@buoy-gg/highlight-updates 2.1.12 → 2.1.13

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 (64) hide show
  1. package/lib/commonjs/highlight-updates/HighlightUpdatesOverlay.js +1 -285
  2. package/lib/commonjs/highlight-updates/components/HighlightFilterView.js +1 -1371
  3. package/lib/commonjs/highlight-updates/components/HighlightUpdatesModal.js +1 -591
  4. package/lib/commonjs/highlight-updates/components/IdentifierBadge.js +1 -267
  5. package/lib/commonjs/highlight-updates/components/IsolatedRenderList.js +1 -178
  6. package/lib/commonjs/highlight-updates/components/ModalHeaderContent.js +1 -303
  7. package/lib/commonjs/highlight-updates/components/RenderCauseBadge.js +1 -500
  8. package/lib/commonjs/highlight-updates/components/RenderDetailView.js +1 -830
  9. package/lib/commonjs/highlight-updates/components/RenderHistoryViewer.js +1 -894
  10. package/lib/commonjs/highlight-updates/components/RenderListItem.js +1 -220
  11. package/lib/commonjs/highlight-updates/components/StatsDisplay.js +1 -70
  12. package/lib/commonjs/highlight-updates/components/index.js +1 -97
  13. package/lib/commonjs/highlight-updates/utils/HighlightUpdatesController.js +1 -1435
  14. package/lib/commonjs/highlight-updates/utils/PerformanceLogger.js +1 -359
  15. package/lib/commonjs/highlight-updates/utils/ProfilerInterceptor.js +1 -371
  16. package/lib/commonjs/highlight-updates/utils/RenderCauseDetector.js +1 -1828
  17. package/lib/commonjs/highlight-updates/utils/RenderTracker.js +1 -903
  18. package/lib/commonjs/highlight-updates/utils/ViewTypeMapper.js +1 -264
  19. package/lib/commonjs/highlight-updates/utils/renderExportFormatter.js +1 -58
  20. package/lib/commonjs/index.js +1 -311
  21. package/lib/commonjs/preset.js +1 -278
  22. package/lib/module/highlight-updates/HighlightUpdatesOverlay.js +1 -278
  23. package/lib/module/highlight-updates/components/HighlightFilterView.js +1 -1365
  24. package/lib/module/highlight-updates/components/HighlightUpdatesModal.js +1 -585
  25. package/lib/module/highlight-updates/components/IdentifierBadge.js +1 -259
  26. package/lib/module/highlight-updates/components/IsolatedRenderList.js +1 -174
  27. package/lib/module/highlight-updates/components/ModalHeaderContent.js +1 -298
  28. package/lib/module/highlight-updates/components/RenderCauseBadge.js +1 -491
  29. package/lib/module/highlight-updates/components/RenderDetailView.js +1 -826
  30. package/lib/module/highlight-updates/components/RenderHistoryViewer.js +1 -888
  31. package/lib/module/highlight-updates/components/RenderListItem.js +1 -215
  32. package/lib/module/highlight-updates/components/StatsDisplay.js +1 -67
  33. package/lib/module/highlight-updates/components/index.js +1 -16
  34. package/lib/module/highlight-updates/utils/HighlightUpdatesController.js +1 -1431
  35. package/lib/module/highlight-updates/utils/PerformanceLogger.js +1 -353
  36. package/lib/module/highlight-updates/utils/ProfilerInterceptor.js +1 -358
  37. package/lib/module/highlight-updates/utils/RenderCauseDetector.js +1 -1818
  38. package/lib/module/highlight-updates/utils/RenderTracker.js +1 -900
  39. package/lib/module/highlight-updates/utils/ViewTypeMapper.js +1 -255
  40. package/lib/module/highlight-updates/utils/renderExportFormatter.js +1 -54
  41. package/lib/module/index.js +1 -71
  42. package/lib/module/preset.js +1 -272
  43. package/package.json +7 -7
  44. package/lib/typescript/highlight-updates/HighlightUpdatesOverlay.d.ts.map +0 -1
  45. package/lib/typescript/highlight-updates/components/HighlightFilterView.d.ts.map +0 -1
  46. package/lib/typescript/highlight-updates/components/HighlightUpdatesModal.d.ts.map +0 -1
  47. package/lib/typescript/highlight-updates/components/IdentifierBadge.d.ts.map +0 -1
  48. package/lib/typescript/highlight-updates/components/IsolatedRenderList.d.ts.map +0 -1
  49. package/lib/typescript/highlight-updates/components/ModalHeaderContent.d.ts.map +0 -1
  50. package/lib/typescript/highlight-updates/components/RenderCauseBadge.d.ts.map +0 -1
  51. package/lib/typescript/highlight-updates/components/RenderDetailView.d.ts.map +0 -1
  52. package/lib/typescript/highlight-updates/components/RenderHistoryViewer.d.ts.map +0 -1
  53. package/lib/typescript/highlight-updates/components/RenderListItem.d.ts.map +0 -1
  54. package/lib/typescript/highlight-updates/components/StatsDisplay.d.ts.map +0 -1
  55. package/lib/typescript/highlight-updates/components/index.d.ts.map +0 -1
  56. package/lib/typescript/highlight-updates/utils/HighlightUpdatesController.d.ts.map +0 -1
  57. package/lib/typescript/highlight-updates/utils/PerformanceLogger.d.ts.map +0 -1
  58. package/lib/typescript/highlight-updates/utils/ProfilerInterceptor.d.ts.map +0 -1
  59. package/lib/typescript/highlight-updates/utils/RenderCauseDetector.d.ts.map +0 -1
  60. package/lib/typescript/highlight-updates/utils/RenderTracker.d.ts.map +0 -1
  61. package/lib/typescript/highlight-updates/utils/ViewTypeMapper.d.ts.map +0 -1
  62. package/lib/typescript/highlight-updates/utils/renderExportFormatter.d.ts.map +0 -1
  63. package/lib/typescript/index.d.ts.map +0 -1
  64. package/lib/typescript/preset.d.ts.map +0 -1
@@ -1,491 +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 } 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
- }) {
96
- const config = CAUSE_CONFIG[cause.type];
97
- const componentConfig = cause.componentCause ? COMPONENT_CAUSE_CONFIG[cause.componentCause] : null;
98
-
99
- // For two-level display: "Component (parent) → Native (PROPS)"
100
- const showComponentCause = showTwoLevel && componentConfig && cause.componentCause !== cause.type;
101
- return /*#__PURE__*/_jsxs(View, {
102
- nativeID: "__rn_buoy__cause-badge",
103
- style: [styles.container, compact && styles.containerCompact],
104
- children: [showComponentCause && /*#__PURE__*/_jsxs(_Fragment, {
105
- children: [/*#__PURE__*/_jsx(View, {
106
- style: [styles.badge, compact && styles.badgeCompact, styles.componentBadge, {
107
- backgroundColor: componentConfig.color + "15"
108
- }],
109
- children: /*#__PURE__*/_jsx(Text, {
110
- style: [styles.badgeText, compact && styles.badgeTextCompact, styles.componentBadgeText, {
111
- color: componentConfig.color
112
- }],
113
- children: componentConfig.label
114
- })
115
- }), /*#__PURE__*/_jsx(Text, {
116
- style: [styles.arrowText, compact && styles.arrowTextCompact],
117
- children: "\u2192"
118
- })]
119
- }), /*#__PURE__*/_jsx(View, {
120
- style: [styles.badge, compact && styles.badgeCompact, {
121
- backgroundColor: config.color + "20"
122
- }],
123
- children: /*#__PURE__*/_jsx(Text, {
124
- style: [styles.badgeText, compact && styles.badgeTextCompact, {
125
- color: config.color
126
- }],
127
- children: config.label
128
- })
129
- }), showKeys && cause.changedKeys && cause.changedKeys.length > 0 && /*#__PURE__*/_jsx(Text, {
130
- style: [styles.keysText, compact && styles.keysTextCompact],
131
- numberOfLines: 1,
132
- children: cause.changedKeys.join(", ")
133
- }), showKeys && cause.hookIndices && cause.hookIndices.length > 0 && /*#__PURE__*/_jsxs(Text, {
134
- style: [styles.keysText, compact && styles.keysTextCompact],
135
- numberOfLines: 1,
136
- children: ["Hook ", cause.hookIndices.join(", ")]
137
- })]
138
- });
139
- }
140
-
141
- /**
142
- * TwoLevelCauseBadge - A more detailed badge for detail views
143
- * Shows: "ComponentName re-rendered due to PARENT → native PROPS [style]"
144
- */
145
- export function TwoLevelCauseBadge({
146
- cause
147
- }) {
148
- const nativeConfig = CAUSE_CONFIG[cause.type];
149
- const componentConfig = cause.componentCause ? COMPONENT_CAUSE_CONFIG[cause.componentCause] : null;
150
- const componentName = cause.componentName || "Component";
151
- return /*#__PURE__*/_jsxs(View, {
152
- nativeID: "__rn_buoy__two-level-cause",
153
- style: styles.twoLevelContainer,
154
- children: [componentConfig && /*#__PURE__*/_jsxs(View, {
155
- style: styles.twoLevelRow,
156
- children: [/*#__PURE__*/_jsx(Text, {
157
- style: styles.twoLevelLabel,
158
- children: "Component:"
159
- }), /*#__PURE__*/_jsx(Text, {
160
- style: styles.twoLevelName,
161
- children: componentName
162
- }), /*#__PURE__*/_jsx(Text, {
163
- style: styles.twoLevelText,
164
- children: "re-rendered due to"
165
- }), /*#__PURE__*/_jsx(View, {
166
- style: [styles.badge, {
167
- backgroundColor: componentConfig.color + "20"
168
- }],
169
- children: /*#__PURE__*/_jsx(Text, {
170
- style: [styles.badgeText, {
171
- color: componentConfig.color
172
- }],
173
- children: componentConfig.label.toUpperCase()
174
- })
175
- })]
176
- }), /*#__PURE__*/_jsxs(View, {
177
- style: styles.twoLevelRow,
178
- children: [/*#__PURE__*/_jsx(Text, {
179
- style: styles.twoLevelLabel,
180
- children: "Native:"
181
- }), /*#__PURE__*/_jsx(View, {
182
- style: [styles.badge, {
183
- backgroundColor: nativeConfig.color + "20"
184
- }],
185
- children: /*#__PURE__*/_jsx(Text, {
186
- style: [styles.badgeText, {
187
- color: nativeConfig.color
188
- }],
189
- children: nativeConfig.label
190
- })
191
- }), cause.changedKeys && cause.changedKeys.length > 0 && /*#__PURE__*/_jsxs(Text, {
192
- style: styles.twoLevelKeys,
193
- children: ["[", cause.changedKeys.join(", "), "]"]
194
- })]
195
- })]
196
- });
197
- }
198
-
199
- /**
200
- * EnhancedCauseDisplay - Phase 5: Comprehensive cause display
201
- * Shows detailed breakdown of why a component rendered with clear sections
202
- */
203
- export function EnhancedCauseDisplay({
204
- cause,
205
- nativeType
206
- }) {
207
- const nativeConfig = CAUSE_CONFIG[cause.type];
208
- const componentConfig = cause.componentCause ? COMPONENT_CAUSE_CONFIG[cause.componentCause] : null;
209
- const componentName = cause.componentName || "Unknown";
210
- const hasHookChanges = cause.hookChanges && cause.hookChanges.length > 0;
211
- const hasChangedKeys = cause.changedKeys && cause.changedKeys.length > 0;
212
-
213
- // Separate ref-only changes from actual value changes
214
- const refOnlyChanges = cause.changedKeys?.filter(k => k.includes("(ref only)") || k.includes("(fn ref)")) || [];
215
- const valueChanges = cause.changedKeys?.filter(k => !k.includes("(ref only)") && !k.includes("(fn ref)")) || [];
216
- return /*#__PURE__*/_jsxs(View, {
217
- nativeID: "__rn_buoy__enhanced-cause",
218
- style: styles.enhancedContainer,
219
- children: [/*#__PURE__*/_jsxs(View, {
220
- style: styles.enhancedHeader,
221
- children: [/*#__PURE__*/_jsx(Text, {
222
- style: styles.enhancedComponentName,
223
- children: componentName
224
- }), nativeType && /*#__PURE__*/_jsx(View, {
225
- style: styles.enhancedNativeTag,
226
- children: /*#__PURE__*/_jsx(Text, {
227
- style: styles.enhancedNativeTagText,
228
- children: nativeType
229
- })
230
- })]
231
- }), /*#__PURE__*/_jsxs(View, {
232
- style: styles.enhancedFlowContainer,
233
- children: [/*#__PURE__*/_jsx(Text, {
234
- style: styles.enhancedFlowLabel,
235
- children: "Cause:"
236
- }), componentConfig && /*#__PURE__*/_jsx(View, {
237
- style: [styles.enhancedFlowBadge, {
238
- backgroundColor: componentConfig.color + "20"
239
- }],
240
- children: /*#__PURE__*/_jsx(Text, {
241
- style: [styles.enhancedFlowBadgeText, {
242
- color: componentConfig.color
243
- }],
244
- children: componentConfig.label.toUpperCase()
245
- })
246
- }), /*#__PURE__*/_jsx(Text, {
247
- style: styles.enhancedFlowArrow,
248
- children: "\u2192"
249
- }), /*#__PURE__*/_jsx(View, {
250
- style: [styles.enhancedFlowBadge, {
251
- backgroundColor: nativeConfig.color + "20"
252
- }],
253
- children: /*#__PURE__*/_jsx(Text, {
254
- style: [styles.enhancedFlowBadgeText, {
255
- color: nativeConfig.color
256
- }],
257
- children: nativeConfig.label
258
- })
259
- })]
260
- }), hasHookChanges && /*#__PURE__*/_jsxs(View, {
261
- style: styles.enhancedSection,
262
- children: [/*#__PURE__*/_jsx(Text, {
263
- style: styles.enhancedSectionTitle,
264
- children: "Component State Changed:"
265
- }), cause.hookChanges.map(hook => /*#__PURE__*/_jsxs(View, {
266
- style: styles.enhancedChangeRow,
267
- children: [/*#__PURE__*/_jsx(Text, {
268
- style: styles.enhancedChangeIcon,
269
- children: "\u26A1"
270
- }), /*#__PURE__*/_jsxs(Text, {
271
- style: styles.enhancedChangeText,
272
- children: ["Hook[", hook.index, "] (", hook.type, "): ", hook.description]
273
- })]
274
- }, hook.index))]
275
- }), valueChanges.length > 0 && /*#__PURE__*/_jsxs(View, {
276
- style: styles.enhancedSection,
277
- children: [/*#__PURE__*/_jsx(Text, {
278
- style: styles.enhancedSectionTitle,
279
- children: "Native Props Changed:"
280
- }), valueChanges.map((key, index) => /*#__PURE__*/_jsxs(View, {
281
- style: styles.enhancedChangeRow,
282
- children: [/*#__PURE__*/_jsx(Text, {
283
- style: styles.enhancedChangeIcon,
284
- children: "~"
285
- }), /*#__PURE__*/_jsx(Text, {
286
- style: styles.enhancedChangeText,
287
- children: key
288
- })]
289
- }, index))]
290
- }), refOnlyChanges.length > 0 && /*#__PURE__*/_jsxs(View, {
291
- style: styles.enhancedSection,
292
- children: [/*#__PURE__*/_jsx(Text, {
293
- style: [styles.enhancedSectionTitle, {
294
- color: buoyColors.textMuted
295
- }],
296
- children: "Reference Changes (optimization opportunity):"
297
- }), refOnlyChanges.map((key, index) => /*#__PURE__*/_jsxs(View, {
298
- style: styles.enhancedChangeRow,
299
- children: [/*#__PURE__*/_jsx(Text, {
300
- style: [styles.enhancedChangeIcon, {
301
- color: buoyColors.textMuted
302
- }],
303
- children: "\u25CB"
304
- }), /*#__PURE__*/_jsx(Text, {
305
- style: [styles.enhancedChangeText, {
306
- color: buoyColors.textMuted
307
- }],
308
- children: key
309
- })]
310
- }, index))]
311
- }), !hasHookChanges && !hasChangedKeys && cause.type !== "mount" && /*#__PURE__*/_jsx(View, {
312
- style: styles.enhancedSection,
313
- children: /*#__PURE__*/_jsx(Text, {
314
- style: styles.enhancedNoChanges,
315
- children: cause.type === "parent" ? "Parent re-rendered (consider React.memo)" : "No specific changes detected"
316
- })
317
- })]
318
- });
319
- }
320
- const styles = StyleSheet.create({
321
- container: {
322
- flexDirection: "row",
323
- alignItems: "center",
324
- gap: 6
325
- },
326
- containerCompact: {
327
- gap: 4
328
- },
329
- badge: {
330
- paddingVertical: 3,
331
- paddingHorizontal: 6,
332
- borderRadius: 4
333
- },
334
- badgeCompact: {
335
- paddingVertical: 2,
336
- paddingHorizontal: 5
337
- },
338
- componentBadge: {
339
- borderStyle: "dashed",
340
- borderWidth: 1,
341
- borderColor: buoyColors.border
342
- },
343
- badgeText: {
344
- fontSize: 10,
345
- fontWeight: "700"
346
- },
347
- badgeTextCompact: {
348
- fontSize: 9
349
- },
350
- componentBadgeText: {
351
- fontWeight: "500",
352
- textTransform: "lowercase"
353
- },
354
- arrowText: {
355
- fontSize: 10,
356
- color: buoyColors.textMuted
357
- },
358
- arrowTextCompact: {
359
- fontSize: 9
360
- },
361
- keysText: {
362
- fontSize: 11,
363
- color: buoyColors.textSecondary,
364
- fontFamily: "monospace",
365
- flex: 1
366
- },
367
- keysTextCompact: {
368
- fontSize: 10
369
- },
370
- // Two-level badge styles
371
- twoLevelContainer: {
372
- gap: 8
373
- },
374
- twoLevelRow: {
375
- flexDirection: "row",
376
- alignItems: "center",
377
- flexWrap: "wrap",
378
- gap: 6
379
- },
380
- twoLevelLabel: {
381
- fontSize: 11,
382
- fontWeight: "600",
383
- color: buoyColors.textSecondary,
384
- minWidth: 70
385
- },
386
- twoLevelName: {
387
- fontSize: 11,
388
- fontWeight: "600",
389
- color: buoyColors.text,
390
- fontFamily: "monospace"
391
- },
392
- twoLevelText: {
393
- fontSize: 11,
394
- color: buoyColors.textSecondary
395
- },
396
- twoLevelKeys: {
397
- fontSize: 10,
398
- color: buoyColors.textSecondary,
399
- fontFamily: "monospace"
400
- },
401
- // Enhanced cause display styles (Phase 5)
402
- enhancedContainer: {
403
- gap: 12
404
- },
405
- enhancedHeader: {
406
- flexDirection: "row",
407
- alignItems: "center",
408
- justifyContent: "space-between",
409
- gap: 8
410
- },
411
- enhancedComponentName: {
412
- fontSize: 14,
413
- fontWeight: "700",
414
- color: buoyColors.text,
415
- fontFamily: "monospace"
416
- },
417
- enhancedNativeTag: {
418
- backgroundColor: buoyColors.input,
419
- paddingVertical: 2,
420
- paddingHorizontal: 6,
421
- borderRadius: 4
422
- },
423
- enhancedNativeTagText: {
424
- fontSize: 10,
425
- fontWeight: "600",
426
- color: buoyColors.textMuted,
427
- fontFamily: "monospace"
428
- },
429
- enhancedFlowContainer: {
430
- flexDirection: "row",
431
- alignItems: "center",
432
- gap: 8,
433
- paddingVertical: 8,
434
- paddingHorizontal: 12,
435
- backgroundColor: buoyColors.input,
436
- borderRadius: 6
437
- },
438
- enhancedFlowLabel: {
439
- fontSize: 11,
440
- fontWeight: "600",
441
- color: buoyColors.textSecondary
442
- },
443
- enhancedFlowBadge: {
444
- paddingVertical: 3,
445
- paddingHorizontal: 8,
446
- borderRadius: 4
447
- },
448
- enhancedFlowBadgeText: {
449
- fontSize: 10,
450
- fontWeight: "700"
451
- },
452
- enhancedFlowArrow: {
453
- fontSize: 14,
454
- color: buoyColors.textMuted,
455
- fontWeight: "300"
456
- },
457
- enhancedSection: {
458
- gap: 6
459
- },
460
- enhancedSectionTitle: {
461
- fontSize: 11,
462
- fontWeight: "600",
463
- color: buoyColors.textSecondary,
464
- letterSpacing: 0.3
465
- },
466
- enhancedChangeRow: {
467
- flexDirection: "row",
468
- alignItems: "flex-start",
469
- gap: 6,
470
- paddingLeft: 4
471
- },
472
- enhancedChangeIcon: {
473
- fontSize: 12,
474
- color: buoyColors.warning,
475
- fontFamily: "monospace",
476
- width: 16
477
- },
478
- enhancedChangeText: {
479
- fontSize: 12,
480
- color: buoyColors.text,
481
- fontFamily: "monospace",
482
- flex: 1
483
- },
484
- enhancedNoChanges: {
485
- fontSize: 12,
486
- color: buoyColors.textMuted,
487
- fontStyle: "italic",
488
- paddingLeft: 4
489
- }
490
- });
491
- export default RenderCauseBadge;
1
+ "use strict";import React from"react";import{View,Text,StyleSheet}from"react-native";import{buoyColors}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}){const s=CAUSE_CONFIG[e.type],l=e.componentCause?COMPONENT_CAUSE_CONFIG[e.componentCause]:null,a=n&&l&&e.componentCause!==e.type;return _jsxs(View,{nativeID:"__rn_buoy__cause-badge",style:[styles.container,t&&styles.containerCompact],children:[a&&_jsxs(_Fragment,{children:[_jsx(View,{style:[styles.badge,t&&styles.badgeCompact,styles.componentBadge,{backgroundColor:l.color+"15"}],children:_jsx(Text,{style:[styles.badgeText,t&&styles.badgeTextCompact,styles.componentBadgeText,{color:l.color}],children:l.label})}),_jsx(Text,{style:[styles.arrowText,t&&styles.arrowTextCompact],children:"→"})]}),_jsx(View,{style:[styles.badge,t&&styles.badgeCompact,{backgroundColor:s.color+"20"}],children:_jsx(Text,{style:[styles.badgeText,t&&styles.badgeTextCompact,{color:s.color}],children:s.label})}),o&&e.changedKeys&&e.changedKeys.length>0&&_jsx(Text,{style:[styles.keysText,t&&styles.keysTextCompact],numberOfLines:1,children:e.changedKeys.join(", ")}),o&&e.hookIndices&&e.hookIndices.length>0&&_jsxs(Text,{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:buoyColors.textMuted}],children:"Reference Changes (optimization opportunity):"}),r.map((e,t)=>_jsxs(View,{style:styles.enhancedChangeRow,children:[_jsx(Text,{style:[styles.enhancedChangeIcon,{color:buoyColors.textMuted}],children:"○"}),_jsx(Text,{style:[styles.enhancedChangeText,{color:buoyColors.textMuted}],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:buoyColors.border},badgeText:{fontSize:10,fontWeight:"700"},badgeTextCompact:{fontSize:9},componentBadgeText:{fontWeight:"500",textTransform:"lowercase"},arrowText:{fontSize:10,color:buoyColors.textMuted},arrowTextCompact:{fontSize:9},keysText:{fontSize:11,color:buoyColors.textSecondary,fontFamily:"monospace",flex:1},keysTextCompact:{fontSize:10},twoLevelContainer:{gap:8},twoLevelRow:{flexDirection:"row",alignItems:"center",flexWrap:"wrap",gap:6},twoLevelLabel:{fontSize:11,fontWeight:"600",color:buoyColors.textSecondary,minWidth:70},twoLevelName:{fontSize:11,fontWeight:"600",color:buoyColors.text,fontFamily:"monospace"},twoLevelText:{fontSize:11,color:buoyColors.textSecondary},twoLevelKeys:{fontSize:10,color:buoyColors.textSecondary,fontFamily:"monospace"},enhancedContainer:{gap:12},enhancedHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8},enhancedComponentName:{fontSize:14,fontWeight:"700",color:buoyColors.text,fontFamily:"monospace"},enhancedNativeTag:{backgroundColor:buoyColors.input,paddingVertical:2,paddingHorizontal:6,borderRadius:4},enhancedNativeTagText:{fontSize:10,fontWeight:"600",color:buoyColors.textMuted,fontFamily:"monospace"},enhancedFlowContainer:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:8,paddingHorizontal:12,backgroundColor:buoyColors.input,borderRadius:6},enhancedFlowLabel:{fontSize:11,fontWeight:"600",color:buoyColors.textSecondary},enhancedFlowBadge:{paddingVertical:3,paddingHorizontal:8,borderRadius:4},enhancedFlowBadgeText:{fontSize:10,fontWeight:"700"},enhancedFlowArrow:{fontSize:14,color:buoyColors.textMuted,fontWeight:"300"},enhancedSection:{gap:6},enhancedSectionTitle:{fontSize:11,fontWeight:"600",color:buoyColors.textSecondary,letterSpacing:.3},enhancedChangeRow:{flexDirection:"row",alignItems:"flex-start",gap:6,paddingLeft:4},enhancedChangeIcon:{fontSize:12,color:buoyColors.warning,fontFamily:"monospace",width:16},enhancedChangeText:{fontSize:12,color:buoyColors.text,fontFamily:"monospace",flex:1},enhancedNoChanges:{fontSize:12,color:buoyColors.textMuted,fontStyle:"italic",paddingLeft:4}});export default RenderCauseBadge;