@oxog/react-check 1.1.0 → 1.1.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.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { F as FiberNode, R as RenderInfo, a as ReactDevToolsHook, S as SessionReport, b as ReportOptions, C as CLIMessage, B as BrowserMessage, c as ScannerConfig, W as WindowWithReactDevTools } from './types-CVcIoqzs.js';
2
- export { q as ComponentNode, h as ComponentStats, E as ErrorCode, t as FiberType, g as FixSuggestion, e as FixType, k as FrameworkInfo, m as FrameworkOptions, O as OverlayOptions, p as ReactCheckConfig, r as ReactCheckError, s as ReactCheckEvents, o as ReactCheckOptions, d as RenderChainInfo, n as RuleOptions, i as SessionInfo, j as SessionSummary, f as Severity, l as ThresholdOptions, T as TimelineEvent } from './types-CVcIoqzs.js';
3
- import { S as Scanner } from './scanner-bpT7eMcv.js';
4
- export { b as ScannerEvents, a as StatsCollector, c as StatsEvents } from './scanner-bpT7eMcv.js';
1
+ import { F as FiberNode, R as RenderInfo, a as ReactDevToolsHook, S as SessionReport, b as ReportOptions, C as CLIMessage, B as BrowserMessage, c as ScannerConfig, W as WindowWithReactDevTools } from './types-xAXT9cir.js';
2
+ export { q as ComponentNode, h as ComponentStats, E as ErrorCode, t as FiberType, g as FixSuggestion, e as FixType, k as FrameworkInfo, m as FrameworkOptions, O as OverlayOptions, p as ReactCheckConfig, r as ReactCheckError, s as ReactCheckEvents, o as ReactCheckOptions, d as RenderChainInfo, n as RuleOptions, i as SessionInfo, j as SessionSummary, f as Severity, l as ThresholdOptions, T as TimelineEvent } from './types-xAXT9cir.js';
3
+ import { S as Scanner } from './scanner-CTBraprQ.js';
4
+ export { b as ScannerEvents, a as StatsCollector, c as StatsEvents } from './scanner-CTBraprQ.js';
5
5
  export { ChainAnalyzer, ChainEvents } from './chain.js';
6
6
  export { FixEvents, FixSuggester } from './fix.js';
7
7
  export { detectFramework, detectFrameworkFromWindow, frameworkDetectors, getFrameworkTips } from './detect.js';
@@ -975,10 +975,12 @@ declare class BrowserLauncher extends EventEmitter<BrowserEvents> {
975
975
  */
976
976
  private setupPageHandlers;
977
977
  /**
978
- * Navigate to a URL
978
+ * Navigate to a URL with retry support
979
979
  * @param url - URL to navigate to
980
+ * @param retries - Number of retries (default: 3)
981
+ * @param retryDelay - Delay between retries in ms (default: 2000)
980
982
  */
981
- navigate(url: string): Promise<void>;
983
+ navigate(url: string, retries?: number, retryDelay?: number): Promise<void>;
982
984
  /**
983
985
  * Execute script in page context
984
986
  * @param script - Script to execute
@@ -1031,6 +1033,148 @@ declare class BrowserLauncher extends EventEmitter<BrowserEvents> {
1031
1033
  */
1032
1034
  declare function isPuppeteerAvailable(): Promise<boolean>;
1033
1035
 
1036
+ /**
1037
+ * Browser overlay for render visualization
1038
+ * @packageDocumentation
1039
+ */
1040
+
1041
+ /**
1042
+ * Overlay configuration
1043
+ */
1044
+ interface OverlayConfig {
1045
+ /** Whether overlay is enabled */
1046
+ enabled: boolean;
1047
+ /** Whether to highlight renders */
1048
+ highlightRenders: boolean;
1049
+ /** Animation speed */
1050
+ animationSpeed: 'slow' | 'fast' | 'off';
1051
+ /** Whether to show badges */
1052
+ showBadges: boolean;
1053
+ /** Whether to show toolbar */
1054
+ showToolbar: boolean;
1055
+ }
1056
+ /**
1057
+ * Overlay for visualizing React renders in the browser
1058
+ */
1059
+ declare class Overlay {
1060
+ /** Shadow root for isolation */
1061
+ private shadowRoot;
1062
+ /** Host element */
1063
+ private host;
1064
+ /** Overlay configuration */
1065
+ private config;
1066
+ /** Highlight elements */
1067
+ private highlights;
1068
+ /** Badge elements */
1069
+ private badges;
1070
+ /** Render counts for badges */
1071
+ private renderCounts;
1072
+ /** Toolbar element */
1073
+ private toolbar;
1074
+ /** Whether overlay is visible */
1075
+ private visible;
1076
+ /**
1077
+ * Create a new overlay
1078
+ * @param config - Overlay configuration
1079
+ */
1080
+ constructor(config?: Partial<OverlayConfig>);
1081
+ /**
1082
+ * Initialize the overlay
1083
+ */
1084
+ init(): void;
1085
+ /**
1086
+ * Destroy the overlay
1087
+ */
1088
+ destroy(): void;
1089
+ /**
1090
+ * Inject CSS styles into shadow DOM
1091
+ */
1092
+ private injectStyles;
1093
+ /**
1094
+ * Create the floating toolbar
1095
+ */
1096
+ private createToolbar;
1097
+ /**
1098
+ * Set up toolbar event listeners
1099
+ */
1100
+ private setupToolbarEvents;
1101
+ /**
1102
+ * Make an element draggable
1103
+ * @param element - Element to make draggable
1104
+ */
1105
+ private makeDraggable;
1106
+ /**
1107
+ * Highlight a component render with flash effect
1108
+ * @param render - Render information
1109
+ * @param element - DOM element to highlight
1110
+ */
1111
+ highlight(render: RenderInfo, element: Element): void;
1112
+ /**
1113
+ * Create a flash overlay effect on the element
1114
+ * @param rect - Element bounding rectangle
1115
+ * @param color - Flash color
1116
+ */
1117
+ private createFlashOverlay;
1118
+ /**
1119
+ * Update or create a badge for a component
1120
+ * @param render - Render information
1121
+ * @param rect - Bounding rectangle
1122
+ * @param color - Badge color
1123
+ */
1124
+ private updateBadge;
1125
+ /**
1126
+ * Get severity level for a render
1127
+ * @param render - Render information
1128
+ * @returns Severity level
1129
+ */
1130
+ private getSeverity;
1131
+ /**
1132
+ * Record a render event (updates stats even without DOM element)
1133
+ * @param render - Render information
1134
+ */
1135
+ recordRender(render: RenderInfo): void;
1136
+ /** Total render count */
1137
+ private totalRenders;
1138
+ /**
1139
+ * Update toolbar stats
1140
+ */
1141
+ private updateStats;
1142
+ /**
1143
+ * Clear all highlights
1144
+ */
1145
+ clearHighlights(): void;
1146
+ /**
1147
+ * Clear all badges
1148
+ */
1149
+ clearBadges(): void;
1150
+ /**
1151
+ * Clear all visualizations
1152
+ */
1153
+ clear(): void;
1154
+ /**
1155
+ * Show the overlay
1156
+ */
1157
+ show(): void;
1158
+ /**
1159
+ * Hide the overlay
1160
+ */
1161
+ hide(): void;
1162
+ /**
1163
+ * Toggle overlay visibility
1164
+ */
1165
+ toggle(): void;
1166
+ /**
1167
+ * Update configuration
1168
+ * @param config - Partial configuration
1169
+ */
1170
+ configure(config: Partial<OverlayConfig>): void;
1171
+ /**
1172
+ * Check if overlay is visible
1173
+ * @returns true if visible
1174
+ */
1175
+ isVisible(): boolean;
1176
+ }
1177
+
1034
1178
  /**
1035
1179
  * Browser-side scanner for React render tracking
1036
1180
  * @packageDocumentation
@@ -1069,12 +1213,35 @@ declare class BrowserScanner extends EventEmitter<BrowserScannerEvents> {
1069
1213
  private originalOnCommitFiberRoot;
1070
1214
  /** Window reference */
1071
1215
  private win;
1216
+ /** Overlay for visual feedback */
1217
+ private overlay;
1072
1218
  /**
1073
1219
  * Create a new browser scanner
1074
1220
  * @param config - Scanner configuration
1075
1221
  * @param win - Window object (for testing)
1076
1222
  */
1077
1223
  constructor(config?: Partial<ScannerConfig>, win?: WindowWithReactDevTools);
1224
+ /**
1225
+ * Get DOM element from fiber node
1226
+ * React stores the DOM node in fiber.stateNode for host components
1227
+ * or we need to walk down to find the first DOM node
1228
+ * @param fiber - Fiber node
1229
+ * @returns DOM Element or null
1230
+ */
1231
+ private getDOMElement;
1232
+ /**
1233
+ * Enable visual overlay for render highlighting
1234
+ */
1235
+ enableOverlay(): void;
1236
+ /**
1237
+ * Disable visual overlay
1238
+ */
1239
+ disableOverlay(): void;
1240
+ /**
1241
+ * Get overlay instance
1242
+ * @returns Overlay instance or null
1243
+ */
1244
+ getOverlay(): Overlay | null;
1078
1245
  /**
1079
1246
  * Start the scanner
1080
1247
  */
@@ -1168,142 +1335,6 @@ declare class BrowserScanner extends EventEmitter<BrowserScannerEvents> {
1168
1335
  getAllRenderCounts(): Map<string, number>;
1169
1336
  }
1170
1337
 
1171
- /**
1172
- * Browser overlay for render visualization
1173
- * @packageDocumentation
1174
- */
1175
-
1176
- /**
1177
- * Overlay configuration
1178
- */
1179
- interface OverlayConfig {
1180
- /** Whether overlay is enabled */
1181
- enabled: boolean;
1182
- /** Whether to highlight renders */
1183
- highlightRenders: boolean;
1184
- /** Animation speed */
1185
- animationSpeed: 'slow' | 'fast' | 'off';
1186
- /** Whether to show badges */
1187
- showBadges: boolean;
1188
- /** Whether to show toolbar */
1189
- showToolbar: boolean;
1190
- }
1191
- /**
1192
- * Overlay for visualizing React renders in the browser
1193
- */
1194
- declare class Overlay {
1195
- /** Shadow root for isolation */
1196
- private shadowRoot;
1197
- /** Host element */
1198
- private host;
1199
- /** Overlay configuration */
1200
- private config;
1201
- /** Highlight elements */
1202
- private highlights;
1203
- /** Badge elements */
1204
- private badges;
1205
- /** Render counts for badges */
1206
- private renderCounts;
1207
- /** Toolbar element */
1208
- private toolbar;
1209
- /** Whether overlay is visible */
1210
- private visible;
1211
- /**
1212
- * Create a new overlay
1213
- * @param config - Overlay configuration
1214
- */
1215
- constructor(config?: Partial<OverlayConfig>);
1216
- /**
1217
- * Initialize the overlay
1218
- */
1219
- init(): void;
1220
- /**
1221
- * Destroy the overlay
1222
- */
1223
- destroy(): void;
1224
- /**
1225
- * Inject CSS styles into shadow DOM
1226
- */
1227
- private injectStyles;
1228
- /**
1229
- * Create the floating toolbar
1230
- */
1231
- private createToolbar;
1232
- /**
1233
- * Set up toolbar event listeners
1234
- */
1235
- private setupToolbarEvents;
1236
- /**
1237
- * Make an element draggable
1238
- * @param element - Element to make draggable
1239
- */
1240
- private makeDraggable;
1241
- /**
1242
- * Highlight a component render
1243
- * @param render - Render information
1244
- * @param element - DOM element to highlight
1245
- */
1246
- highlight(render: RenderInfo, element: Element): void;
1247
- /**
1248
- * Update or create a badge for a component
1249
- * @param render - Render information
1250
- * @param rect - Bounding rectangle
1251
- * @param color - Badge color
1252
- */
1253
- private updateBadge;
1254
- /**
1255
- * Get severity level for a render
1256
- * @param render - Render information
1257
- * @returns Severity level
1258
- */
1259
- private getSeverity;
1260
- /**
1261
- * Record a render event (updates stats even without DOM element)
1262
- * @param render - Render information
1263
- */
1264
- recordRender(render: RenderInfo): void;
1265
- /** Total render count */
1266
- private totalRenders;
1267
- /**
1268
- * Update toolbar stats
1269
- */
1270
- private updateStats;
1271
- /**
1272
- * Clear all highlights
1273
- */
1274
- clearHighlights(): void;
1275
- /**
1276
- * Clear all badges
1277
- */
1278
- clearBadges(): void;
1279
- /**
1280
- * Clear all visualizations
1281
- */
1282
- clear(): void;
1283
- /**
1284
- * Show the overlay
1285
- */
1286
- show(): void;
1287
- /**
1288
- * Hide the overlay
1289
- */
1290
- hide(): void;
1291
- /**
1292
- * Toggle overlay visibility
1293
- */
1294
- toggle(): void;
1295
- /**
1296
- * Update configuration
1297
- * @param config - Partial configuration
1298
- */
1299
- configure(config: Partial<OverlayConfig>): void;
1300
- /**
1301
- * Check if overlay is visible
1302
- * @returns true if visible
1303
- */
1304
- isVisible(): boolean;
1305
- }
1306
-
1307
1338
  /**
1308
1339
  * Browser injection script - main entry point for browser-side code
1309
1340
  * This file is bundled as an IIFE for injection into target pages
@@ -1351,6 +1382,20 @@ declare class ReactCheckInjector {
1351
1382
  * @param message - CLI message
1352
1383
  */
1353
1384
  private handleMessage;
1385
+ /**
1386
+ * Toggle overlay visibility
1387
+ * @param enabled - Whether overlay should be visible
1388
+ */
1389
+ private handleToggleOverlay;
1390
+ /**
1391
+ * Get overlay visibility status
1392
+ * @returns Whether overlay is visible
1393
+ */
1394
+ isOverlayEnabled(): boolean;
1395
+ /**
1396
+ * Toggle overlay (public method for console access)
1397
+ */
1398
+ toggleOverlay(): void;
1354
1399
  /**
1355
1400
  * Handle config update
1356
1401
  * @param config - New configuration