@reopt-ai/opt-devtool 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/LICENSE +21 -0
- package/README.md +149 -0
- package/dist/brandapp/index.cjs +391 -0
- package/dist/brandapp/index.d.cts +95 -0
- package/dist/brandapp/index.d.ts +95 -0
- package/dist/brandapp/index.js +391 -0
- package/dist/chunk-4MJKIAXH.cjs +65 -0
- package/dist/chunk-5HRIQSVF.js +32 -0
- package/dist/chunk-6AGUYGVT.cjs +77 -0
- package/dist/chunk-EQPETYJJ.cjs +32 -0
- package/dist/chunk-H3F2WACS.cjs +568 -0
- package/dist/chunk-N7YO56TN.cjs +25 -0
- package/dist/chunk-SQ3E3QLA.cjs +253 -0
- package/dist/chunk-SW2FF6EV.js +568 -0
- package/dist/chunk-UJSIQF3A.js +25 -0
- package/dist/chunk-UQY5I3WS.js +253 -0
- package/dist/chunk-YCYIUFB4.js +65 -0
- package/dist/chunk-Z2KFRHSI.js +77 -0
- package/dist/datagrid/index.cjs +187 -0
- package/dist/datagrid/index.d.cts +14 -0
- package/dist/datagrid/index.d.ts +14 -0
- package/dist/datagrid/index.js +187 -0
- package/dist/editor/index.cjs +239 -0
- package/dist/editor/index.d.cts +14 -0
- package/dist/editor/index.d.ts +14 -0
- package/dist/editor/index.js +239 -0
- package/dist/harness/index.cjs +13 -0
- package/dist/harness/index.d.cts +30 -0
- package/dist/harness/index.d.ts +30 -0
- package/dist/harness/index.js +13 -0
- package/dist/index-Bakx4o8Z.d.cts +91 -0
- package/dist/index-Bakx4o8Z.d.ts +91 -0
- package/dist/index.cjs +3895 -0
- package/dist/index.d.cts +22 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +3895 -0
- package/dist/theme/index.cjs +13 -0
- package/dist/theme/index.d.cts +33 -0
- package/dist/theme/index.d.ts +33 -0
- package/dist/theme/index.js +13 -0
- package/dist/ui/index.cjs +8 -0
- package/dist/ui/index.d.cts +2 -0
- package/dist/ui/index.d.ts +2 -0
- package/dist/ui/index.js +8 -0
- package/package.json +153 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,3895 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunk4MJKIAXHcjs = require('./chunk-4MJKIAXH.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
var _chunkH3F2WACScjs = require('./chunk-H3F2WACS.cjs');
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var _chunkSQ3E3QLAcjs = require('./chunk-SQ3E3QLA.cjs');
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
var _chunkEQPETYJJcjs = require('./chunk-EQPETYJJ.cjs');
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
var _chunk6AGUYGVTcjs = require('./chunk-6AGUYGVT.cjs');
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
var _chunkN7YO56TNcjs = require('./chunk-N7YO56TN.cjs');
|
|
32
|
+
|
|
33
|
+
// src/opt-devtool.tsx
|
|
34
|
+
var _react = require('react'); var React11 = _interopRequireWildcard(_react); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react); var React4 = _interopRequireWildcard(_react); var React5 = _interopRequireWildcard(_react); var React6 = _interopRequireWildcard(_react); var React7 = _interopRequireWildcard(_react); var React8 = _interopRequireWildcard(_react); var React9 = _interopRequireWildcard(_react); var React10 = _interopRequireWildcard(_react);
|
|
35
|
+
var _optui = require('@reopt-ai/opt-ui');
|
|
36
|
+
|
|
37
|
+
// src/scanning/constants.ts
|
|
38
|
+
var LEGACY_OPT_UI_HELPER_CONFIGURE_EVENT = "opt-ui-helper-configure";
|
|
39
|
+
var TABBABLE = [
|
|
40
|
+
"a[href]:not([disabled])",
|
|
41
|
+
"button:not([disabled])",
|
|
42
|
+
"input:not([disabled])",
|
|
43
|
+
"select:not([disabled])",
|
|
44
|
+
"textarea:not([disabled])",
|
|
45
|
+
"[tabindex]:not([disabled])",
|
|
46
|
+
'[contenteditable="true"]'
|
|
47
|
+
].join(",");
|
|
48
|
+
var REACT_NEXT_INTERNALS = /* @__PURE__ */ new Set([
|
|
49
|
+
"Suspense",
|
|
50
|
+
"Fragment",
|
|
51
|
+
"StrictMode",
|
|
52
|
+
"Profiler",
|
|
53
|
+
"Lazy",
|
|
54
|
+
"InnerLayoutRouter",
|
|
55
|
+
"OuterLayoutRouter",
|
|
56
|
+
"RenderFromTemplateContext",
|
|
57
|
+
"ScrollAndFocusHandler",
|
|
58
|
+
"RedirectBoundary",
|
|
59
|
+
"NotFoundBoundary",
|
|
60
|
+
"LoadingBoundary",
|
|
61
|
+
"ErrorBoundary",
|
|
62
|
+
"HotReload",
|
|
63
|
+
"ReactDevOverlay",
|
|
64
|
+
"Router",
|
|
65
|
+
"AppRouter",
|
|
66
|
+
"ServerRoot",
|
|
67
|
+
"MetadataOutlet",
|
|
68
|
+
"HTTPAccessFallbackBoundary"
|
|
69
|
+
]);
|
|
70
|
+
var PRIMITIVE_PREFIXES = [
|
|
71
|
+
"Composite",
|
|
72
|
+
"Dialog",
|
|
73
|
+
"Combobox",
|
|
74
|
+
"Menu",
|
|
75
|
+
"Menubar",
|
|
76
|
+
"Toolbar",
|
|
77
|
+
"Tab",
|
|
78
|
+
"Select",
|
|
79
|
+
"Disclosure",
|
|
80
|
+
"Form",
|
|
81
|
+
"Tooltip",
|
|
82
|
+
"Radio",
|
|
83
|
+
"Checkbox",
|
|
84
|
+
"Popover"
|
|
85
|
+
];
|
|
86
|
+
var OPS_UI_PRIMITIVES = /* @__PURE__ */ new Set([
|
|
87
|
+
"CompositeZone",
|
|
88
|
+
"Composite",
|
|
89
|
+
"CompositeItem",
|
|
90
|
+
"CompositeRow",
|
|
91
|
+
"CompositeProvider",
|
|
92
|
+
"DisclosureRoot",
|
|
93
|
+
"DisclosureTrigger",
|
|
94
|
+
"DisclosureContent",
|
|
95
|
+
"TabsRoot",
|
|
96
|
+
"TabList",
|
|
97
|
+
"Tab",
|
|
98
|
+
"TabPanel",
|
|
99
|
+
"SelectRoot",
|
|
100
|
+
"SelectLabel",
|
|
101
|
+
"SelectTrigger",
|
|
102
|
+
"SelectPopover",
|
|
103
|
+
"SelectItem",
|
|
104
|
+
"DialogRoot",
|
|
105
|
+
"DialogPanel",
|
|
106
|
+
"DialogDismiss",
|
|
107
|
+
"ComboboxRoot",
|
|
108
|
+
"ComboboxInput",
|
|
109
|
+
"ComboboxPopover",
|
|
110
|
+
"ComboboxItem",
|
|
111
|
+
"ComboboxGroup",
|
|
112
|
+
"ComboboxGroupLabel",
|
|
113
|
+
"ComboboxEmpty",
|
|
114
|
+
"MenubarRoot",
|
|
115
|
+
"MenubarContainer",
|
|
116
|
+
"MenuRoot",
|
|
117
|
+
"MenuTrigger",
|
|
118
|
+
"MenuButtonArrow",
|
|
119
|
+
"MenuPopover",
|
|
120
|
+
"MenuItem",
|
|
121
|
+
"MenuItemCheckbox",
|
|
122
|
+
"MenuItemRadio",
|
|
123
|
+
"MenuSeparator",
|
|
124
|
+
"ToolbarRoot",
|
|
125
|
+
"ToolbarContainer",
|
|
126
|
+
"ToolbarButton",
|
|
127
|
+
"ToolbarSeparator",
|
|
128
|
+
"TooltipProvider",
|
|
129
|
+
"TooltipAnchor",
|
|
130
|
+
"Tooltip",
|
|
131
|
+
"FormRoot",
|
|
132
|
+
"FormInput",
|
|
133
|
+
"FormLabel",
|
|
134
|
+
"FormError",
|
|
135
|
+
"FormSubmit",
|
|
136
|
+
"Checkbox",
|
|
137
|
+
"RadioGroup",
|
|
138
|
+
"Radio",
|
|
139
|
+
"Kbd",
|
|
140
|
+
"StatCard"
|
|
141
|
+
]);
|
|
142
|
+
var OPS_UI_BLOCKS = /* @__PURE__ */ new Set([
|
|
143
|
+
"CommandPalette",
|
|
144
|
+
"CommandPaletteTrigger",
|
|
145
|
+
"DashboardGrid",
|
|
146
|
+
"SearchCombobox",
|
|
147
|
+
"StatusSelect",
|
|
148
|
+
"AppMenubar",
|
|
149
|
+
"SidebarNav",
|
|
150
|
+
"EditorToolbar",
|
|
151
|
+
"ContentTabs",
|
|
152
|
+
"FaqAccordion",
|
|
153
|
+
"SettingsForm",
|
|
154
|
+
"DeploymentTimeline",
|
|
155
|
+
"ProjectSwitcher",
|
|
156
|
+
"EnvPanel",
|
|
157
|
+
"BranchSelect",
|
|
158
|
+
"DomainTable"
|
|
159
|
+
]);
|
|
160
|
+
var COMPOSITE_ROLES = /* @__PURE__ */ new Set([
|
|
161
|
+
"grid",
|
|
162
|
+
"toolbar",
|
|
163
|
+
"tablist",
|
|
164
|
+
"menubar",
|
|
165
|
+
"listbox",
|
|
166
|
+
"radiogroup",
|
|
167
|
+
"menu",
|
|
168
|
+
"navigation"
|
|
169
|
+
]);
|
|
170
|
+
var ITEM_ROLES = '[role="gridcell"],[role="option"],[role="tab"],[role="menuitem"],[role="menuitemcheckbox"],[role="menuitemradio"],[role="radio"]';
|
|
171
|
+
var NAV_KEYS = /* @__PURE__ */ new Set([
|
|
172
|
+
"Tab",
|
|
173
|
+
"ArrowUp",
|
|
174
|
+
"ArrowDown",
|
|
175
|
+
"ArrowLeft",
|
|
176
|
+
"ArrowRight",
|
|
177
|
+
"Escape",
|
|
178
|
+
"Enter",
|
|
179
|
+
" "
|
|
180
|
+
]);
|
|
181
|
+
var DIR_SYMBOL = {
|
|
182
|
+
up: "\u2191",
|
|
183
|
+
down: "\u2193",
|
|
184
|
+
left: "\u2190",
|
|
185
|
+
right: "\u2192"
|
|
186
|
+
};
|
|
187
|
+
var SYMBOL_DIR = {
|
|
188
|
+
"\u2191": "up",
|
|
189
|
+
"\u2193": "down",
|
|
190
|
+
"\u2190": "left",
|
|
191
|
+
"\u2192": "right"
|
|
192
|
+
};
|
|
193
|
+
var ALL_DIRS = ["up", "down", "left", "right"];
|
|
194
|
+
function cornerClass(corner) {
|
|
195
|
+
switch (corner) {
|
|
196
|
+
case "br":
|
|
197
|
+
return "bottom-4 right-4";
|
|
198
|
+
case "bl":
|
|
199
|
+
return "bottom-4 left-4";
|
|
200
|
+
case "tr":
|
|
201
|
+
return "top-4 right-4";
|
|
202
|
+
case "tl":
|
|
203
|
+
return "top-4 left-4";
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
var CORNER_LABELS = [
|
|
207
|
+
{ key: "tl", label: "\u2196" },
|
|
208
|
+
{ key: "tr", label: "\u2197" },
|
|
209
|
+
{ key: "bl", label: "\u2199" },
|
|
210
|
+
{ key: "br", label: "\u2198" }
|
|
211
|
+
];
|
|
212
|
+
|
|
213
|
+
// src/scanning/visibility.ts
|
|
214
|
+
function isVisible(el) {
|
|
215
|
+
if (!el.offsetParent && getComputedStyle(el).position !== "fixed") {
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
const styles = getComputedStyle(el);
|
|
219
|
+
return styles.visibility !== "hidden" && styles.display !== "none";
|
|
220
|
+
}
|
|
221
|
+
function safeRect(el) {
|
|
222
|
+
if (!el || !el.isConnected) {
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
225
|
+
const rect = el.getBoundingClientRect();
|
|
226
|
+
if (rect.width === 0 && rect.height === 0) {
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
return rect;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// src/scanning/tabbable.ts
|
|
233
|
+
function getTabbable() {
|
|
234
|
+
const els = Array.from(
|
|
235
|
+
document.querySelectorAll(TABBABLE)
|
|
236
|
+
).filter((el) => {
|
|
237
|
+
if (el.tabIndex < 0) {
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
240
|
+
if (!isVisible(el)) {
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
if (el.closest("[data-opt-devtool]")) {
|
|
244
|
+
return false;
|
|
245
|
+
}
|
|
246
|
+
return true;
|
|
247
|
+
});
|
|
248
|
+
const positive = [];
|
|
249
|
+
const zero = [];
|
|
250
|
+
for (const el of els) {
|
|
251
|
+
if (el.tabIndex > 0) {
|
|
252
|
+
positive.push(el);
|
|
253
|
+
} else {
|
|
254
|
+
zero.push(el);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
positive.sort((a, b) => a.tabIndex - b.tabIndex);
|
|
258
|
+
return [...positive, ...zero];
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// src/scanning/attributes.ts
|
|
262
|
+
var _idregistry = require('@reopt-ai/opt-ui/id-registry');
|
|
263
|
+
function getAriaAttrs(el) {
|
|
264
|
+
return Array.from(el.attributes).filter((attribute) => attribute.name.startsWith("aria-")).map((attribute) => [attribute.name, attribute.value]);
|
|
265
|
+
}
|
|
266
|
+
function getDataAttrs(el) {
|
|
267
|
+
return Array.from(el.attributes).filter(
|
|
268
|
+
(attribute) => attribute.name.startsWith("data-") && attribute.name !== "data-opt-devtool"
|
|
269
|
+
).map((attribute) => [attribute.name, attribute.value]);
|
|
270
|
+
}
|
|
271
|
+
function getOptIdentity(el) {
|
|
272
|
+
const id = el.getAttribute("data-opt-id");
|
|
273
|
+
const slug = el.getAttribute("data-opt-slug");
|
|
274
|
+
if (!id && !slug) return null;
|
|
275
|
+
if (id && Object.prototype.hasOwnProperty.call(_idregistry.ID_REGISTRY, id)) {
|
|
276
|
+
const entry = _idregistry.ID_REGISTRY[id];
|
|
277
|
+
const derivedSlug = `${entry.slug}.${entry.exportName}`;
|
|
278
|
+
const consistent = !slug || slug === derivedSlug;
|
|
279
|
+
return {
|
|
280
|
+
id,
|
|
281
|
+
slug: slug != null ? slug : derivedSlug,
|
|
282
|
+
exportName: entry.exportName,
|
|
283
|
+
metaName: entry.metaName,
|
|
284
|
+
layer: entry.layer,
|
|
285
|
+
registered: consistent
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
if (slug && Object.prototype.hasOwnProperty.call(_idregistry.SLUG_TO_ID, slug)) {
|
|
289
|
+
const realId = _idregistry.SLUG_TO_ID[slug];
|
|
290
|
+
const entry = _idregistry.ID_REGISTRY[realId];
|
|
291
|
+
return {
|
|
292
|
+
id: id != null ? id : realId,
|
|
293
|
+
slug,
|
|
294
|
+
exportName: entry.exportName,
|
|
295
|
+
metaName: entry.metaName,
|
|
296
|
+
layer: entry.layer,
|
|
297
|
+
// If the element has its own id and it doesn't match what the registry
|
|
298
|
+
// expects for this slug, the code is stale relative to the meta.
|
|
299
|
+
registered: id === null || id === realId
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
return {
|
|
303
|
+
id: id != null ? id : "",
|
|
304
|
+
slug: slug != null ? slug : "",
|
|
305
|
+
exportName: "",
|
|
306
|
+
metaName: "",
|
|
307
|
+
layer: "",
|
|
308
|
+
registered: false
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
function getOptIdentityFromAncestors(el) {
|
|
312
|
+
let cursor = el;
|
|
313
|
+
while (cursor) {
|
|
314
|
+
const identity = getOptIdentity(cursor);
|
|
315
|
+
if (identity) return identity;
|
|
316
|
+
cursor = cursor.parentElement;
|
|
317
|
+
}
|
|
318
|
+
return null;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// src/scanning/fiber.ts
|
|
322
|
+
function getOpsUIComponentType(name) {
|
|
323
|
+
if (OPS_UI_BLOCKS.has(name)) {
|
|
324
|
+
return "block";
|
|
325
|
+
}
|
|
326
|
+
if (OPS_UI_PRIMITIVES.has(name)) {
|
|
327
|
+
return "primitive";
|
|
328
|
+
}
|
|
329
|
+
return null;
|
|
330
|
+
}
|
|
331
|
+
function getReactFiber(el) {
|
|
332
|
+
var _a;
|
|
333
|
+
try {
|
|
334
|
+
const key = Object.keys(el).find(
|
|
335
|
+
(candidate) => candidate.startsWith("__reactFiber$") || candidate.startsWith("__reactInternalInstance$")
|
|
336
|
+
);
|
|
337
|
+
if (!key) return null;
|
|
338
|
+
return (_a = el[key]) != null ? _a : null;
|
|
339
|
+
} catch (e) {
|
|
340
|
+
return null;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
function resolveComponentName(type) {
|
|
344
|
+
if (!type) return null;
|
|
345
|
+
if (typeof type === "function") {
|
|
346
|
+
return type.displayName || type.name || null;
|
|
347
|
+
}
|
|
348
|
+
if (typeof type === "object") {
|
|
349
|
+
if (typeof type.displayName === "string" && type.displayName.length > 0) {
|
|
350
|
+
return type.displayName;
|
|
351
|
+
}
|
|
352
|
+
if (typeof type.render === "function") {
|
|
353
|
+
return type.render.displayName || type.render.name || "ForwardRef";
|
|
354
|
+
}
|
|
355
|
+
if (type.type) {
|
|
356
|
+
const inner = resolveComponentName(type.type);
|
|
357
|
+
if (inner) return inner;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
return null;
|
|
361
|
+
}
|
|
362
|
+
function getComponentChain(el) {
|
|
363
|
+
const fiber = getReactFiber(el);
|
|
364
|
+
if (!fiber) return [];
|
|
365
|
+
const names = [];
|
|
366
|
+
try {
|
|
367
|
+
let current = fiber;
|
|
368
|
+
while (current) {
|
|
369
|
+
const name = resolveComponentName(current.type);
|
|
370
|
+
if (name) names.push(name);
|
|
371
|
+
current = current.return;
|
|
372
|
+
}
|
|
373
|
+
} catch (e) {
|
|
374
|
+
}
|
|
375
|
+
return names;
|
|
376
|
+
}
|
|
377
|
+
function isReactNextInternal(name) {
|
|
378
|
+
if (REACT_NEXT_INTERNALS.has(name)) {
|
|
379
|
+
return true;
|
|
380
|
+
}
|
|
381
|
+
if (name.startsWith("__")) {
|
|
382
|
+
return true;
|
|
383
|
+
}
|
|
384
|
+
if (name.length <= 1) {
|
|
385
|
+
return true;
|
|
386
|
+
}
|
|
387
|
+
return false;
|
|
388
|
+
}
|
|
389
|
+
function isPrimitiveComponent(name) {
|
|
390
|
+
return PRIMITIVE_PREFIXES.some(
|
|
391
|
+
(prefix) => name === prefix || name.startsWith(prefix)
|
|
392
|
+
);
|
|
393
|
+
}
|
|
394
|
+
function filterChain(chain, filter) {
|
|
395
|
+
if (filter === "all") {
|
|
396
|
+
return chain;
|
|
397
|
+
}
|
|
398
|
+
if (filter === "user") {
|
|
399
|
+
return chain.filter(
|
|
400
|
+
(name) => !isReactNextInternal(name) && !isPrimitiveComponent(name)
|
|
401
|
+
);
|
|
402
|
+
}
|
|
403
|
+
if (filter === "primitives") {
|
|
404
|
+
return chain.filter((name) => isPrimitiveComponent(name));
|
|
405
|
+
}
|
|
406
|
+
return chain;
|
|
407
|
+
}
|
|
408
|
+
function findOpsUIComponents() {
|
|
409
|
+
const results = [];
|
|
410
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
411
|
+
function walkFiber(fiber, currentEl) {
|
|
412
|
+
if (!fiber) return;
|
|
413
|
+
let el = currentEl;
|
|
414
|
+
if (fiber.stateNode instanceof HTMLElement) {
|
|
415
|
+
el = fiber.stateNode;
|
|
416
|
+
}
|
|
417
|
+
if (el && !seen.has(el)) {
|
|
418
|
+
const name = resolveComponentName(fiber.type);
|
|
419
|
+
if (name) {
|
|
420
|
+
const compType = getOpsUIComponentType(name);
|
|
421
|
+
if (compType) {
|
|
422
|
+
seen.add(el);
|
|
423
|
+
const rect = el.getBoundingClientRect();
|
|
424
|
+
if (rect.width > 0 && rect.height > 0) {
|
|
425
|
+
results.push({ name, type: compType, element: el, rect });
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
walkFiber(fiber.child, el);
|
|
431
|
+
walkFiber(fiber.sibling, currentEl);
|
|
432
|
+
}
|
|
433
|
+
try {
|
|
434
|
+
const root = document.getElementById("__next") || document.body;
|
|
435
|
+
const fiberKey = Object.keys(root).find(
|
|
436
|
+
(key) => key.startsWith("__reactFiber$") || key.startsWith("__reactContainer$")
|
|
437
|
+
);
|
|
438
|
+
if (!fiberKey) return results;
|
|
439
|
+
const rootFiber = root[fiberKey];
|
|
440
|
+
walkFiber(rootFiber, null);
|
|
441
|
+
} catch (e) {
|
|
442
|
+
}
|
|
443
|
+
return results;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// src/scanning/composite.ts
|
|
447
|
+
function getCompositeItems(container) {
|
|
448
|
+
return Array.from(container.querySelectorAll(ITEM_ROLES)).filter(
|
|
449
|
+
(item) => {
|
|
450
|
+
let parent = item.parentElement;
|
|
451
|
+
while (parent && parent !== container) {
|
|
452
|
+
const role = parent.getAttribute("role");
|
|
453
|
+
if (role && COMPOSITE_ROLES.has(role)) {
|
|
454
|
+
return false;
|
|
455
|
+
}
|
|
456
|
+
parent = parent.parentElement;
|
|
457
|
+
}
|
|
458
|
+
return isVisible(item);
|
|
459
|
+
}
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
function findCompositeZones() {
|
|
463
|
+
const results = [];
|
|
464
|
+
const compositeRoleSelector = Array.from(COMPOSITE_ROLES).map((role) => `[role="${role}"]`).join(",");
|
|
465
|
+
const elements = document.querySelectorAll(
|
|
466
|
+
compositeRoleSelector
|
|
467
|
+
);
|
|
468
|
+
for (const el of elements) {
|
|
469
|
+
if (el.closest("[data-opt-devtool]")) {
|
|
470
|
+
continue;
|
|
471
|
+
}
|
|
472
|
+
if (!isVisible(el)) {
|
|
473
|
+
continue;
|
|
474
|
+
}
|
|
475
|
+
const rect = el.getBoundingClientRect();
|
|
476
|
+
if (rect.width === 0 || rect.height === 0) {
|
|
477
|
+
continue;
|
|
478
|
+
}
|
|
479
|
+
const role = el.getAttribute("role") || "";
|
|
480
|
+
const ariaOrientation = el.getAttribute("aria-orientation");
|
|
481
|
+
let orientation = "grid";
|
|
482
|
+
if (ariaOrientation === "vertical") {
|
|
483
|
+
orientation = "vertical";
|
|
484
|
+
} else if (ariaOrientation === "horizontal") {
|
|
485
|
+
orientation = "horizontal";
|
|
486
|
+
} else if (role === "grid") {
|
|
487
|
+
orientation = "grid";
|
|
488
|
+
} else if (role === "toolbar" || role === "tablist" || role === "menubar") {
|
|
489
|
+
orientation = "horizontal";
|
|
490
|
+
} else if (role === "listbox" || role === "menu" || role === "navigation" || role === "radiogroup") {
|
|
491
|
+
orientation = "vertical";
|
|
492
|
+
}
|
|
493
|
+
const items = getCompositeItems(el);
|
|
494
|
+
results.push({
|
|
495
|
+
role,
|
|
496
|
+
orientation,
|
|
497
|
+
itemCount: items.length,
|
|
498
|
+
element: el,
|
|
499
|
+
rect
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
return results;
|
|
503
|
+
}
|
|
504
|
+
function detectLoopWrap(container) {
|
|
505
|
+
const result = { focusLoop: false, focusWrap: false };
|
|
506
|
+
const fiber = getReactFiber(container);
|
|
507
|
+
if (!fiber) {
|
|
508
|
+
return result;
|
|
509
|
+
}
|
|
510
|
+
let current = fiber.return;
|
|
511
|
+
let depth = 0;
|
|
512
|
+
while (current && depth < 30) {
|
|
513
|
+
const props = current.memoizedProps;
|
|
514
|
+
if (props && typeof props === "object") {
|
|
515
|
+
const hasLoop = "focusLoop" in props;
|
|
516
|
+
const hasWrap = "focusWrap" in props;
|
|
517
|
+
if (hasLoop) {
|
|
518
|
+
result.focusLoop = !!props.focusLoop;
|
|
519
|
+
}
|
|
520
|
+
if (hasWrap) {
|
|
521
|
+
result.focusWrap = !!props.focusWrap;
|
|
522
|
+
}
|
|
523
|
+
if (hasLoop || hasWrap) {
|
|
524
|
+
return result;
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
current = current.return;
|
|
528
|
+
depth++;
|
|
529
|
+
}
|
|
530
|
+
const role = container.getAttribute("role");
|
|
531
|
+
if (role === "tablist" || role === "menubar" || role === "radiogroup") {
|
|
532
|
+
result.focusLoop = true;
|
|
533
|
+
}
|
|
534
|
+
return result;
|
|
535
|
+
}
|
|
536
|
+
function getGridContext(el, container, loopWrap) {
|
|
537
|
+
const cells = getCompositeItems(container);
|
|
538
|
+
if (!cells.length) {
|
|
539
|
+
return null;
|
|
540
|
+
}
|
|
541
|
+
const rows = [];
|
|
542
|
+
let currentRow = [];
|
|
543
|
+
let lastTop = -Infinity;
|
|
544
|
+
for (const cell of cells) {
|
|
545
|
+
const top = cell.getBoundingClientRect().top;
|
|
546
|
+
if (currentRow.length > 0 && Math.abs(top - lastTop) > 5) {
|
|
547
|
+
rows.push(currentRow);
|
|
548
|
+
currentRow = [];
|
|
549
|
+
}
|
|
550
|
+
currentRow.push(cell);
|
|
551
|
+
lastTop = top;
|
|
552
|
+
}
|
|
553
|
+
if (currentRow.length) {
|
|
554
|
+
rows.push(currentRow);
|
|
555
|
+
}
|
|
556
|
+
let rowIndex = -1;
|
|
557
|
+
let colIndex = -1;
|
|
558
|
+
for (let row = 0; row < rows.length; row++) {
|
|
559
|
+
for (let col = 0; col < rows[row].length; col++) {
|
|
560
|
+
if (rows[row][col] === el || rows[row][col].contains(el)) {
|
|
561
|
+
rowIndex = row;
|
|
562
|
+
colIndex = col;
|
|
563
|
+
break;
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
if (rowIndex !== -1) {
|
|
567
|
+
break;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
if (rowIndex === -1) {
|
|
571
|
+
return null;
|
|
572
|
+
}
|
|
573
|
+
const flatIndex = cells.findIndex((cell) => cell === el || cell.contains(el));
|
|
574
|
+
const arrows = [];
|
|
575
|
+
const rowLength = rows[rowIndex].length;
|
|
576
|
+
const rowCount = rows.length;
|
|
577
|
+
if (colIndex > 0) {
|
|
578
|
+
arrows.push({ direction: "\u2190", element: rows[rowIndex][colIndex - 1] });
|
|
579
|
+
} else if (loopWrap.focusLoop && rowLength > 1) {
|
|
580
|
+
arrows.push({
|
|
581
|
+
direction: "\u2190",
|
|
582
|
+
element: rows[rowIndex][rowLength - 1],
|
|
583
|
+
loop: true
|
|
584
|
+
});
|
|
585
|
+
} else if (loopWrap.focusWrap && rowIndex > 0) {
|
|
586
|
+
const prevRow = rows[rowIndex - 1];
|
|
587
|
+
arrows.push({
|
|
588
|
+
direction: "\u2190",
|
|
589
|
+
element: prevRow[prevRow.length - 1],
|
|
590
|
+
loop: true
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
if (colIndex < rowLength - 1) {
|
|
594
|
+
arrows.push({ direction: "\u2192", element: rows[rowIndex][colIndex + 1] });
|
|
595
|
+
} else if (loopWrap.focusLoop && rowLength > 1) {
|
|
596
|
+
arrows.push({
|
|
597
|
+
direction: "\u2192",
|
|
598
|
+
element: rows[rowIndex][0],
|
|
599
|
+
loop: true
|
|
600
|
+
});
|
|
601
|
+
} else if (loopWrap.focusWrap && rowIndex < rowCount - 1) {
|
|
602
|
+
arrows.push({
|
|
603
|
+
direction: "\u2192",
|
|
604
|
+
element: rows[rowIndex + 1][0],
|
|
605
|
+
loop: true
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
if (rowIndex > 0 && colIndex < rows[rowIndex - 1].length) {
|
|
609
|
+
arrows.push({ direction: "\u2191", element: rows[rowIndex - 1][colIndex] });
|
|
610
|
+
} else if (loopWrap.focusLoop && rowCount > 1 && colIndex < rows[rowCount - 1].length) {
|
|
611
|
+
arrows.push({
|
|
612
|
+
direction: "\u2191",
|
|
613
|
+
element: rows[rowCount - 1][colIndex],
|
|
614
|
+
loop: true
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
if (rowIndex < rowCount - 1 && colIndex < rows[rowIndex + 1].length) {
|
|
618
|
+
arrows.push({ direction: "\u2193", element: rows[rowIndex + 1][colIndex] });
|
|
619
|
+
} else if (loopWrap.focusLoop && rowCount > 1 && colIndex < rows[0].length) {
|
|
620
|
+
arrows.push({
|
|
621
|
+
direction: "\u2193",
|
|
622
|
+
element: rows[0][colIndex],
|
|
623
|
+
loop: true
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
return _chunkN7YO56TNcjs.__spreadValues.call(void 0, {
|
|
627
|
+
type: "grid",
|
|
628
|
+
total: cells.length,
|
|
629
|
+
index: flatIndex,
|
|
630
|
+
arrows
|
|
631
|
+
}, loopWrap);
|
|
632
|
+
}
|
|
633
|
+
function getCompositeInfo(el) {
|
|
634
|
+
let container = el.parentElement;
|
|
635
|
+
while (container) {
|
|
636
|
+
const role2 = container.getAttribute("role");
|
|
637
|
+
if (role2 && COMPOSITE_ROLES.has(role2)) {
|
|
638
|
+
break;
|
|
639
|
+
}
|
|
640
|
+
container = container.parentElement;
|
|
641
|
+
}
|
|
642
|
+
if (!container) {
|
|
643
|
+
return null;
|
|
644
|
+
}
|
|
645
|
+
const role = container.getAttribute("role");
|
|
646
|
+
const loopWrap = detectLoopWrap(container);
|
|
647
|
+
if (role === "grid") {
|
|
648
|
+
return getGridContext(el, container, loopWrap);
|
|
649
|
+
}
|
|
650
|
+
const items = getCompositeItems(container);
|
|
651
|
+
const index = items.findIndex((item) => item === el || item.contains(el));
|
|
652
|
+
if (index === -1) {
|
|
653
|
+
return null;
|
|
654
|
+
}
|
|
655
|
+
const horizontal = role === "toolbar" || role === "tablist" || role === "menubar";
|
|
656
|
+
const arrows = [];
|
|
657
|
+
if (index > 0) {
|
|
658
|
+
arrows.push({
|
|
659
|
+
direction: horizontal ? "\u2190" : "\u2191",
|
|
660
|
+
element: items[index - 1]
|
|
661
|
+
});
|
|
662
|
+
} else if (loopWrap.focusLoop && items.length > 1) {
|
|
663
|
+
arrows.push({
|
|
664
|
+
direction: horizontal ? "\u2190" : "\u2191",
|
|
665
|
+
element: items[items.length - 1],
|
|
666
|
+
loop: true
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
if (index < items.length - 1) {
|
|
670
|
+
arrows.push({
|
|
671
|
+
direction: horizontal ? "\u2192" : "\u2193",
|
|
672
|
+
element: items[index + 1]
|
|
673
|
+
});
|
|
674
|
+
} else if (loopWrap.focusLoop && items.length > 1) {
|
|
675
|
+
arrows.push({
|
|
676
|
+
direction: horizontal ? "\u2192" : "\u2193",
|
|
677
|
+
element: items[0],
|
|
678
|
+
loop: true
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
return _chunkN7YO56TNcjs.__spreadValues.call(void 0, {
|
|
682
|
+
type: role,
|
|
683
|
+
total: items.length,
|
|
684
|
+
index,
|
|
685
|
+
arrows
|
|
686
|
+
}, loopWrap);
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
// src/scanning/spatial.ts
|
|
690
|
+
|
|
691
|
+
function getProtectedDirs(el) {
|
|
692
|
+
return ALL_DIRS.filter((direction) => _optui.shouldSkipArrow.call(void 0, el, direction));
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
// src/panels/shared.tsx
|
|
696
|
+
|
|
697
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
698
|
+
function elLabel(el) {
|
|
699
|
+
const tag = el.tagName.toLowerCase();
|
|
700
|
+
const id = el.id ? `#${el.id}` : "";
|
|
701
|
+
const role = el.getAttribute("role");
|
|
702
|
+
const roleLabel = role ? ` [${role}]` : "";
|
|
703
|
+
return `<${tag}${id}>${roleLabel}`;
|
|
704
|
+
}
|
|
705
|
+
function elText(el) {
|
|
706
|
+
const text = (el.getAttribute("aria-label") || el.textContent || el.getAttribute("placeholder") || "").trim();
|
|
707
|
+
return text.length > 30 ? `${text.slice(0, 30)}\u2026` : text;
|
|
708
|
+
}
|
|
709
|
+
function formatTime(timestamp) {
|
|
710
|
+
const date = new Date(timestamp);
|
|
711
|
+
return [date.getHours(), date.getMinutes(), date.getSeconds()].map((value) => String(value).padStart(2, "0")).join(":");
|
|
712
|
+
}
|
|
713
|
+
function getEventLogTypeClass(type) {
|
|
714
|
+
if (type === "focusin") {
|
|
715
|
+
return "text-blue-400";
|
|
716
|
+
}
|
|
717
|
+
if (type === "focusout") {
|
|
718
|
+
return "text-white/55";
|
|
719
|
+
}
|
|
720
|
+
if (type === "spatial-nav") {
|
|
721
|
+
return "text-teal-400";
|
|
722
|
+
}
|
|
723
|
+
return "text-yellow-400";
|
|
724
|
+
}
|
|
725
|
+
function getEventLogTypeLabel(type) {
|
|
726
|
+
if (type === "spatial-nav") {
|
|
727
|
+
return "spatial";
|
|
728
|
+
}
|
|
729
|
+
return type;
|
|
730
|
+
}
|
|
731
|
+
function Section({
|
|
732
|
+
title,
|
|
733
|
+
color,
|
|
734
|
+
trailing,
|
|
735
|
+
children
|
|
736
|
+
}) {
|
|
737
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "px-3 py-2.5", children: [
|
|
738
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-1 flex items-center justify-between gap-2", children: [
|
|
739
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
740
|
+
"p",
|
|
741
|
+
{
|
|
742
|
+
className: `text-[10px] font-semibold tracking-wider uppercase ${color}`,
|
|
743
|
+
children: title
|
|
744
|
+
}
|
|
745
|
+
),
|
|
746
|
+
trailing
|
|
747
|
+
] }),
|
|
748
|
+
children
|
|
749
|
+
] });
|
|
750
|
+
}
|
|
751
|
+
function CollapsibleSection({
|
|
752
|
+
title,
|
|
753
|
+
color,
|
|
754
|
+
summary,
|
|
755
|
+
trailing,
|
|
756
|
+
defaultOpen = true,
|
|
757
|
+
children
|
|
758
|
+
}) {
|
|
759
|
+
const [open, setOpen] = React.useState(defaultOpen);
|
|
760
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "px-3 py-2.5", children: [
|
|
761
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-1 flex items-center gap-2", children: [
|
|
762
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
763
|
+
"button",
|
|
764
|
+
{
|
|
765
|
+
tabIndex: -1,
|
|
766
|
+
onClick: () => setOpen((prev) => !prev),
|
|
767
|
+
className: "flex items-center gap-1.5 text-left",
|
|
768
|
+
children: [
|
|
769
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
770
|
+
"p",
|
|
771
|
+
{
|
|
772
|
+
className: `text-[10px] font-semibold tracking-wider uppercase ${color}`,
|
|
773
|
+
children: title
|
|
774
|
+
}
|
|
775
|
+
),
|
|
776
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-[9px] text-white/30", children: open ? "\u25BE" : "\u25B8" })
|
|
777
|
+
]
|
|
778
|
+
}
|
|
779
|
+
),
|
|
780
|
+
!open && summary && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "ml-auto truncate text-[9px] text-white/40", children: summary }),
|
|
781
|
+
open && trailing && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "ml-auto", children: trailing })
|
|
782
|
+
] }),
|
|
783
|
+
open && children
|
|
784
|
+
] });
|
|
785
|
+
}
|
|
786
|
+
function Attr({ name, value }) {
|
|
787
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { children: [
|
|
788
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-yellow-600", children: name }),
|
|
789
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-white/45", children: "=" }),
|
|
790
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-green-500", children: [
|
|
791
|
+
'"',
|
|
792
|
+
value,
|
|
793
|
+
'"'
|
|
794
|
+
] })
|
|
795
|
+
] });
|
|
796
|
+
}
|
|
797
|
+
function FocusTarget({
|
|
798
|
+
dir,
|
|
799
|
+
el,
|
|
800
|
+
color
|
|
801
|
+
}) {
|
|
802
|
+
if (!el) {
|
|
803
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-white/45", children: [
|
|
804
|
+
dir,
|
|
805
|
+
": (\uC5C6\uC74C)"
|
|
806
|
+
] });
|
|
807
|
+
}
|
|
808
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { children: [
|
|
809
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: color, children: [
|
|
810
|
+
dir,
|
|
811
|
+
":"
|
|
812
|
+
] }),
|
|
813
|
+
" ",
|
|
814
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "font-mono text-white/80", children: elLabel(el) }),
|
|
815
|
+
" ",
|
|
816
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-white/55", children: [
|
|
817
|
+
'"',
|
|
818
|
+
elText(el),
|
|
819
|
+
'"'
|
|
820
|
+
] })
|
|
821
|
+
] });
|
|
822
|
+
}
|
|
823
|
+
function Toggle({
|
|
824
|
+
active,
|
|
825
|
+
onToggle,
|
|
826
|
+
children
|
|
827
|
+
}) {
|
|
828
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
829
|
+
"button",
|
|
830
|
+
{
|
|
831
|
+
tabIndex: -1,
|
|
832
|
+
onClick: onToggle,
|
|
833
|
+
className: `rounded px-2 py-1 text-xs transition-colors ${active ? "bg-blue-600 text-white" : "bg-white/10 text-white/55 hover:text-white/80"}`,
|
|
834
|
+
children
|
|
835
|
+
}
|
|
836
|
+
);
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
// src/panels/component-trace.tsx
|
|
840
|
+
|
|
841
|
+
function ComponentTree({ chain }) {
|
|
842
|
+
const reversed = [...chain].reverse();
|
|
843
|
+
if (reversed.length === 0) {
|
|
844
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-white/55", children: "\uD574\uB2F9\uD558\uB294 \uCEF4\uD3EC\uB10C\uD2B8 \uC5C6\uC74C" });
|
|
845
|
+
}
|
|
846
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "font-mono text-[11px] leading-relaxed", children: reversed.map((name, index) => {
|
|
847
|
+
const isLeaf = index === reversed.length - 1;
|
|
848
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
849
|
+
"div",
|
|
850
|
+
{
|
|
851
|
+
className: "flex items-center",
|
|
852
|
+
style: index > 0 ? { paddingLeft: index * 6 } : void 0,
|
|
853
|
+
children: [
|
|
854
|
+
index > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "mr-1 text-white/45 select-none", children: isLeaf ? "\u2514" : "\u251C" }),
|
|
855
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: isLeaf ? "text-cyan-300" : "text-cyan-500/70", children: name })
|
|
856
|
+
]
|
|
857
|
+
},
|
|
858
|
+
index
|
|
859
|
+
);
|
|
860
|
+
}) });
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
// src/panels/component-tree.tsx
|
|
864
|
+
|
|
865
|
+
|
|
866
|
+
var { useMemo } = React2;
|
|
867
|
+
function buildComponentHierarchy(components, displayedEl) {
|
|
868
|
+
if (components.length === 0) {
|
|
869
|
+
return [];
|
|
870
|
+
}
|
|
871
|
+
const relevantComponents = [];
|
|
872
|
+
if (displayedEl) {
|
|
873
|
+
for (const comp of components) {
|
|
874
|
+
if (comp.element.contains(displayedEl) || comp.element === displayedEl) {
|
|
875
|
+
relevantComponents.push(comp);
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
if (relevantComponents.length === 0) {
|
|
880
|
+
return components.slice(0, 5).map((component) => ({
|
|
881
|
+
name: component.name,
|
|
882
|
+
type: component.type,
|
|
883
|
+
element: component.element,
|
|
884
|
+
children: []
|
|
885
|
+
}));
|
|
886
|
+
}
|
|
887
|
+
const sorted = [...relevantComponents].sort(
|
|
888
|
+
(left, right) => left.rect.width * left.rect.height - right.rect.width * right.rect.height
|
|
889
|
+
);
|
|
890
|
+
const roots = [];
|
|
891
|
+
const nodes = /* @__PURE__ */ new Map();
|
|
892
|
+
for (const component of sorted) {
|
|
893
|
+
const node = {
|
|
894
|
+
name: component.name,
|
|
895
|
+
type: component.type,
|
|
896
|
+
element: component.element,
|
|
897
|
+
children: []
|
|
898
|
+
};
|
|
899
|
+
nodes.set(component.element, node);
|
|
900
|
+
let parent = null;
|
|
901
|
+
for (const other of sorted) {
|
|
902
|
+
if (other.element !== component.element && other.element.contains(component.element)) {
|
|
903
|
+
const candidate = nodes.get(other.element);
|
|
904
|
+
if (candidate) {
|
|
905
|
+
if (!parent || candidate.element.contains(parent.element)) {
|
|
906
|
+
parent = candidate;
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
if (parent) {
|
|
912
|
+
parent.children.push(node);
|
|
913
|
+
} else {
|
|
914
|
+
roots.push(node);
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
return roots;
|
|
918
|
+
}
|
|
919
|
+
function ComponentTreeViewer({
|
|
920
|
+
displayedEl,
|
|
921
|
+
opsUIComponents
|
|
922
|
+
}) {
|
|
923
|
+
const hierarchy = useMemo(
|
|
924
|
+
() => buildComponentHierarchy(opsUIComponents, displayedEl),
|
|
925
|
+
[displayedEl, opsUIComponents]
|
|
926
|
+
);
|
|
927
|
+
if (hierarchy.length === 0) {
|
|
928
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-white/55", children: "opt-ui \uCEF4\uD3EC\uB10C\uD2B8\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC74C" });
|
|
929
|
+
}
|
|
930
|
+
function renderNode(node, depth) {
|
|
931
|
+
const typeColor = node.type === "block" ? "text-emerald-400" : "text-purple-400";
|
|
932
|
+
const typeBadge = node.type === "block" ? "B" : "P";
|
|
933
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
934
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
935
|
+
"div",
|
|
936
|
+
{
|
|
937
|
+
className: "flex items-center gap-1.5 py-0.5",
|
|
938
|
+
style: { paddingLeft: depth * 12 },
|
|
939
|
+
children: [
|
|
940
|
+
depth > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-white/45 select-none", children: "\u2514" }),
|
|
941
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
942
|
+
"span",
|
|
943
|
+
{
|
|
944
|
+
className: `shrink-0 rounded px-1 text-[9px] font-bold ${node.type === "block" ? "bg-emerald-600/30 text-emerald-400" : "bg-purple-600/30 text-purple-400"}`,
|
|
945
|
+
children: typeBadge
|
|
946
|
+
}
|
|
947
|
+
),
|
|
948
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-mono ${typeColor}`, children: node.name })
|
|
949
|
+
]
|
|
950
|
+
}
|
|
951
|
+
),
|
|
952
|
+
node.children.map((child) => renderNode(child, depth + 1))
|
|
953
|
+
] }, `${node.name}-${depth}`);
|
|
954
|
+
}
|
|
955
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-[11px]", children: hierarchy.map((root) => renderNode(root, 0)) });
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
// src/panels/snapshot-text.ts
|
|
959
|
+
function buildSnapshotText(el, componentChain, tabInfo, composite, ariaAttrs, dataAttrs, spatialTargets, trappedContext, protectedDirs, optIdentity = null) {
|
|
960
|
+
const lines = ["=== opt-devtool Snapshot ==="];
|
|
961
|
+
lines.push(`\uC694\uC18C: ${elLabel(el)}`);
|
|
962
|
+
lines.push(`\uD14D\uC2A4\uD2B8: "${elText(el)}"`);
|
|
963
|
+
lines.push(`tabindex: ${el.tabIndex}`);
|
|
964
|
+
if (optIdentity && optIdentity.metaName) {
|
|
965
|
+
const staleMark = optIdentity.registered ? "" : " [stale]";
|
|
966
|
+
lines.push(
|
|
967
|
+
`opt-ui: ${optIdentity.metaName} \u203A ${optIdentity.exportName} (${optIdentity.layer}, ${optIdentity.id})${staleMark}`
|
|
968
|
+
);
|
|
969
|
+
}
|
|
970
|
+
const role = el.getAttribute("role");
|
|
971
|
+
if (role) {
|
|
972
|
+
lines.push(`role: ${role}`);
|
|
973
|
+
}
|
|
974
|
+
for (const [name, value] of ariaAttrs) {
|
|
975
|
+
lines.push(`${name}: ${value}`);
|
|
976
|
+
}
|
|
977
|
+
for (const [name, value] of dataAttrs) {
|
|
978
|
+
lines.push(`${name}: ${value}`);
|
|
979
|
+
}
|
|
980
|
+
if (componentChain.length > 0) {
|
|
981
|
+
lines.push("");
|
|
982
|
+
lines.push(`\uCEF4\uD3EC\uB10C\uD2B8: ${componentChain.join(" \u2192 ")}`);
|
|
983
|
+
}
|
|
984
|
+
if (tabInfo.inOrder) {
|
|
985
|
+
lines.push("");
|
|
986
|
+
lines.push(`Tab \uC21C\uC11C: ${tabInfo.idx + 1}`);
|
|
987
|
+
if (tabInfo.prev) {
|
|
988
|
+
lines.push(` \uC774\uC804: ${elLabel(tabInfo.prev)}`);
|
|
989
|
+
}
|
|
990
|
+
if (tabInfo.next) {
|
|
991
|
+
lines.push(` \uB2E4\uC74C: ${elLabel(tabInfo.next)}`);
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
if (composite) {
|
|
995
|
+
lines.push("");
|
|
996
|
+
const flags = [];
|
|
997
|
+
if (composite.focusLoop) {
|
|
998
|
+
flags.push("Loop");
|
|
999
|
+
}
|
|
1000
|
+
if (composite.focusWrap) {
|
|
1001
|
+
flags.push("Wrap");
|
|
1002
|
+
}
|
|
1003
|
+
const flagLabel = flags.length > 0 ? ` [${flags.join("+")}]` : "";
|
|
1004
|
+
lines.push(
|
|
1005
|
+
`\uBC29\uD5A5\uD0A4 (${composite.type}) ${composite.index + 1}/${composite.total}${flagLabel}`
|
|
1006
|
+
);
|
|
1007
|
+
for (const arrow of composite.arrows) {
|
|
1008
|
+
const loopMark = arrow.loop ? " \u21BB" : "";
|
|
1009
|
+
lines.push(` ${arrow.direction}: ${elLabel(arrow.element)}${loopMark}`);
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
if (trappedContext || protectedDirs.length > 0 || spatialTargets.length > 0) {
|
|
1013
|
+
lines.push("");
|
|
1014
|
+
lines.push("\uACF5\uAC04 \uB124\uBE44\uAC8C\uC774\uC158:");
|
|
1015
|
+
if (trappedContext) {
|
|
1016
|
+
lines.push(` trapped: ${trappedContext}`);
|
|
1017
|
+
}
|
|
1018
|
+
if (protectedDirs.length > 0) {
|
|
1019
|
+
lines.push(
|
|
1020
|
+
` \uBCF4\uD638 \uBC29\uD5A5: ${protectedDirs.map((direction) => DIR_SYMBOL[direction]).join("")}`
|
|
1021
|
+
);
|
|
1022
|
+
}
|
|
1023
|
+
for (const target of spatialTargets) {
|
|
1024
|
+
lines.push(
|
|
1025
|
+
` ${DIR_SYMBOL[target.direction]}: ${elLabel(target.element)} (${target.score})`
|
|
1026
|
+
);
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
return lines.join("\n");
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
// src/panels/theme-panel.tsx
|
|
1033
|
+
|
|
1034
|
+
var _optpalette = require('@reopt-ai/opt-palette');
|
|
1035
|
+
|
|
1036
|
+
|
|
1037
|
+
var { useCallback, useEffect, useMemo: useMemo2, useState: useState2 } = React3;
|
|
1038
|
+
var COLOR_TOKENS = {
|
|
1039
|
+
primary: [
|
|
1040
|
+
{ token: "--opt-accent", label: "Accent" },
|
|
1041
|
+
{ token: "--opt-accent-hover", label: "Acc Hover" },
|
|
1042
|
+
{ token: "--opt-accent-subtle", label: "Acc Subtle" },
|
|
1043
|
+
{ token: "--opt-accent-fg", label: "Acc FG" },
|
|
1044
|
+
{ token: "--opt-surface", label: "Surface" },
|
|
1045
|
+
{ token: "--opt-surface-raised", label: "Raised" },
|
|
1046
|
+
{ token: "--opt-bg", label: "BG" },
|
|
1047
|
+
{ token: "--opt-bg-subtle", label: "BG Sub" },
|
|
1048
|
+
{ token: "--opt-text", label: "Text" },
|
|
1049
|
+
{ token: "--opt-text-secondary", label: "Text 2nd" },
|
|
1050
|
+
{ token: "--opt-border", label: "Border" },
|
|
1051
|
+
{ token: "--opt-border-subtle", label: "Bdr Sub" }
|
|
1052
|
+
],
|
|
1053
|
+
status: [
|
|
1054
|
+
{ token: "--opt-success", label: "OK" },
|
|
1055
|
+
{ token: "--opt-warning", label: "Warn" },
|
|
1056
|
+
{ token: "--opt-danger", label: "Err" },
|
|
1057
|
+
{ token: "--opt-info", label: "Info" }
|
|
1058
|
+
],
|
|
1059
|
+
chart: [
|
|
1060
|
+
{ token: "--opt-chart-1", label: "C1" },
|
|
1061
|
+
{ token: "--opt-chart-2", label: "C2" },
|
|
1062
|
+
{ token: "--opt-chart-3", label: "C3" },
|
|
1063
|
+
{ token: "--opt-chart-4", label: "C4" },
|
|
1064
|
+
{ token: "--opt-chart-5", label: "C5" }
|
|
1065
|
+
]
|
|
1066
|
+
};
|
|
1067
|
+
var SPACING_TOKENS = [
|
|
1068
|
+
{ token: "--opt-space-section", label: "Section" },
|
|
1069
|
+
{ token: "--opt-space-group", label: "Group" },
|
|
1070
|
+
{ token: "--opt-space-element", label: "Element" }
|
|
1071
|
+
];
|
|
1072
|
+
var RADIUS_TOKENS = [
|
|
1073
|
+
{ token: "--opt-radius-sm", label: "SM" },
|
|
1074
|
+
{ token: "--opt-radius-md", label: "MD" },
|
|
1075
|
+
{ token: "--opt-radius-lg", label: "LG" },
|
|
1076
|
+
{ token: "--opt-radius-xl", label: "XL" }
|
|
1077
|
+
];
|
|
1078
|
+
var TYPO_TOKENS = [
|
|
1079
|
+
{ token: "--opt-font-heading", label: "Heading" },
|
|
1080
|
+
{ token: "--opt-font-body", label: "Body" },
|
|
1081
|
+
{ token: "--opt-tracking-heading", label: "Tracking" },
|
|
1082
|
+
{ token: "--opt-weight-heading", label: "Weight" }
|
|
1083
|
+
];
|
|
1084
|
+
var CONTRAST_PAIRS = [
|
|
1085
|
+
{ fg: "--opt-text", bg: "--opt-surface", label: "text / surface" },
|
|
1086
|
+
{ fg: "--opt-accent-fg", bg: "--opt-accent", label: "accentFg / accent" },
|
|
1087
|
+
{
|
|
1088
|
+
fg: "--opt-text-secondary",
|
|
1089
|
+
bg: "--opt-surface",
|
|
1090
|
+
label: "text2nd / surface"
|
|
1091
|
+
}
|
|
1092
|
+
];
|
|
1093
|
+
var ALL_COLOR_TOKENS = [
|
|
1094
|
+
...COLOR_TOKENS.primary,
|
|
1095
|
+
...COLOR_TOKENS.status,
|
|
1096
|
+
...COLOR_TOKENS.chart
|
|
1097
|
+
];
|
|
1098
|
+
function parseComputedColor(value) {
|
|
1099
|
+
const rgbMatch = value.match(
|
|
1100
|
+
/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*[\d.]+)?\s*\)/
|
|
1101
|
+
);
|
|
1102
|
+
if (rgbMatch) {
|
|
1103
|
+
return [Number(rgbMatch[1]), Number(rgbMatch[2]), Number(rgbMatch[3])];
|
|
1104
|
+
}
|
|
1105
|
+
const hexMatch = value.match(/^#([0-9a-f]{3,8})$/i);
|
|
1106
|
+
if (hexMatch) {
|
|
1107
|
+
let hex = hexMatch[1];
|
|
1108
|
+
if (hex.length === 3) {
|
|
1109
|
+
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
|
|
1110
|
+
}
|
|
1111
|
+
return [
|
|
1112
|
+
parseInt(hex.slice(0, 2), 16),
|
|
1113
|
+
parseInt(hex.slice(2, 4), 16),
|
|
1114
|
+
parseInt(hex.slice(4, 6), 16)
|
|
1115
|
+
];
|
|
1116
|
+
}
|
|
1117
|
+
return null;
|
|
1118
|
+
}
|
|
1119
|
+
function parseThemeAttribute(attr) {
|
|
1120
|
+
if (!attr) return { preset: "default", dark: false };
|
|
1121
|
+
const dark = attr.endsWith("-dark");
|
|
1122
|
+
const preset = dark ? attr.replace(/-dark$/, "") : attr;
|
|
1123
|
+
return { preset, dark };
|
|
1124
|
+
}
|
|
1125
|
+
function useComputedTheme(visible) {
|
|
1126
|
+
const [state, setState] = useState2(() => ({
|
|
1127
|
+
preset: "default",
|
|
1128
|
+
dark: false,
|
|
1129
|
+
tokens: {}
|
|
1130
|
+
}));
|
|
1131
|
+
const readTokens = useCallback(() => {
|
|
1132
|
+
const root = document.documentElement;
|
|
1133
|
+
const attr = root.getAttribute("data-theme");
|
|
1134
|
+
const { preset, dark } = parseThemeAttribute(attr);
|
|
1135
|
+
const style = getComputedStyle(root);
|
|
1136
|
+
const tokens = {};
|
|
1137
|
+
for (const { token } of ALL_COLOR_TOKENS) {
|
|
1138
|
+
tokens[token] = style.getPropertyValue(token).trim();
|
|
1139
|
+
}
|
|
1140
|
+
for (const { token } of SPACING_TOKENS) {
|
|
1141
|
+
tokens[token] = style.getPropertyValue(token).trim();
|
|
1142
|
+
}
|
|
1143
|
+
for (const { token } of RADIUS_TOKENS) {
|
|
1144
|
+
tokens[token] = style.getPropertyValue(token).trim();
|
|
1145
|
+
}
|
|
1146
|
+
for (const { token } of TYPO_TOKENS) {
|
|
1147
|
+
tokens[token] = style.getPropertyValue(token).trim();
|
|
1148
|
+
}
|
|
1149
|
+
setState({ preset, dark, tokens });
|
|
1150
|
+
}, []);
|
|
1151
|
+
useEffect(() => {
|
|
1152
|
+
if (!visible) return;
|
|
1153
|
+
readTokens();
|
|
1154
|
+
const observer = new MutationObserver((mutations) => {
|
|
1155
|
+
for (const m of mutations) {
|
|
1156
|
+
if (m.type === "attributes" && (m.attributeName === "data-theme" || m.attributeName === "class")) {
|
|
1157
|
+
readTokens();
|
|
1158
|
+
return;
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
});
|
|
1162
|
+
observer.observe(document.documentElement, {
|
|
1163
|
+
attributes: true,
|
|
1164
|
+
attributeFilter: ["data-theme", "class"]
|
|
1165
|
+
});
|
|
1166
|
+
return () => observer.disconnect();
|
|
1167
|
+
}, [visible, readTokens]);
|
|
1168
|
+
return state;
|
|
1169
|
+
}
|
|
1170
|
+
function SwatchGrid({
|
|
1171
|
+
tokens,
|
|
1172
|
+
items
|
|
1173
|
+
}) {
|
|
1174
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex flex-wrap gap-1", children: items.map(({ token, label }) => {
|
|
1175
|
+
const value = tokens[token];
|
|
1176
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1177
|
+
"div",
|
|
1178
|
+
{
|
|
1179
|
+
className: "flex flex-col items-center gap-0.5",
|
|
1180
|
+
title: `${token}: ${value || "(empty)"}`,
|
|
1181
|
+
children: [
|
|
1182
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1183
|
+
"div",
|
|
1184
|
+
{
|
|
1185
|
+
className: "h-4 w-4 rounded-sm border border-white/15",
|
|
1186
|
+
style: { backgroundColor: value || "#888" }
|
|
1187
|
+
}
|
|
1188
|
+
),
|
|
1189
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-[7px] text-white/30", children: label })
|
|
1190
|
+
]
|
|
1191
|
+
},
|
|
1192
|
+
token
|
|
1193
|
+
);
|
|
1194
|
+
}) });
|
|
1195
|
+
}
|
|
1196
|
+
function ContrastAudit({ tokens }) {
|
|
1197
|
+
const pairs = useMemo2(() => {
|
|
1198
|
+
const results = [];
|
|
1199
|
+
for (const { fg, bg, label } of CONTRAST_PAIRS) {
|
|
1200
|
+
const fgVal = tokens[fg];
|
|
1201
|
+
const bgVal = tokens[bg];
|
|
1202
|
+
if (!fgVal || !bgVal) continue;
|
|
1203
|
+
const fgRgb = parseComputedColor(fgVal);
|
|
1204
|
+
const bgRgb = parseComputedColor(bgVal);
|
|
1205
|
+
if (!fgRgb || !bgRgb) continue;
|
|
1206
|
+
const ratio = _optpalette.contrastRatio.call(void 0, fgRgb, bgRgb);
|
|
1207
|
+
results.push({
|
|
1208
|
+
label,
|
|
1209
|
+
fg,
|
|
1210
|
+
bg,
|
|
1211
|
+
fgVal,
|
|
1212
|
+
bgVal,
|
|
1213
|
+
ratio,
|
|
1214
|
+
level: _optpalette.wcagLevel.call(void 0, ratio)
|
|
1215
|
+
});
|
|
1216
|
+
}
|
|
1217
|
+
return results;
|
|
1218
|
+
}, [tokens]);
|
|
1219
|
+
if (pairs.length === 0) return null;
|
|
1220
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex flex-col gap-0.5 text-[10px]", children: pairs.map(({ label, fgVal, bgVal, ratio, level }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-1.5", children: [
|
|
1221
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-0.5", children: [
|
|
1222
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1223
|
+
"div",
|
|
1224
|
+
{
|
|
1225
|
+
className: "h-3 w-3 rounded-sm border border-white/10",
|
|
1226
|
+
style: { backgroundColor: fgVal }
|
|
1227
|
+
}
|
|
1228
|
+
),
|
|
1229
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1230
|
+
"div",
|
|
1231
|
+
{
|
|
1232
|
+
className: "h-3 w-3 rounded-sm border border-white/10",
|
|
1233
|
+
style: { backgroundColor: bgVal }
|
|
1234
|
+
}
|
|
1235
|
+
)
|
|
1236
|
+
] }),
|
|
1237
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-white/50", children: label }),
|
|
1238
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1239
|
+
"span",
|
|
1240
|
+
{
|
|
1241
|
+
className: level === "Fail" ? "text-red-400" : level === "AAA" ? "text-emerald-400" : "text-amber-300",
|
|
1242
|
+
children: [
|
|
1243
|
+
ratio.toFixed(1),
|
|
1244
|
+
" ",
|
|
1245
|
+
level
|
|
1246
|
+
]
|
|
1247
|
+
}
|
|
1248
|
+
)
|
|
1249
|
+
] }, label)) });
|
|
1250
|
+
}
|
|
1251
|
+
var MODES = [
|
|
1252
|
+
{ value: "light", label: "Light" },
|
|
1253
|
+
{ value: "dark", label: "Dark" },
|
|
1254
|
+
{ value: "system", label: "System" }
|
|
1255
|
+
];
|
|
1256
|
+
function ThemePanel({ visible }) {
|
|
1257
|
+
const { preset, dark, tokens } = useComputedTheme(visible);
|
|
1258
|
+
const { mode, setMode } = _optui.useOptTheme.call(void 0, );
|
|
1259
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "divide-y divide-white/10", style: _chunkEQPETYJJcjs.ISOLATE_STYLE, children: [
|
|
1260
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Section, { title: "\uD604\uC7AC \uD14C\uB9C8", color: "text-violet-400", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-2", children: [
|
|
1261
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
1262
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rounded bg-violet-500/20 px-1.5 py-0.5 text-[10px] font-semibold text-violet-300", children: preset }),
|
|
1263
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1264
|
+
"span",
|
|
1265
|
+
{
|
|
1266
|
+
className: `rounded px-1.5 py-0.5 text-[10px] font-semibold ${dark ? "bg-white/10 text-white/70" : "bg-amber-500/20 text-amber-300"}`,
|
|
1267
|
+
children: dark ? "dark" : "light"
|
|
1268
|
+
}
|
|
1269
|
+
)
|
|
1270
|
+
] }),
|
|
1271
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center gap-1", children: MODES.map(({ value, label }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1272
|
+
"button",
|
|
1273
|
+
{
|
|
1274
|
+
tabIndex: -1,
|
|
1275
|
+
onClick: () => setMode(value),
|
|
1276
|
+
className: `rounded px-2 py-0.5 text-[10px] font-semibold transition-colors ${mode === value ? "bg-violet-600 text-white" : "bg-white/10 text-white/45 hover:text-white/70"}`,
|
|
1277
|
+
children: label
|
|
1278
|
+
},
|
|
1279
|
+
value
|
|
1280
|
+
)) })
|
|
1281
|
+
] }) }),
|
|
1282
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Section, { title: "\uCEEC\uB7EC \uD1A0\uD070", color: "text-blue-400", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-2.5", children: [
|
|
1283
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
1284
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-1 text-[9px] text-white/40", children: "Primary" }),
|
|
1285
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SwatchGrid, { tokens, items: COLOR_TOKENS.primary })
|
|
1286
|
+
] }),
|
|
1287
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
1288
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-1 text-[9px] text-white/40", children: "Status" }),
|
|
1289
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SwatchGrid, { tokens, items: COLOR_TOKENS.status })
|
|
1290
|
+
] }),
|
|
1291
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
1292
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-1 text-[9px] text-white/40", children: "Chart" }),
|
|
1293
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SwatchGrid, { tokens, items: COLOR_TOKENS.chart })
|
|
1294
|
+
] })
|
|
1295
|
+
] }) }),
|
|
1296
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Section, { title: "\uB300\uBE44 \uAC80\uC0AC", color: "text-emerald-400", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ContrastAudit, { tokens }) }),
|
|
1297
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Section, { title: "\uC2A4\uD398\uC774\uC2F1 / \uB808\uC774\uB514\uC5B4\uC2A4", color: "text-teal-400", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4 gap-y-1 text-[10px]", children: [
|
|
1298
|
+
SPACING_TOKENS.map(({ token, label }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1299
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-white/40", children: label }),
|
|
1300
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "font-mono text-white/70", children: tokens[token] || "\u2014" })
|
|
1301
|
+
] }, token)),
|
|
1302
|
+
RADIUS_TOKENS.map(({ token, label }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1303
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-white/40", children: [
|
|
1304
|
+
"R ",
|
|
1305
|
+
label
|
|
1306
|
+
] }),
|
|
1307
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "font-mono text-white/70", children: tokens[token] || "\u2014" })
|
|
1308
|
+
] }, token))
|
|
1309
|
+
] }) }),
|
|
1310
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Section, { title: "\uD0C0\uC774\uD3EC\uADF8\uB798\uD53C", color: "text-pink-400", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex flex-col gap-1 text-[10px]", children: TYPO_TOKENS.map(({ token, label }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
1311
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "shrink-0 text-white/40", children: label }),
|
|
1312
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "truncate font-mono text-white/70", children: tokens[token] || "\u2014" })
|
|
1313
|
+
] }, token)) }) })
|
|
1314
|
+
] });
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
// src/panels/harness-panel.tsx
|
|
1318
|
+
|
|
1319
|
+
|
|
1320
|
+
var { useCallback: useCallback2, useEffect: useEffect2, useState: useState3, useSyncExternalStore } = React4;
|
|
1321
|
+
var DEFAULTS = {
|
|
1322
|
+
density: "comfortable",
|
|
1323
|
+
contentWidth: "wide",
|
|
1324
|
+
navigationMode: "sidebar",
|
|
1325
|
+
themeMode: "preset",
|
|
1326
|
+
stickyAside: true,
|
|
1327
|
+
stickyToolbar: false,
|
|
1328
|
+
datagridChrome: "card",
|
|
1329
|
+
editorChrome: "card"
|
|
1330
|
+
};
|
|
1331
|
+
function StatusDot({ active, label }) {
|
|
1332
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "inline-flex items-center gap-1", children: [
|
|
1333
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1334
|
+
"span",
|
|
1335
|
+
{
|
|
1336
|
+
className: `inline-block h-1.5 w-1.5 rounded-full ${active ? "bg-emerald-400" : "bg-white/20"}`
|
|
1337
|
+
}
|
|
1338
|
+
),
|
|
1339
|
+
label
|
|
1340
|
+
] });
|
|
1341
|
+
}
|
|
1342
|
+
function PolicyRow({
|
|
1343
|
+
label,
|
|
1344
|
+
value,
|
|
1345
|
+
defaultValue
|
|
1346
|
+
}) {
|
|
1347
|
+
const isOverridden = defaultValue !== void 0 && value !== defaultValue;
|
|
1348
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1349
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-white/40", children: label }),
|
|
1350
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-1", children: [
|
|
1351
|
+
isOverridden && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-[8px] text-white/25 line-through", children: defaultValue }),
|
|
1352
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1353
|
+
"span",
|
|
1354
|
+
{
|
|
1355
|
+
className: `font-mono ${isOverridden ? "text-amber-300" : "text-emerald-300"}`,
|
|
1356
|
+
children: value
|
|
1357
|
+
}
|
|
1358
|
+
)
|
|
1359
|
+
] })
|
|
1360
|
+
] });
|
|
1361
|
+
}
|
|
1362
|
+
function useShellSlots(visible) {
|
|
1363
|
+
const [slots, setSlots] = useState3([]);
|
|
1364
|
+
const [recipe, setRecipe] = useState3(null);
|
|
1365
|
+
useEffect2(() => {
|
|
1366
|
+
if (!visible) return;
|
|
1367
|
+
let rafId = 0;
|
|
1368
|
+
function scan() {
|
|
1369
|
+
var _a;
|
|
1370
|
+
const slotEls = document.querySelectorAll("[data-harness-slot]");
|
|
1371
|
+
const next = [];
|
|
1372
|
+
slotEls.forEach((el) => {
|
|
1373
|
+
var _a2;
|
|
1374
|
+
const rect = el.getBoundingClientRect();
|
|
1375
|
+
if (rect.width > 0 && rect.height > 0) {
|
|
1376
|
+
next.push({
|
|
1377
|
+
name: (_a2 = el.getAttribute("data-harness-slot")) != null ? _a2 : "",
|
|
1378
|
+
width: Math.round(rect.width),
|
|
1379
|
+
height: Math.round(rect.height)
|
|
1380
|
+
});
|
|
1381
|
+
}
|
|
1382
|
+
});
|
|
1383
|
+
setSlots(next);
|
|
1384
|
+
const recipeEl = document.querySelector("[data-harness-recipe]");
|
|
1385
|
+
setRecipe(
|
|
1386
|
+
recipeEl ? (_a = recipeEl.getAttribute("data-harness-recipe")) != null ? _a : null : null
|
|
1387
|
+
);
|
|
1388
|
+
}
|
|
1389
|
+
function debounced() {
|
|
1390
|
+
cancelAnimationFrame(rafId);
|
|
1391
|
+
rafId = requestAnimationFrame(scan);
|
|
1392
|
+
}
|
|
1393
|
+
scan();
|
|
1394
|
+
const observer = new MutationObserver(debounced);
|
|
1395
|
+
observer.observe(document.body, {
|
|
1396
|
+
childList: true,
|
|
1397
|
+
subtree: true,
|
|
1398
|
+
attributes: true
|
|
1399
|
+
});
|
|
1400
|
+
window.addEventListener("resize", debounced);
|
|
1401
|
+
return () => {
|
|
1402
|
+
observer.disconnect();
|
|
1403
|
+
cancelAnimationFrame(rafId);
|
|
1404
|
+
window.removeEventListener("resize", debounced);
|
|
1405
|
+
};
|
|
1406
|
+
}, [visible]);
|
|
1407
|
+
return { slots, recipe };
|
|
1408
|
+
}
|
|
1409
|
+
function CopyIcon({ size = 12 }) {
|
|
1410
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1411
|
+
"svg",
|
|
1412
|
+
{
|
|
1413
|
+
width: size,
|
|
1414
|
+
height: size,
|
|
1415
|
+
viewBox: "0 0 14 14",
|
|
1416
|
+
fill: "none",
|
|
1417
|
+
stroke: "currentColor",
|
|
1418
|
+
strokeWidth: "1.5",
|
|
1419
|
+
children: [
|
|
1420
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "rect", { x: "4", y: "4", width: "9", height: "9", rx: "1.5" }),
|
|
1421
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M10 4V2.5A1.5 1.5 0 008.5 1h-6A1.5 1.5 0 001 2.5v6A1.5 1.5 0 002.5 10H4" })
|
|
1422
|
+
]
|
|
1423
|
+
}
|
|
1424
|
+
);
|
|
1425
|
+
}
|
|
1426
|
+
function CheckIcon({ size = 12 }) {
|
|
1427
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1428
|
+
"svg",
|
|
1429
|
+
{
|
|
1430
|
+
width: size,
|
|
1431
|
+
height: size,
|
|
1432
|
+
viewBox: "0 0 14 14",
|
|
1433
|
+
fill: "none",
|
|
1434
|
+
stroke: "currentColor",
|
|
1435
|
+
strokeWidth: "2",
|
|
1436
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M2 7l3.5 3.5L12 3" })
|
|
1437
|
+
}
|
|
1438
|
+
);
|
|
1439
|
+
}
|
|
1440
|
+
var SLOT_COLORS = {
|
|
1441
|
+
header: "text-amber-400",
|
|
1442
|
+
toolbar: "text-blue-400",
|
|
1443
|
+
filters: "text-purple-400",
|
|
1444
|
+
content: "text-emerald-400",
|
|
1445
|
+
aside: "text-cyan-400",
|
|
1446
|
+
footer: "text-zinc-400"
|
|
1447
|
+
};
|
|
1448
|
+
function ShellPanel() {
|
|
1449
|
+
const snapshot = useSyncExternalStore(
|
|
1450
|
+
_chunkH3F2WACScjs.subscribeShellSnapshot,
|
|
1451
|
+
_chunkH3F2WACScjs.getShellSnapshot,
|
|
1452
|
+
() => null
|
|
1453
|
+
);
|
|
1454
|
+
const showOverlay = useSyncExternalStore(
|
|
1455
|
+
_chunkH3F2WACScjs.subscribeShellOverlay,
|
|
1456
|
+
_chunkH3F2WACScjs.getShellOverlay,
|
|
1457
|
+
() => false
|
|
1458
|
+
);
|
|
1459
|
+
const managerHref = _chunkH3F2WACScjs.getShellManagerHref.call(void 0, );
|
|
1460
|
+
const { slots, recipe } = useShellSlots(snapshot !== null);
|
|
1461
|
+
const [copied, setCopied] = useState3(false);
|
|
1462
|
+
const handleCopy = useCallback2(() => {
|
|
1463
|
+
if (!snapshot) return;
|
|
1464
|
+
navigator.clipboard.writeText(JSON.stringify(snapshot, null, 2)).then(() => {
|
|
1465
|
+
setCopied(true);
|
|
1466
|
+
setTimeout(() => setCopied(false), 1500);
|
|
1467
|
+
});
|
|
1468
|
+
}, [snapshot]);
|
|
1469
|
+
if (!snapshot) {
|
|
1470
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1471
|
+
"div",
|
|
1472
|
+
{
|
|
1473
|
+
className: "px-3 py-6 text-center text-[11px] text-white/55",
|
|
1474
|
+
style: _chunkEQPETYJJcjs.ISOLATE_STYLE,
|
|
1475
|
+
children: "\uC774 \uD398\uC774\uC9C0\uC5D0 \uC801\uC6A9\uB41C \uD558\uB124\uC2A4\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."
|
|
1476
|
+
}
|
|
1477
|
+
);
|
|
1478
|
+
}
|
|
1479
|
+
const hasActiveAdapter = snapshot.adapters.datagrid.active || snapshot.adapters.editor.active;
|
|
1480
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "divide-y divide-white/10", style: _chunkEQPETYJJcjs.ISOLATE_STYLE, children: [
|
|
1481
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center gap-2 px-3 py-2", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1482
|
+
"button",
|
|
1483
|
+
{
|
|
1484
|
+
tabIndex: -1,
|
|
1485
|
+
onClick: _chunkH3F2WACScjs.toggleShellOverlay,
|
|
1486
|
+
className: `rounded px-2 py-0.5 text-[10px] font-semibold transition-colors ${showOverlay ? "bg-amber-600 text-white" : "bg-white/10 text-white/45 hover:text-white/70"}`,
|
|
1487
|
+
children: [
|
|
1488
|
+
"\uC2AC\uB86F \uACBD\uACC4 ",
|
|
1489
|
+
showOverlay ? "ON" : "OFF"
|
|
1490
|
+
]
|
|
1491
|
+
}
|
|
1492
|
+
) }),
|
|
1493
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1494
|
+
CollapsibleSection,
|
|
1495
|
+
{
|
|
1496
|
+
title: "\uB9E4\uB2C8\uD398\uC2A4\uD2B8",
|
|
1497
|
+
color: "text-emerald-400",
|
|
1498
|
+
summary: `${snapshot.manifestId} \xB7 v${snapshot.version}`,
|
|
1499
|
+
trailing: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1500
|
+
"button",
|
|
1501
|
+
{
|
|
1502
|
+
tabIndex: -1,
|
|
1503
|
+
onClick: handleCopy,
|
|
1504
|
+
className: "text-white/40 transition-colors hover:text-white/70",
|
|
1505
|
+
title: "\uC2A4\uB0C5\uC0F7 JSON \uBCF5\uC0AC",
|
|
1506
|
+
children: copied ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CheckIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CopyIcon, {})
|
|
1507
|
+
}
|
|
1508
|
+
),
|
|
1509
|
+
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-1.5", children: [
|
|
1510
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
1511
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rounded bg-emerald-500/20 px-1.5 py-0.5 text-[10px] font-semibold text-emerald-300", children: snapshot.manifestLabel }),
|
|
1512
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "font-mono text-[9px] text-white/40", children: snapshot.manifestId })
|
|
1513
|
+
] }),
|
|
1514
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2 text-[10px]", children: [
|
|
1515
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1516
|
+
"span",
|
|
1517
|
+
{
|
|
1518
|
+
className: `inline-block h-1.5 w-1.5 rounded-full ${snapshot.staleness.stale ? "bg-amber-400" : "bg-emerald-400"}`
|
|
1519
|
+
}
|
|
1520
|
+
),
|
|
1521
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1522
|
+
"span",
|
|
1523
|
+
{
|
|
1524
|
+
className: snapshot.staleness.stale ? "text-amber-300" : "text-emerald-300",
|
|
1525
|
+
children: snapshot.staleness.stale ? `Stale (${Math.round((Date.now() - snapshot.staleness.capturedAt) / 1e3)}s)` : "Fresh"
|
|
1526
|
+
}
|
|
1527
|
+
),
|
|
1528
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-white/30", children: [
|
|
1529
|
+
"v",
|
|
1530
|
+
snapshot.version
|
|
1531
|
+
] })
|
|
1532
|
+
] }),
|
|
1533
|
+
managerHref && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1534
|
+
"a",
|
|
1535
|
+
{
|
|
1536
|
+
href: `${managerHref}?manifest=${encodeURIComponent(snapshot.manifestId)}`,
|
|
1537
|
+
target: "_blank",
|
|
1538
|
+
rel: "noopener noreferrer",
|
|
1539
|
+
className: "mt-1 inline-flex items-center gap-1 rounded bg-emerald-900/40 px-2 py-1 text-[10px] text-emerald-400 transition-colors hover:bg-emerald-900/60 hover:text-emerald-300",
|
|
1540
|
+
style: { pointerEvents: "auto" },
|
|
1541
|
+
children: [
|
|
1542
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1543
|
+
"svg",
|
|
1544
|
+
{
|
|
1545
|
+
width: "10",
|
|
1546
|
+
height: "10",
|
|
1547
|
+
viewBox: "0 0 10 10",
|
|
1548
|
+
fill: "none",
|
|
1549
|
+
stroke: "currentColor",
|
|
1550
|
+
strokeWidth: "1.5",
|
|
1551
|
+
children: [
|
|
1552
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M4 1H2a1 1 0 00-1 1v6a1 1 0 001 1h6a1 1 0 001-1V6" }),
|
|
1553
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M6 1h3v3M9 1L4.5 5.5" })
|
|
1554
|
+
]
|
|
1555
|
+
}
|
|
1556
|
+
),
|
|
1557
|
+
"Harness Manager"
|
|
1558
|
+
]
|
|
1559
|
+
}
|
|
1560
|
+
)
|
|
1561
|
+
] })
|
|
1562
|
+
}
|
|
1563
|
+
),
|
|
1564
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1565
|
+
CollapsibleSection,
|
|
1566
|
+
{
|
|
1567
|
+
title: "\uC815\uCC45",
|
|
1568
|
+
color: "text-blue-400",
|
|
1569
|
+
summary: `${snapshot.density} \xB7 ${snapshot.contentWidth}`,
|
|
1570
|
+
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4 gap-y-1 text-[10px]", children: [
|
|
1571
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1572
|
+
PolicyRow,
|
|
1573
|
+
{
|
|
1574
|
+
label: "Density",
|
|
1575
|
+
value: snapshot.density,
|
|
1576
|
+
defaultValue: DEFAULTS.density
|
|
1577
|
+
}
|
|
1578
|
+
),
|
|
1579
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1580
|
+
PolicyRow,
|
|
1581
|
+
{
|
|
1582
|
+
label: "Width",
|
|
1583
|
+
value: snapshot.contentWidth,
|
|
1584
|
+
defaultValue: DEFAULTS.contentWidth
|
|
1585
|
+
}
|
|
1586
|
+
),
|
|
1587
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1588
|
+
PolicyRow,
|
|
1589
|
+
{
|
|
1590
|
+
label: "Nav",
|
|
1591
|
+
value: snapshot.navigationMode,
|
|
1592
|
+
defaultValue: DEFAULTS.navigationMode
|
|
1593
|
+
}
|
|
1594
|
+
),
|
|
1595
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1596
|
+
PolicyRow,
|
|
1597
|
+
{
|
|
1598
|
+
label: "Theme",
|
|
1599
|
+
value: snapshot.themeMode,
|
|
1600
|
+
defaultValue: DEFAULTS.themeMode
|
|
1601
|
+
}
|
|
1602
|
+
),
|
|
1603
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1604
|
+
PolicyRow,
|
|
1605
|
+
{
|
|
1606
|
+
label: "Sticky Aside",
|
|
1607
|
+
value: snapshot.panelBehavior.stickyAside ? "ON" : "OFF",
|
|
1608
|
+
defaultValue: DEFAULTS.stickyAside ? "ON" : "OFF"
|
|
1609
|
+
}
|
|
1610
|
+
),
|
|
1611
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1612
|
+
PolicyRow,
|
|
1613
|
+
{
|
|
1614
|
+
label: "Sticky Toolbar",
|
|
1615
|
+
value: snapshot.panelBehavior.stickyToolbar ? "ON" : "OFF",
|
|
1616
|
+
defaultValue: DEFAULTS.stickyToolbar ? "ON" : "OFF"
|
|
1617
|
+
}
|
|
1618
|
+
)
|
|
1619
|
+
] })
|
|
1620
|
+
}
|
|
1621
|
+
),
|
|
1622
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1623
|
+
CollapsibleSection,
|
|
1624
|
+
{
|
|
1625
|
+
title: "\uC0C1\uD0DC \uACBD\uACC4",
|
|
1626
|
+
color: "text-amber-400",
|
|
1627
|
+
summary: snapshot.stateBoundary ? [
|
|
1628
|
+
snapshot.stateBoundary.loading && "loading",
|
|
1629
|
+
snapshot.stateBoundary.empty && "empty",
|
|
1630
|
+
snapshot.stateBoundary.error && "error"
|
|
1631
|
+
].filter(Boolean).join(", ") || "idle" : "\u2014",
|
|
1632
|
+
defaultOpen: Boolean(snapshot.stateBoundary),
|
|
1633
|
+
children: snapshot.stateBoundary ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 text-[10px] text-white/70", children: [
|
|
1634
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1635
|
+
StatusDot,
|
|
1636
|
+
{
|
|
1637
|
+
active: snapshot.stateBoundary.loading,
|
|
1638
|
+
label: "loading"
|
|
1639
|
+
}
|
|
1640
|
+
),
|
|
1641
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, StatusDot, { active: snapshot.stateBoundary.empty, label: "empty" }),
|
|
1642
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, StatusDot, { active: snapshot.stateBoundary.error, label: "error" }),
|
|
1643
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-white/40", children: [
|
|
1644
|
+
"chrome",
|
|
1645
|
+
" ",
|
|
1646
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-white/60", children: snapshot.stateBoundary.chrome })
|
|
1647
|
+
] })
|
|
1648
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-[10px] text-white/40", children: "\uD65C\uC131 StateBoundary \uC5C6\uC74C" })
|
|
1649
|
+
}
|
|
1650
|
+
),
|
|
1651
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1652
|
+
CollapsibleSection,
|
|
1653
|
+
{
|
|
1654
|
+
title: "\uC5B4\uB311\uD130",
|
|
1655
|
+
color: "text-cyan-400",
|
|
1656
|
+
summary: hasActiveAdapter ? [
|
|
1657
|
+
snapshot.adapters.datagrid.active && "DataGrid",
|
|
1658
|
+
snapshot.adapters.editor.active && "Editor"
|
|
1659
|
+
].filter(Boolean).join(" + ") : "idle",
|
|
1660
|
+
defaultOpen: hasActiveAdapter,
|
|
1661
|
+
children: !hasActiveAdapter ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-[10px] text-white/40", children: "\uD65C\uC131 \uC5B4\uB311\uD130 \uC5C6\uC74C" }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-2 text-[10px] text-white/70", children: [
|
|
1662
|
+
snapshot.adapters.datagrid.active && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
1663
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-0.5 text-[9px] font-semibold text-cyan-300", children: "DataGrid" }),
|
|
1664
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2", children: [
|
|
1665
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1666
|
+
PolicyRow,
|
|
1667
|
+
{
|
|
1668
|
+
label: "chrome",
|
|
1669
|
+
value: snapshot.adapters.datagrid.chrome,
|
|
1670
|
+
defaultValue: DEFAULTS.datagridChrome
|
|
1671
|
+
}
|
|
1672
|
+
),
|
|
1673
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1674
|
+
StatusDot,
|
|
1675
|
+
{
|
|
1676
|
+
active: snapshot.adapters.datagrid.loading,
|
|
1677
|
+
label: "loading"
|
|
1678
|
+
}
|
|
1679
|
+
),
|
|
1680
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1681
|
+
StatusDot,
|
|
1682
|
+
{
|
|
1683
|
+
active: snapshot.adapters.datagrid.empty,
|
|
1684
|
+
label: "empty"
|
|
1685
|
+
}
|
|
1686
|
+
),
|
|
1687
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1688
|
+
StatusDot,
|
|
1689
|
+
{
|
|
1690
|
+
active: snapshot.adapters.datagrid.error,
|
|
1691
|
+
label: "error"
|
|
1692
|
+
}
|
|
1693
|
+
)
|
|
1694
|
+
] })
|
|
1695
|
+
] }),
|
|
1696
|
+
snapshot.adapters.editor.active && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
1697
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-0.5 text-[9px] font-semibold text-cyan-300", children: "Editor" }),
|
|
1698
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2", children: [
|
|
1699
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1700
|
+
PolicyRow,
|
|
1701
|
+
{
|
|
1702
|
+
label: "chrome",
|
|
1703
|
+
value: snapshot.adapters.editor.chrome,
|
|
1704
|
+
defaultValue: DEFAULTS.editorChrome
|
|
1705
|
+
}
|
|
1706
|
+
),
|
|
1707
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1708
|
+
StatusDot,
|
|
1709
|
+
{
|
|
1710
|
+
active: snapshot.adapters.editor.loading,
|
|
1711
|
+
label: "loading"
|
|
1712
|
+
}
|
|
1713
|
+
),
|
|
1714
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1715
|
+
StatusDot,
|
|
1716
|
+
{
|
|
1717
|
+
active: snapshot.adapters.editor.empty,
|
|
1718
|
+
label: "empty"
|
|
1719
|
+
}
|
|
1720
|
+
),
|
|
1721
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1722
|
+
StatusDot,
|
|
1723
|
+
{
|
|
1724
|
+
active: snapshot.adapters.editor.error,
|
|
1725
|
+
label: "error"
|
|
1726
|
+
}
|
|
1727
|
+
),
|
|
1728
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1729
|
+
StatusDot,
|
|
1730
|
+
{
|
|
1731
|
+
active: snapshot.adapters.editor.hasInspector,
|
|
1732
|
+
label: "inspector"
|
|
1733
|
+
}
|
|
1734
|
+
)
|
|
1735
|
+
] })
|
|
1736
|
+
] })
|
|
1737
|
+
] })
|
|
1738
|
+
}
|
|
1739
|
+
),
|
|
1740
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1741
|
+
CollapsibleSection,
|
|
1742
|
+
{
|
|
1743
|
+
title: "\uC2AC\uB86F",
|
|
1744
|
+
color: "text-purple-400",
|
|
1745
|
+
summary: slots.length > 0 ? `${slots.length}\uAC1C${recipe ? ` \xB7 ${recipe}` : ""}` : "\u2014",
|
|
1746
|
+
defaultOpen: slots.length > 0,
|
|
1747
|
+
children: slots.length === 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-[10px] text-white/40", children: "\uBC1C\uACAC\uB41C \uC2AC\uB86F \uC5C6\uC74C" }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-0.5 text-[10px]", children: [
|
|
1748
|
+
recipe && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-1 flex items-center gap-1.5", children: [
|
|
1749
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rounded bg-amber-500/20 px-1.5 py-0.5 text-[9px] font-semibold text-amber-300", children: recipe }),
|
|
1750
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-white/30", children: "workspace" })
|
|
1751
|
+
] }),
|
|
1752
|
+
slots.map((slot, i) => {
|
|
1753
|
+
var _a;
|
|
1754
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1755
|
+
"div",
|
|
1756
|
+
{
|
|
1757
|
+
className: "flex items-center gap-2",
|
|
1758
|
+
children: [
|
|
1759
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: (_a = SLOT_COLORS[slot.name]) != null ? _a : "text-white/60", children: slot.name }),
|
|
1760
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "font-mono text-white/30", children: [
|
|
1761
|
+
slot.width,
|
|
1762
|
+
"\xD7",
|
|
1763
|
+
slot.height
|
|
1764
|
+
] })
|
|
1765
|
+
]
|
|
1766
|
+
},
|
|
1767
|
+
`${slot.name}-${i}`
|
|
1768
|
+
);
|
|
1769
|
+
})
|
|
1770
|
+
] })
|
|
1771
|
+
}
|
|
1772
|
+
),
|
|
1773
|
+
snapshot.diff && !snapshot.diff.empty && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1774
|
+
CollapsibleSection,
|
|
1775
|
+
{
|
|
1776
|
+
title: `\uBCC0\uACBD\uC0AC\uD56D (v${snapshot.diff.baseVersion} \u2192 v${snapshot.diff.headVersion})`,
|
|
1777
|
+
color: "text-amber-400",
|
|
1778
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex flex-col gap-1 text-[10px] text-white/70", children: snapshot.diff.entries.map((entry, i) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-1", children: [
|
|
1779
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-amber-300", children: [
|
|
1780
|
+
entry.path,
|
|
1781
|
+
":"
|
|
1782
|
+
] }),
|
|
1783
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-red-400/70 line-through", children: JSON.stringify(entry.prev) }),
|
|
1784
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-white/30", children: "\u2192" }),
|
|
1785
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-emerald-400", children: JSON.stringify(entry.next) })
|
|
1786
|
+
] }, i)) })
|
|
1787
|
+
}
|
|
1788
|
+
)
|
|
1789
|
+
] });
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
// src/overlays/shared.tsx
|
|
1793
|
+
|
|
1794
|
+
function HighlightRing({
|
|
1795
|
+
rect,
|
|
1796
|
+
color,
|
|
1797
|
+
solid
|
|
1798
|
+
}) {
|
|
1799
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1800
|
+
"div",
|
|
1801
|
+
{
|
|
1802
|
+
className: "absolute rounded-lg",
|
|
1803
|
+
style: {
|
|
1804
|
+
left: rect.left - 3,
|
|
1805
|
+
top: rect.top - 3,
|
|
1806
|
+
width: rect.width + 6,
|
|
1807
|
+
height: rect.height + 6,
|
|
1808
|
+
border: `2px ${solid ? "solid" : "dashed"} ${color}`
|
|
1809
|
+
}
|
|
1810
|
+
}
|
|
1811
|
+
);
|
|
1812
|
+
}
|
|
1813
|
+
function ConnectorLine({
|
|
1814
|
+
from,
|
|
1815
|
+
to,
|
|
1816
|
+
color,
|
|
1817
|
+
label,
|
|
1818
|
+
dotted
|
|
1819
|
+
}) {
|
|
1820
|
+
const fromCenterX = from.left + from.width / 2;
|
|
1821
|
+
const fromCenterY = from.top + from.height / 2;
|
|
1822
|
+
const toCenterX = to.left + to.width / 2;
|
|
1823
|
+
const toCenterY = to.top + to.height / 2;
|
|
1824
|
+
const rawDx = toCenterX - fromCenterX;
|
|
1825
|
+
const rawDy = toCenterY - fromCenterY;
|
|
1826
|
+
if (dotted) {
|
|
1827
|
+
const isHorizontal2 = Math.abs(rawDx) >= Math.abs(rawDy);
|
|
1828
|
+
let fromX2;
|
|
1829
|
+
let fromY2;
|
|
1830
|
+
let toX2;
|
|
1831
|
+
let toY2;
|
|
1832
|
+
let control1X;
|
|
1833
|
+
let control1Y;
|
|
1834
|
+
let control2X;
|
|
1835
|
+
let control2Y;
|
|
1836
|
+
let labelX2;
|
|
1837
|
+
let labelY2;
|
|
1838
|
+
if (isHorizontal2) {
|
|
1839
|
+
fromX2 = fromCenterX;
|
|
1840
|
+
fromY2 = from.top;
|
|
1841
|
+
toX2 = toCenterX;
|
|
1842
|
+
toY2 = to.top;
|
|
1843
|
+
const pad = Math.max(28, Math.min(Math.abs(rawDx) * 0.15, 70));
|
|
1844
|
+
const arcY = Math.min(from.top, to.top) - pad;
|
|
1845
|
+
control1X = fromX2;
|
|
1846
|
+
control1Y = arcY;
|
|
1847
|
+
control2X = toX2;
|
|
1848
|
+
control2Y = arcY;
|
|
1849
|
+
labelX2 = (control1X + control2X) / 2;
|
|
1850
|
+
labelY2 = arcY - 8;
|
|
1851
|
+
} else {
|
|
1852
|
+
fromX2 = from.left;
|
|
1853
|
+
fromY2 = fromCenterY;
|
|
1854
|
+
toX2 = to.left;
|
|
1855
|
+
toY2 = toCenterY;
|
|
1856
|
+
const pad = Math.max(28, Math.min(Math.abs(rawDy) * 0.15, 70));
|
|
1857
|
+
const arcX = Math.min(from.left, to.left) - pad;
|
|
1858
|
+
control1X = arcX;
|
|
1859
|
+
control1Y = fromY2;
|
|
1860
|
+
control2X = arcX;
|
|
1861
|
+
control2Y = toY2;
|
|
1862
|
+
labelX2 = arcX;
|
|
1863
|
+
labelY2 = (control1Y + control2Y) / 2 - 8;
|
|
1864
|
+
}
|
|
1865
|
+
const distance2 = Math.sqrt((toX2 - fromX2) ** 2 + (toY2 - fromY2) ** 2);
|
|
1866
|
+
if (distance2 < 1) {
|
|
1867
|
+
return null;
|
|
1868
|
+
}
|
|
1869
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "g", { children: [
|
|
1870
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1871
|
+
"path",
|
|
1872
|
+
{
|
|
1873
|
+
d: `M ${fromX2} ${fromY2} C ${control1X} ${control1Y}, ${control2X} ${control2Y}, ${toX2} ${toY2}`,
|
|
1874
|
+
fill: "none",
|
|
1875
|
+
stroke: color,
|
|
1876
|
+
strokeWidth: 2,
|
|
1877
|
+
strokeDasharray: "3 4"
|
|
1878
|
+
}
|
|
1879
|
+
),
|
|
1880
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "circle", { cx: toX2, cy: toY2, r: 4, fill: color }),
|
|
1881
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1882
|
+
"text",
|
|
1883
|
+
{
|
|
1884
|
+
x: labelX2,
|
|
1885
|
+
y: labelY2,
|
|
1886
|
+
textAnchor: "middle",
|
|
1887
|
+
fill: color,
|
|
1888
|
+
fontSize: 9,
|
|
1889
|
+
fontWeight: "bold",
|
|
1890
|
+
fontFamily: "var(--font-geist-mono), monospace",
|
|
1891
|
+
children: label
|
|
1892
|
+
}
|
|
1893
|
+
)
|
|
1894
|
+
] });
|
|
1895
|
+
}
|
|
1896
|
+
const isHorizontal = Math.abs(rawDx) >= Math.abs(rawDy);
|
|
1897
|
+
let fromX;
|
|
1898
|
+
let fromY;
|
|
1899
|
+
let toX;
|
|
1900
|
+
let toY;
|
|
1901
|
+
if (isHorizontal) {
|
|
1902
|
+
fromX = rawDx >= 0 ? from.right : from.left;
|
|
1903
|
+
toX = rawDx >= 0 ? to.left : to.right;
|
|
1904
|
+
fromY = fromCenterY;
|
|
1905
|
+
toY = toCenterY;
|
|
1906
|
+
} else {
|
|
1907
|
+
fromX = fromCenterX;
|
|
1908
|
+
toX = toCenterX;
|
|
1909
|
+
fromY = rawDy >= 0 ? from.bottom : from.top;
|
|
1910
|
+
toY = rawDy >= 0 ? to.top : to.bottom;
|
|
1911
|
+
}
|
|
1912
|
+
const edgeDx = toX - fromX;
|
|
1913
|
+
const edgeDy = toY - fromY;
|
|
1914
|
+
const distance = Math.sqrt(edgeDx * edgeDx + edgeDy * edgeDy);
|
|
1915
|
+
if (distance < 1) {
|
|
1916
|
+
return null;
|
|
1917
|
+
}
|
|
1918
|
+
const offset = Math.min(distance * 0.2, 30);
|
|
1919
|
+
const normalX = distance > 0 ? -edgeDy / distance : 0;
|
|
1920
|
+
const normalY = distance > 0 ? edgeDx / distance : 0;
|
|
1921
|
+
const midX = (fromX + toX) / 2 + normalX * offset;
|
|
1922
|
+
const midY = (fromY + toY) / 2 + normalY * offset;
|
|
1923
|
+
const labelX = midX;
|
|
1924
|
+
const labelY = midY - 8;
|
|
1925
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "g", { children: [
|
|
1926
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1927
|
+
"path",
|
|
1928
|
+
{
|
|
1929
|
+
d: `M ${fromX} ${fromY} Q ${midX} ${midY} ${toX} ${toY}`,
|
|
1930
|
+
fill: "none",
|
|
1931
|
+
stroke: color,
|
|
1932
|
+
strokeWidth: 1.5,
|
|
1933
|
+
strokeDasharray: "5 3"
|
|
1934
|
+
}
|
|
1935
|
+
),
|
|
1936
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "circle", { cx: toX, cy: toY, r: 4, fill: color }),
|
|
1937
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1938
|
+
"text",
|
|
1939
|
+
{
|
|
1940
|
+
x: labelX,
|
|
1941
|
+
y: labelY,
|
|
1942
|
+
textAnchor: "middle",
|
|
1943
|
+
fill: color,
|
|
1944
|
+
fontSize: 9,
|
|
1945
|
+
fontWeight: "bold",
|
|
1946
|
+
fontFamily: "var(--font-geist-mono), monospace",
|
|
1947
|
+
children: label
|
|
1948
|
+
}
|
|
1949
|
+
)
|
|
1950
|
+
] });
|
|
1951
|
+
}
|
|
1952
|
+
function ProtectedDirBadges({
|
|
1953
|
+
rect,
|
|
1954
|
+
dirs
|
|
1955
|
+
}) {
|
|
1956
|
+
const centerX = rect.left + rect.width / 2;
|
|
1957
|
+
const centerY = rect.top + rect.height / 2;
|
|
1958
|
+
const pad = 6;
|
|
1959
|
+
const positions = {
|
|
1960
|
+
up: { x: centerX, y: rect.top - pad, anchor: "middle" },
|
|
1961
|
+
down: { x: centerX, y: rect.bottom + pad + 10, anchor: "middle" },
|
|
1962
|
+
left: { x: rect.left - pad, y: centerY + 3, anchor: "end" },
|
|
1963
|
+
right: { x: rect.right + pad, y: centerY + 3, anchor: "start" }
|
|
1964
|
+
};
|
|
1965
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: dirs.map((dir) => {
|
|
1966
|
+
const pos = positions[dir];
|
|
1967
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1968
|
+
"div",
|
|
1969
|
+
{
|
|
1970
|
+
className: "absolute flex items-center gap-0.5 rounded bg-amber-600/90 px-1 py-0.5 text-[8px] font-bold text-white shadow-sm",
|
|
1971
|
+
style: {
|
|
1972
|
+
left: pos.x,
|
|
1973
|
+
top: pos.y,
|
|
1974
|
+
transform: pos.anchor === "middle" ? "translateX(-50%)" : pos.anchor === "end" ? "translateX(-100%)" : void 0
|
|
1975
|
+
},
|
|
1976
|
+
children: [
|
|
1977
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: DIR_SYMBOL[dir] }),
|
|
1978
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "8", height: "8", viewBox: "0 0 16 16", fill: "currentColor", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M8 1a2 2 0 0 1 2 2v4H6V3a2 2 0 0 1 2-2zm3 6V3a3 3 0 0 0-6 0v4a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2z" }) })
|
|
1979
|
+
]
|
|
1980
|
+
},
|
|
1981
|
+
dir
|
|
1982
|
+
);
|
|
1983
|
+
}) });
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
// src/overlays/focus-guide.tsx
|
|
1987
|
+
|
|
1988
|
+
|
|
1989
|
+
var { useCallback: useCallback3, useEffect: useEffect3, useRef, useState: useState4 } = React5;
|
|
1990
|
+
function FocusOverlays({
|
|
1991
|
+
current,
|
|
1992
|
+
tabNext,
|
|
1993
|
+
tabPrev,
|
|
1994
|
+
arrows,
|
|
1995
|
+
spatialTargets,
|
|
1996
|
+
protectedDirs
|
|
1997
|
+
}) {
|
|
1998
|
+
const [rects, setRects] = useState4(null);
|
|
1999
|
+
const currentRef = useRef(current);
|
|
2000
|
+
const tabNextRef = useRef(tabNext);
|
|
2001
|
+
const tabPrevRef = useRef(tabPrev);
|
|
2002
|
+
const arrowsRef = useRef(arrows);
|
|
2003
|
+
const spatialRef = useRef(spatialTargets);
|
|
2004
|
+
const protectedRef = useRef(protectedDirs);
|
|
2005
|
+
currentRef.current = current;
|
|
2006
|
+
tabNextRef.current = tabNext;
|
|
2007
|
+
tabPrevRef.current = tabPrev;
|
|
2008
|
+
arrowsRef.current = arrows;
|
|
2009
|
+
spatialRef.current = spatialTargets;
|
|
2010
|
+
protectedRef.current = protectedDirs;
|
|
2011
|
+
const recalc = useCallback3(() => {
|
|
2012
|
+
const currentRect2 = safeRect(currentRef.current);
|
|
2013
|
+
if (!currentRect2) {
|
|
2014
|
+
return;
|
|
2015
|
+
}
|
|
2016
|
+
const currentProtectedDirs = protectedRef.current;
|
|
2017
|
+
setRects({
|
|
2018
|
+
current: currentRect2,
|
|
2019
|
+
tabNext: safeRect(tabNextRef.current),
|
|
2020
|
+
tabPrev: safeRect(tabPrevRef.current),
|
|
2021
|
+
arrows: arrowsRef.current.filter(
|
|
2022
|
+
(arrow) => !arrow.loop && !currentProtectedDirs.includes(SYMBOL_DIR[arrow.direction])
|
|
2023
|
+
).map((arrow) => {
|
|
2024
|
+
const rect = safeRect(arrow.element);
|
|
2025
|
+
return rect ? { dir: arrow.direction, rect } : null;
|
|
2026
|
+
}).filter(
|
|
2027
|
+
(value) => value !== null
|
|
2028
|
+
),
|
|
2029
|
+
loopArrows: arrowsRef.current.filter(
|
|
2030
|
+
(arrow) => arrow.loop && !currentProtectedDirs.includes(SYMBOL_DIR[arrow.direction])
|
|
2031
|
+
).map((arrow) => {
|
|
2032
|
+
const rect = safeRect(arrow.element);
|
|
2033
|
+
return rect ? { dir: `${arrow.direction}\u21BB`, rect } : null;
|
|
2034
|
+
}).filter(
|
|
2035
|
+
(value) => value !== null
|
|
2036
|
+
),
|
|
2037
|
+
spatial: spatialRef.current.filter((target) => !currentProtectedDirs.includes(target.direction)).map((target) => {
|
|
2038
|
+
const rect = safeRect(target.element);
|
|
2039
|
+
return rect ? { dir: DIR_SYMBOL[target.direction], rect } : null;
|
|
2040
|
+
}).filter(
|
|
2041
|
+
(value) => value !== null
|
|
2042
|
+
)
|
|
2043
|
+
});
|
|
2044
|
+
}, []);
|
|
2045
|
+
useEffect3(() => {
|
|
2046
|
+
recalc();
|
|
2047
|
+
let rafId = 0;
|
|
2048
|
+
function onLayout() {
|
|
2049
|
+
cancelAnimationFrame(rafId);
|
|
2050
|
+
rafId = requestAnimationFrame(recalc);
|
|
2051
|
+
}
|
|
2052
|
+
window.addEventListener("scroll", onLayout, true);
|
|
2053
|
+
window.addEventListener("resize", onLayout);
|
|
2054
|
+
return () => {
|
|
2055
|
+
cancelAnimationFrame(rafId);
|
|
2056
|
+
window.removeEventListener("scroll", onLayout, true);
|
|
2057
|
+
window.removeEventListener("resize", onLayout);
|
|
2058
|
+
};
|
|
2059
|
+
}, [arrows, current, recalc, spatialTargets, tabNext, tabPrev]);
|
|
2060
|
+
if (!rects) {
|
|
2061
|
+
return null;
|
|
2062
|
+
}
|
|
2063
|
+
const currentRect = rects.current;
|
|
2064
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2065
|
+
"div",
|
|
2066
|
+
{
|
|
2067
|
+
"data-opt-devtool": true,
|
|
2068
|
+
className: "pointer-events-none fixed inset-0 z-[9998]",
|
|
2069
|
+
style: _chunkEQPETYJJcjs.ISOLATE_STYLE,
|
|
2070
|
+
children: [
|
|
2071
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", { className: "absolute inset-0 h-full w-full overflow-visible", children: [
|
|
2072
|
+
rects.tabNext && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2073
|
+
ConnectorLine,
|
|
2074
|
+
{
|
|
2075
|
+
from: currentRect,
|
|
2076
|
+
to: rects.tabNext,
|
|
2077
|
+
color: "rgba(34,197,94,0.65)",
|
|
2078
|
+
label: "Tab"
|
|
2079
|
+
}
|
|
2080
|
+
),
|
|
2081
|
+
rects.tabPrev && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2082
|
+
ConnectorLine,
|
|
2083
|
+
{
|
|
2084
|
+
from: currentRect,
|
|
2085
|
+
to: rects.tabPrev,
|
|
2086
|
+
color: "rgba(249,115,22,0.45)",
|
|
2087
|
+
label: "S+Tab"
|
|
2088
|
+
}
|
|
2089
|
+
),
|
|
2090
|
+
rects.arrows.map((arrow, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2091
|
+
ConnectorLine,
|
|
2092
|
+
{
|
|
2093
|
+
from: currentRect,
|
|
2094
|
+
to: arrow.rect,
|
|
2095
|
+
color: "rgba(168,85,247,0.6)",
|
|
2096
|
+
label: arrow.dir
|
|
2097
|
+
},
|
|
2098
|
+
index
|
|
2099
|
+
)),
|
|
2100
|
+
rects.loopArrows.map((arrow, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2101
|
+
ConnectorLine,
|
|
2102
|
+
{
|
|
2103
|
+
from: currentRect,
|
|
2104
|
+
to: arrow.rect,
|
|
2105
|
+
color: "rgba(236,72,153,0.6)",
|
|
2106
|
+
label: arrow.dir,
|
|
2107
|
+
dotted: true
|
|
2108
|
+
},
|
|
2109
|
+
`loop-${index}`
|
|
2110
|
+
)),
|
|
2111
|
+
rects.spatial.map((target, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2112
|
+
ConnectorLine,
|
|
2113
|
+
{
|
|
2114
|
+
from: currentRect,
|
|
2115
|
+
to: target.rect,
|
|
2116
|
+
color: "rgba(20,184,166,0.55)",
|
|
2117
|
+
label: target.dir
|
|
2118
|
+
},
|
|
2119
|
+
`spatial-${index}`
|
|
2120
|
+
))
|
|
2121
|
+
] }),
|
|
2122
|
+
protectedDirs.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProtectedDirBadges, { rect: currentRect, dirs: protectedDirs }),
|
|
2123
|
+
rects.tabPrev && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, HighlightRing, { rect: rects.tabPrev, color: "rgba(249,115,22,0.6)" }),
|
|
2124
|
+
rects.tabNext && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, HighlightRing, { rect: rects.tabNext, color: "rgba(34,197,94,0.65)" }),
|
|
2125
|
+
rects.arrows.map((arrow, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2126
|
+
HighlightRing,
|
|
2127
|
+
{
|
|
2128
|
+
rect: arrow.rect,
|
|
2129
|
+
color: "rgba(168,85,247,0.6)"
|
|
2130
|
+
},
|
|
2131
|
+
index
|
|
2132
|
+
)),
|
|
2133
|
+
rects.loopArrows.map((arrow, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2134
|
+
HighlightRing,
|
|
2135
|
+
{
|
|
2136
|
+
rect: arrow.rect,
|
|
2137
|
+
color: "rgba(236,72,153,0.6)"
|
|
2138
|
+
},
|
|
2139
|
+
`loop-ring-${index}`
|
|
2140
|
+
)),
|
|
2141
|
+
rects.spatial.map((target, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2142
|
+
HighlightRing,
|
|
2143
|
+
{
|
|
2144
|
+
rect: target.rect,
|
|
2145
|
+
color: "rgba(20,184,166,0.55)"
|
|
2146
|
+
},
|
|
2147
|
+
`spatial-ring-${index}`
|
|
2148
|
+
))
|
|
2149
|
+
]
|
|
2150
|
+
}
|
|
2151
|
+
);
|
|
2152
|
+
}
|
|
2153
|
+
|
|
2154
|
+
// src/overlays/tab-order.tsx
|
|
2155
|
+
|
|
2156
|
+
|
|
2157
|
+
var { useCallback: useCallback4, useEffect: useEffect4, useRef: useRef2, useState: useState5 } = React6;
|
|
2158
|
+
function TabOrderBadges({
|
|
2159
|
+
tabbable,
|
|
2160
|
+
current
|
|
2161
|
+
}) {
|
|
2162
|
+
const [badges, setBadges] = useState5([]);
|
|
2163
|
+
const tabbableRef = useRef2(tabbable);
|
|
2164
|
+
const currentRef = useRef2(current);
|
|
2165
|
+
tabbableRef.current = tabbable;
|
|
2166
|
+
currentRef.current = current;
|
|
2167
|
+
const recalc = useCallback4(() => {
|
|
2168
|
+
setBadges(
|
|
2169
|
+
tabbableRef.current.map((el, index) => {
|
|
2170
|
+
const rect = el.getBoundingClientRect();
|
|
2171
|
+
return {
|
|
2172
|
+
left: rect.left - 2,
|
|
2173
|
+
top: rect.top - 10,
|
|
2174
|
+
index: index + 1,
|
|
2175
|
+
isCurrent: el === currentRef.current
|
|
2176
|
+
};
|
|
2177
|
+
})
|
|
2178
|
+
);
|
|
2179
|
+
}, []);
|
|
2180
|
+
useEffect4(() => {
|
|
2181
|
+
recalc();
|
|
2182
|
+
let rafId = 0;
|
|
2183
|
+
function onLayout() {
|
|
2184
|
+
cancelAnimationFrame(rafId);
|
|
2185
|
+
rafId = requestAnimationFrame(recalc);
|
|
2186
|
+
}
|
|
2187
|
+
window.addEventListener("scroll", onLayout, true);
|
|
2188
|
+
window.addEventListener("resize", onLayout);
|
|
2189
|
+
return () => {
|
|
2190
|
+
cancelAnimationFrame(rafId);
|
|
2191
|
+
window.removeEventListener("scroll", onLayout, true);
|
|
2192
|
+
window.removeEventListener("resize", onLayout);
|
|
2193
|
+
};
|
|
2194
|
+
}, [current, recalc, tabbable]);
|
|
2195
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2196
|
+
"div",
|
|
2197
|
+
{
|
|
2198
|
+
"data-opt-devtool": true,
|
|
2199
|
+
className: "pointer-events-none fixed inset-0 z-[9997]",
|
|
2200
|
+
style: _chunkEQPETYJJcjs.ISOLATE_STYLE,
|
|
2201
|
+
children: badges.map((badge) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2202
|
+
"div",
|
|
2203
|
+
{
|
|
2204
|
+
className: `absolute flex h-4 min-w-4 items-center justify-center rounded-full px-1 text-[9px] leading-none font-bold ${badge.isCurrent ? "bg-blue-500 text-white" : "bg-white/15 text-white/80"}`,
|
|
2205
|
+
style: { left: badge.left, top: badge.top },
|
|
2206
|
+
children: badge.index
|
|
2207
|
+
},
|
|
2208
|
+
badge.index
|
|
2209
|
+
))
|
|
2210
|
+
}
|
|
2211
|
+
);
|
|
2212
|
+
}
|
|
2213
|
+
|
|
2214
|
+
// src/overlays/inspect-tool.tsx
|
|
2215
|
+
|
|
2216
|
+
|
|
2217
|
+
var { useCallback: useCallback5, useEffect: useEffect5, useRef: useRef3, useState: useState6 } = React7;
|
|
2218
|
+
function InspectOverlay({
|
|
2219
|
+
element,
|
|
2220
|
+
pinned
|
|
2221
|
+
}) {
|
|
2222
|
+
const [rect, setRect] = useState6(null);
|
|
2223
|
+
const elRef = useRef3(element);
|
|
2224
|
+
elRef.current = element;
|
|
2225
|
+
const recalc = useCallback5(() => {
|
|
2226
|
+
setRect(safeRect(elRef.current));
|
|
2227
|
+
}, []);
|
|
2228
|
+
useEffect5(() => {
|
|
2229
|
+
recalc();
|
|
2230
|
+
let rafId = 0;
|
|
2231
|
+
function onLayout() {
|
|
2232
|
+
cancelAnimationFrame(rafId);
|
|
2233
|
+
rafId = requestAnimationFrame(recalc);
|
|
2234
|
+
}
|
|
2235
|
+
window.addEventListener("scroll", onLayout, true);
|
|
2236
|
+
window.addEventListener("resize", onLayout);
|
|
2237
|
+
return () => {
|
|
2238
|
+
cancelAnimationFrame(rafId);
|
|
2239
|
+
window.removeEventListener("scroll", onLayout, true);
|
|
2240
|
+
window.removeEventListener("resize", onLayout);
|
|
2241
|
+
};
|
|
2242
|
+
}, [element, recalc]);
|
|
2243
|
+
if (!rect) {
|
|
2244
|
+
return null;
|
|
2245
|
+
}
|
|
2246
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2247
|
+
"div",
|
|
2248
|
+
{
|
|
2249
|
+
"data-opt-devtool": true,
|
|
2250
|
+
className: "pointer-events-none fixed inset-0 z-[9998]",
|
|
2251
|
+
style: _chunkEQPETYJJcjs.ISOLATE_STYLE,
|
|
2252
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, HighlightRing, { rect, color: "rgba(6,182,212,0.7)", solid: pinned })
|
|
2253
|
+
}
|
|
2254
|
+
);
|
|
2255
|
+
}
|
|
2256
|
+
|
|
2257
|
+
// src/overlays/component-labels.tsx
|
|
2258
|
+
|
|
2259
|
+
|
|
2260
|
+
var { useCallback: useCallback6, useEffect: useEffect6, useRef: useRef4, useState: useState7 } = React8;
|
|
2261
|
+
function ComponentLabelsOverlay({
|
|
2262
|
+
components
|
|
2263
|
+
}) {
|
|
2264
|
+
const [labels, setLabels] = useState7([]);
|
|
2265
|
+
const componentsRef = useRef4(components);
|
|
2266
|
+
componentsRef.current = components;
|
|
2267
|
+
const recalc = useCallback6(() => {
|
|
2268
|
+
setLabels(
|
|
2269
|
+
componentsRef.current.map((component, index) => {
|
|
2270
|
+
const rect = component.element.getBoundingClientRect();
|
|
2271
|
+
return {
|
|
2272
|
+
id: `${component.name}-${index}`,
|
|
2273
|
+
name: component.name,
|
|
2274
|
+
type: component.type,
|
|
2275
|
+
left: rect.left,
|
|
2276
|
+
top: rect.top,
|
|
2277
|
+
width: rect.width,
|
|
2278
|
+
height: rect.height
|
|
2279
|
+
};
|
|
2280
|
+
})
|
|
2281
|
+
);
|
|
2282
|
+
}, []);
|
|
2283
|
+
useEffect6(() => {
|
|
2284
|
+
recalc();
|
|
2285
|
+
let rafId = 0;
|
|
2286
|
+
function onLayout() {
|
|
2287
|
+
cancelAnimationFrame(rafId);
|
|
2288
|
+
rafId = requestAnimationFrame(recalc);
|
|
2289
|
+
}
|
|
2290
|
+
window.addEventListener("scroll", onLayout, true);
|
|
2291
|
+
window.addEventListener("resize", onLayout);
|
|
2292
|
+
return () => {
|
|
2293
|
+
cancelAnimationFrame(rafId);
|
|
2294
|
+
window.removeEventListener("scroll", onLayout, true);
|
|
2295
|
+
window.removeEventListener("resize", onLayout);
|
|
2296
|
+
};
|
|
2297
|
+
}, [components, recalc]);
|
|
2298
|
+
const primitiveCount = labels.filter(
|
|
2299
|
+
(label) => label.type === "primitive"
|
|
2300
|
+
).length;
|
|
2301
|
+
const blockCount = labels.filter((label) => label.type === "block").length;
|
|
2302
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2303
|
+
"div",
|
|
2304
|
+
{
|
|
2305
|
+
"data-opt-devtool": true,
|
|
2306
|
+
className: "pointer-events-none fixed inset-0 z-[9996]",
|
|
2307
|
+
style: _chunkEQPETYJJcjs.ISOLATE_STYLE,
|
|
2308
|
+
children: [
|
|
2309
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "fixed top-4 left-4 flex gap-2 text-[10px] font-bold", children: [
|
|
2310
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rounded bg-purple-600 px-2 py-1 text-white", children: [
|
|
2311
|
+
"Primitives: ",
|
|
2312
|
+
primitiveCount
|
|
2313
|
+
] }),
|
|
2314
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rounded bg-emerald-600 px-2 py-1 text-white", children: [
|
|
2315
|
+
"Blocks: ",
|
|
2316
|
+
blockCount
|
|
2317
|
+
] })
|
|
2318
|
+
] }),
|
|
2319
|
+
labels.map((label) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2320
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2321
|
+
"div",
|
|
2322
|
+
{
|
|
2323
|
+
className: "absolute rounded",
|
|
2324
|
+
style: {
|
|
2325
|
+
left: label.left,
|
|
2326
|
+
top: label.top,
|
|
2327
|
+
width: label.width,
|
|
2328
|
+
height: label.height,
|
|
2329
|
+
border: label.type === "block" ? "1px solid rgba(16, 185, 129, 0.5)" : "1px dashed rgba(168, 85, 247, 0.4)"
|
|
2330
|
+
}
|
|
2331
|
+
}
|
|
2332
|
+
),
|
|
2333
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2334
|
+
"div",
|
|
2335
|
+
{
|
|
2336
|
+
className: `absolute flex items-center gap-1 rounded-sm px-1.5 py-0.5 text-[9px] font-semibold shadow-sm ${label.type === "block" ? "bg-emerald-600 text-white" : "bg-purple-600 text-white"}`,
|
|
2337
|
+
style: {
|
|
2338
|
+
left: label.left,
|
|
2339
|
+
top: Math.max(0, label.top - 16)
|
|
2340
|
+
},
|
|
2341
|
+
children: [
|
|
2342
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2343
|
+
"span",
|
|
2344
|
+
{
|
|
2345
|
+
className: `h-1.5 w-1.5 rounded-full ${label.type === "block" ? "bg-emerald-300" : "bg-purple-300"}`
|
|
2346
|
+
}
|
|
2347
|
+
),
|
|
2348
|
+
label.name
|
|
2349
|
+
]
|
|
2350
|
+
}
|
|
2351
|
+
)
|
|
2352
|
+
] }, label.id))
|
|
2353
|
+
]
|
|
2354
|
+
}
|
|
2355
|
+
);
|
|
2356
|
+
}
|
|
2357
|
+
|
|
2358
|
+
// src/overlays/composite-bounds.tsx
|
|
2359
|
+
|
|
2360
|
+
|
|
2361
|
+
var { useCallback: useCallback7, useEffect: useEffect7, useRef: useRef5, useState: useState8 } = React9;
|
|
2362
|
+
function CompositeBoundsOverlay({
|
|
2363
|
+
zones
|
|
2364
|
+
}) {
|
|
2365
|
+
const [bounds, setBounds] = useState8([]);
|
|
2366
|
+
const zonesRef = useRef5(zones);
|
|
2367
|
+
zonesRef.current = zones;
|
|
2368
|
+
const recalc = useCallback7(() => {
|
|
2369
|
+
setBounds(
|
|
2370
|
+
zonesRef.current.map((zone, index) => {
|
|
2371
|
+
const rect = zone.element.getBoundingClientRect();
|
|
2372
|
+
return {
|
|
2373
|
+
id: `${zone.role}-${index}`,
|
|
2374
|
+
role: zone.role,
|
|
2375
|
+
orientation: zone.orientation,
|
|
2376
|
+
itemCount: zone.itemCount,
|
|
2377
|
+
left: rect.left,
|
|
2378
|
+
top: rect.top,
|
|
2379
|
+
width: rect.width,
|
|
2380
|
+
height: rect.height
|
|
2381
|
+
};
|
|
2382
|
+
})
|
|
2383
|
+
);
|
|
2384
|
+
}, []);
|
|
2385
|
+
useEffect7(() => {
|
|
2386
|
+
recalc();
|
|
2387
|
+
let rafId = 0;
|
|
2388
|
+
function onLayout() {
|
|
2389
|
+
cancelAnimationFrame(rafId);
|
|
2390
|
+
rafId = requestAnimationFrame(recalc);
|
|
2391
|
+
}
|
|
2392
|
+
window.addEventListener("scroll", onLayout, true);
|
|
2393
|
+
window.addEventListener("resize", onLayout);
|
|
2394
|
+
return () => {
|
|
2395
|
+
cancelAnimationFrame(rafId);
|
|
2396
|
+
window.removeEventListener("scroll", onLayout, true);
|
|
2397
|
+
window.removeEventListener("resize", onLayout);
|
|
2398
|
+
};
|
|
2399
|
+
}, [recalc, zones]);
|
|
2400
|
+
const orientationSymbol = {
|
|
2401
|
+
vertical: "\u2195",
|
|
2402
|
+
horizontal: "\u2194",
|
|
2403
|
+
grid: "\u229E"
|
|
2404
|
+
};
|
|
2405
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2406
|
+
"div",
|
|
2407
|
+
{
|
|
2408
|
+
"data-opt-devtool": true,
|
|
2409
|
+
className: "pointer-events-none fixed inset-0 z-[9995]",
|
|
2410
|
+
style: _chunkEQPETYJJcjs.ISOLATE_STYLE,
|
|
2411
|
+
children: bounds.map((bound) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2412
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2413
|
+
"div",
|
|
2414
|
+
{
|
|
2415
|
+
className: "absolute rounded border-2 border-dashed border-orange-500/50",
|
|
2416
|
+
style: {
|
|
2417
|
+
left: bound.left,
|
|
2418
|
+
top: bound.top,
|
|
2419
|
+
width: bound.width,
|
|
2420
|
+
height: bound.height
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
2423
|
+
),
|
|
2424
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2425
|
+
"div",
|
|
2426
|
+
{
|
|
2427
|
+
className: "absolute flex items-center gap-1 rounded bg-orange-600 px-1.5 py-0.5 text-[9px] font-semibold text-white shadow-sm",
|
|
2428
|
+
style: {
|
|
2429
|
+
left: bound.left,
|
|
2430
|
+
top: Math.max(0, bound.top - 18)
|
|
2431
|
+
},
|
|
2432
|
+
children: [
|
|
2433
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: orientationSymbol[bound.orientation] }),
|
|
2434
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: bound.role }),
|
|
2435
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-orange-200", children: [
|
|
2436
|
+
"(",
|
|
2437
|
+
bound.itemCount,
|
|
2438
|
+
")"
|
|
2439
|
+
] })
|
|
2440
|
+
]
|
|
2441
|
+
}
|
|
2442
|
+
)
|
|
2443
|
+
] }, bound.id))
|
|
2444
|
+
}
|
|
2445
|
+
);
|
|
2446
|
+
}
|
|
2447
|
+
|
|
2448
|
+
// src/opt-devtool.tsx
|
|
2449
|
+
|
|
2450
|
+
|
|
2451
|
+
var _optshell = require('@reopt-ai/opt-shell');
|
|
2452
|
+
|
|
2453
|
+
// src/hooks/use-devtool-keybinding.ts
|
|
2454
|
+
|
|
2455
|
+
function useDevtoolKeybinding(toggle) {
|
|
2456
|
+
_react.useEffect.call(void 0, () => {
|
|
2457
|
+
function onKey(event) {
|
|
2458
|
+
if (event.ctrlKey && event.shiftKey && event.key.toLowerCase() === "f") {
|
|
2459
|
+
event.preventDefault();
|
|
2460
|
+
toggle((current) => !current);
|
|
2461
|
+
}
|
|
2462
|
+
}
|
|
2463
|
+
window.addEventListener("keydown", onKey);
|
|
2464
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
2465
|
+
}, [toggle]);
|
|
2466
|
+
}
|
|
2467
|
+
|
|
2468
|
+
// src/hooks/use-devtool-config-event.ts
|
|
2469
|
+
|
|
2470
|
+
function useDevtoolConfigEvent(apply) {
|
|
2471
|
+
_react.useEffect.call(void 0, () => {
|
|
2472
|
+
function onConfigure(event) {
|
|
2473
|
+
apply(event.detail);
|
|
2474
|
+
}
|
|
2475
|
+
window.addEventListener(_chunk4MJKIAXHcjs.OPT_DEVTOOL_CONFIGURE_EVENT, onConfigure);
|
|
2476
|
+
window.addEventListener(LEGACY_OPT_UI_HELPER_CONFIGURE_EVENT, onConfigure);
|
|
2477
|
+
return () => {
|
|
2478
|
+
window.removeEventListener(_chunk4MJKIAXHcjs.OPT_DEVTOOL_CONFIGURE_EVENT, onConfigure);
|
|
2479
|
+
window.removeEventListener(
|
|
2480
|
+
LEGACY_OPT_UI_HELPER_CONFIGURE_EVENT,
|
|
2481
|
+
onConfigure
|
|
2482
|
+
);
|
|
2483
|
+
};
|
|
2484
|
+
}, [apply]);
|
|
2485
|
+
}
|
|
2486
|
+
|
|
2487
|
+
// src/hooks/use-focus-tracking.ts
|
|
2488
|
+
|
|
2489
|
+
var FOCUS_HISTORY_LIMIT = 10;
|
|
2490
|
+
function getExternalTarget(event) {
|
|
2491
|
+
const el = event.target;
|
|
2492
|
+
if (!el || el.closest("[data-opt-devtool]")) return null;
|
|
2493
|
+
return el;
|
|
2494
|
+
}
|
|
2495
|
+
function useFocusTracking({
|
|
2496
|
+
enabled
|
|
2497
|
+
}) {
|
|
2498
|
+
const [focused, setFocused] = _react.useState.call(void 0, null);
|
|
2499
|
+
const [history, setHistory] = _react.useState.call(void 0, []);
|
|
2500
|
+
const [tabbable, setTabbable] = _react.useState.call(void 0, []);
|
|
2501
|
+
const raf = _react.useRef.call(void 0, 0);
|
|
2502
|
+
_react.useEffect.call(void 0, () => {
|
|
2503
|
+
if (!enabled) return void 0;
|
|
2504
|
+
function onFocus(event) {
|
|
2505
|
+
const el = getExternalTarget(event);
|
|
2506
|
+
if (!el) return;
|
|
2507
|
+
setFocused(el);
|
|
2508
|
+
setHistory(
|
|
2509
|
+
(current) => [el, ...current.filter((item) => item !== el)].slice(
|
|
2510
|
+
0,
|
|
2511
|
+
FOCUS_HISTORY_LIMIT
|
|
2512
|
+
)
|
|
2513
|
+
);
|
|
2514
|
+
cancelAnimationFrame(raf.current);
|
|
2515
|
+
raf.current = requestAnimationFrame(() => setTabbable(getTabbable()));
|
|
2516
|
+
}
|
|
2517
|
+
document.addEventListener("focusin", onFocus);
|
|
2518
|
+
setTabbable(getTabbable());
|
|
2519
|
+
return () => {
|
|
2520
|
+
document.removeEventListener("focusin", onFocus);
|
|
2521
|
+
cancelAnimationFrame(raf.current);
|
|
2522
|
+
};
|
|
2523
|
+
}, [enabled]);
|
|
2524
|
+
return { focused, history, tabbable };
|
|
2525
|
+
}
|
|
2526
|
+
|
|
2527
|
+
// src/hooks/use-inspect-mode.ts
|
|
2528
|
+
|
|
2529
|
+
function getExternalTarget2(event) {
|
|
2530
|
+
const el = event.target;
|
|
2531
|
+
if (!el || el.closest("[data-opt-devtool]")) return null;
|
|
2532
|
+
return el;
|
|
2533
|
+
}
|
|
2534
|
+
function useInspectMode({
|
|
2535
|
+
enabled
|
|
2536
|
+
}) {
|
|
2537
|
+
const [inspectedEl, setInspectedEl] = _react.useState.call(void 0, null);
|
|
2538
|
+
const [pinned, setPinned] = _react.useState.call(void 0, false);
|
|
2539
|
+
_react.useEffect.call(void 0, () => {
|
|
2540
|
+
if (!enabled) {
|
|
2541
|
+
setInspectedEl(null);
|
|
2542
|
+
setPinned(false);
|
|
2543
|
+
return;
|
|
2544
|
+
}
|
|
2545
|
+
function onMouseOver(event) {
|
|
2546
|
+
if (pinned) return;
|
|
2547
|
+
const target = getExternalTarget2(event);
|
|
2548
|
+
if (!target) return;
|
|
2549
|
+
setInspectedEl(target);
|
|
2550
|
+
}
|
|
2551
|
+
function onClick(event) {
|
|
2552
|
+
const target = getExternalTarget2(event);
|
|
2553
|
+
if (!target) return;
|
|
2554
|
+
event.preventDefault();
|
|
2555
|
+
event.stopPropagation();
|
|
2556
|
+
setPinned((current) => {
|
|
2557
|
+
if (current) {
|
|
2558
|
+
setInspectedEl(target);
|
|
2559
|
+
}
|
|
2560
|
+
return !current;
|
|
2561
|
+
});
|
|
2562
|
+
}
|
|
2563
|
+
document.addEventListener("mouseover", onMouseOver);
|
|
2564
|
+
document.addEventListener("click", onClick, true);
|
|
2565
|
+
return () => {
|
|
2566
|
+
document.removeEventListener("mouseover", onMouseOver);
|
|
2567
|
+
document.removeEventListener("click", onClick, true);
|
|
2568
|
+
};
|
|
2569
|
+
}, [enabled, pinned]);
|
|
2570
|
+
return { inspectedEl, pinned };
|
|
2571
|
+
}
|
|
2572
|
+
|
|
2573
|
+
// src/hooks/use-scan-ops-ui-components.ts
|
|
2574
|
+
|
|
2575
|
+
var SCAN_ATTR_FILTER = [
|
|
2576
|
+
"hidden",
|
|
2577
|
+
"aria-hidden",
|
|
2578
|
+
"open",
|
|
2579
|
+
"data-enter",
|
|
2580
|
+
"data-leave"
|
|
2581
|
+
];
|
|
2582
|
+
function remeasure(items) {
|
|
2583
|
+
return items.filter((item) => item.element.isConnected).map((item) => _chunkN7YO56TNcjs.__spreadProps.call(void 0, _chunkN7YO56TNcjs.__spreadValues.call(void 0, {}, item), {
|
|
2584
|
+
rect: item.element.getBoundingClientRect()
|
|
2585
|
+
})).filter((item) => item.rect.width > 0 && item.rect.height > 0);
|
|
2586
|
+
}
|
|
2587
|
+
function useScanOpsUIComponents({
|
|
2588
|
+
enabled
|
|
2589
|
+
}) {
|
|
2590
|
+
const [components, setComponents] = _react.useState.call(void 0, []);
|
|
2591
|
+
_react.useEffect.call(void 0, () => {
|
|
2592
|
+
if (!enabled) {
|
|
2593
|
+
setComponents([]);
|
|
2594
|
+
return;
|
|
2595
|
+
}
|
|
2596
|
+
function structuralScan() {
|
|
2597
|
+
setComponents(findOpsUIComponents());
|
|
2598
|
+
}
|
|
2599
|
+
function positionalRefresh() {
|
|
2600
|
+
setComponents((current) => remeasure(current));
|
|
2601
|
+
}
|
|
2602
|
+
structuralScan();
|
|
2603
|
+
let structuralRaf = 0;
|
|
2604
|
+
const observer = new MutationObserver(() => {
|
|
2605
|
+
cancelAnimationFrame(structuralRaf);
|
|
2606
|
+
structuralRaf = requestAnimationFrame(structuralScan);
|
|
2607
|
+
});
|
|
2608
|
+
observer.observe(document.body, {
|
|
2609
|
+
childList: true,
|
|
2610
|
+
subtree: true,
|
|
2611
|
+
attributes: true,
|
|
2612
|
+
attributeFilter: SCAN_ATTR_FILTER
|
|
2613
|
+
});
|
|
2614
|
+
let positionalRaf = 0;
|
|
2615
|
+
function onLayout() {
|
|
2616
|
+
cancelAnimationFrame(positionalRaf);
|
|
2617
|
+
positionalRaf = requestAnimationFrame(positionalRefresh);
|
|
2618
|
+
}
|
|
2619
|
+
window.addEventListener("scroll", onLayout, true);
|
|
2620
|
+
window.addEventListener("resize", onLayout);
|
|
2621
|
+
return () => {
|
|
2622
|
+
observer.disconnect();
|
|
2623
|
+
cancelAnimationFrame(structuralRaf);
|
|
2624
|
+
cancelAnimationFrame(positionalRaf);
|
|
2625
|
+
window.removeEventListener("scroll", onLayout, true);
|
|
2626
|
+
window.removeEventListener("resize", onLayout);
|
|
2627
|
+
};
|
|
2628
|
+
}, [enabled]);
|
|
2629
|
+
return components;
|
|
2630
|
+
}
|
|
2631
|
+
|
|
2632
|
+
// src/hooks/use-scan-composite-bounds.ts
|
|
2633
|
+
|
|
2634
|
+
var SCAN_ATTR_FILTER2 = [
|
|
2635
|
+
"hidden",
|
|
2636
|
+
"aria-hidden",
|
|
2637
|
+
"open",
|
|
2638
|
+
"data-enter",
|
|
2639
|
+
"data-leave"
|
|
2640
|
+
];
|
|
2641
|
+
function remeasure2(items) {
|
|
2642
|
+
return items.filter((item) => item.element.isConnected).map((item) => _chunkN7YO56TNcjs.__spreadProps.call(void 0, _chunkN7YO56TNcjs.__spreadValues.call(void 0, {}, item), {
|
|
2643
|
+
rect: item.element.getBoundingClientRect()
|
|
2644
|
+
})).filter((item) => item.rect.width > 0 && item.rect.height > 0);
|
|
2645
|
+
}
|
|
2646
|
+
function useScanCompositeBounds({
|
|
2647
|
+
enabled
|
|
2648
|
+
}) {
|
|
2649
|
+
const [bounds, setBounds] = _react.useState.call(void 0, []);
|
|
2650
|
+
_react.useEffect.call(void 0, () => {
|
|
2651
|
+
if (!enabled) {
|
|
2652
|
+
setBounds([]);
|
|
2653
|
+
return;
|
|
2654
|
+
}
|
|
2655
|
+
function structuralScan() {
|
|
2656
|
+
setBounds(findCompositeZones());
|
|
2657
|
+
}
|
|
2658
|
+
function positionalRefresh() {
|
|
2659
|
+
setBounds((current) => remeasure2(current));
|
|
2660
|
+
}
|
|
2661
|
+
structuralScan();
|
|
2662
|
+
let structuralRaf = 0;
|
|
2663
|
+
const observer = new MutationObserver(() => {
|
|
2664
|
+
cancelAnimationFrame(structuralRaf);
|
|
2665
|
+
structuralRaf = requestAnimationFrame(structuralScan);
|
|
2666
|
+
});
|
|
2667
|
+
observer.observe(document.body, {
|
|
2668
|
+
childList: true,
|
|
2669
|
+
subtree: true,
|
|
2670
|
+
attributes: true,
|
|
2671
|
+
attributeFilter: SCAN_ATTR_FILTER2
|
|
2672
|
+
});
|
|
2673
|
+
let positionalRaf = 0;
|
|
2674
|
+
function onLayout() {
|
|
2675
|
+
cancelAnimationFrame(positionalRaf);
|
|
2676
|
+
positionalRaf = requestAnimationFrame(positionalRefresh);
|
|
2677
|
+
}
|
|
2678
|
+
window.addEventListener("scroll", onLayout, true);
|
|
2679
|
+
window.addEventListener("resize", onLayout);
|
|
2680
|
+
return () => {
|
|
2681
|
+
observer.disconnect();
|
|
2682
|
+
cancelAnimationFrame(structuralRaf);
|
|
2683
|
+
cancelAnimationFrame(positionalRaf);
|
|
2684
|
+
window.removeEventListener("scroll", onLayout, true);
|
|
2685
|
+
window.removeEventListener("resize", onLayout);
|
|
2686
|
+
};
|
|
2687
|
+
}, [enabled]);
|
|
2688
|
+
return bounds;
|
|
2689
|
+
}
|
|
2690
|
+
|
|
2691
|
+
// src/hooks/use-event-log.ts
|
|
2692
|
+
|
|
2693
|
+
var EVENT_LOG_CAP = 30;
|
|
2694
|
+
function getExternalTarget3(event) {
|
|
2695
|
+
const el = event.target;
|
|
2696
|
+
if (!el || el.closest("[data-opt-devtool]")) return null;
|
|
2697
|
+
return el;
|
|
2698
|
+
}
|
|
2699
|
+
function useEventLog({
|
|
2700
|
+
enabled
|
|
2701
|
+
}) {
|
|
2702
|
+
const [entries, setEntries] = _react.useState.call(void 0, []);
|
|
2703
|
+
const idRef = _react.useRef.call(void 0, 0);
|
|
2704
|
+
_react.useEffect.call(void 0, () => {
|
|
2705
|
+
if (!enabled) return void 0;
|
|
2706
|
+
function addEntry(type, target, detail) {
|
|
2707
|
+
const entry = {
|
|
2708
|
+
id: ++idRef.current,
|
|
2709
|
+
time: Date.now(),
|
|
2710
|
+
type,
|
|
2711
|
+
target,
|
|
2712
|
+
detail
|
|
2713
|
+
};
|
|
2714
|
+
setEntries((current) => [entry, ...current].slice(0, EVENT_LOG_CAP));
|
|
2715
|
+
}
|
|
2716
|
+
function onFocusIn(event) {
|
|
2717
|
+
const el = getExternalTarget3(event);
|
|
2718
|
+
if (!el) return;
|
|
2719
|
+
addEntry("focusin", elLabel(el));
|
|
2720
|
+
}
|
|
2721
|
+
function onFocusOut(event) {
|
|
2722
|
+
const el = getExternalTarget3(event);
|
|
2723
|
+
if (!el) return;
|
|
2724
|
+
addEntry("focusout", elLabel(el));
|
|
2725
|
+
}
|
|
2726
|
+
function onKeyDown(event) {
|
|
2727
|
+
if (!NAV_KEYS.has(event.key)) return;
|
|
2728
|
+
const el = event.target instanceof HTMLElement ? event.target : document.body;
|
|
2729
|
+
if (el == null ? void 0 : el.closest("[data-opt-devtool]")) return;
|
|
2730
|
+
addEntry(
|
|
2731
|
+
"keydown",
|
|
2732
|
+
el ? elLabel(el) : "document",
|
|
2733
|
+
event.key === " " ? "Space" : event.key
|
|
2734
|
+
);
|
|
2735
|
+
}
|
|
2736
|
+
function onSpatialNav(event) {
|
|
2737
|
+
var _a, _b;
|
|
2738
|
+
const detail = event.detail;
|
|
2739
|
+
const symbol = DIR_SYMBOL[detail.direction];
|
|
2740
|
+
if (detail.result === "moved" && detail.target) {
|
|
2741
|
+
addEntry(
|
|
2742
|
+
"spatial-nav",
|
|
2743
|
+
`${symbol} \u2192 ${elLabel(detail.target)}`,
|
|
2744
|
+
elText(detail.target)
|
|
2745
|
+
);
|
|
2746
|
+
return;
|
|
2747
|
+
}
|
|
2748
|
+
const reasons = {
|
|
2749
|
+
defaultPrevented: "widget\uC774 \uCC98\uB9AC",
|
|
2750
|
+
"input-protection": "\uC785\uB825 \uD544\uB4DC \uBCF4\uD638",
|
|
2751
|
+
"trapped-context": `trapped (${(_a = detail.context) != null ? _a : "?"})`,
|
|
2752
|
+
"no-candidate": "\uD6C4\uBCF4 \uC5C6\uC74C"
|
|
2753
|
+
};
|
|
2754
|
+
addEntry(
|
|
2755
|
+
"spatial-nav",
|
|
2756
|
+
`${symbol} skip`,
|
|
2757
|
+
detail.reason ? (_b = reasons[detail.reason]) != null ? _b : detail.reason : ""
|
|
2758
|
+
);
|
|
2759
|
+
}
|
|
2760
|
+
document.addEventListener("focusin", onFocusIn);
|
|
2761
|
+
document.addEventListener("focusout", onFocusOut);
|
|
2762
|
+
document.addEventListener("keydown", onKeyDown);
|
|
2763
|
+
document.addEventListener("spatial-nav-decision", onSpatialNav);
|
|
2764
|
+
return () => {
|
|
2765
|
+
document.removeEventListener("focusin", onFocusIn);
|
|
2766
|
+
document.removeEventListener("focusout", onFocusOut);
|
|
2767
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
2768
|
+
document.removeEventListener("spatial-nav-decision", onSpatialNav);
|
|
2769
|
+
};
|
|
2770
|
+
}, [enabled]);
|
|
2771
|
+
return {
|
|
2772
|
+
entries,
|
|
2773
|
+
clear: () => setEntries([])
|
|
2774
|
+
};
|
|
2775
|
+
}
|
|
2776
|
+
|
|
2777
|
+
// src/components/devtool-header.tsx
|
|
2778
|
+
|
|
2779
|
+
function DevtoolHeader({
|
|
2780
|
+
labels,
|
|
2781
|
+
copied,
|
|
2782
|
+
panelCorner,
|
|
2783
|
+
onCopy,
|
|
2784
|
+
onCornerChange,
|
|
2785
|
+
onClose
|
|
2786
|
+
}) {
|
|
2787
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2788
|
+
"div",
|
|
2789
|
+
{
|
|
2790
|
+
className: "sticky top-0 z-10 flex items-center justify-between border-b border-white/15 px-3 py-2",
|
|
2791
|
+
style: { backgroundColor: "#0a0a0a" },
|
|
2792
|
+
children: [
|
|
2793
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "font-semibold text-white/95", children: labels.panelTitle }),
|
|
2794
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
2795
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2796
|
+
"button",
|
|
2797
|
+
{
|
|
2798
|
+
tabIndex: -1,
|
|
2799
|
+
onClick: onCopy,
|
|
2800
|
+
className: "text-white/55 transition-colors hover:text-white/75",
|
|
2801
|
+
title: labels.copyButtonTooltip,
|
|
2802
|
+
"aria-label": labels.copyButtonTooltip,
|
|
2803
|
+
children: copied ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2804
|
+
"svg",
|
|
2805
|
+
{
|
|
2806
|
+
width: "14",
|
|
2807
|
+
height: "14",
|
|
2808
|
+
viewBox: "0 0 14 14",
|
|
2809
|
+
fill: "none",
|
|
2810
|
+
stroke: "currentColor",
|
|
2811
|
+
strokeWidth: "2",
|
|
2812
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M2 7l3.5 3.5L12 3" })
|
|
2813
|
+
}
|
|
2814
|
+
) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2815
|
+
"svg",
|
|
2816
|
+
{
|
|
2817
|
+
width: "14",
|
|
2818
|
+
height: "14",
|
|
2819
|
+
viewBox: "0 0 14 14",
|
|
2820
|
+
fill: "none",
|
|
2821
|
+
stroke: "currentColor",
|
|
2822
|
+
strokeWidth: "1.5",
|
|
2823
|
+
children: [
|
|
2824
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "rect", { x: "4", y: "4", width: "9", height: "9", rx: "1.5" }),
|
|
2825
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M10 4V2.5A1.5 1.5 0 008.5 1h-6A1.5 1.5 0 001 2.5v6A1.5 1.5 0 002.5 10H4" })
|
|
2826
|
+
]
|
|
2827
|
+
}
|
|
2828
|
+
)
|
|
2829
|
+
}
|
|
2830
|
+
),
|
|
2831
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-white/45", children: labels.toggleHint }),
|
|
2832
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex gap-0.5", children: CORNER_LABELS.map(({ key, label }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2833
|
+
"button",
|
|
2834
|
+
{
|
|
2835
|
+
tabIndex: -1,
|
|
2836
|
+
onClick: () => onCornerChange(key),
|
|
2837
|
+
className: `rounded px-1 py-0.5 text-[10px] transition-colors ${panelCorner === key ? "bg-white/20 text-white" : "bg-white/10 text-white/45 hover:text-white/80"}`,
|
|
2838
|
+
children: label
|
|
2839
|
+
},
|
|
2840
|
+
key
|
|
2841
|
+
)) }),
|
|
2842
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2843
|
+
"button",
|
|
2844
|
+
{
|
|
2845
|
+
tabIndex: -1,
|
|
2846
|
+
onClick: onClose,
|
|
2847
|
+
"aria-label": labels.closeButton,
|
|
2848
|
+
className: "text-white/55 transition-colors hover:text-white/75",
|
|
2849
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2850
|
+
"svg",
|
|
2851
|
+
{
|
|
2852
|
+
width: "14",
|
|
2853
|
+
height: "14",
|
|
2854
|
+
viewBox: "0 0 14 14",
|
|
2855
|
+
fill: "none",
|
|
2856
|
+
stroke: "currentColor",
|
|
2857
|
+
strokeWidth: "2",
|
|
2858
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M1 1l12 12M13 1L1 13" })
|
|
2859
|
+
}
|
|
2860
|
+
)
|
|
2861
|
+
}
|
|
2862
|
+
)
|
|
2863
|
+
] })
|
|
2864
|
+
]
|
|
2865
|
+
}
|
|
2866
|
+
);
|
|
2867
|
+
}
|
|
2868
|
+
|
|
2869
|
+
// src/components/devtool-tab-bar.tsx
|
|
2870
|
+
|
|
2871
|
+
|
|
2872
|
+
function DevtoolTabBar({
|
|
2873
|
+
active,
|
|
2874
|
+
labels,
|
|
2875
|
+
onChange
|
|
2876
|
+
}) {
|
|
2877
|
+
const tabs = [
|
|
2878
|
+
{ id: "component", label: labels.tabComponent },
|
|
2879
|
+
{ id: "editor", label: labels.tabEditor },
|
|
2880
|
+
{ id: "brandapp", label: labels.tabBrandapp },
|
|
2881
|
+
{ id: "theme", label: labels.tabTheme },
|
|
2882
|
+
{ id: "harness", label: labels.tabHarness }
|
|
2883
|
+
];
|
|
2884
|
+
const tabRefs = React10.useRef(/* @__PURE__ */ new Map());
|
|
2885
|
+
const activateTab = React10.useCallback(
|
|
2886
|
+
(tab) => {
|
|
2887
|
+
onChange(tab);
|
|
2888
|
+
window.requestAnimationFrame(() => {
|
|
2889
|
+
var _a;
|
|
2890
|
+
(_a = tabRefs.current.get(tab)) == null ? void 0 : _a.focus();
|
|
2891
|
+
});
|
|
2892
|
+
},
|
|
2893
|
+
[onChange]
|
|
2894
|
+
);
|
|
2895
|
+
const handleKeyDown = React10.useCallback(
|
|
2896
|
+
(event, tab) => {
|
|
2897
|
+
const currentIndex = tabs.findIndex((item) => item.id === tab);
|
|
2898
|
+
if (currentIndex === -1) {
|
|
2899
|
+
return;
|
|
2900
|
+
}
|
|
2901
|
+
const lastIndex = tabs.length - 1;
|
|
2902
|
+
let nextIndex = null;
|
|
2903
|
+
if (event.key === "ArrowRight") {
|
|
2904
|
+
nextIndex = currentIndex === lastIndex ? 0 : currentIndex + 1;
|
|
2905
|
+
} else if (event.key === "ArrowLeft") {
|
|
2906
|
+
nextIndex = currentIndex === 0 ? lastIndex : currentIndex - 1;
|
|
2907
|
+
} else if (event.key === "Home") {
|
|
2908
|
+
nextIndex = 0;
|
|
2909
|
+
} else if (event.key === "End") {
|
|
2910
|
+
nextIndex = lastIndex;
|
|
2911
|
+
}
|
|
2912
|
+
if (nextIndex !== null) {
|
|
2913
|
+
event.preventDefault();
|
|
2914
|
+
activateTab(tabs[nextIndex].id);
|
|
2915
|
+
}
|
|
2916
|
+
},
|
|
2917
|
+
[activateTab, tabs]
|
|
2918
|
+
);
|
|
2919
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2920
|
+
"div",
|
|
2921
|
+
{
|
|
2922
|
+
className: "flex border-b border-white/10 px-3",
|
|
2923
|
+
style: { backgroundColor: "#0a0a0a" },
|
|
2924
|
+
role: "tablist",
|
|
2925
|
+
"aria-label": labels.panelTitle,
|
|
2926
|
+
children: tabs.map(({ id, label }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2927
|
+
"button",
|
|
2928
|
+
{
|
|
2929
|
+
ref: (node) => {
|
|
2930
|
+
if (node) {
|
|
2931
|
+
tabRefs.current.set(id, node);
|
|
2932
|
+
} else {
|
|
2933
|
+
tabRefs.current.delete(id);
|
|
2934
|
+
}
|
|
2935
|
+
},
|
|
2936
|
+
type: "button",
|
|
2937
|
+
role: "tab",
|
|
2938
|
+
id: `opt-devtool-tab-${id}`,
|
|
2939
|
+
"aria-controls": `opt-devtool-panel-${id}`,
|
|
2940
|
+
"aria-selected": active === id,
|
|
2941
|
+
tabIndex: active === id ? 0 : -1,
|
|
2942
|
+
onClick: () => activateTab(id),
|
|
2943
|
+
onKeyDown: (event) => handleKeyDown(event, id),
|
|
2944
|
+
className: `border-b-2 px-3 py-1.5 text-[11px] font-semibold transition-colors ${active === id ? "border-blue-500 text-white" : "border-transparent text-white/45 hover:text-white/70"}`,
|
|
2945
|
+
children: label
|
|
2946
|
+
},
|
|
2947
|
+
id
|
|
2948
|
+
))
|
|
2949
|
+
}
|
|
2950
|
+
);
|
|
2951
|
+
}
|
|
2952
|
+
|
|
2953
|
+
// src/components/editor-tab-panel.tsx
|
|
2954
|
+
|
|
2955
|
+
function EditorTabPanel({
|
|
2956
|
+
labels,
|
|
2957
|
+
plugins,
|
|
2958
|
+
activePlugin,
|
|
2959
|
+
onActivate
|
|
2960
|
+
}) {
|
|
2961
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2962
|
+
"div",
|
|
2963
|
+
{
|
|
2964
|
+
className: "border-t-2 border-emerald-500/40",
|
|
2965
|
+
style: { backgroundColor: "#0f1210" },
|
|
2966
|
+
children: [
|
|
2967
|
+
plugins.length > 1 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center gap-1 border-b border-white/10 px-3 py-1.5", children: plugins.map((plugin) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2968
|
+
"button",
|
|
2969
|
+
{
|
|
2970
|
+
type: "button",
|
|
2971
|
+
tabIndex: -1,
|
|
2972
|
+
"aria-pressed": (activePlugin == null ? void 0 : activePlugin.id) === plugin.id,
|
|
2973
|
+
onClick: () => onActivate(plugin.id),
|
|
2974
|
+
className: `rounded px-2 py-1 text-[10px] font-semibold transition-colors ${(activePlugin == null ? void 0 : activePlugin.id) === plugin.id ? "bg-emerald-600 text-white" : "text-white/50 hover:bg-white/10 hover:text-white/80"}`,
|
|
2975
|
+
children: plugin.label
|
|
2976
|
+
},
|
|
2977
|
+
plugin.id
|
|
2978
|
+
)) }),
|
|
2979
|
+
activePlugin ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "px-3 py-2", children: activePlugin.renderPanel() }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "px-3 py-3 text-center text-[10px] text-white/40", children: labels.emptyEditor })
|
|
2980
|
+
]
|
|
2981
|
+
}
|
|
2982
|
+
);
|
|
2983
|
+
}
|
|
2984
|
+
|
|
2985
|
+
// src/components/brandapp-tab-panel.tsx
|
|
2986
|
+
|
|
2987
|
+
function BrandappTabPanel({
|
|
2988
|
+
labels,
|
|
2989
|
+
plugins,
|
|
2990
|
+
activePlugin,
|
|
2991
|
+
onActivate
|
|
2992
|
+
}) {
|
|
2993
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { backgroundColor: "#0f1210" }, children: [
|
|
2994
|
+
plugins.length > 1 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center gap-1 bg-white/[0.035] px-3 py-1.5", children: plugins.map((plugin) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2995
|
+
"button",
|
|
2996
|
+
{
|
|
2997
|
+
type: "button",
|
|
2998
|
+
tabIndex: -1,
|
|
2999
|
+
"aria-pressed": (activePlugin == null ? void 0 : activePlugin.id) === plugin.id,
|
|
3000
|
+
onClick: () => onActivate(plugin.id),
|
|
3001
|
+
className: `rounded px-2 py-1 text-[10px] font-semibold transition-colors ${(activePlugin == null ? void 0 : activePlugin.id) === plugin.id ? "bg-emerald-600 text-white" : "text-white/50 hover:bg-white/10 hover:text-white/80"}`,
|
|
3002
|
+
children: plugin.label
|
|
3003
|
+
},
|
|
3004
|
+
plugin.id
|
|
3005
|
+
)) }),
|
|
3006
|
+
activePlugin ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "px-3 py-2", children: activePlugin.renderPanel() }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "px-3 py-3 text-center text-[10px] text-white/40", children: labels.emptyBrandapp })
|
|
3007
|
+
] });
|
|
3008
|
+
}
|
|
3009
|
+
|
|
3010
|
+
// src/components/component-tab-panel.tsx
|
|
3011
|
+
|
|
3012
|
+
|
|
3013
|
+
function ComponentTabPanel({
|
|
3014
|
+
labels,
|
|
3015
|
+
displayedEl,
|
|
3016
|
+
isInspecting,
|
|
3017
|
+
pinnedInspect,
|
|
3018
|
+
componentChain,
|
|
3019
|
+
composite,
|
|
3020
|
+
ariaAttrs,
|
|
3021
|
+
dataAttrs,
|
|
3022
|
+
optIdentity,
|
|
3023
|
+
tabbable,
|
|
3024
|
+
tabInfo,
|
|
3025
|
+
spatialTargets,
|
|
3026
|
+
trappedContext,
|
|
3027
|
+
protectedDirs,
|
|
3028
|
+
history,
|
|
3029
|
+
eventLog,
|
|
3030
|
+
opsUIComponents,
|
|
3031
|
+
traceFilter,
|
|
3032
|
+
showComponentTrace,
|
|
3033
|
+
showComponentTree,
|
|
3034
|
+
showSpatialNav,
|
|
3035
|
+
showEventLog,
|
|
3036
|
+
onTraceFilterChange,
|
|
3037
|
+
onClearEventLog
|
|
3038
|
+
}) {
|
|
3039
|
+
var _a;
|
|
3040
|
+
if (!displayedEl) {
|
|
3041
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "divide-y divide-white/10", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "px-3 py-6 text-center whitespace-pre-line text-white/55", children: labels.emptyComponent }) });
|
|
3042
|
+
}
|
|
3043
|
+
const className = (_a = displayedEl.getAttribute("class")) != null ? _a : "";
|
|
3044
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "divide-y divide-white/10", children: [
|
|
3045
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3046
|
+
Section,
|
|
3047
|
+
{
|
|
3048
|
+
title: isInspecting ? pinnedInspect ? labels.inspectingPinned : labels.inspecting : labels.currentFocus,
|
|
3049
|
+
color: isInspecting ? "text-cyan-400" : "text-blue-400",
|
|
3050
|
+
children: [
|
|
3051
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3052
|
+
"p",
|
|
3053
|
+
{
|
|
3054
|
+
className: `font-mono ${isInspecting ? "text-cyan-300" : "text-blue-300"}`,
|
|
3055
|
+
children: elLabel(displayedEl)
|
|
3056
|
+
}
|
|
3057
|
+
),
|
|
3058
|
+
optIdentity && optIdentity.metaName && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mt-1 flex flex-wrap items-center gap-1.5", children: [
|
|
3059
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rounded bg-blue-900/40 px-1.5 py-0.5 text-[10px] font-medium text-blue-300", children: optIdentity.metaName }),
|
|
3060
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-[10px] text-white/45", children: optIdentity.layer }),
|
|
3061
|
+
optIdentity.exportName !== optIdentity.metaName && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-[10px] text-white/55", children: [
|
|
3062
|
+
"\u203A ",
|
|
3063
|
+
optIdentity.exportName
|
|
3064
|
+
] }),
|
|
3065
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "font-mono text-[10px] text-white/55", children: optIdentity.id }),
|
|
3066
|
+
!optIdentity.registered && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3067
|
+
"span",
|
|
3068
|
+
{
|
|
3069
|
+
className: "rounded bg-red-900/40 px-1.5 py-0.5 text-[10px] text-red-300",
|
|
3070
|
+
title: "data-opt-id and data-opt-slug don't match the same registry entry \u2014 the code is out of sync with the meta",
|
|
3071
|
+
children: "stale"
|
|
3072
|
+
}
|
|
3073
|
+
)
|
|
3074
|
+
] }),
|
|
3075
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "mt-0.5 text-white/60", children: [
|
|
3076
|
+
'"',
|
|
3077
|
+
elText(displayedEl),
|
|
3078
|
+
'"'
|
|
3079
|
+
] }),
|
|
3080
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "gap-element mt-2 flex flex-col", children: [
|
|
3081
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Attr, { name: "tabindex", value: String(displayedEl.tabIndex) }),
|
|
3082
|
+
displayedEl.getAttribute("role") && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Attr, { name: "role", value: displayedEl.getAttribute("role") }),
|
|
3083
|
+
ariaAttrs.map(([name, value]) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Attr, { name, value }, name)),
|
|
3084
|
+
dataAttrs.map(([name, value]) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Attr, { name, value }, name))
|
|
3085
|
+
] }),
|
|
3086
|
+
(trappedContext || protectedDirs.length > 0) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mt-2 flex flex-wrap gap-1.5", children: [
|
|
3087
|
+
trappedContext && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rounded bg-red-900/40 px-1.5 py-0.5 text-[10px] text-red-400", children: [
|
|
3088
|
+
labels.trapped,
|
|
3089
|
+
": ",
|
|
3090
|
+
trappedContext
|
|
3091
|
+
] }),
|
|
3092
|
+
protectedDirs.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rounded bg-amber-900/40 px-1.5 py-0.5 text-[10px] text-amber-400", children: [
|
|
3093
|
+
labels.protected,
|
|
3094
|
+
":",
|
|
3095
|
+
" ",
|
|
3096
|
+
protectedDirs.map((dir) => DIR_SYMBOL[dir]).join("")
|
|
3097
|
+
] })
|
|
3098
|
+
] }),
|
|
3099
|
+
className && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "mt-1.5 break-all text-white/45", children: [
|
|
3100
|
+
"class: ",
|
|
3101
|
+
className.slice(0, 100),
|
|
3102
|
+
className.length > 100 ? "\u2026" : ""
|
|
3103
|
+
] })
|
|
3104
|
+
]
|
|
3105
|
+
}
|
|
3106
|
+
),
|
|
3107
|
+
showComponentTrace && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Section, { title: labels.componentTrace, color: "text-cyan-400", children: [
|
|
3108
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mb-1.5 flex gap-1", children: [
|
|
3109
|
+
["user", labels.filterUser],
|
|
3110
|
+
["primitives", labels.filterPrimitives],
|
|
3111
|
+
["all", labels.filterAll]
|
|
3112
|
+
].map(([key, label]) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3113
|
+
"button",
|
|
3114
|
+
{
|
|
3115
|
+
tabIndex: -1,
|
|
3116
|
+
onClick: () => onTraceFilterChange(key),
|
|
3117
|
+
className: `rounded px-1.5 py-0.5 text-[10px] transition-colors ${traceFilter === key ? "bg-cyan-600 text-white" : "bg-white/10 text-white/55 hover:text-white/80"}`,
|
|
3118
|
+
children: label
|
|
3119
|
+
},
|
|
3120
|
+
key
|
|
3121
|
+
)) }),
|
|
3122
|
+
componentChain.length > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ComponentTree, { chain: filterChain(componentChain, traceFilter) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-white/55", children: labels.noReactComponent })
|
|
3123
|
+
] }),
|
|
3124
|
+
showComponentTree && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Section, { title: labels.componentTree, color: "text-rose-400", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3125
|
+
ComponentTreeViewer,
|
|
3126
|
+
{
|
|
3127
|
+
displayedEl,
|
|
3128
|
+
opsUIComponents
|
|
3129
|
+
}
|
|
3130
|
+
) }),
|
|
3131
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3132
|
+
Section,
|
|
3133
|
+
{
|
|
3134
|
+
title: tabInfo.inOrder ? `${labels.tabOrderInline} (${tabInfo.idx + 1}/${tabbable.length})` : labels.tabOrderOut,
|
|
3135
|
+
color: "text-green-400",
|
|
3136
|
+
children: !tabInfo.inOrder ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-white/55", children: [
|
|
3137
|
+
"tabindex=",
|
|
3138
|
+
displayedEl.tabIndex,
|
|
3139
|
+
" \u2014 ",
|
|
3140
|
+
labels.tabOrderHint
|
|
3141
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "gap-element flex flex-col", children: [
|
|
3142
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3143
|
+
FocusTarget,
|
|
3144
|
+
{
|
|
3145
|
+
dir: labels.shiftTabPrev,
|
|
3146
|
+
el: tabInfo.prev,
|
|
3147
|
+
color: "text-orange-400"
|
|
3148
|
+
}
|
|
3149
|
+
),
|
|
3150
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3151
|
+
FocusTarget,
|
|
3152
|
+
{
|
|
3153
|
+
dir: labels.tabNext,
|
|
3154
|
+
el: tabInfo.next,
|
|
3155
|
+
color: "text-green-400"
|
|
3156
|
+
}
|
|
3157
|
+
)
|
|
3158
|
+
] })
|
|
3159
|
+
}
|
|
3160
|
+
),
|
|
3161
|
+
composite && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3162
|
+
Section,
|
|
3163
|
+
{
|
|
3164
|
+
title: labels.arrowKeysTitle(
|
|
3165
|
+
composite.type,
|
|
3166
|
+
composite.index + 1,
|
|
3167
|
+
composite.total
|
|
3168
|
+
),
|
|
3169
|
+
color: "text-purple-400",
|
|
3170
|
+
trailing: composite.focusLoop || composite.focusWrap ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-1", children: [
|
|
3171
|
+
composite.focusLoop && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rounded bg-pink-600/30 px-1.5 py-0.5 text-[9px] font-bold text-pink-400", children: labels.loopBadge }),
|
|
3172
|
+
composite.focusWrap && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rounded bg-pink-600/30 px-1.5 py-0.5 text-[9px] font-bold text-pink-400", children: labels.wrapBadge })
|
|
3173
|
+
] }) : void 0,
|
|
3174
|
+
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "gap-element flex flex-col", children: [
|
|
3175
|
+
composite.arrows.filter((arrow) => !arrow.loop).map((arrow, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3176
|
+
FocusTarget,
|
|
3177
|
+
{
|
|
3178
|
+
dir: arrow.direction,
|
|
3179
|
+
el: arrow.element,
|
|
3180
|
+
color: "text-purple-300"
|
|
3181
|
+
},
|
|
3182
|
+
index
|
|
3183
|
+
)),
|
|
3184
|
+
composite.arrows.filter((arrow) => arrow.loop).map((arrow, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center gap-1", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3185
|
+
FocusTarget,
|
|
3186
|
+
{
|
|
3187
|
+
dir: `${arrow.direction}\u21BB`,
|
|
3188
|
+
el: arrow.element,
|
|
3189
|
+
color: "text-pink-400"
|
|
3190
|
+
}
|
|
3191
|
+
) }, `loop-${index}`)),
|
|
3192
|
+
composite.arrows.length === 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-white/45", children: labels.noArrowTarget })
|
|
3193
|
+
] })
|
|
3194
|
+
}
|
|
3195
|
+
),
|
|
3196
|
+
showSpatialNav && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Section, { title: labels.spatialNav, color: "text-teal-400", children: spatialTargets.length > 0 || protectedDirs.length > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "gap-element flex flex-col", children: ["up", "down", "left", "right"].map(
|
|
3197
|
+
(direction) => {
|
|
3198
|
+
const target = spatialTargets.find(
|
|
3199
|
+
(candidate) => candidate.direction === direction
|
|
3200
|
+
);
|
|
3201
|
+
const isProtected = protectedDirs.includes(direction);
|
|
3202
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-1.5", children: [
|
|
3203
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3204
|
+
"span",
|
|
3205
|
+
{
|
|
3206
|
+
className: `w-3 text-center font-mono ${isProtected ? "text-amber-500" : "text-teal-300"}`,
|
|
3207
|
+
children: DIR_SYMBOL[direction]
|
|
3208
|
+
}
|
|
3209
|
+
),
|
|
3210
|
+
isProtected ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-amber-500/70", children: labels.spatialProtected }) : target ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3211
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "font-mono text-white/80", children: elLabel(target.element) }),
|
|
3212
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-white/55", children: [
|
|
3213
|
+
'"',
|
|
3214
|
+
elText(target.element),
|
|
3215
|
+
'"'
|
|
3216
|
+
] }),
|
|
3217
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-teal-600", children: [
|
|
3218
|
+
"(",
|
|
3219
|
+
target.score,
|
|
3220
|
+
")"
|
|
3221
|
+
] })
|
|
3222
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-white/45", children: "(\uC5C6\uC74C)" })
|
|
3223
|
+
] }, direction);
|
|
3224
|
+
}
|
|
3225
|
+
) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-white/45", children: trappedContext ? labels.spatialTrappedContext(trappedContext) : labels.spatialNoCandidate }) }),
|
|
3226
|
+
history.length > 1 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Section, { title: labels.history, color: "text-white/60", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex flex-wrap items-center gap-x-1 gap-y-0.5 font-mono leading-relaxed", children: history.slice(0, 8).map((el, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-1", children: [
|
|
3227
|
+
index > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-white/35", children: "\u2190" }),
|
|
3228
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3229
|
+
"span",
|
|
3230
|
+
{
|
|
3231
|
+
className: index === 0 ? "text-blue-400" : "text-white/55",
|
|
3232
|
+
children: elLabel(el).slice(0, 25)
|
|
3233
|
+
}
|
|
3234
|
+
)
|
|
3235
|
+
] }, index)) }) }),
|
|
3236
|
+
showEventLog && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3237
|
+
Section,
|
|
3238
|
+
{
|
|
3239
|
+
title: labels.eventLogTitle,
|
|
3240
|
+
color: "text-yellow-400",
|
|
3241
|
+
trailing: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-1.5", children: [
|
|
3242
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-[10px] text-white/35 tabular-nums", children: [
|
|
3243
|
+
eventLog.length,
|
|
3244
|
+
"/",
|
|
3245
|
+
EVENT_LOG_CAP
|
|
3246
|
+
] }),
|
|
3247
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3248
|
+
"button",
|
|
3249
|
+
{
|
|
3250
|
+
tabIndex: -1,
|
|
3251
|
+
onClick: onClearEventLog,
|
|
3252
|
+
className: "rounded bg-white/10 px-1.5 py-0.5 text-[10px] text-white/55 transition-colors hover:text-white/80",
|
|
3253
|
+
children: labels.eventLogClear
|
|
3254
|
+
}
|
|
3255
|
+
)
|
|
3256
|
+
] }),
|
|
3257
|
+
children: eventLog.length === 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-white/45", children: labels.eventLogWaiting }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "gap-element flex max-h-32 flex-col overflow-y-auto font-mono text-[11px]", children: eventLog.map((entry) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
3258
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "shrink-0 text-white/45", children: formatTime(entry.time) }),
|
|
3259
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3260
|
+
"span",
|
|
3261
|
+
{
|
|
3262
|
+
className: _optui.cn.call(void 0, "shrink-0", getEventLogTypeClass(entry.type)),
|
|
3263
|
+
children: getEventLogTypeLabel(entry.type)
|
|
3264
|
+
}
|
|
3265
|
+
),
|
|
3266
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "truncate text-white/60", children: entry.target }),
|
|
3267
|
+
entry.detail && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "shrink-0 text-yellow-300", children: [
|
|
3268
|
+
"(",
|
|
3269
|
+
entry.detail,
|
|
3270
|
+
")"
|
|
3271
|
+
] })
|
|
3272
|
+
] }, entry.id)) })
|
|
3273
|
+
}
|
|
3274
|
+
)
|
|
3275
|
+
] });
|
|
3276
|
+
}
|
|
3277
|
+
|
|
3278
|
+
// src/components/component-engine-plugins.tsx
|
|
3279
|
+
|
|
3280
|
+
function ComponentEnginePlugins({
|
|
3281
|
+
labels,
|
|
3282
|
+
plugins,
|
|
3283
|
+
activePlugin,
|
|
3284
|
+
onActivate
|
|
3285
|
+
}) {
|
|
3286
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3287
|
+
"div",
|
|
3288
|
+
{
|
|
3289
|
+
className: "border-t-2 border-emerald-500/40",
|
|
3290
|
+
style: { backgroundColor: "#0f1210" },
|
|
3291
|
+
children: [
|
|
3292
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center gap-1 border-b border-white/10 px-3 py-1.5", children: plugins.map((plugin) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3293
|
+
"button",
|
|
3294
|
+
{
|
|
3295
|
+
type: "button",
|
|
3296
|
+
tabIndex: -1,
|
|
3297
|
+
"aria-pressed": (activePlugin == null ? void 0 : activePlugin.id) === plugin.id,
|
|
3298
|
+
onClick: () => onActivate(plugin.id),
|
|
3299
|
+
className: `rounded px-2 py-1 text-[10px] font-semibold transition-colors ${(activePlugin == null ? void 0 : activePlugin.id) === plugin.id ? "bg-emerald-600 text-white" : "text-white/50 hover:bg-white/10 hover:text-white/80"}`,
|
|
3300
|
+
children: plugin.label
|
|
3301
|
+
},
|
|
3302
|
+
plugin.id
|
|
3303
|
+
)) }),
|
|
3304
|
+
activePlugin ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "px-3 py-2", children: activePlugin.renderPanel() }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "px-3 py-3 text-center text-[10px] text-white/40", children: labels.emptyEnginePanel })
|
|
3305
|
+
]
|
|
3306
|
+
}
|
|
3307
|
+
);
|
|
3308
|
+
}
|
|
3309
|
+
|
|
3310
|
+
// src/components/component-toggles-footer.tsx
|
|
3311
|
+
|
|
3312
|
+
function ComponentTogglesFooter({
|
|
3313
|
+
labels,
|
|
3314
|
+
showGuide,
|
|
3315
|
+
showTabOrder,
|
|
3316
|
+
showSpatialNav,
|
|
3317
|
+
showComponentLabels,
|
|
3318
|
+
showCompositeBounds,
|
|
3319
|
+
showComponentTrace,
|
|
3320
|
+
showComponentTree,
|
|
3321
|
+
showEventLog,
|
|
3322
|
+
showInspect,
|
|
3323
|
+
onShowGuideChange,
|
|
3324
|
+
onShowTabOrderChange,
|
|
3325
|
+
onShowSpatialNavChange,
|
|
3326
|
+
onShowComponentLabelsChange,
|
|
3327
|
+
onShowCompositeBoundsChange,
|
|
3328
|
+
onShowComponentTraceChange,
|
|
3329
|
+
onShowComponentTreeChange,
|
|
3330
|
+
onShowEventLogChange,
|
|
3331
|
+
onShowInspectChange
|
|
3332
|
+
}) {
|
|
3333
|
+
const overlays = [
|
|
3334
|
+
{ active: showGuide, set: onShowGuideChange, label: labels.toggleGuide },
|
|
3335
|
+
{
|
|
3336
|
+
active: showTabOrder,
|
|
3337
|
+
set: onShowTabOrderChange,
|
|
3338
|
+
label: labels.toggleTabOrder
|
|
3339
|
+
},
|
|
3340
|
+
{
|
|
3341
|
+
active: showSpatialNav,
|
|
3342
|
+
set: onShowSpatialNavChange,
|
|
3343
|
+
label: labels.toggleSpatialNav
|
|
3344
|
+
},
|
|
3345
|
+
{
|
|
3346
|
+
active: showComponentLabels,
|
|
3347
|
+
set: onShowComponentLabelsChange,
|
|
3348
|
+
label: labels.toggleComponentLabels
|
|
3349
|
+
},
|
|
3350
|
+
{
|
|
3351
|
+
active: showCompositeBounds,
|
|
3352
|
+
set: onShowCompositeBoundsChange,
|
|
3353
|
+
label: labels.toggleCompositeBounds
|
|
3354
|
+
}
|
|
3355
|
+
];
|
|
3356
|
+
const panels = [
|
|
3357
|
+
{
|
|
3358
|
+
active: showComponentTrace,
|
|
3359
|
+
set: onShowComponentTraceChange,
|
|
3360
|
+
label: labels.toggleComponentTrace
|
|
3361
|
+
},
|
|
3362
|
+
{
|
|
3363
|
+
active: showComponentTree,
|
|
3364
|
+
set: onShowComponentTreeChange,
|
|
3365
|
+
label: labels.toggleComponentTree
|
|
3366
|
+
},
|
|
3367
|
+
{
|
|
3368
|
+
active: showEventLog,
|
|
3369
|
+
set: onShowEventLogChange,
|
|
3370
|
+
label: labels.toggleEventLog
|
|
3371
|
+
},
|
|
3372
|
+
{
|
|
3373
|
+
active: showInspect,
|
|
3374
|
+
set: onShowInspectChange,
|
|
3375
|
+
label: labels.toggleInspect
|
|
3376
|
+
}
|
|
3377
|
+
];
|
|
3378
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3379
|
+
"div",
|
|
3380
|
+
{
|
|
3381
|
+
className: "gap-element sticky bottom-0 z-10 flex flex-col border-t border-white/15 px-3 py-2",
|
|
3382
|
+
style: { backgroundColor: "#0a0a0a" },
|
|
3383
|
+
children: [
|
|
3384
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ToggleGroup, { heading: labels.overlaysSection, switches: overlays }),
|
|
3385
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ToggleGroup, { heading: labels.panelsSection, switches: panels })
|
|
3386
|
+
]
|
|
3387
|
+
}
|
|
3388
|
+
);
|
|
3389
|
+
}
|
|
3390
|
+
function ToggleGroup({
|
|
3391
|
+
heading,
|
|
3392
|
+
switches
|
|
3393
|
+
}) {
|
|
3394
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
3395
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-1.5 text-[9px] font-medium tracking-wider text-white/55 uppercase", children: heading }),
|
|
3396
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex flex-wrap gap-1.5", children: switches.map(({ active, set, label }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Toggle, { active, onToggle: () => set((v) => !v), children: label }, label)) })
|
|
3397
|
+
] });
|
|
3398
|
+
}
|
|
3399
|
+
|
|
3400
|
+
// src/opt-devtool.tsx
|
|
3401
|
+
|
|
3402
|
+
var { useCallback: useCallback9, useEffect: useEffect15, useMemo: useMemo3, useState: useState14, useSyncExternalStore: useSyncExternalStore2 } = React11;
|
|
3403
|
+
function AutoThemeBridge() {
|
|
3404
|
+
const { inspect } = _chunkSQ3E3QLAcjs.useThemeDevtoolBridge.call(void 0, {
|
|
3405
|
+
id: "auto-theme",
|
|
3406
|
+
label: "Theme",
|
|
3407
|
+
order: 15
|
|
3408
|
+
});
|
|
3409
|
+
useEffect15(() => {
|
|
3410
|
+
if (typeof window === "undefined") return;
|
|
3411
|
+
function handleTheme(e) {
|
|
3412
|
+
const detail = e.detail;
|
|
3413
|
+
if (detail) {
|
|
3414
|
+
inspect(_chunkSQ3E3QLAcjs.themeConfigToSnapshot.call(void 0, detail));
|
|
3415
|
+
}
|
|
3416
|
+
}
|
|
3417
|
+
window.addEventListener(_optshell.SHELL_THEME_EVENT, handleTheme);
|
|
3418
|
+
return () => window.removeEventListener(_optshell.SHELL_THEME_EVENT, handleTheme);
|
|
3419
|
+
}, [inspect]);
|
|
3420
|
+
return null;
|
|
3421
|
+
}
|
|
3422
|
+
function OptDevtool({
|
|
3423
|
+
defaultOpen = false,
|
|
3424
|
+
labels: labelsProp
|
|
3425
|
+
}) {
|
|
3426
|
+
var _a;
|
|
3427
|
+
const labels = useMemo3(
|
|
3428
|
+
() => _chunkN7YO56TNcjs.__spreadValues.call(void 0, _chunkN7YO56TNcjs.__spreadValues.call(void 0, {}, _chunk4MJKIAXHcjs.koDevtoolLabels), labelsProp),
|
|
3429
|
+
[labelsProp]
|
|
3430
|
+
);
|
|
3431
|
+
const { plugins } = _chunk6AGUYGVTcjs.useOptDevtoolRegistry.call(void 0, );
|
|
3432
|
+
const [visible, setVisible] = useState14(defaultOpen);
|
|
3433
|
+
const [activeTab, setActiveTab] = useState14("component");
|
|
3434
|
+
const [activeComponentModuleId, setActiveComponentModuleId] = useState14(null);
|
|
3435
|
+
const [activeEditorModuleId, setActiveEditorModuleId] = useState14(null);
|
|
3436
|
+
const [activeBrandappModuleId, setActiveBrandappModuleId] = useState14(null);
|
|
3437
|
+
const harnessOverlayOn = useSyncExternalStore2(
|
|
3438
|
+
_chunkH3F2WACScjs.subscribeShellOverlay,
|
|
3439
|
+
_chunkH3F2WACScjs.getShellOverlay,
|
|
3440
|
+
() => false
|
|
3441
|
+
);
|
|
3442
|
+
const harnessSnap = useSyncExternalStore2(
|
|
3443
|
+
_chunkH3F2WACScjs.subscribeShellSnapshot,
|
|
3444
|
+
_chunkH3F2WACScjs.getShellSnapshot,
|
|
3445
|
+
() => null
|
|
3446
|
+
);
|
|
3447
|
+
const [showTabOrder, setShowTabOrder] = useState14(false);
|
|
3448
|
+
const [showGuide, setShowGuide] = useState14(true);
|
|
3449
|
+
const [showComponentTrace, setShowComponentTrace] = useState14(false);
|
|
3450
|
+
const [traceFilter, setTraceFilter] = useState14("user");
|
|
3451
|
+
const [panelCorner, setPanelCorner] = useState14("br");
|
|
3452
|
+
const [copied, setCopied] = useState14(false);
|
|
3453
|
+
const [showInspect, setShowInspect] = useState14(false);
|
|
3454
|
+
const { inspectedEl, pinned: pinnedInspect } = useInspectMode({
|
|
3455
|
+
enabled: showInspect
|
|
3456
|
+
});
|
|
3457
|
+
const [showEventLog, setShowEventLog] = useState14(false);
|
|
3458
|
+
const { entries: eventLog, clear: clearEventLog } = useEventLog({
|
|
3459
|
+
enabled: visible && showEventLog
|
|
3460
|
+
});
|
|
3461
|
+
const [showSpatialNav, setShowSpatialNav] = useState14(false);
|
|
3462
|
+
const [showComponentLabels, setShowComponentLabels] = useState14(false);
|
|
3463
|
+
const opsUIComponents = useScanOpsUIComponents({
|
|
3464
|
+
enabled: visible && showComponentLabels
|
|
3465
|
+
});
|
|
3466
|
+
const [showComponentTree, setShowComponentTree] = useState14(false);
|
|
3467
|
+
const [showCompositeBounds, setShowCompositeBounds] = useState14(false);
|
|
3468
|
+
const compositeBounds = useScanCompositeBounds({
|
|
3469
|
+
enabled: visible && showCompositeBounds
|
|
3470
|
+
});
|
|
3471
|
+
const componentPlugins = useMemo3(
|
|
3472
|
+
() => plugins.filter((plugin) => {
|
|
3473
|
+
var _a2;
|
|
3474
|
+
return ((_a2 = plugin.tab) != null ? _a2 : "component") === "component";
|
|
3475
|
+
}),
|
|
3476
|
+
[plugins]
|
|
3477
|
+
);
|
|
3478
|
+
const editorPlugins = useMemo3(
|
|
3479
|
+
() => plugins.filter((plugin) => plugin.tab === "editor"),
|
|
3480
|
+
[plugins]
|
|
3481
|
+
);
|
|
3482
|
+
const brandappPlugins = useMemo3(
|
|
3483
|
+
() => plugins.filter((plugin) => plugin.tab === "brandapp"),
|
|
3484
|
+
[plugins]
|
|
3485
|
+
);
|
|
3486
|
+
useDevtoolKeybinding(setVisible);
|
|
3487
|
+
const applyConfig = useCallback9((config) => {
|
|
3488
|
+
if (config.visible !== void 0) setVisible(config.visible);
|
|
3489
|
+
if (config.showGuide !== void 0) setShowGuide(config.showGuide);
|
|
3490
|
+
if (config.showTabOrder !== void 0) setShowTabOrder(config.showTabOrder);
|
|
3491
|
+
if (config.showSpatialNav !== void 0)
|
|
3492
|
+
setShowSpatialNav(config.showSpatialNav);
|
|
3493
|
+
if (config.showEventLog !== void 0) setShowEventLog(config.showEventLog);
|
|
3494
|
+
if (config.showComponentTrace !== void 0)
|
|
3495
|
+
setShowComponentTrace(config.showComponentTrace);
|
|
3496
|
+
if (config.showComponentTree !== void 0)
|
|
3497
|
+
setShowComponentTree(config.showComponentTree);
|
|
3498
|
+
if (config.showInspect !== void 0) setShowInspect(config.showInspect);
|
|
3499
|
+
if (config.showComponentLabels !== void 0)
|
|
3500
|
+
setShowComponentLabels(config.showComponentLabels);
|
|
3501
|
+
if (config.showCompositeBounds !== void 0)
|
|
3502
|
+
setShowCompositeBounds(config.showCompositeBounds);
|
|
3503
|
+
}, []);
|
|
3504
|
+
useDevtoolConfigEvent(applyConfig);
|
|
3505
|
+
const { focused, history, tabbable } = useFocusTracking({ enabled: visible });
|
|
3506
|
+
const displayedEl = showInspect && inspectedEl ? inspectedEl : focused;
|
|
3507
|
+
const tabInfo = useMemo3(() => {
|
|
3508
|
+
if (!displayedEl) {
|
|
3509
|
+
return {
|
|
3510
|
+
idx: -1,
|
|
3511
|
+
prev: null,
|
|
3512
|
+
next: null,
|
|
3513
|
+
inOrder: false
|
|
3514
|
+
};
|
|
3515
|
+
}
|
|
3516
|
+
const inOrder = displayedEl.tabIndex >= 0;
|
|
3517
|
+
const idx = inOrder ? tabbable.indexOf(displayedEl) : -1;
|
|
3518
|
+
return {
|
|
3519
|
+
idx,
|
|
3520
|
+
prev: idx > 0 ? tabbable[idx - 1] : null,
|
|
3521
|
+
next: idx >= 0 && idx < tabbable.length - 1 ? tabbable[idx + 1] : null,
|
|
3522
|
+
inOrder
|
|
3523
|
+
};
|
|
3524
|
+
}, [displayedEl, tabbable]);
|
|
3525
|
+
const composite = useMemo3(() => {
|
|
3526
|
+
if (!displayedEl) {
|
|
3527
|
+
return null;
|
|
3528
|
+
}
|
|
3529
|
+
return getCompositeInfo(displayedEl);
|
|
3530
|
+
}, [displayedEl]);
|
|
3531
|
+
const componentChain = useMemo3(() => {
|
|
3532
|
+
if (!displayedEl) {
|
|
3533
|
+
return [];
|
|
3534
|
+
}
|
|
3535
|
+
return getComponentChain(displayedEl);
|
|
3536
|
+
}, [displayedEl]);
|
|
3537
|
+
const ariaAttrs = useMemo3(
|
|
3538
|
+
() => displayedEl ? getAriaAttrs(displayedEl) : [],
|
|
3539
|
+
[displayedEl]
|
|
3540
|
+
);
|
|
3541
|
+
const dataAttrs = useMemo3(
|
|
3542
|
+
() => displayedEl ? getDataAttrs(displayedEl) : [],
|
|
3543
|
+
[displayedEl]
|
|
3544
|
+
);
|
|
3545
|
+
const optIdentity = useMemo3(
|
|
3546
|
+
() => displayedEl ? getOptIdentityFromAncestors(displayedEl) : null,
|
|
3547
|
+
[displayedEl]
|
|
3548
|
+
);
|
|
3549
|
+
const spatialTargets = useMemo3(() => {
|
|
3550
|
+
if (!displayedEl || !showSpatialNav) {
|
|
3551
|
+
return [];
|
|
3552
|
+
}
|
|
3553
|
+
return _optui.computeSpatialTargets.call(void 0, displayedEl);
|
|
3554
|
+
}, [displayedEl, showSpatialNav]);
|
|
3555
|
+
const trappedContext = useMemo3(() => {
|
|
3556
|
+
if (!displayedEl) {
|
|
3557
|
+
return null;
|
|
3558
|
+
}
|
|
3559
|
+
return _optui.getTrappedContextRole.call(void 0, displayedEl);
|
|
3560
|
+
}, [displayedEl]);
|
|
3561
|
+
const protectedDirs = useMemo3(() => {
|
|
3562
|
+
if (!displayedEl) {
|
|
3563
|
+
return [];
|
|
3564
|
+
}
|
|
3565
|
+
return getProtectedDirs(displayedEl);
|
|
3566
|
+
}, [displayedEl]);
|
|
3567
|
+
useEffect15(() => {
|
|
3568
|
+
if (componentPlugins.length === 0) {
|
|
3569
|
+
setActiveComponentModuleId(null);
|
|
3570
|
+
return;
|
|
3571
|
+
}
|
|
3572
|
+
if (!activeComponentModuleId || !componentPlugins.some((plugin) => plugin.id === activeComponentModuleId)) {
|
|
3573
|
+
setActiveComponentModuleId(componentPlugins[0].id);
|
|
3574
|
+
}
|
|
3575
|
+
}, [activeComponentModuleId, componentPlugins]);
|
|
3576
|
+
useEffect15(() => {
|
|
3577
|
+
if (editorPlugins.length === 0) {
|
|
3578
|
+
setActiveEditorModuleId(null);
|
|
3579
|
+
return;
|
|
3580
|
+
}
|
|
3581
|
+
if (!activeEditorModuleId || !editorPlugins.some((plugin) => plugin.id === activeEditorModuleId)) {
|
|
3582
|
+
setActiveEditorModuleId(editorPlugins[0].id);
|
|
3583
|
+
}
|
|
3584
|
+
}, [activeEditorModuleId, activeTab, editorPlugins]);
|
|
3585
|
+
useEffect15(() => {
|
|
3586
|
+
if (brandappPlugins.length === 0) {
|
|
3587
|
+
setActiveBrandappModuleId(null);
|
|
3588
|
+
return;
|
|
3589
|
+
}
|
|
3590
|
+
if (!activeBrandappModuleId || !brandappPlugins.some((plugin) => plugin.id === activeBrandappModuleId)) {
|
|
3591
|
+
setActiveBrandappModuleId(brandappPlugins[0].id);
|
|
3592
|
+
}
|
|
3593
|
+
}, [activeBrandappModuleId, activeTab, brandappPlugins]);
|
|
3594
|
+
const activeComponentPlugin = useMemo3(
|
|
3595
|
+
() => {
|
|
3596
|
+
var _a2, _b;
|
|
3597
|
+
return activeComponentModuleId ? (_a2 = componentPlugins.find(
|
|
3598
|
+
(plugin) => plugin.id === activeComponentModuleId
|
|
3599
|
+
)) != null ? _a2 : null : (_b = componentPlugins[0]) != null ? _b : null;
|
|
3600
|
+
},
|
|
3601
|
+
[activeComponentModuleId, componentPlugins]
|
|
3602
|
+
);
|
|
3603
|
+
const activeEditorPlugin = useMemo3(
|
|
3604
|
+
() => {
|
|
3605
|
+
var _a2, _b;
|
|
3606
|
+
return activeEditorModuleId ? (_a2 = editorPlugins.find((plugin) => plugin.id === activeEditorModuleId)) != null ? _a2 : null : (_b = editorPlugins[0]) != null ? _b : null;
|
|
3607
|
+
},
|
|
3608
|
+
[activeEditorModuleId, editorPlugins]
|
|
3609
|
+
);
|
|
3610
|
+
const activeBrandappPlugin = useMemo3(
|
|
3611
|
+
() => {
|
|
3612
|
+
var _a2, _b;
|
|
3613
|
+
return activeBrandappModuleId ? (_a2 = brandappPlugins.find(
|
|
3614
|
+
(plugin) => plugin.id === activeBrandappModuleId
|
|
3615
|
+
)) != null ? _a2 : null : (_b = brandappPlugins[0]) != null ? _b : null;
|
|
3616
|
+
},
|
|
3617
|
+
[activeBrandappModuleId, brandappPlugins]
|
|
3618
|
+
);
|
|
3619
|
+
const handleCopy = useCallback9(() => {
|
|
3620
|
+
var _a2;
|
|
3621
|
+
if (!displayedEl) {
|
|
3622
|
+
return;
|
|
3623
|
+
}
|
|
3624
|
+
const text = buildSnapshotText(
|
|
3625
|
+
displayedEl,
|
|
3626
|
+
componentChain,
|
|
3627
|
+
tabInfo,
|
|
3628
|
+
composite,
|
|
3629
|
+
ariaAttrs,
|
|
3630
|
+
dataAttrs,
|
|
3631
|
+
spatialTargets,
|
|
3632
|
+
trappedContext,
|
|
3633
|
+
protectedDirs,
|
|
3634
|
+
optIdentity
|
|
3635
|
+
);
|
|
3636
|
+
if (!((_a2 = navigator.clipboard) == null ? void 0 : _a2.writeText)) {
|
|
3637
|
+
console.warn("[opt-devtool] Clipboard API unavailable in this context.");
|
|
3638
|
+
return;
|
|
3639
|
+
}
|
|
3640
|
+
navigator.clipboard.writeText(text).then(
|
|
3641
|
+
() => {
|
|
3642
|
+
setCopied(true);
|
|
3643
|
+
setTimeout(() => setCopied(false), 1500);
|
|
3644
|
+
},
|
|
3645
|
+
(error) => {
|
|
3646
|
+
console.warn("[opt-devtool] Failed to copy snapshot:", error);
|
|
3647
|
+
}
|
|
3648
|
+
);
|
|
3649
|
+
}, [
|
|
3650
|
+
ariaAttrs,
|
|
3651
|
+
componentChain,
|
|
3652
|
+
composite,
|
|
3653
|
+
dataAttrs,
|
|
3654
|
+
displayedEl,
|
|
3655
|
+
optIdentity,
|
|
3656
|
+
protectedDirs,
|
|
3657
|
+
spatialTargets,
|
|
3658
|
+
tabInfo,
|
|
3659
|
+
trappedContext
|
|
3660
|
+
]);
|
|
3661
|
+
if (!visible) {
|
|
3662
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3663
|
+
"div",
|
|
3664
|
+
{
|
|
3665
|
+
"data-opt-devtool": true,
|
|
3666
|
+
className: `fixed ${cornerClass(panelCorner)} z-[9999]`,
|
|
3667
|
+
style: _chunkEQPETYJJcjs.ISOLATE_STYLE,
|
|
3668
|
+
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3669
|
+
"button",
|
|
3670
|
+
{
|
|
3671
|
+
tabIndex: -1,
|
|
3672
|
+
onClick: () => setVisible(true),
|
|
3673
|
+
className: "rounded-lg px-3 py-1.5 text-xs text-white/60 shadow-lg transition-colors hover:text-white",
|
|
3674
|
+
style: { backgroundColor: "#0a0a0a" },
|
|
3675
|
+
children: [
|
|
3676
|
+
labels.panelTitle,
|
|
3677
|
+
" ",
|
|
3678
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "ml-1 text-white/45", children: labels.toggleHint })
|
|
3679
|
+
]
|
|
3680
|
+
}
|
|
3681
|
+
)
|
|
3682
|
+
}
|
|
3683
|
+
);
|
|
3684
|
+
}
|
|
3685
|
+
const isInspecting = showInspect && inspectedEl;
|
|
3686
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3687
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, AutoThemeBridge, {}),
|
|
3688
|
+
showGuide && focused && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3689
|
+
FocusOverlays,
|
|
3690
|
+
{
|
|
3691
|
+
current: focused,
|
|
3692
|
+
tabNext: tabInfo.next,
|
|
3693
|
+
tabPrev: tabInfo.prev,
|
|
3694
|
+
arrows: (_a = composite == null ? void 0 : composite.arrows) != null ? _a : [],
|
|
3695
|
+
spatialTargets: showSpatialNav ? spatialTargets : [],
|
|
3696
|
+
protectedDirs
|
|
3697
|
+
}
|
|
3698
|
+
),
|
|
3699
|
+
showTabOrder && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TabOrderBadges, { tabbable, current: focused }),
|
|
3700
|
+
showInspect && inspectedEl && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InspectOverlay, { element: inspectedEl, pinned: pinnedInspect }),
|
|
3701
|
+
showComponentLabels && opsUIComponents.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ComponentLabelsOverlay, { components: opsUIComponents }),
|
|
3702
|
+
showCompositeBounds && compositeBounds.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CompositeBoundsOverlay, { zones: compositeBounds }),
|
|
3703
|
+
harnessOverlayOn && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkH3F2WACScjs.ShellOverlay, { snapshot: harnessSnap }),
|
|
3704
|
+
plugins.map((plugin) => {
|
|
3705
|
+
var _a2, _b;
|
|
3706
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, React11.Fragment, { children: (_b = (_a2 = plugin.renderOverlay) == null ? void 0 : _a2.call(plugin)) != null ? _b : null }, plugin.id);
|
|
3707
|
+
}),
|
|
3708
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3709
|
+
"div",
|
|
3710
|
+
{
|
|
3711
|
+
"data-opt-devtool": true,
|
|
3712
|
+
className: `fixed ${cornerClass(panelCorner)} z-[9999] max-h-[70vh] w-96 overflow-y-auto rounded-xl border border-white/15 text-xs text-white/80 shadow-2xl`,
|
|
3713
|
+
style: _chunkEQPETYJJcjs.PANEL_STYLE,
|
|
3714
|
+
children: [
|
|
3715
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3716
|
+
DevtoolHeader,
|
|
3717
|
+
{
|
|
3718
|
+
labels,
|
|
3719
|
+
copied,
|
|
3720
|
+
panelCorner,
|
|
3721
|
+
onCopy: handleCopy,
|
|
3722
|
+
onCornerChange: setPanelCorner,
|
|
3723
|
+
onClose: () => setVisible(false)
|
|
3724
|
+
}
|
|
3725
|
+
),
|
|
3726
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3727
|
+
DevtoolTabBar,
|
|
3728
|
+
{
|
|
3729
|
+
active: activeTab,
|
|
3730
|
+
labels,
|
|
3731
|
+
onChange: setActiveTab
|
|
3732
|
+
}
|
|
3733
|
+
),
|
|
3734
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3735
|
+
"div",
|
|
3736
|
+
{
|
|
3737
|
+
id: `opt-devtool-panel-${activeTab}`,
|
|
3738
|
+
role: "tabpanel",
|
|
3739
|
+
"aria-labelledby": `opt-devtool-tab-${activeTab}`,
|
|
3740
|
+
children: [
|
|
3741
|
+
activeTab === "theme" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThemePanel, { visible }),
|
|
3742
|
+
activeTab === "harness" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ShellPanel, {}),
|
|
3743
|
+
activeTab === "editor" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3744
|
+
EditorTabPanel,
|
|
3745
|
+
{
|
|
3746
|
+
labels,
|
|
3747
|
+
plugins: editorPlugins,
|
|
3748
|
+
activePlugin: activeEditorPlugin,
|
|
3749
|
+
onActivate: setActiveEditorModuleId
|
|
3750
|
+
}
|
|
3751
|
+
),
|
|
3752
|
+
activeTab === "brandapp" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3753
|
+
BrandappTabPanel,
|
|
3754
|
+
{
|
|
3755
|
+
labels,
|
|
3756
|
+
plugins: brandappPlugins,
|
|
3757
|
+
activePlugin: activeBrandappPlugin,
|
|
3758
|
+
onActivate: setActiveBrandappModuleId
|
|
3759
|
+
}
|
|
3760
|
+
),
|
|
3761
|
+
activeTab === "component" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3762
|
+
ComponentTabPanel,
|
|
3763
|
+
{
|
|
3764
|
+
labels,
|
|
3765
|
+
displayedEl,
|
|
3766
|
+
isInspecting: !!isInspecting,
|
|
3767
|
+
pinnedInspect,
|
|
3768
|
+
componentChain,
|
|
3769
|
+
composite,
|
|
3770
|
+
ariaAttrs,
|
|
3771
|
+
dataAttrs,
|
|
3772
|
+
optIdentity,
|
|
3773
|
+
tabbable,
|
|
3774
|
+
tabInfo,
|
|
3775
|
+
spatialTargets,
|
|
3776
|
+
trappedContext,
|
|
3777
|
+
protectedDirs,
|
|
3778
|
+
history,
|
|
3779
|
+
eventLog,
|
|
3780
|
+
opsUIComponents,
|
|
3781
|
+
traceFilter,
|
|
3782
|
+
showComponentTrace,
|
|
3783
|
+
showComponentTree,
|
|
3784
|
+
showSpatialNav,
|
|
3785
|
+
showEventLog,
|
|
3786
|
+
onTraceFilterChange: setTraceFilter,
|
|
3787
|
+
onClearEventLog: clearEventLog
|
|
3788
|
+
}
|
|
3789
|
+
),
|
|
3790
|
+
activeTab === "component" && componentPlugins.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3791
|
+
ComponentEnginePlugins,
|
|
3792
|
+
{
|
|
3793
|
+
labels,
|
|
3794
|
+
plugins: componentPlugins,
|
|
3795
|
+
activePlugin: activeComponentPlugin,
|
|
3796
|
+
onActivate: setActiveComponentModuleId
|
|
3797
|
+
}
|
|
3798
|
+
),
|
|
3799
|
+
activeTab === "component" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3800
|
+
ComponentTogglesFooter,
|
|
3801
|
+
{
|
|
3802
|
+
labels,
|
|
3803
|
+
showGuide,
|
|
3804
|
+
showTabOrder,
|
|
3805
|
+
showSpatialNav,
|
|
3806
|
+
showComponentLabels,
|
|
3807
|
+
showCompositeBounds,
|
|
3808
|
+
showComponentTrace,
|
|
3809
|
+
showComponentTree,
|
|
3810
|
+
showEventLog,
|
|
3811
|
+
showInspect,
|
|
3812
|
+
onShowGuideChange: setShowGuide,
|
|
3813
|
+
onShowTabOrderChange: setShowTabOrder,
|
|
3814
|
+
onShowSpatialNavChange: setShowSpatialNav,
|
|
3815
|
+
onShowComponentLabelsChange: setShowComponentLabels,
|
|
3816
|
+
onShowCompositeBoundsChange: setShowCompositeBounds,
|
|
3817
|
+
onShowComponentTraceChange: setShowComponentTrace,
|
|
3818
|
+
onShowComponentTreeChange: setShowComponentTree,
|
|
3819
|
+
onShowEventLogChange: setShowEventLog,
|
|
3820
|
+
onShowInspectChange: setShowInspect
|
|
3821
|
+
}
|
|
3822
|
+
)
|
|
3823
|
+
]
|
|
3824
|
+
}
|
|
3825
|
+
)
|
|
3826
|
+
]
|
|
3827
|
+
}
|
|
3828
|
+
)
|
|
3829
|
+
] });
|
|
3830
|
+
}
|
|
3831
|
+
|
|
3832
|
+
// src/i18n/en.ts
|
|
3833
|
+
var enDevtoolLabels = {
|
|
3834
|
+
panelTitle: "opt-devtool",
|
|
3835
|
+
toggleHint: "Ctrl+Shift+F",
|
|
3836
|
+
copyButtonTooltip: "Copy debug info",
|
|
3837
|
+
closeButton: "Close",
|
|
3838
|
+
tabComponent: "Component",
|
|
3839
|
+
tabEditor: "opt-editor",
|
|
3840
|
+
tabBrandapp: "Brandapp",
|
|
3841
|
+
tabTheme: "Theme",
|
|
3842
|
+
tabHarness: "Harness",
|
|
3843
|
+
emptyComponent: "Focus any element to see\nits info here.",
|
|
3844
|
+
emptyEditor: "No Editor snapshot registered on this page",
|
|
3845
|
+
emptyBrandapp: "No Brandapp SDK snapshot registered on this page",
|
|
3846
|
+
emptyEnginePanel: "Select a panel",
|
|
3847
|
+
inspectingPinned: "Inspecting (pinned)",
|
|
3848
|
+
inspecting: "Inspecting",
|
|
3849
|
+
currentFocus: "Current focus",
|
|
3850
|
+
componentTrace: "Component trace",
|
|
3851
|
+
componentTree: "Component tree",
|
|
3852
|
+
noReactComponent: "No React component found",
|
|
3853
|
+
tabOrderInline: "Tab order",
|
|
3854
|
+
tabOrderOut: "Tab order (out of sequence)",
|
|
3855
|
+
tabOrderHint: "Not reachable via Tab (roving tabindex or programmatic focus)",
|
|
3856
|
+
shiftTabPrev: "Shift+Tab (previous)",
|
|
3857
|
+
tabNext: "Tab (next)",
|
|
3858
|
+
arrowKeysTitle: (type, index, total) => `Arrow keys (${type}) ${index}/${total}`,
|
|
3859
|
+
loopBadge: "Loop",
|
|
3860
|
+
wrapBadge: "Wrap",
|
|
3861
|
+
noArrowTarget: "No arrow target (end)",
|
|
3862
|
+
spatialNav: "Spatial navigation",
|
|
3863
|
+
spatialProtected: "Protected",
|
|
3864
|
+
spatialNoCandidate: "No candidate",
|
|
3865
|
+
spatialTrappedContext: (context) => `trapped context (${context})`,
|
|
3866
|
+
history: "History",
|
|
3867
|
+
eventLogTitle: "Event log",
|
|
3868
|
+
eventLogClear: "Clear",
|
|
3869
|
+
eventLogWaiting: "Waiting for events\u2026",
|
|
3870
|
+
overlaysSection: "Overlays",
|
|
3871
|
+
panelsSection: "Info panels",
|
|
3872
|
+
toggleGuide: "Guide lines",
|
|
3873
|
+
toggleTabOrder: "Tab order",
|
|
3874
|
+
toggleSpatialNav: "Spatial nav",
|
|
3875
|
+
toggleComponentLabels: "Component labels",
|
|
3876
|
+
toggleCompositeBounds: "Composite bounds",
|
|
3877
|
+
toggleComponentTrace: "Component trace",
|
|
3878
|
+
toggleComponentTree: "Component tree",
|
|
3879
|
+
toggleEventLog: "Event log",
|
|
3880
|
+
toggleInspect: "Inspect",
|
|
3881
|
+
trapped: "trapped",
|
|
3882
|
+
protected: "protected",
|
|
3883
|
+
filterUser: "User",
|
|
3884
|
+
filterPrimitives: "Primitives",
|
|
3885
|
+
filterAll: "All"
|
|
3886
|
+
};
|
|
3887
|
+
|
|
3888
|
+
|
|
3889
|
+
|
|
3890
|
+
|
|
3891
|
+
|
|
3892
|
+
|
|
3893
|
+
|
|
3894
|
+
|
|
3895
|
+
exports.OPT_DEVTOOL_CONFIGURE_EVENT = _chunk4MJKIAXHcjs.OPT_DEVTOOL_CONFIGURE_EVENT; exports.OptDevtool = OptDevtool; exports.OptDevtoolProvider = _chunk6AGUYGVTcjs.OptDevtoolProvider; exports.defaultLabels = _chunk4MJKIAXHcjs.koDevtoolLabels; exports.enDevtoolLabels = enDevtoolLabels; exports.koDevtoolLabels = _chunk4MJKIAXHcjs.koDevtoolLabels; exports.useOptDevtoolPlugin = _chunk6AGUYGVTcjs.useOptDevtoolPlugin;
|