@takazudo/zdtp 0.5.2 → 0.6.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 +25 -0
- package/PORTABLE-CONTRACT.md +18 -0
- package/dist/apply/build-apply-overrides.d.ts +2 -2
- package/dist/apply/last-applied.d.ts +1 -1
- package/dist/apply/reconcile-applied.d.ts +2 -2
- package/dist/apply/route-tokens-to-files.d.ts +1 -1
- package/dist/apply/tier-resolver.d.ts +1 -1
- package/dist/apply-modal.d.ts +2 -2
- package/dist/astro/host-adapter.js +3 -3
- package/dist/astro/index.d.ts +8 -8
- package/dist/astro/index.js +1 -1
- package/dist/{autoload-state-BI4-9A58.js → autoload-state-CGnis85c.js} +1 -1
- package/dist/bulk/bulk-actions.d.ts +3 -3
- package/dist/bulk/index.d.ts +2 -2
- package/dist/chain/index.d.ts +2 -2
- package/dist/chain/token-chain-context.d.ts +3 -3
- package/dist/chain/token-chain-popover.d.ts +2 -2
- package/dist/changed/contribution.d.ts +5 -5
- package/dist/changed/footer-content.d.ts +4 -4
- package/dist/changed/index.d.ts +4 -4
- package/dist/components/color-picker/color-field.d.ts +1 -1
- package/dist/components/color-picker/index.d.ts +2 -2
- package/dist/components/palette-chart/index.d.ts +2 -2
- package/dist/components/palette-chart/palette-chart.d.ts +4 -4
- package/dist/config/cluster-config.d.ts +4 -4
- package/dist/config/color-scheme-utils.d.ts +1 -1
- package/dist/config/panel-config.d.ts +5 -5
- package/dist/controls/tier-ref-selector.d.ts +1 -1
- package/dist/dom-tweaker/dom-tweaker-diff-action-link.d.ts +1 -1
- package/dist/dom-tweaker/dom-tweaker-orchestrator.d.ts +1 -1
- package/dist/dom-tweaker/dom-tweaker-state.d.ts +1 -1
- package/dist/dom-tweaker/lazy/class-editor-popup.d.ts +1 -1
- package/dist/dom-tweaker/lazy/diff-export-modal.d.ts +1 -1
- package/dist/dom-tweaker/lazy/index.d.ts +2 -2
- package/dist/element-inspect/element-inspect-context.d.ts +1 -1
- package/dist/element-inspect/element-inspect-orchestrator.d.ts +3 -3
- package/dist/element-inspect/element-inspect-overlay.d.ts +1 -1
- package/dist/element-inspect/find-tokens-for-element.d.ts +1 -1
- package/dist/element-inspect/index.d.ts +8 -8
- package/dist/element-path/element-path-state.d.ts +1 -1
- package/dist/element-path/index.d.ts +7 -7
- package/dist/export-modal.d.ts +2 -2
- package/dist/highlight/highlight-orchestrator.d.ts +2 -2
- package/dist/highlight/highlight-state.d.ts +1 -1
- package/dist/highlight/highlight-toggle-button.d.ts +2 -2
- package/dist/history/buttons.d.ts +1 -1
- package/dist/history/index.d.ts +3 -3
- package/dist/history/rail.d.ts +2 -2
- package/dist/history/snapshots.d.ts +2 -2
- package/dist/import-modal.d.ts +2 -2
- package/dist/{index-ChsJ5u4d.js → index-DWs1XPfy.js} +993 -993
- package/dist/{index-CAQf4HKm.js → index-LYsbHWcy.js} +2 -2
- package/dist/index.d.ts +14 -14
- package/dist/index.js +14 -13
- package/dist/{panel-config-CqbuB0nh.js → panel-config-Crn5QJGy.js} +243 -208
- package/dist/panel.d.ts +2 -2
- package/dist/picker/index.d.ts +4 -4
- package/dist/search/command-palette.d.ts +3 -3
- package/dist/search/contribution.d.ts +1 -1
- package/dist/search/index.d.ts +4 -4
- package/dist/search/match-bar.d.ts +1 -1
- package/dist/search/token-search.d.ts +3 -3
- package/dist/server/create-apply-handler.d.ts +2 -2
- package/dist/server/index.d.ts +6 -6
- package/dist/shell/dock-mode-switch.d.ts +1 -1
- package/dist/shell/regions.d.ts +1 -1
- package/dist/shell/tab-bar.d.ts +1 -1
- package/dist/shell/tab-overflow-popover.d.ts +1 -1
- package/dist/specimen/on-page-specimen.d.ts +3 -3
- package/dist/specimen/preview-glyphs.d.ts +1 -1
- package/dist/specimen/specimen-state.d.ts +1 -1
- package/dist/specimen/specimen-tab-body.d.ts +5 -5
- package/dist/specimen/specimen-toolbar.d.ts +1 -1
- package/dist/specimen/specimen-values.d.ts +1 -1
- package/dist/state/autoload-state.d.ts +1 -1
- package/dist/state/history.d.ts +1 -1
- package/dist/state/persist.d.ts +3 -3
- package/dist/state/transaction.d.ts +3 -3
- package/dist/state/tweak-state.d.ts +12 -12
- package/dist/tabs/_generic-item-editor.d.ts +1 -1
- package/dist/tabs/color-tab.d.ts +6 -6
- package/dist/tabs/flat/flat-tab.d.ts +5 -5
- package/dist/tabs/flat/index.d.ts +8 -8
- package/dist/tabs/flat/scroll-to-token-row.d.ts +1 -1
- package/dist/tabs/flat/tier-section.d.ts +3 -3
- package/dist/tabs/flat/token-controller.d.ts +1 -1
- package/dist/tabs/flat/token-row.d.ts +2 -2
- package/dist/tabs/flat/types.d.ts +1 -1
- package/dist/tabs/font-tab.d.ts +6 -6
- package/dist/tabs/generic-tab.d.ts +4 -4
- package/dist/tabs/notes-tab.d.ts +1 -1
- package/dist/tabs/palette/palette-check-view.d.ts +3 -3
- package/dist/tabs/palette/palette-edit-view.d.ts +3 -3
- package/dist/tabs/palette/palette-readout.d.ts +1 -1
- package/dist/tabs/palette/palette-tab.d.ts +3 -3
- package/dist/tabs/size-tab.d.ts +5 -5
- package/dist/tabs/spacing-tab.d.ts +5 -5
- package/dist/testing.d.ts +6 -6
- package/dist/testing.js +16 -15
- package/dist/tokens/tier-model.d.ts +2 -2
- package/dist/{tweak-state-c53KtLHq.js → tweak-state-Dzr5kDhX.js} +210 -207
- package/dist/utils/color-oklch.d.ts +2 -2
- package/dist/utils/design-token-serde.d.ts +2 -2
- package/dist/utils/token-diff.d.ts +3 -3
- package/dist/utils/token-graph.d.ts +4 -4
- package/dist/utils/token-index.d.ts +2 -2
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_STORAGE_PREFIX as
|
|
1
|
+
import { DEFAULT_STORAGE_PREFIX as z, resolveToggleEventName as M, READABLE_STATE_KEY_SUFFIXES as v } from "./constants.js";
|
|
2
2
|
class k extends Error {
|
|
3
3
|
constructor(t) {
|
|
4
4
|
super(t), this.name = "TierResolverError", Object.setPrototypeOf(this, k.prototype);
|
|
@@ -10,7 +10,7 @@ function S(e, t) {
|
|
|
10
10
|
function $(e, t) {
|
|
11
11
|
return e.items.find((n) => n.id === t);
|
|
12
12
|
}
|
|
13
|
-
function te(e, t, n,
|
|
13
|
+
function te(e, t, n, a) {
|
|
14
14
|
const u = S(e, t);
|
|
15
15
|
if (!u)
|
|
16
16
|
throw new k(
|
|
@@ -21,23 +21,23 @@ function te(e, t, n, i) {
|
|
|
21
21
|
throw new k(
|
|
22
22
|
`Item "${n}" not found in tier "${t}" of tab "${e.id}".`
|
|
23
23
|
);
|
|
24
|
-
const r =
|
|
24
|
+
const r = a[t]?.[n];
|
|
25
25
|
if (u.referencesTier !== void 0) {
|
|
26
26
|
const f = u.referencesTier, l = S(e, f);
|
|
27
27
|
if (!l)
|
|
28
28
|
throw new k(
|
|
29
29
|
`Tier "${t}" declares referencesTier "${f}" but that tier does not exist in tab "${e.id}".`
|
|
30
30
|
);
|
|
31
|
-
const
|
|
32
|
-
if (!
|
|
33
|
-
const
|
|
34
|
-
if (!
|
|
31
|
+
const o = $(l, r ?? n);
|
|
32
|
+
if (!o) {
|
|
33
|
+
const c = $(l, d.default) ?? $(l, n) ?? l.items[0];
|
|
34
|
+
if (!c)
|
|
35
35
|
throw new k(
|
|
36
36
|
`Referenced tier "${f}" has no items; cannot resolve fallback for item "${n}" in tier "${t}" of tab "${e.id}".`
|
|
37
37
|
);
|
|
38
|
-
return { kind: "ref", targetCssVar:
|
|
38
|
+
return { kind: "ref", targetCssVar: c.cssVar };
|
|
39
39
|
}
|
|
40
|
-
return { kind: "ref", targetCssVar:
|
|
40
|
+
return { kind: "ref", targetCssVar: o.cssVar };
|
|
41
41
|
}
|
|
42
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 };
|
|
43
43
|
}
|
|
@@ -45,20 +45,20 @@ function ne(e) {
|
|
|
45
45
|
return e.kind === "literal" ? e.value : `var(${e.targetCssVar})`;
|
|
46
46
|
}
|
|
47
47
|
function D(e, t, n = [t]) {
|
|
48
|
-
const
|
|
49
|
-
if (!
|
|
48
|
+
const a = e.tab === void 0 || e.tab === t.id ? t : n.find((s) => s.id === e.tab);
|
|
49
|
+
if (!a)
|
|
50
50
|
throw new k(
|
|
51
51
|
`Cross-tab ref target tab "${e.tab}" not found. Available tabs: ${n.map((s) => s.id).join(", ")}.`
|
|
52
52
|
);
|
|
53
|
-
const u = S(
|
|
53
|
+
const u = S(a, e.tier);
|
|
54
54
|
if (!u)
|
|
55
55
|
throw new k(
|
|
56
|
-
`Cross-tab ref target tier "${e.tier}" not found in tab "${
|
|
56
|
+
`Cross-tab ref target tier "${e.tier}" not found in tab "${a.id}". Available tiers: ${a.tiers.map((s) => s.id).join(", ")}.`
|
|
57
57
|
);
|
|
58
58
|
const d = $(u, e.item);
|
|
59
59
|
if (!d)
|
|
60
60
|
throw new k(
|
|
61
|
-
`Cross-tab ref target item "${e.item}" not found in tier "${e.tier}" of tab "${
|
|
61
|
+
`Cross-tab ref target item "${e.item}" not found in tier "${e.tier}" of tab "${a.id}". Available items: ${u.items.map((s) => s.id).join(", ")}.`
|
|
62
62
|
);
|
|
63
63
|
return d.cssVar;
|
|
64
64
|
}
|
|
@@ -225,36 +225,36 @@ const H = /* @__PURE__ */ new Set([
|
|
|
225
225
|
function B(e) {
|
|
226
226
|
return e.startsWith("#") || e.includes("(") || H.has(e.toLowerCase());
|
|
227
227
|
}
|
|
228
|
-
function
|
|
228
|
+
function J(e, t, n, a) {
|
|
229
229
|
const u = [], d = e.indexOf(":");
|
|
230
230
|
if (d !== -1) {
|
|
231
|
-
const r = e.slice(0, d), f = e.slice(d + 1), l = t.find((
|
|
231
|
+
const r = e.slice(0, d), f = e.slice(d + 1), l = t.find((i) => i.tier === r);
|
|
232
232
|
l && u.push({ tab: l.tab, tier: l.tier, item: f });
|
|
233
233
|
}
|
|
234
234
|
const [s] = t;
|
|
235
235
|
u.push({ tab: s.tab, tier: s.tier, item: e });
|
|
236
236
|
for (const r of u)
|
|
237
237
|
try {
|
|
238
|
-
return D(r, n,
|
|
238
|
+
return D(r, n, a), { ref: r };
|
|
239
239
|
} catch {
|
|
240
240
|
}
|
|
241
241
|
return { ref: u[0] };
|
|
242
242
|
}
|
|
243
|
-
function F(e, t, n,
|
|
243
|
+
function F(e, t, n, a, u, d) {
|
|
244
244
|
const s = t.get(e.default);
|
|
245
|
-
return s !== void 0 ? s : e.default === "bg" || e.default === "fg" ? e.default : n && n.length > 0 && !B(e.default) ?
|
|
245
|
+
return s !== void 0 ? s : e.default === "bg" || e.default === "fg" ? e.default : n && n.length > 0 && !B(e.default) ? J(e.default, n, a, u) : d ? (console.warn(
|
|
246
246
|
`[design-token-panel] semantic item "${e.id}" default "${e.default}" names no palette item; falling back to palette index 0`
|
|
247
247
|
), 0) : { literal: e.default };
|
|
248
248
|
}
|
|
249
249
|
function _(e, t = [e]) {
|
|
250
250
|
const n = e.colorExtras;
|
|
251
251
|
if (!n) return;
|
|
252
|
-
const
|
|
253
|
-
(
|
|
252
|
+
const a = e.tiers.find(
|
|
253
|
+
(o) => !o.referencesTier && !o.semantic && o.items.length > 0 && o.items[0].type.kind === "color"
|
|
254
254
|
), u = e.tiers.find(
|
|
255
|
-
(
|
|
255
|
+
(o) => a && o.referencesTier === a.id || o.semantic === !0
|
|
256
256
|
);
|
|
257
|
-
if (!
|
|
257
|
+
if (!a && !u)
|
|
258
258
|
return {
|
|
259
259
|
id: n.id,
|
|
260
260
|
label: n.label,
|
|
@@ -268,20 +268,20 @@ function _(e, t = [e]) {
|
|
|
268
268
|
colorSchemes: n.colorSchemes,
|
|
269
269
|
panelSettings: n.panelSettings
|
|
270
270
|
};
|
|
271
|
-
const d =
|
|
272
|
-
for (let
|
|
273
|
-
f.set(d[
|
|
274
|
-
const l = {},
|
|
271
|
+
const d = a?.items ?? [], s = d.length, r = d[0] ? d[0].cssVar.replace(/\d+$/, "{n}") : "--zudo-stub-p{n}", f = /* @__PURE__ */ new Map();
|
|
272
|
+
for (let o = 0; o < d.length; o++)
|
|
273
|
+
f.set(d[o].id, o);
|
|
274
|
+
const l = {}, i = {};
|
|
275
275
|
if (u) {
|
|
276
|
-
const
|
|
277
|
-
for (const
|
|
278
|
-
|
|
279
|
-
|
|
276
|
+
const o = !u.semantic, c = n.semanticDefaults;
|
|
277
|
+
for (const g of u.items)
|
|
278
|
+
i[g.id] = g.cssVar, l[g.id] = c && g.id in c ? c[g.id] : F(
|
|
279
|
+
g,
|
|
280
280
|
f,
|
|
281
281
|
u.referencesRamps,
|
|
282
282
|
e,
|
|
283
283
|
t,
|
|
284
|
-
|
|
284
|
+
o
|
|
285
285
|
);
|
|
286
286
|
}
|
|
287
287
|
return {
|
|
@@ -291,19 +291,19 @@ function _(e, t = [e]) {
|
|
|
291
291
|
baseRoles: n.baseRoles,
|
|
292
292
|
paletteCssVarTemplate: r,
|
|
293
293
|
semanticDefaults: l,
|
|
294
|
-
semanticCssNames:
|
|
294
|
+
semanticCssNames: i,
|
|
295
295
|
baseDefaults: n.baseDefaults,
|
|
296
296
|
defaultShikiTheme: n.defaultShikiTheme,
|
|
297
297
|
colorSchemes: n.colorSchemes,
|
|
298
298
|
panelSettings: n.panelSettings
|
|
299
299
|
};
|
|
300
300
|
}
|
|
301
|
-
function
|
|
301
|
+
function ie(e) {
|
|
302
302
|
const t = e.find((n) => n.id === "color");
|
|
303
303
|
if (t)
|
|
304
304
|
return _(t, e);
|
|
305
305
|
}
|
|
306
|
-
function
|
|
306
|
+
function L(e) {
|
|
307
307
|
const t = e.find((n) => n.id === "color-secondary");
|
|
308
308
|
return t ? _(t, e) ?? null : null;
|
|
309
309
|
}
|
|
@@ -317,16 +317,16 @@ function x(e, t) {
|
|
|
317
317
|
return !0;
|
|
318
318
|
}
|
|
319
319
|
if (Array.isArray(t)) return !1;
|
|
320
|
-
const n = Object.keys(e),
|
|
321
|
-
if (n.length !==
|
|
322
|
-
const u = new Set(
|
|
320
|
+
const n = Object.keys(e), a = Object.keys(t);
|
|
321
|
+
if (n.length !== a.length) return !1;
|
|
322
|
+
const u = new Set(a);
|
|
323
323
|
for (const d of n)
|
|
324
324
|
if (!u.has(d) || !x(e[d], t[d]))
|
|
325
325
|
return !1;
|
|
326
326
|
return !0;
|
|
327
327
|
}
|
|
328
328
|
const q = {
|
|
329
|
-
storagePrefix:
|
|
329
|
+
storagePrefix: z,
|
|
330
330
|
consoleNamespace: "zudo",
|
|
331
331
|
modalClassPrefix: "zudo-design-token-panel-modal",
|
|
332
332
|
schemaId: "zudo-design-tokens/v1",
|
|
@@ -338,7 +338,7 @@ const q = {
|
|
|
338
338
|
applyEndpoint: void 0,
|
|
339
339
|
applyRouting: void 0
|
|
340
340
|
}, V = /* @__PURE__ */ Symbol.for("@takazudo/zdtp:singleton");
|
|
341
|
-
function
|
|
341
|
+
function h() {
|
|
342
342
|
const e = globalThis;
|
|
343
343
|
let t = e[V];
|
|
344
344
|
return t || (t = {
|
|
@@ -354,17 +354,17 @@ function G(e) {
|
|
|
354
354
|
return {
|
|
355
355
|
instanceId: e,
|
|
356
356
|
open() {
|
|
357
|
-
|
|
357
|
+
h().lifecycleHooks.open?.(e);
|
|
358
358
|
},
|
|
359
359
|
close() {
|
|
360
|
-
|
|
360
|
+
h().lifecycleHooks.close?.(e);
|
|
361
361
|
},
|
|
362
362
|
toggle() {
|
|
363
|
-
|
|
363
|
+
h().lifecycleHooks.toggle?.(e);
|
|
364
364
|
},
|
|
365
365
|
destroy() {
|
|
366
|
-
|
|
367
|
-
const t =
|
|
366
|
+
h().lifecycleHooks.destroy?.(e);
|
|
367
|
+
const t = h();
|
|
368
368
|
if (t.instances.delete(e), t.defaultPrefix === e) {
|
|
369
369
|
const n = [...t.instances.keys()];
|
|
370
370
|
t.defaultPrefix = n.length > 0 ? n[n.length - 1] : null;
|
|
@@ -372,8 +372,8 @@ function G(e) {
|
|
|
372
372
|
}
|
|
373
373
|
};
|
|
374
374
|
}
|
|
375
|
-
function
|
|
376
|
-
|
|
375
|
+
function oe(e) {
|
|
376
|
+
h().lifecycleHooks = {
|
|
377
377
|
configured: e.configured,
|
|
378
378
|
open: e.open,
|
|
379
379
|
close: e.close,
|
|
@@ -382,11 +382,11 @@ function ie(e) {
|
|
|
382
382
|
};
|
|
383
383
|
}
|
|
384
384
|
function se(e) {
|
|
385
|
-
const t =
|
|
386
|
-
if (
|
|
387
|
-
const l = (
|
|
388
|
-
if (x(l(
|
|
389
|
-
return t.defaultPrefix = n,
|
|
385
|
+
const t = h(), n = e.storagePrefix, a = t.instances.get(n);
|
|
386
|
+
if (a) {
|
|
387
|
+
const l = (i) => ({ ...i, applySink: void 0 });
|
|
388
|
+
if (x(l(a.suppliedConfig), l(e)))
|
|
389
|
+
return t.defaultPrefix = n, a.handle;
|
|
390
390
|
throw new Error(
|
|
391
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.)`
|
|
392
392
|
);
|
|
@@ -410,35 +410,35 @@ function se(e) {
|
|
|
410
410
|
l();
|
|
411
411
|
return t.lifecycleHooks.configured?.(n), f.handle;
|
|
412
412
|
}
|
|
413
|
-
function
|
|
414
|
-
const e =
|
|
413
|
+
function T() {
|
|
414
|
+
const e = h();
|
|
415
415
|
return e.defaultPrefix === null ? null : e.instances.get(e.defaultPrefix) ?? null;
|
|
416
416
|
}
|
|
417
417
|
function ae(e) {
|
|
418
|
-
const t =
|
|
418
|
+
const t = T();
|
|
419
419
|
if (t === null) {
|
|
420
|
-
const n =
|
|
420
|
+
const n = h();
|
|
421
421
|
if (n.pendingPostConfigureHooks.includes(e)) return;
|
|
422
422
|
n.pendingPostConfigureHooks.push(e);
|
|
423
423
|
return;
|
|
424
424
|
}
|
|
425
425
|
t.postConfigureHooks.includes(e) || (t.postConfigureHooks.push(e), e());
|
|
426
426
|
}
|
|
427
|
-
function
|
|
428
|
-
return
|
|
427
|
+
function j() {
|
|
428
|
+
return T()?.config ?? q;
|
|
429
429
|
}
|
|
430
430
|
function le() {
|
|
431
|
-
return [...
|
|
431
|
+
return [...h().instances.values()].map((e) => e.config);
|
|
432
432
|
}
|
|
433
433
|
function fe(e) {
|
|
434
|
-
return
|
|
434
|
+
return h().instances.get(e)?.config ?? null;
|
|
435
435
|
}
|
|
436
436
|
function ce() {
|
|
437
|
-
const e =
|
|
437
|
+
const e = h();
|
|
438
438
|
e.instances.clear(), e.defaultPrefix = null, e.pendingColorPresets = null, e.pendingPostConfigureHooks.length = 0, A().clear();
|
|
439
439
|
}
|
|
440
440
|
function A() {
|
|
441
|
-
const e =
|
|
441
|
+
const e = h();
|
|
442
442
|
return e.colorSchemeOwners || (e.colorSchemeOwners = /* @__PURE__ */ new Set()), e.colorSchemeOwners;
|
|
443
443
|
}
|
|
444
444
|
function ge(e) {
|
|
@@ -450,13 +450,13 @@ function de(e) {
|
|
|
450
450
|
function ue(e) {
|
|
451
451
|
return A().has(e);
|
|
452
452
|
}
|
|
453
|
-
function pe(e =
|
|
454
|
-
return
|
|
453
|
+
function pe(e = j()) {
|
|
454
|
+
return L(e.tabs);
|
|
455
455
|
}
|
|
456
|
-
function
|
|
456
|
+
function me(e) {
|
|
457
457
|
return e.storagePrefix + v.v2;
|
|
458
458
|
}
|
|
459
|
-
function
|
|
459
|
+
function ye(e) {
|
|
460
460
|
return e.storagePrefix + v.v3;
|
|
461
461
|
}
|
|
462
462
|
function he(e) {
|
|
@@ -495,10 +495,10 @@ function Se(e, t) {
|
|
|
495
495
|
function xe(e) {
|
|
496
496
|
return `${e.storagePrefix}-last-applied`;
|
|
497
497
|
}
|
|
498
|
-
function
|
|
498
|
+
function Te(e) {
|
|
499
499
|
return `${e.storagePrefix}:visible`;
|
|
500
500
|
}
|
|
501
|
-
function
|
|
501
|
+
function je(e) {
|
|
502
502
|
return `${e.storagePrefix}:autoload`;
|
|
503
503
|
}
|
|
504
504
|
function Oe(e) {
|
|
@@ -514,23 +514,23 @@ function Ve(e) {
|
|
|
514
514
|
function _e(e, t) {
|
|
515
515
|
return `${e.modalClassPrefix}${t}`;
|
|
516
516
|
}
|
|
517
|
-
function
|
|
517
|
+
function Ne(e) {
|
|
518
518
|
return `${e.exportFilenameBase}.json`;
|
|
519
519
|
}
|
|
520
|
-
const
|
|
521
|
-
function
|
|
520
|
+
const N = /* @__PURE__ */ Symbol.for("@takazudo/zdtp:global-alias-marker");
|
|
521
|
+
function K(e) {
|
|
522
522
|
return typeof e == "object" && e !== null || typeof e == "function";
|
|
523
523
|
}
|
|
524
524
|
function W(e) {
|
|
525
|
-
if (!
|
|
525
|
+
if (!K(e)) return !1;
|
|
526
526
|
try {
|
|
527
|
-
return e[
|
|
527
|
+
return e[N] === !0;
|
|
528
528
|
} catch {
|
|
529
529
|
return !1;
|
|
530
530
|
}
|
|
531
531
|
}
|
|
532
532
|
function Y(e) {
|
|
533
|
-
if (!
|
|
533
|
+
if (!K(e)) return !1;
|
|
534
534
|
try {
|
|
535
535
|
const t = e;
|
|
536
536
|
return typeof t.show == "function" && typeof t.hide == "function" && typeof t.toggle == "function";
|
|
@@ -538,7 +538,7 @@ function Y(e) {
|
|
|
538
538
|
return !1;
|
|
539
539
|
}
|
|
540
540
|
}
|
|
541
|
-
function
|
|
541
|
+
function Ke(e) {
|
|
542
542
|
if (typeof window > "u") return;
|
|
543
543
|
const t = window, n = t.zdtp;
|
|
544
544
|
if (n !== void 0) {
|
|
@@ -549,10 +549,10 @@ function ze(e) {
|
|
|
549
549
|
);
|
|
550
550
|
return;
|
|
551
551
|
}
|
|
552
|
-
const
|
|
553
|
-
|
|
552
|
+
const a = { ...e };
|
|
553
|
+
a[N] = !0, t.zdtp = a;
|
|
554
554
|
}
|
|
555
|
-
function
|
|
555
|
+
function ze(e) {
|
|
556
556
|
if (e === null || typeof e != "object" || Array.isArray(e))
|
|
557
557
|
throw new Error("[design-token-panel] PanelConfig must be a non-null object");
|
|
558
558
|
const t = e;
|
|
@@ -578,8 +578,8 @@ function Ne(e) {
|
|
|
578
578
|
if (t.applyRouting !== void 0) {
|
|
579
579
|
if (t.applyRouting === null || typeof t.applyRouting != "object" || Array.isArray(t.applyRouting))
|
|
580
580
|
throw new Error("[design-token-panel] PanelConfig.applyRouting must be a plain object");
|
|
581
|
-
for (const [n,
|
|
582
|
-
if (typeof
|
|
581
|
+
for (const [n, a] of Object.entries(t.applyRouting))
|
|
582
|
+
if (typeof a != "string")
|
|
583
583
|
throw new Error(
|
|
584
584
|
`[design-token-panel] PanelConfig.applyRouting[${JSON.stringify(n)}] must be a string`
|
|
585
585
|
);
|
|
@@ -588,10 +588,10 @@ function Ne(e) {
|
|
|
588
588
|
if (t.domTweaker === null || typeof t.domTweaker != "object" || Array.isArray(t.domTweaker))
|
|
589
589
|
throw new Error("[design-token-panel] PanelConfig.domTweaker must be a plain object");
|
|
590
590
|
const n = t.domTweaker;
|
|
591
|
-
for (const
|
|
592
|
-
if (
|
|
591
|
+
for (const a of Object.keys(n))
|
|
592
|
+
if (a !== "themeCss")
|
|
593
593
|
throw new Error(
|
|
594
|
-
`[design-token-panel] PanelConfig.domTweaker.${
|
|
594
|
+
`[design-token-panel] PanelConfig.domTweaker.${a} is not a supported field`
|
|
595
595
|
);
|
|
596
596
|
if (n.themeCss !== void 0) {
|
|
597
597
|
if (typeof n.themeCss != "string")
|
|
@@ -608,9 +608,9 @@ function Ne(e) {
|
|
|
608
608
|
if (t.dock === null || typeof t.dock != "object" || Array.isArray(t.dock))
|
|
609
609
|
throw new Error("[design-token-panel] PanelConfig.dock must be a plain object");
|
|
610
610
|
const n = t.dock;
|
|
611
|
-
for (const
|
|
612
|
-
if (
|
|
613
|
-
throw new Error(`[design-token-panel] PanelConfig.dock.${
|
|
611
|
+
for (const a of Object.keys(n))
|
|
612
|
+
if (a !== "reflow")
|
|
613
|
+
throw new Error(`[design-token-panel] PanelConfig.dock.${a} is not a supported field`);
|
|
614
614
|
if (n.reflow !== void 0 && n.reflow !== "body-margin" && n.reflow !== "none")
|
|
615
615
|
throw new Error(
|
|
616
616
|
'[design-token-panel] PanelConfig.dock.reflow must be "body-margin" or "none" when set'
|
|
@@ -623,10 +623,10 @@ function Ne(e) {
|
|
|
623
623
|
if (t.legacyIdRenameMap !== void 0) {
|
|
624
624
|
if (t.legacyIdRenameMap === null || typeof t.legacyIdRenameMap != "object" || Array.isArray(t.legacyIdRenameMap))
|
|
625
625
|
throw new Error("[design-token-panel] PanelConfig.legacyIdRenameMap must be a plain object");
|
|
626
|
-
for (const [n,
|
|
627
|
-
if (
|
|
626
|
+
for (const [n, a] of Object.entries(t.legacyIdRenameMap))
|
|
627
|
+
if (a !== null && typeof a != "string")
|
|
628
628
|
throw new Error(
|
|
629
|
-
`[design-token-panel] PanelConfig.legacyIdRenameMap[${JSON.stringify(n)}] must be a string or null (got ${typeof
|
|
629
|
+
`[design-token-panel] PanelConfig.legacyIdRenameMap[${JSON.stringify(n)}] must be a string or null (got ${typeof a})`
|
|
630
630
|
);
|
|
631
631
|
}
|
|
632
632
|
}
|
|
@@ -637,14 +637,14 @@ function Z(e) {
|
|
|
637
637
|
for (const n of e) {
|
|
638
638
|
if (n === null || typeof n != "object" || Array.isArray(n))
|
|
639
639
|
throw new Error("[design-token-panel] PanelConfig.tabs: each tab must be a non-null object");
|
|
640
|
-
const
|
|
641
|
-
if (typeof
|
|
640
|
+
const a = n;
|
|
641
|
+
if (typeof a.id != "string" || a.id.length === 0)
|
|
642
642
|
throw new Error("[design-token-panel] PanelConfig.tabs: each tab must have a non-empty string id");
|
|
643
|
-
if (t.has(
|
|
643
|
+
if (t.has(a.id))
|
|
644
644
|
throw new Error(
|
|
645
|
-
`[design-token-panel] PanelConfig.tabs: duplicate tab id "${
|
|
645
|
+
`[design-token-panel] PanelConfig.tabs: duplicate tab id "${a.id}"`
|
|
646
646
|
);
|
|
647
|
-
t.add(
|
|
647
|
+
t.add(a.id), Q(a.id, a, e);
|
|
648
648
|
}
|
|
649
649
|
}
|
|
650
650
|
function X(e) {
|
|
@@ -655,14 +655,14 @@ function X(e) {
|
|
|
655
655
|
const n = t.literal;
|
|
656
656
|
if (typeof n == "string") return !0;
|
|
657
657
|
if (n === null || typeof n != "object" || Array.isArray(n)) return !1;
|
|
658
|
-
const
|
|
659
|
-
return typeof
|
|
658
|
+
const a = n;
|
|
659
|
+
return typeof a.light == "string" && typeof a.dark == "string";
|
|
660
660
|
}
|
|
661
661
|
if ("ref" in t) {
|
|
662
662
|
const n = t.ref;
|
|
663
663
|
if (n === null || typeof n != "object" || Array.isArray(n)) return !1;
|
|
664
|
-
const
|
|
665
|
-
return !(typeof
|
|
664
|
+
const a = n;
|
|
665
|
+
return !(typeof a.tier != "string" || typeof a.item != "string" || a.tab !== void 0 && typeof a.tab != "string");
|
|
666
666
|
}
|
|
667
667
|
return !1;
|
|
668
668
|
}
|
|
@@ -671,7 +671,7 @@ function Q(e, t, n) {
|
|
|
671
671
|
throw new Error(
|
|
672
672
|
`[design-token-panel] PanelConfig.tabs["${e}"].tiers must be an array`
|
|
673
673
|
);
|
|
674
|
-
const
|
|
674
|
+
const a = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Map();
|
|
675
675
|
for (const s of t.tiers) {
|
|
676
676
|
if (s === null || typeof s != "object" || Array.isArray(s))
|
|
677
677
|
throw new Error(
|
|
@@ -682,11 +682,11 @@ function Q(e, t, n) {
|
|
|
682
682
|
throw new Error(
|
|
683
683
|
`[design-token-panel] PanelConfig.tabs["${e}"].tiers: each tier must have a non-empty string id`
|
|
684
684
|
);
|
|
685
|
-
if (
|
|
685
|
+
if (a.has(r.id))
|
|
686
686
|
throw new Error(
|
|
687
687
|
`[design-token-panel] PanelConfig.tabs["${e}"]: duplicate tier id "${r.id}"`
|
|
688
688
|
);
|
|
689
|
-
if (
|
|
689
|
+
if (a.add(r.id), r.semantic !== void 0 && r.semantic !== !0)
|
|
690
690
|
throw new Error(
|
|
691
691
|
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${r.id}"].semantic must be exactly \`true\` when present (got ${JSON.stringify(r.semantic)})`
|
|
692
692
|
);
|
|
@@ -716,17 +716,17 @@ function Q(e, t, n) {
|
|
|
716
716
|
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${r.id}"].items must be an array`
|
|
717
717
|
);
|
|
718
718
|
let l;
|
|
719
|
-
for (const
|
|
720
|
-
if (
|
|
721
|
-
const
|
|
722
|
-
if (
|
|
723
|
-
const
|
|
724
|
-
if (typeof
|
|
719
|
+
for (const i of r.items) {
|
|
720
|
+
if (i === null || typeof i != "object" || Array.isArray(i)) continue;
|
|
721
|
+
const c = i.type;
|
|
722
|
+
if (c === null || typeof c != "object" || Array.isArray(c)) continue;
|
|
723
|
+
const g = c.kind;
|
|
724
|
+
if (typeof g == "string") {
|
|
725
725
|
if (l === void 0)
|
|
726
|
-
l =
|
|
727
|
-
else if (l !==
|
|
726
|
+
l = g;
|
|
727
|
+
else if (l !== g)
|
|
728
728
|
throw new Error(
|
|
729
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${r.id}"]: mixed item kinds — found "${l}" and "${
|
|
729
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${r.id}"]: mixed item kinds — found "${l}" and "${g}" in the same tier (all items must share the same kind)`
|
|
730
730
|
);
|
|
731
731
|
}
|
|
732
732
|
}
|
|
@@ -740,41 +740,41 @@ function Q(e, t, n) {
|
|
|
740
740
|
throw new Error(
|
|
741
741
|
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].items: each item must be a non-null object`
|
|
742
742
|
);
|
|
743
|
-
const
|
|
744
|
-
if (typeof
|
|
743
|
+
const i = l;
|
|
744
|
+
if (typeof i.id != "string" || i.id.length === 0)
|
|
745
745
|
throw new Error(
|
|
746
746
|
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].items: each item must have a non-empty string id`
|
|
747
747
|
);
|
|
748
|
-
if (d.has(
|
|
748
|
+
if (d.has(i.id))
|
|
749
749
|
throw new Error(
|
|
750
|
-
`[design-token-panel] PanelConfig.tabs["${e}"]: duplicate item id "${
|
|
750
|
+
`[design-token-panel] PanelConfig.tabs["${e}"]: duplicate item id "${i.id}" (item ids must be unique across all tiers within a tab)`
|
|
751
751
|
);
|
|
752
|
-
if (d.add(
|
|
752
|
+
if (d.add(i.id), typeof i.cssVar != "string" || !i.cssVar.startsWith("--"))
|
|
753
753
|
throw new Error(
|
|
754
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].items["${
|
|
754
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].items["${i.id}"].cssVar must start with "--" (got ${JSON.stringify(i.cssVar)})`
|
|
755
755
|
);
|
|
756
|
-
if (
|
|
756
|
+
if (i.cssVar.length <= 2)
|
|
757
757
|
throw new Error(
|
|
758
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].items["${
|
|
758
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].items["${i.id}"].cssVar must be non-empty after "--"`
|
|
759
759
|
);
|
|
760
|
-
const
|
|
761
|
-
if (
|
|
762
|
-
const
|
|
763
|
-
if (!Array.isArray(
|
|
760
|
+
const o = i.type;
|
|
761
|
+
if (o !== null && typeof o == "object" && !Array.isArray(o) && o.kind === "length" && o.units !== void 0) {
|
|
762
|
+
const c = o.units;
|
|
763
|
+
if (!Array.isArray(c))
|
|
764
764
|
throw new Error(
|
|
765
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].items["${
|
|
765
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].items["${i.id}"].type.units must be an array`
|
|
766
766
|
);
|
|
767
|
-
const
|
|
768
|
-
for (const p of
|
|
767
|
+
const g = /* @__PURE__ */ new Set();
|
|
768
|
+
for (const p of c) {
|
|
769
769
|
if (typeof p != "string" || p.length === 0)
|
|
770
770
|
throw new Error(
|
|
771
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].items["${
|
|
771
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].items["${i.id}"].type.units entries must be non-empty strings (got ${JSON.stringify(p)})`
|
|
772
772
|
);
|
|
773
|
-
if (
|
|
773
|
+
if (g.has(p))
|
|
774
774
|
throw new Error(
|
|
775
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].items["${
|
|
775
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].items["${i.id}"].type.units: duplicate unit ${JSON.stringify(p)}`
|
|
776
776
|
);
|
|
777
|
-
|
|
777
|
+
g.add(p);
|
|
778
778
|
}
|
|
779
779
|
}
|
|
780
780
|
}
|
|
@@ -787,32 +787,32 @@ function Q(e, t, n) {
|
|
|
787
787
|
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesTier must be a string`
|
|
788
788
|
);
|
|
789
789
|
const l = r.referencesTier;
|
|
790
|
-
if (!
|
|
790
|
+
if (!a.has(l))
|
|
791
791
|
throw new Error(
|
|
792
792
|
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesTier: tier "${l}" does not exist in this tab`
|
|
793
793
|
);
|
|
794
|
-
const
|
|
795
|
-
if (
|
|
794
|
+
const i = u.get(f), o = u.get(l);
|
|
795
|
+
if (i !== void 0 && o !== void 0 && i !== "text" && i !== o)
|
|
796
796
|
throw new Error(
|
|
797
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesTier: referencing tier has kind "${
|
|
797
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesTier: referencing tier has kind "${i}" but referenced tier "${l}" has kind "${o}" (cross-kind reference is only allowed when the referencing tier has kind "text")`
|
|
798
798
|
);
|
|
799
799
|
}
|
|
800
800
|
}
|
|
801
801
|
for (const s of t.tiers) {
|
|
802
802
|
const r = s, f = r.id, l = r.preview;
|
|
803
803
|
if (l === void 0) continue;
|
|
804
|
-
const
|
|
804
|
+
const i = u.get(f), o = typeof r.referencesTier == "string" ? u.get(r.referencesTier) : void 0, c = (g) => {
|
|
805
805
|
throw new Error(
|
|
806
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].preview "${l}" requires ${
|
|
806
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].preview "${l}" requires ${g}`
|
|
807
807
|
);
|
|
808
808
|
};
|
|
809
|
-
if (l === "size" && (r.referencesTier === void 0 ?
|
|
810
|
-
|
|
811
|
-
for (const
|
|
812
|
-
if (
|
|
809
|
+
if (l === "size" && (r.referencesTier === void 0 ? i !== "length" : o !== "length") && c("a length tier or a reference tier resolving to length"), l === "line-height" && i !== "number" && c("a number tier"), l === "family" && i !== "text" && c("a text tier"), l === "weight" && i !== "select" && i !== "number" && c("a select or number tier"), (l === "bar" || l === "radius") && i !== "length" && c("a length tier"), l === "duration") {
|
|
810
|
+
i !== "length" && i !== "number" && c('a length or number tier with unit "ms" or "s"');
|
|
811
|
+
for (const g of r.items) {
|
|
812
|
+
if (g === null || typeof g != "object" || Array.isArray(g))
|
|
813
813
|
continue;
|
|
814
|
-
const p =
|
|
815
|
-
|
|
814
|
+
const p = g.type, m = p !== null && typeof p == "object" && !Array.isArray(p) ? p.unit : void 0;
|
|
815
|
+
m !== "ms" && m !== "s" && c('a length or number tier with unit "ms" or "s"');
|
|
816
816
|
}
|
|
817
817
|
}
|
|
818
818
|
}
|
|
@@ -831,26 +831,26 @@ function Q(e, t, n) {
|
|
|
831
831
|
throw new Error(
|
|
832
832
|
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesRamps is only supported on tabs with id "color" or "color-secondary" (got "${e}")`
|
|
833
833
|
);
|
|
834
|
-
const l = u.get(f),
|
|
835
|
-
for (let
|
|
836
|
-
const
|
|
837
|
-
if (
|
|
834
|
+
const l = u.get(f), i = r.referencesRamps;
|
|
835
|
+
for (let o = 0; o < i.length; o++) {
|
|
836
|
+
const c = i[o];
|
|
837
|
+
if (c === null || typeof c != "object" || Array.isArray(c))
|
|
838
838
|
throw new Error(
|
|
839
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesRamps[${
|
|
839
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesRamps[${o}] must be a non-null object`
|
|
840
840
|
);
|
|
841
|
-
const
|
|
842
|
-
if (typeof
|
|
841
|
+
const g = c;
|
|
842
|
+
if (typeof g.tier != "string" || g.tier.length === 0)
|
|
843
843
|
throw new Error(
|
|
844
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesRamps[${
|
|
844
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesRamps[${o}].tier must be a non-empty string`
|
|
845
845
|
);
|
|
846
|
-
if (
|
|
846
|
+
if (g.tab !== void 0 && (typeof g.tab != "string" || g.tab.length === 0))
|
|
847
847
|
throw new Error(
|
|
848
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesRamps[${
|
|
848
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesRamps[${o}].tab must be a non-empty string when set`
|
|
849
849
|
);
|
|
850
|
-
const p =
|
|
851
|
-
let
|
|
850
|
+
const p = g.tab === void 0 ? e : g.tab;
|
|
851
|
+
let m;
|
|
852
852
|
if (p === e)
|
|
853
|
-
|
|
853
|
+
m = t;
|
|
854
854
|
else {
|
|
855
855
|
const b = n.find(
|
|
856
856
|
(y) => y !== null && typeof y == "object" && !Array.isArray(y) && y.id === p
|
|
@@ -858,21 +858,21 @@ function Q(e, t, n) {
|
|
|
858
858
|
if (!b) {
|
|
859
859
|
const y = n.filter((w) => w !== null && typeof w == "object" && !Array.isArray(w)).map((w) => w.id).join(", ");
|
|
860
860
|
throw new Error(
|
|
861
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesRamps[${
|
|
861
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesRamps[${o}]: tab "${p}" does not exist. Available tabs: ${y}.`
|
|
862
862
|
);
|
|
863
863
|
}
|
|
864
|
-
|
|
864
|
+
m = b;
|
|
865
865
|
}
|
|
866
|
-
const C = Array.isArray(
|
|
866
|
+
const C = Array.isArray(m.tiers) ? m.tiers : [], O = [];
|
|
867
867
|
let P;
|
|
868
868
|
for (const b of C) {
|
|
869
869
|
if (b === null || typeof b != "object" || Array.isArray(b)) continue;
|
|
870
870
|
const y = b;
|
|
871
|
-
typeof y.id == "string" && (O.push(y.id), y.id ===
|
|
871
|
+
typeof y.id == "string" && (O.push(y.id), y.id === g.tier && (P = y));
|
|
872
872
|
}
|
|
873
873
|
if (!P)
|
|
874
874
|
throw new Error(
|
|
875
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesRamps[${
|
|
875
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesRamps[${o}]: tier "${g.tier}" does not exist in tab "${p}". Available tiers: ${O.join(", ")}.`
|
|
876
876
|
);
|
|
877
877
|
if (l !== void 0) {
|
|
878
878
|
const b = Array.isArray(P.items) ? P.items : [];
|
|
@@ -889,26 +889,61 @@ function Q(e, t, n) {
|
|
|
889
889
|
}
|
|
890
890
|
if (y !== void 0 && l !== y)
|
|
891
891
|
throw new Error(
|
|
892
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesRamps[${
|
|
892
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesRamps[${o}]: referencing semantic tier has kind "${l}" but target tier "${g.tier}" in tab "${p}" has kind "${y}" (cross-tab ramp sources must share the semantic tier's kind)`
|
|
893
893
|
);
|
|
894
894
|
}
|
|
895
895
|
}
|
|
896
896
|
}
|
|
897
|
+
if (e === "palette") {
|
|
898
|
+
if (t.colorExtras !== void 0)
|
|
899
|
+
throw new Error(
|
|
900
|
+
'[design-token-panel] PanelConfig.tabs["palette"].colorExtras must be absent — multiple kind:"color" tiers are only safe when resolveColorClusterFromTab is not invoked'
|
|
901
|
+
);
|
|
902
|
+
for (const s of t.tiers) {
|
|
903
|
+
const r = s.items, f = `[design-token-panel] PanelConfig.tabs["palette"].tiers["${s.id}"]`;
|
|
904
|
+
if (r.length === 0)
|
|
905
|
+
throw new Error(`${f}.items must be non-empty`);
|
|
906
|
+
for (const [o, c] of r.entries())
|
|
907
|
+
if (c.type.kind !== "color")
|
|
908
|
+
throw new Error(`${f}.items[${o}].type.kind must be "color"`);
|
|
909
|
+
const l = r[0].cssVar, i = l.replace(/\d+$/, "{n}");
|
|
910
|
+
if (i.includes("{n}")) {
|
|
911
|
+
const o = Number(l.match(/\d+$/)[0]);
|
|
912
|
+
for (const [c, g] of r.entries()) {
|
|
913
|
+
const p = i.replace("{n}", String(o + c));
|
|
914
|
+
if (!Number.isSafeInteger(o + c) || g.cssVar !== p)
|
|
915
|
+
throw new Error(
|
|
916
|
+
`${f}.items[${c}].cssVar is ${JSON.stringify(g.cssVar)} but expected ${JSON.stringify(p)} — palette item cssVars must share one prefix and be numbered consecutively in tier order`
|
|
917
|
+
);
|
|
918
|
+
}
|
|
919
|
+
} else {
|
|
920
|
+
const o = l.slice(0, l.lastIndexOf("-") + 1), c = /* @__PURE__ */ new Set();
|
|
921
|
+
for (const [g, p] of r.entries()) {
|
|
922
|
+
const m = p.cssVar;
|
|
923
|
+
if (r.length > 1 && o === "--" || !m.startsWith(o) || m.length === o.length || /\d+$/.test(m) || c.has(m))
|
|
924
|
+
throw new Error(
|
|
925
|
+
`${f}.items[${g}].cssVar ${JSON.stringify(m)} — named palette item cssVars must share one prefix and have unique non-numbered suffixes`
|
|
926
|
+
);
|
|
927
|
+
c.add(m);
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
}
|
|
897
932
|
if (t.colorExtras !== void 0) {
|
|
898
933
|
const s = t.colorExtras;
|
|
899
934
|
if (s === null || typeof s != "object" || Array.isArray(s))
|
|
900
935
|
throw new Error(
|
|
901
936
|
`[design-token-panel] PanelConfig.tabs["${e}"].colorExtras must be a plain object`
|
|
902
937
|
);
|
|
903
|
-
for (const
|
|
904
|
-
if (typeof s[
|
|
938
|
+
for (const i of ["id", "defaultShikiTheme"])
|
|
939
|
+
if (typeof s[i] != "string" || s[i].length === 0)
|
|
905
940
|
throw new Error(
|
|
906
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].colorExtras.${
|
|
941
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].colorExtras.${i} must be a non-empty string (got ${typeof s[i]})`
|
|
907
942
|
);
|
|
908
|
-
for (const
|
|
909
|
-
if (s[
|
|
943
|
+
for (const i of ["colorSchemes", "baseRoles", "baseDefaults"])
|
|
944
|
+
if (s[i] === void 0 || s[i] === null || typeof s[i] != "object" || Array.isArray(s[i]))
|
|
910
945
|
throw new Error(
|
|
911
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].colorExtras.${
|
|
946
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].colorExtras.${i} must be a plain object`
|
|
912
947
|
);
|
|
913
948
|
if (s.panelSettings === void 0 || s.panelSettings === null || typeof s.panelSettings != "object" || Array.isArray(s.panelSettings))
|
|
914
949
|
throw new Error(
|
|
@@ -924,15 +959,15 @@ function Q(e, t, n) {
|
|
|
924
959
|
throw new Error(
|
|
925
960
|
`[design-token-panel] PanelConfig.tabs["${e}"].colorExtras.panelSettings.colorMode must be false or a plain object`
|
|
926
961
|
);
|
|
927
|
-
const
|
|
928
|
-
for (const
|
|
929
|
-
if (typeof o
|
|
962
|
+
const i = r.colorMode;
|
|
963
|
+
for (const o of ["lightScheme", "darkScheme"])
|
|
964
|
+
if (typeof i[o] != "string" || i[o].length === 0)
|
|
930
965
|
throw new Error(
|
|
931
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].colorExtras.panelSettings.colorMode.${
|
|
966
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].colorExtras.panelSettings.colorMode.${o} must be a non-empty string`
|
|
932
967
|
);
|
|
933
|
-
if (
|
|
968
|
+
if (i.defaultMode !== "light" && i.defaultMode !== "dark")
|
|
934
969
|
throw new Error(
|
|
935
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].colorExtras.panelSettings.colorMode.defaultMode must be "light" or "dark" (got ${JSON.stringify(
|
|
970
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].colorExtras.panelSettings.colorMode.defaultMode must be "light" or "dark" (got ${JSON.stringify(i.defaultMode)})`
|
|
936
971
|
);
|
|
937
972
|
}
|
|
938
973
|
if (s.semanticDefaults !== void 0) {
|
|
@@ -940,37 +975,37 @@ function Q(e, t, n) {
|
|
|
940
975
|
throw new Error(
|
|
941
976
|
`[design-token-panel] PanelConfig.tabs["${e}"].colorExtras.semanticDefaults must be a plain object`
|
|
942
977
|
);
|
|
943
|
-
const
|
|
944
|
-
for (const [
|
|
945
|
-
if (!X(
|
|
978
|
+
const i = s.semanticDefaults;
|
|
979
|
+
for (const [o, c] of Object.entries(i))
|
|
980
|
+
if (!X(c))
|
|
946
981
|
throw new Error(
|
|
947
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].colorExtras.semanticDefaults["${
|
|
982
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].colorExtras.semanticDefaults["${o}"] must be a valid SemanticValue (number | 'bg' | 'fg' | { literal: string } | { literal: { light, dark } } | { ref: { tier, item, tab? } }), got ${JSON.stringify(c)}`
|
|
948
983
|
);
|
|
949
984
|
}
|
|
950
|
-
const l = t.tiers.find((
|
|
951
|
-
if (
|
|
952
|
-
const
|
|
953
|
-
if (!Array.isArray(
|
|
954
|
-
const
|
|
955
|
-
if (
|
|
956
|
-
const
|
|
957
|
-
return
|
|
985
|
+
const l = t.tiers.find((i) => {
|
|
986
|
+
if (i.referencesTier !== void 0 || i.semantic === !0) return !1;
|
|
987
|
+
const o = i.items;
|
|
988
|
+
if (!Array.isArray(o) || o.length === 0) return !1;
|
|
989
|
+
const c = o[0];
|
|
990
|
+
if (c === null || typeof c != "object" || Array.isArray(c)) return !1;
|
|
991
|
+
const g = c.type;
|
|
992
|
+
return g === null || typeof g != "object" || Array.isArray(g) ? !1 : g.kind === "color";
|
|
958
993
|
});
|
|
959
994
|
if (l) {
|
|
960
|
-
const
|
|
961
|
-
if (
|
|
962
|
-
const
|
|
963
|
-
if (
|
|
964
|
-
for (let p = 0; p <
|
|
965
|
-
const
|
|
966
|
-
if (
|
|
995
|
+
const i = l.id, o = l.items, c = o[0]?.cssVar;
|
|
996
|
+
if (c !== void 0) {
|
|
997
|
+
const g = c.replace(/\d+$/, "{n}");
|
|
998
|
+
if (g.includes("{n}"))
|
|
999
|
+
for (let p = 0; p < o.length; p++) {
|
|
1000
|
+
const m = o[p], C = g.replace("{n}", String(p));
|
|
1001
|
+
if (m.cssVar !== C)
|
|
967
1002
|
throw new Error(
|
|
968
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
1003
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${i}"].items[${p}].cssVar is ${JSON.stringify(m.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(g)})`
|
|
969
1004
|
);
|
|
970
1005
|
}
|
|
971
|
-
else if (
|
|
1006
|
+
else if (o.length > 1)
|
|
972
1007
|
throw new Error(
|
|
973
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
1008
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${i}"].items[0].cssVar ${JSON.stringify(c)} 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")`
|
|
974
1009
|
);
|
|
975
1010
|
}
|
|
976
1011
|
}
|
|
@@ -999,16 +1034,16 @@ function Q(e, t, n) {
|
|
|
999
1034
|
`[design-token-panel] PanelConfig.tabs["${e}"].notesExtras must only be set on a tab with id "notes"`
|
|
1000
1035
|
);
|
|
1001
1036
|
}
|
|
1002
|
-
function I(e =
|
|
1037
|
+
function I(e = j()) {
|
|
1003
1038
|
return e.applyRouting ?? {};
|
|
1004
1039
|
}
|
|
1005
|
-
function Me(e =
|
|
1040
|
+
function Me(e = j()) {
|
|
1006
1041
|
return !!e.applyEndpoint && Object.keys(I(e)).length > 0;
|
|
1007
1042
|
}
|
|
1008
1043
|
function De(e) {
|
|
1009
|
-
const t =
|
|
1044
|
+
const t = T();
|
|
1010
1045
|
if (t === null) {
|
|
1011
|
-
|
|
1046
|
+
h().pendingColorPresets = e;
|
|
1012
1047
|
return;
|
|
1013
1048
|
}
|
|
1014
1049
|
t.config = { ...t.config, colorPresets: e };
|
|
@@ -1017,14 +1052,14 @@ export {
|
|
|
1017
1052
|
D as A,
|
|
1018
1053
|
_ as B,
|
|
1019
1054
|
x as C,
|
|
1020
|
-
|
|
1055
|
+
Ne as D,
|
|
1021
1056
|
I as E,
|
|
1022
1057
|
Me as F,
|
|
1023
1058
|
xe as G,
|
|
1024
1059
|
Se as H,
|
|
1025
1060
|
Ae as I,
|
|
1026
1061
|
Ve as J,
|
|
1027
|
-
|
|
1062
|
+
oe as K,
|
|
1028
1063
|
ae as L,
|
|
1029
1064
|
Re as M,
|
|
1030
1065
|
le as N,
|
|
@@ -1032,24 +1067,24 @@ export {
|
|
|
1032
1067
|
Oe as P,
|
|
1033
1068
|
be as Q,
|
|
1034
1069
|
ce as _,
|
|
1035
|
-
|
|
1036
|
-
|
|
1070
|
+
Te as a,
|
|
1071
|
+
ze as b,
|
|
1037
1072
|
se as c,
|
|
1038
1073
|
ke as d,
|
|
1039
1074
|
$e as e,
|
|
1040
1075
|
we as f,
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1076
|
+
j as g,
|
|
1077
|
+
me as h,
|
|
1078
|
+
Ke as i,
|
|
1079
|
+
je as j,
|
|
1045
1080
|
he as k,
|
|
1046
|
-
|
|
1081
|
+
ye as l,
|
|
1047
1082
|
_e as m,
|
|
1048
1083
|
de as n,
|
|
1049
1084
|
pe as o,
|
|
1050
1085
|
te as p,
|
|
1051
1086
|
ne as q,
|
|
1052
|
-
|
|
1087
|
+
ie as r,
|
|
1053
1088
|
De as s,
|
|
1054
1089
|
Ce as t,
|
|
1055
1090
|
ve as u,
|