@voltro/devtools 0.85.0 → 0.87.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 +5987 -0
- package/THIRD-PARTY-NOTICES.md +1125 -34
- package/dist/Devtools.js +327 -0
- package/dist/capsuleClearance.js +42 -0
- package/dist/capsulePlacement.js +66 -0
- package/dist/components/boundary.js +47 -0
- package/dist/components/dockMenu.js +121 -0
- package/dist/components/icons.js +236 -0
- package/dist/components/primitives.js +75 -0
- package/dist/console/Capsule.js +169 -0
- package/dist/console/Console.js +508 -0
- package/dist/console/InspectRefusals.js +89 -0
- package/dist/console/searchIndex.js +63 -0
- package/dist/console/sources.js +106 -0
- package/dist/consoleBridge.js +76 -0
- package/dist/externalWindow.js +9 -0
- package/dist/index.js +3 -4382
- package/dist/inspectAuth.js +16 -0
- package/dist/inspectFetch.js +46 -0
- package/dist/inspectRefusal.js +45 -0
- package/dist/inspectStream.js +88 -0
- package/dist/logsBus.js +22 -0
- package/dist/panels/desktop.js +101 -0
- package/dist/panels/indexes.js +233 -0
- package/dist/panels/logs.js +55 -0
- package/dist/panels/mutations.js +81 -0
- package/dist/panels/pwa.js +171 -0
- package/dist/panels/routes.js +69 -0
- package/dist/panels/runtimes.js +67 -0
- package/dist/panels/stores.js +125 -0
- package/dist/panels/subscriptions.js +117 -0
- package/dist/panels/traces.js +160 -0
- package/dist/panels/webhooks.js +248 -0
- package/dist/panels/workflows.js +478 -0
- package/dist/pushPage.js +36 -0
- package/dist/shadowHost.js +77 -0
- package/dist/strings.js +332 -0
- package/dist/styles.css +20 -0
- package/dist/useCapsuleClearance.js +85 -0
- package/dist/useDevStatuses.js +6 -0
- package/dist/useDock.js +181 -0
- package/dist/useDocumentVisible.js +5 -0
- package/dist/useLiveCacheEntries.js +19 -0
- package/package.json +4 -4
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { Plug as e } from "../components/icons.js";
|
|
2
|
+
import { useDevtoolsStrings as t } from "../strings.js";
|
|
3
|
+
import { Badge as n, Button as r, Card as i, Empty as a, KeyValue as o, SectionTitle as s } from "../components/primitives.js";
|
|
4
|
+
import { useCallback as c, useEffect as l, useState as u } from "react";
|
|
5
|
+
import { useAppUpdate as d, useInstallPrompt as f, useOfflineStatus as p } from "@voltro/web";
|
|
6
|
+
import { usePlatform as m } from "@voltro/client";
|
|
7
|
+
import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
8
|
+
//#region src/panels/pwa.tsx
|
|
9
|
+
var v = (e, t) => ({
|
|
10
|
+
supported: t,
|
|
11
|
+
scope: e?.scope ?? null,
|
|
12
|
+
scriptUrl: e?.active?.scriptURL ?? e?.waiting?.scriptURL ?? e?.installing?.scriptURL ?? null,
|
|
13
|
+
installing: e?.installing?.state ?? null,
|
|
14
|
+
waiting: e?.waiting?.state ?? null,
|
|
15
|
+
active: e?.active?.state ?? null,
|
|
16
|
+
backgroundSync: e != null && "sync" in e && e.sync !== void 0
|
|
17
|
+
}), y = (e) => e.filter((e) => e.startsWith("voltro-")).sort(), b = (e) => {
|
|
18
|
+
try {
|
|
19
|
+
return new URL(e).host;
|
|
20
|
+
} catch {
|
|
21
|
+
return "(unparseable endpoint)";
|
|
22
|
+
}
|
|
23
|
+
}, x = async () => {
|
|
24
|
+
let e = typeof navigator > "u" ? void 0 : navigator, t = e?.serviceWorker !== void 0, n = t ? await e.serviceWorker.getRegistration().catch(() => void 0) : void 0, r = v(n ?? null, t), i = globalThis.caches, a = i ? y(await i.keys().catch(() => [])) : [], o = [];
|
|
25
|
+
for (let e of a) {
|
|
26
|
+
let t = i ? await i.open(e).then((e) => e.keys()).then((e) => e.length).catch(() => 0) : 0;
|
|
27
|
+
o.push({
|
|
28
|
+
name: e,
|
|
29
|
+
entries: t
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
let s = globalThis.Notification, c = null;
|
|
33
|
+
if (n?.pushManager) {
|
|
34
|
+
let e = await n.pushManager.getSubscription().catch(() => null);
|
|
35
|
+
c = e ? b(e.endpoint) : null;
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
worker: r,
|
|
39
|
+
caches: o,
|
|
40
|
+
pushPermission: s?.permission ?? null,
|
|
41
|
+
pushEndpointHost: c
|
|
42
|
+
};
|
|
43
|
+
}, S = (e) => e === "activated" ? "success" : e === null ? "neutral" : "warning", C = () => {
|
|
44
|
+
let v = t().pwa, y = d(), b = f(), C = p(), w = m(), [T, E] = u(null), D = c(() => {
|
|
45
|
+
x().then(E);
|
|
46
|
+
}, []);
|
|
47
|
+
if (l(() => {
|
|
48
|
+
D();
|
|
49
|
+
let e = typeof navigator > "u" ? void 0 : navigator;
|
|
50
|
+
return e?.serviceWorker?.addEventListener?.("controllerchange", D), () => {
|
|
51
|
+
e?.serviceWorker?.removeEventListener?.("controllerchange", D);
|
|
52
|
+
};
|
|
53
|
+
}, [D]), T === null) return /* @__PURE__ */ g(a, { children: v.loading });
|
|
54
|
+
if (!T.worker.supported) return /* @__PURE__ */ g(a, { children: v.unsupported });
|
|
55
|
+
let O = T.worker;
|
|
56
|
+
return /* @__PURE__ */ _("div", {
|
|
57
|
+
className: "vdt:flex vdt:flex-col vdt:gap-3 vdt:p-3",
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ _(i, { children: [/* @__PURE__ */ g(s, {
|
|
60
|
+
Icon: e,
|
|
61
|
+
right: /* @__PURE__ */ g(r, {
|
|
62
|
+
size: "sm",
|
|
63
|
+
onClick: D,
|
|
64
|
+
children: v.refresh
|
|
65
|
+
}),
|
|
66
|
+
children: v.worker
|
|
67
|
+
}), /* @__PURE__ */ g(o, { entries: [
|
|
68
|
+
{
|
|
69
|
+
key: v.scope,
|
|
70
|
+
value: O.scope ?? v.none
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
key: v.script,
|
|
74
|
+
value: O.scriptUrl ?? v.none
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
key: "installing",
|
|
78
|
+
value: /* @__PURE__ */ g(n, {
|
|
79
|
+
tone: S(O.installing),
|
|
80
|
+
children: O.installing ?? v.none
|
|
81
|
+
})
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
key: "waiting",
|
|
85
|
+
value: /* @__PURE__ */ g(n, {
|
|
86
|
+
tone: S(O.waiting),
|
|
87
|
+
children: O.waiting ?? v.none
|
|
88
|
+
})
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
key: "active",
|
|
92
|
+
value: /* @__PURE__ */ g(n, {
|
|
93
|
+
tone: S(O.active),
|
|
94
|
+
children: O.active ?? v.none
|
|
95
|
+
})
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
key: v.backgroundSync,
|
|
99
|
+
value: O.backgroundSync ? v.yes : v.no
|
|
100
|
+
}
|
|
101
|
+
] })] }),
|
|
102
|
+
/* @__PURE__ */ _(i, { children: [/* @__PURE__ */ g(s, {
|
|
103
|
+
right: /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g(r, {
|
|
104
|
+
size: "sm",
|
|
105
|
+
onClick: () => {
|
|
106
|
+
y.check();
|
|
107
|
+
},
|
|
108
|
+
children: v.checkNow
|
|
109
|
+
}), /* @__PURE__ */ g(r, {
|
|
110
|
+
size: "sm",
|
|
111
|
+
variant: "accent",
|
|
112
|
+
disabled: !y.updateAvailable,
|
|
113
|
+
onClick: () => {
|
|
114
|
+
y.apply({ force: !0 });
|
|
115
|
+
},
|
|
116
|
+
children: v.forceUpdate
|
|
117
|
+
})] }),
|
|
118
|
+
children: v.update
|
|
119
|
+
}), /* @__PURE__ */ g(o, { entries: [
|
|
120
|
+
{
|
|
121
|
+
key: v.currentBuild,
|
|
122
|
+
value: w.platform.appVersion ?? v.unknown
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
key: v.waitingBuild,
|
|
126
|
+
value: y.updateAvailable ? y.version ?? v.unknown : v.none
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
key: v.online,
|
|
130
|
+
value: C.online ? v.yes : v.no
|
|
131
|
+
}
|
|
132
|
+
] })] }),
|
|
133
|
+
/* @__PURE__ */ _(i, { children: [/* @__PURE__ */ g(s, { children: v.precache }), T.caches.length === 0 ? /* @__PURE__ */ g("div", {
|
|
134
|
+
className: "vdt:px-3 vdt:py-2 vdt:text-xs vdt:text-foreground-subtle",
|
|
135
|
+
children: v.noCaches
|
|
136
|
+
}) : /* @__PURE__ */ g(o, { entries: T.caches.map((e) => ({
|
|
137
|
+
key: e.name,
|
|
138
|
+
value: v.entries(e.entries)
|
|
139
|
+
})) })] }),
|
|
140
|
+
/* @__PURE__ */ _(i, { children: [/* @__PURE__ */ g(s, {
|
|
141
|
+
right: b.canInstall ? /* @__PURE__ */ g(r, {
|
|
142
|
+
size: "sm",
|
|
143
|
+
onClick: () => {
|
|
144
|
+
b.install();
|
|
145
|
+
},
|
|
146
|
+
children: v.install
|
|
147
|
+
}) : void 0,
|
|
148
|
+
children: v.installAndPush
|
|
149
|
+
}), /* @__PURE__ */ g(o, { entries: [
|
|
150
|
+
{
|
|
151
|
+
key: v.installed,
|
|
152
|
+
value: b.installed ? v.yes : v.no
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
key: v.installPrompt,
|
|
156
|
+
value: b.platform
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
key: v.pushPermission,
|
|
160
|
+
value: T.pushPermission ?? v.unknown
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
key: v.pushSubscription,
|
|
164
|
+
value: T.pushEndpointHost ?? v.none
|
|
165
|
+
}
|
|
166
|
+
] })] })
|
|
167
|
+
]
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
//#endregion
|
|
171
|
+
export { C as PwaPanel, v as describeRegistration, b as pushEndpointHost, y as voltroCacheNames };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Compass as e } from "../components/icons.js";
|
|
2
|
+
import { useDevtoolsStrings as t } from "../strings.js";
|
|
3
|
+
import { Card as n, Empty as r, KeyValue as i, SectionTitle as a } from "../components/primitives.js";
|
|
4
|
+
import { useEffect as o, useState as s, useSyncExternalStore as c } from "react";
|
|
5
|
+
import { getRouteSnapshot as l, subscribeRouteSnapshot as u } from "@voltro/web";
|
|
6
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
7
|
+
//#region src/panels/routes.tsx
|
|
8
|
+
var p = (e) => {
|
|
9
|
+
try {
|
|
10
|
+
return JSON.stringify(e, null, 2);
|
|
11
|
+
} catch {
|
|
12
|
+
return String(e);
|
|
13
|
+
}
|
|
14
|
+
}, m = () => c(u, l, l), h = () => {
|
|
15
|
+
let [e, t] = s(() => typeof window > "u" ? "/" : window.location.pathname);
|
|
16
|
+
return o(() => {
|
|
17
|
+
if (typeof window > "u") return;
|
|
18
|
+
let e = () => t(window.location.pathname);
|
|
19
|
+
window.addEventListener("popstate", e);
|
|
20
|
+
let n = setInterval(e, 1e3);
|
|
21
|
+
return () => {
|
|
22
|
+
window.removeEventListener("popstate", e), clearInterval(n);
|
|
23
|
+
};
|
|
24
|
+
}, []), e;
|
|
25
|
+
}, g = () => {
|
|
26
|
+
let o = m(), c = h(), l = t().routes, [u, g] = s(!0), _ = o.pathname === "/" && Object.keys(o.params).length === 0 && o.loaderData === void 0 && c !== "/" ? c : o.pathname, v = Object.entries(o.params).map(([e, t]) => ({
|
|
27
|
+
key: e,
|
|
28
|
+
value: String(t)
|
|
29
|
+
}));
|
|
30
|
+
return /* @__PURE__ */ f("div", {
|
|
31
|
+
className: "vdt:flex vdt:flex-col vdt:gap-3 vdt:p-3",
|
|
32
|
+
children: [/* @__PURE__ */ f(n, { children: [
|
|
33
|
+
/* @__PURE__ */ d(a, {
|
|
34
|
+
Icon: e,
|
|
35
|
+
children: l.currentRoute
|
|
36
|
+
}),
|
|
37
|
+
/* @__PURE__ */ d(i, { entries: [{
|
|
38
|
+
key: "pathname",
|
|
39
|
+
value: _
|
|
40
|
+
}, {
|
|
41
|
+
key: "params",
|
|
42
|
+
value: v.length === 0 ? "—" : ""
|
|
43
|
+
}] }),
|
|
44
|
+
v.length > 0 ? /* @__PURE__ */ d("div", {
|
|
45
|
+
className: "vdt:px-3 vdt:pb-3",
|
|
46
|
+
children: /* @__PURE__ */ d(i, { entries: v })
|
|
47
|
+
}) : null
|
|
48
|
+
] }), /* @__PURE__ */ f(n, { children: [
|
|
49
|
+
/* @__PURE__ */ d(a, {
|
|
50
|
+
Icon: e,
|
|
51
|
+
children: l.loaderData
|
|
52
|
+
}),
|
|
53
|
+
/* @__PURE__ */ d("button", {
|
|
54
|
+
onClick: () => g((e) => !e),
|
|
55
|
+
className: "vdt:px-3 vdt:py-1.5 vdt:text-[10px] vdt:uppercase vdt:tracking-wider vdt:text-foreground-muted vdt:hover:text-foreground",
|
|
56
|
+
children: u ? l.collapse : l.expand
|
|
57
|
+
}),
|
|
58
|
+
u ? o.loaderData === void 0 ? /* @__PURE__ */ f(r, { children: [l.noLoaderTitle, /* @__PURE__ */ d("div", {
|
|
59
|
+
className: "vdt:mt-1 vdt:text-foreground-subtle",
|
|
60
|
+
children: l.noLoaderHint(/* @__PURE__ */ d("code", { children: "<Router>" }))
|
|
61
|
+
})] }) : /* @__PURE__ */ d("pre", {
|
|
62
|
+
className: "vdt:px-3 vdt:pb-3 vdt:text-[11px] vdt:max-h-80 vdt:overflow-auto vdt:font-mono vdt:text-foreground",
|
|
63
|
+
children: p(o.loaderData)
|
|
64
|
+
}) : null
|
|
65
|
+
] })]
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
69
|
+
export { g as RoutesPanel };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Plug as e } from "../components/icons.js";
|
|
2
|
+
import { useDevtoolsStrings as t } from "../strings.js";
|
|
3
|
+
import { Badge as n, Card as r, Empty as i, KeyValue as a, SectionTitle as o } from "../components/primitives.js";
|
|
4
|
+
import { useFrameworkRuntimes as s } from "@voltro/client";
|
|
5
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
6
|
+
//#region src/panels/runtimes.tsx
|
|
7
|
+
var u = (e) => {
|
|
8
|
+
let t = 0, n = 0, r = 0, i = 0, a = 0;
|
|
9
|
+
for (let o of Object.values(e)) o.kind === "query" && (t += 1), o.kind === "mutation" && (n += 1), o.kind === "action" && (r += 1), o.kind === "stream" && (i += 1), o.kind === "workflow" && (a += 1);
|
|
10
|
+
return {
|
|
11
|
+
queries: t,
|
|
12
|
+
mutations: n,
|
|
13
|
+
actions: r,
|
|
14
|
+
streams: i,
|
|
15
|
+
workflows: a
|
|
16
|
+
};
|
|
17
|
+
}, d = () => {
|
|
18
|
+
let d = s(), f = t().runtimes, p = d.names;
|
|
19
|
+
return p.length === 0 ? /* @__PURE__ */ l(i, { children: [f.emptyTitle, /* @__PURE__ */ c("div", {
|
|
20
|
+
className: "vdt:mt-1 vdt:text-foreground-subtle",
|
|
21
|
+
children: f.emptyHint
|
|
22
|
+
})] }) : /* @__PURE__ */ c("div", {
|
|
23
|
+
className: "vdt:flex vdt:flex-col vdt:gap-3 vdt:p-3",
|
|
24
|
+
children: p.map((t) => {
|
|
25
|
+
let i = d.get(t), s = u(i.descriptors);
|
|
26
|
+
return /* @__PURE__ */ l(r, { children: [/* @__PURE__ */ c(o, {
|
|
27
|
+
Icon: e,
|
|
28
|
+
right: /* @__PURE__ */ c(n, {
|
|
29
|
+
tone: "success",
|
|
30
|
+
children: f.live
|
|
31
|
+
}),
|
|
32
|
+
children: t
|
|
33
|
+
}), /* @__PURE__ */ c(a, { entries: [
|
|
34
|
+
{
|
|
35
|
+
key: "queries",
|
|
36
|
+
value: String(s.queries)
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
key: "mutations",
|
|
40
|
+
value: String(s.mutations)
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
key: "actions",
|
|
44
|
+
value: String(s.actions)
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
key: "streams",
|
|
48
|
+
value: String(s.streams)
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
key: "workflows",
|
|
52
|
+
value: String(s.workflows)
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
key: "cacheSize",
|
|
56
|
+
value: String(i.cache.size())
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
key: "descriptors",
|
|
60
|
+
value: String(Object.keys(i.descriptors).length)
|
|
61
|
+
}
|
|
62
|
+
] })] }, t);
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
//#endregion
|
|
67
|
+
export { d as RuntimesPanel };
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { ArrowUpDown as e, Database as t, Trash as n } from "../components/icons.js";
|
|
2
|
+
import { Badge as r, Button as i, Card as a, Empty as o, KeyValue as s, SectionTitle as c } from "../components/primitives.js";
|
|
3
|
+
import { useState as l, useSyncExternalStore as u } from "react";
|
|
4
|
+
import { clearStoreHistory as d, definedStores as f, storeHistory as p, subscribeStoreHistory as m, travelToStoreState as h } from "@voltro/client";
|
|
5
|
+
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
6
|
+
//#region src/panels/stores.tsx
|
|
7
|
+
var y = () => u(m, p, p), b = (e, t = 90) => {
|
|
8
|
+
let n;
|
|
9
|
+
try {
|
|
10
|
+
n = JSON.stringify(e) ?? String(e);
|
|
11
|
+
} catch {
|
|
12
|
+
n = String(e);
|
|
13
|
+
}
|
|
14
|
+
return n.length > t ? `${n.slice(0, t)}…` : n;
|
|
15
|
+
}, x = (e, t) => typeof e != "object" || typeof t != "object" || e === null || t === null ? [] : [.../* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)])].filter((n) => !Object.is(e[n], t[n])), S = ({ label: e, state: t }) => {
|
|
16
|
+
let [n, i] = l(!1);
|
|
17
|
+
return /* @__PURE__ */ v("div", {
|
|
18
|
+
className: "vdt:border-t vdt:border-border",
|
|
19
|
+
children: [/* @__PURE__ */ v("button", {
|
|
20
|
+
type: "button",
|
|
21
|
+
className: "vdt:flex vdt:w-full vdt:items-center vdt:gap-2 vdt:px-3 vdt:py-2 vdt:text-left vdt:hover:bg-muted",
|
|
22
|
+
onClick: () => i((e) => !e),
|
|
23
|
+
children: [/* @__PURE__ */ _(r, {
|
|
24
|
+
tone: "neutral",
|
|
25
|
+
children: e
|
|
26
|
+
}), /* @__PURE__ */ _("span", {
|
|
27
|
+
className: "vdt:truncate vdt:font-mono vdt:text-[11px] vdt:text-foreground-muted",
|
|
28
|
+
children: b(t)
|
|
29
|
+
})]
|
|
30
|
+
}), n ? /* @__PURE__ */ _(s, { entries: Object.entries(t).map(([e, t]) => ({
|
|
31
|
+
key: e,
|
|
32
|
+
value: b(t, 200)
|
|
33
|
+
})) }) : null]
|
|
34
|
+
});
|
|
35
|
+
}, C = () => {
|
|
36
|
+
let u = y(), [p, m] = l(null), C = f(), w = p ?? u.length;
|
|
37
|
+
return /* @__PURE__ */ v(g, { children: [
|
|
38
|
+
/* @__PURE__ */ v(c, {
|
|
39
|
+
Icon: t,
|
|
40
|
+
right: /* @__PURE__ */ v(i, {
|
|
41
|
+
onClick: () => {
|
|
42
|
+
d(), m(null);
|
|
43
|
+
},
|
|
44
|
+
children: [/* @__PURE__ */ _(n, {}), "Clear"]
|
|
45
|
+
}),
|
|
46
|
+
children: [
|
|
47
|
+
"Stores (",
|
|
48
|
+
C.length,
|
|
49
|
+
")"
|
|
50
|
+
]
|
|
51
|
+
}),
|
|
52
|
+
C.length === 0 ? /* @__PURE__ */ _(o, { children: "No stores defined. `defineStore(name, () => state)` in a *.store.ts file." }) : C.map((e) => /* @__PURE__ */ v(a, { children: [
|
|
53
|
+
/* @__PURE__ */ _(c, { children: e.name }),
|
|
54
|
+
/* @__PURE__ */ _(S, {
|
|
55
|
+
label: "global",
|
|
56
|
+
state: e.get()
|
|
57
|
+
}),
|
|
58
|
+
e.keys().map((t) => /* @__PURE__ */ _(S, {
|
|
59
|
+
label: t,
|
|
60
|
+
state: e.get(t)
|
|
61
|
+
}, t))
|
|
62
|
+
] }, e.name)),
|
|
63
|
+
/* @__PURE__ */ v(c, {
|
|
64
|
+
Icon: e,
|
|
65
|
+
right: /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(i, {
|
|
66
|
+
onClick: () => {
|
|
67
|
+
w <= 0 || h(w - 1, "before") && m(w - 1);
|
|
68
|
+
},
|
|
69
|
+
disabled: w <= 0,
|
|
70
|
+
children: "◀ Back"
|
|
71
|
+
}), /* @__PURE__ */ _(i, {
|
|
72
|
+
onClick: () => {
|
|
73
|
+
p === null || w >= u.length || h(w, "after") && m(w + 1);
|
|
74
|
+
},
|
|
75
|
+
disabled: p === null || w >= u.length,
|
|
76
|
+
children: "Forward ▶"
|
|
77
|
+
})] }),
|
|
78
|
+
children: [
|
|
79
|
+
"Writes (",
|
|
80
|
+
u.length,
|
|
81
|
+
")",
|
|
82
|
+
p === null ? "" : ` — travelled to ${w}/${u.length}`
|
|
83
|
+
]
|
|
84
|
+
}),
|
|
85
|
+
u.length === 0 ? /* @__PURE__ */ _(o, { children: "No writes yet. Every `set()` lands here, labelled if you pass one." }) : [...u].reverse().map((e, t) => {
|
|
86
|
+
let n = u.length - 1 - t, i = x(e.prev, e.next);
|
|
87
|
+
return /* @__PURE__ */ v(a, { children: [/* @__PURE__ */ v("div", {
|
|
88
|
+
className: "vdt:flex vdt:items-center vdt:gap-2 vdt:px-3 vdt:py-2",
|
|
89
|
+
children: [
|
|
90
|
+
/* @__PURE__ */ _(r, {
|
|
91
|
+
tone: e.isUndo === !0 ? "warning" : "neutral",
|
|
92
|
+
children: e.store
|
|
93
|
+
}),
|
|
94
|
+
e.key === void 0 ? null : /* @__PURE__ */ _(r, {
|
|
95
|
+
tone: "neutral",
|
|
96
|
+
children: e.key
|
|
97
|
+
}),
|
|
98
|
+
e.label === void 0 ? null : /* @__PURE__ */ _("span", {
|
|
99
|
+
className: "vdt:truncate vdt:font-mono vdt:text-[11px] vdt:text-foreground-muted",
|
|
100
|
+
children: e.label
|
|
101
|
+
}),
|
|
102
|
+
p !== null && n === w ? /* @__PURE__ */ _(r, {
|
|
103
|
+
tone: "info",
|
|
104
|
+
children: "here"
|
|
105
|
+
}) : null
|
|
106
|
+
]
|
|
107
|
+
}), /* @__PURE__ */ _(s, { entries: [
|
|
108
|
+
{
|
|
109
|
+
key: "changed",
|
|
110
|
+
value: i.length > 0 ? i.join(", ") : "(no field diff)"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
key: "before",
|
|
114
|
+
value: b(e.prev)
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
key: "after",
|
|
118
|
+
value: b(e.next)
|
|
119
|
+
}
|
|
120
|
+
] })] }, `${e.at}-${n}`);
|
|
121
|
+
})
|
|
122
|
+
] });
|
|
123
|
+
};
|
|
124
|
+
//#endregion
|
|
125
|
+
export { C as StoresPanel };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { KeyValue as e } from "../components/primitives.js";
|
|
2
|
+
import { useLiveCacheEntries as t } from "../useLiveCacheEntries.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { useFrameworkRuntimes as n } from "@voltro/client";
|
|
5
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
6
|
+
//#region src/panels/subscriptions.tsx
|
|
7
|
+
var a = () => {
|
|
8
|
+
let e = n();
|
|
9
|
+
return e.names.map((t) => ({
|
|
10
|
+
name: t,
|
|
11
|
+
entries: e.get(t).cache.peekAll()
|
|
12
|
+
}));
|
|
13
|
+
}, o = () => {
|
|
14
|
+
let e = n(), r = e.names[0] ? e.get(e.names[0]) : null;
|
|
15
|
+
return t(r?.cache ?? null), a();
|
|
16
|
+
}, s = (e) => {
|
|
17
|
+
if (e instanceof Error) {
|
|
18
|
+
let t = e._tag;
|
|
19
|
+
return `${typeof t == "string" ? t : e.name}: ${e.message}`;
|
|
20
|
+
}
|
|
21
|
+
if (typeof e == "object" && e) {
|
|
22
|
+
let { _tag: t, message: n } = e;
|
|
23
|
+
if (typeof t == "string") return typeof n == "string" && n !== "" ? `${t}: ${n}` : t;
|
|
24
|
+
try {
|
|
25
|
+
return JSON.stringify(e);
|
|
26
|
+
} catch {
|
|
27
|
+
return String(e);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return String(e);
|
|
31
|
+
}, c = (e) => {
|
|
32
|
+
try {
|
|
33
|
+
let t = JSON.parse(e);
|
|
34
|
+
if (Array.isArray(t)) {
|
|
35
|
+
let [e, ...n] = t;
|
|
36
|
+
return n.length === 0 || n.length === 1 && (n[0] === void 0 || JSON.stringify(n[0]) === "{}") ? String(e) : `${String(e)}(${n.map((e) => JSON.stringify(e)).join(", ")})`;
|
|
37
|
+
}
|
|
38
|
+
} catch {}
|
|
39
|
+
return e;
|
|
40
|
+
}, l = ({ entry: t }) => /* @__PURE__ */ i("div", {
|
|
41
|
+
className: "vdt:bg-background/60",
|
|
42
|
+
children: [/* @__PURE__ */ r(e, { entries: [
|
|
43
|
+
{
|
|
44
|
+
key: "tag",
|
|
45
|
+
value: t.tag ?? "—"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
key: "source",
|
|
49
|
+
value: t.source ?? "—"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
key: "subscribers",
|
|
53
|
+
value: String(t.subscriberCount)
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
key: "fiber",
|
|
57
|
+
value: t.hasFiber ? "running" : t.evicting ? "evicting" : "idle"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
key: "recovery",
|
|
61
|
+
value: t.recovery.phase
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
key: "recoveryAttempt",
|
|
65
|
+
value: String(t.recovery.attempt)
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
key: "basePreserved",
|
|
69
|
+
value: String(t.recovery.basePreserved)
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
key: "lastTransportFailureAt",
|
|
73
|
+
value: t.recovery.lastTransportFailureAt ? new Date(t.recovery.lastTransportFailureAt).toISOString() : "—"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
key: "lastReissueAt",
|
|
77
|
+
value: t.recovery.lastReissueAt ? new Date(t.recovery.lastReissueAt).toISOString() : "—"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
key: "lastDeliveryAt",
|
|
81
|
+
value: t.recovery.lastDeliveryAt ? new Date(t.recovery.lastDeliveryAt).toISOString() : "—"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
key: "revision",
|
|
85
|
+
value: t.snapshot.revision >= 0 ? String(t.snapshot.revision) : "—"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
key: "emittedAt",
|
|
89
|
+
value: t.snapshot.emittedAt ? new Date(t.snapshot.emittedAt).toISOString() : "—"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
key: "pendingPatches",
|
|
93
|
+
value: String(t.snapshot.pendingPatches)
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
key: "error",
|
|
97
|
+
value: t.snapshot.error === void 0 ? "—" : s(t.snapshot.error)
|
|
98
|
+
}
|
|
99
|
+
] }), /* @__PURE__ */ i("details", {
|
|
100
|
+
className: "vdt:px-3 vdt:py-2 vdt:border-t vdt:border-border",
|
|
101
|
+
children: [/* @__PURE__ */ r("summary", {
|
|
102
|
+
className: "vdt:text-[10px] vdt:uppercase vdt:tracking-wider vdt:text-foreground-muted vdt:cursor-pointer",
|
|
103
|
+
children: "Data"
|
|
104
|
+
}), /* @__PURE__ */ r("pre", {
|
|
105
|
+
className: "vdt:mt-2 vdt:text-[11px] vdt:text-foreground vdt:max-h-64 vdt:overflow-auto vdt:font-mono",
|
|
106
|
+
children: (() => {
|
|
107
|
+
try {
|
|
108
|
+
return JSON.stringify(t.snapshot.data, null, 2);
|
|
109
|
+
} catch {
|
|
110
|
+
return String(t.snapshot.data);
|
|
111
|
+
}
|
|
112
|
+
})()
|
|
113
|
+
})]
|
|
114
|
+
})]
|
|
115
|
+
}), u = () => o().reduce((e, t) => e + t.entries.length, 0);
|
|
116
|
+
//#endregion
|
|
117
|
+
export { l as SubscriptionDetail, s as describeSubscriptionError, c as formatCacheKey, o as useLiveApiSections, u as useSubscriptionsCount };
|