@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/CHANGELOG.md +121 -0
- package/THIRD-PARTY-NOTICES.md +1 -1
- package/dist/Devtools.js +170 -169
- package/dist/components/dockMenu.js +46 -46
- package/dist/console/Capsule.js +137 -68
- package/dist/console/Console.js +22 -22
- package/dist/console/InspectRefusals.js +12 -12
- package/dist/console/sources.js +13 -13
- package/dist/index.js +3 -3
- package/dist/inspectFetch.js +19 -19
- package/dist/inspectStream.js +9 -9
- package/dist/panels/desktop.js +18 -18
- package/dist/panels/indexes.js +71 -71
- package/dist/panels/pwa.js +22 -22
- package/dist/panels/routes.js +13 -13
- package/dist/panels/runtimes.js +15 -15
- package/dist/panels/stores.js +35 -35
- package/dist/panels/traces.js +42 -42
- package/dist/panels/webhooks.js +89 -89
- package/dist/panels/workflows.js +146 -146
- package/dist/styles.css +11 -3
- package/dist/useCapsuleClearance.js +6 -6
- package/package.json +4 -4
package/dist/Devtools.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { engagePush as
|
|
12
|
-
import { openExternalWindow as
|
|
13
|
-
import { useCallback as
|
|
14
|
-
import { selectDevStatus as
|
|
15
|
-
import { Fragment as
|
|
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
|
|
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(
|
|
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
|
-
},
|
|
25
|
+
}, fe = (e) => {
|
|
26
26
|
if (typeof window < "u") try {
|
|
27
|
-
window.localStorage.setItem(
|
|
27
|
+
window.localStorage.setItem(y, e ? "1" : "0");
|
|
28
28
|
} catch {}
|
|
29
|
-
},
|
|
30
|
-
let
|
|
31
|
-
return /* @__PURE__ */
|
|
32
|
-
token:
|
|
33
|
-
children: /* @__PURE__ */
|
|
34
|
-
strings:
|
|
35
|
-
children: /* @__PURE__ */
|
|
36
|
-
initialIsOpen:
|
|
37
|
-
initialDock:
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
68
|
+
}, pe = (e) => {
|
|
69
69
|
console.error("[voltro devtools] the overlay hit an error and was contained:", e);
|
|
70
|
-
},
|
|
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
|
-
},
|
|
73
|
+
}, E = () => {
|
|
74
74
|
let e = document.body.style;
|
|
75
75
|
e.removeProperty("cursor"), e.removeProperty("user-select"), e.removeProperty("-webkit-user-select");
|
|
76
|
-
},
|
|
77
|
-
let
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}, [
|
|
81
|
-
|
|
82
|
-
}, [
|
|
83
|
-
let { dock:
|
|
84
|
-
|
|
85
|
-
let
|
|
86
|
-
|
|
87
|
-
if (!
|
|
88
|
-
let e =
|
|
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
|
-
|
|
90
|
+
B(!1);
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
93
|
let t = !1, n = () => {
|
|
94
|
-
t ||
|
|
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
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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] ${
|
|
109
|
+
console.warn(`[voltro devtools] ${f.externalBlocked}`), O(!1);
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
|
-
|
|
112
|
+
K(e), e.focus();
|
|
113
113
|
let t = window.setInterval(() => {
|
|
114
|
-
e.closed &&
|
|
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),
|
|
119
|
+
window.clearInterval(t), window.removeEventListener("pagehide", n), K(null), e.close();
|
|
120
120
|
};
|
|
121
|
-
}, [
|
|
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(),
|
|
125
|
-
else if ((t.metaKey || t.ctrlKey) && !t.altKey && e(t, "KeyK", "k")) t.preventDefault(),
|
|
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 =
|
|
128
|
-
e !== null && (t.preventDefault(),
|
|
127
|
+
let e = ne(t.key);
|
|
128
|
+
e !== null && (t.preventDefault(), O(!0), N(e));
|
|
129
129
|
}
|
|
130
|
-
}, n =
|
|
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
|
-
}, [
|
|
136
|
-
if (!
|
|
137
|
-
let e = requestAnimationFrame(() =>
|
|
135
|
+
}, [N, G]), m(() => {
|
|
136
|
+
if (!D) return;
|
|
137
|
+
let e = requestAnimationFrame(() => A.current?.focus());
|
|
138
138
|
return () => cancelAnimationFrame(e);
|
|
139
139
|
}, [
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
D,
|
|
141
|
+
ge,
|
|
142
|
+
G
|
|
143
143
|
]);
|
|
144
|
-
let J =
|
|
145
|
-
|
|
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 =
|
|
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 :
|
|
153
|
-
|
|
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 =
|
|
157
|
-
if (!l(
|
|
156
|
+
let xe = p((e) => {
|
|
157
|
+
if (!l(j)) return;
|
|
158
158
|
e.preventDefault();
|
|
159
|
-
let t =
|
|
159
|
+
let t = j, n = {
|
|
160
160
|
x: e.clientX,
|
|
161
161
|
y: e.clientY,
|
|
162
|
-
size:
|
|
162
|
+
size: R.sizes[t]
|
|
163
163
|
}, r = (e) => {
|
|
164
|
-
|
|
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),
|
|
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),
|
|
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
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
]), Se =
|
|
174
|
-
if (
|
|
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:
|
|
179
|
+
rect: R.window
|
|
180
180
|
}, n = (e) => {
|
|
181
|
-
|
|
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),
|
|
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),
|
|
189
|
+
window.addEventListener("pointermove", n), window.addEventListener("pointerup", r), window.addEventListener("pointercancel", r), T(null);
|
|
190
190
|
}, [
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
]), Ce =
|
|
195
|
-
if (
|
|
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:
|
|
200
|
+
rect: R.window
|
|
201
201
|
}, n = (e) => {
|
|
202
|
-
|
|
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),
|
|
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),
|
|
210
|
+
window.addEventListener("pointermove", n), window.addEventListener("pointerup", r), window.addEventListener("pointercancel", r), T("nwse-resize");
|
|
211
211
|
}, [
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
]), [Z,
|
|
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,
|
|
218
|
-
x: Number(n.getPropertyValue("--vdt-capsule-x") ||
|
|
219
|
-
y: Number(n.getPropertyValue("--vdt-capsule-y") ||
|
|
220
|
-
},
|
|
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:
|
|
223
|
+
placement: r,
|
|
224
224
|
size: {
|
|
225
225
|
w: t.width,
|
|
226
226
|
h: t.height
|
|
227
227
|
}
|
|
228
|
-
},
|
|
229
|
-
let t = e.clientX -
|
|
230
|
-
if (!
|
|
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
|
-
|
|
232
|
+
a = !0, $.current = !0, Q(i.size), T("grabbing");
|
|
233
233
|
}
|
|
234
|
-
|
|
234
|
+
I(ee(i.placement, i.size, {
|
|
235
235
|
width: window.innerWidth,
|
|
236
236
|
height: window.innerHeight
|
|
237
237
|
}, t, n));
|
|
238
|
-
},
|
|
239
|
-
window.removeEventListener("pointermove",
|
|
240
|
-
|
|
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",
|
|
244
|
-
}, [
|
|
245
|
-
|
|
246
|
-
}, []),
|
|
247
|
-
ref:
|
|
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":
|
|
251
|
-
"data-dock":
|
|
252
|
-
"data-closing":
|
|
253
|
-
inert:
|
|
254
|
-
style:
|
|
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(
|
|
256
|
+
l(j) ? /* @__PURE__ */ _("div", {
|
|
257
257
|
className: "vdt-grip",
|
|
258
258
|
role: "separator",
|
|
259
|
-
"aria-label":
|
|
260
|
-
"aria-orientation":
|
|
259
|
+
"aria-label": f.resizeLabel,
|
|
260
|
+
"aria-orientation": j === "left" || j === "right" ? "vertical" : "horizontal",
|
|
261
261
|
onPointerDown: xe
|
|
262
262
|
}) : null,
|
|
263
|
-
/* @__PURE__ */
|
|
264
|
-
onError:
|
|
265
|
-
children: /* @__PURE__ */
|
|
266
|
-
dock:
|
|
267
|
-
push:
|
|
268
|
-
onDock:
|
|
269
|
-
onPush:
|
|
270
|
-
onClose:
|
|
271
|
-
scope:
|
|
272
|
-
onScope:
|
|
273
|
-
searchRef:
|
|
274
|
-
onHeaderPointerDown:
|
|
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
|
-
|
|
277
|
+
j === "window" ? /* @__PURE__ */ _("div", {
|
|
278
278
|
className: "vdt-win-resize",
|
|
279
279
|
role: "separator",
|
|
280
|
-
"aria-label":
|
|
280
|
+
"aria-label": f.resizeLabel,
|
|
281
281
|
onPointerDown: Ce
|
|
282
282
|
}) : null
|
|
283
283
|
]
|
|
284
284
|
}) : null;
|
|
285
|
-
return /* @__PURE__ */
|
|
285
|
+
return /* @__PURE__ */ v(de, { children: [/* @__PURE__ */ _(r, { children: /* @__PURE__ */ _("div", {
|
|
286
286
|
className: "vdt-host",
|
|
287
|
-
"data-open":
|
|
288
|
-
"data-dock":
|
|
287
|
+
"data-open": D ? "true" : "false",
|
|
288
|
+
"data-dock": j,
|
|
289
289
|
"data-push": J === null ? "false" : "true",
|
|
290
|
-
children: /* @__PURE__ */
|
|
290
|
+
children: /* @__PURE__ */ _("div", {
|
|
291
291
|
className: "vdt-scope",
|
|
292
|
-
children:
|
|
293
|
-
onError:
|
|
294
|
-
children: [Z === null ? null : /* @__PURE__ */
|
|
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:
|
|
297
|
+
children: a.map((e) => /* @__PURE__ */ _("span", {
|
|
298
298
|
className: "vdt-capsule-slot",
|
|
299
|
-
"data-active":
|
|
300
|
-
style:
|
|
299
|
+
"data-active": o(e, y.capsule) ? "true" : void 0,
|
|
300
|
+
style: C(e, Z)
|
|
301
301
|
}, `${e.x}:${e.y}`))
|
|
302
|
-
}), /* @__PURE__ */
|
|
303
|
-
status:
|
|
304
|
-
onOpen:
|
|
305
|
-
buttonRef:
|
|
306
|
-
style:
|
|
302
|
+
}), /* @__PURE__ */ _(e, {
|
|
303
|
+
status: ye,
|
|
304
|
+
onOpen: Oe,
|
|
305
|
+
buttonRef: U,
|
|
306
|
+
style: C(y.capsule),
|
|
307
307
|
dragging: Z !== null,
|
|
308
|
-
|
|
308
|
+
pinned: we,
|
|
309
|
+
onPointerDown: Ee
|
|
309
310
|
})]
|
|
310
311
|
})
|
|
311
312
|
})
|
|
312
|
-
}) }),
|
|
313
|
-
target:
|
|
314
|
-
children: /* @__PURE__ */
|
|
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__ */
|
|
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 {
|
|
327
|
+
export { x as VoltroDevtools, C as capsuleStyle, S as consoleStyle, w as edgeSizeFromDrag, b as readStoredOpen };
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useDevtoolsStrings as
|
|
3
|
-
import {
|
|
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:
|
|
9
|
-
top:
|
|
10
|
-
left:
|
|
11
|
-
right:
|
|
12
|
-
window:
|
|
13
|
-
external:
|
|
14
|
-
}, h = ({ dock:
|
|
15
|
-
let
|
|
16
|
-
bottom:
|
|
17
|
-
top:
|
|
18
|
-
left:
|
|
19
|
-
right:
|
|
20
|
-
window:
|
|
21
|
-
external:
|
|
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 (!
|
|
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
|
-
}, [
|
|
33
|
+
}, [c]);
|
|
34
34
|
let v = u([]);
|
|
35
35
|
l(() => {
|
|
36
|
-
if (!
|
|
37
|
-
let t =
|
|
36
|
+
if (!c) return;
|
|
37
|
+
let t = e.indexOf(r);
|
|
38
38
|
v.current[t === -1 ? 0 : t]?.focus();
|
|
39
|
-
}, [
|
|
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[
|
|
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${
|
|
69
|
-
title:
|
|
70
|
-
"aria-label":
|
|
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":
|
|
72
|
+
"aria-expanded": c,
|
|
73
73
|
onClick: () => h((e) => !e),
|
|
74
74
|
children: /* @__PURE__ */ f(b, { className: "vdt:w-4 vdt:h-4" })
|
|
75
|
-
}),
|
|
75
|
+
}), c ? /* @__PURE__ */ p("div", {
|
|
76
76
|
role: "menu",
|
|
77
|
-
"aria-label":
|
|
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:
|
|
83
|
-
let
|
|
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[
|
|
86
|
+
v.current[t] = e;
|
|
87
87
|
},
|
|
88
88
|
type: "button",
|
|
89
89
|
role: "menuitemradio",
|
|
90
|
-
"aria-checked":
|
|
91
|
-
"aria-label": _[
|
|
92
|
-
title: _[
|
|
93
|
-
className: `vdt-dockmenu-item${
|
|
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
|
-
|
|
95
|
+
a(e), h(!1);
|
|
96
96
|
},
|
|
97
|
-
children: /* @__PURE__ */ f(
|
|
98
|
-
},
|
|
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${
|
|
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":
|
|
106
|
-
checked:
|
|
107
|
-
disabled: !
|
|
108
|
-
onChange: (e) =>
|
|
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:
|
|
111
|
+
children: s.pushPage
|
|
112
112
|
}), /* @__PURE__ */ f("span", {
|
|
113
113
|
className: "vdt-dockmenu-push-hint",
|
|
114
|
-
children:
|
|
114
|
+
children: s.pushPageHint
|
|
115
115
|
})] })]
|
|
116
116
|
})]
|
|
117
117
|
}) : null]
|