Reference
@reckona/mreact-store
30 public exports.
Function
FunctioncreateRequestStoreFactory
function createRequestStoreFactory<T, TPersisted>(initial: (): T, options?: StoreOptions<T, TPersisted>): (): Store<T>Creates a factory for per-request stores from an initial-state callback. Use this when SSR or server actions need isolated store instances instead of sharing process-global state.FunctioncreateStorefunction createStore<T, TPersisted>(initial: T, options: StoreOptions<T, TPersisted>): Store<T>Creates a reactive object store with patch updates, replacement, transactions, selectors, subscriptions, and optional instrumentation. The store keeps state in a `ReadonlyCell`; selectors should be disposed when their consumer scope ends.FunctionpersistedStoreStatefunction persistedStoreState<T>(state: T, version: number): StorePersistedState<T>Creates an unambiguous versioned persistence record for Store.load().FunctionshallowEqualfunction shallowEqual<T>(left: T, right: T): booleanCompares two plain objects by own enumerable keys with `Object.is` value equality. Both operands must be inert while the comparison runs. Own keys are captured once per call and values are read afterwards, so an accessor or proxy trap that adds or removes an own key on either operand during the call leaves the result unspecified.FunctionsnapshotStoreValuefunction snapshotStoreValue<T>(value: T): TCreates an independent supported-value snapshot without cloning ordinary Store reads.Interface
InterfaceLegacyStorePersistedState
interface LegacyStorePersistedStateRepresents the deprecated untagged persistence envelope accepted only with explicit opt-in.InterfaceReadonlyStoreinterface ReadonlyStoreProvides readonly, reference-stable reads and explicit snapshots for a Store.InterfaceSelectedCellinterface SelectedCellRepresents a selected reactive value that can be disposed manually.InterfaceStoreinterface StoreProvides reactive state access, updates, transactions, selectors, and subscriptions.InterfaceStoreCurrentPersistOptionsinterface StoreCurrentPersistOptionsConfigures raw or tagged persistence records without legacy envelope inference.InterfaceStoreInstrumentationEventinterface StoreInstrumentationEventDescribes one store instrumentation event emitted after a state change.InterfaceStoreLegacyPersistOptionsinterface StoreLegacyPersistOptionsConfigures persistence with explicit support for deprecated untagged envelopes.InterfaceStoreOptionsinterface StoreOptionsConfigures store instrumentation and persistence hooks.InterfaceStorePersistBaseOptionsinterface StorePersistBaseOptionsConfigures persistence behavior shared by current and legacy record contracts.InterfaceStorePersistedStateinterface StorePersistedStateInterfaceStorePersistenceinterface StorePersistenceInterfaceStorePersistenceFailureinterface StorePersistenceFailureDescribes an observable persistence failure.Type Alias
Type AliasReadonlyStoreValue
type ReadonlyStoreValue = T extends (...args: never[]): unknown ? T : T extends Date ? Readonly<T> : T extends RegExp ? Readonly<T> : T extends Map<..., ...> ? ReadonlyMap<..., ...> : ... extends ... ? ... : ...Recursively readonly view used by Store.view without cloning ordinary reads.Type AliasRejectThenabletype RejectThenable = [T] extends [never] ? [] : [Extract<T, ThenableLike>] extends [never] ? [] : [error: never]Type AliasStoreEqualitytype StoreEquality = (left: T, right: T): booleanCompares selected store values to decide whether subscribers should update.Type AliasStoreHydrationConflicttype StoreHydrationConflict = "merge" | "preserve-local" | "replace" | (loaded: T, current: T): TControls how hydration resolves a loaded value after local state has changed.Type AliasStoreListenertype StoreListener = (state: T, previous: T): voidReceives the next and previous store state after a committed change.Type AliasStorePatchtype StorePatch = Partial<T>Represents a partial object patch applied to store state.Type AliasStorePersisttype StorePersist = (state: T): void | Promise<void> | StorePersistOptions<T, TPersisted>Type AliasStorePersistenceFailurePhasetype StorePersistenceFailurePhase = "load" | "migrate" | "save"Identifies the persistence operation that failed.Type AliasStorePersistenceStatustype StorePersistenceStatus = "hydrating" | "ready" | "error"Type AliasStorePersistOptionstype StorePersistOptions = StoreCurrentPersistOptions<T, TPersisted> | StoreLegacyPersistOptions<T, TPersisted>Configures store persistence with an explicit current or legacy record contract.Type AliasStoreReplacertype StoreReplacer = T | (previous: T): TProvides either a replacement object or a replacement-producing updater callback.Type AliasStoreSettertype StoreSetter = StorePatch<T> | (previous: T): StorePatch<T> | TProvides either a patch object or a patch-producing updater callback.Type AliasThenableLiketype ThenableLike = unknown