@askrjs/askr 0.2.4 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/access-CEA2pOry.js +1046 -0
- package/dist/actions/index.d.ts +16 -2
- package/dist/actions/index.js +5 -5
- package/dist/{activity-FirwPXA_.js → activity-oy2YFTFF.js} +10 -16
- package/dist/benchmark.js +8 -9
- package/dist/boot/index.d.ts +19 -9
- package/dist/boot/index.js +1 -1
- package/dist/{boot-tWyF6121.js → boot-BMBMWUGI.js} +680 -441
- package/dist/capabilities-Bbf0mlp9.js +42 -0
- package/dist/components/index.d.ts +11 -8
- package/dist/components/index.js +1 -1
- package/dist/{compose-ref-Bfaf4kUC.js → compose-ref-v0qGlHoN.js} +7 -1
- package/dist/control/index.d.ts +20 -2
- package/dist/control/index.js +1 -1
- package/dist/{control-C-wSaq9V.js → control-BR_mrX__.js} +4 -4
- package/dist/core.d.ts +163 -0
- package/dist/csp-nonce-BfFWcd0w.js +173 -0
- package/dist/data/index.d.ts +74 -2
- package/dist/data/index.js +3 -3
- package/dist/{data-ghKopAbp.js → data-2edW0jhF.js} +108 -122
- package/dist/{data-runtime-7t_Y0iv3.js → data-runtime-CxoY98lX.js} +22 -15
- package/dist/{deferred-CxjWCkIn.js → deferred-CbgNhf67.js} +5 -5
- package/dist/dom-renderer.d.ts +77 -0
- package/dist/domains/actions.d.ts +70 -0
- package/dist/domains/component.d.ts +119 -0
- package/dist/domains/context.d.ts +73 -0
- package/dist/domains/control.d.ts +328 -0
- package/dist/domains/data.d.ts +461 -0
- package/dist/domains/diagnostics.d.ts +21 -0
- package/dist/domains/lifecycle.d.ts +112 -0
- package/dist/domains/refs.d.ts +18 -0
- package/dist/domains/renderer.d.ts +127 -0
- package/dist/domains/routing.d.ts +501 -0
- package/dist/domains/scheduler.d.ts +79 -0
- package/dist/domains/server.d.ts +112 -0
- package/dist/domains/state.d.ts +129 -0
- package/dist/domains/telemetry.d.ts +29 -0
- package/dist/eager-control.d.ts +8 -0
- package/dist/{effect-CNwstBBD.js → effect-C3Zsc1k6.js} +14 -41
- package/dist/{types-DWVrKn9N.d.ts → elements.d.ts} +79 -42
- package/dist/{for-internal-DyBHfKJA.js → for-state-BDykeOJL.js} +598 -494
- package/dist/foundations/icon/index.d.ts +67 -16
- package/dist/foundations/icon/index.js +1 -1
- package/dist/foundations/index.d.ts +26 -3
- package/dist/foundations/index.js +1 -1
- package/dist/foundations/interactions/index.d.ts +73 -34
- package/dist/foundations/interactions/index.js +1 -1
- package/dist/foundations/state/index.d.ts +12 -5
- package/dist/foundations/state/index.js +1 -1
- package/dist/foundations/structures/index.d.ts +44 -3
- package/dist/foundations/structures/index.js +1 -1
- package/dist/foundations/utilities/index.d.ts +34 -3
- package/dist/foundations/utilities/index.js +1 -1
- package/dist/fx/index.d.ts +72 -25
- package/dist/fx/index.js +8 -8
- package/dist/index.d.ts +121 -4
- package/dist/index.js +316 -47
- package/dist/{component-internal-C4hKKQBF.js → instance-VAFYVJOa.js} +495 -283
- package/dist/{interactions-D102JxBR.js → interactions-CTeACdT_.js} +1 -1
- package/dist/jsx-dev-runtime.d.ts +51 -11
- package/dist/jsx-globals.d.ts +2 -0
- package/dist/jsx-runtime-CPJXAOBF.js +43 -0
- package/dist/jsx-runtime.d.ts +17 -3
- package/dist/jsx-runtime.js +2 -42
- package/dist/jsx.d.ts +108 -0
- package/dist/{manifest-D6rfj_jC.js → manifest-D1P3UNWV.js} +4 -9
- package/dist/{navigate-ZZu1IV0B.js → navigate-prC5V8XV.js} +125 -472
- package/dist/{navigate-F4sHgWbw.d.ts → navigation.d.ts} +8 -8
- package/dist/{readable-Di1fzSwm.js → notify-DxxuDPeY.js} +96 -34
- package/dist/{query-registry-Bua3cDyb.js → query-registry-LrYpQsDJ.js} +1 -1
- package/dist/{compose-ref-DOJHoW5X.d.ts → refs.d.ts} +11 -7
- package/dist/{ssr-Doog-AfJ.js → render-resolved-BC0W7_5b.js} +165 -558
- package/dist/{renderer-Cl23O0hV.js → renderer-CT0HeY58.js} +6825 -5692
- package/dist/{resolution-ClD-K7Lz.js → resolution-3DskUkjG.js} +189 -180
- package/dist/{resource-operation-Vz1S5h2k.js → resource-18-sFRl9.js} +98 -58
- package/dist/resources/index.d.ts +64 -12
- package/dist/resources/index.js +214 -8
- package/dist/route-activity.d.ts +21 -0
- package/dist/{route-matching-Bo6UqG-5.js → route-matching-CUzZ31gT.js} +68 -82
- package/dist/router/index.d.ts +378 -79
- package/dist/router/index.js +9 -9
- package/dist/router-internal-7nuNEHfG.js +36 -0
- package/dist/scope-Cq_iYbTR.js +403 -0
- package/dist/{selector-CsKuomw0.js → selector-BSPVkjKP.js} +26 -27
- package/dist/{shared-CYBH3F8I.js → shared-kU8yvryp.js} +3 -6
- package/dist/{snapshot-source-BB42xgwb.js → snapshot-source-An4iKajG.js} +1 -1
- package/dist/ssg/index.d.ts +51 -15
- package/dist/ssg/index.js +269 -209
- package/dist/ssr/index.d.ts +121 -68
- package/dist/ssr/index.js +2 -1
- package/dist/ssr-CiNm6Vzl.js +393 -0
- package/dist/{ssr-DSHd_Q9K.js → ssr-EPjwJH5R.js} +5 -1
- package/dist/{state-BGJgYSyQ.js → state-BXJfudq1.js} +10 -15
- package/dist/{structures-DFyK5AdQ.js → structures-CjEzfj4h.js} +37 -57
- package/dist/{index-CTpMmzgN.d.ts → structures.d.ts} +57 -36
- package/dist/testing/index.d.ts +123 -24
- package/dist/testing/index.js +24 -61
- package/dist/timer-C7uqnJVt.js +85 -0
- package/dist/{index-B1gu0_m0.d.ts → utilities.d.ts} +24 -13
- package/dist/{verify-hydration-BZPJ_kYa.js → verify-hydration-ikaxotf7.js} +8 -5
- package/package.json +12 -14
- package/dist/access-BucjYZcX.js +0 -509
- package/dist/activity-DooIuxQO.d.ts +0 -14
- package/dist/benchmark.d.ts +0 -26
- package/dist/cleanup-TXSsApEl.js +0 -535
- package/dist/component-cleanup-jdbgjkT1.js +0 -143
- package/dist/component-scope-4I3yEMkb.js +0 -195
- package/dist/control-Cxag1yqV.d.ts +0 -8
- package/dist/csp-nonce-9NFUb7hJ.js +0 -72
- package/dist/css-BuPaTOfe.js +0 -70
- package/dist/fastlane-BKZduiBQ.js +0 -166
- package/dist/index-Dgjbo2gU.d.ts +0 -1456
- package/dist/jsx-runtime-Cg7GqY1S.d.ts +0 -2
- package/dist/jsx-runtime-gVIaTPw0.d.ts +0 -38
- package/dist/lifecycle-batch-63aXFf2S.js +0 -253
- package/dist/lifecycle-operations-Q0k3EFnG.js +0 -287
package/dist/index-Dgjbo2gU.d.ts
DELETED
|
@@ -1,1456 +0,0 @@
|
|
|
1
|
-
import { i as JSXElementType, r as JSXElement, s as Props } from "./types-DWVrKn9N.js";
|
|
2
|
-
import "./jsx-runtime-Cg7GqY1S.js";
|
|
3
|
-
import { AuthContext, AuthRequirement } from "@askrjs/auth";
|
|
4
|
-
import { InferSchema, ObjectSchema } from "@askrjs/schema";
|
|
5
|
-
//#region src/runtime/state.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* State value holder - callable to read, has set method to update
|
|
8
|
-
* @example
|
|
9
|
-
* const count = state(0);
|
|
10
|
-
* count(); // read: 0
|
|
11
|
-
* count.set(1); // write: triggers re-render
|
|
12
|
-
*/
|
|
13
|
-
interface State<T> extends ReadableSource<T> {
|
|
14
|
-
(): T;
|
|
15
|
-
set(...args: StateSetterArgs<T>): void;
|
|
16
|
-
[Symbol.iterator](): IterableIterator<StateTuple<T>[number]>;
|
|
17
|
-
}
|
|
18
|
-
type StateUpdater<T> = (prev: T) => T;
|
|
19
|
-
type StateSetterArgs<T> = [Extract<T, (...args: any[]) => unknown>] extends [never] ? [value: T] | [updater: StateUpdater<T>] : [updater: StateUpdater<T>];
|
|
20
|
-
/**
|
|
21
|
-
* Public setter type for state cells.
|
|
22
|
-
*/
|
|
23
|
-
type StateSetter<T> = (...args: StateSetterArgs<T>) => void;
|
|
24
|
-
/**
|
|
25
|
-
* Tuple-first state handle returned by `state()`.
|
|
26
|
-
*/
|
|
27
|
-
type StateTuple<T> = [get: State<T>, set: StateSetter<T>] & State<T>;
|
|
28
|
-
/**
|
|
29
|
-
* Creates a local state value for a component
|
|
30
|
-
* Optimized for:
|
|
31
|
-
* - O(1) read performance
|
|
32
|
-
* - Minimal allocation per state
|
|
33
|
-
* - Fast scheduler integration
|
|
34
|
-
*
|
|
35
|
-
* IMPORTANT: state() must be called during component render execution.
|
|
36
|
-
* It captures the current component instance from context.
|
|
37
|
-
* Calling outside a component function will throw an error.
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```ts
|
|
41
|
-
* // ✅ Correct: called during render
|
|
42
|
-
* export function Counter() {
|
|
43
|
-
* const [count, setCount] = state(0);
|
|
44
|
-
* return { type: 'button', children: [count()] };
|
|
45
|
-
* }
|
|
46
|
-
*
|
|
47
|
-
* // ❌ Wrong: called outside component
|
|
48
|
-
* const count = state(0);
|
|
49
|
-
* export function BadComponent() {
|
|
50
|
-
* return { type: 'div' };
|
|
51
|
-
* }
|
|
52
|
-
* ```
|
|
53
|
-
*/
|
|
54
|
-
declare function state<T>(initialValue: T): StateTuple<T>;
|
|
55
|
-
//#endregion
|
|
56
|
-
//#region src/common/ssr.d.ts
|
|
57
|
-
/**
|
|
58
|
-
* Common call contracts: SSR types
|
|
59
|
-
*/
|
|
60
|
-
/** Arbitrary serializable data attached to an SSR render pass (e.g. loader output). */
|
|
61
|
-
type SSRData = Record<string, unknown>;
|
|
62
|
-
/** Styles produced while rendering a request, kept with that request's SSR context. */
|
|
63
|
-
interface SSRStyleRegistration {
|
|
64
|
-
id: string;
|
|
65
|
-
cssText: string;
|
|
66
|
-
}
|
|
67
|
-
interface DocumentRenderRoute {
|
|
68
|
-
path: string;
|
|
69
|
-
namespace?: string;
|
|
70
|
-
}
|
|
71
|
-
/** Request/render metadata passed to a {@link DocumentRenderer}. */
|
|
72
|
-
interface DocumentRenderContext {
|
|
73
|
-
mode: 'ssr' | 'ssg';
|
|
74
|
-
url: string;
|
|
75
|
-
pathname: string;
|
|
76
|
-
search: string;
|
|
77
|
-
hash: string;
|
|
78
|
-
params: Record<string, string>;
|
|
79
|
-
data?: SSRData;
|
|
80
|
-
seed: number;
|
|
81
|
-
route: DocumentRenderRoute;
|
|
82
|
-
cspNonce?: string;
|
|
83
|
-
styles?: readonly SSRStyleRegistration[];
|
|
84
|
-
}
|
|
85
|
-
/** Arguments passed to a {@link DocumentRenderer}: the rendered app HTML and its context. */
|
|
86
|
-
interface DocumentRenderArgs {
|
|
87
|
-
appHtml: string;
|
|
88
|
-
context: DocumentRenderContext;
|
|
89
|
-
}
|
|
90
|
-
/** Wraps rendered app HTML in a full document (`<html>`, `<head>`, etc.) for SSR/SSG output. */
|
|
91
|
-
type DocumentRenderer = (args: DocumentRenderArgs) => string;
|
|
92
|
-
/** How to react when SSR styles were registered but not included in the rendered document. */
|
|
93
|
-
type SSRStyleRegistrationValidation = 'warn' | 'error' | 'off';
|
|
94
|
-
/** Full context for sink-based streaming SSR */
|
|
95
|
-
type SSRContext = {
|
|
96
|
-
url: string;
|
|
97
|
-
seed: number;
|
|
98
|
-
data?: SSRData;
|
|
99
|
-
params?: Record<string, string>;
|
|
100
|
-
signal?: AbortSignal;
|
|
101
|
-
};
|
|
102
|
-
//#endregion
|
|
103
|
-
//#region src/common/vnode.d.ts
|
|
104
|
-
interface DOMElement {
|
|
105
|
-
type: JSXElementType;
|
|
106
|
-
props?: Props;
|
|
107
|
-
children?: VNode[];
|
|
108
|
-
key?: string | number | null;
|
|
109
|
-
[Symbol.iterator]?: never;
|
|
110
|
-
_controlState?: ControlBoundaryState;
|
|
111
|
-
}
|
|
112
|
-
type VNode = DOMElement | string | number | boolean | null | undefined;
|
|
113
|
-
type RenderableChild = VNode | JSXElement | readonly RenderableChild[];
|
|
114
|
-
//#endregion
|
|
115
|
-
//#region src/common/component.d.ts
|
|
116
|
-
type ComponentContext = {
|
|
117
|
-
signal: AbortSignal;
|
|
118
|
-
ssr?: SSRContext;
|
|
119
|
-
};
|
|
120
|
-
type ComponentFunction = (props: Props, context?: ComponentContext) => JSXElement | VNode;
|
|
121
|
-
//#endregion
|
|
122
|
-
//#region src/runtime/context.d.ts
|
|
123
|
-
type ContextKey = symbol;
|
|
124
|
-
type Renderable = RenderableChild;
|
|
125
|
-
type ContextScopeChildren = Renderable | (() => Renderable);
|
|
126
|
-
/** A lexical scope created by {@link defineScope}; render it as a provider component, read it with {@link readScope}. */
|
|
127
|
-
interface Scope<T> {
|
|
128
|
-
(props: {
|
|
129
|
-
value: T;
|
|
130
|
-
children?: ContextScopeChildren;
|
|
131
|
-
}): JSXElement;
|
|
132
|
-
readonly key: ContextKey;
|
|
133
|
-
readonly defaultValue: T;
|
|
134
|
-
}
|
|
135
|
-
interface ContextFrame {
|
|
136
|
-
parent: ContextFrame | null;
|
|
137
|
-
values: Map<ContextKey, unknown> | null;
|
|
138
|
-
}
|
|
139
|
-
/** Create a new lexical {@link Scope} with `defaultValue`, readable via {@link readScope}. */
|
|
140
|
-
declare function defineScope<T>(defaultValue: T): Scope<T>;
|
|
141
|
-
/** Read the current value of a {@link Scope} during component render or an async resource. */
|
|
142
|
-
declare function readScope<T>(context: Scope<T>): T;
|
|
143
|
-
//#endregion
|
|
144
|
-
//#region src/runtime/component-cleanup.d.ts
|
|
145
|
-
type OwnedChildScope = {
|
|
146
|
-
key: string | number;
|
|
147
|
-
dispose(): void;
|
|
148
|
-
};
|
|
149
|
-
//#endregion
|
|
150
|
-
//#region src/data/types.d.ts
|
|
151
|
-
/** Freshness classification for a {@link Query}'s current data. */
|
|
152
|
-
type QueryConsistency = 'fresh' | 'stale' | 'refreshing' | 'pending-write';
|
|
153
|
-
/** Why a {@link Query} is stale. */
|
|
154
|
-
type QueryStaleReason = 'aborted' | 'error' | 'inconsistent';
|
|
155
|
-
/** Isolated cache/state container backing queries and mutations, e.g. one per test or request. */
|
|
156
|
-
interface DataRuntime {
|
|
157
|
-
readonly queryCache: Map<string, unknown>;
|
|
158
|
-
readonly queryData: Map<string, unknown>;
|
|
159
|
-
/** Test-only query overrides keyed by the canonical query key. */
|
|
160
|
-
readonly queryTestOverrides: Map<string, unknown>;
|
|
161
|
-
/** Test-only mutation overrides keyed by the canonical mutation key. */
|
|
162
|
-
readonly mutationTestOverrides: Map<string, unknown>;
|
|
163
|
-
}
|
|
164
|
-
/** Options for {@link createDataRuntime}. */
|
|
165
|
-
interface DataRuntimeOptions {
|
|
166
|
-
queryCache?: Map<string, unknown>;
|
|
167
|
-
queryData?: Map<string, unknown>;
|
|
168
|
-
queryTestOverrides?: Map<string, unknown>;
|
|
169
|
-
mutationTestOverrides?: Map<string, unknown>;
|
|
170
|
-
}
|
|
171
|
-
/** Reusable query definition for {@link defineQuery}: key, fetcher, and freshness checks. */
|
|
172
|
-
interface QueryDefinition<TInput, TResult extends {}> {
|
|
173
|
-
readonly key: (input: TInput) => string;
|
|
174
|
-
readonly fetch: (context: TInput & {
|
|
175
|
-
signal: AbortSignal;
|
|
176
|
-
}) => Promise<TResult>;
|
|
177
|
-
readonly isConsistent?: (data: TResult) => boolean;
|
|
178
|
-
readonly reconcile?: (data: TResult, context: {
|
|
179
|
-
key: string;
|
|
180
|
-
}) => Promise<boolean> | boolean;
|
|
181
|
-
}
|
|
182
|
-
/** Stable identity for one member of a {@link QueryCollection}. */
|
|
183
|
-
type QueryCollectionKey = string | number | symbol;
|
|
184
|
-
/** One keyed input and its underlying cache-backed query reader. */
|
|
185
|
-
interface QueryCollectionEntry<TInput, TResult extends {}, TKey extends QueryCollectionKey = string> {
|
|
186
|
-
readonly key: TKey;
|
|
187
|
-
readonly input: TInput;
|
|
188
|
-
readonly query: Query<TResult>;
|
|
189
|
-
}
|
|
190
|
-
/** Options for {@link createQueryCollection}. */
|
|
191
|
-
interface QueryCollectionOptions<TInput, TResult extends {}, TKey extends QueryCollectionKey = string> {
|
|
192
|
-
readonly query: QueryDefinition<TInput, TResult>;
|
|
193
|
-
readonly inputs: () => readonly TInput[];
|
|
194
|
-
readonly key: (input: TInput) => TKey;
|
|
195
|
-
readonly concurrency?: number;
|
|
196
|
-
readonly runtime?: DataRuntime;
|
|
197
|
-
}
|
|
198
|
-
/** Aggregate reactive state for a lifecycle-owned dynamic query collection. */
|
|
199
|
-
interface QueryCollection<TInput, TResult extends {}, TKey extends QueryCollectionKey = string> {
|
|
200
|
-
readonly entries: readonly QueryCollectionEntry<TInput, TResult, TKey>[];
|
|
201
|
-
readonly loading: boolean;
|
|
202
|
-
readonly settled: boolean;
|
|
203
|
-
readonly results: ReadonlyMap<TKey, TResult>;
|
|
204
|
-
readonly errors: ReadonlyMap<TKey, {}>;
|
|
205
|
-
get(key: TKey): QueryCollectionEntry<TInput, TResult, TKey> | undefined;
|
|
206
|
-
retry(key: TKey): Promise<void>;
|
|
207
|
-
}
|
|
208
|
-
/** Context passed to server prefetch callbacks, exposing a scoped `prefetch` helper. */
|
|
209
|
-
interface QueryPrefetchContext {
|
|
210
|
-
readonly runtime: DataRuntime;
|
|
211
|
-
readonly request?: Request;
|
|
212
|
-
readonly signal: AbortSignal;
|
|
213
|
-
readonly mode: 'ssr' | 'spa';
|
|
214
|
-
prefetch<TInput, TResult extends {}>(query: QueryDefinition<TInput, TResult>, input: TInput): Promise<boolean>;
|
|
215
|
-
}
|
|
216
|
-
/** Server-side handler that resolves a {@link QueryDefinition}'s data for `serveQuery`. */
|
|
217
|
-
type ServerQueryHandler<TInput, TResult extends {}> = (context: {
|
|
218
|
-
input: TInput;
|
|
219
|
-
request?: Request;
|
|
220
|
-
signal: AbortSignal;
|
|
221
|
-
}) => Promise<TResult> | TResult;
|
|
222
|
-
/** Options for {@link invalidate} and {@link QueryScope.invalidate}. */
|
|
223
|
-
interface InvalidateOptions {
|
|
224
|
-
markPendingWrite?: boolean;
|
|
225
|
-
runtime?: DataRuntime;
|
|
226
|
-
}
|
|
227
|
-
/** Options for {@link invalidateOnInterval}. */
|
|
228
|
-
interface InvalidateOnIntervalOptions extends InvalidateOptions {
|
|
229
|
-
intervalMs: number;
|
|
230
|
-
activeOn?: string | readonly string[];
|
|
231
|
-
visibleOnly?: boolean;
|
|
232
|
-
focusedOnly?: boolean;
|
|
233
|
-
}
|
|
234
|
-
/** A JSON-serializable value usable as part of a query key or invalidation prefix. */
|
|
235
|
-
type QueryKeyPart = string | number | boolean | null | undefined | readonly QueryKeyPart[] | {
|
|
236
|
-
readonly [key: string]: QueryKeyPart;
|
|
237
|
-
};
|
|
238
|
-
/** Namespaced key-building and invalidation helper returned by {@link queryScope}. */
|
|
239
|
-
interface QueryScope {
|
|
240
|
-
key(...parts: QueryKeyPart[]): string;
|
|
241
|
-
prefix(...parts: QueryKeyPart[]): string;
|
|
242
|
-
invalidate(parts: readonly QueryKeyPart[], options?: InvalidateOptions): void;
|
|
243
|
-
}
|
|
244
|
-
type QueryControls = {
|
|
245
|
-
refresh(): Promise<void>;
|
|
246
|
-
};
|
|
247
|
-
type QueryLoading = {
|
|
248
|
-
data: null;
|
|
249
|
-
error: null;
|
|
250
|
-
loading: true;
|
|
251
|
-
refreshing: false;
|
|
252
|
-
stale: false;
|
|
253
|
-
consistency: 'fresh';
|
|
254
|
-
staleReason: null;
|
|
255
|
-
};
|
|
256
|
-
type QueryFresh<T> = {
|
|
257
|
-
data: T;
|
|
258
|
-
error: null;
|
|
259
|
-
loading: false;
|
|
260
|
-
refreshing: false;
|
|
261
|
-
stale: false;
|
|
262
|
-
consistency: 'fresh';
|
|
263
|
-
staleReason: null;
|
|
264
|
-
};
|
|
265
|
-
type QueryRefreshing<T> = {
|
|
266
|
-
data: T;
|
|
267
|
-
error: null;
|
|
268
|
-
loading: false;
|
|
269
|
-
refreshing: true;
|
|
270
|
-
stale: true;
|
|
271
|
-
consistency: 'refreshing';
|
|
272
|
-
staleReason: null;
|
|
273
|
-
};
|
|
274
|
-
type QueryPendingWrite<T> = {
|
|
275
|
-
data: T;
|
|
276
|
-
error: null;
|
|
277
|
-
loading: false;
|
|
278
|
-
refreshing: true;
|
|
279
|
-
stale: true;
|
|
280
|
-
consistency: 'pending-write';
|
|
281
|
-
staleReason: null;
|
|
282
|
-
};
|
|
283
|
-
type QueryStaleValue<T> = {
|
|
284
|
-
data: T;
|
|
285
|
-
error: null;
|
|
286
|
-
loading: false;
|
|
287
|
-
refreshing: false;
|
|
288
|
-
stale: true;
|
|
289
|
-
consistency: 'stale';
|
|
290
|
-
staleReason: 'aborted' | 'inconsistent';
|
|
291
|
-
};
|
|
292
|
-
type QueryStaleErrorWithValue<T> = {
|
|
293
|
-
data: T;
|
|
294
|
-
error: {};
|
|
295
|
-
loading: false;
|
|
296
|
-
refreshing: false;
|
|
297
|
-
stale: true;
|
|
298
|
-
consistency: 'stale';
|
|
299
|
-
staleReason: 'error';
|
|
300
|
-
};
|
|
301
|
-
type QueryStaleError = {
|
|
302
|
-
data: null;
|
|
303
|
-
error: {};
|
|
304
|
-
loading: false;
|
|
305
|
-
refreshing: false;
|
|
306
|
-
stale: true;
|
|
307
|
-
consistency: 'stale';
|
|
308
|
-
staleReason: 'error';
|
|
309
|
-
};
|
|
310
|
-
/** Reactive read state for a query cell: data, loading/refresh flags, and freshness. */
|
|
311
|
-
type Query<T extends {}> = QueryControls & (QueryLoading | QueryFresh<T> | QueryRefreshing<T> | QueryPendingWrite<T> | QueryStaleValue<T> | QueryStaleErrorWithValue<T> | QueryStaleError);
|
|
312
|
-
type MutationControls<TInput, TResult> = {
|
|
313
|
-
execute(input: TInput): Promise<TResult>;
|
|
314
|
-
abort(): void;
|
|
315
|
-
reset(): void;
|
|
316
|
-
};
|
|
317
|
-
type MutationIdle = {
|
|
318
|
-
status: 'idle';
|
|
319
|
-
pending: false;
|
|
320
|
-
error: null;
|
|
321
|
-
result: null;
|
|
322
|
-
};
|
|
323
|
-
type MutationPending = {
|
|
324
|
-
status: 'pending';
|
|
325
|
-
pending: true;
|
|
326
|
-
error: null;
|
|
327
|
-
result: null;
|
|
328
|
-
};
|
|
329
|
-
type MutationSuccess<TResult> = {
|
|
330
|
-
status: 'success';
|
|
331
|
-
pending: false;
|
|
332
|
-
error: null;
|
|
333
|
-
result: TResult;
|
|
334
|
-
};
|
|
335
|
-
type MutationError = {
|
|
336
|
-
status: 'error';
|
|
337
|
-
pending: false;
|
|
338
|
-
error: {};
|
|
339
|
-
result: null;
|
|
340
|
-
};
|
|
341
|
-
/** Reactive state for a mutation cell: status, error/result, and execute/abort/reset controls. */
|
|
342
|
-
type Mutation<TInput, TResult> = MutationControls<TInput, TResult> & (MutationIdle | MutationPending | MutationSuccess<TResult> | MutationError);
|
|
343
|
-
type QueryOptions<T> = {
|
|
344
|
-
key: string;
|
|
345
|
-
fetch: (ctx: {
|
|
346
|
-
signal: AbortSignal;
|
|
347
|
-
}) => Promise<T>;
|
|
348
|
-
isConsistent?: (data: T) => boolean;
|
|
349
|
-
reconcile?: (data: T, ctx: {
|
|
350
|
-
key: string;
|
|
351
|
-
}) => Promise<boolean> | boolean;
|
|
352
|
-
runtime?: DataRuntime;
|
|
353
|
-
initialData?: T;
|
|
354
|
-
skipInitialFetch?: boolean;
|
|
355
|
-
};
|
|
356
|
-
/** Options for {@link createMutation}. */
|
|
357
|
-
type MutationOptions<TInput, TResult> = {
|
|
358
|
-
/** Stable identity used by runtime-scoped mutation test overrides. */
|
|
359
|
-
key?: string;
|
|
360
|
-
action: (input: TInput, ctx: {
|
|
361
|
-
signal: AbortSignal;
|
|
362
|
-
}) => Promise<TResult>;
|
|
363
|
-
affects?: (input: TInput, result: TResult) => string[];
|
|
364
|
-
afterSuccess?: 'invalidate';
|
|
365
|
-
runtime?: DataRuntime;
|
|
366
|
-
};
|
|
367
|
-
//#endregion
|
|
368
|
-
//#region src/common/telemetry.d.ts
|
|
369
|
-
interface TelemetryFields {
|
|
370
|
-
requestId?: string;
|
|
371
|
-
traceId?: string;
|
|
372
|
-
route?: string;
|
|
373
|
-
action?: string;
|
|
374
|
-
operation?: string;
|
|
375
|
-
status?: number;
|
|
376
|
-
durationMs?: number;
|
|
377
|
-
}
|
|
378
|
-
type TelemetrySpan = <T>(fields: TelemetryFields, work: () => T) => T;
|
|
379
|
-
/**
|
|
380
|
-
* Structural subset implemented by `createTelemetry()` from `@askrjs/otel`.
|
|
381
|
-
* Core does not install an OpenTelemetry SDK, backend, or exporter.
|
|
382
|
-
*/
|
|
383
|
-
interface CoreTelemetry {
|
|
384
|
-
routeMatch?: TelemetrySpan;
|
|
385
|
-
loader?: TelemetrySpan;
|
|
386
|
-
queryPrefetch?: TelemetrySpan;
|
|
387
|
-
ssrRender?: TelemetrySpan;
|
|
388
|
-
}
|
|
389
|
-
//#endregion
|
|
390
|
-
//#region src/common/router.d.ts
|
|
391
|
-
/**
|
|
392
|
-
* Common call contracts: Router types
|
|
393
|
-
*/
|
|
394
|
-
/** Path parameters captured for a matched route, keyed by parameter name. */
|
|
395
|
-
type RouteParams = Record<string, string>;
|
|
396
|
-
type StripRoutePathSuffix<Path extends string> = Path extends `${infer Base}?${string}` ? StripRoutePathSuffix<Base> : Path extends `${infer Base}#${string}` ? StripRoutePathSuffix<Base> : Path;
|
|
397
|
-
type TrimRoutePathSlashes<Path extends string> = Path extends `/${infer Rest}` ? TrimRoutePathSlashes<Rest> : Path extends `${infer Rest}/` ? TrimRoutePathSlashes<Rest> : Path;
|
|
398
|
-
type TrimRoutePathWhitespace<Path extends string> = Path extends `${' ' | '\n' | '\t' | '\r'}${infer Rest}` ? TrimRoutePathWhitespace<Rest> : Path extends `${infer Rest}${' ' | '\n' | '\t' | '\r'}` ? TrimRoutePathWhitespace<Rest> : Path;
|
|
399
|
-
type ExtractRouteSegmentParam<Segment extends string> = Segment extends `{${infer Param}}` ? TrimRoutePathWhitespace<Param> extends `*${infer SplatParam}` ? TrimRoutePathWhitespace<SplatParam> extends '' ? never : TrimRoutePathWhitespace<SplatParam> extends '*' ? never : TrimRoutePathWhitespace<SplatParam> : TrimRoutePathWhitespace<Param> extends '' ? never : TrimRoutePathWhitespace<Param> : Segment extends '*' ? '*' : never;
|
|
400
|
-
type ExtractRoutePathParamNames<Path extends string> = TrimRoutePathSlashes<StripRoutePathSuffix<Path>> extends `${infer Segment}/${infer Rest}` ? ExtractRouteSegmentParam<Segment> | ExtractRoutePathParamNames<Rest> : ExtractRouteSegmentParam<TrimRoutePathSlashes<StripRoutePathSuffix<Path>>>;
|
|
401
|
-
/** Statically infers the param record shape from a route path string literal, e.g. `/posts/{id}`. */
|
|
402
|
-
type RoutePathParams<Path extends string> = [ExtractRoutePathParamNames<Path>] extends [never] ? Record<never, string> : { [Key in ExtractRoutePathParamNames<Path>]: string; };
|
|
403
|
-
/**
|
|
404
|
-
* A route page component: a regular component that receives route params as
|
|
405
|
-
* props derived from the URL pattern.
|
|
406
|
-
*
|
|
407
|
-
* Components may accept no params at all — zero-argument components are still
|
|
408
|
-
* assignable.
|
|
409
|
-
*/
|
|
410
|
-
type RouteComponent<TParams extends RouteParams = RouteParams> = (props: TParams) => RenderableChild;
|
|
411
|
-
/** The rendering mode a route is currently being evaluated under. */
|
|
412
|
-
type RouteMode = 'spa' | 'ssr' | 'ssg';
|
|
413
|
-
type AccessRedirectStatus = 301 | 302 | 303 | 307 | 308;
|
|
414
|
-
type AccessDenyStatus = 401 | 403 | 404;
|
|
415
|
-
interface AccessAllowDecision {
|
|
416
|
-
kind: 'allow';
|
|
417
|
-
}
|
|
418
|
-
/** Policy decision produced by {@link redirect}: sends the visitor to another URL. */
|
|
419
|
-
interface AccessRedirectDecision {
|
|
420
|
-
kind: 'redirect';
|
|
421
|
-
to: string;
|
|
422
|
-
status?: AccessRedirectStatus;
|
|
423
|
-
replace?: boolean;
|
|
424
|
-
}
|
|
425
|
-
/** Policy decision produced by {@link deny}/{@link unauthorized}/{@link forbidden}/{@link notFound}. */
|
|
426
|
-
interface AccessDenyDecision {
|
|
427
|
-
kind: 'deny';
|
|
428
|
-
status: AccessDenyStatus;
|
|
429
|
-
}
|
|
430
|
-
/** Outcome of a {@link RoutePolicy} evaluation: allow, redirect, or deny. */
|
|
431
|
-
type AccessDecision = AccessAllowDecision | AccessRedirectDecision | AccessDenyDecision;
|
|
432
|
-
/** Context passed to route policies, auth resolvers, and loaders. */
|
|
433
|
-
interface RouteContext<TParams extends RouteParams = RouteParams> {
|
|
434
|
-
mode: RouteMode;
|
|
435
|
-
params: TParams;
|
|
436
|
-
pathname: string;
|
|
437
|
-
search: string;
|
|
438
|
-
hash: string;
|
|
439
|
-
href: string;
|
|
440
|
-
auth: AuthContext;
|
|
441
|
-
signal: AbortSignal;
|
|
442
|
-
}
|
|
443
|
-
/** A route access-control check, evaluated against {@link RouteContext} to produce an {@link AccessDecision}. */
|
|
444
|
-
type RoutePolicy = (context: RouteContext) => AccessDecision | PromiseLike<AccessDecision>;
|
|
445
|
-
/** Resolves the {@link AuthContext} for a route request. */
|
|
446
|
-
type RouteAuthResolver = (context: Omit<RouteContext, 'auth'>) => AuthContext | PromiseLike<AuthContext>;
|
|
447
|
-
/** Auth configuration shared across a route registry or a single route. */
|
|
448
|
-
interface RouteAuthOptions {
|
|
449
|
-
resolve: RouteAuthResolver;
|
|
450
|
-
loginPath?: string | ((context: RouteContext) => string | PromiseLike<string>);
|
|
451
|
-
authenticatedRedirectTo?: string | ((context: RouteContext) => string | PromiseLike<string>);
|
|
452
|
-
}
|
|
453
|
-
interface CommonAccessOptions {
|
|
454
|
-
auth?: AuthRequirement;
|
|
455
|
-
policies?: readonly RoutePolicy[];
|
|
456
|
-
}
|
|
457
|
-
/** A route's metadata, or a function computing it from the resolved context. */
|
|
458
|
-
type RouteMetaSource<TParams extends RouteParams = RouteParams> = RouteMeta | ((context: RouteContext<TParams>) => RouteMeta | PromiseLike<RouteMeta>);
|
|
459
|
-
/**
|
|
460
|
-
* Options for `route()` declarations.
|
|
461
|
-
*
|
|
462
|
-
* - `loader`: server data loader called before render, result passed as SSR data
|
|
463
|
-
* - `entries`: SSG entry generator — returns one param map per static page
|
|
464
|
-
* - `title`: page title hint used by SSG and document-meta integrations
|
|
465
|
-
* - `namespace`: MFE namespace key for grouped route management
|
|
466
|
-
*/
|
|
467
|
-
interface RouteOptions<TParams extends RouteParams = RouteParams, TSearchSchema extends ObjectSchema<RouteSearch> | undefined = ObjectSchema<RouteSearch> | undefined, TLoaderData = unknown, TDehydratedData = TLoaderData> extends CommonAccessOptions {
|
|
468
|
-
loader?: (context: RouteContext<TParams> & {
|
|
469
|
-
request?: Request;
|
|
470
|
-
}) => TLoaderData | PromiseLike<TLoaderData>;
|
|
471
|
-
/**
|
|
472
|
-
* Select the loader data transported to the browser for initial hydration.
|
|
473
|
-
*
|
|
474
|
-
* Server rendering still receives the complete loader value. The selector
|
|
475
|
-
* must be synchronous; client navigations rerun the loader and receive its
|
|
476
|
-
* complete result.
|
|
477
|
-
*/
|
|
478
|
-
dehydrate?: (data: TLoaderData, context: RouteContext<TParams> & {
|
|
479
|
-
request?: Request;
|
|
480
|
-
}) => TDehydratedData extends PromiseLike<unknown> ? never : TDehydratedData;
|
|
481
|
-
preload?: (context: RouteContext<TParams> & {
|
|
482
|
-
request?: Request;
|
|
483
|
-
data: QueryPrefetchContext;
|
|
484
|
-
}) => unknown;
|
|
485
|
-
entries?: () => Array<TParams> | Promise<Array<TParams>>;
|
|
486
|
-
/** Optional invalidation keys used by incremental SSG generation. */
|
|
487
|
-
invalidationKeys?: readonly string[];
|
|
488
|
-
title?: string;
|
|
489
|
-
namespace?: string;
|
|
490
|
-
search?: TSearchSchema;
|
|
491
|
-
meta?: RouteMetaSource<TParams>;
|
|
492
|
-
actions?: readonly ActionDescriptor[];
|
|
493
|
-
}
|
|
494
|
-
interface RouteMeta {
|
|
495
|
-
title?: string;
|
|
496
|
-
description?: string;
|
|
497
|
-
canonical?: string;
|
|
498
|
-
robots?: string;
|
|
499
|
-
openGraph?: Record<string, string>;
|
|
500
|
-
links?: readonly {
|
|
501
|
-
rel: string;
|
|
502
|
-
href: string;
|
|
503
|
-
[key: string]: string;
|
|
504
|
-
}[];
|
|
505
|
-
jsonLd?: unknown | readonly unknown[];
|
|
506
|
-
html?: {
|
|
507
|
-
lang?: string;
|
|
508
|
-
dir?: 'ltr' | 'rtl' | 'auto';
|
|
509
|
-
};
|
|
510
|
-
}
|
|
511
|
-
/** A stable, typed reference returned by route() for destination construction. */
|
|
512
|
-
type RouteSearchValue = string | number | boolean | null | undefined | readonly (string | number | boolean | null)[];
|
|
513
|
-
/** A route's query-string parameters, keyed by name. */
|
|
514
|
-
type RouteSearch = Record<string, RouteSearchValue>;
|
|
515
|
-
/** Stable, typed reference to a route returned by `route()`, used to build destinations. */
|
|
516
|
-
interface RouteRef<TParams extends RouteParams = RouteParams, TSearch = RouteSearch> {
|
|
517
|
-
readonly path: string;
|
|
518
|
-
/** @internal Executable schema retained for destination validation. */
|
|
519
|
-
readonly searchSchema?: ObjectSchema<TSearch & RouteSearch>;
|
|
520
|
-
/** @internal Public mount point captured by createRouteRegistry(). */
|
|
521
|
-
readonly basePath?: string;
|
|
522
|
-
readonly __params?: TParams;
|
|
523
|
-
readonly __search?: TSearch;
|
|
524
|
-
}
|
|
525
|
-
type RouteRefSearch<TSchema extends ObjectSchema<RouteSearch> | undefined> = TSchema extends ObjectSchema<RouteSearch> ? InferSchema<TSchema> : RouteSearch;
|
|
526
|
-
/** A resolved navigation target with a computed `href`, produced by {@link to}. */
|
|
527
|
-
interface RouteDestination {
|
|
528
|
-
readonly href: string;
|
|
529
|
-
}
|
|
530
|
-
/** Options accepted by the `page()` route-declaration helper. */
|
|
531
|
-
interface PageHelperOptions extends CommonAccessOptions {
|
|
532
|
-
preload?: (context: RouteContext & {
|
|
533
|
-
request?: Request;
|
|
534
|
-
data: QueryPrefetchContext;
|
|
535
|
-
}) => unknown;
|
|
536
|
-
meta?: RouteMetaSource;
|
|
537
|
-
}
|
|
538
|
-
/**
|
|
539
|
-
* A single parsed segment from a route path.
|
|
540
|
-
*
|
|
541
|
-
* - `static`: a literal path segment, e.g. `"users"` in `/users/{id}`
|
|
542
|
-
* - `param`: a `{name}` capture group — `value` holds the param name
|
|
543
|
-
* - `wildcard`: a bare `*` segment that captures exactly one segment
|
|
544
|
-
* - `splat`: a `{*name}` capture group that captures the remaining path
|
|
545
|
-
* - `catchall`: the `/*` catch-all that matches any depth
|
|
546
|
-
*/
|
|
547
|
-
interface ParsedSegment {
|
|
548
|
-
kind: 'static' | 'param' | 'wildcard' | 'splat' | 'catchall';
|
|
549
|
-
/** For static/wildcard/catchall: the literal text; for param: the param name. */
|
|
550
|
-
value: string;
|
|
551
|
-
}
|
|
552
|
-
/** Resolved layout component as stored in a route record's layout chain. */
|
|
553
|
-
interface LayoutScopeRecord {
|
|
554
|
-
component: (props: {
|
|
555
|
-
children?: RenderableChild;
|
|
556
|
-
}) => RenderableChild;
|
|
557
|
-
}
|
|
558
|
-
/** Resolved page host component as stored in a route record's page chain. */
|
|
559
|
-
interface PageScopeRecord {
|
|
560
|
-
component: RouteComponent;
|
|
561
|
-
}
|
|
562
|
-
/** Options for {@link createRouteRegistry}. */
|
|
563
|
-
interface RouteRegistryOptions {
|
|
564
|
-
auth?: RouteAuthOptions;
|
|
565
|
-
/** Public pathname prefix for applications mounted below the origin root. */
|
|
566
|
-
basePath?: string;
|
|
567
|
-
}
|
|
568
|
-
/** A callback that declares routes via `route()`/`page()`/`group()`, passed to {@link createRouteRegistry}. */
|
|
569
|
-
type RouteDefinition = () => void;
|
|
570
|
-
/** Options for resolving a route request (used internally by `createSPA`/`hydrateSPA`/SSR). */
|
|
571
|
-
interface RouteRequestOptions {
|
|
572
|
-
/** Explicit route source shared by the application renderers. */
|
|
573
|
-
registry: RouteRegistry;
|
|
574
|
-
mode?: RouteMode;
|
|
575
|
-
/** @internal Hydration adopts server loader data instead of rerunning it. */
|
|
576
|
-
load?: boolean;
|
|
577
|
-
auth?: RouteAuthOptions;
|
|
578
|
-
authContext?: AuthContext;
|
|
579
|
-
signal?: AbortSignal;
|
|
580
|
-
request?: Request;
|
|
581
|
-
telemetry?: CoreTelemetry;
|
|
582
|
-
}
|
|
583
|
-
/** A resolved route request that should render `handler` with `params`. */
|
|
584
|
-
interface RouteRenderResult<TParams extends RouteParams = RouteParams> {
|
|
585
|
-
kind: 'render';
|
|
586
|
-
handler: RouteHandler<TParams>;
|
|
587
|
-
params: TParams;
|
|
588
|
-
record?: RouteRecord;
|
|
589
|
-
}
|
|
590
|
-
/** Outcome of resolving a route request: render, redirect, deny, or no match. */
|
|
591
|
-
type RouteRequestResult<TParams extends RouteParams = RouteParams> = RouteRenderResult<TParams> | AccessRedirectDecision | AccessDenyDecision | null;
|
|
592
|
-
/** Options accepted by the `group()` route-declaration helper. */
|
|
593
|
-
interface GroupHelperOptions extends CommonAccessOptions {
|
|
594
|
-
layout?: (props: {
|
|
595
|
-
children?: RenderableChild;
|
|
596
|
-
}) => RenderableChild;
|
|
597
|
-
meta?: RouteMetaSource;
|
|
598
|
-
}
|
|
599
|
-
/**
|
|
600
|
-
* A fully normalized route record produced by `route(path, Component, options?)`.
|
|
601
|
-
*
|
|
602
|
-
* This is the canonical representation shared by:
|
|
603
|
-
* - SPA matching and navigation
|
|
604
|
-
* - SSR request resolution
|
|
605
|
-
* - SSG manifest expansion
|
|
606
|
-
*/
|
|
607
|
-
interface RouteRecord {
|
|
608
|
-
/** Canonical normalized absolute path, e.g. `/posts/{slug}` */
|
|
609
|
-
path: string;
|
|
610
|
-
/** The page component to render when this route is active */
|
|
611
|
-
component: RouteComponent;
|
|
612
|
-
/** Pre-parsed segment list for fast matching and typed param extraction */
|
|
613
|
-
segments: ParsedSegment[];
|
|
614
|
-
/** Pre-computed specificity rank (higher = more specific) */
|
|
615
|
-
rank: number;
|
|
616
|
-
/** Layout chain from outermost to innermost, applied automatically on render */
|
|
617
|
-
layoutChain: LayoutScopeRecord[];
|
|
618
|
-
/** Page chain from outermost to innermost, composed through Outlet before layouts apply */
|
|
619
|
-
pageChain: PageScopeRecord[];
|
|
620
|
-
/** Route metadata: loader, entries, policies, title, namespace */
|
|
621
|
-
options: RouteOptions;
|
|
622
|
-
/** Metadata sources ordered from outermost group/page to the route leaf. */
|
|
623
|
-
metaChain?: readonly RouteMetaSource[];
|
|
624
|
-
/** True when this is the `/*` catch-all fallback route */
|
|
625
|
-
isFallback: boolean;
|
|
626
|
-
/**
|
|
627
|
-
* Runtime-ready handler with layout composition baked in.
|
|
628
|
-
* Compatible with the low-level `RouteHandler` signature so that navigation
|
|
629
|
-
* and SSR rendering do not need to know about layout chains.
|
|
630
|
-
*/
|
|
631
|
-
handler: RouteHandler;
|
|
632
|
-
}
|
|
633
|
-
/**
|
|
634
|
-
* The normalized route manifest produced by registered route definitions.
|
|
635
|
-
* declarations. Pass it to `createSPA`, `hydrateSPA`, or `renderToString`
|
|
636
|
-
* instead of assembling plain `Route[]` arrays.
|
|
637
|
-
*
|
|
638
|
-
* ```ts
|
|
639
|
-
* import { createRouteRegistry } from '@askrjs/askr/router';
|
|
640
|
-
* const registry = createRouteRegistry(() => { ... });
|
|
641
|
-
* await createSPA({ root: '#app', registry });
|
|
642
|
-
* ```
|
|
643
|
-
*/
|
|
644
|
-
interface RouteManifest {
|
|
645
|
-
records: RouteRecord[];
|
|
646
|
-
auth?: RouteAuthOptions;
|
|
647
|
-
/** Normalized public pathname prefix. Empty and root mounts omit it. */
|
|
648
|
-
basePath?: string;
|
|
649
|
-
}
|
|
650
|
-
declare const routeRegistryBrand: unique symbol;
|
|
651
|
-
/** A function rendering a matched route's page content, with layouts already composed. */
|
|
652
|
-
interface RouteHandler<TParams extends RouteParams = RouteParams> {
|
|
653
|
-
(params: TParams, context?: {
|
|
654
|
-
signal: AbortSignal;
|
|
655
|
-
}): RenderableChild;
|
|
656
|
-
}
|
|
657
|
-
/** A single path-to-handler binding as seen by low-level navigation code. */
|
|
658
|
-
interface Route<TParams extends RouteParams = RouteParams> {
|
|
659
|
-
path: string;
|
|
660
|
-
handler: RouteHandler<TParams>;
|
|
661
|
-
namespace?: string;
|
|
662
|
-
}
|
|
663
|
-
/** Opaque handle produced by {@link createRouteRegistry}, required by `createSPA`/`hydrateSPA`. */
|
|
664
|
-
interface RouteRegistry {
|
|
665
|
-
/** Internal brand: registries must come from createRouteRegistry(). */
|
|
666
|
-
readonly [routeRegistryBrand]: true;
|
|
667
|
-
manifest: RouteManifest;
|
|
668
|
-
routes: readonly Route[];
|
|
669
|
-
}
|
|
670
|
-
/** A single matched route, as reported by {@link currentRoute} and activity predicates. */
|
|
671
|
-
interface RouteMatch<TParams extends RouteParams = RouteParams> {
|
|
672
|
-
path: string;
|
|
673
|
-
params: Readonly<TParams>;
|
|
674
|
-
name?: string;
|
|
675
|
-
namespace?: string;
|
|
676
|
-
}
|
|
677
|
-
/** Read-only accessor for the current route's query-string parameters. */
|
|
678
|
-
interface RouteQuery {
|
|
679
|
-
get(key: string): string | null;
|
|
680
|
-
getAll(key: string): string[];
|
|
681
|
-
has(key: string): boolean;
|
|
682
|
-
toJSON(): Record<string, string | string[]>;
|
|
683
|
-
}
|
|
684
|
-
/** Full description of the currently active route, returned by {@link currentRoute}. */
|
|
685
|
-
interface RouteSnapshot<TParams extends RouteParams = RouteParams, TState = unknown> {
|
|
686
|
-
path: string;
|
|
687
|
-
params: Readonly<TParams>;
|
|
688
|
-
query: Readonly<RouteQuery>;
|
|
689
|
-
hash: string | null;
|
|
690
|
-
/** Whether the current browser history entry was given explicit location state. */
|
|
691
|
-
hasState: boolean;
|
|
692
|
-
/** Entry-local state supplied to navigate(); absent during SSR and when no state was supplied. */
|
|
693
|
-
state: TState | undefined;
|
|
694
|
-
name?: string;
|
|
695
|
-
namespace?: string;
|
|
696
|
-
matches: readonly RouteMatch<TParams>[];
|
|
697
|
-
}
|
|
698
|
-
//#endregion
|
|
699
|
-
//#region src/common/app-render-runtime.d.ts
|
|
700
|
-
interface AppRenderRuntime {
|
|
701
|
-
framework: Readonly<Record<string, unknown>>;
|
|
702
|
-
route: unknown;
|
|
703
|
-
hasRoute: boolean;
|
|
704
|
-
dataRuntime?: DataRuntime;
|
|
705
|
-
routeRegistry?: RouteRegistry;
|
|
706
|
-
routeAuth?: RouteAuthOptions;
|
|
707
|
-
}
|
|
708
|
-
//#endregion
|
|
709
|
-
//#region src/runtime/component-internal.d.ts
|
|
710
|
-
interface ComponentInstance {
|
|
711
|
-
id: string;
|
|
712
|
-
fn: ComponentFunction;
|
|
713
|
-
props: Props;
|
|
714
|
-
target: Element | null;
|
|
715
|
-
parentInstance: ComponentInstance | null;
|
|
716
|
-
portalScope: object | null;
|
|
717
|
-
mounted: boolean;
|
|
718
|
-
abortController: AbortController | null;
|
|
719
|
-
ssr?: boolean;
|
|
720
|
-
cleanupStrict?: boolean;
|
|
721
|
-
/** @internal Private resource-ownership identity for the active mount. */
|
|
722
|
-
_ownershipGeneration: object;
|
|
723
|
-
stateValues?: State<unknown>[];
|
|
724
|
-
evaluationGeneration: number;
|
|
725
|
-
notifyUpdate: (() => void) | null;
|
|
726
|
-
_pendingFlushTask?: () => void;
|
|
727
|
-
_pendingRunTask?: () => void;
|
|
728
|
-
_enqueueRun?: () => void;
|
|
729
|
-
stateIndexCheck: number;
|
|
730
|
-
expectedStateIndices?: number[];
|
|
731
|
-
firstRenderComplete: boolean;
|
|
732
|
-
mountOperations?: Array<() => void | (() => void) | PromiseLike<void | (() => void)>>;
|
|
733
|
-
commitOperations?: Array<() => void | (() => void) | PromiseLike<void | (() => void)>>;
|
|
734
|
-
cleanupFns?: Array<() => void>;
|
|
735
|
-
lifecycleSlots?: unknown[];
|
|
736
|
-
lifecycleGeneration: number;
|
|
737
|
-
hasPendingUpdate: boolean;
|
|
738
|
-
ownerFrame: ContextFrame | null;
|
|
739
|
-
isRoot?: boolean;
|
|
740
|
-
_rootComponentFn?: ComponentFunction;
|
|
741
|
-
/** @internal Browser-owned hydration and route state for this app root. */
|
|
742
|
-
_appRenderRuntime?: AppRenderRuntime;
|
|
743
|
-
/** @internal CSP nonce retained across browser route navigation. */
|
|
744
|
-
_cspNonce?: string;
|
|
745
|
-
_vnodeOwner?: object;
|
|
746
|
-
_vnodeParent?: ComponentInstance | null;
|
|
747
|
-
_vnodeParentGeneration?: object;
|
|
748
|
-
_vnodeKey?: string | number;
|
|
749
|
-
_vnodePosition?: number;
|
|
750
|
-
_wrapperDepth?: number;
|
|
751
|
-
_currentRenderToken?: number;
|
|
752
|
-
lastRenderToken?: number;
|
|
753
|
-
_pendingReadSources?: Set<ReadableSource<unknown>>;
|
|
754
|
-
_pendingReadSourceVersions?: Map<ReadableSource<unknown>, number>;
|
|
755
|
-
_lastReadSources?: Set<ReadableSource<unknown>>;
|
|
756
|
-
devWarningsEmitted?: Set<string>;
|
|
757
|
-
_placeholder?: Comment;
|
|
758
|
-
_ownedChildScopes?: Set<OwnedChildScope>;
|
|
759
|
-
errorBoundaryState?: {
|
|
760
|
-
error: unknown | null;
|
|
761
|
-
resetKey: unknown;
|
|
762
|
-
notified: boolean;
|
|
763
|
-
};
|
|
764
|
-
/** @internal Logical error ancestry for content materialized by a portal host. */
|
|
765
|
-
_portalErrorParent?: ComponentInstance | null;
|
|
766
|
-
/** @internal Ownership identity paired with `_portalErrorParent`. */
|
|
767
|
-
_portalErrorParentGeneration?: object;
|
|
768
|
-
}
|
|
769
|
-
//#endregion
|
|
770
|
-
//#region src/runtime/component-scope.d.ts
|
|
771
|
-
/**
|
|
772
|
-
* Get the abort signal for the current component.
|
|
773
|
-
*
|
|
774
|
-
* The signal is guaranteed to be aborted when:
|
|
775
|
-
* - Component unmounts
|
|
776
|
-
* - Navigation occurs (different route)
|
|
777
|
-
* - Parent is destroyed
|
|
778
|
-
*/
|
|
779
|
-
declare function getSignal(): AbortSignal;
|
|
780
|
-
//#endregion
|
|
781
|
-
//#region src/runtime/readable.d.ts
|
|
782
|
-
interface DerivedSubscriber {
|
|
783
|
-
_markDirty(): void;
|
|
784
|
-
_pendingDependencySources?: Set<ReadableSource<unknown>>;
|
|
785
|
-
}
|
|
786
|
-
interface ReadableSource<T = unknown> {
|
|
787
|
-
(): T;
|
|
788
|
-
_hasBeenRead?: boolean;
|
|
789
|
-
_hasEverBeenRead?: boolean;
|
|
790
|
-
_unusedStateDiagnosticEligible?: boolean;
|
|
791
|
-
_readers?: Map<ComponentInstance, {
|
|
792
|
-
token: number;
|
|
793
|
-
generation: object;
|
|
794
|
-
}>;
|
|
795
|
-
_derivedSubscribers?: Set<DerivedSubscriber>;
|
|
796
|
-
_version?: number;
|
|
797
|
-
}
|
|
798
|
-
//#endregion
|
|
799
|
-
//#region src/runtime/scheduler.d.ts
|
|
800
|
-
/**
|
|
801
|
-
* Serialized update scheduler — safer design (no inline execution, explicit flush)
|
|
802
|
-
*
|
|
803
|
-
* Key ideas:
|
|
804
|
-
* - Never execute a task inline from `enqueue`.
|
|
805
|
-
* - `flush()` is explicit and non-reentrant.
|
|
806
|
-
* - `runWithSyncProgress()` allows enqueues temporarily but does not run tasks
|
|
807
|
-
* inline; it runs `fn` and then does an explicit `flush()`.
|
|
808
|
-
* - `waitForFlush()` is race-free with a monotonic `flushVersion`.
|
|
809
|
-
*/
|
|
810
|
-
type Task = () => void;
|
|
811
|
-
type SchedulerLane = 'derived' | 'component' | 'reactive' | 'post';
|
|
812
|
-
type SchedulerBulkCommitProbe = () => boolean;
|
|
813
|
-
declare class Scheduler {
|
|
814
|
-
private bulkCommitProbe;
|
|
815
|
-
private lanes;
|
|
816
|
-
private running;
|
|
817
|
-
private inHandler;
|
|
818
|
-
private depth;
|
|
819
|
-
private executionDepth;
|
|
820
|
-
private flushVersion;
|
|
821
|
-
private kickScheduled;
|
|
822
|
-
private allowSyncProgress;
|
|
823
|
-
private waiters;
|
|
824
|
-
private taskCount;
|
|
825
|
-
setBulkCommitProbe(probe: SchedulerBulkCommitProbe): void;
|
|
826
|
-
private isBulkCommitActive;
|
|
827
|
-
private hasPendingTasks;
|
|
828
|
-
private getPendingTaskCount;
|
|
829
|
-
private compactLane;
|
|
830
|
-
private scheduleFlushKick;
|
|
831
|
-
enqueue(task: Task): void;
|
|
832
|
-
enqueueInLane(lane: SchedulerLane, task: Task): void;
|
|
833
|
-
flush(): void;
|
|
834
|
-
runWithSyncProgress<T>(fn: () => T): T;
|
|
835
|
-
waitForFlush(targetVersion?: number, timeoutMs?: number): Promise<void>;
|
|
836
|
-
getState(): {
|
|
837
|
-
queueLength: number;
|
|
838
|
-
running: boolean;
|
|
839
|
-
depth: number;
|
|
840
|
-
executionDepth: number;
|
|
841
|
-
taskCount: number;
|
|
842
|
-
flushVersion: number;
|
|
843
|
-
laneQueues: {
|
|
844
|
-
derived: number;
|
|
845
|
-
component: number;
|
|
846
|
-
reactive: number;
|
|
847
|
-
post: number;
|
|
848
|
-
};
|
|
849
|
-
inHandler: boolean;
|
|
850
|
-
allowSyncProgress: boolean;
|
|
851
|
-
};
|
|
852
|
-
getFlushVersion(): number;
|
|
853
|
-
flushIfQueued(): void;
|
|
854
|
-
runInHandlerScope<T>(fn: () => T, flushMode?: 'defer' | 'sync'): T;
|
|
855
|
-
setInHandler(v: boolean): void;
|
|
856
|
-
isInHandler(): boolean;
|
|
857
|
-
isExecuting(): boolean;
|
|
858
|
-
clearPendingSyncTasks(): number;
|
|
859
|
-
private resolveWaiters;
|
|
860
|
-
}
|
|
861
|
-
declare function scheduleEventHandler(handler: EventListener): EventListener;
|
|
862
|
-
//#endregion
|
|
863
|
-
//#region src/common/dom-range.d.ts
|
|
864
|
-
/**
|
|
865
|
-
* Internal DOM range shape shared by runtime ownership records and the
|
|
866
|
-
* renderer. A singleton range uses the node itself for both anchors; a
|
|
867
|
-
* multi-node or empty range uses deterministic comment anchors.
|
|
868
|
-
*/
|
|
869
|
-
interface DOMRange {
|
|
870
|
-
start: Node;
|
|
871
|
-
end: Node;
|
|
872
|
-
single: boolean;
|
|
873
|
-
}
|
|
874
|
-
//#endregion
|
|
875
|
-
//#region src/runtime/child-scope.d.ts
|
|
876
|
-
interface ChildScope {
|
|
877
|
-
key: string | number;
|
|
878
|
-
componentInstance: ComponentInstance;
|
|
879
|
-
previousVnode: VNode | undefined;
|
|
880
|
-
vnode: VNode | undefined;
|
|
881
|
-
dom?: Node;
|
|
882
|
-
/** @internal Fast singleton node plus an anchor-backed multi-node range. */
|
|
883
|
-
range?: DOMRange;
|
|
884
|
-
needsDomUpdate: boolean;
|
|
885
|
-
hydrationPending: boolean;
|
|
886
|
-
/** @internal Stable owner for validated intrinsic blueprints in list items. */
|
|
887
|
-
blueprintOwner?: object;
|
|
888
|
-
render(renderFn: () => VNode): VNode;
|
|
889
|
-
markDirty(): void;
|
|
890
|
-
dispose(): void;
|
|
891
|
-
}
|
|
892
|
-
interface ChildScopeOwnership {
|
|
893
|
-
add(scope: ChildScope): void;
|
|
894
|
-
delete(scope: ChildScope): void;
|
|
895
|
-
bulkDispose(run: () => void): void;
|
|
896
|
-
}
|
|
897
|
-
/** @internal Snapshot used to restore a child scope after a failed commit. */
|
|
898
|
-
interface ChildScopeTransactionSnapshot {
|
|
899
|
-
previousVnode: VNode | undefined;
|
|
900
|
-
vnode: VNode | undefined;
|
|
901
|
-
dom: Node | undefined;
|
|
902
|
-
range: DOMRange | undefined;
|
|
903
|
-
domTextData: string | undefined;
|
|
904
|
-
needsDomUpdate: boolean;
|
|
905
|
-
hydrationPending: boolean;
|
|
906
|
-
renderFn: (() => VNode) | undefined;
|
|
907
|
-
renderedOwnerFrame: ContextFrame | null;
|
|
908
|
-
}
|
|
909
|
-
//#endregion
|
|
910
|
-
//#region src/runtime/runtime.d.ts
|
|
911
|
-
/** Diagnostic breakdown of a keyed-list reorder decision, returned by {@link RuntimeRendererHost.isKeyedReorderFastPathEligible}. */
|
|
912
|
-
interface RuntimeKeyedReorderDecision {
|
|
913
|
-
useFastPath: boolean;
|
|
914
|
-
totalKeyed: number;
|
|
915
|
-
totalChildren: number;
|
|
916
|
-
currentKeyCount: number;
|
|
917
|
-
moveCount: number;
|
|
918
|
-
lisLen: number;
|
|
919
|
-
hasPropChanges: boolean;
|
|
920
|
-
isWholeKeyedList: boolean;
|
|
921
|
-
}
|
|
922
|
-
/** The renderer implementation an {@link AskrRuntime} delegates DOM evaluation and cleanup to. */
|
|
923
|
-
interface RuntimeRendererHost {
|
|
924
|
-
evaluate(node: unknown, target: Element | null, context?: object, retainedOwner?: ComponentInstance): void;
|
|
925
|
-
cleanupInstancesUnder(node: Node): void;
|
|
926
|
-
replaceComponentRange(instance: ComponentInstance, result: unknown, host: Element | Comment): Node | null;
|
|
927
|
-
resolveChildScopeRange?(scope: ChildScope): DOMRange | null;
|
|
928
|
-
teardownNodeSubtree(root: Node): void;
|
|
929
|
-
populateKeyMapForElement(parent: Element): void;
|
|
930
|
-
getKeyMapForElement(parent: Element): Map<string | number, Element> | undefined;
|
|
931
|
-
isKeyedReorderFastPathEligible(parent: Element, children: unknown[], oldKeyMap: Map<string | number, Element> | undefined): RuntimeKeyedReorderDecision;
|
|
932
|
-
markReactivePropsDirtySource(source: ReadableSource<unknown>): void;
|
|
933
|
-
}
|
|
934
|
-
/** Options for {@link createRuntime}. */
|
|
935
|
-
interface AskrRuntimeOptions {
|
|
936
|
-
scheduler?: Scheduler;
|
|
937
|
-
renderer?: RuntimeRendererHost;
|
|
938
|
-
}
|
|
939
|
-
/** A scheduler + renderer host pairing; owns scheduling and renderer wiring for an app instance. */
|
|
940
|
-
declare class AskrRuntime {
|
|
941
|
-
readonly scheduler: Scheduler;
|
|
942
|
-
private rendererHost;
|
|
943
|
-
constructor(options?: AskrRuntimeOptions);
|
|
944
|
-
get renderer(): RuntimeRendererHost;
|
|
945
|
-
configureRenderer(renderer: RuntimeRendererHost): void;
|
|
946
|
-
}
|
|
947
|
-
/** Create a new {@link AskrRuntime} instance with its own scheduler/renderer wiring. */
|
|
948
|
-
declare function createRuntime(options?: AskrRuntimeOptions): AskrRuntime;
|
|
949
|
-
/** Get the process-wide default {@link AskrRuntime}. */
|
|
950
|
-
declare function getDefaultRuntime(): AskrRuntime;
|
|
951
|
-
//#endregion
|
|
952
|
-
//#region src/runtime/for-signals.d.ts
|
|
953
|
-
type ForItemSignal<T> = ReadableSource<T> & (() => T) & {
|
|
954
|
-
peek(): T;
|
|
955
|
-
set(newValue: T, notifyReaders?: boolean): void;
|
|
956
|
-
};
|
|
957
|
-
type ForItemPropertySignal = ReadableSource<unknown> & (() => unknown) & {
|
|
958
|
-
peek(): unknown;
|
|
959
|
-
set(newValue: unknown, notifyReaders?: boolean): void;
|
|
960
|
-
};
|
|
961
|
-
type ForIndexSignal = ReadableSource<number> & (() => number) & {
|
|
962
|
-
peek(): number;
|
|
963
|
-
set(newValue: number | ((prev: number) => number), notifyReaders?: boolean): void;
|
|
964
|
-
};
|
|
965
|
-
interface ReactiveForItemState<T> {
|
|
966
|
-
currentItem: T;
|
|
967
|
-
itemSignal: ForItemSignal<T> | null;
|
|
968
|
-
propertySignals: Map<PropertyKey, ForItemPropertySignal> | null;
|
|
969
|
-
coalescedProperties: PropertyKey | PropertyKey[] | null;
|
|
970
|
-
coalescedProperty2: PropertyKey | null;
|
|
971
|
-
wholeItemRead: boolean;
|
|
972
|
-
proxy: T;
|
|
973
|
-
}
|
|
974
|
-
//#endregion
|
|
975
|
-
//#region src/runtime/for-scopes.d.ts
|
|
976
|
-
interface ForItemInstance<T> {
|
|
977
|
-
key: string | number;
|
|
978
|
-
item: T;
|
|
979
|
-
reactiveItem: T;
|
|
980
|
-
reactiveItemState: ReactiveForItemState<T> | null;
|
|
981
|
-
indexSignal: ForIndexSignal;
|
|
982
|
-
scope: ChildScope;
|
|
983
|
-
}
|
|
984
|
-
//#endregion
|
|
985
|
-
//#region src/runtime/effect.d.ts
|
|
986
|
-
interface FineGrainedEffectHandle<T> {
|
|
987
|
-
cleanup(): void;
|
|
988
|
-
updateCompute(nextCompute: () => T): void;
|
|
989
|
-
flush(): void;
|
|
990
|
-
}
|
|
991
|
-
//#endregion
|
|
992
|
-
//#region src/runtime/for-types.d.ts
|
|
993
|
-
type ForEachSource<T> = readonly T[] | (() => readonly T[]);
|
|
994
|
-
type ForKeySelector<T> = (item: T, index: number) => string | number;
|
|
995
|
-
type ForRenderItem<T> = (item: T, index: () => number) => VNode;
|
|
996
|
-
//#endregion
|
|
997
|
-
//#region src/runtime/for-internal.d.ts
|
|
998
|
-
type ForCommitStrategy = 'APPEND' | 'INSERT_ONE' | 'REMOVE_ONE' | 'TRUNCATE' | 'NO_REORDER' | 'SWAP' | 'FULL_KEYED';
|
|
999
|
-
interface ForState<T> {
|
|
1000
|
-
kind: 'for';
|
|
1001
|
-
_contextFrame: ContextFrame | null;
|
|
1002
|
-
_contextFrameChanged: boolean;
|
|
1003
|
-
currentItems: readonly T[];
|
|
1004
|
-
_committedItems: readonly T[];
|
|
1005
|
-
eachSource: ForEachSource<T>;
|
|
1006
|
-
fallback: VNode | null;
|
|
1007
|
-
fallbackScope: ChildScope | null;
|
|
1008
|
-
items: Map<string | number, ForItemInstance<T>>;
|
|
1009
|
-
orderedKeys: Array<string | number>;
|
|
1010
|
-
orderedItems: ForItemInstance<T>[];
|
|
1011
|
-
orderedVNodes: VNode[];
|
|
1012
|
-
byFn: ForKeySelector<T>;
|
|
1013
|
-
renderFn: ForRenderItem<T>;
|
|
1014
|
-
parentInstance: ComponentInstance | null;
|
|
1015
|
-
lastCommitStrategy: ForCommitStrategy;
|
|
1016
|
-
lastRemovedNodes: Node[];
|
|
1017
|
-
lastRemovedRanges: DOMRange[];
|
|
1018
|
-
pendingDirtyIndices: number[] | null;
|
|
1019
|
-
pendingSwapIndices: [number, number] | null;
|
|
1020
|
-
pendingMoveOnly: boolean;
|
|
1021
|
-
pendingInsertedIndex: number | null;
|
|
1022
|
-
pendingRemovedKey: string | number | null;
|
|
1023
|
-
pendingAppendStart: number | null;
|
|
1024
|
-
_hasResolvedItemDom: boolean;
|
|
1025
|
-
_needsSourceReconcile: boolean;
|
|
1026
|
-
_sourceEffect: FineGrainedEffectHandle<readonly T[]> | null;
|
|
1027
|
-
_suspendSourceCommit: boolean;
|
|
1028
|
-
_enqueueBoundaryCommit?: (() => void) | null;
|
|
1029
|
-
_hasPendingBoundaryCommit?: boolean;
|
|
1030
|
-
devKeyKinds?: Map<string | number, 'number' | 'string'>;
|
|
1031
|
-
_transaction?: ForTransaction<T> | null;
|
|
1032
|
-
_scopeOwnership: ChildScopeOwnership;
|
|
1033
|
-
}
|
|
1034
|
-
interface ForItemTransactionSnapshot<T> {
|
|
1035
|
-
item: T;
|
|
1036
|
-
itemSignalExists: boolean;
|
|
1037
|
-
itemSignalValue: T | undefined;
|
|
1038
|
-
itemSignalHasBeenRead: boolean;
|
|
1039
|
-
indexValue: number;
|
|
1040
|
-
indexHasBeenRead: boolean;
|
|
1041
|
-
propertySignalStore: Map<PropertyKey, ForItemPropertySignal> | null;
|
|
1042
|
-
propertySignals: Map<PropertyKey, {
|
|
1043
|
-
signal: ForItemPropertySignal;
|
|
1044
|
-
value: unknown;
|
|
1045
|
-
hasBeenRead: boolean;
|
|
1046
|
-
}> | null;
|
|
1047
|
-
scope: ChildScopeTransactionSnapshot;
|
|
1048
|
-
}
|
|
1049
|
-
interface ForTransaction<T> {
|
|
1050
|
-
collectionSnapshotMode: 'copy' | 'reset-empty' | 'preserve-clear' | 'reuse';
|
|
1051
|
-
currentItems: readonly T[];
|
|
1052
|
-
items: Map<string | number, ForItemInstance<T>>;
|
|
1053
|
-
orderedKeys: Array<string | number>;
|
|
1054
|
-
orderedItems: ForItemInstance<T>[];
|
|
1055
|
-
orderedVNodes: VNode[];
|
|
1056
|
-
fallbackScope: ChildScope | null;
|
|
1057
|
-
lastCommitStrategy: ForCommitStrategy;
|
|
1058
|
-
lastRemovedNodes: Node[];
|
|
1059
|
-
lastRemovedRanges: DOMRange[];
|
|
1060
|
-
pendingDirtyIndices: number[] | null;
|
|
1061
|
-
pendingSwapIndices: [number, number] | null;
|
|
1062
|
-
pendingMoveOnly: boolean;
|
|
1063
|
-
pendingInsertedIndex: number | null;
|
|
1064
|
-
pendingRemovedKey: string | number | null;
|
|
1065
|
-
pendingAppendStart: number | null;
|
|
1066
|
-
hasResolvedItemDom: boolean;
|
|
1067
|
-
needsSourceReconcile: boolean;
|
|
1068
|
-
devKeyKinds?: Map<string | number, 'number' | 'string'>;
|
|
1069
|
-
itemSnapshots: Map<ForItemInstance<T>, ForItemTransactionSnapshot<T>> | null;
|
|
1070
|
-
unreadIndexSnapshots: Map<ForIndexSignal, number> | null;
|
|
1071
|
-
fallbackScopeSnapshot: ChildScopeTransactionSnapshot | null;
|
|
1072
|
-
removedScopes: ChildScope[] | null;
|
|
1073
|
-
removedScopeNodes: Node[] | null;
|
|
1074
|
-
removeAllItems: boolean;
|
|
1075
|
-
signalEffects: Map<ReadableSource<unknown>, {
|
|
1076
|
-
parentInstance: ComponentInstance | null;
|
|
1077
|
-
notify: boolean;
|
|
1078
|
-
skipInstance: ComponentInstance | null;
|
|
1079
|
-
skipOwnedBy: ComponentInstance | null;
|
|
1080
|
-
}> | null;
|
|
1081
|
-
shouldClearDomUpdateState: boolean;
|
|
1082
|
-
}
|
|
1083
|
-
//#endregion
|
|
1084
|
-
//#region src/runtime/control.d.ts
|
|
1085
|
-
interface MatchBranch {
|
|
1086
|
-
key: string | number;
|
|
1087
|
-
render: () => VNode;
|
|
1088
|
-
when: unknown;
|
|
1089
|
-
}
|
|
1090
|
-
interface BranchControlStateBase {
|
|
1091
|
-
_contextFrame: ContextFrame | null;
|
|
1092
|
-
activeKey: string | number | null;
|
|
1093
|
-
activeScope: ChildScope | null;
|
|
1094
|
-
activeVNodes: VNode[];
|
|
1095
|
-
lastRemovedNodes: Node[];
|
|
1096
|
-
lastRemovedRanges: DOMRange[];
|
|
1097
|
-
parentInstance: ComponentInstance | null;
|
|
1098
|
-
_enqueueBoundaryCommit?: (() => void) | null;
|
|
1099
|
-
_hasPendingBoundaryCommit?: boolean;
|
|
1100
|
-
_transaction?: ControlTransaction | null;
|
|
1101
|
-
}
|
|
1102
|
-
interface ShowState extends BranchControlStateBase {
|
|
1103
|
-
kind: 'show';
|
|
1104
|
-
fallbackScope: ChildScope | null;
|
|
1105
|
-
renderFallback: (() => VNode) | null;
|
|
1106
|
-
renderTruthy: ((value: unknown) => VNode) | (() => VNode);
|
|
1107
|
-
selectedValue: unknown;
|
|
1108
|
-
truthyScope: ChildScope | null;
|
|
1109
|
-
}
|
|
1110
|
-
interface CaseState extends BranchControlStateBase {
|
|
1111
|
-
kind: 'case';
|
|
1112
|
-
fallback: (() => VNode) | null;
|
|
1113
|
-
matches: MatchBranch[];
|
|
1114
|
-
}
|
|
1115
|
-
type ControlBoundaryState = ForState<unknown> | ShowState | CaseState;
|
|
1116
|
-
type BranchStateSnapshot = {
|
|
1117
|
-
activeKey: string | number | null;
|
|
1118
|
-
activeScope: ChildScope | null;
|
|
1119
|
-
activeVNodes: VNode[];
|
|
1120
|
-
lastRemovedNodes: Node[];
|
|
1121
|
-
lastRemovedRanges: DOMRange[];
|
|
1122
|
-
scopeSnapshots: Map<ChildScope, ChildScopeTransactionSnapshot>;
|
|
1123
|
-
fallbackScope?: ChildScope | null;
|
|
1124
|
-
truthyScope?: ChildScope | null;
|
|
1125
|
-
};
|
|
1126
|
-
interface ControlTransaction {
|
|
1127
|
-
state: ShowState | CaseState;
|
|
1128
|
-
snapshot: BranchStateSnapshot;
|
|
1129
|
-
removedScopes: ChildScope[];
|
|
1130
|
-
shouldClearDomUpdateState: boolean;
|
|
1131
|
-
registered: boolean;
|
|
1132
|
-
}
|
|
1133
|
-
//#endregion
|
|
1134
|
-
//#region src/runtime/snapshot-source.d.ts
|
|
1135
|
-
declare const SNAPSHOT_SOURCE_BRAND: unique symbol;
|
|
1136
|
-
type SnapshotSourceBrand = {
|
|
1137
|
-
readonly [SNAPSHOT_SOURCE_BRAND]: true;
|
|
1138
|
-
};
|
|
1139
|
-
//#endregion
|
|
1140
|
-
//#region src/runtime/derive.d.ts
|
|
1141
|
-
/** A reactive derived value produced by {@link derive}; call it to read the current result. */
|
|
1142
|
-
interface Derived<T> extends ReadableSource<T> {
|
|
1143
|
-
(): T;
|
|
1144
|
-
}
|
|
1145
|
-
type SnapshotSource<T> = {
|
|
1146
|
-
value: T | null;
|
|
1147
|
-
pending?: boolean;
|
|
1148
|
-
error?: Error | null;
|
|
1149
|
-
} & SnapshotSourceBrand;
|
|
1150
|
-
/** Creates a render-scoped derived value; must be called during component render. */
|
|
1151
|
-
declare function derive<TOut>(fn: () => TOut): Derived<TOut>;
|
|
1152
|
-
declare function derive<TIn, TOut>(source: SnapshotSource<TIn> | TIn | (() => TIn), map: (value: TIn) => TOut): Derived<TOut | null>;
|
|
1153
|
-
//#endregion
|
|
1154
|
-
//#region src/runtime/lifecycle-operations.d.ts
|
|
1155
|
-
/** A gating condition for lifecycle primitives like {@link timer}; `true` means active. */
|
|
1156
|
-
type ActivityPredicate = () => boolean;
|
|
1157
|
-
/** Options for {@link timer}. */
|
|
1158
|
-
interface TimerOptions {
|
|
1159
|
-
when?: ActivityPredicate | readonly ActivityPredicate[];
|
|
1160
|
-
}
|
|
1161
|
-
/** {@link ActivityPredicate} that is true while the current route matches `pathOrPaths`. */
|
|
1162
|
-
declare function routeActive(pathOrPaths: string | readonly string[]): ActivityPredicate;
|
|
1163
|
-
/** {@link ActivityPredicate} that is true while the document is visible. */
|
|
1164
|
-
declare function documentVisible(): ActivityPredicate;
|
|
1165
|
-
/** {@link ActivityPredicate} that is true while the window has focus. */
|
|
1166
|
-
declare function windowFocused(): ActivityPredicate;
|
|
1167
|
-
/** An event target, or a function resolving one, accepted by {@link on}. */
|
|
1168
|
-
type ListenerTarget = EventTarget | (() => EventTarget | null | undefined);
|
|
1169
|
-
type ListenerOptions = boolean | AddEventListenerOptions | undefined;
|
|
1170
|
-
/** Attach an owned event listener to `target` for the current component's lifetime. */
|
|
1171
|
-
declare function on(target: ListenerTarget, event: string, handler: EventListener, options?: ListenerOptions): void;
|
|
1172
|
-
/** Run `fn` on an owned interval for the current component's lifetime, optionally gated by `options.when`. */
|
|
1173
|
-
declare function timer(intervalMs: number, fn: () => void, options?: TimerOptions): void;
|
|
1174
|
-
/** Runs an owned task after commit. */
|
|
1175
|
-
declare function task(fn: () => void | (() => void) | PromiseLike<void | (() => void)>): void;
|
|
1176
|
-
/** A callable reactive source accepted by {@link watch}. */
|
|
1177
|
-
type WatchSource<T> = ReadableSource<T>;
|
|
1178
|
-
/** Values inferred from an ordered tuple of {@link WatchSource} accessors. */
|
|
1179
|
-
type WatchValues<TSources extends readonly WatchSource<unknown>[]> = { -readonly [TIndex in keyof TSources]: ReturnType<TSources[TIndex]>; };
|
|
1180
|
-
/** Post-commit generation details supplied to a {@link watch} callback. */
|
|
1181
|
-
interface WatchContext<TValue> {
|
|
1182
|
-
readonly initial: boolean;
|
|
1183
|
-
readonly previous: TValue | undefined;
|
|
1184
|
-
readonly signal: AbortSignal;
|
|
1185
|
-
}
|
|
1186
|
-
/** Owned side-effect callback invoked by {@link watch}. */
|
|
1187
|
-
type WatchCallback<TValue> = (value: TValue, context: WatchContext<TValue>) => void | (() => void) | PromiseLike<void>;
|
|
1188
|
-
/** Observe one readable source after commit and whenever its value changes. */
|
|
1189
|
-
declare function watch<TValue>(source: WatchSource<TValue>, callback: WatchCallback<TValue>): void;
|
|
1190
|
-
/** Observe an ordered tuple of readable sources after commit and whenever an entry changes. */
|
|
1191
|
-
declare function watch<const TSources extends readonly WatchSource<unknown>[]>(sources: TSources, callback: WatchCallback<WatchValues<TSources>>): void;
|
|
1192
|
-
/**
|
|
1193
|
-
* Capture the result of a synchronous expression at call time and return a
|
|
1194
|
-
* thunk that returns the captured value later. This is a low-level helper for
|
|
1195
|
-
* cases where async continuations need to observe a snapshot of values at the
|
|
1196
|
-
* moment scheduling occurred.
|
|
1197
|
-
*
|
|
1198
|
-
* Usage (public API):
|
|
1199
|
-
* const snapshot = capture(() => someState());
|
|
1200
|
-
* Promise.resolve().then(() => { use(snapshot()); });
|
|
1201
|
-
*/
|
|
1202
|
-
declare function capture<T>(fn: () => T): () => T;
|
|
1203
|
-
//#endregion
|
|
1204
|
-
//#region src/runtime/render-diagnostics.d.ts
|
|
1205
|
-
interface RenderDiagnosticsOptions {
|
|
1206
|
-
/** Emit one warning per component instance when a render exceeds the threshold. */
|
|
1207
|
-
slowRenderWarnings?: boolean;
|
|
1208
|
-
/** Slow-render threshold in milliseconds. The default is 5. */
|
|
1209
|
-
slowRenderThresholdMs?: number;
|
|
1210
|
-
}
|
|
1211
|
-
/**
|
|
1212
|
-
* Configure development render diagnostics and return a function that restores
|
|
1213
|
-
* the previous configuration. Component counters and timing remain enabled
|
|
1214
|
-
* when warning output is disabled.
|
|
1215
|
-
*/
|
|
1216
|
-
declare function configureRenderDiagnostics(options: RenderDiagnosticsOptions): () => void;
|
|
1217
|
-
//#endregion
|
|
1218
|
-
//#region src/runtime/selector.d.ts
|
|
1219
|
-
/** A fine-grained reactive membership check produced by {@link selector}. */
|
|
1220
|
-
interface Selector<T> {
|
|
1221
|
-
(candidate: T): boolean;
|
|
1222
|
-
}
|
|
1223
|
-
type SelectorEquals<T> = {
|
|
1224
|
-
bivarianceHack(a: T, b: T): boolean;
|
|
1225
|
-
}['bivarianceHack'];
|
|
1226
|
-
/**
|
|
1227
|
-
* Creates a render-scoped predicate for keyed membership in reactive list rows.
|
|
1228
|
-
*
|
|
1229
|
-
* Use this when a `<For>` child needs to compare each stable item with a
|
|
1230
|
-
* changing selected value. Unlike a plain closure capture, the predicate
|
|
1231
|
-
* subscribes the affected rows and updates them without rebuilding the list.
|
|
1232
|
-
* Must be called during component render.
|
|
1233
|
-
*/
|
|
1234
|
-
declare function selector<T>(source: () => T, equals?: SelectorEquals<T>): Selector<T>;
|
|
1235
|
-
//#endregion
|
|
1236
|
-
//#region src/control/shared.d.ts
|
|
1237
|
-
type BoundaryChild = RenderableChild;
|
|
1238
|
-
//#endregion
|
|
1239
|
-
//#region src/control/for.d.ts
|
|
1240
|
-
type ForBaseProps<T> = {
|
|
1241
|
-
each: ForEachSource<T>;
|
|
1242
|
-
fallback?: BoundaryChild;
|
|
1243
|
-
/**
|
|
1244
|
-
* Row renderer. Parent reactive reads must use `selector()` or thunk props;
|
|
1245
|
-
* closure-captured values are snapshotted when the row is created or
|
|
1246
|
-
* reconciled; changing the parent source does not rerun an existing row.
|
|
1247
|
-
*/
|
|
1248
|
-
children: (item: T, index: () => number) => VNode;
|
|
1249
|
-
};
|
|
1250
|
-
type KeyedForProps<T, K extends string | number> = ForBaseProps<T> & {
|
|
1251
|
-
by: (item: T, index: number) => K;
|
|
1252
|
-
byIndex?: never;
|
|
1253
|
-
};
|
|
1254
|
-
type IndexedForProps<T> = ForBaseProps<T> & {
|
|
1255
|
-
by?: never;
|
|
1256
|
-
byIndex: true;
|
|
1257
|
-
};
|
|
1258
|
-
/** Props for {@link For}. */
|
|
1259
|
-
type ForProps<T, K extends string | number = string | number> = KeyedForProps<T, K> | IndexedForProps<T>;
|
|
1260
|
-
/** Render a keyed or indexed list, reconciling items by key instead of position. */
|
|
1261
|
-
declare const For: <T, K extends string | number = string | number>(props: ForProps<T, K>) => JSXElement;
|
|
1262
|
-
//#endregion
|
|
1263
|
-
//#region src/control/show.d.ts
|
|
1264
|
-
type ShowSource<T> = T | (() => T);
|
|
1265
|
-
type Truthy<T> = T extends false | '' | 0 | 0n | null | undefined ? never : T;
|
|
1266
|
-
/** Props for {@link Show}. */
|
|
1267
|
-
type ShowProps<T> = {
|
|
1268
|
-
when: ShowSource<T>;
|
|
1269
|
-
fallback?: BoundaryChild;
|
|
1270
|
-
children: BoundaryChild | ((value: Truthy<T>) => BoundaryChild);
|
|
1271
|
-
};
|
|
1272
|
-
/** Conditionally render children based on `when`, narrowing truthy values for the render function form. */
|
|
1273
|
-
declare const Show: <T>(props: ShowProps<T>) => JSXElement;
|
|
1274
|
-
//#endregion
|
|
1275
|
-
//#region src/control/case.d.ts
|
|
1276
|
-
type MatchChild = BoundaryChild | (() => BoundaryChild);
|
|
1277
|
-
/** Props for {@link Match}, valid only as a direct child of {@link Case}. */
|
|
1278
|
-
type MatchProps = {
|
|
1279
|
-
key?: string | number | null;
|
|
1280
|
-
when: unknown;
|
|
1281
|
-
children: MatchChild;
|
|
1282
|
-
};
|
|
1283
|
-
/** Props for {@link Case}. */
|
|
1284
|
-
type CaseProps = {
|
|
1285
|
-
fallback?: BoundaryChild;
|
|
1286
|
-
children?: unknown;
|
|
1287
|
-
};
|
|
1288
|
-
/** Declares one branch of a {@link Case}; only valid as its direct child. */
|
|
1289
|
-
declare function Match(_props: MatchProps): null;
|
|
1290
|
-
/** Render the first matching {@link Match} child (by `when`), or `fallback` if none match. */
|
|
1291
|
-
declare const Case: (props: CaseProps) => JSXElement;
|
|
1292
|
-
//#endregion
|
|
1293
|
-
//#region src/csp-nonce.d.ts
|
|
1294
|
-
/** Lexical scope carrying the CSP nonce for the current render, if any. */
|
|
1295
|
-
declare const CspNonceScope: Scope<string | undefined>;
|
|
1296
|
-
/**
|
|
1297
|
-
* Read the CSP nonce for the current render from {@link CspNonceScope}.
|
|
1298
|
-
*
|
|
1299
|
-
* @returns The active nonce, or `undefined` when called outside of a
|
|
1300
|
-
* component render or when no nonce was configured.
|
|
1301
|
-
*/
|
|
1302
|
-
declare function cspNonce(): string | undefined;
|
|
1303
|
-
//#endregion
|
|
1304
|
-
//#region src/common/render-context.d.ts
|
|
1305
|
-
interface DeferredBoundaryRegistration {
|
|
1306
|
-
id: string;
|
|
1307
|
-
promise: Promise<unknown>;
|
|
1308
|
-
fulfilled(value: unknown): RenderableChild;
|
|
1309
|
-
rejected(error: unknown): RenderableChild;
|
|
1310
|
-
}
|
|
1311
|
-
interface SSRPortalHostRegistration {
|
|
1312
|
-
token: string;
|
|
1313
|
-
automatic: boolean;
|
|
1314
|
-
}
|
|
1315
|
-
interface SSRPortalSlot {
|
|
1316
|
-
hasValue: boolean;
|
|
1317
|
-
value: RenderableChild | undefined;
|
|
1318
|
-
hosts: SSRPortalHostRegistration[];
|
|
1319
|
-
}
|
|
1320
|
-
interface SSRPortalState {
|
|
1321
|
-
slots: Map<object, SSRPortalSlot>;
|
|
1322
|
-
nextHostId: number;
|
|
1323
|
-
}
|
|
1324
|
-
/** Register request-local CSS produced during SSR without importing the SSR renderer in clients. */
|
|
1325
|
-
declare function registerSSRStyle(id: string, cssText: string): void;
|
|
1326
|
-
//#endregion
|
|
1327
|
-
//#region src/ref.d.ts
|
|
1328
|
-
/**
|
|
1329
|
-
* Creates a stable holder for an intrinsic element ref.
|
|
1330
|
-
*
|
|
1331
|
-
* The renderer mutates `current` during commit and clears it during cleanup.
|
|
1332
|
-
* Updating the holder never schedules a render.
|
|
1333
|
-
*/
|
|
1334
|
-
interface Ref<T extends Element = Element> {
|
|
1335
|
-
current: T | null;
|
|
1336
|
-
}
|
|
1337
|
-
/** Create a new, empty {@link Ref} holder. */
|
|
1338
|
-
declare function createRef<T extends Element = Element>(): Ref<T>;
|
|
1339
|
-
//#endregion
|
|
1340
|
-
//#region src/data/mutation-cell.d.ts
|
|
1341
|
-
/**
|
|
1342
|
-
* Create a reactive {@link Mutation} cell bound to the current component,
|
|
1343
|
-
* running `options.action` on `execute()` and optionally invalidating
|
|
1344
|
-
* affected query prefixes on success.
|
|
1345
|
-
*/
|
|
1346
|
-
declare function createMutation<TInput, TResult>(options: MutationOptions<TInput, TResult>): Mutation<TInput, TResult>;
|
|
1347
|
-
//#endregion
|
|
1348
|
-
//#region src/data/query-cell.d.ts
|
|
1349
|
-
/**
|
|
1350
|
-
* Create a reactive {@link Query} cell bound to the current component, either
|
|
1351
|
-
* from inline `options` (key + fetch) or a reusable {@link QueryDefinition}
|
|
1352
|
-
* plus its input.
|
|
1353
|
-
*/
|
|
1354
|
-
declare function createQuery<T extends {}>(options: QueryOptions<T>): Query<T>;
|
|
1355
|
-
declare function createQuery<TInput, TResult extends {}>(definition: QueryDefinition<TInput, TResult>, input: TInput, options?: Omit<QueryOptions<TResult>, 'key' | 'fetch'>): Query<TResult>;
|
|
1356
|
-
//#endregion
|
|
1357
|
-
//#region src/data/data-runtime.d.ts
|
|
1358
|
-
/** Create a new, isolated {@link DataRuntime} with its own query/mutation caches. */
|
|
1359
|
-
declare function createDataRuntime(options?: DataRuntimeOptions): DataRuntime;
|
|
1360
|
-
/** Get the process-wide default {@link DataRuntime} used when none is provided explicitly. */
|
|
1361
|
-
declare function getDefaultDataRuntime(): DataRuntime;
|
|
1362
|
-
//#endregion
|
|
1363
|
-
//#region src/data/invalidation.d.ts
|
|
1364
|
-
/** Mark all cached queries whose key starts with `prefix` as stale, triggering a refresh. */
|
|
1365
|
-
declare function invalidate(prefix: string, options?: InvalidateOptions): void;
|
|
1366
|
-
/** Create a {@link QueryScope} that namespaces keys and invalidations under `namespace`. */
|
|
1367
|
-
declare function queryScope(namespace: string): QueryScope;
|
|
1368
|
-
/**
|
|
1369
|
-
* Periodically invalidate queries matching `prefix` on a fixed interval,
|
|
1370
|
-
* optionally gated by active route, document visibility, or window focus.
|
|
1371
|
-
*/
|
|
1372
|
-
declare function invalidateOnInterval(prefix: string, options: InvalidateOnIntervalOptions): void;
|
|
1373
|
-
//#endregion
|
|
1374
|
-
//#region src/data/query-collection.d.ts
|
|
1375
|
-
/**
|
|
1376
|
-
* Create one lifecycle-owned collection of dynamically keyed readers for a
|
|
1377
|
-
* reusable query definition, with bounded collection-started fetches.
|
|
1378
|
-
*/
|
|
1379
|
-
declare function createQueryCollection<TInput, TResult extends {}, TKey extends QueryCollectionKey = string>(options: QueryCollectionOptions<TInput, TResult, TKey>): QueryCollection<TInput, TResult, TKey>;
|
|
1380
|
-
//#endregion
|
|
1381
|
-
//#region src/data/query-registry.d.ts
|
|
1382
|
-
/** Lookup table of server handlers keyed by their {@link QueryDefinition}, built by {@link defineServerQueries}. */
|
|
1383
|
-
interface ServerQueryRegistry {
|
|
1384
|
-
readonly entries: readonly ServerQueryEntry<unknown, {}>[];
|
|
1385
|
-
get<TInput, TResult extends {}>(query: QueryDefinition<TInput, TResult>): ServerQueryHandler<TInput, TResult> | undefined;
|
|
1386
|
-
}
|
|
1387
|
-
/** A query paired with the server handler that resolves it, produced by {@link serveQuery}. */
|
|
1388
|
-
interface ServerQueryEntry<TInput, TResult extends {}> {
|
|
1389
|
-
readonly query: QueryDefinition<TInput, TResult>;
|
|
1390
|
-
readonly handler: ServerQueryHandler<TInput, TResult>;
|
|
1391
|
-
}
|
|
1392
|
-
/** Pair a {@link QueryDefinition} with the server-side handler that resolves it. */
|
|
1393
|
-
declare function serveQuery<TInput, TResult extends {}>(query: QueryDefinition<TInput, TResult>, handler: ServerQueryHandler<TInput, TResult>): ServerQueryEntry<TInput, TResult>;
|
|
1394
|
-
/** Build a {@link ServerQueryRegistry} from one or more {@link serveQuery} entries. */
|
|
1395
|
-
declare function defineServerQueries(...entries: readonly ServerQueryEntry<any, any>[]): ServerQueryRegistry;
|
|
1396
|
-
/** Freeze and return a reusable {@link QueryDefinition}. */
|
|
1397
|
-
declare function defineQuery<TInput, TResult extends {}>(definition: QueryDefinition<TInput, TResult>): QueryDefinition<TInput, TResult>;
|
|
1398
|
-
/**
|
|
1399
|
-
* Create a {@link QueryPrefetchContext} for prefetching query data ahead of
|
|
1400
|
-
* render, e.g. during SSR route resolution.
|
|
1401
|
-
*/
|
|
1402
|
-
declare function createQueryPrefetchContext(options?: {
|
|
1403
|
-
runtime?: DataRuntime;
|
|
1404
|
-
registry?: ServerQueryRegistry;
|
|
1405
|
-
request?: Request;
|
|
1406
|
-
signal?: AbortSignal;
|
|
1407
|
-
mode?: 'ssr' | 'spa';
|
|
1408
|
-
telemetry?: CoreTelemetry;
|
|
1409
|
-
}): QueryPrefetchContext;
|
|
1410
|
-
/** Prefetch `query` with `input` into a {@link QueryPrefetchContext}'s runtime. */
|
|
1411
|
-
declare function prefetchQuery<TInput, TResult extends {}>(context: QueryPrefetchContext, query: QueryDefinition<TInput, TResult>, input: TInput): Promise<boolean>;
|
|
1412
|
-
/** Extract a runtime's cached query data into a JSON-serializable snapshot, dropping non-serializable values. */
|
|
1413
|
-
declare function dehydrateDataRuntime(runtime: DataRuntime): Record<string, unknown>;
|
|
1414
|
-
/** Load a {@link dehydrateDataRuntime} snapshot back into a runtime's query cache. */
|
|
1415
|
-
declare function hydrateDataRuntime(runtime: DataRuntime, data: unknown): void;
|
|
1416
|
-
//#endregion
|
|
1417
|
-
//#region src/actions/index.d.ts
|
|
1418
|
-
/** A declared server action, built by {@link defineAction}, bound to a form via {@link ActionForm}. */
|
|
1419
|
-
interface ActionDescriptor<TInput extends Record<string, unknown> = Record<string, unknown>> {
|
|
1420
|
-
readonly id: string;
|
|
1421
|
-
readonly input: ObjectSchema<TInput>;
|
|
1422
|
-
readonly invalidates: readonly string[];
|
|
1423
|
-
}
|
|
1424
|
-
/** Declare a server action with a stable id, input schema, and query prefixes to invalidate on success. */
|
|
1425
|
-
declare function defineAction<TInput extends Record<string, unknown>>(options: {
|
|
1426
|
-
readonly id: string;
|
|
1427
|
-
readonly input: ObjectSchema<TInput>;
|
|
1428
|
-
readonly invalidates?: readonly string[];
|
|
1429
|
-
}): ActionDescriptor<TInput>;
|
|
1430
|
-
/** A native form bound to a declared action; it is not a synthetic event API. */
|
|
1431
|
-
declare function ActionForm<TInput extends Record<string, unknown>>({ action, children, ...props }: {
|
|
1432
|
-
readonly action: ActionDescriptor<TInput>;
|
|
1433
|
-
readonly children?: RenderableChild;
|
|
1434
|
-
readonly [key: string]: unknown;
|
|
1435
|
-
}): JSXElement;
|
|
1436
|
-
/** Server-replayed validation failure for an {@link ActionForm} submission. */
|
|
1437
|
-
interface ActionValidationError {
|
|
1438
|
-
readonly kind: 'invalid';
|
|
1439
|
-
readonly action: string;
|
|
1440
|
-
readonly values: Readonly<Record<string, unknown>>;
|
|
1441
|
-
readonly issues: readonly unknown[];
|
|
1442
|
-
readonly fieldErrors: Readonly<Record<string, readonly string[]>>;
|
|
1443
|
-
}
|
|
1444
|
-
/** Pending/result/error status for an action, as reported by the `action()` hook. */
|
|
1445
|
-
interface ActionStatus<TResult = unknown> {
|
|
1446
|
-
readonly pending: boolean;
|
|
1447
|
-
readonly result?: TResult;
|
|
1448
|
-
readonly error?: unknown;
|
|
1449
|
-
}
|
|
1450
|
-
/** Returns a command handle, rather than a hook. */
|
|
1451
|
-
declare function action<TInput extends Record<string, unknown>, TResult = unknown>(descriptor: ActionDescriptor<TInput>): {
|
|
1452
|
-
state: StateTuple<ActionStatus<TResult>>;
|
|
1453
|
-
submit(input: TInput): Promise<TResult>;
|
|
1454
|
-
};
|
|
1455
|
-
//#endregion
|
|
1456
|
-
export { routeActive as $, RouteSnapshot as $t, cspNonce as A, SSRStyleRegistrationValidation as An, RouteDefinition as At, selector as B, RoutePathParams as Bt, createMutation as C, RenderableChild as Cn, PageScopeRecord as Ct, SSRPortalState as D, DocumentRenderer as Dn, RouteAuthResolver as Dt, DeferredBoundaryRegistration as E, DocumentRenderContext as En, RouteAuthOptions as Et, Show as F, RouteMeta as Ft, TimerOptions as G, RouteRefSearch as Gt, configureRenderDiagnostics as H, RouteQuery as Ht, ShowProps as I, RouteMetaSource as It, WatchSource as J, RouteRenderResult as Jt, WatchCallback as K, RouteRegistry as Kt, For as L, RouteMode as Lt, CaseProps as M, StateSetter as Mn, RouteHandler as Mt, Match as N, StateTuple as Nn, RouteManifest as Nt, registerSSRStyle as O, SSRData as On, RouteComponent as Ot, MatchProps as P, state as Pn, RouteMatch as Pt, on as Q, RouteSearchValue as Qt, ForProps as R, RouteOptions as Rt, createQuery as S, ComponentFunction as Sn, PageHelperOptions as St, createRef as T, DocumentRenderArgs as Tn, Route as Tt, ActivityPredicate as U, RouteRecord as Ut, RenderDiagnosticsOptions as V, RoutePolicy as Vt, ListenerTarget as W, RouteRef as Wt, capture as X, RouteRequestResult as Xt, WatchValues as Y, RouteRequestOptions as Yt, documentVisible as Z, RouteSearch as Zt, invalidate as _, QueryStaleReason as _n, AccessDenyStatus as _t, action as a, Mutation as an, derive as at, createDataRuntime as b, defineScope as bn, GroupHelperOptions as bt, ServerQueryRegistry as c, QueryCollection as cn, RuntimeKeyedReorderDecision as ct, defineServerQueries as d, QueryCollectionOptions as dn, getDefaultRuntime as dt, CoreTelemetry as en, task as et, dehydrateDataRuntime as f, QueryConsistency as fn, scheduleEventHandler as ft, createQueryCollection as g, QueryScope as gn, AccessDenyDecision as gt, serveQuery as h, QueryPrefetchContext as hn, AccessDecision as ht, ActionValidationError as i, InvalidateOptions as in, Derived as it, Case as j, State as jn, RouteDestination as jt, CspNonceScope as k, SSRStyleRegistration as kn, RouteContext as kt, createQueryPrefetchContext as l, QueryCollectionEntry as ln, RuntimeRendererHost as lt, prefetchQuery as m, QueryKeyPart as mn, AccessAllowDecision as mt, ActionForm as n, DataRuntimeOptions as nn, watch as nt, defineAction as o, MutationOptions as on, AskrRuntime as ot, hydrateDataRuntime as p, QueryDefinition as pn, getSignal as pt, WatchContext as q, RouteRegistryOptions as qt, ActionStatus as r, InvalidateOnIntervalOptions as rn, windowFocused as rt, ServerQueryEntry as s, Query as sn, AskrRuntimeOptions as st, ActionDescriptor as t, DataRuntime as tn, timer as tt, defineQuery as u, QueryCollectionKey as un, createRuntime as ut, invalidateOnInterval as v, ServerQueryHandler as vn, AccessRedirectDecision as vt, Ref as w, VNode as wn, ParsedSegment as wt, getDefaultDataRuntime as x, readScope as xn, LayoutScopeRecord as xt, queryScope as y, Scope as yn, AccessRedirectStatus as yt, Selector as z, RouteParams as zt };
|