@reopt-ai/opt-devtool 1.0.0 → 1.0.1
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/README.md +7 -0
- package/dist/brandapp/index.cjs +455 -364
- package/dist/brandapp/index.d.cts +70 -68
- package/dist/brandapp/index.d.ts +70 -68
- package/dist/brandapp/index.js +448 -361
- package/dist/datagrid/index.cjs +171 -181
- package/dist/datagrid/index.d.cts +10 -9
- package/dist/datagrid/index.d.ts +10 -9
- package/dist/datagrid/index.js +167 -179
- package/dist/editor/index.cjs +210 -229
- package/dist/editor/index.d.cts +10 -9
- package/dist/editor/index.d.ts +10 -9
- package/dist/editor/index.js +206 -227
- package/dist/harness/index.cjs +5 -12
- package/dist/harness/index.d.cts +14 -14
- package/dist/harness/index.d.ts +14 -14
- package/dist/harness/index.js +2 -11
- package/dist/harness-CoRqiJWO.cjs +584 -0
- package/dist/harness-DU8hP98g.js +536 -0
- package/dist/index.cjs +3687 -3816
- package/dist/index.d.cts +13 -15
- package/dist/index.d.ts +13 -15
- package/dist/index.js +3679 -3815
- package/dist/provider-Bn7CAE_Y.js +116 -0
- package/dist/provider-CLRiXjfD.cjs +168 -0
- package/dist/theme/index.cjs +296 -12
- package/dist/theme/index.d.cts +25 -24
- package/dist/theme/index.d.ts +25 -24
- package/dist/theme/index.js +292 -11
- package/dist/theme-isolate-DgSS935z.cjs +54 -0
- package/dist/theme-isolate-F-oX2d4W.js +43 -0
- package/dist/types-B_abMm2B.cjs +10 -0
- package/dist/types-DvhcaPXA.js +5 -0
- package/dist/types-oHbLkgEH.d.cts +95 -0
- package/dist/types-oHbLkgEH.d.ts +95 -0
- package/dist/ui/index.cjs +4 -8
- package/dist/ui/index.d.cts +3 -2
- package/dist/ui/index.d.ts +3 -2
- package/dist/ui/index.js +2 -7
- package/package.json +2 -2
- package/dist/chunk-4MJKIAXH.cjs +0 -65
- package/dist/chunk-5HRIQSVF.js +0 -32
- package/dist/chunk-6AGUYGVT.cjs +0 -77
- package/dist/chunk-EQPETYJJ.cjs +0 -32
- package/dist/chunk-H3F2WACS.cjs +0 -568
- package/dist/chunk-N7YO56TN.cjs +0 -25
- package/dist/chunk-SQ3E3QLA.cjs +0 -253
- package/dist/chunk-SW2FF6EV.js +0 -568
- package/dist/chunk-UJSIQF3A.js +0 -25
- package/dist/chunk-UQY5I3WS.js +0 -253
- package/dist/chunk-YCYIUFB4.js +0 -65
- package/dist/chunk-Z2KFRHSI.js +0 -77
- package/dist/index-Bakx4o8Z.d.cts +0 -91
- package/dist/index-Bakx4o8Z.d.ts +0 -91
package/dist/theme/index.d.ts
CHANGED
|
@@ -1,33 +1,34 @@
|
|
|
1
|
-
import { ResolvedShellThemeConfig } from '@reopt-ai/opt-shell';
|
|
2
1
|
|
|
2
|
+
import { ResolvedShellThemeConfig } from "@reopt-ai/opt-shell";
|
|
3
|
+
//#region src/theme/index.d.ts
|
|
3
4
|
interface ThemeDevtoolSnapshot {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
5
|
+
mode: "preset" | "generated";
|
|
6
|
+
preset: string;
|
|
7
|
+
seed?: string;
|
|
8
|
+
harmony?: string;
|
|
9
|
+
radiusScale?: string;
|
|
10
|
+
shadowIntensity?: string;
|
|
11
|
+
neutralTemperature?: string;
|
|
12
|
+
forceLightOnly: boolean;
|
|
13
|
+
lightTokens?: Record<string, string>;
|
|
14
|
+
darkTokens?: Record<string, string>;
|
|
15
|
+
contrastPairs?: {
|
|
16
|
+
fg: string;
|
|
17
|
+
bg: string;
|
|
18
|
+
ratio: number;
|
|
19
|
+
level: "AAA" | "AA" | "Fail";
|
|
20
|
+
}[];
|
|
20
21
|
}
|
|
21
22
|
interface UseThemeDevtoolBridgeOptions {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
id?: string;
|
|
24
|
+
label?: string;
|
|
25
|
+
order?: number;
|
|
25
26
|
}
|
|
26
27
|
interface RegisteredThemeDevtoolBridge {
|
|
27
|
-
|
|
28
|
+
inspect: (snapshot: ThemeDevtoolSnapshot) => void;
|
|
28
29
|
}
|
|
29
30
|
/** Build a ThemeDevtoolSnapshot from a ResolvedShellThemeConfig */
|
|
30
31
|
declare function themeConfigToSnapshot(theme: ResolvedShellThemeConfig): ThemeDevtoolSnapshot;
|
|
31
|
-
declare function useThemeDevtoolBridge({ id, label, order
|
|
32
|
-
|
|
33
|
-
export {
|
|
32
|
+
declare function useThemeDevtoolBridge({ id, label, order }?: UseThemeDevtoolBridgeOptions): RegisteredThemeDevtoolBridge;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { RegisteredThemeDevtoolBridge, ThemeDevtoolSnapshot, UseThemeDevtoolBridgeOptions, themeConfigToSnapshot, useThemeDevtoolBridge };
|
package/dist/theme/index.js
CHANGED
|
@@ -1,13 +1,294 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from "
|
|
7
|
-
import "
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
import { n as useOptDevtoolPlugin } from "../provider-Bn7CAE_Y.js";
|
|
4
|
+
import { t as ISOLATE_STYLE } from "../theme-isolate-F-oX2d4W.js";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { contrastRatio, hexToSrgb, wcagLevel } from "@reopt-ai/opt-palette";
|
|
8
|
+
//#region src/theme/index.tsx
|
|
9
|
+
const AUDIT_PAIRS = [
|
|
10
|
+
["--opt-text", "--opt-surface"],
|
|
11
|
+
["--opt-accent-fg", "--opt-accent"],
|
|
12
|
+
["--opt-text-secondary", "--opt-surface"]
|
|
13
|
+
];
|
|
14
|
+
function computeContrastPairs(tokens) {
|
|
15
|
+
const results = [];
|
|
16
|
+
for (const [fgName, bgName] of AUDIT_PAIRS) {
|
|
17
|
+
const fgVal = tokens[fgName];
|
|
18
|
+
const bgVal = tokens[bgName];
|
|
19
|
+
if (!fgVal || !bgVal) continue;
|
|
20
|
+
try {
|
|
21
|
+
const ratio = contrastRatio(hexToSrgb(fgVal), hexToSrgb(bgVal));
|
|
22
|
+
results.push({
|
|
23
|
+
fg: fgName,
|
|
24
|
+
bg: bgName,
|
|
25
|
+
ratio,
|
|
26
|
+
level: wcagLevel(ratio)
|
|
27
|
+
});
|
|
28
|
+
} catch (_unused) {}
|
|
29
|
+
}
|
|
30
|
+
return results;
|
|
31
|
+
}
|
|
32
|
+
/** Build a ThemeDevtoolSnapshot from a ResolvedShellThemeConfig */
|
|
33
|
+
function themeConfigToSnapshot(theme) {
|
|
34
|
+
if (theme.mode === "generated") return {
|
|
35
|
+
mode: theme.mode,
|
|
36
|
+
preset: theme.preset,
|
|
37
|
+
seed: theme.palette.seed,
|
|
38
|
+
harmony: theme.palette.harmony,
|
|
39
|
+
radiusScale: theme.palette.radiusScale,
|
|
40
|
+
shadowIntensity: theme.palette.shadowIntensity,
|
|
41
|
+
neutralTemperature: theme.palette.neutralTemperature,
|
|
42
|
+
forceLightOnly: theme.forceLightOnly,
|
|
43
|
+
lightTokens: theme.generatedLightTokens,
|
|
44
|
+
darkTokens: theme.generatedDarkTokens,
|
|
45
|
+
contrastPairs: computeContrastPairs(theme.generatedLightTokens)
|
|
46
|
+
};
|
|
47
|
+
return {
|
|
48
|
+
mode: theme.mode,
|
|
49
|
+
preset: theme.preset,
|
|
50
|
+
seed: void 0,
|
|
51
|
+
harmony: void 0,
|
|
52
|
+
radiusScale: void 0,
|
|
53
|
+
shadowIntensity: void 0,
|
|
54
|
+
neutralTemperature: void 0,
|
|
55
|
+
forceLightOnly: theme.forceLightOnly,
|
|
56
|
+
lightTokens: void 0,
|
|
57
|
+
darkTokens: void 0,
|
|
58
|
+
contrastPairs: void 0
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const SWATCH_TOKENS = [
|
|
62
|
+
{
|
|
63
|
+
token: "--opt-accent",
|
|
64
|
+
label: "Accent"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
token: "--opt-surface",
|
|
68
|
+
label: "Surface"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
token: "--opt-text",
|
|
72
|
+
label: "Text"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
token: "--opt-bg",
|
|
76
|
+
label: "BG"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
token: "--opt-border",
|
|
80
|
+
label: "Border"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
token: "--opt-success",
|
|
84
|
+
label: "OK"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
token: "--opt-warning",
|
|
88
|
+
label: "Warn"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
token: "--opt-danger",
|
|
92
|
+
label: "Err"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
token: "--opt-chart-1",
|
|
96
|
+
label: "C1"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
token: "--opt-chart-2",
|
|
100
|
+
label: "C2"
|
|
101
|
+
}
|
|
102
|
+
];
|
|
103
|
+
const CONTRAST_CHECK_PAIRS = [
|
|
104
|
+
{
|
|
105
|
+
fg: "--opt-text",
|
|
106
|
+
bg: "--opt-surface",
|
|
107
|
+
label: "text/surface"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
fg: "--opt-accent-fg",
|
|
111
|
+
bg: "--opt-accent",
|
|
112
|
+
label: "accentFg/accent"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
fg: "--opt-text-secondary",
|
|
116
|
+
bg: "--opt-surface",
|
|
117
|
+
label: "text2nd/surface"
|
|
118
|
+
}
|
|
119
|
+
];
|
|
120
|
+
function ThemeDevtoolPanel({ snapshot }) {
|
|
121
|
+
if (!snapshot) return /* @__PURE__ */ jsx("div", {
|
|
122
|
+
className: "text-[11px] text-white/55",
|
|
123
|
+
children: "Waiting for Theme snapshot."
|
|
124
|
+
});
|
|
125
|
+
const isGenerated = snapshot.mode === "generated";
|
|
126
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
127
|
+
className: "flex flex-col gap-3 text-[11px]",
|
|
128
|
+
style: ISOLATE_STYLE,
|
|
129
|
+
children: [
|
|
130
|
+
/* @__PURE__ */ jsxs("div", {
|
|
131
|
+
className: "flex items-center gap-2",
|
|
132
|
+
children: [
|
|
133
|
+
/* @__PURE__ */ jsx("span", { className: `inline-block h-1.5 w-1.5 rounded-full ${isGenerated ? "bg-violet-400" : "bg-white/30"}` }),
|
|
134
|
+
/* @__PURE__ */ jsx("span", {
|
|
135
|
+
className: isGenerated ? "text-violet-300" : "text-white/60",
|
|
136
|
+
children: isGenerated ? "Generated" : `Preset: ${snapshot.preset}`
|
|
137
|
+
}),
|
|
138
|
+
snapshot.forceLightOnly && /* @__PURE__ */ jsx("span", {
|
|
139
|
+
className: "text-[9px] text-amber-400",
|
|
140
|
+
children: "light-only"
|
|
141
|
+
})
|
|
142
|
+
]
|
|
143
|
+
}),
|
|
144
|
+
isGenerated && snapshot.seed && /* @__PURE__ */ jsxs("div", {
|
|
145
|
+
className: "flex flex-col gap-1.5",
|
|
146
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
147
|
+
className: "flex items-center gap-2",
|
|
148
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
149
|
+
className: "h-5 w-5 rounded border border-white/20",
|
|
150
|
+
style: { backgroundColor: snapshot.seed }
|
|
151
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
152
|
+
className: "font-mono text-[10px] text-white/70",
|
|
153
|
+
children: snapshot.seed
|
|
154
|
+
})]
|
|
155
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
156
|
+
className: "grid grid-cols-2 gap-x-3 gap-y-0.5 text-[10px] text-white/50",
|
|
157
|
+
children: [
|
|
158
|
+
snapshot.harmony && /* @__PURE__ */ jsxs("div", { children: [
|
|
159
|
+
/* @__PURE__ */ jsx("span", {
|
|
160
|
+
className: "text-white/30",
|
|
161
|
+
children: "Harmony"
|
|
162
|
+
}),
|
|
163
|
+
" ",
|
|
164
|
+
snapshot.harmony
|
|
165
|
+
] }),
|
|
166
|
+
snapshot.radiusScale && /* @__PURE__ */ jsxs("div", { children: [
|
|
167
|
+
/* @__PURE__ */ jsx("span", {
|
|
168
|
+
className: "text-white/30",
|
|
169
|
+
children: "Radius"
|
|
170
|
+
}),
|
|
171
|
+
" ",
|
|
172
|
+
snapshot.radiusScale
|
|
173
|
+
] }),
|
|
174
|
+
snapshot.shadowIntensity && /* @__PURE__ */ jsxs("div", { children: [
|
|
175
|
+
/* @__PURE__ */ jsx("span", {
|
|
176
|
+
className: "text-white/30",
|
|
177
|
+
children: "Shadow"
|
|
178
|
+
}),
|
|
179
|
+
" ",
|
|
180
|
+
snapshot.shadowIntensity
|
|
181
|
+
] }),
|
|
182
|
+
snapshot.neutralTemperature && /* @__PURE__ */ jsxs("div", { children: [
|
|
183
|
+
/* @__PURE__ */ jsx("span", {
|
|
184
|
+
className: "text-white/30",
|
|
185
|
+
children: "Temp"
|
|
186
|
+
}),
|
|
187
|
+
" ",
|
|
188
|
+
snapshot.neutralTemperature
|
|
189
|
+
] })
|
|
190
|
+
]
|
|
191
|
+
})]
|
|
192
|
+
}),
|
|
193
|
+
isGenerated && snapshot.lightTokens && /* @__PURE__ */ jsxs("div", { children: [
|
|
194
|
+
/* @__PURE__ */ jsx("div", {
|
|
195
|
+
className: "mb-1 text-[10px] font-semibold text-violet-400",
|
|
196
|
+
children: "Light"
|
|
197
|
+
}),
|
|
198
|
+
/* @__PURE__ */ jsx("div", {
|
|
199
|
+
className: "flex flex-wrap gap-1",
|
|
200
|
+
children: SWATCH_TOKENS.map(({ token, label }) => {
|
|
201
|
+
var _snapshot$lightTokens, _snapshot$lightTokens2;
|
|
202
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
203
|
+
className: "flex flex-col items-center gap-0.5",
|
|
204
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
205
|
+
className: "h-4 w-4 rounded-sm border border-white/15",
|
|
206
|
+
style: { backgroundColor: (_snapshot$lightTokens = (_snapshot$lightTokens2 = snapshot.lightTokens) === null || _snapshot$lightTokens2 === void 0 ? void 0 : _snapshot$lightTokens2[token]) !== null && _snapshot$lightTokens !== void 0 ? _snapshot$lightTokens : "#888" }
|
|
207
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
208
|
+
className: "text-[7px] text-white/30",
|
|
209
|
+
children: label
|
|
210
|
+
})]
|
|
211
|
+
}, token);
|
|
212
|
+
})
|
|
213
|
+
}),
|
|
214
|
+
snapshot.darkTokens && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
215
|
+
className: "mt-2 mb-1 text-[10px] font-semibold text-violet-400",
|
|
216
|
+
children: "Dark"
|
|
217
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
218
|
+
className: "flex flex-wrap gap-1",
|
|
219
|
+
children: SWATCH_TOKENS.map(({ token, label }) => {
|
|
220
|
+
var _snapshot$darkTokens$, _snapshot$darkTokens;
|
|
221
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
222
|
+
className: "flex flex-col items-center gap-0.5",
|
|
223
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
224
|
+
className: "h-4 w-4 rounded-sm border border-white/15",
|
|
225
|
+
style: { backgroundColor: (_snapshot$darkTokens$ = (_snapshot$darkTokens = snapshot.darkTokens) === null || _snapshot$darkTokens === void 0 ? void 0 : _snapshot$darkTokens[token]) !== null && _snapshot$darkTokens$ !== void 0 ? _snapshot$darkTokens$ : "#333" }
|
|
226
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
227
|
+
className: "text-[7px] text-white/30",
|
|
228
|
+
children: label
|
|
229
|
+
})]
|
|
230
|
+
}, token);
|
|
231
|
+
})
|
|
232
|
+
})] })
|
|
233
|
+
] }),
|
|
234
|
+
isGenerated && snapshot.lightTokens && /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
|
|
235
|
+
className: "mb-1 text-[10px] font-semibold text-violet-400",
|
|
236
|
+
children: "Contrast"
|
|
237
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
238
|
+
className: "flex flex-col gap-0.5 text-[10px]",
|
|
239
|
+
children: CONTRAST_CHECK_PAIRS.map(({ fg, bg, label }) => {
|
|
240
|
+
var _snapshot$lightTokens3, _snapshot$lightTokens4, _snapshot$contrastPai;
|
|
241
|
+
const fgVal = (_snapshot$lightTokens3 = snapshot.lightTokens) === null || _snapshot$lightTokens3 === void 0 ? void 0 : _snapshot$lightTokens3[fg];
|
|
242
|
+
const bgVal = (_snapshot$lightTokens4 = snapshot.lightTokens) === null || _snapshot$lightTokens4 === void 0 ? void 0 : _snapshot$lightTokens4[bg];
|
|
243
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
244
|
+
className: "flex items-center gap-1.5",
|
|
245
|
+
children: [
|
|
246
|
+
/* @__PURE__ */ jsxs("div", {
|
|
247
|
+
className: "flex gap-0.5",
|
|
248
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
249
|
+
className: "h-3 w-3 rounded-sm border border-white/10",
|
|
250
|
+
style: { backgroundColor: fgVal !== null && fgVal !== void 0 ? fgVal : "#888" }
|
|
251
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
252
|
+
className: "h-3 w-3 rounded-sm border border-white/10",
|
|
253
|
+
style: { backgroundColor: bgVal !== null && bgVal !== void 0 ? bgVal : "#fff" }
|
|
254
|
+
})]
|
|
255
|
+
}),
|
|
256
|
+
/* @__PURE__ */ jsx("span", {
|
|
257
|
+
className: "text-white/50",
|
|
258
|
+
children: label
|
|
259
|
+
}),
|
|
260
|
+
(_snapshot$contrastPai = snapshot.contrastPairs) === null || _snapshot$contrastPai === void 0 ? void 0 : _snapshot$contrastPai.filter((p) => p.fg === fg && p.bg === bg).map((p, i) => /* @__PURE__ */ jsxs("span", {
|
|
261
|
+
className: p.level === "Fail" ? "text-red-400" : p.level === "AAA" ? "text-emerald-400" : "text-amber-300",
|
|
262
|
+
children: [
|
|
263
|
+
p.ratio.toFixed(1),
|
|
264
|
+
" ",
|
|
265
|
+
p.level
|
|
266
|
+
]
|
|
267
|
+
}, i))
|
|
268
|
+
]
|
|
269
|
+
}, label);
|
|
270
|
+
})
|
|
271
|
+
})] })
|
|
272
|
+
]
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
function useThemeDevtoolBridge({ id = "theme", label = "Theme", order = 15 } = {}) {
|
|
276
|
+
const [snapshot, setSnapshot] = React.useState(null);
|
|
277
|
+
const inspect = React.useCallback((nextSnapshot) => {
|
|
278
|
+
setSnapshot(nextSnapshot);
|
|
279
|
+
}, []);
|
|
280
|
+
useOptDevtoolPlugin(React.useMemo(() => ({
|
|
281
|
+
id,
|
|
282
|
+
label,
|
|
283
|
+
order,
|
|
284
|
+
renderPanel: () => /* @__PURE__ */ jsx(ThemeDevtoolPanel, { snapshot })
|
|
285
|
+
}), [
|
|
286
|
+
id,
|
|
287
|
+
label,
|
|
288
|
+
order,
|
|
289
|
+
snapshot
|
|
290
|
+
]));
|
|
291
|
+
return { inspect };
|
|
292
|
+
}
|
|
293
|
+
//#endregion
|
|
294
|
+
export { themeConfigToSnapshot, useThemeDevtoolBridge };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_provider = require("./provider-CLRiXjfD.cjs");
|
|
3
|
+
//#region src/theme-isolate.tsx
|
|
4
|
+
/**
|
|
5
|
+
* Style object that isolates opt-devtool from external themes.
|
|
6
|
+
*
|
|
7
|
+
* Applied to all opt-devtool root containers (panel, floating button,
|
|
8
|
+
* overlays). Uses inline styles because (a) inline beats every cascade in
|
|
9
|
+
* specificity short of an `!important` rule, and (b) the devtool panel
|
|
10
|
+
* must look identical regardless of the consumer's Tailwind preflight,
|
|
11
|
+
* `body { font-family }` reset, dark-mode toggling, etc.
|
|
12
|
+
*
|
|
13
|
+
* For full isolation against aggressive global CSS (`body * { ... !important }`)
|
|
14
|
+
* the only complete answer is Shadow DOM. We do **not** use Shadow DOM
|
|
15
|
+
* because the entire UI relies on Tailwind utility classes inherited from
|
|
16
|
+
* the consumer's stylesheet — moving into a closed shadow root would
|
|
17
|
+
* require shipping the compiled CSS bundle alongside the panel, which is a
|
|
18
|
+
* larger change than is justified for a dev-only overlay.
|
|
19
|
+
*
|
|
20
|
+
* `isolation: "isolate"` creates a fresh stacking context so z-index
|
|
21
|
+
* collisions with the host page can't reorder the panel.
|
|
22
|
+
*/
|
|
23
|
+
const ISOLATE_STYLE = {
|
|
24
|
+
color: "rgba(255, 255, 255, 0.8)",
|
|
25
|
+
fontFamily: "ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, monospace",
|
|
26
|
+
fontSize: "12px",
|
|
27
|
+
fontWeight: 400,
|
|
28
|
+
lineHeight: 1.5,
|
|
29
|
+
letterSpacing: "normal",
|
|
30
|
+
textTransform: "none",
|
|
31
|
+
textDecoration: "none",
|
|
32
|
+
fontStyle: "normal",
|
|
33
|
+
colorScheme: "dark",
|
|
34
|
+
textAlign: "left",
|
|
35
|
+
wordSpacing: "normal",
|
|
36
|
+
tabSize: 4,
|
|
37
|
+
isolation: "isolate",
|
|
38
|
+
boxSizing: "border-box"
|
|
39
|
+
};
|
|
40
|
+
/** Panel-specific style — solid opaque background that blocks page content. */
|
|
41
|
+
const PANEL_STYLE = require_provider._objectSpread2(require_provider._objectSpread2({}, ISOLATE_STYLE), {}, { backgroundColor: "#0a0a0a" });
|
|
42
|
+
//#endregion
|
|
43
|
+
Object.defineProperty(exports, "ISOLATE_STYLE", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function() {
|
|
46
|
+
return ISOLATE_STYLE;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(exports, "PANEL_STYLE", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function() {
|
|
52
|
+
return PANEL_STYLE;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { i as _objectSpread2 } from "./provider-Bn7CAE_Y.js";
|
|
3
|
+
//#region src/theme-isolate.tsx
|
|
4
|
+
/**
|
|
5
|
+
* Style object that isolates opt-devtool from external themes.
|
|
6
|
+
*
|
|
7
|
+
* Applied to all opt-devtool root containers (panel, floating button,
|
|
8
|
+
* overlays). Uses inline styles because (a) inline beats every cascade in
|
|
9
|
+
* specificity short of an `!important` rule, and (b) the devtool panel
|
|
10
|
+
* must look identical regardless of the consumer's Tailwind preflight,
|
|
11
|
+
* `body { font-family }` reset, dark-mode toggling, etc.
|
|
12
|
+
*
|
|
13
|
+
* For full isolation against aggressive global CSS (`body * { ... !important }`)
|
|
14
|
+
* the only complete answer is Shadow DOM. We do **not** use Shadow DOM
|
|
15
|
+
* because the entire UI relies on Tailwind utility classes inherited from
|
|
16
|
+
* the consumer's stylesheet — moving into a closed shadow root would
|
|
17
|
+
* require shipping the compiled CSS bundle alongside the panel, which is a
|
|
18
|
+
* larger change than is justified for a dev-only overlay.
|
|
19
|
+
*
|
|
20
|
+
* `isolation: "isolate"` creates a fresh stacking context so z-index
|
|
21
|
+
* collisions with the host page can't reorder the panel.
|
|
22
|
+
*/
|
|
23
|
+
const ISOLATE_STYLE = {
|
|
24
|
+
color: "rgba(255, 255, 255, 0.8)",
|
|
25
|
+
fontFamily: "ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, monospace",
|
|
26
|
+
fontSize: "12px",
|
|
27
|
+
fontWeight: 400,
|
|
28
|
+
lineHeight: 1.5,
|
|
29
|
+
letterSpacing: "normal",
|
|
30
|
+
textTransform: "none",
|
|
31
|
+
textDecoration: "none",
|
|
32
|
+
fontStyle: "normal",
|
|
33
|
+
colorScheme: "dark",
|
|
34
|
+
textAlign: "left",
|
|
35
|
+
wordSpacing: "normal",
|
|
36
|
+
tabSize: 4,
|
|
37
|
+
isolation: "isolate",
|
|
38
|
+
boxSizing: "border-box"
|
|
39
|
+
};
|
|
40
|
+
/** Panel-specific style — solid opaque background that blocks page content. */
|
|
41
|
+
const PANEL_STYLE = _objectSpread2(_objectSpread2({}, ISOLATE_STYLE), {}, { backgroundColor: "#0a0a0a" });
|
|
42
|
+
//#endregion
|
|
43
|
+
export { PANEL_STYLE as n, ISOLATE_STYLE as t };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region src/types.ts
|
|
3
|
+
const OPT_DEVTOOL_CONFIGURE_EVENT = "opt-devtool-configure";
|
|
4
|
+
//#endregion
|
|
5
|
+
Object.defineProperty(exports, "OPT_DEVTOOL_CONFIGURE_EVENT", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return OPT_DEVTOOL_CONFIGURE_EVENT;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
//#region src/i18n/ko.d.ts
|
|
4
|
+
/** opt-devtool Korean label catalog. Used as the package default. */
|
|
5
|
+
declare const koDevtoolLabels: OptDevtoolLabels;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/types.d.ts
|
|
8
|
+
declare const OPT_DEVTOOL_CONFIGURE_EVENT = "opt-devtool-configure";
|
|
9
|
+
/** Built-in overlay tab slots that inspect plugins can target. */
|
|
10
|
+
type OptDevtoolPluginTab = "component" | "editor" | "brandapp";
|
|
11
|
+
/** Runtime configuration payload for toggling opt-devtool state. */
|
|
12
|
+
interface OptDevtoolConfig {
|
|
13
|
+
visible?: boolean;
|
|
14
|
+
showGuide?: boolean;
|
|
15
|
+
showTabOrder?: boolean;
|
|
16
|
+
showSpatialNav?: boolean;
|
|
17
|
+
showEventLog?: boolean;
|
|
18
|
+
showComponentTrace?: boolean;
|
|
19
|
+
showComponentTree?: boolean;
|
|
20
|
+
showInspect?: boolean;
|
|
21
|
+
showComponentLabels?: boolean;
|
|
22
|
+
showCompositeBounds?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/** Page-local module plugin registered into the opt-devtool overlay. */
|
|
25
|
+
interface OptDevtoolPlugin {
|
|
26
|
+
id: string;
|
|
27
|
+
label: string;
|
|
28
|
+
order?: number;
|
|
29
|
+
tab?: OptDevtoolPluginTab;
|
|
30
|
+
renderPanel: () => React.ReactNode;
|
|
31
|
+
renderOverlay?: () => React.ReactNode;
|
|
32
|
+
}
|
|
33
|
+
/** Localised strings rendered inside the devtool overlay. */
|
|
34
|
+
interface OptDevtoolLabels {
|
|
35
|
+
panelTitle: string;
|
|
36
|
+
toggleHint: string;
|
|
37
|
+
copyButtonTooltip: string;
|
|
38
|
+
closeButton: string;
|
|
39
|
+
tabComponent: string;
|
|
40
|
+
tabEditor: string;
|
|
41
|
+
tabBrandapp: string;
|
|
42
|
+
tabTheme: string;
|
|
43
|
+
tabHarness: string;
|
|
44
|
+
emptyComponent: string;
|
|
45
|
+
emptyEditor: string;
|
|
46
|
+
emptyBrandapp: string;
|
|
47
|
+
emptyEnginePanel: string;
|
|
48
|
+
inspectingPinned: string;
|
|
49
|
+
inspecting: string;
|
|
50
|
+
currentFocus: string;
|
|
51
|
+
componentTrace: string;
|
|
52
|
+
componentTree: string;
|
|
53
|
+
noReactComponent: string;
|
|
54
|
+
tabOrderInline: string;
|
|
55
|
+
tabOrderOut: string;
|
|
56
|
+
tabOrderHint: string;
|
|
57
|
+
shiftTabPrev: string;
|
|
58
|
+
tabNext: string;
|
|
59
|
+
arrowKeysTitle: (type: string, index: number, total: number) => string;
|
|
60
|
+
loopBadge: string;
|
|
61
|
+
wrapBadge: string;
|
|
62
|
+
noArrowTarget: string;
|
|
63
|
+
spatialNav: string;
|
|
64
|
+
spatialProtected: string;
|
|
65
|
+
spatialNoCandidate: string;
|
|
66
|
+
spatialTrappedContext: (context: string) => string;
|
|
67
|
+
history: string;
|
|
68
|
+
eventLogTitle: string;
|
|
69
|
+
eventLogClear: string;
|
|
70
|
+
eventLogWaiting: string;
|
|
71
|
+
overlaysSection: string;
|
|
72
|
+
panelsSection: string;
|
|
73
|
+
toggleGuide: string;
|
|
74
|
+
toggleTabOrder: string;
|
|
75
|
+
toggleSpatialNav: string;
|
|
76
|
+
toggleComponentLabels: string;
|
|
77
|
+
toggleCompositeBounds: string;
|
|
78
|
+
toggleComponentTrace: string;
|
|
79
|
+
toggleComponentTree: string;
|
|
80
|
+
toggleEventLog: string;
|
|
81
|
+
toggleInspect: string;
|
|
82
|
+
trapped: string;
|
|
83
|
+
protected: string;
|
|
84
|
+
filterUser: string;
|
|
85
|
+
filterPrimitives: string;
|
|
86
|
+
filterAll: string;
|
|
87
|
+
}
|
|
88
|
+
/** Root overlay props. */
|
|
89
|
+
interface OptDevtoolProps {
|
|
90
|
+
defaultOpen?: boolean;
|
|
91
|
+
/** Override individual labels. Falls back to {@link defaultLabels} (Korean). */
|
|
92
|
+
labels?: Partial<OptDevtoolLabels>;
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
export { OptDevtoolPluginTab as a, OptDevtoolPlugin as i, OptDevtoolConfig as n, OptDevtoolProps as o, OptDevtoolLabels as r, koDevtoolLabels as s, OPT_DEVTOOL_CONFIGURE_EVENT as t };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
//#region src/i18n/ko.d.ts
|
|
4
|
+
/** opt-devtool Korean label catalog. Used as the package default. */
|
|
5
|
+
declare const koDevtoolLabels: OptDevtoolLabels;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/types.d.ts
|
|
8
|
+
declare const OPT_DEVTOOL_CONFIGURE_EVENT = "opt-devtool-configure";
|
|
9
|
+
/** Built-in overlay tab slots that inspect plugins can target. */
|
|
10
|
+
type OptDevtoolPluginTab = "component" | "editor" | "brandapp";
|
|
11
|
+
/** Runtime configuration payload for toggling opt-devtool state. */
|
|
12
|
+
interface OptDevtoolConfig {
|
|
13
|
+
visible?: boolean;
|
|
14
|
+
showGuide?: boolean;
|
|
15
|
+
showTabOrder?: boolean;
|
|
16
|
+
showSpatialNav?: boolean;
|
|
17
|
+
showEventLog?: boolean;
|
|
18
|
+
showComponentTrace?: boolean;
|
|
19
|
+
showComponentTree?: boolean;
|
|
20
|
+
showInspect?: boolean;
|
|
21
|
+
showComponentLabels?: boolean;
|
|
22
|
+
showCompositeBounds?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/** Page-local module plugin registered into the opt-devtool overlay. */
|
|
25
|
+
interface OptDevtoolPlugin {
|
|
26
|
+
id: string;
|
|
27
|
+
label: string;
|
|
28
|
+
order?: number;
|
|
29
|
+
tab?: OptDevtoolPluginTab;
|
|
30
|
+
renderPanel: () => React.ReactNode;
|
|
31
|
+
renderOverlay?: () => React.ReactNode;
|
|
32
|
+
}
|
|
33
|
+
/** Localised strings rendered inside the devtool overlay. */
|
|
34
|
+
interface OptDevtoolLabels {
|
|
35
|
+
panelTitle: string;
|
|
36
|
+
toggleHint: string;
|
|
37
|
+
copyButtonTooltip: string;
|
|
38
|
+
closeButton: string;
|
|
39
|
+
tabComponent: string;
|
|
40
|
+
tabEditor: string;
|
|
41
|
+
tabBrandapp: string;
|
|
42
|
+
tabTheme: string;
|
|
43
|
+
tabHarness: string;
|
|
44
|
+
emptyComponent: string;
|
|
45
|
+
emptyEditor: string;
|
|
46
|
+
emptyBrandapp: string;
|
|
47
|
+
emptyEnginePanel: string;
|
|
48
|
+
inspectingPinned: string;
|
|
49
|
+
inspecting: string;
|
|
50
|
+
currentFocus: string;
|
|
51
|
+
componentTrace: string;
|
|
52
|
+
componentTree: string;
|
|
53
|
+
noReactComponent: string;
|
|
54
|
+
tabOrderInline: string;
|
|
55
|
+
tabOrderOut: string;
|
|
56
|
+
tabOrderHint: string;
|
|
57
|
+
shiftTabPrev: string;
|
|
58
|
+
tabNext: string;
|
|
59
|
+
arrowKeysTitle: (type: string, index: number, total: number) => string;
|
|
60
|
+
loopBadge: string;
|
|
61
|
+
wrapBadge: string;
|
|
62
|
+
noArrowTarget: string;
|
|
63
|
+
spatialNav: string;
|
|
64
|
+
spatialProtected: string;
|
|
65
|
+
spatialNoCandidate: string;
|
|
66
|
+
spatialTrappedContext: (context: string) => string;
|
|
67
|
+
history: string;
|
|
68
|
+
eventLogTitle: string;
|
|
69
|
+
eventLogClear: string;
|
|
70
|
+
eventLogWaiting: string;
|
|
71
|
+
overlaysSection: string;
|
|
72
|
+
panelsSection: string;
|
|
73
|
+
toggleGuide: string;
|
|
74
|
+
toggleTabOrder: string;
|
|
75
|
+
toggleSpatialNav: string;
|
|
76
|
+
toggleComponentLabels: string;
|
|
77
|
+
toggleCompositeBounds: string;
|
|
78
|
+
toggleComponentTrace: string;
|
|
79
|
+
toggleComponentTree: string;
|
|
80
|
+
toggleEventLog: string;
|
|
81
|
+
toggleInspect: string;
|
|
82
|
+
trapped: string;
|
|
83
|
+
protected: string;
|
|
84
|
+
filterUser: string;
|
|
85
|
+
filterPrimitives: string;
|
|
86
|
+
filterAll: string;
|
|
87
|
+
}
|
|
88
|
+
/** Root overlay props. */
|
|
89
|
+
interface OptDevtoolProps {
|
|
90
|
+
defaultOpen?: boolean;
|
|
91
|
+
/** Override individual labels. Falls back to {@link defaultLabels} (Korean). */
|
|
92
|
+
labels?: Partial<OptDevtoolLabels>;
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
export { OptDevtoolPluginTab as a, OptDevtoolPlugin as i, OptDevtoolConfig as n, OptDevtoolProps as o, OptDevtoolLabels as r, koDevtoolLabels as s, OPT_DEVTOOL_CONFIGURE_EVENT as t };
|
package/dist/ui/index.cjs
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
"use
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
require('../chunk-N7YO56TN.cjs');
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.OPT_DEVTOOL_CONFIGURE_EVENT = _chunk4MJKIAXHcjs.OPT_DEVTOOL_CONFIGURE_EVENT;
|
|
1
|
+
"use client";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const require_types = require("../types-B_abMm2B.cjs");
|
|
4
|
+
exports.OPT_DEVTOOL_CONFIGURE_EVENT = require_types.OPT_DEVTOOL_CONFIGURE_EVENT;
|