@takazudo/zdtp 0.4.15 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,39 +1,40 @@
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 A, l as C, m as S, n as u, o as T, q as c, r as f, s as K, t as M, v, w, x, y as E, z as F } from "./index-BOOmFtJh.js";
4
- import { Z as y, a2 as D, x as k, w as H, a5 as L } from "./tweak-state-BGp_7Tfh.js";
5
- import { c as O, s as V } from "./panel-config-CRf-ONSV.js";
6
- import "./autoload-state-7BQYXI7Y.js";
3
+ import { S as i, c as n, d as l, _ as d, e as _, f as p, g as m, h as g, i as P, j as A, k as C, l as S, m as u, n as T, o as c, q as f, r as K, s as M, t as v, v as w, w as x, x as E, y as F, z as h } from "./index-CHzTi0y5.js";
4
+ import { Z as D, a2 as k, x as H, w as L, a5 as b } from "./tweak-state-B7ok3Ob3.js";
5
+ import { c as V, s as Y } from "./panel-config-BSu6TUht.js";
6
+ import "./autoload-state-DmTY6tRy.js";
7
+ import "./constants.js";
7
8
  export {
8
- t as SCHEMA_V1,
9
- i as SCHEMA_V2,
10
- n as SCHEMA_V3,
11
- y as ZDTP_LEGACY_TYPOGRAPHY_RENAME_MAP,
12
- l as __mountedSpawnSlotsForTests,
13
- d as __panelConfigForTest,
14
- _ as __reapplyFromStorageForTests,
15
- p as __resetInstanceBindingsForTests,
9
+ i as SCHEMA_V1,
10
+ n as SCHEMA_V2,
11
+ l as SCHEMA_V3,
12
+ D as ZDTP_LEGACY_TYPOGRAPHY_RENAME_MAP,
13
+ d as __mountedSpawnSlotsForTests,
14
+ _ as __panelConfigForTest,
15
+ p as __reapplyFromStorageForTests,
16
+ m as __resetInstanceBindingsForTests,
16
17
  g as __resetSpawnSlotsForTests,
17
- O as configurePanel,
18
- m as disableAutoload,
19
- D as emptyOverrides,
20
- P as enableAutoload,
21
- k as getClusterDefaultMode,
22
- A as hideDesignTokenPanel,
23
- C as isColorKind,
24
- S as isContentKind,
25
- u as isCursorKind,
26
- T as isLengthKind,
27
- c as isMaskImageKind,
28
- f as isNumberKind,
29
- K as isSelectKind,
30
- M as isTextKind,
31
- v as reapplyPersistedOverrides,
32
- H as resolvePerModeLiteral,
33
- L as resolveSemanticPreviewColor,
34
- w as setLifecycleAdapter,
35
- V as setPanelColorPresets,
36
- x as shouldAutoload,
37
- E as showDesignTokenPanel,
38
- F as toggleDesignPanel
18
+ V as configurePanel,
19
+ P as disableAutoload,
20
+ k as emptyOverrides,
21
+ A as enableAutoload,
22
+ H as getClusterDefaultMode,
23
+ C as hideDesignTokenPanel,
24
+ S as isColorKind,
25
+ u as isContentKind,
26
+ T as isCursorKind,
27
+ c as isLengthKind,
28
+ f as isMaskImageKind,
29
+ K as isNumberKind,
30
+ M as isSelectKind,
31
+ v as isTextKind,
32
+ w as reapplyPersistedOverrides,
33
+ L as resolvePerModeLiteral,
34
+ b as resolveSemanticPreviewColor,
35
+ x as setLifecycleAdapter,
36
+ Y as setPanelColorPresets,
37
+ E as shouldAutoload,
38
+ F as showDesignTokenPanel,
39
+ h as toggleDesignPanel
39
40
  };
@@ -1,3 +1,4 @@
1
+ import { DEFAULT_STORAGE_PREFIX as K, resolveToggleEventName as N } from "./constants.js";
1
2
  class k extends Error {
2
3
  constructor(t) {
3
4
  super(t), this.name = "TierResolverError", Object.setPrototypeOf(this, k.prototype);
@@ -9,7 +10,7 @@ function A(e, t) {
9
10
  function $(e, t) {
10
11
  return e.items.find((n) => n.id === t);
11
12
  }
12
- function I(e, t, n, i) {
13
+ function ee(e, t, n, i) {
13
14
  const u = A(e, t);
14
15
  if (!u)
15
16
  throw new k(
@@ -40,10 +41,10 @@ function I(e, t, n, i) {
40
41
  }
41
42
  return r !== void 0 ? d.pill && r === d.pill.value ? { kind: "literal", value: d.pill.value } : { kind: "literal", value: r } : d.pill ? { kind: "literal", value: d.pill.customDefault } : { kind: "literal", value: d.default };
42
43
  }
43
- function ee(e) {
44
+ function te(e) {
44
45
  return e.kind === "literal" ? e.value : `var(${e.targetCssVar})`;
45
46
  }
46
- function N(e, t, n = [t]) {
47
+ function M(e, t, n = [t]) {
47
48
  const i = e.tab === void 0 || e.tab === t.id ? t : n.find((s) => s.id === e.tab);
48
49
  if (!i)
49
50
  throw new k(
@@ -61,10 +62,10 @@ function N(e, t, n = [t]) {
61
62
  );
62
63
  return d.cssVar;
63
64
  }
64
- function te(e, t) {
65
+ function ne(e, t) {
65
66
  return e.paletteCssVarTemplate.replace("{n}", String(t));
66
67
  }
67
- const M = /* @__PURE__ */ new Set([
68
+ const D = /* @__PURE__ */ new Set([
68
69
  "aliceblue",
69
70
  "antiquewhite",
70
71
  "aqua",
@@ -221,10 +222,10 @@ const M = /* @__PURE__ */ new Set([
221
222
  "revert",
222
223
  "revert-layer"
223
224
  ]);
224
- function D(e) {
225
- return e.startsWith("#") || e.includes("(") || M.has(e.toLowerCase());
225
+ function H(e) {
226
+ return e.startsWith("#") || e.includes("(") || D.has(e.toLowerCase());
226
227
  }
227
- function H(e, t, n, i) {
228
+ function B(e, t, n, i) {
228
229
  const u = [], d = e.indexOf(":");
229
230
  if (d !== -1) {
230
231
  const r = e.slice(0, d), f = e.slice(d + 1), l = t.find((o) => o.tier === r);
@@ -234,14 +235,14 @@ function H(e, t, n, i) {
234
235
  u.push({ tab: s.tab, tier: s.tier, item: e });
235
236
  for (const r of u)
236
237
  try {
237
- return N(r, n, i), { ref: r };
238
+ return M(r, n, i), { ref: r };
238
239
  } catch {
239
240
  }
240
241
  return { ref: u[0] };
241
242
  }
242
243
  function L(e, t, n, i, u, d) {
243
244
  const s = t.get(e.default);
244
- return s !== void 0 ? s : e.default === "bg" || e.default === "fg" ? e.default : n && n.length > 0 && !D(e.default) ? H(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 && !H(e.default) ? B(e.default, n, i, u) : d ? (console.warn(
245
246
  `[design-token-panel] semantic item "${e.id}" default "${e.default}" names no palette item; falling back to palette index 0`
246
247
  ), 0) : { literal: e.default };
247
248
  }
@@ -297,22 +298,22 @@ function V(e, t = [e]) {
297
298
  panelSettings: n.panelSettings
298
299
  };
299
300
  }
300
- function ne(e) {
301
+ function re(e) {
301
302
  const t = e.find((n) => n.id === "color");
302
303
  if (t)
303
304
  return V(t, e);
304
305
  }
305
- function B(e) {
306
+ function J(e) {
306
307
  const t = e.find((n) => n.id === "color-secondary");
307
308
  return t ? V(t, e) ?? null : null;
308
309
  }
309
- function x(e, t) {
310
+ function S(e, t) {
310
311
  if (Object.is(e, t)) return !0;
311
312
  if (e === null || t === null || typeof e != typeof t || typeof e != "object") return !1;
312
313
  if (Array.isArray(e)) {
313
314
  if (!Array.isArray(t) || e.length !== t.length) return !1;
314
315
  for (let d = 0; d < e.length; d++)
315
- if (!x(e[d], t[d])) return !1;
316
+ if (!S(e[d], t[d])) return !1;
316
317
  return !0;
317
318
  }
318
319
  if (Array.isArray(t)) return !1;
@@ -320,12 +321,12 @@ function x(e, t) {
320
321
  if (n.length !== i.length) return !1;
321
322
  const u = new Set(i);
322
323
  for (const d of n)
323
- if (!u.has(d) || !x(e[d], t[d]))
324
+ if (!u.has(d) || !S(e[d], t[d]))
324
325
  return !1;
325
326
  return !0;
326
327
  }
327
- const _ = {
328
- storagePrefix: "zudo-design-token-panel",
328
+ const q = {
329
+ storagePrefix: K,
329
330
  consoleNamespace: "zudo",
330
331
  modalClassPrefix: "zudo-design-token-panel-modal",
331
332
  schemaId: "zudo-design-tokens/v1",
@@ -371,7 +372,7 @@ function F(e) {
371
372
  }
372
373
  };
373
374
  }
374
- function re(e) {
375
+ function oe(e) {
375
376
  m().lifecycleHooks = {
376
377
  configured: e.configured,
377
378
  open: e.open,
@@ -380,11 +381,11 @@ function re(e) {
380
381
  destroy: e.destroy
381
382
  };
382
383
  }
383
- function oe(e) {
384
+ function ie(e) {
384
385
  const t = m(), n = e.storagePrefix, i = t.instances.get(n);
385
386
  if (i) {
386
387
  const l = (o) => ({ ...o, applySink: void 0 });
387
- if (x(l(i.suppliedConfig), l(e)))
388
+ if (S(l(i.suppliedConfig), l(e)))
388
389
  return t.defaultPrefix = n, i.handle;
389
390
  throw new Error(
390
391
  `[design-token-panel] configurePanel() was already called with different values for storagePrefix "${n}". Configuration is one-shot per prefix per page lifecycle. To re-configure this prefix, call handle.destroy() first, then configurePanel() again. (Use a distinct storagePrefix for a second panel instance.)`
@@ -409,12 +410,12 @@ function oe(e) {
409
410
  l();
410
411
  return t.lifecycleHooks.configured?.(n), f.handle;
411
412
  }
412
- function S() {
413
+ function x() {
413
414
  const e = m();
414
415
  return e.defaultPrefix === null ? null : e.instances.get(e.defaultPrefix) ?? null;
415
416
  }
416
- function ie(e) {
417
- const t = S();
417
+ function se(e) {
418
+ const t = x();
418
419
  if (t === null) {
419
420
  const n = m();
420
421
  if (n.pendingPostConfigureHooks.includes(e)) return;
@@ -424,110 +425,109 @@ function ie(e) {
424
425
  t.postConfigureHooks.includes(e) || (t.postConfigureHooks.push(e), e());
425
426
  }
426
427
  function j() {
427
- return S()?.config ?? _;
428
+ return x()?.config ?? q;
428
429
  }
429
- function se() {
430
+ function ae() {
430
431
  return [...m().instances.values()].map((e) => e.config);
431
432
  }
432
- function ae(e) {
433
+ function le(e) {
433
434
  return m().instances.get(e)?.config ?? null;
434
435
  }
435
- function le() {
436
+ function fe() {
436
437
  const e = m();
437
- e.instances.clear(), e.defaultPrefix = null, e.pendingColorPresets = null, e.pendingPostConfigureHooks.length = 0, v().clear();
438
+ e.instances.clear(), e.defaultPrefix = null, e.pendingColorPresets = null, e.pendingPostConfigureHooks.length = 0, E().clear();
438
439
  }
439
- function v() {
440
+ function E() {
440
441
  const e = m();
441
442
  return e.colorSchemeOwners || (e.colorSchemeOwners = /* @__PURE__ */ new Set()), e.colorSchemeOwners;
442
443
  }
443
- function fe(e) {
444
- v().add(e);
445
- }
446
444
  function ce(e) {
447
- v().delete(e);
445
+ E().add(e);
448
446
  }
449
447
  function ge(e) {
450
- return v().has(e);
448
+ E().delete(e);
451
449
  }
452
- function de(e = j()) {
453
- return B(e.tabs);
450
+ function de(e) {
451
+ return E().has(e);
454
452
  }
455
- function ue(e) {
456
- return `${e.storagePrefix}-state-v2`;
453
+ function ue(e = j()) {
454
+ return J(e.tabs);
457
455
  }
458
456
  function pe(e) {
459
- return `${e.storagePrefix}-state-v3`;
457
+ return `${e.storagePrefix}-state-v2`;
460
458
  }
461
459
  function ye(e) {
462
- return `${e.storagePrefix}-state-v4`;
460
+ return `${e.storagePrefix}-state-v3`;
463
461
  }
464
462
  function me(e) {
465
- return `${e.storagePrefix}-state`;
463
+ return `${e.storagePrefix}-state-v4`;
466
464
  }
467
465
  function he(e) {
468
- return `${e.storagePrefix}-open`;
466
+ return `${e.storagePrefix}-state`;
469
467
  }
470
468
  function we(e) {
471
- return `${e.storagePrefix}-position`;
469
+ return `${e.storagePrefix}-open`;
472
470
  }
473
471
  function be(e) {
474
- return `${e.storagePrefix}-size`;
472
+ return `${e.storagePrefix}-position`;
475
473
  }
476
474
  function ke(e) {
477
- return `${e.storagePrefix}-dock`;
475
+ return `${e.storagePrefix}-size`;
478
476
  }
479
477
  function $e(e) {
480
- return `${e.storagePrefix}-dock-size`;
478
+ return `${e.storagePrefix}-dock`;
481
479
  }
482
480
  function Ce(e) {
483
- return `${e.storagePrefix}-density`;
481
+ return `${e.storagePrefix}-dock-size`;
484
482
  }
485
483
  function Pe(e) {
484
+ return `${e.storagePrefix}-density`;
485
+ }
486
+ function ve(e) {
486
487
  return `${e.storagePrefix}-specimen`;
487
488
  }
488
489
  function Ee(e, t) {
489
490
  return `${e.storagePrefix}-snapshot-${t}`;
490
491
  }
491
- function ve(e) {
492
+ function Ae(e) {
492
493
  return `${e.storagePrefix}-last-applied`;
493
494
  }
494
- function Ae(e) {
495
+ function Se(e) {
495
496
  return `${e.storagePrefix}:visible`;
496
497
  }
497
498
  function xe(e) {
498
499
  return `${e.storagePrefix}:autoload`;
499
500
  }
500
- function Se(e) {
501
+ function je(e) {
501
502
  return `${e.storagePrefix}-root`;
502
503
  }
503
- const J = _.storagePrefix, q = "toggle-design-token-panel";
504
- function je(e) {
505
- return e.storagePrefix === J ? q : e.toggleEvent ?? `toggle-${e.storagePrefix}`;
504
+ function Te(e) {
505
+ return N(e);
506
506
  }
507
507
  const G = "__zdtp:open-state-changed";
508
- function Te(e) {
508
+ function Oe(e) {
509
509
  return `${G}:${e.storagePrefix}`;
510
510
  }
511
- function Oe(e, t) {
511
+ function Re(e, t) {
512
512
  return `${e.modalClassPrefix}${t}`;
513
513
  }
514
- function Re(e) {
514
+ function Ve(e) {
515
515
  return `${e.exportFilenameBase}.json`;
516
516
  }
517
- const z = /* @__PURE__ */ Symbol.for("@takazudo/zdtp:global-alias-marker");
518
- function K(e) {
517
+ const _ = /* @__PURE__ */ Symbol.for("@takazudo/zdtp:global-alias-marker");
518
+ function z(e) {
519
519
  return typeof e == "object" && e !== null || typeof e == "function";
520
520
  }
521
521
  function U(e) {
522
- if (!K(e)) return !1;
522
+ if (!z(e)) return !1;
523
523
  try {
524
- return e[z] === !0;
524
+ return e[_] === !0;
525
525
  } catch {
526
526
  return !1;
527
527
  }
528
528
  }
529
529
  function W(e) {
530
- if (!K(e)) return !1;
530
+ if (!z(e)) return !1;
531
531
  try {
532
532
  const t = e;
533
533
  return typeof t.show == "function" && typeof t.hide == "function" && typeof t.toggle == "function";
@@ -535,7 +535,7 @@ function W(e) {
535
535
  return !1;
536
536
  }
537
537
  }
538
- function Ve(e) {
538
+ function _e(e) {
539
539
  if (typeof window > "u") return;
540
540
  const t = window, n = t.zdtp;
541
541
  if (n !== void 0) {
@@ -547,9 +547,9 @@ function Ve(e) {
547
547
  return;
548
548
  }
549
549
  const i = { ...e };
550
- i[z] = !0, t.zdtp = i;
550
+ i[_] = !0, t.zdtp = i;
551
551
  }
552
- function _e(e) {
552
+ function ze(e) {
553
553
  if (e === null || typeof e != "object" || Array.isArray(e))
554
554
  throw new Error("[design-token-panel] PanelConfig must be a non-null object");
555
555
  const t = e;
@@ -641,7 +641,7 @@ function Z(e) {
641
641
  throw new Error(
642
642
  `[design-token-panel] PanelConfig.tabs: duplicate tab id "${i.id}"`
643
643
  );
644
- t.add(i.id), Q(i.id, i, e);
644
+ t.add(i.id), X(i.id, i, e);
645
645
  }
646
646
  }
647
647
  function Y(e) {
@@ -663,7 +663,7 @@ function Y(e) {
663
663
  }
664
664
  return !1;
665
665
  }
666
- function Q(e, t, n) {
666
+ function X(e, t, n) {
667
667
  if (!Array.isArray(t.tiers))
668
668
  throw new Error(
669
669
  `[design-token-panel] PanelConfig.tabs["${e}"].tiers must be an array`
@@ -876,9 +876,9 @@ function Q(e, t, n) {
876
876
  let y;
877
877
  for (const w of b) {
878
878
  if (w === null || typeof w != "object" || Array.isArray(w)) continue;
879
- const E = w.type;
880
- if (E === null || typeof E != "object" || Array.isArray(E)) continue;
881
- const O = E.kind;
879
+ const v = w.type;
880
+ if (v === null || typeof v != "object" || Array.isArray(v)) continue;
881
+ const O = v.kind;
882
882
  if (typeof O == "string") {
883
883
  y = O;
884
884
  break;
@@ -996,14 +996,14 @@ function Q(e, t, n) {
996
996
  `[design-token-panel] PanelConfig.tabs["${e}"].notesExtras must only be set on a tab with id "notes"`
997
997
  );
998
998
  }
999
- function X(e = j()) {
999
+ function Q(e = j()) {
1000
1000
  return e.applyRouting ?? {};
1001
1001
  }
1002
- function ze(e = j()) {
1003
- return !!e.applyEndpoint && Object.keys(X(e)).length > 0;
1002
+ function Ke(e = j()) {
1003
+ return !!e.applyEndpoint && Object.keys(Q(e)).length > 0;
1004
1004
  }
1005
- function Ke(e) {
1006
- const t = S();
1005
+ function Ne(e) {
1006
+ const t = x();
1007
1007
  if (t === null) {
1008
1008
  m().pendingColorPresets = e;
1009
1009
  return;
@@ -1011,48 +1011,47 @@ function Ke(e) {
1011
1011
  t.config = { ...t.config, colorPresets: e };
1012
1012
  }
1013
1013
  export {
1014
- N as A,
1014
+ M as A,
1015
1015
  V as B,
1016
- x as C,
1017
- Re as D,
1018
- X as E,
1019
- ze as F,
1020
- ve as G,
1016
+ S as C,
1017
+ Ve as D,
1018
+ Q as E,
1019
+ Ke as F,
1020
+ Ae as G,
1021
1021
  Ee as H,
1022
- Pe as I,
1023
- Te as J,
1024
- re as K,
1025
- ie as L,
1026
- je as M,
1027
- q as N,
1028
- se as O,
1029
- ae as P,
1030
- Se as Q,
1031
- le as _,
1032
- Ae as a,
1033
- _e as b,
1034
- oe as c,
1035
- he as d,
1036
- we as e,
1037
- me as f,
1022
+ ve as I,
1023
+ Oe as J,
1024
+ oe as K,
1025
+ se as L,
1026
+ Te as M,
1027
+ ae as N,
1028
+ le as O,
1029
+ je as P,
1030
+ fe as _,
1031
+ Se as a,
1032
+ ze as b,
1033
+ ie as c,
1034
+ we as d,
1035
+ be as e,
1036
+ he as f,
1038
1037
  j as g,
1039
- ue as h,
1040
- Ve as i,
1038
+ pe as h,
1039
+ _e as i,
1041
1040
  xe as j,
1042
- ye as k,
1043
- pe as l,
1044
- Oe as m,
1045
- ce as n,
1046
- de as o,
1047
- I as p,
1048
- ee as q,
1049
- ne as r,
1050
- Ke as s,
1051
- be as t,
1052
- Ce as u,
1053
- $e as v,
1054
- ke as w,
1055
- te as x,
1056
- fe as y,
1057
- ge as z
1041
+ me as k,
1042
+ ye as l,
1043
+ Re as m,
1044
+ ge as n,
1045
+ ue as o,
1046
+ ee as p,
1047
+ te as q,
1048
+ re as r,
1049
+ Ne as s,
1050
+ ke as t,
1051
+ Pe as u,
1052
+ Ce as v,
1053
+ $e as w,
1054
+ ne as x,
1055
+ ce as y,
1056
+ de as z
1058
1057
  };
@@ -1,5 +1,4 @@
1
1
  import { type JSX } from 'preact';
2
- export declare function ShellHeader({ width, onMouseDown, }: {
3
- width: number;
2
+ export declare function ShellHeader({ onMouseDown, }: {
4
3
  onMouseDown: JSX.MouseEventHandler<HTMLDivElement>;
5
4
  }): JSX.Element;
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-CRf-ONSV.js";
2
- import { a as l, b as y, l as O } from "./tweak-state-BGp_7Tfh.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-BSu6TUht.js";
2
+ import { a as l, b as y, l as O } from "./tweak-state-B7ok3Ob3.js";
3
3
  import { F as K, G as E, a as S, S as u } from "./manifest-DvuKi7I4.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 xt, g, k as Mt, l as kt, h as vt, d as St, n as Z, o as Q, p as Pe, q as De, t as wt, e as Nt, u as $t, v as Ct, w as Tt, x as B, f as It, y as Ee, z as Ot, A as At } from "./panel-config-CRf-ONSV.js";
1
+ import { r as xt, g, k as Mt, l as kt, h as vt, d as St, n as Z, o as Q, p as Pe, q as De, t as wt, e as Nt, u as $t, v as Ct, w as Tt, x as B, f as It, y as Ee, z as Ot, A as At } from "./panel-config-BSu6TUht.js";
2
2
  const Le = (e, t) => {
3
3
  if (typeof e == "number") {
4
4
  if (t === 3)