@pure-ds/core 0.7.34 → 0.7.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pure-ds/core",
|
|
3
3
|
"shortname": "pds",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.36",
|
|
5
5
|
"description": "Why develop a Design System when you can generate one?",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -47,6 +47,10 @@
|
|
|
47
47
|
"types": "./dist/types/src/js/pds-localization.d.ts",
|
|
48
48
|
"import": "./public/assets/pds/core/pds-localization.js"
|
|
49
49
|
},
|
|
50
|
+
"./lit": {
|
|
51
|
+
"types": "./dist/types/src/js/lit.d.ts",
|
|
52
|
+
"import": "./public/assets/pds/external/lit.js"
|
|
53
|
+
},
|
|
50
54
|
"./pds-core": "./src/js/pds.js",
|
|
51
55
|
"./auto-define/*": "./public/auto-define/*"
|
|
52
56
|
},
|
|
@@ -322,13 +322,72 @@ async function updateVSCodeSettings(targetDir) {
|
|
|
322
322
|
async function loadConsumerConfig() {
|
|
323
323
|
const cwd = process.cwd();
|
|
324
324
|
|
|
325
|
+
const resolveConfigFromModule = (mod) => {
|
|
326
|
+
if (mod?.config) return mod.config;
|
|
327
|
+
if (mod?.default) return mod.default;
|
|
328
|
+
if (mod?.presets?.default) return mod.presets.default;
|
|
329
|
+
return null;
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
const importConfigWithCompatibilityPatch = async (
|
|
333
|
+
configPath,
|
|
334
|
+
{
|
|
335
|
+
rewritePdsAliases = false,
|
|
336
|
+
guardDefaultEnhancersSpread = false,
|
|
337
|
+
} = {},
|
|
338
|
+
) => {
|
|
339
|
+
const source = await readFile(configPath, 'utf-8');
|
|
340
|
+
let patched = source;
|
|
341
|
+
|
|
342
|
+
if (rewritePdsAliases) {
|
|
343
|
+
patched = patched
|
|
344
|
+
.replaceAll('"#pds/lit"', '"@pure-ds/core/lit"')
|
|
345
|
+
.replaceAll("'#pds/lit'", "'@pure-ds/core/lit'")
|
|
346
|
+
.replaceAll('"#pds"', '"@pure-ds/core"')
|
|
347
|
+
.replaceAll("'#pds'", "'@pure-ds/core'");
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
if (guardDefaultEnhancersSpread) {
|
|
351
|
+
patched = patched
|
|
352
|
+
.replaceAll(
|
|
353
|
+
'...defaultEnhancers',
|
|
354
|
+
'...(Array.isArray(defaultEnhancers) ? defaultEnhancers : [])',
|
|
355
|
+
)
|
|
356
|
+
.replaceAll(
|
|
357
|
+
'...PDS.defaultEnhancers',
|
|
358
|
+
'...(Array.isArray(PDS?.defaultEnhancers) ? PDS.defaultEnhancers : [])',
|
|
359
|
+
);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
if (patched === source) {
|
|
363
|
+
return null;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
const tempConfigPath = path.join(
|
|
367
|
+
path.dirname(configPath),
|
|
368
|
+
`.pds-config.node.${Date.now()}.${Math.random().toString(36).slice(2)}.mjs`,
|
|
369
|
+
);
|
|
370
|
+
|
|
371
|
+
await writeFile(tempConfigPath, patched, 'utf-8');
|
|
372
|
+
try {
|
|
373
|
+
return await import(pathToFileURL(tempConfigPath).href);
|
|
374
|
+
} finally {
|
|
375
|
+
await unlink(tempConfigPath).catch(() => {});
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
const isPdsImportSpecifierIssue = (message = '') =>
|
|
380
|
+
/(?:Package import specifier\s+"#pds(?:\/lit)?"\s+is not defined|Invalid "imports" target .*['"]#pds(?:\/lit)?['"])/i.test(
|
|
381
|
+
message,
|
|
382
|
+
);
|
|
383
|
+
|
|
325
384
|
// 1) Prefer repository-level pds.config.js (source of truth for both live and static)
|
|
326
385
|
const repoConfigPath = path.join(repoRoot, 'pds.config.js');
|
|
327
386
|
if (existsSync(repoConfigPath)) {
|
|
328
387
|
log(`📋 Using repo config: ${path.relative(process.cwd(), repoConfigPath)}`,'blue');
|
|
329
388
|
const mod = await import(pathToFileURL(repoConfigPath).href);
|
|
330
|
-
|
|
331
|
-
if (
|
|
389
|
+
const resolved = resolveConfigFromModule(mod);
|
|
390
|
+
if (resolved) return resolved;
|
|
332
391
|
}
|
|
333
392
|
|
|
334
393
|
// 2) Fallbacks for consumer apps: pds.config.js or legacy pds-config.js in CWD
|
|
@@ -339,19 +398,53 @@ async function loadConsumerConfig() {
|
|
|
339
398
|
log(`📋 Using consumer config: ${path.relative(cwd, configPath)}`,'blue');
|
|
340
399
|
try {
|
|
341
400
|
const mod = await import(pathToFileURL(configPath).href);
|
|
342
|
-
|
|
343
|
-
if (
|
|
344
|
-
if (mod.presets?.default) return mod.presets.default;
|
|
401
|
+
const resolved = resolveConfigFromModule(mod);
|
|
402
|
+
if (resolved) return resolved;
|
|
345
403
|
log(`⚠️ Could not resolve config from ${fname}; trying next/fallback`, 'yellow');
|
|
346
404
|
} catch (e) {
|
|
347
405
|
const msg = e?.message || String(e);
|
|
348
|
-
if (
|
|
349
|
-
log(`⚠️ Could not evaluate ${fname}:
|
|
350
|
-
log('
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
406
|
+
if (isPdsImportSpecifierIssue(msg)) {
|
|
407
|
+
log(`⚠️ Could not evaluate ${fname}: #pds alias resolution failed in Node`, 'yellow');
|
|
408
|
+
log(' Trying compatibility load by mapping "#pds" → "@pure-ds/core".', 'yellow');
|
|
409
|
+
try {
|
|
410
|
+
const compatMod = await importConfigWithCompatibilityPatch(configPath, {
|
|
411
|
+
rewritePdsAliases: true,
|
|
412
|
+
guardDefaultEnhancersSpread: true,
|
|
413
|
+
});
|
|
414
|
+
if (compatMod) {
|
|
415
|
+
const resolvedCompat = resolveConfigFromModule(compatMod);
|
|
416
|
+
if (resolvedCompat) {
|
|
417
|
+
log(`✅ Loaded ${fname} via compatibility alias mapping`, 'green');
|
|
418
|
+
return resolvedCompat;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
} catch (compatErr) {
|
|
422
|
+
log(`⚠️ Compatibility load failed for ${fname}: ${compatErr?.message || compatErr}`, 'yellow');
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
log(' Suggested package.json aliases:', 'yellow');
|
|
426
|
+
log(' "imports": { "#pds": "@pure-ds/core", "#pds/lit": "@pure-ds/core/lit" }', 'blue');
|
|
427
|
+
log(' Falling back to internal default preset for this run.', 'yellow');
|
|
428
|
+
continue;
|
|
429
|
+
}
|
|
430
|
+
if (/defaultEnhancers\s+is\s+not\s+iterable/i.test(msg)) {
|
|
431
|
+
log(`⚠️ Could not evaluate ${fname}: defaultEnhancers is not iterable`, 'yellow');
|
|
432
|
+
log(' Trying compatibility load with safe enhancer spread guards.', 'yellow');
|
|
433
|
+
try {
|
|
434
|
+
const compatMod = await importConfigWithCompatibilityPatch(configPath, {
|
|
435
|
+
rewritePdsAliases: true,
|
|
436
|
+
guardDefaultEnhancersSpread: true,
|
|
437
|
+
});
|
|
438
|
+
if (compatMod) {
|
|
439
|
+
const resolvedCompat = resolveConfigFromModule(compatMod);
|
|
440
|
+
if (resolvedCompat) {
|
|
441
|
+
log(`✅ Loaded ${fname} with enhancer spread compatibility guard`, 'green');
|
|
442
|
+
return resolvedCompat;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
} catch (compatErr) {
|
|
446
|
+
log(`⚠️ Compatibility load failed for ${fname}: ${compatErr?.message || compatErr}`, 'yellow');
|
|
447
|
+
}
|
|
355
448
|
log(' Falling back to internal default preset for this run.', 'yellow');
|
|
356
449
|
continue;
|
|
357
450
|
}
|
|
@@ -141,20 +141,42 @@ async function ensureBuildScript(consumerRoot) {
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
const requiredImports = {
|
|
144
|
-
'#pds': '
|
|
145
|
-
'#pds/lit': '
|
|
144
|
+
'#pds': '@pure-ds/core',
|
|
145
|
+
'#pds/lit': '@pure-ds/core/lit',
|
|
146
146
|
};
|
|
147
147
|
|
|
148
|
+
const legacyImports = {
|
|
149
|
+
'#pds': new Set([
|
|
150
|
+
'./node_modules/@pure-ds/core/public/assets/pds/core.js',
|
|
151
|
+
]),
|
|
152
|
+
'#pds/lit': new Set([
|
|
153
|
+
'./node_modules/@pure-ds/core/public/assets/pds/external/lit.js',
|
|
154
|
+
]),
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
const normalizeImportTarget = (value) =>
|
|
158
|
+
typeof value === 'string' ? value.replace(/\\/g, '/').trim().toLowerCase() : '';
|
|
159
|
+
|
|
148
160
|
if (consumerPkg.imports && (typeof consumerPkg.imports !== 'object' || Array.isArray(consumerPkg.imports))) {
|
|
149
161
|
console.warn('⚠️ package.json "imports" is not an object; skipping #pds import aliases');
|
|
150
162
|
} else {
|
|
151
163
|
consumerPkg.imports = consumerPkg.imports || {};
|
|
152
164
|
|
|
153
165
|
for (const [importKey, importValue] of Object.entries(requiredImports)) {
|
|
154
|
-
|
|
166
|
+
const existingValue = consumerPkg.imports[importKey];
|
|
167
|
+
const existingNormalized = normalizeImportTarget(existingValue);
|
|
168
|
+
const legacySet = new Set(
|
|
169
|
+
Array.from(legacyImports[importKey] || []).map((item) => normalizeImportTarget(item))
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
if (!existingValue) {
|
|
155
173
|
consumerPkg.imports[importKey] = importValue;
|
|
156
174
|
console.log(`🧩 Added "imports.${importKey}" alias to consumer package.json`);
|
|
157
175
|
changed = true;
|
|
176
|
+
} else if (typeof existingValue === 'string' && legacySet.has(existingNormalized)) {
|
|
177
|
+
consumerPkg.imports[importKey] = importValue;
|
|
178
|
+
console.log(`🔁 Migrated legacy "imports.${importKey}" alias to a valid Node target`);
|
|
179
|
+
changed = true;
|
|
158
180
|
} else {
|
|
159
181
|
console.log(`🔧 Import alias "${importKey}" already present in consumer package.json`);
|
|
160
182
|
}
|
package/public/assets/js/app.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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}},Ae="__PURE_DS_PDS_SINGLETON__",ce=typeof globalThis<"u"?globalThis:window,ie=ce?.[Ae],s=ie&&typeof ie.addEventListener=="function"?ie:new ae;ce&&(ce[Ae]=s);typeof s.log!="function"&&(s.log=(e="log",t,...n)=>{if(typeof console>"u")return;let o=typeof console[e]=="function"?console[e].bind(console):typeof console.log=="function"?console.log.bind(console):null;o&&(n.length>0?o(t,...n):o(t))});typeof s.logHandler!="function"&&(s.logHandler=null);var 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){s.log("error",`Registry: failed to load static ${t}:`,n),s.log("error",`Registry: looking for ${this._staticPaths[t]}`),s.log("error","Registry: make sure you've run 'npm run pds:build' and configured PDS.start() with the correct static.root path");let o=new CSSStyleSheet;return o.replaceSync("/* Failed to load "+t+" */"),o}}get mode(){return this._mode}get isLive(){return this._mode==="live"}},z=new le;async function je(e,t=[],n=null){try{let o=n?.primitivesStylesheet?n.primitivesStylesheet:await z.getStylesheet("primitives");e.adoptedStyleSheets=[o,...t]}catch(o){let a=e.host?.tagName?.toLowerCase()||"unknown";s.log("error",`Adopter: <${a}> failed to adopt primitives:`,o),e.adoptedStyleSheets=t}}async function ke(e,t=["primitives"],n=[],o=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(o)switch(y){case"tokens":return o.tokensStylesheet;case"primitives":return o.primitivesStylesheet;case"components":return o.componentsStylesheet;case"utilities":return o.utilitiesStylesheet;default:break}return z.getStylesheet(y)}))).filter(y=>y!==null);e.adoptedStyleSheets=[...l,...a]}catch(r){let l=e.host?.tagName?.toLowerCase()||"unknown";s.log("error",`Adopter: <${l}> failed to adopt layers:`,r),e.adoptedStyleSheets=a}}function Pe(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(o=>{B(t[o])?o in e?n[o]=Re(e[o],t[o]):Object.assign(n,{[o]:t[o]}):Object.assign(n,{[o]:t[o]})}),n}function at(e){let t=Array.isArray(e?.strings)?e.strings:[],n=Array.isArray(e?.values)?e.values:[],o=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}"`),o.add(i)}a.push(w),i<n.length&&!o.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 U(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,o=t.defaultRoot||`/assets/${n}/`,a=e?.public&&e.public?.root||e?.static&&e.static?.root||null;if(!a||typeof a!="string")return U(o);let r=a.trim();return r?(r=r.replace(/\\/g,"/"),r=lt(r,n),r=U(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:"/")),U(r))):U(o)}async function ft(...e){let t={};e.length&&typeof e[e.length-1]=="object"&&(t=e.pop()||{});let n=e,{baseURL:o,mapper:a=d=>`${d}.js`,onError:r=(d,c)=>console.error(`[defineWebComponents] ${d}:`,c)}=t,l=o?new URL(o,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:o,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,k=new WeakMap,E=new WeakMap,h=0,b=!1,P=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(A){console.warn(`[AutoDefiner] Error applying enhancer for selector "${p.selector}":`,A)}},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),st()}},st=()=>{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||k.has(u))return;R(u);let f=new MutationObserver(p=>{for(let A of p)A.addedNodes?.forEach(D=>{R(D)}),A.type==="attributes"&&A.target&&R(A.target)});f.observe(u,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[l,...i.map(p=>p.selector).filter(p=>p.startsWith("data-"))]}),k.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)??(o?o(p):`${p}.js`);await ft(...u,{baseURL:n,mapper:f,onError:(p,A)=>{S.add(p),a?.(p,A)}})}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 A=u.call(this,p);if(p&&p.mode==="open"){re(A);let D=this.tagName?.toLowerCase();D&&D.includes("-")&&!customElements.get(D)&&M(D,this)}return A},P=()=>Element.prototype.attachShadow=u}return g&&R(Ee),{stop(){b=!0,ve.disconnect(),P&&P(),h&&(clearTimeout(h),h=0),k.forEach(u=>u.disconnect())},flush:_e}}static async define(...t){let n={};t.length&&typeof t[t.length-1]=="object"&&(n=t.pop()||{});let o=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(o.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,o=()=>{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?o()||a():a()||o())||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 Me(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 Ue({manageTheme:e,themeStorageKey:t,applyResolvedTheme:n,setupSystemListenerIfNeeded:o}){let a="light",r=null;if(e&&typeof window<"u"){try{r=localStorage.getItem(t)||null}catch{r=null}try{n?.(r),o?.(r)}catch{}r?r==="system"?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),o=t(e);return!n&&Te&&(o=Te),q(V(o))}async function Oe(e,{baseEnhancers:t=[]}={}){let{autoDefineBaseURL:n="/auto-define/",autoDefinePreload:o=[],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 P=h.get(b.selector)||null;h.set(b.selector,{...P||{},...b,run:typeof b?.run=="function"?b.run:P?.run})}),Array.from(h.values())})(),E={baseURL:n&&q(V(n,{preferModule:y})),predefine:o,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?s.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`):s.log("warn",`\u26A0\uFE0F PDS component <${h}> not found. Assets may not be installed.`)}else s.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 s.log("warn","Custom autoDefine.mapper error; falling back to default:",b?.message||b),i(h)}return i(h)}};d=new c(E),o.length>0&&typeof c.define=="function"&&await c.define(...o,{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(o=>String(o).toLowerCase()):pe).filter(o=>fe.has(o));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 o=document.documentElement?.getAttribute("data-theme");if(fe.has(o))return o}return typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Ne(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 $e(){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=$e();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=$e();return typeof e?.logHandler=="function"?e.logHandler:null}function Ie(e,t,...n){if(typeof console>"u")return;let o=typeof console[e]=="function"?console[e].bind(console):typeof console.log=="function"?console.log.bind(console):null;o&&(n.length>0?o(t,...n):o(t))}function _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 o=wt(e),a=St(),r=Lt();if(r)try{r.call(a?.thisArg,o,t,...n);return}catch(l){Ie("error","Custom log handler failed:",l)}_t(o,a)&&Ie(o,t,...n)}typeof s.initializing!="boolean"&&(s.initializing=!1);"currentPreset"in s||(s.currentPreset=null);typeof s.debug!="boolean"&&(s.debug=!1);"currentConfig"in s||(s.currentConfig=null);"compiled"in s||(s.compiled=null);typeof s.logHandler!="function"&&(s.logHandler=null);"mode"in s||(s.mode=null);var Q=null,Y=null,Z=null,X=null,ee=null,te=null,Be="__pdsLocalizationRuntime";function T(){if(te)return te;let e=s?.[Be];return e&&typeof e=="object"?(te=e,e):null}function Et(e){let t=e&&typeof e=="object"?e:null;te=t,s[Be]=t}Fe({getLogger:()=>typeof s.logHandler=="function"?s.logHandler:null,getContext:()=>{let e=s?.mode||s?.compiled?.mode||(s?.registry?.isLive?"live":"static"),t=(s?.debug||s?.currentConfig?.debug||s?.currentConfig?.design?.debug||s?.compiled?.debug||s?.compiled?.design?.debug||!1)===!0;return{mode:e,debug:t,thisArg:s}}});s.log=(e="log",t,...n)=>{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,o)=>t(Number(o)))}function At(e){if(!e||typeof e!="object")return{};let t={};for(let[n,o]of Object.entries(e)){if(typeof o=="string"){t[n]=o;continue}o&&typeof o=="object"&&typeof o.content=="string"&&(t[n]=o.content)}return t}function jt(e,...t){return{strTag:!0,strings:Array.from(e||[]),values:t,raw:Array.from(e?.raw||[])}}function kt(e){if(!e)return"";if(Ke(e)){let n=Ge(e.strings||[]),o=L.messages[n]||n;return vt(o,a=>e.values?.[a])}let t=String(e);return L.messages[t]||t}function Pt(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 $=(e,t={})=>{let n=T();return typeof n?.msg=="function"?n.msg(e,t):(Pt(e),kt(e,t))},se=(e,...t)=>{let n=T();return typeof n?.str=="function"?n.str(e,...t):jt(e,...t)},oe=(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=At(e.messages));let n=!!(e.provider||e.translate||e.loadLocale||e.setLocale);return L.hasProvider=n,n&&I().then(o=>{o.configureLocalization(e),qe(o)}).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",o=Array.isArray(e?.locales)?e.locales.map(g=>String(g||"").trim().toLowerCase()).filter(Boolean):[],a=Array.from(new Set([n,...o])),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(s.currentConfig||{},{resolvePublicAssetURL:K})}core/${e}`}async function xt(){return Array.isArray(s.defaultEnhancers)&&s.defaultEnhancers.length>0?s.defaultEnhancers:(X||(X=import(F("pds-enhancers.js",s.currentConfig?.enhancersURL)).then(t=>{let n=Array.isArray(t?.defaultPDSEnhancers)?t.defaultPDSEnhancers:[];return s.defaultEnhancers=n,n}).catch(t=>{throw X=null,t})),X)}async function Rt(){return typeof s.ask=="function"&&s.ask!==Ze?s.ask:(Y||(Y=import(F("pds-ask.js",s.currentConfig?.askURL)).then(t=>{let n=t?.ask;if(typeof n!="function")throw new Error("Failed to load ask helper");return s.ask=n,n}).catch(t=>{throw Y=null,t})),Y)}async function W(){return typeof s.toast=="function"&&s.toast!==C?s.toast:(Z||(Z=import(F("pds-toast.js",s.currentConfig?.toastURL)).then(t=>{let n=t?.toast;if(typeof n!="function")throw new Error("Failed to load toast helper");return s.toast=n,n}).catch(t=>{throw Z=null,t})),Z)}async function Ze(...e){return(await Rt())(...e)}async function C(...e){return(await W())(...e)}C.success=async(...e)=>(await W()).success(...e);C.error=async(...e)=>(await W()).error(...e);C.warning=async(...e)=>(await W()).warning(...e);C.info=async(...e)=>(await W()).info(...e);var He=function(e="log",t,...n){s.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,o]of Object.entries(e)){let a=be(o);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 o=await fetch(n,{cache:"no-store"});return o.ok?await o.json():null}catch{return null}}s.registry=z;s.enums=xe;s.adoptLayers=ke;s.adoptPrimitives=je;s.parse=de;s.createStylesheet=Pe;s.isLiveMode=()=>z.isLive;s.ask=Ze;s.toast=C;s.common=ue;s.msg=$;s.str=se;s.configureLocalization=oe;s.loadLocale=Ve;s.setLocale=Je;s.getLocalizationState=Qe;s.createJSONLocalization=Ye;s.i18n={msg:$,str:se,configure:oe,loadLocale:Ve,setLocale:Je,getState:Qe,createJSONLocalization:Ye};s.AutoComplete=null;s.loadAutoComplete=async()=>{if(s.AutoComplete&&typeof s.AutoComplete.connect=="function")return s.AutoComplete;let e=F("pds-autocomplete.js",s.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 s.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");s.dispatchEvent(n)}catch{}if(typeof document<"u")if(t){let n={detail:e,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:ready",n))}catch{}try{document.dispatchEvent(new CustomEvent("pds-ready",n))}catch{}}else{try{document.dispatchEvent(new Event("pds:ready"))}catch{}try{document.dispatchEvent(new Event("pds-ready"))}catch{}}}function tt(e={}){let t=typeof CustomEvent=="function",n={at:Date.now(),...e};try{let o=t?new CustomEvent("pds:config-changed",{detail:n}):new Event("pds:config-changed");s.dispatchEvent(o)}catch{}if(typeof document<"u")if(t){let o={detail:n,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:config-changed",o))}catch{}}else try{document.dispatchEvent(new Event("pds:config-changed"))}catch{}}var ge="pure-ds-theme",x=null,N=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&&N){try{typeof x.removeEventListener=="function"?x.removeEventListener("change",N):typeof x.removeListener=="function"&&x.removeListener(N)}catch{}x=null,N=null}if(e==="system"&&typeof window<"u"&&window.matchMedia){let t=window.matchMedia("(prefers-color-scheme: dark)"),n=o=>{let a=o?.matches===void 0?t.matches:o.matches;try{let r=a?"dark":"light";document.documentElement.setAttribute("data-theme",r),s.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:r,source:"system"}}))}catch{}};x=t,N=n,typeof t.addEventListener=="function"?t.addEventListener("change",n):typeof t.addListener=="function"&&t.addListener(n)}}catch{}}var zt=Object.getOwnPropertyDescriptor(s,"theme");zt||Object.defineProperty(s,"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=s.currentConfig?.design||null,n=me(e);if(t&&!Ne(t,n)){let o=t?.name||s.currentPreset?.name||s.currentConfig?.preset||"current preset";s.log("warn",`PDS theme "${n}" not supported by preset "${o}".`),s.dispatchEvent(new CustomEvent("pds:theme:blocked",{detail:{theme:e,resolvedTheme:n,preset:o}}));return}e==null?localStorage.removeItem(ge):localStorage.setItem(ge,e),Se(e),Le(e),s.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:e,source:"api"}}))}catch{}}});s.defaultEnhancers=[];async function Tt(e){s.initializing=!0;try{let t=e&&e.mode||"live",{mode:n,...o}=e||{};s.mode=t,s.logHandler=typeof o?.log=="function"?o.log:null,s.currentConfig=we(o);let a=o&&typeof o.localization=="object"&&o.localization?o.localization:null;a?(await I(),oe(a)):oe(null);let r;if(t==="static")r=await Ct(o);else{let y=J(o,{resolvePublicAssetURL:K}),g=o?.managerURL||o?.public?.managerURL||o?.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(s,o,{emitReady:et,emitConfigChanged:tt,applyResolvedTheme:Se,setupSystemListenerIfNeeded:Le})}s.compiled=we(r?.config||null);let l=s?.compiled?.design?.icons?.externalPath||"/assets/img/icons/";return s.log("info",`startup ready; external icon path: ${l}`),r}finally{s.initializing=!1}}s.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,o=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{Me(s);let{resolvedTheme:c}=Ue({manageTheme:n,themeStorageKey:o,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},s.registry.setStaticMode(a),t&&typeof document<"u")try{let E=await s.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(s,"warn","Failed to apply static styles:",E)}let v=null,k=[];try{let E=await xt(),h=await Oe({autoDefineBaseURL:y,autoDefinePreload:g,autoDefineMapper:d,enhancers:w,autoDefineOverrides:l||null,autoDefinePreferModule:!(l&&l.baseURL)},{baseEnhancers:E});v=h.autoDefiner,k=h.mergedEnhancers||[]}catch(E){He.call(s,"error","\u274C Failed to initialize AutoDefiner/Enhancers (static):",E)}return s.compiled=we({mode:"static",...m,theme:c,enhancers:k}),et({mode:"static",config:m,theme:c,autoDefiner:v}),{config:m,theme:c,autoDefiner:v}}catch(c){throw s.dispatchEvent(new CustomEvent("pds:error",{detail:{error:c}})),c}}var Mt=s.createJSONLocalization({locale:"en",locales:["en","nl"],aliases:{en:["en","en-US"],nl:["nl","nl-NL"]},basePath:"/assets/locales"}),nt={mode:"live",liveEdit:!0,preset:"default",localization:Mt,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 j={name:"@pure-ds/core",shortname:"pds",version:"0.7.34",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"},"./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 s.start(nt);document.documentElement.lang="en";var ot=typeof j.repository=="string"?j.repository:j.repository?.url,Ot=ot?ot.replace(/^git\+/,"").replace(/\.git$/,""):"",hn=j.homepage||Ot,yn=j.bugs?.url||"";document.body.innerHTML=`
|
|
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 ke(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 Pe(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 U(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 U(s);let r=a.trim();return r?(r=r.replace(/\\/g,"/"),r=lt(r,n),r=U(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:"/")),U(r))):U(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,k=new WeakMap,E=new WeakMap,h=0,b=!1,P=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||k.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-"))]}),k.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},P=()=>Element.prototype.attachShadow=u}return g&&R(Ee),{stop(){b=!0,ve.disconnect(),P&&P(),h&&(clearTimeout(h),h=0),k.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 Me(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 Ue({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 Oe(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 P=h.get(b.selector)||null;h.set(b.selector,{...P||{},...b,run:typeof b?.run=="function"?b.run:P?.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 Ne(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 $e(){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=$e();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=$e();return typeof e?.logHandler=="function"?e.logHandler:null}function Ie(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){Ie("error","Custom log handler failed:",l)}_t(s,a)&&Ie(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 kt(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 Pt(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 $=(e,t={})=>{let n=T();return typeof n?.msg=="function"?n.msg(e,t):(Pt(e),kt(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!==C?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 C(...e){return(await W())(...e)}C.success=async(...e)=>(await W()).success(...e);C.error=async(...e)=>(await W()).error(...e);C.warning=async(...e)=>(await W()).warning(...e);C.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=ke;o.adoptPrimitives=Ae;o.parse=de;o.createStylesheet=Pe;o.isLiveMode=()=>z.isLive;o.ask=Ze;o.toast=C;o.common=ue;o.msg=$;o.str=oe;o.configureLocalization=se;o.loadLocale=Ve;o.setLocale=Je;o.getLocalizationState=Qe;o.createJSONLocalization=Ye;o.i18n={msg:$,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,N=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&&N){try{typeof x.removeEventListener=="function"?x.removeEventListener("change",N):typeof x.removeListener=="function"&&x.removeListener(N)}catch{}x=null,N=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=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&&!Ne(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{Me(o);let{resolvedTheme:c}=Ue({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,k=[];try{let E=await xt(),h=await Oe({autoDefineBaseURL:y,autoDefinePreload:g,autoDefineMapper:d,enhancers:w,autoDefineOverrides:l||null,autoDefinePreferModule:!(l&&l.baseURL)},{baseEnhancers:E});v=h.autoDefiner,k=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:k}),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 Mt=o.createJSONLocalization({locale:"en",locales:["en","nl"],aliases:{en:["en","en-US"],nl:["nl","nl-NL"]},basePath:"/assets/locales"}),nt={mode:"live",liveEdit:!0,preset:"default",localization:Mt,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.36",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,Ot=st?st.replace(/^git\+/,"").replace(/\.git$/,""):"",hn=A.homepage||Ot,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" width="64" height="64" />
|
|
5
5
|
<header class="container section">
|
|
6
|
-
<h1>${
|
|
7
|
-
<small class="text-muted">${$(
|
|
6
|
+
<h1>${A.name} ${$(oe`version ${A.version}`)}</h1>
|
|
7
|
+
<small class="text-muted">${$(A.description)}</small>
|
|
8
8
|
</header>
|
|
9
9
|
</div>
|
|
10
10
|
`;
|