vanilla-breeze 0.1.3 → 0.2.0
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 +25084 -6649
- package/dist/cdn/components/accessibility-specimen.js +11 -0
- package/dist/cdn/components/accordion-wc.js +1 -1
- package/dist/cdn/components/activity-feed.js +2 -0
- package/dist/cdn/components/adr-wc.js +17 -17
- package/dist/cdn/components/ai-chat.js +28 -0
- package/dist/cdn/components/ai-summary.js +10 -0
- package/dist/cdn/components/analytics-panel.js +5 -5
- package/dist/cdn/components/audio-player.js +3 -3
- 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 +2 -0
- package/dist/cdn/components/breakpoint-specimen.js +26 -0
- package/dist/cdn/components/burndown-chart.js +2 -0
- package/dist/cdn/components/calendar-wc.js +2 -2
- package/dist/cdn/components/capacity-plan.js +25 -0
- 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 +2 -2
- package/dist/cdn/components/chart-wc.js +58 -36
- package/dist/cdn/components/chat-input.js +1 -1
- package/dist/cdn/components/chat-window.js +1 -1
- package/dist/cdn/components/color-palette.js +9 -9
- 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 +60 -0
- package/dist/cdn/components/comment-thread.js +60 -0
- package/dist/cdn/components/comment-wc.js +1 -1
- package/dist/cdn/components/compare-surface.js +1 -1
- package/dist/cdn/components/component-sampler.js +2 -2
- 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 +3 -0
- 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/empathy-map.js +41 -43
- package/dist/cdn/components/flow-diagram.js +1 -1
- package/dist/cdn/components/font-pairer.js +81 -81
- package/dist/cdn/components/foot-notes.js +1 -1
- package/dist/cdn/components/form-field.js +1 -1
- package/dist/cdn/components/gantt-chart.js +1 -1
- package/dist/cdn/components/geo-map.js +25 -23
- package/dist/cdn/components/glossary-index.js +1 -1
- package/dist/cdn/components/glossary-wc.js +1 -1
- package/dist/cdn/components/gradient-builder.js +29 -29
- package/dist/cdn/components/heading-links.js +1 -1
- package/dist/cdn/components/highlight-wc.js +2 -2
- package/dist/cdn/components/icon-wc.js +4 -4
- package/dist/cdn/components/image-gallery.js +1 -1
- package/dist/cdn/components/image-map.js +1 -1
- package/dist/cdn/components/impact-effort.js +1 -1
- package/dist/cdn/components/include-file.js +1 -1
- package/dist/cdn/components/iron-triangle.js +2 -0
- package/dist/cdn/components/kanban-board.js +1 -1
- package/dist/cdn/components/layout-specimen.js +35 -0
- package/dist/cdn/components/manifest.json +227 -103
- package/dist/cdn/components/markdown-editor.js +1 -1
- package/dist/cdn/components/markdown-viewer.js +12 -12
- package/dist/cdn/components/motion-specimen.js +12 -12
- package/dist/cdn/components/nav-bar.js +2 -0
- package/dist/cdn/components/note-wc.js +2 -2
- package/dist/cdn/components/notification-wc.js +4 -4
- package/dist/cdn/components/page-info.js +4 -4
- 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 +6 -6
- package/dist/cdn/components/pager-wc.js +2 -0
- package/dist/cdn/components/palette-generator.js +11 -11
- package/dist/cdn/components/poll-wc.js +2 -0
- package/dist/cdn/components/pop-over.js +2 -0
- package/dist/cdn/components/popularity-index.js +2 -2
- package/dist/cdn/components/print-page.js +1 -1
- package/dist/cdn/components/product-roadmap.js +3 -0
- package/dist/cdn/components/progress-tracker.js +2 -0
- package/dist/cdn/components/qr-code.js +1 -1
- package/dist/cdn/components/quadrant-grid.js +3 -0
- package/dist/cdn/components/quality-target.js +12 -0
- package/dist/cdn/components/reaction-bar.js +2 -0
- package/dist/cdn/components/reader-view.js +3 -3
- package/dist/cdn/components/reading-progress.js +2 -0
- package/dist/cdn/components/recently-visited.js +10 -10
- package/dist/cdn/components/requirement-card.js +122 -0
- package/dist/cdn/components/review-surface.js +34 -40
- package/dist/cdn/components/risk-register.js +25 -0
- package/dist/cdn/components/roadmap.js +3 -0
- package/dist/cdn/components/score-card.js +197 -0
- package/dist/cdn/components/selection-menu.js +1 -1
- package/dist/cdn/components/semantic-palette.js +15 -15
- package/dist/cdn/components/settings-panel.js +12 -12
- 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 +4 -4
- package/dist/cdn/components/site-map-wc.js +1 -1
- package/dist/cdn/components/site-map.js +1 -1
- package/dist/cdn/components/site-search.js +9 -9
- package/dist/cdn/components/slide-accept.js +1 -1
- package/dist/cdn/components/social-embed.js +1 -1
- package/dist/cdn/components/spacing-specimen.js +5 -5
- 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 +2 -0
- package/dist/cdn/components/stepper-wc.js +2 -0
- package/dist/cdn/components/story-map.js +1 -1
- package/dist/cdn/components/tab-set.js +1 -1
- package/dist/cdn/components/text-reader.js +2 -2
- package/dist/cdn/components/theme-catalog.js +28 -0
- package/dist/cdn/components/theme-export.js +20 -12
- package/dist/cdn/components/theme-import.js +44 -0
- package/dist/cdn/components/theme-picker.js +29 -26
- package/dist/cdn/components/time-index.js +2 -2
- package/dist/cdn/components/time-picker.js +1 -1
- package/dist/cdn/components/toast-msg.js +3 -3
- package/dist/cdn/components/token-specimen.js +14 -14
- package/dist/cdn/components/tool-tip.js +1 -1
- package/dist/cdn/components/topic-map.js +3 -3
- package/dist/cdn/components/traceability-matrix.js +3 -0
- package/dist/cdn/components/trust-filter.js +3 -3
- package/dist/cdn/components/type-specimen.js +15 -15
- package/dist/cdn/components/user-journey.js +63 -70
- package/dist/cdn/components/user-persona.js +75 -13
- package/dist/cdn/components/user-story.js +12 -11
- package/dist/cdn/components/version-switcher.js +17 -0
- package/dist/cdn/components/video-player.js +3 -3
- package/dist/cdn/components/watch-wc.js +2 -2
- package/dist/cdn/components/week-view.js +1 -1
- package/dist/cdn/components/work-item.js +29 -28
- package/dist/cdn/components/youtube-player.js +1 -1
- package/dist/cdn/icons/bold.css +17 -0
- package/dist/cdn/icons/bold.json +1 -0
- package/dist/cdn/icons/custom.css +6 -0
- package/dist/cdn/icons/custom.json +1 -0
- package/dist/cdn/icons/lucide.css +1914 -0
- package/dist/cdn/icons/lucide.json +1 -0
- package/dist/cdn/icons/mage.css +17 -0
- package/dist/cdn/icons/mage.json +1 -0
- package/dist/cdn/icons/phosphor.css +17 -0
- package/dist/cdn/icons/phosphor.json +1 -0
- package/dist/cdn/icons/tabler.css +17 -0
- package/dist/cdn/icons/tabler.json +1 -0
- package/dist/cdn/packs/design-system.full.js +59 -51
- package/dist/cdn/packs/effects.full.js +1 -1
- package/dist/cdn/packs/icons.effects.js +1 -1
- package/dist/cdn/packs/icons.full.js +1 -1
- package/dist/cdn/packs/kawaii.full.css +1 -1
- package/dist/cdn/packs/kawaii.full.js +6 -6
- package/dist/cdn/packs/kawaii.theme.css +1 -1
- package/dist/cdn/packs/manifest.json +11 -11
- package/dist/cdn/packs/ui.full.css +1 -1
- package/dist/cdn/packs/ui.full.js +54 -51
- package/dist/cdn/packs/ux-planning.full.css +1 -1
- package/dist/cdn/packs/ux-planning.full.js +318 -243
- package/dist/cdn/themes/8bit.css +1 -1
- package/dist/cdn/themes/8bit.tokens.json +662 -0
- package/dist/cdn/themes/alpha1999-dark.tokens.json +693 -0
- package/dist/cdn/themes/alpha1999.css +1 -1
- package/dist/cdn/themes/alpha1999.tokens.json +869 -0
- package/dist/cdn/themes/anthropic.css +2 -0
- package/dist/cdn/themes/anthropic.tokens.json +564 -0
- package/dist/cdn/themes/art-deco-dark.tokens.json +407 -0
- package/dist/cdn/themes/art-deco.css +1 -1
- package/dist/cdn/themes/art-deco.tokens.json +581 -0
- package/dist/cdn/themes/bauhaus-dark.tokens.json +260 -0
- package/dist/cdn/themes/bauhaus.css +1 -1
- package/dist/cdn/themes/bauhaus.tokens.json +589 -0
- package/dist/cdn/themes/brutalist-dark.tokens.json +503 -0
- package/dist/cdn/themes/brutalist.tokens.json +677 -0
- package/dist/cdn/themes/catalog/atlassian.tokens.json +303 -0
- package/dist/cdn/themes/catalog/bootstrap.tokens.json +304 -0
- package/dist/cdn/themes/catalog/carbon.tokens.json +301 -0
- package/dist/cdn/themes/catalog/catppuccin-mocha.tokens.json +301 -0
- package/dist/cdn/themes/catalog/govuk.tokens.json +301 -0
- package/dist/cdn/themes/catalog/manifest.json +132 -0
- package/dist/cdn/themes/catalog/material.tokens.json +289 -0
- package/dist/cdn/themes/catalog/salesforce.tokens.json +301 -0
- package/dist/cdn/themes/catalog/tailwind.tokens.json +302 -0
- package/dist/cdn/themes/catppuccin-frappe.css +1 -1
- package/dist/cdn/themes/catppuccin-frappe.tokens.json +608 -0
- package/dist/cdn/themes/catppuccin-latte-dark.tokens.json +472 -0
- package/dist/cdn/themes/catppuccin-latte.css +1 -1
- package/dist/cdn/themes/catppuccin-latte.tokens.json +608 -0
- package/dist/cdn/themes/catppuccin-macchiato.css +1 -1
- package/dist/cdn/themes/catppuccin-macchiato.tokens.json +608 -0
- package/dist/cdn/themes/catppuccin-mocha.tokens.json +608 -0
- package/dist/cdn/themes/classic-dark.tokens.json +503 -0
- package/dist/cdn/themes/classic.tokens.json +640 -0
- package/dist/cdn/themes/claymorphism-dark.tokens.json +493 -0
- package/dist/cdn/themes/claymorphism.css +1 -1
- package/dist/cdn/themes/claymorphism.tokens.json +626 -0
- package/dist/cdn/themes/clinical-dark.tokens.json +472 -0
- package/dist/cdn/themes/clinical.tokens.json +608 -0
- package/dist/cdn/themes/cottagecore-dark.tokens.json +412 -0
- package/dist/cdn/themes/cottagecore.css +1 -1
- package/dist/cdn/themes/cottagecore.tokens.json +544 -0
- package/dist/cdn/themes/cyber.tokens.json +668 -0
- package/dist/cdn/themes/dawn-dark.tokens.json +472 -0
- package/dist/cdn/themes/dawn.css +1 -1
- package/dist/cdn/themes/dawn.tokens.json +608 -0
- package/dist/cdn/themes/dracula.tokens.json +534 -0
- package/dist/cdn/themes/dusk.tokens.json +533 -0
- package/dist/cdn/themes/editorial-dark.tokens.json +400 -0
- package/dist/cdn/themes/editorial.tokens.json +690 -0
- package/dist/cdn/themes/financial-dark.tokens.json +472 -0
- package/dist/cdn/themes/financial.css +1 -1
- package/dist/cdn/themes/financial.tokens.json +607 -0
- package/dist/cdn/themes/genai.tokens.json +534 -0
- package/dist/cdn/themes/glassmorphism-dark.tokens.json +489 -0
- package/dist/cdn/themes/glassmorphism.css +1 -1
- package/dist/cdn/themes/glassmorphism.tokens.json +632 -0
- package/dist/cdn/themes/government-dark.tokens.json +472 -0
- package/dist/cdn/themes/government.tokens.json +608 -0
- package/dist/cdn/themes/gruvbox-dark.tokens.json +472 -0
- package/dist/cdn/themes/gruvbox.tokens.json +608 -0
- package/dist/cdn/themes/high-noon-dark.tokens.json +397 -0
- package/dist/cdn/themes/high-noon.tokens.json +533 -0
- package/dist/cdn/themes/ibm.css +2 -0
- package/dist/cdn/themes/ibm.tokens.json +568 -0
- package/dist/cdn/themes/kawaii-dark.tokens.json +549 -0
- package/dist/cdn/themes/kawaii.css +1 -1
- package/dist/cdn/themes/kawaii.tokens.json +641 -0
- package/dist/cdn/themes/magna-dark.tokens.json +482 -0
- package/dist/cdn/themes/magna.css +1 -1
- package/dist/cdn/themes/magna.tokens.json +632 -0
- package/dist/cdn/themes/manifest.json +162 -62
- package/dist/cdn/themes/mcdonalds.css +2 -0
- package/dist/cdn/themes/mcdonalds.tokens.json +533 -0
- package/dist/cdn/themes/midnight.tokens.json +534 -0
- package/dist/cdn/themes/minimal-dark.tokens.json +294 -0
- package/dist/cdn/themes/minimal.tokens.json +494 -0
- package/dist/cdn/themes/modern-dark.tokens.json +490 -0
- package/dist/cdn/themes/modern.tokens.json +573 -0
- package/dist/cdn/themes/nes-dark.tokens.json +564 -0
- package/dist/cdn/themes/nes.css +1 -1
- package/dist/cdn/themes/nes.tokens.json +687 -0
- package/dist/cdn/themes/neumorphism-dark.tokens.json +471 -0
- package/dist/cdn/themes/neumorphism.css +1 -1
- package/dist/cdn/themes/neumorphism.tokens.json +589 -0
- package/dist/cdn/themes/nord-dark.tokens.json +484 -0
- package/dist/cdn/themes/nord.tokens.json +619 -0
- package/dist/cdn/themes/organic-dark.tokens.json +532 -0
- package/dist/cdn/themes/organic.tokens.json +685 -0
- package/dist/cdn/themes/rose-pine-dark.tokens.json +472 -0
- package/dist/cdn/themes/rose-pine.tokens.json +608 -0
- package/dist/cdn/themes/rough-dark.tokens.json +515 -0
- package/dist/cdn/themes/rough.css +1 -1
- package/dist/cdn/themes/rough.tokens.json +650 -0
- package/dist/cdn/themes/solarized-dark.tokens.json +397 -0
- package/dist/cdn/themes/solarized.tokens.json +532 -0
- package/dist/cdn/themes/starbucks.css +2 -0
- package/dist/cdn/themes/starbucks.tokens.json +593 -0
- package/dist/cdn/themes/startup-dark.tokens.json +522 -0
- package/dist/cdn/themes/startup.css +1 -1
- package/dist/cdn/themes/startup.tokens.json +607 -0
- package/dist/cdn/themes/super2026-dark.tokens.json +667 -0
- package/dist/cdn/themes/super2026.tokens.json +863 -0
- package/dist/cdn/themes/swiss-dark.tokens.json +390 -0
- package/dist/cdn/themes/swiss.tokens.json +750 -0
- package/dist/cdn/themes/terminal.css +1 -1
- package/dist/cdn/themes/terminal.tokens.json +689 -0
- package/dist/cdn/themes/tokyo-night-dark.tokens.json +472 -0
- package/dist/cdn/themes/tokyo-night.tokens.json +608 -0
- package/dist/cdn/themes/vaporwave-dark.tokens.json +413 -0
- package/dist/cdn/themes/vaporwave.tokens.json +549 -0
- package/dist/cdn/themes/win9x-dark.tokens.json +563 -0
- package/dist/cdn/themes/win9x.tokens.json +700 -0
- package/dist/cdn/vanilla-breeze-charts.css +1 -1
- package/dist/cdn/vanilla-breeze-charts.js +58 -36
- package/dist/cdn/vanilla-breeze-core.css +1 -1
- package/dist/cdn/vanilla-breeze-core.js +246 -51
- package/dist/cdn/vanilla-breeze-dev.js +1 -1
- package/dist/cdn/vanilla-breeze-extras.js +90 -80
- package/dist/cdn/vanilla-breeze.css +1 -1
- package/dist/cdn/vanilla-breeze.js +1370 -405
- package/package.json +12 -4
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var u=window.matchMedia("(prefers-reduced-motion: reduce)");var c=new Map;function d(s,t,e={}){let i=e.priority??10,a={impl:t,bundle:e.bundle,contract:e.contract,priority:i},r=c.get(s);if(customElements.get(s)){if(!r||r.priority>=i){r&&r.priority===i&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=i){r.priority===i&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}c.set(s,a),customElements.define(s,t)}var n=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,i,a){t.addEventListener(e,i,a),this.#t.push(()=>t.removeEventListener(e,i,a))}setup(){}teardown(){}setState(t,e){this.#e||(this.#e=this.attachInternals());let i=this.#e.states;try{e?i.add(t):i.delete(t)}catch{let a=`--${t}`;e?i.add(a):i.delete(a)}}_adoptInternals(t){this.#e||(this.#e=t)}};var l=new Set(["live","recording","streaming","error","online","running","away","paused","busy","offline","stopped"]),o=class extends n{static observedAttributes=["data-variant","data-live"];#t;setup(){let t=document.createElement("span");for(t.className="status-dot",t.setAttribute("aria-hidden","true"),this.#t=document.createElement("span"),this.#t.className="status-label";this.firstChild;)this.#t.appendChild(this.firstChild);this.appendChild(t),this.appendChild(this.#t),this.#e(),this.#i(),this.#s()}attributeChangedCallback(t,e,i){!this.isConnected||e===i||(t==="data-variant"?(this.#i(),this.dispatchEvent(new CustomEvent("status-wc:change",{bubbles:!0,detail:{variant:i,previousVariant:e}}))):t==="data-live"&&this.#e())}#e(){this.getAttribute("data-live")==="off"?(this.removeAttribute("role"),this.removeAttribute("aria-live")):(this.hasAttribute("role")||this.setAttribute("role","status"),this.hasAttribute("aria-live")||this.setAttribute("aria-live","polite"))}#i(){let t=this.getAttribute("data-variant");t&&(l.has(t)||this.#r(t)||console.info(`[status-wc] data-variant="${t}" is not a built-in; add a CSS rule (status-wc[data-variant="${t}"] { --status-dot-color: \u2026; }) or use a built-in.`))}#r(t){let e=this.querySelector(".status-dot");if(!e)return!0;let i=getComputedStyle(e).getPropertyValue("--status-dot-color").trim();return i&&i!==""}#s(){let t=this.#t?.textContent.trim(),e=this.hasAttribute("aria-label");!t&&!e&&console.warn("[status-wc] needs slot text or aria-label for accessibility.")}get variant(){return this.getAttribute("data-variant")}set variant(t){t?this.setAttribute("data-variant",t):this.removeAttribute("data-variant")}};d("status-wc",o);export{o as StatusWc};
|
|
2
|
+
//# sourceMappingURL=status-wc.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var k=window.matchMedia("(prefers-reduced-motion: reduce)");var m=new Map;function b(r,t,e={}){let i=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:i},n=m.get(r);if(customElements.get(r)){if(!n||n.priority>=i){n&&n.priority===i&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=i){n.priority===i&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${n.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}m.set(r,s),customElements.define(r,t)}var l=class extends HTMLElement{#r=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#r)t();this.#r=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,s){t.addEventListener(e,i,s),this.#r.push(()=>t.removeEventListener(e,i,s))}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let i=this.#t.states;try{e?i.add(t):i.delete(t)}catch{let s=`--${t}`;e?i.add(s):i.delete(s)}}_adoptInternals(t){this.#t||(this.#t=t)}};var g='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><line x1="5" y1="12" x2="19" y2="12"/></svg>',v='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>';function y(r){if(!r)return[];let t=r.trim();if(t.startsWith("["))try{return JSON.parse(t).map(i=>({value:String(i.value),label:String(i.label??i.value)}))}catch{return[]}return t.split(",").map(e=>{let i=e.trim();return{value:i,label:i}})}function x(r){return r?r.split(",").map(t=>t.trim()).filter(Boolean):[]}function A(r){let t=Math.max(0,Math.round(r)),e=Math.floor(t/3600),i=Math.floor(t%3600/60),s=t%60,n=a=>String(a).padStart(2,"0");return e>0?`${e}:${n(i)}:${n(s)}`:`${i}:${n(s)}`}function S(r,t){let e=Number(r)||0,i=["B","KB","MB","GB","TB","PB"],s=0,n=Math.abs(e);for(;n>=1e3&&s<i.length-1;)n/=1e3,s+=1;let a=new Intl.NumberFormat(t,{minimumFractionDigits:s===0?0:1,maximumFractionDigits:s===0?0:2});return`${e<0?"-":""}${a.format(n)} ${i[s]}`}function w(){return document.documentElement.lang||void 0}function d(r){let t=String(r),e=t.indexOf(".");return e<0?0:t.length-e-1}var f=class extends l{static formAssociated=!0;static observedAttributes=["value","disabled","readonly"];#r;#t;#n=-1/0;#a=1/0;#b=1;#h=[];#s=[];#o;#M;#d="";#$=!1;#C=!1;#p;#i;#F;#e;#g;#y;#u;#l;#w;#x=0;#v=0;#k=!1;#N=!1;constructor(){super(),this.#r=this.attachInternals(),this._adoptInternals(this.#r)}setup(){this.#O(),this.#q(),this.#H();let t=this.getAttribute("value");this.#F=t,this.#c(t??this.#A(),"init")}attributeChangedCallback(t,e,i){!this.isConnected||!this.#e||(t==="value"?this.#c(i??this.#A(),"attr"):(t==="disabled"||t==="readonly")&&this.#B())}#O(){this.hasAttribute("data-options")?this.#t="enum":this.hasAttribute("data-values")?this.#t="token":this.hasAttribute("data-format")||this.hasAttribute("data-suffix")?this.#t="formatted":(this.#t="numeric",console.info('[stepper-wc] No mode attribute set. Plain numeric stepping is better served by `<input type="number" data-stepper>`. See /docs/concepts/numeric-inputs/'))}#q(){this.#n=this.hasAttribute("data-min")?Number(this.getAttribute("data-min")):-1/0,this.#a=this.hasAttribute("data-max")?Number(this.getAttribute("data-max")):1/0,this.#b=Number(this.getAttribute("data-step"))||1,this.#h=x(this.getAttribute("data-values")),this.#s=y(this.getAttribute("data-options")),this.#o=this.getAttribute("data-format")||(this.hasAttribute("data-suffix")?"number":null),this.#M=this.getAttribute("data-currency")||"USD",this.#d=this.getAttribute("data-suffix")||"",this.#$=this.hasAttribute("data-show-label"),this.#C=this.hasAttribute("data-accelerate"),this.#p=w(),this.#w=this.#P()}#P(){if(!this.#o)return null;let t=d(this.#b);return this.#o==="number"?new Intl.NumberFormat(this.#p,{minimumFractionDigits:t,maximumFractionDigits:t}):this.#o==="currency"?new Intl.NumberFormat(this.#p,{style:"currency",currency:this.#M}):this.#o==="percent"?new Intl.NumberFormat(this.#p,{style:"percent",minimumFractionDigits:t,maximumFractionDigits:t}):null}#A(){return this.#t==="enum"?this.#s[0]?.value??"":this.#t==="token"?this.#h[0]??"":"0"}#H(){this.replaceChildren(),this.#u=document.createElement("button"),this.#u.type="button",this.#u.className="stepper-dec",this.#u.setAttribute("aria-label","Decrease"),this.#u.setAttribute("tabindex","-1"),this.#u.innerHTML=g,this.#l=document.createElement("button"),this.#l.type="button",this.#l.className="stepper-inc",this.#l.setAttribute("aria-label","Increase"),this.#l.setAttribute("tabindex","-1"),this.#l.innerHTML=v,this.#e=document.createElement("span"),this.#e.className="stepper-value",this.#e.setAttribute("role","spinbutton"),this.#e.setAttribute("tabindex","0"),this.#g=document.createElement("span"),this.#g.className="stepper-value-display",this.#e.appendChild(this.#g),this.#y=new Set;for(let t of this.#V())this.#I(t);this.appendChild(this.#u),this.appendChild(this.#e),this.appendChild(this.#l),this.#D(this.#u,-1),this.#D(this.#l,1),this.listen(this.#e,"keydown",this.#R),this.#B()}#D(t,e){if(this.listen(t,"click",s=>{if(this.#N){this.#N=!1,s.preventDefault();return}this.#f(e,1)}),!this.#C)return;this.listen(t,"pointerdown",s=>{let n=s;n.pointerType==="mouse"&&n.button!==0||this.#E()||(this.#k=!1,this.#x=window.setTimeout(()=>{this.#k=!0,this.#v=window.setInterval(()=>this.#f(e,1),100),this.#x=window.setTimeout(()=>{window.clearInterval(this.#v),this.#v=window.setInterval(()=>this.#f(e,5),50)},1e3)},500))});let i=()=>{window.clearTimeout(this.#x),window.clearInterval(this.#v),this.#x=0,this.#v=0,this.#k&&(this.#N=!0)};this.listen(t,"pointerup",i),this.listen(t,"pointerleave",i),this.listen(t,"pointercancel",i)}#R=t=>{if(!this.#E())switch(t.key){case"ArrowUp":case"ArrowRight":t.preventDefault(),this.#f(1,1);break;case"ArrowDown":case"ArrowLeft":t.preventDefault(),this.#f(-1,1);break;case"PageUp":t.preventDefault(),this.#f(1,10);break;case"PageDown":t.preventDefault(),this.#f(-1,10);break;case"Home":t.preventDefault(),this.#T("min");break;case"End":t.preventDefault(),this.#T("max");break;default:}};#E(){return this.hasAttribute("disabled")||this.hasAttribute("readonly")}#B(){let t=this.hasAttribute("disabled");this.#u.disabled=t,this.#l.disabled=t,this.#e.setAttribute("aria-disabled",String(t)),t?this.#e.removeAttribute("tabindex"):this.#e.setAttribute("tabindex","0")}#f(t,e){if(this.#E())return;let i=this.#U(t,e);i===null||i===this.#i||this.#c(i,"step")}#T(t){if(this.#t==="enum"){let i=t==="min"?0:this.#s.length-1;this.#c(this.#s[i]?.value,"step");return}if(this.#t==="token"){let i=t==="min"?0:this.#h.length-1;this.#c(this.#h[i],"step");return}let e=t==="min"?this.#n===-1/0?this.#i:this.#n:this.#a===1/0?this.#i:this.#a;this.#c(String(e),"step")}#U(t,e){if(this.#t==="enum"){let h=this.#s.findIndex(p=>p.value===this.#i),o=h===-1?0:h,c=Math.min(this.#s.length-1,Math.max(0,o+t*e));return this.#s[c]?.value}if(this.#t==="token"){let o=this.#S(this.#i);o===-1&&(o=this.#j(this.#i));let c=Math.min(this.#h.length-1,Math.max(0,o+t*e));return this.#h[c]}let i=Number(this.#i)||0,s=d(this.#b),n=i+t*this.#b*e,a=Number(n.toFixed(s)),u=Math.min(this.#a,Math.max(this.#n,a));return String(u)}#S(t){if(t==null)return-1;let e=this.#h.indexOf(String(t));if(e!==-1)return e;let i=Number(t);if(Number.isFinite(i)){let s=this.#h.findIndex(n=>Number(n)===i);if(s!==-1)return s}return-1}#j(t){let e=Number(t);if(!Number.isFinite(e))return 0;let i=0,s=1/0;return this.#h.forEach((n,a)=>{let u=Number(n);if(!Number.isFinite(u))return;let h=Math.abs(u-e);h<s&&(s=h,i=a)}),i}#c(t,e){let i=this.#G(t),s=i!==this.#i;this.#i=i,this.getAttribute("value")!==String(i)&&this.setAttribute("value",String(i)),this.#z(),this.#K(),this.#J(),this.#W(),this.#Q(),s&&e!=="init"&&(this.dispatchEvent(new Event("input",{bubbles:!0})),this.dispatchEvent(new Event("change",{bubbles:!0})))}#G(t){if(t==null)return this.#A();if(this.#t==="enum"){let s=String(t);return this.#s.find(a=>a.value===s)?s:this.#s[0]?.value??""}if(this.#t==="token")return String(t);let e=Number(t);if(!Number.isFinite(e))return String(this.#n===-1/0?0:this.#n);let i=d(this.#b);return String(Number(Math.min(this.#a,Math.max(this.#n,e)).toFixed(i)))}#z(){let t=this.#m();this.#g.textContent=t,this.#I(t)}#m(t=this.#i){if(this.#t==="enum")return this.#s.find(i=>i.value===t)?.label??t??"";if(this.#t==="token"){let e=this.#$?String(t).replace(/^--/,""):String(t);return this.#d?`${e}${this.#d}`:e}if(this.#t==="formatted"){let e=Number(t)||0;if(this.#o==="duration")return A(e);if(this.#o==="bytes")return S(e,this.#p);if(this.#w){let i=this.#o==="percent"?e/100:e,s=this.#w.format(i);return this.#d&&this.#o==="number"?`${s}${this.#d}`:s}return this.#d?`${e}${this.#d}`:String(e)}return String(t??"")}#V(){if(this.#t==="enum")return this.#s.map(i=>this.#m(i.value));if(this.#t==="token")return this.#h.map(i=>this.#m(i));let t=new Set,e=i=>{Number.isFinite(i)&&t.add(i)};if(this.#n!==-1/0&&e(this.#n),this.#a!==1/0&&e(this.#a),e(Number(this.getAttribute("value"))||0),this.#a===1/0){let i=[10,100,1e3,1e4];for(let s of i)e(s);if(this.#o==="bytes")for(let s of[999,999e3,999e6,999e9])e(s)}return[...t].map(i=>this.#m(String(i)))}#I(t){let e=String(t??"");if(!e||this.#y.has(e))return;this.#y.add(e);let i=document.createElement("span");i.className="stepper-value-reserve",i.setAttribute("aria-hidden","true"),i.textContent=e,this.#e.appendChild(i)}recomputeWidth(){if(this.#e){this.#e.querySelectorAll(".stepper-value-reserve").forEach(t=>t.remove()),this.#y=new Set;for(let t of this.#V())this.#I(t)}}#K(){if(this.#t==="enum"){let e=this.#s.findIndex(i=>i.value===this.#i);this.#e.setAttribute("aria-valuemin","1"),this.#e.setAttribute("aria-valuemax",String(this.#s.length)),this.#e.setAttribute("aria-valuenow",String((e===-1?0:e)+1)),this.#e.setAttribute("aria-valuetext",this.#m());return}if(this.#t==="token"){let e=this.#S(this.#i);this.#e.setAttribute("aria-valuemin","1"),this.#e.setAttribute("aria-valuemax",String(this.#h.length)),this.#e.setAttribute("aria-valuenow",String((e===-1?0:e)+1)),this.#e.setAttribute("aria-valuetext",this.#m());return}let t=Number(this.#i)||0;this.#n!==-1/0?this.#e.setAttribute("aria-valuemin",String(this.#n)):this.#e.removeAttribute("aria-valuemin"),this.#a!==1/0?this.#e.setAttribute("aria-valuemax",String(this.#a)):this.#e.removeAttribute("aria-valuemax"),this.#e.setAttribute("aria-valuenow",String(t)),this.#e.setAttribute("aria-valuetext",this.#m())}#J(){let t=this.#L(),e=this.#_();this.#u.disabled=t||this.hasAttribute("disabled"),this.#l.disabled=e||this.hasAttribute("disabled")}#L(){return this.#t==="enum"?this.#i===this.#s[0]?.value:this.#t==="token"?this.#S(this.#i)===0:this.#n!==-1/0&&Number(this.#i)<=this.#n}#_(){return this.#t==="enum"?this.#i===this.#s[this.#s.length-1]?.value:this.#t==="token"?this.#S(this.#i)===this.#h.length-1:this.#a!==1/0&&Number(this.#i)>=this.#a}#W(){this.#r.setFormValue(String(this.#i??""))}#Q(){this.setState("at-min",this.#L()),this.setState("at-max",this.#_())}formResetCallback(){this.#c(this.#F??this.#A(),"reset")}formStateRestoreCallback(t){t!=null&&this.#c(t,"restore")}get displayText(){return this.#g?.textContent??""}get value(){return this.#i==null?"":String(this.#i)}set value(t){String(t)!==String(this.#i)&&this.#c(t,"api")}get form(){return this.#r.form}get name(){return this.getAttribute("name")}get type(){return this.localName}get validity(){return this.#r.validity}get validationMessage(){return this.#r.validationMessage}checkValidity(){return this.#r.checkValidity()}reportValidity(){return this.#r.reportValidity()}};b("stepper-wc",f);export{f as StepperWc};
|
|
2
|
+
//# sourceMappingURL=stepper-wc.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var C=window.matchMedia("(prefers-reduced-motion: reduce)");var b=new Map;function y(c,e,s={}){let r=s.priority??10,a={impl:e,bundle:s.bundle,contract:s.contract,priority:r},t=b.get(c);if(customElements.get(c)){if(!t||t.priority>=r){t&&t.priority===r&&t.impl!==e&&console.warn(`[VB Bundle] Tag <${c}> already registered by "${t.bundle}" (priority ${t.priority}). Skipping "${s.bundle}".`);return}console.warn(`[VB Bundle] Tag <${c}> defined by "${t.bundle}" cannot be replaced (customElements.define is permanent). "${s.bundle}" has higher priority but arrived late.`);return}if(t&&t.priority>=r){t.priority===r&&console.warn(`[VB Bundle] Tag <${c}> already registered by "${t.bundle}". Skipping "${s.bundle}" (first wins at equal priority).`);return}b.set(c,a),customElements.define(c,e)}var h=class extends HTMLElement{#i=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#i)e();this.#i=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,s,r,a){e.addEventListener(s,r,a),this.#i.push(()=>e.removeEventListener(s,r,a))}setup(){}teardown(){}setState(e,s){this.#t||(this.#t=this.attachInternals());let r=this.#t.states;try{s?r.add(e):r.delete(e)}catch{let a=`--${e}`;s?r.add(a):r.delete(a)}}_adoptInternals(e){this.#t||(this.#t=e)}};var v=0;function m(c,e,s="vb-vt"){if(!c?.isConnected||typeof document>"u"||!("startViewTransition"in document)||matchMedia("(prefers-reduced-motion: reduce)").matches)return e(),null;let r=`${s}-${++v}`;c.style.viewTransitionName=r;let a=document.startViewTransition(e);return a.finished.finally(()=>{c.style.viewTransitionName===r&&(c.style.viewTransitionName="")}),a}var p=class c extends h{static get observedAttributes(){return["src","compact","title"]}static#i=0;#t=null;#s=null;#r={};#e=null;#c="";#n=[];setup(){this.#c=`sm-${++c.#i}`;let e=[...this.querySelectorAll(":scope > section[data-activity]")];this.#n=e.map(t=>{let n=t.getAttribute("data-activity")||"",o=t.getAttribute("data-activity-label")||""||this.#u(n),l=t.getAttribute("data-journey-phase")||null,d=[...t.children];return{id:n,label:o,journeyPhase:l,children:d}});for(let t of e)t.remove();this.#t=document.createElement("div"),this.#t.className="sm-scroll",this.#t.setAttribute("role","region"),this.#t.setAttribute("aria-label","Story map"),this.#t.setAttribute("tabindex","0"),this.#s=document.createElement("div"),this.#s.className="sm-columns";let s=0;for(let t of this.#n){let n=document.createElement("section");n.className="sm-column",n.setAttribute("data-activity-column",t.id);let i=document.createElement("header");i.className="sm-activity-header";let o=document.createElement("h3");o.textContent=t.label;let l=document.createElement("span");l.className="sm-activity-count",l.textContent=String(t.children.length),o.appendChild(l),i.appendChild(o),n.appendChild(i);let d=document.createElement("drag-surface");if(d.setAttribute("group",this.#c),d.setAttribute("aria-label",`${t.label} stories`),d.setAttribute("data-layout","stack"),d.setAttribute("data-layout-gap","xs"),t.children.length>0){for(let u of t.children)d.appendChild(u);s+=t.children.length}else{let u=document.createElement("p");u.className="sm-empty",u.textContent="No stories yet",d.appendChild(u)}n.appendChild(d),this.#s.appendChild(n),this.#r[t.id]=d}let r=this.getAttribute("title");if(r){let t=document.createElement("h2");t.className="sm-title",t.textContent=r,this.appendChild(t)}this.#t.appendChild(this.#s),this.appendChild(this.#t),this.#e=document.createElement("div"),this.#e.className="sm-live-region",this.#e.setAttribute("role","status"),this.#e.setAttribute("aria-live","polite"),this.#e.setAttribute("aria-atomic","true"),this.appendChild(this.#e),this.listen(this,"drag-surface:reorder",t=>{let n=t.detail,i=t.target.closest("drag-surface"),o=this.#o(i);o&&(this.#a(o),this.dispatchEvent(new CustomEvent("story-map:reorder",{bubbles:!0,detail:{itemId:n.itemId,activity:o,oldIndex:n.oldIndex,newIndex:n.newIndex}})))}),this.listen(this,"drag-surface:transfer",t=>{let n=t.detail,i=n.fromSurface,o=n.toSurface,l=this.#o(i),d=this.#o(o);if(!l||!d)return;this.#a(l),this.#a(d);let u=o.querySelector(".sm-empty");if(u&&u.remove(),i.querySelectorAll(':scope > [draggable="true"]').length===0&&!i.querySelector(".sm-empty")){let f=document.createElement("p");f.className="sm-empty",f.textContent="No stories yet",i.appendChild(f)}let g=this.#l(n.item);this.#d(`${g} moved from ${l} to ${d}`),this.dispatchEvent(new CustomEvent("story-map:transfer",{bubbles:!0,detail:{itemId:n.itemId,fromActivity:l,toActivity:d,newIndex:n.newIndex}}))});let a=this.getAttribute("src");if(a){this._loadSrc(a);return}this.dispatchEvent(new CustomEvent("story-map:ready",{bubbles:!0,detail:{activityCount:this.#n.length,storyCount:s}}))}teardown(){this.#t&&(this.#t.remove(),this.#t=null),this.#e&&(this.#e.remove(),this.#e=null),this.#s=null,this.#r={},this.#n=[]}get activities(){return this.#n.map(e=>({id:e.id,label:e.label,journeyPhase:e.journeyPhase||void 0,stories:[...this.#r[e.id]?.querySelectorAll(':scope > [draggable="true"]')||[]].map(s=>({id:s.getAttribute("data-id")||void 0,storyId:s.getAttribute("story-id")||void 0,title:s.querySelector('[slot="title"]')?.textContent?.trim()||void 0}))}))}set activities(e){let s=Array.isArray(e)?e:[];for(;this.firstChild;)this.firstChild.remove();for(let a of s){let t=document.createElement("section");t.setAttribute("data-activity",a.id||""),a.label&&t.setAttribute("data-activity-label",a.label),a.journeyPhase&&t.setAttribute("data-journey-phase",a.journeyPhase);for(let n of a.stories||[]){let i,o=this;if(typeof o.renderStory=="function"){let l=o.renderStory(n);i=l instanceof Element?l:null}i||(customElements.get("user-story")?(i=document.createElement("user-story"),i.data=n):(i=document.createElement("article"),i.className="sm-card",i.textContent=n.title||n.id||"")),i.hasAttribute("draggable")||i.setAttribute("draggable","true"),n.id&&!i.hasAttribute("data-id")&&i.setAttribute("data-id",String(n.id)),t.appendChild(i)}this.appendChild(t)}let r=()=>{this.teardown(),this.removeAttribute("data-upgraded"),this.setup()};this.hasAttribute("data-upgraded")&&this.#t?m(this,r,"sm-vt"):r(),this.dispatchEvent(new CustomEvent("story-map:activities-changed",{detail:{activities:s,source:"property"},bubbles:!0}))}attributeChangedCallback(e,s,r){s===r||!this.isConnected||e==="src"&&this._loadSrc(r)}async _loadSrc(e){if(e)try{let s=await fetch(e);if(!s.ok)throw new Error(`HTTP ${s.status}`);let r=await s.json();for(;this.firstChild;)this.firstChild.remove();for(let t of r.activities||[]){let n=document.createElement("section");n.setAttribute("data-activity",t.id),n.setAttribute("data-activity-label",t.label||t.id),t.journeyPhase&&n.setAttribute("data-journey-phase",t.journeyPhase);for(let i of t.stories||[]){let o=document.createElement("user-story");o.setAttribute("draggable","true"),o.dataset.id=i.id||i.storyId,(i.storyId||i.id)&&o.setAttribute("story-id",i.storyId||i.id),i.title&&o.setAttribute("title",i.title),i.persona&&o.setAttribute("persona",i.persona),i.action&&o.setAttribute("action",i.action),i.benefit&&o.setAttribute("benefit",i.benefit),i.priority&&o.setAttribute("priority",i.priority),i.status&&o.setAttribute("status",i.status),i.points&&o.setAttribute("points",String(i.points)),o.setAttribute("detail",i.detail||"compact"),n.appendChild(o)}this.appendChild(n)}let a=()=>{this.teardown(),this.removeAttribute("data-upgraded"),this.setup()};this.hasAttribute("data-upgraded")&&this.#t?m(this,a,"sm-vt"):a()}catch(s){console.warn(`[story-map] Failed to load src="${e}":`,s)}}#o(e){if(!e)return null;for(let[s,r]of Object.entries(this.#r))if(r===e)return s;return null}#a(e){let s=this.#r[e];if(!s)return;let r=s.querySelectorAll(':scope > [draggable="true"]').length,a=s.closest("[data-activity-column]");if(!a)return;let t=a.querySelector(".sm-activity-count");t&&(t.textContent=String(r))}#d(e){this.#e&&(this.#e.textContent="",requestAnimationFrame(()=>{this.#e&&(this.#e.textContent=e)}))}#l(e){return e.getAttribute("story-id")||e.getAttribute("data-id")||e.textContent?.trim().slice(0,40)||"item"}#u(e){return e.replace(/[-_]/g," ").replace(/\b\w/g,s=>s.toUpperCase())}};y("story-map",p);export{p as StoryMap};
|
|
2
2
|
//# sourceMappingURL=story-map.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function l(r){return document.startViewTransition?document.startViewTransition(r):r()}var m=window.matchMedia("(prefers-reduced-motion: reduce)");var u=new Map;function h(r,e
|
|
1
|
+
function l(r){return document.startViewTransition?document.startViewTransition(r):r()}var m=window.matchMedia("(prefers-reduced-motion: reduce)");var u=new Map;function h(r,t,e={}){let s=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:s},n=u.get(r);if(customElements.get(r)){if(!n||n.priority>=s){n&&n.priority===s&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=s){n.priority===s&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${n.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}u.set(r,i),customElements.define(r,t)}var c=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,s,i){t.addEventListener(e,s,i),this.#t.push(()=>t.removeEventListener(e,s,i))}setup(){}teardown(){}setState(t,e){this.#e||(this.#e=this.attachInternals());let s=this.#e.states;try{e?s.add(t):s.delete(t)}catch{let i=`--${t}`;e?s.add(i):s.delete(i)}}_adoptInternals(t){this.#e||(this.#e=t)}};var f=0,d=class extends c{#t=[];#e=[];#i=!1;#s=0;setup(){return this.#t=[...this.querySelectorAll(":scope > details")],this.#e=this.#t.map(t=>t.querySelector("summary")),this.#t.length===0?!1:(this.#a(),this.#c(),this.#o(),!0)}teardown(){this.#t=[],this.#e=[],this.#i=!1}get tabs(){return this.#t.map((t,e)=>({id:t.id||void 0,label:t.querySelector("summary")?.textContent?.trim()||`Tab ${e+1}`,content:t.querySelector(":scope > :not(summary)")?.innerHTML||"",active:t.hasAttribute("open")}))}set tabs(t){let e=Array.isArray(t)?t:[];for(;this.firstChild;)this.firstChild.remove();let s=!1;for(let i of e){let n=document.createElement("details");i.id&&(n.id=i.id),i.active&&!s&&(n.setAttribute("open",""),s=!0);let a=document.createElement("summary");a.textContent=i.label||"",n.appendChild(a);let o=document.createElement("div");o.innerHTML=i.content||"",n.appendChild(o),this.appendChild(n)}!s&&this.firstElementChild&&this.firstElementChild.setAttribute("open",""),this.teardown(),this.removeAttribute("data-upgraded"),this.setup(),this.dispatchEvent(new CustomEvent("tab-set:tabs-changed",{detail:{tabs:e,source:"property"},bubbles:!0}))}#o(){if(!this.hasAttribute("transition")||!document.startViewTransition)return;this.#i=!0;let t=++f,e=this.getAttribute("transition")||"fade",s=e==="slide"?"vt-tabs-slide":e==="scale"?"vt-tabs-scale":"vt-tabs";this.#t.forEach(i=>{let n=i.querySelector(":scope > :not(summary)");n&&(n.style.viewTransitionName=`tabs-${t}`,n.style.viewTransitionClass=s)}),this.#s=this.#t.findIndex(i=>i.open),this.#s===-1&&(this.#s=0)}#n(t){if(t===this.#s)return;let e=t>this.#s?"forward":"backward";document.documentElement.dataset.vtDirection=e,l(()=>{this.#t[t].open=!0}).finished?.then(()=>{delete document.documentElement.dataset.vtDirection})}#a(){this.#t.forEach((t,e)=>{let s=this.#e[e],i=t.querySelector(":scope > :not(summary)");if(!s||!i)return;let n=s.id||`tab-${crypto.randomUUID().slice(0,8)}`,a=i.id||`panel-${crypto.randomUUID().slice(0,8)}`;s.id=n,s.setAttribute("aria-controls",a),s.setAttribute("tabindex",t.open?"0":"-1"),s.setAttribute("aria-selected",t.open?"true":"false"),i.id=a,i.setAttribute("aria-labelledby",n),this.listen(s,"click",o=>{this.#i&&(o.preventDefault(),this.#n(e))}),this.listen(s,"keydown",o=>this.#l(o,e)),this.listen(t,"toggle",()=>this.#d(e))})}#c(){!this.#t.some(e=>e.open)&&this.#t.length>0&&(this.#t[0].open=!0,this.#r())}#d(t){this.#t[t].open&&(this.#s=t),this.#r(),this.dispatchEvent(new CustomEvent("tab-set:change",{detail:{index:t},bubbles:!0}))}#r(){this.#t.forEach((t,e)=>{let s=this.#e[e];s.setAttribute("tabindex",t.open?"0":"-1"),s.setAttribute("aria-selected",t.open?"true":"false")})}#l(t,e){let{key:s}=t,i;switch(s){case"ArrowRight":i=(e+1)%this.#t.length;break;case"ArrowLeft":i=(e-1+this.#t.length)%this.#t.length;break;case"Home":i=0;break;case"End":i=this.#t.length-1;break;default:return}t.preventDefault(),this.#i?this.#n(i):this.#t[i].open=!0,this.#e[i].focus()}};h("tab-set",d);export{d as TabSet};
|
|
2
2
|
//# sourceMappingURL=tab-set.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var b=window.matchMedia("(prefers-reduced-motion: reduce)");var f=new Map;function g(c,t,s={}){let e=s.priority??10,i={impl:t,bundle:s.bundle,contract:s.contract,priority:e},r=f.get(c);if(customElements.get(c)){if(!r||r.priority>=e){r&&r.priority===e&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${c}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${s.bundle}".`);return}console.warn(`[VB Bundle] Tag <${c}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${s.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=e){r.priority===e&&console.warn(`[VB Bundle] Tag <${c}> already registered by "${r.bundle}". Skipping "${s.bundle}" (first wins at equal priority).`);return}f.set(c,i),customElements.define(c,t)}var u=class extends HTMLElement{#
|
|
1
|
+
var b=window.matchMedia("(prefers-reduced-motion: reduce)");var f=new Map;function g(c,t,s={}){let e=s.priority??10,i={impl:t,bundle:s.bundle,contract:s.contract,priority:e},r=f.get(c);if(customElements.get(c)){if(!r||r.priority>=e){r&&r.priority===e&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${c}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${s.bundle}".`);return}console.warn(`[VB Bundle] Tag <${c}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${s.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=e){r.priority===e&&console.warn(`[VB Bundle] Tag <${c}> already registered by "${r.bundle}". Skipping "${s.bundle}" (first wins at equal priority).`);return}f.set(c,i),customElements.define(c,t)}var u=class extends HTMLElement{#a=[];#r;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#a)t();this.#a=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,s,e,i){t.addEventListener(s,e,i),this.#a.push(()=>t.removeEventListener(s,e,i))}setup(){}teardown(){}setState(t,s){this.#r||(this.#r=this.attachInternals());let e=this.#r.states;try{s?e.add(t):e.delete(t)}catch{let i=`--${t}`;s?e.add(i):e.delete(i)}}_adoptInternals(t){this.#r||(this.#r=t)}};var p=class extends u{#a=null;#r=null;#g=[];#o="";#p=0;#b=null;#E=null;#C=null;#w=null;#s=!1;#i=!1;#$=0;#e=null;#l=null;#c=null;#m=null;#y=null;#S=null;#H=null;#L=!1;#n=null;#t=null;static get observedAttributes(){return["speed","voice","for"]}attributeChangedCallback(t,s,e){if(s!==e&&(t==="for"&&(this.stop(),this.#B()),(t==="speed"||t==="voice")&&this.#s&&this.#x(),t==="speed")){let i=this.#f(parseFloat(e)||1);this.#y&&(this.#y.value=String(i)),this.#S&&(this.#S.textContent=`${i}\xD7`)}}setup(){return"speechSynthesis"in window?(this.getAttribute("variant")==="icon"?this.#O():this.#D(),this.#B(),this.#J(),this.#w=this.#q(),this.#w.then(t=>this.#tt(t)),this.listen(window,"beforeunload",this.#et),!0):(this.style.display="none",!1)}teardown(){this.stop(),this.#Q(),this.#t&&(this.#t.remove(),this.#t=null),this.#n&&(this.#n.remove(),this.#n=null)}play(){if(this.#i){this.resume();return}this.#s||this.#F(0)}pause(){!this.#s||this.#i||(speechSynthesis.pause(),this.#i=!0,this.#U(!0),this.#d("text-reader:pause"))}resume(){this.#i&&(speechSynthesis.resume(),this.#i=!1,this.#U(!1),this.#d("text-reader:resume"))}stop(){speechSynthesis.cancel(),this.#k(),this.#d("text-reader:stop")}get voices(){return this.#w||this.#q()}get speaking(){return this.#s}get paused(){return this.#i}get progress(){return this.#o.length?Math.min(this.#p/this.#o.length,1):0}#D(){let t=document.createElement("div");t.setAttribute("part","controls"),t.setAttribute("role","group"),t.setAttribute("aria-label","Article reader");let s=this.#h("play",this.getAttribute("label-play")||"Play","\u25B6");s.addEventListener("click",()=>this.play());let e=this.#h("pause",this.getAttribute("label-pause")||"Pause","\u23F8");e.hidden=!0,e.addEventListener("click",()=>this.pause());let i=this.#h("stop",this.getAttribute("label-stop")||"Stop","\u23F9");i.disabled=!0,i.addEventListener("click",()=>this.stop());let r=document.createElement("select");r.setAttribute("aria-label","Voice");let n=document.createElement("option");n.textContent="Loading voices\u2026",r.append(n),r.addEventListener("change",()=>{this.#s&&this.#x()});let h=document.createElement("label");h.setAttribute("data-speed-group","");let o=document.createElement("span");o.setAttribute("data-speed-value","");let l=this.#f(parseFloat(this.getAttribute("speed")??"1")||1);o.textContent=`${l}\xD7`;let a=document.createElement("input");a.type="range",a.min="0.5",a.max="2",a.step="0.1",a.value=String(l),a.setAttribute("aria-label","Speed"),a.addEventListener("input",()=>{let d=parseFloat(a.value);o.textContent=`${d}\xD7`,this.#s&&this.#x()}),h.append(o,a),this.#u("icon-play",s),this.#u("icon-pause",e),this.#u("icon-stop",i),t.append(s,e,i,r,h),this.prepend(t),this.#H=t,this.#e=s,this.#l=e,this.#c=i,this.#m=r,this.#y=a,this.#S=o}#h(t,s,e){let i=document.createElement("button");return i.type="button",i.setAttribute("part",`button ${t}`),i.setAttribute("aria-label",s),i.textContent=e,i}#u(t,s){let e=this.querySelector(`[slot="${t}"]`);e&&(e.removeAttribute("slot"),s.textContent="",s.append(e))}#O(){this.#L=!0;for(let e of this.querySelectorAll(':scope > [part="trigger"]'))e.remove();let t=document.createElement("button");t.type="button",t.setAttribute("part","trigger"),t.setAttribute("aria-label","Article reader"),t.setAttribute("aria-pressed","false");let s=this.querySelector('[slot="icon-trigger"]');if(s)s.removeAttribute("slot"),t.append(s);else{let e=document.createElement("icon-wc");e.setAttribute("name","volume-2"),e.setAttribute("aria-hidden","true"),t.append(e)}t.addEventListener("click",()=>this.#W()),this.append(t),this.#n=t,this.#R()}#R(){let t=document.createElement("div");t.setAttribute("data-text-reader-toolbar",""),t.setAttribute("role","group"),t.setAttribute("aria-label","Reader controls"),t.hidden=!0;let s=this.#h("play",this.getAttribute("label-play")||"Play","\u25B6");s.addEventListener("click",()=>this.play());let e=this.#h("pause",this.getAttribute("label-pause")||"Pause","\u23F8");e.hidden=!0,e.addEventListener("click",()=>this.pause());let i=this.#h("stop",this.getAttribute("label-stop")||"Stop","\u23F9");i.addEventListener("click",()=>this.stop());let r=this.#h("speed-down","Slower","\u2212");r.addEventListener("click",()=>this.#T(-.1));let n=document.createElement("span");n.setAttribute("data-speed-value","");let h=this.#f(parseFloat(this.getAttribute("speed")??"1")||1);n.textContent=`${h}\xD7`;let o=this.#h("speed-up","Faster","+");o.addEventListener("click",()=>this.#T(.1)),this.#u("icon-play",s),this.#u("icon-pause",e),this.#u("icon-stop",i),t.append(s,e,i,r,n,o),document.body.append(t),this.#e=s,this.#l=e,this.#c=i,this.#S=n,this.#t=t,this.listen(document,"pointerdown",this.#_),this.listen(document,"keydown",this.#G)}#W(){if(!this.#s){this.play();return}this.#t?.hidden&&this.#M(),this.#i?this.resume():this.pause()}#M(){if(!this.#t||!this.#n)return;let t=this.#t;t.hidden=!1,t.style.visibility="hidden",requestAnimationFrame(()=>{this.#j(),t.style.visibility=""})}#A(){this.#t&&(this.#t.hidden=!0)}#j(){let t=this.#t,s=this.#n;if(!t||!s)return;let e=s.getBoundingClientRect(),i=t.offsetWidth,r=t.offsetHeight,n=8,h=8,o=e.top-r-n;o<h&&(o=e.bottom+n);let l=e.left+e.width/2-i/2,a=window.innerWidth-i-h;l=Math.max(h,Math.min(l,a)),t.style.top=`${o}px`,t.style.left=`${l}px`}#T(t){let s=parseFloat(this.getAttribute("speed")??"1")||1,e=this.#f(s+t);this.setAttribute("speed",String(e))}#_=t=>{!this.#t||this.#t.hidden||this.#t.contains(t.target)||this.#n?.contains(t.target)||this.#A()};#G=t=>{t.key==="Escape"&&this.#t&&!this.#t.hidden&&this.#A()};#B(){let t=this.getAttribute("for");if(!t){console.warn('<text-reader>: missing "for" attribute'),this.#I();return}if(this.#a=document.getElementById(t),!this.#a){console.warn(`<text-reader>: no element found with id="${t}"`),this.#I();return}this.#X(),this.#K()}#I(){this.#e&&(this.#e.disabled=!0),this.#c&&(this.#c.disabled=!0)}#K(){this.#e&&(this.#e.disabled=!1)}#X(){let t=this.#a;if(!t)return;let s=this.getAttribute("selectors")||"p,li",e=[...t.querySelectorAll(s)],i=n=>n.closest("pre")||n.closest("code")||n.closest('[aria-hidden="true"]');this.#g=[];let r=0;for(let n of e){if(i(n))continue;let h=n.textContent.trim();h&&(this.#g.push({element:n,text:h,speechStart:r,speechEnd:r+h.length}),r+=h.length+1)}this.#o=this.#g.map(n=>n.text).join(" ")}#F(t){if(!this.#o)return;let s=t>0?this.#o.slice(t):this.#o;if(!s.trim())return;let e=s.replace(/[<>]/g," "),i=new SpeechSynthesisUtterance(e);i.rate=this.#f(parseFloat(this.#y?.value??this.getAttribute("speed")??"1")||1);let r=this.#m?.selectedOptions[0];if(r?.dataset.voiceUri){let n=speechSynthesis.getVoices().find(h=>h.voiceURI===r.dataset.voiceUri);n&&(i.voice=n)}i.onboundary=n=>{if(n.name!=="word")return;let h=t+n.charIndex;this.#p=h;let o=n.charLength;if(!o){let a=this.#o.slice(h).match(/^\S+/);o=a?a[0].length:1}this.#Y(h,o),this.#d("text-reader:word",{word:this.#o.slice(h,h+o),charIndex:h,element:this.#P(h)?.element})},i.onend=()=>{let n=Date.now()-this.#$;this.#k(),this.#d("text-reader:end",{duration:n})},i.onerror=n=>{n.error==="interrupted"||n.error==="canceled"||(console.warn("<text-reader>: SpeechSynthesisUtterance error:",n.error),this.#k(),this.#d("text-reader:error",{error:n.error}))},this.#r=i,this.#s=!0,this.#i=!1,this.#$=Date.now(),this.#p=t,this.#N(!0),speechSynthesis.cancel(),speechSynthesis.speak(i),this.#z(),this.#d("text-reader:play",{voice:i.voice?.name,speed:i.rate})}#x(){let t=this.#p;speechSynthesis.cancel(),this.#v(),requestAnimationFrame(()=>this.#F(t))}#z(){this.#v(),this.#b=setInterval(()=>{if(!speechSynthesis.speaking){this.#v();return}speechSynthesis.pause(),speechSynthesis.resume()},1e4)}#v(){this.#b&&clearInterval(this.#b),this.#b=null}#J(){if(!CSS.highlights)return;let t=new CSSStyleSheet;t.replaceSync(`
|
|
2
2
|
::highlight(text-reader-word) {
|
|
3
3
|
background-color: var(--text-reader-highlight, Mark);
|
|
4
4
|
color: var(--text-reader-highlight-text, MarkText);
|
|
5
5
|
}
|
|
6
|
-
`),this.#
|
|
6
|
+
`),this.#E=t,document.adoptedStyleSheets=[...document.adoptedStyleSheets,t]}#Q(){let t=this.#E;t&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(s=>s!==t),this.#E=null),this.#V()}#Y(t,s){if(!CSS.highlights||this.getAttribute("highlight")==="false")return;let e=this.#P(t);if(!e)return;let i=t-e.speechStart,r=this.#Z(e.element,i,s);if(!r)return;let n=new Highlight(r);if(CSS.highlights.set("text-reader-word",n),this.#C=n,this.getAttribute("scroll")!=="false"){let h=r.getBoundingClientRect(),o=window.innerHeight;(h.top<0||h.bottom>o)&&e.element.scrollIntoView({behavior:"smooth",block:"nearest"})}}#V(){CSS.highlights&&CSS.highlights.delete("text-reader-word"),this.#C=null}#P(t){let s=this.#g,e=0,i=s.length-1;for(;e<=i;){let r=e+i>>>1,n=s[r];if(t<n.speechStart)i=r-1;else if(t>=n.speechEnd)e=r+1;else return n}return null}#Z(t,s,e){let i=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),r=0;for(;i.nextNode();){let n=i.currentNode,h=n.textContent??"";if(!h.trim())continue;let o=h.length;if(r+o>s){let l=s-r,a=document.createRange();a.setStart(n,Math.min(l,o));let d=l+e;return d<=o?a.setEnd(n,d):a.setEnd(n,o),a}r+=o}return null}async#q(){let t=speechSynthesis.getVoices();return t.length>0?t:new Promise(s=>{let e=()=>{speechSynthesis.removeEventListener("voiceschanged",e),s(speechSynthesis.getVoices())};speechSynthesis.addEventListener("voiceschanged",e),setTimeout(()=>{speechSynthesis.removeEventListener("voiceschanged",e),s(speechSynthesis.getVoices())},3e3)})}#tt(t){if(!this.#m||!t.length)return;let s=this.#m;s.innerHTML="";let e=document.documentElement.lang||"en",i=t.filter(o=>o.lang.startsWith(e)),r=t.filter(o=>!o.lang.startsWith(e)),n=[...i,...r],h=this.getAttribute("voice");for(let o of n){let l=document.createElement("option");l.textContent=`${o.name} (${o.lang})`,l.dataset.voiceUri=o.voiceURI,h&&o.voiceURI===h&&(l.selected=!0),s.append(l)}if(!h){let o=i.find(l=>l.default)||i[0];if(o){let l=[...s.options].find(a=>a.dataset.voiceUri===o.voiceURI);l&&(l.selected=!0)}}}#N(t){!this.#e||!this.#l||!this.#c||(t?(this.#e.hidden=!0,this.#l.hidden=!1,this.#c.disabled=!1):(this.#e.hidden=!1,this.#l.hidden=!0,this.#c.disabled=!0),this.#L&&(this.#n&&this.#n.setAttribute("aria-pressed",String(t)),t?this.#M():this.#A()))}#U(t){!this.#e||!this.#l||(this.#e.hidden=!t,this.#l.hidden=t)}#k(){this.#s=!1,this.#i=!1,this.#p=0,this.#r=null,this.#v(),this.#V(),this.#N(!1)}#f(t){return Math.round(Math.max(.5,Math.min(2,t))*10)/10}#d(t,s={}){this.dispatchEvent(new CustomEvent(t,{detail:s,bubbles:!0}))}#et=()=>{speechSynthesis.cancel()}};g("text-reader",p);export{p as TextReader};
|
|
7
7
|
//# sourceMappingURL=text-reader.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var F=window.matchMedia("(prefers-reduced-motion: reduce)");var $=new Map;function y(t,r,e={}){let n=e.priority??10,i={impl:r,bundle:e.bundle,contract:e.contract,priority:n},s=$.get(t);if(customElements.get(t)){if(!s||s.priority>=n){s&&s.priority===n&&s.impl!==r&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${t}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=n){s.priority===n&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}$.set(t,i),customElements.define(t,r)}var p=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 r of this.#t)r();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(r,e,n,i){r.addEventListener(e,n,i),this.#t.push(()=>r.removeEventListener(e,n,i))}setup(){}teardown(){}setState(r,e){this.#e||(this.#e=this.attachInternals());let n=this.#e.states;try{e?n.add(r):n.delete(r)}catch{let i=`--${r}`;e?n.add(i):n.delete(i)}}_adoptInternals(r){this.#e||(this.#e=r)}};var w="com.vanilla-breeze";function x(t){let r=[],e=[],n=t&&typeof t=="object"?t:{};return S(n,[],void 0,n,r,e),{tokens:r,ignored:e,stats:{applied:r.length,ignored:e.length}}}function S(t,r,e,n,i,s){if(!t||typeof t!="object")return;if("$value"in t){A(t,r,e??t.$type,n,i,s);return}if(k(t)){T(t,r,e??t.$type??"color",n,i,s);return}let o=t.$type??e;for(let[a,c]of Object.entries(t))a.startsWith("$")||S(c,[...r,a],o,n,i,s)}function k(t){return["$root","light","dark"].some(e=>t[e]&&typeof t[e]=="object"&&"$value"in t[e])}function m(t){let[r,e,...n]=t;switch(r){case"color":{if(e==="seeds")return n.length?`--${n.join("-")}`:null;let i=[e,...n].filter(Boolean).join("-");return i?`--color-${i}`:null}case"typography":{let i=n.join("-")||e,s=n.length?n.join("-"):"";switch(e){case"family":return s?`--font-${s}`:null;case"size":return s?`--font-size-${s}`:null;case"weight":return s?`--font-weight-${s}`:null;case"lineHeight":return s?`--line-height-${s}`:null;case"letterSpacing":return s?`--letter-spacing-${s}`:null;default:return null}let o=i}case"spacing":return[e,...n].filter(Boolean).length?`--size-${[e,...n].filter(Boolean).join("-")}`:null;case"border":{let i=n.join("-")||"";return e==="radius"?i?`--radius-${i}`:null:e==="width"&&i?`--border-width-${i}`:null}case"motion":{let i=n.join("-")||"";return e==="duration"?i?`--duration-${i}`:null:e==="easing"&&i?`--ease-${i}`:null}case"effect":{let i=n.join("-")||"";return e==="shadow"&&i?`--shadow-${i}`:null}default:return null}}function A(t,r,e,n,i,s){if((e==="typography"||t.$type==="typography")&&t.$value&&typeof t.$value=="object"&&!Array.isArray(t.$value)&&r[0]==="typography"){q(t,r,i);return}let o=m(r);if(!o){s.push(r.join("."));return}let a=e??j(r),c=t.$extensions&&t.$extensions[w]||{};if(c.expression){i.push([o,c.expression]);return}if(c.lightDark){i.push([o,c.lightDark]);return}let l=h(t.$value,a,c,n);if(l==null){s.push(r.join("."));return}i.push([o,l])}function j(t){let[r,e]=t;if(r==="color")return"color";if(r==="spacing"||r==="border"&&(e==="radius"||e==="width"))return"dimension";if(r==="motion"&&e==="duration")return"duration";if(r==="motion"&&e==="easing")return"cubicBezier";if(r==="effect"&&e==="shadow")return"shadow";if(r==="typography"){if(e==="family")return"fontFamily";if(e==="size")return"dimension";if(e==="weight")return"fontWeight";if(e==="lineHeight")return"number";if(e==="letterSpacing")return"dimension"}}function T(t,r,e,n,i,s){let o=m(r);if(!o){s.push(r.join("."));return}let a=t.$extensions&&t.$extensions[w]||{};if(a.lightDark){i.push([o,a.lightDark]);return}let c=t.light?.$value?h(t.light.$value,e,{},n):null,l=t.dark?.$value?h(t.dark.$value,e,{},n):null,f=t.$root?.$value?h(t.$root.$value,e,{},n):null;if(c&&l){i.push([o,`light-dark(${c}, ${l})`]);return}if(f){i.push([o,f]);return}if(c){i.push([o,c]);return}if(l){i.push([o,l]);return}s.push(r.join("."))}function h(t,r,e,n){if(typeof t=="string"&&/^\{[^}]+\}$/.test(t)){let i=t.slice(1,-1).split("."),s=m(i);return s?`var(${s})`:t}switch(r){case"color":return v(t,e);case"fontFamily":return E(t);case"fontWeight":return String(t);case"number":return B(t,e);case"dimension":return u(t,e);case"duration":return L(t);case"cubicBezier":return Array.isArray(t)?`cubic-bezier(${t.join(", ")})`:null;case"shadow":return _(t);default:return typeof t=="string"||typeof t=="number"?String(t):null}}function v(t,r){if(!t||typeof t!="object")return null;if(t.hex)return t.hex;if(t.colorSpace==="oklch"){let[e,n,i]=t.components||[0,0,0],s=t.alpha!=null?` / ${t.alpha}`:"";return`oklch(${e} ${n} ${i}${s})`}if(t.colorSpace==="srgb"){let[e,n,i]=t.components||[0,0,0],s=t.alpha;return s!=null?`rgba(${Math.round(e*255)}, ${Math.round(n*255)}, ${Math.round(i*255)}, ${s})`:C(e,n,i)}return null}function C(t,r,e){let n=i=>Math.round(i*255).toString(16).padStart(2,"0");return`#${n(t)}${n(r)}${n(e)}`}var M=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","math","emoji","fangsong","-apple-system","BlinkMacSystemFont"]);function E(t){return typeof t=="string"?t:Array.isArray(t)?t.map(r=>M.has(r)||r.startsWith('"')||r.startsWith("'")?r:`"${r}"`).join(", "):null}function B(t,r){return r.unit==="%"?`${t}%`:String(t)}function u(t,r){if(!t||typeof t!="object")return null;let e=r.unit||t.unit||"px";return`${t.value}${e}`}function L(t){return!t||typeof t!="object"?null:`${t.value}${t.unit||"ms"}`}function _(t){return Array.isArray(t)?t.map(b).filter(Boolean).join(", "):b(t)}function b(t){if(!t)return null;let r=u(t.offsetX,{})??"0px",e=u(t.offsetY,{})??"0px",n=u(t.blur,{})??"0px",i=t.spread?" "+u(t.spread,{}):"",s=v(t.color,{})??"#000";return`${r} ${e} ${n}${i} ${s}`}function q(t,r,e){let n=t.$value,i=r[r.length-1];n.fontFamily!=null&&e.push([`--font-${i}`,E(n.fontFamily)]),n.fontSize!=null&&e.push([`--font-size-${i}`,u(n.fontSize,{})]),n.fontWeight!=null&&e.push([`--font-weight-${i}`,String(n.fontWeight)]),n.lineHeight!=null&&e.push([`--line-height-${i}`,String(n.lineHeight)]),n.letterSpacing!=null&&e.push([`--letter-spacing-${i}`,u(n.letterSpacing,{})])}var g=class extends p{static observedAttributes=["target","catalog-base"];#t=null;#e="";setup(){this.#i(),this.#s()}attributeChangedCallback(){this.isConnected&&this.hasAttribute("data-upgraded")&&(this.#i(),this.#s())}#r(){let r=this.getAttribute("target")||"#preview";try{return document.querySelector(r)}catch{return null}}#n(){let r=this.getAttribute("catalog-base");return r?r.replace(/\/$/,""):typeof window<"u"&&window.__VB_CATALOG_BASE?String(window.__VB_CATALOG_BASE).replace(/\/$/,""):"/cdn/themes/catalog"}#i(){let r="border:1px solid var(--color-border,#ddd);border-radius:var(--radius-m,0.5rem);background:var(--color-surface,#fff);padding:var(--size-m,1rem);display:flex;flex-direction:column;gap:var(--size-2xs,0.375rem);min-block-size:0",e="display:grid;grid-template-columns:repeat(auto-fill,minmax(14rem,1fr));gap:var(--size-s,0.75rem)",n="font-size:var(--font-size-xs,0.75rem);color:var(--color-text-muted,#666)",i="margin:0;font-size:var(--font-size-md,1rem);font-weight:600;color:var(--color-text,#222)",s="align-self:flex-start;padding:0.375rem 0.75rem;border:1px solid var(--color-border,#ccc);border-radius:var(--radius-s,0.25rem);background:var(--color-primary,#0066cc);color:var(--color-text-on-primary,#fff);cursor:pointer;font:inherit;font-size:var(--font-size-xs,0.75rem)",o=`display:inline-block;padding:0.125rem 0.375rem;border-radius:0.25rem;background:var(--color-surface-raised,#f3f3f3);${n};margin-inline-end:0.25rem`;this.innerHTML=`
|
|
2
|
+
<div class="tc-head" style="display:flex;align-items:baseline;gap:var(--size-s,0.75rem);margin-block-end:var(--size-s,0.75rem);flex-wrap:wrap">
|
|
3
|
+
<strong style="font-size:var(--font-size-sm,0.875rem)">Start from a known system</strong>
|
|
4
|
+
<span class="tc-target" style="${n}"></span>
|
|
5
|
+
</div>
|
|
6
|
+
<div class="tc-grid" style="${e}" role="list"></div>
|
|
7
|
+
<output class="tc-result" style="display:block;margin-block-start:var(--size-s,0.75rem);${n}"></output>
|
|
8
|
+
<p class="tc-attribution" style="margin-block-start:var(--size-2xs,0.375rem);${n}" hidden></p>
|
|
9
|
+
<details class="tc-ignored" style="margin-block-start:var(--size-2xs,0.375rem)" hidden>
|
|
10
|
+
<summary style="${n};cursor:pointer">Ignored tokens</summary>
|
|
11
|
+
<ul class="tc-ignored-list" style="margin:var(--size-2xs,0.375rem) 0 0;padding-inline-start:1.25rem;${n}"></ul>
|
|
12
|
+
</details>
|
|
13
|
+
<style>
|
|
14
|
+
:host ._card { ${r} }
|
|
15
|
+
:host ._title { ${i} }
|
|
16
|
+
:host ._btn { ${s} }
|
|
17
|
+
:host ._tag { ${o} }
|
|
18
|
+
</style>
|
|
19
|
+
`,this.#a()}#a(){let r=this.querySelector(".tc-target");if(!r)return;let e=this.getAttribute("target")||"#preview",n=this.#r();r.textContent=n?`Target: ${e}`:`Target ${e} not found`}async#s(){let r=this.querySelector(".tc-grid");if(r)try{let e=await fetch(`${this.#n()}/manifest.json`);if(!e.ok)throw new Error(`Catalog manifest fetch failed: ${e.status}`);let n=await e.json();this.#t=n.entries||[],this.#c()}catch(e){r.innerHTML="";let n=this.querySelector(".tc-result");n&&(n.textContent=`Couldn't load catalog manifest: ${e&&e.message?e.message:String(e)}`)}}#c(){let r=this.querySelector(".tc-grid");if(!r||!this.#t)return;let e="border:1px solid var(--color-border,#ddd);border-radius:var(--radius-m,0.5rem);background:var(--color-surface,#fff);padding:var(--size-m,1rem);display:flex;flex-direction:column;gap:var(--size-2xs,0.375rem)",n="margin:0;font-size:var(--font-size-md,1rem);font-weight:600;color:var(--color-text,#222)",i="align-self:flex-start;margin-block-start:auto;padding:0.375rem 0.75rem;border:1px solid var(--color-border,#ccc);border-radius:var(--radius-s,0.25rem);background:var(--color-primary,#0066cc);color:var(--color-text-on-primary,#fff);cursor:pointer;font:inherit;font-size:var(--font-size-xs,0.75rem)",s="font-size:var(--font-size-xs,0.75rem);color:var(--color-text-muted,#666)",o=`display:inline-block;padding:0.125rem 0.375rem;border-radius:0.25rem;background:var(--color-surface-raised,#f3f3f3);${s};margin-inline-end:0.25rem`;r.innerHTML="";for(let a of this.#t){let c=document.createElement("article");c.setAttribute("role","listitem"),c.setAttribute("data-id",a.id),c.style.cssText=e,c.innerHTML=`
|
|
20
|
+
<h3 style="${n}">${d(a.name)}</h3>
|
|
21
|
+
<p style="${s};margin:0">${d(a.summary||"")}</p>
|
|
22
|
+
<p style="${s};margin:0">License: ${d(a.license)}</p>
|
|
23
|
+
<p style="margin:0">${(a.tags||[]).map(f=>`<span style="${o}">${d(f)}</span>`).join("")}</p>
|
|
24
|
+
<button type="button" class="tc-apply" style="${i}" data-id="${z(a.id)}" aria-label="Apply ${z(a.name)} tokens">
|
|
25
|
+
Apply
|
|
26
|
+
</button>
|
|
27
|
+
`;let l=c.querySelector("button.tc-apply");l&&this.listen(l,"click",()=>this.#l(a)),r.appendChild(c)}}async#l(r){let e=this.#r();if(!e){this.#o(r.id,new Error(`Target ${this.getAttribute("target")||"#preview"} not found`),"apply");return}try{let n=await fetch(`${this.#n()}/${r.file}`);if(!n.ok)throw new Error(`Fetch failed: ${n.status}`);let i=await n.json(),s=x(i);for(let[o,a]of s.tokens)e.style.setProperty(o,a);this.#u(r,s),this.#e=r.id,this.dispatchEvent(new CustomEvent("theme-catalog:applied",{bubbles:!0,detail:{id:r.id,applied:s.stats.applied,ignored:s.ignored,tokens:s.tokens,source:"catalog"}}))}catch(n){this.#o(r.id,n,"fetch-or-apply")}}#u(r,e){let n=this.querySelector(".tc-result");n&&(n.textContent=`Applied ${e.stats.applied} token${e.stats.applied===1?"":"s"} from ${r.name}${e.stats.ignored?` \xB7 ${e.stats.ignored} ignored`:""}.`);let i=this.querySelector(".tc-attribution");i&&(i.hidden=!1,i.textContent=r.attribution);let s=this.querySelector(".tc-ignored"),o=this.querySelector(".tc-ignored-list");s&&o&&(e.ignored.length===0?(s.hidden=!0,o.innerHTML=""):(s.hidden=!1,o.innerHTML=e.ignored.map(a=>`<li>${d(a)}</li>`).join("")))}#o(r,e,n){let i=this.querySelector(".tc-result");i&&(i.textContent=`Error (${n}): ${e&&e.message?e.message:String(e)}`),this.dispatchEvent(new CustomEvent("theme-catalog:error",{bubbles:!0,detail:{id:r,error:e,phase:n}}))}};function d(t){return String(t).replace(/[&<>"']/g,r=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[r])}function z(t){return d(t)}y("theme-catalog",g);export{g as ThemeCatalog};
|
|
28
|
+
//# sourceMappingURL=theme-catalog.js.map
|
|
@@ -1,18 +1,26 @@
|
|
|
1
|
-
var b=window.matchMedia("(prefers-reduced-motion: reduce)");var u=new Map;function d(i,e,t={}){let r=t.priority??10,n={impl:e,bundle:t.bundle,contract:t.contract,priority:r},o=u.get(i);if(customElements.get(i)){if(!o||o.priority>=r){o&&o.priority===r&&o.impl!==e&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${o.bundle}" (priority ${o.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${o.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(o&&o.priority>=r){o.priority===r&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${o.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}u.set(i,n),customElements.define(i,e)}var c=class extends HTMLElement{#e=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0})))}disconnectedCallback(){for(let e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,t,r,n){e.addEventListener(t,r,n),this.#e.push(()=>e.removeEventListener(t,r,n))}setup(){}teardown(){}};var h="--color-,--hue-,--lightness-,--chroma-,--font-,--size-,--radius-,--shadow-,--border-width-,--ease-,--duration-",m=["type-specimen:change","spacing-specimen:change","token-specimen:change","semantic-palette:change"],a=class extends c{static observedAttributes=["scope","selector","include","format","label","live"];setup(){this.#o(),this.#t(),this.#r(),this.#n()}attributeChangedCallback(){this.isConnected&&this.hasAttribute("data-upgraded")&&(this.#o(),this.#t(),this.#r(),this.#n())}#e(){let e=this.getAttribute("scope")||":root";try{return e===":root"?document.documentElement:document.querySelector(e)}catch{return document.documentElement}}#s(){return(this.getAttribute("include")||h).split(",").map(t=>t.trim()).filter(Boolean)}#i(){let e=this.#e();if(!e)return[];let t=this.#s(),r=e.style,n=[];for(let o=0;o<r.length;o++){let s=r.item(o);if(!s.startsWith("--")||!t.some(f=>s.startsWith(f)))continue;let l=r.getPropertyValue(s).trim();l&&n.push([s,l])}return n}#c(e){if((this.getAttribute("format")||"css")==="json"){let o=Object.fromEntries(e);return JSON.stringify(o,null,2)}let r=this.getAttribute("selector")||":root";if(!e.length)return`${r} {
|
|
1
|
+
var Z=window.matchMedia("(prefers-reduced-motion: reduce)");var E=new Map;function w(n,t,e={}){let o=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:o},r=E.get(n);if(customElements.get(n)){if(!r||r.priority>=o){r&&r.priority===o&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=o){r.priority===o&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}E.set(n,s),customElements.define(n,t)}var d=class extends HTMLElement{#e=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,o,s){t.addEventListener(e,o,s),this.#e.push(()=>t.removeEventListener(e,o,s))}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let o=this.#t.states;try{e?o.add(t):o.delete(t)}catch{let s=`--${t}`;e?o.add(s):o.delete(s)}}_adoptInternals(t){this.#t||(this.#t=t)}};var h="[data-copy], [data-copy-target], [data-paste-target]",A="Copied to clipboard",z="Pasted from clipboard",m=new WeakMap;async function y(n,t={}){if(n==null||n==="")return!1;let{button:e,announceMessage:o=A,duration:s=1500}=t;try{await navigator.clipboard.writeText(n)}catch{return!1}return k({button:e,duration:s,announceMessage:o,eventDetail:{text:n}}),!0}function k({button:n,duration:t,announceMessage:e,eventDetail:o,state:s="copied",eventName:r="copy"}){if(n){n.dataset.state=s;let i=m.get(n);i&&clearTimeout(i),m.set(n,setTimeout(()=>{delete n.dataset.state,m.delete(n)},t)),n.dispatchEvent(new CustomEvent(r,{bubbles:!0,detail:o}))}O(e,n??document.body)}async function L(n,t={}){let{button:e,announceMessage:o=z,duration:s=1500}=t,r;try{r=await navigator.clipboard.readText()}catch{return null}return n&&("value"in n&&(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement||n instanceof HTMLSelectElement)?n.value=r:n.textContent=r,n.dispatchEvent(new Event("input",{bubbles:!0}))),k({button:e,duration:s,announceMessage:o,eventDetail:{text:r},state:"pasted",eventName:"paste"}),r}function S(n=document){n.querySelectorAll(h).forEach(b)}function b(n){n.hasAttribute("data-copy-init")||(n.setAttribute("data-copy-init",""),n.addEventListener("click",()=>{if(n.dataset.pasteTarget){let e=document.querySelector(n.dataset.pasteTarget);if(!e)return;L(e,{button:n});return}let t=D(n);t&&y(t,{button:n})}))}function D(n){if(n.dataset.copy)return n.dataset.copy;if(n.dataset.copyTarget){let t=document.querySelector(n.dataset.copyTarget);if(!t)return"";let e=n.dataset.copyAttr;return e?t.getAttribute(e)??"":t.textContent??""}return""}function O(n,t){let e=document.createElement("div");e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.className="visually-hidden",e.textContent=n,t.appendChild(e),setTimeout(()=>e.remove(),1e3)}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>S()):S();var M=new MutationObserver(n=>{for(let t of n)for(let e of t.addedNodes){if(e.nodeType!==Node.ELEMENT_NODE)continue;let o=e;o.matches(h)&&b(o),o.querySelectorAll(h).forEach(s=>b(s))}});M.observe(document.documentElement,{childList:!0,subtree:!0});var u="com.vanilla-breeze",F="2025.10";function T(n,t={}){let e={},o=[],s=!1;for(let[i,a]of n){let c=String(a).trim(),l=I(i);if(!l){o.push(i);continue}l.path[0]==="color"&&l.path[1]==="seeds"&&(s=!0);let C=B(i,c,l);Y(e,l.path,l.name,C)}let r={spec:F};return t.vbVersion&&(r.vbVersion=t.vbVersion),s&&(r.seedDerivation=!0),o.length&&(r.unmapped=o),e.$extensions={[u]:r},e}function I(n){let t=[{p:"--hue-",path:["color","seeds"],type:"number",keep:!0},{p:"--lightness-",path:["color","seeds"],type:"number",keep:!0},{p:"--chroma-",path:["color","seeds"],type:"number",keep:!0},{p:"--color-",path:["color"],type:"color"},{p:"--font-size-",path:["typography","size"],type:"dimension"},{p:"--font-weight-",path:["typography","weight"],type:"fontWeight"},{p:"--font-",path:["typography","family"],type:"fontFamily"},{p:"--line-height-",path:["typography","lineHeight"],type:"number"},{p:"--letter-spacing-",path:["typography","letterSpacing"],type:"dimension"},{p:"--size-",path:["spacing"],type:"dimension"},{p:"--radius-",path:["border","radius"],type:"dimension"},{p:"--border-width-",path:["border","width"],type:"dimension"},{p:"--duration-",path:["motion","duration"],type:"duration"},{p:"--ease-",path:["motion","easing"],type:"cubicBezier"},{p:"--shadow-",path:["effect","shadow"],type:"shadow"}];for(let{p:e,path:o,type:s,keep:r}of t)if(n.startsWith(e)){let i=r?n.slice(2):n.slice(e.length);return{path:o,type:s,name:i}}return null}function B(n,t,e){switch(e.type){case"color":return q(t);case"fontFamily":return{$type:"fontFamily",$value:P(t)};case"fontWeight":return{$type:"fontWeight",$value:$(t)};case"number":return R(t);case"dimension":return _(t);case"duration":return{$type:"duration",$value:V(t)};case"cubicBezier":return W(t);case"shadow":return H(t);default:return{$value:t}}}function q(n){let t=X(n);if(t)return{$root:{$type:"color",$value:p(t.light)??g(t.light)},light:{$type:"color",$value:p(t.light)??g(t.light)},dark:{$type:"color",$value:p(t.dark)??g(t.dark)},$extensions:{[u]:{lightDark:n}}};if(/\bfrom\b/.test(n)&&/^oklch\(/i.test(n))return{$type:"color",$value:{colorSpace:"srgb",components:[0,0,0]},$extensions:{[u]:{expression:n}}};let e=p(n);return e?{$type:"color",$value:e}:{$type:"color",$value:{colorSpace:"srgb",components:[0,0,0]},$extensions:{[u]:{literal:n}}}}function g(n){return{colorSpace:"srgb",components:[0,0,0],$vbLiteral:n}}function p(n){let t=String(n).trim(),e=t.match(/^oklch\(\s*([^)]+)\)\s*$/i);if(e){let[o,s]=j(e[1]),r=o.trim().split(/\s+/);if(r.length<3)return null;let i=f(r[0]),a=$(r[1]),c=$(r[2]);if([i,a,c].some(Number.isNaN))return null;let l={colorSpace:"oklch",components:[U(r[0],i),a,c]};return s!=null&&(l.alpha=s),l}if(e=t.match(/^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i),e){let o=e[1],s,r,i,a;o.length===3||o.length===4?(s=parseInt(o[0]+o[0],16)/255,r=parseInt(o[1]+o[1],16)/255,i=parseInt(o[2]+o[2],16)/255,o.length===4&&(a=parseInt(o[3]+o[3],16)/255)):(s=parseInt(o.slice(0,2),16)/255,r=parseInt(o.slice(2,4),16)/255,i=parseInt(o.slice(4,6),16)/255,o.length===8&&(a=parseInt(o.slice(6,8),16)/255));let c={colorSpace:"srgb",components:[s,r,i],hex:"#"+(o.length<=4?o.slice(0,3).split("").map(l=>l+l).join(""):o.slice(0,6)).toLowerCase()};return a!=null&&(c.alpha=a),c}if(e=t.match(/^rgba?\(\s*([^)]+)\)\s*$/i),e){let o=e[1].split(/\s*,\s*|\s+/).filter(Boolean);if(o.length<3)return null;let s=v(o[0]),r=v(o[1]),i=v(o[2]),a={colorSpace:"srgb",components:[s,r,i]};return o[3]!=null&&(a.alpha=f(o[3])),a}return null}function U(n,t){return typeof n=="string"&&n.endsWith("%")?t/100:t}function j(n){let t=n.indexOf("/");if(t<0)return[n,null];let e=n.slice(0,t),o=f(n.slice(t+1).trim());return[e,o]}function v(n){let t=n.trim();return t.endsWith("%")?parseFloat(t)/100:parseFloat(t)/255}function R(n){let e={$type:"number",$value:f(n)};return typeof n=="string"&&n.trim().endsWith("%")&&(e.$extensions={[u]:{unit:"%"}}),e}function _(n){let t=String(n).trim(),e=t.match(/^(-?[\d.]+)(px|rem|em|%)?$/);if(!e)return{$type:"dimension",$value:{value:0,unit:"px"},$extensions:{[u]:{literal:t}}};let o=parseFloat(e[1]),s=e[2]||"px",i={$type:"dimension",$value:{value:o,unit:s==="px"||s==="rem"?s:"rem"}};return s!=="px"&&s!=="rem"&&(i.$extensions={[u]:{unit:s}}),i}function $(n){return parseFloat(String(n).trim())}function f(n){let t=String(n).trim();return t.endsWith("%"),parseFloat(t)}function P(n){let t=[],e="",o=null;for(let r of String(n))if(o){if(r===o){o=null;continue}e+=r}else if(r==='"'||r==="'")o=r;else if(r===","){let i=e.trim();i&&t.push(i),e=""}else e+=r;let s=e.trim();return s&&t.push(s),t}function V(n){let t=String(n).trim(),e=t.match(/^(-?[\d.]+)(ms|s)$/);return e?{value:parseFloat(e[1]),unit:e[2]}:{value:parseFloat(t),unit:"ms"}}function W(n){let t=String(n).match(/^cubic-bezier\(\s*([^)]+)\)\s*$/i);if(!t)return{$type:"cubicBezier",$value:[0,0,1,1],$extensions:{[u]:{literal:n}}};let e=t[1].split(",").map(o=>parseFloat(o.trim()));return e.length!==4||e.some(Number.isNaN)?{$type:"cubicBezier",$value:[0,0,1,1],$extensions:{[u]:{literal:n}}}:{$type:"cubicBezier",$value:e}}function H(n){let e=N(String(n)).map(G);return e.some(o=>o==null)?{$type:"shadow",$value:{offsetX:{value:0,unit:"px"},offsetY:{value:0,unit:"px"},blur:{value:0,unit:"px"},color:{colorSpace:"srgb",components:[0,0,0]}},$extensions:{[u]:{literal:n}}}:e.length===1?{$type:"shadow",$value:e[0]}:{$type:"shadow",$value:e}}function G(n){let t=n.trim(),e=t.match(/(#[0-9a-f]{3,8}|rgba?\([^)]+\)|oklch\([^)]+\))$/i);if(!e)return null;let o=p(e[0]);if(!o)return null;let r=t.slice(0,e.index).trim().split(/\s+/).filter(Boolean);if(r.length<3)return null;let i=c=>J(r[c]),a={offsetX:i(0),offsetY:i(1),blur:i(2),color:o};return r[3]&&(a.spread=i(3)),a}function J(n){let t=n.match(/^(-?[\d.]+)(px|rem|em)?$/);if(!t)return{value:0,unit:"px"};let e=parseFloat(t[1]),o=t[2]||"px";return{value:e,unit:o==="px"||o==="rem"?o:"rem"}}function N(n){let t=[],e="",o=0;for(let s of n)s==="("?o++:s===")"&&o--,s===","&&o===0?(t.push(e),e=""):e+=s;return e.trim()&&t.push(e),t}function X(n){let t=String(n).match(/^light-dark\(\s*([\s\S]+)\s*\)\s*$/i);if(!t)return null;let e=N(t[1]);return e.length!==2?null:{light:e[0].trim(),dark:e[1].trim()}}function Y(n,t,e,o){let s=n;for(let r of t)(!s[r]||typeof s[r]!="object")&&(s[r]={}),s=s[r];s[e]=o}var K="--color-,--hue-,--lightness-,--chroma-,--font-,--size-,--radius-,--shadow-,--border-width-,--ease-,--duration-,--line-height-,--letter-spacing-",Q=["type-specimen:change","spacing-specimen:change","token-specimen:change","semantic-palette:change"],x=class extends d{static observedAttributes=["scope","selector","include","format","label","live"];setup(){this.#o(),this.#n(),this.#r(),this.#s()}attributeChangedCallback(){this.isConnected&&this.hasAttribute("data-upgraded")&&(this.#o(),this.#n(),this.#r(),this.#s())}#e(){let t=this.getAttribute("scope")||":root";try{return t===":root"?document.documentElement:document.querySelector(t)}catch{return document.documentElement}}#t(){return(this.getAttribute("include")||K).split(",").map(e=>e.trim()).filter(Boolean)}#i(){let t=this.#e();if(!t)return[];let e=this.#t(),o=t.style,s=[];for(let r=0;r<o.length;r++){let i=o.item(r);if(!i.startsWith("--")||!e.some(c=>i.startsWith(c)))continue;let a=o.getPropertyValue(i).trim();a&&s.push([i,a])}return s}#a(t){let e=this.getAttribute("format")||"css";if(e==="json"){let r=Object.fromEntries(t);return JSON.stringify(r,null,2)}if(e==="dtcg"){let r=this.getAttribute("vb-version")||void 0;return JSON.stringify(T(t,{vbVersion:r}),null,2)}let o=this.getAttribute("selector")||":root";if(!t.length)return`${o} {
|
|
2
2
|
/* No theme overrides detected yet. Edit a specimen to populate. */
|
|
3
3
|
}
|
|
4
|
-
`;let
|
|
5
|
-
`);return`${
|
|
6
|
-
${
|
|
4
|
+
`;let s=t.map(([r,i])=>` ${r}: ${i};`).join(`
|
|
5
|
+
`);return`${o} {
|
|
6
|
+
${s}
|
|
7
7
|
}
|
|
8
|
-
`}#o(){let
|
|
9
|
-
${
|
|
10
|
-
<div class="te-toolbar" style="${
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
`}#o(){let t=this.getAttribute("label")||"",e=t?`<p style="font-weight:600;margin:0 0 var(--size-xs,0.5rem)">${t}</p>`:"",o="display:flex;gap:var(--size-2xs,0.375rem);margin-block-end:var(--size-xs,0.5rem);align-items:center;flex-wrap:wrap",s="padding:0.375rem 0.75rem;border:1px solid var(--color-border,#ccc);border-radius:var(--radius-s,0.25rem);background:var(--color-surface,#fff);color:var(--color-text,#222);cursor:pointer;font:inherit;font-size:var(--font-size-xs,0.75rem)",r="padding:0.375rem 0.5rem;border:1px solid var(--color-border,#ccc);border-radius:var(--radius-s,0.25rem);background:var(--color-surface,#fff);color:var(--color-text,#222);font:inherit;font-size:var(--font-size-xs,0.75rem)",i="inline-size:100%;block-size:16rem;padding:var(--size-s,0.75rem);border:1px solid var(--color-border,#ccc);border-radius:var(--radius-s,0.25rem);background:var(--color-surface-sunken,#f8f8f8);color:var(--color-text,#222);font-family:var(--font-mono,monospace);font-size:var(--font-size-xs,0.75rem);white-space:pre;overflow:auto;tab-size:2;resize:vertical;box-sizing:border-box",a=this.getAttribute("format")||"css";this.innerHTML=`
|
|
9
|
+
${e}
|
|
10
|
+
<div class="te-toolbar" style="${o}">
|
|
11
|
+
<label style="display:flex;gap:var(--size-2xs,0.375rem);align-items:center;font-size:var(--font-size-xs,0.75rem);color:var(--color-text-muted,#666)">
|
|
12
|
+
Format
|
|
13
|
+
<select class="te-format" style="${r}" aria-label="Output format">
|
|
14
|
+
<option value="css"${a==="css"?" selected":""}>CSS</option>
|
|
15
|
+
<option value="json"${a==="json"?" selected":""}>JSON</option>
|
|
16
|
+
<option value="dtcg"${a==="dtcg"?" selected":""}>DTCG</option>
|
|
17
|
+
</select>
|
|
18
|
+
</label>
|
|
19
|
+
<button type="button" class="te-refresh" style="${s}" aria-label="Refresh">Refresh</button>
|
|
20
|
+
<button type="button" class="te-copy" style="${s}">Copy</button>
|
|
21
|
+
<button type="button" class="te-download" style="${s}">Download</button>
|
|
14
22
|
<span class="te-count" style="align-self:center;font-size:var(--font-size-xs,0.75rem);color:var(--color-text-muted,#666);margin-inline-start:auto"></span>
|
|
15
23
|
</div>
|
|
16
|
-
<textarea class="te-output" readonly aria-label="Theme output" style="${
|
|
17
|
-
`}#
|
|
24
|
+
<textarea class="te-output" readonly aria-label="Theme output" style="${i}"></textarea>
|
|
25
|
+
`}#n(){let t=this.#i(),e=this.#a(t),o=this.querySelector(".te-output"),s=this.querySelector(".te-count");o&&(o.value=e),s&&(s.textContent=`${t.length} token${t.length===1?"":"s"}`),this.dispatchEvent(new CustomEvent("theme-export:change",{bubbles:!0,detail:{output:e,format:this.getAttribute("format")||"css",tokens:Object.fromEntries(t)}}))}#r(){let t=this.querySelector(".te-refresh"),e=this.querySelector(".te-copy"),o=this.querySelector(".te-download"),s=this.querySelector(".te-format");s&&this.listen(s,"change",()=>{this.setAttribute("format",s.value)}),t&&this.listen(t,"click",()=>this.#n()),e&&this.listen(e,"click",()=>{let r=this.querySelector(".te-output");r&&y(r.value,{button:e,announceMessage:"Theme copied"})}),o&&this.listen(o,"click",()=>this.#c())}#c(){let t=this.querySelector(".te-output");if(!t)return;let e=this.getAttribute("format")||"css",o="css",s="text/css",r="theme.css";e==="json"?(o="json",s="application/json",r="theme.json"):e==="dtcg"&&(o="tokens.json",s="application/design-tokens+json",r="theme.tokens.json");let i=new Blob([t.value],{type:s}),a=URL.createObjectURL(i),c=document.createElement("a");c.href=a,c.download=r,c.click(),URL.revokeObjectURL(a)}#s(){if(this.hasAttribute("live"))for(let t of Q)this.listen(document,t,()=>this.#n())}};w("theme-export",x);
|
|
18
26
|
//# sourceMappingURL=theme-export.js.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
var B=window.matchMedia("(prefers-reduced-motion: reduce)");var y=new Map;function g(t,r,e={}){let n=e.priority??10,i={impl:r,bundle:e.bundle,contract:e.contract,priority:n},s=y.get(t);if(customElements.get(t)){if(!s||s.priority>=n){s&&s.priority===n&&s.impl!==r&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${t}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=n){s.priority===n&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}y.set(t,i),customElements.define(t,r)}var d=class extends HTMLElement{#e=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let r of this.#e)r();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(r,e,n,i){r.addEventListener(e,n,i),this.#e.push(()=>r.removeEventListener(e,n,i))}setup(){}teardown(){}setState(r,e){this.#t||(this.#t=this.attachInternals());let n=this.#t.states;try{e?n.add(r):n.delete(r)}catch{let i=`--${r}`;e?n.add(i):n.delete(i)}}_adoptInternals(r){this.#t||(this.#t=r)}};var $="com.vanilla-breeze";function x(t){let r=[],e=[],n=t&&typeof t=="object"?t:{};return v(n,[],void 0,n,r,e),{tokens:r,ignored:e,stats:{applied:r.length,ignored:e.length}}}function v(t,r,e,n,i,s){if(!t||typeof t!="object")return;if("$value"in t){z(t,r,e??t.$type,n,i,s);return}if(k(t)){E(t,r,e??t.$type??"color",n,i,s);return}let o=t.$type??e;for(let[a,l]of Object.entries(t))a.startsWith("$")||v(l,[...r,a],o,n,i,s)}function k(t){return["$root","light","dark"].some(e=>t[e]&&typeof t[e]=="object"&&"$value"in t[e])}function p(t){let[r,e,...n]=t;switch(r){case"color":{if(e==="seeds")return n.length?`--${n.join("-")}`:null;let i=[e,...n].filter(Boolean).join("-");return i?`--color-${i}`:null}case"typography":{let i=n.join("-")||e,s=n.length?n.join("-"):"";switch(e){case"family":return s?`--font-${s}`:null;case"size":return s?`--font-size-${s}`:null;case"weight":return s?`--font-weight-${s}`:null;case"lineHeight":return s?`--line-height-${s}`:null;case"letterSpacing":return s?`--letter-spacing-${s}`:null;default:return null}let o=i}case"spacing":return[e,...n].filter(Boolean).length?`--size-${[e,...n].filter(Boolean).join("-")}`:null;case"border":{let i=n.join("-")||"";return e==="radius"?i?`--radius-${i}`:null:e==="width"&&i?`--border-width-${i}`:null}case"motion":{let i=n.join("-")||"";return e==="duration"?i?`--duration-${i}`:null:e==="easing"&&i?`--ease-${i}`:null}case"effect":{let i=n.join("-")||"";return e==="shadow"&&i?`--shadow-${i}`:null}default:return null}}function z(t,r,e,n,i,s){if((e==="typography"||t.$type==="typography")&&t.$value&&typeof t.$value=="object"&&!Array.isArray(t.$value)&&r[0]==="typography"){F(t,r,i);return}let o=p(r);if(!o){s.push(r.join("."));return}let a=e??j(r),l=t.$extensions&&t.$extensions[$]||{};if(l.expression){i.push([o,l.expression]);return}if(l.lightDark){i.push([o,l.lightDark]);return}let c=f(t.$value,a,l,n);if(c==null){s.push(r.join("."));return}i.push([o,c])}function j(t){let[r,e]=t;if(r==="color")return"color";if(r==="spacing"||r==="border"&&(e==="radius"||e==="width"))return"dimension";if(r==="motion"&&e==="duration")return"duration";if(r==="motion"&&e==="easing")return"cubicBezier";if(r==="effect"&&e==="shadow")return"shadow";if(r==="typography"){if(e==="family")return"fontFamily";if(e==="size")return"dimension";if(e==="weight")return"fontWeight";if(e==="lineHeight")return"number";if(e==="letterSpacing")return"dimension"}}function E(t,r,e,n,i,s){let o=p(r);if(!o){s.push(r.join("."));return}let a=t.$extensions&&t.$extensions[$]||{};if(a.lightDark){i.push([o,a.lightDark]);return}let l=t.light?.$value?f(t.light.$value,e,{},n):null,c=t.dark?.$value?f(t.dark.$value,e,{},n):null,m=t.$root?.$value?f(t.$root.$value,e,{},n):null;if(l&&c){i.push([o,`light-dark(${l}, ${c})`]);return}if(m){i.push([o,m]);return}if(l){i.push([o,l]);return}if(c){i.push([o,c]);return}s.push(r.join("."))}function f(t,r,e,n){if(typeof t=="string"&&/^\{[^}]+\}$/.test(t)){let i=t.slice(1,-1).split("."),s=p(i);return s?`var(${s})`:t}switch(r){case"color":return S(t,e);case"fontFamily":return w(t);case"fontWeight":return String(t);case"number":return C(t,e);case"dimension":return u(t,e);case"duration":return q(t);case"cubicBezier":return Array.isArray(t)?`cubic-bezier(${t.join(", ")})`:null;case"shadow":return M(t);default:return typeof t=="string"||typeof t=="number"?String(t):null}}function S(t,r){if(!t||typeof t!="object")return null;if(t.hex)return t.hex;if(t.colorSpace==="oklch"){let[e,n,i]=t.components||[0,0,0],s=t.alpha!=null?` / ${t.alpha}`:"";return`oklch(${e} ${n} ${i}${s})`}if(t.colorSpace==="srgb"){let[e,n,i]=t.components||[0,0,0],s=t.alpha;return s!=null?`rgba(${Math.round(e*255)}, ${Math.round(n*255)}, ${Math.round(i*255)}, ${s})`:T(e,n,i)}return null}function T(t,r,e){let n=i=>Math.round(i*255).toString(16).padStart(2,"0");return`#${n(t)}${n(r)}${n(e)}`}var A=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","math","emoji","fangsong","-apple-system","BlinkMacSystemFont"]);function w(t){return typeof t=="string"?t:Array.isArray(t)?t.map(r=>A.has(r)||r.startsWith('"')||r.startsWith("'")?r:`"${r}"`).join(", "):null}function C(t,r){return r.unit==="%"?`${t}%`:String(t)}function u(t,r){if(!t||typeof t!="object")return null;let e=r.unit||t.unit||"px";return`${t.value}${e}`}function q(t){return!t||typeof t!="object"?null:`${t.value}${t.unit||"ms"}`}function M(t){return Array.isArray(t)?t.map(b).filter(Boolean).join(", "):b(t)}function b(t){if(!t)return null;let r=u(t.offsetX,{})??"0px",e=u(t.offsetY,{})??"0px",n=u(t.blur,{})??"0px",i=t.spread?" "+u(t.spread,{}):"",s=S(t.color,{})??"#000";return`${r} ${e} ${n}${i} ${s}`}function F(t,r,e){let n=t.$value,i=r[r.length-1];n.fontFamily!=null&&e.push([`--font-${i}`,w(n.fontFamily)]),n.fontSize!=null&&e.push([`--font-size-${i}`,u(n.fontSize,{})]),n.fontWeight!=null&&e.push([`--font-weight-${i}`,String(n.fontWeight)]),n.lineHeight!=null&&e.push([`--line-height-${i}`,String(n.lineHeight)]),n.letterSpacing!=null&&e.push([`--letter-spacing-${i}`,u(n.letterSpacing,{})])}var h=class extends d{static observedAttributes=["target","placeholder"];setup(){this.#t(),this.#i()}attributeChangedCallback(){this.isConnected&&this.hasAttribute("data-upgraded")&&(this.#t(),this.#i())}#e(){let r=this.getAttribute("target")||"#preview";try{return document.querySelector(r)}catch{return null}}#t(){let r=this.getAttribute("placeholder")||"Paste DTCG tokens.json here\u2026",e="padding:0.375rem 0.75rem;border:1px solid var(--color-border,#ccc);border-radius:var(--radius-s,0.25rem);background:var(--color-surface,#fff);color:var(--color-text,#222);cursor:pointer;font:inherit;font-size:var(--font-size-xs,0.75rem)",n="padding:0.375rem 0.5rem;border:1px solid var(--color-border,#ccc);border-radius:var(--radius-s,0.25rem);background:var(--color-surface,#fff);color:var(--color-text,#222);font:inherit;font-size:var(--font-size-xs,0.75rem)",i="inline-size:100%;block-size:10rem;padding:var(--size-s,0.75rem);border:1px solid var(--color-border,#ccc);border-radius:var(--radius-s,0.25rem);background:var(--color-surface-sunken,#f8f8f8);color:var(--color-text,#222);font-family:var(--font-mono,monospace);font-size:var(--font-size-xs,0.75rem);white-space:pre;overflow:auto;tab-size:2;resize:vertical;box-sizing:border-box",s="display:flex;flex-wrap:wrap;gap:var(--size-2xs,0.375rem);align-items:center;margin-block-end:var(--size-s,0.5rem)",o="font-size:var(--font-size-xs,0.75rem);color:var(--color-text-muted,#666)";this.innerHTML=`
|
|
2
|
+
<div class="ti-modes" role="tablist" aria-label="Import source" style="${s}">
|
|
3
|
+
<button type="button" class="ti-mode" data-mode="paste" style="${e}" role="tab" aria-selected="true">Paste</button>
|
|
4
|
+
<button type="button" class="ti-mode" data-mode="file" style="${e}" role="tab" aria-selected="false">File</button>
|
|
5
|
+
<button type="button" class="ti-mode" data-mode="url" style="${e}" role="tab" aria-selected="false">URL</button>
|
|
6
|
+
<span style="${o};margin-inline-start:auto" class="ti-target"></span>
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<div class="ti-pane ti-pane-paste" role="tabpanel">
|
|
10
|
+
<textarea class="ti-paste" aria-label="DTCG JSON" placeholder="${r}" style="${i}"></textarea>
|
|
11
|
+
<div style="${s};margin-block-start:var(--size-2xs,0.375rem)">
|
|
12
|
+
<button type="button" class="ti-apply-paste" style="${e}">Apply</button>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<div class="ti-pane ti-pane-file" role="tabpanel" hidden>
|
|
17
|
+
<label style="display:flex;flex-direction:column;gap:var(--size-2xs,0.375rem);${o}">
|
|
18
|
+
<span>DTCG file (.tokens.json or .json)</span>
|
|
19
|
+
<input class="ti-file" type="file" accept=".json,.tokens,.tokens.json,application/json,application/design-tokens+json" style="${n}">
|
|
20
|
+
</label>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<div class="ti-pane ti-pane-url" role="tabpanel" hidden>
|
|
24
|
+
<label style="display:flex;flex-direction:column;gap:var(--size-2xs,0.375rem);${o}">
|
|
25
|
+
<span>DTCG URL (CORS-permitted host)</span>
|
|
26
|
+
<input class="ti-url" type="url" placeholder="https://example.com/theme.tokens.json" style="${n}">
|
|
27
|
+
</label>
|
|
28
|
+
<div style="${s};margin-block-start:var(--size-2xs,0.375rem)">
|
|
29
|
+
<button type="button" class="ti-apply-url" style="${e}">Fetch & apply</button>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<output class="ti-result" style="display:block;margin-block-start:var(--size-s,0.5rem);${o}"></output>
|
|
34
|
+
|
|
35
|
+
<details class="ti-ignored" style="margin-block-start:var(--size-2xs,0.375rem)" hidden>
|
|
36
|
+
<summary style="${o};cursor:pointer">Ignored tokens</summary>
|
|
37
|
+
<ul class="ti-ignored-list" style="margin:var(--size-2xs,0.375rem) 0 0;padding-inline-start:1.25rem;${o}"></ul>
|
|
38
|
+
</details>
|
|
39
|
+
|
|
40
|
+
<div style="${s};margin-block-start:var(--size-s,0.5rem)">
|
|
41
|
+
<button type="button" class="ti-reset" style="${e}">Reset preview scope</button>
|
|
42
|
+
</div>
|
|
43
|
+
`,this.#s()}#s(){let r=this.querySelector(".ti-target");if(!r)return;let e=this.getAttribute("target")||"#preview",n=this.#e();r.textContent=n?`Target: ${e}`:`Target ${e} not found`}#i(){for(let s of this.querySelectorAll(".ti-mode"))this.listen(s,"click",()=>this.#o(s.dataset.mode||"paste"));let r=this.querySelector(".ti-apply-paste");r&&this.listen(r,"click",()=>this.#a());let e=this.querySelector(".ti-file");e&&this.listen(e,"change",()=>this.#l(e));let n=this.querySelector(".ti-apply-url");n&&this.listen(n,"click",()=>this.#c());let i=this.querySelector(".ti-reset");i&&this.listen(i,"click",()=>this.#u())}#o(r){for(let e of this.querySelectorAll(".ti-mode")){let n=e,i=n.dataset.mode===r;n.setAttribute("aria-selected",String(i))}for(let e of this.querySelectorAll(".ti-pane")){let n=e;n.hidden=!n.classList.contains(`ti-pane-${r}`)}}#a(){let r=this.querySelector(".ti-paste");r&&this.#n(r.value,"paste")}async#l(r){let e=r.files?.[0];if(e)try{let n=await e.text();this.#n(n,"file")}catch(n){this.#r(n,"file")}}async#c(){let e=this.querySelector(".ti-url")?.value?.trim();if(e)try{let n=await fetch(e,{mode:"cors"});if(!n.ok)throw new Error(`Fetch failed: ${n.status} ${n.statusText}`);let i=await n.text();this.#n(i,"url")}catch(n){this.#r(n,"url")}}#n(r,e){let n;try{n=JSON.parse(r)}catch(o){this.#r(o,"parse");return}let i=x(n),s=this.#e();if(!s){this.#r(new Error(`Target ${this.getAttribute("target")||"#preview"} not found`),"apply");return}for(let[o,a]of i.tokens)s.style.setProperty(o,a);this.#d(i,e),this.dispatchEvent(new CustomEvent("theme-import:applied",{bubbles:!0,detail:{tokens:i.tokens,applied:i.stats.applied,ignored:i.ignored,source:e}}))}#u(){let r=this.#e();if(!r)return;let e=r.style,n=[];for(let o=0;o<e.length;o++){let a=e.item(o);a.startsWith("--")&&n.push(a)}for(let o of n)e.removeProperty(o);let i=this.querySelector(".ti-result");i&&(i.textContent=`Cleared ${n.length} custom properties from ${this.getAttribute("target")||"#preview"}.`);let s=this.querySelector(".ti-ignored");s&&(s.hidden=!0)}#d(r,e){let n=this.querySelector(".ti-result");n&&(n.textContent=`Applied ${r.stats.applied} token${r.stats.applied===1?"":"s"} from ${e}${r.stats.ignored?` \xB7 ${r.stats.ignored} ignored`:""}.`);let i=this.querySelector(".ti-ignored"),s=this.querySelector(".ti-ignored-list");if(i&&s){let o=i;r.ignored.length===0?(o.hidden=!0,s.innerHTML=""):(o.hidden=!1,s.innerHTML=r.ignored.map(a=>`<li>${L(a)}</li>`).join(""))}}#r(r,e){let n=this.querySelector(".ti-result");n&&(n.textContent=`Error (${e}): ${r&&r.message?r.message:String(r)}`),this.dispatchEvent(new CustomEvent("theme-import:error",{bubbles:!0,detail:{error:r,phase:e}}))}};function L(t){return String(t).replace(/[&<>"']/g,r=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[r])}g("theme-import",h);export{h as ThemeImport};
|
|
44
|
+
//# sourceMappingURL=theme-import.js.map
|