@analogjs/router 2.8.0-beta.1 → 2.8.0-beta.11

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.
Files changed (28) hide show
  1. package/fesm2022/analogjs-router-debug.page-MFY2u07E.mjs +119 -0
  2. package/fesm2022/analogjs-router-debug.page-MFY2u07E.mjs.map +1 -0
  3. package/fesm2022/analogjs-router-i18n.mjs +82 -210
  4. package/fesm2022/analogjs-router-i18n.mjs.map +1 -1
  5. package/fesm2022/analogjs-router-routes-L2tt-0ms.mjs +263 -0
  6. package/fesm2022/analogjs-router-routes-L2tt-0ms.mjs.map +1 -0
  7. package/fesm2022/analogjs-router-server-actions.mjs +240 -294
  8. package/fesm2022/analogjs-router-server-actions.mjs.map +1 -1
  9. package/fesm2022/analogjs-router-server.mjs +387 -832
  10. package/fesm2022/analogjs-router-server.mjs.map +1 -1
  11. package/fesm2022/analogjs-router-tanstack-query-server.mjs +35 -85
  12. package/fesm2022/analogjs-router-tanstack-query-server.mjs.map +1 -1
  13. package/fesm2022/analogjs-router-tanstack-query.mjs +79 -127
  14. package/fesm2022/analogjs-router-tanstack-query.mjs.map +1 -1
  15. package/fesm2022/analogjs-router-tokens.mjs +14 -19
  16. package/fesm2022/analogjs-router-tokens.mjs.map +1 -1
  17. package/fesm2022/analogjs-router.mjs +777 -1187
  18. package/fesm2022/analogjs-router.mjs.map +1 -1
  19. package/package.json +2 -2
  20. package/types/analogjs-router-i18n.d.ts +55 -24
  21. package/types/analogjs-router-server-actions.d.ts +179 -90
  22. package/types/analogjs-router-server.d.ts +76 -116
  23. package/types/analogjs-router-tanstack-query-server.d.ts +33 -37
  24. package/types/analogjs-router-tanstack-query.d.ts +19 -24
  25. package/types/analogjs-router-tokens.d.ts +18 -22
  26. package/types/analogjs-router.d.ts +271 -251
  27. package/fesm2022/analogjs-router-debug.page-COcFkgRu.mjs +0 -91
  28. package/fesm2022/analogjs-router-debug.page-COcFkgRu.mjs.map +0 -1
@@ -1,14 +1,12 @@
1
- import * as i0 from '@angular/core';
2
- import { Type, EnvironmentProviders, Injector, ResourceRef, InjectionToken, OnChanges, InputSignal, Signal } from '@angular/core';
3
- import * as _angular_router from '@angular/router';
4
- import { Route, ActivatedRoute, Router, CanActivateFn, DeprecatedGuard, CanActivateChildFn, CanDeactivateFn, CanMatchFn, ResolveFn, RouterFeatures, Routes, ActivatedRouteSnapshot, NavigationBehaviorOptions } from '@angular/router';
5
- import { H3EventContext, H3Event } from 'h3';
6
- import { $Fetch } from 'nitropack';
7
- import * as rxjs from 'rxjs';
8
- import { Observable } from 'rxjs';
9
- import * as _angular_common_http from '@angular/common/http';
10
- import { HttpRequest, HttpHandlerFn } from '@angular/common/http';
11
-
1
+ import * as i0 from "@angular/core";
2
+ import { EnvironmentProviders, InjectionToken, Injector, InputSignal, OnChanges, ResourceRef, Signal, Type } from "@angular/core";
3
+ import * as i1 from "@angular/router";
4
+ import { ActivatedRoute, ActivatedRouteSnapshot, CanActivateChildFn, CanActivateFn, CanDeactivateFn, CanMatchFn, DeprecatedGuard, NavigationBehaviorOptions, ResolveFn, Route, Router, RouterFeatures, Routes } from "@angular/router";
5
+ import { H3Event, H3EventContext } from "h3";
6
+ import { $Fetch } from "nitropack";
7
+ import { Observable } from "rxjs";
8
+ import { HttpHandlerFn, HttpRequest } from "@angular/common/http";
9
+ import { StandardSchemaV1 as StandardSchemaV1$1 } from "@analogjs/router/server/actions";
12
10
  type RouteOmitted = 'component' | 'loadComponent' | 'loadChildren' | 'path' | 'pathMatch';
13
11
  type RestrictedRoute = Omit<Route, RouteOmitted>;
14
12
  /**
@@ -39,75 +37,81 @@ type RestrictedRoute = Omit<Route, RouteOmitted>;
39
37
  * @param route
40
38
  * @returns
41
39
  */
42
- declare const defineRouteMeta: (route: RestrictedRoute) => RestrictedRoute;
40
+ export declare const defineRouteMeta: (route: RestrictedRoute) => RestrictedRoute;
43
41
  /**
44
42
  * Returns the instance of Angular Router
45
43
  *
46
44
  * @returns The router
47
45
  */
48
- declare const injectRouter: () => Router;
46
+ export declare const injectRouter: () => Router;
49
47
  /**
50
48
  * Returns the instance of the Activate Route for the component
51
49
  *
52
50
  * @returns The activated route
53
51
  */
54
- declare const injectActivatedRoute: () => ActivatedRoute;
55
-
52
+ export declare const injectActivatedRoute: () => ActivatedRoute;
53
+ declare const ROUTE_META_TAGS_KEY: unique symbol;
56
54
  declare const CHARSET_KEY = "charset";
57
55
  declare const HTTP_EQUIV_KEY = "httpEquiv";
58
56
  declare const NAME_KEY = "name";
59
57
  declare const PROPERTY_KEY = "property";
60
58
  declare const CONTENT_KEY = "content";
61
59
  declare const ITEMPROP_KEY = "itemprop";
62
- type MetaTag = (CharsetMetaTag & ExcludeRestMetaTagKeys<typeof CHARSET_KEY>) | (HttpEquivMetaTag & ExcludeRestMetaTagKeys<typeof HTTP_EQUIV_KEY>) | (NameMetaTag & ExcludeRestMetaTagKeys<typeof NAME_KEY>) | (PropertyMetaTag & ExcludeRestMetaTagKeys<typeof PROPERTY_KEY>) | (ItempropMetaTag & ExcludeRestMetaTagKeys<typeof ITEMPROP_KEY>);
60
+ export type MetaTag = (CharsetMetaTag & ExcludeRestMetaTagKeys<typeof CHARSET_KEY>) | (HttpEquivMetaTag & ExcludeRestMetaTagKeys<typeof HTTP_EQUIV_KEY>) | (NameMetaTag & ExcludeRestMetaTagKeys<typeof NAME_KEY>) | (PropertyMetaTag & ExcludeRestMetaTagKeys<typeof PROPERTY_KEY>) | (ItempropMetaTag & ExcludeRestMetaTagKeys<typeof ITEMPROP_KEY>);
63
61
  type CharsetMetaTag = {
64
- [CHARSET_KEY]: string;
62
+ [CHARSET_KEY]: string;
65
63
  };
66
64
  type HttpEquivMetaTag = {
67
- [HTTP_EQUIV_KEY]: string;
68
- [CONTENT_KEY]: string;
65
+ [HTTP_EQUIV_KEY]: string;
66
+ [CONTENT_KEY]: string;
69
67
  };
70
68
  type NameMetaTag = {
71
- [NAME_KEY]: string;
72
- [CONTENT_KEY]: string;
69
+ [NAME_KEY]: string;
70
+ [CONTENT_KEY]: string;
73
71
  };
74
72
  type PropertyMetaTag = {
75
- [PROPERTY_KEY]: string;
76
- [CONTENT_KEY]: string;
73
+ [PROPERTY_KEY]: string;
74
+ [CONTENT_KEY]: string;
77
75
  };
78
76
  type ItempropMetaTag = {
79
- [ITEMPROP_KEY]: string;
80
- [CONTENT_KEY]: string;
77
+ [ITEMPROP_KEY]: string;
78
+ [CONTENT_KEY]: string;
81
79
  };
82
80
  type MetaTagKey = typeof CHARSET_KEY | typeof HTTP_EQUIV_KEY | typeof NAME_KEY | typeof PROPERTY_KEY | typeof ITEMPROP_KEY;
83
- type ExcludeRestMetaTagKeys<Key extends MetaTagKey> = {
84
- [K in Exclude<MetaTagKey, Key>]?: never;
85
- };
86
-
81
+ type ExcludeRestMetaTagKeys<Key extends MetaTagKey> = { [K in Exclude<MetaTagKey, Key>]?: never; };
82
+ declare function updateMetaTagsOnRouteChange(): void;
87
83
  type OmittedRouteProps = 'path' | 'matcher' | 'component' | 'loadComponent' | 'children' | 'loadChildren' | 'canLoad' | 'outlet';
84
+ type RouteConfig = Omit<Route, OmittedRouteProps>;
88
85
  interface DefaultRouteMeta extends Omit<Route, OmittedRouteProps | keyof RedirectRouteMeta> {
89
- canActivate?: CanActivateFn[] | DeprecatedGuard[];
90
- canActivateChild?: CanActivateChildFn[];
91
- canDeactivate?: CanDeactivateFn<unknown>[];
92
- canMatch?: CanMatchFn[];
93
- resolve?: {
94
- [key: string | symbol]: ResolveFn<unknown>;
95
- };
96
- title?: string | ResolveFn<string>;
97
- meta?: MetaTag[] | ResolveFn<MetaTag[]>;
86
+ canActivate?: CanActivateFn[] | DeprecatedGuard[];
87
+ canActivateChild?: CanActivateChildFn[];
88
+ canDeactivate?: CanDeactivateFn<unknown>[];
89
+ canMatch?: CanMatchFn[];
90
+ resolve?: {
91
+ [key: string | symbol]: ResolveFn<unknown>;
92
+ };
93
+ title?: string | ResolveFn<string>;
94
+ meta?: MetaTag[] | ResolveFn<MetaTag[]>;
98
95
  }
99
96
  interface RedirectRouteMeta {
100
- redirectTo: string;
101
- pathMatch?: Route['pathMatch'];
97
+ redirectTo: string;
98
+ pathMatch?: Route['pathMatch'];
102
99
  }
103
- type RouteMeta = (DefaultRouteMeta & {
104
- redirectTo?: never;
100
+ export type RouteMeta = (DefaultRouteMeta & {
101
+ redirectTo?: never;
105
102
  }) | RedirectRouteMeta;
106
103
  type RouteExport = {
107
- default: Type<unknown>;
108
- routeMeta?: RouteMeta | ReturnType<typeof defineRouteMeta>;
104
+ default: Type<unknown>;
105
+ routeMeta?: RouteMeta | ReturnType<typeof defineRouteMeta>;
109
106
  };
110
-
107
+ /**
108
+ * This variable reference is replaced with a glob of all page routes.
109
+ */
110
+ declare let ANALOG_ROUTE_FILES: {};
111
+ /**
112
+ * This variable reference is replaced with a glob of all content routes.
113
+ */
114
+ declare let ANALOG_CONTENT_ROUTE_FILES: {};
111
115
  type Files = Record<string, () => Promise<RouteExport | string>>;
112
116
  /**
113
117
  * A function used to parse list of files and create configuration of routes.
@@ -115,9 +119,8 @@ type Files = Record<string, () => Promise<RouteExport | string>>;
115
119
  * @param files
116
120
  * @returns Array of routes
117
121
  */
118
- declare function createRoutes(files: Files, debug?: boolean): Route[];
119
- declare const routes: Route[];
120
-
122
+ export declare function createRoutes(files: Files, debug?: boolean): Route[];
123
+ export declare const routes: Route[];
121
124
  /**
122
125
  * Sets up providers for the Angular router, and registers
123
126
  * file-based routes. Additional features can be provided
@@ -126,36 +129,32 @@ declare const routes: Route[];
126
129
  * @param features
127
130
  * @returns Providers and features to configure the router with routes
128
131
  */
129
- declare function provideFileRouter(...features: RouterFeatures[]): EnvironmentProviders;
132
+ export declare function provideFileRouter(...features: RouterFeatures[]): EnvironmentProviders;
130
133
  /**
131
134
  * Provides extra custom routes in addition to the routes
132
135
  * discovered from the filesystem-based routing. These routes are
133
136
  * inserted before the filesystem-based routes, and take priority in
134
137
  * route matching.
135
138
  */
136
- declare function withExtraRoutes(routes: Routes): RouterFeatures;
137
-
138
- type PageServerLoad = {
139
- params: H3EventContext['params'];
140
- req: H3Event['node']['req'];
141
- res: H3Event['node']['res'];
142
- fetch: $Fetch;
143
- event: H3Event;
139
+ export declare function withExtraRoutes(routes: Routes): RouterFeatures;
140
+ export type PageServerLoad = {
141
+ params: H3EventContext['params'];
142
+ req: H3Event['node']['req'];
143
+ res: H3Event['node']['res'];
144
+ fetch: $Fetch;
145
+ event: H3Event;
144
146
  };
145
- type LoadResult<A extends (pageServerLoad: PageServerLoad) => Promise<any>> = Awaited<ReturnType<A>>;
146
-
147
- declare function injectLoad<T extends (pageServerLoad: PageServerLoad) => Promise<any>>(options?: {
148
- injector?: Injector;
147
+ export type LoadResult<A extends (pageServerLoad: PageServerLoad) => Promise<any>> = Awaited<ReturnType<A>>;
148
+ export declare function injectLoad<T extends (pageServerLoad: PageServerLoad) => Promise<any>>(options?: {
149
+ injector?: Injector;
149
150
  }): Observable<Awaited<ReturnType<T>>>;
150
-
151
151
  /**
152
152
  * Get server load resolver data for the route
153
153
  *
154
154
  * @param route Provides the route to get server load resolver
155
155
  * @returns Returns server load resolver data for the route
156
156
  */
157
- declare function getLoadResolver<T>(route: ActivatedRouteSnapshot): Promise<T>;
158
-
157
+ export declare function getLoadResolver<T>(route: ActivatedRouteSnapshot): Promise<T>;
159
158
  /**
160
159
  * Interceptor that is server-aware when making HttpClient requests.
161
160
  * Server-side requests use the full URL
@@ -166,129 +165,149 @@ declare function getLoadResolver<T>(route: ActivatedRouteSnapshot): Promise<T>;
166
165
  * @param next HttpHandlerFn
167
166
  * @returns
168
167
  */
169
- declare function requestContextInterceptor(req: HttpRequest<unknown>, next: HttpHandlerFn): rxjs.Observable<_angular_common_http.HttpEvent<unknown>>;
170
-
171
- declare function injectRouteEndpointURL(route: ActivatedRouteSnapshot): URL;
172
-
173
- declare class FormAction {
174
- action: i0.InputSignal<string>;
175
- onSuccess: i0.OutputEmitterRef<unknown>;
176
- onError: i0.OutputEmitterRef<unknown>;
177
- state: i0.OutputEmitterRef<"error" | "navigate" | "redirect" | "submitting" | "success">;
178
- private router;
179
- private route;
180
- private path;
181
- submitted($event: any): void;
182
- private _handleGet;
183
- private _handlePost;
184
- private _getPath;
185
- private _isJSON;
186
- static ɵfac: i0.ɵɵFactoryDeclaration<FormAction, never>;
187
- static ɵdir: i0.ɵɵDirectiveDeclaration<FormAction, "form[action],form[method]", never, { "action": { "alias": "action"; "required": false; "isSignal": true; }; }, { "onSuccess": "onSuccess"; "onError": "onError"; "state": "state"; }, never, never, true, never>;
168
+ export declare function requestContextInterceptor(req: HttpRequest<unknown>, next: HttpHandlerFn): import("rxjs").Observable<import("@angular/common/http").HttpEvent<unknown>>;
169
+ export declare function injectRouteEndpointURL(route: ActivatedRouteSnapshot): URL;
170
+ type FormActionState = 'submitting' | 'error' | 'redirect' | 'success' | 'navigate';
171
+ export declare class FormAction {
172
+ action: import("@angular/core").InputSignal<string>;
173
+ enhanceForm: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
174
+ onSuccess: import("@angular/core").OutputEmitterRef<unknown>;
175
+ onError: import("@angular/core").OutputEmitterRef<unknown>;
176
+ state: import("@angular/core").OutputEmitterRef<FormActionState>;
177
+ private currentState;
178
+ private injector;
179
+ private router;
180
+ private route;
181
+ private path;
182
+ constructor();
183
+ submitted($event: any): void;
184
+ private _handleGet;
185
+ private _handlePost;
186
+ private _getPath;
187
+ private _handleEnhancedGet;
188
+ private _handleEnhancedPost;
189
+ private _emitState;
190
+ private _navigateTo;
191
+ private _isJSON;
192
+ static ɵfac: i0.ɵɵFactoryDeclaration<FormAction, never>;
193
+ static ɵdir: i0.ɵɵDirectiveDeclaration<FormAction, "form[action],form[method],form[enhanceForm]", never, {
194
+ "action": {
195
+ "alias": "action";
196
+ "required": false;
197
+ "isSignal": true;
198
+ };
199
+ "enhanceForm": {
200
+ "alias": "enhanceForm";
201
+ "required": false;
202
+ "isSignal": true;
203
+ };
204
+ }, {
205
+ "onSuccess": "onSuccess";
206
+ "onError": "onError";
207
+ "state": "state";
208
+ }, never, never, true, never>;
188
209
  }
189
-
210
+ type ValidationFieldErrors = Record<string, string[]>;
211
+ export declare function issuePathToFieldName(path: ReadonlyArray<string | number | symbol | {
212
+ key: string | number | symbol;
213
+ }>): string;
214
+ export declare function issuesToFieldErrors(issues: ReadonlyArray<StandardSchemaV1$1.Issue>): ValidationFieldErrors;
215
+ export declare function issuesToFormErrors(issues: ReadonlyArray<StandardSchemaV1$1.Issue>): string[];
216
+ declare const DEBUG_ROUTES: InjectionToken<(Route & DebugRoute)[]>;
190
217
  type DebugRoute = {
191
- path: string;
192
- filename: string;
193
- isLayout: boolean;
194
- children?: DebugRoute[];
218
+ path: string;
219
+ filename: string;
220
+ isLayout: boolean;
221
+ children?: DebugRoute[];
195
222
  };
196
- declare function injectDebugRoutes(): (Route & DebugRoute)[];
197
-
223
+ export declare function injectDebugRoutes(): (Route & DebugRoute)[];
224
+ declare namespace debug_page_d_exports {
225
+ export { DebugRoutesComponent as default };
226
+ }
198
227
  type CollectedRoute = {
199
- path: string;
200
- filename: string;
201
- file: string;
202
- isLayout: boolean;
228
+ path: string;
229
+ filename: string;
230
+ file: string;
231
+ isLayout: boolean;
203
232
  };
204
233
  declare class DebugRoutesComponent {
205
- collectedRoutes: CollectedRoute[];
206
- debugRoutes: (_angular_router.Route & DebugRoute)[];
207
- ngOnInit(): void;
208
- traverseRoutes(routes: DebugRoute[], parent?: string): void;
209
- static ɵfac: i0.ɵɵFactoryDeclaration<DebugRoutesComponent, never>;
210
- static ɵcmp: i0.ɵɵComponentDeclaration<DebugRoutesComponent, "analogjs-debug-routes-page", never, {}, {}, never, never, true, never>;
234
+ collectedRoutes: CollectedRoute[];
235
+ debugRoutes: (import("@angular/router").Route & DebugRoute)[];
236
+ ngOnInit(): void;
237
+ traverseRoutes(routes: DebugRoute[], parent?: string): void;
238
+ static ɵfac: i0.ɵɵFactoryDeclaration<DebugRoutesComponent, never>;
239
+ static ɵcmp: i0.ɵɵComponentDeclaration<DebugRoutesComponent, "analogjs-debug-routes-page", never, {}, {}, never, never, true, never>;
211
240
  }
212
-
213
- declare namespace __debug_page {
214
- export {
215
- DebugRoutesComponent as default,
216
- };
217
- }
218
-
219
241
  /**
220
242
  * Provides routes that provide additional
221
243
  * pages for displaying and debugging
222
244
  * routes.
223
245
  */
224
- declare function withDebugRoutes(): {
225
- ɵkind: number;
226
- ɵproviders: {
227
- provide: i0.InjectionToken<_angular_router.Route[][]>;
228
- useValue: {
229
- path: string;
230
- loadComponent: () => Promise<typeof __debug_page>;
231
- }[];
232
- multi: boolean;
246
+ export declare function withDebugRoutes(): {
247
+ ɵkind: number;
248
+ ɵproviders: {
249
+ provide: import("@angular/core").InjectionToken<import("@angular/router").Route[][]>;
250
+ useValue: {
251
+ path: string;
252
+ loadComponent: () => Promise<typeof debug_page_d_exports>;
233
253
  }[];
254
+ multi: boolean;
255
+ }[];
234
256
  };
235
-
236
257
  /** Minimal Standard Schema shape (valibot/zod/arktype conform). */
237
258
  interface StandardSchemaV1<In = unknown> {
238
- readonly '~standard': {
239
- readonly version: 1;
240
- readonly vendor: string;
241
- validate: (value: unknown) => {
242
- value: In;
243
- issues?: undefined;
244
- } | {
245
- issues: ReadonlyArray<{
246
- message: string;
247
- }>;
248
- } | Promise<{
249
- value: In;
250
- issues?: undefined;
251
- } | {
252
- issues: ReadonlyArray<{
253
- message: string;
254
- }>;
255
- }>;
256
- };
259
+ readonly '~standard': {
260
+ readonly version: 1;
261
+ readonly vendor: string;
262
+ validate: (value: unknown) => {
263
+ value: In;
264
+ issues?: undefined;
265
+ } | {
266
+ issues: ReadonlyArray<{
267
+ message: string;
268
+ }>;
269
+ } | Promise<{
270
+ value: In;
271
+ issues?: undefined;
272
+ } | {
273
+ issues: ReadonlyArray<{
274
+ message: string;
275
+ }>;
276
+ }>;
277
+ };
257
278
  }
258
279
  type ServerFnMethod = 'GET' | 'POST';
259
280
  interface ServerFnConfig<In> {
260
- /**
261
- * Opaque route id `/_analog/fn/<id>`. **Build-injected, not author-supplied:**
262
- * the Analog transform derives `hash(fileId + exportName)` and stamps it into
263
- * both the server registration and the client proxy, so authors never choose a
264
- * route. Absent at runtime means the transform did not run — `serverFn` throws.
265
- */
266
- id?: string;
267
- /** Defaults to 'POST' when `input` is present, otherwise 'GET'. */
268
- method?: ServerFnMethod;
269
- input?: StandardSchemaV1<In>;
281
+ /**
282
+ * Opaque route id `/_analog/fn/<id>`. **Build-injected, not author-supplied:**
283
+ * the Analog transform derives `hash(fileId + exportName)` and stamps it into
284
+ * both the server registration and the client proxy, so authors never choose a
285
+ * route. Absent at runtime means the transform did not run — `serverFn` throws.
286
+ */
287
+ id?: string;
288
+ /** Defaults to 'POST' when `input` is present, otherwise 'GET'. */
289
+ method?: ServerFnMethod;
290
+ input?: StandardSchemaV1<In>;
270
291
  }
271
292
  /**
272
293
  * Interceptor-accumulated context, delivered to the handler as its second
273
294
  * argument. Apps extend this by declaration merging.
274
295
  */
275
- interface ServerFnContext {
276
- }
296
+ interface ServerFnContext {}
277
297
  /** A server function reference: callable type on both sides; real impl only on the server. */
278
298
  type ServerFn<In, Out> = ((input: In) => Promise<Out>) & {
279
- readonly __serverFn: true;
280
- readonly id: string;
281
- readonly url: string;
282
- readonly method: ServerFnMethod;
299
+ readonly __serverFn: true;
300
+ readonly id: string;
301
+ readonly url: string;
302
+ readonly method: ServerFnMethod;
283
303
  };
284
304
  type ServerFnHandler<In, Out> = (input: In, context: ServerFnContext) => Promise<Out> | Out;
285
305
  interface ServerFnDef {
286
- id: string;
287
- method: ServerFnMethod;
288
- config: ServerFnConfig<unknown>;
289
- handler: ServerFnHandler<unknown, unknown>;
306
+ id: string;
307
+ method: ServerFnMethod;
308
+ config: ServerFnConfig<unknown>;
309
+ handler: ServerFnHandler<unknown, unknown>;
290
310
  }
291
-
292
311
  /**
293
312
  * Client transport for server functions. In the browser it goes through Angular
294
313
  * `HttpClient`, so client `HttpInterceptorFn`s apply. During SSR the dispatcher
@@ -296,23 +315,23 @@ interface ServerFnDef {
296
315
  * handler runs in-process in the current request injector. Lives in the client
297
316
  * entry (client-safe).
298
317
  */
299
- declare class ServerFnClient {
300
- private readonly http;
301
- private readonly transferState;
302
- private readonly injector;
303
- private readonly dispatcher;
304
- /** True while rendering on the server (the in-process dispatcher is provided). */
305
- get isServer(): boolean;
306
- call<In, Out>(fn: ServerFn<In, Out>, input: In): Promise<Out>;
307
- /** Key a read's value for TransferState hydration (fn id + input). */
308
- stateKey<Out>(fn: ServerFn<unknown, Out>, input: unknown): i0.StateKey<Out>;
309
- readSeed<Out>(fn: ServerFn<unknown, Out>, input: unknown): Out | undefined;
310
- writeSeed<Out>(fn: ServerFn<unknown, Out>, input: unknown, value: Out): void;
311
- static ɵfac: i0.ɵɵFactoryDeclaration<ServerFnClient, never>;
312
- static ɵprov: i0.ɵɵInjectableDeclaration<ServerFnClient>;
318
+ export declare class ServerFnClient {
319
+ private readonly http;
320
+ private readonly transferState;
321
+ private readonly injector;
322
+ private readonly dispatcher;
323
+ /** True while rendering on the server (the in-process dispatcher is provided). */
324
+ get isServer(): boolean;
325
+ call<In, Out>(fn: ServerFn<In, Out>, input: In): Promise<Out>;
326
+ /** Key a read's value for TransferState hydration (fn id + input). */
327
+ stateKey<Out>(fn: ServerFn<unknown, Out>, input: unknown): import("@angular/core").StateKey<Out>;
328
+ readSeed<Out>(fn: ServerFn<unknown, Out>, input: unknown): Out | undefined;
329
+ writeSeed<Out>(fn: ServerFn<unknown, Out>, input: unknown, value: Out): void;
330
+ static ɵfac: i0.ɵɵFactoryDeclaration<ServerFnClient, never>;
331
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
313
332
  }
314
333
  /** No-op provider hook; ServerFnClient is `providedIn: 'root'`. */
315
- declare function provideServerFnClient(): readonly [];
334
+ export declare function provideServerFnClient(): readonly [];
316
335
  /**
317
336
  * Reactive read of a server function as an Angular `resource()`.
318
337
  *
@@ -321,25 +340,24 @@ declare function provideServerFnClient(): readonly [];
321
340
  * the resource idle until inputs are ready, the standard resource pattern). For
322
341
  * imperative calls (mutations, event handlers) use `injectServerFnMutation`.
323
342
  */
324
- declare function injectServerFn<Out>(fn: ServerFn<void, Out>): ResourceRef<Out | undefined>;
325
- declare function injectServerFn<In, Out>(fn: ServerFn<In, Out>, args: () => In | undefined): ResourceRef<Out | undefined>;
343
+ export declare function injectServerFn<Out>(fn: ServerFn<void, Out>): ResourceRef<Out | undefined>;
344
+ export declare function injectServerFn<In, Out>(fn: ServerFn<In, Out>, args: () => In | undefined): ResourceRef<Out | undefined>;
326
345
  /**
327
346
  * Imperative binding of a server function: returns a callable that dispatches
328
347
  * the call through `HttpClient` (so client interceptors apply) and resolves the
329
348
  * result. Use for mutations and event-driven calls; use `injectServerFn` for
330
349
  * reactive reads.
331
350
  */
332
- declare function injectServerFnMutation<In, Out>(fn: ServerFn<In, Out>): (input: In) => Promise<Out>;
333
-
351
+ export declare function injectServerFnMutation<In, Out>(fn: ServerFn<In, Out>): (input: In) => Promise<Out>;
334
352
  interface ServerFnRefConfig {
335
- id?: string;
336
- method?: ServerFnMethod;
337
- /**
338
- * Only its presence matters here: when `method` is omitted, a config with an
339
- * `input` schema defaults to `POST`, otherwise `GET`. The schema itself is
340
- * never used to build the ref — validation happens server-side.
341
- */
342
- input?: unknown;
353
+ id?: string;
354
+ method?: ServerFnMethod;
355
+ /**
356
+ * Only its presence matters here: when `method` is omitted, a config with an
357
+ * `input` schema defaults to `POST`, otherwise `GET`. The schema itself is
358
+ * never used to build the ref — validation happens server-side.
359
+ */
360
+ input?: unknown;
343
361
  }
344
362
  /**
345
363
  * Builds a server-function reference: the client-safe `{ __serverFn, id, url,
@@ -353,8 +371,7 @@ interface ServerFnRefConfig {
353
371
  * The returned value is callable-typed but throws if invoked directly — it is
354
372
  * always dispatched via `injectServerFn`/`ServerFnClient`, never called.
355
373
  */
356
- declare function createServerFnRef<In, Out>(config: ServerFnRefConfig): ServerFn<In, Out>;
357
-
374
+ export declare function createServerFnRef<In, Out>(config: ServerFnRefConfig): ServerFn<In, Out>;
358
375
  /**
359
376
  * In-process transport for a server function call.
360
377
  *
@@ -375,8 +392,7 @@ declare function createServerFnRef<In, Out>(config: ServerFnRefConfig): ServerFn
375
392
  * be surprising and unportable.
376
393
  */
377
394
  type ServerFnDispatcher = <In, Out>(fn: ServerFn<In, Out>, input: In, injector: Injector) => Promise<Out>;
378
- declare const SERVER_FN_DISPATCHER: InjectionToken<ServerFnDispatcher>;
379
-
395
+ export declare const SERVER_FN_DISPATCHER: InjectionToken<ServerFnDispatcher>;
380
396
  /**
381
397
  * Typed route path utilities for Analog.
382
398
  *
@@ -393,8 +409,7 @@ declare const SERVER_FN_DISPATCHER: InjectionToken<ServerFnDispatcher>;
393
409
  * This interface is augmented by generated code in `src/routeTree.gen.d.ts`.
394
410
  * Without the generated declaration, typed helpers reject route paths.
395
411
  */
396
- interface AnalogRouteTable {
397
- }
412
+ interface AnalogRouteTable {}
398
413
  /**
399
414
  * Union of all valid route paths.
400
415
  *
@@ -406,61 +421,55 @@ type AnalogRoutePath = Extract<keyof AnalogRouteTable, string>;
406
421
  * Options for building a route URL.
407
422
  */
408
423
  interface RoutePathOptionsBase {
409
- params?: Record<string, string | number | (string | number)[] | undefined>;
410
- query?: Record<string, string | string[] | undefined>;
411
- hash?: string;
424
+ params?: Record<string, string | number | (string | number)[] | undefined>;
425
+ query?: Record<string, string | string[] | undefined>;
426
+ hash?: string;
412
427
  }
413
428
  /** Raw parameter types from the generated route table. */
414
429
  type RouteParamsOutput<P extends string> = P extends keyof AnalogRouteTable ? AnalogRouteTable[P] extends {
415
- params: infer Params;
430
+ params: infer Params;
416
431
  } ? Params : Record<string, unknown> : Record<string, unknown>;
417
432
  /**
418
433
  * Extracts the raw output type for route query params.
419
434
  */
420
435
  type RouteQueryOutput<P extends string> = P extends keyof AnalogRouteTable ? AnalogRouteTable[P] extends {
421
- query: infer O;
436
+ query: infer O;
422
437
  } ? O : Record<string, string | string[] | undefined> : Record<string, string | string[] | undefined>;
423
- type RequiredRouteParamKeys<Params> = Params extends Record<string, never> ? never : {
424
- [K in keyof Params]-?: Record<string, never> extends Pick<Params, K> ? never : K;
425
- }[keyof Params];
426
- type HasRequiredRouteParams<Params> = [RequiredRouteParamKeys<Params>] extends [
427
- never
428
- ] ? false : true;
429
- type RouteParamsInput<Params> = {
430
- [K in keyof Params]: Exclude<Params[K], undefined> extends string[] ? undefined extends Params[K] ? (string | number)[] : [string | number, ...(string | number)[]] : Exclude<Params[K], undefined> extends string ? string | number : Params[K];
431
- };
438
+ type RequiredRouteParamKeys<Params> = Params extends Record<string, never> ? never : { [K in keyof Params]-?: Record<string, never> extends Pick<Params, K> ? never : K; }[keyof Params];
439
+ type HasRequiredRouteParams<Params> = [RequiredRouteParamKeys<Params>] extends [never] ? false : true;
440
+ type RouteParamsInput<Params> = { [K in keyof Params]: Exclude<Params[K], undefined> extends string[] ? undefined extends Params[K] ? (string | number)[] : [string | number, ...(string | number)[]] : Exclude<Params[K], undefined> extends string ? string | number : Params[K]; };
432
441
  /**
433
442
  * Typed options that infer params from the route table when available.
434
443
  */
435
444
  type RoutePathOptions<P extends string = string> = P extends keyof AnalogRouteTable ? AnalogRouteTable[P] extends {
436
- params: infer Params;
445
+ params: infer Params;
437
446
  } ? Params extends Record<string, never> ? {
438
- params?: never;
439
- query?: RouteQueryOutput<P>;
440
- hash?: string;
447
+ params?: never;
448
+ query?: RouteQueryOutput<P>;
449
+ hash?: string;
441
450
  } : HasRequiredRouteParams<Params> extends true ? {
442
- params: RouteParamsInput<Params>;
443
- query?: RouteQueryOutput<P>;
444
- hash?: string;
451
+ params: RouteParamsInput<Params>;
452
+ query?: RouteQueryOutput<P>;
453
+ hash?: string;
445
454
  } : {
446
- params?: RouteParamsInput<Params>;
447
- query?: RouteQueryOutput<P>;
448
- hash?: string;
455
+ params?: RouteParamsInput<Params>;
456
+ query?: RouteQueryOutput<P>;
457
+ hash?: string;
449
458
  } : RoutePathOptionsBase : RoutePathOptionsBase;
450
459
  /**
451
460
  * Conditional args: require options when the route has params.
452
461
  */
453
462
  type RoutePathArgs<P extends string = string> = P extends keyof AnalogRouteTable ? AnalogRouteTable[P] extends {
454
- params: infer Params;
463
+ params: infer Params;
455
464
  } ? Params extends Record<string, never> ? [options?: RoutePathOptions<P>] : HasRequiredRouteParams<Params> extends true ? [options: RoutePathOptions<P>] : [options?: RoutePathOptions<P>] : [options?: RoutePathOptionsBase] : [options?: RoutePathOptionsBase];
456
465
  /**
457
466
  * Result of `toRoute()` — contains properties that map directly
458
467
  * to Angular's `[routerLink]`, `[queryParams]`, and `[fragment]` inputs.
459
468
  */
460
469
  interface RouteLinkResult {
461
- path: string[];
462
- queryParams: Record<string, string | string[]> | null;
463
- fragment: string | undefined;
470
+ path: string[];
471
+ queryParams: Record<string, string | string[]> | null;
472
+ fragment: string | undefined;
464
473
  }
465
474
  /**
466
475
  * Builds a typed route link object from a route path pattern and options.
@@ -488,32 +497,46 @@ interface RouteLinkResult {
488
497
  * <a [routerLink]="link.path" [queryParams]="link.queryParams" [fragment]="link.fragment">
489
498
  * ```
490
499
  */
491
- declare function toRoute<P extends AnalogRoutePath>(path: P, ...args: RoutePathArgs<P>): RouteLinkResult;
492
-
493
- type LinkToDestination = {
494
- [P in AnalogRoutePath]: {
495
- path: P;
496
- } & RoutePathOptions<P>;
497
- }[AnalogRoutePath];
498
- type StaticRoutePath = {
499
- [P in AnalogRoutePath]: RouteParamsOutput<P> extends Record<string, never> ? P : never;
500
- }[AnalogRoutePath];
501
- declare class LinkTo implements OnChanges {
502
- readonly linkTo: InputSignal<StaticRoutePath | LinkToDestination | null | undefined>;
503
- private readonly routerLink;
504
- ngOnChanges(): void;
505
- static ɵfac: i0.ɵɵFactoryDeclaration<LinkTo, never>;
506
- static ɵdir: i0.ɵɵDirectiveDeclaration<LinkTo, "[linkTo]", never, { "linkTo": { "alias": "linkTo"; "required": true; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof _angular_router.RouterLink; inputs: { "target": "target"; "queryParamsHandling": "queryParamsHandling"; "preserveFragment": "preserveFragment"; "skipLocationChange": "skipLocationChange"; "replaceUrl": "replaceUrl"; "state": "state"; }; outputs: {}; }]>;
500
+ export declare function toRoute<P extends AnalogRoutePath>(path: P, ...args: RoutePathArgs<P>): RouteLinkResult;
501
+ /**
502
+ * Internal: builds a `RouteLinkResult` from path and options.
503
+ * Exported for direct use in tests (avoids generic constraints).
504
+ */
505
+ declare function buildRouteLink(path: string, options?: RoutePathOptionsBase): RouteLinkResult;
506
+ /** Internal URL serialization for programmatic navigation. */
507
+ declare function buildUrl(path: string, options?: RoutePathOptionsBase): string;
508
+ type LinkToDestination = { [P in AnalogRoutePath]: {
509
+ path: P;
510
+ } & RoutePathOptions<P>; }[AnalogRoutePath];
511
+ type StaticRoutePath = { [P in AnalogRoutePath]: RouteParamsOutput<P> extends Record<string, never> ? P : never; }[AnalogRoutePath];
512
+ export declare class LinkTo implements OnChanges {
513
+ readonly linkTo: InputSignal<StaticRoutePath | LinkToDestination | null | undefined>;
514
+ private readonly routerLink;
515
+ ngOnChanges(): void;
516
+ static ɵfac: i0.ɵɵFactoryDeclaration<LinkTo, never>;
517
+ static ɵdir: i0.ɵɵDirectiveDeclaration<LinkTo, "[linkTo]", never, {
518
+ "linkTo": {
519
+ "alias": "linkTo";
520
+ "required": true;
521
+ "isSignal": true;
522
+ };
523
+ }, {}, never, never, true, [{
524
+ directive: typeof i1.RouterLink;
525
+ inputs: {
526
+ "target": "target";
527
+ "queryParamsHandling": "queryParamsHandling";
528
+ "preserveFragment": "preserveFragment";
529
+ "skipLocationChange": "skipLocationChange";
530
+ "replaceUrl": "replaceUrl";
531
+ "state": "state";
532
+ };
533
+ outputs: {};
534
+ }]>;
507
535
  }
508
-
509
- type NavigateWithExtrasArgs<P extends AnalogRoutePath> = [
510
- ] extends RoutePathArgs<P> ? [extras: NavigationBehaviorOptions] | [
511
- options: RoutePathArgs<P>[0] | undefined,
512
- extras: NavigationBehaviorOptions
513
- ] : [options: RoutePathArgs<P>[0], extras: NavigationBehaviorOptions];
536
+ type NavigateWithExtrasArgs<P extends AnalogRoutePath> = [] extends RoutePathArgs<P> ? [extras: NavigationBehaviorOptions] | [options: RoutePathArgs<P>[0] | undefined, extras: NavigationBehaviorOptions] : [options: RoutePathArgs<P>[0], extras: NavigationBehaviorOptions];
514
537
  type TypedNavigate = {
515
- <P extends AnalogRoutePath>(path: P, ...args: RoutePathArgs<P>): Promise<boolean>;
516
- <P extends AnalogRoutePath>(path: P, ...args: NavigateWithExtrasArgs<P>): Promise<boolean>;
538
+ <P extends AnalogRoutePath>(path: P, ...args: RoutePathArgs<P>): Promise<boolean>;
539
+ <P extends AnalogRoutePath>(path: P, ...args: NavigateWithExtrasArgs<P>): Promise<boolean>;
517
540
  };
518
541
  /**
519
542
  * Injects a typed navigate function.
@@ -529,16 +552,13 @@ type TypedNavigate = {
529
552
  * navigate('/users/[id]', { params: { id: '42' } }, { replaceUrl: true });
530
553
  * ```
531
554
  */
532
- declare function injectNavigate(): TypedNavigate;
533
-
555
+ export declare function injectNavigate(): TypedNavigate;
534
556
  /** Read raw route params; catch-all segments are returned as arrays. */
535
- declare function injectParams<P extends AnalogRoutePath>(_from: P, options?: {
536
- injector?: Injector;
557
+ export declare function injectParams<P extends AnalogRoutePath>(_from: P, options?: {
558
+ injector?: Injector;
537
559
  }): Signal<RouteParamsOutput<P>>;
538
560
  /** Read raw query params as a signal. No schema coercion is performed. */
539
- declare function injectQuery<P extends AnalogRoutePath>(_from: P, options?: {
540
- injector?: Injector;
561
+ export declare function injectQuery<P extends AnalogRoutePath>(_from: P, options?: {
562
+ injector?: Injector;
541
563
  }): Signal<RouteQueryOutput<P>>;
542
-
543
- export { FormAction, LinkTo, SERVER_FN_DISPATCHER, ServerFnClient, createRoutes, createServerFnRef, defineRouteMeta, getLoadResolver, injectActivatedRoute, injectDebugRoutes, injectLoad, injectNavigate, injectParams, injectQuery, injectRouteEndpointURL, injectRouter, injectServerFn, injectServerFnMutation, provideFileRouter, provideServerFnClient, requestContextInterceptor, routes, toRoute, withDebugRoutes, withExtraRoutes };
544
- export type { AnalogRoutePath, AnalogRouteTable, Files, LoadResult, MetaTag, PageServerLoad, RouteExport, RouteMeta, RoutePathOptions, ServerFn, ServerFnConfig, ServerFnContext, ServerFnDef, ServerFnDispatcher, ServerFnHandler, ServerFnMethod, ServerFnRefConfig, StandardSchemaV1 };
564
+ export type { AnalogRoutePath, AnalogRouteTable, Files, FormActionState, RouteExport, RoutePathOptions, ServerFn, ServerFnConfig, ServerFnContext, ServerFnDef, ServerFnDispatcher, ServerFnHandler, ServerFnMethod, ServerFnRefConfig, StandardSchemaV1, ValidationFieldErrors };