@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.
Files changed (107) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/PORTABLE-CONTRACT.md +18 -0
  3. package/dist/apply/build-apply-overrides.d.ts +2 -2
  4. package/dist/apply/last-applied.d.ts +1 -1
  5. package/dist/apply/reconcile-applied.d.ts +2 -2
  6. package/dist/apply/route-tokens-to-files.d.ts +1 -1
  7. package/dist/apply/tier-resolver.d.ts +1 -1
  8. package/dist/apply-modal.d.ts +2 -2
  9. package/dist/astro/host-adapter.js +3 -3
  10. package/dist/astro/index.d.ts +8 -8
  11. package/dist/astro/index.js +1 -1
  12. package/dist/{autoload-state-BI4-9A58.js → autoload-state-CGnis85c.js} +1 -1
  13. package/dist/bulk/bulk-actions.d.ts +3 -3
  14. package/dist/bulk/index.d.ts +2 -2
  15. package/dist/chain/index.d.ts +2 -2
  16. package/dist/chain/token-chain-context.d.ts +3 -3
  17. package/dist/chain/token-chain-popover.d.ts +2 -2
  18. package/dist/changed/contribution.d.ts +5 -5
  19. package/dist/changed/footer-content.d.ts +4 -4
  20. package/dist/changed/index.d.ts +4 -4
  21. package/dist/components/color-picker/color-field.d.ts +1 -1
  22. package/dist/components/color-picker/index.d.ts +2 -2
  23. package/dist/components/palette-chart/index.d.ts +2 -2
  24. package/dist/components/palette-chart/palette-chart.d.ts +4 -4
  25. package/dist/config/cluster-config.d.ts +4 -4
  26. package/dist/config/color-scheme-utils.d.ts +1 -1
  27. package/dist/config/panel-config.d.ts +5 -5
  28. package/dist/controls/tier-ref-selector.d.ts +1 -1
  29. package/dist/dom-tweaker/dom-tweaker-diff-action-link.d.ts +1 -1
  30. package/dist/dom-tweaker/dom-tweaker-orchestrator.d.ts +1 -1
  31. package/dist/dom-tweaker/dom-tweaker-state.d.ts +1 -1
  32. package/dist/dom-tweaker/lazy/class-editor-popup.d.ts +1 -1
  33. package/dist/dom-tweaker/lazy/diff-export-modal.d.ts +1 -1
  34. package/dist/dom-tweaker/lazy/index.d.ts +2 -2
  35. package/dist/element-inspect/element-inspect-context.d.ts +1 -1
  36. package/dist/element-inspect/element-inspect-orchestrator.d.ts +3 -3
  37. package/dist/element-inspect/element-inspect-overlay.d.ts +1 -1
  38. package/dist/element-inspect/find-tokens-for-element.d.ts +1 -1
  39. package/dist/element-inspect/index.d.ts +8 -8
  40. package/dist/element-path/element-path-state.d.ts +1 -1
  41. package/dist/element-path/index.d.ts +7 -7
  42. package/dist/export-modal.d.ts +2 -2
  43. package/dist/highlight/highlight-orchestrator.d.ts +2 -2
  44. package/dist/highlight/highlight-state.d.ts +1 -1
  45. package/dist/highlight/highlight-toggle-button.d.ts +2 -2
  46. package/dist/history/buttons.d.ts +1 -1
  47. package/dist/history/index.d.ts +3 -3
  48. package/dist/history/rail.d.ts +2 -2
  49. package/dist/history/snapshots.d.ts +2 -2
  50. package/dist/import-modal.d.ts +2 -2
  51. package/dist/{index-ChsJ5u4d.js → index-DWs1XPfy.js} +993 -993
  52. package/dist/{index-CAQf4HKm.js → index-LYsbHWcy.js} +2 -2
  53. package/dist/index.d.ts +14 -14
  54. package/dist/index.js +14 -13
  55. package/dist/{panel-config-CqbuB0nh.js → panel-config-Crn5QJGy.js} +243 -208
  56. package/dist/panel.d.ts +2 -2
  57. package/dist/picker/index.d.ts +4 -4
  58. package/dist/search/command-palette.d.ts +3 -3
  59. package/dist/search/contribution.d.ts +1 -1
  60. package/dist/search/index.d.ts +4 -4
  61. package/dist/search/match-bar.d.ts +1 -1
  62. package/dist/search/token-search.d.ts +3 -3
  63. package/dist/server/create-apply-handler.d.ts +2 -2
  64. package/dist/server/index.d.ts +6 -6
  65. package/dist/shell/dock-mode-switch.d.ts +1 -1
  66. package/dist/shell/regions.d.ts +1 -1
  67. package/dist/shell/tab-bar.d.ts +1 -1
  68. package/dist/shell/tab-overflow-popover.d.ts +1 -1
  69. package/dist/specimen/on-page-specimen.d.ts +3 -3
  70. package/dist/specimen/preview-glyphs.d.ts +1 -1
  71. package/dist/specimen/specimen-state.d.ts +1 -1
  72. package/dist/specimen/specimen-tab-body.d.ts +5 -5
  73. package/dist/specimen/specimen-toolbar.d.ts +1 -1
  74. package/dist/specimen/specimen-values.d.ts +1 -1
  75. package/dist/state/autoload-state.d.ts +1 -1
  76. package/dist/state/history.d.ts +1 -1
  77. package/dist/state/persist.d.ts +3 -3
  78. package/dist/state/transaction.d.ts +3 -3
  79. package/dist/state/tweak-state.d.ts +12 -12
  80. package/dist/tabs/_generic-item-editor.d.ts +1 -1
  81. package/dist/tabs/color-tab.d.ts +6 -6
  82. package/dist/tabs/flat/flat-tab.d.ts +5 -5
  83. package/dist/tabs/flat/index.d.ts +8 -8
  84. package/dist/tabs/flat/scroll-to-token-row.d.ts +1 -1
  85. package/dist/tabs/flat/tier-section.d.ts +3 -3
  86. package/dist/tabs/flat/token-controller.d.ts +1 -1
  87. package/dist/tabs/flat/token-row.d.ts +2 -2
  88. package/dist/tabs/flat/types.d.ts +1 -1
  89. package/dist/tabs/font-tab.d.ts +6 -6
  90. package/dist/tabs/generic-tab.d.ts +4 -4
  91. package/dist/tabs/notes-tab.d.ts +1 -1
  92. package/dist/tabs/palette/palette-check-view.d.ts +3 -3
  93. package/dist/tabs/palette/palette-edit-view.d.ts +3 -3
  94. package/dist/tabs/palette/palette-readout.d.ts +1 -1
  95. package/dist/tabs/palette/palette-tab.d.ts +3 -3
  96. package/dist/tabs/size-tab.d.ts +5 -5
  97. package/dist/tabs/spacing-tab.d.ts +5 -5
  98. package/dist/testing.d.ts +6 -6
  99. package/dist/testing.js +16 -15
  100. package/dist/tokens/tier-model.d.ts +2 -2
  101. package/dist/{tweak-state-c53KtLHq.js → tweak-state-Dzr5kDhX.js} +210 -207
  102. package/dist/utils/color-oklch.d.ts +2 -2
  103. package/dist/utils/design-token-serde.d.ts +2 -2
  104. package/dist/utils/token-diff.d.ts +3 -3
  105. package/dist/utils/token-graph.d.ts +4 -4
  106. package/dist/utils/token-index.d.ts +2 -2
  107. package/package.json +4 -4
@@ -1,4 +1,4 @@
1
- import { DEFAULT_STORAGE_PREFIX as N, resolveToggleEventName as M, READABLE_STATE_KEY_SUFFIXES as v } from "./constants.js";
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, i) {
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 = i[t]?.[n];
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 a = $(l, r ?? n);
32
- if (!a) {
33
- const g = $(l, d.default) ?? $(l, n) ?? l.items[0];
34
- if (!g)
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: g.cssVar };
38
+ return { kind: "ref", targetCssVar: c.cssVar };
39
39
  }
40
- return { kind: "ref", targetCssVar: a.cssVar };
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 i = e.tab === void 0 || e.tab === t.id ? t : n.find((s) => s.id === e.tab);
49
- if (!i)
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(i, e.tier);
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 "${i.id}". Available tiers: ${i.tiers.map((s) => s.id).join(", ")}.`
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 "${i.id}". Available items: ${u.items.map((s) => s.id).join(", ")}.`
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 L(e, t, n, i) {
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((o) => o.tier === r);
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, i), { ref: r };
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, i, u, d) {
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) ? L(e.default, n, i, u) : d ? (console.warn(
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 i = e.tiers.find(
253
- (a) => !a.referencesTier && !a.semantic && a.items.length > 0 && a.items[0].type.kind === "color"
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
- (a) => i && a.referencesTier === i.id || a.semantic === !0
255
+ (o) => a && o.referencesTier === a.id || o.semantic === !0
256
256
  );
257
- if (!i && !u)
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 = 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 = {};
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 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] : F(
279
- c,
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
- a
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: o,
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 oe(e) {
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 J(e) {
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), i = Object.keys(t);
321
- if (n.length !== i.length) return !1;
322
- const u = new Set(i);
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: N,
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 m() {
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
- m().lifecycleHooks.open?.(e);
357
+ h().lifecycleHooks.open?.(e);
358
358
  },
359
359
  close() {
360
- m().lifecycleHooks.close?.(e);
360
+ h().lifecycleHooks.close?.(e);
361
361
  },
362
362
  toggle() {
363
- m().lifecycleHooks.toggle?.(e);
363
+ h().lifecycleHooks.toggle?.(e);
364
364
  },
365
365
  destroy() {
366
- m().lifecycleHooks.destroy?.(e);
367
- const t = m();
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 ie(e) {
376
- m().lifecycleHooks = {
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 = m(), n = e.storagePrefix, i = t.instances.get(n);
386
- if (i) {
387
- const l = (o) => ({ ...o, applySink: void 0 });
388
- if (x(l(i.suppliedConfig), l(e)))
389
- return t.defaultPrefix = n, i.handle;
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 j() {
414
- const e = m();
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 = j();
418
+ const t = T();
419
419
  if (t === null) {
420
- const n = m();
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 T() {
428
- return j()?.config ?? q;
427
+ function j() {
428
+ return T()?.config ?? q;
429
429
  }
430
430
  function le() {
431
- return [...m().instances.values()].map((e) => e.config);
431
+ return [...h().instances.values()].map((e) => e.config);
432
432
  }
433
433
  function fe(e) {
434
- return m().instances.get(e)?.config ?? null;
434
+ return h().instances.get(e)?.config ?? null;
435
435
  }
436
436
  function ce() {
437
- const e = m();
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 = m();
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 = T()) {
454
- return J(e.tabs);
453
+ function pe(e = j()) {
454
+ return L(e.tabs);
455
455
  }
456
- function ye(e) {
456
+ function me(e) {
457
457
  return e.storagePrefix + v.v2;
458
458
  }
459
- function me(e) {
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 je(e) {
498
+ function Te(e) {
499
499
  return `${e.storagePrefix}:visible`;
500
500
  }
501
- function Te(e) {
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 Ke(e) {
517
+ function Ne(e) {
518
518
  return `${e.exportFilenameBase}.json`;
519
519
  }
520
- const K = /* @__PURE__ */ Symbol.for("@takazudo/zdtp:global-alias-marker");
521
- function z(e) {
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 (!z(e)) return !1;
525
+ if (!K(e)) return !1;
526
526
  try {
527
- return e[K] === !0;
527
+ return e[N] === !0;
528
528
  } catch {
529
529
  return !1;
530
530
  }
531
531
  }
532
532
  function Y(e) {
533
- if (!z(e)) return !1;
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 ze(e) {
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 i = { ...e };
553
- i[K] = !0, t.zdtp = i;
552
+ const a = { ...e };
553
+ a[N] = !0, t.zdtp = a;
554
554
  }
555
- function Ne(e) {
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, i] of Object.entries(t.applyRouting))
582
- if (typeof i != "string")
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 i of Object.keys(n))
592
- if (i !== "themeCss")
591
+ for (const a of Object.keys(n))
592
+ if (a !== "themeCss")
593
593
  throw new Error(
594
- `[design-token-panel] PanelConfig.domTweaker.${i} is not a supported field`
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 i of Object.keys(n))
612
- if (i !== "reflow")
613
- throw new Error(`[design-token-panel] PanelConfig.dock.${i} is not a supported field`);
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, i] of Object.entries(t.legacyIdRenameMap))
627
- if (i !== null && typeof i != "string")
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 i})`
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 i = n;
641
- if (typeof i.id != "string" || i.id.length === 0)
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(i.id))
643
+ if (t.has(a.id))
644
644
  throw new Error(
645
- `[design-token-panel] PanelConfig.tabs: duplicate tab id "${i.id}"`
645
+ `[design-token-panel] PanelConfig.tabs: duplicate tab id "${a.id}"`
646
646
  );
647
- t.add(i.id), Q(i.id, i, e);
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 i = n;
659
- return typeof i.light == "string" && typeof i.dark == "string";
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 i = n;
665
- return !(typeof i.tier != "string" || typeof i.item != "string" || i.tab !== void 0 && typeof i.tab != "string");
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 i = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Map();
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 (i.has(r.id))
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 (i.add(r.id), r.semantic !== void 0 && r.semantic !== !0)
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 o of r.items) {
720
- if (o === null || typeof o != "object" || Array.isArray(o)) continue;
721
- const g = o.type;
722
- if (g === null || typeof g != "object" || Array.isArray(g)) continue;
723
- const c = g.kind;
724
- if (typeof c == "string") {
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 = c;
727
- else if (l !== c)
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 "${c}" in the same tier (all items must share the same kind)`
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 o = l;
744
- if (typeof o.id != "string" || o.id.length === 0)
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(o.id))
748
+ if (d.has(i.id))
749
749
  throw new Error(
750
- `[design-token-panel] PanelConfig.tabs["${e}"]: duplicate item id "${o.id}" (item ids must be unique across all tiers within a tab)`
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(o.id), typeof o.cssVar != "string" || !o.cssVar.startsWith("--"))
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["${o.id}"].cssVar must start with "--" (got ${JSON.stringify(o.cssVar)})`
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 (o.cssVar.length <= 2)
756
+ if (i.cssVar.length <= 2)
757
757
  throw new Error(
758
- `[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].items["${o.id}"].cssVar must be non-empty after "--"`
758
+ `[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].items["${i.id}"].cssVar must be non-empty after "--"`
759
759
  );
760
- const a = o.type;
761
- if (a !== null && typeof a == "object" && !Array.isArray(a) && a.kind === "length" && a.units !== void 0) {
762
- const g = a.units;
763
- if (!Array.isArray(g))
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["${o.id}"].type.units must be an array`
765
+ `[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].items["${i.id}"].type.units must be an array`
766
766
  );
767
- const c = /* @__PURE__ */ new Set();
768
- for (const p of g) {
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["${o.id}"].type.units entries must be non-empty strings (got ${JSON.stringify(p)})`
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 (c.has(p))
773
+ if (g.has(p))
774
774
  throw new Error(
775
- `[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].items["${o.id}"].type.units: duplicate unit ${JSON.stringify(p)}`
775
+ `[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].items["${i.id}"].type.units: duplicate unit ${JSON.stringify(p)}`
776
776
  );
777
- c.add(p);
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 (!i.has(l))
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 o = u.get(f), a = u.get(l);
795
- if (o !== void 0 && a !== void 0 && o !== "text" && o !== a)
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 "${o}" but referenced tier "${l}" has kind "${a}" (cross-kind reference is only allowed when the referencing tier has kind "text")`
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 o = u.get(f), a = typeof r.referencesTier == "string" ? u.get(r.referencesTier) : void 0, g = (c) => {
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 ${c}`
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 ? 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") {
810
- o !== "length" && o !== "number" && g('a length or number tier with unit "ms" or "s"');
811
- for (const c of r.items) {
812
- if (c === null || typeof c != "object" || Array.isArray(c))
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 = c.type, h = p !== null && typeof p == "object" && !Array.isArray(p) ? p.unit : void 0;
815
- h !== "ms" && h !== "s" && g('a length or number tier with unit "ms" or "s"');
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), o = r.referencesRamps;
835
- for (let a = 0; a < o.length; a++) {
836
- const g = o[a];
837
- if (g === null || typeof g != "object" || Array.isArray(g))
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[${a}] must be a non-null object`
839
+ `[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesRamps[${o}] must be a non-null object`
840
840
  );
841
- const c = g;
842
- if (typeof c.tier != "string" || c.tier.length === 0)
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[${a}].tier must be a non-empty string`
844
+ `[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesRamps[${o}].tier must be a non-empty string`
845
845
  );
846
- if (c.tab !== void 0 && (typeof c.tab != "string" || c.tab.length === 0))
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[${a}].tab must be a non-empty string when set`
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 = c.tab === void 0 ? e : c.tab;
851
- let h;
850
+ const p = g.tab === void 0 ? e : g.tab;
851
+ let m;
852
852
  if (p === e)
853
- h = t;
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[${a}]: tab "${p}" does not exist. Available tabs: ${y}.`
861
+ `[design-token-panel] PanelConfig.tabs["${e}"].tiers["${f}"].referencesRamps[${o}]: tab "${p}" does not exist. Available tabs: ${y}.`
862
862
  );
863
863
  }
864
- h = b;
864
+ m = b;
865
865
  }
866
- const C = Array.isArray(h.tiers) ? h.tiers : [], O = [];
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 === c.tier && (P = y));
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[${a}]: tier "${c.tier}" does not exist in tab "${p}". Available tiers: ${O.join(", ")}.`
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[${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)`
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 o of ["id", "defaultShikiTheme"])
904
- if (typeof s[o] != "string" || s[o].length === 0)
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.${o} must be a non-empty string (got ${typeof s[o]})`
941
+ `[design-token-panel] PanelConfig.tabs["${e}"].colorExtras.${i} must be a non-empty string (got ${typeof s[i]})`
907
942
  );
908
- for (const o of ["colorSchemes", "baseRoles", "baseDefaults"])
909
- if (s[o] === void 0 || s[o] === null || typeof s[o] != "object" || Array.isArray(s[o]))
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.${o} must be a plain object`
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 o = r.colorMode;
928
- for (const a of ["lightScheme", "darkScheme"])
929
- if (typeof o[a] != "string" || o[a].length === 0)
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.${a} must be a non-empty string`
966
+ `[design-token-panel] PanelConfig.tabs["${e}"].colorExtras.panelSettings.colorMode.${o} must be a non-empty string`
932
967
  );
933
- if (o.defaultMode !== "light" && o.defaultMode !== "dark")
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(o.defaultMode)})`
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 o = s.semanticDefaults;
944
- for (const [a, g] of Object.entries(o))
945
- if (!X(g))
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["${a}"] must be a valid SemanticValue (number | 'bg' | 'fg' | { literal: string } | { literal: { light, dark } } | { ref: { tier, item, tab? } }), got ${JSON.stringify(g)}`
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((o) => {
951
- if (o.referencesTier !== void 0 || o.semantic === !0) return !1;
952
- const a = o.items;
953
- if (!Array.isArray(a) || a.length === 0) return !1;
954
- const g = a[0];
955
- if (g === null || typeof g != "object" || Array.isArray(g)) return !1;
956
- const c = g.type;
957
- return c === null || typeof c != "object" || Array.isArray(c) ? !1 : c.kind === "color";
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 o = l.id, a = l.items, g = a[0]?.cssVar;
961
- if (g !== void 0) {
962
- const c = g.replace(/\d+$/, "{n}");
963
- if (c.includes("{n}"))
964
- for (let p = 0; p < a.length; p++) {
965
- const h = a[p], C = c.replace("{n}", String(p));
966
- if (h.cssVar !== C)
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["${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)})`
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 (a.length > 1)
1006
+ else if (o.length > 1)
972
1007
  throw new Error(
973
- `[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")`
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 = T()) {
1037
+ function I(e = j()) {
1003
1038
  return e.applyRouting ?? {};
1004
1039
  }
1005
- function Me(e = T()) {
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 = j();
1044
+ const t = T();
1010
1045
  if (t === null) {
1011
- m().pendingColorPresets = e;
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
- Ke as D,
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
- ie as K,
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
- je as a,
1036
- Ne as b,
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
- T as g,
1042
- ye as h,
1043
- ze as i,
1044
- Te as j,
1076
+ j as g,
1077
+ me as h,
1078
+ Ke as i,
1079
+ je as j,
1045
1080
  he as k,
1046
- me as l,
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
- oe as r,
1087
+ ie as r,
1053
1088
  De as s,
1054
1089
  Ce as t,
1055
1090
  ve as u,