import { DataStore, StoreState } from "./data-store.mjs"; import { AnyRouteContext, RouteContext } from "./context.mjs"; import { ReadableAtom } from "nanostores"; //#region src/stores.d.ts type PluginStores = Readonly>>; declare const REF_VALUE: unique symbol; /** Published store handle; apps see `$name`, other plugins resolve via {@link StoreRegistry}. */ type StoreRef = { readonly name: string; readonly [REF_VALUE]?: Value; }; declare function storeRef(name: string): StoreRef; type StoreRegistry = { get(ref: StoreRef): DataStore | undefined; }; type EffectTrigger = "data" | "write"; type StoreEffect = { readonly ref: StoreRef; readonly run: (state: never, ctx: AnyRouteContext) => void; readonly when: EffectTrigger; }; /** Defaults to `when: "data"` so pending/error flips do not re-run the effect. */ declare function effect(ref: StoreRef, run: (state: StoreState, ctx: RouteContext) => void, options?: { when?: EffectTrigger; }): StoreEffect; declare function currentData(ctx: AnyRouteContext, ref: StoreRef): Value | undefined; //#endregion export { EffectTrigger, PluginStores, StoreEffect, StoreRef, StoreRegistry, currentData, effect, storeRef };