@buoy-gg/highlight-updates 7.0.38 → 7.0.40

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