/** * useData — THE keyed async read (docs/rfc-async.md rev 8). * * Every read has a key — data always has identity: * * useData(key, fn) → static key: SSR-transferable * useData(() => key, fn) → reactive key: string OR tuple; falsy ⇒ idle * useData(key, fn, {server:false}) → client-only (still keyed — there is * NO bare-fetcher form) * * The key does three jobs: reactive trigger, cache/SSR identity, fetcher * input. The fetcher runs UNTRACKED — only the key getter is reactive; a * parameter that should re-run the fetch belongs in the key. * * This module provides the default CLIENT semantics. Server renderers * install per-instance providers (`_useAsync` on the setup context) that * take over during SSR — the whole options bag passes through the seam * untouched (open interface: packs augment `AsyncOptions` and read their * own keys on the other side). */ import { type Falsy, type KeyTuple, type KeyValue, type ServerFnDataRef } from './async/key.js'; import { type AsyncState, type Fetcher } from './async/shared.js'; export type { Falsy, KeyTuple, KeyValue, ServerFnDataRef } from './async/key.js'; export type { AsyncFetcherContext, Fetcher, MatchArms, AsyncState } from './async/shared.js'; /** * OPEN interface — contains only options core actually reads. A pack * augments it (`declare module …`) so its options exist in the editor * exactly when the pack is installed; core passes the whole bag through the * provider seam untouched, and the default engine dev-warns on options no * installed plugin handles. */ export interface AsyncOptions { /** * Run the fetcher on the server. Default: true. `server: false` makes the * read client-only (SSR renders the pending arm; the client fetches after * hydration) — it keeps its key for dedupe and future cache coverage. */ server?: boolean; } /** Server-fn key (#452): data identity IS the fn — canonical key * `'["/"]'`, default fetcher `() => fn()`. */ export declare function useData(fn: ServerFnDataRef<[], R>, opts?: AsyncOptions): AsyncState>; /** Reactive server-fn tuple key: `() => [fn, ...args]`; falsy ⇒ idle. * Default fetcher `fn(...args)`; args are the fn's own parameters. */ export declare function useData(key: () => readonly [ServerFnDataRef, ...A] | Falsy, opts?: AsyncOptions): AsyncState>; /** Static key: runs on the server, serialized under `key`, restored on hydration. */ export declare function useData(key: string, fetcher: Fetcher, opts?: AsyncOptions): AsyncState; /** Reactive key: string or tuple; a falsy result skips the fetch (state 'idle'). */ export declare function useData(key: () => K | Falsy, fetcher: Fetcher, opts?: AsyncOptions): AsyncState; //# sourceMappingURL=use-data.d.ts.map