@pure-ds/core 0.7.15 → 0.7.18

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.
Files changed (33) hide show
  1. package/.cursorrules +22 -11
  2. package/.github/copilot-instructions.md +22 -11
  3. package/custom-elements.json +38 -0
  4. package/dist/types/pds.d.ts +0 -1
  5. package/dist/types/public/assets/js/pds-manager.d.ts +44 -44
  6. package/dist/types/public/assets/js/pds-manager.d.ts.map +1 -1
  7. package/dist/types/public/assets/pds/components/pds-form.d.ts.map +1 -1
  8. package/dist/types/public/assets/pds/components/pds-omnibox.d.ts.map +1 -1
  9. package/dist/types/public/assets/pds/components/pds-treeview.d.ts +9 -0
  10. package/dist/types/public/assets/pds/components/pds-treeview.d.ts.map +1 -1
  11. package/dist/types/src/js/pds-core/pds-live.d.ts.map +1 -1
  12. package/dist/types/src/js/pds-core/pds-runtime.d.ts.map +1 -1
  13. package/package.json +1 -1
  14. package/packages/pds-cli/bin/pds-mcp-health.js +2 -1
  15. package/packages/pds-cli/bin/pds-mcp-server.js +10 -0
  16. package/packages/pds-cli/lib/pds-mcp-core.js +95 -3
  17. package/packages/pds-cli/lib/pds-mcp-eval-cases.json +13 -0
  18. package/public/assets/js/app.js +4 -4
  19. package/public/assets/js/pds-manager.js +144 -162
  20. package/public/assets/js/pds.js +2 -2
  21. package/public/assets/pds/components/pds-calendar.js +19 -11
  22. package/public/assets/pds/components/pds-form.js +85 -2
  23. package/public/assets/pds/components/pds-omnibox.js +9 -6
  24. package/public/assets/pds/components/pds-treeview.js +321 -24
  25. package/public/assets/pds/core/pds-manager.js +144 -162
  26. package/public/assets/pds/core.js +2 -2
  27. package/public/assets/pds/vscode-custom-data.json +4 -0
  28. package/readme.md +12 -59
  29. package/src/js/pds-core/pds-generator.js +7 -7
  30. package/src/js/pds-core/pds-live.js +1 -13
  31. package/src/js/pds-core/pds-ontology.js +2 -2
  32. package/src/js/pds-core/pds-runtime.js +18 -2
  33. package/src/js/pds.d.ts +0 -1
@@ -101,6 +101,17 @@ function getToolSchema() {
101
101
  },
102
102
  },
103
103
  },
104
+ {
105
+ name: 'query_design_system',
106
+ description: 'Run natural-language PDS design system search against SSoT-backed data.',
107
+ inputSchema: {
108
+ type: 'object',
109
+ required: ['question'],
110
+ properties: {
111
+ question: { type: 'string', description: 'Natural language question, e.g. "focus border color on inputs".' },
112
+ },
113
+ },
114
+ },
104
115
  {
105
116
  name: 'get_component_api',
106
117
  description: 'Lookup PDS custom element API from custom-elements.json.',
@@ -170,6 +181,7 @@ export function createPdsMcpContext({ projectRoot = process.cwd() } = {}) {
170
181
  cssData: path.join(ssoTRoot, 'public', 'assets', 'pds', 'pds.css-data.json'),
171
182
  customElements: path.join(ssoTRoot, 'custom-elements.json'),
172
183
  ontology: path.join(ssoTRoot, 'src', 'js', 'pds-core', 'pds-ontology.js'),
184
+ queryEngine: path.join(ssoTRoot, 'src', 'js', 'pds-core', 'pds-query.js'),
173
185
  enhancersMeta: path.join(ssoTRoot, 'src', 'js', 'pds-core', 'pds-enhancers-meta.js'),
174
186
  config: path.join(ssoTRoot, 'src', 'js', 'pds-core', 'pds-config.js'),
175
187
  },
@@ -215,6 +227,50 @@ async function getConfigRelations(ctx) {
215
227
  return ctx.cache.get('configRelations');
216
228
  }
217
229
 
230
+ async function getQueryEngineClass(ctx) {
231
+ if (!ctx.cache.has('queryEngineClass')) {
232
+ const mod = await importModule(ctx.files.queryEngine);
233
+ const queryEngineClass = mod?.PDSQuery || mod?.default || null;
234
+ ctx.cache.set('queryEngineClass', queryEngineClass);
235
+ }
236
+ return ctx.cache.get('queryEngineClass');
237
+ }
238
+
239
+ function getPropertyValue(property) {
240
+ return decodeDataTextUrl(property?.references?.find((r) => r.name === 'Value')?.url);
241
+ }
242
+
243
+ function buildCompiledFromCssData(cssData) {
244
+ const compiled = {
245
+ tokens: {
246
+ colors: {},
247
+ spacing: {},
248
+ typography: {},
249
+ },
250
+ };
251
+
252
+ for (const property of cssData.properties || []) {
253
+ const name = String(property?.name || '');
254
+ const value = getPropertyValue(property);
255
+ if (!name) continue;
256
+
257
+ if (name.startsWith('--color-')) {
258
+ compiled.tokens.colors[name] = value;
259
+ }
260
+
261
+ if (name.startsWith('--spacing-')) {
262
+ const key = name.replace('--spacing-', '').trim();
263
+ if (key) compiled.tokens.spacing[key] = value || '';
264
+ }
265
+
266
+ if (name.startsWith('--font-')) {
267
+ compiled.tokens.typography[name] = value;
268
+ }
269
+ }
270
+
271
+ return compiled;
272
+ }
273
+
218
274
  function shapeComponentDeclaration(declaration) {
219
275
  const pick = (items = [], mapper) => items.map(mapper).slice(0, 80);
220
276
  return {
@@ -260,9 +316,7 @@ async function handleGetTokens(ctx, args = {}) {
260
316
  })
261
317
  .slice(0, limit)
262
318
  .map((property) => {
263
- const value = includeValues
264
- ? decodeDataTextUrl(property?.references?.find((r) => r.name === 'Value')?.url)
265
- : null;
319
+ const value = includeValues ? getPropertyValue(property) : null;
266
320
  return {
267
321
  name: property.name,
268
322
  description: property.description || '',
@@ -321,6 +375,43 @@ async function handleFindUtilityClass(ctx, args = {}) {
321
375
  };
322
376
  }
323
377
 
378
+ async function handleQueryDesignSystem(ctx, args = {}) {
379
+ const question = String(args.question || '').trim();
380
+ if (!question) {
381
+ throw new Error('The "question" argument is required.');
382
+ }
383
+
384
+ const [PDSQuery, ontology, cssData] = await Promise.all([
385
+ getQueryEngineClass(ctx),
386
+ getOntology(ctx),
387
+ getCssData(ctx),
388
+ ]);
389
+
390
+ if (!PDSQuery) {
391
+ throw new Error('Unable to load PDS query engine.');
392
+ }
393
+
394
+ const pseudoPds = {
395
+ ontology,
396
+ compiled: buildCompiledFromCssData(cssData),
397
+ };
398
+
399
+ const engine = new PDSQuery(pseudoPds);
400
+ const results = await engine.search(question);
401
+
402
+ return {
403
+ ssoTRoot: normalizePath(ctx.ssoTRoot),
404
+ source: {
405
+ ontology: normalizePath(path.relative(ctx.ssoTRoot, ctx.files.ontology)),
406
+ cssData: normalizePath(path.relative(ctx.ssoTRoot, ctx.files.cssData)),
407
+ queryEngine: normalizePath(path.relative(ctx.ssoTRoot, ctx.files.queryEngine)),
408
+ },
409
+ question,
410
+ totalMatches: results.length,
411
+ results,
412
+ };
413
+ }
414
+
324
415
  async function handleGetComponentApi(ctx, args = {}) {
325
416
  const { tagName = '', contains = '' } = args;
326
417
  const limit = Math.min(Math.max(Number(args.limit || 10), 1), 50);
@@ -478,6 +569,7 @@ async function handleValidateSnippet(ctx, args = {}) {
478
569
  const TOOL_HANDLERS = {
479
570
  get_tokens: handleGetTokens,
480
571
  find_utility_class: handleFindUtilityClass,
572
+ query_design_system: handleQueryDesignSystem,
481
573
  get_component_api: handleGetComponentApi,
482
574
  get_enhancer_metadata: handleGetEnhancerMetadata,
483
575
  get_config_relations: handleGetConfigRelations,
@@ -27,6 +27,19 @@
27
27
  ]
28
28
  }
29
29
  },
30
+ {
31
+ "id": "query-focus-input",
32
+ "tool": "query_design_system",
33
+ "args": {
34
+ "question": "what is the focus border color on inputs?"
35
+ },
36
+ "expect": {
37
+ "paths": [
38
+ "results",
39
+ "results.0.value"
40
+ ]
41
+ }
42
+ },
30
43
  {
31
44
  "id": "component-form",
32
45
  "tool": "get_component_api",
@@ -1,12 +1,12 @@
1
- var Pe=Object.defineProperty;var Me=(e,t)=>{for(var s in t)Pe(e,s,{get:t[s],enumerable:!0})};var X=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(s){console.error(`[PDS Registry] Failed to load static ${t}:`,s),console.error(`[PDS Registry] Looking for: ${this._staticPaths[t]}`),console.error("[PDS Registry] Make sure you've run 'npm run pds:build' and configured PDS.start() with the correct static.root path");let n=new CSSStyleSheet;return n.replaceSync("/* Failed to load "+t+" */"),n}}get mode(){return this._mode}get isLive(){return this._mode==="live"}},P=new X;async function pe(e,t=[],s=null){try{let n=s?.primitivesStylesheet?s.primitivesStylesheet:await P.getStylesheet("primitives");e.adoptedStyleSheets=[n,...t]}catch(n){let c=e.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${c}> failed to adopt primitives:`,n),e.adoptedStyleSheets=t}}async function ue(e,t=["primitives"],s=[],n=null){try{let r=(await Promise.all(t.map(async d=>{if(n)switch(d){case"tokens":return n.tokensStylesheet;case"primitives":return n.primitivesStylesheet;case"components":return n.componentsStylesheet;case"utilities":return n.utilitiesStylesheet;default:break}return P.getStylesheet(d)}))).filter(d=>d!==null);e.adoptedStyleSheets=[...r,...s]}catch(c){let r=e.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${r}> failed to adopt layers:`,c),e.adoptedStyleSheets=s}}function me(e){let t=new CSSStyleSheet;return t.replaceSync(e),t}var fe={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 Z={};Me(Z,{deepMerge:()=>he,fragmentFromTemplateLike:()=>Te,isObject:()=>O,parseHTML:()=>Y});function O(e){return e&&typeof e=="object"&&!Array.isArray(e)}function he(e,t){let s={...e};return O(e)&&O(t)&&Object.keys(t).forEach(n=>{O(t[n])?n in e?s[n]=he(e[n],t[n]):Object.assign(s,{[n]:t[n]}):Object.assign(s,{[n]:t[n]})}),s}function Te(e){let t=Array.isArray(e?.strings)?e.strings:[],s=Array.isArray(e?.values)?e.values:[],n=new Set,c=[],r=/(\s)(\.[\w-]+)=\s*$/;for(let i=0;i<t.length;i+=1){let b=t[i]??"",f=b.match(r);if(f&&i<s.length){let g=f[2].slice(1),v=`pds-val-${i}`;b=b.replace(r,`$1data-pds-prop="${g}:${v}"`),n.add(i)}c.push(b),i<s.length&&!n.has(i)&&c.push(`<!--pds-val-${i}-->`)}let d=document.createElement("template");d.innerHTML=c.join("");let w=(i,b)=>{let f=i.parentNode;if(!f)return;if(b==null){f.removeChild(i);return}let S=g=>{if(g!=null){if(g instanceof Node){f.insertBefore(g,i);return}if(Array.isArray(g)){g.forEach(v=>S(v));return}f.insertBefore(document.createTextNode(String(g)),i)}};S(b),f.removeChild(i)},E=document.createTreeWalker(d.content,NodeFilter.SHOW_COMMENT),h=[];for(;E.nextNode();){let i=E.currentNode;i?.nodeValue?.startsWith("pds-val-")&&h.push(i)}return h.forEach(i=>{let b=Number(i.nodeValue.replace("pds-val-",""));w(i,s[b])}),d.content.querySelectorAll("*").forEach(i=>{let b=i.getAttribute("data-pds-prop");if(!b)return;let[f,S]=b.split(":"),g=Number(String(S).replace("pds-val-",""));f&&Number.isInteger(g)&&(i[f]=s[g]),i.removeAttribute("data-pds-prop")}),d.content}function Y(e){return new DOMParser().parseFromString(e,"text/html").body.childNodes}var be="pds",Ue=/^([a-z][a-z0-9+\-.]*:)?\/\//i,ye=/^[a-z]:/i;function U(e=""){return e.endsWith("/")?e:`${e}/`}function Ce(e="",t=be){let s=e.replace(/\/+$/,"");return new RegExp(`(?:^|/)${t}$`,"i").test(s)?s:`${s}/${t}`}function $e(e){return e.replace(/^\.\/+/,"")}function Ie(e){return ye.test(e)?e.replace(ye,"").replace(/^\/+/,""):e}function Ne(e){return e.startsWith("public/")?e.substring(7):e}function z(e,t={}){let s=t.segment||be,n=t.defaultRoot||`/assets/${s}/`,c=e?.public&&e.public?.root||e?.static&&e.static?.root||null;if(!c||typeof c!="string")return U(n);let r=c.trim();return r?(r=r.replace(/\\/g,"/"),r=Ce(r,s),r=U(r),Ue.test(r)?r:(r=$e(r),r=Ie(r),r.startsWith("/")||(r=Ne(r),r.startsWith("/")||(r=`/${r}`),r=r.replace(/\/+/g,(d,w)=>w===0?d:"/")),U(r))):U(n)}async function Oe(...e){let t={};e.length&&typeof e[e.length-1]=="object"&&(t=e.pop()||{});let s=e,{baseURL:n,mapper:c=h=>`${h}.js`,onError:r=(h,a)=>console.error(`[defineWebComponents] ${h}:`,a)}=t,d=n?new URL(n,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),w=h=>h.toLowerCase().replace(/(^|-)([a-z])/g,(a,i,b)=>b.toUpperCase()),E=async h=>{try{if(customElements.get(h))return{tag:h,status:"already-defined"};let a=c(h),b=await import(a instanceof URL?a.href:new URL(a,d).href),f=b?.default??b?.[w(h)];if(!f){if(customElements.get(h))return{tag:h,status:"self-defined"};throw new Error(`No export found for ${h}. Expected default export or named export "${w(h)}".`)}return customElements.get(h)?{tag:h,status:"race-already-defined"}:(customElements.define(h,f),{tag:h,status:"defined"})}catch(a){throw r(h,a),a}};return Promise.all(s.map(E))}var F=class{constructor(t={}){let{baseURL:s,mapper:n,onError:c,predicate:r=()=>!0,attributeModule:d="data-module",root:w=document,scanExisting:E=!0,debounceMs:h=16,observeShadows:a=!0,enhancers:i=[],patchAttachShadow:b=!0}=t,f=new Set,S=new Set,g=new Set,v=new Map,j=new WeakMap,_=new WeakMap,u=0,y=!1,k=null,N=l=>{if(!l||!i.length)return;let m=_.get(l);m||(m=new Set,_.set(l,m));for(let p of i)if(!(!p.selector||!p.run)&&!m.has(p.selector))try{l.matches&&l.matches(p.selector)&&(p.run(l),m.add(p.selector))}catch(L){console.warn(`[AutoDefiner] Error applying enhancer for selector "${p.selector}":`,L)}},T=(l,m)=>{if(!y&&!(!l||!l.includes("-"))&&!customElements.get(l)&&!S.has(l)&&!g.has(l)){if(m&&m.getAttribute){let p=m.getAttribute(d);p&&!v.has(l)&&v.set(l,p)}f.add(l),De()}},De=()=>{u||(u=setTimeout(ce,h))},R=l=>{if(l){if(l.nodeType===1){let m=l,p=m.tagName?.toLowerCase();p&&p.includes("-")&&!customElements.get(p)&&r(p,m)&&T(p,m),N(m),a&&m.shadowRoot&&J(m.shadowRoot)}l.querySelectorAll&&l.querySelectorAll("*").forEach(m=>{let p=m.tagName?.toLowerCase();p&&p.includes("-")&&!customElements.get(p)&&r(p,m)&&T(p,m),N(m),a&&m.shadowRoot&&J(m.shadowRoot)})}},J=l=>{if(!l||j.has(l))return;R(l);let m=new MutationObserver(p=>{for(let L of p)L.addedNodes?.forEach(D=>{R(D)}),L.type==="attributes"&&L.target&&R(L.target)});m.observe(l,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[d,...i.map(p=>p.selector).filter(p=>p.startsWith("data-"))]}),j.set(l,m)};async function ce(){if(clearTimeout(u),u=0,!f.size)return;let l=Array.from(f);f.clear(),l.forEach(m=>S.add(m));try{let m=p=>v.get(p)??(n?n(p):`${p}.js`);await Oe(...l,{baseURL:s,mapper:m,onError:(p,L)=>{g.add(p),c?.(p,L)}})}catch{}finally{l.forEach(m=>S.delete(m))}}let de=w===document?document.documentElement:w,le=new MutationObserver(l=>{for(let m of l)m.addedNodes?.forEach(p=>{R(p)}),m.type==="attributes"&&m.target&&R(m.target)});if(le.observe(de,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[d,...i.map(l=>l.selector).filter(l=>l.startsWith("data-"))]}),a&&b&&Element.prototype.attachShadow){let l=Element.prototype.attachShadow;Element.prototype.attachShadow=function(p){let L=l.call(this,p);if(p&&p.mode==="open"){J(L);let D=this.tagName?.toLowerCase();D&&D.includes("-")&&!customElements.get(D)&&T(D,this)}return L},k=()=>Element.prototype.attachShadow=l}return E&&R(de),{stop(){y=!0,le.disconnect(),k&&k(),u&&(clearTimeout(u),u=0),j.forEach(l=>l.disconnect())},flush:ce}}static async define(...t){let s={};t.length&&typeof t[t.length-1]=="object"&&(s=t.pop()||{});let n=t,{baseURL:c,mapper:r=a=>`${a}.js`,onError:d=(a,i)=>console.error(`[defineWebComponents] ${a}:`,i)}=s,w=c?new URL(c,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),E=a=>a.toLowerCase().replace(/(^|-)([a-z])/g,(i,b,f)=>f.toUpperCase()),h=async a=>{try{if(customElements.get(a))return{tag:a,status:"already-defined"};let i=r(a),f=await import(i instanceof URL?i.href:new URL(i,w).href),S=f?.default??f?.[E(a)];if(!S){if(customElements.get(a))return{tag:a,status:"self-defined"};throw new Error(`No export found for ${a}. Expected default export or named export "${E(a)}".`)}return customElements.get(a)?{tag:a,status:"race-already-defined"}:(customElements.define(a,S),{tag:a,status:"defined"})}catch(i){throw d(a,i),i}};return Promise.all(n.map(h))}};var ze=/^[a-z][a-z0-9+\-.]*:\/\//i,C=(()=>{try{return import.meta.url}catch{return}})(),W=e=>typeof e=="string"&&e.length&&!e.endsWith("/")?`${e}/`:e;function B(e,t={}){if(!e||ze.test(e))return e;let{preferModule:s=!0}=t,n=()=>{if(!C)return null;try{return new URL(e,C).href}catch{return null}},c=()=>{if(typeof window>"u"||!window.location?.origin)return null;try{return new URL(e,window.location.origin).href}catch{return null}};return(s?n()||c():c()||n())||e}var ge=(()=>{if(C)try{let e=new URL(C);if(/\/public\/assets\/js\//.test(e.pathname))return new URL("../pds/",C).href}catch{return}})(),we=!1;function Se(e){we||typeof document>"u"||(we=!0,e.addEventListener("pds:ready",t=>{let s=t.detail?.mode;s&&document.documentElement.classList.add(`pds-${s}`,"pds-ready")}))}function Ee({manageTheme:e,themeStorageKey:t,applyResolvedTheme:s,setupSystemListenerIfNeeded:n}){let c="light",r=null;if(e&&typeof window<"u"){try{r=localStorage.getItem(t)||null}catch{r=null}try{s?.(r),n?.(r)}catch{}r?r==="system"?c=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":c=r:c=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return{resolvedTheme:c,storedTheme:r}}function q(e,{resolvePublicAssetURL:t}){let s=!!(e?.public?.root||e?.static?.root),n=t(e);return!s&&ge&&(n=ge),W(B(n))}async function ve(e,{baseEnhancers:t=[]}={}){let{autoDefineBaseURL:s="/auto-define/",autoDefinePreload:n=[],autoDefineMapper:c=null,enhancers:r=[],autoDefineOverrides:d=null,autoDefinePreferModule:w=!0}=e,E=(()=>{let a=new Map;return(t||[]).forEach(i=>a.set(i.selector,i)),(r||[]).forEach(i=>a.set(i.selector,i)),Array.from(a.values())})(),h=null;if(typeof window<"u"&&typeof document<"u"){let a=F,i=u=>{switch(u){case"pds-tabpanel":return"pds-tabstrip.js";default:return`${u}.js`}},{mapper:b,enhancers:f,...S}=d&&typeof d=="object"?d:{},g=f?Array.isArray(f)?f:typeof f=="object"?Object.values(f):[]:[],v=(()=>{let u=new Map;return(E||[]).forEach(y=>{y?.selector&&u.set(y.selector,y)}),(g||[]).forEach(y=>{if(!y?.selector)return;let k=u.get(y.selector)||null;u.set(y.selector,{...k||{},...y,run:typeof y?.run=="function"?y.run:k?.run})}),Array.from(u.values())})(),_={baseURL:s&&W(B(s,{preferModule:w})),predefine:n,scanExisting:!0,observeShadows:!0,patchAttachShadow:!0,debounceMs:16,enhancers:v,onError:(u,y)=>{if(typeof u=="string"&&u.startsWith("pds-")){let N=["pds-form","pds-drawer"].includes(u),T=y?.message?.includes("#pds/lit")||y?.message?.includes("Failed to resolve module specifier");N&&T?console.error(`\u274C PDS component <${u}> 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`):console.warn(`\u26A0\uFE0F PDS component <${u}> not found. Assets may not be installed.`)}else console.error(`\u274C Auto-define error for <${u}>:`,y)},...S,mapper:u=>{if(customElements.get(u))return null;if(typeof c=="function")try{let y=c(u);return y===void 0?i(u):y}catch(y){return console.warn("Custom autoDefine.mapper error; falling back to default:",y?.message||y),i(u)}return i(u)}};h=new a(_),n.length>0&&typeof a.define=="function"&&await a.define(...n,{baseURL:s,mapper:_.mapper,onError:_.onError})}return{autoDefiner:h,mergedEnhancers:E}}var ee=["light","dark"],te=new Set(ee);function Fe(e){let s=(Array.isArray(e?.themes)?e.themes.map(n=>String(n).toLowerCase()):ee).filter(n=>te.has(n));return s.length?s:ee}function se(e,{preferDocument:t=!0}={}){let s=String(e||"").toLowerCase();if(te.has(s))return s;if(t&&typeof document<"u"){let n=document.documentElement?.getAttribute("data-theme");if(te.has(n))return n}return typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Le(e,t){let s=se(t);return Fe(e).includes(s)}var re=class extends EventTarget{},o=new re;o.initializing=!1;o.currentPreset=null;o.debug=!1;var H=null,V=null,K=null,G=null;function Q(e,t){return t&&typeof t=="string"?t:`${q(o.currentConfig||{},{resolvePublicAssetURL:z})}core/${e}`}async function We(){return Array.isArray(o.defaultEnhancers)&&o.defaultEnhancers.length>0?o.defaultEnhancers:(G||(G=import(Q("pds-enhancers.js",o.currentConfig?.enhancersURL)).then(t=>{let s=Array.isArray(t?.defaultPDSEnhancers)?t.defaultPDSEnhancers:[];return o.defaultEnhancers=s,s}).catch(t=>{throw G=null,t})),G)}async function Be(){return typeof o.ask=="function"&&o.ask!==Ae?o.ask:(V||(V=import(Q("pds-ask.js",o.currentConfig?.askURL)).then(t=>{let s=t?.ask;if(typeof s!="function")throw new Error("Failed to load ask helper");return o.ask=s,s}).catch(t=>{throw V=null,t})),V)}async function I(){return typeof o.toast=="function"&&o.toast!==M?o.toast:(K||(K=import(Q("pds-toast.js",o.currentConfig?.toastURL)).then(t=>{let s=t?.toast;if(typeof s!="function")throw new Error("Failed to load toast helper");return o.toast=s,s}).catch(t=>{throw K=null,t})),K)}async function Ae(...e){return(await Be())(...e)}async function M(...e){return(await I())(...e)}M.success=async(...e)=>(await I()).success(...e);M.error=async(...e)=>(await I()).error(...e);M.warning=async(...e)=>(await I()).warning(...e);M.info=async(...e)=>(await I()).info(...e);var ke=function(e="log",t,...s){let n=!!(o.registry&&!o.registry.isLive),c=(this?.debug||this?.design?.debug||o.debug||!1)===!0;if(n){if(!o.debug)return}else if(!c&&e!=="error"&&e!=="warn")return;let r=console[e]||console.log;s.length>0?r(t,...s):r(t)};function oe(e){if(e==null)return e;if(typeof e=="function")return;if(typeof e!="object")return e;if(Array.isArray(e))return e.map(s=>oe(s)).filter(s=>s!==void 0);let t={};for(let[s,n]of Object.entries(e)){let c=oe(n);c!==void 0&&(t[s]=c)}return t}async function qe(e,t={}){if(t?.runtimeConfig===!1||typeof fetch!="function")return null;let s=t?.runtimeConfigURL||`${e}pds-runtime-config.json`;try{let n=await fetch(s,{cache:"no-store"});return n.ok?await n.json():null}catch{return null}}o.registry=P;o.enums=fe;o.adoptLayers=ue;o.adoptPrimitives=pe;o.parse=Y;o.createStylesheet=me;o.isLiveMode=()=>P.isLive;o.ask=Ae;o.toast=M;o.common=Z;o.AutoComplete=null;o.loadAutoComplete=async()=>{if(o.AutoComplete&&typeof o.AutoComplete.connect=="function")return o.AutoComplete;let e=Q("pds-autocomplete.js",o.currentConfig?.autoCompleteURL);return H||(H=import(e).then(t=>{let s=t?.AutoComplete||t?.default?.AutoComplete||t?.default||null;if(!s)throw new Error("AutoComplete export not found in module");return o.AutoComplete=s,s}).catch(t=>{throw H=null,t})),H};function _e(e){let t=typeof CustomEvent=="function";try{let s=t?new CustomEvent("pds:ready",{detail:e}):new Event("pds:ready");o.dispatchEvent(s)}catch{}if(typeof document<"u")if(t){let s={detail:e,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:ready",s))}catch{}try{document.dispatchEvent(new CustomEvent("pds-ready",s))}catch{}}else{try{document.dispatchEvent(new Event("pds:ready"))}catch{}try{document.dispatchEvent(new Event("pds-ready"))}catch{}}}function je(e={}){let t=typeof CustomEvent=="function",s={at:Date.now(),...e};try{let n=t?new CustomEvent("pds:config-changed",{detail:s}):new Event("pds:config-changed");o.dispatchEvent(n)}catch{}if(typeof document<"u")if(t){let n={detail:s,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:config-changed",n))}catch{}}else try{document.dispatchEvent(new Event("pds:config-changed"))}catch{}}var ne="pure-ds-theme",x=null,$=null;function ie(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 ae(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)"),s=n=>{let c=n?.matches===void 0?t.matches:n.matches;try{let r=c?"dark":"light";document.documentElement.setAttribute("data-theme",r),o.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:r,source:"system"}}))}catch{}};x=t,$=s,typeof t.addEventListener=="function"?t.addEventListener("change",s):typeof t.addListener=="function"&&t.addListener(s)}}catch{}}Object.defineProperty(o,"theme",{get(){try{return typeof window>"u"?null:localStorage.getItem(ne)||null}catch{return null}},set(e){try{if(typeof window>"u")return;let t=o.currentConfig?.design||null,s=se(e);if(t&&!Le(t,s)){let n=t?.name||o.currentPreset?.name||o.currentConfig?.preset||"current preset";console.warn(`PDS theme "${s}" not supported by preset "${n}".`),o.dispatchEvent(new CustomEvent("pds:theme:blocked",{detail:{theme:e,resolvedTheme:s,preset:n}}));return}e==null?localStorage.removeItem(ne):localStorage.setItem(ne,e),ie(e),ae(e),o.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:e,source:"api"}}))}catch{}}});o.defaultEnhancers=[];async function He(e){let t=e&&e.mode||"live",{mode:s,...n}=e||{};if(t==="static")return Ve(n);let c=q(n,{resolvePublicAssetURL:z}),r=n?.managerURL||n?.public?.managerURL||n?.manager?.url||new URL("core/pds-manager.js",c).href||new URL("./pds-manager.js",import.meta.url).href,{startLive:d}=await import(r);return d(o,n,{emitReady:_e,emitConfigChanged:je,applyResolvedTheme:ie,setupSystemListenerIfNeeded:ae})}o.start=He;async function Ve(e){if(!e||typeof e!="object")throw new Error("PDS.start({ mode: 'static', ... }) requires a valid configuration object");let t=e.applyGlobalStyles??!0,s=e.manageTheme??!0,n=e.themeStorageKey??"pure-ds-theme",c=e.staticPaths??{},r=q(e,{resolvePublicAssetURL:z}),d=e&&e.autoDefine||null,w;d&&d.baseURL?w=W(B(d.baseURL,{preferModule:!1})):w=`${r}components/`;let E=d&&Array.isArray(d.predefine)&&d.predefine||[],h=d&&typeof d.mapper=="function"&&d.mapper||null;try{Se(o);let{resolvedTheme:a}=Ee({manageTheme:s,themeStorageKey:n,applyResolvedTheme:ie,setupSystemListenerIfNeeded:ae}),i=await qe(r,e),b=Array.isArray(e?.enhancers)?e.enhancers:e?.enhancers&&typeof e.enhancers=="object"?Object.values(e.enhancers):[],f=i?.config?{...i.config,...e,design:e?.design||i.config.design,preset:e?.preset||i.config.preset}:{...e},S={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`},g=i?.paths||{};if(c={...S,...g,...c},o.registry.setStaticMode(c),t&&typeof document<"u")try{let u=await o.registry.getStylesheet("styles");if(u){u._pds=!0;let y=(document.adoptedStyleSheets||[]).filter(k=>k._pds!==!0);document.adoptedStyleSheets=[...y,u],je({mode:"static",source:"static:styles-applied"})}}catch(u){ke.call(o,"warn","Failed to apply static styles:",u)}let v=null,j=[];try{let u=await We(),y=await ve({autoDefineBaseURL:w,autoDefinePreload:E,autoDefineMapper:h,enhancers:b,autoDefineOverrides:d||null,autoDefinePreferModule:!(d&&d.baseURL)},{baseEnhancers:u});v=y.autoDefiner,j=y.mergedEnhancers||[]}catch(u){ke.call(o,"error","\u274C Failed to initialize AutoDefiner/Enhancers (static):",u)}let _=oe(e);return o.currentConfig=Object.freeze({mode:"static",...structuredClone(_),design:structuredClone(f.design||{}),preset:f.preset,theme:a,enhancers:j}),_e({mode:"static",config:f,theme:a,autoDefiner:v}),{config:f,theme:a,autoDefiner:v}}catch(a){throw o.dispatchEvent(new CustomEvent("pds:error",{detail:{error:a}})),a}}var xe={mode:"live",liveEdit:!0,preset:"default",autoDefine:{predefine:["pds-icon","pds-drawer","pds-toaster","pds-form"]},log(e,t,...s){console[e](t,...s)}};var A={name:"@pure-ds/core",shortname:"pds",version:"0.7.15",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"},"./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-live-manager/","src/js/pds-core/","custom-elements.json","custom-elements-manifest.config.js","pds.html-data.json","pds.css-data.json","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",esbuild:"^0.19.0","fs-extra":"^11.1.1",typescript:"^5.6.3","@types/node":"^22.10.2"},dependencies:{lit:"^3.3.1","pure-web":"1.1.32"},customElements:"custom-elements.json"};await o.start(xe);var Re=typeof A.repository=="string"?A.repository:A.repository?.url,Ge=Re?Re.replace(/^git\+/,"").replace(/\.git$/,""):"",bt=A.homepage||Ge,gt=A.bugs?.url||"";document.body.innerHTML=`
1
+ var Pe=Object.defineProperty;var Me=(e,t)=>{for(var s in t)Pe(e,s,{get:t[s],enumerable:!0})};var X=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(s){console.error(`[PDS Registry] Failed to load static ${t}:`,s),console.error(`[PDS Registry] Looking for: ${this._staticPaths[t]}`),console.error("[PDS Registry] Make sure you've run 'npm run pds:build' and configured PDS.start() with the correct static.root path");let n=new CSSStyleSheet;return n.replaceSync("/* Failed to load "+t+" */"),n}}get mode(){return this._mode}get isLive(){return this._mode==="live"}},P=new X;async function pe(e,t=[],s=null){try{let n=s?.primitivesStylesheet?s.primitivesStylesheet:await P.getStylesheet("primitives");e.adoptedStyleSheets=[n,...t]}catch(n){let c=e.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${c}> failed to adopt primitives:`,n),e.adoptedStyleSheets=t}}async function ue(e,t=["primitives"],s=[],n=null){let c=Array.isArray(s)?s.filter(Boolean):[];if(c.length){let d=(Array.isArray(e.adoptedStyleSheets)?e.adoptedStyleSheets:[]).filter(b=>!c.includes(b));e.adoptedStyleSheets=[...d,...c]}try{let d=(await Promise.all(t.map(async b=>{if(n)switch(b){case"tokens":return n.tokensStylesheet;case"primitives":return n.primitivesStylesheet;case"components":return n.componentsStylesheet;case"utilities":return n.utilitiesStylesheet;default:break}return P.getStylesheet(b)}))).filter(b=>b!==null);e.adoptedStyleSheets=[...d,...c]}catch(r){let d=e.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${d}> failed to adopt layers:`,r),e.adoptedStyleSheets=c}}function me(e){let t=new CSSStyleSheet;return t.replaceSync(e),t}var fe={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 Z={};Me(Z,{deepMerge:()=>he,fragmentFromTemplateLike:()=>Te,isObject:()=>O,parseHTML:()=>Y});function O(e){return e&&typeof e=="object"&&!Array.isArray(e)}function he(e,t){let s={...e};return O(e)&&O(t)&&Object.keys(t).forEach(n=>{O(t[n])?n in e?s[n]=he(e[n],t[n]):Object.assign(s,{[n]:t[n]}):Object.assign(s,{[n]:t[n]})}),s}function Te(e){let t=Array.isArray(e?.strings)?e.strings:[],s=Array.isArray(e?.values)?e.values:[],n=new Set,c=[],r=/(\s)(\.[\w-]+)=\s*$/;for(let i=0;i<t.length;i+=1){let g=t[i]??"",f=g.match(r);if(f&&i<s.length){let w=f[2].slice(1),v=`pds-val-${i}`;g=g.replace(r,`$1data-pds-prop="${w}:${v}"`),n.add(i)}c.push(g),i<s.length&&!n.has(i)&&c.push(`<!--pds-val-${i}-->`)}let d=document.createElement("template");d.innerHTML=c.join("");let b=(i,g)=>{let f=i.parentNode;if(!f)return;if(g==null){f.removeChild(i);return}let S=w=>{if(w!=null){if(w instanceof Node){f.insertBefore(w,i);return}if(Array.isArray(w)){w.forEach(v=>S(v));return}f.insertBefore(document.createTextNode(String(w)),i)}};S(g),f.removeChild(i)},E=document.createTreeWalker(d.content,NodeFilter.SHOW_COMMENT),h=[];for(;E.nextNode();){let i=E.currentNode;i?.nodeValue?.startsWith("pds-val-")&&h.push(i)}return h.forEach(i=>{let g=Number(i.nodeValue.replace("pds-val-",""));b(i,s[g])}),d.content.querySelectorAll("*").forEach(i=>{let g=i.getAttribute("data-pds-prop");if(!g)return;let[f,S]=g.split(":"),w=Number(String(S).replace("pds-val-",""));f&&Number.isInteger(w)&&(i[f]=s[w]),i.removeAttribute("data-pds-prop")}),d.content}function Y(e){return new DOMParser().parseFromString(e,"text/html").body.childNodes}var be="pds",Ue=/^([a-z][a-z0-9+\-.]*:)?\/\//i,ye=/^[a-z]:/i;function U(e=""){return e.endsWith("/")?e:`${e}/`}function Ce(e="",t=be){let s=e.replace(/\/+$/,"");return new RegExp(`(?:^|/)${t}$`,"i").test(s)?s:`${s}/${t}`}function $e(e){return e.replace(/^\.\/+/,"")}function Ie(e){return ye.test(e)?e.replace(ye,"").replace(/^\/+/,""):e}function Ne(e){return e.startsWith("public/")?e.substring(7):e}function z(e,t={}){let s=t.segment||be,n=t.defaultRoot||`/assets/${s}/`,c=e?.public&&e.public?.root||e?.static&&e.static?.root||null;if(!c||typeof c!="string")return U(n);let r=c.trim();return r?(r=r.replace(/\\/g,"/"),r=Ce(r,s),r=U(r),Ue.test(r)?r:(r=$e(r),r=Ie(r),r.startsWith("/")||(r=Ne(r),r.startsWith("/")||(r=`/${r}`),r=r.replace(/\/+/g,(d,b)=>b===0?d:"/")),U(r))):U(n)}async function Oe(...e){let t={};e.length&&typeof e[e.length-1]=="object"&&(t=e.pop()||{});let s=e,{baseURL:n,mapper:c=h=>`${h}.js`,onError:r=(h,a)=>console.error(`[defineWebComponents] ${h}:`,a)}=t,d=n?new URL(n,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),b=h=>h.toLowerCase().replace(/(^|-)([a-z])/g,(a,i,g)=>g.toUpperCase()),E=async h=>{try{if(customElements.get(h))return{tag:h,status:"already-defined"};let a=c(h),g=await import(a instanceof URL?a.href:new URL(a,d).href),f=g?.default??g?.[b(h)];if(!f){if(customElements.get(h))return{tag:h,status:"self-defined"};throw new Error(`No export found for ${h}. Expected default export or named export "${b(h)}".`)}return customElements.get(h)?{tag:h,status:"race-already-defined"}:(customElements.define(h,f),{tag:h,status:"defined"})}catch(a){throw r(h,a),a}};return Promise.all(s.map(E))}var F=class{constructor(t={}){let{baseURL:s,mapper:n,onError:c,predicate:r=()=>!0,attributeModule:d="data-module",root:b=document,scanExisting:E=!0,debounceMs:h=16,observeShadows:a=!0,enhancers:i=[],patchAttachShadow:g=!0}=t,f=new Set,S=new Set,w=new Set,v=new Map,x=new WeakMap,_=new WeakMap,u=0,y=!1,A=null,N=l=>{if(!l||!i.length)return;let m=_.get(l);m||(m=new Set,_.set(l,m));for(let p of i)if(!(!p.selector||!p.run)&&!m.has(p.selector))try{l.matches&&l.matches(p.selector)&&(p.run(l),m.add(p.selector))}catch(L){console.warn(`[AutoDefiner] Error applying enhancer for selector "${p.selector}":`,L)}},T=(l,m)=>{if(!y&&!(!l||!l.includes("-"))&&!customElements.get(l)&&!S.has(l)&&!w.has(l)){if(m&&m.getAttribute){let p=m.getAttribute(d);p&&!v.has(l)&&v.set(l,p)}f.add(l),De()}},De=()=>{u||(u=setTimeout(ce,h))},R=l=>{if(l){if(l.nodeType===1){let m=l,p=m.tagName?.toLowerCase();p&&p.includes("-")&&!customElements.get(p)&&r(p,m)&&T(p,m),N(m),a&&m.shadowRoot&&J(m.shadowRoot)}l.querySelectorAll&&l.querySelectorAll("*").forEach(m=>{let p=m.tagName?.toLowerCase();p&&p.includes("-")&&!customElements.get(p)&&r(p,m)&&T(p,m),N(m),a&&m.shadowRoot&&J(m.shadowRoot)})}},J=l=>{if(!l||x.has(l))return;R(l);let m=new MutationObserver(p=>{for(let L of p)L.addedNodes?.forEach(D=>{R(D)}),L.type==="attributes"&&L.target&&R(L.target)});m.observe(l,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[d,...i.map(p=>p.selector).filter(p=>p.startsWith("data-"))]}),x.set(l,m)};async function ce(){if(clearTimeout(u),u=0,!f.size)return;let l=Array.from(f);f.clear(),l.forEach(m=>S.add(m));try{let m=p=>v.get(p)??(n?n(p):`${p}.js`);await Oe(...l,{baseURL:s,mapper:m,onError:(p,L)=>{w.add(p),c?.(p,L)}})}catch{}finally{l.forEach(m=>S.delete(m))}}let de=b===document?document.documentElement:b,le=new MutationObserver(l=>{for(let m of l)m.addedNodes?.forEach(p=>{R(p)}),m.type==="attributes"&&m.target&&R(m.target)});if(le.observe(de,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[d,...i.map(l=>l.selector).filter(l=>l.startsWith("data-"))]}),a&&g&&Element.prototype.attachShadow){let l=Element.prototype.attachShadow;Element.prototype.attachShadow=function(p){let L=l.call(this,p);if(p&&p.mode==="open"){J(L);let D=this.tagName?.toLowerCase();D&&D.includes("-")&&!customElements.get(D)&&T(D,this)}return L},A=()=>Element.prototype.attachShadow=l}return E&&R(de),{stop(){y=!0,le.disconnect(),A&&A(),u&&(clearTimeout(u),u=0),x.forEach(l=>l.disconnect())},flush:ce}}static async define(...t){let s={};t.length&&typeof t[t.length-1]=="object"&&(s=t.pop()||{});let n=t,{baseURL:c,mapper:r=a=>`${a}.js`,onError:d=(a,i)=>console.error(`[defineWebComponents] ${a}:`,i)}=s,b=c?new URL(c,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),E=a=>a.toLowerCase().replace(/(^|-)([a-z])/g,(i,g,f)=>f.toUpperCase()),h=async a=>{try{if(customElements.get(a))return{tag:a,status:"already-defined"};let i=r(a),f=await import(i instanceof URL?i.href:new URL(i,b).href),S=f?.default??f?.[E(a)];if(!S){if(customElements.get(a))return{tag:a,status:"self-defined"};throw new Error(`No export found for ${a}. Expected default export or named export "${E(a)}".`)}return customElements.get(a)?{tag:a,status:"race-already-defined"}:(customElements.define(a,S),{tag:a,status:"defined"})}catch(i){throw d(a,i),i}};return Promise.all(n.map(h))}};var ze=/^[a-z][a-z0-9+\-.]*:\/\//i,C=(()=>{try{return import.meta.url}catch{return}})(),W=e=>typeof e=="string"&&e.length&&!e.endsWith("/")?`${e}/`:e;function B(e,t={}){if(!e||ze.test(e))return e;let{preferModule:s=!0}=t,n=()=>{if(!C)return null;try{return new URL(e,C).href}catch{return null}},c=()=>{if(typeof window>"u"||!window.location?.origin)return null;try{return new URL(e,window.location.origin).href}catch{return null}};return(s?n()||c():c()||n())||e}var ge=(()=>{if(C)try{let e=new URL(C);if(/\/public\/assets\/js\//.test(e.pathname))return new URL("../pds/",C).href}catch{return}})(),we=!1;function Se(e){we||typeof document>"u"||(we=!0,e.addEventListener("pds:ready",t=>{let s=t.detail?.mode;s&&document.documentElement.classList.add(`pds-${s}`,"pds-ready")}))}function Ee({manageTheme:e,themeStorageKey:t,applyResolvedTheme:s,setupSystemListenerIfNeeded:n}){let c="light",r=null;if(e&&typeof window<"u"){try{r=localStorage.getItem(t)||null}catch{r=null}try{s?.(r),n?.(r)}catch{}r?r==="system"?c=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":c=r:c=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return{resolvedTheme:c,storedTheme:r}}function q(e,{resolvePublicAssetURL:t}){let s=!!(e?.public?.root||e?.static?.root),n=t(e);return!s&&ge&&(n=ge),W(B(n))}async function ve(e,{baseEnhancers:t=[]}={}){let{autoDefineBaseURL:s="/auto-define/",autoDefinePreload:n=[],autoDefineMapper:c=null,enhancers:r=[],autoDefineOverrides:d=null,autoDefinePreferModule:b=!0}=e,E=(()=>{let a=new Map;return(t||[]).forEach(i=>a.set(i.selector,i)),(r||[]).forEach(i=>a.set(i.selector,i)),Array.from(a.values())})(),h=null;if(typeof window<"u"&&typeof document<"u"){let a=F,i=u=>{switch(u){case"pds-tabpanel":return"pds-tabstrip.js";default:return`${u}.js`}},{mapper:g,enhancers:f,...S}=d&&typeof d=="object"?d:{},w=f?Array.isArray(f)?f:typeof f=="object"?Object.values(f):[]:[],v=(()=>{let u=new Map;return(E||[]).forEach(y=>{y?.selector&&u.set(y.selector,y)}),(w||[]).forEach(y=>{if(!y?.selector)return;let A=u.get(y.selector)||null;u.set(y.selector,{...A||{},...y,run:typeof y?.run=="function"?y.run:A?.run})}),Array.from(u.values())})(),_={baseURL:s&&W(B(s,{preferModule:b})),predefine:n,scanExisting:!0,observeShadows:!0,patchAttachShadow:!0,debounceMs:16,enhancers:v,onError:(u,y)=>{if(typeof u=="string"&&u.startsWith("pds-")){let N=["pds-form","pds-drawer"].includes(u),T=y?.message?.includes("#pds/lit")||y?.message?.includes("Failed to resolve module specifier");N&&T?console.error(`\u274C PDS component <${u}> 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`):console.warn(`\u26A0\uFE0F PDS component <${u}> not found. Assets may not be installed.`)}else console.error(`\u274C Auto-define error for <${u}>:`,y)},...S,mapper:u=>{if(customElements.get(u))return null;if(typeof c=="function")try{let y=c(u);return y===void 0?i(u):y}catch(y){return console.warn("Custom autoDefine.mapper error; falling back to default:",y?.message||y),i(u)}return i(u)}};h=new a(_),n.length>0&&typeof a.define=="function"&&await a.define(...n,{baseURL:s,mapper:_.mapper,onError:_.onError})}return{autoDefiner:h,mergedEnhancers:E}}var ee=["light","dark"],te=new Set(ee);function Fe(e){let s=(Array.isArray(e?.themes)?e.themes.map(n=>String(n).toLowerCase()):ee).filter(n=>te.has(n));return s.length?s:ee}function se(e,{preferDocument:t=!0}={}){let s=String(e||"").toLowerCase();if(te.has(s))return s;if(t&&typeof document<"u"){let n=document.documentElement?.getAttribute("data-theme");if(te.has(n))return n}return typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Le(e,t){let s=se(t);return Fe(e).includes(s)}var re=class extends EventTarget{},o=new re;o.initializing=!1;o.currentPreset=null;o.debug=!1;var H=null,V=null,K=null,G=null;function Q(e,t){return t&&typeof t=="string"?t:`${q(o.currentConfig||{},{resolvePublicAssetURL:z})}core/${e}`}async function We(){return Array.isArray(o.defaultEnhancers)&&o.defaultEnhancers.length>0?o.defaultEnhancers:(G||(G=import(Q("pds-enhancers.js",o.currentConfig?.enhancersURL)).then(t=>{let s=Array.isArray(t?.defaultPDSEnhancers)?t.defaultPDSEnhancers:[];return o.defaultEnhancers=s,s}).catch(t=>{throw G=null,t})),G)}async function Be(){return typeof o.ask=="function"&&o.ask!==ke?o.ask:(V||(V=import(Q("pds-ask.js",o.currentConfig?.askURL)).then(t=>{let s=t?.ask;if(typeof s!="function")throw new Error("Failed to load ask helper");return o.ask=s,s}).catch(t=>{throw V=null,t})),V)}async function I(){return typeof o.toast=="function"&&o.toast!==M?o.toast:(K||(K=import(Q("pds-toast.js",o.currentConfig?.toastURL)).then(t=>{let s=t?.toast;if(typeof s!="function")throw new Error("Failed to load toast helper");return o.toast=s,s}).catch(t=>{throw K=null,t})),K)}async function ke(...e){return(await Be())(...e)}async function M(...e){return(await I())(...e)}M.success=async(...e)=>(await I()).success(...e);M.error=async(...e)=>(await I()).error(...e);M.warning=async(...e)=>(await I()).warning(...e);M.info=async(...e)=>(await I()).info(...e);var Ae=function(e="log",t,...s){let n=!!(o.registry&&!o.registry.isLive),c=(this?.debug||this?.design?.debug||o.debug||!1)===!0;if(n){if(!o.debug)return}else if(!c&&e!=="error"&&e!=="warn")return;let r=console[e]||console.log;s.length>0?r(t,...s):r(t)};function oe(e){if(e==null)return e;if(typeof e=="function")return;if(typeof e!="object")return e;if(Array.isArray(e))return e.map(s=>oe(s)).filter(s=>s!==void 0);let t={};for(let[s,n]of Object.entries(e)){let c=oe(n);c!==void 0&&(t[s]=c)}return t}async function qe(e,t={}){if(t?.runtimeConfig===!1||typeof fetch!="function")return null;let s=t?.runtimeConfigURL||`${e}pds-runtime-config.json`;try{let n=await fetch(s,{cache:"no-store"});return n.ok?await n.json():null}catch{return null}}o.registry=P;o.enums=fe;o.adoptLayers=ue;o.adoptPrimitives=pe;o.parse=Y;o.createStylesheet=me;o.isLiveMode=()=>P.isLive;o.ask=ke;o.toast=M;o.common=Z;o.AutoComplete=null;o.loadAutoComplete=async()=>{if(o.AutoComplete&&typeof o.AutoComplete.connect=="function")return o.AutoComplete;let e=Q("pds-autocomplete.js",o.currentConfig?.autoCompleteURL);return H||(H=import(e).then(t=>{let s=t?.AutoComplete||t?.default?.AutoComplete||t?.default||null;if(!s)throw new Error("AutoComplete export not found in module");return o.AutoComplete=s,s}).catch(t=>{throw H=null,t})),H};function _e(e){let t=typeof CustomEvent=="function";try{let s=t?new CustomEvent("pds:ready",{detail:e}):new Event("pds:ready");o.dispatchEvent(s)}catch{}if(typeof document<"u")if(t){let s={detail:e,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:ready",s))}catch{}try{document.dispatchEvent(new CustomEvent("pds-ready",s))}catch{}}else{try{document.dispatchEvent(new Event("pds:ready"))}catch{}try{document.dispatchEvent(new Event("pds-ready"))}catch{}}}function xe(e={}){let t=typeof CustomEvent=="function",s={at:Date.now(),...e};try{let n=t?new CustomEvent("pds:config-changed",{detail:s}):new Event("pds:config-changed");o.dispatchEvent(n)}catch{}if(typeof document<"u")if(t){let n={detail:s,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:config-changed",n))}catch{}}else try{document.dispatchEvent(new Event("pds:config-changed"))}catch{}}var ne="pure-ds-theme",j=null,$=null;function ie(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 ae(e){try{if(j&&$){try{typeof j.removeEventListener=="function"?j.removeEventListener("change",$):typeof j.removeListener=="function"&&j.removeListener($)}catch{}j=null,$=null}if(e==="system"&&typeof window<"u"&&window.matchMedia){let t=window.matchMedia("(prefers-color-scheme: dark)"),s=n=>{let c=n?.matches===void 0?t.matches:n.matches;try{let r=c?"dark":"light";document.documentElement.setAttribute("data-theme",r),o.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:r,source:"system"}}))}catch{}};j=t,$=s,typeof t.addEventListener=="function"?t.addEventListener("change",s):typeof t.addListener=="function"&&t.addListener(s)}}catch{}}Object.defineProperty(o,"theme",{get(){try{return typeof window>"u"?null:localStorage.getItem(ne)||null}catch{return null}},set(e){try{if(typeof window>"u")return;let t=o.currentConfig?.design||null,s=se(e);if(t&&!Le(t,s)){let n=t?.name||o.currentPreset?.name||o.currentConfig?.preset||"current preset";console.warn(`PDS theme "${s}" not supported by preset "${n}".`),o.dispatchEvent(new CustomEvent("pds:theme:blocked",{detail:{theme:e,resolvedTheme:s,preset:n}}));return}e==null?localStorage.removeItem(ne):localStorage.setItem(ne,e),ie(e),ae(e),o.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:e,source:"api"}}))}catch{}}});o.defaultEnhancers=[];async function He(e){let t=e&&e.mode||"live",{mode:s,...n}=e||{};if(t==="static")return Ve(n);let c=q(n,{resolvePublicAssetURL:z}),r=n?.managerURL||n?.public?.managerURL||n?.manager?.url||new URL("core/pds-manager.js",c).href||new URL("./pds-manager.js",import.meta.url).href,{startLive:d}=await import(r);return d(o,n,{emitReady:_e,emitConfigChanged:xe,applyResolvedTheme:ie,setupSystemListenerIfNeeded:ae})}o.start=He;async function Ve(e){if(!e||typeof e!="object")throw new Error("PDS.start({ mode: 'static', ... }) requires a valid configuration object");let t=e.applyGlobalStyles??!0,s=e.manageTheme??!0,n=e.themeStorageKey??"pure-ds-theme",c=e.staticPaths??{},r=q(e,{resolvePublicAssetURL:z}),d=e&&e.autoDefine||null,b;d&&d.baseURL?b=W(B(d.baseURL,{preferModule:!1})):b=`${r}components/`;let E=d&&Array.isArray(d.predefine)&&d.predefine||[],h=d&&typeof d.mapper=="function"&&d.mapper||null;try{Se(o);let{resolvedTheme:a}=Ee({manageTheme:s,themeStorageKey:n,applyResolvedTheme:ie,setupSystemListenerIfNeeded:ae}),i=await qe(r,e),g=Array.isArray(e?.enhancers)?e.enhancers:e?.enhancers&&typeof e.enhancers=="object"?Object.values(e.enhancers):[],f=i?.config?{...i.config,...e,design:e?.design||i.config.design,preset:e?.preset||i.config.preset}:{...e},S={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`},w=i?.paths||{};if(c={...S,...w,...c},o.registry.setStaticMode(c),t&&typeof document<"u")try{let u=await o.registry.getStylesheet("styles");if(u){u._pds=!0;let y=(document.adoptedStyleSheets||[]).filter(A=>A._pds!==!0);document.adoptedStyleSheets=[...y,u],xe({mode:"static",source:"static:styles-applied"})}}catch(u){Ae.call(o,"warn","Failed to apply static styles:",u)}let v=null,x=[];try{let u=await We(),y=await ve({autoDefineBaseURL:b,autoDefinePreload:E,autoDefineMapper:h,enhancers:g,autoDefineOverrides:d||null,autoDefinePreferModule:!(d&&d.baseURL)},{baseEnhancers:u});v=y.autoDefiner,x=y.mergedEnhancers||[]}catch(u){Ae.call(o,"error","\u274C Failed to initialize AutoDefiner/Enhancers (static):",u)}let _=oe(e);return o.currentConfig=Object.freeze({mode:"static",...structuredClone(_),design:structuredClone(f.design||{}),preset:f.preset,theme:a,enhancers:x}),_e({mode:"static",config:f,theme:a,autoDefiner:v}),{config:f,theme:a,autoDefiner:v}}catch(a){throw o.dispatchEvent(new CustomEvent("pds:error",{detail:{error:a}})),a}}var je={mode:"live",liveEdit:!0,preset:"default",autoDefine:{predefine:["pds-icon","pds-drawer","pds-toaster","pds-form"]},log(e,t,...s){console[e](t,...s)}};var k={name:"@pure-ds/core",shortname:"pds",version:"0.7.18",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"},"./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-live-manager/","src/js/pds-core/","custom-elements.json","custom-elements-manifest.config.js","pds.html-data.json","pds.css-data.json","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",esbuild:"^0.19.0","fs-extra":"^11.1.1",typescript:"^5.6.3","@types/node":"^22.10.2"},dependencies:{lit:"^3.3.1","pure-web":"1.1.32"},customElements:"custom-elements.json"};await o.start(je);var Re=typeof k.repository=="string"?k.repository:k.repository?.url,Ge=Re?Re.replace(/^git\+/,"").replace(/\.git$/,""):"",bt=k.homepage||Ge,gt=k.bugs?.url||"";document.body.innerHTML=`
3
3
  <pds-toaster id="global-toaster"></pds-toaster>
4
4
 
5
5
  <div class="container text-center">
6
6
  <img src="/assets/img/pds-logo.svg" alt="PDS Logo" width="64" height="64" />
7
7
  <header class="container section">
8
- <h1>${A.name} ${A.version}</h1>
9
- <small class="text-muted">${A.description}</small>
8
+ <h1>${k.name} ${k.version}</h1>
9
+ <small class="text-muted">${k.description}</small>
10
10
  </header>
11
11
  </div>
12
12
  `;