@buoy-gg/highlight-updates 2.0.2

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 (63) hide show
  1. package/README.md +210 -0
  2. package/lib/commonjs/highlight-updates/HighlightUpdatesOverlay.js +1 -0
  3. package/lib/commonjs/highlight-updates/components/HighlightFilterView.js +1 -0
  4. package/lib/commonjs/highlight-updates/components/HighlightUpdatesModal.js +1 -0
  5. package/lib/commonjs/highlight-updates/components/IdentifierBadge.js +1 -0
  6. package/lib/commonjs/highlight-updates/components/IsolatedRenderList.js +1 -0
  7. package/lib/commonjs/highlight-updates/components/ModalHeaderContent.js +1 -0
  8. package/lib/commonjs/highlight-updates/components/RenderCauseBadge.js +1 -0
  9. package/lib/commonjs/highlight-updates/components/RenderDetailView.js +1 -0
  10. package/lib/commonjs/highlight-updates/components/RenderHistoryViewer.js +1 -0
  11. package/lib/commonjs/highlight-updates/components/RenderListItem.js +1 -0
  12. package/lib/commonjs/highlight-updates/components/StatsDisplay.js +1 -0
  13. package/lib/commonjs/highlight-updates/components/index.js +1 -0
  14. package/lib/commonjs/highlight-updates/utils/HighlightUpdatesController.js +1 -0
  15. package/lib/commonjs/highlight-updates/utils/PerformanceLogger.js +1 -0
  16. package/lib/commonjs/highlight-updates/utils/ProfilerInterceptor.js +1 -0
  17. package/lib/commonjs/highlight-updates/utils/RenderCauseDetector.js +1 -0
  18. package/lib/commonjs/highlight-updates/utils/RenderTracker.js +1 -0
  19. package/lib/commonjs/highlight-updates/utils/ViewTypeMapper.js +1 -0
  20. package/lib/commonjs/index.js +1 -0
  21. package/lib/commonjs/package.json +1 -0
  22. package/lib/commonjs/preset.js +1 -0
  23. package/lib/module/highlight-updates/HighlightUpdatesOverlay.js +1 -0
  24. package/lib/module/highlight-updates/components/HighlightFilterView.js +1 -0
  25. package/lib/module/highlight-updates/components/HighlightUpdatesModal.js +1 -0
  26. package/lib/module/highlight-updates/components/IdentifierBadge.js +1 -0
  27. package/lib/module/highlight-updates/components/IsolatedRenderList.js +1 -0
  28. package/lib/module/highlight-updates/components/ModalHeaderContent.js +1 -0
  29. package/lib/module/highlight-updates/components/RenderCauseBadge.js +1 -0
  30. package/lib/module/highlight-updates/components/RenderDetailView.js +1 -0
  31. package/lib/module/highlight-updates/components/RenderHistoryViewer.js +1 -0
  32. package/lib/module/highlight-updates/components/RenderListItem.js +1 -0
  33. package/lib/module/highlight-updates/components/StatsDisplay.js +1 -0
  34. package/lib/module/highlight-updates/components/index.js +1 -0
  35. package/lib/module/highlight-updates/utils/HighlightUpdatesController.js +1 -0
  36. package/lib/module/highlight-updates/utils/PerformanceLogger.js +1 -0
  37. package/lib/module/highlight-updates/utils/ProfilerInterceptor.js +1 -0
  38. package/lib/module/highlight-updates/utils/RenderCauseDetector.js +1 -0
  39. package/lib/module/highlight-updates/utils/RenderTracker.js +1 -0
  40. package/lib/module/highlight-updates/utils/ViewTypeMapper.js +1 -0
  41. package/lib/module/index.js +1 -0
  42. package/lib/module/preset.js +1 -0
  43. package/lib/typescript/highlight-updates/HighlightUpdatesOverlay.d.ts +18 -0
  44. package/lib/typescript/highlight-updates/components/HighlightFilterView.d.ts +27 -0
  45. package/lib/typescript/highlight-updates/components/HighlightUpdatesModal.d.ts +36 -0
  46. package/lib/typescript/highlight-updates/components/IdentifierBadge.d.ts +39 -0
  47. package/lib/typescript/highlight-updates/components/IsolatedRenderList.d.ts +32 -0
  48. package/lib/typescript/highlight-updates/components/ModalHeaderContent.d.ts +68 -0
  49. package/lib/typescript/highlight-updates/components/RenderCauseBadge.d.ts +43 -0
  50. package/lib/typescript/highlight-updates/components/RenderDetailView.d.ts +29 -0
  51. package/lib/typescript/highlight-updates/components/RenderHistoryViewer.d.ts +36 -0
  52. package/lib/typescript/highlight-updates/components/RenderListItem.d.ts +16 -0
  53. package/lib/typescript/highlight-updates/components/StatsDisplay.d.ts +18 -0
  54. package/lib/typescript/highlight-updates/components/index.d.ts +12 -0
  55. package/lib/typescript/highlight-updates/utils/HighlightUpdatesController.d.ts +132 -0
  56. package/lib/typescript/highlight-updates/utils/PerformanceLogger.d.ts +135 -0
  57. package/lib/typescript/highlight-updates/utils/ProfilerInterceptor.d.ts +91 -0
  58. package/lib/typescript/highlight-updates/utils/RenderCauseDetector.d.ts +68 -0
  59. package/lib/typescript/highlight-updates/utils/RenderTracker.d.ts +407 -0
  60. package/lib/typescript/highlight-updates/utils/ViewTypeMapper.d.ts +66 -0
  61. package/lib/typescript/index.d.ts +43 -0
  62. package/lib/typescript/preset.d.ts +187 -0
  63. package/package.json +73 -0
@@ -0,0 +1,66 @@
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
+ * Mapping from native view class names to React component names.
18
+ *
19
+ * Format: { "NativeClassName": "ComponentName" }
20
+ */
21
+ export declare const VIEW_TYPE_MAP: Record<string, string>;
22
+ /**
23
+ * Get the developer-friendly component name for a native view type.
24
+ * Returns the original viewType if no mapping exists.
25
+ *
26
+ * @param viewType - The native view class name (e.g., "RCTView")
27
+ * @returns The component name (e.g., "View")
28
+ */
29
+ export declare function getComponentDisplayName(viewType: string): string;
30
+ /**
31
+ * Get the native view class name for a component name (reverse lookup).
32
+ * Returns null if no mapping exists.
33
+ *
34
+ * @param componentName - The component name (e.g., "View")
35
+ * @returns The native view class name (e.g., "RCTView") or null
36
+ */
37
+ export declare function getNativeViewType(componentName: string): string | null;
38
+ /**
39
+ * Check if a view type is a known native component.
40
+ *
41
+ * @param viewType - The native view class name
42
+ * @returns true if it's a known component
43
+ */
44
+ export declare function isKnownViewType(viewType: string): boolean;
45
+ /**
46
+ * Get all known view types (useful for autocomplete/suggestions).
47
+ *
48
+ * @returns Array of all native view class names
49
+ */
50
+ export declare function getAllNativeViewTypes(): string[];
51
+ /**
52
+ * Get all known component names (useful for autocomplete/suggestions).
53
+ *
54
+ * @returns Array of all component display names
55
+ */
56
+ export declare function getAllComponentNames(): string[];
57
+ declare const _default: {
58
+ VIEW_TYPE_MAP: Record<string, string>;
59
+ getComponentDisplayName: typeof getComponentDisplayName;
60
+ getNativeViewType: typeof getNativeViewType;
61
+ isKnownViewType: typeof isKnownViewType;
62
+ getAllNativeViewTypes: typeof getAllNativeViewTypes;
63
+ getAllComponentNames: typeof getAllComponentNames;
64
+ };
65
+ export default _default;
66
+ //# sourceMappingURL=ViewTypeMapper.d.ts.map
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @buoy-gg/highlight-updates
3
+ *
4
+ * Standalone implementation of React DevTools' "Highlight updates when components
5
+ * render" feature. Works without requiring DevTools to be connected.
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * // Toggle-only preset - tap to enable/disable highlights
10
+ * import { highlightUpdatesPreset } from '@buoy-gg/highlight-updates';
11
+ *
12
+ * <FloatingDevTools apps={[highlightUpdatesPreset]} />
13
+ *
14
+ * // Modal preset - full interface with filters and render list
15
+ * import { highlightUpdatesModalPreset } from '@buoy-gg/highlight-updates';
16
+ *
17
+ * <FloatingDevTools apps={[highlightUpdatesModalPreset]} />
18
+ *
19
+ * // Or use the standalone controller programmatically
20
+ * import { HighlightUpdatesController } from '@buoy-gg/highlight-updates';
21
+ *
22
+ * HighlightUpdatesController.toggle();
23
+ * HighlightUpdatesController.enable();
24
+ * HighlightUpdatesController.disable();
25
+ * ```
26
+ */
27
+ export { highlightUpdatesPreset, createHighlightUpdatesTool, highlightUpdatesModalPreset, createHighlightUpdatesModalTool, } from "./preset";
28
+ export { default as HighlightUpdatesController } from "./highlight-updates/utils/HighlightUpdatesController";
29
+ export { HighlightUpdatesOverlay } from "./highlight-updates/HighlightUpdatesOverlay";
30
+ export { installProfilerInterceptor, uninstallProfilerInterceptor, setComparisonCallback, isInterceptorInstalled, enableProfilerLogging, disableProfilerLogging, isLoggingEnabled, } from "./highlight-updates/utils/ProfilerInterceptor";
31
+ export { RenderTracker } from "./highlight-updates/utils/RenderTracker";
32
+ export type { TrackedRender, FilterConfig, RenderTrackerSettings, RenderCause, RenderCauseType, ComponentCauseType, RenderEvent, } from "./highlight-updates/utils/RenderTracker";
33
+ export { detectRenderCause, clearRenderCauseState, removeRenderCauseState, getRenderCauseStats, safeCloneForHistory, capturePropsSnapshot, captureStateSnapshot, } from "./highlight-updates/utils/RenderCauseDetector";
34
+ export { PerformanceLogger } from "./highlight-updates/utils/PerformanceLogger";
35
+ export type { BatchMetrics, BatchTimer } from "./highlight-updates/utils/PerformanceLogger";
36
+ export { VIEW_TYPE_MAP, getComponentDisplayName, getNativeViewType, isKnownViewType, getAllNativeViewTypes, getAllComponentNames, } from "./highlight-updates/utils/ViewTypeMapper";
37
+ export { HighlightUpdatesModal } from "./highlight-updates/components/HighlightUpdatesModal";
38
+ export { RenderListItem } from "./highlight-updates/components/RenderListItem";
39
+ export { RenderDetailView } from "./highlight-updates/components/RenderDetailView";
40
+ export { HighlightFilterView } from "./highlight-updates/components/HighlightFilterView";
41
+ export { RenderCauseBadge, TwoLevelCauseBadge, CAUSE_CONFIG, COMPONENT_CAUSE_CONFIG, } from "./highlight-updates/components/RenderCauseBadge";
42
+ export { RenderHistoryViewer, RenderHistoryFooter, } from "./highlight-updates/components/RenderHistoryViewer";
43
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,187 @@
1
+ /**
2
+ * Pre-configured highlight updates tool for FloatingDevTools
3
+ *
4
+ * This preset provides standalone "Highlight updates when components render"
5
+ * functionality. Tap the icon to toggle highlights on/off.
6
+ *
7
+ * The overlay is automatically rendered by FloatingDevTools when the
8
+ * @buoy-gg/highlight-updates package is installed.
9
+ *
10
+ * Two presets available:
11
+ * - highlightUpdatesPreset: Quick toggle (no modal)
12
+ * - highlightUpdatesModalPreset: Full modal with filters and render list
13
+ *
14
+ * @example
15
+ * ```tsx
16
+ * import { highlightUpdatesPreset, highlightUpdatesModalPreset } from '@buoy-gg/highlight-updates';
17
+ *
18
+ * // Toggle-only: Just tap to enable/disable highlighting
19
+ * <FloatingDevTools apps={[highlightUpdatesPreset]} />
20
+ *
21
+ * // Modal: Opens interface with filters, render list, and controls
22
+ * <FloatingDevTools apps={[highlightUpdatesModalPreset]} />
23
+ * ```
24
+ */
25
+ import React from "react";
26
+ /**
27
+ * Icon component that changes color based on enabled state.
28
+ *
29
+ * ⚠️ IMPORTANT - DO NOT MODIFY THIS COMPONENT ⚠️
30
+ * This component MUST use useState and useEffect hooks to subscribe to the controller.
31
+ * It is rendered as a JSX component (<IconComponent />) in FloatingMenu and DialIcon,
32
+ * which allows hooks to work properly.
33
+ *
34
+ * If you remove the hooks or change this to read isEnabled() directly,
35
+ * the icon color will NOT update when the toggle is pressed.
36
+ */
37
+ declare function HighlightIcon({ size }: {
38
+ size: number;
39
+ }): React.JSX.Element;
40
+ /**
41
+ * Empty component for toggle-only tools (no modal needed)
42
+ * The actual overlay is rendered by FloatingDevTools automatically
43
+ */
44
+ declare function EmptyComponent(): null;
45
+ /**
46
+ * Wrapper component for the modal that handles badge press navigation.
47
+ * Registers a callback with the controller to receive badge press events
48
+ * and passes the target nativeTag to the modal for deep linking.
49
+ */
50
+ declare function HighlightUpdatesModalWithBadgeNavigation(props: {
51
+ visible: boolean;
52
+ onClose: () => void;
53
+ onBack?: () => void;
54
+ onMinimize?: (modalState: any) => void;
55
+ enableSharedModalDimensions?: boolean;
56
+ }): React.JSX.Element;
57
+ /**
58
+ * Pre-configured highlight updates tool for FloatingDevTools.
59
+ * Tap the icon to toggle component render highlighting on/off.
60
+ *
61
+ * Features:
62
+ * - Standalone implementation - no DevTools connection required
63
+ * - Simple direct toggle (no modal)
64
+ * - Icon changes color: gray when off, green when on
65
+ * - Overlay auto-rendered by FloatingDevTools
66
+ */
67
+ export declare const highlightUpdatesPreset: {
68
+ id: string;
69
+ name: string;
70
+ description: string;
71
+ slot: "row";
72
+ icon: typeof HighlightIcon;
73
+ component: typeof EmptyComponent;
74
+ props: {};
75
+ launchMode: "toggle-only";
76
+ onPress: () => void;
77
+ };
78
+ /**
79
+ * Create a custom highlight updates tool configuration.
80
+ * Use this if you want to override default settings.
81
+ *
82
+ * @example
83
+ * ```tsx
84
+ * import { createHighlightUpdatesTool } from '@buoy-gg/highlight-updates';
85
+ *
86
+ * const myHighlightTool = createHighlightUpdatesTool({
87
+ * name: "RENDERS",
88
+ * enabledColor: "#ec4899",
89
+ * disabledColor: "#9ca3af",
90
+ * autoInitialize: true,
91
+ * });
92
+ * ```
93
+ */
94
+ export declare function createHighlightUpdatesTool(options?: {
95
+ /** Tool name (default: "UPDATES") */
96
+ name?: string;
97
+ /** Tool description */
98
+ description?: string;
99
+ /** Icon color when enabled (default: "#10b981" - green) */
100
+ enabledColor?: string;
101
+ /** Icon color when disabled (default: "#6b7280" - gray) */
102
+ disabledColor?: string;
103
+ /** Custom tool ID (default: "highlight-updates") */
104
+ id?: string;
105
+ /** Auto-initialize on first render (default: false) */
106
+ autoInitialize?: boolean;
107
+ }): {
108
+ id: string;
109
+ name: string;
110
+ description: string;
111
+ slot: "row";
112
+ icon: ({ size }: {
113
+ size: number;
114
+ }) => React.JSX.Element;
115
+ component: typeof EmptyComponent;
116
+ props: {};
117
+ launchMode: "toggle-only";
118
+ onPress: () => void;
119
+ };
120
+ /**
121
+ * Modal preset for highlight updates tool.
122
+ * Opens a full modal interface with:
123
+ * - List of tracked component renders
124
+ * - Start/Stop and Pause/Resume controls
125
+ * - Clear button to reset render counts
126
+ * - Search bar in navbar (expandable)
127
+ * - Filter by viewType, testID, nativeID, componentName
128
+ * - Tap overlay badge to jump to component detail view
129
+ *
130
+ * Use this preset when you want detailed render tracking and filtering.
131
+ */
132
+ export declare const highlightUpdatesModalPreset: {
133
+ id: string;
134
+ name: string;
135
+ description: string;
136
+ slot: "both";
137
+ icon: ({ size }: {
138
+ size: number;
139
+ }) => React.JSX.Element;
140
+ component: typeof HighlightUpdatesModalWithBadgeNavigation;
141
+ props: {
142
+ enableSharedModalDimensions: boolean;
143
+ };
144
+ };
145
+ /**
146
+ * Create a custom highlight updates modal tool configuration.
147
+ * Use this if you want to override default settings for the modal version.
148
+ *
149
+ * @example
150
+ * ```tsx
151
+ * import { createHighlightUpdatesModalTool } from '@buoy-gg/highlight-updates';
152
+ *
153
+ * const myRendersTool = createHighlightUpdatesModalTool({
154
+ * name: "PROFILER",
155
+ * enabledColor: "#8b5cf6",
156
+ * disabledColor: "#9ca3af",
157
+ * });
158
+ * ```
159
+ */
160
+ export declare function createHighlightUpdatesModalTool(options?: {
161
+ /** Tool name (default: "RENDERS") */
162
+ name?: string;
163
+ /** Tool description */
164
+ description?: string;
165
+ /** Icon color when tracking enabled (default: "#10b981" - green) */
166
+ enabledColor?: string;
167
+ /** Icon color when tracking disabled (default: "#6b7280" - gray) */
168
+ disabledColor?: string;
169
+ /** Custom tool ID (default: "highlight-updates-modal") */
170
+ id?: string;
171
+ /** Auto-initialize on first render (default: false) */
172
+ autoInitialize?: boolean;
173
+ }): {
174
+ id: string;
175
+ name: string;
176
+ description: string;
177
+ slot: "both";
178
+ icon: ({ size }: {
179
+ size: number;
180
+ }) => React.JSX.Element;
181
+ component: typeof HighlightUpdatesModalWithBadgeNavigation;
182
+ props: {
183
+ enableSharedModalDimensions: boolean;
184
+ };
185
+ };
186
+ export {};
187
+ //# sourceMappingURL=preset.d.ts.map
package/package.json ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "@buoy-gg/highlight-updates",
3
+ "version": "2.0.2",
4
+ "description": "Control React DevTools highlight updates feature from your app",
5
+ "main": "lib/commonjs/index",
6
+ "module": "lib/module/index",
7
+ "types": "lib/typescript/index.d.ts",
8
+ "react-native": "src/index.tsx",
9
+ "source": "src/index.tsx",
10
+ "files": [
11
+ "lib"
12
+ ],
13
+ "sideEffects": false,
14
+ "scripts": {
15
+ "build": "bob build",
16
+ "typecheck": "tsc --noEmit",
17
+ "clean": "rimraf lib",
18
+ "test": "pnpm run typecheck",
19
+ "postinstall": "echo \"Run pnpm build to compile this package\""
20
+ },
21
+ "dependencies": {
22
+ "@buoy-gg/shared-ui": "workspace:*",
23
+ "@buoy-gg/floating-tools-core": "workspace:*"
24
+ },
25
+ "peerDependencies": {
26
+ "react": "*",
27
+ "react-native": "*",
28
+ "@buoy-gg/core": "workspace:*"
29
+ },
30
+ "peerDependenciesMeta": {
31
+ "@buoy-gg/core": {
32
+ "optional": true
33
+ }
34
+ },
35
+ "devDependencies": {
36
+ "@buoy-gg/core": "workspace:*",
37
+ "@types/react": "^19.1.0",
38
+ "@types/react-native": "^0.73.0",
39
+ "typescript": "~5.8.3"
40
+ },
41
+ "react-native-builder-bob": {
42
+ "source": "src",
43
+ "output": "lib",
44
+ "targets": [
45
+ [
46
+ "commonjs",
47
+ {
48
+ "sourceMaps": false
49
+ }
50
+ ],
51
+ [
52
+ "module",
53
+ {
54
+ "sourceMaps": false
55
+ }
56
+ ],
57
+ "typescript"
58
+ ]
59
+ },
60
+ "repository": {
61
+ "type": "git",
62
+ "url": "https://github.com/LovesWorking/react-native-buoy.git",
63
+ "directory": "packages/highlight-updates"
64
+ },
65
+ "bugs": {
66
+ "url": "https://github.com/LovesWorking/react-native-buoy/issues"
67
+ },
68
+ "homepage": "https://github.com/LovesWorking/react-native-buoy/tree/main/packages/highlight-updates#readme",
69
+ "publishConfig": {
70
+ "access": "public",
71
+ "tag": "latest"
72
+ }
73
+ }