@askrjs/askr
Exports from the declarations published in @askrjs/askr. Signatures reflect the published artifact.
Exports
This entrypoint publishes 53 exports. Use the anchored symbol rows for direct links. Type-only exports are labeled separately from runtime values.
AskrRuntimetype
AskrRuntime: typeof AskrRuntimeA scheduler + renderer host pairing; owns scheduling and renderer wiring for an app instance.
scheduler- readonly scheduler: Scheduler;
rendererHost- private rendererHost;
renderer- get renderer(): RuntimeRendererHost;
configureRenderer- configureRenderer(renderer: RuntimeRendererHost): void;
AskrRuntimeOptionstype
AskrRuntimeOptions: anyOptions for {@link createRuntime}.
scheduler- scheduler?: Scheduler;
renderer- renderer?: RuntimeRendererHost;
Casetype
Case: (props: CaseProps) => JSXElementRender the first matching {@link Match} child (by `when`), or `fallback` if none match.
CasePropstype
CaseProps: {
fallback?: BoundaryChild;
children?: unknown;
}Props for {@link Case}.
children- children?: unknown;
fallback- fallback?: RenderableChild;
configureRenderDiagnosticstype
configureRenderDiagnostics: (options: RenderDiagnosticsOptions) => () => voidConfigure development render diagnostics and return a function that restores the previous configuration. Component counters and timing remain enabled when warning output is disabled.
createQuerytype
createQuery: { <T extends {}>(options: QueryOptions<T>): Query<T>; <TInput, TResult extends {}>(definition: QueryDefinition<TInput, TResult>, input: TInput, options?: Omit<QueryOptions<TResult>, "key" | "fetch">): Query<TResult>; }Create a reactive {@link Query} cell bound to the current component, either from inline `options` (key + fetch) or a reusable {@link QueryDefinition} plus its input.
createQueryCollectiontype
createQueryCollection: <TInput, TResult extends {}, TKey extends QueryCollectionKey = string>(options: QueryCollectionOptions<TInput, TResult, TKey>) => QueryCollection<TInput, TResult, TKey>Create one lifecycle-owned collection of dynamically keyed readers for a reusable query definition, with bounded collection-started fetches.
createReftype
createRef: <T extends Element = Element>() => Ref<T>Create a new, empty {@link Ref} holder.
createRuntimetype
createRuntime: (options?: AskrRuntimeOptions) => AskrRuntimeCreate a new {@link AskrRuntime} instance with its own scheduler/renderer wiring.
cspNoncetype
cspNonce: () => string | undefinedRead the CSP nonce for the current render from {@link CspNonceScope}.
CspNonceScopetype
CspNonceScope: Scope<string | undefined>Lexical scope carrying the CSP nonce for the current render, if any.
DataRuntimetype
DataRuntime: anyIsolated cache/state container backing queries and mutations, e.g. one per test or request.
queryCache- readonly queryCache: Map<string, unknown>;
queryData- readonly queryData: Map<string, unknown>;
queryTestOverrides- Test-only query overrides keyed by the canonical query key.
mutationTestOverrides- Test-only mutation overrides keyed by the canonical mutation key.
defineQuerytype
defineQuery: <TInput, TResult extends {}>(definition: QueryDefinition<TInput, TResult>) => QueryDefinition<TInput, TResult>Freeze and return a reusable {@link QueryDefinition}.
defineScopetype
defineScope: <T>(defaultValue: T) => Scope<T>Create a new lexical {@link Scope} with `defaultValue`, readable via {@link readScope}.
defineServerQueriestype
defineServerQueries: (...entries: readonly ServerQueryEntry<any, any>[]) => ServerQueryRegistryBuild a {@link ServerQueryRegistry} from one or more {@link serveQuery} entries.
dehydrateDataRuntimetype
dehydrateDataRuntime: (runtime: DataRuntime) => Record<string, unknown>Extract a runtime's cached query data into a JSON-serializable snapshot, dropping non-serializable values.
derivetype
derive: { <TOut>(fn: () => TOut): Derived<TOut>; <TIn, TOut>(source: SnapshotSource<TIn> | TIn | (() => TIn), map: (value: TIn) => TOut): Derived<TOut | null>; }Creates a render-scoped derived value; must be called during component render.
Derivedtype
Derived: anyA reactive derived value produced by {@link derive}; call it to read the current result.
Fortype
For: <T, K extends string | number = string | number>(props: ForProps<T, K>) => JSXElementRender a keyed or indexed list, reconciling items by key instead of position.
ForPropstype
ForProps: KeyedForProps<T, K> | IndexedForProps<T>Props for {@link For}.
by- by?: ((item: T, index: number) => K) | undefined;
byIndex- byIndex?: true | undefined;
children- Row renderer. Parent reactive reads must use `selector()` or thunk props; closure-captured values are snapshotted when the row is created or reconciled; changing the parent source does not rerun an existing row.
each- each: ForEachSource<T>;
fallback- fallback?: RenderableChild;
Fragmenttype
Fragment: typeof FragmentThe element type marker for JSX fragments (`<>...</>`), groups children without a wrapper element.
getDefaultRuntimetype
getDefaultRuntime: () => AskrRuntimeGet the process-wide default {@link AskrRuntime}.
getSignaltype
getSignal: () => AbortSignalGet the abort signal for the current component. The signal is guaranteed to be aborted when: - Component unmounts - Navigation occurs (different route) - Parent is destroyed
hydrateDataRuntimetype
hydrateDataRuntime: (runtime: DataRuntime, data: unknown) => voidLoad a {@link dehydrateDataRuntime} snapshot back into a runtime's query cache.
jsxtype
jsx: { (type: EagerControlPrimitive, props: Props | null, key?: string | number): unknown; <TTag extends keyof KnownIntrinsicElementProps>(type: TTag, props: KnownIntrinsicElementProps[TTag] | null, key?: string | number): JSXElement; <TTag extends string>(type: Exclude<TTag, keyof KnownIntrinsicElementProps>, props: IntrinsicFallbackProps | null, key?: string | number): JSXElement; <TProps extends object>(type: (props: TProps) => unknown, props: TProps | null, key?: string | number): JSXElement; (type: symbol, props: Props | null, key?: string | number): JSXElement; }JSX factory for elements with a single or no child, used by the `jsxImportSource` transform.
jsxstype
jsxs: { (type: EagerControlPrimitive, props: Props | null, key?: string | number): unknown; <TTag extends keyof KnownIntrinsicElementProps>(type: TTag, props: KnownIntrinsicElementProps[TTag] | null, key?: string | number): JSXElement; <TTag extends string>(type: Exclude<TTag, keyof KnownIntrinsicElementProps>, props: IntrinsicFallbackProps | null, key?: string | number): JSXElement; <TProps extends object>(type: (props: TProps) => unknown, props: TProps | null, key?: string | number): JSXElement; (type: symbol, props: Props | null, key?: string | number): JSXElement; }JSX factory for elements with multiple static children, used by the `jsxImportSource` transform.
Matchtype
Match: (_props: MatchProps) => nullDeclares one branch of a {@link Case}; only valid as its direct child.
MatchPropstype
MatchProps: {
key?: string | number | null;
when: unknown;
children: MatchChild;
}Props for {@link Match}, valid only as a direct child of {@link Case}.
children- children: MatchChild;
key- key?: string | number | null | undefined;
when- when: unknown;
prefetchQuerytype
prefetchQuery: <TInput, TResult extends {}>(context: QueryPrefetchContext, query: QueryDefinition<TInput, TResult>, input: TInput) => Promise<boolean>Prefetch `query` with `input` into a {@link QueryPrefetchContext}'s runtime.
Propstype
Props: anyProps accepted by components and elements. Intentionally permissive but provides a single named type.
children- Optional children slot
key- Optional key for keyed lists (string | number | symbol for internal frames)
QueryCollectiontype
QueryCollection: anyAggregate reactive state for a lifecycle-owned dynamic query collection.
entries- readonly entries: readonly QueryCollectionEntry<TInput, TResult, TKey>[];
loading- readonly loading: boolean;
settled- readonly settled: boolean;
results- readonly results: ReadonlyMap<TKey, TResult>;
errors- readonly errors: ReadonlyMap<TKey, {}>;
get- get(key: TKey): QueryCollectionEntry<TInput, TResult, TKey> | undefined;
retry- retry(key: TKey): Promise<void>;
QueryCollectionEntrytype
QueryCollectionEntry: anyOne keyed input and its underlying cache-backed query reader.
key- readonly key: TKey;
input- readonly input: TInput;
query- readonly query: Query<TResult>;
QueryCollectionKeytype
QueryCollectionKey: string | number | symbolStable identity for one member of a {@link QueryCollection}.
QueryCollectionOptionstype
QueryCollectionOptions: anyOptions for {@link createQueryCollection}.
query- readonly query: QueryDefinition<TInput, TResult>;
inputs- readonly inputs: () => readonly TInput[];
key- readonly key: (input: TInput) => TKey;
concurrency- readonly concurrency?: number;
runtime- readonly runtime?: DataRuntime;
QueryDefinitiontype
QueryDefinition: anyReusable query definition for {@link defineQuery}: key, fetcher, and freshness checks.
key- readonly key: (input: TInput) => string;
fetch- readonly fetch: (context: TInput & { signal: AbortSignal; }) => Promise<TResult>;
isConsistent- readonly isConsistent?: (data: TResult) => boolean;
reconcile- readonly reconcile?: (data: TResult, context: { key: string; }) => Promise<boolean> | boolean;
QueryPrefetchContexttype
QueryPrefetchContext: anyContext passed to server prefetch callbacks, exposing a scoped `prefetch` helper.
runtime- readonly runtime: DataRuntime;
request- readonly request?: Request;
signal- readonly signal: AbortSignal;
mode- readonly mode: 'ssr' | 'spa';
prefetch- prefetch<TInput, TResult extends {}>(query: QueryDefinition<TInput, TResult>, input: TInput): Promise<boolean>;
readScopetype
readScope: <T>(context: Scope<T>) => TRead the current value of a {@link Scope} during component render or an async resource.
Reftype
Ref: anyCreates a stable holder for an intrinsic element ref. The renderer mutates `current` during commit and clears it during cleanup. Updating the holder never schedules a render.
current- current: T | null;
registerSSRStyletype
registerSSRStyle: (id: string, cssText: string) => voidRegister request-local CSS produced during SSR without importing the SSR renderer in clients.
RenderDiagnosticsOptionstype
RenderDiagnosticsOptions: anyslowRenderWarnings- Emit one warning per component instance when a render exceeds the threshold.
slowRenderThresholdMs- Slow-render threshold in milliseconds. The default is 5.
RuntimeKeyedReorderDecisiontype
RuntimeKeyedReorderDecision: anyDiagnostic breakdown of a keyed-list reorder decision, returned by {@link RuntimeRendererHost.isKeyedReorderFastPathEligible}.
useFastPath- useFastPath: boolean;
totalKeyed- totalKeyed: number;
totalChildren- totalChildren: number;
currentKeyCount- currentKeyCount: number;
moveCount- moveCount: number;
lisLen- lisLen: number;
hasPropChanges- hasPropChanges: boolean;
isWholeKeyedList- isWholeKeyedList: boolean;
RuntimeRendererHosttype
RuntimeRendererHost: anyThe renderer implementation an {@link AskrRuntime} delegates DOM evaluation and cleanup to.
evaluate- evaluate(node: unknown, target: Element | null, context?: object, retainedOwner?: ComponentInstance): void;
cleanupInstancesUnder- cleanupInstancesUnder(node: Node): void;
replaceComponentRange- replaceComponentRange(instance: ComponentInstance, result: unknown, host: Element | Comment): Node | null;
resolveChildScopeRange- resolveChildScopeRange?(scope: ChildScope): DOMRange | null;
teardownNodeSubtree- teardownNodeSubtree(root: Node): void;
populateKeyMapForElement- populateKeyMapForElement(parent: Element): void;
getKeyMapForElement- getKeyMapForElement(parent: Element): Map<string | number, Element> | undefined;
isKeyedReorderFastPathEligible- isKeyedReorderFastPathEligible(parent: Element, children: unknown[], oldKeyMap: Map<string | number, Element> | undefined): RuntimeKeyedReorderDecision;
markReactivePropsDirtySource- markReactivePropsDirtySource(source: ReadableSource<unknown>): void;
Scopetype
Scope: anyA lexical scope created by {@link defineScope}; render it as a provider component, read it with {@link readScope}.
key- readonly key: ContextKey;
defaultValue- readonly defaultValue: T;
selectortype
selector: <T>(source: () => T, equals?: SelectorEquals<T>) => Selector<T>Creates a render-scoped predicate for keyed membership in reactive list rows. Use this when a `<For>` child needs to compare each stable item with a changing selected value. Unlike a plain closure capture, the predicate subscribes the affected rows and updates them without rebuilding the list. Must be called during component render.
Selectortype
Selector: anyA fine-grained reactive membership check produced by {@link selector}.
serveQuerytype
serveQuery: <TInput, TResult extends {}>(query: QueryDefinition<TInput, TResult>, handler: ServerQueryHandler<TInput, TResult>) => ServerQueryEntry<TInput, TResult>Pair a {@link QueryDefinition} with the server-side handler that resolves it.
ServerQueryHandlertype
ServerQueryHandler: (context: {
input: TInput;
request?: Request;
signal: AbortSignal;
}) => Promise<TResult> | TResultServer-side handler that resolves a {@link QueryDefinition}'s data for `serveQuery`.
Showtype
Show: <T>(props: ShowProps<T>) => JSXElementConditionally render children based on `when`, narrowing truthy values for the render function form.
ShowPropstype
ShowProps: {
when: ShowSource<T>;
fallback?: BoundaryChild;
children: BoundaryChild | ((value: Truthy<T>) => BoundaryChild);
}Props for {@link Show}.
children- children: RenderableChild | ((value: Truthy<T>) => BoundaryChild);
fallback- fallback?: RenderableChild;
when- when: ShowSource<T>;
statetype
state: <T>(initialValue: T) => StateTuple<T>Creates a local state value for a component Optimized for: - O(1) read performance - Minimal allocation per state - Fast scheduler integration IMPORTANT: state() must be called during component render execution. It captures the current component instance from context. Calling outside a component function will throw an error.
```ts
// ✅ Correct: called during render
export function Counter() {
const [count, setCount] = state(0);
return { type: 'button', children: [count()] };
}
// ❌ Wrong: called outside component
const count = state(0);
export function BadComponent() {
return { type: 'div' };
}
```Statetype
State: anyState value holder - callable to read, has set method to update
const count = state(0);
count(); // read: 0
count.set(1); // write: triggers re-renderset- set(...args: StateSetterArgs<T>): void;
StateSettertype
StateSetter: (...args: StateSetterArgs<T>) => voidPublic setter type for state cells.
StateTupletype
StateTuple: [get: State<T>, set: StateSetter<T>] & State<T>Tuple-first state handle returned by `state()`.