@pure-ds/core 0.7.50 → 0.7.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2136 +1,12 @@
1
- var __defProp = Object.defineProperty;
2
- var __export = (target, all) => {
3
- for (var name in all)
4
- __defProp(target, name, { get: all[name], enumerable: true });
5
- };
6
-
7
- // src/js/pds-singleton.js
8
- var PDSBase = class extends EventTarget {
9
- constructor() {
10
- super();
11
- this.mode = null;
12
- this.compiled = null;
13
- this.log = () => {
14
- };
15
- this.logHandler = null;
16
- }
17
- };
18
- var PDS_SINGLETON_KEY = "__PURE_DS_PDS_SINGLETON__";
19
- var globalScope = typeof globalThis !== "undefined" ? globalThis : window;
20
- var existingPDS = globalScope?.[PDS_SINGLETON_KEY];
21
- var PDS = existingPDS && typeof existingPDS.addEventListener === "function" ? existingPDS : new PDSBase();
22
- if (globalScope) {
23
- globalScope[PDS_SINGLETON_KEY] = PDS;
24
- }
25
- if (typeof PDS.log !== "function") {
26
- PDS.log = (level = "log", message, ...data) => {
27
- if (typeof console === "undefined")
28
- return;
29
- const method = typeof console[level] === "function" ? console[level].bind(console) : typeof console.log === "function" ? console.log.bind(console) : null;
30
- if (!method)
31
- return;
32
- if (data.length > 0) {
33
- method(message, ...data);
34
- } else {
35
- method(message);
36
- }
37
- };
38
- }
39
- if (typeof PDS.logHandler !== "function") {
40
- PDS.logHandler = null;
41
- }
42
-
43
- // src/js/pds-core/pds-registry.js
44
- var PDSRegistry = class {
45
- constructor() {
46
- this._mode = "static";
47
- this._staticPaths = {
48
- tokens: "/assets/pds/styles/pds-tokens.css.js",
49
- primitives: "/assets/pds/styles/pds-primitives.css.js",
50
- components: "/assets/pds/styles/pds-components.css.js",
51
- utilities: "/assets/pds/styles/pds-utilities.css.js",
52
- styles: "/assets/pds/styles/pds-styles.css.js"
53
- };
54
- }
55
- /**
56
- * Switch to live mode
57
- */
58
- setLiveMode() {
59
- this._mode = "live";
60
- }
61
- /**
62
- * Switch to static mode with custom paths
63
- * Called by consumers who want to use static CSS files
64
- */
65
- setStaticMode(paths = {}) {
66
- this._mode = "static";
67
- this._staticPaths = { ...this._staticPaths, ...paths };
68
- }
69
- /**
70
- * Get stylesheet for adoption in shadow DOM
71
- * Returns CSSStyleSheet object (constructable stylesheet)
72
- */
73
- async getStylesheet(layer) {
74
- if (this._mode === "live") {
75
- return null;
76
- } else {
77
- try {
78
- const module = await import(
79
- /* @vite-ignore */
80
- this._staticPaths[layer]
81
- );
82
- return module[layer];
83
- } catch (error) {
84
- PDS.log("error", `Registry: failed to load static ${layer}:`, error);
85
- PDS.log("error", `Registry: looking for ${this._staticPaths[layer]}`);
86
- PDS.log("error", "Registry: make sure you've run 'npm run pds:build' and configured PDS.start() with the correct static.root path");
87
- const fallback = new CSSStyleSheet();
88
- fallback.replaceSync("/* Failed to load " + layer + " */");
89
- return fallback;
90
- }
91
- }
92
- }
93
- /**
94
- * Get current mode
95
- */
96
- get mode() {
97
- return this._mode;
98
- }
99
- /**
100
- * Check if in live mode
101
- */
102
- get isLive() {
103
- return this._mode === "live";
104
- }
105
- };
106
- var registry = new PDSRegistry();
107
-
108
- // src/js/pds-core/pds-runtime.js
109
- async function adoptPrimitives(shadowRoot, additionalSheets = [], generator = null) {
110
- try {
111
- const primitives = generator?.primitivesStylesheet ? generator.primitivesStylesheet : await registry.getStylesheet("primitives");
112
- shadowRoot.adoptedStyleSheets = [primitives, ...additionalSheets];
113
- } catch (error) {
114
- const componentName = shadowRoot.host?.tagName?.toLowerCase() || "unknown";
115
- PDS.log(
116
- "error",
117
- `Adopter: <${componentName}> failed to adopt primitives:`,
118
- error
119
- );
120
- shadowRoot.adoptedStyleSheets = additionalSheets;
121
- }
122
- }
123
- async function adoptLayers(shadowRoot, layers = ["primitives"], additionalSheets = [], generator = null) {
124
- const safeAdditionalSheets = Array.isArray(additionalSheets) ? additionalSheets.filter(Boolean) : [];
125
- if (safeAdditionalSheets.length) {
126
- const existing = Array.isArray(shadowRoot.adoptedStyleSheets) ? shadowRoot.adoptedStyleSheets : [];
127
- const nonAdditional = existing.filter(
128
- (sheet) => !safeAdditionalSheets.includes(sheet)
129
- );
130
- shadowRoot.adoptedStyleSheets = [...nonAdditional, ...safeAdditionalSheets];
131
- }
132
- try {
133
- const stylesheets = await Promise.all(
134
- layers.map(async (layer) => {
135
- if (generator) {
136
- switch (layer) {
137
- case "tokens":
138
- return generator.tokensStylesheet;
139
- case "primitives":
140
- return generator.primitivesStylesheet;
141
- case "components":
142
- return generator.componentsStylesheet;
143
- case "utilities":
144
- return generator.utilitiesStylesheet;
145
- default:
146
- break;
147
- }
148
- }
149
- return registry.getStylesheet(layer);
150
- })
151
- );
152
- const validStylesheets = stylesheets.filter((sheet) => sheet !== null);
153
- shadowRoot.adoptedStyleSheets = [...validStylesheets, ...safeAdditionalSheets];
154
- } catch (error) {
155
- const componentName = shadowRoot.host?.tagName?.toLowerCase() || "unknown";
156
- PDS.log(
157
- "error",
158
- `Adopter: <${componentName}> failed to adopt layers:`,
159
- error
160
- );
161
- shadowRoot.adoptedStyleSheets = safeAdditionalSheets;
162
- }
163
- }
164
- function createStylesheet(css) {
165
- const sheet = new CSSStyleSheet();
166
- sheet.replaceSync(css);
167
- return sheet;
168
- }
169
-
170
- // src/js/pds-core/pds-enums.js
171
- var enums = {
172
- FontWeights: {
173
- light: 300,
174
- normal: 400,
175
- medium: 500,
176
- semibold: 600,
177
- bold: 700
178
- },
179
- LineHeights: {
180
- tight: 1.25,
181
- normal: 1.5,
182
- relaxed: 1.75
183
- },
184
- BorderWidths: {
185
- hairline: 0.5,
186
- thin: 1,
187
- medium: 2,
188
- thick: 3
189
- },
190
- RadiusSizes: {
191
- none: 0,
192
- small: 4,
193
- medium: 8,
194
- large: 16,
195
- xlarge: 24,
196
- xxlarge: 32
197
- },
198
- ShadowDepths: {
199
- none: "none",
200
- light: "0 1px 2px 0 rgba(0, 0, 0, 0.05)",
201
- medium: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",
202
- deep: "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",
203
- extreme: "0 25px 50px -12px rgba(0, 0, 0, 0.25)"
204
- },
205
- TransitionSpeeds: {
206
- fast: 150,
207
- normal: 250,
208
- slow: 350
209
- },
210
- AnimationEasings: {
211
- linear: "linear",
212
- ease: "ease",
213
- "ease-in": "ease-in",
214
- "ease-out": "ease-out",
215
- "ease-in-out": "ease-in-out",
216
- bounce: "cubic-bezier(0.68, -0.55, 0.265, 1.55)"
217
- },
218
- TouchTargetSizes: {
219
- compact: 36,
220
- standard: 44,
221
- // iOS/Android accessibility standard
222
- comfortable: 48,
223
- spacious: 56
224
- },
225
- LinkStyles: {
226
- inline: "inline",
227
- // Normal inline text links
228
- block: "block",
229
- // Block-level links
230
- button: "button"
231
- // Button-like links (flex with touch target)
232
- },
233
- FocusStyles: {
234
- ring: "ring",
235
- // Box-shadow ring (default)
236
- outline: "outline",
237
- // Browser outline
238
- border: "border",
239
- // Border change
240
- glow: "glow"
241
- // Subtle glow effect
242
- },
243
- TabSizes: {
244
- compact: 2,
245
- standard: 4,
246
- wide: 8
247
- },
248
- SelectIcons: {
249
- chevron: "chevron",
250
- // Standard chevron down
251
- arrow: "arrow",
252
- // Simple arrow
253
- caret: "caret",
254
- // Triangle caret
255
- none: "none"
256
- // No icon
257
- },
258
- IconSizes: {
259
- xs: 16,
260
- sm: 20,
261
- md: 24,
262
- lg: 32,
263
- xl: 48,
264
- "2xl": 64,
265
- "3xl": 96
266
- }
267
- };
268
-
269
- // src/js/common/common.js
270
- var common_exports = {};
271
- __export(common_exports, {
272
- deepMerge: () => deepMerge,
273
- fragmentFromTemplateLike: () => fragmentFromTemplateLike,
274
- isObject: () => isObject,
275
- parseHTML: () => parseHTML
276
- });
277
- function isObject(item) {
278
- return item && typeof item === "object" && !Array.isArray(item);
279
- }
280
- function deepMerge(target, source) {
281
- const output = { ...target };
282
- if (isObject(target) && isObject(source)) {
283
- Object.keys(source).forEach((key) => {
284
- if (isObject(source[key])) {
285
- if (!(key in target))
286
- Object.assign(output, { [key]: source[key] });
287
- else
288
- output[key] = deepMerge(target[key], source[key]);
289
- } else {
290
- Object.assign(output, { [key]: source[key] });
291
- }
292
- });
293
- }
294
- return output;
295
- }
296
- function fragmentFromTemplateLike(templateLike) {
297
- const strings = Array.isArray(templateLike?.strings) ? templateLike.strings : [];
298
- const values = Array.isArray(templateLike?.values) ? templateLike.values : [];
299
- const consumedValues = /* @__PURE__ */ new Set();
300
- const htmlParts = [];
301
- const propBindingPattern = /(\s)(\.[\w-]+)=\s*$/;
302
- for (let i = 0; i < strings.length; i += 1) {
303
- let chunk = strings[i] ?? "";
304
- const match = chunk.match(propBindingPattern);
305
- if (match && i < values.length) {
306
- const propToken = match[2];
307
- const propName = propToken.slice(1);
308
- const marker = `pds-val-${i}`;
309
- chunk = chunk.replace(
310
- propBindingPattern,
311
- `$1data-pds-prop="${propName}:${marker}"`
312
- );
313
- consumedValues.add(i);
314
- }
315
- htmlParts.push(chunk);
316
- if (i < values.length && !consumedValues.has(i)) {
317
- htmlParts.push(`<!--pds-val-${i}-->`);
318
- }
319
- }
320
- const tpl = document.createElement("template");
321
- tpl.innerHTML = htmlParts.join("");
322
- const replaceValueAtMarker = (markerNode, value) => {
323
- const parent = markerNode.parentNode;
324
- if (!parent)
325
- return;
326
- if (value == null) {
327
- parent.removeChild(markerNode);
328
- return;
329
- }
330
- const insertValue = (val) => {
331
- if (val == null)
332
- return;
333
- if (val instanceof Node) {
334
- parent.insertBefore(val, markerNode);
335
- return;
336
- }
337
- if (Array.isArray(val)) {
338
- val.forEach((item) => insertValue(item));
339
- return;
340
- }
341
- parent.insertBefore(document.createTextNode(String(val)), markerNode);
342
- };
343
- insertValue(value);
344
- parent.removeChild(markerNode);
345
- };
346
- const walker = document.createTreeWalker(tpl.content, NodeFilter.SHOW_COMMENT);
347
- const markers = [];
348
- while (walker.nextNode()) {
349
- const node = walker.currentNode;
350
- if (node?.nodeValue?.startsWith("pds-val-")) {
351
- markers.push(node);
352
- }
353
- }
354
- markers.forEach((node) => {
355
- const index = Number(node.nodeValue.replace("pds-val-", ""));
356
- replaceValueAtMarker(node, values[index]);
357
- });
358
- const elements = tpl.content.querySelectorAll("*");
359
- elements.forEach((el) => {
360
- const propAttr = el.getAttribute("data-pds-prop");
361
- if (!propAttr)
362
- return;
363
- const [propName, markerValue] = propAttr.split(":");
364
- const index = Number(String(markerValue).replace("pds-val-", ""));
365
- if (propName && Number.isInteger(index)) {
366
- el[propName] = values[index];
367
- }
368
- el.removeAttribute("data-pds-prop");
369
- });
370
- return tpl.content;
371
- }
372
- function parseHTML(html) {
373
- return new DOMParser().parseFromString(html, "text/html").body.childNodes;
374
- }
375
-
376
- // src/js/pds-core/pds-paths.js
377
- var DEFAULT_SEGMENT = "pds";
378
- var URL_PATTERN = /^([a-z][a-z0-9+\-.]*:)?\/\//i;
379
- var DRIVE_PATTERN = /^[a-z]:/i;
380
- function ensureTrailingSlash(value = "") {
381
- return value.endsWith("/") ? value : `${value}/`;
382
- }
383
- function appendSegmentIfMissing(input = "", segment = DEFAULT_SEGMENT) {
384
- const trimmed = input.replace(/\/+$/, "");
385
- const regex = new RegExp(`(?:^|/)${segment}$`, "i");
386
- if (regex.test(trimmed)) {
387
- return trimmed;
388
- }
389
- return `${trimmed}/${segment}`;
390
- }
391
- function stripLeadingDotSlash(value) {
392
- return value.replace(/^\.\/+/, "");
393
- }
394
- function stripDriveLetter(value) {
395
- if (DRIVE_PATTERN.test(value)) {
396
- return value.replace(DRIVE_PATTERN, "").replace(/^\/+/, "");
397
- }
398
- return value;
399
- }
400
- function stripPublicPrefix(value) {
401
- if (value.startsWith("public/")) {
402
- return value.substring("public/".length);
403
- }
404
- return value;
405
- }
406
- function resolvePublicAssetURL(config2, options = {}) {
407
- const segment = options.segment || DEFAULT_SEGMENT;
408
- const defaultRoot = options.defaultRoot || `/assets/${segment}/`;
409
- const candidate = config2?.public && config2.public?.root || config2?.static && config2.static?.root || null;
410
- if (!candidate || typeof candidate !== "string") {
411
- return ensureTrailingSlash(defaultRoot);
412
- }
413
- let normalized = candidate.trim();
414
- if (!normalized) {
415
- return ensureTrailingSlash(defaultRoot);
416
- }
417
- normalized = normalized.replace(/\\/g, "/");
418
- normalized = appendSegmentIfMissing(normalized, segment);
419
- normalized = ensureTrailingSlash(normalized);
420
- if (URL_PATTERN.test(normalized)) {
421
- return normalized;
422
- }
423
- normalized = stripLeadingDotSlash(normalized);
424
- normalized = stripDriveLetter(normalized);
425
- if (normalized.startsWith("/")) {
426
- return ensureTrailingSlash(normalized);
427
- }
428
- normalized = stripPublicPrefix(normalized);
429
- if (!normalized.startsWith("/")) {
430
- normalized = `/${normalized}`;
431
- }
432
- normalized = normalized.replace(
433
- /\/+/g,
434
- (match, offset) => offset === 0 ? match : "/"
435
- );
436
- return ensureTrailingSlash(normalized);
437
- }
438
-
439
- // node_modules/pure-web/src/js/auto-definer.js
440
- async function defineWebComponents(...args) {
441
- let opts = {};
442
- if (args.length && typeof args[args.length - 1] === "object") {
443
- opts = args.pop() || {};
444
- }
445
- const tags = args;
446
- const {
447
- baseURL,
448
- mapper = (tag) => `${tag}.js`,
449
- onError = (tag, err) => console.error(`[defineWebComponents] ${tag}:`, err)
450
- } = opts;
451
- const base = baseURL ? new URL(
452
- baseURL,
453
- typeof location !== "undefined" ? location.href : import.meta.url
454
- ) : new URL("./", import.meta.url);
455
- const toPascal = (tag) => tag.toLowerCase().replace(/(^|-)([a-z])/g, (_, __, c) => c.toUpperCase());
456
- const loadOne = async (tag) => {
457
- try {
458
- if (customElements.get(tag))
459
- return { tag, status: "already-defined" };
460
- const spec = mapper(tag);
461
- const href = spec instanceof URL ? spec.href : new URL(spec, base).href;
462
- const mod = await import(href);
463
- const Named = mod?.default ?? mod?.[toPascal(tag)];
464
- if (!Named) {
465
- if (customElements.get(tag))
466
- return { tag, status: "self-defined" };
467
- throw new Error(
468
- `No export found for ${tag}. Expected default export or named export "${toPascal(
469
- tag
470
- )}".`
471
- );
472
- }
473
- if (!customElements.get(tag)) {
474
- customElements.define(tag, Named);
475
- return { tag, status: "defined" };
476
- }
477
- return { tag, status: "race-already-defined" };
478
- } catch (err) {
479
- onError(tag, err);
480
- throw err;
481
- }
482
- };
483
- return Promise.all(tags.map(loadOne));
484
- }
485
- var AutoDefiner = class {
486
- constructor(options = {}) {
487
- const {
488
- baseURL,
489
- mapper,
490
- onError,
491
- predicate = () => true,
492
- attributeModule = "data-module",
493
- root = document,
494
- scanExisting = true,
495
- debounceMs = 16,
496
- observeShadows = true,
497
- enhancers = [],
498
- // [{String selector, Function run(elem)}]
499
- patchAttachShadow = true
500
- } = options;
501
- const pending = /* @__PURE__ */ new Set();
502
- const inFlight = /* @__PURE__ */ new Set();
503
- const knownMissing = /* @__PURE__ */ new Set();
504
- const perTagModulePath = /* @__PURE__ */ new Map();
505
- const shadowObservers = /* @__PURE__ */ new WeakMap();
506
- const enhancerApplied = /* @__PURE__ */ new WeakMap();
507
- let timer = 0;
508
- let stopped = false;
509
- let restoreAttachShadow = null;
510
- const applyEnhancers = (element) => {
511
- if (!element || !enhancers.length)
512
- return;
513
- let appliedEnhancers = enhancerApplied.get(element);
514
- if (!appliedEnhancers) {
515
- appliedEnhancers = /* @__PURE__ */ new Set();
516
- enhancerApplied.set(element, appliedEnhancers);
517
- }
518
- for (const enhancer of enhancers) {
519
- if (!enhancer.selector || !enhancer.run)
520
- continue;
521
- if (appliedEnhancers.has(enhancer.selector))
522
- continue;
523
- try {
524
- if (element.matches && element.matches(enhancer.selector)) {
525
- enhancer.run(element);
526
- appliedEnhancers.add(enhancer.selector);
527
- }
528
- } catch (err) {
529
- console.warn(
530
- `[AutoDefiner] Error applying enhancer for selector "${enhancer.selector}":`,
531
- err
532
- );
533
- }
534
- }
535
- };
536
- const queueTag = (tag, el) => {
537
- if (stopped)
538
- return;
539
- if (!tag || !tag.includes("-"))
540
- return;
541
- if (customElements.get(tag))
542
- return;
543
- if (inFlight.has(tag))
544
- return;
545
- if (knownMissing.has(tag))
546
- return;
547
- if (el && el.getAttribute) {
548
- const override = el.getAttribute(attributeModule);
549
- if (override && !perTagModulePath.has(tag)) {
550
- perTagModulePath.set(tag, override);
551
- }
552
- }
553
- pending.add(tag);
554
- schedule();
555
- };
556
- const schedule = () => {
557
- if (timer)
558
- return;
559
- timer = setTimeout(flush, debounceMs);
560
- };
561
- const crawlTree = (rootNode) => {
562
- if (!rootNode)
563
- return;
564
- if (rootNode.nodeType === 1) {
565
- const el = (
566
- /** @type {Element} */
567
- rootNode
568
- );
569
- const tag = el.tagName?.toLowerCase();
570
- if (tag && tag.includes("-") && !customElements.get(tag) && predicate(tag, el)) {
571
- queueTag(tag, el);
572
- }
573
- applyEnhancers(el);
574
- if (observeShadows && el.shadowRoot) {
575
- observeShadowRoot(el.shadowRoot);
576
- }
577
- }
578
- if (rootNode.querySelectorAll) {
579
- rootNode.querySelectorAll("*").forEach((e) => {
580
- const t = e.tagName?.toLowerCase();
581
- if (t && t.includes("-") && !customElements.get(t) && predicate(t, e)) {
582
- queueTag(t, e);
583
- }
584
- applyEnhancers(e);
585
- if (observeShadows && e.shadowRoot) {
586
- observeShadowRoot(e.shadowRoot);
587
- }
588
- });
589
- }
590
- };
591
- const observeShadowRoot = (sr) => {
592
- if (!sr || shadowObservers.has(sr))
593
- return;
594
- crawlTree(sr);
595
- const mo = new MutationObserver((mutations) => {
596
- for (const m of mutations) {
597
- m.addedNodes?.forEach((n) => {
598
- crawlTree(n);
599
- });
600
- if (m.type === "attributes" && m.target) {
601
- crawlTree(m.target);
602
- }
603
- }
604
- });
605
- mo.observe(sr, {
606
- childList: true,
607
- subtree: true,
608
- attributes: true,
609
- attributeFilter: [
610
- attributeModule,
611
- ...enhancers.map((e) => e.selector).filter((s) => s.startsWith("data-"))
612
- ]
613
- });
614
- shadowObservers.set(sr, mo);
615
- };
616
- async function flush() {
617
- clearTimeout(timer);
618
- timer = 0;
619
- if (!pending.size)
620
- return;
621
- const tags = Array.from(pending);
622
- pending.clear();
623
- tags.forEach((t) => inFlight.add(t));
624
- try {
625
- const effectiveMapper = (tag) => perTagModulePath.get(tag) ?? (mapper ? mapper(tag) : `${tag}.js`);
626
- await defineWebComponents(...tags, {
627
- baseURL,
628
- mapper: effectiveMapper,
629
- onError: (tag, err) => {
630
- knownMissing.add(tag);
631
- onError?.(tag, err);
632
- }
633
- });
634
- } catch {
635
- } finally {
636
- tags.forEach((t) => inFlight.delete(t));
637
- }
638
- }
639
- const mountNode = root === document ? document.documentElement : root;
640
- const obs = new MutationObserver((mutations) => {
641
- for (const m of mutations) {
642
- m.addedNodes?.forEach((n) => {
643
- crawlTree(n);
644
- });
645
- if (m.type === "attributes" && m.target) {
646
- crawlTree(m.target);
647
- }
648
- }
649
- });
650
- obs.observe(mountNode, {
651
- childList: true,
652
- subtree: true,
653
- attributes: true,
654
- attributeFilter: [
655
- attributeModule,
656
- ...enhancers.map((e) => e.selector).filter((s) => s.startsWith("data-"))
657
- ]
658
- });
659
- if (observeShadows && patchAttachShadow && Element.prototype.attachShadow) {
660
- const orig = Element.prototype.attachShadow;
661
- Element.prototype.attachShadow = function patchedAttachShadow(init) {
662
- const sr = orig.call(this, init);
663
- if (init && init.mode === "open") {
664
- observeShadowRoot(sr);
665
- const tag = this.tagName?.toLowerCase();
666
- if (tag && tag.includes("-") && !customElements.get(tag)) {
667
- queueTag(tag, this);
668
- }
669
- }
670
- return sr;
671
- };
672
- restoreAttachShadow = () => Element.prototype.attachShadow = orig;
673
- }
674
- if (scanExisting) {
675
- crawlTree(mountNode);
676
- }
677
- return {
678
- stop() {
679
- stopped = true;
680
- obs.disconnect();
681
- if (restoreAttachShadow)
682
- restoreAttachShadow();
683
- if (timer) {
684
- clearTimeout(timer);
685
- timer = 0;
686
- }
687
- shadowObservers.forEach((mo) => mo.disconnect());
688
- },
689
- flush
690
- };
691
- }
692
- /**
693
- * Dynamically load and (idempotently) define a set of web components by tag name.
694
- */
695
- static async define(...args) {
696
- let opts = {};
697
- if (args.length && typeof args[args.length - 1] === "object") {
698
- opts = args.pop() || {};
699
- }
700
- const tags = args;
701
- const {
702
- baseURL,
703
- mapper = (tag) => `${tag}.js`,
704
- onError = (tag, err) => console.error(`[defineWebComponents] ${tag}:`, err)
705
- } = opts;
706
- const base = baseURL ? new URL(
707
- baseURL,
708
- typeof location !== "undefined" ? location.href : import.meta.url
709
- ) : new URL("./", import.meta.url);
710
- const toPascal = (tag) => tag.toLowerCase().replace(/(^|-)([a-z])/g, (_, __, c) => c.toUpperCase());
711
- const loadOne = async (tag) => {
712
- try {
713
- if (customElements.get(tag))
714
- return { tag, status: "already-defined" };
715
- const spec = mapper(tag);
716
- const href = spec instanceof URL ? spec.href : new URL(spec, base).href;
717
- const mod = await import(href);
718
- const Named = mod?.default ?? mod?.[toPascal(tag)];
719
- if (!Named) {
720
- if (customElements.get(tag))
721
- return { tag, status: "self-defined" };
722
- throw new Error(
723
- `No export found for ${tag}. Expected default export or named export "${toPascal(
724
- tag
725
- )}".`
726
- );
727
- }
728
- if (!customElements.get(tag)) {
729
- customElements.define(tag, Named);
730
- return { tag, status: "defined" };
731
- }
732
- return { tag, status: "race-already-defined" };
733
- } catch (err) {
734
- onError(tag, err);
735
- throw err;
736
- }
737
- };
738
- return Promise.all(tags.map(loadOne));
739
- }
740
- };
741
-
742
- // src/js/pds-core/pds-start-helpers.js
743
- var __ABSOLUTE_URL_PATTERN__ = /^[a-z][a-z0-9+\-.]*:\/\//i;
744
- var __MODULE_URL__ = (() => {
745
- try {
746
- return import.meta.url;
747
- } catch (e) {
748
- return void 0;
749
- }
750
- })();
751
- var ensureTrailingSlash2 = (value) => typeof value === "string" && value.length && !value.endsWith("/") ? `${value}/` : value;
752
- function ensureAbsoluteAssetURL(value, options = {}) {
753
- if (!value || __ABSOLUTE_URL_PATTERN__.test(value)) {
754
- return value;
755
- }
756
- const { preferModule = true } = options;
757
- const tryModule = () => {
758
- if (!__MODULE_URL__)
759
- return null;
760
- try {
761
- return new URL(value, __MODULE_URL__).href;
762
- } catch (e) {
763
- return null;
764
- }
765
- };
766
- const tryWindow = () => {
767
- if (typeof window === "undefined" || !window.location?.origin) {
768
- return null;
769
- }
770
- try {
771
- return new URL(value, window.location.origin).href;
772
- } catch (e) {
773
- return null;
774
- }
775
- };
776
- const resolved = preferModule ? tryModule() || tryWindow() : tryWindow() || tryModule();
777
- return resolved || value;
778
- }
779
- var __MODULE_DEFAULT_ASSET_ROOT__ = (() => {
780
- if (!__MODULE_URL__)
781
- return void 0;
782
- try {
783
- const parsed = new URL(__MODULE_URL__);
784
- if (/\/public\/assets\/js\//.test(parsed.pathname)) {
785
- return new URL("../pds/", __MODULE_URL__).href;
786
- }
787
- } catch (e) {
788
- return void 0;
789
- }
790
- return void 0;
791
- })();
792
- var __foucListenerAttached = false;
793
- function attachFoucListener(PDS2) {
794
- if (__foucListenerAttached || typeof document === "undefined")
795
- return;
796
- __foucListenerAttached = true;
797
- PDS2.addEventListener("pds:ready", (event) => {
798
- const mode = event.detail?.mode;
799
- if (mode) {
800
- document.documentElement.classList.add(`pds-${mode}`, "pds-ready");
801
- }
802
- });
803
- }
804
- function resolveThemeAndApply({ manageTheme, themeStorageKey, applyResolvedTheme, setupSystemListenerIfNeeded }) {
805
- let resolvedTheme = "light";
806
- let storedTheme = null;
807
- if (manageTheme && typeof window !== "undefined") {
808
- try {
809
- storedTheme = localStorage.getItem(themeStorageKey) || null;
810
- } catch (e) {
811
- storedTheme = null;
812
- }
813
- try {
814
- applyResolvedTheme?.(storedTheme);
815
- setupSystemListenerIfNeeded?.(storedTheme);
816
- } catch (e) {
817
- }
818
- if (storedTheme) {
819
- if (storedTheme === "system") {
820
- const prefersDark = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches;
821
- resolvedTheme = prefersDark ? "dark" : "light";
822
- } else {
823
- resolvedTheme = storedTheme;
824
- }
825
- } else {
826
- const prefersDark = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches;
827
- resolvedTheme = prefersDark ? "dark" : "light";
828
- }
829
- }
830
- return { resolvedTheme, storedTheme };
831
- }
832
- function resolveRuntimeAssetRoot(config2, { resolvePublicAssetURL: resolvePublicAssetURL2 }) {
833
- const hasCustomRoot = Boolean(config2?.public?.root || config2?.static?.root);
834
- let candidate = resolvePublicAssetURL2(config2);
835
- if (!hasCustomRoot && __MODULE_DEFAULT_ASSET_ROOT__) {
836
- candidate = __MODULE_DEFAULT_ASSET_ROOT__;
837
- }
838
- return ensureTrailingSlash2(ensureAbsoluteAssetURL(candidate));
839
- }
840
- async function setupAutoDefinerAndEnhancers(options, { baseEnhancers = [] } = {}) {
841
- const {
842
- autoDefineBaseURL = "/auto-define/",
843
- autoDefinePreload = [],
844
- autoDefineMapper = null,
845
- enhancers = [],
846
- autoDefineOverrides = null,
847
- autoDefinePreferModule = true
848
- } = options;
849
- const mergedEnhancers = (() => {
850
- const map = /* @__PURE__ */ new Map();
851
- (baseEnhancers || []).forEach((e) => map.set(e.selector, e));
852
- (enhancers || []).forEach((e) => map.set(e.selector, e));
853
- return Array.from(map.values());
854
- })();
855
- let autoDefiner = null;
856
- if (typeof window !== "undefined" && typeof document !== "undefined") {
857
- const AutoDefinerCtor = AutoDefiner;
858
- const defaultMapper = (tag) => {
859
- switch (tag) {
860
- case "pds-tabpanel":
861
- return "pds-tabstrip.js";
862
- default:
863
- return `${tag}.js`;
864
- }
865
- };
866
- const {
867
- mapper: _overrideMapperIgnored,
868
- enhancers: overrideEnhancers,
869
- ...restAutoDefineOverrides
870
- } = autoDefineOverrides && typeof autoDefineOverrides === "object" ? autoDefineOverrides : {};
871
- const normalizedOverrideEnhancers = (() => {
872
- if (!overrideEnhancers)
873
- return [];
874
- if (Array.isArray(overrideEnhancers))
875
- return overrideEnhancers;
876
- if (typeof overrideEnhancers === "object") {
877
- return Object.values(overrideEnhancers);
878
- }
879
- return [];
880
- })();
881
- const resolvedEnhancers = (() => {
882
- const map = /* @__PURE__ */ new Map();
883
- (mergedEnhancers || []).forEach((enhancer) => {
884
- if (!enhancer?.selector)
885
- return;
886
- map.set(enhancer.selector, enhancer);
887
- });
888
- (normalizedOverrideEnhancers || []).forEach((enhancer) => {
889
- if (!enhancer?.selector)
890
- return;
891
- const existing = map.get(enhancer.selector) || null;
892
- map.set(enhancer.selector, {
893
- ...existing || {},
894
- ...enhancer,
895
- run: typeof enhancer?.run === "function" ? enhancer.run : existing?.run
896
- });
897
- });
898
- return Array.from(map.values());
899
- })();
900
- const normalizedBaseURL = autoDefineBaseURL ? ensureTrailingSlash2(
901
- ensureAbsoluteAssetURL(autoDefineBaseURL, {
902
- preferModule: autoDefinePreferModule
903
- })
904
- ) : autoDefineBaseURL;
905
- const autoDefineConfig = {
906
- baseURL: normalizedBaseURL,
907
- predefine: autoDefinePreload,
908
- scanExisting: true,
909
- observeShadows: true,
910
- patchAttachShadow: true,
911
- debounceMs: 16,
912
- enhancers: resolvedEnhancers,
913
- onError: (tag, err) => {
914
- if (typeof tag === "string" && tag.startsWith("pds-")) {
915
- const litDependentComponents = ["pds-form", "pds-drawer"];
916
- const isLitComponent = litDependentComponents.includes(tag);
917
- const isMissingLitError = err?.message?.includes("#pds/lit") || err?.message?.includes("Failed to resolve module specifier");
918
- if (isLitComponent && isMissingLitError) {
919
- PDS.log(
920
- "error",
921
- `\u274C PDS component <${tag}> requires Lit but #pds/lit is not in import map.
922
- See: https://github.com/Pure-Web-Foundation/pure-ds/blob/main/readme.md#lit-components-not-working`
923
- );
924
- } else {
925
- PDS.log(
926
- "warn",
927
- `\u26A0\uFE0F PDS component <${tag}> not found. Assets may not be installed.`
928
- );
929
- }
930
- } else {
931
- PDS.log("error", `\u274C Auto-define error for <${tag}>:`, err);
932
- }
933
- },
934
- // Apply all user overrides except mapper so we can still wrap it
935
- ...restAutoDefineOverrides,
936
- mapper: (tag) => {
937
- if (customElements.get(tag))
938
- return null;
939
- if (typeof autoDefineMapper === "function") {
940
- try {
941
- const mapped = autoDefineMapper(tag);
942
- if (mapped === void 0) {
943
- return defaultMapper(tag);
944
- }
945
- return mapped;
946
- } catch (e) {
947
- PDS.log(
948
- "warn",
949
- "Custom autoDefine.mapper error; falling back to default:",
950
- e?.message || e
951
- );
952
- return defaultMapper(tag);
953
- }
954
- }
955
- return defaultMapper(tag);
956
- }
957
- };
958
- autoDefiner = new AutoDefinerCtor(autoDefineConfig);
959
- if (autoDefinePreload.length > 0 && typeof AutoDefinerCtor.define === "function") {
960
- await AutoDefinerCtor.define(...autoDefinePreload, {
961
- baseURL: autoDefineBaseURL,
962
- mapper: autoDefineConfig.mapper,
963
- onError: autoDefineConfig.onError
964
- });
965
- }
966
- }
967
- return { autoDefiner, mergedEnhancers };
968
- }
969
-
970
- // src/js/pds-core/pds-theme-utils.js
971
- var DEFAULT_THEMES = ["light", "dark"];
972
- var VALID_THEMES = new Set(DEFAULT_THEMES);
973
- function normalizePresetThemes(preset) {
974
- const themes = Array.isArray(preset?.themes) ? preset.themes.map((theme) => String(theme).toLowerCase()) : DEFAULT_THEMES;
975
- const normalized = themes.filter((theme) => VALID_THEMES.has(theme));
976
- return normalized.length ? normalized : DEFAULT_THEMES;
977
- }
978
- function resolveThemePreference(preference, { preferDocument = true } = {}) {
979
- const normalized = String(preference || "").toLowerCase();
980
- if (VALID_THEMES.has(normalized))
981
- return normalized;
982
- if (preferDocument && typeof document !== "undefined") {
983
- const applied = document.documentElement?.getAttribute("data-theme");
984
- if (VALID_THEMES.has(applied))
985
- return applied;
986
- }
987
- if (typeof window !== "undefined" && window.matchMedia) {
988
- const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
989
- return prefersDark ? "dark" : "light";
990
- }
991
- return "light";
992
- }
993
- function isPresetThemeCompatible(preset, themePreference) {
994
- const resolvedTheme = resolveThemePreference(themePreference);
995
- const themes = normalizePresetThemes(preset);
996
- return themes.includes(resolvedTheme);
997
- }
998
-
999
- // src/js/common/pds-log.js
1000
- var __SUPPORTED_LOG_LEVELS = /* @__PURE__ */ new Set(["log", "warn", "error", "debug", "info"]);
1001
- var __PDS_SINGLETON_KEY = "__PURE_DS_PDS_SINGLETON__";
1002
- var __logProvider = null;
1003
- var __contextProvider = null;
1004
- function __resolveGlobalPDS() {
1005
- try {
1006
- const scope = typeof globalThis !== "undefined" ? globalThis : window;
1007
- const candidate = scope?.[__PDS_SINGLETON_KEY];
1008
- if (candidate && typeof candidate === "object") {
1009
- return candidate;
1010
- }
1011
- } catch (error) {
1012
- return null;
1013
- }
1014
- return null;
1015
- }
1016
- function __normalizeContext(context) {
1017
- if (!context || typeof context !== "object") {
1018
- return null;
1019
- }
1020
- return {
1021
- mode: context.mode === "live" || context.mode === "static" ? context.mode : null,
1022
- debug: context.debug === true,
1023
- thisArg: context.thisArg
1024
- };
1025
- }
1026
- function __normalizeLevel(level) {
1027
- if (typeof level !== "string")
1028
- return "log";
1029
- const normalized = level.toLowerCase();
1030
- return __SUPPORTED_LOG_LEVELS.has(normalized) ? normalized : "log";
1031
- }
1032
- function __resolveContext() {
1033
- if (typeof __contextProvider === "function") {
1034
- try {
1035
- const configuredContext = __normalizeContext(__contextProvider());
1036
- if (configuredContext) {
1037
- return configuredContext;
1038
- }
1039
- } catch (error) {
1040
- }
1041
- }
1042
- const globalPDS = __resolveGlobalPDS();
1043
- if (globalPDS) {
1044
- const mode = globalPDS?.mode || globalPDS?.compiled?.mode || (globalPDS?.registry?.isLive ? "live" : "static");
1045
- const debug = (globalPDS?.debug || globalPDS?.currentConfig?.debug || globalPDS?.currentConfig?.design?.debug || globalPDS?.compiled?.debug || globalPDS?.compiled?.design?.debug || false) === true;
1046
- return {
1047
- mode,
1048
- debug,
1049
- thisArg: globalPDS
1050
- };
1051
- }
1052
- return { mode: null, debug: false };
1053
- }
1054
- function __resolveLogger() {
1055
- if (typeof __logProvider === "function") {
1056
- try {
1057
- const logger = __logProvider();
1058
- if (typeof logger === "function") {
1059
- return logger;
1060
- }
1061
- } catch (error) {
1062
- }
1063
- }
1064
- const globalPDS = __resolveGlobalPDS();
1065
- if (typeof globalPDS?.logHandler === "function") {
1066
- return globalPDS.logHandler;
1067
- }
1068
- return null;
1069
- }
1070
- function __consoleLog(level, message, ...data) {
1071
- if (typeof console === "undefined")
1072
- return;
1073
- const method = typeof console[level] === "function" ? console[level].bind(console) : typeof console.log === "function" ? console.log.bind(console) : null;
1074
- if (!method)
1075
- return;
1076
- if (data.length > 0) {
1077
- method(message, ...data);
1078
- } else {
1079
- method(message);
1080
- }
1081
- }
1082
- function __shouldUseConsoleFallback(level, context) {
1083
- const debugEnabled = context?.debug === true;
1084
- const staticMode = context?.mode === "static";
1085
- if (staticMode && !debugEnabled) {
1086
- return false;
1087
- }
1088
- if (!debugEnabled && level !== "error" && level !== "warn") {
1089
- return false;
1090
- }
1091
- return true;
1092
- }
1093
- function configurePDSLogger({ getLogger, getContext } = {}) {
1094
- __logProvider = typeof getLogger === "function" ? getLogger : null;
1095
- __contextProvider = typeof getContext === "function" ? getContext : null;
1096
- }
1097
- function pdsLog(level = "log", message, ...data) {
1098
- const normalizedLevel = __normalizeLevel(level);
1099
- const context = __resolveContext();
1100
- const customLogger = __resolveLogger();
1101
- if (customLogger) {
1102
- try {
1103
- customLogger.call(context?.thisArg, normalizedLevel, message, ...data);
1104
- return;
1105
- } catch (error) {
1106
- __consoleLog("error", "Custom log handler failed:", error);
1107
- }
1108
- }
1109
- if (!__shouldUseConsoleFallback(normalizedLevel, context)) {
1110
- return;
1111
- }
1112
- __consoleLog(normalizedLevel, message, ...data);
1113
- }
1114
-
1115
- // src/js/pds.js
1116
- if (typeof PDS.initializing !== "boolean") {
1117
- PDS.initializing = false;
1118
- }
1119
- if (!("currentPreset" in PDS)) {
1120
- PDS.currentPreset = null;
1121
- }
1122
- if (typeof PDS.debug !== "boolean") {
1123
- PDS.debug = false;
1124
- }
1125
- if (!("currentConfig" in PDS)) {
1126
- PDS.currentConfig = null;
1127
- }
1128
- if (!("compiled" in PDS)) {
1129
- PDS.compiled = null;
1130
- }
1131
- if (typeof PDS.logHandler !== "function") {
1132
- PDS.logHandler = null;
1133
- }
1134
- if (!("mode" in PDS)) {
1135
- PDS.mode = null;
1136
- }
1137
- var __autoCompletePromise = null;
1138
- var __askPromise = null;
1139
- var __toastPromise = null;
1140
- var __defaultEnhancersPromise = null;
1141
- var __localizationPromise = null;
1142
- var __localizationRuntime = null;
1143
- var __LOCALIZATION_RUNTIME_SINGLETON_KEY__ = "__pdsLocalizationRuntime";
1144
- function __getLocalizationRuntimeSync() {
1145
- if (__localizationRuntime) {
1146
- return __localizationRuntime;
1147
- }
1148
- const sharedRuntime = PDS?.[__LOCALIZATION_RUNTIME_SINGLETON_KEY__];
1149
- if (sharedRuntime && typeof sharedRuntime === "object") {
1150
- __localizationRuntime = sharedRuntime;
1151
- return sharedRuntime;
1152
- }
1153
- return null;
1154
- }
1155
- function __setLocalizationRuntime(runtime) {
1156
- const normalizedRuntime = runtime && typeof runtime === "object" ? runtime : null;
1157
- __localizationRuntime = normalizedRuntime;
1158
- PDS[__LOCALIZATION_RUNTIME_SINGLETON_KEY__] = normalizedRuntime;
1159
- }
1160
- configurePDSLogger({
1161
- getLogger: () => typeof PDS.logHandler === "function" ? PDS.logHandler : null,
1162
- getContext: () => {
1163
- const mode = PDS?.mode || PDS?.compiled?.mode || (PDS?.registry?.isLive ? "live" : "static");
1164
- const debug = (PDS?.debug || PDS?.currentConfig?.debug || PDS?.currentConfig?.design?.debug || PDS?.compiled?.debug || PDS?.compiled?.design?.debug || false) === true;
1165
- return {
1166
- mode,
1167
- debug,
1168
- thisArg: PDS
1169
- };
1170
- }
1171
- });
1172
- PDS.log = (level = "log", message, ...data) => {
1173
- pdsLog(level, message, ...data);
1174
- };
1175
- var __fallbackLocalizationState = {
1176
- locale: "en",
1177
- messages: {},
1178
- hasProvider: false
1179
- };
1180
- var __pendingLocalizationKeys = /* @__PURE__ */ new Set();
1181
- function __isStrTagged(template) {
1182
- return Boolean(template) && typeof template !== "string" && typeof template === "object" && "strTag" in template;
1183
- }
1184
- function __collateStrings(strings = []) {
1185
- let result = "";
1186
- for (let index = 0; index <= strings.length - 1; index += 1) {
1187
- result += strings[index];
1188
- if (index < strings.length - 1) {
1189
- result += `{${index}}`;
1190
- }
1191
- }
1192
- return result;
1193
- }
1194
- function __replacePlaceholders(input, callback) {
1195
- return String(input).replace(
1196
- /\{(\d+)\}/g,
1197
- (_match, index) => callback(Number(index))
1198
- );
1199
- }
1200
- function __normalizeMessages(messages) {
1201
- if (!messages || typeof messages !== "object") {
1202
- return {};
1203
- }
1204
- const normalized = {};
1205
- for (const [key, value] of Object.entries(messages)) {
1206
- if (typeof value === "string") {
1207
- normalized[key] = value;
1208
- continue;
1209
- }
1210
- if (value && typeof value === "object" && typeof value.content === "string") {
1211
- normalized[key] = value.content;
1212
- }
1213
- }
1214
- return normalized;
1215
- }
1216
- function __fallbackStr(strings, ...values) {
1217
- return {
1218
- strTag: true,
1219
- strings: Array.from(strings || []),
1220
- values,
1221
- raw: Array.from(strings?.raw || [])
1222
- };
1223
- }
1224
- function __fallbackMsg(template) {
1225
- if (!template) {
1226
- return "";
1227
- }
1228
- if (__isStrTagged(template)) {
1229
- const key2 = __collateStrings(template.strings || []);
1230
- const translated = __fallbackLocalizationState.messages[key2] || key2;
1231
- return __replacePlaceholders(translated, (index) => template.values?.[index]);
1232
- }
1233
- const key = String(template);
1234
- return __fallbackLocalizationState.messages[key] || key;
1235
- }
1236
- function __queuePendingLocalizationKey(template) {
1237
- if (!template) {
1238
- return;
1239
- }
1240
- const key = __isStrTagged(template) ? __collateStrings(template.strings || []) : String(template);
1241
- if (typeof key === "string" && key.length > 0) {
1242
- __pendingLocalizationKeys.add(key);
1243
- }
1244
- }
1245
- function __flushPendingLocalizationKeys(runtime) {
1246
- if (!runtime || typeof runtime.msg !== "function" || __pendingLocalizationKeys.size === 0) {
1247
- return;
1248
- }
1249
- const pendingKeys = Array.from(__pendingLocalizationKeys);
1250
- __pendingLocalizationKeys.clear();
1251
- for (const key of pendingKeys) {
1252
- try {
1253
- runtime.msg(key);
1254
- } catch {
1255
- }
1256
- }
1257
- }
1258
- async function __loadLocalizationRuntime() {
1259
- const runtime = __getLocalizationRuntimeSync();
1260
- if (runtime) {
1261
- return runtime;
1262
- }
1263
- if (!__localizationPromise) {
1264
- const localizationModuleURL = __resolveExternalRuntimeModuleURL(
1265
- "pds-localization.js"
1266
- );
1267
- __localizationPromise = import(
1268
- /* @vite-ignore */
1269
- localizationModuleURL
1270
- ).then((mod) => {
1271
- if (typeof mod?.msg !== "function" || typeof mod?.str !== "function" || typeof mod?.configureLocalization !== "function" || typeof mod?.loadLocale !== "function" || typeof mod?.setLocale !== "function" || typeof mod?.getLocalizationState !== "function") {
1272
- throw new Error("Failed to load localization runtime exports");
1273
- }
1274
- __setLocalizationRuntime(mod);
1275
- __flushPendingLocalizationKeys(mod);
1276
- return mod;
1277
- }).catch((error) => {
1278
- __localizationPromise = null;
1279
- throw error;
1280
- });
1281
- }
1282
- return __localizationPromise;
1283
- }
1284
- var msg = (template, options = {}) => {
1285
- const runtime = __getLocalizationRuntimeSync();
1286
- if (typeof runtime?.msg === "function") {
1287
- return runtime.msg(template, options);
1288
- }
1289
- __queuePendingLocalizationKey(template);
1290
- return __fallbackMsg(template, options);
1291
- };
1292
- var str = (strings, ...values) => {
1293
- const runtime = __getLocalizationRuntimeSync();
1294
- if (typeof runtime?.str === "function") {
1295
- return runtime.str(strings, ...values);
1296
- }
1297
- return __fallbackStr(strings, ...values);
1298
- };
1299
- var configureLocalization = (config2 = null) => {
1300
- const runtime = __getLocalizationRuntimeSync();
1301
- if (typeof runtime?.configureLocalization === "function") {
1302
- return runtime.configureLocalization(config2);
1303
- }
1304
- if (!config2 || typeof config2 !== "object") {
1305
- __fallbackLocalizationState.locale = "en";
1306
- __fallbackLocalizationState.messages = {};
1307
- __fallbackLocalizationState.hasProvider = false;
1308
- return {
1309
- locale: __fallbackLocalizationState.locale,
1310
- messages: { ...__fallbackLocalizationState.messages },
1311
- hasProvider: __fallbackLocalizationState.hasProvider
1312
- };
1313
- }
1314
- if (typeof config2.locale === "string" && config2.locale.trim()) {
1315
- __fallbackLocalizationState.locale = config2.locale.trim();
1316
- }
1317
- if (Object.prototype.hasOwnProperty.call(config2, "messages")) {
1318
- __fallbackLocalizationState.messages = __normalizeMessages(config2.messages);
1319
- }
1320
- const hasProvider = Boolean(
1321
- config2.provider || config2.translate || config2.loadLocale || config2.setLocale
1322
- );
1323
- __fallbackLocalizationState.hasProvider = hasProvider;
1324
- if (hasProvider) {
1325
- __loadLocalizationRuntime().then((runtime2) => {
1326
- runtime2.configureLocalization(config2);
1327
- __flushPendingLocalizationKeys(runtime2);
1328
- }).catch(() => {
1329
- });
1330
- }
1331
- return {
1332
- locale: __fallbackLocalizationState.locale,
1333
- messages: { ...__fallbackLocalizationState.messages },
1334
- hasProvider: __fallbackLocalizationState.hasProvider
1335
- };
1336
- };
1337
- var loadLocale = async (locale) => {
1338
- const runtime = await __loadLocalizationRuntime();
1339
- return runtime.loadLocale(locale);
1340
- };
1341
- var setLocale = async (locale, options = {}) => {
1342
- const runtime = await __loadLocalizationRuntime();
1343
- return runtime.setLocale(locale, options);
1344
- };
1345
- var getLocalizationState = () => {
1346
- const runtime = __getLocalizationRuntimeSync();
1347
- if (typeof runtime?.getLocalizationState === "function") {
1348
- return runtime.getLocalizationState();
1349
- }
1350
- return {
1351
- locale: __fallbackLocalizationState.locale,
1352
- messages: { ...__fallbackLocalizationState.messages },
1353
- hasProvider: __fallbackLocalizationState.hasProvider
1354
- };
1355
- };
1356
- var createJSONLocalization = (options = {}) => {
1357
- const runtime = __getLocalizationRuntimeSync();
1358
- if (typeof runtime?.createJSONLocalization === "function") {
1359
- return runtime.createJSONLocalization(options);
1360
- }
1361
- const defaultLocale = typeof options?.locale === "string" && options.locale.trim() ? options.locale.trim().toLowerCase() : "en";
1362
- const configuredLocales = Array.isArray(options?.locales) ? options.locales.map((locale) => String(locale || "").trim().toLowerCase()).filter(Boolean) : [];
1363
- const locales = Array.from(/* @__PURE__ */ new Set([defaultLocale, ...configuredLocales]));
1364
- let __jsonLocalizationConfigPromise = null;
1365
- const __resolveJSONLocalizationConfig = async () => {
1366
- if (!__jsonLocalizationConfigPromise) {
1367
- __jsonLocalizationConfigPromise = __loadLocalizationRuntime().then((runtime2) => {
1368
- if (typeof runtime2?.createJSONLocalization === "function") {
1369
- return runtime2.createJSONLocalization(options);
1370
- }
1371
- return null;
1372
- }).catch(() => null);
1373
- }
1374
- return __jsonLocalizationConfigPromise;
1375
- };
1376
- const resolveLoader = async (kind = "loadLocale") => {
1377
- const runtimeConfig = await __resolveJSONLocalizationConfig();
1378
- if (!runtimeConfig || typeof runtimeConfig !== "object") {
1379
- return null;
1380
- }
1381
- const provider = runtimeConfig.provider;
1382
- if (!provider || typeof provider !== "object") {
1383
- return null;
1384
- }
1385
- const exactLoader = provider[kind];
1386
- if (typeof exactLoader === "function") {
1387
- return exactLoader;
1388
- }
1389
- if (kind === "setLocale" && typeof provider.loadLocale === "function") {
1390
- return provider.loadLocale;
1391
- }
1392
- return null;
1393
- };
1394
- return {
1395
- locale: defaultLocale,
1396
- locales: [...locales],
1397
- provider: {
1398
- locales: [...locales],
1399
- async loadLocale(context = {}) {
1400
- const loader = await resolveLoader("loadLocale");
1401
- if (typeof loader !== "function") {
1402
- return {};
1403
- }
1404
- return loader(context);
1405
- },
1406
- async setLocale(context = {}) {
1407
- const loader = await resolveLoader("setLocale");
1408
- if (typeof loader !== "function") {
1409
- return {};
1410
- }
1411
- return loader(context);
1412
- }
1413
- }
1414
- };
1415
- };
1416
- function __resolveExternalRuntimeModuleURL(filename, overrideURL) {
1417
- if (overrideURL && typeof overrideURL === "string") {
1418
- return overrideURL;
1419
- }
1420
- const assetRootURL = resolveRuntimeAssetRoot(PDS.currentConfig || {}, {
1421
- resolvePublicAssetURL
1422
- });
1423
- return `${assetRootURL}core/${filename}`;
1424
- }
1425
- async function __loadDefaultEnhancers() {
1426
- if (Array.isArray(PDS.defaultEnhancers) && PDS.defaultEnhancers.length > 0) {
1427
- return PDS.defaultEnhancers;
1428
- }
1429
- if (!__defaultEnhancersPromise) {
1430
- const enhancersModuleURL = __resolveExternalRuntimeModuleURL(
1431
- "pds-enhancers.js",
1432
- PDS.currentConfig?.enhancersURL
1433
- );
1434
- __defaultEnhancersPromise = import(
1435
- /* @vite-ignore */
1436
- enhancersModuleURL
1437
- ).then((mod) => {
1438
- const enhancers = Array.isArray(mod?.defaultPDSEnhancers) ? mod.defaultPDSEnhancers : [];
1439
- PDS.defaultEnhancers = enhancers;
1440
- return enhancers;
1441
- }).catch((error) => {
1442
- __defaultEnhancersPromise = null;
1443
- throw error;
1444
- });
1445
- }
1446
- return __defaultEnhancersPromise;
1447
- }
1448
- async function __loadAsk() {
1449
- if (typeof PDS.ask === "function" && PDS.ask !== __lazyAsk) {
1450
- return PDS.ask;
1451
- }
1452
- if (!__askPromise) {
1453
- const askModuleURL = __resolveExternalRuntimeModuleURL(
1454
- "pds-ask.js",
1455
- PDS.currentConfig?.askURL
1456
- );
1457
- __askPromise = import(
1458
- /* @vite-ignore */
1459
- askModuleURL
1460
- ).then((mod) => {
1461
- const impl = mod?.ask;
1462
- if (typeof impl !== "function") {
1463
- throw new Error("Failed to load ask helper");
1464
- }
1465
- PDS.ask = impl;
1466
- return impl;
1467
- }).catch((error) => {
1468
- __askPromise = null;
1469
- throw error;
1470
- });
1471
- }
1472
- return __askPromise;
1473
- }
1474
- async function __loadToast() {
1475
- if (typeof PDS.toast === "function" && PDS.toast !== __lazyToast) {
1476
- return PDS.toast;
1477
- }
1478
- if (!__toastPromise) {
1479
- const toastModuleURL = __resolveExternalRuntimeModuleURL(
1480
- "pds-toast.js",
1481
- PDS.currentConfig?.toastURL
1482
- );
1483
- __toastPromise = import(
1484
- /* @vite-ignore */
1485
- toastModuleURL
1486
- ).then((mod) => {
1487
- const impl = mod?.toast;
1488
- if (typeof impl !== "function") {
1489
- throw new Error("Failed to load toast helper");
1490
- }
1491
- PDS.toast = impl;
1492
- return impl;
1493
- }).catch((error) => {
1494
- __toastPromise = null;
1495
- throw error;
1496
- });
1497
- }
1498
- return __toastPromise;
1499
- }
1500
- async function __lazyAsk(...args) {
1501
- const askImpl = await __loadAsk();
1502
- return askImpl(...args);
1503
- }
1504
- async function __lazyToast(...args) {
1505
- const toastImpl = await __loadToast();
1506
- return toastImpl(...args);
1507
- }
1508
- __lazyToast.success = async (...args) => {
1509
- const toastImpl = await __loadToast();
1510
- return toastImpl.success(...args);
1511
- };
1512
- __lazyToast.error = async (...args) => {
1513
- const toastImpl = await __loadToast();
1514
- return toastImpl.error(...args);
1515
- };
1516
- __lazyToast.warning = async (...args) => {
1517
- const toastImpl = await __loadToast();
1518
- return toastImpl.warning(...args);
1519
- };
1520
- __lazyToast.info = async (...args) => {
1521
- const toastImpl = await __loadToast();
1522
- return toastImpl.info(...args);
1523
- };
1524
- var __defaultLog = function(level = "log", message, ...data) {
1525
- PDS.log(level, message, ...data);
1526
- };
1527
- function __stripFunctionsForClone(value) {
1528
- if (value === null || value === void 0)
1529
- return value;
1530
- if (typeof value === "function")
1531
- return void 0;
1532
- if (typeof value !== "object")
1533
- return value;
1534
- if (Array.isArray(value)) {
1535
- return value.map((item) => __stripFunctionsForClone(item)).filter((item) => item !== void 0);
1536
- }
1537
- const result = {};
1538
- for (const [key, entry] of Object.entries(value)) {
1539
- const stripped = __stripFunctionsForClone(entry);
1540
- if (stripped !== void 0) {
1541
- result[key] = stripped;
1542
- }
1543
- }
1544
- return result;
1545
- }
1546
- function __deepFreeze(value, seen = /* @__PURE__ */ new WeakSet()) {
1547
- if (!value || typeof value !== "object") {
1548
- return value;
1549
- }
1550
- if (seen.has(value)) {
1551
- return value;
1552
- }
1553
- seen.add(value);
1554
- Object.freeze(value);
1555
- for (const key of Object.keys(value)) {
1556
- __deepFreeze(value[key], seen);
1557
- }
1558
- return value;
1559
- }
1560
- function __toReadonlyClone(value) {
1561
- if (value === null || value === void 0) {
1562
- return value;
1563
- }
1564
- if (typeof value !== "object") {
1565
- return value;
1566
- }
1567
- return __deepFreeze(structuredClone(__stripFunctionsForClone(value)));
1568
- }
1569
- async function __loadRuntimeConfig(assetRootURL, config2 = {}) {
1570
- if (config2?.runtimeConfig === false)
1571
- return null;
1572
- if (typeof fetch !== "function")
1573
- return null;
1574
- const runtimeUrl = config2?.runtimeConfigURL || `${assetRootURL}pds-runtime-config.json`;
1575
- try {
1576
- const res = await fetch(runtimeUrl, { cache: "no-store" });
1577
- if (!res.ok)
1578
- return null;
1579
- return await res.json();
1580
- } catch (e) {
1581
- return null;
1582
- }
1583
- }
1584
- PDS.registry = registry;
1585
- PDS.enums = enums;
1586
- PDS.adoptLayers = adoptLayers;
1587
- PDS.adoptPrimitives = adoptPrimitives;
1588
- PDS.parse = parseHTML;
1589
- PDS.createStylesheet = createStylesheet;
1590
- PDS.isLiveMode = () => registry.isLive;
1591
- PDS.ask = __lazyAsk;
1592
- PDS.toast = __lazyToast;
1593
- PDS.common = common_exports;
1594
- PDS.msg = msg;
1595
- PDS.str = str;
1596
- PDS.configureLocalization = configureLocalization;
1597
- PDS.loadLocale = loadLocale;
1598
- PDS.setLocale = setLocale;
1599
- PDS.getLocalizationState = getLocalizationState;
1600
- PDS.createJSONLocalization = createJSONLocalization;
1601
- PDS.i18n = {
1602
- msg,
1603
- str,
1604
- configure: configureLocalization,
1605
- loadLocale,
1606
- setLocale,
1607
- getState: getLocalizationState,
1608
- createJSONLocalization
1609
- };
1610
- PDS.AutoComplete = null;
1611
- PDS.loadAutoComplete = async () => {
1612
- if (PDS.AutoComplete && typeof PDS.AutoComplete.connect === "function") {
1613
- return PDS.AutoComplete;
1614
- }
1615
- const autoCompleteModuleURL = __resolveExternalRuntimeModuleURL(
1616
- "pds-autocomplete.js",
1617
- PDS.currentConfig?.autoCompleteURL
1618
- );
1619
- if (!__autoCompletePromise) {
1620
- __autoCompletePromise = import(
1621
- /* @vite-ignore */
1622
- autoCompleteModuleURL
1623
- ).then((mod) => {
1624
- const autoCompleteCtor = mod?.AutoComplete || mod?.default?.AutoComplete || mod?.default || null;
1625
- if (!autoCompleteCtor) {
1626
- throw new Error("AutoComplete export not found in module");
1627
- }
1628
- PDS.AutoComplete = autoCompleteCtor;
1629
- return autoCompleteCtor;
1630
- }).catch((error) => {
1631
- __autoCompletePromise = null;
1632
- throw error;
1633
- });
1634
- }
1635
- return __autoCompletePromise;
1636
- };
1637
- function __emitPDSReady(detail) {
1638
- const hasCustomEvent = typeof CustomEvent === "function";
1639
- try {
1640
- const readyEvent = hasCustomEvent ? new CustomEvent("pds:ready", { detail }) : new Event("pds:ready");
1641
- PDS.dispatchEvent(readyEvent);
1642
- } catch (e) {
1643
- }
1644
- if (typeof document !== "undefined") {
1645
- if (hasCustomEvent) {
1646
- const eventOptions = { detail, bubbles: true, composed: true };
1647
- try {
1648
- document.dispatchEvent(new CustomEvent("pds:ready", eventOptions));
1649
- } catch (e) {
1650
- }
1651
- try {
1652
- document.dispatchEvent(new CustomEvent("pds-ready", eventOptions));
1653
- } catch (e) {
1654
- }
1655
- } else {
1656
- try {
1657
- document.dispatchEvent(new Event("pds:ready"));
1658
- } catch (e) {
1659
- }
1660
- try {
1661
- document.dispatchEvent(new Event("pds-ready"));
1662
- } catch (e) {
1663
- }
1664
- }
1665
- }
1666
- }
1667
- function __emitPDSConfigChanged(detail = {}) {
1668
- const hasCustomEvent = typeof CustomEvent === "function";
1669
- const payload = {
1670
- at: Date.now(),
1671
- ...detail
1672
- };
1673
- try {
1674
- const changedEvent = hasCustomEvent ? new CustomEvent("pds:config-changed", { detail: payload }) : new Event("pds:config-changed");
1675
- PDS.dispatchEvent(changedEvent);
1676
- } catch (e) {
1677
- }
1678
- if (typeof document !== "undefined") {
1679
- if (hasCustomEvent) {
1680
- const eventOptions = { detail: payload, bubbles: true, composed: true };
1681
- try {
1682
- document.dispatchEvent(
1683
- new CustomEvent("pds:config-changed", eventOptions)
1684
- );
1685
- } catch (e) {
1686
- }
1687
- } else {
1688
- try {
1689
- document.dispatchEvent(new Event("pds:config-changed"));
1690
- } catch (e) {
1691
- }
1692
- }
1693
- }
1694
- }
1695
- var __themeStorageKey = "pure-ds-theme";
1696
- var __themeMQ = null;
1697
- var __themeMQListener = null;
1698
- function __applyResolvedTheme(raw) {
1699
- try {
1700
- if (typeof document === "undefined")
1701
- return;
1702
- let resolved = "light";
1703
- if (!raw) {
1704
- const prefersDark = typeof window !== "undefined" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches;
1705
- resolved = prefersDark ? "dark" : "light";
1706
- } else if (raw === "system") {
1707
- const prefersDark = typeof window !== "undefined" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches;
1708
- resolved = prefersDark ? "dark" : "light";
1709
- } else {
1710
- resolved = raw;
1711
- }
1712
- document.documentElement.setAttribute("data-theme", resolved);
1713
- } catch (e) {
1714
- }
1715
- }
1716
- function __setupSystemListenerIfNeeded(raw) {
1717
- try {
1718
- if (__themeMQ && __themeMQListener) {
1719
- try {
1720
- if (typeof __themeMQ.removeEventListener === "function")
1721
- __themeMQ.removeEventListener("change", __themeMQListener);
1722
- else if (typeof __themeMQ.removeListener === "function")
1723
- __themeMQ.removeListener(__themeMQListener);
1724
- } catch (e) {
1725
- }
1726
- __themeMQ = null;
1727
- __themeMQListener = null;
1728
- }
1729
- if (raw === "system" && typeof window !== "undefined" && window.matchMedia) {
1730
- const mq = window.matchMedia("(prefers-color-scheme: dark)");
1731
- const listener = (e) => {
1732
- const isDark = e?.matches === void 0 ? mq.matches : e.matches;
1733
- try {
1734
- const newTheme = isDark ? "dark" : "light";
1735
- document.documentElement.setAttribute("data-theme", newTheme);
1736
- PDS.dispatchEvent(
1737
- new CustomEvent("pds:theme:changed", {
1738
- detail: { theme: newTheme, source: "system" }
1739
- })
1740
- );
1741
- } catch (ex) {
1742
- }
1743
- };
1744
- __themeMQ = mq;
1745
- __themeMQListener = listener;
1746
- if (typeof mq.addEventListener === "function")
1747
- mq.addEventListener("change", listener);
1748
- else if (typeof mq.addListener === "function")
1749
- mq.addListener(listener);
1750
- }
1751
- } catch (e) {
1752
- }
1753
- }
1754
- var __themeDescriptor = Object.getOwnPropertyDescriptor(PDS, "theme");
1755
- if (!__themeDescriptor) {
1756
- Object.defineProperty(PDS, "theme", {
1757
- get() {
1758
- try {
1759
- if (typeof window === "undefined")
1760
- return null;
1761
- return localStorage.getItem(__themeStorageKey) || null;
1762
- } catch (e) {
1763
- return null;
1764
- }
1765
- },
1766
- set(value) {
1767
- try {
1768
- if (typeof window === "undefined")
1769
- return;
1770
- const currentPreset = PDS.currentConfig?.design || null;
1771
- const resolvedTheme = resolveThemePreference(value);
1772
- if (currentPreset && !isPresetThemeCompatible(currentPreset, resolvedTheme)) {
1773
- const presetName = currentPreset?.name || PDS.currentPreset?.name || PDS.currentConfig?.preset || "current preset";
1774
- PDS.log(
1775
- "warn",
1776
- `PDS theme "${resolvedTheme}" not supported by preset "${presetName}".`
1777
- );
1778
- PDS.dispatchEvent(
1779
- new CustomEvent("pds:theme:blocked", {
1780
- detail: { theme: value, resolvedTheme, preset: presetName }
1781
- })
1782
- );
1783
- return;
1784
- }
1785
- if (value === null || value === void 0) {
1786
- localStorage.removeItem(__themeStorageKey);
1787
- } else {
1788
- localStorage.setItem(__themeStorageKey, value);
1789
- }
1790
- __applyResolvedTheme(value);
1791
- __setupSystemListenerIfNeeded(value);
1792
- PDS.dispatchEvent(
1793
- new CustomEvent("pds:theme:changed", {
1794
- detail: { theme: value, source: "api" }
1795
- })
1796
- );
1797
- } catch (e) {
1798
- }
1799
- }
1800
- });
1801
- }
1802
- PDS.defaultEnhancers = [];
1803
- async function start(config2) {
1804
- PDS.initializing = true;
1805
- try {
1806
- const mode = config2 && config2.mode || "live";
1807
- const { mode: _omit, ...rest } = config2 || {};
1808
- PDS.mode = mode;
1809
- PDS.logHandler = typeof rest?.log === "function" ? rest.log : null;
1810
- PDS.currentConfig = __toReadonlyClone(rest);
1811
- const localizationConfig = rest && typeof rest.localization === "object" && rest.localization ? rest.localization : null;
1812
- if (localizationConfig) {
1813
- await __loadLocalizationRuntime();
1814
- configureLocalization(localizationConfig);
1815
- } else {
1816
- configureLocalization(null);
1817
- }
1818
- let startResult;
1819
- if (mode === "static") {
1820
- startResult = await staticInit(rest);
1821
- } else {
1822
- const { localization: _managerLocalization, ...managerConfig } = rest || {};
1823
- const assetRootURL = resolveRuntimeAssetRoot(managerConfig, { resolvePublicAssetURL });
1824
- const managerUrl = managerConfig?.managerURL || managerConfig?.public?.managerURL || managerConfig?.manager?.url || new URL("core/pds-manager.js", assetRootURL).href || new URL("./pds-manager.js", import.meta.url).href;
1825
- const { startLive } = await import(
1826
- /* @vite-ignore */
1827
- managerUrl
1828
- );
1829
- startResult = await startLive(PDS, managerConfig, {
1830
- emitReady: __emitPDSReady,
1831
- emitConfigChanged: __emitPDSConfigChanged,
1832
- applyResolvedTheme: __applyResolvedTheme,
1833
- setupSystemListenerIfNeeded: __setupSystemListenerIfNeeded
1834
- });
1835
- }
1836
- PDS.compiled = __toReadonlyClone(startResult?.config || null);
1837
- const resolvedExternalIconPath = PDS?.compiled?.design?.icons?.externalPath || "/assets/img/icons/";
1838
- PDS.log("info", `startup ready; external icon path: ${resolvedExternalIconPath}`);
1839
- return startResult;
1840
- } finally {
1841
- PDS.initializing = false;
1842
- }
1843
- }
1844
- PDS.start = start;
1845
- async function staticInit(config2) {
1846
- if (!config2 || typeof config2 !== "object") {
1847
- throw new Error(
1848
- "PDS.start({ mode: 'static', ... }) requires a valid configuration object"
1849
- );
1850
- }
1851
- const applyGlobalStyles = config2.applyGlobalStyles ?? true;
1852
- const manageTheme = config2.manageTheme ?? true;
1853
- const themeStorageKey = config2.themeStorageKey ?? "pure-ds-theme";
1854
- let staticPaths = config2.staticPaths ?? {};
1855
- const assetRootURL = resolveRuntimeAssetRoot(config2, { resolvePublicAssetURL });
1856
- const cfgAuto = config2 && config2.autoDefine || null;
1857
- let autoDefineBaseURL;
1858
- if (cfgAuto && cfgAuto.baseURL) {
1859
- autoDefineBaseURL = ensureTrailingSlash2(
1860
- ensureAbsoluteAssetURL(cfgAuto.baseURL, { preferModule: false })
1861
- );
1862
- } else {
1863
- autoDefineBaseURL = `${assetRootURL}components/`;
1864
- }
1865
- const autoDefinePreload = cfgAuto && Array.isArray(cfgAuto.predefine) && cfgAuto.predefine || [];
1866
- const autoDefineMapper = cfgAuto && typeof cfgAuto.mapper === "function" && cfgAuto.mapper || null;
1867
- try {
1868
- attachFoucListener(PDS);
1869
- const { resolvedTheme } = resolveThemeAndApply({
1870
- manageTheme,
1871
- themeStorageKey,
1872
- applyResolvedTheme: __applyResolvedTheme,
1873
- setupSystemListenerIfNeeded: __setupSystemListenerIfNeeded
1874
- });
1875
- const runtimeConfig = await __loadRuntimeConfig(assetRootURL, config2);
1876
- const userEnhancers = Array.isArray(config2?.enhancers) ? config2.enhancers : config2?.enhancers && typeof config2.enhancers === "object" ? Object.values(config2.enhancers) : [];
1877
- const resolvedConfig = runtimeConfig?.config ? {
1878
- ...runtimeConfig.config,
1879
- ...config2,
1880
- design: config2?.design || runtimeConfig.config.design,
1881
- preset: config2?.preset || runtimeConfig.config.preset
1882
- } : { ...config2 };
1883
- const baseStaticPaths = {
1884
- tokens: `${assetRootURL}styles/pds-tokens.css.js`,
1885
- primitives: `${assetRootURL}styles/pds-primitives.css.js`,
1886
- components: `${assetRootURL}styles/pds-components.css.js`,
1887
- utilities: `${assetRootURL}styles/pds-utilities.css.js`,
1888
- styles: `${assetRootURL}styles/pds-styles.css.js`
1889
- };
1890
- const runtimePaths = runtimeConfig?.paths || {};
1891
- staticPaths = { ...baseStaticPaths, ...runtimePaths, ...staticPaths };
1892
- PDS.registry.setStaticMode(staticPaths);
1893
- if (applyGlobalStyles && typeof document !== "undefined") {
1894
- try {
1895
- const stylesSheet = await PDS.registry.getStylesheet("styles");
1896
- if (stylesSheet) {
1897
- stylesSheet._pds = true;
1898
- const others = (document.adoptedStyleSheets || []).filter(
1899
- (s) => s._pds !== true
1900
- );
1901
- document.adoptedStyleSheets = [...others, stylesSheet];
1902
- __emitPDSConfigChanged({
1903
- mode: "static",
1904
- source: "static:styles-applied"
1905
- });
1906
- }
1907
- } catch (e) {
1908
- __defaultLog.call(PDS, "warn", "Failed to apply static styles:", e);
1909
- }
1910
- }
1911
- let autoDefiner = null;
1912
- let mergedEnhancers = [];
1913
- try {
1914
- const defaultPDSEnhancers = await __loadDefaultEnhancers();
1915
- const res = await setupAutoDefinerAndEnhancers({
1916
- autoDefineBaseURL,
1917
- autoDefinePreload,
1918
- autoDefineMapper,
1919
- enhancers: userEnhancers,
1920
- autoDefineOverrides: cfgAuto || null,
1921
- autoDefinePreferModule: !(cfgAuto && cfgAuto.baseURL)
1922
- }, { baseEnhancers: defaultPDSEnhancers });
1923
- autoDefiner = res.autoDefiner;
1924
- mergedEnhancers = res.mergedEnhancers || [];
1925
- } catch (error) {
1926
- __defaultLog.call(
1927
- PDS,
1928
- "error",
1929
- "\u274C Failed to initialize AutoDefiner/Enhancers (static):",
1930
- error
1931
- );
1932
- }
1933
- PDS.compiled = __toReadonlyClone({
1934
- mode: "static",
1935
- ...resolvedConfig,
1936
- theme: resolvedTheme,
1937
- enhancers: mergedEnhancers
1938
- });
1939
- __emitPDSReady({
1940
- mode: "static",
1941
- config: resolvedConfig,
1942
- theme: resolvedTheme,
1943
- autoDefiner
1944
- });
1945
- return {
1946
- config: resolvedConfig,
1947
- theme: resolvedTheme,
1948
- autoDefiner
1949
- };
1950
- } catch (error) {
1951
- PDS.dispatchEvent(new CustomEvent("pds:error", { detail: { error } }));
1952
- throw error;
1953
- }
1954
- }
1955
-
1956
- // pds.config.js
1957
- var localization = PDS.createJSONLocalization({
1958
- locale: "en-US",
1959
- locales: ["en-US", "nl-NL"],
1960
- aliases: {
1961
- en: ["en-US"],
1962
- nl: ["nl-NL"]
1963
- },
1964
- basePath: "/assets/locales"
1965
- });
1966
- var config = {
1967
- mode: "live",
1968
- liveEdit: true,
1969
- preset: "default",
1970
- localization,
1971
- autoDefine: {
1972
- predefine: ["pds-icon", "pds-drawer", "pds-toaster"]
1973
- },
1974
- /** @this {PDSBase} */
1975
- log(level, message, ...data) {
1976
- const mode = this?.mode || this?.compiled?.mode || "live";
1977
- if (mode !== "static") {
1978
- const method = typeof console[level] === "function" ? console[level] : console.log;
1979
- method(`[PDS] ${message}`, ...data);
1980
- }
1981
- }
1982
- };
1983
-
1984
- // package.json
1985
- var package_default = {
1986
- name: "@pure-ds/core",
1987
- shortname: "pds",
1988
- version: "0.7.49",
1989
- description: "Why develop a Design System when you can generate one?",
1990
- repository: {
1991
- type: "git",
1992
- url: "git+https://github.com/Pure-Web-Foundation/pure-ds.git"
1993
- },
1994
- bugs: {
1995
- url: "https://github.com/Pure-Web-Foundation/pure-ds/issues"
1996
- },
1997
- homepage: "https://puredesignsystem.z6.web.core.windows.net/",
1998
- keywords: [
1999
- "design-system",
2000
- "css",
2001
- "web-components",
2002
- "lit",
2003
- "constructable-stylesheets",
2004
- "tokens",
2005
- "utilities",
2006
- "a11y"
2007
- ],
2008
- type: "module",
2009
- main: "./public/assets/pds/core.js",
2010
- module: "./public/assets/pds/core.js",
2011
- types: "./dist/types/pds.d.ts",
2012
- bin: {
2013
- "pds-build": "packages/pds-cli/bin/pds-static.js",
2014
- "pds-sync-assets": "packages/pds-cli/bin/sync-assets.js",
2015
- "pds-build-icons": "packages/pds-cli/bin/pds-build-icons.js",
2016
- "pds-import": "packages/pds-cli/bin/pds-import.js",
2017
- "pds-setup-copilot": "packages/pds-cli/bin/pds-setup-copilot.js",
2018
- "pds-setup-mcp": "packages/pds-cli/bin/pds-setup-mcp.js",
2019
- "pds-init-config": "packages/pds-cli/bin/pds-init-config.js",
2020
- "pds-bootstrap": "packages/pds-cli/bin/pds-bootstrap.js",
2021
- "pds-mcp-server": "packages/pds-cli/bin/pds-mcp-server.js",
2022
- "pds-mcp-health": "packages/pds-cli/bin/pds-mcp-health.js",
2023
- "pds-mcp-eval": "packages/pds-cli/bin/pds-mcp-eval.js"
2024
- },
2025
- exports: {
2026
- ".": {
2027
- types: "./src/js/pds.d.ts",
2028
- import: "./public/assets/pds/core.js"
2029
- },
2030
- "./localization": {
2031
- types: "./dist/types/src/js/pds-localization.d.ts",
2032
- import: "./public/assets/pds/core/pds-localization.js"
2033
- },
2034
- "./lit": {
2035
- types: "./dist/types/src/js/lit.d.ts",
2036
- import: "./public/assets/pds/external/lit.js"
2037
- },
2038
- "./pds-core": "./src/js/pds.js",
2039
- "./auto-define/*": "./public/auto-define/*"
2040
- },
2041
- files: [
2042
- ".github/copilot-instructions.md",
2043
- ".cursorrules",
2044
- "dist/types/",
2045
- "public/assets/js/",
2046
- "public/assets/pds/components/",
2047
- "public/assets/pds/templates/",
2048
- "public/assets/pds/core.js",
2049
- "public/assets/pds/core/",
2050
- "public/assets/pds/external/",
2051
- "public/assets/pds/vscode-custom-data.json",
2052
- "public/assets/pds/pds.css-data.json",
2053
- "public/assets/pds/pds-css-complete.json",
2054
- "public/auto-define/",
2055
- "public/pds/components/",
2056
- "public/assets/pds/icons/pds-icons.svg",
2057
- "packages/pds-cli/bin/",
2058
- "packages/pds-cli/lib/",
2059
- "src/js/pds.d.ts",
2060
- "src/js/pds.js",
2061
- "src/js/pds-singleton.js",
2062
- "src/js/common/",
2063
- "src/js/pds-live-manager/",
2064
- "src/js/pds-core/",
2065
- "custom-elements.json",
2066
- "custom-elements-manifest.config.js",
2067
- "pds.html-data.json",
2068
- "pds.css-data.json",
2069
- "LOCALIZATION.md",
2070
- "readme.md",
2071
- "INTELLISENSE.md",
2072
- "CSS-INTELLISENSE-LIMITATION.md",
2073
- "CSS-INTELLISENSE-QUICK-REF.md"
2074
- ],
2075
- scripts: {
2076
- test: 'echo "Error: no test specified" && exit 1',
2077
- dev: "node esbuild-dev.js",
2078
- prebuild: "npm run types",
2079
- build: "node esbuild-build.js",
2080
- types: "tsc -p tsconfig.json && node scripts/sync-types.mjs",
2081
- postinstall: "node packages/pds-cli/bin/postinstall.mjs",
2082
- "prepds:build": "npm run types",
2083
- "pds:build": "node packages/pds-cli/bin/pds-static.js",
2084
- "pds:build-icons": "node packages/pds-cli/bin/pds-build-icons.js",
2085
- "pds:bootstrap": "node packages/pds-cli/bin/pds-bootstrap.js",
2086
- "pds:manifest": "node packages/pds-cli/bin/generate-manifest.js",
2087
- "pds:css-data": "node packages/pds-cli/bin/generate-css-data.js",
2088
- "pds:import": "node packages/pds-cli/bin/pds-import.js",
2089
- "pds:dx": "node packages/pds-cli/bin/pds-dx.js",
2090
- "pds:mcp:server": "node packages/pds-cli/bin/pds-mcp-server.js",
2091
- "pds:mcp:health": "node packages/pds-cli/bin/pds-mcp-health.js",
2092
- "pds:mcp:eval": "node packages/pds-cli/bin/pds-mcp-eval.js",
2093
- "storybook:generate": "cd packages/pds-storybook && npm run generate-stories",
2094
- "storybook:dev": "cd packages/pds-storybook && npm run storybook:dev",
2095
- "storybook:build": "cd packages/pds-storybook && npm run storybook:build"
2096
- },
2097
- author: "Marc van Neerven",
2098
- license: "ISC",
2099
- engines: {
2100
- node: ">=18"
2101
- },
2102
- publishConfig: {
2103
- access: "public"
2104
- },
2105
- devDependencies: {
2106
- "@custom-elements-manifest/analyzer": "^0.9.9",
2107
- "@types/node": "^22.10.2",
2108
- esbuild: "^0.19.0",
2109
- "fs-extra": "^11.1.1",
2110
- typescript: "^5.6.3"
2111
- },
2112
- dependencies: {
2113
- lit: "^3.3.2",
2114
- "pure-web": "1.1.32"
2115
- },
2116
- customElements: "custom-elements.json"
2117
- };
2118
-
2119
- // src/js/app.js
2120
- await PDS.start(config);
2121
- document.documentElement.lang = "en";
2122
- var rawRepoUrl = typeof package_default.repository === "string" ? package_default.repository : package_default.repository?.url;
2123
- var repoUrl = rawRepoUrl ? rawRepoUrl.replace(/^git\+/, "").replace(/\.git$/, "") : "";
2124
- var homepageUrl = package_default.homepage || repoUrl;
2125
- var issuesUrl = package_default.bugs?.url || "";
2126
- document.body.innerHTML = /*html*/
2127
- `
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.51",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`
2128
3
  <div class="container text-center">
2129
- <img src="/assets/img/pds-logo.svg" alt="PDS Logo" title="${msg("PDS Logo")}" width="64" height="64" />
4
+ <img src="/assets/img/pds-logo.svg" alt="PDS Logo" title="${M("PDS Logo")}" width="64" height="64" />
2130
5
  <header class="container section">
2131
- <h1>${package_default.name} ${msg(str`version ${package_default.version}`)}</h1>
2132
- <small class="text-muted">${msg(package_default.description)}</small>
6
+ <h1 @click=${()=>o.toast("Hallo")}>
7
+ ${x.name} ${M(oe`version ${x.version}`)}
8
+ </h1>
9
+ <small class="text-muted">${M(x.description)}</small>
2133
10
  </header>
2134
11
  </div>
2135
- `;
2136
- //# sourceMappingURL=app.js.map
12
+ `);