@buoy-gg/highlight-updates 3.0.0 → 3.0.2

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 (83) hide show
  1. package/lib/commonjs/highlight-updates/HighlightUpdatesOverlay.js +285 -1
  2. package/lib/commonjs/highlight-updates/components/HighlightFilterView.js +1371 -1
  3. package/lib/commonjs/highlight-updates/components/HighlightUpdatesModal.js +564 -1
  4. package/lib/commonjs/highlight-updates/components/IdentifierBadge.js +267 -1
  5. package/lib/commonjs/highlight-updates/components/IsolatedRenderList.js +178 -1
  6. package/lib/commonjs/highlight-updates/components/ModalHeaderContent.js +309 -1
  7. package/lib/commonjs/highlight-updates/components/RenderCauseBadge.js +500 -1
  8. package/lib/commonjs/highlight-updates/components/RenderDetailView.js +803 -1
  9. package/lib/commonjs/highlight-updates/components/RenderHistoryViewer.js +894 -1
  10. package/lib/commonjs/highlight-updates/components/RenderListItem.js +220 -1
  11. package/lib/commonjs/highlight-updates/components/RendersCopySettingsView.js +562 -1
  12. package/lib/commonjs/highlight-updates/components/StatsDisplay.js +70 -1
  13. package/lib/commonjs/highlight-updates/components/index.js +97 -1
  14. package/lib/commonjs/highlight-updates/types/copySettings.js +107 -1
  15. package/lib/commonjs/highlight-updates/utils/HighlightUpdatesController.js +1819 -1
  16. package/lib/commonjs/highlight-updates/utils/PerformanceLogger.js +359 -1
  17. package/lib/commonjs/highlight-updates/utils/ProfilerInterceptor.js +371 -1
  18. package/lib/commonjs/highlight-updates/utils/RenderCauseDetector.js +1828 -1
  19. package/lib/commonjs/highlight-updates/utils/RenderTracker.js +919 -1
  20. package/lib/commonjs/highlight-updates/utils/ViewTypeMapper.js +264 -1
  21. package/lib/commonjs/highlight-updates/utils/copySettingsStorage.js +49 -1
  22. package/lib/commonjs/highlight-updates/utils/renderExportFormatter.js +58 -1
  23. package/lib/commonjs/highlight-updates/utils/rendersExportFormatter.js +485 -1
  24. package/lib/commonjs/index.js +320 -1
  25. package/lib/commonjs/preset.js +278 -1
  26. package/lib/commonjs/sync/highlightUpdatesSyncAdapter.js +83 -0
  27. package/lib/module/highlight-updates/HighlightUpdatesOverlay.js +278 -1
  28. package/lib/module/highlight-updates/components/HighlightFilterView.js +1365 -1
  29. package/lib/module/highlight-updates/components/HighlightUpdatesModal.js +558 -1
  30. package/lib/module/highlight-updates/components/IdentifierBadge.js +259 -1
  31. package/lib/module/highlight-updates/components/IsolatedRenderList.js +174 -1
  32. package/lib/module/highlight-updates/components/ModalHeaderContent.js +304 -1
  33. package/lib/module/highlight-updates/components/RenderCauseBadge.js +491 -1
  34. package/lib/module/highlight-updates/components/RenderDetailView.js +797 -1
  35. package/lib/module/highlight-updates/components/RenderHistoryViewer.js +888 -1
  36. package/lib/module/highlight-updates/components/RenderListItem.js +215 -1
  37. package/lib/module/highlight-updates/components/RendersCopySettingsView.js +558 -1
  38. package/lib/module/highlight-updates/components/StatsDisplay.js +67 -1
  39. package/lib/module/highlight-updates/components/index.js +16 -1
  40. package/lib/module/highlight-updates/types/copySettings.js +102 -1
  41. package/lib/module/highlight-updates/utils/HighlightUpdatesController.js +1815 -1
  42. package/lib/module/highlight-updates/utils/PerformanceLogger.js +353 -1
  43. package/lib/module/highlight-updates/utils/ProfilerInterceptor.js +358 -1
  44. package/lib/module/highlight-updates/utils/RenderCauseDetector.js +1818 -1
  45. package/lib/module/highlight-updates/utils/RenderTracker.js +916 -1
  46. package/lib/module/highlight-updates/utils/ViewTypeMapper.js +255 -1
  47. package/lib/module/highlight-updates/utils/copySettingsStorage.js +43 -1
  48. package/lib/module/highlight-updates/utils/renderExportFormatter.js +54 -1
  49. package/lib/module/highlight-updates/utils/rendersExportFormatter.js +478 -1
  50. package/lib/module/index.js +74 -1
  51. package/lib/module/preset.js +272 -1
  52. package/lib/module/sync/highlightUpdatesSyncAdapter.js +78 -0
  53. package/lib/typescript/highlight-updates/HighlightUpdatesOverlay.d.ts.map +1 -0
  54. package/lib/typescript/highlight-updates/components/HighlightFilterView.d.ts.map +1 -0
  55. package/lib/typescript/highlight-updates/components/HighlightUpdatesModal.d.ts.map +1 -0
  56. package/lib/typescript/highlight-updates/components/IdentifierBadge.d.ts.map +1 -0
  57. package/lib/typescript/highlight-updates/components/IsolatedRenderList.d.ts.map +1 -0
  58. package/lib/typescript/highlight-updates/components/ModalHeaderContent.d.ts.map +1 -0
  59. package/lib/typescript/highlight-updates/components/RenderCauseBadge.d.ts.map +1 -0
  60. package/lib/typescript/highlight-updates/components/RenderDetailView.d.ts.map +1 -0
  61. package/lib/typescript/highlight-updates/components/RenderHistoryViewer.d.ts.map +1 -0
  62. package/lib/typescript/highlight-updates/components/RenderListItem.d.ts.map +1 -0
  63. package/lib/typescript/highlight-updates/components/RendersCopySettingsView.d.ts.map +1 -0
  64. package/lib/typescript/highlight-updates/components/StatsDisplay.d.ts.map +1 -0
  65. package/lib/typescript/highlight-updates/components/index.d.ts.map +1 -0
  66. package/lib/typescript/highlight-updates/types/copySettings.d.ts.map +1 -0
  67. package/lib/typescript/highlight-updates/utils/HighlightUpdatesController.d.ts +90 -0
  68. package/lib/typescript/highlight-updates/utils/HighlightUpdatesController.d.ts.map +1 -0
  69. package/lib/typescript/highlight-updates/utils/PerformanceLogger.d.ts.map +1 -0
  70. package/lib/typescript/highlight-updates/utils/ProfilerInterceptor.d.ts.map +1 -0
  71. package/lib/typescript/highlight-updates/utils/RenderCauseDetector.d.ts.map +1 -0
  72. package/lib/typescript/highlight-updates/utils/RenderTracker.d.ts +10 -0
  73. package/lib/typescript/highlight-updates/utils/RenderTracker.d.ts.map +1 -0
  74. package/lib/typescript/highlight-updates/utils/ViewTypeMapper.d.ts.map +1 -0
  75. package/lib/typescript/highlight-updates/utils/copySettingsStorage.d.ts.map +1 -0
  76. package/lib/typescript/highlight-updates/utils/renderExportFormatter.d.ts.map +1 -0
  77. package/lib/typescript/highlight-updates/utils/rendersExportFormatter.d.ts.map +1 -0
  78. package/lib/typescript/index.d.ts +1 -0
  79. package/lib/typescript/index.d.ts.map +1 -0
  80. package/lib/typescript/preset.d.ts.map +1 -0
  81. package/lib/typescript/sync/highlightUpdatesSyncAdapter.d.ts +36 -0
  82. package/lib/typescript/sync/highlightUpdatesSyncAdapter.d.ts.map +1 -0
  83. package/package.json +7 -7
@@ -1 +1,562 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.RendersCopySettingsView=RendersCopySettingsView;var _react=require("react"),_reactNative=require("react-native"),_sharedUi=require("@buoy-gg/shared-ui"),_copySettings=require("../types/copySettings"),_rendersExportFormatter=require("../utils/rendersExportFormatter"),_copySettingsStorage=require("../utils/copySettingsStorage"),_jsxRuntime=require("react/jsx-runtime");const SIZE_WARNING_THRESHOLD=51200,SIZE_DANGER_THRESHOLD=204800,CAUSE_OPTIONS=[{value:"mount",label:"Mount"},{value:"props",label:"Props"},{value:"hooks",label:"Hooks"},{value:"state",label:"State"},{value:"parent",label:"Parent"},{value:"context",label:"Context"},{value:"unknown",label:"Unknown"}];function formatBytes(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function createMockRenders(){const e=Date.now();return[{id:"1",nativeTag:1,viewType:"RCTView",displayName:"View",componentName:"PokemonListItem",renderCount:30,firstRenderTime:e-5e3,lastRenderTime:e,color:"#10B981",lastRenderCause:{type:"parent",timestamp:e,componentCause:"parent"}},{id:"2",nativeTag:2,viewType:"RCTView",displayName:"View",componentName:"CartHeader",renderCount:12,firstRenderTime:e-4e3,lastRenderTime:e,color:"#3B82F6",lastRenderCause:{type:"hooks",timestamp:e,componentCause:"state",hookChanges:[{type:"useState",index:2,previousValue:4,currentValue:5}]}},{id:"3",nativeTag:3,viewType:"RCTView",displayName:"View",componentName:"SearchBar",renderCount:8,firstRenderTime:e-3e3,lastRenderTime:e,color:"#F59E0B",lastRenderCause:{type:"props",timestamp:e,componentCause:"props",changedKeys:["query","onChange"]}}]}function RendersCopySettingsView({renders:e}){const[t,r]=(0,_react.useState)(_copySettings.DEFAULT_COPY_SETTINGS),[s,a]=(0,_react.useState)(!1);(0,_react.useEffect)(()=>{let e=!0;return(0,_copySettingsStorage.loadCopySettings)().then(t=>{e&&t&&r(t)}),()=>{e=!1}},[]);const i=(0,_react.useCallback)(e=>{r(e),(0,_copySettingsStorage.saveCopySettings)(e)},[]),o=e.length>0,n=o?e:createMockRenders(),l=(0,_react.useMemo)(()=>(0,_copySettings.detectActivePreset)(t),[t]),c=(0,_react.useMemo)(()=>(0,_rendersExportFormatter.estimateExportSize)(n,t),[n,t]),d=(0,_react.useMemo)(()=>c>=SIZE_DANGER_THRESHOLD?"danger":c>=SIZE_WARNING_THRESHOLD?"warning":"none",[c]),u=(0,_react.useCallback)(()=>(0,_rendersExportFormatter.generateExport)(n,t),[n,t]),m=(0,_react.useCallback)(e=>{const t=_copySettings.COPY_PRESETS[e];i({...t,filterCauses:[...t.filterCauses]})},[i]),p=(0,_react.useCallback)((e,r)=>{const[s,a]=e.split("::");if("preset"!==s)if("format"!==s)if("sort"!==s)if("topN"!==s)if("minRenders"!==s){if("cause"===s){const e=r,s=t.filterCauses.includes(e);return void i({...t,filterCauses:s?t.filterCauses.filter(t=>t!==e):[...t.filterCauses,e]})}if("signal"===s){const e=a;return void i({...t,[e]:!t[e]})}}else i({...t,minRenders:r});else i({...t,topN:r});else i({...t,sortBy:r});else i({...t,format:r});else m(a)},[t,i,m]),_=(0,_react.useCallback)(()=>{const{totalComponents:e,totalRenders:t}=(0,_rendersExportFormatter.getExportSummary)(n);if(!s){const r="danger"===d?_sharedUi.macOSColors.semantic.error:"warning"===d?_sharedUi.macOSColors.semantic.warning:_sharedUi.macOSColors.text.secondary;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.collapsedPreview,children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.expandButton,onPress:()=>a(!0),children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.expandButtonContent,children:[(0,_jsxRuntime.jsx)(_sharedUi.Eye,{size:16,color:_sharedUi.macOSColors.semantic.info}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.expandButtonTextContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.expandButtonTitle,children:"Show Preview"}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.expandButtonSubtitle,children:[e," component",1!==e?"s":""," · ",t," renders · ~",formatBytes(c),o?"":" (mock data)"]})]}),(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:16,color:_sharedUi.macOSColors.text.muted})]})}),"none"!==d&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.sizeWarning,"danger"===d&&styles.sizeWarningDanger],children:[(0,_jsxRuntime.jsx)(_sharedUi.AlertTriangle,{size:12,color:r}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.sizeWarningText,{color:r}],children:"danger"===d?"Very large payload — try a smaller topN or turn off history":"Large payload — preview may be slow"})]})]})}const r=u();return(0,_jsxRuntime.jsxs)(_reactNative.View,{children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.collapseButton,onPress:()=>a(!1),children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.collapseButtonText,children:"Hide Preview"}),(0,_jsxRuntime.jsx)(_sharedUi.ChevronUp,{size:14,color:_sharedUi.macOSColors.text.secondary})]}),(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{style:styles.previewScroll,nestedScrollEnabled:!0,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.previewText,selectable:!0,children:r})})]})},[s,n,c,d,o,u]),y=(0,_react.useCallback)(()=>{const{totalComponents:e}=(0,_rendersExportFormatter.getExportSummary)(n),t=o?`${e} components`:"Mock data (no renders captured)";return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.statusLabel,children:t}),(0,_jsxRuntime.jsx)(_sharedUi.ToolbarCopyButton,{value:u})]})},[o,n,u]),g=(0,_react.useMemo)(()=>({sections:[{id:"presets",title:"Presets",type:"custom",data:[{id:"preset::llm",label:_copySettings.PRESET_METADATA.llm.label,icon:_sharedUi.Zap,color:_copySettings.PRESET_METADATA.llm.color,value:"llm",isActive:"llm"===l,description:_copySettings.PRESET_METADATA.llm.description},{id:"preset::table",label:_copySettings.PRESET_METADATA.table.label,icon:_sharedUi.FileText,color:_copySettings.PRESET_METADATA.table.color,value:"table",isActive:"table"===l,description:_copySettings.PRESET_METADATA.table.description},{id:"preset::json",label:_copySettings.PRESET_METADATA.json.label,icon:_sharedUi.FileCode,color:_copySettings.PRESET_METADATA.json.color,value:"json",isActive:"json"===l,description:_copySettings.PRESET_METADATA.json.description},{id:"preset::full",label:_copySettings.PRESET_METADATA.full.label,icon:_sharedUi.Layers,color:_copySettings.PRESET_METADATA.full.color,value:"full",isActive:"full"===l,description:_copySettings.PRESET_METADATA.full.description},{id:"preset::custom",label:"Custom",icon:_sharedUi.Settings,color:_sharedUi.macOSColors.text.secondary,value:"custom",isActive:null===l,description:"User-configured"}]},{id:"format",title:"Format",type:"custom",data:[{id:"format::summary",label:"Summary",icon:_sharedUi.Zap,color:_sharedUi.macOSColors.semantic.success,value:"summary",isActive:"summary"===t.format,description:"Compact, LLM-ready"},{id:"format::markdown-table",label:"Table",icon:_sharedUi.FileText,color:_sharedUi.macOSColors.semantic.info,value:"markdown-table",isActive:"markdown-table"===t.format,description:"Markdown table"},{id:"format::json",label:"JSON",icon:_sharedUi.FileCode,color:_sharedUi.macOSColors.semantic.warning,value:"json",isActive:"json"===t.format,description:"Structured data"}]},{id:"sort",title:"Sort By",type:"custom",data:[{id:"sort::renderCount",label:"Count",value:"renderCount",isActive:"renderCount"===t.sortBy,description:"Total renders"},{id:"sort::rate",label:"Rate",value:"rate",isActive:"rate"===t.sortBy,description:"Renders / sec"},{id:"sort::name",label:"Name",value:"name",isActive:"name"===t.sortBy,description:"Alphabetical"}]},{id:"topN",title:"Top N",type:"custom",data:[{id:"topN::10",label:"10",value:10,isActive:10===t.topN},{id:"topN::25",label:"25",value:25,isActive:25===t.topN},{id:"topN::50",label:"50",value:50,isActive:50===t.topN},{id:"topN::100",label:"100",value:100,isActive:100===t.topN},{id:"topN::-1",label:"All",value:-1,isActive:-1===t.topN}]},{id:"minRenders",title:"Min Renders",type:"custom",data:[{id:"minRenders::1",label:"1",value:1,isActive:1===t.minRenders},{id:"minRenders::2",label:"2",value:2,isActive:2===t.minRenders},{id:"minRenders::3",label:"3",value:3,isActive:3===t.minRenders},{id:"minRenders::5",label:"5",value:5,isActive:5===t.minRenders},{id:"minRenders::10",label:"10",value:10,isActive:10===t.minRenders}]},{id:"causes",title:"Filter Causes",type:"custom",description:0===t.filterCauses.length?"All causes shown":"Only the selected causes shown",data:CAUSE_OPTIONS.map(e=>({id:`cause::${e.value}`,label:e.label,value:e.value,isActive:t.filterCauses.includes(e.value)}))},{id:"signal",title:"Signal Extraction",type:"custom",data:[{id:"signal::groupByName",label:"Group by name",value:"groupByName",isActive:t.groupByName,description:"Collapse list items"},{id:"signal::aggregateCauses",label:"Aggregate causes",value:"aggregateCauses",isActive:t.aggregateCauses,description:"Hook x N"},{id:"signal::includeHistory",label:"Include history",value:"includeHistory",isActive:t.includeHistory,description:"JSON only — large"}]}],previewSection:{enabled:!0,title:"PREVIEW",icon:_sharedUi.Eye,content:_,headerActions:y},onFilterChange:p}),[t,l,p,_,y]);return(0,_jsxRuntime.jsx)(_sharedUi.DynamicFilterView,{...g})}const styles=_reactNative.StyleSheet.create({collapsedPreview:{gap:8},expandButton:{backgroundColor:_sharedUi.macOSColors.background.input,borderRadius:8,borderWidth:1,borderColor:_sharedUi.macOSColors.border.default,padding:12},expandButtonContent:{flexDirection:"row",alignItems:"center",gap:10},expandButtonTextContainer:{flex:1},expandButtonTitle:{fontSize:13,fontWeight:"600",color:_sharedUi.macOSColors.text.primary},expandButtonSubtitle:{fontSize:11,color:_sharedUi.macOSColors.text.secondary,marginTop:2},collapseButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,paddingVertical:8,marginBottom:8,backgroundColor:_sharedUi.macOSColors.background.hover,borderRadius:6,borderWidth:1,borderColor:_sharedUi.macOSColors.border.default},collapseButtonText:{fontSize:12,fontWeight:"500",color:_sharedUi.macOSColors.text.secondary},sizeWarning:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:10,paddingVertical:6,backgroundColor:_sharedUi.macOSColors.semantic.warningBackground,borderRadius:6,borderWidth:1,borderColor:_sharedUi.macOSColors.semantic.warning+"30"},sizeWarningDanger:{backgroundColor:_sharedUi.macOSColors.semantic.errorBackground,borderColor:_sharedUi.macOSColors.semantic.error+"30"},sizeWarningText:{fontSize:11,fontWeight:"500",flex:1},previewScroll:{maxHeight:360},previewText:{fontFamily:"monospace",fontSize:11,color:_sharedUi.macOSColors.text.primary,lineHeight:18},statusLabel:{fontSize:11,fontWeight:"600",color:_sharedUi.macOSColors.text.muted,marginRight:8}});
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.RendersCopySettingsView = RendersCopySettingsView;
7
+ var _react = require("react");
8
+ var _reactNative = require("react-native");
9
+ var _sharedUi = require("@buoy-gg/shared-ui");
10
+ var _copySettings = require("../types/copySettings");
11
+ var _rendersExportFormatter = require("../utils/rendersExportFormatter");
12
+ var _copySettingsStorage = require("../utils/copySettingsStorage");
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ /**
15
+ * RendersCopySettingsView
16
+ *
17
+ * Settings UI for configuring render report export.
18
+ * Mirrors EventsCopySettingsView but with renders-specific options.
19
+ */
20
+
21
+ const SIZE_WARNING_THRESHOLD = 50 * 1024;
22
+ const SIZE_DANGER_THRESHOLD = 200 * 1024;
23
+ const CAUSE_OPTIONS = [{
24
+ value: "mount",
25
+ label: "Mount"
26
+ }, {
27
+ value: "props",
28
+ label: "Props"
29
+ }, {
30
+ value: "hooks",
31
+ label: "Hooks"
32
+ }, {
33
+ value: "state",
34
+ label: "State"
35
+ }, {
36
+ value: "parent",
37
+ label: "Parent"
38
+ }, {
39
+ value: "context",
40
+ label: "Context"
41
+ }, {
42
+ value: "unknown",
43
+ label: "Unknown"
44
+ }];
45
+ function formatBytes(bytes) {
46
+ if (bytes < 1024) return `${bytes} B`;
47
+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
48
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
49
+ }
50
+ function createMockRenders() {
51
+ const now = Date.now();
52
+ return [{
53
+ id: "1",
54
+ nativeTag: 1,
55
+ viewType: "RCTView",
56
+ displayName: "View",
57
+ componentName: "PokemonListItem",
58
+ renderCount: 30,
59
+ firstRenderTime: now - 5000,
60
+ lastRenderTime: now,
61
+ color: "#10B981",
62
+ lastRenderCause: {
63
+ type: "parent",
64
+ timestamp: now,
65
+ componentCause: "parent"
66
+ }
67
+ }, {
68
+ id: "2",
69
+ nativeTag: 2,
70
+ viewType: "RCTView",
71
+ displayName: "View",
72
+ componentName: "CartHeader",
73
+ renderCount: 12,
74
+ firstRenderTime: now - 4000,
75
+ lastRenderTime: now,
76
+ color: "#3B82F6",
77
+ lastRenderCause: {
78
+ type: "hooks",
79
+ timestamp: now,
80
+ componentCause: "state",
81
+ hookChanges: [{
82
+ type: "useState",
83
+ index: 2,
84
+ previousValue: 4,
85
+ currentValue: 5
86
+ }]
87
+ }
88
+ }, {
89
+ id: "3",
90
+ nativeTag: 3,
91
+ viewType: "RCTView",
92
+ displayName: "View",
93
+ componentName: "SearchBar",
94
+ renderCount: 8,
95
+ firstRenderTime: now - 3000,
96
+ lastRenderTime: now,
97
+ color: "#F59E0B",
98
+ lastRenderCause: {
99
+ type: "props",
100
+ timestamp: now,
101
+ componentCause: "props",
102
+ changedKeys: ["query", "onChange"]
103
+ }
104
+ }];
105
+ }
106
+ function RendersCopySettingsView({
107
+ renders
108
+ }) {
109
+ const [settings, setSettings] = (0, _react.useState)(_copySettings.DEFAULT_COPY_SETTINGS);
110
+ const [isPreviewExpanded, setIsPreviewExpanded] = (0, _react.useState)(false);
111
+ (0, _react.useEffect)(() => {
112
+ let mounted = true;
113
+ (0, _copySettingsStorage.loadCopySettings)().then(saved => {
114
+ if (mounted && saved) setSettings(saved);
115
+ });
116
+ return () => {
117
+ mounted = false;
118
+ };
119
+ }, []);
120
+ const updateSettings = (0, _react.useCallback)(next => {
121
+ setSettings(next);
122
+ (0, _copySettingsStorage.saveCopySettings)(next);
123
+ }, []);
124
+ const hasLiveData = renders.length > 0;
125
+ const previewRenders = hasLiveData ? renders : createMockRenders();
126
+ const activePreset = (0, _react.useMemo)(() => (0, _copySettings.detectActivePreset)(settings), [settings]);
127
+ const estimatedSize = (0, _react.useMemo)(() => (0, _rendersExportFormatter.estimateExportSize)(previewRenders, settings), [previewRenders, settings]);
128
+ const sizeWarningLevel = (0, _react.useMemo)(() => {
129
+ if (estimatedSize >= SIZE_DANGER_THRESHOLD) return "danger";
130
+ if (estimatedSize >= SIZE_WARNING_THRESHOLD) return "warning";
131
+ return "none";
132
+ }, [estimatedSize]);
133
+ const generateCopyText = (0, _react.useCallback)(() => (0, _rendersExportFormatter.generateExport)(previewRenders, settings), [previewRenders, settings]);
134
+ const applyPreset = (0, _react.useCallback)(name => {
135
+ const preset = _copySettings.COPY_PRESETS[name];
136
+ updateSettings({
137
+ ...preset,
138
+ filterCauses: [...preset.filterCauses]
139
+ });
140
+ }, [updateSettings]);
141
+ const handleOptionChange = (0, _react.useCallback)((optionId, value) => {
142
+ const [group, key] = optionId.split("::");
143
+ if (group === "preset") {
144
+ applyPreset(key);
145
+ return;
146
+ }
147
+ if (group === "format") {
148
+ updateSettings({
149
+ ...settings,
150
+ format: value
151
+ });
152
+ return;
153
+ }
154
+ if (group === "sort") {
155
+ updateSettings({
156
+ ...settings,
157
+ sortBy: value
158
+ });
159
+ return;
160
+ }
161
+ if (group === "topN") {
162
+ updateSettings({
163
+ ...settings,
164
+ topN: value
165
+ });
166
+ return;
167
+ }
168
+ if (group === "minRenders") {
169
+ updateSettings({
170
+ ...settings,
171
+ minRenders: value
172
+ });
173
+ return;
174
+ }
175
+ if (group === "cause") {
176
+ const cause = value;
177
+ const has = settings.filterCauses.includes(cause);
178
+ updateSettings({
179
+ ...settings,
180
+ filterCauses: has ? settings.filterCauses.filter(c => c !== cause) : [...settings.filterCauses, cause]
181
+ });
182
+ return;
183
+ }
184
+ if (group === "signal") {
185
+ const k = key;
186
+ updateSettings({
187
+ ...settings,
188
+ [k]: !settings[k]
189
+ });
190
+ return;
191
+ }
192
+ }, [settings, updateSettings, applyPreset]);
193
+ const renderPreviewContent = (0, _react.useCallback)(() => {
194
+ const {
195
+ totalComponents,
196
+ totalRenders
197
+ } = (0, _rendersExportFormatter.getExportSummary)(previewRenders);
198
+ if (!isPreviewExpanded) {
199
+ const warningColor = sizeWarningLevel === "danger" ? _sharedUi.macOSColors.semantic.error : sizeWarningLevel === "warning" ? _sharedUi.macOSColors.semantic.warning : _sharedUi.macOSColors.text.secondary;
200
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
201
+ style: styles.collapsedPreview,
202
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
203
+ style: styles.expandButton,
204
+ onPress: () => setIsPreviewExpanded(true),
205
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
206
+ style: styles.expandButtonContent,
207
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Eye, {
208
+ size: 16,
209
+ color: _sharedUi.macOSColors.semantic.info
210
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
211
+ style: styles.expandButtonTextContainer,
212
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
213
+ style: styles.expandButtonTitle,
214
+ children: "Show Preview"
215
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
216
+ style: styles.expandButtonSubtitle,
217
+ children: [totalComponents, " component", totalComponents !== 1 ? "s" : "", " \xB7 ", totalRenders, " renders \xB7 ~", formatBytes(estimatedSize), !hasLiveData ? " (mock data)" : ""]
218
+ })]
219
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ChevronDown, {
220
+ size: 16,
221
+ color: _sharedUi.macOSColors.text.muted
222
+ })]
223
+ })
224
+ }), sizeWarningLevel !== "none" && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
225
+ style: [styles.sizeWarning, sizeWarningLevel === "danger" && styles.sizeWarningDanger],
226
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.AlertTriangle, {
227
+ size: 12,
228
+ color: warningColor
229
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
230
+ style: [styles.sizeWarningText, {
231
+ color: warningColor
232
+ }],
233
+ children: sizeWarningLevel === "danger" ? "Very large payload — try a smaller topN or turn off history" : "Large payload — preview may be slow"
234
+ })]
235
+ })]
236
+ });
237
+ }
238
+ const exportText = generateCopyText();
239
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
240
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
241
+ style: styles.collapseButton,
242
+ onPress: () => setIsPreviewExpanded(false),
243
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
244
+ style: styles.collapseButtonText,
245
+ children: "Hide Preview"
246
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ChevronUp, {
247
+ size: 14,
248
+ color: _sharedUi.macOSColors.text.secondary
249
+ })]
250
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
251
+ style: styles.previewScroll,
252
+ nestedScrollEnabled: true,
253
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
254
+ style: styles.previewText,
255
+ selectable: true,
256
+ children: exportText
257
+ })
258
+ })]
259
+ });
260
+ }, [isPreviewExpanded, previewRenders, estimatedSize, sizeWarningLevel, hasLiveData, generateCopyText]);
261
+ const renderPreviewHeaderActions = (0, _react.useCallback)(() => {
262
+ const {
263
+ totalComponents
264
+ } = (0, _rendersExportFormatter.getExportSummary)(previewRenders);
265
+ const statusLabel = hasLiveData ? `${totalComponents} components` : "Mock data (no renders captured)";
266
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
267
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
268
+ style: styles.statusLabel,
269
+ children: statusLabel
270
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ToolbarCopyButton, {
271
+ value: generateCopyText
272
+ })]
273
+ });
274
+ }, [hasLiveData, previewRenders, generateCopyText]);
275
+ const dynamicFilterConfig = (0, _react.useMemo)(() => ({
276
+ sections: [{
277
+ id: "presets",
278
+ title: "Presets",
279
+ type: "custom",
280
+ data: [{
281
+ id: "preset::llm",
282
+ label: _copySettings.PRESET_METADATA.llm.label,
283
+ icon: _sharedUi.Zap,
284
+ color: _copySettings.PRESET_METADATA.llm.color,
285
+ value: "llm",
286
+ isActive: activePreset === "llm",
287
+ description: _copySettings.PRESET_METADATA.llm.description
288
+ }, {
289
+ id: "preset::table",
290
+ label: _copySettings.PRESET_METADATA.table.label,
291
+ icon: _sharedUi.FileText,
292
+ color: _copySettings.PRESET_METADATA.table.color,
293
+ value: "table",
294
+ isActive: activePreset === "table",
295
+ description: _copySettings.PRESET_METADATA.table.description
296
+ }, {
297
+ id: "preset::json",
298
+ label: _copySettings.PRESET_METADATA.json.label,
299
+ icon: _sharedUi.FileCode,
300
+ color: _copySettings.PRESET_METADATA.json.color,
301
+ value: "json",
302
+ isActive: activePreset === "json",
303
+ description: _copySettings.PRESET_METADATA.json.description
304
+ }, {
305
+ id: "preset::full",
306
+ label: _copySettings.PRESET_METADATA.full.label,
307
+ icon: _sharedUi.Layers,
308
+ color: _copySettings.PRESET_METADATA.full.color,
309
+ value: "full",
310
+ isActive: activePreset === "full",
311
+ description: _copySettings.PRESET_METADATA.full.description
312
+ }, {
313
+ id: "preset::custom",
314
+ label: "Custom",
315
+ icon: _sharedUi.Settings,
316
+ color: _sharedUi.macOSColors.text.secondary,
317
+ value: "custom",
318
+ isActive: activePreset === null,
319
+ description: "User-configured"
320
+ }]
321
+ }, {
322
+ id: "format",
323
+ title: "Format",
324
+ type: "custom",
325
+ data: [{
326
+ id: "format::summary",
327
+ label: "Summary",
328
+ icon: _sharedUi.Zap,
329
+ color: _sharedUi.macOSColors.semantic.success,
330
+ value: "summary",
331
+ isActive: settings.format === "summary",
332
+ description: "Compact, LLM-ready"
333
+ }, {
334
+ id: "format::markdown-table",
335
+ label: "Table",
336
+ icon: _sharedUi.FileText,
337
+ color: _sharedUi.macOSColors.semantic.info,
338
+ value: "markdown-table",
339
+ isActive: settings.format === "markdown-table",
340
+ description: "Markdown table"
341
+ }, {
342
+ id: "format::json",
343
+ label: "JSON",
344
+ icon: _sharedUi.FileCode,
345
+ color: _sharedUi.macOSColors.semantic.warning,
346
+ value: "json",
347
+ isActive: settings.format === "json",
348
+ description: "Structured data"
349
+ }]
350
+ }, {
351
+ id: "sort",
352
+ title: "Sort By",
353
+ type: "custom",
354
+ data: [{
355
+ id: "sort::renderCount",
356
+ label: "Count",
357
+ value: "renderCount",
358
+ isActive: settings.sortBy === "renderCount",
359
+ description: "Total renders"
360
+ }, {
361
+ id: "sort::rate",
362
+ label: "Rate",
363
+ value: "rate",
364
+ isActive: settings.sortBy === "rate",
365
+ description: "Renders / sec"
366
+ }, {
367
+ id: "sort::name",
368
+ label: "Name",
369
+ value: "name",
370
+ isActive: settings.sortBy === "name",
371
+ description: "Alphabetical"
372
+ }]
373
+ }, {
374
+ id: "topN",
375
+ title: "Top N",
376
+ type: "custom",
377
+ data: [{
378
+ id: "topN::10",
379
+ label: "10",
380
+ value: 10,
381
+ isActive: settings.topN === 10
382
+ }, {
383
+ id: "topN::25",
384
+ label: "25",
385
+ value: 25,
386
+ isActive: settings.topN === 25
387
+ }, {
388
+ id: "topN::50",
389
+ label: "50",
390
+ value: 50,
391
+ isActive: settings.topN === 50
392
+ }, {
393
+ id: "topN::100",
394
+ label: "100",
395
+ value: 100,
396
+ isActive: settings.topN === 100
397
+ }, {
398
+ id: "topN::-1",
399
+ label: "All",
400
+ value: -1,
401
+ isActive: settings.topN === -1
402
+ }]
403
+ }, {
404
+ id: "minRenders",
405
+ title: "Min Renders",
406
+ type: "custom",
407
+ data: [{
408
+ id: "minRenders::1",
409
+ label: "1",
410
+ value: 1,
411
+ isActive: settings.minRenders === 1
412
+ }, {
413
+ id: "minRenders::2",
414
+ label: "2",
415
+ value: 2,
416
+ isActive: settings.minRenders === 2
417
+ }, {
418
+ id: "minRenders::3",
419
+ label: "3",
420
+ value: 3,
421
+ isActive: settings.minRenders === 3
422
+ }, {
423
+ id: "minRenders::5",
424
+ label: "5",
425
+ value: 5,
426
+ isActive: settings.minRenders === 5
427
+ }, {
428
+ id: "minRenders::10",
429
+ label: "10",
430
+ value: 10,
431
+ isActive: settings.minRenders === 10
432
+ }]
433
+ }, {
434
+ id: "causes",
435
+ title: "Filter Causes",
436
+ type: "custom",
437
+ description: settings.filterCauses.length === 0 ? "All causes shown" : "Only the selected causes shown",
438
+ data: CAUSE_OPTIONS.map(opt => ({
439
+ id: `cause::${opt.value}`,
440
+ label: opt.label,
441
+ value: opt.value,
442
+ isActive: settings.filterCauses.includes(opt.value)
443
+ }))
444
+ }, {
445
+ id: "signal",
446
+ title: "Signal Extraction",
447
+ type: "custom",
448
+ data: [{
449
+ id: "signal::groupByName",
450
+ label: "Group by name",
451
+ value: "groupByName",
452
+ isActive: settings.groupByName,
453
+ description: "Collapse list items"
454
+ }, {
455
+ id: "signal::aggregateCauses",
456
+ label: "Aggregate causes",
457
+ value: "aggregateCauses",
458
+ isActive: settings.aggregateCauses,
459
+ description: "Hook x N"
460
+ }, {
461
+ id: "signal::includeHistory",
462
+ label: "Include history",
463
+ value: "includeHistory",
464
+ isActive: settings.includeHistory,
465
+ description: "JSON only — large"
466
+ }]
467
+ }],
468
+ previewSection: {
469
+ enabled: true,
470
+ title: "PREVIEW",
471
+ icon: _sharedUi.Eye,
472
+ content: renderPreviewContent,
473
+ headerActions: renderPreviewHeaderActions
474
+ },
475
+ onFilterChange: handleOptionChange
476
+ }), [settings, activePreset, handleOptionChange, renderPreviewContent, renderPreviewHeaderActions]);
477
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.DynamicFilterView, {
478
+ ...dynamicFilterConfig
479
+ });
480
+ }
481
+ const styles = _reactNative.StyleSheet.create({
482
+ collapsedPreview: {
483
+ gap: 8
484
+ },
485
+ expandButton: {
486
+ backgroundColor: _sharedUi.macOSColors.background.input,
487
+ borderRadius: 8,
488
+ borderWidth: 1,
489
+ borderColor: _sharedUi.macOSColors.border.default,
490
+ padding: 12
491
+ },
492
+ expandButtonContent: {
493
+ flexDirection: "row",
494
+ alignItems: "center",
495
+ gap: 10
496
+ },
497
+ expandButtonTextContainer: {
498
+ flex: 1
499
+ },
500
+ expandButtonTitle: {
501
+ fontSize: 13,
502
+ fontWeight: "600",
503
+ color: _sharedUi.macOSColors.text.primary
504
+ },
505
+ expandButtonSubtitle: {
506
+ fontSize: 11,
507
+ color: _sharedUi.macOSColors.text.secondary,
508
+ marginTop: 2
509
+ },
510
+ collapseButton: {
511
+ flexDirection: "row",
512
+ alignItems: "center",
513
+ justifyContent: "center",
514
+ gap: 6,
515
+ paddingVertical: 8,
516
+ marginBottom: 8,
517
+ backgroundColor: _sharedUi.macOSColors.background.hover,
518
+ borderRadius: 6,
519
+ borderWidth: 1,
520
+ borderColor: _sharedUi.macOSColors.border.default
521
+ },
522
+ collapseButtonText: {
523
+ fontSize: 12,
524
+ fontWeight: "500",
525
+ color: _sharedUi.macOSColors.text.secondary
526
+ },
527
+ sizeWarning: {
528
+ flexDirection: "row",
529
+ alignItems: "center",
530
+ gap: 6,
531
+ paddingHorizontal: 10,
532
+ paddingVertical: 6,
533
+ backgroundColor: _sharedUi.macOSColors.semantic.warningBackground,
534
+ borderRadius: 6,
535
+ borderWidth: 1,
536
+ borderColor: _sharedUi.macOSColors.semantic.warning + "30"
537
+ },
538
+ sizeWarningDanger: {
539
+ backgroundColor: _sharedUi.macOSColors.semantic.errorBackground,
540
+ borderColor: _sharedUi.macOSColors.semantic.error + "30"
541
+ },
542
+ sizeWarningText: {
543
+ fontSize: 11,
544
+ fontWeight: "500",
545
+ flex: 1
546
+ },
547
+ previewScroll: {
548
+ maxHeight: 360
549
+ },
550
+ previewText: {
551
+ fontFamily: "monospace",
552
+ fontSize: 11,
553
+ color: _sharedUi.macOSColors.text.primary,
554
+ lineHeight: 18
555
+ },
556
+ statusLabel: {
557
+ fontSize: 11,
558
+ fontWeight: "600",
559
+ color: _sharedUi.macOSColors.text.muted,
560
+ marginRight: 8
561
+ }
562
+ });
@@ -1 +1,70 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.StatsDisplay=void 0;var _react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_sharedUi=require("@buoy-gg/shared-ui"),_RenderTracker=require("../utils/RenderTracker"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,r){if("function"==typeof WeakMap)var t=new WeakMap,a=new WeakMap;return(_interopRequireWildcard=function(e,r){if(!r&&e&&e.__esModule)return e;var i,o,s={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return s;if(i=r?a:t){if(i.has(e))return i.get(e);i.set(e,s)}for(const r in e)"default"!==r&&{}.hasOwnProperty.call(e,r)&&((o=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,r))&&(o.get||o.set)?i(s,r,o):s[r]=e[r]);return s})(e,r)}function StatsDisplayInner(){const[e,r]=(0,_react.useState)({totalComponents:0,totalRenders:0});return(0,_react.useEffect)(()=>_RenderTracker.RenderTracker.subscribe(()=>{r(_RenderTracker.RenderTracker.getStats())}),[]),(0,_jsxRuntime.jsxs)(_reactNative.View,{nativeID:"__rn_buoy__stats-row",style:styles.headerChip,children:[(0,_jsxRuntime.jsx)(_sharedUi.Activity,{size:12,color:_sharedUi.buoyColors.primary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.headerChipValue,{color:_sharedUi.buoyColors.primary}],children:e.totalComponents})]})}const StatsDisplay=exports.StatsDisplay=(0,_react.memo)(StatsDisplayInner),styles=_reactNative.StyleSheet.create({headerChip:{flexDirection:"row",alignItems:"center",gap:4,backgroundColor:_sharedUi.buoyColors.hover,paddingHorizontal:8,paddingVertical:5,borderRadius:12,borderWidth:1,borderColor:_sharedUi.buoyColors.border},headerChipValue:{fontSize:12,fontWeight:"600",fontFamily:"monospace"}});var _default=exports.default=StatsDisplay;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.StatsDisplay = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _sharedUi = require("@buoy-gg/shared-ui");
10
+ var _RenderTracker = require("../utils/RenderTracker");
11
+ var _jsxRuntime = require("react/jsx-runtime");
12
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
13
+ /**
14
+ * StatsDisplay
15
+ *
16
+ * Isolated component for displaying render statistics in the header.
17
+ * Subscribes to RenderTracker updates independently so parent header
18
+ * doesn't re-render when stats change.
19
+ *
20
+ * Following the optimization guide: move subscriptions to child components.
21
+ */
22
+
23
+ /**
24
+ * Isolated stats display that owns its own subscription.
25
+ * Only this component re-renders when stats change.
26
+ */function StatsDisplayInner() {
27
+ const [stats, setStats] = (0, _react.useState)({
28
+ totalComponents: 0,
29
+ totalRenders: 0
30
+ });
31
+ (0, _react.useEffect)(() => {
32
+ const unsubscribe = _RenderTracker.RenderTracker.subscribe(() => {
33
+ setStats(_RenderTracker.RenderTracker.getStats());
34
+ });
35
+ return unsubscribe;
36
+ }, []);
37
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
38
+ nativeID: "__rn_buoy__stats-row",
39
+ style: styles.headerChip,
40
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Activity, {
41
+ size: 12,
42
+ color: _sharedUi.buoyColors.primary
43
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
44
+ style: [styles.headerChipValue, {
45
+ color: _sharedUi.buoyColors.primary
46
+ }],
47
+ children: stats.totalComponents
48
+ })]
49
+ });
50
+ }
51
+ const StatsDisplay = exports.StatsDisplay = /*#__PURE__*/(0, _react.memo)(StatsDisplayInner);
52
+ const styles = _reactNative.StyleSheet.create({
53
+ headerChip: {
54
+ flexDirection: "row",
55
+ alignItems: "center",
56
+ gap: 4,
57
+ backgroundColor: _sharedUi.buoyColors.hover,
58
+ paddingHorizontal: 8,
59
+ paddingVertical: 5,
60
+ borderRadius: 12,
61
+ borderWidth: 1,
62
+ borderColor: _sharedUi.buoyColors.border
63
+ },
64
+ headerChipValue: {
65
+ fontSize: 12,
66
+ fontWeight: "600",
67
+ fontFamily: "monospace"
68
+ }
69
+ });
70
+ var _default = exports.default = StatsDisplay;