@react-perfscope/ui 0.2.0 → 0.3.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/README.md +4 -6
- package/dist/index.cjs +46 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +46 -20
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -99,6 +99,8 @@ var en = {
|
|
|
99
99
|
blocking: "blocking",
|
|
100
100
|
sourceCount: (n) => `${n} source(s)`,
|
|
101
101
|
moreItems: (n) => `+ ${n} more`,
|
|
102
|
+
coalescedReads: (n) => `${n} reads`,
|
|
103
|
+
cascadeComponents: (n) => `${n} components`,
|
|
102
104
|
startRecording: "Start recording",
|
|
103
105
|
stopRecording: "Stop recording",
|
|
104
106
|
rec: "rec",
|
|
@@ -187,6 +189,8 @@ var ko = {
|
|
|
187
189
|
blocking: "\uCC28\uB2E8",
|
|
188
190
|
sourceCount: (n) => `\uC18C\uC2A4 ${n}\uAC1C`,
|
|
189
191
|
moreItems: (n) => `\uC678 ${n}\uAC1C \uB354`,
|
|
192
|
+
coalescedReads: (n) => `\uC77D\uAE30 ${n}\uD68C`,
|
|
193
|
+
cascadeComponents: (n) => `\uCEF4\uD3EC\uB10C\uD2B8 ${n}\uAC1C`,
|
|
190
194
|
startRecording: "\uB179\uD654 \uC2DC\uC791",
|
|
191
195
|
stopRecording: "\uB179\uD654 \uC885\uB8CC",
|
|
192
196
|
rec: "\uB179\uD654",
|
|
@@ -795,8 +799,10 @@ function renderBreakdown(members) {
|
|
|
795
799
|
const counts = /* @__PURE__ */ new Map();
|
|
796
800
|
for (const s of members) {
|
|
797
801
|
if (s.kind !== "render") continue;
|
|
798
|
-
|
|
799
|
-
|
|
802
|
+
for (const m of s.members ?? [s]) {
|
|
803
|
+
if (!counts.has(m.component)) order.push(m.component);
|
|
804
|
+
counts.set(m.component, (counts.get(m.component) ?? 0) + 1);
|
|
805
|
+
}
|
|
800
806
|
}
|
|
801
807
|
return order.map((c) => ({ component: c, count: counts.get(c) }));
|
|
802
808
|
}
|
|
@@ -1698,6 +1704,7 @@ function TooltipContent({ s, startedAt }) {
|
|
|
1698
1704
|
s.duration.toFixed(2),
|
|
1699
1705
|
"ms"
|
|
1700
1706
|
] }),
|
|
1707
|
+
(s.count ?? 1) > 1 ? ` \xD7${s.count}` : "",
|
|
1701
1708
|
" ",
|
|
1702
1709
|
at
|
|
1703
1710
|
] });
|
|
@@ -1975,7 +1982,7 @@ function summary(s) {
|
|
|
1975
1982
|
case "web-vital":
|
|
1976
1983
|
return `${s.name}: ${s.value.toFixed(2)}`;
|
|
1977
1984
|
case "render":
|
|
1978
|
-
return `${s.component} \u2022 ${s.reason} \u2022 ${s.duration.toFixed(2)}ms`;
|
|
1985
|
+
return `${s.component} \u2022 ${s.reason} \u2022 ${s.duration.toFixed(2)}ms${s.count && s.count > 1 ? ` \u2022 ${s.count} components` : ""}`;
|
|
1979
1986
|
}
|
|
1980
1987
|
}
|
|
1981
1988
|
var detailLabelStyle = { color: "#888", marginRight: "6px" };
|
|
@@ -2060,6 +2067,25 @@ function WebVitalDetail({ s }) {
|
|
|
2060
2067
|
}
|
|
2061
2068
|
function RenderDetail({ s }) {
|
|
2062
2069
|
const { t } = useI18n();
|
|
2070
|
+
if (s.members && s.members.length > 0) {
|
|
2071
|
+
return /* @__PURE__ */ jsxs5("div", { style: { paddingLeft: "12px" }, children: [
|
|
2072
|
+
/* @__PURE__ */ jsxs5("div", { style: detailRowStyle, children: [
|
|
2073
|
+
/* @__PURE__ */ jsx5("span", { style: detailLabelStyle, children: t.duration }),
|
|
2074
|
+
/* @__PURE__ */ jsxs5("span", { children: [
|
|
2075
|
+
s.duration.toFixed(3),
|
|
2076
|
+
"ms"
|
|
2077
|
+
] })
|
|
2078
|
+
] }),
|
|
2079
|
+
/* @__PURE__ */ jsxs5("div", { style: detailRowStyle, children: [
|
|
2080
|
+
/* @__PURE__ */ jsx5("span", { style: detailLabelStyle, children: t.at }),
|
|
2081
|
+
/* @__PURE__ */ jsxs5("span", { children: [
|
|
2082
|
+
s.at.toFixed(2),
|
|
2083
|
+
"ms"
|
|
2084
|
+
] })
|
|
2085
|
+
] }),
|
|
2086
|
+
/* @__PURE__ */ jsx5("div", { style: { marginTop: "6px" }, children: /* @__PURE__ */ jsx5(CascadeMembers, { members: s.members }) })
|
|
2087
|
+
] });
|
|
2088
|
+
}
|
|
2063
2089
|
return /* @__PURE__ */ jsxs5("div", { style: { paddingLeft: "12px" }, children: [
|
|
2064
2090
|
/* @__PURE__ */ jsxs5("div", { style: detailRowStyle, children: [
|
|
2065
2091
|
/* @__PURE__ */ jsx5("span", { style: detailLabelStyle, children: t.component }),
|
|
@@ -2350,6 +2376,7 @@ function SummaryLine({ signal }) {
|
|
|
2350
2376
|
] });
|
|
2351
2377
|
}
|
|
2352
2378
|
if (signal.kind === "forced-reflow") {
|
|
2379
|
+
const count = signal.count ?? 1;
|
|
2353
2380
|
return /* @__PURE__ */ jsxs5("span", { children: [
|
|
2354
2381
|
"@ ",
|
|
2355
2382
|
signal.at.toFixed(1),
|
|
@@ -2358,6 +2385,10 @@ function SummaryLine({ signal }) {
|
|
|
2358
2385
|
/* @__PURE__ */ jsxs5("span", { style: { color }, children: [
|
|
2359
2386
|
signal.duration.toFixed(2),
|
|
2360
2387
|
"ms"
|
|
2388
|
+
] }),
|
|
2389
|
+
count > 1 && /* @__PURE__ */ jsxs5("span", { style: { color: "#888" }, children: [
|
|
2390
|
+
" \u2022 ",
|
|
2391
|
+
t.coalescedReads(count)
|
|
2361
2392
|
] })
|
|
2362
2393
|
] });
|
|
2363
2394
|
}
|
|
@@ -2379,7 +2410,8 @@ function SummaryLine({ signal }) {
|
|
|
2379
2410
|
/* @__PURE__ */ jsxs5("span", { style: { color }, children: [
|
|
2380
2411
|
signal.duration.toFixed(2),
|
|
2381
2412
|
"ms"
|
|
2382
|
-
] })
|
|
2413
|
+
] }),
|
|
2414
|
+
signal.count && signal.count > 1 && /* @__PURE__ */ jsx5("span", { style: { color: "#888" }, children: t.cascadeComponents(signal.count) })
|
|
2383
2415
|
] });
|
|
2384
2416
|
}
|
|
2385
2417
|
if (signal.kind === "network") {
|
|
@@ -2399,9 +2431,6 @@ function SummaryLine({ signal }) {
|
|
|
2399
2431
|
}
|
|
2400
2432
|
return /* @__PURE__ */ jsx5("span", { children: summary(signal) });
|
|
2401
2433
|
}
|
|
2402
|
-
function cascadeRootOf(list) {
|
|
2403
|
-
return list.find((s) => s.reason === "state") ?? list.find((s) => s.reason === "mount") ?? [...list].sort((a, b) => a.depth - b.depth)[0];
|
|
2404
|
-
}
|
|
2405
2434
|
function tabSupportsGrouping(kind) {
|
|
2406
2435
|
return kind === "render" || kind === "forced-reflow";
|
|
2407
2436
|
}
|
|
@@ -2445,22 +2474,17 @@ function groupSignals(signals, mode, kind) {
|
|
|
2445
2474
|
const byName = /* @__PURE__ */ new Map();
|
|
2446
2475
|
for (const s of signals) {
|
|
2447
2476
|
if (s.kind !== "render") continue;
|
|
2448
|
-
const
|
|
2449
|
-
|
|
2450
|
-
|
|
2477
|
+
for (const m of s.members ?? [s]) {
|
|
2478
|
+
if (!byName.has(m.component)) byName.set(m.component, []);
|
|
2479
|
+
byName.get(m.component).push(m);
|
|
2480
|
+
}
|
|
2451
2481
|
}
|
|
2452
2482
|
return Array.from(byName.entries()).sort((a, b) => b[1].length - a[1].length).map(([label, list]) => ({ label, count: list.length, signals: list }));
|
|
2453
2483
|
}
|
|
2454
2484
|
if (mode === "commit" && kind === "render") {
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
if (!byCommit.has(s.commitId)) byCommit.set(s.commitId, []);
|
|
2459
|
-
byCommit.get(s.commitId).push(s);
|
|
2460
|
-
}
|
|
2461
|
-
return Array.from(byCommit.entries()).sort((a, b) => a[0] - b[0]).map(([id, list]) => {
|
|
2462
|
-
const root = cascadeRootOf(list);
|
|
2463
|
-
return { label: root?.component ?? `commit ${id}`, count: list.length, signals: list };
|
|
2485
|
+
return signals.filter((s) => s.kind === "render").sort((a, b) => a.commitId - b.commitId).map((s) => {
|
|
2486
|
+
const list = s.members ?? [s];
|
|
2487
|
+
return { label: s.component, count: list.length, signals: list };
|
|
2464
2488
|
});
|
|
2465
2489
|
}
|
|
2466
2490
|
if (mode === "source" && kind === "forced-reflow") {
|
|
@@ -2822,7 +2846,9 @@ function Panel(props) {
|
|
|
2822
2846
|
activeKind === "render" && activeTab !== "timeline" && /* @__PURE__ */ jsx5(
|
|
2823
2847
|
RenderInsights,
|
|
2824
2848
|
{
|
|
2825
|
-
signals: grouped.render.
|
|
2849
|
+
signals: grouped.render.flatMap(
|
|
2850
|
+
(s) => s.kind === "render" ? s.members ?? [s] : []
|
|
2851
|
+
),
|
|
2826
2852
|
onSelect: () => {
|
|
2827
2853
|
setGroupMode({ ...groupMode, render: "component" });
|
|
2828
2854
|
setExpandedKey(null);
|