vanilla-breeze 0.5.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +23071 -13897
- package/dist/cdn/components/accordion-wc.js +1 -1
- package/dist/cdn/components/activity-feed.js +1 -1
- package/dist/cdn/components/ai-chat.js +5 -5
- package/dist/cdn/components/ai-summary.js +2 -2
- package/dist/cdn/components/analytics-panel.js +2 -2
- package/dist/cdn/components/audio-player.js +4 -4
- package/dist/cdn/components/audio-visualizer.js +2 -2
- package/dist/cdn/components/author-index.js +2 -2
- package/dist/cdn/components/brand-mark.js +1 -1
- package/dist/cdn/components/bread-crumb.js +1 -1
- package/dist/cdn/components/calendar-wc.js +2 -2
- package/dist/cdn/components/card-list.js +1 -1
- package/dist/cdn/components/carousel-wc.js +1 -1
- package/dist/cdn/components/change-set.js +1 -1
- package/dist/cdn/components/chart-wc.js +56 -32
- package/dist/cdn/components/chat-input.js +1 -1
- package/dist/cdn/components/chat-window.js +1 -1
- package/dist/cdn/components/color-picker.js +1 -1
- package/dist/cdn/components/combo-box.js +1 -1
- package/dist/cdn/components/command-palette.js +1 -1
- package/dist/cdn/components/comment-box.js +51 -50
- package/dist/cdn/components/comment-thread.js +50 -49
- package/dist/cdn/components/comment-wc.js +1 -1
- package/dist/cdn/components/compare-surface.js +1 -1
- package/dist/cdn/components/consent-banner.js +1 -1
- package/dist/cdn/components/content-lens.js +1 -1
- package/dist/cdn/components/content-swap.js +1 -1
- package/dist/cdn/components/context-menu.js +1 -1
- package/dist/cdn/components/data-table.js +1 -1
- package/dist/cdn/components/date-picker.js +1 -1
- package/dist/cdn/components/day-view.js +1 -1
- package/dist/cdn/components/diagram-wc.js +2 -2
- package/dist/cdn/components/drag-surface.js +1 -1
- package/dist/cdn/components/drop-down.js +1 -1
- package/dist/cdn/components/emoji-picker.js +1 -1
- package/dist/cdn/components/flow-diagram.js +1 -1
- package/dist/cdn/components/foot-notes.js +1 -1
- package/dist/cdn/components/form-field.js +1 -1
- package/dist/cdn/components/geo-map.js +170 -54
- package/dist/cdn/components/glossary-index.js +1 -1
- package/dist/cdn/components/glossary-wc.js +1 -1
- package/dist/cdn/components/heading-links.js +1 -1
- package/dist/cdn/components/highlight-wc.js +6 -2
- package/dist/cdn/components/icon-wc.js +11 -10
- package/dist/cdn/components/image-gallery.js +1 -1
- package/dist/cdn/components/image-map.js +1 -1
- package/dist/cdn/components/include-file.js +1 -1
- package/dist/cdn/components/manifest.json +101 -101
- package/dist/cdn/components/markdown-editor.js +60 -1
- package/dist/cdn/components/markdown-viewer.js +50 -49
- package/dist/cdn/components/nav-bar.js +1 -1
- package/dist/cdn/components/note-wc.js +6 -2
- package/dist/cdn/components/notification-wc.js +33 -32
- package/dist/cdn/components/page-info.js +6 -72
- package/dist/cdn/components/page-stats.js +1 -1
- package/dist/cdn/components/page-toc.js +1 -1
- package/dist/cdn/components/page-tools.js +1 -1
- package/dist/cdn/components/page-tour.js +1 -38
- package/dist/cdn/components/pager-wc.js +1 -1
- package/dist/cdn/components/poll-wc.js +1 -1
- package/dist/cdn/components/pop-over.js +1 -1
- package/dist/cdn/components/popularity-index.js +1 -8
- package/dist/cdn/components/print-page.js +1 -1
- package/dist/cdn/components/progress-tracker.js +1 -1
- package/dist/cdn/components/qr-code.js +1 -1
- package/dist/cdn/components/reaction-bar.js +1 -1
- package/dist/cdn/components/reader-view.js +25 -25
- package/dist/cdn/components/reading-progress.js +1 -1
- package/dist/cdn/components/recently-visited.js +1 -26
- package/dist/cdn/components/score-card.js +21 -5
- package/dist/cdn/components/selection-menu.js +1 -1
- package/dist/cdn/components/settings-panel.js +88 -142
- package/dist/cdn/components/share-wc.js +2 -2
- package/dist/cdn/components/short-cuts.js +1 -1
- package/dist/cdn/components/site-index.js +1 -10
- package/dist/cdn/components/site-map.js +1 -1
- package/dist/cdn/components/site-search.js +1 -51
- package/dist/cdn/components/slide-accept.js +1 -1
- package/dist/cdn/components/social-embed.js +1 -1
- package/dist/cdn/components/split-surface.js +1 -1
- package/dist/cdn/components/star-rating.js +1 -1
- package/dist/cdn/components/status-wc.js +1 -1
- package/dist/cdn/components/stepper-wc.js +1 -1
- package/dist/cdn/components/tab-set.js +1 -1
- package/dist/cdn/components/text-reader.js +2 -2
- package/dist/cdn/components/theme-picker.js +86 -83
- package/dist/cdn/components/time-index.js +1 -11
- package/dist/cdn/components/time-picker.js +1 -1
- package/dist/cdn/components/toast-msg.js +6 -6
- package/dist/cdn/components/tool-tip.js +1 -1
- package/dist/cdn/components/topic-map.js +6 -3
- package/dist/cdn/components/trust-filter.js +1 -3
- package/dist/cdn/components/version-switcher.js +5 -5
- package/dist/cdn/components/video-player.js +67 -9
- package/dist/cdn/components/watch-wc.js +6 -2
- package/dist/cdn/components/week-view.js +1 -1
- package/dist/cdn/components/youtube-player.js +1 -1
- package/dist/cdn/emoji-extended.js +2 -0
- package/dist/cdn/fonts/atkinson-hyperlegible-OFL.txt +93 -0
- package/dist/cdn/fonts/atkinson-hyperlegible-latin-400-italic.woff2 +0 -0
- package/dist/cdn/fonts/atkinson-hyperlegible-latin-400-normal.woff2 +0 -0
- package/dist/cdn/fonts/atkinson-hyperlegible-latin-700-italic.woff2 +0 -0
- package/dist/cdn/fonts/atkinson-hyperlegible-latin-700-normal.woff2 +0 -0
- package/dist/cdn/fonts/atkinson-hyperlegible-latin-ext-400-italic.woff2 +0 -0
- package/dist/cdn/fonts/atkinson-hyperlegible-latin-ext-400-normal.woff2 +0 -0
- package/dist/cdn/fonts/atkinson-hyperlegible-latin-ext-700-italic.woff2 +0 -0
- package/dist/cdn/fonts/atkinson-hyperlegible-latin-ext-700-normal.woff2 +0 -0
- package/dist/cdn/fonts/latinmodern-math-GUST-LICENSE.txt +30 -0
- package/dist/cdn/fonts/latinmodern-math.woff2 +0 -0
- package/dist/cdn/fonts/math-fonts.css +14 -0
- package/dist/cdn/packs/effects.full.css +1 -1
- package/dist/cdn/packs/effects.full.js +1 -1
- package/dist/cdn/packs/fonts-display.full.css +1 -1
- package/dist/cdn/packs/fonts-display.theme.css +1 -1
- package/dist/cdn/packs/icons.bundle.js +1 -1
- package/dist/cdn/packs/icons.full.css +1 -1
- package/dist/cdn/packs/icons.theme.css +1 -1
- package/dist/cdn/packs/journal.effects.css +1 -1
- package/dist/cdn/packs/journal.full.css +1 -1
- package/dist/cdn/packs/kawaii.effects.css +1 -1
- package/dist/cdn/packs/kawaii.full.css +2 -2
- package/dist/cdn/packs/kawaii.full.js +4 -4
- package/dist/cdn/packs/kawaii.theme.css +1 -1
- package/dist/cdn/packs/manifest.json +17 -17
- package/dist/cdn/packs/memphis.full.css +1 -1
- package/dist/cdn/packs/memphis.theme.css +1 -1
- package/dist/cdn/packs/ui.full.css +1 -1
- package/dist/cdn/packs/ui.full.js +89 -86
- package/dist/cdn/themes/8bit.css +1 -1
- package/dist/cdn/themes/8bit.tokens.json +1 -1
- package/dist/cdn/themes/alpha1999-dark.tokens.json +1 -1
- package/dist/cdn/themes/alpha1999.css +1 -1
- package/dist/cdn/themes/alpha1999.tokens.json +1 -1
- package/dist/cdn/themes/art-deco-dark.tokens.json +1 -1
- package/dist/cdn/themes/art-deco.css +1 -1
- package/dist/cdn/themes/art-deco.tokens.json +1 -1
- package/dist/cdn/themes/bauhaus-dark.tokens.json +1 -1
- package/dist/cdn/themes/bauhaus.css +1 -1
- package/dist/cdn/themes/bauhaus.tokens.json +1 -1
- package/dist/cdn/themes/brutalist-dark.tokens.json +1 -1
- package/dist/cdn/themes/brutalist.css +1 -1
- package/dist/cdn/themes/brutalist.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-frappe.css +1 -1
- package/dist/cdn/themes/catppuccin-frappe.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-latte-dark.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-latte.css +1 -1
- package/dist/cdn/themes/catppuccin-latte.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-macchiato.css +1 -1
- package/dist/cdn/themes/catppuccin-macchiato.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-mocha.css +1 -1
- package/dist/cdn/themes/catppuccin-mocha.tokens.json +1 -1
- package/dist/cdn/themes/classic-dark.tokens.json +1 -1
- package/dist/cdn/themes/classic.css +1 -1
- package/dist/cdn/themes/classic.tokens.json +1 -1
- package/dist/cdn/themes/claymorphism-dark.tokens.json +1 -1
- package/dist/cdn/themes/claymorphism.css +1 -1
- package/dist/cdn/themes/claymorphism.tokens.json +2 -1
- package/dist/cdn/themes/clinical-dark.tokens.json +1 -1
- package/dist/cdn/themes/clinical.css +1 -1
- package/dist/cdn/themes/clinical.tokens.json +1 -1
- package/dist/cdn/themes/cottagecore-dark.tokens.json +1 -1
- package/dist/cdn/themes/cottagecore.css +1 -1
- package/dist/cdn/themes/cottagecore.tokens.json +1 -1
- package/dist/cdn/themes/cyber.css +1 -1
- package/dist/cdn/themes/cyber.tokens.json +1 -1
- package/dist/cdn/themes/dawn-dark.tokens.json +1 -1
- package/dist/cdn/themes/dawn.css +1 -1
- package/dist/cdn/themes/dawn.tokens.json +1 -1
- package/dist/cdn/themes/dracula.css +1 -1
- package/dist/cdn/themes/dracula.tokens.json +1 -1
- package/dist/cdn/themes/dusk.css +1 -1
- package/dist/cdn/themes/dusk.tokens.json +1 -1
- package/dist/cdn/themes/editorial-dark.tokens.json +1 -1
- package/dist/cdn/themes/editorial.css +1 -1
- package/dist/cdn/themes/editorial.tokens.json +1 -1
- package/dist/cdn/themes/financial-dark.tokens.json +1 -1
- package/dist/cdn/themes/financial.css +1 -1
- package/dist/cdn/themes/financial.tokens.json +1 -1
- package/dist/cdn/themes/genai.css +1 -1
- package/dist/cdn/themes/genai.tokens.json +1 -1
- package/dist/cdn/themes/glassmorphism-dark.tokens.json +1 -1
- package/dist/cdn/themes/glassmorphism.css +1 -1
- package/dist/cdn/themes/glassmorphism.tokens.json +1 -1
- package/dist/cdn/themes/government-dark.tokens.json +1 -1
- package/dist/cdn/themes/government.css +1 -1
- package/dist/cdn/themes/government.tokens.json +1 -1
- package/dist/cdn/themes/gruvbox-dark.tokens.json +1 -1
- package/dist/cdn/themes/gruvbox.css +1 -1
- package/dist/cdn/themes/gruvbox.tokens.json +1 -1
- package/dist/cdn/themes/high-noon-dark.tokens.json +1 -1
- package/dist/cdn/themes/high-noon.css +1 -1
- package/dist/cdn/themes/high-noon.tokens.json +1 -1
- package/dist/cdn/themes/journal-dark.tokens.json +4 -2
- package/dist/cdn/themes/journal.css +1 -1
- package/dist/cdn/themes/journal.tokens.json +4 -2
- package/dist/cdn/themes/kawaii-dark.tokens.json +1 -1
- package/dist/cdn/themes/kawaii.css +1 -1
- package/dist/cdn/themes/kawaii.tokens.json +1 -1
- package/dist/cdn/themes/magna-dark.tokens.json +1 -1
- package/dist/cdn/themes/magna.css +1 -1
- package/dist/cdn/themes/magna.tokens.json +1 -1
- package/dist/cdn/themes/manifest.json +44 -44
- package/dist/cdn/themes/midnight.css +1 -1
- package/dist/cdn/themes/midnight.tokens.json +1 -1
- package/dist/cdn/themes/minimal-dark.tokens.json +1 -1
- package/dist/cdn/themes/minimal.css +1 -1
- package/dist/cdn/themes/minimal.tokens.json +1 -1
- package/dist/cdn/themes/modern-dark.tokens.json +1 -1
- package/dist/cdn/themes/modern.css +1 -1
- package/dist/cdn/themes/modern.tokens.json +1 -1
- package/dist/cdn/themes/nes-dark.tokens.json +7 -2
- package/dist/cdn/themes/nes.css +1 -1
- package/dist/cdn/themes/nes.tokens.json +1 -1
- package/dist/cdn/themes/neumorphism-dark.tokens.json +1 -1
- package/dist/cdn/themes/neumorphism.css +1 -1
- package/dist/cdn/themes/neumorphism.tokens.json +1 -1
- package/dist/cdn/themes/nord-dark.tokens.json +1 -1
- package/dist/cdn/themes/nord.css +1 -1
- package/dist/cdn/themes/nord.tokens.json +1 -1
- package/dist/cdn/themes/organic-dark.tokens.json +1 -1
- package/dist/cdn/themes/organic.css +1 -1
- package/dist/cdn/themes/organic.tokens.json +1 -1
- package/dist/cdn/themes/rose-pine-dark.tokens.json +1 -1
- package/dist/cdn/themes/rose-pine.css +1 -1
- package/dist/cdn/themes/rose-pine.tokens.json +1 -1
- package/dist/cdn/themes/rough-dark.tokens.json +1 -1
- package/dist/cdn/themes/rough.css +1 -1
- package/dist/cdn/themes/rough.tokens.json +1 -1
- package/dist/cdn/themes/solarized-dark.tokens.json +1 -1
- package/dist/cdn/themes/solarized.css +1 -1
- package/dist/cdn/themes/solarized.tokens.json +1 -1
- package/dist/cdn/themes/startup-dark.tokens.json +1 -1
- package/dist/cdn/themes/startup.css +1 -1
- package/dist/cdn/themes/startup.tokens.json +1 -1
- package/dist/cdn/themes/super2026-dark.tokens.json +1 -1
- package/dist/cdn/themes/super2026.css +1 -1
- package/dist/cdn/themes/super2026.tokens.json +1 -1
- package/dist/cdn/themes/swiss-dark.tokens.json +1 -1
- package/dist/cdn/themes/swiss.css +1 -1
- package/dist/cdn/themes/swiss.tokens.json +1 -1
- package/dist/cdn/themes/terminal.css +1 -1
- package/dist/cdn/themes/terminal.tokens.json +1 -1
- package/dist/cdn/themes/tokyo-night-dark.tokens.json +1 -1
- package/dist/cdn/themes/tokyo-night.css +1 -1
- package/dist/cdn/themes/tokyo-night.tokens.json +1 -1
- package/dist/cdn/themes/vaporwave-dark.tokens.json +1 -1
- package/dist/cdn/themes/vaporwave.css +1 -1
- package/dist/cdn/themes/vaporwave.tokens.json +1 -1
- package/dist/cdn/themes/win9x-dark.tokens.json +6 -2
- package/dist/cdn/themes/win9x.css +1 -1
- package/dist/cdn/themes/win9x.tokens.json +3 -1
- package/dist/cdn/vanilla-breeze-autoload.js +187 -297
- package/dist/cdn/vanilla-breeze-charts.css +1 -1
- package/dist/cdn/vanilla-breeze-charts.js +56 -32
- package/dist/cdn/vanilla-breeze-core.css +1 -1
- package/dist/cdn/vanilla-breeze-core.js +166 -262
- package/dist/cdn/vanilla-breeze-dev.js +1 -1
- package/dist/cdn/vanilla-breeze-extras.js +272 -130
- package/dist/cdn/vanilla-breeze.css +1 -1
- package/dist/cdn/vanilla-breeze.js +536 -621
- package/dist/cdn/view-transitions.css +2 -0
- package/package.json +15 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var U=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;function w(i,e,t={}){let n=t.priority??10,r={impl:e,bundle:t.bundle,contract:t.contract,priority:n},a=v.get(i);if(customElements.get(i)){if(!a||a.priority>=n){a&&a.priority===n&&a.impl!==e&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${a.bundle}" (priority ${a.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${a.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(a&&a.priority>=n){a.priority===n&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${a.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}v.set(i,r),customElements.define(i,e)}var h=class extends HTMLElement{#t=[];#i;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#t)e();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,t,n,r){e.addEventListener(t,n,r),this.#t.push(()=>e.removeEventListener(t,n,r))}_reinit(){for(let e of this.#t)e();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(e,t){this.#i||(this.#i=this.attachInternals());let n=this.#i.states;try{t?n.add(e):n.delete(e)}catch{let r=`--${e}`;t?n.add(r):n.delete(r)}}_adoptInternals(e){this.#i||(this.#i=e)}#n(){return this.constructor.formAssociated&&this.#i?this.#i:null}get validity(){return this.#n()?.validity}get validationMessage(){return this.#n()?.validationMessage??""}get willValidate(){return this.#n()?.willValidate??!1}get form(){return this.#n()?.form??null}checkValidity(){return this.#n()?.checkValidity()??!0}reportValidity(){return this.#n()?.reportValidity()??!0}};var S=["position:absolute","inline-size:1px","block-size:1px","padding:0","margin:-1px","overflow:hidden","clip-path:inset(50%)","white-space:nowrap","border:0"].join(";"),E=new WeakMap;function T(i,e){let t=E.get(e);t||E.set(e,t=new Map);let n=t.get(i);if(!n||!n.region.isConnected){let a=(e.ownerDocument||document).createElement("span");a.setAttribute("data-vb-announcer",i),a.setAttribute("role",i==="assertive"?"alert":"status"),a.setAttribute("aria-live",i),a.setAttribute("aria-atomic","true"),a.style.cssText=S,e.appendChild(a),n={region:a},t.set(i,n)}return n}function A(i,{politeness:e="polite",root:t}={}){let n=String(i??"").trim();if(!n||typeof document>"u")return null;let r=t||document.body;if(!r)return null;let s=T(e==="assertive"?"assertive":"polite",r);return clearTimeout(s.write),clearTimeout(s.clear),s.region.textContent="",s.write=setTimeout(()=>{s.region.textContent=n,s.clear=setTimeout(()=>{s.region.textContent=""},7e3)},50),s.region}function c(i,e,t,n){let r=`data-label-${e}`,s=i?.closest?.(`[${r}]`)?.getAttribute(r)||t;return n?s.replace(/\{(\w+)\}/g,(l,u)=>u in n?String(n[u]):l):s}var C=1500,k="[data-copy], [data-copy-target], [data-paste-target]",d={copied:"Copied to clipboard",pasted:"Pasted from clipboard","copy-failed":"Copy failed","copy-failed-selected":"Copy failed. Text selected, press Ctrl+C to copy","paste-failed":"Paste failed"},m=new WeakMap;function $(i){if(typeof document.execCommand!="function"||!document.body)return!1;let e=document.activeElement,t=document.createElement("textarea");t.value=i,t.setAttribute("readonly",""),t.setAttribute("aria-hidden","true"),t.style.cssText="position:fixed;inset-block-start:0;inset-inline-start:0;opacity:0;pointer-events:none",document.body.appendChild(t),t.select();let n=!1;try{n=document.execCommand("copy")}catch{n=!1}return t.remove(),e?.focus?.({preventScroll:!0}),n}function L(i){if(!i)return!1;if(i instanceof HTMLInputElement||i instanceof HTMLTextAreaElement)return i.focus(),i.select(),!0;let e=window.getSelection?.();if(!e)return!1;let t=document.createRange();return t.selectNodeContents(i),e.removeAllRanges(),e.addRange(t),!e.isCollapsed}async function f(i,e={}){if(i==null||i==="")return!1;let{button:t,duration:n=C}=e,r=!1,a=null;try{if(!navigator.clipboard?.writeText)throw new Error("Clipboard API unavailable");await navigator.clipboard.writeText(i),r=!0}catch(l){a=l,r=$(i)}if(r)return p({button:t,duration:n,state:"copied",eventName:"copy:done",eventDetail:{text:i},message:e.announceMessage??c(t,"copied",d.copied)}),!0;let s=L(e.source);return p({button:t,duration:n,state:"failed",eventName:"copy:error",eventDetail:{text:i,error:a},message:e.failureMessage??c(t,"copy-failed",s?d["copy-failed-selected"]:d["copy-failed"])}),!1}function p({button:i,duration:e,message:t,eventDetail:n,state:r,eventName:a}){if(i){i.dataset.state=r;let s=m.get(i);s&&clearTimeout(s),m.set(i,setTimeout(()=>{i.dataset.state===r&&delete i.dataset.state,m.delete(i)},e)),i.dispatchEvent(new CustomEvent(a,{bubbles:!0,detail:n}))}A(t,{politeness:r==="failed"?"assertive":"polite"})}async function M(i,e={}){let{button:t,duration:n=C}=e,r;try{if(!navigator.clipboard?.readText)throw new Error("Clipboard API unavailable");r=await navigator.clipboard.readText()}catch(a){return p({button:t,duration:n,state:"failed",eventName:"paste:error",eventDetail:{target:i,error:a},message:e.failureMessage??c(t,"paste-failed",d["paste-failed"])}),null}return i&&(i instanceof HTMLInputElement||i instanceof HTMLTextAreaElement||i instanceof HTMLSelectElement?i.value=r:i.textContent=r,i.dispatchEvent(new Event("input",{bubbles:!0}))),p({button:t,duration:n,state:"pasted",eventName:"paste:done",eventDetail:{text:r,target:i},message:e.announceMessage??c(t,"pasted",d.pasted)}),r}function x(i){let e=i.dataset.copyTarget;if(!e)return null;try{return document.querySelector(e)}catch{return null}}function N(i){if(i.dataset.copy)return i.dataset.copy;let e=x(i);if(!e)return"";let t=i.dataset.copyAttr;return t?e.getAttribute(t)??"":e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement?e.value:e.textContent??""}function q(i){let e=i.target?.closest?.(k);if(!e||e.matches(':disabled, [aria-disabled="true"]'))return;if(e.dataset.pasteTarget){let n=null;try{n=document.querySelector(e.dataset.pasteTarget)}catch{}if(!n)return;M(n,{button:e});return}let t=N(e);t&&f(t,{button:e,source:x(e)??void 0})}typeof document<"u"&&!document.__vbCopyDelegated&&(document.__vbCopyDelegated=!0,document.addEventListener("click",q));var b=new Map([["x",{label:"X",iconName:"twitter",buildUrl:({url:i,title:e})=>`https://x.com/intent/post?url=${o(i)}&text=${o(e)}`}],["twitter",{label:"X",iconName:"twitter",buildUrl:({url:i,title:e})=>`https://x.com/intent/post?url=${o(i)}&text=${o(e)}`}],["facebook",{label:"Facebook",iconName:"facebook",buildUrl:({url:i})=>`https://www.facebook.com/sharer/sharer.php?u=${o(i)}`}],["linkedin",{label:"LinkedIn",iconName:"linkedin",buildUrl:({url:i})=>`https://www.linkedin.com/sharing/share-offsite/?url=${o(i)}`}],["whatsapp",{label:"WhatsApp",iconName:"whatsapp",iconSet:"custom",buildUrl:({url:i,title:e})=>`https://wa.me/?text=${o(`${e} ${i}`)}`}],["telegram",{label:"Telegram",iconName:"telegram",iconSet:"custom",buildUrl:({url:i,title:e})=>`https://t.me/share/url?url=${o(i)}&text=${o(e)}`}],["bluesky",{label:"Bluesky",iconName:"bluesky",iconSet:"custom",buildUrl:({url:i,title:e})=>`https://bsky.app/intent/compose?text=${o(`${e} ${i}`)}`}],["mastodon",{label:"Mastodon",iconName:"mastodon",iconSet:"custom",buildUrl:({url:i,title:e},t="mastodon.social")=>`https://${t}/share?text=${o(`${e} ${i}`)}`}],["email",{label:"Email",iconName:"mail",buildUrl:({url:i,title:e,text:t})=>`mailto:?subject=${o(e)}&body=${o(`${t}
|
|
2
2
|
|
|
3
|
-
${
|
|
3
|
+
${i}`)}`}],["copy",{label:"Copy link",iconName:"link",buildUrl:()=>""}]]),y="x,linkedin,bluesky,mastodon,whatsapp,email,copy";function o(i){return encodeURIComponent(i)}var D={sharePage:"Share this page",shareOn:"Share on {platform}",copy:"Copy link",copied:"Copied!",linkCopied:"Link copied to clipboard",shareSelection:"Share selection",selectionCopied:"Selection copied"},R=/\{(url|title|text)\}/;function I(i,e){let t=a=>encodeURIComponent(a).replace(/-/g,"%2D"),n=e.replace(/\s+/g," ").trim().split(" "),r=n.length>10?`${t(n.slice(0,4).join(" "))},${t(n.slice(-4).join(" "))}`:t(n.join(" "));return`${i.split("#")[0]}#:~:text=${r}`}var g=class extends h{#t;#i;#n;#a={};#m=new WeakMap;#r="";#o=null;#e=null;#c=!1;get url(){return this.#a.url??this.#t}set url(e){this.#d("url",e)}get shareTitle(){return this.#a.title??this.#i??""}set shareTitle(e){this.#d("title",e)}get text(){return this.#a.text??this.#n}set text(e){this.#d("text",e)}#d(e,t){t==null?delete this.#a[e]:this.#a[e]=String(t),this.hasAttribute("data-upgraded")&&(this.#b(),this.#y())}setup(){if(this.#b(),this.#v(),this.closest("selection-menu")){this.#w(),this.setAttribute("data-tier-resolved","selection");return}this.#r==="native"?this.#E():this.#r==="hidden"?this.style.display="none":this.children.length>0?this.#C():this.#A(),this.setAttribute("data-tier-resolved",this.#r)}teardown(){this.removeAttribute("data-tier-resolved"),this.#r==="hidden"&&this.style.removeProperty("display"),this.#o&&(clearTimeout(this.#o),this.#o=null);for(let e of this.querySelectorAll(".share-label[data-original]"))e.textContent=e.dataset.original??"",delete e.dataset.original;this.#e&&(this.#e.removeEventListener("click",this.#p),this.#c&&this.#e.remove(),this.#e=null,this.#c=!1),this.querySelector(":scope > .share-trigger")?.remove(),this.querySelector(":scope > .share-selection")?.remove()}async share(){return this.#r==="native"?this.#g():this.#f()}#s(e){let t=`data-label-${e.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}`;return this.getAttribute(t)||D[e]}#b(){this.#t=this.#a.url||this.getAttribute("url")||document.querySelector('link[rel~="canonical" i]')?.href||location.href,this.#i=this.#a.title??(this.getAttribute("title")||document.querySelector('meta[property="og:title"]')?.getAttribute("content")||document.title),this.#n=this.#a.text??(this.getAttribute("text")||document.querySelector('meta[name="description"]')?.getAttribute("content")||document.querySelector('meta[property="og:description"]')?.getAttribute("content")||"")}#u(){return{url:this.#t||"",title:this.#i||"",text:this.#n||""}}#v(){let e=this.getAttribute("tier");if(e==="platforms"||e==="native"){e==="native"&&!navigator.share?this.#r="hidden":this.#r=e;return}if((this.getAttribute("platforms")||y)==="native-only"){this.#r=typeof navigator.share=="function"?"native":"hidden";return}this.#r=typeof navigator.share=="function"?"native":"platforms"}#h(e){let t=document.createElement("span");return t.className="share-label",t.textContent=e,t}#l(e,t){let n=document.createElement("icon-wc");return n.setAttribute("name",e),n.setAttribute("size","sm"),t&&n.setAttribute("set",t),n.setAttribute("aria-hidden","true"),n}#w(){let e=document.createElement("button");e.type="button",e.className="share-selection",e.setAttribute("aria-label",this.#s("shareSelection")),e.appendChild(this.#l("share-2")),e.addEventListener("click",async()=>{let t=this.closest("selection-menu"),r=t?.getSelection?.()?.text||window.getSelection()?.toString().trim()||"";if(!r){t?.dismiss?.();return}let a=I(this.#t||location.href,r),s=`"${r}" \u2014 ${a}`,l=!1;if(typeof navigator.share=="function")try{await navigator.share({text:s}),l=!0}catch(u){u?.name==="AbortError"&&(l=!0)}l||await f(s,{announceMessage:this.#s("selectionCopied")}),t?.dismiss?.()}),this.appendChild(e)}#E(){let e=document.createElement("button");e.type="button",e.className="share-trigger",e.append(this.#l("share-2"),this.#h(this.getAttribute("label")||"Share")),e.addEventListener("click",this.#x),this.appendChild(e)}#A(){let e=(this.getAttribute("platforms")||y).split(",").map(t=>t.trim()).filter(Boolean);this.#e=document.createElement("nav"),this.#e.setAttribute("aria-label",this.#s("sharePage"));for(let t of e){let n=b.get(t);if(!n)continue;let r=document.createElement("button");r.type="button",r.dataset.platform=t,t==="copy"?r.append(this.#l(n.iconName,n.iconSet),this.#h(this.#s("copy"))):(r.setAttribute("aria-label",this.#s("shareOn").replace("{platform}",n.label)),r.append(this.#l(n.iconName,n.iconSet),this.#h(n.label))),this.#e.appendChild(r)}this.#e.addEventListener("click",this.#p),this.appendChild(this.#e),this.#c=!0}#C(){if(this.querySelector("nav"))this.#e=this.querySelector("nav");else{let e=document.createElement("nav");for(e.setAttribute("aria-label",this.#s("sharePage"));this.firstChild;)e.appendChild(this.firstChild);this.appendChild(e),this.#e=e}this.#y(),this.#e.addEventListener("click",this.#p)}#y(){let{url:e,title:t,text:n}=this.#u();for(let r of this.querySelectorAll("a[data-platform]")){let a=this.#m.get(r);if(a==null){let s=r.getAttribute("href")||"";if(!R.test(s))continue;a=s,this.#m.set(r,a)}r.setAttribute("href",a.replace(/\{url\}/g,encodeURIComponent(e)).replace(/\{title\}/g,encodeURIComponent(t)).replace(/\{text\}/g,encodeURIComponent(n)))}}#x=async()=>{await this.#g()};async#g(){let e=this.#u();this.dispatchEvent(new CustomEvent("share-wc:open",{detail:{platform:"native"},bubbles:!0}));try{if(navigator.canShare&&!navigator.canShare(e))throw new Error("Payload not shareable");return await navigator.share(e),this.dispatchEvent(new CustomEvent("share-wc:success",{detail:{platform:"native"},bubbles:!0})),!0}catch(t){return t?.name==="AbortError"?!1:(this.dispatchEvent(new CustomEvent("share-wc:error",{detail:{platform:"native",error:t},bubbles:!0})),this.#f(this.querySelector(":scope > .share-trigger")))}}#p=e=>{let t=e.target.closest("[data-platform]");if(!t)return;let n=t.dataset.platform;if(n==="copy"){t.tagName==="A"&&e.preventDefault(),this.#f(t);return}if(t.tagName==="A"||!n)return;let r=b.get(n);if(!r)return;this.dispatchEvent(new CustomEvent("share-wc:open",{detail:{platform:n},bubbles:!0}));let a=this.#u();if(n==="email")location.href=r.buildUrl(a);else if(n==="mastodon"){let s=this.getAttribute("mastodon-instance")||"mastodon.social",l=r.buildUrl(a,s);window.open(l,"_blank","noopener,noreferrer")}else window.open(r.buildUrl(a),"_blank","noopener,noreferrer");this.dispatchEvent(new CustomEvent("share-wc:success",{detail:{platform:n},bubbles:!0}))};async#f(e=null){let t=e?.isConnected?e:void 0;if(!await f(this.#t||"",{button:t,announceMessage:this.#s("linkCopied"),duration:2e3}))return this.dispatchEvent(new CustomEvent("share-wc:error",{detail:{platform:"copy"},bubbles:!0})),!1;this.dispatchEvent(new CustomEvent("share-wc:success",{detail:{platform:"copy"},bubbles:!0}));let r=t?.dataset.platform==="copy"?t.querySelector(".share-label"):null;if(!r)return!0;let a=r.dataset.original??r.textContent??"";return r.dataset.original=a,r.textContent=this.#s("copied"),this.#o&&clearTimeout(this.#o),this.#o=setTimeout(()=>{r.textContent=a,delete r.dataset.original,this.#o=null},2e3),!0}};w("share-wc",g);export{g as ShareWc};
|
|
4
4
|
//# sourceMappingURL=share-wc.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var v=window.matchMedia("(prefers-reduced-motion: reduce)");var g=new Map;function E(e,t,n={}){let o=n.priority??10,s={impl:t,bundle:n.bundle,contract:n.contract,priority:o},r=g.get(e);if(customElements.get(e)){if(!r||r.priority>=o){r&&r.priority===o&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${e}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${n.bundle}".`);return}console.warn(`[VB Bundle] Tag <${e}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${n.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=o){r.priority===o&&console.warn(`[VB Bundle] Tag <${e}> already registered by "${r.bundle}". Skipping "${n.bundle}" (first wins at equal priority).`);return}g.set(e,s),customElements.define(e,t)}var h=class extends HTMLElement{#t=[];#e;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,n,o,s){t.addEventListener(n,o,s),this.#t.push(()=>t.removeEventListener(n,o,s))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,n){this.#e||(this.#e=this.attachInternals());let o=this.#e.states;try{n?o.add(t):o.delete(t)}catch{let s=`--${t}`;n?o.add(s):o.delete(s)}}_adoptInternals(t){this.#e||(this.#e=t)}};var p=/Mac|iPhone|iPad|iPod/.test(navigator.platform??""),k={mac:{meta:"\u2318",cmd:"\u2318",alt:"\u2325",shift:"\u21E7",ctrl:"\u2303"},other:{meta:"Ctrl",cmd:"Ctrl",alt:"Alt",shift:"Shift",ctrl:"Ctrl"}};function w(e){let t=p?k.mac:k.other;return e.split("+").map(n=>{let o=n.trim().toLowerCase();return t[o]??o.toUpperCase()}).join(p?"":"+")}function C(e){let t=e.toLowerCase().split("+").map(o=>o.trim());return{key:t.pop()??"",meta:t.includes("meta")||t.includes("cmd"),ctrl:t.includes("ctrl"),shift:t.includes("shift"),alt:t.includes("alt")}}function M(e,t){if(e.key.toLowerCase()!==t.key)return!1;let n,o;return p?(n=t.meta,o=t.ctrl):(n=!1,o=t.meta||t.ctrl),!(n!==e.metaKey||o!==e.ctrlKey||t.shift!==e.shiftKey||t.alt!==e.altKey)}var L=new Set(["INPUT","TEXTAREA","SELECT"]),d=[],N=!1;function S(e){let t=L.has(e.target.tagName)||e.target.isContentEditable;for(let n of d)if(!(t&&!n.global)&&M(e,n.descriptor)){e.preventDefault(),n.callback(e);return}}function $(){N||(document.addEventListener("keydown",S),N=!0)}function x(e,t,n={}){$();let o=C(e),s={combo:e,descriptor:o,callback:t,global:n.global===!0};return d.find(c=>c.combo===e)&&console.warn(`[hotkey-bind] Shortcut "${e}" already bound. Last-connected-wins.`),d.unshift(s),function(){let l=d.indexOf(s);l!==-1&&d.splice(l,1)}}var b=class extends h{#t;#e=null;setup(){this.#n(),this.#e=x("shift+?",()=>{this.#t.open?this.#t.close():this.#o()})}teardown(){this.#e?.(),this.#e=null,this.#t?.remove(),this.#t=null}get shortcuts(){return this.__shortcuts||null}set shortcuts(t){this.__shortcuts=t&&typeof t=="object"?t:null,this.dispatchEvent(new CustomEvent("short-cuts:shortcuts-changed",{detail:{shortcuts:this.__shortcuts,source:"property"},bubbles:!0}))}#n(){this.#t=document.createElement("dialog"),this.#t.className="shortcut-dialog",this.#t.addEventListener("click",t=>{t.target===this.#t&&this.#t.close()}),this.appendChild(this.#t)}#o(){this.#t.innerHTML="";let t=document.createElement("div");t.className="shortcut-header",t.innerHTML="<h2>Keyboard Shortcuts</h2>",this.#t.appendChild(t);let n=document.createElement("div");n.className="shortcut-body";let{getRegisteredCommands:o}=window.__commandRegistry||{},s=new Map;if(s.set("General",[{label:"Show keyboard shortcuts",shortcut:"shift+?"}]),o)for(let[c,l]of o())for(let i of l){if(!i.shortcut)continue;let a=s.get(c)||[];a.push({label:i.label,shortcut:i.shortcut}),s.set(c,a)}let{getHotkeyActions:r}=window.__hotkeyActionRegistry||{};if(r)for(let[c,l]of r()){let i=s.get(c)||[];for(let a of l)i.push({label:a.label,shortcut:a.shortcut});s.set(c,i)}for(let[c,l]of s){let i=document.createElement("div");i.className="shortcut-group";let a=document.createElement("div");a.className="shortcut-group-header",a.textContent=c,i.appendChild(a);for(let y of l){let u=document.createElement("div");u.className="shortcut-row";let f=document.createElement("span");f.className="shortcut-label",f.textContent=y.label;let m=document.createElement("kbd");m.className="shortcut-kbd",m.textContent=w(y.shortcut),u.appendChild(f),u.appendChild(m),i.appendChild(u)}n.appendChild(i)}this.#t.appendChild(n),this.#t.showModal()}};E("short-cuts",b);export{b as ShortCuts};
|
|
1
|
+
var Y=window.matchMedia("(prefers-reduced-motion: reduce)");var w=new Map;function C(e,t,o={}){let n=o.priority??10,r={impl:t,bundle:o.bundle,contract:o.contract,priority:n},s=w.get(e);if(customElements.get(e)){if(!s||s.priority>=n){s&&s.priority===n&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${e}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${o.bundle}".`);return}console.warn(`[VB Bundle] Tag <${e}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${o.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=n){s.priority===n&&console.warn(`[VB Bundle] Tag <${e}> already registered by "${s.bundle}". Skipping "${o.bundle}" (first wins at equal priority).`);return}w.set(e,r),customElements.define(e,t)}var m=class extends HTMLElement{#t=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,o,n,r){t.addEventListener(o,n,r),this.#t.push(()=>t.removeEventListener(o,n,r))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,o){this.#e||(this.#e=this.attachInternals());let n=this.#e.states;try{o?n.add(t):n.delete(t)}catch{let r=`--${t}`;o?n.add(r):n.delete(r)}}_adoptInternals(t){this.#e||(this.#e=t)}#o(){return this.constructor.formAssociated&&this.#e?this.#e:null}get validity(){return this.#o()?.validity}get validationMessage(){return this.#o()?.validationMessage??""}get willValidate(){return this.#o()?.willValidate??!1}get form(){return this.#o()?.form??null}checkValidity(){return this.#o()?.checkValidity()??!0}reportValidity(){return this.#o()?.reportValidity()??!0}};var u=/Mac|iPhone|iPad|iPod/.test(navigator.platform??""),A={mac:{meta:"\u2318",cmd:"\u2318",alt:"\u2325",option:"\u2325",shift:"\u21E7",ctrl:"\u2303",control:"\u2303"},other:{meta:"Ctrl",cmd:"Ctrl",alt:"Alt",option:"Alt",shift:"Shift",ctrl:"Ctrl",control:"Ctrl"}},S={mac:{meta:"Command",cmd:"Command",alt:"Option",option:"Option",shift:"Shift",ctrl:"Control",control:"Control"},other:{meta:"Control",cmd:"Control",alt:"Alt",option:"Alt",shift:"Shift",ctrl:"Control",control:"Control"}},L={escape:{label:"Esc",spoken:"Escape"},esc:{label:"Esc",spoken:"Escape"},enter:{label:"Enter",spoken:"Enter"},return:{label:"Enter",spoken:"Enter"},tab:{label:"Tab",spoken:"Tab"},space:{label:"Space",spoken:"Space"},backspace:{label:"Backspace",spoken:"Backspace"},delete:{label:"Del",spoken:"Delete"},del:{label:"Del",spoken:"Delete"},insert:{label:"Ins",spoken:"Insert"},home:{label:"Home",spoken:"Home"},end:{label:"End",spoken:"End"},pageup:{label:"PgUp",spoken:"Page up"},pagedown:{label:"PgDn",spoken:"Page down"},arrowup:{label:"\u2191",spoken:"Up arrow"},up:{label:"\u2191",spoken:"Up arrow"},arrowdown:{label:"\u2193",spoken:"Down arrow"},down:{label:"\u2193",spoken:"Down arrow"},arrowleft:{label:"\u2190",spoken:"Left arrow"},left:{label:"\u2190",spoken:"Left arrow"},arrowright:{label:"\u2192",spoken:"Right arrow"},right:{label:"\u2192",spoken:"Right arrow"},"+":{label:"+",spoken:"Plus"},plus:{label:"+",spoken:"Plus"}};function b(e){return[...String(e??"").trim().toLowerCase().matchAll(/([^+]+|\+)(?:\+|$)/g)].map(o=>o[1].trim()).filter(Boolean).map(o=>o==="plus"?"+":o)}function g(e,t=u){let o=t?A.mac:A.other;if(e in o)return{label:o[e],spoken:(t?S.mac:S.other)[e],modifier:!0};let n=L[e];if(n)return{...n,modifier:!1};let r=e.toUpperCase();return{label:r,spoken:r,modifier:!1}}function T(e){return b(e).map(t=>g(t).label).join(u?"":"+")}var _={esc:"escape",return:"enter",del:"delete",ins:"insert",up:"arrowup",down:"arrowdown",left:"arrowleft",right:"arrowright",space:" ",spacebar:" ",plus:"+",pgup:"pageup",pgdn:"pagedown"};function K(e){let t=String(e??"").toLowerCase();return _[t]??t}function h(e){let t=b(e);return{key:K(t.pop()??""),meta:t.includes("meta")||t.includes("cmd"),ctrl:t.includes("ctrl")||t.includes("control"),shift:t.includes("shift"),alt:t.includes("alt")||t.includes("option")}}function x(e){return e.length===1&&!/[a-z0-9 ]/.test(e)}function M(e,t){let n=(e.key==="Spacebar"?" ":String(e.key??"").toLowerCase())===t.key;if(!n&&(e.altKey||e.shiftKey)&&/^[a-z0-9]$/.test(t.key)){let i=/\d/.test(t.key)?`Digit${t.key}`:`Key${t.key.toUpperCase()}`;n=e.code===i}if(!n)return!1;let r,s;return u?(r=t.meta,s=t.ctrl):(r=!1,s=t.meta||t.ctrl),!(r!==e.metaKey||s!==e.ctrlKey||!x(t.key)&&t.shift!==e.shiftKey||t.alt!==e.altKey)}function y(e){let t=typeof e=="string"?h(e):e;return!t.meta&&!t.ctrl&&!t.alt&&t.key.length===1}function N(e,t){let o=h(e),n=h(t),r=u?o.ctrl:o.ctrl||o.meta,s=u?n.ctrl:n.ctrl||n.meta,i=u&&o.meta,l=u&&n.meta,a=!x(o.key);return o.key===n.key&&r===s&&i===l&&o.alt===n.alt&&(!a||o.shift===n.shift)}var k="data-char-shortcuts",v="vb:char-shortcuts-change",O="vb:settings:extensions";function f(){return typeof document>"u"?!0:document.documentElement.getAttribute(k)!=="off"}function D(){try{let e=globalThis.localStorage?.getItem(O);if(!e)return null;let t=JSON.parse(e)?.data?.charShortcuts;return typeof t=="boolean"?t:null}catch{return null}}var P=!0;if(typeof document<"u"){let e=D();e===null&&(P=f()),e===!1?document.documentElement.setAttribute(k,"off"):e===!0&&document.documentElement.removeAttribute(k)}var R=new Set(["INPUT","TEXTAREA","SELECT"]),p=[],H=!1;function U(e){let t=e;return!t||!t.tagName?!1:R.has(t.tagName)||t.isContentEditable}function B(e){if(e.repeat||e.isComposing||e.defaultPrevented)return;let t=U(e.target),o=!f(),n=document.activeElement;for(let r of p)if(!(t&&!r.global)&&!(r.scope&&!(r.scope.isConnected&&r.scope.contains(n)))&&!(o&&r.character&&!r.scope)&&!(r.enabled&&!r.enabled())&&M(e,r.descriptor)){e.preventDefault(),r.callback(e);return}}function I(){H||(document.addEventListener("keydown",B),H=!0)}function $(e,t,o={}){I();let n=h(e),r={combo:e,descriptor:n,callback:t,global:o.global===!0,scope:o.scope??null,enabled:typeof o.enabled=="function"?o.enabled:null,character:y(n)},s=p.find(i=>!i.scope&&!r.scope&&N(i.combo,e));return s&&console.warn(`[hotkey-bind] Shortcut "${e}" is already bound as "${s.combo}". Last-bound wins.`),p.unshift(r),function(){let l=p.indexOf(r);l!==-1&&p.splice(l,1)}}var V="shift+?",q={title:"Keyboard shortcuts",general:"General",self:"Show keyboard shortcuts",close:"Close"},j=0,E=class extends m{static get observedAttributes(){return["hotkey"]}#t=null;#e=null;#o=null;#n=null;setup(){this.#a(),this.#i(),this.listen(window,v,()=>{this.#t?.open&&this.#s()})}teardown(){this.#o?.(),this.#o=null,this.#t?.remove(),this.#t=null,this.#e=null}attributeChangedCallback(t,o,n){t==="hotkey"&&o!==n&&this.hasAttribute("data-upgraded")&&this.#i()}show(){this.#t&&(this.#s(),this.#t.open||this.#t.showModal())}close(){this.#t?.open&&this.#t.close()}toggle(){this.#t?.open?this.close():this.show()}get open(){return!!this.#t?.open}get hotkey(){let t=(this.getAttribute("hotkey")??"").trim();return t.toLowerCase()==="none"?null:t||V}get shortcuts(){return this.#n}set shortcuts(t){this.#n=t&&typeof t=="object"?t:null,this.#t?.open&&this.#s(),this.dispatchEvent(new CustomEvent("short-cuts:shortcuts-changed",{detail:{shortcuts:this.#n,source:"property"},bubbles:!0}))}#r(t){return this.getAttribute(`data-label-${t}`)||q[t]}#i(){this.#o?.(),this.#o=null;let t=this.hotkey;t&&(this.#o=$(t,()=>this.toggle()))}#a(){this.querySelector(":scope > dialog.shortcut-dialog")?.remove();let t=`short-cuts-title-${++j}`,o=document.createElement("dialog");o.className="shortcut-dialog",o.setAttribute("aria-labelledby",t);let n=document.createElement("header");n.className="shortcut-header";let r=document.createElement("h2");r.id=t,r.textContent=this.#r("title");let s=document.createElement("button");s.type="button",s.className="shortcut-close",s.setAttribute("aria-label",this.#r("close"));let i=document.createElement("icon-wc");i.setAttribute("name","x"),i.setAttribute("size","sm"),i.setAttribute("aria-hidden","true"),s.appendChild(i),s.addEventListener("click",()=>this.close()),n.append(r,s);let l=document.createElement("section");l.className="shortcut-body",o.append(n,l),o.addEventListener("click",a=>{a.target===o&&o.close()}),this.#t=o,this.#e=l,this.appendChild(o)}#c(){let t=new Map,o=!f(),n=(a,c=!1)=>!(o&&!c&&y(a)),r=this.hotkey;r&&n(r)&&t.set(this.#r("general"),[{label:this.#r("self"),shortcut:r}]);let s=(a,c)=>{if(!c?.shortcut||!n(String(c.shortcut),!!c.scoped))return;let d=t.get(a)||[];d.push({label:String(c.label??""),shortcut:String(c.shortcut)}),t.set(a,d)};if(this.#n){for(let[a,c]of Object.entries(this.#n))Array.isArray(c)&&c.forEach(d=>s(a,d));return t}let{getRegisteredCommands:i}=window.__commandRegistry||{};if(i)for(let[a,c]of i())for(let d of c)s(a,d);let{getHotkeyActions:l}=window.__hotkeyActionRegistry||{};if(l)for(let[a,c]of l())for(let d of c)s(a,d);return t}#l(t){let o=document.createElement("kbd");o.className="shortcut-kbd";let n=document.createElement("span");n.setAttribute("aria-hidden","true"),n.textContent=T(t);let r=document.createElement("span");return r.className="visually-hidden",r.textContent=b(t).map(s=>g(s,u).spoken).join(" "),o.append(n,r),o}#s(){if(this.#e){this.#e.replaceChildren();for(let[t,o]of this.#c()){if(!o.length)continue;let n=document.createElement("section");n.className="shortcut-group";let r=document.createElement("h3");r.className="shortcut-group-header",r.textContent=t;let s=document.createElement("dl");s.className="shortcut-list";for(let i of o){let l=document.createElement("div");l.className="shortcut-row";let a=document.createElement("dt");a.className="shortcut-label",a.textContent=i.label;let c=document.createElement("dd");c.appendChild(this.#l(i.shortcut)),l.append(a,c),s.appendChild(l)}n.append(r,s),this.#e.appendChild(n)}}}};C("short-cuts",E);export{E as ShortCuts};
|
|
2
2
|
//# sourceMappingURL=short-cuts.js.map
|
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
var x=window.matchMedia("(prefers-reduced-motion: reduce)");var y=new Map;function S(u,e,t={}){let n=t.priority??10,o={impl:e,bundle:t.bundle,contract:t.contract,priority:n},r=y.get(u);if(customElements.get(u)){if(!r||r.priority>=n){r&&r.priority===n&&r.impl!==e&&console.warn(`[VB Bundle] Tag <${u}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${u}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=n){r.priority===n&&console.warn(`[VB Bundle] Tag <${u}> already registered by "${r.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}y.set(u,o),customElements.define(u,e)}var h=class extends HTMLElement{#e=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,t,n,o){e.addEventListener(t,n,o),this.#e.push(()=>e.removeEventListener(t,n,o))}_reinit(){for(let e of this.#e)e();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(e,t){this.#t||(this.#t=this.attachInternals());let n=this.#t.states;try{t?n.add(e):n.delete(e)}catch{let o=`--${e}`;t?n.add(o):n.delete(o)}}_adoptInternals(e){this.#t||(this.#t=e)}};var m=class extends h{#e=null;#t=[];#n=null;setup(){let e=this.getAttribute("src");e?this.#p(e).then(()=>this.#o()):this.#o()}teardown(){this.#e?.disconnect()}#o(){this.#s(),this.#c(),this.#a();let e=this.getAttribute("letters")||"entries";e!=="none"&&this.#l(e==="all"),this.#u()}#s(){let e=this.querySelector('nav[aria-label="Site index"]');e&&(this.#t=[...e.querySelectorAll(":scope > section")])}#c(){let e=this.querySelectorAll('nav[aria-label="Site index"] > section');for(let t of e){let n=t.querySelectorAll(":scope > ul > li"),o=0;for(let s of n){let c=s.querySelectorAll(".index-refs > li").length;o+=c;let a=s.querySelector(".index-term");if(a&&c>0&&!a.querySelector(".index-count")){let d=document.createElement("span");d.className="index-count",d.textContent=`(${c})`,a.after(d)}}let r=t.querySelector("h2");if(r&&o>0&&!r.querySelector(".index-count")){let s=document.createElement("span");s.className="index-count",s.textContent=`(${o})`,r.append(s)}}}#a(){let e=document.createElement("nav");e.setAttribute("data-index-controls",""),e.setAttribute("aria-label","Index controls");let t=this.getAttribute("placeholder")||"Filter index\u2026",n=document.createElement("input");n.type="search",n.placeholder=t,n.setAttribute("aria-label",t),n.setAttribute("data-index-search",""),n.addEventListener("input",()=>this.#r(n.value)),e.append(n);let o=document.createElement("select");o.setAttribute("aria-label","Search scope"),o.innerHTML=`
|
|
2
|
-
<option value="topic">By Topic</option>
|
|
3
|
-
<option value="all">All</option>
|
|
4
|
-
`,this.getAttribute("filter")==="all"&&(o.value="all"),o.addEventListener("change",()=>this.#r(n.value)),this.#n=o,e.append(o);let s=document.createElement("select");s.setAttribute("aria-label","Sort order"),s.innerHTML=`
|
|
5
|
-
<option value="alpha">Alphabetical</option>
|
|
6
|
-
<option value="count">Most entries</option>
|
|
7
|
-
`;let i=this.getAttribute("sort");i==="count"&&(s.value="count"),s.addEventListener("change",()=>this.#i(s.value)),e.append(s);let c=this.querySelector('nav[aria-label="Site index"]');c?c.before(e):this.prepend(e),i==="count"&&this.#i("count")}#l(e){let t=this.querySelector(".index-jump");t&&t.remove();let n=this.querySelectorAll('nav[aria-label="Site index"] > section'),o=new Set;for(let l of n){let f=l.id?.replace("index-","").toUpperCase();f&&o.add(f)}if(o.size===0)return;let r="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),s=e?r:[...o].sort(),i=document.createElement("nav");i.className="index-jump",i.setAttribute("aria-label","Jump to letter");let c=document.createElement("ol");c.className="inline";for(let l of s){let f=document.createElement("li");if(o.has(l)){let p=document.createElement("a");p.href=`#index-${l.toLowerCase()}`,p.textContent=l,f.append(p)}else{let p=document.createElement("span");p.textContent=l,p.setAttribute("aria-disabled","true"),f.append(p)}c.append(f)}i.append(c);let a=this.querySelector("[data-index-controls]"),d=this.querySelector('nav[aria-label="Site index"]');a?a.after(i):d?d.before(i):this.prepend(i),this.#d(i)}#d(e){let t=e.querySelectorAll("a");if(!t.length)return;let n=this.querySelectorAll('nav[aria-label="Site index"] > section');if(n.length){this.#e=new IntersectionObserver(o=>{for(let r of o)if(r.isIntersecting){let s=r.target.id;for(let i of t){let c=i.getAttribute("href")===`#${s}`;i.setAttribute("aria-current",c?"true":"false")}}},{rootMargin:"-20% 0px -60% 0px"});for(let o of n)this.#e.observe(o)}}#u(){let e=this.getAttribute("limit");if(!e)return;let t=parseInt(e,10);if(!t||t<1)return;let n=this.querySelectorAll('nav[aria-label="Site index"] > section');for(let o of n){let r=[...o.querySelectorAll(":scope > ul > li")];if(r.length<=t)continue;let s=r.slice(t);for(let a of s)a.hidden=!0,a.setAttribute("data-index-overflow","");let i=document.createElement("button");i.type="button",i.setAttribute("data-index-expand",""),i.setAttribute("aria-expanded","false"),i.textContent=`Show ${s.length} more`,i.addEventListener("click",()=>{let a=i.getAttribute("aria-expanded")==="true";for(let d of s)d.hidden=a;i.setAttribute("aria-expanded",String(!a)),i.textContent=a?`Show ${s.length} more`:"Show less"});let c=o.querySelector(":scope > ul");c&&c.after(i)}}#r(e){let t=e.toLowerCase().trim(),n=this.#n?.value||"topic",o=this.querySelectorAll('nav[aria-label="Site index"] > section');for(let r of o){let s=r.querySelectorAll(":scope > ul > li"),i=!1;for(let c of s){let d=c.querySelector(".index-term")?.textContent?.toLowerCase()||"",l=!t||d.includes(t);if(!l&&n==="all"){let f=c.querySelectorAll(".index-refs a");for(let b of f)if((b.textContent||"").toLowerCase().includes(t)){l=!0;break}}c.hidden=!l,l&&(i=!0)}r.hidden=!i}this.#f()}#f(){let e=this.querySelector(".index-jump");if(!e)return;let t=this.querySelectorAll('nav[aria-label="Site index"] > section');for(let n of t){let o=n.id?.replace("index-","").toUpperCase();if(!o)continue;let r=e.querySelector(`a[href="#index-${o.toLowerCase()}"]`);r&&(r.style.opacity=n.hidden?"0.3":"")}}#i(e){let t=this.querySelector('nav[aria-label="Site index"]');if(t){if(e==="alpha")for(let n of this.#t)t.append(n);else if(e==="count"){let n=[...t.querySelectorAll(":scope > section")];n.sort((o,r)=>{let s=o.querySelectorAll(".index-refs > li").length;return r.querySelectorAll(".index-refs > li").length-s});for(let o of n)t.append(o)}}}async#p(e){try{let t=await fetch(e);if(!t.ok)return;let n=await t.json();this.#h(n)}catch{}}#h(e){if(!Array.isArray(e))return;let t={};for(let r of e){let s=(r.term||"")[0]?.toUpperCase()||"#";t[s]||(t[s]=[]),t[s].push(r)}let n=document.createElement("nav");n.setAttribute("aria-label","Site index");for(let[r,s]of Object.entries(t).sort(([i],[c])=>i.localeCompare(c))){let i=document.createElement("section");i.id=`index-${r.toLowerCase()}`,i.innerHTML=`<h2>${r}</h2>`;let c=document.createElement("ul");for(let a of s){let d=document.createElement("li");d.innerHTML=`
|
|
8
|
-
<span class="index-term">${a.term}</span>
|
|
9
|
-
${a.refs?`<ul class="index-refs">${a.refs.map(l=>`<li><a href="${l.href}">${l.label}</a>${l.type?` <small>${l.type}</small>`:""}</li>`).join("")}</ul>`:""}
|
|
10
|
-
`,c.append(d)}i.append(c),n.append(i)}let o=this.querySelector('nav[aria-label="Site index"]');o?o.replaceWith(n):this.append(n)}};S("site-index",m);export{m as SiteIndex};
|
|
1
|
+
var N=window.matchMedia("(prefers-reduced-motion: reduce)");var S=new Map;function w(u,e,n={}){let t=n.priority??10,s={impl:e,bundle:n.bundle,contract:n.contract,priority:t},o=S.get(u);if(customElements.get(u)){if(!o||o.priority>=t){o&&o.priority===t&&o.impl!==e&&console.warn(`[VB Bundle] Tag <${u}> already registered by "${o.bundle}" (priority ${o.priority}). Skipping "${n.bundle}".`);return}console.warn(`[VB Bundle] Tag <${u}> defined by "${o.bundle}" cannot be replaced (customElements.define is permanent). "${n.bundle}" has higher priority but arrived late.`);return}if(o&&o.priority>=t){o.priority===t&&console.warn(`[VB Bundle] Tag <${u}> already registered by "${o.bundle}". Skipping "${n.bundle}" (first wins at equal priority).`);return}S.set(u,s),customElements.define(u,e)}var x=class extends HTMLElement{#e=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,n,t,s){e.addEventListener(n,t,s),this.#e.push(()=>e.removeEventListener(n,t,s))}_reinit(){for(let e of this.#e)e();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(e,n){this.#t||(this.#t=this.attachInternals());let t=this.#t.states;try{n?t.add(e):t.delete(e)}catch{let s=`--${e}`;n?t.add(s):t.delete(s)}}_adoptInternals(e){this.#t||(this.#t=e)}#o(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#o()?.validity}get validationMessage(){return this.#o()?.validationMessage??""}get willValidate(){return this.#o()?.willValidate??!1}get form(){return this.#o()?.form??null}checkValidity(){return this.#o()?.checkValidity()??!0}reportValidity(){return this.#o()?.reportValidity()??!0}};var q=()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches;function L(u,e){let t=(()=>{try{return decodeURIComponent(location.hash.slice(1))}catch{return location.hash.slice(1)}})()===e;t||(location.hash=e);let s=u;typeof s.focus=="function"&&(s.tabIndex<0&&!s.hasAttribute("tabindex")&&s.setAttribute("tabindex","-1"),s.focus({preventScroll:!0})),(t||!s.matches?.(":target"))&&s.scrollIntoView({behavior:q()?"auto":"smooth",block:"start"})}function C(u){let e=u;if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return!1;let t=(e.target instanceof Element?e.target:null)?.closest('a[href^="#"]');if(!t)return!1;let s=t.getAttribute("target");if(s&&s!=="_self"||t.hasAttribute("download"))return!1;let o=(t.getAttribute("href")??"").slice(1);if(!o)return!1;let r=o;try{r=decodeURIComponent(o)}catch{}let c=t.ownerDocument.getElementById(r);return c?(e.preventDefault(),L(c,r),!0):!1}var k={controls:"Filter the index",scope:"Search scope","scope-topic":"By Topic","scope-all":"All",sort:"Sort order","sort-alpha":"Alphabetical","sort-count":"Most entries",jump:"Jump to letter",more:"Show {count} more",less:"Show less",matches:"{count} terms match","matches-one":"1 term matches","no-matches":"No matches"},M="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");function $(u){if(typeof u!="string"||!u.trim())return null;try{let e=new URL(u,document.baseURI);return e.protocol==="http:"||e.protocol==="https:"?u:null}catch{return null}}var A=class extends x{#e=null;#t=[];#o=null;#c=null;#a=null;setup(){this.listen(this,"click",C);let e=this.getAttribute("src");e?this.#v(e).then(()=>{this.isConnected&&this.#u()}):this.#u()}teardown(){this.#e?.disconnect(),this.#e=null}#n(e,n){let t=this.getAttribute(`data-label-${e}`)??k[e];return n==null?t:t.replace("{count}",String(n))}get#i(){return this.closest("[lang]")?.getAttribute("lang")||document.documentElement.lang||void 0}#r(){return this.querySelector("nav[data-index]")??this.querySelector(":scope > nav:has(> section)")}#s(){let e=this.#r();return e?[...e.querySelectorAll(":scope > section")]:[]}#h(e){let n=e.id?.replace(/^index-/,"");if(!n)return"";let t=n;try{t=decodeURIComponent(n)}catch{}return t.toLocaleUpperCase(this.#i)}#u(){this.#p(),this.#m(),this.#b();let e=this.getAttribute("letters")||"entries";e!=="none"&&this.#y(e==="all"),this.#x(),this.#c?.value&&this.#l(this.#c.value)}#p(){let e=this.#s();this.#t.length&&this.#t.every(n=>e.includes(n))||(this.#t=e)}#m(){for(let e of this.#s()){let n=e.querySelectorAll(":scope > ul > li"),t=0;for(let o of n){let c=o.querySelectorAll(".index-refs > li").length;t+=c;let i=o.querySelector(".index-term");if(i&&c>0&&!i.nextElementSibling?.classList.contains("index-count")){let l=document.createElement("span");l.className="index-count",l.textContent=`(${c})`,i.after(l)}}let s=e.querySelector("h2");if(s&&t>0&&!s.querySelector(".index-count")){let o=document.createElement("span");o.className="index-count",o.textContent=`(${t})`,s.append(o)}}}#d(e,n){let t=document.createElement("select");t.setAttribute("aria-label",this.#n(e));for(let[s,o]of n){let r=document.createElement("option");r.value=s,r.textContent=this.#n(o),t.append(r)}return t}#b(){if(this.querySelector(":scope > [data-index-controls]"))return;let e=document.createElement("search");e.setAttribute("data-index-controls",""),e.setAttribute("aria-label",this.#n("controls"));let n=this.getAttribute("placeholder")||"Filter index\u2026",t=document.createElement("input");t.type="search",t.placeholder=n,t.setAttribute("aria-label",n),t.setAttribute("data-index-search",""),t.addEventListener("input",()=>this.#l(t.value)),this.#c=t,e.append(t);let s=this.#d("scope",[["topic","scope-topic"],["all","scope-all"]]);this.getAttribute("filter")==="all"&&(s.value="all"),s.addEventListener("change",()=>this.#l(t.value)),this.#o=s,e.append(s);let o=this.#d("sort",[["alpha","sort-alpha"],["count","sort-count"]]),r=this.getAttribute("sort");r==="count"&&(o.value="count"),o.addEventListener("change",()=>this.#f(o.value)),e.append(o);let c=document.createElement("output");c.setAttribute("role","status"),c.setAttribute("data-index-status",""),this.#a=c,e.append(c);let i=this.#r();i?i.before(e):this.prepend(e),r==="count"&&this.#f("count")}#y(e){let n=this.querySelector(":scope > .index-jump");n&&n.remove();let t=new Map;for(let d of this.#s()){let a=this.#h(d);a&&t.set(a,d.id)}if(t.size===0)return;let s=new Intl.Collator(this.#i,{sensitivity:"base"}),o=e?[...new Set([...M,...t.keys()])]:[...t.keys()];o.sort((d,a)=>s.compare(d,a)||d.localeCompare(a));let r=document.createElement("nav");r.className="index-jump",r.setAttribute("aria-label",this.#n("jump"));let c=document.createElement("ol");c.className="inline";for(let d of o){let a=document.createElement("li"),h=t.get(d);if(h){let f=document.createElement("a");f.setAttribute("href",`#${h}`),f.textContent=d,a.append(f)}else{let f=document.createElement("span");f.textContent=d,f.setAttribute("aria-disabled","true"),a.append(f)}c.append(a)}r.append(c);let i=this.querySelector(":scope > [data-index-controls]"),l=this.#r();i?i.after(r):l?l.before(r):this.prepend(r),this.#g(r)}#g(e){let n=e.querySelectorAll("a");if(!n.length)return;let t=this.#s();if(t.length){this.#e?.disconnect(),this.#e=new IntersectionObserver(s=>{for(let o of s)if(o.isIntersecting){let r=o.target.id;for(let c of n){let i=c.getAttribute("href")===`#${r}`;c.setAttribute("aria-current",i?"true":"false")}}},{rootMargin:"-20% 0px -60% 0px"});for(let s of t)this.#e.observe(s)}}#x(){let e=this.getAttribute("limit");if(!e)return;let n=parseInt(e,10);if(!(!n||n<1))for(let t of this.#s()){let s=[...t.querySelectorAll(":scope > ul > li")];if(s.length<=n||t.querySelector(":scope > [data-index-expand]"))continue;let o=s.slice(n);for(let i of o)i.hidden=!0,i.setAttribute("data-index-overflow","");let r=document.createElement("button");r.type="button",r.setAttribute("data-index-expand",""),r.setAttribute("aria-expanded","false"),r.textContent=this.#n("more",o.length),r.addEventListener("click",()=>{let i=r.getAttribute("aria-expanded")!=="true";for(let l of o)l.hidden=!i;r.setAttribute("aria-expanded",String(i)),r.textContent=i?this.#n("less"):this.#n("more",o.length)});let c=t.querySelector(":scope > ul");c&&c.after(r)}}#l(e){let n=this.#i,t=e.toLocaleLowerCase(n).trim(),s=this.#o?.value||"topic",o=0;for(let r of this.#s()){let c=r.querySelectorAll(":scope > ul > li"),i=r.querySelector(":scope > [data-index-expand]"),l=i?.getAttribute("aria-expanded")==="true",d=!1;for(let a of c){let h=a.querySelector(".index-term")?.textContent?.toLocaleLowerCase(n)||"",f=!t||h.includes(t);if(!f&&s==="all"){for(let y of a.querySelectorAll(".index-refs a"))if((y.textContent||"").toLocaleLowerCase(n).includes(t)){f=!0;break}}f&&(d=!0,o++);let b=!t&&a.hasAttribute("data-index-overflow")&&!l;a.hidden=!f||b}r.hidden=!d,i&&(i.hidden=!!t)}this.#a&&(this.#a.textContent=t?o===0?this.#n("no-matches"):o===1?this.#n("matches-one"):this.#n("matches",o):""),this.#A()}#A(){let e=this.querySelector(":scope > .index-jump");if(e)for(let n of this.#s()){if(!n.id)continue;let t=[...e.querySelectorAll("a")].find(s=>s.getAttribute("href")===`#${n.id}`)??null;t&&(n.hidden?(t.setAttribute("aria-disabled","true"),t.setAttribute("tabindex","-1")):(t.removeAttribute("aria-disabled"),t.removeAttribute("tabindex")))}}#f(e){let n=this.#r();if(n){if(e==="alpha")for(let t of this.#t)n.append(t);else if(e==="count"){let t=[...n.querySelectorAll(":scope > section")];t.sort((s,o)=>{let r=s.querySelectorAll(".index-refs > li").length;return o.querySelectorAll(".index-refs > li").length-r});for(let s of t)n.append(s)}}}async#v(e){try{let n=await fetch(e);if(!n.ok)return;let t=await n.json();this.#E(t)}catch{}}#E(e){if(!Array.isArray(e))return;let n=this.#i,t=new Map;for(let i of e){if(!i||typeof i!="object")continue;let d=[...String(i.term??"").trim()][0],a=d?d.toLocaleUpperCase(n):"#";t.has(a)||t.set(a,[]),t.get(a)?.push(i)}let s=this.#r(),o=document.createElement("nav");o.setAttribute("data-index",""),o.setAttribute("aria-label",s?.getAttribute("aria-label")||"Site index");let r=new Intl.Collator(n,{sensitivity:"base"}),c=[...t.keys()].sort((i,l)=>r.compare(i,l)||i.localeCompare(l));for(let i of c){let l=document.createElement("section");l.id=`index-${i.toLocaleLowerCase(n)}`;let d=document.createElement("h2");d.textContent=i,l.append(d);let a=document.createElement("ul");for(let h of t.get(i)??[]){let f=document.createElement("li"),b=document.createElement("span");if(b.className="index-term",b.textContent=String(h.term??""),f.append(b),Array.isArray(h.refs)&&h.refs.length){let y=document.createElement("ul");y.className="index-refs";for(let p of h.refs){if(!p||typeof p!="object")continue;let g=document.createElement("li"),v=$(p.href),E=String(p.label??p.href??"");if(v){let m=document.createElement("a");m.setAttribute("href",v),m.textContent=E,g.append(m)}else g.append(E);if(p.type){let m=document.createElement("small");m.textContent=String(p.type),g.append(" ",m)}y.append(g)}f.append(y)}a.append(f)}l.append(a),o.append(l)}s?s.replaceWith(o):this.append(o),this.#t=[]}};w("site-index",A);export{A as SiteIndex};
|
|
11
2
|
//# sourceMappingURL=site-index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var B=window.matchMedia("(prefers-reduced-motion: reduce)");var T=new Map;function $(l,s,t={}){let e=t.priority??10,i={impl:s,bundle:t.bundle,contract:t.contract,priority:e},r=T.get(l);if(customElements.get(l)){if(!r||r.priority>=e){r&&r.priority===e&&r.impl!==s&&console.warn(`[VB Bundle] Tag <${l}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${l}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=e){r.priority===e&&console.warn(`[VB Bundle] Tag <${l}> already registered by "${r.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}T.set(l,i),customElements.define(l,s)}var v=class extends HTMLElement{#l=[];#s;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let s of this.#l)s();this.#l=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(s,t,e,i){s.addEventListener(t,e,i),this.#l.push(()=>s.removeEventListener(t,e,i))}_reinit(){for(let s of this.#l)s();this.#l=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(s,t){this.#s||(this.#s=this.attachInternals());let e=this.#s.states;try{t?e.add(s):e.delete(s)}catch{let i=`--${s}`;t?e.add(i):e.delete(i)}}_adoptInternals(s){this.#s||(this.#s=s)}};var M=0;function L(l,s,t="vb-vt"){if(!l?.isConnected||typeof document>"u"||!("startViewTransition"in document)||matchMedia("(prefers-reduced-motion: reduce)").matches)return s(),null;let e=`${t}-${++M}`;l.style.viewTransitionName=e;let i=document.startViewTransition(s);return i.finished.finally(()=>{l.style.viewTransitionName===e&&(l.style.viewTransitionName="")}),i}var S={layout:{label:"Layout",cssClass:"sm-badge--layout"},section:{label:"Section",cssClass:"sm-badge--section"},dashboard:{label:"Dashboard",cssClass:"sm-badge--dashboard"},page:{label:"Page",cssClass:"sm-badge--page"},modal:{label:"Modal",cssClass:"sm-badge--modal"},redirect:{label:"Redirect",cssClass:"sm-badge--redirect"}},C={draft:{label:"Draft",cssClass:"sm-status--draft"},ready:{label:"Ready",cssClass:"sm-status--ready"},live:{label:"Live",cssClass:"sm-status--live"},deprecated:{label:"Deprecated",cssClass:"sm-status--deprecated"}},w=class l extends v{static get observedAttributes(){return["src","collapsed","compact","title","data-view","data-orientation","data-detail"]}static#l=0;#s=null;#i=null;#t=null;#m=null;#n=0;#o=0;setup(){if((this.getAttribute("mode")||"nav-enhance")!=="ia-tree"){this.#ct();return}l.#l++;let s=this.getAttribute("src");if(s&&!this.querySelector("nav")){this._loadSrc(s);return}let t=this.querySelector(":scope > nav");if(t){if(this.#n=0,this.#o=0,this.#k(t.querySelector("ul"),0),this.dataset.view==="visual"){this.#N(),this.#st(t),this.dispatchEvent(new CustomEvent("site-map:ready",{bubbles:!0,detail:{nodeCount:this.#n,depth:this.#o}}));return}this.#q(t.querySelector("ul"),0),this.#N(),t.classList.add("sm-tree"),t.setAttribute("role","tree"),t.setAttribute("aria-label",this.getAttribute("title")||"Site map"),this.#s=t,this.hasAttribute("collapsed")&&this.#T(),this.listen(t,"keydown",e=>this.#Q(e)),this.listen(t,"click",e=>this.#Z(e)),this.dispatchEvent(new CustomEvent("site-map:ready",{bubbles:!0,detail:{nodeCount:this.#n,depth:this.#o}}))}}teardown(){if((this.getAttribute("mode")||"nav-enhance")!=="ia-tree"){this.#dt();return}if(this.#t){this.#t.remove(),this.#t=null;let s=this.querySelector("nav");s&&(s.style.display="",s.removeAttribute("aria-hidden"))}this.#i&&(this.#i.remove(),this.#i=null),this.#s&&(this.#s.classList.remove("sm-tree"),this.#s.removeAttribute("role"),this.#s.removeAttribute("aria-label")),this.querySelectorAll(".sm-node-content, .sm-toggle").forEach(s=>s.remove()),this.querySelectorAll('li[role="treeitem"]').forEach(s=>{s.removeAttribute("role"),s.removeAttribute("aria-expanded"),s.removeAttribute("tabindex")}),this.querySelectorAll('ul[role="group"]').forEach(s=>{s.removeAttribute("role"),s.classList.remove("sm-subtree","sm-collapsed")}),this.#s=null,this.#m=null,this.#n=0,this.#o=0}attributeChangedCallback(s,t,e){(this.getAttribute("mode")||"nav-enhance")==="ia-tree"&&(t===e||!this.isConnected||s==="src"&&this._loadSrc(e))}#k(s,t){if(!s)return;let e=s.querySelectorAll(":scope > li");for(let i of e){this.#n++;let r=t+1;r>this.#o&&(this.#o=r);let o=i.querySelector(":scope > ul");o&&this.#k(o,r)}}#q(s,t){if(!s)return;t>0&&(s.setAttribute("role","group"),s.classList.add("sm-subtree"));let e=[...s.querySelectorAll(":scope > li")];for(let i of e){let r=!!i.querySelector(":scope > ul"),o=i.querySelector(":scope > a"),a=i.getAttribute("data-page-type")||"page",u=i.getAttribute("data-template")||"",p=i.getAttribute("data-status")||"";i.setAttribute("role","treeitem"),i.setAttribute("tabindex","-1");let n=document.createElement("span");if(n.className="sm-node-content",r){i.setAttribute("aria-expanded","true");let c=document.createElement("button");c.className="sm-toggle",c.setAttribute("type","button"),c.setAttribute("aria-hidden","true"),c.setAttribute("tabindex","-1"),c.textContent="\u25BE",n.appendChild(c)}else{let c=document.createElement("span");c.className="sm-leaf-marker",c.setAttribute("aria-hidden","true"),n.appendChild(c)}if(p&&C[p]){let c=document.createElement("span");c.className=`sm-status-dot ${C[p].cssClass}`,c.setAttribute("title",C[p].label),c.setAttribute("aria-label",C[p].label),n.appendChild(c)}if(o&&n.appendChild(o),S[a]){let c=document.createElement("span");c.className=`sm-badge ${S[a].cssClass}`,c.textContent=S[a].label,n.appendChild(c)}if(u){let c=document.createElement("span");c.className="sm-badge sm-badge--template",c.textContent=u,n.appendChild(c)}i.insertBefore(n,i.firstChild);let f=i.querySelector(":scope > ul");f&&this.#q(f,t+1)}}#N(){let s=this.getAttribute("title");if(!s&&this.#n===0)return;if(this.#i=document.createElement("div"),this.#i.className="sm-header",s){let i=document.createElement("h2");i.className="sm-title",i.textContent=s,this.#i.appendChild(i)}let t=document.createElement("span");t.className="sm-summary",t.textContent=`${this.#n} pages \xB7 ${this.#o} levels deep`,this.#i.appendChild(t);let e=document.createElement("button");e.className="sm-toggle-all",e.setAttribute("type","button"),e.textContent="Collapse all",e.addEventListener("click",()=>{this.querySelectorAll('li[aria-expanded="true"]').length>0?(this.#T(),e.textContent="Expand all"):(this.#K(),e.textContent="Collapse all")}),this.#i.appendChild(e),this.insertBefore(this.#i,this.firstChild)}#T(){let s=this.querySelectorAll("li[aria-expanded]");for(let t of s){t.setAttribute("aria-expanded","false");let e=t.querySelector(":scope > ul");e&&e.classList.add("sm-collapsed");let i=t.querySelector(":scope > .sm-node-content > .sm-toggle");i&&(i.textContent="\u25B8")}}#K(){let s=this.querySelectorAll("li[aria-expanded]");for(let t of s){t.setAttribute("aria-expanded","true");let e=t.querySelector(":scope > ul");e&&e.classList.remove("sm-collapsed");let i=t.querySelector(":scope > .sm-node-content > .sm-toggle");i&&(i.textContent="\u25BE")}}#b(s){let t=s.getAttribute("aria-expanded")==="true";s.setAttribute("aria-expanded",t?"false":"true");let e=s.querySelector(":scope > ul");e&&e.classList.toggle("sm-collapsed",t);let i=s.querySelector(":scope > .sm-node-content > .sm-toggle");i&&(i.textContent=t?"\u25B8":"\u25BE")}#Z(s){let t=s.target;if(t.closest(".sm-toggle")){s.preventDefault();let r=t.closest('li[role="treeitem"]');r&&this.#b(r);return}let e=t.closest('li[role="treeitem"]');if(!e)return;this.#c(e);let i=t.closest("a");i&&this.dispatchEvent(new CustomEvent("site-map:select",{bubbles:!0,detail:{href:i.getAttribute("href")||"",pageType:e.getAttribute("data-page-type")||"page",template:e.getAttribute("data-template")||""}}))}#Q(s){let t=s.target.closest('li[role="treeitem"]');if(!t)return;let e=s.key,i=!1;switch(e){case"ArrowDown":i=!0,this.#_(t);break;case"ArrowUp":i=!0,this.#tt(t);break;case"ArrowRight":if(i=!0,t.getAttribute("aria-expanded")==="false")this.#b(t);else if(t.getAttribute("aria-expanded")==="true"){let r=t.querySelector(':scope > ul > li[role="treeitem"]');r&&this.#c(r)}break;case"ArrowLeft":if(i=!0,t.getAttribute("aria-expanded")==="true")this.#b(t);else{let r=t.parentElement?.closest('li[role="treeitem"]');r&&this.#c(r)}break;case"Enter":i=!0,t.hasAttribute("aria-expanded")&&this.#b(t);break;case" ":i=!0;{let r=t.querySelector(":scope > .sm-node-content > a");r&&r.click()}break;case"Home":i=!0;{let r=this.querySelector('li[role="treeitem"]');r&&this.#c(r)}break;case"End":i=!0;{let r=this.#x();r.length&&this.#c(r[r.length-1])}break}i&&(s.preventDefault(),s.stopPropagation())}#x(){let s=[],t=i=>{if(!i)return;let r=[...i.querySelectorAll(':scope > li[role="treeitem"]')];for(let o of r)if(s.push(o),o.getAttribute("aria-expanded")==="true"){let a=o.querySelector(":scope > ul");a&&t(a)}},e=this.querySelector("nav > ul");return t(e),s}#_(s){let t=this.#x(),e=t.indexOf(s);e>=0&&e<t.length-1&&this.#c(t[e+1])}#tt(s){let t=this.#x(),e=t.indexOf(s);e>0&&this.#c(t[e-1])}#c(s){this.#m&&this.#m.setAttribute("tabindex","-1"),s.setAttribute("tabindex","0"),s.focus(),this.#m=s}static#g="http://www.w3.org/2000/svg";static#d=150;static#u=70;static#$=30;static#v=50;static#et=20;static#L={layout:{stroke:"#8b5cf6",fill:"#f5f3ff",text:"#6d28d9"},section:{stroke:"#3b82f6",fill:"#eff6ff",text:"#1d4ed8"},dashboard:{stroke:"#22c55e",fill:"#f0fdf4",text:"#15803d"},page:{stroke:"#94a3b8",fill:"#f8fafc",text:"#475569"},modal:{stroke:"#f59e0b",fill:"#fffbeb",text:"#b45309"},redirect:{stroke:"#ef4444",fill:"#fef2f2",text:"#b91c1c"}};static#M={draft:"#94a3b8",ready:"#f59e0b",live:"#22c55e",deprecated:"#ef4444"};#B(s){let t=[];for(let e of s.querySelectorAll(":scope > li")){let i=e.querySelector(":scope > a"),r=e.querySelector(":scope > ul");t.push({label:i?.textContent?.trim()||e.firstChild?.textContent?.trim()||"",href:i?.getAttribute("href")||"",pageType:e.getAttribute("data-page-type")||"page",template:e.getAttribute("data-template")||"",status:e.getAttribute("data-status")||"",children:r?this.#B(r):[],x:0,y:0,subtreeWidth:0,collapsed:!1,childCount:0})}return t}#D(s,t=0){let e=l.#d,i=l.#u,r=l.#$,o=l.#v;for(let a of s)a.childCount=this.#I(a),a.children.length>0&&!a.collapsed?(this.#D(a.children,t+1),a.subtreeWidth=a.children.reduce((u,p)=>u+p.subtreeWidth,0)+r*(a.children.length-1)):a.subtreeWidth=e,a.subtreeWidth=Math.max(a.subtreeWidth,e)}#I(s){let t=0;for(let e of s.children)t+=1+this.#I(e);return t}#z(s,t,e){let i=l.#d,r=l.#u,o=l.#$,a=l.#v,u=t;for(let p of s)p.x=u+(p.subtreeWidth-i)/2,p.y=e,p.children.length>0&&!p.collapsed&&this.#z(p.children,u,e+r+a),u+=p.subtreeWidth+o}#st(s){s.style.display="none",s.setAttribute("aria-hidden","true");let t=s.querySelector("ul");t&&(this.#e=this.#B(t),this.#h())}#e=null;#r=1;get#S(){return this.dataset.orientation==="horizontal"?"horizontal":"vertical"}get#P(){return Math.min(4,Math.max(0,parseInt(this.dataset.detail||"2",10)))}static#y={zoomIn:'<circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="11" x2="11" y1="8" y2="14"/><line x1="8" x2="14" y1="11" y2="11"/>',zoomOut:'<circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="8" x2="14" y1="11" y2="11"/>',reset:'<path d="M15 3h6v6"/><path d="m21 3-7 7"/><path d="m3 21 7-7"/><path d="M9 21H3v-6"/>',flip:'<path d="M21 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v3"/><path d="M21 16v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-3"/><path d="M4 12H2"/><path d="M10 12H8"/><path d="M16 12h-2"/><path d="M22 12h-2"/>'};static#H=["Shape","Shape + Title","Full","Full + Status","Wireframe"];#it(s){let t=this.#t?.querySelector(".sm-visual-scroll"),e=this.#t?.querySelector('svg[role="tree"]'),i={nodeId:null,rectTop:0,rectLeft:0,focusId:this.#p};if(!t||!e)return i;let r=s||this.#p;if(!r)return i;let a=e.querySelector(`[data-node-id="${r}"]`)?.querySelector("rect");if(!a)return i;let u=a.getBoundingClientRect(),p=t.getBoundingClientRect();return i.nodeId=r,i.rectTop=u.top-p.top,i.rectLeft=u.left-p.left,i}#F(s){let t=this.#t?.querySelector(".sm-visual-scroll"),e=this.#t?.querySelector('svg[role="tree"]');if(!(!t||!e)){if(s.nodeId){let r=e.querySelector(`[data-node-id="${s.nodeId}"]`)?.querySelector("rect");if(r){let o=r.getBoundingClientRect(),a=t.getBoundingClientRect(),u=o.top-a.top-s.rectTop,p=o.left-a.left-s.rectLeft;t.scrollTop+=u,t.scrollLeft+=p}}s.focusId&&(this.#a(s.focusId),e.focus({preventScroll:!0}))}}#h(s={}){if(!this.#e)return;let t=this.#it(s.anchorId||null),e=this.#t,i=l.#g,r=l.#d,o=l.#u,a=l.#et,u=this.#S==="horizontal";this.#D(this.#e),this.#z(this.#e,a,a);let p=this.#U(this.#e),n=p.maxX+r+a,f=p.maxY+o+a;u&&([n,f]=[f,n]),this.#t=document.createElement("div"),this.#t.className="sm-visual",this.#t.setAttribute("tabindex","-1"),this.#t.appendChild(this.#rt());let c=document.createElement("div");c.className="sm-visual-scroll";let h=document.createElementNS(i,"svg");h.setAttribute("viewBox",`0 0 ${n} ${f}`),h.setAttribute("width",String(n)),h.setAttribute("height",String(f)),h.setAttribute("role","img"),h.setAttribute("aria-label",`Site map${this.getAttribute("title")?": "+this.getAttribute("title"):""}`);let b=document.createElement("div");if(b.className="sm-visual-zoom",b.style.width=`${Math.round(n*this.#r)}px`,b.style.height=`${Math.round(f*this.#r)}px`,h.style.transform=`scale(${this.#r})`,h.style.transformOrigin="0 0",u){let y=document.createElementNS(i,"g");y.setAttribute("transform",`rotate(90 0 0) translate(0 -${f})`),this.#C(y,this.#e),this.#E(y,this.#e),h.appendChild(y)}else this.#C(h,this.#e),this.#E(h,this.#e);b.appendChild(h),c.appendChild(b),this.#t.appendChild(c);let d=document.createElement("div");d.className="sm-visual-summary";let m=Math.round(this.#r*100);d.textContent=`${this.#n} pages \xB7 ${this.#o} levels \xB7 ${m}%`,this.#t.appendChild(d);let g=this.#t,k=()=>{e&&e.isConnected?e.replaceWith(g):this.appendChild(g)},E=null;e?.isConnected?E=L(this,k,"sm-vt"):k(),E?E.updateCallbackDone.then(()=>this.#F(t)):this.#F(t),this.#lt(this.#t,h),this.listen(h,"click",y=>{let q=y.target,N=q.closest("[data-toggle]");if(N){let x=N.getAttribute("data-toggle");x&&this.#Y(x);return}let A=q.closest("[data-node-id]");if(A){let x=A.getAttribute("data-node-id");x&&this.#a(x),this.dispatchEvent(new CustomEvent("site-map:select",{bubbles:!0,detail:{href:A.getAttribute("data-href")||"",pageType:A.getAttribute("data-page-type")||"page",template:A.getAttribute("data-template")||""}}))}}),h.setAttribute("tabindex","0"),h.setAttribute("role","tree"),h.setAttribute("aria-label",`Site map${this.getAttribute("title")?": "+this.getAttribute("title"):""} \u2014 use arrow keys to navigate`),h.addEventListener("keydown",y=>this.#ot(y)),requestAnimationFrame(()=>{let y=h.querySelector("[data-node-id]");y&&this.#O(y)})}#rt(){let s=document.createElement("div");s.className="sm-vtoolbar",s.setAttribute("role","toolbar"),s.setAttribute("aria-label","Site map controls");let t=h=>`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${h}</svg>`,e=this.#A(t(l.#y.zoomIn),"Zoom in",()=>{this.#r=Math.min(3,this.#r+.25),this.#h()});s.appendChild(e);let i=this.#A(t(l.#y.zoomOut),"Zoom out",()=>{this.#r=Math.max(.25,this.#r-.25),this.#h()});s.appendChild(i);let r=this.#A(t(l.#y.reset),"Reset zoom",()=>{this.#r=1,this.#h()});s.appendChild(r);let o=document.createElement("span");o.className="sm-vtoolbar-sep",s.appendChild(o);let a=this.#S==="horizontal"?"Vertical":"Horizontal",u=this.#A(t(l.#y.flip),a,()=>{this.dataset.orientation=this.#S==="horizontal"?"vertical":"horizontal",this.#h()});s.appendChild(u),s.appendChild(o.cloneNode());let p=this.#P,n=document.createElement("label");n.className="sm-vtoolbar-detail",n.textContent="Detail ";let f=document.createElement("input");f.type="range",f.min="0",f.max="4",f.value=String(p),f.setAttribute("aria-label","Detail level"),f.className="sm-vtoolbar-slider",n.appendChild(f);let c=document.createElement("span");return c.className="sm-vtoolbar-detail-label",c.textContent=l.#H[p],n.appendChild(c),f.addEventListener("input",()=>{this.dataset.detail=f.value,c.textContent=l.#H[parseInt(f.value,10)],this.#h()}),s.appendChild(n),s}#A(s,t,e){let i=document.createElement("button");return i.type="button",i.className="sm-vtoolbar-btn",i.innerHTML=s,i.setAttribute("aria-label",t),i.setAttribute("title",t),i.addEventListener("click",e),i}#p=null;#W(s,t=""){let e=[];for(let i=0;i<s.length;i++){let r=s[i],o=t?`${t}-${i}`:String(i);e.push(o),r.children.length>0&&!r.collapsed&&e.push(...this.#W(r.children,o))}return e}#nt(s){let t=s.lastIndexOf("-");return t>0?s.slice(0,t):null}#ft(s){let t=this.#f(s,this.#e);return!t||t.collapsed||t.children.length===0?null:`${s}-0`}#a(s){if(!s||!this.#t)return;let t=this.#t.querySelector('svg[role="tree"]');if(!t)return;let e=t.querySelector(`[data-node-id="${s}"]`);if(!e)return;this.#O(e),this.#p=s;let i=e.querySelector("rect"),r=this.#t?.querySelector(".sm-visual-scroll");if(i&&r){let o=i.getBoundingClientRect(),a=r.getBoundingClientRect();(o.left<a.left||o.right>a.right||o.top<a.top||o.bottom>a.bottom)&&i.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}}#O(s){let t=s.closest("svg");if(!t)return;t.querySelectorAll(".sm-vfocus-ring").forEach(r=>r.remove()),t.querySelectorAll("[data-node-id]").forEach(r=>r.removeAttribute("aria-current"));let e=l.#g,i=s.querySelector("rect");if(i){let r=document.createElementNS(e,"rect");r.setAttribute("x",String(parseFloat(i.getAttribute("x")??"0")-3)),r.setAttribute("y",String(parseFloat(i.getAttribute("y")??"0")-3)),r.setAttribute("width",String(parseFloat(i.getAttribute("width")??"0")+6)),r.setAttribute("height",String(parseFloat(i.getAttribute("height")??"0")+6)),r.setAttribute("rx","11"),r.setAttribute("fill","none"),r.setAttribute("stroke","#3b82f6"),r.setAttribute("stroke-width","2"),r.setAttribute("class","sm-vfocus-ring"),s.parentNode?.insertBefore(r,s)}s.setAttribute("aria-current","true"),this.#p=s.getAttribute("data-node-id")}#ot(s){if(!this.#e)return;let t=this.#p||"0",e=!1;switch(s.key){case"ArrowDown":{e=!0;let i=this.#f(t,this.#e);i&&i.children.length>0&&!i.collapsed&&this.#a(`${t}-0`);break}case"ArrowUp":{e=!0;let i=this.#nt(t);i&&this.#a(i);break}case"ArrowRight":{e=!0;let i=this.#V(t,1);i&&this.#a(i);break}case"ArrowLeft":{e=!0;let i=this.#V(t,-1);i&&this.#a(i);break}case"Enter":case" ":{e=!0;let i=this.#f(t,this.#e);i&&i.children.length>0&&this.#Y(t);break}case"Home":{e=!0,this.#a("0");break}case"End":{e=!0;let i=this.#W(this.#e);i.length&&this.#a(i[i.length-1]);break}}e&&(s.preventDefault(),s.stopPropagation())}#V(s,t){let e=s.split("-").map(Number),i=e[e.length-1]+t;if(i<0)return null;let r=e.length>1?e.slice(0,-1).join("-"):null,o=r?this.#f(r,this.#e):null,a=o?o.children:this.#e;if(!a||i>=a.length)return null;let u=[...e];return u[u.length-1]=i,u.join("-")}#R=!1;#at={dragging:!1,startX:0,startY:0,scrollLeft:0,scrollTop:0,moved:!1};#lt(s,t){if(t.style.cursor="grab",this.#R)return;this.#R=!0;let e=this.#at;this.listen(this,"pointerdown",i=>{let r=i;if(r.target.closest("button, [data-toggle], .sm-vtoolbar, input"))return;let o=this.querySelector(".sm-visual-scroll");if(!o)return;e.dragging=!0,e.moved=!1,e.startX=r.clientX,e.startY=r.clientY,e.scrollLeft=o.scrollLeft,e.scrollTop=o.scrollTop;let a=this.querySelector('svg[role="tree"]');a&&(a.style.cursor="grabbing")}),this.listen(window,"pointermove",i=>{if(!e.dragging)return;let r=i,o=r.clientX-e.startX,a=r.clientY-e.startY;(Math.abs(o)>3||Math.abs(a)>3)&&(e.moved=!0);let u=this.querySelector(".sm-visual-scroll");u&&(u.scrollLeft=e.scrollLeft-o,u.scrollTop=e.scrollTop-a)}),this.listen(window,"pointerup",()=>{if(!e.dragging)return;e.dragging=!1;let i=this.querySelector('svg[role="tree"]');i&&(i.style.cursor="grab")}),this.listen(this,"click",i=>{e.moved&&(i.stopPropagation(),e.moved=!1)},{capture:!0})}#U(s){let t=0,e=0;for(let i of s)if(i.x+l.#d>t&&(t=i.x+l.#d),i.y+l.#u>e&&(e=i.y+l.#u),i.children.length>0&&!i.collapsed){let r=this.#U(i.children);r.maxX>t&&(t=r.maxX),r.maxY>e&&(e=r.maxY)}return{maxX:t,maxY:e}}#C(s,t){let e=l.#g,i=l.#d,r=l.#u,o=l.#v;for(let a of t){if(a.children.length===0||a.collapsed)continue;let u=a.x+i/2,p=a.y+r,n=p+o/2;for(let f of a.children){let c=f.x+i/2,h=f.y,b=document.createElementNS(e,"path");b.setAttribute("d",`M ${u} ${p} L ${u} ${n} L ${c} ${n} L ${c} ${h}`),b.setAttribute("fill","none"),b.setAttribute("stroke","#cbd5e1"),b.setAttribute("stroke-width","1.5"),s.appendChild(b)}this.#C(s,a.children)}}#E(s,t,e=""){let i=l.#g,r=l.#d,o=l.#u,a=this.#P,u=a>=4;for(let p=0;p<t.length;p++){let n=t[p],f=e?`${e}-${p}`:String(p),c=u?{stroke:"#94a3b8",fill:"#ffffff",text:"#475569"}:l.#L[n.pageType]||l.#L.page,h=document.createElementNS(i,"g");h.setAttribute("data-node-id",f),h.setAttribute("data-href",n.href),h.setAttribute("data-page-type",n.pageType),h.setAttribute("data-template",n.template),h.style.cursor="pointer";let b=document.createElementNS(i,"rect");if(b.setAttribute("x",String(n.x)),b.setAttribute("y",String(n.y)),b.setAttribute("width",String(r)),b.setAttribute("height",String(o)),b.setAttribute("rx","8"),b.setAttribute("fill",c.fill),b.setAttribute("stroke",c.stroke),b.setAttribute("stroke-width",u?"1":"2"),(u||n.pageType==="modal")&&b.setAttribute("stroke-dasharray","6 3"),h.appendChild(b),a>=1){let d=document.createElementNS(i,"text");d.setAttribute("x",String(n.x+r/2)),d.setAttribute("y",String(a===1?n.y+o/2+5:n.y+24)),d.setAttribute("text-anchor","middle"),d.setAttribute("font-size","13"),d.setAttribute("font-weight","600"),d.setAttribute("fill",c.text),d.setAttribute("font-family","system-ui, sans-serif"),d.textContent=n.label.length>18?n.label.slice(0,17)+"\u2026":n.label,h.appendChild(d)}if(a>=2){let d=document.createElementNS(i,"text");if(d.setAttribute("x",String(n.x+r/2)),d.setAttribute("y",String(n.y+40)),d.setAttribute("text-anchor","middle"),d.setAttribute("font-size","9"),d.setAttribute("font-weight","700"),d.setAttribute("fill",c.stroke),d.setAttribute("font-family","system-ui, sans-serif"),d.textContent=(S[n.pageType]?.label||n.pageType).toUpperCase(),h.appendChild(d),n.template){let m=document.createElementNS(i,"text");m.setAttribute("x",String(n.x+r/2)),m.setAttribute("y",String(n.y+54)),m.setAttribute("text-anchor","middle"),m.setAttribute("font-size","9"),m.setAttribute("fill","#94a3b8"),m.setAttribute("font-family","system-ui, sans-serif"),m.textContent=n.template,h.appendChild(m)}}if(a>=3&&n.status&&l.#M[n.status]){let d=document.createElementNS(i,"circle");d.setAttribute("cx",String(n.x+r/2)),d.setAttribute("cy",String(n.y+o-8)),d.setAttribute("r","4"),d.setAttribute("fill",u?"#94a3b8":l.#M[n.status]),h.appendChild(d)}if(u)for(let d=0;d<2;d++){let m=document.createElementNS(i,"line");m.setAttribute("x1",String(n.x+12)),m.setAttribute("x2",String(n.x+r-12)),m.setAttribute("y1",String(n.y+o-22+d*8)),m.setAttribute("y2",String(n.y+o-22+d*8)),m.setAttribute("stroke","#cbd5e1"),m.setAttribute("stroke-width","1"),m.setAttribute("stroke-dasharray","3 2"),h.appendChild(m)}if(n.children.length>0){let d=document.createElementNS(i,"g");d.setAttribute("data-toggle",f),d.style.cursor="pointer";let m=document.createElementNS(i,"circle");m.setAttribute("cx",String(n.x+r/2)),m.setAttribute("cy",String(n.y+o+10)),m.setAttribute("r","10"),m.setAttribute("fill",u?"#fff":"#f1f5f9"),m.setAttribute("stroke","#cbd5e1"),m.setAttribute("stroke-width","1"),d.appendChild(m);let g=document.createElementNS(i,"text");g.setAttribute("x",String(n.x+r/2)),g.setAttribute("y",String(n.y+o+14)),g.setAttribute("text-anchor","middle"),g.setAttribute("font-size","11"),g.setAttribute("font-weight","700"),g.setAttribute("fill","#64748b"),g.setAttribute("font-family","system-ui, sans-serif"),g.textContent=n.collapsed?`+${n.childCount}`:"\u2212",d.appendChild(g),h.appendChild(d)}s.appendChild(h),n.children.length>0&&!n.collapsed&&this.#E(s,n.children,f)}}#Y(s){let t=this.#f(s,this.#e);t&&(t.collapsed=!t.collapsed,this.#p||(this.#p=s),this.#h({anchorId:s}))}#f(s,t){if(!t)return null;let e=s.split("-").map(Number),i=t,r=null;for(let o of e){if(!i||o>=i.length)return null;r=i[o],i=r.children}return r}async _loadSrc(s){if(s)try{let t=await fetch(s);if(!t.ok)throw new Error(`HTTP ${t.status}`);let e=await t.json();e.title&&!this.getAttribute("title")&&this.setAttribute("title",e.title),this._setPages(e.pages||[])}catch(t){console.warn(`[site-map] Failed to load src="${s}":`,t)}}get pages(){let t=this.querySelector(":scope > nav")?.querySelector("ul");return t?this.#G(t):[]}set pages(s){this._setPages(Array.isArray(s)?s:[]),this.dispatchEvent(new CustomEvent("site-map:pages-changed",{detail:{pages:this.pages,source:"property"},bubbles:!0}))}_setPages(s){for(;this.firstChild;)this.firstChild.remove();let t=document.createElement("nav"),e=document.createElement("ul");this.#X(e,s),t.appendChild(e),this.appendChild(t),this.teardown(),this.removeAttribute("data-upgraded"),this.setup()}#G(s){let t=[];for(let e of s.querySelectorAll(":scope > li")){let i=e.querySelector(":scope > a"),r=e.querySelector(":scope > ul"),o={label:i?.textContent?.trim()||"",href:i?.getAttribute("href")||void 0,pageType:e.getAttribute("data-page-type")||void 0,template:e.getAttribute("data-template")||void 0,status:e.getAttribute("data-status")||void 0};r&&(o.children=this.#G(r)),t.push(o)}return t}#X(s,t){for(let e of t){let i=document.createElement("li");e.pageType&&i.setAttribute("data-page-type",e.pageType),e.template&&i.setAttribute("data-template",e.template),e.status&&i.setAttribute("data-status",e.status);let r=document.createElement("a");if(r.href=e.href||"#",r.textContent=e.label||"",i.appendChild(r),e.children&&e.children.length>0){let o=document.createElement("ul");this.#X(o,e.children),i.appendChild(o)}s.appendChild(i)}}#ct(){this.#j(),this.#w(),this.#ut(),this.getAttribute("src")&&this.#ht()}#dt(){this.querySelector(":scope > [data-sitemap-controls]")?.remove()}#j(){let s=this.getAttribute("current")||window.location.pathname,t=this.querySelectorAll("a");for(let e of t)new URL(e.href,window.location.origin).pathname===s&&e.setAttribute("aria-current","page")}#w(){let s=this.querySelector('[aria-current="page"]');if(!s)return;let t=s.parentElement;for(;t&&t!==this;)t.tagName==="DETAILS"&&(t.open=!0),t=t.parentElement}#ut(){let s=this.querySelectorAll("details");if(!s.length)return;let t=document.createElement("nav");t.setAttribute("data-sitemap-controls",""),t.setAttribute("aria-label","Sitemap controls");let e=document.createElement("button");e.type="button",e.textContent="Expand all",this.listen(e,"click",()=>{for(let r of s)r.open=!0});let i=document.createElement("button");i.type="button",i.textContent="Collapse all",this.listen(i,"click",()=>{for(let r of s)r.open=!1;this.#w()}),t.append(e,i),this.prepend(t)}async#ht(){let s=this.getAttribute("src");if(s)try{let t=await fetch(s);if(!t.ok)return;let e=await t.json();this.#pt(e)}catch{}}#pt(s){if(!s||!Array.isArray(s.children))return;let t=document.createElement("nav");t.setAttribute("aria-label","Full site map"),t.append(this.#J(s.children));let e=this.querySelector("nav");e?e.replaceWith(t):this.append(t),this.#j(),this.#w()}#J(s){let t=document.createElement("ul");for(let e of s){let i=document.createElement("li");if(e.children?.length){let r=document.createElement("details"),o=document.createElement("summary");o.textContent=e.title,r.append(o),r.append(this.#J(e.children)),i.append(r)}else{let r=document.createElement("a");r.href=e.href||e.path,r.textContent=e.title,i.append(r)}t.append(i)}return t}};$("site-map",w);export{w as SiteMap};
|
|
1
|
+
var z=window.matchMedia("(prefers-reduced-motion: reduce)");var k=new Map;function T(l,e,s={}){let t=s.priority??10,i={impl:e,bundle:s.bundle,contract:s.contract,priority:t},r=k.get(l);if(customElements.get(l)){if(!r||r.priority>=t){r&&r.priority===t&&r.impl!==e&&console.warn(`[VB Bundle] Tag <${l}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${s.bundle}".`);return}console.warn(`[VB Bundle] Tag <${l}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${s.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=t){r.priority===t&&console.warn(`[VB Bundle] Tag <${l}> already registered by "${r.bundle}". Skipping "${s.bundle}" (first wins at equal priority).`);return}k.set(l,i),customElements.define(l,e)}var w=class extends HTMLElement{#d=[];#s;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#d)e();this.#d=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,s,t,i){e.addEventListener(s,t,i),this.#d.push(()=>e.removeEventListener(s,t,i))}_reinit(){for(let e of this.#d)e();this.#d=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(e,s){this.#s||(this.#s=this.attachInternals());let t=this.#s.states;try{s?t.add(e):t.delete(e)}catch{let i=`--${e}`;s?t.add(i):t.delete(i)}}_adoptInternals(e){this.#s||(this.#s=e)}#i(){return this.constructor.formAssociated&&this.#s?this.#s:null}get validity(){return this.#i()?.validity}get validationMessage(){return this.#i()?.validationMessage??""}get willValidate(){return this.#i()?.willValidate??!1}get form(){return this.#i()?.form??null}checkValidity(){return this.#i()?.checkValidity()??!0}reportValidity(){return this.#i()?.reportValidity()??!0}};var B=0;function L(l,e,s="vb-vt"){if(!l?.isConnected||typeof document>"u"||!("startViewTransition"in document)||matchMedia("(prefers-reduced-motion: reduce)").matches)return e(),null;let t=`${s}-${++B}`;l.style.viewTransitionName=t;let i=document.startViewTransition(e);return i.finished.finally(()=>{l.style.viewTransitionName===t&&(l.style.viewTransitionName="")}),i}var x={layout:{label:"Layout",cssClass:"sm-badge--layout"},section:{label:"Section",cssClass:"sm-badge--section"},dashboard:{label:"Dashboard",cssClass:"sm-badge--dashboard"},page:{label:"Page",cssClass:"sm-badge--page"},modal:{label:"Modal",cssClass:"sm-badge--modal"},redirect:{label:"Redirect",cssClass:"sm-badge--redirect"}},S={draft:{label:"Draft",cssClass:"sm-status--draft"},ready:{label:"Ready",cssClass:"sm-status--ready"},live:{label:"Live",cssClass:"sm-status--live"},deprecated:{label:"Deprecated",cssClass:"sm-status--deprecated"}};function M(l){if(typeof l!="string"||!l.trim())return null;try{let e=new URL(l,document.baseURI);return e.protocol==="http:"||e.protocol==="https:"?l:null}catch{return null}}var I=0,q=class l extends w{static get observedAttributes(){return["src","collapsed","title","data-view","data-orientation","data-detail"]}#d=`sm-${++I}`;#s=!1;#i=null;#r=null;#t=null;#u=null;#a=0;#o=0;setup(){if((this.getAttribute("mode")||"nav-enhance")!=="ia-tree"){this.#pt();return}let e=this.getAttribute("src");if(e&&!this.querySelector("nav")){this._loadSrc(e);return}let s=this.querySelector(":scope > nav");if(!s)return;if(this.#a=0,this.#o=0,this.#T(s.querySelector("ul"),0),this.dataset.view==="visual"){this.#M(),this.#at(s),this.dispatchEvent(new CustomEvent("site-map:ready",{bubbles:!0,detail:{nodeCount:this.#a,depth:this.#o}}));return}this.#L(s.querySelector("ul"),0),this.#M(),s.classList.add("sm-tree"),s.setAttribute("role","tree"),s.setAttribute("aria-label",this.getAttribute("title")||"Site map"),this.#i=s,this.hasAttribute("collapsed")&&this.#B();let t=s.querySelector('a[aria-current="page"]')?.closest('li[role="treeitem"]')??null,i=t&&this.#g().includes(t)?t:s.querySelector('li[role="treeitem"]');i&&(i.setAttribute("tabindex","0"),this.#u=i),this.listen(s,"keydown",r=>this.#st(r)),this.listen(s,"click",r=>this.#et(r)),this.dispatchEvent(new CustomEvent("site-map:ready",{bubbles:!0,detail:{nodeCount:this.#a,depth:this.#o}}))}teardown(){if((this.getAttribute("mode")||"nav-enhance")!=="ia-tree"){this.#ft();return}if(this.#t){this.#t.remove(),this.#t=null;let e=this.querySelector(":scope > nav");e&&(e.hidden=!1,e.removeAttribute("aria-hidden"))}this.#e=null,this.#c=null,this.#r&&(this.#r.remove(),this.#r=null),this.#i&&(this.#i.classList.remove("sm-tree"),this.#i.removeAttribute("role"),this.#i.removeAttribute("aria-label")),this.querySelectorAll(".sm-node-content").forEach(e=>{let s=e.querySelector(":scope > a");s&&(s.removeAttribute("tabindex"),e.before(s)),e.remove()}),this.querySelectorAll(".sm-toggle").forEach(e=>e.remove()),this.querySelectorAll('li[role="treeitem"]').forEach(e=>{e.removeAttribute("role"),e.removeAttribute("aria-expanded"),e.removeAttribute("tabindex")}),this.querySelectorAll('ul[role="group"]').forEach(e=>{e.removeAttribute("role"),e.classList.remove("sm-subtree","sm-collapsed")}),this.#i=null,this.#q=!1,this.#u=null,this.#a=0,this.#o=0}attributeChangedCallback(e,s,t){if(!(s===t||!this.isConnected||!this.hasAttribute("data-upgraded"))){if((this.getAttribute("mode")||"nav-enhance")!=="ia-tree"){e==="src"&&t&&this.#Q();return}switch(e){case"src":t&&this._loadSrc(t);break;case"title":case"collapsed":case"data-view":this.#s||this._reinit();break;case"data-orientation":case"data-detail":!this.#s&&this.#e&&(this.#W(),this.#l());break}}}#T(e,s){if(!e)return;let t=e.querySelectorAll(":scope > li");for(let i of t){this.#a++;let r=s+1;r>this.#o&&(this.#o=r);let a=i.querySelector(":scope > ul");a&&this.#T(a,r)}}#L(e,s){if(!e)return;s>0&&(e.setAttribute("role","group"),e.classList.add("sm-subtree"));let t=[...e.querySelectorAll(":scope > li")];for(let i of t){let r=!!i.querySelector(":scope > ul"),a=i.querySelector(":scope > a"),o=i.getAttribute("data-page-type")||"page",u=i.getAttribute("data-template")||"",h=i.getAttribute("data-status")||"";i.setAttribute("role","treeitem"),i.setAttribute("tabindex","-1");let m=document.createElement("span");if(m.className="sm-node-content",r){i.setAttribute("aria-expanded","true");let c=document.createElement("button");c.className="sm-toggle",c.setAttribute("type","button"),c.setAttribute("aria-hidden","true"),c.setAttribute("tabindex","-1"),c.textContent="\u25BE",m.appendChild(c)}else{let c=document.createElement("span");c.className="sm-leaf-marker",c.setAttribute("aria-hidden","true"),m.appendChild(c)}if(h&&S[h]){let c=document.createElement("span");c.className=`sm-status-dot ${S[h].cssClass}`,c.setAttribute("title",S[h].label),c.setAttribute("aria-hidden","true"),m.appendChild(c);let g=document.createElement("span");g.className="visually-hidden",g.textContent=`${S[h].label}: `,m.appendChild(g)}if(a&&(a.setAttribute("tabindex","-1"),m.appendChild(a)),x[o]){let c=document.createElement("span");c.className=`sm-badge ${x[o].cssClass}`,c.textContent=x[o].label,m.appendChild(c)}if(u){let c=document.createElement("span");c.className="sm-badge sm-badge--template",c.textContent=u,m.appendChild(c)}i.insertBefore(m,i.firstChild);let n=i.querySelector(":scope > ul");n&&this.#L(n,s+1)}}#M(){let e=this.getAttribute("title");if(!e&&this.#a===0)return;if(this.#r=document.createElement("div"),this.#r.className="sm-header",e){let i=document.createElement("h2");i.className="sm-title",i.textContent=e,this.#r.appendChild(i)}let s=document.createElement("span");s.className="sm-summary",s.textContent=`${this.#a} pages \xB7 ${this.#o} levels deep`,this.#r.appendChild(s);let t=document.createElement("button");t.className="sm-toggle-all",t.setAttribute("type","button"),t.textContent="Collapse all",t.addEventListener("click",()=>{this.querySelectorAll('li[aria-expanded="true"]').length>0?(this.#B(),t.textContent="Expand all"):(this.#tt(),t.textContent="Collapse all")}),this.#r.appendChild(t),this.insertBefore(this.#r,this.firstChild)}#B(){let e=this.querySelectorAll("li[aria-expanded]");for(let s of e){s.setAttribute("aria-expanded","false");let t=s.querySelector(":scope > ul");t&&t.classList.add("sm-collapsed");let i=s.querySelector(":scope > .sm-node-content > .sm-toggle");i&&(i.textContent="\u25B8")}this.#I()}#I(){let e=this.#u;if(!e||!this.#i)return;let s=this.#g();if(s.includes(e))return;let t=e.parentElement?.closest('li[role="treeitem"]');for(;t&&!s.includes(t);)t=t.parentElement?.closest('li[role="treeitem"]');let i=t??s[0]??null;if(!i)return;let r=e.contains(document.activeElement);e.setAttribute("tabindex","-1"),i.setAttribute("tabindex","0"),this.#u=i,r&&i.focus()}#tt(){let e=this.querySelectorAll("li[aria-expanded]");for(let s of e){s.setAttribute("aria-expanded","true");let t=s.querySelector(":scope > ul");t&&t.classList.remove("sm-collapsed");let i=s.querySelector(":scope > .sm-node-content > .sm-toggle");i&&(i.textContent="\u25BE")}}#b(e){let s=e.getAttribute("aria-expanded")==="true";e.setAttribute("aria-expanded",s?"false":"true");let t=e.querySelector(":scope > ul");t&&t.classList.toggle("sm-collapsed",s);let i=e.querySelector(":scope > .sm-node-content > .sm-toggle");i&&(i.textContent=s?"\u25B8":"\u25BE"),s&&this.#I()}#et(e){let s=e.target;if(s.closest(".sm-toggle")){e.preventDefault();let r=s.closest('li[role="treeitem"]');r&&this.#b(r);return}let t=s.closest('li[role="treeitem"]');if(!t)return;this.#h(t);let i=s.closest("a");i&&this.dispatchEvent(new CustomEvent("site-map:select",{bubbles:!0,detail:{href:i.getAttribute("href")||"",pageType:t.getAttribute("data-page-type")||"page",template:t.getAttribute("data-template")||""}}))}#st(e){let s=e.target,t=s.closest('li[role="treeitem"]');if(!t||e.key==="Enter"&&s.closest("a")&&s!==t||e.altKey||e.ctrlKey||e.metaKey)return;let i=this.matches(":dir(rtl)"),r=e.key;i&&r==="ArrowRight"?r="ArrowLeft":i&&r==="ArrowLeft"&&(r="ArrowRight");let a=!1;switch(r){case"ArrowDown":a=!0,this.#it(t);break;case"ArrowUp":a=!0,this.#rt(t);break;case"ArrowRight":if(a=!0,t.getAttribute("aria-expanded")==="false")this.#b(t);else if(t.getAttribute("aria-expanded")==="true"){let o=t.querySelector(':scope > ul > li[role="treeitem"]');o&&this.#h(o)}break;case"ArrowLeft":if(a=!0,t.getAttribute("aria-expanded")==="true")this.#b(t);else{let o=t.parentElement?.closest('li[role="treeitem"]');o&&this.#h(o)}break;case"Enter":{a=!0;let o=t.querySelector(":scope > .sm-node-content > a[href]");o?o.click():t.hasAttribute("aria-expanded")&&this.#b(t);break}case" ":{a=!0,t.hasAttribute("aria-expanded")?this.#b(t):t.querySelector(":scope > .sm-node-content > a[href]")?.click();break}case"Home":a=!0;{let o=this.querySelector('li[role="treeitem"]');o&&this.#h(o)}break;case"End":a=!0;{let o=this.#g();o.length&&this.#h(o[o.length-1])}break}a&&(e.preventDefault(),e.stopPropagation())}#g(){let e=[],s=i=>{if(!i)return;let r=[...i.querySelectorAll(':scope > li[role="treeitem"]')];for(let a of r)if(e.push(a),a.getAttribute("aria-expanded")==="true"){let o=a.querySelector(":scope > ul");o&&s(o)}},t=this.querySelector("nav > ul");return s(t),e}#it(e){let s=this.#g(),t=s.indexOf(e);t>=0&&t<s.length-1&&this.#h(s[t+1])}#rt(e){let s=this.#g(),t=s.indexOf(e);t>0&&this.#h(s[t-1])}#h(e){this.#u&&this.#u.setAttribute("tabindex","-1"),e.setAttribute("tabindex","0"),e.focus(),this.#u=e}static#v="http://www.w3.org/2000/svg";static#p=150;static#m=70;static#z=30;static#w=50;static#nt=20;#D(e){let s=[];for(let t of e.querySelectorAll(":scope > li")){let i=t.querySelector(":scope > a"),r=t.querySelector(":scope > ul");s.push({label:i?.textContent?.trim()||t.firstChild?.textContent?.trim()||"",href:i?.getAttribute("href")||"",pageType:t.getAttribute("data-page-type")||"page",template:t.getAttribute("data-template")||"",status:t.getAttribute("data-status")||"",children:r?this.#D(r):[],x:0,y:0,subtreeWidth:0,collapsed:!1,childCount:0})}return s}#H(e,s=0){let t=l.#p,i=l.#m,r=l.#z,a=l.#w;for(let o of e)o.childCount=this.#P(o),o.children.length>0&&!o.collapsed?(this.#H(o.children,s+1),o.subtreeWidth=o.children.reduce((u,h)=>u+h.subtreeWidth,0)+r*(o.children.length-1)):o.subtreeWidth=t,o.subtreeWidth=Math.max(o.subtreeWidth,t)}#P(e){let s=0;for(let t of e.children)s+=1+this.#P(t);return s}#V(e,s,t){let i=l.#p,r=l.#m,a=l.#z,o=l.#w,u=s;for(let h of e)h.x=u+(h.subtreeWidth-i)/2,h.y=t,h.children.length>0&&!h.collapsed&&this.#V(h.children,u,t+r+o),u+=h.subtreeWidth+a}#at(e){e.hidden=!0,e.setAttribute("aria-hidden","true");let s=e.querySelector("ul");s&&(this.#e=this.#D(s),this.#l())}#e=null;#n=1;get#S(){return this.dataset.orientation==="horizontal"?"horizontal":"vertical"}get#y(){return Math.min(4,Math.max(0,parseInt(this.dataset.detail||"2",10)))}static#x={zoomIn:'<circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="11" x2="11" y1="8" y2="14"/><line x1="8" x2="14" y1="11" y2="11"/>',zoomOut:'<circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="8" x2="14" y1="11" y2="11"/>',reset:'<path d="M15 3h6v6"/><path d="m21 3-7 7"/><path d="m3 21 7-7"/><path d="M9 21H3v-6"/>',flip:'<path d="M21 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v3"/><path d="M21 16v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-3"/><path d="M4 12H2"/><path d="M10 12H8"/><path d="M16 12h-2"/><path d="M22 12h-2"/>'};static#C=["Shape","Shape + Title","Full","Full + Status","Wireframe"];#ot(e){let s=this.#t?.querySelector(".sm-visual-scroll"),t=this.#t?.querySelector('svg[role="tree"]'),i={nodeId:null,rectTop:0,rectLeft:0,focusId:this.#c};if(!s||!t)return i;let r=e||this.#c;if(!r)return i;let o=t.querySelector(`[data-node-id="${r}"]`)?.querySelector("rect");if(!o)return i;let u=o.getBoundingClientRect(),h=s.getBoundingClientRect();return i.nodeId=r,i.rectTop=u.top-h.top,i.rectLeft=u.left-h.left,i}#F(e,s){let t=this.#t?.querySelector(".sm-visual-scroll"),i=this.#t?.querySelector('svg[role="tree"]');if(!t||!i)return;if(e.nodeId){let u=i.querySelector(`[data-node-id="${e.nodeId}"]`)?.querySelector("rect");if(u){let h=u.getBoundingClientRect(),m=t.getBoundingClientRect(),n=h.top-m.top-e.rectTop,c=h.left-m.left-e.rectLeft;t.scrollTop+=n,t.scrollLeft+=c}}let r=e.focusId&&i.querySelector(`[data-node-id="${e.focusId}"]`)?e.focusId:"0",a=i.querySelector(`[data-node-id="${r}"]`);a&&this.#U(a),s&&i.focus({preventScroll:!0})}#l(e={}){if(!this.#e)return;let s=this.#ot(e.anchorId||null),t=this.#t?.querySelector(".sm-visual-scroll")??null,i=!!t&&t.contains(document.activeElement),r=l.#v,a=l.#p,o=l.#m,u=l.#nt,h=this.#S==="horizontal";this.#H(this.#e),this.#V(this.#e,u,u);let m=this.#G(this.#e),n=m.maxX+a+u,c=m.maxY+o+u;h&&([n,c]=[c,n]);let g=this.#t?.querySelector(".sm-visual-summary");this.#t||(this.#t=document.createElement("div"),this.#t.className="sm-visual",this.#t.appendChild(this.#lt()),g=document.createElement("div"),g.className="sm-visual-summary",this.#t.appendChild(g),this.appendChild(this.#t));let p=document.createElement("div");p.className="sm-visual-scroll";let b=document.createElementNS(r,"svg");b.setAttribute("viewBox",`0 0 ${n} ${c}`),b.setAttribute("width",String(n)),b.setAttribute("height",String(c)),b.setAttribute("class",`sm-vsvg${this.#y>=4?" sm-vsvg--wireframe":""}`);let y=document.createElement("div");if(y.className="sm-visual-zoom",y.style.width=`${Math.round(n*this.#n)}px`,y.style.height=`${Math.round(c*this.#n)}px`,b.style.transform=`scale(${this.#n})`,b.style.transformOrigin="0 0",h){let v=document.createElementNS(r,"g");v.setAttribute("transform",`rotate(90 0 0) translate(0 -${c})`),this.#N(v,this.#e),this.#$(v,this.#e),b.appendChild(v)}else this.#N(b,this.#e),this.#$(b,this.#e);if(y.appendChild(b),p.appendChild(y),g){let v=Math.round(this.#n*100);g.textContent=`${this.#a} pages \xB7 ${this.#o} levels \xB7 ${v}%`}b.setAttribute("tabindex","0"),b.setAttribute("role","tree"),b.setAttribute("aria-label",`Site map${this.getAttribute("title")?": "+this.getAttribute("title"):""}`),b.addEventListener("keydown",v=>this.#dt(v)),b.addEventListener("click",v=>{let N=v.target,$=N.closest("[data-toggle]");if($){let E=$.getAttribute("data-toggle");E&&this.#X(E);return}let C=N.closest("[data-node-id]");if(C){let E=C.getAttribute("data-node-id");E&&this.#f(E),this.dispatchEvent(new CustomEvent("site-map:select",{bubbles:!0,detail:{href:C.getAttribute("data-href")||"",pageType:C.getAttribute("data-page-type")||"page",template:C.getAttribute("data-template")||""}}))}});let d=this.#t,f=()=>{t&&t.isConnected?t.replaceWith(p):d.insertBefore(p,d.querySelector(".sm-visual-summary"))},A=null;t?.isConnected?A=L(this,f,"sm-vt"):f(),A?A.updateCallbackDone.then(()=>this.#F(s,i)):this.#F(s,i),this.#ht(d,b)}#W(){let e=this.#t?.querySelector(".sm-vtoolbar");if(!e)return;let s=e.querySelector("[data-sm-flip]"),t=this.#S==="horizontal"?"Vertical":"Horizontal";s?.setAttribute("aria-label",t),s?.setAttribute("title",t);let i=e.querySelector(".sm-vtoolbar-slider");i&&(i.value=String(this.#y));let r=e.querySelector(".sm-vtoolbar-detail-label");r&&(r.textContent=l.#C[this.#y])}#R(e,s){this.#s=!0,this.dataset[e]=s,this.#s=!1}#lt(){let e=document.createElement("div");e.className="sm-vtoolbar",e.setAttribute("role","toolbar"),e.setAttribute("aria-label","Site map controls");let s=g=>`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${g}</svg>`,t=this.#E(s(l.#x.zoomIn),"Zoom in",()=>{this.#n=Math.min(3,this.#n+.25),this.#l()});e.appendChild(t);let i=this.#E(s(l.#x.zoomOut),"Zoom out",()=>{this.#n=Math.max(.25,this.#n-.25),this.#l()});e.appendChild(i);let r=this.#E(s(l.#x.reset),"Reset zoom",()=>{this.#n=1,this.#l()});e.appendChild(r);let a=document.createElement("span");a.className="sm-vtoolbar-sep",e.appendChild(a);let o=this.#S==="horizontal"?"Vertical":"Horizontal",u=this.#E(s(l.#x.flip),o,()=>{this.#R("orientation",this.#S==="horizontal"?"vertical":"horizontal"),this.#W(),this.#l()});u.setAttribute("data-sm-flip",""),e.appendChild(u),e.appendChild(a.cloneNode());let h=this.#y,m=document.createElement("label");m.className="sm-vtoolbar-detail",m.textContent="Detail ";let n=document.createElement("input");n.type="range",n.min="0",n.max="4",n.value=String(h),n.setAttribute("aria-label","Detail level"),n.className="sm-vtoolbar-slider",m.appendChild(n);let c=document.createElement("span");return c.className="sm-vtoolbar-detail-label",c.textContent=l.#C[h],m.appendChild(c),n.addEventListener("input",()=>{this.#R("detail",n.value),c.textContent=l.#C[parseInt(n.value,10)],n.setAttribute("aria-valuetext",c.textContent),this.#l()}),n.setAttribute("aria-valuetext",l.#C[h]),e.appendChild(m),e}#E(e,s,t){let i=document.createElement("button");return i.type="button",i.className="sm-vtoolbar-btn",i.innerHTML=e,i.setAttribute("aria-label",s),i.setAttribute("title",s),i.addEventListener("click",t),i}#c=null;#O(e,s=""){let t=[];for(let i=0;i<e.length;i++){let r=e[i],a=s?`${s}-${i}`:String(i);t.push(a),r.children.length>0&&!r.collapsed&&t.push(...this.#O(r.children,a))}return t}#ct(e){let s=e.lastIndexOf("-");return s>0?e.slice(0,s):null}#gt(e){let s=this.#A(e,this.#e);return!s||s.collapsed||s.children.length===0?null:`${e}-0`}#f(e){if(!e||!this.#t)return;let s=this.#t.querySelector('svg[role="tree"]');if(!s)return;let t=s.querySelector(`[data-node-id="${e}"]`);if(!t)return;this.#U(t),this.#c=e;let i=t.querySelector("rect"),r=this.#t?.querySelector(".sm-visual-scroll");if(i&&r){let a=i.getBoundingClientRect(),o=r.getBoundingClientRect();(a.left<o.left||a.right>o.right||a.top<o.top||a.bottom>o.bottom)&&i.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}}#U(e){let s=e.closest("svg");if(!s)return;s.querySelectorAll(".sm-vfocus-ring").forEach(r=>r.remove()),s.querySelectorAll('[data-node-id][aria-selected="true"]').forEach(r=>r.setAttribute("aria-selected","false"));let t=l.#v,i=e.querySelector("rect");if(i){let r=document.createElementNS(t,"rect");r.setAttribute("x",String(parseFloat(i.getAttribute("x")??"0")-3)),r.setAttribute("y",String(parseFloat(i.getAttribute("y")??"0")-3)),r.setAttribute("width",String(parseFloat(i.getAttribute("width")??"0")+6)),r.setAttribute("height",String(parseFloat(i.getAttribute("height")??"0")+6)),r.setAttribute("rx","11"),r.setAttribute("class","sm-vfocus-ring"),r.setAttribute("aria-hidden","true"),e.parentNode?.insertBefore(r,e)}e.setAttribute("aria-selected","true"),e.id&&s.setAttribute("aria-activedescendant",e.id),this.#c=e.getAttribute("data-node-id")}#dt(e){if(!this.#e)return;let s=this.#c||"0",t=!1;switch(e.key){case"ArrowDown":{t=!0;let i=this.#A(s,this.#e);i&&i.children.length>0&&!i.collapsed&&this.#f(`${s}-0`);break}case"ArrowUp":{t=!0;let i=this.#ct(s);i&&this.#f(i);break}case"ArrowRight":{t=!0;let i=this.#Y(s,1);i&&this.#f(i);break}case"ArrowLeft":{t=!0;let i=this.#Y(s,-1);i&&this.#f(i);break}case"Enter":case" ":{t=!0;let i=this.#A(s,this.#e);i&&i.children.length>0&&this.#X(s);break}case"Home":{t=!0,this.#f("0");break}case"End":{t=!0;let i=this.#O(this.#e);i.length&&this.#f(i[i.length-1]);break}}t&&(e.preventDefault(),e.stopPropagation())}#Y(e,s){let t=e.split("-").map(Number),i=t[t.length-1]+s;if(i<0)return null;let r=t.length>1?t.slice(0,-1).join("-"):null,a=r?this.#A(r,this.#e):null,o=a?a.children:this.#e;if(!o||i>=o.length)return null;let u=[...t];return u[u.length-1]=i,u.join("-")}#q=!1;#ut={dragging:!1,startX:0,startY:0,scrollLeft:0,scrollTop:0,moved:!1};#ht(e,s){if(s.style.cursor="grab",this.#q)return;this.#q=!0;let t=this.#ut;this.listen(this,"pointerdown",i=>{let r=i;if(r.target.closest("button, [data-toggle], .sm-vtoolbar, input"))return;let a=this.querySelector(".sm-visual-scroll");if(!a)return;t.dragging=!0,t.moved=!1,t.startX=r.clientX,t.startY=r.clientY,t.scrollLeft=a.scrollLeft,t.scrollTop=a.scrollTop;let o=this.querySelector('svg[role="tree"]');o&&(o.style.cursor="grabbing")}),this.listen(window,"pointermove",i=>{if(!t.dragging)return;let r=i,a=r.clientX-t.startX,o=r.clientY-t.startY;(Math.abs(a)>3||Math.abs(o)>3)&&(t.moved=!0);let u=this.querySelector(".sm-visual-scroll");u&&(u.scrollLeft=t.scrollLeft-a,u.scrollTop=t.scrollTop-o)}),this.listen(window,"pointerup",()=>{if(!t.dragging)return;t.dragging=!1;let i=this.querySelector('svg[role="tree"]');i&&(i.style.cursor="grab")}),this.listen(this,"click",i=>{t.moved&&(i.stopPropagation(),t.moved=!1)},{capture:!0})}#G(e){let s=0,t=0;for(let i of e)if(i.x+l.#p>s&&(s=i.x+l.#p),i.y+l.#m>t&&(t=i.y+l.#m),i.children.length>0&&!i.collapsed){let r=this.#G(i.children);r.maxX>s&&(s=r.maxX),r.maxY>t&&(t=r.maxY)}return{maxX:s,maxY:t}}#N(e,s){let t=l.#v,i=l.#p,r=l.#m,a=l.#w;for(let o of s){if(o.children.length===0||o.collapsed)continue;let u=o.x+i/2,h=o.y+r,m=h+a/2;for(let n of o.children){let c=n.x+i/2,g=n.y,p=document.createElementNS(t,"path");p.setAttribute("d",`M ${u} ${h} L ${u} ${m} L ${c} ${m} L ${c} ${g}`),p.setAttribute("class","sm-vedge"),p.setAttribute("aria-hidden","true"),e.appendChild(p)}this.#N(e,o.children)}}#$(e,s,t=""){let i=l.#v,r=l.#p,a=l.#m,o=this.#y,u=o>=4,h=t?t.split("-").length+1:1;for(let m=0;m<s.length;m++){let n=s[m],c=t?`${t}-${m}`:String(m),g=x[n.pageType]?n.pageType:"page",p=document.createElementNS(i,"g");p.setAttribute("class",`sm-vnode sm-vnode--${g}`),p.id=`${this.#d}-n-${c}`,p.setAttribute("role","treeitem"),p.setAttribute("aria-level",String(h)),p.setAttribute("aria-setsize",String(s.length)),p.setAttribute("aria-posinset",String(m+1)),p.setAttribute("aria-selected","false"),n.children.length>0&&p.setAttribute("aria-expanded",n.collapsed?"false":"true");let b=n.status&&S[n.status]?`, ${S[n.status].label}`:"";p.setAttribute("aria-label",`${n.label||n.href||"Untitled"}, ${x[g].label}${n.template?`, ${n.template}`:""}${b}`),p.setAttribute("data-node-id",c),p.setAttribute("data-href",n.href),p.setAttribute("data-page-type",n.pageType),p.setAttribute("data-template",n.template),p.style.cursor="pointer";let y=document.createElementNS(i,"rect");if(y.setAttribute("x",String(n.x)),y.setAttribute("y",String(n.y)),y.setAttribute("width",String(r)),y.setAttribute("height",String(a)),y.setAttribute("rx","8"),y.setAttribute("class","sm-vbox"),(u||n.pageType==="modal")&&y.setAttribute("stroke-dasharray","6 3"),p.appendChild(y),o>=1){let d=document.createElementNS(i,"text");d.setAttribute("x",String(n.x+r/2)),d.setAttribute("y",String(o===1?n.y+a/2+5:n.y+24)),d.setAttribute("text-anchor","middle"),d.setAttribute("font-size","13"),d.setAttribute("font-weight","600"),d.setAttribute("class","sm-vlabel"),d.textContent=n.label.length>18?n.label.slice(0,17)+"\u2026":n.label,p.appendChild(d)}if(o>=2){let d=document.createElementNS(i,"text");if(d.setAttribute("x",String(n.x+r/2)),d.setAttribute("y",String(n.y+40)),d.setAttribute("text-anchor","middle"),d.setAttribute("font-size","9"),d.setAttribute("font-weight","700"),d.setAttribute("class","sm-vtype"),d.textContent=(x[n.pageType]?.label||n.pageType).toUpperCase(),p.appendChild(d),n.template){let f=document.createElementNS(i,"text");f.setAttribute("x",String(n.x+r/2)),f.setAttribute("y",String(n.y+54)),f.setAttribute("text-anchor","middle"),f.setAttribute("font-size","9"),f.setAttribute("class","sm-vtemplate"),f.textContent=n.template,p.appendChild(f)}}if(o>=3&&n.status&&S[n.status]){let d=document.createElementNS(i,"circle");d.setAttribute("cx",String(n.x+r/2)),d.setAttribute("cy",String(n.y+a-8)),d.setAttribute("r","4"),d.setAttribute("class",`sm-vstatus sm-vstatus--${n.status}`),p.appendChild(d)}if(u)for(let d=0;d<2;d++){let f=document.createElementNS(i,"line");f.setAttribute("x1",String(n.x+12)),f.setAttribute("x2",String(n.x+r-12)),f.setAttribute("y1",String(n.y+a-22+d*8)),f.setAttribute("y2",String(n.y+a-22+d*8)),f.setAttribute("class","sm-vwire"),p.appendChild(f)}if(n.children.length>0){let d=document.createElementNS(i,"g");d.setAttribute("data-toggle",c),d.setAttribute("class","sm-vtoggle"),d.setAttribute("aria-hidden","true");let f=document.createElementNS(i,"circle");f.setAttribute("cx",String(n.x+r/2)),f.setAttribute("cy",String(n.y+a+10)),f.setAttribute("r","10"),d.appendChild(f);let A=document.createElementNS(i,"text");A.setAttribute("x",String(n.x+r/2)),A.setAttribute("y",String(n.y+a+14)),A.setAttribute("text-anchor","middle"),A.setAttribute("font-size","11"),A.setAttribute("font-weight","700"),A.textContent=n.collapsed?`+${n.childCount}`:"\u2212",d.appendChild(A),p.appendChild(d)}e.appendChild(p),n.children.length>0&&!n.collapsed&&this.#$(e,n.children,c)}}#X(e){let s=this.#A(e,this.#e);s&&(s.collapsed=!s.collapsed,this.#c||(this.#c=e),this.#l({anchorId:e}))}#A(e,s){if(!s)return null;let t=e.split("-").map(Number),i=s,r=null;for(let a of t){if(!i||a>=i.length)return null;r=i[a],i=r.children}return r}async _loadSrc(e){if(e)try{let s=await fetch(e);if(!s.ok)throw new Error(`HTTP ${s.status}`);let t=await s.json();t.title&&!this.getAttribute("title")&&(this.#s=!0,this.setAttribute("title",String(t.title)),this.#s=!1),this._setPages(t.pages||[])}catch(s){console.warn(`[site-map] Failed to load src="${e}":`,s)}}get pages(){let s=this.querySelector(":scope > nav")?.querySelector("ul");return s?this.#j(s):[]}set pages(e){this._setPages(Array.isArray(e)?e:[]),this.dispatchEvent(new CustomEvent("site-map:pages-changed",{detail:{pages:this.pages,source:"property"},bubbles:!0}))}_setPages(e){for(;this.firstChild;)this.firstChild.remove();let s=document.createElement("nav"),t=document.createElement("ul");this.#K(t,e),s.appendChild(t),this.appendChild(s),this._reinit()}#j(e){let s=[];for(let t of e.querySelectorAll(":scope > li")){let i=t.querySelector(":scope > a, :scope > .sm-node-content > a"),r=t.querySelector(":scope > ul"),a={label:i?.textContent?.trim()||"",href:i?.getAttribute("href")||void 0,pageType:t.getAttribute("data-page-type")||void 0,template:t.getAttribute("data-template")||void 0,status:t.getAttribute("data-status")||void 0};r&&(a.children=this.#j(r)),s.push(a)}return s}#K(e,s){for(let t of s){let i=document.createElement("li");t.pageType&&i.setAttribute("data-page-type",t.pageType),t.template&&i.setAttribute("data-template",t.template),t.status&&i.setAttribute("data-status",t.status);let r=document.createElement("a"),a=M(t.href);if(a&&r.setAttribute("href",a),r.textContent=String(t.label??""),i.appendChild(r),t.children&&t.children.length>0){let o=document.createElement("ul");this.#K(o,t.children),i.appendChild(o)}e.appendChild(i)}}#pt(){this.#J(),this.#k(),this.#Z(),this.getAttribute("src")&&this.#Q()}#mt(){return this.querySelector(":scope > nav:not([data-sitemap-controls])")}#ft(){this.querySelector(":scope > [data-sitemap-controls]")?.remove()}#J(){let e=this.getAttribute("current")||window.location.pathname,s=this.querySelectorAll("a");for(let t of s){if(!t.hasAttribute("href"))continue;new URL(t.href,window.location.origin).pathname===e&&t.setAttribute("aria-current","page")}}#k(){let e=this.querySelector('[aria-current="page"]');if(!e)return;let s=e.parentElement;for(;s&&s!==this;)s.tagName==="DETAILS"&&(s.open=!0),s=s.parentElement}#Z(){if(this.querySelector(":scope > [data-sitemap-controls]")?.remove(),!this.querySelector("details"))return;let e=()=>this.querySelectorAll("details"),s=document.createElement("nav");s.setAttribute("data-sitemap-controls",""),s.setAttribute("aria-label","Sitemap controls");let t=document.createElement("button");t.type="button",t.textContent="Expand all",this.listen(t,"click",()=>{for(let r of e())r.open=!0});let i=document.createElement("button");i.type="button",i.textContent="Collapse all",this.listen(i,"click",()=>{for(let r of e())r.open=!1;this.#k()}),s.append(t,i),this.prepend(s)}async#Q(){let e=this.getAttribute("src");if(e)try{let s=await fetch(e);if(!s.ok)return;let t=await s.json();this.#bt(t)}catch{}}#bt(e){if(!e||!Array.isArray(e.children))return;let s=this.#mt(),t=document.createElement("nav");t.setAttribute("aria-label",s?.getAttribute("aria-label")||"Full site map"),t.append(this.#_(e.children)),s?s.replaceWith(t):this.append(t),this.#J(),this.#k(),this.#Z()}#_(e){let s=document.createElement("ul");for(let t of e){let i=document.createElement("li");if(t.children?.length){let r=document.createElement("details"),a=document.createElement("summary");a.textContent=String(t.title??""),r.append(a),r.append(this.#_(t.children)),i.append(r)}else{let r=document.createElement("a"),a=M(t.href||t.path);a&&r.setAttribute("href",a),r.textContent=String(t.title??""),i.append(r)}s.append(i)}return s}};T("site-map",q);export{q as SiteMap};
|
|
2
2
|
//# sourceMappingURL=site-map.js.map
|
|
@@ -1,52 +1,2 @@
|
|
|
1
|
-
var v=/Mac|iPhone|iPad|iPod/.test(navigator.platform??"");function d(s){let t=s.toLowerCase().split("+").map(i=>i.trim());return{key:t.pop()??"",meta:t.includes("meta")||t.includes("cmd"),ctrl:t.includes("ctrl"),shift:t.includes("shift"),alt:t.includes("alt")}}function h(s,t){if(s.key.toLowerCase()!==t.key)return!1;let e,i;return v?(e=t.meta,i=t.ctrl):(e=!1,i=t.meta||t.ctrl),!(e!==s.metaKey||i!==s.ctrlKey||t.shift!==s.shiftKey||t.alt!==s.altKey)}var g=new Set(["INPUT","TEXTAREA","SELECT"]),a=[],f=!1;function k(s){let t=g.has(s.target.tagName)||s.target.isContentEditable;for(let e of a)if(!(t&&!e.global)&&h(s,e.descriptor)){s.preventDefault(),e.callback(s);return}}function E(){f||(document.addEventListener("keydown",k),f=!0)}function p(s,t,e={}){E();let i=d(s),r={combo:s,descriptor:i,callback:t,global:e.global===!0};return a.find(l=>l.combo===s)&&console.warn(`[hotkey-bind] Shortcut "${s}" already bound. Last-connected-wins.`),a.unshift(r),function(){let u=a.indexOf(r);u!==-1&&a.splice(u,1)}}function b(){return a.map(s=>s.combo)}var L=window.matchMedia("(prefers-reduced-motion: reduce)");var m=new Map;function y(s,t,e={}){let i=e.priority??10,r={impl:t,bundle:e.bundle,contract:e.contract,priority:i},n=m.get(s);if(customElements.get(s)){if(!n||n.priority>=i){n&&n.priority===i&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=i){n.priority===i&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${n.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}m.set(s,r),customElements.define(s,t)}var o=class extends HTMLElement{#o=[];#c;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#o)t();this.#o=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,r){t.addEventListener(e,i,r),this.#o.push(()=>t.removeEventListener(e,i,r))}_reinit(){for(let t of this.#o)t();this.#o=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#c||(this.#c=this.attachInternals());let i=this.#c.states;try{e?i.add(t):i.delete(t)}catch{let r=`--${t}`;e?i.add(r):i.delete(r)}}_adoptInternals(t){this.#c||(this.#c=t)}};var c=class s extends o{static#o=150;static#c=8;#e=null;#i=null;#t=null;#s=null;#n=[];#a=-1;#r=!1;#l=null;#u=null;#h=null;setup(){this.#y(),this.#v()}teardown(){this.#r&&(document.body.style.overflow="",this.removeAttribute("open"),this.#r=!1),this.#h?.(),this.#d(),this.#i?.remove(),this.#i=null}get value(){return this.#t?.value??""}set value(t){if(!this.#t)return;let e=t==null?"":String(t);this.#t.value!==e&&(this.#t.value=e,this.#t.dispatchEvent(new Event("input",{bubbles:!0})),this.dispatchEvent(new CustomEvent("site-search:change",{detail:{value:e,source:"api"},bubbles:!0})))}get results(){return[...this.#n]}#y(){this.#e=this.querySelector(":scope > [data-trigger]"),this.#e||(this.#e=this.querySelector(":scope > button")),this.#e||(this.#e=document.createElement("button"),this.#e.setAttribute("data-trigger",""),this.#e.innerHTML=`
|
|
2
|
-
<icon-wc name="search" label="Search"></icon-wc>
|
|
3
|
-
`,this.prepend(this.#e)),this.#e.setAttribute("aria-haspopup","dialog"),this.#e.setAttribute("aria-expanded","false"),this.#i=document.createElement("div"),this.#i.className="dialog",this.#i.setAttribute("role","dialog"),this.#i.setAttribute("aria-label","Site search"),this.#i.id=`search-dialog-${crypto.randomUUID().slice(0,8)}`,this.#e.setAttribute("aria-controls",this.#i.id),this.#i.innerHTML=`
|
|
4
|
-
<div class="backdrop"></div>
|
|
5
|
-
<div class="panel">
|
|
6
|
-
<div class="input-wrapper">
|
|
7
|
-
<icon-wc name="search" class="icon"></icon-wc>
|
|
8
|
-
<input
|
|
9
|
-
type="search"
|
|
10
|
-
name="search"
|
|
11
|
-
class="input"
|
|
12
|
-
placeholder="Search documentation..."
|
|
13
|
-
autocomplete="off"
|
|
14
|
-
autocorrect="off"
|
|
15
|
-
autocapitalize="off"
|
|
16
|
-
spellcheck="false"
|
|
17
|
-
aria-label="Search"
|
|
18
|
-
aria-autocomplete="list"
|
|
19
|
-
/>
|
|
20
|
-
<kbd class="shortcut">Esc</kbd>
|
|
21
|
-
</div>
|
|
22
|
-
<div class="results" role="listbox" aria-label="Search results"></div>
|
|
23
|
-
<div class="footer">
|
|
24
|
-
<span class="hint">
|
|
25
|
-
<kbd>\u2191</kbd><kbd>\u2193</kbd> to navigate
|
|
26
|
-
<kbd>\u21B5</kbd> to select
|
|
27
|
-
<kbd>esc</kbd> to close
|
|
28
|
-
</span>
|
|
29
|
-
<span class="powered">
|
|
30
|
-
Powered by <a href="https://pagefind.app" target="_blank" rel="noopener">Pagefind</a>
|
|
31
|
-
</span>
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
`,this.appendChild(this.#i),this.#t=this.#i.querySelector(".input"),this.#s=this.#i.querySelector(".results")}#v(){this.#e.addEventListener("click",this.#g),b().includes("meta+k")||(this.#h=p("meta+k",()=>{this.#r?this.close():this.open()},{global:!0})),this.listen(document,"keydown",this.#k),this.#i.querySelector(".backdrop")?.addEventListener("click",()=>this.close()),this.#t.addEventListener("input",this.#E),this.#t.addEventListener("keydown",this.#w),this.#s.addEventListener("click",this.#S)}#g=t=>{t.stopPropagation(),this.open()};#k=t=>{t.key==="Escape"&&this.#r&&(t.preventDefault(),this.close())};#E=()=>{this.#d(),this.setState("input-debounce-pending",!0),this.#u=setTimeout(()=>{this.setState("input-debounce-pending",!1),this.#A(this.#t.value)},s.#o)};#w=t=>{switch(t.key){case"ArrowDown":t.preventDefault(),this.#b(this.#a+1);break;case"ArrowUp":t.preventDefault(),this.#b(this.#a-1);break;case"Enter":t.preventDefault(),this.#a>=0&&this.#n[this.#a]&&this.#m(this.#n[this.#a]);break}};#S=t=>{let e=t.target.closest("[data-result-index]");if(e){let i=parseInt(e.dataset.resultIndex,10);this.#n[i]&&this.#m(this.#n[i])}};async#f(){if(!this.#l)try{this.#l=await import("/pagefind/pagefind.js"),await this.#l.options({excerptLength:20})}catch{console.warn("Pagefind not available. Run `npm run search:index` to build the search index."),this.#l=null}}async#A(t){if(!t.trim()){this.#p([]);return}if(await this.#f(),!this.#l){this.#L();return}try{this.#s.innerHTML='<div class="loading">Searching...</div>';let e=await this.#l.search(t),i=await Promise.all(e.results.slice(0,s.#c).map(r=>r.data()));this.#n=i,this.#p(i)}catch(e){console.error("Search error:",e),this.#s.innerHTML='<div class="error">Search error. Please try again.</div>'}}#p(t){if(this.#a=-1,t.length===0){this.#t.value.trim()?this.#s.innerHTML='<div class="empty">No results found</div>':this.#s.innerHTML="";return}this.#s.innerHTML=t.map((e,i)=>`
|
|
35
|
-
<a
|
|
36
|
-
id="search-result-${i}"
|
|
37
|
-
href="${e.url}"
|
|
38
|
-
class="result"
|
|
39
|
-
role="option"
|
|
40
|
-
data-result-index="${i}"
|
|
41
|
-
tabindex="-1"
|
|
42
|
-
>
|
|
43
|
-
<span class="result-title">${e.meta?.title||"Untitled"}</span>
|
|
44
|
-
<span class="result-excerpt">${e.excerpt||""}</span>
|
|
45
|
-
</a>
|
|
46
|
-
`).join("")}#L(){this.#s.innerHTML=`
|
|
47
|
-
<div class="error">
|
|
48
|
-
Search index not found.<br>
|
|
49
|
-
Run <code>npm run search:index</code> after building.
|
|
50
|
-
</div>
|
|
51
|
-
`}#b(t){if(this.#n.length===0)return;t<0&&(t=this.#n.length-1),t>=this.#n.length&&(t=0);let e=this.#s.querySelector("[data-active]");e&&e.removeAttribute("data-active"),this.#t?.removeAttribute("aria-activedescendant"),this.#a=t;let i=this.#s.querySelector(`[data-result-index="${t}"]`);i&&(i.setAttribute("data-active",""),this.#t?.setAttribute("aria-activedescendant",i.id),i.scrollIntoView({block:"nearest"}))}#m(t){t.url&&(this.close(),window.location.href=t.url)}#d(){this.#u&&(clearTimeout(this.#u),this.#u=null,this.setState("input-debounce-pending",!1))}open(){this.#r||(this.#r=!0,this.setAttribute("open",""),this.#e?.setAttribute("aria-expanded","true"),document.body.style.overflow="hidden",requestAnimationFrame(()=>{this.#t?.focus(),this.#t?.select()}),this.#f(),this.dispatchEvent(new CustomEvent("site-search:open",{bubbles:!0})))}close(){this.#r&&(this.#r=!1,this.removeAttribute("open"),this.#e?.setAttribute("aria-expanded","false"),document.body.style.overflow="",this.#d(),this.#t.value="",this.#t?.removeAttribute("aria-activedescendant"),this.#n=[],this.#a=-1,this.#s.innerHTML="",this.#e?.focus(),this.dispatchEvent(new CustomEvent("site-search:close",{bubbles:!0})))}get isOpen(){return this.#r}};y("site-search",c);export{c as SiteSearch};
|
|
1
|
+
var u=/Mac|iPhone|iPad|iPod/.test(navigator.platform??"");function $(e){return[...String(e??"").trim().toLowerCase().matchAll(/([^+]+|\+)(?:\+|$)/g)].map(s=>s[1].trim()).filter(Boolean).map(s=>s==="plus"?"+":s)}var L={esc:"escape",return:"enter",del:"delete",ins:"insert",up:"arrowup",down:"arrowdown",left:"arrowleft",right:"arrowright",space:" ",spacebar:" ",plus:"+",pgup:"pageup",pgdn:"pagedown"};function D(e){let t=String(e??"").toLowerCase();return L[t]??t}function h(e){let t=$(e);return{key:D(t.pop()??""),meta:t.includes("meta")||t.includes("cmd"),ctrl:t.includes("ctrl")||t.includes("control"),shift:t.includes("shift"),alt:t.includes("alt")||t.includes("option")}}function y(e){return e.length===1&&!/[a-z0-9 ]/.test(e)}function k(e,t){let n=(e.key==="Spacebar"?" ":String(e.key??"").toLowerCase())===t.key;if(!n&&(e.altKey||e.shiftKey)&&/^[a-z0-9]$/.test(t.key)){let a=/\d/.test(t.key)?`Digit${t.key}`:`Key${t.key.toUpperCase()}`;n=e.code===a}if(!n)return!1;let i,r;return u?(i=t.meta,r=t.ctrl):(i=!1,r=t.meta||t.ctrl),!(i!==e.metaKey||r!==e.ctrlKey||!y(t.key)&&t.shift!==e.shiftKey||t.alt!==e.altKey)}function w(e){let t=typeof e=="string"?h(e):e;return!t.meta&&!t.ctrl&&!t.alt&&t.key.length===1}function E(e,t){let s=h(e),n=h(t),i=u?s.ctrl:s.ctrl||s.meta,r=u?n.ctrl:n.ctrl||n.meta,a=u&&s.meta,l=u&&n.meta,T=!y(s.key);return s.key===n.key&&i===r&&a===l&&s.alt===n.alt&&(!T||s.shift===n.shift)}var b="data-char-shortcuts";var M="vb:settings:extensions";function m(){return typeof document>"u"?!0:document.documentElement.getAttribute(b)!=="off"}function N(){try{let e=globalThis.localStorage?.getItem(M);if(!e)return null;let t=JSON.parse(e)?.data?.charShortcuts;return typeof t=="boolean"?t:null}catch{return null}}var P=!0;if(typeof document<"u"){let e=N();e===null&&(P=m()),e===!1?document.documentElement.setAttribute(b,"off"):e===!0&&document.documentElement.removeAttribute(b)}var U=new Set(["INPUT","TEXTAREA","SELECT"]),c=[],S=!1;function H(e){let t=e;return!t||!t.tagName?!1:U.has(t.tagName)||t.isContentEditable}function R(e){if(e.repeat||e.isComposing||e.defaultPrevented)return;let t=H(e.target),s=!m(),n=document.activeElement;for(let i of c)if(!(t&&!i.global)&&!(i.scope&&!(i.scope.isConnected&&i.scope.contains(n)))&&!(s&&i.character&&!i.scope)&&!(i.enabled&&!i.enabled())&&k(e,i.descriptor)){e.preventDefault(),i.callback(e);return}}function O(){S||(document.addEventListener("keydown",R),S=!0)}function A(e,t,s={}){O();let n=h(e),i={combo:e,descriptor:n,callback:t,global:s.global===!0,scope:s.scope??null,enabled:typeof s.enabled=="function"?s.enabled:null,character:w(n)},r=c.find(a=>!a.scope&&!i.scope&&E(a.combo,e));return r&&console.warn(`[hotkey-bind] Shortcut "${e}" is already bound as "${r.combo}". Last-bound wins.`),c.unshift(i),function(){let l=c.indexOf(i);l!==-1&&c.splice(l,1)}}function v(){return c.map(e=>e.combo)}var W=window.matchMedia("(prefers-reduced-motion: reduce)");var C=new Map;function x(e,t,s={}){let n=s.priority??10,i={impl:t,bundle:s.bundle,contract:s.contract,priority:n},r=C.get(e);if(customElements.get(e)){if(!r||r.priority>=n){r&&r.priority===n&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${e}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${s.bundle}".`);return}console.warn(`[VB Bundle] Tag <${e}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${s.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=n){r.priority===n&&console.warn(`[VB Bundle] Tag <${e}> already registered by "${r.bundle}". Skipping "${s.bundle}" (first wins at equal priority).`);return}C.set(e,i),customElements.define(e,t)}var f=class extends HTMLElement{#a=[];#i;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#a)t();this.#a=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,s,n,i){t.addEventListener(s,n,i),this.#a.push(()=>t.removeEventListener(s,n,i))}_reinit(){for(let t of this.#a)t();this.#a=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,s){this.#i||(this.#i=this.attachInternals());let n=this.#i.states;try{s?n.add(t):n.delete(t)}catch{let i=`--${t}`;s?n.add(i):n.delete(i)}}_adoptInternals(t){this.#i||(this.#i=t)}#t(){return this.constructor.formAssociated&&this.#i?this.#i:null}get validity(){return this.#t()?.validity}get validationMessage(){return this.#t()?.validationMessage??""}get willValidate(){return this.#t()?.willValidate??!1}get form(){return this.#t()?.form??null}checkValidity(){return this.#t()?.checkValidity()??!0}reportValidity(){return this.#t()?.reportValidity()??!0}};var K={trigger:"Search",dialog:"Site search",placeholder:"Search documentation...",input:"Search",results:"Search results",searching:"Searching...",empty:"No results found",count:"{count} results","count-one":"1 result",unavailable:"Search unavailable",error:"Search error. Please try again.",untitled:"Untitled",navigate:"to navigate",select:"to select",close:"to close",powered:"Powered by"},I=0,p=new Set,d=null;function B(e){return typeof e.checkVisibility=="function"?e.checkVisibility():e.getClientRects().length>0}function _(){let e=[...p].filter(n=>n.isConnected),t=e.find(n=>n.isOpen);if(t){t.close();return}(e.find(n=>B(n))??e[0])?.open()}function V(e){p.add(e),!d&&!v().includes("meta+k")&&(d=A("meta+k",_,{global:!0}))}function q(e){p.delete(e),p.size===0&&d&&(d(),d=null)}function o(e,t={},s=[]){let n=document.createElement(e);for(let[i,r]of Object.entries(t))n.setAttribute(i,r);return n.append(...s),n}function Y(e){let t=document.createDocumentFragment();if(!e||typeof e!="string")return t;let s=document.createElement("template");s.innerHTML=e;let n=(i,r)=>{for(let a of i.childNodes)if(a.nodeType===Node.TEXT_NODE)r.appendChild(document.createTextNode(a.textContent??""));else if(a.nodeType===Node.ELEMENT_NODE)if(a.localName==="mark"){let l=document.createElement("mark");n(a,l),r.appendChild(l)}else n(a,r)};return n(s.content,t),t}function j(e){if(typeof e!="string"||!e)return null;try{let t=new URL(e,document.baseURI);return t.protocol!=="http:"&&t.protocol!=="https:"||t.origin!==location.origin?null:t.href}catch{return null}}var g=class e extends f{static#a=150;static#i=8;#t=null;#n=null;#e=null;#l=null;#p=null;#u=[];#o=-1;#r=!1;#h=0;#d="";#b=null;#y=!1;#f=null;setup(){this.#d||(this.#d=`site-search-${++I}`),this.#S(),this.#A(),V(this)}teardown(){q(this),this.#r&&(document.body.style.overflow="",this.removeAttribute("open"),this.#t?.setAttribute("aria-expanded","false"),this.#r=!1),this.#g(),this.#h++,this.#u=[],this.#o=-1,this.#n?.remove(),this.#n=null}#s(t){let s=`data-label-${t}`;return this.getAttribute(s)??K[t]}get value(){return this.#e?.value??""}set value(t){if(!this.#e)return;let s=t==null?"":String(t);this.#e.value!==s&&(this.#e.value=s,this.#e.dispatchEvent(new Event("input",{bubbles:!0})),this.dispatchEvent(new CustomEvent("site-search:change",{detail:{value:s,source:"api"},bubbles:!0})))}get results(){return[...this.#u]}#S(){this.#t=this.querySelector(":scope > [data-trigger]"),this.#t||(this.#t=this.querySelector(":scope > button")),this.#t||(this.#t=o("button",{type:"button","data-trigger":""},[o("icon-wc",{name:"search",label:this.#s("trigger")})]),this.prepend(this.#t));let t=`${this.#d}-dialog`,s=`${this.#d}-results`;this.#t.setAttribute("aria-haspopup","dialog"),this.#t.setAttribute("aria-expanded","false"),this.#t.setAttribute("aria-controls",t),this.#e=o("input",{type:"search",name:"search",class:"input",placeholder:this.#s("placeholder"),autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellcheck:"false",role:"combobox","aria-label":this.#s("input"),"aria-autocomplete":"list","aria-controls":s,"aria-expanded":"false"}),this.#l=o("div",{class:"results",id:s,role:"listbox","aria-label":this.#s("results")}),this.#p=o("p",{class:"status",role:"status"});let n=i=>o("kbd",{},[i]);this.#n=o("dialog",{class:"dialog",id:t,"aria-label":this.#s("dialog")},[o("search",{class:"search"},[o("div",{class:"input-wrapper"},[o("icon-wc",{name:"search",class:"icon"}),this.#e,o("kbd",{class:"shortcut","aria-hidden":"true"},["Esc"])]),this.#p,this.#l]),o("div",{class:"footer"},[o("span",{class:"hint"},[n("\u2191"),n("\u2193"),` ${this.#s("navigate")} `,n("\u21B5"),` ${this.#s("select")} `,n("esc"),` ${this.#s("close")}`]),o("span",{class:"powered"},[`${this.#s("powered")} `,o("a",{href:"https://pagefind.app",target:"_blank",rel:"noopener"},["Pagefind"])])])]),this.appendChild(this.#n)}#A(){this.listen(this.#t,"click",this.#v),this.#n.addEventListener("close",this.#C),this.#n.addEventListener("click",this.#x),this.#e.addEventListener("input",this.#T),this.#e.addEventListener("keydown",this.#$),this.#l.addEventListener("click",this.#L)}#v=t=>{t.stopPropagation(),this.open()};#C=()=>{this.#r&&!this.#n?.open&&this.#E()};#x=t=>{if(t.target!==this.#n)return;let s=this.#n.getBoundingClientRect();t.clientX>=s.left&&t.clientX<=s.right&&t.clientY>=s.top&&t.clientY<=s.bottom||this.close()};#T=()=>{this.#g(),this.setState("input-debounce-pending",!0),this.#f=setTimeout(()=>{this.#f=null,this.setState("input-debounce-pending",!1),this.#M(this.#e.value)},e.#a)};#$=t=>{switch(t.key){case"ArrowDown":t.preventDefault(),this.#w(this.#o+1);break;case"ArrowUp":t.preventDefault(),this.#w(this.#o-1);break;case"Escape":t.preventDefault(),this.close();break;case"Enter":{t.preventDefault();let s=this.#o>=0?this.#o:0,n=this.#l.querySelector(`[data-result-index="${s}"]`)?.getAttribute("href");n&&(this.close(),window.location.assign(n));break}}};#L=t=>{t.target.closest("[data-result-index]")&&(t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||setTimeout(()=>this.close(),0))};get#D(){let t=this.getAttribute("data-pagefind-path")||"/pagefind/";return t.endsWith("/")?t:`${t}/`}async#k(){if(this.#b||this.#y)return;let t=new URL(this.#D,document.baseURI),s=this.getAttribute("data-base-url")??new URL("..",t).pathname;try{let n=await import(new URL("pagefind.js",t).href);await n.options({excerptLength:20,baseUrl:s}),this.#b=n}catch{this.#y=!0,console.warn(`[site-search] Pagefind not found at ${t.pathname}pagefind.js. Run \`npm run search:index\` after building, or set data-pagefind-path.`)}}#c(t){this.#p&&(this.#p.textContent=t)}async#M(t){let s=++this.#h;if(!t.trim()){this.#m([]);return}if(this.#c(this.#s("searching")),await this.#k(),s===this.#h){if(!this.#b){this.#u=[],this.#m([]),this.#c(this.#s("unavailable"));return}try{let n=await this.#b.search(t),i=await Promise.all((n?.results??[]).slice(0,e.#i).map(r=>r.data()));if(s!==this.#h)return;this.#u=i,this.#m(i)}catch(n){if(s!==this.#h)return;console.error("[site-search] Search error:",n),this.#u=[],this.#m([]),this.#c(this.#s("error"))}}}#m(t){this.#o=-1,this.#e.removeAttribute("aria-activedescendant");let s=[];for(let n of t){let i=j(n?.url);if(!i)continue;let r=o("span",{class:"result-title"});r.textContent=String(n.meta?.title||this.#s("untitled"));let a=o("span",{class:"result-excerpt"});a.append(Y(n.excerpt||"")),s.push(o("a",{id:`${this.#d}-result-${s.length}`,href:i,class:"result",role:"option","aria-selected":"false","data-result-index":String(s.length),tabindex:"-1"},[r,a]))}this.#l.replaceChildren(...s),this.#e.setAttribute("aria-expanded",s.length?"true":"false"),this.#e.value.trim()?s.length===0?this.#c(this.#s("empty")):this.#c(s.length===1?this.#s("count-one"):this.#s("count").replace("{count}",String(s.length))):this.#c("")}#w(t){let s=this.#l.querySelectorAll("[data-result-index]");if(s.length===0)return;t<0&&(t=s.length-1),t>=s.length&&(t=0);for(let i of s)i.removeAttribute("data-active"),i.setAttribute("aria-selected","false");this.#o=t;let n=s[t];n.setAttribute("data-active",""),n.setAttribute("aria-selected","true"),this.#e.setAttribute("aria-activedescendant",n.id),n.scrollIntoView({block:"nearest"})}#g(){this.#f&&(clearTimeout(this.#f),this.#f=null),this.setState("input-debounce-pending",!1)}open(){if(!(this.#r||!this.#n)){if(this.#r=!0,this.setAttribute("open",""),this.#t?.setAttribute("aria-expanded","true"),document.body.style.overflow="hidden",!this.#n.open)try{this.#n.showModal()}catch{this.#n.setAttribute("open","")}this.#e.focus(),this.#e.select(),this.#k(),this.dispatchEvent(new CustomEvent("site-search:open",{bubbles:!0}))}}close(){this.#r&&(this.#n?.open&&this.#n.close(),this.#r&&this.#E())}#E(){this.#r=!1,this.removeAttribute("open"),this.#t?.setAttribute("aria-expanded","false"),document.body.style.overflow="",this.#g(),this.#h++,this.#u=[],this.#o=-1,this.#e&&(this.#e.value="",this.#e.removeAttribute("aria-activedescendant"),this.#e.setAttribute("aria-expanded","false")),this.#l?.replaceChildren(),this.#c(""),this.#t?.focus(),this.dispatchEvent(new CustomEvent("site-search:close",{bubbles:!0}))}get isOpen(){return this.#r}};x("site-search",g);export{g as SiteSearch};
|
|
52
2
|
//# sourceMappingURL=site-search.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var p=window.matchMedia("(prefers-reduced-motion: reduce)");var l=new Map;function d(n,t,e={}){let i=e.priority??10,r={impl:t,bundle:e.bundle,contract:e.contract,priority:i},s=l.get(n);if(customElements.get(n)){if(!s||s.priority>=i){s&&s.priority===i&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=i){s.priority===i&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}l.set(n,r),customElements.define(n,t)}var a=class extends HTMLElement{#s=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#s)t();this.#s=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,r){t.addEventListener(e,i,r),this.#s.push(()=>t.removeEventListener(e,i,r))}_reinit(){for(let t of this.#s)t();this.#s=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let i=this.#t.states;try{e?i.add(t):i.delete(t)}catch{let r=`--${t}`;e?i.add(r):i.delete(r)}}_adoptInternals(t){this.#t||(this.#t=t)}#e(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#e()?.validity}get validationMessage(){return this.#e()?.validationMessage??""}get willValidate(){return this.#e()?.willValidate??!1}get form(){return this.#e()?.form??null}checkValidity(){return this.#e()?.checkValidity()??!0}reportValidity(){return this.#e()?.reportValidity()??!0}};var f="Slide to confirm",b="Confirmed!",m="Press Enter to confirm",c=6,o=class extends a{static formAssociated=!0;static observedAttributes=["label","activated-label","data-label-hint","required","value"];#s;#t;#e;#h;#a;#o=!1;#n=0;#m=0;#E=0;#l=0;#i=!1;#d=!1;#p=!1;#w="";#c;constructor(){super(),this.#s=this.attachInternals(),this._adoptInternals(this.#s)}get activated(){return this.#i}get#M(){let t=this.getAttribute("threshold"),e=Number(t);return t!==null&&t.trim()!==""&&!isNaN(e)?Math.min(100,Math.max(0,e)):90}get#k(){return this.getAttribute("label")||this.#w||f}get#C(){return this.getAttribute("activated-label")||b}get#v(){return getComputedStyle(this).direction==="rtl"}setup(){this.#p||(this.#D(),this.#p=!0),this.listen(this.#t,"pointerdown",this.#S),this.listen(this.#t,"keydown",this.#N),this.listen(this.#t,"transitionend",this.#P)}teardown(){this.#o&&this.#b(),clearTimeout(this.#c),this.removeAttribute("transitioning")}attributeChangedCallback(t,e,i){e===i||!this.#p||(this.#u(),(t==="required"||t==="value")&&this.#f())}#D(){this.#w=(this.textContent||"").replace(/\s+/g," ").trim(),this.#a=document.createElement("div"),this.#a.className="slide-track",this.#e=document.createElement("span"),this.#e.className="slide-label",this.#e.setAttribute("role","status"),this.#h=document.createElement("span"),this.#h.className="visually-hidden slide-hint",this.#h.id=`slide-hint-${Math.random().toString(36).slice(2,9)}`,this.#t=document.createElement("div"),this.#t.className="slide-handle",this.#t.setAttribute("role","slider"),this.#t.setAttribute("aria-valuemin","0"),this.#t.setAttribute("aria-valuemax","100"),this.#t.setAttribute("aria-describedby",this.#h.id),this.#t.setAttribute("tabindex","0"),this.#t.innerHTML='<icon-wc name="chevrons-right" size="sm"></icon-wc>',this.#a.append(this.#e,this.#t),this.textContent="",this.append(this.#a,this.#h),this.#u(),this.#r(0),this.#f()}#u(){let t=this.#k;this.#e.textContent=this.#i?this.#C:t,this.#t.setAttribute("aria-label",t),this.#h.textContent=this.getAttribute("data-label-hint")||m,this.#T()}#T(){this.#t.setAttribute("aria-valuetext",this.#i?this.#C:`${Math.round(this.#n)}%`)}#f(){let t=this.getAttribute("value")||"on";this.#s.setFormValue(this.#i?t:null),this.hasAttribute("required")&&!this.#i?this.#s.setValidity({valueMissing:!0},`${this.#k} to continue.`,this.#t):this.#s.setValidity({})}reset(){this.#i=!1,this.removeAttribute("data-activated"),this.#t.removeAttribute("aria-disabled"),this.#g(),this.#r(0),this.#u(),this.#f(),this.dispatchEvent(new CustomEvent("slide-accept:reset",{bubbles:!0}))}formResetCallback(){(this.#i||this.#n!==0)&&this.reset()}formDisabledCallback(t){this.#d=t,t&&this.#o&&(this.#b(),this.#A()),this.#g()}#g(){this.#t&&(this.#i||this.#d?this.#t.setAttribute("aria-disabled","true"):this.#t.removeAttribute("aria-disabled"))}#S=t=>{if(!(this.#i||this.#d)&&t.button===0){if(t.preventDefault(),this.#t.focus({preventScroll:!0}),this.hasAttribute("transitioning")){let e=this.#t.getBoundingClientRect(),i=this.#a.getBoundingClientRect(),r=parseFloat(getComputedStyle(this.#a).getPropertyValue("--_handle-inset")||"0"),s=this.#t.offsetWidth,h=i.width-s-r*2,u=this.#v?i.right-e.right-r:e.left-i.left-r;this.removeAttribute("transitioning"),clearTimeout(this.#c),this.#r(h>0?Math.max(0,Math.min(100,u/h*100)):0)}this.#o=!0,this.#m=t.clientX,this.#E=this.#n,this.#l=0;try{this.#t.setPointerCapture(t.pointerId)}catch{}this.setAttribute("data-dragging",""),this.#t.addEventListener("pointermove",this.#x),this.#t.addEventListener("pointerup",this.#L),this.#t.addEventListener("pointercancel",this.#$)}};#x=t=>{if(!this.#o)return;let e=this.#a.getBoundingClientRect().width-this.#t.offsetWidth;if(e<=0)return;let i=t.clientX-this.#m;this.#l=Math.max(this.#l,Math.abs(i));let s=(this.#v?-i:i)/e*100;this.#r(Math.min(100,Math.max(0,this.#E+s)))};#b(t){if(this.#o=!1,this.removeAttribute("data-dragging"),t)try{this.#t.releasePointerCapture(t.pointerId)}catch{}this.#t.removeEventListener("pointermove",this.#x),this.#t.removeEventListener("pointerup",this.#L),this.#t.removeEventListener("pointercancel",this.#$)}#L=t=>{if(!this.#o)return;let e=this.#l<c&&Math.abs(t.clientX-this.#m)<c;this.#b(t),e||this.#n>=this.#M?this.#y():this.#A()};#$=t=>{this.#o&&(this.#b(t),this.#A())};#N=t=>{if(this.#i||this.#d)return;let e=t.shiftKey?20:5,i=this.#v,r=i?"ArrowLeft":"ArrowRight",s=i?"ArrowRight":"ArrowLeft";t.key===r||t.key==="ArrowUp"?(t.preventDefault(),this.#r(Math.min(100,this.#n+e)),this.#n>=this.#M&&this.#y()):t.key===s||t.key==="ArrowDown"?(t.preventDefault(),this.#r(Math.max(0,this.#n-e))):t.key==="End"||t.key==="Enter"||t.key===" "?(t.preventDefault(),this.#y()):t.key==="Home"&&(t.preventDefault(),this.#r(0))};#P=()=>{this.removeAttribute("transitioning")};#y(){this.#i||(this.#i=!0,this.#r(100),this.setAttribute("data-activated",""),this.#g(),this.#u(),this.#f(),this.dispatchEvent(new CustomEvent("slide-accept:accept",{bubbles:!0})))}#A(){this.setAttribute("transitioning",""),this.#r(0),clearTimeout(this.#c),this.#c=setTimeout(()=>{this.removeAttribute("transitioning")},500)}#r(t){this.#n=t,this.style.setProperty("--_slide-position",String(t)),this.#t.setAttribute("aria-valuenow",String(Math.round(t))),this.#T()}};d("slide-accept",o);export{o as SlideAccept};
|
|
2
2
|
//# sourceMappingURL=slide-accept.js.map
|