react-reinspect 0.1.6 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +21 -37
  2. package/dist/lib/autoWrap.d.ts +1 -8
  3. package/dist/lib/autoWrap.d.ts.map +1 -1
  4. package/dist/lib/constants.d.ts +2 -2
  5. package/dist/lib/constants.d.ts.map +1 -1
  6. package/dist/lib/context.d.ts +1 -3
  7. package/dist/lib/context.d.ts.map +1 -1
  8. package/dist/lib/core/renderCounter.d.ts +11 -0
  9. package/dist/lib/core/renderCounter.d.ts.map +1 -0
  10. package/dist/lib/core/state.d.ts +42 -0
  11. package/dist/lib/core/state.d.ts.map +1 -0
  12. package/dist/lib/dom/styleInjection.d.ts +2 -0
  13. package/dist/lib/dom/styleInjection.d.ts.map +1 -0
  14. package/dist/lib/index.cjs +1 -1
  15. package/dist/lib/index.d.ts +2 -5
  16. package/dist/lib/index.d.ts.map +1 -1
  17. package/dist/lib/index.js +259 -1156
  18. package/dist/lib/injectStyles.d.ts +1 -1
  19. package/dist/lib/injectStyles.d.ts.map +1 -1
  20. package/dist/lib/internal/auto-wrap.cjs +1 -0
  21. package/dist/lib/internal/auto-wrap.d.ts +9 -0
  22. package/dist/lib/internal/auto-wrap.d.ts.map +1 -0
  23. package/dist/lib/internal/auto-wrap.js +12 -0
  24. package/dist/lib/propsInspector.d.ts.map +1 -1
  25. package/dist/lib/react/context.d.ts +3 -0
  26. package/dist/lib/react/context.d.ts.map +1 -0
  27. package/dist/lib/react/overlay.d.ts +15 -0
  28. package/dist/lib/react/overlay.d.ts.map +1 -0
  29. package/dist/lib/react/provider.d.ts +4 -0
  30. package/dist/lib/react/provider.d.ts.map +1 -0
  31. package/dist/lib/react/wrap.d.ts +11 -0
  32. package/dist/lib/react/wrap.d.ts.map +1 -0
  33. package/dist/lib/store.d.ts +1 -2
  34. package/dist/lib/store.d.ts.map +1 -1
  35. package/dist/lib/types.d.ts +24 -17
  36. package/dist/lib/types.d.ts.map +1 -1
  37. package/dist/lib/utils.d.ts +4 -4
  38. package/dist/lib/utils.d.ts.map +1 -1
  39. package/dist/lib/withReinspect.d.ts +1 -6
  40. package/dist/lib/withReinspect.d.ts.map +1 -1
  41. package/dist/lib/wrap-8xVFW-im.js +996 -0
  42. package/dist/lib/wrap-Bu931FVO.cjs +1 -0
  43. package/dist/lib/wrapInspectableMap.d.ts +1 -1
  44. package/dist/lib/wrapInspectableMap.d.ts.map +1 -1
  45. package/dist/lib/wrapMarker.d.ts +6 -3
  46. package/dist/lib/wrapMarker.d.ts.map +1 -1
  47. package/dist/plugin/internal/autoDiscoverTransform.d.ts +26 -0
  48. package/dist/plugin/internal/autoDiscoverTransform.d.ts.map +1 -0
  49. package/dist/plugin/internal/autoDiscoverTransform.js +397 -0
  50. package/dist/plugin/reinspectAutoDiscoverPlugin.d.ts +5 -8
  51. package/dist/plugin/reinspectAutoDiscoverPlugin.d.ts.map +1 -1
  52. package/dist/plugin/reinspectAutoDiscoverPlugin.js +11 -358
  53. package/dist/plugin/reinspectNextAutoDiscoverLoader.d.ts +1 -0
  54. package/dist/plugin/reinspectNextAutoDiscoverLoader.d.ts.map +1 -1
  55. package/dist/plugin/reinspectNextAutoDiscoverLoader.js +5 -27
  56. package/dist/plugin/reinspectNextPlugin.d.ts +2 -0
  57. package/dist/plugin/reinspectNextPlugin.d.ts.map +1 -1
  58. package/dist/plugin/reinspectNextPlugin.js +19 -15
  59. package/docs/assets/screenshot-example.png +0 -0
  60. package/package.json +8 -2
package/dist/lib/index.js CHANGED
@@ -1,1279 +1,382 @@
1
- import { createContext as e, useCallback as t, useContext as n, useEffect as r, useId as i, useMemo as a, useRef as o, useState as s } from "react";
2
- import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
3
- import { createPortal as d } from "react-dom";
1
+ "use client";
2
+ import { a as e, c as t, i as n, l as r, o as i, r as a, s as o, t as s } from "./wrap-8xVFW-im.js";
3
+ import { useCallback as c, useContext as l, useEffect as u, useMemo as d, useReducer as f, useRef as p, useState as m } from "react";
4
+ import { jsx as h, jsxs as g } from "react/jsx-runtime";
4
5
  //#region src/reinspect/reinspect.css?inline
5
- var f = ".reinspect-shell{border-radius:14px;transition:outline-color .12s;position:relative}.reinspect-shell[data-reinspect-active=true]{outline:2px dashed var(--reinspect-color);outline-offset:2px}.reinspect-content{border-radius:inherit}.reinspect-name-badge{z-index:calc(var(--reinspect-z-base) + 5);letter-spacing:.04em;color:#0f172a;background:color-mix(in srgb, var(--reinspect-color) 25%, white);border:1px solid color-mix(in srgb, var(--reinspect-color) 45%, white);pointer-events:none;white-space:nowrap;border-radius:999px;padding:5px 8px;font-size:11px;line-height:1;position:absolute;top:-14px;left:10px}.reinspect-menu{z-index:2147483647;background:#fff;border:1px solid #cbd5e1;border-radius:12px;width:min(300px,100vw - 24px);max-height:min(420px,70vh);padding:12px;position:fixed;overflow:auto;box-shadow:0 20px 25px -5px #0f172a33,0 8px 10px -6px #0f172a33}.reinspect-menu-title{color:#0f172a;margin:0 0 10px;font-size:13px;font-weight:600}.reinspect-menu-component-setting{color:#1e293b;grid-template-columns:1fr auto;align-items:center;gap:8px;margin-bottom:8px;font-size:12px;display:grid}.reinspect-menu-component-setting input[type=checkbox]{width:15px;height:15px}.reinspect-setting-note{color:#64748b;margin:0 0 10px;font-size:11px}.reinspect-submenu{grid-template-columns:1fr 1fr;gap:6px;margin-bottom:10px;display:grid}.reinspect-submenu button{color:#1e293b;cursor:pointer;background:#f8fafc;border:1px solid #cbd5e1;border-radius:8px;padding:6px 8px;font-size:12px}.reinspect-submenu button[data-state=active]{background:#e0f2fe;border-color:#0284c7}.reinspect-menu-grid{gap:9px;display:grid}.reinspect-menu-filter{margin-bottom:10px;position:relative}.reinspect-menu-filter-icon{color:#64748b;pointer-events:none;width:14px;height:14px;position:absolute;top:50%;left:9px;transform:translateY(-50%)}.reinspect-menu-filter-icon svg{width:100%;height:100%;display:block}.reinspect-menu-filter input{border:1px solid #cbd5e1;border-radius:8px;width:100%;padding:5px 7px 5px 30px;font-size:12px}.reinspect-menu-empty-state{color:#64748b;margin:8px 0 0;font-size:12px}.reinspect-field{gap:4px;display:grid}.reinspect-field label{color:#334155;font-size:12px}.reinspect-inline-controls{grid-template-columns:1fr auto;gap:6px;display:grid}.reinspect-inline-controls input,.reinspect-inline-controls button,.reinspect-inline-controls output{font-size:12px}.reinspect-inline-controls input[type=number],.reinspect-inline-controls input[type=text]{border:1px solid #cbd5e1;border-radius:8px;width:100%;padding:5px 7px}.reinspect-inline-controls button{color:#1e293b;cursor:pointer;background:#f8fafc;border:1px solid #cbd5e1;border-radius:8px;padding:5px 7px}.reinspect-inline-controls button:disabled{opacity:.45;cursor:default}.reinspect-opacity-controls{grid-template-columns:1fr auto auto;align-items:center}.reinspect-opacity-controls output{color:#475569;text-align:right;min-width:36px}.reinspect-props-panel{gap:8px;display:grid}.reinspect-props-submenu{grid-template-columns:1fr 1fr;gap:6px;display:grid}.reinspect-props-submenu button{color:#1e293b;cursor:pointer;background:#f8fafc;border:1px solid #cbd5e1;border-radius:8px;padding:6px 8px;font-size:12px}.reinspect-props-submenu button[data-state=active]{background:#e0f2fe;border-color:#0284c7}.reinspect-props-panel label{color:#334155;font-size:12px}.reinspect-props-table{gap:6px;display:grid}.reinspect-props-header{color:#475569;text-transform:uppercase;letter-spacing:.04em;grid-template-columns:.85fr 1.15fr;gap:8px;font-size:11px;display:grid}.reinspect-props-row{border:1px solid #e2e8f0;border-radius:8px;grid-template-columns:.85fr 1.15fr;align-items:start;gap:8px;padding:6px;display:grid}.reinspect-prop-key{color:#0f172a;word-break:break-word;font-size:12px}.reinspect-prop-cell{min-width:0}.reinspect-prop-cell code{color:#0f172a;word-break:break-word;font-size:11px}.reinspect-prop-missing{color:#94a3b8;font-size:11px}.reinspect-prop-scalar{gap:4px;display:grid}.reinspect-prop-actions{flex-wrap:wrap;gap:6px;margin-top:6px;display:flex}.reinspect-prop-scalar button,.reinspect-prop-function button,.reinspect-prop-tree summary button{color:#1e293b;cursor:pointer;background:#f8fafc;border:1px solid #cbd5e1;border-radius:7px;justify-self:start;padding:3px 6px;font-size:11px}.reinspect-prop-actions button,.reinspect-prop-json-preview button{color:#1e293b;cursor:pointer;background:#f8fafc;border:1px solid #cbd5e1;border-radius:7px;padding:3px 6px;font-size:11px}.reinspect-prop-tree{background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;padding:5px}.reinspect-prop-tree summary{cursor:pointer;color:#1e293b;justify-content:space-between;align-items:center;gap:8px;font-size:11px;display:flex}.reinspect-prop-tree-children{gap:6px;margin-top:6px;display:grid}.reinspect-prop-tree-row{grid-template-columns:.8fr 1.2fr;align-items:start;gap:6px;display:grid}.reinspect-prop-tree-row>code{color:#334155;word-break:break-word;font-size:10px}.reinspect-prop-function{gap:4px;display:grid}.reinspect-prop-function pre{white-space:pre-wrap;word-break:break-word;background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;margin:0;padding:6px;font-size:11px;line-height:1.3}.reinspect-prop-json-preview{gap:6px;margin-top:6px;display:grid}.reinspect-prop-json-preview pre{white-space:pre-wrap;word-break:break-word;background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;max-height:180px;margin:0;padding:6px;font-size:11px;line-height:1.3;overflow:auto}.reinspect-modal-backdrop{z-index:2147483647;background:#0f172a73;place-items:center;padding:20px;display:grid;position:fixed;inset:0}.reinspect-modal{background:#fff;border:1px solid #cbd5e1;border-radius:12px;gap:8px;width:min(560px,100%);padding:12px;display:grid;box-shadow:0 24px 28px -12px #0f172a40,0 10px 16px -10px #0f172a38}.reinspect-modal textarea,.reinspect-props-panel textarea{resize:vertical;border:1px solid #cbd5e1;border-radius:8px;width:100%;padding:8px;font-family:IBM Plex Mono,SFMono-Regular,monospace;font-size:12px}.reinspect-error{color:#b91c1c;margin:0;font-size:12px}.reinspect-floating-toggle{z-index:2147483647;color:#f8fafc;letter-spacing:.03em;cursor:pointer;background:linear-gradient(120deg,#0f172a,#334155);border:none;border-radius:999px;padding:10px 15px;font-size:13px;font-weight:600;position:fixed;bottom:18px;right:18px;box-shadow:0 10px 18px #0f172a47}.reinspect-floating-root{z-index:2147483645;position:fixed;bottom:18px;right:18px}.reinspect-floating-root .reinspect-floating-toggle{position:static}.reinspect-settings-menu{background:#fff;border:1px solid #cbd5e1;border-radius:12px;gap:10px;width:min(360px,100vw - 24px);max-height:min(540px,75vh);padding:12px;display:grid;position:absolute;bottom:calc(100% + 10px);right:0;overflow:auto;box-shadow:0 24px 28px -12px #0f172a40,0 10px 16px -10px #0f172a38}.reinspect-settings-title{color:#0f172a;margin:0;font-size:13px;font-weight:700}.reinspect-settings-toggle-row{color:#1e293b;grid-template-columns:1fr auto;align-items:center;gap:8px;font-size:12px;display:grid}.reinspect-settings-select-row{gap:6px;font-size:12px;display:grid}.reinspect-settings-select-row select{color:#0f172a;background:#fff;border:1px solid #cbd5e1;border-radius:8px;width:100%;padding:6px 8px;font-size:12px}.reinspect-settings-toggle-label{line-height:1.35}.reinspect-settings-toggle-row input[type=checkbox]{width:16px;height:16px}.reinspect-settings-divider{background:#e2e8f0;height:1px}.reinspect-setting-block{gap:8px;display:grid}.reinspect-apply-button{color:#f8fafc;cursor:pointer;background:#0f172a;border:1px solid #0f172a;border-radius:8px;padding:6px 8px;font-size:12px;font-weight:600}.reinspect-apply-button:disabled{opacity:.4;cursor:default}.reinspect-setting-header{grid-template-columns:1fr auto;align-items:start;gap:8px;display:grid}.reinspect-setting-name{color:#0f172a;letter-spacing:.02em;margin:0;font-size:12px;font-weight:700}.reinspect-setting-short-description{color:#475569;margin:3px 0 0;font-size:12px;line-height:1.35}.reinspect-tooltip-host{display:inline-flex;position:relative}.reinspect-tooltip-trigger{color:#334155;cursor:help;background:#f8fafc;border:1px solid #cbd5e1;border-radius:999px;justify-content:center;align-items:center;width:20px;height:20px;padding:0;font-size:12px;font-weight:700;display:inline-flex}.reinspect-tooltip-content{color:#f8fafc;opacity:0;pointer-events:none;background:#0f172a;border:1px solid #cbd5e1;border-radius:8px;width:240px;padding:8px;font-size:11px;line-height:1.4;transition:opacity .12s;position:absolute;top:calc(100% + 6px);right:0}.reinspect-tooltip-host:hover .reinspect-tooltip-content,.reinspect-tooltip-host:focus-within .reinspect-tooltip-content{opacity:1;pointer-events:auto}.reinspect-setting-subheading{color:#334155;margin:2px 0 0;font-size:12px;font-weight:600}.reinspect-setting-empty-state{color:#64748b;margin:0;font-size:12px}.reinspect-component-settings-list{gap:6px;display:grid}.reinspect-component-setting-row{color:#1e293b;background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;grid-template-columns:1fr auto;align-items:center;gap:8px;padding:6px 8px;font-size:12px;display:grid}.reinspect-component-setting-row input[type=checkbox]{width:15px;height:15px}", p = "reinspect-runtime-styles";
6
- function m() {
6
+ var _ = ".reinspect-shell{border-radius:14px;transition:outline-color .12s;position:relative}.reinspect-shell[data-reinspect-active=true]{outline:2px dashed var(--reinspect-color);outline-offset:2px}.reinspect-content{border-radius:inherit}.reinspect-name-badge{z-index:calc(var(--reinspect-z-base) + 5);letter-spacing:.04em;color:#0f172a;background:color-mix(in srgb, var(--reinspect-color) 25%, white);border:1px solid color-mix(in srgb, var(--reinspect-color) 45%, white);pointer-events:none;white-space:nowrap;border-radius:999px;padding:5px 8px;font-size:11px;line-height:1;position:absolute;top:-14px;left:10px}.reinspect-menu{z-index:2147483647;background:#fff;border:1px solid #cbd5e1;border-radius:12px;width:min(300px,100vw - 24px);max-height:min(420px,70vh);padding:12px;position:fixed;overflow:auto;box-shadow:0 20px 25px -5px #0f172a33,0 8px 10px -6px #0f172a33}.reinspect-menu-title{color:#0f172a;margin:0 0 10px;font-size:13px;font-weight:600}.reinspect-menu-component-setting{color:#1e293b;grid-template-columns:1fr auto;align-items:center;gap:8px;margin-bottom:8px;font-size:12px;display:grid}.reinspect-menu-component-setting input[type=checkbox]{width:15px;height:15px}.reinspect-setting-note{color:#64748b;margin:0 0 10px;font-size:11px}.reinspect-submenu{grid-template-columns:1fr 1fr;gap:6px;margin-bottom:10px;display:grid}.reinspect-submenu button{color:#1e293b;cursor:pointer;background:#f8fafc;border:1px solid #cbd5e1;border-radius:8px;padding:6px 8px;font-size:12px}.reinspect-submenu button[data-state=active]{background:#e0f2fe;border-color:#0284c7}.reinspect-menu-grid{gap:9px;display:grid}.reinspect-menu-filter{margin-bottom:10px;position:relative}.reinspect-menu-filter-icon{color:#64748b;pointer-events:none;width:14px;height:14px;position:absolute;top:50%;left:9px;transform:translateY(-50%)}.reinspect-menu-filter-icon svg{width:100%;height:100%;display:block}.reinspect-menu-filter input{border:1px solid #cbd5e1;border-radius:8px;width:100%;padding:5px 7px 5px 30px;font-size:12px}.reinspect-menu-empty-state{color:#64748b;margin:8px 0 0;font-size:12px}.reinspect-field{gap:4px;display:grid}.reinspect-field label{color:#334155;font-size:12px}.reinspect-inline-controls{grid-template-columns:1fr auto;gap:6px;display:grid}.reinspect-inline-controls input,.reinspect-inline-controls button,.reinspect-inline-controls output{font-size:12px}.reinspect-inline-controls input[type=number],.reinspect-inline-controls input[type=text]{border:1px solid #cbd5e1;border-radius:8px;width:100%;padding:5px 7px}.reinspect-inline-controls button{color:#1e293b;cursor:pointer;background:#f8fafc;border:1px solid #cbd5e1;border-radius:8px;padding:5px 7px}.reinspect-inline-controls button:disabled{opacity:.45;cursor:default}.reinspect-opacity-controls{grid-template-columns:1fr auto auto;align-items:center}.reinspect-opacity-controls output{color:#475569;text-align:right;min-width:36px}.reinspect-props-panel{gap:8px;display:grid}.reinspect-props-submenu{grid-template-columns:1fr 1fr;gap:6px;display:grid}.reinspect-props-submenu button{color:#1e293b;cursor:pointer;background:#f8fafc;border:1px solid #cbd5e1;border-radius:8px;padding:6px 8px;font-size:12px}.reinspect-props-submenu button[data-state=active]{background:#e0f2fe;border-color:#0284c7}.reinspect-props-panel label{color:#334155;font-size:12px}.reinspect-props-table{gap:6px;display:grid}.reinspect-props-header{color:#475569;text-transform:uppercase;letter-spacing:.04em;grid-template-columns:.85fr 1.15fr;gap:8px;font-size:11px;display:grid}.reinspect-props-row{border:1px solid #e2e8f0;border-radius:8px;grid-template-columns:.85fr 1.15fr;align-items:start;gap:8px;padding:6px;display:grid}.reinspect-prop-key{color:#0f172a;word-break:break-word;font-size:12px}.reinspect-prop-cell{min-width:0}.reinspect-prop-cell code{color:#0f172a;word-break:break-word;font-size:11px}.reinspect-prop-missing{color:#94a3b8;font-size:11px}.reinspect-prop-scalar{gap:4px;display:grid}.reinspect-prop-actions{flex-wrap:wrap;gap:6px;margin-top:6px;display:flex}.reinspect-prop-scalar button,.reinspect-prop-function button,.reinspect-prop-tree summary button{color:#1e293b;cursor:pointer;background:#f8fafc;border:1px solid #cbd5e1;border-radius:7px;justify-self:start;padding:3px 6px;font-size:11px}.reinspect-prop-actions button,.reinspect-prop-json-preview button{color:#1e293b;cursor:pointer;background:#f8fafc;border:1px solid #cbd5e1;border-radius:7px;padding:3px 6px;font-size:11px}.reinspect-prop-tree{background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;padding:5px}.reinspect-prop-tree summary{cursor:pointer;color:#1e293b;justify-content:space-between;align-items:center;gap:8px;font-size:11px;display:flex}.reinspect-prop-tree-children{gap:6px;margin-top:6px;display:grid}.reinspect-prop-tree-row{grid-template-columns:.8fr 1.2fr;align-items:start;gap:6px;display:grid}.reinspect-prop-tree-row>code{color:#334155;word-break:break-word;font-size:10px}.reinspect-prop-function{gap:4px;display:grid}.reinspect-prop-function pre{white-space:pre-wrap;word-break:break-word;background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;margin:0;padding:6px;font-size:11px;line-height:1.3}.reinspect-prop-json-preview{gap:6px;margin-top:6px;display:grid}.reinspect-prop-json-preview pre{white-space:pre-wrap;word-break:break-word;background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;max-height:180px;margin:0;padding:6px;font-size:11px;line-height:1.3;overflow:auto}.reinspect-modal-backdrop{z-index:2147483647;background:#0f172a73;place-items:center;padding:20px;display:grid;position:fixed;inset:0}.reinspect-modal{background:#fff;border:1px solid #cbd5e1;border-radius:12px;gap:8px;width:min(560px,100%);padding:12px;display:grid;box-shadow:0 24px 28px -12px #0f172a40,0 10px 16px -10px #0f172a38}.reinspect-modal textarea,.reinspect-props-panel textarea{resize:vertical;border:1px solid #cbd5e1;border-radius:8px;width:100%;padding:8px;font-family:IBM Plex Mono,SFMono-Regular,monospace;font-size:12px}.reinspect-error{color:#b91c1c;margin:0;font-size:12px}.reinspect-floating-toggle{z-index:2147483647;color:#f8fafc;letter-spacing:.03em;cursor:pointer;background:linear-gradient(120deg,#0f172a,#334155);border:none;border-radius:999px;padding:10px 15px;font-size:13px;font-weight:600;position:fixed;bottom:18px;right:18px;box-shadow:0 10px 18px #0f172a47}.reinspect-floating-root{z-index:2147483645;position:fixed;bottom:18px;right:18px}.reinspect-floating-root .reinspect-floating-toggle{position:static}.reinspect-settings-menu{background:#fff;border:1px solid #cbd5e1;border-radius:12px;gap:10px;width:min(360px,100vw - 24px);max-height:min(540px,75vh);padding:12px;display:grid;position:absolute;bottom:calc(100% + 10px);right:0;overflow:auto;box-shadow:0 24px 28px -12px #0f172a40,0 10px 16px -10px #0f172a38}.reinspect-settings-title{color:#0f172a;margin:0;font-size:13px;font-weight:700}.reinspect-settings-toggle-row{color:#1e293b;grid-template-columns:1fr auto;align-items:center;gap:8px;font-size:12px;display:grid}.reinspect-settings-select-row{gap:6px;font-size:12px;display:grid}.reinspect-settings-select-row select{color:#0f172a;background:#fff;border:1px solid #cbd5e1;border-radius:8px;width:100%;padding:6px 8px;font-size:12px}.reinspect-settings-toggle-label{line-height:1.35}.reinspect-settings-toggle-row input[type=checkbox]{width:16px;height:16px}.reinspect-settings-divider{background:#e2e8f0;height:1px}.reinspect-setting-block{gap:8px;display:grid}.reinspect-apply-button{color:#f8fafc;cursor:pointer;background:#0f172a;border:1px solid #0f172a;border-radius:8px;padding:6px 8px;font-size:12px;font-weight:600}.reinspect-apply-button:disabled{opacity:.4;cursor:default}.reinspect-setting-header{grid-template-columns:1fr auto;align-items:start;gap:8px;display:grid}.reinspect-setting-name{color:#0f172a;letter-spacing:.02em;margin:0;font-size:12px;font-weight:700}.reinspect-setting-short-description{color:#475569;margin:3px 0 0;font-size:12px;line-height:1.35}.reinspect-tooltip-host{display:inline-flex;position:relative}.reinspect-tooltip-trigger{color:#334155;cursor:help;background:#f8fafc;border:1px solid #cbd5e1;border-radius:999px;justify-content:center;align-items:center;width:20px;height:20px;padding:0;font-size:12px;font-weight:700;display:inline-flex}.reinspect-tooltip-content{color:#f8fafc;opacity:0;pointer-events:none;background:#0f172a;border:1px solid #cbd5e1;border-radius:8px;width:240px;padding:8px;font-size:11px;line-height:1.4;transition:opacity .12s;position:absolute;top:calc(100% + 6px);right:0}.reinspect-tooltip-host:hover .reinspect-tooltip-content,.reinspect-tooltip-host:focus-within .reinspect-tooltip-content{opacity:1;pointer-events:auto}.reinspect-setting-subheading{color:#334155;margin:2px 0 0;font-size:12px;font-weight:600}.reinspect-setting-empty-state{color:#64748b;margin:0;font-size:12px}.reinspect-component-settings-list{gap:6px;display:grid}.reinspect-component-setting-row{color:#1e293b;background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;grid-template-columns:1fr auto;align-items:center;gap:8px;padding:6px 8px;font-size:12px;display:grid}.reinspect-component-setting-row input[type=checkbox]{width:15px;height:15px}", v = "reinspect-runtime-styles";
7
+ function y() {
7
8
  return typeof document > "u" ? null : document;
8
9
  }
9
- function h(e) {
10
+ function b(e) {
10
11
  if (!e) return;
11
- let t = m();
12
- if (!t || t.getElementById(p)) return;
12
+ let t = y();
13
+ if (!t || t.getElementById(v)) return;
13
14
  let n = t.createElement("style");
14
- n.id = p, n.textContent = e, (t.head ?? t.documentElement).appendChild(n);
15
+ n.id = v, n.textContent = e, (t.head ?? t.documentElement).appendChild(n);
15
16
  }
16
17
  //#endregion
17
- //#region src/reinspect/store.ts
18
- var g = e(null);
19
- //#endregion
20
- //#region src/reinspect/useReinspect.ts
21
- function _() {
22
- let e = n(g);
23
- if (!e) throw Error("useReinspect must be used within ReinspectProvider");
24
- return e;
25
- }
26
- //#endregion
27
- //#region src/reinspect/constants.ts
28
- var v = [
29
- "backgroundColor",
30
- "color",
31
- "fontSize",
32
- "padding",
33
- "margin",
34
- "borderRadius",
35
- "borderWidth",
36
- "borderColor",
37
- "opacity",
38
- "width",
39
- "height",
40
- "gap"
41
- ], y = [
42
- "#f97316",
43
- "#2563eb",
44
- "#16a34a",
45
- "#db2777",
46
- "#ca8a04",
47
- "#0f766e"
48
- ], b = new Set([
49
- "backgroundColor",
50
- "color",
51
- "borderColor"
52
- ]), ee = new Set([
53
- "fontSize",
54
- "padding",
55
- "margin",
56
- "borderRadius",
57
- "borderWidth",
58
- "width",
59
- "height",
60
- "gap"
61
- ]), x = 2147483e3, S = "reinspect.inspectMode", C = [
62
- "wrapped",
63
- "first-party",
64
- "all"
65
- ], w = [
66
- "attempts",
67
- "commits",
68
- "both"
69
- ];
70
- function T() {
71
- return !1;
72
- }
73
- function E(e) {
74
- return typeof e == "string" && C.includes(e);
75
- }
76
- function D(e) {
77
- return typeof e == "string" && w.includes(e);
78
- }
79
- function O() {
80
- if (!(typeof window > "u")) try {
81
- let e = window.sessionStorage.getItem(S);
82
- return E(e) ? e : void 0;
83
- } catch {
84
- return;
85
- }
86
- }
87
- function te(e) {
88
- return O() || (E(e) ? e : "wrapped");
89
- }
90
- function k(e) {
91
- if (!(typeof window > "u")) try {
92
- window.sessionStorage.setItem(S, e);
93
- } catch {}
94
- }
95
- function ne() {
96
- if (!(typeof window > "u")) try {
97
- window.location.reload();
98
- } catch {}
18
+ //#region src/reinspect/core/state.ts
19
+ function x(e) {
20
+ let t = {};
21
+ for (let n of e) t[n] = !0;
22
+ return t;
99
23
  }
100
- function A(e = {}) {
101
- let t = e.enabled ?? T(), n = e.editableProps && e.editableProps.length > 0 ? e.editableProps : v, r = e.palette && e.palette.length > 0 ? e.palette : y;
24
+ function S(e) {
102
25
  return {
103
- enabled: t,
104
- startActive: e.startActive ?? !0,
105
- showFloatingToggle: e.showFloatingToggle ?? t,
106
- inspectMode: te(e.inspectMode),
107
- editableProps: n,
108
- palette: r,
109
- zIndexBase: e.zIndexBase ?? x,
110
- shouldCountRenders: e.shouldCountRenders ?? !1,
111
- countRendersForComponents: e.countRendersForComponents ?? [],
112
- renderCaptureMode: D(e.renderCaptureMode) ? e.renderCaptureMode : "attempts"
26
+ isActive: e.startActive,
27
+ inspectMode: e.inspectMode,
28
+ pendingInspectMode: e.inspectMode,
29
+ renderCounterMode: e.renderCounters,
30
+ renderCountComponents: x(e.countRendersForComponents),
31
+ overrides: {}
113
32
  };
114
33
  }
115
- function j(e) {
116
- let t = 0;
117
- for (let n = 0; n < e.length; n += 1) t = (t << 5) - t + e.charCodeAt(n), t |= 0;
118
- return Math.abs(t);
119
- }
120
- function M(e, t) {
121
- return t.length === 0 ? y[0] : t[j(e) % t.length];
122
- }
123
- function re(e, t) {
124
- if (!e) return {};
125
- let n = {};
126
- for (let r of t) {
127
- let t = e[r];
128
- t == null || t === "" || (n[r] = t);
129
- }
130
- return n;
131
- }
132
- function ie(e) {
133
- if (!e) return "#1f2937";
134
- if (/^#[0-9a-fA-F]{6}$/.test(e)) return e;
135
- if (/^#[0-9a-fA-F]{3}$/.test(e)) {
136
- let [, t, n, r] = e;
137
- return `#${t}${t}${n}${n}${r}${r}`;
34
+ function C(e, t) {
35
+ if (e === t) return !0;
36
+ if (e.length !== t.length) return !1;
37
+ for (let n = 0; n < e.length; n += 1) if (e[n] !== t[n]) return !1;
38
+ return !0;
39
+ }
40
+ function w(e, t) {
41
+ switch (t.type) {
42
+ case "hydrate-config": {
43
+ let n = x(t.config.countRendersForComponents), r = {
44
+ ...e,
45
+ isActive: t.config.enabled ? e.isActive : !1,
46
+ inspectMode: t.config.inspectMode,
47
+ pendingInspectMode: t.config.inspectMode,
48
+ renderCounterMode: t.config.renderCounters,
49
+ renderCountComponents: n
50
+ };
51
+ return r.isActive === e.isActive && r.inspectMode === e.inspectMode && r.pendingInspectMode === e.pendingInspectMode && r.renderCounterMode === e.renderCounterMode && C(Object.keys(r.renderCountComponents), Object.keys(e.renderCountComponents)) ? e : r;
52
+ }
53
+ case "set-is-active": return e.isActive === t.value ? e : {
54
+ ...e,
55
+ isActive: t.value
56
+ };
57
+ case "set-pending-inspect-mode": return e.pendingInspectMode === t.value ? e : {
58
+ ...e,
59
+ pendingInspectMode: t.value
60
+ };
61
+ case "set-render-counter-mode": return e.renderCounterMode === t.value ? e : {
62
+ ...e,
63
+ renderCounterMode: t.value
64
+ };
65
+ case "set-render-counting-for-component": {
66
+ if (t.enabled) return e.renderCountComponents[t.componentName] ? e : {
67
+ ...e,
68
+ renderCountComponents: {
69
+ ...e.renderCountComponents,
70
+ [t.componentName]: !0
71
+ }
72
+ };
73
+ if (!e.renderCountComponents[t.componentName]) return e;
74
+ let n = { ...e.renderCountComponents };
75
+ return delete n[t.componentName], {
76
+ ...e,
77
+ renderCountComponents: n
78
+ };
79
+ }
80
+ case "update-override": {
81
+ let n = { ...e.overrides[t.componentId] ?? {} };
82
+ if (t.value === void 0 || t.value === null || t.value === "" ? delete n[t.prop] : n[t.prop] = t.value, Object.keys(n).length === 0) {
83
+ if (!e.overrides[t.componentId]) return e;
84
+ let n = { ...e.overrides };
85
+ return delete n[t.componentId], {
86
+ ...e,
87
+ overrides: n
88
+ };
89
+ }
90
+ return {
91
+ ...e,
92
+ overrides: {
93
+ ...e.overrides,
94
+ [t.componentId]: n
95
+ }
96
+ };
97
+ }
98
+ default: return e;
138
99
  }
139
- return "#1f2937";
140
- }
141
- function ae(e) {
142
- let t = Number(e);
143
- if (Number.isFinite(t)) return t;
144
100
  }
145
101
  //#endregion
146
- //#region src/reinspect/context.tsx
147
- var N = "Capture rerenders and show totals next to component badges.", oe = "Tracks every rerender after initial mount for wrapped components. Use this toggle to capture for all components, or enable a specific component from its right-click inspector menu.", se = "Choose whether to count render attempts, committed renders, or both.", ce = "Render attempts track render-phase executions (includes Strict Mode extra passes). Committed renders track completed DOM commits. Both shows both counters together.", le = "Controls which components are automatically discoverable by Reinspect.", P = "Only wrapped components uses explicit withReinspect wrappers only. All 1st-party components auto-discovers components under your source tree. All components also attempts dependency components (with safety skips).";
148
- function F(e) {
149
- let t = {};
150
- for (let n of e) t[n] = !0;
151
- return t;
102
+ //#region src/reinspect/useReinspect.ts
103
+ function T() {
104
+ let e = l(r);
105
+ if (!e) throw Error("useReinspect must be used within ReinspectProvider");
106
+ return e;
152
107
  }
153
- function I({ children: e, config: n }) {
154
- let r = a(() => A(n), [n]), [i, o] = s(r.startActive), [c] = s(r.inspectMode), [d, f] = s(r.inspectMode), [p, m] = s(r.shouldCountRenders), [h, _] = s(r.renderCaptureMode), [v, y] = s(() => F(r.countRendersForComponents)), [b, ee] = s({}), x = t((e, t, n) => {
155
- ee((r) => {
156
- let i = { ...r[e] ?? {} };
157
- if (n == null || n === "" ? delete i[t] : i[t] = n, Object.keys(i).length === 0) {
158
- let t = { ...r };
159
- return delete t[e], t;
160
- }
161
- return {
162
- ...r,
163
- [e]: i
164
- };
108
+ //#endregion
109
+ //#region src/reinspect/react/provider.tsx
110
+ var E = "Controls render counting for wrapped components.", D = "Off disables global counting. Attempts, commits, and both capture rerenders after initial mount.", O = "Controls which components are automatically discoverable by Reinspect.", k = "Only wrapped components uses explicit withReinspect wrappers only. All 1st-party components auto-discovers components under your source tree. All components also attempts dependency components (with safety skips).";
111
+ function A({ children: n, config: a }) {
112
+ let s = d(() => t(a), [a]), [l, p] = f(w, s, S);
113
+ u(() => {
114
+ p({
115
+ type: "hydrate-config",
116
+ config: s
165
117
  });
166
- }, []), S = t((e, t) => {
167
- y((n) => {
168
- if (t) return {
169
- ...n,
170
- [e]: !0
171
- };
172
- if (!n[e]) return n;
173
- let r = { ...n };
174
- return delete r[e], r;
118
+ }, [s]);
119
+ let m = c((e) => {
120
+ p({
121
+ type: "set-is-active",
122
+ value: typeof e == "function" ? e(l.isActive) : e
123
+ });
124
+ }, [l.isActive]), _ = c((e) => {
125
+ p({
126
+ type: "set-pending-inspect-mode",
127
+ value: typeof e == "function" ? e(l.pendingInspectMode) : e
175
128
  });
176
- }, []), C = t((e) => p || !!v[e], [p, v]), w = d !== c, T = t(() => {
177
- w && (k(d), ne());
178
- }, [w, d]), E = t((e) => M(e, r.palette), [r.palette]), D = a(() => ({
179
- config: r,
180
- isActive: r.enabled && i,
181
- setIsActive: o,
182
- inspectMode: c,
183
- pendingInspectMode: d,
184
- setPendingInspectMode: f,
185
- hasPendingInspectModeChange: w,
129
+ }, [l.pendingInspectMode]), v = c((e) => {
130
+ p({
131
+ type: "set-render-counter-mode",
132
+ value: typeof e == "function" ? e(l.renderCounterMode) : e
133
+ });
134
+ }, [l.renderCounterMode]), y = c((e, t, n) => {
135
+ p({
136
+ type: "update-override",
137
+ componentId: e,
138
+ prop: t,
139
+ value: n
140
+ });
141
+ }, []), b = c((e, t) => {
142
+ p({
143
+ type: "set-render-counting-for-component",
144
+ componentName: e,
145
+ enabled: t
146
+ });
147
+ }, []), x = c((e) => l.renderCounterMode !== "off" || !!l.renderCountComponents[e], [l.renderCounterMode, l.renderCountComponents]), C = l.pendingInspectMode !== l.inspectMode, T = c(() => {
148
+ C && (e(l.pendingInspectMode), o());
149
+ }, [C, l.pendingInspectMode]), E = c((e) => i(e, s.palette), [s.palette]), D = d(() => ({
150
+ config: s,
151
+ isActive: s.enabled && l.isActive,
152
+ setIsActive: m,
153
+ inspectMode: l.inspectMode,
154
+ pendingInspectMode: l.pendingInspectMode,
155
+ setPendingInspectMode: _,
156
+ hasPendingInspectModeChange: C,
186
157
  applyInspectMode: T,
187
- shouldCountRenders: p,
188
- setShouldCountRenders: m,
189
- renderCaptureMode: h,
190
- setRenderCaptureMode: _,
191
- renderCountComponents: v,
192
- setRenderCountingForComponent: S,
193
- isRenderCountingEnabledFor: C,
194
- overrides: b,
195
- updateOverride: x,
158
+ renderCounterMode: l.renderCounterMode,
159
+ setRenderCounterMode: v,
160
+ renderCountComponents: l.renderCountComponents,
161
+ setRenderCountingForComponent: b,
162
+ isRenderCountingEnabledFor: x,
163
+ overrides: l.overrides,
164
+ updateOverride: y,
196
165
  getBorderColor: E
197
166
  }), [
198
- r,
199
- i,
200
- c,
201
- d,
202
- f,
203
- w,
167
+ s,
168
+ l.isActive,
169
+ m,
170
+ l.inspectMode,
171
+ l.pendingInspectMode,
172
+ _,
173
+ C,
204
174
  T,
205
- p,
206
- h,
175
+ l.renderCounterMode,
207
176
  v,
208
- S,
209
- C,
177
+ l.renderCountComponents,
210
178
  b,
211
179
  x,
180
+ l.overrides,
181
+ y,
212
182
  E
213
183
  ]);
214
- return /* @__PURE__ */ u(g.Provider, {
184
+ return /* @__PURE__ */ g(r.Provider, {
215
185
  value: D,
216
- children: [e, r.enabled && r.showFloatingToggle ? /* @__PURE__ */ l(L, {}) : null]
186
+ children: [n, s.enabled && s.showFloatingToggle ? /* @__PURE__ */ h(j, {}) : null]
217
187
  });
218
188
  }
219
- function L() {
220
- let { config: e, isActive: t, setIsActive: n, inspectMode: i, pendingInspectMode: a, setPendingInspectMode: c, hasPendingInspectModeChange: d, applyInspectMode: f, shouldCountRenders: p, setShouldCountRenders: m, renderCaptureMode: h, setRenderCaptureMode: g } = _(), [v, y] = s(!1), b = o(null);
221
- return r(() => {
222
- if (!v) return;
189
+ function j() {
190
+ let { config: e, isActive: t, setIsActive: r, inspectMode: i, pendingInspectMode: o, setPendingInspectMode: s, hasPendingInspectModeChange: c, applyInspectMode: l, renderCounterMode: d, setRenderCounterMode: f } = T(), [_, v] = m(!1), y = p(null);
191
+ return u(() => {
192
+ if (!_) return;
223
193
  let e = (e) => {
224
194
  let t = e.target;
225
- b.current?.contains(t) || y(!1);
195
+ t instanceof Node && (y.current?.contains(t) || v(!1));
226
196
  }, t = (e) => {
227
- e.key === "Escape" && y(!1);
197
+ e.key === "Escape" && v(!1);
228
198
  };
229
199
  return document.addEventListener("mousedown", e), document.addEventListener("keydown", t), () => {
230
200
  document.removeEventListener("mousedown", e), document.removeEventListener("keydown", t);
231
201
  };
232
- }, [v]), e.enabled ? /* @__PURE__ */ u("div", {
202
+ }, [_]), e.enabled ? /* @__PURE__ */ g("div", {
233
203
  className: "reinspect-floating-root",
234
- ref: b,
235
- children: [/* @__PURE__ */ l("button", {
204
+ ref: y,
205
+ children: [/* @__PURE__ */ h("button", {
236
206
  type: "button",
237
207
  className: "reinspect-floating-toggle",
238
208
  "data-testid": "reinspect-floating-toggle",
239
- onClick: () => y((e) => !e),
240
- "aria-expanded": v,
209
+ onClick: () => v((e) => !e),
210
+ "aria-expanded": _,
241
211
  "aria-controls": "reinspect-settings-menu",
242
212
  children: "Reinspect settings"
243
- }), v ? /* @__PURE__ */ u("div", {
213
+ }), _ ? /* @__PURE__ */ g("div", {
244
214
  id: "reinspect-settings-menu",
245
215
  className: "reinspect-settings-menu",
246
216
  role: "dialog",
247
217
  "aria-label": "Reinspect settings",
248
218
  "data-testid": "reinspect-settings-menu",
249
219
  children: [
250
- /* @__PURE__ */ l("p", {
220
+ /* @__PURE__ */ h("p", {
251
221
  className: "reinspect-settings-title",
252
222
  children: "Reinspect settings"
253
223
  }),
254
- /* @__PURE__ */ u("label", {
224
+ /* @__PURE__ */ g("label", {
255
225
  className: "reinspect-settings-toggle-row",
256
- children: [/* @__PURE__ */ l("span", {
226
+ children: [/* @__PURE__ */ h("span", {
257
227
  className: "reinspect-settings-toggle-label",
258
228
  children: "Inspector enabled"
259
- }), /* @__PURE__ */ l("input", {
229
+ }), /* @__PURE__ */ h("input", {
260
230
  "data-testid": "reinspect-setting-inspector-active",
261
231
  type: "checkbox",
262
232
  checked: t,
263
- onChange: (e) => n(e.currentTarget.checked)
233
+ onChange: (e) => r(e.currentTarget.checked)
264
234
  })]
265
235
  }),
266
- /* @__PURE__ */ l("div", { className: "reinspect-settings-divider" }),
267
- /* @__PURE__ */ u("section", {
236
+ /* @__PURE__ */ h("div", { className: "reinspect-settings-divider" }),
237
+ /* @__PURE__ */ g("section", {
268
238
  className: "reinspect-setting-block",
269
239
  children: [
270
- /* @__PURE__ */ u("header", {
240
+ /* @__PURE__ */ g("header", {
271
241
  className: "reinspect-setting-header",
272
- children: [/* @__PURE__ */ u("div", { children: [/* @__PURE__ */ l("p", {
242
+ children: [/* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("p", {
273
243
  className: "reinspect-setting-name",
274
244
  children: "INSPECT_MODE"
275
- }), /* @__PURE__ */ l("p", {
245
+ }), /* @__PURE__ */ h("p", {
276
246
  className: "reinspect-setting-short-description",
277
- children: le
278
- })] }), /* @__PURE__ */ u("span", {
247
+ children: O
248
+ })] }), /* @__PURE__ */ g("span", {
279
249
  className: "reinspect-tooltip-host",
280
- children: [/* @__PURE__ */ l("button", {
250
+ children: [/* @__PURE__ */ h("button", {
281
251
  type: "button",
282
252
  className: "reinspect-tooltip-trigger",
283
253
  "aria-label": "Explain INSPECT_MODE",
284
254
  children: "?"
285
- }), /* @__PURE__ */ l("span", {
255
+ }), /* @__PURE__ */ h("span", {
286
256
  className: "reinspect-tooltip-content",
287
257
  role: "tooltip",
288
- children: P
258
+ children: k
289
259
  })]
290
260
  })]
291
261
  }),
292
- /* @__PURE__ */ u("label", {
262
+ /* @__PURE__ */ g("label", {
293
263
  className: "reinspect-settings-select-row",
294
- children: [/* @__PURE__ */ l("span", {
264
+ children: [/* @__PURE__ */ h("span", {
295
265
  className: "reinspect-settings-toggle-label",
296
266
  children: "Inspect Mode"
297
- }), /* @__PURE__ */ u("select", {
267
+ }), /* @__PURE__ */ g("select", {
298
268
  "data-testid": "reinspect-setting-inspect-mode",
299
- value: a,
269
+ value: o,
300
270
  onChange: (e) => {
301
271
  let t = e.currentTarget.value;
302
- E(t) && c(t);
272
+ a(t) && s(t);
303
273
  },
304
274
  children: [
305
- /* @__PURE__ */ l("option", {
275
+ /* @__PURE__ */ h("option", {
306
276
  value: "wrapped",
307
277
  children: "Only wrapped components"
308
278
  }),
309
- /* @__PURE__ */ l("option", {
279
+ /* @__PURE__ */ h("option", {
310
280
  value: "first-party",
311
281
  children: "All 1st-party components"
312
282
  }),
313
- /* @__PURE__ */ l("option", {
283
+ /* @__PURE__ */ h("option", {
314
284
  value: "all",
315
285
  children: "All components"
316
286
  })
317
287
  ]
318
288
  })]
319
289
  }),
320
- /* @__PURE__ */ l("button", {
290
+ /* @__PURE__ */ h("button", {
321
291
  type: "button",
322
292
  className: "reinspect-apply-button",
323
293
  "data-testid": "reinspect-apply-inspect-mode",
324
- onClick: f,
325
- disabled: !d,
294
+ onClick: l,
295
+ disabled: !c,
326
296
  children: "Apply & Reload"
327
297
  }),
328
- d ? /* @__PURE__ */ l("p", {
298
+ c ? /* @__PURE__ */ h("p", {
329
299
  className: "reinspect-setting-note",
330
300
  "data-testid": "reinspect-inspect-mode-reload-note",
331
301
  children: "Inspect mode changes are applied after reload."
332
- }) : /* @__PURE__ */ u("p", {
302
+ }) : /* @__PURE__ */ g("p", {
333
303
  className: "reinspect-setting-note",
334
304
  children: ["Current mode: ", i]
335
305
  })
336
306
  ]
337
307
  }),
338
- /* @__PURE__ */ l("div", { className: "reinspect-settings-divider" }),
339
- /* @__PURE__ */ u("section", {
308
+ /* @__PURE__ */ h("div", { className: "reinspect-settings-divider" }),
309
+ /* @__PURE__ */ g("section", {
340
310
  className: "reinspect-setting-block",
341
- children: [
342
- /* @__PURE__ */ u("header", {
343
- className: "reinspect-setting-header",
344
- children: [/* @__PURE__ */ u("div", { children: [/* @__PURE__ */ l("p", {
345
- className: "reinspect-setting-name",
346
- children: "SHOULD_COUNT_RENDERS"
347
- }), /* @__PURE__ */ l("p", {
348
- className: "reinspect-setting-short-description",
349
- children: N
350
- })] }), /* @__PURE__ */ u("span", {
351
- className: "reinspect-tooltip-host",
352
- children: [/* @__PURE__ */ l("button", {
353
- type: "button",
354
- className: "reinspect-tooltip-trigger",
355
- "aria-label": "Explain SHOULD_COUNT_RENDERS",
356
- children: "?"
357
- }), /* @__PURE__ */ l("span", {
358
- className: "reinspect-tooltip-content",
359
- role: "tooltip",
360
- children: oe
361
- })]
362
- })]
363
- }),
364
- /* @__PURE__ */ u("label", {
365
- className: "reinspect-settings-toggle-row",
366
- children: [/* @__PURE__ */ l("span", {
367
- className: "reinspect-settings-toggle-label",
368
- children: "Capture render for all components"
369
- }), /* @__PURE__ */ l("input", {
370
- "data-testid": "reinspect-setting-should-count-renders",
371
- type: "checkbox",
372
- checked: p,
373
- onChange: (e) => m(e.currentTarget.checked)
374
- })]
375
- }),
376
- /* @__PURE__ */ u("header", {
377
- className: "reinspect-setting-header",
378
- children: [/* @__PURE__ */ u("div", { children: [/* @__PURE__ */ l("p", {
379
- className: "reinspect-setting-name",
380
- children: "RENDER_CAPTURE_MODE"
381
- }), /* @__PURE__ */ l("p", {
382
- className: "reinspect-setting-short-description",
383
- children: se
384
- })] }), /* @__PURE__ */ u("span", {
385
- className: "reinspect-tooltip-host",
386
- children: [/* @__PURE__ */ l("button", {
387
- type: "button",
388
- className: "reinspect-tooltip-trigger",
389
- "aria-label": "Explain RENDER_CAPTURE_MODE",
390
- children: "?"
391
- }), /* @__PURE__ */ l("span", {
392
- className: "reinspect-tooltip-content",
393
- role: "tooltip",
394
- children: ce
395
- })]
396
- })]
397
- }),
398
- /* @__PURE__ */ u("label", {
399
- className: "reinspect-settings-select-row",
400
- children: [/* @__PURE__ */ l("span", {
401
- className: "reinspect-settings-toggle-label",
402
- children: "Capture mode"
403
- }), /* @__PURE__ */ u("select", {
404
- "data-testid": "reinspect-setting-render-capture-mode",
405
- value: h,
406
- onChange: (e) => {
407
- let t = e.currentTarget.value;
408
- D(t) && g(t);
409
- },
410
- children: [
411
- /* @__PURE__ */ l("option", {
412
- value: "attempts",
413
- children: "Render attempts"
414
- }),
415
- /* @__PURE__ */ l("option", {
416
- value: "commits",
417
- children: "Committed renders"
418
- }),
419
- /* @__PURE__ */ l("option", {
420
- value: "both",
421
- children: "Both"
422
- })
423
- ]
311
+ children: [/* @__PURE__ */ g("header", {
312
+ className: "reinspect-setting-header",
313
+ children: [/* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("p", {
314
+ className: "reinspect-setting-name",
315
+ children: "RENDER_COUNTERS"
316
+ }), /* @__PURE__ */ h("p", {
317
+ className: "reinspect-setting-short-description",
318
+ children: E
319
+ })] }), /* @__PURE__ */ g("span", {
320
+ className: "reinspect-tooltip-host",
321
+ children: [/* @__PURE__ */ h("button", {
322
+ type: "button",
323
+ className: "reinspect-tooltip-trigger",
324
+ "aria-label": "Explain RENDER_COUNTERS",
325
+ children: "?"
326
+ }), /* @__PURE__ */ h("span", {
327
+ className: "reinspect-tooltip-content",
328
+ role: "tooltip",
329
+ children: D
424
330
  })]
425
- })
426
- ]
331
+ })]
332
+ }), /* @__PURE__ */ g("label", {
333
+ className: "reinspect-settings-select-row",
334
+ children: [/* @__PURE__ */ h("span", {
335
+ className: "reinspect-settings-toggle-label",
336
+ children: "Counter mode"
337
+ }), /* @__PURE__ */ g("select", {
338
+ "data-testid": "reinspect-setting-render-counters",
339
+ value: d,
340
+ onChange: (e) => {
341
+ let t = e.currentTarget.value;
342
+ n(t) && f(t);
343
+ },
344
+ children: [
345
+ /* @__PURE__ */ h("option", {
346
+ value: "off",
347
+ children: "Off"
348
+ }),
349
+ /* @__PURE__ */ h("option", {
350
+ value: "attempts",
351
+ children: "Render attempts"
352
+ }),
353
+ /* @__PURE__ */ h("option", {
354
+ value: "commits",
355
+ children: "Committed renders"
356
+ }),
357
+ /* @__PURE__ */ h("option", {
358
+ value: "both",
359
+ children: "Both"
360
+ })
361
+ ]
362
+ })]
363
+ })]
427
364
  })
428
365
  ]
429
366
  }) : null]
430
367
  }) : null;
431
368
  }
432
369
  //#endregion
433
- //#region src/reinspect/propsInspector.ts
434
- var R = 4, z = 40, B = 40, V = "__reinspect_placeholder__";
435
- function H(e, t) {
436
- return {
437
- [V]: e,
438
- display: t
439
- };
440
- }
441
- function U(e) {
442
- return typeof e == "object" && !!e && !Array.isArray(e);
443
- }
444
- function ue(e) {
445
- if (!U(e)) return !1;
446
- let t = Object.getPrototypeOf(e);
447
- return t === Object.prototype || t === null;
448
- }
449
- function de(e) {
450
- return U(e) && typeof e.__reinspect_placeholder__ == "string" && typeof e.display == "string";
451
- }
452
- function fe(e) {
453
- try {
454
- return JSON.stringify(e, null, 2);
455
- } catch {
456
- return null;
457
- }
458
- }
459
- function W(e) {
460
- try {
461
- let t = Function.prototype.toString.call(e);
462
- return typeof t != "string" || t.trim().length === 0 ? "[Function source unavailable]" : t;
463
- } catch {
464
- return "[Function source unavailable]";
465
- }
466
- }
467
- function pe(e) {
468
- let t = e.replace(/\s+/g, " ").trim();
469
- return t.length <= 120 ? t : `${t.slice(0, 117)}...`;
470
- }
471
- function G(e, t, n) {
472
- if (n > R) return H("truncated", "[Max depth reached]");
473
- if (e === null) return null;
474
- let r = typeof e;
475
- if (r === "string" || r === "boolean") return e;
476
- if (r === "number") return Number.isFinite(e) ? e : H("non-finite-number", String(e));
477
- if (r === "undefined") return H("undefined", "undefined");
478
- if (r === "bigint") return H("bigint", `${String(e)}n`);
479
- if (r === "symbol") return H("symbol", String(e));
480
- if (r === "function") return H("function", `[Function ${e.name || "anonymous"}]`);
481
- if (e instanceof Date) return H("date", Number.isNaN(e.getTime()) ? "Invalid Date" : e.toISOString());
482
- if (e instanceof RegExp) return H("regexp", e.toString());
483
- if (r === "object") {
484
- let r = e;
485
- if (t.has(r)) return H("circular", "[Circular]");
486
- if (t.add(r), Array.isArray(e)) {
487
- let i = [], a = Math.min(e.length, B);
488
- for (let r = 0; r < a; r += 1) i.push(G(e[r], t, n + 1));
489
- return e.length > B && i.push(H("truncated", `${e.length - B} more items`)), t.delete(r), i;
490
- }
491
- let i = {}, a = Object.entries(e), o = Math.min(a.length, z);
492
- for (let e = 0; e < o; e += 1) {
493
- let [r, o] = a[e];
494
- i[r] = G(o, t, n + 1);
495
- }
496
- return a.length > z && (i.__reinspect_truncated__ = H("truncated", `${a.length - z} more keys`)), t.delete(r), i;
497
- }
498
- return H("unsupported", "[Unsupported value]");
499
- }
500
- function K(e) {
501
- if (e === null) return {
502
- kind: "null",
503
- summary: "null",
504
- copyText: "null"
505
- };
506
- let t = typeof e;
507
- if (t === "undefined") return {
508
- kind: "undefined",
509
- summary: "undefined",
510
- copyText: "undefined"
511
- };
512
- if (t === "boolean") return {
513
- kind: "boolean",
514
- summary: String(e),
515
- copyText: String(e)
516
- };
517
- if (t === "number") return {
518
- kind: "number",
519
- summary: String(e),
520
- copyText: String(e)
521
- };
522
- if (t === "string") return {
523
- kind: "string",
524
- summary: JSON.stringify(e),
525
- copyText: String(e)
526
- };
527
- if (t === "bigint") return {
528
- kind: "bigint",
529
- summary: `${String(e)}n`,
530
- copyText: `${String(e)}n`
531
- };
532
- if (t === "symbol") {
533
- let t = String(e);
534
- return {
535
- kind: "symbol",
536
- summary: t,
537
- copyText: t
538
- };
539
- }
540
- if (t === "function") {
541
- let t = e, n = W(t), r = t.name || "anonymous";
542
- return {
543
- kind: "function",
544
- summary: `Function ${r}(${t.length})`,
545
- copyText: n,
546
- functionMeta: {
547
- name: r,
548
- arity: t.length,
549
- preview: pe(n),
550
- source: n
551
- }
552
- };
553
- }
554
- if (e instanceof Date) {
555
- let t = Number.isNaN(e.getTime()) ? "Invalid Date" : e.toISOString();
556
- return {
557
- kind: "date",
558
- summary: `Date ${t}`,
559
- copyText: t
560
- };
561
- }
562
- if (e instanceof RegExp) {
563
- let t = e.toString();
564
- return {
565
- kind: "regexp",
566
- summary: t,
567
- copyText: t
568
- };
569
- }
570
- return Array.isArray(e) ? {
571
- kind: "array",
572
- summary: `Array(${e.length})`
573
- } : U(e) ? {
574
- kind: "object",
575
- summary: `Object(${Object.keys(e).length})`
576
- } : {
577
- kind: "unknown",
578
- summary: String(e)
579
- };
580
- }
581
- function q(e) {
582
- if (!de(e)) {
583
- if (Array.isArray(e)) {
584
- let t = [];
585
- for (let n of e) {
586
- let e = q(n);
587
- if (e === void 0) return;
588
- t.push(e);
589
- }
590
- return t;
591
- }
592
- if (U(e)) {
593
- let t = {};
594
- for (let [n, r] of Object.entries(e)) {
595
- let e = q(r);
596
- e !== void 0 && (t[n] = e);
597
- }
598
- return t;
599
- }
600
- return e;
601
- }
602
- }
603
- function me(e) {
604
- return Object.keys(e).map((t) => ({
605
- key: t,
606
- value: K(e[t])
607
- }));
608
- }
609
- function he(e) {
610
- return fe(G(e, /* @__PURE__ */ new WeakSet(), 0)) ?? "{}";
611
- }
612
- function ge(e) {
613
- return fe(G(e, /* @__PURE__ */ new WeakSet(), 0));
614
- }
615
- function _e(e) {
616
- if (e === null) return !0;
617
- let t = typeof e;
618
- return t === "string" || t === "number" || t === "boolean" || Array.isArray(e) ? !0 : ue(e);
619
- }
620
- function ve(e) {
621
- let t = e.trim();
622
- if (t.length === 0) return {
623
- parsed: null,
624
- error: "Value JSON cannot be empty."
625
- };
626
- try {
627
- let e = q(JSON.parse(t));
628
- return e === void 0 || !_e(e) ? {
629
- parsed: null,
630
- error: "Only objects, arrays, and primitive JSON values are editable."
631
- } : {
632
- parsed: e,
633
- error: null
634
- };
635
- } catch {
636
- return {
637
- parsed: null,
638
- error: "Invalid JSON. Fix syntax and try Apply again."
639
- };
640
- }
641
- }
642
- function ye(e) {
643
- let t = e.trim();
644
- if (t.length === 0) return {
645
- parsed: {},
646
- error: null
647
- };
648
- try {
649
- let e = JSON.parse(t);
650
- if (typeof e != "object" || !e || Array.isArray(e)) return {
651
- parsed: null,
652
- error: "Props JSON must be an object (example: {\"title\":\"Demo\"})."
653
- };
654
- let n = {};
655
- for (let [t, r] of Object.entries(e)) {
656
- let e = q(r);
657
- e !== void 0 && (n[t] = e);
658
- }
659
- return {
660
- parsed: n,
661
- error: null
662
- };
663
- } catch {
664
- return {
665
- parsed: null,
666
- error: "Invalid JSON. Fix syntax and try Apply again."
667
- };
668
- }
669
- }
670
- //#endregion
671
- //#region src/reinspect/wrapMarker.ts
672
- var be = Symbol.for("reinspect.wrapped");
673
- function xe(e) {
674
- return e[be];
675
- }
676
- //#endregion
677
370
  //#region src/reinspect/withReinspect.tsx
678
- var Se = {
679
- enabled: !1,
680
- startActive: !1,
681
- showFloatingToggle: !1,
682
- inspectMode: "wrapped",
683
- editableProps: [],
684
- palette: [],
685
- zIndexBase: 0,
686
- shouldCountRenders: !1,
687
- countRendersForComponents: [],
688
- renderCaptureMode: "attempts"
689
- }, Ce = /* @__PURE__ */ new Map();
690
- function J(e) {
691
- let t = Ce.get(e);
692
- if (t) return t;
371
+ function M(e, t) {
693
372
  let n = {
694
- attempts: 0,
695
- commits: 0,
696
- hasCommitted: !1,
697
- wasCountingEnabled: !1,
698
- shouldCountCommit: !1
699
- };
700
- return Ce.set(e, n), n;
701
- }
702
- function we(e, t) {
703
- let n = J(e);
704
- if (!t) return n.wasCountingEnabled = !1, n.shouldCountCommit = !1, {
705
- attempts: n.attempts,
706
- commits: n.commits
707
- };
708
- let r = n.hasCommitted && n.wasCountingEnabled;
709
- return r && (n.attempts += 1), n.wasCountingEnabled = !0, n.shouldCountCommit = r, {
710
- attempts: n.attempts,
711
- commits: n.commits + +!!r
373
+ source: "manual",
374
+ scope: "first-party"
712
375
  };
713
- }
714
- function Te(e) {
715
- let t = J(e);
716
- t.hasCommitted && t.shouldCountCommit && (t.commits += 1), t.hasCommitted = !0, t.shouldCountCommit = !1;
717
- }
718
- function Ee(e, t) {
719
- return t === "commits" ? `${e.commits} commits` : t === "both" ? `${e.attempts} attempts | ${e.commits} commits` : `${e.attempts} attempts`;
720
- }
721
- function De(e) {
722
- let t = e.replace(/([A-Z])/g, " $1").trim();
723
- return t.length > 0 ? t[0].toUpperCase() + t.slice(1) : e;
724
- }
725
- function Oe(e) {
726
- return e.trim().toLowerCase().replace(/[\s_-]+/g, "");
727
- }
728
- function Y(e) {
729
- return e != null && e !== "";
730
- }
731
- function ke(e) {
732
- return e.replace(/[^a-zA-Z0-9_-]/g, "-");
733
- }
734
- async function Ae(e) {
735
- if (typeof navigator > "u" || !navigator.clipboard?.writeText) return !1;
736
- try {
737
- return await navigator.clipboard.writeText(e), !0;
738
- } catch {
739
- return !1;
740
- }
741
- }
742
- function je({ value: e, onCopy: t }) {
743
- if (e.kind === "function" && e.functionMeta) {
744
- let n = e.functionMeta;
745
- return /* @__PURE__ */ u("div", {
746
- className: "reinspect-prop-function",
747
- children: [
748
- /* @__PURE__ */ l("code", { children: e.summary }),
749
- /* @__PURE__ */ l("pre", { children: n.preview }),
750
- /* @__PURE__ */ l("button", {
751
- type: "button",
752
- onClick: () => t(n.source, "Function source"),
753
- disabled: !n.source,
754
- children: "Copy function source"
755
- })
756
- ]
757
- });
758
- }
759
- return /* @__PURE__ */ u("div", {
760
- className: "reinspect-prop-scalar",
761
- children: [/* @__PURE__ */ l("code", { children: e.summary }), e.copyText ? /* @__PURE__ */ l("button", {
762
- type: "button",
763
- onClick: () => t(e.copyText ?? "", "Value"),
764
- children: "Copy"
765
- }) : null]
766
- });
767
- }
768
- function Me(e, t) {
769
- return t?.name?.trim() || e.displayName?.trim() || e.name?.trim() || t?.fallbackName?.trim() || "Component";
770
- }
771
- function Ne(e, t, n) {
772
- return e === "manual" || n === "all" || n === "first-party" && t === "first-party";
773
- }
774
- function X(e, t) {
775
- let a = t?.source ?? "manual", f = t?.scope ?? "first-party", p = xe(e);
776
- if (p && a === "auto") return e;
777
- let m = p && a === "manual" ? p.original : e, h = Me(m, t);
778
- function _(e) {
779
- let t = i(), p = o(null), _ = o(null), [v, y] = s(null), [x, S] = s("css"), [C, w] = s("detected"), [T, E] = s(""), [D, O] = s({}), [te, k] = s("{}"), [ne, A] = s(null), [j, M] = s(null), [N, oe] = s({}), [se, ce] = s({}), [le, P] = s({}), [F, I] = s(null), [L, R] = s(""), [z, B] = s(null), V = n(g), H = !!V, U = V?.config ?? Se, ue = V?.getBorderColor ?? (() => "#f97316"), de = V?.isActive ?? !1, fe = V?.inspectMode ?? "wrapped", W = V?.shouldCountRenders ?? !1, pe = V?.renderCaptureMode ?? Se.renderCaptureMode, G = V?.overrides ?? {}, K = V?.updateOverride ?? (() => void 0), q = V?.renderCountComponents ?? {}, be = V?.setRenderCountingForComponent ?? (() => void 0), xe = V?.isRenderCountingEnabledFor ?? (() => !1), J = `${h}-${t}`, Me = ue(h), X = Ne(a, f, fe), Z = U.enabled && de && X, Pe = X && xe(h), Fe = !!q[h], Ie = we(J, Pe), Le = G[J], Re = Z ? re(Le, U.editableProps) : {}, Q = {
780
- ...e,
781
- ...D
782
- }, ze = Q, $ = Z && v !== null, Be = Oe(T), Ve = Be.length === 0 ? U.editableProps : U.editableProps.filter((e) => Oe(e).includes(Be)), He = $ && x === "props" && C === "detected" ? me(ze) : [];
783
- r(() => (Te(J), () => {
784
- Ce.delete(J);
785
- }), [J]), r(() => {
786
- if (!$) return;
787
- let e = (e) => {
788
- let t = e.target;
789
- p.current?.contains(t) || _.current?.contains(t) || (y(null), I(null), R(""), B(null));
790
- }, t = (e) => {
791
- if (e.key === "Escape") {
792
- if (F) {
793
- I(null), R(""), B(null);
794
- return;
795
- }
796
- y(null);
797
- }
798
- };
799
- return document.addEventListener("mousedown", e), document.addEventListener("keydown", t), () => {
800
- document.removeEventListener("mousedown", e), document.removeEventListener("keydown", t);
801
- };
802
- }, [F, $]), r(() => {
803
- if (!j) return;
804
- let e = globalThis.setTimeout(() => {
805
- M(null);
806
- }, 1400);
807
- return () => {
808
- globalThis.clearTimeout(e);
809
- };
810
- }, [j]);
811
- let Ue = {
812
- "--reinspect-color": Me,
813
- "--reinspect-z-base": U.zIndexBase
814
- }, We = (e) => {
815
- Z && (e.preventDefault(), S("css"), w("detected"), E(""), A(null), M(null), oe({}), ce({}), P({}), I(null), R(""), B(null), k("{}"), y({
816
- x: e.clientX,
817
- y: e.clientY
818
- }));
819
- }, Ge = () => {
820
- let { parsed: e, error: t } = ye(te);
821
- if (t || !e) {
822
- A(t);
823
- return;
824
- }
825
- O(e), A(null);
826
- }, Ke = () => {
827
- O({}), C === "raw" && k(he(e)), A(null);
828
- }, qe = (e, t) => {
829
- Ae(e).then((e) => {
830
- M(e ? `${t} copied.` : "Clipboard access is unavailable.");
831
- });
832
- }, Je = (e, t) => {
833
- if (le[e]) {
834
- P((t) => ({
835
- ...t,
836
- [e]: !1
837
- }));
838
- return;
839
- }
840
- if (!(e in N) && !(e in se)) {
841
- let n = ge(t);
842
- n === null ? ce((t) => ({
843
- ...t,
844
- [e]: "JSON preview is unavailable for this value."
845
- })) : oe((t) => ({
846
- ...t,
847
- [e]: n
848
- }));
849
- }
850
- P((t) => ({
851
- ...t,
852
- [e]: !0
853
- }));
854
- }, Ye = (e, t) => {
855
- if (!_e(t)) return;
856
- let n = ge(t);
857
- if (n === null) {
858
- M("Unable to open editor for this value.");
859
- return;
860
- }
861
- I(e), R(n), B(null);
862
- }, Xe = () => {
863
- if (!F) return;
864
- let { parsed: e, error: t } = ve(L);
865
- if (t || e === null) {
866
- B(t);
867
- return;
868
- }
869
- O((t) => ({
870
- ...t,
871
- [F]: e
872
- })), I(null), R(""), B(null);
873
- }, Ze = $ ? /* @__PURE__ */ u("div", {
874
- ref: p,
875
- className: "reinspect-menu",
876
- role: "dialog",
877
- "aria-label": `${h} inspector controls`,
878
- style: {
879
- top: `${v.y}px`,
880
- left: `${v.x}px`
881
- },
882
- children: [
883
- /* @__PURE__ */ u("p", {
884
- className: "reinspect-menu-title",
885
- children: [h, " inspector"]
886
- }),
887
- /* @__PURE__ */ u("label", {
888
- className: "reinspect-menu-component-setting",
889
- children: [/* @__PURE__ */ l("span", { children: "Capture renders for this component" }), /* @__PURE__ */ l("input", {
890
- type: "checkbox",
891
- checked: W ? !0 : Fe,
892
- onChange: (e) => be(h, e.currentTarget.checked),
893
- disabled: W,
894
- "aria-label": `Capture renders for ${h}`,
895
- "data-testid": `reinspect-component-render-toggle-${h}`
896
- })]
897
- }),
898
- W ? /* @__PURE__ */ l("p", {
899
- className: "reinspect-setting-note",
900
- children: "Global capture is enabled from Reinspect settings."
901
- }) : null,
902
- /* @__PURE__ */ u("div", {
903
- className: "reinspect-submenu",
904
- children: [/* @__PURE__ */ l("button", {
905
- type: "button",
906
- "data-state": x === "css" ? "active" : "idle",
907
- onClick: () => S("css"),
908
- children: "CSS"
909
- }), /* @__PURE__ */ l("button", {
910
- type: "button",
911
- "data-state": x === "props" ? "active" : "idle",
912
- onClick: () => S("props"),
913
- children: "Props"
914
- })]
915
- }),
916
- x === "css" ? /* @__PURE__ */ u(c, { children: [
917
- /* @__PURE__ */ u("div", {
918
- className: "reinspect-menu-filter",
919
- children: [/* @__PURE__ */ l("span", {
920
- className: "reinspect-menu-filter-icon",
921
- "aria-hidden": "true",
922
- children: /* @__PURE__ */ l("svg", {
923
- viewBox: "0 0 24 24",
924
- focusable: "false",
925
- children: /* @__PURE__ */ l("path", {
926
- d: "M10.5 3a7.5 7.5 0 015.92 12.1l4.24 4.23a1 1 0 01-1.42 1.42l-4.23-4.24A7.5 7.5 0 1110.5 3zm0 2a5.5 5.5 0 100 11 5.5 5.5 0 000-11z",
927
- fill: "currentColor"
928
- })
929
- })
930
- }), /* @__PURE__ */ l("input", {
931
- id: `${J}-css-filter`,
932
- "data-testid": "reinspect-css-filter-input",
933
- type: "search",
934
- value: T,
935
- placeholder: "Filter",
936
- "aria-label": "Filter CSS properties",
937
- onChange: (e) => E(e.currentTarget.value)
938
- })]
939
- }),
940
- /* @__PURE__ */ l("div", {
941
- className: "reinspect-menu-grid",
942
- children: Ve.map((e) => {
943
- let t = Le?.[e], n = `${J}-${e}`;
944
- if (b.has(e)) {
945
- let r = typeof t == "string" ? ie(t) : "#1f2937";
946
- return /* @__PURE__ */ u("div", {
947
- className: "reinspect-field",
948
- children: [/* @__PURE__ */ l("label", {
949
- htmlFor: n,
950
- children: De(e)
951
- }), /* @__PURE__ */ u("div", {
952
- className: "reinspect-inline-controls",
953
- children: [/* @__PURE__ */ l("input", {
954
- id: n,
955
- type: "color",
956
- value: r,
957
- onChange: (t) => K(J, e, t.currentTarget.value)
958
- }), /* @__PURE__ */ l("button", {
959
- type: "button",
960
- onClick: () => K(J, e, void 0),
961
- disabled: !Y(t),
962
- children: "reset"
963
- })]
964
- })]
965
- }, e);
966
- }
967
- if (e === "opacity") {
968
- let r = typeof t == "number" ? t : 1;
969
- return /* @__PURE__ */ u("div", {
970
- className: "reinspect-field",
971
- children: [/* @__PURE__ */ l("label", {
972
- htmlFor: n,
973
- children: "Opacity"
974
- }), /* @__PURE__ */ u("div", {
975
- className: "reinspect-inline-controls reinspect-opacity-controls",
976
- children: [
977
- /* @__PURE__ */ l("input", {
978
- id: n,
979
- type: "range",
980
- min: "0",
981
- max: "1",
982
- step: "0.05",
983
- value: r,
984
- onChange: (t) => {
985
- let n = ae(t.currentTarget.value);
986
- n !== void 0 && K(J, e, n);
987
- }
988
- }),
989
- /* @__PURE__ */ l("output", { children: r.toFixed(2) }),
990
- /* @__PURE__ */ l("button", {
991
- type: "button",
992
- onClick: () => K(J, e, void 0),
993
- disabled: !Y(t),
994
- children: "reset"
995
- })
996
- ]
997
- })]
998
- }, e);
999
- }
1000
- if (ee.has(e)) {
1001
- let r = typeof t == "number" ? t : "";
1002
- return /* @__PURE__ */ u("div", {
1003
- className: "reinspect-field",
1004
- children: [/* @__PURE__ */ u("label", {
1005
- htmlFor: n,
1006
- children: [De(e), " (px)"]
1007
- }), /* @__PURE__ */ u("div", {
1008
- className: "reinspect-inline-controls",
1009
- children: [/* @__PURE__ */ l("input", {
1010
- id: n,
1011
- type: "number",
1012
- step: "1",
1013
- value: r,
1014
- onChange: (t) => {
1015
- if (t.currentTarget.value === "") {
1016
- K(J, e, void 0);
1017
- return;
1018
- }
1019
- let n = ae(t.currentTarget.value);
1020
- n !== void 0 && K(J, e, n);
1021
- }
1022
- }), /* @__PURE__ */ l("button", {
1023
- type: "button",
1024
- onClick: () => K(J, e, void 0),
1025
- disabled: !Y(t),
1026
- children: "reset"
1027
- })]
1028
- })]
1029
- }, e);
1030
- }
1031
- return /* @__PURE__ */ u("div", {
1032
- className: "reinspect-field",
1033
- children: [/* @__PURE__ */ l("label", {
1034
- htmlFor: n,
1035
- children: De(e)
1036
- }), /* @__PURE__ */ u("div", {
1037
- className: "reinspect-inline-controls",
1038
- children: [/* @__PURE__ */ l("input", {
1039
- id: n,
1040
- type: "text",
1041
- value: typeof t == "string" ? t : "",
1042
- onChange: (t) => K(J, e, t.currentTarget.value || void 0)
1043
- }), /* @__PURE__ */ l("button", {
1044
- type: "button",
1045
- onClick: () => K(J, e, void 0),
1046
- disabled: !Y(t),
1047
- children: "reset"
1048
- })]
1049
- })]
1050
- }, e);
1051
- })
1052
- }),
1053
- Ve.length === 0 ? /* @__PURE__ */ u("p", {
1054
- className: "reinspect-menu-empty-state",
1055
- children: [
1056
- "No CSS properties match \"",
1057
- T.trim(),
1058
- "\"."
1059
- ]
1060
- }) : null
1061
- ] }) : /* @__PURE__ */ u("div", {
1062
- className: "reinspect-props-panel",
1063
- children: [
1064
- /* @__PURE__ */ u("div", {
1065
- className: "reinspect-props-submenu",
1066
- children: [/* @__PURE__ */ l("button", {
1067
- type: "button",
1068
- "data-state": C === "detected" ? "active" : "idle",
1069
- onClick: () => w("detected"),
1070
- children: "Detected"
1071
- }), /* @__PURE__ */ l("button", {
1072
- type: "button",
1073
- "data-state": C === "raw" ? "active" : "idle",
1074
- onClick: () => {
1075
- w("raw"), A(null), k(he(ze));
1076
- },
1077
- children: "Raw"
1078
- })]
1079
- }),
1080
- C === "detected" ? He.length > 0 ? /* @__PURE__ */ u("div", {
1081
- className: "reinspect-props-table",
1082
- children: [/* @__PURE__ */ u("div", {
1083
- className: "reinspect-props-header",
1084
- children: [/* @__PURE__ */ l("span", { children: "Key" }), /* @__PURE__ */ l("span", { children: "Value" })]
1085
- }), He.map((e) => {
1086
- let t = ke(e.key), n = ze[e.key], r = e.value.kind === "object" || e.value.kind === "array", i = !!le[e.key], a = N[e.key], o = se[e.key], s = _e(n);
1087
- return /* @__PURE__ */ u("div", {
1088
- className: "reinspect-props-row",
1089
- "data-testid": `reinspect-prop-row-${t}`,
1090
- children: [/* @__PURE__ */ l("code", {
1091
- className: "reinspect-prop-key",
1092
- children: e.key
1093
- }), /* @__PURE__ */ u("div", {
1094
- className: "reinspect-prop-cell",
1095
- "data-testid": `reinspect-prop-value-${t}`,
1096
- children: [
1097
- je({
1098
- value: e.value,
1099
- onCopy: qe
1100
- }),
1101
- r || s ? /* @__PURE__ */ u("div", {
1102
- className: "reinspect-prop-actions",
1103
- children: [r ? /* @__PURE__ */ l("button", {
1104
- type: "button",
1105
- "data-testid": `reinspect-prop-show-json-${t}`,
1106
- onClick: () => Je(e.key, n),
1107
- children: i ? "Hide JSON" : "Show JSON"
1108
- }) : null, s ? /* @__PURE__ */ l("button", {
1109
- type: "button",
1110
- "data-testid": `reinspect-prop-edit-${t}`,
1111
- onClick: () => Ye(e.key, n),
1112
- children: "Edit"
1113
- }) : null]
1114
- }) : null,
1115
- i ? /* @__PURE__ */ l("div", {
1116
- className: "reinspect-prop-json-preview",
1117
- "data-testid": `reinspect-prop-json-preview-${t}`,
1118
- children: o ? /* @__PURE__ */ l("p", {
1119
- className: "reinspect-error",
1120
- children: o
1121
- }) : /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("pre", { children: a }), a ? /* @__PURE__ */ l("button", {
1122
- type: "button",
1123
- "data-testid": `reinspect-prop-copy-json-${t}`,
1124
- onClick: () => qe(a, "JSON value"),
1125
- children: "Copy JSON"
1126
- }) : null] })
1127
- }) : null
1128
- ]
1129
- })]
1130
- }, e.key);
1131
- })]
1132
- }) : /* @__PURE__ */ l("p", {
1133
- className: "reinspect-menu-empty-state",
1134
- children: "No props detected."
1135
- }) : /* @__PURE__ */ u(c, { children: [
1136
- /* @__PURE__ */ l("label", {
1137
- htmlFor: `${J}-props-json`,
1138
- children: "Props JSON"
1139
- }),
1140
- /* @__PURE__ */ l("textarea", {
1141
- id: `${J}-props-json`,
1142
- value: te,
1143
- onChange: (e) => {
1144
- k(e.currentTarget.value), A(null);
1145
- },
1146
- rows: 9
1147
- }),
1148
- ne ? /* @__PURE__ */ l("p", {
1149
- className: "reinspect-error",
1150
- children: ne
1151
- }) : null,
1152
- /* @__PURE__ */ u("div", {
1153
- className: "reinspect-inline-controls",
1154
- children: [/* @__PURE__ */ l("button", {
1155
- type: "button",
1156
- onClick: Ge,
1157
- children: "apply"
1158
- }), /* @__PURE__ */ l("button", {
1159
- type: "button",
1160
- onClick: Ke,
1161
- children: "reset"
1162
- })]
1163
- })
1164
- ] }),
1165
- j ? /* @__PURE__ */ l("p", {
1166
- className: "reinspect-setting-note",
1167
- "data-testid": "reinspect-props-copy-status",
1168
- children: j
1169
- }) : null
1170
- ]
1171
- })
1172
- ]
1173
- }) : null, Qe = F ? d(/* @__PURE__ */ l("div", {
1174
- className: "reinspect-modal-backdrop",
1175
- role: "dialog",
1176
- "aria-modal": "true",
1177
- "aria-label": `Edit ${F} prop`,
1178
- "data-testid": "reinspect-prop-edit-modal",
1179
- children: /* @__PURE__ */ u("div", {
1180
- className: "reinspect-modal",
1181
- ref: _,
1182
- children: [
1183
- /* @__PURE__ */ u("p", {
1184
- className: "reinspect-menu-title",
1185
- children: ["Edit prop: ", F]
1186
- }),
1187
- /* @__PURE__ */ l("label", {
1188
- htmlFor: `${J}-prop-edit-json`,
1189
- children: "JSON value"
1190
- }),
1191
- /* @__PURE__ */ l("textarea", {
1192
- id: `${J}-prop-edit-json`,
1193
- "data-testid": "reinspect-prop-edit-textarea",
1194
- value: L,
1195
- onChange: (e) => {
1196
- R(e.currentTarget.value), B(null);
1197
- },
1198
- rows: 10
1199
- }),
1200
- z ? /* @__PURE__ */ l("p", {
1201
- className: "reinspect-error",
1202
- "data-testid": "reinspect-prop-edit-error",
1203
- children: z
1204
- }) : null,
1205
- /* @__PURE__ */ u("div", {
1206
- className: "reinspect-inline-controls",
1207
- children: [/* @__PURE__ */ l("button", {
1208
- type: "button",
1209
- onClick: Xe,
1210
- children: "apply"
1211
- }), /* @__PURE__ */ l("button", {
1212
- type: "button",
1213
- onClick: () => {
1214
- I(null), R(""), B(null);
1215
- },
1216
- children: "cancel"
1217
- })]
1218
- })
1219
- ]
1220
- })
1221
- }), document.body) : null;
1222
- if (!H) {
1223
- if (a === "manual") throw Error("useReinspect must be used within ReinspectProvider");
1224
- return /* @__PURE__ */ l(m, { ...Q });
1225
- }
1226
- return a === "auto" && !X ? /* @__PURE__ */ l(m, { ...Q }) : /* @__PURE__ */ u("div", {
1227
- className: "reinspect-shell",
1228
- "data-reinspect-component": h,
1229
- "data-reinspect-active": Z,
1230
- "data-testid": `reinspect-shell-${h}`,
1231
- style: Ue,
1232
- onContextMenu: We,
1233
- children: [
1234
- Z ? /* @__PURE__ */ u("span", {
1235
- className: "reinspect-name-badge",
1236
- children: [h, Pe ? ` | ${Ee(Ie, pe)}` : ""]
1237
- }) : null,
1238
- Ze ? d(Ze, document.body) : null,
1239
- Qe,
1240
- /* @__PURE__ */ l("div", {
1241
- className: "reinspect-content",
1242
- "data-reinspect-content": "true",
1243
- style: Re,
1244
- children: /* @__PURE__ */ l(m, { ...Q })
1245
- })
1246
- ]
1247
- });
1248
- }
1249
- return _.displayName = `withReinspect(${h})`, _[be] = {
1250
- source: a,
1251
- scope: f,
1252
- original: m
1253
- }, _;
1254
- }
1255
- //#endregion
1256
- //#region src/reinspect/autoWrap.ts
1257
- function Z(e, t) {
1258
- return xe(e)?.source === "manual" ? e : X(e, {
1259
- source: "auto",
1260
- scope: t.scope,
1261
- name: t.componentName,
1262
- fallbackName: t.fallbackName
1263
- });
1264
- }
1265
- //#endregion
1266
- //#region src/reinspect/wrapInspectableMap.ts
1267
- function Pe(e, t) {
1268
- let n = {};
1269
- for (let r of Object.keys(e)) {
1270
- let i = e[r];
1271
- n[r] = X(i, typeof t == "function" ? t(r, i) : t?.[r]);
1272
- }
1273
- return n;
376
+ return t?.name && (n.componentName = t.name), s(e, n);
1274
377
  }
1275
378
  //#endregion
1276
379
  //#region src/reinspect/index.ts
1277
- h(f);
380
+ b(_);
1278
381
  //#endregion
1279
- export { v as DEFAULT_EDITABLE_PROPS, y as DEFAULT_PALETTE, L as ReinspectFloatingToggle, I as ReinspectProvider, Z as autoWrapInspectable, _ as useReinspect, X as withReinspect, Pe as wrapInspectableMap };
382
+ export { A as ReinspectProvider, T as useReinspect, M as withReinspect };