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