@reopt-ai/opt-devtool 1.0.0 → 1.0.2
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/README.md +11 -2
- package/dist/brandapp/index.cjs +457 -363
- package/dist/brandapp/index.d.cts +80 -81
- package/dist/brandapp/index.d.ts +80 -81
- package/dist/brandapp/index.js +451 -361
- package/dist/datagrid/index.cjs +170 -180
- package/dist/datagrid/index.d.cts +9 -11
- package/dist/datagrid/index.d.ts +9 -11
- package/dist/datagrid/index.js +167 -179
- package/dist/editor/index.cjs +209 -228
- package/dist/editor/index.d.cts +9 -11
- package/dist/editor/index.d.ts +9 -11
- package/dist/editor/index.js +206 -227
- package/dist/harness/index.cjs +5 -12
- package/dist/harness/index.d.cts +14 -16
- package/dist/harness/index.d.ts +14 -16
- package/dist/harness/index.js +1 -11
- package/dist/harness-CJZXBH3w.js +528 -0
- package/dist/harness-CPOp9Wlj.cjs +582 -0
- package/dist/index.cjs +3619 -3782
- package/dist/index.d.cts +9 -17
- package/dist/index.d.ts +9 -17
- package/dist/index.js +3611 -3781
- package/dist/provider-Cjg2rSYG.js +110 -0
- package/dist/provider-H53ZWHCo.cjs +161 -0
- package/dist/theme/index.cjs +298 -12
- package/dist/theme/index.d.cts +26 -28
- package/dist/theme/index.d.ts +26 -28
- package/dist/theme/index.js +294 -11
- package/dist/theme-isolate-BOo3J259.js +42 -0
- package/dist/theme-isolate-D9AMkYrD.cjs +53 -0
- package/dist/types-BKmW0EBr.js +4 -0
- package/dist/types-Bz4DijhU.cjs +9 -0
- package/dist/types-D_lNT2Nr.d.cts +91 -0
- package/dist/types-D_lNT2Nr.d.ts +91 -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 +1 -7
- package/package.json +4 -4
- 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,31 @@
|
|
|
1
|
-
import { ResolvedShellThemeConfig } from '@reopt-ai/opt-shell';
|
|
2
1
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
2
|
+
import { ResolvedShellThemeConfig } from "@reopt-ai/opt-shell";
|
|
3
|
+
export interface ThemeDevtoolSnapshot {
|
|
4
|
+
mode: "preset" | "generated";
|
|
5
|
+
preset: string;
|
|
6
|
+
seed?: string;
|
|
7
|
+
harmony?: string;
|
|
8
|
+
radiusScale?: string;
|
|
9
|
+
shadowIntensity?: string;
|
|
10
|
+
neutralTemperature?: string;
|
|
11
|
+
forceLightOnly: boolean;
|
|
12
|
+
lightTokens?: Record<string, string>;
|
|
13
|
+
darkTokens?: Record<string, string>;
|
|
14
|
+
contrastPairs?: {
|
|
15
|
+
fg: string;
|
|
16
|
+
bg: string;
|
|
17
|
+
ratio: number;
|
|
18
|
+
level: "AAA" | "AA" | "Fail";
|
|
19
|
+
}[];
|
|
20
20
|
}
|
|
21
|
-
interface UseThemeDevtoolBridgeOptions {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
export interface UseThemeDevtoolBridgeOptions {
|
|
22
|
+
id?: string;
|
|
23
|
+
label?: string;
|
|
24
|
+
order?: number;
|
|
25
25
|
}
|
|
26
|
-
interface RegisteredThemeDevtoolBridge {
|
|
27
|
-
|
|
26
|
+
export interface RegisteredThemeDevtoolBridge {
|
|
27
|
+
inspect: (snapshot: ThemeDevtoolSnapshot) => void;
|
|
28
28
|
}
|
|
29
29
|
/** Build a ThemeDevtoolSnapshot from a ResolvedShellThemeConfig */
|
|
30
|
-
declare function themeConfigToSnapshot(theme: ResolvedShellThemeConfig): ThemeDevtoolSnapshot;
|
|
31
|
-
declare function useThemeDevtoolBridge({ id, label, order
|
|
32
|
-
|
|
33
|
-
export { type RegisteredThemeDevtoolBridge, type ThemeDevtoolSnapshot, type UseThemeDevtoolBridgeOptions, themeConfigToSnapshot, useThemeDevtoolBridge };
|
|
30
|
+
export declare function themeConfigToSnapshot(theme: ResolvedShellThemeConfig): ThemeDevtoolSnapshot;
|
|
31
|
+
export declare function useThemeDevtoolBridge({ id, label, order }?: UseThemeDevtoolBridgeOptions): RegisteredThemeDevtoolBridge;
|
package/dist/theme/index.js
CHANGED
|
@@ -1,13 +1,296 @@
|
|
|
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-Cjg2rSYG.js";
|
|
4
|
+
import { t as ISOLATE_STYLE } from "../theme-isolate-BOo3J259.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
|
+
// 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 fgRgb = hexToSrgb(fgVal);
|
|
22
|
+
const bgRgb = hexToSrgb(bgVal);
|
|
23
|
+
const ratio = contrastRatio(fgRgb, bgRgb);
|
|
24
|
+
results.push({
|
|
25
|
+
fg: fgName,
|
|
26
|
+
bg: bgName,
|
|
27
|
+
ratio,
|
|
28
|
+
level: wcagLevel(ratio)
|
|
29
|
+
});
|
|
30
|
+
} catch (_unused) {}
|
|
31
|
+
}
|
|
32
|
+
return results;
|
|
33
|
+
}
|
|
34
|
+
/** Build a ThemeDevtoolSnapshot from a ResolvedShellThemeConfig */
|
|
35
|
+
function themeConfigToSnapshot(theme) {
|
|
36
|
+
if (theme.mode === "generated") return {
|
|
37
|
+
mode: theme.mode,
|
|
38
|
+
preset: theme.preset,
|
|
39
|
+
seed: theme.palette.seed,
|
|
40
|
+
harmony: theme.palette.harmony,
|
|
41
|
+
radiusScale: theme.palette.radiusScale,
|
|
42
|
+
shadowIntensity: theme.palette.shadowIntensity,
|
|
43
|
+
neutralTemperature: theme.palette.neutralTemperature,
|
|
44
|
+
forceLightOnly: theme.forceLightOnly,
|
|
45
|
+
lightTokens: theme.generatedLightTokens,
|
|
46
|
+
darkTokens: theme.generatedDarkTokens,
|
|
47
|
+
contrastPairs: computeContrastPairs(theme.generatedLightTokens)
|
|
48
|
+
};
|
|
49
|
+
return {
|
|
50
|
+
mode: theme.mode,
|
|
51
|
+
preset: theme.preset,
|
|
52
|
+
seed: void 0,
|
|
53
|
+
harmony: void 0,
|
|
54
|
+
radiusScale: void 0,
|
|
55
|
+
shadowIntensity: void 0,
|
|
56
|
+
neutralTemperature: void 0,
|
|
57
|
+
forceLightOnly: theme.forceLightOnly,
|
|
58
|
+
lightTokens: void 0,
|
|
59
|
+
darkTokens: void 0,
|
|
60
|
+
contrastPairs: void 0
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
const SWATCH_TOKENS = [
|
|
64
|
+
{
|
|
65
|
+
token: "--opt-accent",
|
|
66
|
+
label: "Accent"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
token: "--opt-surface",
|
|
70
|
+
label: "Surface"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
token: "--opt-text",
|
|
74
|
+
label: "Text"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
token: "--opt-bg",
|
|
78
|
+
label: "BG"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
token: "--opt-border",
|
|
82
|
+
label: "Border"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
token: "--opt-success",
|
|
86
|
+
label: "OK"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
token: "--opt-warning",
|
|
90
|
+
label: "Warn"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
token: "--opt-danger",
|
|
94
|
+
label: "Err"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
token: "--opt-chart-1",
|
|
98
|
+
label: "C1"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
token: "--opt-chart-2",
|
|
102
|
+
label: "C2"
|
|
103
|
+
}
|
|
104
|
+
];
|
|
105
|
+
const CONTRAST_CHECK_PAIRS = [
|
|
106
|
+
{
|
|
107
|
+
fg: "--opt-text",
|
|
108
|
+
bg: "--opt-surface",
|
|
109
|
+
label: "text/surface"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
fg: "--opt-accent-fg",
|
|
113
|
+
bg: "--opt-accent",
|
|
114
|
+
label: "accentFg/accent"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
fg: "--opt-text-secondary",
|
|
118
|
+
bg: "--opt-surface",
|
|
119
|
+
label: "text2nd/surface"
|
|
120
|
+
}
|
|
121
|
+
];
|
|
122
|
+
function ThemeDevtoolPanel({ snapshot }) {
|
|
123
|
+
if (!snapshot) return /* @__PURE__ */ jsx("div", {
|
|
124
|
+
className: "text-[11px] text-white/55",
|
|
125
|
+
children: "Waiting for Theme snapshot."
|
|
126
|
+
});
|
|
127
|
+
const isGenerated = snapshot.mode === "generated";
|
|
128
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
129
|
+
className: "flex flex-col gap-3 text-[11px]",
|
|
130
|
+
style: ISOLATE_STYLE,
|
|
131
|
+
children: [
|
|
132
|
+
/* @__PURE__ */ jsxs("div", {
|
|
133
|
+
className: "flex items-center gap-2",
|
|
134
|
+
children: [
|
|
135
|
+
/* @__PURE__ */ jsx("span", { className: `inline-block h-1.5 w-1.5 rounded-full ${isGenerated ? "bg-violet-400" : "bg-white/30"}` }),
|
|
136
|
+
/* @__PURE__ */ jsx("span", {
|
|
137
|
+
className: isGenerated ? "text-violet-300" : "text-white/60",
|
|
138
|
+
children: isGenerated ? "Generated" : `Preset: ${snapshot.preset}`
|
|
139
|
+
}),
|
|
140
|
+
snapshot.forceLightOnly && /* @__PURE__ */ jsx("span", {
|
|
141
|
+
className: "text-[9px] text-amber-400",
|
|
142
|
+
children: "light-only"
|
|
143
|
+
})
|
|
144
|
+
]
|
|
145
|
+
}),
|
|
146
|
+
isGenerated && snapshot.seed && /* @__PURE__ */ jsxs("div", {
|
|
147
|
+
className: "flex flex-col gap-1.5",
|
|
148
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
149
|
+
className: "flex items-center gap-2",
|
|
150
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
151
|
+
className: "h-5 w-5 rounded border border-white/20",
|
|
152
|
+
style: { backgroundColor: snapshot.seed }
|
|
153
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
154
|
+
className: "font-mono text-[10px] text-white/70",
|
|
155
|
+
children: snapshot.seed
|
|
156
|
+
})]
|
|
157
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
158
|
+
className: "grid grid-cols-2 gap-x-3 gap-y-0.5 text-[10px] text-white/50",
|
|
159
|
+
children: [
|
|
160
|
+
snapshot.harmony && /* @__PURE__ */ jsxs("div", { children: [
|
|
161
|
+
/* @__PURE__ */ jsx("span", {
|
|
162
|
+
className: "text-white/30",
|
|
163
|
+
children: "Harmony"
|
|
164
|
+
}),
|
|
165
|
+
" ",
|
|
166
|
+
snapshot.harmony
|
|
167
|
+
] }),
|
|
168
|
+
snapshot.radiusScale && /* @__PURE__ */ jsxs("div", { children: [
|
|
169
|
+
/* @__PURE__ */ jsx("span", {
|
|
170
|
+
className: "text-white/30",
|
|
171
|
+
children: "Radius"
|
|
172
|
+
}),
|
|
173
|
+
" ",
|
|
174
|
+
snapshot.radiusScale
|
|
175
|
+
] }),
|
|
176
|
+
snapshot.shadowIntensity && /* @__PURE__ */ jsxs("div", { children: [
|
|
177
|
+
/* @__PURE__ */ jsx("span", {
|
|
178
|
+
className: "text-white/30",
|
|
179
|
+
children: "Shadow"
|
|
180
|
+
}),
|
|
181
|
+
" ",
|
|
182
|
+
snapshot.shadowIntensity
|
|
183
|
+
] }),
|
|
184
|
+
snapshot.neutralTemperature && /* @__PURE__ */ jsxs("div", { children: [
|
|
185
|
+
/* @__PURE__ */ jsx("span", {
|
|
186
|
+
className: "text-white/30",
|
|
187
|
+
children: "Temp"
|
|
188
|
+
}),
|
|
189
|
+
" ",
|
|
190
|
+
snapshot.neutralTemperature
|
|
191
|
+
] })
|
|
192
|
+
]
|
|
193
|
+
})]
|
|
194
|
+
}),
|
|
195
|
+
isGenerated && snapshot.lightTokens && /* @__PURE__ */ jsxs("div", { children: [
|
|
196
|
+
/* @__PURE__ */ jsx("div", {
|
|
197
|
+
className: "mb-1 text-[10px] font-semibold text-violet-400",
|
|
198
|
+
children: "Light"
|
|
199
|
+
}),
|
|
200
|
+
/* @__PURE__ */ jsx("div", {
|
|
201
|
+
className: "flex flex-wrap gap-1",
|
|
202
|
+
children: SWATCH_TOKENS.map(({ token, label }) => {
|
|
203
|
+
var _snapshot$lightTokens, _snapshot$lightTokens2;
|
|
204
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
205
|
+
className: "flex flex-col items-center gap-0.5",
|
|
206
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
207
|
+
className: "h-4 w-4 rounded-sm border border-white/15",
|
|
208
|
+
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" }
|
|
209
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
210
|
+
className: "text-[7px] text-white/30",
|
|
211
|
+
children: label
|
|
212
|
+
})]
|
|
213
|
+
}, token);
|
|
214
|
+
})
|
|
215
|
+
}),
|
|
216
|
+
snapshot.darkTokens && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
217
|
+
className: "mt-2 mb-1 text-[10px] font-semibold text-violet-400",
|
|
218
|
+
children: "Dark"
|
|
219
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
220
|
+
className: "flex flex-wrap gap-1",
|
|
221
|
+
children: SWATCH_TOKENS.map(({ token, label }) => {
|
|
222
|
+
var _snapshot$darkTokens$, _snapshot$darkTokens;
|
|
223
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
224
|
+
className: "flex flex-col items-center gap-0.5",
|
|
225
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
226
|
+
className: "h-4 w-4 rounded-sm border border-white/15",
|
|
227
|
+
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" }
|
|
228
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
229
|
+
className: "text-[7px] text-white/30",
|
|
230
|
+
children: label
|
|
231
|
+
})]
|
|
232
|
+
}, token);
|
|
233
|
+
})
|
|
234
|
+
})] })
|
|
235
|
+
] }),
|
|
236
|
+
isGenerated && snapshot.lightTokens && /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
|
|
237
|
+
className: "mb-1 text-[10px] font-semibold text-violet-400",
|
|
238
|
+
children: "Contrast"
|
|
239
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
240
|
+
className: "flex flex-col gap-0.5 text-[10px]",
|
|
241
|
+
children: CONTRAST_CHECK_PAIRS.map(({ fg, bg, label }) => {
|
|
242
|
+
var _snapshot$lightTokens3, _snapshot$lightTokens4, _snapshot$contrastPai;
|
|
243
|
+
const fgVal = (_snapshot$lightTokens3 = snapshot.lightTokens) === null || _snapshot$lightTokens3 === void 0 ? void 0 : _snapshot$lightTokens3[fg];
|
|
244
|
+
const bgVal = (_snapshot$lightTokens4 = snapshot.lightTokens) === null || _snapshot$lightTokens4 === void 0 ? void 0 : _snapshot$lightTokens4[bg];
|
|
245
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
246
|
+
className: "flex items-center gap-1.5",
|
|
247
|
+
children: [
|
|
248
|
+
/* @__PURE__ */ jsxs("div", {
|
|
249
|
+
className: "flex gap-0.5",
|
|
250
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
251
|
+
className: "h-3 w-3 rounded-sm border border-white/10",
|
|
252
|
+
style: { backgroundColor: fgVal !== null && fgVal !== void 0 ? fgVal : "#888" }
|
|
253
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
254
|
+
className: "h-3 w-3 rounded-sm border border-white/10",
|
|
255
|
+
style: { backgroundColor: bgVal !== null && bgVal !== void 0 ? bgVal : "#fff" }
|
|
256
|
+
})]
|
|
257
|
+
}),
|
|
258
|
+
/* @__PURE__ */ jsx("span", {
|
|
259
|
+
className: "text-white/50",
|
|
260
|
+
children: label
|
|
261
|
+
}),
|
|
262
|
+
(_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", {
|
|
263
|
+
className: p.level === "Fail" ? "text-red-400" : p.level === "AAA" ? "text-emerald-400" : "text-amber-300",
|
|
264
|
+
children: [
|
|
265
|
+
p.ratio.toFixed(1),
|
|
266
|
+
" ",
|
|
267
|
+
p.level
|
|
268
|
+
]
|
|
269
|
+
}, i))
|
|
270
|
+
]
|
|
271
|
+
}, label);
|
|
272
|
+
})
|
|
273
|
+
})] })
|
|
274
|
+
]
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
function useThemeDevtoolBridge({ id = "theme", label = "Theme", order = 15 } = {}) {
|
|
278
|
+
const [snapshot, setSnapshot] = React.useState(null);
|
|
279
|
+
const inspect = React.useCallback((nextSnapshot) => {
|
|
280
|
+
setSnapshot(nextSnapshot);
|
|
281
|
+
}, []);
|
|
282
|
+
const plugin = React.useMemo(() => ({
|
|
283
|
+
id,
|
|
284
|
+
label,
|
|
285
|
+
order,
|
|
286
|
+
renderPanel: () => /* @__PURE__ */ jsx(ThemeDevtoolPanel, { snapshot })
|
|
287
|
+
}), [
|
|
288
|
+
id,
|
|
289
|
+
label,
|
|
290
|
+
order,
|
|
291
|
+
snapshot
|
|
292
|
+
]);
|
|
293
|
+
useOptDevtoolPlugin(plugin);
|
|
294
|
+
return { inspect };
|
|
295
|
+
}
|
|
296
|
+
export { themeConfigToSnapshot, useThemeDevtoolBridge };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { i as _objectSpread2 } from "./provider-Cjg2rSYG.js";
|
|
3
|
+
// 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
|
+
export { PANEL_STYLE as n, ISOLATE_STYLE as t };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_provider = require("./provider-H53ZWHCo.cjs");
|
|
3
|
+
// 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
|
+
Object.defineProperty(exports, "ISOLATE_STYLE", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function() {
|
|
45
|
+
return ISOLATE_STYLE;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "PANEL_STYLE", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function() {
|
|
51
|
+
return PANEL_STYLE;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
/** opt-devtool Korean label catalog. Used as the package default. */
|
|
4
|
+
declare const koDevtoolLabels: OptDevtoolLabels;
|
|
5
|
+
declare const OPT_DEVTOOL_CONFIGURE_EVENT = "opt-devtool-configure";
|
|
6
|
+
/** Built-in overlay tab slots that inspect plugins can target. */
|
|
7
|
+
type OptDevtoolPluginTab = "component" | "editor" | "brandapp";
|
|
8
|
+
/** Runtime configuration payload for toggling opt-devtool state. */
|
|
9
|
+
interface OptDevtoolConfig {
|
|
10
|
+
visible?: boolean;
|
|
11
|
+
showGuide?: boolean;
|
|
12
|
+
showTabOrder?: boolean;
|
|
13
|
+
showSpatialNav?: boolean;
|
|
14
|
+
showEventLog?: boolean;
|
|
15
|
+
showComponentTrace?: boolean;
|
|
16
|
+
showComponentTree?: boolean;
|
|
17
|
+
showInspect?: boolean;
|
|
18
|
+
showComponentLabels?: boolean;
|
|
19
|
+
showCompositeBounds?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** Page-local module plugin registered into the opt-devtool overlay. */
|
|
22
|
+
interface OptDevtoolPlugin {
|
|
23
|
+
id: string;
|
|
24
|
+
label: string;
|
|
25
|
+
order?: number;
|
|
26
|
+
tab?: OptDevtoolPluginTab;
|
|
27
|
+
renderPanel: () => React.ReactNode;
|
|
28
|
+
renderOverlay?: () => React.ReactNode;
|
|
29
|
+
}
|
|
30
|
+
/** Localised strings rendered inside the devtool overlay. */
|
|
31
|
+
interface OptDevtoolLabels {
|
|
32
|
+
panelTitle: string;
|
|
33
|
+
toggleHint: string;
|
|
34
|
+
copyButtonTooltip: string;
|
|
35
|
+
closeButton: string;
|
|
36
|
+
tabComponent: string;
|
|
37
|
+
tabEditor: string;
|
|
38
|
+
tabBrandapp: string;
|
|
39
|
+
tabTheme: string;
|
|
40
|
+
tabHarness: string;
|
|
41
|
+
emptyComponent: string;
|
|
42
|
+
emptyEditor: string;
|
|
43
|
+
emptyBrandapp: string;
|
|
44
|
+
emptyEnginePanel: string;
|
|
45
|
+
inspectingPinned: string;
|
|
46
|
+
inspecting: string;
|
|
47
|
+
currentFocus: string;
|
|
48
|
+
componentTrace: string;
|
|
49
|
+
componentTree: string;
|
|
50
|
+
noReactComponent: string;
|
|
51
|
+
tabOrderInline: string;
|
|
52
|
+
tabOrderOut: string;
|
|
53
|
+
tabOrderHint: string;
|
|
54
|
+
shiftTabPrev: string;
|
|
55
|
+
tabNext: string;
|
|
56
|
+
arrowKeysTitle: (type: string, index: number, total: number) => string;
|
|
57
|
+
loopBadge: string;
|
|
58
|
+
wrapBadge: string;
|
|
59
|
+
noArrowTarget: string;
|
|
60
|
+
spatialNav: string;
|
|
61
|
+
spatialProtected: string;
|
|
62
|
+
spatialNoCandidate: string;
|
|
63
|
+
spatialTrappedContext: (context: string) => string;
|
|
64
|
+
history: string;
|
|
65
|
+
eventLogTitle: string;
|
|
66
|
+
eventLogClear: string;
|
|
67
|
+
eventLogWaiting: string;
|
|
68
|
+
overlaysSection: string;
|
|
69
|
+
panelsSection: string;
|
|
70
|
+
toggleGuide: string;
|
|
71
|
+
toggleTabOrder: string;
|
|
72
|
+
toggleSpatialNav: string;
|
|
73
|
+
toggleComponentLabels: string;
|
|
74
|
+
toggleCompositeBounds: string;
|
|
75
|
+
toggleComponentTrace: string;
|
|
76
|
+
toggleComponentTree: string;
|
|
77
|
+
toggleEventLog: string;
|
|
78
|
+
toggleInspect: string;
|
|
79
|
+
trapped: string;
|
|
80
|
+
protected: string;
|
|
81
|
+
filterUser: string;
|
|
82
|
+
filterPrimitives: string;
|
|
83
|
+
filterAll: string;
|
|
84
|
+
}
|
|
85
|
+
/** Root overlay props. */
|
|
86
|
+
interface OptDevtoolProps {
|
|
87
|
+
defaultOpen?: boolean;
|
|
88
|
+
/** Override individual labels. Falls back to {@link defaultLabels} (Korean). */
|
|
89
|
+
labels?: Partial<OptDevtoolLabels>;
|
|
90
|
+
}
|
|
91
|
+
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,91 @@
|
|
|
1
|
+
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
/** opt-devtool Korean label catalog. Used as the package default. */
|
|
4
|
+
declare const koDevtoolLabels: OptDevtoolLabels;
|
|
5
|
+
declare const OPT_DEVTOOL_CONFIGURE_EVENT = "opt-devtool-configure";
|
|
6
|
+
/** Built-in overlay tab slots that inspect plugins can target. */
|
|
7
|
+
type OptDevtoolPluginTab = "component" | "editor" | "brandapp";
|
|
8
|
+
/** Runtime configuration payload for toggling opt-devtool state. */
|
|
9
|
+
interface OptDevtoolConfig {
|
|
10
|
+
visible?: boolean;
|
|
11
|
+
showGuide?: boolean;
|
|
12
|
+
showTabOrder?: boolean;
|
|
13
|
+
showSpatialNav?: boolean;
|
|
14
|
+
showEventLog?: boolean;
|
|
15
|
+
showComponentTrace?: boolean;
|
|
16
|
+
showComponentTree?: boolean;
|
|
17
|
+
showInspect?: boolean;
|
|
18
|
+
showComponentLabels?: boolean;
|
|
19
|
+
showCompositeBounds?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** Page-local module plugin registered into the opt-devtool overlay. */
|
|
22
|
+
interface OptDevtoolPlugin {
|
|
23
|
+
id: string;
|
|
24
|
+
label: string;
|
|
25
|
+
order?: number;
|
|
26
|
+
tab?: OptDevtoolPluginTab;
|
|
27
|
+
renderPanel: () => React.ReactNode;
|
|
28
|
+
renderOverlay?: () => React.ReactNode;
|
|
29
|
+
}
|
|
30
|
+
/** Localised strings rendered inside the devtool overlay. */
|
|
31
|
+
interface OptDevtoolLabels {
|
|
32
|
+
panelTitle: string;
|
|
33
|
+
toggleHint: string;
|
|
34
|
+
copyButtonTooltip: string;
|
|
35
|
+
closeButton: string;
|
|
36
|
+
tabComponent: string;
|
|
37
|
+
tabEditor: string;
|
|
38
|
+
tabBrandapp: string;
|
|
39
|
+
tabTheme: string;
|
|
40
|
+
tabHarness: string;
|
|
41
|
+
emptyComponent: string;
|
|
42
|
+
emptyEditor: string;
|
|
43
|
+
emptyBrandapp: string;
|
|
44
|
+
emptyEnginePanel: string;
|
|
45
|
+
inspectingPinned: string;
|
|
46
|
+
inspecting: string;
|
|
47
|
+
currentFocus: string;
|
|
48
|
+
componentTrace: string;
|
|
49
|
+
componentTree: string;
|
|
50
|
+
noReactComponent: string;
|
|
51
|
+
tabOrderInline: string;
|
|
52
|
+
tabOrderOut: string;
|
|
53
|
+
tabOrderHint: string;
|
|
54
|
+
shiftTabPrev: string;
|
|
55
|
+
tabNext: string;
|
|
56
|
+
arrowKeysTitle: (type: string, index: number, total: number) => string;
|
|
57
|
+
loopBadge: string;
|
|
58
|
+
wrapBadge: string;
|
|
59
|
+
noArrowTarget: string;
|
|
60
|
+
spatialNav: string;
|
|
61
|
+
spatialProtected: string;
|
|
62
|
+
spatialNoCandidate: string;
|
|
63
|
+
spatialTrappedContext: (context: string) => string;
|
|
64
|
+
history: string;
|
|
65
|
+
eventLogTitle: string;
|
|
66
|
+
eventLogClear: string;
|
|
67
|
+
eventLogWaiting: string;
|
|
68
|
+
overlaysSection: string;
|
|
69
|
+
panelsSection: string;
|
|
70
|
+
toggleGuide: string;
|
|
71
|
+
toggleTabOrder: string;
|
|
72
|
+
toggleSpatialNav: string;
|
|
73
|
+
toggleComponentLabels: string;
|
|
74
|
+
toggleCompositeBounds: string;
|
|
75
|
+
toggleComponentTrace: string;
|
|
76
|
+
toggleComponentTree: string;
|
|
77
|
+
toggleEventLog: string;
|
|
78
|
+
toggleInspect: string;
|
|
79
|
+
trapped: string;
|
|
80
|
+
protected: string;
|
|
81
|
+
filterUser: string;
|
|
82
|
+
filterPrimitives: string;
|
|
83
|
+
filterAll: string;
|
|
84
|
+
}
|
|
85
|
+
/** Root overlay props. */
|
|
86
|
+
interface OptDevtoolProps {
|
|
87
|
+
defaultOpen?: boolean;
|
|
88
|
+
/** Override individual labels. Falls back to {@link defaultLabels} (Korean). */
|
|
89
|
+
labels?: Partial<OptDevtoolLabels>;
|
|
90
|
+
}
|
|
91
|
+
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-Bz4DijhU.cjs");
|
|
4
|
+
exports.OPT_DEVTOOL_CONFIGURE_EVENT = require_types.OPT_DEVTOOL_CONFIGURE_EVENT;
|
package/dist/ui/index.d.cts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
|
|
2
|
+
import { n as OptDevtoolConfig, t as OPT_DEVTOOL_CONFIGURE_EVENT } from "../types-D_lNT2Nr.cjs";
|
|
3
|
+
export { OPT_DEVTOOL_CONFIGURE_EVENT, type OptDevtoolConfig };
|