@pure-ds/core 0.7.52 → 0.7.54
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 +21 -7
- package/dist/types/public/assets/pds/components/pds-toaster.d.ts +12 -2
- package/dist/types/public/assets/pds/components/pds-toaster.d.ts.map +1 -1
- package/dist/types/src/js/common/common.d.ts +11 -0
- package/dist/types/src/js/common/common.d.ts.map +1 -1
- package/dist/types/src/js/common/toast.d.ts +20 -10
- package/dist/types/src/js/common/toast.d.ts.map +1 -1
- package/dist/types/src/js/pds.d.ts +5 -0
- package/dist/types/src/js/pds.d.ts.map +1 -1
- package/package.json +1 -1
- package/packages/pds-cli/bin/templates/bootstrap/src/js/app.js +21 -27
- package/public/assets/js/app.js +5 -5
- package/public/assets/js/pds-ask.js +9 -9
- package/public/assets/js/pds-manager.js +79 -79
- package/public/assets/js/pds.js +2 -2
- package/public/assets/pds/components/pds-toaster.js +22 -1
- package/public/assets/pds/core/pds-ask.js +9 -9
- package/public/assets/pds/core/pds-manager.js +79 -79
- package/public/assets/pds/core.js +2 -2
- package/src/js/common/common.js +45 -20
- package/src/js/common/toast.js +14 -5
- package/src/js/pds-core/pds-enhancers-meta.js +135 -135
- package/src/js/pds.d.ts +21 -7
- package/src/js/pds.js +7 -2
package/dist/types/pds.d.ts
CHANGED
|
@@ -283,6 +283,13 @@ export interface AskOptions {
|
|
|
283
283
|
[key: string]: any;
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
+
export type PDSParseTemplateLike = TemplateStringsArray | {
|
|
287
|
+
strings: string[];
|
|
288
|
+
values: unknown[];
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
export type PDSParseInput = string | PDSParseTemplateLike;
|
|
292
|
+
|
|
286
293
|
export class PDS extends EventTarget {
|
|
287
294
|
// Static surface
|
|
288
295
|
static registry: PDSRegistry;
|
|
@@ -332,7 +339,8 @@ export class PDS extends EventTarget {
|
|
|
332
339
|
static ontology?: any;
|
|
333
340
|
static enums?: Record<string, any>;
|
|
334
341
|
static common?: Record<string, any>;
|
|
335
|
-
static parse?: (html:
|
|
342
|
+
static parse?: (html: PDSParseInput, ...values: unknown[]) => NodeListOf<ChildNode>;
|
|
343
|
+
static html?: (html: PDSParseInput, ...values: unknown[]) => DocumentFragment;
|
|
336
344
|
static msg: (template: string | PDSStrResult, options?: Record<string, any>) => string;
|
|
337
345
|
static str: (strings: TemplateStringsArray, ...values: any[]) => PDSStrResult;
|
|
338
346
|
static configureLocalization: (config?: PDSLocalizationConfig | null) => {
|
|
@@ -395,7 +403,8 @@ export class PDS extends EventTarget {
|
|
|
395
403
|
* @param options.duration - Duration in milliseconds (auto-calculated if not provided)
|
|
396
404
|
* @param options.closable - Whether toast can be manually closed (default: true)
|
|
397
405
|
* @param options.persistent - If true, toast won't auto-dismiss (default: false)
|
|
398
|
-
|
|
406
|
+
* @param options.returnToastElement - If true, returns the live toast element instead of the toast ID
|
|
407
|
+
* @returns Toast ID (default), or live toast element when returnToastElement is true
|
|
399
408
|
*
|
|
400
409
|
* @example
|
|
401
410
|
* await PDS.toast('Changes saved!', { type: 'success' });
|
|
@@ -411,6 +420,7 @@ export class PDS extends EventTarget {
|
|
|
411
420
|
duration?: number;
|
|
412
421
|
closable?: boolean;
|
|
413
422
|
persistent?: boolean;
|
|
423
|
+
returnToastElement?: false;
|
|
414
424
|
}
|
|
415
425
|
): Promise<string>;
|
|
416
426
|
|
|
@@ -425,11 +435,12 @@ export class PDS extends EventTarget {
|
|
|
425
435
|
* await PDS.toast.success('Profile updated!');
|
|
426
436
|
*/
|
|
427
437
|
static toast: {
|
|
428
|
-
(message: string, options
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
438
|
+
(message: string, options: { type?: 'information' | 'success' | 'warning' | 'error'; title?: string; duration?: number; closable?: boolean; persistent?: boolean; returnToastElement: true }): Promise<HTMLElement | null>;
|
|
439
|
+
(message: string, options?: { type?: 'information' | 'success' | 'warning' | 'error'; title?: string; duration?: number; closable?: boolean; persistent?: boolean; returnToastElement?: false }): Promise<string>;
|
|
440
|
+
success(message: string, options?: { title?: string; duration?: number; closable?: boolean; persistent?: boolean; returnToastElement?: boolean }): Promise<string | HTMLElement | null>;
|
|
441
|
+
error(message: string, options?: { title?: string; duration?: number; closable?: boolean; persistent?: boolean; returnToastElement?: boolean }): Promise<string | HTMLElement | null>;
|
|
442
|
+
warning(message: string, options?: { title?: string; duration?: number; closable?: boolean; persistent?: boolean; returnToastElement?: boolean }): Promise<string | HTMLElement | null>;
|
|
443
|
+
info(message: string, options?: { title?: string; duration?: number; closable?: boolean; persistent?: boolean; returnToastElement?: boolean }): Promise<string | HTMLElement | null>;
|
|
433
444
|
};
|
|
434
445
|
|
|
435
446
|
/**
|
|
@@ -740,3 +751,6 @@ export class SchemaForm extends HTMLElement {
|
|
|
740
751
|
options?: boolean | EventListenerOptions
|
|
741
752
|
): void;
|
|
742
753
|
}
|
|
754
|
+
|
|
755
|
+
export function parse(html: PDSParseInput, ...values: unknown[]): NodeListOf<ChildNode>;
|
|
756
|
+
export function html(html: PDSParseInput, ...values: unknown[]): DocumentFragment;
|
|
@@ -44,7 +44,8 @@ export class AppToaster extends HTMLElement {
|
|
|
44
44
|
* @param {number} [options.duration] - Duration in ms (auto-calculated if not provided)
|
|
45
45
|
* @param {boolean} [options.closable=true] - Whether toast can be closed manually
|
|
46
46
|
* @param {boolean} [options.persistent=false] - If true, toast doesn't auto-dismiss
|
|
47
|
-
* @
|
|
47
|
+
* @param {boolean} [options.returnToastElement=false] - If true, return the toast element instead of toast ID
|
|
48
|
+
* @returns {string|HTMLElement|null} Toast ID by default, or toast element when returnToastElement is true
|
|
48
49
|
*/
|
|
49
50
|
public toast(message: string, options?: {
|
|
50
51
|
type?: "information" | "success" | "warning" | "error";
|
|
@@ -52,7 +53,16 @@ export class AppToaster extends HTMLElement {
|
|
|
52
53
|
duration?: number;
|
|
53
54
|
closable?: boolean;
|
|
54
55
|
persistent?: boolean;
|
|
55
|
-
|
|
56
|
+
returnToastElement?: boolean;
|
|
57
|
+
}): string | HTMLElement | null;
|
|
58
|
+
/**
|
|
59
|
+
* Get toast element by ID.
|
|
60
|
+
* @method getToastElement
|
|
61
|
+
* @public
|
|
62
|
+
* @param {string} toastId - Toast ID
|
|
63
|
+
* @returns {HTMLElement|null} Matching toast element or null if not found
|
|
64
|
+
*/
|
|
65
|
+
public getToastElement(toastId: string): HTMLElement | null;
|
|
56
66
|
/**
|
|
57
67
|
* Build a DOM node representing a single toast notification.
|
|
58
68
|
* @param {string} id
|
|
@@ -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;;;;;;;;;;;;;OAaG;IACH,sBAVW,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;QACW,kBAAkB,GAApC,OAAO;KACf,GAAU,MAAM,GAAC,WAAW,GAAC,IAAI,CA8CnC;IAED;;;;;;OAMG;IACH,gCAHW,MAAM,GACJ,WAAW,GAAC,IAAI,CAI5B;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"}
|
|
@@ -9,6 +9,17 @@ export function fragmentFromTemplateLike(templateLike: {
|
|
|
9
9
|
strings: string[];
|
|
10
10
|
values: unknown[];
|
|
11
11
|
}): DocumentFragment;
|
|
12
|
+
/**
|
|
13
|
+
* Parses either an HTML string or tagged template into a DocumentFragment.
|
|
14
|
+
* Useful when you want direct appendChild(fragment) ergonomics.
|
|
15
|
+
* @param {string | TemplateStringsArray | {strings: string[], values: unknown[]}} html
|
|
16
|
+
* @param {...unknown} values
|
|
17
|
+
* @returns {DocumentFragment}
|
|
18
|
+
*/
|
|
19
|
+
export function parseFragment(html: string | TemplateStringsArray | {
|
|
20
|
+
strings: string[];
|
|
21
|
+
values: unknown[];
|
|
22
|
+
}, ...values: unknown[]): DocumentFragment;
|
|
12
23
|
/**
|
|
13
24
|
* Parses either an HTML string or a tagged template into DOM nodes.
|
|
14
25
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../src/js/common/common.js"],"names":[],"mappings":"AAAA,6CAEC;AAED,yDAeG;AAEH;;;;GAIG;AACH,uDAHW;IAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,OAAO,EAAE,CAAA;CAAC,GACpC,gBAAgB,
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../src/js/common/common.js"],"names":[],"mappings":"AAAA,6CAEC;AAED,yDAeG;AAEH;;;;GAIG;AACH,uDAHW;IAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,OAAO,EAAE,CAAA;CAAC,GACpC,gBAAgB,CAuK5B;AAED;;;;;;GAMG;AACH,oCAJW,MAAM,GAAG,oBAAoB,GAAG;IAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,OAAO,EAAE,CAAA;CAAC,aACnE,OAAO,EAAA,GACR,gBAAgB,CAiB5B;AAED;;;;;;;;;;;;;;GAcG;AACH,gCAJW,MAAM,GAAG,oBAAoB,GAAG;IAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,OAAO,EAAE,CAAA;CAAC,aACnE,OAAO,EAAA,GACR,UAAU,CAAC,SAAS,CAAC,CAIjC"}
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
* @param {boolean} [options.persistent=false] - If true, toast won't auto-dismiss (requires manual close)
|
|
15
15
|
* @param {boolean} [options.html=false] - Render `message` as HTML (trusted content only)
|
|
16
16
|
* @param {{label: string, onClick?: Function, dismissOnClick?: boolean}} [options.action] - Optional action button config
|
|
17
|
-
* @
|
|
17
|
+
* @param {boolean} [options.returnToastElement=false] - If true, resolves to the rendered toast element instead of toast ID
|
|
18
|
+
* @returns {Promise<string|HTMLElement|null>} Toast ID by default, or toast element when returnToastElement is true
|
|
18
19
|
*
|
|
19
20
|
* @example
|
|
20
21
|
* // Simple success toast
|
|
@@ -47,6 +48,14 @@
|
|
|
47
48
|
* // ... later
|
|
48
49
|
* const toaster = document.querySelector('pds-toaster');
|
|
49
50
|
* toaster.dismissToast(toastId);
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* // Get toast element directly for live updates
|
|
54
|
+
* const toastEl = await PDS.toast('Syncing draft... 0%', {
|
|
55
|
+
* persistent: true,
|
|
56
|
+
* returnToastElement: true
|
|
57
|
+
* });
|
|
58
|
+
* toastEl?.querySelector('.toast-content p').textContent = 'Syncing draft... 35%';
|
|
50
59
|
*/
|
|
51
60
|
export function toast(message: string, options?: {
|
|
52
61
|
type?: "information" | "success" | "warning" | "error";
|
|
@@ -60,51 +69,52 @@ export function toast(message: string, options?: {
|
|
|
60
69
|
onClick?: Function;
|
|
61
70
|
dismissOnClick?: boolean;
|
|
62
71
|
};
|
|
63
|
-
|
|
72
|
+
returnToastElement?: boolean;
|
|
73
|
+
}): Promise<string | HTMLElement | null>;
|
|
64
74
|
export namespace toast {
|
|
65
75
|
/**
|
|
66
76
|
* Display a success toast (convenience method)
|
|
67
77
|
*
|
|
68
78
|
* @param {string} message - The success message
|
|
69
79
|
* @param {Object} [options={}] - Additional toast options (type is preset to 'success')
|
|
70
|
-
* @returns {Promise<string>} Toast ID
|
|
80
|
+
* @returns {Promise<string|HTMLElement|null>} Toast ID by default, or toast element when returnToastElement is true
|
|
71
81
|
*
|
|
72
82
|
* @example
|
|
73
83
|
* await PDS.toast.success('Profile updated!');
|
|
74
84
|
*/
|
|
75
|
-
function success(message: string, options?: any): Promise<string>;
|
|
85
|
+
function success(message: string, options?: any): Promise<string | HTMLElement | null>;
|
|
76
86
|
/**
|
|
77
87
|
* Display an error toast (convenience method)
|
|
78
88
|
*
|
|
79
89
|
* @param {string} message - The error message
|
|
80
90
|
* @param {Object} [options={}] - Additional toast options (type is preset to 'error')
|
|
81
|
-
* @returns {Promise<string>} Toast ID
|
|
91
|
+
* @returns {Promise<string|HTMLElement|null>} Toast ID by default, or toast element when returnToastElement is true
|
|
82
92
|
*
|
|
83
93
|
* @example
|
|
84
94
|
* await PDS.toast.error('Failed to connect to server');
|
|
85
95
|
*/
|
|
86
|
-
function error(message: string, options?: any): Promise<string>;
|
|
96
|
+
function error(message: string, options?: any): Promise<string | HTMLElement | null>;
|
|
87
97
|
/**
|
|
88
98
|
* Display a warning toast (convenience method)
|
|
89
99
|
*
|
|
90
100
|
* @param {string} message - The warning message
|
|
91
101
|
* @param {Object} [options={}] - Additional toast options (type is preset to 'warning')
|
|
92
|
-
* @returns {Promise<string>} Toast ID
|
|
102
|
+
* @returns {Promise<string|HTMLElement|null>} Toast ID by default, or toast element when returnToastElement is true
|
|
93
103
|
*
|
|
94
104
|
* @example
|
|
95
105
|
* await PDS.toast.warning('Session will expire in 5 minutes');
|
|
96
106
|
*/
|
|
97
|
-
function warning(message: string, options?: any): Promise<string>;
|
|
107
|
+
function warning(message: string, options?: any): Promise<string | HTMLElement | null>;
|
|
98
108
|
/**
|
|
99
109
|
* Display an information toast (convenience method)
|
|
100
110
|
*
|
|
101
111
|
* @param {string} message - The information message
|
|
102
112
|
* @param {Object} [options={}] - Additional toast options (type is preset to 'information')
|
|
103
|
-
* @returns {Promise<string>} Toast ID
|
|
113
|
+
* @returns {Promise<string|HTMLElement|null>} Toast ID by default, or toast element when returnToastElement is true
|
|
104
114
|
*
|
|
105
115
|
* @example
|
|
106
116
|
* await PDS.toast.info('New features available!');
|
|
107
117
|
*/
|
|
108
|
-
function info(message: string, options?: any): Promise<string>;
|
|
118
|
+
function info(message: string, options?: any): Promise<string | HTMLElement | null>;
|
|
109
119
|
}
|
|
110
120
|
//# sourceMappingURL=toast.d.ts.map
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,+BApDW,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;IAC3C,kBAAkB,GAApC,OAAO;CACf,GAAU,OAAO,CAAC,MAAM,GAAC,WAAW,GAAC,IAAI,CAAC,CA6C5C;;IAED;;;;;;;;;OASG;IACH,0BAPW,MAAM,kBAEJ,OAAO,CAAC,MAAM,GAAC,WAAW,GAAC,IAAI,CAAC,CAO5C;IAED;;;;;;;;;OASG;IACH,wBAPW,MAAM,kBAEJ,OAAO,CAAC,MAAM,GAAC,WAAW,GAAC,IAAI,CAAC,CAO5C;IAED;;;;;;;;;OASG;IACH,0BAPW,MAAM,kBAEJ,OAAO,CAAC,MAAM,GAAC,WAAW,GAAC,IAAI,CAAC,CAO5C;IAED;;;;;;;;;OASG;IACH,uBAPW,MAAM,kBAEJ,OAAO,CAAC,MAAM,GAAC,WAAW,GAAC,IAAI,CAAC,CAO5C"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/** Parse HTML strings or tagged templates into a NodeList */
|
|
2
|
+
export const parse: typeof common.parseHTML;
|
|
3
|
+
/** Parse HTML or tagged templates into a DocumentFragment */
|
|
4
|
+
export const html: typeof common.parseFragment;
|
|
1
5
|
export function applyResolvedTheme(raw: any): void;
|
|
2
6
|
export function setupSystemListenerIfNeeded(raw: any): void;
|
|
3
7
|
/**
|
|
@@ -42,6 +46,7 @@ export type PDSAPI = {
|
|
|
42
46
|
*/
|
|
43
47
|
createStylesheet: (css: string) => CSSStyleSheet;
|
|
44
48
|
};
|
|
49
|
+
import * as common from "./common/common.js";
|
|
45
50
|
import { PDS } from "./pds-singleton.js";
|
|
46
51
|
export function msg(template: any, options?: {}): any;
|
|
47
52
|
export function str(strings: any, ...values: any[]): any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pds.d.ts","sourceRoot":"","sources":["../../../../src/js/pds.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pds.d.ts","sourceRoot":"","sources":["../../../../src/js/pds.js"],"names":[],"mappings":"AAgoBA,6DAA6D;AAC7D,4CAAsC;AAGtC,6DAA6D;AAC7D,+CAAyC;AAsIzC,mDAsBC;AAGD,4DAuCC;;;;;;;;;;;;;;;;;;;;;;;;;cApzBa,OAAO,4BAA4B,EAAE,WAAW;;;;iBAChD,CAAC,SAAS,CAAC,EAAE,OAAO,6BAA6B,EAAE,SAAS,KAAK,IAAI;;;;iBACrE,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,gBAAgB,CAAC,EAAE,aAAa,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC;;;;qBAChG,CAAC,UAAU,EAAE,UAAU,EAAE,gBAAgB,CAAC,EAAE,aAAa,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC;;;;sBAC7E,CAAC,GAAG,EAAC,MAAM,KAAK,aAAa;;wBAqCnB,oBAAoB;oBAhCxB,oBAAoB;AAyPxC,sDAOC;AAED,yDAMC;AAED,yDA+CC;AAED,sDAGC;AAED,mEAGC;AAED,4CAUC;AAED,0DA+EC"}
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PDS } from "@pure-ds/core";
|
|
1
|
+
import { PDS, html } from "@pure-ds/core";
|
|
2
2
|
import { config } from "../../pds.config.js";
|
|
3
3
|
|
|
4
4
|
await PDS.start(config);
|
|
@@ -8,41 +8,35 @@ if (main && !main.querySelector("my-home")) {
|
|
|
8
8
|
main.innerHTML = "<my-home></my-home>";
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
const
|
|
12
|
-
|
|
11
|
+
const openSettingsDrawer = () => {
|
|
12
|
+
const drawer = document.getElementById("settings-drawer");
|
|
13
|
+
if (drawer) drawer.open = true;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
document.body.appendChild(html`
|
|
17
|
+
<button
|
|
18
|
+
id="settings-btn"
|
|
19
|
+
class="icon-only btn-xs btn-outline"
|
|
20
|
+
aria-label="Settings"
|
|
21
|
+
@click=${openSettingsDrawer}
|
|
22
|
+
>
|
|
13
23
|
<pds-icon icon="gear"></pds-icon>
|
|
14
|
-
</button
|
|
15
|
-
)[0];
|
|
24
|
+
</button>
|
|
16
25
|
|
|
17
|
-
|
|
26
|
+
<pds-drawer id="settings-drawer" position="right" .open=${false}>
|
|
27
|
+
<div slot="drawer-header">Settings</div>
|
|
28
|
+
<div slot="drawer-content"><pds-theme></pds-theme></div>
|
|
29
|
+
</pds-drawer>
|
|
30
|
+
`);
|
|
18
31
|
|
|
19
|
-
const drawer = document.createElement("pds-drawer");
|
|
20
|
-
drawer.setAttribute("position", "right");
|
|
21
32
|
|
|
22
|
-
drawer.innerHTML = /*html*/ `<div slot="drawer-header">Settings</div>
|
|
23
|
-
<div slot="drawer-content"><pds-theme></pds-theme></div>`;
|
|
24
|
-
|
|
25
|
-
document.body.appendChild(drawer);
|
|
26
|
-
|
|
27
|
-
settingsBtn.addEventListener("click", () => {
|
|
28
|
-
drawer.open = true;
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
const THEME_LABELS = new Map([
|
|
32
|
-
["system", "System"],
|
|
33
|
-
["light", "Light"],
|
|
34
|
-
["dark", "Dark"],
|
|
35
|
-
]);
|
|
36
33
|
|
|
37
34
|
PDS.addEventListener("pds:theme:changed", (event) => {
|
|
38
35
|
const { detail } = event ?? {};
|
|
39
36
|
if (detail?.source !== "api") return;
|
|
40
37
|
const theme = detail?.theme;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const label =
|
|
44
|
-
THEME_LABELS.get(theme) ?? theme.charAt(0).toUpperCase() + theme.slice(1);
|
|
45
|
-
void PDS.toast(`Theme changed to ${label}`, {
|
|
38
|
+
|
|
39
|
+
void PDS.toast(`Theme changed to ${theme}`, {
|
|
46
40
|
type: "information",
|
|
47
41
|
duration: 2000,
|
|
48
42
|
});
|
package/public/assets/js/app.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var it=Object.defineProperty;var at=(e,t)=>{for(var n in t)it(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"}},C=new le;async function Pe(e,t=[],n=null){try{let s=n?.primitivesStylesheet?n.primitivesStylesheet:await C.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(S=>!a.includes(S));e.adoptedStyleSheets=[...l,...a]}try{let l=(await Promise.all(t.map(async S=>{if(s)switch(S){case"tokens":return s.tokensStylesheet;case"primitives":return s.primitivesStylesheet;case"components":return s.componentsStylesheet;case"utilities":return s.utilitiesStylesheet;default:break}return C.getStylesheet(S)}))).filter(S=>S!==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 xe(e){let t=new CSSStyleSheet;return t.replaceSync(e),t}var Re={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 pe={};at(pe,{deepMerge:()=>De,fragmentFromTemplateLike:()=>de,isObject:()=>H,parseHTML:()=>ue});function H(e){return e&&typeof e=="object"&&!Array.isArray(e)}function De(e,t){let n={...e};return H(e)&&H(t)&&Object.keys(t).forEach(s=>{H(t[s])?s in e?n[s]=De(e[s],t[s]):Object.assign(n,{[s]:t[s]}):Object.assign(n,{[s]:t[s]})}),n}function de(e){let t=Array.isArray(e?.strings)?e.strings:[],n=Array.isArray(e?.values)?e.values:[],s=new Set,a=[],r=/(\s)(\.[\w-]+)=\s*$/,l=/(\s)(@[\w-]+)=\s*$/,S=/(\s)(\?[\w-]+)=\s*$/,g=/(\s)([\w:-]+)=\s*$/;for(let c=0;c<t.length;c+=1){let y=t[c]??"";if(c<n.length){let L=`pds-val-${c}`,v=y.match(r),b=y.match(l),d=y.match(S),w=y.match(g);if(v){let E=v[2].slice(1);y=y.replace(r,`$1data-pds-bind-${c}="prop:${E}:${L}"`),s.add(c)}else if(b){let E=b[2].slice(1);y=y.replace(l,`$1data-pds-bind-${c}="event:${E}:${L}"`),s.add(c)}else if(d){let E=d[2].slice(1);y=y.replace(S,`$1data-pds-bind-${c}="boolean:${E}:${L}"`),s.add(c)}else if(w){let E=w[2];y=y.replace(g,`$1data-pds-bind-${c}="attr:${E}:${L}"`),s.add(c)}}a.push(y),c<n.length&&!s.has(c)&&a.push(`<!--pds-val-${c}-->`)}let u=document.createElement("template");u.innerHTML=a.join("");let i=(c,y)=>{let L=c.parentNode;if(!L)return;if(y==null){L.removeChild(c);return}let v=b=>{if(b!=null){if(b instanceof Node){L.insertBefore(b,c);return}if(Array.isArray(b)){b.forEach(d=>v(d));return}L.insertBefore(document.createTextNode(String(b)),c)}};v(y),L.removeChild(c)},m=document.createTreeWalker(u.content,NodeFilter.SHOW_COMMENT),j=[];for(;m.nextNode();){let c=m.currentNode;c?.nodeValue?.startsWith("pds-val-")&&j.push(c)}return j.forEach(c=>{let y=Number(c.nodeValue.replace("pds-val-",""));i(c,n[y])}),u.content.querySelectorAll("*").forEach(c=>{[...c.attributes].forEach(y=>{if(!y.name.startsWith("data-pds-bind-"))return;let L=y.value.indexOf(":"),v=y.value.lastIndexOf(":");if(L<=0||v<=L){c.removeAttribute(y.name);return}let b=y.value.slice(0,L),d=y.value.slice(L+1,v),w=y.value.slice(v+1),E=Number(String(w).replace("pds-val-","")),P=n[E];if(!d||!Number.isInteger(E)){c.removeAttribute(y.name);return}b==="prop"?c[d]=P:b==="event"?(typeof P=="function"||P&&typeof P.handleEvent=="function")&&c.addEventListener(d,P):b==="boolean"?P?c.setAttribute(d,""):c.removeAttribute(d):b==="attr"&&(P==null||P===!1?c.removeAttribute(d):c.setAttribute(d,String(P))),c.removeAttribute(y.name)})}),u.content}function ue(e,...t){return Array.isArray(e)&&Object.prototype.hasOwnProperty.call(e,"raw")?de({strings:Array.from(e),values:t}).childNodes:Array.isArray(e?.strings)&&Array.isArray(e?.values)?de({strings:e.strings,values:e.values}).childNodes:new DOMParser().parseFromString(String(e??""),"text/html").body.childNodes}var Ce="pds",ct=/^([a-z][a-z0-9+\-.]*:)?\/\//i,ze=/^[a-z]:/i;function N(e=""){return e.endsWith("/")?e:`${e}/`}function lt(e="",t=Ce){let n=e.replace(/\/+$/,"");return new RegExp(`(?:^|/)${t}$`,"i").test(n)?n:`${n}/${t}`}function dt(e){return e.replace(/^\.\/+/,"")}function ut(e){return ze.test(e)?e.replace(ze,"").replace(/^\/+/,""):e}function pt(e){return e.startsWith("public/")?e.substring(7):e}function K(e,t={}){let n=t.segment||Ce,s=t.defaultRoot||`/assets/${n}/`,a=e?.public&&e.public?.root||e?.static&&e.static?.root||null;if(!a||typeof a!="string")return N(s);let r=a.trim();return r?(r=r.replace(/\\/g,"/"),r=lt(r,n),r=N(r),ct.test(r)?r:(r=dt(r),r=ut(r),r.startsWith("/")||(r=pt(r),r.startsWith("/")||(r=`/${r}`),r=r.replace(/\/+/g,(l,S)=>S===0?l:"/")),N(r))):N(s)}async function ft(...e){let t={};e.length&&typeof e[e.length-1]=="object"&&(t=e.pop()||{});let n=e,{baseURL:s,mapper:a=u=>`${u}.js`,onError:r=(u,i)=>console.error(`[defineWebComponents] ${u}:`,i)}=t,l=s?new URL(s,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),S=u=>u.toLowerCase().replace(/(^|-)([a-z])/g,(i,m,j)=>j.toUpperCase()),g=async u=>{try{if(customElements.get(u))return{tag:u,status:"already-defined"};let i=a(u),j=await import(i instanceof URL?i.href:new URL(i,l).href),_=j?.default??j?.[S(u)];if(!_){if(customElements.get(u))return{tag:u,status:"self-defined"};throw new Error(`No export found for ${u}. Expected default export or named export "${S(u)}".`)}return customElements.get(u)?{tag:u,status:"race-already-defined"}:(customElements.define(u,_),{tag:u,status:"defined"})}catch(i){throw r(u,i),i}};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:S=document,scanExisting:g=!0,debounceMs:u=16,observeShadows:i=!0,enhancers:m=[],patchAttachShadow:j=!0}=t,_=new Set,c=new Set,y=new Set,L=new Map,v=new WeakMap,b=new WeakMap,d=0,w=!1,E=null,P=p=>{if(!p||!m.length)return;let h=b.get(p);h||(h=new Set,b.set(p,h));for(let f of m)if(!(!f.selector||!f.run)&&!h.has(f.selector))try{p.matches&&p.matches(f.selector)&&(f.run(p),h.add(f.selector))}catch(k){console.warn(`[AutoDefiner] Error applying enhancer for selector "${f.selector}":`,k)}},$=(p,h)=>{if(!w&&!(!p||!p.includes("-"))&&!customElements.get(p)&&!c.has(p)&&!y.has(p)){if(h&&h.getAttribute){let f=h.getAttribute(l);f&&!L.has(p)&&L.set(p,f)}_.add(p),rt()}},rt=()=>{d||(d=setTimeout(Ee,u))},D=p=>{if(p){if(p.nodeType===1){let h=p,f=h.tagName?.toLowerCase();f&&f.includes("-")&&!customElements.get(f)&&r(f,h)&&$(f,h),P(h),i&&h.shadowRoot&&re(h.shadowRoot)}p.querySelectorAll&&p.querySelectorAll("*").forEach(h=>{let f=h.tagName?.toLowerCase();f&&f.includes("-")&&!customElements.get(f)&&r(f,h)&&$(f,h),P(h),i&&h.shadowRoot&&re(h.shadowRoot)})}},re=p=>{if(!p||v.has(p))return;D(p);let h=new MutationObserver(f=>{for(let k of f)k.addedNodes?.forEach(z=>{D(z)}),k.type==="attributes"&&k.target&&D(k.target)});h.observe(p,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[l,...m.map(f=>f.selector).filter(f=>f.startsWith("data-"))]}),v.set(p,h)};async function Ee(){if(clearTimeout(d),d=0,!_.size)return;let p=Array.from(_);_.clear(),p.forEach(h=>c.add(h));try{let h=f=>L.get(f)??(s?s(f):`${f}.js`);await ft(...p,{baseURL:n,mapper:h,onError:(f,k)=>{y.add(f),a?.(f,k)}})}catch{}finally{p.forEach(h=>c.delete(h))}}let ve=S===document?document.documentElement:S,Ae=new MutationObserver(p=>{for(let h of p)h.addedNodes?.forEach(f=>{D(f)}),h.type==="attributes"&&h.target&&D(h.target)});if(Ae.observe(ve,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[l,...m.map(p=>p.selector).filter(p=>p.startsWith("data-"))]}),i&&j&&Element.prototype.attachShadow){let p=Element.prototype.attachShadow;Element.prototype.attachShadow=function(f){let k=p.call(this,f);if(f&&f.mode==="open"){re(k);let z=this.tagName?.toLowerCase();z&&z.includes("-")&&!customElements.get(z)&&$(z,this)}return k},E=()=>Element.prototype.attachShadow=p}return g&&D(ve),{stop(){w=!0,Ae.disconnect(),E&&E(),d&&(clearTimeout(d),d=0),v.forEach(p=>p.disconnect())},flush:Ee}}static async define(...t){let n={};t.length&&typeof t[t.length-1]=="object"&&(n=t.pop()||{});let s=t,{baseURL:a,mapper:r=i=>`${i}.js`,onError:l=(i,m)=>console.error(`[defineWebComponents] ${i}:`,m)}=n,S=a?new URL(a,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),g=i=>i.toLowerCase().replace(/(^|-)([a-z])/g,(m,j,_)=>_.toUpperCase()),u=async i=>{try{if(customElements.get(i))return{tag:i,status:"already-defined"};let m=r(i),_=await import(m instanceof URL?m.href:new URL(m,S).href),c=_?.default??_?.[g(i)];if(!c){if(customElements.get(i))return{tag:i,status:"self-defined"};throw new Error(`No export found for ${i}. Expected default export or named export "${g(i)}".`)}return customElements.get(i)?{tag:i,status:"race-already-defined"}:(customElements.define(i,c),{tag:i,status:"defined"})}catch(m){throw l(i,m),m}};return Promise.all(s.map(u))}};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}},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}})(),Me=!1;function Ue(e){Me||typeof document>"u"||(Me=!0,e.addEventListener("pds:ready",t=>{let n=t.detail?.mode;n&&document.documentElement.classList.add(`pds-${n}`,"pds-ready")}))}function $e({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 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:a=null,enhancers:r=[],autoDefineOverrides:l=null,autoDefinePreferModule:S=!0}=e,g=(()=>{let i=new Map;return(t||[]).forEach(m=>i.set(m.selector,m)),(r||[]).forEach(m=>i.set(m.selector,m)),Array.from(i.values())})(),u=null;if(typeof window<"u"&&typeof document<"u"){let i=G,m=d=>{switch(d){case"pds-tabpanel":return"pds-tabstrip.js";default:return`${d}.js`}},{mapper:j,enhancers:_,...c}=l&&typeof l=="object"?l:{},y=_?Array.isArray(_)?_:typeof _=="object"?Object.values(_):[]:[],L=(()=>{let d=new Map;return(g||[]).forEach(w=>{w?.selector&&d.set(w.selector,w)}),(y||[]).forEach(w=>{if(!w?.selector)return;let E=d.get(w.selector)||null;d.set(w.selector,{...E||{},...w,run:typeof w?.run=="function"?w.run:E?.run})}),Array.from(d.values())})(),b={baseURL:n&&J(q(n,{preferModule:S})),predefine:s,scanExisting:!0,observeShadows:!0,patchAttachShadow:!0,debounceMs:16,enhancers:L,onError:(d,w)=>{if(typeof d=="string"&&d.startsWith("pds-")){let P=["pds-form","pds-drawer"].includes(d),$=w?.message?.includes("#pds/lit")||w?.message?.includes("Failed to resolve module specifier");P&&$?o.log("error",`\u274C PDS component <${d}> 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 <${d}> not found. Assets may not be installed.`)}else o.log("error",`\u274C Auto-define error for <${d}>:`,w)},...c,mapper:d=>{if(customElements.get(d))return null;if(typeof a=="function")try{let w=a(d);return w===void 0?m(d):w}catch(w){return o.log("warn","Custom autoDefine.mapper error; falling back to default:",w?.message||w),m(d)}return m(d)}};u=new i(b),s.length>0&&typeof i.define=="function"&&await i.define(...s,{baseURL:n,mapper:b.mapper,onError:b.onError})}return{autoDefiner:u,mergedEnhancers:g}}var fe=["light","dark"],me=new Set(fe);function ht(e){let n=(Array.isArray(e?.themes)?e.themes.map(s=>String(s).toLowerCase()):fe).filter(s=>me.has(s));return n.length?n:fe}function he(e,{preferDocument:t=!0}={}){let n=String(e||"").toLowerCase();if(me.has(n))return n;if(t&&typeof document<"u"){let s=document.documentElement?.getAttribute("data-theme");if(me.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=he(t);return ht(e).includes(n)}var yt=new Set(["log","warn","error","debug","info"]),gt="__PURE_DS_PDS_SINGLETON__",ye=null,ge=null;function Fe(){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 ge=="function")try{let t=bt(ge());if(t)return t}catch{}let e=Fe();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 ye=="function")try{let t=ye();if(typeof t=="function")return t}catch{}let e=Fe();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 We({getLogger:e,getContext:t}={}){ye=typeof e=="function"?e:null,ge=typeof t=="function"?t:null}function Be(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,Ke="__pdsLocalizationRuntime";function T(){if(te)return te;let e=o?.[Ke];return e&&typeof e=="object"?(te=e,e):null}function Et(e){let t=e&&typeof e=="object"?e:null;te=t,o[Ke]=t}We({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)=>{Be(e,t,...n)};var A={locale:"en",messages:{},hasProvider:!1},ne=new Set;function Ge(e){return!!e&&typeof e!="string"&&typeof e=="object"&&"strTag"in e}function Je(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 At(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 jt(e,...t){return{strTag:!0,strings:Array.from(e||[]),values:t,raw:Array.from(e?.raw||[])}}function Pt(e){if(!e)return"";if(Ge(e)){let n=Je(e.strings||[]),s=A.messages[n]||n;return vt(s,a=>e.values?.[a])}let t=String(e);return A.messages[t]||t}function kt(e){if(!e)return;let t=Ge(e)?Je(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 F(){let e=T();return e||(ee||(ee=import(W("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 M=(e,t={})=>{let n=T();return typeof n?.msg=="function"?n.msg(e,t):(kt(e),Pt(e,t))},oe=(e,...t)=>{let n=T();return typeof n?.str=="function"?n.str(e,...t):jt(e,...t)},se=(e=null)=>{let t=T();if(typeof t?.configureLocalization=="function")return t.configureLocalization(e);if(!e||typeof e!="object")return A.locale="en",A.messages={},A.hasProvider=!1,{locale:A.locale,messages:{...A.messages},hasProvider:A.hasProvider};typeof e.locale=="string"&&e.locale.trim()&&(A.locale=e.locale.trim()),Object.prototype.hasOwnProperty.call(e,"messages")&&(A.messages=At(e.messages));let n=!!(e.provider||e.translate||e.loadLocale||e.setLocale);return A.hasProvider=n,n&&F().then(s=>{s.configureLocalization(e),qe(s)}).catch(()=>{}),{locale:A.locale,messages:{...A.messages},hasProvider:A.hasProvider}},Ve=async e=>(await F()).loadLocale(e),Qe=async(e,t={})=>(await F()).setLocale(e,t),Ye=()=>{let e=T();return typeof e?.getLocalizationState=="function"?e.getLocalizationState():{locale:A.locale,messages:{...A.messages},hasProvider:A.hasProvider}},Ze=(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=F().then(g=>typeof g?.createJSONLocalization=="function"?g.createJSONLocalization(e):null).catch(()=>null)),r),S=async(g="loadLocale")=>{let u=await l();if(!u||typeof u!="object")return null;let i=u.provider;if(!i||typeof i!="object")return null;let m=i[g];return typeof m=="function"?m:g==="setLocale"&&typeof i.loadLocale=="function"?i.loadLocale:null};return{locale:n,locales:[...a],provider:{locales:[...a],async loadLocale(g={}){let u=await S("loadLocale");return typeof u!="function"?{}:u(g)},async setLocale(g={}){let u=await S("setLocale");return typeof u!="function"?{}:u(g)}}}};function W(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(W("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!==Xe?o.ask:(Y||(Y=import(W("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 B(){return typeof o.toast=="function"&&o.toast!==U?o.toast:(Z||(Z=import(W("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 Xe(...e){return(await Rt())(...e)}async function U(...e){return(await B())(...e)}U.success=async(...e)=>(await B()).success(...e);U.error=async(...e)=>(await B()).error(...e);U.warning=async(...e)=>(await B()).warning(...e);U.info=async(...e)=>(await B()).info(...e);var He=function(e="log",t,...n){o.log(e,t,...n)};function we(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=>we(n)).filter(n=>n!==void 0);let t={};for(let[n,s]of Object.entries(e)){let a=we(s);a!==void 0&&(t[n]=a)}return t}function et(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))et(e[n],t);return e}function Se(e){return e==null||typeof e!="object"?e:et(structuredClone(we(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=C;o.enums=Re;o.adoptLayers=ke;o.adoptPrimitives=Pe;o.parse=ue;o.createStylesheet=xe;o.isLiveMode=()=>C.isLive;o.ask=Xe;o.toast=U;o.common=pe;o.msg=M;o.str=oe;o.configureLocalization=se;o.loadLocale=Ve;o.setLocale=Qe;o.getLocalizationState=Ye;o.createJSONLocalization=Ze;o.i18n={msg:M,str:oe,configure:se,loadLocale:Ve,setLocale:Qe,getState:Ye,createJSONLocalization:Ze};o.AutoComplete=null;o.loadAutoComplete=async()=>{if(o.AutoComplete&&typeof o.AutoComplete.connect=="function")return o.AutoComplete;let e=W("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 tt(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 nt(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 be="pure-ds-theme",R=null,I=null;function Le(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 _e(e){try{if(R&&I){try{typeof R.removeEventListener=="function"?R.removeEventListener("change",I):typeof R.removeListener=="function"&&R.removeListener(I)}catch{}R=null,I=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{}};R=t,I=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(be)||null}catch{return null}},set(e){try{if(typeof window>"u")return;let t=o.currentConfig?.design||null,n=he(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(be):localStorage.setItem(be,e),Le(e),_e(e),o.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:e,source:"api"}}))}catch{}}});o.defaultEnhancers=[];async function Ct(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=Se(s);let a=s&&typeof s.localization=="object"&&s.localization?s.localization:null;a?(await F(),se(a)):se(null);let r;if(t==="static")r=await Tt(s);else{let{localization:S,...g}=s||{},u=V(g,{resolvePublicAssetURL:K}),i=g?.managerURL||g?.public?.managerURL||g?.manager?.url||new URL("core/pds-manager.js",u).href||new URL("./pds-manager.js",import.meta.url).href,{startLive:m}=await import(i);r=await m(o,g,{emitReady:tt,emitConfigChanged:nt,applyResolvedTheme:Le,setupSystemListenerIfNeeded:_e})}o.compiled=Se(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=Ct;async function Tt(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=V(e,{resolvePublicAssetURL:K}),l=e&&e.autoDefine||null,S;l&&l.baseURL?S=J(q(l.baseURL,{preferModule:!1})):S=`${r}components/`;let g=l&&Array.isArray(l.predefine)&&l.predefine||[],u=l&&typeof l.mapper=="function"&&l.mapper||null;try{Ue(o);let{resolvedTheme:i}=$e({manageTheme:n,themeStorageKey:s,applyResolvedTheme:Le,setupSystemListenerIfNeeded:_e}),m=await Dt(r,e),j=Array.isArray(e?.enhancers)?e.enhancers:e?.enhancers&&typeof e.enhancers=="object"?Object.values(e.enhancers):[],_=m?.config?{...m.config,...e,design:e?.design||m.config.design,preset:e?.preset||m.config.preset}:{...e},c={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`},y=m?.paths||{};if(a={...c,...y,...a},o.registry.setStaticMode(a),t&&typeof document<"u")try{let b=await o.registry.getStylesheet("styles");if(b){b._pds=!0;let d=(document.adoptedStyleSheets||[]).filter(w=>w._pds!==!0);document.adoptedStyleSheets=[...d,b],nt({mode:"static",source:"static:styles-applied"})}}catch(b){He.call(o,"warn","Failed to apply static styles:",b)}let L=null,v=[];try{let b=await xt(),d=await Ne({autoDefineBaseURL:S,autoDefinePreload:g,autoDefineMapper:u,enhancers:j,autoDefineOverrides:l||null,autoDefinePreferModule:!(l&&l.baseURL)},{baseEnhancers:b});L=d.autoDefiner,v=d.mergedEnhancers||[]}catch(b){He.call(o,"error","\u274C Failed to initialize AutoDefiner/Enhancers (static):",b)}return o.compiled=Se({mode:"static",..._,theme:i,enhancers:v}),tt({mode:"static",config:_,theme:i,autoDefiner:L}),{config:_,theme:i,autoDefiner:L}}catch(i){throw o.dispatchEvent(new CustomEvent("pds:error",{detail:{error:i}})),i}}var Mt=o.createJSONLocalization({locale:"en-US",locales:["en-US","nl-NL"],aliases:{en:["en-US"],nl:["nl-NL"]},basePath:"/assets/locales"}),st={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 x={name:"@pure-ds/core",shortname:"pds",version:"0.7.52",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(st);document.documentElement.lang="en";var ot=typeof x.repository=="string"?x.repository:x.repository?.url,$t=ot?ot.replace(/^git\+/,"").replace(/\.git$/,""):"",hn=x.homepage||$t,yn=x.bugs?.url||"";document.body.append(...o.parse`
|
|
1
|
+
var ct=Object.defineProperty;var lt=(e,t)=>{for(var n in t)ct(e,n,{get:t[n],enumerable:!0})};var le=class extends EventTarget{constructor(){super(),this.mode=null,this.compiled=null,this.log=()=>{},this.logHandler=null}},xe="__PURE_DS_PDS_SINGLETON__",de=typeof globalThis<"u"?globalThis:window,ce=de?.[xe],o=ce&&typeof ce.addEventListener=="function"?ce:new le;de&&(de[xe]=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 ue=class{constructor(){this._mode="static",this._staticPaths={tokens:"/assets/pds/styles/pds-tokens.css.js",primitives:"/assets/pds/styles/pds-primitives.css.js",components:"/assets/pds/styles/pds-components.css.js",utilities:"/assets/pds/styles/pds-utilities.css.js",styles:"/assets/pds/styles/pds-styles.css.js"}}setLiveMode(){this._mode="live"}setStaticMode(t={}){this._mode="static",this._staticPaths={...this._staticPaths,...t}}async getStylesheet(t){if(this._mode==="live")return null;try{return(await import(this._staticPaths[t]))[t]}catch(n){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"}},M=new ue;async function Re(e,t=[],n=null){try{let s=n?.primitivesStylesheet?n.primitivesStylesheet:await M.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 De(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(S=>!a.includes(S));e.adoptedStyleSheets=[...l,...a]}try{let l=(await Promise.all(t.map(async S=>{if(s)switch(S){case"tokens":return s.tokensStylesheet;case"primitives":return s.primitivesStylesheet;case"components":return s.componentsStylesheet;case"utilities":return s.utilitiesStylesheet;default:break}return M.getStylesheet(S)}))).filter(S=>S!==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 ze(e){let t=new CSSStyleSheet;return t.replaceSync(e),t}var Ce={FontWeights:{light:300,normal:400,medium:500,semibold:600,bold:700},LineHeights:{tight:1.25,normal:1.5,relaxed:1.75},BorderWidths:{hairline:.5,thin:1,medium:2,thick:3},RadiusSizes:{none:0,small:4,medium:8,large:16,xlarge:24,xxlarge:32},ShadowDepths:{none:"none",light:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",medium:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",deep:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",extreme:"0 25px 50px -12px rgba(0, 0, 0, 0.25)"},TransitionSpeeds:{fast:150,normal:250,slow:350},AnimationEasings:{linear:"linear",ease:"ease","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out",bounce:"cubic-bezier(0.68, -0.55, 0.265, 1.55)"},TouchTargetSizes:{compact:36,standard:44,comfortable:48,spacious:56},LinkStyles:{inline:"inline",block:"block",button:"button"},FocusStyles:{ring:"ring",outline:"outline",border:"border",glow:"glow"},TabSizes:{compact:2,standard:4,wide:8},SelectIcons:{chevron:"chevron",arrow:"arrow",caret:"caret",none:"none"},IconSizes:{xs:16,sm:20,md:24,lg:32,xl:48,"2xl":64,"3xl":96}};var me={};lt(me,{deepMerge:()=>Te,fragmentFromTemplateLike:()=>pe,isObject:()=>K,parseFragment:()=>G,parseHTML:()=>fe});function K(e){return e&&typeof e=="object"&&!Array.isArray(e)}function Te(e,t){let n={...e};return K(e)&&K(t)&&Object.keys(t).forEach(s=>{K(t[s])?s in e?n[s]=Te(e[s],t[s]):Object.assign(n,{[s]:t[s]}):Object.assign(n,{[s]:t[s]})}),n}function pe(e){let t=Array.isArray(e?.strings)?e.strings:[],n=Array.isArray(e?.values)?e.values:[],s=new Set,a=[],r=/(\s)(\.[\w-]+)=["']?\s*$/,l=/(\s)(@[\w-]+)=["']?\s*$/,S=/(\s)(\?[\w-]+)=["']?\s*$/,b=/(\s)([\w:-]+)=["']?\s*$/,d=/=["']\s*$/,i=!1;for(let c=0;c<t.length;c+=1){let y=t[c]??"";if(i&&(y=y.replace(/^["']/,""),i=!1),c<n.length){let w=`pds-val-${c}`,u=y.match(r),h=y.match(l),_=y.match(S),x=y.match(b);if(u){let v=u[2].slice(1);i=d.test(t[c]??""),y=y.replace(r,`$1data-pds-bind-${c}="prop:${v}:${w}"`),s.add(c)}else if(h){let v=h[2].slice(1);i=d.test(t[c]??""),y=y.replace(l,`$1data-pds-bind-${c}="event:${v}:${w}"`),s.add(c)}else if(_){let v=_[2].slice(1);i=d.test(t[c]??""),y=y.replace(S,`$1data-pds-bind-${c}="boolean:${v}:${w}"`),s.add(c)}else if(x){let v=x[2];i=d.test(t[c]??""),y=y.replace(b,`$1data-pds-bind-${c}="attr:${v}:${w}"`),s.add(c)}}a.push(y),c<n.length&&!s.has(c)&&a.push(`<!--pds-val-${c}-->`)}let p=document.createElement("template");p.innerHTML=a.join("");let A=(c,y)=>{let w=c.parentNode;if(!w)return;if(y==null){w.removeChild(c);return}let u=h=>{if(h!=null){if(h instanceof Node){w.insertBefore(h,c);return}if(Array.isArray(h)){h.forEach(_=>u(_));return}w.insertBefore(document.createTextNode(String(h)),c)}};u(y),w.removeChild(c)},L=document.createTreeWalker(p.content,NodeFilter.SHOW_COMMENT),j=[];for(;L.nextNode();){let c=L.currentNode;c?.nodeValue?.startsWith("pds-val-")&&j.push(c)}return j.forEach(c=>{let y=Number(c.nodeValue.replace("pds-val-",""));A(c,n[y])}),p.content.querySelectorAll("*").forEach(c=>{[...c.attributes].forEach(y=>{if(!y.name.startsWith("data-pds-bind-"))return;let w=y.value.indexOf(":"),u=y.value.lastIndexOf(":");if(w<=0||u<=w){c.removeAttribute(y.name);return}let h=y.value.slice(0,w),_=y.value.slice(w+1,u),x=y.value.slice(u+1),v=Number(String(x).replace("pds-val-","")),P=n[v];if(!_||!Number.isInteger(v)){c.removeAttribute(y.name);return}h==="prop"?c[_]=P:h==="event"?(typeof P=="function"||P&&typeof P.handleEvent=="function")&&c.addEventListener(_,P):h==="boolean"?P?c.setAttribute(_,""):c.removeAttribute(_):h==="attr"&&(P==null||P===!1?c.removeAttribute(_):c.setAttribute(_,String(P))),c.removeAttribute(y.name)})}),p.content}function G(e,...t){if(Array.isArray(e)&&Object.prototype.hasOwnProperty.call(e,"raw"))return pe({strings:Array.from(e),values:t});if(Array.isArray(e?.strings)&&Array.isArray(e?.values))return pe({strings:e.strings,values:e.values});let s=document.createElement("template");return s.innerHTML=String(e??""),s.content}function fe(e,...t){return G(e,...t).childNodes}var Ue="pds",dt=/^([a-z][a-z0-9+\-.]*:)?\/\//i,Me=/^[a-z]:/i;function O(e=""){return e.endsWith("/")?e:`${e}/`}function ut(e="",t=Ue){let n=e.replace(/\/+$/,"");return new RegExp(`(?:^|/)${t}$`,"i").test(n)?n:`${n}/${t}`}function pt(e){return e.replace(/^\.\/+/,"")}function ft(e){return Me.test(e)?e.replace(Me,"").replace(/^\/+/,""):e}function mt(e){return e.startsWith("public/")?e.substring(7):e}function q(e,t={}){let n=t.segment||Ue,s=t.defaultRoot||`/assets/${n}/`,a=e?.public&&e.public?.root||e?.static&&e.static?.root||null;if(!a||typeof a!="string")return O(s);let r=a.trim();return r?(r=r.replace(/\\/g,"/"),r=ut(r,n),r=O(r),dt.test(r)?r:(r=pt(r),r=ft(r),r.startsWith("/")||(r=mt(r),r.startsWith("/")||(r=`/${r}`),r=r.replace(/\/+/g,(l,S)=>S===0?l:"/")),O(r))):O(s)}async function ht(...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,i)=>console.error(`[defineWebComponents] ${d}:`,i)}=t,l=s?new URL(s,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),S=d=>d.toLowerCase().replace(/(^|-)([a-z])/g,(i,p,A)=>A.toUpperCase()),b=async d=>{try{if(customElements.get(d))return{tag:d,status:"already-defined"};let i=a(d),A=await import(i instanceof URL?i.href:new URL(i,l).href),L=A?.default??A?.[S(d)];if(!L){if(customElements.get(d))return{tag:d,status:"self-defined"};throw new Error(`No export found for ${d}. Expected default export or named export "${S(d)}".`)}return customElements.get(d)?{tag:d,status:"race-already-defined"}:(customElements.define(d,L),{tag:d,status:"defined"})}catch(i){throw r(d,i),i}};return Promise.all(n.map(b))}var J=class{constructor(t={}){let{baseURL:n,mapper:s,onError:a,predicate:r=()=>!0,attributeModule:l="data-module",root:S=document,scanExisting:b=!0,debounceMs:d=16,observeShadows:i=!0,enhancers:p=[],patchAttachShadow:A=!0}=t,L=new Set,j=new Set,D=new Set,c=new Map,y=new WeakMap,w=new WeakMap,u=0,h=!1,_=null,x=f=>{if(!f||!p.length)return;let g=w.get(f);g||(g=new Set,w.set(f,g));for(let m of p)if(!(!m.selector||!m.run)&&!g.has(m.selector))try{f.matches&&f.matches(m.selector)&&(m.run(f),g.add(m.selector))}catch(k){console.warn(`[AutoDefiner] Error applying enhancer for selector "${m.selector}":`,k)}},v=(f,g)=>{if(!h&&!(!f||!f.includes("-"))&&!customElements.get(f)&&!j.has(f)&&!D.has(f)){if(g&&g.getAttribute){let m=g.getAttribute(l);m&&!c.has(f)&&c.set(f,m)}L.add(f),P()}},P=()=>{u||(u=setTimeout(je,d))},C=f=>{if(f){if(f.nodeType===1){let g=f,m=g.tagName?.toLowerCase();m&&m.includes("-")&&!customElements.get(m)&&r(m,g)&&v(m,g),x(g),i&&g.shadowRoot&&ae(g.shadowRoot)}f.querySelectorAll&&f.querySelectorAll("*").forEach(g=>{let m=g.tagName?.toLowerCase();m&&m.includes("-")&&!customElements.get(m)&&r(m,g)&&v(m,g),x(g),i&&g.shadowRoot&&ae(g.shadowRoot)})}},ae=f=>{if(!f||y.has(f))return;C(f);let g=new MutationObserver(m=>{for(let k of m)k.addedNodes?.forEach(T=>{C(T)}),k.type==="attributes"&&k.target&&C(k.target)});g.observe(f,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[l,...p.map(m=>m.selector).filter(m=>m.startsWith("data-"))]}),y.set(f,g)};async function je(){if(clearTimeout(u),u=0,!L.size)return;let f=Array.from(L);L.clear(),f.forEach(g=>j.add(g));try{let g=m=>c.get(m)??(s?s(m):`${m}.js`);await ht(...f,{baseURL:n,mapper:g,onError:(m,k)=>{D.add(m),a?.(m,k)}})}catch{}finally{f.forEach(g=>j.delete(g))}}let Pe=S===document?document.documentElement:S,ke=new MutationObserver(f=>{for(let g of f)g.addedNodes?.forEach(m=>{C(m)}),g.type==="attributes"&&g.target&&C(g.target)});if(ke.observe(Pe,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[l,...p.map(f=>f.selector).filter(f=>f.startsWith("data-"))]}),i&&A&&Element.prototype.attachShadow){let f=Element.prototype.attachShadow;Element.prototype.attachShadow=function(m){let k=f.call(this,m);if(m&&m.mode==="open"){ae(k);let T=this.tagName?.toLowerCase();T&&T.includes("-")&&!customElements.get(T)&&v(T,this)}return k},_=()=>Element.prototype.attachShadow=f}return b&&C(Pe),{stop(){h=!0,ke.disconnect(),_&&_(),u&&(clearTimeout(u),u=0),y.forEach(f=>f.disconnect())},flush:je}}static async define(...t){let n={};t.length&&typeof t[t.length-1]=="object"&&(n=t.pop()||{});let s=t,{baseURL:a,mapper:r=i=>`${i}.js`,onError:l=(i,p)=>console.error(`[defineWebComponents] ${i}:`,p)}=n,S=a?new URL(a,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),b=i=>i.toLowerCase().replace(/(^|-)([a-z])/g,(p,A,L)=>L.toUpperCase()),d=async i=>{try{if(customElements.get(i))return{tag:i,status:"already-defined"};let p=r(i),L=await import(p instanceof URL?p.href:new URL(p,S).href),j=L?.default??L?.[b(i)];if(!j){if(customElements.get(i))return{tag:i,status:"self-defined"};throw new Error(`No export found for ${i}. Expected default export or named export "${b(i)}".`)}return customElements.get(i)?{tag:i,status:"race-already-defined"}:(customElements.define(i,j),{tag:i,status:"defined"})}catch(p){throw l(i,p),p}};return Promise.all(s.map(d))}};var yt=/^[a-z][a-z0-9+\-.]*:\/\//i,I=(()=>{try{return import.meta.url}catch{return}})(),V=e=>typeof e=="string"&&e.length&&!e.endsWith("/")?`${e}/`:e;function Q(e,t={}){if(!e||yt.test(e))return e;let{preferModule:n=!0}=t,s=()=>{if(!I)return null;try{return new URL(e,I).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 $e=(()=>{if(I)try{let e=new URL(I);if(/\/public\/assets\/js\//.test(e.pathname))return new URL("../pds/",I).href}catch{return}})(),Ne=!1;function Oe(e){Ne||typeof document>"u"||(Ne=!0,e.addEventListener("pds:ready",t=>{let n=t.detail?.mode;n&&document.documentElement.classList.add(`pds-${n}`,"pds-ready")}))}function Ie({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 Y(e,{resolvePublicAssetURL:t}){let n=!!(e?.public?.root||e?.static?.root),s=t(e);return!n&&$e&&(s=$e),V(Q(s))}async function Fe(e,{baseEnhancers:t=[]}={}){let{autoDefineBaseURL:n="/auto-define/",autoDefinePreload:s=[],autoDefineMapper:a=null,enhancers:r=[],autoDefineOverrides:l=null,autoDefinePreferModule:S=!0}=e,b=(()=>{let i=new Map;return(t||[]).forEach(p=>i.set(p.selector,p)),(r||[]).forEach(p=>i.set(p.selector,p)),Array.from(i.values())})(),d=null;if(typeof window<"u"&&typeof document<"u"){let i=J,p=u=>{switch(u){case"pds-tabpanel":return"pds-tabstrip.js";default:return`${u}.js`}},{mapper:A,enhancers:L,...j}=l&&typeof l=="object"?l:{},D=L?Array.isArray(L)?L:typeof L=="object"?Object.values(L):[]:[],c=(()=>{let u=new Map;return(b||[]).forEach(h=>{h?.selector&&u.set(h.selector,h)}),(D||[]).forEach(h=>{if(!h?.selector)return;let _=u.get(h.selector)||null;u.set(h.selector,{..._||{},...h,run:typeof h?.run=="function"?h.run:_?.run})}),Array.from(u.values())})(),w={baseURL:n&&V(Q(n,{preferModule:S})),predefine:s,scanExisting:!0,observeShadows:!0,patchAttachShadow:!0,debounceMs:16,enhancers:c,onError:(u,h)=>{if(typeof u=="string"&&u.startsWith("pds-")){let x=["pds-form","pds-drawer"].includes(u),v=h?.message?.includes("#pds/lit")||h?.message?.includes("Failed to resolve module specifier");x&&v?o.log("error",`\u274C PDS component <${u}> requires Lit but #pds/lit is not in import map.
|
|
2
|
+
See: https://github.com/Pure-Web-Foundation/pure-ds/blob/main/readme.md#lit-components-not-working`):o.log("warn",`\u26A0\uFE0F PDS component <${u}> not found. Assets may not be installed.`)}else o.log("error",`\u274C Auto-define error for <${u}>:`,h)},...j,mapper:u=>{if(customElements.get(u))return null;if(typeof a=="function")try{let h=a(u);return h===void 0?p(u):h}catch(h){return o.log("warn","Custom autoDefine.mapper error; falling back to default:",h?.message||h),p(u)}return p(u)}};d=new i(w),s.length>0&&typeof i.define=="function"&&await i.define(...s,{baseURL:n,mapper:w.mapper,onError:w.onError})}return{autoDefiner:d,mergedEnhancers:b}}var he=["light","dark"],ye=new Set(he);function gt(e){let n=(Array.isArray(e?.themes)?e.themes.map(s=>String(s).toLowerCase()):he).filter(s=>ye.has(s));return n.length?n:he}function ge(e,{preferDocument:t=!0}={}){let n=String(e||"").toLowerCase();if(ye.has(n))return n;if(t&&typeof document<"u"){let s=document.documentElement?.getAttribute("data-theme");if(ye.has(s))return s}return typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function We(e,t){let n=ge(t);return gt(e).includes(n)}var bt=new Set(["log","warn","error","debug","info"]),wt="__PURE_DS_PDS_SINGLETON__",be=null,we=null;function He(){try{let t=(typeof globalThis<"u"?globalThis:window)?.[wt];if(t&&typeof t=="object")return t}catch{return null}return null}function St(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 Lt(e){if(typeof e!="string")return"log";let t=e.toLowerCase();return bt.has(t)?t:"log"}function _t(){if(typeof we=="function")try{let t=St(we());if(t)return t}catch{}let e=He();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 Et(){if(typeof be=="function")try{let t=be();if(typeof t=="function")return t}catch{}let e=He();return typeof e?.logHandler=="function"?e.logHandler:null}function Be(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 vt(e,t){let n=t?.debug===!0;return!(t?.mode==="static"&&!n||!n&&e!=="error"&&e!=="warn")}function Ke({getLogger:e,getContext:t}={}){be=typeof e=="function"?e:null,we=typeof t=="function"?t:null}function Ge(e="log",t,...n){let s=Lt(e),a=_t(),r=Et();if(r)try{r.call(a?.thisArg,s,t,...n);return}catch(l){Be("error","Custom log handler failed:",l)}vt(s,a)&&Be(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 Z=null,X=null,ee=null,te=null,ne=null,se=null,Je="__pdsLocalizationRuntime";function U(){if(se)return se;let e=o?.[Je];return e&&typeof e=="object"?(se=e,e):null}function At(e){let t=e&&typeof e=="object"?e:null;se=t,o[Je]=t}Ke({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)=>{Ge(e,t,...n)};var E={locale:"en",messages:{},hasProvider:!1},oe=new Set;function Ve(e){return!!e&&typeof e!="string"&&typeof e=="object"&&"strTag"in e}function Qe(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 jt(e,t){return String(e).replace(/\{(\d+)\}/g,(n,s)=>t(Number(s)))}function Pt(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 kt(e,...t){return{strTag:!0,strings:Array.from(e||[]),values:t,raw:Array.from(e?.raw||[])}}function xt(e){if(!e)return"";if(Ve(e)){let n=Qe(e.strings||[]),s=E.messages[n]||n;return jt(s,a=>e.values?.[a])}let t=String(e);return E.messages[t]||t}function Rt(e){if(!e)return;let t=Ve(e)?Qe(e.strings||[]):String(e);typeof t=="string"&&t.length>0&&oe.add(t)}function Ye(e){if(!e||typeof e.msg!="function"||oe.size===0)return;let t=Array.from(oe);oe.clear();for(let n of t)try{e.msg(n)}catch{}}async function W(){let e=U();return e||(ne||(ne=import(B("pds-localization.js")).then(n=>{if(typeof n?.msg!="function"||typeof n?.str!="function"||typeof n?.configureLocalization!="function"||typeof n?.loadLocale!="function"||typeof n?.setLocale!="function"||typeof n?.getLocalizationState!="function")throw new Error("Failed to load localization runtime exports");return At(n),Ye(n),n}).catch(n=>{throw ne=null,n})),ne)}var $=(e,t={})=>{let n=U();return typeof n?.msg=="function"?n.msg(e,t):(Rt(e),xt(e,t))},ie=(e,...t)=>{let n=U();return typeof n?.str=="function"?n.str(e,...t):kt(e,...t)},re=(e=null)=>{let t=U();if(typeof t?.configureLocalization=="function")return t.configureLocalization(e);if(!e||typeof e!="object")return E.locale="en",E.messages={},E.hasProvider=!1,{locale:E.locale,messages:{...E.messages},hasProvider:E.hasProvider};typeof e.locale=="string"&&e.locale.trim()&&(E.locale=e.locale.trim()),Object.prototype.hasOwnProperty.call(e,"messages")&&(E.messages=Pt(e.messages));let n=!!(e.provider||e.translate||e.loadLocale||e.setLocale);return E.hasProvider=n,n&&W().then(s=>{s.configureLocalization(e),Ye(s)}).catch(()=>{}),{locale:E.locale,messages:{...E.messages},hasProvider:E.hasProvider}},Ze=async e=>(await W()).loadLocale(e),Xe=async(e,t={})=>(await W()).setLocale(e,t),et=()=>{let e=U();return typeof e?.getLocalizationState=="function"?e.getLocalizationState():{locale:E.locale,messages:{...E.messages},hasProvider:E.hasProvider}},tt=(e={})=>{let t=U();if(typeof t?.createJSONLocalization=="function")return t.createJSONLocalization(e);let n=typeof e?.locale=="string"&&e.locale.trim()?e.locale.trim().toLowerCase():"en",s=Array.isArray(e?.locales)?e.locales.map(b=>String(b||"").trim().toLowerCase()).filter(Boolean):[],a=Array.from(new Set([n,...s])),r=null,l=async()=>(r||(r=W().then(b=>typeof b?.createJSONLocalization=="function"?b.createJSONLocalization(e):null).catch(()=>null)),r),S=async(b="loadLocale")=>{let d=await l();if(!d||typeof d!="object")return null;let i=d.provider;if(!i||typeof i!="object")return null;let p=i[b];return typeof p=="function"?p:b==="setLocale"&&typeof i.loadLocale=="function"?i.loadLocale:null};return{locale:n,locales:[...a],provider:{locales:[...a],async loadLocale(b={}){let d=await S("loadLocale");return typeof d!="function"?{}:d(b)},async setLocale(b={}){let d=await S("setLocale");return typeof d!="function"?{}:d(b)}}}};function B(e,t){return t&&typeof t=="string"?t:`${Y(o.currentConfig||{},{resolvePublicAssetURL:q})}core/${e}`}async function Dt(){return Array.isArray(o.defaultEnhancers)&&o.defaultEnhancers.length>0?o.defaultEnhancers:(te||(te=import(B("pds-enhancers.js",o.currentConfig?.enhancersURL)).then(t=>{let n=Array.isArray(t?.defaultPDSEnhancers)?t.defaultPDSEnhancers:[];return o.defaultEnhancers=n,n}).catch(t=>{throw te=null,t})),te)}async function zt(){return typeof o.ask=="function"&&o.ask!==nt?o.ask:(X||(X=import(B("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 X=null,t})),X)}async function H(){return typeof o.toast=="function"&&o.toast!==N?o.toast:(ee||(ee=import(B("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 ee=null,t})),ee)}async function nt(...e){return(await zt())(...e)}async function N(...e){return(await H())(...e)}N.success=async(...e)=>(await H()).success(...e);N.error=async(...e)=>(await H()).error(...e);N.warning=async(...e)=>(await H()).warning(...e);N.info=async(...e)=>(await H()).info(...e);var qe=function(e="log",t,...n){o.log(e,t,...n)};function Le(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=>Le(n)).filter(n=>n!==void 0);let t={};for(let[n,s]of Object.entries(e)){let a=Le(s);a!==void 0&&(t[n]=a)}return t}function st(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))st(e[n],t);return e}function _e(e){return e==null||typeof e!="object"?e:st(structuredClone(Le(e)))}async function Ct(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=M;o.enums=Ce;o.adoptLayers=De;o.adoptPrimitives=Re;var Tt=fe;o.parse=Tt;var Ee=G;o.html=Ee;o.createStylesheet=ze;o.isLiveMode=()=>M.isLive;o.ask=nt;o.toast=N;o.common=me;o.msg=$;o.str=ie;o.configureLocalization=re;o.loadLocale=Ze;o.setLocale=Xe;o.getLocalizationState=et;o.createJSONLocalization=tt;o.i18n={msg:$,str:ie,configure:re,loadLocale:Ze,setLocale:Xe,getState:et,createJSONLocalization:tt};o.AutoComplete=null;o.loadAutoComplete=async()=>{if(o.AutoComplete&&typeof o.AutoComplete.connect=="function")return o.AutoComplete;let e=B("pds-autocomplete.js",o.currentConfig?.autoCompleteURL);return Z||(Z=import(e).then(t=>{let n=t?.AutoComplete||t?.default?.AutoComplete||t?.default||null;if(!n)throw new Error("AutoComplete export not found in module");return o.AutoComplete=n,n}).catch(t=>{throw Z=null,t})),Z};function ot(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 rt(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 Se="pure-ds-theme",z=null,F=null;function ve(e){try{if(typeof document>"u")return;let t="light";e?e==="system"?t=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t=e:t=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",document.documentElement.setAttribute("data-theme",t)}catch{}}function Ae(e){try{if(z&&F){try{typeof z.removeEventListener=="function"?z.removeEventListener("change",F):typeof z.removeListener=="function"&&z.removeListener(F)}catch{}z=null,F=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{}};z=t,F=n,typeof t.addEventListener=="function"?t.addEventListener("change",n):typeof t.addListener=="function"&&t.addListener(n)}}catch{}}var Mt=Object.getOwnPropertyDescriptor(o,"theme");Mt||Object.defineProperty(o,"theme",{get(){try{return typeof window>"u"?null:localStorage.getItem(Se)||null}catch{return null}},set(e){try{if(typeof window>"u")return;let t=o.currentConfig?.design||null,n=ge(e);if(t&&!We(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(Se):localStorage.setItem(Se,e),ve(e),Ae(e),o.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:e,source:"api"}}))}catch{}}});o.defaultEnhancers=[];async function Ut(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=_e(s);let a=s&&typeof s.localization=="object"&&s.localization?s.localization:null;a?(await W(),re(a)):re(null);let r;if(t==="static")r=await $t(s);else{let{localization:S,...b}=s||{},d=Y(b,{resolvePublicAssetURL:q}),i=b?.managerURL||b?.public?.managerURL||b?.manager?.url||new URL("core/pds-manager.js",d).href||new URL("./pds-manager.js",import.meta.url).href,{startLive:p}=await import(i);r=await p(o,b,{emitReady:ot,emitConfigChanged:rt,applyResolvedTheme:ve,setupSystemListenerIfNeeded:Ae})}o.compiled=_e(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=Ut;async function $t(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=Y(e,{resolvePublicAssetURL:q}),l=e&&e.autoDefine||null,S;l&&l.baseURL?S=V(Q(l.baseURL,{preferModule:!1})):S=`${r}components/`;let b=l&&Array.isArray(l.predefine)&&l.predefine||[],d=l&&typeof l.mapper=="function"&&l.mapper||null;try{Oe(o);let{resolvedTheme:i}=Ie({manageTheme:n,themeStorageKey:s,applyResolvedTheme:ve,setupSystemListenerIfNeeded:Ae}),p=await Ct(r,e),A=Array.isArray(e?.enhancers)?e.enhancers:e?.enhancers&&typeof e.enhancers=="object"?Object.values(e.enhancers):[],L=p?.config?{...p.config,...e,design:e?.design||p.config.design,preset:e?.preset||p.config.preset}:{...e},j={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`},D=p?.paths||{};if(a={...j,...D,...a},o.registry.setStaticMode(a),t&&typeof document<"u")try{let w=await o.registry.getStylesheet("styles");if(w){w._pds=!0;let u=(document.adoptedStyleSheets||[]).filter(h=>h._pds!==!0);document.adoptedStyleSheets=[...u,w],rt({mode:"static",source:"static:styles-applied"})}}catch(w){qe.call(o,"warn","Failed to apply static styles:",w)}let c=null,y=[];try{let w=await Dt(),u=await Fe({autoDefineBaseURL:S,autoDefinePreload:b,autoDefineMapper:d,enhancers:A,autoDefineOverrides:l||null,autoDefinePreferModule:!(l&&l.baseURL)},{baseEnhancers:w});c=u.autoDefiner,y=u.mergedEnhancers||[]}catch(w){qe.call(o,"error","\u274C Failed to initialize AutoDefiner/Enhancers (static):",w)}return o.compiled=_e({mode:"static",...L,theme:i,enhancers:y}),ot({mode:"static",config:L,theme:i,autoDefiner:c}),{config:L,theme:i,autoDefiner:c}}catch(i){throw o.dispatchEvent(new CustomEvent("pds:error",{detail:{error:i}})),i}}var Nt=o.createJSONLocalization({locale:"en-US",locales:["en-US","nl-NL"],aliases:{en:["en-US"],nl:["nl-NL"]},basePath:"/assets/locales"}),it={mode:"live",liveEdit:!0,preset:"default",localization:Nt,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 R={name:"@pure-ds/core",shortname:"pds",version:"0.7.54",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(it);document.documentElement.lang="en";var at=typeof R.repository=="string"?R.repository:R.repository?.url,It=at?at.replace(/^git\+/,"").replace(/\.git$/,""):"",bn=R.homepage||It,wn=R.bugs?.url||"";document.body.appendChild(Ee`
|
|
3
3
|
<div class="container text-center">
|
|
4
|
-
<img src="/assets/img/pds-logo.svg" alt="PDS Logo" title="${
|
|
4
|
+
<img src="/assets/img/pds-logo.svg" alt="PDS Logo" title="${$("PDS Logo")}" width="64" height="64" />
|
|
5
5
|
<header class="container section">
|
|
6
6
|
<h1 @click=${()=>o.toast("Hallo")}>
|
|
7
|
-
${
|
|
7
|
+
${R.name} ${$(ie`version ${R.version}`)}
|
|
8
8
|
</h1>
|
|
9
|
-
<small class="text-muted">${
|
|
9
|
+
<small class="text-muted">${$(R.description)}</small>
|
|
10
10
|
</header>
|
|
11
11
|
</div>
|
|
12
12
|
`);
|