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