@pure-ds/core 0.7.63 → 0.7.65

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pure-ds/core",
3
3
  "shortname": "pds",
4
- "version": "0.7.63",
4
+ "version": "0.7.65",
5
5
  "description": "Why develop a Design System when you can generate one?",
6
6
  "repository": {
7
7
  "type": "git",
@@ -1,6 +1,6 @@
1
1
  var mt=Object.defineProperty;var ht=(e,t)=>()=>(e&&(t=e(e=0)),t);var De=(e,t)=>{for(var n in t)mt(e,n,{get:t[n],enumerable:!0})};var Ie={};De(Ie,{AutoDefiner:()=>he});async function Pt(...e){let t={};e.length&&typeof e[e.length-1]=="object"&&(t=e.pop()||{});let n=e,{baseURL:o,mapper:i=p=>`${p}.js`,onError:r=(p,c)=>console.error(`[defineWebComponents] ${p}:`,c)}=t,d=o?new URL(o,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),S=p=>p.toLowerCase().replace(/(^|-)([a-z])/g,(c,f,A)=>A.toUpperCase()),L=async p=>{try{if(customElements.get(p))return{tag:p,status:"already-defined"};let c=i(p),A=await import(c instanceof URL?c.href:new URL(c,d).href),m=A?.default??A?.[S(p)];if(!m){if(customElements.get(p))return{tag:p,status:"self-defined"};throw new Error(`No export found for ${p}. Expected default export or named export "${S(p)}".`)}return customElements.get(p)?{tag:p,status:"race-already-defined"}:(customElements.define(p,m),{tag:p,status:"defined"})}catch(c){throw r(p,c),c}};return Promise.all(n.map(L))}var he,Fe=ht(()=>{he=class{constructor(t={}){let{baseURL:n,mapper:o,onError:i,predicate:r=()=>!0,attributeModule:d="data-module",root:S=document,scanExisting:L=!0,debounceMs:p=16,observeShadows:c=!0,enhancers:f=[],patchAttachShadow:A=!0}=t,m=new Set,E=new Set,j=new Set,a=new Map,l=new WeakMap,h=new WeakMap,u=0,y=!1,_=null,R=g=>{if(!g||!f.length)return;let w=h.get(g);w||(w=new Set,h.set(g,w));for(let b of f)if(!(!b.selector||!b.run)&&!w.has(b.selector))try{g.matches&&g.matches(b.selector)&&(b.run(g),w.add(b.selector))}catch(k){console.warn(`[AutoDefiner] Error applying enhancer for selector "${b.selector}":`,k)}},x=(g,w)=>{if(!y&&!(!g||!g.includes("-"))&&!customElements.get(g)&&!E.has(g)&&!j.has(g)){if(w&&w.getAttribute){let b=w.getAttribute(d);b&&!a.has(g)&&a.set(g,b)}m.add(g),P()}},P=()=>{u||(u=setTimeout(Pe,p))},T=g=>{if(g){if(g.nodeType===1){let w=g,b=w.tagName?.toLowerCase();b&&b.includes("-")&&!customElements.get(b)&&r(b,w)&&x(b,w),R(w),c&&w.shadowRoot&&ae(w.shadowRoot)}g.querySelectorAll&&g.querySelectorAll("*").forEach(w=>{let b=w.tagName?.toLowerCase();b&&b.includes("-")&&!customElements.get(b)&&r(b,w)&&x(b,w),R(w),c&&w.shadowRoot&&ae(w.shadowRoot)})}},ae=g=>{if(!g||l.has(g))return;T(g);let w=new MutationObserver(b=>{for(let k of b)k.addedNodes?.forEach(z=>{T(z)}),k.type==="attributes"&&k.target&&T(k.target)});w.observe(g,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[d,...f.map(b=>b.selector).filter(b=>b.startsWith("data-"))]}),l.set(g,w)};async function Pe(){if(clearTimeout(u),u=0,!m.size)return;let g=Array.from(m);m.clear(),g.forEach(w=>E.add(w));try{let w=b=>a.get(b)??(o?o(b):`${b}.js`);await Pt(...g,{baseURL:n,mapper:w,onError:(b,k)=>{j.add(b),i?.(b,k)}})}catch{}finally{g.forEach(w=>E.delete(w))}}let ke=S===document?document.documentElement:S,Re=new MutationObserver(g=>{for(let w of g)w.addedNodes?.forEach(b=>{T(b)}),w.type==="attributes"&&w.target&&T(w.target)});if(Re.observe(ke,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[d,...f.map(g=>g.selector).filter(g=>g.startsWith("data-"))]}),c&&A&&Element.prototype.attachShadow){let g=Element.prototype.attachShadow;Element.prototype.attachShadow=function(b){let k=g.call(this,b);if(b&&b.mode==="open"){ae(k);let z=this.tagName?.toLowerCase();z&&z.includes("-")&&!customElements.get(z)&&x(z,this)}return k},_=()=>Element.prototype.attachShadow=g}return L&&T(ke),{stop(){y=!0,Re.disconnect(),_&&_(),u&&(clearTimeout(u),u=0),l.forEach(g=>g.disconnect())},flush:Pe}}static async define(...t){let n={};t.length&&typeof t[t.length-1]=="object"&&(n=t.pop()||{});let o=t,{baseURL:i,mapper:r=c=>`${c}.js`,onError:d=(c,f)=>console.error(`[defineWebComponents] ${c}:`,f)}=n,S=i?new URL(i,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),L=c=>c.toLowerCase().replace(/(^|-)([a-z])/g,(f,A,m)=>m.toUpperCase()),p=async c=>{try{if(customElements.get(c))return{tag:c,status:"already-defined"};let f=r(c),m=await import(f instanceof URL?f.href:new URL(f,S).href),E=m?.default??m?.[L(c)];if(!E){if(customElements.get(c))return{tag:c,status:"self-defined"};throw new Error(`No export found for ${c}. Expected default export or named export "${L(c)}".`)}return customElements.get(c)?{tag:c,status:"race-already-defined"}:(customElements.define(c,E),{tag:c,status:"defined"})}catch(f){throw d(c,f),f}};return Promise.all(o.map(p))}}});var le=class extends EventTarget{constructor(){super(),this.mode=null,this.compiled=null,this.log=()=>{},this.logHandler=null}},Ce="__PURE_DS_PDS_SINGLETON__",de=typeof globalThis<"u"?globalThis:window,ce=de?.[Ce],s=ce&&typeof ce.addEventListener=="function"?ce:new le;de&&(de[Ce]=s);typeof s.log!="function"&&(s.log=(e="log",t,...n)=>{if(typeof console>"u")return;let o=typeof console[e]=="function"?console[e].bind(console):typeof console.log=="function"?console.log.bind(console):null;o&&(n.length>0?o(t,...n):o(t))});typeof s.logHandler!="function"&&(s.logHandler=null);var ue=class{constructor(){this._mode="static",this._staticPaths={tokens:"/assets/pds/styles/pds-tokens.css.js",primitives:"/assets/pds/styles/pds-primitives.css.js",components:"/assets/pds/styles/pds-components.css.js",utilities:"/assets/pds/styles/pds-utilities.css.js",styles:"/assets/pds/styles/pds-styles.css.js"}}setLiveMode(){this._mode="live"}setStaticMode(t={}){this._mode="static",this._staticPaths={...this._staticPaths,...t}}async getStylesheet(t){if(this._mode==="live")return null;try{return(await import(this._staticPaths[t]))[t]}catch(n){s.log("error",`Registry: failed to load static ${t}:`,n),s.log("error",`Registry: looking for ${this._staticPaths[t]}`),s.log("error","Registry: make sure you've run 'npm run pds:build' and configured PDS.start() with the correct static.root path");let o=new CSSStyleSheet;return o.replaceSync("/* Failed to load "+t+" */"),o}}get mode(){return this._mode}get isLive(){return this._mode==="live"}},$=new ue;async function Te(e,t=[],n=null){try{let o=n?.primitivesStylesheet?n.primitivesStylesheet:await $.getStylesheet("primitives");e.adoptedStyleSheets=[o,...t]}catch(o){let i=e.host?.tagName?.toLowerCase()||"unknown";s.log("error",`Adopter: <${i}> failed to adopt primitives:`,o),e.adoptedStyleSheets=t}}async function ze(e,t=["primitives"],n=[],o=null){let i=Array.isArray(n)?n.filter(Boolean):[];if(i.length){let d=(Array.isArray(e.adoptedStyleSheets)?e.adoptedStyleSheets:[]).filter(S=>!i.includes(S));e.adoptedStyleSheets=[...d,...i]}try{let d=(await Promise.all(t.map(async S=>{if(o)switch(S){case"tokens":return o.tokensStylesheet;case"primitives":return o.primitivesStylesheet;case"components":return o.componentsStylesheet;case"utilities":return o.utilitiesStylesheet;default:break}return $.getStylesheet(S)}))).filter(S=>S!==null);e.adoptedStyleSheets=[...d,...i]}catch(r){let d=e.host?.tagName?.toLowerCase()||"unknown";s.log("error",`Adopter: <${d}> failed to adopt layers:`,r),e.adoptedStyleSheets=i}}function $e(e){let t=new CSSStyleSheet;return t.replaceSync(e),t}var Ue={FontWeights:{light:300,normal:400,medium:500,semibold:600,bold:700},LineHeights:{tight:1.25,normal:1.5,relaxed:1.75},BorderWidths:{hairline:.5,thin:1,medium:2,thick:3},RadiusSizes:{none:0,small:4,medium:8,large:16,xlarge:24,xxlarge:32},ShadowDepths:{none:"none",light:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",medium:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",deep:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",extreme:"0 25px 50px -12px rgba(0, 0, 0, 0.25)"},TransitionSpeeds:{fast:150,normal:250,slow:350},AnimationEasings:{linear:"linear",ease:"ease","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out",bounce:"cubic-bezier(0.68, -0.55, 0.265, 1.55)"},TouchTargetSizes:{compact:36,standard:44,comfortable:48,spacious:56},LinkStyles:{inline:"inline",block:"block",button:"button"},FocusStyles:{ring:"ring",outline:"outline",border:"border",glow:"glow"},TabSizes:{compact:2,standard:4,wide:8},SelectIcons:{chevron:"chevron",arrow:"arrow",caret:"caret",none:"none"},IconSizes:{xs:16,sm:20,md:24,lg:32,xl:48,"2xl":64,"3xl":96}};var me={};De(me,{deepMerge:()=>Me,enQueue:()=>gt,escapeForRegExp:()=>St,fragmentFromTemplateLike:()=>pe,humanizeIdentifier:()=>Et,isObject:()=>K,isUrl:()=>bt,openCenteredWindow:()=>Lt,parseFragment:()=>G,parseHTML:()=>fe,throttle:()=>yt,withTimeout:()=>wt});function K(e){return e&&typeof e=="object"&&!Array.isArray(e)}function Me(e,t){let n={...e};return K(e)&&K(t)&&Object.keys(t).forEach(o=>{K(t[o])?o in e?n[o]=Me(e[o],t[o]):Object.assign(n,{[o]:t[o]}):Object.assign(n,{[o]:t[o]})}),n}function pe(e){let t=Array.isArray(e?.strings)?e.strings:[],n=Array.isArray(e?.values)?e.values:[],o=new Set,i=[],r=/(\s)(\.[\w-]+)=["']?\s*$/,d=/(\s)(@[\w-]+)=["']?\s*$/,S=/(\s)(\?[\w-]+)=["']?\s*$/,L=/(\s)([\w:-]+)=["']?\s*$/,p=/=["']\s*$/,c=!1;for(let a=0;a<t.length;a+=1){let l=t[a]??"";if(c&&(l=l.replace(/^["']/,""),c=!1),a<n.length){let h=`pds-val-${a}`,u=l.match(r),y=l.match(d),_=l.match(S),R=l.match(L);if(u){let x=u[2].slice(1);c=p.test(t[a]??""),l=l.replace(r,`$1data-pds-bind-${a}="prop:${x}:${h}"`),o.add(a)}else if(y){let x=y[2].slice(1);c=p.test(t[a]??""),l=l.replace(d,`$1data-pds-bind-${a}="event:${x}:${h}"`),o.add(a)}else if(_){let x=_[2].slice(1);c=p.test(t[a]??""),l=l.replace(S,`$1data-pds-bind-${a}="boolean:${x}:${h}"`),o.add(a)}else if(R){let x=R[2];c=p.test(t[a]??""),l=l.replace(L,`$1data-pds-bind-${a}="attr:${x}:${h}"`),o.add(a)}}i.push(l),a<n.length&&!o.has(a)&&i.push(`<!--pds-val-${a}-->`)}let f=document.createElement("template");f.innerHTML=i.join("");let A=(a,l)=>{let h=a.parentNode;if(!h)return;if(l==null){h.removeChild(a);return}let u=y=>{if(y!=null){if(y instanceof Node){h.insertBefore(y,a);return}if(Array.isArray(y)){y.forEach(_=>u(_));return}h.insertBefore(document.createTextNode(String(y)),a)}};u(l),h.removeChild(a)},m=document.createTreeWalker(f.content,NodeFilter.SHOW_COMMENT),E=[];for(;m.nextNode();){let a=m.currentNode;a?.nodeValue?.startsWith("pds-val-")&&E.push(a)}return E.forEach(a=>{let l=Number(a.nodeValue.replace("pds-val-",""));A(a,n[l])}),f.content.querySelectorAll("*").forEach(a=>{[...a.attributes].forEach(l=>{if(!l.name.startsWith("data-pds-bind-"))return;let h=l.value.indexOf(":"),u=l.value.lastIndexOf(":");if(h<=0||u<=h){a.removeAttribute(l.name);return}let y=l.value.slice(0,h),_=l.value.slice(h+1,u),R=l.value.slice(u+1),x=Number(String(R).replace("pds-val-","")),P=n[x];if(!_||!Number.isInteger(x)){a.removeAttribute(l.name);return}y==="prop"?a[_]=P:y==="event"?(typeof P=="function"||P&&typeof P.handleEvent=="function")&&a.addEventListener(_,P):y==="boolean"?P?a.setAttribute(_,""):a.removeAttribute(_):y==="attr"&&(P==null||P===!1?a.removeAttribute(_):a.setAttribute(_,String(P))),a.removeAttribute(l.name)})}),f.content}function G(e,...t){if(Array.isArray(e)&&Object.prototype.hasOwnProperty.call(e,"raw"))return pe({strings:Array.from(e),values:t});if(Array.isArray(e?.strings)&&Array.isArray(e?.values))return pe({strings:e.strings,values:e.values});let o=document.createElement("template");return o.innerHTML=String(e??""),o.content}function fe(e,...t){return G(e,...t).childNodes}function yt(e,t=100){let n;return function(...i){let r=()=>{clearTimeout(n),e(...i)};clearTimeout(n),n=setTimeout(r,t)}}function gt(e){setTimeout(e,0)}function bt(e){try{if(typeof e!="string"||e.indexOf(`
2
2
  `)!==-1||e.indexOf(" ")!==-1||e.startsWith("#/"))return!1;let t=new URL(e,window.location.origin);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function wt(e,t,n="Operation"){return!t||t<=0?e:new Promise((o,i)=>{let r=setTimeout(()=>{i(new Error(`${n} timed out after ${t}ms`))},t);Promise.resolve(e).then(d=>{clearTimeout(r),o(d)}).catch(d=>{clearTimeout(r),i(d)})})}function St(e){return String(e).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Lt(e,t,n){let o=window.screen.width/2-t/2,i=window.screen.height/2-n/2;return window.open(e,"",`toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=${t}, height=${n}, top=${i}, left=${o}`)}function Et(e){if(e==null)return"";let t=String(e).trim();return t?t.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\s+/g," ").trim():""}var Ne="pds",_t=/^([a-z][a-z0-9+\-.]*:)?\/\//i,Oe=/^[a-z]:/i;function N(e=""){return e.endsWith("/")?e:`${e}/`}function vt(e="",t=Ne){let n=e.replace(/\/+$/,"");return new RegExp(`(?:^|/)${t}$`,"i").test(n)?n:`${n}/${t}`}function At(e){return e.replace(/^\.\/+/,"")}function xt(e){return Oe.test(e)?e.replace(Oe,"").replace(/^\/+/,""):e}function jt(e){return e.startsWith("public/")?e.substring(7):e}function q(e,t={}){let n=t.segment||Ne,o=t.defaultRoot||`/assets/${n}/`,i=e?.public&&e.public?.root||e?.static&&e.static?.root||null;if(!i||typeof i!="string")return N(o);let r=i.trim();return r?(r=r.replace(/\\/g,"/"),r=vt(r,n),r=N(r),_t.test(r)?r:(r=At(r),r=xt(r),r.startsWith("/")||(r=jt(r),r.startsWith("/")||(r=`/${r}`),r=r.replace(/\/+/g,(d,S)=>S===0?d:"/")),N(r))):N(o)}var ye=null;async function kt(){return ye||(ye=Promise.resolve().then(()=>(Fe(),Ie)).then(e=>e?.AutoDefiner||e?.default?.AutoDefiner||e?.default).then(e=>{if(typeof e!="function")throw new Error("AutoDefiner constructor not found in pure-web/auto-definer");return e})),ye}var Rt=/^[a-z][a-z0-9+\-.]*:\/\//i,I=(()=>{try{return import.meta.url}catch{return}})(),J=e=>typeof e=="string"&&e.length&&!e.endsWith("/")?`${e}/`:e;function V(e,t={}){if(!e||Rt.test(e))return e;let{preferModule:n=!0}=t,o=()=>{if(!I)return null;try{return new URL(e,I).href}catch{return null}},i=()=>{if(typeof window>"u"||!window.location?.origin)return null;try{return new URL(e,window.location.origin).href}catch{return null}};return(n?o()||i():i()||o())||e}var We=(()=>{if(I)try{let e=new URL(I);if(/\/public\/assets\/js\//.test(e.pathname))return new URL("../pds/",I).href}catch{return}})(),Be=!1;function He(e){Be||typeof document>"u"||(Be=!0,e.addEventListener("pds:ready",t=>{let n=t.detail?.mode;n&&document.documentElement.classList.add(`pds-${n}`,"pds-ready")}))}function Ke({manageTheme:e,themeStorageKey:t,applyResolvedTheme:n,setupSystemListenerIfNeeded:o}){let i="light",r=null;if(e&&typeof window<"u"){try{r=localStorage.getItem(t)||null}catch{r=null}try{n?.(r),o?.(r)}catch{}r?r==="system"?i=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":i=r:i=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return{resolvedTheme:i,storedTheme:r}}function Q(e,{resolvePublicAssetURL:t}){let n=!!(e?.public?.root||e?.static?.root),o=t(e);return!n&&We&&(o=We),J(V(o))}async function Ge(e,{baseEnhancers:t=[]}={}){let{autoDefineBaseURL:n="/auto-define/",autoDefinePreload:o=[],autoDefineMapper:i=null,enhancers:r=[],autoDefineOverrides:d=null,autoDefinePreferModule:S=!0}=e,L=(()=>{let c=new Map;return(t||[]).forEach(f=>c.set(f.selector,f)),(r||[]).forEach(f=>c.set(f.selector,f)),Array.from(c.values())})(),p=null;if(typeof window<"u"&&typeof document<"u"){let c=await kt(),f=u=>{switch(u){case"pds-tabpanel":return"pds-tabstrip.js";default:return`${u}.js`}},{mapper:A,enhancers:m,...E}=d&&typeof d=="object"?d:{},j=m?Array.isArray(m)?m:typeof m=="object"?Object.values(m):[]:[],a=(()=>{let u=new Map;return(L||[]).forEach(y=>{y?.selector&&u.set(y.selector,y)}),(j||[]).forEach(y=>{if(!y?.selector)return;let _=u.get(y.selector)||null;u.set(y.selector,{..._||{},...y,run:typeof y?.run=="function"?y.run:_?.run})}),Array.from(u.values())})(),h={baseURL:n&&J(V(n,{preferModule:S})),predefine:o,scanExisting:!0,observeShadows:!0,patchAttachShadow:!0,debounceMs:16,enhancers:a,onError:(u,y)=>{if(typeof u=="string"&&u.startsWith("pds-")){let R=["pds-form","pds-drawer"].includes(u),x=y?.message?.includes("#pds/lit")||y?.message?.includes("Failed to resolve module specifier");R&&x?s.log("error",`\u274C PDS component <${u}> requires Lit but #pds/lit is not in import map.
3
- See: https://github.com/Pure-Web-Foundation/pure-ds/blob/main/readme.md#lit-components-not-working`):s.log("warn",`\u26A0\uFE0F PDS component <${u}> not found. Assets may not be installed.`)}else s.log("error",`\u274C Auto-define error for <${u}>:`,y)},...E,mapper:u=>{if(customElements.get(u))return null;if(typeof i=="function")try{let y=i(u);return y===void 0?f(u):y}catch(y){return s.log("warn","Custom autoDefine.mapper error; falling back to default:",y?.message||y),f(u)}return f(u)}};p=new c(h),o.length>0&&typeof c.define=="function"&&await c.define(...o,{baseURL:n,mapper:h.mapper,onError:h.onError})}return{autoDefiner:p,mergedEnhancers:L}}var ge=["light","dark"],be=new Set(ge);function Dt(e){let n=(Array.isArray(e?.themes)?e.themes.map(o=>String(o).toLowerCase()):ge).filter(o=>be.has(o));return n.length?n:ge}function we(e,{preferDocument:t=!0}={}){let n=String(e||"").toLowerCase();if(be.has(n))return n;if(t&&typeof document<"u"){let o=document.documentElement?.getAttribute("data-theme");if(be.has(o))return o}return typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function qe(e,t){let n=we(t);return Dt(e).includes(n)}var Ct=new Set(["log","warn","error","debug","info"]),Tt="__PURE_DS_PDS_SINGLETON__",Se=null,Le=null;function Ve(){try{let t=(typeof globalThis<"u"?globalThis:window)?.[Tt];if(t&&typeof t=="object")return t}catch{return null}return null}function zt(e){return!e||typeof e!="object"?null:{mode:e.mode==="live"||e.mode==="static"?e.mode:null,debug:e.debug===!0,thisArg:e.thisArg}}function $t(e){if(typeof e!="string")return"log";let t=e.toLowerCase();return Ct.has(t)?t:"log"}function Ut(){if(typeof Le=="function")try{let t=zt(Le());if(t)return t}catch{}let e=Ve();if(e){let t=e?.mode||e?.compiled?.mode||(e?.registry?.isLive?"live":"static"),n=(e?.debug||e?.currentConfig?.debug||e?.currentConfig?.design?.debug||e?.compiled?.debug||e?.compiled?.design?.debug||!1)===!0;return{mode:t,debug:n,thisArg:e}}return{mode:null,debug:!1}}function Mt(){if(typeof Se=="function")try{let t=Se();if(typeof t=="function")return t}catch{}let e=Ve();return typeof e?.logHandler=="function"?e.logHandler:null}function Je(e,t,...n){if(typeof console>"u")return;let o=typeof console[e]=="function"?console[e].bind(console):typeof console.log=="function"?console.log.bind(console):null;o&&(n.length>0?o(t,...n):o(t))}function Ot(e,t){let n=t?.debug===!0;return!(t?.mode==="static"&&!n||!n&&e!=="error"&&e!=="warn")}function Qe({getLogger:e,getContext:t}={}){Se=typeof e=="function"?e:null,Le=typeof t=="function"?t:null}function Ye(e="log",t,...n){let o=$t(e),i=Ut(),r=Mt();if(r)try{r.call(i?.thisArg,o,t,...n);return}catch(d){Je("error","Custom log handler failed:",d)}Ot(o,i)&&Je(o,t,...n)}var Y=class{constructor(t={},n=null){let o=t&&typeof t=="object"?t:{},i=n||(typeof document<"u"?document:new EventTarget),r=new WeakMap,d=m=>m.map(E=>String(E)).join("."),S,L=(m,E,j,a)=>{let l=d(m),h={property:E,path:l,value:j,oldValue:a};i.dispatchEvent(new CustomEvent(`change:${l}`,{detail:h,bubbles:!0,composed:!0})),i.dispatchEvent(new CustomEvent("change",{detail:{...h,state:S},bubbles:!0,composed:!0}))},p=(m,E)=>(typeof E=="function"&&i.addEventListener(m,E),S),c=(m,E)=>(typeof E=="function"&&i.removeEventListener(m,E),S),f=(m,E)=>{if(typeof E=="function"){let j=a=>{E(a),i.removeEventListener(m,j)};i.addEventListener(m,j)}return S},A=(m,E)=>{if(!m||typeof m!="object")return m;if(r.has(m))return r.get(m);let j=new Proxy(m,{get(a,l,h){if(l==="on")return p;if(l==="off")return c;if(l==="once")return f;let u=Reflect.get(a,l,h);return u&&typeof u=="object"?A(u,[...E,l]):u},set(a,l,h,u){let y=Reflect.get(a,l,u);return Object.is(y,h)?!0:Reflect.set(a,l,h,u)?(L([...E,l],l,h,y),!0):!1},deleteProperty(a,l){if(!Reflect.has(a,l))return!0;let h=a[l];return Reflect.deleteProperty(a,l)?(L([...E,l],l,void 0,h),!0):!1}});return r.set(m,j),j};return S=A(o,[]),S}};function Ze(e,t,n){if(!e||!t||typeof n!="object")return()=>{};let o={};return Object.entries(n).forEach(([i,r])=>{o[i]=d=>{typeof r=="function"&&r(e,d.detail.value,d.detail.oldValue)},t.on(`change:${i}`,o[i])}),()=>{Object.entries(o).forEach(([i,r])=>{t.off(`change:${i}`,r)})}}typeof s.initializing!="boolean"&&(s.initializing=!1);"currentPreset"in s||(s.currentPreset=null);typeof s.debug!="boolean"&&(s.debug=!1);"currentConfig"in s||(s.currentConfig=null);"compiled"in s||(s.compiled=null);typeof s.logHandler!="function"&&(s.logHandler=null);"mode"in s||(s.mode=null);var Z=null,X=null,ee=null,te=null,ne=null,oe=null,et="__pdsLocalizationRuntime";function U(){if(oe)return oe;let e=s?.[et];return e&&typeof e=="object"?(oe=e,e):null}function Nt(e){let t=e&&typeof e=="object"?e:null;oe=t,s[et]=t}Qe({getLogger:()=>typeof s.logHandler=="function"?s.logHandler:null,getContext:()=>{let e=s?.mode||s?.compiled?.mode||(s?.registry?.isLive?"live":"static"),t=(s?.debug||s?.currentConfig?.debug||s?.currentConfig?.design?.debug||s?.compiled?.debug||s?.compiled?.design?.debug||!1)===!0;return{mode:e,debug:t,thisArg:s}}});s.log=(e="log",t,...n)=>{Ye(e,t,...n)};var v={locale:"en",messages:{},hasProvider:!1},se=new Set;function tt(e){return!!e&&typeof e!="string"&&typeof e=="object"&&"strTag"in e}function nt(e=[]){let t="";for(let n=0;n<=e.length-1;n+=1)t+=e[n],n<e.length-1&&(t+=`{${n}}`);return t}function It(e,t){return String(e).replace(/\{(\d+)\}/g,(n,o)=>t(Number(o)))}function Ft(e){if(!e||typeof e!="object")return{};let t={};for(let[n,o]of Object.entries(e)){if(typeof o=="string"){t[n]=o;continue}o&&typeof o=="object"&&typeof o.content=="string"&&(t[n]=o.content)}return t}function Wt(e,...t){return{strTag:!0,strings:Array.from(e||[]),values:t,raw:Array.from(e?.raw||[])}}function Bt(e){if(!e)return"";if(tt(e)){let n=nt(e.strings||[]),o=v.messages[n]||n;return It(o,i=>e.values?.[i])}let t=String(e);return v.messages[t]||t}function Ht(e){if(!e)return;let t=tt(e)?nt(e.strings||[]):String(e);typeof t=="string"&&t.length>0&&se.add(t)}function ot(e){if(!e||typeof e.msg!="function"||se.size===0)return;let t=Array.from(se);se.clear();for(let n of t)try{e.msg(n)}catch{}}async function W(){let e=U();return e||(ne||(ne=import(B("pds-localization.js")).then(n=>{if(typeof n?.msg!="function"||typeof n?.str!="function"||typeof n?.configureLocalization!="function"||typeof n?.loadLocale!="function"||typeof n?.setLocale!="function"||typeof n?.getLocalizationState!="function")throw new Error("Failed to load localization runtime exports");return Nt(n),ot(n),n}).catch(n=>{throw ne=null,n})),ne)}var M=(e,t={})=>{let n=U();return typeof n?.msg=="function"?n.msg(e,t):(Ht(e),Bt(e,t))},ie=(e,...t)=>{let n=U();return typeof n?.str=="function"?n.str(e,...t):Wt(e,...t)},re=(e=null)=>{let t=U();if(typeof t?.configureLocalization=="function")return t.configureLocalization(e);if(!e||typeof e!="object")return v.locale="en",v.messages={},v.hasProvider=!1,{locale:v.locale,messages:{...v.messages},hasProvider:v.hasProvider};typeof e.locale=="string"&&e.locale.trim()&&(v.locale=e.locale.trim()),Object.prototype.hasOwnProperty.call(e,"messages")&&(v.messages=Ft(e.messages));let n=!!(e.provider||e.translate||e.loadLocale||e.setLocale);return v.hasProvider=n,n&&W().then(o=>{o.configureLocalization(e),ot(o)}).catch(()=>{}),{locale:v.locale,messages:{...v.messages},hasProvider:v.hasProvider}},st=async e=>(await W()).loadLocale(e),rt=async(e,t={})=>(await W()).setLocale(e,t),it=()=>{let e=U();return typeof e?.getLocalizationState=="function"?e.getLocalizationState():{locale:v.locale,messages:{...v.messages},hasProvider:v.hasProvider}},at=(e={})=>{let t=U();if(typeof t?.createJSONLocalization=="function")return t.createJSONLocalization(e);let n=typeof e?.locale=="string"&&e.locale.trim()?e.locale.trim().toLowerCase():"en",o=Array.isArray(e?.locales)?e.locales.map(L=>String(L||"").trim().toLowerCase()).filter(Boolean):[],i=Array.from(new Set([n,...o])),r=null,d=async()=>(r||(r=W().then(L=>typeof L?.createJSONLocalization=="function"?L.createJSONLocalization(e):null).catch(()=>null)),r),S=async(L="loadLocale")=>{let p=await d();if(!p||typeof p!="object")return null;let c=p.provider;if(!c||typeof c!="object")return null;let f=c[L];return typeof f=="function"?f:L==="setLocale"&&typeof c.loadLocale=="function"?c.loadLocale:null};return{locale:n,locales:[...i],provider:{locales:[...i],async loadLocale(L={}){let p=await S("loadLocale");return typeof p!="function"?{}:p(L)},async setLocale(L={}){let p=await S("setLocale");return typeof p!="function"?{}:p(L)}}}};function B(e,t){return t&&typeof t=="string"?t:`${Q(s.currentConfig||{},{resolvePublicAssetURL:q})}core/${e}`}async function Kt(){return Array.isArray(s.defaultEnhancers)&&s.defaultEnhancers.length>0?s.defaultEnhancers:(te||(te=import(B("pds-enhancers.js",s.currentConfig?.enhancersURL)).then(t=>{let n=Array.isArray(t?.defaultPDSEnhancers)?t.defaultPDSEnhancers:[];return s.defaultEnhancers=n,n}).catch(t=>{throw te=null,t})),te)}async function Gt(){return typeof s.ask=="function"&&s.ask!==ct?s.ask:(X||(X=import(B("pds-ask.js",s.currentConfig?.askURL)).then(t=>{let n=t?.ask;if(typeof n!="function")throw new Error("Failed to load ask helper");return s.ask=n,n}).catch(t=>{throw X=null,t})),X)}async function H(){return typeof s.toast=="function"&&s.toast!==O?s.toast:(ee||(ee=import(B("pds-toast.js",s.currentConfig?.toastURL)).then(t=>{let n=t?.toast;if(typeof n!="function")throw new Error("Failed to load toast helper");return s.toast=n,n}).catch(t=>{throw ee=null,t})),ee)}async function ct(...e){return(await Gt())(...e)}async function O(...e){return(await H())(...e)}O.success=async(...e)=>(await H()).success(...e);O.error=async(...e)=>(await H()).error(...e);O.warning=async(...e)=>(await H()).warning(...e);O.info=async(...e)=>(await H()).info(...e);var Xe=function(e="log",t,...n){s.log(e,t,...n)};function _e(e){if(e==null)return e;if(typeof e=="function")return;if(typeof e!="object")return e;if(Array.isArray(e))return e.map(n=>_e(n)).filter(n=>n!==void 0);let t={};for(let[n,o]of Object.entries(e)){let i=_e(o);i!==void 0&&(t[n]=i)}return t}function lt(e,t=new WeakSet){if(!e||typeof e!="object"||t.has(e))return e;t.add(e),Object.freeze(e);for(let n of Object.keys(e))lt(e[n],t);return e}function ve(e){return e==null||typeof e!="object"?e:lt(structuredClone(_e(e)))}async function qt(e,t={}){if(t?.runtimeConfig===!1||typeof fetch!="function")return null;let n=t?.runtimeConfigURL||`${e}pds-runtime-config.json`;try{let o=await fetch(n,{cache:"no-store"});return o.ok?await o.json():null}catch{return null}}s.registry=$;s.enums=Ue;s.adoptLayers=ze;s.adoptPrimitives=Te;var Jt=fe;s.parse=Jt;var Ae=G;s.html=Ae;s.State=Y;s.bindState=Ze;s.createStylesheet=$e;s.isLiveMode=()=>$.isLive;s.ask=ct;s.toast=O;s.common=me;s.msg=M;s.str=ie;s.configureLocalization=re;s.loadLocale=st;s.setLocale=rt;s.getLocalizationState=it;s.createJSONLocalization=at;s.i18n={msg:M,str:ie,configure:re,loadLocale:st,setLocale:rt,getState:it,createJSONLocalization:at};s.AutoComplete=null;s.loadAutoComplete=async()=>{if(s.AutoComplete&&typeof s.AutoComplete.connect=="function")return s.AutoComplete;let e=B("pds-autocomplete.js",s.currentConfig?.autoCompleteURL);return Z||(Z=import(e).then(t=>{let n=t?.AutoComplete||t?.default?.AutoComplete||t?.default||null;if(!n)throw new Error("AutoComplete export not found in module");return s.AutoComplete=n,n}).catch(t=>{throw Z=null,t})),Z};function dt(e){let t=typeof CustomEvent=="function";try{let n=t?new CustomEvent("pds:ready",{detail:e}):new Event("pds:ready");s.dispatchEvent(n)}catch{}if(typeof document<"u")if(t){let n={detail:e,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:ready",n))}catch{}try{document.dispatchEvent(new CustomEvent("pds-ready",n))}catch{}}else{try{document.dispatchEvent(new Event("pds:ready"))}catch{}try{document.dispatchEvent(new Event("pds-ready"))}catch{}}}function ut(e={}){let t=typeof CustomEvent=="function",n={at:Date.now(),...e};try{let o=t?new CustomEvent("pds:config-changed",{detail:n}):new Event("pds:config-changed");s.dispatchEvent(o)}catch{}if(typeof document<"u")if(t){let o={detail:n,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:config-changed",o))}catch{}}else try{document.dispatchEvent(new Event("pds:config-changed"))}catch{}}var Ee="pure-ds-theme",C=null,F=null;function xe(e){try{if(typeof document>"u")return;let t="light";e?e==="system"?t=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t=e:t=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",document.documentElement.setAttribute("data-theme",t)}catch{}}function je(e){try{if(C&&F){try{typeof C.removeEventListener=="function"?C.removeEventListener("change",F):typeof C.removeListener=="function"&&C.removeListener(F)}catch{}C=null,F=null}if(e==="system"&&typeof window<"u"&&window.matchMedia){let t=window.matchMedia("(prefers-color-scheme: dark)"),n=o=>{let i=o?.matches===void 0?t.matches:o.matches;try{let r=i?"dark":"light";document.documentElement.setAttribute("data-theme",r),s.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:r,source:"system"}}))}catch{}};C=t,F=n,typeof t.addEventListener=="function"?t.addEventListener("change",n):typeof t.addListener=="function"&&t.addListener(n)}}catch{}}var Vt=Object.getOwnPropertyDescriptor(s,"theme");Vt||Object.defineProperty(s,"theme",{get(){try{return typeof window>"u"?null:localStorage.getItem(Ee)||null}catch{return null}},set(e){try{if(typeof window>"u")return;let t=s.currentConfig?.design||null,n=we(e);if(t&&!qe(t,n)){let o=t?.name||s.currentPreset?.name||s.currentConfig?.preset||"current preset";s.log("warn",`PDS theme "${n}" not supported by preset "${o}".`),s.dispatchEvent(new CustomEvent("pds:theme:blocked",{detail:{theme:e,resolvedTheme:n,preset:o}}));return}e==null?localStorage.removeItem(Ee):localStorage.setItem(Ee,e),xe(e),je(e),s.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:e,source:"api"}}))}catch{}}});s.defaultEnhancers=[];async function Qt(e){s.initializing=!0;try{let t=e&&e.mode||"live",{mode:n,...o}=e||{};s.mode=t,s.logHandler=typeof o?.log=="function"?o.log:null,s.currentConfig=ve(o);let i=o&&typeof o.localization=="object"&&o.localization?o.localization:null;i?(await W(),re(i)):re(null);let r;if(t==="static")r=await Yt(o);else{let{localization:S,...L}=o||{},p=Q(L,{resolvePublicAssetURL:q}),c=L?.managerURL||L?.public?.managerURL||L?.manager?.url||new URL("core/pds-manager.js",p).href||new URL("./pds-manager.js",import.meta.url).href,{startLive:f}=await import(c);r=await f(s,L,{emitReady:dt,emitConfigChanged:ut,applyResolvedTheme:xe,setupSystemListenerIfNeeded:je})}s.compiled=ve(r?.config||null);let d=s?.compiled?.design?.icons?.externalPath||"/assets/img/icons/";return s.log("info",`startup ready; external icon path: ${d}`),r}finally{s.initializing=!1}}s.start=Qt;async function Yt(e){if(!e||typeof e!="object")throw new Error("PDS.start({ mode: 'static', ... }) requires a valid configuration object");let t=e.applyGlobalStyles??!0,n=e.manageTheme??!0,o=e.themeStorageKey??"pure-ds-theme",i=e.staticPaths??{},r=Q(e,{resolvePublicAssetURL:q}),d=e&&e.autoDefine||null,S;d&&d.baseURL?S=J(V(d.baseURL,{preferModule:!1})):S=`${r}components/`;let L=d&&Array.isArray(d.predefine)&&d.predefine||[],p=d&&typeof d.mapper=="function"&&d.mapper||null;try{He(s);let{resolvedTheme:c}=Ke({manageTheme:n,themeStorageKey:o,applyResolvedTheme:xe,setupSystemListenerIfNeeded:je}),f=await qt(r,e),A=Array.isArray(e?.enhancers)?e.enhancers:e?.enhancers&&typeof e.enhancers=="object"?Object.values(e.enhancers):[],m=f?.config?{...f.config,...e,design:e?.design||f.config.design,preset:e?.preset||f.config.preset}:{...e},E={tokens:`${r}styles/pds-tokens.css.js`,primitives:`${r}styles/pds-primitives.css.js`,components:`${r}styles/pds-components.css.js`,utilities:`${r}styles/pds-utilities.css.js`,styles:`${r}styles/pds-styles.css.js`},j=f?.paths||{};if(i={...E,...j,...i},s.registry.setStaticMode(i),t&&typeof document<"u")try{let h=await s.registry.getStylesheet("styles");if(h){h._pds=!0;let u=(document.adoptedStyleSheets||[]).filter(y=>y._pds!==!0);document.adoptedStyleSheets=[...u,h],ut({mode:"static",source:"static:styles-applied"})}}catch(h){Xe.call(s,"warn","Failed to apply static styles:",h)}let a=null,l=[];try{let h=await Kt(),u=await Ge({autoDefineBaseURL:S,autoDefinePreload:L,autoDefineMapper:p,enhancers:A,autoDefineOverrides:d||null,autoDefinePreferModule:!(d&&d.baseURL)},{baseEnhancers:h});a=u.autoDefiner,l=u.mergedEnhancers||[]}catch(h){Xe.call(s,"error","\u274C Failed to initialize AutoDefiner/Enhancers (static):",h)}return s.compiled=ve({mode:"static",...m,theme:c,enhancers:l}),dt({mode:"static",config:m,theme:c,autoDefiner:a}),{config:m,theme:c,autoDefiner:a}}catch(c){throw s.dispatchEvent(new CustomEvent("pds:error",{detail:{error:c}})),c}}var Zt=s.createJSONLocalization({locale:"en-US",locales:["en-US","nl-NL"],aliases:{en:["en-US"],nl:["nl-NL"]},basePath:"/assets/locales"}),pt={mode:"live",liveEdit:!0,preset:"default",localization:Zt,autoDefine:{predefine:["pds-icon","pds-drawer","pds-toaster"]},log(e,t,...n){(this?.mode||this?.compiled?.mode||"live")!=="static"&&(typeof console[e]=="function"?console[e]:console.log)(`[PDS] ${t}`,...n)}};var D={name:"@pure-ds/core",shortname:"pds",version:"0.7.63",description:"Why develop a Design System when you can generate one?",repository:{type:"git",url:"git+https://github.com/Pure-Web-Foundation/pure-ds.git"},bugs:{url:"https://github.com/Pure-Web-Foundation/pure-ds/issues"},homepage:"https://puredesignsystem.z6.web.core.windows.net/",keywords:["design-system","css","web-components","lit","constructable-stylesheets","tokens","utilities","a11y"],type:"module",main:"./public/assets/pds/core.js",module:"./public/assets/pds/core.js",types:"./dist/types/pds.d.ts",bin:{"pds-build":"packages/pds-cli/bin/pds-static.js","pds-sync-assets":"packages/pds-cli/bin/sync-assets.js","pds-build-icons":"packages/pds-cli/bin/pds-build-icons.js","pds-import":"packages/pds-cli/bin/pds-import.js","pds-setup-copilot":"packages/pds-cli/bin/pds-setup-copilot.js","pds-setup-mcp":"packages/pds-cli/bin/pds-setup-mcp.js","pds-init-config":"packages/pds-cli/bin/pds-init-config.js","pds-bootstrap":"packages/pds-cli/bin/pds-bootstrap.js","pds-mcp-server":"packages/pds-cli/bin/pds-mcp-server.js","pds-mcp-health":"packages/pds-cli/bin/pds-mcp-health.js","pds-mcp-eval":"packages/pds-cli/bin/pds-mcp-eval.js"},exports:{".":{types:"./src/js/pds.d.ts",import:"./public/assets/pds/core.js"},"./localization":{types:"./dist/types/src/js/pds-localization.d.ts",import:"./public/assets/pds/core/pds-localization.js"},"./lit":{types:"./dist/types/src/js/lit.d.ts",import:"./public/assets/pds/external/lit.js"},"./pds-core":"./src/js/pds.js","./auto-define/*":"./public/auto-define/*"},files:[".github/copilot-instructions.md",".cursorrules","dist/types/","public/assets/js/","public/assets/pds/components/","public/assets/pds/templates/","public/assets/pds/core.js","public/assets/pds/core/","public/assets/pds/external/","public/assets/pds/vscode-custom-data.json","public/assets/pds/pds.css-data.json","public/assets/pds/pds-css-complete.json","public/auto-define/","public/pds/components/","public/assets/pds/icons/pds-icons.svg","packages/pds-cli/bin/","packages/pds-cli/lib/","src/js/pds.d.ts","src/js/pds.js","src/js/pds-singleton.js","src/js/common/","src/js/pds-live-manager/","src/js/pds-core/","custom-elements.json","custom-elements-manifest.config.js","pds.html-data.json","pds.css-data.json","LOCALIZATION.md","readme.md","INTELLISENSE.md","CSS-INTELLISENSE-LIMITATION.md","CSS-INTELLISENSE-QUICK-REF.md"],scripts:{dev:"node esbuild-dev.js",prebuild:"npm run types",build:"node esbuild-build.js",types:"tsc -p tsconfig.json && node scripts/sync-types.mjs",postinstall:"node packages/pds-cli/bin/postinstall.mjs","prepds:build":"npm run types","pds:build":"node packages/pds-cli/bin/pds-static.js","pds:build-icons":"node packages/pds-cli/bin/pds-build-icons.js","pds:bootstrap":"node packages/pds-cli/bin/pds-bootstrap.js","pds:manifest":"node packages/pds-cli/bin/generate-manifest.js","pds:css-data":"node packages/pds-cli/bin/generate-css-data.js","pds:import":"node packages/pds-cli/bin/pds-import.js","pds:dx":"node packages/pds-cli/bin/pds-dx.js","pds:mcp:server":"node packages/pds-cli/bin/pds-mcp-server.js","pds:mcp:health":"node packages/pds-cli/bin/pds-mcp-health.js","pds:mcp:eval":"node packages/pds-cli/bin/pds-mcp-eval.js","storybook:generate":"cd packages/pds-storybook && npm run generate-stories","storybook:dev":"cd packages/pds-storybook && npm run storybook:dev","storybook:build":"cd packages/pds-storybook && npm run storybook:build"},author:"Marc van Neerven",license:"ISC",engines:{node:">=18"},publishConfig:{access:"public"},devDependencies:{"@custom-elements-manifest/analyzer":"^0.9.9","@types/node":"^22.10.2",esbuild:"^0.19.0","fs-extra":"^11.1.1",typescript:"^5.6.3"},dependencies:{lit:"^3.3.2","pure-web":"1.1.32"},customElements:"custom-elements.json"};await s.start(pt);document.documentElement.lang="en";var ft=typeof D.repository=="string"?D.repository:D.repository?.url,en=ft?ft.replace(/^git\+/,"").replace(/\.git$/,""):"",Tn=D.homepage||en,zn=D.bugs?.url||"";document.body.appendChild(Ae`
3
+ See: https://github.com/Pure-Web-Foundation/pure-ds/blob/main/readme.md#lit-components-not-working`):s.log("warn",`\u26A0\uFE0F PDS component <${u}> not found. Assets may not be installed.`)}else s.log("error",`\u274C Auto-define error for <${u}>:`,y)},...E,mapper:u=>{if(customElements.get(u))return null;if(typeof i=="function")try{let y=i(u);return y===void 0?f(u):y}catch(y){return s.log("warn","Custom autoDefine.mapper error; falling back to default:",y?.message||y),f(u)}return f(u)}};p=new c(h),o.length>0&&typeof c.define=="function"&&await c.define(...o,{baseURL:n,mapper:h.mapper,onError:h.onError})}return{autoDefiner:p,mergedEnhancers:L}}var ge=["light","dark"],be=new Set(ge);function Dt(e){let n=(Array.isArray(e?.themes)?e.themes.map(o=>String(o).toLowerCase()):ge).filter(o=>be.has(o));return n.length?n:ge}function we(e,{preferDocument:t=!0}={}){let n=String(e||"").toLowerCase();if(be.has(n))return n;if(t&&typeof document<"u"){let o=document.documentElement?.getAttribute("data-theme");if(be.has(o))return o}return typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function qe(e,t){let n=we(t);return Dt(e).includes(n)}var Ct=new Set(["log","warn","error","debug","info"]),Tt="__PURE_DS_PDS_SINGLETON__",Se=null,Le=null;function Ve(){try{let t=(typeof globalThis<"u"?globalThis:window)?.[Tt];if(t&&typeof t=="object")return t}catch{return null}return null}function zt(e){return!e||typeof e!="object"?null:{mode:e.mode==="live"||e.mode==="static"?e.mode:null,debug:e.debug===!0,thisArg:e.thisArg}}function $t(e){if(typeof e!="string")return"log";let t=e.toLowerCase();return Ct.has(t)?t:"log"}function Ut(){if(typeof Le=="function")try{let t=zt(Le());if(t)return t}catch{}let e=Ve();if(e){let t=e?.mode||e?.compiled?.mode||(e?.registry?.isLive?"live":"static"),n=(e?.debug||e?.currentConfig?.debug||e?.currentConfig?.design?.debug||e?.compiled?.debug||e?.compiled?.design?.debug||!1)===!0;return{mode:t,debug:n,thisArg:e}}return{mode:null,debug:!1}}function Mt(){if(typeof Se=="function")try{let t=Se();if(typeof t=="function")return t}catch{}let e=Ve();return typeof e?.logHandler=="function"?e.logHandler:null}function Je(e,t,...n){if(typeof console>"u")return;let o=typeof console[e]=="function"?console[e].bind(console):typeof console.log=="function"?console.log.bind(console):null;o&&(n.length>0?o(t,...n):o(t))}function Ot(e,t){let n=t?.debug===!0;return!(t?.mode==="static"&&!n||!n&&e!=="error"&&e!=="warn")}function Qe({getLogger:e,getContext:t}={}){Se=typeof e=="function"?e:null,Le=typeof t=="function"?t:null}function Ye(e="log",t,...n){let o=$t(e),i=Ut(),r=Mt();if(r)try{r.call(i?.thisArg,o,t,...n);return}catch(d){Je("error","Custom log handler failed:",d)}Ot(o,i)&&Je(o,t,...n)}var Y=class{constructor(t={},n=null){let o=t&&typeof t=="object"?t:{},i=n||(typeof document<"u"?document:new EventTarget),r=new WeakMap,d=m=>m.map(E=>String(E)).join("."),S,L=(m,E,j,a)=>{let l=d(m),h={property:E,path:l,value:j,oldValue:a};i.dispatchEvent(new CustomEvent(`change:${l}`,{detail:h,bubbles:!0,composed:!0})),i.dispatchEvent(new CustomEvent("change",{detail:{...h,state:S},bubbles:!0,composed:!0}))},p=(m,E)=>(typeof E=="function"&&i.addEventListener(m,E),S),c=(m,E)=>(typeof E=="function"&&i.removeEventListener(m,E),S),f=(m,E)=>{if(typeof E=="function"){let j=a=>{E(a),i.removeEventListener(m,j)};i.addEventListener(m,j)}return S},A=(m,E)=>{if(!m||typeof m!="object")return m;if(r.has(m))return r.get(m);let j=new Proxy(m,{get(a,l,h){if(l==="on")return p;if(l==="off")return c;if(l==="once")return f;let u=Reflect.get(a,l,h);return u&&typeof u=="object"?A(u,[...E,l]):u},set(a,l,h,u){let y=Reflect.get(a,l,u);return Object.is(y,h)?!0:Reflect.set(a,l,h,u)?(L([...E,l],l,h,y),!0):!1},deleteProperty(a,l){if(!Reflect.has(a,l))return!0;let h=a[l];return Reflect.deleteProperty(a,l)?(L([...E,l],l,void 0,h),!0):!1}});return r.set(m,j),j};return S=A(o,[]),S}};function Ze(e,t,n){if(!e||!t||typeof n!="object")return()=>{};let o={};return Object.entries(n).forEach(([i,r])=>{o[i]=d=>{typeof r=="function"&&r(e,d.detail.value,d.detail.oldValue)},t.on(`change:${i}`,o[i])}),()=>{Object.entries(o).forEach(([i,r])=>{t.off(`change:${i}`,r)})}}typeof s.initializing!="boolean"&&(s.initializing=!1);"currentPreset"in s||(s.currentPreset=null);typeof s.debug!="boolean"&&(s.debug=!1);"currentConfig"in s||(s.currentConfig=null);"compiled"in s||(s.compiled=null);typeof s.logHandler!="function"&&(s.logHandler=null);"mode"in s||(s.mode=null);var Z=null,X=null,ee=null,te=null,ne=null,oe=null,et="__pdsLocalizationRuntime";function U(){if(oe)return oe;let e=s?.[et];return e&&typeof e=="object"?(oe=e,e):null}function Nt(e){let t=e&&typeof e=="object"?e:null;oe=t,s[et]=t}Qe({getLogger:()=>typeof s.logHandler=="function"?s.logHandler:null,getContext:()=>{let e=s?.mode||s?.compiled?.mode||(s?.registry?.isLive?"live":"static"),t=(s?.debug||s?.currentConfig?.debug||s?.currentConfig?.design?.debug||s?.compiled?.debug||s?.compiled?.design?.debug||!1)===!0;return{mode:e,debug:t,thisArg:s}}});s.log=(e="log",t,...n)=>{Ye(e,t,...n)};var v={locale:"en",messages:{},hasProvider:!1},se=new Set;function tt(e){return!!e&&typeof e!="string"&&typeof e=="object"&&"strTag"in e}function nt(e=[]){let t="";for(let n=0;n<=e.length-1;n+=1)t+=e[n],n<e.length-1&&(t+=`{${n}}`);return t}function It(e,t){return String(e).replace(/\{(\d+)\}/g,(n,o)=>t(Number(o)))}function Ft(e){if(!e||typeof e!="object")return{};let t={};for(let[n,o]of Object.entries(e)){if(typeof o=="string"){t[n]=o;continue}o&&typeof o=="object"&&typeof o.content=="string"&&(t[n]=o.content)}return t}function Wt(e,...t){return{strTag:!0,strings:Array.from(e||[]),values:t,raw:Array.from(e?.raw||[])}}function Bt(e){if(!e)return"";if(tt(e)){let n=nt(e.strings||[]),o=v.messages[n]||n;return It(o,i=>e.values?.[i])}let t=String(e);return v.messages[t]||t}function Ht(e){if(!e)return;let t=tt(e)?nt(e.strings||[]):String(e);typeof t=="string"&&t.length>0&&se.add(t)}function ot(e){if(!e||typeof e.msg!="function"||se.size===0)return;let t=Array.from(se);se.clear();for(let n of t)try{e.msg(n)}catch{}}async function W(){let e=U();return e||(ne||(ne=import(B("pds-localization.js")).then(n=>{if(typeof n?.msg!="function"||typeof n?.str!="function"||typeof n?.configureLocalization!="function"||typeof n?.loadLocale!="function"||typeof n?.setLocale!="function"||typeof n?.getLocalizationState!="function")throw new Error("Failed to load localization runtime exports");return Nt(n),ot(n),n}).catch(n=>{throw ne=null,n})),ne)}var M=(e,t={})=>{let n=U();return typeof n?.msg=="function"?n.msg(e,t):(Ht(e),Bt(e,t))},ie=(e,...t)=>{let n=U();return typeof n?.str=="function"?n.str(e,...t):Wt(e,...t)},re=(e=null)=>{let t=U();if(typeof t?.configureLocalization=="function")return t.configureLocalization(e);if(!e||typeof e!="object")return v.locale="en",v.messages={},v.hasProvider=!1,{locale:v.locale,messages:{...v.messages},hasProvider:v.hasProvider};typeof e.locale=="string"&&e.locale.trim()&&(v.locale=e.locale.trim()),Object.prototype.hasOwnProperty.call(e,"messages")&&(v.messages=Ft(e.messages));let n=!!(e.provider||e.translate||e.loadLocale||e.setLocale);return v.hasProvider=n,n&&W().then(o=>{o.configureLocalization(e),ot(o)}).catch(()=>{}),{locale:v.locale,messages:{...v.messages},hasProvider:v.hasProvider}},st=async e=>(await W()).loadLocale(e),rt=async(e,t={})=>(await W()).setLocale(e,t),it=()=>{let e=U();return typeof e?.getLocalizationState=="function"?e.getLocalizationState():{locale:v.locale,messages:{...v.messages},hasProvider:v.hasProvider}},at=(e={})=>{let t=U();if(typeof t?.createJSONLocalization=="function")return t.createJSONLocalization(e);let n=typeof e?.locale=="string"&&e.locale.trim()?e.locale.trim().toLowerCase():"en",o=Array.isArray(e?.locales)?e.locales.map(L=>String(L||"").trim().toLowerCase()).filter(Boolean):[],i=Array.from(new Set([n,...o])),r=null,d=async()=>(r||(r=W().then(L=>typeof L?.createJSONLocalization=="function"?L.createJSONLocalization(e):null).catch(()=>null)),r),S=async(L="loadLocale")=>{let p=await d();if(!p||typeof p!="object")return null;let c=p.provider;if(!c||typeof c!="object")return null;let f=c[L];return typeof f=="function"?f:L==="setLocale"&&typeof c.loadLocale=="function"?c.loadLocale:null};return{locale:n,locales:[...i],provider:{locales:[...i],async loadLocale(L={}){let p=await S("loadLocale");return typeof p!="function"?{}:p(L)},async setLocale(L={}){let p=await S("setLocale");return typeof p!="function"?{}:p(L)}}}};function B(e,t){return t&&typeof t=="string"?t:`${Q(s.currentConfig||{},{resolvePublicAssetURL:q})}core/${e}`}async function Kt(){return Array.isArray(s.defaultEnhancers)&&s.defaultEnhancers.length>0?s.defaultEnhancers:(te||(te=import(B("pds-enhancers.js",s.currentConfig?.enhancersURL)).then(t=>{let n=Array.isArray(t?.defaultPDSEnhancers)?t.defaultPDSEnhancers:[];return s.defaultEnhancers=n,n}).catch(t=>{throw te=null,t})),te)}async function Gt(){return typeof s.ask=="function"&&s.ask!==ct?s.ask:(X||(X=import(B("pds-ask.js",s.currentConfig?.askURL)).then(t=>{let n=t?.ask;if(typeof n!="function")throw new Error("Failed to load ask helper");return s.ask=n,n}).catch(t=>{throw X=null,t})),X)}async function H(){return typeof s.toast=="function"&&s.toast!==O?s.toast:(ee||(ee=import(B("pds-toast.js",s.currentConfig?.toastURL)).then(t=>{let n=t?.toast;if(typeof n!="function")throw new Error("Failed to load toast helper");return s.toast=n,n}).catch(t=>{throw ee=null,t})),ee)}async function ct(...e){return(await Gt())(...e)}async function O(...e){return(await H())(...e)}O.success=async(...e)=>(await H()).success(...e);O.error=async(...e)=>(await H()).error(...e);O.warning=async(...e)=>(await H()).warning(...e);O.info=async(...e)=>(await H()).info(...e);var Xe=function(e="log",t,...n){s.log(e,t,...n)};function _e(e){if(e==null)return e;if(typeof e=="function")return;if(typeof e!="object")return e;if(Array.isArray(e))return e.map(n=>_e(n)).filter(n=>n!==void 0);let t={};for(let[n,o]of Object.entries(e)){let i=_e(o);i!==void 0&&(t[n]=i)}return t}function lt(e,t=new WeakSet){if(!e||typeof e!="object"||t.has(e))return e;t.add(e),Object.freeze(e);for(let n of Object.keys(e))lt(e[n],t);return e}function ve(e){return e==null||typeof e!="object"?e:lt(structuredClone(_e(e)))}async function qt(e,t={}){if(t?.runtimeConfig===!1||typeof fetch!="function")return null;let n=t?.runtimeConfigURL||`${e}pds-runtime-config.json`;try{let o=await fetch(n,{cache:"no-store"});return o.ok?await o.json():null}catch{return null}}s.registry=$;s.enums=Ue;s.adoptLayers=ze;s.adoptPrimitives=Te;var Jt=fe;s.parse=Jt;var Ae=G;s.html=Ae;s.State=Y;s.bindState=Ze;s.createStylesheet=$e;s.isLiveMode=()=>$.isLive;s.ask=ct;s.toast=O;s.common=me;s.msg=M;s.str=ie;s.configureLocalization=re;s.loadLocale=st;s.setLocale=rt;s.getLocalizationState=it;s.createJSONLocalization=at;s.i18n={msg:M,str:ie,configure:re,loadLocale:st,setLocale:rt,getState:it,createJSONLocalization:at};s.AutoComplete=null;s.loadAutoComplete=async()=>{if(s.AutoComplete&&typeof s.AutoComplete.connect=="function")return s.AutoComplete;let e=B("pds-autocomplete.js",s.currentConfig?.autoCompleteURL);return Z||(Z=import(e).then(t=>{let n=t?.AutoComplete||t?.default?.AutoComplete||t?.default||null;if(!n)throw new Error("AutoComplete export not found in module");return s.AutoComplete=n,n}).catch(t=>{throw Z=null,t})),Z};function dt(e){let t=typeof CustomEvent=="function";try{let n=t?new CustomEvent("pds:ready",{detail:e}):new Event("pds:ready");s.dispatchEvent(n)}catch{}if(typeof document<"u")if(t){let n={detail:e,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:ready",n))}catch{}try{document.dispatchEvent(new CustomEvent("pds-ready",n))}catch{}}else{try{document.dispatchEvent(new Event("pds:ready"))}catch{}try{document.dispatchEvent(new Event("pds-ready"))}catch{}}}function ut(e={}){let t=typeof CustomEvent=="function",n={at:Date.now(),...e};try{let o=t?new CustomEvent("pds:config-changed",{detail:n}):new Event("pds:config-changed");s.dispatchEvent(o)}catch{}if(typeof document<"u")if(t){let o={detail:n,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:config-changed",o))}catch{}}else try{document.dispatchEvent(new Event("pds:config-changed"))}catch{}}var Ee="pure-ds-theme",C=null,F=null;function xe(e){try{if(typeof document>"u")return;let t="light";e?e==="system"?t=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t=e:t=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",document.documentElement.setAttribute("data-theme",t)}catch{}}function je(e){try{if(C&&F){try{typeof C.removeEventListener=="function"?C.removeEventListener("change",F):typeof C.removeListener=="function"&&C.removeListener(F)}catch{}C=null,F=null}if(e==="system"&&typeof window<"u"&&window.matchMedia){let t=window.matchMedia("(prefers-color-scheme: dark)"),n=o=>{let i=o?.matches===void 0?t.matches:o.matches;try{let r=i?"dark":"light";document.documentElement.setAttribute("data-theme",r),s.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:r,source:"system"}}))}catch{}};C=t,F=n,typeof t.addEventListener=="function"?t.addEventListener("change",n):typeof t.addListener=="function"&&t.addListener(n)}}catch{}}var Vt=Object.getOwnPropertyDescriptor(s,"theme");Vt||Object.defineProperty(s,"theme",{get(){try{return typeof window>"u"?null:localStorage.getItem(Ee)||null}catch{return null}},set(e){try{if(typeof window>"u")return;let t=s.currentConfig?.design||null,n=we(e);if(t&&!qe(t,n)){let o=t?.name||s.currentPreset?.name||s.currentConfig?.preset||"current preset";s.log("warn",`PDS theme "${n}" not supported by preset "${o}".`),s.dispatchEvent(new CustomEvent("pds:theme:blocked",{detail:{theme:e,resolvedTheme:n,preset:o}}));return}e==null?localStorage.removeItem(Ee):localStorage.setItem(Ee,e),xe(e),je(e),s.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:e,source:"api"}}))}catch{}}});s.defaultEnhancers=[];async function Qt(e){s.initializing=!0;try{let t=e&&e.mode||"live",{mode:n,...o}=e||{};s.mode=t,s.logHandler=typeof o?.log=="function"?o.log:null,s.currentConfig=ve(o);let i=o&&typeof o.localization=="object"&&o.localization?o.localization:null;i?(await W(),re(i)):re(null);let r;if(t==="static")r=await Yt(o);else{let{localization:S,...L}=o||{},p=Q(L,{resolvePublicAssetURL:q}),c=L?.managerURL||L?.public?.managerURL||L?.manager?.url||new URL("core/pds-manager.js",p).href||new URL("./pds-manager.js",import.meta.url).href,{startLive:f}=await import(c);r=await f(s,L,{emitReady:dt,emitConfigChanged:ut,applyResolvedTheme:xe,setupSystemListenerIfNeeded:je})}s.compiled=ve(r?.config||null);let d=s?.compiled?.design?.icons?.externalPath||"/assets/img/icons/";return s.log("info",`startup ready; external icon path: ${d}`),r}finally{s.initializing=!1}}s.start=Qt;async function Yt(e){if(!e||typeof e!="object")throw new Error("PDS.start({ mode: 'static', ... }) requires a valid configuration object");let t=e.applyGlobalStyles??!0,n=e.manageTheme??!0,o=e.themeStorageKey??"pure-ds-theme",i=e.staticPaths??{},r=Q(e,{resolvePublicAssetURL:q}),d=e&&e.autoDefine||null,S;d&&d.baseURL?S=J(V(d.baseURL,{preferModule:!1})):S=`${r}components/`;let L=d&&Array.isArray(d.predefine)&&d.predefine||[],p=d&&typeof d.mapper=="function"&&d.mapper||null;try{He(s);let{resolvedTheme:c}=Ke({manageTheme:n,themeStorageKey:o,applyResolvedTheme:xe,setupSystemListenerIfNeeded:je}),f=await qt(r,e),A=Array.isArray(e?.enhancers)?e.enhancers:e?.enhancers&&typeof e.enhancers=="object"?Object.values(e.enhancers):[],m=f?.config?{...f.config,...e,design:e?.design||f.config.design,preset:e?.preset||f.config.preset}:{...e},E={tokens:`${r}styles/pds-tokens.css.js`,primitives:`${r}styles/pds-primitives.css.js`,components:`${r}styles/pds-components.css.js`,utilities:`${r}styles/pds-utilities.css.js`,styles:`${r}styles/pds-styles.css.js`},j=f?.paths||{};if(i={...E,...j,...i},s.registry.setStaticMode(i),t&&typeof document<"u")try{let h=await s.registry.getStylesheet("styles");if(h){h._pds=!0;let u=(document.adoptedStyleSheets||[]).filter(y=>y._pds!==!0);document.adoptedStyleSheets=[...u,h],ut({mode:"static",source:"static:styles-applied"})}}catch(h){Xe.call(s,"warn","Failed to apply static styles:",h)}let a=null,l=[];try{let h=await Kt(),u=await Ge({autoDefineBaseURL:S,autoDefinePreload:L,autoDefineMapper:p,enhancers:A,autoDefineOverrides:d||null,autoDefinePreferModule:!(d&&d.baseURL)},{baseEnhancers:h});a=u.autoDefiner,l=u.mergedEnhancers||[]}catch(h){Xe.call(s,"error","\u274C Failed to initialize AutoDefiner/Enhancers (static):",h)}return s.compiled=ve({mode:"static",...m,theme:c,enhancers:l}),dt({mode:"static",config:m,theme:c,autoDefiner:a}),{config:m,theme:c,autoDefiner:a}}catch(c){throw s.dispatchEvent(new CustomEvent("pds:error",{detail:{error:c}})),c}}var Zt=s.createJSONLocalization({locale:"en-US",locales:["en-US","nl-NL"],aliases:{en:["en-US"],nl:["nl-NL"]},basePath:"/assets/locales"}),pt={mode:"live",liveEdit:!0,preset:"default",localization:Zt,autoDefine:{predefine:["pds-icon","pds-drawer","pds-toaster"]},log(e,t,...n){(this?.mode||this?.compiled?.mode||"live")!=="static"&&(typeof console[e]=="function"?console[e]:console.log)(`[PDS] ${t}`,...n)}};var D={name:"@pure-ds/core",shortname:"pds",version:"0.7.65",description:"Why develop a Design System when you can generate one?",repository:{type:"git",url:"git+https://github.com/Pure-Web-Foundation/pure-ds.git"},bugs:{url:"https://github.com/Pure-Web-Foundation/pure-ds/issues"},homepage:"https://puredesignsystem.z6.web.core.windows.net/",keywords:["design-system","css","web-components","lit","constructable-stylesheets","tokens","utilities","a11y"],type:"module",main:"./public/assets/pds/core.js",module:"./public/assets/pds/core.js",types:"./dist/types/pds.d.ts",bin:{"pds-build":"packages/pds-cli/bin/pds-static.js","pds-sync-assets":"packages/pds-cli/bin/sync-assets.js","pds-build-icons":"packages/pds-cli/bin/pds-build-icons.js","pds-import":"packages/pds-cli/bin/pds-import.js","pds-setup-copilot":"packages/pds-cli/bin/pds-setup-copilot.js","pds-setup-mcp":"packages/pds-cli/bin/pds-setup-mcp.js","pds-init-config":"packages/pds-cli/bin/pds-init-config.js","pds-bootstrap":"packages/pds-cli/bin/pds-bootstrap.js","pds-mcp-server":"packages/pds-cli/bin/pds-mcp-server.js","pds-mcp-health":"packages/pds-cli/bin/pds-mcp-health.js","pds-mcp-eval":"packages/pds-cli/bin/pds-mcp-eval.js"},exports:{".":{types:"./src/js/pds.d.ts",import:"./public/assets/pds/core.js"},"./localization":{types:"./dist/types/src/js/pds-localization.d.ts",import:"./public/assets/pds/core/pds-localization.js"},"./lit":{types:"./dist/types/src/js/lit.d.ts",import:"./public/assets/pds/external/lit.js"},"./pds-core":"./src/js/pds.js","./auto-define/*":"./public/auto-define/*"},files:[".github/copilot-instructions.md",".cursorrules","dist/types/","public/assets/js/","public/assets/pds/components/","public/assets/pds/templates/","public/assets/pds/core.js","public/assets/pds/core/","public/assets/pds/external/","public/assets/pds/vscode-custom-data.json","public/assets/pds/pds.css-data.json","public/assets/pds/pds-css-complete.json","public/auto-define/","public/pds/components/","public/assets/pds/icons/pds-icons.svg","packages/pds-cli/bin/","packages/pds-cli/lib/","src/js/pds.d.ts","src/js/pds.js","src/js/pds-singleton.js","src/js/common/","src/js/pds-live-manager/","src/js/pds-core/","custom-elements.json","custom-elements-manifest.config.js","pds.html-data.json","pds.css-data.json","LOCALIZATION.md","readme.md","INTELLISENSE.md","CSS-INTELLISENSE-LIMITATION.md","CSS-INTELLISENSE-QUICK-REF.md"],scripts:{dev:"node esbuild-dev.js",prebuild:"npm run types",build:"node esbuild-build.js",types:"tsc -p tsconfig.json && node scripts/sync-types.mjs",postinstall:"node packages/pds-cli/bin/postinstall.mjs","prepds:build":"npm run types","pds:build":"node packages/pds-cli/bin/pds-static.js","pds:build-icons":"node packages/pds-cli/bin/pds-build-icons.js","pds:bootstrap":"node packages/pds-cli/bin/pds-bootstrap.js","pds:manifest":"node packages/pds-cli/bin/generate-manifest.js","pds:css-data":"node packages/pds-cli/bin/generate-css-data.js","pds:import":"node packages/pds-cli/bin/pds-import.js","pds:dx":"node packages/pds-cli/bin/pds-dx.js","pds:mcp:server":"node packages/pds-cli/bin/pds-mcp-server.js","pds:mcp:health":"node packages/pds-cli/bin/pds-mcp-health.js","pds:mcp:eval":"node packages/pds-cli/bin/pds-mcp-eval.js","storybook:generate":"cd packages/pds-storybook && npm run generate-stories","storybook:dev":"cd packages/pds-storybook && npm run storybook:dev","storybook:build":"cd packages/pds-storybook && npm run storybook:build"},author:"Marc van Neerven",license:"ISC",engines:{node:">=18"},publishConfig:{access:"public"},devDependencies:{"@custom-elements-manifest/analyzer":"^0.9.9","@types/node":"^22.10.2",esbuild:"^0.19.0","fs-extra":"^11.1.1",typescript:"^5.6.3"},dependencies:{lit:"^3.3.2","pure-web":"1.1.32"},customElements:"custom-elements.json"};await s.start(pt);document.documentElement.lang="en";var ft=typeof D.repository=="string"?D.repository:D.repository?.url,en=ft?ft.replace(/^git\+/,"").replace(/\.git$/,""):"",Tn=D.homepage||en,zn=D.bugs?.url||"";document.body.appendChild(Ae`
4
4
  <div class="container text-center">
5
5
  <img src="/assets/img/pds-logo.svg" alt="PDS Logo" title="${M("PDS Logo")}" width="64" height="64" />
6
6
  <header class="container section">
@@ -1647,7 +1647,7 @@ export class SchemaForm extends LitElement {
1647
1647
  // Fallback text input
1648
1648
  this.#renderers.set(
1649
1649
  "*",
1650
- ({ id, path, value, attrs, set }) => html`
1650
+ ({ id, path, value, attrs, set, ui }) => html`
1651
1651
  <input
1652
1652
  id=${id}
1653
1653
  name=${path}
@@ -1660,7 +1660,7 @@ export class SchemaForm extends LitElement {
1660
1660
  ?readonly=${!!attrs.readOnly}
1661
1661
  ?disabled=${!!attrs.disabled}
1662
1662
  ?required=${!!attrs.required}
1663
- autocomplete=${ifDefined(attrs.autocomplete)}
1663
+ autocomplete=${ifDefined(ui?.["ui:autocomplete"] ?? attrs.autocomplete)}
1664
1664
  @input=${(e) => set(e.target.value)}
1665
1665
  />
1666
1666
  `
@@ -1681,7 +1681,7 @@ export class SchemaForm extends LitElement {
1681
1681
  ?readonly=${!!attrs.readOnly}
1682
1682
  ?disabled=${!!attrs.disabled}
1683
1683
  ?required=${!!attrs.required}
1684
- autocomplete=${ifDefined(attrs.autocomplete)}
1684
+ autocomplete=${ifDefined(ui?.["ui:autocomplete"] ?? attrs.autocomplete)}
1685
1685
  list=${ifDefined(ui?.["ui:datalist"] ? `${id}-datalist` : attrs.list)}
1686
1686
  @input=${(e) => set(e.target.value)}
1687
1687
  />
@@ -21,6 +21,15 @@ class PdsScrollrow extends HTMLElement {
21
21
  #ro;
22
22
  #rendered = false;
23
23
  #adopted = false;
24
+ #updateFrame = 0;
25
+ #refreshMetricsPending = false;
26
+ #padStart = 0;
27
+ #padEnd = 0;
28
+ #direction = "ltr";
29
+ #prevButton;
30
+ #nextButton;
31
+ #lastAtStart;
32
+ #lastAtEnd;
24
33
 
25
34
  static get observedAttributes() {
26
35
  return ["label", "snap", "tile-min", "tile-max"];
@@ -170,9 +179,11 @@ class PdsScrollrow extends HTMLElement {
170
179
  this.render();
171
180
  this.#postRender();
172
181
  this.#rendered = true;
182
+ } else if (this.#viewport && this.#ro) {
183
+ this.#ro.observe(this.#viewport);
173
184
  }
174
- // In case content/size changed while disconnected
175
- this.#updateControls();
185
+ // Defer measurement to the next frame so layout can settle first.
186
+ this.#scheduleUpdateControls({ refreshMetrics: true });
176
187
  }
177
188
 
178
189
  /**
@@ -180,6 +191,10 @@ class PdsScrollrow extends HTMLElement {
180
191
  */
181
192
  disconnectedCallback() {
182
193
  this.#ro?.disconnect();
194
+ if (this.#updateFrame) {
195
+ cancelAnimationFrame(this.#updateFrame);
196
+ this.#updateFrame = 0;
197
+ }
183
198
  }
184
199
 
185
200
  /**
@@ -226,6 +241,7 @@ class PdsScrollrow extends HTMLElement {
226
241
  case "tile-min":
227
242
  case "tile-max": {
228
243
  this.#applyTileSizing();
244
+ this.#scheduleUpdateControls({ refreshMetrics: true });
229
245
  break;
230
246
  }
231
247
  }
@@ -276,35 +292,61 @@ class PdsScrollrow extends HTMLElement {
276
292
  this.#viewport = root.querySelector(".viewport");
277
293
 
278
294
  // Events
279
- this.#viewport.addEventListener("scroll", () => this.#onScroll());
295
+ this.#viewport.addEventListener("scroll", () => this.#onScroll(), {
296
+ passive: true,
297
+ });
280
298
  this.#viewport.addEventListener("keydown", (e) => this.#onKeyDown(e));
281
299
  // Update when images inside slotted content finish loading (capture because load doesn't bubble)
282
300
  this.#viewport.addEventListener(
283
301
  "load",
284
- () => this.#updateControls(),
302
+ () => this.#scheduleUpdateControls(),
285
303
  true
286
304
  );
287
305
 
288
306
  const [prevBtn, nextBtn] = root.querySelectorAll(".control button");
289
- if (prevBtn) prevBtn.addEventListener("click", (e) => this.doPage(e));
290
- if (nextBtn) nextBtn.addEventListener("click", (e) => this.doPage(e));
307
+ this.#prevButton = prevBtn ?? null;
308
+ this.#nextButton = nextBtn ?? null;
309
+ if (this.#prevButton) this.#prevButton.addEventListener("click", (e) => this.doPage(e));
310
+ if (this.#nextButton) this.#nextButton.addEventListener("click", (e) => this.doPage(e));
291
311
 
292
312
  // Slot content changes may affect scrollWidth
293
313
  const defaultSlot = root.querySelector("slot:not([name])");
294
- defaultSlot?.addEventListener("slotchange", () => this.#updateControls());
314
+ defaultSlot?.addEventListener("slotchange", () => this.#scheduleUpdateControls());
295
315
 
296
316
  // Apply initial snap alignment
297
317
  this.#applySnap();
298
318
  this.#applyTileSizing();
299
319
 
300
320
  // Observe size changes to refresh controls
301
- this.#ro = new ResizeObserver(() => this.#updateControls());
321
+ this.#ro = new ResizeObserver(() => this.#scheduleUpdateControls({ refreshMetrics: true }));
302
322
  if (this.#viewport) this.#ro.observe(this.#viewport);
303
323
 
304
- // Initial state (layout can be delayed; schedule a couple of passes)
305
- this.#updateControls();
306
- queueMicrotask(() => this.#updateControls());
307
- requestAnimationFrame(() => this.#updateControls());
324
+ // Initial state: batch measurement into the next frame.
325
+ this.#scheduleUpdateControls({ refreshMetrics: true });
326
+ }
327
+
328
+ #scheduleUpdateControls({ refreshMetrics = false } = {}) {
329
+ this.#refreshMetricsPending ||= refreshMetrics;
330
+ if (this.#updateFrame) return;
331
+
332
+ this.#updateFrame = requestAnimationFrame(() => {
333
+ this.#updateFrame = 0;
334
+ if (this.#refreshMetricsPending) {
335
+ this.#refreshMetricsPending = false;
336
+ this.#refreshMetrics();
337
+ }
338
+ this.#updateControls();
339
+ });
340
+ }
341
+
342
+ #refreshMetrics() {
343
+ const el = this.#viewport;
344
+ if (!el) return;
345
+
346
+ const computed = getComputedStyle(el);
347
+ this.#padStart = parseFloat(computed.paddingInlineStart) || 0;
348
+ this.#padEnd = parseFloat(computed.paddingInlineEnd) || 0;
349
+ this.#direction = computed.direction || "ltr";
308
350
  }
309
351
 
310
352
  #applySnap() {
@@ -342,30 +384,25 @@ class PdsScrollrow extends HTMLElement {
342
384
  }
343
385
 
344
386
  #onScroll() {
345
- this.#updateControls();
387
+ this.#scheduleUpdateControls();
346
388
  }
347
389
 
348
390
  #updateControls() {
349
391
  const el = this.#viewport;
350
392
  if (!el) return;
351
393
 
352
- const computed = getComputedStyle(el);
353
- const padStart = parseFloat(computed.paddingInlineStart) || 0;
354
- const padEnd = parseFloat(computed.paddingInlineEnd) || 0;
355
-
356
394
  const maxScroll = Math.max(0, el.scrollWidth - el.clientWidth);
357
- const dir = computed.direction;
358
395
  let position = el.scrollLeft;
359
396
 
360
- if (dir === "rtl") {
397
+ if (this.#direction === "rtl") {
361
398
  position = position < 0 ? -position : maxScroll - position;
362
399
  }
363
400
 
364
401
  position = Math.min(maxScroll, Math.max(0, position));
365
402
 
366
403
  const baseThreshold = 2;
367
- const startThreshold = Math.max(baseThreshold, Math.ceil(padStart) + 1);
368
- const endThreshold = Math.max(baseThreshold, Math.ceil(padEnd) + 1);
404
+ const startThreshold = Math.max(baseThreshold, Math.ceil(this.#padStart) + 1);
405
+ const endThreshold = Math.max(baseThreshold, Math.ceil(this.#padEnd) + 1);
369
406
 
370
407
  let atStart = position <= startThreshold;
371
408
  let atEnd = maxScroll - position <= endThreshold;
@@ -375,14 +412,16 @@ class PdsScrollrow extends HTMLElement {
375
412
  atEnd = true;
376
413
  }
377
414
 
378
- this.classList.toggle("can-scroll-left", !atStart);
379
- this.classList.toggle("can-scroll-right", !atEnd);
380
- const buttons = this.shadowRoot.querySelectorAll(".control button");
381
- const prevBtn = buttons[0];
382
- const nextBtn = buttons[1];
383
- if (prevBtn && nextBtn) {
384
- prevBtn.disabled = atStart;
385
- nextBtn.disabled = atEnd;
415
+ if (this.#lastAtStart !== atStart) {
416
+ this.classList.toggle("can-scroll-left", !atStart);
417
+ if (this.#prevButton) this.#prevButton.disabled = atStart;
418
+ this.#lastAtStart = atStart;
419
+ }
420
+
421
+ if (this.#lastAtEnd !== atEnd) {
422
+ this.classList.toggle("can-scroll-right", !atEnd);
423
+ if (this.#nextButton) this.#nextButton.disabled = atEnd;
424
+ this.#lastAtEnd = atEnd;
386
425
  }
387
426
  }
388
427