Package surface
The public entrypoint paths are defined by state/package.json exports. Import framework-neutral construction from the root and framework adapters from their subpaths.
Entry point matrix
| Import | Purpose |
|---|---|
@ilokesto/state | Framework-neutral Store, createStore, createReducer, pipe, definePipeableMiddleware, PipeConfigurationError, and dispose, plus their public state contracts. |
@ilokesto/state/react | React create() adapter and UseState, UseReducer types. |
@ilokesto/state/vue | Vue create() adapter and UseState, UseReducer types. |
@ilokesto/state/svelte | Svelte create() adapter and UseState, UseReducer types. |
@ilokesto/state/solid | Solid create() adapter and UseState, UseReducer types. |
@ilokesto/state/angular | Angular create() adapter and AngularOptions, UseState, UseReducer types. |
@ilokesto/state/middleware | Registered middleware, store disposal, and middleware types. |
@ilokesto/state/utils | The pipe builder, custom-middleware registration, configuration errors, and pipe types. |
@ilokesto/state/adaptor | adaptor; requires the optional immer peer. |
@ilokesto/state/package.json | Package metadata export for tooling that needs this package manifest. |
Middleware exports
@ilokesto/state/middleware exports debounce, throttle, devtools, dispose, history, HistoryConfigurationError, logger, persist, and validate.
Its public types are HistoryControls, HistoryOptions, HistoryStore, OnRehydrateStorage, OnRehydrateStorageCallback, PersistControls, PersistDecoder, PersistDecoderStateDiagnostic, PersistMigration, PersistStore, SafePersistConfig, SafePersistCookieConfig, SafePersistLocalConfig, and SafePersistSessionConfig.
Utility exports
@ilokesto/state/utils exports pipe, definePipeableMiddleware, and PipeConfigurationError.
Its public types are Pipe, PipeAnyMiddleware, PipeBuilder, PipeCapability, PipeConfigurationErrorCode, PipeDuplicatePolicy, PipeMiddleware, PipeMiddlewareConflictDiagnostic, and PipeMiddlewareMetadata.
Root and framework entrypoints
Import framework-neutral construction APIs from the root. Framework adapter APIs such as create, bind, and bindReducer come from a framework subpath, never the root.
// Available from the framework subpath
import { create } from '@ilokesto/state/react';
import { logger } from '@ilokesto/state/middleware';Use createStore or createReducer from the root and connect the result with bind or bindReducer from a framework subpath. See Vanilla state and binding and the migration guide.
Peer dependencies
Framework peers are optional: install only the adapter framework you use. immer is optional and only needed when you use adaptor from @ilokesto/state/adaptor.