@takazudo/zdtp 0.4.14 → 0.5.0
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/CHANGELOG.md +163 -0
- package/PORTABLE-CONTRACT.md +386 -91
- package/README.md +268 -95
- package/dist/apply/build-apply-overrides.d.ts +2 -2
- package/dist/apply/compute-hunks.d.ts +23 -0
- package/dist/apply/last-applied.d.ts +5 -0
- package/dist/apply/reconcile-applied.d.ts +19 -0
- package/dist/apply-modal.d.ts +2 -48
- package/dist/astro/host-adapter.js +3 -3
- package/dist/astro/index.js +2 -2
- package/dist/{autoload-state-IlkEci88.js → autoload-state-DmTY6tRy.js} +1 -1
- package/dist/bin/server.js +52 -50
- package/dist/bulk/bulk-actions.d.ts +45 -0
- package/dist/bulk/index.d.ts +2 -0
- package/dist/chain/index.d.ts +2 -0
- package/dist/chain/token-chain-context.d.ts +19 -0
- package/dist/chain/token-chain-popover.d.ts +22 -0
- package/dist/changed/contribution.d.ts +32 -0
- package/dist/changed/footer-content.d.ts +16 -0
- package/dist/changed/index.d.ts +4 -0
- package/dist/changed/tab-badge.d.ts +8 -0
- package/dist/changed/tab-filter.d.ts +8 -0
- package/dist/config/panel-config.d.ts +23 -7
- package/dist/constants.d.ts +66 -0
- package/dist/constants.js +30 -0
- package/dist/controls/actions-menu-popover.d.ts +2 -0
- package/dist/controls/role-button.d.ts +5 -2
- package/dist/controls/tooltip.d.ts +8 -4
- package/dist/element-inspect/element-inspect-context.d.ts +22 -0
- package/dist/element-inspect/element-inspect-orchestrator.d.ts +17 -0
- package/dist/element-inspect/element-inspect-overlay.d.ts +16 -0
- package/dist/element-inspect/element-inspect-toggle-button.d.ts +3 -0
- package/dist/element-inspect/element-inspect-view.d.ts +6 -0
- package/dist/element-inspect/find-tokens-for-element.d.ts +23 -0
- package/dist/element-inspect/index.d.ts +8 -0
- package/dist/highlight/find-elements.d.ts +14 -3
- package/dist/highlight/highlight-orchestrator.d.ts +7 -3
- package/dist/highlight/highlight-state.d.ts +3 -2
- package/dist/highlight/highlight-toggle-button.d.ts +3 -0
- package/dist/highlight/walk-css-rules.d.ts +2 -0
- package/dist/history/buttons.d.ts +28 -0
- package/dist/history/index.d.ts +3 -0
- package/dist/history/rail.d.ts +13 -0
- package/dist/history/snapshots.d.ts +57 -0
- package/dist/host/host-mutations.d.ts +23 -0
- package/dist/{index-EdhZv8Ru.js → index-By6zFdp4.js} +2 -2
- package/dist/index-CHzTi0y5.js +12184 -0
- package/dist/index.js +35 -34
- package/dist/load-routing-BtCE1hGI.js +547 -0
- package/dist/{manifest-DCReQE0k.js → manifest-DvuKi7I4.js} +11 -7
- package/dist/{panel-config-SgA84Uqe.js → panel-config-BSu6TUht.js} +391 -317
- package/dist/picker/alt-click-picker.d.ts +10 -2
- package/dist/picker/arming-coordinator.d.ts +2 -0
- package/dist/picker/index.d.ts +2 -2
- package/dist/search/command-palette.d.ts +21 -0
- package/dist/search/contribution.d.ts +7 -0
- package/dist/search/fuzzy.d.ts +10 -0
- package/dist/search/index.d.ts +4 -0
- package/dist/search/match-bar.d.ts +14 -0
- package/dist/search/search-header.d.ts +7 -0
- package/dist/search/token-search.d.ts +36 -0
- package/dist/server/create-apply-handler.d.ts +33 -0
- package/dist/server/index.d.ts +2 -1
- package/dist/server/index.js +1 -1
- package/dist/shell/dock-mode-switch.d.ts +6 -0
- package/dist/shell/footer.d.ts +1 -0
- package/dist/shell/ghost-idle.d.ts +24 -0
- package/dist/shell/header.d.ts +4 -0
- package/dist/shell/layer-activity.d.ts +6 -0
- package/dist/shell/mini-pill.d.ts +21 -0
- package/dist/shell/regions.d.ts +26 -0
- package/dist/shell/shortcut-dispatcher.d.ts +17 -0
- package/dist/shell/tab-bar.d.ts +17 -0
- package/dist/shell/tab-overflow-popover.d.ts +13 -0
- package/dist/specimen/on-page-specimen.d.ts +19 -0
- package/dist/specimen/preview-glyphs.d.ts +2 -0
- package/dist/specimen/specimen-state.d.ts +12 -0
- package/dist/specimen/specimen-tab-body.d.ts +18 -0
- package/dist/specimen/specimen-toolbar.d.ts +10 -0
- package/dist/specimen/specimen-values.d.ts +9 -0
- package/dist/state/history.d.ts +64 -0
- package/dist/state/persist.d.ts +10 -14
- package/dist/state/transaction.d.ts +24 -0
- package/dist/state/tweak-state.d.ts +16 -0
- package/dist/styles/z-index-tokens.d.ts +2 -0
- package/dist/tabs/color-tab.d.ts +10 -1
- package/dist/tabs/flat/flat-tab.d.ts +27 -0
- package/dist/tabs/flat/index.d.ts +8 -0
- package/dist/tabs/flat/scroll-to-token-row.d.ts +3 -0
- package/dist/tabs/flat/tier-section.d.ts +17 -0
- package/dist/tabs/flat/token-controller.d.ts +23 -0
- package/dist/tabs/flat/token-row.d.ts +12 -0
- package/dist/tabs/flat/types.d.ts +25 -0
- package/dist/tabs/font-tab.d.ts +13 -12
- package/dist/tabs/generic-tab.d.ts +8 -38
- package/dist/tabs/palette/palette-check-view.d.ts +5 -1
- package/dist/tabs/palette/palette-edit-view.d.ts +9 -1
- package/dist/tabs/palette/palette-tab.d.ts +12 -1
- package/dist/tabs/size-tab.d.ts +7 -10
- package/dist/tabs/spacing-tab.d.ts +7 -13
- package/dist/testing.js +3 -3
- package/dist/tokens/tier-model.d.ts +6 -0
- package/dist/{tweak-state-DGLrzIwq.js → tweak-state-B7ok3Ob3.js} +473 -423
- package/dist/utils/numeric-transform.d.ts +32 -0
- package/dist/utils/token-diff.d.ts +25 -0
- package/dist/utils/token-graph.d.ts +23 -0
- package/dist/utils/token-index.d.ts +30 -0
- package/dist/zdtp.css +1 -1
- package/package.json +8 -1
- package/dist/controls/pill-slider-row.d.ts +0 -36
- package/dist/controls/select-row.d.ts +0 -25
- package/dist/controls/slider-row.d.ts +0 -29
- package/dist/controls/text-row.d.ts +0 -27
- package/dist/index-Ds4bCeiC.js +0 -7591
- package/dist/load-routing-D4H2VOl5.js +0 -426
|
@@ -1,70 +1,71 @@
|
|
|
1
|
-
|
|
1
|
+
import { DEFAULT_STORAGE_PREFIX as K, resolveToggleEventName as N } from "./constants.js";
|
|
2
|
+
class k extends Error {
|
|
2
3
|
constructor(t) {
|
|
3
|
-
super(t), this.name = "TierResolverError", Object.setPrototypeOf(this,
|
|
4
|
+
super(t), this.name = "TierResolverError", Object.setPrototypeOf(this, k.prototype);
|
|
4
5
|
}
|
|
5
6
|
}
|
|
6
|
-
function
|
|
7
|
+
function A(e, t) {
|
|
7
8
|
return e.tiers.find((n) => n.id === t);
|
|
8
9
|
}
|
|
9
10
|
function $(e, t) {
|
|
10
11
|
return e.items.find((n) => n.id === t);
|
|
11
12
|
}
|
|
12
|
-
function
|
|
13
|
-
const
|
|
14
|
-
if (!
|
|
15
|
-
throw new
|
|
16
|
-
`Tier "${t}" not found in tab "${e.id}". Available tiers: ${e.tiers.map((
|
|
13
|
+
function ee(e, t, n, i) {
|
|
14
|
+
const u = A(e, t);
|
|
15
|
+
if (!u)
|
|
16
|
+
throw new k(
|
|
17
|
+
`Tier "${t}" not found in tab "${e.id}". Available tiers: ${e.tiers.map((f) => f.id).join(", ")}.`
|
|
17
18
|
);
|
|
18
|
-
const
|
|
19
|
-
if (!
|
|
20
|
-
throw new
|
|
19
|
+
const d = $(u, n);
|
|
20
|
+
if (!d)
|
|
21
|
+
throw new k(
|
|
21
22
|
`Item "${n}" not found in tier "${t}" of tab "${e.id}".`
|
|
22
23
|
);
|
|
23
|
-
const
|
|
24
|
-
if (
|
|
25
|
-
const
|
|
26
|
-
if (!
|
|
27
|
-
throw new
|
|
28
|
-
`Tier "${t}" declares referencesTier "${
|
|
24
|
+
const r = i[t]?.[n];
|
|
25
|
+
if (u.referencesTier !== void 0) {
|
|
26
|
+
const f = u.referencesTier, l = A(e, f);
|
|
27
|
+
if (!l)
|
|
28
|
+
throw new k(
|
|
29
|
+
`Tier "${t}" declares referencesTier "${f}" but that tier does not exist in tab "${e.id}".`
|
|
29
30
|
);
|
|
30
|
-
const
|
|
31
|
-
if (!
|
|
32
|
-
const
|
|
33
|
-
if (!
|
|
34
|
-
throw new
|
|
35
|
-
`Referenced tier "${
|
|
31
|
+
const a = $(l, r ?? n);
|
|
32
|
+
if (!a) {
|
|
33
|
+
const g = $(l, d.default) ?? $(l, n) ?? l.items[0];
|
|
34
|
+
if (!g)
|
|
35
|
+
throw new k(
|
|
36
|
+
`Referenced tier "${f}" has no items; cannot resolve fallback for item "${n}" in tier "${t}" of tab "${e.id}".`
|
|
36
37
|
);
|
|
37
|
-
return { kind: "ref", targetCssVar:
|
|
38
|
+
return { kind: "ref", targetCssVar: g.cssVar };
|
|
38
39
|
}
|
|
39
|
-
return { kind: "ref", targetCssVar:
|
|
40
|
+
return { kind: "ref", targetCssVar: a.cssVar };
|
|
40
41
|
}
|
|
41
|
-
return
|
|
42
|
+
return r !== void 0 ? d.pill && r === d.pill.value ? { kind: "literal", value: d.pill.value } : { kind: "literal", value: r } : d.pill ? { kind: "literal", value: d.pill.customDefault } : { kind: "literal", value: d.default };
|
|
42
43
|
}
|
|
43
|
-
function
|
|
44
|
+
function te(e) {
|
|
44
45
|
return e.kind === "literal" ? e.value : `var(${e.targetCssVar})`;
|
|
45
46
|
}
|
|
46
|
-
function
|
|
47
|
+
function M(e, t, n = [t]) {
|
|
47
48
|
const i = e.tab === void 0 || e.tab === t.id ? t : n.find((s) => s.id === e.tab);
|
|
48
49
|
if (!i)
|
|
49
|
-
throw new
|
|
50
|
+
throw new k(
|
|
50
51
|
`Cross-tab ref target tab "${e.tab}" not found. Available tabs: ${n.map((s) => s.id).join(", ")}.`
|
|
51
52
|
);
|
|
52
|
-
const
|
|
53
|
-
if (!
|
|
54
|
-
throw new
|
|
53
|
+
const u = A(i, e.tier);
|
|
54
|
+
if (!u)
|
|
55
|
+
throw new k(
|
|
55
56
|
`Cross-tab ref target tier "${e.tier}" not found in tab "${i.id}". Available tiers: ${i.tiers.map((s) => s.id).join(", ")}.`
|
|
56
57
|
);
|
|
57
|
-
const
|
|
58
|
-
if (!
|
|
59
|
-
throw new
|
|
60
|
-
`Cross-tab ref target item "${e.item}" not found in tier "${e.tier}" of tab "${i.id}". Available items: ${
|
|
58
|
+
const d = $(u, e.item);
|
|
59
|
+
if (!d)
|
|
60
|
+
throw new k(
|
|
61
|
+
`Cross-tab ref target item "${e.item}" not found in tier "${e.tier}" of tab "${i.id}". Available items: ${u.items.map((s) => s.id).join(", ")}.`
|
|
61
62
|
);
|
|
62
|
-
return
|
|
63
|
+
return d.cssVar;
|
|
63
64
|
}
|
|
64
|
-
function
|
|
65
|
+
function ne(e, t) {
|
|
65
66
|
return e.paletteCssVarTemplate.replace("{n}", String(t));
|
|
66
67
|
}
|
|
67
|
-
const
|
|
68
|
+
const D = /* @__PURE__ */ new Set([
|
|
68
69
|
"aliceblue",
|
|
69
70
|
"antiquewhite",
|
|
70
71
|
"aqua",
|
|
@@ -222,38 +223,38 @@ const z = /* @__PURE__ */ new Set([
|
|
|
222
223
|
"revert-layer"
|
|
223
224
|
]);
|
|
224
225
|
function H(e) {
|
|
225
|
-
return e.startsWith("#") || e.includes("(") ||
|
|
226
|
+
return e.startsWith("#") || e.includes("(") || D.has(e.toLowerCase());
|
|
226
227
|
}
|
|
227
|
-
function
|
|
228
|
-
const
|
|
229
|
-
if (
|
|
230
|
-
const
|
|
231
|
-
|
|
228
|
+
function B(e, t, n, i) {
|
|
229
|
+
const u = [], d = e.indexOf(":");
|
|
230
|
+
if (d !== -1) {
|
|
231
|
+
const r = e.slice(0, d), f = e.slice(d + 1), l = t.find((o) => o.tier === r);
|
|
232
|
+
l && u.push({ tab: l.tab, tier: l.tier, item: f });
|
|
232
233
|
}
|
|
233
234
|
const [s] = t;
|
|
234
|
-
|
|
235
|
-
for (const
|
|
235
|
+
u.push({ tab: s.tab, tier: s.tier, item: e });
|
|
236
|
+
for (const r of u)
|
|
236
237
|
try {
|
|
237
|
-
return
|
|
238
|
+
return M(r, n, i), { ref: r };
|
|
238
239
|
} catch {
|
|
239
240
|
}
|
|
240
|
-
return { ref:
|
|
241
|
+
return { ref: u[0] };
|
|
241
242
|
}
|
|
242
|
-
function L(e, t, n, i,
|
|
243
|
+
function L(e, t, n, i, u, d) {
|
|
243
244
|
const s = t.get(e.default);
|
|
244
|
-
return s !== void 0 ? s : e.default === "bg" || e.default === "fg" ? e.default : n && n.length > 0 && !H(e.default) ?
|
|
245
|
+
return s !== void 0 ? s : e.default === "bg" || e.default === "fg" ? e.default : n && n.length > 0 && !H(e.default) ? B(e.default, n, i, u) : d ? (console.warn(
|
|
245
246
|
`[design-token-panel] semantic item "${e.id}" default "${e.default}" names no palette item; falling back to palette index 0`
|
|
246
247
|
), 0) : { literal: e.default };
|
|
247
248
|
}
|
|
248
|
-
function
|
|
249
|
+
function V(e, t = [e]) {
|
|
249
250
|
const n = e.colorExtras;
|
|
250
251
|
if (!n) return;
|
|
251
252
|
const i = e.tiers.find(
|
|
252
|
-
(
|
|
253
|
-
),
|
|
254
|
-
(
|
|
253
|
+
(a) => !a.referencesTier && !a.semantic && a.items.length > 0 && a.items[0].type.kind === "color"
|
|
254
|
+
), u = e.tiers.find(
|
|
255
|
+
(a) => i && a.referencesTier === i.id || a.semantic === !0
|
|
255
256
|
);
|
|
256
|
-
if (!i && !
|
|
257
|
+
if (!i && !u)
|
|
257
258
|
return {
|
|
258
259
|
id: n.id,
|
|
259
260
|
label: n.label,
|
|
@@ -267,20 +268,20 @@ function O(e, t = [e]) {
|
|
|
267
268
|
colorSchemes: n.colorSchemes,
|
|
268
269
|
panelSettings: n.panelSettings
|
|
269
270
|
};
|
|
270
|
-
const
|
|
271
|
-
for (let
|
|
272
|
-
|
|
273
|
-
const
|
|
274
|
-
if (
|
|
275
|
-
const
|
|
276
|
-
for (const
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
271
|
+
const d = i?.items ?? [], s = d.length, r = d[0] ? d[0].cssVar.replace(/\d+$/, "{n}") : "--zudo-stub-p{n}", f = /* @__PURE__ */ new Map();
|
|
272
|
+
for (let a = 0; a < d.length; a++)
|
|
273
|
+
f.set(d[a].id, a);
|
|
274
|
+
const l = {}, o = {};
|
|
275
|
+
if (u) {
|
|
276
|
+
const a = !u.semantic, g = n.semanticDefaults;
|
|
277
|
+
for (const c of u.items)
|
|
278
|
+
o[c.id] = c.cssVar, l[c.id] = g && c.id in g ? g[c.id] : L(
|
|
279
|
+
c,
|
|
280
|
+
f,
|
|
281
|
+
u.referencesRamps,
|
|
281
282
|
e,
|
|
282
283
|
t,
|
|
283
|
-
|
|
284
|
+
a
|
|
284
285
|
);
|
|
285
286
|
}
|
|
286
287
|
return {
|
|
@@ -288,44 +289,44 @@ function O(e, t = [e]) {
|
|
|
288
289
|
label: n.label,
|
|
289
290
|
paletteSize: s,
|
|
290
291
|
baseRoles: n.baseRoles,
|
|
291
|
-
paletteCssVarTemplate:
|
|
292
|
-
semanticDefaults:
|
|
293
|
-
semanticCssNames:
|
|
292
|
+
paletteCssVarTemplate: r,
|
|
293
|
+
semanticDefaults: l,
|
|
294
|
+
semanticCssNames: o,
|
|
294
295
|
baseDefaults: n.baseDefaults,
|
|
295
296
|
defaultShikiTheme: n.defaultShikiTheme,
|
|
296
297
|
colorSchemes: n.colorSchemes,
|
|
297
298
|
panelSettings: n.panelSettings
|
|
298
299
|
};
|
|
299
300
|
}
|
|
300
|
-
function
|
|
301
|
+
function re(e) {
|
|
301
302
|
const t = e.find((n) => n.id === "color");
|
|
302
303
|
if (t)
|
|
303
|
-
return
|
|
304
|
+
return V(t, e);
|
|
304
305
|
}
|
|
305
|
-
function
|
|
306
|
+
function J(e) {
|
|
306
307
|
const t = e.find((n) => n.id === "color-secondary");
|
|
307
|
-
return t ?
|
|
308
|
+
return t ? V(t, e) ?? null : null;
|
|
308
309
|
}
|
|
309
310
|
function S(e, t) {
|
|
310
311
|
if (Object.is(e, t)) return !0;
|
|
311
312
|
if (e === null || t === null || typeof e != typeof t || typeof e != "object") return !1;
|
|
312
313
|
if (Array.isArray(e)) {
|
|
313
314
|
if (!Array.isArray(t) || e.length !== t.length) return !1;
|
|
314
|
-
for (let
|
|
315
|
-
if (!S(e[
|
|
315
|
+
for (let d = 0; d < e.length; d++)
|
|
316
|
+
if (!S(e[d], t[d])) return !1;
|
|
316
317
|
return !0;
|
|
317
318
|
}
|
|
318
319
|
if (Array.isArray(t)) return !1;
|
|
319
320
|
const n = Object.keys(e), i = Object.keys(t);
|
|
320
321
|
if (n.length !== i.length) return !1;
|
|
321
|
-
const
|
|
322
|
-
for (const
|
|
323
|
-
if (!
|
|
322
|
+
const u = new Set(i);
|
|
323
|
+
for (const d of n)
|
|
324
|
+
if (!u.has(d) || !S(e[d], t[d]))
|
|
324
325
|
return !1;
|
|
325
326
|
return !0;
|
|
326
327
|
}
|
|
327
|
-
const
|
|
328
|
-
storagePrefix:
|
|
328
|
+
const q = {
|
|
329
|
+
storagePrefix: K,
|
|
329
330
|
consoleNamespace: "zudo",
|
|
330
331
|
modalClassPrefix: "zudo-design-token-panel-modal",
|
|
331
332
|
schemaId: "zudo-design-tokens/v1",
|
|
@@ -349,7 +350,7 @@ function m() {
|
|
|
349
350
|
colorSchemeOwners: /* @__PURE__ */ new Set()
|
|
350
351
|
}, e[R] = t), t;
|
|
351
352
|
}
|
|
352
|
-
function
|
|
353
|
+
function F(e) {
|
|
353
354
|
return {
|
|
354
355
|
instanceId: e,
|
|
355
356
|
open() {
|
|
@@ -371,7 +372,7 @@ function J(e) {
|
|
|
371
372
|
}
|
|
372
373
|
};
|
|
373
374
|
}
|
|
374
|
-
function
|
|
375
|
+
function oe(e) {
|
|
375
376
|
m().lifecycleHooks = {
|
|
376
377
|
configured: e.configured,
|
|
377
378
|
open: e.open,
|
|
@@ -380,40 +381,40 @@ function ne(e) {
|
|
|
380
381
|
destroy: e.destroy
|
|
381
382
|
};
|
|
382
383
|
}
|
|
383
|
-
function
|
|
384
|
+
function ie(e) {
|
|
384
385
|
const t = m(), n = e.storagePrefix, i = t.instances.get(n);
|
|
385
386
|
if (i) {
|
|
386
|
-
const
|
|
387
|
-
if (S(
|
|
387
|
+
const l = (o) => ({ ...o, applySink: void 0 });
|
|
388
|
+
if (S(l(i.suppliedConfig), l(e)))
|
|
388
389
|
return t.defaultPrefix = n, i.handle;
|
|
389
390
|
throw new Error(
|
|
390
391
|
`[design-token-panel] configurePanel() was already called with different values for storagePrefix "${n}". Configuration is one-shot per prefix per page lifecycle. To re-configure this prefix, call handle.destroy() first, then configurePanel() again. (Use a distinct storagePrefix for a second panel instance.)`
|
|
391
392
|
);
|
|
392
393
|
}
|
|
393
|
-
const
|
|
394
|
+
const u = t.pendingColorPresets, d = u ? { ...e, colorPresets: u } : { ...e };
|
|
394
395
|
t.pendingColorPresets = null;
|
|
395
|
-
const s = t.instances.size === 0,
|
|
396
|
+
const s = t.instances.size === 0, r = s ? [...t.pendingPostConfigureHooks] : [];
|
|
396
397
|
s && (t.pendingPostConfigureHooks.length = 0);
|
|
397
|
-
const
|
|
398
|
-
config:
|
|
398
|
+
const f = {
|
|
399
|
+
config: d,
|
|
399
400
|
// Snapshot the as-supplied config before any runtime merges. Used by the
|
|
400
401
|
// idempotency guard so view-transition re-calls with the original inline
|
|
401
402
|
// config keep passing even after setPanelColorPresets mutates `config`.
|
|
402
403
|
suppliedConfig: { ...e },
|
|
403
404
|
pendingColorPresets: null,
|
|
404
|
-
postConfigureHooks:
|
|
405
|
-
handle:
|
|
405
|
+
postConfigureHooks: r,
|
|
406
|
+
handle: F(n)
|
|
406
407
|
};
|
|
407
|
-
t.instances.set(n,
|
|
408
|
-
for (const
|
|
409
|
-
|
|
410
|
-
return t.lifecycleHooks.configured?.(n),
|
|
408
|
+
t.instances.set(n, f), t.defaultPrefix = n;
|
|
409
|
+
for (const l of f.postConfigureHooks)
|
|
410
|
+
l();
|
|
411
|
+
return t.lifecycleHooks.configured?.(n), f.handle;
|
|
411
412
|
}
|
|
412
413
|
function x() {
|
|
413
414
|
const e = m();
|
|
414
415
|
return e.defaultPrefix === null ? null : e.instances.get(e.defaultPrefix) ?? null;
|
|
415
416
|
}
|
|
416
|
-
function
|
|
417
|
+
function se(e) {
|
|
417
418
|
const t = x();
|
|
418
419
|
if (t === null) {
|
|
419
420
|
const n = m();
|
|
@@ -423,96 +424,110 @@ function oe(e) {
|
|
|
423
424
|
}
|
|
424
425
|
t.postConfigureHooks.includes(e) || (t.postConfigureHooks.push(e), e());
|
|
425
426
|
}
|
|
426
|
-
function
|
|
427
|
-
return x()?.config ??
|
|
427
|
+
function j() {
|
|
428
|
+
return x()?.config ?? q;
|
|
428
429
|
}
|
|
429
|
-
function
|
|
430
|
+
function ae() {
|
|
430
431
|
return [...m().instances.values()].map((e) => e.config);
|
|
431
432
|
}
|
|
432
|
-
function
|
|
433
|
+
function le(e) {
|
|
433
434
|
return m().instances.get(e)?.config ?? null;
|
|
434
435
|
}
|
|
435
|
-
function
|
|
436
|
+
function fe() {
|
|
436
437
|
const e = m();
|
|
437
|
-
e.instances.clear(), e.defaultPrefix = null, e.pendingColorPresets = null, e.pendingPostConfigureHooks.length = 0,
|
|
438
|
+
e.instances.clear(), e.defaultPrefix = null, e.pendingColorPresets = null, e.pendingPostConfigureHooks.length = 0, E().clear();
|
|
438
439
|
}
|
|
439
|
-
function
|
|
440
|
+
function E() {
|
|
440
441
|
const e = m();
|
|
441
442
|
return e.colorSchemeOwners || (e.colorSchemeOwners = /* @__PURE__ */ new Set()), e.colorSchemeOwners;
|
|
442
443
|
}
|
|
443
|
-
function le(e) {
|
|
444
|
-
A().add(e);
|
|
445
|
-
}
|
|
446
|
-
function fe(e) {
|
|
447
|
-
A().delete(e);
|
|
448
|
-
}
|
|
449
444
|
function ce(e) {
|
|
450
|
-
|
|
445
|
+
E().add(e);
|
|
451
446
|
}
|
|
452
|
-
function ge(e
|
|
453
|
-
|
|
447
|
+
function ge(e) {
|
|
448
|
+
E().delete(e);
|
|
454
449
|
}
|
|
455
450
|
function de(e) {
|
|
451
|
+
return E().has(e);
|
|
452
|
+
}
|
|
453
|
+
function ue(e = j()) {
|
|
454
|
+
return J(e.tabs);
|
|
455
|
+
}
|
|
456
|
+
function pe(e) {
|
|
456
457
|
return `${e.storagePrefix}-state-v2`;
|
|
457
458
|
}
|
|
458
|
-
function
|
|
459
|
+
function ye(e) {
|
|
459
460
|
return `${e.storagePrefix}-state-v3`;
|
|
460
461
|
}
|
|
461
|
-
function
|
|
462
|
+
function me(e) {
|
|
462
463
|
return `${e.storagePrefix}-state-v4`;
|
|
463
464
|
}
|
|
464
|
-
function
|
|
465
|
+
function he(e) {
|
|
465
466
|
return `${e.storagePrefix}-state`;
|
|
466
467
|
}
|
|
467
|
-
function
|
|
468
|
+
function we(e) {
|
|
468
469
|
return `${e.storagePrefix}-open`;
|
|
469
470
|
}
|
|
470
|
-
function
|
|
471
|
+
function be(e) {
|
|
471
472
|
return `${e.storagePrefix}-position`;
|
|
472
473
|
}
|
|
473
|
-
function
|
|
474
|
+
function ke(e) {
|
|
474
475
|
return `${e.storagePrefix}-size`;
|
|
475
476
|
}
|
|
476
|
-
function
|
|
477
|
+
function $e(e) {
|
|
478
|
+
return `${e.storagePrefix}-dock`;
|
|
479
|
+
}
|
|
480
|
+
function Ce(e) {
|
|
481
|
+
return `${e.storagePrefix}-dock-size`;
|
|
482
|
+
}
|
|
483
|
+
function Pe(e) {
|
|
477
484
|
return `${e.storagePrefix}-density`;
|
|
478
485
|
}
|
|
479
|
-
function
|
|
486
|
+
function ve(e) {
|
|
487
|
+
return `${e.storagePrefix}-specimen`;
|
|
488
|
+
}
|
|
489
|
+
function Ee(e, t) {
|
|
490
|
+
return `${e.storagePrefix}-snapshot-${t}`;
|
|
491
|
+
}
|
|
492
|
+
function Ae(e) {
|
|
493
|
+
return `${e.storagePrefix}-last-applied`;
|
|
494
|
+
}
|
|
495
|
+
function Se(e) {
|
|
480
496
|
return `${e.storagePrefix}:visible`;
|
|
481
497
|
}
|
|
482
|
-
function
|
|
498
|
+
function xe(e) {
|
|
483
499
|
return `${e.storagePrefix}:autoload`;
|
|
484
500
|
}
|
|
485
|
-
function
|
|
501
|
+
function je(e) {
|
|
486
502
|
return `${e.storagePrefix}-root`;
|
|
487
503
|
}
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
return e.storagePrefix === q ? G : e.toggleEvent ?? `toggle-${e.storagePrefix}`;
|
|
504
|
+
function Te(e) {
|
|
505
|
+
return N(e);
|
|
491
506
|
}
|
|
492
|
-
const
|
|
493
|
-
function
|
|
494
|
-
return `${
|
|
507
|
+
const G = "__zdtp:open-state-changed";
|
|
508
|
+
function Oe(e) {
|
|
509
|
+
return `${G}:${e.storagePrefix}`;
|
|
495
510
|
}
|
|
496
|
-
function
|
|
511
|
+
function Re(e, t) {
|
|
497
512
|
return `${e.modalClassPrefix}${t}`;
|
|
498
513
|
}
|
|
499
|
-
function
|
|
514
|
+
function Ve(e) {
|
|
500
515
|
return `${e.exportFilenameBase}.json`;
|
|
501
516
|
}
|
|
502
|
-
const
|
|
503
|
-
function
|
|
517
|
+
const _ = /* @__PURE__ */ Symbol.for("@takazudo/zdtp:global-alias-marker");
|
|
518
|
+
function z(e) {
|
|
504
519
|
return typeof e == "object" && e !== null || typeof e == "function";
|
|
505
520
|
}
|
|
506
521
|
function U(e) {
|
|
507
|
-
if (!
|
|
522
|
+
if (!z(e)) return !1;
|
|
508
523
|
try {
|
|
509
|
-
return e[
|
|
524
|
+
return e[_] === !0;
|
|
510
525
|
} catch {
|
|
511
526
|
return !1;
|
|
512
527
|
}
|
|
513
528
|
}
|
|
514
529
|
function W(e) {
|
|
515
|
-
if (!
|
|
530
|
+
if (!z(e)) return !1;
|
|
516
531
|
try {
|
|
517
532
|
const t = e;
|
|
518
533
|
return typeof t.show == "function" && typeof t.hide == "function" && typeof t.toggle == "function";
|
|
@@ -520,7 +535,7 @@ function W(e) {
|
|
|
520
535
|
return !1;
|
|
521
536
|
}
|
|
522
537
|
}
|
|
523
|
-
function
|
|
538
|
+
function _e(e) {
|
|
524
539
|
if (typeof window > "u") return;
|
|
525
540
|
const t = window, n = t.zdtp;
|
|
526
541
|
if (n !== void 0) {
|
|
@@ -532,9 +547,9 @@ function Se(e) {
|
|
|
532
547
|
return;
|
|
533
548
|
}
|
|
534
549
|
const i = { ...e };
|
|
535
|
-
i[
|
|
550
|
+
i[_] = !0, t.zdtp = i;
|
|
536
551
|
}
|
|
537
|
-
function
|
|
552
|
+
function ze(e) {
|
|
538
553
|
if (e === null || typeof e != "object" || Array.isArray(e))
|
|
539
554
|
throw new Error("[design-token-panel] PanelConfig must be a non-null object");
|
|
540
555
|
const t = e;
|
|
@@ -586,6 +601,18 @@ function xe(e) {
|
|
|
586
601
|
);
|
|
587
602
|
}
|
|
588
603
|
}
|
|
604
|
+
if (t.dock !== void 0) {
|
|
605
|
+
if (t.dock === null || typeof t.dock != "object" || Array.isArray(t.dock))
|
|
606
|
+
throw new Error("[design-token-panel] PanelConfig.dock must be a plain object");
|
|
607
|
+
const n = t.dock;
|
|
608
|
+
for (const i of Object.keys(n))
|
|
609
|
+
if (i !== "reflow")
|
|
610
|
+
throw new Error(`[design-token-panel] PanelConfig.dock.${i} is not a supported field`);
|
|
611
|
+
if (n.reflow !== void 0 && n.reflow !== "body-margin" && n.reflow !== "none")
|
|
612
|
+
throw new Error(
|
|
613
|
+
'[design-token-panel] PanelConfig.dock.reflow must be "body-margin" or "none" when set'
|
|
614
|
+
);
|
|
615
|
+
}
|
|
589
616
|
if (t.autoRememberOnOpen !== void 0 && typeof t.autoRememberOnOpen != "boolean")
|
|
590
617
|
throw new Error(
|
|
591
618
|
`[design-token-panel] PanelConfig.autoRememberOnOpen must be a boolean when set (got ${typeof t.autoRememberOnOpen})`
|
|
@@ -641,186 +668,225 @@ function X(e, t, n) {
|
|
|
641
668
|
throw new Error(
|
|
642
669
|
`[design-token-panel] PanelConfig.tabs["${e}"].tiers must be an array`
|
|
643
670
|
);
|
|
644
|
-
const i = /* @__PURE__ */ new Set(),
|
|
671
|
+
const i = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Map();
|
|
645
672
|
for (const s of t.tiers) {
|
|
646
673
|
if (s === null || typeof s != "object" || Array.isArray(s))
|
|
647
674
|
throw new Error(
|
|
648
675
|
`[design-token-panel] PanelConfig.tabs["${e}"].tiers: each tier must be a non-null object`
|
|
649
676
|
);
|
|
650
|
-
const
|
|
651
|
-
if (typeof
|
|
677
|
+
const r = s;
|
|
678
|
+
if (typeof r.id != "string" || r.id.length === 0)
|
|
652
679
|
throw new Error(
|
|
653
680
|
`[design-token-panel] PanelConfig.tabs["${e}"].tiers: each tier must have a non-empty string id`
|
|
654
681
|
);
|
|
655
|
-
if (i.has(
|
|
682
|
+
if (i.has(r.id))
|
|
683
|
+
throw new Error(
|
|
684
|
+
`[design-token-panel] PanelConfig.tabs["${e}"]: duplicate tier id "${r.id}"`
|
|
685
|
+
);
|
|
686
|
+
if (i.add(r.id), r.semantic !== void 0 && r.semantic !== !0)
|
|
687
|
+
throw new Error(
|
|
688
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${r.id}"].semantic must be exactly \`true\` when present (got ${JSON.stringify(r.semantic)})`
|
|
689
|
+
);
|
|
690
|
+
const f = /* @__PURE__ */ new Set([
|
|
691
|
+
"size",
|
|
692
|
+
"line-height",
|
|
693
|
+
"family",
|
|
694
|
+
"weight",
|
|
695
|
+
"bar",
|
|
696
|
+
"radius",
|
|
697
|
+
"duration"
|
|
698
|
+
]);
|
|
699
|
+
if (r.preview !== void 0 && !f.has(r.preview))
|
|
656
700
|
throw new Error(
|
|
657
|
-
`[design-token-panel] PanelConfig.tabs["${e}"]
|
|
701
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${r.id}"].preview has unsupported value ${JSON.stringify(r.preview)}`
|
|
658
702
|
);
|
|
659
|
-
if (
|
|
703
|
+
if (r.previewBase !== void 0 && (typeof r.previewBase != "string" || !r.previewBase.startsWith("--") || r.previewBase.length <= 2))
|
|
660
704
|
throw new Error(
|
|
661
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
705
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${r.id}"].previewBase must be a CSS custom property name`
|
|
662
706
|
);
|
|
663
|
-
if (
|
|
707
|
+
if (r.previewBase !== void 0 && r.preview !== "line-height")
|
|
664
708
|
throw new Error(
|
|
665
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
709
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${r.id}"].previewBase is only valid with preview "line-height"`
|
|
710
|
+
);
|
|
711
|
+
if (!Array.isArray(r.items))
|
|
712
|
+
throw new Error(
|
|
713
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${r.id}"].items must be an array`
|
|
666
714
|
);
|
|
667
715
|
let l;
|
|
668
|
-
for (const
|
|
669
|
-
if (f === null || typeof f != "object" || Array.isArray(f)) continue;
|
|
670
|
-
const o = f.type;
|
|
716
|
+
for (const o of r.items) {
|
|
671
717
|
if (o === null || typeof o != "object" || Array.isArray(o)) continue;
|
|
672
|
-
const
|
|
673
|
-
if (typeof
|
|
718
|
+
const g = o.type;
|
|
719
|
+
if (g === null || typeof g != "object" || Array.isArray(g)) continue;
|
|
720
|
+
const c = g.kind;
|
|
721
|
+
if (typeof c == "string") {
|
|
674
722
|
if (l === void 0)
|
|
675
|
-
l =
|
|
676
|
-
else if (l !==
|
|
723
|
+
l = c;
|
|
724
|
+
else if (l !== c)
|
|
677
725
|
throw new Error(
|
|
678
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
726
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${r.id}"]: mixed item kinds — found "${l}" and "${c}" in the same tier (all items must share the same kind)`
|
|
679
727
|
);
|
|
680
728
|
}
|
|
681
729
|
}
|
|
682
|
-
l !== void 0 &&
|
|
730
|
+
l !== void 0 && u.set(r.id, l);
|
|
683
731
|
}
|
|
684
|
-
const
|
|
732
|
+
const d = /* @__PURE__ */ new Set();
|
|
685
733
|
for (const s of t.tiers) {
|
|
686
|
-
const
|
|
687
|
-
for (const
|
|
688
|
-
if (
|
|
734
|
+
const r = s, f = r.id;
|
|
735
|
+
for (const l of r.items) {
|
|
736
|
+
if (l === null || typeof l != "object" || Array.isArray(l))
|
|
689
737
|
throw new Error(
|
|
690
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
738
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].items: each item must be a non-null object`
|
|
691
739
|
);
|
|
692
|
-
const
|
|
693
|
-
if (typeof
|
|
740
|
+
const o = l;
|
|
741
|
+
if (typeof o.id != "string" || o.id.length === 0)
|
|
694
742
|
throw new Error(
|
|
695
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
743
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].items: each item must have a non-empty string id`
|
|
696
744
|
);
|
|
697
|
-
if (
|
|
745
|
+
if (d.has(o.id))
|
|
698
746
|
throw new Error(
|
|
699
|
-
`[design-token-panel] PanelConfig.tabs["${e}"]: duplicate item id "${
|
|
747
|
+
`[design-token-panel] PanelConfig.tabs["${e}"]: duplicate item id "${o.id}" (item ids must be unique across all tiers within a tab)`
|
|
700
748
|
);
|
|
701
|
-
if (
|
|
749
|
+
if (d.add(o.id), typeof o.cssVar != "string" || !o.cssVar.startsWith("--"))
|
|
702
750
|
throw new Error(
|
|
703
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
751
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].items["${o.id}"].cssVar must start with "--" (got ${JSON.stringify(o.cssVar)})`
|
|
704
752
|
);
|
|
705
|
-
if (
|
|
753
|
+
if (o.cssVar.length <= 2)
|
|
706
754
|
throw new Error(
|
|
707
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
755
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].items["${o.id}"].cssVar must be non-empty after "--"`
|
|
708
756
|
);
|
|
709
|
-
const
|
|
710
|
-
if (
|
|
711
|
-
const
|
|
712
|
-
if (!Array.isArray(
|
|
757
|
+
const a = o.type;
|
|
758
|
+
if (a !== null && typeof a == "object" && !Array.isArray(a) && a.kind === "length" && a.units !== void 0) {
|
|
759
|
+
const g = a.units;
|
|
760
|
+
if (!Array.isArray(g))
|
|
713
761
|
throw new Error(
|
|
714
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
762
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].items["${o.id}"].type.units must be an array`
|
|
715
763
|
);
|
|
716
|
-
const
|
|
717
|
-
for (const p of
|
|
764
|
+
const c = /* @__PURE__ */ new Set();
|
|
765
|
+
for (const p of g) {
|
|
718
766
|
if (typeof p != "string" || p.length === 0)
|
|
719
767
|
throw new Error(
|
|
720
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
768
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].items["${o.id}"].type.units entries must be non-empty strings (got ${JSON.stringify(p)})`
|
|
721
769
|
);
|
|
722
|
-
if (
|
|
770
|
+
if (c.has(p))
|
|
723
771
|
throw new Error(
|
|
724
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
772
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].items["${o.id}"].type.units: duplicate unit ${JSON.stringify(p)}`
|
|
725
773
|
);
|
|
726
|
-
|
|
774
|
+
c.add(p);
|
|
727
775
|
}
|
|
728
776
|
}
|
|
729
777
|
}
|
|
730
778
|
}
|
|
731
779
|
for (const s of t.tiers) {
|
|
732
|
-
const
|
|
733
|
-
if (
|
|
734
|
-
if (typeof
|
|
780
|
+
const r = s, f = r.id;
|
|
781
|
+
if (r.referencesTier !== void 0) {
|
|
782
|
+
if (typeof r.referencesTier != "string")
|
|
735
783
|
throw new Error(
|
|
736
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
784
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesTier must be a string`
|
|
737
785
|
);
|
|
738
|
-
const
|
|
739
|
-
if (!i.has(
|
|
786
|
+
const l = r.referencesTier;
|
|
787
|
+
if (!i.has(l))
|
|
740
788
|
throw new Error(
|
|
741
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
789
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesTier: tier "${l}" does not exist in this tab`
|
|
742
790
|
);
|
|
743
|
-
const
|
|
744
|
-
if (
|
|
791
|
+
const o = u.get(f), a = u.get(l);
|
|
792
|
+
if (o !== void 0 && a !== void 0 && o !== "text" && o !== a)
|
|
745
793
|
throw new Error(
|
|
746
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
794
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesTier: referencing tier has kind "${o}" but referenced tier "${l}" has kind "${a}" (cross-kind reference is only allowed when the referencing tier has kind "text")`
|
|
747
795
|
);
|
|
748
796
|
}
|
|
749
797
|
}
|
|
750
798
|
for (const s of t.tiers) {
|
|
751
|
-
const
|
|
752
|
-
if (
|
|
753
|
-
|
|
799
|
+
const r = s, f = r.id, l = r.preview;
|
|
800
|
+
if (l === void 0) continue;
|
|
801
|
+
const o = u.get(f), a = typeof r.referencesTier == "string" ? u.get(r.referencesTier) : void 0, g = (c) => {
|
|
802
|
+
throw new Error(
|
|
803
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].preview "${l}" requires ${c}`
|
|
804
|
+
);
|
|
805
|
+
};
|
|
806
|
+
if (l === "size" && (r.referencesTier === void 0 ? o !== "length" : a !== "length") && g("a length tier or a reference tier resolving to length"), l === "line-height" && o !== "number" && g("a number tier"), l === "family" && o !== "text" && g("a text tier"), l === "weight" && o !== "select" && o !== "number" && g("a select or number tier"), (l === "bar" || l === "radius") && o !== "length" && g("a length tier"), l === "duration") {
|
|
807
|
+
o !== "length" && o !== "number" && g('a length or number tier with unit "ms" or "s"');
|
|
808
|
+
for (const c of r.items) {
|
|
809
|
+
if (c === null || typeof c != "object" || Array.isArray(c))
|
|
810
|
+
continue;
|
|
811
|
+
const p = c.type, h = p !== null && typeof p == "object" && !Array.isArray(p) ? p.unit : void 0;
|
|
812
|
+
h !== "ms" && h !== "s" && g('a length or number tier with unit "ms" or "s"');
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
for (const s of t.tiers) {
|
|
817
|
+
const r = s, f = r.id;
|
|
818
|
+
if (r.referencesRamps === void 0) continue;
|
|
819
|
+
if (r.semantic !== !0)
|
|
754
820
|
throw new Error(
|
|
755
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
821
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesRamps is only valid on a tier with semantic: true`
|
|
756
822
|
);
|
|
757
|
-
if (!Array.isArray(
|
|
823
|
+
if (!Array.isArray(r.referencesRamps))
|
|
758
824
|
throw new Error(
|
|
759
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
825
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesRamps must be an array`
|
|
760
826
|
);
|
|
761
827
|
if (e !== "color" && e !== "color-secondary")
|
|
762
828
|
throw new Error(
|
|
763
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
829
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesRamps is only supported on tabs with id "color" or "color-secondary" (got "${e}")`
|
|
764
830
|
);
|
|
765
|
-
const
|
|
766
|
-
for (let
|
|
767
|
-
const
|
|
768
|
-
if (
|
|
831
|
+
const l = u.get(f), o = r.referencesRamps;
|
|
832
|
+
for (let a = 0; a < o.length; a++) {
|
|
833
|
+
const g = o[a];
|
|
834
|
+
if (g === null || typeof g != "object" || Array.isArray(g))
|
|
769
835
|
throw new Error(
|
|
770
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
836
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesRamps[${a}] must be a non-null object`
|
|
771
837
|
);
|
|
772
|
-
const
|
|
773
|
-
if (typeof
|
|
838
|
+
const c = g;
|
|
839
|
+
if (typeof c.tier != "string" || c.tier.length === 0)
|
|
774
840
|
throw new Error(
|
|
775
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
841
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesRamps[${a}].tier must be a non-empty string`
|
|
776
842
|
);
|
|
777
|
-
if (
|
|
843
|
+
if (c.tab !== void 0 && (typeof c.tab != "string" || c.tab.length === 0))
|
|
778
844
|
throw new Error(
|
|
779
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
845
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesRamps[${a}].tab must be a non-empty string when set`
|
|
780
846
|
);
|
|
781
|
-
const p =
|
|
782
|
-
let
|
|
847
|
+
const p = c.tab === void 0 ? e : c.tab;
|
|
848
|
+
let h;
|
|
783
849
|
if (p === e)
|
|
784
|
-
|
|
850
|
+
h = t;
|
|
785
851
|
else {
|
|
786
|
-
const
|
|
852
|
+
const b = n.find(
|
|
787
853
|
(y) => y !== null && typeof y == "object" && !Array.isArray(y) && y.id === p
|
|
788
854
|
);
|
|
789
|
-
if (!
|
|
790
|
-
const y = n.filter((
|
|
855
|
+
if (!b) {
|
|
856
|
+
const y = n.filter((w) => w !== null && typeof w == "object" && !Array.isArray(w)).map((w) => w.id).join(", ");
|
|
791
857
|
throw new Error(
|
|
792
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
858
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesRamps[${a}]: tab "${p}" does not exist. Available tabs: ${y}.`
|
|
793
859
|
);
|
|
794
860
|
}
|
|
795
|
-
|
|
861
|
+
h = b;
|
|
796
862
|
}
|
|
797
|
-
const C = Array.isArray(
|
|
863
|
+
const C = Array.isArray(h.tiers) ? h.tiers : [], T = [];
|
|
798
864
|
let P;
|
|
799
|
-
for (const
|
|
800
|
-
if (
|
|
801
|
-
const y =
|
|
802
|
-
typeof y.id == "string" && (T.push(y.id), y.id ===
|
|
865
|
+
for (const b of C) {
|
|
866
|
+
if (b === null || typeof b != "object" || Array.isArray(b)) continue;
|
|
867
|
+
const y = b;
|
|
868
|
+
typeof y.id == "string" && (T.push(y.id), y.id === c.tier && (P = y));
|
|
803
869
|
}
|
|
804
870
|
if (!P)
|
|
805
871
|
throw new Error(
|
|
806
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
872
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesRamps[${a}]: tier "${c.tier}" does not exist in tab "${p}". Available tiers: ${T.join(", ")}.`
|
|
807
873
|
);
|
|
808
|
-
if (
|
|
809
|
-
const
|
|
874
|
+
if (l !== void 0) {
|
|
875
|
+
const b = Array.isArray(P.items) ? P.items : [];
|
|
810
876
|
let y;
|
|
811
|
-
for (const
|
|
812
|
-
if (
|
|
813
|
-
const
|
|
814
|
-
if (
|
|
815
|
-
const
|
|
816
|
-
if (typeof
|
|
817
|
-
y =
|
|
877
|
+
for (const w of b) {
|
|
878
|
+
if (w === null || typeof w != "object" || Array.isArray(w)) continue;
|
|
879
|
+
const v = w.type;
|
|
880
|
+
if (v === null || typeof v != "object" || Array.isArray(v)) continue;
|
|
881
|
+
const O = v.kind;
|
|
882
|
+
if (typeof O == "string") {
|
|
883
|
+
y = O;
|
|
818
884
|
break;
|
|
819
885
|
}
|
|
820
886
|
}
|
|
821
|
-
if (y !== void 0 &&
|
|
887
|
+
if (y !== void 0 && l !== y)
|
|
822
888
|
throw new Error(
|
|
823
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
889
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesRamps[${a}]: referencing semantic tier has kind "${l}" but target tier "${c.tier}" in tab "${p}" has kind "${y}" (cross-tab ramp sources must share the semantic tier's kind)`
|
|
824
890
|
);
|
|
825
891
|
}
|
|
826
892
|
}
|
|
@@ -831,39 +897,39 @@ function X(e, t, n) {
|
|
|
831
897
|
throw new Error(
|
|
832
898
|
`[design-token-panel] PanelConfig.tabs["${e}"].colorExtras must be a plain object`
|
|
833
899
|
);
|
|
834
|
-
for (const
|
|
835
|
-
if (typeof s[
|
|
900
|
+
for (const o of ["id", "defaultShikiTheme"])
|
|
901
|
+
if (typeof s[o] != "string" || s[o].length === 0)
|
|
836
902
|
throw new Error(
|
|
837
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].colorExtras.${
|
|
903
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].colorExtras.${o} must be a non-empty string (got ${typeof s[o]})`
|
|
838
904
|
);
|
|
839
|
-
for (const
|
|
840
|
-
if (s[
|
|
905
|
+
for (const o of ["colorSchemes", "baseRoles", "baseDefaults"])
|
|
906
|
+
if (s[o] === void 0 || s[o] === null || typeof s[o] != "object" || Array.isArray(s[o]))
|
|
841
907
|
throw new Error(
|
|
842
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].colorExtras.${
|
|
908
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].colorExtras.${o} must be a plain object`
|
|
843
909
|
);
|
|
844
910
|
if (s.panelSettings === void 0 || s.panelSettings === null || typeof s.panelSettings != "object" || Array.isArray(s.panelSettings))
|
|
845
911
|
throw new Error(
|
|
846
912
|
`[design-token-panel] PanelConfig.tabs["${e}"].colorExtras.panelSettings must be a plain object`
|
|
847
913
|
);
|
|
848
|
-
const
|
|
849
|
-
if (typeof
|
|
914
|
+
const r = s.panelSettings;
|
|
915
|
+
if (typeof r.colorScheme != "string" || r.colorScheme.length === 0)
|
|
850
916
|
throw new Error(
|
|
851
917
|
`[design-token-panel] PanelConfig.tabs["${e}"].colorExtras.panelSettings.colorScheme must be a non-empty string`
|
|
852
918
|
);
|
|
853
|
-
if (
|
|
854
|
-
if (
|
|
919
|
+
if (r.colorMode !== !1) {
|
|
920
|
+
if (r.colorMode === null || typeof r.colorMode != "object" || Array.isArray(r.colorMode))
|
|
855
921
|
throw new Error(
|
|
856
922
|
`[design-token-panel] PanelConfig.tabs["${e}"].colorExtras.panelSettings.colorMode must be false or a plain object`
|
|
857
923
|
);
|
|
858
|
-
const
|
|
859
|
-
for (const
|
|
860
|
-
if (typeof
|
|
924
|
+
const o = r.colorMode;
|
|
925
|
+
for (const a of ["lightScheme", "darkScheme"])
|
|
926
|
+
if (typeof o[a] != "string" || o[a].length === 0)
|
|
861
927
|
throw new Error(
|
|
862
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].colorExtras.panelSettings.colorMode.${
|
|
928
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].colorExtras.panelSettings.colorMode.${a} must be a non-empty string`
|
|
863
929
|
);
|
|
864
|
-
if (
|
|
930
|
+
if (o.defaultMode !== "light" && o.defaultMode !== "dark")
|
|
865
931
|
throw new Error(
|
|
866
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].colorExtras.panelSettings.colorMode.defaultMode must be "light" or "dark" (got ${JSON.stringify(
|
|
932
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].colorExtras.panelSettings.colorMode.defaultMode must be "light" or "dark" (got ${JSON.stringify(o.defaultMode)})`
|
|
867
933
|
);
|
|
868
934
|
}
|
|
869
935
|
if (s.semanticDefaults !== void 0) {
|
|
@@ -871,37 +937,37 @@ function X(e, t, n) {
|
|
|
871
937
|
throw new Error(
|
|
872
938
|
`[design-token-panel] PanelConfig.tabs["${e}"].colorExtras.semanticDefaults must be a plain object`
|
|
873
939
|
);
|
|
874
|
-
const
|
|
875
|
-
for (const [
|
|
876
|
-
if (!Y(
|
|
940
|
+
const o = s.semanticDefaults;
|
|
941
|
+
for (const [a, g] of Object.entries(o))
|
|
942
|
+
if (!Y(g))
|
|
877
943
|
throw new Error(
|
|
878
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].colorExtras.semanticDefaults["${
|
|
944
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].colorExtras.semanticDefaults["${a}"] must be a valid SemanticValue (number | 'bg' | 'fg' | { literal: string } | { literal: { light, dark } } | { ref: { tier, item, tab? } }), got ${JSON.stringify(g)}`
|
|
879
945
|
);
|
|
880
946
|
}
|
|
881
|
-
const
|
|
882
|
-
if (
|
|
883
|
-
const
|
|
884
|
-
if (!Array.isArray(
|
|
885
|
-
const
|
|
886
|
-
if (
|
|
887
|
-
const
|
|
888
|
-
return
|
|
947
|
+
const l = t.tiers.find((o) => {
|
|
948
|
+
if (o.referencesTier !== void 0 || o.semantic === !0) return !1;
|
|
949
|
+
const a = o.items;
|
|
950
|
+
if (!Array.isArray(a) || a.length === 0) return !1;
|
|
951
|
+
const g = a[0];
|
|
952
|
+
if (g === null || typeof g != "object" || Array.isArray(g)) return !1;
|
|
953
|
+
const c = g.type;
|
|
954
|
+
return c === null || typeof c != "object" || Array.isArray(c) ? !1 : c.kind === "color";
|
|
889
955
|
});
|
|
890
|
-
if (
|
|
891
|
-
const
|
|
892
|
-
if (
|
|
893
|
-
const
|
|
894
|
-
if (
|
|
895
|
-
for (let p = 0; p <
|
|
896
|
-
const
|
|
897
|
-
if (
|
|
956
|
+
if (l) {
|
|
957
|
+
const o = l.id, a = l.items, g = a[0]?.cssVar;
|
|
958
|
+
if (g !== void 0) {
|
|
959
|
+
const c = g.replace(/\d+$/, "{n}");
|
|
960
|
+
if (c.includes("{n}"))
|
|
961
|
+
for (let p = 0; p < a.length; p++) {
|
|
962
|
+
const h = a[p], C = c.replace("{n}", String(p));
|
|
963
|
+
if (h.cssVar !== C)
|
|
898
964
|
throw new Error(
|
|
899
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
965
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${o}"].items[${p}].cssVar is ${JSON.stringify(h.cssVar)} but expected ${JSON.stringify(C)} — palette item cssVars must share one prefix and be numbered 0..n-1 in tier order (template derived from first item: ${JSON.stringify(c)})`
|
|
900
966
|
);
|
|
901
967
|
}
|
|
902
|
-
else if (
|
|
968
|
+
else if (a.length > 1)
|
|
903
969
|
throw new Error(
|
|
904
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
970
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${o}"].items[0].cssVar ${JSON.stringify(g)} has no trailing digit — palette item cssVars must share one prefix and be numbered 0..n-1 in tier order (e.g. "--pal-0" … "--pal-15")`
|
|
905
971
|
);
|
|
906
972
|
}
|
|
907
973
|
}
|
|
@@ -920,20 +986,23 @@ function X(e, t, n) {
|
|
|
920
986
|
'[design-token-panel] PanelConfig.tabs["notes"].notesExtras must be a plain object with { title, html }'
|
|
921
987
|
);
|
|
922
988
|
const s = t.notesExtras;
|
|
923
|
-
for (const
|
|
924
|
-
if (typeof s[
|
|
989
|
+
for (const r of ["title", "html"])
|
|
990
|
+
if (typeof s[r] != "string" || s[r].length === 0)
|
|
925
991
|
throw new Error(
|
|
926
|
-
`[design-token-panel] PanelConfig.tabs["notes"].notesExtras.${
|
|
992
|
+
`[design-token-panel] PanelConfig.tabs["notes"].notesExtras.${r} must be a non-empty string (got ${typeof s[r]})`
|
|
927
993
|
);
|
|
928
994
|
} else if (t.notesExtras !== void 0)
|
|
929
995
|
throw new Error(
|
|
930
996
|
`[design-token-panel] PanelConfig.tabs["${e}"].notesExtras must only be set on a tab with id "notes"`
|
|
931
997
|
);
|
|
932
998
|
}
|
|
933
|
-
function
|
|
999
|
+
function Q(e = j()) {
|
|
934
1000
|
return e.applyRouting ?? {};
|
|
935
1001
|
}
|
|
936
|
-
function
|
|
1002
|
+
function Ke(e = j()) {
|
|
1003
|
+
return !!e.applyEndpoint && Object.keys(Q(e)).length > 0;
|
|
1004
|
+
}
|
|
1005
|
+
function Ne(e) {
|
|
937
1006
|
const t = x();
|
|
938
1007
|
if (t === null) {
|
|
939
1008
|
m().pendingColorPresets = e;
|
|
@@ -942,42 +1011,47 @@ function je(e) {
|
|
|
942
1011
|
t.config = { ...t.config, colorPresets: e };
|
|
943
1012
|
}
|
|
944
1013
|
export {
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
1014
|
+
M as A,
|
|
1015
|
+
V as B,
|
|
1016
|
+
S as C,
|
|
1017
|
+
Ve as D,
|
|
1018
|
+
Q as E,
|
|
1019
|
+
Ke as F,
|
|
1020
|
+
Ae as G,
|
|
1021
|
+
Ee as H,
|
|
1022
|
+
ve as I,
|
|
1023
|
+
Oe as J,
|
|
1024
|
+
oe as K,
|
|
1025
|
+
se as L,
|
|
1026
|
+
Te as M,
|
|
1027
|
+
ae as N,
|
|
1028
|
+
le as O,
|
|
1029
|
+
je as P,
|
|
1030
|
+
fe as _,
|
|
1031
|
+
Se as a,
|
|
1032
|
+
ze as b,
|
|
1033
|
+
ie as c,
|
|
1034
|
+
we as d,
|
|
1035
|
+
be as e,
|
|
1036
|
+
he as f,
|
|
1037
|
+
j as g,
|
|
1038
|
+
pe as h,
|
|
1039
|
+
_e as i,
|
|
1040
|
+
xe as j,
|
|
1041
|
+
me as k,
|
|
1042
|
+
ye as l,
|
|
1043
|
+
Re as m,
|
|
1044
|
+
ge as n,
|
|
1045
|
+
ue as o,
|
|
1046
|
+
ee as p,
|
|
1047
|
+
te as q,
|
|
1048
|
+
re as r,
|
|
1049
|
+
Ne as s,
|
|
1050
|
+
ke as t,
|
|
1051
|
+
Pe as u,
|
|
1052
|
+
Ce as v,
|
|
1053
|
+
$e as w,
|
|
1054
|
+
ne as x,
|
|
1055
|
+
ce as y,
|
|
1056
|
+
de as z
|
|
983
1057
|
};
|