@voltro/devtools 0.84.0 → 0.86.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +1215 -0
  2. package/THIRD-PARTY-NOTICES.md +5 -89
  3. package/dist/Devtools.js +327 -0
  4. package/dist/capsuleClearance.js +42 -0
  5. package/dist/capsulePlacement.js +66 -0
  6. package/dist/components/boundary.js +47 -0
  7. package/dist/components/dockMenu.js +121 -0
  8. package/dist/components/icons.js +236 -0
  9. package/dist/components/primitives.js +75 -0
  10. package/dist/console/Capsule.js +169 -0
  11. package/dist/console/Console.js +508 -0
  12. package/dist/console/InspectRefusals.js +89 -0
  13. package/dist/console/searchIndex.js +63 -0
  14. package/dist/console/sources.js +106 -0
  15. package/dist/consoleBridge.js +76 -0
  16. package/dist/externalWindow.js +9 -0
  17. package/dist/index.js +3 -4382
  18. package/dist/inspectAuth.js +16 -0
  19. package/dist/inspectFetch.js +46 -0
  20. package/dist/inspectRefusal.js +45 -0
  21. package/dist/inspectStream.js +88 -0
  22. package/dist/logsBus.js +22 -0
  23. package/dist/panels/desktop.js +101 -0
  24. package/dist/panels/indexes.js +233 -0
  25. package/dist/panels/logs.js +55 -0
  26. package/dist/panels/mutations.js +81 -0
  27. package/dist/panels/pwa.js +171 -0
  28. package/dist/panels/routes.js +69 -0
  29. package/dist/panels/runtimes.js +67 -0
  30. package/dist/panels/stores.js +125 -0
  31. package/dist/panels/subscriptions.js +117 -0
  32. package/dist/panels/traces.js +160 -0
  33. package/dist/panels/webhooks.js +248 -0
  34. package/dist/panels/workflows.js +478 -0
  35. package/dist/pushPage.js +36 -0
  36. package/dist/shadowHost.js +77 -0
  37. package/dist/strings.js +332 -0
  38. package/dist/styles.css +20 -0
  39. package/dist/useCapsuleClearance.js +85 -0
  40. package/dist/useDevStatuses.js +6 -0
  41. package/dist/useDock.js +181 -0
  42. package/dist/useDocumentVisible.js +5 -0
  43. package/dist/useLiveCacheEntries.js +19 -0
  44. package/package.json +4 -4
@@ -1,70 +1,14 @@
1
1
  # Third-Party Notices — @voltro/devtools
2
2
 
3
- This package depends on the open-source software listed below. Each is the
3
+ This package uses the open-source software listed below. Each is the
4
4
  property of its respective copyright holders and is used under the terms of
5
5
  its license. This file is provided for attribution; it grants no rights in
6
6
  @voltro/devtools itself, which is proprietary (see LICENSE).
7
7
 
8
- Generated from the resolved runtime dependency closure (13 packages).
8
+ Generated from the resolved runtime dependency closure (10 packages).
9
9
 
10
10
  ---
11
11
 
12
- ## @effect/experimental@0.61.1
13
-
14
- License: MIT
15
-
16
- ```
17
- MIT License
18
-
19
- Copyright (c) 2023-present The Contributors
20
-
21
- Permission is hereby granted, free of charge, to any person obtaining a copy
22
- of this software and associated documentation files (the "Software"), to deal
23
- in the Software without restriction, including without limitation the rights
24
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
25
- copies of the Software, and to permit persons to whom the Software is
26
- furnished to do so, subject to the following conditions:
27
-
28
- The above copyright notice and this permission notice shall be included in all
29
- copies or substantial portions of the Software.
30
-
31
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
34
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
36
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37
- SOFTWARE.
38
- ```
39
-
40
- ## @effect/sql@0.52.1
41
-
42
- License: MIT
43
-
44
- ```
45
- MIT License
46
-
47
- Copyright (c) 2023-present The Contributors
48
-
49
- Permission is hereby granted, free of charge, to any person obtaining a copy
50
- of this software and associated documentation files (the "Software"), to deal
51
- in the Software without restriction, including without limitation the rights
52
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
53
- copies of the Software, and to permit persons to whom the Software is
54
- furnished to do so, subject to the following conditions:
55
-
56
- The above copyright notice and this permission notice shall be included in all
57
- copies or substantial portions of the Software.
58
-
59
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
60
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
61
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
62
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
63
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
64
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
65
- SOFTWARE.
66
- ```
67
-
68
12
  ## @tanstack/devtools-event-client@0.4.4
69
13
 
70
14
  License: MIT
@@ -233,34 +177,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
233
177
  SOFTWARE.
234
178
  ```
235
179
 
236
- ## layerr@3.0.0
237
-
238
- License: MIT
239
-
240
- ```
241
- MIT License
242
-
243
- Copyright (c) 2020 Perry Mitchell
244
-
245
- Permission is hereby granted, free of charge, to any person obtaining a copy
246
- of this software and associated documentation files (the "Software"), to deal
247
- in the Software without restriction, including without limitation the rights
248
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
249
- copies of the Software, and to permit persons to whom the Software is
250
- furnished to do so, subject to the following conditions:
251
-
252
- The above copyright notice and this permission notice shall be included in all
253
- copies or substantial portions of the Software.
254
-
255
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
256
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
257
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
258
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
259
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
260
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
261
- SOFTWARE.
262
- ```
263
-
264
180
  ## typeid-js@1.2.0
265
181
 
266
182
  License: Apache-2.0
@@ -469,14 +385,14 @@ Apache License
469
385
  limitations under the License.
470
386
  ```
471
387
 
472
- ## ulidx@2.4.1
388
+ ## ulid@3.0.2
473
389
 
474
390
  License: MIT
475
391
 
476
392
  ```
477
- MIT License
393
+ The MIT License (MIT)
478
394
 
479
- Copyright (c) 2021 Perry Mitchell
395
+ Copyright (c) 2017 Alizain Feerasta
480
396
 
481
397
  Permission is hereby granted, free of charge, to any person obtaining a copy
482
398
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,327 @@
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";
16
+ //#region src/Devtools.tsx
17
+ var b = "voltro:devtools:open", x = (e) => {
18
+ if (typeof window > "u") return e;
19
+ try {
20
+ let t = window.localStorage.getItem(b);
21
+ return t === null ? e : t === "1";
22
+ } catch {
23
+ return e;
24
+ }
25
+ }, de = (e) => {
26
+ if (typeof window < "u") try {
27
+ window.localStorage.setItem(b, e ? "1" : "0");
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
38
+ })
39
+ })
40
+ });
41
+ }, C = (e) => {
42
+ switch (e.dock) {
43
+ case "bottom":
44
+ case "top": return { height: e.sizes[e.dock] };
45
+ case "left":
46
+ case "right": return { width: e.sizes[e.dock] };
47
+ case "window": return {
48
+ left: e.window.x,
49
+ top: e.window.y,
50
+ width: e.window.w,
51
+ height: e.window.h
52
+ };
53
+ case "external": return {};
54
+ }
55
+ }, w = (e, t) => {
56
+ let n = {
57
+ "--vdt-capsule-x": e.x,
58
+ "--vdt-capsule-y": e.y
59
+ };
60
+ return t !== void 0 && (n.width = t.w, n.height = t.h), n;
61
+ }, T = (e, t, n, r) => {
62
+ switch (e) {
63
+ case "bottom": return t - r;
64
+ case "top": return t + r;
65
+ case "left": return t + n;
66
+ case "right": return t - n;
67
+ }
68
+ }, E = (e) => {
69
+ console.error("[voltro devtools] the overlay hit an error and was contained:", e);
70
+ }, D = (e) => {
71
+ let t = document.body.style;
72
+ e !== null && t.setProperty("cursor", e), t.setProperty("user-select", "none"), t.setProperty("-webkit-user-select", "none");
73
+ }, O = () => {
74
+ let e = document.body.style;
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?.() ?? [];
89
+ if (e.length === 0) {
90
+ H(!1);
91
+ return;
92
+ }
93
+ let t = !1, n = () => {
94
+ t || H(!1);
95
+ };
96
+ return Promise.all(e.map((e) => e.finished)).then(n, n), () => {
97
+ t = !0;
98
+ };
99
+ }, [U]);
100
+ let G = g(null), K = g(!1);
101
+ h(() => {
102
+ V ? K.current = !0 : K.current && G.current?.focus();
103
+ }, [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);
108
+ if (e === null) {
109
+ console.warn(`[voltro devtools] ${d.externalBlocked}`), A(!1);
110
+ return;
111
+ }
112
+ ye(e), e.focus();
113
+ let t = window.setInterval(() => {
114
+ e.closed && A(!1);
115
+ }, 400), n = () => {
116
+ e.close();
117
+ };
118
+ return window.addEventListener("pagehide", n), () => {
119
+ window.clearInterval(t), window.removeEventListener("pagehide", n), ye(null), e.close();
120
+ };
121
+ }, [be]), h(() => {
122
+ if (typeof window > "u") return;
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);
126
+ else if (t.altKey && t.shiftKey) {
127
+ let e = ee(t.key);
128
+ e !== null && (t.preventDefault(), A(!0), F(e));
129
+ }
130
+ }, n = q === null ? [window] : [window, q];
131
+ for (let e of n) e.addEventListener("keydown", t);
132
+ return () => {
133
+ for (let e of n) e.removeEventListener("keydown", t);
134
+ };
135
+ }, [F, q]), h(() => {
136
+ if (!k) return;
137
+ let e = requestAnimationFrame(() => M.current?.focus());
138
+ return () => cancelAnimationFrame(e);
139
+ }, [
140
+ k,
141
+ me,
142
+ q
143
+ ]);
144
+ let J = V && P && l(N) ? N : null, Y = g(null);
145
+ h(() => {
146
+ if (typeof document > "u" || J === null) return;
147
+ let e = oe(J, B.sizes[J]);
148
+ return Y.current = e, () => {
149
+ Y.current = null, e.release();
150
+ };
151
+ }, [J]);
152
+ let X = J === null ? null : B.sizes[J];
153
+ h(() => {
154
+ X !== null && Y.current?.resize(X);
155
+ }, [X]);
156
+ let xe = m((e) => {
157
+ if (!l(N)) return;
158
+ e.preventDefault();
159
+ let t = N, n = {
160
+ x: e.clientX,
161
+ y: e.clientY,
162
+ size: B.sizes[t]
163
+ }, r = (e) => {
164
+ I(t, s(t, T(t, n.size, e.clientX - n.x, e.clientY - n.y)));
165
+ }, i = () => {
166
+ window.removeEventListener("pointermove", r), window.removeEventListener("pointerup", i), window.removeEventListener("pointercancel", i), O();
167
+ };
168
+ window.addEventListener("pointermove", r), window.addEventListener("pointerup", i), window.addEventListener("pointercancel", i), D(t === "left" || t === "right" ? "col-resize" : "row-resize");
169
+ }, [
170
+ N,
171
+ B.sizes,
172
+ I
173
+ ]), Se = m((e) => {
174
+ if (N !== "window" || fe(e.target)) return;
175
+ e.preventDefault();
176
+ let t = {
177
+ x: e.clientX,
178
+ y: e.clientY,
179
+ rect: B.window
180
+ }, n = (e) => {
181
+ L(c({
182
+ ...t.rect,
183
+ x: t.rect.x + (e.clientX - t.x),
184
+ y: t.rect.y + (e.clientY - t.y)
185
+ }));
186
+ }, r = () => {
187
+ window.removeEventListener("pointermove", n), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", r), O();
188
+ };
189
+ window.addEventListener("pointermove", n), window.addEventListener("pointerup", r), window.addEventListener("pointercancel", r), D(null);
190
+ }, [
191
+ N,
192
+ B.window,
193
+ L
194
+ ]), Ce = m((e) => {
195
+ if (N !== "window") return;
196
+ e.preventDefault();
197
+ let t = {
198
+ x: e.clientX,
199
+ y: e.clientY,
200
+ rect: B.window
201
+ }, n = (e) => {
202
+ L(c({
203
+ ...t.rect,
204
+ w: t.rect.w + (e.clientX - t.x),
205
+ h: t.rect.h + (e.clientY - t.y)
206
+ }));
207
+ }, r = () => {
208
+ window.removeEventListener("pointermove", n), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", r), O();
209
+ };
210
+ window.addEventListener("pointermove", n), window.addEventListener("pointerup", r), window.addEventListener("pointercancel", r), D("nwse-resize");
211
+ }, [
212
+ N,
213
+ B.window,
214
+ L
215
+ ]), [Z, we] = _(null), Q = g(!1), Te = m((e) => {
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 = {
221
+ x: e.clientX,
222
+ y: e.clientY,
223
+ placement: i,
224
+ size: {
225
+ w: t.width,
226
+ h: t.height
227
+ }
228
+ }, o = !1, s = (e) => {
229
+ let t = e.clientX - a.x, n = e.clientY - a.y;
230
+ if (!o) {
231
+ if (Math.hypot(t, n) < 4) return;
232
+ o = !0, Q.current = !0, we(a.size), D("grabbing");
233
+ }
234
+ R(r(a.placement, a.size, {
235
+ width: window.innerWidth,
236
+ height: window.innerHeight
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;
241
+ }, 0));
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,
248
+ className: "vdt-console",
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),
255
+ children: [
256
+ l(N) ? /* @__PURE__ */ v("div", {
257
+ className: "vdt-grip",
258
+ role: "separator",
259
+ "aria-label": d.resizeLabel,
260
+ "aria-orientation": N === "left" || N === "right" ? "vertical" : "horizontal",
261
+ onPointerDown: xe
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
275
+ })
276
+ }),
277
+ N === "window" ? /* @__PURE__ */ v("div", {
278
+ className: "vdt-win-resize",
279
+ role: "separator",
280
+ "aria-label": d.resizeLabel,
281
+ onPointerDown: Ce
282
+ }) : null
283
+ ]
284
+ }) : null;
285
+ return /* @__PURE__ */ y(ue, { children: [/* @__PURE__ */ v(p, { children: /* @__PURE__ */ v("div", {
286
+ className: "vdt-host",
287
+ "data-open": k ? "true" : "false",
288
+ "data-dock": N,
289
+ "data-push": J === null ? "false" : "true",
290
+ children: /* @__PURE__ */ v("div", {
291
+ className: "vdt-scope",
292
+ children: V ? Oe ? null : $ : /* @__PURE__ */ y(f, {
293
+ onError: E,
294
+ children: [Z === null ? null : /* @__PURE__ */ v("div", {
295
+ className: "vdt-capsule-slots",
296
+ "aria-hidden": "true",
297
+ children: n.map((e) => /* @__PURE__ */ v("span", {
298
+ className: "vdt-capsule-slot",
299
+ "data-active": i(e, b.capsule) ? "true" : void 0,
300
+ style: w(e, Z)
301
+ }, `${e.x}:${e.y}`))
302
+ }), /* @__PURE__ */ v(a, {
303
+ status: _e,
304
+ onOpen: De,
305
+ buttonRef: G,
306
+ style: w(b.capsule),
307
+ dragging: Z !== null,
308
+ onPointerDown: Te
309
+ })]
310
+ })
311
+ })
312
+ }) }), Oe && q !== null ? /* @__PURE__ */ v(p, {
313
+ target: q.document,
314
+ children: /* @__PURE__ */ v("div", {
315
+ className: "vdt-host",
316
+ "data-open": "true",
317
+ "data-dock": "external",
318
+ "data-push": "false",
319
+ children: /* @__PURE__ */ v("div", {
320
+ className: "vdt-scope",
321
+ children: $
322
+ })
323
+ })
324
+ }) : null] });
325
+ };
326
+ //#endregion
327
+ export { S as VoltroDevtools, w as capsuleStyle, C as consoleStyle, T as edgeSizeFromDrag, x as readStoredOpen };
@@ -0,0 +1,42 @@
1
+ import { CAPSULE_SNAP_POINTS as e, isSamePlacement as t } from "./capsulePlacement.js";
2
+ //#region src/capsuleClearance.ts
3
+ var n = 8, r = (e, t, r, i) => {
4
+ let a = 18 + e.x * Math.max(0, r.width - 36 - t.w), o = 18 + e.y * Math.max(0, r.height - 36 - t.h);
5
+ return i.filter((e) => a < e.right + n && a + t.w > e.left - n && o < e.bottom + n && o + t.h > e.top - n);
6
+ }, i = (e, t, n, i) => r(e, t, n, i).length === 0, a = (i, a, o, s, c) => {
7
+ let l = Math.max(0, s.width - 36 - o.w), u = Math.max(0, s.height - 36 - o.h), d = (e) => r(e, o, s, c);
8
+ if (d(i).length === 0) return i;
9
+ if (!t(i, a) && d(a).length === 0) return a;
10
+ let f = [], p = /* @__PURE__ */ new Set(), m = (e) => {
11
+ if (p.size >= 256) return;
12
+ let t = {
13
+ x: Math.max(0, Math.min(1, e.x)),
14
+ y: Math.max(0, Math.min(1, e.y))
15
+ }, n = `${(t.x * l).toFixed(2)}:${(t.y * u).toFixed(2)}`;
16
+ p.has(n) || (p.add(n), f.push(t));
17
+ }, h = (e) => Math.hypot((e.x - i.x) * l, (e.y - i.y) * u);
18
+ m(i), e.forEach(m);
19
+ for (let e = 0; e < 64 && f.length > 0; e++) {
20
+ f.sort((e, t) => h(e) - h(t));
21
+ let e = f.shift();
22
+ if (!e) break;
23
+ let t = d(e);
24
+ if (t.length === 0) return e;
25
+ for (let r of t.slice(0, 8)) l > 0 && (m({
26
+ x: (r.left - n - o.w - 18) / l,
27
+ y: e.y
28
+ }), m({
29
+ x: (r.right + n - 18) / l,
30
+ y: e.y
31
+ })), u > 0 && (m({
32
+ x: e.x,
33
+ y: (r.top - n - o.h - 18) / u
34
+ }), m({
35
+ x: e.x,
36
+ y: (r.bottom + n - 18) / u
37
+ }));
38
+ }
39
+ return [...e].sort((e, t) => h(e) - h(t)).find((e) => d(e).length === 0) ?? i;
40
+ };
41
+ //#endregion
42
+ export { a as clearCapsulePlacement, i as hasCapsuleClearance };
@@ -0,0 +1,66 @@
1
+ //#region src/capsulePlacement.ts
2
+ var e = {
3
+ x: .5,
4
+ y: 1
5
+ }, t = [
6
+ {
7
+ x: 0,
8
+ y: 0
9
+ },
10
+ {
11
+ x: .5,
12
+ y: 0
13
+ },
14
+ {
15
+ x: 1,
16
+ y: 0
17
+ },
18
+ {
19
+ x: 0,
20
+ y: .5
21
+ },
22
+ {
23
+ x: 1,
24
+ y: .5
25
+ },
26
+ {
27
+ x: 0,
28
+ y: 1
29
+ },
30
+ {
31
+ x: .5,
32
+ y: 1
33
+ },
34
+ {
35
+ x: 1,
36
+ y: 1
37
+ }
38
+ ], n = (e) => Math.min(1, Math.max(0, e)), r = (e, t) => ({
39
+ x: Math.max(0, t.width - 36 - e.w),
40
+ y: Math.max(0, t.height - 36 - e.h)
41
+ }), i = (e, t) => e.x === t.x && e.y === t.y, a = (e, n, i) => {
42
+ let a = r(n, i), o = null, s = 48;
43
+ for (let n of t) {
44
+ let t = Math.hypot((e.x - n.x) * a.x, (e.y - n.y) * a.y);
45
+ t <= s && (o = n, s = t);
46
+ }
47
+ return o === null ? e : {
48
+ x: a.x > 0 ? o.x : e.x,
49
+ y: a.y > 0 ? o.y : e.y
50
+ };
51
+ }, o = (e, t, i, o, s) => {
52
+ let c = r(t, i);
53
+ return a({
54
+ x: c.x > 0 ? n((e.x * c.x + o) / c.x) : e.x,
55
+ y: c.y > 0 ? n((e.y * c.y + s) / c.y) : e.y
56
+ }, t, i);
57
+ }, s = (e) => typeof e == "number" && Number.isFinite(e), c = (t) => {
58
+ if (typeof t != "object" || !t) return e;
59
+ let r = t;
60
+ return {
61
+ x: s(r.x) ? n(r.x) : e.x,
62
+ y: s(r.y) ? n(r.y) : e.y
63
+ };
64
+ };
65
+ //#endregion
66
+ export { t as CAPSULE_SNAP_POINTS, e as DEFAULT_CAPSULE_PLACEMENT, o as capsulePlacementFromDrag, c as decodeCapsulePlacement, i as isSamePlacement, a as snapCapsulePlacement };
@@ -0,0 +1,47 @@
1
+ import { useDevtoolsStrings as e } from "../strings.js";
2
+ import { Component as t } from "react";
3
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
+ //#region src/components/boundary.tsx
5
+ var i = ({ error: t, onReset: i }) => {
6
+ let a = e().shell;
7
+ return /* @__PURE__ */ r("div", {
8
+ role: "alert",
9
+ className: "vdt-crash",
10
+ children: [
11
+ /* @__PURE__ */ n("div", {
12
+ className: "vdt-crash-title",
13
+ children: a.crashTitle
14
+ }),
15
+ /* @__PURE__ */ r("pre", {
16
+ className: "vdt-crash-message",
17
+ children: [
18
+ t.name,
19
+ ": ",
20
+ t.message
21
+ ]
22
+ }),
23
+ /* @__PURE__ */ n("button", {
24
+ type: "button",
25
+ className: "vdt-crash-reset",
26
+ onClick: i,
27
+ children: a.crashReset
28
+ })
29
+ ]
30
+ });
31
+ }, a = class extends t {
32
+ state = { error: null };
33
+ static getDerivedStateFromError(e) {
34
+ return { error: e };
35
+ }
36
+ componentDidCatch(e, t) {
37
+ this.props.onError?.(e, t);
38
+ }
39
+ render() {
40
+ return this.state.error === null ? this.props.children : /* @__PURE__ */ n(i, {
41
+ error: this.state.error,
42
+ onReset: () => this.setState({ error: null })
43
+ });
44
+ }
45
+ };
46
+ //#endregion
47
+ export { a as OverlayBoundary };