@askrjs/askr 0.0.90 → 0.0.92
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/dist/{access-Dpfoi4cA.js → access-DSkccuEI.js} +5 -2
- package/dist/actions/index.d.ts +1 -1
- package/dist/actions/index.js +4 -4
- package/dist/{activity-CQKEAORw.js → activity-DodHdC0L.js} +8 -6
- package/dist/{activity-CF2_JvJs.d.ts → activity-DxUcygE5.d.ts} +1 -1
- package/dist/benchmark.d.ts +1 -1
- package/dist/benchmark.js +8 -8
- package/dist/boot/index.d.ts +3 -4
- package/dist/boot/index.js +1 -1
- package/dist/{boot-D5GZU_g4.js → boot-D71bjP4r.js} +28 -22
- package/dist/{cleanup-c837KVij.js → cleanup-DAAhJjx5.js} +8 -5
- package/dist/{component-cleanup-BUfUleGZ.js → component-cleanup-CJCfu5ed.js} +3 -3
- package/dist/{component-internal-C4uwwUaK.js → component-internal-DlAkCgBE.js} +5 -5
- package/dist/{component-scope-DzJEbYGE.js → component-scope-4I3yEMkb.js} +13 -1
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +1 -1
- package/dist/control/index.d.ts +1 -1
- package/dist/control/index.js +1 -1
- package/dist/{control-CsGs2bLS.d.ts → control-CdzY49Q2.d.ts} +1 -1
- package/dist/{control-CON10J1p.js → control-Dv540XtV.js} +4 -4
- package/dist/{csp-nonce-DH0TrDij.js → csp-nonce-ByMbWv8s.js} +1 -1
- package/dist/data/index.d.ts +1 -2
- package/dist/data/index.js +3 -3
- package/dist/{data-BmZC1kDn.js → data-DcikEH9N.js} +13 -13
- package/dist/{data-runtime-SC6zzAwh.js → data-runtime-oIdQWnPW.js} +2 -2
- package/dist/{deferred-Bh-nZhZF.js → deferred-B6CafO5u.js} +6 -6
- package/dist/{effect-lnxQIpJG.js → effect-BdZcHblj.js} +73 -14
- package/dist/{fastlane-CrfB3QG0.js → fastlane-B2s24fWt.js} +22 -3
- package/dist/{for-internal-Bsm0B8GZ.js → for-internal-T1C7jd7x.js} +6 -6
- package/dist/foundations/icon/index.d.ts +1 -2
- package/dist/foundations/index.d.ts +2 -2
- package/dist/foundations/index.js +1 -1
- package/dist/foundations/state/index.d.ts +1 -1
- package/dist/foundations/state/index.js +1 -1
- package/dist/foundations/structures/index.d.ts +2 -2
- package/dist/foundations/structures/index.js +1 -1
- package/dist/fx/index.js +2 -2
- package/dist/{types-iAmDSV6o.d.ts → index-2bk8nldG.d.ts} +63 -1
- package/dist/index-DA3g8lm8.d.ts +955 -0
- package/dist/{index-Cf2ANwPL.d.ts → index-oswRaMn6.d.ts} +2 -3
- package/dist/index.d.ts +4 -7
- package/dist/index.js +32 -17
- package/dist/jsx-dev-runtime.d.ts +2 -3
- package/dist/jsx-runtime-C_0v1pMN.d.ts +2 -0
- package/dist/{jsx-runtime-LHh5tcTe.d.ts → jsx-runtime-Cfb2umb4.d.ts} +2 -3
- package/dist/jsx-runtime.d.ts +2 -2
- package/dist/{lifecycle-batch-Dfpid9-A.js → lifecycle-batch-Cyfd07rf.js} +2 -2
- package/dist/{lifecycle-operations-CMK1AN2C.js → lifecycle-operations-CQ8fsc94.js} +2 -2
- package/dist/{manifest-D1P9uTlz.js → manifest-Dv0bO6kg.js} +1 -1
- package/dist/{navigate-DIOaNAcS.js → navigate-BbWj-QU-.js} +12 -10
- package/dist/{navigate-BO7M2iUG.d.ts → navigate-CZHPEUC4.d.ts} +1 -1
- package/dist/{query-registry-IACQeDqi.js → query-registry-qm13pEdK.js} +1 -1
- package/dist/{readable-B5NtV7V0.js → readable-B99wh5Z_.js} +9 -6
- package/dist/{render-context-D0Hoj9dW.js → render-context-B7ohlh6t.js} +17 -1
- package/dist/{renderer-y2DL627q.js → renderer-C6jz9nIN.js} +234 -188
- package/dist/{resolution-D3UO6aKA.js → resolution-B21kmOkp.js} +6 -6
- package/dist/{resource-operation-CYDU3XzS.js → resource-operation-CaAttQqz.js} +6 -6
- package/dist/resources/index.d.ts +2 -2
- package/dist/resources/index.js +6 -6
- package/dist/{route-matching-DqULzZtC.js → route-matching-Bo6UqG-5.js} +14 -5
- package/dist/router/index.d.ts +4 -6
- package/dist/router/index.js +7 -7
- package/dist/{selector-BLNkRZ2i.js → selector-BLWwI55m.js} +22 -5
- package/dist/ssg/index.d.ts +1 -2
- package/dist/ssg/index.js +6 -6
- package/dist/ssr/index.d.ts +3 -5
- package/dist/ssr/index.js +2 -2
- package/dist/{ssr-VdXmmJqx.js → ssr-CaZfvQWn.js} +14 -13
- package/dist/{state-DCjONcHK.js → state-XPZYUzHL.js} +5 -5
- package/dist/{structures--NKfTh3j.js → structures-DKjkAmM5.js} +6 -6
- package/dist/testing/index.d.ts +2 -3
- package/dist/testing/index.js +6 -6
- package/dist/{jsx-BYXe_Nnk.d.ts → types-BA9FJtfR.d.ts} +16 -0
- package/dist/{verify-hydration-wRofFN5b.js → verify-hydration-CcF-HJil.js} +4 -3
- package/package.json +1 -1
- package/dist/control-D-FIa-n-.d.ts +0 -451
- package/dist/index-BU17hud9.d.ts +0 -52
- package/dist/index-CPlPDbEY.d.ts +0 -64
- package/dist/index-Izwp_ESC.d.ts +0 -458
- package/dist/jsx-runtime-BqhMEuT4.d.ts +0 -2
- package/dist/types-CsPtBGWb.d.ts +0 -16
|
@@ -0,0 +1,955 @@
|
|
|
1
|
+
import { i as JSXElementType, r as JSXElement, s as Props } from "./types-BA9FJtfR.js";
|
|
2
|
+
import { O as QueryPrefetchContext, _ as CoreTelemetry, v as DataRuntime } from "./index-2bk8nldG.js";
|
|
3
|
+
import { t as Scheduler } from "./scheduler-CmLO4Dfm.js";
|
|
4
|
+
import "./jsx-runtime-C_0v1pMN.js";
|
|
5
|
+
import { AuthContext, AuthRequirement } from "@askrjs/auth";
|
|
6
|
+
import { InferSchema, ObjectSchema } from "@askrjs/schema";
|
|
7
|
+
//#region src/runtime/state.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* State value holder - callable to read, has set method to update
|
|
10
|
+
* @example
|
|
11
|
+
* const count = state(0);
|
|
12
|
+
* count(); // read: 0
|
|
13
|
+
* count.set(1); // write: triggers re-render
|
|
14
|
+
*/
|
|
15
|
+
interface State<T> extends ReadableSource<T> {
|
|
16
|
+
(): T;
|
|
17
|
+
set(...args: StateSetterArgs<T>): void;
|
|
18
|
+
[Symbol.iterator](): IterableIterator<StateTuple<T>[number]>;
|
|
19
|
+
}
|
|
20
|
+
type StateUpdater<T> = (prev: T) => T;
|
|
21
|
+
type StateSetterArgs<T> = [Extract<T, (...args: any[]) => unknown>] extends [never] ? [value: T] | [updater: StateUpdater<T>] : [updater: StateUpdater<T>];
|
|
22
|
+
/**
|
|
23
|
+
* Public setter type for state cells.
|
|
24
|
+
*/
|
|
25
|
+
type StateSetter<T> = (...args: StateSetterArgs<T>) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Tuple-first state handle returned by `state()`.
|
|
28
|
+
*/
|
|
29
|
+
type StateTuple<T> = [get: State<T>, set: StateSetter<T>] & State<T>;
|
|
30
|
+
/**
|
|
31
|
+
* Creates a local state value for a component
|
|
32
|
+
* Optimized for:
|
|
33
|
+
* - O(1) read performance
|
|
34
|
+
* - Minimal allocation per state
|
|
35
|
+
* - Fast scheduler integration
|
|
36
|
+
*
|
|
37
|
+
* IMPORTANT: state() must be called during component render execution.
|
|
38
|
+
* It captures the current component instance from context.
|
|
39
|
+
* Calling outside a component function will throw an error.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* // ✅ Correct: called during render
|
|
44
|
+
* export function Counter() {
|
|
45
|
+
* const [count, setCount] = state(0);
|
|
46
|
+
* return { type: 'button', children: [count()] };
|
|
47
|
+
* }
|
|
48
|
+
*
|
|
49
|
+
* // ❌ Wrong: called outside component
|
|
50
|
+
* const count = state(0);
|
|
51
|
+
* export function BadComponent() {
|
|
52
|
+
* return { type: 'div' };
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
declare function state<T>(initialValue: T): StateTuple<T>;
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/common/ssr.d.ts
|
|
59
|
+
/**
|
|
60
|
+
* Common call contracts: SSR types
|
|
61
|
+
*/
|
|
62
|
+
type SSRData = Record<string, unknown>;
|
|
63
|
+
/** Styles produced while rendering a request, kept with that request's SSR context. */
|
|
64
|
+
interface SSRStyleRegistration {
|
|
65
|
+
id: string;
|
|
66
|
+
cssText: string;
|
|
67
|
+
}
|
|
68
|
+
interface DocumentRenderRoute {
|
|
69
|
+
path: string;
|
|
70
|
+
namespace?: string;
|
|
71
|
+
}
|
|
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
|
+
interface DocumentRenderArgs {
|
|
86
|
+
appHtml: string;
|
|
87
|
+
context: DocumentRenderContext;
|
|
88
|
+
}
|
|
89
|
+
type DocumentRenderer = (args: DocumentRenderArgs) => string;
|
|
90
|
+
type SSRStyleRegistrationValidation = 'warn' | 'error' | 'off';
|
|
91
|
+
/** Full context for sink-based streaming SSR */
|
|
92
|
+
type SSRContext = {
|
|
93
|
+
url: string;
|
|
94
|
+
seed: number;
|
|
95
|
+
data?: SSRData;
|
|
96
|
+
params?: Record<string, string>;
|
|
97
|
+
signal?: AbortSignal;
|
|
98
|
+
};
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/common/vnode.d.ts
|
|
101
|
+
interface DOMElement {
|
|
102
|
+
type: JSXElementType;
|
|
103
|
+
props?: Props;
|
|
104
|
+
children?: VNode[];
|
|
105
|
+
key?: string | number | null;
|
|
106
|
+
[Symbol.iterator]?: never;
|
|
107
|
+
_controlState?: ControlBoundaryState;
|
|
108
|
+
}
|
|
109
|
+
type VNode = DOMElement | string | number | boolean | null | undefined;
|
|
110
|
+
type RenderableChild = VNode | JSXElement | readonly RenderableChild[];
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region src/common/component.d.ts
|
|
113
|
+
type ComponentContext = {
|
|
114
|
+
signal: AbortSignal;
|
|
115
|
+
ssr?: SSRContext;
|
|
116
|
+
};
|
|
117
|
+
type ComponentFunction = (props: Props, context?: ComponentContext) => JSXElement | VNode;
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region src/runtime/context.d.ts
|
|
120
|
+
type ContextKey = symbol;
|
|
121
|
+
type Renderable = RenderableChild;
|
|
122
|
+
type ContextScopeChildren = Renderable | (() => Renderable);
|
|
123
|
+
interface Scope<T> {
|
|
124
|
+
(props: {
|
|
125
|
+
value: T;
|
|
126
|
+
children?: ContextScopeChildren;
|
|
127
|
+
}): JSXElement;
|
|
128
|
+
readonly key: ContextKey;
|
|
129
|
+
readonly defaultValue: T;
|
|
130
|
+
}
|
|
131
|
+
interface ContextFrame {
|
|
132
|
+
parent: ContextFrame | null;
|
|
133
|
+
values: Map<ContextKey, unknown> | null;
|
|
134
|
+
}
|
|
135
|
+
declare function defineScope<T>(defaultValue: T): Scope<T>;
|
|
136
|
+
declare function readScope<T>(context: Scope<T>): T;
|
|
137
|
+
//#endregion
|
|
138
|
+
//#region src/runtime/component-cleanup.d.ts
|
|
139
|
+
type OwnedChildScope = {
|
|
140
|
+
key: string | number;
|
|
141
|
+
dispose(): void;
|
|
142
|
+
};
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region src/common/router.d.ts
|
|
145
|
+
/**
|
|
146
|
+
* Common call contracts: Router types
|
|
147
|
+
*/
|
|
148
|
+
type RouteParams = Record<string, string>;
|
|
149
|
+
type StripRoutePathSuffix<Path extends string> = Path extends `${infer Base}?${string}` ? StripRoutePathSuffix<Base> : Path extends `${infer Base}#${string}` ? StripRoutePathSuffix<Base> : Path;
|
|
150
|
+
type TrimRoutePathSlashes<Path extends string> = Path extends `/${infer Rest}` ? TrimRoutePathSlashes<Rest> : Path extends `${infer Rest}/` ? TrimRoutePathSlashes<Rest> : Path;
|
|
151
|
+
type TrimRoutePathWhitespace<Path extends string> = Path extends `${' ' | '\n' | '\t' | '\r'}${infer Rest}` ? TrimRoutePathWhitespace<Rest> : Path extends `${infer Rest}${' ' | '\n' | '\t' | '\r'}` ? TrimRoutePathWhitespace<Rest> : Path;
|
|
152
|
+
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;
|
|
153
|
+
type ExtractRoutePathParamNames<Path extends string> = TrimRoutePathSlashes<StripRoutePathSuffix<Path>> extends `${infer Segment}/${infer Rest}` ? ExtractRouteSegmentParam<Segment> | ExtractRoutePathParamNames<Rest> : ExtractRouteSegmentParam<TrimRoutePathSlashes<StripRoutePathSuffix<Path>>>;
|
|
154
|
+
type RoutePathParams<Path extends string> = [ExtractRoutePathParamNames<Path>] extends [never] ? Record<never, string> : { [Key in ExtractRoutePathParamNames<Path>]: string; };
|
|
155
|
+
/**
|
|
156
|
+
* A route page component: a regular component that receives route params as
|
|
157
|
+
* props derived from the URL pattern.
|
|
158
|
+
*
|
|
159
|
+
* Components may accept no params at all — zero-argument components are still
|
|
160
|
+
* assignable.
|
|
161
|
+
*/
|
|
162
|
+
type RouteComponent<TParams extends RouteParams = RouteParams> = (props: TParams) => RenderableChild;
|
|
163
|
+
type RouteMode = 'spa' | 'ssr' | 'ssg';
|
|
164
|
+
type AccessRedirectStatus = 301 | 302 | 303 | 307 | 308;
|
|
165
|
+
type AccessDenyStatus = 401 | 403 | 404;
|
|
166
|
+
interface AccessAllowDecision {
|
|
167
|
+
kind: 'allow';
|
|
168
|
+
}
|
|
169
|
+
interface AccessRedirectDecision {
|
|
170
|
+
kind: 'redirect';
|
|
171
|
+
to: string;
|
|
172
|
+
status?: AccessRedirectStatus;
|
|
173
|
+
replace?: boolean;
|
|
174
|
+
}
|
|
175
|
+
interface AccessDenyDecision {
|
|
176
|
+
kind: 'deny';
|
|
177
|
+
status: AccessDenyStatus;
|
|
178
|
+
}
|
|
179
|
+
type AccessDecision = AccessAllowDecision | AccessRedirectDecision | AccessDenyDecision;
|
|
180
|
+
interface RouteContext<TParams extends RouteParams = RouteParams> {
|
|
181
|
+
mode: RouteMode;
|
|
182
|
+
params: TParams;
|
|
183
|
+
pathname: string;
|
|
184
|
+
search: string;
|
|
185
|
+
hash: string;
|
|
186
|
+
href: string;
|
|
187
|
+
auth: AuthContext;
|
|
188
|
+
signal: AbortSignal;
|
|
189
|
+
}
|
|
190
|
+
type RoutePolicy = (context: RouteContext) => AccessDecision | PromiseLike<AccessDecision>;
|
|
191
|
+
type RouteAuthResolver = (context: Omit<RouteContext, 'auth'>) => AuthContext | PromiseLike<AuthContext>;
|
|
192
|
+
interface RouteAuthOptions {
|
|
193
|
+
resolve: RouteAuthResolver;
|
|
194
|
+
loginPath?: string | ((context: RouteContext) => string | PromiseLike<string>);
|
|
195
|
+
authenticatedRedirectTo?: string | ((context: RouteContext) => string | PromiseLike<string>);
|
|
196
|
+
}
|
|
197
|
+
interface CommonAccessOptions {
|
|
198
|
+
auth?: AuthRequirement;
|
|
199
|
+
policies?: readonly RoutePolicy[];
|
|
200
|
+
}
|
|
201
|
+
type RouteMetaSource<TParams extends RouteParams = RouteParams> = RouteMeta | ((context: RouteContext<TParams>) => RouteMeta | PromiseLike<RouteMeta>);
|
|
202
|
+
/**
|
|
203
|
+
* Options for `route()` declarations.
|
|
204
|
+
*
|
|
205
|
+
* - `loader`: server data loader called before render, result passed as SSR data
|
|
206
|
+
* - `entries`: SSG entry generator — returns one param map per static page
|
|
207
|
+
* - `title`: page title hint used by SSG and document-meta integrations
|
|
208
|
+
* - `namespace`: MFE namespace key for grouped route management
|
|
209
|
+
*/
|
|
210
|
+
interface RouteOptions<TParams extends RouteParams = RouteParams, TSearchSchema extends ObjectSchema<RouteSearch> | undefined = ObjectSchema<RouteSearch> | undefined, TLoaderData = unknown, TDehydratedData = TLoaderData> extends CommonAccessOptions {
|
|
211
|
+
loader?: (context: RouteContext<TParams> & {
|
|
212
|
+
request?: Request;
|
|
213
|
+
}) => TLoaderData | PromiseLike<TLoaderData>;
|
|
214
|
+
/**
|
|
215
|
+
* Select the loader data transported to the browser for initial hydration.
|
|
216
|
+
*
|
|
217
|
+
* Server rendering still receives the complete loader value. The selector
|
|
218
|
+
* must be synchronous; client navigations rerun the loader and receive its
|
|
219
|
+
* complete result.
|
|
220
|
+
*/
|
|
221
|
+
dehydrate?: (data: TLoaderData, context: RouteContext<TParams> & {
|
|
222
|
+
request?: Request;
|
|
223
|
+
}) => TDehydratedData extends PromiseLike<unknown> ? never : TDehydratedData;
|
|
224
|
+
preload?: (context: RouteContext<TParams> & {
|
|
225
|
+
request?: Request;
|
|
226
|
+
data: QueryPrefetchContext;
|
|
227
|
+
}) => unknown;
|
|
228
|
+
entries?: () => Array<TParams> | Promise<Array<TParams>>;
|
|
229
|
+
/** Optional invalidation keys used by incremental SSG generation. */
|
|
230
|
+
invalidationKeys?: readonly string[];
|
|
231
|
+
title?: string;
|
|
232
|
+
namespace?: string;
|
|
233
|
+
search?: TSearchSchema;
|
|
234
|
+
meta?: RouteMetaSource<TParams>;
|
|
235
|
+
actions?: readonly ActionDescriptor[];
|
|
236
|
+
}
|
|
237
|
+
interface RouteMeta {
|
|
238
|
+
title?: string;
|
|
239
|
+
description?: string;
|
|
240
|
+
canonical?: string;
|
|
241
|
+
robots?: string;
|
|
242
|
+
openGraph?: Record<string, string>;
|
|
243
|
+
links?: readonly {
|
|
244
|
+
rel: string;
|
|
245
|
+
href: string;
|
|
246
|
+
[key: string]: string;
|
|
247
|
+
}[];
|
|
248
|
+
jsonLd?: unknown | readonly unknown[];
|
|
249
|
+
html?: {
|
|
250
|
+
lang?: string;
|
|
251
|
+
dir?: 'ltr' | 'rtl' | 'auto';
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
/** A stable, typed reference returned by route() for destination construction. */
|
|
255
|
+
type RouteSearchValue = string | number | boolean | null | undefined | readonly (string | number | boolean | null)[];
|
|
256
|
+
type RouteSearch = Record<string, RouteSearchValue>;
|
|
257
|
+
interface RouteRef<TParams extends RouteParams = RouteParams, TSearch = RouteSearch> {
|
|
258
|
+
readonly path: string;
|
|
259
|
+
/** @internal Executable schema retained for destination validation. */
|
|
260
|
+
readonly searchSchema?: ObjectSchema<TSearch & RouteSearch>;
|
|
261
|
+
/** @internal Public mount point captured by createRouteRegistry(). */
|
|
262
|
+
readonly basePath?: string;
|
|
263
|
+
readonly __params?: TParams;
|
|
264
|
+
readonly __search?: TSearch;
|
|
265
|
+
}
|
|
266
|
+
type RouteRefSearch<TSchema extends ObjectSchema<RouteSearch> | undefined> = TSchema extends ObjectSchema<RouteSearch> ? InferSchema<TSchema> : RouteSearch;
|
|
267
|
+
interface RouteDestination {
|
|
268
|
+
readonly href: string;
|
|
269
|
+
}
|
|
270
|
+
interface PageHelperOptions extends CommonAccessOptions {
|
|
271
|
+
preload?: (context: RouteContext & {
|
|
272
|
+
request?: Request;
|
|
273
|
+
data: QueryPrefetchContext;
|
|
274
|
+
}) => unknown;
|
|
275
|
+
meta?: RouteMetaSource;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* A single parsed segment from a route path.
|
|
279
|
+
*
|
|
280
|
+
* - `static`: a literal path segment, e.g. `"users"` in `/users/{id}`
|
|
281
|
+
* - `param`: a `{name}` capture group — `value` holds the param name
|
|
282
|
+
* - `wildcard`: a bare `*` segment that captures exactly one segment
|
|
283
|
+
* - `splat`: a `{*name}` capture group that captures the remaining path
|
|
284
|
+
* - `catchall`: the `/*` catch-all that matches any depth
|
|
285
|
+
*/
|
|
286
|
+
interface ParsedSegment {
|
|
287
|
+
kind: 'static' | 'param' | 'wildcard' | 'splat' | 'catchall';
|
|
288
|
+
/** For static/wildcard/catchall: the literal text; for param: the param name. */
|
|
289
|
+
value: string;
|
|
290
|
+
}
|
|
291
|
+
/** Resolved layout component as stored in a route record's layout chain. */
|
|
292
|
+
interface LayoutScopeRecord {
|
|
293
|
+
component: (props: {
|
|
294
|
+
children?: RenderableChild;
|
|
295
|
+
}) => RenderableChild;
|
|
296
|
+
}
|
|
297
|
+
/** Resolved page host component as stored in a route record's page chain. */
|
|
298
|
+
interface PageScopeRecord {
|
|
299
|
+
component: RouteComponent;
|
|
300
|
+
}
|
|
301
|
+
interface RouteRegistryOptions {
|
|
302
|
+
auth?: RouteAuthOptions;
|
|
303
|
+
/** Public pathname prefix for applications mounted below the origin root. */
|
|
304
|
+
basePath?: string;
|
|
305
|
+
}
|
|
306
|
+
type RouteDefinition = () => void;
|
|
307
|
+
interface RouteRequestOptions {
|
|
308
|
+
/** Explicit route source shared by the application renderers. */
|
|
309
|
+
registry: RouteRegistry;
|
|
310
|
+
mode?: RouteMode;
|
|
311
|
+
/** @internal Hydration adopts server loader data instead of rerunning it. */
|
|
312
|
+
load?: boolean;
|
|
313
|
+
auth?: RouteAuthOptions;
|
|
314
|
+
authContext?: AuthContext;
|
|
315
|
+
signal?: AbortSignal;
|
|
316
|
+
request?: Request;
|
|
317
|
+
telemetry?: CoreTelemetry;
|
|
318
|
+
}
|
|
319
|
+
interface RouteRenderResult<TParams extends RouteParams = RouteParams> {
|
|
320
|
+
kind: 'render';
|
|
321
|
+
handler: RouteHandler<TParams>;
|
|
322
|
+
params: TParams;
|
|
323
|
+
record?: RouteRecord;
|
|
324
|
+
}
|
|
325
|
+
type RouteRequestResult<TParams extends RouteParams = RouteParams> = RouteRenderResult<TParams> | AccessRedirectDecision | AccessDenyDecision | null;
|
|
326
|
+
interface GroupHelperOptions extends CommonAccessOptions {
|
|
327
|
+
layout?: (props: {
|
|
328
|
+
children?: RenderableChild;
|
|
329
|
+
}) => RenderableChild;
|
|
330
|
+
meta?: RouteMetaSource;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* A fully normalized route record produced by `route(path, Component, options?)`.
|
|
334
|
+
*
|
|
335
|
+
* This is the canonical representation shared by:
|
|
336
|
+
* - SPA matching and navigation
|
|
337
|
+
* - SSR request resolution
|
|
338
|
+
* - SSG manifest expansion
|
|
339
|
+
*/
|
|
340
|
+
interface RouteRecord {
|
|
341
|
+
/** Canonical normalized absolute path, e.g. `/posts/{slug}` */
|
|
342
|
+
path: string;
|
|
343
|
+
/** The page component to render when this route is active */
|
|
344
|
+
component: RouteComponent;
|
|
345
|
+
/** Pre-parsed segment list for fast matching and typed param extraction */
|
|
346
|
+
segments: ParsedSegment[];
|
|
347
|
+
/** Pre-computed specificity rank (higher = more specific) */
|
|
348
|
+
rank: number;
|
|
349
|
+
/** Layout chain from outermost to innermost, applied automatically on render */
|
|
350
|
+
layoutChain: LayoutScopeRecord[];
|
|
351
|
+
/** Page chain from outermost to innermost, composed through Outlet before layouts apply */
|
|
352
|
+
pageChain: PageScopeRecord[];
|
|
353
|
+
/** Route metadata: loader, entries, policies, title, namespace */
|
|
354
|
+
options: RouteOptions;
|
|
355
|
+
/** Metadata sources ordered from outermost group/page to the route leaf. */
|
|
356
|
+
metaChain?: readonly RouteMetaSource[];
|
|
357
|
+
/** True when this is the `/*` catch-all fallback route */
|
|
358
|
+
isFallback: boolean;
|
|
359
|
+
/**
|
|
360
|
+
* Runtime-ready handler with layout composition baked in.
|
|
361
|
+
* Compatible with the low-level `RouteHandler` signature so that navigation
|
|
362
|
+
* and SSR rendering do not need to know about layout chains.
|
|
363
|
+
*/
|
|
364
|
+
handler: RouteHandler;
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* The normalized route manifest produced by registered route definitions.
|
|
368
|
+
* declarations. Pass it to `createSPA`, `hydrateSPA`, or `renderToString`
|
|
369
|
+
* instead of assembling plain `Route[]` arrays.
|
|
370
|
+
*
|
|
371
|
+
* ```ts
|
|
372
|
+
* import { createRouteRegistry } from '@askrjs/askr/router';
|
|
373
|
+
* const registry = createRouteRegistry(() => { ... });
|
|
374
|
+
* await createSPA({ root: '#app', registry });
|
|
375
|
+
* ```
|
|
376
|
+
*/
|
|
377
|
+
interface RouteManifest {
|
|
378
|
+
records: RouteRecord[];
|
|
379
|
+
auth?: RouteAuthOptions;
|
|
380
|
+
/** Normalized public pathname prefix. Empty and root mounts omit it. */
|
|
381
|
+
basePath?: string;
|
|
382
|
+
}
|
|
383
|
+
declare const routeRegistryBrand: unique symbol;
|
|
384
|
+
interface RouteHandler<TParams extends RouteParams = RouteParams> {
|
|
385
|
+
(params: TParams, context?: {
|
|
386
|
+
signal: AbortSignal;
|
|
387
|
+
}): RenderableChild;
|
|
388
|
+
}
|
|
389
|
+
interface Route<TParams extends RouteParams = RouteParams> {
|
|
390
|
+
path: string;
|
|
391
|
+
handler: RouteHandler<TParams>;
|
|
392
|
+
namespace?: string;
|
|
393
|
+
}
|
|
394
|
+
interface RouteRegistry {
|
|
395
|
+
/** Internal brand: registries must come from createRouteRegistry(). */
|
|
396
|
+
readonly [routeRegistryBrand]: true;
|
|
397
|
+
manifest: RouteManifest;
|
|
398
|
+
routes: readonly Route[];
|
|
399
|
+
}
|
|
400
|
+
interface RouteMatch<TParams extends RouteParams = RouteParams> {
|
|
401
|
+
path: string;
|
|
402
|
+
params: Readonly<TParams>;
|
|
403
|
+
name?: string;
|
|
404
|
+
namespace?: string;
|
|
405
|
+
}
|
|
406
|
+
interface RouteQuery {
|
|
407
|
+
get(key: string): string | null;
|
|
408
|
+
getAll(key: string): string[];
|
|
409
|
+
has(key: string): boolean;
|
|
410
|
+
toJSON(): Record<string, string | string[]>;
|
|
411
|
+
}
|
|
412
|
+
interface RouteSnapshot<TParams extends RouteParams = RouteParams> {
|
|
413
|
+
path: string;
|
|
414
|
+
params: Readonly<TParams>;
|
|
415
|
+
query: Readonly<RouteQuery>;
|
|
416
|
+
hash: string | null;
|
|
417
|
+
name?: string;
|
|
418
|
+
namespace?: string;
|
|
419
|
+
matches: readonly RouteMatch<TParams>[];
|
|
420
|
+
}
|
|
421
|
+
//#endregion
|
|
422
|
+
//#region src/common/app-render-runtime.d.ts
|
|
423
|
+
interface AppRenderRuntime {
|
|
424
|
+
framework: Readonly<Record<string, unknown>>;
|
|
425
|
+
route: unknown;
|
|
426
|
+
hasRoute: boolean;
|
|
427
|
+
dataRuntime?: DataRuntime;
|
|
428
|
+
routeRegistry?: RouteRegistry;
|
|
429
|
+
routeAuth?: RouteAuthOptions;
|
|
430
|
+
}
|
|
431
|
+
//#endregion
|
|
432
|
+
//#region src/runtime/component-internal.d.ts
|
|
433
|
+
interface ComponentInstance {
|
|
434
|
+
id: string;
|
|
435
|
+
fn: ComponentFunction;
|
|
436
|
+
props: Props;
|
|
437
|
+
target: Element | null;
|
|
438
|
+
parentInstance: ComponentInstance | null;
|
|
439
|
+
portalScope: object | null;
|
|
440
|
+
mounted: boolean;
|
|
441
|
+
abortController: AbortController | null;
|
|
442
|
+
ssr?: boolean;
|
|
443
|
+
cleanupStrict?: boolean;
|
|
444
|
+
/** @internal Private resource-ownership identity for the active mount. */
|
|
445
|
+
_ownershipGeneration: object;
|
|
446
|
+
stateValues?: State<unknown>[];
|
|
447
|
+
evaluationGeneration: number;
|
|
448
|
+
notifyUpdate: (() => void) | null;
|
|
449
|
+
_pendingFlushTask?: () => void;
|
|
450
|
+
_pendingRunTask?: () => void;
|
|
451
|
+
_enqueueRun?: () => void;
|
|
452
|
+
stateIndexCheck: number;
|
|
453
|
+
expectedStateIndices?: number[];
|
|
454
|
+
firstRenderComplete: boolean;
|
|
455
|
+
mountOperations?: Array<() => void | (() => void) | PromiseLike<void | (() => void)>>;
|
|
456
|
+
commitOperations?: Array<() => void | (() => void) | PromiseLike<void | (() => void)>>;
|
|
457
|
+
cleanupFns?: Array<() => void>;
|
|
458
|
+
lifecycleSlots?: unknown[];
|
|
459
|
+
lifecycleGeneration: number;
|
|
460
|
+
hasPendingUpdate: boolean;
|
|
461
|
+
ownerFrame: ContextFrame | null;
|
|
462
|
+
isRoot?: boolean;
|
|
463
|
+
_rootComponentFn?: ComponentFunction;
|
|
464
|
+
/** @internal Browser-owned hydration and route state for this app root. */
|
|
465
|
+
_appRenderRuntime?: AppRenderRuntime;
|
|
466
|
+
/** @internal CSP nonce retained across browser route navigation. */
|
|
467
|
+
_cspNonce?: string;
|
|
468
|
+
_vnodeOwner?: object;
|
|
469
|
+
_vnodeParent?: ComponentInstance | null;
|
|
470
|
+
_vnodeParentGeneration?: object;
|
|
471
|
+
_vnodeKey?: string | number;
|
|
472
|
+
_vnodePosition?: number;
|
|
473
|
+
_wrapperDepth?: number;
|
|
474
|
+
_currentRenderToken?: number;
|
|
475
|
+
lastRenderToken?: number;
|
|
476
|
+
_pendingReadSources?: Set<ReadableSource<unknown>>;
|
|
477
|
+
_pendingReadSourceVersions?: Map<ReadableSource<unknown>, number>;
|
|
478
|
+
_lastReadSources?: Set<ReadableSource<unknown>>;
|
|
479
|
+
devWarningsEmitted?: Set<string>;
|
|
480
|
+
_placeholder?: Comment;
|
|
481
|
+
_ownedChildScopes?: Set<OwnedChildScope>;
|
|
482
|
+
errorBoundaryState?: {
|
|
483
|
+
error: unknown | null;
|
|
484
|
+
resetKey: unknown;
|
|
485
|
+
notified: boolean;
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
//#endregion
|
|
489
|
+
//#region src/runtime/component-scope.d.ts
|
|
490
|
+
/**
|
|
491
|
+
* Get the abort signal for the current component.
|
|
492
|
+
*
|
|
493
|
+
* The signal is guaranteed to be aborted when:
|
|
494
|
+
* - Component unmounts
|
|
495
|
+
* - Navigation occurs (different route)
|
|
496
|
+
* - Parent is destroyed
|
|
497
|
+
*/
|
|
498
|
+
declare function getSignal(): AbortSignal;
|
|
499
|
+
//#endregion
|
|
500
|
+
//#region src/runtime/readable.d.ts
|
|
501
|
+
interface DerivedSubscriber {
|
|
502
|
+
_markDirty(): void;
|
|
503
|
+
_pendingDependencySources?: Set<ReadableSource<unknown>>;
|
|
504
|
+
}
|
|
505
|
+
interface ReadableSource<T = unknown> {
|
|
506
|
+
(): T;
|
|
507
|
+
_hasBeenRead?: boolean;
|
|
508
|
+
_hasEverBeenRead?: boolean;
|
|
509
|
+
_readers?: Map<ComponentInstance, {
|
|
510
|
+
token: number;
|
|
511
|
+
generation: object;
|
|
512
|
+
}>;
|
|
513
|
+
_derivedSubscribers?: Set<DerivedSubscriber>;
|
|
514
|
+
_version?: number;
|
|
515
|
+
}
|
|
516
|
+
//#endregion
|
|
517
|
+
//#region src/common/dom-range.d.ts
|
|
518
|
+
/**
|
|
519
|
+
* Internal DOM range shape shared by runtime ownership records and the
|
|
520
|
+
* renderer. A singleton range uses the node itself for both anchors; a
|
|
521
|
+
* multi-node or empty range uses deterministic comment anchors.
|
|
522
|
+
*/
|
|
523
|
+
interface DOMRange {
|
|
524
|
+
start: Node;
|
|
525
|
+
end: Node;
|
|
526
|
+
single: boolean;
|
|
527
|
+
}
|
|
528
|
+
//#endregion
|
|
529
|
+
//#region src/runtime/child-scope.d.ts
|
|
530
|
+
interface ChildScope {
|
|
531
|
+
key: string | number;
|
|
532
|
+
componentInstance: ComponentInstance;
|
|
533
|
+
previousVnode: VNode | undefined;
|
|
534
|
+
vnode: VNode | undefined;
|
|
535
|
+
dom?: Node;
|
|
536
|
+
/** @internal Fast singleton node plus an anchor-backed multi-node range. */
|
|
537
|
+
range?: DOMRange;
|
|
538
|
+
needsDomUpdate: boolean;
|
|
539
|
+
hydrationPending: boolean;
|
|
540
|
+
/** @internal Stable owner for validated intrinsic blueprints in list items. */
|
|
541
|
+
blueprintOwner?: object;
|
|
542
|
+
render(renderFn: () => VNode): VNode;
|
|
543
|
+
markDirty(): void;
|
|
544
|
+
dispose(): void;
|
|
545
|
+
}
|
|
546
|
+
interface ChildScopeOwnership {
|
|
547
|
+
add(scope: ChildScope): void;
|
|
548
|
+
delete(scope: ChildScope): void;
|
|
549
|
+
bulkDispose(run: () => void): void;
|
|
550
|
+
}
|
|
551
|
+
/** @internal Snapshot used to restore a child scope after a failed commit. */
|
|
552
|
+
interface ChildScopeTransactionSnapshot {
|
|
553
|
+
previousVnode: VNode | undefined;
|
|
554
|
+
vnode: VNode | undefined;
|
|
555
|
+
dom: Node | undefined;
|
|
556
|
+
range: DOMRange | undefined;
|
|
557
|
+
domTextData: string | undefined;
|
|
558
|
+
needsDomUpdate: boolean;
|
|
559
|
+
hydrationPending: boolean;
|
|
560
|
+
renderFn: (() => VNode) | undefined;
|
|
561
|
+
renderedOwnerFrame: ContextFrame | null;
|
|
562
|
+
}
|
|
563
|
+
//#endregion
|
|
564
|
+
//#region src/runtime/runtime.d.ts
|
|
565
|
+
interface RuntimeKeyedReorderDecision {
|
|
566
|
+
useFastPath: boolean;
|
|
567
|
+
totalKeyed: number;
|
|
568
|
+
totalChildren: number;
|
|
569
|
+
currentKeyCount: number;
|
|
570
|
+
moveCount: number;
|
|
571
|
+
lisLen: number;
|
|
572
|
+
hasPropChanges: boolean;
|
|
573
|
+
isWholeKeyedList: boolean;
|
|
574
|
+
}
|
|
575
|
+
interface RuntimeRendererHost {
|
|
576
|
+
evaluate(node: unknown, target: Element | null, context?: object, retainedOwner?: ComponentInstance): void;
|
|
577
|
+
cleanupInstancesUnder(node: Node): void;
|
|
578
|
+
replaceComponentRange(instance: ComponentInstance, result: unknown, host: Element | Comment): Node | null;
|
|
579
|
+
resolveChildScopeRange?(scope: ChildScope): DOMRange | null;
|
|
580
|
+
teardownNodeSubtree(root: Node): void;
|
|
581
|
+
populateKeyMapForElement(parent: Element): void;
|
|
582
|
+
getKeyMapForElement(parent: Element): Map<string | number, Element> | undefined;
|
|
583
|
+
isKeyedReorderFastPathEligible(parent: Element, children: unknown[], oldKeyMap: Map<string | number, Element> | undefined): RuntimeKeyedReorderDecision;
|
|
584
|
+
markReactivePropsDirtySource(source: ReadableSource<unknown>): void;
|
|
585
|
+
}
|
|
586
|
+
interface AskrRuntimeOptions {
|
|
587
|
+
scheduler?: Scheduler;
|
|
588
|
+
renderer?: RuntimeRendererHost;
|
|
589
|
+
}
|
|
590
|
+
declare class AskrRuntime {
|
|
591
|
+
readonly scheduler: Scheduler;
|
|
592
|
+
private rendererHost;
|
|
593
|
+
constructor(options?: AskrRuntimeOptions);
|
|
594
|
+
get renderer(): RuntimeRendererHost;
|
|
595
|
+
configureRenderer(renderer: RuntimeRendererHost): void;
|
|
596
|
+
}
|
|
597
|
+
declare function createRuntime(options?: AskrRuntimeOptions): AskrRuntime;
|
|
598
|
+
declare function getDefaultRuntime(): AskrRuntime;
|
|
599
|
+
//#endregion
|
|
600
|
+
//#region src/runtime/for-signals.d.ts
|
|
601
|
+
type ForItemSignal<T> = ReadableSource<T> & (() => T) & {
|
|
602
|
+
peek(): T;
|
|
603
|
+
set(newValue: T, notifyReaders?: boolean): void;
|
|
604
|
+
};
|
|
605
|
+
type ForItemPropertySignal = ReadableSource<unknown> & (() => unknown) & {
|
|
606
|
+
peek(): unknown;
|
|
607
|
+
set(newValue: unknown, notifyReaders?: boolean): void;
|
|
608
|
+
};
|
|
609
|
+
type ForIndexSignal = ReadableSource<number> & (() => number) & {
|
|
610
|
+
peek(): number;
|
|
611
|
+
set(newValue: number | ((prev: number) => number), notifyReaders?: boolean): void;
|
|
612
|
+
};
|
|
613
|
+
interface ReactiveForItemState<T> {
|
|
614
|
+
currentItem: T;
|
|
615
|
+
itemSignal: ForItemSignal<T> | null;
|
|
616
|
+
propertySignals: Map<PropertyKey, ForItemPropertySignal> | null;
|
|
617
|
+
coalescedProperties: PropertyKey | PropertyKey[] | null;
|
|
618
|
+
coalescedProperty2: PropertyKey | null;
|
|
619
|
+
wholeItemRead: boolean;
|
|
620
|
+
proxy: T;
|
|
621
|
+
}
|
|
622
|
+
//#endregion
|
|
623
|
+
//#region src/runtime/for-scopes.d.ts
|
|
624
|
+
interface ForItemInstance<T> {
|
|
625
|
+
key: string | number;
|
|
626
|
+
item: T;
|
|
627
|
+
reactiveItem: T;
|
|
628
|
+
reactiveItemState: ReactiveForItemState<T> | null;
|
|
629
|
+
indexSignal: ForIndexSignal;
|
|
630
|
+
scope: ChildScope;
|
|
631
|
+
}
|
|
632
|
+
//#endregion
|
|
633
|
+
//#region src/runtime/effect.d.ts
|
|
634
|
+
interface FineGrainedEffectHandle<T> {
|
|
635
|
+
cleanup(): void;
|
|
636
|
+
updateCompute(nextCompute: () => T): void;
|
|
637
|
+
flush(): void;
|
|
638
|
+
}
|
|
639
|
+
//#endregion
|
|
640
|
+
//#region src/runtime/for-types.d.ts
|
|
641
|
+
type ForEachSource<T> = readonly T[] | (() => readonly T[]);
|
|
642
|
+
type ForKeySelector<T> = (item: T, index: number) => string | number;
|
|
643
|
+
type ForRenderItem<T> = (item: T, index: () => number) => VNode;
|
|
644
|
+
//#endregion
|
|
645
|
+
//#region src/runtime/for-internal.d.ts
|
|
646
|
+
type ForCommitStrategy = 'APPEND' | 'INSERT_ONE' | 'REMOVE_ONE' | 'TRUNCATE' | 'NO_REORDER' | 'SWAP' | 'FULL_KEYED';
|
|
647
|
+
interface ForState<T> {
|
|
648
|
+
kind: 'for';
|
|
649
|
+
_contextFrame: ContextFrame | null;
|
|
650
|
+
_contextFrameChanged: boolean;
|
|
651
|
+
currentItems: readonly T[];
|
|
652
|
+
_committedItems: readonly T[];
|
|
653
|
+
eachSource: ForEachSource<T>;
|
|
654
|
+
fallback: VNode | null;
|
|
655
|
+
fallbackScope: ChildScope | null;
|
|
656
|
+
items: Map<string | number, ForItemInstance<T>>;
|
|
657
|
+
orderedKeys: Array<string | number>;
|
|
658
|
+
orderedItems: ForItemInstance<T>[];
|
|
659
|
+
orderedVNodes: VNode[];
|
|
660
|
+
byFn: ForKeySelector<T>;
|
|
661
|
+
renderFn: ForRenderItem<T>;
|
|
662
|
+
parentInstance: ComponentInstance | null;
|
|
663
|
+
lastCommitStrategy: ForCommitStrategy;
|
|
664
|
+
lastRemovedNodes: Node[];
|
|
665
|
+
lastRemovedRanges: DOMRange[];
|
|
666
|
+
pendingDirtyIndices: number[] | null;
|
|
667
|
+
pendingSwapIndices: [number, number] | null;
|
|
668
|
+
pendingMoveOnly: boolean;
|
|
669
|
+
pendingInsertedIndex: number | null;
|
|
670
|
+
pendingRemovedKey: string | number | null;
|
|
671
|
+
pendingAppendStart: number | null;
|
|
672
|
+
_hasResolvedItemDom: boolean;
|
|
673
|
+
_needsSourceReconcile: boolean;
|
|
674
|
+
_sourceEffect: FineGrainedEffectHandle<readonly T[]> | null;
|
|
675
|
+
_suspendSourceCommit: boolean;
|
|
676
|
+
_enqueueBoundaryCommit?: (() => void) | null;
|
|
677
|
+
_hasPendingBoundaryCommit?: boolean;
|
|
678
|
+
devKeyKinds?: Map<string | number, 'number' | 'string'>;
|
|
679
|
+
_transaction?: ForTransaction<T> | null;
|
|
680
|
+
_scopeOwnership: ChildScopeOwnership;
|
|
681
|
+
}
|
|
682
|
+
interface ForItemTransactionSnapshot<T> {
|
|
683
|
+
item: T;
|
|
684
|
+
itemSignalExists: boolean;
|
|
685
|
+
itemSignalValue: T | undefined;
|
|
686
|
+
itemSignalHasBeenRead: boolean;
|
|
687
|
+
indexValue: number;
|
|
688
|
+
indexHasBeenRead: boolean;
|
|
689
|
+
propertySignalStore: Map<PropertyKey, ForItemPropertySignal> | null;
|
|
690
|
+
propertySignals: Map<PropertyKey, {
|
|
691
|
+
signal: ForItemPropertySignal;
|
|
692
|
+
value: unknown;
|
|
693
|
+
hasBeenRead: boolean;
|
|
694
|
+
}> | null;
|
|
695
|
+
scope: ChildScopeTransactionSnapshot;
|
|
696
|
+
}
|
|
697
|
+
interface ForTransaction<T> {
|
|
698
|
+
collectionSnapshotMode: 'copy' | 'reset-empty' | 'preserve-clear' | 'reuse';
|
|
699
|
+
currentItems: readonly T[];
|
|
700
|
+
items: Map<string | number, ForItemInstance<T>>;
|
|
701
|
+
orderedKeys: Array<string | number>;
|
|
702
|
+
orderedItems: ForItemInstance<T>[];
|
|
703
|
+
orderedVNodes: VNode[];
|
|
704
|
+
fallbackScope: ChildScope | null;
|
|
705
|
+
lastCommitStrategy: ForCommitStrategy;
|
|
706
|
+
lastRemovedNodes: Node[];
|
|
707
|
+
lastRemovedRanges: DOMRange[];
|
|
708
|
+
pendingDirtyIndices: number[] | null;
|
|
709
|
+
pendingSwapIndices: [number, number] | null;
|
|
710
|
+
pendingMoveOnly: boolean;
|
|
711
|
+
pendingInsertedIndex: number | null;
|
|
712
|
+
pendingRemovedKey: string | number | null;
|
|
713
|
+
pendingAppendStart: number | null;
|
|
714
|
+
hasResolvedItemDom: boolean;
|
|
715
|
+
needsSourceReconcile: boolean;
|
|
716
|
+
devKeyKinds?: Map<string | number, 'number' | 'string'>;
|
|
717
|
+
itemSnapshots: Map<ForItemInstance<T>, ForItemTransactionSnapshot<T>> | null;
|
|
718
|
+
unreadIndexSnapshots: Map<ForIndexSignal, number> | null;
|
|
719
|
+
fallbackScopeSnapshot: ChildScopeTransactionSnapshot | null;
|
|
720
|
+
removedScopes: ChildScope[] | null;
|
|
721
|
+
removedScopeNodes: Node[] | null;
|
|
722
|
+
removeAllItems: boolean;
|
|
723
|
+
signalEffects: Map<ReadableSource<unknown>, {
|
|
724
|
+
parentInstance: ComponentInstance | null;
|
|
725
|
+
notify: boolean;
|
|
726
|
+
skipInstance: ComponentInstance | null;
|
|
727
|
+
skipOwnedBy: ComponentInstance | null;
|
|
728
|
+
}> | null;
|
|
729
|
+
shouldClearDomUpdateState: boolean;
|
|
730
|
+
}
|
|
731
|
+
//#endregion
|
|
732
|
+
//#region src/runtime/control.d.ts
|
|
733
|
+
interface MatchBranch {
|
|
734
|
+
key: string | number;
|
|
735
|
+
render: () => VNode;
|
|
736
|
+
when: unknown;
|
|
737
|
+
}
|
|
738
|
+
interface BranchControlStateBase {
|
|
739
|
+
_contextFrame: ContextFrame | null;
|
|
740
|
+
activeKey: string | number | null;
|
|
741
|
+
activeScope: ChildScope | null;
|
|
742
|
+
activeVNodes: VNode[];
|
|
743
|
+
lastRemovedNodes: Node[];
|
|
744
|
+
lastRemovedRanges: DOMRange[];
|
|
745
|
+
parentInstance: ComponentInstance | null;
|
|
746
|
+
_enqueueBoundaryCommit?: (() => void) | null;
|
|
747
|
+
_hasPendingBoundaryCommit?: boolean;
|
|
748
|
+
_transaction?: ControlTransaction | null;
|
|
749
|
+
}
|
|
750
|
+
interface ShowState extends BranchControlStateBase {
|
|
751
|
+
kind: 'show';
|
|
752
|
+
fallbackScope: ChildScope | null;
|
|
753
|
+
renderFallback: (() => VNode) | null;
|
|
754
|
+
renderTruthy: ((value: unknown) => VNode) | (() => VNode);
|
|
755
|
+
selectedValue: unknown;
|
|
756
|
+
truthyScope: ChildScope | null;
|
|
757
|
+
}
|
|
758
|
+
interface CaseState extends BranchControlStateBase {
|
|
759
|
+
kind: 'case';
|
|
760
|
+
fallback: (() => VNode) | null;
|
|
761
|
+
matches: MatchBranch[];
|
|
762
|
+
}
|
|
763
|
+
type ControlBoundaryState = ForState<unknown> | ShowState | CaseState;
|
|
764
|
+
type BranchStateSnapshot = {
|
|
765
|
+
activeKey: string | number | null;
|
|
766
|
+
activeScope: ChildScope | null;
|
|
767
|
+
activeVNodes: VNode[];
|
|
768
|
+
lastRemovedNodes: Node[];
|
|
769
|
+
lastRemovedRanges: DOMRange[];
|
|
770
|
+
scopeSnapshots: Map<ChildScope, ChildScopeTransactionSnapshot>;
|
|
771
|
+
fallbackScope?: ChildScope | null;
|
|
772
|
+
truthyScope?: ChildScope | null;
|
|
773
|
+
};
|
|
774
|
+
interface ControlTransaction {
|
|
775
|
+
state: ShowState | CaseState;
|
|
776
|
+
snapshot: BranchStateSnapshot;
|
|
777
|
+
removedScopes: ChildScope[];
|
|
778
|
+
shouldClearDomUpdateState: boolean;
|
|
779
|
+
registered: boolean;
|
|
780
|
+
}
|
|
781
|
+
//#endregion
|
|
782
|
+
//#region src/runtime/snapshot-source.d.ts
|
|
783
|
+
declare const SNAPSHOT_SOURCE_BRAND: unique symbol;
|
|
784
|
+
type SnapshotSourceBrand = {
|
|
785
|
+
readonly [SNAPSHOT_SOURCE_BRAND]: true;
|
|
786
|
+
};
|
|
787
|
+
//#endregion
|
|
788
|
+
//#region src/runtime/derive.d.ts
|
|
789
|
+
interface Derived<T> extends ReadableSource<T> {
|
|
790
|
+
(): T;
|
|
791
|
+
}
|
|
792
|
+
type SnapshotSource<T> = {
|
|
793
|
+
value: T | null;
|
|
794
|
+
pending?: boolean;
|
|
795
|
+
error?: Error | null;
|
|
796
|
+
} & SnapshotSourceBrand;
|
|
797
|
+
/** Creates a render-scoped derived value; must be called during component render. */
|
|
798
|
+
declare function derive<TOut>(fn: () => TOut): Derived<TOut>;
|
|
799
|
+
declare function derive<TIn, TOut>(source: SnapshotSource<TIn> | TIn | (() => TIn), map: (value: TIn) => TOut): Derived<TOut | null>;
|
|
800
|
+
//#endregion
|
|
801
|
+
//#region src/runtime/render-diagnostics.d.ts
|
|
802
|
+
interface RenderDiagnosticsOptions {
|
|
803
|
+
/** Emit one warning per component instance when a render exceeds the threshold. */
|
|
804
|
+
slowRenderWarnings?: boolean;
|
|
805
|
+
/** Slow-render threshold in milliseconds. The default is 5. */
|
|
806
|
+
slowRenderThresholdMs?: number;
|
|
807
|
+
}
|
|
808
|
+
/**
|
|
809
|
+
* Configure development render diagnostics and return a function that restores
|
|
810
|
+
* the previous configuration. Component counters and timing remain enabled
|
|
811
|
+
* when warning output is disabled.
|
|
812
|
+
*/
|
|
813
|
+
declare function configureRenderDiagnostics(options: RenderDiagnosticsOptions): () => void;
|
|
814
|
+
//#endregion
|
|
815
|
+
//#region src/runtime/selector.d.ts
|
|
816
|
+
interface Selector<T> {
|
|
817
|
+
(candidate: T): boolean;
|
|
818
|
+
}
|
|
819
|
+
type SelectorEquals<T> = {
|
|
820
|
+
bivarianceHack(a: T, b: T): boolean;
|
|
821
|
+
}['bivarianceHack'];
|
|
822
|
+
/**
|
|
823
|
+
* Creates a render-scoped predicate for keyed membership in reactive list rows.
|
|
824
|
+
*
|
|
825
|
+
* Use this when a `<For>` child needs to compare each stable item with a
|
|
826
|
+
* changing selected value. Unlike a plain closure capture, the predicate
|
|
827
|
+
* subscribes the affected rows and updates them without rebuilding the list.
|
|
828
|
+
* Must be called during component render.
|
|
829
|
+
*/
|
|
830
|
+
declare function selector<T>(source: () => T, equals?: SelectorEquals<T>): Selector<T>;
|
|
831
|
+
//#endregion
|
|
832
|
+
//#region src/control/shared.d.ts
|
|
833
|
+
type BoundaryChild = RenderableChild;
|
|
834
|
+
//#endregion
|
|
835
|
+
//#region src/control/for.d.ts
|
|
836
|
+
type ForBaseProps<T> = {
|
|
837
|
+
each: ForEachSource<T>;
|
|
838
|
+
fallback?: BoundaryChild;
|
|
839
|
+
/**
|
|
840
|
+
* Row renderer. Parent reactive reads must use `selector()` or thunk props;
|
|
841
|
+
* closure-captured values are snapshotted when the row is created or
|
|
842
|
+
* reconciled; changing the parent source does not rerun an existing row.
|
|
843
|
+
*/
|
|
844
|
+
children: (item: T, index: () => number) => VNode;
|
|
845
|
+
};
|
|
846
|
+
type KeyedForProps<T, K extends string | number> = ForBaseProps<T> & {
|
|
847
|
+
by: (item: T, index: number) => K;
|
|
848
|
+
byIndex?: never;
|
|
849
|
+
};
|
|
850
|
+
type IndexedForProps<T> = ForBaseProps<T> & {
|
|
851
|
+
by?: never;
|
|
852
|
+
byIndex: true;
|
|
853
|
+
};
|
|
854
|
+
type ForProps<T, K extends string | number = string | number> = KeyedForProps<T, K> | IndexedForProps<T>;
|
|
855
|
+
declare const For: <T, K extends string | number = string | number>(props: ForProps<T, K>) => JSXElement;
|
|
856
|
+
//#endregion
|
|
857
|
+
//#region src/control/show.d.ts
|
|
858
|
+
type ShowSource<T> = T | (() => T);
|
|
859
|
+
type Truthy<T> = T extends false | '' | 0 | 0n | null | undefined ? never : T;
|
|
860
|
+
type ShowProps<T> = {
|
|
861
|
+
when: ShowSource<T>;
|
|
862
|
+
fallback?: BoundaryChild;
|
|
863
|
+
children: BoundaryChild | ((value: Truthy<T>) => BoundaryChild);
|
|
864
|
+
};
|
|
865
|
+
declare const Show: <T>(props: ShowProps<T>) => JSXElement;
|
|
866
|
+
//#endregion
|
|
867
|
+
//#region src/control/case.d.ts
|
|
868
|
+
type MatchChild = BoundaryChild | (() => BoundaryChild);
|
|
869
|
+
type MatchProps = {
|
|
870
|
+
key?: string | number | null;
|
|
871
|
+
when: unknown;
|
|
872
|
+
children: MatchChild;
|
|
873
|
+
};
|
|
874
|
+
type CaseProps = {
|
|
875
|
+
fallback?: BoundaryChild;
|
|
876
|
+
children?: unknown;
|
|
877
|
+
};
|
|
878
|
+
declare function Match(_props: MatchProps): null;
|
|
879
|
+
declare const Case: (props: CaseProps) => JSXElement;
|
|
880
|
+
//#endregion
|
|
881
|
+
//#region src/csp-nonce.d.ts
|
|
882
|
+
declare const CspNonceScope: Scope<string | undefined>;
|
|
883
|
+
declare function cspNonce(): string | undefined;
|
|
884
|
+
//#endregion
|
|
885
|
+
//#region src/common/render-context.d.ts
|
|
886
|
+
interface DeferredBoundaryRegistration {
|
|
887
|
+
id: string;
|
|
888
|
+
promise: Promise<unknown>;
|
|
889
|
+
fulfilled(value: unknown): RenderableChild;
|
|
890
|
+
rejected(error: unknown): RenderableChild;
|
|
891
|
+
}
|
|
892
|
+
interface SSRPortalHostRegistration {
|
|
893
|
+
token: string;
|
|
894
|
+
automatic: boolean;
|
|
895
|
+
}
|
|
896
|
+
interface SSRPortalSlot {
|
|
897
|
+
hasValue: boolean;
|
|
898
|
+
value: RenderableChild | undefined;
|
|
899
|
+
hosts: SSRPortalHostRegistration[];
|
|
900
|
+
}
|
|
901
|
+
interface SSRPortalState {
|
|
902
|
+
slots: Map<object, SSRPortalSlot>;
|
|
903
|
+
nextHostId: number;
|
|
904
|
+
}
|
|
905
|
+
/** Register request-local CSS produced during SSR without importing the SSR renderer in clients. */
|
|
906
|
+
declare function registerSSRStyle(id: string, cssText: string): void;
|
|
907
|
+
//#endregion
|
|
908
|
+
//#region src/ref.d.ts
|
|
909
|
+
/**
|
|
910
|
+
* Creates a stable holder for an intrinsic element ref.
|
|
911
|
+
*
|
|
912
|
+
* The renderer mutates `current` during commit and clears it during cleanup.
|
|
913
|
+
* Updating the holder never schedules a render.
|
|
914
|
+
*/
|
|
915
|
+
interface Ref<T extends Element = Element> {
|
|
916
|
+
current: T | null;
|
|
917
|
+
}
|
|
918
|
+
declare function createRef<T extends Element = Element>(): Ref<T>;
|
|
919
|
+
//#endregion
|
|
920
|
+
//#region src/actions/index.d.ts
|
|
921
|
+
interface ActionDescriptor<TInput extends Record<string, unknown> = Record<string, unknown>> {
|
|
922
|
+
readonly id: string;
|
|
923
|
+
readonly input: ObjectSchema<TInput>;
|
|
924
|
+
readonly invalidates: readonly string[];
|
|
925
|
+
}
|
|
926
|
+
declare function defineAction<TInput extends Record<string, unknown>>(options: {
|
|
927
|
+
readonly id: string;
|
|
928
|
+
readonly input: ObjectSchema<TInput>;
|
|
929
|
+
readonly invalidates?: readonly string[];
|
|
930
|
+
}): ActionDescriptor<TInput>;
|
|
931
|
+
/** A native form bound to a declared action; it is not a synthetic event API. */
|
|
932
|
+
declare function ActionForm<TInput extends Record<string, unknown>>({ action, children, ...props }: {
|
|
933
|
+
readonly action: ActionDescriptor<TInput>;
|
|
934
|
+
readonly children?: RenderableChild;
|
|
935
|
+
readonly [key: string]: unknown;
|
|
936
|
+
}): JSXElement;
|
|
937
|
+
interface ActionValidationError {
|
|
938
|
+
readonly kind: 'invalid';
|
|
939
|
+
readonly action: string;
|
|
940
|
+
readonly values: Readonly<Record<string, unknown>>;
|
|
941
|
+
readonly issues: readonly unknown[];
|
|
942
|
+
readonly fieldErrors: Readonly<Record<string, readonly string[]>>;
|
|
943
|
+
}
|
|
944
|
+
interface ActionStatus<TResult = unknown> {
|
|
945
|
+
readonly pending: boolean;
|
|
946
|
+
readonly result?: TResult;
|
|
947
|
+
readonly error?: unknown;
|
|
948
|
+
}
|
|
949
|
+
/** Returns a command handle, rather than a hook. */
|
|
950
|
+
declare function action<TInput extends Record<string, unknown>, TResult = unknown>(descriptor: ActionDescriptor<TInput>): {
|
|
951
|
+
state: StateTuple<ActionStatus<TResult>>;
|
|
952
|
+
submit(input: TInput): Promise<TResult>;
|
|
953
|
+
};
|
|
954
|
+
//#endregion
|
|
955
|
+
export { RouteHandler as $, RuntimeKeyedReorderDecision as A, SSRData as At, AccessRedirectStatus as B, selector as C, readScope as Ct, derive as D, DocumentRenderArgs as Dt, Derived as E, VNode as Et, AccessAllowDecision as F, StateTuple as Ft, ParsedSegment as G, LayoutScopeRecord as H, AccessDecision as I, state as It, RouteAuthResolver as J, Route as K, AccessDenyDecision as L, createRuntime as M, SSRStyleRegistrationValidation as Mt, getDefaultRuntime as N, State as Nt, AskrRuntime as O, DocumentRenderContext as Ot, getSignal as P, StateSetter as Pt, RouteDestination as Q, AccessDenyStatus as R, Selector as S, defineScope as St, configureRenderDiagnostics as T, RenderableChild as Tt, PageHelperOptions as U, GroupHelperOptions as V, PageScopeRecord as W, RouteContext as X, RouteComponent as Y, RouteDefinition as Z, MatchProps as _, RouteRequestResult as _t, action as a, RouteOptions as at, For as b, RouteSnapshot as bt, createRef as c, RoutePolicy as ct, registerSSRStyle as d, RouteRef as dt, RouteManifest as et, CspNonceScope as f, RouteRefSearch as ft, Match as g, RouteRequestOptions as gt, CaseProps as h, RouteRenderResult as ht, ActionValidationError as i, RouteMode as it, RuntimeRendererHost as j, SSRStyleRegistration as jt, AskrRuntimeOptions as k, DocumentRenderer as kt, DeferredBoundaryRegistration as l, RouteQuery as lt, Case as m, RouteRegistryOptions as mt, ActionForm as n, RouteMeta as nt, defineAction as o, RouteParams as ot, cspNonce as p, RouteRegistry as pt, RouteAuthOptions as q, ActionStatus as r, RouteMetaSource as rt, Ref as s, RoutePathParams as st, ActionDescriptor as t, RouteMatch as tt, SSRPortalState as u, RouteRecord as ut, Show as v, RouteSearch as vt, RenderDiagnosticsOptions as w, ComponentFunction as wt, ForProps as x, Scope as xt, ShowProps as y, RouteSearchValue as yt, AccessRedirectDecision as z };
|