@plitzi/sdk-dev-tools 0.36.1 → 0.36.2

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 (61) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/DevToolsContainer.mjs +54 -53
  3. package/dist/DevToolsRoot.d.ts +18 -0
  4. package/dist/DevToolsRoot.mjs +43 -0
  5. package/dist/components/DevToolsPanel/DevToolsBody.mjs +33 -31
  6. package/dist/components/DevToolsPanel/DevToolsHeader.mjs +5 -0
  7. package/dist/components/DevToolsPanel/tabs/ActionsViewer/components/RunDetail/RunDetail.mjs +14 -14
  8. package/dist/components/DevToolsPanel/tabs/ActionsViewer/helpers.d.ts +0 -1
  9. package/dist/components/DevToolsPanel/tabs/ActionsViewer/helpers.mjs +1 -1
  10. package/dist/components/DevToolsPanel/tabs/CacheViewer/CacheViewer.d.ts +12 -0
  11. package/dist/components/DevToolsPanel/tabs/CacheViewer/CacheViewer.mjs +91 -0
  12. package/dist/components/DevToolsPanel/tabs/CacheViewer/components/CacheRow/CacheRow.d.ts +16 -0
  13. package/dist/components/DevToolsPanel/tabs/CacheViewer/components/CacheRow/CacheRow.mjs +87 -0
  14. package/dist/components/DevToolsPanel/tabs/CacheViewer/components/CacheRow/index.d.ts +3 -0
  15. package/dist/components/DevToolsPanel/tabs/CacheViewer/components/CacheRow/index.mjs +5 -0
  16. package/dist/components/DevToolsPanel/tabs/CacheViewer/index.d.ts +2 -0
  17. package/dist/components/DevToolsPanel/tabs/CacheViewer/index.mjs +5 -0
  18. package/dist/components/DevToolsPanel/tabs/StoreViewer/StoreViewer.mjs +52 -54
  19. package/dist/components/DevToolsPanel/tabs/StoreViewer/components/FreshnessMark/FreshnessMark.d.ts +16 -0
  20. package/dist/components/DevToolsPanel/tabs/StoreViewer/components/FreshnessMark/FreshnessMark.mjs +13 -0
  21. package/dist/components/DevToolsPanel/tabs/StoreViewer/components/FreshnessMark/index.d.ts +3 -0
  22. package/dist/components/DevToolsPanel/tabs/StoreViewer/components/{FreshnessPanel → FreshnessMark}/index.mjs +2 -2
  23. package/dist/components/DevToolsPanel/tabs/StoreViewer/helpers/renderFreshnessKey.d.ts +14 -0
  24. package/dist/components/DevToolsPanel/tabs/StoreViewer/helpers/renderFreshnessKey.mjs +18 -0
  25. package/dist/components/DevToolsPanel/tabs/TracingViewer/helpers.d.ts +5 -0
  26. package/dist/components/DevToolsPanel/tabs/TracingViewer/helpers.mjs +65 -55
  27. package/dist/components/PayloadView/PayloadView.d.ts +11 -0
  28. package/dist/components/{DevToolsPanel/tabs/ActionsViewer/components/PayloadView → PayloadView}/PayloadView.mjs +1 -1
  29. package/dist/components/PayloadView/index.mjs +5 -0
  30. package/dist/freshness/describeQueryPath.d.ts +22 -0
  31. package/dist/freshness/describeQueryPath.mjs +22 -0
  32. package/dist/freshness/formatDuration.d.ts +3 -0
  33. package/dist/freshness/formatDuration.mjs +9 -0
  34. package/dist/freshness/index.d.ts +8 -0
  35. package/dist/freshness/index.mjs +6 -0
  36. package/dist/freshness/rows.d.ts +42 -0
  37. package/dist/freshness/rows.mjs +29 -0
  38. package/dist/freshness/useFreshnessByStore.d.ts +15 -0
  39. package/dist/freshness/useFreshnessByStore.mjs +20 -0
  40. package/dist/freshness/useSecondsClock.d.ts +8 -0
  41. package/dist/freshness/useSecondsClock.mjs +12 -0
  42. package/dist/scope/helpers.d.ts +1 -0
  43. package/dist/scope/helpers.mjs +7 -7
  44. package/dist/scope/useScope.d.ts +3 -1
  45. package/dist/scope/useScope.mjs +21 -18
  46. package/dist/useRegisterQueriesStore.mjs +3 -3
  47. package/package.json +89 -49
  48. package/dist/components/DevToolsPanel/tabs/ActionsViewer/components/PayloadView/PayloadView.d.ts +0 -6
  49. package/dist/components/DevToolsPanel/tabs/ActionsViewer/components/PayloadView/index.mjs +0 -5
  50. package/dist/components/DevToolsPanel/tabs/StoreViewer/components/FreshnessPanel/FreshnessPanel.d.ts +0 -11
  51. package/dist/components/DevToolsPanel/tabs/StoreViewer/components/FreshnessPanel/FreshnessPanel.mjs +0 -49
  52. package/dist/components/DevToolsPanel/tabs/StoreViewer/components/FreshnessPanel/components/FreshnessRow/FreshnessRow.d.ts +0 -7
  53. package/dist/components/DevToolsPanel/tabs/StoreViewer/components/FreshnessPanel/components/FreshnessRow/FreshnessRow.mjs +0 -43
  54. package/dist/components/DevToolsPanel/tabs/StoreViewer/components/FreshnessPanel/components/FreshnessRow/index.d.ts +0 -3
  55. package/dist/components/DevToolsPanel/tabs/StoreViewer/components/FreshnessPanel/components/FreshnessRow/index.mjs +0 -5
  56. package/dist/components/DevToolsPanel/tabs/StoreViewer/components/FreshnessPanel/helpers.d.ts +0 -14
  57. package/dist/components/DevToolsPanel/tabs/StoreViewer/components/FreshnessPanel/helpers.mjs +0 -18
  58. package/dist/components/DevToolsPanel/tabs/StoreViewer/components/FreshnessPanel/index.d.ts +0 -3
  59. package/dist/scope/useFreshnessRecords.d.ts +0 -3
  60. package/dist/scope/useFreshnessRecords.mjs +0 -8
  61. /package/dist/components/{DevToolsPanel/tabs/ActionsViewer/components/PayloadView → PayloadView}/index.d.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @plitzi/sdk-dev-tools
2
2
 
3
+ ## 0.36.2
4
+
5
+ ### Patch Changes
6
+
7
+ - v0.36.2
8
+ - Updated dependencies
9
+ - @plitzi/sdk-navigation@0.36.2
10
+ - @plitzi/sdk-schema@0.36.2
11
+ - @plitzi/sdk-shared@0.36.2
12
+ - @plitzi/sdk-style@0.36.2
13
+
3
14
  ## 0.36.1
4
15
 
5
16
  ### Patch Changes
@@ -1,60 +1,61 @@
1
1
  import { useIsSelectedInstance as e } from "./instanceRegistry.mjs";
2
2
  import t from "./components/DevToolsOverlay/index.mjs";
3
3
  import n from "./DevToolsContextProvider.mjs";
4
- import r from "./useHydrated.mjs";
5
- import i from "./useRegisterQueriesStore.mjs";
6
- import a from "./useRegisterRootStore.mjs";
7
- import o from "@plitzi/plitzi-ui/ContainerShadow";
8
- import s from "@plitzi/plitzi-ui/hooks/useStorage";
9
- import c from "clsx";
10
- import { useCallback as l, useRef as u, useState as d } from "react";
11
- import { DevStoreScopeContext as f } from "@plitzi/nexus/react";
12
- import p from "@plitzi/sdk-shared/theme/useTheme";
13
- import { jsx as m, jsxs as h } from "react/jsx-runtime";
4
+ import r from "./DevToolsRoot.mjs";
5
+ import i from "./useHydrated.mjs";
6
+ import a from "./useRegisterQueriesStore.mjs";
7
+ import o from "./useRegisterRootStore.mjs";
8
+ import s from "@plitzi/plitzi-ui/ContainerShadow";
9
+ import c from "@plitzi/plitzi-ui/hooks/useStorage";
10
+ import l from "clsx";
11
+ import { useCallback as u, useRef as d, useState as f } from "react";
12
+ import { DevStoreScopeContext as p } from "@plitzi/nexus/react";
13
+ import m from "@plitzi/sdk-shared/theme/useTheme";
14
+ import { jsx as h, jsxs as g } from "react/jsx-runtime";
14
15
  //#region src/DevToolsContainer.tsx
15
- var g = "horizontal", _ = 0, v = ({ children: v, className: y, innerClassName: b, enabled: x = !1, instanceId: S, renderMode: C = "default", devToolsStyle: w = "", devToolsStyleLink: T = "" }) => {
16
- let { resolvedTheme: E } = p(), [D, O] = s("plitzi-sdk.dev-tools.orientation", g), [k, A] = s("plitzi-sdk.dev-tools.collapsed", !0), [j, M] = s("plitzi-sdk.dev-tools.tab", "logs"), [N, P] = d(), F = u(void 0);
17
- F.current ||= `sdk-instance-${++_}`;
18
- let I = S || F.current, L = r(), R = L ? D : g, z = e(I, x);
19
- a(x), i(z, I);
20
- let B = l((e) => O(e), [O]), V = l((e) => {
21
- e && M("logs"), P(e), A(!1);
22
- }, [A, M]), H = l(() => A(!0), [A]), U = l((e) => {
23
- P(void 0), M(e);
24
- }, [M]);
25
- return x ? /* @__PURE__ */ h("div", {
26
- className: c("relative flex grow overflow-auto", {
27
- "flex-col": R === "horizontal",
28
- "h-screen": R === "vertical"
29
- }, y),
30
- children: [/* @__PURE__ */ m(f, {
31
- value: I,
32
- children: /* @__PURE__ */ m("div", {
33
- className: c("grow basis-0 flex-col overflow-auto", b),
34
- children: v
16
+ var _ = "horizontal", v = 0, y = ({ children: y, className: b, innerClassName: x, enabled: S = !1, instanceId: C, renderMode: w = "default", devToolsStyle: T = "", devToolsStyleLink: E = "" }) => {
17
+ let { resolvedTheme: D } = m(), [O, k] = c("plitzi-sdk.dev-tools.orientation", _), [A, j] = c("plitzi-sdk.dev-tools.collapsed", !0), [M, N] = c("plitzi-sdk.dev-tools.tab", "logs"), [P, F] = f(), I = d(void 0);
18
+ I.current ||= `sdk-instance-${++v}`;
19
+ let L = C || I.current, R = i(), z = R ? O : _, B = e(L, S);
20
+ o(S), a(B, L);
21
+ let V = u((e) => k(e), [k]), H = u((e) => {
22
+ e && N("logs"), F(e), j(!1);
23
+ }, [j, N]), U = u(() => j(!0), [j]), W = u((e) => {
24
+ F(void 0), N(e);
25
+ }, [N]);
26
+ return S ? /* @__PURE__ */ g("div", {
27
+ className: l("relative flex grow overflow-auto", {
28
+ "flex-col": z === "horizontal",
29
+ "h-screen": z === "vertical"
30
+ }, b),
31
+ children: [/* @__PURE__ */ h(p, {
32
+ value: L,
33
+ children: /* @__PURE__ */ h("div", {
34
+ className: l("grow basis-0 flex-col overflow-auto", x),
35
+ children: y
35
36
  })
36
- }), z && L && /* @__PURE__ */ h(n, { children: [C === "default" && /* @__PURE__ */ m(t, {
37
- className: c({ dark: E === "dark" }),
38
- collapsed: k,
39
- orientation: R,
40
- tabSelected: j,
41
- logTypeFilter: N,
42
- onOpen: V,
43
- onCollapse: H,
44
- onTabSelect: U,
45
- onChangeOrientation: B
46
- }), C === "shadow" && /* @__PURE__ */ h(o, { children: [T && /* @__PURE__ */ m(o.Link, { href: T }), /* @__PURE__ */ h(o.Content, { children: [/* @__PURE__ */ m("style", { dangerouslySetInnerHTML: { __html: w } }), /* @__PURE__ */ m(t, {
47
- className: c({ dark: E === "dark" }),
48
- collapsed: k,
49
- orientation: R,
50
- tabSelected: j,
51
- logTypeFilter: N,
52
- onOpen: V,
53
- onCollapse: H,
54
- onTabSelect: U,
55
- onChangeOrientation: B
56
- })] })] })] })]
57
- }) : v;
37
+ }), B && R && /* @__PURE__ */ h(r, { children: /* @__PURE__ */ g(n, { children: [w === "default" && /* @__PURE__ */ h(t, {
38
+ className: l({ dark: D === "dark" }),
39
+ collapsed: A,
40
+ orientation: z,
41
+ tabSelected: M,
42
+ logTypeFilter: P,
43
+ onOpen: H,
44
+ onCollapse: U,
45
+ onTabSelect: W,
46
+ onChangeOrientation: V
47
+ }), w === "shadow" && /* @__PURE__ */ g(s, { children: [E && /* @__PURE__ */ h(s.Link, { href: E }), /* @__PURE__ */ g(s.Content, { children: [/* @__PURE__ */ h("style", { dangerouslySetInnerHTML: { __html: T } }), /* @__PURE__ */ h(t, {
48
+ className: l({ dark: D === "dark" }),
49
+ collapsed: A,
50
+ orientation: z,
51
+ tabSelected: M,
52
+ logTypeFilter: P,
53
+ onOpen: H,
54
+ onCollapse: U,
55
+ onTabSelect: W,
56
+ onChangeOrientation: V
57
+ })] })] })] }) })]
58
+ }) : y;
58
59
  };
59
60
  //#endregion
60
- export { v as default };
61
+ export { y as default };
@@ -0,0 +1,18 @@
1
+ import { ReactNode } from 'react';
2
+ export type DevToolsRootProps = {
3
+ children: ReactNode;
4
+ };
5
+ /**
6
+ * Renders the panel in a React root of its own, inside a node the page's root leaves alone.
7
+ *
8
+ * In the page's root, every render of the panel was a commit of the page: the tracing tab recorded the panel profiling
9
+ * itself, a log arriving re-rendered through the app's scheduler, and what a tab switch cost read higher with the
10
+ * panel open than without it. In its own root the panel's work is its own.
11
+ *
12
+ * The node stays where the panel always sat — the flex sibling of the space, which is how it docks and what the
13
+ * collapsed badge positions itself against — so only the React tree moves, not the layout. What the panel reads from
14
+ * the page's providers is carried over: the root store, plitzi-ui's theme, the theme scope, and the two plugin
15
+ * registries.
16
+ */
17
+ declare const DevToolsRoot: ({ children }: DevToolsRootProps) => import("react").JSX.Element;
18
+ export default DevToolsRoot;
@@ -0,0 +1,43 @@
1
+ import { use as e, useContext as t, useLayoutEffect as n, useRef as r } from "react";
2
+ import { StoreContext as i } from "@plitzi/nexus/react";
3
+ import { jsx as a } from "react/jsx-runtime";
4
+ import o from "@plitzi/sdk-plugins/PluginsContext";
5
+ import s from "@plitzi/sdk-shared/elements/ComponentContext";
6
+ import { ThemeContext as c } from "@plitzi/plitzi-ui/Provider";
7
+ import { createRoot as l } from "react-dom/client";
8
+ import u from "@plitzi/sdk-shared/theme/ThemeScope";
9
+ //#region src/DevToolsRoot.tsx
10
+ var d = { display: "contents" }, f = ({ children: f }) => {
11
+ let p = r(null), m = r(void 0), h = r(void 0), g = t(i), _ = e(u), v = e(o), y = e(s), b = e(c);
12
+ return n(() => {
13
+ let e = p.current;
14
+ if (e) return clearTimeout(h.current), m.current ??= l(e), () => {
15
+ let e = m.current;
16
+ h.current = setTimeout(() => {
17
+ e?.unmount(), m.current === e && (m.current = void 0);
18
+ }, 0);
19
+ };
20
+ }, []), n(() => {
21
+ m.current?.render(/* @__PURE__ */ a(i, {
22
+ value: g,
23
+ children: /* @__PURE__ */ a(c, {
24
+ value: b,
25
+ children: /* @__PURE__ */ a(u, {
26
+ value: _,
27
+ children: /* @__PURE__ */ a(o, {
28
+ value: v,
29
+ children: /* @__PURE__ */ a(s, {
30
+ value: y,
31
+ children: f
32
+ })
33
+ })
34
+ })
35
+ })
36
+ }));
37
+ }), /* @__PURE__ */ a("div", {
38
+ ref: p,
39
+ style: d
40
+ });
41
+ };
42
+ //#endregion
43
+ export { f as default };
@@ -1,42 +1,44 @@
1
1
  import e from "./tabs/ActionsViewer/index.mjs";
2
- import t from "./tabs/ElementsViewer/index.mjs";
3
- import n from "./tabs/HistoryViewer/index.mjs";
4
- import r from "./tabs/Logs/index.mjs";
5
- import i from "./tabs/PluginsViewer/PluginsViewer.mjs";
6
- import a from "./tabs/StoreViewer/index.mjs";
7
- import o from "./tabs/TracingViewer/TracingViewer.mjs";
8
- import s from "./tabs/VariablesViewer/index.mjs";
9
- import c from "clsx";
10
- import { use as l } from "react";
11
- import u from "@plitzi/sdk-shared/devTools/DevToolsContext";
12
- import { jsx as d, jsxs as f } from "react/jsx-runtime";
2
+ import t from "./tabs/CacheViewer/index.mjs";
3
+ import n from "./tabs/ElementsViewer/index.mjs";
4
+ import r from "./tabs/HistoryViewer/index.mjs";
5
+ import i from "./tabs/Logs/index.mjs";
6
+ import a from "./tabs/PluginsViewer/PluginsViewer.mjs";
7
+ import o from "./tabs/StoreViewer/index.mjs";
8
+ import s from "./tabs/TracingViewer/TracingViewer.mjs";
9
+ import c from "./tabs/VariablesViewer/index.mjs";
10
+ import l from "clsx";
11
+ import { use as u } from "react";
12
+ import d from "@plitzi/sdk-shared/devTools/DevToolsContext";
13
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
13
14
  //#region src/components/DevToolsPanel/DevToolsBody.tsx
14
- var p = ({ className: p, tabSelected: m, orientation: h, logTypeFilter: g, elementSelected: _, onSelectElement: v }) => {
15
- let { logs: y, clearLogs: b } = l(u);
16
- return /* @__PURE__ */ d("div", {
17
- className: c("flex h-full w-full grow overflow-auto bg-white dark:bg-zinc-900", p),
18
- children: /* @__PURE__ */ f("div", {
15
+ var m = ({ className: m, tabSelected: h, orientation: g, logTypeFilter: _, elementSelected: v, onSelectElement: y }) => {
16
+ let { logs: b, clearLogs: x } = u(d);
17
+ return /* @__PURE__ */ f("div", {
18
+ className: l("flex h-full w-full grow overflow-auto bg-white dark:bg-zinc-900", m),
19
+ children: /* @__PURE__ */ p("div", {
19
20
  className: "flex w-full flex-col",
20
21
  children: [
21
- m === "logs" && /* @__PURE__ */ d(r, {
22
- items: y,
23
- orientation: h,
24
- logTypeFilter: g,
25
- onClear: b
22
+ h === "logs" && /* @__PURE__ */ f(i, {
23
+ items: b,
24
+ orientation: g,
25
+ logTypeFilter: _,
26
+ onClear: x
26
27
  }),
27
- m === "store" && /* @__PURE__ */ d(a, { elementSelected: _ }),
28
- m === "history" && /* @__PURE__ */ d(n, {}),
29
- m === "variables" && /* @__PURE__ */ d(s, {}),
30
- m === "elements" && /* @__PURE__ */ d(t, {
31
- elementSelected: _,
32
- onSelectElement: v
28
+ h === "store" && /* @__PURE__ */ f(o, { elementSelected: v }),
29
+ h === "cache" && /* @__PURE__ */ f(t, {}),
30
+ h === "history" && /* @__PURE__ */ f(r, {}),
31
+ h === "variables" && /* @__PURE__ */ f(c, {}),
32
+ h === "elements" && /* @__PURE__ */ f(n, {
33
+ elementSelected: v,
34
+ onSelectElement: y
33
35
  }),
34
- m === "plugins" && /* @__PURE__ */ d(i, {}),
35
- m === "tracing" && /* @__PURE__ */ d(o, {}),
36
- m === "actions" && /* @__PURE__ */ d(e, {})
36
+ h === "plugins" && /* @__PURE__ */ f(a, {}),
37
+ h === "tracing" && /* @__PURE__ */ f(s, {}),
38
+ h === "actions" && /* @__PURE__ */ f(e, {})
37
39
  ]
38
40
  })
39
41
  });
40
42
  };
41
43
  //#endregion
42
- export { p as default };
44
+ export { m as default };
@@ -16,6 +16,11 @@ var s = [
16
16
  label: "Store",
17
17
  icon: "fa-solid fa-database"
18
18
  },
19
+ {
20
+ id: "cache",
21
+ label: "Cache",
22
+ icon: "fa-solid fa-hourglass-half"
23
+ },
19
24
  {
20
25
  id: "history",
21
26
  label: "History",
@@ -1,6 +1,6 @@
1
- import { MODE_LABEL as e, failedStep as t, formatMs as n, formatTime as r, isLive as i, runDuration as a, statusTone as o, traceResultOf as s } from "../../helpers.mjs";
2
- import c from "../FlowTimeline/index.mjs";
3
- import l from "../PayloadView/index.mjs";
1
+ import e from "../../../../../PayloadView/index.mjs";
2
+ import { MODE_LABEL as t, failedStep as n, formatMs as r, formatTime as i, isLive as a, runDuration as o, statusTone as s, traceResultOf as c } from "../../helpers.mjs";
3
+ import l from "../FlowTimeline/index.mjs";
4
4
  import u from "clsx";
5
5
  import { useMemo as d } from "react";
6
6
  import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
@@ -12,7 +12,7 @@ var h = {
12
12
  warning: "bg-amber-500/15 text-amber-600 dark:text-amber-400",
13
13
  custom: "bg-zinc-500/15 text-zinc-500 dark:text-zinc-400"
14
14
  }, g = "This page was sent what the flow DID, not what each step read or answered. Open the action in the builder, or run the deployment in dev mode, to inspect a step.", _ = "The server did not send the steps for this run: the action is behind a session, or this page is not authorized to debug it.", v = "The flow is still running. Its steps arrive with the answer.", y = ({ run: y, selectedStepId: b, onSelectStep: x }) => {
15
- let S = t(y.steps), C = a(y), w = d(() => b === void 0 ? void 0 : s(y.trace, b), [y.trace, b]);
15
+ let S = n(y.steps), C = o(y), w = d(() => b === void 0 ? void 0 : c(y.trace, b), [y.trace, b]);
16
16
  return /* @__PURE__ */ m(f, { children: [
17
17
  /* @__PURE__ */ m("div", {
18
18
  className: "flex items-center gap-1.5",
@@ -20,7 +20,7 @@ var h = {
20
20
  className: "truncate text-xs font-medium text-zinc-700 dark:text-zinc-100",
21
21
  children: y.actionId || "(no action named)"
22
22
  }), /* @__PURE__ */ p("span", {
23
- className: u("shrink-0 rounded px-1 py-0.5 text-[9px]", h[o(y.status)]),
23
+ className: u("shrink-0 rounded px-1 py-0.5 text-[9px]", h[s(y.status)]),
24
24
  children: y.reason ?? y.status
25
25
  })]
26
26
  }),
@@ -40,9 +40,9 @@ var h = {
40
40
  }),
41
41
  y.steps === void 0 && /* @__PURE__ */ p("span", {
42
42
  className: "text-zinc-400 italic dark:text-zinc-500",
43
- children: i(y) ? v : _
43
+ children: a(y) ? v : _
44
44
  }),
45
- y.steps !== void 0 && /* @__PURE__ */ p(c, {
45
+ y.steps !== void 0 && /* @__PURE__ */ p(l, {
46
46
  steps: y.steps,
47
47
  selectedStepId: b,
48
48
  onSelectStep: x
@@ -53,7 +53,7 @@ var h = {
53
53
  }),
54
54
  w !== void 0 && /* @__PURE__ */ p("div", {
55
55
  className: "overflow-auto rounded border border-zinc-200 dark:border-zinc-700",
56
- children: /* @__PURE__ */ p(l, { value: w })
56
+ children: /* @__PURE__ */ p(e, { value: w })
57
57
  }),
58
58
  /* @__PURE__ */ p("div", {
59
59
  className: "mt-1 font-medium tracking-wide text-zinc-400 uppercase dark:text-zinc-500",
@@ -66,7 +66,7 @@ var h = {
66
66
  children: "Mode"
67
67
  }), /* @__PURE__ */ p("span", {
68
68
  className: "text-zinc-700 dark:text-zinc-200",
69
- children: e[y.mode]
69
+ children: t[y.mode]
70
70
  })]
71
71
  }),
72
72
  /* @__PURE__ */ m("div", {
@@ -76,7 +76,7 @@ var h = {
76
76
  children: "Started"
77
77
  }), /* @__PURE__ */ p("span", {
78
78
  className: "text-zinc-700 tabular-nums dark:text-zinc-200",
79
- children: r(y.startedAt)
79
+ children: i(y.startedAt)
80
80
  })]
81
81
  }),
82
82
  /* @__PURE__ */ m("div", {
@@ -86,7 +86,7 @@ var h = {
86
86
  children: "Took"
87
87
  }), /* @__PURE__ */ p("span", {
88
88
  className: "text-zinc-700 tabular-nums dark:text-zinc-200",
89
- children: C === void 0 ? "still running" : n(C)
89
+ children: C === void 0 ? "still running" : r(C)
90
90
  })]
91
91
  }),
92
92
  y.elementId !== void 0 && /* @__PURE__ */ m("div", {
@@ -114,14 +114,14 @@ var h = {
114
114
  children: "Input"
115
115
  }), /* @__PURE__ */ p("div", {
116
116
  className: "overflow-auto rounded border border-zinc-200 dark:border-zinc-700",
117
- children: /* @__PURE__ */ p(l, { value: y.input })
117
+ children: /* @__PURE__ */ p(e, { value: y.input })
118
118
  })] }),
119
119
  y.output !== void 0 && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("div", {
120
120
  className: "mt-1 font-medium tracking-wide text-zinc-400 uppercase dark:text-zinc-500",
121
121
  children: "Output"
122
122
  }), /* @__PURE__ */ p("div", {
123
123
  className: "overflow-auto rounded border border-zinc-200 dark:border-zinc-700",
124
- children: /* @__PURE__ */ p(l, { value: y.output })
124
+ children: /* @__PURE__ */ p(e, { value: y.output })
125
125
  })] }),
126
126
  y.progress.length > 0 && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ m("div", {
127
127
  className: "mt-1 font-medium tracking-wide text-zinc-400 uppercase dark:text-zinc-500",
@@ -132,7 +132,7 @@ var h = {
132
132
  ]
133
133
  }), /* @__PURE__ */ p("div", {
134
134
  className: "overflow-auto rounded border border-zinc-200 dark:border-zinc-700",
135
- children: /* @__PURE__ */ p(l, { value: y.progress })
135
+ children: /* @__PURE__ */ p(e, { value: y.progress })
136
136
  })] })
137
137
  ] });
138
138
  };
@@ -5,7 +5,6 @@ export type RunFilter = 'all' | 'live' | 'failed';
5
5
  export type StatusTone = 'danger' | 'warning' | 'success' | 'info' | 'custom';
6
6
  /** Still happening: no end time, and the step that started it still holds the handle. */
7
7
  export declare const isLive: (run: ActionRunEntry) => boolean;
8
- export declare const hasFailed: (run: ActionRunEntry) => boolean;
9
8
  export declare const runDuration: (run: ActionRunEntry) => number | undefined;
10
9
  export declare const formatMs: (ms: number) => string;
11
10
  export declare const formatTime: (value: number) => string;
@@ -62,4 +62,4 @@ var e = (e) => e.endedAt === void 0, t = (e) => e.status === "failed" || e.statu
62
62
  return typeof n == "string" ? n : void 0;
63
63
  }, y = (e, t) => e?.find((e) => v(e) === t)?.result;
64
64
  //#endregion
65
- export { f as MODE_ICON, d as MODE_LABEL, u as STEP_BAR, l as STEP_ICON, m as failedStep, g as filterRuns, r as formatMs, i as formatTime, t as hasFailed, e as isLive, h as matchesQuery, n as runDuration, o as statusTone, _ as stepBars, p as stepCount, c as stepTone, y as traceResultOf };
65
+ export { f as MODE_ICON, d as MODE_LABEL, u as STEP_BAR, l as STEP_ICON, m as failedStep, g as filterRuns, r as formatMs, i as formatTime, e as isLive, h as matchesQuery, n as runDuration, o as statusTone, _ as stepBars, p as stepCount, c as stepTone, y as traceResultOf };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Everything this page is keeping, and for how much longer.
3
+ *
4
+ * Its own tab rather than a strip above the state tree, because the two answer different questions. The tree is the
5
+ * shape of one store; this is "what is cached right now" across every store of the instance — and the store holding a
6
+ * TTL is rarely the one being looked at, since a provider's answers live in the query cache and not in its own scope.
7
+ *
8
+ * Everything a row says is on screen: no tooltips, a bar for what is left of the life it was given, and the value it
9
+ * holds one click away, so checking a cache never means going somewhere else to look at it.
10
+ */
11
+ declare const CacheViewer: () => import("react").JSX.Element;
12
+ export default CacheViewer;
@@ -0,0 +1,91 @@
1
+ import e from "./components/CacheRow/index.mjs";
2
+ import t, { forgetQueryPath as n } from "../../../../freshness/describeQueryPath.mjs";
3
+ import r from "../../../../freshness/useFreshnessByStore.mjs";
4
+ import i from "../../../../freshness/useSecondsClock.mjs";
5
+ import { toRows as a } from "../../../../freshness/rows.mjs";
6
+ import { rootKeysOf as o, storeLabel as s } from "../../../../scope/helpers.mjs";
7
+ import { useInstanceStores as c } from "../../../../scope/useScope.mjs";
8
+ import l from "clsx";
9
+ import { useCallback as u, useMemo as d, useState as f } from "react";
10
+ import { jsx as p, jsxs as m } from "react/jsx-runtime";
11
+ //#region src/components/DevToolsPanel/tabs/CacheViewer/CacheViewer.tsx
12
+ var h = () => {
13
+ let h = c(), g = r(h), _ = d(() => g.reduce((e, t) => e + Object.keys(t.records).length, 0), [g]), v = i(_ > 0), y = d(() => o(h), [h]), b = u((e) => s(e.entry, y), [y]), x = d(() => a(g, b, v, t), [
14
+ g,
15
+ b,
16
+ v
17
+ ]), [S, C] = f(""), [w, T] = f(!1), [E, D] = f(void 0), O = d(() => {
18
+ let e = S.trim().toLowerCase();
19
+ return x.filter((t) => w && !t.isStale ? !1 : !e || t.label.toLowerCase().includes(e) || t.storeLabel.toLowerCase().includes(e) || t.tags.some((t) => t.toLowerCase().includes(e)));
20
+ }, [
21
+ x,
22
+ S,
23
+ w
24
+ ]), k = d(() => {
25
+ let e = O.find((e) => e.key === E);
26
+ if (e) return g.find((t) => t.entry.uid === e.uid)?.entry.store.getPath(e.path);
27
+ }, [
28
+ O,
29
+ E,
30
+ g
31
+ ]), A = u((e) => D((t) => t === e ? void 0 : e), []), j = u(() => T((e) => !e), []), M = u((e, t) => {
32
+ g.find((t) => t.entry.uid === e)?.entry.store.expire(t);
33
+ }, [g]), N = u((e, t) => {
34
+ let r = g.find((t) => t.entry.uid === e)?.entry;
35
+ r && !n(r.store, t) && r.store.setState(t, void 0, { unmount: !0 });
36
+ }, [g]), P = u(() => g.forEach((e) => e.entry.store.expire()), [g]);
37
+ return /* @__PURE__ */ m("div", {
38
+ className: "flex h-full w-full flex-col text-[11px]",
39
+ children: [/* @__PURE__ */ m("div", {
40
+ className: "flex shrink-0 items-center gap-2 border-b border-zinc-200 px-2 py-1 dark:border-zinc-800",
41
+ children: [
42
+ /* @__PURE__ */ p("span", {
43
+ className: "font-medium text-zinc-600 dark:text-zinc-300",
44
+ children: "Cached"
45
+ }),
46
+ /* @__PURE__ */ p("span", {
47
+ className: "text-zinc-500 tabular-nums dark:text-zinc-400",
48
+ children: _
49
+ }),
50
+ /* @__PURE__ */ p("input", {
51
+ className: "min-w-0 grow rounded border border-zinc-200 bg-white px-1.5 py-0.5 text-zinc-700 outline-none placeholder:text-zinc-400 focus:border-violet-400 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-100 dark:placeholder:text-zinc-500",
52
+ value: S,
53
+ placeholder: "Filter by URL, store or tag",
54
+ onChange: (e) => C(e.target.value)
55
+ }),
56
+ /* @__PURE__ */ p("button", {
57
+ className: l("shrink-0 cursor-pointer rounded px-1.5 py-0.5 font-medium transition-colors", w ? "bg-amber-500/15 text-amber-600 dark:text-amber-400" : "text-zinc-500 hover:bg-zinc-100 dark:text-zinc-400 dark:hover:bg-zinc-800"),
58
+ onClick: j,
59
+ children: "Stale only"
60
+ }),
61
+ /* @__PURE__ */ p("button", {
62
+ className: "shrink-0 cursor-pointer rounded px-1.5 py-0.5 text-violet-600 hover:bg-violet-500/15 dark:text-violet-400",
63
+ onClick: P,
64
+ children: "Expire all"
65
+ })
66
+ ]
67
+ }), O.length === 0 ? /* @__PURE__ */ m("div", {
68
+ className: "flex grow flex-col items-center justify-center gap-2 px-6 text-center text-zinc-500 dark:text-zinc-400",
69
+ children: [
70
+ /* @__PURE__ */ p("i", { className: "fa-solid fa-database text-3xl opacity-20" }),
71
+ /* @__PURE__ */ p("span", { children: _ === 0 ? "Nothing on this page is cached" : "Nothing matches the filter" }),
72
+ _ === 0 && /* @__PURE__ */ p("span", {
73
+ className: "max-w-80 text-[10px]",
74
+ children: "A path appears here once something writes it with a time to live — a provider does that when its author turns its cache on."
75
+ })
76
+ ]
77
+ }) : /* @__PURE__ */ p("ul", {
78
+ className: "grow overflow-auto",
79
+ children: O.map((t) => /* @__PURE__ */ p(e, {
80
+ row: t,
81
+ isOpen: t.key === E,
82
+ value: t.key === E ? k : void 0,
83
+ onToggle: A,
84
+ onExpire: M,
85
+ onForget: N
86
+ }, t.key))
87
+ })]
88
+ });
89
+ };
90
+ //#endregion
91
+ export { h as default };
@@ -0,0 +1,16 @@
1
+ import { FreshnessRowModel } from '../../../../../../freshness';
2
+ export type CacheRowProps = {
3
+ row: FreshnessRowModel;
4
+ /** Open rows show what the path holds, so a reader never has to go and find it in the state tree. */
5
+ isOpen: boolean;
6
+ value: unknown;
7
+ onToggle: (key: string) => void;
8
+ onExpire: (uid: string, path: string) => void;
9
+ onForget: (uid: string, path: string) => void;
10
+ };
11
+ /**
12
+ * One cached path, said in full and on screen: which store it is in, what it stands for, how long it has left and how
13
+ * much of its life that is. Nothing here is a tooltip — the whole point of the tab is that a glance answers it.
14
+ */
15
+ declare const CacheRow: ({ row, isOpen, value, onToggle, onExpire, onForget }: CacheRowProps) => import("react").JSX.Element;
16
+ export default CacheRow;
@@ -0,0 +1,87 @@
1
+ import e from "../../../../../PayloadView/index.mjs";
2
+ import t from "clsx";
3
+ import { useCallback as n } from "react";
4
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
+ //#region src/components/DevToolsPanel/tabs/CacheViewer/components/CacheRow/CacheRow.tsx
6
+ var a = ({ row: a, isOpen: o, value: s, onToggle: c, onExpire: l, onForget: u }) => {
7
+ let d = n(() => c(a.key), [c, a.key]), f = n(() => l(a.uid, a.path), [
8
+ l,
9
+ a.uid,
10
+ a.path
11
+ ]), p = n(() => u(a.uid, a.path), [
12
+ u,
13
+ a.uid,
14
+ a.path
15
+ ]);
16
+ return /* @__PURE__ */ i("li", {
17
+ className: "border-b border-zinc-100 last:border-0 dark:border-zinc-800",
18
+ children: [
19
+ /* @__PURE__ */ i("div", {
20
+ className: "flex items-center gap-2 px-2 py-1.5",
21
+ children: [
22
+ /* @__PURE__ */ i("button", {
23
+ className: "flex min-w-0 grow cursor-pointer items-center gap-2 text-left",
24
+ onClick: d,
25
+ "aria-expanded": o,
26
+ children: [
27
+ /* @__PURE__ */ r("i", { className: t("fa-solid w-2 shrink-0 text-[9px] text-zinc-400 dark:text-zinc-500", o ? "fa-chevron-down" : "fa-chevron-right") }),
28
+ /* @__PURE__ */ r("span", {
29
+ className: "shrink-0 rounded-sm bg-zinc-100 px-1 text-[9px] text-zinc-500 uppercase dark:bg-zinc-800 dark:text-zinc-400",
30
+ children: a.storeLabel
31
+ }),
32
+ /* @__PURE__ */ r("span", {
33
+ className: "min-w-0 grow truncate font-mono text-[11px] text-zinc-700 dark:text-zinc-100",
34
+ children: a.label
35
+ }),
36
+ a.tags.map((e) => /* @__PURE__ */ r("span", {
37
+ className: "shrink-0 rounded bg-violet-500/15 px-1.5 text-[10px] text-violet-600 dark:text-violet-400",
38
+ children: e
39
+ }, e))
40
+ ]
41
+ }),
42
+ /* @__PURE__ */ r("span", {
43
+ className: t("w-24 shrink-0 rounded px-1.5 py-0.5 text-center text-[11px] font-medium tabular-nums", a.isStale ? "bg-amber-500/15 text-amber-600 dark:text-amber-400" : "bg-emerald-500/15 text-emerald-600 dark:text-emerald-400"),
44
+ children: a.status
45
+ }),
46
+ a.inUse === !1 ? /* @__PURE__ */ r("button", {
47
+ className: "w-14 shrink-0 cursor-pointer rounded px-1.5 text-[11px] text-violet-600 hover:bg-violet-500/15 dark:text-violet-400",
48
+ onClick: p,
49
+ children: "Forget"
50
+ }) : /* @__PURE__ */ r("button", {
51
+ className: "w-14 shrink-0 cursor-pointer rounded px-1.5 text-[11px] text-violet-600 hover:bg-violet-500/15 dark:text-violet-400",
52
+ onClick: f,
53
+ children: "Expire"
54
+ })
55
+ ]
56
+ }),
57
+ /* @__PURE__ */ i("div", {
58
+ className: "flex items-center gap-2 px-2 pb-1.5 pl-6",
59
+ children: [/* @__PURE__ */ r("span", {
60
+ className: "h-1 min-w-0 grow overflow-hidden rounded-full bg-zinc-200 dark:bg-zinc-800",
61
+ children: /* @__PURE__ */ r("span", {
62
+ className: t("block h-full rounded-full", a.isStale ? "bg-amber-500/60" : "bg-emerald-500/80"),
63
+ style: { width: `${Math.round(a.progress * 100)}%` }
64
+ })
65
+ }), /* @__PURE__ */ i("span", {
66
+ className: "shrink-0 text-[10px] text-zinc-500 tabular-nums dark:text-zinc-400",
67
+ children: [
68
+ "written ",
69
+ a.age,
70
+ " · ttl ",
71
+ a.ttl,
72
+ a.inUse === !1 && ` · nothing renders it${a.kept ? ` · ${a.kept}` : ""}`
73
+ ]
74
+ })]
75
+ }),
76
+ o && /* @__PURE__ */ i("div", {
77
+ className: "max-h-56 overflow-auto border-t border-zinc-100 bg-zinc-50 px-2 py-1 dark:border-zinc-800 dark:bg-zinc-800/40",
78
+ children: [/* @__PURE__ */ r("div", {
79
+ className: "pb-1 font-mono text-[10px] text-zinc-500 dark:text-zinc-400",
80
+ children: a.path
81
+ }), /* @__PURE__ */ r(e, { value: s })]
82
+ })
83
+ ]
84
+ });
85
+ };
86
+ //#endregion
87
+ export { a as default };
@@ -0,0 +1,3 @@
1
+ import { default as CacheRow } from './CacheRow';
2
+ export * from './CacheRow';
3
+ export default CacheRow;
@@ -0,0 +1,5 @@
1
+ import e from "./CacheRow.mjs";
2
+ //#region src/components/DevToolsPanel/tabs/CacheViewer/components/CacheRow/index.ts
3
+ var t = e;
4
+ //#endregion
5
+ export { t as default };
@@ -0,0 +1,2 @@
1
+ import { default as CacheViewer } from './CacheViewer';
2
+ export default CacheViewer;
@@ -0,0 +1,5 @@
1
+ import e from "./CacheViewer.mjs";
2
+ //#region src/components/DevToolsPanel/tabs/CacheViewer/index.ts
3
+ var t = e;
4
+ //#endregion
5
+ export { t as default };