@buoy-gg/highlight-updates 7.0.41 → 7.0.43

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 (108) hide show
  1. package/README.md +11 -71
  2. package/lib/commonjs/highlight-updates/HighlightUpdatesOverlay.js +1 -281
  3. package/lib/commonjs/highlight-updates/components/HighlightFilterView.js +1 -1474
  4. package/lib/commonjs/highlight-updates/components/HighlightUpdatesModal.js +1 -641
  5. package/lib/commonjs/highlight-updates/components/IdentifierBadge.js +1 -273
  6. package/lib/commonjs/highlight-updates/components/IsolatedRenderList.js +1 -188
  7. package/lib/commonjs/highlight-updates/components/ModalHeaderContent.js +1 -293
  8. package/lib/commonjs/highlight-updates/components/RenderCauseBadge.js +1 -508
  9. package/lib/commonjs/highlight-updates/components/RenderDetailView.js +1 -846
  10. package/lib/commonjs/highlight-updates/components/RenderHistoryViewer.js +1 -915
  11. package/lib/commonjs/highlight-updates/components/RenderListItem.js +1 -235
  12. package/lib/commonjs/highlight-updates/components/RendersCopySettingsView.js +1 -469
  13. package/lib/commonjs/highlight-updates/components/StatsDisplay.js +1 -73
  14. package/lib/commonjs/highlight-updates/types/copySettings.js +1 -107
  15. package/lib/commonjs/highlight-updates/utils/CommitProfiler.js +1 -455
  16. package/lib/commonjs/highlight-updates/utils/HighlightUpdatesController.js +1 -1929
  17. package/lib/commonjs/highlight-updates/utils/PerformanceLogger.js +26 -359
  18. package/lib/commonjs/highlight-updates/utils/ProfilerInterceptor.js +1 -371
  19. package/lib/commonjs/highlight-updates/utils/RenderCauseDetector.js +5 -1840
  20. package/lib/commonjs/highlight-updates/utils/RenderTracker.js +1 -952
  21. package/lib/commonjs/highlight-updates/utils/ViewTypeMapper.js +1 -264
  22. package/lib/commonjs/highlight-updates/utils/copySettingsStorage.js +1 -32
  23. package/lib/commonjs/highlight-updates/utils/devtoolsComponentNames.js +1 -188
  24. package/lib/commonjs/highlight-updates/utils/namedComposite.js +1 -41
  25. package/lib/commonjs/highlight-updates/utils/ownStateChanged.js +1 -103
  26. package/lib/commonjs/highlight-updates/utils/rawEventEmitter.js +1 -50
  27. package/lib/commonjs/highlight-updates/utils/rawEventEmitter.web.js +1 -12
  28. package/lib/commonjs/highlight-updates/utils/renderExportFormatter.js +1 -58
  29. package/lib/commonjs/highlight-updates/utils/rendersExportFormatter.js +1 -485
  30. package/lib/commonjs/highlight-updates/utils/screenElements.js +1 -1269
  31. package/lib/commonjs/highlight-updates/utils/tapMatch.js +1 -83
  32. package/lib/commonjs/highlight-updates/utils/testIDs.js +1 -68
  33. package/lib/commonjs/highlight-updates/utils/touchCapture.js +1 -277
  34. package/lib/commonjs/index.js +1 -429
  35. package/lib/commonjs/preset.js +1 -278
  36. package/lib/commonjs/sync/highlightUpdatesSyncAdapter.js +1 -235
  37. package/lib/module/highlight-updates/HighlightUpdatesOverlay.js +1 -274
  38. package/lib/module/highlight-updates/components/HighlightFilterView.js +1 -1468
  39. package/lib/module/highlight-updates/components/HighlightUpdatesModal.js +1 -634
  40. package/lib/module/highlight-updates/components/IdentifierBadge.js +1 -265
  41. package/lib/module/highlight-updates/components/IsolatedRenderList.js +1 -183
  42. package/lib/module/highlight-updates/components/ModalHeaderContent.js +1 -288
  43. package/lib/module/highlight-updates/components/RenderCauseBadge.js +1 -499
  44. package/lib/module/highlight-updates/components/RenderDetailView.js +1 -840
  45. package/lib/module/highlight-updates/components/RenderHistoryViewer.js +1 -908
  46. package/lib/module/highlight-updates/components/RenderListItem.js +1 -230
  47. package/lib/module/highlight-updates/components/RendersCopySettingsView.js +1 -465
  48. package/lib/module/highlight-updates/components/StatsDisplay.js +1 -70
  49. package/lib/module/highlight-updates/types/copySettings.js +1 -102
  50. package/lib/module/highlight-updates/utils/CommitProfiler.js +1 -451
  51. package/lib/module/highlight-updates/utils/HighlightUpdatesController.js +1 -1925
  52. package/lib/module/highlight-updates/utils/PerformanceLogger.js +26 -353
  53. package/lib/module/highlight-updates/utils/ProfilerInterceptor.js +1 -358
  54. package/lib/module/highlight-updates/utils/RenderCauseDetector.js +5 -1830
  55. package/lib/module/highlight-updates/utils/RenderTracker.js +1 -949
  56. package/lib/module/highlight-updates/utils/ViewTypeMapper.js +1 -255
  57. package/lib/module/highlight-updates/utils/copySettingsStorage.js +1 -26
  58. package/lib/module/highlight-updates/utils/devtoolsComponentNames.js +1 -178
  59. package/lib/module/highlight-updates/utils/namedComposite.js +1 -36
  60. package/lib/module/highlight-updates/utils/ownStateChanged.js +1 -98
  61. package/lib/module/highlight-updates/utils/rawEventEmitter.js +1 -46
  62. package/lib/module/highlight-updates/utils/rawEventEmitter.web.js +1 -3
  63. package/lib/module/highlight-updates/utils/renderExportFormatter.js +1 -54
  64. package/lib/module/highlight-updates/utils/rendersExportFormatter.js +1 -478
  65. package/lib/module/highlight-updates/utils/screenElements.js +1 -1263
  66. package/lib/module/highlight-updates/utils/tapMatch.js +1 -76
  67. package/lib/module/highlight-updates/utils/testIDs.js +1 -60
  68. package/lib/module/highlight-updates/utils/touchCapture.js +1 -270
  69. package/lib/module/index.js +1 -130
  70. package/lib/module/preset.js +1 -272
  71. package/lib/module/sync/highlightUpdatesSyncAdapter.js +1 -230
  72. package/lib/web/index.mjs +28 -29
  73. package/package.json +7 -11
  74. package/lib/typescript/highlight-updates/HighlightUpdatesOverlay.d.ts.map +0 -1
  75. package/lib/typescript/highlight-updates/components/HighlightFilterView.d.ts.map +0 -1
  76. package/lib/typescript/highlight-updates/components/HighlightUpdatesModal.d.ts.map +0 -1
  77. package/lib/typescript/highlight-updates/components/IdentifierBadge.d.ts.map +0 -1
  78. package/lib/typescript/highlight-updates/components/IsolatedRenderList.d.ts.map +0 -1
  79. package/lib/typescript/highlight-updates/components/ModalHeaderContent.d.ts.map +0 -1
  80. package/lib/typescript/highlight-updates/components/RenderCauseBadge.d.ts.map +0 -1
  81. package/lib/typescript/highlight-updates/components/RenderDetailView.d.ts.map +0 -1
  82. package/lib/typescript/highlight-updates/components/RenderHistoryViewer.d.ts.map +0 -1
  83. package/lib/typescript/highlight-updates/components/RenderListItem.d.ts.map +0 -1
  84. package/lib/typescript/highlight-updates/components/RendersCopySettingsView.d.ts.map +0 -1
  85. package/lib/typescript/highlight-updates/components/StatsDisplay.d.ts.map +0 -1
  86. package/lib/typescript/highlight-updates/types/copySettings.d.ts.map +0 -1
  87. package/lib/typescript/highlight-updates/utils/CommitProfiler.d.ts.map +0 -1
  88. package/lib/typescript/highlight-updates/utils/HighlightUpdatesController.d.ts.map +0 -1
  89. package/lib/typescript/highlight-updates/utils/PerformanceLogger.d.ts.map +0 -1
  90. package/lib/typescript/highlight-updates/utils/ProfilerInterceptor.d.ts.map +0 -1
  91. package/lib/typescript/highlight-updates/utils/RenderCauseDetector.d.ts.map +0 -1
  92. package/lib/typescript/highlight-updates/utils/RenderTracker.d.ts.map +0 -1
  93. package/lib/typescript/highlight-updates/utils/ViewTypeMapper.d.ts.map +0 -1
  94. package/lib/typescript/highlight-updates/utils/copySettingsStorage.d.ts.map +0 -1
  95. package/lib/typescript/highlight-updates/utils/devtoolsComponentNames.d.ts.map +0 -1
  96. package/lib/typescript/highlight-updates/utils/namedComposite.d.ts.map +0 -1
  97. package/lib/typescript/highlight-updates/utils/ownStateChanged.d.ts.map +0 -1
  98. package/lib/typescript/highlight-updates/utils/rawEventEmitter.d.ts.map +0 -1
  99. package/lib/typescript/highlight-updates/utils/rawEventEmitter.web.d.ts.map +0 -1
  100. package/lib/typescript/highlight-updates/utils/renderExportFormatter.d.ts.map +0 -1
  101. package/lib/typescript/highlight-updates/utils/rendersExportFormatter.d.ts.map +0 -1
  102. package/lib/typescript/highlight-updates/utils/screenElements.d.ts.map +0 -1
  103. package/lib/typescript/highlight-updates/utils/tapMatch.d.ts.map +0 -1
  104. package/lib/typescript/highlight-updates/utils/testIDs.d.ts.map +0 -1
  105. package/lib/typescript/highlight-updates/utils/touchCapture.d.ts.map +0 -1
  106. package/lib/typescript/index.d.ts.map +0 -1
  107. package/lib/typescript/preset.d.ts.map +0 -1
  108. package/lib/typescript/sync/highlightUpdatesSyncAdapter.d.ts.map +0 -1
@@ -1,499 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * RenderCauseBadge
5
- *
6
- * Displays a colored badge indicating why a component rendered.
7
- * Used in RenderListItem and RenderDetailView.
8
- *
9
- * TWO-LEVEL CAUSATION:
10
- * Shows both the native-level cause (what props changed on the native view)
11
- * and the component-level cause (why the React component re-rendered).
12
- */
13
-
14
- import React from "react";
15
- import { View, Text, StyleSheet } from "react-native";
16
- import { buoyColors, night, monoFont } from "@buoy-gg/shared-ui";
17
-
18
- // Badge configuration for each cause type
19
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
20
- export const CAUSE_CONFIG = {
21
- mount: {
22
- label: "MOUNT",
23
- color: buoyColors.success,
24
- tip: "First render of this component."
25
- },
26
- props: {
27
- label: "PROPS",
28
- color: buoyColors.warning,
29
- tip: "Native props changed. Consider React.memo() or useCallback for handlers."
30
- },
31
- state: {
32
- label: "STATE",
33
- color: "#a855f7",
34
- // purple
35
- tip: "Component state changed via setState."
36
- },
37
- hooks: {
38
- label: "HOOKS",
39
- color: "#ec4899",
40
- // pink
41
- tip: "Hook values changed (useState, useReducer, useMemo, etc.)."
42
- },
43
- context: {
44
- label: "CONTEXT",
45
- color: "#06b6d4",
46
- // cyan
47
- tip: "React context value changed."
48
- },
49
- parent: {
50
- label: "PARENT",
51
- color: buoyColors.textSecondary,
52
- tip: "Parent component re-rendered. Consider wrapping with React.memo()."
53
- },
54
- unknown: {
55
- label: "?",
56
- color: buoyColors.textMuted,
57
- tip: "Could not determine render cause."
58
- }
59
- };
60
-
61
- // Component-level cause configuration
62
- export const COMPONENT_CAUSE_CONFIG = {
63
- mount: {
64
- label: "mount",
65
- color: buoyColors.success,
66
- tip: "First render of this component."
67
- },
68
- props: {
69
- label: "props",
70
- color: buoyColors.warning,
71
- tip: "Component received different props from parent."
72
- },
73
- state: {
74
- label: "state",
75
- color: "#a855f7",
76
- // purple
77
- tip: "Component's own state changed (useState/useReducer)."
78
- },
79
- parent: {
80
- label: "parent",
81
- color: buoyColors.textSecondary,
82
- tip: "Parent re-rendered but this component's props/state didn't change. Consider React.memo()."
83
- },
84
- unknown: {
85
- label: "?",
86
- color: buoyColors.textMuted,
87
- tip: "Could not determine component render cause."
88
- }
89
- };
90
- export function RenderCauseBadge({
91
- cause,
92
- compact = false,
93
- showKeys = false,
94
- showTwoLevel = false,
95
- testID
96
- }) {
97
- const config = CAUSE_CONFIG[cause.type];
98
- const componentConfig = cause.componentCause ? COMPONENT_CAUSE_CONFIG[cause.componentCause] : null;
99
-
100
- // For two-level display: "Component (parent) → Native (PROPS)"
101
- const showComponentCause = showTwoLevel && componentConfig && cause.componentCause !== cause.type;
102
- return /*#__PURE__*/_jsxs(View, {
103
- nativeID: "__rn_buoy__cause-badge",
104
- testID: testID,
105
- style: [styles.container, compact && styles.containerCompact],
106
- children: [showComponentCause && /*#__PURE__*/_jsxs(_Fragment, {
107
- children: [/*#__PURE__*/_jsx(View, {
108
- style: [styles.badge, compact && styles.badgeCompact, styles.componentBadge, {
109
- backgroundColor: componentConfig.color + "15"
110
- }],
111
- children: /*#__PURE__*/_jsx(Text, {
112
- testID: testID ? `${testID}-component` : undefined,
113
- style: [styles.badgeText, compact && styles.badgeTextCompact, styles.componentBadgeText, {
114
- color: componentConfig.color
115
- }],
116
- children: componentConfig.label
117
- })
118
- }), /*#__PURE__*/_jsx(Text, {
119
- style: [styles.arrowText, compact && styles.arrowTextCompact],
120
- children: "\u2192"
121
- })]
122
- }), /*#__PURE__*/_jsx(View, {
123
- style: [styles.badge, compact && styles.badgeCompact, {
124
- backgroundColor: config.color + "20"
125
- }],
126
- children: /*#__PURE__*/_jsx(Text, {
127
- testID: testID ? `${testID}-native` : undefined,
128
- style: [styles.badgeText, compact && styles.badgeTextCompact, {
129
- color: config.color
130
- }],
131
- children: config.label
132
- })
133
- }), showKeys && cause.changedKeys && cause.changedKeys.length > 0 && /*#__PURE__*/_jsx(Text, {
134
- testID: testID ? `${testID}-keys` : undefined,
135
- style: [styles.keysText, compact && styles.keysTextCompact],
136
- numberOfLines: 1,
137
- children: cause.changedKeys.join(", ")
138
- }), showKeys && cause.hookIndices && cause.hookIndices.length > 0 && /*#__PURE__*/_jsxs(Text, {
139
- testID: testID ? `${testID}-hooks` : undefined,
140
- style: [styles.keysText, compact && styles.keysTextCompact],
141
- numberOfLines: 1,
142
- children: ["Hook ", cause.hookIndices.join(", ")]
143
- })]
144
- });
145
- }
146
-
147
- /**
148
- * TwoLevelCauseBadge - A more detailed badge for detail views
149
- * Shows: "ComponentName re-rendered due to PARENT → native PROPS [style]"
150
- */
151
- export function TwoLevelCauseBadge({
152
- cause
153
- }) {
154
- const nativeConfig = CAUSE_CONFIG[cause.type];
155
- const componentConfig = cause.componentCause ? COMPONENT_CAUSE_CONFIG[cause.componentCause] : null;
156
- const componentName = cause.componentName || "Component";
157
- return /*#__PURE__*/_jsxs(View, {
158
- nativeID: "__rn_buoy__two-level-cause",
159
- style: styles.twoLevelContainer,
160
- children: [componentConfig && /*#__PURE__*/_jsxs(View, {
161
- style: styles.twoLevelRow,
162
- children: [/*#__PURE__*/_jsx(Text, {
163
- style: styles.twoLevelLabel,
164
- children: "Component:"
165
- }), /*#__PURE__*/_jsx(Text, {
166
- style: styles.twoLevelName,
167
- children: componentName
168
- }), /*#__PURE__*/_jsx(Text, {
169
- style: styles.twoLevelText,
170
- children: "re-rendered due to"
171
- }), /*#__PURE__*/_jsx(View, {
172
- style: [styles.badge, {
173
- backgroundColor: componentConfig.color + "20"
174
- }],
175
- children: /*#__PURE__*/_jsx(Text, {
176
- style: [styles.badgeText, {
177
- color: componentConfig.color
178
- }],
179
- children: componentConfig.label.toUpperCase()
180
- })
181
- })]
182
- }), /*#__PURE__*/_jsxs(View, {
183
- style: styles.twoLevelRow,
184
- children: [/*#__PURE__*/_jsx(Text, {
185
- style: styles.twoLevelLabel,
186
- children: "Native:"
187
- }), /*#__PURE__*/_jsx(View, {
188
- style: [styles.badge, {
189
- backgroundColor: nativeConfig.color + "20"
190
- }],
191
- children: /*#__PURE__*/_jsx(Text, {
192
- style: [styles.badgeText, {
193
- color: nativeConfig.color
194
- }],
195
- children: nativeConfig.label
196
- })
197
- }), cause.changedKeys && cause.changedKeys.length > 0 && /*#__PURE__*/_jsxs(Text, {
198
- style: styles.twoLevelKeys,
199
- children: ["[", cause.changedKeys.join(", "), "]"]
200
- })]
201
- })]
202
- });
203
- }
204
-
205
- /**
206
- * EnhancedCauseDisplay - Phase 5: Comprehensive cause display
207
- * Shows detailed breakdown of why a component rendered with clear sections
208
- */
209
- export function EnhancedCauseDisplay({
210
- cause,
211
- nativeType
212
- }) {
213
- const nativeConfig = CAUSE_CONFIG[cause.type];
214
- const componentConfig = cause.componentCause ? COMPONENT_CAUSE_CONFIG[cause.componentCause] : null;
215
- const componentName = cause.componentName || "Unknown";
216
- const hasHookChanges = cause.hookChanges && cause.hookChanges.length > 0;
217
- const hasChangedKeys = cause.changedKeys && cause.changedKeys.length > 0;
218
-
219
- // Separate ref-only changes from actual value changes
220
- const refOnlyChanges = cause.changedKeys?.filter(k => k.includes("(ref only)") || k.includes("(fn ref)")) || [];
221
- const valueChanges = cause.changedKeys?.filter(k => !k.includes("(ref only)") && !k.includes("(fn ref)")) || [];
222
- return /*#__PURE__*/_jsxs(View, {
223
- nativeID: "__rn_buoy__enhanced-cause",
224
- style: styles.enhancedContainer,
225
- children: [/*#__PURE__*/_jsxs(View, {
226
- style: styles.enhancedHeader,
227
- children: [/*#__PURE__*/_jsx(Text, {
228
- style: styles.enhancedComponentName,
229
- children: componentName
230
- }), nativeType && /*#__PURE__*/_jsx(View, {
231
- style: styles.enhancedNativeTag,
232
- children: /*#__PURE__*/_jsx(Text, {
233
- style: styles.enhancedNativeTagText,
234
- children: nativeType
235
- })
236
- })]
237
- }), /*#__PURE__*/_jsxs(View, {
238
- style: styles.enhancedFlowContainer,
239
- children: [/*#__PURE__*/_jsx(Text, {
240
- style: styles.enhancedFlowLabel,
241
- children: "Cause:"
242
- }), componentConfig && /*#__PURE__*/_jsx(View, {
243
- style: [styles.enhancedFlowBadge, {
244
- backgroundColor: componentConfig.color + "20"
245
- }],
246
- children: /*#__PURE__*/_jsx(Text, {
247
- style: [styles.enhancedFlowBadgeText, {
248
- color: componentConfig.color
249
- }],
250
- children: componentConfig.label.toUpperCase()
251
- })
252
- }), /*#__PURE__*/_jsx(Text, {
253
- style: styles.enhancedFlowArrow,
254
- children: "\u2192"
255
- }), /*#__PURE__*/_jsx(View, {
256
- style: [styles.enhancedFlowBadge, {
257
- backgroundColor: nativeConfig.color + "20"
258
- }],
259
- children: /*#__PURE__*/_jsx(Text, {
260
- style: [styles.enhancedFlowBadgeText, {
261
- color: nativeConfig.color
262
- }],
263
- children: nativeConfig.label
264
- })
265
- })]
266
- }), hasHookChanges && /*#__PURE__*/_jsxs(View, {
267
- style: styles.enhancedSection,
268
- children: [/*#__PURE__*/_jsx(Text, {
269
- style: styles.enhancedSectionTitle,
270
- children: "Component State Changed:"
271
- }), cause.hookChanges.map(hook => /*#__PURE__*/_jsxs(View, {
272
- style: styles.enhancedChangeRow,
273
- children: [/*#__PURE__*/_jsx(Text, {
274
- style: styles.enhancedChangeIcon,
275
- children: "\u26A1"
276
- }), /*#__PURE__*/_jsxs(Text, {
277
- style: styles.enhancedChangeText,
278
- children: ["Hook[", hook.index, "] (", hook.type, "): ", hook.description]
279
- })]
280
- }, hook.index))]
281
- }), valueChanges.length > 0 && /*#__PURE__*/_jsxs(View, {
282
- style: styles.enhancedSection,
283
- children: [/*#__PURE__*/_jsx(Text, {
284
- style: styles.enhancedSectionTitle,
285
- children: "Native Props Changed:"
286
- }), valueChanges.map((key, index) => /*#__PURE__*/_jsxs(View, {
287
- style: styles.enhancedChangeRow,
288
- children: [/*#__PURE__*/_jsx(Text, {
289
- style: styles.enhancedChangeIcon,
290
- children: "~"
291
- }), /*#__PURE__*/_jsx(Text, {
292
- style: styles.enhancedChangeText,
293
- children: key
294
- })]
295
- }, index))]
296
- }), refOnlyChanges.length > 0 && /*#__PURE__*/_jsxs(View, {
297
- style: styles.enhancedSection,
298
- children: [/*#__PURE__*/_jsx(Text, {
299
- style: [styles.enhancedSectionTitle, {
300
- color: night.color.textTertiary
301
- }],
302
- children: "Reference Changes (optimization opportunity):"
303
- }), refOnlyChanges.map((key, index) => /*#__PURE__*/_jsxs(View, {
304
- style: styles.enhancedChangeRow,
305
- children: [/*#__PURE__*/_jsx(Text, {
306
- style: [styles.enhancedChangeIcon, {
307
- color: night.color.textTertiary
308
- }],
309
- children: "\u25CB"
310
- }), /*#__PURE__*/_jsx(Text, {
311
- style: [styles.enhancedChangeText, {
312
- color: night.color.textTertiary
313
- }],
314
- children: key
315
- })]
316
- }, index))]
317
- }), !hasHookChanges && !hasChangedKeys && cause.type !== "mount" && /*#__PURE__*/_jsx(View, {
318
- style: styles.enhancedSection,
319
- children: /*#__PURE__*/_jsx(Text, {
320
- style: styles.enhancedNoChanges,
321
- children: cause.type === "parent" ? "Parent re-rendered (consider React.memo)" : "No specific changes detected"
322
- })
323
- })]
324
- });
325
- }
326
- const styles = StyleSheet.create({
327
- container: {
328
- flexDirection: "row",
329
- alignItems: "center",
330
- gap: 6
331
- },
332
- containerCompact: {
333
- gap: 4
334
- },
335
- badge: {
336
- paddingVertical: 3,
337
- paddingHorizontal: 6,
338
- borderRadius: 4
339
- },
340
- badgeCompact: {
341
- paddingVertical: 2,
342
- paddingHorizontal: 5
343
- },
344
- componentBadge: {
345
- borderStyle: "dashed",
346
- borderWidth: 1,
347
- borderColor: night.color.border
348
- },
349
- badgeText: {
350
- fontSize: 10,
351
- fontWeight: "700"
352
- },
353
- badgeTextCompact: {
354
- fontSize: 9
355
- },
356
- componentBadgeText: {
357
- fontWeight: "500",
358
- textTransform: "lowercase"
359
- },
360
- arrowText: {
361
- fontSize: 10,
362
- color: night.color.textTertiary
363
- },
364
- arrowTextCompact: {
365
- fontSize: 9
366
- },
367
- keysText: {
368
- fontSize: 11,
369
- color: night.color.textSecondary,
370
- fontFamily: monoFont,
371
- flex: 1
372
- },
373
- keysTextCompact: {
374
- fontSize: 10
375
- },
376
- // Two-level badge styles
377
- twoLevelContainer: {
378
- gap: 8
379
- },
380
- twoLevelRow: {
381
- flexDirection: "row",
382
- alignItems: "center",
383
- flexWrap: "wrap",
384
- gap: 6
385
- },
386
- twoLevelLabel: {
387
- fontSize: 11,
388
- fontWeight: "600",
389
- color: night.color.textSecondary,
390
- minWidth: 70
391
- },
392
- twoLevelName: {
393
- fontSize: 11,
394
- fontWeight: "600",
395
- color: night.color.text,
396
- fontFamily: monoFont
397
- },
398
- twoLevelText: {
399
- fontSize: 11,
400
- color: night.color.textSecondary
401
- },
402
- twoLevelKeys: {
403
- fontSize: 10,
404
- color: night.color.textSecondary,
405
- fontFamily: monoFont
406
- },
407
- // Enhanced cause display styles (Phase 5)
408
- enhancedContainer: {
409
- gap: 12
410
- },
411
- enhancedHeader: {
412
- flexDirection: "row",
413
- alignItems: "center",
414
- justifyContent: "space-between",
415
- gap: 8
416
- },
417
- enhancedComponentName: {
418
- fontSize: 14,
419
- fontWeight: "700",
420
- color: night.color.text,
421
- fontFamily: monoFont
422
- },
423
- enhancedNativeTag: {
424
- // Inset display chip — the night track color.
425
- backgroundColor: night.color.bg,
426
- paddingVertical: 2,
427
- paddingHorizontal: 6,
428
- borderRadius: 4
429
- },
430
- enhancedNativeTagText: {
431
- fontSize: 10,
432
- fontWeight: "600",
433
- color: night.color.textTertiary,
434
- fontFamily: monoFont
435
- },
436
- enhancedFlowContainer: {
437
- flexDirection: "row",
438
- alignItems: "center",
439
- gap: 8,
440
- paddingVertical: 8,
441
- paddingHorizontal: 12,
442
- // Inset display box — the night track color.
443
- backgroundColor: night.color.bg,
444
- borderRadius: 6
445
- },
446
- enhancedFlowLabel: {
447
- fontSize: 11,
448
- fontWeight: "600",
449
- color: night.color.textSecondary
450
- },
451
- enhancedFlowBadge: {
452
- paddingVertical: 3,
453
- paddingHorizontal: 8,
454
- borderRadius: 4
455
- },
456
- enhancedFlowBadgeText: {
457
- fontSize: 10,
458
- fontWeight: "700"
459
- },
460
- enhancedFlowArrow: {
461
- fontSize: 14,
462
- color: night.color.textTertiary,
463
- fontWeight: "300"
464
- },
465
- enhancedSection: {
466
- gap: 6
467
- },
468
- enhancedSectionTitle: {
469
- fontSize: 11,
470
- fontWeight: "600",
471
- color: night.color.textSecondary,
472
- letterSpacing: 0.3
473
- },
474
- enhancedChangeRow: {
475
- flexDirection: "row",
476
- alignItems: "flex-start",
477
- gap: 6,
478
- paddingLeft: 4
479
- },
480
- enhancedChangeIcon: {
481
- fontSize: 12,
482
- color: night.color.warning,
483
- fontFamily: monoFont,
484
- width: 16
485
- },
486
- enhancedChangeText: {
487
- fontSize: 12,
488
- color: night.color.text,
489
- fontFamily: monoFont,
490
- flex: 1
491
- },
492
- enhancedNoChanges: {
493
- fontSize: 12,
494
- color: night.color.textTertiary,
495
- fontStyle: "italic",
496
- paddingLeft: 4
497
- }
498
- });
499
- export default RenderCauseBadge;
1
+ "use strict";import T from"react";import{View as r,Text as t,StyleSheet as b}from"react-native";import{buoyColors as g,night as l,monoFont as p}from"@buoy-gg/shared-ui";import{jsx as o,Fragment as w,jsxs as a}from"react/jsx-runtime";export const CAUSE_CONFIG={mount:{label:"MOUNT",color:g.success,tip:"First render of this component."},props:{label:"PROPS",color:g.warning,tip:"Native props changed. Consider React.memo() or useCallback for handlers."},state:{label:"STATE",color:"#a855f7",tip:"Component state changed via setState."},hooks:{label:"HOOKS",color:"#ec4899",tip:"Hook values changed (useState, useReducer, useMemo, etc.)."},context:{label:"CONTEXT",color:"#06b6d4",tip:"React context value changed."},parent:{label:"PARENT",color:g.textSecondary,tip:"Parent component re-rendered. Consider wrapping with React.memo()."},unknown:{label:"?",color:g.textMuted,tip:"Could not determine render cause."}};export const COMPONENT_CAUSE_CONFIG={mount:{label:"mount",color:g.success,tip:"First render of this component."},props:{label:"props",color:g.warning,tip:"Component received different props from parent."},state:{label:"state",color:"#a855f7",tip:"Component's own state changed (useState/useReducer)."},parent:{label:"parent",color:g.textSecondary,tip:"Parent re-rendered but this component's props/state didn't change. Consider React.memo()."},unknown:{label:"?",color:g.textMuted,tip:"Could not determine component render cause."}};export function RenderCauseBadge({cause:n,compact:c=false,showKeys:i=false,showTwoLevel:s=false,testID:h}){const y=CAUSE_CONFIG[n.type];const C=n.componentCause?COMPONENT_CAUSE_CONFIG[n.componentCause]:null;const m=s&&C&&n.componentCause!==n.type;return a(r,{nativeID:"__rn_buoy__cause-badge",testID:h,style:[e.container,c&&e.containerCompact],children:[m&&a(w,{children:[o(r,{style:[e.badge,c&&e.badgeCompact,e.componentBadge,{backgroundColor:C.color+"15"}],children:o(t,{testID:h?`${h}-component`:void 0,style:[e.badgeText,c&&e.badgeTextCompact,e.componentBadgeText,{color:C.color}],children:C.label})}),o(t,{style:[e.arrowText,c&&e.arrowTextCompact],children:"\u2192"})]}),o(r,{style:[e.badge,c&&e.badgeCompact,{backgroundColor:y.color+"20"}],children:o(t,{testID:h?`${h}-native`:void 0,style:[e.badgeText,c&&e.badgeTextCompact,{color:y.color}],children:y.label})}),i&&n.changedKeys&&n.changedKeys.length>0&&o(t,{testID:h?`${h}-keys`:void 0,style:[e.keysText,c&&e.keysTextCompact],numberOfLines:1,children:n.changedKeys.join(", ")}),i&&n.hookIndices&&n.hookIndices.length>0&&a(t,{testID:h?`${h}-hooks`:void 0,style:[e.keysText,c&&e.keysTextCompact],numberOfLines:1,children:["Hook ",n.hookIndices.join(", ")]})]})}export function TwoLevelCauseBadge({cause:n}){const c=CAUSE_CONFIG[n.type];const i=n.componentCause?COMPONENT_CAUSE_CONFIG[n.componentCause]:null;const s=n.componentName||"Component";return a(r,{nativeID:"__rn_buoy__two-level-cause",style:e.twoLevelContainer,children:[i&&a(r,{style:e.twoLevelRow,children:[o(t,{style:e.twoLevelLabel,children:"Component:"}),o(t,{style:e.twoLevelName,children:s}),o(t,{style:e.twoLevelText,children:"re-rendered due to"}),o(r,{style:[e.badge,{backgroundColor:i.color+"20"}],children:o(t,{style:[e.badgeText,{color:i.color}],children:i.label.toUpperCase()})})]}),a(r,{style:e.twoLevelRow,children:[o(t,{style:e.twoLevelLabel,children:"Native:"}),o(r,{style:[e.badge,{backgroundColor:c.color+"20"}],children:o(t,{style:[e.badgeText,{color:c.color}],children:c.label})}),n.changedKeys&&n.changedKeys.length>0&&a(t,{style:e.twoLevelKeys,children:["[",n.changedKeys.join(", "),"]"]})]})]})}export function EnhancedCauseDisplay({cause:n,nativeType:c}){const i=CAUSE_CONFIG[n.type];const s=n.componentCause?COMPONENT_CAUSE_CONFIG[n.componentCause]:null;const h=n.componentName||"Unknown";const y=n.hookChanges&&n.hookChanges.length>0;const C=n.changedKeys&&n.changedKeys.length>0;const m=n.changedKeys?.filter(d=>d.includes("(ref only)")||d.includes("(fn ref)"))||[];const x=n.changedKeys?.filter(d=>!d.includes("(ref only)")&&!d.includes("(fn ref)"))||[];return a(r,{nativeID:"__rn_buoy__enhanced-cause",style:e.enhancedContainer,children:[a(r,{style:e.enhancedHeader,children:[o(t,{style:e.enhancedComponentName,children:h}),c&&o(r,{style:e.enhancedNativeTag,children:o(t,{style:e.enhancedNativeTagText,children:c})})]}),a(r,{style:e.enhancedFlowContainer,children:[o(t,{style:e.enhancedFlowLabel,children:"Cause:"}),s&&o(r,{style:[e.enhancedFlowBadge,{backgroundColor:s.color+"20"}],children:o(t,{style:[e.enhancedFlowBadgeText,{color:s.color}],children:s.label.toUpperCase()})}),o(t,{style:e.enhancedFlowArrow,children:"\u2192"}),o(r,{style:[e.enhancedFlowBadge,{backgroundColor:i.color+"20"}],children:o(t,{style:[e.enhancedFlowBadgeText,{color:i.color}],children:i.label})})]}),y&&a(r,{style:e.enhancedSection,children:[o(t,{style:e.enhancedSectionTitle,children:"Component State Changed:"}),n.hookChanges.map(d=>a(r,{style:e.enhancedChangeRow,children:[o(t,{style:e.enhancedChangeIcon,children:"\u26A1"}),a(t,{style:e.enhancedChangeText,children:["Hook[",d.index,"] (",d.type,"): ",d.description]})]},d.index))]}),x.length>0&&a(r,{style:e.enhancedSection,children:[o(t,{style:e.enhancedSectionTitle,children:"Native Props Changed:"}),x.map((d,f)=>a(r,{style:e.enhancedChangeRow,children:[o(t,{style:e.enhancedChangeIcon,children:"~"}),o(t,{style:e.enhancedChangeText,children:d})]},f))]}),m.length>0&&a(r,{style:e.enhancedSection,children:[o(t,{style:[e.enhancedSectionTitle,{color:l.color.textTertiary}],children:"Reference Changes (optimization opportunity):"}),m.map((d,f)=>a(r,{style:e.enhancedChangeRow,children:[o(t,{style:[e.enhancedChangeIcon,{color:l.color.textTertiary}],children:"\u25CB"}),o(t,{style:[e.enhancedChangeText,{color:l.color.textTertiary}],children:d})]},f))]}),!y&&!C&&n.type!=="mount"&&o(r,{style:e.enhancedSection,children:o(t,{style:e.enhancedNoChanges,children:n.type==="parent"?"Parent re-rendered (consider React.memo)":"No specific changes detected"})})]})}const e=b.create({container:{flexDirection:"row",alignItems:"center",gap:6},containerCompact:{gap:4},badge:{paddingVertical:3,paddingHorizontal:6,borderRadius:4},badgeCompact:{paddingVertical:2,paddingHorizontal:5},componentBadge:{borderStyle:"dashed",borderWidth:1,borderColor:l.color.border},badgeText:{fontSize:10,fontWeight:"700"},badgeTextCompact:{fontSize:9},componentBadgeText:{fontWeight:"500",textTransform:"lowercase"},arrowText:{fontSize:10,color:l.color.textTertiary},arrowTextCompact:{fontSize:9},keysText:{fontSize:11,color:l.color.textSecondary,fontFamily:p,flex:1},keysTextCompact:{fontSize:10},twoLevelContainer:{gap:8},twoLevelRow:{flexDirection:"row",alignItems:"center",flexWrap:"wrap",gap:6},twoLevelLabel:{fontSize:11,fontWeight:"600",color:l.color.textSecondary,minWidth:70},twoLevelName:{fontSize:11,fontWeight:"600",color:l.color.text,fontFamily:p},twoLevelText:{fontSize:11,color:l.color.textSecondary},twoLevelKeys:{fontSize:10,color:l.color.textSecondary,fontFamily:p},enhancedContainer:{gap:12},enhancedHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8},enhancedComponentName:{fontSize:14,fontWeight:"700",color:l.color.text,fontFamily:p},enhancedNativeTag:{backgroundColor:l.color.bg,paddingVertical:2,paddingHorizontal:6,borderRadius:4},enhancedNativeTagText:{fontSize:10,fontWeight:"600",color:l.color.textTertiary,fontFamily:p},enhancedFlowContainer:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:8,paddingHorizontal:12,backgroundColor:l.color.bg,borderRadius:6},enhancedFlowLabel:{fontSize:11,fontWeight:"600",color:l.color.textSecondary},enhancedFlowBadge:{paddingVertical:3,paddingHorizontal:8,borderRadius:4},enhancedFlowBadgeText:{fontSize:10,fontWeight:"700"},enhancedFlowArrow:{fontSize:14,color:l.color.textTertiary,fontWeight:"300"},enhancedSection:{gap:6},enhancedSectionTitle:{fontSize:11,fontWeight:"600",color:l.color.textSecondary,letterSpacing:.3},enhancedChangeRow:{flexDirection:"row",alignItems:"flex-start",gap:6,paddingLeft:4},enhancedChangeIcon:{fontSize:12,color:l.color.warning,fontFamily:p,width:16},enhancedChangeText:{fontSize:12,color:l.color.text,fontFamily:p,flex:1},enhancedNoChanges:{fontSize:12,color:l.color.textTertiary,fontStyle:"italic",paddingLeft:4}});export default RenderCauseBadge;