@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
@@ -1,568 +0,0 @@
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
- var _chunkEQPETYJJcjs = require('./chunk-EQPETYJJ.cjs');
5
-
6
-
7
- var _chunk6AGUYGVTcjs = require('./chunk-6AGUYGVT.cjs');
8
-
9
-
10
-
11
- var _chunkN7YO56TNcjs = require('./chunk-N7YO56TN.cjs');
12
-
13
- // src/harness/index.tsx
14
- var _react = require('react'); var React = _interopRequireWildcard(_react);
15
-
16
- // src/harness-store.ts
17
-
18
-
19
- var _optshell = require('@reopt-ai/opt-shell');
20
- var snapshot = null;
21
- var snapshotListeners = /* @__PURE__ */ new Set();
22
- function notifySnapshot() {
23
- snapshotListeners.forEach((fn) => fn());
24
- }
25
- function setShellSnapshot(next) {
26
- snapshot = next;
27
- notifySnapshot();
28
- }
29
- function clearShellSnapshot() {
30
- snapshot = null;
31
- notifySnapshot();
32
- }
33
- function subscribeShellSnapshot(cb) {
34
- initAutoListener();
35
- snapshotListeners.add(cb);
36
- return () => snapshotListeners.delete(cb);
37
- }
38
- function getShellSnapshot() {
39
- return snapshot;
40
- }
41
- var autoListenerInitialized = false;
42
- function initAutoListener() {
43
- if (autoListenerInitialized || typeof window === "undefined") return;
44
- autoListenerInitialized = true;
45
- window.addEventListener(_optshell.SHELL_SNAPSHOT_EVENT, ((e) => {
46
- const detail = e.detail;
47
- if (detail) {
48
- setShellSnapshot(detail.snapshot);
49
- setShellManagerHref(detail.managerHref);
50
- } else {
51
- clearShellSnapshot();
52
- setShellManagerHref(void 0);
53
- }
54
- }));
55
- }
56
- var overlayVisible = false;
57
- var overlayListeners = /* @__PURE__ */ new Set();
58
- function notifyOverlay() {
59
- overlayListeners.forEach((fn) => fn());
60
- }
61
- function toggleShellOverlay() {
62
- overlayVisible = !overlayVisible;
63
- notifyOverlay();
64
- }
65
- function getShellOverlay() {
66
- return overlayVisible;
67
- }
68
- function subscribeShellOverlay(cb) {
69
- overlayListeners.add(cb);
70
- return () => overlayListeners.delete(cb);
71
- }
72
- var managerHref;
73
- function setShellManagerHref(href) {
74
- managerHref = href;
75
- }
76
- function getShellManagerHref() {
77
- return managerHref;
78
- }
79
-
80
- // src/harness/index.tsx
81
- var _jsxruntime = require('react/jsx-runtime');
82
- function StatusDot({ active, label }) {
83
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "inline-flex items-center gap-1", children: [
84
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
85
- "span",
86
- {
87
- className: `inline-block h-1.5 w-1.5 rounded-full ${active ? "bg-emerald-400" : "bg-white/20"}`
88
- }
89
- ),
90
- label
91
- ] });
92
- }
93
- function CollapsibleSection({
94
- title,
95
- color,
96
- summary,
97
- defaultOpen = true,
98
- children
99
- }) {
100
- const [open, setOpen] = React.useState(defaultOpen);
101
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { children: [
102
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
103
- "button",
104
- {
105
- tabIndex: -1,
106
- onClick: () => setOpen((prev) => !prev),
107
- className: "flex w-full items-center gap-1.5 text-left",
108
- children: [
109
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `text-[10px] font-semibold ${color}`, children: title }),
110
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-[9px] text-white/30", children: open ? "\u25BE" : "\u25B8" }),
111
- !open && summary && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "ml-auto truncate text-[9px] text-white/40", children: summary })
112
- ]
113
- }
114
- ),
115
- open && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mt-1.5", children })
116
- ] });
117
- }
118
- function ShellDevtoolPanel({
119
- snapshot: snapshot2,
120
- showOverlay,
121
- onToggleOverlay,
122
- managerHref: managerHref2
123
- }) {
124
- if (!snapshot2) {
125
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-[11px] text-white/55", children: "Waiting for Harness snapshot." });
126
- }
127
- const hasActiveAdapter = snapshot2.adapters.datagrid.active || snapshot2.adapters.editor.active;
128
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-3 text-[11px]", children: [
129
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mb-2 flex items-center gap-1.5 text-[10px]", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
130
- "button",
131
- {
132
- tabIndex: -1,
133
- onClick: onToggleOverlay,
134
- 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"}`,
135
- children: [
136
- "\uC2AC\uB86F \uACBD\uACC4 ",
137
- showOverlay ? "ON" : "OFF"
138
- ]
139
- }
140
- ) }),
141
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-2 flex items-center gap-1.5 text-[10px]", children: [
142
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
143
- "span",
144
- {
145
- className: `inline-block h-1.5 w-1.5 rounded-full ${snapshot2.staleness.stale ? "bg-amber-400" : "bg-emerald-400"}`
146
- }
147
- ),
148
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
149
- "span",
150
- {
151
- className: snapshot2.staleness.stale ? "text-amber-300" : "text-emerald-300",
152
- children: snapshot2.staleness.stale ? `Stale (${Math.round((Date.now() - snapshot2.staleness.capturedAt) / 1e3)}s ago)` : "Fresh"
153
- }
154
- )
155
- ] }),
156
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
157
- CollapsibleSection,
158
- {
159
- title: `Manifest v${snapshot2.version}`,
160
- color: "text-emerald-400",
161
- summary: `${snapshot2.manifestId} \xB7 ${snapshot2.density} \xB7 ${snapshot2.contentWidth}`,
162
- children: [
163
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-3 gap-y-1 text-[10px] text-white/70", children: [
164
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
165
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-white/40", children: "ID" }),
166
- " ",
167
- snapshot2.manifestId
168
- ] }),
169
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
170
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-white/40", children: "Label" }),
171
- " ",
172
- snapshot2.manifestLabel
173
- ] }),
174
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
175
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-white/40", children: "Density" }),
176
- " ",
177
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-emerald-300", children: snapshot2.density })
178
- ] }),
179
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
180
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-white/40", children: "Width" }),
181
- " ",
182
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-emerald-300", children: snapshot2.contentWidth })
183
- ] }),
184
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
185
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-white/40", children: "Nav" }),
186
- " ",
187
- snapshot2.navigationMode
188
- ] }),
189
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
190
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-white/40", children: "Sticky" }),
191
- " aside",
192
- " ",
193
- snapshot2.panelBehavior.stickyAside ? "\u2713" : "\u2014",
194
- " toolbar",
195
- " ",
196
- snapshot2.panelBehavior.stickyToolbar ? "\u2713" : "\u2014"
197
- ] })
198
- ] }),
199
- managerHref2 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
200
- "a",
201
- {
202
- href: `${managerHref2}?manifest=${encodeURIComponent(snapshot2.manifestId)}`,
203
- target: "_blank",
204
- rel: "noopener noreferrer",
205
- 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",
206
- style: { pointerEvents: "auto" },
207
- children: [
208
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
209
- "svg",
210
- {
211
- width: "10",
212
- height: "10",
213
- viewBox: "0 0 10 10",
214
- fill: "none",
215
- stroke: "currentColor",
216
- strokeWidth: "1.5",
217
- children: [
218
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M4 1H2a1 1 0 00-1 1v6a1 1 0 001 1h6a1 1 0 001-1V6" }),
219
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M6 1h3v3M9 1L4.5 5.5" })
220
- ]
221
- }
222
- ),
223
- "Harness Manager"
224
- ]
225
- }
226
- )
227
- ]
228
- }
229
- ),
230
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
231
- CollapsibleSection,
232
- {
233
- title: "Boundaries",
234
- color: "text-emerald-400",
235
- summary: snapshot2.stateBoundary ? `${snapshot2.stateBoundary.loading ? "loading" : ""}${snapshot2.stateBoundary.empty ? "empty" : ""}${snapshot2.stateBoundary.error ? "error" : ""}${!snapshot2.stateBoundary.loading && !snapshot2.stateBoundary.empty && !snapshot2.stateBoundary.error ? "idle" : ""}` : "\u2014",
236
- defaultOpen: Boolean(snapshot2.stateBoundary),
237
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-white/70", children: snapshot2.stateBoundary ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2", children: [
238
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
239
- StatusDot,
240
- {
241
- active: snapshot2.stateBoundary.loading,
242
- label: "loading"
243
- }
244
- ),
245
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, StatusDot, { active: snapshot2.stateBoundary.empty, label: "empty" }),
246
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, StatusDot, { active: snapshot2.stateBoundary.error, label: "error" }),
247
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { children: [
248
- "chrome ",
249
- snapshot2.stateBoundary.chrome
250
- ] })
251
- ] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: "No active ShellStateBoundary signal." }) })
252
- }
253
- ),
254
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
255
- CollapsibleSection,
256
- {
257
- title: snapshot2.diff && !snapshot2.diff.empty ? `Changes (v${snapshot2.diff.baseVersion} \u2192 v${snapshot2.diff.headVersion})` : "Changes",
258
- color: snapshot2.diff && !snapshot2.diff.empty ? "text-amber-400" : "text-emerald-400",
259
- summary: snapshot2.diff ? snapshot2.diff.empty ? "none" : `${snapshot2.diff.entries.length} change(s)` : "\u2014",
260
- defaultOpen: Boolean(snapshot2.diff && !snapshot2.diff.empty),
261
- children: snapshot2.diff && !snapshot2.diff.empty ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex flex-col gap-1 text-[10px] text-white/70", children: snapshot2.diff.entries.map((entry, i) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-1", children: [
262
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-amber-300", children: [
263
- entry.path,
264
- ":"
265
- ] }),
266
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-red-400/70 line-through", children: JSON.stringify(entry.prev) }),
267
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-white/30", children: "\u2192" }),
268
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-emerald-400", children: JSON.stringify(entry.next) })
269
- ] }, i)) }) : snapshot2.diff ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-[10px] text-white/40", children: "No changes from previous snapshot" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-[10px] text-white/40", children: "No diff available" })
270
- }
271
- ),
272
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
273
- CollapsibleSection,
274
- {
275
- title: "Adapters",
276
- color: "text-emerald-400",
277
- summary: hasActiveAdapter ? `${snapshot2.adapters.datagrid.active ? "DataGrid" : ""}${snapshot2.adapters.datagrid.active && snapshot2.adapters.editor.active ? " + " : ""}${snapshot2.adapters.editor.active ? "Editor" : ""}` : "idle",
278
- defaultOpen: hasActiveAdapter,
279
- children: !hasActiveAdapter ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-[10px] text-white/40", children: "No active adapters" }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-1.5 text-[10px] text-white/70", children: [
280
- snapshot2.adapters.datagrid.active && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2", children: [
281
- "DataGrid:",
282
- " ",
283
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
284
- StatusDot,
285
- {
286
- active: snapshot2.adapters.datagrid.active,
287
- label: "active"
288
- }
289
- ),
290
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { children: [
291
- "chrome ",
292
- snapshot2.adapters.datagrid.chrome
293
- ] }),
294
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
295
- StatusDot,
296
- {
297
- active: snapshot2.adapters.datagrid.loading,
298
- label: "loading"
299
- }
300
- ),
301
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
302
- StatusDot,
303
- {
304
- active: snapshot2.adapters.datagrid.empty,
305
- label: "empty"
306
- }
307
- ),
308
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
309
- StatusDot,
310
- {
311
- active: snapshot2.adapters.datagrid.error,
312
- label: "error"
313
- }
314
- )
315
- ] }),
316
- snapshot2.adapters.editor.active && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2", children: [
317
- "Editor:",
318
- " ",
319
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
320
- StatusDot,
321
- {
322
- active: snapshot2.adapters.editor.active,
323
- label: "active"
324
- }
325
- ),
326
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { children: [
327
- "chrome ",
328
- snapshot2.adapters.editor.chrome
329
- ] }),
330
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
331
- StatusDot,
332
- {
333
- active: snapshot2.adapters.editor.loading,
334
- label: "loading"
335
- }
336
- ),
337
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
338
- StatusDot,
339
- {
340
- active: snapshot2.adapters.editor.empty,
341
- label: "empty"
342
- }
343
- ),
344
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
345
- StatusDot,
346
- {
347
- active: snapshot2.adapters.editor.error,
348
- label: "error"
349
- }
350
- ),
351
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
352
- StatusDot,
353
- {
354
- active: snapshot2.adapters.editor.hasInspector,
355
- label: "inspector"
356
- }
357
- )
358
- ] })
359
- ] })
360
- }
361
- )
362
- ] });
363
- }
364
- var SLOT_COLORS = {
365
- header: {
366
- border: "border-amber-400/60",
367
- bg: "bg-amber-400/10",
368
- text: "text-amber-400"
369
- },
370
- toolbar: {
371
- border: "border-blue-400/60",
372
- bg: "bg-blue-400/10",
373
- text: "text-blue-400"
374
- },
375
- filters: {
376
- border: "border-purple-400/60",
377
- bg: "bg-purple-400/10",
378
- text: "text-purple-400"
379
- },
380
- content: {
381
- border: "border-emerald-400/60",
382
- bg: "bg-emerald-400/10",
383
- text: "text-emerald-400"
384
- },
385
- aside: {
386
- border: "border-cyan-400/60",
387
- bg: "bg-cyan-400/10",
388
- text: "text-cyan-400"
389
- },
390
- footer: {
391
- border: "border-zinc-400/60",
392
- bg: "bg-zinc-400/10",
393
- text: "text-zinc-400"
394
- }
395
- };
396
- var DEFAULT_COLOR = {
397
- border: "border-white/30",
398
- bg: "bg-white/5",
399
- text: "text-white/60"
400
- };
401
- function ShellOverlay({
402
- snapshot: snapshot2
403
- }) {
404
- const [slots, setSlots] = React.useState(
405
- []
406
- );
407
- const [recipe, setRecipe] = React.useState(null);
408
- React.useEffect(() => {
409
- let rafId = 0;
410
- function scan() {
411
- var _a;
412
- const slotEls = document.querySelectorAll("[data-harness-slot]");
413
- const newSlots = [];
414
- slotEls.forEach((el) => {
415
- var _a2;
416
- const rect = el.getBoundingClientRect();
417
- if (rect.width > 0 && rect.height > 0) {
418
- newSlots.push({
419
- name: (_a2 = el.getAttribute("data-harness-slot")) != null ? _a2 : "",
420
- rect
421
- });
422
- }
423
- });
424
- setSlots(newSlots);
425
- const recipeEl = document.querySelector("[data-harness-recipe]");
426
- if (recipeEl) {
427
- const rect = recipeEl.getBoundingClientRect();
428
- setRecipe({
429
- name: (_a = recipeEl.getAttribute("data-harness-recipe")) != null ? _a : "",
430
- rect
431
- });
432
- } else {
433
- setRecipe(null);
434
- }
435
- }
436
- function debouncedScan() {
437
- cancelAnimationFrame(rafId);
438
- rafId = requestAnimationFrame(scan);
439
- }
440
- scan();
441
- const observer = new MutationObserver(debouncedScan);
442
- observer.observe(document.body, {
443
- childList: true,
444
- subtree: true,
445
- attributes: true
446
- });
447
- window.addEventListener("resize", debouncedScan);
448
- window.addEventListener("scroll", debouncedScan, true);
449
- return () => {
450
- observer.disconnect();
451
- cancelAnimationFrame(rafId);
452
- window.removeEventListener("resize", debouncedScan);
453
- window.removeEventListener("scroll", debouncedScan, true);
454
- };
455
- }, []);
456
- if (slots.length === 0 && !recipe) return null;
457
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
458
- "div",
459
- {
460
- "data-opt-devtool": true,
461
- style: _chunkN7YO56TNcjs.__spreadProps.call(void 0, _chunkN7YO56TNcjs.__spreadValues.call(void 0, {}, _chunkEQPETYJJcjs.ISOLATE_STYLE), {
462
- position: "fixed",
463
- inset: 0,
464
- pointerEvents: "none",
465
- zIndex: 9997
466
- }),
467
- children: [
468
- recipe && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
469
- "div",
470
- {
471
- style: {
472
- position: "absolute",
473
- left: recipe.rect.left,
474
- top: recipe.rect.top - 20
475
- },
476
- className: "rounded bg-amber-500/90 px-1.5 py-0.5 text-[9px] font-bold text-black",
477
- children: [
478
- recipe.name,
479
- " workspace",
480
- snapshot2 ? ` \xB7 ${snapshot2.density} \xB7 ${snapshot2.contentWidth}` : ""
481
- ]
482
- }
483
- ),
484
- slots.map((slot, i) => {
485
- var _a;
486
- const colors = (_a = SLOT_COLORS[slot.name]) != null ? _a : DEFAULT_COLOR;
487
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
488
- "div",
489
- {
490
- style: {
491
- position: "absolute",
492
- left: slot.rect.left,
493
- top: slot.rect.top,
494
- width: slot.rect.width,
495
- height: slot.rect.height
496
- },
497
- className: `border ${colors.border} ${colors.bg} rounded-sm`,
498
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
499
- "span",
500
- {
501
- className: `absolute -top-3.5 left-1 rounded px-1 py-0 text-[8px] font-semibold ${colors.text}`,
502
- style: { backgroundColor: "rgba(0,0,0,0.8)" },
503
- children: slot.name
504
- }
505
- )
506
- },
507
- `${slot.name}-${i}`
508
- );
509
- })
510
- ]
511
- }
512
- );
513
- }
514
- function useShellDevtoolBridge({
515
- id,
516
- label,
517
- order = 10,
518
- managerHref: managerHref2
519
- }) {
520
- const [snapshot2, setSnapshot] = React.useState(
521
- null
522
- );
523
- const [showOverlay, setShowOverlay] = React.useState(false);
524
- const inspect = React.useCallback((nextSnapshot) => {
525
- setSnapshot(nextSnapshot);
526
- setShellSnapshot(nextSnapshot);
527
- }, []);
528
- React.useEffect(() => {
529
- setShellManagerHref(managerHref2);
530
- return () => {
531
- clearShellSnapshot();
532
- setShellManagerHref(void 0);
533
- };
534
- }, [managerHref2]);
535
- const plugin = React.useMemo(
536
- () => ({
537
- id,
538
- label,
539
- order,
540
- renderPanel: () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
541
- ShellDevtoolPanel,
542
- {
543
- snapshot: snapshot2,
544
- showOverlay,
545
- onToggleOverlay: () => setShowOverlay((prev) => !prev),
546
- managerHref: managerHref2
547
- }
548
- ),
549
- renderOverlay: () => showOverlay ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ShellOverlay, { snapshot: snapshot2 }) : null
550
- }),
551
- [id, label, order, snapshot2, showOverlay]
552
- );
553
- _chunk6AGUYGVTcjs.useOptDevtoolPlugin.call(void 0, plugin);
554
- return {
555
- inspect
556
- };
557
- }
558
-
559
-
560
-
561
-
562
-
563
-
564
-
565
-
566
-
567
-
568
- exports.subscribeShellSnapshot = subscribeShellSnapshot; exports.getShellSnapshot = getShellSnapshot; exports.toggleShellOverlay = toggleShellOverlay; exports.getShellOverlay = getShellOverlay; exports.subscribeShellOverlay = subscribeShellOverlay; exports.getShellManagerHref = getShellManagerHref; exports.ShellOverlay = ShellOverlay; exports.useShellDevtoolBridge = useShellDevtoolBridge;
@@ -1,25 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
- var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
- var __spreadValues = (a, b) => {
10
- for (var prop in b || (b = {}))
11
- if (__hasOwnProp.call(b, prop))
12
- __defNormalProp(a, prop, b[prop]);
13
- if (__getOwnPropSymbols)
14
- for (var prop of __getOwnPropSymbols(b)) {
15
- if (__propIsEnum.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- }
18
- return a;
19
- };
20
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
-
22
-
23
-
24
-
25
- exports.__spreadValues = __spreadValues; exports.__spreadProps = __spreadProps;