@okyrychenko-dev/react-action-guard-devtools 0.1.2 → 0.2.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.
- package/README.md +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +140 -4
- package/dist/index.d.ts +140 -4
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.cts
CHANGED
|
@@ -124,10 +124,98 @@ interface ActionGuardDevtoolsProps {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
/**
|
|
127
|
-
* ActionGuardDevtools -
|
|
127
|
+
* ActionGuardDevtools - Visual developer tools panel for debugging UI blocking.
|
|
128
128
|
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
129
|
+
* This component provides a floating developer tools panel that visualizes all UI blocking
|
|
130
|
+
* events in real-time. It shows active blockers, their priorities, scopes, and provides
|
|
131
|
+
* a timeline of all blocking events with filtering and search capabilities.
|
|
132
|
+
*
|
|
133
|
+
* **Key Features:**
|
|
134
|
+
* - Real-time visualization of active blockers
|
|
135
|
+
* - Timeline of all blocking events (add, remove, timeout)
|
|
136
|
+
* - Filter by action type, scope, or search term
|
|
137
|
+
* - Pause/resume event capture
|
|
138
|
+
* - Keyboard shortcuts (Esc to close, P to pause, C to clear)
|
|
139
|
+
* - Draggable and resizable panel
|
|
140
|
+
* - Works with both global store and custom store instances
|
|
141
|
+
*
|
|
142
|
+
* **Performance:**
|
|
143
|
+
* - Automatically disabled in production builds (returns `null`)
|
|
144
|
+
* - Only allocates resources in development
|
|
145
|
+
* - Uses `showInProduction` prop to override if needed
|
|
146
|
+
*
|
|
147
|
+
* **Integration:**
|
|
148
|
+
* - Automatically registers devtools middleware on mount
|
|
149
|
+
* - Cleans up middleware on unmount
|
|
150
|
+
* - No configuration required for basic usage
|
|
151
|
+
*
|
|
152
|
+
* @param props - Configuration props for the devtools panel
|
|
153
|
+
* @param props.position - Panel position: 'left' | 'right' | 'top' | 'bottom' (default: 'right')
|
|
154
|
+
* @param props.defaultOpen - Whether panel is open initially (default: false)
|
|
155
|
+
* @param props.maxEvents - Maximum events to store in timeline (default: 200)
|
|
156
|
+
* @param props.showInProduction - Show panel even in production (default: false)
|
|
157
|
+
* @param props.store - Custom store instance (default: global store)
|
|
158
|
+
*
|
|
159
|
+
* @returns React element in development, `null` in production (unless `showInProduction` is true)
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* Basic usage (global store)
|
|
163
|
+
* ```tsx
|
|
164
|
+
* import { ActionGuardDevtools } from '@okyrychenko-dev/react-action-guard-devtools';
|
|
165
|
+
*
|
|
166
|
+
* function App() {
|
|
167
|
+
* return (
|
|
168
|
+
* <div>
|
|
169
|
+
* <YourApp />
|
|
170
|
+
* <ActionGuardDevtools />
|
|
171
|
+
* </div>
|
|
172
|
+
* );
|
|
173
|
+
* }
|
|
174
|
+
* ```
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* With custom configuration
|
|
178
|
+
* ```tsx
|
|
179
|
+
* <ActionGuardDevtools
|
|
180
|
+
* position="bottom"
|
|
181
|
+
* defaultOpen={true}
|
|
182
|
+
* maxEvents={500}
|
|
183
|
+
* />
|
|
184
|
+
* ```
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* With custom store instance (isolated state)
|
|
188
|
+
* ```tsx
|
|
189
|
+
* import { UIBlockingProvider } from '@okyrychenko-dev/react-action-guard';
|
|
190
|
+
* import { ActionGuardDevtools } from '@okyrychenko-dev/react-action-guard-devtools';
|
|
191
|
+
*
|
|
192
|
+
* function IsolatedApp() {
|
|
193
|
+
* return (
|
|
194
|
+
* <UIBlockingProvider>
|
|
195
|
+
* {({ store }) => (
|
|
196
|
+
* <>
|
|
197
|
+
* <YourApp />
|
|
198
|
+
* <ActionGuardDevtools store={store} />
|
|
199
|
+
* </>
|
|
200
|
+
* )}
|
|
201
|
+
* </UIBlockingProvider>
|
|
202
|
+
* );
|
|
203
|
+
* }
|
|
204
|
+
* ```
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* Keyboard shortcuts
|
|
208
|
+
* ```
|
|
209
|
+
* Esc - Close devtools panel
|
|
210
|
+
* Ctrl/⌘ + P - Toggle pause/resume event capture
|
|
211
|
+
* Ctrl/⌘ + K - Clear all events
|
|
212
|
+
* ```
|
|
213
|
+
*
|
|
214
|
+
* @see {@link https://github.com/okyrychenko-dev/react-action-guard-devtools | DevTools README}
|
|
215
|
+
* @see {@link createDevtoolsMiddleware} for manual middleware registration
|
|
216
|
+
*
|
|
217
|
+
* @public
|
|
218
|
+
* @since 0.6.0
|
|
131
219
|
*/
|
|
132
220
|
declare function ActionGuardDevtools(props: ActionGuardDevtoolsProps): ReactElement | null;
|
|
133
221
|
|
|
@@ -159,7 +247,55 @@ declare function selectUniqueScopes(state: DevtoolsStore): Array<string>;
|
|
|
159
247
|
|
|
160
248
|
declare const DEVTOOLS_MIDDLEWARE_NAME = "action-guard-devtools";
|
|
161
249
|
/**
|
|
162
|
-
* Creates the devtools middleware that records events
|
|
250
|
+
* Creates the devtools middleware that captures and records UI blocking events.
|
|
251
|
+
*
|
|
252
|
+
* This middleware intercepts all blocking events (add, remove, timeout, clear) and
|
|
253
|
+
* forwards them to the devtools store for visualization in the ActionGuardDevtools panel.
|
|
254
|
+
*
|
|
255
|
+
* The middleware calculates the duration of each blocker by tracking when it was added
|
|
256
|
+
* and when it was removed/timed out, providing insights into how long UI was blocked.
|
|
257
|
+
*
|
|
258
|
+
* **Note:** This middleware is automatically registered when you use the `ActionGuardDevtools`
|
|
259
|
+
* component. You typically don't need to call this function directly unless you're manually
|
|
260
|
+
* managing middleware registration.
|
|
261
|
+
*
|
|
262
|
+
* @returns Middleware function that can be registered with `configureMiddleware` or `registerMiddleware`
|
|
263
|
+
*
|
|
264
|
+
* @example
|
|
265
|
+
* Manual middleware registration (advanced usage)
|
|
266
|
+
* ```tsx
|
|
267
|
+
* import { uiBlockingStoreApi } from '@okyrychenko-dev/react-action-guard';
|
|
268
|
+
* import { createDevtoolsMiddleware, DEVTOOLS_MIDDLEWARE_NAME } from '@okyrychenko-dev/react-action-guard-devtools';
|
|
269
|
+
*
|
|
270
|
+
* // Register manually
|
|
271
|
+
* const middleware = createDevtoolsMiddleware();
|
|
272
|
+
* uiBlockingStoreApi.getState().registerMiddleware(DEVTOOLS_MIDDLEWARE_NAME, middleware);
|
|
273
|
+
*
|
|
274
|
+
* // Cleanup
|
|
275
|
+
* uiBlockingStoreApi.getState().unregisterMiddleware(DEVTOOLS_MIDDLEWARE_NAME);
|
|
276
|
+
* ```
|
|
277
|
+
*
|
|
278
|
+
* @example
|
|
279
|
+
* Automatic registration (recommended)
|
|
280
|
+
* ```tsx
|
|
281
|
+
* import { ActionGuardDevtools } from '@okyrychenko-dev/react-action-guard-devtools';
|
|
282
|
+
*
|
|
283
|
+
* // Middleware registered automatically when component mounts
|
|
284
|
+
* function App() {
|
|
285
|
+
* return (
|
|
286
|
+
* <>
|
|
287
|
+
* <YourApp />
|
|
288
|
+
* <ActionGuardDevtools />
|
|
289
|
+
* </>
|
|
290
|
+
* );
|
|
291
|
+
* }
|
|
292
|
+
* ```
|
|
293
|
+
*
|
|
294
|
+
* @see {@link ActionGuardDevtools} for automatic middleware registration
|
|
295
|
+
* @see {@link https://github.com/okyrychenko-dev/react-action-guard#middleware | Middleware documentation}
|
|
296
|
+
*
|
|
297
|
+
* @public
|
|
298
|
+
* @since 0.6.0
|
|
163
299
|
*/
|
|
164
300
|
declare function createDevtoolsMiddleware(): Middleware;
|
|
165
301
|
|
package/dist/index.d.ts
CHANGED
|
@@ -124,10 +124,98 @@ interface ActionGuardDevtoolsProps {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
/**
|
|
127
|
-
* ActionGuardDevtools -
|
|
127
|
+
* ActionGuardDevtools - Visual developer tools panel for debugging UI blocking.
|
|
128
128
|
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
129
|
+
* This component provides a floating developer tools panel that visualizes all UI blocking
|
|
130
|
+
* events in real-time. It shows active blockers, their priorities, scopes, and provides
|
|
131
|
+
* a timeline of all blocking events with filtering and search capabilities.
|
|
132
|
+
*
|
|
133
|
+
* **Key Features:**
|
|
134
|
+
* - Real-time visualization of active blockers
|
|
135
|
+
* - Timeline of all blocking events (add, remove, timeout)
|
|
136
|
+
* - Filter by action type, scope, or search term
|
|
137
|
+
* - Pause/resume event capture
|
|
138
|
+
* - Keyboard shortcuts (Esc to close, P to pause, C to clear)
|
|
139
|
+
* - Draggable and resizable panel
|
|
140
|
+
* - Works with both global store and custom store instances
|
|
141
|
+
*
|
|
142
|
+
* **Performance:**
|
|
143
|
+
* - Automatically disabled in production builds (returns `null`)
|
|
144
|
+
* - Only allocates resources in development
|
|
145
|
+
* - Uses `showInProduction` prop to override if needed
|
|
146
|
+
*
|
|
147
|
+
* **Integration:**
|
|
148
|
+
* - Automatically registers devtools middleware on mount
|
|
149
|
+
* - Cleans up middleware on unmount
|
|
150
|
+
* - No configuration required for basic usage
|
|
151
|
+
*
|
|
152
|
+
* @param props - Configuration props for the devtools panel
|
|
153
|
+
* @param props.position - Panel position: 'left' | 'right' | 'top' | 'bottom' (default: 'right')
|
|
154
|
+
* @param props.defaultOpen - Whether panel is open initially (default: false)
|
|
155
|
+
* @param props.maxEvents - Maximum events to store in timeline (default: 200)
|
|
156
|
+
* @param props.showInProduction - Show panel even in production (default: false)
|
|
157
|
+
* @param props.store - Custom store instance (default: global store)
|
|
158
|
+
*
|
|
159
|
+
* @returns React element in development, `null` in production (unless `showInProduction` is true)
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* Basic usage (global store)
|
|
163
|
+
* ```tsx
|
|
164
|
+
* import { ActionGuardDevtools } from '@okyrychenko-dev/react-action-guard-devtools';
|
|
165
|
+
*
|
|
166
|
+
* function App() {
|
|
167
|
+
* return (
|
|
168
|
+
* <div>
|
|
169
|
+
* <YourApp />
|
|
170
|
+
* <ActionGuardDevtools />
|
|
171
|
+
* </div>
|
|
172
|
+
* );
|
|
173
|
+
* }
|
|
174
|
+
* ```
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* With custom configuration
|
|
178
|
+
* ```tsx
|
|
179
|
+
* <ActionGuardDevtools
|
|
180
|
+
* position="bottom"
|
|
181
|
+
* defaultOpen={true}
|
|
182
|
+
* maxEvents={500}
|
|
183
|
+
* />
|
|
184
|
+
* ```
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* With custom store instance (isolated state)
|
|
188
|
+
* ```tsx
|
|
189
|
+
* import { UIBlockingProvider } from '@okyrychenko-dev/react-action-guard';
|
|
190
|
+
* import { ActionGuardDevtools } from '@okyrychenko-dev/react-action-guard-devtools';
|
|
191
|
+
*
|
|
192
|
+
* function IsolatedApp() {
|
|
193
|
+
* return (
|
|
194
|
+
* <UIBlockingProvider>
|
|
195
|
+
* {({ store }) => (
|
|
196
|
+
* <>
|
|
197
|
+
* <YourApp />
|
|
198
|
+
* <ActionGuardDevtools store={store} />
|
|
199
|
+
* </>
|
|
200
|
+
* )}
|
|
201
|
+
* </UIBlockingProvider>
|
|
202
|
+
* );
|
|
203
|
+
* }
|
|
204
|
+
* ```
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* Keyboard shortcuts
|
|
208
|
+
* ```
|
|
209
|
+
* Esc - Close devtools panel
|
|
210
|
+
* Ctrl/⌘ + P - Toggle pause/resume event capture
|
|
211
|
+
* Ctrl/⌘ + K - Clear all events
|
|
212
|
+
* ```
|
|
213
|
+
*
|
|
214
|
+
* @see {@link https://github.com/okyrychenko-dev/react-action-guard-devtools | DevTools README}
|
|
215
|
+
* @see {@link createDevtoolsMiddleware} for manual middleware registration
|
|
216
|
+
*
|
|
217
|
+
* @public
|
|
218
|
+
* @since 0.6.0
|
|
131
219
|
*/
|
|
132
220
|
declare function ActionGuardDevtools(props: ActionGuardDevtoolsProps): ReactElement | null;
|
|
133
221
|
|
|
@@ -159,7 +247,55 @@ declare function selectUniqueScopes(state: DevtoolsStore): Array<string>;
|
|
|
159
247
|
|
|
160
248
|
declare const DEVTOOLS_MIDDLEWARE_NAME = "action-guard-devtools";
|
|
161
249
|
/**
|
|
162
|
-
* Creates the devtools middleware that records events
|
|
250
|
+
* Creates the devtools middleware that captures and records UI blocking events.
|
|
251
|
+
*
|
|
252
|
+
* This middleware intercepts all blocking events (add, remove, timeout, clear) and
|
|
253
|
+
* forwards them to the devtools store for visualization in the ActionGuardDevtools panel.
|
|
254
|
+
*
|
|
255
|
+
* The middleware calculates the duration of each blocker by tracking when it was added
|
|
256
|
+
* and when it was removed/timed out, providing insights into how long UI was blocked.
|
|
257
|
+
*
|
|
258
|
+
* **Note:** This middleware is automatically registered when you use the `ActionGuardDevtools`
|
|
259
|
+
* component. You typically don't need to call this function directly unless you're manually
|
|
260
|
+
* managing middleware registration.
|
|
261
|
+
*
|
|
262
|
+
* @returns Middleware function that can be registered with `configureMiddleware` or `registerMiddleware`
|
|
263
|
+
*
|
|
264
|
+
* @example
|
|
265
|
+
* Manual middleware registration (advanced usage)
|
|
266
|
+
* ```tsx
|
|
267
|
+
* import { uiBlockingStoreApi } from '@okyrychenko-dev/react-action-guard';
|
|
268
|
+
* import { createDevtoolsMiddleware, DEVTOOLS_MIDDLEWARE_NAME } from '@okyrychenko-dev/react-action-guard-devtools';
|
|
269
|
+
*
|
|
270
|
+
* // Register manually
|
|
271
|
+
* const middleware = createDevtoolsMiddleware();
|
|
272
|
+
* uiBlockingStoreApi.getState().registerMiddleware(DEVTOOLS_MIDDLEWARE_NAME, middleware);
|
|
273
|
+
*
|
|
274
|
+
* // Cleanup
|
|
275
|
+
* uiBlockingStoreApi.getState().unregisterMiddleware(DEVTOOLS_MIDDLEWARE_NAME);
|
|
276
|
+
* ```
|
|
277
|
+
*
|
|
278
|
+
* @example
|
|
279
|
+
* Automatic registration (recommended)
|
|
280
|
+
* ```tsx
|
|
281
|
+
* import { ActionGuardDevtools } from '@okyrychenko-dev/react-action-guard-devtools';
|
|
282
|
+
*
|
|
283
|
+
* // Middleware registered automatically when component mounts
|
|
284
|
+
* function App() {
|
|
285
|
+
* return (
|
|
286
|
+
* <>
|
|
287
|
+
* <YourApp />
|
|
288
|
+
* <ActionGuardDevtools />
|
|
289
|
+
* </>
|
|
290
|
+
* );
|
|
291
|
+
* }
|
|
292
|
+
* ```
|
|
293
|
+
*
|
|
294
|
+
* @see {@link ActionGuardDevtools} for automatic middleware registration
|
|
295
|
+
* @see {@link https://github.com/okyrychenko-dev/react-action-guard#middleware | Middleware documentation}
|
|
296
|
+
*
|
|
297
|
+
* @public
|
|
298
|
+
* @since 0.6.0
|
|
163
299
|
*/
|
|
164
300
|
declare function createDevtoolsMiddleware(): Middleware;
|
|
165
301
|
|