vanilla-breeze 0.5.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +23071 -13897
- package/dist/cdn/components/accordion-wc.js +1 -1
- package/dist/cdn/components/activity-feed.js +1 -1
- package/dist/cdn/components/ai-chat.js +5 -5
- package/dist/cdn/components/ai-summary.js +2 -2
- package/dist/cdn/components/analytics-panel.js +2 -2
- package/dist/cdn/components/audio-player.js +4 -4
- package/dist/cdn/components/audio-visualizer.js +2 -2
- package/dist/cdn/components/author-index.js +2 -2
- package/dist/cdn/components/brand-mark.js +1 -1
- package/dist/cdn/components/bread-crumb.js +1 -1
- package/dist/cdn/components/calendar-wc.js +2 -2
- package/dist/cdn/components/card-list.js +1 -1
- package/dist/cdn/components/carousel-wc.js +1 -1
- package/dist/cdn/components/change-set.js +1 -1
- package/dist/cdn/components/chart-wc.js +56 -32
- package/dist/cdn/components/chat-input.js +1 -1
- package/dist/cdn/components/chat-window.js +1 -1
- package/dist/cdn/components/color-picker.js +1 -1
- package/dist/cdn/components/combo-box.js +1 -1
- package/dist/cdn/components/command-palette.js +1 -1
- package/dist/cdn/components/comment-box.js +51 -50
- package/dist/cdn/components/comment-thread.js +50 -49
- package/dist/cdn/components/comment-wc.js +1 -1
- package/dist/cdn/components/compare-surface.js +1 -1
- package/dist/cdn/components/consent-banner.js +1 -1
- package/dist/cdn/components/content-lens.js +1 -1
- package/dist/cdn/components/content-swap.js +1 -1
- package/dist/cdn/components/context-menu.js +1 -1
- package/dist/cdn/components/data-table.js +1 -1
- package/dist/cdn/components/date-picker.js +1 -1
- package/dist/cdn/components/day-view.js +1 -1
- package/dist/cdn/components/diagram-wc.js +2 -2
- package/dist/cdn/components/drag-surface.js +1 -1
- package/dist/cdn/components/drop-down.js +1 -1
- package/dist/cdn/components/emoji-picker.js +1 -1
- package/dist/cdn/components/flow-diagram.js +1 -1
- package/dist/cdn/components/foot-notes.js +1 -1
- package/dist/cdn/components/form-field.js +1 -1
- package/dist/cdn/components/geo-map.js +170 -54
- package/dist/cdn/components/glossary-index.js +1 -1
- package/dist/cdn/components/glossary-wc.js +1 -1
- package/dist/cdn/components/heading-links.js +1 -1
- package/dist/cdn/components/highlight-wc.js +6 -2
- package/dist/cdn/components/icon-wc.js +11 -10
- package/dist/cdn/components/image-gallery.js +1 -1
- package/dist/cdn/components/image-map.js +1 -1
- package/dist/cdn/components/include-file.js +1 -1
- package/dist/cdn/components/manifest.json +101 -101
- package/dist/cdn/components/markdown-editor.js +60 -1
- package/dist/cdn/components/markdown-viewer.js +50 -49
- package/dist/cdn/components/nav-bar.js +1 -1
- package/dist/cdn/components/note-wc.js +6 -2
- package/dist/cdn/components/notification-wc.js +33 -32
- package/dist/cdn/components/page-info.js +6 -72
- package/dist/cdn/components/page-stats.js +1 -1
- package/dist/cdn/components/page-toc.js +1 -1
- package/dist/cdn/components/page-tools.js +1 -1
- package/dist/cdn/components/page-tour.js +1 -38
- package/dist/cdn/components/pager-wc.js +1 -1
- package/dist/cdn/components/poll-wc.js +1 -1
- package/dist/cdn/components/pop-over.js +1 -1
- package/dist/cdn/components/popularity-index.js +1 -8
- package/dist/cdn/components/print-page.js +1 -1
- package/dist/cdn/components/progress-tracker.js +1 -1
- package/dist/cdn/components/qr-code.js +1 -1
- package/dist/cdn/components/reaction-bar.js +1 -1
- package/dist/cdn/components/reader-view.js +25 -25
- package/dist/cdn/components/reading-progress.js +1 -1
- package/dist/cdn/components/recently-visited.js +1 -26
- package/dist/cdn/components/score-card.js +21 -5
- package/dist/cdn/components/selection-menu.js +1 -1
- package/dist/cdn/components/settings-panel.js +88 -142
- package/dist/cdn/components/share-wc.js +2 -2
- package/dist/cdn/components/short-cuts.js +1 -1
- package/dist/cdn/components/site-index.js +1 -10
- package/dist/cdn/components/site-map.js +1 -1
- package/dist/cdn/components/site-search.js +1 -51
- package/dist/cdn/components/slide-accept.js +1 -1
- package/dist/cdn/components/social-embed.js +1 -1
- package/dist/cdn/components/split-surface.js +1 -1
- package/dist/cdn/components/star-rating.js +1 -1
- package/dist/cdn/components/status-wc.js +1 -1
- package/dist/cdn/components/stepper-wc.js +1 -1
- package/dist/cdn/components/tab-set.js +1 -1
- package/dist/cdn/components/text-reader.js +2 -2
- package/dist/cdn/components/theme-picker.js +86 -83
- package/dist/cdn/components/time-index.js +1 -11
- package/dist/cdn/components/time-picker.js +1 -1
- package/dist/cdn/components/toast-msg.js +6 -6
- package/dist/cdn/components/tool-tip.js +1 -1
- package/dist/cdn/components/topic-map.js +6 -3
- package/dist/cdn/components/trust-filter.js +1 -3
- package/dist/cdn/components/version-switcher.js +5 -5
- package/dist/cdn/components/video-player.js +67 -9
- package/dist/cdn/components/watch-wc.js +6 -2
- package/dist/cdn/components/week-view.js +1 -1
- package/dist/cdn/components/youtube-player.js +1 -1
- package/dist/cdn/emoji-extended.js +2 -0
- package/dist/cdn/fonts/atkinson-hyperlegible-OFL.txt +93 -0
- package/dist/cdn/fonts/atkinson-hyperlegible-latin-400-italic.woff2 +0 -0
- package/dist/cdn/fonts/atkinson-hyperlegible-latin-400-normal.woff2 +0 -0
- package/dist/cdn/fonts/atkinson-hyperlegible-latin-700-italic.woff2 +0 -0
- package/dist/cdn/fonts/atkinson-hyperlegible-latin-700-normal.woff2 +0 -0
- package/dist/cdn/fonts/atkinson-hyperlegible-latin-ext-400-italic.woff2 +0 -0
- package/dist/cdn/fonts/atkinson-hyperlegible-latin-ext-400-normal.woff2 +0 -0
- package/dist/cdn/fonts/atkinson-hyperlegible-latin-ext-700-italic.woff2 +0 -0
- package/dist/cdn/fonts/atkinson-hyperlegible-latin-ext-700-normal.woff2 +0 -0
- package/dist/cdn/fonts/latinmodern-math-GUST-LICENSE.txt +30 -0
- package/dist/cdn/fonts/latinmodern-math.woff2 +0 -0
- package/dist/cdn/fonts/math-fonts.css +14 -0
- package/dist/cdn/packs/effects.full.css +1 -1
- package/dist/cdn/packs/effects.full.js +1 -1
- package/dist/cdn/packs/fonts-display.full.css +1 -1
- package/dist/cdn/packs/fonts-display.theme.css +1 -1
- package/dist/cdn/packs/icons.bundle.js +1 -1
- package/dist/cdn/packs/icons.full.css +1 -1
- package/dist/cdn/packs/icons.theme.css +1 -1
- package/dist/cdn/packs/journal.effects.css +1 -1
- package/dist/cdn/packs/journal.full.css +1 -1
- package/dist/cdn/packs/kawaii.effects.css +1 -1
- package/dist/cdn/packs/kawaii.full.css +2 -2
- package/dist/cdn/packs/kawaii.full.js +4 -4
- package/dist/cdn/packs/kawaii.theme.css +1 -1
- package/dist/cdn/packs/manifest.json +17 -17
- package/dist/cdn/packs/memphis.full.css +1 -1
- package/dist/cdn/packs/memphis.theme.css +1 -1
- package/dist/cdn/packs/ui.full.css +1 -1
- package/dist/cdn/packs/ui.full.js +89 -86
- package/dist/cdn/themes/8bit.css +1 -1
- package/dist/cdn/themes/8bit.tokens.json +1 -1
- package/dist/cdn/themes/alpha1999-dark.tokens.json +1 -1
- package/dist/cdn/themes/alpha1999.css +1 -1
- package/dist/cdn/themes/alpha1999.tokens.json +1 -1
- package/dist/cdn/themes/art-deco-dark.tokens.json +1 -1
- package/dist/cdn/themes/art-deco.css +1 -1
- package/dist/cdn/themes/art-deco.tokens.json +1 -1
- package/dist/cdn/themes/bauhaus-dark.tokens.json +1 -1
- package/dist/cdn/themes/bauhaus.css +1 -1
- package/dist/cdn/themes/bauhaus.tokens.json +1 -1
- package/dist/cdn/themes/brutalist-dark.tokens.json +1 -1
- package/dist/cdn/themes/brutalist.css +1 -1
- package/dist/cdn/themes/brutalist.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-frappe.css +1 -1
- package/dist/cdn/themes/catppuccin-frappe.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-latte-dark.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-latte.css +1 -1
- package/dist/cdn/themes/catppuccin-latte.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-macchiato.css +1 -1
- package/dist/cdn/themes/catppuccin-macchiato.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-mocha.css +1 -1
- package/dist/cdn/themes/catppuccin-mocha.tokens.json +1 -1
- package/dist/cdn/themes/classic-dark.tokens.json +1 -1
- package/dist/cdn/themes/classic.css +1 -1
- package/dist/cdn/themes/classic.tokens.json +1 -1
- package/dist/cdn/themes/claymorphism-dark.tokens.json +1 -1
- package/dist/cdn/themes/claymorphism.css +1 -1
- package/dist/cdn/themes/claymorphism.tokens.json +2 -1
- package/dist/cdn/themes/clinical-dark.tokens.json +1 -1
- package/dist/cdn/themes/clinical.css +1 -1
- package/dist/cdn/themes/clinical.tokens.json +1 -1
- package/dist/cdn/themes/cottagecore-dark.tokens.json +1 -1
- package/dist/cdn/themes/cottagecore.css +1 -1
- package/dist/cdn/themes/cottagecore.tokens.json +1 -1
- package/dist/cdn/themes/cyber.css +1 -1
- package/dist/cdn/themes/cyber.tokens.json +1 -1
- package/dist/cdn/themes/dawn-dark.tokens.json +1 -1
- package/dist/cdn/themes/dawn.css +1 -1
- package/dist/cdn/themes/dawn.tokens.json +1 -1
- package/dist/cdn/themes/dracula.css +1 -1
- package/dist/cdn/themes/dracula.tokens.json +1 -1
- package/dist/cdn/themes/dusk.css +1 -1
- package/dist/cdn/themes/dusk.tokens.json +1 -1
- package/dist/cdn/themes/editorial-dark.tokens.json +1 -1
- package/dist/cdn/themes/editorial.css +1 -1
- package/dist/cdn/themes/editorial.tokens.json +1 -1
- package/dist/cdn/themes/financial-dark.tokens.json +1 -1
- package/dist/cdn/themes/financial.css +1 -1
- package/dist/cdn/themes/financial.tokens.json +1 -1
- package/dist/cdn/themes/genai.css +1 -1
- package/dist/cdn/themes/genai.tokens.json +1 -1
- package/dist/cdn/themes/glassmorphism-dark.tokens.json +1 -1
- package/dist/cdn/themes/glassmorphism.css +1 -1
- package/dist/cdn/themes/glassmorphism.tokens.json +1 -1
- package/dist/cdn/themes/government-dark.tokens.json +1 -1
- package/dist/cdn/themes/government.css +1 -1
- package/dist/cdn/themes/government.tokens.json +1 -1
- package/dist/cdn/themes/gruvbox-dark.tokens.json +1 -1
- package/dist/cdn/themes/gruvbox.css +1 -1
- package/dist/cdn/themes/gruvbox.tokens.json +1 -1
- package/dist/cdn/themes/high-noon-dark.tokens.json +1 -1
- package/dist/cdn/themes/high-noon.css +1 -1
- package/dist/cdn/themes/high-noon.tokens.json +1 -1
- package/dist/cdn/themes/journal-dark.tokens.json +4 -2
- package/dist/cdn/themes/journal.css +1 -1
- package/dist/cdn/themes/journal.tokens.json +4 -2
- package/dist/cdn/themes/kawaii-dark.tokens.json +1 -1
- package/dist/cdn/themes/kawaii.css +1 -1
- package/dist/cdn/themes/kawaii.tokens.json +1 -1
- package/dist/cdn/themes/magna-dark.tokens.json +1 -1
- package/dist/cdn/themes/magna.css +1 -1
- package/dist/cdn/themes/magna.tokens.json +1 -1
- package/dist/cdn/themes/manifest.json +44 -44
- package/dist/cdn/themes/midnight.css +1 -1
- package/dist/cdn/themes/midnight.tokens.json +1 -1
- package/dist/cdn/themes/minimal-dark.tokens.json +1 -1
- package/dist/cdn/themes/minimal.css +1 -1
- package/dist/cdn/themes/minimal.tokens.json +1 -1
- package/dist/cdn/themes/modern-dark.tokens.json +1 -1
- package/dist/cdn/themes/modern.css +1 -1
- package/dist/cdn/themes/modern.tokens.json +1 -1
- package/dist/cdn/themes/nes-dark.tokens.json +7 -2
- package/dist/cdn/themes/nes.css +1 -1
- package/dist/cdn/themes/nes.tokens.json +1 -1
- package/dist/cdn/themes/neumorphism-dark.tokens.json +1 -1
- package/dist/cdn/themes/neumorphism.css +1 -1
- package/dist/cdn/themes/neumorphism.tokens.json +1 -1
- package/dist/cdn/themes/nord-dark.tokens.json +1 -1
- package/dist/cdn/themes/nord.css +1 -1
- package/dist/cdn/themes/nord.tokens.json +1 -1
- package/dist/cdn/themes/organic-dark.tokens.json +1 -1
- package/dist/cdn/themes/organic.css +1 -1
- package/dist/cdn/themes/organic.tokens.json +1 -1
- package/dist/cdn/themes/rose-pine-dark.tokens.json +1 -1
- package/dist/cdn/themes/rose-pine.css +1 -1
- package/dist/cdn/themes/rose-pine.tokens.json +1 -1
- package/dist/cdn/themes/rough-dark.tokens.json +1 -1
- package/dist/cdn/themes/rough.css +1 -1
- package/dist/cdn/themes/rough.tokens.json +1 -1
- package/dist/cdn/themes/solarized-dark.tokens.json +1 -1
- package/dist/cdn/themes/solarized.css +1 -1
- package/dist/cdn/themes/solarized.tokens.json +1 -1
- package/dist/cdn/themes/startup-dark.tokens.json +1 -1
- package/dist/cdn/themes/startup.css +1 -1
- package/dist/cdn/themes/startup.tokens.json +1 -1
- package/dist/cdn/themes/super2026-dark.tokens.json +1 -1
- package/dist/cdn/themes/super2026.css +1 -1
- package/dist/cdn/themes/super2026.tokens.json +1 -1
- package/dist/cdn/themes/swiss-dark.tokens.json +1 -1
- package/dist/cdn/themes/swiss.css +1 -1
- package/dist/cdn/themes/swiss.tokens.json +1 -1
- package/dist/cdn/themes/terminal.css +1 -1
- package/dist/cdn/themes/terminal.tokens.json +1 -1
- package/dist/cdn/themes/tokyo-night-dark.tokens.json +1 -1
- package/dist/cdn/themes/tokyo-night.css +1 -1
- package/dist/cdn/themes/tokyo-night.tokens.json +1 -1
- package/dist/cdn/themes/vaporwave-dark.tokens.json +1 -1
- package/dist/cdn/themes/vaporwave.css +1 -1
- package/dist/cdn/themes/vaporwave.tokens.json +1 -1
- package/dist/cdn/themes/win9x-dark.tokens.json +6 -2
- package/dist/cdn/themes/win9x.css +1 -1
- package/dist/cdn/themes/win9x.tokens.json +3 -1
- package/dist/cdn/vanilla-breeze-autoload.js +187 -297
- package/dist/cdn/vanilla-breeze-charts.css +1 -1
- package/dist/cdn/vanilla-breeze-charts.js +56 -32
- package/dist/cdn/vanilla-breeze-core.css +1 -1
- package/dist/cdn/vanilla-breeze-core.js +166 -262
- package/dist/cdn/vanilla-breeze-dev.js +1 -1
- package/dist/cdn/vanilla-breeze-extras.js +272 -130
- package/dist/cdn/vanilla-breeze.css +1 -1
- package/dist/cdn/vanilla-breeze.js +536 -621
- package/dist/cdn/view-transitions.css +2 -0
- package/package.json +15 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _=Object.defineProperty;var
|
|
1
|
+
var _=Object.defineProperty;var L=(n,t)=>()=>(n&&(t=n(n=0)),t);var q=(n,t)=>{for(var e in t)_(n,e,{get:t[e],enumerable:!0})};function F(n,t,e){let r=256*Math.pow(2,e),o=n/r*360-180;return{lat:Math.atan(Math.sinh(Math.PI*(1-2*t/r)))*180/Math.PI,lng:o}}function x(n,t,e){let r=256*Math.pow(2,e),o=n*Math.PI/180;return{x:(t+180)/360*r,y:(1-Math.log(Math.tan(o)+1/Math.cos(o))/Math.PI)/2*r}}function V(n,t,e,r,o){let i=o??(typeof devicePixelRatio=="number"?devicePixelRatio:1),s="abc"[Math.abs(e+r)%3];return n.replaceAll("{z}",String(t)).replaceAll("{x}",String(e)).replaceAll("{y}",String(r)).replaceAll("{s}",s).replaceAll("{r}",i>1?"@2x":"")}function S(n,t,e,r,o){let i=o||(v[n]??v.osm).template;return V(i,t,e,r)}var v,z=L(()=>{v={osm:{template:"https://tile.openstreetmap.org/{z}/{x}/{y}.png",origin:"https://tile.openstreetmap.org",credits:[{text:"\xA9 OpenStreetMap contributors",href:"https://www.openstreetmap.org/copyright"}]},"carto-light":{template:"https://basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png",origin:"https://basemaps.cartocdn.com",credits:[{text:"\xA9 OpenStreetMap contributors",href:"https://www.openstreetmap.org/copyright"},{text:"\xA9 CARTO",href:"https://carto.com/attributions"}]},"carto-dark":{template:"https://basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png",origin:"https://basemaps.cartocdn.com",credits:[{text:"\xA9 OpenStreetMap contributors",href:"https://www.openstreetmap.org/copyright"},{text:"\xA9 CARTO",href:"https://carto.com/attributions"}]}}});var B={};q(B,{MapInteraction:()=>E});var E,I=L(()=>{z();E=class{#t;#i;#r;#S;#N;#L;#T;#A;#a=0;#e=0;#s=15;#h=1;#b=19;#d=0;#m=0;#v=0;#y=0;#$=15;#c=0;#n=0;#o=new Map;#f=0;#x=0;#l=new Map;#k=0;#p=0;constructor({host:t,viewport:e,tiles:r,marker:o,lat:i,lng:s,zoom:l,provider:c,tileUrl:h,width:a,height:d,onDeactivate:g,onMove:p}){this.#A=t,this.#t=e,this.#i=r,this.#r=o,this.#S=c,this.#N=h||"",this.#L=g,this.#T=p||(()=>{}),this.#s=l,this.#v=this.#f=i,this.#y=this.#x=s,this.#$=l,this.#c=a,this.#n=d;let b=x(i,s,l);this.#a=b.x,this.#e=b.y,this.#z(),this.#i.replaceChildren(),this.#i.style.transform="",this.#r&&this.#i.appendChild(this.#r),this.#t.addEventListener("pointerdown",this.#R),this.#t.addEventListener("pointermove",this.#B),this.#t.addEventListener("pointerup",this.#E),this.#t.addEventListener("pointercancel",this.#E),this.#t.addEventListener("wheel",this.#F,{passive:!1}),this.#t.addEventListener("keydown",this.#O),this.#u()}get zoom(){return this.#s}get minZoom(){return this.#h}get maxZoom(){return this.#b}get center(){let{lat:t,lng:e}=F(this.#a,this.#e,this.#s);return{lat:+t.toFixed(6),lng:+e.toFixed(6),zoom:this.#s}}zoomBy(t){this.#g(this.#s+t,this.#c/2,this.#n/2)}recenter(){this.#s=this.#$;let t=x(this.#v,this.#y,this.#s);this.#a=t.x,this.#e=t.y,this.#M(),this.#z(),this.#w(),this.#u(),this.#C()}panBy(t,e){this.#a+=t,this.#e+=e,this.#w(),this.#u()}resize(t,e){!t||!e||t===this.#c&&e===this.#n||(this.#c=t,this.#n=e,this.#w(),this.#u())}#z(){this.#d=Math.floor(this.#a/256)*256,this.#m=Math.floor(this.#e/256)*256}#R=t=>{if(!(t.pointerType==="mouse"&&t.button!==0)&&!t.target.closest?.("a, button")){t.preventDefault(),this.#t.focus({preventScroll:!0}),this.#l.set(t.pointerId,{x:t.clientX,y:t.clientY});try{this.#t.setPointerCapture(t.pointerId)}catch{}this.#l.size===1?(this.#k=0,this.#t.setAttribute("data-dragging","")):this.#l.size===2&&(this.#p=this.#I(),this.#k=1/0)}};#B=t=>{let e=this.#l.get(t.pointerId);if(!e)return;let r=t.clientX-e.x,o=t.clientY-e.y;if(e.x=t.clientX,e.y=t.clientY,this.#l.size===1){this.#k+=Math.abs(r)+Math.abs(o),this.panBy(-r,-o);return}if(this.#l.size===2){this.panBy(-r/2,-o/2);let i=this.#I();if(!this.#p){this.#p=i;return}let s=i/this.#p;if(s>=1.5||s<=1/1.5){let l=this.#D();this.#g(this.#s+(s>1?1:-1),l.x,l.y),this.#p=i}}};#E=t=>{if(!this.#l.has(t.pointerId))return;let e=this.#l.size===1;this.#l.delete(t.pointerId);try{this.#t.releasePointerCapture(t.pointerId)}catch{}if(this.#l.size<2&&(this.#p=0),!(this.#l.size>0)){if(this.#t.removeAttribute("data-dragging"),e&&t.type==="pointerup"&&this.#k<5){let r=this.#t.getBoundingClientRect();this.panBy(t.clientX-r.left-this.#c/2,t.clientY-r.top-this.#n/2)}this.#C()}};#I(){let[t,e]=[...this.#l.values()];return t&&e?Math.hypot(t.x-e.x,t.y-e.y):0}#D(){let[t,e]=[...this.#l.values()],r=this.#t.getBoundingClientRect();return{x:(t.x+e.x)/2-r.left,y:(t.y+e.y)/2-r.top}}#F=t=>{t.preventDefault();let e=t.ctrlKey?-t.deltaY*.01:-Math.sign(t.deltaY),r=Math.round(Math.max(this.#h,Math.min(this.#b,this.#s+e)));if(r===this.#s)return;let o=this.#t.getBoundingClientRect();this.#g(r,t.clientX-o.left,t.clientY-o.top)};#O=t=>{if(t.target!==this.#t)return;let e=80,r=null;switch(t.key){case"ArrowLeft":r=[-e,0];break;case"ArrowRight":r=[e,0];break;case"ArrowUp":r=[0,-e];break;case"ArrowDown":r=[0,e];break;case"+":case"=":t.preventDefault(),this.zoomBy(1);return;case"-":case"_":t.preventDefault(),this.zoomBy(-1);return;case"Home":case"0":t.preventDefault(),this.recenter();return;case"Escape":t.preventDefault(),this.#L();return;default:return}t.preventDefault(),this.panBy(r[0],r[1]),this.#C()};#g(t,e,r){if(t=Math.max(this.#h,Math.min(this.#b,t)),t===this.#s)return;let o=this.#a-this.#c/2+e,i=this.#e-this.#n/2+r,s=Math.pow(2,t-this.#s);this.#a=o*s-e+this.#c/2,this.#e=i*s-r+this.#n/2,this.#s=t,this.#M(),this.#w(),this.#z(),this.#u(),this.#C()}#w(){let t=256*Math.pow(2,this.#s),e=(this.#a%t+t)%t;e!==this.#a&&(this.#a=e,this.#M(),this.#z());let r=Math.min(this.#n/2,t/2);this.#e=Math.max(r,Math.min(t-r,this.#e))}#u(){let t=-(this.#a-this.#c/2-this.#d),e=-(this.#e-this.#n/2-this.#m);this.#i.style.transform=`translate(${Math.round(t)}px, ${Math.round(e)}px)`,this.#_(),this.#q(),this.#P()}#_(){let t=this.#s,e=Math.pow(2,t),r=this.#a-this.#c/2,o=this.#e-this.#n/2,i=Math.floor(r/256)-1,s=Math.max(0,Math.floor(o/256)-1),l=Math.ceil((r+this.#c)/256)+1,c=Math.min(e,Math.ceil((o+this.#n)/256)+1);for(let h=s;h<c;h++)for(let a=i;a<l;a++){let d=(a%e+e)%e,g=`${t}/${a}/${h}`;if(this.#o.has(g))continue;let p=document.createElement("img");p.src=S(this.#S,t,d,h,this.#N),p.alt="",p.draggable=!1,p.style.left=`${a*256-this.#d}px`,p.style.top=`${h*256-this.#m}px`,p._wx=a*256,p._wy=h*256,this.#o.set(g,p),this.#i.insertBefore(p,this.#r?.parentNode===this.#i?this.#r:null)}}#q(){let t=this.#a-this.#c/2,e=this.#e-this.#n/2,r=512;for(let[o,i]of this.#o){let s=i._wx??0,l=i._wy??0;(s+256<t-r||s>t+this.#c+r||l+256<e-r||l>e+this.#n+r)&&(i.remove(),this.#o.delete(o))}}#P(){if(!this.#r)return;let t=x(this.#f,this.#x,this.#s),e=this.#r.offsetWidth||32,r=256*Math.pow(2,this.#s),o=t.x;for(;o-this.#a>r/2;)o-=r;for(;this.#a-o>r/2;)o+=r;this.#r.style.top=`${Math.round(t.y-this.#m-e)}px`,this.#r.style.left=`${Math.round(o-this.#d-e/2)}px`,this.#r.style.transform="none"}#C(){let t=this.center;this.#A.dispatchEvent(new CustomEvent("geo-map:move",{bubbles:!0,detail:t})),this.#T(t)}#M(){for(let t of this.#o.values())t.remove();this.#o.clear()}destroy(){this.#t.removeEventListener("pointerdown",this.#R),this.#t.removeEventListener("pointermove",this.#B),this.#t.removeEventListener("pointerup",this.#E),this.#t.removeEventListener("pointercancel",this.#E),this.#t.removeEventListener("wheel",this.#F),this.#t.removeEventListener("keydown",this.#O),this.#t.removeAttribute("data-dragging"),this.#l.clear(),this.#M()}}});var M=class extends HTMLElement{#t=[];#i;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,r,o){t.addEventListener(e,r,o),this.#t.push(()=>t.removeEventListener(e,r,o))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#i||(this.#i=this.attachInternals());let r=this.#i.states;try{e?r.add(t):r.delete(t)}catch{let o=`--${t}`;e?r.add(o):r.delete(o)}}_adoptInternals(t){this.#i||(this.#i=t)}#r(){return this.constructor.formAssociated&&this.#i?this.#i:null}get validity(){return this.#r()?.validity}get validationMessage(){return this.#r()?.validationMessage??""}get willValidate(){return this.#r()?.willValidate??!1}get form(){return this.#r()?.form??null}checkValidity(){return this.#r()?.checkValidity()??!0}reportValidity(){return this.#r()?.reportValidity()??!0}};var T=`
|
|
2
2
|
:host {
|
|
3
3
|
display: block;
|
|
4
4
|
position: relative;
|
|
@@ -22,23 +22,39 @@ var _=Object.defineProperty;var A=(l,t)=>()=>(l&&(t=l(l=0)),t);var I=(l,t)=>{for
|
|
|
22
22
|
overflow: hidden;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
/*
|
|
25
|
+
/* Stationary viewport (focus target in interactive mode); the tiles layer
|
|
26
|
+
inside it is translated. Tiles are always physically laid out (a map
|
|
27
|
+
is not mirrored in RTL). */
|
|
28
|
+
[part="viewport"] {
|
|
29
|
+
position: absolute;
|
|
30
|
+
inset: 0;
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
direction: ltr;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
[part="viewport"]:focus-visible {
|
|
36
|
+
outline: 2px solid var(--color-interactive, var(--color-primary, Highlight));
|
|
37
|
+
outline-offset: -4px;
|
|
38
|
+
}
|
|
39
|
+
|
|
26
40
|
[part="tiles"] {
|
|
27
41
|
position: absolute;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
grid-template-rows: repeat(3, 256px);
|
|
42
|
+
top: 0;
|
|
43
|
+
left: 0;
|
|
31
44
|
}
|
|
32
45
|
|
|
33
46
|
[part="tiles"] img {
|
|
47
|
+
position: absolute;
|
|
34
48
|
display: block;
|
|
35
49
|
width: 256px;
|
|
36
50
|
height: 256px;
|
|
51
|
+
max-width: none;
|
|
37
52
|
-webkit-user-drag: none;
|
|
38
53
|
user-select: none;
|
|
39
54
|
}
|
|
40
55
|
|
|
41
|
-
/* Marker
|
|
56
|
+
/* Marker \u2014 fill follows marker-color (validated, set as --_marker-color),
|
|
57
|
+
then --geo-map-marker-color, then the theme's error/danger token. */
|
|
42
58
|
[part="marker"] {
|
|
43
59
|
position: absolute;
|
|
44
60
|
top: 50%;
|
|
@@ -46,82 +62,117 @@ var _=Object.defineProperty;var A=(l,t)=>()=>(l&&(t=l(l=0)),t);var I=(l,t)=>{for
|
|
|
46
62
|
width: var(--geo-map-marker-size, 32px);
|
|
47
63
|
height: var(--geo-map-marker-size, 32px);
|
|
48
64
|
transform: translate(-50%, -100%);
|
|
49
|
-
filter: drop-shadow(0 2px 4px
|
|
65
|
+
filter: drop-shadow(0 2px 4px rgb(0 0 0 / 0.3));
|
|
50
66
|
pointer-events: none;
|
|
51
67
|
z-index: 2;
|
|
52
68
|
}
|
|
53
69
|
|
|
70
|
+
[part="marker"] svg {
|
|
71
|
+
display: block;
|
|
72
|
+
width: 100%;
|
|
73
|
+
height: 100%;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
[part="marker"] .pin {
|
|
77
|
+
fill: var(--_marker-color, var(--geo-map-marker-color, var(--color-error, #c0392b)));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
[part="marker"] .dot {
|
|
81
|
+
fill: var(--geo-map-marker-dot-color, #fff);
|
|
82
|
+
opacity: 0.9;
|
|
83
|
+
}
|
|
84
|
+
|
|
54
85
|
/* Caption (slot projection). Translucent surface over the map; uses
|
|
55
86
|
light-dark() so the pair switches automatically with the page's
|
|
56
87
|
resolved color-scheme (driven by VB tokens). */
|
|
57
88
|
[part="caption"] {
|
|
58
89
|
position: absolute;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
background: var(--geo-map-caption-bg, light-dark(rgba(255, 255, 255, 0.9), rgba(0, 0, 0, 0.75)));
|
|
90
|
+
inset-block-end: 0;
|
|
91
|
+
inset-inline: 0;
|
|
92
|
+
background: var(--geo-map-caption-bg, light-dark(rgb(255 255 255 / 0.9), rgb(0 0 0 / 0.75)));
|
|
63
93
|
color: var(--geo-map-caption-color, var(--color-text, light-dark(#1a1a1a, #e0e0e0)));
|
|
64
94
|
padding: var(--geo-map-caption-padding, 0.5rem 0.75rem);
|
|
65
95
|
font-size: 0.875rem;
|
|
66
|
-
|
|
96
|
+
/* Above the activation overlay so links in the caption stay usable */
|
|
97
|
+
z-index: 6;
|
|
67
98
|
}
|
|
68
99
|
|
|
69
|
-
[part="caption"]
|
|
70
|
-
[part="caption"]:not(:has(*)) {
|
|
100
|
+
[part="container"]:not([data-caption]) [part="caption"] {
|
|
71
101
|
display: none;
|
|
72
102
|
}
|
|
73
103
|
|
|
74
104
|
/* Attribution \u2014 translucent surface over the map; same pattern as caption */
|
|
75
105
|
[part="attribution"] {
|
|
76
106
|
position: absolute;
|
|
77
|
-
|
|
78
|
-
|
|
107
|
+
inset-block-end: 0;
|
|
108
|
+
inset-inline-end: 0;
|
|
79
109
|
padding: 2px 5px;
|
|
80
110
|
font-size: var(--geo-map-attribution-font-size, 0.625rem);
|
|
81
|
-
background: var(--geo-map-attribution-bg, light-dark(
|
|
111
|
+
background: var(--geo-map-attribution-bg, light-dark(rgb(255 255 255 / 0.7), rgb(0 0 0 / 0.6)));
|
|
82
112
|
color: var(--geo-map-attribution-color, var(--color-text, light-dark(#333, #ddd)));
|
|
83
|
-
z-index:
|
|
113
|
+
z-index: 7;
|
|
84
114
|
line-height: 1.4;
|
|
85
115
|
}
|
|
86
116
|
|
|
117
|
+
[part="attribution"][hidden] {
|
|
118
|
+
display: none;
|
|
119
|
+
}
|
|
120
|
+
|
|
87
121
|
[part="attribution"] a {
|
|
88
122
|
color: inherit;
|
|
89
123
|
text-decoration: none;
|
|
90
124
|
}
|
|
91
125
|
|
|
92
|
-
[part="attribution"] a:hover
|
|
126
|
+
[part="attribution"] a:hover,
|
|
127
|
+
[part="attribution"] a:focus-visible {
|
|
93
128
|
text-decoration: underline;
|
|
94
129
|
}
|
|
95
130
|
|
|
96
131
|
/* When caption is present, shift attribution above it */
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
132
|
+
[part="container"][data-caption] [part="attribution"] {
|
|
133
|
+
inset-block-end: auto;
|
|
134
|
+
inset-block-start: 0;
|
|
100
135
|
}
|
|
101
136
|
|
|
102
|
-
/* Overlay \u2014
|
|
137
|
+
/* Overlay \u2014 the whole surface is the activation target; faded in on
|
|
138
|
+
hover/focus for mouse users, always visible on touch (no hover). */
|
|
103
139
|
[part="overlay"] {
|
|
104
140
|
position: absolute;
|
|
105
141
|
inset: 0;
|
|
106
142
|
z-index: 5;
|
|
107
143
|
display: flex;
|
|
144
|
+
flex-direction: column;
|
|
145
|
+
gap: 0.5rem;
|
|
108
146
|
align-items: center;
|
|
109
147
|
justify-content: center;
|
|
110
|
-
|
|
148
|
+
padding: 3rem 1rem 1rem;
|
|
149
|
+
text-align: center;
|
|
150
|
+
background: var(--geo-map-overlay-bg, rgb(0 0 0 / 0.35));
|
|
111
151
|
color: var(--geo-map-overlay-color, var(--color-text-inverted, #fff));
|
|
152
|
+
cursor: pointer;
|
|
112
153
|
opacity: 0;
|
|
113
154
|
transition: opacity 0.2s ease;
|
|
114
155
|
}
|
|
115
156
|
|
|
116
157
|
[part="overlay"]:hover,
|
|
117
|
-
[part="overlay"]:focus-within
|
|
158
|
+
[part="overlay"]:focus-within,
|
|
159
|
+
[part="container"][data-consent] [part="overlay"] {
|
|
118
160
|
opacity: 1;
|
|
119
161
|
}
|
|
120
162
|
|
|
121
|
-
|
|
163
|
+
@media (hover: none) {
|
|
164
|
+
[part="overlay"] {
|
|
165
|
+
opacity: 1;
|
|
166
|
+
background: transparent;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
}
|
|
170
|
+
|
|
122
171
|
[part="activate"] {
|
|
123
|
-
background:
|
|
172
|
+
background: var(--geo-map-activate-bg, rgb(0 0 0 / 0.6));
|
|
124
173
|
border: none;
|
|
174
|
+
border-radius: 999px;
|
|
175
|
+
padding: 0.5rem 1rem;
|
|
125
176
|
color: inherit;
|
|
126
177
|
font: inherit;
|
|
127
178
|
font-size: 0.875rem;
|
|
@@ -130,32 +181,104 @@ var _=Object.defineProperty;var A=(l,t)=>()=>(l&&(t=l(l=0)),t);var I=(l,t)=>{for
|
|
|
130
181
|
}
|
|
131
182
|
|
|
132
183
|
[part="activate"]:focus-visible {
|
|
133
|
-
outline: 2px solid
|
|
184
|
+
outline: 2px solid currentColor;
|
|
134
185
|
outline-offset: 4px;
|
|
135
186
|
}
|
|
136
187
|
|
|
137
|
-
|
|
138
|
-
:
|
|
139
|
-
|
|
140
|
-
cursor: grab;
|
|
141
|
-
touch-action: none;
|
|
188
|
+
[part="consent-note"] {
|
|
189
|
+
margin: 0;
|
|
190
|
+
font-size: 0.75rem;
|
|
142
191
|
}
|
|
143
192
|
|
|
144
|
-
|
|
193
|
+
/* Consent placeholder \u2014 no tiles yet; keep the overlay readable */
|
|
194
|
+
[part="container"][data-consent] [part="overlay"] {
|
|
195
|
+
background: var(--geo-map-consent-bg, light-dark(rgb(255 255 255 / 0.6), rgb(0 0 0 / 0.5)));
|
|
196
|
+
color: var(--geo-map-consent-color, var(--color-text, light-dark(#1a1a1a, #e0e0e0)));
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
[part="container"][data-consent] [part="activate"] {
|
|
200
|
+
background: var(--color-interactive, var(--color-primary, #1a5fb4));
|
|
201
|
+
color: var(--color-text-on-primary, var(--color-text-inverted, #fff));
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
[part="container"][data-consent] [part="marker"] {
|
|
205
|
+
display: none;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
[part="container"][data-consent][data-caption] [part="overlay"] {
|
|
209
|
+
padding-block-end: 4rem;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/* On-screen controls (interactive mode) */
|
|
213
|
+
[part="controls"] {
|
|
145
214
|
position: absolute;
|
|
215
|
+
inset-block-start: 0.5rem;
|
|
216
|
+
inset-inline-start: 0.5rem;
|
|
217
|
+
z-index: 6;
|
|
218
|
+
display: none;
|
|
219
|
+
flex-direction: column;
|
|
220
|
+
gap: 2px;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
[part="container"][data-active] [part="controls"] {
|
|
224
|
+
display: flex;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
[part~="control"] {
|
|
228
|
+
min-inline-size: 2.75rem;
|
|
229
|
+
min-block-size: 2.75rem;
|
|
230
|
+
display: grid;
|
|
231
|
+
place-items: center;
|
|
232
|
+
padding: 0 0.5rem;
|
|
233
|
+
border: 1px solid var(--color-border, rgb(0 0 0 / 0.2));
|
|
234
|
+
border-radius: var(--radius-s, 0.25rem);
|
|
235
|
+
background: var(--color-surface, light-dark(#fff, #1e1e1e));
|
|
236
|
+
color: var(--color-text, light-dark(#1a1a1a, #e0e0e0));
|
|
237
|
+
font: inherit;
|
|
238
|
+
font-size: 1rem;
|
|
239
|
+
line-height: 1;
|
|
240
|
+
cursor: pointer;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
[part~="control"]:hover {
|
|
244
|
+
background: var(--color-surface-raised, light-dark(#f2f2f2, #2a2a2a));
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
[part~="control"]:focus-visible {
|
|
248
|
+
outline: 2px solid var(--color-interactive, var(--color-primary, Highlight));
|
|
249
|
+
outline-offset: 1px;
|
|
146
250
|
}
|
|
147
251
|
|
|
148
|
-
|
|
252
|
+
[part~="control"]:disabled {
|
|
253
|
+
opacity: 0.5;
|
|
254
|
+
cursor: default;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/* Interactive mode */
|
|
258
|
+
[part="container"][data-active] [part="viewport"] {
|
|
259
|
+
cursor: grab;
|
|
260
|
+
touch-action: none;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
[part="container"][data-active] [part="viewport"][data-dragging] {
|
|
149
264
|
cursor: grabbing;
|
|
150
265
|
}
|
|
151
266
|
|
|
152
|
-
|
|
267
|
+
[part="container"][data-active] [part="overlay"] {
|
|
153
268
|
display: none;
|
|
154
269
|
}
|
|
155
270
|
|
|
156
|
-
/*
|
|
157
|
-
|
|
158
|
-
|
|
271
|
+
/* Visually hidden live region */
|
|
272
|
+
[part="status"] {
|
|
273
|
+
position: absolute;
|
|
274
|
+
inline-size: 1px;
|
|
275
|
+
block-size: 1px;
|
|
276
|
+
margin: -1px;
|
|
277
|
+
padding: 0;
|
|
278
|
+
overflow: hidden;
|
|
279
|
+
clip-path: inset(50%);
|
|
280
|
+
white-space: nowrap;
|
|
281
|
+
border: 0;
|
|
159
282
|
}
|
|
160
283
|
|
|
161
284
|
/* Reduced motion \u2014 disable transitions */
|
|
@@ -182,19 +305,12 @@ var _=Object.defineProperty;var A=(l,t)=>()=>(l&&(t=l(l=0)),t);var I=(l,t)=>{for
|
|
|
182
305
|
text-align: center;
|
|
183
306
|
padding: 1rem;
|
|
184
307
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
${n}
|
|
193
|
-
${h}
|
|
194
|
-
<div part="caption"><slot></slot></div>
|
|
195
|
-
<div part="attribution">
|
|
196
|
-
<a href="https://www.openstreetmap.org/copyright" target="_blank" rel="noopener">© OpenStreetMap</a>
|
|
197
|
-
</div>
|
|
198
|
-
</div>
|
|
199
|
-
`}loadTiles(){let t=this.#t(),e=t?.lat??NaN,i=t?.lng??NaN;if(isNaN(e)||isNaN(i)){this.handleError("Missing or invalid lat/lng coordinates");return}let r=this.zoom,o=this.provider,{tileX:a,tileY:n,pixelX:s,pixelY:h}=C(e,i,r),c=this.shadowRoot.querySelector('[part="tiles"]');if(!c)return;c.innerHTML="";let d=this,u=d.offsetWidth||400,f=d.offsetHeight||300,b=Math.round(u/2-256-s),F=Math.round(f/2-256-h);c.style.transform=`translate(${b}px, ${F}px)`;let y=0,m=0,w=9;for(let k=-1;k<=1;k++)for(let x=-1;x<=1;x++){let D=a+x,q=n+k,R=v(o,r,D,q,this.tileUrl),p=document.createElement("img");p.src=R,p.alt="",p.loading="lazy",p.draggable=!1,p.addEventListener("load",()=>{y++,y+m===w&&this.dispatchEvent(new CustomEvent("geo-map:ready",{bubbles:!0,detail:{lat:e,lng:i,zoom:r}}))}),p.addEventListener("error",()=>{m++,m===w?this.handleError("Failed to load map tiles"):y+m===w&&this.dispatchEvent(new CustomEvent("geo-map:ready",{bubbles:!0,detail:{lat:e,lng:i,zoom:r}}))}),c.appendChild(p)}}#o(){let t=this.shadowRoot.querySelector('[part="overlay"]');if(!t)return;let e=t.querySelector('[part="activate"]');t.addEventListener("mouseenter",()=>this.#s(),{once:!0}),e&&e.addEventListener("focus",()=>this.#s(),{once:!0}),e&&e.addEventListener("click",()=>this.#a()),this.interactive==="eager"&&requestAnimationFrame(()=>this.#a())}#s(){if(this.#e)return;let t=this.tileUrl;if(t)try{let o=new URL(t,location.origin);if(o.origin===location.origin){this.#e=!0;return}this.#e=!0;let a=document.createElement("link");a.rel="preconnect",a.href=o.origin,a.crossOrigin="",document.head.appendChild(a);return}catch{}this.#e=!0;let e=this.provider,i;e==="carto-light"||e==="carto-dark"?i="https://basemaps.cartocdn.com":i="https://tile.openstreetmap.org";let r=document.createElement("link");r.rel="preconnect",r.href=i,r.crossOrigin="",document.head.appendChild(r)}async#a(){if(this.#i)return;let t=this.#t(),e=t?.lat??NaN,i=t?.lng??NaN;if(isNaN(e)||isNaN(i))return;let{MapInteraction:r}=await Promise.resolve().then(()=>(P(),z));this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.focus(),this.setAttribute("data-interactive-active",""),this.#i=new r({shadow:this.shadowRoot,host:this,lat:e,lng:i,zoom:this.zoom,provider:this.provider,tileUrl:this.tileUrl,onDeactivate:()=>this.#u()}),this.dispatchEvent(new CustomEvent("geo-map:activate",{bubbles:!0,detail:{lat:e,lng:i,zoom:this.zoom}}))}#u(){this.#i&&(this.#i.destroy(),this.#i=null,this.removeAttribute("data-interactive-active"),this.render(),this.loadTiles(),this.#o())}handleError(t){let e=this.shadowRoot.querySelector('[part="container"]');e&&(e.setAttribute("data-state","error"),e.setAttribute("data-error",t)),this.dispatchEvent(new CustomEvent("geo-map:error",{bubbles:!0,detail:{message:t}}))}};T("geo-map",N);export{N as GeoMap};
|
|
308
|
+
|
|
309
|
+
@media (forced-colors: active) {
|
|
310
|
+
[part~="control"],
|
|
311
|
+
[part="activate"] {
|
|
312
|
+
border: 1px solid ButtonText;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
`,k=null;function $(n){if("adoptedStyleSheets"in n&&typeof CSSStyleSheet=="function"&&"replaceSync"in CSSStyleSheet.prototype)return k||(k=new CSSStyleSheet,k.replaceSync(T)),n.adoptedStyleSheets.includes(k)||(n.adoptedStyleSheets=[...n.adoptedStyleSheets,k]),null;let t=document.createElement("style");return t.textContent=T,t}z();var Z=window.matchMedia("(prefers-reduced-motion: reduce)");var P=new Map;function R(n,t,e={}){let r=e.priority??10,o={impl:t,bundle:e.bundle,contract:e.contract,priority:r},i=P.get(n);if(customElements.get(n)){if(!i||i.priority>=r){i&&i.priority===r&&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>=r){i.priority===r&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${i.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}P.set(n,o),customElements.define(n,t)}var C="http://www.w3.org/2000/svg",U={map:"Map","map-of":"Map of {name}",activate:"Activate interactive map",consent:"Load map","consent-note":"Loads map images from {host}","zoom-in":"Zoom in","zoom-out":"Zoom out",recenter:"Recenter map",exit:"Exit map",controls:"Map controls",instructions:"Drag or use the arrow keys to pan. Click a point to centre on it. Pinch, scroll, or press plus and minus to zoom. Home recentres. Escape exits.",moved:"Map centred on {lat}, {lng}, zoom {zoom}","error-coords":"Map location unavailable","error-tiles":"Map images failed to load"},W=0;function Y(){let n=document.createElement("div");n.setAttribute("part","marker"),n.setAttribute("aria-hidden","true");let t=document.createElementNS(C,"svg");t.setAttribute("viewBox","0 0 24 36"),t.setAttribute("focusable","false");let e=document.createElementNS(C,"path");e.setAttribute("class","pin"),e.setAttribute("d","M12 0C5.373 0 0 5.373 0 12c0 9 12 24 12 24s12-15 12-24C24 5.373 18.627 0 12 0z");let r=document.createElementNS(C,"circle");return r.setAttribute("class","dot"),r.setAttribute("cx","12"),r.setAttribute("cy","12"),r.setAttribute("r","5"),t.append(e,r),n.append(t),n}function u(n,t={},e){let r=document.createElement(n);for(let[o,i]of Object.entries(t))r.setAttribute(o,i);return e!=null&&(r.textContent=e),r}function O(n){return!n||typeof n!="string"?!1:typeof CSS<"u"&&CSS.supports("color",n)}var N=class extends M{static get observedAttributes(){return["lat","lng","zoom","marker","marker-color","provider","tile-url","interactive","static-only","src","place","label","attribution","attribution-href","loading"]}#t=null;#i=null;#r=0;#S=!1;#N=!1;#L=!1;#T=!1;#A=!1;#a=`geo-map-${++W}`;#e=null;#s="";#h=new Map;#b="";#d=null;#m=0;#v=null;#y=null;#$=()=>this.#F();#c=0;#n="osm";constructor(){super(),this.attachShadow({mode:"open"})}get lat(){return parseFloat(this.getAttribute("lat")??"")}get lng(){return parseFloat(this.getAttribute("lng")??"")}get zoom(){let t=parseInt(this.getAttribute("zoom")??"",10);return t>=1&&t<=19?t:15}get showMarker(){return this.getAttribute("marker")!=="false"}get markerColor(){let t=this.getAttribute("marker-color");return O(t)?t:""}get provider(){let t=this.getAttribute("provider");return t&&(t in v||t==="carto-auto")?t:"osm"}get tileUrl(){return this.getAttribute("tile-url")||""}get interactive(){let t=this.getAttribute("interactive");return t==="eager"||t==="none"?t:"click"}get staticOnly(){return this.hasAttribute("static-only")}get loading(){let t=this.getAttribute("loading");return t==="eager"||t==="consent"?t:"lazy"}get active(){return this.#t!==null}#o(t,e={}){return(this.getAttribute(`data-label-${t}`)??U[t]??"").replace(/\{(\w+)\}/g,(o,i)=>i in e?String(e[i]):o)}get#f(){return this.interactive!=="none"&&!this.staticOnly}get#x(){return this.loading==="consent"&&!this.#N}#l(){let t=this.provider;if(t!=="carto-auto")return t;let e=this.closest("[data-mode]")?.getAttribute("data-mode");return e==="dark"?"carto-dark":e==="light"?"carto-light":window.matchMedia?.("(prefers-color-scheme: dark)").matches?"carto-dark":"carto-light"}#k(){if(this.tileUrl)try{return new URL(this.tileUrl.replace(/\{s\}/g,"a"),location.href).origin}catch{return""}return(v[this.#n]??v.osm).origin}#p(){let t=parseFloat(this.getAttribute("lat")??""),e=parseFloat(this.getAttribute("lng")??"");if(!isNaN(t)&&!isNaN(e))return{lat:t,lng:e};let r=this.getAttribute("src");if(r){let l=this.#z(r);if(l)return l}let o=this.querySelector("address[data-lat][data-lng]");if(o){let l=parseFloat(o.dataset.lat??""),c=parseFloat(o.dataset.lng??"");if(!isNaN(l)&&!isNaN(c))return{lat:l,lng:c}}let i=this.getAttribute("place");if(i){let l=this.#R(i);if(l)return l}let s=document.querySelector('meta[name="geo.position"]');if(s){let c=(s.getAttribute("content")||"").split(";");if(c.length===2){let h=parseFloat(c[0]),a=parseFloat(c[1]);if(!isNaN(h)&&!isNaN(a))return{lat:h,lng:a}}}return null}#z(t){let e=document.getElementById(t);if(!e)return null;if(e.tagName==="ADDRESS"&&e.dataset.lat&&e.dataset.lng){let r=parseFloat(e.dataset.lat),o=parseFloat(e.dataset.lng);if(!isNaN(r)&&!isNaN(o))return{lat:r,lng:o}}return e.tagName==="SCRIPT"&&e.type==="application/ld+json"?this.#B(e):null}#R(t){let e=document.querySelectorAll('script[type="application/ld+json"]');for(let r of e)try{let o=JSON.parse(r.textContent);if(o.name===t){let i=o.geo;if(i){let s=parseFloat(i.latitude),l=parseFloat(i.longitude);if(!isNaN(s)&&!isNaN(l))return{lat:s,lng:l}}}}catch{}return null}#B(t){try{let r=JSON.parse(t.textContent).geo;if(r){let o=parseFloat(r.latitude),i=parseFloat(r.longitude);if(!isNaN(o)&&!isNaN(i))return{lat:o,lng:i}}}catch{}return null}#E(){let t=i=>(i||"").replace(/\s+/g," ").trim(),e=t(this.getAttribute("label"));if(e)return e;let r=t(this.querySelector("address")?.textContent),o=this.getAttribute("src");if(!r&&o){let i=document.getElementById(o);if(i?.tagName==="ADDRESS")r=t(i.textContent);else if(i?.tagName==="SCRIPT")try{r=t(JSON.parse(i.textContent||"").name)}catch{}}return r||(r=t(this.getAttribute("place"))),r?this.#o("map-of",{name:r}):this.#o("map")}setup(){if(this.#r++,this.#n=this.#l(),this.render(),this.#I(),this.#D(),this.#w(),this.interactive==="eager"&&!this.#L&&this.#f&&!this.#x&&this.#e){let t=this.#r;requestAnimationFrame(()=>{t===this.#r&&this.#P({focus:!1})})}}attributeChangedCallback(t,e,r){e===r||this.#S||!this.isConnected||!this.hasAttribute("data-upgraded")||this._reinit()}teardown(){this.#r++,this.#i=null,this.#t&&(this.#t.destroy(),this.#t=null,this.setState("active",!1)),this.#d?.disconnect(),this.#d=null,cancelAnimationFrame(this.#m),this.#v?.disconnect(),this.#v=null,this.#y?.removeEventListener("change",this.#$),this.#y=null,clearTimeout(this.#c)}#I(){typeof ResizeObserver=="function"&&(this.#d=new ResizeObserver(()=>{cancelAnimationFrame(this.#m),this.#m=requestAnimationFrame(()=>this.#w())}),this.#d.observe(this))}#D(){this.provider!=="carto-auto"||this.tileUrl||(this.#v=new MutationObserver(()=>this.#F()),this.#v.observe(document.documentElement,{attributes:!0,attributeFilter:["data-mode"]}),this.#y=window.matchMedia?.("(prefers-color-scheme: dark)")??null,this.#y?.addEventListener("change",this.#$))}#F(){this.#l()!==this.#n&&this._reinit()}get data(){return{lat:isNaN(this.lat)?void 0:this.lat,lng:isNaN(this.lng)?void 0:this.lng,zoom:this.zoom,marker:this.showMarker,markerColor:this.markerColor}}set data(t){if(!t||typeof t!="object")return;let e=this.data,r={...e};if(t.lat!=null&&!isNaN(Number(t.lat))&&(r.lat=Number(t.lat)),t.lng!=null&&!isNaN(Number(t.lng))&&(r.lng=Number(t.lng)),t.zoom!=null&&!isNaN(Number(t.zoom))&&(r.zoom=Number(t.zoom)),t.marker!=null&&(r.marker=!!t.marker),"markerColor"in t&&(O(t.markerColor)?r.markerColor=t.markerColor:t.markerColor||(r.markerColor="")),!(r.lat===e.lat&&r.lng===e.lng&&r.zoom===e.zoom&&r.marker===e.marker&&r.markerColor===e.markerColor)){this.#S=!0;try{r.lat!==e.lat&&this.setAttribute("lat",String(r.lat)),r.lng!==e.lng&&this.setAttribute("lng",String(r.lng)),r.zoom!==e.zoom&&this.setAttribute("zoom",String(r.zoom)),r.marker!==e.marker&&this.setAttribute("marker",r.marker?"true":"false"),r.markerColor!==e.markerColor&&(r.markerColor?this.setAttribute("marker-color",r.markerColor):this.removeAttribute("marker-color"))}finally{this.#S=!1}this.hasAttribute("data-upgraded")&&this._reinit(),this.dispatchEvent(new CustomEvent("geo-map:data-changed",{detail:{data:this.data,source:"property"},bubbles:!0,composed:!0}))}}get markers(){let t=this.#p();return t?[{lat:t.lat,lng:t.lng,color:this.markerColor}]:[]}render(){let t=this.shadowRoot,e=$(t);this.removeAttribute("data-ready"),this.#A=!1,this.#h=new Map,this.#b="",this.#e=this.#p(),this.#s=this.#E();let r=this.#e!==null,o=r&&this.#x,i=u("div",{part:"container"}),s=u("div",{part:"viewport",role:"img","aria-label":this.#s});if(s.append(u("div",{part:"tiles"})),this.showMarker&&r){let a=Y();this.markerColor&&a.style.setProperty("--_marker-color",this.markerColor),s.append(a)}if(i.append(s),o){i.setAttribute("data-consent","");let a=u("div",{part:"overlay"}),d=u("button",{part:"activate",type:"button"},this.#o("consent")),g=this.#k().replace(/^https?:\/\//,""),p=u("p",{part:"consent-note"},this.#o("consent-note",{host:g}));a.append(d,p),a.addEventListener("click",()=>this.#_());let b=()=>this.#q();a.addEventListener("pointerenter",b,{once:!0}),d.addEventListener("focus",b,{once:!0}),i.append(a)}else if(r&&this.#f){let a=u("div",{part:"overlay"});a.append(u("button",{part:"activate",type:"button"},this.#o("activate"))),a.addEventListener("click",()=>this.#P({focus:!0})),i.append(a)}if(r&&this.#f){let a=u("div",{part:"controls",role:"group","aria-label":this.#o("controls")}),d=[["zoom-in","+",this.#o("zoom-in"),()=>this.#t?.zoomBy(1)],["zoom-out","\u2212",this.#o("zoom-out"),()=>this.#t?.zoomBy(-1)],["recenter","\u2316",this.#o("recenter"),()=>this.#t?.recenter()],["exit","\u2715",this.#o("exit"),()=>this.#M()]];for(let[g,p,b,w]of d){let f=u("button",{part:`control ${g}`,type:"button","aria-label":b,title:b},p);f.addEventListener("click",w),a.append(f)}i.append(a)}let l=u("div",{part:"caption"}),c=u("slot");l.append(c),i.append(l);let h=()=>{let a=c.assignedNodes().some(d=>d.nodeType===1||(d.textContent||"").trim());i.toggleAttribute("data-caption",a)};c.addEventListener("slotchange",h),i.toggleAttribute("data-caption",[...this.childNodes].some(a=>a.nodeType===1&&!a.hasAttribute("slot")||a.nodeType===3&&(a.textContent||"").trim())),i.append(this.#O()),i.append(u("p",{part:"instructions",id:`${this.#a}-help`,hidden:""},this.#o("instructions"))),i.append(u("p",{part:"status",role:"status","aria-live":"polite"})),t.replaceChildren(...e?[e]:[],i),r||this.handleError("Missing or invalid lat/lng coordinates",this.#o("error-coords"))}#O(){let t=u("div",{part:"attribution"}),e=u("slot",{name:"attribution"}),r;if(this.tileUrl){let i=(this.getAttribute("attribution")||"").trim(),s=this.getAttribute("attribution-href")||"";r=i?[{text:i,href:s}]:[]}else r=(v[this.#n]??v.osm).credits;r.forEach((i,s)=>{s&&e.append(document.createTextNode(" "));let l="";if(i.href)try{let c=new URL(i.href,location.href);(c.protocol==="https:"||c.protocol==="http:")&&(l=c.href)}catch{}e.append(l?u("a",{href:l,target:"_blank",rel:"noopener noreferrer"},i.text):u("span",{},i.text))});let o=()=>{t.hidden=r.length===0&&e.assignedNodes().length===0};return e.addEventListener("slotchange",o),t.hidden=r.length===0&&!this.querySelector(':scope > [slot="attribution"]'),t.append(e),t}#g(){let t=this.shadowRoot;return{container:t.querySelector('[part="container"]'),viewport:t.querySelector('[part="viewport"]'),tiles:t.querySelector('[part="tiles"]'),marker:t.querySelector('[part="marker"]'),status:t.querySelector('[part="status"]')}}#w(){let t=this.clientWidth,e=this.clientHeight;if(this.#t){this.#t.resize(t,e);return}if(!this.#e||this.#x||!t||!e)return;let r=`${t}x${e}`;r!==this.#b&&(this.#b=r,this.loadTiles(t,e))}loadTiles(t=this.clientWidth,e=this.clientHeight){let{tiles:r}=this.#g();if(!r||!this.#e||!t||!e)return;let o=this.zoom,{lat:i,lng:s}=this.#e,l=x(i,s,o),c=Math.pow(2,o),h=l.x-t/2,a=l.y-e/2,d=Math.floor(h/256),g=Math.floor((h+t-1)/256),p=Math.max(0,Math.floor(a/256)),b=Math.min(c-1,Math.floor((a+e-1)/256));r.style.transform=`translate(${Math.round(d*256-h)}px, ${Math.round(p*256-a)}px)`;let w=new Set;for(let f=p;f<=b;f++)for(let y=d;y<=g;y++){let A=`${y}/${f}`;w.add(A);let m=this.#h.get(A);if(!m){let D=(y%c+c)%c;m=document.createElement("img"),m.alt="",m.loading=this.loading==="eager"?"eager":"lazy",m.decoding="async",m.draggable=!1,m.addEventListener("load",()=>this.#u()),m.addEventListener("error",()=>this.#u()),m.src=S(this.#n,o,D,f,this.tileUrl),this.#h.set(A,m),r.append(m)}m.style.left=`${(y-d)*256}px`,m.style.top=`${(f-p)*256}px`}for(let[f,y]of this.#h)w.has(f)||(y.remove(),this.#h.delete(f));this.#u()}#u(){if(this.#A||this.#t||!this.#e||this.#h.size===0)return;let t=[...this.#h.values()];if(t.every(e=>e.complete)){if(this.#A=!0,t.every(e=>e.naturalWidth===0)){this.handleError("Failed to load map tiles",this.#o("error-tiles"));return}this.setAttribute("data-ready",""),this.dispatchEvent(new CustomEvent("geo-map:ready",{bubbles:!0,detail:{lat:this.#e.lat,lng:this.#e.lng,zoom:this.zoom}}))}}#_(){this.#N=!0,this._reinit(),this.#f&&this.#P({focus:!0})}#q(){if(this.#T)return;this.#T=!0;let t=this.#k();if(!t||t===location.origin||document.head.querySelector(`link[rel~="preconnect" i][href="${CSS.escape(t)}"]`))return;let e=document.createElement("link");e.rel="preconnect",e.href=t,document.head.appendChild(e)}#P({focus:t=!0}={}){if(this.#t)return Promise.resolve();if(this.#i)return this.#i;if(!this.#e||!this.#f||this.#x)return Promise.resolve();let e=this.#r,r=(async()=>{let{MapInteraction:o}=await Promise.resolve().then(()=>(I(),B));if(!this.isConnected||e!==this.#r||this.#t||!this.#e)return;let{container:i,viewport:s,tiles:l,marker:c}=this.#g();if(!i||!s||!l)return;for(let d of this.#h.values())d.remove();this.#h.clear(),i.setAttribute("data-active",""),s.setAttribute("role","region"),s.setAttribute("aria-roledescription","map"),s.setAttribute("aria-describedby",`${this.#a}-help`),s.setAttribute("tabindex","0"),this.setState("active",!0);let{lat:h,lng:a}=this.#e;this.#t=new o({host:this,viewport:s,tiles:l,marker:c,lat:h,lng:a,zoom:this.zoom,provider:this.#n,tileUrl:this.tileUrl,width:this.clientWidth,height:this.clientHeight,onDeactivate:()=>this.#M(),onMove:d=>this.#C(d)}),t&&s.focus({preventScroll:!0}),this.dispatchEvent(new CustomEvent("geo-map:activate",{bubbles:!0,detail:{lat:h,lng:a,zoom:this.zoom}}))})();return this.#i=r,r.finally(()=>{this.#i===r&&(this.#i=null)}),r}#C(t){clearTimeout(this.#c),this.#c=window.setTimeout(()=>{let{status:e}=this.#g();e&&(e.textContent=this.#o("moved",{lat:t.lat.toFixed(4),lng:t.lng.toFixed(4),zoom:t.zoom}))},400)}#M(){if(!this.#t)return;let t=!!this.shadowRoot?.activeElement;this.#L=!0,this._reinit(),t&&this.shadowRoot?.querySelector('[part="activate"]')?.focus()}handleError(t,e=t){let{container:r}=this.#g();r&&(r.setAttribute("data-state","error"),r.setAttribute("data-error",e)),this.dispatchEvent(new CustomEvent("geo-map:error",{bubbles:!0,detail:{message:t}}))}};R("geo-map",N);export{N as GeoMap};
|
|
200
316
|
//# sourceMappingURL=geo-map.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var m=window.matchMedia("(prefers-reduced-motion: reduce)");var f=new Map;function h(o,t,e={}){let n=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:n},r=f.get(o);if(customElements.get(o)){if(!r||r.priority>=n){r&&r.priority===n&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${o}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=n){r.priority===n&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}f.set(o,s),customElements.define(o,t)}var a=class extends HTMLElement{#t=[];#e;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,n,s){t.addEventListener(e,n,s),this.#t.push(()=>t.removeEventListener(e,n,s))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#e||(this.#e=this.attachInternals());let n=this.#e.states;try{e?n.add(t):n.delete(t)}catch{let s=`--${t}`;e?n.add(s):n.delete(s)}}_adoptInternals(t){this.#e||(this.#e=t)}};var l=class extends a{#t=null;#e=null;setup(){this.#n(),this.#s()}teardown(){this.#e?.disconnect()}#n(){let t=this.getAttribute("placeholder")||"Filter terms\u2026",e=document.createElement("input");e.type="search",e.placeholder=t,e.setAttribute("aria-label",t),e.setAttribute("data-glossary-search",""),e.addEventListener("input",()=>this.#r(e.value));let n=this.querySelector("main");n?n.prepend(e):this.prepend(e),this.#t=e}#r(t){let e=t.toLowerCase().trim(),n=this.querySelectorAll('.glossary-section, section[id^="glossary-"]');for(let s of n){let r=s.querySelectorAll("dt"),i=!1;for(let c of r){let p=c.textContent?.toLowerCase()||"",d=!e||p.includes(e),u=c.nextElementSibling;c.hidden=!d,u?.tagName==="DD"&&(u.hidden=!d),d&&(i=!0)}s.hidden=!i}}#s(){let t=this.querySelectorAll(".glossary-jump a");if(!t.length)return;let e=this.querySelectorAll('.glossary-section, section[id^="glossary-"]');if(e.length){this.#e=new IntersectionObserver(n=>{for(let s of n)if(s.isIntersecting){let r=s.target.id;for(let i of t){let c=i.getAttribute("href")===`#${r}`;i.setAttribute("aria-current",c?"true":"false")}}},{rootMargin:"-20% 0px -60% 0px"});for(let n of e)this.#e.observe(n)}}};h("glossary-index",l);export{l as GlossaryIndex};
|
|
1
|
+
var U=window.matchMedia("(prefers-reduced-motion: reduce)");var x=new Map;function T(s,e,t={}){let r=t.priority??10,n={impl:e,bundle:t.bundle,contract:t.contract,priority:r},i=x.get(s);if(customElements.get(s)){if(!i||i.priority>=r){i&&i.priority===r&&i.impl!==e&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=r){i.priority===r&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${i.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}x.set(s,n),customElements.define(s,e)}var m=class extends HTMLElement{#r=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#r)e();this.#r=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,t,r,n){e.addEventListener(t,r,n),this.#r.push(()=>e.removeEventListener(t,r,n))}_reinit(){for(let e of this.#r)e();this.#r=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(e,t){this.#e||(this.#e=this.attachInternals());let r=this.#e.states;try{t?r.add(e):r.delete(e)}catch{let n=`--${e}`;t?r.add(n):r.delete(n)}}_adoptInternals(e){this.#e||(this.#e=e)}#t(){return this.constructor.formAssociated&&this.#e?this.#e:null}get validity(){return this.#t()?.validity}get validationMessage(){return this.#t()?.validationMessage??""}get willValidate(){return this.#t()?.willValidate??!1}get form(){return this.#t()?.form??null}checkValidity(){return this.#t()?.checkValidity()??!0}reportValidity(){return this.#t()?.reportValidity()??!0}};var D=["position:absolute","inline-size:1px","block-size:1px","padding:0","margin:-1px","overflow:hidden","clip-path:inset(50%)","white-space:nowrap","border:0"].join(";"),S=new WeakMap;function R(s,e){let t=S.get(e);t||S.set(e,t=new Map);let r=t.get(s);if(!r||!r.region.isConnected){let i=(e.ownerDocument||document).createElement("span");i.setAttribute("data-vb-announcer",s),i.setAttribute("role",s==="assertive"?"alert":"status"),i.setAttribute("aria-live",s),i.setAttribute("aria-atomic","true"),i.style.cssText=D,e.appendChild(i),r={region:i},t.set(s,r)}return r}function k(s,{politeness:e="polite",root:t}={}){let r=String(s??"").trim();if(!r||typeof document>"u")return null;let n=t||document.body;if(!n)return null;let o=R(e==="assertive"?"assertive":"polite",n);return clearTimeout(o.write),clearTimeout(o.clear),o.region.textContent="",o.write=setTimeout(()=>{o.region.textContent=r,o.clear=setTimeout(()=>{o.region.textContent=""},7e3)},50),o.region}function p(s,e,t,r){let n=`data-label-${e}`,o=s?.closest?.(`[${n}]`)?.getAttribute(n)||t;return r?o.replace(/\{(\w+)\}/g,(c,l)=>l in r?String(r[l]):c):o}var M=1500,F="[data-copy], [data-copy-target], [data-paste-target]",h={copied:"Copied to clipboard",pasted:"Pasted from clipboard","copy-failed":"Copy failed","copy-failed-selected":"Copy failed. Text selected, press Ctrl+C to copy","paste-failed":"Paste failed"},A=new WeakMap;function _(s){if(typeof document.execCommand!="function"||!document.body)return!1;let e=document.activeElement,t=document.createElement("textarea");t.value=s,t.setAttribute("readonly",""),t.setAttribute("aria-hidden","true"),t.style.cssText="position:fixed;inset-block-start:0;inset-inline-start:0;opacity:0;pointer-events:none",document.body.appendChild(t),t.select();let r=!1;try{r=document.execCommand("copy")}catch{r=!1}return t.remove(),e?.focus?.({preventScroll:!0}),r}function B(s){if(!s)return!1;if(s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement)return s.focus(),s.select(),!0;let e=window.getSelection?.();if(!e)return!1;let t=document.createRange();return t.selectNodeContents(s),e.removeAllRanges(),e.addRange(t),!e.isCollapsed}async function E(s,e={}){if(s==null||s==="")return!1;let{button:t,duration:r=M}=e,n=!1,i=null;try{if(!navigator.clipboard?.writeText)throw new Error("Clipboard API unavailable");await navigator.clipboard.writeText(s),n=!0}catch(c){i=c,n=_(s)}if(n)return y({button:t,duration:r,state:"copied",eventName:"copy:done",eventDetail:{text:s},message:e.announceMessage??p(t,"copied",h.copied)}),!0;let o=B(e.source);return y({button:t,duration:r,state:"failed",eventName:"copy:error",eventDetail:{text:s,error:i},message:e.failureMessage??p(t,"copy-failed",o?h["copy-failed-selected"]:h["copy-failed"])}),!1}function y({button:s,duration:e,message:t,eventDetail:r,state:n,eventName:i}){if(s){s.dataset.state=n;let o=A.get(s);o&&clearTimeout(o),A.set(s,setTimeout(()=>{s.dataset.state===n&&delete s.dataset.state,A.delete(s)},e)),s.dispatchEvent(new CustomEvent(i,{bubbles:!0,detail:r}))}k(t,{politeness:n==="failed"?"assertive":"polite"})}async function P(s,e={}){let{button:t,duration:r=M}=e,n;try{if(!navigator.clipboard?.readText)throw new Error("Clipboard API unavailable");n=await navigator.clipboard.readText()}catch(i){return y({button:t,duration:r,state:"failed",eventName:"paste:error",eventDetail:{target:s,error:i},message:e.failureMessage??p(t,"paste-failed",h["paste-failed"])}),null}return s&&(s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement||s instanceof HTMLSelectElement?s.value=n:s.textContent=n,s.dispatchEvent(new Event("input",{bubbles:!0}))),y({button:t,duration:r,state:"pasted",eventName:"paste:done",eventDetail:{text:n,target:s},message:e.announceMessage??p(t,"pasted",h.pasted)}),n}function L(s){let e=s.dataset.copyTarget;if(!e)return null;try{return document.querySelector(e)}catch{return null}}function O(s){if(s.dataset.copy)return s.dataset.copy;let e=L(s);if(!e)return"";let t=s.dataset.copyAttr;return t?e.getAttribute(t)??"":e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement?e.value:e.textContent??""}function j(s){let e=s.target?.closest?.(F);if(!e||e.matches(':disabled, [aria-disabled="true"]'))return;if(e.dataset.pasteTarget){let r=null;try{r=document.querySelector(e.dataset.pasteTarget)}catch{}if(!r)return;P(r,{button:e});return}let t=O(e);t&&E(t,{button:e,source:L(e)??void 0})}typeof document<"u"&&!document.__vbCopyDelegated&&(document.__vbCopyDelegated=!0,document.addEventListener("click",j));var H=()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches;function w(s,e){let r=(()=>{try{return decodeURIComponent(location.hash.slice(1))}catch{return location.hash.slice(1)}})()===e;r||(location.hash=e);let n=s;typeof n.focus=="function"&&(n.tabIndex<0&&!n.hasAttribute("tabindex")&&n.setAttribute("tabindex","-1"),n.focus({preventScroll:!0})),(r||!n.matches?.(":target"))&&n.scrollIntoView({behavior:H()?"auto":"smooth",block:"start"})}function N(s){let e=s;if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return!1;let r=(e.target instanceof Element?e.target:null)?.closest('a[href^="#"]');if(!r)return!1;let n=r.getAttribute("target");if(n&&n!=="_self"||r.hasAttribute("download"))return!1;let i=(r.getAttribute("href")??"").slice(1);if(!i)return!1;let o=i;try{o=decodeURIComponent(i)}catch{}let c=r.ownerDocument.getElementById(o);return c?(e.preventDefault(),w(c,o),!0):!1}var $={filter:"Filter glossary terms","matches-one":"{count} term matches","matches-other":"{count} terms match","all-one":"Showing {count} term","all-other":"Showing all {count} terms",empty:"No terms match your filter.",permalink:"Copy link to",copied:"Link copied to clipboard"},g='.glossary-section, section[id^="glossary-"]',V=1500;function K(s){let e=[],t=null;for(let r of[...s.children])if(r.localName==="div"){let n={dts:[],dds:[],wrapper:r};for(let i of[...r.children])i.localName==="dt"?n.dts.push(i):i.localName==="dd"&&n.dds.push(i);e.push(n),t=null}else r.localName==="dt"?((!t||t.dds.length)&&(t={dts:[],dds:[],wrapper:null},e.push(t)),t.dts.push(r)):r.localName==="dd"&&(t||(t={dts:[],dds:[],wrapper:null},e.push(t)),t.dds.push(r));return e}var C=class extends m{#r=null;#e=null;#t=null;#i=null;#a=[];#n=new Map;#o="";setup(){this.#o="",this.listen(this,"click",this.#h),this.listen(this,"click",N),this.#f(),this.#p(),this.#y()}teardown(){this.#i?.disconnect(),this.#i=null;for(let e of this.#n.values())clearTimeout(e);this.#n.clear(),this.#o&&this.#l("",{silent:!0}),this.#r?.remove(),this.#e?.remove(),this.#t?.remove();for(let e of this.#a)e.remove();for(let e of this.querySelectorAll(".glossary-jump a[aria-current]"))e.removeAttribute("aria-current");this.#r=null,this.#e=null,this.#t=null,this.#a=[]}#f(){let e=document.createElement("search");e.className="glossary-search";let t=document.createElement("input");t.type="search",t.placeholder=this.getAttribute("placeholder")||"Filter terms\u2026",t.setAttribute("aria-label",this.#s("filter")),e.append(t),this.listen(t,"input",()=>this.#l(t.value));let r=document.createElement("p");r.className="glossary-status",r.setAttribute("role","status"),r.setAttribute("aria-live","polite"),r.setAttribute("aria-atomic","true");let n=document.createElement("p");n.className="glossary-empty",n.textContent=this.#s("empty"),n.hidden=!0;let i=this.querySelector("main"),o=this.querySelector(".glossary-jump"),c=this.querySelector(":scope > :is(h1, h2, h3, h4, h5, h6)");i?i.prepend(e,r):o?.parentElement?o.before(e,r):c?c.after(e,r):this.prepend(e,r);let l=this.querySelectorAll(g),f=l[l.length-1];f?f.after(n):r.after(n),this.#r=e,this.#e=r,this.#t=n}#l(e,{silent:t=!1}={}){let r=this.#c(),n=a=>{try{return a.toLocaleLowerCase(r)}catch{return a.toLowerCase()}},i=n(e.trim()),o=this.#o!=="";this.#o=i;let c=0,l=0,f=new Set;for(let a of this.querySelectorAll(g)){let d=!1;for(let I of a.querySelectorAll("dl"))for(let u of K(I)){if(!u.dts.length)continue;l+=u.dts.length;let q=n(u.dts.map(v=>this.#d(v)).join(" ")),b=!i||q.includes(i);u.wrapper&&(u.wrapper.hidden=!b);for(let v of[...u.dts,...u.dds])v.hidden=!b;b&&(d=!0,c+=u.dts.length)}a.hidden=!d,!d&&a.id&&f.add(a.id)}for(let a of this.querySelectorAll('.glossary-jump a[href^="#"]')){let d=decodeURIComponent((a.getAttribute("href")??"").slice(1));f.has(d)?a.hasAttribute("aria-disabled")||(a.setAttribute("aria-disabled","true"),a.setAttribute("data-glossary-disabled","")):a.hasAttribute("data-glossary-disabled")&&(a.removeAttribute("aria-disabled"),a.removeAttribute("data-glossary-disabled"))}if(this.#t&&(this.#t.hidden=!i||c>0),!t){if(this.#e&&(i||o)){let a=i?this.#u("matches",c):this.#u("all",l),d=this.#e;d.textContent="",requestAnimationFrame(()=>{d.textContent=a})}this.dispatchEvent(new CustomEvent("glossary-index:filter",{bubbles:!0,detail:{query:i,matchCount:c}}))}}#p(){for(let e of this.querySelectorAll(`:is(${g}) dl dt[id]`)){if(e.querySelector(":scope > .glossary-permalink"))continue;let t=document.createElement("a");t.className="glossary-permalink",t.href=`#${encodeURIComponent(e.id)}`,t.setAttribute("aria-label",`${this.#s("permalink")} ${this.#d(e)}`);let r=document.createElement("span");r.setAttribute("aria-hidden","true"),r.textContent="#",t.append(r),e.append(t),this.#a.push(t)}}#d(e){let t=e.querySelector("dfn");if(t)return(t.textContent??"").trim();let r="";for(let n of e.childNodes)n instanceof Element&&n.classList.contains("glossary-permalink")||(r+=n.textContent??"");return r.replace(/\s+/g," ").trim()}#h=e=>{let t=e,n=(t.target instanceof Element?t.target:null)?.closest("a");if(!n||!this.contains(n))return;if(n.getAttribute("aria-disabled")==="true"){t.preventDefault();return}if(!n.classList.contains("glossary-permalink")||t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return;let i=n.parentElement;i?.id&&(t.preventDefault(),this.#m(i,n))};async#m(e,t){w(e,e.id);let r=new URL(document.URL);r.hash=e.id,await E(r.href,{announceMessage:this.#s("copied")})&&(t.dataset.state="copied",clearTimeout(this.#n.get(t)),this.#n.set(t,setTimeout(()=>{delete t.dataset.state,this.#n.delete(t)},V)))}#y(){let e=this.querySelectorAll(".glossary-jump a");if(!e.length)return;let t=this.querySelectorAll(g);if(t.length){this.#i=new IntersectionObserver(r=>{for(let n of r)if(n.isIntersecting){let i=n.target.id;for(let o of e){let c=o.getAttribute("href")===`#${i}`;o.setAttribute("aria-current",c?"true":"false")}}},{rootMargin:"-20% 0px -60% 0px"});for(let r of t)this.#i.observe(r)}}#c(){return this.closest("[lang]")?.getAttribute("lang")||void 0}#s(e){return this.getAttribute(`data-label-${e}`)??$[e]??""}#u(e,t){let r="other",n=String(t);try{r=new Intl.PluralRules(this.#c()).select(t),n=new Intl.NumberFormat(this.#c()).format(t)}catch{}return(this.getAttribute(`data-label-${e}-${r}`)??$[`${e}-${r}`]??this.#s(`${e}-other`)).replaceAll("{count}",n)}};T("glossary-index",C);export{C as GlossaryIndex,K as termGroups};
|
|
2
2
|
//# sourceMappingURL=glossary-index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var y=window.matchMedia("(prefers-reduced-motion: reduce)");var b=new Map;function C(c,t,e={}){let s=e.priority??10,r={impl:t,bundle:e.bundle,contract:e.contract,priority:s},i=b.get(c);if(customElements.get(c)){if(!i||i.priority>=s){i&&i.priority===s&&i.impl!==t&&console.warn(`[VB Bundle] Tag <${c}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${c}> 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 <${c}> already registered by "${i.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}b.set(c,r),customElements.define(c,t)}var u=class extends HTMLElement{#o=[];#s;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#o)t();this.#o=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,s,r){t.addEventListener(e,s,r),this.#o.push(()=>t.removeEventListener(e,s,r))}_reinit(){for(let t of this.#o)t();this.#o=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#s||(this.#s=this.attachInternals());let s=this.#s.states;try{e?s.add(t):s.delete(t)}catch{let r=`--${t}`;e?s.add(r):s.delete(r)}}_adoptInternals(t){this.#s||(this.#s=t)}};function m(c){return String(c).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}var p={user:'<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/>',pencil:'<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/><path d="m15 5 4 4"/>',check:'<path d="M20 6 9 17l-5-5"/>',target:'<circle cx="12" cy="12" r="10"/><circle cx="12" cy="12" r="6"/><circle cx="12" cy="12" r="2"/>',alertTriangle:'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>',messageCircle:'<path d="M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"/>',lightbulb:'<path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"/><path d="M9 18h6"/><path d="M10 22h4"/>',wrench:'<path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z"/>',heart:'<path d="M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5"/>',mapPin:'<path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"/><circle cx="12" cy="10" r="3"/>',checkCircle:'<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><path d="m9 11 3 3L22 4"/>',x:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',download:'<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" x2="12" y1="15" y2="3"/>',send:'<path d="M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z"/><path d="m21.854 2.147-10.94 10.939"/>'},v={says:{label:"Says",icon:p.messageCircle,color:"#3b82f6"},thinks:{label:"Thinks",icon:p.lightbulb,color:"#8b5cf6"},does:{label:"Does",icon:p.wrench,color:"#f59e0b"},feels:{label:"Feels",icon:p.heart,color:"#ef4444"}};var g=class c extends u{static get observedAttributes(){return["src","compact","title","searchable"]}static#o=0;#s=null;#r=null;#n=null;#t=null;#i=null;#l="";#c=null;#e=[];#a=[];#h=new Map;#d=new Map;setup(){this.#l=`gloss-${++c.#o}`;let t=this.querySelector(":scope > dl");if(!t)return!1;let e=[...t.querySelectorAll(":scope > div[data-term-id]")];if(e.length===0)return!1;this.#e=e.map(i=>{let o=i.getAttribute("data-term-id")||"",a=i.getAttribute("data-category")||"Uncategorized",l=i.querySelector("dt"),h=i.querySelector("dd"),n=l?l.textContent.trim():"",d=h?h.textContent.trim():"";return i.id=o,{id:o,term:n,definition:d,category:a,el:i}});let s=new Set;this.#a=[];for(let i of this.#e)s.has(i.category)||(s.add(i.category),this.#a.push(i.category));t.remove(),this.#u();let r=this.getAttribute("src");if(r){this._loadSrc(r);return}return this.dispatchEvent(new CustomEvent("glossary-wc:ready",{bubbles:!0,detail:{termCount:this.#e.length,categories:[...this.#a]}})),!0}get terms(){return this.#e.map(t=>({id:t.id,term:t.term,definition:t.definition,category:t.category}))}set terms(t){let e=Array.isArray(t)?t:[];for(;this.firstChild;)this.firstChild.remove();let s=document.createElement("dl");for(let r of e){let i=document.createElement("div");i.setAttribute("data-term-id",r.id||""),r.category&&i.setAttribute("data-category",r.category);let o=document.createElement("dt");o.textContent=r.term||"";let a=document.createElement("dd");a.textContent=r.definition||"",i.appendChild(o),i.appendChild(a),s.appendChild(i)}this.appendChild(s),this.teardown(),this.removeAttribute("data-upgraded"),this.setup(),this.dispatchEvent(new CustomEvent("glossary-wc:terms-changed",{detail:{terms:e,source:"property"},bubbles:!0}))}teardown(){this.#c&&clearTimeout(this.#c);let t=this.querySelector(".gloss-title");t&&t.remove(),this.#s?.parentElement&&this.#s.parentElement.remove(),this.#r&&this.#r.remove(),this.#i&&this.#i.remove(),this.#t&&this.#t.remove(),this.#s=null,this.#r=null,this.#n=null,this.#t=null,this.#i=null,this.#e=[],this.#a=[],this.#h=new Map,this.#d=new Map}#u(){let t=this.getAttribute("title");if(t){let e=document.createElement("h2");e.className="gloss-title",e.textContent=t,this.#n=document.createElement("output"),this.#n.className="gloss-count",this.#n.textContent=String(this.#e.length),e.appendChild(this.#n),this.appendChild(e)}if(this.hasAttribute("searchable")){let e=document.createElement("div");e.className="gloss-search";let s=document.createElement("input");s.type="search",s.className="gloss-search-input",s.setAttribute("placeholder","Search terms\u2026"),s.setAttribute("aria-label","Search glossary terms"),e.appendChild(s),this.appendChild(e),this.#s=s,this.listen(s,"input",this.#f)}this.#p(),this.#i=document.createElement("div"),this.#i.className="gloss-categories",this.#i.setAttribute("role","region"),this.#i.setAttribute("aria-label","Glossary terms"),this.appendChild(this.#i);for(let e of this.#a){let s=this.#e.filter(r=>r.category===e);this.#m(e,s)}this.#t=document.createElement("div"),this.#t.className="gloss-live-region",this.#t.setAttribute("role","status"),this.#t.setAttribute("aria-live","polite"),this.#t.setAttribute("aria-atomic","true"),this.appendChild(this.#t)}#p(){this.#r=document.createElement("nav"),this.#r.className="gloss-jump-bar",this.#r.setAttribute("aria-label","Alphabet navigation");let t=new Set;for(let e of this.#e){let s=e.term.charAt(0).toUpperCase();/[A-Z]/.test(s)&&t.add(s)}for(let e=65;e<=90;e++){let s=String.fromCharCode(e),r=document.createElement("a");r.textContent=s,r.className="gloss-jump-letter",t.has(s)?(r.href=`#${this.#l}-letter-${s}`,r.setAttribute("data-active","")):(r.setAttribute("aria-disabled","true"),r.setAttribute("tabindex","-1")),this.#r.appendChild(r)}this.appendChild(this.#r)}#m(t,e){let s=document.createElement("section");s.className="gloss-category",s.setAttribute("data-category",t);let r=document.createElement("header");r.className="gloss-category-header";let i=document.createElement("button");i.type="button",i.className="gloss-category-toggle",i.setAttribute("aria-expanded","true"),i.innerHTML=`<span class="gloss-category-label">${m(t)}</span><output class="gloss-category-count">${e.length}</output><span class="gloss-chevron" aria-hidden="true"></span>`,r.appendChild(i),s.appendChild(r),this.#h.set(t,i);let o=document.createElement("dl");o.className="gloss-term-list";let a=[...e].sort((n,d)=>n.term.localeCompare(d.term)),l=[],h="";for(let n of a){let d=n.term.charAt(0).toUpperCase();if(/[A-Z]/.test(d)&&d!==h){h=d;let f=document.createElement("span");f.id=`${this.#l}-letter-${d}`,f.className="gloss-letter-anchor",o.appendChild(f)}n.el.className="gloss-term",n.el.id=n.id,o.appendChild(n.el),l.push(n.el)}this.#d.set(t,l),s.appendChild(o),this.#i?.appendChild(s),this.listen(i,"click",()=>{let n=i.getAttribute("aria-expanded")==="true";i.setAttribute("aria-expanded",String(!n)),o.hidden=n})}#f=t=>{this.#c&&clearTimeout(this.#c),this.#c=setTimeout(()=>{let e=t.target.value.toLowerCase().trim();this.#g(e)},150)};#g(t){let e=0;for(let s of this.#e)t===""||s.term.toLowerCase().includes(t)||s.definition.toLowerCase().includes(t)?(s.el.removeAttribute("hidden"),e++):s.el.setAttribute("hidden","");for(let s of this.#a){let r=this.#d.get(s)||[],i=r[0]?.closest(".gloss-category");if(!i)continue;if(r.some(a=>!a.hasAttribute("hidden"))){i.removeAttribute("hidden");let a=r.filter(h=>!h.hasAttribute("hidden")).length,l=i.querySelector(".gloss-category-count");l&&(l.textContent=String(a))}else i.setAttribute("hidden","")}this.#n&&(this.#n.textContent=t===""?String(this.#e.length):`${e} / ${this.#e.length}`),t!==""&&this.#t&&(this.#t.textContent="",requestAnimationFrame(()=>{this.#t&&(this.#t.textContent=`${e} term${e!==1?"s":""} found`)})),this.dispatchEvent(new CustomEvent("glossary-wc:search",{bubbles:!0,detail:{query:t,matchCount:e}}))}attributeChangedCallback(t,e,s){e===s||!this.isConnected||t==="src"&&this._loadSrc(s)}async _loadSrc(t){if(t)try{let e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}`);let s=await e.json();for(;this.firstChild;)this.firstChild.remove();let r=document.createElement("dl");for(let i of s.terms||[]){let o=document.createElement("div");o.setAttribute("data-term-id",i.id||""),o.setAttribute("data-category",i.category||"Uncategorized");let a=document.createElement("dt");a.textContent=i.term||"";let l=document.createElement("dd"),h=i.definition||"";if(i.seeAlso&&i.seeAlso.length>0){let n=i.seeAlso.map(d=>`<a href="#${m(d)}">${m(this.#b(d))}</a>`).join(", ");h+=` See also: ${n}.`}l.innerHTML=h,o.appendChild(a),o.appendChild(l),r.appendChild(o)}this.appendChild(r),s.title&&!this.getAttribute("title")&&this.setAttribute("title",s.title),this.teardown(),this.removeAttribute("data-upgraded"),this.setup()}catch(e){console.warn(`[glossary-wc] Failed to load src="${t}":`,e)}}#b(t){return t.replace(/[-_]/g," ").replace(/\b\w/g,e=>e.toUpperCase())}};C("glossary-wc",g);export{g as GlossaryWc};
|
|
1
|
+
var wt=window.matchMedia("(prefers-reduced-motion: reduce)");var $=new Map;function I(s,t,e={}){let n=e.priority??10,r={impl:t,bundle:e.bundle,contract:e.contract,priority:n},i=$.get(s);if(customElements.get(s)){if(!i||i.priority>=n){i&&i.priority===n&&i.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=n){i.priority===n&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${i.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}$.set(s,r),customElements.define(s,t)}var A=class extends HTMLElement{#r=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#r)t();this.#r=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,n,r){t.addEventListener(e,n,r),this.#r.push(()=>t.removeEventListener(e,n,r))}_reinit(){for(let t of this.#r)t();this.#r=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#e||(this.#e=this.attachInternals());let n=this.#e.states;try{e?n.add(t):n.delete(t)}catch{let r=`--${t}`;e?n.add(r):n.delete(r)}}_adoptInternals(t){this.#e||(this.#e=t)}#n(){return this.constructor.formAssociated&&this.#e?this.#e:null}get validity(){return this.#n()?.validity}get validationMessage(){return this.#n()?.validationMessage??""}get willValidate(){return this.#n()?.willValidate??!1}get form(){return this.#n()?.form??null}checkValidity(){return this.#n()?.checkValidity()??!0}reportValidity(){return this.#n()?.reportValidity()??!0}};var W="http://www.w3.org/1999/xhtml",v="http://www.w3.org/2000/svg",P="http://www.w3.org/1998/Math/MathML",G=new Set([W,v,P]),E="user-content-",K=new Set(["script","iframe","frame","frameset","object","embed","applet","portal","fencedframe","form","base","link","meta","noscript","foreignobject","style","xmp","noembed","noframes","plaintext","mglyph","malignmark","annotation-xml"]),k=new Set(["title","desc"]),X=new Set(["animate","set","animatemotion","animatetransform"]),Y=new Set(["href","xlink:href","action","formaction","data","codebase","cite","background","longdesc","manifest","to","from","values","by"]),J=new Set(["src","poster","srcset"]),Q=new Set(["srcdoc","form","formaction","formmethod","formtarget","formenctype","formnovalidate","action","method","ping"]),Z=new Set(["popovertarget","popovertargetaction","commandfor","command","interestfor","autofocus"]),tt=new Set(["for","headers","list","aria-labelledby","aria-describedby","aria-controls","aria-owns","aria-flowto","aria-details","aria-errormessage","aria-activedescendant"]),et={"include-file":["trusted","allow-scripts","allow-cross-origin"],"markdown-viewer":["src","sanitize","ping","allow-cross-origin"]},nt=new Set(["social-embed","youtube-player","geo-map"]),rt=["src","src-dark","data-src","url","endpoint","tile-url","data-versions"],st=new Set(["audio-player","video-player","image-map","brand-mark"]);function it(s){return String(s).replace(/[\u0000- \u007f-\u009f]/g,"").toLowerCase()}function L(s,t=!1){let e=it(s);return t?/(^|,)(javascript|vbscript|livescript):/.test(e)?!0:/(^|,)data:/.test(e)?e.split(/(?=data:)/).filter(r=>r.startsWith("data:")).some(r=>!/^data:(image|audio|video|font)\//.test(r)):!1:/^(javascript|vbscript|livescript|data):/.test(e)}function R(s){let t=String(s).replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\/g,"").replace(/\s+/g,"").toLowerCase();return/expression\(|javascript:|vbscript:|-moz-binding|behavior:|@import|position:fixed/.test(t)}var ot=s=>String(s.localName||s.tagName||"").toLowerCase(),at=s=>s.startsWith(E)?s:E+s;function ct(s,t){if(K.has(t))return!0;let e=s.namespaceURI;return!!(e&&!G.has(e)||t==="title"&&e!==v||k.has(t)&&e===v&&s.children?.length||X.has(t)&&(s.getAttribute("attributeName")||s.getAttribute("attributename")||"").toLowerCase().includes("href"))}function lt(s,t){for(let e of[...s.attributes]){let n=e.name.toLowerCase();if(n.startsWith("on")||Q.has(n)||!t.keepIds&&Z.has(n)){s.removeAttribute(e.name);continue}if(n==="style"){(!t.keepStyle||R(e.value))&&s.removeAttribute(e.name);continue}if((n==="id"||n==="name")&&!t.keepIds){let r=at(e.value);n==="id"?t.ids.set(e.value,r):t.ids.set(`name:${e.value}`,r),s.setAttribute(e.name,r);continue}if(Y.has(n)||n.endsWith(":href")){L(e.value,!1)&&s.removeAttribute(e.name);continue}J.has(n)&&L(e.value,!0)&&s.removeAttribute(e.name)}}function ut(s,t){let e=(s.getAttribute("type")||"").toLowerCase();t==="button"&&e!=="button"&&s.setAttribute("type","button"),t==="input"&&/^(submit|reset|image)$/.test(e)&&s.setAttribute("type","button")}function dt(s,t){for(let e of s)for(let n of[...e.attributes]){let r=n.name.toLowerCase(),i=n.value;if((r==="href"||r.endsWith(":href"))&&i.startsWith("#")){let o=ht(i.slice(1));t.has(o)&&e.setAttribute(n.name,`#${t.get(o)}`)}else if(r==="usemap"&&i.startsWith("#")){let o=t.get(`name:${i.slice(1)}`);o?e.setAttribute(n.name,`#${o}`):e.removeAttribute(n.name)}else if(tt.has(r)){let o=i.split(/\s+/).filter(Boolean).map(a=>t.get(a)||(a.startsWith(E)?a:null)).filter(Boolean);o.length?e.setAttribute(n.name,o.join(" ")):e.removeAttribute(n.name)}else i.includes("url(#")&&e.setAttribute(n.name,i.replace(/url\(#([^)]+)\)/g,(o,a)=>t.has(a)?`url(#${t.get(a)})`:o))}}function ht(s){try{return decodeURIComponent(s)}catch{return s}}function _(s){let t=s.childNodes;if(t)for(let e of[...t])e.nodeType===8?e.remove():(e.nodeType===1||e.nodeType===11)&&_(e)}function O(s,t){_(s);let e=[...s.querySelectorAll("*")];t.includeRoot&&e.unshift(s);let n=new Map,r=[],i={...t,ids:n};for(let o of e){if(!mt(o,s))continue;let a=ot(o);if(t.svgOnly&&(k.has(a)||a==="style")){if(a==="style"&&R(o.textContent||"")){o.remove();continue}}else if(ct(o,a)){o.remove();continue}if(!t.keepIds&&!t.svgOnly&&nt.has(a)){ft(o);continue}if(a==="template"){let l=o.content;l&&O(l,{...t,includeRoot:!1})}lt(o,i),t.keepIds||ut(o,a);let d=et[a];if(d)for(let l of d)o.removeAttribute(l);if(a==="include-file"&&!t.allowIncludeFile&&o.removeAttribute("src"),!t.keepIds&&!t.svgOnly&&a.includes("-")&&a!=="include-file"&&!st.has(a))for(let l of rt)o.removeAttribute(l);r.push(o)}!t.keepIds&&n.size&&dt(r,n)}function ft(s){let t=s.parentNode;if(t){for(let e of[...s.childNodes])t.insertBefore(e,s);s.remove()}}function mt(s,t){let e=s;for(;e;){if(e===t)return!0;e=e.parentNode??e.parent??null}return!1}function U(s,t={}){let e=document.createElement("template");return s&&typeof s=="string"&&(e.innerHTML=s,O(e.content,{allowIncludeFile:!!t.allowIncludeFile,keepIds:!!t.keepIds,keepStyle:!!t.keepStyle})),e.content}var pt=()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches;function gt(s,t){let n=(()=>{try{return decodeURIComponent(location.hash.slice(1))}catch{return location.hash.slice(1)}})()===t;n||(location.hash=t);let r=s;typeof r.focus=="function"&&(r.tabIndex<0&&!r.hasAttribute("tabindex")&&r.setAttribute("tabindex","-1"),r.focus({preventScroll:!0})),(n||!r.matches?.(":target"))&&r.scrollIntoView({behavior:pt()?"auto":"smooth",block:"start"})}function D(s){let t=s;if(t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return!1;let n=(t.target instanceof Element?t.target:null)?.closest('a[href^="#"]');if(!n)return!1;let r=n.getAttribute("target");if(r&&r!=="_self"||n.hasAttribute("download"))return!1;let i=(n.getAttribute("href")??"").slice(1);if(!i)return!1;let o=i;try{o=decodeURIComponent(i)}catch{}let a=n.ownerDocument.getElementById(o);return a?(t.preventDefault(),gt(a,o),!0):!1}var q={search:"Search glossary terms","search-placeholder":"Search terms\u2026",terms:"Glossary terms",alphabet:"Alphabet navigation","found-one":"{count} term found","found-other":"{count} terms found","all-one":"Showing {count} term","all-other":"Showing all {count} terms",uncategorized:"Uncategorized","see-also":"See also:",error:"Could not load the glossary terms."},b="#",bt=0;function yt(s,t){let e=s.trim();if(!e)return"";if(typeof Intl.Segmenter=="function")try{for(let{segment:n}of new Intl.Segmenter(t,{granularity:"grapheme"}).segment(e))return n}catch{}return String.fromCodePoint(e.codePointAt(0))}function At(s,t){let e=yt(s,t);if(!e||!/^\p{L}/u.test(e))return b;try{return e.toLocaleUpperCase(t)}catch{return e.toUpperCase()}}function z(s,t){let e=new Map(s.map(r=>[String(r?.id??""),String(r?.term??"")])),n=document.createElement("dl");for(let r of s){if(!r||typeof r!="object")continue;let i=document.createElement("div");i.setAttribute("data-term-id",String(r.id??"")),r.category&&i.setAttribute("data-category",String(r.category));let o=document.createElement("dt");o.textContent=String(r.term??"");let a=document.createElement("dd");typeof r.definitionHtml=="string"&&r.definitionHtml?a.replaceChildren(U(r.definitionHtml)):a.textContent=String(r.definition??"");let d=Array.isArray(r.seeAlso)?r.seeAlso.map(String).filter(Boolean):[];if(d.length){let l=document.createElement("span");l.className="gloss-see-also",l.append(` ${t} `),d.forEach((u,m)=>{m&&l.append(", ");let f=document.createElement("a");f.href=`#${encodeURIComponent(u)}`,f.textContent=e.get(u)||u,l.append(f)}),l.append("."),a.append(l)}i.append(o,a),n.append(i)}return n}var S=class extends A{static get observedAttributes(){return["src","data-title","data-heading-level","searchable","lang"]}#r=`gloss-${++bt}`;#e=null;#n=[];#w=null;#o=null;#i=null;#c=null;#t=[];#l=[];#u=new Map;#b=new Map;#h=new Set;#d=new Set;#f="";#g=null;#y=null;#m=null;#v="";setup(){this.#f="",this.#h=new Set,this.#d=new Set;let t=this.getAttribute("src"),e=!!t&&t!==this.#y&&t!==this.#m;e&&this.#_(t),t?this.setAttribute("data-state",e?"loading":t===this.#m?"error":"ready"):this.removeAttribute("data-state");let n=this.querySelector(":scope > dl"),r=n?[...n.querySelectorAll(":scope > div[data-term-id]")]:[],i=!!t&&t===this.#m;if(r.length===0)return i&&this.#E(null),e||i;this.listen(this,"click",this.#L),this.listen(this,"click",D);let o=this.#p(),a=this.#s("uncategorized");this.#e={dl:n,wasHidden:n.hidden,items:r.map(c=>({el:c,attrs:Object.fromEntries(["id","class","hidden","data-letter"].map(h=>[h,c.getAttribute(h)]))}))};let d=0;this.#t=r.map(c=>{let h=c.getAttribute("data-term-id")||`${this.#r}-term-${++d}`,p=c.querySelector("dt"),y=c.querySelector("dd"),T=p?(p.textContent??"").trim():"",x="",N=[];if(y){let M=y.cloneNode(!0),w=M.querySelector(".gloss-see-also");w&&(N=[...w.querySelectorAll('a[href^="#"]')].map(V=>decodeURIComponent((V.getAttribute("href")??"").slice(1))),w.remove()),x=(M.textContent??"").replace(/\s+/g," ").trim()}return c.id=h,{id:h,term:T,definition:x,seeAlso:N,category:c.getAttribute("data-category")||"",el:c,letter:At(T,o)}});let l=this.#C({sensitivity:"base"}),u=[];for(let c of this.#t){if(c.letter===b)continue;let h=u.findIndex(p=>l.compare(p,c.letter)===0);h===-1?u.push(c.letter):u[h].normalize("NFD")!==u[h]&&c.letter.normalize("NFD")===c.letter&&(u[h]=c.letter)}for(let c of this.#t)c.letter!==b&&(c.letter=u.find(h=>l.compare(h,c.letter)===0)??c.letter);u.sort((c,h)=>l.compare(c,h)),this.#t.some(c=>c.letter===b)&&u.unshift(b);let m=new Set;this.#l=[];for(let c of this.#t)m.has(c.category)||(m.add(c.category),this.#l.push(c.category));let f=n;f.hidden=!0;let B=this.#x(),F=this.hasAttribute("searchable")?this.#N():null,H=this.#M(u),g=document.createElement("div");g.className="gloss-categories",g.id=`${this.#r}-categories`,g.setAttribute("role","region"),g.setAttribute("aria-label",this.#s("terms"));let j=this.#C({numeric:!0});for(let c of this.#l){let h=this.#t.filter(p=>p.category===c).sort((p,y)=>j.compare(p.term,y.term));g.append(this.#$(c,c||a,h))}let C=[B,F,H,g].filter(Boolean);return f.before(...C),this.#n.push(...C),i&&this.#E(f),this.#i=document.createElement("div"),this.#i.className="gloss-live-region",this.#i.setAttribute("role","status"),this.#i.setAttribute("aria-live","polite"),this.#i.setAttribute("aria-atomic","true"),this.append(this.#i),this.#n.push(this.#i),this.#S(),e||this.dispatchEvent(new CustomEvent("glossary-wc:ready",{bubbles:!0,detail:{termCount:this.#t.length,categories:this.#l.map(c=>c||a)}})),!0}teardown(){this.#c&&clearTimeout(this.#c),this.#c=null;let t=this.#e;if(t){for(let{el:e,attrs:n}of t.items){for(let[r,i]of Object.entries(n))i===null?e.removeAttribute(r):e.setAttribute(r,i);t.dl.append(e)}t.dl.hidden=t.wasHidden}for(let e of this.#n)e.remove();this.#e=null,this.#n=[],this.#w=null,this.#o=null,this.#i=null,this.#t=[],this.#l=[],this.#u=new Map,this.#b=new Map}get terms(){return this.#t.map(t=>({id:t.id,term:t.term,definition:t.definition,category:t.category||this.#s("uncategorized"),...t.seeAlso.length?{seeAlso:[...t.seeAlso]}:{}}))}set terms(t){let e=Array.isArray(t)?t:[];this.#e&&this.teardown();let n=z(e,this.#s("see-also")),r=this.querySelector(":scope > dl");r?r.replaceWith(n):this.append(n),this._reinit(),this.dispatchEvent(new CustomEvent("glossary-wc:terms-changed",{detail:{terms:e,source:"property"},bubbles:!0}))}#x(){let t=this.dataset.title||(this.getAttribute("src")===this.#y?this.#v:"");if(!t)return null;let e=Math.min(6,Math.max(1,parseInt(this.dataset.headingLevel||"2",10)||2)),n=document.createElement(`h${e}`);return n.className="gloss-title",n.append(t),this.#o=document.createElement("span"),this.#o.className="gloss-count",this.#o.setAttribute("aria-hidden","true"),this.#o.textContent=this.#a(this.#t.length),n.append(" ",this.#o),n}#N(){let t=document.createElement("search");t.className="gloss-search";let e=document.createElement("input");return e.type="search",e.className="gloss-search-input",e.setAttribute("placeholder",this.#s("search-placeholder")),e.setAttribute("aria-label",this.#s("search")),e.setAttribute("aria-controls",`${this.#r}-categories`),t.append(e),this.#w=e,this.listen(e,"input",this.#k),t}#M(t){let e=document.createElement("nav");e.className="gloss-jump-bar",e.setAttribute("aria-label",this.#s("alphabet"));for(let n of t){let r=document.createElement("a");r.className="gloss-jump-letter",r.textContent=n,r.dataset.letter=n,e.append(r),this.#b.set(n,r)}return e}#$(t,e,n){let r=this.#u.size+1,i=document.createElement("section");i.className="gloss-category",t&&i.setAttribute("data-category",t);let o=document.createElement("header");o.className="gloss-category-header";let a=document.createElement("button");a.type="button",a.className="gloss-category-toggle",a.setAttribute("aria-expanded","true"),a.setAttribute("aria-controls",`${this.#r}-cat-${r}`);let d=document.createElement("span");d.className="gloss-category-label",d.textContent=e;let l=document.createElement("span");l.className="gloss-category-count",l.setAttribute("aria-hidden","true"),l.textContent=this.#a(n.length);let u=document.createElement("span");u.className="gloss-chevron",u.setAttribute("aria-hidden","true"),a.append(d,l,u),o.append(a),i.append(o);let m=document.createElement("dl");m.className="gloss-term-list",m.id=`${this.#r}-cat-${r}`;for(let f of n)f.el.classList.add("gloss-term"),f.el.dataset.letter=f.letter,m.append(f.el);return i.append(m),this.#u.set(t,{section:i,toggle:a,list:m,count:l,els:n.map(f=>f.el)}),this.listen(a,"click",()=>{a.getAttribute("aria-expanded")!=="true"?(this.#h.delete(t),this.#d.delete(t)):(this.#h.add(t),this.#f&&this.#d.add(t)),this.#A(t)}),i}#E(t){let e=document.createElement("p");e.className="gloss-error",e.setAttribute("role","alert"),e.textContent=this.#s("error"),t?t.before(e):this.append(e),this.#n.push(e)}#A(t){let e=this.#u.get(t);if(!e)return;let n=e.els.filter(i=>!i.hidden).length;e.section.hidden=n===0,e.count.textContent=this.#a(n);let r=this.#f?!this.#d.has(t):!this.#h.has(t);e.list.hidden=!r,e.toggle.setAttribute("aria-expanded",String(r))}#S(){let t=this.#I();for(let[e,n]of this.#b){let r=t.find(i=>i.letter===e&&!i.el.hidden);r?(n.href=`#${encodeURIComponent(r.id)}`,n.setAttribute("data-active",""),n.removeAttribute("aria-disabled"),n.removeAttribute("role")):(n.removeAttribute("href"),n.removeAttribute("data-active"),n.setAttribute("role","link"),n.setAttribute("aria-disabled","true"))}}#I(){let t=new Map(this.#t.map(e=>[e.el,e]));return[...this.#u.values()].flatMap(e=>e.els).map(e=>t.get(e))}#L=t=>{let n=(t.target instanceof Element?t.target:null)?.closest("a");if(!n||!this.contains(n))return;if(n.getAttribute("aria-disabled")==="true"){t.preventDefault();return}let r=n.getAttribute("href");if(!r?.startsWith("#"))return;let i=r.slice(1);try{i=decodeURIComponent(i)}catch{}let o=document.getElementById(i);if(!(!o||!this.contains(o)))for(let[a,d]of this.#u)d.list.contains(o)&&d.list.hidden&&(this.#h.delete(a),this.#d.delete(a),this.#A(a))};#k=t=>{this.#c&&clearTimeout(this.#c);let e=t.target;this.#c=setTimeout(()=>this.#R(e.value),150)};#R(t){let e=this.#p(),n=l=>{try{return l.toLocaleLowerCase(e)}catch{return l.toLowerCase()}},r=n(t.trim()),i=r!==this.#f;this.#f=r,i&&(this.#d=new Set);let o=0;for(let l of this.#t){let u=r===""||n(l.term).includes(r)||n(l.definition).includes(r);l.el.hidden=!u,u&&o++}for(let l of this.#l)this.#A(l);this.#S(),this.#o&&(this.#o.textContent=r===""?this.#a(this.#t.length):`${this.#a(o)} / ${this.#a(this.#t.length)}`);let a=r===""?this.#T("all",this.#t.length):this.#T("found",o),d=this.#i;d&&(d.textContent="",requestAnimationFrame(()=>{d.textContent=a})),this.dispatchEvent(new CustomEvent("glossary-wc:search",{bubbles:!0,detail:{query:r,matchCount:o}}))}attributeChangedCallback(t,e,n){e===n||!this.isConnected||(t==="src"||this.hasAttribute("data-upgraded"))&&this._reinit()}async#_(t){if(this.#g===t)return;this.#g=t;let e,n=null;try{let o=await fetch(t);if(!o.ok)throw new Error(`HTTP ${o.status}`);if(e=await o.json(),!e||!Array.isArray(e.terms))throw new Error("Expected { terms: [...] }")}catch(o){n=o}if(this.#g!==t||(this.#g=null,this.getAttribute("src")!==t))return;if(n){console.warn(`[glossary-wc] Failed to load src="${t}":`,n),this.#m=t,this.dispatchEvent(new CustomEvent("glossary-wc:error",{bubbles:!0,detail:{url:t,error:n}})),this._reinit();return}this.#y=t,this.#m=null,this.#e&&this.teardown();let r=z(e.terms,this.#s("see-also")),i=this.querySelector(":scope > dl");i?i.replaceWith(r):this.append(r),this.#v=e.title?String(e.title):"",this._reinit()}#p(){return this.closest("[lang]")?.getAttribute("lang")||void 0}#C(t){try{return new Intl.Collator(this.#p(),t)}catch{return new Intl.Collator(void 0,t)}}#a(t){try{return new Intl.NumberFormat(this.#p()).format(t)}catch{return String(t)}}#s(t){return this.getAttribute(`data-label-${t}`)??q[t]??""}#T(t,e){let n="other";try{n=new Intl.PluralRules(this.#p()).select(e)}catch{}return(this.getAttribute(`data-label-${t}-${n}`)??q[`${t}-${n}`]??this.#s(`${t}-other`)).replaceAll("{count}",this.#a(e))}};I("glossary-wc",S);export{S as GlossaryWc};
|
|
2
2
|
//# sourceMappingURL=glossary-wc.js.map
|