react-dev-profiler 1.0.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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/DevProfiler.tsx","../src/DevProfiler.module.css","../src/types.ts","../src/env.ts","../src/hooks.ts","../src/DevStatsPanel.tsx","../src/ToggleButton.tsx"],"sourcesContent":["/**\n * react-dev-profiler\n * Real-time React performance monitoring for development.\n *\n * @author Frederic Denis (billywild87) — https://github.com/billywild87\n * @license MIT\n */\n\nexport { DevProfiler } from './DevProfiler'\nexport type { DevStats, ReactProfilerData, PanelPosition } from './types'\n","/**\n * @module react-dev-profiler\n * @description Main wrapper component — wraps your app and enables profiling.\n * @author Frederic Denis (billywild87) — https://github.com/billywild87\n * @license MIT\n */\n\nimport { Profiler, useRef, useState, useEffect, useCallback, type ReactNode } from 'react'\nimport styles from './DevProfiler.module.css'\nimport { type ReactProfilerData, type PanelPosition, INITIAL_PROFILER } from './types'\nimport { __DEV__ } from './env'\nimport { useDomTracker, useRenderRate, useRenderFlash, useLongTasks } from './hooks'\nimport { DevStatsPanel } from './DevStatsPanel'\nimport { ToggleButton } from './ToggleButton'\n\n/*\n * Global keyboard shortcut: Ctrl+I (or Cmd+I) to toggle the profiler.\n * Registered once and kept alive across HMR reloads via a window flag.\n */\nconst TOGGLE_EVENT = 'devprofiler:toggle'\nconst BOUND_KEY = '__devprofiler_bound'\n\nif (typeof window !== 'undefined' && __DEV__ && !(window as any)[BOUND_KEY]) {\n (window as any)[BOUND_KEY] = true\n window.addEventListener('keydown', (e) => {\n if ((e.ctrlKey || e.metaKey) && e.key === 'i') {\n e.preventDefault()\n window.dispatchEvent(new CustomEvent(TOGGLE_EVENT))\n }\n })\n}\n\n/* Module-level registry to track active profiler instances. */\nlet instanceCounter = 0\nconst activeInstances = new Set<string>()\n\n/**\n * Wrap your application (or any subtree) with `<DevProfiler>` to enable\n * real-time performance monitoring during development.\n *\n * In production builds the profiler is completely stripped — children\n * are rendered as-is with zero overhead.\n *\n * @example\n * ```tsx\n * import { DevProfiler } from 'react-dev-profiler'\n *\n * function App() {\n * return (\n * <DevProfiler>\n * <YourApp />\n * </DevProfiler>\n * )\n * }\n * ```\n */\nexport function DevProfiler({\n children,\n position = 'bottom-left',\n id,\n}: {\n children: ReactNode\n /** Where to anchor the panel. @default 'bottom-left' */\n position?: PanelPosition\n /** Optional identifier — shown in the panel when multiple instances are active. */\n id?: string\n}) {\n const wrapperRef = useRef<HTMLDivElement>(null)\n const [open, setOpen] = useState(false)\n const toggle = useCallback(() => setOpen(prev => !prev), [])\n\n // Generate a stable instance ID (user-provided or auto-incremented).\n const instanceId = useRef(id ?? `profiler-${++instanceCounter}`).current\n\n useEffect(() => {\n activeInstances.add(instanceId)\n return () => { activeInstances.delete(instanceId) }\n }, [instanceId])\n\n const domTracker = useDomTracker(wrapperRef, open)\n const renderRate = useRenderRate()\n const longTasks = useLongTasks(open)\n useRenderFlash(wrapperRef, open)\n\n const profilerData = useRef<ReactProfilerData>({ ...INITIAL_PROFILER })\n const onRender = useCallback((_id: string, phase: string, actualDuration: number, baseDuration: number) => {\n profilerData.current = {\n phase,\n actualDuration,\n baseDuration,\n commitCount: profilerData.current.commitCount + 1,\n }\n renderRate.tick()\n }, [renderRate])\n\n const handleReset = useCallback(() => {\n domTracker.reset()\n renderRate.reset()\n longTasks.reset()\n profilerData.current = { ...INITIAL_PROFILER }\n }, [domTracker, renderRate, longTasks])\n\n useEffect(() => {\n const handler = () => setOpen(prev => !prev)\n window.addEventListener(TOGGLE_EVENT, handler)\n return () => window.removeEventListener(TOGGLE_EVENT, handler)\n }, [])\n\n if (!__DEV__) return <>{children}</>\n\n return (\n <div ref={wrapperRef} className={styles.wrapper}>\n <Profiler id=\"DevProfiler\" onRender={onRender}>\n {children}\n </Profiler>\n {!open && <ToggleButton targetRef={wrapperRef} onClick={toggle} position={position} />}\n {open && (\n <DevStatsPanel\n targetRef={wrapperRef}\n domTracker={domTracker}\n renderRate={renderRate}\n longTasks={longTasks}\n profilerData={profilerData}\n onClose={toggle}\n onReset={handleReset}\n position={position}\n instanceId={instanceId}\n instanceCount={activeInstances.size}\n />\n )}\n </div>\n )\n}\n","/**\n * react-dev-profiler — Styles\n * Dark, minimal overlay theme with glassmorphism.\n * Author: Frederic Denis (billywild87)\n */\n\n/* Wrapper — takes up the full space of the profiled subtree */\n.wrapper {\n height: 100%;\n width: 100%;\n}\n\n/* Panel — floating overlay anchored near the profiled element */\n.panel {\n position: fixed;\n z-index: 99999;\n background: rgba(8, 8, 8, 0.95);\n border: 1px solid #222;\n border-radius: 10px;\n padding: 10px 14px;\n min-width: 220px;\n box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);\n font-family: 'SF Mono', 'Fira Code', monospace;\n backdrop-filter: blur(12px);\n user-select: none;\n}\n\n/* Draggable header */\n.panelHeader {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 8px;\n cursor: grab;\n touch-action: none;\n}\n\n.panelHeader:active {\n cursor: grabbing;\n}\n\n.panelTitle {\n color: #666;\n font-size: 9px;\n font-weight: 700;\n letter-spacing: 1.5px;\n text-transform: uppercase;\n display: flex;\n align-items: center;\n gap: 6px;\n}\n\n.instanceBadge {\n background: #222;\n color: #888;\n font-size: 8px;\n padding: 1px 5px;\n border-radius: 4px;\n letter-spacing: 0.5px;\n text-transform: none;\n}\n\n.headerActions {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n\n/* Export button */\n.exportBtn {\n background: none;\n border: none;\n color: #444;\n cursor: pointer;\n padding: 0;\n line-height: 1;\n display: flex;\n align-items: center;\n transition: color 0.15s;\n}\n\n.exportBtn:hover {\n color: #4ade80;\n}\n\n.exportBtnActive {\n color: #4ade80;\n}\n\n/* Reset button */\n.resetBtn {\n background: none;\n border: none;\n color: #444;\n cursor: pointer;\n padding: 0;\n line-height: 1;\n display: flex;\n align-items: center;\n}\n\n.resetBtn:hover {\n color: #4ade80;\n}\n\n.closeBtn {\n background: none;\n border: none;\n color: #444;\n cursor: pointer;\n font-size: 13px;\n padding: 0;\n line-height: 1;\n}\n\n.closeBtn:hover {\n color: #888;\n}\n\n.body {\n display: flex;\n flex-direction: column;\n gap: 5px;\n}\n\n/* Stat rows */\n.section {\n color: #444;\n font-size: 8px;\n font-weight: 600;\n letter-spacing: 1px;\n text-transform: uppercase;\n margin-top: 2px;\n}\n\n.separator {\n height: 1px;\n background: #1a1a1a;\n margin: 2px 0;\n}\n\n.row {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 1px 0;\n}\n\n.rowLabel {\n color: #555;\n font-size: 10px;\n}\n\n.rowValue {\n font-size: 11px;\n font-weight: 600;\n}\n\n.miniRow {\n display: flex;\n justify-content: space-between;\n color: #444;\n font-size: 9px;\n margin-top: -2px;\n margin-bottom: 2px;\n}\n\n/* Frame time graph */\n.graphWrap {\n margin-top: 4px;\n}\n\n/* Toggle button — small floating FPS pill */\n.toggleBtn {\n position: fixed;\n z-index: 99998;\n min-width: 28px;\n height: 24px;\n border-radius: 7px;\n border: 1px solid #2a2a2a;\n background: rgba(20, 20, 20, 0.9);\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0 6px;\n backdrop-filter: blur(8px);\n}\n\n.toggleBtn:hover {\n border-color: #333;\n}\n\n.toggleFps {\n font-family: 'SF Mono', 'Fira Code', monospace;\n font-size: 10px;\n font-weight: 700;\n letter-spacing: -0.5px;\n}\n\n/* Footer hint */\n.footer {\n margin-top: 8px;\n color: #333;\n font-size: 8px;\n text-align: center;\n}\n\n/* DOM mutation flash — brief outline pulse */\n.flash {\n outline: 2px solid rgba(99, 102, 241, 0.8);\n outline-offset: -2px;\n}\n","/**\n * @module react-dev-profiler\n * @description Type definitions and constants for the profiler.\n * @author Frederic Denis (billywild87) — https://github.com/billywild87\n * @license MIT\n */\n\n/** Data captured from React's built-in <Profiler> callback. */\nexport type ReactProfilerData = {\n phase: string\n actualDuration: number\n baseDuration: number\n commitCount: number\n}\n\n/** Aggregated stats displayed in the profiler panel. */\nexport type DevStats = {\n domMutations: number\n domNodes: number\n frameTime: number\n frameTimeMin: number\n frameTimeMax: number\n frameTimeP99: number\n frameTimeHistory: number[]\n longTasks: number\n rendersPerSecond: number\n memory: number\n dimensions: string\n profiler: ReactProfilerData\n}\n\n/** Where the panel anchors relative to the profiled element. */\nexport type PanelPosition = 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right'\n\n/** How many frames we keep in the rolling history graph. */\nexport const HISTORY_SIZE = 60\n\nexport const INITIAL_PROFILER: ReactProfilerData = {\n phase: 'mount',\n actualDuration: 0,\n baseDuration: 0,\n commitCount: 0,\n}\n\nexport const INITIAL_STATS: DevStats = {\n domMutations: 0,\n domNodes: 0,\n frameTime: 0,\n frameTimeMin: 0,\n frameTimeMax: 0,\n frameTimeP99: 0,\n frameTimeHistory: [],\n longTasks: 0,\n rendersPerSecond: 0,\n memory: 0,\n dimensions: '–',\n profiler: INITIAL_PROFILER,\n}\n\n/** Returns the value at a given percentile from a pre-sorted array. */\nexport function percentile(sorted: number[], p: number): number {\n if (sorted.length === 0) return 0\n const idx = Math.ceil((p / 100) * sorted.length) - 1\n return sorted[Math.max(0, idx)]\n}\n","/**\n * @module react-dev-profiler\n * @description Environment detection — works with Vite, webpack, Next.js, and any bundler.\n * @author Frederic Denis (billywild87) — https://github.com/billywild87\n * @license MIT\n */\n\n/**\n * True when running in a development environment.\n * Relies on `process.env.NODE_ENV` which all major bundlers replace at build time,\n * enabling dead-code elimination in production.\n */\nexport const __DEV__: boolean =\n typeof process !== 'undefined'\n ? process.env.NODE_ENV !== 'production'\n : true\n","/**\n * @module react-dev-profiler\n * @description Custom hooks that power the profiler's data collection.\n * @author Frederic Denis (billywild87) — https://github.com/billywild87\n * @license MIT\n */\n\nimport { useState, useEffect, useCallback, useRef } from 'react'\nimport styles from './DevProfiler.module.css'\nimport type { PanelPosition } from './types'\n\n/**\n * Tracks a corner position of a referenced element using ResizeObserver.\n * Used to anchor the panel and toggle button near the profiled component.\n */\nexport function useAnchorPosition(\n ref: React.RefObject<HTMLDivElement | null>,\n position: PanelPosition = 'bottom-left'\n) {\n const [pos, setPos] = useState({ top: 0, left: 0 })\n\n useEffect(() => {\n if (!ref.current) return\n const update = () => {\n if (!ref.current) return\n const rect = ref.current.getBoundingClientRect()\n const margin = 8\n switch (position) {\n case 'top-left':\n setPos({ top: rect.top + margin, left: rect.left + margin }); break\n case 'top-right':\n setPos({ top: rect.top + margin, left: rect.right - margin }); break\n case 'bottom-right':\n setPos({ top: rect.bottom - margin, left: rect.right - margin }); break\n case 'bottom-left':\n default:\n setPos({ top: rect.bottom - margin, left: rect.left + margin }); break\n }\n }\n const observer = new ResizeObserver(update)\n observer.observe(ref.current)\n observer.observe(document.documentElement)\n return () => observer.disconnect()\n }, [ref, position])\n\n return pos\n}\n\n/**\n * Makes an element draggable via Pointer Events.\n * Returns an offset to apply as CSS transform and event handlers for the drag handle.\n */\nexport function useDraggable() {\n const [offset, setOffset] = useState({ x: 0, y: 0 })\n const dragging = useRef(false)\n const start = useRef({ x: 0, y: 0 })\n\n const onPointerDown = useCallback((e: React.PointerEvent) => {\n dragging.current = true\n start.current = { x: e.clientX - offset.x, y: e.clientY - offset.y }\n ;(e.target as HTMLElement).setPointerCapture(e.pointerId)\n }, [offset])\n\n const onPointerMove = useCallback((e: React.PointerEvent) => {\n if (!dragging.current) return\n setOffset({\n x: e.clientX - start.current.x,\n y: e.clientY - start.current.y,\n })\n }, [])\n\n const onPointerUp = useCallback(() => {\n dragging.current = false\n }, [])\n\n return { offset, handlers: { onPointerDown, onPointerMove, onPointerUp } }\n}\n\n/**\n * Counts real DOM mutations via MutationObserver (ignoring class-only changes).\n * The node count is cached and only recalculated when the DOM actually changes,\n * so we don't pay the cost of querySelectorAll('*') every frame.\n */\nexport function useDomTracker(wrapperRef: React.RefObject<HTMLDivElement | null>, enabled: boolean) {\n const mutations = useRef(0)\n const nodeCount = useRef(0)\n const dirty = useRef(true)\n\n useEffect(() => {\n if (!enabled || !wrapperRef.current) return\n const observer = new MutationObserver((records) => {\n let realMutation = false\n for (const record of records) {\n if (record.type === 'attributes' && record.attributeName === 'class') continue\n realMutation = true\n }\n if (realMutation) {\n mutations.current++\n dirty.current = true\n }\n })\n observer.observe(wrapperRef.current, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['style'],\n })\n return () => observer.disconnect()\n }, [wrapperRef, enabled])\n\n const getNodeCount = useCallback(() => {\n if (dirty.current && wrapperRef.current) {\n nodeCount.current = wrapperRef.current.querySelectorAll('*').length\n dirty.current = false\n }\n return nodeCount.current\n }, [wrapperRef])\n\n const reset = useCallback(() => {\n mutations.current = 0\n dirty.current = true\n }, [])\n\n return { mutations, getNodeCount, reset }\n}\n\n/**\n * Measures how many React renders happen per second.\n * Call `tick()` from the <Profiler> onRender callback; the hook\n * snapshots the count every second and resets it.\n */\nexport function useRenderRate() {\n const renderCount = useRef(0)\n const rendersPerSecond = useRef(0)\n\n const tick = useCallback(() => {\n renderCount.current++\n }, [])\n\n useEffect(() => {\n const id = setInterval(() => {\n rendersPerSecond.current = renderCount.current\n renderCount.current = 0\n }, 1000)\n return () => clearInterval(id)\n }, [])\n\n const reset = useCallback(() => {\n renderCount.current = 0\n rendersPerSecond.current = 0\n }, [])\n\n return { rendersPerSecond, tick, reset }\n}\n\n/**\n * Flashes a subtle outline on the profiled element whenever the DOM mutates.\n * Skips the very first mutation (the initial mount) to avoid a flash on load.\n */\nexport function useRenderFlash(wrapperRef: React.RefObject<HTMLDivElement | null>, open: boolean) {\n const mutationCount = useRef(0)\n\n useEffect(() => {\n if (!open || !wrapperRef.current) return\n const observer = new MutationObserver(() => {\n mutationCount.current++\n if (!wrapperRef.current || mutationCount.current <= 1) return\n const el = wrapperRef.current\n el.classList.add(styles.flash)\n setTimeout(() => el.classList.remove(styles.flash), 150)\n })\n observer.observe(wrapperRef.current, { childList: true, subtree: true })\n return () => observer.disconnect()\n }, [wrapperRef, open])\n}\n\n/**\n * Detects browser \"long tasks\" (>50 ms) using PerformanceObserver.\n * Falls back silently in browsers that don't support the longtask entry type.\n */\nexport function useLongTasks(enabled: boolean) {\n const count = useRef(0)\n\n useEffect(() => {\n if (!enabled || typeof PerformanceObserver === 'undefined') return\n try {\n const observer = new PerformanceObserver((list) => {\n count.current += list.getEntries().length\n })\n observer.observe({ entryTypes: ['longtask'] })\n return () => observer.disconnect()\n } catch {\n // longtask not supported in this browser\n }\n }, [enabled])\n\n const reset = useCallback(() => { count.current = 0 }, [])\n\n return { count, reset }\n}\n","/**\n * @module react-dev-profiler\n * @description The main stats panel — renders all performance metrics in a floating overlay.\n * @author Frederic Denis (billywild87) — https://github.com/billywild87\n * @license MIT\n */\n\nimport { useState, useEffect, useCallback, useRef, type CSSProperties } from 'react'\nimport { createPortal } from 'react-dom'\nimport styles from './DevProfiler.module.css'\nimport { useAnchorPosition, useDraggable, useDomTracker, useRenderRate, useLongTasks } from './hooks'\nimport { type ReactProfilerData, type PanelPosition, type DevStats, HISTORY_SIZE, INITIAL_STATS, percentile } from './types'\n\n/** Rolling bar chart of frame times (last 60 samples). */\nfunction FrameTimeGraph({ history }: { history: number[] }) {\n const max = Math.max(33, ...history)\n const w = 140\n const h = 32\n const barW = Math.max(1, w / HISTORY_SIZE - 0.5)\n\n return (\n <div className={styles.graphWrap}>\n <svg width={w} height={h} style={{ display: 'block' }}>\n <rect width={w} height={h} rx={3} fill=\"#111\" />\n {/* 60 fps guideline */}\n <line x1={0} y1={h - (16.67 / max) * h} x2={w} y2={h - (16.67 / max) * h}\n stroke=\"#1a3a1a\" strokeWidth={1} />\n {/* 30 fps guideline */}\n <line x1={0} y1={h - (33 / max) * h} x2={w} y2={h - (33 / max) * h}\n stroke=\"#3a1a1a\" strokeWidth={1} />\n {history.map((ms, i) => {\n const x = (i / HISTORY_SIZE) * w\n const barH = Math.min((ms / max) * h, h)\n const color = ms > 33 ? '#ef4444' : ms > 16.67 ? '#f59e0b' : '#4ade80'\n return <rect key={i} x={x} y={h - barH} width={barW} height={barH} fill={color} opacity={0.8} rx={0.5} />\n })}\n </svg>\n </div>\n )\n}\n\n/** Single label → value row used throughout the panel. */\nfunction StatRow({ label, value, sub, color = '#4ade80' }: { label: string, value: string, sub?: string, color?: string }) {\n return (\n <div className={styles.row}>\n <span className={styles.rowLabel}>{label}</span>\n <span>\n <span className={styles.rowValue} style={{ color }}>{value}</span>\n {sub && <span style={{ color: '#444', fontSize: 9, marginLeft: 4 }}>{sub}</span>}\n </span>\n </div>\n )\n}\n\n/** Computes fixed-position styles based on the chosen panel position + drag offset. */\nfunction getPanelStyle(\n pos: { top: number; left: number },\n offset: { x: number; y: number },\n position: PanelPosition,\n): CSSProperties {\n const style: CSSProperties = {\n transform: `translate(${offset.x}px, ${offset.y}px)`,\n }\n if (position.startsWith('bottom')) {\n style.bottom = window.innerHeight - pos.top\n } else {\n style.top = pos.top\n }\n if (position.endsWith('right')) {\n style.right = window.innerWidth - pos.left\n } else {\n style.left = pos.left\n }\n return style\n}\n\n/** Floating stats panel portaled to document.body. */\nexport function DevStatsPanel({\n targetRef,\n domTracker,\n renderRate,\n longTasks,\n profilerData,\n onClose,\n onReset,\n position = 'bottom-left',\n instanceId,\n instanceCount = 1,\n}: {\n targetRef: React.RefObject<HTMLDivElement | null>\n domTracker: ReturnType<typeof useDomTracker>\n renderRate: ReturnType<typeof useRenderRate>\n longTasks: ReturnType<typeof useLongTasks>\n profilerData: React.RefObject<ReactProfilerData>\n onClose: () => void\n onReset: () => void\n position?: PanelPosition\n instanceId?: string\n instanceCount?: number\n}) {\n const [stats, setStats] = useState<DevStats>(INITIAL_STATS)\n const [exported, setExported] = useState(false)\n const lastFrame = useRef(performance.now())\n const frameTimeHistory = useRef<number[]>([])\n const allFrameTimes = useRef<number[]>([])\n const pos = useAnchorPosition(targetRef, position)\n const { offset, handlers: dragHandlers } = useDraggable()\n\n // Collects frame timing data every rAF, then snapshots stats once per second.\n useEffect(() => {\n let animId: number\n let frameCount = 0\n let frameTotalMs = 0\n let lastSecond = performance.now()\n\n const tick = () => {\n const now = performance.now()\n const delta = now - lastFrame.current\n lastFrame.current = now\n frameCount++\n frameTotalMs += delta\n\n if (now - lastSecond >= 1000) {\n const avgFrameTime = frameTotalMs / frameCount\n\n const hist = frameTimeHistory.current\n if (hist.length >= HISTORY_SIZE) hist.shift()\n hist.push(avgFrameTime)\n\n allFrameTimes.current.push(avgFrameTime)\n const sorted = [...allFrameTimes.current].sort((a, b) => a - b)\n\n const el = targetRef.current\n const dims = el ? `${el.offsetWidth} x ${el.offsetHeight}` : '–'\n\n // Chrome-only: performance.memory exposes JS heap usage\n const perf = performance as any\n const mem = perf.memory ? Math.round(perf.memory.usedJSHeapSize / 1024 / 1024) : 0\n\n setStats({\n domMutations: domTracker.mutations.current,\n domNodes: domTracker.getNodeCount(),\n frameTime: avgFrameTime,\n frameTimeMin: sorted[0] ?? 0,\n frameTimeMax: sorted[sorted.length - 1] ?? 0,\n frameTimeP99: percentile(sorted, 99),\n frameTimeHistory: [...hist],\n longTasks: longTasks.count.current,\n rendersPerSecond: renderRate.rendersPerSecond.current,\n memory: mem,\n dimensions: dims,\n profiler: { ...profilerData.current },\n })\n\n frameCount = 0\n frameTotalMs = 0\n lastSecond = now\n }\n animId = requestAnimationFrame(tick)\n }\n animId = requestAnimationFrame(tick)\n return () => cancelAnimationFrame(animId)\n }, [targetRef, domTracker, renderRate, longTasks])\n\n const handleReset = useCallback(() => {\n frameTimeHistory.current = []\n allFrameTimes.current = []\n setStats(INITIAL_STATS)\n onReset()\n }, [onReset])\n\n // Copy current stats as JSON to clipboard.\n const handleExport = useCallback(() => {\n const payload = { timestamp: new Date().toISOString(), ...stats }\n const json = JSON.stringify(payload, null, 2)\n try {\n navigator.clipboard.writeText(json).then(() => {\n setExported(true)\n setTimeout(() => setExported(false), 1200)\n })\n } catch {\n // Fallback for non-secure contexts\n const ta = document.createElement('textarea')\n ta.value = json\n ta.style.position = 'fixed'\n ta.style.opacity = '0'\n document.body.appendChild(ta)\n ta.select()\n document.execCommand('copy')\n document.body.removeChild(ta)\n setExported(true)\n setTimeout(() => setExported(false), 1200)\n }\n }, [stats])\n\n // Color thresholds: green = good, amber = warning, red = bad\n const ftColor = stats.frameTime > 33 ? '#ef4444' : stats.frameTime > 16.67 ? '#f59e0b' : '#4ade80'\n const rpsColor = stats.rendersPerSecond > 30 ? '#ef4444' : stats.rendersPerSecond > 10 ? '#f59e0b' : '#4ade80'\n const actualColor = stats.profiler.actualDuration > 16 ? '#ef4444' : stats.profiler.actualDuration > 8 ? '#f59e0b' : '#4ade80'\n const fps = stats.frameTime > 0 ? Math.round(1000 / stats.frameTime) : 0\n const memoGain = stats.profiler.baseDuration > 0\n ? Math.round((1 - stats.profiler.actualDuration / stats.profiler.baseDuration) * 100)\n : 0\n const p99Color = stats.frameTimeP99 > 33 ? '#ef4444' : stats.frameTimeP99 > 16.67 ? '#f59e0b' : '#4ade80'\n\n return createPortal(\n <div className={styles.panel} style={getPanelStyle(pos, offset, position)}>\n <div\n className={styles.panelHeader}\n {...dragHandlers}\n >\n <span className={styles.panelTitle}>\n Dev Profiler\n {instanceCount > 1 && instanceId && (\n <span className={styles.instanceBadge}>{instanceId}</span>\n )}\n </span>\n <div className={styles.headerActions}>\n <button\n className={`${styles.exportBtn} ${exported ? styles.exportBtnActive : ''}`}\n onClick={handleExport}\n title={exported ? 'Copied!' : 'Copy stats to clipboard'}\n >\n {exported ? (\n <svg width=\"10\" height=\"10\" viewBox=\"0 0 16 16\" fill=\"currentColor\">\n <path d=\"M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.75.75 0 0 1 1.06-1.06L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0z\"/>\n </svg>\n ) : (\n <svg width=\"10\" height=\"10\" viewBox=\"0 0 16 16\" fill=\"currentColor\">\n <path d=\"M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25z\"/>\n <path d=\"M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25z\"/>\n </svg>\n )}\n </button>\n <button className={styles.resetBtn} onClick={handleReset} title=\"Reset counters\">\n <svg width=\"10\" height=\"10\" viewBox=\"0 0 16 16\" fill=\"currentColor\">\n <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\"/>\n </svg>\n </button>\n <button className={styles.closeBtn} onClick={onClose}>✕</button>\n </div>\n </div>\n\n <div className={styles.body}>\n <span className={styles.section}>Rendering</span>\n <StatRow label=\"Frame time\" value={`${stats.frameTime.toFixed(1)}ms`} sub={`${fps} fps`} color={ftColor} />\n <FrameTimeGraph history={stats.frameTimeHistory} />\n <div className={styles.miniRow}>\n <span>min {stats.frameTimeMin.toFixed(1)}</span>\n <span>max {stats.frameTimeMax.toFixed(1)}</span>\n <span style={{ color: p99Color }}>p99 {stats.frameTimeP99.toFixed(1)}</span>\n </div>\n <StatRow label=\"Renders/s\" value={String(stats.rendersPerSecond)} color={rpsColor} />\n <StatRow label=\"Long tasks\" value={String(stats.longTasks)} color={stats.longTasks > 0 ? '#f59e0b' : '#4ade80'} />\n\n <div className={styles.separator} />\n <span className={styles.section}>React Profiler</span>\n <StatRow label=\"Phase\" value={stats.profiler.phase} color=\"#888\" />\n <StatRow label=\"Render\" value={`${stats.profiler.actualDuration.toFixed(2)}ms`} color={actualColor} />\n <StatRow label=\"Base (no memo)\" value={`${stats.profiler.baseDuration.toFixed(2)}ms`} color=\"#888\" />\n <StatRow label=\"Memo gain\" value={`${memoGain}%`} color={memoGain > 50 ? '#4ade80' : memoGain > 20 ? '#f59e0b' : '#ef4444'} />\n <StatRow label=\"Commits\" value={String(stats.profiler.commitCount)} />\n\n <div className={styles.separator} />\n <span className={styles.section}>DOM</span>\n <StatRow label=\"Nodes\" value={stats.domNodes.toLocaleString()} />\n <StatRow label=\"Mutations\" value={String(stats.domMutations)} />\n <StatRow label=\"Size\" value={stats.dimensions} color=\"#888\" />\n\n <div className={styles.separator} />\n <span className={styles.section}>Memory</span>\n <StatRow label=\"JS Heap\" value={stats.memory > 0 ? `${stats.memory} MB` : 'N/A'} />\n </div>\n\n <div className={styles.footer}>Ctrl+I to toggle</div>\n </div>,\n document.body\n )\n}\n","/**\n * @module react-dev-profiler\n * @description Minimal floating button that shows the current FPS at a glance.\n * @author Frederic Denis (billywild87) — https://github.com/billywild87\n * @license MIT\n */\n\nimport { useState, useEffect, useRef, type CSSProperties } from 'react'\nimport { createPortal } from 'react-dom'\nimport styles from './DevProfiler.module.css'\nimport { useAnchorPosition } from './hooks'\nimport type { PanelPosition } from './types'\n\n/** Computes fixed-position styles based on the chosen panel position. */\nfunction getButtonStyle(pos: { top: number; left: number }, position: PanelPosition): CSSProperties {\n const style: CSSProperties = {}\n if (position.startsWith('bottom')) {\n style.bottom = window.innerHeight - pos.top + 8\n } else {\n style.top = pos.top + 8\n }\n if (position.endsWith('right')) {\n style.right = window.innerWidth - pos.left\n } else {\n style.left = pos.left\n }\n return style\n}\n\n/** Small floating pill showing live FPS — click to open the full panel. */\nexport function ToggleButton({\n targetRef,\n onClick,\n position = 'bottom-left',\n}: {\n targetRef: React.RefObject<HTMLDivElement | null>\n onClick: () => void\n position?: PanelPosition\n}) {\n const pos = useAnchorPosition(targetRef, position)\n const [fps, setFps] = useState(0)\n const lastFrame = useRef(performance.now())\n\n useEffect(() => {\n let animId: number\n let count = 0\n let lastSecond = performance.now()\n\n const tick = () => {\n const now = performance.now()\n lastFrame.current = now\n count++\n if (now - lastSecond >= 1000) {\n setFps(count)\n count = 0\n lastSecond = now\n }\n animId = requestAnimationFrame(tick)\n }\n animId = requestAnimationFrame(tick)\n return () => cancelAnimationFrame(animId)\n }, [])\n\n const fpsColor = fps < 30 ? '#ef4444' : fps < 55 ? '#f59e0b' : '#4ade80'\n\n return createPortal(\n <button\n className={styles.toggleBtn}\n onClick={onClick}\n title=\"Dev Profiler (Ctrl+I)\"\n style={getButtonStyle(pos, position)}\n >\n <span className={styles.toggleFps} style={{ color: fpsColor }}>{fps}</span>\n </button>,\n document.body\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACOA,IAAAA,gBAAmF;;;ACPnF;;;ACmCO,IAAM,eAAe;AAErB,IAAM,mBAAsC;AAAA,EAC/C,OAAO;AAAA,EACP,gBAAgB;AAAA,EAChB,cAAc;AAAA,EACd,aAAa;AACjB;AAEO,IAAM,gBAA0B;AAAA,EACnC,cAAc;AAAA,EACd,UAAU;AAAA,EACV,WAAW;AAAA,EACX,cAAc;AAAA,EACd,cAAc;AAAA,EACd,cAAc;AAAA,EACd,kBAAkB,CAAC;AAAA,EACnB,WAAW;AAAA,EACX,kBAAkB;AAAA,EAClB,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,UAAU;AACd;AAGO,SAAS,WAAW,QAAkB,GAAmB;AAC5D,MAAI,OAAO,WAAW,EAAG,QAAO;AAChC,QAAM,MAAM,KAAK,KAAM,IAAI,MAAO,OAAO,MAAM,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c;AAAA,IACpD;AACA,eAAW,KAAK;AAAA,EACpB,GAAG,CAAC,UAAU,CAAC;AAEf,QAAM,kBAAc,2BAAY,MAAM;AAClC,eAAW,MAAM;AACjB,eAAW,MAAM;AACjB,cAAU,MAAM;AAChB,iBAAa,UAAU,EAAE,GAAG,iBAAiB;AAAA,EACjD,GAAG,CAAC,YAAY,YAAY,SAAS,CAAC;AAEtC,+BAAU,MAAM;AACZ,UAAM,UAAU,MAAM,QAAQ,UAAQ,CAAC,IAAI;AAC3C,WAAO,iBAAiB,cAAc,OAAO;AAC7C,WAAO,MAAM,OAAO,oBAAoB,cAAc,OAAO;AAAA,EACjE,GAAG,CAAC,CAAC;AAEL,MAAI,CAAC,QAAS,QAAO,6EAAG,UAAS;AAEjC,SACI,8CAAC,SAAI,KAAK,YAAY,WAAW,oBAAO,SACpC;AAAA,iDAAC,0BAAS,IAAG,eAAc,UACtB,UACL;AAAA,IACC,CAAC,QAAQ,6CAAC,gBAAa,WAAW,YAAY,SAAS,QAAQ,UAAoB;AAAA,IACnF,QACG;AAAA,MAAC;AAAA;AAAA,QACG,WAAW;AAAA,QACX;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,SAAS;AAAA,QACT,SAAS;AAAA,QACT;AAAA,QACA;AAAA,QACA,eAAe,gBAAgB;AAAA;AAAA,IACnC;AAAA,KAER;AAER;","names":["import_react","import_react","import_react","import_react_dom","import_jsx_runtime","import_jsx_runtime"]}
package/dist/index.css ADDED
@@ -0,0 +1,179 @@
1
+ /* src/DevProfiler.module.css */
2
+ .wrapper {
3
+ height: 100%;
4
+ width: 100%;
5
+ }
6
+ .panel {
7
+ position: fixed;
8
+ z-index: 99999;
9
+ background: rgba(8, 8, 8, 0.95);
10
+ border: 1px solid #222;
11
+ border-radius: 10px;
12
+ padding: 10px 14px;
13
+ min-width: 220px;
14
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
15
+ font-family:
16
+ "SF Mono",
17
+ "Fira Code",
18
+ monospace;
19
+ backdrop-filter: blur(12px);
20
+ user-select: none;
21
+ }
22
+ .panelHeader {
23
+ display: flex;
24
+ justify-content: space-between;
25
+ align-items: center;
26
+ margin-bottom: 8px;
27
+ cursor: grab;
28
+ touch-action: none;
29
+ }
30
+ .panelHeader:active {
31
+ cursor: grabbing;
32
+ }
33
+ .panelTitle {
34
+ color: #666;
35
+ font-size: 9px;
36
+ font-weight: 700;
37
+ letter-spacing: 1.5px;
38
+ text-transform: uppercase;
39
+ display: flex;
40
+ align-items: center;
41
+ gap: 6px;
42
+ }
43
+ .instanceBadge {
44
+ background: #222;
45
+ color: #888;
46
+ font-size: 8px;
47
+ padding: 1px 5px;
48
+ border-radius: 4px;
49
+ letter-spacing: 0.5px;
50
+ text-transform: none;
51
+ }
52
+ .headerActions {
53
+ display: flex;
54
+ align-items: center;
55
+ gap: 8px;
56
+ }
57
+ .exportBtn {
58
+ background: none;
59
+ border: none;
60
+ color: #444;
61
+ cursor: pointer;
62
+ padding: 0;
63
+ line-height: 1;
64
+ display: flex;
65
+ align-items: center;
66
+ transition: color 0.15s;
67
+ }
68
+ .exportBtn:hover {
69
+ color: #4ade80;
70
+ }
71
+ .exportBtnActive {
72
+ color: #4ade80;
73
+ }
74
+ .resetBtn {
75
+ background: none;
76
+ border: none;
77
+ color: #444;
78
+ cursor: pointer;
79
+ padding: 0;
80
+ line-height: 1;
81
+ display: flex;
82
+ align-items: center;
83
+ }
84
+ .resetBtn:hover {
85
+ color: #4ade80;
86
+ }
87
+ .closeBtn {
88
+ background: none;
89
+ border: none;
90
+ color: #444;
91
+ cursor: pointer;
92
+ font-size: 13px;
93
+ padding: 0;
94
+ line-height: 1;
95
+ }
96
+ .closeBtn:hover {
97
+ color: #888;
98
+ }
99
+ .body {
100
+ display: flex;
101
+ flex-direction: column;
102
+ gap: 5px;
103
+ }
104
+ .section {
105
+ color: #444;
106
+ font-size: 8px;
107
+ font-weight: 600;
108
+ letter-spacing: 1px;
109
+ text-transform: uppercase;
110
+ margin-top: 2px;
111
+ }
112
+ .separator {
113
+ height: 1px;
114
+ background: #1a1a1a;
115
+ margin: 2px 0;
116
+ }
117
+ .row {
118
+ display: flex;
119
+ justify-content: space-between;
120
+ align-items: center;
121
+ padding: 1px 0;
122
+ }
123
+ .rowLabel {
124
+ color: #555;
125
+ font-size: 10px;
126
+ }
127
+ .rowValue {
128
+ font-size: 11px;
129
+ font-weight: 600;
130
+ }
131
+ .miniRow {
132
+ display: flex;
133
+ justify-content: space-between;
134
+ color: #444;
135
+ font-size: 9px;
136
+ margin-top: -2px;
137
+ margin-bottom: 2px;
138
+ }
139
+ .graphWrap {
140
+ margin-top: 4px;
141
+ }
142
+ .toggleBtn {
143
+ position: fixed;
144
+ z-index: 99998;
145
+ min-width: 28px;
146
+ height: 24px;
147
+ border-radius: 7px;
148
+ border: 1px solid #2a2a2a;
149
+ background: rgba(20, 20, 20, 0.9);
150
+ cursor: pointer;
151
+ display: flex;
152
+ align-items: center;
153
+ justify-content: center;
154
+ padding: 0 6px;
155
+ backdrop-filter: blur(8px);
156
+ }
157
+ .toggleBtn:hover {
158
+ border-color: #333;
159
+ }
160
+ .toggleFps {
161
+ font-family:
162
+ "SF Mono",
163
+ "Fira Code",
164
+ monospace;
165
+ font-size: 10px;
166
+ font-weight: 700;
167
+ letter-spacing: -0.5px;
168
+ }
169
+ .footer {
170
+ margin-top: 8px;
171
+ color: #333;
172
+ font-size: 8px;
173
+ text-align: center;
174
+ }
175
+ .flash {
176
+ outline: 2px solid rgba(99, 102, 241, 0.8);
177
+ outline-offset: -2px;
178
+ }
179
+ /*# sourceMappingURL=index.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/DevProfiler.module.css"],"sourcesContent":["/**\n * react-dev-profiler — Styles\n * Dark, minimal overlay theme with glassmorphism.\n * Author: Frederic Denis (billywild87)\n */\n\n/* Wrapper — takes up the full space of the profiled subtree */\n.wrapper {\n height: 100%;\n width: 100%;\n}\n\n/* Panel — floating overlay anchored near the profiled element */\n.panel {\n position: fixed;\n z-index: 99999;\n background: rgba(8, 8, 8, 0.95);\n border: 1px solid #222;\n border-radius: 10px;\n padding: 10px 14px;\n min-width: 220px;\n box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);\n font-family: 'SF Mono', 'Fira Code', monospace;\n backdrop-filter: blur(12px);\n user-select: none;\n}\n\n/* Draggable header */\n.panelHeader {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 8px;\n cursor: grab;\n touch-action: none;\n}\n\n.panelHeader:active {\n cursor: grabbing;\n}\n\n.panelTitle {\n color: #666;\n font-size: 9px;\n font-weight: 700;\n letter-spacing: 1.5px;\n text-transform: uppercase;\n display: flex;\n align-items: center;\n gap: 6px;\n}\n\n.instanceBadge {\n background: #222;\n color: #888;\n font-size: 8px;\n padding: 1px 5px;\n border-radius: 4px;\n letter-spacing: 0.5px;\n text-transform: none;\n}\n\n.headerActions {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n\n/* Export button */\n.exportBtn {\n background: none;\n border: none;\n color: #444;\n cursor: pointer;\n padding: 0;\n line-height: 1;\n display: flex;\n align-items: center;\n transition: color 0.15s;\n}\n\n.exportBtn:hover {\n color: #4ade80;\n}\n\n.exportBtnActive {\n color: #4ade80;\n}\n\n/* Reset button */\n.resetBtn {\n background: none;\n border: none;\n color: #444;\n cursor: pointer;\n padding: 0;\n line-height: 1;\n display: flex;\n align-items: center;\n}\n\n.resetBtn:hover {\n color: #4ade80;\n}\n\n.closeBtn {\n background: none;\n border: none;\n color: #444;\n cursor: pointer;\n font-size: 13px;\n padding: 0;\n line-height: 1;\n}\n\n.closeBtn:hover {\n color: #888;\n}\n\n.body {\n display: flex;\n flex-direction: column;\n gap: 5px;\n}\n\n/* Stat rows */\n.section {\n color: #444;\n font-size: 8px;\n font-weight: 600;\n letter-spacing: 1px;\n text-transform: uppercase;\n margin-top: 2px;\n}\n\n.separator {\n height: 1px;\n background: #1a1a1a;\n margin: 2px 0;\n}\n\n.row {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 1px 0;\n}\n\n.rowLabel {\n color: #555;\n font-size: 10px;\n}\n\n.rowValue {\n font-size: 11px;\n font-weight: 600;\n}\n\n.miniRow {\n display: flex;\n justify-content: space-between;\n color: #444;\n font-size: 9px;\n margin-top: -2px;\n margin-bottom: 2px;\n}\n\n/* Frame time graph */\n.graphWrap {\n margin-top: 4px;\n}\n\n/* Toggle button — small floating FPS pill */\n.toggleBtn {\n position: fixed;\n z-index: 99998;\n min-width: 28px;\n height: 24px;\n border-radius: 7px;\n border: 1px solid #2a2a2a;\n background: rgba(20, 20, 20, 0.9);\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0 6px;\n backdrop-filter: blur(8px);\n}\n\n.toggleBtn:hover {\n border-color: #333;\n}\n\n.toggleFps {\n font-family: 'SF Mono', 'Fira Code', monospace;\n font-size: 10px;\n font-weight: 700;\n letter-spacing: -0.5px;\n}\n\n/* Footer hint */\n.footer {\n margin-top: 8px;\n color: #333;\n font-size: 8px;\n text-align: center;\n}\n\n/* DOM mutation flash — brief outline pulse */\n.flash {\n outline: 2px solid rgba(99, 102, 241, 0.8);\n outline-offset: -2px;\n}\n"],"mappings":";AAOA,CAAC;AACG,UAAQ;AACR,SAAO;AACX;AAGA,CAAC;AACG,YAAU;AACV,WAAS;AACT,cAAY,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;AAC1B,UAAQ,IAAI,MAAM;AAClB,iBAAe;AACf,WAAS,KAAK;AACd,aAAW;AACX,cAAY,EAAE,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;AACrC;AAAA,IAAa,SAAS;AAAA,IAAE,WAAW;AAAA,IAAE;AACrC,mBAAiB,KAAK;AACtB,eAAa;AACjB;AAGA,CAAC;AACG,WAAS;AACT,mBAAiB;AACjB,eAAa;AACb,iBAAe;AACf,UAAQ;AACR,gBAAc;AAClB;AAEA,CATC,WASW;AACR,UAAQ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AACV,WAAS;AACT,aAAW;AACX,UAAQ;AACR,iBAAe;AACf,UAAQ,IAAI,MAAM;AAClB,cAAY,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;AAC7B,UAAQ;AACR,WAAS;AACT,eAAa;AACb,mBAAiB;AACjB,WAAS,EAAE;AACX,mBAAiB,KAAK;AAC1B;AAEA,CAhBC,SAgBS;AACN,gBAAc;AAClB;AAEA,CAAC;AACG;AAAA,IAAa,SAAS;AAAA,IAAE,WAAW;AAAA,IAAE;AACrC,aAAW;AACX,eAAa;AACb,kBAAgB;AACpB;AAGA,CAAC;AACG,cAAY;AACZ,SAAO;AACP,aAAW;AACX,cAAY;AAChB;AAGA,CAAC;AACG,WAAS,IAAI,MAAM,KAAK,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE;AACtC,kBAAgB;AACpB;","names":[]}
@@ -0,0 +1,63 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ /**
5
+ * @module react-dev-profiler
6
+ * @description Type definitions and constants for the profiler.
7
+ * @author Frederic Denis (billywild87) — https://github.com/billywild87
8
+ * @license MIT
9
+ */
10
+ /** Data captured from React's built-in <Profiler> callback. */
11
+ type ReactProfilerData = {
12
+ phase: string;
13
+ actualDuration: number;
14
+ baseDuration: number;
15
+ commitCount: number;
16
+ };
17
+ /** Aggregated stats displayed in the profiler panel. */
18
+ type DevStats = {
19
+ domMutations: number;
20
+ domNodes: number;
21
+ frameTime: number;
22
+ frameTimeMin: number;
23
+ frameTimeMax: number;
24
+ frameTimeP99: number;
25
+ frameTimeHistory: number[];
26
+ longTasks: number;
27
+ rendersPerSecond: number;
28
+ memory: number;
29
+ dimensions: string;
30
+ profiler: ReactProfilerData;
31
+ };
32
+ /** Where the panel anchors relative to the profiled element. */
33
+ type PanelPosition = 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right';
34
+
35
+ /**
36
+ * Wrap your application (or any subtree) with `<DevProfiler>` to enable
37
+ * real-time performance monitoring during development.
38
+ *
39
+ * In production builds the profiler is completely stripped — children
40
+ * are rendered as-is with zero overhead.
41
+ *
42
+ * @example
43
+ * ```tsx
44
+ * import { DevProfiler } from 'react-dev-profiler'
45
+ *
46
+ * function App() {
47
+ * return (
48
+ * <DevProfiler>
49
+ * <YourApp />
50
+ * </DevProfiler>
51
+ * )
52
+ * }
53
+ * ```
54
+ */
55
+ declare function DevProfiler({ children, position, id, }: {
56
+ children: ReactNode;
57
+ /** Where to anchor the panel. @default 'bottom-left' */
58
+ position?: PanelPosition;
59
+ /** Optional identifier — shown in the panel when multiple instances are active. */
60
+ id?: string;
61
+ }): react_jsx_runtime.JSX.Element;
62
+
63
+ export { DevProfiler, type DevStats, type PanelPosition, type ReactProfilerData };
@@ -0,0 +1,63 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ /**
5
+ * @module react-dev-profiler
6
+ * @description Type definitions and constants for the profiler.
7
+ * @author Frederic Denis (billywild87) — https://github.com/billywild87
8
+ * @license MIT
9
+ */
10
+ /** Data captured from React's built-in <Profiler> callback. */
11
+ type ReactProfilerData = {
12
+ phase: string;
13
+ actualDuration: number;
14
+ baseDuration: number;
15
+ commitCount: number;
16
+ };
17
+ /** Aggregated stats displayed in the profiler panel. */
18
+ type DevStats = {
19
+ domMutations: number;
20
+ domNodes: number;
21
+ frameTime: number;
22
+ frameTimeMin: number;
23
+ frameTimeMax: number;
24
+ frameTimeP99: number;
25
+ frameTimeHistory: number[];
26
+ longTasks: number;
27
+ rendersPerSecond: number;
28
+ memory: number;
29
+ dimensions: string;
30
+ profiler: ReactProfilerData;
31
+ };
32
+ /** Where the panel anchors relative to the profiled element. */
33
+ type PanelPosition = 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right';
34
+
35
+ /**
36
+ * Wrap your application (or any subtree) with `<DevProfiler>` to enable
37
+ * real-time performance monitoring during development.
38
+ *
39
+ * In production builds the profiler is completely stripped — children
40
+ * are rendered as-is with zero overhead.
41
+ *
42
+ * @example
43
+ * ```tsx
44
+ * import { DevProfiler } from 'react-dev-profiler'
45
+ *
46
+ * function App() {
47
+ * return (
48
+ * <DevProfiler>
49
+ * <YourApp />
50
+ * </DevProfiler>
51
+ * )
52
+ * }
53
+ * ```
54
+ */
55
+ declare function DevProfiler({ children, position, id, }: {
56
+ children: ReactNode;
57
+ /** Where to anchor the panel. @default 'bottom-left' */
58
+ position?: PanelPosition;
59
+ /** Optional identifier — shown in the panel when multiple instances are active. */
60
+ id?: string;
61
+ }): react_jsx_runtime.JSX.Element;
62
+
63
+ export { DevProfiler, type DevStats, type PanelPosition, type ReactProfilerData };