@okyrychenko-dev/react-action-guard 1.0.4 → 2.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.
- package/CHANGELOG.md +451 -0
- package/README.md +171 -1026
- package/dist/index.cjs +796 -589
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +172 -1225
- package/dist/index.d.ts +172 -1225
- package/dist/index.js +795 -595
- package/dist/index.js.map +1 -1
- package/package.json +47 -53
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 2.0.0
|
|
4
|
+
|
|
5
|
+
[Release history](https://github.com/okyrychenko-dev/react-action-guard/compare/v1.0.5...@okyrychenko-dev/react-action-guard@2.0.0)
|
|
6
|
+
|
|
7
|
+
### Major Changes
|
|
8
|
+
|
|
9
|
+
- 0d3c1f7: Complete the Blocking lifecycle architecture migration. Remove mutable blocker and middleware maps,
|
|
10
|
+
named middleware registration, direct event dispatch, and compatibility restore contracts. Observe
|
|
11
|
+
lifecycle transitions through ownership-safe anonymous leases and read readonly BlockerInfo snapshots.
|
|
12
|
+
Devtools sessions release only their observations; manual observation is now additive on every store.
|
|
13
|
+
Centralize guarded-control state and accessible reasons while retaining public hooks, state mappers,
|
|
14
|
+
state utilities, and distinct link behavior. Consolidate shared TanStack coverage at its coordination
|
|
15
|
+
interface and document migration from removed interfaces. Retain react-zustand-toolkit as the state
|
|
16
|
+
management base.
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- 39fb3de: Introduce a public Blocking lifecycle interface that owns blocker transitions, timers, immutable reads, and isolated observation while preserving the existing Zustand store interface through a compatibility adapter.
|
|
21
|
+
- 3db526a: Publish immutable Blocking lifecycle snapshots through global and provider-scoped stores. React hooks, guarded UI controls, and Devtools subscribe to those snapshots. The final release cohort is Core 2.0 and Devtools 1.0 with a Core ^2.0.0 peer requirement. Node.js 20 or newer is required; prior intermediate version proposals are superseded by this cohort.
|
|
22
|
+
- 4363609: Expose anonymous, ownership-safe lifecycle event observation through global and provider-scoped stores. Provider middleware and automatic Devtools observation use release leases without registry names. Core 2.0 removes the intermediate named middleware and direct runMiddlewares compatibility APIs; use observeBlockingEvents and release its lease to detach.
|
|
23
|
+
|
|
24
|
+
Observers registered while an event is being delivered begin receiving events with the next delivery. Observers released before their turn are skipped. Observer delivery remains ordered and error-isolated without awaiting earlier observers.
|
|
25
|
+
|
|
26
|
+
Manual Devtools observation is additive and store-local. Releasing an observation lease does not remove another owner's observer.
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- 6a08414: Finalize performance lifetimes on timeout and bulk cleanup, preserve timing through scope updates, and isolate slow-block callback failures. Keep Devtools history durations accurate after scope changes and preserve global registrations during targeted cleanup.
|
|
31
|
+
|
|
32
|
+
Preserve replacement registrations created inside timeout callbacks using opaque lifecycle registration identities; stale timeout events finalize only the expired lifetime.
|
|
33
|
+
|
|
34
|
+
Snapshot tracked scopes in performance and Devtools diagnostics so caller-owned array mutations cannot prevent scoped cleanup.
|
|
35
|
+
|
|
36
|
+
Read timeout metadata after the timeout callback so scope, reason and priority updates are reflected in the emitted event while preserving registration identity.
|
|
37
|
+
|
|
38
|
+
- 32264e4: Centralize scope normalization, inheritance, observation, and targeted-clear semantics in the core package, preserve empty observed scopes, and migrate guarded UI controls to use the shared behavior. The UI package now requires the core release that exports these helpers.
|
|
39
|
+
- 5d403d8: Migrate the Core and Devtools store integrations to `@okyrychenko-dev/react-zustand-toolkit` 1.0.0 while preserving React Action Guard's public store and provider APIs.
|
|
40
|
+
- 64145c9: Keep conditional blocker configuration current while the condition remains true, including scope, reason, priority, timestamp and timeout options. Preserve unchanged timeout deadlines and use the latest timeout callback. A timeout ends the current registration episode until a polled false-to-true condition transition or a new ID or Provider attachment starts another episode.
|
|
41
|
+
- 083a5b7: Warn in development when active useActionBlocker hooks share an ID in the same store. Track registrations through cleanup and Strict Mode without warning for equal IDs in isolated stores. Shared IDs still require consumer correction; production registration and cleanup behavior is unchanged.
|
|
42
|
+
- 690a3a9: Validate every supplied scheduled-window bound, preserve epoch-zero ends, and treat zero duration as an empty window instead of indefinite blocking. Invalid bounds cancel hook-owned work with a development warning. Support distant finite starts using bounded timer chunks, matching end deadlines. Omit duration and end explicitly when indefinite blocking is intended.
|
|
43
|
+
|
|
44
|
+
Empty future windows do not retain start timers or repeatedly wake for distant deadlines.
|
|
45
|
+
|
|
46
|
+
- a1b83db: Freeze normalized scope arrays so JavaScript mutation cannot corrupt cached results shared by other consumers. Stable identity, sorting, deduplication, default and empty scope semantics, and bounded cache eviction are preserved.
|
|
47
|
+
- d07b65a: Treat array-form global blocker scopes consistently across store scope queries and targeted clears.
|
|
48
|
+
- bd1dc3b: Publish format-specific ESM and CommonJS declarations so NodeNext CommonJS consumers can use the supported public imports. Correct Core's legacy main/module paths and resolve Next's router.js entry so native Node ESM can load the Next adapter. Require React Router DOM >=6.19.0 within v6 or v7 because earlier v6 releases do not export the stable useBlocker API. This excludes previously declared unsupported versions and releases the pre-1.0 router package as a minor change. Consumers on older v6 must upgrade before adopting this release; no new runtime dependency is added. Publish evidence-labelled capabilities and packed peer/provider checks, and clarify App Router and application-owned payment cancellation limits.
|
|
49
|
+
- 6513e1e: Apply current reactive blocker configuration in core and TanStack hooks. Removed
|
|
50
|
+
scope, reason and priority values return to defaults; omitted timeout and callback
|
|
51
|
+
values clear. Metadata changes preserve unchanged deadlines and registration
|
|
52
|
+
timestamps, while changed timeouts restart and removed timeouts cancel timers.
|
|
53
|
+
Imperative updateBlocker patch behavior remains compatible. Consumers relying on
|
|
54
|
+
retained hook options must keep those options in the current configuration.
|
|
55
|
+
The released TanStack adapter requires Core ^2.0.0, including configuration replacement support.
|
|
56
|
+
- 6d59289: Skip scheduled windows that have already elapsed when a delayed start timer runs, and retain long windows without overflowing their end timers. Share router protection scope keys, remove unused internal confirmation handling, and correct the documented public router types.
|
|
57
|
+
- 26cc31e: Align packaged README requirements with the Core ^2.0.0 release cohort and use durable repository URLs for migration, observability and Next runtime evidence. Declare the Query adapter's existing Node.js >=20 requirement inherited from type-utils. Reconcile superseded intermediate compatibility descriptions in pending release notes.
|
|
58
|
+
|
|
59
|
+
Include CHANGELOG.md in every package so the packaged README changelog links resolve. Generate versioned API references and advance changelog links as part of the Changesets version command.
|
|
60
|
+
|
|
61
|
+
- b987ed1: Honor long finite blocker timeouts with bounded timer chunks that credit each completed wait even when the monotonic clock pauses during system suspension. System clock adjustments do not change the delay. Reject nonfinite timeouts and unrepresentable deadlines with RangeError before changing registrations or existing timers. Omitted, zero and finite negative timeouts continue to disable expiration; replace infinity/NaN sentinels with an omitted timeout or zero.
|
|
62
|
+
- 743c6f4: Guarantee scheduled blocker completion when start or end notifications throw. Schedule the end before notifying start, and always release protection after the end notification. Cancel scheduled notifications and release protection when an immediate start notification prevents effect setup. Notification errors remain observable.
|
|
63
|
+
- 303abc3: Keep scheduled blocker configuration current during active windows and honor timeout options without restarting unchanged deadlines. Preserve scheduled end notifications after blocker timeout.
|
|
64
|
+
- eefba30: Prevent repeated confirmation calls from executing the same action more than once per hook
|
|
65
|
+
instance. Concurrent callers share its outcome; reopening and cancellation are ignored while
|
|
66
|
+
execution is pending. Success and failure both allow retry. Existing timeout and unmount
|
|
67
|
+
behavior remains unchanged.
|
|
68
|
+
- 40e8420: Keep scoped metadata and guarded controls stable when unrelated blockers change, while observing all relevant metadata and preserving immutable priority-ordered results. Core `useBlockingInfo` now also accepts readonly scope arrays so UI consumers share the same projection and matching rules; `createTypedHooks` accepts the same arrays while rejecting unknown scope names. Delegate resolved subscriptions and selection retention to react-zustand-toolkit, with optional custom equality on `useResolvedValue`. Cover scope representation changes and stable metadata when observation expands. Retain production/development scale and rapid-registration benchmark evidence refreshed after the typed-hook fix, with installed-tarball declaration checks and pinned source provenance.
|
|
69
|
+
- 6230733: Adopt `@okyrychenko-dev/type-utils` 0.1.2 for internal type guards, assertions, and utility types, replacing equivalent hand-rolled checks, a duplicated `assertNever` helper, and inline nullable/optional unions. Runtime behavior is unchanged; some public function signatures now show the package's equivalent utility types. Adds `@okyrychenko-dev/type-utils` as a new dependency and explicitly requires Node.js 20 or newer; Node.js 18 is EOL and unsupported.
|
|
70
|
+
|
|
71
|
+
All notable changes to this project will be documented in this file.
|
|
72
|
+
|
|
73
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
74
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
75
|
+
|
|
76
|
+
## [Unreleased]
|
|
77
|
+
|
|
78
|
+
## [1.0.5] - 2026-07-25
|
|
79
|
+
|
|
80
|
+
### Changed
|
|
81
|
+
|
|
82
|
+
- Made scheduled blockers react to runtime schedule changes.
|
|
83
|
+
- Made conditional blockers react to runtime interval changes and fall back to
|
|
84
|
+
the default interval for non-positive values.
|
|
85
|
+
- Removed the internal circular type dependency from the package entrypoint.
|
|
86
|
+
|
|
87
|
+
### Fixed
|
|
88
|
+
|
|
89
|
+
- Prevented `useAsyncAction` blocker ID collisions across hook instances while
|
|
90
|
+
preserving isolation between provider stores.
|
|
91
|
+
- Prevented inline `useBlocker` timeout callbacks from causing redundant blocker
|
|
92
|
+
updates while still invoking the latest callback.
|
|
93
|
+
- Ensured active timeout handlers and timeout middleware use the latest blocker
|
|
94
|
+
configuration.
|
|
95
|
+
- Prevented remove middleware contexts from exposing the internal `timeoutId`.
|
|
96
|
+
- Corrected `loggerMiddleware` documentation about production logging behavior.
|
|
97
|
+
|
|
98
|
+
## [1.0.4] - 2026-05-27
|
|
99
|
+
|
|
100
|
+
### Changed
|
|
101
|
+
|
|
102
|
+
- Updated `@okyrychenko-dev/react-zustand-toolkit` to `^0.4.1`.
|
|
103
|
+
- Prepared package metadata for the coordinated toolkit compatibility release.
|
|
104
|
+
|
|
105
|
+
## [1.0.3] - 2026-05-09
|
|
106
|
+
|
|
107
|
+
### Fixed
|
|
108
|
+
|
|
109
|
+
- Prevented `useBlocker` from updating an active blocker when inline config objects keep the same effective values.
|
|
110
|
+
- Stabilized blocker config comparison through normalized scope snapshots and Zustand `shallow` equality.
|
|
111
|
+
- Added regression coverage for inline blocker config rerenders.
|
|
112
|
+
|
|
113
|
+
## [1.0.2] - 2026-04-18
|
|
114
|
+
|
|
115
|
+
### Changed
|
|
116
|
+
|
|
117
|
+
- Aligned provider docs and examples with `react-zustand-toolkit@0.4.0`
|
|
118
|
+
- Removed obsolete provider-level DevTools props from the public provider contract
|
|
119
|
+
|
|
120
|
+
### Fixed
|
|
121
|
+
|
|
122
|
+
- Updated `UIBlockingProvider` source and tests to match the current toolkit provider API
|
|
123
|
+
|
|
124
|
+
## [1.0.1] - 2026-03-08
|
|
125
|
+
|
|
126
|
+
### Changed
|
|
127
|
+
|
|
128
|
+
- 📚 Refocused README onboarding around core use cases: `useAsyncAction`, scoped coordination, and provider isolation
|
|
129
|
+
- 🧭 Reframed `useConfirmableBlocker`, `useScheduledBlocker`, and `useConditionalBlocker` as advanced hooks in README and Storybook docs
|
|
130
|
+
- 🧩 Clarified that middleware is optional and additive, not part of the primary onboarding path
|
|
131
|
+
|
|
132
|
+
## [1.0.0] - 2026-03-08
|
|
133
|
+
|
|
134
|
+
### Breaking Changes
|
|
135
|
+
|
|
136
|
+
- 🔒 Removed public re-exports of internal `react-zustand-toolkit` helpers from the root API:
|
|
137
|
+
- `createShallowStore`
|
|
138
|
+
- `createStoreToolkit`
|
|
139
|
+
- `createStoreProvider`
|
|
140
|
+
- `createResolvedStoreHooks`
|
|
141
|
+
- 🧹 Tightened the public API boundary around `react-action-guard` store internals
|
|
142
|
+
|
|
143
|
+
### Migration Notes
|
|
144
|
+
|
|
145
|
+
- Import advanced store construction helpers directly from `@okyrychenko-dev/react-zustand-toolkit` if you still need them
|
|
146
|
+
- Prefer `useUIBlockingStore`, `uiBlockingStoreApi`, and provider/hooks exported by `react-action-guard` for public integration
|
|
147
|
+
|
|
148
|
+
### Changed
|
|
149
|
+
|
|
150
|
+
- 🔄 `useBlocker` now applies config updates to an already active blocker (without requiring remount)
|
|
151
|
+
- ♻️ `configureMiddleware(...)` is now idempotent for global middleware registration:
|
|
152
|
+
- replaces previously configured `middleware-*` entries
|
|
153
|
+
- preserves provider-level middlewares (e.g., `provider-middleware-*`)
|
|
154
|
+
- 🧼 `BlockerInfo` no longer exposes internal `timeoutId`
|
|
155
|
+
- 🔇 Core hooks/store runtime no longer emit default `console.*` side effects for scheduling, confirmable actions, middleware failures, or slow-block detection
|
|
156
|
+
- 📚 README onboarding is now centered on core use cases (`useAsyncAction`, scoped coordination, provider isolation) and marks scheduled/confirmable/conditional hooks as advanced
|
|
157
|
+
|
|
158
|
+
### Fixed
|
|
159
|
+
|
|
160
|
+
- 🛡️ Analytics middleware is now SSR-safe (`ga`, `mixpanel`, `amplitude` become no-op when `window` is unavailable)
|
|
161
|
+
- 📚 Documentation updates across README and Storybook MDX:
|
|
162
|
+
- corrected `useBlocker` signature/defaults and config update behavior
|
|
163
|
+
- corrected `useIsBlocked` default scope semantics (`"global"`)
|
|
164
|
+
- corrected type signatures in `useAsyncAction`, `useConditionalBlocker`, `useScheduledBlocker`
|
|
165
|
+
- fixed Introduction middleware example to use `uiBlockingStoreApi`
|
|
166
|
+
|
|
167
|
+
## [0.7.0] - 2026-01-25
|
|
168
|
+
|
|
169
|
+
### Breaking Changes
|
|
170
|
+
|
|
171
|
+
- ⚠️ **Updated minimum peer dependency versions**:
|
|
172
|
+
- React: `^18.0.0 || ^19.0.0` (removed React 17 support)
|
|
173
|
+
- Zustand: `^5.0.0` (removed Zustand 4.x support)
|
|
174
|
+
|
|
175
|
+
### Added
|
|
176
|
+
|
|
177
|
+
- 🧩 **New Storybook components** for enhanced interactive documentation:
|
|
178
|
+
- `BlockerItem` - Reusable component for displaying blocker details
|
|
179
|
+
- `ConfirmDialog` - Confirmation dialog component with customizable styling
|
|
180
|
+
- `ScopeSync` - CSS styles for multi-component scope coordination examples
|
|
181
|
+
|
|
182
|
+
### Changed
|
|
183
|
+
|
|
184
|
+
- ♻️ **Code quality improvements**:
|
|
185
|
+
- Converted all `export const` function declarations to `export function` for consistency
|
|
186
|
+
- Standardized component props destructuring pattern in story files
|
|
187
|
+
- Migrated from `JSX` to `ReactElement` type imports for better type clarity
|
|
188
|
+
- Converted utility arrow functions to function declarations (`normalizePriority`, `createMiddlewareContext`)
|
|
189
|
+
- 🏗️ **Type organization**: Moved `ShallowStoreBindings` interface to `uiBlockingStore.types.ts` for better structure
|
|
190
|
+
- 🔧 **ESLint configuration**: Added `curly: ["error", "all"]` rule to enforce explicit block statements
|
|
191
|
+
- 🎨 **Documentation**: Updated code samples in MDX files to reflect function declaration syntax
|
|
192
|
+
- 📦 **Dependencies**: Updated `@okyrychenko-dev/react-zustand-toolkit` to `^0.2.0`
|
|
193
|
+
|
|
194
|
+
### Fixed
|
|
195
|
+
|
|
196
|
+
- 📝 Cleaned up trailing whitespace in JSDoc comments across all files
|
|
197
|
+
|
|
198
|
+
## [0.6.1] - 2024-12-28
|
|
199
|
+
|
|
200
|
+
### Documentation
|
|
201
|
+
|
|
202
|
+
- 📚 **Comprehensive JSDoc documentation** (~90 examples across all hooks and middleware)
|
|
203
|
+
- All hooks: `useBlocker`, `useIsBlocked`, `useBlockingInfo`, `useAsyncAction`, `useConfirmableBlocker`, `useScheduledBlocker`, `useConditionalBlocker`
|
|
204
|
+
- All middleware: logger, analytics, performance, configuration
|
|
205
|
+
- Context/Provider hooks with isolated store examples
|
|
206
|
+
- 🎯 **Examples demonstrate react-action-guard concepts**:
|
|
207
|
+
- Scope-based isolation and coordination
|
|
208
|
+
- `useIsBlocked`/`useBlockingInfo` patterns in separate components
|
|
209
|
+
- Multi-component coordination without prop drilling
|
|
210
|
+
- Priority-based blocking resolution
|
|
211
|
+
- Real-world use cases (forms, navigation, async operations)
|
|
212
|
+
- 🔧 **Fixed JSDoc formatting** (removed literal `\n` escape sequences for cleaner TypeDoc generation)
|
|
213
|
+
|
|
214
|
+
## [0.6.0] - 2024-12-24
|
|
215
|
+
|
|
216
|
+
### Added
|
|
217
|
+
|
|
218
|
+
- 🧩 **New `updateBlocker` function** to update blocker metadata dynamically
|
|
219
|
+
- Update scope, reason, and priority of existing blockers
|
|
220
|
+
- Restart timeout by providing a new `timeout` value
|
|
221
|
+
- Clear timeout by setting `timeout: 0`
|
|
222
|
+
- If `timeout` is not changed, the timer continues as before (backward compatible)
|
|
223
|
+
- 🎯 **Middleware events for clear operations**:
|
|
224
|
+
- `clearAllBlockers()` now emits `"clear"` middleware event with `count` field
|
|
225
|
+
- `clearBlockersForScope()` now emits `"clear_scope"` middleware event with `scope` and `count` fields
|
|
226
|
+
- 📊 **Extended `MiddlewareContext` type**:
|
|
227
|
+
- New optional `scope?: string` field for `clear_scope` action
|
|
228
|
+
- New optional `count?: number` field for `clear` and `clear_scope` actions
|
|
229
|
+
- 🧹 **Logger middleware enhancements**:
|
|
230
|
+
- Support for `"clear"` action → 🧹 emoji
|
|
231
|
+
- Support for `"clear_scope"` action → 🎯 emoji
|
|
232
|
+
- ✅ **Priority validation**: Negative priority values are automatically normalized to 0
|
|
233
|
+
- Ensures consistent priority sorting behavior
|
|
234
|
+
- Prevents unexpected behavior with negative priorities
|
|
235
|
+
- Documented in TypeScript types and README
|
|
236
|
+
- 📚 **Documentation improvements**:
|
|
237
|
+
- Added "Clearing Blockers on Navigation" use case
|
|
238
|
+
- Added "Managing Session Timeouts with Dynamic Updates" use case
|
|
239
|
+
- Added interactive Storybook stories for new features
|
|
240
|
+
- 🧪 **Test coverage**: Added 7 new tests for priority validation and clear operations
|
|
241
|
+
|
|
242
|
+
### Changed
|
|
243
|
+
|
|
244
|
+
- 🧹 **Internal**: Refactored store actions to reduce code duplication
|
|
245
|
+
- Added `normalizePriority()` helper function for consistent priority handling
|
|
246
|
+
- Added `createMiddlewareContext()` factory for middleware event creation
|
|
247
|
+
|
|
248
|
+
### Removed
|
|
249
|
+
|
|
250
|
+
- 🧹 Removed debug `console.log` statements from `registerMiddleware` and `unregisterMiddleware`
|
|
251
|
+
- Use logger middleware for observability instead
|
|
252
|
+
|
|
253
|
+
## [0.5.0]
|
|
254
|
+
|
|
255
|
+
### Added
|
|
256
|
+
|
|
257
|
+
- 📦 Added dependency on `@okyrychenko-dev/react-zustand-toolkit` for shared store utilities
|
|
258
|
+
- 🧰 Exported store toolkit helpers for advanced usage:
|
|
259
|
+
- `createShallowStore`
|
|
260
|
+
- `createStoreToolkit`
|
|
261
|
+
- `createStoreProvider`
|
|
262
|
+
- `createResolvedStoreHooks`
|
|
263
|
+
|
|
264
|
+
### Changed
|
|
265
|
+
|
|
266
|
+
- ♻️ Store creation now uses `react-zustand-toolkit` utilities
|
|
267
|
+
- 🧩 Internal store setup moved to a dedicated toolkit library for reuse and maintenance
|
|
268
|
+
|
|
269
|
+
## [0.4.0]
|
|
270
|
+
|
|
271
|
+
### Added
|
|
272
|
+
|
|
273
|
+
- ⏱️ **Timeout mechanism** - auto-remove blockers after specified time
|
|
274
|
+
- New `timeout` option in `BlockerConfig` to auto-remove blockers
|
|
275
|
+
- New `onTimeout` callback when blocker is auto-removed
|
|
276
|
+
- New `"timeout"` action type in middleware
|
|
277
|
+
- Works with `useBlocker`, `useAsyncAction`, and all other hooks
|
|
278
|
+
- 🏠 **Provider pattern** - isolated stores for SSR, testing, and micro-frontends
|
|
279
|
+
- New `UIBlockingProvider` component for isolated store instances
|
|
280
|
+
- New `useUIBlockingContext` hook to access context store
|
|
281
|
+
- New `useIsInsideUIBlockingProvider` hook to check if inside provider
|
|
282
|
+
- New `useUIBlockingStoreFromContext` hook for context store with selector
|
|
283
|
+
- All hooks now support both global and context stores automatically
|
|
284
|
+
|
|
285
|
+
### Changed
|
|
286
|
+
|
|
287
|
+
- ⬆️ Updated peer dependencies to support React 19
|
|
288
|
+
- React: `^18.0.0 || ^19.0.0`
|
|
289
|
+
- Zustand: `^5.0.0`
|
|
290
|
+
- 🔧 All hooks now use resolved store APIs for Provider support
|
|
291
|
+
|
|
292
|
+
## [0.3.3] - 2025-12-01
|
|
293
|
+
|
|
294
|
+
### Added
|
|
295
|
+
|
|
296
|
+
- 🛠️ `configureMiddleware` helper function for easy middleware registration
|
|
297
|
+
- 📊 `useBlockingInfo` hook to get detailed blocking information (reason, priority, timestamp, etc.)
|
|
298
|
+
|
|
299
|
+
### Fixed
|
|
300
|
+
|
|
301
|
+
- 📝 Fixed README documentation to use correct middleware function names:
|
|
302
|
+
- `analyticsMiddleware` → `createAnalyticsMiddleware`
|
|
303
|
+
- `performanceMiddleware` → `createPerformanceMiddleware`
|
|
304
|
+
- 📚 Added missing `configureMiddleware` export that was referenced in documentation
|
|
305
|
+
|
|
306
|
+
## [0.3.0] - 2025-11-25
|
|
307
|
+
|
|
308
|
+
### Added
|
|
309
|
+
|
|
310
|
+
- 🚀 `createShallowStore` utility function for automatic shallow comparison in selectors
|
|
311
|
+
- 📦 Export `uiBlockingStoreApi` for direct store access without hooks
|
|
312
|
+
|
|
313
|
+
### Changed
|
|
314
|
+
|
|
315
|
+
- ⚡ **BREAKING**: `useUIBlockingStore` now requires a selector function instead of being called without arguments
|
|
316
|
+
- 🔧 Refactored `useUIBlockingStore` to use `createShallowStore` instead of direct `create()`
|
|
317
|
+
- 🎯 Updated all hooks to use selectors with shallow comparison:
|
|
318
|
+
- `useBlocker`
|
|
319
|
+
- `useAsyncAction`
|
|
320
|
+
- `useScheduledBlocker`
|
|
321
|
+
- `useConditionalBlocker`
|
|
322
|
+
- 🧪 Updated all tests to use `uiBlockingStoreApi.getState()` instead of `useUIBlockingStore.getState()`
|
|
323
|
+
|
|
324
|
+
### Performance
|
|
325
|
+
|
|
326
|
+
- ♻️ Reduced unnecessary re-renders by automatically applying shallow comparison to all selectors
|
|
327
|
+
- 🎯 Improved component performance when using multiple store subscriptions
|
|
328
|
+
|
|
329
|
+
### Migration Guide
|
|
330
|
+
|
|
331
|
+
**Before (0.2.x):**
|
|
332
|
+
|
|
333
|
+
```typescript
|
|
334
|
+
const { addBlocker, removeBlocker } = useUIBlockingStore();
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
**After (0.3.0):**
|
|
338
|
+
|
|
339
|
+
```typescript
|
|
340
|
+
// Option 1: Use selector (recommended for hooks)
|
|
341
|
+
const { addBlocker, removeBlocker } = useUIBlockingStore((state) => ({
|
|
342
|
+
addBlocker: state.addBlocker,
|
|
343
|
+
removeBlocker: state.removeBlocker,
|
|
344
|
+
}));
|
|
345
|
+
|
|
346
|
+
// Option 2: Use direct API access (for non-hook contexts)
|
|
347
|
+
import { uiBlockingStoreApi } from "@okyrychenko-dev/react-action-guard";
|
|
348
|
+
uiBlockingStoreApi.getState().addBlocker("id", config);
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
## [0.2.3] - 2025-11-24
|
|
352
|
+
|
|
353
|
+
### Added
|
|
354
|
+
|
|
355
|
+
- 📚 Comprehensive Storybook documentation with interactive examples for all hooks
|
|
356
|
+
- 📖 Detailed MDX documentation files (3000+ lines total):
|
|
357
|
+
- Introduction.mdx with library overview and quick start guide
|
|
358
|
+
- Individual MDX files for each hook with usage examples and API reference
|
|
359
|
+
- 🧩 Reusable Storybook components for consistent presentation:
|
|
360
|
+
- `StoryContainer` - Standardized container for all stories
|
|
361
|
+
- `StatusDisplay` - Unified status display component
|
|
362
|
+
- `AffectedElements` - Demo component showing blocked UI elements
|
|
363
|
+
- `DebugPanel` - Real-time blocker state visualization
|
|
364
|
+
- 🛠️ Utility functions for stories:
|
|
365
|
+
- `simulateAsyncOperation()` - Reusable async operation simulator
|
|
366
|
+
- `formatErrorMessage()` - Type-safe error message formatter
|
|
367
|
+
- 🎨 Shared CSS styles (`shared.stories.css`) for consistent story styling
|
|
368
|
+
- 🔧 Integration with `clsx` library for className management (industry standard)
|
|
369
|
+
|
|
370
|
+
### Changed
|
|
371
|
+
|
|
372
|
+
- ♻️ Refactored all 6 story files to use shared components (reduced code duplication by ~20%)
|
|
373
|
+
- 📝 Updated ESLint configuration with import sorting rules
|
|
374
|
+
- 🏗️ Reorganized hooks folder structure for better maintainability
|
|
375
|
+
- 🎯 Stories now use `clsx` instead of custom `classNames` implementation
|
|
376
|
+
|
|
377
|
+
### Fixed
|
|
378
|
+
|
|
379
|
+
- ✅ Resolved React `act()` warnings in test suite
|
|
380
|
+
- 🐛 Fixed `useScheduledBlocker` hook implementation issues
|
|
381
|
+
- 🔧 Fixed ESLint errors in story files (type return annotations, async handlers)
|
|
382
|
+
- 🎨 Fixed CSS class concatenation using proper utilities
|
|
383
|
+
|
|
384
|
+
## [0.2.2] - 2025-11-23
|
|
385
|
+
|
|
386
|
+
### Added
|
|
387
|
+
|
|
388
|
+
- Documentation improvements in README
|
|
389
|
+
|
|
390
|
+
### Changed
|
|
391
|
+
|
|
392
|
+
- Updated project metadata
|
|
393
|
+
|
|
394
|
+
## [0.2.1] - 2025-11-22
|
|
395
|
+
|
|
396
|
+
### Added
|
|
397
|
+
|
|
398
|
+
- Advanced hooks implementation:
|
|
399
|
+
- `useAsyncAction` - Wrap async operations with automatic UI blocking
|
|
400
|
+
- `useConfirmableBlocker` - Confirmation dialogs with blocking
|
|
401
|
+
- `useConditionalBlocker` - Condition-based blocking with polling
|
|
402
|
+
- `useScheduledBlocker` - Time-based scheduled blocking
|
|
403
|
+
- `useIsBlocked` - Check blocking state for any scope
|
|
404
|
+
|
|
405
|
+
### Changed
|
|
406
|
+
|
|
407
|
+
- Improved hook implementations with better TypeScript types
|
|
408
|
+
- Enhanced middleware system with context passing
|
|
409
|
+
|
|
410
|
+
### Fixed
|
|
411
|
+
|
|
412
|
+
- Cleaned up redundant files from repository
|
|
413
|
+
|
|
414
|
+
## [0.1.0] - 2025-11-16
|
|
415
|
+
|
|
416
|
+
### Added
|
|
417
|
+
|
|
418
|
+
- Initial release of React Action Guard
|
|
419
|
+
- Core blocking system with Zustand store
|
|
420
|
+
- Basic hooks:
|
|
421
|
+
- `useBlocker` - Manual blocking control with priorities
|
|
422
|
+
- `useUIBlockingStore` - Direct store access
|
|
423
|
+
- Scope-based blocking system (global, custom scopes, multiple scopes)
|
|
424
|
+
- Priority-based blocker management (higher values = higher priority)
|
|
425
|
+
- Middleware system for extensibility
|
|
426
|
+
- Built-in logger middleware
|
|
427
|
+
- TypeScript support with full type definitions
|
|
428
|
+
- Comprehensive test suite
|
|
429
|
+
- MIT License
|
|
430
|
+
|
|
431
|
+
[Unreleased]: https://github.com/okyrychenko-dev/react-action-guard/compare/@okyrychenko-dev/react-action-guard@2.0.0...HEAD
|
|
432
|
+
[1.0.5]: https://github.com/okyrychenko-dev/react-action-guard/compare/v1.0.4...v1.0.5
|
|
433
|
+
[1.0.4]: https://github.com/okyrychenko/react-action-guard/compare/v1.0.3...v1.0.4
|
|
434
|
+
[1.0.3]: https://github.com/okyrychenko/react-action-guard/compare/v1.0.2...v1.0.3
|
|
435
|
+
[1.0.2]: https://github.com/okyrychenko/react-action-guard/compare/v1.0.1...v1.0.2
|
|
436
|
+
[1.0.1]: https://github.com/okyrychenko/react-action-guard/compare/v1.0.0...v1.0.1
|
|
437
|
+
[1.0.0]: https://github.com/okyrychenko/react-action-guard/compare/v0.7.0...v1.0.0
|
|
438
|
+
[0.7.0]: https://github.com/okyrychenko/react-action-guard/compare/v0.6.1...v0.7.0
|
|
439
|
+
[0.6.1]: https://github.com/okyrychenko/react-action-guard/compare/v0.6.0...v0.6.1
|
|
440
|
+
[0.6.0]: https://github.com/okyrychenko/react-action-guard/compare/v0.5.0...v0.6.0
|
|
441
|
+
[0.5.0]: https://github.com/okyrychenko/react-action-guard/compare/v0.4.0...v0.5.0
|
|
442
|
+
[0.4.0]: https://github.com/okyrychenko/react-action-guard/compare/v0.3.3...v0.4.0
|
|
443
|
+
[0.3.3]: https://github.com/okyrychenko/react-action-guard/compare/v0.3.2...v0.3.3
|
|
444
|
+
[0.3.2]: https://github.com/okyrychenko/react-action-guard/compare/v0.3.1...v0.3.2
|
|
445
|
+
[0.3.1]: https://github.com/okyrychenko/react-action-guard/compare/v0.3.0...v0.3.1
|
|
446
|
+
[0.3.0]: https://github.com/okyrychenko/react-action-guard/compare/v0.2.3...v0.3.0
|
|
447
|
+
[0.2.3]: https://github.com/okyrychenko/react-action-guard/compare/v0.2.2...v0.2.3
|
|
448
|
+
[0.2.2]: https://github.com/okyrychenko/react-action-guard/compare/v0.2.1...v0.2.2
|
|
449
|
+
[0.2.1]: https://github.com/okyrychenko/react-action-guard/compare/v0.1.0...v0.2.1
|
|
450
|
+
[0.1.0]: https://github.com/okyrychenko/react-action-guard/releases/tag/v0.1.0
|
|
451
|
+
[2.0.0]: https://github.com/okyrychenko-dev/react-action-guard/compare/v1.0.5...@okyrychenko-dev/react-action-guard@2.0.0
|