@takazudo/zdtp 0.4.13 → 0.4.14

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 CHANGED
@@ -4,6 +4,17 @@ All notable changes to `@takazudo/zdtp` are documented in this file.
4
4
 
5
5
  The format is based on Keep a Changelog, and release notes are generated from the changelog MDX pages.
6
6
 
7
+ ## [0.4.14] - 2026-08-29
8
+
9
+ ### Fixed
10
+
11
+ - fix(zdtp): silence compatible global alias warning (2630d84)
12
+
13
+ ### Other Changes
14
+
15
+ - test(zdtp): cover partial global alias shape (6314a7f)
16
+ - Merge pull request [#647](https://github.com/Takazudo/zudo-design-token-panel/pull/647) from Takazudo/fix/646-compatible-zdtp-alias: fix(zdtp): silence warnings for compatible global aliases (44f6ca4)
17
+
7
18
  ## [0.4.13] - 2026-08-29
8
19
 
9
20
  ### Features
@@ -1104,11 +1104,12 @@ window.zdtp.toggle = () => void | Promise<void>; // toggle the panel
1104
1104
  always installs first ("first install wins" — see the next point). The
1105
1105
  package-root install site is therefore reached only by non-Astro hosts.
1106
1106
  - **Never clobbers a host-defined `window.zdtp`.** If `window.zdtp` already
1107
- exists and was not installed by this package, the install is skipped with
1108
- a `console.warn` — the host's own global is left untouched. (This also
1109
- covers the edge case of a host that picks `consoleNamespace: 'zdtp'`: the
1110
- namespace object installed at §6.4 is not this package's alias marker, so
1111
- the second install site treats it as host-owned and skips.)
1107
+ exposes callable `show` / `hide` / `toggle` methods, the install is skipped
1108
+ silently — this supports hosts that pre-claim the alias before lazily loading
1109
+ the panel bundle. Other pre-existing values are also left untouched, but
1110
+ produce a `console.warn`. (This includes the edge case of a host that picks
1111
+ `consoleNamespace: 'zdtp'`: the namespace object installed at §6.4 does not
1112
+ expose the fixed-name alias shape, so the second install site warns and skips.)
1112
1113
  - **Auto-remember carries over for free.** `zdtp.show()` routes through the
1113
1114
  same `showDesignTokenPanel()` / `handle.open()` core as every other open
1114
1115
  path, so it arms `${storagePrefix}:autoload = 'auto'` exactly like
package/README.md CHANGED
@@ -1053,7 +1053,7 @@ zdtp.toggle(); // toggle open/closed
1053
1053
  - **Available on both integration paths:**
1054
1054
  - Non-Astro hosts get it as soon as `@takazudo/zdtp`'s package-root module has loaded (it installs the alias at module init).
1055
1055
  - Astro hosts get it as soon as the host-adapter `<script>` has run — **before** the panel bundle itself has loaded. The first `zdtp.*` call lazy-imports the bundle, exactly like `window[consoleNamespace].*`.
1056
- - **Never clobbers a host-defined `window.zdtp`.** If your page already has its own `window.zdtp` for something unrelated, the package leaves it alone and logs a `console.warn` instead of overwriting it — including the edge case of choosing `consoleNamespace: 'zdtp'` yourself.
1056
+ - **Never clobbers a host-defined `window.zdtp`.** If the existing value exposes callable `show`, `hide`, and `toggle` methods, the package treats it as an intentional host alias and stays silent — enabling hosts to pre-claim the alias before lazily loading the panel bundle. Other existing values are still left untouched and produce a `console.warn`, including the edge case of choosing `consoleNamespace: 'zdtp'` yourself.
1057
1057
  - **Auto-remember applies too** — `zdtp.show()` arms the `:autoload` flag with `'auto'` provenance exactly like `showDesignPanel()` (§10.1's Auto-remember footgun note applies here as well).
1058
1058
 
1059
1059
  See `PORTABLE-CONTRACT.md` §6.5 for the full install-site and no-clobber/no-double-install contract.
@@ -1,6 +1,6 @@
1
- import { c as y, g as m, a as w, b, i as P } from "../panel-config-COHesW2B.js";
2
- import { g, Z as k } from "../tweak-state-BKNxtHzb.js";
3
- import { s as A, l as D, a as E, i as c, r as f, c as _, b as I, d } from "../autoload-state-CfL2VUe1.js";
1
+ import { c as y, g as m, a as w, b, i as P } from "../panel-config-SgA84Uqe.js";
2
+ import { g, Z as k } from "../tweak-state-DGLrzIwq.js";
3
+ import { s as A, l as D, a as E, i as c, r as f, c as _, b as I, d } from "../autoload-state-IlkEci88.js";
4
4
  const u = "tokenpanel-config";
5
5
  function S() {
6
6
  if (typeof document > "u")
@@ -1,4 +1,4 @@
1
- import { s as t } from "../panel-config-COHesW2B.js";
1
+ import { s as t } from "../panel-config-SgA84Uqe.js";
2
2
  import { c as d } from "../color-schemes-CgzOBqGO.js";
3
3
  import { F as r, G as m, a as g, S as z } from "../manifest-DCReQE0k.js";
4
4
  const e = {
@@ -1,4 +1,4 @@
1
- import { g as n, j as o } from "./panel-config-COHesW2B.js";
1
+ import { g as n, j as o } from "./panel-config-SgA84Uqe.js";
2
2
  function c() {
3
3
  return typeof document < "u" && document !== null && typeof document.getElementById == "function";
4
4
  }
@@ -532,31 +532,6 @@ export interface ZdtpGlobalApi {
532
532
  hide: () => void | Promise<void>;
533
533
  toggle: () => void | Promise<void>;
534
534
  }
535
- /**
536
- * Install `window.zdtp = { show, hide, toggle }`, the fixed-name console
537
- * sugar for the common single-panel case (issue #523).
538
- *
539
- * Guard rules:
540
- * - A pre-existing `window.zdtp` WITHOUT this package's marker is assumed to
541
- * be host-defined — never overwritten. Logs a `console.warn` so the host
542
- * can see why `zdtp.show()` did not appear.
543
- * - A pre-existing `window.zdtp` WITH the marker means this package already
544
- * installed the alias (from the other call site, or an earlier run of this
545
- * same one). First install wins — the call is a silent no-op. In the Astro
546
- * flow this manifests as "the adapter wins": its bootstrap script always
547
- * runs (and installs the alias) before the panel module's lazy dynamic
548
- * import can resolve and reach the package-root install site.
549
- *
550
- * `show` / `hide` / `toggle` are caller-supplied closures, so which instance
551
- * they target is up to the caller — the package-root install site (below,
552
- * `index.tsx`) wraps `showDesignTokenPanel()` etc., which re-resolve
553
- * `getPanelConfig()` (the CURRENT default instance) on every call; the Astro
554
- * host-adapter install site instead binds to the specific `PanelInstanceHandle`
555
- * captured at its own install time, which does NOT track a later change of
556
- * default (see PORTABLE-CONTRACT.md §6.5 for the full nuance). Either way,
557
- * for a multi-instance page use `configurePanel(cfg).open()` etc. on the
558
- * specific instance's own handle instead of relying on this alias.
559
- */
560
535
  export declare function installZdtpGlobalAlias(api: ZdtpGlobalApi): void;
561
536
  /**
562
537
  * Runtime validation at the host-adapter trust boundary. The Astro inline
@@ -1,12 +1,12 @@
1
1
  import { jsxs as f, jsx as a, Fragment as fe } from "preact/jsx-runtime";
2
2
  import { createContext as Lt, render as xo } from "preact";
3
3
  import { useRef as H, useCallback as O, useState as Y, useMemo as ne, useEffect as oe, useId as ut, useLayoutEffect as yo, useContext as br, createPortal as Dt, memo as Ie } from "preact/compat";
4
- import { c as Ee, i as Xe, d as Zt, e as Ye, f as Fe, n as cn, h as No, s as xr, o as Me, j as Co, k as yr, m as Vt, p as de, q as Ae, M as dn, r as pn, t as Nr, u as lt, v as $n, w as Cr, x as Eo, y as Tt, z as _o, D as Tn, A as Er, B as _r, g as it, C as Sr, E as $r, F as vt, G as Tr, H as Ar, l as Qt, I as en, J as So, K as An, L as Ln, N as Dn, O as St, P as Lr, Q as Ge, R as Dr, S as Bt, T as Mn, U as Pn, V as Ft, W as Mr, X as Pr, b as Rr } from "./tweak-state-BKNxtHzb.js";
5
- import { g as ie, v as Se, z as un, y as $o, A as Or, m as G, p as ft, q as zr, o as Ir, B as Vr, C as Rn, a as To, D as Ao, E as Br, i as Fr, F as Hr, G as jr, H as Kr, I as fn, J as Lo, K as Ur } from "./panel-config-COHesW2B.js";
4
+ import { c as Ee, i as Xe, d as Zt, e as Ye, f as Fe, n as cn, h as No, s as xr, o as Me, j as Co, k as yr, m as Vt, p as de, q as Ae, M as dn, r as pn, t as Nr, u as lt, v as $n, w as Cr, x as Eo, y as Tt, z as _o, D as Tn, A as Er, B as _r, g as it, C as Sr, E as $r, F as vt, G as Tr, H as Ar, l as Qt, I as en, J as So, K as An, L as Ln, N as Dn, O as St, P as Lr, Q as Ge, R as Dr, S as Bt, T as Mn, U as Pn, V as Ft, W as Mr, X as Pr, b as Rr } from "./tweak-state-DGLrzIwq.js";
5
+ import { g as ie, v as Se, z as un, y as $o, A as Or, m as G, p as ft, q as zr, o as Ir, B as Vr, C as Rn, a as To, D as Ao, E as Br, i as Fr, F as Hr, G as jr, H as Kr, I as fn, J as Lo, K as Ur } from "./panel-config-SgA84Uqe.js";
6
6
  import { c as Wr } from "./color-schemes-CgzOBqGO.js";
7
7
  import { r as qr } from "./route-tokens-to-files-1DvmWBdj.js";
8
8
  import { useContext as kt, useCallback as ee, useRef as be, useEffect as he, useState as Ce, useMemo as et } from "preact/hooks";
9
- import { e as we, l as Do, b as At, a as Mo, f as Gr, s as Po, r as kn, c as Xr, g as Yr } from "./autoload-state-CfL2VUe1.js";
9
+ import { e as we, l as Do, b as At, a as Mo, f as Gr, s as Po, r as kn, c as Xr, g as Yr } from "./autoload-state-IlkEci88.js";
10
10
  function On(e, t, n) {
11
11
  return t < e.left || t > e.right || n < e.top || n > e.bottom;
12
12
  }
@@ -3545,7 +3545,7 @@ function ni({
3545
3545
  he(() => () => {
3546
3546
  Zn(t);
3547
3547
  }, [t]), he(() => {
3548
- !n && !p || r !== null || d.current !== null || (n && s("loading"), d.current = import("./index-BAY1JOUl.js").then((b) => {
3548
+ !n && !p || r !== null || d.current !== null || (n && s("loading"), d.current = import("./index-EdhZv8Ru.js").then((b) => {
3549
3549
  l(() => b.DomTweakerLazyBoundary);
3550
3550
  }).catch((b) => {
3551
3551
  d.current = null, n && s("error"), console.warn(
@@ -1,7 +1,7 @@
1
1
  import { jsx as y, jsxs as K, Fragment as kt } from "preact/jsx-runtime";
2
2
  import { useEffect as P, useState as Y, useRef as O, useMemo as J, useCallback as X } from "preact/hooks";
3
- import { b as ft, p as wt, u as ht, a as Ne, A as bt, Z as gt } from "./index-U7Ol7tgA.js";
4
- import { g as vt, m as j } from "./panel-config-COHesW2B.js";
3
+ import { b as ft, p as wt, u as ht, a as Ne, A as bt, Z as gt } from "./index-Ds4bCeiC.js";
4
+ import { g as vt, m as j } from "./panel-config-SgA84Uqe.js";
5
5
  const xt = (e, o) => {
6
6
  const t = new Array(e.length + o.length);
7
7
  for (let r = 0; r < e.length; r++)
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import "preact/jsx-runtime";
2
2
  import "preact";
3
- import { S as t, c as i, d as n, _ as l, e as d, f as _, g as p, h as g, i as m, j as P, k as u, l as A, m as C, n as S, o as T, q as c, r as f, s as K, t as M, v, w as E, x as F, y as h, z as w } from "./index-U7Ol7tgA.js";
4
- import { Z as y, V as D, v as k, u as H, Y as L } from "./tweak-state-BKNxtHzb.js";
5
- import { c as Y, s as b } from "./panel-config-COHesW2B.js";
6
- import "./autoload-state-CfL2VUe1.js";
3
+ import { S as t, c as i, d as n, _ as l, e as d, f as _, g as p, h as g, i as m, j as P, k as u, l as A, m as C, n as S, o as T, q as c, r as f, s as K, t as M, v, w as E, x as F, y as h, z as w } from "./index-Ds4bCeiC.js";
4
+ import { Z as y, V as D, v as k, u as H, Y as L } from "./tweak-state-DGLrzIwq.js";
5
+ import { c as Y, s as b } from "./panel-config-SgA84Uqe.js";
6
+ import "./autoload-state-IlkEci88.js";
7
7
  export {
8
8
  t as SCHEMA_V1,
9
9
  i as SCHEMA_V2,
@@ -3,14 +3,14 @@ class b extends Error {
3
3
  super(t), this.name = "TierResolverError", Object.setPrototypeOf(this, b.prototype);
4
4
  }
5
5
  }
6
- function A(e, t) {
6
+ function v(e, t) {
7
7
  return e.tiers.find((n) => n.id === t);
8
8
  }
9
9
  function $(e, t) {
10
10
  return e.items.find((n) => n.id === t);
11
11
  }
12
- function Y(e, t, n, i) {
13
- const g = A(e, t);
12
+ function Q(e, t, n, i) {
13
+ const g = v(e, t);
14
14
  if (!g)
15
15
  throw new b(
16
16
  `Tier "${t}" not found in tab "${e.id}". Available tiers: ${e.tiers.map((l) => l.id).join(", ")}.`
@@ -22,7 +22,7 @@ function Y(e, t, n, i) {
22
22
  );
23
23
  const a = i[t]?.[n];
24
24
  if (g.referencesTier !== void 0) {
25
- const l = g.referencesTier, f = A(e, l);
25
+ const l = g.referencesTier, f = v(e, l);
26
26
  if (!f)
27
27
  throw new b(
28
28
  `Tier "${t}" declares referencesTier "${l}" but that tier does not exist in tab "${e.id}".`
@@ -40,16 +40,16 @@ function Y(e, t, n, i) {
40
40
  }
41
41
  return a !== void 0 ? c.pill && a === c.pill.value ? { kind: "literal", value: c.pill.value } : { kind: "literal", value: a } : c.pill ? { kind: "literal", value: c.pill.customDefault } : { kind: "literal", value: c.default };
42
42
  }
43
- function Z(e) {
43
+ function I(e) {
44
44
  return e.kind === "literal" ? e.value : `var(${e.targetCssVar})`;
45
45
  }
46
- function M(e, t, n = [t]) {
46
+ function N(e, t, n = [t]) {
47
47
  const i = e.tab === void 0 || e.tab === t.id ? t : n.find((s) => s.id === e.tab);
48
48
  if (!i)
49
49
  throw new b(
50
50
  `Cross-tab ref target tab "${e.tab}" not found. Available tabs: ${n.map((s) => s.id).join(", ")}.`
51
51
  );
52
- const g = A(i, e.tier);
52
+ const g = v(i, e.tier);
53
53
  if (!g)
54
54
  throw new b(
55
55
  `Cross-tab ref target tier "${e.tier}" not found in tab "${i.id}". Available tiers: ${i.tiers.map((s) => s.id).join(", ")}.`
@@ -61,10 +61,10 @@ function M(e, t, n = [t]) {
61
61
  );
62
62
  return c.cssVar;
63
63
  }
64
- function X(e, t) {
64
+ function ee(e, t) {
65
65
  return e.paletteCssVarTemplate.replace("{n}", String(t));
66
66
  }
67
- const N = /* @__PURE__ */ new Set([
67
+ const z = /* @__PURE__ */ new Set([
68
68
  "aliceblue",
69
69
  "antiquewhite",
70
70
  "aqua",
@@ -221,10 +221,10 @@ const N = /* @__PURE__ */ new Set([
221
221
  "revert",
222
222
  "revert-layer"
223
223
  ]);
224
- function z(e) {
225
- return e.startsWith("#") || e.includes("(") || N.has(e.toLowerCase());
224
+ function H(e) {
225
+ return e.startsWith("#") || e.includes("(") || z.has(e.toLowerCase());
226
226
  }
227
- function H(e, t, n, i) {
227
+ function K(e, t, n, i) {
228
228
  const g = [], c = e.indexOf(":");
229
229
  if (c !== -1) {
230
230
  const a = e.slice(0, c), l = e.slice(c + 1), f = t.find((r) => r.tier === a);
@@ -234,18 +234,18 @@ function H(e, t, n, i) {
234
234
  g.push({ tab: s.tab, tier: s.tier, item: e });
235
235
  for (const a of g)
236
236
  try {
237
- return M(a, n, i), { ref: a };
237
+ return N(a, n, i), { ref: a };
238
238
  } catch {
239
239
  }
240
240
  return { ref: g[0] };
241
241
  }
242
- function K(e, t, n, i, g, c) {
242
+ function L(e, t, n, i, g, c) {
243
243
  const s = t.get(e.default);
244
- return s !== void 0 ? s : e.default === "bg" || e.default === "fg" ? e.default : n && n.length > 0 && !z(e.default) ? H(e.default, n, i, g) : c ? (console.warn(
244
+ return s !== void 0 ? s : e.default === "bg" || e.default === "fg" ? e.default : n && n.length > 0 && !H(e.default) ? K(e.default, n, i, g) : c ? (console.warn(
245
245
  `[design-token-panel] semantic item "${e.id}" default "${e.default}" names no palette item; falling back to palette index 0`
246
246
  ), 0) : { literal: e.default };
247
247
  }
248
- function V(e, t = [e]) {
248
+ function O(e, t = [e]) {
249
249
  const n = e.colorExtras;
250
250
  if (!n) return;
251
251
  const i = e.tiers.find(
@@ -274,7 +274,7 @@ function V(e, t = [e]) {
274
274
  if (g) {
275
275
  const o = !g.semantic, d = n.semanticDefaults;
276
276
  for (const u of g.items)
277
- r[u.id] = u.cssVar, f[u.id] = d && u.id in d ? d[u.id] : K(
277
+ r[u.id] = u.cssVar, f[u.id] = d && u.id in d ? d[u.id] : L(
278
278
  u,
279
279
  l,
280
280
  g.referencesRamps,
@@ -297,14 +297,14 @@ function V(e, t = [e]) {
297
297
  panelSettings: n.panelSettings
298
298
  };
299
299
  }
300
- function Q(e) {
300
+ function te(e) {
301
301
  const t = e.find((n) => n.id === "color");
302
302
  if (t)
303
- return V(t, e);
303
+ return O(t, e);
304
304
  }
305
- function L(e) {
305
+ function F(e) {
306
306
  const t = e.find((n) => n.id === "color-secondary");
307
- return t ? V(t, e) ?? null : null;
307
+ return t ? O(t, e) ?? null : null;
308
308
  }
309
309
  function S(e, t) {
310
310
  if (Object.is(e, t)) return !0;
@@ -324,7 +324,7 @@ function S(e, t) {
324
324
  return !1;
325
325
  return !0;
326
326
  }
327
- const _ = {
327
+ const V = {
328
328
  storagePrefix: "zudo-design-token-panel",
329
329
  consoleNamespace: "zudo",
330
330
  modalClassPrefix: "zudo-design-token-panel-modal",
@@ -336,10 +336,10 @@ const _ = {
336
336
  // No bundled apply endpoint / routing — hosts wire their own.
337
337
  applyEndpoint: void 0,
338
338
  applyRouting: void 0
339
- }, O = /* @__PURE__ */ Symbol.for("@takazudo/zdtp:singleton");
339
+ }, R = /* @__PURE__ */ Symbol.for("@takazudo/zdtp:singleton");
340
340
  function m() {
341
341
  const e = globalThis;
342
- let t = e[O];
342
+ let t = e[R];
343
343
  return t || (t = {
344
344
  instances: /* @__PURE__ */ new Map(),
345
345
  defaultPrefix: null,
@@ -347,9 +347,9 @@ function m() {
347
347
  pendingPostConfigureHooks: [],
348
348
  lifecycleHooks: {},
349
349
  colorSchemeOwners: /* @__PURE__ */ new Set()
350
- }, e[O] = t), t;
350
+ }, e[R] = t), t;
351
351
  }
352
- function F(e) {
352
+ function J(e) {
353
353
  return {
354
354
  instanceId: e,
355
355
  open() {
@@ -371,7 +371,7 @@ function F(e) {
371
371
  }
372
372
  };
373
373
  }
374
- function I(e) {
374
+ function ne(e) {
375
375
  m().lifecycleHooks = {
376
376
  configured: e.configured,
377
377
  open: e.open,
@@ -380,7 +380,7 @@ function I(e) {
380
380
  destroy: e.destroy
381
381
  };
382
382
  }
383
- function ee(e) {
383
+ function re(e) {
384
384
  const t = m(), n = e.storagePrefix, i = t.instances.get(n);
385
385
  if (i) {
386
386
  const f = (r) => ({ ...r, applySink: void 0 });
@@ -402,7 +402,7 @@ function ee(e) {
402
402
  suppliedConfig: { ...e },
403
403
  pendingColorPresets: null,
404
404
  postConfigureHooks: a,
405
- handle: F(n)
405
+ handle: J(n)
406
406
  };
407
407
  t.instances.set(n, l), t.defaultPrefix = n;
408
408
  for (const f of l.postConfigureHooks)
@@ -413,7 +413,7 @@ function x() {
413
413
  const e = m();
414
414
  return e.defaultPrefix === null ? null : e.instances.get(e.defaultPrefix) ?? null;
415
415
  }
416
- function te(e) {
416
+ function oe(e) {
417
417
  const t = x();
418
418
  if (t === null) {
419
419
  const n = m();
@@ -423,97 +423,118 @@ function te(e) {
423
423
  }
424
424
  t.postConfigureHooks.includes(e) || (t.postConfigureHooks.push(e), e());
425
425
  }
426
- function D() {
427
- return x()?.config ?? _;
426
+ function _() {
427
+ return x()?.config ?? V;
428
428
  }
429
- function ne() {
429
+ function ie() {
430
430
  return [...m().instances.values()].map((e) => e.config);
431
431
  }
432
- function re(e) {
432
+ function se(e) {
433
433
  return m().instances.get(e)?.config ?? null;
434
434
  }
435
- function oe() {
435
+ function ae() {
436
436
  const e = m();
437
- e.instances.clear(), e.defaultPrefix = null, e.pendingColorPresets = null, e.pendingPostConfigureHooks.length = 0, v().clear();
437
+ e.instances.clear(), e.defaultPrefix = null, e.pendingColorPresets = null, e.pendingPostConfigureHooks.length = 0, A().clear();
438
438
  }
439
- function v() {
439
+ function A() {
440
440
  const e = m();
441
441
  return e.colorSchemeOwners || (e.colorSchemeOwners = /* @__PURE__ */ new Set()), e.colorSchemeOwners;
442
442
  }
443
- function ie(e) {
444
- v().add(e);
443
+ function le(e) {
444
+ A().add(e);
445
445
  }
446
- function se(e) {
447
- v().delete(e);
446
+ function fe(e) {
447
+ A().delete(e);
448
448
  }
449
- function ae(e) {
450
- return v().has(e);
449
+ function ce(e) {
450
+ return A().has(e);
451
451
  }
452
- function le(e = D()) {
453
- return L(e.tabs);
452
+ function ge(e = _()) {
453
+ return F(e.tabs);
454
454
  }
455
- function fe(e) {
455
+ function de(e) {
456
456
  return `${e.storagePrefix}-state-v2`;
457
457
  }
458
- function ce(e) {
458
+ function ue(e) {
459
459
  return `${e.storagePrefix}-state-v3`;
460
460
  }
461
- function ge(e) {
461
+ function pe(e) {
462
462
  return `${e.storagePrefix}-state-v4`;
463
463
  }
464
- function de(e) {
464
+ function ye(e) {
465
465
  return `${e.storagePrefix}-state`;
466
466
  }
467
- function ue(e) {
467
+ function me(e) {
468
468
  return `${e.storagePrefix}-open`;
469
469
  }
470
- function pe(e) {
470
+ function he(e) {
471
471
  return `${e.storagePrefix}-position`;
472
472
  }
473
- function ye(e) {
473
+ function we(e) {
474
474
  return `${e.storagePrefix}-size`;
475
475
  }
476
- function me(e) {
476
+ function be(e) {
477
477
  return `${e.storagePrefix}-density`;
478
478
  }
479
- function he(e) {
479
+ function ke(e) {
480
480
  return `${e.storagePrefix}:visible`;
481
481
  }
482
- function we(e) {
482
+ function $e(e) {
483
483
  return `${e.storagePrefix}:autoload`;
484
484
  }
485
- function be(e) {
485
+ function Ce(e) {
486
486
  return `${e.storagePrefix}-root`;
487
487
  }
488
- const J = _.storagePrefix, q = "toggle-design-token-panel";
489
- function ke(e) {
490
- return e.storagePrefix === J ? q : e.toggleEvent ?? `toggle-${e.storagePrefix}`;
488
+ const q = V.storagePrefix, G = "toggle-design-token-panel";
489
+ function Pe(e) {
490
+ return e.storagePrefix === q ? G : e.toggleEvent ?? `toggle-${e.storagePrefix}`;
491
491
  }
492
- const G = "__zdtp:open-state-changed";
493
- function $e(e) {
494
- return `${G}:${e.storagePrefix}`;
492
+ const B = "__zdtp:open-state-changed";
493
+ function Ee(e) {
494
+ return `${B}:${e.storagePrefix}`;
495
495
  }
496
- function Ce(e, t) {
496
+ function Ae(e, t) {
497
497
  return `${e.modalClassPrefix}${t}`;
498
498
  }
499
- function Pe(e) {
499
+ function ve(e) {
500
500
  return `${e.exportFilenameBase}.json`;
501
501
  }
502
- const R = /* @__PURE__ */ Symbol.for("@takazudo/zdtp:global-alias-marker");
503
- function Ee(e) {
502
+ const D = /* @__PURE__ */ Symbol.for("@takazudo/zdtp:global-alias-marker");
503
+ function M(e) {
504
+ return typeof e == "object" && e !== null || typeof e == "function";
505
+ }
506
+ function U(e) {
507
+ if (!M(e)) return !1;
508
+ try {
509
+ return e[D] === !0;
510
+ } catch {
511
+ return !1;
512
+ }
513
+ }
514
+ function W(e) {
515
+ if (!M(e)) return !1;
516
+ try {
517
+ const t = e;
518
+ return typeof t.show == "function" && typeof t.hide == "function" && typeof t.toggle == "function";
519
+ } catch {
520
+ return !1;
521
+ }
522
+ }
523
+ function Se(e) {
504
524
  if (typeof window > "u") return;
505
525
  const t = window, n = t.zdtp;
506
526
  if (n !== void 0) {
507
- if ((typeof n == "object" || typeof n == "function") && n !== null && n[R] === !0) return;
527
+ if (U(n) || W(n))
528
+ return;
508
529
  console.warn(
509
530
  "[design-token-panel] window.zdtp already exists and was not installed by this package. Skipping the zdtp.show() / zdtp.hide() / zdtp.toggle() global alias to avoid clobbering it. Use window[consoleNamespace].* or the configurePanel(cfg) handle instead."
510
531
  );
511
532
  return;
512
533
  }
513
534
  const i = { ...e };
514
- i[R] = !0, t.zdtp = i;
535
+ i[D] = !0, t.zdtp = i;
515
536
  }
516
- function ve(e) {
537
+ function xe(e) {
517
538
  if (e === null || typeof e != "object" || Array.isArray(e))
518
539
  throw new Error("[design-token-panel] PanelConfig must be a non-null object");
519
540
  const t = e;
@@ -528,7 +549,7 @@ function ve(e) {
528
549
  throw new Error(
529
550
  `[design-token-panel] PanelConfig.${n} must be a non-empty string (got ${typeof t[n]})`
530
551
  );
531
- if (B(t.tabs), t.toggleEvent !== void 0 && (typeof t.toggleEvent != "string" || t.toggleEvent.length === 0))
552
+ if (Z(t.tabs), t.toggleEvent !== void 0 && (typeof t.toggleEvent != "string" || t.toggleEvent.length === 0))
532
553
  throw new Error(
533
554
  `[design-token-panel] PanelConfig.toggleEvent must be a non-empty string when set (got ${typeof t.toggleEvent})`
534
555
  );
@@ -579,7 +600,7 @@ function ve(e) {
579
600
  );
580
601
  }
581
602
  }
582
- function B(e) {
603
+ function Z(e) {
583
604
  if (!Array.isArray(e))
584
605
  throw new Error("[design-token-panel] PanelConfig.tabs must be an array");
585
606
  const t = /* @__PURE__ */ new Set();
@@ -593,10 +614,10 @@ function B(e) {
593
614
  throw new Error(
594
615
  `[design-token-panel] PanelConfig.tabs: duplicate tab id "${i.id}"`
595
616
  );
596
- t.add(i.id), W(i.id, i, e);
617
+ t.add(i.id), X(i.id, i, e);
597
618
  }
598
619
  }
599
- function U(e) {
620
+ function Y(e) {
600
621
  if (typeof e == "number" || e === "bg" || e === "fg") return !0;
601
622
  if (e === null || typeof e != "object" || Array.isArray(e)) return !1;
602
623
  const t = e;
@@ -615,7 +636,7 @@ function U(e) {
615
636
  }
616
637
  return !1;
617
638
  }
618
- function W(e, t, n) {
639
+ function X(e, t, n) {
619
640
  if (!Array.isArray(t.tiers))
620
641
  throw new Error(
621
642
  `[design-token-panel] PanelConfig.tabs["${e}"].tiers must be an array`
@@ -852,7 +873,7 @@ function W(e, t, n) {
852
873
  );
853
874
  const r = s.semanticDefaults;
854
875
  for (const [o, d] of Object.entries(r))
855
- if (!U(d))
876
+ if (!Y(d))
856
877
  throw new Error(
857
878
  `[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(d)}`
858
879
  );
@@ -909,10 +930,10 @@ function W(e, t, n) {
909
930
  `[design-token-panel] PanelConfig.tabs["${e}"].notesExtras must only be set on a tab with id "notes"`
910
931
  );
911
932
  }
912
- function Ae(e = D()) {
933
+ function Te(e = _()) {
913
934
  return e.applyRouting ?? {};
914
935
  }
915
- function Se(e) {
936
+ function je(e) {
916
937
  const t = x();
917
938
  if (t === null) {
918
939
  m().pendingColorPresets = e;
@@ -921,42 +942,42 @@ function Se(e) {
921
942
  t.config = { ...t.config, colorPresets: e };
922
943
  }
923
944
  export {
924
- Pe as A,
925
- Ae as B,
926
- V as C,
927
- $e as D,
928
- I as E,
929
- te as F,
930
- ke as G,
931
- q as H,
932
- ne as I,
933
- re as J,
934
- be as K,
935
- oe as _,
936
- he as a,
937
- ve as b,
938
- ee as c,
939
- ue as d,
940
- pe as e,
941
- de as f,
942
- D as g,
943
- fe as h,
944
- Ee as i,
945
- we as j,
946
- ge as k,
947
- ce as l,
948
- Ce as m,
949
- se as n,
950
- le as o,
951
- Y as p,
952
- Z as q,
953
- Q as r,
954
- Se as s,
955
- ye as t,
956
- me as u,
957
- X as v,
958
- ie as w,
959
- ae as x,
960
- M as y,
945
+ ve as A,
946
+ Te as B,
947
+ O as C,
948
+ Ee as D,
949
+ ne as E,
950
+ oe as F,
951
+ Pe as G,
952
+ G as H,
953
+ ie as I,
954
+ se as J,
955
+ Ce as K,
956
+ ae as _,
957
+ ke as a,
958
+ xe as b,
959
+ re as c,
960
+ me as d,
961
+ he as e,
962
+ ye as f,
963
+ _ as g,
964
+ de as h,
965
+ Se as i,
966
+ $e as j,
967
+ pe as k,
968
+ ue as l,
969
+ Ae as m,
970
+ fe as n,
971
+ ge as o,
972
+ Q as p,
973
+ I as q,
974
+ te as r,
975
+ je as s,
976
+ we as t,
977
+ be as u,
978
+ ee as v,
979
+ le as w,
980
+ ce as x,
981
+ N as y,
961
982
  S as z
962
983
  };
package/dist/testing.js CHANGED
@@ -1,5 +1,5 @@
1
- import { _ as r, c as _, d as i, e as n, f as g, h as R, a as p } from "./panel-config-COHesW2B.js";
2
- import { a as l, b as y, l as O } from "./tweak-state-BKNxtHzb.js";
1
+ import { _ as r, c as _, d as i, e as n, f as g, h as R, a as p } from "./panel-config-SgA84Uqe.js";
2
+ import { a as l, b as y, l as O } from "./tweak-state-DGLrzIwq.js";
3
3
  import { F as K, G as E, a as S, S as u } from "./manifest-DCReQE0k.js";
4
4
  async function s(e, a) {
5
5
  await e.fill(a), await e.dispatchEvent("input");
@@ -1,4 +1,4 @@
1
- import { r as mt, g, k as yt, l as bt, h as xt, d as Mt, n as Z, o as Q, p as Ae, q as Pe, t as kt, e as vt, u as St, v as B, f as wt, w as _e, x as $t, y as Nt } from "./panel-config-COHesW2B.js";
1
+ import { r as mt, g, k as yt, l as bt, h as xt, d as Mt, n as Z, o as Q, p as Ae, q as Pe, t as kt, e as vt, u as St, v as B, f as wt, w as _e, x as $t, y as Nt } from "./panel-config-SgA84Uqe.js";
2
2
  const Le = (e, t) => {
3
3
  if (typeof e == "number") {
4
4
  if (t === 3)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takazudo/zdtp",
3
- "version": "0.4.13",
3
+ "version": "0.4.14",
4
4
  "description": "Dynamic design-token tweak panel — host-config-driven, framework-agnostic Preact UI.",
5
5
  "private": false,
6
6
  "license": "MIT",