@takazudo/zdtp 0.4.7 → 0.4.9

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 (37) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/astro/host-adapter.js +42 -42
  3. package/dist/astro/index.js +1 -1
  4. package/dist/autoload-state-CFmRjtD-.js +64 -0
  5. package/dist/config/panel-config.d.ts +21 -0
  6. package/dist/controls/actions-menu-popover.d.ts +3 -2
  7. package/dist/controls/help-icon.d.ts +5 -8
  8. package/dist/dom-tweaker/dom-tweaker-context.d.ts +21 -0
  9. package/dist/dom-tweaker/dom-tweaker-diff-action-link.d.ts +7 -0
  10. package/dist/dom-tweaker/dom-tweaker-orchestrator.d.ts +17 -0
  11. package/dist/dom-tweaker/dom-tweaker-state.d.ts +18 -0
  12. package/dist/dom-tweaker/dom-tweaker-toggle-button.d.ts +9 -0
  13. package/dist/dom-tweaker/lazy/class-editor-popup.d.ts +14 -0
  14. package/dist/dom-tweaker/lazy/diff-export-modal.d.ts +10 -0
  15. package/dist/dom-tweaker/lazy/edit-session.d.ts +19 -0
  16. package/dist/dom-tweaker/lazy/index.d.ts +24 -0
  17. package/dist/dom-tweaker/lazy/pinned-selection-overlay.d.ts +31 -0
  18. package/dist/dom-tweaker/lazy/style-injection.d.ts +2 -0
  19. package/dist/dom-tweaker/lazy/suggestions.d.ts +32 -0
  20. package/dist/dom-tweaker/lazy/tailwind-runtime.d.ts +20 -0
  21. package/dist/element-path/inspector-overlay.d.ts +10 -9
  22. package/dist/highlight/find-elements.d.ts +4 -3
  23. package/dist/index-CGev6ZiI.js +4141 -0
  24. package/dist/index-t74PT2zd.js +7542 -0
  25. package/dist/index.global-Cc-vinUf.js +5387 -0
  26. package/dist/index.global-DdZgM26F.js +4 -0
  27. package/dist/index.js +35 -7186
  28. package/dist/{panel-config-Bw7D-25C.js → panel-config-BNLlUc_r.js} +232 -212
  29. package/dist/picker/alt-click-picker.d.ts +51 -0
  30. package/dist/picker/arming-coordinator.d.ts +16 -0
  31. package/dist/picker/index.d.ts +4 -0
  32. package/dist/tabs/color-tab.d.ts +4 -1
  33. package/dist/testing.js +2 -2
  34. package/dist/{tweak-state-CD1y56zR.js → tweak-state-Dti6XMoQ.js} +1 -1
  35. package/dist/zdtp.css +1 -1
  36. package/package.json +4 -2
  37. package/dist/autoload-state-D26ML6sW.js +0 -46
package/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.9
4
+
5
+ ### Features
6
+
7
+ - feat: add color picker close button ([#542](https://github.com/Takazudo/zudo-design-token-panel/pull/542)) (8596353)
8
+ - feat(zdtp): clean up semantic color rows ([#544](https://github.com/Takazudo/zudo-design-token-panel/pull/544)) (849e0ad)
9
+
10
+ ### Fixed
11
+
12
+ - fix: enforce color picker close hit target ([#546](https://github.com/Takazudo/zudo-design-token-panel/pull/546)) (85c9acd)
13
+ - fix(panel): add palette check view styles ([#543](https://github.com/Takazudo/zudo-design-token-panel/pull/543)) (a6a1fa2)
14
+
15
+ ### Other Changes
16
+
17
+ - docs: fix apply pipeline heading anchor ([#554](https://github.com/Takazudo/zudo-design-token-panel/pull/554)) (13afef6)
18
+ - docs: refresh palette check mode guide ([#545](https://github.com/Takazudo/zudo-design-token-panel/pull/545)) (4ab2ce3)
19
+ - test: record color picker close control VRT (aa66eba)
20
+ - chore: start panel UI tweaks 540 (57fb4c7)
21
+
22
+ ## 0.4.8
23
+
24
+ ### Features
25
+
26
+ - DOM Tweaker — live Tailwind class editor with element picker, suggestions, edit-session state, confirmation gates, and runtime orchestration ([#539](https://github.com/Takazudo/zudo-design-token-panel/pull/539)) (46f4524, 67e695e, b8bafeb, 5de9ae8, 6e4baab, 376d390, eef4c2, 75f14c7)
27
+
28
+ ### Other Changes
29
+
30
+ - docs(zdtp): add DOM Tweaker reference ([#539](https://github.com/Takazudo/zudo-design-token-panel/pull/539)) (b2b2ed3)
31
+ - chore(dom-tweaker): remove consumed prototype resource ([#539](https://github.com/Takazudo/zudo-design-token-panel/pull/539)) (9a0ac51)
32
+ - docs(l-make-release): add autonomy-after-the-gate principle (7f64206)
33
+
3
34
  ## 0.4.7
4
35
 
5
36
  ### Fixed
@@ -1,8 +1,8 @@
1
- import { c as h, g as u, a as g, b as y, d as P, e as b, f as _, i as A } from "../panel-config-Bw7D-25C.js";
2
- import { g as c, Z as k } from "../tweak-state-CD1y56zR.js";
3
- import { s as I, l as E, a as d, c as C, b as S } from "../autoload-state-D26ML6sW.js";
1
+ import { c as h, g as u, a as g, b as y, d as P, e as b, f as _, i as A } from "../panel-config-BNLlUc_r.js";
2
+ import { g as d, Z as k } from "../tweak-state-Dti6XMoQ.js";
3
+ import { s as I, l as E, a as T, b as c, c as C, d as S } from "../autoload-state-CFmRjtD-.js";
4
4
  const r = "tokenpanel-config";
5
- function T() {
5
+ function v() {
6
6
  if (typeof document > "u")
7
7
  throw new Error(
8
8
  "[design-token-panel] host-adapter loaded without a document; expected to run in a browser context."
@@ -12,45 +12,45 @@ function T() {
12
12
  throw new Error(
13
13
  `[design-token-panel] Inline config script #${r} not found. Ensure <DesignTokenPanelHost config={...} /> is rendered on this page before the host script runs.`
14
14
  );
15
- const t = e.textContent ?? "";
15
+ const o = e.textContent ?? "";
16
16
  let n;
17
17
  try {
18
- n = JSON.parse(t);
19
- } catch (o) {
18
+ n = JSON.parse(o);
19
+ } catch (a) {
20
20
  throw new Error(
21
- `[design-token-panel] Failed to parse inline config from #${r}: ${o.message}`
21
+ `[design-token-panel] Failed to parse inline config from #${r}: ${a.message}`
22
22
  );
23
23
  }
24
24
  return _(n), n;
25
25
  }
26
- function V(e) {
26
+ function D(e) {
27
27
  return e.__zudoDesignTokenPanelAdapter || (e.__zudoDesignTokenPanelAdapter = {}), e.__zudoDesignTokenPanelAdapter;
28
28
  }
29
- function v(e, t) {
30
- const n = V(e);
31
- let o = n[t];
32
- return o || (o = { bound: !1, modulePromise: null }, n[t] = o), o;
29
+ function V(e, o) {
30
+ const n = D(e);
31
+ let a = n[o];
32
+ return a || (a = { bound: !1, modulePromise: null }, n[o] = a), a;
33
33
  }
34
- function D(e) {
34
+ function K(e) {
35
35
  try {
36
36
  return window.localStorage.getItem(e) === "1";
37
37
  } catch {
38
38
  return !1;
39
39
  }
40
40
  }
41
- function K(e, t, n) {
41
+ function M(e, o, n) {
42
42
  try {
43
- const o = window.localStorage;
44
- return o.getItem(n) !== null || o.getItem(t) !== null || o.getItem(e) !== null;
43
+ const a = window.localStorage;
44
+ return a.getItem(n) !== null || a.getItem(o) !== null || a.getItem(e) !== null;
45
45
  } catch {
46
46
  return !1;
47
47
  }
48
48
  }
49
49
  async function i(e) {
50
- return e.modulePromise === null && (e.modulePromise = import("@takazudo/zdtp").then((t) => {
50
+ return e.modulePromise === null && (e.modulePromise = import("@takazudo/zdtp").then((o) => {
51
51
  try {
52
- const n = u(), o = t.__panelConfigForTest();
53
- n !== o && console.warn(
52
+ const n = u(), a = o.__panelConfigForTest();
53
+ n !== a && console.warn(
54
54
  "[design-token-panel] Singleton-sharing check failed: the host adapter and the panel module observed different PanelConfig singletons. This indicates the package's `config/panel-config` module is no longer code-split into a single shared chunk. The panel may behave correctly today, but storage keys / namespaces / branding could diverge between the two surfaces in future bundles."
55
55
  );
56
56
  } catch (n) {
@@ -58,58 +58,58 @@ async function i(e) {
58
58
  "[design-token-panel] Singleton-sharing check could not run (likely an older dist without the __panelConfigForTest accessor): " + n.message
59
59
  );
60
60
  }
61
- return t;
61
+ return o;
62
62
  })), e.modulePromise;
63
63
  }
64
- function M(e, t, n, o, a) {
65
- const l = e[t] ?? {};
64
+ function O(e, o, n, a, t) {
65
+ const l = e[o] ?? {};
66
66
  l.showDesignPanel = async () => {
67
- d(a, !0), await i(n), o.open();
67
+ c(t, !0), await i(n), a.open();
68
68
  }, l.hideDesignPanel = async () => {
69
- await i(n), o.close();
69
+ await i(n), a.close();
70
70
  }, l.toggleDesignPanel = async () => {
71
- await i(n), o.toggle();
71
+ await i(n), a.toggle();
72
72
  let s = !1;
73
73
  try {
74
- s = window.localStorage.getItem(c(a)) === "1";
74
+ s = window.localStorage.getItem(d(t)) === "1";
75
75
  } catch {
76
76
  }
77
- s && d(a, !0);
77
+ s && c(t, !0);
78
78
  }, l.enableAutoload = async () => {
79
- (await i(n)).enableAutoload(a);
79
+ (await i(n)).enableAutoload(t);
80
80
  }, l.disableAutoload = async () => {
81
81
  if (n.modulePromise !== null) {
82
- (await i(n)).disableAutoload(a);
82
+ (await i(n)).disableAutoload(t);
83
83
  return;
84
84
  }
85
- C(a), S(!1, a);
85
+ C(t), S(!1, t);
86
86
  try {
87
- window.localStorage.setItem(g(a), "0");
87
+ window.localStorage.setItem(g(t), "0");
88
88
  } catch {
89
89
  }
90
90
  try {
91
- window.localStorage.removeItem(c(a));
91
+ window.localStorage.removeItem(d(t));
92
92
  } catch {
93
93
  }
94
- }, e[t] = l;
94
+ }, e[o] = l;
95
95
  }
96
- function O(e, t) {
96
+ function x(e, o) {
97
97
  A({
98
98
  show: async () => {
99
- await i(e), t.open();
99
+ await i(e), o.open();
100
100
  },
101
101
  hide: async () => {
102
- await i(e), t.close();
102
+ await i(e), o.close();
103
103
  },
104
104
  toggle: async () => {
105
- await i(e), t.toggle();
105
+ await i(e), o.toggle();
106
106
  }
107
107
  });
108
108
  }
109
109
  (function() {
110
- const t = T(), n = t.legacyIdRenameMap ? t : { ...t, legacyIdRenameMap: { ...k } }, o = h(n), a = u(), l = window, s = v(l, a.storagePrefix);
111
- if (M(l, a.consoleNamespace, s, o, a), O(s, o), s.bound) return;
110
+ const o = v(), n = o.legacyIdRenameMap ? o : { ...o, legacyIdRenameMap: { ...k } }, a = h(n), t = u(), l = window, s = V(l, t.storagePrefix);
111
+ if (O(l, t.consoleNamespace, s, a, t), x(s, a), s.bound) return;
112
112
  s.bound = !0;
113
- const p = g(a), f = y(a), m = P(a), w = b(a);
114
- (D(p) || K(f, m, w) || I(a) || E(a)) && i(s);
113
+ const p = g(t), f = y(t), m = P(t), w = b(t);
114
+ (K(p) || M(f, m, w) || I(t) || E(t) || t.domTweaker !== void 0 && T(t)) && i(s);
115
115
  })();
@@ -1,4 +1,4 @@
1
- import { s as t } from "../panel-config-Bw7D-25C.js";
1
+ import { s as t } from "../panel-config-BNLlUc_r.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 = {
@@ -0,0 +1,64 @@
1
+ import { g as t, l as o } from "./panel-config-BNLlUc_r.js";
2
+ function n(e = t()) {
3
+ return `${e.storagePrefix}-elpath-enabled`;
4
+ }
5
+ function c(e = t()) {
6
+ try {
7
+ return localStorage.getItem(n(e)) === "1";
8
+ } catch {
9
+ return !1;
10
+ }
11
+ }
12
+ function d(e, a = t()) {
13
+ try {
14
+ localStorage.setItem(n(a), e ? "1" : "0");
15
+ } catch {
16
+ }
17
+ }
18
+ function r(e = t()) {
19
+ return `${e.storagePrefix}-domtweaker-enabled`;
20
+ }
21
+ function u(e = t()) {
22
+ try {
23
+ return localStorage.getItem(r(e)) === "1";
24
+ } catch {
25
+ return !1;
26
+ }
27
+ }
28
+ function f(e, a = t()) {
29
+ try {
30
+ localStorage.setItem(r(a), e ? "1" : "0");
31
+ } catch {
32
+ }
33
+ }
34
+ function s(e) {
35
+ if (typeof window > "u") return !1;
36
+ try {
37
+ return window.localStorage.getItem(o(e)) === "1";
38
+ } catch {
39
+ return !1;
40
+ }
41
+ }
42
+ function i(e, a) {
43
+ if (!(typeof window > "u"))
44
+ try {
45
+ window.localStorage.setItem(o(e), a ? "1" : "0");
46
+ } catch {
47
+ }
48
+ }
49
+ function g(e) {
50
+ if (!(typeof window > "u"))
51
+ try {
52
+ window.localStorage.removeItem(o(e));
53
+ } catch {
54
+ }
55
+ }
56
+ export {
57
+ u as a,
58
+ i as b,
59
+ g as c,
60
+ d,
61
+ f as e,
62
+ c as l,
63
+ s
64
+ };
@@ -60,6 +60,18 @@ import type { TabConfig } from '../tokens/tier-model';
60
60
  * (JSON-serializable constraint).
61
61
  */
62
62
  export type ApplyRoutingMap = Record<string, string>;
63
+ /**
64
+ * DOM Tweaker opt-in config.
65
+ *
66
+ * Presence enables the eager-side DOM Tweaker scaffold. The object must stay
67
+ * pure JSON data because Astro serialises `PanelConfig` through an inline JSON
68
+ * script. `themeCss` is host-supplied Tailwind v4 theme CSS used by the lazy
69
+ * side to derive suggestions; `@import` is deliberately rejected by the
70
+ * validator so the lazy boundary never receives network-loading CSS.
71
+ */
72
+ export interface DomTweakerConfig {
73
+ themeCss?: string;
74
+ }
63
75
  /**
64
76
  * Apply sink interface — allows routing CSS-var writes somewhere other than
65
77
  * the host `:root` (e.g. a shadow root, an iframe document, or a spy in
@@ -129,6 +141,15 @@ export interface PanelConfig {
129
141
  * routing map).
130
142
  */
131
143
  applyRouting?: ApplyRoutingMap;
144
+ /**
145
+ * Optional DOM Tweaker feature config.
146
+ *
147
+ * Presence enables the header toggle and persisted revival path. The value
148
+ * is JSON-serializable only; the lazy DOM Tweaker boundary receives the
149
+ * specific scalar config values it needs instead of reading module-global
150
+ * panel config.
151
+ */
152
+ domTweaker?: DomTweakerConfig;
132
153
  /**
133
154
  * Host-supplied tab configuration for the data-driven tab strip.
134
155
  *
@@ -9,7 +9,7 @@
9
9
  * gear-settings popover's dialog + outside-click/Escape wiring instead
10
10
  * (usePopoverClose, shared with highlight/highlight-settings-popover.tsx).
11
11
  */
12
- import type { JSX } from 'preact';
12
+ import type { ComponentChildren, JSX } from 'preact';
13
13
  export interface ActionsMenuAction {
14
14
  label: string;
15
15
  onSelect: () => void;
@@ -21,6 +21,7 @@ interface ActionsMenuPopoverProps {
21
21
  anchorRef: React.RefObject<HTMLElement | null>;
22
22
  actions: readonly ActionsMenuAction[];
23
23
  onClose: () => void;
24
+ children?: ComponentChildren;
24
25
  }
25
- export declare function ActionsMenuPopover({ anchorRef, actions, onClose, }: ActionsMenuPopoverProps): JSX.Element;
26
+ export declare function ActionsMenuPopover({ anchorRef, actions, onClose, children, }: ActionsMenuPopoverProps): JSX.Element;
26
27
  export {};
@@ -1,6 +1,6 @@
1
1
  /**
2
- * HelpIcon — small round "?" badge that explains a nearby control via the
3
- * shared `.tokenpanel-tooltip--help` variant (issue #520).
2
+ * HelpIcon — small round "?" badge that explains a panel concept via the
3
+ * shared `.tokenpanel-tooltip--help` variant (issues #520 and #544).
4
4
  *
5
5
  * Chrome-button policy (CLAUDE.md): implemented as
6
6
  * `<div role="button" tabIndex={0}>` with explicit Enter/Space handling —
@@ -13,10 +13,8 @@
13
13
  * hover, so a tap must be able to reveal and hold the tip. A second
14
14
  * activation, or pressing Escape anywhere on the page, unpins it.
15
15
  *
16
- * Callers place this as a SIBLING of the control it explains (e.g. after a
17
- * `<select>`, or after a `<label>` wrapping a checkbox) — never nested
18
- * inside a `<label>`, where a click would also toggle the label's own
19
- * control.
16
+ * Callers must never nest this inside a `<label>`, where activating the icon
17
+ * would also toggle the label's control.
20
18
  *
21
19
  * Known trade-off: `tooltip.tsx` renders a single shared tooltip DOM node,
22
20
  * so pinning icon A then hovering/pinning icon B silently replaces A's
@@ -31,8 +29,7 @@
31
29
  * visible until the next activation. Same accepted single-tooltip trade-off.
32
30
  */
33
31
  import type { JSX } from 'preact';
34
- export declare const LITERAL_HELP_TEXT = "Literal sets a fixed color just for this token \u2014 it won't update if you edit a palette/ramp swatch later. Pick a ramp option to keep it linked live.";
35
- export declare const PER_MODE_HELP_TEXT = "Per-mode gives this token two colors \u2014 one for light mode, one for dark. The browser picks the right one automatically via CSS light-dark().";
32
+ export declare const SEMANTIC_TOKENS_HELP_TEXT = "Ramp options stay linked live to palette edits. Literal sets a fixed color that is not linked. Per-mode sets independent light and dark colors emitted with CSS light-dark().";
36
33
  export interface HelpIconProps {
37
34
  /** The help text shown in the tooltip (wrapped, multi-line). */
38
35
  text: string;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * DomTweakerContext — shared eager-side state for the DOM Tweaker feature.
3
+ *
4
+ * Provided by `DomTweakerOrchestrator`; consumed by the header toggle button.
5
+ * The lazy feature runtime is intentionally not exposed here yet — this slice
6
+ * only owns the enabled bit and the first-enable lazy-boundary trigger.
7
+ */
8
+ export type DomTweakerRuntimeStatus = 'idle' | 'loading' | 'ready' | 'error';
9
+ export interface DomTweakerContextValue {
10
+ /** Whether DOM Tweaker is enabled for this panel instance. */
11
+ enabled: boolean;
12
+ /** Enable / disable DOM Tweaker. */
13
+ setEnabled: (enabled: boolean) => void;
14
+ /** Toggle DOM Tweaker. */
15
+ toggle: () => void;
16
+ /** Page-lifetime Tailwind runtime status. */
17
+ runtimeStatus: DomTweakerRuntimeStatus;
18
+ /** Open the lazy diff-export modal from the header toggle area. */
19
+ openDiffExport: () => void;
20
+ }
21
+ export declare const DomTweakerContext: import("preact").Context<DomTweakerContextValue | null>;
@@ -0,0 +1,7 @@
1
+ import type { JSX } from 'preact';
2
+ import type { PanelConfig } from '../config/panel-config';
3
+ export interface DomTweakerDiffActionLinkProps {
4
+ instanceConfig: PanelConfig;
5
+ onSelected?: () => void;
6
+ }
7
+ export declare function DomTweakerDiffActionLink({ instanceConfig, onSelected, }: DomTweakerDiffActionLinkProps): JSX.Element | null;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * DomTweakerOrchestrator — eager-side scaffold for DOM Tweaker.
3
+ *
4
+ * Responsibilities:
5
+ * 1. Lifts and persists the `enabled` flag.
6
+ * 2. Provides DomTweakerContext to descendants (the header toggle button).
7
+ * 3. Enforces the document-global single-active-instance guard.
8
+ * 4. Creates the body-level portal mount for the future lazy UI/runtime.
9
+ * 5. Dynamically imports the lazy boundary on first enable and passes only
10
+ * explicit scalar config values into that boundary.
11
+ */
12
+ import type { ComponentChildren, JSX } from 'preact';
13
+ import type { PanelConfig } from '../config/panel-config';
14
+ export declare function DomTweakerOrchestrator({ children, instanceConfig, }: {
15
+ children: ComponentChildren;
16
+ instanceConfig: PanelConfig;
17
+ }): JSX.Element;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * DOM Tweaker — persisted feature state.
3
+ *
4
+ * The eager shell owns one persisted bit: whether DOM Tweaker is enabled for
5
+ * this panel instance. The storage key is derived from PanelConfig at call
6
+ * time (never at module init), so a late `configurePanel({ storagePrefix })`
7
+ * is respected by no-arg callers.
8
+ */
9
+ import { type PanelConfig } from '../config/panel-config';
10
+ export declare function storageKey_domTweakerEnabled(cfg?: PanelConfig): string;
11
+ /**
12
+ * Load the persisted enabled flag from localStorage. Defaults to `false` on
13
+ * missing storage, denied storage access, or any value other than the literal
14
+ * string `'1'`.
15
+ */
16
+ export declare function loadDomTweakerEnabled(cfg?: PanelConfig): boolean;
17
+ /** Persist the enabled flag to localStorage. Degrades silently when unavailable. */
18
+ export declare function saveDomTweakerEnabled(enabled: boolean, cfg?: PanelConfig): void;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * DomTweakerToggleButton — header button that enables/disables DOM Tweaker.
3
+ *
4
+ * The full DOM editing UI/runtime lives behind the lazy boundary. This eager
5
+ * control only flips the persisted enabled bit and triggers the first lazy
6
+ * import through DomTweakerOrchestrator.
7
+ */
8
+ import type { JSX } from 'preact';
9
+ export declare function DomTweakerToggleButton(): JSX.Element | null;
@@ -0,0 +1,14 @@
1
+ import type { JSX } from 'preact';
2
+ import { type TrackedElementRect } from './pinned-selection-overlay';
3
+ export interface ClassEditorPopupProps {
4
+ target: Element | null;
5
+ selectorSummary: string;
6
+ currentClasses: readonly string[];
7
+ suggestions: readonly string[];
8
+ onAddClass: (className: string) => void;
9
+ onRemoveClass: (className: string) => void;
10
+ onClose: () => void;
11
+ visible?: boolean;
12
+ }
13
+ export declare function computeClassEditorPosition(rect: TrackedElementRect): JSX.CSSProperties;
14
+ export declare function ClassEditorPopup({ target, selectorSummary, currentClasses, suggestions, onAddClass, onRemoveClass, onClose, visible, }: ClassEditorPopupProps): JSX.Element | null;
@@ -0,0 +1,10 @@
1
+ import type { JSX } from 'preact';
2
+ import { type PanelConfig } from '../../config/panel-config';
3
+ export interface DiffExportModalProps {
4
+ diffText: string;
5
+ onClose: () => void;
6
+ onCopy?: (text: string) => void | Promise<void>;
7
+ onResetAll: () => void;
8
+ instanceConfig?: PanelConfig;
9
+ }
10
+ export declare function DiffExportModal({ diffText, onClose, onCopy, onResetAll, instanceConfig, }: DiffExportModalProps): JSX.Element;
@@ -0,0 +1,19 @@
1
+ export interface EditSessionRecord {
2
+ selector: string;
3
+ summary: string;
4
+ originalClasses: string[];
5
+ currentClasses: string[];
6
+ }
7
+ export interface EditSessionDiff extends EditSessionRecord {
8
+ addedClasses: string[];
9
+ removedClasses: string[];
10
+ isConnected: boolean;
11
+ }
12
+ export declare function addClass(el: Element, cls: string): void;
13
+ export declare function removeClass(el: Element, cls: string): void;
14
+ export declare function resetElement(el: Element): void;
15
+ export declare function resetAll(): void;
16
+ export declare function getElementRecord(el: Element): EditSessionRecord | null;
17
+ export declare function getSessionRecords(): EditSessionRecord[];
18
+ export declare function getSessionDiff(): EditSessionDiff[];
19
+ export declare function formatSessionDiff(): string;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * DOM Tweaker lazy boundary.
3
+ *
4
+ * The eager orchestrator dynamically imports this boundary on first enable. This
5
+ * file owns every heavy dependency and browser-only surface: Tailwind browser
6
+ * runtime startup, Alt-click picking, pinned selection, class editing, and
7
+ * diff export. The eager side passes scalar config values explicitly so the
8
+ * lazy boundary does not read global panel config.
9
+ */
10
+ import type { JSX } from 'preact';
11
+ import type { DomTweakerRuntimeStatus } from '../dom-tweaker-context';
12
+ export { buildStaticSuggestions, buildSuggestions, buildThemeSuggestions, filterSuggestions, STATIC_SUGGESTIONS, } from './suggestions';
13
+ export interface DomTweakerLazyBoundaryProps {
14
+ enabled: boolean;
15
+ storagePrefix: string;
16
+ themeCss?: string;
17
+ consoleNamespace: string;
18
+ modalClassPrefix: string;
19
+ showDiffExport: boolean;
20
+ onCloseDiffExport: () => void;
21
+ onRuntimeStatusChange: (status: DomTweakerRuntimeStatus) => void;
22
+ onArmingRevoked: () => void;
23
+ }
24
+ export declare function DomTweakerLazyBoundary({ enabled, storagePrefix, themeCss, consoleNamespace, modalClassPrefix, showDiffExport, onCloseDiffExport, onRuntimeStatusChange, onArmingRevoked, }: DomTweakerLazyBoundaryProps): JSX.Element | null;
@@ -0,0 +1,31 @@
1
+ import type { JSX } from 'preact';
2
+ export interface TrackedElementRect {
3
+ top: number;
4
+ left: number;
5
+ right: number;
6
+ bottom: number;
7
+ width: number;
8
+ height: number;
9
+ }
10
+ export interface PinnedSelectionOverlayProps {
11
+ /** Element picked by the DOM Tweaker coordinator. */
12
+ target: Element | null;
13
+ /** Defaults to true. Passing false keeps the component mounted but inert. */
14
+ visible?: boolean;
15
+ /** Fired once when the pinned element leaves the document. */
16
+ onTargetDisconnected?: () => void;
17
+ }
18
+ export interface EditIconButtonProps {
19
+ /** Element picked by the DOM Tweaker coordinator. */
20
+ target: Element | null;
21
+ /** Defaults to true. Passing false keeps the component mounted but inert. */
22
+ visible?: boolean;
23
+ /** Opens the class editor popover. */
24
+ onOpenEditor: () => void;
25
+ /** Accessible label for the icon-only control. */
26
+ label?: string;
27
+ }
28
+ export declare function useTrackedElementRect(target: Element | null, visible?: boolean, onTargetDisconnected?: () => void): TrackedElementRect | null;
29
+ export declare function rectToFixedStyle(rect: TrackedElementRect): JSX.CSSProperties;
30
+ export declare function PinnedSelectionOverlay({ target, visible, onTargetDisconnected, }: PinnedSelectionOverlayProps): JSX.Element | null;
31
+ export declare function EditIconButton({ target, visible, onOpenEditor, label, }: EditIconButtonProps): JSX.Element | null;
@@ -0,0 +1,2 @@
1
+ export declare const DOM_TWEAKER_STYLE_ID = "tokenpanel-domtweaker-style";
2
+ export declare function ensureDomTweakerStyles(doc?: Document): HTMLStyleElement;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Pure Tailwind-class suggestion generation for the DOM Tweaker lazy chunk.
3
+ *
4
+ * This module deliberately has no DOM reads, IO, global state mutation, or
5
+ * eager package-root export. The prototype-sized static list lives behind the
6
+ * DOM Tweaker lazy boundary, and callers may merge in host `@theme` CSS when
7
+ * the tweaker runtime is already active.
8
+ */
9
+ /**
10
+ * Prototype-sized static Tailwind candidate list, carried forward from the
11
+ * DOM Tweaker feasibility prototype's `buildSuggestions()` coverage.
12
+ */
13
+ export declare function buildStaticSuggestions(): string[];
14
+ export declare const STATIC_SUGGESTIONS: readonly string[];
15
+ /**
16
+ * Derive DOM Tweaker candidates from Tailwind v4 `@theme` custom properties.
17
+ *
18
+ * Supported namespaces:
19
+ * - `--color-X` -> `bg-X`, `text-X`, `border-X`
20
+ * - `--spacing-X` -> spacing-family utilities such as `p-X`, `px-X`,
21
+ * `gap-X`, `w-X`, `space-x-X`, etc.
22
+ *
23
+ * Unknown namespaces are ignored.
24
+ */
25
+ export declare function buildThemeSuggestions(themeCss: string): string[];
26
+ /**
27
+ * Build the full suggestion list from the static prototype list and optional
28
+ * host theme CSS. The result is always sorted and deduped.
29
+ */
30
+ export declare function buildSuggestions(themeCss?: string): string[];
31
+ export declare function filterSuggestions(query: string, limit: number): string[];
32
+ export declare function filterSuggestions(query: string, limit: number, suggestions: readonly string[]): string[];
@@ -0,0 +1,20 @@
1
+ export interface RuntimeOptions {
2
+ readonly themeCss?: string;
3
+ }
4
+ export type RuntimeStartMode = 'module-import' | 'blob-script';
5
+ export interface RuntimeHandle {
6
+ readonly ready: true;
7
+ readonly startMode: RuntimeStartMode;
8
+ readonly styleElement: HTMLStyleElement;
9
+ readonly themeCss: string;
10
+ }
11
+ /**
12
+ * Starts the DOM Tweaker Tailwind runtime once per page.
13
+ *
14
+ * There is intentionally no teardown API in v1. `@tailwindcss/browser` installs
15
+ * document-level MutationObservers and appends its generated utility stylesheet
16
+ * without exposing a public cleanup hook. Reusing the first promise avoids
17
+ * stacking observers/styles across panel open-close cycles, and matches the
18
+ * runtime's page-lifetime design.
19
+ */
20
+ export declare function ensureRuntime(opts?: RuntimeOptions): Promise<RuntimeHandle>;
@@ -2,18 +2,17 @@
2
2
  * InspectorOverlay — the interactive heart of Element Path Copy.
3
3
  *
4
4
  * Behaviour (only while the feature is `enabled`):
5
- * 1. Holding **Alt** arms the inspector. While Alt is down, the element under
6
- * the cursor is resolved via `document.elementFromPoint` (panel surfaces
7
- * excluded) and drawn with a DevTools-style box + an attached label tag
8
- * (`tag#id.class W × H`) on its top-left edge.
5
+ * 1. Holding **Alt** arms the inspector via the shared AltClickPicker
6
+ * primitive. While Alt is down, the element under the cursor is resolved
7
+ * via `document.elementFromPoint` (panel surfaces excluded) and drawn with
8
+ * a DevTools-style box + attached label tag (`tag#id.class W × H`).
9
9
  * 2. **Clicking** while armed copies the annotated path block for that element
10
10
  * to the clipboard (the click is swallowed so host links/handlers don't
11
11
  * fire) and shows a transient top-center toast.
12
12
  *
13
- * Rendering follows the highlight-overlay convention: the box + label positions
14
- * are written imperatively from a RAF loop (so they track scroll/reflow without
15
- * a Preact re-render per frame). Preact only re-renders when the hovered element
16
- * or armed/toast state changes.
13
+ * Rendering follows the highlight-overlay convention inside AltClickPicker: the
14
+ * box + label positions are written imperatively from a RAF loop (so they track
15
+ * scroll/reflow without a Preact re-render per frame).
17
16
  *
18
17
  * Self-contained — does NOT own its portal mount; the orchestrator decides where
19
18
  * in the DOM this renders.
@@ -22,5 +21,7 @@ import type { JSX } from 'preact';
22
21
  export interface InspectorOverlayProps {
23
22
  /** Whether inspect mode is enabled. When false the overlay is fully inert. */
24
23
  enabled: boolean;
24
+ /** Called when another real picker feature takes coordinator ownership. */
25
+ onArmingRevoked?: () => void;
25
26
  }
26
- export declare function InspectorOverlay({ enabled }: InspectorOverlayProps): JSX.Element | null;
27
+ export declare function InspectorOverlay({ enabled, onArmingRevoked, }: InspectorOverlayProps): JSX.Element | null;
@@ -75,13 +75,14 @@ export interface FindElementsOptions {
75
75
  */
76
76
  export declare const HIGHLIGHT_PORTAL_MOUNT_ID = "tokenpanel-highlight-mount";
77
77
  export declare const ELPATH_PORTAL_MOUNT_ID = "tokenpanel-elpath-mount";
78
+ export declare const DOM_TWEAKER_PORTAL_MOUNT_ID = "tokenpanel-domtweaker-mount";
78
79
  /**
79
80
  * Selector matching every panel-owned surface that must NEVER be treated as a
80
- * host element (the shell, modals, and the highlight/element-path portal mounts).
81
- * Exported so the Element Path Copy inspector can skip the same surfaces when
81
+ * host element (the shell, modals, and the highlight/element-path/dom-tweaker
82
+ * portal mounts). Exported so picker features can skip the same surfaces when
82
83
  * resolving the element under the cursor.
83
84
  */
84
- export declare const PANEL_EXCLUSION_SELECTOR = ".tokenpanel-shell, [data-design-token-panel-modal], #tokenpanel-highlight-mount, #tokenpanel-elpath-mount";
85
+ export declare const PANEL_EXCLUSION_SELECTOR = ".tokenpanel-shell, [data-design-token-panel-modal], #tokenpanel-highlight-mount, #tokenpanel-elpath-mount, #tokenpanel-domtweaker-mount";
85
86
  /**
86
87
  * Find all DOM elements whose computed style reflects the given CSS custom
87
88
  * property.