@buoy-gg/highlight-updates 2.1.11 → 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.
- package/LICENSE +58 -0
- package/lib/commonjs/highlight-updates/HighlightUpdatesOverlay.js +1 -285
- package/lib/commonjs/highlight-updates/components/HighlightFilterView.js +1 -1371
- package/lib/commonjs/highlight-updates/components/HighlightUpdatesModal.js +1 -591
- package/lib/commonjs/highlight-updates/components/IdentifierBadge.js +1 -267
- package/lib/commonjs/highlight-updates/components/IsolatedRenderList.js +1 -178
- package/lib/commonjs/highlight-updates/components/ModalHeaderContent.js +1 -303
- package/lib/commonjs/highlight-updates/components/RenderCauseBadge.js +1 -500
- package/lib/commonjs/highlight-updates/components/RenderDetailView.js +1 -830
- package/lib/commonjs/highlight-updates/components/RenderHistoryViewer.js +1 -894
- package/lib/commonjs/highlight-updates/components/RenderListItem.js +1 -220
- package/lib/commonjs/highlight-updates/components/StatsDisplay.js +1 -70
- package/lib/commonjs/highlight-updates/components/index.js +1 -97
- package/lib/commonjs/highlight-updates/utils/HighlightUpdatesController.js +1 -1435
- package/lib/commonjs/highlight-updates/utils/PerformanceLogger.js +1 -359
- package/lib/commonjs/highlight-updates/utils/ProfilerInterceptor.js +1 -371
- package/lib/commonjs/highlight-updates/utils/RenderCauseDetector.js +1 -1828
- package/lib/commonjs/highlight-updates/utils/RenderTracker.js +1 -903
- package/lib/commonjs/highlight-updates/utils/ViewTypeMapper.js +1 -264
- package/lib/commonjs/highlight-updates/utils/renderExportFormatter.js +1 -58
- package/lib/commonjs/index.js +1 -311
- package/lib/commonjs/preset.js +1 -278
- package/lib/module/highlight-updates/HighlightUpdatesOverlay.js +1 -278
- package/lib/module/highlight-updates/components/HighlightFilterView.js +1 -1365
- package/lib/module/highlight-updates/components/HighlightUpdatesModal.js +1 -585
- package/lib/module/highlight-updates/components/IdentifierBadge.js +1 -259
- package/lib/module/highlight-updates/components/IsolatedRenderList.js +1 -174
- package/lib/module/highlight-updates/components/ModalHeaderContent.js +1 -298
- package/lib/module/highlight-updates/components/RenderCauseBadge.js +1 -491
- package/lib/module/highlight-updates/components/RenderDetailView.js +1 -826
- package/lib/module/highlight-updates/components/RenderHistoryViewer.js +1 -888
- package/lib/module/highlight-updates/components/RenderListItem.js +1 -215
- package/lib/module/highlight-updates/components/StatsDisplay.js +1 -67
- package/lib/module/highlight-updates/components/index.js +1 -16
- package/lib/module/highlight-updates/utils/HighlightUpdatesController.js +1 -1431
- package/lib/module/highlight-updates/utils/PerformanceLogger.js +1 -353
- package/lib/module/highlight-updates/utils/ProfilerInterceptor.js +1 -358
- package/lib/module/highlight-updates/utils/RenderCauseDetector.js +1 -1818
- package/lib/module/highlight-updates/utils/RenderTracker.js +1 -900
- package/lib/module/highlight-updates/utils/ViewTypeMapper.js +1 -255
- package/lib/module/highlight-updates/utils/renderExportFormatter.js +1 -54
- package/lib/module/index.js +1 -71
- package/lib/module/preset.js +1 -272
- package/package.json +16 -16
- package/lib/typescript/highlight-updates/HighlightUpdatesOverlay.d.ts.map +0 -1
- package/lib/typescript/highlight-updates/components/HighlightFilterView.d.ts.map +0 -1
- package/lib/typescript/highlight-updates/components/HighlightUpdatesModal.d.ts.map +0 -1
- package/lib/typescript/highlight-updates/components/IdentifierBadge.d.ts.map +0 -1
- package/lib/typescript/highlight-updates/components/IsolatedRenderList.d.ts.map +0 -1
- package/lib/typescript/highlight-updates/components/ModalHeaderContent.d.ts.map +0 -1
- package/lib/typescript/highlight-updates/components/RenderCauseBadge.d.ts.map +0 -1
- package/lib/typescript/highlight-updates/components/RenderDetailView.d.ts.map +0 -1
- package/lib/typescript/highlight-updates/components/RenderHistoryViewer.d.ts.map +0 -1
- package/lib/typescript/highlight-updates/components/RenderListItem.d.ts.map +0 -1
- package/lib/typescript/highlight-updates/components/StatsDisplay.d.ts.map +0 -1
- package/lib/typescript/highlight-updates/components/index.d.ts.map +0 -1
- package/lib/typescript/highlight-updates/utils/HighlightUpdatesController.d.ts.map +0 -1
- package/lib/typescript/highlight-updates/utils/PerformanceLogger.d.ts.map +0 -1
- package/lib/typescript/highlight-updates/utils/ProfilerInterceptor.d.ts.map +0 -1
- package/lib/typescript/highlight-updates/utils/RenderCauseDetector.d.ts.map +0 -1
- package/lib/typescript/highlight-updates/utils/RenderTracker.d.ts.map +0 -1
- package/lib/typescript/highlight-updates/utils/ViewTypeMapper.d.ts.map +0 -1
- package/lib/typescript/highlight-updates/utils/renderExportFormatter.d.ts.map +0 -1
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/preset.d.ts.map +0 -1
|
@@ -1,255 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* ViewTypeMapper
|
|
3
|
-
*
|
|
4
|
-
* Maps native view class names (e.g., "RCTView", "RCTText") to their
|
|
5
|
-
* developer-friendly React Native component names (e.g., "View", "Text").
|
|
6
|
-
*
|
|
7
|
-
* This makes the render tracking UI more understandable since developers
|
|
8
|
-
* work with component names, not native class names.
|
|
9
|
-
*
|
|
10
|
-
* Sources:
|
|
11
|
-
* - React Native core: packages/react-native/Libraries/Components/*
|
|
12
|
-
* - React Native Android: ReactAndroid/src/main/java/com/facebook/react/views/*
|
|
13
|
-
* - FabricNameComponentMapping.kt
|
|
14
|
-
* - Common third-party libraries (react-native-svg, gesture-handler, etc.)
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
"use strict";
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Mapping from native view class names to React component names.
|
|
21
|
-
*
|
|
22
|
-
* Format: { "NativeClassName": "ComponentName" }
|
|
23
|
-
*/
|
|
24
|
-
export const VIEW_TYPE_MAP = {
|
|
25
|
-
// ==========================================================================
|
|
26
|
-
// REACT NATIVE CORE - Views
|
|
27
|
-
// ==========================================================================
|
|
28
|
-
RCTView: "View",
|
|
29
|
-
RCTSafeAreaView: "SafeAreaView",
|
|
30
|
-
RCTModalHostView: "Modal",
|
|
31
|
-
// ==========================================================================
|
|
32
|
-
// REACT NATIVE CORE - Text
|
|
33
|
-
// ==========================================================================
|
|
34
|
-
RCTText: "Text",
|
|
35
|
-
RCTRawText: "RawText",
|
|
36
|
-
RCTVirtualText: "VirtualText",
|
|
37
|
-
RCTTextInlineImage: "TextInlineImage",
|
|
38
|
-
// ==========================================================================
|
|
39
|
-
// REACT NATIVE CORE - Images
|
|
40
|
-
// ==========================================================================
|
|
41
|
-
RCTImageView: "Image",
|
|
42
|
-
RCTImage: "Image",
|
|
43
|
-
// ==========================================================================
|
|
44
|
-
// REACT NATIVE CORE - ScrollView
|
|
45
|
-
// ==========================================================================
|
|
46
|
-
RCTScrollView: "ScrollView",
|
|
47
|
-
RCTScrollContentView: "ScrollContentView",
|
|
48
|
-
AndroidHorizontalScrollView: "HorizontalScrollView",
|
|
49
|
-
AndroidHorizontalScrollContentView: "HorizontalScrollContentView",
|
|
50
|
-
// ==========================================================================
|
|
51
|
-
// REACT NATIVE CORE - TextInput
|
|
52
|
-
// ==========================================================================
|
|
53
|
-
RCTSinglelineTextInputView: "TextInput",
|
|
54
|
-
RCTMultilineTextInputView: "TextInput (Multiline)",
|
|
55
|
-
AndroidTextInput: "TextInput",
|
|
56
|
-
RCTInputAccessoryView: "InputAccessoryView",
|
|
57
|
-
// ==========================================================================
|
|
58
|
-
// REACT NATIVE CORE - Lists (FlatList/SectionList internals)
|
|
59
|
-
// ==========================================================================
|
|
60
|
-
RCTRefreshControl: "RefreshControl",
|
|
61
|
-
AndroidSwipeRefreshLayout: "RefreshControl",
|
|
62
|
-
PullToRefreshView: "RefreshControl",
|
|
63
|
-
// ==========================================================================
|
|
64
|
-
// REACT NATIVE CORE - Buttons & Touchables
|
|
65
|
-
// ==========================================================================
|
|
66
|
-
RCTSwitch: "Switch",
|
|
67
|
-
AndroidSwitch: "Switch",
|
|
68
|
-
RCTSlider: "Slider",
|
|
69
|
-
// ==========================================================================
|
|
70
|
-
// REACT NATIVE CORE - Activity Indicators
|
|
71
|
-
// ==========================================================================
|
|
72
|
-
RCTActivityIndicatorView: "ActivityIndicator",
|
|
73
|
-
AndroidProgressBar: "ActivityIndicator",
|
|
74
|
-
// ==========================================================================
|
|
75
|
-
// REACT NATIVE CORE - Android-specific
|
|
76
|
-
// ==========================================================================
|
|
77
|
-
AndroidDrawerLayout: "DrawerLayout",
|
|
78
|
-
VirtualView: "VirtualView",
|
|
79
|
-
VirtualViewExperimental: "VirtualView",
|
|
80
|
-
// ==========================================================================
|
|
81
|
-
// REACT NATIVE CORE - Debugging & Internal
|
|
82
|
-
// ==========================================================================
|
|
83
|
-
DebuggingOverlay: "DebuggingOverlay",
|
|
84
|
-
LayoutConformance: "LayoutConformance",
|
|
85
|
-
UnimplementedNativeView: "UnimplementedView",
|
|
86
|
-
// ==========================================================================
|
|
87
|
-
// REACT NATIVE CORE - Legacy/Deprecated
|
|
88
|
-
// ==========================================================================
|
|
89
|
-
RKShimmeringView: "ShimmeringView",
|
|
90
|
-
RCTTemplateView: "TemplateView",
|
|
91
|
-
RCTAxialGradientView: "AxialGradientView",
|
|
92
|
-
// "RCTVideo": "Video",
|
|
93
|
-
RCTMap: "Map",
|
|
94
|
-
RCTWebView: "WebView",
|
|
95
|
-
RCTKeyframes: "Keyframes",
|
|
96
|
-
RCTImpressionTrackingView: "ImpressionTrackingView",
|
|
97
|
-
// ==========================================================================
|
|
98
|
-
// REACT-NATIVE-SVG
|
|
99
|
-
// ==========================================================================
|
|
100
|
-
RNSVGSvgView: "Svg",
|
|
101
|
-
RNSVGGroup: "G",
|
|
102
|
-
RNSVGPath: "Path",
|
|
103
|
-
RNSVGText: "SvgText",
|
|
104
|
-
RNSVGTSpan: "TSpan",
|
|
105
|
-
RNSVGTextPath: "TextPath",
|
|
106
|
-
RNSVGImage: "SvgImage",
|
|
107
|
-
RNSVGCircle: "Circle",
|
|
108
|
-
RNSVGEllipse: "Ellipse",
|
|
109
|
-
RNSVGLine: "Line",
|
|
110
|
-
RNSVGRect: "Rect",
|
|
111
|
-
RNSVGClipPath: "ClipPath",
|
|
112
|
-
RNSVGDefs: "Defs",
|
|
113
|
-
RNSVGUse: "Use",
|
|
114
|
-
RNSVGSymbol: "Symbol",
|
|
115
|
-
RNSVGPattern: "Pattern",
|
|
116
|
-
RNSVGMask: "Mask",
|
|
117
|
-
RNSVGForeignObject: "ForeignObject",
|
|
118
|
-
RNSVGMarker: "Marker",
|
|
119
|
-
RNSVGLinearGradient: "LinearGradient",
|
|
120
|
-
RNSVGRadialGradient: "RadialGradient",
|
|
121
|
-
RNSVGFilter: "Filter",
|
|
122
|
-
RNSVGFeBlend: "FeBlend",
|
|
123
|
-
RNSVGFeColorMatrix: "FeColorMatrix",
|
|
124
|
-
RNSVGFeComposite: "FeComposite",
|
|
125
|
-
RNSVGFeFlood: "FeFlood",
|
|
126
|
-
RNSVGFeGaussianBlur: "FeGaussianBlur",
|
|
127
|
-
RNSVGFeMerge: "FeMerge",
|
|
128
|
-
RNSVGFeOffset: "FeOffset",
|
|
129
|
-
RNSVGPolygon: "Polygon",
|
|
130
|
-
RNSVGPolyline: "Polyline",
|
|
131
|
-
RNSVGStop: "Stop",
|
|
132
|
-
// ==========================================================================
|
|
133
|
-
// REACT-NATIVE-GESTURE-HANDLER
|
|
134
|
-
// ==========================================================================
|
|
135
|
-
RNGestureHandlerRootView: "GestureHandlerRootView",
|
|
136
|
-
RNGestureHandlerButton: "GestureHandlerButton",
|
|
137
|
-
// ==========================================================================
|
|
138
|
-
// REACT-NATIVE-SAFE-AREA-CONTEXT
|
|
139
|
-
// ==========================================================================
|
|
140
|
-
RNCSafeAreaProvider: "SafeAreaProvider",
|
|
141
|
-
RNCSafeAreaView: "SafeAreaView",
|
|
142
|
-
// ==========================================================================
|
|
143
|
-
// REACT-NATIVE-SCREENS (React Navigation)
|
|
144
|
-
// ==========================================================================
|
|
145
|
-
RNSScreen: "Screen",
|
|
146
|
-
RNSScreenContainer: "ScreenContainer",
|
|
147
|
-
RNSScreenStack: "ScreenStack",
|
|
148
|
-
RNSScreenStackHeaderConfig: "ScreenStackHeaderConfig",
|
|
149
|
-
RNSScreenStackHeaderSubview: "ScreenStackHeaderSubview",
|
|
150
|
-
RNSSearchBar: "SearchBar",
|
|
151
|
-
RNSFullWindowOverlay: "FullWindowOverlay",
|
|
152
|
-
RNSModalScreen: "ModalScreen",
|
|
153
|
-
// ==========================================================================
|
|
154
|
-
// REACT-NATIVE-REANIMATED
|
|
155
|
-
// ==========================================================================
|
|
156
|
-
ReanimatedView: "Animated.View",
|
|
157
|
-
// ==========================================================================
|
|
158
|
-
// EXPO MODULES
|
|
159
|
-
// ==========================================================================
|
|
160
|
-
ExpoView: "ExpoView",
|
|
161
|
-
ExpoBlurView: "BlurView",
|
|
162
|
-
ExpoLinearGradient: "LinearGradient",
|
|
163
|
-
ExpoImage: "ExpoImage",
|
|
164
|
-
ExpoVideoView: "VideoView",
|
|
165
|
-
ExpoCamera: "Camera",
|
|
166
|
-
ExpoBarCodeScannerView: "BarCodeScanner",
|
|
167
|
-
// ==========================================================================
|
|
168
|
-
// REACT-NATIVE-WEBVIEW
|
|
169
|
-
// ==========================================================================
|
|
170
|
-
RNCWebView: "WebView",
|
|
171
|
-
// ==========================================================================
|
|
172
|
-
// REACT-NATIVE-MAPS
|
|
173
|
-
// ==========================================================================
|
|
174
|
-
AIRMap: "MapView",
|
|
175
|
-
AIRMapMarker: "Marker",
|
|
176
|
-
AIRMapPolyline: "Polyline",
|
|
177
|
-
AIRMapPolygon: "Polygon",
|
|
178
|
-
AIRMapCircle: "Circle",
|
|
179
|
-
AIRMapCallout: "Callout",
|
|
180
|
-
// ==========================================================================
|
|
181
|
-
// REACT-NATIVE-VIDEO
|
|
182
|
-
// ==========================================================================
|
|
183
|
-
RCTVideo: "Video",
|
|
184
|
-
// ==========================================================================
|
|
185
|
-
// LOTTIE-REACT-NATIVE
|
|
186
|
-
// ==========================================================================
|
|
187
|
-
LottieAnimationView: "LottieView",
|
|
188
|
-
// ==========================================================================
|
|
189
|
-
// REACT-NATIVE-FAST-IMAGE
|
|
190
|
-
// ==========================================================================
|
|
191
|
-
FastImageView: "FastImage"
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Get the developer-friendly component name for a native view type.
|
|
196
|
-
* Returns the original viewType if no mapping exists.
|
|
197
|
-
*
|
|
198
|
-
* @param viewType - The native view class name (e.g., "RCTView")
|
|
199
|
-
* @returns The component name (e.g., "View")
|
|
200
|
-
*/
|
|
201
|
-
export function getComponentDisplayName(viewType) {
|
|
202
|
-
return VIEW_TYPE_MAP[viewType] || viewType;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Get the native view class name for a component name (reverse lookup).
|
|
207
|
-
* Returns null if no mapping exists.
|
|
208
|
-
*
|
|
209
|
-
* @param componentName - The component name (e.g., "View")
|
|
210
|
-
* @returns The native view class name (e.g., "RCTView") or null
|
|
211
|
-
*/
|
|
212
|
-
export function getNativeViewType(componentName) {
|
|
213
|
-
for (const [native, display] of Object.entries(VIEW_TYPE_MAP)) {
|
|
214
|
-
if (display === componentName) {
|
|
215
|
-
return native;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
return null;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* Check if a view type is a known native component.
|
|
223
|
-
*
|
|
224
|
-
* @param viewType - The native view class name
|
|
225
|
-
* @returns true if it's a known component
|
|
226
|
-
*/
|
|
227
|
-
export function isKnownViewType(viewType) {
|
|
228
|
-
return viewType in VIEW_TYPE_MAP;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Get all known view types (useful for autocomplete/suggestions).
|
|
233
|
-
*
|
|
234
|
-
* @returns Array of all native view class names
|
|
235
|
-
*/
|
|
236
|
-
export function getAllNativeViewTypes() {
|
|
237
|
-
return Object.keys(VIEW_TYPE_MAP);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Get all known component names (useful for autocomplete/suggestions).
|
|
242
|
-
*
|
|
243
|
-
* @returns Array of all component display names
|
|
244
|
-
*/
|
|
245
|
-
export function getAllComponentNames() {
|
|
246
|
-
return [...new Set(Object.values(VIEW_TYPE_MAP))];
|
|
247
|
-
}
|
|
248
|
-
export default {
|
|
249
|
-
VIEW_TYPE_MAP,
|
|
250
|
-
getComponentDisplayName,
|
|
251
|
-
getNativeViewType,
|
|
252
|
-
isKnownViewType,
|
|
253
|
-
getAllNativeViewTypes,
|
|
254
|
-
getAllComponentNames
|
|
255
|
-
};
|
|
1
|
+
"use strict";export const VIEW_TYPE_MAP={RCTView:"View",RCTSafeAreaView:"SafeAreaView",RCTModalHostView:"Modal",RCTText:"Text",RCTRawText:"RawText",RCTVirtualText:"VirtualText",RCTTextInlineImage:"TextInlineImage",RCTImageView:"Image",RCTImage:"Image",RCTScrollView:"ScrollView",RCTScrollContentView:"ScrollContentView",AndroidHorizontalScrollView:"HorizontalScrollView",AndroidHorizontalScrollContentView:"HorizontalScrollContentView",RCTSinglelineTextInputView:"TextInput",RCTMultilineTextInputView:"TextInput (Multiline)",AndroidTextInput:"TextInput",RCTInputAccessoryView:"InputAccessoryView",RCTRefreshControl:"RefreshControl",AndroidSwipeRefreshLayout:"RefreshControl",PullToRefreshView:"RefreshControl",RCTSwitch:"Switch",AndroidSwitch:"Switch",RCTSlider:"Slider",RCTActivityIndicatorView:"ActivityIndicator",AndroidProgressBar:"ActivityIndicator",AndroidDrawerLayout:"DrawerLayout",VirtualView:"VirtualView",VirtualViewExperimental:"VirtualView",DebuggingOverlay:"DebuggingOverlay",LayoutConformance:"LayoutConformance",UnimplementedNativeView:"UnimplementedView",RKShimmeringView:"ShimmeringView",RCTTemplateView:"TemplateView",RCTAxialGradientView:"AxialGradientView",RCTMap:"Map",RCTWebView:"WebView",RCTKeyframes:"Keyframes",RCTImpressionTrackingView:"ImpressionTrackingView",RNSVGSvgView:"Svg",RNSVGGroup:"G",RNSVGPath:"Path",RNSVGText:"SvgText",RNSVGTSpan:"TSpan",RNSVGTextPath:"TextPath",RNSVGImage:"SvgImage",RNSVGCircle:"Circle",RNSVGEllipse:"Ellipse",RNSVGLine:"Line",RNSVGRect:"Rect",RNSVGClipPath:"ClipPath",RNSVGDefs:"Defs",RNSVGUse:"Use",RNSVGSymbol:"Symbol",RNSVGPattern:"Pattern",RNSVGMask:"Mask",RNSVGForeignObject:"ForeignObject",RNSVGMarker:"Marker",RNSVGLinearGradient:"LinearGradient",RNSVGRadialGradient:"RadialGradient",RNSVGFilter:"Filter",RNSVGFeBlend:"FeBlend",RNSVGFeColorMatrix:"FeColorMatrix",RNSVGFeComposite:"FeComposite",RNSVGFeFlood:"FeFlood",RNSVGFeGaussianBlur:"FeGaussianBlur",RNSVGFeMerge:"FeMerge",RNSVGFeOffset:"FeOffset",RNSVGPolygon:"Polygon",RNSVGPolyline:"Polyline",RNSVGStop:"Stop",RNGestureHandlerRootView:"GestureHandlerRootView",RNGestureHandlerButton:"GestureHandlerButton",RNCSafeAreaProvider:"SafeAreaProvider",RNCSafeAreaView:"SafeAreaView",RNSScreen:"Screen",RNSScreenContainer:"ScreenContainer",RNSScreenStack:"ScreenStack",RNSScreenStackHeaderConfig:"ScreenStackHeaderConfig",RNSScreenStackHeaderSubview:"ScreenStackHeaderSubview",RNSSearchBar:"SearchBar",RNSFullWindowOverlay:"FullWindowOverlay",RNSModalScreen:"ModalScreen",ReanimatedView:"Animated.View",ExpoView:"ExpoView",ExpoBlurView:"BlurView",ExpoLinearGradient:"LinearGradient",ExpoImage:"ExpoImage",ExpoVideoView:"VideoView",ExpoCamera:"Camera",ExpoBarCodeScannerView:"BarCodeScanner",RNCWebView:"WebView",AIRMap:"MapView",AIRMapMarker:"Marker",AIRMapPolyline:"Polyline",AIRMapPolygon:"Polygon",AIRMapCircle:"Circle",AIRMapCallout:"Callout",RCTVideo:"Video",LottieAnimationView:"LottieView",FastImageView:"FastImage"};export function getComponentDisplayName(e){return VIEW_TYPE_MAP[e]||e}export function getNativeViewType(e){for(const[i,t]of Object.entries(VIEW_TYPE_MAP))if(t===e)return i;return null}export function isKnownViewType(e){return e in VIEW_TYPE_MAP}export function getAllNativeViewTypes(){return Object.keys(VIEW_TYPE_MAP)}export function getAllComponentNames(){return[...new Set(Object.values(VIEW_TYPE_MAP))]}export default{VIEW_TYPE_MAP:VIEW_TYPE_MAP,getComponentDisplayName:getComponentDisplayName,getNativeViewType:getNativeViewType,isKnownViewType:isKnownViewType,getAllNativeViewTypes:getAllNativeViewTypes,getAllComponentNames:getAllComponentNames};
|
|
@@ -1,54 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Render Export Formatter
|
|
5
|
-
*
|
|
6
|
-
* Simple JSON export for render tracking data.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Generate JSON export of all tracked renders
|
|
11
|
-
*/
|
|
12
|
-
export function generateRendersJson(renders) {
|
|
13
|
-
const exportData = {
|
|
14
|
-
exportedAt: new Date().toISOString(),
|
|
15
|
-
totalComponents: renders.length,
|
|
16
|
-
totalRenders: renders.reduce((sum, r) => sum + r.renderCount, 0),
|
|
17
|
-
components: renders.map(render => ({
|
|
18
|
-
// Identity
|
|
19
|
-
componentName: render.componentName || render.displayName,
|
|
20
|
-
viewType: render.viewType,
|
|
21
|
-
nativeTag: render.nativeTag,
|
|
22
|
-
// Identifiers
|
|
23
|
-
testID: render.testID,
|
|
24
|
-
nativeID: render.nativeID,
|
|
25
|
-
accessibilityLabel: render.accessibilityLabel,
|
|
26
|
-
// Render stats
|
|
27
|
-
renderCount: render.renderCount,
|
|
28
|
-
firstRenderTime: render.firstRenderTime,
|
|
29
|
-
lastRenderTime: render.lastRenderTime,
|
|
30
|
-
// Last render cause
|
|
31
|
-
lastRenderCause: render.lastRenderCause ? {
|
|
32
|
-
type: render.lastRenderCause.type,
|
|
33
|
-
componentCause: render.lastRenderCause.componentCause,
|
|
34
|
-
changedKeys: render.lastRenderCause.changedKeys,
|
|
35
|
-
hookChanges: render.lastRenderCause.hookChanges?.map(h => ({
|
|
36
|
-
type: h.type,
|
|
37
|
-
index: h.index,
|
|
38
|
-
description: h.description
|
|
39
|
-
}))
|
|
40
|
-
} : null,
|
|
41
|
-
// Render history (if available)
|
|
42
|
-
renderHistory: render.renderHistory?.map(event => ({
|
|
43
|
-
renderNumber: event.renderNumber,
|
|
44
|
-
timestamp: event.timestamp,
|
|
45
|
-
cause: {
|
|
46
|
-
type: event.cause.type,
|
|
47
|
-
componentCause: event.cause.componentCause,
|
|
48
|
-
changedKeys: event.cause.changedKeys
|
|
49
|
-
}
|
|
50
|
-
}))
|
|
51
|
-
}))
|
|
52
|
-
};
|
|
53
|
-
return JSON.stringify(exportData, null, 2);
|
|
54
|
-
}
|
|
1
|
+
"use strict";export function generateRendersJson(e){const n={exportedAt:(new Date).toISOString(),totalComponents:e.length,totalRenders:e.reduce((e,n)=>e+n.renderCount,0),components:e.map(e=>({componentName:e.componentName||e.displayName,viewType:e.viewType,nativeTag:e.nativeTag,testID:e.testID,nativeID:e.nativeID,accessibilityLabel:e.accessibilityLabel,renderCount:e.renderCount,firstRenderTime:e.firstRenderTime,lastRenderTime:e.lastRenderTime,lastRenderCause:e.lastRenderCause?{type:e.lastRenderCause.type,componentCause:e.lastRenderCause.componentCause,changedKeys:e.lastRenderCause.changedKeys,hookChanges:e.lastRenderCause.hookChanges?.map(e=>({type:e.type,index:e.index,description:e.description}))}:null,renderHistory:e.renderHistory?.map(e=>({renderNumber:e.renderNumber,timestamp:e.timestamp,cause:{type:e.cause.type,componentCause:e.cause.componentCause,changedKeys:e.cause.changedKeys}}))}))};return JSON.stringify(n,null,2)}
|
package/lib/module/index.js
CHANGED
|
@@ -1,71 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @buoy-gg/highlight-updates
|
|
5
|
-
*
|
|
6
|
-
* Standalone implementation of React DevTools' "Highlight updates when components
|
|
7
|
-
* render" feature. Works without requiring DevTools to be connected.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```tsx
|
|
11
|
-
* // Toggle-only preset - tap to enable/disable highlights
|
|
12
|
-
* import { highlightUpdatesPreset } from '@buoy-gg/highlight-updates';
|
|
13
|
-
*
|
|
14
|
-
* <FloatingDevTools apps={[highlightUpdatesPreset]} />
|
|
15
|
-
*
|
|
16
|
-
* // Modal preset - full interface with filters and render list
|
|
17
|
-
* import { highlightUpdatesModalPreset } from '@buoy-gg/highlight-updates';
|
|
18
|
-
*
|
|
19
|
-
* <FloatingDevTools apps={[highlightUpdatesModalPreset]} />
|
|
20
|
-
*
|
|
21
|
-
* // Or use the standalone controller programmatically
|
|
22
|
-
* import { HighlightUpdatesController } from '@buoy-gg/highlight-updates';
|
|
23
|
-
*
|
|
24
|
-
* HighlightUpdatesController.toggle();
|
|
25
|
-
* HighlightUpdatesController.enable();
|
|
26
|
-
* HighlightUpdatesController.disable();
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
// Preset exports for FloatingDevTools integration
|
|
31
|
-
export { highlightUpdatesPreset, createHighlightUpdatesTool, highlightUpdatesModalPreset, createHighlightUpdatesModalTool } from "./preset";
|
|
32
|
-
|
|
33
|
-
// Controller export for standalone usage
|
|
34
|
-
export { default as HighlightUpdatesController } from "./highlight-updates/utils/HighlightUpdatesController";
|
|
35
|
-
|
|
36
|
-
// Overlay component - auto-rendered by FloatingDevTools, but exported for manual usage
|
|
37
|
-
export { HighlightUpdatesOverlay } from "./highlight-updates/HighlightUpdatesOverlay";
|
|
38
|
-
|
|
39
|
-
// Profiler interceptor for debugging - captures what DevTools detects
|
|
40
|
-
export { installProfilerInterceptor, uninstallProfilerInterceptor, setComparisonCallback, isInterceptorInstalled, enableProfilerLogging, disableProfilerLogging, isLoggingEnabled } from "./highlight-updates/utils/ProfilerInterceptor";
|
|
41
|
-
|
|
42
|
-
// RenderTracker singleton for tracking render history
|
|
43
|
-
export { RenderTracker } from "./highlight-updates/utils/RenderTracker";
|
|
44
|
-
// Convenience export for unified events integration
|
|
45
|
-
export const onRenderEvent = callback => {
|
|
46
|
-
const {
|
|
47
|
-
RenderTracker
|
|
48
|
-
} = require("./highlight-updates/utils/RenderTracker");
|
|
49
|
-
return RenderTracker.onRenderEvent(callback);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
// RenderCauseDetector for detecting why components rendered
|
|
53
|
-
export { detectRenderCause, clearRenderCauseState, removeRenderCauseState, getRenderCauseStats,
|
|
54
|
-
// Snapshot capture for render history
|
|
55
|
-
safeCloneForHistory, capturePropsSnapshot, captureStateSnapshot } from "./highlight-updates/utils/RenderCauseDetector";
|
|
56
|
-
|
|
57
|
-
// PerformanceLogger for performance measurement and debugging
|
|
58
|
-
export { PerformanceLogger } from "./highlight-updates/utils/PerformanceLogger";
|
|
59
|
-
// ViewTypeMapper for translating native view names to component names
|
|
60
|
-
export { VIEW_TYPE_MAP, getComponentDisplayName, getNativeViewType, isKnownViewType, getAllNativeViewTypes, getAllComponentNames } from "./highlight-updates/utils/ViewTypeMapper";
|
|
61
|
-
|
|
62
|
-
// Modal components for custom integrations
|
|
63
|
-
export { HighlightUpdatesModal } from "./highlight-updates/components/HighlightUpdatesModal";
|
|
64
|
-
export { RenderListItem } from "./highlight-updates/components/RenderListItem";
|
|
65
|
-
export { RenderDetailView } from "./highlight-updates/components/RenderDetailView";
|
|
66
|
-
export { HighlightFilterView } from "./highlight-updates/components/HighlightFilterView";
|
|
67
|
-
export { RenderCauseBadge, TwoLevelCauseBadge, CAUSE_CONFIG, COMPONENT_CAUSE_CONFIG } from "./highlight-updates/components/RenderCauseBadge";
|
|
68
|
-
export { RenderHistoryViewer, RenderHistoryFooter } from "./highlight-updates/components/RenderHistoryViewer";
|
|
69
|
-
|
|
70
|
-
// Simple JSON export for renders
|
|
71
|
-
export { generateRendersJson } from "./highlight-updates/utils/renderExportFormatter";
|
|
1
|
+
"use strict";export{highlightUpdatesPreset,createHighlightUpdatesTool,highlightUpdatesModalPreset,createHighlightUpdatesModalTool}from"./preset";export{default as HighlightUpdatesController}from"./highlight-updates/utils/HighlightUpdatesController";export{HighlightUpdatesOverlay}from"./highlight-updates/HighlightUpdatesOverlay";export{installProfilerInterceptor,uninstallProfilerInterceptor,setComparisonCallback,isInterceptorInstalled,enableProfilerLogging,disableProfilerLogging,isLoggingEnabled}from"./highlight-updates/utils/ProfilerInterceptor";export{RenderTracker}from"./highlight-updates/utils/RenderTracker";export const onRenderEvent=e=>{const{RenderTracker:t}=require("./highlight-updates/utils/RenderTracker");return t.onRenderEvent(e)};export{detectRenderCause,clearRenderCauseState,removeRenderCauseState,getRenderCauseStats,safeCloneForHistory,capturePropsSnapshot,captureStateSnapshot}from"./highlight-updates/utils/RenderCauseDetector";export{PerformanceLogger}from"./highlight-updates/utils/PerformanceLogger";export{VIEW_TYPE_MAP,getComponentDisplayName,getNativeViewType,isKnownViewType,getAllNativeViewTypes,getAllComponentNames}from"./highlight-updates/utils/ViewTypeMapper";export{HighlightUpdatesModal}from"./highlight-updates/components/HighlightUpdatesModal";export{RenderListItem}from"./highlight-updates/components/RenderListItem";export{RenderDetailView}from"./highlight-updates/components/RenderDetailView";export{HighlightFilterView}from"./highlight-updates/components/HighlightFilterView";export{RenderCauseBadge,TwoLevelCauseBadge,CAUSE_CONFIG,COMPONENT_CAUSE_CONFIG}from"./highlight-updates/components/RenderCauseBadge";export{RenderHistoryViewer,RenderHistoryFooter}from"./highlight-updates/components/RenderHistoryViewer";export{generateRendersJson}from"./highlight-updates/utils/renderExportFormatter";
|
package/lib/module/preset.js
CHANGED
|
@@ -1,272 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Pre-configured highlight updates tool for FloatingDevTools
|
|
5
|
-
*
|
|
6
|
-
* This preset provides standalone "Highlight updates when components render"
|
|
7
|
-
* functionality. Tap the icon to toggle highlights on/off.
|
|
8
|
-
*
|
|
9
|
-
* The overlay is automatically rendered by FloatingDevTools when the
|
|
10
|
-
* @buoy-gg/highlight-updates package is installed.
|
|
11
|
-
*
|
|
12
|
-
* Two presets available:
|
|
13
|
-
* - highlightUpdatesPreset: Quick toggle (no modal)
|
|
14
|
-
* - highlightUpdatesModalPreset: Full modal with filters and render list
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```tsx
|
|
18
|
-
* import { highlightUpdatesPreset, highlightUpdatesModalPreset } from '@buoy-gg/highlight-updates';
|
|
19
|
-
*
|
|
20
|
-
* // Toggle-only: Just tap to enable/disable highlighting
|
|
21
|
-
* <FloatingDevTools apps={[highlightUpdatesPreset]} />
|
|
22
|
-
*
|
|
23
|
-
* // Modal: Opens interface with filters, render list, and controls
|
|
24
|
-
* <FloatingDevTools apps={[highlightUpdatesModalPreset]} />
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
import React, { useState, useEffect, useCallback } from "react";
|
|
29
|
-
import { HighlighterIcon, HighlightIcon as HighlightIconBase } from "@buoy-gg/floating-tools-core";
|
|
30
|
-
import HighlightUpdatesController from "./highlight-updates/utils/HighlightUpdatesController";
|
|
31
|
-
import { HighlightUpdatesModal } from "./highlight-updates/components/HighlightUpdatesModal";
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Icon component that changes color based on enabled state.
|
|
35
|
-
*
|
|
36
|
-
* ⚠️ IMPORTANT - DO NOT MODIFY THIS COMPONENT ⚠️
|
|
37
|
-
* This component MUST use useState and useEffect hooks to subscribe to the controller.
|
|
38
|
-
* It is rendered as a JSX component (<IconComponent />) in FloatingMenu and DialIcon,
|
|
39
|
-
* which allows hooks to work properly.
|
|
40
|
-
*
|
|
41
|
-
* If you remove the hooks or change this to read isEnabled() directly,
|
|
42
|
-
* the icon color will NOT update when the toggle is pressed.
|
|
43
|
-
*/
|
|
44
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
45
|
-
function HighlightIcon({
|
|
46
|
-
size
|
|
47
|
-
}) {
|
|
48
|
-
const [enabled, setEnabled] = useState(() => HighlightUpdatesController.isEnabled());
|
|
49
|
-
useEffect(() => {
|
|
50
|
-
const unsubscribe = HighlightUpdatesController.subscribe(isEnabled => {
|
|
51
|
-
setEnabled(isEnabled);
|
|
52
|
-
});
|
|
53
|
-
return unsubscribe;
|
|
54
|
-
}, []);
|
|
55
|
-
return /*#__PURE__*/_jsx(HighlightIconBase, {
|
|
56
|
-
size: size,
|
|
57
|
-
color: enabled ? "#10b981" : "#6b7280"
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Empty component for toggle-only tools (no modal needed)
|
|
63
|
-
* The actual overlay is rendered by FloatingDevTools automatically
|
|
64
|
-
*/
|
|
65
|
-
function EmptyComponent() {
|
|
66
|
-
return null;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Wrapper component for the modal that handles badge press navigation.
|
|
71
|
-
* Registers a callback with the controller to receive badge press events
|
|
72
|
-
* and passes the target nativeTag to the modal for deep linking.
|
|
73
|
-
*/
|
|
74
|
-
function HighlightUpdatesModalWithBadgeNavigation(props) {
|
|
75
|
-
const [targetNativeTag, setTargetNativeTag] = useState(null);
|
|
76
|
-
|
|
77
|
-
// Register badge press callback when modal is visible
|
|
78
|
-
useEffect(() => {
|
|
79
|
-
if (props.visible) {
|
|
80
|
-
// Register callback to handle badge presses
|
|
81
|
-
HighlightUpdatesController.setBadgePressCallback(nativeTag => {
|
|
82
|
-
setTargetNativeTag(nativeTag);
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
return () => {
|
|
86
|
-
// Clear callback when modal is closed or unmounted
|
|
87
|
-
if (!props.visible) {
|
|
88
|
-
HighlightUpdatesController.setBadgePressCallback(null);
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
}, [props.visible]);
|
|
92
|
-
|
|
93
|
-
// Clear the target after it's been handled
|
|
94
|
-
const handleInitialNativeTagHandled = useCallback(() => {
|
|
95
|
-
setTargetNativeTag(null);
|
|
96
|
-
}, []);
|
|
97
|
-
return /*#__PURE__*/_jsx(HighlightUpdatesModal, {
|
|
98
|
-
...props,
|
|
99
|
-
initialNativeTag: targetNativeTag,
|
|
100
|
-
onInitialNativeTagHandled: handleInitialNativeTagHandled
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Pre-configured highlight updates tool for FloatingDevTools.
|
|
106
|
-
* Tap the icon to toggle component render highlighting on/off.
|
|
107
|
-
*
|
|
108
|
-
* Features:
|
|
109
|
-
* - Standalone implementation - no DevTools connection required
|
|
110
|
-
* - Simple direct toggle (no modal)
|
|
111
|
-
* - Icon changes color: gray when off, green when on
|
|
112
|
-
* - Overlay auto-rendered by FloatingDevTools
|
|
113
|
-
*/
|
|
114
|
-
export const highlightUpdatesPreset = {
|
|
115
|
-
id: "highlight-updates",
|
|
116
|
-
name: "TOGGLE HIGHLIGHT",
|
|
117
|
-
description: "Toggle component render highlights",
|
|
118
|
-
slot: "row",
|
|
119
|
-
icon: HighlightIcon,
|
|
120
|
-
component: EmptyComponent,
|
|
121
|
-
props: {},
|
|
122
|
-
launchMode: "toggle-only",
|
|
123
|
-
onPress: () => {
|
|
124
|
-
// Initialize on first press if not already initialized
|
|
125
|
-
if (!HighlightUpdatesController.isInitialized()) {
|
|
126
|
-
HighlightUpdatesController.initialize();
|
|
127
|
-
}
|
|
128
|
-
HighlightUpdatesController.toggle();
|
|
129
|
-
// Icon updates automatically via subscription in HighlightIcon component
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Create a custom highlight updates tool configuration.
|
|
135
|
-
* Use this if you want to override default settings.
|
|
136
|
-
*
|
|
137
|
-
* @example
|
|
138
|
-
* ```tsx
|
|
139
|
-
* import { createHighlightUpdatesTool } from '@buoy-gg/highlight-updates';
|
|
140
|
-
*
|
|
141
|
-
* const myHighlightTool = createHighlightUpdatesTool({
|
|
142
|
-
* name: "RENDERS",
|
|
143
|
-
* enabledColor: "#ec4899",
|
|
144
|
-
* disabledColor: "#9ca3af",
|
|
145
|
-
* autoInitialize: true,
|
|
146
|
-
* });
|
|
147
|
-
* ```
|
|
148
|
-
*/
|
|
149
|
-
export function createHighlightUpdatesTool(options) {
|
|
150
|
-
const enabledColor = options?.enabledColor || "#10b981";
|
|
151
|
-
const disabledColor = options?.disabledColor || "#6b7280";
|
|
152
|
-
|
|
153
|
-
// Auto-initialize if requested
|
|
154
|
-
if (options?.autoInitialize) {
|
|
155
|
-
// Delay to allow DevTools to connect
|
|
156
|
-
setTimeout(() => {
|
|
157
|
-
HighlightUpdatesController.initialize();
|
|
158
|
-
}, 1000);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Custom icon component with hooks - rendered as JSX component.
|
|
163
|
-
*
|
|
164
|
-
* ⚠️ IMPORTANT - DO NOT MODIFY THIS COMPONENT ⚠️
|
|
165
|
-
* This component MUST use useState and useEffect hooks to subscribe to the controller.
|
|
166
|
-
* See the comment on HighlightIcon above for full explanation.
|
|
167
|
-
*/
|
|
168
|
-
const CustomHighlightIcon = ({
|
|
169
|
-
size
|
|
170
|
-
}) => {
|
|
171
|
-
const [enabled, setEnabled] = useState(() => HighlightUpdatesController.isEnabled());
|
|
172
|
-
useEffect(() => {
|
|
173
|
-
const unsubscribe = HighlightUpdatesController.subscribe(isEnabled => {
|
|
174
|
-
setEnabled(isEnabled);
|
|
175
|
-
});
|
|
176
|
-
return unsubscribe;
|
|
177
|
-
}, []);
|
|
178
|
-
return /*#__PURE__*/_jsx(HighlightIconBase, {
|
|
179
|
-
size: size,
|
|
180
|
-
color: enabled ? enabledColor : disabledColor
|
|
181
|
-
});
|
|
182
|
-
};
|
|
183
|
-
return {
|
|
184
|
-
id: options?.id || "highlight-updates",
|
|
185
|
-
name: options?.name || "TOGGLE HIGHLIGHT",
|
|
186
|
-
description: options?.description || "Toggle component render highlights",
|
|
187
|
-
slot: "row",
|
|
188
|
-
icon: CustomHighlightIcon,
|
|
189
|
-
component: EmptyComponent,
|
|
190
|
-
props: {},
|
|
191
|
-
launchMode: "toggle-only",
|
|
192
|
-
onPress: () => {
|
|
193
|
-
// Initialize on first press if not already initialized
|
|
194
|
-
if (!HighlightUpdatesController.isInitialized()) {
|
|
195
|
-
HighlightUpdatesController.initialize();
|
|
196
|
-
}
|
|
197
|
-
HighlightUpdatesController.toggle();
|
|
198
|
-
// Icon updates automatically via subscription
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Modal preset for highlight updates tool.
|
|
205
|
-
* Opens a full modal interface with:
|
|
206
|
-
* - List of tracked component renders
|
|
207
|
-
* - Start/Stop and Pause/Resume controls
|
|
208
|
-
* - Clear button to reset render counts
|
|
209
|
-
* - Search bar in navbar (expandable)
|
|
210
|
-
* - Filter by viewType, testID, nativeID, componentName
|
|
211
|
-
* - Tap overlay badge to jump to component detail view
|
|
212
|
-
*
|
|
213
|
-
* Use this preset when you want detailed render tracking and filtering.
|
|
214
|
-
*/
|
|
215
|
-
export const highlightUpdatesModalPreset = {
|
|
216
|
-
id: "highlight-updates-modal",
|
|
217
|
-
name: "HIGHLIGHT",
|
|
218
|
-
description: "View component render tracking modal",
|
|
219
|
-
slot: "both",
|
|
220
|
-
icon: ({
|
|
221
|
-
size
|
|
222
|
-
}) => /*#__PURE__*/_jsx(HighlighterIcon, {
|
|
223
|
-
size: size
|
|
224
|
-
}),
|
|
225
|
-
component: HighlightUpdatesModalWithBadgeNavigation,
|
|
226
|
-
props: {
|
|
227
|
-
enableSharedModalDimensions: false
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Create a custom highlight updates modal tool configuration.
|
|
233
|
-
* Use this if you want to override default settings for the modal version.
|
|
234
|
-
*
|
|
235
|
-
* @example
|
|
236
|
-
* ```tsx
|
|
237
|
-
* import { createHighlightUpdatesModalTool } from '@buoy-gg/highlight-updates';
|
|
238
|
-
*
|
|
239
|
-
* const myRendersTool = createHighlightUpdatesModalTool({
|
|
240
|
-
* name: "PROFILER",
|
|
241
|
-
* enabledColor: "#8b5cf6",
|
|
242
|
-
* disabledColor: "#9ca3af",
|
|
243
|
-
* });
|
|
244
|
-
* ```
|
|
245
|
-
*/
|
|
246
|
-
export function createHighlightUpdatesModalTool(options) {
|
|
247
|
-
const enabledColor = options?.enabledColor || "#10b981";
|
|
248
|
-
const disabledColor = options?.disabledColor || "#6b7280";
|
|
249
|
-
|
|
250
|
-
// Auto-initialize if requested
|
|
251
|
-
if (options?.autoInitialize) {
|
|
252
|
-
setTimeout(() => {
|
|
253
|
-
HighlightUpdatesController.initialize();
|
|
254
|
-
}, 1000);
|
|
255
|
-
}
|
|
256
|
-
return {
|
|
257
|
-
id: options?.id || "highlight-updates-modal",
|
|
258
|
-
name: options?.name || "HIGHLIGHT",
|
|
259
|
-
description: options?.description || "View component render tracking modal",
|
|
260
|
-
slot: "both",
|
|
261
|
-
icon: ({
|
|
262
|
-
size
|
|
263
|
-
}) => /*#__PURE__*/_jsx(HighlighterIcon, {
|
|
264
|
-
size: size,
|
|
265
|
-
color: enabledColor
|
|
266
|
-
}),
|
|
267
|
-
component: HighlightUpdatesModalWithBadgeNavigation,
|
|
268
|
-
props: {
|
|
269
|
-
enableSharedModalDimensions: false
|
|
270
|
-
}
|
|
271
|
-
};
|
|
272
|
-
}
|
|
1
|
+
"use strict";import React,{useState,useEffect,useCallback}from"react";import{HighlighterIcon,HighlightIcon as HighlightIconBase}from"@buoy-gg/floating-tools-core";import HighlightUpdatesController from"./highlight-updates/utils/HighlightUpdatesController";import{HighlightUpdatesModal}from"./highlight-updates/components/HighlightUpdatesModal";import{jsx as _jsx}from"react/jsx-runtime";function HighlightIcon({size:t}){const[i,e]=useState(()=>HighlightUpdatesController.isEnabled());return useEffect(()=>HighlightUpdatesController.subscribe(t=>{e(t)}),[]),_jsx(HighlightIconBase,{size:t,color:i?"#10b981":"#6b7280"})}function EmptyComponent(){return null}function HighlightUpdatesModalWithBadgeNavigation(t){const[i,e]=useState(null);useEffect(()=>(t.visible&&HighlightUpdatesController.setBadgePressCallback(t=>{e(t)}),()=>{t.visible||HighlightUpdatesController.setBadgePressCallback(null)}),[t.visible]);const o=useCallback(()=>{e(null)},[]);return _jsx(HighlightUpdatesModal,{...t,initialNativeTag:i,onInitialNativeTagHandled:o})}export const highlightUpdatesPreset={id:"highlight-updates",name:"TOGGLE HIGHLIGHT",description:"Toggle component render highlights",slot:"row",icon:HighlightIcon,component:EmptyComponent,props:{},launchMode:"toggle-only",onPress:()=>{HighlightUpdatesController.isInitialized()||HighlightUpdatesController.initialize(),HighlightUpdatesController.toggle()}};export function createHighlightUpdatesTool(t){const i=t?.enabledColor||"#10b981",e=t?.disabledColor||"#6b7280";return t?.autoInitialize&&setTimeout(()=>{HighlightUpdatesController.initialize()},1e3),{id:t?.id||"highlight-updates",name:t?.name||"TOGGLE HIGHLIGHT",description:t?.description||"Toggle component render highlights",slot:"row",icon:({size:t})=>{const[o,l]=useState(()=>HighlightUpdatesController.isEnabled());return useEffect(()=>HighlightUpdatesController.subscribe(t=>{l(t)}),[]),_jsx(HighlightIconBase,{size:t,color:o?i:e})},component:EmptyComponent,props:{},launchMode:"toggle-only",onPress:()=>{HighlightUpdatesController.isInitialized()||HighlightUpdatesController.initialize(),HighlightUpdatesController.toggle()}}}export const highlightUpdatesModalPreset={id:"highlight-updates-modal",name:"HIGHLIGHT",description:"View component render tracking modal",slot:"both",icon:({size:t})=>_jsx(HighlighterIcon,{size:t}),component:HighlightUpdatesModalWithBadgeNavigation,props:{enableSharedModalDimensions:!1}};export function createHighlightUpdatesModalTool(t){const i=t?.enabledColor||"#10b981";return t?.autoInitialize&&setTimeout(()=>{HighlightUpdatesController.initialize()},1e3),{id:t?.id||"highlight-updates-modal",name:t?.name||"HIGHLIGHT",description:t?.description||"View component render tracking modal",slot:"both",icon:({size:t})=>_jsx(HighlighterIcon,{size:t,color:i}),component:HighlightUpdatesModalWithBadgeNavigation,props:{enableSharedModalDimensions:!1}}}
|