@pure-ds/core 0.7.48 → 0.7.49
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/dist/types/pds.d.ts +7 -5
- package/dist/types/public/assets/pds/components/pds-toaster.d.ts +4 -1
- package/dist/types/public/assets/pds/components/pds-toaster.d.ts.map +1 -1
- package/dist/types/src/js/common/toast.d.ts +9 -0
- package/dist/types/src/js/common/toast.d.ts.map +1 -1
- package/package.json +1 -1
- package/public/assets/js/app.js +1 -1
- package/public/assets/pds/components/pds-toaster.js +25 -7
- package/src/js/common/toast.js +8 -0
- package/src/js/pds.d.ts +7 -5
package/dist/types/pds.d.ts
CHANGED
|
@@ -391,6 +391,7 @@ export class PDS extends EventTarget {
|
|
|
391
391
|
* @param message - The message to display
|
|
392
392
|
* @param options - Toast configuration
|
|
393
393
|
* @param options.type - Toast type/severity ("information" | "success" | "warning" | "error")
|
|
394
|
+
* @param options.title - Optional heading override (falls back to type label when empty)
|
|
394
395
|
* @param options.duration - Duration in milliseconds (auto-calculated if not provided)
|
|
395
396
|
* @param options.closable - Whether toast can be manually closed (default: true)
|
|
396
397
|
* @param options.persistent - If true, toast won't auto-dismiss (default: false)
|
|
@@ -406,6 +407,7 @@ export class PDS extends EventTarget {
|
|
|
406
407
|
message: string,
|
|
407
408
|
options?: {
|
|
408
409
|
type?: 'information' | 'success' | 'warning' | 'error';
|
|
410
|
+
title?: string;
|
|
409
411
|
duration?: number;
|
|
410
412
|
closable?: boolean;
|
|
411
413
|
persistent?: boolean;
|
|
@@ -423,11 +425,11 @@ export class PDS extends EventTarget {
|
|
|
423
425
|
* await PDS.toast.success('Profile updated!');
|
|
424
426
|
*/
|
|
425
427
|
static toast: {
|
|
426
|
-
(message: string, options?: { type?: 'information' | 'success' | 'warning' | 'error'; duration?: number; closable?: boolean; persistent?: boolean }): Promise<string>;
|
|
427
|
-
success(message: string, options?: { duration?: number; closable?: boolean; persistent?: boolean }): Promise<string>;
|
|
428
|
-
error(message: string, options?: { duration?: number; closable?: boolean; persistent?: boolean }): Promise<string>;
|
|
429
|
-
warning(message: string, options?: { duration?: number; closable?: boolean; persistent?: boolean }): Promise<string>;
|
|
430
|
-
info(message: string, options?: { duration?: number; closable?: boolean; persistent?: boolean }): Promise<string>;
|
|
428
|
+
(message: string, options?: { type?: 'information' | 'success' | 'warning' | 'error'; title?: string; duration?: number; closable?: boolean; persistent?: boolean }): Promise<string>;
|
|
429
|
+
success(message: string, options?: { title?: string; duration?: number; closable?: boolean; persistent?: boolean }): Promise<string>;
|
|
430
|
+
error(message: string, options?: { title?: string; duration?: number; closable?: boolean; persistent?: boolean }): Promise<string>;
|
|
431
|
+
warning(message: string, options?: { title?: string; duration?: number; closable?: boolean; persistent?: boolean }): Promise<string>;
|
|
432
|
+
info(message: string, options?: { title?: string; duration?: number; closable?: boolean; persistent?: boolean }): Promise<string>;
|
|
431
433
|
};
|
|
432
434
|
|
|
433
435
|
/**
|
|
@@ -40,6 +40,7 @@ export class AppToaster extends HTMLElement {
|
|
|
40
40
|
* @param {string} message - The message to display
|
|
41
41
|
* @param {Object} [options] - Toast configuration
|
|
42
42
|
* @param {"information"|"success"|"warning"|"error"} [options.type="information"] - Toast type
|
|
43
|
+
* @param {string} [options.title] - Optional heading text (falls back to type-based title when empty)
|
|
43
44
|
* @param {number} [options.duration] - Duration in ms (auto-calculated if not provided)
|
|
44
45
|
* @param {boolean} [options.closable=true] - Whether toast can be closed manually
|
|
45
46
|
* @param {boolean} [options.persistent=false] - If true, toast doesn't auto-dismiss
|
|
@@ -47,6 +48,7 @@ export class AppToaster extends HTMLElement {
|
|
|
47
48
|
*/
|
|
48
49
|
public toast(message: string, options?: {
|
|
49
50
|
type?: "information" | "success" | "warning" | "error";
|
|
51
|
+
title?: string;
|
|
50
52
|
duration?: number;
|
|
51
53
|
closable?: boolean;
|
|
52
54
|
persistent?: boolean;
|
|
@@ -56,12 +58,13 @@ export class AppToaster extends HTMLElement {
|
|
|
56
58
|
* @param {string} id
|
|
57
59
|
* @param {string} message
|
|
58
60
|
* @param {"information"|"success"|"warning"|"error"} type
|
|
61
|
+
* @param {string|null|undefined} title
|
|
59
62
|
* @param {boolean} closable
|
|
60
63
|
* @param {number} duration
|
|
61
64
|
* @param {boolean} persistent
|
|
62
65
|
* @returns {HTMLElement}
|
|
63
66
|
*/
|
|
64
|
-
createToastElement(id: string, message: string, type: "information" | "success" | "warning" | "error", closable: boolean, duration: number, persistent: boolean, html?: boolean, action?: any): HTMLElement;
|
|
67
|
+
createToastElement(id: string, message: string, type: "information" | "success" | "warning" | "error", title: string | null | undefined, closable: boolean, duration: number, persistent: boolean, html?: boolean, action?: any): HTMLElement;
|
|
65
68
|
/**
|
|
66
69
|
* Dismiss a toast by ID
|
|
67
70
|
* @method dismissToast
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pds-toaster.d.ts","sourceRoot":"","sources":["../../../../../../public/assets/pds/components/pds-toaster.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AACH;IAGI,cAAgB;IAChB,0BAAgC;IAChC,mCAAoC;IACpC,mCAAoC;IAGtC;;;OAGG;IACH,qBAFa,OAAO,CAAC,IAAI,CAAC,CA+JzB;IAxJC,oCAGC;IAuJH;;OAEG;IACH,6BAMC;IAED
|
|
1
|
+
{"version":3,"file":"pds-toaster.d.ts","sourceRoot":"","sources":["../../../../../../public/assets/pds/components/pds-toaster.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AACH;IAGI,cAAgB;IAChB,0BAAgC;IAChC,mCAAoC;IACpC,mCAAoC;IAGtC;;;OAGG;IACH,qBAFa,OAAO,CAAC,IAAI,CAAC,CA+JzB;IAxJC,oCAGC;IAuJH;;OAEG;IACH,6BAMC;IAED;;;;;;;;;;;;OAYG;IACH,sBATW,MAAM,YAEd;QAA4D,IAAI,GAAxD,aAAa,GAAC,SAAS,GAAC,SAAS,GAAC,OAAO;QACvB,KAAK,GAAtB,MAAM;QACU,QAAQ,GAAzB,MAAM;QACY,QAAQ,GAA1B,OAAO;QACW,UAAU,GAA5B,OAAO;KACf,GAAU,MAAM,CAqClB;IA6CD;;;;;;;;;;OAUG;IACH,uBATW,MAAM,WACN,MAAM,QACN,aAAa,GAAC,SAAS,GAAC,SAAS,GAAC,OAAO,SACxC,MAAM,GAAC,IAAI,GAAC,SAAS,YACtB,OAAO,YACP,MAAM,cACN,OAAO,iCACL,WAAW,CA+EvB;IAED;;;;;OAKG;IACH,6BAFW,MAAM,QAyBhB;IAED;;OAEG;IACH,mBAgBC;IAmFD;;;;;;;OAOG;IACH,6BAJW,MAAM,kBAEJ,MAAM,CAIlB;IAED;;;;;;;OAOG;IACH,6BAJW,MAAM,kBAEJ,MAAM,CAIlB;IAED;;;;;;;OAOG;IACH,2BAJW,MAAM,kBAEJ,MAAM,CAIlB;IAED;;;;;;;OAOG;IACH,0BAJW,MAAM,kBAEJ,MAAM,CAIlB;;CACF"}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* @param {string} message - The message to display
|
|
9
9
|
* @param {Object} [options={}] - Toast configuration
|
|
10
10
|
* @param {"information"|"success"|"warning"|"error"} [options.type="information"] - Toast type/severity
|
|
11
|
+
* @param {string} [options.title] - Optional heading override (falls back to type label when empty)
|
|
11
12
|
* @param {number} [options.duration] - Duration in milliseconds (auto-calculated if not provided based on message length)
|
|
12
13
|
* @param {boolean} [options.closable=true] - Whether the toast can be manually closed
|
|
13
14
|
* @param {boolean} [options.persistent=false] - If true, toast won't auto-dismiss (requires manual close)
|
|
@@ -27,6 +28,13 @@
|
|
|
27
28
|
* });
|
|
28
29
|
*
|
|
29
30
|
* @example
|
|
31
|
+
* // Custom title overrides type-derived heading
|
|
32
|
+
* await PDS.toast('Feature coming soon...', {
|
|
33
|
+
* type: 'information',
|
|
34
|
+
* title: 'Qogni'
|
|
35
|
+
* });
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
30
38
|
* // Persistent warning (must be manually closed)
|
|
31
39
|
* await PDS.toast('This action cannot be undone', {
|
|
32
40
|
* type: 'warning',
|
|
@@ -42,6 +50,7 @@
|
|
|
42
50
|
*/
|
|
43
51
|
export function toast(message: string, options?: {
|
|
44
52
|
type?: "information" | "success" | "warning" | "error";
|
|
53
|
+
title?: string;
|
|
45
54
|
duration?: number;
|
|
46
55
|
closable?: boolean;
|
|
47
56
|
persistent?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../../../../../src/js/common/toast.js"],"names":[],"mappings":"AAoBA
|
|
1
|
+
{"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../../../../../src/js/common/toast.js"],"names":[],"mappings":"AAoBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,+BA3CW,MAAM,YAEd;IAA4D,IAAI,GAAxD,aAAa,GAAC,SAAS,GAAC,SAAS,GAAC,OAAO;IACxB,KAAK,GAAtB,MAAM;IACW,QAAQ,GAAzB,MAAM;IACY,QAAQ,GAA1B,OAAO;IACW,UAAU,GAA5B,OAAO;IACW,IAAI,GAAtB,OAAO;IACiE,MAAM,GAA9E;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,WAAW;QAAC,cAAc,CAAC,EAAE,OAAO,CAAA;KAAC;CACrE,GAAU,OAAO,CAAC,MAAM,CAAC,CAqC3B;;IAED;;;;;;;;;OASG;IACH,0BAPW,MAAM,kBAEJ,OAAO,CAAC,MAAM,CAAC,CAO3B;IAED;;;;;;;;;OASG;IACH,wBAPW,MAAM,kBAEJ,OAAO,CAAC,MAAM,CAAC,CAO3B;IAED;;;;;;;;;OASG;IACH,0BAPW,MAAM,kBAEJ,OAAO,CAAC,MAAM,CAAC,CAO3B;IAED;;;;;;;;;OASG;IACH,uBAPW,MAAM,kBAEJ,OAAO,CAAC,MAAM,CAAC,CAO3B"}
|
package/package.json
CHANGED
package/public/assets/js/app.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var rt=Object.defineProperty;var it=(e,t)=>{for(var n in t)rt(e,n,{get:t[n],enumerable:!0})};var ae=class extends EventTarget{constructor(){super(),this.mode=null,this.compiled=null,this.log=()=>{},this.logHandler=null}},je="__PURE_DS_PDS_SINGLETON__",ce=typeof globalThis<"u"?globalThis:window,ie=ce?.[je],o=ie&&typeof ie.addEventListener=="function"?ie:new ae;ce&&(ce[je]=o);typeof o.log!="function"&&(o.log=(e="log",t,...n)=>{if(typeof console>"u")return;let s=typeof console[e]=="function"?console[e].bind(console):typeof console.log=="function"?console.log.bind(console):null;s&&(n.length>0?s(t,...n):s(t))});typeof o.logHandler!="function"&&(o.logHandler=null);var le=class{constructor(){this._mode="static",this._staticPaths={tokens:"/assets/pds/styles/pds-tokens.css.js",primitives:"/assets/pds/styles/pds-primitives.css.js",components:"/assets/pds/styles/pds-components.css.js",utilities:"/assets/pds/styles/pds-utilities.css.js",styles:"/assets/pds/styles/pds-styles.css.js"}}setLiveMode(){this._mode="live"}setStaticMode(t={}){this._mode="static",this._staticPaths={...this._staticPaths,...t}}async getStylesheet(t){if(this._mode==="live")return null;try{return(await import(this._staticPaths[t]))[t]}catch(n){o.log("error",`Registry: failed to load static ${t}:`,n),o.log("error",`Registry: looking for ${this._staticPaths[t]}`),o.log("error","Registry: make sure you've run 'npm run pds:build' and configured PDS.start() with the correct static.root path");let s=new CSSStyleSheet;return s.replaceSync("/* Failed to load "+t+" */"),s}}get mode(){return this._mode}get isLive(){return this._mode==="live"}},z=new le;async function Ae(e,t=[],n=null){try{let s=n?.primitivesStylesheet?n.primitivesStylesheet:await z.getStylesheet("primitives");e.adoptedStyleSheets=[s,...t]}catch(s){let c=e.host?.tagName?.toLowerCase()||"unknown";o.log("error",`Adopter: <${c}> failed to adopt primitives:`,s),e.adoptedStyleSheets=t}}async function Pe(e,t=["primitives"],n=[],s=null){let c=Array.isArray(n)?n.filter(Boolean):[];if(c.length){let l=(Array.isArray(e.adoptedStyleSheets)?e.adoptedStyleSheets:[]).filter(g=>!c.includes(g));e.adoptedStyleSheets=[...l,...c]}try{let l=(await Promise.all(t.map(async g=>{if(s)switch(g){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(g)}))).filter(g=>g!==null);e.adoptedStyleSheets=[...l,...c]}catch(r){let l=e.host?.tagName?.toLowerCase()||"unknown";o.log("error",`Adopter: <${l}> failed to adopt layers:`,r),e.adoptedStyleSheets=c}}function ke(e){let t=new CSSStyleSheet;return t.replaceSync(e),t}var xe={FontWeights:{light:300,normal:400,medium:500,semibold:600,bold:700},LineHeights:{tight:1.25,normal:1.5,relaxed:1.75},BorderWidths:{hairline:.5,thin:1,medium:2,thick:3},RadiusSizes:{none:0,small:4,medium:8,large:16,xlarge:24,xxlarge:32},ShadowDepths:{none:"none",light:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",medium:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",deep:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",extreme:"0 25px 50px -12px rgba(0, 0, 0, 0.25)"},TransitionSpeeds:{fast:150,normal:250,slow:350},AnimationEasings:{linear:"linear",ease:"ease","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out",bounce:"cubic-bezier(0.68, -0.55, 0.265, 1.55)"},TouchTargetSizes:{compact:36,standard:44,comfortable:48,spacious:56},LinkStyles:{inline:"inline",block:"block",button:"button"},FocusStyles:{ring:"ring",outline:"outline",border:"border",glow:"glow"},TabSizes:{compact:2,standard:4,wide:8},SelectIcons:{chevron:"chevron",arrow:"arrow",caret:"caret",none:"none"},IconSizes:{xs:16,sm:20,md:24,lg:32,xl:48,"2xl":64,"3xl":96}};var ue={};it(ue,{deepMerge:()=>Re,fragmentFromTemplateLike:()=>at,isObject:()=>B,parseHTML:()=>de});function B(e){return e&&typeof e=="object"&&!Array.isArray(e)}function Re(e,t){let n={...e};return B(e)&&B(t)&&Object.keys(t).forEach(s=>{B(t[s])?s in e?n[s]=Re(e[s],t[s]):Object.assign(n,{[s]:t[s]}):Object.assign(n,{[s]:t[s]})}),n}function at(e){let t=Array.isArray(e?.strings)?e.strings:[],n=Array.isArray(e?.values)?e.values:[],s=new Set,c=[],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)}c.push(w),i<n.length&&!s.has(i)&&c.push(`<!--pds-val-${i}-->`)}let l=document.createElement("template");l.innerHTML=c.join("");let g=(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)},y=document.createTreeWalker(l.content,NodeFilter.SHOW_COMMENT),d=[];for(;y.nextNode();){let i=y.currentNode;i?.nodeValue?.startsWith("pds-val-")&&d.push(i)}return d.forEach(i=>{let w=Number(i.nodeValue.replace("pds-val-",""));g(i,n[w])}),l.content.querySelectorAll("*").forEach(i=>{let w=i.getAttribute("data-pds-prop");if(!w)return;let[m,_]=w.split(":"),S=Number(String(_).replace("pds-val-",""));m&&Number.isInteger(S)&&(i[m]=n[S]),i.removeAttribute("data-pds-prop")}),l.content}function de(e){return new DOMParser().parseFromString(e,"text/html").body.childNodes}var ze="pds",ct=/^([a-z][a-z0-9+\-.]*:)?\/\//i,De=/^[a-z]:/i;function N(e=""){return e.endsWith("/")?e:`${e}/`}function lt(e="",t=ze){let n=e.replace(/\/+$/,"");return new RegExp(`(?:^|/)${t}$`,"i").test(n)?n:`${n}/${t}`}function dt(e){return e.replace(/^\.\/+/,"")}function ut(e){return De.test(e)?e.replace(De,"").replace(/^\/+/,""):e}function pt(e){return e.startsWith("public/")?e.substring(7):e}function K(e,t={}){let n=t.segment||ze,s=t.defaultRoot||`/assets/${n}/`,c=e?.public&&e.public?.root||e?.static&&e.static?.root||null;if(!c||typeof c!="string")return N(s);let r=c.trim();return r?(r=r.replace(/\\/g,"/"),r=lt(r,n),r=N(r),ct.test(r)?r:(r=dt(r),r=ut(r),r.startsWith("/")||(r=pt(r),r.startsWith("/")||(r=`/${r}`),r=r.replace(/\/+/g,(l,g)=>g===0?l:"/")),N(r))):N(s)}async function ft(...e){let t={};e.length&&typeof e[e.length-1]=="object"&&(t=e.pop()||{});let n=e,{baseURL:s,mapper:c=d=>`${d}.js`,onError:r=(d,a)=>console.error(`[defineWebComponents] ${d}:`,a)}=t,l=s?new URL(s,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),g=d=>d.toLowerCase().replace(/(^|-)([a-z])/g,(a,i,w)=>w.toUpperCase()),y=async d=>{try{if(customElements.get(d))return{tag:d,status:"already-defined"};let a=c(d),w=await import(a instanceof URL?a.href:new URL(a,l).href),m=w?.default??w?.[g(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 "${g(d)}".`)}return customElements.get(d)?{tag:d,status:"race-already-defined"}:(customElements.define(d,m),{tag:d,status:"defined"})}catch(a){throw r(d,a),a}};return Promise.all(n.map(y))}var G=class{constructor(t={}){let{baseURL:n,mapper:s,onError:c,predicate:r=()=>!0,attributeModule:l="data-module",root:g=document,scanExisting:y=!0,debounceMs:d=16,observeShadows:a=!0,enhancers:i=[],patchAttachShadow:w=!0}=t,m=new Set,_=new Set,S=new Set,v=new Map,P=new WeakMap,E=new WeakMap,h=0,b=!1,k=null,H=u=>{if(!u||!i.length)return;let f=E.get(u);f||(f=new Set,E.set(u,f));for(let p of i)if(!(!p.selector||!p.run)&&!f.has(p.selector))try{u.matches&&u.matches(p.selector)&&(p.run(u),f.add(p.selector))}catch(j){console.warn(`[AutoDefiner] Error applying enhancer for selector "${p.selector}":`,j)}},M=(u,f)=>{if(!b&&!(!u||!u.includes("-"))&&!customElements.get(u)&&!_.has(u)&&!S.has(u)){if(f&&f.getAttribute){let p=f.getAttribute(l);p&&!v.has(u)&&v.set(u,p)}m.add(u),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),a&&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),a&&f.shadowRoot&&re(f.shadowRoot)})}},re=u=>{if(!u||P.has(u))return;R(u);let f=new MutationObserver(p=>{for(let j of p)j.addedNodes?.forEach(D=>{R(D)}),j.type==="attributes"&&j.target&&R(j.target)});f.observe(u,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[l,...i.map(p=>p.selector).filter(p=>p.startsWith("data-"))]}),P.set(u,f)};async function _e(){if(clearTimeout(h),h=0,!m.size)return;let u=Array.from(m);m.clear(),u.forEach(f=>_.add(f));try{let f=p=>v.get(p)??(s?s(p):`${p}.js`);await ft(...u,{baseURL:n,mapper:f,onError:(p,j)=>{S.add(p),c?.(p,j)}})}catch{}finally{u.forEach(f=>_.delete(f))}}let Ee=g===document?document.documentElement:g,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-"))]}),a&&w&&Element.prototype.attachShadow){let u=Element.prototype.attachShadow;Element.prototype.attachShadow=function(p){let j=u.call(this,p);if(p&&p.mode==="open"){re(j);let D=this.tagName?.toLowerCase();D&&D.includes("-")&&!customElements.get(D)&&M(D,this)}return j},k=()=>Element.prototype.attachShadow=u}return y&&R(Ee),{stop(){b=!0,ve.disconnect(),k&&k(),h&&(clearTimeout(h),h=0),P.forEach(u=>u.disconnect())},flush:_e}}static async define(...t){let n={};t.length&&typeof t[t.length-1]=="object"&&(n=t.pop()||{});let s=t,{baseURL:c,mapper:r=a=>`${a}.js`,onError:l=(a,i)=>console.error(`[defineWebComponents] ${a}:`,i)}=n,g=c?new URL(c,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),y=a=>a.toLowerCase().replace(/(^|-)([a-z])/g,(i,w,m)=>m.toUpperCase()),d=async a=>{try{if(customElements.get(a))return{tag:a,status:"already-defined"};let i=r(a),m=await import(i instanceof URL?i.href:new URL(i,g).href),_=m?.default??m?.[y(a)];if(!_){if(customElements.get(a))return{tag:a,status:"self-defined"};throw new Error(`No export found for ${a}. Expected default export or named export "${y(a)}".`)}return customElements.get(a)?{tag:a,status:"race-already-defined"}:(customElements.define(a,_),{tag:a,status:"defined"})}catch(i){throw l(a,i),i}};return Promise.all(s.map(d))}};var mt=/^[a-z][a-z0-9+\-.]*:\/\//i,O=(()=>{try{return import.meta.url}catch{return}})(),J=e=>typeof e=="string"&&e.length&&!e.endsWith("/")?`${e}/`:e;function q(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}},c=()=>{if(typeof window>"u"||!window.location?.origin)return null;try{return new URL(e,window.location.origin).href}catch{return null}};return(n?s()||c():c()||s())||e}var Te=(()=>{if(O)try{let e=new URL(O);if(/\/public\/assets\/js\//.test(e.pathname))return new URL("../pds/",O).href}catch{return}})(),Ce=!1;function Ue(e){Ce||typeof document>"u"||(Ce=!0,e.addEventListener("pds:ready",t=>{let n=t.detail?.mode;n&&document.documentElement.classList.add(`pds-${n}`,"pds-ready")}))}function Me({manageTheme:e,themeStorageKey:t,applyResolvedTheme:n,setupSystemListenerIfNeeded:s}){let c="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"?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 V(e,{resolvePublicAssetURL:t}){let n=!!(e?.public?.root||e?.static?.root),s=t(e);return!n&&Te&&(s=Te),J(q(s))}async function Ne(e,{baseEnhancers:t=[]}={}){let{autoDefineBaseURL:n="/auto-define/",autoDefinePreload:s=[],autoDefineMapper:c=null,enhancers:r=[],autoDefineOverrides:l=null,autoDefinePreferModule:g=!0}=e,y=(()=>{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())})(),d=null;if(typeof window<"u"&&typeof document<"u"){let a=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(y||[]).forEach(b=>{b?.selector&&h.set(b.selector,b)}),(S||[]).forEach(b=>{if(!b?.selector)return;let k=h.get(b.selector)||null;h.set(b.selector,{...k||{},...b,run:typeof b?.run=="function"?b.run:k?.run})}),Array.from(h.values())})(),E={baseURL:n&&J(q(n,{preferModule:g})),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 c=="function")try{let b=c(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 a(E),s.length>0&&typeof a.define=="function"&&await a.define(...s,{baseURL:n,mapper:E.mapper,onError:E.onError})}return{autoDefiner:d,mergedEnhancers:y}}var pe=["light","dark"],fe=new Set(pe);function ht(e){let n=(Array.isArray(e?.themes)?e.themes.map(s=>String(s).toLowerCase()):pe).filter(s=>fe.has(s));return n.length?n:pe}function me(e,{preferDocument:t=!0}={}){let n=String(e||"").toLowerCase();if(fe.has(n))return n;if(t&&typeof document<"u"){let s=document.documentElement?.getAttribute("data-theme");if(fe.has(s))return s}return typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Oe(e,t){let n=me(t);return ht(e).includes(n)}var yt=new Set(["log","warn","error","debug","info"]),gt="__PURE_DS_PDS_SINGLETON__",he=null,ye=null;function Ie(){try{let t=(typeof globalThis<"u"?globalThis:window)?.[gt];if(t&&typeof t=="object")return t}catch{return null}return null}function bt(e){return!e||typeof e!="object"?null:{mode:e.mode==="live"||e.mode==="static"?e.mode:null,debug:e.debug===!0,thisArg:e.thisArg}}function wt(e){if(typeof e!="string")return"log";let t=e.toLowerCase();return yt.has(t)?t:"log"}function St(){if(typeof ye=="function")try{let t=bt(ye());if(t)return t}catch{}let e=Ie();if(e){let t=e?.mode||e?.compiled?.mode||(e?.registry?.isLive?"live":"static"),n=(e?.debug||e?.currentConfig?.debug||e?.currentConfig?.design?.debug||e?.compiled?.debug||e?.compiled?.design?.debug||!1)===!0;return{mode:t,debug:n,thisArg:e}}return{mode:null,debug:!1}}function Lt(){if(typeof he=="function")try{let t=he();if(typeof t=="function")return t}catch{}let e=Ie();return typeof e?.logHandler=="function"?e.logHandler:null}function $e(e,t,...n){if(typeof console>"u")return;let s=typeof console[e]=="function"?console[e].bind(console):typeof console.log=="function"?console.log.bind(console):null;s&&(n.length>0?s(t,...n):s(t))}function _t(e,t){let n=t?.debug===!0;return!(t?.mode==="static"&&!n||!n&&e!=="error"&&e!=="warn")}function Fe({getLogger:e,getContext:t}={}){he=typeof e=="function"?e:null,ye=typeof t=="function"?t:null}function We(e="log",t,...n){let s=wt(e),c=St(),r=Lt();if(r)try{r.call(c?.thisArg,s,t,...n);return}catch(l){$e("error","Custom log handler failed:",l)}_t(s,c)&&$e(s,t,...n)}typeof o.initializing!="boolean"&&(o.initializing=!1);"currentPreset"in o||(o.currentPreset=null);typeof o.debug!="boolean"&&(o.debug=!1);"currentConfig"in o||(o.currentConfig=null);"compiled"in o||(o.compiled=null);typeof o.logHandler!="function"&&(o.logHandler=null);"mode"in o||(o.mode=null);var Q=null,Y=null,Z=null,X=null,ee=null,te=null,Be="__pdsLocalizationRuntime";function T(){if(te)return te;let e=o?.[Be];return e&&typeof e=="object"?(te=e,e):null}function Et(e){let t=e&&typeof e=="object"?e:null;te=t,o[Be]=t}Fe({getLogger:()=>typeof o.logHandler=="function"?o.logHandler:null,getContext:()=>{let e=o?.mode||o?.compiled?.mode||(o?.registry?.isLive?"live":"static"),t=(o?.debug||o?.currentConfig?.debug||o?.currentConfig?.design?.debug||o?.compiled?.debug||o?.compiled?.design?.debug||!1)===!0;return{mode:e,debug:t,thisArg:o}}});o.log=(e="log",t,...n)=>{We(e,t,...n)};var L={locale:"en",messages:{},hasProvider:!1},ne=new Set;function Ke(e){return!!e&&typeof e!="string"&&typeof e=="object"&&"strTag"in e}function Ge(e=[]){let t="";for(let n=0;n<=e.length-1;n+=1)t+=e[n],n<e.length-1&&(t+=`{${n}}`);return t}function vt(e,t){return String(e).replace(/\{(\d+)\}/g,(n,s)=>t(Number(s)))}function jt(e){if(!e||typeof e!="object")return{};let t={};for(let[n,s]of Object.entries(e)){if(typeof s=="string"){t[n]=s;continue}s&&typeof s=="object"&&typeof s.content=="string"&&(t[n]=s.content)}return t}function At(e,...t){return{strTag:!0,strings:Array.from(e||[]),values:t,raw:Array.from(e?.raw||[])}}function Pt(e){if(!e)return"";if(Ke(e)){let n=Ge(e.strings||[]),s=L.messages[n]||n;return vt(s,c=>e.values?.[c])}let t=String(e);return L.messages[t]||t}function kt(e){if(!e)return;let t=Ke(e)?Ge(e.strings||[]):String(e);typeof t=="string"&&t.length>0&&ne.add(t)}function Je(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),Je(n),n}).catch(n=>{throw ee=null,n})),ee)}var C=(e,t={})=>{let n=T();return typeof n?.msg=="function"?n.msg(e,t):(kt(e),Pt(e,t))},se=(e,...t)=>{let n=T();return typeof n?.str=="function"?n.str(e,...t):At(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=jt(e.messages));let n=!!(e.provider||e.translate||e.loadLocale||e.setLocale);return L.hasProvider=n,n&&I().then(s=>{s.configureLocalization(e),Je(s)}).catch(()=>{}),{locale:L.locale,messages:{...L.messages},hasProvider:L.hasProvider}},qe=async e=>(await I()).loadLocale(e),Ve=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(y=>String(y||"").trim().toLowerCase()).filter(Boolean):[],c=Array.from(new Set([n,...s])),r=null,l=async()=>(r||(r=I().then(y=>typeof y?.createJSONLocalization=="function"?y.createJSONLocalization(e):null).catch(()=>null)),r),g=async(y="loadLocale")=>{let d=await l();if(!d||typeof d!="object")return null;let a=d.provider;if(!a||typeof a!="object")return null;let i=a[y];return typeof i=="function"?i:y==="setLocale"&&typeof a.loadLocale=="function"?a.loadLocale:null};return{locale:n,locales:[...c],provider:{locales:[...c],async loadLocale(y={}){let d=await g("loadLocale");return typeof d!="function"?{}:d(y)},async setLocale(y={}){let d=await g("setLocale");return typeof d!="function"?{}:d(y)}}}};function F(e,t){return t&&typeof t=="string"?t:`${V(o.currentConfig||{},{resolvePublicAssetURL:K})}core/${e}`}async function xt(){return Array.isArray(o.defaultEnhancers)&&o.defaultEnhancers.length>0?o.defaultEnhancers:(X||(X=import(F("pds-enhancers.js",o.currentConfig?.enhancersURL)).then(t=>{let n=Array.isArray(t?.defaultPDSEnhancers)?t.defaultPDSEnhancers:[];return o.defaultEnhancers=n,n}).catch(t=>{throw X=null,t})),X)}async function Rt(){return typeof o.ask=="function"&&o.ask!==Ze?o.ask:(Y||(Y=import(F("pds-ask.js",o.currentConfig?.askURL)).then(t=>{let n=t?.ask;if(typeof n!="function")throw new Error("Failed to load ask helper");return o.ask=n,n}).catch(t=>{throw Y=null,t})),Y)}async function W(){return typeof o.toast=="function"&&o.toast!==U?o.toast:(Z||(Z=import(F("pds-toast.js",o.currentConfig?.toastURL)).then(t=>{let n=t?.toast;if(typeof n!="function")throw new Error("Failed to load toast helper");return o.toast=n,n}).catch(t=>{throw Z=null,t})),Z)}async function Ze(...e){return(await Rt())(...e)}async function U(...e){return(await W())(...e)}U.success=async(...e)=>(await W()).success(...e);U.error=async(...e)=>(await W()).error(...e);U.warning=async(...e)=>(await W()).warning(...e);U.info=async(...e)=>(await W()).info(...e);var He=function(e="log",t,...n){o.log(e,t,...n)};function be(e){if(e==null)return e;if(typeof e=="function")return;if(typeof e!="object")return e;if(Array.isArray(e))return e.map(n=>be(n)).filter(n=>n!==void 0);let t={};for(let[n,s]of Object.entries(e)){let c=be(s);c!==void 0&&(t[n]=c)}return t}function Xe(e,t=new WeakSet){if(!e||typeof e!="object"||t.has(e))return e;t.add(e),Object.freeze(e);for(let n of Object.keys(e))Xe(e[n],t);return e}function we(e){return e==null||typeof e!="object"?e:Xe(structuredClone(be(e)))}async function Dt(e,t={}){if(t?.runtimeConfig===!1||typeof fetch!="function")return null;let n=t?.runtimeConfigURL||`${e}pds-runtime-config.json`;try{let s=await fetch(n,{cache:"no-store"});return s.ok?await s.json():null}catch{return null}}o.registry=z;o.enums=xe;o.adoptLayers=Pe;o.adoptPrimitives=Ae;o.parse=de;o.createStylesheet=ke;o.isLiveMode=()=>z.isLive;o.ask=Ze;o.toast=U;o.common=ue;o.msg=C;o.str=se;o.configureLocalization=oe;o.loadLocale=qe;o.setLocale=Ve;o.getLocalizationState=Qe;o.createJSONLocalization=Ye;o.i18n={msg:C,str:se,configure:oe,loadLocale:qe,setLocale:Ve,getState:Qe,createJSONLocalization:Ye};o.AutoComplete=null;o.loadAutoComplete=async()=>{if(o.AutoComplete&&typeof o.AutoComplete.connect=="function")return o.AutoComplete;let e=F("pds-autocomplete.js",o.currentConfig?.autoCompleteURL);return Q||(Q=import(e).then(t=>{let n=t?.AutoComplete||t?.default?.AutoComplete||t?.default||null;if(!n)throw new Error("AutoComplete export not found in module");return o.AutoComplete=n,n}).catch(t=>{throw Q=null,t})),Q};function et(e){let t=typeof CustomEvent=="function";try{let n=t?new CustomEvent("pds:ready",{detail:e}):new Event("pds:ready");o.dispatchEvent(n)}catch{}if(typeof document<"u")if(t){let n={detail:e,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:ready",n))}catch{}try{document.dispatchEvent(new CustomEvent("pds-ready",n))}catch{}}else{try{document.dispatchEvent(new Event("pds:ready"))}catch{}try{document.dispatchEvent(new Event("pds-ready"))}catch{}}}function tt(e={}){let t=typeof CustomEvent=="function",n={at:Date.now(),...e};try{let s=t?new CustomEvent("pds:config-changed",{detail:n}):new Event("pds:config-changed");o.dispatchEvent(s)}catch{}if(typeof document<"u")if(t){let s={detail:n,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:config-changed",s))}catch{}}else try{document.dispatchEvent(new Event("pds:config-changed"))}catch{}}var ge="pure-ds-theme",x=null,$=null;function Se(e){try{if(typeof document>"u")return;let t="light";e?e==="system"?t=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t=e:t=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",document.documentElement.setAttribute("data-theme",t)}catch{}}function Le(e){try{if(x&&$){try{typeof x.removeEventListener=="function"?x.removeEventListener("change",$):typeof x.removeListener=="function"&&x.removeListener($)}catch{}x=null,$=null}if(e==="system"&&typeof window<"u"&&window.matchMedia){let t=window.matchMedia("(prefers-color-scheme: dark)"),n=s=>{let c=s?.matches===void 0?t.matches:s.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,$=n,typeof t.addEventListener=="function"?t.addEventListener("change",n):typeof t.addListener=="function"&&t.addListener(n)}}catch{}}var zt=Object.getOwnPropertyDescriptor(o,"theme");zt||Object.defineProperty(o,"theme",{get(){try{return typeof window>"u"?null:localStorage.getItem(ge)||null}catch{return null}},set(e){try{if(typeof window>"u")return;let t=o.currentConfig?.design||null,n=me(e);if(t&&!Oe(t,n)){let s=t?.name||o.currentPreset?.name||o.currentConfig?.preset||"current preset";o.log("warn",`PDS theme "${n}" not supported by preset "${s}".`),o.dispatchEvent(new CustomEvent("pds:theme:blocked",{detail:{theme:e,resolvedTheme:n,preset:s}}));return}e==null?localStorage.removeItem(ge):localStorage.setItem(ge,e),Se(e),Le(e),o.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:e,source:"api"}}))}catch{}}});o.defaultEnhancers=[];async function Tt(e){o.initializing=!0;try{let t=e&&e.mode||"live",{mode:n,...s}=e||{};o.mode=t,o.logHandler=typeof s?.log=="function"?s.log:null,o.currentConfig=we(s);let c=s&&typeof s.localization=="object"&&s.localization?s.localization:null;c?(await I(),oe(c)):oe(null);let r;if(t==="static")r=await Ct(s);else{let{localization:g,...y}=s||{},d=V(y,{resolvePublicAssetURL:K}),a=y?.managerURL||y?.public?.managerURL||y?.manager?.url||new URL("core/pds-manager.js",d).href||new URL("./pds-manager.js",import.meta.url).href,{startLive:i}=await import(a);r=await i(o,y,{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",c=e.staticPaths??{},r=V(e,{resolvePublicAssetURL:K}),l=e&&e.autoDefine||null,g;l&&l.baseURL?g=J(q(l.baseURL,{preferModule:!1})):g=`${r}components/`;let y=l&&Array.isArray(l.predefine)&&l.predefine||[],d=l&&typeof l.mapper=="function"&&l.mapper||null;try{Ue(o);let{resolvedTheme:a}=Me({manageTheme:n,themeStorageKey:s,applyResolvedTheme:Se,setupSystemListenerIfNeeded:Le}),i=await Dt(r,e),w=Array.isArray(e?.enhancers)?e.enhancers:e?.enhancers&&typeof e.enhancers=="object"?Object.values(e.enhancers):[],m=i?.config?{...i.config,...e,design:e?.design||i.config.design,preset:e?.preset||i.config.preset}:{...e},_={tokens:`${r}styles/pds-tokens.css.js`,primitives:`${r}styles/pds-primitives.css.js`,components:`${r}styles/pds-components.css.js`,utilities:`${r}styles/pds-utilities.css.js`,styles:`${r}styles/pds-styles.css.js`},S=i?.paths||{};if(c={..._,...S,...c},o.registry.setStaticMode(c),t&&typeof document<"u")try{let E=await o.registry.getStylesheet("styles");if(E){E._pds=!0;let h=(document.adoptedStyleSheets||[]).filter(b=>b._pds!==!0);document.adoptedStyleSheets=[...h,E],tt({mode:"static",source:"static:styles-applied"})}}catch(E){He.call(o,"warn","Failed to apply static styles:",E)}let v=null,P=[];try{let E=await xt(),h=await Ne({autoDefineBaseURL:g,autoDefinePreload:y,autoDefineMapper:d,enhancers:w,autoDefineOverrides:l||null,autoDefinePreferModule:!(l&&l.baseURL)},{baseEnhancers:E});v=h.autoDefiner,P=h.mergedEnhancers||[]}catch(E){He.call(o,"error","\u274C Failed to initialize AutoDefiner/Enhancers (static):",E)}return o.compiled=we({mode:"static",...m,theme:a,enhancers:P}),et({mode:"static",config:m,theme:a,autoDefiner:v}),{config:m,theme:a,autoDefiner:v}}catch(a){throw o.dispatchEvent(new CustomEvent("pds:error",{detail:{error:a}})),a}}var Ut=o.createJSONLocalization({locale:"en-US",locales:["en-US","nl-NL"],aliases:{en:["en-US"],nl:["nl-NL"]},basePath:"/assets/locales"}),nt={mode:"live",liveEdit:!0,preset:"default",localization:Ut,autoDefine:{predefine:["pds-icon","pds-drawer","pds-toaster"]},log(e,t,...n){(this?.mode||this?.compiled?.mode||"live")!=="static"&&(typeof console[e]=="function"?console[e]:console.log)(`[PDS] ${t}`,...n)}};var A={name:"@pure-ds/core",shortname:"pds",version:"0.7.48",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 ot=typeof A.repository=="string"?A.repository:A.repository?.url,Nt=ot?ot.replace(/^git\+/,"").replace(/\.git$/,""):"",hn=A.homepage||Nt,yn=A.bugs?.url||"";document.body.innerHTML=`
|
|
2
|
+
See: https://github.com/Pure-Web-Foundation/pure-ds/blob/main/readme.md#lit-components-not-working`):o.log("warn",`\u26A0\uFE0F PDS component <${h}> not found. Assets may not be installed.`)}else o.log("error",`\u274C Auto-define error for <${h}>:`,b)},..._,mapper:h=>{if(customElements.get(h))return null;if(typeof c=="function")try{let b=c(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 a(E),s.length>0&&typeof a.define=="function"&&await a.define(...s,{baseURL:n,mapper:E.mapper,onError:E.onError})}return{autoDefiner:d,mergedEnhancers:y}}var pe=["light","dark"],fe=new Set(pe);function ht(e){let n=(Array.isArray(e?.themes)?e.themes.map(s=>String(s).toLowerCase()):pe).filter(s=>fe.has(s));return n.length?n:pe}function me(e,{preferDocument:t=!0}={}){let n=String(e||"").toLowerCase();if(fe.has(n))return n;if(t&&typeof document<"u"){let s=document.documentElement?.getAttribute("data-theme");if(fe.has(s))return s}return typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Oe(e,t){let n=me(t);return ht(e).includes(n)}var yt=new Set(["log","warn","error","debug","info"]),gt="__PURE_DS_PDS_SINGLETON__",he=null,ye=null;function Ie(){try{let t=(typeof globalThis<"u"?globalThis:window)?.[gt];if(t&&typeof t=="object")return t}catch{return null}return null}function bt(e){return!e||typeof e!="object"?null:{mode:e.mode==="live"||e.mode==="static"?e.mode:null,debug:e.debug===!0,thisArg:e.thisArg}}function wt(e){if(typeof e!="string")return"log";let t=e.toLowerCase();return yt.has(t)?t:"log"}function St(){if(typeof ye=="function")try{let t=bt(ye());if(t)return t}catch{}let e=Ie();if(e){let t=e?.mode||e?.compiled?.mode||(e?.registry?.isLive?"live":"static"),n=(e?.debug||e?.currentConfig?.debug||e?.currentConfig?.design?.debug||e?.compiled?.debug||e?.compiled?.design?.debug||!1)===!0;return{mode:t,debug:n,thisArg:e}}return{mode:null,debug:!1}}function Lt(){if(typeof he=="function")try{let t=he();if(typeof t=="function")return t}catch{}let e=Ie();return typeof e?.logHandler=="function"?e.logHandler:null}function $e(e,t,...n){if(typeof console>"u")return;let s=typeof console[e]=="function"?console[e].bind(console):typeof console.log=="function"?console.log.bind(console):null;s&&(n.length>0?s(t,...n):s(t))}function _t(e,t){let n=t?.debug===!0;return!(t?.mode==="static"&&!n||!n&&e!=="error"&&e!=="warn")}function Fe({getLogger:e,getContext:t}={}){he=typeof e=="function"?e:null,ye=typeof t=="function"?t:null}function We(e="log",t,...n){let s=wt(e),c=St(),r=Lt();if(r)try{r.call(c?.thisArg,s,t,...n);return}catch(l){$e("error","Custom log handler failed:",l)}_t(s,c)&&$e(s,t,...n)}typeof o.initializing!="boolean"&&(o.initializing=!1);"currentPreset"in o||(o.currentPreset=null);typeof o.debug!="boolean"&&(o.debug=!1);"currentConfig"in o||(o.currentConfig=null);"compiled"in o||(o.compiled=null);typeof o.logHandler!="function"&&(o.logHandler=null);"mode"in o||(o.mode=null);var Q=null,Y=null,Z=null,X=null,ee=null,te=null,Be="__pdsLocalizationRuntime";function T(){if(te)return te;let e=o?.[Be];return e&&typeof e=="object"?(te=e,e):null}function Et(e){let t=e&&typeof e=="object"?e:null;te=t,o[Be]=t}Fe({getLogger:()=>typeof o.logHandler=="function"?o.logHandler:null,getContext:()=>{let e=o?.mode||o?.compiled?.mode||(o?.registry?.isLive?"live":"static"),t=(o?.debug||o?.currentConfig?.debug||o?.currentConfig?.design?.debug||o?.compiled?.debug||o?.compiled?.design?.debug||!1)===!0;return{mode:e,debug:t,thisArg:o}}});o.log=(e="log",t,...n)=>{We(e,t,...n)};var L={locale:"en",messages:{},hasProvider:!1},ne=new Set;function Ke(e){return!!e&&typeof e!="string"&&typeof e=="object"&&"strTag"in e}function Ge(e=[]){let t="";for(let n=0;n<=e.length-1;n+=1)t+=e[n],n<e.length-1&&(t+=`{${n}}`);return t}function vt(e,t){return String(e).replace(/\{(\d+)\}/g,(n,s)=>t(Number(s)))}function jt(e){if(!e||typeof e!="object")return{};let t={};for(let[n,s]of Object.entries(e)){if(typeof s=="string"){t[n]=s;continue}s&&typeof s=="object"&&typeof s.content=="string"&&(t[n]=s.content)}return t}function At(e,...t){return{strTag:!0,strings:Array.from(e||[]),values:t,raw:Array.from(e?.raw||[])}}function Pt(e){if(!e)return"";if(Ke(e)){let n=Ge(e.strings||[]),s=L.messages[n]||n;return vt(s,c=>e.values?.[c])}let t=String(e);return L.messages[t]||t}function kt(e){if(!e)return;let t=Ke(e)?Ge(e.strings||[]):String(e);typeof t=="string"&&t.length>0&&ne.add(t)}function Je(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),Je(n),n}).catch(n=>{throw ee=null,n})),ee)}var C=(e,t={})=>{let n=T();return typeof n?.msg=="function"?n.msg(e,t):(kt(e),Pt(e,t))},se=(e,...t)=>{let n=T();return typeof n?.str=="function"?n.str(e,...t):At(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=jt(e.messages));let n=!!(e.provider||e.translate||e.loadLocale||e.setLocale);return L.hasProvider=n,n&&I().then(s=>{s.configureLocalization(e),Je(s)}).catch(()=>{}),{locale:L.locale,messages:{...L.messages},hasProvider:L.hasProvider}},qe=async e=>(await I()).loadLocale(e),Ve=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(y=>String(y||"").trim().toLowerCase()).filter(Boolean):[],c=Array.from(new Set([n,...s])),r=null,l=async()=>(r||(r=I().then(y=>typeof y?.createJSONLocalization=="function"?y.createJSONLocalization(e):null).catch(()=>null)),r),g=async(y="loadLocale")=>{let d=await l();if(!d||typeof d!="object")return null;let a=d.provider;if(!a||typeof a!="object")return null;let i=a[y];return typeof i=="function"?i:y==="setLocale"&&typeof a.loadLocale=="function"?a.loadLocale:null};return{locale:n,locales:[...c],provider:{locales:[...c],async loadLocale(y={}){let d=await g("loadLocale");return typeof d!="function"?{}:d(y)},async setLocale(y={}){let d=await g("setLocale");return typeof d!="function"?{}:d(y)}}}};function F(e,t){return t&&typeof t=="string"?t:`${V(o.currentConfig||{},{resolvePublicAssetURL:K})}core/${e}`}async function xt(){return Array.isArray(o.defaultEnhancers)&&o.defaultEnhancers.length>0?o.defaultEnhancers:(X||(X=import(F("pds-enhancers.js",o.currentConfig?.enhancersURL)).then(t=>{let n=Array.isArray(t?.defaultPDSEnhancers)?t.defaultPDSEnhancers:[];return o.defaultEnhancers=n,n}).catch(t=>{throw X=null,t})),X)}async function Rt(){return typeof o.ask=="function"&&o.ask!==Ze?o.ask:(Y||(Y=import(F("pds-ask.js",o.currentConfig?.askURL)).then(t=>{let n=t?.ask;if(typeof n!="function")throw new Error("Failed to load ask helper");return o.ask=n,n}).catch(t=>{throw Y=null,t})),Y)}async function W(){return typeof o.toast=="function"&&o.toast!==U?o.toast:(Z||(Z=import(F("pds-toast.js",o.currentConfig?.toastURL)).then(t=>{let n=t?.toast;if(typeof n!="function")throw new Error("Failed to load toast helper");return o.toast=n,n}).catch(t=>{throw Z=null,t})),Z)}async function Ze(...e){return(await Rt())(...e)}async function U(...e){return(await W())(...e)}U.success=async(...e)=>(await W()).success(...e);U.error=async(...e)=>(await W()).error(...e);U.warning=async(...e)=>(await W()).warning(...e);U.info=async(...e)=>(await W()).info(...e);var He=function(e="log",t,...n){o.log(e,t,...n)};function be(e){if(e==null)return e;if(typeof e=="function")return;if(typeof e!="object")return e;if(Array.isArray(e))return e.map(n=>be(n)).filter(n=>n!==void 0);let t={};for(let[n,s]of Object.entries(e)){let c=be(s);c!==void 0&&(t[n]=c)}return t}function Xe(e,t=new WeakSet){if(!e||typeof e!="object"||t.has(e))return e;t.add(e),Object.freeze(e);for(let n of Object.keys(e))Xe(e[n],t);return e}function we(e){return e==null||typeof e!="object"?e:Xe(structuredClone(be(e)))}async function Dt(e,t={}){if(t?.runtimeConfig===!1||typeof fetch!="function")return null;let n=t?.runtimeConfigURL||`${e}pds-runtime-config.json`;try{let s=await fetch(n,{cache:"no-store"});return s.ok?await s.json():null}catch{return null}}o.registry=z;o.enums=xe;o.adoptLayers=Pe;o.adoptPrimitives=Ae;o.parse=de;o.createStylesheet=ke;o.isLiveMode=()=>z.isLive;o.ask=Ze;o.toast=U;o.common=ue;o.msg=C;o.str=se;o.configureLocalization=oe;o.loadLocale=qe;o.setLocale=Ve;o.getLocalizationState=Qe;o.createJSONLocalization=Ye;o.i18n={msg:C,str:se,configure:oe,loadLocale:qe,setLocale:Ve,getState:Qe,createJSONLocalization:Ye};o.AutoComplete=null;o.loadAutoComplete=async()=>{if(o.AutoComplete&&typeof o.AutoComplete.connect=="function")return o.AutoComplete;let e=F("pds-autocomplete.js",o.currentConfig?.autoCompleteURL);return Q||(Q=import(e).then(t=>{let n=t?.AutoComplete||t?.default?.AutoComplete||t?.default||null;if(!n)throw new Error("AutoComplete export not found in module");return o.AutoComplete=n,n}).catch(t=>{throw Q=null,t})),Q};function et(e){let t=typeof CustomEvent=="function";try{let n=t?new CustomEvent("pds:ready",{detail:e}):new Event("pds:ready");o.dispatchEvent(n)}catch{}if(typeof document<"u")if(t){let n={detail:e,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:ready",n))}catch{}try{document.dispatchEvent(new CustomEvent("pds-ready",n))}catch{}}else{try{document.dispatchEvent(new Event("pds:ready"))}catch{}try{document.dispatchEvent(new Event("pds-ready"))}catch{}}}function tt(e={}){let t=typeof CustomEvent=="function",n={at:Date.now(),...e};try{let s=t?new CustomEvent("pds:config-changed",{detail:n}):new Event("pds:config-changed");o.dispatchEvent(s)}catch{}if(typeof document<"u")if(t){let s={detail:n,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:config-changed",s))}catch{}}else try{document.dispatchEvent(new Event("pds:config-changed"))}catch{}}var ge="pure-ds-theme",x=null,$=null;function Se(e){try{if(typeof document>"u")return;let t="light";e?e==="system"?t=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t=e:t=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",document.documentElement.setAttribute("data-theme",t)}catch{}}function Le(e){try{if(x&&$){try{typeof x.removeEventListener=="function"?x.removeEventListener("change",$):typeof x.removeListener=="function"&&x.removeListener($)}catch{}x=null,$=null}if(e==="system"&&typeof window<"u"&&window.matchMedia){let t=window.matchMedia("(prefers-color-scheme: dark)"),n=s=>{let c=s?.matches===void 0?t.matches:s.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,$=n,typeof t.addEventListener=="function"?t.addEventListener("change",n):typeof t.addListener=="function"&&t.addListener(n)}}catch{}}var zt=Object.getOwnPropertyDescriptor(o,"theme");zt||Object.defineProperty(o,"theme",{get(){try{return typeof window>"u"?null:localStorage.getItem(ge)||null}catch{return null}},set(e){try{if(typeof window>"u")return;let t=o.currentConfig?.design||null,n=me(e);if(t&&!Oe(t,n)){let s=t?.name||o.currentPreset?.name||o.currentConfig?.preset||"current preset";o.log("warn",`PDS theme "${n}" not supported by preset "${s}".`),o.dispatchEvent(new CustomEvent("pds:theme:blocked",{detail:{theme:e,resolvedTheme:n,preset:s}}));return}e==null?localStorage.removeItem(ge):localStorage.setItem(ge,e),Se(e),Le(e),o.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:e,source:"api"}}))}catch{}}});o.defaultEnhancers=[];async function Tt(e){o.initializing=!0;try{let t=e&&e.mode||"live",{mode:n,...s}=e||{};o.mode=t,o.logHandler=typeof s?.log=="function"?s.log:null,o.currentConfig=we(s);let c=s&&typeof s.localization=="object"&&s.localization?s.localization:null;c?(await I(),oe(c)):oe(null);let r;if(t==="static")r=await Ct(s);else{let{localization:g,...y}=s||{},d=V(y,{resolvePublicAssetURL:K}),a=y?.managerURL||y?.public?.managerURL||y?.manager?.url||new URL("core/pds-manager.js",d).href||new URL("./pds-manager.js",import.meta.url).href,{startLive:i}=await import(a);r=await i(o,y,{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",c=e.staticPaths??{},r=V(e,{resolvePublicAssetURL:K}),l=e&&e.autoDefine||null,g;l&&l.baseURL?g=J(q(l.baseURL,{preferModule:!1})):g=`${r}components/`;let y=l&&Array.isArray(l.predefine)&&l.predefine||[],d=l&&typeof l.mapper=="function"&&l.mapper||null;try{Ue(o);let{resolvedTheme:a}=Me({manageTheme:n,themeStorageKey:s,applyResolvedTheme:Se,setupSystemListenerIfNeeded:Le}),i=await Dt(r,e),w=Array.isArray(e?.enhancers)?e.enhancers:e?.enhancers&&typeof e.enhancers=="object"?Object.values(e.enhancers):[],m=i?.config?{...i.config,...e,design:e?.design||i.config.design,preset:e?.preset||i.config.preset}:{...e},_={tokens:`${r}styles/pds-tokens.css.js`,primitives:`${r}styles/pds-primitives.css.js`,components:`${r}styles/pds-components.css.js`,utilities:`${r}styles/pds-utilities.css.js`,styles:`${r}styles/pds-styles.css.js`},S=i?.paths||{};if(c={..._,...S,...c},o.registry.setStaticMode(c),t&&typeof document<"u")try{let E=await o.registry.getStylesheet("styles");if(E){E._pds=!0;let h=(document.adoptedStyleSheets||[]).filter(b=>b._pds!==!0);document.adoptedStyleSheets=[...h,E],tt({mode:"static",source:"static:styles-applied"})}}catch(E){He.call(o,"warn","Failed to apply static styles:",E)}let v=null,P=[];try{let E=await xt(),h=await Ne({autoDefineBaseURL:g,autoDefinePreload:y,autoDefineMapper:d,enhancers:w,autoDefineOverrides:l||null,autoDefinePreferModule:!(l&&l.baseURL)},{baseEnhancers:E});v=h.autoDefiner,P=h.mergedEnhancers||[]}catch(E){He.call(o,"error","\u274C Failed to initialize AutoDefiner/Enhancers (static):",E)}return o.compiled=we({mode:"static",...m,theme:a,enhancers:P}),et({mode:"static",config:m,theme:a,autoDefiner:v}),{config:m,theme:a,autoDefiner:v}}catch(a){throw o.dispatchEvent(new CustomEvent("pds:error",{detail:{error:a}})),a}}var Ut=o.createJSONLocalization({locale:"en-US",locales:["en-US","nl-NL"],aliases:{en:["en-US"],nl:["nl-NL"]},basePath:"/assets/locales"}),nt={mode:"live",liveEdit:!0,preset:"default",localization:Ut,autoDefine:{predefine:["pds-icon","pds-drawer","pds-toaster"]},log(e,t,...n){(this?.mode||this?.compiled?.mode||"live")!=="static"&&(typeof console[e]=="function"?console[e]:console.log)(`[PDS] ${t}`,...n)}};var A={name:"@pure-ds/core",shortname:"pds",version:"0.7.49",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 ot=typeof A.repository=="string"?A.repository:A.repository?.url,Nt=ot?ot.replace(/^git\+/,"").replace(/\.git$/,""):"",hn=A.homepage||Nt,yn=A.bugs?.url||"";document.body.innerHTML=`
|
|
3
3
|
<div class="container text-center">
|
|
4
4
|
<img src="/assets/img/pds-logo.svg" alt="PDS Logo" title="${C("PDS Logo")}" width="64" height="64" />
|
|
5
5
|
<header class="container section">
|
|
@@ -39,8 +39,8 @@ export class AppToaster extends HTMLElement {
|
|
|
39
39
|
|
|
40
40
|
// Listen for global toast events
|
|
41
41
|
this._handleToastEvent = (e) => {
|
|
42
|
-
const { message, type, duration, closable, persistent } = e.detail;
|
|
43
|
-
this.toast(message, { type, duration, closable, persistent });
|
|
42
|
+
const { message, type, title, duration, closable, persistent, html, action } = e.detail;
|
|
43
|
+
this.toast(message, { type, title, duration, closable, persistent, html, action });
|
|
44
44
|
};
|
|
45
45
|
PDS.addEventListener('pds:toast', this._handleToastEvent);
|
|
46
46
|
|
|
@@ -210,6 +210,7 @@ export class AppToaster extends HTMLElement {
|
|
|
210
210
|
* @param {string} message - The message to display
|
|
211
211
|
* @param {Object} [options] - Toast configuration
|
|
212
212
|
* @param {"information"|"success"|"warning"|"error"} [options.type="information"] - Toast type
|
|
213
|
+
* @param {string} [options.title] - Optional heading text (falls back to type-based title when empty)
|
|
213
214
|
* @param {number} [options.duration] - Duration in ms (auto-calculated if not provided)
|
|
214
215
|
* @param {boolean} [options.closable=true] - Whether toast can be closed manually
|
|
215
216
|
* @param {boolean} [options.persistent=false] - If true, toast doesn't auto-dismiss
|
|
@@ -218,6 +219,7 @@ export class AppToaster extends HTMLElement {
|
|
|
218
219
|
toast(message, options = {}) {
|
|
219
220
|
const defaults = {
|
|
220
221
|
type: "information", // information, success, warning, error
|
|
222
|
+
title: null,
|
|
221
223
|
duration: null, // auto-calculated based on reading time
|
|
222
224
|
closable: true,
|
|
223
225
|
persistent: false, // if true, doesn't auto-dismiss
|
|
@@ -265,6 +267,7 @@ export class AppToaster extends HTMLElement {
|
|
|
265
267
|
toastId,
|
|
266
268
|
message,
|
|
267
269
|
config.type,
|
|
270
|
+
config.title,
|
|
268
271
|
config.closable,
|
|
269
272
|
duration,
|
|
270
273
|
config.persistent,
|
|
@@ -298,12 +301,13 @@ export class AppToaster extends HTMLElement {
|
|
|
298
301
|
* @param {string} id
|
|
299
302
|
* @param {string} message
|
|
300
303
|
* @param {"information"|"success"|"warning"|"error"} type
|
|
304
|
+
* @param {string|null|undefined} title
|
|
301
305
|
* @param {boolean} closable
|
|
302
306
|
* @param {number} duration
|
|
303
307
|
* @param {boolean} persistent
|
|
304
308
|
* @returns {HTMLElement}
|
|
305
309
|
*/
|
|
306
|
-
createToastElement(id, message, type, closable, duration, persistent, html = false, action = null) {
|
|
310
|
+
createToastElement(id, message, type, title, closable, duration, persistent, html = false, action = null) {
|
|
307
311
|
const toast = document.createElement("aside");
|
|
308
312
|
toast.className = `toast callout ${this.#getAlertClass(type)}`;
|
|
309
313
|
toast.setAttribute("data-toast-id", id);
|
|
@@ -318,9 +322,9 @@ export class AppToaster extends HTMLElement {
|
|
|
318
322
|
const content = document.createElement("div");
|
|
319
323
|
content.className = "toast-content";
|
|
320
324
|
|
|
321
|
-
const
|
|
322
|
-
|
|
323
|
-
|
|
325
|
+
const titleElement = document.createElement("div");
|
|
326
|
+
titleElement.className = "callout-title";
|
|
327
|
+
titleElement.textContent = this.#resolveToastTitle(type, title);
|
|
324
328
|
|
|
325
329
|
const text = document.createElement("p");
|
|
326
330
|
text.style.margin = "0";
|
|
@@ -330,7 +334,7 @@ export class AppToaster extends HTMLElement {
|
|
|
330
334
|
text.textContent = String(message || "");
|
|
331
335
|
}
|
|
332
336
|
|
|
333
|
-
content.appendChild(
|
|
337
|
+
content.appendChild(titleElement);
|
|
334
338
|
content.appendChild(text);
|
|
335
339
|
|
|
336
340
|
if (action && typeof action === "object" && action.label) {
|
|
@@ -486,6 +490,20 @@ export class AppToaster extends HTMLElement {
|
|
|
486
490
|
return titles[type] || titles.information;
|
|
487
491
|
}
|
|
488
492
|
|
|
493
|
+
/**
|
|
494
|
+
* Resolve toast heading: custom title first, then localized type-based fallback.
|
|
495
|
+
* @param {"information"|"success"|"warning"|"error"} type
|
|
496
|
+
* @param {string|null|undefined} title
|
|
497
|
+
* @returns {string}
|
|
498
|
+
*/
|
|
499
|
+
#resolveToastTitle(type, title) {
|
|
500
|
+
const normalizedCustomTitle = typeof title === "string" ? title.trim() : "";
|
|
501
|
+
if (normalizedCustomTitle) {
|
|
502
|
+
return normalizedCustomTitle;
|
|
503
|
+
}
|
|
504
|
+
return this.#getToastTitle(type);
|
|
505
|
+
}
|
|
506
|
+
|
|
489
507
|
/**
|
|
490
508
|
* Resolve toast type to an alert utility class name.
|
|
491
509
|
* @param {"information"|"success"|"warning"|"error"} type
|
package/src/js/common/toast.js
CHANGED
|
@@ -28,6 +28,7 @@ async function ensureToaster() {
|
|
|
28
28
|
* @param {string} message - The message to display
|
|
29
29
|
* @param {Object} [options={}] - Toast configuration
|
|
30
30
|
* @param {"information"|"success"|"warning"|"error"} [options.type="information"] - Toast type/severity
|
|
31
|
+
* @param {string} [options.title] - Optional heading override (falls back to type label when empty)
|
|
31
32
|
* @param {number} [options.duration] - Duration in milliseconds (auto-calculated if not provided based on message length)
|
|
32
33
|
* @param {boolean} [options.closable=true] - Whether the toast can be manually closed
|
|
33
34
|
* @param {boolean} [options.persistent=false] - If true, toast won't auto-dismiss (requires manual close)
|
|
@@ -47,6 +48,13 @@ async function ensureToaster() {
|
|
|
47
48
|
* });
|
|
48
49
|
*
|
|
49
50
|
* @example
|
|
51
|
+
* // Custom title overrides type-derived heading
|
|
52
|
+
* await PDS.toast('Feature coming soon...', {
|
|
53
|
+
* type: 'information',
|
|
54
|
+
* title: 'Qogni'
|
|
55
|
+
* });
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
50
58
|
* // Persistent warning (must be manually closed)
|
|
51
59
|
* await PDS.toast('This action cannot be undone', {
|
|
52
60
|
* type: 'warning',
|
package/src/js/pds.d.ts
CHANGED
|
@@ -391,6 +391,7 @@ export class PDS extends EventTarget {
|
|
|
391
391
|
* @param message - The message to display
|
|
392
392
|
* @param options - Toast configuration
|
|
393
393
|
* @param options.type - Toast type/severity ("information" | "success" | "warning" | "error")
|
|
394
|
+
* @param options.title - Optional heading override (falls back to type label when empty)
|
|
394
395
|
* @param options.duration - Duration in milliseconds (auto-calculated if not provided)
|
|
395
396
|
* @param options.closable - Whether toast can be manually closed (default: true)
|
|
396
397
|
* @param options.persistent - If true, toast won't auto-dismiss (default: false)
|
|
@@ -406,6 +407,7 @@ export class PDS extends EventTarget {
|
|
|
406
407
|
message: string,
|
|
407
408
|
options?: {
|
|
408
409
|
type?: 'information' | 'success' | 'warning' | 'error';
|
|
410
|
+
title?: string;
|
|
409
411
|
duration?: number;
|
|
410
412
|
closable?: boolean;
|
|
411
413
|
persistent?: boolean;
|
|
@@ -423,11 +425,11 @@ export class PDS extends EventTarget {
|
|
|
423
425
|
* await PDS.toast.success('Profile updated!');
|
|
424
426
|
*/
|
|
425
427
|
static toast: {
|
|
426
|
-
(message: string, options?: { type?: 'information' | 'success' | 'warning' | 'error'; duration?: number; closable?: boolean; persistent?: boolean }): Promise<string>;
|
|
427
|
-
success(message: string, options?: { duration?: number; closable?: boolean; persistent?: boolean }): Promise<string>;
|
|
428
|
-
error(message: string, options?: { duration?: number; closable?: boolean; persistent?: boolean }): Promise<string>;
|
|
429
|
-
warning(message: string, options?: { duration?: number; closable?: boolean; persistent?: boolean }): Promise<string>;
|
|
430
|
-
info(message: string, options?: { duration?: number; closable?: boolean; persistent?: boolean }): Promise<string>;
|
|
428
|
+
(message: string, options?: { type?: 'information' | 'success' | 'warning' | 'error'; title?: string; duration?: number; closable?: boolean; persistent?: boolean }): Promise<string>;
|
|
429
|
+
success(message: string, options?: { title?: string; duration?: number; closable?: boolean; persistent?: boolean }): Promise<string>;
|
|
430
|
+
error(message: string, options?: { title?: string; duration?: number; closable?: boolean; persistent?: boolean }): Promise<string>;
|
|
431
|
+
warning(message: string, options?: { title?: string; duration?: number; closable?: boolean; persistent?: boolean }): Promise<string>;
|
|
432
|
+
info(message: string, options?: { title?: string; duration?: number; closable?: boolean; persistent?: boolean }): Promise<string>;
|
|
431
433
|
};
|
|
432
434
|
|
|
433
435
|
/**
|