@praxisjs/store
Changelog for @praxisjs/store — global state management with @Storable and @Store.
@praxisjs/store
1.3.0
Plugin system — useStorePlugin, clearPlugins, and the StorePlugin interface. Plugins hook into store lifecycle via onInit, onMutation, onAction, and onActionDone. Works with both createStore (functional) and class-based @Storable stores. See the Plugins section for usage and built-in plugin recipes.
1.2.0
API rename — @Store() (class decorator) → @Storable(), @UseStore(Class) (field decorator) → @Store(Class), useStore() → store().
| Before | After |
|---|---|
@Store() on a class | @Storable() |
@UseStore(CartStore) on a field | @Store(CartStore) |
useStore(CartStore) imperatively | store(CartStore) |
import { Storable, Store, store, ReactiveStore } from '@praxisjs/store'
@Storable()
class CartStore extends ReactiveStore { /* ... */ }
// in a component:
@Store(CartStore) cart!: CartStore
// imperatively:
const cart = store(CartStore)1.1.0
Add store() — functional alternative to @Store for use outside component context (route guards, plain functions). Resolves from the same global registry as @Store and always returns the same singleton instance.
1.0.12
Updated dependencies — @praxisjs/[email protected], @praxisjs/[email protected].
1.0.11
Updated dependencies — @praxisjs/[email protected].
1.0.10
ReactiveStore base class introduced. Store classes must now extend ReactiveStore to satisfy the ReactiveHost constraint required by @State and @DeepState. A TypeScript error is produced at the call site if omitted — no more silent runtime failures.
1.0.0
Breaking — createStore() removed
createStore() is removed. Use @Storable and @Store:
// before
const store = createStore({ count: 0 })
// after
@Storable()
class CounterStore extends ReactiveStore {
@State() count = 0
}
// in a component:
@Store(CounterStore) counter!: CounterStore0.2.2
Bug fix: store Proxy set trap no longer throws TypeError when JavaScript internals write symbol keys (e.g. Symbol.toPrimitive).
0.2.0
Migrated to TC39 decorator context API.
0.1.0
Initial beta release.