import { EnqueueObject, EventObject, EventPayloadMap, ExtractEvents, Store, StoreAssigner, StoreLogicCreator, StoreSelectorsConfig, StoreContext, StoreConfig, StoreEffect, StoreSnapshot, StoreLogic, StoreTransition, SpecificStoreConfig, ResolveStoreContext, ResolveStoreEventPayloadMap, ResolveStoreEmittedPayloadMap, StandardSchemaMap } from "./types.js"; import type { StandardSchemaV1 } from "./schema.js"; export declare function createEnqueueObject(effects: StoreEffect[], trigger?: (event: EventObject) => void): EnqueueObject; export declare function assertNoInternalEventTypeCollisions(existingEventTypes: readonly string[] | undefined, internalEventTypes: readonly string[], extensionName: string): void; export declare function appendInternalEventTypes(existingEventTypes: readonly string[] | undefined, internalEventTypes: readonly string[], extensionName: string): readonly string[]; export type TransitionsFromEventPayloadMap = { [K in keyof TEventPayloadMap & string]?: StoreAssigner; }; /** * Creates a **store** that has its own internal state and can be sent events * that update its internal state based on transitions. * * @example * * ```ts * const store = createStore({ * context: { count: 0, name: 'Ada' }, * on: { * inc: (context, event: { by: number }) => ({ * ...context, * count: context.count + event.by * }) * } * }); * * store.subscribe((snapshot) => { * console.log(snapshot); * }); * * store.send({ type: 'inc', by: 5 }); * // Logs { context: { count: 5, name: 'Ada' }, status: 'active', ... } * ``` * * @param config - The store configuration object * @param config.context - The initial state of the store * @param config.schemas - Optional standard-schema definitions used as type * sources for context, events, and emitted events * @param config.on - An object mapping event types to transition functions * @returns A store instance with methods to send events and subscribe to state * changes */ export declare function createStore(definition: StoreConfig): Store, ResolveStoreEventPayloadMap, ExtractEvents>>; export declare function createStore(definition: SpecificStoreConfig | StoreLogic>, TEvent, TEmitted>): Store, { [E in TEvent as E['type']]: E; }, TEmitted>; export declare const createStoreConfig: { (definition: StoreConfig): StoreConfig; }; export declare function createStoreLogic> = StoreSelectorsConfig>>(config: Omit, 'context'> & { context: (input: TInput) => ResolveStoreContext; selectors: TSelectors; }): StoreLogicCreator, ResolveStoreEventPayloadMap, ExtractEvents>, TInput, TSelectors>; export declare function createStoreLogic(config: Omit, 'context'> & { context: (input: TInput) => ResolveStoreContext; }): StoreLogicCreator, ResolveStoreEventPayloadMap, ExtractEvents>, TInput, {}>; export declare function createStoreLogic> = {}>(config: StoreConfig & { selectors: TSelectors; }): StoreLogicCreator, ResolveStoreEventPayloadMap, ExtractEvents>, void, TSelectors>; export declare function createStoreLogic(config: StoreConfig): StoreLogicCreator, ResolveStoreEventPayloadMap, ExtractEvents>, void, {}>; declare global { interface SymbolConstructor { readonly observable: symbol; } } /** * Creates a store transition function that handles state updates based on * events. * * @param transitions - An object mapping event types to transition functions * @param producer - Optional producer function (e.g., Immer's produce) for * immutable updates * @returns A transition function that takes a snapshot and event and returns a * new snapshot with effects */ export declare function createStoreTransition(transitions: { [K in keyof TEventPayloadMap & string]?: StoreAssigner; }, producer?: (context: TContext, recipe: (context: TContext) => void) => TContext): StoreTransition, TEmitted>;