@voltro/devtools 0.90.0 → 0.91.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/dist/Devtools.js CHANGED
@@ -1,44 +1,44 @@
1
- import { DevtoolsStringsProvider as e, useDevtoolsStrings as t } from "./strings.js";
2
- import { CAPSULE_SNAP_POINTS as n, capsulePlacementFromDrag as r, isSamePlacement as i } from "./capsulePlacement.js";
3
- import { Capsule as a } from "./console/Capsule.js";
4
- import { clampDockState as o, clampEdgeSize as s, clampWindow as c, dockForArrow as ee, isEdgeDock as l, useDockState as te, useViewport as ne } from "./useDock.js";
5
- import { clearInspectRefusals as re } from "./inspectRefusal.js";
6
- import { InspectTokenProvider as u, resolveInspectToken as d } from "./inspectAuth.js";
7
- import { Console as ie } from "./console/Console.js";
8
- import { OverlayBoundary as f } from "./components/boundary.js";
9
- import { ShadowHost as p } from "./shadowHost.js";
10
- import { useDevStatuses as ae } from "./useDevStatuses.js";
11
- import { engagePush as oe } from "./pushPage.js";
12
- import { openExternalWindow as se } from "./externalWindow.js";
13
- import { useCallback as m, useEffect as h, useMemo as ce, useRef as g, useState as _ } from "react";
14
- import { selectDevStatus as le } from "@voltro/web";
15
- import { Fragment as ue, jsx as v, jsxs as y } from "react/jsx-runtime";
1
+ import { Capsule as e } from "./console/Capsule.js";
2
+ import { Console as t } from "./console/Console.js";
3
+ import { OverlayBoundary as n } from "./components/boundary.js";
4
+ import { ShadowHost as r } from "./shadowHost.js";
5
+ import { useDevStatuses as i } from "./useDevStatuses.js";
6
+ import { CAPSULE_SNAP_POINTS as a, capsulePlacementFromDrag as ee, isSamePlacement as o } from "./capsulePlacement.js";
7
+ import { clampDockState as s, clampEdgeSize as te, clampWindow as c, dockForArrow as ne, isEdgeDock as l, useDockState as re, useViewport as ie } from "./useDock.js";
8
+ import { DevtoolsStringsProvider as u, useDevtoolsStrings as ae } from "./strings.js";
9
+ import { InspectTokenProvider as d, resolveInspectToken as f } from "./inspectAuth.js";
10
+ import { clearInspectRefusals as oe } from "./inspectRefusal.js";
11
+ import { engagePush as se } from "./pushPage.js";
12
+ import { openExternalWindow as ce } from "./externalWindow.js";
13
+ import { useCallback as p, useEffect as m, useMemo as le, useRef as h, useState as g } from "react";
14
+ import { selectDevStatus as ue } from "@voltro/web";
15
+ import { Fragment as de, jsx as _, jsxs as v } from "react/jsx-runtime";
16
16
  // src/Devtools.tsx
17
- var b = "voltro:devtools:open", x = (e) => {
17
+ var y = "voltro:devtools:open", b = (e) => {
18
18
  if (typeof window > "u") return e;
19
19
  try {
20
- let t = window.localStorage.getItem(b);
20
+ let t = window.localStorage.getItem(y);
21
21
  return t === null ? e : t === "1";
22
22
  } catch {
23
23
  return e;
24
24
  }
25
- }, de = (e) => {
25
+ }, fe = (e) => {
26
26
  if (typeof window < "u") try {
27
- window.localStorage.setItem(b, e ? "1" : "0");
27
+ window.localStorage.setItem(y, e ? "1" : "0");
28
28
  } catch {}
29
- }, S = ({ initialIsOpen: t = !1, initialDock: n = "bottom", strings: r, inspectToken: i } = {}) => {
30
- let a = d(i);
31
- return /* @__PURE__ */ v(u, {
32
- token: a,
33
- children: /* @__PURE__ */ v(e, {
34
- strings: r ?? {},
35
- children: /* @__PURE__ */ v(k, {
36
- initialIsOpen: t,
37
- initialDock: n
29
+ }, x = ({ initialIsOpen: e = !1, initialDock: t = "bottom", strings: n, inspectToken: r } = {}) => {
30
+ let i = f(r);
31
+ return /* @__PURE__ */ _(d, {
32
+ token: i,
33
+ children: /* @__PURE__ */ _(u, {
34
+ strings: n ?? {},
35
+ children: /* @__PURE__ */ _(D, {
36
+ initialIsOpen: e,
37
+ initialDock: t
38
38
  })
39
39
  })
40
40
  });
41
- }, C = (e) => {
41
+ }, S = (e) => {
42
42
  switch (e.dock) {
43
43
  case "bottom":
44
44
  case "top": return { height: e.sizes[e.dock] };
@@ -52,275 +52,276 @@ var b = "voltro:devtools:open", x = (e) => {
52
52
  };
53
53
  case "external": return {};
54
54
  }
55
- }, w = (e, t) => {
55
+ }, C = (e, t) => {
56
56
  let n = {
57
57
  "--vdt-capsule-x": e.x,
58
58
  "--vdt-capsule-y": e.y
59
59
  };
60
60
  return t !== void 0 && (n.width = t.w, n.height = t.h), n;
61
- }, T = (e, t, n, r) => {
61
+ }, w = (e, t, n, r) => {
62
62
  switch (e) {
63
63
  case "bottom": return t - r;
64
64
  case "top": return t + r;
65
65
  case "left": return t + n;
66
66
  case "right": return t - n;
67
67
  }
68
- }, E = (e) => {
68
+ }, pe = (e) => {
69
69
  console.error("[voltro devtools] the overlay hit an error and was contained:", e);
70
- }, D = (e) => {
70
+ }, T = (e) => {
71
71
  let t = document.body.style;
72
72
  e !== null && t.setProperty("cursor", e), t.setProperty("user-select", "none"), t.setProperty("-webkit-user-select", "none");
73
- }, O = () => {
73
+ }, E = () => {
74
74
  let e = document.body.style;
75
75
  e.removeProperty("cursor"), e.removeProperty("user-select"), e.removeProperty("-webkit-user-select");
76
- }, fe = (e) => e instanceof Element && e.closest("button, input, a, [role=\"menu\"], [role=\"tablist\"], label") !== null, k = ({ initialIsOpen: e, initialDock: u }) => {
77
- let d = t().shell, [b, S] = te(u), [k, A] = _(() => x(e) && b.dock !== "external"), [pe, j] = _("all"), M = g(null), [me, he] = _(0), ge = ae(), _e = le(ge);
78
- h(() => {
79
- de(k);
80
- }, [k]), h(() => {
81
- k || re();
82
- }, [k]);
83
- let { dock: N, push: P } = b, { setDock: F, setEdgeSize: I, setWindowRect: L, setPush: ve, setCapsule: R } = S, z = ne(), B = ce(() => o(b, z), [b, z]), [V, H] = _(k);
84
- k && !V && H(!0);
85
- let U = V && !k, W = g(null);
86
- h(() => {
87
- if (!U) return;
88
- let e = W.current?.getAnimations?.() ?? [];
76
+ }, me = (e) => e instanceof Element && e.closest("button, input, a, [role=\"menu\"], [role=\"tablist\"], label") !== null, D = ({ initialIsOpen: u, initialDock: d }) => {
77
+ let f = ae().shell, [y, x] = re(d), [D, O] = g(() => b(u) && y.dock !== "external"), [he, k] = g("all"), A = h(null), [ge, _e] = g(0), ve = i(), ye = ue(ve);
78
+ m(() => {
79
+ fe(D);
80
+ }, [D]), m(() => {
81
+ D || oe();
82
+ }, [D]);
83
+ let { dock: j, push: M } = y, { setDock: N, setEdgeSize: P, setWindowRect: F, setPush: be, setCapsule: I } = x, L = ie(), R = le(() => s(y, L), [y, L]), [z, B] = g(D);
84
+ D && !z && B(!0);
85
+ let V = z && !D, H = h(null);
86
+ m(() => {
87
+ if (!V) return;
88
+ let e = H.current?.getAnimations?.() ?? [];
89
89
  if (e.length === 0) {
90
- H(!1);
90
+ B(!1);
91
91
  return;
92
92
  }
93
93
  let t = !1, n = () => {
94
- t || H(!1);
94
+ t || B(!1);
95
95
  };
96
96
  return Promise.all(e.map((e) => e.finished)).then(n, n), () => {
97
97
  t = !0;
98
98
  };
99
- }, [U]);
100
- let G = g(null), K = g(!1);
101
- h(() => {
102
- V ? K.current = !0 : K.current && G.current?.focus();
103
99
  }, [V]);
104
- let [q, ye] = _(null), be = k && N === "external";
105
- h(() => {
106
- if (!be || typeof window > "u") return;
107
- let e = se(b.window, d.brand);
100
+ let U = h(null), W = h(!1);
101
+ m(() => {
102
+ z ? W.current = !0 : W.current && U.current?.focus();
103
+ }, [z]);
104
+ let [G, K] = g(null), q = D && j === "external";
105
+ m(() => {
106
+ if (!q || typeof window > "u") return;
107
+ let e = ce(y.window, f.brand);
108
108
  if (e === null) {
109
- console.warn(`[voltro devtools] ${d.externalBlocked}`), A(!1);
109
+ console.warn(`[voltro devtools] ${f.externalBlocked}`), O(!1);
110
110
  return;
111
111
  }
112
- ye(e), e.focus();
112
+ K(e), e.focus();
113
113
  let t = window.setInterval(() => {
114
- e.closed && A(!1);
114
+ e.closed && O(!1);
115
115
  }, 400), n = () => {
116
116
  e.close();
117
117
  };
118
118
  return window.addEventListener("pagehide", n), () => {
119
- window.clearInterval(t), window.removeEventListener("pagehide", n), ye(null), e.close();
119
+ window.clearInterval(t), window.removeEventListener("pagehide", n), K(null), e.close();
120
120
  };
121
- }, [be]), h(() => {
121
+ }, [q]), m(() => {
122
122
  if (typeof window > "u") return;
123
123
  let e = (e, t, n) => e.code === t || e.key.toLowerCase() === n, t = (t) => {
124
- if (t.altKey && !t.shiftKey && !t.metaKey && !t.ctrlKey && e(t, "KeyV", "v")) t.preventDefault(), A((e) => !e);
125
- else if ((t.metaKey || t.ctrlKey) && !t.altKey && e(t, "KeyK", "k")) t.preventDefault(), A(!0), j((e) => e === "stores" || e === "indexes" || e === "webhooks" || e === "routes" || e === "runtimes" || e === "pwa" || e === "desktop" ? "all" : e), he((e) => e + 1);
124
+ if (t.altKey && !t.shiftKey && !t.metaKey && !t.ctrlKey && e(t, "KeyV", "v")) t.preventDefault(), O((e) => !e);
125
+ else if ((t.metaKey || t.ctrlKey) && !t.altKey && e(t, "KeyK", "k")) t.preventDefault(), O(!0), k((e) => e === "stores" || e === "indexes" || e === "webhooks" || e === "routes" || e === "runtimes" || e === "pwa" || e === "desktop" ? "all" : e), _e((e) => e + 1);
126
126
  else if (t.altKey && t.shiftKey) {
127
- let e = ee(t.key);
128
- e !== null && (t.preventDefault(), A(!0), F(e));
127
+ let e = ne(t.key);
128
+ e !== null && (t.preventDefault(), O(!0), N(e));
129
129
  }
130
- }, n = q === null ? [window] : [window, q];
130
+ }, n = G === null ? [window] : [window, G];
131
131
  for (let e of n) e.addEventListener("keydown", t);
132
132
  return () => {
133
133
  for (let e of n) e.removeEventListener("keydown", t);
134
134
  };
135
- }, [F, q]), h(() => {
136
- if (!k) return;
137
- let e = requestAnimationFrame(() => M.current?.focus());
135
+ }, [N, G]), m(() => {
136
+ if (!D) return;
137
+ let e = requestAnimationFrame(() => A.current?.focus());
138
138
  return () => cancelAnimationFrame(e);
139
139
  }, [
140
- k,
141
- me,
142
- q
140
+ D,
141
+ ge,
142
+ G
143
143
  ]);
144
- let J = V && P && l(N) ? N : null, Y = g(null);
145
- h(() => {
144
+ let J = z && M && l(j) ? j : null, Y = h(null);
145
+ m(() => {
146
146
  if (typeof document > "u" || J === null) return;
147
- let e = oe(J, B.sizes[J]);
147
+ let e = se(J, R.sizes[J]);
148
148
  return Y.current = e, () => {
149
149
  Y.current = null, e.release();
150
150
  };
151
151
  }, [J]);
152
- let X = J === null ? null : B.sizes[J];
153
- h(() => {
152
+ let X = J === null ? null : R.sizes[J];
153
+ m(() => {
154
154
  X !== null && Y.current?.resize(X);
155
155
  }, [X]);
156
- let xe = m((e) => {
157
- if (!l(N)) return;
156
+ let xe = p((e) => {
157
+ if (!l(j)) return;
158
158
  e.preventDefault();
159
- let t = N, n = {
159
+ let t = j, n = {
160
160
  x: e.clientX,
161
161
  y: e.clientY,
162
- size: B.sizes[t]
162
+ size: R.sizes[t]
163
163
  }, r = (e) => {
164
- I(t, s(t, T(t, n.size, e.clientX - n.x, e.clientY - n.y)));
164
+ P(t, te(t, w(t, n.size, e.clientX - n.x, e.clientY - n.y)));
165
165
  }, i = () => {
166
- window.removeEventListener("pointermove", r), window.removeEventListener("pointerup", i), window.removeEventListener("pointercancel", i), O();
166
+ window.removeEventListener("pointermove", r), window.removeEventListener("pointerup", i), window.removeEventListener("pointercancel", i), E();
167
167
  };
168
- window.addEventListener("pointermove", r), window.addEventListener("pointerup", i), window.addEventListener("pointercancel", i), D(t === "left" || t === "right" ? "col-resize" : "row-resize");
168
+ window.addEventListener("pointermove", r), window.addEventListener("pointerup", i), window.addEventListener("pointercancel", i), T(t === "left" || t === "right" ? "col-resize" : "row-resize");
169
169
  }, [
170
- N,
171
- B.sizes,
172
- I
173
- ]), Se = m((e) => {
174
- if (N !== "window" || fe(e.target)) return;
170
+ j,
171
+ R.sizes,
172
+ P
173
+ ]), Se = p((e) => {
174
+ if (j !== "window" || me(e.target)) return;
175
175
  e.preventDefault();
176
176
  let t = {
177
177
  x: e.clientX,
178
178
  y: e.clientY,
179
- rect: B.window
179
+ rect: R.window
180
180
  }, n = (e) => {
181
- L(c({
181
+ F(c({
182
182
  ...t.rect,
183
183
  x: t.rect.x + (e.clientX - t.x),
184
184
  y: t.rect.y + (e.clientY - t.y)
185
185
  }));
186
186
  }, r = () => {
187
- window.removeEventListener("pointermove", n), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", r), O();
187
+ window.removeEventListener("pointermove", n), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", r), E();
188
188
  };
189
- window.addEventListener("pointermove", n), window.addEventListener("pointerup", r), window.addEventListener("pointercancel", r), D(null);
189
+ window.addEventListener("pointermove", n), window.addEventListener("pointerup", r), window.addEventListener("pointercancel", r), T(null);
190
190
  }, [
191
- N,
192
- B.window,
193
- L
194
- ]), Ce = m((e) => {
195
- if (N !== "window") return;
191
+ j,
192
+ R.window,
193
+ F
194
+ ]), Ce = p((e) => {
195
+ if (j !== "window") return;
196
196
  e.preventDefault();
197
197
  let t = {
198
198
  x: e.clientX,
199
199
  y: e.clientY,
200
- rect: B.window
200
+ rect: R.window
201
201
  }, n = (e) => {
202
- L(c({
202
+ F(c({
203
203
  ...t.rect,
204
204
  w: t.rect.w + (e.clientX - t.x),
205
205
  h: t.rect.h + (e.clientY - t.y)
206
206
  }));
207
207
  }, r = () => {
208
- window.removeEventListener("pointermove", n), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", r), O();
208
+ window.removeEventListener("pointermove", n), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", r), E();
209
209
  };
210
- window.addEventListener("pointermove", n), window.addEventListener("pointerup", r), window.addEventListener("pointercancel", r), D("nwse-resize");
210
+ window.addEventListener("pointermove", n), window.addEventListener("pointerup", r), window.addEventListener("pointercancel", r), T("nwse-resize");
211
211
  }, [
212
- N,
213
- B.window,
214
- L
215
- ]), [Z, we] = _(null), Q = g(!1), Te = m((e) => {
212
+ j,
213
+ R.window,
214
+ F
215
+ ]), [Z, Q] = g(null), [we, Te] = g(!1), $ = h(!1), Ee = p((e) => {
216
216
  if (e.button !== 0) return;
217
- let t = e.currentTarget.getBoundingClientRect(), n = e.currentTarget.style, i = {
218
- x: Number(n.getPropertyValue("--vdt-capsule-x") || b.capsule.x),
219
- y: Number(n.getPropertyValue("--vdt-capsule-y") || b.capsule.y)
220
- }, a = {
217
+ let t = e.currentTarget.getBoundingClientRect(), n = e.currentTarget.style, r = {
218
+ x: Number(n.getPropertyValue("--vdt-capsule-x") || y.capsule.x),
219
+ y: Number(n.getPropertyValue("--vdt-capsule-y") || y.capsule.y)
220
+ }, i = {
221
221
  x: e.clientX,
222
222
  y: e.clientY,
223
- placement: i,
223
+ placement: r,
224
224
  size: {
225
225
  w: t.width,
226
226
  h: t.height
227
227
  }
228
- }, o = !1, s = (e) => {
229
- let t = e.clientX - a.x, n = e.clientY - a.y;
230
- if (!o) {
228
+ }, a = !1, o = (e) => {
229
+ let t = e.clientX - i.x, n = e.clientY - i.y;
230
+ if (!a) {
231
231
  if (Math.hypot(t, n) < 4) return;
232
- o = !0, Q.current = !0, we(a.size), D("grabbing");
232
+ a = !0, $.current = !0, Q(i.size), T("grabbing");
233
233
  }
234
- R(r(a.placement, a.size, {
234
+ I(ee(i.placement, i.size, {
235
235
  width: window.innerWidth,
236
236
  height: window.innerHeight
237
237
  }, t, n));
238
- }, c = () => {
239
- window.removeEventListener("pointermove", s), window.removeEventListener("pointerup", c), window.removeEventListener("pointercancel", c), o && (we(null), O(), setTimeout(() => {
240
- Q.current = !1;
238
+ }, s = () => {
239
+ window.removeEventListener("pointermove", o), window.removeEventListener("pointerup", s), window.removeEventListener("pointercancel", s), a && (Q(null), Te(!0), E(), setTimeout(() => {
240
+ $.current = !1;
241
241
  }, 0));
242
242
  };
243
- window.addEventListener("pointermove", s), window.addEventListener("pointerup", c), window.addEventListener("pointercancel", c);
244
- }, [b.capsule, R]), Ee = m(() => A(!1), []), De = m(() => {
245
- Q.current ? Q.current = !1 : A(!0);
246
- }, []), Oe = N === "external", $ = V ? /* @__PURE__ */ y("section", {
247
- ref: W,
243
+ window.addEventListener("pointermove", o), window.addEventListener("pointerup", s), window.addEventListener("pointercancel", s);
244
+ }, [y.capsule, I]), De = p(() => O(!1), []), Oe = p(() => {
245
+ $.current ? $.current = !1 : O(!0);
246
+ }, []), ke = j === "external", Ae = z ? /* @__PURE__ */ v("section", {
247
+ ref: H,
248
248
  className: "vdt-console",
249
249
  role: "dialog",
250
- "aria-label": d.brand,
251
- "data-dock": N,
252
- "data-closing": U ? "true" : void 0,
253
- inert: U,
254
- style: C(B),
250
+ "aria-label": f.brand,
251
+ "data-dock": j,
252
+ "data-closing": V ? "true" : void 0,
253
+ inert: V,
254
+ style: S(R),
255
255
  children: [
256
- l(N) ? /* @__PURE__ */ v("div", {
256
+ l(j) ? /* @__PURE__ */ _("div", {
257
257
  className: "vdt-grip",
258
258
  role: "separator",
259
- "aria-label": d.resizeLabel,
260
- "aria-orientation": N === "left" || N === "right" ? "vertical" : "horizontal",
259
+ "aria-label": f.resizeLabel,
260
+ "aria-orientation": j === "left" || j === "right" ? "vertical" : "horizontal",
261
261
  onPointerDown: xe
262
262
  }) : null,
263
- /* @__PURE__ */ v(f, {
264
- onError: E,
265
- children: /* @__PURE__ */ v(ie, {
266
- dock: N,
267
- push: P,
268
- onDock: F,
269
- onPush: ve,
270
- onClose: Ee,
271
- scope: pe,
272
- onScope: j,
273
- searchRef: M,
274
- onHeaderPointerDown: N === "window" ? Se : void 0
263
+ /* @__PURE__ */ _(n, {
264
+ onError: pe,
265
+ children: /* @__PURE__ */ _(t, {
266
+ dock: j,
267
+ push: M,
268
+ onDock: N,
269
+ onPush: be,
270
+ onClose: De,
271
+ scope: he,
272
+ onScope: k,
273
+ searchRef: A,
274
+ onHeaderPointerDown: j === "window" ? Se : void 0
275
275
  })
276
276
  }),
277
- N === "window" ? /* @__PURE__ */ v("div", {
277
+ j === "window" ? /* @__PURE__ */ _("div", {
278
278
  className: "vdt-win-resize",
279
279
  role: "separator",
280
- "aria-label": d.resizeLabel,
280
+ "aria-label": f.resizeLabel,
281
281
  onPointerDown: Ce
282
282
  }) : null
283
283
  ]
284
284
  }) : null;
285
- return /* @__PURE__ */ y(ue, { children: [/* @__PURE__ */ v(p, { children: /* @__PURE__ */ v("div", {
285
+ return /* @__PURE__ */ v(de, { children: [/* @__PURE__ */ _(r, { children: /* @__PURE__ */ _("div", {
286
286
  className: "vdt-host",
287
- "data-open": k ? "true" : "false",
288
- "data-dock": N,
287
+ "data-open": D ? "true" : "false",
288
+ "data-dock": j,
289
289
  "data-push": J === null ? "false" : "true",
290
- children: /* @__PURE__ */ v("div", {
290
+ children: /* @__PURE__ */ _("div", {
291
291
  className: "vdt-scope",
292
- children: V ? Oe ? null : $ : /* @__PURE__ */ y(f, {
293
- onError: E,
294
- children: [Z === null ? null : /* @__PURE__ */ v("div", {
292
+ children: z ? ke ? null : Ae : /* @__PURE__ */ v(n, {
293
+ onError: pe,
294
+ children: [Z === null ? null : /* @__PURE__ */ _("div", {
295
295
  className: "vdt-capsule-slots",
296
296
  "aria-hidden": "true",
297
- children: n.map((e) => /* @__PURE__ */ v("span", {
297
+ children: a.map((e) => /* @__PURE__ */ _("span", {
298
298
  className: "vdt-capsule-slot",
299
- "data-active": i(e, b.capsule) ? "true" : void 0,
300
- style: w(e, Z)
299
+ "data-active": o(e, y.capsule) ? "true" : void 0,
300
+ style: C(e, Z)
301
301
  }, `${e.x}:${e.y}`))
302
- }), /* @__PURE__ */ v(a, {
303
- status: _e,
304
- onOpen: De,
305
- buttonRef: G,
306
- style: w(b.capsule),
302
+ }), /* @__PURE__ */ _(e, {
303
+ status: ye,
304
+ onOpen: Oe,
305
+ buttonRef: U,
306
+ style: C(y.capsule),
307
307
  dragging: Z !== null,
308
- onPointerDown: Te
308
+ pinned: we,
309
+ onPointerDown: Ee
309
310
  })]
310
311
  })
311
312
  })
312
- }) }), Oe && q !== null ? /* @__PURE__ */ v(p, {
313
- target: q.document,
314
- children: /* @__PURE__ */ v("div", {
313
+ }) }), ke && G !== null ? /* @__PURE__ */ _(r, {
314
+ target: G.document,
315
+ children: /* @__PURE__ */ _("div", {
315
316
  className: "vdt-host",
316
317
  "data-open": "true",
317
318
  "data-dock": "external",
318
319
  "data-push": "false",
319
- children: /* @__PURE__ */ v("div", {
320
+ children: /* @__PURE__ */ _("div", {
320
321
  className: "vdt-scope",
321
- children: $
322
+ children: Ae
322
323
  })
323
324
  })
324
325
  }) : null] });
325
326
  };
326
- export { S as VoltroDevtools, w as capsuleStyle, C as consoleStyle, T as edgeSizeFromDrag, x as readStoredOpen };
327
+ export { x as VoltroDevtools, C as capsuleStyle, S as consoleStyle, w as edgeSizeFromDrag, b as readStoredOpen };
@@ -1,27 +1,27 @@
1
- import { DockBottom as e, DockExternal as t, DockLeft as n, DockRight as r, DockTop as i, DockWindow as a } from "./icons.js";
2
- import { useDevtoolsStrings as o } from "../strings.js";
3
- import { ALL_DOCKS as s, isEdgeDock as c } from "../useDock.js";
1
+ import { ALL_DOCKS as e, isEdgeDock as t } from "../useDock.js";
2
+ import { useDevtoolsStrings as n } from "../strings.js";
3
+ import { DockBottom as r, DockExternal as i, DockLeft as a, DockRight as o, DockTop as s, DockWindow as c } from "./icons.js";
4
4
  import { useEffect as l, useRef as u, useState as d } from "react";
5
5
  import { jsx as f, jsxs as p } from "react/jsx-runtime";
6
6
  // src/components/dockMenu.tsx
7
7
  var m = {
8
- bottom: e,
9
- top: i,
10
- left: n,
11
- right: r,
12
- window: a,
13
- external: t
14
- }, h = ({ dock: e, push: t, onDock: n, onPush: r }) => {
15
- let i = o().shell, [a, h] = d(!1), g = u(null), _ = {
16
- bottom: i.dockBottom,
17
- top: i.dockTop,
18
- left: i.dockLeft,
19
- right: i.dockRight,
20
- window: i.dockWindow,
21
- external: i.dockExternal
8
+ bottom: r,
9
+ top: s,
10
+ left: a,
11
+ right: o,
12
+ window: c,
13
+ external: i
14
+ }, h = ({ dock: r, push: i, onDock: a, onPush: o }) => {
15
+ let s = n().shell, [c, h] = d(!1), g = u(null), _ = {
16
+ bottom: s.dockBottom,
17
+ top: s.dockTop,
18
+ left: s.dockLeft,
19
+ right: s.dockRight,
20
+ window: s.dockWindow,
21
+ external: s.dockExternal
22
22
  };
23
23
  l(() => {
24
- if (!a) return;
24
+ if (!c) return;
25
25
  let e = g.current?.ownerDocument ?? document, t = (e) => {
26
26
  g.current !== null && !e.composedPath().includes(g.current) && h(!1);
27
27
  }, n = (e) => {
@@ -30,13 +30,13 @@ var m = {
30
30
  return e.addEventListener("mousedown", t), e.addEventListener("keydown", n), () => {
31
31
  e.removeEventListener("mousedown", t), e.removeEventListener("keydown", n);
32
32
  };
33
- }, [a]);
33
+ }, [c]);
34
34
  let v = u([]);
35
35
  l(() => {
36
- if (!a) return;
37
- let t = s.indexOf(e);
36
+ if (!c) return;
37
+ let t = e.indexOf(r);
38
38
  v.current[t === -1 ? 0 : t]?.focus();
39
- }, [a, e]);
39
+ }, [c, r]);
40
40
  let y = (e) => {
41
41
  let t = v.current.filter((e) => e !== null);
42
42
  if (t.length === 0) return;
@@ -59,59 +59,59 @@ var m = {
59
59
  default: return;
60
60
  }
61
61
  e.preventDefault(), t[r]?.focus();
62
- }, b = m[e];
62
+ }, b = m[r];
63
63
  return /* @__PURE__ */ p("div", {
64
64
  ref: g,
65
65
  className: "vdt-dockmenu",
66
66
  children: [/* @__PURE__ */ f("button", {
67
67
  type: "button",
68
- className: `vdt-iconbtn${a ? " vdt-iconbtn-on" : ""}`,
69
- title: i.dockMenuTitle,
70
- "aria-label": i.dockMenuTitle,
68
+ className: `vdt-iconbtn${c ? " vdt-iconbtn-on" : ""}`,
69
+ title: s.dockMenuTitle,
70
+ "aria-label": s.dockMenuTitle,
71
71
  "aria-haspopup": "menu",
72
- "aria-expanded": a,
72
+ "aria-expanded": c,
73
73
  onClick: () => h((e) => !e),
74
74
  children: /* @__PURE__ */ f(b, { className: "vdt:w-4 vdt:h-4" })
75
- }), a ? /* @__PURE__ */ p("div", {
75
+ }), c ? /* @__PURE__ */ p("div", {
76
76
  role: "menu",
77
- "aria-label": i.dockMenuTitle,
77
+ "aria-label": s.dockMenuTitle,
78
78
  className: "vdt-dockmenu-pop",
79
79
  children: [/* @__PURE__ */ f("div", {
80
80
  className: "vdt-dockmenu-row",
81
81
  onKeyDown: y,
82
- children: s.map((t, r) => {
83
- let i = m[t], a = t === e;
82
+ children: e.map((e, t) => {
83
+ let n = m[e], i = e === r;
84
84
  return /* @__PURE__ */ f("button", {
85
85
  ref: (e) => {
86
- v.current[r] = e;
86
+ v.current[t] = e;
87
87
  },
88
88
  type: "button",
89
89
  role: "menuitemradio",
90
- "aria-checked": a,
91
- "aria-label": _[t],
92
- title: _[t],
93
- className: `vdt-dockmenu-item${a ? " vdt-dockmenu-item-on" : ""}`,
90
+ "aria-checked": i,
91
+ "aria-label": _[e],
92
+ title: _[e],
93
+ className: `vdt-dockmenu-item${i ? " vdt-dockmenu-item-on" : ""}`,
94
94
  onClick: () => {
95
- n(t), h(!1);
95
+ a(e), h(!1);
96
96
  },
97
- children: /* @__PURE__ */ f(i, { className: "vdt:w-4 vdt:h-4" })
98
- }, t);
97
+ children: /* @__PURE__ */ f(n, { className: "vdt:w-4 vdt:h-4" })
98
+ }, e);
99
99
  })
100
100
  }), /* @__PURE__ */ p("label", {
101
- className: `vdt-dockmenu-push${c(e) ? "" : " vdt-dockmenu-push-off"}`,
101
+ className: `vdt-dockmenu-push${t(r) ? "" : " vdt-dockmenu-push-off"}`,
102
102
  children: [/* @__PURE__ */ f("input", {
103
103
  type: "checkbox",
104
104
  role: "menuitemcheckbox",
105
- "aria-checked": t,
106
- checked: t,
107
- disabled: !c(e),
108
- onChange: (e) => r(e.target.checked)
105
+ "aria-checked": i,
106
+ checked: i,
107
+ disabled: !t(r),
108
+ onChange: (e) => o(e.target.checked)
109
109
  }), /* @__PURE__ */ p("span", { children: [/* @__PURE__ */ f("span", {
110
110
  className: "vdt-dockmenu-push-label",
111
- children: i.pushPage
111
+ children: s.pushPage
112
112
  }), /* @__PURE__ */ f("span", {
113
113
  className: "vdt-dockmenu-push-hint",
114
- children: i.pushPageHint
114
+ children: s.pushPageHint
115
115
  })] })]
116
116
  })]
117
117
  }) : null]