@plitzi/sdk-dev-tools 0.33.1 → 0.34.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 +27 -0
- package/dist/DevToolsContainer.mjs +50 -45
- package/dist/DevToolsContextProvider.mjs +1 -1
- package/dist/components/DevToolsIndicator/DevToolsIndicator.mjs +1 -1
- package/dist/components/DevToolsPanel/DevToolsBody.mjs +32 -30
- package/dist/components/DevToolsPanel/DevToolsHeader.mjs +40 -34
- package/dist/components/DevToolsPanel/DevToolsPanel.mjs +13 -13
- package/dist/components/DevToolsPanel/ThemeControl.d.ts +2 -0
- package/dist/components/DevToolsPanel/ThemeControl.mjs +27 -0
- package/dist/components/DevToolsPanel/tabs/ActionsViewer/ActionsViewer.d.ts +3 -0
- package/dist/components/DevToolsPanel/tabs/ActionsViewer/ActionsViewer.mjs +147 -0
- package/dist/components/DevToolsPanel/tabs/ActionsViewer/index.d.ts +3 -0
- package/dist/components/DevToolsPanel/tabs/ActionsViewer/index.mjs +5 -0
- package/dist/components/DevToolsPanel/tabs/ElementsViewer/ElementsList.mjs +23 -16
- package/dist/components/DevToolsPanel/tabs/HistoryViewer/HistoryViewer.mjs +9 -9
- package/dist/components/DevToolsPanel/tabs/Logs/Log.mjs +30 -24
- package/dist/components/DevToolsPanel/tabs/Logs/categories/LogAction/LogAction.d.ts +11 -0
- package/dist/components/DevToolsPanel/tabs/Logs/categories/LogAction/LogAction.mjs +42 -0
- package/dist/components/DevToolsPanel/tabs/Logs/categories/LogAction/index.d.ts +3 -0
- package/dist/components/DevToolsPanel/tabs/Logs/categories/LogAction/index.mjs +5 -0
- package/dist/components/DevToolsPanel/tabs/Logs/categories/LogInteraction/BodyContent.d.ts +3 -3
- package/dist/components/DevToolsPanel/tabs/Logs/categories/LogInteraction/BodyHeader.d.ts +2 -2
- package/dist/components/DevToolsPanel/tabs/Logs/categories/LogInteraction/BodyHeader.mjs +1 -1
- package/dist/components/DevToolsPanel/tabs/Logs/categories/LogInteraction/ExecutionTree/ExecutionTree.d.ts +2 -2
- package/dist/components/DevToolsPanel/tabs/Logs/categories/LogInteraction/LogInteraction.d.ts +7 -2
- package/dist/components/DevToolsPanel/tabs/Logs/categories/LogInteraction/LogInteraction.mjs +41 -24
- package/dist/components/DevToolsPanel/tabs/Logs/categories/LogInteraction/LogInteractionBody.d.ts +5 -5
- package/dist/components/DevToolsPanel/tabs/Logs/categories/LogInteraction/LogInteractionBody.mjs +2 -2
- package/dist/components/DevToolsPanel/tabs/Logs/categories/LogInteraction/LogInteractionNote.d.ts +17 -0
- package/dist/components/DevToolsPanel/tabs/Logs/categories/LogInteraction/LogInteractionNote.mjs +72 -0
- package/dist/components/DevToolsPanel/tabs/PluginsViewer/PluginDetails.d.ts +10 -3
- package/dist/components/DevToolsPanel/tabs/PluginsViewer/PluginDetails.mjs +27 -8
- package/dist/components/DevToolsPanel/tabs/PluginsViewer/PluginsViewer.d.ts +1 -0
- package/dist/components/DevToolsPanel/tabs/PluginsViewer/PluginsViewer.mjs +37 -22
- package/dist/components/DevToolsPanel/tabs/StoreViewer/StoreViewer.mjs +27 -26
- package/dist/components/DevToolsPanel/tabs/TracingViewer/TracingViewer.mjs +34 -34
- package/dist/components/DevToolsPanel/tabs/TracingViewer/components/Flamegraph/FlameFrame.mjs +3 -2
- package/dist/components/DevToolsPanel/tabs/TracingViewer/components/Flamegraph/Flamegraph.mjs +48 -35
- package/dist/components/DevToolsPanel/tabs/TracingViewer/components/HotspotsList/HotspotsList.mjs +32 -32
- package/dist/components/DevToolsPanel/tabs/TracingViewer/components/RankedList/RankedList.mjs +40 -40
- package/dist/components/DevToolsPanel/tabs/TracingViewer/components/SidebarShell/SidebarShell.mjs +7 -7
- package/dist/components/DevToolsPanel/tabs/TracingViewer/helpers.d.ts +26 -1
- package/dist/components/DevToolsPanel/tabs/TracingViewer/helpers.mjs +106 -84
- package/dist/components/List/List.mjs +1 -1
- package/dist/useHydrated.d.ts +2 -0
- package/dist/useHydrated.mjs +5 -0
- package/dist/useRegisterRootStore.d.ts +11 -0
- package/dist/useRegisterRootStore.mjs +13 -0
- package/package.json +57 -11
package/dist/components/DevToolsPanel/tabs/TracingViewer/components/HotspotsList/HotspotsList.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { buildHotspots as e, durationColor as t, formatMs as n } from "../../helpers.mjs";
|
|
2
2
|
import r from "../DurationLegend/DurationLegend.mjs";
|
|
3
3
|
import i from "../HotspotSidebar/HotspotSidebar.mjs";
|
|
4
|
-
import a from "
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import f from "
|
|
4
|
+
import a from "@plitzi/plitzi-ui/hooks/useStorage";
|
|
5
|
+
import o from "clsx";
|
|
6
|
+
import { useCallback as s, useEffect as c, useMemo as l, useRef as u } from "react";
|
|
7
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
8
8
|
//#region src/components/DevToolsPanel/tabs/TracingViewer/components/HotspotsList/HotspotsList.tsx
|
|
9
9
|
var p = [
|
|
10
10
|
{
|
|
@@ -24,14 +24,14 @@ var p = [
|
|
|
24
24
|
label: "Max"
|
|
25
25
|
}
|
|
26
26
|
], m = (e, t) => t === "renders" ? e.renders : t === "avg" ? e.avgSelf : t === "max" ? e.maxSelf : e.totalSelf, h = ({ commits: h, tree: g, flat: _, selectedId: v, onSelectElement: y }) => {
|
|
27
|
-
let [b, x] =
|
|
27
|
+
let [b, x] = a("plitzi-sdk.dev-tools.tracing.sort", "total"), S = u(null), C = l(() => e(h, g, _).sort((e, t) => m(t, b) - m(e, b)), [
|
|
28
28
|
h,
|
|
29
29
|
g,
|
|
30
30
|
_,
|
|
31
31
|
b
|
|
32
|
-
]), w =
|
|
33
|
-
|
|
34
|
-
let O =
|
|
32
|
+
]), w = l(() => C.reduce((e, t) => Math.max(e, m(t, b)), 0) || 1, [C, b]), T = l(() => C.reduce((e, t) => e + t.totalSelf, 0), [C]), E = l(() => C.find((e) => e.id === v), [C, v]), D = l(() => C.findIndex((e) => e.id === v), [C, v]);
|
|
33
|
+
c(() => S.current?.scrollIntoView({ block: "nearest" }), [v]);
|
|
34
|
+
let O = s((e) => () => x(e), [x]), k = s((e) => {
|
|
35
35
|
if (e.key !== "ArrowUp" && e.key !== "ArrowDown" || C.length === 0) return;
|
|
36
36
|
e.preventDefault();
|
|
37
37
|
let t = D === -1 ? 0 : D, n = Math.max(0, Math.min(C.length - 1, t + (e.key === "ArrowUp" ? -1 : 1)));
|
|
@@ -41,29 +41,29 @@ var p = [
|
|
|
41
41
|
D,
|
|
42
42
|
y
|
|
43
43
|
]);
|
|
44
|
-
return /* @__PURE__ */
|
|
44
|
+
return /* @__PURE__ */ f("div", {
|
|
45
45
|
className: "flex min-h-0 flex-1 flex-col overflow-hidden",
|
|
46
46
|
children: [
|
|
47
|
-
/* @__PURE__ */
|
|
47
|
+
/* @__PURE__ */ f("div", {
|
|
48
48
|
className: "flex shrink-0 items-center gap-2 border-b border-zinc-200 px-2 py-1.5 text-[10px] text-zinc-500 dark:border-zinc-800 dark:text-zinc-400",
|
|
49
49
|
children: [
|
|
50
|
-
/* @__PURE__ */
|
|
50
|
+
/* @__PURE__ */ d("span", {
|
|
51
51
|
className: "font-medium text-zinc-700 dark:text-zinc-200",
|
|
52
52
|
children: "Session hotspots"
|
|
53
53
|
}),
|
|
54
|
-
/* @__PURE__ */
|
|
54
|
+
/* @__PURE__ */ f("span", { children: [
|
|
55
55
|
"· ",
|
|
56
56
|
C.length,
|
|
57
57
|
" elements · ",
|
|
58
58
|
h.length,
|
|
59
59
|
" commits"
|
|
60
60
|
] }),
|
|
61
|
-
/* @__PURE__ */
|
|
61
|
+
/* @__PURE__ */ f("div", {
|
|
62
62
|
className: "ml-auto flex items-center gap-1",
|
|
63
|
-
children: [/* @__PURE__ */
|
|
63
|
+
children: [/* @__PURE__ */ d("span", { children: "sort" }), p.map((e) => /* @__PURE__ */ d("button", {
|
|
64
64
|
onClick: O(e.id),
|
|
65
65
|
"aria-pressed": b === e.id,
|
|
66
|
-
className:
|
|
66
|
+
className: o("rounded px-1.5 py-0.5 text-[10px] font-medium", {
|
|
67
67
|
"bg-violet-500 text-white": b === e.id,
|
|
68
68
|
"text-zinc-600 hover:bg-zinc-200 dark:text-zinc-400 dark:hover:bg-zinc-700": b !== e.id
|
|
69
69
|
}),
|
|
@@ -72,66 +72,66 @@ var p = [
|
|
|
72
72
|
})
|
|
73
73
|
]
|
|
74
74
|
}),
|
|
75
|
-
/* @__PURE__ */
|
|
75
|
+
/* @__PURE__ */ f("div", {
|
|
76
76
|
className: "flex min-h-0 flex-1 overflow-hidden",
|
|
77
|
-
children: [/* @__PURE__ */
|
|
77
|
+
children: [/* @__PURE__ */ f("div", {
|
|
78
78
|
role: "listbox",
|
|
79
79
|
"aria-label": "Session hotspots",
|
|
80
80
|
tabIndex: 0,
|
|
81
81
|
onKeyDown: k,
|
|
82
82
|
className: "min-h-0 flex-1 overflow-auto outline-none focus-visible:ring-1 focus-visible:ring-violet-400",
|
|
83
|
-
children: [C.length === 0 && /* @__PURE__ */
|
|
83
|
+
children: [C.length === 0 && /* @__PURE__ */ d("div", {
|
|
84
84
|
className: "px-2 py-3 text-center text-[10px] text-zinc-400 dark:text-zinc-500",
|
|
85
85
|
children: "No renders recorded yet"
|
|
86
86
|
}), C.map((e) => {
|
|
87
|
-
let r = e.id === v, i = m(e, b),
|
|
88
|
-
return /* @__PURE__ */
|
|
87
|
+
let r = e.id === v, i = m(e, b), a = b === "renders" ? e.renders / w : i / w;
|
|
88
|
+
return /* @__PURE__ */ f("button", {
|
|
89
89
|
ref: r ? S : void 0,
|
|
90
90
|
role: "option",
|
|
91
91
|
"aria-selected": r,
|
|
92
92
|
onClick: () => y(r ? void 0 : e.id),
|
|
93
93
|
title: `${e.name} (${e.type})\n${e.renders} renders (${e.mounts} mount)\ntotal ${n(e.totalSelf)} · avg ${n(e.avgSelf)} · max ${n(e.maxSelf)} · last ${n(e.lastSelf)}`,
|
|
94
|
-
className:
|
|
94
|
+
className: o("flex w-full items-center gap-2 px-2 py-0.5 text-left", {
|
|
95
95
|
"bg-violet-500/10": r,
|
|
96
96
|
"hover:bg-zinc-50 dark:hover:bg-zinc-800/50": !r
|
|
97
97
|
}),
|
|
98
98
|
children: [
|
|
99
|
-
/* @__PURE__ */
|
|
99
|
+
/* @__PURE__ */ f("span", {
|
|
100
100
|
className: "flex w-40 shrink-0 flex-col",
|
|
101
|
-
children: [/* @__PURE__ */
|
|
101
|
+
children: [/* @__PURE__ */ d("span", {
|
|
102
102
|
className: "truncate text-zinc-700 dark:text-zinc-200",
|
|
103
103
|
children: e.name
|
|
104
|
-
}), /* @__PURE__ */
|
|
104
|
+
}), /* @__PURE__ */ d("span", {
|
|
105
105
|
className: "truncate text-[9px] text-zinc-400 dark:text-zinc-500",
|
|
106
106
|
children: e.type
|
|
107
107
|
})]
|
|
108
108
|
}),
|
|
109
|
-
/* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ f("span", {
|
|
110
110
|
className: "w-12 shrink-0 text-right text-[10px] text-zinc-400 tabular-nums dark:text-zinc-500",
|
|
111
111
|
title: "Times this element rendered itself",
|
|
112
112
|
children: [e.renders, "×"]
|
|
113
113
|
}),
|
|
114
|
-
/* @__PURE__ */
|
|
114
|
+
/* @__PURE__ */ d("div", {
|
|
115
115
|
className: "h-2 flex-1 overflow-hidden rounded-sm bg-zinc-100 dark:bg-zinc-800",
|
|
116
|
-
children: /* @__PURE__ */
|
|
117
|
-
style: { width: `${Math.max(2, Math.round(
|
|
118
|
-
className:
|
|
116
|
+
children: /* @__PURE__ */ d("div", {
|
|
117
|
+
style: { width: `${Math.max(2, Math.round(a * 100))}%` },
|
|
118
|
+
className: o("h-full rounded-sm", t(e.maxSelf))
|
|
119
119
|
})
|
|
120
120
|
}),
|
|
121
|
-
/* @__PURE__ */
|
|
121
|
+
/* @__PURE__ */ d("span", {
|
|
122
122
|
className: "w-14 shrink-0 text-right text-zinc-500 tabular-nums dark:text-zinc-400",
|
|
123
123
|
children: b === "renders" ? `${e.renders}×` : n(i)
|
|
124
124
|
})
|
|
125
125
|
]
|
|
126
126
|
}, e.id);
|
|
127
127
|
})]
|
|
128
|
-
}), E && /* @__PURE__ */
|
|
128
|
+
}), E && /* @__PURE__ */ d(i, {
|
|
129
129
|
row: E,
|
|
130
130
|
flat: _,
|
|
131
131
|
sessionSelf: T
|
|
132
132
|
})]
|
|
133
133
|
}),
|
|
134
|
-
/* @__PURE__ */
|
|
134
|
+
/* @__PURE__ */ d(r, {})
|
|
135
135
|
]
|
|
136
136
|
});
|
|
137
137
|
};
|
package/dist/components/DevToolsPanel/tabs/TracingViewer/components/RankedList/RankedList.mjs
CHANGED
|
@@ -6,15 +6,15 @@ import c from "../SidebarShell/SidebarShell.mjs";
|
|
|
6
6
|
import l from "../SidebarShell/SidebarEmpty.mjs";
|
|
7
7
|
import u from "../SidebarToggle/SidebarToggle.mjs";
|
|
8
8
|
import d from "../MetricToggle/MetricToggle.mjs";
|
|
9
|
-
import f from "
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import y from "
|
|
9
|
+
import f from "@plitzi/plitzi-ui/hooks/useStorage";
|
|
10
|
+
import p from "clsx";
|
|
11
|
+
import { useCallback as m, useEffect as h, useMemo as g, useRef as _ } from "react";
|
|
12
|
+
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
13
13
|
//#region src/components/DevToolsPanel/tabs/TracingViewer/components/RankedList/RankedList.tsx
|
|
14
14
|
var b = ({ commit: b, model: x, active: S, origin: C, sidebarOpen: w, onSelectElement: T, onToggleSidebar: E }) => {
|
|
15
|
-
let [D, O] =
|
|
16
|
-
|
|
17
|
-
let N =
|
|
15
|
+
let [D, O] = f("plitzi-sdk.dev-tools.tracing.metric", "self"), k = _(null), A = g(() => x.nodes.filter((e) => e.state === "rendered").sort((e, t) => i(t, D) - i(e, D)), [x, D]), j = g(() => A.reduce((e, t) => Math.max(e, i(t, D)), 0) || 1, [A, D]), M = g(() => A.findIndex((e) => e.id === S?.id), [A, S]);
|
|
16
|
+
h(() => k.current?.scrollIntoView({ block: "nearest" }), [S]);
|
|
17
|
+
let N = m((e) => {
|
|
18
18
|
if (e.key !== "ArrowUp" && e.key !== "ArrowDown" || A.length === 0) return;
|
|
19
19
|
e.preventDefault();
|
|
20
20
|
let t = M === -1 ? 0 : M, n = Math.max(0, Math.min(A.length - 1, t + (e.key === "ArrowUp" ? -1 : 1)));
|
|
@@ -24,22 +24,22 @@ var b = ({ commit: b, model: x, active: S, origin: C, sidebarOpen: w, onSelectEl
|
|
|
24
24
|
M,
|
|
25
25
|
T
|
|
26
26
|
]);
|
|
27
|
-
return /* @__PURE__ */
|
|
27
|
+
return /* @__PURE__ */ y("div", {
|
|
28
28
|
className: "flex min-h-0 flex-1 flex-col overflow-hidden",
|
|
29
29
|
children: [
|
|
30
|
-
/* @__PURE__ */
|
|
30
|
+
/* @__PURE__ */ y("div", {
|
|
31
31
|
className: "flex shrink-0 flex-wrap items-center gap-x-2 gap-y-1 border-b border-zinc-200 px-2 py-1.5 text-[10px] text-zinc-500 dark:border-zinc-800 dark:text-zinc-400",
|
|
32
32
|
children: [
|
|
33
|
-
/* @__PURE__ */
|
|
33
|
+
/* @__PURE__ */ y("span", {
|
|
34
34
|
className: "font-medium text-zinc-700 dark:text-zinc-200",
|
|
35
35
|
children: ["Commit #", b.commitId]
|
|
36
36
|
}),
|
|
37
|
-
C !== "update" && /* @__PURE__ */
|
|
37
|
+
C !== "update" && /* @__PURE__ */ v("span", {
|
|
38
38
|
className: "rounded bg-violet-100 px-1 text-[9px] font-medium text-violet-700 uppercase dark:bg-violet-500/20 dark:text-violet-300",
|
|
39
39
|
children: e[C]
|
|
40
40
|
}),
|
|
41
|
-
/* @__PURE__ */
|
|
42
|
-
/* @__PURE__ */
|
|
41
|
+
/* @__PURE__ */ y("span", { children: [n(b.duration), " total"] }),
|
|
42
|
+
/* @__PURE__ */ y("span", {
|
|
43
43
|
title: "Elements that re-rendered, of all in this commit's subtree",
|
|
44
44
|
children: [
|
|
45
45
|
"· ",
|
|
@@ -49,107 +49,107 @@ var b = ({ commit: b, model: x, active: S, origin: C, sidebarOpen: w, onSelectEl
|
|
|
49
49
|
" rendered"
|
|
50
50
|
]
|
|
51
51
|
}),
|
|
52
|
-
/* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ v(a, {
|
|
53
53
|
commit: b,
|
|
54
54
|
model: x,
|
|
55
55
|
active: S,
|
|
56
56
|
onSelectElement: T
|
|
57
57
|
}),
|
|
58
|
-
/* @__PURE__ */
|
|
58
|
+
/* @__PURE__ */ v(d, {
|
|
59
59
|
className: "ml-auto",
|
|
60
60
|
metric: D,
|
|
61
61
|
onChange: O
|
|
62
62
|
}),
|
|
63
|
-
/* @__PURE__ */
|
|
63
|
+
/* @__PURE__ */ v(u, {
|
|
64
64
|
open: w,
|
|
65
65
|
onToggle: E
|
|
66
66
|
})
|
|
67
67
|
]
|
|
68
68
|
}),
|
|
69
|
-
/* @__PURE__ */
|
|
69
|
+
/* @__PURE__ */ y("div", {
|
|
70
70
|
className: "flex min-h-0 flex-1 overflow-hidden",
|
|
71
|
-
children: [/* @__PURE__ */
|
|
71
|
+
children: [/* @__PURE__ */ y("div", {
|
|
72
72
|
role: "listbox",
|
|
73
73
|
"aria-label": "Rendered elements, ranked",
|
|
74
74
|
tabIndex: 0,
|
|
75
75
|
onKeyDown: N,
|
|
76
76
|
className: "min-h-0 flex-1 overflow-auto outline-none focus-visible:ring-1 focus-visible:ring-violet-400",
|
|
77
|
-
children: [A.length === 0 && /* @__PURE__ */
|
|
77
|
+
children: [A.length === 0 && /* @__PURE__ */ v("div", {
|
|
78
78
|
className: "px-2 py-3 text-center text-[10px] text-zinc-400 dark:text-zinc-500",
|
|
79
79
|
children: "No element re-rendered in this commit"
|
|
80
80
|
}), A.map((e) => {
|
|
81
|
-
let a = i(e, D), o = e.id === S?.id, s = x.totalSelf > 0 ? e.selfDuration / x.totalSelf : 0, c = e.phase !== "mount", l = c && (e.changedProps === void 0 || e.changedProps.length === 0 && e.trigger), u = c && e.changedProps?.length === 0 && !e.trigger, d = !!e.changedProps?.length && e.changedProps.every((e) => e.ref),
|
|
82
|
-
return /* @__PURE__ */
|
|
81
|
+
let a = i(e, D), o = e.id === S?.id, s = x.totalSelf > 0 ? e.selfDuration / x.totalSelf : 0, c = e.phase !== "mount", l = c && (e.changedProps === void 0 || e.changedProps.length === 0 && e.trigger), u = c && e.changedProps?.length === 0 && !e.trigger, d = !!e.changedProps?.length && e.changedProps.every((e) => e.ref), f = e.changedProps?.map((e) => e.key).join(", "), m = f || (l ? "internal state / hook" : e.type);
|
|
82
|
+
return /* @__PURE__ */ y("button", {
|
|
83
83
|
ref: o ? k : void 0,
|
|
84
84
|
role: "option",
|
|
85
85
|
"aria-selected": o,
|
|
86
86
|
onClick: () => T(e.id === S?.id ? void 0 : e.id),
|
|
87
|
-
title: `${e.name} (${e.type})\n${n(e.selfDuration)} self · ${n(e.actualDuration)} total · ${n(e.baseDuration)} base\nphase: ${e.phase ?? "update"} · ${r(s)} of render work${u ? "\nno input changed — re-rendered by an ancestor" : l ? "\nno input changed — internal state/hook/context" : d ? `\nreference-only change (missing memo): ${
|
|
88
|
-
className:
|
|
87
|
+
title: `${e.name} (${e.type})\n${n(e.selfDuration)} self · ${n(e.actualDuration)} total · ${n(e.baseDuration)} base\nphase: ${e.phase ?? "update"} · ${r(s)} of render work${u ? "\nno input changed — re-rendered by an ancestor" : l ? "\nno input changed — internal state/hook/context" : d ? `\nreference-only change (missing memo): ${f}` : f ? `\nchanged: ${f}` : ""}`,
|
|
88
|
+
className: p("flex w-full items-center gap-2 px-2 py-0.5 text-left", {
|
|
89
89
|
"bg-violet-500/10": o,
|
|
90
90
|
"hover:bg-zinc-50 dark:hover:bg-zinc-800/50": !o
|
|
91
91
|
}),
|
|
92
92
|
children: [
|
|
93
|
-
/* @__PURE__ */
|
|
93
|
+
/* @__PURE__ */ y("span", {
|
|
94
94
|
className: "flex w-40 shrink-0 flex-col",
|
|
95
|
-
children: [/* @__PURE__ */
|
|
95
|
+
children: [/* @__PURE__ */ y("span", {
|
|
96
96
|
className: "flex items-center gap-1 text-zinc-700 dark:text-zinc-200",
|
|
97
97
|
children: [
|
|
98
|
-
e.trigger && /* @__PURE__ */
|
|
98
|
+
e.trigger && /* @__PURE__ */ v("i", {
|
|
99
99
|
className: "fa-solid fa-bolt shrink-0 text-[9px] text-violet-500",
|
|
100
100
|
title: "Trigger — a root cause of this commit"
|
|
101
101
|
}),
|
|
102
|
-
(u || d) && /* @__PURE__ */
|
|
102
|
+
(u || d) && /* @__PURE__ */ v("i", {
|
|
103
103
|
className: "fa-solid fa-triangle-exclamation shrink-0 text-[9px] text-amber-500",
|
|
104
104
|
title: u ? "Re-rendered without any input change — possible unnecessary re-render" : "Only reference-changed props (shallow-equal content) — likely a missing memo"
|
|
105
105
|
}),
|
|
106
|
-
!e.visible && /* @__PURE__ */
|
|
106
|
+
!e.visible && /* @__PURE__ */ v("i", {
|
|
107
107
|
className: "fa-solid fa-eye-slash shrink-0 text-[9px] text-amber-500",
|
|
108
108
|
title: "Hidden (visibility)"
|
|
109
109
|
}),
|
|
110
|
-
/* @__PURE__ */
|
|
110
|
+
/* @__PURE__ */ v("span", {
|
|
111
111
|
className: "truncate",
|
|
112
112
|
children: e.name
|
|
113
113
|
})
|
|
114
114
|
]
|
|
115
|
-
}), /* @__PURE__ */
|
|
115
|
+
}), /* @__PURE__ */ v("span", {
|
|
116
116
|
className: "truncate text-[9px] text-zinc-400 dark:text-zinc-500",
|
|
117
117
|
children: m
|
|
118
118
|
})]
|
|
119
119
|
}),
|
|
120
|
-
/* @__PURE__ */
|
|
121
|
-
className:
|
|
120
|
+
/* @__PURE__ */ v("span", {
|
|
121
|
+
className: p("rounded px-1 text-[9px] uppercase", {
|
|
122
122
|
"bg-sky-500/15 text-sky-600 dark:text-sky-400": e.phase === "mount",
|
|
123
123
|
"bg-amber-500/15 text-amber-600 dark:text-amber-400": e.phase !== "mount"
|
|
124
124
|
}),
|
|
125
125
|
children: e.phase === "mount" ? "mount" : "update"
|
|
126
126
|
}),
|
|
127
|
-
/* @__PURE__ */
|
|
127
|
+
/* @__PURE__ */ v("div", {
|
|
128
128
|
className: "h-2 flex-1 overflow-hidden rounded-sm bg-zinc-100 dark:bg-zinc-800",
|
|
129
|
-
children: /* @__PURE__ */
|
|
129
|
+
children: /* @__PURE__ */ v("div", {
|
|
130
130
|
style: { width: `${Math.max(2, Math.round(a / j * 100))}%` },
|
|
131
|
-
className:
|
|
131
|
+
className: p("h-full rounded-sm", t(a))
|
|
132
132
|
})
|
|
133
133
|
}),
|
|
134
|
-
/* @__PURE__ */
|
|
134
|
+
/* @__PURE__ */ v("span", {
|
|
135
135
|
className: "w-10 shrink-0 text-right text-[10px] text-zinc-400 tabular-nums dark:text-zinc-500",
|
|
136
136
|
title: "Share of this commit's total render work",
|
|
137
137
|
children: r(s)
|
|
138
138
|
}),
|
|
139
|
-
/* @__PURE__ */
|
|
139
|
+
/* @__PURE__ */ v("span", {
|
|
140
140
|
className: "w-12 shrink-0 text-right text-zinc-500 tabular-nums dark:text-zinc-400",
|
|
141
141
|
children: n(a)
|
|
142
142
|
})
|
|
143
143
|
]
|
|
144
144
|
}, e.id);
|
|
145
145
|
})]
|
|
146
|
-
}), w && /* @__PURE__ */
|
|
146
|
+
}), w && /* @__PURE__ */ v(c, { children: S ? /* @__PURE__ */ v(o, {
|
|
147
147
|
node: S,
|
|
148
148
|
commit: b,
|
|
149
149
|
model: x
|
|
150
|
-
}) : /* @__PURE__ */
|
|
150
|
+
}) : /* @__PURE__ */ v(l, {}) })]
|
|
151
151
|
}),
|
|
152
|
-
/* @__PURE__ */
|
|
152
|
+
/* @__PURE__ */ v(s, {})
|
|
153
153
|
]
|
|
154
154
|
});
|
|
155
155
|
};
|
package/dist/components/DevToolsPanel/tabs/TracingViewer/components/SidebarShell/SidebarShell.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import n from "
|
|
4
|
-
import r from "@plitzi/plitzi-ui/
|
|
1
|
+
import e from "@plitzi/plitzi-ui/hooks/useStorage";
|
|
2
|
+
import { useCallback as t } from "react";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
import r from "@plitzi/plitzi-ui/ContainerResizable";
|
|
5
5
|
//#region src/components/DevToolsPanel/tabs/TracingViewer/components/SidebarShell/SidebarShell.tsx
|
|
6
6
|
var i = 180, a = 480, o = 224, s = ({ children: s }) => {
|
|
7
|
-
let [c, l] =
|
|
7
|
+
let [c, l] = e("plitzi-sdk.dev-tools.tracing.sidebar-width", o), u = t((e) => {
|
|
8
8
|
Number.isFinite(e) && l(e);
|
|
9
9
|
}, [l]);
|
|
10
|
-
return /* @__PURE__ */
|
|
10
|
+
return /* @__PURE__ */ n(r, {
|
|
11
11
|
className: "shrink-0 border-l border-zinc-200 dark:border-zinc-800",
|
|
12
12
|
resizeHandles: ["w"],
|
|
13
13
|
axis: "x",
|
|
@@ -16,7 +16,7 @@ var i = 180, a = 480, o = 224, s = ({ children: s }) => {
|
|
|
16
16
|
minConstraintsX: i,
|
|
17
17
|
maxConstraintsX: a,
|
|
18
18
|
onChange: u,
|
|
19
|
-
children: /* @__PURE__ */
|
|
19
|
+
children: /* @__PURE__ */ n("aside", {
|
|
20
20
|
className: "flex h-full w-full flex-col gap-1.5 overflow-auto bg-zinc-50 px-3 py-2 text-[10px] dark:bg-zinc-900/50",
|
|
21
21
|
children: s
|
|
22
22
|
})
|
|
@@ -4,7 +4,10 @@ export type TracingView = 'ranked' | 'flamegraph' | 'hotspots';
|
|
|
4
4
|
export type DurationMetric = 'self' | 'total';
|
|
5
5
|
type RenderState = 'rendered' | 'bubbled' | 'hatched';
|
|
6
6
|
export type FlameNode = {
|
|
7
|
+
/** This INSTANCE — a list's rows are one node each. See `CommitElementRender.id`. */
|
|
7
8
|
id: string;
|
|
9
|
+
/** Which element the instance is: the label, the schema lookup, and what gets outlined on the page. */
|
|
10
|
+
elementId: string;
|
|
8
11
|
name: string;
|
|
9
12
|
type: string;
|
|
10
13
|
state: RenderState;
|
|
@@ -28,6 +31,7 @@ export type FlameModel = {
|
|
|
28
31
|
triggers: string[];
|
|
29
32
|
};
|
|
30
33
|
export type HotspotRow = {
|
|
34
|
+
/** The ELEMENT, not an instance: a list's hundred rows are one row here, with a hundred renders against it. */
|
|
31
35
|
id: string;
|
|
32
36
|
name: string;
|
|
33
37
|
type: string;
|
|
@@ -81,6 +85,27 @@ export declare const frameColor: (node: FlameNode) => string;
|
|
|
81
85
|
export declare const frameTextColor: (node: FlameNode) => string;
|
|
82
86
|
export declare const elementVisible: (id: string, flat: Record<string, Element> | undefined) => boolean;
|
|
83
87
|
export declare const rowDuration: (node: FlameNode, metric: DurationMetric) => number;
|
|
84
|
-
|
|
88
|
+
/**
|
|
89
|
+
* The accumulated tree, indexed once.
|
|
90
|
+
*
|
|
91
|
+
* Separate from any single commit because none of it depends on one: the parent links, the sizes and the child lists
|
|
92
|
+
* are facts about the tree. Rebuilding them per commit is what made the hotspots view — which walks every commit it
|
|
93
|
+
* has — quadratic in the size of the page.
|
|
94
|
+
*/
|
|
95
|
+
export type TreeIndex = {
|
|
96
|
+
parent: Map<string, string | undefined>;
|
|
97
|
+
base: Map<string, number>;
|
|
98
|
+
children: Map<string, string[]>;
|
|
99
|
+
elementOf: Map<string, string>;
|
|
100
|
+
};
|
|
101
|
+
export declare const buildTreeIndex: (tree: TracingTree) => TreeIndex;
|
|
102
|
+
export declare const buildFlameModel: (commit: CommitEntry, tree: TracingTree, flat: Record<string, Element> | undefined, index?: TreeIndex) => FlameModel;
|
|
103
|
+
/**
|
|
104
|
+
* Aggregates self time across ALL commits — chatty/expensive elements a single commit can't reveal.
|
|
105
|
+
*
|
|
106
|
+
* By ELEMENT and not by instance, which is the whole point of the view: a list's hundred rows are one element that
|
|
107
|
+
* rendered a hundred times, and a hundred rows of one render each would say nothing. The flamegraph is where the
|
|
108
|
+
* instances are told apart.
|
|
109
|
+
*/
|
|
85
110
|
export declare const buildHotspots: (commits: CommitEntry[], tree: TracingTree, flat: Record<string, Element> | undefined) => HotspotRow[];
|
|
86
111
|
export {};
|