@buoy-gg/highlight-updates 7.0.36 → 7.0.38

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 (104) hide show
  1. package/README.md +28 -6
  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 -466
  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 -446
  16. package/lib/commonjs/highlight-updates/utils/HighlightUpdatesController.js +1 -1920
  17. package/lib/commonjs/highlight-updates/utils/PerformanceLogger.js +1 -359
  18. package/lib/commonjs/highlight-updates/utils/ProfilerInterceptor.js +1 -371
  19. package/lib/commonjs/highlight-updates/utils/RenderCauseDetector.js +1 -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/renderExportFormatter.js +1 -58
  28. package/lib/commonjs/highlight-updates/utils/rendersExportFormatter.js +1 -485
  29. package/lib/commonjs/highlight-updates/utils/screenElements.js +1 -1248
  30. package/lib/commonjs/highlight-updates/utils/tapMatch.js +1 -83
  31. package/lib/commonjs/highlight-updates/utils/testIDs.js +1 -68
  32. package/lib/commonjs/highlight-updates/utils/touchCapture.js +1 -277
  33. package/lib/commonjs/index.js +1 -429
  34. package/lib/commonjs/preset.js +1 -278
  35. package/lib/commonjs/sync/highlightUpdatesSyncAdapter.js +1 -235
  36. package/lib/module/highlight-updates/HighlightUpdatesOverlay.js +1 -274
  37. package/lib/module/highlight-updates/components/HighlightFilterView.js +1 -1468
  38. package/lib/module/highlight-updates/components/HighlightUpdatesModal.js +1 -634
  39. package/lib/module/highlight-updates/components/IdentifierBadge.js +1 -265
  40. package/lib/module/highlight-updates/components/IsolatedRenderList.js +1 -183
  41. package/lib/module/highlight-updates/components/ModalHeaderContent.js +1 -288
  42. package/lib/module/highlight-updates/components/RenderCauseBadge.js +1 -499
  43. package/lib/module/highlight-updates/components/RenderDetailView.js +1 -840
  44. package/lib/module/highlight-updates/components/RenderHistoryViewer.js +1 -908
  45. package/lib/module/highlight-updates/components/RenderListItem.js +1 -230
  46. package/lib/module/highlight-updates/components/RendersCopySettingsView.js +1 -462
  47. package/lib/module/highlight-updates/components/StatsDisplay.js +1 -70
  48. package/lib/module/highlight-updates/types/copySettings.js +1 -102
  49. package/lib/module/highlight-updates/utils/CommitProfiler.js +1 -442
  50. package/lib/module/highlight-updates/utils/HighlightUpdatesController.js +1 -1916
  51. package/lib/module/highlight-updates/utils/PerformanceLogger.js +1 -353
  52. package/lib/module/highlight-updates/utils/ProfilerInterceptor.js +1 -358
  53. package/lib/module/highlight-updates/utils/RenderCauseDetector.js +1 -1830
  54. package/lib/module/highlight-updates/utils/RenderTracker.js +1 -949
  55. package/lib/module/highlight-updates/utils/ViewTypeMapper.js +1 -255
  56. package/lib/module/highlight-updates/utils/copySettingsStorage.js +1 -26
  57. package/lib/module/highlight-updates/utils/devtoolsComponentNames.js +1 -178
  58. package/lib/module/highlight-updates/utils/namedComposite.js +1 -36
  59. package/lib/module/highlight-updates/utils/ownStateChanged.js +1 -98
  60. package/lib/module/highlight-updates/utils/rawEventEmitter.js +1 -46
  61. package/lib/module/highlight-updates/utils/renderExportFormatter.js +1 -54
  62. package/lib/module/highlight-updates/utils/rendersExportFormatter.js +1 -478
  63. package/lib/module/highlight-updates/utils/screenElements.js +1 -1242
  64. package/lib/module/highlight-updates/utils/tapMatch.js +1 -76
  65. package/lib/module/highlight-updates/utils/testIDs.js +1 -60
  66. package/lib/module/highlight-updates/utils/touchCapture.js +1 -270
  67. package/lib/module/index.js +1 -130
  68. package/lib/module/preset.js +1 -272
  69. package/lib/module/sync/highlightUpdatesSyncAdapter.js +1 -230
  70. package/package.json +8 -8
  71. package/lib/typescript/highlight-updates/HighlightUpdatesOverlay.d.ts.map +0 -1
  72. package/lib/typescript/highlight-updates/components/HighlightFilterView.d.ts.map +0 -1
  73. package/lib/typescript/highlight-updates/components/HighlightUpdatesModal.d.ts.map +0 -1
  74. package/lib/typescript/highlight-updates/components/IdentifierBadge.d.ts.map +0 -1
  75. package/lib/typescript/highlight-updates/components/IsolatedRenderList.d.ts.map +0 -1
  76. package/lib/typescript/highlight-updates/components/ModalHeaderContent.d.ts.map +0 -1
  77. package/lib/typescript/highlight-updates/components/RenderCauseBadge.d.ts.map +0 -1
  78. package/lib/typescript/highlight-updates/components/RenderDetailView.d.ts.map +0 -1
  79. package/lib/typescript/highlight-updates/components/RenderHistoryViewer.d.ts.map +0 -1
  80. package/lib/typescript/highlight-updates/components/RenderListItem.d.ts.map +0 -1
  81. package/lib/typescript/highlight-updates/components/RendersCopySettingsView.d.ts.map +0 -1
  82. package/lib/typescript/highlight-updates/components/StatsDisplay.d.ts.map +0 -1
  83. package/lib/typescript/highlight-updates/types/copySettings.d.ts.map +0 -1
  84. package/lib/typescript/highlight-updates/utils/CommitProfiler.d.ts.map +0 -1
  85. package/lib/typescript/highlight-updates/utils/HighlightUpdatesController.d.ts.map +0 -1
  86. package/lib/typescript/highlight-updates/utils/PerformanceLogger.d.ts.map +0 -1
  87. package/lib/typescript/highlight-updates/utils/ProfilerInterceptor.d.ts.map +0 -1
  88. package/lib/typescript/highlight-updates/utils/RenderCauseDetector.d.ts.map +0 -1
  89. package/lib/typescript/highlight-updates/utils/RenderTracker.d.ts.map +0 -1
  90. package/lib/typescript/highlight-updates/utils/ViewTypeMapper.d.ts.map +0 -1
  91. package/lib/typescript/highlight-updates/utils/copySettingsStorage.d.ts.map +0 -1
  92. package/lib/typescript/highlight-updates/utils/devtoolsComponentNames.d.ts.map +0 -1
  93. package/lib/typescript/highlight-updates/utils/namedComposite.d.ts.map +0 -1
  94. package/lib/typescript/highlight-updates/utils/ownStateChanged.d.ts.map +0 -1
  95. package/lib/typescript/highlight-updates/utils/rawEventEmitter.d.ts.map +0 -1
  96. package/lib/typescript/highlight-updates/utils/renderExportFormatter.d.ts.map +0 -1
  97. package/lib/typescript/highlight-updates/utils/rendersExportFormatter.d.ts.map +0 -1
  98. package/lib/typescript/highlight-updates/utils/screenElements.d.ts.map +0 -1
  99. package/lib/typescript/highlight-updates/utils/tapMatch.d.ts.map +0 -1
  100. package/lib/typescript/highlight-updates/utils/testIDs.d.ts.map +0 -1
  101. package/lib/typescript/highlight-updates/utils/touchCapture.d.ts.map +0 -1
  102. package/lib/typescript/index.d.ts.map +0 -1
  103. package/lib/typescript/preset.d.ts.map +0 -1
  104. 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 React from"react";import{View,Text,StyleSheet}from"react-native";import{buoyColors,night,monoFont}from"@buoy-gg/shared-ui";import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";export const CAUSE_CONFIG={mount:{label:"MOUNT",color:buoyColors.success,tip:"First render of this component."},props:{label:"PROPS",color:buoyColors.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:buoyColors.textSecondary,tip:"Parent component re-rendered. Consider wrapping with React.memo()."},unknown:{label:"?",color:buoyColors.textMuted,tip:"Could not determine render cause."}};export const COMPONENT_CAUSE_CONFIG={mount:{label:"mount",color:buoyColors.success,tip:"First render of this component."},props:{label:"props",color:buoyColors.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:buoyColors.textSecondary,tip:"Parent re-rendered but this component's props/state didn't change. Consider React.memo()."},unknown:{label:"?",color:buoyColors.textMuted,tip:"Could not determine component render cause."}};export function RenderCauseBadge({cause:e,compact:t=!1,showKeys:o=!1,showTwoLevel:n=!1,testID:s}){const l=CAUSE_CONFIG[e.type],a=e.componentCause?COMPONENT_CAUSE_CONFIG[e.componentCause]:null,r=n&&a&&e.componentCause!==e.type;return _jsxs(View,{nativeID:"__rn_buoy__cause-badge",testID:s,style:[styles.container,t&&styles.containerCompact],children:[r&&_jsxs(_Fragment,{children:[_jsx(View,{style:[styles.badge,t&&styles.badgeCompact,styles.componentBadge,{backgroundColor:a.color+"15"}],children:_jsx(Text,{testID:s?`${s}-component`:void 0,style:[styles.badgeText,t&&styles.badgeTextCompact,styles.componentBadgeText,{color:a.color}],children:a.label})}),_jsx(Text,{style:[styles.arrowText,t&&styles.arrowTextCompact],children:"→"})]}),_jsx(View,{style:[styles.badge,t&&styles.badgeCompact,{backgroundColor:l.color+"20"}],children:_jsx(Text,{testID:s?`${s}-native`:void 0,style:[styles.badgeText,t&&styles.badgeTextCompact,{color:l.color}],children:l.label})}),o&&e.changedKeys&&e.changedKeys.length>0&&_jsx(Text,{testID:s?`${s}-keys`:void 0,style:[styles.keysText,t&&styles.keysTextCompact],numberOfLines:1,children:e.changedKeys.join(", ")}),o&&e.hookIndices&&e.hookIndices.length>0&&_jsxs(Text,{testID:s?`${s}-hooks`:void 0,style:[styles.keysText,t&&styles.keysTextCompact],numberOfLines:1,children:["Hook ",e.hookIndices.join(", ")]})]})}export function TwoLevelCauseBadge({cause:e}){const t=CAUSE_CONFIG[e.type],o=e.componentCause?COMPONENT_CAUSE_CONFIG[e.componentCause]:null,n=e.componentName||"Component";return _jsxs(View,{nativeID:"__rn_buoy__two-level-cause",style:styles.twoLevelContainer,children:[o&&_jsxs(View,{style:styles.twoLevelRow,children:[_jsx(Text,{style:styles.twoLevelLabel,children:"Component:"}),_jsx(Text,{style:styles.twoLevelName,children:n}),_jsx(Text,{style:styles.twoLevelText,children:"re-rendered due to"}),_jsx(View,{style:[styles.badge,{backgroundColor:o.color+"20"}],children:_jsx(Text,{style:[styles.badgeText,{color:o.color}],children:o.label.toUpperCase()})})]}),_jsxs(View,{style:styles.twoLevelRow,children:[_jsx(Text,{style:styles.twoLevelLabel,children:"Native:"}),_jsx(View,{style:[styles.badge,{backgroundColor:t.color+"20"}],children:_jsx(Text,{style:[styles.badgeText,{color:t.color}],children:t.label})}),e.changedKeys&&e.changedKeys.length>0&&_jsxs(Text,{style:styles.twoLevelKeys,children:["[",e.changedKeys.join(", "),"]"]})]})]})}export function EnhancedCauseDisplay({cause:e,nativeType:t}){const o=CAUSE_CONFIG[e.type],n=e.componentCause?COMPONENT_CAUSE_CONFIG[e.componentCause]:null,s=e.componentName||"Unknown",l=e.hookChanges&&e.hookChanges.length>0,a=e.changedKeys&&e.changedKeys.length>0,r=e.changedKeys?.filter(e=>e.includes("(ref only)")||e.includes("(fn ref)"))||[],c=e.changedKeys?.filter(e=>!e.includes("(ref only)")&&!e.includes("(fn ref)"))||[];return _jsxs(View,{nativeID:"__rn_buoy__enhanced-cause",style:styles.enhancedContainer,children:[_jsxs(View,{style:styles.enhancedHeader,children:[_jsx(Text,{style:styles.enhancedComponentName,children:s}),t&&_jsx(View,{style:styles.enhancedNativeTag,children:_jsx(Text,{style:styles.enhancedNativeTagText,children:t})})]}),_jsxs(View,{style:styles.enhancedFlowContainer,children:[_jsx(Text,{style:styles.enhancedFlowLabel,children:"Cause:"}),n&&_jsx(View,{style:[styles.enhancedFlowBadge,{backgroundColor:n.color+"20"}],children:_jsx(Text,{style:[styles.enhancedFlowBadgeText,{color:n.color}],children:n.label.toUpperCase()})}),_jsx(Text,{style:styles.enhancedFlowArrow,children:"→"}),_jsx(View,{style:[styles.enhancedFlowBadge,{backgroundColor:o.color+"20"}],children:_jsx(Text,{style:[styles.enhancedFlowBadgeText,{color:o.color}],children:o.label})})]}),l&&_jsxs(View,{style:styles.enhancedSection,children:[_jsx(Text,{style:styles.enhancedSectionTitle,children:"Component State Changed:"}),e.hookChanges.map(e=>_jsxs(View,{style:styles.enhancedChangeRow,children:[_jsx(Text,{style:styles.enhancedChangeIcon,children:"⚡"}),_jsxs(Text,{style:styles.enhancedChangeText,children:["Hook[",e.index,"] (",e.type,"): ",e.description]})]},e.index))]}),c.length>0&&_jsxs(View,{style:styles.enhancedSection,children:[_jsx(Text,{style:styles.enhancedSectionTitle,children:"Native Props Changed:"}),c.map((e,t)=>_jsxs(View,{style:styles.enhancedChangeRow,children:[_jsx(Text,{style:styles.enhancedChangeIcon,children:"~"}),_jsx(Text,{style:styles.enhancedChangeText,children:e})]},t))]}),r.length>0&&_jsxs(View,{style:styles.enhancedSection,children:[_jsx(Text,{style:[styles.enhancedSectionTitle,{color:night.color.textTertiary}],children:"Reference Changes (optimization opportunity):"}),r.map((e,t)=>_jsxs(View,{style:styles.enhancedChangeRow,children:[_jsx(Text,{style:[styles.enhancedChangeIcon,{color:night.color.textTertiary}],children:"○"}),_jsx(Text,{style:[styles.enhancedChangeText,{color:night.color.textTertiary}],children:e})]},t))]}),!l&&!a&&"mount"!==e.type&&_jsx(View,{style:styles.enhancedSection,children:_jsx(Text,{style:styles.enhancedNoChanges,children:"parent"===e.type?"Parent re-rendered (consider React.memo)":"No specific changes detected"})})]})}const styles=StyleSheet.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:night.color.border},badgeText:{fontSize:10,fontWeight:"700"},badgeTextCompact:{fontSize:9},componentBadgeText:{fontWeight:"500",textTransform:"lowercase"},arrowText:{fontSize:10,color:night.color.textTertiary},arrowTextCompact:{fontSize:9},keysText:{fontSize:11,color:night.color.textSecondary,fontFamily:monoFont,flex:1},keysTextCompact:{fontSize:10},twoLevelContainer:{gap:8},twoLevelRow:{flexDirection:"row",alignItems:"center",flexWrap:"wrap",gap:6},twoLevelLabel:{fontSize:11,fontWeight:"600",color:night.color.textSecondary,minWidth:70},twoLevelName:{fontSize:11,fontWeight:"600",color:night.color.text,fontFamily:monoFont},twoLevelText:{fontSize:11,color:night.color.textSecondary},twoLevelKeys:{fontSize:10,color:night.color.textSecondary,fontFamily:monoFont},enhancedContainer:{gap:12},enhancedHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8},enhancedComponentName:{fontSize:14,fontWeight:"700",color:night.color.text,fontFamily:monoFont},enhancedNativeTag:{backgroundColor:night.color.bg,paddingVertical:2,paddingHorizontal:6,borderRadius:4},enhancedNativeTagText:{fontSize:10,fontWeight:"600",color:night.color.textTertiary,fontFamily:monoFont},enhancedFlowContainer:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:8,paddingHorizontal:12,backgroundColor:night.color.bg,borderRadius:6},enhancedFlowLabel:{fontSize:11,fontWeight:"600",color:night.color.textSecondary},enhancedFlowBadge:{paddingVertical:3,paddingHorizontal:8,borderRadius:4},enhancedFlowBadgeText:{fontSize:10,fontWeight:"700"},enhancedFlowArrow:{fontSize:14,color:night.color.textTertiary,fontWeight:"300"},enhancedSection:{gap:6},enhancedSectionTitle:{fontSize:11,fontWeight:"600",color:night.color.textSecondary,letterSpacing:.3},enhancedChangeRow:{flexDirection:"row",alignItems:"flex-start",gap:6,paddingLeft:4},enhancedChangeIcon:{fontSize:12,color:night.color.warning,fontFamily:monoFont,width:16},enhancedChangeText:{fontSize:12,color:night.color.text,fontFamily:monoFont,flex:1},enhancedNoChanges:{fontSize:12,color:night.color.textTertiary,fontStyle:"italic",paddingLeft:4}});export default RenderCauseBadge;