@pure-ds/core 0.6.9 → 0.6.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +865 -35
- package/dist/types/pds.d.ts +31 -0
- package/dist/types/public/assets/js/pds-manager.d.ts +100 -2
- package/dist/types/public/assets/js/pds-manager.d.ts.map +1 -1
- package/dist/types/public/assets/js/pds.d.ts.map +1 -1
- package/dist/types/public/assets/pds/components/pds-form.d.ts.map +1 -1
- package/dist/types/public/assets/pds/components/pds-live-converter.d.ts +8 -0
- package/dist/types/public/assets/pds/components/pds-live-converter.d.ts.map +1 -0
- package/dist/types/public/assets/pds/components/pds-live-edit.d.ts +1 -195
- package/dist/types/public/assets/pds/components/pds-live-edit.d.ts.map +1 -1
- package/dist/types/public/assets/pds/components/pds-live-importer.d.ts +2 -0
- package/dist/types/public/assets/pds/components/pds-live-importer.d.ts.map +1 -0
- package/dist/types/public/assets/pds/components/pds-live-template-canvas.d.ts +2 -0
- package/dist/types/public/assets/pds/components/pds-live-template-canvas.d.ts.map +1 -0
- package/dist/types/public/assets/pds/components/pds-omnibox.d.ts +0 -2
- package/dist/types/public/assets/pds/components/pds-omnibox.d.ts.map +1 -1
- package/dist/types/public/assets/pds/components/pds-scrollrow.d.ts +20 -0
- package/dist/types/public/assets/pds/components/pds-scrollrow.d.ts.map +1 -1
- package/dist/types/public/assets/pds/components/pds-toaster.d.ts +1 -1
- package/dist/types/public/assets/pds/components/pds-toaster.d.ts.map +1 -1
- package/dist/types/public/assets/pds/components/pds-treeview.d.ts +37 -0
- package/dist/types/public/assets/pds/components/pds-treeview.d.ts.map +1 -0
- package/dist/types/src/js/common/toast.d.ts +8 -0
- package/dist/types/src/js/common/toast.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-config.d.ts +1306 -13
- package/dist/types/src/js/pds-core/pds-config.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-enhancers-meta.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-enhancers.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-generator.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-live.d.ts +2 -1
- package/dist/types/src/js/pds-core/pds-live.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-ontology.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-start-helpers.d.ts +1 -4
- package/dist/types/src/js/pds-core/pds-start-helpers.d.ts.map +1 -1
- package/dist/types/src/js/pds-live-manager/conversion-service.d.ts +66 -0
- package/dist/types/src/js/pds-live-manager/conversion-service.d.ts.map +1 -0
- package/dist/types/src/js/pds-live-manager/import-contract.d.ts +15 -0
- package/dist/types/src/js/pds-live-manager/import-contract.d.ts.map +1 -0
- package/dist/types/src/js/pds-live-manager/import-history-service.d.ts +32 -0
- package/dist/types/src/js/pds-live-manager/import-history-service.d.ts.map +1 -0
- package/dist/types/src/js/pds-live-manager/import-service.d.ts +21 -0
- package/dist/types/src/js/pds-live-manager/import-service.d.ts.map +1 -0
- package/dist/types/src/js/pds-live-manager/template-service.d.ts +17 -0
- package/dist/types/src/js/pds-live-manager/template-service.d.ts.map +1 -0
- package/dist/types/src/js/pds-manager.d.ts +4 -0
- package/dist/types/src/js/pds.d.ts.map +1 -1
- package/package.json +7 -3
- package/packages/pds-cli/README.md +51 -0
- package/packages/pds-cli/bin/pds-import.js +176 -0
- package/packages/pds-cli/bin/pds-static.js +31 -1
- package/packages/pds-cli/bin/postinstall.mjs +17 -8
- package/public/assets/js/app.js +23 -147
- package/public/assets/js/pds-manager.js +481 -248
- package/public/assets/js/pds.js +16 -16
- package/public/assets/pds/components/pds-form.js +124 -27
- package/public/assets/pds/components/pds-live-converter.js +47 -0
- package/public/assets/pds/components/pds-live-edit.js +1626 -211
- package/public/assets/pds/components/pds-live-importer.js +772 -0
- package/public/assets/pds/components/pds-live-template-canvas.js +171 -0
- package/public/assets/pds/components/pds-omnibox.js +146 -20
- package/public/assets/pds/components/pds-scrollrow.js +56 -1
- package/public/assets/pds/components/pds-toaster.js +50 -5
- package/public/assets/pds/components/pds-treeview.js +972 -0
- package/public/assets/pds/custom-elements.json +865 -35
- package/public/assets/pds/pds-css-complete.json +7 -7
- package/public/assets/pds/pds.css-data.json +5 -35
- package/public/assets/pds/templates/commerce-scroll-explorer.html +115 -0
- package/public/assets/pds/templates/content-brand-showcase.html +110 -0
- package/public/assets/pds/templates/feedback-ops-dashboard.html +91 -0
- package/public/assets/pds/templates/release-readiness-radar.html +69 -0
- package/public/assets/pds/templates/support-command-center.html +92 -0
- package/public/assets/pds/templates/templates.json +53 -0
- package/public/assets/pds/templates/workspace-settings-lab.html +131 -0
- package/public/assets/pds/vscode-custom-data.json +54 -4
- package/readme.md +34 -0
- package/src/js/pds-core/pds-config.js +831 -40
- package/src/js/pds-core/pds-enhancers-meta.js +11 -0
- package/src/js/pds-core/pds-enhancers.js +259 -5
- package/src/js/pds-core/pds-generator.js +353 -52
- package/src/js/pds-core/pds-live.js +630 -15
- package/src/js/pds-core/pds-ontology.js +6 -0
- package/src/js/pds-core/pds-start-helpers.js +14 -6
- package/src/js/pds-live-manager/conversion-service.js +3136 -0
- package/src/js/pds-live-manager/import-contract.js +57 -0
- package/src/js/pds-live-manager/import-history-service.js +145 -0
- package/src/js/pds-live-manager/import-service.js +255 -0
- package/src/js/pds-live-manager/tailwind-conversion-rules.json +383 -0
- package/src/js/pds-live-manager/template-service.js +170 -0
- package/src/js/pds.d.ts +31 -0
- package/src/js/pds.js +71 -60
package/src/js/pds.js
CHANGED
|
@@ -62,24 +62,15 @@ import {
|
|
|
62
62
|
ensureAbsoluteAssetURL,
|
|
63
63
|
ensureTrailingSlash,
|
|
64
64
|
attachFoucListener,
|
|
65
|
-
normalizeInitConfig,
|
|
66
65
|
resolveRuntimeAssetRoot,
|
|
67
66
|
resolveThemeAndApply,
|
|
68
67
|
setupAutoDefinerAndEnhancers,
|
|
69
|
-
stripFunctions,
|
|
70
68
|
} from "./pds-core/pds-start-helpers.js";
|
|
71
69
|
import {
|
|
72
70
|
isPresetThemeCompatible,
|
|
73
71
|
resolveThemePreference,
|
|
74
72
|
} from "./pds-core/pds-theme-utils.js";
|
|
75
73
|
|
|
76
|
-
const __slugifyPreset = (str = "") =>
|
|
77
|
-
String(str)
|
|
78
|
-
.toLowerCase()
|
|
79
|
-
.replace(/&/g, " and ")
|
|
80
|
-
.replace(/[^a-z0-9]+/g, "-")
|
|
81
|
-
.replace(/^-+|-+$/g, "");
|
|
82
|
-
|
|
83
74
|
const __defaultLog = function (level = "log", message, ...data) {
|
|
84
75
|
const isStaticMode = Boolean(PDS.registry && !PDS.registry.isLive);
|
|
85
76
|
const debug =
|
|
@@ -99,6 +90,27 @@ const __defaultLog = function (level = "log", message, ...data) {
|
|
|
99
90
|
}
|
|
100
91
|
};
|
|
101
92
|
|
|
93
|
+
function __stripFunctionsForClone(value) {
|
|
94
|
+
if (value === null || value === undefined) return value;
|
|
95
|
+
if (typeof value === "function") return undefined;
|
|
96
|
+
if (typeof value !== "object") return value;
|
|
97
|
+
|
|
98
|
+
if (Array.isArray(value)) {
|
|
99
|
+
return value
|
|
100
|
+
.map((item) => __stripFunctionsForClone(item))
|
|
101
|
+
.filter((item) => item !== undefined);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const result = {};
|
|
105
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
106
|
+
const stripped = __stripFunctionsForClone(entry);
|
|
107
|
+
if (stripped !== undefined) {
|
|
108
|
+
result[key] = stripped;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return result;
|
|
112
|
+
}
|
|
113
|
+
|
|
102
114
|
async function __loadRuntimeConfig(assetRootURL, config = {}) {
|
|
103
115
|
if (config?.runtimeConfig === false) return null;
|
|
104
116
|
if (typeof fetch !== "function") return null;
|
|
@@ -168,6 +180,36 @@ function __emitPDSReady(detail) {
|
|
|
168
180
|
}
|
|
169
181
|
}
|
|
170
182
|
|
|
183
|
+
function __emitPDSConfigChanged(detail = {}) {
|
|
184
|
+
const hasCustomEvent = typeof CustomEvent === "function";
|
|
185
|
+
const payload = {
|
|
186
|
+
at: Date.now(),
|
|
187
|
+
...detail,
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
try {
|
|
191
|
+
const changedEvent = hasCustomEvent
|
|
192
|
+
? new CustomEvent("pds:config-changed", { detail: payload })
|
|
193
|
+
: new Event("pds:config-changed");
|
|
194
|
+
PDS.dispatchEvent(changedEvent);
|
|
195
|
+
} catch (e) {}
|
|
196
|
+
|
|
197
|
+
if (typeof document !== "undefined") {
|
|
198
|
+
if (hasCustomEvent) {
|
|
199
|
+
const eventOptions = { detail: payload, bubbles: true, composed: true };
|
|
200
|
+
try {
|
|
201
|
+
document.dispatchEvent(
|
|
202
|
+
new CustomEvent("pds:config-changed", eventOptions)
|
|
203
|
+
);
|
|
204
|
+
} catch (e) {}
|
|
205
|
+
} else {
|
|
206
|
+
try {
|
|
207
|
+
document.dispatchEvent(new Event("pds:config-changed"));
|
|
208
|
+
} catch (e) {}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
171
213
|
if (typeof window !== "undefined") {
|
|
172
214
|
// @ts-ignore
|
|
173
215
|
window.PDS = PDS;
|
|
@@ -370,6 +412,7 @@ async function start(config) {
|
|
|
370
412
|
const { startLive } = await import(managerUrl);
|
|
371
413
|
return startLive(PDS, rest, {
|
|
372
414
|
emitReady: __emitPDSReady,
|
|
415
|
+
emitConfigChanged: __emitPDSConfigChanged,
|
|
373
416
|
applyResolvedTheme: __applyResolvedTheme,
|
|
374
417
|
setupSystemListenerIfNeeded: __setupSystemListenerIfNeeded,
|
|
375
418
|
});
|
|
@@ -435,57 +478,21 @@ async function staticInit(config) {
|
|
|
435
478
|
setupSystemListenerIfNeeded: __setupSystemListenerIfNeeded,
|
|
436
479
|
});
|
|
437
480
|
|
|
438
|
-
//
|
|
481
|
+
// Load runtime config for static assets; config metadata remains live-mode only
|
|
439
482
|
const runtimeConfig = await __loadRuntimeConfig(assetRootURL, config);
|
|
440
|
-
const
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
const runtimePresets = runtimeDesign
|
|
447
|
-
? {
|
|
448
|
-
[String(runtimePresetId).toLowerCase()]: runtimeDesign,
|
|
449
|
-
...(String(runtimePresetId).toLowerCase() !== "default"
|
|
450
|
-
? { default: runtimeDesign }
|
|
451
|
-
: {}),
|
|
452
|
-
}
|
|
453
|
-
: null;
|
|
454
|
-
|
|
455
|
-
const inlineDesign =
|
|
456
|
-
config?.design && typeof config.design === "object"
|
|
457
|
-
? stripFunctions(config.design)
|
|
458
|
-
: null;
|
|
459
|
-
const inlinePresetId = __slugifyPreset(config?.preset || "default") || "default";
|
|
460
|
-
const inlinePresets = inlineDesign
|
|
461
|
-
? {
|
|
462
|
-
[String(inlinePresetId).toLowerCase()]: inlineDesign,
|
|
463
|
-
...(String(inlinePresetId).toLowerCase() !== "default"
|
|
464
|
-
? { default: inlineDesign }
|
|
465
|
-
: {}),
|
|
466
|
-
}
|
|
467
|
-
: null;
|
|
468
|
-
|
|
469
|
-
const presets = runtimePresets || config?.presets || inlinePresets || {};
|
|
470
|
-
if (!Object.keys(presets || {}).length) {
|
|
471
|
-
throw new Error(
|
|
472
|
-
"PDS static mode requires preset data. Run pds:build or provide config.presets/config.design."
|
|
473
|
-
);
|
|
474
|
-
}
|
|
475
|
-
const normalizedInput = runtimeConfig?.config
|
|
483
|
+
const userEnhancers = Array.isArray(config?.enhancers)
|
|
484
|
+
? config.enhancers
|
|
485
|
+
: config?.enhancers && typeof config.enhancers === "object"
|
|
486
|
+
? Object.values(config.enhancers)
|
|
487
|
+
: [];
|
|
488
|
+
const resolvedConfig = runtimeConfig?.config
|
|
476
489
|
? {
|
|
477
490
|
...runtimeConfig.config,
|
|
478
491
|
...config,
|
|
479
|
-
|
|
480
|
-
|
|
492
|
+
design: config?.design || runtimeConfig.config.design,
|
|
493
|
+
preset: config?.preset || runtimeConfig.config.preset,
|
|
481
494
|
}
|
|
482
|
-
: config;
|
|
483
|
-
|
|
484
|
-
const normalized = normalizeInitConfig(normalizedInput, {}, {
|
|
485
|
-
presets,
|
|
486
|
-
defaultLog: __defaultLog,
|
|
487
|
-
});
|
|
488
|
-
const userEnhancers = normalized.enhancers;
|
|
495
|
+
: { ...config };
|
|
489
496
|
|
|
490
497
|
|
|
491
498
|
// 2) Derive static asset URLs from the normalized public root
|
|
@@ -514,6 +521,10 @@ async function staticInit(config) {
|
|
|
514
521
|
(s) => s._pds !== true
|
|
515
522
|
);
|
|
516
523
|
document.adoptedStyleSheets = [...others, stylesSheet];
|
|
524
|
+
__emitPDSConfigChanged({
|
|
525
|
+
mode: "static",
|
|
526
|
+
source: "static:styles-applied",
|
|
527
|
+
});
|
|
517
528
|
}
|
|
518
529
|
} catch (e) {
|
|
519
530
|
__defaultLog.call(PDS, "warn", "Failed to apply static styles:", e);
|
|
@@ -545,12 +556,12 @@ async function staticInit(config) {
|
|
|
545
556
|
|
|
546
557
|
// Expose current config as frozen read-only on PDS, preserving input shape
|
|
547
558
|
// Strip functions before cloning to avoid DataCloneError
|
|
548
|
-
const cloneableConfig =
|
|
559
|
+
const cloneableConfig = __stripFunctionsForClone(config);
|
|
549
560
|
PDS.currentConfig = Object.freeze({
|
|
550
561
|
mode: "static",
|
|
551
562
|
...structuredClone(cloneableConfig),
|
|
552
|
-
design: structuredClone(
|
|
553
|
-
preset:
|
|
563
|
+
design: structuredClone(resolvedConfig.design || {}),
|
|
564
|
+
preset: resolvedConfig.preset,
|
|
554
565
|
theme: resolvedTheme,
|
|
555
566
|
enhancers: mergedEnhancers,
|
|
556
567
|
});
|
|
@@ -558,12 +569,12 @@ async function staticInit(config) {
|
|
|
558
569
|
// 6) Emit ready event (unified)
|
|
559
570
|
__emitPDSReady({
|
|
560
571
|
mode: "static",
|
|
561
|
-
config:
|
|
572
|
+
config: resolvedConfig,
|
|
562
573
|
theme: resolvedTheme,
|
|
563
574
|
autoDefiner,
|
|
564
575
|
});
|
|
565
576
|
return {
|
|
566
|
-
config:
|
|
577
|
+
config: resolvedConfig,
|
|
567
578
|
theme: resolvedTheme,
|
|
568
579
|
autoDefiner,
|
|
569
580
|
};
|