@takazudo/zdtp 0.4.6 → 0.4.8
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 +22 -0
- package/dist/astro/host-adapter.js +42 -42
- package/dist/astro/index.js +1 -1
- package/dist/autoload-state-CFmRjtD-.js +64 -0
- package/dist/bin/server.js +1 -1
- package/dist/config/panel-config.d.ts +21 -0
- package/dist/controls/actions-menu-popover.d.ts +3 -2
- package/dist/dom-tweaker/dom-tweaker-context.d.ts +21 -0
- package/dist/dom-tweaker/dom-tweaker-diff-action-link.d.ts +7 -0
- package/dist/dom-tweaker/dom-tweaker-orchestrator.d.ts +17 -0
- package/dist/dom-tweaker/dom-tweaker-state.d.ts +18 -0
- package/dist/dom-tweaker/dom-tweaker-toggle-button.d.ts +9 -0
- package/dist/dom-tweaker/lazy/class-editor-popup.d.ts +14 -0
- package/dist/dom-tweaker/lazy/diff-export-modal.d.ts +10 -0
- package/dist/dom-tweaker/lazy/edit-session.d.ts +19 -0
- package/dist/dom-tweaker/lazy/index.d.ts +24 -0
- package/dist/dom-tweaker/lazy/pinned-selection-overlay.d.ts +31 -0
- package/dist/dom-tweaker/lazy/style-injection.d.ts +2 -0
- package/dist/dom-tweaker/lazy/suggestions.d.ts +32 -0
- package/dist/dom-tweaker/lazy/tailwind-runtime.d.ts +20 -0
- package/dist/element-path/inspector-overlay.d.ts +10 -9
- package/dist/highlight/find-elements.d.ts +4 -3
- package/dist/index-DTyUiYcC.js +7457 -0
- package/dist/index-DXSiRW1w.js +4141 -0
- package/dist/index.global-Cc-vinUf.js +5387 -0
- package/dist/index.global-DdZgM26F.js +4 -0
- package/dist/index.js +35 -7186
- package/dist/{load-routing-LJ72261l.js → load-routing-D4H2VOl5.js} +166 -161
- package/dist/{panel-config-Bw7D-25C.js → panel-config-BNLlUc_r.js} +232 -212
- package/dist/picker/alt-click-picker.d.ts +51 -0
- package/dist/picker/arming-coordinator.d.ts +16 -0
- package/dist/picker/index.d.ts +4 -0
- package/dist/server/index.js +1 -1
- package/dist/testing.js +2 -2
- package/dist/{tweak-state-CD1y56zR.js → tweak-state-Dti6XMoQ.js} +1 -1
- package/dist/zdtp.css +1 -1
- package/package.json +4 -2
- package/dist/autoload-state-D26ML6sW.js +0 -46
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.8
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- 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)
|
|
8
|
+
|
|
9
|
+
### Other Changes
|
|
10
|
+
|
|
11
|
+
- docs(zdtp): add DOM Tweaker reference ([#539](https://github.com/Takazudo/zudo-design-token-panel/pull/539)) (b2b2ed3)
|
|
12
|
+
- chore(dom-tweaker): remove consumed prototype resource ([#539](https://github.com/Takazudo/zudo-design-token-panel/pull/539)) (9a0ac51)
|
|
13
|
+
- docs(l-make-release): add autonomy-after-the-gate principle (7f64206)
|
|
14
|
+
|
|
15
|
+
## 0.4.7
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- fix(server): coalesce same-file token groups in createApplyHandler ([#527](https://github.com/Takazudo/zudo-design-token-panel/pull/527)) (1d84c94)
|
|
20
|
+
|
|
21
|
+
### Other Changes
|
|
22
|
+
|
|
23
|
+
- chore(deps): resolve 19 pnpm audit security advisories ([#525](https://github.com/Takazudo/zudo-design-token-panel/pull/525)) (80c9a0e)
|
|
24
|
+
|
|
3
25
|
## 0.4.6
|
|
4
26
|
|
|
5
27
|
### Features
|
|
@@ -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-
|
|
2
|
-
import { g as
|
|
3
|
-
import { s as I, l as E, a as
|
|
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
|
|
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
|
|
15
|
+
const o = e.textContent ?? "";
|
|
16
16
|
let n;
|
|
17
17
|
try {
|
|
18
|
-
n = JSON.parse(
|
|
19
|
-
} catch (
|
|
18
|
+
n = JSON.parse(o);
|
|
19
|
+
} catch (a) {
|
|
20
20
|
throw new Error(
|
|
21
|
-
`[design-token-panel] Failed to parse inline config from #${r}: ${
|
|
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
|
|
26
|
+
function D(e) {
|
|
27
27
|
return e.__zudoDesignTokenPanelAdapter || (e.__zudoDesignTokenPanelAdapter = {}), e.__zudoDesignTokenPanelAdapter;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
const n =
|
|
31
|
-
let
|
|
32
|
-
return
|
|
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
|
|
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
|
|
41
|
+
function M(e, o, n) {
|
|
42
42
|
try {
|
|
43
|
-
const
|
|
44
|
-
return
|
|
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((
|
|
50
|
+
return e.modulePromise === null && (e.modulePromise = import("@takazudo/zdtp").then((o) => {
|
|
51
51
|
try {
|
|
52
|
-
const n = u(),
|
|
53
|
-
n !==
|
|
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
|
|
61
|
+
return o;
|
|
62
62
|
})), e.modulePromise;
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
const l = e[
|
|
64
|
+
function O(e, o, n, a, t) {
|
|
65
|
+
const l = e[o] ?? {};
|
|
66
66
|
l.showDesignPanel = async () => {
|
|
67
|
-
|
|
67
|
+
c(t, !0), await i(n), a.open();
|
|
68
68
|
}, l.hideDesignPanel = async () => {
|
|
69
|
-
await i(n),
|
|
69
|
+
await i(n), a.close();
|
|
70
70
|
}, l.toggleDesignPanel = async () => {
|
|
71
|
-
await i(n),
|
|
71
|
+
await i(n), a.toggle();
|
|
72
72
|
let s = !1;
|
|
73
73
|
try {
|
|
74
|
-
s = window.localStorage.getItem(
|
|
74
|
+
s = window.localStorage.getItem(d(t)) === "1";
|
|
75
75
|
} catch {
|
|
76
76
|
}
|
|
77
|
-
s &&
|
|
77
|
+
s && c(t, !0);
|
|
78
78
|
}, l.enableAutoload = async () => {
|
|
79
|
-
(await i(n)).enableAutoload(
|
|
79
|
+
(await i(n)).enableAutoload(t);
|
|
80
80
|
}, l.disableAutoload = async () => {
|
|
81
81
|
if (n.modulePromise !== null) {
|
|
82
|
-
(await i(n)).disableAutoload(
|
|
82
|
+
(await i(n)).disableAutoload(t);
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
|
-
C(
|
|
85
|
+
C(t), S(!1, t);
|
|
86
86
|
try {
|
|
87
|
-
window.localStorage.setItem(g(
|
|
87
|
+
window.localStorage.setItem(g(t), "0");
|
|
88
88
|
} catch {
|
|
89
89
|
}
|
|
90
90
|
try {
|
|
91
|
-
window.localStorage.removeItem(
|
|
91
|
+
window.localStorage.removeItem(d(t));
|
|
92
92
|
} catch {
|
|
93
93
|
}
|
|
94
|
-
}, e[
|
|
94
|
+
}, e[o] = l;
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function x(e, o) {
|
|
97
97
|
A({
|
|
98
98
|
show: async () => {
|
|
99
|
-
await i(e),
|
|
99
|
+
await i(e), o.open();
|
|
100
100
|
},
|
|
101
101
|
hide: async () => {
|
|
102
|
-
await i(e),
|
|
102
|
+
await i(e), o.close();
|
|
103
103
|
},
|
|
104
104
|
toggle: async () => {
|
|
105
|
-
await i(e),
|
|
105
|
+
await i(e), o.toggle();
|
|
106
106
|
}
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
109
|
(function() {
|
|
110
|
-
const
|
|
111
|
-
if (
|
|
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(
|
|
114
|
-
(
|
|
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
|
})();
|
package/dist/astro/index.js
CHANGED
|
@@ -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
|
+
};
|
package/dist/bin/server.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { realpathSync as E } from "node:fs";
|
|
3
3
|
import { createServer as H } from "node:http";
|
|
4
4
|
import { resolve as p } from "node:path";
|
|
5
|
-
import { l as $, c as x } from "../load-routing-
|
|
5
|
+
import { l as $, c as x } from "../load-routing-D4H2VOl5.js";
|
|
6
6
|
function g(o, t) {
|
|
7
7
|
return typeof o != "string" || o.length === 0 || t.length === 0 ? !1 : t.includes(o);
|
|
8
8
|
}
|
|
@@ -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 {};
|
|
@@ -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,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
|
|
6
|
-
*
|
|
7
|
-
* excluded) and drawn with
|
|
8
|
-
* (`tag#id.class W × H`)
|
|
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
|
|
14
|
-
* are written imperatively from a RAF loop (so they track
|
|
15
|
-
* a Preact re-render per frame).
|
|
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
|
|
81
|
-
* Exported so
|
|
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.
|