react-dev-profiler 1.1.1 → 1.2.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/dist/index.js CHANGED
@@ -29,6 +29,25 @@ function percentile(sorted, p) {
29
29
  return sorted[Math.max(0, idx)];
30
30
  }
31
31
 
32
+ // src/constants.ts
33
+ var COLOR_GREEN = "#4ade80";
34
+ var COLOR_AMBER = "#f59e0b";
35
+ var COLOR_RED = "#ef4444";
36
+ var COLOR_MUTED = "#888";
37
+ var COLOR_DIM = "#444";
38
+ var COLOR_ACCENT = "#6366f1";
39
+ var FPS_60_MS = 16.67;
40
+ var FPS_30_MS = 33;
41
+ var GRAPH_BG = "#111";
42
+ var GRAPH_60FPS_LINE = "#1a3a1a";
43
+ var GRAPH_30FPS_LINE = "#3a1a1a";
44
+ var PANEL_GAP = 8;
45
+ function ftColor(ms) {
46
+ if (ms > FPS_30_MS) return COLOR_RED;
47
+ if (ms > FPS_60_MS) return COLOR_AMBER;
48
+ return COLOR_GREEN;
49
+ }
50
+
32
51
  // src/env.ts
33
52
  var __DEV__ = typeof process !== "undefined" ? process.env.NODE_ENV !== "production" : true;
34
53
 
@@ -75,7 +94,7 @@ var s = {
75
94
  },
76
95
  instanceBadge: {
77
96
  background: "#222",
78
- color: "#888",
97
+ color: COLOR_MUTED,
79
98
  fontSize: 8,
80
99
  padding: "1px 5px",
81
100
  borderRadius: 4,
@@ -90,7 +109,7 @@ var s = {
90
109
  iconBtn: {
91
110
  background: "none",
92
111
  border: "none",
93
- color: "#444",
112
+ color: COLOR_DIM,
94
113
  cursor: "pointer",
95
114
  padding: 4,
96
115
  margin: -4,
@@ -100,12 +119,12 @@ var s = {
100
119
  transition: "color 0.15s"
101
120
  },
102
121
  iconBtnActive: {
103
- color: "#4ade80"
122
+ color: COLOR_GREEN
104
123
  },
105
124
  closeBtn: {
106
125
  background: "none",
107
126
  border: "none",
108
- color: "#444",
127
+ color: COLOR_DIM,
109
128
  cursor: "pointer",
110
129
  fontSize: 13,
111
130
  padding: 4,
@@ -118,7 +137,7 @@ var s = {
118
137
  gap: 5
119
138
  },
120
139
  section: {
121
- color: "#444",
140
+ color: COLOR_DIM,
122
141
  fontSize: 8,
123
142
  fontWeight: 600,
124
143
  letterSpacing: 1,
@@ -147,7 +166,7 @@ var s = {
147
166
  miniRow: {
148
167
  display: "flex",
149
168
  justifyContent: "space-between",
150
- color: "#444",
169
+ color: COLOR_DIM,
151
170
  fontSize: 9,
152
171
  marginTop: -2,
153
172
  marginBottom: 2
@@ -200,9 +219,9 @@ var s = {
200
219
  textAlign: "center"
201
220
  }
202
221
  };
203
- var FLASH_OUTLINE = "2px solid rgba(99, 102, 241, 0.8)";
222
+ var FLASH_OUTLINE = `2px solid ${COLOR_ACCENT}cc`;
204
223
 
205
- // src/hooks.ts
224
+ // src/utils.ts
206
225
  function getEffectiveRect(el) {
207
226
  const rect = el.getBoundingClientRect();
208
227
  if (rect.width > 0 || rect.height > 0) return rect;
@@ -229,6 +248,8 @@ function getObservableChildren(el) {
229
248
  }
230
249
  return result;
231
250
  }
251
+
252
+ // src/hooks.ts
232
253
  function useAnchorPosition(ref, position = "bottom-left") {
233
254
  const [pos, setPos] = useState({ top: 0, left: 0 });
234
255
  useEffect(() => {
@@ -374,22 +395,24 @@ function useLongTasks(enabled) {
374
395
  // src/DevStatsPanel.tsx
375
396
  import { useState as useState2, useEffect as useEffect2, useCallback as useCallback2, useRef as useRef2 } from "react";
376
397
  import { createPortal } from "react-dom";
398
+
399
+ // src/FrameTimeGraph.tsx
377
400
  import { jsx, jsxs } from "react/jsx-runtime";
378
401
  function FrameTimeGraph({ history }) {
379
- const max = Math.max(33, ...history);
402
+ const max = Math.max(FPS_30_MS, ...history);
380
403
  const w = 140;
381
404
  const h = 32;
382
405
  const barW = Math.max(1, w / HISTORY_SIZE - 0.5);
383
406
  return /* @__PURE__ */ jsx("div", { style: s.graphWrap, children: /* @__PURE__ */ jsxs("svg", { width: w, height: h, style: { display: "block" }, children: [
384
- /* @__PURE__ */ jsx("rect", { width: w, height: h, rx: 3, fill: "#111" }),
407
+ /* @__PURE__ */ jsx("rect", { width: w, height: h, rx: 3, fill: GRAPH_BG }),
385
408
  /* @__PURE__ */ jsx(
386
409
  "line",
387
410
  {
388
411
  x1: 0,
389
- y1: h - 16.67 / max * h,
412
+ y1: h - FPS_60_MS / max * h,
390
413
  x2: w,
391
- y2: h - 16.67 / max * h,
392
- stroke: "#1a3a1a",
414
+ y2: h - FPS_60_MS / max * h,
415
+ stroke: GRAPH_60FPS_LINE,
393
416
  strokeWidth: 1
394
417
  }
395
418
  ),
@@ -397,31 +420,36 @@ function FrameTimeGraph({ history }) {
397
420
  "line",
398
421
  {
399
422
  x1: 0,
400
- y1: h - 33 / max * h,
423
+ y1: h - FPS_30_MS / max * h,
401
424
  x2: w,
402
- y2: h - 33 / max * h,
403
- stroke: "#3a1a1a",
425
+ y2: h - FPS_30_MS / max * h,
426
+ stroke: GRAPH_30FPS_LINE,
404
427
  strokeWidth: 1
405
428
  }
406
429
  ),
407
430
  history.map((ms, i) => {
408
431
  const x = i / HISTORY_SIZE * w;
409
432
  const barH = Math.min(ms / max * h, h);
410
- const color = ms > 33 ? "#ef4444" : ms > 16.67 ? "#f59e0b" : "#4ade80";
411
- return /* @__PURE__ */ jsx("rect", { x, y: h - barH, width: barW, height: barH, fill: color, opacity: 0.8, rx: 0.5 }, i);
433
+ return /* @__PURE__ */ jsx("rect", { x, y: h - barH, width: barW, height: barH, fill: ftColor(ms), opacity: 0.8, rx: 0.5 }, i);
412
434
  })
413
435
  ] }) });
414
436
  }
415
- function StatRow({ label, value, sub, color = "#4ade80" }) {
416
- return /* @__PURE__ */ jsxs("div", { style: s.row, children: [
417
- /* @__PURE__ */ jsx("span", { style: s.rowLabel, children: label }),
418
- /* @__PURE__ */ jsxs("span", { children: [
419
- /* @__PURE__ */ jsx("span", { style: { ...s.rowValue, color }, children: value }),
420
- sub && /* @__PURE__ */ jsx("span", { style: { color: "#444", fontSize: 9, marginLeft: 4 }, children: sub })
437
+
438
+ // src/StatRow.tsx
439
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
440
+ function StatRow({ label, value, sub, color = COLOR_GREEN }) {
441
+ return /* @__PURE__ */ jsxs2("div", { style: s.row, children: [
442
+ /* @__PURE__ */ jsx2("span", { style: s.rowLabel, children: label }),
443
+ /* @__PURE__ */ jsxs2("span", { children: [
444
+ /* @__PURE__ */ jsx2("span", { style: { ...s.rowValue, color }, children: value }),
445
+ sub && /* @__PURE__ */ jsx2("span", { style: { color: COLOR_DIM, fontSize: 9, marginLeft: 4 }, children: sub })
421
446
  ] })
422
447
  ] });
423
448
  }
424
- var GAP = 8;
449
+
450
+ // src/DevStatsPanel.tsx
451
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
452
+ var GAP = PANEL_GAP;
425
453
  function getPanelStyle(pos, offset, position) {
426
454
  const style = {
427
455
  ...s.panel,
@@ -525,71 +553,71 @@ function DevStatsPanel({
525
553
  setExported(true);
526
554
  setTimeout(() => setExported(false), 1200);
527
555
  }, [stats]);
528
- const ftColor = stats.frameTime > 33 ? "#ef4444" : stats.frameTime > 16.67 ? "#f59e0b" : "#4ade80";
529
- const rpsColor = stats.rendersPerSecond > 30 ? "#ef4444" : stats.rendersPerSecond > 10 ? "#f59e0b" : "#4ade80";
530
- const actualColor = stats.profiler.actualDuration > 16 ? "#ef4444" : stats.profiler.actualDuration > 8 ? "#f59e0b" : "#4ade80";
556
+ const frameTColor = ftColor(stats.frameTime);
557
+ const rpsColor = stats.rendersPerSecond > 30 ? COLOR_RED : stats.rendersPerSecond > 10 ? COLOR_AMBER : COLOR_GREEN;
558
+ const actualColor = stats.profiler.actualDuration > 16 ? COLOR_RED : stats.profiler.actualDuration > 8 ? COLOR_AMBER : COLOR_GREEN;
531
559
  const fps = stats.frameTime > 0 ? Math.round(1e3 / stats.frameTime) : 0;
532
560
  const memoGain = stats.profiler.baseDuration > 0 ? Math.round((1 - stats.profiler.actualDuration / stats.profiler.baseDuration) * 100) : 0;
533
- const p99Color = stats.frameTimeP99 > 33 ? "#ef4444" : stats.frameTimeP99 > 16.67 ? "#f59e0b" : "#4ade80";
561
+ const p99Color = ftColor(stats.frameTimeP99);
534
562
  const exportStyle = exported ? { ...s.iconBtn, ...s.iconBtnActive } : s.iconBtn;
535
563
  return createPortal(
536
- /* @__PURE__ */ jsxs("div", { style: getPanelStyle(pos, offset, position), ...dragHandlers, children: [
537
- /* @__PURE__ */ jsxs("div", { style: s.panelHeader, children: [
538
- /* @__PURE__ */ jsxs("span", { style: s.panelTitle, children: [
564
+ /* @__PURE__ */ jsxs3("div", { style: getPanelStyle(pos, offset, position), ...dragHandlers, children: [
565
+ /* @__PURE__ */ jsxs3("div", { style: s.panelHeader, children: [
566
+ /* @__PURE__ */ jsxs3("span", { style: s.panelTitle, children: [
539
567
  "Dev Profiler",
540
- instanceCount > 1 && instanceId && /* @__PURE__ */ jsx("span", { style: s.instanceBadge, children: instanceId })
568
+ instanceCount > 1 && instanceId && /* @__PURE__ */ jsx3("span", { style: s.instanceBadge, children: instanceId })
541
569
  ] }),
542
- /* @__PURE__ */ jsxs("div", { style: s.headerActions, children: [
543
- /* @__PURE__ */ jsx(
570
+ /* @__PURE__ */ jsxs3("div", { style: s.headerActions, children: [
571
+ /* @__PURE__ */ jsx3(
544
572
  "button",
545
573
  {
546
574
  style: exportStyle,
547
575
  onClick: handleExport,
548
576
  title: exported ? "Exported!" : "Export stats as JSON",
549
- children: exported ? /* @__PURE__ */ jsx("svg", { width: "10", height: "10", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("polyline", { points: "3.5 8.5 6.5 11.5 12.5 4.5" }) }) : /* @__PURE__ */ jsx("svg", { width: "10", height: "10", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "M8 2v8M4 7l4 4 4-4M2 14h12" }) })
577
+ children: exported ? /* @__PURE__ */ jsx3("svg", { width: "10", height: "10", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx3("polyline", { points: "3.5 8.5 6.5 11.5 12.5 4.5" }) }) : /* @__PURE__ */ jsx3("svg", { width: "10", height: "10", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx3("path", { d: "M8 2v8M4 7l4 4 4-4M2 14h12" }) })
550
578
  }
551
579
  ),
552
- /* @__PURE__ */ jsx("button", { style: s.iconBtn, onClick: handleReset, title: "Reset counters", children: /* @__PURE__ */ jsx("svg", { width: "10", height: "10", viewBox: "0 0 16 16", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M14 1a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-4a1 1 0 0 1 0-2h1.6A6 6 0 0 0 2.07 7.5a1 1 0 1 1-1.97-.36A8 8 0 0 1 13 3.35V2a1 1 0 0 1 1-1zM2 15a1 1 0 0 1-1-1v-4a1 1 0 0 1 1-1h4a1 1 0 0 1 0 2H4.4A6 6 0 0 0 13.93 8.5a1 1 0 1 1 1.97.36A8 8 0 0 1 3 12.65V14a1 1 0 0 1-1 1z" }) }) }),
553
- /* @__PURE__ */ jsx("button", { style: s.closeBtn, onClick: onClose, children: "\u2715" })
580
+ /* @__PURE__ */ jsx3("button", { style: s.iconBtn, onClick: handleReset, title: "Reset counters", children: /* @__PURE__ */ jsx3("svg", { width: "10", height: "10", viewBox: "0 0 16 16", fill: "currentColor", children: /* @__PURE__ */ jsx3("path", { d: "M14 1a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-4a1 1 0 0 1 0-2h1.6A6 6 0 0 0 2.07 7.5a1 1 0 1 1-1.97-.36A8 8 0 0 1 13 3.35V2a1 1 0 0 1 1-1zM2 15a1 1 0 0 1-1-1v-4a1 1 0 0 1 1-1h4a1 1 0 0 1 0 2H4.4A6 6 0 0 0 13.93 8.5a1 1 0 1 1 1.97.36A8 8 0 0 1 3 12.65V14a1 1 0 0 1-1 1z" }) }) }),
581
+ /* @__PURE__ */ jsx3("button", { style: s.closeBtn, onClick: onClose, children: "\u2715" })
554
582
  ] })
555
583
  ] }),
556
- /* @__PURE__ */ jsxs("div", { style: s.body, children: [
557
- /* @__PURE__ */ jsx("span", { style: s.section, children: "Rendering" }),
558
- /* @__PURE__ */ jsx(StatRow, { label: "Frame time", value: `${stats.frameTime.toFixed(1)}ms`, sub: `${fps} fps`, color: ftColor }),
559
- /* @__PURE__ */ jsx(FrameTimeGraph, { history: stats.frameTimeHistory }),
560
- /* @__PURE__ */ jsxs("div", { style: s.miniRow, children: [
561
- /* @__PURE__ */ jsxs("span", { children: [
584
+ /* @__PURE__ */ jsxs3("div", { style: s.body, children: [
585
+ /* @__PURE__ */ jsx3("span", { style: s.section, children: "Rendering" }),
586
+ /* @__PURE__ */ jsx3(StatRow, { label: "Frame time", value: `${stats.frameTime.toFixed(1)}ms`, sub: `${fps} fps`, color: frameTColor }),
587
+ /* @__PURE__ */ jsx3(FrameTimeGraph, { history: stats.frameTimeHistory }),
588
+ /* @__PURE__ */ jsxs3("div", { style: s.miniRow, children: [
589
+ /* @__PURE__ */ jsxs3("span", { children: [
562
590
  "min ",
563
591
  stats.frameTimeMin.toFixed(1)
564
592
  ] }),
565
- /* @__PURE__ */ jsxs("span", { children: [
593
+ /* @__PURE__ */ jsxs3("span", { children: [
566
594
  "max ",
567
595
  stats.frameTimeMax.toFixed(1)
568
596
  ] }),
569
- /* @__PURE__ */ jsxs("span", { style: { color: p99Color }, children: [
597
+ /* @__PURE__ */ jsxs3("span", { style: { color: p99Color }, children: [
570
598
  "p99 ",
571
599
  stats.frameTimeP99.toFixed(1)
572
600
  ] })
573
601
  ] }),
574
- /* @__PURE__ */ jsx(StatRow, { label: "Renders/s", value: String(stats.rendersPerSecond), color: rpsColor }),
575
- /* @__PURE__ */ jsx(StatRow, { label: "Long tasks", value: String(stats.longTasks), color: stats.longTasks > 0 ? "#f59e0b" : "#4ade80" }),
576
- /* @__PURE__ */ jsx("div", { style: s.separator }),
577
- /* @__PURE__ */ jsx("span", { style: s.section, children: "React Profiler" }),
578
- /* @__PURE__ */ jsx(StatRow, { label: "Phase", value: stats.profiler.phase, color: "#888" }),
579
- /* @__PURE__ */ jsx(StatRow, { label: "Render", value: `${stats.profiler.actualDuration.toFixed(2)}ms`, color: actualColor }),
580
- /* @__PURE__ */ jsx(StatRow, { label: "Base (no memo)", value: `${stats.profiler.baseDuration.toFixed(2)}ms`, color: "#888" }),
581
- /* @__PURE__ */ jsx(StatRow, { label: "Memo gain", value: `${memoGain}%`, color: memoGain > 50 ? "#4ade80" : memoGain > 20 ? "#f59e0b" : "#ef4444" }),
582
- /* @__PURE__ */ jsx(StatRow, { label: "Commits", value: String(stats.profiler.commitCount) }),
583
- /* @__PURE__ */ jsx("div", { style: s.separator }),
584
- /* @__PURE__ */ jsx("span", { style: s.section, children: "DOM" }),
585
- /* @__PURE__ */ jsx(StatRow, { label: "Nodes", value: stats.domNodes.toLocaleString() }),
586
- /* @__PURE__ */ jsx(StatRow, { label: "Mutations", value: String(stats.domMutations) }),
587
- /* @__PURE__ */ jsx(StatRow, { label: "Size", value: stats.dimensions, color: "#888" }),
588
- /* @__PURE__ */ jsx("div", { style: s.separator }),
589
- /* @__PURE__ */ jsx("span", { style: s.section, children: "Memory" }),
590
- /* @__PURE__ */ jsx(StatRow, { label: "JS Heap", value: stats.memory > 0 ? `${stats.memory} MB` : "N/A" })
602
+ /* @__PURE__ */ jsx3(StatRow, { label: "Renders/s", value: String(stats.rendersPerSecond), color: rpsColor }),
603
+ /* @__PURE__ */ jsx3(StatRow, { label: "Long tasks", value: String(stats.longTasks), color: stats.longTasks > 0 ? COLOR_AMBER : COLOR_GREEN }),
604
+ /* @__PURE__ */ jsx3("div", { style: s.separator }),
605
+ /* @__PURE__ */ jsx3("span", { style: s.section, children: "React Profiler" }),
606
+ /* @__PURE__ */ jsx3(StatRow, { label: "Phase", value: stats.profiler.phase, color: COLOR_MUTED }),
607
+ /* @__PURE__ */ jsx3(StatRow, { label: "Render", value: `${stats.profiler.actualDuration.toFixed(2)}ms`, color: actualColor }),
608
+ /* @__PURE__ */ jsx3(StatRow, { label: "Base (no memo)", value: `${stats.profiler.baseDuration.toFixed(2)}ms`, color: COLOR_MUTED }),
609
+ /* @__PURE__ */ jsx3(StatRow, { label: "Memo gain", value: `${memoGain}%`, color: memoGain > 50 ? COLOR_GREEN : memoGain > 20 ? COLOR_AMBER : COLOR_RED }),
610
+ /* @__PURE__ */ jsx3(StatRow, { label: "Commits", value: String(stats.profiler.commitCount) }),
611
+ /* @__PURE__ */ jsx3("div", { style: s.separator }),
612
+ /* @__PURE__ */ jsx3("span", { style: s.section, children: "DOM" }),
613
+ /* @__PURE__ */ jsx3(StatRow, { label: "Nodes", value: stats.domNodes.toLocaleString() }),
614
+ /* @__PURE__ */ jsx3(StatRow, { label: "Mutations", value: String(stats.domMutations) }),
615
+ /* @__PURE__ */ jsx3(StatRow, { label: "Size", value: stats.dimensions, color: COLOR_MUTED }),
616
+ /* @__PURE__ */ jsx3("div", { style: s.separator }),
617
+ /* @__PURE__ */ jsx3("span", { style: s.section, children: "Memory" }),
618
+ /* @__PURE__ */ jsx3(StatRow, { label: "JS Heap", value: stats.memory > 0 ? `${stats.memory} MB` : "N/A" })
591
619
  ] }),
592
- /* @__PURE__ */ jsx("div", { style: s.footer, children: "Ctrl+I to toggle" })
620
+ /* @__PURE__ */ jsx3("div", { style: s.footer, children: "Ctrl+I to toggle" })
593
621
  ] }),
594
622
  document.body
595
623
  );
@@ -598,8 +626,8 @@ function DevStatsPanel({
598
626
  // src/ToggleButton.tsx
599
627
  import { useState as useState3, useEffect as useEffect3 } from "react";
600
628
  import { createPortal as createPortal2 } from "react-dom";
601
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
602
- var GAP2 = 8;
629
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
630
+ var GAP2 = PANEL_GAP;
603
631
  function getButtonStyle(pos, position) {
604
632
  const style = { ...s.toggleBtn };
605
633
  if (position.startsWith("bottom")) {
@@ -618,7 +646,7 @@ function ToggleButton({
618
646
  targetRef,
619
647
  onClick,
620
648
  position = "bottom-left",
621
- accentColor = "#6366f1"
649
+ accentColor = COLOR_ACCENT
622
650
  }) {
623
651
  const pos = useAnchorPosition(targetRef, position);
624
652
  const [fps, setFps] = useState3(0);
@@ -640,16 +668,16 @@ function ToggleButton({
640
668
  return () => cancelAnimationFrame(animId);
641
669
  }, []);
642
670
  return createPortal2(
643
- /* @__PURE__ */ jsxs2(
671
+ /* @__PURE__ */ jsxs4(
644
672
  "button",
645
673
  {
646
674
  onClick,
647
675
  title: "Dev Profiler (Ctrl+I)",
648
676
  style: getButtonStyle(pos, position),
649
677
  children: [
650
- /* @__PURE__ */ jsx2("span", { style: { ...s.toggleDot, background: accentColor, boxShadow: `0 0 4px ${accentColor}` } }),
651
- /* @__PURE__ */ jsx2("span", { style: s.toggleFps, children: fps }),
652
- /* @__PURE__ */ jsx2("span", { style: s.toggleLabel, children: "fps" })
678
+ /* @__PURE__ */ jsx4("span", { style: { ...s.toggleDot, background: accentColor, boxShadow: `0 0 4px ${accentColor}` } }),
679
+ /* @__PURE__ */ jsx4("span", { style: s.toggleFps, children: fps }),
680
+ /* @__PURE__ */ jsx4("span", { style: s.toggleLabel, children: "fps" })
653
681
  ]
654
682
  }
655
683
  ),
@@ -658,7 +686,7 @@ function ToggleButton({
658
686
  }
659
687
 
660
688
  // src/DevProfiler.tsx
661
- import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
689
+ import { Fragment, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
662
690
  var TOGGLE_EVENT = "devprofiler:toggle";
663
691
  var BOUND_KEY = "__devprofiler_bound";
664
692
  if (typeof window !== "undefined" && __DEV__ && !window[BOUND_KEY]) {
@@ -676,7 +704,7 @@ function DevProfiler({
676
704
  children,
677
705
  position = "bottom-left",
678
706
  id,
679
- accentColor = "#6366f1"
707
+ accentColor = COLOR_ACCENT
680
708
  }) {
681
709
  const wrapperRef = useRef3(null);
682
710
  const [open, setOpen] = useState4(false);
@@ -713,11 +741,11 @@ function DevProfiler({
713
741
  window.addEventListener(TOGGLE_EVENT, handler);
714
742
  return () => window.removeEventListener(TOGGLE_EVENT, handler);
715
743
  }, []);
716
- if (!__DEV__) return /* @__PURE__ */ jsx3(Fragment, { children });
717
- return /* @__PURE__ */ jsxs3("div", { ref: wrapperRef, style: { display: "contents" }, children: [
718
- /* @__PURE__ */ jsx3(Profiler, { id: "DevProfiler", onRender, children }),
719
- !open && /* @__PURE__ */ jsx3(ToggleButton, { targetRef: wrapperRef, onClick: toggle, position, accentColor }),
720
- open && /* @__PURE__ */ jsx3(
744
+ if (!__DEV__) return /* @__PURE__ */ jsx5(Fragment, { children });
745
+ return /* @__PURE__ */ jsxs5("div", { ref: wrapperRef, style: { display: "contents" }, children: [
746
+ /* @__PURE__ */ jsx5(Profiler, { id: "DevProfiler", onRender, children }),
747
+ !open && /* @__PURE__ */ jsx5(ToggleButton, { targetRef: wrapperRef, onClick: toggle, position, accentColor }),
748
+ open && /* @__PURE__ */ jsx5(
721
749
  DevStatsPanel,
722
750
  {
723
751
  targetRef: wrapperRef,
@@ -735,8 +763,7 @@ function DevProfiler({
735
763
  ] });
736
764
  }
737
765
  export {
738
- DevProfiler,
739
- DevProfiler as default
766
+ DevProfiler
740
767
  };
741
768
  /**
742
769
  * @module react-dev-profiler
@@ -744,6 +771,12 @@ export {
744
771
  * @author Frederic Denis (billywild87) — https://github.com/billywild87
745
772
  * @license MIT
746
773
  */
774
+ /**
775
+ * @module react-dev-profiler
776
+ * @description Shared colors and thresholds used across the profiler UI.
777
+ * @author Frederic Denis (billywild87) — https://github.com/billywild87
778
+ * @license MIT
779
+ */
747
780
  /**
748
781
  * @module react-dev-profiler
749
782
  * @description Environment detection — works with Vite, webpack, Next.js, and any bundler.
@@ -756,12 +789,30 @@ export {
756
789
  * @author Frederic Denis (billywild87) — https://github.com/billywild87
757
790
  * @license MIT
758
791
  */
792
+ /**
793
+ * @module react-dev-profiler
794
+ * @description Pure utility functions for DOM measurement.
795
+ * @author Frederic Denis (billywild87) — https://github.com/billywild87
796
+ * @license MIT
797
+ */
759
798
  /**
760
799
  * @module react-dev-profiler
761
800
  * @description Custom hooks that power the profiler's data collection.
762
801
  * @author Frederic Denis (billywild87) — https://github.com/billywild87
763
802
  * @license MIT
764
803
  */
804
+ /**
805
+ * @module react-dev-profiler
806
+ * @description Rolling bar chart of frame times (last 60 samples).
807
+ * @author Frederic Denis (billywild87) — https://github.com/billywild87
808
+ * @license MIT
809
+ */
810
+ /**
811
+ * @module react-dev-profiler
812
+ * @description Single label/value row used throughout the profiler panel.
813
+ * @author Frederic Denis (billywild87) — https://github.com/billywild87
814
+ * @license MIT
815
+ */
765
816
  /**
766
817
  * @module react-dev-profiler
767
818
  * @description The main stats panel — renders all performance metrics in a floating overlay.