diff --git a/app/Markdown/ConfigureHeadingLinks.php b/app/Markdown/ConfigureHeadingLinks.php new file mode 100644 index 00000000..e252c52a --- /dev/null +++ b/app/Markdown/ConfigureHeadingLinks.php @@ -0,0 +1,50 @@ +getDocument()->walker(); + + while ($event = $walker->next()) { + [$paragraph, $heading, $linkOpener, $linkCloser] = [ + $event->getNode(), + $event->getNode()->next(), + $event->getNode()->firstChild(), + $event->getNode()->lastChild(), + ]; + + if ( + ! $heading instanceof Heading || + ! $paragraph instanceof Paragraph || + count($paragraph->children()) !== 2 || + ! $linkOpener instanceof HtmlInline || + ! $linkCloser instanceof HtmlInline || + ! str_starts_with($linkOpener->getLiteral(), '') || + substr_count($linkOpener->getLiteral(), '"') !== 2 || + $paragraph->firstChild()->next() !== $paragraph->lastChild() || + ! str_starts_with($linkCloser->getLiteral(), '') + ) { + continue; + } + + $link = str($linkOpener->getLiteral())->after('')->toString(); + + $heading->data->set('attributes.id', $link); + $heading->prependChild(new HtmlInline('')); + $heading->appendChild(new HtmlInline('')); + + $paragraph->detach(); + + $walker->resumeAt($heading->next()); + } + } +} diff --git a/app/Markdown/GithubFlavoredMarkdownConverter.php b/app/Markdown/GithubFlavoredMarkdownConverter.php index 77aafca7..9aca2267 100644 --- a/app/Markdown/GithubFlavoredMarkdownConverter.php +++ b/app/Markdown/GithubFlavoredMarkdownConverter.php @@ -2,25 +2,19 @@ namespace App\Markdown; -use Illuminate\Support\Str; +use Laravel\Unfenced\UnfencedExtension; +use League\CommonMark\Environment\Environment; +use League\CommonMark\Environment\EnvironmentInterface; +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Extension\Attributes\AttributesExtension; use League\CommonMark\Extension\Autolink\AutolinkExtension; +use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension; +use League\CommonMark\Extension\CommonMark\Node\Block\BlockQuote; use League\CommonMark\Extension\Strikethrough\StrikethroughExtension; use League\CommonMark\Extension\Table\TableExtension; use League\CommonMark\Extension\TaskList\TaskListExtension; use League\CommonMark\MarkdownConverter; -use League\CommonMark\Environment\Environment; -use App\Markdown\GithubFlavoredMarkdownExtension; -use Illuminate\Support\Facades\Vite; -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Util\HtmlElement; use Torchlight\Commonmark\V2\TorchlightExtension; -use Laravel\Unfenced\UnfencedExtension; -use League\CommonMark\Environment\EnvironmentInterface; -use League\CommonMark\Extension\Attributes\AttributesExtension; -use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension; -use League\CommonMark\Extension\CommonMark\Node\Block\BlockQuote; -use League\CommonMark\Renderer\NodeRendererInterface; /** * Converts GitHub Flavored Markdown to HTML. @@ -44,7 +38,8 @@ public function __construct(array $config = []) $environment->addExtension(new AttributesExtension()); $environment->addExtension(new TorchlightExtension()); - $environment->addRenderer(BlockQuote::class, new BlockQuoteRenderer()); + $environment->addRenderer(BlockQuote::class, new BlockQuoteRenderer); + $environment->addEventListener(DocumentParsedEvent::class, new ConfigureHeadingLinks); parent::__construct($environment); } diff --git a/public/build/assets/docs-143568ce.js b/public/build/assets/docs-143568ce.js new file mode 100644 index 00000000..f939dfd5 --- /dev/null +++ b/public/build/assets/docs-143568ce.js @@ -0,0 +1,6 @@ +var J=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function W(y){return y&&y.__esModule&&Object.prototype.hasOwnProperty.call(y,"default")?y.default:y}var R={exports:{}};/*! + * clipboard.js v2.0.10 + * https://clipboardjs.com/ + * + * Licensed MIT © Zeno Rocha + */(function(y,E){(function(h,b){y.exports=b()})(J,function(){return function(){var w={686:function(s,o,t){t.d(o,{default:function(){return G}});var c=t(279),u=t.n(c),f=t(370),g=t.n(f),v=t(817),S=t.n(v);function d(i){try{return document.execCommand(i)}catch{return!1}}var m=function(n){var e=S()(n);return d("cut"),e},p=m;function _(i){var n=document.documentElement.getAttribute("dir")==="rtl",e=document.createElement("textarea");e.style.fontSize="12pt",e.style.border="0",e.style.padding="0",e.style.margin="0",e.style.position="absolute",e.style[n?"right":"left"]="-9999px";var a=window.pageYOffset||document.documentElement.scrollTop;return e.style.top="".concat(a,"px"),e.setAttribute("readonly",""),e.value=i,e}var j=function(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body},a="";if(typeof n=="string"){var r=_(n);e.container.appendChild(r),a=S()(r),d("copy"),r.remove()}else a=S()(n),d("copy");return a},O=j;function A(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?A=function(e){return typeof e}:A=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},A(i)}var H=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=n.action,a=e===void 0?"copy":e,r=n.container,l=n.target,T=n.text;if(a!=="copy"&&a!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"');if(l!==void 0)if(l&&A(l)==="object"&&l.nodeType===1){if(a==="copy"&&l.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(a==="cut"&&(l.hasAttribute("readonly")||l.hasAttribute("disabled")))throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`)}else throw new Error('Invalid "target" value, use a valid Element');if(T)return O(T,{container:r});if(l)return a==="cut"?p(l):O(l,{container:r})},z=H;function C(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?C=function(e){return typeof e}:C=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},C(i)}function q(i,n){if(!(i instanceof n))throw new TypeError("Cannot call a class as a function")}function D(i,n){for(var e=0;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function L(i){return L=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},L(i)}function k(i,n){var e="data-clipboard-".concat(i);if(n.hasAttribute(e))return n.getAttribute(e)}var Y=function(i){F(e,i);var n=I(e);function e(a,r){var l;return q(this,e),l=n.call(this),l.resolveOptions(r),l.listenClick(a),l}return B(e,[{key:"resolveOptions",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof r.action=="function"?r.action:this.defaultAction,this.target=typeof r.target=="function"?r.target:this.defaultTarget,this.text=typeof r.text=="function"?r.text:this.defaultText,this.container=C(r.container)==="object"?r.container:document.body}},{key:"listenClick",value:function(r){var l=this;this.listener=g()(r,"click",function(T){return l.onClick(T)})}},{key:"onClick",value:function(r){var l=r.delegateTarget||r.currentTarget,T=this.action(l)||"copy",x=z({action:T,container:this.container,target:this.target(l),text:this.text(l)});this.emit(x?"success":"error",{action:T,text:x,trigger:l,clearSelection:function(){l&&l.focus(),document.activeElement.blur(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(r){return k("action",r)}},{key:"defaultTarget",value:function(r){var l=k("target",r);if(l)return document.querySelector(l)}},{key:"defaultText",value:function(r){return k("text",r)}},{key:"destroy",value:function(){this.listener.destroy()}}],[{key:"copy",value:function(r){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body};return O(r,l)}},{key:"cut",value:function(r){return p(r)}},{key:"isSupported",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],l=typeof r=="string"?[r]:r,T=!!document.queryCommandSupported;return l.forEach(function(x){T=T&&!!document.queryCommandSupported(x)}),T}}]),e}(u()),G=Y},828:function(s){var o=9;if(typeof Element<"u"&&!Element.prototype.matches){var t=Element.prototype;t.matches=t.matchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector||t.webkitMatchesSelector}function c(u,f){for(;u&&u.nodeType!==o;){if(typeof u.matches=="function"&&u.matches(f))return u;u=u.parentNode}}s.exports=c},438:function(s,o,t){var c=t(828);function u(v,S,d,m,p){var _=g.apply(this,arguments);return v.addEventListener(d,_,p),{destroy:function(){v.removeEventListener(d,_,p)}}}function f(v,S,d,m,p){return typeof v.addEventListener=="function"?u.apply(null,arguments):typeof d=="function"?u.bind(null,document).apply(null,arguments):(typeof v=="string"&&(v=document.querySelectorAll(v)),Array.prototype.map.call(v,function(_){return u(_,S,d,m,p)}))}function g(v,S,d,m){return function(p){p.delegateTarget=c(p.target,S),p.delegateTarget&&m.call(v,p)}}s.exports=f},879:function(s,o){o.node=function(t){return t!==void 0&&t instanceof HTMLElement&&t.nodeType===1},o.nodeList=function(t){var c=Object.prototype.toString.call(t);return t!==void 0&&(c==="[object NodeList]"||c==="[object HTMLCollection]")&&"length"in t&&(t.length===0||o.node(t[0]))},o.string=function(t){return typeof t=="string"||t instanceof String},o.fn=function(t){var c=Object.prototype.toString.call(t);return c==="[object Function]"}},370:function(s,o,t){var c=t(879),u=t(438);function f(d,m,p){if(!d&&!m&&!p)throw new Error("Missing required arguments");if(!c.string(m))throw new TypeError("Second argument must be a String");if(!c.fn(p))throw new TypeError("Third argument must be a Function");if(c.node(d))return g(d,m,p);if(c.nodeList(d))return v(d,m,p);if(c.string(d))return S(d,m,p);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function g(d,m,p){return d.addEventListener(m,p),{destroy:function(){d.removeEventListener(m,p)}}}function v(d,m,p){return Array.prototype.forEach.call(d,function(_){_.addEventListener(m,p)}),{destroy:function(){Array.prototype.forEach.call(d,function(_){_.removeEventListener(m,p)})}}}function S(d,m,p){return u(document.body,d,m,p)}s.exports=f},817:function(s){function o(t){var c;if(t.nodeName==="SELECT")t.focus(),c=t.value;else if(t.nodeName==="INPUT"||t.nodeName==="TEXTAREA"){var u=t.hasAttribute("readonly");u||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),u||t.removeAttribute("readonly"),c=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var f=window.getSelection(),g=document.createRange();g.selectNodeContents(t),f.removeAllRanges(),f.addRange(g),c=f.toString()}return c}s.exports=o},279:function(s){function o(){}o.prototype={on:function(t,c,u){var f=this.e||(this.e={});return(f[t]||(f[t]=[])).push({fn:c,ctx:u}),this},once:function(t,c,u){var f=this;function g(){f.off(t,g),c.apply(u,arguments)}return g._=c,this.on(t,g,u)},emit:function(t){var c=[].slice.call(arguments,1),u=((this.e||(this.e={}))[t]||[]).slice(),f=0,g=u.length;for(f;f',Q='';let Z=document.querySelectorAll("#main-content pre");Z.forEach((y,E)=>{var w=document.createElement("div");["relative","code-block-wrapper"].forEach(o=>{w.classList.add(o)}),y.parentNode.insertBefore(w,y),w.appendChild(y);let h=document.createElement("button");h.innerHTML=N,h.id=`clipButton-${E}`,["md:block","hidden"].forEach(o=>{h.classList.add(o)}),h.setAttribute("aria-label","Copy to Clipboard"),h.setAttribute("title","Copy to Clipboard"),h.classList.add("copyBtn"),w.appendChild(h),new K(`#${h.id}`).on("success",o=>{h.innerHTML=Q,o.clearSelection(),setTimeout(()=>{h.innerHTML=N},1500)});let s=y.querySelector("code");s.id=`clipText-${E}`,h.dataset.clipboardTarget=`#${s.id}`});window.toDarkMode=()=>{localStorage.theme="dark",window.updateTheme()};window.toLightMode=()=>{localStorage.theme="light",window.updateTheme()};window.toSystemMode=()=>{localStorage.theme="system",window.updateTheme()};window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",y=>{localStorage.theme==="system"&&(y.matches?(document.documentElement.classList.add("dark"),document.documentElement.setAttribute("data-theme","dark")):(document.documentElement.classList.remove("dark"),document.documentElement.setAttribute("data-theme","light"))),updateThemeAndSchemeColor()});document.addEventListener("DOMContentLoaded",()=>{tt(),et();const y=document.querySelector("#skip-to-content-link"),E=document.querySelector("#main-content");y.addEventListener("click",w=>{w.preventDefault(),E.setAttribute("tabindex",-1),E.focus()}),E.addEventListener("blur",()=>{E.removeAttribute("tabindex")})});function tt(){[...document.querySelectorAll(".docs_sidebar h2")].forEach(y=>{y.addEventListener("click",E=>{E.preventDefault();const w=y.parentNode.classList.contains("sub--on");[...document.querySelectorAll(".docs_sidebar ul li")].forEach(h=>h.classList.remove("sub--on")),w||y.parentNode.classList.add("sub--on")})})}function et(){function y(h){const b=new Date().valueOf();Array.from(h.rows).forEach((s,o)=>{if(o>0){const t=s.cells,c=t[0],u=P(t[t.length-2]),f=P(t[t.length-1]);b>f?c.classList.add("bg-red-500","support-policy-highlight"):b<=f&&b>u&&c.classList.add("bg-orange-600","support-policy-highlight")}})}const E=document.querySelector(".docs_main #support-policy ~ div table:first-of-type");if(E){y(E);return}const w=document.querySelector(".docs_main #support-policy ~ table:first-of-type");w&&y(w)}function P(y){return Date.parse(y.innerHTML.replace(/(\d+)(st|nd|rd|th)/,"$1"))} diff --git a/public/build/assets/docs-8564cabe.js b/public/build/assets/docs-8564cabe.js deleted file mode 100644 index 63e1dd00..00000000 --- a/public/build/assets/docs-8564cabe.js +++ /dev/null @@ -1,6 +0,0 @@ -var J=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function W(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")?u.default:u}var R={exports:{}};/*! - * clipboard.js v2.0.10 - * https://clipboardjs.com/ - * - * Licensed MIT © Zeno Rocha - */(function(u,b){(function(h,E){u.exports=E()})(J,function(){return function(){var w={686:function(f,o,t){t.d(o,{default:function(){return G}});var c=t(279),l=t.n(c),d=t(370),g=t.n(d),v=t(817),S=t.n(v);function p(i){try{return document.execCommand(i)}catch{return!1}}var m=function(n){var e=S()(n);return p("cut"),e},y=m;function _(i){var n=document.documentElement.getAttribute("dir")==="rtl",e=document.createElement("textarea");e.style.fontSize="12pt",e.style.border="0",e.style.padding="0",e.style.margin="0",e.style.position="absolute",e.style[n?"right":"left"]="-9999px";var a=window.pageYOffset||document.documentElement.scrollTop;return e.style.top="".concat(a,"px"),e.setAttribute("readonly",""),e.value=i,e}var H=function(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body},a="";if(typeof n=="string"){var r=_(n);e.container.appendChild(r),a=S()(r),p("copy"),r.remove()}else a=S()(n),p("copy");return a},O=H;function A(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?A=function(e){return typeof e}:A=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},A(i)}var j=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=n.action,a=e===void 0?"copy":e,r=n.container,s=n.target,T=n.text;if(a!=="copy"&&a!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"');if(s!==void 0)if(s&&A(s)==="object"&&s.nodeType===1){if(a==="copy"&&s.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(a==="cut"&&(s.hasAttribute("readonly")||s.hasAttribute("disabled")))throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`)}else throw new Error('Invalid "target" value, use a valid Element');if(T)return O(T,{container:r});if(s)return a==="cut"?y(s):O(s,{container:r})},q=j;function C(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?C=function(e){return typeof e}:C=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},C(i)}function z(i,n){if(!(i instanceof n))throw new TypeError("Cannot call a class as a function")}function N(i,n){for(var e=0;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function x(i){return x=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},x(i)}function k(i,n){var e="data-clipboard-".concat(i);if(n.hasAttribute(e))return n.getAttribute(e)}var Y=function(i){I(e,i);var n=$(e);function e(a,r){var s;return z(this,e),s=n.call(this),s.resolveOptions(r),s.listenClick(a),s}return B(e,[{key:"resolveOptions",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof r.action=="function"?r.action:this.defaultAction,this.target=typeof r.target=="function"?r.target:this.defaultTarget,this.text=typeof r.text=="function"?r.text:this.defaultText,this.container=C(r.container)==="object"?r.container:document.body}},{key:"listenClick",value:function(r){var s=this;this.listener=g()(r,"click",function(T){return s.onClick(T)})}},{key:"onClick",value:function(r){var s=r.delegateTarget||r.currentTarget,T=this.action(s)||"copy",L=q({action:T,container:this.container,target:this.target(s),text:this.text(s)});this.emit(L?"success":"error",{action:T,text:L,trigger:s,clearSelection:function(){s&&s.focus(),document.activeElement.blur(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(r){return k("action",r)}},{key:"defaultTarget",value:function(r){var s=k("target",r);if(s)return document.querySelector(s)}},{key:"defaultText",value:function(r){return k("text",r)}},{key:"destroy",value:function(){this.listener.destroy()}}],[{key:"copy",value:function(r){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body};return O(r,s)}},{key:"cut",value:function(r){return y(r)}},{key:"isSupported",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],s=typeof r=="string"?[r]:r,T=!!document.queryCommandSupported;return s.forEach(function(L){T=T&&!!document.queryCommandSupported(L)}),T}}]),e}(l()),G=Y},828:function(f){var o=9;if(typeof Element<"u"&&!Element.prototype.matches){var t=Element.prototype;t.matches=t.matchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector||t.webkitMatchesSelector}function c(l,d){for(;l&&l.nodeType!==o;){if(typeof l.matches=="function"&&l.matches(d))return l;l=l.parentNode}}f.exports=c},438:function(f,o,t){var c=t(828);function l(v,S,p,m,y){var _=g.apply(this,arguments);return v.addEventListener(p,_,y),{destroy:function(){v.removeEventListener(p,_,y)}}}function d(v,S,p,m,y){return typeof v.addEventListener=="function"?l.apply(null,arguments):typeof p=="function"?l.bind(null,document).apply(null,arguments):(typeof v=="string"&&(v=document.querySelectorAll(v)),Array.prototype.map.call(v,function(_){return l(_,S,p,m,y)}))}function g(v,S,p,m){return function(y){y.delegateTarget=c(y.target,S),y.delegateTarget&&m.call(v,y)}}f.exports=d},879:function(f,o){o.node=function(t){return t!==void 0&&t instanceof HTMLElement&&t.nodeType===1},o.nodeList=function(t){var c=Object.prototype.toString.call(t);return t!==void 0&&(c==="[object NodeList]"||c==="[object HTMLCollection]")&&"length"in t&&(t.length===0||o.node(t[0]))},o.string=function(t){return typeof t=="string"||t instanceof String},o.fn=function(t){var c=Object.prototype.toString.call(t);return c==="[object Function]"}},370:function(f,o,t){var c=t(879),l=t(438);function d(p,m,y){if(!p&&!m&&!y)throw new Error("Missing required arguments");if(!c.string(m))throw new TypeError("Second argument must be a String");if(!c.fn(y))throw new TypeError("Third argument must be a Function");if(c.node(p))return g(p,m,y);if(c.nodeList(p))return v(p,m,y);if(c.string(p))return S(p,m,y);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function g(p,m,y){return p.addEventListener(m,y),{destroy:function(){p.removeEventListener(m,y)}}}function v(p,m,y){return Array.prototype.forEach.call(p,function(_){_.addEventListener(m,y)}),{destroy:function(){Array.prototype.forEach.call(p,function(_){_.removeEventListener(m,y)})}}}function S(p,m,y){return l(document.body,p,m,y)}f.exports=d},817:function(f){function o(t){var c;if(t.nodeName==="SELECT")t.focus(),c=t.value;else if(t.nodeName==="INPUT"||t.nodeName==="TEXTAREA"){var l=t.hasAttribute("readonly");l||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),l||t.removeAttribute("readonly"),c=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var d=window.getSelection(),g=document.createRange();g.selectNodeContents(t),d.removeAllRanges(),d.addRange(g),c=d.toString()}return c}f.exports=o},279:function(f){function o(){}o.prototype={on:function(t,c,l){var d=this.e||(this.e={});return(d[t]||(d[t]=[])).push({fn:c,ctx:l}),this},once:function(t,c,l){var d=this;function g(){d.off(t,g),c.apply(l,arguments)}return g._=c,this.on(t,g,l)},emit:function(t){var c=[].slice.call(arguments,1),l=((this.e||(this.e={}))[t]||[]).slice(),d=0,g=l.length;for(d;d',Q='';let Z=document.querySelectorAll("#main-content pre");Z.forEach((u,b)=>{var w=document.createElement("div");["relative","code-block-wrapper"].forEach(o=>{w.classList.add(o)}),u.parentNode.insertBefore(w,u),w.appendChild(u);let h=document.createElement("button");h.innerHTML=D,h.id=`clipButton-${b}`,["md:block","hidden"].forEach(o=>{h.classList.add(o)}),h.setAttribute("aria-label","Copy to Clipboard"),h.setAttribute("title","Copy to Clipboard"),h.classList.add("copyBtn"),w.appendChild(h),new K(`#${h.id}`).on("success",o=>{h.innerHTML=Q,o.clearSelection(),setTimeout(()=>{h.innerHTML=D},1500)});let f=u.querySelector("code");f.id=`clipText-${b}`,h.dataset.clipboardTarget=`#${f.id}`});window.toDarkMode=()=>{localStorage.theme="dark",window.updateTheme()};window.toLightMode=()=>{localStorage.theme="light",window.updateTheme()};window.toSystemMode=()=>{localStorage.theme="system",window.updateTheme()};window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",u=>{localStorage.theme==="system"&&(u.matches?(document.documentElement.classList.add("dark"),document.documentElement.setAttribute("data-theme","dark")):(document.documentElement.classList.remove("dark"),document.documentElement.setAttribute("data-theme","light"))),updateThemeAndSchemeColor()});document.addEventListener("DOMContentLoaded",()=>{tt(),et(),nt();const u=document.querySelector("#skip-to-content-link"),b=document.querySelector("#main-content");u.addEventListener("click",w=>{w.preventDefault(),b.setAttribute("tabindex",-1),b.focus()}),b.addEventListener("blur",()=>{b.removeAttribute("tabindex")})});function tt(){[...document.querySelector(".docs_main").querySelectorAll("a[name]")].forEach(u=>{const b=u.parentNode.nextElementSibling;b.id=u.name,u.href=`#${u.name}`,u.removeAttribute("name"),[...b.childNodes].forEach(w=>u.appendChild(w)),b.appendChild(u)})}function et(){[...document.querySelectorAll(".docs_sidebar h2")].forEach(u=>{u.addEventListener("click",b=>{b.preventDefault();const w=u.parentNode.classList.contains("sub--on");[...document.querySelectorAll(".docs_sidebar ul li")].forEach(h=>h.classList.remove("sub--on")),w||u.parentNode.classList.add("sub--on")})})}function nt(){function u(h){const E=new Date().valueOf();Array.from(h.rows).forEach((f,o)=>{if(o>0){const t=f.cells,c=t[0],l=P(t[t.length-2]),d=P(t[t.length-1]);E>d?c.classList.add("bg-red-500","support-policy-highlight"):E<=d&&E>l&&c.classList.add("bg-orange-600","support-policy-highlight")}})}const b=document.querySelector(".docs_main #support-policy ~ div table:first-of-type");if(b){u(b);return}const w=document.querySelector(".docs_main #support-policy ~ table:first-of-type");w&&u(w)}function P(u){return Date.parse(u.innerHTML.replace(/(\d+)(st|nd|rd|th)/,"$1"))} diff --git a/public/build/manifest.json b/public/build/manifest.json index c6bb8485..fcab2f1a 100644 --- a/public/build/manifest.json +++ b/public/build/manifest.json @@ -54,7 +54,7 @@ "src": "resources/js/app.js" }, "resources/js/docs.js": { - "file": "assets/docs-8564cabe.js", + "file": "assets/docs-143568ce.js", "isEntry": true, "src": "resources/js/docs.js" } diff --git a/resources/js/docs.js b/resources/js/docs.js index 1ecc2fdc..0da42dc7 100644 --- a/resources/js/docs.js +++ b/resources/js/docs.js @@ -2,7 +2,6 @@ import './clipboard'; import './theme' document.addEventListener('DOMContentLoaded', () => { - wrapHeadingsInAnchors(); setupNavCurrentLinkHandling(); highlightSupportPolicyTable(); @@ -20,17 +19,6 @@ document.addEventListener('DOMContentLoaded', () => { }); }) -function wrapHeadingsInAnchors() { - [...document.querySelector('.docs_main').querySelectorAll('a[name]')].forEach(anchor => { - const heading = anchor.parentNode.nextElementSibling; - heading.id = anchor.name; - anchor.href = `#${anchor.name}`; - anchor.removeAttribute('name'); - [...heading.childNodes].forEach(node => anchor.appendChild(node)); - heading.appendChild(anchor); - }); -} - function setupNavCurrentLinkHandling() { [...document.querySelectorAll('.docs_sidebar h2')].forEach(el => { el.addEventListener('click', (e) => {