@oxog/react-check 1.0.0

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.
@@ -0,0 +1,145 @@
1
+ import { d as RenderChainInfo, R as RenderInfo } from './types-CVcIoqzs.cjs';
2
+ import { E as EventEmitter } from './event-emitter-CxKUDo9q.cjs';
3
+
4
+ /**
5
+ * Render chain analyzer - traces cascading renders to find root causes
6
+ * @packageDocumentation
7
+ */
8
+
9
+ /**
10
+ * Events emitted by ChainAnalyzer
11
+ */
12
+ interface ChainEvents {
13
+ /** Index signature for EventMap compatibility */
14
+ [key: string]: unknown;
15
+ /** Emitted when a render chain is detected */
16
+ chain: RenderChainInfo;
17
+ /** Emitted when a context-triggered chain is detected */
18
+ contextChain: RenderChainInfo;
19
+ }
20
+ /**
21
+ * Analyzes render patterns to detect and trace render chains
22
+ */
23
+ declare class ChainAnalyzer extends EventEmitter<ChainEvents> {
24
+ /** Time window size in ms (one frame at 60fps) */
25
+ private readonly windowSize;
26
+ /** Current render windows being tracked */
27
+ private windows;
28
+ /** Component parent relationships */
29
+ private parentMap;
30
+ /** Recently detected chains to avoid duplicates */
31
+ private recentChains;
32
+ /** Minimum chain depth to report */
33
+ private readonly minChainDepth;
34
+ /** Maximum time to keep recent chains */
35
+ private readonly recentChainTtl;
36
+ /**
37
+ * Create a new ChainAnalyzer
38
+ * @param options - Configuration options
39
+ */
40
+ constructor(options?: {
41
+ windowSize?: number;
42
+ minChainDepth?: number;
43
+ recentChainTtl?: number;
44
+ });
45
+ /**
46
+ * Add a render event for analysis
47
+ * @param render - Render information
48
+ * @param parent - Optional parent component name
49
+ */
50
+ addRender(render: RenderInfo, parent?: string): void;
51
+ /**
52
+ * Set parent relationship for a component
53
+ * @param child - Child component name
54
+ * @param parent - Parent component name
55
+ */
56
+ setParent(child: string, parent: string): void;
57
+ /**
58
+ * Get window key for a timestamp
59
+ * @param timestamp - Timestamp in ms
60
+ * @returns Window key
61
+ */
62
+ private getWindowKey;
63
+ /**
64
+ * Check if a render was likely triggered by context
65
+ * @param render - Render information
66
+ * @returns true if context-triggered
67
+ */
68
+ private isContextTriggered;
69
+ /**
70
+ * Analyze a render window for chains
71
+ * @param windowKey - Window key to analyze
72
+ */
73
+ private analyzeWindow;
74
+ /**
75
+ * Build chains from a sorted render sequence
76
+ * @param renders - Sorted render events
77
+ * @returns Detected chains
78
+ */
79
+ private buildChains;
80
+ /**
81
+ * Trace a chain starting from a component
82
+ * @param startComponent - Starting component
83
+ * @param renders - All renders in window
84
+ * @param visited - Already visited components
85
+ * @returns Chain of component names
86
+ */
87
+ private traceChain;
88
+ /**
89
+ * Find the root cause component in a chain
90
+ * @param chain - Component chain
91
+ * @param renders - All renders
92
+ * @returns Root cause component name
93
+ */
94
+ private findRootCause;
95
+ /**
96
+ * Determine what triggered a chain
97
+ * @param rootCause - Root cause component
98
+ * @param renders - All renders
99
+ * @returns Trigger description
100
+ */
101
+ private determineTrigger;
102
+ /**
103
+ * Generate a unique key for a chain to detect duplicates
104
+ * @param chain - Chain info
105
+ * @returns Unique key
106
+ */
107
+ private getChainKey;
108
+ /**
109
+ * Clean up old render windows
110
+ * @param currentTime - Current timestamp
111
+ */
112
+ private cleanupWindows;
113
+ /**
114
+ * Get the parent of a component
115
+ * @param componentName - Component name
116
+ * @returns Parent name or undefined
117
+ */
118
+ getParent(componentName: string): string | undefined;
119
+ /**
120
+ * Get all known parent relationships
121
+ * @returns Map of child to parent
122
+ */
123
+ getParentMap(): Map<string, string>;
124
+ /**
125
+ * Build a full chain for a component (tracing up to root)
126
+ * @param componentName - Starting component
127
+ * @returns Chain from root to component
128
+ */
129
+ getComponentChain(componentName: string): string[];
130
+ /**
131
+ * Clear all tracked data
132
+ */
133
+ reset(): void;
134
+ /**
135
+ * Get statistics about current tracking
136
+ * @returns Tracking statistics
137
+ */
138
+ getStats(): {
139
+ windowCount: number;
140
+ parentRelationships: number;
141
+ recentChains: number;
142
+ };
143
+ }
144
+
145
+ export { ChainAnalyzer, type ChainEvents };
@@ -0,0 +1,145 @@
1
+ import { d as RenderChainInfo, R as RenderInfo } from './types-CVcIoqzs.js';
2
+ import { E as EventEmitter } from './event-emitter-CxKUDo9q.js';
3
+
4
+ /**
5
+ * Render chain analyzer - traces cascading renders to find root causes
6
+ * @packageDocumentation
7
+ */
8
+
9
+ /**
10
+ * Events emitted by ChainAnalyzer
11
+ */
12
+ interface ChainEvents {
13
+ /** Index signature for EventMap compatibility */
14
+ [key: string]: unknown;
15
+ /** Emitted when a render chain is detected */
16
+ chain: RenderChainInfo;
17
+ /** Emitted when a context-triggered chain is detected */
18
+ contextChain: RenderChainInfo;
19
+ }
20
+ /**
21
+ * Analyzes render patterns to detect and trace render chains
22
+ */
23
+ declare class ChainAnalyzer extends EventEmitter<ChainEvents> {
24
+ /** Time window size in ms (one frame at 60fps) */
25
+ private readonly windowSize;
26
+ /** Current render windows being tracked */
27
+ private windows;
28
+ /** Component parent relationships */
29
+ private parentMap;
30
+ /** Recently detected chains to avoid duplicates */
31
+ private recentChains;
32
+ /** Minimum chain depth to report */
33
+ private readonly minChainDepth;
34
+ /** Maximum time to keep recent chains */
35
+ private readonly recentChainTtl;
36
+ /**
37
+ * Create a new ChainAnalyzer
38
+ * @param options - Configuration options
39
+ */
40
+ constructor(options?: {
41
+ windowSize?: number;
42
+ minChainDepth?: number;
43
+ recentChainTtl?: number;
44
+ });
45
+ /**
46
+ * Add a render event for analysis
47
+ * @param render - Render information
48
+ * @param parent - Optional parent component name
49
+ */
50
+ addRender(render: RenderInfo, parent?: string): void;
51
+ /**
52
+ * Set parent relationship for a component
53
+ * @param child - Child component name
54
+ * @param parent - Parent component name
55
+ */
56
+ setParent(child: string, parent: string): void;
57
+ /**
58
+ * Get window key for a timestamp
59
+ * @param timestamp - Timestamp in ms
60
+ * @returns Window key
61
+ */
62
+ private getWindowKey;
63
+ /**
64
+ * Check if a render was likely triggered by context
65
+ * @param render - Render information
66
+ * @returns true if context-triggered
67
+ */
68
+ private isContextTriggered;
69
+ /**
70
+ * Analyze a render window for chains
71
+ * @param windowKey - Window key to analyze
72
+ */
73
+ private analyzeWindow;
74
+ /**
75
+ * Build chains from a sorted render sequence
76
+ * @param renders - Sorted render events
77
+ * @returns Detected chains
78
+ */
79
+ private buildChains;
80
+ /**
81
+ * Trace a chain starting from a component
82
+ * @param startComponent - Starting component
83
+ * @param renders - All renders in window
84
+ * @param visited - Already visited components
85
+ * @returns Chain of component names
86
+ */
87
+ private traceChain;
88
+ /**
89
+ * Find the root cause component in a chain
90
+ * @param chain - Component chain
91
+ * @param renders - All renders
92
+ * @returns Root cause component name
93
+ */
94
+ private findRootCause;
95
+ /**
96
+ * Determine what triggered a chain
97
+ * @param rootCause - Root cause component
98
+ * @param renders - All renders
99
+ * @returns Trigger description
100
+ */
101
+ private determineTrigger;
102
+ /**
103
+ * Generate a unique key for a chain to detect duplicates
104
+ * @param chain - Chain info
105
+ * @returns Unique key
106
+ */
107
+ private getChainKey;
108
+ /**
109
+ * Clean up old render windows
110
+ * @param currentTime - Current timestamp
111
+ */
112
+ private cleanupWindows;
113
+ /**
114
+ * Get the parent of a component
115
+ * @param componentName - Component name
116
+ * @returns Parent name or undefined
117
+ */
118
+ getParent(componentName: string): string | undefined;
119
+ /**
120
+ * Get all known parent relationships
121
+ * @returns Map of child to parent
122
+ */
123
+ getParentMap(): Map<string, string>;
124
+ /**
125
+ * Build a full chain for a component (tracing up to root)
126
+ * @param componentName - Starting component
127
+ * @returns Chain from root to component
128
+ */
129
+ getComponentChain(componentName: string): string[];
130
+ /**
131
+ * Clear all tracked data
132
+ */
133
+ reset(): void;
134
+ /**
135
+ * Get statistics about current tracking
136
+ * @returns Tracking statistics
137
+ */
138
+ getStats(): {
139
+ windowCount: number;
140
+ parentRelationships: number;
141
+ recentChains: number;
142
+ };
143
+ }
144
+
145
+ export { ChainAnalyzer, type ChainEvents };