@reopt-ai/opt-devtool 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +7 -0
  2. package/dist/brandapp/index.cjs +455 -364
  3. package/dist/brandapp/index.d.cts +70 -68
  4. package/dist/brandapp/index.d.ts +70 -68
  5. package/dist/brandapp/index.js +448 -361
  6. package/dist/datagrid/index.cjs +171 -181
  7. package/dist/datagrid/index.d.cts +10 -9
  8. package/dist/datagrid/index.d.ts +10 -9
  9. package/dist/datagrid/index.js +167 -179
  10. package/dist/editor/index.cjs +210 -229
  11. package/dist/editor/index.d.cts +10 -9
  12. package/dist/editor/index.d.ts +10 -9
  13. package/dist/editor/index.js +206 -227
  14. package/dist/harness/index.cjs +5 -12
  15. package/dist/harness/index.d.cts +14 -14
  16. package/dist/harness/index.d.ts +14 -14
  17. package/dist/harness/index.js +2 -11
  18. package/dist/harness-CoRqiJWO.cjs +584 -0
  19. package/dist/harness-DU8hP98g.js +536 -0
  20. package/dist/index.cjs +3687 -3816
  21. package/dist/index.d.cts +13 -15
  22. package/dist/index.d.ts +13 -15
  23. package/dist/index.js +3679 -3815
  24. package/dist/provider-Bn7CAE_Y.js +116 -0
  25. package/dist/provider-CLRiXjfD.cjs +168 -0
  26. package/dist/theme/index.cjs +296 -12
  27. package/dist/theme/index.d.cts +25 -24
  28. package/dist/theme/index.d.ts +25 -24
  29. package/dist/theme/index.js +292 -11
  30. package/dist/theme-isolate-DgSS935z.cjs +54 -0
  31. package/dist/theme-isolate-F-oX2d4W.js +43 -0
  32. package/dist/types-B_abMm2B.cjs +10 -0
  33. package/dist/types-DvhcaPXA.js +5 -0
  34. package/dist/types-oHbLkgEH.d.cts +95 -0
  35. package/dist/types-oHbLkgEH.d.ts +95 -0
  36. package/dist/ui/index.cjs +4 -8
  37. package/dist/ui/index.d.cts +3 -2
  38. package/dist/ui/index.d.ts +3 -2
  39. package/dist/ui/index.js +2 -7
  40. package/package.json +2 -2
  41. package/dist/chunk-4MJKIAXH.cjs +0 -65
  42. package/dist/chunk-5HRIQSVF.js +0 -32
  43. package/dist/chunk-6AGUYGVT.cjs +0 -77
  44. package/dist/chunk-EQPETYJJ.cjs +0 -32
  45. package/dist/chunk-H3F2WACS.cjs +0 -568
  46. package/dist/chunk-N7YO56TN.cjs +0 -25
  47. package/dist/chunk-SQ3E3QLA.cjs +0 -253
  48. package/dist/chunk-SW2FF6EV.js +0 -568
  49. package/dist/chunk-UJSIQF3A.js +0 -25
  50. package/dist/chunk-UQY5I3WS.js +0 -253
  51. package/dist/chunk-YCYIUFB4.js +0 -65
  52. package/dist/chunk-Z2KFRHSI.js +0 -77
  53. package/dist/index-Bakx4o8Z.d.cts +0 -91
  54. package/dist/index-Bakx4o8Z.d.ts +0 -91
@@ -0,0 +1,536 @@
1
+ "use client";
2
+ import { i as _objectSpread2, n as useOptDevtoolPlugin } from "./provider-Bn7CAE_Y.js";
3
+ import { t as ISOLATE_STYLE } from "./theme-isolate-F-oX2d4W.js";
4
+ import * as React from "react";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { SHELL_SNAPSHOT_EVENT } from "@reopt-ai/opt-shell";
7
+ //#region src/harness-store.ts
8
+ /**
9
+ * Lightweight external store for harness snapshots + UI state.
10
+ *
11
+ * Module-level singleton — there is one harness snapshot at a time per
12
+ * window, mirroring the assumption that a single ShellProvider tree is
13
+ * active. The store is `useSyncExternalStore`-compatible.
14
+ *
15
+ * The auto-listener wiring is **lazy**: a `SHELL_SNAPSHOT_EVENT` listener
16
+ * is only attached the first time `subscribeShellSnapshot()` is called.
17
+ * Direct callers of `getShellSnapshot()` without a subscription will see
18
+ * `null` until something subscribes. This avoids attaching window listeners
19
+ * during SSR or in test environments that never read the store.
20
+ *
21
+ * For tests, use `__resetShellStore()` to clear all module state between
22
+ * cases.
23
+ */
24
+ let snapshot = null;
25
+ const snapshotListeners = /* @__PURE__ */ new Set();
26
+ function notifySnapshot() {
27
+ snapshotListeners.forEach((fn) => fn());
28
+ }
29
+ /** setShellSnapshot — see usage in callers. */
30
+ function setShellSnapshot(next) {
31
+ snapshot = next;
32
+ notifySnapshot();
33
+ }
34
+ /** clearShellSnapshot — see usage in callers. */
35
+ function clearShellSnapshot() {
36
+ snapshot = null;
37
+ notifySnapshot();
38
+ }
39
+ /** subscribeShellSnapshot — see usage in callers. */
40
+ function subscribeShellSnapshot(cb) {
41
+ initAutoListener();
42
+ snapshotListeners.add(cb);
43
+ return () => snapshotListeners.delete(cb);
44
+ }
45
+ /** getShellSnapshot — see usage in callers. */
46
+ function getShellSnapshot() {
47
+ return snapshot;
48
+ }
49
+ let autoListenerInitialized = false;
50
+ function initAutoListener() {
51
+ if (autoListenerInitialized || typeof window === "undefined") return;
52
+ autoListenerInitialized = true;
53
+ window.addEventListener(SHELL_SNAPSHOT_EVENT, ((e) => {
54
+ const detail = e.detail;
55
+ if (detail) {
56
+ setShellSnapshot(detail.snapshot);
57
+ setShellManagerHref(detail.managerHref);
58
+ } else {
59
+ clearShellSnapshot();
60
+ setShellManagerHref(void 0);
61
+ }
62
+ }));
63
+ }
64
+ let overlayVisible = false;
65
+ const overlayListeners = /* @__PURE__ */ new Set();
66
+ function notifyOverlay() {
67
+ overlayListeners.forEach((fn) => fn());
68
+ }
69
+ /** toggleShellOverlay — see usage in callers. */
70
+ function toggleShellOverlay() {
71
+ overlayVisible = !overlayVisible;
72
+ notifyOverlay();
73
+ }
74
+ /** getShellOverlay — see usage in callers. */
75
+ function getShellOverlay() {
76
+ return overlayVisible;
77
+ }
78
+ /** subscribeShellOverlay — see usage in callers. */
79
+ function subscribeShellOverlay(cb) {
80
+ overlayListeners.add(cb);
81
+ return () => overlayListeners.delete(cb);
82
+ }
83
+ let managerHref;
84
+ /** setShellManagerHref — see usage in callers. */
85
+ function setShellManagerHref(href) {
86
+ managerHref = href;
87
+ }
88
+ /** getShellManagerHref — see usage in callers. */
89
+ function getShellManagerHref() {
90
+ return managerHref;
91
+ }
92
+ //#endregion
93
+ //#region src/harness/index.tsx
94
+ function StatusDot({ active, label }) {
95
+ return /* @__PURE__ */ jsxs("span", {
96
+ className: "inline-flex items-center gap-1",
97
+ children: [/* @__PURE__ */ jsx("span", { className: `inline-block h-1.5 w-1.5 rounded-full ${active ? "bg-emerald-400" : "bg-white/20"}` }), label]
98
+ });
99
+ }
100
+ function CollapsibleSection({ title, color, summary, defaultOpen = true, children }) {
101
+ const [open, setOpen] = React.useState(defaultOpen);
102
+ return /* @__PURE__ */ jsxs("section", { children: [/* @__PURE__ */ jsxs("button", {
103
+ tabIndex: -1,
104
+ onClick: () => setOpen((prev) => !prev),
105
+ className: "flex w-full items-center gap-1.5 text-left",
106
+ children: [
107
+ /* @__PURE__ */ jsx("span", {
108
+ className: `text-[10px] font-semibold ${color}`,
109
+ children: title
110
+ }),
111
+ /* @__PURE__ */ jsx("span", {
112
+ className: "text-[9px] text-white/30",
113
+ children: open ? "▾" : "▸"
114
+ }),
115
+ !open && summary && /* @__PURE__ */ jsx("span", {
116
+ className: "ml-auto truncate text-[9px] text-white/40",
117
+ children: summary
118
+ })
119
+ ]
120
+ }), open && /* @__PURE__ */ jsx("div", {
121
+ className: "mt-1.5",
122
+ children
123
+ })] });
124
+ }
125
+ function ShellDevtoolPanel({ snapshot, showOverlay, onToggleOverlay, managerHref }) {
126
+ if (!snapshot) return /* @__PURE__ */ jsx("div", {
127
+ className: "text-[11px] text-white/55",
128
+ children: "Waiting for Harness snapshot."
129
+ });
130
+ const hasActiveAdapter = snapshot.adapters.datagrid.active || snapshot.adapters.editor.active;
131
+ return /* @__PURE__ */ jsxs("div", {
132
+ className: "flex flex-col gap-3 text-[11px]",
133
+ children: [
134
+ /* @__PURE__ */ jsx("div", {
135
+ className: "mb-2 flex items-center gap-1.5 text-[10px]",
136
+ children: /* @__PURE__ */ jsxs("button", {
137
+ tabIndex: -1,
138
+ onClick: onToggleOverlay,
139
+ className: `rounded px-1.5 py-0.5 text-[10px] transition-colors ${showOverlay ? "bg-amber-600 text-white" : "bg-white/10 text-white/55 hover:text-white/80"}`,
140
+ children: ["슬롯 경계 ", showOverlay ? "ON" : "OFF"]
141
+ })
142
+ }),
143
+ /* @__PURE__ */ jsxs("div", {
144
+ className: "mb-2 flex items-center gap-1.5 text-[10px]",
145
+ children: [/* @__PURE__ */ jsx("span", { className: `inline-block h-1.5 w-1.5 rounded-full ${snapshot.staleness.stale ? "bg-amber-400" : "bg-emerald-400"}` }), /* @__PURE__ */ jsx("span", {
146
+ className: snapshot.staleness.stale ? "text-amber-300" : "text-emerald-300",
147
+ children: snapshot.staleness.stale ? `Stale (${Math.round((Date.now() - snapshot.staleness.capturedAt) / 1e3)}s ago)` : "Fresh"
148
+ })]
149
+ }),
150
+ /* @__PURE__ */ jsxs(CollapsibleSection, {
151
+ title: `Manifest v${snapshot.version}`,
152
+ color: "text-emerald-400",
153
+ summary: `${snapshot.manifestId} · ${snapshot.density} · ${snapshot.contentWidth}`,
154
+ children: [/* @__PURE__ */ jsxs("div", {
155
+ className: "grid grid-cols-2 gap-x-3 gap-y-1 text-[10px] text-white/70",
156
+ children: [
157
+ /* @__PURE__ */ jsxs("div", { children: [
158
+ /* @__PURE__ */ jsx("span", {
159
+ className: "text-white/40",
160
+ children: "ID"
161
+ }),
162
+ " ",
163
+ snapshot.manifestId
164
+ ] }),
165
+ /* @__PURE__ */ jsxs("div", { children: [
166
+ /* @__PURE__ */ jsx("span", {
167
+ className: "text-white/40",
168
+ children: "Label"
169
+ }),
170
+ " ",
171
+ snapshot.manifestLabel
172
+ ] }),
173
+ /* @__PURE__ */ jsxs("div", { children: [
174
+ /* @__PURE__ */ jsx("span", {
175
+ className: "text-white/40",
176
+ children: "Density"
177
+ }),
178
+ " ",
179
+ /* @__PURE__ */ jsx("span", {
180
+ className: "text-emerald-300",
181
+ children: snapshot.density
182
+ })
183
+ ] }),
184
+ /* @__PURE__ */ jsxs("div", { children: [
185
+ /* @__PURE__ */ jsx("span", {
186
+ className: "text-white/40",
187
+ children: "Width"
188
+ }),
189
+ " ",
190
+ /* @__PURE__ */ jsx("span", {
191
+ className: "text-emerald-300",
192
+ children: snapshot.contentWidth
193
+ })
194
+ ] }),
195
+ /* @__PURE__ */ jsxs("div", { children: [
196
+ /* @__PURE__ */ jsx("span", {
197
+ className: "text-white/40",
198
+ children: "Nav"
199
+ }),
200
+ " ",
201
+ snapshot.navigationMode
202
+ ] }),
203
+ /* @__PURE__ */ jsxs("div", { children: [
204
+ /* @__PURE__ */ jsx("span", {
205
+ className: "text-white/40",
206
+ children: "Sticky"
207
+ }),
208
+ " aside",
209
+ " ",
210
+ snapshot.panelBehavior.stickyAside ? "✓" : "—",
211
+ " toolbar",
212
+ " ",
213
+ snapshot.panelBehavior.stickyToolbar ? "✓" : "—"
214
+ ] })
215
+ ]
216
+ }), managerHref && /* @__PURE__ */ jsxs("a", {
217
+ href: `${managerHref}?manifest=${encodeURIComponent(snapshot.manifestId)}`,
218
+ target: "_blank",
219
+ rel: "noopener noreferrer",
220
+ className: "mt-2 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",
221
+ style: { pointerEvents: "auto" },
222
+ children: [/* @__PURE__ */ jsxs("svg", {
223
+ width: "10",
224
+ height: "10",
225
+ viewBox: "0 0 10 10",
226
+ fill: "none",
227
+ stroke: "currentColor",
228
+ strokeWidth: "1.5",
229
+ children: [/* @__PURE__ */ jsx("path", { d: "M4 1H2a1 1 0 00-1 1v6a1 1 0 001 1h6a1 1 0 001-1V6" }), /* @__PURE__ */ jsx("path", { d: "M6 1h3v3M9 1L4.5 5.5" })]
230
+ }), "Harness Manager"]
231
+ })]
232
+ }),
233
+ /* @__PURE__ */ jsx(CollapsibleSection, {
234
+ title: "Boundaries",
235
+ color: "text-emerald-400",
236
+ summary: snapshot.stateBoundary ? `${snapshot.stateBoundary.loading ? "loading" : ""}${snapshot.stateBoundary.empty ? "empty" : ""}${snapshot.stateBoundary.error ? "error" : ""}${!snapshot.stateBoundary.loading && !snapshot.stateBoundary.empty && !snapshot.stateBoundary.error ? "idle" : ""}` : "—",
237
+ defaultOpen: Boolean(snapshot.stateBoundary),
238
+ children: /* @__PURE__ */ jsx("div", {
239
+ className: "text-white/70",
240
+ children: snapshot.stateBoundary ? /* @__PURE__ */ jsxs("div", {
241
+ className: "flex flex-wrap gap-2",
242
+ children: [
243
+ /* @__PURE__ */ jsx(StatusDot, {
244
+ active: snapshot.stateBoundary.loading,
245
+ label: "loading"
246
+ }),
247
+ /* @__PURE__ */ jsx(StatusDot, {
248
+ active: snapshot.stateBoundary.empty,
249
+ label: "empty"
250
+ }),
251
+ /* @__PURE__ */ jsx(StatusDot, {
252
+ active: snapshot.stateBoundary.error,
253
+ label: "error"
254
+ }),
255
+ /* @__PURE__ */ jsxs("span", { children: ["chrome ", snapshot.stateBoundary.chrome] })
256
+ ]
257
+ }) : /* @__PURE__ */ jsx("div", { children: "No active ShellStateBoundary signal." })
258
+ })
259
+ }),
260
+ /* @__PURE__ */ jsx(CollapsibleSection, {
261
+ title: snapshot.diff && !snapshot.diff.empty ? `Changes (v${snapshot.diff.baseVersion} → v${snapshot.diff.headVersion})` : "Changes",
262
+ color: snapshot.diff && !snapshot.diff.empty ? "text-amber-400" : "text-emerald-400",
263
+ summary: snapshot.diff ? snapshot.diff.empty ? "none" : `${snapshot.diff.entries.length} change(s)` : "—",
264
+ defaultOpen: Boolean(snapshot.diff && !snapshot.diff.empty),
265
+ children: snapshot.diff && !snapshot.diff.empty ? /* @__PURE__ */ jsx("div", {
266
+ className: "flex flex-col gap-1 text-[10px] text-white/70",
267
+ children: snapshot.diff.entries.map((entry, i) => /* @__PURE__ */ jsxs("div", {
268
+ className: "flex gap-1",
269
+ children: [
270
+ /* @__PURE__ */ jsxs("span", {
271
+ className: "text-amber-300",
272
+ children: [entry.path, ":"]
273
+ }),
274
+ /* @__PURE__ */ jsx("span", {
275
+ className: "text-red-400/70 line-through",
276
+ children: JSON.stringify(entry.prev)
277
+ }),
278
+ /* @__PURE__ */ jsx("span", {
279
+ className: "text-white/30",
280
+ children: "→"
281
+ }),
282
+ /* @__PURE__ */ jsx("span", {
283
+ className: "text-emerald-400",
284
+ children: JSON.stringify(entry.next)
285
+ })
286
+ ]
287
+ }, i))
288
+ }) : snapshot.diff ? /* @__PURE__ */ jsx("div", {
289
+ className: "text-[10px] text-white/40",
290
+ children: "No changes from previous snapshot"
291
+ }) : /* @__PURE__ */ jsx("div", {
292
+ className: "text-[10px] text-white/40",
293
+ children: "No diff available"
294
+ })
295
+ }),
296
+ /* @__PURE__ */ jsx(CollapsibleSection, {
297
+ title: "Adapters",
298
+ color: "text-emerald-400",
299
+ summary: hasActiveAdapter ? `${snapshot.adapters.datagrid.active ? "DataGrid" : ""}${snapshot.adapters.datagrid.active && snapshot.adapters.editor.active ? " + " : ""}${snapshot.adapters.editor.active ? "Editor" : ""}` : "idle",
300
+ defaultOpen: hasActiveAdapter,
301
+ children: !hasActiveAdapter ? /* @__PURE__ */ jsx("div", {
302
+ className: "text-[10px] text-white/40",
303
+ children: "No active adapters"
304
+ }) : /* @__PURE__ */ jsxs("div", {
305
+ className: "flex flex-col gap-1.5 text-[10px] text-white/70",
306
+ children: [snapshot.adapters.datagrid.active && /* @__PURE__ */ jsxs("div", {
307
+ className: "flex flex-wrap gap-2",
308
+ children: [
309
+ "DataGrid:",
310
+ " ",
311
+ /* @__PURE__ */ jsx(StatusDot, {
312
+ active: snapshot.adapters.datagrid.active,
313
+ label: "active"
314
+ }),
315
+ /* @__PURE__ */ jsxs("span", { children: ["chrome ", snapshot.adapters.datagrid.chrome] }),
316
+ /* @__PURE__ */ jsx(StatusDot, {
317
+ active: snapshot.adapters.datagrid.loading,
318
+ label: "loading"
319
+ }),
320
+ /* @__PURE__ */ jsx(StatusDot, {
321
+ active: snapshot.adapters.datagrid.empty,
322
+ label: "empty"
323
+ }),
324
+ /* @__PURE__ */ jsx(StatusDot, {
325
+ active: snapshot.adapters.datagrid.error,
326
+ label: "error"
327
+ })
328
+ ]
329
+ }), snapshot.adapters.editor.active && /* @__PURE__ */ jsxs("div", {
330
+ className: "flex flex-wrap gap-2",
331
+ children: [
332
+ "Editor:",
333
+ " ",
334
+ /* @__PURE__ */ jsx(StatusDot, {
335
+ active: snapshot.adapters.editor.active,
336
+ label: "active"
337
+ }),
338
+ /* @__PURE__ */ jsxs("span", { children: ["chrome ", snapshot.adapters.editor.chrome] }),
339
+ /* @__PURE__ */ jsx(StatusDot, {
340
+ active: snapshot.adapters.editor.loading,
341
+ label: "loading"
342
+ }),
343
+ /* @__PURE__ */ jsx(StatusDot, {
344
+ active: snapshot.adapters.editor.empty,
345
+ label: "empty"
346
+ }),
347
+ /* @__PURE__ */ jsx(StatusDot, {
348
+ active: snapshot.adapters.editor.error,
349
+ label: "error"
350
+ }),
351
+ /* @__PURE__ */ jsx(StatusDot, {
352
+ active: snapshot.adapters.editor.hasInspector,
353
+ label: "inspector"
354
+ })
355
+ ]
356
+ })]
357
+ })
358
+ })
359
+ ]
360
+ });
361
+ }
362
+ const SLOT_COLORS = {
363
+ header: {
364
+ border: "border-amber-400/60",
365
+ bg: "bg-amber-400/10",
366
+ text: "text-amber-400"
367
+ },
368
+ toolbar: {
369
+ border: "border-blue-400/60",
370
+ bg: "bg-blue-400/10",
371
+ text: "text-blue-400"
372
+ },
373
+ filters: {
374
+ border: "border-purple-400/60",
375
+ bg: "bg-purple-400/10",
376
+ text: "text-purple-400"
377
+ },
378
+ content: {
379
+ border: "border-emerald-400/60",
380
+ bg: "bg-emerald-400/10",
381
+ text: "text-emerald-400"
382
+ },
383
+ aside: {
384
+ border: "border-cyan-400/60",
385
+ bg: "bg-cyan-400/10",
386
+ text: "text-cyan-400"
387
+ },
388
+ footer: {
389
+ border: "border-zinc-400/60",
390
+ bg: "bg-zinc-400/10",
391
+ text: "text-zinc-400"
392
+ }
393
+ };
394
+ const DEFAULT_COLOR = {
395
+ border: "border-white/30",
396
+ bg: "bg-white/5",
397
+ text: "text-white/60"
398
+ };
399
+ function ShellOverlay({ snapshot }) {
400
+ const [slots, setSlots] = React.useState([]);
401
+ const [recipe, setRecipe] = React.useState(null);
402
+ React.useEffect(() => {
403
+ let rafId = 0;
404
+ function scan() {
405
+ const slotEls = document.querySelectorAll("[data-harness-slot]");
406
+ const newSlots = [];
407
+ slotEls.forEach((el) => {
408
+ const rect = el.getBoundingClientRect();
409
+ if (rect.width > 0 && rect.height > 0) {
410
+ var _el$getAttribute;
411
+ newSlots.push({
412
+ name: (_el$getAttribute = el.getAttribute("data-harness-slot")) !== null && _el$getAttribute !== void 0 ? _el$getAttribute : "",
413
+ rect
414
+ });
415
+ }
416
+ });
417
+ setSlots(newSlots);
418
+ const recipeEl = document.querySelector("[data-harness-recipe]");
419
+ if (recipeEl) {
420
+ var _recipeEl$getAttribut;
421
+ const rect = recipeEl.getBoundingClientRect();
422
+ setRecipe({
423
+ name: (_recipeEl$getAttribut = recipeEl.getAttribute("data-harness-recipe")) !== null && _recipeEl$getAttribut !== void 0 ? _recipeEl$getAttribut : "",
424
+ rect
425
+ });
426
+ } else setRecipe(null);
427
+ }
428
+ function debouncedScan() {
429
+ cancelAnimationFrame(rafId);
430
+ rafId = requestAnimationFrame(scan);
431
+ }
432
+ scan();
433
+ const observer = new MutationObserver(debouncedScan);
434
+ observer.observe(document.body, {
435
+ childList: true,
436
+ subtree: true,
437
+ attributes: true
438
+ });
439
+ window.addEventListener("resize", debouncedScan);
440
+ window.addEventListener("scroll", debouncedScan, true);
441
+ return () => {
442
+ observer.disconnect();
443
+ cancelAnimationFrame(rafId);
444
+ window.removeEventListener("resize", debouncedScan);
445
+ window.removeEventListener("scroll", debouncedScan, true);
446
+ };
447
+ }, []);
448
+ if (slots.length === 0 && !recipe) return null;
449
+ return /* @__PURE__ */ jsxs("div", {
450
+ "data-opt-devtool": true,
451
+ style: _objectSpread2(_objectSpread2({}, ISOLATE_STYLE), {}, {
452
+ position: "fixed",
453
+ inset: 0,
454
+ pointerEvents: "none",
455
+ zIndex: 9997
456
+ }),
457
+ children: [recipe && /* @__PURE__ */ jsxs("div", {
458
+ style: {
459
+ position: "absolute",
460
+ left: recipe.rect.left,
461
+ top: recipe.rect.top - 20
462
+ },
463
+ className: "rounded bg-amber-500/90 px-1.5 py-0.5 text-[9px] font-bold text-black",
464
+ children: [
465
+ recipe.name,
466
+ " workspace",
467
+ snapshot ? ` · ${snapshot.density} · ${snapshot.contentWidth}` : ""
468
+ ]
469
+ }), slots.map((slot, i) => {
470
+ var _SLOT_COLORS$slot$nam;
471
+ const colors = (_SLOT_COLORS$slot$nam = SLOT_COLORS[slot.name]) !== null && _SLOT_COLORS$slot$nam !== void 0 ? _SLOT_COLORS$slot$nam : DEFAULT_COLOR;
472
+ return /* @__PURE__ */ jsx("div", {
473
+ style: {
474
+ position: "absolute",
475
+ left: slot.rect.left,
476
+ top: slot.rect.top,
477
+ width: slot.rect.width,
478
+ height: slot.rect.height
479
+ },
480
+ className: `border ${colors.border} ${colors.bg} rounded-sm`,
481
+ children: /* @__PURE__ */ jsx("span", {
482
+ className: `absolute -top-3.5 left-1 rounded px-1 py-0 text-[8px] font-semibold ${colors.text}`,
483
+ style: { backgroundColor: "rgba(0,0,0,0.8)" },
484
+ children: slot.name
485
+ })
486
+ }, `${slot.name}-${i}`);
487
+ })]
488
+ });
489
+ }
490
+ /**
491
+ * Register the harness devtool bridge.
492
+ *
493
+ * Note on the snapshot wiring (intentional asymmetry vs the editor /
494
+ * datagrid / theme bridges): harness state is mirrored into the shared
495
+ * `harness-store` module singleton in addition to local hook state.
496
+ * `<OptDevtool>` itself reads the store directly so it can render the
497
+ * harness *overlay* outside the panel chrome, even when the panel is on a
498
+ * different tab. The other bridges only render inside their tab and so can
499
+ * keep their snapshot fully local.
500
+ */
501
+ function useShellDevtoolBridge({ id, label, order = 10, managerHref }) {
502
+ const [snapshot, setSnapshot] = React.useState(null);
503
+ const [showOverlay, setShowOverlay] = React.useState(false);
504
+ const inspect = React.useCallback((nextSnapshot) => {
505
+ setSnapshot(nextSnapshot);
506
+ setShellSnapshot(nextSnapshot);
507
+ }, []);
508
+ React.useEffect(() => {
509
+ setShellManagerHref(managerHref);
510
+ return () => {
511
+ clearShellSnapshot();
512
+ setShellManagerHref(void 0);
513
+ };
514
+ }, [managerHref]);
515
+ useOptDevtoolPlugin(React.useMemo(() => ({
516
+ id,
517
+ label,
518
+ order,
519
+ renderPanel: () => /* @__PURE__ */ jsx(ShellDevtoolPanel, {
520
+ snapshot,
521
+ showOverlay,
522
+ onToggleOverlay: () => setShowOverlay((prev) => !prev),
523
+ managerHref
524
+ }),
525
+ renderOverlay: () => showOverlay ? /* @__PURE__ */ jsx(ShellOverlay, { snapshot }) : null
526
+ }), [
527
+ id,
528
+ label,
529
+ order,
530
+ snapshot,
531
+ showOverlay
532
+ ]));
533
+ return { inspect };
534
+ }
535
+ //#endregion
536
+ export { getShellSnapshot as a, toggleShellOverlay as c, getShellOverlay as i, useShellDevtoolBridge as n, subscribeShellOverlay as o, getShellManagerHref as r, subscribeShellSnapshot as s, ShellOverlay as t };