@pure-ds/core 0.7.39 → 0.7.40

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.
@@ -1 +1 @@
1
- {"version":3,"file":"pds-icon.d.ts","sourceRoot":"","sources":["../../../../../../public/assets/pds/components/pds-icon.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;IACE,oCAAkF;IAClF,sDAAwC;IAGxC;;;;;;;;;;MAkBE;IAEF,qCAAkC;IAClC,oCAAiC;IAGjC,wCAAqC;IAErC,2CAAwC;IAExC,yCAA2C;IAE3C,2BAA6B;IAE7B,4CAA8B;IAO9B,oDA4CC;IA0dD;;;;OAIG;IACH,mCAWC;IAED;;;;OAIG;IACH,6CAOC;IAED;;;OAGG;IACH,qCAYC;IAED;;;;;OAKG;IACH,yCAOC;IAED;;;;;;OAMG;IACH,uCAEC;IAED;;;;;;OAMG;IACH,kCAUC;IAED;;;;OAIG;IACH,qCAOC;IAED;;;;OAIG;IACH,mCAHW,MAAM,kBACJ,OAAO,CAAC,OAAO,CAAC,CAgH5B;IAED,wDA8EC;IACD,+BAMC;IA5wBC,kBAAwB;IACxB,kBAAwB;IACxB,mBAAsB;IACtB,iBAAuB;IACvB,wBAA2B;IAC3B,kBAAoB;IACpB,mBAAqB;IACrB,mBAAqB;IACrB,yBAA2B;IAC3B,yBAA2B;IAG7B,0BAIC;IAED,6BAGC;IAED,wEAmBC;IAED,eAqQC;IA0JD;;;;;OAKG;IACH,0BAFa,OAAO,CAInB;;CA0TF"}
1
+ {"version":3,"file":"pds-icon.d.ts","sourceRoot":"","sources":["../../../../../../public/assets/pds/components/pds-icon.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;IACE,oCAAkF;IAClF,sDAAwC;IAGxC;;;;;;;;;;MAkBE;IAEF,qCAAkC;IAClC,oCAAiC;IAGjC,wCAAqC;IAErC,2CAAwC;IAExC,yCAA2C;IAE3C,2BAA6B;IAE7B,4CAA8B;IAO9B,oDA4CC;IAkeD;;;;OAIG;IACH,mCAWC;IAED;;;;OAIG;IACH,6CAOC;IAED;;;OAGG;IACH,qCAYC;IAED;;;;;OAKG;IACH,yCAOC;IAED;;;;;;OAMG;IACH,uCAEC;IAED;;;;;;OAMG;IACH,kCAUC;IAED;;;;OAIG;IACH,qCAOC;IAED;;;;OAIG;IACH,mCAHW,MAAM,kBACJ,OAAO,CAAC,OAAO,CAAC,CAgH5B;IAED,wDA8EC;IACD,+BAMC;IApxBC,kBAAwB;IACxB,kBAAwB;IACxB,mBAAsB;IACtB,iBAAuB;IACvB,wBAA2B;IAC3B,kBAAoB;IACpB,mBAAqB;IACrB,mBAAqB;IACrB,yBAA2B;IAC3B,yBAA2B;IAG7B,0BAIC;IAED,6BAGC;IAED,wEAmBC;IAED,eA6QC;IA0JD;;;;;OAKG;IACH,0BAFa,OAAO,CAInB;;CA0TF"}
@@ -1 +1 @@
1
- {"version":3,"file":"pds-omnibox.d.ts","sourceRoot":"","sources":["../../../../../../public/assets/pds/components/pds-omnibox.js"],"names":[],"mappings":"AAuCA;IACE,+BAA6B;IAE7B,0CAUC;IAwBD,0BAaC;IAED,6BAoBC;IAED,wEAGC;IAMD,yBAEC;IAND,oBAEC;IAUD,wBAGC;IAPD,mBAEC;IAWD,4BAGC;IAPD,uBAEC;IAWD,sBAIC;IARD,iBAEC;IAYD,6BAGC;IAPD,wBAEC;IAWD,6BAGC;IAPD,wBAEC;IAWD,gCAGC;IAPD,2BAEC;IAWD,wBAGC;IAPD,mBAEC;IAOD,+BAA2B;IAE3B,0CAGC;IAED,0BAEC;IAED,2CAEC;IAED,qBAEC;IAED,sBAEC;;CA+zBF;;;;;cAhhCa,CAAC,OAAO,CAAC,KAAQ,KAAK,OAAO;;;;eAC7B,CAAC,OAAO,CAAC,KAAQ,KAAK,OAAO,CAAC,KAAK,KAAQ,CAAC,GAAC,KAAK,KAAQ;;;;aAC1D,CAAC,IAAI,CAAC,KAAQ,KAAK,GAAG;;;;sBACtB,OAAO;;;;gBACP,MAAM;;;;;;mBAKN,OAAO;;;;eACP,MAAM;;;;kBACN,CAAC,IAAI,CAAC,KAAQ,KAAK,CAAC,MAAM,GAAC,IAAI,CAAC;;;;sBAChC,OAAO"}
1
+ {"version":3,"file":"pds-omnibox.d.ts","sourceRoot":"","sources":["../../../../../../public/assets/pds/components/pds-omnibox.js"],"names":[],"mappings":"AAuCA;IACE,+BAA6B;IAE7B,0CAUC;IAyBD,0BAaC;IAED,6BAqBC;IAED,wEAGC;IAMD,yBAEC;IAND,oBAEC;IAUD,wBAGC;IAPD,mBAEC;IAWD,4BAGC;IAPD,uBAEC;IAWD,sBAIC;IARD,iBAEC;IAYD,6BAGC;IAPD,wBAEC;IAWD,6BAGC;IAPD,wBAEC;IAWD,gCAGC;IAPD,2BAEC;IAWD,wBAGC;IAPD,mBAEC;IAOD,+BAA2B;IAE3B,0CAGC;IAED,0BAEC;IAED,2CAEC;IAED,qBAEC;IAED,sBAEC;;CA64BF;;;;;cAhmCa,CAAC,OAAO,CAAC,KAAQ,KAAK,OAAO;;;;eAC7B,CAAC,OAAO,CAAC,KAAQ,KAAK,OAAO,CAAC,KAAK,KAAQ,CAAC,GAAC,KAAK,KAAQ;;;;aAC1D,CAAC,IAAI,CAAC,KAAQ,KAAK,GAAG;;;;sBACtB,OAAO;;;;gBACP,MAAM;;;;;;mBAKN,OAAO;;;;eACP,MAAM;;;;kBACN,CAAC,IAAI,CAAC,KAAQ,KAAK,CAAC,MAAM,GAAC,IAAI,CAAC;;;;sBAChC,OAAO"}
@@ -1,2 +1,2 @@
1
- export {};
1
+ export { AutoComplete };
2
2
  //# sourceMappingURL=pds-autocomplete.d.ts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pure-ds/core",
3
3
  "shortname": "pds",
4
- "version": "0.7.39",
4
+ "version": "0.7.40",
5
5
  "description": "Why develop a Design System when you can generate one?",
6
6
  "repository": {
7
7
  "type": "git",
@@ -1,5 +1,5 @@
1
1
  var rt=Object.defineProperty;var it=(e,t)=>{for(var n in t)rt(e,n,{get:t[n],enumerable:!0})};var ae=class extends EventTarget{constructor(){super(),this.mode=null,this.compiled=null,this.log=()=>{},this.logHandler=null}},je="__PURE_DS_PDS_SINGLETON__",ce=typeof globalThis<"u"?globalThis:window,ie=ce?.[je],o=ie&&typeof ie.addEventListener=="function"?ie:new ae;ce&&(ce[je]=o);typeof o.log!="function"&&(o.log=(e="log",t,...n)=>{if(typeof console>"u")return;let s=typeof console[e]=="function"?console[e].bind(console):typeof console.log=="function"?console.log.bind(console):null;s&&(n.length>0?s(t,...n):s(t))});typeof o.logHandler!="function"&&(o.logHandler=null);var le=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){o.log("error",`Registry: failed to load static ${t}:`,n),o.log("error",`Registry: looking for ${this._staticPaths[t]}`),o.log("error","Registry: make sure you've run 'npm run pds:build' and configured PDS.start() with the correct static.root path");let s=new CSSStyleSheet;return s.replaceSync("/* Failed to load "+t+" */"),s}}get mode(){return this._mode}get isLive(){return this._mode==="live"}},z=new le;async function Ae(e,t=[],n=null){try{let s=n?.primitivesStylesheet?n.primitivesStylesheet:await z.getStylesheet("primitives");e.adoptedStyleSheets=[s,...t]}catch(s){let a=e.host?.tagName?.toLowerCase()||"unknown";o.log("error",`Adopter: <${a}> failed to adopt primitives:`,s),e.adoptedStyleSheets=t}}async function Pe(e,t=["primitives"],n=[],s=null){let a=Array.isArray(n)?n.filter(Boolean):[];if(a.length){let l=(Array.isArray(e.adoptedStyleSheets)?e.adoptedStyleSheets:[]).filter(y=>!a.includes(y));e.adoptedStyleSheets=[...l,...a]}try{let l=(await Promise.all(t.map(async y=>{if(s)switch(y){case"tokens":return s.tokensStylesheet;case"primitives":return s.primitivesStylesheet;case"components":return s.componentsStylesheet;case"utilities":return s.utilitiesStylesheet;default:break}return z.getStylesheet(y)}))).filter(y=>y!==null);e.adoptedStyleSheets=[...l,...a]}catch(r){let l=e.host?.tagName?.toLowerCase()||"unknown";o.log("error",`Adopter: <${l}> failed to adopt layers:`,r),e.adoptedStyleSheets=a}}function ke(e){let t=new CSSStyleSheet;return t.replaceSync(e),t}var xe={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 ue={};it(ue,{deepMerge:()=>Re,fragmentFromTemplateLike:()=>at,isObject:()=>B,parseHTML:()=>de});function B(e){return e&&typeof e=="object"&&!Array.isArray(e)}function Re(e,t){let n={...e};return B(e)&&B(t)&&Object.keys(t).forEach(s=>{B(t[s])?s in e?n[s]=Re(e[s],t[s]):Object.assign(n,{[s]:t[s]}):Object.assign(n,{[s]:t[s]})}),n}function at(e){let t=Array.isArray(e?.strings)?e.strings:[],n=Array.isArray(e?.values)?e.values:[],s=new Set,a=[],r=/(\s)(\.[\w-]+)=\s*$/;for(let i=0;i<t.length;i+=1){let w=t[i]??"",m=w.match(r);if(m&&i<n.length){let S=m[2].slice(1),v=`pds-val-${i}`;w=w.replace(r,`$1data-pds-prop="${S}:${v}"`),s.add(i)}a.push(w),i<n.length&&!s.has(i)&&a.push(`<!--pds-val-${i}-->`)}let l=document.createElement("template");l.innerHTML=a.join("");let y=(i,w)=>{let m=i.parentNode;if(!m)return;if(w==null){m.removeChild(i);return}let _=S=>{if(S!=null){if(S instanceof Node){m.insertBefore(S,i);return}if(Array.isArray(S)){S.forEach(v=>_(v));return}m.insertBefore(document.createTextNode(String(S)),i)}};_(w),m.removeChild(i)},g=document.createTreeWalker(l.content,NodeFilter.SHOW_COMMENT),d=[];for(;g.nextNode();){let i=g.currentNode;i?.nodeValue?.startsWith("pds-val-")&&d.push(i)}return d.forEach(i=>{let w=Number(i.nodeValue.replace("pds-val-",""));y(i,n[w])}),l.content.querySelectorAll("*").forEach(i=>{let w=i.getAttribute("data-pds-prop");if(!w)return;let[m,_]=w.split(":"),S=Number(String(_).replace("pds-val-",""));m&&Number.isInteger(S)&&(i[m]=n[S]),i.removeAttribute("data-pds-prop")}),l.content}function de(e){return new DOMParser().parseFromString(e,"text/html").body.childNodes}var ze="pds",ct=/^([a-z][a-z0-9+\-.]*:)?\/\//i,De=/^[a-z]:/i;function N(e=""){return e.endsWith("/")?e:`${e}/`}function lt(e="",t=ze){let n=e.replace(/\/+$/,"");return new RegExp(`(?:^|/)${t}$`,"i").test(n)?n:`${n}/${t}`}function dt(e){return e.replace(/^\.\/+/,"")}function ut(e){return De.test(e)?e.replace(De,"").replace(/^\/+/,""):e}function pt(e){return e.startsWith("public/")?e.substring(7):e}function K(e,t={}){let n=t.segment||ze,s=t.defaultRoot||`/assets/${n}/`,a=e?.public&&e.public?.root||e?.static&&e.static?.root||null;if(!a||typeof a!="string")return N(s);let r=a.trim();return r?(r=r.replace(/\\/g,"/"),r=lt(r,n),r=N(r),ct.test(r)?r:(r=dt(r),r=ut(r),r.startsWith("/")||(r=pt(r),r.startsWith("/")||(r=`/${r}`),r=r.replace(/\/+/g,(l,y)=>y===0?l:"/")),N(r))):N(s)}async function ft(...e){let t={};e.length&&typeof e[e.length-1]=="object"&&(t=e.pop()||{});let n=e,{baseURL:s,mapper:a=d=>`${d}.js`,onError:r=(d,c)=>console.error(`[defineWebComponents] ${d}:`,c)}=t,l=s?new URL(s,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),y=d=>d.toLowerCase().replace(/(^|-)([a-z])/g,(c,i,w)=>w.toUpperCase()),g=async d=>{try{if(customElements.get(d))return{tag:d,status:"already-defined"};let c=a(d),w=await import(c instanceof URL?c.href:new URL(c,l).href),m=w?.default??w?.[y(d)];if(!m){if(customElements.get(d))return{tag:d,status:"self-defined"};throw new Error(`No export found for ${d}. Expected default export or named export "${y(d)}".`)}return customElements.get(d)?{tag:d,status:"race-already-defined"}:(customElements.define(d,m),{tag:d,status:"defined"})}catch(c){throw r(d,c),c}};return Promise.all(n.map(g))}var G=class{constructor(t={}){let{baseURL:n,mapper:s,onError:a,predicate:r=()=>!0,attributeModule:l="data-module",root:y=document,scanExisting:g=!0,debounceMs:d=16,observeShadows:c=!0,enhancers:i=[],patchAttachShadow:w=!0}=t,m=new Set,_=new Set,S=new Set,v=new Map,P=new WeakMap,E=new WeakMap,h=0,b=!1,k=null,H=u=>{if(!u||!i.length)return;let f=E.get(u);f||(f=new Set,E.set(u,f));for(let p of i)if(!(!p.selector||!p.run)&&!f.has(p.selector))try{u.matches&&u.matches(p.selector)&&(p.run(u),f.add(p.selector))}catch(j){console.warn(`[AutoDefiner] Error applying enhancer for selector "${p.selector}":`,j)}},M=(u,f)=>{if(!b&&!(!u||!u.includes("-"))&&!customElements.get(u)&&!_.has(u)&&!S.has(u)){if(f&&f.getAttribute){let p=f.getAttribute(l);p&&!v.has(u)&&v.set(u,p)}m.add(u),ot()}},ot=()=>{h||(h=setTimeout(_e,d))},R=u=>{if(u){if(u.nodeType===1){let f=u,p=f.tagName?.toLowerCase();p&&p.includes("-")&&!customElements.get(p)&&r(p,f)&&M(p,f),H(f),c&&f.shadowRoot&&re(f.shadowRoot)}u.querySelectorAll&&u.querySelectorAll("*").forEach(f=>{let p=f.tagName?.toLowerCase();p&&p.includes("-")&&!customElements.get(p)&&r(p,f)&&M(p,f),H(f),c&&f.shadowRoot&&re(f.shadowRoot)})}},re=u=>{if(!u||P.has(u))return;R(u);let f=new MutationObserver(p=>{for(let j of p)j.addedNodes?.forEach(D=>{R(D)}),j.type==="attributes"&&j.target&&R(j.target)});f.observe(u,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[l,...i.map(p=>p.selector).filter(p=>p.startsWith("data-"))]}),P.set(u,f)};async function _e(){if(clearTimeout(h),h=0,!m.size)return;let u=Array.from(m);m.clear(),u.forEach(f=>_.add(f));try{let f=p=>v.get(p)??(s?s(p):`${p}.js`);await ft(...u,{baseURL:n,mapper:f,onError:(p,j)=>{S.add(p),a?.(p,j)}})}catch{}finally{u.forEach(f=>_.delete(f))}}let Ee=y===document?document.documentElement:y,ve=new MutationObserver(u=>{for(let f of u)f.addedNodes?.forEach(p=>{R(p)}),f.type==="attributes"&&f.target&&R(f.target)});if(ve.observe(Ee,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[l,...i.map(u=>u.selector).filter(u=>u.startsWith("data-"))]}),c&&w&&Element.prototype.attachShadow){let u=Element.prototype.attachShadow;Element.prototype.attachShadow=function(p){let j=u.call(this,p);if(p&&p.mode==="open"){re(j);let D=this.tagName?.toLowerCase();D&&D.includes("-")&&!customElements.get(D)&&M(D,this)}return j},k=()=>Element.prototype.attachShadow=u}return g&&R(Ee),{stop(){b=!0,ve.disconnect(),k&&k(),h&&(clearTimeout(h),h=0),P.forEach(u=>u.disconnect())},flush:_e}}static async define(...t){let n={};t.length&&typeof t[t.length-1]=="object"&&(n=t.pop()||{});let s=t,{baseURL:a,mapper:r=c=>`${c}.js`,onError:l=(c,i)=>console.error(`[defineWebComponents] ${c}:`,i)}=n,y=a?new URL(a,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),g=c=>c.toLowerCase().replace(/(^|-)([a-z])/g,(i,w,m)=>m.toUpperCase()),d=async c=>{try{if(customElements.get(c))return{tag:c,status:"already-defined"};let i=r(c),m=await import(i instanceof URL?i.href:new URL(i,y).href),_=m?.default??m?.[g(c)];if(!_){if(customElements.get(c))return{tag:c,status:"self-defined"};throw new Error(`No export found for ${c}. Expected default export or named export "${g(c)}".`)}return customElements.get(c)?{tag:c,status:"race-already-defined"}:(customElements.define(c,_),{tag:c,status:"defined"})}catch(i){throw l(c,i),i}};return Promise.all(s.map(d))}};var mt=/^[a-z][a-z0-9+\-.]*:\/\//i,O=(()=>{try{return import.meta.url}catch{return}})(),q=e=>typeof e=="string"&&e.length&&!e.endsWith("/")?`${e}/`:e;function V(e,t={}){if(!e||mt.test(e))return e;let{preferModule:n=!0}=t,s=()=>{if(!O)return null;try{return new URL(e,O).href}catch{return null}},a=()=>{if(typeof window>"u"||!window.location?.origin)return null;try{return new URL(e,window.location.origin).href}catch{return null}};return(n?s()||a():a()||s())||e}var Te=(()=>{if(O)try{let e=new URL(O);if(/\/public\/assets\/js\//.test(e.pathname))return new URL("../pds/",O).href}catch{return}})(),Ce=!1;function Ue(e){Ce||typeof document>"u"||(Ce=!0,e.addEventListener("pds:ready",t=>{let n=t.detail?.mode;n&&document.documentElement.classList.add(`pds-${n}`,"pds-ready")}))}function Me({manageTheme:e,themeStorageKey:t,applyResolvedTheme:n,setupSystemListenerIfNeeded:s}){let a="light",r=null;if(e&&typeof window<"u"){try{r=localStorage.getItem(t)||null}catch{r=null}try{n?.(r),s?.(r)}catch{}r?r==="system"?a=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":a=r:a=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return{resolvedTheme:a,storedTheme:r}}function J(e,{resolvePublicAssetURL:t}){let n=!!(e?.public?.root||e?.static?.root),s=t(e);return!n&&Te&&(s=Te),q(V(s))}async function Ne(e,{baseEnhancers:t=[]}={}){let{autoDefineBaseURL:n="/auto-define/",autoDefinePreload:s=[],autoDefineMapper:a=null,enhancers:r=[],autoDefineOverrides:l=null,autoDefinePreferModule:y=!0}=e,g=(()=>{let c=new Map;return(t||[]).forEach(i=>c.set(i.selector,i)),(r||[]).forEach(i=>c.set(i.selector,i)),Array.from(c.values())})(),d=null;if(typeof window<"u"&&typeof document<"u"){let c=G,i=h=>{switch(h){case"pds-tabpanel":return"pds-tabstrip.js";default:return`${h}.js`}},{mapper:w,enhancers:m,..._}=l&&typeof l=="object"?l:{},S=m?Array.isArray(m)?m:typeof m=="object"?Object.values(m):[]:[],v=(()=>{let h=new Map;return(g||[]).forEach(b=>{b?.selector&&h.set(b.selector,b)}),(S||[]).forEach(b=>{if(!b?.selector)return;let k=h.get(b.selector)||null;h.set(b.selector,{...k||{},...b,run:typeof b?.run=="function"?b.run:k?.run})}),Array.from(h.values())})(),E={baseURL:n&&q(V(n,{preferModule:y})),predefine:s,scanExisting:!0,observeShadows:!0,patchAttachShadow:!0,debounceMs:16,enhancers:v,onError:(h,b)=>{if(typeof h=="string"&&h.startsWith("pds-")){let H=["pds-form","pds-drawer"].includes(h),M=b?.message?.includes("#pds/lit")||b?.message?.includes("Failed to resolve module specifier");H&&M?o.log("error",`\u274C PDS component <${h}> requires Lit but #pds/lit is not in import map.
2
- See: https://github.com/Pure-Web-Foundation/pure-ds/blob/main/readme.md#lit-components-not-working`):o.log("warn",`\u26A0\uFE0F PDS component <${h}> not found. Assets may not be installed.`)}else o.log("error",`\u274C Auto-define error for <${h}>:`,b)},..._,mapper:h=>{if(customElements.get(h))return null;if(typeof a=="function")try{let b=a(h);return b===void 0?i(h):b}catch(b){return o.log("warn","Custom autoDefine.mapper error; falling back to default:",b?.message||b),i(h)}return i(h)}};d=new c(E),s.length>0&&typeof c.define=="function"&&await c.define(...s,{baseURL:n,mapper:E.mapper,onError:E.onError})}return{autoDefiner:d,mergedEnhancers:g}}var pe=["light","dark"],fe=new Set(pe);function ht(e){let n=(Array.isArray(e?.themes)?e.themes.map(s=>String(s).toLowerCase()):pe).filter(s=>fe.has(s));return n.length?n:pe}function me(e,{preferDocument:t=!0}={}){let n=String(e||"").toLowerCase();if(fe.has(n))return n;if(t&&typeof document<"u"){let s=document.documentElement?.getAttribute("data-theme");if(fe.has(s))return s}return typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Oe(e,t){let n=me(t);return ht(e).includes(n)}var yt=new Set(["log","warn","error","debug","info"]),gt="__PURE_DS_PDS_SINGLETON__",he=null,ye=null;function Ie(){try{let t=(typeof globalThis<"u"?globalThis:window)?.[gt];if(t&&typeof t=="object")return t}catch{return null}return null}function bt(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 wt(e){if(typeof e!="string")return"log";let t=e.toLowerCase();return yt.has(t)?t:"log"}function St(){if(typeof ye=="function")try{let t=bt(ye());if(t)return t}catch{}let e=Ie();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 Lt(){if(typeof he=="function")try{let t=he();if(typeof t=="function")return t}catch{}let e=Ie();return typeof e?.logHandler=="function"?e.logHandler:null}function $e(e,t,...n){if(typeof console>"u")return;let s=typeof console[e]=="function"?console[e].bind(console):typeof console.log=="function"?console.log.bind(console):null;s&&(n.length>0?s(t,...n):s(t))}function _t(e,t){let n=t?.debug===!0;return!(t?.mode==="static"&&!n||!n&&e!=="error"&&e!=="warn")}function Fe({getLogger:e,getContext:t}={}){he=typeof e=="function"?e:null,ye=typeof t=="function"?t:null}function We(e="log",t,...n){let s=wt(e),a=St(),r=Lt();if(r)try{r.call(a?.thisArg,s,t,...n);return}catch(l){$e("error","Custom log handler failed:",l)}_t(s,a)&&$e(s,t,...n)}typeof o.initializing!="boolean"&&(o.initializing=!1);"currentPreset"in o||(o.currentPreset=null);typeof o.debug!="boolean"&&(o.debug=!1);"currentConfig"in o||(o.currentConfig=null);"compiled"in o||(o.compiled=null);typeof o.logHandler!="function"&&(o.logHandler=null);"mode"in o||(o.mode=null);var Q=null,Y=null,Z=null,X=null,ee=null,te=null,Be="__pdsLocalizationRuntime";function T(){if(te)return te;let e=o?.[Be];return e&&typeof e=="object"?(te=e,e):null}function Et(e){let t=e&&typeof e=="object"?e:null;te=t,o[Be]=t}Fe({getLogger:()=>typeof o.logHandler=="function"?o.logHandler:null,getContext:()=>{let e=o?.mode||o?.compiled?.mode||(o?.registry?.isLive?"live":"static"),t=(o?.debug||o?.currentConfig?.debug||o?.currentConfig?.design?.debug||o?.compiled?.debug||o?.compiled?.design?.debug||!1)===!0;return{mode:e,debug:t,thisArg:o}}});o.log=(e="log",t,...n)=>{We(e,t,...n)};var L={locale:"en",messages:{},hasProvider:!1},ne=new Set;function Ke(e){return!!e&&typeof e!="string"&&typeof e=="object"&&"strTag"in e}function Ge(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 vt(e,t){return String(e).replace(/\{(\d+)\}/g,(n,s)=>t(Number(s)))}function jt(e){if(!e||typeof e!="object")return{};let t={};for(let[n,s]of Object.entries(e)){if(typeof s=="string"){t[n]=s;continue}s&&typeof s=="object"&&typeof s.content=="string"&&(t[n]=s.content)}return t}function At(e,...t){return{strTag:!0,strings:Array.from(e||[]),values:t,raw:Array.from(e?.raw||[])}}function Pt(e){if(!e)return"";if(Ke(e)){let n=Ge(e.strings||[]),s=L.messages[n]||n;return vt(s,a=>e.values?.[a])}let t=String(e);return L.messages[t]||t}function kt(e){if(!e)return;let t=Ke(e)?Ge(e.strings||[]):String(e);typeof t=="string"&&t.length>0&&ne.add(t)}function qe(e){if(!e||typeof e.msg!="function"||ne.size===0)return;let t=Array.from(ne);ne.clear();for(let n of t)try{e.msg(n)}catch{}}async function I(){let e=T();return e||(ee||(ee=import(F("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 Et(n),qe(n),n}).catch(n=>{throw ee=null,n})),ee)}var C=(e,t={})=>{let n=T();return typeof n?.msg=="function"?n.msg(e,t):(kt(e),Pt(e,t))},oe=(e,...t)=>{let n=T();return typeof n?.str=="function"?n.str(e,...t):At(e,...t)},se=(e=null)=>{let t=T();if(typeof t?.configureLocalization=="function")return t.configureLocalization(e);if(!e||typeof e!="object")return L.locale="en",L.messages={},L.hasProvider=!1,{locale:L.locale,messages:{...L.messages},hasProvider:L.hasProvider};typeof e.locale=="string"&&e.locale.trim()&&(L.locale=e.locale.trim()),Object.prototype.hasOwnProperty.call(e,"messages")&&(L.messages=jt(e.messages));let n=!!(e.provider||e.translate||e.loadLocale||e.setLocale);return L.hasProvider=n,n&&I().then(s=>{s.configureLocalization(e),qe(s)}).catch(()=>{}),{locale:L.locale,messages:{...L.messages},hasProvider:L.hasProvider}},Ve=async e=>(await I()).loadLocale(e),Je=async(e,t={})=>(await I()).setLocale(e,t),Qe=()=>{let e=T();return typeof e?.getLocalizationState=="function"?e.getLocalizationState():{locale:L.locale,messages:{...L.messages},hasProvider:L.hasProvider}},Ye=(e={})=>{let t=T();if(typeof t?.createJSONLocalization=="function")return t.createJSONLocalization(e);let n=typeof e?.locale=="string"&&e.locale.trim()?e.locale.trim().toLowerCase():"en",s=Array.isArray(e?.locales)?e.locales.map(g=>String(g||"").trim().toLowerCase()).filter(Boolean):[],a=Array.from(new Set([n,...s])),r=null,l=async()=>(r||(r=I().then(g=>typeof g?.createJSONLocalization=="function"?g.createJSONLocalization(e):null).catch(()=>null)),r),y=async(g="loadLocale")=>{let d=await l();if(!d||typeof d!="object")return null;let c=d.provider;if(!c||typeof c!="object")return null;let i=c[g];return typeof i=="function"?i:g==="setLocale"&&typeof c.loadLocale=="function"?c.loadLocale:null};return{locale:n,locales:[...a],provider:{locales:[...a],async loadLocale(g={}){let d=await y("loadLocale");return typeof d!="function"?{}:d(g)},async setLocale(g={}){let d=await y("setLocale");return typeof d!="function"?{}:d(g)}}}};function F(e,t){return t&&typeof t=="string"?t:`${J(o.currentConfig||{},{resolvePublicAssetURL:K})}core/${e}`}async function xt(){return Array.isArray(o.defaultEnhancers)&&o.defaultEnhancers.length>0?o.defaultEnhancers:(X||(X=import(F("pds-enhancers.js",o.currentConfig?.enhancersURL)).then(t=>{let n=Array.isArray(t?.defaultPDSEnhancers)?t.defaultPDSEnhancers:[];return o.defaultEnhancers=n,n}).catch(t=>{throw X=null,t})),X)}async function Rt(){return typeof o.ask=="function"&&o.ask!==Ze?o.ask:(Y||(Y=import(F("pds-ask.js",o.currentConfig?.askURL)).then(t=>{let n=t?.ask;if(typeof n!="function")throw new Error("Failed to load ask helper");return o.ask=n,n}).catch(t=>{throw Y=null,t})),Y)}async function W(){return typeof o.toast=="function"&&o.toast!==U?o.toast:(Z||(Z=import(F("pds-toast.js",o.currentConfig?.toastURL)).then(t=>{let n=t?.toast;if(typeof n!="function")throw new Error("Failed to load toast helper");return o.toast=n,n}).catch(t=>{throw Z=null,t})),Z)}async function Ze(...e){return(await Rt())(...e)}async function U(...e){return(await W())(...e)}U.success=async(...e)=>(await W()).success(...e);U.error=async(...e)=>(await W()).error(...e);U.warning=async(...e)=>(await W()).warning(...e);U.info=async(...e)=>(await W()).info(...e);var He=function(e="log",t,...n){o.log(e,t,...n)};function be(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=>be(n)).filter(n=>n!==void 0);let t={};for(let[n,s]of Object.entries(e)){let a=be(s);a!==void 0&&(t[n]=a)}return t}function Xe(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))Xe(e[n],t);return e}function we(e){return e==null||typeof e!="object"?e:Xe(structuredClone(be(e)))}async function Dt(e,t={}){if(t?.runtimeConfig===!1||typeof fetch!="function")return null;let n=t?.runtimeConfigURL||`${e}pds-runtime-config.json`;try{let s=await fetch(n,{cache:"no-store"});return s.ok?await s.json():null}catch{return null}}o.registry=z;o.enums=xe;o.adoptLayers=Pe;o.adoptPrimitives=Ae;o.parse=de;o.createStylesheet=ke;o.isLiveMode=()=>z.isLive;o.ask=Ze;o.toast=U;o.common=ue;o.msg=C;o.str=oe;o.configureLocalization=se;o.loadLocale=Ve;o.setLocale=Je;o.getLocalizationState=Qe;o.createJSONLocalization=Ye;o.i18n={msg:C,str:oe,configure:se,loadLocale:Ve,setLocale:Je,getState:Qe,createJSONLocalization:Ye};o.AutoComplete=null;o.loadAutoComplete=async()=>{if(o.AutoComplete&&typeof o.AutoComplete.connect=="function")return o.AutoComplete;let e=F("pds-autocomplete.js",o.currentConfig?.autoCompleteURL);return Q||(Q=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 o.AutoComplete=n,n}).catch(t=>{throw Q=null,t})),Q};function et(e){let t=typeof CustomEvent=="function";try{let n=t?new CustomEvent("pds:ready",{detail:e}):new Event("pds:ready");o.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 tt(e={}){let t=typeof CustomEvent=="function",n={at:Date.now(),...e};try{let s=t?new CustomEvent("pds:config-changed",{detail:n}):new Event("pds:config-changed");o.dispatchEvent(s)}catch{}if(typeof document<"u")if(t){let s={detail:n,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:config-changed",s))}catch{}}else try{document.dispatchEvent(new Event("pds:config-changed"))}catch{}}var ge="pure-ds-theme",x=null,$=null;function Se(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 Le(e){try{if(x&&$){try{typeof x.removeEventListener=="function"?x.removeEventListener("change",$):typeof x.removeListener=="function"&&x.removeListener($)}catch{}x=null,$=null}if(e==="system"&&typeof window<"u"&&window.matchMedia){let t=window.matchMedia("(prefers-color-scheme: dark)"),n=s=>{let a=s?.matches===void 0?t.matches:s.matches;try{let r=a?"dark":"light";document.documentElement.setAttribute("data-theme",r),o.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:r,source:"system"}}))}catch{}};x=t,$=n,typeof t.addEventListener=="function"?t.addEventListener("change",n):typeof t.addListener=="function"&&t.addListener(n)}}catch{}}var zt=Object.getOwnPropertyDescriptor(o,"theme");zt||Object.defineProperty(o,"theme",{get(){try{return typeof window>"u"?null:localStorage.getItem(ge)||null}catch{return null}},set(e){try{if(typeof window>"u")return;let t=o.currentConfig?.design||null,n=me(e);if(t&&!Oe(t,n)){let s=t?.name||o.currentPreset?.name||o.currentConfig?.preset||"current preset";o.log("warn",`PDS theme "${n}" not supported by preset "${s}".`),o.dispatchEvent(new CustomEvent("pds:theme:blocked",{detail:{theme:e,resolvedTheme:n,preset:s}}));return}e==null?localStorage.removeItem(ge):localStorage.setItem(ge,e),Se(e),Le(e),o.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:e,source:"api"}}))}catch{}}});o.defaultEnhancers=[];async function Tt(e){o.initializing=!0;try{let t=e&&e.mode||"live",{mode:n,...s}=e||{};o.mode=t,o.logHandler=typeof s?.log=="function"?s.log:null,o.currentConfig=we(s);let a=s&&typeof s.localization=="object"&&s.localization?s.localization:null;a?(await I(),se(a)):se(null);let r;if(t==="static")r=await Ct(s);else{let y=J(s,{resolvePublicAssetURL:K}),g=s?.managerURL||s?.public?.managerURL||s?.manager?.url||new URL("core/pds-manager.js",y).href||new URL("./pds-manager.js",import.meta.url).href,{startLive:d}=await import(g);r=await d(o,s,{emitReady:et,emitConfigChanged:tt,applyResolvedTheme:Se,setupSystemListenerIfNeeded:Le})}o.compiled=we(r?.config||null);let l=o?.compiled?.design?.icons?.externalPath||"/assets/img/icons/";return o.log("info",`startup ready; external icon path: ${l}`),r}finally{o.initializing=!1}}o.start=Tt;async function Ct(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,s=e.themeStorageKey??"pure-ds-theme",a=e.staticPaths??{},r=J(e,{resolvePublicAssetURL:K}),l=e&&e.autoDefine||null,y;l&&l.baseURL?y=q(V(l.baseURL,{preferModule:!1})):y=`${r}components/`;let g=l&&Array.isArray(l.predefine)&&l.predefine||[],d=l&&typeof l.mapper=="function"&&l.mapper||null;try{Ue(o);let{resolvedTheme:c}=Me({manageTheme:n,themeStorageKey:s,applyResolvedTheme:Se,setupSystemListenerIfNeeded:Le}),i=await Dt(r,e),w=Array.isArray(e?.enhancers)?e.enhancers:e?.enhancers&&typeof e.enhancers=="object"?Object.values(e.enhancers):[],m=i?.config?{...i.config,...e,design:e?.design||i.config.design,preset:e?.preset||i.config.preset}:{...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`},S=i?.paths||{};if(a={..._,...S,...a},o.registry.setStaticMode(a),t&&typeof document<"u")try{let E=await o.registry.getStylesheet("styles");if(E){E._pds=!0;let h=(document.adoptedStyleSheets||[]).filter(b=>b._pds!==!0);document.adoptedStyleSheets=[...h,E],tt({mode:"static",source:"static:styles-applied"})}}catch(E){He.call(o,"warn","Failed to apply static styles:",E)}let v=null,P=[];try{let E=await xt(),h=await Ne({autoDefineBaseURL:y,autoDefinePreload:g,autoDefineMapper:d,enhancers:w,autoDefineOverrides:l||null,autoDefinePreferModule:!(l&&l.baseURL)},{baseEnhancers:E});v=h.autoDefiner,P=h.mergedEnhancers||[]}catch(E){He.call(o,"error","\u274C Failed to initialize AutoDefiner/Enhancers (static):",E)}return o.compiled=we({mode:"static",...m,theme:c,enhancers:P}),et({mode:"static",config:m,theme:c,autoDefiner:v}),{config:m,theme:c,autoDefiner:v}}catch(c){throw o.dispatchEvent(new CustomEvent("pds:error",{detail:{error:c}})),c}}var Ut=o.createJSONLocalization({locale:"en-US",locales:["en-US","nl-NL"],aliases:{en:["en-US"],nl:["nl-NL"]},basePath:"/assets/locales"}),nt={mode:"live",liveEdit:!0,preset:"default",localization:Ut,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 A={name:"@pure-ds/core",shortname:"pds",version:"0.7.38",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:{test:'echo "Error: no test specified" && exit 1',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 o.start(nt);document.documentElement.lang="en";var st=typeof A.repository=="string"?A.repository:A.repository?.url,Nt=st?st.replace(/^git\+/,"").replace(/\.git$/,""):"",hn=A.homepage||Nt,yn=A.bugs?.url||"";document.body.innerHTML=`
2
+ See: https://github.com/Pure-Web-Foundation/pure-ds/blob/main/readme.md#lit-components-not-working`):o.log("warn",`\u26A0\uFE0F PDS component <${h}> not found. Assets may not be installed.`)}else o.log("error",`\u274C Auto-define error for <${h}>:`,b)},..._,mapper:h=>{if(customElements.get(h))return null;if(typeof a=="function")try{let b=a(h);return b===void 0?i(h):b}catch(b){return o.log("warn","Custom autoDefine.mapper error; falling back to default:",b?.message||b),i(h)}return i(h)}};d=new c(E),s.length>0&&typeof c.define=="function"&&await c.define(...s,{baseURL:n,mapper:E.mapper,onError:E.onError})}return{autoDefiner:d,mergedEnhancers:g}}var pe=["light","dark"],fe=new Set(pe);function ht(e){let n=(Array.isArray(e?.themes)?e.themes.map(s=>String(s).toLowerCase()):pe).filter(s=>fe.has(s));return n.length?n:pe}function me(e,{preferDocument:t=!0}={}){let n=String(e||"").toLowerCase();if(fe.has(n))return n;if(t&&typeof document<"u"){let s=document.documentElement?.getAttribute("data-theme");if(fe.has(s))return s}return typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Oe(e,t){let n=me(t);return ht(e).includes(n)}var yt=new Set(["log","warn","error","debug","info"]),gt="__PURE_DS_PDS_SINGLETON__",he=null,ye=null;function Ie(){try{let t=(typeof globalThis<"u"?globalThis:window)?.[gt];if(t&&typeof t=="object")return t}catch{return null}return null}function bt(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 wt(e){if(typeof e!="string")return"log";let t=e.toLowerCase();return yt.has(t)?t:"log"}function St(){if(typeof ye=="function")try{let t=bt(ye());if(t)return t}catch{}let e=Ie();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 Lt(){if(typeof he=="function")try{let t=he();if(typeof t=="function")return t}catch{}let e=Ie();return typeof e?.logHandler=="function"?e.logHandler:null}function $e(e,t,...n){if(typeof console>"u")return;let s=typeof console[e]=="function"?console[e].bind(console):typeof console.log=="function"?console.log.bind(console):null;s&&(n.length>0?s(t,...n):s(t))}function _t(e,t){let n=t?.debug===!0;return!(t?.mode==="static"&&!n||!n&&e!=="error"&&e!=="warn")}function Fe({getLogger:e,getContext:t}={}){he=typeof e=="function"?e:null,ye=typeof t=="function"?t:null}function We(e="log",t,...n){let s=wt(e),a=St(),r=Lt();if(r)try{r.call(a?.thisArg,s,t,...n);return}catch(l){$e("error","Custom log handler failed:",l)}_t(s,a)&&$e(s,t,...n)}typeof o.initializing!="boolean"&&(o.initializing=!1);"currentPreset"in o||(o.currentPreset=null);typeof o.debug!="boolean"&&(o.debug=!1);"currentConfig"in o||(o.currentConfig=null);"compiled"in o||(o.compiled=null);typeof o.logHandler!="function"&&(o.logHandler=null);"mode"in o||(o.mode=null);var Q=null,Y=null,Z=null,X=null,ee=null,te=null,Be="__pdsLocalizationRuntime";function T(){if(te)return te;let e=o?.[Be];return e&&typeof e=="object"?(te=e,e):null}function Et(e){let t=e&&typeof e=="object"?e:null;te=t,o[Be]=t}Fe({getLogger:()=>typeof o.logHandler=="function"?o.logHandler:null,getContext:()=>{let e=o?.mode||o?.compiled?.mode||(o?.registry?.isLive?"live":"static"),t=(o?.debug||o?.currentConfig?.debug||o?.currentConfig?.design?.debug||o?.compiled?.debug||o?.compiled?.design?.debug||!1)===!0;return{mode:e,debug:t,thisArg:o}}});o.log=(e="log",t,...n)=>{We(e,t,...n)};var L={locale:"en",messages:{},hasProvider:!1},ne=new Set;function Ke(e){return!!e&&typeof e!="string"&&typeof e=="object"&&"strTag"in e}function Ge(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 vt(e,t){return String(e).replace(/\{(\d+)\}/g,(n,s)=>t(Number(s)))}function jt(e){if(!e||typeof e!="object")return{};let t={};for(let[n,s]of Object.entries(e)){if(typeof s=="string"){t[n]=s;continue}s&&typeof s=="object"&&typeof s.content=="string"&&(t[n]=s.content)}return t}function At(e,...t){return{strTag:!0,strings:Array.from(e||[]),values:t,raw:Array.from(e?.raw||[])}}function Pt(e){if(!e)return"";if(Ke(e)){let n=Ge(e.strings||[]),s=L.messages[n]||n;return vt(s,a=>e.values?.[a])}let t=String(e);return L.messages[t]||t}function kt(e){if(!e)return;let t=Ke(e)?Ge(e.strings||[]):String(e);typeof t=="string"&&t.length>0&&ne.add(t)}function qe(e){if(!e||typeof e.msg!="function"||ne.size===0)return;let t=Array.from(ne);ne.clear();for(let n of t)try{e.msg(n)}catch{}}async function I(){let e=T();return e||(ee||(ee=import(F("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 Et(n),qe(n),n}).catch(n=>{throw ee=null,n})),ee)}var C=(e,t={})=>{let n=T();return typeof n?.msg=="function"?n.msg(e,t):(kt(e),Pt(e,t))},oe=(e,...t)=>{let n=T();return typeof n?.str=="function"?n.str(e,...t):At(e,...t)},se=(e=null)=>{let t=T();if(typeof t?.configureLocalization=="function")return t.configureLocalization(e);if(!e||typeof e!="object")return L.locale="en",L.messages={},L.hasProvider=!1,{locale:L.locale,messages:{...L.messages},hasProvider:L.hasProvider};typeof e.locale=="string"&&e.locale.trim()&&(L.locale=e.locale.trim()),Object.prototype.hasOwnProperty.call(e,"messages")&&(L.messages=jt(e.messages));let n=!!(e.provider||e.translate||e.loadLocale||e.setLocale);return L.hasProvider=n,n&&I().then(s=>{s.configureLocalization(e),qe(s)}).catch(()=>{}),{locale:L.locale,messages:{...L.messages},hasProvider:L.hasProvider}},Ve=async e=>(await I()).loadLocale(e),Je=async(e,t={})=>(await I()).setLocale(e,t),Qe=()=>{let e=T();return typeof e?.getLocalizationState=="function"?e.getLocalizationState():{locale:L.locale,messages:{...L.messages},hasProvider:L.hasProvider}},Ye=(e={})=>{let t=T();if(typeof t?.createJSONLocalization=="function")return t.createJSONLocalization(e);let n=typeof e?.locale=="string"&&e.locale.trim()?e.locale.trim().toLowerCase():"en",s=Array.isArray(e?.locales)?e.locales.map(g=>String(g||"").trim().toLowerCase()).filter(Boolean):[],a=Array.from(new Set([n,...s])),r=null,l=async()=>(r||(r=I().then(g=>typeof g?.createJSONLocalization=="function"?g.createJSONLocalization(e):null).catch(()=>null)),r),y=async(g="loadLocale")=>{let d=await l();if(!d||typeof d!="object")return null;let c=d.provider;if(!c||typeof c!="object")return null;let i=c[g];return typeof i=="function"?i:g==="setLocale"&&typeof c.loadLocale=="function"?c.loadLocale:null};return{locale:n,locales:[...a],provider:{locales:[...a],async loadLocale(g={}){let d=await y("loadLocale");return typeof d!="function"?{}:d(g)},async setLocale(g={}){let d=await y("setLocale");return typeof d!="function"?{}:d(g)}}}};function F(e,t){return t&&typeof t=="string"?t:`${J(o.currentConfig||{},{resolvePublicAssetURL:K})}core/${e}`}async function xt(){return Array.isArray(o.defaultEnhancers)&&o.defaultEnhancers.length>0?o.defaultEnhancers:(X||(X=import(F("pds-enhancers.js",o.currentConfig?.enhancersURL)).then(t=>{let n=Array.isArray(t?.defaultPDSEnhancers)?t.defaultPDSEnhancers:[];return o.defaultEnhancers=n,n}).catch(t=>{throw X=null,t})),X)}async function Rt(){return typeof o.ask=="function"&&o.ask!==Ze?o.ask:(Y||(Y=import(F("pds-ask.js",o.currentConfig?.askURL)).then(t=>{let n=t?.ask;if(typeof n!="function")throw new Error("Failed to load ask helper");return o.ask=n,n}).catch(t=>{throw Y=null,t})),Y)}async function W(){return typeof o.toast=="function"&&o.toast!==U?o.toast:(Z||(Z=import(F("pds-toast.js",o.currentConfig?.toastURL)).then(t=>{let n=t?.toast;if(typeof n!="function")throw new Error("Failed to load toast helper");return o.toast=n,n}).catch(t=>{throw Z=null,t})),Z)}async function Ze(...e){return(await Rt())(...e)}async function U(...e){return(await W())(...e)}U.success=async(...e)=>(await W()).success(...e);U.error=async(...e)=>(await W()).error(...e);U.warning=async(...e)=>(await W()).warning(...e);U.info=async(...e)=>(await W()).info(...e);var He=function(e="log",t,...n){o.log(e,t,...n)};function be(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=>be(n)).filter(n=>n!==void 0);let t={};for(let[n,s]of Object.entries(e)){let a=be(s);a!==void 0&&(t[n]=a)}return t}function Xe(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))Xe(e[n],t);return e}function we(e){return e==null||typeof e!="object"?e:Xe(structuredClone(be(e)))}async function Dt(e,t={}){if(t?.runtimeConfig===!1||typeof fetch!="function")return null;let n=t?.runtimeConfigURL||`${e}pds-runtime-config.json`;try{let s=await fetch(n,{cache:"no-store"});return s.ok?await s.json():null}catch{return null}}o.registry=z;o.enums=xe;o.adoptLayers=Pe;o.adoptPrimitives=Ae;o.parse=de;o.createStylesheet=ke;o.isLiveMode=()=>z.isLive;o.ask=Ze;o.toast=U;o.common=ue;o.msg=C;o.str=oe;o.configureLocalization=se;o.loadLocale=Ve;o.setLocale=Je;o.getLocalizationState=Qe;o.createJSONLocalization=Ye;o.i18n={msg:C,str:oe,configure:se,loadLocale:Ve,setLocale:Je,getState:Qe,createJSONLocalization:Ye};o.AutoComplete=null;o.loadAutoComplete=async()=>{if(o.AutoComplete&&typeof o.AutoComplete.connect=="function")return o.AutoComplete;let e=F("pds-autocomplete.js",o.currentConfig?.autoCompleteURL);return Q||(Q=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 o.AutoComplete=n,n}).catch(t=>{throw Q=null,t})),Q};function et(e){let t=typeof CustomEvent=="function";try{let n=t?new CustomEvent("pds:ready",{detail:e}):new Event("pds:ready");o.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 tt(e={}){let t=typeof CustomEvent=="function",n={at:Date.now(),...e};try{let s=t?new CustomEvent("pds:config-changed",{detail:n}):new Event("pds:config-changed");o.dispatchEvent(s)}catch{}if(typeof document<"u")if(t){let s={detail:n,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:config-changed",s))}catch{}}else try{document.dispatchEvent(new Event("pds:config-changed"))}catch{}}var ge="pure-ds-theme",x=null,$=null;function Se(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 Le(e){try{if(x&&$){try{typeof x.removeEventListener=="function"?x.removeEventListener("change",$):typeof x.removeListener=="function"&&x.removeListener($)}catch{}x=null,$=null}if(e==="system"&&typeof window<"u"&&window.matchMedia){let t=window.matchMedia("(prefers-color-scheme: dark)"),n=s=>{let a=s?.matches===void 0?t.matches:s.matches;try{let r=a?"dark":"light";document.documentElement.setAttribute("data-theme",r),o.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:r,source:"system"}}))}catch{}};x=t,$=n,typeof t.addEventListener=="function"?t.addEventListener("change",n):typeof t.addListener=="function"&&t.addListener(n)}}catch{}}var zt=Object.getOwnPropertyDescriptor(o,"theme");zt||Object.defineProperty(o,"theme",{get(){try{return typeof window>"u"?null:localStorage.getItem(ge)||null}catch{return null}},set(e){try{if(typeof window>"u")return;let t=o.currentConfig?.design||null,n=me(e);if(t&&!Oe(t,n)){let s=t?.name||o.currentPreset?.name||o.currentConfig?.preset||"current preset";o.log("warn",`PDS theme "${n}" not supported by preset "${s}".`),o.dispatchEvent(new CustomEvent("pds:theme:blocked",{detail:{theme:e,resolvedTheme:n,preset:s}}));return}e==null?localStorage.removeItem(ge):localStorage.setItem(ge,e),Se(e),Le(e),o.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:e,source:"api"}}))}catch{}}});o.defaultEnhancers=[];async function Tt(e){o.initializing=!0;try{let t=e&&e.mode||"live",{mode:n,...s}=e||{};o.mode=t,o.logHandler=typeof s?.log=="function"?s.log:null,o.currentConfig=we(s);let a=s&&typeof s.localization=="object"&&s.localization?s.localization:null;a?(await I(),se(a)):se(null);let r;if(t==="static")r=await Ct(s);else{let y=J(s,{resolvePublicAssetURL:K}),g=s?.managerURL||s?.public?.managerURL||s?.manager?.url||new URL("core/pds-manager.js",y).href||new URL("./pds-manager.js",import.meta.url).href,{startLive:d}=await import(g);r=await d(o,s,{emitReady:et,emitConfigChanged:tt,applyResolvedTheme:Se,setupSystemListenerIfNeeded:Le})}o.compiled=we(r?.config||null);let l=o?.compiled?.design?.icons?.externalPath||"/assets/img/icons/";return o.log("info",`startup ready; external icon path: ${l}`),r}finally{o.initializing=!1}}o.start=Tt;async function Ct(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,s=e.themeStorageKey??"pure-ds-theme",a=e.staticPaths??{},r=J(e,{resolvePublicAssetURL:K}),l=e&&e.autoDefine||null,y;l&&l.baseURL?y=q(V(l.baseURL,{preferModule:!1})):y=`${r}components/`;let g=l&&Array.isArray(l.predefine)&&l.predefine||[],d=l&&typeof l.mapper=="function"&&l.mapper||null;try{Ue(o);let{resolvedTheme:c}=Me({manageTheme:n,themeStorageKey:s,applyResolvedTheme:Se,setupSystemListenerIfNeeded:Le}),i=await Dt(r,e),w=Array.isArray(e?.enhancers)?e.enhancers:e?.enhancers&&typeof e.enhancers=="object"?Object.values(e.enhancers):[],m=i?.config?{...i.config,...e,design:e?.design||i.config.design,preset:e?.preset||i.config.preset}:{...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`},S=i?.paths||{};if(a={..._,...S,...a},o.registry.setStaticMode(a),t&&typeof document<"u")try{let E=await o.registry.getStylesheet("styles");if(E){E._pds=!0;let h=(document.adoptedStyleSheets||[]).filter(b=>b._pds!==!0);document.adoptedStyleSheets=[...h,E],tt({mode:"static",source:"static:styles-applied"})}}catch(E){He.call(o,"warn","Failed to apply static styles:",E)}let v=null,P=[];try{let E=await xt(),h=await Ne({autoDefineBaseURL:y,autoDefinePreload:g,autoDefineMapper:d,enhancers:w,autoDefineOverrides:l||null,autoDefinePreferModule:!(l&&l.baseURL)},{baseEnhancers:E});v=h.autoDefiner,P=h.mergedEnhancers||[]}catch(E){He.call(o,"error","\u274C Failed to initialize AutoDefiner/Enhancers (static):",E)}return o.compiled=we({mode:"static",...m,theme:c,enhancers:P}),et({mode:"static",config:m,theme:c,autoDefiner:v}),{config:m,theme:c,autoDefiner:v}}catch(c){throw o.dispatchEvent(new CustomEvent("pds:error",{detail:{error:c}})),c}}var Ut=o.createJSONLocalization({locale:"en-US",locales:["en-US","nl-NL"],aliases:{en:["en-US"],nl:["nl-NL"]},basePath:"/assets/locales"}),nt={mode:"live",liveEdit:!0,preset:"default",localization:Ut,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 A={name:"@pure-ds/core",shortname:"pds",version:"0.7.40",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:{test:'echo "Error: no test specified" && exit 1',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 o.start(nt);document.documentElement.lang="en";var st=typeof A.repository=="string"?A.repository:A.repository?.url,Nt=st?st.replace(/^git\+/,"").replace(/\.git$/,""):"",hn=A.homepage||Nt,yn=A.bugs?.url||"";document.body.innerHTML=`
3
3
  <div class="container text-center">
4
4
  <img src="/assets/img/pds-logo.svg" alt="PDS Logo" title="${C("PDS Logo")}" width="64" height="64" />
5
5
  <header class="container section">
@@ -1,7 +1,7 @@
1
- function m(o){return new DOMParser().parseFromString(o,"text/html").body.childNodes}function y(o,t=100){let e;return function(...i){let r=()=>{clearTimeout(e),o(...i)};clearTimeout(e),e=setTimeout(r,t)}}function p(o){setTimeout(o,0)}function b(o){try{if(typeof o!="string"||o.indexOf(`
2
- `)!==-1||o.indexOf(" ")!==-1||o.startsWith("#/"))return!1;let t=new URL(o,window.location.origin);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function x(o,t,e){let s=window.screen.width/2-t/2,i=window.screen.height/2-e/2;return window.open(o,"",`toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=${t}, height=${e}, top=${i}, left=${s}`)}var g={result:"ac-suggestion",item:"ac-itm"},f=class o extends EventTarget{constructor(t,e,s){super(),this.settings={emptyResultsText:"",...s},this.container=t,this.input=e,this.input.setAttribute("autocomplete","off"),this.categories=s.categories||{},this.caches=new Map,p(this.attach.bind(this))}static connect(t,e){let s=t.target;if(!s._autoComplete){if(!e?.categories)throw Error("Missing autocomplete settings");s._autoComplete=new o(s.parentNode,s,e),t.type==="focus"&&setTimeout(()=>{s._autoComplete.focusHandler(t)},100)}return s._autoComplete}on(t,e){return this.input.addEventListener(t,e),this}attach(){this.resultsDiv=document.createElement("div"),this.resultsDiv.title="",this.resultsDiv.classList.add(g.result),this.container.offsetWidth>100&&(this.resultsDiv.style.width=this.container.offsetWidth),this.resultsDiv.addEventListener("mousedown",this.resultClick.bind(this)),this.container.classList.add("ac-container"),this.input.classList.add("ac-input");let t=getComputedStyle(this.input);this.container.style.setProperty("--ac-bg-default",t.backgroundColor),this.container.style.setProperty("--ac-color-default",t.color);let e=getComputedStyle(this.input).accentColor;e!=="auto"&&this.container.style.setProperty("--ac-accent-color",e),(this.container?.shadowRoot??this.container).appendChild(this.resultsDiv),this.controller().clear("attach"),this.on("input",y(this.inputHandler.bind(this),this.settings.throttleInputMs??300)).on("focus",this.focusHandler.bind(this)).on("focusout",this.blurHandler.bind(this)).on("keyup",this.keyUpHandler.bind(this)).on("keydown",this.keyDownHandler.bind(this))}controller(){let t=this.internalController();return typeof this.settings.controller=="function"&&(t=this.settings.controller(this)??t),t}internalController(){return{show:this.show.bind(this),hide:this.hide.bind(this),clear:this.clear.bind(this),empty:()=>{}}}moveResult(t){this.controller().show();let e=this.acItems.length;this.rowIndex=this.rowIndex+t,this.rowIndex<=0?this.rowIndex=0:this.rowIndex>e-1&&(this.rowIndex=0);for(let i of this.acItems)i.classList.remove("selected");let s=this.getSelectedDiv();s?(s.classList.add("selected"),s.scrollIntoView({behavior:"smooth",block:"end",inline:"nearest"})):this.focusHandler({target:this.input})}getSelectedDiv(){return this.resultsDiv.querySelector(`div:nth-child(${this.rowIndex+1})`)}selectResult(t){if(t=t||this.getSelectedDiv(),t){let e=parseInt(t.getAttribute("data-index"));this.resultClicked=!0;let s=this.results[e],i=this.categories[s.category]??{};i.action=i.action??this.setText.bind(this),i.newTab&&(this.tabWindow=x("about:blank"));let r={...s,search:this.input.value};t.classList.add("ac-active"),setTimeout(()=>{this.controller().hide("result-selected"),r.action?r.action(r):(i.action(r),i.newTab&&(r.url?this.tabWindow.location.href=r.url:this.tabWindow.close()));var n=new Event("change",{bubbles:!0});this.input.dispatchEvent(n),this.controller().clear("result-selected");let u=new Event("result-selected");u.detail=r,this.input.dispatchEvent(u)},0)}}setText(t){let e=!1;this.input?(this.input.value=t.text,e=!0):this.container?.autoCompleteInput?(this.container.autoCompleteInput.value=t.text,e=!0):"value"in this.container&&(this.container.value=t.text,e=!0),e&&this.input&&this.input.dispatchEvent(new Event("input",{bubbles:!0})),this.controller().hide("settext")}resultClick(t){this.selectResult(t.target.closest(`.${g.item}`))}blurHandler(){setTimeout(()=>{this.resultClicked||this.controller().clear("blurred"),this.resultClicked=!1},100)}clear(){this.settings.debug||this.resultsDiv&&(this.resultsDiv.innerHTML="",this.controller().hide("clear"),this.cacheTmr&&clearTimeout(this.cacheTmr),this.cacheTmr=setTimeout(()=>{this.caches.clear()},60*1e3*5))}show(){if(!this.resultsDiv.classList.contains("ac-active")){let t=this.getViewBounds();this.resultsDiv.style.position="absolute",t.rect.width>100&&(this.resultsDiv.style.width=`${t.rect.width}px`),this.settings.direction=this.settings.direction??t.suggestedDirection,this.resultsDiv.setAttribute("data-direction",this.settings.direction),this.settings.direction==="up"?(this.resultsDiv.style.top="unset",this.resultsDiv.style.bottom=`${t.rect.height+20}px`,this.rowIndex=this.acItems.length):(this.resultsDiv.style.bottom="unset",this.resultsDiv.style.top=`${t.rect.height}px`,this.rowIndex=-1),this.resultsDiv.style.maxWidth="unset",this.resultsDiv.classList.toggle("ac-active",!0)}}getViewBounds(){let t=this.input.getBoundingClientRect();return{rect:t,suggestedDirection:t.top+t.height+500>window.innerHeight?"up":"down"}}hide(){this.resultsDiv.classList.toggle("ac-active",!1)}empty(){this.resultsDiv.innerHTML=`<div class="ac-empty">${this.settings.emptyResultsText}</div>`,this.controller().show()}inputHandler(t){this.cacheTmr&&clearTimeout(this.cacheTmr);let e={search:t.target.value,categories:this.categories};this.container.classList.add("search-running"),this.getItems(e,t).then(s=>{this.controller().clear("new-results"),this.resultsHandler(s,e),this.container.classList.remove("search-running")})}keyDownHandler(t){switch(t.key){case"Enter":t.stopPropagation(),t.preventDefault();break;case"ArrowDown":p(this.moveResult(1));break;case"ArrowUp":p(this.moveResult(-1));break}}keyUpHandler(t){switch(t.key){case"Escape":this.controller().hide("escape");break;case"Enter":this.getSelectedDiv()&&(this.container.preventEnter=!0,t.stopPropagation(),t.preventDefault(),this.selectResult(),setTimeout(()=>{this.container.preventEnter=!1},10));break;default:break}}focusHandler(t){this.controller().clear("focus");let e=t.target.value;this.suggest(e,t)}suggest(t,e){this.input.focus();let s={suggest:!0,search:t||"",categories:this.categories};this.getItems(s,e).then(i=>{this.input.dispatchEvent(new CustomEvent("show-results",{detail:{results:i}})),this.resultsHandler(i,s)})}sort(t,e){return t.sort((s,i)=>{let r=e.categories[s.category],n=e.categories[i.category],u=typeof r.sortIndex=="function"?r.sortIndex(e):r.sortIndex??0;return(typeof n.sortIndex=="function"?n.sortIndex(e):n.sortIndex??0)>u?1:-1})}resultsHandler(t,e){this.results=t,this.rowIndex=-1;let s=0,i=(r,n)=>`
3
- <div title="${n.tooltip||""}" data-index="${s}" class="${`${g.item} cat-${n.category} ${n.class??""}`.trim()}"${n.style?` style="${n.style}"`:""}>
1
+ function w(c){return new DOMParser().parseFromString(c,"text/html").body.childNodes}function v(c,t=100){let e;return function(...i){let r=()=>{clearTimeout(e),c(...i)};clearTimeout(e),e=setTimeout(r,t)}}function m(c){setTimeout(c,0)}function I(c){try{if(typeof c!="string"||c.indexOf(`
2
+ `)!==-1||c.indexOf(" ")!==-1||c.startsWith("#/"))return!1;let t=new URL(c,window.location.origin);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function A(c,t,e){let s=window.screen.width/2-t/2,i=window.screen.height/2-e/2;return window.open(c,"",`toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=${t}, height=${e}, top=${i}, left=${s}`)}var y={result:"ac-suggestion",item:"ac-itm"},p=class c extends EventTarget{constructor(t,e,s){super(),this.settings={emptyResultsText:"",...s},this.container=t,this.input=e,this.input.setAttribute("autocomplete","off"),this.categories=s.categories||{},this.caches=new Map,m(this.attach.bind(this))}static connect(t,e){let s=t.target;if(!s._autoComplete){if(!e?.categories)throw Error("Missing autocomplete settings");s._autoComplete=new c(s.parentNode,s,e),t.type==="focus"&&setTimeout(()=>{s._autoComplete.focusHandler(t)},100)}return s._autoComplete}on(t,e){return this.input.addEventListener(t,e),this}attach(){this.resultsDiv=document.createElement("div"),this.resultsDiv.title="",this.resultsDiv.classList.add(y.result),this.container.offsetWidth>100&&(this.resultsDiv.style.width=this.container.offsetWidth),this.resultsDiv.addEventListener("mousedown",this.resultClick.bind(this)),this.container.classList.add("ac-container"),this.input.classList.add("ac-input");let t=getComputedStyle(this.input);this.container.style.setProperty("--ac-bg-default",t.backgroundColor),this.container.style.setProperty("--ac-color-default",t.color);let e=getComputedStyle(this.input).accentColor;e!=="auto"&&this.container.style.setProperty("--ac-accent-color",e),(this.container?.shadowRoot??this.container).appendChild(this.resultsDiv),this.controller().clear("attach"),this.on("input",v(this.inputHandler.bind(this),this.settings.throttleInputMs??300)).on("focus",this.focusHandler.bind(this)).on("focusout",this.blurHandler.bind(this)).on("keyup",this.keyUpHandler.bind(this)).on("keydown",this.keyDownHandler.bind(this))}controller(){let t=this.internalController();return typeof this.settings.controller=="function"&&(t=this.settings.controller(this)??t),t}internalController(){return{show:this.show.bind(this),hide:this.hide.bind(this),clear:this.clear.bind(this),empty:()=>{}}}moveResult(t){this.controller().show();let e=this.acItems.length;this.rowIndex=this.rowIndex+t,this.rowIndex<=0?this.rowIndex=0:this.rowIndex>e-1&&(this.rowIndex=0);for(let i of this.acItems)i.classList.remove("selected");let s=this.getSelectedDiv();s?(s.classList.add("selected"),s.scrollIntoView({behavior:"smooth",block:"end",inline:"nearest"})):this.focusHandler({target:this.input})}getSelectedDiv(){return this.resultsDiv.querySelector(`div:nth-child(${this.rowIndex+1})`)}selectResult(t){if(t=t||this.getSelectedDiv(),t){let e=parseInt(t.getAttribute("data-index"));this.resultClicked=!0;let s=this.results[e],i=this.categories[s.category]??{};i.action=i.action??this.setText.bind(this),i.newTab&&(this.tabWindow=A("about:blank"));let r={...s,search:this.input.value};t.classList.add("ac-active"),setTimeout(()=>{this.controller().hide("result-selected"),r.action?r.action(r):(i.action(r),i.newTab&&(r.url?this.tabWindow.location.href=r.url:this.tabWindow.close()));var n=new Event("change",{bubbles:!0});this.input.dispatchEvent(n),this.controller().clear("result-selected");let u=new Event("result-selected");u.detail=r,this.input.dispatchEvent(u)},0)}}setText(t){let e=!1;this.input?(this.input.value=t.text,e=!0):this.container?.autoCompleteInput?(this.container.autoCompleteInput.value=t.text,e=!0):"value"in this.container&&(this.container.value=t.text,e=!0),e&&this.input&&this.input.dispatchEvent(new Event("input",{bubbles:!0})),this.controller().hide("settext")}resultClick(t){this.selectResult(t.target.closest(`.${y.item}`))}blurHandler(){setTimeout(()=>{this.resultClicked||this.controller().clear("blurred"),this.resultClicked=!1},100)}clear(){this.settings.debug||this.resultsDiv&&(this.resultsDiv.innerHTML="",this.controller().hide("clear"),this.cacheTmr&&clearTimeout(this.cacheTmr),this.cacheTmr=setTimeout(()=>{this.caches.clear()},60*1e3*5))}show(){if(!this.resultsDiv.classList.contains("ac-active")){let t=this.getViewBounds();this.resultsDiv.style.position="absolute",t.rect.width>100&&(this.resultsDiv.style.width=`${t.rect.width}px`),this.settings.direction=this.settings.direction??t.suggestedDirection,this.resultsDiv.setAttribute("data-direction",this.settings.direction),this.settings.direction==="up"?(this.resultsDiv.style.top="unset",this.resultsDiv.style.bottom=`${t.rect.height+20}px`,this.rowIndex=this.acItems.length):(this.resultsDiv.style.bottom="unset",this.resultsDiv.style.top=`${t.rect.height}px`,this.rowIndex=-1),this.resultsDiv.style.maxWidth="unset",this.resultsDiv.classList.toggle("ac-active",!0)}}getViewBounds(){let t=this.input.getBoundingClientRect();return{rect:t,suggestedDirection:t.top+t.height+500>window.innerHeight?"up":"down"}}hide(){this.resultsDiv.classList.toggle("ac-active",!1)}empty(){this.resultsDiv.innerHTML=`<div class="ac-empty">${this.settings.emptyResultsText}</div>`,this.controller().show()}inputHandler(t){this.cacheTmr&&clearTimeout(this.cacheTmr);let e={search:t.target.value,categories:this.categories};this.container.classList.add("search-running"),this.getItems(e,t).then(s=>{this.controller().clear("new-results"),this.resultsHandler(s,e),this.container.classList.remove("search-running")})}keyDownHandler(t){switch(t.key){case"Enter":t.stopPropagation(),t.preventDefault();break;case"ArrowDown":m(this.moveResult(1));break;case"ArrowUp":m(this.moveResult(-1));break}}keyUpHandler(t){switch(t.key){case"Escape":this.controller().hide("escape");break;case"Enter":this.getSelectedDiv()&&(this.container.preventEnter=!0,t.stopPropagation(),t.preventDefault(),this.selectResult(),setTimeout(()=>{this.container.preventEnter=!1},10));break;default:break}}focusHandler(t){this.controller().clear("focus");let e=t.target.value;this.suggest(e,t)}suggest(t,e){this.input.focus();let s={suggest:!0,search:t||"",categories:this.categories};this.getItems(s,e).then(i=>{this.input.dispatchEvent(new CustomEvent("show-results",{detail:{results:i}})),this.resultsHandler(i,s)})}sort(t,e){return t.sort((s,i)=>{let r=e.categories[s.category],n=e.categories[i.category],u=typeof r.sortIndex=="function"?r.sortIndex(e):r.sortIndex??0;return(typeof n.sortIndex=="function"?n.sortIndex(e):n.sortIndex??0)>u?1:-1})}resultsHandler(t,e){this.results=t,this.rowIndex=-1;let s=0,i=(r,n)=>`
3
+ <div title="${n.tooltip||""}" data-index="${s}" class="${`${y.item} cat-${n.category} ${n.class??""}`.trim()}"${n.style?` style="${n.style}"`:""}>
4
4
  ${this.handleImageOrIcon(n)}
5
5
  <span class="text">${this.formatResultItem(n,e,r)}</span>
6
6
  ${this.settings.hideCategory?"":`<span class="category">${n.category||""}</span>`}
7
- </div>`;t.forEach(r=>{let n=e.categories[r.category]||{};r.element?this.resultsDiv.appendChild(r.element):(r=typeof r=="string"?{text:r}:r,this.resultsDiv.appendChild(m(i(n,r))[0])),s++}),t.length?(this.acItems=this.resultsDiv.querySelectorAll(".ac-itm"),this.controller().show()):e.search.length&&this.controller().empty()}handleImageOrIcon(t){return t.image?`<img src="${t.image}"/>`:typeof this.settings.iconHandler=="function"?this.settings.iconHandler(t):`<svg-icon icon="${t.icon}"></svg-icon>`}formatResultItem(t,e,s){let i=typeof t=="string"?{text:t}:t,r=i.text;return e.search&&(r=r.replace("%search%",e.search),i.description=i.description?.replace("%search%",e.search)),r=this.highlight(r,e.search),i.description&&(r=`<div>${r}</div><small>${i.description}</small>`),s.format&&(r=s.format({item:i,result:r,options:e})),r}highlight(t,e){var s=new RegExp("("+e+")","gi");return t.replace(s,'<span class="txt-hl">$1</span>')}async getItems(t,e){this.aborter&&this.aborter.abort();let s=this.caches.get(t.search);if(s)return s;let i=this.settings.map,r=a=>(typeof a=="string"&&(a={text:a}),a),n=a=>i?a.map(h=>({text:h[i]})):a.map(h=>r(h)),u=a=>(this.settings.max&&this.settings.max>0&&(a.length=this.settings.max),a);return this.aborter=new AbortController,this.aborterSignal=this.aborter.signal,new Promise(a=>{let h=l=>{l=this.sort(l,t),this.settings.cache!==!1&&this.caches.set(t.search,l),a(l)};if(b(this.items)){if(this.settings.minlength>0&&(!t.search||t.search.length<this.settings.minlength)){h([]);return}let l=this.formatSearch(this.items,t);fetch(l).then(c=>{if(c.status===200){c.json().then(d=>{d=n(d),h(u(d.filter(w=>this.isMatch(t,w))))});return}throw Error(`HTTP error ${c.status} - ${l}`)})}else if(Array.isArray(this.items)){let l=!0;this.items=this.items.map(c=>typeof c=="string"?{text:c}:(l=!1,c)),l&&this.container.classList.add("simple"),h(u(n(this.items)))}else if(typeof this.items=="function")t.control=this.container,Promise.resolve(this.items(t,e)).then(c=>{c=c.map(d=>r(d)),c=n(c),h(c)});else return h(Promise.resolve(this.items.apply(this,t)))})}async items(t){let e=[];t.results=[],t.signal=this.aborterSignal;for(var s in t.categories){let i=t.categories[s];if(i.trigger=i.trigger??(()=>!0),t.results=e,i.trigger(t)){let r=[];try{r=await i.getItems(t)}catch(n){console.warn(`Error loading items for omniBox category '${s}'.`,n)}e=e.concat(r.map(n=>(n.category=s,n)))}}return e}formatSearch(t,e){return t.indexOf("%search%")?t.replace("%search%",e.search||""):t+"?"+this.createQueryParam(e)}createQueryParam(t){let e=t.suggest?"&suggest=true":"";return`q=${t.text}${e}`}isMatch(t,e){return e.text?.indexOf("%search%")>=0?!0:t.search?e.text?.toLowerCase().indexOf(t.search.toLowerCase())>=0:t.suggest}static textFilter(t,e){return function(s){if(!t.search)return!0;if(s.hidden)return!1;let r=(e?s[e]:s).match(new RegExp(t.search,"gi"));if(r)return r;if(s.config?.tags)return s.config.tags.some(n=>n.match(new RegExp(t.search,"gi")))}}};export{f as AutoComplete};
7
+ </div>`;t.forEach(r=>{let n=e.categories[r.category]||{};r.element?this.resultsDiv.appendChild(r.element):(r=typeof r=="string"?{text:r}:r,this.resultsDiv.appendChild(w(i(n,r))[0])),s++}),t.length?(this.acItems=this.resultsDiv.querySelectorAll(".ac-itm"),this.controller().show()):e.search.length&&this.controller().empty()}handleImageOrIcon(t){return t.image?`<img src="${t.image}"/>`:typeof this.settings.iconHandler=="function"?this.settings.iconHandler(t):`<svg-icon icon="${t.icon}"></svg-icon>`}formatResultItem(t,e,s){let i=typeof t=="string"?{text:t}:t,r=i.text;return e.search&&(r=r.replace("%search%",e.search),i.description=i.description?.replace("%search%",e.search)),r=this.highlight(r,e.search),i.description&&(r=`<div>${r}</div><small>${i.description}</small>`),s.format&&(r=s.format({item:i,result:r,options:e})),r}highlight(t,e){var s=new RegExp("("+e+")","gi");return t.replace(s,'<span class="txt-hl">$1</span>')}async getItems(t,e){this.aborter&&this.aborter.abort();let s=this.caches.get(t.search);if(s)return s;let i=this.settings.map,r=l=>(typeof l=="string"&&(l={text:l}),l),n=l=>i?l.map(h=>({text:h[i]})):l.map(h=>r(h)),u=l=>(this.settings.max&&this.settings.max>0&&(l.length=this.settings.max),l);return this.aborter=new AbortController,this.aborterSignal=this.aborter.signal,new Promise(l=>{let h=o=>{o=this.sort(o,t),this.settings.cache!==!1&&this.caches.set(t.search,o),l(o)};if(I(this.items)){if(this.settings.minlength>0&&(!t.search||t.search.length<this.settings.minlength)){h([]);return}let o=this.formatSearch(this.items,t);fetch(o).then(a=>{if(a.status===200){a.json().then(d=>{d=n(d),h(u(d.filter(g=>this.isMatch(t,g))))});return}throw Error(`HTTP error ${a.status} - ${o}`)})}else if(Array.isArray(this.items)){let o=!0;this.items=this.items.map(a=>typeof a=="string"?{text:a}:(o=!1,a)),o&&this.container.classList.add("simple"),h(u(n(this.items)))}else if(typeof this.items=="function")t.control=this.container,Promise.resolve(this.items(t,e)).then(a=>{a=a.map(d=>r(d)),a=n(a),h(a)});else return h(Promise.resolve(this.items.apply(this,t)))})}async items(t){let e=[];t.results=[],t.signal=this.aborterSignal;for(var s in t.categories){let i=t.categories[s];if(i.trigger=i.trigger??(()=>!0),t.results=e,i.trigger(t)){let r=[];try{r=await i.getItems(t)}catch(n){console.warn(`Error loading items for omniBox category '${s}'.`,n)}e=e.concat(r.map(n=>(n.category=s,n)))}}return e}formatSearch(t,e){return t.indexOf("%search%")?t.replace("%search%",e.search||""):t+"?"+this.createQueryParam(e)}createQueryParam(t){let e=t.suggest?"&suggest=true":"";return`q=${t.text}${e}`}isMatch(t,e){return e.text?.indexOf("%search%")>=0?!0:t.search?e.text?.toLowerCase().indexOf(t.search.toLowerCase())>=0:t.suggest}static textFilter(t,e){return function(s){if(!t.search)return!0;if(s.hidden)return!1;let r=(e?s[e]:s).match(new RegExp(t.search,"gi"));if(r)return r;if(s.config?.tags)return s.config.tags.some(n=>n.match(new RegExp(t.search,"gi")))}}};var b=p?.prototype?.selectResult;typeof b=="function"&&p?.prototype?.__pdsSelectedItemPatched!==!0&&(p.prototype.selectResult=function(t){let e=t||this.getSelectedDiv?.();if(!e)return b.call(this,t);let s=e.getAttribute?.("data-index")??"",i=Number.parseInt(s,10),r=Number.isInteger(i)?this.results?.[i]:null,n=r&&this.categories?this.categories[r.category]:null,u=[],l=(o,a)=>{if(!o||typeof o[a]!="function")return;let d=o[a],g=!1,x=()=>{g||(o[a]=d,g=!0)};o[a]=function(f={},...C){try{return f&&typeof f=="object"&&!("selectedItem"in f)&&(f.selectedItem=e),d.call(this,f,...C)}finally{x()}},u.push(x)};l(r,"action"),l(n,"action");let h=b.call(this,e);return setTimeout(()=>{for(let o of u)o()},1e3),h},p.prototype.__pdsSelectedItemPatched=!0);export{p as AutoComplete};
@@ -162,7 +162,8 @@ export class SvgIcon extends HTMLElement {
162
162
  const attrIcon = this.getAttribute('icon') || 'missing';
163
163
  const icon = this._morphing ? (this._currentIcon || attrIcon) : attrIcon;
164
164
  const sizeAttr = this.getAttribute('size') || '24';
165
- const color = this.getAttribute('color') || 'currentColor';
165
+ const colorAttr = this.getAttribute('color');
166
+ const color = colorAttr || 'currentColor';
166
167
  const label = this.getAttribute('label');
167
168
  const spriteOverride = this.getAttribute('sprite');
168
169
  const rotate = this.getAttribute('rotate') || '0';
@@ -379,6 +380,13 @@ export class SvgIcon extends HTMLElement {
379
380
  return;
380
381
  }
381
382
 
383
+ // Keep host color in sync for external SVGs that rely on fill="currentColor".
384
+ if (colorAttr) {
385
+ this.style.setProperty('color', colorAttr);
386
+ } else {
387
+ this.style.removeProperty('color');
388
+ }
389
+
382
390
  this._stackEl.setAttribute('class', `icon-stack${morphClass ? ` ${morphClass}` : ''}`);
383
391
  this._stackEl.style.width = `${size}px`;
384
392
  this._stackEl.style.height = `${size}px`;
@@ -65,6 +65,7 @@ export class PdsOmnibox extends HTMLElement {
65
65
  #lengthProbe;
66
66
  #suggestionsUpdatedHandler;
67
67
  #suggestionsObserver;
68
+ #overlayOverflowOverrides = new Map();
68
69
 
69
70
  constructor() {
70
71
  super();
@@ -96,6 +97,7 @@ export class PdsOmnibox extends HTMLElement {
96
97
  }
97
98
  this.#teardownAutoCompleteSizing();
98
99
  this.#teardownSuggestionsObserver();
100
+ this.#setOverlayClippingOverride(false);
99
101
  const autoComplete = this.#input?._autoComplete;
100
102
  if (autoComplete) {
101
103
  autoComplete.controller?.().clear?.("disconnected");
@@ -765,6 +767,7 @@ export class PdsOmnibox extends HTMLElement {
765
767
  this.#suggestionsObserver = new MutationObserver(() => {
766
768
  if (!suggestion.classList.contains("ac-active")) {
767
769
  this.removeAttribute("data-suggestions-open");
770
+ this.#setOverlayClippingOverride(false);
768
771
  this.#clearSuggestionOverlayStyles(suggestion);
769
772
  this.#resetIconToDefault();
770
773
  }
@@ -819,7 +822,7 @@ export class PdsOmnibox extends HTMLElement {
819
822
  return null;
820
823
  }
821
824
 
822
- #hasTransformedAncestor(startNode) {
825
+ #getFixedContainingBlock(startNode) {
823
826
  let current = startNode;
824
827
  let safety = 0;
825
828
  while (current && safety < 80) {
@@ -831,19 +834,21 @@ export class PdsOmnibox extends HTMLElement {
831
834
  style.filter !== "none" ||
832
835
  style.backdropFilter !== "none"
833
836
  ) {
834
- return true;
837
+ return current;
835
838
  }
836
839
  }
837
840
  current = this.#getComposedParent(current);
838
841
  safety += 1;
839
842
  }
840
- return false;
843
+ return null;
841
844
  }
842
845
 
843
846
  #shouldUseFixedSuggestionOverlay(container) {
844
847
  if (!container) return false;
845
- if (this.closest("pds-drawer, dialog")) return false;
846
- return !this.#hasTransformedAncestor(this);
848
+
849
+ // Always prefer viewport overlay positioning so results are not clipped by
850
+ // parent overflow containers (for example dialog bodies or drawers).
851
+ return true;
847
852
  }
848
853
 
849
854
  #positionSuggestionInline({ container, suggestion, rect, direction, offset, maxHeight }) {
@@ -865,6 +870,7 @@ export class PdsOmnibox extends HTMLElement {
865
870
  container,
866
871
  suggestion,
867
872
  rect,
873
+ containingBlock,
868
874
  viewportHeight,
869
875
  viewportWidth,
870
876
  direction,
@@ -878,21 +884,28 @@ export class PdsOmnibox extends HTMLElement {
878
884
  return;
879
885
  }
880
886
 
887
+ const blockRect = containingBlock?.getBoundingClientRect?.();
888
+ const originLeft = Number.isFinite(blockRect?.left) ? blockRect.left : 0;
889
+ const originTop = Number.isFinite(blockRect?.top) ? blockRect.top : 0;
890
+ const blockBottom = Number.isFinite(blockRect?.bottom)
891
+ ? blockRect.bottom
892
+ : viewportHeight;
893
+
881
894
  const clampedLeft = Math.max(gap, Math.min(rect.left, viewportWidth - rect.width - gap));
882
895
  const clampedWidth = Math.max(0, Math.min(rect.width, viewportWidth - gap * 2));
883
896
 
884
897
  suggestion.style.position = "fixed";
885
- suggestion.style.left = `${Math.round(clampedLeft)}px`;
898
+ suggestion.style.left = `${Math.round(clampedLeft - originLeft)}px`;
886
899
  suggestion.style.width = `${Math.round(clampedWidth)}px`;
887
900
  suggestion.style.maxWidth = `${Math.round(Math.max(0, viewportWidth - gap * 2))}px`;
888
901
  suggestion.style.right = "auto";
889
902
 
890
903
  if (direction === "up") {
891
904
  suggestion.style.top = "auto";
892
- suggestion.style.bottom = `${Math.round(viewportHeight - rect.top + offset)}px`;
905
+ suggestion.style.bottom = `${Math.round(blockBottom - rect.top + offset)}px`;
893
906
  } else {
894
907
  suggestion.style.bottom = "auto";
895
- suggestion.style.top = `${Math.round(rect.bottom + offset)}px`;
908
+ suggestion.style.top = `${Math.round(rect.bottom - originTop + offset)}px`;
896
909
  }
897
910
 
898
911
  container.setAttribute("data-direction", direction);
@@ -900,6 +913,68 @@ export class PdsOmnibox extends HTMLElement {
900
913
  container.style.setProperty("--ac-max-height", `${maxHeight}px`);
901
914
  }
902
915
 
916
+ #collectClippingAncestors(startNode, stopAt) {
917
+ const targets = [];
918
+ let current = this.#getComposedParent(startNode);
919
+
920
+ while (current instanceof Element) {
921
+ const tagName = String(current.tagName || "").toUpperCase();
922
+ if (tagName === "HTML" || tagName === "BODY") {
923
+ break;
924
+ }
925
+
926
+ const style = getComputedStyle(current);
927
+ const clips = [style.overflow, style.overflowX, style.overflowY].some(
928
+ (value) => value && value !== "visible",
929
+ );
930
+
931
+ if (clips) {
932
+ targets.push(current);
933
+ }
934
+
935
+ if (stopAt && current === stopAt) {
936
+ break;
937
+ }
938
+
939
+ current = this.#getComposedParent(current);
940
+ }
941
+
942
+ return targets;
943
+ }
944
+
945
+ #setOverlayClippingOverride(enabled, stopAt) {
946
+ if (enabled) {
947
+ if (this.#overlayOverflowOverrides.size) {
948
+ return;
949
+ }
950
+
951
+ const startNode = this.#input?.parentElement || this;
952
+ const targets = this.#collectClippingAncestors(startNode, stopAt);
953
+
954
+ targets.forEach((element) => {
955
+ this.#overlayOverflowOverrides.set(element, {
956
+ overflow: element.style.overflow,
957
+ overflowX: element.style.overflowX,
958
+ overflowY: element.style.overflowY,
959
+ });
960
+
961
+ element.style.overflow = "visible";
962
+ element.style.overflowX = "visible";
963
+ element.style.overflowY = "visible";
964
+ });
965
+
966
+ return;
967
+ }
968
+
969
+ this.#overlayOverflowOverrides.forEach((previous, element) => {
970
+ element.style.overflow = previous.overflow;
971
+ element.style.overflowX = previous.overflowX;
972
+ element.style.overflowY = previous.overflowY;
973
+ });
974
+
975
+ this.#overlayOverflowOverrides.clear();
976
+ }
977
+
903
978
  #updateSuggestionMaxHeight() {
904
979
  if (!this.#input) return;
905
980
  const container = this.#input.parentElement;
@@ -908,6 +983,7 @@ export class PdsOmnibox extends HTMLElement {
908
983
  const rect = container.getBoundingClientRect();
909
984
  const viewportHeight = window.visualViewport?.height || window.innerHeight;
910
985
  const gap = this.#readSpacingToken(container, "--ac-viewport-gap") || 0;
986
+ const containingBlock = this.#getFixedContainingBlock(container);
911
987
  const root = container.shadowRoot ?? container;
912
988
  const suggestion = root?.querySelector?.(".ac-suggestion");
913
989
  const currentDirection =
@@ -948,10 +1024,13 @@ export class PdsOmnibox extends HTMLElement {
948
1024
  this.toggleAttribute("data-suggestions-open", Boolean(isSuggestionActive));
949
1025
 
950
1026
  if (!suggestion || !isSuggestionActive || suggestion.classList.contains("full-mobile")) {
1027
+ this.#setOverlayClippingOverride(false);
951
1028
  this.#clearSuggestionOverlayStyles(suggestion);
952
1029
  return;
953
1030
  }
954
1031
 
1032
+ this.#setOverlayClippingOverride(true, containingBlock);
1033
+
955
1034
  if (!this.#shouldUseFixedSuggestionOverlay(container)) {
956
1035
  this.#positionSuggestionInline({
957
1036
  container,
@@ -969,6 +1048,7 @@ export class PdsOmnibox extends HTMLElement {
969
1048
  container,
970
1049
  suggestion,
971
1050
  rect,
1051
+ containingBlock,
972
1052
  viewportHeight,
973
1053
  viewportWidth,
974
1054
  direction,
@@ -1,7 +1,7 @@
1
- function m(o){return new DOMParser().parseFromString(o,"text/html").body.childNodes}function y(o,t=100){let e;return function(...i){let r=()=>{clearTimeout(e),o(...i)};clearTimeout(e),e=setTimeout(r,t)}}function p(o){setTimeout(o,0)}function b(o){try{if(typeof o!="string"||o.indexOf(`
2
- `)!==-1||o.indexOf(" ")!==-1||o.startsWith("#/"))return!1;let t=new URL(o,window.location.origin);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function x(o,t,e){let s=window.screen.width/2-t/2,i=window.screen.height/2-e/2;return window.open(o,"",`toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=${t}, height=${e}, top=${i}, left=${s}`)}var g={result:"ac-suggestion",item:"ac-itm"},f=class o extends EventTarget{constructor(t,e,s){super(),this.settings={emptyResultsText:"",...s},this.container=t,this.input=e,this.input.setAttribute("autocomplete","off"),this.categories=s.categories||{},this.caches=new Map,p(this.attach.bind(this))}static connect(t,e){let s=t.target;if(!s._autoComplete){if(!e?.categories)throw Error("Missing autocomplete settings");s._autoComplete=new o(s.parentNode,s,e),t.type==="focus"&&setTimeout(()=>{s._autoComplete.focusHandler(t)},100)}return s._autoComplete}on(t,e){return this.input.addEventListener(t,e),this}attach(){this.resultsDiv=document.createElement("div"),this.resultsDiv.title="",this.resultsDiv.classList.add(g.result),this.container.offsetWidth>100&&(this.resultsDiv.style.width=this.container.offsetWidth),this.resultsDiv.addEventListener("mousedown",this.resultClick.bind(this)),this.container.classList.add("ac-container"),this.input.classList.add("ac-input");let t=getComputedStyle(this.input);this.container.style.setProperty("--ac-bg-default",t.backgroundColor),this.container.style.setProperty("--ac-color-default",t.color);let e=getComputedStyle(this.input).accentColor;e!=="auto"&&this.container.style.setProperty("--ac-accent-color",e),(this.container?.shadowRoot??this.container).appendChild(this.resultsDiv),this.controller().clear("attach"),this.on("input",y(this.inputHandler.bind(this),this.settings.throttleInputMs??300)).on("focus",this.focusHandler.bind(this)).on("focusout",this.blurHandler.bind(this)).on("keyup",this.keyUpHandler.bind(this)).on("keydown",this.keyDownHandler.bind(this))}controller(){let t=this.internalController();return typeof this.settings.controller=="function"&&(t=this.settings.controller(this)??t),t}internalController(){return{show:this.show.bind(this),hide:this.hide.bind(this),clear:this.clear.bind(this),empty:()=>{}}}moveResult(t){this.controller().show();let e=this.acItems.length;this.rowIndex=this.rowIndex+t,this.rowIndex<=0?this.rowIndex=0:this.rowIndex>e-1&&(this.rowIndex=0);for(let i of this.acItems)i.classList.remove("selected");let s=this.getSelectedDiv();s?(s.classList.add("selected"),s.scrollIntoView({behavior:"smooth",block:"end",inline:"nearest"})):this.focusHandler({target:this.input})}getSelectedDiv(){return this.resultsDiv.querySelector(`div:nth-child(${this.rowIndex+1})`)}selectResult(t){if(t=t||this.getSelectedDiv(),t){let e=parseInt(t.getAttribute("data-index"));this.resultClicked=!0;let s=this.results[e],i=this.categories[s.category]??{};i.action=i.action??this.setText.bind(this),i.newTab&&(this.tabWindow=x("about:blank"));let r={...s,search:this.input.value};t.classList.add("ac-active"),setTimeout(()=>{this.controller().hide("result-selected"),r.action?r.action(r):(i.action(r),i.newTab&&(r.url?this.tabWindow.location.href=r.url:this.tabWindow.close()));var n=new Event("change",{bubbles:!0});this.input.dispatchEvent(n),this.controller().clear("result-selected");let u=new Event("result-selected");u.detail=r,this.input.dispatchEvent(u)},0)}}setText(t){let e=!1;this.input?(this.input.value=t.text,e=!0):this.container?.autoCompleteInput?(this.container.autoCompleteInput.value=t.text,e=!0):"value"in this.container&&(this.container.value=t.text,e=!0),e&&this.input&&this.input.dispatchEvent(new Event("input",{bubbles:!0})),this.controller().hide("settext")}resultClick(t){this.selectResult(t.target.closest(`.${g.item}`))}blurHandler(){setTimeout(()=>{this.resultClicked||this.controller().clear("blurred"),this.resultClicked=!1},100)}clear(){this.settings.debug||this.resultsDiv&&(this.resultsDiv.innerHTML="",this.controller().hide("clear"),this.cacheTmr&&clearTimeout(this.cacheTmr),this.cacheTmr=setTimeout(()=>{this.caches.clear()},60*1e3*5))}show(){if(!this.resultsDiv.classList.contains("ac-active")){let t=this.getViewBounds();this.resultsDiv.style.position="absolute",t.rect.width>100&&(this.resultsDiv.style.width=`${t.rect.width}px`),this.settings.direction=this.settings.direction??t.suggestedDirection,this.resultsDiv.setAttribute("data-direction",this.settings.direction),this.settings.direction==="up"?(this.resultsDiv.style.top="unset",this.resultsDiv.style.bottom=`${t.rect.height+20}px`,this.rowIndex=this.acItems.length):(this.resultsDiv.style.bottom="unset",this.resultsDiv.style.top=`${t.rect.height}px`,this.rowIndex=-1),this.resultsDiv.style.maxWidth="unset",this.resultsDiv.classList.toggle("ac-active",!0)}}getViewBounds(){let t=this.input.getBoundingClientRect();return{rect:t,suggestedDirection:t.top+t.height+500>window.innerHeight?"up":"down"}}hide(){this.resultsDiv.classList.toggle("ac-active",!1)}empty(){this.resultsDiv.innerHTML=`<div class="ac-empty">${this.settings.emptyResultsText}</div>`,this.controller().show()}inputHandler(t){this.cacheTmr&&clearTimeout(this.cacheTmr);let e={search:t.target.value,categories:this.categories};this.container.classList.add("search-running"),this.getItems(e,t).then(s=>{this.controller().clear("new-results"),this.resultsHandler(s,e),this.container.classList.remove("search-running")})}keyDownHandler(t){switch(t.key){case"Enter":t.stopPropagation(),t.preventDefault();break;case"ArrowDown":p(this.moveResult(1));break;case"ArrowUp":p(this.moveResult(-1));break}}keyUpHandler(t){switch(t.key){case"Escape":this.controller().hide("escape");break;case"Enter":this.getSelectedDiv()&&(this.container.preventEnter=!0,t.stopPropagation(),t.preventDefault(),this.selectResult(),setTimeout(()=>{this.container.preventEnter=!1},10));break;default:break}}focusHandler(t){this.controller().clear("focus");let e=t.target.value;this.suggest(e,t)}suggest(t,e){this.input.focus();let s={suggest:!0,search:t||"",categories:this.categories};this.getItems(s,e).then(i=>{this.input.dispatchEvent(new CustomEvent("show-results",{detail:{results:i}})),this.resultsHandler(i,s)})}sort(t,e){return t.sort((s,i)=>{let r=e.categories[s.category],n=e.categories[i.category],u=typeof r.sortIndex=="function"?r.sortIndex(e):r.sortIndex??0;return(typeof n.sortIndex=="function"?n.sortIndex(e):n.sortIndex??0)>u?1:-1})}resultsHandler(t,e){this.results=t,this.rowIndex=-1;let s=0,i=(r,n)=>`
3
- <div title="${n.tooltip||""}" data-index="${s}" class="${`${g.item} cat-${n.category} ${n.class??""}`.trim()}"${n.style?` style="${n.style}"`:""}>
1
+ function w(c){return new DOMParser().parseFromString(c,"text/html").body.childNodes}function v(c,t=100){let e;return function(...i){let r=()=>{clearTimeout(e),c(...i)};clearTimeout(e),e=setTimeout(r,t)}}function m(c){setTimeout(c,0)}function I(c){try{if(typeof c!="string"||c.indexOf(`
2
+ `)!==-1||c.indexOf(" ")!==-1||c.startsWith("#/"))return!1;let t=new URL(c,window.location.origin);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function A(c,t,e){let s=window.screen.width/2-t/2,i=window.screen.height/2-e/2;return window.open(c,"",`toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=${t}, height=${e}, top=${i}, left=${s}`)}var y={result:"ac-suggestion",item:"ac-itm"},p=class c extends EventTarget{constructor(t,e,s){super(),this.settings={emptyResultsText:"",...s},this.container=t,this.input=e,this.input.setAttribute("autocomplete","off"),this.categories=s.categories||{},this.caches=new Map,m(this.attach.bind(this))}static connect(t,e){let s=t.target;if(!s._autoComplete){if(!e?.categories)throw Error("Missing autocomplete settings");s._autoComplete=new c(s.parentNode,s,e),t.type==="focus"&&setTimeout(()=>{s._autoComplete.focusHandler(t)},100)}return s._autoComplete}on(t,e){return this.input.addEventListener(t,e),this}attach(){this.resultsDiv=document.createElement("div"),this.resultsDiv.title="",this.resultsDiv.classList.add(y.result),this.container.offsetWidth>100&&(this.resultsDiv.style.width=this.container.offsetWidth),this.resultsDiv.addEventListener("mousedown",this.resultClick.bind(this)),this.container.classList.add("ac-container"),this.input.classList.add("ac-input");let t=getComputedStyle(this.input);this.container.style.setProperty("--ac-bg-default",t.backgroundColor),this.container.style.setProperty("--ac-color-default",t.color);let e=getComputedStyle(this.input).accentColor;e!=="auto"&&this.container.style.setProperty("--ac-accent-color",e),(this.container?.shadowRoot??this.container).appendChild(this.resultsDiv),this.controller().clear("attach"),this.on("input",v(this.inputHandler.bind(this),this.settings.throttleInputMs??300)).on("focus",this.focusHandler.bind(this)).on("focusout",this.blurHandler.bind(this)).on("keyup",this.keyUpHandler.bind(this)).on("keydown",this.keyDownHandler.bind(this))}controller(){let t=this.internalController();return typeof this.settings.controller=="function"&&(t=this.settings.controller(this)??t),t}internalController(){return{show:this.show.bind(this),hide:this.hide.bind(this),clear:this.clear.bind(this),empty:()=>{}}}moveResult(t){this.controller().show();let e=this.acItems.length;this.rowIndex=this.rowIndex+t,this.rowIndex<=0?this.rowIndex=0:this.rowIndex>e-1&&(this.rowIndex=0);for(let i of this.acItems)i.classList.remove("selected");let s=this.getSelectedDiv();s?(s.classList.add("selected"),s.scrollIntoView({behavior:"smooth",block:"end",inline:"nearest"})):this.focusHandler({target:this.input})}getSelectedDiv(){return this.resultsDiv.querySelector(`div:nth-child(${this.rowIndex+1})`)}selectResult(t){if(t=t||this.getSelectedDiv(),t){let e=parseInt(t.getAttribute("data-index"));this.resultClicked=!0;let s=this.results[e],i=this.categories[s.category]??{};i.action=i.action??this.setText.bind(this),i.newTab&&(this.tabWindow=A("about:blank"));let r={...s,search:this.input.value};t.classList.add("ac-active"),setTimeout(()=>{this.controller().hide("result-selected"),r.action?r.action(r):(i.action(r),i.newTab&&(r.url?this.tabWindow.location.href=r.url:this.tabWindow.close()));var n=new Event("change",{bubbles:!0});this.input.dispatchEvent(n),this.controller().clear("result-selected");let u=new Event("result-selected");u.detail=r,this.input.dispatchEvent(u)},0)}}setText(t){let e=!1;this.input?(this.input.value=t.text,e=!0):this.container?.autoCompleteInput?(this.container.autoCompleteInput.value=t.text,e=!0):"value"in this.container&&(this.container.value=t.text,e=!0),e&&this.input&&this.input.dispatchEvent(new Event("input",{bubbles:!0})),this.controller().hide("settext")}resultClick(t){this.selectResult(t.target.closest(`.${y.item}`))}blurHandler(){setTimeout(()=>{this.resultClicked||this.controller().clear("blurred"),this.resultClicked=!1},100)}clear(){this.settings.debug||this.resultsDiv&&(this.resultsDiv.innerHTML="",this.controller().hide("clear"),this.cacheTmr&&clearTimeout(this.cacheTmr),this.cacheTmr=setTimeout(()=>{this.caches.clear()},60*1e3*5))}show(){if(!this.resultsDiv.classList.contains("ac-active")){let t=this.getViewBounds();this.resultsDiv.style.position="absolute",t.rect.width>100&&(this.resultsDiv.style.width=`${t.rect.width}px`),this.settings.direction=this.settings.direction??t.suggestedDirection,this.resultsDiv.setAttribute("data-direction",this.settings.direction),this.settings.direction==="up"?(this.resultsDiv.style.top="unset",this.resultsDiv.style.bottom=`${t.rect.height+20}px`,this.rowIndex=this.acItems.length):(this.resultsDiv.style.bottom="unset",this.resultsDiv.style.top=`${t.rect.height}px`,this.rowIndex=-1),this.resultsDiv.style.maxWidth="unset",this.resultsDiv.classList.toggle("ac-active",!0)}}getViewBounds(){let t=this.input.getBoundingClientRect();return{rect:t,suggestedDirection:t.top+t.height+500>window.innerHeight?"up":"down"}}hide(){this.resultsDiv.classList.toggle("ac-active",!1)}empty(){this.resultsDiv.innerHTML=`<div class="ac-empty">${this.settings.emptyResultsText}</div>`,this.controller().show()}inputHandler(t){this.cacheTmr&&clearTimeout(this.cacheTmr);let e={search:t.target.value,categories:this.categories};this.container.classList.add("search-running"),this.getItems(e,t).then(s=>{this.controller().clear("new-results"),this.resultsHandler(s,e),this.container.classList.remove("search-running")})}keyDownHandler(t){switch(t.key){case"Enter":t.stopPropagation(),t.preventDefault();break;case"ArrowDown":m(this.moveResult(1));break;case"ArrowUp":m(this.moveResult(-1));break}}keyUpHandler(t){switch(t.key){case"Escape":this.controller().hide("escape");break;case"Enter":this.getSelectedDiv()&&(this.container.preventEnter=!0,t.stopPropagation(),t.preventDefault(),this.selectResult(),setTimeout(()=>{this.container.preventEnter=!1},10));break;default:break}}focusHandler(t){this.controller().clear("focus");let e=t.target.value;this.suggest(e,t)}suggest(t,e){this.input.focus();let s={suggest:!0,search:t||"",categories:this.categories};this.getItems(s,e).then(i=>{this.input.dispatchEvent(new CustomEvent("show-results",{detail:{results:i}})),this.resultsHandler(i,s)})}sort(t,e){return t.sort((s,i)=>{let r=e.categories[s.category],n=e.categories[i.category],u=typeof r.sortIndex=="function"?r.sortIndex(e):r.sortIndex??0;return(typeof n.sortIndex=="function"?n.sortIndex(e):n.sortIndex??0)>u?1:-1})}resultsHandler(t,e){this.results=t,this.rowIndex=-1;let s=0,i=(r,n)=>`
3
+ <div title="${n.tooltip||""}" data-index="${s}" class="${`${y.item} cat-${n.category} ${n.class??""}`.trim()}"${n.style?` style="${n.style}"`:""}>
4
4
  ${this.handleImageOrIcon(n)}
5
5
  <span class="text">${this.formatResultItem(n,e,r)}</span>
6
6
  ${this.settings.hideCategory?"":`<span class="category">${n.category||""}</span>`}
7
- </div>`;t.forEach(r=>{let n=e.categories[r.category]||{};r.element?this.resultsDiv.appendChild(r.element):(r=typeof r=="string"?{text:r}:r,this.resultsDiv.appendChild(m(i(n,r))[0])),s++}),t.length?(this.acItems=this.resultsDiv.querySelectorAll(".ac-itm"),this.controller().show()):e.search.length&&this.controller().empty()}handleImageOrIcon(t){return t.image?`<img src="${t.image}"/>`:typeof this.settings.iconHandler=="function"?this.settings.iconHandler(t):`<svg-icon icon="${t.icon}"></svg-icon>`}formatResultItem(t,e,s){let i=typeof t=="string"?{text:t}:t,r=i.text;return e.search&&(r=r.replace("%search%",e.search),i.description=i.description?.replace("%search%",e.search)),r=this.highlight(r,e.search),i.description&&(r=`<div>${r}</div><small>${i.description}</small>`),s.format&&(r=s.format({item:i,result:r,options:e})),r}highlight(t,e){var s=new RegExp("("+e+")","gi");return t.replace(s,'<span class="txt-hl">$1</span>')}async getItems(t,e){this.aborter&&this.aborter.abort();let s=this.caches.get(t.search);if(s)return s;let i=this.settings.map,r=a=>(typeof a=="string"&&(a={text:a}),a),n=a=>i?a.map(h=>({text:h[i]})):a.map(h=>r(h)),u=a=>(this.settings.max&&this.settings.max>0&&(a.length=this.settings.max),a);return this.aborter=new AbortController,this.aborterSignal=this.aborter.signal,new Promise(a=>{let h=l=>{l=this.sort(l,t),this.settings.cache!==!1&&this.caches.set(t.search,l),a(l)};if(b(this.items)){if(this.settings.minlength>0&&(!t.search||t.search.length<this.settings.minlength)){h([]);return}let l=this.formatSearch(this.items,t);fetch(l).then(c=>{if(c.status===200){c.json().then(d=>{d=n(d),h(u(d.filter(w=>this.isMatch(t,w))))});return}throw Error(`HTTP error ${c.status} - ${l}`)})}else if(Array.isArray(this.items)){let l=!0;this.items=this.items.map(c=>typeof c=="string"?{text:c}:(l=!1,c)),l&&this.container.classList.add("simple"),h(u(n(this.items)))}else if(typeof this.items=="function")t.control=this.container,Promise.resolve(this.items(t,e)).then(c=>{c=c.map(d=>r(d)),c=n(c),h(c)});else return h(Promise.resolve(this.items.apply(this,t)))})}async items(t){let e=[];t.results=[],t.signal=this.aborterSignal;for(var s in t.categories){let i=t.categories[s];if(i.trigger=i.trigger??(()=>!0),t.results=e,i.trigger(t)){let r=[];try{r=await i.getItems(t)}catch(n){console.warn(`Error loading items for omniBox category '${s}'.`,n)}e=e.concat(r.map(n=>(n.category=s,n)))}}return e}formatSearch(t,e){return t.indexOf("%search%")?t.replace("%search%",e.search||""):t+"?"+this.createQueryParam(e)}createQueryParam(t){let e=t.suggest?"&suggest=true":"";return`q=${t.text}${e}`}isMatch(t,e){return e.text?.indexOf("%search%")>=0?!0:t.search?e.text?.toLowerCase().indexOf(t.search.toLowerCase())>=0:t.suggest}static textFilter(t,e){return function(s){if(!t.search)return!0;if(s.hidden)return!1;let r=(e?s[e]:s).match(new RegExp(t.search,"gi"));if(r)return r;if(s.config?.tags)return s.config.tags.some(n=>n.match(new RegExp(t.search,"gi")))}}};export{f as AutoComplete};
7
+ </div>`;t.forEach(r=>{let n=e.categories[r.category]||{};r.element?this.resultsDiv.appendChild(r.element):(r=typeof r=="string"?{text:r}:r,this.resultsDiv.appendChild(w(i(n,r))[0])),s++}),t.length?(this.acItems=this.resultsDiv.querySelectorAll(".ac-itm"),this.controller().show()):e.search.length&&this.controller().empty()}handleImageOrIcon(t){return t.image?`<img src="${t.image}"/>`:typeof this.settings.iconHandler=="function"?this.settings.iconHandler(t):`<svg-icon icon="${t.icon}"></svg-icon>`}formatResultItem(t,e,s){let i=typeof t=="string"?{text:t}:t,r=i.text;return e.search&&(r=r.replace("%search%",e.search),i.description=i.description?.replace("%search%",e.search)),r=this.highlight(r,e.search),i.description&&(r=`<div>${r}</div><small>${i.description}</small>`),s.format&&(r=s.format({item:i,result:r,options:e})),r}highlight(t,e){var s=new RegExp("("+e+")","gi");return t.replace(s,'<span class="txt-hl">$1</span>')}async getItems(t,e){this.aborter&&this.aborter.abort();let s=this.caches.get(t.search);if(s)return s;let i=this.settings.map,r=l=>(typeof l=="string"&&(l={text:l}),l),n=l=>i?l.map(h=>({text:h[i]})):l.map(h=>r(h)),u=l=>(this.settings.max&&this.settings.max>0&&(l.length=this.settings.max),l);return this.aborter=new AbortController,this.aborterSignal=this.aborter.signal,new Promise(l=>{let h=o=>{o=this.sort(o,t),this.settings.cache!==!1&&this.caches.set(t.search,o),l(o)};if(I(this.items)){if(this.settings.minlength>0&&(!t.search||t.search.length<this.settings.minlength)){h([]);return}let o=this.formatSearch(this.items,t);fetch(o).then(a=>{if(a.status===200){a.json().then(d=>{d=n(d),h(u(d.filter(g=>this.isMatch(t,g))))});return}throw Error(`HTTP error ${a.status} - ${o}`)})}else if(Array.isArray(this.items)){let o=!0;this.items=this.items.map(a=>typeof a=="string"?{text:a}:(o=!1,a)),o&&this.container.classList.add("simple"),h(u(n(this.items)))}else if(typeof this.items=="function")t.control=this.container,Promise.resolve(this.items(t,e)).then(a=>{a=a.map(d=>r(d)),a=n(a),h(a)});else return h(Promise.resolve(this.items.apply(this,t)))})}async items(t){let e=[];t.results=[],t.signal=this.aborterSignal;for(var s in t.categories){let i=t.categories[s];if(i.trigger=i.trigger??(()=>!0),t.results=e,i.trigger(t)){let r=[];try{r=await i.getItems(t)}catch(n){console.warn(`Error loading items for omniBox category '${s}'.`,n)}e=e.concat(r.map(n=>(n.category=s,n)))}}return e}formatSearch(t,e){return t.indexOf("%search%")?t.replace("%search%",e.search||""):t+"?"+this.createQueryParam(e)}createQueryParam(t){let e=t.suggest?"&suggest=true":"";return`q=${t.text}${e}`}isMatch(t,e){return e.text?.indexOf("%search%")>=0?!0:t.search?e.text?.toLowerCase().indexOf(t.search.toLowerCase())>=0:t.suggest}static textFilter(t,e){return function(s){if(!t.search)return!0;if(s.hidden)return!1;let r=(e?s[e]:s).match(new RegExp(t.search,"gi"));if(r)return r;if(s.config?.tags)return s.config.tags.some(n=>n.match(new RegExp(t.search,"gi")))}}};var b=p?.prototype?.selectResult;typeof b=="function"&&p?.prototype?.__pdsSelectedItemPatched!==!0&&(p.prototype.selectResult=function(t){let e=t||this.getSelectedDiv?.();if(!e)return b.call(this,t);let s=e.getAttribute?.("data-index")??"",i=Number.parseInt(s,10),r=Number.isInteger(i)?this.results?.[i]:null,n=r&&this.categories?this.categories[r.category]:null,u=[],l=(o,a)=>{if(!o||typeof o[a]!="function")return;let d=o[a],g=!1,x=()=>{g||(o[a]=d,g=!0)};o[a]=function(f={},...C){try{return f&&typeof f=="object"&&!("selectedItem"in f)&&(f.selectedItem=e),d.call(this,f,...C)}finally{x()}},u.push(x)};l(r,"action"),l(n,"action");let h=b.call(this,e);return setTimeout(()=>{for(let o of u)o()},1e3),h},p.prototype.__pdsSelectedItemPatched=!0);export{p as AutoComplete};
package/src/js/pds.js CHANGED
@@ -677,7 +677,7 @@ PDS.loadAutoComplete = async () => {
677
677
  );
678
678
 
679
679
  if (!__autoCompletePromise) {
680
- __autoCompletePromise = import(autoCompleteModuleURL)
680
+ __autoCompletePromise = import(/* @vite-ignore */ autoCompleteModuleURL)
681
681
  .then((mod) => {
682
682
  const autoCompleteCtor =
683
683
  mod?.AutoComplete ||
@@ -978,7 +978,7 @@ async function start(config) {
978
978
  rest?.manager?.url ||
979
979
  new URL("core/pds-manager.js", assetRootURL).href ||
980
980
  new URL("./pds-manager.js", import.meta.url).href;
981
- const { startLive } = await import(managerUrl);
981
+ const { startLive } = await import(/* @vite-ignore */ managerUrl);
982
982
  startResult = await startLive(PDS, rest, {
983
983
  emitReady: __emitPDSReady,
984
984
  emitConfigChanged: __emitPDSConfigChanged,