vanilla-breeze 0.1.2 → 0.1.3
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/dist/cdn/components/accordion-wc.js +1 -1
- package/dist/cdn/components/analytics-panel.js +1 -1
- package/dist/cdn/components/audio-player.js +1 -1
- package/dist/cdn/components/audio-visualizer.js +2 -2
- package/dist/cdn/components/author-index.js +1 -1
- package/dist/cdn/components/brand-mark.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 +11 -11
- package/dist/cdn/components/chat-input.js +1 -1
- package/dist/cdn/components/chat-window.js +1 -1
- package/dist/cdn/components/color-palette.js +4 -4
- 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-wc.js +1 -1
- package/dist/cdn/components/compare-surface.js +1 -1
- package/dist/cdn/components/component-sampler.js +4 -4
- 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/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/font-pairer.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/gantt-chart.js +1 -1
- package/dist/cdn/components/geo-map.js +3 -3
- package/dist/cdn/components/glossary-index.js +1 -1
- package/dist/cdn/components/glossary-wc.js +1 -1
- package/dist/cdn/components/gradient-builder.js +1 -1
- package/dist/cdn/components/heading-links.js +1 -1
- package/dist/cdn/components/highlight-wc.js +2 -2
- package/dist/cdn/components/image-gallery.js +1 -1
- package/dist/cdn/components/image-map.js +1 -1
- package/dist/cdn/components/impact-effort.js +1 -1
- package/dist/cdn/components/include-file.js +1 -1
- package/dist/cdn/components/kanban-board.js +1 -1
- package/dist/cdn/components/manifest.json +95 -95
- package/dist/cdn/components/markdown-editor.js +1 -1
- package/dist/cdn/components/markdown-viewer.js +1 -1
- package/dist/cdn/components/motion-specimen.js +3 -3
- package/dist/cdn/components/note-wc.js +1 -1
- package/dist/cdn/components/notification-wc.js +4 -4
- package/dist/cdn/components/page-info.js +20 -20
- 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 +2 -2
- package/dist/cdn/components/palette-generator.js +1 -1
- package/dist/cdn/components/popularity-index.js +1 -1
- package/dist/cdn/components/print-page.js +1 -1
- package/dist/cdn/components/qr-code.js +1 -1
- package/dist/cdn/components/reader-view.js +2 -2
- package/dist/cdn/components/recently-visited.js +26 -2
- package/dist/cdn/components/selection-menu.js +1 -1
- package/dist/cdn/components/semantic-palette.js +1 -1
- package/dist/cdn/components/settings-panel.js +2 -2
- package/dist/cdn/components/share-wc.js +1 -1
- package/dist/cdn/components/short-cuts.js +1 -1
- package/dist/cdn/components/site-index.js +1 -1
- package/dist/cdn/components/site-map-wc.js +1 -1
- package/dist/cdn/components/site-map.js +1 -1
- package/dist/cdn/components/site-search.js +3 -3
- package/dist/cdn/components/slide-accept.js +1 -1
- package/dist/cdn/components/social-embed.js +1 -1
- package/dist/cdn/components/spacing-specimen.js +2 -2
- package/dist/cdn/components/split-surface.js +1 -1
- package/dist/cdn/components/star-rating.js +1 -1
- package/dist/cdn/components/story-map.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-export.js +1 -1
- package/dist/cdn/components/theme-picker.js +3 -3
- package/dist/cdn/components/time-index.js +1 -1
- package/dist/cdn/components/time-picker.js +1 -1
- package/dist/cdn/components/toast-msg.js +1 -1
- package/dist/cdn/components/token-specimen.js +6 -6
- package/dist/cdn/components/tool-tip.js +1 -1
- package/dist/cdn/components/topic-map.js +3 -2
- package/dist/cdn/components/trust-filter.js +3 -3
- package/dist/cdn/components/type-specimen.js +1 -1
- package/dist/cdn/components/user-story.js +8 -8
- package/dist/cdn/components/video-player.js +4 -4
- package/dist/cdn/components/watch-wc.js +2 -2
- package/dist/cdn/components/week-view.js +1 -1
- package/dist/cdn/components/work-item.js +14 -14
- package/dist/cdn/components/youtube-player.js +1 -1
- package/dist/cdn/packs/design-system.full.js +15 -15
- package/dist/cdn/packs/effects.full.js +1 -1
- package/dist/cdn/packs/manifest.json +5 -5
- package/dist/cdn/packs/ui.full.css +1 -1
- package/dist/cdn/packs/ui.full.js +5 -5
- package/dist/cdn/packs/ux-planning.full.js +119 -119
- package/dist/cdn/vanilla-breeze-charts.css +1 -1
- package/dist/cdn/vanilla-breeze-charts.js +11 -11
- package/dist/cdn/vanilla-breeze-core.css +1 -1
- package/dist/cdn/vanilla-breeze-core.js +21 -21
- package/dist/cdn/vanilla-breeze-extras.js +3 -3
- package/dist/cdn/vanilla-breeze.css +1 -1
- package/dist/cdn/vanilla-breeze.js +210 -185
- package/package.json +5 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var E=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;function C(c,i,e={}){let s=e.priority??10,t={impl:i,bundle:e.bundle,contract:e.contract,priority:s},r=v.get(c);if(customElements.get(c)){if(!r||r.priority>=s){r&&r.priority===s&&r.impl!==i&&console.warn(`[VB Bundle] Tag <${c}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${c}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=s){r.priority===s&&console.warn(`[VB Bundle] Tag <${c}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}v.set(c,t),customElements.define(c,i)}var A=class extends HTMLElement{#h=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&this.setAttribute("data-upgraded","")}disconnectedCallback(){for(let i of this.#h)i();this.#h=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(i,e,s,t){i.addEventListener(e,s,t),this.#h.push(()=>i.removeEventListener(e,s,t))}setup(){}teardown(){}};var y={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"}},x={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"}},S=class c extends A{static get observedAttributes(){return["src","collapsed","compact","title","data-view","data-orientation","data-detail"]}static#h=0;#u=null;#s=null;#t=null;#f=null;#r=0;#n=0;setup(){c.#h++;let i=this.getAttribute("src");if(i&&!this.querySelector("nav")){this._loadSrc(i);return}let e=this.querySelector(":scope > nav");if(e){if(this.#r=0,this.#n=0,this.#w(e.querySelector("ul"),0),this.dataset.view==="visual"){this.#N(),this.#J(e),this.dispatchEvent(new CustomEvent("site-map-wc:ready",{bubbles:!0,detail:{nodeCount:this.#r,depth:this.#n}}));return}this.#k(e.querySelector("ul"),0),this.#N(),e.classList.add("sm-tree"),e.setAttribute("role","tree"),e.setAttribute("aria-label",this.getAttribute("title")||"Site map"),this.#u=e,this.hasAttribute("collapsed")&&this.#q(),this.listen(e,"keydown",s=>this.#X(s)),this.listen(e,"click",s=>this.#R(s)),this.dispatchEvent(new CustomEvent("site-map-wc:ready",{bubbles:!0,detail:{nodeCount:this.#r,depth:this.#n}}))}}teardown(){if(this.#t){this.#t.remove(),this.#t=null;let i=this.querySelector("nav");i&&(i.style.display="",i.removeAttribute("aria-hidden"))}this.#s&&(this.#s.remove(),this.#s=null),this.#u&&(this.#u.classList.remove("sm-tree"),this.#u.removeAttribute("role"),this.#u.removeAttribute("aria-label")),this.querySelectorAll(".sm-node-content, .sm-toggle").forEach(i=>i.remove()),this.querySelectorAll('li[role="treeitem"]').forEach(i=>{i.removeAttribute("role"),i.removeAttribute("aria-expanded"),i.removeAttribute("tabindex")}),this.querySelectorAll('ul[role="group"]').forEach(i=>{i.removeAttribute("role"),i.classList.remove("sm-subtree","sm-collapsed")}),this.#u=null,this.#f=null,this.#r=0,this.#n=0}attributeChangedCallback(i,e,s){e===s||!this.isConnected||i==="src"&&this._loadSrc(s)}#w(i,e){if(!i)return;let s=i.querySelectorAll(":scope > li");for(let t of s){this.#r++;let r=e+1;r>this.#n&&(this.#n=r);let o=t.querySelector(":scope > ul");o&&this.#w(o,r)}}#k(i,e){if(!i)return;e>0&&(i.setAttribute("role","group"),i.classList.add("sm-subtree"));let s=[...i.querySelectorAll(":scope > li")];for(let t of s){let r=!!t.querySelector(":scope > ul"),o=t.querySelector(":scope > a"),a=t.getAttribute("data-page-type")||"page",h=t.getAttribute("data-template")||"",l=t.getAttribute("data-status")||"";t.setAttribute("role","treeitem"),t.setAttribute("tabindex","-1");let n=document.createElement("span");if(n.className="sm-node-content",r){t.setAttribute("aria-expanded","true");let u=document.createElement("button");u.className="sm-toggle",u.setAttribute("type","button"),u.setAttribute("aria-hidden","true"),u.setAttribute("tabindex","-1"),u.textContent="\u25BE",n.appendChild(u)}else{let u=document.createElement("span");u.className="sm-leaf-marker",u.setAttribute("aria-hidden","true"),n.appendChild(u)}if(l&&x[l]){let u=document.createElement("span");u.className=`sm-status-dot ${x[l].cssClass}`,u.setAttribute("title",x[l].label),u.setAttribute("aria-label",x[l].label),n.appendChild(u)}if(o&&n.appendChild(o),y[a]){let u=document.createElement("span");u.className=`sm-badge ${y[a].cssClass}`,u.textContent=y[a].label,n.appendChild(u)}if(h){let u=document.createElement("span");u.className="sm-badge sm-badge--template",u.textContent=h,n.appendChild(u)}t.insertBefore(n,t.firstChild);let b=t.querySelector(":scope > ul");b&&this.#k(b,e+1)}}#N(){let i=this.getAttribute("title");if(!i&&this.#r===0)return;if(this.#s=document.createElement("div"),this.#s.className="sm-header",i){let t=document.createElement("h2");t.className="sm-title",t.textContent=i,this.#s.appendChild(t)}let e=document.createElement("span");e.className="sm-summary",e.textContent=`${this.#r} pages \xB7 ${this.#n} levels deep`,this.#s.appendChild(e);let s=document.createElement("button");s.className="sm-toggle-all",s.setAttribute("type","button"),s.textContent="Collapse all",s.addEventListener("click",()=>{this.querySelectorAll('li[aria-expanded="true"]').length>0?(this.#q(),s.textContent="Expand all"):(this.#G(),s.textContent="Collapse all")}),this.#s.appendChild(s),this.insertBefore(this.#s,this.firstChild)}#q(){let i=this.querySelectorAll("li[aria-expanded]");for(let e of i){e.setAttribute("aria-expanded","false");let s=e.querySelector(":scope > ul");s&&s.classList.add("sm-collapsed");let t=e.querySelector(":scope > .sm-node-content > .sm-toggle");t&&(t.textContent="\u25B8")}}#G(){let i=this.querySelectorAll("li[aria-expanded]");for(let e of i){e.setAttribute("aria-expanded","true");let s=e.querySelector(":scope > ul");s&&s.classList.remove("sm-collapsed");let t=e.querySelector(":scope > .sm-node-content > .sm-toggle");t&&(t.textContent="\u25BE")}}#b(i){let e=i.getAttribute("aria-expanded")==="true";i.setAttribute("aria-expanded",e?"false":"true");let s=i.querySelector(":scope > ul");s&&s.classList.toggle("sm-collapsed",e);let t=i.querySelector(":scope > .sm-node-content > .sm-toggle");t&&(t.textContent=e?"\u25B8":"\u25BE")}#R(i){let e=i.target;if(e.closest(".sm-toggle")){i.preventDefault();let r=e.closest('li[role="treeitem"]');r&&this.#b(r);return}let s=e.closest('li[role="treeitem"]');if(!s)return;this.#a(s);let t=e.closest("a");t&&this.dispatchEvent(new CustomEvent("site-map-wc:select",{bubbles:!0,detail:{href:t.getAttribute("href")||"",pageType:s.getAttribute("data-page-type")||"page",template:s.getAttribute("data-template")||""}}))}#X(i){let e=i.target.closest('li[role="treeitem"]');if(!e)return;let s=i.key,t=!1;switch(s){case"ArrowDown":t=!0,this.#j(e);break;case"ArrowUp":t=!0,this.#K(e);break;case"ArrowRight":if(t=!0,e.getAttribute("aria-expanded")==="false")this.#b(e);else if(e.getAttribute("aria-expanded")==="true"){let r=e.querySelector(':scope > ul > li[role="treeitem"]');r&&this.#a(r)}break;case"ArrowLeft":if(t=!0,e.getAttribute("aria-expanded")==="true")this.#b(e);else{let r=e.parentElement?.closest('li[role="treeitem"]');r&&this.#a(r)}break;case"Enter":t=!0,e.hasAttribute("aria-expanded")&&this.#b(e);break;case" ":t=!0;{let r=e.querySelector(":scope > .sm-node-content > a");r&&r.click()}break;case"Home":t=!0;{let r=this.querySelector('li[role="treeitem"]');r&&this.#a(r)}break;case"End":t=!0;{let r=this.#x();r.length&&this.#a(r[r.length-1])}break}t&&(i.preventDefault(),i.stopPropagation())}#x(){let i=[],e=t=>{if(!t)return;let r=[...t.querySelectorAll(':scope > li[role="treeitem"]')];for(let o of r)if(i.push(o),o.getAttribute("aria-expanded")==="true"){let a=o.querySelector(":scope > ul");a&&e(a)}},s=this.querySelector("nav > ul");return e(s),i}#j(i){let e=this.#x(),s=e.indexOf(i);s>=0&&s<e.length-1&&this.#a(e[s+1])}#K(i){let e=this.#x(),s=e.indexOf(i);s>0&&this.#a(e[s-1])}#a(i){this.#f&&this.#f.setAttribute("tabindex","-1"),i.setAttribute("tabindex","0"),i.focus(),this.#f=i}static#m="http://www.w3.org/2000/svg";static#l=150;static#c=70;static#$=30;static#S=50;static#Z=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#T={draft:"#94a3b8",ready:"#f59e0b",live:"#22c55e",deprecated:"#ef4444"};#M(i){let e=[];for(let s of i.querySelectorAll(":scope > li")){let t=s.querySelector(":scope > a"),r=s.querySelector(":scope > ul");e.push({label:t?.textContent?.trim()||s.firstChild?.textContent?.trim()||"",href:t?.getAttribute("href")||"",pageType:s.getAttribute("data-page-type")||"page",template:s.getAttribute("data-template")||"",status:s.getAttribute("data-status")||"",children:r?this.#M(r):[],x:0,y:0,subtreeWidth:0,collapsed:!1,childCount:0})}return e}#B(i,e=0){let s=c.#l,t=c.#c,r=c.#$,o=c.#S;for(let a of i)a.childCount=this.#z(a),a.children.length>0&&!a.collapsed?(this.#B(a.children,e+1),a.subtreeWidth=a.children.reduce((h,l)=>h+l.subtreeWidth,0)+r*(a.children.length-1)):a.subtreeWidth=s,a.subtreeWidth=Math.max(a.subtreeWidth,s)}#z(i){let e=0;for(let s of i.children)e+=1+this.#z(s);return e}#D(i,e,s){let t=c.#l,r=c.#c,o=c.#$,a=c.#S,h=e;for(let l of i)l.x=h+(l.subtreeWidth-t)/2,l.y=s,l.children.length>0&&!l.collapsed&&this.#D(l.children,h,s+r+a),h+=l.subtreeWidth+o}#J(i){i.style.display="none",i.setAttribute("aria-hidden","true");let e=i.querySelector("ul");e&&(this.#e=this.#M(e),this.#d())}#e=null;#i=1;get#v(){return this.dataset.orientation==="horizontal"?"horizontal":"vertical"}get#H(){return Math.min(4,Math.max(0,parseInt(this.dataset.detail||"2",10)))}static#g={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#P=["Shape","Shape + Title","Full","Full + Status","Wireframe"];#d(){if(!this.#e)return;this.#t&&this.#t.remove();let i=c.#m,e=c.#l,s=c.#c,t=c.#Z,r=this.#v==="horizontal";this.#B(this.#e),this.#D(this.#e,t,t);let o=this.#V(this.#e),a=o.maxX+e+t,h=o.maxY+s+t;r&&([a,h]=[h,a]),this.#t=document.createElement("div"),this.#t.className="sm-visual",this.#t.setAttribute("tabindex","-1"),this.#t.appendChild(this.#Q());let l=document.createElementNS(i,"svg");l.setAttribute("viewBox",`0 0 ${a} ${h}`),l.setAttribute("width",String(a)),l.setAttribute("height",String(h)),l.setAttribute("role","img"),l.setAttribute("aria-label",`Site map${this.getAttribute("title")?": "+this.getAttribute("title"):""}`);let n=document.createElement("div");if(n.className="sm-visual-zoom",n.style.width=`${Math.round(a*this.#i)}px`,n.style.height=`${Math.round(h*this.#i)}px`,l.style.transform=`scale(${this.#i})`,l.style.transformOrigin="0 0",r){let f=document.createElementNS(i,"g");f.setAttribute("transform",`rotate(90 0 0) translate(0 -${h})`),this.#C(f,this.#e),this.#E(f,this.#e),l.appendChild(f)}else this.#C(l,this.#e),this.#E(l,this.#e);n.appendChild(l),this.#t.appendChild(n);let b=document.createElement("div");b.className="sm-visual-summary";let u=Math.round(this.#i*100);b.textContent=`${this.#r} pages \xB7 ${this.#n} levels \xB7 ${u}%`,this.#t.appendChild(b),this.appendChild(this.#t),this.#st(this.#t,l),this.listen(l,"click",f=>{let m=f.target,d=m.closest("[data-toggle]");if(d){let g=d.getAttribute("data-toggle");this.#U(g);return}let p=m.closest("[data-node-id]");p&&(this.#o(p.getAttribute("data-node-id")),this.dispatchEvent(new CustomEvent("site-map-wc:select",{bubbles:!0,detail:{href:p.getAttribute("data-href")||"",pageType:p.getAttribute("data-page-type")||"page",template:p.getAttribute("data-template")||""}})))}),l.setAttribute("tabindex","0"),l.setAttribute("role","tree"),l.setAttribute("aria-label",`Site map${this.getAttribute("title")?": "+this.getAttribute("title"):""} \u2014 use arrow keys to navigate`),l.addEventListener("keydown",f=>this.#tt(f)),requestAnimationFrame(()=>{let f=l.querySelector("[data-node-id]");f&&this.#F(f)})}#Q(){let i=document.createElement("div");i.className="sm-vtoolbar",i.setAttribute("role","toolbar"),i.setAttribute("aria-label","Site map controls");let e=f=>`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${f}</svg>`,s=this.#A(e(c.#g.zoomIn),"Zoom in",()=>{this.#i=Math.min(3,this.#i+.25),this.#d()});i.appendChild(s);let t=this.#A(e(c.#g.zoomOut),"Zoom out",()=>{this.#i=Math.max(.25,this.#i-.25),this.#d()});i.appendChild(t);let r=this.#A(e(c.#g.reset),"Reset zoom",()=>{this.#i=1,this.#d()});i.appendChild(r);let o=document.createElement("span");o.className="sm-vtoolbar-sep",i.appendChild(o);let a=this.#v==="horizontal"?"Vertical":"Horizontal",h=this.#A(e(c.#g.flip),a,()=>{this.dataset.orientation=this.#v==="horizontal"?"vertical":"horizontal",this.#d()});i.appendChild(h),i.appendChild(o.cloneNode());let l=this.#H,n=document.createElement("label");n.className="sm-vtoolbar-detail",n.textContent="Detail ";let b=document.createElement("input");b.type="range",b.min="0",b.max="4",b.value=String(l),b.setAttribute("aria-label","Detail level"),b.className="sm-vtoolbar-slider",n.appendChild(b);let u=document.createElement("span");return u.className="sm-vtoolbar-detail-label",u.textContent=c.#P[l],n.appendChild(u),b.addEventListener("input",()=>{this.dataset.detail=b.value,u.textContent=c.#P[parseInt(b.value,10)],this.#d()}),i.appendChild(n),i}#A(i,e,s){let t=document.createElement("button");return t.type="button",t.className="sm-vtoolbar-btn",t.innerHTML=i,t.setAttribute("aria-label",e),t.setAttribute("title",e),t.addEventListener("click",s),t}#y=null;#O(i,e=""){let s=[];for(let t=0;t<i.length;t++){let r=i[t],o=e?`${e}-${t}`:String(t);s.push(o),r.children.length>0&&!r.collapsed&&s.push(...this.#O(r.children,o))}return s}#_(i){let e=i.lastIndexOf("-");return e>0?i.slice(0,e):null}#it(i){let e=this.#p(i,this.#e);return!e||e.collapsed||e.children.length===0?null:`${i}-0`}#o(i){if(!i||!this.#t)return;let e=this.#t.querySelector('svg[role="tree"]');if(!e)return;let s=e.querySelector(`[data-node-id="${i}"]`);if(!s)return;this.#F(s),this.#y=i;let t=s.querySelector("rect");if(t&&this.#t){let r=t.getBoundingClientRect(),o=this.#t.getBoundingClientRect();(r.left<o.left||r.right>o.right||r.top<o.top||r.bottom>o.bottom)&&t.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}}#F(i){let e=i.closest("svg");if(!e)return;e.querySelectorAll(".sm-vfocus-ring").forEach(r=>r.remove()),e.querySelectorAll("[data-node-id]").forEach(r=>r.removeAttribute("aria-current"));let s=c.#m,t=i.querySelector("rect");if(t){let r=document.createElementNS(s,"rect");r.setAttribute("x",String(parseFloat(t.getAttribute("x"))-3)),r.setAttribute("y",String(parseFloat(t.getAttribute("y"))-3)),r.setAttribute("width",String(parseFloat(t.getAttribute("width"))+6)),r.setAttribute("height",String(parseFloat(t.getAttribute("height"))+6)),r.setAttribute("rx","11"),r.setAttribute("fill","none"),r.setAttribute("stroke","#3b82f6"),r.setAttribute("stroke-width","2"),r.setAttribute("class","sm-vfocus-ring"),i.parentNode.insertBefore(r,i)}i.setAttribute("aria-current","true"),this.#y=i.getAttribute("data-node-id")}#tt(i){if(!this.#e)return;let e=this.#y||"0",s=!1;switch(i.key){case"ArrowDown":{s=!0;let t=this.#p(e,this.#e);t&&t.children.length>0&&!t.collapsed&&this.#o(`${e}-0`);break}case"ArrowUp":{s=!0;let t=this.#_(e);t&&this.#o(t);break}case"ArrowRight":{s=!0;let t=this.#W(e,1);t&&this.#o(t);break}case"ArrowLeft":{s=!0;let t=this.#W(e,-1);t&&this.#o(t);break}case"Enter":case" ":{s=!0;let t=this.#p(e,this.#e);t&&t.children.length>0&&this.#U(e);break}case"Home":{s=!0,this.#o("0");break}case"End":{s=!0;let t=this.#O(this.#e);t.length&&this.#o(t[t.length-1]);break}}s&&(i.preventDefault(),i.stopPropagation())}#W(i,e){let s=i.split("-").map(Number),t=s[s.length-1]+e;if(t<0)return null;let r=s.length>1?s.slice(0,-1).join("-"):null,o=r?this.#p(r,this.#e):null,a=o?o.children:this.#e;if(!a||t>=a.length)return null;let h=[...s];return h[h.length-1]=t,h.join("-")}#I=!1;#et={dragging:!1,startX:0,startY:0,scrollLeft:0,scrollTop:0,moved:!1};#st(i,e){if(e.style.cursor="grab",this.#I)return;this.#I=!0;let s=this.#et;this.listen(this,"pointerdown",t=>{if(t.target.closest("button, [data-toggle], .sm-vtoolbar, input"))return;let r=this.querySelector(".sm-visual");if(!r)return;s.dragging=!0,s.moved=!1,s.startX=t.clientX,s.startY=t.clientY,s.scrollLeft=r.scrollLeft,s.scrollTop=r.scrollTop;let o=this.querySelector('svg[role="tree"]');o&&(o.style.cursor="grabbing")}),this.listen(window,"pointermove",t=>{if(!s.dragging)return;let r=t.clientX-s.startX,o=t.clientY-s.startY;(Math.abs(r)>3||Math.abs(o)>3)&&(s.moved=!0);let a=this.querySelector(".sm-visual");a&&(a.scrollLeft=s.scrollLeft-r,a.scrollTop=s.scrollTop-o)}),this.listen(window,"pointerup",()=>{if(!s.dragging)return;s.dragging=!1;let t=this.querySelector('svg[role="tree"]');t&&(t.style.cursor="grab")}),this.listen(this,"click",t=>{s.moved&&(t.stopPropagation(),s.moved=!1)},{capture:!0})}#V(i){let e=0,s=0;for(let t of i)if(t.x+c.#l>e&&(e=t.x+c.#l),t.y+c.#c>s&&(s=t.y+c.#c),t.children.length>0&&!t.collapsed){let r=this.#V(t.children);r.maxX>e&&(e=r.maxX),r.maxY>s&&(s=r.maxY)}return{maxX:e,maxY:s}}#C(i,e){let s=c.#m,t=c.#l,r=c.#c,o=c.#S;for(let a of e){if(a.children.length===0||a.collapsed)continue;let h=a.x+t/2,l=a.y+r,n=l+o/2;for(let b of a.children){let u=b.x+t/2,f=b.y,m=document.createElementNS(s,"path");m.setAttribute("d",`M ${h} ${l} L ${h} ${n} L ${u} ${n} L ${u} ${f}`),m.setAttribute("fill","none"),m.setAttribute("stroke","#cbd5e1"),m.setAttribute("stroke-width","1.5"),i.appendChild(m)}this.#C(i,a.children)}}#E(i,e,s=""){let t=c.#m,r=c.#l,o=c.#c,a=this.#H,h=a>=4;for(let l=0;l<e.length;l++){let n=e[l],b=s?`${s}-${l}`:String(l),u=h?{stroke:"#94a3b8",fill:"#ffffff",text:"#475569"}:c.#L[n.pageType]||c.#L.page,f=document.createElementNS(t,"g");f.setAttribute("data-node-id",b),f.setAttribute("data-href",n.href),f.setAttribute("data-page-type",n.pageType),f.setAttribute("data-template",n.template),f.style.cursor="pointer";let m=document.createElementNS(t,"rect");if(m.setAttribute("x",String(n.x)),m.setAttribute("y",String(n.y)),m.setAttribute("width",String(r)),m.setAttribute("height",String(o)),m.setAttribute("rx","8"),m.setAttribute("fill",u.fill),m.setAttribute("stroke",u.stroke),m.setAttribute("stroke-width",h?"1":"2"),(h||n.pageType==="modal")&&m.setAttribute("stroke-dasharray","6 3"),f.appendChild(m),a>=1){let d=document.createElementNS(t,"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",u.text),d.setAttribute("font-family","system-ui, sans-serif"),d.textContent=n.label.length>18?n.label.slice(0,17)+"\u2026":n.label,f.appendChild(d)}if(a>=2){let d=document.createElementNS(t,"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",u.stroke),d.setAttribute("font-family","system-ui, sans-serif"),d.textContent=(y[n.pageType]?.label||n.pageType).toUpperCase(),f.appendChild(d),n.template){let p=document.createElementNS(t,"text");p.setAttribute("x",String(n.x+r/2)),p.setAttribute("y",String(n.y+54)),p.setAttribute("text-anchor","middle"),p.setAttribute("font-size","9"),p.setAttribute("fill","#94a3b8"),p.setAttribute("font-family","system-ui, sans-serif"),p.textContent=n.template,f.appendChild(p)}}if(a>=3&&n.status&&c.#T[n.status]){let d=document.createElementNS(t,"circle");d.setAttribute("cx",String(n.x+r/2)),d.setAttribute("cy",String(n.y+o-8)),d.setAttribute("r","4"),d.setAttribute("fill",h?"#94a3b8":c.#T[n.status]),f.appendChild(d)}if(h)for(let d=0;d<2;d++){let p=document.createElementNS(t,"line");p.setAttribute("x1",String(n.x+12)),p.setAttribute("x2",String(n.x+r-12)),p.setAttribute("y1",String(n.y+o-22+d*8)),p.setAttribute("y2",String(n.y+o-22+d*8)),p.setAttribute("stroke","#cbd5e1"),p.setAttribute("stroke-width","1"),p.setAttribute("stroke-dasharray","3 2"),f.appendChild(p)}if(n.children.length>0){let d=document.createElementNS(t,"g");d.setAttribute("data-toggle",b),d.style.cursor="pointer";let p=document.createElementNS(t,"circle");p.setAttribute("cx",String(n.x+r/2)),p.setAttribute("cy",String(n.y+o+10)),p.setAttribute("r","10"),p.setAttribute("fill",h?"#fff":"#f1f5f9"),p.setAttribute("stroke","#cbd5e1"),p.setAttribute("stroke-width","1"),d.appendChild(p);let g=document.createElementNS(t,"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),f.appendChild(d)}i.appendChild(f),n.children.length>0&&!n.collapsed&&this.#E(i,n.children,b)}}#U(i){let e=this.#p(i,this.#e);if(!e)return;e.collapsed=!e.collapsed;let s=this.#y||i;this.#d(),requestAnimationFrame(()=>{this.#o(s);let t=this.#t?.querySelector('svg[role="tree"]');t&&t.focus({preventScroll:!0})})}#p(i,e){if(!e)return null;let s=i.split("-").map(Number),t=e,r=null;for(let o of s){if(!t||o>=t.length)return null;r=t[o],t=r.children}return r}async _loadSrc(i){if(i)try{let e=await fetch(i);if(!e.ok)throw new Error(`HTTP ${e.status}`);let s=await e.json();for(;this.firstChild;)this.firstChild.remove();s.title&&!this.getAttribute("title")&&this.setAttribute("title",s.title);let t=document.createElement("nav"),r=document.createElement("ul");this.#Y(r,s.pages||[]),t.appendChild(r),this.appendChild(t),this.teardown(),this.removeAttribute("data-upgraded"),this.setup()}catch(e){console.warn(`[site-map-wc] Failed to load src="${i}":`,e)}}#Y(i,e){for(let s of e){let t=document.createElement("li");s.pageType&&t.setAttribute("data-page-type",s.pageType),s.template&&t.setAttribute("data-template",s.template),s.status&&t.setAttribute("data-status",s.status);let r=document.createElement("a");if(r.href=s.href||"#",r.textContent=s.label||"",t.appendChild(r),s.children&&s.children.length>0){let o=document.createElement("ul");this.#Y(o,s.children),t.appendChild(o)}i.appendChild(t)}}};C("site-map-wc",S);export{S as SiteMapWc};
|
|
1
|
+
var E=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;function C(c,i,e={}){let s=e.priority??10,t={impl:i,bundle:e.bundle,contract:e.contract,priority:s},r=v.get(c);if(customElements.get(c)){if(!r||r.priority>=s){r&&r.priority===s&&r.impl!==i&&console.warn(`[VB Bundle] Tag <${c}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${c}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=s){r.priority===s&&console.warn(`[VB Bundle] Tag <${c}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}v.set(c,t),customElements.define(c,i)}var A=class extends HTMLElement{#h=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0})))}disconnectedCallback(){for(let i of this.#h)i();this.#h=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(i,e,s,t){i.addEventListener(e,s,t),this.#h.push(()=>i.removeEventListener(e,s,t))}setup(){}teardown(){}};var y={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"}},x={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"}},S=class c extends A{static get observedAttributes(){return["src","collapsed","compact","title","data-view","data-orientation","data-detail"]}static#h=0;#u=null;#s=null;#t=null;#f=null;#r=0;#n=0;setup(){c.#h++;let i=this.getAttribute("src");if(i&&!this.querySelector("nav")){this._loadSrc(i);return}let e=this.querySelector(":scope > nav");if(e){if(this.#r=0,this.#n=0,this.#w(e.querySelector("ul"),0),this.dataset.view==="visual"){this.#N(),this.#J(e),this.dispatchEvent(new CustomEvent("site-map-wc:ready",{bubbles:!0,detail:{nodeCount:this.#r,depth:this.#n}}));return}this.#k(e.querySelector("ul"),0),this.#N(),e.classList.add("sm-tree"),e.setAttribute("role","tree"),e.setAttribute("aria-label",this.getAttribute("title")||"Site map"),this.#u=e,this.hasAttribute("collapsed")&&this.#q(),this.listen(e,"keydown",s=>this.#X(s)),this.listen(e,"click",s=>this.#R(s)),this.dispatchEvent(new CustomEvent("site-map-wc:ready",{bubbles:!0,detail:{nodeCount:this.#r,depth:this.#n}}))}}teardown(){if(this.#t){this.#t.remove(),this.#t=null;let i=this.querySelector("nav");i&&(i.style.display="",i.removeAttribute("aria-hidden"))}this.#s&&(this.#s.remove(),this.#s=null),this.#u&&(this.#u.classList.remove("sm-tree"),this.#u.removeAttribute("role"),this.#u.removeAttribute("aria-label")),this.querySelectorAll(".sm-node-content, .sm-toggle").forEach(i=>i.remove()),this.querySelectorAll('li[role="treeitem"]').forEach(i=>{i.removeAttribute("role"),i.removeAttribute("aria-expanded"),i.removeAttribute("tabindex")}),this.querySelectorAll('ul[role="group"]').forEach(i=>{i.removeAttribute("role"),i.classList.remove("sm-subtree","sm-collapsed")}),this.#u=null,this.#f=null,this.#r=0,this.#n=0}attributeChangedCallback(i,e,s){e===s||!this.isConnected||i==="src"&&this._loadSrc(s)}#w(i,e){if(!i)return;let s=i.querySelectorAll(":scope > li");for(let t of s){this.#r++;let r=e+1;r>this.#n&&(this.#n=r);let o=t.querySelector(":scope > ul");o&&this.#w(o,r)}}#k(i,e){if(!i)return;e>0&&(i.setAttribute("role","group"),i.classList.add("sm-subtree"));let s=[...i.querySelectorAll(":scope > li")];for(let t of s){let r=!!t.querySelector(":scope > ul"),o=t.querySelector(":scope > a"),a=t.getAttribute("data-page-type")||"page",h=t.getAttribute("data-template")||"",l=t.getAttribute("data-status")||"";t.setAttribute("role","treeitem"),t.setAttribute("tabindex","-1");let n=document.createElement("span");if(n.className="sm-node-content",r){t.setAttribute("aria-expanded","true");let u=document.createElement("button");u.className="sm-toggle",u.setAttribute("type","button"),u.setAttribute("aria-hidden","true"),u.setAttribute("tabindex","-1"),u.textContent="\u25BE",n.appendChild(u)}else{let u=document.createElement("span");u.className="sm-leaf-marker",u.setAttribute("aria-hidden","true"),n.appendChild(u)}if(l&&x[l]){let u=document.createElement("span");u.className=`sm-status-dot ${x[l].cssClass}`,u.setAttribute("title",x[l].label),u.setAttribute("aria-label",x[l].label),n.appendChild(u)}if(o&&n.appendChild(o),y[a]){let u=document.createElement("span");u.className=`sm-badge ${y[a].cssClass}`,u.textContent=y[a].label,n.appendChild(u)}if(h){let u=document.createElement("span");u.className="sm-badge sm-badge--template",u.textContent=h,n.appendChild(u)}t.insertBefore(n,t.firstChild);let b=t.querySelector(":scope > ul");b&&this.#k(b,e+1)}}#N(){let i=this.getAttribute("title");if(!i&&this.#r===0)return;if(this.#s=document.createElement("div"),this.#s.className="sm-header",i){let t=document.createElement("h2");t.className="sm-title",t.textContent=i,this.#s.appendChild(t)}let e=document.createElement("span");e.className="sm-summary",e.textContent=`${this.#r} pages \xB7 ${this.#n} levels deep`,this.#s.appendChild(e);let s=document.createElement("button");s.className="sm-toggle-all",s.setAttribute("type","button"),s.textContent="Collapse all",s.addEventListener("click",()=>{this.querySelectorAll('li[aria-expanded="true"]').length>0?(this.#q(),s.textContent="Expand all"):(this.#G(),s.textContent="Collapse all")}),this.#s.appendChild(s),this.insertBefore(this.#s,this.firstChild)}#q(){let i=this.querySelectorAll("li[aria-expanded]");for(let e of i){e.setAttribute("aria-expanded","false");let s=e.querySelector(":scope > ul");s&&s.classList.add("sm-collapsed");let t=e.querySelector(":scope > .sm-node-content > .sm-toggle");t&&(t.textContent="\u25B8")}}#G(){let i=this.querySelectorAll("li[aria-expanded]");for(let e of i){e.setAttribute("aria-expanded","true");let s=e.querySelector(":scope > ul");s&&s.classList.remove("sm-collapsed");let t=e.querySelector(":scope > .sm-node-content > .sm-toggle");t&&(t.textContent="\u25BE")}}#b(i){let e=i.getAttribute("aria-expanded")==="true";i.setAttribute("aria-expanded",e?"false":"true");let s=i.querySelector(":scope > ul");s&&s.classList.toggle("sm-collapsed",e);let t=i.querySelector(":scope > .sm-node-content > .sm-toggle");t&&(t.textContent=e?"\u25B8":"\u25BE")}#R(i){let e=i.target;if(e.closest(".sm-toggle")){i.preventDefault();let r=e.closest('li[role="treeitem"]');r&&this.#b(r);return}let s=e.closest('li[role="treeitem"]');if(!s)return;this.#a(s);let t=e.closest("a");t&&this.dispatchEvent(new CustomEvent("site-map-wc:select",{bubbles:!0,detail:{href:t.getAttribute("href")||"",pageType:s.getAttribute("data-page-type")||"page",template:s.getAttribute("data-template")||""}}))}#X(i){let e=i.target.closest('li[role="treeitem"]');if(!e)return;let s=i.key,t=!1;switch(s){case"ArrowDown":t=!0,this.#j(e);break;case"ArrowUp":t=!0,this.#K(e);break;case"ArrowRight":if(t=!0,e.getAttribute("aria-expanded")==="false")this.#b(e);else if(e.getAttribute("aria-expanded")==="true"){let r=e.querySelector(':scope > ul > li[role="treeitem"]');r&&this.#a(r)}break;case"ArrowLeft":if(t=!0,e.getAttribute("aria-expanded")==="true")this.#b(e);else{let r=e.parentElement?.closest('li[role="treeitem"]');r&&this.#a(r)}break;case"Enter":t=!0,e.hasAttribute("aria-expanded")&&this.#b(e);break;case" ":t=!0;{let r=e.querySelector(":scope > .sm-node-content > a");r&&r.click()}break;case"Home":t=!0;{let r=this.querySelector('li[role="treeitem"]');r&&this.#a(r)}break;case"End":t=!0;{let r=this.#x();r.length&&this.#a(r[r.length-1])}break}t&&(i.preventDefault(),i.stopPropagation())}#x(){let i=[],e=t=>{if(!t)return;let r=[...t.querySelectorAll(':scope > li[role="treeitem"]')];for(let o of r)if(i.push(o),o.getAttribute("aria-expanded")==="true"){let a=o.querySelector(":scope > ul");a&&e(a)}},s=this.querySelector("nav > ul");return e(s),i}#j(i){let e=this.#x(),s=e.indexOf(i);s>=0&&s<e.length-1&&this.#a(e[s+1])}#K(i){let e=this.#x(),s=e.indexOf(i);s>0&&this.#a(e[s-1])}#a(i){this.#f&&this.#f.setAttribute("tabindex","-1"),i.setAttribute("tabindex","0"),i.focus(),this.#f=i}static#m="http://www.w3.org/2000/svg";static#l=150;static#c=70;static#$=30;static#S=50;static#Z=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#T={draft:"#94a3b8",ready:"#f59e0b",live:"#22c55e",deprecated:"#ef4444"};#M(i){let e=[];for(let s of i.querySelectorAll(":scope > li")){let t=s.querySelector(":scope > a"),r=s.querySelector(":scope > ul");e.push({label:t?.textContent?.trim()||s.firstChild?.textContent?.trim()||"",href:t?.getAttribute("href")||"",pageType:s.getAttribute("data-page-type")||"page",template:s.getAttribute("data-template")||"",status:s.getAttribute("data-status")||"",children:r?this.#M(r):[],x:0,y:0,subtreeWidth:0,collapsed:!1,childCount:0})}return e}#B(i,e=0){let s=c.#l,t=c.#c,r=c.#$,o=c.#S;for(let a of i)a.childCount=this.#z(a),a.children.length>0&&!a.collapsed?(this.#B(a.children,e+1),a.subtreeWidth=a.children.reduce((h,l)=>h+l.subtreeWidth,0)+r*(a.children.length-1)):a.subtreeWidth=s,a.subtreeWidth=Math.max(a.subtreeWidth,s)}#z(i){let e=0;for(let s of i.children)e+=1+this.#z(s);return e}#D(i,e,s){let t=c.#l,r=c.#c,o=c.#$,a=c.#S,h=e;for(let l of i)l.x=h+(l.subtreeWidth-t)/2,l.y=s,l.children.length>0&&!l.collapsed&&this.#D(l.children,h,s+r+a),h+=l.subtreeWidth+o}#J(i){i.style.display="none",i.setAttribute("aria-hidden","true");let e=i.querySelector("ul");e&&(this.#e=this.#M(e),this.#d())}#e=null;#i=1;get#v(){return this.dataset.orientation==="horizontal"?"horizontal":"vertical"}get#H(){return Math.min(4,Math.max(0,parseInt(this.dataset.detail||"2",10)))}static#g={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#P=["Shape","Shape + Title","Full","Full + Status","Wireframe"];#d(){if(!this.#e)return;this.#t&&this.#t.remove();let i=c.#m,e=c.#l,s=c.#c,t=c.#Z,r=this.#v==="horizontal";this.#B(this.#e),this.#D(this.#e,t,t);let o=this.#V(this.#e),a=o.maxX+e+t,h=o.maxY+s+t;r&&([a,h]=[h,a]),this.#t=document.createElement("div"),this.#t.className="sm-visual",this.#t.setAttribute("tabindex","-1"),this.#t.appendChild(this.#Q());let l=document.createElementNS(i,"svg");l.setAttribute("viewBox",`0 0 ${a} ${h}`),l.setAttribute("width",String(a)),l.setAttribute("height",String(h)),l.setAttribute("role","img"),l.setAttribute("aria-label",`Site map${this.getAttribute("title")?": "+this.getAttribute("title"):""}`);let n=document.createElement("div");if(n.className="sm-visual-zoom",n.style.width=`${Math.round(a*this.#i)}px`,n.style.height=`${Math.round(h*this.#i)}px`,l.style.transform=`scale(${this.#i})`,l.style.transformOrigin="0 0",r){let f=document.createElementNS(i,"g");f.setAttribute("transform",`rotate(90 0 0) translate(0 -${h})`),this.#C(f,this.#e),this.#E(f,this.#e),l.appendChild(f)}else this.#C(l,this.#e),this.#E(l,this.#e);n.appendChild(l),this.#t.appendChild(n);let b=document.createElement("div");b.className="sm-visual-summary";let u=Math.round(this.#i*100);b.textContent=`${this.#r} pages \xB7 ${this.#n} levels \xB7 ${u}%`,this.#t.appendChild(b),this.appendChild(this.#t),this.#st(this.#t,l),this.listen(l,"click",f=>{let m=f.target,d=m.closest("[data-toggle]");if(d){let g=d.getAttribute("data-toggle");this.#U(g);return}let p=m.closest("[data-node-id]");p&&(this.#o(p.getAttribute("data-node-id")),this.dispatchEvent(new CustomEvent("site-map-wc:select",{bubbles:!0,detail:{href:p.getAttribute("data-href")||"",pageType:p.getAttribute("data-page-type")||"page",template:p.getAttribute("data-template")||""}})))}),l.setAttribute("tabindex","0"),l.setAttribute("role","tree"),l.setAttribute("aria-label",`Site map${this.getAttribute("title")?": "+this.getAttribute("title"):""} \u2014 use arrow keys to navigate`),l.addEventListener("keydown",f=>this.#tt(f)),requestAnimationFrame(()=>{let f=l.querySelector("[data-node-id]");f&&this.#F(f)})}#Q(){let i=document.createElement("div");i.className="sm-vtoolbar",i.setAttribute("role","toolbar"),i.setAttribute("aria-label","Site map controls");let e=f=>`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${f}</svg>`,s=this.#A(e(c.#g.zoomIn),"Zoom in",()=>{this.#i=Math.min(3,this.#i+.25),this.#d()});i.appendChild(s);let t=this.#A(e(c.#g.zoomOut),"Zoom out",()=>{this.#i=Math.max(.25,this.#i-.25),this.#d()});i.appendChild(t);let r=this.#A(e(c.#g.reset),"Reset zoom",()=>{this.#i=1,this.#d()});i.appendChild(r);let o=document.createElement("span");o.className="sm-vtoolbar-sep",i.appendChild(o);let a=this.#v==="horizontal"?"Vertical":"Horizontal",h=this.#A(e(c.#g.flip),a,()=>{this.dataset.orientation=this.#v==="horizontal"?"vertical":"horizontal",this.#d()});i.appendChild(h),i.appendChild(o.cloneNode());let l=this.#H,n=document.createElement("label");n.className="sm-vtoolbar-detail",n.textContent="Detail ";let b=document.createElement("input");b.type="range",b.min="0",b.max="4",b.value=String(l),b.setAttribute("aria-label","Detail level"),b.className="sm-vtoolbar-slider",n.appendChild(b);let u=document.createElement("span");return u.className="sm-vtoolbar-detail-label",u.textContent=c.#P[l],n.appendChild(u),b.addEventListener("input",()=>{this.dataset.detail=b.value,u.textContent=c.#P[parseInt(b.value,10)],this.#d()}),i.appendChild(n),i}#A(i,e,s){let t=document.createElement("button");return t.type="button",t.className="sm-vtoolbar-btn",t.innerHTML=i,t.setAttribute("aria-label",e),t.setAttribute("title",e),t.addEventListener("click",s),t}#y=null;#O(i,e=""){let s=[];for(let t=0;t<i.length;t++){let r=i[t],o=e?`${e}-${t}`:String(t);s.push(o),r.children.length>0&&!r.collapsed&&s.push(...this.#O(r.children,o))}return s}#_(i){let e=i.lastIndexOf("-");return e>0?i.slice(0,e):null}#it(i){let e=this.#p(i,this.#e);return!e||e.collapsed||e.children.length===0?null:`${i}-0`}#o(i){if(!i||!this.#t)return;let e=this.#t.querySelector('svg[role="tree"]');if(!e)return;let s=e.querySelector(`[data-node-id="${i}"]`);if(!s)return;this.#F(s),this.#y=i;let t=s.querySelector("rect");if(t&&this.#t){let r=t.getBoundingClientRect(),o=this.#t.getBoundingClientRect();(r.left<o.left||r.right>o.right||r.top<o.top||r.bottom>o.bottom)&&t.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}}#F(i){let e=i.closest("svg");if(!e)return;e.querySelectorAll(".sm-vfocus-ring").forEach(r=>r.remove()),e.querySelectorAll("[data-node-id]").forEach(r=>r.removeAttribute("aria-current"));let s=c.#m,t=i.querySelector("rect");if(t){let r=document.createElementNS(s,"rect");r.setAttribute("x",String(parseFloat(t.getAttribute("x"))-3)),r.setAttribute("y",String(parseFloat(t.getAttribute("y"))-3)),r.setAttribute("width",String(parseFloat(t.getAttribute("width"))+6)),r.setAttribute("height",String(parseFloat(t.getAttribute("height"))+6)),r.setAttribute("rx","11"),r.setAttribute("fill","none"),r.setAttribute("stroke","#3b82f6"),r.setAttribute("stroke-width","2"),r.setAttribute("class","sm-vfocus-ring"),i.parentNode.insertBefore(r,i)}i.setAttribute("aria-current","true"),this.#y=i.getAttribute("data-node-id")}#tt(i){if(!this.#e)return;let e=this.#y||"0",s=!1;switch(i.key){case"ArrowDown":{s=!0;let t=this.#p(e,this.#e);t&&t.children.length>0&&!t.collapsed&&this.#o(`${e}-0`);break}case"ArrowUp":{s=!0;let t=this.#_(e);t&&this.#o(t);break}case"ArrowRight":{s=!0;let t=this.#W(e,1);t&&this.#o(t);break}case"ArrowLeft":{s=!0;let t=this.#W(e,-1);t&&this.#o(t);break}case"Enter":case" ":{s=!0;let t=this.#p(e,this.#e);t&&t.children.length>0&&this.#U(e);break}case"Home":{s=!0,this.#o("0");break}case"End":{s=!0;let t=this.#O(this.#e);t.length&&this.#o(t[t.length-1]);break}}s&&(i.preventDefault(),i.stopPropagation())}#W(i,e){let s=i.split("-").map(Number),t=s[s.length-1]+e;if(t<0)return null;let r=s.length>1?s.slice(0,-1).join("-"):null,o=r?this.#p(r,this.#e):null,a=o?o.children:this.#e;if(!a||t>=a.length)return null;let h=[...s];return h[h.length-1]=t,h.join("-")}#I=!1;#et={dragging:!1,startX:0,startY:0,scrollLeft:0,scrollTop:0,moved:!1};#st(i,e){if(e.style.cursor="grab",this.#I)return;this.#I=!0;let s=this.#et;this.listen(this,"pointerdown",t=>{if(t.target.closest("button, [data-toggle], .sm-vtoolbar, input"))return;let r=this.querySelector(".sm-visual");if(!r)return;s.dragging=!0,s.moved=!1,s.startX=t.clientX,s.startY=t.clientY,s.scrollLeft=r.scrollLeft,s.scrollTop=r.scrollTop;let o=this.querySelector('svg[role="tree"]');o&&(o.style.cursor="grabbing")}),this.listen(window,"pointermove",t=>{if(!s.dragging)return;let r=t.clientX-s.startX,o=t.clientY-s.startY;(Math.abs(r)>3||Math.abs(o)>3)&&(s.moved=!0);let a=this.querySelector(".sm-visual");a&&(a.scrollLeft=s.scrollLeft-r,a.scrollTop=s.scrollTop-o)}),this.listen(window,"pointerup",()=>{if(!s.dragging)return;s.dragging=!1;let t=this.querySelector('svg[role="tree"]');t&&(t.style.cursor="grab")}),this.listen(this,"click",t=>{s.moved&&(t.stopPropagation(),s.moved=!1)},{capture:!0})}#V(i){let e=0,s=0;for(let t of i)if(t.x+c.#l>e&&(e=t.x+c.#l),t.y+c.#c>s&&(s=t.y+c.#c),t.children.length>0&&!t.collapsed){let r=this.#V(t.children);r.maxX>e&&(e=r.maxX),r.maxY>s&&(s=r.maxY)}return{maxX:e,maxY:s}}#C(i,e){let s=c.#m,t=c.#l,r=c.#c,o=c.#S;for(let a of e){if(a.children.length===0||a.collapsed)continue;let h=a.x+t/2,l=a.y+r,n=l+o/2;for(let b of a.children){let u=b.x+t/2,f=b.y,m=document.createElementNS(s,"path");m.setAttribute("d",`M ${h} ${l} L ${h} ${n} L ${u} ${n} L ${u} ${f}`),m.setAttribute("fill","none"),m.setAttribute("stroke","#cbd5e1"),m.setAttribute("stroke-width","1.5"),i.appendChild(m)}this.#C(i,a.children)}}#E(i,e,s=""){let t=c.#m,r=c.#l,o=c.#c,a=this.#H,h=a>=4;for(let l=0;l<e.length;l++){let n=e[l],b=s?`${s}-${l}`:String(l),u=h?{stroke:"#94a3b8",fill:"#ffffff",text:"#475569"}:c.#L[n.pageType]||c.#L.page,f=document.createElementNS(t,"g");f.setAttribute("data-node-id",b),f.setAttribute("data-href",n.href),f.setAttribute("data-page-type",n.pageType),f.setAttribute("data-template",n.template),f.style.cursor="pointer";let m=document.createElementNS(t,"rect");if(m.setAttribute("x",String(n.x)),m.setAttribute("y",String(n.y)),m.setAttribute("width",String(r)),m.setAttribute("height",String(o)),m.setAttribute("rx","8"),m.setAttribute("fill",u.fill),m.setAttribute("stroke",u.stroke),m.setAttribute("stroke-width",h?"1":"2"),(h||n.pageType==="modal")&&m.setAttribute("stroke-dasharray","6 3"),f.appendChild(m),a>=1){let d=document.createElementNS(t,"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",u.text),d.setAttribute("font-family","system-ui, sans-serif"),d.textContent=n.label.length>18?n.label.slice(0,17)+"\u2026":n.label,f.appendChild(d)}if(a>=2){let d=document.createElementNS(t,"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",u.stroke),d.setAttribute("font-family","system-ui, sans-serif"),d.textContent=(y[n.pageType]?.label||n.pageType).toUpperCase(),f.appendChild(d),n.template){let p=document.createElementNS(t,"text");p.setAttribute("x",String(n.x+r/2)),p.setAttribute("y",String(n.y+54)),p.setAttribute("text-anchor","middle"),p.setAttribute("font-size","9"),p.setAttribute("fill","#94a3b8"),p.setAttribute("font-family","system-ui, sans-serif"),p.textContent=n.template,f.appendChild(p)}}if(a>=3&&n.status&&c.#T[n.status]){let d=document.createElementNS(t,"circle");d.setAttribute("cx",String(n.x+r/2)),d.setAttribute("cy",String(n.y+o-8)),d.setAttribute("r","4"),d.setAttribute("fill",h?"#94a3b8":c.#T[n.status]),f.appendChild(d)}if(h)for(let d=0;d<2;d++){let p=document.createElementNS(t,"line");p.setAttribute("x1",String(n.x+12)),p.setAttribute("x2",String(n.x+r-12)),p.setAttribute("y1",String(n.y+o-22+d*8)),p.setAttribute("y2",String(n.y+o-22+d*8)),p.setAttribute("stroke","#cbd5e1"),p.setAttribute("stroke-width","1"),p.setAttribute("stroke-dasharray","3 2"),f.appendChild(p)}if(n.children.length>0){let d=document.createElementNS(t,"g");d.setAttribute("data-toggle",b),d.style.cursor="pointer";let p=document.createElementNS(t,"circle");p.setAttribute("cx",String(n.x+r/2)),p.setAttribute("cy",String(n.y+o+10)),p.setAttribute("r","10"),p.setAttribute("fill",h?"#fff":"#f1f5f9"),p.setAttribute("stroke","#cbd5e1"),p.setAttribute("stroke-width","1"),d.appendChild(p);let g=document.createElementNS(t,"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),f.appendChild(d)}i.appendChild(f),n.children.length>0&&!n.collapsed&&this.#E(i,n.children,b)}}#U(i){let e=this.#p(i,this.#e);if(!e)return;e.collapsed=!e.collapsed;let s=this.#y||i;this.#d(),requestAnimationFrame(()=>{this.#o(s);let t=this.#t?.querySelector('svg[role="tree"]');t&&t.focus({preventScroll:!0})})}#p(i,e){if(!e)return null;let s=i.split("-").map(Number),t=e,r=null;for(let o of s){if(!t||o>=t.length)return null;r=t[o],t=r.children}return r}async _loadSrc(i){if(i)try{let e=await fetch(i);if(!e.ok)throw new Error(`HTTP ${e.status}`);let s=await e.json();for(;this.firstChild;)this.firstChild.remove();s.title&&!this.getAttribute("title")&&this.setAttribute("title",s.title);let t=document.createElement("nav"),r=document.createElement("ul");this.#Y(r,s.pages||[]),t.appendChild(r),this.appendChild(t),this.teardown(),this.removeAttribute("data-upgraded"),this.setup()}catch(e){console.warn(`[site-map-wc] Failed to load src="${i}":`,e)}}#Y(i,e){for(let s of e){let t=document.createElement("li");s.pageType&&t.setAttribute("data-page-type",s.pageType),s.template&&t.setAttribute("data-template",s.template),s.status&&t.setAttribute("data-status",s.status);let r=document.createElement("a");if(r.href=s.href||"#",r.textContent=s.label||"",t.appendChild(r),s.children&&s.children.length>0){let o=document.createElement("ul");this.#Y(o,s.children),t.appendChild(o)}i.appendChild(t)}}};C("site-map-wc",S);export{S as SiteMapWc};
|
|
2
2
|
//# sourceMappingURL=site-map-wc.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var u=window.matchMedia("(prefers-reduced-motion: reduce)");var l=new Map;function d(i,n,e={}){let t=e.priority??10,o={impl:n,bundle:e.bundle,contract:e.contract,priority:t},r=l.get(i);if(customElements.get(i)){if(!r||r.priority>=t){r&&r.priority===t&&r.impl!==n&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=t){r.priority===t&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}l.set(i,o),customElements.define(i,n)}var s=class extends HTMLElement{#e=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&this.setAttribute("data-upgraded","")}disconnectedCallback(){for(let n of this.#e)n();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(n,e,t,o){n.addEventListener(e,t,o),this.#e.push(()=>n.removeEventListener(e,t,o))}setup(){}teardown(){}};var c=class extends s{setup(){this.#e(),this.#t(),this.#r(),this.getAttribute("src")&&this.#o()}#e(){let n=this.getAttribute("current")||window.location.pathname,e=this.querySelectorAll("a");for(let t of e)new URL(t.href,window.location.origin).pathname===n&&t.setAttribute("aria-current","page")}#t(){let n=this.querySelector('[aria-current="page"]');if(!n)return;let e=n.parentElement;for(;e&&e!==this;)e.tagName==="DETAILS"&&(e.open=!0),e=e.parentElement}#r(){let n=this.querySelectorAll("details");if(!n.length)return;let e=document.createElement("nav");e.setAttribute("data-sitemap-controls",""),e.setAttribute("aria-label","Sitemap controls");let t=document.createElement("button");t.type="button",t.textContent="Expand all",t.addEventListener("click",()=>{for(let r of n)r.open=!0});let o=document.createElement("button");o.type="button",o.textContent="Collapse all",o.addEventListener("click",()=>{for(let r of n)r.open=!1;this.#t()}),e.append(t,o),this.prepend(e)}async#o(){let n=this.getAttribute("src");if(n)try{let e=await fetch(n);if(!e.ok)return;let t=await e.json();this.#i(t)}catch{}}#i(n){if(!n||!Array.isArray(n.children))return;let e=document.createElement("nav");e.setAttribute("aria-label","Full site map"),e.append(this.#n(n.children));let t=this.querySelector("nav");t?t.replaceWith(e):this.append(e),this.#e(),this.#t()}#n(n){let e=document.createElement("ul");for(let t of n){let o=document.createElement("li");if(t.children?.length){let r=document.createElement("details"),a=document.createElement("summary");a.textContent=t.title,r.append(a),r.append(this.#n(t.children)),o.append(r)}else{let r=document.createElement("a");r.href=t.href||t.path,r.textContent=t.title,o.append(r)}e.append(o)}return e}};d("site-map",c);export{c as SiteMap};
|
|
1
|
+
var u=window.matchMedia("(prefers-reduced-motion: reduce)");var l=new Map;function d(i,n,e={}){let t=e.priority??10,o={impl:n,bundle:e.bundle,contract:e.contract,priority:t},r=l.get(i);if(customElements.get(i)){if(!r||r.priority>=t){r&&r.priority===t&&r.impl!==n&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=t){r.priority===t&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}l.set(i,o),customElements.define(i,n)}var s=class extends HTMLElement{#e=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0})))}disconnectedCallback(){for(let n of this.#e)n();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(n,e,t,o){n.addEventListener(e,t,o),this.#e.push(()=>n.removeEventListener(e,t,o))}setup(){}teardown(){}};var c=class extends s{setup(){this.#e(),this.#t(),this.#r(),this.getAttribute("src")&&this.#o()}#e(){let n=this.getAttribute("current")||window.location.pathname,e=this.querySelectorAll("a");for(let t of e)new URL(t.href,window.location.origin).pathname===n&&t.setAttribute("aria-current","page")}#t(){let n=this.querySelector('[aria-current="page"]');if(!n)return;let e=n.parentElement;for(;e&&e!==this;)e.tagName==="DETAILS"&&(e.open=!0),e=e.parentElement}#r(){let n=this.querySelectorAll("details");if(!n.length)return;let e=document.createElement("nav");e.setAttribute("data-sitemap-controls",""),e.setAttribute("aria-label","Sitemap controls");let t=document.createElement("button");t.type="button",t.textContent="Expand all",t.addEventListener("click",()=>{for(let r of n)r.open=!0});let o=document.createElement("button");o.type="button",o.textContent="Collapse all",o.addEventListener("click",()=>{for(let r of n)r.open=!1;this.#t()}),e.append(t,o),this.prepend(e)}async#o(){let n=this.getAttribute("src");if(n)try{let e=await fetch(n);if(!e.ok)return;let t=await e.json();this.#i(t)}catch{}}#i(n){if(!n||!Array.isArray(n.children))return;let e=document.createElement("nav");e.setAttribute("aria-label","Full site map"),e.append(this.#n(n.children));let t=this.querySelector("nav");t?t.replaceWith(e):this.append(e),this.#e(),this.#t()}#n(n){let e=document.createElement("ul");for(let t of n){let o=document.createElement("li");if(t.children?.length){let r=document.createElement("details"),a=document.createElement("summary");a.textContent=t.title,r.append(a),r.append(this.#n(t.children)),o.append(r)}else{let r=document.createElement("a");r.href=t.href||t.path,r.textContent=t.title,o.append(r)}e.append(o)}return e}};d("site-map",c);export{c as SiteMap};
|
|
2
2
|
//# sourceMappingURL=site-map.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var v=/Mac|iPhone|iPad|iPod/.test(navigator.platform??"");function u(i){let e=i.toLowerCase().split("+").map(s=>s.trim());return{key:e.pop()??"",meta:e.includes("meta")||e.includes("cmd"),ctrl:e.includes("ctrl"),shift:e.includes("shift"),alt:e.includes("alt")}}function h(i,e){if(i.key.toLowerCase()!==e.key)return!1;let t,s;return v?(t=e.meta,s=e.ctrl):(t=!1,s=e.meta||e.ctrl),!(t!==i.metaKey||s!==i.ctrlKey||e.shift!==i.shiftKey||e.alt!==i.altKey)}var
|
|
1
|
+
var v=/Mac|iPhone|iPad|iPod/.test(navigator.platform??"");function u(i){let e=i.toLowerCase().split("+").map(s=>s.trim());return{key:e.pop()??"",meta:e.includes("meta")||e.includes("cmd"),ctrl:e.includes("ctrl"),shift:e.includes("shift"),alt:e.includes("alt")}}function h(i,e){if(i.key.toLowerCase()!==e.key)return!1;let t,s;return v?(t=e.meta,s=e.ctrl):(t=!1,s=e.meta||e.ctrl),!(t!==i.metaKey||s!==i.ctrlKey||e.shift!==i.shiftKey||e.alt!==i.altKey)}var g=new Set(["INPUT","TEXTAREA","SELECT"]),a=[],f=!1;function k(i){let e=g.has(i.target.tagName)||i.target.isContentEditable;for(let t of a)if(!(e&&!t.global)&&h(i,t.descriptor)){i.preventDefault(),t.callback(i);return}}function w(){f||(document.addEventListener("keydown",k),f=!0)}function p(i,e,t={}){w();let s=u(i),n={combo:i,descriptor:s,callback:e,global:t.global===!0};return a.find(l=>l.combo===i)&&console.warn(`[hotkey-bind] Shortcut "${i}" already bound. Last-connected-wins.`),a.unshift(n),function(){let d=a.indexOf(n);d!==-1&&a.splice(d,1)}}function b(){return a.map(i=>i.combo)}var A=window.matchMedia("(prefers-reduced-motion: reduce)");var m=new Map;function y(i,e,t={}){let s=t.priority??10,n={impl:e,bundle:t.bundle,contract:t.contract,priority:s},r=m.get(i);if(customElements.get(i)){if(!r||r.priority>=s){r&&r.priority===s&&r.impl!==e&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=s){r.priority===s&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${r.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}m.set(i,n),customElements.define(i,e)}var o=class extends HTMLElement{#c=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0})))}disconnectedCallback(){for(let e of this.#c)e();this.#c=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,t,s,n){e.addEventListener(t,s,n),this.#c.push(()=>e.removeEventListener(t,s,n))}setup(){}teardown(){}};var c=class i extends o{static#c=150;static#m=8;#e=null;#t=null;#i=null;#s=null;#r=[];#a=-1;#n=!1;#o=null;#l=null;#u=null;setup(){this.#y(),this.#v()}teardown(){this.#n&&(document.body.style.overflow="",this.removeAttribute("open"),this.#n=!1),this.#u?.(),this.#d()}#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
2
|
<icon-wc name="search" label="Search"></icon-wc>
|
|
3
3
|
`,this.prepend(this.#e)),this.#e.setAttribute("aria-haspopup","dialog"),this.#e.setAttribute("aria-expanded","false"),this.#t=document.createElement("div"),this.#t.className="dialog",this.#t.setAttribute("role","dialog"),this.#t.setAttribute("aria-label","Site search"),this.#t.id=`search-dialog-${crypto.randomUUID().slice(0,8)}`,this.#e.setAttribute("aria-controls",this.#t.id),this.#t.innerHTML=`
|
|
4
4
|
<div class="backdrop"></div>
|
|
@@ -31,7 +31,7 @@ var v=/Mac|iPhone|iPad|iPod/.test(navigator.platform??"");function u(i){let e=i.
|
|
|
31
31
|
</span>
|
|
32
32
|
</div>
|
|
33
33
|
</div>
|
|
34
|
-
`,this.appendChild(this.#t),this.#i=this.#t.querySelector(".input"),this.#s=this.#t.querySelector(".results")}#v(){this.#e.addEventListener("click",this.#
|
|
34
|
+
`,this.appendChild(this.#t),this.#i=this.#t.querySelector(".input"),this.#s=this.#t.querySelector(".results")}#v(){this.#e.addEventListener("click",this.#g),b().includes("meta+k")||(this.#u=p("meta+k",()=>{this.#n?this.close():this.open()},{global:!0})),this.listen(document,"keydown",this.#k),this.#t.querySelector(".backdrop")?.addEventListener("click",()=>this.close()),this.#i.addEventListener("input",this.#w),this.#i.addEventListener("keydown",this.#E),this.#s.addEventListener("click",this.#S)}#g=e=>{e.stopPropagation(),this.open()};#k=e=>{e.key==="Escape"&&this.#n&&(e.preventDefault(),this.close())};#w=()=>{this.#d(),this.#l=setTimeout(()=>{this.#L(this.#i.value)},i.#c)};#E=e=>{switch(e.key){case"ArrowDown":e.preventDefault(),this.#p(this.#a+1);break;case"ArrowUp":e.preventDefault(),this.#p(this.#a-1);break;case"Enter":e.preventDefault(),this.#a>=0&&this.#r[this.#a]&&this.#b(this.#r[this.#a]);break}};#S=e=>{let t=e.target.closest("[data-result-index]");if(t){let s=parseInt(t.dataset.resultIndex,10);this.#r[s]&&this.#b(this.#r[s])}};async#h(){if(!this.#o)try{this.#o=await import("/pagefind/pagefind.js"),await this.#o.options({excerptLength:20})}catch{console.warn("Pagefind not available. Run `npm run search:index` to build the search index."),this.#o=null}}async#L(e){if(!e.trim()){this.#f([]);return}if(await this.#h(),!this.#o){this.#A();return}try{this.#s.innerHTML='<div class="loading">Searching...</div>';let t=await this.#o.search(e),s=await Promise.all(t.results.slice(0,i.#m).map(n=>n.data()));this.#r=s,this.#f(s)}catch(t){console.error("Search error:",t),this.#s.innerHTML='<div class="error">Search error. Please try again.</div>'}}#f(e){if(this.#a=-1,e.length===0){this.#i.value.trim()?this.#s.innerHTML='<div class="empty">No results found</div>':this.#s.innerHTML="";return}this.#s.innerHTML=e.map((t,s)=>`
|
|
35
35
|
<a
|
|
36
36
|
id="search-result-${s}"
|
|
37
37
|
href="${t.url}"
|
|
@@ -48,5 +48,5 @@ var v=/Mac|iPhone|iPad|iPod/.test(navigator.platform??"");function u(i){let e=i.
|
|
|
48
48
|
Search index not found.<br>
|
|
49
49
|
Run <code>npm run search:index</code> after building.
|
|
50
50
|
</div>
|
|
51
|
-
`}#p(e){if(this.#r.length===0)return;e<0&&(e=this.#r.length-1),e>=this.#r.length&&(e=0);let t=this.#s.querySelector("[data-active]");t&&t.removeAttribute("data-active"),this.#i?.removeAttribute("aria-activedescendant"),this.#a=e;let s=this.#s.querySelector(`[data-result-index="${e}"]`);s&&(s.setAttribute("data-active",""),this.#i?.setAttribute("aria-activedescendant",s.id),s.scrollIntoView({block:"nearest"}))}#
|
|
51
|
+
`}#p(e){if(this.#r.length===0)return;e<0&&(e=this.#r.length-1),e>=this.#r.length&&(e=0);let t=this.#s.querySelector("[data-active]");t&&t.removeAttribute("data-active"),this.#i?.removeAttribute("aria-activedescendant"),this.#a=e;let s=this.#s.querySelector(`[data-result-index="${e}"]`);s&&(s.setAttribute("data-active",""),this.#i?.setAttribute("aria-activedescendant",s.id),s.scrollIntoView({block:"nearest"}))}#b(e){e.url&&(this.close(),window.location.href=e.url)}#d(){this.#l&&(clearTimeout(this.#l),this.#l=null)}open(){this.#n||(this.#n=!0,this.setAttribute("open",""),this.#e?.setAttribute("aria-expanded","true"),document.body.style.overflow="hidden",requestAnimationFrame(()=>{this.#i?.focus(),this.#i?.select()}),this.#h(),this.dispatchEvent(new CustomEvent("site-search:open",{bubbles:!0})))}close(){this.#n&&(this.#n=!1,this.removeAttribute("open"),this.#e?.setAttribute("aria-expanded","false"),document.body.style.overflow="",this.#d(),this.#i.value="",this.#i?.removeAttribute("aria-activedescendant"),this.#r=[],this.#a=-1,this.#s.innerHTML="",this.#e?.focus(),this.dispatchEvent(new CustomEvent("site-search:close",{bubbles:!0})))}get isOpen(){return this.#n}};y("site-search",c);export{c as SiteSearch};
|
|
52
52
|
//# sourceMappingURL=site-search.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var u=window.matchMedia("(prefers-reduced-motion: reduce)");var d=new Map;function l(n,t,e={}){let s=e.priority??10,r={impl:t,bundle:e.bundle,contract:e.contract,priority:s},i=d.get(n);if(customElements.get(n)){if(!i||i.priority>=s){i&&i.priority===s&&i.impl!==t&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=s){i.priority===s&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${i.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}d.set(n,r),customElements.define(n,t)}var o=class extends HTMLElement{#t=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&this.setAttribute("data-upgraded","")}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,s,r){t.addEventListener(e,s,r),this.#t.push(()=>t.removeEventListener(e,s,r))}setup(){}teardown(){}};var a=class extends o{#t;#n;#s;#o=!1;#i=0;#d=0;#l=0;#r=!1;#c=!1;get activated(){return this.#r}get#u(){let t=this.getAttribute("threshold"),e=Number(t);return t!==null&&!isNaN(e)?Math.min(100,Math.max(0,e)):90}setup(){this.#c||(this.#m(),this.#c=!0),this.listen(this.#t,"pointerdown",this.#b),this.listen(this.#t,"keydown",this.#p),this.listen(this.#t,"transitionend",this.#v)}#m(){this.#s=document.createElement("div"),this.#s.className="slide-track",this.#n=document.createElement("span"),this.#n.className="slide-label",this.#n.textContent=this.getAttribute("label")||"Slide to confirm",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-valuenow","0"),this.#t.setAttribute("aria-label",this.getAttribute("label")||"Slide to confirm"),this.#t.setAttribute("tabindex","0"),this.#t.innerHTML='<icon-wc name="chevrons-right" size="sm"></icon-wc>',this.#s.append(this.#n,this.#t),this.textContent="",this.appendChild(this.#s),this.#e(0)}reset(){this.#r=!1,this.removeAttribute("data-activated"),this.#n.textContent=this.getAttribute("label")||"Slide to confirm",this.#t.removeAttribute("aria-disabled"),this.#t.setAttribute("tabindex","0"),this.#e(0),this.dispatchEvent(new CustomEvent("slide-accept:reset",{bubbles:!0}))}#b=t=>{if(!this.#r){if(t.preventDefault(),this.hasAttribute("transitioning")){let e=this.#t.getBoundingClientRect(),s=this.#s.getBoundingClientRect(),r=parseFloat(getComputedStyle(this.#s).getPropertyValue("--_handle-inset")||"0"),i=this.#t.offsetWidth,h=s.width-i-r*2,c=e.left-s.left-r;this.removeAttribute("transitioning"),this.#i=h>0?Math.max(0,Math.min(100,c/h*100)):0,this.#e(this.#i)}this.#o=!0,this.#d=t.clientX,this.#l=this.#i,this.#t.setPointerCapture(t.pointerId),this.setAttribute("data-dragging",""),this.#t.addEventListener("pointermove",this.#f),this.#t.addEventListener("pointerup",this.#a),this.#t.addEventListener("pointercancel",this.#a)}};#f=t=>{if(!this.#o)return;let e=this.#s.getBoundingClientRect().width-this.#t.offsetWidth;if(e<=0)return;let r=(t.clientX-this.#d)/e*100,i=Math.min(100,Math.max(0,this.#l+r));this.#e(i)};#a=t=>{this.#o&&(this.#o=!1,this.removeAttribute("data-dragging"),this.#t.releasePointerCapture(t.pointerId),this.#t.removeEventListener("pointermove",this.#f),this.#t.removeEventListener("pointerup",this.#a),this.#t.removeEventListener("pointercancel",this.#a),this.#i>=this.#u?this.#h():this.#g())};#p=t=>{if(this.#r)return;let e=t.shiftKey?20:5;t.key==="ArrowRight"?(t.preventDefault(),this.#e(Math.min(100,this.#i+e))):t.key==="ArrowLeft"?(t.preventDefault(),this.#e(Math.max(0,this.#i-e))):t.key==="End"?(t.preventDefault(),this.#h()):t.key==="Home"&&(t.preventDefault(),this.#e(0)),t.key==="ArrowRight"&&this.#i>=this.#u&&this.#h()};#v=()=>{this.removeAttribute("transitioning")};#h(){this.#r=!0,this.#e(100),this.setAttribute("data-activated",""),this.#n.textContent=this.getAttribute("activated-label")||"Confirmed!",this.#t.setAttribute("aria-disabled","true"),this.#t.removeAttribute("tabindex"),this.dispatchEvent(new CustomEvent("slide-accept:accept",{bubbles:!0}))}#g(){this.setAttribute("transitioning",""),this.#e(0),setTimeout(()=>{this.hasAttribute("transitioning")&&this.removeAttribute("transitioning")},500)}#e(t){this.#i=t,this.style.setProperty("--_slide-position",String(t)),this.#t.setAttribute("aria-valuenow",String(Math.round(t)))}};l("slide-accept",a);export{a as SlideAccept};
|
|
1
|
+
var u=window.matchMedia("(prefers-reduced-motion: reduce)");var d=new Map;function l(n,t,e={}){let s=e.priority??10,r={impl:t,bundle:e.bundle,contract:e.contract,priority:s},i=d.get(n);if(customElements.get(n)){if(!i||i.priority>=s){i&&i.priority===s&&i.impl!==t&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=s){i.priority===s&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${i.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}d.set(n,r),customElements.define(n,t)}var o=class extends HTMLElement{#t=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),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,e,s,r){t.addEventListener(e,s,r),this.#t.push(()=>t.removeEventListener(e,s,r))}setup(){}teardown(){}};var a=class extends o{#t;#n;#s;#o=!1;#i=0;#d=0;#l=0;#r=!1;#c=!1;get activated(){return this.#r}get#u(){let t=this.getAttribute("threshold"),e=Number(t);return t!==null&&!isNaN(e)?Math.min(100,Math.max(0,e)):90}setup(){this.#c||(this.#m(),this.#c=!0),this.listen(this.#t,"pointerdown",this.#b),this.listen(this.#t,"keydown",this.#p),this.listen(this.#t,"transitionend",this.#v)}#m(){this.#s=document.createElement("div"),this.#s.className="slide-track",this.#n=document.createElement("span"),this.#n.className="slide-label",this.#n.textContent=this.getAttribute("label")||"Slide to confirm",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-valuenow","0"),this.#t.setAttribute("aria-label",this.getAttribute("label")||"Slide to confirm"),this.#t.setAttribute("tabindex","0"),this.#t.innerHTML='<icon-wc name="chevrons-right" size="sm"></icon-wc>',this.#s.append(this.#n,this.#t),this.textContent="",this.appendChild(this.#s),this.#e(0)}reset(){this.#r=!1,this.removeAttribute("data-activated"),this.#n.textContent=this.getAttribute("label")||"Slide to confirm",this.#t.removeAttribute("aria-disabled"),this.#t.setAttribute("tabindex","0"),this.#e(0),this.dispatchEvent(new CustomEvent("slide-accept:reset",{bubbles:!0}))}#b=t=>{if(!this.#r){if(t.preventDefault(),this.hasAttribute("transitioning")){let e=this.#t.getBoundingClientRect(),s=this.#s.getBoundingClientRect(),r=parseFloat(getComputedStyle(this.#s).getPropertyValue("--_handle-inset")||"0"),i=this.#t.offsetWidth,h=s.width-i-r*2,c=e.left-s.left-r;this.removeAttribute("transitioning"),this.#i=h>0?Math.max(0,Math.min(100,c/h*100)):0,this.#e(this.#i)}this.#o=!0,this.#d=t.clientX,this.#l=this.#i,this.#t.setPointerCapture(t.pointerId),this.setAttribute("data-dragging",""),this.#t.addEventListener("pointermove",this.#f),this.#t.addEventListener("pointerup",this.#a),this.#t.addEventListener("pointercancel",this.#a)}};#f=t=>{if(!this.#o)return;let e=this.#s.getBoundingClientRect().width-this.#t.offsetWidth;if(e<=0)return;let r=(t.clientX-this.#d)/e*100,i=Math.min(100,Math.max(0,this.#l+r));this.#e(i)};#a=t=>{this.#o&&(this.#o=!1,this.removeAttribute("data-dragging"),this.#t.releasePointerCapture(t.pointerId),this.#t.removeEventListener("pointermove",this.#f),this.#t.removeEventListener("pointerup",this.#a),this.#t.removeEventListener("pointercancel",this.#a),this.#i>=this.#u?this.#h():this.#g())};#p=t=>{if(this.#r)return;let e=t.shiftKey?20:5;t.key==="ArrowRight"?(t.preventDefault(),this.#e(Math.min(100,this.#i+e))):t.key==="ArrowLeft"?(t.preventDefault(),this.#e(Math.max(0,this.#i-e))):t.key==="End"?(t.preventDefault(),this.#h()):t.key==="Home"&&(t.preventDefault(),this.#e(0)),t.key==="ArrowRight"&&this.#i>=this.#u&&this.#h()};#v=()=>{this.removeAttribute("transitioning")};#h(){this.#r=!0,this.#e(100),this.setAttribute("data-activated",""),this.#n.textContent=this.getAttribute("activated-label")||"Confirmed!",this.#t.setAttribute("aria-disabled","true"),this.#t.removeAttribute("tabindex"),this.dispatchEvent(new CustomEvent("slide-accept:accept",{bubbles:!0}))}#g(){this.setAttribute("transitioning",""),this.#e(0),setTimeout(()=>{this.hasAttribute("transitioning")&&this.removeAttribute("transitioning")},500)}#e(t){this.#i=t,this.style.setProperty("--_slide-position",String(t)),this.#t.setAttribute("aria-valuenow",String(Math.round(t)))}};l("slide-accept",a);export{a as SlideAccept};
|
|
2
2
|
//# sourceMappingURL=slide-accept.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var b=window.matchMedia("(prefers-reduced-motion: reduce)");var l=new Map;function u(i,t,e={}){let r=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:r},n=l.get(i);if(customElements.get(i)){if(!n||n.priority>=r){n&&n.priority===r&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=r){n.priority===r&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${n.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}l.set(i,s),customElements.define(i,t)}var o=class extends HTMLElement{#e=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&this.setAttribute("data-upgraded","")}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,r,s){t.addEventListener(e,r,s),this.#e.push(()=>t.removeEventListener(e,r,s))}setup(){}teardown(){}};var a=new Map,c=new Map;function E(i){if(c.has(i))return c.get(i);let t=new Promise((e,r)=>{let s=document.createElement("script");s.src=i,s.async=!0,s.onload=()=>e(),s.onerror=()=>r(new Error(`Failed to load script: ${i}`)),document.head.appendChild(s)});return c.set(i,t),t}async function w(i,t,e={}){let r=new URLSearchParams({url:t,format:"json",...e}),s=await fetch(`${i}?${r}`);if(!s.ok)throw new Error(`oEmbed error ${s.status}`);return s.json()}function h(i){return i==="light"?"light":i==="dark"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var f="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0",d=class extends o{static register(t,e){a.set(t,e)}#e=null;#i="";#t=null;setup(){this.#i||(this.#i=this.innerHTML);let t=this.getAttribute("url");if(!t)return console.warn("social-embed: missing required url attribute"),!1;let e=this.getAttribute("provider"),r=e?a.get(e):[...a.values()].find(n=>n.canHandle?.(t));if(!r){this.setAttribute("state","unsupported");return}if(r.delegatesActivation){this.#r(r);return}this.setAttribute("state","idle");let s=this.getAttribute("activate")??"click";s==="eager"?this.#r(r):s==="visible"?(this.#e=new IntersectionObserver(n=>{n[0].isIntersecting&&(this.#e?.disconnect(),this.#r(r))},{rootMargin:"200px"}),this.#e.observe(this)):(this.#t=n=>{n.preventDefault(),this.#r(r)},this.addEventListener("click",this.#t,{once:!0}),this.addEventListener("keydown",this.#n),this.setAttribute("tabindex","0"),this.setAttribute("role","button"),this.setAttribute("aria-label","Load embed"))}teardown(){this.#e?.disconnect(),this.#t&&(this.removeEventListener("click",this.#t),this.#t=null),this.removeEventListener("keydown",this.#n)}#n=t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.click())};async#r(t){this.removeAttribute("tabindex"),this.removeAttribute("role"),this.removeAttribute("aria-label"),this.#t&&(this.removeEventListener("click",this.#t),this.#t=null),this.removeEventListener("keydown",this.#n);let e=this.getAttribute("url");this.setAttribute("state","loading"),this.#s("Loading embed\u2026");try{let r=h(this.getAttribute("theme")??"auto");await t.render(this,e,{theme:r}),this.setAttribute("state","loaded")}catch(r){console.warn("[social-embed] render failed:",r),this.innerHTML=this.#i,this.setAttribute("state","error"),this.#s("Embed failed to load.")}}#s(t){let e=this.querySelector("[data-embed-live]");e||(e=document.createElement("span"),e.setAttribute("data-embed-live",""),e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.setAttribute("style",f),this.prepend(e)),e.textContent=t}};u("social-embed",d);export{a as PROVIDERS,d as SocialEmbed,w as fetchOEmbed,E as loadScript};
|
|
1
|
+
var b=window.matchMedia("(prefers-reduced-motion: reduce)");var l=new Map;function u(i,t,e={}){let r=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:r},n=l.get(i);if(customElements.get(i)){if(!n||n.priority>=r){n&&n.priority===r&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=r){n.priority===r&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${n.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}l.set(i,s),customElements.define(i,t)}var o=class extends HTMLElement{#e=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0})))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,r,s){t.addEventListener(e,r,s),this.#e.push(()=>t.removeEventListener(e,r,s))}setup(){}teardown(){}};var a=new Map,c=new Map;function E(i){if(c.has(i))return c.get(i);let t=new Promise((e,r)=>{let s=document.createElement("script");s.src=i,s.async=!0,s.onload=()=>e(),s.onerror=()=>r(new Error(`Failed to load script: ${i}`)),document.head.appendChild(s)});return c.set(i,t),t}async function w(i,t,e={}){let r=new URLSearchParams({url:t,format:"json",...e}),s=await fetch(`${i}?${r}`);if(!s.ok)throw new Error(`oEmbed error ${s.status}`);return s.json()}function h(i){return i==="light"?"light":i==="dark"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var f="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0",d=class extends o{static register(t,e){a.set(t,e)}#e=null;#i="";#t=null;setup(){this.#i||(this.#i=this.innerHTML);let t=this.getAttribute("url");if(!t)return console.warn("social-embed: missing required url attribute"),!1;let e=this.getAttribute("provider"),r=e?a.get(e):[...a.values()].find(n=>n.canHandle?.(t));if(!r){this.setAttribute("state","unsupported");return}if(r.delegatesActivation){this.#r(r);return}this.setAttribute("state","idle");let s=this.getAttribute("activate")??"click";s==="eager"?this.#r(r):s==="visible"?(this.#e=new IntersectionObserver(n=>{n[0].isIntersecting&&(this.#e?.disconnect(),this.#r(r))},{rootMargin:"200px"}),this.#e.observe(this)):(this.#t=n=>{n.preventDefault(),this.#r(r)},this.addEventListener("click",this.#t,{once:!0}),this.addEventListener("keydown",this.#n),this.setAttribute("tabindex","0"),this.setAttribute("role","button"),this.setAttribute("aria-label","Load embed"))}teardown(){this.#e?.disconnect(),this.#t&&(this.removeEventListener("click",this.#t),this.#t=null),this.removeEventListener("keydown",this.#n)}#n=t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.click())};async#r(t){this.removeAttribute("tabindex"),this.removeAttribute("role"),this.removeAttribute("aria-label"),this.#t&&(this.removeEventListener("click",this.#t),this.#t=null),this.removeEventListener("keydown",this.#n);let e=this.getAttribute("url");this.setAttribute("state","loading"),this.#s("Loading embed\u2026");try{let r=h(this.getAttribute("theme")??"auto");await t.render(this,e,{theme:r}),this.setAttribute("state","loaded")}catch(r){console.warn("[social-embed] render failed:",r),this.innerHTML=this.#i,this.setAttribute("state","error"),this.#s("Embed failed to load.")}}#s(t){let e=this.querySelector("[data-embed-live]");e||(e=document.createElement("span"),e.setAttribute("data-embed-live",""),e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.setAttribute("style",f),this.prepend(e)),e.textContent=t}};u("social-embed",d);export{a as PROVIDERS,d as SocialEmbed,w as fetchOEmbed,E as loadScript};
|
|
2
2
|
//# sourceMappingURL=social-embed.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var p=window.matchMedia("(prefers-reduced-motion: reduce)");var
|
|
1
|
+
var p=window.matchMedia("(prefers-reduced-motion: reduce)");var f=new Map;function h(s,e,t={}){let n=t.priority??10,o={impl:e,bundle:t.bundle,contract:t.contract,priority:n},r=f.get(s);if(customElements.get(s)){if(!r||r.priority>=n){r&&r.priority===n&&r.impl!==e&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> 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 <${s}> already registered by "${r.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}f.set(s,o),customElements.define(s,e)}var u=class extends HTMLElement{#e=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),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))}setup(){}teardown(){}};var m=class extends u{static observedAttributes=["tokens","prefix","show-values","label","editable","target"];setup(){this.#e(),this.#t()}attributeChangedCallback(){this.isConnected&&(this.#e(),this.#t())}#e(){let e=this.getAttribute("tokens")||"3xs,2xs,xs,s,m,l,xl,2xl,3xl",t=this.getAttribute("prefix")||"--size-",n=this.getAttribute("show-values")!=="false",o=this.getAttribute("label")||"",r=this.hasAttribute("editable"),d=e.split(",").map(i=>i.trim()),c="";o&&(c+=`<div style="font-size:0.75rem;font-weight:700;text-transform:uppercase;letter-spacing:0.08em;color:var(--color-text-muted,#666);margin-block-end:0.75rem;font-family:var(--font-sans,system-ui)">${o}</div>`),c+=`<div role="list" aria-label="${o||"Spacing scale"}" style="display:flex;flex-direction:column;gap:0.25rem">`;for(let i of d){let a=`${t}${i}`,l=r?`<input type="text" class="scale-edit" data-token="${i}" aria-label="${i} value" style="font-family:var(--font-mono,monospace);font-size:0.75rem;padding:0.125rem 0.375rem;border:1px solid var(--color-border,#ccc);border-radius:var(--radius-s,0.25rem);background:var(--color-surface,#fff);color:var(--color-text,#222);inline-size:6rem;text-align:end">`:n?'<span class="scale-value" style="font-family:var(--font-mono,monospace);font-size:0.75rem;color:var(--color-text-muted,#666);font-variant-numeric:tabular-nums;min-inline-size:3.5rem;text-align:end"></span>':"";c+=`<div role="listitem" style="display:grid;grid-template-columns:3rem 1fr auto;align-items:center;gap:0.75rem;min-block-size:1.75rem">
|
|
2
2
|
<span style="font-family:var(--font-mono,monospace);font-size:0.875rem;color:var(--color-text-muted,#666);text-align:end">${i}</span>
|
|
3
3
|
<div class="scale-bar" style="display:block;block-size:var(--size-m,1rem);min-inline-size:2px;inline-size:var(${a});background:var(--color-interactive,oklch(55% 0.2 260));border-radius:var(--radius-s,0.25rem)" aria-hidden="true"></div>
|
|
4
4
|
${l}
|
|
5
|
-
</div>`}c+="</div>",this.innerHTML=c,requestAnimationFrame(()=>{if(r){let i=getComputedStyle(this);this.querySelectorAll(".scale-edit").forEach(a=>{let l=a.getAttribute("data-token"),b=i.getPropertyValue(`${t}${l}`).trim();a.value=b||""})}else n&&this.querySelectorAll(".scale-bar").forEach(i=>{let a=i.getBoundingClientRect().width,l=i.nextElementSibling;l&&(l.textContent=`${Math.round(a*100)/100}px`)})})}#t(){if(!this.hasAttribute("editable"))return;let e=this.getAttribute("prefix")||"--size-";this.querySelectorAll(".scale-edit").forEach(t=>{this.listen(t,"change",()=>this.#r(t,e)),this.listen(t,"keydown",n=>{n.key==="Enter"&&this.#r(t,e)})})}#r(e,t){let n=e.getAttribute("data-token"),o=e.value.trim();if(!n||!o)return;let r=this.#n(),d=`${t}${n}`;r&&r.style.setProperty(d,o),this.dispatchEvent(new CustomEvent("spacing-specimen:change",{bubbles:!0,detail:{name:n,value:o,token:d,target:this.getAttribute("target")||":root"}}))}#n(){let e=this.getAttribute("target")||":root";try{return e===":root"?document.documentElement:document.querySelector(e)}catch{return document.documentElement}}};h("spacing-specimen",
|
|
5
|
+
</div>`}c+="</div>",this.innerHTML=c,requestAnimationFrame(()=>{if(r){let i=getComputedStyle(this);this.querySelectorAll(".scale-edit").forEach(a=>{let l=a.getAttribute("data-token"),b=i.getPropertyValue(`${t}${l}`).trim();a.value=b||""})}else n&&this.querySelectorAll(".scale-bar").forEach(i=>{let a=i.getBoundingClientRect().width,l=i.nextElementSibling;l&&(l.textContent=`${Math.round(a*100)/100}px`)})})}#t(){if(!this.hasAttribute("editable"))return;let e=this.getAttribute("prefix")||"--size-";this.querySelectorAll(".scale-edit").forEach(t=>{this.listen(t,"change",()=>this.#r(t,e)),this.listen(t,"keydown",n=>{n.key==="Enter"&&this.#r(t,e)})})}#r(e,t){let n=e.getAttribute("data-token"),o=e.value.trim();if(!n||!o)return;let r=this.#n(),d=`${t}${n}`;r&&r.style.setProperty(d,o),this.dispatchEvent(new CustomEvent("spacing-specimen:change",{bubbles:!0,detail:{name:n,value:o,token:d,target:this.getAttribute("target")||":root"}}))}#n(){let e=this.getAttribute("target")||":root";try{return e===":root"?document.documentElement:document.querySelector(e)}catch{return document.documentElement}}};h("spacing-specimen",m);
|
|
6
6
|
//# sourceMappingURL=spacing-specimen.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var v=window.matchMedia("(prefers-reduced-motion: reduce)");var f=new Map;function p(s,t,e={}){let i=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:i},r=f.get(s);if(customElements.get(s)){if(!r||r.priority>=i){r&&r.priority===i&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=i){r.priority===i&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}f.set(s,n),customElements.define(s,t)}var c=class extends HTMLElement{#t=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&this.setAttribute("data-upgraded","")}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,n){t.addEventListener(e,i,n),this.#t.push(()=>t.removeEventListener(e,i,n))}setup(){}teardown(){}};function w(){let s=globalThis.localStorage;if(!s)throw new Error("VBStore: localStorage is not available in this environment");return{async getRaw(t){return s.getItem(t)},async setRaw(t,e){s.setItem(t,e)},async removeRaw(t){s.removeItem(t)},async keys(t){let e=[];for(let i=0;i<s.length;i++){let n=s.key(i);n&&n.startsWith(t)&&e.push(n)}return e}}}var u=null;function o(){return u||(u=w()),u}function h(s,t){if(typeof s!="string"||!s)throw new TypeError("VBStore: namespace must be a non-empty string");if(typeof t!="string"||!t)throw new TypeError("VBStore: key must be a non-empty string");return`vb:${s}:${t}`}function m(s){if(typeof s!="string"||!s)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${s}:`}function y(s){try{let t=JSON.parse(s);if(t&&typeof t=="object"&&typeof t.timestamp=="number")return t}catch{}return null}var l={configure(s={}){u=s.backend??null},async set(s,t,e){let i={data:e,timestamp:Date.now()};await o().setRaw(h(s,t),JSON.stringify(i))},async get(s,t,e){let i=await o().getRaw(h(s,t));if(i==null)return null;let n=y(i);return!n||e?.maxAge!=null&&Date.now()-n.timestamp>e.maxAge?null:n.data},async remove(s,t){await o().removeRaw(h(s,t))},async list(s){let t=m(s),e=await o().keys(t),i=[];for(let n of e){let r=await o().getRaw(n);if(r==null)continue;let a=y(r);a&&i.push({key:n.slice(t.length),data:a.data,timestamp:a.timestamp})}return i},async clear(s){let t=m(s),e=await o().keys(t);for(let i of e)await o().removeRaw(i)},async clearAll(){let s=await o().keys("vb:");for(let t of s)await o().removeRaw(t)},async setMany(s,t){for(let[e,i]of t)await l.set(s,e,i)}};var d=class extends c{#t;#s;#o;#l=!1;#n=50;#i=!1;#h=50;get#a(){return this.getAttribute("direction")==="vertical"}get#c(){let t=this.getAttribute("min"),e=Number(t);return t!==null&&!isNaN(e)?e:10}get#u(){let t=this.getAttribute("max"),e=Number(t);return t!==null&&!isNaN(e)?e:90}get position(){return this.#n}set position(t){this.#e(Number(t))}get collapsed(){return this.#i}set collapsed(t){t?this.#p():this.#m()}reset(){let t=this.getAttribute("position"),e=Number(t),i=t!==null&&!isNaN(e)?e:50;this.#i=!1,this.#e(i),this.#g()}async setup(){let t=[...this.children].filter(b=>!b.classList.contains("split-divider"));if(t.length<2)return!1;this.#s=t[0],this.#o=t[1];let e=this.getAttribute("position"),i=Number(e),n=e!==null&&!isNaN(i)?i:null,r=await this.#v(),a=n??r??50;this.#t=document.createElement("div"),this.#t.className="split-divider",this.#t.setAttribute("role","separator"),this.#t.setAttribute("aria-orientation",this.#a?"vertical":"horizontal"),this.#t.setAttribute("aria-valuenow",String(Math.round(a))),this.#t.setAttribute("aria-valuemin",String(this.#c)),this.#t.setAttribute("aria-valuemax",String(this.#u)),this.#t.setAttribute("aria-label","Resize panels"),this.#t.setAttribute("tabindex","0"),this.insertBefore(this.#t,this.#o),this.#e(a),this.listen(this.#t,"pointerdown",this.#y),this.listen(this.#t,"keydown",this.#b),this.hasAttribute("collapsible")&&this.listen(this.#t,"dblclick",this.#w)}teardown(){this.#t&&(this.#t.remove(),this.#t=null)}#y=t=>{t.preventDefault(),this.#l=!0,this.#t.setPointerCapture(t.pointerId),this.style.userSelect="none",this.#t.addEventListener("pointermove",this.#d),this.#t.addEventListener("pointerup",this.#f)};#d=t=>{if(!this.#l)return;let e=this.getBoundingClientRect(),i;this.#a?i=(t.clientY-e.top)/e.height*100:i=(t.clientX-e.left)/e.width*100,this.#i&&(this.#i=!1),this.#e(i)};#f=t=>{this.#l=!1,this.#t.releasePointerCapture(t.pointerId),this.style.userSelect="",this.#t.removeEventListener("pointermove",this.#d),this.#t.removeEventListener("pointerup",this.#f),this.#r()};#b=t=>{let e=t.shiftKey?10:1,i=this.#n,n=this.#a?["ArrowUp"]:["ArrowLeft"],r=this.#a?["ArrowDown"]:["ArrowRight"];n.includes(t.key)?(t.preventDefault(),this.#e(i-e),this.#r()):r.includes(t.key)?(t.preventDefault(),this.#e(i+e),this.#r()):t.key==="Home"?(t.preventDefault(),this.#e(this.#c),this.#r()):t.key==="End"&&(t.preventDefault(),this.#e(this.#u),this.#r())};#w=()=>{this.#i?this.#m():this.#p(),this.#r()};#p(){this.#h=this.#n,this.#i=!0,this.#s.style.flexBasis="0%",this.#s.style.overflow="hidden",this.#t.setAttribute("aria-valuenow","0"),this.#n=0,this.dispatchEvent(new CustomEvent("split-surface:collapse",{detail:{collapsed:!0},bubbles:!0}))}#m(){this.#i=!1,this.#s.style.overflow="auto",this.#e(this.#h),this.dispatchEvent(new CustomEvent("split-surface:collapse",{detail:{collapsed:!1},bubbles:!0}))}#e(t){let e=this.#i?0:Math.min(this.#u,Math.max(this.#c,t));this.#n=e,this.#s.style.flexBasis=`${e}%`,this.#s.style.flexGrow="0",this.#s.style.flexShrink="0",this.#s.style.overflow="auto",this.#o.style.flexGrow="1",this.#o.style.overflow="auto",this.#t.setAttribute("aria-valuenow",String(Math.round(e))),this.dispatchEvent(new CustomEvent("split-surface:resize",{detail:{position:e},bubbles:!0}))}async#v(){let t=this.getAttribute("persist");if(!t)return null;let e=await l.get("layout",`split:${t}`);return typeof e=="number"?e:null}#r(){let t=this.getAttribute("persist");t&&l.set("layout",`split:${t}`,Math.round(this.#n)).catch(()=>{})}#g(){let t=this.getAttribute("persist");t&&l.remove("layout",`split:${t}`).catch(()=>{})}};p("split-surface",d);export{d as SplitSurface};
|
|
1
|
+
var v=window.matchMedia("(prefers-reduced-motion: reduce)");var f=new Map;function p(s,t,e={}){let i=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:i},r=f.get(s);if(customElements.get(s)){if(!r||r.priority>=i){r&&r.priority===i&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=i){r.priority===i&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}f.set(s,n),customElements.define(s,t)}var c=class extends HTMLElement{#t=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),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,e,i,n){t.addEventListener(e,i,n),this.#t.push(()=>t.removeEventListener(e,i,n))}setup(){}teardown(){}};function w(){let s=globalThis.localStorage;if(!s)throw new Error("VBStore: localStorage is not available in this environment");return{async getRaw(t){return s.getItem(t)},async setRaw(t,e){s.setItem(t,e)},async removeRaw(t){s.removeItem(t)},async keys(t){let e=[];for(let i=0;i<s.length;i++){let n=s.key(i);n&&n.startsWith(t)&&e.push(n)}return e}}}var u=null;function o(){return u||(u=w()),u}function h(s,t){if(typeof s!="string"||!s)throw new TypeError("VBStore: namespace must be a non-empty string");if(typeof t!="string"||!t)throw new TypeError("VBStore: key must be a non-empty string");return`vb:${s}:${t}`}function m(s){if(typeof s!="string"||!s)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${s}:`}function y(s){try{let t=JSON.parse(s);if(t&&typeof t=="object"&&typeof t.timestamp=="number")return t}catch{}return null}var l={configure(s={}){u=s.backend??null},async set(s,t,e){let i={data:e,timestamp:Date.now()};await o().setRaw(h(s,t),JSON.stringify(i))},async get(s,t,e){let i=await o().getRaw(h(s,t));if(i==null)return null;let n=y(i);return!n||e?.maxAge!=null&&Date.now()-n.timestamp>e.maxAge?null:n.data},async remove(s,t){await o().removeRaw(h(s,t))},async list(s){let t=m(s),e=await o().keys(t),i=[];for(let n of e){let r=await o().getRaw(n);if(r==null)continue;let a=y(r);a&&i.push({key:n.slice(t.length),data:a.data,timestamp:a.timestamp})}return i},async clear(s){let t=m(s),e=await o().keys(t);for(let i of e)await o().removeRaw(i)},async clearAll(){let s=await o().keys("vb:");for(let t of s)await o().removeRaw(t)},async setMany(s,t){for(let[e,i]of t)await l.set(s,e,i)}};var d=class extends c{#t;#s;#o;#l=!1;#n=50;#i=!1;#h=50;get#a(){return this.getAttribute("direction")==="vertical"}get#c(){let t=this.getAttribute("min"),e=Number(t);return t!==null&&!isNaN(e)?e:10}get#u(){let t=this.getAttribute("max"),e=Number(t);return t!==null&&!isNaN(e)?e:90}get position(){return this.#n}set position(t){this.#e(Number(t))}get collapsed(){return this.#i}set collapsed(t){t?this.#p():this.#m()}reset(){let t=this.getAttribute("position"),e=Number(t),i=t!==null&&!isNaN(e)?e:50;this.#i=!1,this.#e(i),this.#g()}async setup(){let t=[...this.children].filter(b=>!b.classList.contains("split-divider"));if(t.length<2)return!1;this.#s=t[0],this.#o=t[1];let e=this.getAttribute("position"),i=Number(e),n=e!==null&&!isNaN(i)?i:null,r=await this.#v(),a=n??r??50;this.#t=document.createElement("div"),this.#t.className="split-divider",this.#t.setAttribute("role","separator"),this.#t.setAttribute("aria-orientation",this.#a?"vertical":"horizontal"),this.#t.setAttribute("aria-valuenow",String(Math.round(a))),this.#t.setAttribute("aria-valuemin",String(this.#c)),this.#t.setAttribute("aria-valuemax",String(this.#u)),this.#t.setAttribute("aria-label","Resize panels"),this.#t.setAttribute("tabindex","0"),this.insertBefore(this.#t,this.#o),this.#e(a),this.listen(this.#t,"pointerdown",this.#y),this.listen(this.#t,"keydown",this.#b),this.hasAttribute("collapsible")&&this.listen(this.#t,"dblclick",this.#w)}teardown(){this.#t&&(this.#t.remove(),this.#t=null)}#y=t=>{t.preventDefault(),this.#l=!0,this.#t.setPointerCapture(t.pointerId),this.style.userSelect="none",this.#t.addEventListener("pointermove",this.#d),this.#t.addEventListener("pointerup",this.#f)};#d=t=>{if(!this.#l)return;let e=this.getBoundingClientRect(),i;this.#a?i=(t.clientY-e.top)/e.height*100:i=(t.clientX-e.left)/e.width*100,this.#i&&(this.#i=!1),this.#e(i)};#f=t=>{this.#l=!1,this.#t.releasePointerCapture(t.pointerId),this.style.userSelect="",this.#t.removeEventListener("pointermove",this.#d),this.#t.removeEventListener("pointerup",this.#f),this.#r()};#b=t=>{let e=t.shiftKey?10:1,i=this.#n,n=this.#a?["ArrowUp"]:["ArrowLeft"],r=this.#a?["ArrowDown"]:["ArrowRight"];n.includes(t.key)?(t.preventDefault(),this.#e(i-e),this.#r()):r.includes(t.key)?(t.preventDefault(),this.#e(i+e),this.#r()):t.key==="Home"?(t.preventDefault(),this.#e(this.#c),this.#r()):t.key==="End"&&(t.preventDefault(),this.#e(this.#u),this.#r())};#w=()=>{this.#i?this.#m():this.#p(),this.#r()};#p(){this.#h=this.#n,this.#i=!0,this.#s.style.flexBasis="0%",this.#s.style.overflow="hidden",this.#t.setAttribute("aria-valuenow","0"),this.#n=0,this.dispatchEvent(new CustomEvent("split-surface:collapse",{detail:{collapsed:!0},bubbles:!0}))}#m(){this.#i=!1,this.#s.style.overflow="auto",this.#e(this.#h),this.dispatchEvent(new CustomEvent("split-surface:collapse",{detail:{collapsed:!1},bubbles:!0}))}#e(t){let e=this.#i?0:Math.min(this.#u,Math.max(this.#c,t));this.#n=e,this.#s.style.flexBasis=`${e}%`,this.#s.style.flexGrow="0",this.#s.style.flexShrink="0",this.#s.style.overflow="auto",this.#o.style.flexGrow="1",this.#o.style.overflow="auto",this.#t.setAttribute("aria-valuenow",String(Math.round(e))),this.dispatchEvent(new CustomEvent("split-surface:resize",{detail:{position:e},bubbles:!0}))}async#v(){let t=this.getAttribute("persist");if(!t)return null;let e=await l.get("layout",`split:${t}`);return typeof e=="number"?e:null}#r(){let t=this.getAttribute("persist");t&&l.set("layout",`split:${t}`,Math.round(this.#n)).catch(()=>{})}#g(){let t=this.getAttribute("persist");t&&l.remove("layout",`split:${t}`).catch(()=>{})}};p("split-surface",d);export{d as SplitSurface};
|
|
2
2
|
//# sourceMappingURL=split-surface.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var E=window.matchMedia("(prefers-reduced-motion: reduce)");var y=new Map;function g(l,e,t={}){let n=t.priority??10,c={impl:e,bundle:t.bundle,contract:t.contract,priority:n},i=y.get(l);if(customElements.get(l)){if(!i||i.priority>=n){i&&i.priority===n&&i.impl!==e&&console.warn(`[VB Bundle] Tag <${l}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${l}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=n){i.priority===n&&console.warn(`[VB Bundle] Tag <${l}> already registered by "${i.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}y.set(l,c),customElements.define(l,e)}var m=class extends HTMLElement{#t=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&this.setAttribute("data-upgraded","")}disconnectedCallback(){for(let e of this.#t)e();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,t,n,c){e.addEventListener(t,n,c),this.#t.push(()=>e.removeEventListener(t,n,c))}setup(){}teardown(){}};var b=class extends m{static formAssociated=!0;#t;#s;#e;constructor(){super(),this.#t=this.attachInternals()}setup(){this.#a()}#a(){if(this.querySelector("fieldset"))return;let e=Number(this.getAttribute("value")||0);this.#s=e;let t=Number(this.getAttribute("max")||5),n=this.getAttribute("label")||"Rating",c=this.hasAttribute("allow-half"),i=this.hasAttribute("readonly"),d=this.getAttribute("icon"),u=`_sr_${this.getAttribute("name")||`star-rating-${crypto.randomUUID().slice(0,8)}`}`;i?this.#c(e,t,n,d):this.#o(e,t,n,u,c,d),this.#i(e),this.#r()}#o(e,t,n,c,i,d){let a=document.createElement("fieldset");a.setAttribute("data-rating",""),i&&a.setAttribute("data-rating-half",""),a.setAttribute("data-effect","rating");let u=document.createElement("legend");if(u.textContent=n,a.appendChild(u),i)for(let r=1;r<=t;r++){let s=r-.5,o=document.createElement("label");o.setAttribute("data-half","left");let h=document.createElement("input");h.type="radio",h.name=c,h.value=String(s),h.setAttribute("aria-label",`${s} ${s===1?"star":"stars"}`),e===s&&(h.checked=!0),o.appendChild(h),o.append(this.#n(d)),a.appendChild(o);let p=document.createElement("label");p.setAttribute("data-half","right");let f=document.createElement("input");f.type="radio",f.name=c,f.value=String(r),f.setAttribute("aria-label",`${r} ${r===1?"star":"stars"}`),e===r&&(f.checked=!0),p.appendChild(f),p.append(this.#n(d)),a.appendChild(p)}else for(let r=1;r<=t;r++){let s=document.createElement("label"),o=document.createElement("input");o.type="radio",o.name=c,o.value=String(r),o.setAttribute("aria-label",`${r} ${r===1?"star":"stars"}`),e===r&&(o.checked=!0),s.appendChild(o),s.append(this.#n(d)),a.appendChild(s)}this.appendChild(a),this.#e=a,a.addEventListener("rating:change",r=>{this.#i(r.detail.value),this.#r()}),a.addEventListener("change",r=>{let s=r.target;s.type==="radio"&&s.checked&&(this.#i(Number(s.value)),this.#r())})}#c(e,t,n,c){let i=document.createElement("fieldset");i.setAttribute("data-rating",""),i.setAttribute("data-rating-readonly",""),i.setAttribute("role","img"),i.setAttribute("aria-label",`${n}: ${e} out of ${t}`);let d=document.createElement("legend");d.textContent=n,i.appendChild(d);let a=Math.floor(e),u=e-a;for(let r=1;r<=t;r++){let s=document.createElement("span");if(s.setAttribute("aria-hidden","true"),r<=a)s.classList.add("star-filled");else if(r===a+1&&u>0){s.classList.add("star-partial"),s.style.setProperty("--_star-fill",`${u*100}%`);let o=document.createElement("span");o.classList.add("star-partial-fill"),o.append(this.#n(c)),s.appendChild(o)}else s.classList.add("star-empty");s.append(this.#n(c)),i.appendChild(s)}this.appendChild(i),this.#e=i}#n(e){if(e){let t=document.createElement("icon-wc");return t.setAttribute("name",e),t}return document.createTextNode("\u2605")}#i(e){let t=Number(e);t>0?this.#t.setFormValue(String(t)):this.#t.setFormValue(null)}#r(){this.hasAttribute("required")?this.#e?.querySelector('input[type="radio"]:checked')?this.#t.setValidity({}):this.#t.setValidity({valueMissing:!0},"Please select a rating",this.#e||this):this.#t.setValidity({})}formResetCallback(){if(this.#e){if(this.#e.querySelectorAll('input[type="radio"]').forEach(e=>{e.checked=!1}),this.#s>0){let e=this.#e.querySelector(`input[value="${this.#s}"]`);e&&(e.checked=!0)}this.#i(this.#s),this.#r()}}formStateRestoreCallback(e){if(!e||!this.#e)return;let t=this.#e.querySelector(`input[value="${e}"]`);t&&(t.checked=!0,this.#i(Number(e)),this.#r())}get value(){if(!this.#e)return Number(this.getAttribute("value")||0);let e=this.#e.querySelector('input[type="radio"]:checked');return e?Number(e.value):0}set value(e){if(!this.#e)return;this.#e.querySelectorAll('input[type="radio"]').forEach(n=>{n.checked=!1});let t=Number(e);if(t>0){let n=this.#e.querySelector(`input[value="${t}"]`);n&&(n.checked=!0)}this.#i(t),this.#r()}};g("star-rating",b);export{b as StarRating};
|
|
1
|
+
var E=window.matchMedia("(prefers-reduced-motion: reduce)");var y=new Map;function g(l,e,t={}){let n=t.priority??10,c={impl:e,bundle:t.bundle,contract:t.contract,priority:n},i=y.get(l);if(customElements.get(l)){if(!i||i.priority>=n){i&&i.priority===n&&i.impl!==e&&console.warn(`[VB Bundle] Tag <${l}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${l}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=n){i.priority===n&&console.warn(`[VB Bundle] Tag <${l}> already registered by "${i.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}y.set(l,c),customElements.define(l,e)}var m=class extends HTMLElement{#t=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),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,c){e.addEventListener(t,n,c),this.#t.push(()=>e.removeEventListener(t,n,c))}setup(){}teardown(){}};var b=class extends m{static formAssociated=!0;#t;#s;#e;constructor(){super(),this.#t=this.attachInternals()}setup(){this.#a()}#a(){if(this.querySelector("fieldset"))return;let e=Number(this.getAttribute("value")||0);this.#s=e;let t=Number(this.getAttribute("max")||5),n=this.getAttribute("label")||"Rating",c=this.hasAttribute("allow-half"),i=this.hasAttribute("readonly"),d=this.getAttribute("icon"),u=`_sr_${this.getAttribute("name")||`star-rating-${crypto.randomUUID().slice(0,8)}`}`;i?this.#c(e,t,n,d):this.#o(e,t,n,u,c,d),this.#i(e),this.#r()}#o(e,t,n,c,i,d){let a=document.createElement("fieldset");a.setAttribute("data-rating",""),i&&a.setAttribute("data-rating-half",""),a.setAttribute("data-effect","rating");let u=document.createElement("legend");if(u.textContent=n,a.appendChild(u),i)for(let r=1;r<=t;r++){let s=r-.5,o=document.createElement("label");o.setAttribute("data-half","left");let h=document.createElement("input");h.type="radio",h.name=c,h.value=String(s),h.setAttribute("aria-label",`${s} ${s===1?"star":"stars"}`),e===s&&(h.checked=!0),o.appendChild(h),o.append(this.#n(d)),a.appendChild(o);let p=document.createElement("label");p.setAttribute("data-half","right");let f=document.createElement("input");f.type="radio",f.name=c,f.value=String(r),f.setAttribute("aria-label",`${r} ${r===1?"star":"stars"}`),e===r&&(f.checked=!0),p.appendChild(f),p.append(this.#n(d)),a.appendChild(p)}else for(let r=1;r<=t;r++){let s=document.createElement("label"),o=document.createElement("input");o.type="radio",o.name=c,o.value=String(r),o.setAttribute("aria-label",`${r} ${r===1?"star":"stars"}`),e===r&&(o.checked=!0),s.appendChild(o),s.append(this.#n(d)),a.appendChild(s)}this.appendChild(a),this.#e=a,a.addEventListener("rating:change",r=>{this.#i(r.detail.value),this.#r()}),a.addEventListener("change",r=>{let s=r.target;s.type==="radio"&&s.checked&&(this.#i(Number(s.value)),this.#r())})}#c(e,t,n,c){let i=document.createElement("fieldset");i.setAttribute("data-rating",""),i.setAttribute("data-rating-readonly",""),i.setAttribute("role","img"),i.setAttribute("aria-label",`${n}: ${e} out of ${t}`);let d=document.createElement("legend");d.textContent=n,i.appendChild(d);let a=Math.floor(e),u=e-a;for(let r=1;r<=t;r++){let s=document.createElement("span");if(s.setAttribute("aria-hidden","true"),r<=a)s.classList.add("star-filled");else if(r===a+1&&u>0){s.classList.add("star-partial"),s.style.setProperty("--_star-fill",`${u*100}%`);let o=document.createElement("span");o.classList.add("star-partial-fill"),o.append(this.#n(c)),s.appendChild(o)}else s.classList.add("star-empty");s.append(this.#n(c)),i.appendChild(s)}this.appendChild(i),this.#e=i}#n(e){if(e){let t=document.createElement("icon-wc");return t.setAttribute("name",e),t}return document.createTextNode("\u2605")}#i(e){let t=Number(e);t>0?this.#t.setFormValue(String(t)):this.#t.setFormValue(null)}#r(){this.hasAttribute("required")?this.#e?.querySelector('input[type="radio"]:checked')?this.#t.setValidity({}):this.#t.setValidity({valueMissing:!0},"Please select a rating",this.#e||this):this.#t.setValidity({})}formResetCallback(){if(this.#e){if(this.#e.querySelectorAll('input[type="radio"]').forEach(e=>{e.checked=!1}),this.#s>0){let e=this.#e.querySelector(`input[value="${this.#s}"]`);e&&(e.checked=!0)}this.#i(this.#s),this.#r()}}formStateRestoreCallback(e){if(!e||!this.#e)return;let t=this.#e.querySelector(`input[value="${e}"]`);t&&(t.checked=!0,this.#i(Number(e)),this.#r())}get value(){if(!this.#e)return Number(this.getAttribute("value")||0);let e=this.#e.querySelector('input[type="radio"]:checked');return e?Number(e.value):0}set value(e){if(!this.#e)return;this.#e.querySelectorAll('input[type="radio"]').forEach(n=>{n.checked=!1});let t=Number(e);if(t>0){let n=this.#e.querySelector(`input[value="${t}"]`);n&&(n.checked=!0)}this.#i(t),this.#r()}};g("star-rating",b);export{b as StarRating};
|
|
2
2
|
//# sourceMappingURL=star-rating.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var v=window.matchMedia("(prefers-reduced-motion: reduce)");var p=new Map;function b(l,i,s={}){let n=s.priority??10,o={impl:i,bundle:s.bundle,contract:s.contract,priority:n},t=p.get(l);if(customElements.get(l)){if(!t||t.priority>=n){t&&t.priority===n&&t.impl!==i&&console.warn(`[VB Bundle] Tag <${l}> already registered by "${t.bundle}" (priority ${t.priority}). Skipping "${s.bundle}".`);return}console.warn(`[VB Bundle] Tag <${l}> defined by "${t.bundle}" cannot be replaced (customElements.define is permanent). "${s.bundle}" has higher priority but arrived late.`);return}if(t&&t.priority>=n){t.priority===n&&console.warn(`[VB Bundle] Tag <${l}> already registered by "${t.bundle}". Skipping "${s.bundle}" (first wins at equal priority).`);return}p.set(l,o),customElements.define(l,i)}var h=class extends HTMLElement{#i=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&this.setAttribute("data-upgraded","")}disconnectedCallback(){for(let i of this.#i)i();this.#i=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(i,s,n,o){i.addEventListener(s,n,o),this.#i.push(()=>i.removeEventListener(s,n,o))}setup(){}teardown(){}};var f=class l extends h{static get observedAttributes(){return["src","compact","title"]}static#i=0;#e=null;#s=null;#r={};#t=null;#c="";#n=[];setup(){this.#c=`sm-${++l.#i}`;let i=[...this.querySelectorAll(":scope > section[data-activity]")];this.#n=i.map(t=>{let e=t.getAttribute("data-activity")||"",c=t.getAttribute("data-activity-label")||""||this.#u(e),d=t.getAttribute("data-journey-phase")||null,a=[...t.children];return{id:e,label:c,journeyPhase:d,children:a}});for(let t of i)t.remove();this.#e=document.createElement("div"),this.#e.className="sm-scroll",this.#e.setAttribute("role","region"),this.#e.setAttribute("aria-label","Story map"),this.#e.setAttribute("tabindex","0"),this.#s=document.createElement("div"),this.#s.className="sm-columns";let s=0;for(let t of this.#n){let e=document.createElement("section");e.className="sm-column",e.setAttribute("data-activity-column",t.id);let r=document.createElement("header");r.className="sm-activity-header";let c=document.createElement("h3");c.textContent=t.label;let d=document.createElement("span");d.className="sm-activity-count",d.textContent=String(t.children.length),c.appendChild(d),r.appendChild(c),e.appendChild(r);let a=document.createElement("drag-surface");if(a.setAttribute("group",this.#c),a.setAttribute("aria-label",`${t.label} stories`),a.setAttribute("data-layout","stack"),a.setAttribute("data-layout-gap","xs"),t.children.length>0){for(let u of t.children)a.appendChild(u);s+=t.children.length}else{let u=document.createElement("p");u.className="sm-empty",u.textContent="No stories yet",a.appendChild(u)}e.appendChild(a),this.#s.appendChild(e),this.#r[t.id]=a}let n=this.getAttribute("title");if(n){let t=document.createElement("h2");t.className="sm-title",t.textContent=n,this.appendChild(t)}this.#e.appendChild(this.#s),this.appendChild(this.#e),this.#t=document.createElement("div"),this.#t.className="sm-live-region",this.#t.setAttribute("role","status"),this.#t.setAttribute("aria-live","polite"),this.#t.setAttribute("aria-atomic","true"),this.appendChild(this.#t),this.listen(this,"drag-surface:reorder",t=>{let e=t.detail,r=t.target.closest("drag-surface"),c=this.#o(r);c&&(this.#a(c),this.dispatchEvent(new CustomEvent("story-map:reorder",{bubbles:!0,detail:{itemId:e.itemId,activity:c,oldIndex:e.oldIndex,newIndex:e.newIndex}})))}),this.listen(this,"drag-surface:transfer",t=>{let e=t.detail,r=e.fromSurface,c=e.toSurface,d=this.#o(r),a=this.#o(c);if(!d||!a)return;this.#a(d),this.#a(a);let u=c.querySelector(".sm-empty");if(u&&u.remove(),r.querySelectorAll(':scope > [draggable="true"]').length===0&&!r.querySelector(".sm-empty")){let m=document.createElement("p");m.className="sm-empty",m.textContent="No stories yet",r.appendChild(m)}let y=this.#d(e.item);this.#l(`${y} moved from ${d} to ${a}`),this.dispatchEvent(new CustomEvent("story-map:transfer",{bubbles:!0,detail:{itemId:e.itemId,fromActivity:d,toActivity:a,newIndex:e.newIndex}}))});let o=this.getAttribute("src");if(o){this._loadSrc(o);return}this.dispatchEvent(new CustomEvent("story-map:ready",{bubbles:!0,detail:{activityCount:this.#n.length,storyCount:s}}))}teardown(){this.#e&&(this.#e.remove(),this.#e=null),this.#t&&(this.#t.remove(),this.#t=null),this.#s=null,this.#r={},this.#n=[]}attributeChangedCallback(i,s,n){s===n||!this.isConnected||i==="src"&&this._loadSrc(n)}async _loadSrc(i){if(i)try{let s=await fetch(i);if(!s.ok)throw new Error(`HTTP ${s.status}`);let n=await s.json();for(;this.firstChild;)this.firstChild.remove();for(let o of n.activities||[]){let t=document.createElement("section");t.setAttribute("data-activity",o.id),t.setAttribute("data-activity-label",o.label||o.id),o.journeyPhase&&t.setAttribute("data-journey-phase",o.journeyPhase);for(let e of o.stories||[]){let r=document.createElement("user-story");r.setAttribute("draggable","true"),r.dataset.id=e.id||e.storyId,(e.storyId||e.id)&&r.setAttribute("story-id",e.storyId||e.id),e.title&&r.setAttribute("title",e.title),e.persona&&r.setAttribute("persona",e.persona),e.action&&r.setAttribute("action",e.action),e.benefit&&r.setAttribute("benefit",e.benefit),e.priority&&r.setAttribute("priority",e.priority),e.status&&r.setAttribute("status",e.status),e.points&&r.setAttribute("points",String(e.points)),r.setAttribute("detail",e.detail||"compact"),t.appendChild(r)}this.appendChild(t)}this.teardown(),this.removeAttribute("data-upgraded"),this.setup()}catch(s){console.warn(`[story-map] Failed to load src="${i}":`,s)}}#o(i){if(!i)return null;for(let[s,n]of Object.entries(this.#r))if(n===i)return s;return null}#a(i){let s=this.#r[i];if(!s)return;let n=s.querySelectorAll(':scope > [draggable="true"]').length,o=s.closest("[data-activity-column]");if(!o)return;let t=o.querySelector(".sm-activity-count");t&&(t.textContent=String(n))}#l(i){this.#t&&(this.#t.textContent="",requestAnimationFrame(()=>{this.#t&&(this.#t.textContent=i)}))}#d(i){return i.getAttribute("story-id")||i.getAttribute("data-id")||i.textContent?.trim().slice(0,40)||"item"}#u(i){return i.replace(/[-_]/g," ").replace(/\b\w/g,s=>s.toUpperCase())}};b("story-map",f);export{f as StoryMap};
|
|
1
|
+
var v=window.matchMedia("(prefers-reduced-motion: reduce)");var p=new Map;function b(l,i,s={}){let n=s.priority??10,o={impl:i,bundle:s.bundle,contract:s.contract,priority:n},t=p.get(l);if(customElements.get(l)){if(!t||t.priority>=n){t&&t.priority===n&&t.impl!==i&&console.warn(`[VB Bundle] Tag <${l}> already registered by "${t.bundle}" (priority ${t.priority}). Skipping "${s.bundle}".`);return}console.warn(`[VB Bundle] Tag <${l}> defined by "${t.bundle}" cannot be replaced (customElements.define is permanent). "${s.bundle}" has higher priority but arrived late.`);return}if(t&&t.priority>=n){t.priority===n&&console.warn(`[VB Bundle] Tag <${l}> already registered by "${t.bundle}". Skipping "${s.bundle}" (first wins at equal priority).`);return}p.set(l,o),customElements.define(l,i)}var h=class extends HTMLElement{#i=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0})))}disconnectedCallback(){for(let i of this.#i)i();this.#i=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(i,s,n,o){i.addEventListener(s,n,o),this.#i.push(()=>i.removeEventListener(s,n,o))}setup(){}teardown(){}};var f=class l extends h{static get observedAttributes(){return["src","compact","title"]}static#i=0;#e=null;#s=null;#r={};#t=null;#c="";#n=[];setup(){this.#c=`sm-${++l.#i}`;let i=[...this.querySelectorAll(":scope > section[data-activity]")];this.#n=i.map(t=>{let e=t.getAttribute("data-activity")||"",c=t.getAttribute("data-activity-label")||""||this.#u(e),d=t.getAttribute("data-journey-phase")||null,a=[...t.children];return{id:e,label:c,journeyPhase:d,children:a}});for(let t of i)t.remove();this.#e=document.createElement("div"),this.#e.className="sm-scroll",this.#e.setAttribute("role","region"),this.#e.setAttribute("aria-label","Story map"),this.#e.setAttribute("tabindex","0"),this.#s=document.createElement("div"),this.#s.className="sm-columns";let s=0;for(let t of this.#n){let e=document.createElement("section");e.className="sm-column",e.setAttribute("data-activity-column",t.id);let r=document.createElement("header");r.className="sm-activity-header";let c=document.createElement("h3");c.textContent=t.label;let d=document.createElement("span");d.className="sm-activity-count",d.textContent=String(t.children.length),c.appendChild(d),r.appendChild(c),e.appendChild(r);let a=document.createElement("drag-surface");if(a.setAttribute("group",this.#c),a.setAttribute("aria-label",`${t.label} stories`),a.setAttribute("data-layout","stack"),a.setAttribute("data-layout-gap","xs"),t.children.length>0){for(let u of t.children)a.appendChild(u);s+=t.children.length}else{let u=document.createElement("p");u.className="sm-empty",u.textContent="No stories yet",a.appendChild(u)}e.appendChild(a),this.#s.appendChild(e),this.#r[t.id]=a}let n=this.getAttribute("title");if(n){let t=document.createElement("h2");t.className="sm-title",t.textContent=n,this.appendChild(t)}this.#e.appendChild(this.#s),this.appendChild(this.#e),this.#t=document.createElement("div"),this.#t.className="sm-live-region",this.#t.setAttribute("role","status"),this.#t.setAttribute("aria-live","polite"),this.#t.setAttribute("aria-atomic","true"),this.appendChild(this.#t),this.listen(this,"drag-surface:reorder",t=>{let e=t.detail,r=t.target.closest("drag-surface"),c=this.#o(r);c&&(this.#a(c),this.dispatchEvent(new CustomEvent("story-map:reorder",{bubbles:!0,detail:{itemId:e.itemId,activity:c,oldIndex:e.oldIndex,newIndex:e.newIndex}})))}),this.listen(this,"drag-surface:transfer",t=>{let e=t.detail,r=e.fromSurface,c=e.toSurface,d=this.#o(r),a=this.#o(c);if(!d||!a)return;this.#a(d),this.#a(a);let u=c.querySelector(".sm-empty");if(u&&u.remove(),r.querySelectorAll(':scope > [draggable="true"]').length===0&&!r.querySelector(".sm-empty")){let m=document.createElement("p");m.className="sm-empty",m.textContent="No stories yet",r.appendChild(m)}let y=this.#d(e.item);this.#l(`${y} moved from ${d} to ${a}`),this.dispatchEvent(new CustomEvent("story-map:transfer",{bubbles:!0,detail:{itemId:e.itemId,fromActivity:d,toActivity:a,newIndex:e.newIndex}}))});let o=this.getAttribute("src");if(o){this._loadSrc(o);return}this.dispatchEvent(new CustomEvent("story-map:ready",{bubbles:!0,detail:{activityCount:this.#n.length,storyCount:s}}))}teardown(){this.#e&&(this.#e.remove(),this.#e=null),this.#t&&(this.#t.remove(),this.#t=null),this.#s=null,this.#r={},this.#n=[]}attributeChangedCallback(i,s,n){s===n||!this.isConnected||i==="src"&&this._loadSrc(n)}async _loadSrc(i){if(i)try{let s=await fetch(i);if(!s.ok)throw new Error(`HTTP ${s.status}`);let n=await s.json();for(;this.firstChild;)this.firstChild.remove();for(let o of n.activities||[]){let t=document.createElement("section");t.setAttribute("data-activity",o.id),t.setAttribute("data-activity-label",o.label||o.id),o.journeyPhase&&t.setAttribute("data-journey-phase",o.journeyPhase);for(let e of o.stories||[]){let r=document.createElement("user-story");r.setAttribute("draggable","true"),r.dataset.id=e.id||e.storyId,(e.storyId||e.id)&&r.setAttribute("story-id",e.storyId||e.id),e.title&&r.setAttribute("title",e.title),e.persona&&r.setAttribute("persona",e.persona),e.action&&r.setAttribute("action",e.action),e.benefit&&r.setAttribute("benefit",e.benefit),e.priority&&r.setAttribute("priority",e.priority),e.status&&r.setAttribute("status",e.status),e.points&&r.setAttribute("points",String(e.points)),r.setAttribute("detail",e.detail||"compact"),t.appendChild(r)}this.appendChild(t)}this.teardown(),this.removeAttribute("data-upgraded"),this.setup()}catch(s){console.warn(`[story-map] Failed to load src="${i}":`,s)}}#o(i){if(!i)return null;for(let[s,n]of Object.entries(this.#r))if(n===i)return s;return null}#a(i){let s=this.#r[i];if(!s)return;let n=s.querySelectorAll(':scope > [draggable="true"]').length,o=s.closest("[data-activity-column]");if(!o)return;let t=o.querySelector(".sm-activity-count");t&&(t.textContent=String(n))}#l(i){this.#t&&(this.#t.textContent="",requestAnimationFrame(()=>{this.#t&&(this.#t.textContent=i)}))}#d(i){return i.getAttribute("story-id")||i.getAttribute("data-id")||i.textContent?.trim().slice(0,40)||"item"}#u(i){return i.replace(/[-_]/g," ").replace(/\b\w/g,s=>s.toUpperCase())}};b("story-map",f);export{f as StoryMap};
|
|
2
2
|
//# sourceMappingURL=story-map.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function l(r){return document.startViewTransition?document.startViewTransition(r):r()}var m=window.matchMedia("(prefers-reduced-motion: reduce)");var u=new Map;function h(r,e,t={}){let s=t.priority??10,n={impl:e,bundle:t.bundle,contract:t.contract,priority:s},i=u.get(r);if(customElements.get(r)){if(!i||i.priority>=s){i&&i.priority===s&&i.impl!==e&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=s){i.priority===s&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${i.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}u.set(r,n),customElements.define(r,e)}var o=class extends HTMLElement{#e=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&this.setAttribute("data-upgraded","")}disconnectedCallback(){for(let e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,t,s,n){e.addEventListener(t,s,n),this.#e.push(()=>e.removeEventListener(t,s,n))}setup(){}teardown(){}};var f=0,c=class extends o{#e=[];#s=[];#n=!1;#t=0;setup(){if(this.#e=[...this.querySelectorAll(":scope > details")],this.#s=this.#e.map(e=>e.querySelector("summary")),this.#e.length===0)return!1;this.#a(),this.#c(),this.#o()}teardown(){this.#e=[],this.#s=[],this.#n=!1}#o(){if(!this.hasAttribute("transition")||!document.startViewTransition)return;this.#n=!0;let e=++f,t=this.getAttribute("transition")||"fade",s=t==="slide"?"vt-tabs-slide":t==="scale"?"vt-tabs-scale":"vt-tabs";this.#e.forEach(n=>{let i=n.querySelector(":scope > :not(summary)");i&&(i.style.viewTransitionName=`tabs-${e}`,i.style.viewTransitionClass=s)}),this.#t=this.#e.findIndex(n=>n.open),this.#t===-1&&(this.#t=0)}#i(e){if(e===this.#t)return;let t=e>this.#t?"forward":"backward";document.documentElement.dataset.vtDirection=t,l(()=>{this.#e[e].open=!0}).finished?.then(()=>{delete document.documentElement.dataset.vtDirection})}#a(){this.#e.forEach((e,t)=>{let s=this.#s[t],n=e.querySelector(":scope > :not(summary)");if(!s||!n)return;let i=s.id||`tab-${crypto.randomUUID().slice(0,8)}`,d=n.id||`panel-${crypto.randomUUID().slice(0,8)}`;s.id=i,s.setAttribute("aria-controls",d),s.setAttribute("tabindex",e.open?"0":"-1"),s.setAttribute("aria-selected",e.open?"true":"false"),n.id=d,n.setAttribute("aria-labelledby",i),this.listen(s,"click",a=>{this.#n&&(a.preventDefault(),this.#i(t))}),this.listen(s,"keydown",a=>this.#l(a,t)),this.listen(e,"toggle",()=>this.#d(t))})}#c(){!this.#e.some(t=>t.open)&&this.#e.length>0&&(this.#e[0].open=!0,this.#r())}#d(e){this.#e[e].open&&(this.#t=e),this.#r(),this.dispatchEvent(new CustomEvent("tab-set:change",{detail:{index:e},bubbles:!0}))}#r(){this.#e.forEach((e,t)=>{let s=this.#s[t];s.setAttribute("tabindex",e.open?"0":"-1"),s.setAttribute("aria-selected",e.open?"true":"false")})}#l(e,t){let{key:s}=e,n;switch(s){case"ArrowRight":n=(t+1)%this.#e.length;break;case"ArrowLeft":n=(t-1+this.#e.length)%this.#e.length;break;case"Home":n=0;break;case"End":n=this.#e.length-1;break;default:return}e.preventDefault(),this.#n?this.#i(n):this.#e[n].open=!0,this.#s[n].focus()}};h("tab-set",c);export{c as TabSet};
|
|
1
|
+
function l(r){return document.startViewTransition?document.startViewTransition(r):r()}var m=window.matchMedia("(prefers-reduced-motion: reduce)");var u=new Map;function h(r,e,t={}){let s=t.priority??10,n={impl:e,bundle:t.bundle,contract:t.contract,priority:s},i=u.get(r);if(customElements.get(r)){if(!i||i.priority>=s){i&&i.priority===s&&i.impl!==e&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=s){i.priority===s&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${i.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}u.set(r,n),customElements.define(r,e)}var o=class extends HTMLElement{#e=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),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,s,n){e.addEventListener(t,s,n),this.#e.push(()=>e.removeEventListener(t,s,n))}setup(){}teardown(){}};var f=0,c=class extends o{#e=[];#s=[];#n=!1;#t=0;setup(){if(this.#e=[...this.querySelectorAll(":scope > details")],this.#s=this.#e.map(e=>e.querySelector("summary")),this.#e.length===0)return!1;this.#a(),this.#c(),this.#o()}teardown(){this.#e=[],this.#s=[],this.#n=!1}#o(){if(!this.hasAttribute("transition")||!document.startViewTransition)return;this.#n=!0;let e=++f,t=this.getAttribute("transition")||"fade",s=t==="slide"?"vt-tabs-slide":t==="scale"?"vt-tabs-scale":"vt-tabs";this.#e.forEach(n=>{let i=n.querySelector(":scope > :not(summary)");i&&(i.style.viewTransitionName=`tabs-${e}`,i.style.viewTransitionClass=s)}),this.#t=this.#e.findIndex(n=>n.open),this.#t===-1&&(this.#t=0)}#i(e){if(e===this.#t)return;let t=e>this.#t?"forward":"backward";document.documentElement.dataset.vtDirection=t,l(()=>{this.#e[e].open=!0}).finished?.then(()=>{delete document.documentElement.dataset.vtDirection})}#a(){this.#e.forEach((e,t)=>{let s=this.#s[t],n=e.querySelector(":scope > :not(summary)");if(!s||!n)return;let i=s.id||`tab-${crypto.randomUUID().slice(0,8)}`,d=n.id||`panel-${crypto.randomUUID().slice(0,8)}`;s.id=i,s.setAttribute("aria-controls",d),s.setAttribute("tabindex",e.open?"0":"-1"),s.setAttribute("aria-selected",e.open?"true":"false"),n.id=d,n.setAttribute("aria-labelledby",i),this.listen(s,"click",a=>{this.#n&&(a.preventDefault(),this.#i(t))}),this.listen(s,"keydown",a=>this.#l(a,t)),this.listen(e,"toggle",()=>this.#d(t))})}#c(){!this.#e.some(t=>t.open)&&this.#e.length>0&&(this.#e[0].open=!0,this.#r())}#d(e){this.#e[e].open&&(this.#t=e),this.#r(),this.dispatchEvent(new CustomEvent("tab-set:change",{detail:{index:e},bubbles:!0}))}#r(){this.#e.forEach((e,t)=>{let s=this.#s[t];s.setAttribute("tabindex",e.open?"0":"-1"),s.setAttribute("aria-selected",e.open?"true":"false")})}#l(e,t){let{key:s}=e,n;switch(s){case"ArrowRight":n=(t+1)%this.#e.length;break;case"ArrowLeft":n=(t-1+this.#e.length)%this.#e.length;break;case"Home":n=0;break;case"End":n=this.#e.length-1;break;default:return}e.preventDefault(),this.#n?this.#i(n):this.#e[n].open=!0,this.#s[n].focus()}};h("tab-set",c);export{c as TabSet};
|
|
2
2
|
//# sourceMappingURL=tab-set.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
1
|
+
var b=window.matchMedia("(prefers-reduced-motion: reduce)");var f=new Map;function g(c,t,s={}){let e=s.priority??10,i={impl:t,bundle:s.bundle,contract:s.contract,priority:e},r=f.get(c);if(customElements.get(c)){if(!r||r.priority>=e){r&&r.priority===e&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${c}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${s.bundle}".`);return}console.warn(`[VB Bundle] Tag <${c}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${s.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=e){r.priority===e&&console.warn(`[VB Bundle] Tag <${c}> already registered by "${r.bundle}". Skipping "${s.bundle}" (first wins at equal priority).`);return}f.set(c,i),customElements.define(c,t)}var u=class extends HTMLElement{#h=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0})))}disconnectedCallback(){for(let t of this.#h)t();this.#h=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,s,e,i){t.addEventListener(s,e,i),this.#h.push(()=>t.removeEventListener(s,e,i))}setup(){}teardown(){}};var p=class extends u{#h=null;#k=null;#f=[];#r="";#u=0;#g=null;#v=null;#C=null;#E=null;#s=!1;#i=!1;#L=0;#e=null;#a=null;#l=null;#b=null;#m=null;#y=null;#H=null;#$=!1;#n=null;#t=null;static get observedAttributes(){return["speed","voice","for"]}attributeChangedCallback(t,s,e){if(s!==e&&(t==="for"&&(this.stop(),this.#B()),(t==="speed"||t==="voice")&&this.#s&&this.#A(),t==="speed")){let i=this.#p(parseFloat(e)||1);this.#m&&(this.#m.value=String(i)),this.#y&&(this.#y.textContent=`${i}\xD7`)}}setup(){if(!("speechSynthesis"in window))return this.style.display="none",!1;this.getAttribute("variant")==="icon"?this.#O():this.#D(),this.#B(),this.#J(),this.#E=this.#N(),this.#E.then(t=>this.#tt(t)),this.listen(window,"beforeunload",this.#et)}teardown(){this.stop(),this.#Q(),this.#t&&(this.#t.remove(),this.#t=null),this.#n&&(this.#n.remove(),this.#n=null)}play(){if(this.#i){this.resume();return}this.#s||this.#V(0)}pause(){!this.#s||this.#i||(speechSynthesis.pause(),this.#i=!0,this.#q(!0),this.#c("text-reader:pause"))}resume(){this.#i&&(speechSynthesis.resume(),this.#i=!1,this.#q(!1),this.#c("text-reader:resume"))}stop(){speechSynthesis.cancel(),this.#x(),this.#c("text-reader:stop")}get voices(){return this.#E||this.#N()}get speaking(){return this.#s}get paused(){return this.#i}get progress(){return this.#r.length?Math.min(this.#u/this.#r.length,1):0}#D(){let t=document.createElement("div");t.setAttribute("part","controls"),t.setAttribute("role","group"),t.setAttribute("aria-label","Article reader");let s=this.#o("play",this.getAttribute("label-play")||"Play","\u25B6");s.addEventListener("click",()=>this.play());let e=this.#o("pause",this.getAttribute("label-pause")||"Pause","\u23F8");e.hidden=!0,e.addEventListener("click",()=>this.pause());let i=this.#o("stop",this.getAttribute("label-stop")||"Stop","\u23F9");i.disabled=!0,i.addEventListener("click",()=>this.stop());let r=document.createElement("select");r.setAttribute("aria-label","Voice");let n=document.createElement("option");n.textContent="Loading voices\u2026",r.append(n),r.addEventListener("change",()=>{this.#s&&this.#A()});let h=document.createElement("label");h.setAttribute("data-speed-group","");let o=document.createElement("span");o.setAttribute("data-speed-value","");let l=this.#p(parseFloat(this.getAttribute("speed")??"1")||1);o.textContent=`${l}\xD7`;let a=document.createElement("input");a.type="range",a.min="0.5",a.max="2",a.step="0.1",a.value=String(l),a.setAttribute("aria-label","Speed"),a.addEventListener("input",()=>{let d=parseFloat(a.value);o.textContent=`${d}\xD7`,this.#s&&this.#A()}),h.append(o,a),this.#d("icon-play",s),this.#d("icon-pause",e),this.#d("icon-stop",i),t.append(s,e,i,r,h),this.prepend(t),this.#H=t,this.#e=s,this.#a=e,this.#l=i,this.#b=r,this.#m=a,this.#y=o}#o(t,s,e){let i=document.createElement("button");return i.type="button",i.setAttribute("part",`button ${t}`),i.setAttribute("aria-label",s),i.textContent=e,i}#d(t,s){let e=this.querySelector(`[slot="${t}"]`);e&&(e.removeAttribute("slot"),s.textContent="",s.append(e))}#O(){this.#$=!0;for(let e of this.querySelectorAll(':scope > [part="trigger"]'))e.remove();let t=document.createElement("button");t.type="button",t.setAttribute("part","trigger"),t.setAttribute("aria-label","Article reader"),t.setAttribute("aria-pressed","false");let s=this.querySelector('[slot="icon-trigger"]');if(s)s.removeAttribute("slot"),t.append(s);else{let e=document.createElement("icon-wc");e.setAttribute("name","volume-2"),e.setAttribute("aria-hidden","true"),t.append(e)}t.addEventListener("click",()=>this.#W()),this.append(t),this.#n=t,this.#R()}#R(){let t=document.createElement("div");t.setAttribute("data-text-reader-toolbar",""),t.setAttribute("role","group"),t.setAttribute("aria-label","Reader controls"),t.hidden=!0;let s=this.#o("play",this.getAttribute("label-play")||"Play","\u25B6");s.addEventListener("click",()=>this.play());let e=this.#o("pause",this.getAttribute("label-pause")||"Pause","\u23F8");e.hidden=!0,e.addEventListener("click",()=>this.pause());let i=this.#o("stop",this.getAttribute("label-stop")||"Stop","\u23F9");i.addEventListener("click",()=>this.stop());let r=this.#o("speed-down","Slower","\u2212");r.addEventListener("click",()=>this.#T(-.1));let n=document.createElement("span");n.setAttribute("data-speed-value","");let h=this.#p(parseFloat(this.getAttribute("speed")??"1")||1);n.textContent=`${h}\xD7`;let o=this.#o("speed-up","Faster","+");o.addEventListener("click",()=>this.#T(.1)),this.#d("icon-play",s),this.#d("icon-pause",e),this.#d("icon-stop",i),t.append(s,e,i,r,n,o),document.body.append(t),this.#e=s,this.#a=e,this.#l=i,this.#y=n,this.#t=t,this.listen(document,"pointerdown",this.#_),this.listen(document,"keydown",this.#G)}#W(){if(!this.#s){this.play();return}this.#t?.hidden&&this.#M(),this.#i?this.resume():this.pause()}#M(){if(!this.#t||!this.#n)return;let t=this.#t;t.hidden=!1,t.style.visibility="hidden",requestAnimationFrame(()=>{this.#j(),t.style.visibility=""})}#w(){this.#t&&(this.#t.hidden=!0)}#j(){let t=this.#t,s=this.#n;if(!t||!s)return;let e=s.getBoundingClientRect(),i=t.offsetWidth,r=t.offsetHeight,n=8,h=8,o=e.top-r-n;o<h&&(o=e.bottom+n);let l=e.left+e.width/2-i/2,a=window.innerWidth-i-h;l=Math.max(h,Math.min(l,a)),t.style.top=`${o}px`,t.style.left=`${l}px`}#T(t){let s=parseFloat(this.getAttribute("speed")??"1")||1,e=this.#p(s+t);this.setAttribute("speed",String(e))}#_=t=>{!this.#t||this.#t.hidden||this.#t.contains(t.target)||this.#n?.contains(t.target)||this.#w()};#G=t=>{t.key==="Escape"&&this.#t&&!this.#t.hidden&&this.#w()};#B(){let t=this.getAttribute("for");if(!t){console.warn('<text-reader>: missing "for" attribute'),this.#F();return}if(this.#h=document.getElementById(t),!this.#h){console.warn(`<text-reader>: no element found with id="${t}"`),this.#F();return}this.#X(),this.#K()}#F(){this.#e&&(this.#e.disabled=!0),this.#l&&(this.#l.disabled=!0)}#K(){this.#e&&(this.#e.disabled=!1)}#X(){let t=this.#h;if(!t)return;let s=this.getAttribute("selectors")||"p,li",e=[...t.querySelectorAll(s)],i=n=>n.closest("pre")||n.closest("code")||n.closest('[aria-hidden="true"]');this.#f=[];let r=0;for(let n of e){if(i(n))continue;let h=n.textContent.trim();h&&(this.#f.push({element:n,text:h,speechStart:r,speechEnd:r+h.length}),r+=h.length+1)}this.#r=this.#f.map(n=>n.text).join(" ")}#V(t){if(!this.#r)return;let s=t>0?this.#r.slice(t):this.#r;if(!s.trim())return;let e=s.replace(/[<>]/g," "),i=new SpeechSynthesisUtterance(e);i.rate=this.#p(parseFloat(this.#m?.value??this.getAttribute("speed")??"1")||1);let r=this.#b?.selectedOptions[0];if(r?.dataset.voiceUri){let n=speechSynthesis.getVoices().find(h=>h.voiceURI===r.dataset.voiceUri);n&&(i.voice=n)}i.onboundary=n=>{if(n.name!=="word")return;let h=t+n.charIndex;this.#u=h;let o=n.charLength;if(!o){let a=this.#r.slice(h).match(/^\S+/);o=a?a[0].length:1}this.#Y(h,o),this.#c("text-reader:word",{word:this.#r.slice(h,h+o),charIndex:h,element:this.#P(h)?.element})},i.onend=()=>{let n=Date.now()-this.#L;this.#x(),this.#c("text-reader:end",{duration:n})},i.onerror=n=>{n.error==="interrupted"||n.error==="canceled"||(console.warn("<text-reader>: SpeechSynthesisUtterance error:",n.error),this.#x(),this.#c("text-reader:error",{error:n.error}))},this.#k=i,this.#s=!0,this.#i=!1,this.#L=Date.now(),this.#u=t,this.#U(!0),speechSynthesis.cancel(),speechSynthesis.speak(i),this.#z(),this.#c("text-reader:play",{voice:i.voice?.name,speed:i.rate})}#A(){let t=this.#u;speechSynthesis.cancel(),this.#S(),requestAnimationFrame(()=>this.#V(t))}#z(){this.#S(),this.#g=setInterval(()=>{if(!speechSynthesis.speaking){this.#S();return}speechSynthesis.pause(),speechSynthesis.resume()},1e4)}#S(){this.#g&&clearInterval(this.#g),this.#g=null}#J(){if(!CSS.highlights)return;let t=new CSSStyleSheet;t.replaceSync(`
|
|
2
2
|
::highlight(text-reader-word) {
|
|
3
3
|
background-color: var(--text-reader-highlight, Mark);
|
|
4
4
|
color: var(--text-reader-highlight-text, MarkText);
|
|
5
5
|
}
|
|
6
|
-
`),this.#v=t,document.adoptedStyleSheets=[...document.adoptedStyleSheets,t]}#Q(){let t=this.#v;t&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(s=>s!==t),this.#v=null),this.#I()}#Y(t,s){if(!CSS.highlights||this.getAttribute("highlight")==="false")return;let e=this.#P(t);if(!e)return;let i=t-e.speechStart,r=this.#Z(e.element,i,s);if(!r)return;let n=new Highlight(r);if(CSS.highlights.set("text-reader-word",n),this.#C=n,this.getAttribute("scroll")!=="false"){let h=r.getBoundingClientRect(),o=window.innerHeight;(h.top<0||h.bottom>o)&&e.element.scrollIntoView({behavior:"smooth",block:"nearest"})}}#I(){CSS.highlights&&CSS.highlights.delete("text-reader-word"),this.#C=null}#P(t){let s=this.#f,e=0,i=s.length-1;for(;e<=i;){let r=e+i>>>1,n=s[r];if(t<n.speechStart)i=r-1;else if(t>=n.speechEnd)e=r+1;else return n}return null}#Z(t,s,e){let i=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),r=0;for(;i.nextNode();){let n=i.currentNode,h=n.textContent??"";if(!h.trim())continue;let o=h.length;if(r+o>s){let l=s-r,a=document.createRange();a.setStart(n,Math.min(l,o));let d=l+e;return d<=o?a.setEnd(n,d):a.setEnd(n,o),a}r+=o}return null}async#
|
|
6
|
+
`),this.#v=t,document.adoptedStyleSheets=[...document.adoptedStyleSheets,t]}#Q(){let t=this.#v;t&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(s=>s!==t),this.#v=null),this.#I()}#Y(t,s){if(!CSS.highlights||this.getAttribute("highlight")==="false")return;let e=this.#P(t);if(!e)return;let i=t-e.speechStart,r=this.#Z(e.element,i,s);if(!r)return;let n=new Highlight(r);if(CSS.highlights.set("text-reader-word",n),this.#C=n,this.getAttribute("scroll")!=="false"){let h=r.getBoundingClientRect(),o=window.innerHeight;(h.top<0||h.bottom>o)&&e.element.scrollIntoView({behavior:"smooth",block:"nearest"})}}#I(){CSS.highlights&&CSS.highlights.delete("text-reader-word"),this.#C=null}#P(t){let s=this.#f,e=0,i=s.length-1;for(;e<=i;){let r=e+i>>>1,n=s[r];if(t<n.speechStart)i=r-1;else if(t>=n.speechEnd)e=r+1;else return n}return null}#Z(t,s,e){let i=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),r=0;for(;i.nextNode();){let n=i.currentNode,h=n.textContent??"";if(!h.trim())continue;let o=h.length;if(r+o>s){let l=s-r,a=document.createRange();a.setStart(n,Math.min(l,o));let d=l+e;return d<=o?a.setEnd(n,d):a.setEnd(n,o),a}r+=o}return null}async#N(){let t=speechSynthesis.getVoices();return t.length>0?t:new Promise(s=>{let e=()=>{speechSynthesis.removeEventListener("voiceschanged",e),s(speechSynthesis.getVoices())};speechSynthesis.addEventListener("voiceschanged",e),setTimeout(()=>{speechSynthesis.removeEventListener("voiceschanged",e),s(speechSynthesis.getVoices())},3e3)})}#tt(t){if(!this.#b||!t.length)return;let s=this.#b;s.innerHTML="";let e=document.documentElement.lang||"en",i=t.filter(o=>o.lang.startsWith(e)),r=t.filter(o=>!o.lang.startsWith(e)),n=[...i,...r],h=this.getAttribute("voice");for(let o of n){let l=document.createElement("option");l.textContent=`${o.name} (${o.lang})`,l.dataset.voiceUri=o.voiceURI,h&&o.voiceURI===h&&(l.selected=!0),s.append(l)}if(!h){let o=i.find(l=>l.default)||i[0];if(o){let l=[...s.options].find(a=>a.dataset.voiceUri===o.voiceURI);l&&(l.selected=!0)}}}#U(t){!this.#e||!this.#a||!this.#l||(t?(this.#e.hidden=!0,this.#a.hidden=!1,this.#l.disabled=!1):(this.#e.hidden=!1,this.#a.hidden=!0,this.#l.disabled=!0),this.#$&&(this.#n&&this.#n.setAttribute("aria-pressed",String(t)),t?this.#M():this.#w()))}#q(t){!this.#e||!this.#a||(this.#e.hidden=!t,this.#a.hidden=t)}#x(){this.#s=!1,this.#i=!1,this.#u=0,this.#k=null,this.#S(),this.#I(),this.#U(!1)}#p(t){return Math.round(Math.max(.5,Math.min(2,t))*10)/10}#c(t,s={}){this.dispatchEvent(new CustomEvent(t,{detail:s,bubbles:!0}))}#et=()=>{speechSynthesis.cancel()}};g("text-reader",p);export{p as TextReader};
|
|
7
7
|
//# sourceMappingURL=text-reader.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var b=window.matchMedia("(prefers-reduced-motion: reduce)");var u=new Map;function d(i,e,t={}){let r=t.priority??10,n={impl:e,bundle:t.bundle,contract:t.contract,priority:r},o=u.get(i);if(customElements.get(i)){if(!o||o.priority>=r){o&&o.priority===r&&o.impl!==e&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${o.bundle}" (priority ${o.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${o.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(o&&o.priority>=r){o.priority===r&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${o.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}u.set(i,n),customElements.define(i,e)}var c=class extends HTMLElement{#e=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),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,r,n){e.addEventListener(t,r,n),this.#e.push(()=>e.removeEventListener(t,r,n))}setup(){}teardown(){}};var h="--color-,--hue-,--lightness-,--chroma-,--font-,--size-,--radius-,--shadow-,--border-width-,--ease-,--duration-",m=["type-specimen:change","spacing-specimen:change","token-specimen:change","semantic-palette:change"],a=class extends c{static observedAttributes=["scope","selector","include","format","label","live"];setup(){this.#o(),this.#t(),this.#r(),this.#n()}attributeChangedCallback(){this.isConnected&&this.hasAttribute("data-upgraded")&&(this.#o(),this.#t(),this.#r(),this.#n())}#e(){let e=this.getAttribute("scope")||":root";try{return e===":root"?document.documentElement:document.querySelector(e)}catch{return document.documentElement}}#s(){return(this.getAttribute("include")||h).split(",").map(t=>t.trim()).filter(Boolean)}#i(){let e=this.#e();if(!e)return[];let t=this.#s(),r=e.style,n=[];for(let o=0;o<r.length;o++){let s=r.item(o);if(!s.startsWith("--")||!t.some(f=>s.startsWith(f)))continue;let l=r.getPropertyValue(s).trim();l&&n.push([s,l])}return n}#c(e){if((this.getAttribute("format")||"css")==="json"){let o=Object.fromEntries(e);return JSON.stringify(o,null,2)}let r=this.getAttribute("selector")||":root";if(!e.length)return`${r} {
|
|
2
2
|
/* No theme overrides detected yet. Edit a specimen to populate. */
|
|
3
3
|
}
|
|
4
4
|
`;let n=e.map(([o,s])=>` ${o}: ${s};`).join(`
|