react-devbelt 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/NOTICE +16 -0
- package/README.md +292 -2
- package/dist/announce-6XECDMRI.js +12 -0
- package/dist/announce-6XECDMRI.js.map +1 -0
- package/dist/chunk-3SXZJ6OP.js +65 -0
- package/dist/chunk-3SXZJ6OP.js.map +1 -0
- package/dist/chunk-63DO3YVL.js +330 -0
- package/dist/chunk-63DO3YVL.js.map +1 -0
- package/dist/chunk-6PAFI4BJ.js +14615 -0
- package/dist/chunk-6PAFI4BJ.js.map +1 -0
- package/dist/chunk-7JLNVGRQ.js +164 -0
- package/dist/chunk-7JLNVGRQ.js.map +1 -0
- package/dist/chunk-C7RMX5PF.js +57 -0
- package/dist/chunk-C7RMX5PF.js.map +1 -0
- package/dist/chunk-GNJF3UHO.js +1030 -0
- package/dist/chunk-GNJF3UHO.js.map +1 -0
- package/dist/chunk-PRTINXUT.js +105 -0
- package/dist/chunk-PRTINXUT.js.map +1 -0
- package/dist/chunk-QRXHNBFY.js +22 -0
- package/dist/chunk-QRXHNBFY.js.map +1 -0
- package/dist/chunk-QT3YSHQA.js +18 -0
- package/dist/chunk-QT3YSHQA.js.map +1 -0
- package/dist/chunk-UBSHMGMV.js +8016 -0
- package/dist/chunk-UBSHMGMV.js.map +1 -0
- package/dist/context-D2euxPc4.d.ts +6 -0
- package/dist/core.d.ts +266 -0
- package/dist/core.js +1070 -0
- package/dist/core.js.map +1 -0
- package/dist/findable-rows-UQBKFZ45.js +356 -0
- package/dist/findable-rows-UQBKFZ45.js.map +1 -0
- package/dist/index.d.ts +57 -0
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -0
- package/dist/install.d.ts +2 -0
- package/dist/install.js +21 -0
- package/dist/install.js.map +1 -0
- package/dist/next.d.ts +18 -0
- package/dist/next.js +13 -0
- package/dist/next.js.map +1 -0
- package/dist/plugin-C8VytW9X.d.ts +162 -0
- package/dist/plugins.d.ts +118 -0
- package/dist/plugins.js +36 -0
- package/dist/plugins.js.map +1 -0
- package/dist/sheet-presentation-S6GGOKMB.js +2667 -0
- package/dist/sheet-presentation-S6GGOKMB.js.map +1 -0
- package/dist/styles.css +2 -0
- package/dist/toolbar-entry-XIOWCGBL.js +1685 -0
- package/dist/toolbar-entry-XIOWCGBL.js.map +1 -0
- package/dist/ui.d.ts +37 -0
- package/dist/ui.js +126 -0
- package/dist/ui.js.map +1 -0
- package/licenses/motion-MIT.txt +21 -0
- package/licenses/ui-sdk-APACHE-2.0.txt +202 -0
- package/package.json +115 -3
|
@@ -0,0 +1,1685 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import {
|
|
4
|
+
installPlugins
|
|
5
|
+
} from "./chunk-C7RMX5PF.js";
|
|
6
|
+
import {
|
|
7
|
+
COLLAPSE_EVENT,
|
|
8
|
+
COLLAPSE_SHORTCUT,
|
|
9
|
+
FluidHoverHighlight,
|
|
10
|
+
HIDE_EVENT,
|
|
11
|
+
Menu,
|
|
12
|
+
MenuContent,
|
|
13
|
+
MenuContextTrigger,
|
|
14
|
+
MenuGroup,
|
|
15
|
+
MenuGroupLabel,
|
|
16
|
+
MenuHighlight,
|
|
17
|
+
MenuItem,
|
|
18
|
+
MenuSeparator,
|
|
19
|
+
MoreMenu,
|
|
20
|
+
Toolbar,
|
|
21
|
+
ToolbarButton,
|
|
22
|
+
ToolbarSeparator,
|
|
23
|
+
collapseLabel,
|
|
24
|
+
defaultAiTools,
|
|
25
|
+
defaultPlugins,
|
|
26
|
+
exposedAgentTools,
|
|
27
|
+
forwardToTop,
|
|
28
|
+
hideLabel,
|
|
29
|
+
installToolbarShortcuts,
|
|
30
|
+
menuContentClass,
|
|
31
|
+
menuIconClass,
|
|
32
|
+
menuItemClass,
|
|
33
|
+
menuLabelClass,
|
|
34
|
+
menuSeparatorClass,
|
|
35
|
+
readJson,
|
|
36
|
+
readString,
|
|
37
|
+
registerAgentTools,
|
|
38
|
+
spring,
|
|
39
|
+
writeJson,
|
|
40
|
+
writeString
|
|
41
|
+
} from "./chunk-UBSHMGMV.js";
|
|
42
|
+
import "./chunk-QRXHNBFY.js";
|
|
43
|
+
import {
|
|
44
|
+
Button,
|
|
45
|
+
MorphText,
|
|
46
|
+
Popover,
|
|
47
|
+
PopoverClose,
|
|
48
|
+
PopoverContent,
|
|
49
|
+
PopoverTitle,
|
|
50
|
+
Toggle,
|
|
51
|
+
Tooltip,
|
|
52
|
+
TooltipContent,
|
|
53
|
+
TooltipTrigger,
|
|
54
|
+
ariaKeyshortcuts,
|
|
55
|
+
iconButtonClass,
|
|
56
|
+
kbdClass,
|
|
57
|
+
toolbarItemClass,
|
|
58
|
+
tooltipClass
|
|
59
|
+
} from "./chunk-6PAFI4BJ.js";
|
|
60
|
+
import {
|
|
61
|
+
ToolbarContext
|
|
62
|
+
} from "./chunk-QT3YSHQA.js";
|
|
63
|
+
import "./chunk-3SXZJ6OP.js";
|
|
64
|
+
import "./chunk-GNJF3UHO.js";
|
|
65
|
+
import "./chunk-PRTINXUT.js";
|
|
66
|
+
import {
|
|
67
|
+
bindDrag
|
|
68
|
+
} from "./chunk-63DO3YVL.js";
|
|
69
|
+
import "./chunk-7JLNVGRQ.js";
|
|
70
|
+
|
|
71
|
+
// src/ui/toolbar-entry.tsx
|
|
72
|
+
import { useMemo as useMemo3 } from "react";
|
|
73
|
+
|
|
74
|
+
// src/ui/toolbar.tsx
|
|
75
|
+
import {
|
|
76
|
+
useEffect as useEffect5,
|
|
77
|
+
useMemo as useMemo2,
|
|
78
|
+
useRef as useRef5,
|
|
79
|
+
useState as useState6
|
|
80
|
+
} from "react";
|
|
81
|
+
import { MotionConfig, motion } from "motion/react";
|
|
82
|
+
import { ChevronDownIcon, GripVerticalIcon } from "lucide-react";
|
|
83
|
+
|
|
84
|
+
// src/ui/default-item.tsx
|
|
85
|
+
import { useState } from "react";
|
|
86
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
87
|
+
var FLASH_MS = 1500;
|
|
88
|
+
function DefaultItem({
|
|
89
|
+
plugin,
|
|
90
|
+
open,
|
|
91
|
+
onToggle,
|
|
92
|
+
api
|
|
93
|
+
}) {
|
|
94
|
+
const [flash, setFlash] = useState(null);
|
|
95
|
+
const label = plugin.label ?? plugin.name;
|
|
96
|
+
const { Badge, Hint } = plugin;
|
|
97
|
+
if (plugin.window) {
|
|
98
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
99
|
+
/* @__PURE__ */ jsxs(
|
|
100
|
+
TooltipTrigger,
|
|
101
|
+
{
|
|
102
|
+
render: /* @__PURE__ */ jsx(
|
|
103
|
+
Toggle,
|
|
104
|
+
{
|
|
105
|
+
"aria-label": label,
|
|
106
|
+
"data-devbelt-item": plugin.id,
|
|
107
|
+
pressed: open,
|
|
108
|
+
onPressedChange: onToggle
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
className: `${toolbarItemClass} data-pressed:bg-pressed`,
|
|
112
|
+
children: [
|
|
113
|
+
plugin.icon,
|
|
114
|
+
Badge ? /* @__PURE__ */ jsx(Badge, {}) : null
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
),
|
|
118
|
+
/* @__PURE__ */ jsxs(TooltipContent, { side: "top", sideOffset: 8, className: tooltipClass, children: [
|
|
119
|
+
plugin.window.title ?? plugin.name,
|
|
120
|
+
Hint ? /* @__PURE__ */ jsx(Hint, {}) : null
|
|
121
|
+
] })
|
|
122
|
+
] });
|
|
123
|
+
}
|
|
124
|
+
if (plugin.run) {
|
|
125
|
+
const run = plugin.run;
|
|
126
|
+
const onClick = async () => {
|
|
127
|
+
let result;
|
|
128
|
+
try {
|
|
129
|
+
result = await run(api);
|
|
130
|
+
} catch {
|
|
131
|
+
result = "Failed";
|
|
132
|
+
}
|
|
133
|
+
if (typeof result === "string") {
|
|
134
|
+
setFlash(result);
|
|
135
|
+
window.setTimeout(() => setFlash(null), FLASH_MS);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
139
|
+
/* @__PURE__ */ jsxs(
|
|
140
|
+
TooltipTrigger,
|
|
141
|
+
{
|
|
142
|
+
render: /* @__PURE__ */ jsx(ToolbarButton, { "aria-label": label, onClick }),
|
|
143
|
+
className: toolbarItemClass,
|
|
144
|
+
children: [
|
|
145
|
+
plugin.icon,
|
|
146
|
+
flash ? /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(MorphText, { children: flash }) }) : null,
|
|
147
|
+
Badge ? /* @__PURE__ */ jsx(Badge, {}) : null
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
),
|
|
151
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "top", sideOffset: 8, className: tooltipClass, children: plugin.description ?? plugin.name })
|
|
152
|
+
] });
|
|
153
|
+
}
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// src/ui/floating-window.tsx
|
|
158
|
+
import { XIcon } from "lucide-react";
|
|
159
|
+
import { useEffect, useRef } from "react";
|
|
160
|
+
|
|
161
|
+
// src/ui/use-dev-layout.ts
|
|
162
|
+
import { useState as useState2 } from "react";
|
|
163
|
+
var isPanelMode = (value) => value === "window" || value === "popover";
|
|
164
|
+
var STORAGE_KEY = "layout";
|
|
165
|
+
var MARGIN = 8;
|
|
166
|
+
var KEEP_VISIBLE = 96;
|
|
167
|
+
var CASCADE = 28;
|
|
168
|
+
var DEFAULT_LAYOUT = { pinned: {}, open: [], rects: {} };
|
|
169
|
+
function isRect(value) {
|
|
170
|
+
const r = value;
|
|
171
|
+
return !!r && [r.x, r.y, r.width, r.height].every(
|
|
172
|
+
(n) => typeof n === "number" && Number.isFinite(n)
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
function read(windows) {
|
|
176
|
+
const parsed = readJson(STORAGE_KEY, null);
|
|
177
|
+
if (!parsed || typeof parsed !== "object") return DEFAULT_LAYOUT;
|
|
178
|
+
const rects = {};
|
|
179
|
+
for (const [id, rect] of Object.entries(parsed.rects ?? {})) {
|
|
180
|
+
if (windows.has(id) && isRect(rect)) rects[id] = rect;
|
|
181
|
+
}
|
|
182
|
+
const pinned = {};
|
|
183
|
+
for (const [id, value] of Object.entries(parsed.pinned ?? {})) {
|
|
184
|
+
if (typeof value === "boolean") pinned[id] = value;
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
pinned,
|
|
188
|
+
open: Array.isArray(parsed.open) ? parsed.open.filter((id) => windows.has(id)) : [],
|
|
189
|
+
rects,
|
|
190
|
+
...isPanelMode(parsed.mode) ? { mode: parsed.mode } : {}
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function clampRect(size, rect) {
|
|
194
|
+
const { minWidth, minHeight } = size;
|
|
195
|
+
const width = Math.min(
|
|
196
|
+
Math.max(rect.width, minWidth),
|
|
197
|
+
window.innerWidth - MARGIN * 2
|
|
198
|
+
);
|
|
199
|
+
const height = Math.min(
|
|
200
|
+
Math.max(rect.height, minHeight),
|
|
201
|
+
window.innerHeight - MARGIN * 2
|
|
202
|
+
);
|
|
203
|
+
return {
|
|
204
|
+
width,
|
|
205
|
+
height,
|
|
206
|
+
x: Math.min(
|
|
207
|
+
Math.max(rect.x, KEEP_VISIBLE - width),
|
|
208
|
+
window.innerWidth - KEEP_VISIBLE
|
|
209
|
+
),
|
|
210
|
+
y: Math.min(Math.max(rect.y, 0), window.innerHeight - 40)
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
function defaultRect(size, index) {
|
|
214
|
+
const width = Math.min(size.width, window.innerWidth - MARGIN * 2);
|
|
215
|
+
const height = Math.min(size.height, window.innerHeight - 120);
|
|
216
|
+
return clampRect(size, {
|
|
217
|
+
width,
|
|
218
|
+
height,
|
|
219
|
+
x: (window.innerWidth - width) / 2 + index * CASCADE,
|
|
220
|
+
y: Math.max(
|
|
221
|
+
MARGIN,
|
|
222
|
+
(window.innerHeight - height) / 2 - 40 + index * CASCADE
|
|
223
|
+
)
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
function useDevLayout(plugins, defaultMode = "window") {
|
|
227
|
+
const sizes = /* @__PURE__ */ new Map();
|
|
228
|
+
for (const plugin of plugins) {
|
|
229
|
+
if (plugin.window) sizes.set(plugin.id, plugin.window.size);
|
|
230
|
+
}
|
|
231
|
+
const [layout, setLayout] = useState2(
|
|
232
|
+
() => read(new Set(sizes.keys()))
|
|
233
|
+
);
|
|
234
|
+
const update = (change) => setLayout((current) => {
|
|
235
|
+
const next = change(current);
|
|
236
|
+
writeJson(STORAGE_KEY, next);
|
|
237
|
+
return next;
|
|
238
|
+
});
|
|
239
|
+
const sizeOf = (id) => sizes.get(id);
|
|
240
|
+
const open = (id) => {
|
|
241
|
+
const size = sizeOf(id);
|
|
242
|
+
if (!size) return;
|
|
243
|
+
update((current) => {
|
|
244
|
+
if ((current.mode ?? defaultMode) === "popover") {
|
|
245
|
+
return { ...current, open: [id] };
|
|
246
|
+
}
|
|
247
|
+
return {
|
|
248
|
+
...current,
|
|
249
|
+
open: [...current.open.filter((w) => w !== id), id],
|
|
250
|
+
rects: current.rects[id] ? current.rects : { ...current.rects, [id]: defaultRect(size, current.open.length) }
|
|
251
|
+
};
|
|
252
|
+
});
|
|
253
|
+
};
|
|
254
|
+
const close = (id) => update((current) => ({
|
|
255
|
+
...current,
|
|
256
|
+
open: current.open.filter((w) => w !== id)
|
|
257
|
+
}));
|
|
258
|
+
return {
|
|
259
|
+
layout,
|
|
260
|
+
mode: layout.mode ?? defaultMode,
|
|
261
|
+
setMode: (mode) => update((current) => ({
|
|
262
|
+
...current,
|
|
263
|
+
mode,
|
|
264
|
+
// switching to a popover keeps only the tool in front
|
|
265
|
+
open: mode === "popover" ? current.open.slice(-1) : current.open
|
|
266
|
+
})),
|
|
267
|
+
isOpen: (id) => layout.open.includes(id),
|
|
268
|
+
isPinned: (plugin) => layout.pinned[plugin.id] ?? plugin.pinned ?? true,
|
|
269
|
+
open,
|
|
270
|
+
close,
|
|
271
|
+
toggle: (id) => layout.open.includes(id) ? close(id) : open(id),
|
|
272
|
+
focus: (id) => update(
|
|
273
|
+
(current) => current.open[current.open.length - 1] === id ? current : { ...current, open: [...current.open.filter((w) => w !== id), id] }
|
|
274
|
+
),
|
|
275
|
+
setRect: (id, rect) => {
|
|
276
|
+
const size = sizeOf(id);
|
|
277
|
+
if (!size) return;
|
|
278
|
+
update((current) => ({
|
|
279
|
+
...current,
|
|
280
|
+
rects: { ...current.rects, [id]: clampRect(size, rect) }
|
|
281
|
+
}));
|
|
282
|
+
},
|
|
283
|
+
setPinned: (id, pinned) => update((current) => ({
|
|
284
|
+
...current,
|
|
285
|
+
pinned: { ...current.pinned, [id]: pinned }
|
|
286
|
+
})),
|
|
287
|
+
reset: () => update(() => DEFAULT_LAYOUT)
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// src/ui/floating-window.tsx
|
|
292
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
293
|
+
var DRAG_THRESHOLD = 4;
|
|
294
|
+
var STEP = 8;
|
|
295
|
+
var LARGE_STEP = 40;
|
|
296
|
+
var BASE_Z = 9100;
|
|
297
|
+
function FloatingWindow({
|
|
298
|
+
id,
|
|
299
|
+
size,
|
|
300
|
+
title,
|
|
301
|
+
icon,
|
|
302
|
+
rect,
|
|
303
|
+
stack,
|
|
304
|
+
onFocus,
|
|
305
|
+
onClose,
|
|
306
|
+
onRect,
|
|
307
|
+
children
|
|
308
|
+
}) {
|
|
309
|
+
const ref = useRef(null);
|
|
310
|
+
const current = useRef(rect);
|
|
311
|
+
const stop = useRef(void 0);
|
|
312
|
+
useEffect(() => {
|
|
313
|
+
current.current = rect;
|
|
314
|
+
}, [rect]);
|
|
315
|
+
useEffect(() => () => stop.current?.(), []);
|
|
316
|
+
const paint = (next) => {
|
|
317
|
+
const el = ref.current;
|
|
318
|
+
if (!el) return;
|
|
319
|
+
el.style.setProperty("--x", `${next.x}px`);
|
|
320
|
+
el.style.setProperty("--y", `${next.y}px`);
|
|
321
|
+
el.style.setProperty("--w", `${next.width}px`);
|
|
322
|
+
el.style.setProperty("--h", `${next.height}px`);
|
|
323
|
+
};
|
|
324
|
+
const drag = (event, to) => {
|
|
325
|
+
if (event.button !== 0) return;
|
|
326
|
+
stop.current?.();
|
|
327
|
+
const from = current.current;
|
|
328
|
+
const origin = { x: event.clientX, y: event.clientY };
|
|
329
|
+
let latest = from;
|
|
330
|
+
stop.current = bindDrag(event.currentTarget, event.nativeEvent, {
|
|
331
|
+
threshold: DRAG_THRESHOLD,
|
|
332
|
+
cancelOnEscape: true,
|
|
333
|
+
onMove: ({ x, y }) => {
|
|
334
|
+
latest = clampRect(size, to(from, x - origin.x, y - origin.y));
|
|
335
|
+
paint(latest);
|
|
336
|
+
},
|
|
337
|
+
onEnd: (_event, canceled) => {
|
|
338
|
+
if (canceled) paint(from);
|
|
339
|
+
else onRect(latest);
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
};
|
|
343
|
+
const startMove = (event) => {
|
|
344
|
+
if (event.target.closest("button")) return;
|
|
345
|
+
drag(event, (from, dx, dy) => ({
|
|
346
|
+
...from,
|
|
347
|
+
x: from.x + dx,
|
|
348
|
+
y: from.y + dy
|
|
349
|
+
}));
|
|
350
|
+
};
|
|
351
|
+
const startResize = (edge) => (event) => drag(event, (from, dx, dy) => ({
|
|
352
|
+
...from,
|
|
353
|
+
width: edge.includes("e") ? from.width + dx : from.width,
|
|
354
|
+
height: edge.includes("s") ? from.height + dy : from.height
|
|
355
|
+
}));
|
|
356
|
+
const onKeyDown = (event) => {
|
|
357
|
+
if (!event.altKey) return;
|
|
358
|
+
const delta = {
|
|
359
|
+
ArrowLeft: { x: -1, y: 0 },
|
|
360
|
+
ArrowRight: { x: 1, y: 0 },
|
|
361
|
+
ArrowUp: { x: 0, y: -1 },
|
|
362
|
+
ArrowDown: { x: 0, y: 1 }
|
|
363
|
+
}[event.key];
|
|
364
|
+
if (!delta) return;
|
|
365
|
+
event.preventDefault();
|
|
366
|
+
event.stopPropagation();
|
|
367
|
+
const step = event.shiftKey ? LARGE_STEP : STEP;
|
|
368
|
+
const from = current.current;
|
|
369
|
+
onRect(
|
|
370
|
+
event.ctrlKey ? {
|
|
371
|
+
...from,
|
|
372
|
+
width: from.width + delta.x * step,
|
|
373
|
+
height: from.height + delta.y * step
|
|
374
|
+
} : { ...from, x: from.x + delta.x * step, y: from.y + delta.y * step }
|
|
375
|
+
);
|
|
376
|
+
};
|
|
377
|
+
const { minWidth, minHeight } = size;
|
|
378
|
+
return /* @__PURE__ */ jsxs2(
|
|
379
|
+
"section",
|
|
380
|
+
{
|
|
381
|
+
ref,
|
|
382
|
+
"aria-label": title,
|
|
383
|
+
"data-react-grab-ignore": true,
|
|
384
|
+
"data-devbelt-window": id,
|
|
385
|
+
onPointerDownCapture: onFocus,
|
|
386
|
+
className: "pointer-events-auto fixed top-(--y) left-(--x) flex h-(--h) w-(--w) flex-col overflow-hidden rounded-xl border border-line bg-surface text-xs text-fg shadow-2xl",
|
|
387
|
+
style: {
|
|
388
|
+
"--x": `${rect.x}px`,
|
|
389
|
+
"--y": `${rect.y}px`,
|
|
390
|
+
"--w": `${rect.width}px`,
|
|
391
|
+
"--h": `${rect.height}px`,
|
|
392
|
+
minWidth,
|
|
393
|
+
minHeight,
|
|
394
|
+
zIndex: BASE_Z + stack
|
|
395
|
+
},
|
|
396
|
+
children: [
|
|
397
|
+
/* @__PURE__ */ jsxs2(
|
|
398
|
+
"header",
|
|
399
|
+
{
|
|
400
|
+
onPointerDown: startMove,
|
|
401
|
+
className: "flex shrink-0 cursor-grab touch-none items-center gap-2 border-b border-line bg-surface-header px-2 py-1.5 select-none active:cursor-grabbing",
|
|
402
|
+
children: [
|
|
403
|
+
/* @__PURE__ */ jsx2("span", { className: "text-fg-icon", "aria-hidden": "true", children: icon }),
|
|
404
|
+
/* @__PURE__ */ jsx2("h2", { className: "min-w-0 flex-1 text-xs font-semibold", children: /* @__PURE__ */ jsx2(
|
|
405
|
+
Button,
|
|
406
|
+
{
|
|
407
|
+
"aria-label": `Move ${title}`,
|
|
408
|
+
title: "Drag the header to move \xB7 Alt+arrows nudge \xB7 add Ctrl to resize",
|
|
409
|
+
onKeyDown,
|
|
410
|
+
className: "block w-full cursor-grab truncate rounded-md px-1 py-0.5 text-start focus-visible:outline-2 focus-visible:outline-focus active:cursor-grabbing",
|
|
411
|
+
children: title
|
|
412
|
+
}
|
|
413
|
+
) }),
|
|
414
|
+
/* @__PURE__ */ jsx2(
|
|
415
|
+
Button,
|
|
416
|
+
{
|
|
417
|
+
"aria-label": `Close ${title}`,
|
|
418
|
+
onClick: onClose,
|
|
419
|
+
className: `${iconButtonClass} relative after:absolute after:-inset-1 size-6`,
|
|
420
|
+
children: /* @__PURE__ */ jsx2(XIcon, { className: "size-3.5", "aria-hidden": "true" })
|
|
421
|
+
}
|
|
422
|
+
)
|
|
423
|
+
]
|
|
424
|
+
}
|
|
425
|
+
),
|
|
426
|
+
/* @__PURE__ */ jsx2("div", { className: "flex min-h-0 flex-1 flex-col", children }),
|
|
427
|
+
/* @__PURE__ */ jsx2(
|
|
428
|
+
"div",
|
|
429
|
+
{
|
|
430
|
+
"aria-hidden": "true",
|
|
431
|
+
onPointerDown: startResize("e"),
|
|
432
|
+
className: "group absolute inset-y-0 right-0 w-1.5 cursor-ew-resize touch-none",
|
|
433
|
+
children: /* @__PURE__ */ jsx2("span", { className: "pointer-events-none absolute inset-y-3 right-0 w-[3px] rounded-full bg-accent opacity-0 transition-opacity duration-75 group-hover:opacity-100 group-active:opacity-100" })
|
|
434
|
+
}
|
|
435
|
+
),
|
|
436
|
+
/* @__PURE__ */ jsx2(
|
|
437
|
+
"div",
|
|
438
|
+
{
|
|
439
|
+
"aria-hidden": "true",
|
|
440
|
+
onPointerDown: startResize("s"),
|
|
441
|
+
className: "group absolute inset-x-0 bottom-0 h-1.5 cursor-ns-resize touch-none",
|
|
442
|
+
children: /* @__PURE__ */ jsx2("span", { className: "pointer-events-none absolute inset-x-3 bottom-0 h-[3px] rounded-full bg-accent opacity-0 transition-opacity duration-75 group-hover:opacity-100 group-active:opacity-100" })
|
|
443
|
+
}
|
|
444
|
+
),
|
|
445
|
+
/* @__PURE__ */ jsx2(
|
|
446
|
+
"div",
|
|
447
|
+
{
|
|
448
|
+
"aria-hidden": "true",
|
|
449
|
+
onPointerDown: startResize("se"),
|
|
450
|
+
className: "group absolute right-0 bottom-0 size-6 cursor-nwse-resize touch-none",
|
|
451
|
+
children: /* @__PURE__ */ jsx2("span", { className: "pointer-events-none absolute right-0 bottom-0 size-4 rounded-br-xl border-r-[3px] border-b-[3px] border-accent opacity-0 transition-opacity duration-75 group-hover:opacity-100 group-active:opacity-100" })
|
|
452
|
+
}
|
|
453
|
+
)
|
|
454
|
+
]
|
|
455
|
+
}
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
// src/ui/item-menu.tsx
|
|
460
|
+
import { PinOffIcon, PlayIcon, SquareArrowOutUpRightIcon } from "lucide-react";
|
|
461
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
462
|
+
function ItemMenu({ plugin, onOpen, onUnpin, children }) {
|
|
463
|
+
const Section = plugin.MenuSection;
|
|
464
|
+
return /* @__PURE__ */ jsxs3(Menu, { children: [
|
|
465
|
+
/* @__PURE__ */ jsx3(
|
|
466
|
+
MenuContextTrigger,
|
|
467
|
+
{
|
|
468
|
+
"aria-label": `${plugin.name} options`,
|
|
469
|
+
render: /* @__PURE__ */ jsx3("span", { className: "contents" }),
|
|
470
|
+
children
|
|
471
|
+
}
|
|
472
|
+
),
|
|
473
|
+
/* @__PURE__ */ jsxs3(
|
|
474
|
+
MenuContent,
|
|
475
|
+
{
|
|
476
|
+
"aria-label": `${plugin.name} options`,
|
|
477
|
+
"data-react-grab-ignore": true,
|
|
478
|
+
className: menuContentClass,
|
|
479
|
+
children: [
|
|
480
|
+
/* @__PURE__ */ jsx3(MenuHighlight, {}),
|
|
481
|
+
/* @__PURE__ */ jsxs3(MenuGroup, { children: [
|
|
482
|
+
/* @__PURE__ */ jsxs3(MenuGroupLabel, { className: `${menuLabelClass} flex items-center gap-1.5`, children: [
|
|
483
|
+
/* @__PURE__ */ jsx3("span", { className: "inline-flex shrink-0 [&_svg]:size-3", "aria-hidden": "true", children: plugin.icon }),
|
|
484
|
+
plugin.name
|
|
485
|
+
] }),
|
|
486
|
+
plugin.window || plugin.run ? /* @__PURE__ */ jsxs3(MenuItem, { value: "open", className: menuItemClass, onSelect: onOpen, children: [
|
|
487
|
+
plugin.window ? /* @__PURE__ */ jsx3(SquareArrowOutUpRightIcon, { className: menuIconClass, "aria-hidden": "true" }) : /* @__PURE__ */ jsx3(PlayIcon, { className: menuIconClass, "aria-hidden": "true" }),
|
|
488
|
+
plugin.window ? "Open" : "Run"
|
|
489
|
+
] }) : null
|
|
490
|
+
] }),
|
|
491
|
+
Section ? /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
492
|
+
/* @__PURE__ */ jsx3(MenuSeparator, { className: menuSeparatorClass }),
|
|
493
|
+
/* @__PURE__ */ jsx3(Section, {})
|
|
494
|
+
] }) : null,
|
|
495
|
+
/* @__PURE__ */ jsx3(MenuSeparator, { className: menuSeparatorClass }),
|
|
496
|
+
/* @__PURE__ */ jsxs3(MenuItem, { value: "unpin", className: menuItemClass, onSelect: onUnpin, children: [
|
|
497
|
+
/* @__PURE__ */ jsx3(PinOffIcon, { className: menuIconClass, "aria-hidden": "true" }),
|
|
498
|
+
"Unpin from toolbar"
|
|
499
|
+
] })
|
|
500
|
+
]
|
|
501
|
+
}
|
|
502
|
+
)
|
|
503
|
+
] });
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
// src/ui/toolbar-strip.tsx
|
|
507
|
+
import { useEffect as useEffect3, useRef as useRef3 } from "react";
|
|
508
|
+
|
|
509
|
+
// src/ui/use-fluid-hover.ts
|
|
510
|
+
import {
|
|
511
|
+
useRef as useRef2,
|
|
512
|
+
useState as useState3,
|
|
513
|
+
useCallback,
|
|
514
|
+
useEffect as useEffect2,
|
|
515
|
+
useLayoutEffect,
|
|
516
|
+
useMemo,
|
|
517
|
+
useSyncExternalStore
|
|
518
|
+
} from "react";
|
|
519
|
+
function pickNearest({
|
|
520
|
+
axis,
|
|
521
|
+
point,
|
|
522
|
+
rects,
|
|
523
|
+
containerRect,
|
|
524
|
+
scroll,
|
|
525
|
+
border,
|
|
526
|
+
layoutSize,
|
|
527
|
+
isDisabled
|
|
528
|
+
}) {
|
|
529
|
+
const scaleX = layoutSize.width > 0 ? containerRect.width / layoutSize.width : 1;
|
|
530
|
+
const scaleY = layoutSize.height > 0 ? containerRect.height / layoutSize.height : 1;
|
|
531
|
+
let closestIndex = null;
|
|
532
|
+
let closestDistance = Infinity;
|
|
533
|
+
let containingIndex = null;
|
|
534
|
+
for (let index = 0; index < rects.length; index++) {
|
|
535
|
+
const r = rects[index];
|
|
536
|
+
if (!r) continue;
|
|
537
|
+
if (isDisabled?.(index)) continue;
|
|
538
|
+
if (axis === "xy") {
|
|
539
|
+
const left = containerRect.left + (border.x + r.left - scroll.x) * scaleX;
|
|
540
|
+
const top = containerRect.top + (border.y + r.top - scroll.y) * scaleY;
|
|
541
|
+
const width = r.width * scaleX;
|
|
542
|
+
const height = r.height * scaleY;
|
|
543
|
+
if (point.x >= left && point.x <= left + width && point.y >= top && point.y <= top + height) {
|
|
544
|
+
containingIndex = index;
|
|
545
|
+
}
|
|
546
|
+
const distance2 = Math.hypot(point.x - (left + width / 2), point.y - (top + height / 2));
|
|
547
|
+
if (distance2 < closestDistance) {
|
|
548
|
+
closestDistance = distance2;
|
|
549
|
+
closestIndex = index;
|
|
550
|
+
}
|
|
551
|
+
continue;
|
|
552
|
+
}
|
|
553
|
+
const horizontal = axis === "x";
|
|
554
|
+
const mousePos = horizontal ? point.x : point.y;
|
|
555
|
+
const scale = horizontal ? scaleX : scaleY;
|
|
556
|
+
const itemStart = (horizontal ? containerRect.left : containerRect.top) + ((horizontal ? border.x : border.y) + (horizontal ? r.left : r.top) - (horizontal ? scroll.x : scroll.y)) * scale;
|
|
557
|
+
const itemSize = (horizontal ? r.width : r.height) * scale;
|
|
558
|
+
if (mousePos >= itemStart && mousePos <= itemStart + itemSize) {
|
|
559
|
+
containingIndex = index;
|
|
560
|
+
}
|
|
561
|
+
const distance = Math.abs(mousePos - (itemStart + itemSize / 2));
|
|
562
|
+
if (distance < closestDistance) {
|
|
563
|
+
closestDistance = distance;
|
|
564
|
+
closestIndex = index;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
return containingIndex ?? closestIndex;
|
|
568
|
+
}
|
|
569
|
+
function isOwnEvent(e) {
|
|
570
|
+
const { currentTarget, target } = e;
|
|
571
|
+
if (!(currentTarget instanceof Node) || !(target instanceof Node)) return true;
|
|
572
|
+
return currentTarget.contains(target);
|
|
573
|
+
}
|
|
574
|
+
var ACTIVE_ATTR = "data-fluid-hover-active";
|
|
575
|
+
var ACTIVE_INDEX_ATTR = "data-fluid-hover-active-index";
|
|
576
|
+
var ACTIVATOR_SELECTOR = "a[href], button, [role='menuitem'], [role='menuitemradio'], [role='menuitemcheckbox'], [role='option'], [role='radio'], [role='checkbox'], [role='tab'], [role='link'], [role='button']";
|
|
577
|
+
function resolveActivator(element) {
|
|
578
|
+
if (element.matches(ACTIVATOR_SELECTOR) || element.hasAttribute("tabindex")) {
|
|
579
|
+
return element;
|
|
580
|
+
}
|
|
581
|
+
return element.querySelector(ACTIVATOR_SELECTOR) ?? element;
|
|
582
|
+
}
|
|
583
|
+
var useIsoLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect2;
|
|
584
|
+
var measurementAttempts = 3;
|
|
585
|
+
var SEAM = 4;
|
|
586
|
+
function distanceToRect(r, point) {
|
|
587
|
+
const dx = Math.max(r.left - point.x, 0, point.x - r.right);
|
|
588
|
+
const dy = Math.max(r.top - point.y, 0, point.y - r.bottom);
|
|
589
|
+
return Math.hypot(dx, dy);
|
|
590
|
+
}
|
|
591
|
+
function useFluidHover(containerRef, options = {}) {
|
|
592
|
+
const { axis = "y", isItemDisabled, gapClick = true, nearest = false, followScroll = false } = options;
|
|
593
|
+
const gapClickMaxDistance = typeof gapClick === "object" ? gapClick.maxDistance ?? Infinity : Infinity;
|
|
594
|
+
const itemsRef = useRef2(/* @__PURE__ */ new Map());
|
|
595
|
+
const [activeIndex, setActiveIndex] = useState3(null);
|
|
596
|
+
const activeIndexRef = useRef2(null);
|
|
597
|
+
const listenersRef = useRef2(/* @__PURE__ */ new Set());
|
|
598
|
+
const activeStore = useMemo(
|
|
599
|
+
() => ({
|
|
600
|
+
subscribe: (listener) => {
|
|
601
|
+
listenersRef.current.add(listener);
|
|
602
|
+
return () => {
|
|
603
|
+
listenersRef.current.delete(listener);
|
|
604
|
+
};
|
|
605
|
+
},
|
|
606
|
+
get: () => activeIndexRef.current
|
|
607
|
+
}),
|
|
608
|
+
[]
|
|
609
|
+
);
|
|
610
|
+
useIsoLayoutEffect(() => {
|
|
611
|
+
activeIndexRef.current = activeIndex;
|
|
612
|
+
listenersRef.current.forEach((listener) => listener());
|
|
613
|
+
}, [activeIndex]);
|
|
614
|
+
useEffect2(() => {
|
|
615
|
+
const container = containerRef.current;
|
|
616
|
+
const items = itemsRef.current;
|
|
617
|
+
if (activeIndex === null) container?.removeAttribute(ACTIVE_INDEX_ATTR);
|
|
618
|
+
else container?.setAttribute(ACTIVE_INDEX_ATTR, String(activeIndex));
|
|
619
|
+
const active = activeIndex === null ? void 0 : items.get(activeIndex);
|
|
620
|
+
active?.setAttribute(ACTIVE_ATTR, "");
|
|
621
|
+
return () => {
|
|
622
|
+
active?.removeAttribute(ACTIVE_ATTR);
|
|
623
|
+
if (activeIndex !== null) items.get(activeIndex)?.removeAttribute(ACTIVE_ATTR);
|
|
624
|
+
};
|
|
625
|
+
}, [activeIndex, containerRef]);
|
|
626
|
+
const [itemRects, setItemRects] = useState3([]);
|
|
627
|
+
const [isMeasured, setIsMeasured] = useState3(false);
|
|
628
|
+
const itemRectsRef = useRef2([]);
|
|
629
|
+
const [session, setSession] = useState3(0);
|
|
630
|
+
const sessionRef = useRef2(0);
|
|
631
|
+
const sessionPendingRef = useRef2(false);
|
|
632
|
+
const rafIdRef = useRef2(null);
|
|
633
|
+
const remeasureRafIdRef = useRef2(null);
|
|
634
|
+
const runMeasurement = useCallback(() => {
|
|
635
|
+
const container = containerRef.current;
|
|
636
|
+
if (!container) return false;
|
|
637
|
+
const rects = [];
|
|
638
|
+
let everyItemHasLayout = true;
|
|
639
|
+
itemsRef.current.forEach((element, index) => {
|
|
640
|
+
const hasLayoutBox = element.offsetParent !== null || element.offsetWidth > 0 || element.offsetHeight > 0;
|
|
641
|
+
if (!hasLayoutBox) {
|
|
642
|
+
everyItemHasLayout = false;
|
|
643
|
+
return;
|
|
644
|
+
}
|
|
645
|
+
let top = element.offsetTop;
|
|
646
|
+
let left = element.offsetLeft;
|
|
647
|
+
let ancestor = element.offsetParent;
|
|
648
|
+
while (ancestor && ancestor !== container && container.contains(ancestor)) {
|
|
649
|
+
top += ancestor.offsetTop + ancestor.clientTop;
|
|
650
|
+
left += ancestor.offsetLeft + ancestor.clientLeft;
|
|
651
|
+
ancestor = ancestor.offsetParent;
|
|
652
|
+
}
|
|
653
|
+
rects[index] = {
|
|
654
|
+
top,
|
|
655
|
+
height: element.offsetHeight,
|
|
656
|
+
left,
|
|
657
|
+
width: element.offsetWidth
|
|
658
|
+
};
|
|
659
|
+
});
|
|
660
|
+
if (!everyItemHasLayout) return false;
|
|
661
|
+
const prev = itemRectsRef.current;
|
|
662
|
+
let changed = prev.length !== rects.length;
|
|
663
|
+
for (let i = 0; !changed && i < rects.length; i++) {
|
|
664
|
+
const p = prev[i];
|
|
665
|
+
const r = rects[i];
|
|
666
|
+
if (p === r) continue;
|
|
667
|
+
changed = !p || !r || p.top !== r.top || p.left !== r.left || p.width !== r.width || p.height !== r.height;
|
|
668
|
+
}
|
|
669
|
+
if (changed) {
|
|
670
|
+
itemRectsRef.current = rects;
|
|
671
|
+
setItemRects(rects);
|
|
672
|
+
}
|
|
673
|
+
return true;
|
|
674
|
+
}, [containerRef]);
|
|
675
|
+
const measureItems = useCallback(() => {
|
|
676
|
+
runMeasurement();
|
|
677
|
+
}, [runMeasurement]);
|
|
678
|
+
const scheduleMeasurement = useCallback(
|
|
679
|
+
(attempts) => {
|
|
680
|
+
const attempt = (attemptsLeft) => {
|
|
681
|
+
if (remeasureRafIdRef.current !== null) {
|
|
682
|
+
cancelAnimationFrame(remeasureRafIdRef.current);
|
|
683
|
+
}
|
|
684
|
+
remeasureRafIdRef.current = requestAnimationFrame(() => {
|
|
685
|
+
remeasureRafIdRef.current = null;
|
|
686
|
+
if (runMeasurement()) {
|
|
687
|
+
setIsMeasured(true);
|
|
688
|
+
} else if (attemptsLeft > 1) {
|
|
689
|
+
attempt(attemptsLeft - 1);
|
|
690
|
+
}
|
|
691
|
+
});
|
|
692
|
+
};
|
|
693
|
+
attempt(attempts);
|
|
694
|
+
},
|
|
695
|
+
[runMeasurement]
|
|
696
|
+
);
|
|
697
|
+
const remeasure = useCallback(() => {
|
|
698
|
+
setIsMeasured(false);
|
|
699
|
+
scheduleMeasurement(measurementAttempts);
|
|
700
|
+
}, [scheduleMeasurement]);
|
|
701
|
+
const itemRoRef = useRef2(null);
|
|
702
|
+
const getItemRo = useCallback(() => {
|
|
703
|
+
if (itemRoRef.current === null && typeof ResizeObserver !== "undefined") {
|
|
704
|
+
itemRoRef.current = new ResizeObserver(
|
|
705
|
+
() => scheduleMeasurement(measurementAttempts)
|
|
706
|
+
);
|
|
707
|
+
}
|
|
708
|
+
return itemRoRef.current;
|
|
709
|
+
}, [scheduleMeasurement]);
|
|
710
|
+
const registerItem = useCallback(
|
|
711
|
+
(index, element) => {
|
|
712
|
+
if (element) {
|
|
713
|
+
itemsRef.current.set(index, element);
|
|
714
|
+
getItemRo()?.observe(element);
|
|
715
|
+
if (index === activeIndexRef.current) element.setAttribute(ACTIVE_ATTR, "");
|
|
716
|
+
} else {
|
|
717
|
+
const previous = itemsRef.current.get(index);
|
|
718
|
+
if (previous) itemRoRef.current?.unobserve(previous);
|
|
719
|
+
previous?.removeAttribute(ACTIVE_ATTR);
|
|
720
|
+
itemsRef.current.delete(index);
|
|
721
|
+
if (index === activeIndexRef.current) {
|
|
722
|
+
setActiveIndex(
|
|
723
|
+
(current) => current === index && !itemsRef.current.has(index) ? null : current
|
|
724
|
+
);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
remeasure();
|
|
728
|
+
},
|
|
729
|
+
[remeasure, getItemRo]
|
|
730
|
+
);
|
|
731
|
+
const seamHold = useCallback(
|
|
732
|
+
(point) => {
|
|
733
|
+
const active = activeIndexRef.current;
|
|
734
|
+
if (active === null) return null;
|
|
735
|
+
const activeEl = itemsRef.current.get(active);
|
|
736
|
+
if (!activeEl || isItemDisabled?.(activeEl)) return null;
|
|
737
|
+
const activeRect = activeEl.getBoundingClientRect();
|
|
738
|
+
const d = distanceToRect(activeRect, point);
|
|
739
|
+
if (d === 0 || d > SEAM) return null;
|
|
740
|
+
for (const [index, el] of itemsRef.current) {
|
|
741
|
+
if (index === active || el.contains(activeEl) || activeEl.contains(el)) continue;
|
|
742
|
+
if (isItemDisabled?.(el)) continue;
|
|
743
|
+
const r = el.getBoundingClientRect();
|
|
744
|
+
if (distanceToRect(r, point) > 0 && distanceToRect(r, point) <= SEAM) return active;
|
|
745
|
+
}
|
|
746
|
+
return null;
|
|
747
|
+
},
|
|
748
|
+
[isItemDisabled]
|
|
749
|
+
);
|
|
750
|
+
const itemAt = useCallback(
|
|
751
|
+
(container, point, target) => {
|
|
752
|
+
if (nearest)
|
|
753
|
+
return pickNearest({
|
|
754
|
+
axis,
|
|
755
|
+
point,
|
|
756
|
+
rects: itemRectsRef.current,
|
|
757
|
+
containerRect: container.getBoundingClientRect(),
|
|
758
|
+
scroll: { x: container.scrollLeft, y: container.scrollTop },
|
|
759
|
+
border: { x: container.clientLeft, y: container.clientTop },
|
|
760
|
+
layoutSize: { width: container.offsetWidth, height: container.offsetHeight },
|
|
761
|
+
isDisabled: isItemDisabled ? (index) => {
|
|
762
|
+
const el = itemsRef.current.get(index);
|
|
763
|
+
return !!el && isItemDisabled(el);
|
|
764
|
+
} : void 0
|
|
765
|
+
});
|
|
766
|
+
let next = null;
|
|
767
|
+
let hit = null;
|
|
768
|
+
for (const [index, el] of itemsRef.current) {
|
|
769
|
+
if (!el.contains(target) || isItemDisabled?.(el)) continue;
|
|
770
|
+
if (!hit || hit.contains(el)) {
|
|
771
|
+
hit = el;
|
|
772
|
+
next = index;
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
const held = seamHold(point);
|
|
776
|
+
if (held !== null && held !== next) {
|
|
777
|
+
const heldEl = itemsRef.current.get(held);
|
|
778
|
+
if (!hit || heldEl && hit.contains(heldEl)) return held;
|
|
779
|
+
}
|
|
780
|
+
return next;
|
|
781
|
+
},
|
|
782
|
+
[axis, isItemDisabled, nearest, seamHold]
|
|
783
|
+
);
|
|
784
|
+
const pointRef = useRef2(null);
|
|
785
|
+
const handleMouseMove = useCallback(
|
|
786
|
+
(e) => {
|
|
787
|
+
if (!isOwnEvent(e)) return;
|
|
788
|
+
const mouseX = e.clientX;
|
|
789
|
+
const mouseY = e.clientY;
|
|
790
|
+
const target = e.target;
|
|
791
|
+
pointRef.current = { x: mouseX, y: mouseY };
|
|
792
|
+
if (rafIdRef.current !== null) {
|
|
793
|
+
cancelAnimationFrame(rafIdRef.current);
|
|
794
|
+
}
|
|
795
|
+
rafIdRef.current = requestAnimationFrame(() => {
|
|
796
|
+
rafIdRef.current = null;
|
|
797
|
+
const container = containerRef.current;
|
|
798
|
+
if (!container) return;
|
|
799
|
+
const next = itemAt(container, { x: mouseX, y: mouseY }, target);
|
|
800
|
+
if (sessionPendingRef.current && next !== activeIndexRef.current) {
|
|
801
|
+
sessionPendingRef.current = false;
|
|
802
|
+
sessionRef.current += 1;
|
|
803
|
+
setSession(sessionRef.current);
|
|
804
|
+
} else if (next !== null && next === activeIndexRef.current) {
|
|
805
|
+
sessionPendingRef.current = false;
|
|
806
|
+
}
|
|
807
|
+
if (next === null) sessionPendingRef.current = true;
|
|
808
|
+
setActiveIndex(next);
|
|
809
|
+
});
|
|
810
|
+
},
|
|
811
|
+
[containerRef, itemAt]
|
|
812
|
+
);
|
|
813
|
+
useEffect2(() => {
|
|
814
|
+
if (!followScroll) return;
|
|
815
|
+
let frame = null;
|
|
816
|
+
const follow = () => {
|
|
817
|
+
frame = null;
|
|
818
|
+
const container = containerRef.current;
|
|
819
|
+
const point = pointRef.current;
|
|
820
|
+
if (!container || !point) return;
|
|
821
|
+
const target = document.elementFromPoint(point.x, point.y);
|
|
822
|
+
if (!target || !container.contains(target)) return;
|
|
823
|
+
const next = itemAt(container, point, target);
|
|
824
|
+
if (next === activeIndexRef.current) return;
|
|
825
|
+
if (sessionPendingRef.current && next !== null) {
|
|
826
|
+
sessionPendingRef.current = false;
|
|
827
|
+
sessionRef.current += 1;
|
|
828
|
+
setSession(sessionRef.current);
|
|
829
|
+
}
|
|
830
|
+
if (next === null) sessionPendingRef.current = true;
|
|
831
|
+
setActiveIndex(next);
|
|
832
|
+
};
|
|
833
|
+
const onScroll = () => {
|
|
834
|
+
if (!pointRef.current || frame !== null || window.matchMedia("(hover: none)").matches) return;
|
|
835
|
+
frame = requestAnimationFrame(follow);
|
|
836
|
+
};
|
|
837
|
+
window.addEventListener("scroll", onScroll, { capture: true, passive: true });
|
|
838
|
+
return () => {
|
|
839
|
+
window.removeEventListener("scroll", onScroll, { capture: true });
|
|
840
|
+
if (frame !== null) cancelAnimationFrame(frame);
|
|
841
|
+
};
|
|
842
|
+
}, [containerRef, itemAt, followScroll]);
|
|
843
|
+
const handleMouseEnter = useCallback(() => {
|
|
844
|
+
sessionPendingRef.current = true;
|
|
845
|
+
}, []);
|
|
846
|
+
const handleMouseLeave = useCallback(() => {
|
|
847
|
+
if (rafIdRef.current !== null) {
|
|
848
|
+
cancelAnimationFrame(rafIdRef.current);
|
|
849
|
+
rafIdRef.current = null;
|
|
850
|
+
}
|
|
851
|
+
pointRef.current = null;
|
|
852
|
+
setActiveIndex(null);
|
|
853
|
+
}, []);
|
|
854
|
+
const setActiveIndexFromOutside = useCallback((value) => {
|
|
855
|
+
pointRef.current = null;
|
|
856
|
+
setActiveIndex(value);
|
|
857
|
+
}, []);
|
|
858
|
+
const handleClick = useCallback(
|
|
859
|
+
(e) => {
|
|
860
|
+
const target = e.target;
|
|
861
|
+
if (!target) return;
|
|
862
|
+
for (const element2 of itemsRef.current.values()) {
|
|
863
|
+
if (element2.contains(target)) return;
|
|
864
|
+
}
|
|
865
|
+
if (!target.isConnected) return;
|
|
866
|
+
if (!isOwnEvent(e)) return;
|
|
867
|
+
const control = target.closest?.(
|
|
868
|
+
"input, textarea, select, button, a, summary, [contenteditable], [role='textbox'], [role='searchbox'], [role='button']"
|
|
869
|
+
);
|
|
870
|
+
if (control) return;
|
|
871
|
+
if (gapClick === false) return;
|
|
872
|
+
const index = nearest ? activeIndexRef.current : seamHold({ x: e.clientX, y: e.clientY });
|
|
873
|
+
if (index === null) return;
|
|
874
|
+
const element = itemsRef.current.get(index);
|
|
875
|
+
if (!element || isItemDisabled?.(element)) return;
|
|
876
|
+
if (gapClickMaxDistance !== Infinity) {
|
|
877
|
+
const r = element.getBoundingClientRect();
|
|
878
|
+
const dx = Math.max(r.left - e.clientX, 0, e.clientX - r.right);
|
|
879
|
+
const dy = Math.max(r.top - e.clientY, 0, e.clientY - r.bottom);
|
|
880
|
+
if (Math.hypot(dx, dy) > gapClickMaxDistance) return;
|
|
881
|
+
}
|
|
882
|
+
resolveActivator(element).click();
|
|
883
|
+
},
|
|
884
|
+
[isItemDisabled, gapClick, gapClickMaxDistance, nearest, seamHold]
|
|
885
|
+
);
|
|
886
|
+
useEffect2(() => {
|
|
887
|
+
const container = containerRef.current;
|
|
888
|
+
if (!container || typeof ResizeObserver === "undefined") return;
|
|
889
|
+
const ro = new ResizeObserver(() => scheduleMeasurement(measurementAttempts));
|
|
890
|
+
ro.observe(container);
|
|
891
|
+
return () => ro.disconnect();
|
|
892
|
+
}, [containerRef, scheduleMeasurement]);
|
|
893
|
+
useEffect2(() => {
|
|
894
|
+
return () => {
|
|
895
|
+
if (rafIdRef.current !== null) {
|
|
896
|
+
cancelAnimationFrame(rafIdRef.current);
|
|
897
|
+
}
|
|
898
|
+
if (remeasureRafIdRef.current !== null) {
|
|
899
|
+
cancelAnimationFrame(remeasureRafIdRef.current);
|
|
900
|
+
}
|
|
901
|
+
itemRoRef.current?.disconnect();
|
|
902
|
+
itemRoRef.current = null;
|
|
903
|
+
};
|
|
904
|
+
}, []);
|
|
905
|
+
return {
|
|
906
|
+
activeIndex,
|
|
907
|
+
setActiveIndex: setActiveIndexFromOutside,
|
|
908
|
+
activeStore,
|
|
909
|
+
itemRects,
|
|
910
|
+
isMeasured,
|
|
911
|
+
session,
|
|
912
|
+
sessionRef,
|
|
913
|
+
handlers: {
|
|
914
|
+
onMouseMove: handleMouseMove,
|
|
915
|
+
onMouseEnter: handleMouseEnter,
|
|
916
|
+
onMouseLeave: handleMouseLeave,
|
|
917
|
+
onClick: handleClick
|
|
918
|
+
},
|
|
919
|
+
registerItem,
|
|
920
|
+
remeasure,
|
|
921
|
+
measureItems
|
|
922
|
+
};
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
// src/ui/toolbar-strip.tsx
|
|
926
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
927
|
+
function ToolbarStrip({
|
|
928
|
+
children,
|
|
929
|
+
...props
|
|
930
|
+
}) {
|
|
931
|
+
const ref = useRef3(null);
|
|
932
|
+
const hover = useFluidHover(ref, { axis: "x", gapClick: false });
|
|
933
|
+
const { registerItem } = hover;
|
|
934
|
+
useEffect3(() => {
|
|
935
|
+
const strip = ref.current;
|
|
936
|
+
if (!strip) return;
|
|
937
|
+
let known = [];
|
|
938
|
+
const sync = () => {
|
|
939
|
+
const buttons = Array.from(
|
|
940
|
+
strip.querySelectorAll("button:not([disabled])")
|
|
941
|
+
);
|
|
942
|
+
buttons.forEach((button, index) => {
|
|
943
|
+
if (known[index] !== button) registerItem(index, button);
|
|
944
|
+
});
|
|
945
|
+
for (let index = buttons.length; index < known.length; index++) {
|
|
946
|
+
registerItem(index, null);
|
|
947
|
+
}
|
|
948
|
+
known = buttons;
|
|
949
|
+
};
|
|
950
|
+
sync();
|
|
951
|
+
const observer = new MutationObserver(sync);
|
|
952
|
+
observer.observe(strip, { childList: true, subtree: true });
|
|
953
|
+
return () => {
|
|
954
|
+
observer.disconnect();
|
|
955
|
+
known.forEach((_, index) => registerItem(index, null));
|
|
956
|
+
};
|
|
957
|
+
}, [registerItem]);
|
|
958
|
+
return /* @__PURE__ */ jsxs4(Toolbar, { ref, ...hover.handlers, ...props, children: [
|
|
959
|
+
/* @__PURE__ */ jsx4(FluidHoverHighlight, { hover, className: "z-0 rounded-full" }),
|
|
960
|
+
children
|
|
961
|
+
] });
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
// src/ui/plugin-boundary.tsx
|
|
965
|
+
import { Component } from "react";
|
|
966
|
+
var PluginBoundary = class extends Component {
|
|
967
|
+
state = { failed: false };
|
|
968
|
+
static getDerivedStateFromError() {
|
|
969
|
+
return { failed: true };
|
|
970
|
+
}
|
|
971
|
+
componentDidCatch(error) {
|
|
972
|
+
console.warn(`devbelt: plugin "${this.props.plugin}" crashed`, error);
|
|
973
|
+
}
|
|
974
|
+
render() {
|
|
975
|
+
return this.state.failed ? null : this.props.children;
|
|
976
|
+
}
|
|
977
|
+
};
|
|
978
|
+
|
|
979
|
+
// src/ui/plugin-popover.tsx
|
|
980
|
+
import { XIcon as XIcon2 } from "lucide-react";
|
|
981
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
982
|
+
var MARGIN2 = 8;
|
|
983
|
+
var findAnchor = (root, id) => root.querySelector(`[data-devbelt-item="${id}"]`) ?? root.querySelector('[data-dock="toolbar"]');
|
|
984
|
+
var onToolbar = (event) => event?.composedPath().some((node) => node instanceof Element && node.hasAttribute("data-dock")) ?? false;
|
|
985
|
+
function PluginPopover({
|
|
986
|
+
id,
|
|
987
|
+
title,
|
|
988
|
+
icon,
|
|
989
|
+
size,
|
|
990
|
+
root,
|
|
991
|
+
onClose,
|
|
992
|
+
children
|
|
993
|
+
}) {
|
|
994
|
+
return /* @__PURE__ */ jsx5(
|
|
995
|
+
Popover,
|
|
996
|
+
{
|
|
997
|
+
open: true,
|
|
998
|
+
modal: false,
|
|
999
|
+
onOpenChange: (open, details) => {
|
|
1000
|
+
if (open) return;
|
|
1001
|
+
if (details.reason !== "escape-key" && onToolbar(details.event)) {
|
|
1002
|
+
details.cancel();
|
|
1003
|
+
return;
|
|
1004
|
+
}
|
|
1005
|
+
onClose();
|
|
1006
|
+
},
|
|
1007
|
+
children: /* @__PURE__ */ jsxs5(
|
|
1008
|
+
PopoverContent,
|
|
1009
|
+
{
|
|
1010
|
+
anchor: findAnchor(root, id),
|
|
1011
|
+
side: "top",
|
|
1012
|
+
align: "center",
|
|
1013
|
+
sideOffset: 12,
|
|
1014
|
+
initialFocus: "content",
|
|
1015
|
+
"data-react-grab-ignore": true,
|
|
1016
|
+
"data-devbelt-window": id,
|
|
1017
|
+
className: "m-0 flex flex-col overflow-hidden rounded-xl border border-line bg-surface p-0 text-xs text-fg shadow-2xl",
|
|
1018
|
+
style: {
|
|
1019
|
+
width: `min(${size.width}px, calc(100vw - ${MARGIN2 * 2}px))`,
|
|
1020
|
+
height: `min(${size.height}px, var(--available-height, 100vh))`
|
|
1021
|
+
},
|
|
1022
|
+
children: [
|
|
1023
|
+
/* @__PURE__ */ jsxs5("header", { className: "flex shrink-0 items-center gap-2 border-b border-line bg-surface-header px-2 py-1.5", children: [
|
|
1024
|
+
/* @__PURE__ */ jsx5("span", { className: "text-fg-icon", "aria-hidden": "true", children: icon }),
|
|
1025
|
+
/* @__PURE__ */ jsx5(PopoverTitle, { className: "min-w-0 flex-1 truncate text-xs font-semibold", children: title }),
|
|
1026
|
+
/* @__PURE__ */ jsx5(
|
|
1027
|
+
PopoverClose,
|
|
1028
|
+
{
|
|
1029
|
+
"aria-label": `Close ${title}`,
|
|
1030
|
+
className: `${iconButtonClass} relative after:absolute after:-inset-1 size-6`,
|
|
1031
|
+
children: /* @__PURE__ */ jsx5(XIcon2, { className: "size-3.5", "aria-hidden": "true" })
|
|
1032
|
+
}
|
|
1033
|
+
)
|
|
1034
|
+
] }),
|
|
1035
|
+
/* @__PURE__ */ jsx5("div", { className: "flex min-h-0 flex-1 flex-col", children: /* @__PURE__ */ jsx5(PluginBoundary, { plugin: id, children }) })
|
|
1036
|
+
]
|
|
1037
|
+
}
|
|
1038
|
+
)
|
|
1039
|
+
}
|
|
1040
|
+
);
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
// src/ui/toolbar-root.tsx
|
|
1044
|
+
import { useLayoutEffect as useLayoutEffect2, useState as useState4 } from "react";
|
|
1045
|
+
import { createPortal } from "react-dom";
|
|
1046
|
+
|
|
1047
|
+
// src/ui/styles.generated.ts
|
|
1048
|
+
var PROPERTY_CSS = '@property --tw-animation-delay{syntax:"*";inherits:false;initial-value:0s}@property --tw-animation-direction{syntax:"*";inherits:false;initial-value:normal}@property --tw-animation-duration{syntax:"*";inherits:false}@property --tw-animation-fill-mode{syntax:"*";inherits:false;initial-value:none}@property --tw-animation-iteration-count{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}';
|
|
1049
|
+
var TOOLBAR_CSS = '/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */\n@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:block))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-content:"";--tw-animation-delay:0s;--tw-animation-direction:normal;--tw-animation-duration:initial;--tw-animation-fill-mode:none;--tw-animation-iteration-count:1;--tw-enter-blur:0;--tw-enter-opacity:1;--tw-enter-rotate:0;--tw-enter-scale:1;--tw-enter-translate-x:0;--tw-enter-translate-y:0;--tw-exit-blur:0;--tw-exit-opacity:1;--tw-exit-rotate:0;--tw-exit-scale:1;--tw-exit-translate-x:0;--tw-exit-translate-y:0}}}@layer theme{:root,:host{--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-sky-300:oklch(82.8% .111 230.318);--color-sky-400:oklch(74.6% .16 232.661);--color-sky-500:oklch(68.5% .169 237.323);--color-violet-300:oklch(81.1% .111 293.571);--color-rose-300:oklch(81% .117 11.638);--color-rose-400:oklch(71.2% .194 13.428);--color-neutral-400:oklch(70.8% 0 none);--color-neutral-500:oklch(55.6% 0 none);--color-neutral-900:oklch(20.5% 0 none);--color-neutral-950:oklch(14.5% 0 none);--color-black:#000;--color-white:#fff;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--font-weight-medium:500;--font-weight-semibold:600;--tracking-tight:-.025em;--tracking-wide:.025em;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--ease-out:cubic-bezier(0, 0, .2, 1);--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-md:12px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--palette-ink:var(--color-neutral-950);--palette-ink-raised:var(--color-neutral-900);--palette-black:var(--color-black);--palette-paper:var(--color-white);--palette-mute:var(--color-neutral-400);--palette-dim:var(--color-neutral-500);--palette-sky:var(--color-sky-400);--palette-sky-strong:var(--color-sky-500);--palette-sky-soft:var(--color-sky-300);--palette-emerald:var(--color-emerald-400);--palette-emerald-strong:var(--color-emerald-500);--palette-emerald-soft:var(--color-emerald-300);--palette-amber:var(--color-amber-400);--palette-amber-soft:var(--color-amber-300);--palette-rose:var(--color-rose-400);--palette-rose-soft:var(--color-rose-300);--palette-violet-soft:var(--color-violet-300);--color-surface:var(--palette-ink);--color-surface-raised:var(--palette-ink-raised);--color-surface-overlay:#0a0a0ad9}@supports (color:color-mix(in lab, red, red)){:root,:host{--color-surface-overlay:color-mix(in oklab, var(--palette-ink) 85%, transparent)}}:root,:host{--color-surface-sticky:#0a0a0acc}@supports (color:color-mix(in lab, red, red)){:root,:host{--color-surface-sticky:color-mix(in oklab, var(--palette-ink) 80%, transparent)}}:root,:host{--color-surface-header:#17171799}@supports (color:color-mix(in lab, red, red)){:root,:host{--color-surface-header:color-mix(in oklab, var(--palette-ink-raised) 60%, transparent)}}:root,:host{--color-scrim:#0009}@supports (color:color-mix(in lab, red, red)){:root,:host{--color-scrim:color-mix(in oklab, var(--palette-black) 60%, transparent)}}:root,:host{--color-page:var(--palette-paper);--color-fg:var(--palette-paper);--color-fg-secondary:#ffffffb3}@supports (color:color-mix(in lab, red, red)){:root,:host{--color-fg-secondary:color-mix(in oklab, var(--palette-paper) 70%, transparent)}}:root,:host{--color-fg-tertiary:#ffffff80}@supports (color:color-mix(in lab, red, red)){:root,:host{--color-fg-tertiary:color-mix(in oklab, var(--palette-paper) 50%, transparent)}}:root,:host{--color-fg-disabled:#fff6}@supports (color:color-mix(in lab, red, red)){:root,:host{--color-fg-disabled:color-mix(in oklab, var(--palette-paper) 40%, transparent)}}:root,:host{--color-fg-icon:var(--palette-mute);--color-fg-inverse:var(--palette-ink);--color-inverse:var(--palette-paper);--color-inverse-hover:#ffffffe6}@supports (color:color-mix(in lab, red, red)){:root,:host{--color-inverse-hover:color-mix(in oklab, var(--palette-paper) 90%, transparent)}}:root,:host{--color-hover:#ffffff1a}@supports (color:color-mix(in lab, red, red)){:root,:host{--color-hover:color-mix(in oklab, var(--palette-paper) 10%, transparent)}}:root,:host{--color-hover-subtle:#ffffff0d}@supports (color:color-mix(in lab, red, red)){:root,:host{--color-hover-subtle:color-mix(in oklab, var(--palette-paper) 5%, transparent)}}:root,:host{--color-pressed:#ffffff26}@supports (color:color-mix(in lab, red, red)){:root,:host{--color-pressed:color-mix(in oklab, var(--palette-paper) 15%, transparent)}}:root,:host{--color-track:#fff3}@supports (color:color-mix(in lab, red, red)){:root,:host{--color-track:color-mix(in oklab, var(--palette-paper) 20%, transparent)}}:root,:host{--color-line:#ffffff1a}@supports (color:color-mix(in lab, red, red)){:root,:host{--color-line:color-mix(in oklab, var(--palette-paper) 10%, transparent)}}:root,:host{--color-line-strong:#ffffff26}@supports (color:color-mix(in lab, red, red)){:root,:host{--color-line-strong:color-mix(in oklab, var(--palette-paper) 15%, transparent)}}:root,:host{--color-line-control:#ffffff4d}@supports (color:color-mix(in lab, red, red)){:root,:host{--color-line-control:color-mix(in oklab, var(--palette-paper) 30%, transparent)}}:root,:host{--color-line-inverse:var(--palette-paper);--color-accent:var(--palette-sky);--color-accent-strong:var(--palette-sky-strong);--color-accent-fg:var(--palette-sky-soft);--color-focus:var(--color-accent);--color-success:var(--palette-emerald);--color-success-strong:var(--palette-emerald-strong);--color-success-fg:var(--palette-emerald-soft);--color-warning:var(--palette-amber);--color-warning-fg:var(--palette-amber-soft);--color-danger:var(--palette-rose);--color-danger-fg:var(--palette-rose-soft);--color-syntax-key:var(--palette-sky-soft);--color-syntax-string:var(--palette-emerald-soft);--color-syntax-number:var(--palette-amber-soft);--color-syntax-literal:var(--palette-violet-soft);--color-syntax-punctuation:var(--palette-dim)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}[data-devbelt] :where(button,[role=button],[role=tab],[role=switch],[role=checkbox],summary):not(:disabled,[aria-disabled=true]){cursor:pointer}[data-devbelt] [torph-sr]{clip-path:inset(50%);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:0}.inset-4{inset:calc(var(--spacing) * 4)}.inset-x-0{inset-inline:0}.inset-x-3{inset-inline:calc(var(--spacing) * 3)}.inset-y-0{inset-block:0}.inset-y-0\\.5{inset-block:calc(var(--spacing) * .5)}.inset-y-3{inset-block:calc(var(--spacing) * 3)}.-top-6{top:calc(var(--spacing) * -6)}.top-\\(--y\\){top:var(--y)}.top-0{top:0}.top-1{top:var(--spacing)}.top-4{top:calc(var(--spacing) * 4)}.right-0{right:0}.bottom-0{bottom:0}.bottom-4{bottom:calc(var(--spacing) * 4)}.left-\\(--x\\){left:var(--x)}.left-0{left:0}.isolate{isolation:isolate}.-z-10{z-index:calc(10 * -1)}.z-0{z-index:0}.z-10{z-index:10}.z-\\[9000\\]{z-index:9000}.z-\\[9999\\]{z-index:9999}.z-\\[10000\\]{z-index:10000}.z-\\[10001\\]{z-index:10001}.float-end{float:inline-end}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.m-0{margin:0}.mx-1{margin-inline:var(--spacing)}.mx-auto{margin-inline:auto}.my-1{margin-block:var(--spacing)}.ms-2{margin-inline-start:calc(var(--spacing) * 2)}.ms-auto{margin-inline-start:auto}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mb-1{margin-bottom:var(--spacing)}.mb-1\\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.ml-auto{margin-left:auto}.\\!hidden{display:none!important}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-flex{display:inline-flex}.table{display:table}@supports not selector(::-webkit-scrollbar){.scrollbar-slim{scrollbar-width:thin;scrollbar-color:var(--color-track) transparent}}.scrollbar-slim::-webkit-scrollbar{width:10px;height:10px}.scrollbar-slim::-webkit-scrollbar-track{background:0 0}.scrollbar-slim::-webkit-scrollbar-corner{background:0 0}.scrollbar-slim::-webkit-scrollbar-thumb{background-color:var(--color-track);background-clip:content-box;border:2px solid #0000;border-radius:9999px}.scrollbar-slim::-webkit-scrollbar-thumb:hover{background-color:var(--color-fg-disabled)}.size-2\\.5{width:calc(var(--spacing) * 2.5);height:calc(var(--spacing) * 2.5)}.size-3{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.size-3\\.5{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-6{width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.size-7{width:calc(var(--spacing) * 7);height:calc(var(--spacing) * 7)}.h-\\(--h\\){height:var(--h)}.h-1\\.5{height:calc(var(--spacing) * 1.5)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-\\[3px\\]{height:3px}.h-auto{height:auto}.h-px{height:1px}.max-h-\\(--available-height\\){max-height:var(--available-height)}.max-h-40{max-height:calc(var(--spacing) * 40)}.max-h-\\[40\\%\\]{max-height:40%}.max-h-none{max-height:none}.min-h-0{min-height:0}.min-h-6{min-height:calc(var(--spacing) * 6)}.min-h-16{min-height:calc(var(--spacing) * 16)}.w-\\(--w\\){width:var(--w)}.w-1\\.5{width:calc(var(--spacing) * 1.5)}.w-6{width:calc(var(--spacing) * 6)}.w-9{width:calc(var(--spacing) * 9)}.w-28{width:calc(var(--spacing) * 28)}.w-52{width:calc(var(--spacing) * 52)}.w-56{width:calc(var(--spacing) * 56)}.w-72{width:calc(var(--spacing) * 72)}.w-\\[3px\\]{width:3px}.w-\\[min\\(26rem\\,calc\\(100vw-2rem\\)\\)\\]{width:min(26rem,100vw - 2rem)}.w-\\[min\\(380px\\,calc\\(100vw-32px\\)\\)\\]{width:min(380px,100vw - 32px)}.w-auto{width:auto}.w-fit{width:fit-content}.w-full{width:100%}.w-px{width:1px}.max-w-full{max-width:100%}.max-w-none{max-width:none}.min-w-0{min-width:0}.min-w-4{min-width:calc(var(--spacing) * 4)}.min-w-6{min-width:calc(var(--spacing) * 6)}.min-w-10{min-width:calc(var(--spacing) * 10)}.min-w-56{min-width:calc(var(--spacing) * 56)}.flex-1{flex:1}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.\\[translate\\:var\\(--dock-x\\)_var\\(--dock-y\\)\\]{translate:var(--dock-x) var(--dock-y)}.transform{transform:var(--tw-rotate-x, ) var(--tw-rotate-y, ) var(--tw-rotate-z, ) var(--tw-skew-x, ) var(--tw-skew-y, )}.animate-pulse{animation:var(--animate-pulse)}.cursor-crosshair{cursor:crosshair}.cursor-default{cursor:default}.cursor-ew-resize{cursor:ew-resize}.cursor-grab{cursor:grab}.cursor-ns-resize{cursor:ns-resize}.cursor-nwse-resize{cursor:nwse-resize}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.resize{resize:both}.resize-none{resize:none}.grid-cols-\\[3\\.25rem_minmax\\(0\\,1fr\\)_2\\.25rem_3\\.25rem_minmax\\(0\\,1\\.4fr\\)\\]{grid-template-columns:3.25rem minmax(0,1fr) 2.25rem 3.25rem minmax(0,1.4fr)}.grid-cols-\\[3\\.25rem_minmax\\(0\\,1fr\\)_2rem_4\\.5rem\\]{grid-template-columns:3.25rem minmax(0,1fr) 2rem 4.5rem}.grid-cols-\\[max-content_minmax\\(0\\,1fr\\)\\]{grid-template-columns:max-content minmax(0,1fr)}.grid-cols-\\[minmax\\(0\\,12rem\\)_minmax\\(0\\,1fr\\)_auto_auto\\]{grid-template-columns:minmax(0,12rem) minmax(0,1fr) auto auto}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.place-items-center{place-items:center}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}:where(.space-y-1\\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-y-1{row-gap:var(--spacing)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:2147483647px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-br-xl{border-bottom-right-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r-\\[3px\\]{border-right-style:var(--tw-border-style);border-right-width:3px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-\\[3px\\]{border-bottom-style:var(--tw-border-style);border-bottom-width:3px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-accent{border-color:var(--color-accent)}.border-line{border-color:var(--color-line)}.border-line-control{border-color:var(--color-line-control)}.border-line-strong{border-color:var(--color-line-strong)}.border-success{border-color:var(--color-success)}.bg-accent{background-color:var(--color-accent)}.bg-accent-strong{background-color:var(--color-accent-strong)}.bg-accent\\/5{background-color:#00bcfe0d}@supports (color:color-mix(in lab, red, red)){.bg-accent\\/5{background-color:color-mix(in oklab, var(--color-accent) 5%, transparent)}}.bg-accent\\/10{background-color:#00bcfe1a}@supports (color:color-mix(in lab, red, red)){.bg-accent\\/10{background-color:color-mix(in oklab, var(--color-accent) 10%, transparent)}}.bg-accent\\/15{background-color:#00bcfe26}@supports (color:color-mix(in lab, red, red)){.bg-accent\\/15{background-color:color-mix(in oklab, var(--color-accent) 15%, transparent)}}.bg-accent\\/20{background-color:#00bcfe33}@supports (color:color-mix(in lab, red, red)){.bg-accent\\/20{background-color:color-mix(in oklab, var(--color-accent) 20%, transparent)}}.bg-accent\\/60{background-color:#00bcfe99}@supports (color:color-mix(in lab, red, red)){.bg-accent\\/60{background-color:color-mix(in oklab, var(--color-accent) 60%, transparent)}}.bg-accent\\/70{background-color:#00bcfeb3}@supports (color:color-mix(in lab, red, red)){.bg-accent\\/70{background-color:color-mix(in oklab, var(--color-accent) 70%, transparent)}}.bg-danger{background-color:var(--color-danger)}.bg-hover{background-color:var(--color-hover)}.bg-hover-subtle{background-color:var(--color-hover-subtle)}.bg-inverse{background-color:var(--color-inverse)}.bg-page{background-color:var(--color-page)}.bg-pressed{background-color:var(--color-pressed)}.bg-scrim{background-color:var(--color-scrim)}.bg-success{background-color:var(--color-success)}.bg-success-strong{background-color:var(--color-success-strong)}.bg-success\\/10{background-color:#00d2941a}@supports (color:color-mix(in lab, red, red)){.bg-success\\/10{background-color:color-mix(in oklab, var(--color-success) 10%, transparent)}}.bg-success\\/20{background-color:#00d29433}@supports (color:color-mix(in lab, red, red)){.bg-success\\/20{background-color:color-mix(in oklab, var(--color-success) 20%, transparent)}}.bg-surface{background-color:var(--color-surface)}.bg-surface-header{background-color:var(--color-surface-header)}.bg-surface-overlay{background-color:var(--color-surface-overlay)}.bg-surface-raised{background-color:var(--color-surface-raised)}.bg-surface-sticky{background-color:var(--color-surface-sticky)}.bg-track{background-color:var(--color-track)}.bg-transparent{background-color:#0000}.bg-warning{background-color:var(--color-warning)}.fill-current{fill:currentColor}.p-0{padding:0}.p-0\\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:var(--spacing)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.px-1{padding-inline:var(--spacing)}.px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-3\\.5{padding-inline:calc(var(--spacing) * 3.5)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\\.5{padding-block:calc(var(--spacing) * 2.5)}.py-4{padding-block:calc(var(--spacing) * 4)}.ps-3\\.5{padding-inline-start:calc(var(--spacing) * 3.5)}.ps-6{padding-inline-start:calc(var(--spacing) * 6)}.pe-1{padding-inline-end:var(--spacing)}.pt-1\\.5{padding-top:calc(var(--spacing) * 1.5)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pb-1{padding-bottom:var(--spacing)}.text-end{text-align:end}.text-start{text-align:start}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\\[10px\\]{font-size:10px}.text-\\[11px\\]{font-size:11px}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-accent-fg{color:var(--color-accent-fg)}.text-danger-fg{color:var(--color-danger-fg)}.text-fg{color:var(--color-fg)}.text-fg-disabled{color:var(--color-fg-disabled)}.text-fg-icon{color:var(--color-fg-icon)}.text-fg-inverse{color:var(--color-fg-inverse)}.text-fg-secondary{color:var(--color-fg-secondary)}.text-fg-tertiary{color:var(--color-fg-tertiary)}.text-success-fg{color:var(--color-success-fg)}.text-warning-fg{color:var(--color-warning-fg)}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal, ) var(--tw-slashed-zero, ) var(--tw-numeric-figure, ) var(--tw-numeric-spacing, ) var(--tw-numeric-fraction, )}.opacity-0{opacity:0}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset, ) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-line{--tw-ring-color:var(--color-line)}.ring-line-strong{--tw-ring-color:var(--color-line-strong)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.filter{filter:var(--tw-blur, ) var(--tw-brightness, ) var(--tw-contrast, ) var(--tw-grayscale, ) var(--tw-hue-rotate, ) var(--tw-invert, ) var(--tw-saturate, ) var(--tw-sepia, ) var(--tw-drop-shadow, )}.backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur, ) var(--tw-backdrop-brightness, ) var(--tw-backdrop-contrast, ) var(--tw-backdrop-grayscale, ) var(--tw-backdrop-hue-rotate, ) var(--tw-backdrop-invert, ) var(--tw-backdrop-opacity, ) var(--tw-backdrop-saturate, ) var(--tw-backdrop-sepia, );backdrop-filter:var(--tw-backdrop-blur, ) var(--tw-backdrop-brightness, ) var(--tw-backdrop-contrast, ) var(--tw-backdrop-grayscale, ) var(--tw-backdrop-hue-rotate, ) var(--tw-backdrop-invert, ) var(--tw-backdrop-opacity, ) var(--tw-backdrop-saturate, ) var(--tw-backdrop-sepia, )}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[opacity\\,scale\\]{transition-property:opacity,scale;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-75{--tw-duration:75ms;transition-duration:75ms}.duration-\\[240ms\\]{--tw-duration:.24s;transition-duration:.24s}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.running{animation-play-state:running}@media (hover:hover){:is(:where(.group):hover .group-hover\\:opacity-100){opacity:1}}:is(:where(.group):active .group-active\\:opacity-100){opacity:1}.placeholder\\:text-fg-disabled::placeholder{color:var(--color-fg-disabled)}.backdrop\\:bg-scrim::backdrop{background-color:var(--color-scrim)}.after\\:absolute:after{content:var(--tw-content);position:absolute}.after\\:-inset-1:after{content:var(--tw-content);inset:calc(var(--spacing) * -1)}.after\\:inset-x-0:after{content:var(--tw-content);inset-inline:0}.after\\:-inset-y-0\\.5:after{content:var(--tw-content);inset-block:calc(var(--spacing) * -.5)}.after\\:-inset-y-1:after{content:var(--tw-content);inset-block:calc(var(--spacing) * -1)}@media (hover:hover){.hover\\:bg-hover:hover{background-color:var(--color-hover)}.hover\\:bg-hover-subtle:hover{background-color:var(--color-hover-subtle)}.hover\\:bg-inverse:hover{background-color:var(--color-inverse)}.hover\\:bg-inverse-hover:hover{background-color:var(--color-inverse-hover)}.hover\\:bg-success:hover{background-color:var(--color-success)}.hover\\:bg-surface-raised:hover{background-color:var(--color-surface-raised)}.hover\\:text-fg:hover{color:var(--color-fg)}}.focus-visible\\:outline-2:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.focus-visible\\:outline-offset-1:focus-visible{outline-offset:1px}.focus-visible\\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\\:outline-focus:focus-visible{outline-color:var(--color-focus)}.active\\:cursor-grabbing:active{cursor:grabbing}.disabled\\:opacity-40:disabled{opacity:.4}.data-checked\\:border-line-inverse[data-checked]{border-color:var(--color-line-inverse)}.data-checked\\:bg-inverse[data-checked]{background-color:var(--color-inverse)}.data-checked\\:bg-surface[data-checked]{background-color:var(--color-surface)}.data-checked\\:text-fg-inverse[data-checked]{color:var(--color-fg-inverse)}.data-disabled\\:opacity-40[data-disabled]{opacity:.4}.data-ending-style\\:opacity-0[data-ending-style]{opacity:0}.data-ending-style\\:duration-\\[160ms\\][data-ending-style]{--tw-duration:.16s;transition-duration:.16s}.data-highlighted\\:bg-hover-subtle[data-highlighted]{background-color:var(--color-hover-subtle)}.data-pressed\\:border-line-inverse[data-pressed]{border-color:var(--color-line-inverse)}.data-pressed\\:bg-accent\\/20[data-pressed]{background-color:#00bcfe33}@supports (color:color-mix(in lab, red, red)){.data-pressed\\:bg-accent\\/20[data-pressed]{background-color:color-mix(in oklab, var(--color-accent) 20%, transparent)}}.data-pressed\\:bg-inverse[data-pressed]{background-color:var(--color-inverse)}.data-pressed\\:bg-pressed[data-pressed]{background-color:var(--color-pressed)}.data-pressed\\:text-fg-inverse[data-pressed]{color:var(--color-fg-inverse)}@media (hover:hover){.data-pressed\\:hover\\:bg-transparent[data-pressed]:hover{background-color:#0000}}.data-selected\\:bg-accent\\/15[data-selected]{background-color:#00bcfe26}@supports (color:color-mix(in lab, red, red)){.data-selected\\:bg-accent\\/15[data-selected]{background-color:color-mix(in oklab, var(--color-accent) 15%, transparent)}}.data-selected\\:bg-hover[data-selected]{background-color:var(--color-hover)}.data-selected\\:text-fg[data-selected]{color:var(--color-fg)}.data-starting-style\\:scale-\\[0\\.98\\][data-starting-style]{scale:.98}.data-starting-style\\:opacity-0[data-starting-style]{opacity:0}.data-unchecked\\:invisible[data-unchecked]{visibility:hidden}@media (prefers-reduced-motion:reduce){.motion-reduce\\:transition-none{transition-property:none}}.\\[\\&_\\.hljs-attr\\]\\:text-syntax-key .hljs-attr{color:var(--color-syntax-key)}.\\[\\&_\\.hljs-literal\\]\\:text-syntax-literal .hljs-literal{color:var(--color-syntax-literal)}.\\[\\&_\\.hljs-number\\]\\:text-syntax-number .hljs-number{color:var(--color-syntax-number)}.\\[\\&_\\.hljs-punctuation\\]\\:text-syntax-punctuation .hljs-punctuation{color:var(--color-syntax-punctuation)}.\\[\\&_\\.hljs-string\\]\\:text-syntax-string .hljs-string{color:var(--color-syntax-string)}.\\[\\&_pre\\]\\:text-\\[13px\\] pre{font-size:13px}.\\[\\&_svg\\]\\:size-3 svg{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.\\[\\&_svg\\]\\:text-accent-fg svg{color:var(--color-accent-fg)}.\\[\\&_svg\\]\\:text-fg-icon svg{color:var(--color-fg-icon)}.\\[\\&_svg\\]\\:text-fg-inverse svg{color:var(--color-fg-inverse)}.\\[\\&_svg\\]\\:transition-colors svg{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.\\[\\&_svg\\]\\:duration-75 svg{--tw-duration:75ms;transition-duration:75ms}.data-pressed\\:\\[\\&_svg\\]\\:text-accent-fg[data-pressed] svg{color:var(--color-accent-fg)}.data-pressed\\:\\[\\&_svg\\]\\:text-fg[data-pressed] svg{color:var(--color-fg)}}[data-devbelt-hidden] [data-devbelt-hud]{display:none}@keyframes pulse{50%{opacity:.5}}';
|
|
1050
|
+
|
|
1051
|
+
// src/ui/toolbar-root.tsx
|
|
1052
|
+
var HOST_TAG = "devbelt-root";
|
|
1053
|
+
var PROPERTY_STYLE_ID = "devbelt-properties";
|
|
1054
|
+
var HOST_CSS = `:host{all:initial;display:contents;font:12px/1.5 ui-sans-serif,system-ui,sans-serif;color:var(--color-fg);-webkit-font-smoothing:antialiased}`;
|
|
1055
|
+
function ensurePropertyStyles() {
|
|
1056
|
+
if (document.getElementById(PROPERTY_STYLE_ID)) return;
|
|
1057
|
+
const style = document.createElement("style");
|
|
1058
|
+
style.id = PROPERTY_STYLE_ID;
|
|
1059
|
+
style.textContent = PROPERTY_CSS;
|
|
1060
|
+
document.head.append(style);
|
|
1061
|
+
}
|
|
1062
|
+
function useMount(isolation, pluginCss) {
|
|
1063
|
+
const [mount, setMount] = useState4(null);
|
|
1064
|
+
const cssKey = pluginCss.join("\n");
|
|
1065
|
+
useLayoutEffect2(() => {
|
|
1066
|
+
const host = document.createElement(HOST_TAG);
|
|
1067
|
+
host.setAttribute("data-react-grab-ignore", "");
|
|
1068
|
+
const container = document.createElement("div");
|
|
1069
|
+
container.setAttribute("data-devbelt", "");
|
|
1070
|
+
let root = document;
|
|
1071
|
+
if (isolation === "shadow") {
|
|
1072
|
+
ensurePropertyStyles();
|
|
1073
|
+
const shadow = host.attachShadow({ mode: "open" });
|
|
1074
|
+
const style = document.createElement("style");
|
|
1075
|
+
style.textContent = `${HOST_CSS}${TOOLBAR_CSS}${cssKey}`;
|
|
1076
|
+
shadow.append(style, container);
|
|
1077
|
+
root = shadow;
|
|
1078
|
+
} else {
|
|
1079
|
+
if (cssKey) {
|
|
1080
|
+
const style = document.createElement("style");
|
|
1081
|
+
style.textContent = cssKey;
|
|
1082
|
+
host.append(style);
|
|
1083
|
+
}
|
|
1084
|
+
host.append(container);
|
|
1085
|
+
}
|
|
1086
|
+
document.body.append(host);
|
|
1087
|
+
setMount({ container, root });
|
|
1088
|
+
return () => {
|
|
1089
|
+
host.remove();
|
|
1090
|
+
setMount(null);
|
|
1091
|
+
};
|
|
1092
|
+
}, [isolation, cssKey]);
|
|
1093
|
+
return mount;
|
|
1094
|
+
}
|
|
1095
|
+
function ToolbarPortal({
|
|
1096
|
+
mount,
|
|
1097
|
+
children
|
|
1098
|
+
}) {
|
|
1099
|
+
return mount ? createPortal(children, mount.container) : null;
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
// src/ui/use-dock-position.ts
|
|
1103
|
+
import { useEffect as useEffect4, useRef as useRef4, useState as useState5 } from "react";
|
|
1104
|
+
var STORAGE_KEY2 = "position";
|
|
1105
|
+
var ORIGIN = { x: 0, y: 0 };
|
|
1106
|
+
var MARGIN3 = 8;
|
|
1107
|
+
var STEP2 = 8;
|
|
1108
|
+
var LARGE_STEP2 = 40;
|
|
1109
|
+
var DRAG_THRESHOLD2 = 4;
|
|
1110
|
+
var SNAP_DISTANCE = 12;
|
|
1111
|
+
var SNAP_EDGE_GAP = 16;
|
|
1112
|
+
var NO_GUIDES = { x: null, y: null };
|
|
1113
|
+
function read2() {
|
|
1114
|
+
const parsed = readJson(STORAGE_KEY2, null);
|
|
1115
|
+
return typeof parsed?.x === "number" && typeof parsed.y === "number" ? { x: parsed.x, y: parsed.y } : ORIGIN;
|
|
1116
|
+
}
|
|
1117
|
+
function write(position) {
|
|
1118
|
+
if (position.x === 0 && position.y === 0) writeString(STORAGE_KEY2, null);
|
|
1119
|
+
else writeJson(STORAGE_KEY2, position);
|
|
1120
|
+
}
|
|
1121
|
+
var clamp = (value, min, max) => Math.min(Math.max(value, min), Math.max(min, max));
|
|
1122
|
+
function snapAxis(offset, from, lo, hi, size) {
|
|
1123
|
+
const shift = offset - from;
|
|
1124
|
+
const a = lo + shift;
|
|
1125
|
+
const b = hi + shift;
|
|
1126
|
+
const targets = [
|
|
1127
|
+
{ delta: SNAP_EDGE_GAP - a, guide: SNAP_EDGE_GAP },
|
|
1128
|
+
{ delta: size - SNAP_EDGE_GAP - b, guide: size - SNAP_EDGE_GAP },
|
|
1129
|
+
{ delta: size / 2 - (a + b) / 2, guide: size / 2 }
|
|
1130
|
+
];
|
|
1131
|
+
const best = targets.filter((t) => Math.abs(t.delta) <= SNAP_DISTANCE).sort((p, q) => Math.abs(p.delta) - Math.abs(q.delta))[0];
|
|
1132
|
+
return best ? { offset: offset + best.delta, guide: best.guide } : { offset, guide: null };
|
|
1133
|
+
}
|
|
1134
|
+
function useDockPosition(collapsed) {
|
|
1135
|
+
const dockRef = useRef4(null);
|
|
1136
|
+
const [position, setPosition] = useState5(read2);
|
|
1137
|
+
const [guides, setGuides] = useState5(NO_GUIDES);
|
|
1138
|
+
const current = useRef4(position);
|
|
1139
|
+
const stopDrag = useRef4(void 0);
|
|
1140
|
+
const paint = (next) => {
|
|
1141
|
+
const dock = dockRef.current;
|
|
1142
|
+
dock?.style.setProperty("--dock-x", `${next.x}px`);
|
|
1143
|
+
dock?.style.setProperty("--dock-y", `${next.y}px`);
|
|
1144
|
+
};
|
|
1145
|
+
const commit = (next) => {
|
|
1146
|
+
current.current = next;
|
|
1147
|
+
setPosition(next);
|
|
1148
|
+
paint(next);
|
|
1149
|
+
write(next);
|
|
1150
|
+
};
|
|
1151
|
+
const bounds = () => {
|
|
1152
|
+
const parts = dockRef.current?.querySelectorAll("[data-dock]");
|
|
1153
|
+
let left = Infinity;
|
|
1154
|
+
let top = Infinity;
|
|
1155
|
+
let right = -Infinity;
|
|
1156
|
+
let bottom = -Infinity;
|
|
1157
|
+
parts?.forEach((part) => {
|
|
1158
|
+
if (collapsed && part.dataset.dock === "toolbar") return;
|
|
1159
|
+
const rect = part.getBoundingClientRect();
|
|
1160
|
+
left = Math.min(left, rect.left);
|
|
1161
|
+
top = Math.min(top, rect.top);
|
|
1162
|
+
right = Math.max(right, rect.right);
|
|
1163
|
+
bottom = Math.max(bottom, rect.bottom);
|
|
1164
|
+
});
|
|
1165
|
+
return Number.isFinite(left) ? { left, top, right, bottom } : null;
|
|
1166
|
+
};
|
|
1167
|
+
const fit = (desired, from) => {
|
|
1168
|
+
const box = bounds();
|
|
1169
|
+
if (!box) return desired;
|
|
1170
|
+
return {
|
|
1171
|
+
x: clamp(
|
|
1172
|
+
desired.x,
|
|
1173
|
+
from.x + MARGIN3 - box.left,
|
|
1174
|
+
from.x + window.innerWidth - MARGIN3 - box.right
|
|
1175
|
+
),
|
|
1176
|
+
y: clamp(
|
|
1177
|
+
desired.y,
|
|
1178
|
+
from.y + MARGIN3 - box.top,
|
|
1179
|
+
from.y + window.innerHeight - MARGIN3 - box.bottom
|
|
1180
|
+
)
|
|
1181
|
+
};
|
|
1182
|
+
};
|
|
1183
|
+
useEffect4(() => {
|
|
1184
|
+
const onResize = () => {
|
|
1185
|
+
const fitted = fit(current.current, current.current);
|
|
1186
|
+
if (fitted.x !== current.current.x || fitted.y !== current.current.y) {
|
|
1187
|
+
commit(fitted);
|
|
1188
|
+
}
|
|
1189
|
+
};
|
|
1190
|
+
window.addEventListener("resize", onResize);
|
|
1191
|
+
return () => {
|
|
1192
|
+
window.removeEventListener("resize", onResize);
|
|
1193
|
+
stopDrag.current?.();
|
|
1194
|
+
};
|
|
1195
|
+
}, [collapsed]);
|
|
1196
|
+
const startDrag = (event) => {
|
|
1197
|
+
if (event.button !== 0) return;
|
|
1198
|
+
stopDrag.current?.();
|
|
1199
|
+
const from = current.current;
|
|
1200
|
+
const box = bounds();
|
|
1201
|
+
const origin = { x: event.clientX, y: event.clientY };
|
|
1202
|
+
stopDrag.current = bindDrag(event.currentTarget, event.nativeEvent, {
|
|
1203
|
+
threshold: DRAG_THRESHOLD2,
|
|
1204
|
+
cancelOnEscape: true,
|
|
1205
|
+
onMove: ({ x, y, event: move }) => {
|
|
1206
|
+
const desired = {
|
|
1207
|
+
x: from.x + x - origin.x,
|
|
1208
|
+
y: from.y + y - origin.y
|
|
1209
|
+
};
|
|
1210
|
+
if (!box) return paint(desired);
|
|
1211
|
+
const clamped = {
|
|
1212
|
+
x: clamp(
|
|
1213
|
+
desired.x,
|
|
1214
|
+
from.x + MARGIN3 - box.left,
|
|
1215
|
+
from.x + window.innerWidth - MARGIN3 - box.right
|
|
1216
|
+
),
|
|
1217
|
+
y: clamp(
|
|
1218
|
+
desired.y,
|
|
1219
|
+
from.y + MARGIN3 - box.top,
|
|
1220
|
+
from.y + window.innerHeight - MARGIN3 - box.bottom
|
|
1221
|
+
)
|
|
1222
|
+
};
|
|
1223
|
+
if (move.altKey) {
|
|
1224
|
+
setGuides((g) => g.x === null && g.y === null ? g : NO_GUIDES);
|
|
1225
|
+
return paint(clamped);
|
|
1226
|
+
}
|
|
1227
|
+
const snapX = snapAxis(
|
|
1228
|
+
clamped.x,
|
|
1229
|
+
from.x,
|
|
1230
|
+
box.left,
|
|
1231
|
+
box.right,
|
|
1232
|
+
window.innerWidth
|
|
1233
|
+
);
|
|
1234
|
+
const snapY = snapAxis(
|
|
1235
|
+
clamped.y,
|
|
1236
|
+
from.y,
|
|
1237
|
+
box.top,
|
|
1238
|
+
box.bottom,
|
|
1239
|
+
window.innerHeight
|
|
1240
|
+
);
|
|
1241
|
+
paint({ x: snapX.offset, y: snapY.offset });
|
|
1242
|
+
setGuides(
|
|
1243
|
+
(g) => g.x === snapX.guide && g.y === snapY.guide ? g : { x: snapX.guide, y: snapY.guide }
|
|
1244
|
+
);
|
|
1245
|
+
},
|
|
1246
|
+
onEnd: (_event, canceled) => {
|
|
1247
|
+
setGuides(NO_GUIDES);
|
|
1248
|
+
if (canceled) {
|
|
1249
|
+
paint(from);
|
|
1250
|
+
return;
|
|
1251
|
+
}
|
|
1252
|
+
const x = parseFloat(
|
|
1253
|
+
dockRef.current?.style.getPropertyValue("--dock-x") ?? ""
|
|
1254
|
+
);
|
|
1255
|
+
const y = parseFloat(
|
|
1256
|
+
dockRef.current?.style.getPropertyValue("--dock-y") ?? ""
|
|
1257
|
+
);
|
|
1258
|
+
if (Number.isFinite(x) && Number.isFinite(y)) commit({ x, y });
|
|
1259
|
+
}
|
|
1260
|
+
});
|
|
1261
|
+
};
|
|
1262
|
+
const onKeyDown = (event) => {
|
|
1263
|
+
if (!event.altKey) return;
|
|
1264
|
+
const delta = {
|
|
1265
|
+
ArrowLeft: { x: -1, y: 0 },
|
|
1266
|
+
ArrowRight: { x: 1, y: 0 },
|
|
1267
|
+
ArrowUp: { x: 0, y: -1 },
|
|
1268
|
+
ArrowDown: { x: 0, y: 1 }
|
|
1269
|
+
}[event.key];
|
|
1270
|
+
if (!delta) return;
|
|
1271
|
+
event.preventDefault();
|
|
1272
|
+
event.stopPropagation();
|
|
1273
|
+
const step = event.shiftKey ? LARGE_STEP2 : STEP2;
|
|
1274
|
+
const from = current.current;
|
|
1275
|
+
commit(
|
|
1276
|
+
fit({ x: from.x + delta.x * step, y: from.y + delta.y * step }, from)
|
|
1277
|
+
);
|
|
1278
|
+
};
|
|
1279
|
+
const reset = () => commit(ORIGIN);
|
|
1280
|
+
return { dockRef, position, guides, startDrag, onKeyDown, reset };
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
// src/ui/toolbar.tsx
|
|
1284
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1285
|
+
var COLLAPSE_KEY = "collapsed";
|
|
1286
|
+
var OPEN_POPUP = '[data-slot$="-content"][data-open]:not([data-slot="tooltip-content"])';
|
|
1287
|
+
function ToolbarImpl({
|
|
1288
|
+
plugins,
|
|
1289
|
+
isolation,
|
|
1290
|
+
panelMode,
|
|
1291
|
+
aiTools
|
|
1292
|
+
}) {
|
|
1293
|
+
const [embedded] = useState6(() => window.self !== window.top);
|
|
1294
|
+
const key = plugins.map((p) => p.id).join("|");
|
|
1295
|
+
useEffect5(() => installPlugins(plugins), [key]);
|
|
1296
|
+
useEffect5(
|
|
1297
|
+
() => embedded ? installToolbarShortcuts({
|
|
1298
|
+
collapse: () => forwardToTop(COLLAPSE_EVENT),
|
|
1299
|
+
hide: () => forwardToTop(HIDE_EVENT)
|
|
1300
|
+
}) : void 0,
|
|
1301
|
+
[embedded]
|
|
1302
|
+
);
|
|
1303
|
+
return embedded ? null : /* @__PURE__ */ jsx6(
|
|
1304
|
+
TopToolbar,
|
|
1305
|
+
{
|
|
1306
|
+
plugins,
|
|
1307
|
+
isolation,
|
|
1308
|
+
panelMode,
|
|
1309
|
+
aiTools
|
|
1310
|
+
}
|
|
1311
|
+
);
|
|
1312
|
+
}
|
|
1313
|
+
function TopToolbar({ plugins, isolation, panelMode, aiTools }) {
|
|
1314
|
+
const pluginCss = useMemo2(
|
|
1315
|
+
() => plugins.flatMap((p) => p.styles ? [p.styles] : []),
|
|
1316
|
+
[plugins]
|
|
1317
|
+
);
|
|
1318
|
+
const mount = useMount(isolation, pluginCss);
|
|
1319
|
+
const [collapsed, setCollapsed] = useState6(
|
|
1320
|
+
() => readString(COLLAPSE_KEY) === "1"
|
|
1321
|
+
);
|
|
1322
|
+
const [hidden, setHidden] = useState6(false);
|
|
1323
|
+
const dock = useDockPosition(collapsed);
|
|
1324
|
+
const layout = useDevLayout(plugins, panelMode);
|
|
1325
|
+
const live = useRef5({ layout, plugins, aiTools, hidden });
|
|
1326
|
+
const escapeHolds = useRef5(0);
|
|
1327
|
+
useEffect5(() => {
|
|
1328
|
+
live.current = { layout, plugins, aiTools, hidden };
|
|
1329
|
+
});
|
|
1330
|
+
const api = useMemo2(
|
|
1331
|
+
() => mount ? {
|
|
1332
|
+
container: mount.container,
|
|
1333
|
+
root: mount.root,
|
|
1334
|
+
openWindow: (id) => live.current.layout.open(id),
|
|
1335
|
+
closeWindow: (id) => live.current.layout.close(id),
|
|
1336
|
+
toggleWindow: (id) => live.current.layout.toggle(id),
|
|
1337
|
+
get aiTools() {
|
|
1338
|
+
return live.current.aiTools ?? defaultAiTools;
|
|
1339
|
+
},
|
|
1340
|
+
debugContext: () => collectDebugContext(live.current.plugins),
|
|
1341
|
+
debugSections: () => live.current.plugins.flatMap((p) => {
|
|
1342
|
+
try {
|
|
1343
|
+
return p.debugSections?.() ?? [];
|
|
1344
|
+
} catch {
|
|
1345
|
+
return [];
|
|
1346
|
+
}
|
|
1347
|
+
}),
|
|
1348
|
+
setHidden: (next) => setHidden(next),
|
|
1349
|
+
isHidden: () => live.current.hidden,
|
|
1350
|
+
holdEscape: () => {
|
|
1351
|
+
escapeHolds.current++;
|
|
1352
|
+
let released = false;
|
|
1353
|
+
return () => {
|
|
1354
|
+
if (!released) {
|
|
1355
|
+
released = true;
|
|
1356
|
+
escapeHolds.current--;
|
|
1357
|
+
}
|
|
1358
|
+
};
|
|
1359
|
+
}
|
|
1360
|
+
} : null,
|
|
1361
|
+
[mount]
|
|
1362
|
+
);
|
|
1363
|
+
const toolKey = plugins.map((p) => `${p.id}:${p.agent?.write === true}`).join("|");
|
|
1364
|
+
const apiRef = useRef5(api);
|
|
1365
|
+
useEffect5(() => {
|
|
1366
|
+
apiRef.current = api;
|
|
1367
|
+
});
|
|
1368
|
+
useEffect5(
|
|
1369
|
+
() => registerAgentTools(
|
|
1370
|
+
exposedAgentTools(plugins),
|
|
1371
|
+
() => apiRef.current
|
|
1372
|
+
),
|
|
1373
|
+
[toolKey]
|
|
1374
|
+
// eslint-disable-line react-hooks/exhaustive-deps
|
|
1375
|
+
);
|
|
1376
|
+
useEffect5(() => {
|
|
1377
|
+
const onKey = (event) => {
|
|
1378
|
+
if (event.key !== "Escape" || event.defaultPrevented) return;
|
|
1379
|
+
const { layout: current } = live.current;
|
|
1380
|
+
if (live.current.hidden || escapeHolds.current > 0 || current.layout.open.length === 0) {
|
|
1381
|
+
return;
|
|
1382
|
+
}
|
|
1383
|
+
const root = mount?.root ?? document;
|
|
1384
|
+
if (root.querySelector(OPEN_POPUP) || document.querySelector(OPEN_POPUP)) {
|
|
1385
|
+
return;
|
|
1386
|
+
}
|
|
1387
|
+
event.preventDefault();
|
|
1388
|
+
current.close(current.layout.open[current.layout.open.length - 1]);
|
|
1389
|
+
};
|
|
1390
|
+
window.addEventListener("keydown", onKey);
|
|
1391
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
1392
|
+
}, [mount]);
|
|
1393
|
+
const toggleCollapsed = () => setCollapsed((current) => {
|
|
1394
|
+
writeString(COLLAPSE_KEY, current ? "0" : "1");
|
|
1395
|
+
return !current;
|
|
1396
|
+
});
|
|
1397
|
+
const toggleHidden = () => setHidden((current) => !current);
|
|
1398
|
+
useEffect5(() => {
|
|
1399
|
+
mount?.container.toggleAttribute("data-devbelt-hidden", hidden);
|
|
1400
|
+
}, [mount, hidden]);
|
|
1401
|
+
const shortcutActions = useRef5({ collapse: () => {
|
|
1402
|
+
}, hide: () => {
|
|
1403
|
+
} });
|
|
1404
|
+
useEffect5(() => {
|
|
1405
|
+
shortcutActions.current = {
|
|
1406
|
+
collapse: () => live.current.hidden ? setHidden(false) : toggleCollapsed(),
|
|
1407
|
+
hide: toggleHidden
|
|
1408
|
+
};
|
|
1409
|
+
});
|
|
1410
|
+
useEffect5(() => {
|
|
1411
|
+
const collapse = () => shortcutActions.current.collapse();
|
|
1412
|
+
const hide = () => shortcutActions.current.hide();
|
|
1413
|
+
const off = installToolbarShortcuts({ collapse, hide });
|
|
1414
|
+
window.addEventListener(COLLAPSE_EVENT, collapse);
|
|
1415
|
+
window.addEventListener(HIDE_EVENT, hide);
|
|
1416
|
+
return () => {
|
|
1417
|
+
off();
|
|
1418
|
+
window.removeEventListener(COLLAPSE_EVENT, collapse);
|
|
1419
|
+
window.removeEventListener(HIDE_EVENT, hide);
|
|
1420
|
+
};
|
|
1421
|
+
}, []);
|
|
1422
|
+
const run = (plugin) => {
|
|
1423
|
+
if (!api) return;
|
|
1424
|
+
if (plugin.window) layout.open(plugin.id);
|
|
1425
|
+
else void plugin.run?.(api);
|
|
1426
|
+
};
|
|
1427
|
+
if (!api) return null;
|
|
1428
|
+
const pinned = plugins.filter((p) => layout.isPinned(p));
|
|
1429
|
+
const byId = new Map(plugins.map((p) => [p.id, p]));
|
|
1430
|
+
const popoverId = layout.mode === "popover" && !collapsed ? layout.layout.open.at(-1) : void 0;
|
|
1431
|
+
const popover = popoverId ? byId.get(popoverId) : void 0;
|
|
1432
|
+
return /* @__PURE__ */ jsx6(ToolbarContext.Provider, { value: api, children: /* @__PURE__ */ jsx6(MotionConfig, { reducedMotion: "user", children: /* @__PURE__ */ jsxs6(ToolbarPortal, { mount, children: [
|
|
1433
|
+
plugins.map(
|
|
1434
|
+
(plugin) => plugin.Overlay ? /* @__PURE__ */ jsx6(PluginBoundary, { plugin: plugin.id, children: /* @__PURE__ */ jsx6(plugin.Overlay, {}) }, plugin.id) : null
|
|
1435
|
+
),
|
|
1436
|
+
/* @__PURE__ */ jsxs6("div", { style: { display: hidden ? "none" : "contents" }, children: [
|
|
1437
|
+
popover?.window ? /* @__PURE__ */ jsx6(
|
|
1438
|
+
PluginPopover,
|
|
1439
|
+
{
|
|
1440
|
+
id: popover.id,
|
|
1441
|
+
title: popover.window.title ?? popover.name,
|
|
1442
|
+
icon: popover.icon,
|
|
1443
|
+
size: popover.window.size,
|
|
1444
|
+
root: api.root,
|
|
1445
|
+
onClose: () => layout.close(popover.id),
|
|
1446
|
+
children: /* @__PURE__ */ jsx6(popover.window.Component, {})
|
|
1447
|
+
},
|
|
1448
|
+
popover.id
|
|
1449
|
+
) : null,
|
|
1450
|
+
layout.mode === "window" ? layout.layout.open.map((id, index) => {
|
|
1451
|
+
const plugin = byId.get(id);
|
|
1452
|
+
if (!plugin?.window) return null;
|
|
1453
|
+
const { Component: Component2, size, title } = plugin.window;
|
|
1454
|
+
return /* @__PURE__ */ jsx6(
|
|
1455
|
+
FloatingWindow,
|
|
1456
|
+
{
|
|
1457
|
+
id,
|
|
1458
|
+
size,
|
|
1459
|
+
title: title ?? plugin.name,
|
|
1460
|
+
icon: plugin.icon,
|
|
1461
|
+
rect: clampRect(
|
|
1462
|
+
size,
|
|
1463
|
+
layout.layout.rects[id] ?? defaultRect(size, index)
|
|
1464
|
+
),
|
|
1465
|
+
stack: index,
|
|
1466
|
+
onFocus: () => layout.focus(id),
|
|
1467
|
+
onClose: () => layout.close(id),
|
|
1468
|
+
onRect: (rect) => layout.setRect(id, rect),
|
|
1469
|
+
children: /* @__PURE__ */ jsx6(PluginBoundary, { plugin: id, children: /* @__PURE__ */ jsx6(Component2, {}) })
|
|
1470
|
+
},
|
|
1471
|
+
id
|
|
1472
|
+
);
|
|
1473
|
+
}) : null,
|
|
1474
|
+
dock.guides.x !== null ? /* @__PURE__ */ jsx6(
|
|
1475
|
+
"div",
|
|
1476
|
+
{
|
|
1477
|
+
"data-react-grab-ignore": true,
|
|
1478
|
+
"data-dock-guide": "x",
|
|
1479
|
+
"aria-hidden": "true",
|
|
1480
|
+
className: "pointer-events-none fixed inset-y-0 z-[9999] w-px bg-accent/70",
|
|
1481
|
+
style: { left: dock.guides.x }
|
|
1482
|
+
}
|
|
1483
|
+
) : null,
|
|
1484
|
+
dock.guides.y !== null ? /* @__PURE__ */ jsx6(
|
|
1485
|
+
"div",
|
|
1486
|
+
{
|
|
1487
|
+
"data-react-grab-ignore": true,
|
|
1488
|
+
"data-dock-guide": "y",
|
|
1489
|
+
"aria-hidden": "true",
|
|
1490
|
+
className: "pointer-events-none fixed inset-x-0 z-[9999] h-px bg-accent/70",
|
|
1491
|
+
style: { top: dock.guides.y }
|
|
1492
|
+
}
|
|
1493
|
+
) : null,
|
|
1494
|
+
/* @__PURE__ */ jsxs6(
|
|
1495
|
+
"div",
|
|
1496
|
+
{
|
|
1497
|
+
ref: dock.dockRef,
|
|
1498
|
+
className: "pointer-events-none fixed inset-0 z-[10000] [translate:var(--dock-x)_var(--dock-y)]",
|
|
1499
|
+
style: {
|
|
1500
|
+
"--dock-x": `${dock.position.x}px`,
|
|
1501
|
+
"--dock-y": `${dock.position.y}px`
|
|
1502
|
+
},
|
|
1503
|
+
children: [
|
|
1504
|
+
/* @__PURE__ */ jsx6(
|
|
1505
|
+
motion.div,
|
|
1506
|
+
{
|
|
1507
|
+
"data-react-grab-ignore": true,
|
|
1508
|
+
"data-dock": "chip",
|
|
1509
|
+
initial: false,
|
|
1510
|
+
animate: { y: collapsed ? 0 : "-3.25rem" },
|
|
1511
|
+
transition: spring.moderate,
|
|
1512
|
+
className: "pointer-events-none fixed inset-x-0 bottom-4 z-[10000] mx-auto flex w-fit",
|
|
1513
|
+
children: /* @__PURE__ */ jsxs6(Tooltip, { children: [
|
|
1514
|
+
/* @__PURE__ */ jsxs6(
|
|
1515
|
+
TooltipTrigger,
|
|
1516
|
+
{
|
|
1517
|
+
render: /* @__PURE__ */ jsx6(
|
|
1518
|
+
Button,
|
|
1519
|
+
{
|
|
1520
|
+
onPointerDown: dock.startDrag,
|
|
1521
|
+
"aria-label": collapsed ? "Show dev tools" : "Hide dev tools",
|
|
1522
|
+
"aria-expanded": !collapsed,
|
|
1523
|
+
"aria-keyshortcuts": ariaKeyshortcuts(COLLAPSE_SHORTCUT),
|
|
1524
|
+
onClick: toggleCollapsed
|
|
1525
|
+
}
|
|
1526
|
+
),
|
|
1527
|
+
className: "pointer-events-auto flex h-7 w-fit items-center justify-center gap-1.5 rounded-full border border-line bg-surface px-3 text-xs font-medium text-fg shadow-lg hover:bg-surface-raised focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",
|
|
1528
|
+
children: [
|
|
1529
|
+
/* @__PURE__ */ jsx6(
|
|
1530
|
+
motion.span,
|
|
1531
|
+
{
|
|
1532
|
+
initial: false,
|
|
1533
|
+
animate: { rotate: collapsed ? 180 : 0 },
|
|
1534
|
+
transition: spring.fast,
|
|
1535
|
+
className: "inline-flex",
|
|
1536
|
+
children: /* @__PURE__ */ jsx6(ChevronDownIcon, { className: "size-3.5 text-fg-icon", "aria-hidden": "true" })
|
|
1537
|
+
}
|
|
1538
|
+
),
|
|
1539
|
+
collapsed ? /* @__PURE__ */ jsx6(
|
|
1540
|
+
motion.span,
|
|
1541
|
+
{
|
|
1542
|
+
initial: { opacity: 0, y: 4 },
|
|
1543
|
+
animate: { opacity: 1, y: 0 },
|
|
1544
|
+
transition: spring.fast,
|
|
1545
|
+
className: "inline-flex items-center gap-1.5",
|
|
1546
|
+
children: plugins.map(
|
|
1547
|
+
(plugin) => plugin.ChipStatus ? /* @__PURE__ */ jsx6(PluginBoundary, { plugin: plugin.id, children: /* @__PURE__ */ jsx6(plugin.ChipStatus, {}) }, plugin.id) : null
|
|
1548
|
+
)
|
|
1549
|
+
}
|
|
1550
|
+
) : null
|
|
1551
|
+
]
|
|
1552
|
+
}
|
|
1553
|
+
),
|
|
1554
|
+
/* @__PURE__ */ jsxs6(TooltipContent, { side: "top", sideOffset: 8, className: `${tooltipClass} flex-col items-start`, children: [
|
|
1555
|
+
/* @__PURE__ */ jsxs6("span", { className: "flex items-center gap-2", children: [
|
|
1556
|
+
collapsed ? "Show the toolbar" : "Collapse the toolbar",
|
|
1557
|
+
/* @__PURE__ */ jsx6("kbd", { className: kbdClass, children: collapseLabel() })
|
|
1558
|
+
] }),
|
|
1559
|
+
/* @__PURE__ */ jsxs6("span", { className: "flex items-center gap-2 text-fg-secondary", children: [
|
|
1560
|
+
"Hide everything",
|
|
1561
|
+
/* @__PURE__ */ jsx6("kbd", { className: kbdClass, children: hideLabel() })
|
|
1562
|
+
] })
|
|
1563
|
+
] })
|
|
1564
|
+
] })
|
|
1565
|
+
}
|
|
1566
|
+
),
|
|
1567
|
+
/* @__PURE__ */ jsx6(
|
|
1568
|
+
motion.div,
|
|
1569
|
+
{
|
|
1570
|
+
"data-react-grab-ignore": true,
|
|
1571
|
+
"data-dock": "toolbar",
|
|
1572
|
+
initial: false,
|
|
1573
|
+
animate: { y: collapsed ? "calc(100% + 1rem)" : 0 },
|
|
1574
|
+
transition: collapsed ? spring.slow.exit : spring.slow,
|
|
1575
|
+
className: "pointer-events-none fixed inset-x-0 bottom-4 z-[10000] mx-auto w-fit",
|
|
1576
|
+
children: /* @__PURE__ */ jsxs6(
|
|
1577
|
+
ToolbarStrip,
|
|
1578
|
+
{
|
|
1579
|
+
"aria-label": "Dev tools",
|
|
1580
|
+
inert: collapsed,
|
|
1581
|
+
className: "pointer-events-auto relative flex w-fit items-center gap-1 rounded-full border border-line bg-surface p-1 text-xs text-fg shadow-lg",
|
|
1582
|
+
children: [
|
|
1583
|
+
/* @__PURE__ */ jsxs6(Tooltip, { children: [
|
|
1584
|
+
/* @__PURE__ */ jsx6(
|
|
1585
|
+
TooltipTrigger,
|
|
1586
|
+
{
|
|
1587
|
+
render: /* @__PURE__ */ jsx6(
|
|
1588
|
+
ToolbarButton,
|
|
1589
|
+
{
|
|
1590
|
+
"aria-label": "Move dev tools",
|
|
1591
|
+
onPointerDown: dock.startDrag,
|
|
1592
|
+
onKeyDown: dock.onKeyDown,
|
|
1593
|
+
onDoubleClick: dock.reset
|
|
1594
|
+
}
|
|
1595
|
+
),
|
|
1596
|
+
className: "inline-flex h-8 w-6 cursor-grab touch-none items-center justify-center rounded-full text-fg-icon select-none focus-visible:outline-2 focus-visible:outline-focus active:cursor-grabbing",
|
|
1597
|
+
children: /* @__PURE__ */ jsx6(GripVerticalIcon, { className: "size-4", "aria-hidden": "true" })
|
|
1598
|
+
}
|
|
1599
|
+
),
|
|
1600
|
+
/* @__PURE__ */ jsx6(
|
|
1601
|
+
TooltipContent,
|
|
1602
|
+
{
|
|
1603
|
+
side: "top",
|
|
1604
|
+
sideOffset: 8,
|
|
1605
|
+
className: tooltipClass,
|
|
1606
|
+
children: "Drag to move \xB7 Alt+arrows nudge \xB7 double-click to reset"
|
|
1607
|
+
}
|
|
1608
|
+
)
|
|
1609
|
+
] }),
|
|
1610
|
+
pinned.map((plugin, index) => /* @__PURE__ */ jsxs6(PluginBoundary, { plugin: plugin.id, children: [
|
|
1611
|
+
/* @__PURE__ */ jsx6(
|
|
1612
|
+
ItemMenu,
|
|
1613
|
+
{
|
|
1614
|
+
plugin,
|
|
1615
|
+
onOpen: () => run(plugin),
|
|
1616
|
+
onUnpin: () => layout.setPinned(plugin.id, false),
|
|
1617
|
+
children: plugin.Item ? /* @__PURE__ */ jsx6(plugin.Item, {}) : /* @__PURE__ */ jsx6(
|
|
1618
|
+
DefaultItem,
|
|
1619
|
+
{
|
|
1620
|
+
plugin,
|
|
1621
|
+
api,
|
|
1622
|
+
open: layout.isOpen(plugin.id),
|
|
1623
|
+
onToggle: () => layout.toggle(plugin.id)
|
|
1624
|
+
}
|
|
1625
|
+
)
|
|
1626
|
+
}
|
|
1627
|
+
),
|
|
1628
|
+
index < pinned.length - 1 ? /* @__PURE__ */ jsx6(ToolbarSeparator, { className: "h-4 w-px bg-pressed" }) : null
|
|
1629
|
+
] }, plugin.id)),
|
|
1630
|
+
/* @__PURE__ */ jsx6(ToolbarSeparator, { className: "mx-1 h-4 w-px bg-pressed" }),
|
|
1631
|
+
/* @__PURE__ */ jsx6(
|
|
1632
|
+
MoreMenu,
|
|
1633
|
+
{
|
|
1634
|
+
plugins,
|
|
1635
|
+
isPinned: layout.isPinned,
|
|
1636
|
+
mode: layout.mode,
|
|
1637
|
+
onMode: layout.setMode,
|
|
1638
|
+
onCollapse: toggleCollapsed,
|
|
1639
|
+
onHide: toggleHidden,
|
|
1640
|
+
onRun: run,
|
|
1641
|
+
onPin: layout.setPinned,
|
|
1642
|
+
onReset: layout.reset
|
|
1643
|
+
}
|
|
1644
|
+
),
|
|
1645
|
+
plugins.map(
|
|
1646
|
+
(plugin) => plugin.Status ? /* @__PURE__ */ jsx6(PluginBoundary, { plugin: plugin.id, children: /* @__PURE__ */ jsx6(plugin.Status, {}) }, plugin.id) : null
|
|
1647
|
+
)
|
|
1648
|
+
]
|
|
1649
|
+
}
|
|
1650
|
+
)
|
|
1651
|
+
}
|
|
1652
|
+
)
|
|
1653
|
+
]
|
|
1654
|
+
}
|
|
1655
|
+
)
|
|
1656
|
+
] })
|
|
1657
|
+
] }) }) });
|
|
1658
|
+
}
|
|
1659
|
+
function collectDebugContext(plugins) {
|
|
1660
|
+
const entries = plugins.flatMap((p) => {
|
|
1661
|
+
try {
|
|
1662
|
+
return p.debugContext?.() ?? [];
|
|
1663
|
+
} catch {
|
|
1664
|
+
return [];
|
|
1665
|
+
}
|
|
1666
|
+
});
|
|
1667
|
+
return entries.some((e) => e.label === "Page") ? entries : [{ label: "Page", value: window.location.href }, ...entries];
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
// src/ui/toolbar-entry.tsx
|
|
1671
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1672
|
+
var defaults = null;
|
|
1673
|
+
function ToolbarEntry({
|
|
1674
|
+
plugins,
|
|
1675
|
+
isolation,
|
|
1676
|
+
panelMode,
|
|
1677
|
+
aiTools
|
|
1678
|
+
}) {
|
|
1679
|
+
const list = useMemo3(() => plugins ?? (defaults ??= defaultPlugins()), [plugins]);
|
|
1680
|
+
return /* @__PURE__ */ jsx7(ToolbarImpl, { plugins: list, isolation, panelMode, aiTools });
|
|
1681
|
+
}
|
|
1682
|
+
export {
|
|
1683
|
+
ToolbarEntry as default
|
|
1684
|
+
};
|
|
1685
|
+
//# sourceMappingURL=toolbar-entry-XIOWCGBL.js.map
|