v0.14.0
cotton-box
ReadOnlyStateManagertype now exposes thenameproperty.
cotton-box-react
- Fixed a bug where the error below might be thrown under some circumstances:
Cannot use 'in' operator to search for 'name' in undefined
useSimpleStateValueWithReactiveSelectoranduseStateValueWithReactiveSelectorhas been marked as deprecated and will most likely be removed in the next major version (v0 -> v1). If you use this hook and find a valid use case, please create an issue to explain your use case.
v0.13.1
cotton-box
- Internal code optimizations with TypeScript strict mode enabled.
cotton-box-react
- Internal code optimizations with TypeScript strict mode enabled.
v0.13.0
cotton-box
- N/A
cotton-box-react
- Added missing export.
v0.12.0
cotton-box
- Added experimental hydration API for when server-side rendering is involved.
cotton-box-react
- Added experimental hydration API for when server-side rendering is involved.
v0.11.0
cotton-box
- Fixed incorrect type definition for
trySet
cotton-box-react
- N/A
v0.10.0
cotton-box
- Added
trySetmethod toSimpleFiniteStateManager. - Parameter
stateManagerNameofInvalidStateTransitionErrorhas been renamed tostateManagerfor brevity. - Constructor parameters of
InvalidStateTransitionError(fromState,toState,stateManager) are now also available as public readonly properties.
cotton-box-react
- N/A
v0.9.0
cotton-box
- Fixed a bug where
SimpleFiniteStateManagerwould throw "TypeError: Cannot read properties of undefined (reading 'has')" when setting state under certain circumstances. - The constructor of
InvalidStateTransitionErrornow accepts a third optional parameterstateManagerName. Watcher.refreshhas now been renamed to.post. The.refreshmethod is still available but will be removed in a future version.
cotton-box-react
- N/A
v0.8.0
cotton-box
- Added helper type
StateTransition.
cotton-box-react
- Updated type definitions for hooks to accept
SimpleFiniteStateManagerandReadonlyStateManager.
v0.7.0
cotton-box
- Added
SimpleFiniteStateManager, a sub-class ofSimpleStateManagerthat only allows state change according to a set of predefined state transitions.
cotton-box-react
- N/A
v0.6.0
cotton-box
- The
EqualityAPI has been removed — it now exists as a separate package:@glyph-cat/equality.
cotton-box-react
- N/A
v0.5.0
cotton-box
- N/A
cotton-box-react
- Updated post-install script.
- Removed Scope-related APIs (
StateManagerScopeProviderProps,StateManagerScopeProvider,useScoped) to reduce complexity of the library.
v0.4.0
cotton-box
- The
Watcherthat Cotton Box uses internally is now exposed as a public API. - Internal stability enhancements.
cotton-box-react
- Internal stability enhancements.
v0.3.0
cotton-box
- Fixed incorrect export name for UMD builds.
- Events captured by
.watchnow includesStateChangeEventTypeas the second parameter. - Events captured by
.waitnow includesStateChangeEventTypeas the third parameter. - Type safety enhancements.
- Internal optimizations.
cotton-box-react
- Fixed incorrect export name for UMD builds.
- Fixed a bug where error "Cannot read properties of null (reading 'name')" would be thrown in production.
- Internal optimizations.
v0.2.0
cotton-box
- The
isInitializingproperty ofStateManagerandAsyncStateManageris now exposed as aReadOnlyStateManager. - Removed method
.waitForInitin favor of calling….isInitializing.wait(false)directly. - State Managers without names will be assigned automatic names (
UnnamedStateManager_001,UnnamedStateManager_002, and so on).
cotton-box-react
useInitState has been removed in favor of a more direct way to find out if a State Manager is initializing:
- const isInitializing = useInitState(ExampleState)
+ const isInitializing = useSimpleStateValue(ExampleState.isInitializing)
The way useInitState works internally is also similar to calling useSimpleStateValue. By having one less hook means the codebase will have less complexity and becomes easier to maintain.
On top of that, now that isInitializing is exposed as a State Manager itself, this means it is also possible to watch for the changes and even use it with other UI libraries/frameworks such as Vue and Angular with significantly less friction.
v0.1.0
cotton-box
- The
waitmethod now will only wait for the state to match or evaluator to return true, without checking if the state is currently initializing. - Added new method
waitForInittoStateManagerandAsyncStateManager - Added new method
reinitializetoStateManagerandAsyncStateManager currentStateis now exposed in thelifecycle.initcallback- New property
isInitializingexposed forStateManagerandAsyncStateManager
cotton-box-react
- Added new hook
useInitState
v0.0.2
cotton-box
- Stability enhancements.
cotton-box-react
- Passing
StateManagerandAsyncStateManagertouseSimpleStateValueanduseSimpleStateValueWithReactiveSelectorwill not cause an error to be thrown. This is the same behavior as v0.0.0. Instead, rely on TypeScript's type-checking to prevent passing the wrong State Manager type. This change is made to reduce some runtime overhead in the hooks by not having to validate the State Manager types.
v0.0.1
cotton-box
- Fixed a bug where the
didResetlifecycle hook is called during initialization viacommit.
cotton-box-react
- Passing
StateManagerandAsyncStateManagertouseSimpleStateValueanduseSimpleStateValueWithReactiveSelectorwill now cause an error to be thrown.
v0.0.0
- Initial release / pre-release