@analogjs/router 2.8.0-beta.15 → 2.8.0-beta.16
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/fesm2022/analogjs-router.mjs +181 -83
- package/fesm2022/analogjs-router.mjs.map +1 -1
- package/package.json +2 -2
- package/types/analogjs-router.d.ts +304 -127
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as ANALOG_META_KEY, i as injectRouteEndpointURL, n as createRoutes, o as updateMetaTagsOnRouteChange, r as routes, t as injectDebugRoutes } from "./analogjs-router-routes-L2tt-0ms.mjs";
|
|
2
2
|
import * as i1 from "@angular/router";
|
|
3
|
-
import { ActivatedRoute,
|
|
3
|
+
import { ActivatedRoute, ROUTES, Router, RouterLink, provideRouter } from "@angular/router";
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
import { Directive, ENVIRONMENT_INITIALIZER, ElementRef, Injectable, InjectionToken, Injector, PLATFORM_ID, Renderer2, TransferState, assertInInjectionContext, booleanAttribute, effect, inject, input, makeEnvironmentProviders, makeStateKey, output, resource, runInInjectionContext, signal } from "@angular/core";
|
|
6
6
|
import { HttpClient, HttpHeaders, HttpResponse, ɵHTTP_ROOT_INTERCEPTOR_FNS } from "@angular/common/http";
|
|
@@ -59,8 +59,8 @@ function withExtraRoutes(routes) {
|
|
|
59
59
|
}]
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
-
function injectLoad(options) {
|
|
63
|
-
return (options?.injector ?? inject(Injector)).get(ActivatedRoute).data.pipe(map((data) => data["load"]));
|
|
62
|
+
function injectLoad(pathOrOptions, options) {
|
|
63
|
+
return ((typeof pathOrOptions === "string" ? options : pathOrOptions)?.injector ?? inject(Injector)).get(ActivatedRoute).data.pipe(map((data) => data["load"]));
|
|
64
64
|
}
|
|
65
65
|
async function getLoadResolver(route) {
|
|
66
66
|
return route.routeConfig?.resolve?.["load"]?.(route);
|
|
@@ -645,20 +645,9 @@ function toRoute(path, ...args) {
|
|
|
645
645
|
return buildRouteLink(path, options);
|
|
646
646
|
}
|
|
647
647
|
function buildRouteLink(path, options) {
|
|
648
|
-
const resolvedPath = buildPath(path, options?.params);
|
|
649
|
-
let queryParams = null;
|
|
650
|
-
if (options?.query) {
|
|
651
|
-
const filtered = {};
|
|
652
|
-
let hasEntries = false;
|
|
653
|
-
for (const [key, value] of Object.entries(options.query)) if (value !== void 0) {
|
|
654
|
-
filtered[key] = value;
|
|
655
|
-
hasEntries = true;
|
|
656
|
-
}
|
|
657
|
-
if (hasEntries) queryParams = filtered;
|
|
658
|
-
}
|
|
659
648
|
return {
|
|
660
|
-
path:
|
|
661
|
-
queryParams,
|
|
649
|
+
path: buildPath(path, options?.params),
|
|
650
|
+
queryParams: options?.query ?? null,
|
|
662
651
|
fragment: options?.hash
|
|
663
652
|
};
|
|
664
653
|
}
|
|
@@ -677,20 +666,132 @@ function buildPath(path, params = {}) {
|
|
|
677
666
|
return Array.isArray(value) ? value.map(String) : [String(value)];
|
|
678
667
|
})];
|
|
679
668
|
}
|
|
680
|
-
function
|
|
681
|
-
|
|
682
|
-
const segments =
|
|
683
|
-
const
|
|
684
|
-
|
|
669
|
+
function resolveRoutePath(from, to) {
|
|
670
|
+
if (to.startsWith("/")) return to;
|
|
671
|
+
const segments = from.split("/").filter(Boolean);
|
|
672
|
+
for (const part of to.split("/")) if (part === "..") segments.pop();
|
|
673
|
+
else if (part && part !== ".") segments.push(part);
|
|
674
|
+
return "/" + segments.join("/");
|
|
675
|
+
}
|
|
676
|
+
function resolveScopedRoute(from, target, current, options) {
|
|
677
|
+
const path = resolveRoutePath(from, target);
|
|
678
|
+
const fromSegments = from.split("/").filter(Boolean);
|
|
679
|
+
const toSegments = path.split("/").filter(Boolean);
|
|
680
|
+
const params = {};
|
|
681
|
+
for (let i = 0; i < toSegments.length && toSegments[i] === fromSegments[i]; i++) {
|
|
682
|
+
const name = paramName(toSegments[i]);
|
|
683
|
+
if (name) params[name] = current[name];
|
|
684
|
+
}
|
|
685
|
+
return {
|
|
686
|
+
path,
|
|
687
|
+
options: {
|
|
688
|
+
...options,
|
|
689
|
+
params: {
|
|
690
|
+
...params,
|
|
691
|
+
...options?.params
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
};
|
|
695
|
+
}
|
|
696
|
+
function paramName(segment) {
|
|
697
|
+
return (segment.match(/^\[\[\.\.\.([^\]]+)\]\]$/) ?? segment.match(/^\[\.\.\.([^\]]+)\]$/) ?? segment.match(/^\[([^\]]+)\]$/))?.[1];
|
|
698
|
+
}
|
|
699
|
+
function extractCatchAllParams(routePath) {
|
|
700
|
+
const params = [];
|
|
701
|
+
for (const segment of routePath.split("/")) {
|
|
702
|
+
const optional = segment.match(/^\[\[\.\.\.([^\]]+)\]\]$/);
|
|
703
|
+
const required = segment.match(/^\[\.\.\.([^\]]+)\]$/);
|
|
704
|
+
if (optional) params.push({
|
|
705
|
+
name: optional[1],
|
|
706
|
+
type: "optionalCatchAll"
|
|
707
|
+
});
|
|
708
|
+
else if (required) params.push({
|
|
709
|
+
name: required[1],
|
|
710
|
+
type: "catchAll"
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
return params;
|
|
714
|
+
}
|
|
715
|
+
function observeRouteParams(route, routePath) {
|
|
716
|
+
const ancestors = route.pathFromRoot ?? [route];
|
|
717
|
+
const catchAllParams = extractCatchAllParams(routePath);
|
|
718
|
+
return combineLatest([combineLatest(ancestors.map((entry) => entry.params)), combineLatest(ancestors.map((entry) => entry.url ?? of([])))]).pipe(map(([values, segments]) => {
|
|
719
|
+
const params = Object.assign({}, ...values);
|
|
720
|
+
for (const param of catchAllParams) {
|
|
721
|
+
const source = ancestors.findIndex((entry, index) => param.type === "catchAll" ? entry.routeConfig?.path === "**" : !!entry.routeConfig?.matcher && values[index][param.name] != null);
|
|
722
|
+
if (source !== -1) params[param.name] = segments[source].map((segment) => segment.path);
|
|
723
|
+
}
|
|
724
|
+
return params;
|
|
725
|
+
}));
|
|
726
|
+
}
|
|
727
|
+
function resolveArgs(fromOrOptions, options) {
|
|
728
|
+
const typed = typeof fromOrOptions === "string";
|
|
729
|
+
const injector = (typed ? options : fromOrOptions)?.injector;
|
|
730
|
+
return {
|
|
731
|
+
from: typed ? fromOrOptions : "",
|
|
732
|
+
injector,
|
|
733
|
+
route: injector ? injector.get(ActivatedRoute) : inject(ActivatedRoute)
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
function injectParams(fromOrOptions, options) {
|
|
737
|
+
const { from, injector, route } = resolveArgs(fromOrOptions, options);
|
|
738
|
+
return toSignal(observeRouteParams(route, from), {
|
|
739
|
+
requireSync: true,
|
|
740
|
+
injector
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
function injectQuery(fromOrOptions, options) {
|
|
744
|
+
const { injector, route } = resolveArgs(fromOrOptions, options);
|
|
745
|
+
return toSignal(route.queryParams, {
|
|
746
|
+
requireSync: true,
|
|
747
|
+
injector
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
function injectRouteData(fromOrOptions, options) {
|
|
751
|
+
const { injector, route } = resolveArgs(fromOrOptions, options);
|
|
752
|
+
return toSignal(route.data, {
|
|
753
|
+
requireSync: true,
|
|
754
|
+
injector
|
|
755
|
+
});
|
|
756
|
+
}
|
|
757
|
+
function injectResources(fromOrOptions, options) {
|
|
758
|
+
const { route } = resolveArgs(fromOrOptions, options);
|
|
759
|
+
return "resources" in route ? route.resources ?? {} : {};
|
|
685
760
|
}
|
|
686
761
|
var LinkTo = class LinkTo {
|
|
687
762
|
constructor() {
|
|
688
763
|
this.linkTo = input.required(...ngDevMode ? [{ debugName: "linkTo" }] : /* istanbul ignore next */ []);
|
|
764
|
+
this.from = input(...ngDevMode ? [void 0, { debugName: "from" }] : /* istanbul ignore next */ []);
|
|
689
765
|
this.routerLink = inject(RouterLink);
|
|
766
|
+
this.route = inject(ActivatedRoute);
|
|
767
|
+
this.currentParams = {};
|
|
690
768
|
}
|
|
691
769
|
ngOnChanges() {
|
|
770
|
+
const from = this.from();
|
|
771
|
+
if (from !== this.paramsFrom) {
|
|
772
|
+
this.paramsFrom = from;
|
|
773
|
+
this.paramsSubscription?.unsubscribe();
|
|
774
|
+
this.paramsSubscription = from ? observeRouteParams(this.route, from).subscribe((params) => {
|
|
775
|
+
this.currentParams = params;
|
|
776
|
+
this.update();
|
|
777
|
+
}) : void 0;
|
|
778
|
+
}
|
|
779
|
+
this.update();
|
|
780
|
+
}
|
|
781
|
+
ngOnDestroy() {
|
|
782
|
+
this.paramsSubscription?.unsubscribe();
|
|
783
|
+
}
|
|
784
|
+
update() {
|
|
692
785
|
const destination = this.linkTo();
|
|
693
|
-
const
|
|
786
|
+
const from = this.from();
|
|
787
|
+
let link = null;
|
|
788
|
+
if (destination) {
|
|
789
|
+
const { path, ...options } = typeof destination === "string" ? { path: destination } : destination;
|
|
790
|
+
if (from) {
|
|
791
|
+
const scoped = resolveScopedRoute(from, path, this.currentParams, options);
|
|
792
|
+
link = buildRouteLink(scoped.path, scoped.options);
|
|
793
|
+
} else link = buildRouteLink(path, options);
|
|
794
|
+
}
|
|
694
795
|
this.routerLink.routerLink = link?.path ?? null;
|
|
695
796
|
this.routerLink.queryParams = link?.queryParams ?? null;
|
|
696
797
|
this.routerLink.fragment = link?.fragment;
|
|
@@ -713,13 +814,22 @@ var LinkTo = class LinkTo {
|
|
|
713
814
|
type: LinkTo,
|
|
714
815
|
isStandalone: true,
|
|
715
816
|
selector: "[linkTo]",
|
|
716
|
-
inputs: {
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
817
|
+
inputs: {
|
|
818
|
+
linkTo: {
|
|
819
|
+
classPropertyName: "linkTo",
|
|
820
|
+
publicName: "linkTo",
|
|
821
|
+
isSignal: true,
|
|
822
|
+
isRequired: true,
|
|
823
|
+
transformFunction: null
|
|
824
|
+
},
|
|
825
|
+
from: {
|
|
826
|
+
classPropertyName: "from",
|
|
827
|
+
publicName: "from",
|
|
828
|
+
isSignal: true,
|
|
829
|
+
isRequired: false,
|
|
830
|
+
transformFunction: null
|
|
831
|
+
}
|
|
832
|
+
},
|
|
723
833
|
usesOnChanges: true,
|
|
724
834
|
hostDirectives: [{
|
|
725
835
|
directive: i1.RouterLink,
|
|
@@ -765,21 +875,37 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
765
875
|
}]
|
|
766
876
|
}]
|
|
767
877
|
}],
|
|
768
|
-
propDecorators: {
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
878
|
+
propDecorators: {
|
|
879
|
+
linkTo: [{
|
|
880
|
+
type: i0.Input,
|
|
881
|
+
args: [{
|
|
882
|
+
isSignal: true,
|
|
883
|
+
alias: "linkTo",
|
|
884
|
+
required: true
|
|
885
|
+
}]
|
|
886
|
+
}],
|
|
887
|
+
from: [{
|
|
888
|
+
type: i0.Input,
|
|
889
|
+
args: [{
|
|
890
|
+
isSignal: true,
|
|
891
|
+
alias: "from",
|
|
892
|
+
required: false
|
|
893
|
+
}]
|
|
774
894
|
}]
|
|
775
|
-
}
|
|
895
|
+
}
|
|
776
896
|
});
|
|
777
897
|
function isRoutePathOptionsBase(value) {
|
|
778
898
|
return !!value && typeof value === "object" && ("params" in value || "query" in value || "hash" in value);
|
|
779
899
|
}
|
|
780
|
-
function
|
|
781
|
-
|
|
782
|
-
|
|
900
|
+
function update(value, current) {
|
|
901
|
+
return typeof value === "function" ? value(current) : value;
|
|
902
|
+
}
|
|
903
|
+
function injectNavigate(from, options) {
|
|
904
|
+
const injector = options?.injector ?? inject(Injector);
|
|
905
|
+
const router = injector.get(Router);
|
|
906
|
+
const currentParams = from ? injectParams(from, { injector }) : void 0;
|
|
907
|
+
const currentQuery = from ? injectQuery(from, { injector }) : void 0;
|
|
908
|
+
return (target, ...args) => {
|
|
783
909
|
let options;
|
|
784
910
|
let extras;
|
|
785
911
|
if (args.length > 1) {
|
|
@@ -787,51 +913,23 @@ function injectNavigate() {
|
|
|
787
913
|
extras = args[1];
|
|
788
914
|
} else if (args.length === 1) if (isRoutePathOptionsBase(args[0])) options = args[0];
|
|
789
915
|
else extras = args[0];
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
const optional = segment.match(/^\[\[\.\.\.([^\]]+)\]\]$/);
|
|
799
|
-
const required = segment.match(/^\[\.\.\.([^\]]+)\]$/);
|
|
800
|
-
if (optional) params.push({
|
|
801
|
-
name: optional[1],
|
|
802
|
-
type: "optionalCatchAll"
|
|
803
|
-
});
|
|
804
|
-
else if (required) params.push({
|
|
805
|
-
name: required[1],
|
|
806
|
-
type: "catchAll"
|
|
807
|
-
});
|
|
808
|
-
}
|
|
809
|
-
return params;
|
|
810
|
-
}
|
|
811
|
-
function injectParams(_from, options) {
|
|
812
|
-
const injector = options?.injector;
|
|
813
|
-
const route = injector ? injector.get(ActivatedRoute) : inject(ActivatedRoute);
|
|
814
|
-
const ancestors = route.pathFromRoot ?? [route];
|
|
815
|
-
const catchAllParams = extractCatchAllParams(_from);
|
|
816
|
-
return toSignal(combineLatest([combineLatest(ancestors.map((entry) => entry.params)), combineLatest(ancestors.map((entry) => entry.url ?? of([])))]).pipe(map(([values, segments]) => {
|
|
817
|
-
const params = Object.assign({}, ...values);
|
|
818
|
-
for (const param of catchAllParams) {
|
|
819
|
-
const source = ancestors.findIndex((entry, index) => param.type === "catchAll" ? entry.routeConfig?.path === "**" : !!entry.routeConfig?.matcher && values[index][param.name] != null);
|
|
820
|
-
if (source !== -1) params[param.name] = segments[source].map((segment) => segment.path);
|
|
916
|
+
let path = target;
|
|
917
|
+
if (from && currentParams && currentQuery) {
|
|
918
|
+
const params = currentParams();
|
|
919
|
+
({path, options} = resolveScopedRoute(from, target, params, {
|
|
920
|
+
...options,
|
|
921
|
+
params: update(options?.params, params),
|
|
922
|
+
query: update(options?.query, currentQuery())
|
|
923
|
+
}));
|
|
821
924
|
}
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
const injector = options?.injector;
|
|
830
|
-
return toSignal((injector ? injector.get(ActivatedRoute) : inject(ActivatedRoute)).queryParams.pipe(map((params) => params)), {
|
|
831
|
-
requireSync: true,
|
|
832
|
-
injector
|
|
833
|
-
});
|
|
925
|
+
const link = buildRouteLink(path, options);
|
|
926
|
+
return router.navigate(link.path, {
|
|
927
|
+
...extras,
|
|
928
|
+
queryParams: link.queryParams,
|
|
929
|
+
fragment: link.fragment
|
|
930
|
+
});
|
|
931
|
+
};
|
|
834
932
|
}
|
|
835
|
-
export { FormAction, LinkTo, SERVER_FN_DISPATCHER, ServerFnClient, createRoutes, createServerFnRef, defineRouteMeta, getLoadResolver, injectActivatedRoute, injectDebugRoutes, injectLoad, injectNavigate, injectParams, injectQuery, injectRouteEndpointURL, injectRouter, injectServerFn, injectServerFnMutation, issuePathToFieldName, issuesToFieldErrors, issuesToFormErrors, provideFileRouter, provideServerFnClient, requestContextInterceptor, routes, toRoute, withDebugRoutes, withExtraRoutes };
|
|
933
|
+
export { FormAction, LinkTo, SERVER_FN_DISPATCHER, ServerFnClient, createRoutes, createServerFnRef, defineRouteMeta, getLoadResolver, injectActivatedRoute, injectDebugRoutes, injectLoad, injectNavigate, injectParams, injectQuery, injectResources, injectResources as injectRouteResources, injectRouteData, injectRouteEndpointURL, injectRouter, injectServerFn, injectServerFnMutation, issuePathToFieldName, issuesToFieldErrors, issuesToFormErrors, provideFileRouter, provideServerFnClient, requestContextInterceptor, routes, toRoute, withDebugRoutes, withExtraRoutes };
|
|
836
934
|
|
|
837
935
|
//# sourceMappingURL=analogjs-router.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analogjs-router.mjs","names":[],"sources":["../../../../packages/router/src/lib/define-route.ts","../../../../packages/router/src/lib/cookie-interceptor.ts","../../../../packages/router/src/lib/provide-file-router.ts","../../../../packages/router/src/lib/inject-load.ts","../../../../packages/router/src/lib/get-load-resolver.ts","../../../../packages/router/src/lib/cache-key.ts","../../../../packages/router/src/lib/request-context.ts","../../../../packages/router/src/lib/form-action.directive.ts","../../../../packages/router/src/lib/validation-errors.ts","../../../../packages/router/src/lib/debug/index.ts","../../../../packages/router/src/lib/server-fn/dispatcher.ts","../../../../packages/router/src/lib/server-fn/inject-server-fn.ts","../../../../packages/router/src/lib/server-fn/server-fn-ref.ts","../../../../packages/router/src/lib/to-route.ts","../../../../packages/router/src/lib/link-to.directive.ts","../../../../packages/router/src/lib/inject-navigate.ts","../../../../packages/router/src/lib/inject-typed-params.ts"],"sourcesContent":["import { inject } from '@angular/core';\nimport { Route as NgRoute, Router } from '@angular/router';\nimport { ActivatedRoute } from '@angular/router';\n\ntype RouteOmitted =\n | 'component'\n | 'loadComponent'\n | 'loadChildren'\n | 'path'\n | 'pathMatch';\n\ntype RestrictedRoute = Omit<NgRoute, RouteOmitted>;\n\n/**\n * @deprecated Use `RouteMeta` type instead.\n * For more info see: https://github.com/analogjs/analog/issues/223\n *\n * Defines additional route config metadata. This\n * object is merged into the route config with\n * the predefined file-based route.\n *\n * @usageNotes\n *\n * ```\n * import { Component } from '@angular/core';\n * import { defineRouteMeta } from '@analogjs/router';\n *\n * export const routeMeta = defineRouteMeta({\n * title: 'Welcome'\n * });\n *\n * @Component({\n * template: `Home`,\n * standalone: true,\n * })\n * export default class HomeComponent {}\n * ```\n *\n * @param route\n * @returns\n */\nexport const defineRouteMeta = (route: RestrictedRoute) => {\n return route;\n};\n\n/**\n * Returns the instance of Angular Router\n *\n * @returns The router\n */\nexport const injectRouter = () => {\n return inject(Router);\n};\n\n/**\n * Returns the instance of the Activate Route for the component\n *\n * @returns The activated route\n */\nexport const injectActivatedRoute = () => {\n return inject(ActivatedRoute);\n};\n","import { isPlatformServer } from '@angular/common';\nimport { HttpHandlerFn, HttpHeaders, HttpRequest } from '@angular/common/http';\nimport { PLATFORM_ID, inject } from '@angular/core';\nimport { injectRequest } from '@analogjs/router/tokens';\n\nexport function cookieInterceptor(\n req: HttpRequest<unknown>,\n next: HttpHandlerFn,\n location = inject(PLATFORM_ID),\n serverRequest = injectRequest(),\n) {\n if (isPlatformServer(location) && req.url.includes('/_analog/')) {\n let headers = new HttpHeaders();\n const cookies = serverRequest?.headers.cookie;\n headers = headers.set('cookie', cookies ?? '');\n\n const cookiedRequest = req.clone({\n headers,\n });\n\n return next(cookiedRequest);\n } else {\n return next(req);\n }\n}\n","import {\n ENVIRONMENT_INITIALIZER,\n EnvironmentProviders,\n makeEnvironmentProviders,\n} from '@angular/core';\nimport { provideRouter, RouterFeatures, ROUTES, Routes } from '@angular/router';\nimport { API_PREFIX } from '@analogjs/router/tokens';\nimport { ɵHTTP_ROOT_INTERCEPTOR_FNS as HTTP_ROOT_INTERCEPTOR_FNS } from '@angular/common/http';\n\nimport { routes } from './routes';\nimport { updateMetaTagsOnRouteChange } from './meta-tags';\nimport { cookieInterceptor } from './cookie-interceptor';\n\ndeclare const ANALOG_API_PREFIX: string;\n\n/**\n * Sets up providers for the Angular router, and registers\n * file-based routes. Additional features can be provided\n * to further configure the behavior of the router.\n *\n * @param features\n * @returns Providers and features to configure the router with routes\n */\nexport function provideFileRouter(\n ...features: RouterFeatures[]\n): EnvironmentProviders {\n const extraRoutesFeature = features.filter((feat) => feat.ɵkind >= 100);\n const routerFeatures = features.filter((feat) => feat.ɵkind < 100);\n\n return makeEnvironmentProviders([\n extraRoutesFeature.map((erf) => erf.ɵproviders),\n provideRouter(routes, ...routerFeatures),\n {\n provide: ENVIRONMENT_INITIALIZER,\n multi: true,\n useValue: () => updateMetaTagsOnRouteChange(),\n },\n {\n provide: HTTP_ROOT_INTERCEPTOR_FNS,\n multi: true,\n useValue: cookieInterceptor,\n },\n {\n provide: API_PREFIX,\n useFactory() {\n return typeof ANALOG_API_PREFIX !== 'undefined'\n ? ANALOG_API_PREFIX\n : 'api';\n },\n },\n ]);\n}\n\n/**\n * Provides extra custom routes in addition to the routes\n * discovered from the filesystem-based routing. These routes are\n * inserted before the filesystem-based routes, and take priority in\n * route matching.\n */\nexport function withExtraRoutes(routes: Routes): RouterFeatures {\n return {\n ɵkind: 100 as number,\n ɵproviders: [{ provide: ROUTES, useValue: routes, multi: true }],\n };\n}\n","import { Injector, inject } from '@angular/core';\nimport { ActivatedRoute, Data } from '@angular/router';\nimport { Observable, map } from 'rxjs';\n\nimport { PageServerLoad } from './route-types';\n\nexport function injectLoad<\n T extends (pageServerLoad: PageServerLoad) => Promise<any>,\n>(options?: { injector?: Injector }): Observable<Awaited<ReturnType<T>>> {\n const injector = options?.injector ?? inject(Injector);\n const route = injector.get(ActivatedRoute);\n\n return route.data.pipe(\n map<Data, Awaited<ReturnType<T>>>((data) => data['load']),\n );\n}\n","import { ActivatedRouteSnapshot } from '@angular/router';\n\n/**\n * Get server load resolver data for the route\n *\n * @param route Provides the route to get server load resolver\n * @returns Returns server load resolver data for the route\n */\nexport async function getLoadResolver<T>(\n route: ActivatedRouteSnapshot,\n): Promise<T> {\n return route.routeConfig?.resolve?.['load']?.(route);\n}\n","import { HttpParams, HttpRequest } from '@angular/common/http';\nimport { StateKey, makeStateKey } from '@angular/core';\n\n// Length-prefix each atom (netstring style) so no field, parameter key, or\n// parameter value can be crafted to shift another's boundary. Without this a\n// hash over delimiter-joined fields still collides on ambiguous inputs, e.g.\n// `?tag=x&tag=y` and `?tag=x,y` both serialize to `tag=x,y`.\nfunction encodeAtom(value: string): string {\n return `${value.length}:${value}`;\n}\n\nfunction sortAndConcatParams(params: HttpParams | URLSearchParams): string {\n const keys = [...new Set(params.keys())].sort();\n const atoms: string[] = [];\n for (const key of keys) {\n for (const value of params.getAll(key) ?? []) {\n atoms.push(encodeAtom(key), encodeAtom(value));\n }\n }\n return atoms.join('');\n}\n\nexport function makeCacheKey(\n request: HttpRequest<any>,\n mappedRequestUrl: string,\n): StateKey<unknown> {\n const { params, method, responseType } = request;\n const encodedParams = sortAndConcatParams(params);\n\n let serializedBody = request.serializeBody();\n if (serializedBody instanceof URLSearchParams) {\n serializedBody = sortAndConcatParams(serializedBody);\n } else if (typeof serializedBody !== 'string') {\n serializedBody = '';\n }\n\n const key = [\n method,\n responseType,\n mappedRequestUrl,\n serializedBody,\n encodedParams,\n ]\n .map(encodeAtom)\n .join('');\n\n const hash = generateHash(key);\n\n return makeStateKey(hash);\n}\n\n/**\n * SHA-256 round constants (first 32 bits of the fractional parts of the cube\n * roots of the first 64 primes).\n */\nconst SHA256_ROUND_CONSTANTS = /* @__PURE__ */ new Uint32Array([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1,\n 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,\n 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786,\n 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,\n 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,\n 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b,\n 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,\n 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,\n 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,\n]);\n\nlet textEncoder: TextEncoder | undefined;\n\n/**\n * Generates a SHA-256 hash of a string. This mirrors Angular's `HttpTransferCache`\n * key derivation: a synchronous SHA-256 is used because the Web Crypto API is\n * asynchronous, whereas cache-key derivation in the interceptor must stay\n * synchronous. The previous 32-bit DJB2 hash had a keyspace small enough for an\n * attacker to craft colliding requests and poison the transfer cache.\n */\nfunction generateHash(value: string): string {\n textEncoder ??= new TextEncoder();\n const inputBytes = textEncoder.encode(value);\n\n // Initial hash values (first 32 bits of the fractional parts of the square\n // roots of the first 8 primes).\n let hashState0 = 0x6a09e667;\n let hashState1 = 0xbb67ae85;\n let hashState2 = 0x3c6ef372;\n let hashState3 = 0xa54ff53a;\n let hashState4 = 0x510e527f;\n let hashState5 = 0x9b05688c;\n let hashState6 = 0x1f83d9ab;\n let hashState7 = 0x5be0cd19;\n\n const messageLengthInBits = inputBytes.length * 8;\n const paddedLengthInBytes = (((inputBytes.length + 8) >> 6) + 1) << 6;\n const paddedBytes = new Uint8Array(paddedLengthInBytes);\n paddedBytes.set(inputBytes);\n paddedBytes[inputBytes.length] = 0x80;\n\n const paddedBytesView = new DataView(paddedBytes.buffer);\n const lowBits = messageLengthInBits >>> 0;\n const highBits = (messageLengthInBits / 0x100000000) >>> 0;\n paddedBytesView.setUint32(paddedLengthInBytes - 8, highBits, false);\n paddedBytesView.setUint32(paddedLengthInBytes - 4, lowBits, false);\n\n const messageSchedule = new Uint32Array(64);\n for (\n let chunkOffset = 0;\n chunkOffset < paddedLengthInBytes;\n chunkOffset += 64\n ) {\n for (let i = 0; i < 16; i++) {\n messageSchedule[i] = paddedBytesView.getUint32(\n chunkOffset + i * 4,\n false,\n );\n }\n\n for (let i = 16; i < 64; i++) {\n const prevWord15 = messageSchedule[i - 15];\n const sigma0 =\n (((prevWord15 >>> 7) | (prevWord15 << 25)) ^\n ((prevWord15 >>> 18) | (prevWord15 << 14)) ^\n (prevWord15 >>> 3)) >>>\n 0;\n\n const prevWord2 = messageSchedule[i - 2];\n const sigma1 =\n (((prevWord2 >>> 17) | (prevWord2 << 15)) ^\n ((prevWord2 >>> 19) | (prevWord2 << 13)) ^\n (prevWord2 >>> 10)) >>>\n 0;\n\n messageSchedule[i] =\n (messageSchedule[i - 16] + sigma0 + messageSchedule[i - 7] + sigma1) >>>\n 0;\n }\n\n let workingStateA = hashState0;\n let workingStateB = hashState1;\n let workingStateC = hashState2;\n let workingStateD = hashState3;\n let workingStateE = hashState4;\n let workingStateF = hashState5;\n let workingStateG = hashState6;\n let workingStateH = hashState7;\n\n for (let i = 0; i < 64; i++) {\n const capitalSigma1 =\n (((workingStateE >>> 6) | (workingStateE << 26)) ^\n ((workingStateE >>> 11) | (workingStateE << 21)) ^\n ((workingStateE >>> 25) | (workingStateE << 7))) >>>\n 0;\n const chFunction =\n ((workingStateE & workingStateF) ^ (~workingStateE & workingStateG)) >>>\n 0;\n const temp1 =\n (workingStateH +\n capitalSigma1 +\n chFunction +\n SHA256_ROUND_CONSTANTS[i] +\n messageSchedule[i]) >>>\n 0;\n\n const capitalSigma0 =\n (((workingStateA >>> 2) | (workingStateA << 30)) ^\n ((workingStateA >>> 13) | (workingStateA << 19)) ^\n ((workingStateA >>> 22) | (workingStateA << 10))) >>>\n 0;\n const majFunction =\n ((workingStateA & workingStateB) ^\n (workingStateA & workingStateC) ^\n (workingStateB & workingStateC)) >>>\n 0;\n const temp2 = (capitalSigma0 + majFunction) >>> 0;\n\n workingStateH = workingStateG;\n workingStateG = workingStateF;\n workingStateF = workingStateE;\n workingStateE = (workingStateD + temp1) >>> 0;\n workingStateD = workingStateC;\n workingStateC = workingStateB;\n workingStateB = workingStateA;\n workingStateA = (temp1 + temp2) >>> 0;\n }\n\n hashState0 = (hashState0 + workingStateA) >>> 0;\n hashState1 = (hashState1 + workingStateB) >>> 0;\n hashState2 = (hashState2 + workingStateC) >>> 0;\n hashState3 = (hashState3 + workingStateD) >>> 0;\n hashState4 = (hashState4 + workingStateE) >>> 0;\n hashState5 = (hashState5 + workingStateF) >>> 0;\n hashState6 = (hashState6 + workingStateG) >>> 0;\n hashState7 = (hashState7 + workingStateH) >>> 0;\n }\n\n return [\n hashState0,\n hashState1,\n hashState2,\n hashState3,\n hashState4,\n hashState5,\n hashState6,\n hashState7,\n ]\n .map((x) => x.toString(16).padStart(8, '0'))\n .join('');\n}\n","import { TransferState, inject, makeStateKey } from '@angular/core';\nimport {\n HttpHandlerFn,\n HttpHeaders,\n HttpRequest,\n HttpResponse,\n} from '@angular/common/http';\n\nimport { from, of } from 'rxjs';\n\nimport { injectBaseURL, injectAPIPrefix } from '@analogjs/router/tokens';\n\nimport { makeCacheKey } from './cache-key';\n\n/**\n * Interceptor that is server-aware when making HttpClient requests.\n * Server-side requests use the full URL\n * Prerendering uses the internal Nitro $fetch function, along with state transfer\n * Client-side requests use the window.location.origin\n *\n * @param req HttpRequest<unknown>\n * @param next HttpHandlerFn\n * @returns\n */\nexport function requestContextInterceptor(\n req: HttpRequest<unknown>,\n next: HttpHandlerFn,\n) {\n const apiPrefix = injectAPIPrefix();\n const baseUrl = injectBaseURL();\n const transferState = inject(TransferState);\n\n // during prerendering with Nitro\n if (\n typeof global !== 'undefined' &&\n global.$fetch &&\n baseUrl &&\n (req.url.startsWith('/') ||\n req.url.startsWith(baseUrl) ||\n req.url.startsWith(`/${apiPrefix}`))\n ) {\n const requestUrl = new URL(req.urlWithParams, baseUrl);\n const fetchUrl = `${requestUrl.pathname}${requestUrl.search}`;\n const cacheKey = makeCacheKey(req, fetchUrl);\n const storeKey = makeStateKey<unknown>(`analog_${cacheKey}`);\n\n const responseType =\n req.responseType === 'arraybuffer' ? 'arrayBuffer' : req.responseType;\n\n return from(\n global.$fetch\n .raw(fetchUrl, {\n method: req.method as any,\n body: req.body ? req.body : undefined,\n responseType,\n headers: req.headers.keys().reduce((hdrs, current) => {\n return {\n ...hdrs,\n [current]: req.headers.get(current),\n };\n }, {}),\n })\n .then((res) => {\n const cacheResponse = {\n body: res._data,\n headers: new HttpHeaders(res.headers),\n status: 200,\n statusText: 'OK',\n url: fetchUrl,\n };\n const transferResponse = new HttpResponse(cacheResponse);\n\n transferState.set(storeKey, cacheResponse);\n return transferResponse;\n }),\n );\n }\n\n // on the client\n if (\n !import.meta.env.SSR &&\n (req.url.startsWith('/') || req.url.includes('/_analog/'))\n ) {\n // /_analog/ requests are full URLs\n const toAbsoluteUrl = (url: string) => new URL(url, window.location.origin);\n const requestUrl = toAbsoluteUrl(req.url).href;\n const { pathname, search } = toAbsoluteUrl(req.urlWithParams);\n const cacheKey = makeCacheKey(req, `${pathname}${search}`);\n const storeKey = makeStateKey<unknown>(`analog_${cacheKey}`);\n const cacheRestoreResponse = transferState.get(storeKey, null);\n\n if (cacheRestoreResponse) {\n transferState.remove(storeKey);\n return of(new HttpResponse(cacheRestoreResponse));\n }\n\n return next(\n req.clone({\n url: requestUrl,\n }),\n );\n }\n\n // on the server\n if (baseUrl && (req.url.startsWith('/') || req.url.startsWith(baseUrl))) {\n const requestUrl =\n req.url.startsWith(baseUrl) && !req.url.startsWith('/')\n ? req.url\n : `${baseUrl}${req.url}`;\n\n return next(\n req.clone({\n url: requestUrl,\n }),\n );\n }\n\n return next(req);\n}\n","import {\n booleanAttribute,\n Directive,\n effect,\n ElementRef,\n inject,\n Injector,\n input,\n output,\n Renderer2,\n runInInjectionContext,\n signal,\n} from '@angular/core';\nimport { ActivatedRoute, Params, Router } from '@angular/router';\n\nimport { injectRouteEndpointURL } from './inject-route-endpoint-url';\nimport { ANALOG_META_KEY } from './endpoints';\n\nexport type FormActionState =\n | 'submitting'\n | 'error'\n | 'redirect'\n | 'success'\n | 'navigate';\n\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: 'form[action],form[method],form[enhanceForm]',\n host: {\n '(submit)': `submitted($event)`,\n },\n standalone: true,\n})\nexport class FormAction {\n action = input<string>('');\n enhanceForm = input(false, { transform: booleanAttribute });\n // eslint-disable-next-line @angular-eslint/no-output-on-prefix\n onSuccess = output<unknown>();\n // eslint-disable-next-line @angular-eslint/no-output-on-prefix\n onError = output<unknown>();\n state = output<FormActionState>();\n private currentState = signal<FormActionState | 'idle'>('idle');\n private injector = inject(Injector);\n private router = inject(Router);\n private route = inject(ActivatedRoute);\n private path = this._getPath();\n\n constructor() {\n const form = inject(ElementRef<HTMLFormElement>).nativeElement;\n const renderer = inject(Renderer2);\n effect((onCleanup) => {\n if (!this.enhanceForm()) {\n return;\n }\n\n const previous = {\n 'data-state': form.getAttribute('data-state'),\n 'aria-busy': form.getAttribute('aria-busy'),\n };\n const state = this.currentState();\n renderer.setAttribute(form, 'data-state', state);\n if (state === 'submitting') {\n renderer.setAttribute(form, 'aria-busy', 'true');\n } else {\n renderer.removeAttribute(form, 'aria-busy');\n }\n onCleanup(() => {\n for (const [name, value] of Object.entries(previous)) {\n if (value === null) {\n renderer.removeAttribute(form, name);\n } else {\n renderer.setAttribute(form, name, value);\n }\n }\n });\n });\n }\n\n submitted($event: any) {\n $event.preventDefault();\n\n this._emitState('submitting');\n const body = new FormData($event.target);\n\n if (this.enhanceForm()) {\n const form = $event.target as HTMLFormElement;\n try {\n const action =\n this.action().trim() || form.getAttribute('action')?.trim();\n if (form.method.toUpperCase() === 'GET') {\n this._handleEnhancedGet(body, action || this.router.url);\n } else {\n const path = action\n ? new URL(action, window.location.href).toString()\n : this._getPath();\n void this._handleEnhancedPost(body, path, form.method);\n }\n } catch {\n this._emitState('error');\n }\n return;\n }\n\n if ($event.target.method.toUpperCase() === 'GET') {\n this._handleGet(body, this.router.url);\n } else {\n this._handlePost(body, this.path, $event);\n }\n }\n\n private _handleGet(body: FormData, path: string) {\n const params: Params = {};\n body.forEach((formVal, formKey) => (params[formKey] = formVal));\n\n this._emitState('navigate');\n const url = path.split('?')[0];\n this.router.navigate([url], {\n queryParams: params,\n onSameUrlNavigation: 'reload',\n });\n }\n\n private _handlePost(\n body: FormData,\n path: string,\n $event: { target: HTMLFormElement } & Event,\n ) {\n fetch(path, {\n method: $event.target.method,\n body,\n })\n .then((res) => {\n if (res.ok) {\n if (res.redirected) {\n const redirectUrl = new URL(res.url).pathname;\n this._emitState('redirect');\n this.router.navigate([redirectUrl]);\n } else if (this._isJSON(res.headers.get('Content-type'))) {\n res.json().then((result) => {\n this.onSuccess.emit(result);\n this._emitState('success');\n });\n } else {\n res.text().then((result) => {\n this.onSuccess.emit(result);\n this._emitState('success');\n });\n }\n } else {\n if (res.headers.get('X-Analog-Errors')) {\n res.json().then((errors: unknown) => {\n this.onError.emit(errors);\n this._emitState('error');\n });\n } else {\n this._emitState('error');\n }\n }\n })\n .catch((_) => {\n this._emitState('error');\n });\n }\n\n private _getPath() {\n const snapshot = this.route.snapshot;\n if (snapshot.routeConfig && ANALOG_META_KEY in snapshot.routeConfig) {\n return runInInjectionContext(this.injector, () =>\n injectRouteEndpointURL(snapshot),\n ).pathname;\n }\n\n return `/api/_analog/pages${window.location.pathname}`;\n }\n\n private _handleEnhancedGet(body: FormData, path: string) {\n const url = new URL(path, window.location.href);\n const params = new URLSearchParams(url.search);\n body.forEach((_value, key) => params.delete(key));\n body.forEach((value, key) => {\n params.append(key, value instanceof File ? value.name : value);\n });\n url.search = params.toString();\n\n this._emitState('navigate');\n this._navigateTo(url);\n }\n\n private async _handleEnhancedPost(\n body: FormData,\n path: string,\n method: string,\n ) {\n try {\n const response = await fetch(path, { method, body });\n if (response.ok) {\n if (response.redirected) {\n this._emitState('redirect');\n this._navigateTo(new URL(response.url, window.location.href));\n } else {\n const result = this._isJSON(response.headers.get('Content-type'))\n ? await response.json()\n : await response.text();\n this.onSuccess.emit(result);\n this._emitState('success');\n }\n } else {\n if (response.headers.get('X-Analog-Errors')) {\n this.onError.emit(await response.json());\n }\n this._emitState('error');\n }\n } catch {\n this._emitState('error');\n }\n }\n\n private _emitState(state: FormActionState) {\n this.currentState.set(state);\n this.state.emit(state);\n }\n\n private _navigateTo(url: URL) {\n if (url.origin === window.location.origin) {\n void this.router.navigateByUrl(\n `${url.pathname}${url.search}${url.hash}`,\n {\n onSameUrlNavigation: 'reload',\n },\n );\n return;\n }\n\n window.location.assign(url.toString());\n }\n\n private _isJSON(contentType: string | null): boolean {\n const mime = contentType ? contentType.split(';') : [];\n const essence = mime[0];\n\n return essence === 'application/json';\n }\n}\n","import type { StandardSchemaV1 } from '@analogjs/router/server/actions';\n\nexport type ValidationFieldErrors = Record<string, string[]>;\n\nfunction getPathSegmentKey(\n segment: string | number | symbol | { key: string | number | symbol },\n) {\n return typeof segment === 'object' ? segment.key : segment;\n}\n\nexport function issuePathToFieldName(\n path: ReadonlyArray<\n string | number | symbol | { key: string | number | symbol }\n >,\n): string {\n return path.map((segment) => String(getPathSegmentKey(segment))).join('.');\n}\n\nexport function issuesToFieldErrors(\n issues: ReadonlyArray<StandardSchemaV1.Issue>,\n): ValidationFieldErrors {\n return issues.reduce<ValidationFieldErrors>((errors, issue) => {\n if (!issue.path?.length) {\n return errors;\n }\n\n const fieldName = issuePathToFieldName(issue.path);\n errors[fieldName] ??= [];\n errors[fieldName].push(issue.message);\n return errors;\n }, Object.create(null));\n}\n\nexport function issuesToFormErrors(\n issues: ReadonlyArray<StandardSchemaV1.Issue>,\n): string[] {\n return issues\n .filter((issue) => !issue.path?.length)\n .map((issue) => issue.message);\n}\n","import { ROUTES } from '@angular/router';\n\n/**\n * Provides routes that provide additional\n * pages for displaying and debugging\n * routes.\n */\nexport function withDebugRoutes() {\n const routes = [\n {\n path: '__analog/routes',\n loadComponent: () => import('./debug.page'),\n },\n ];\n\n return {\n ɵkind: 101 as number,\n ɵproviders: [{ provide: ROUTES, useValue: routes, multi: true }],\n };\n}\n","import { InjectionToken, type Injector } from '@angular/core';\n\nimport type { ServerFn } from './types';\n\n/**\n * In-process transport for a server function call.\n *\n * Provided on the server by `provideServerContext`, so during SSR a server\n * function runs in the same process — and the same request injector — as the\n * render instead of making an HTTP request back into the app. Absent in the\n * browser, where `ServerFnClient` falls back to `HttpClient`.\n *\n * `injector` is the **app environment injector** — `ServerFnClient` is\n * `providedIn: 'root'`, and SSR bootstraps a fresh application per request, so\n * its injector is both per-request and the right scope for a handler to resolve\n * from. It is passed rather than captured from the token because\n * `provideServerContext` is applied as *platform* providers, which sit above\n * the app's `providedIn: 'root'` services.\n *\n * Deliberately not a component's node injector: a handler resolves app-level\n * services, and making that depend on which component happened to call it would\n * be surprising and unportable.\n */\nexport type ServerFnDispatcher = <In, Out>(\n fn: ServerFn<In, Out>,\n input: In,\n injector: Injector,\n) => Promise<Out>;\n\nexport const SERVER_FN_DISPATCHER = new InjectionToken<ServerFnDispatcher>(\n '@analogjs/router Server Function Dispatcher',\n);\n","import {\n Injectable,\n Injector,\n assertInInjectionContext,\n inject,\n makeStateKey,\n resource,\n TransferState,\n type ResourceRef,\n} from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { firstValueFrom } from 'rxjs';\n\nimport type { ServerFn } from './types';\nimport { SERVER_FN_DISPATCHER } from './dispatcher';\n\n/**\n * Client transport for server functions. In the browser it goes through Angular\n * `HttpClient`, so client `HttpInterceptorFn`s apply. During SSR the dispatcher\n * token is provided, and the call short-circuits the HTTP round-trip: the\n * handler runs in-process in the current request injector. Lives in the client\n * entry (client-safe).\n */\n@Injectable({ providedIn: 'root' })\nexport class ServerFnClient {\n private readonly http = inject(HttpClient);\n private readonly transferState = inject(TransferState);\n private readonly injector = inject(Injector);\n private readonly dispatcher = inject(SERVER_FN_DISPATCHER, {\n optional: true,\n });\n\n /** True while rendering on the server (the in-process dispatcher is provided). */\n get isServer(): boolean {\n return !!this.dispatcher;\n }\n\n async call<In, Out>(fn: ServerFn<In, Out>, input: In): Promise<Out> {\n if (this.dispatcher) {\n return this.dispatcher(fn, input, this.injector);\n }\n\n const request$ =\n fn.method === 'GET'\n ? this.http.get<Out>(fn.url)\n : this.http.post<Out>(fn.url, input ?? {});\n return firstValueFrom(request$);\n }\n\n /** Key a read's value for TransferState hydration (fn id + input). */\n stateKey<Out>(fn: ServerFn<unknown, Out>, input: unknown) {\n return makeStateKey<Out>(`__analog_fn_${fn.id}_${stableInput(input)}`);\n }\n\n readSeed<Out>(fn: ServerFn<unknown, Out>, input: unknown): Out | undefined {\n const key = this.stateKey(fn, input);\n if (this.transferState.hasKey(key)) {\n const value = this.transferState.get(key, undefined as unknown as Out);\n this.transferState.remove(key); // single-use\n return value;\n }\n return undefined;\n }\n\n writeSeed<Out>(fn: ServerFn<unknown, Out>, input: unknown, value: Out): void {\n this.transferState.set(this.stateKey(fn, input), value);\n }\n}\n\n/** No-op provider hook; ServerFnClient is `providedIn: 'root'`. */\nexport function provideServerFnClient() {\n return [] as const;\n}\n\n// Stable sentinel for the input-less read: `resource()` treats an `undefined`\n// params value as \"idle, don't load\", so an input-less read must yield a\n// defined-but-ignored params. It is never sent — the call uses `undefined`.\nconst NO_INPUT = Symbol('analog.serverFn.noInput');\n\n/**\n * Reactive read of a server function as an Angular `resource()`.\n *\n * `args` is optional: omit it for an input-less read (the resource loads once);\n * provide it for an input-bearing read (returning `undefined` from `args` leaves\n * the resource idle until inputs are ready, the standard resource pattern). For\n * imperative calls (mutations, event handlers) use `injectServerFnMutation`.\n */\nexport function injectServerFn<Out>(\n fn: ServerFn<void, Out>,\n): ResourceRef<Out | undefined>;\nexport function injectServerFn<In, Out>(\n fn: ServerFn<In, Out>,\n args: () => In | undefined,\n): ResourceRef<Out | undefined>;\nexport function injectServerFn<In, Out>(\n fn: ServerFn<In, Out>,\n args?: () => In | undefined,\n): ResourceRef<Out | undefined> {\n assertInInjectionContext(injectServerFn);\n const client = inject(ServerFnClient);\n\n return resource<Out | undefined, unknown>({\n params: () => (args ? args() : NO_INPUT),\n loader: async ({ params }) => {\n const input = (params === NO_INPUT ? undefined : params) as In;\n // Hydrate from the SSR seed on first client render; else fetch and (on\n // the server) seed for the client.\n const seeded = client.readSeed(fn as ServerFn<unknown, Out>, input);\n if (seeded !== undefined) return seeded;\n const value = await client.call(fn, input);\n if (client.isServer) {\n client.writeSeed(fn as ServerFn<unknown, Out>, input, value);\n }\n return value;\n },\n });\n}\n\n/**\n * Imperative binding of a server function: returns a callable that dispatches\n * the call through `HttpClient` (so client interceptors apply) and resolves the\n * result. Use for mutations and event-driven calls; use `injectServerFn` for\n * reactive reads.\n */\nexport function injectServerFnMutation<In, Out>(\n fn: ServerFn<In, Out>,\n): (input: In) => Promise<Out> {\n assertInInjectionContext(injectServerFnMutation);\n const client = inject(ServerFnClient);\n return (input: In) => client.call(fn, input);\n}\n\nfunction stableInput(input: unknown): string {\n if (input === undefined || input === null) return '_';\n return JSON.stringify(input);\n}\n","import type { ServerFn, ServerFnMethod } from './types';\n\nexport interface ServerFnRefConfig {\n id?: string;\n method?: ServerFnMethod;\n /**\n * Only its presence matters here: when `method` is omitted, a config with an\n * `input` schema defaults to `POST`, otherwise `GET`. The schema itself is\n * never used to build the ref — validation happens server-side.\n */\n input?: unknown;\n}\n\n/**\n * Builds a server-function reference: the client-safe `{ __serverFn, id, url,\n * method }` metadata that `injectServerFn`/`ServerFnClient` dispatch through.\n *\n * Shared by both sides so they produce identical refs: the server `serverFn`\n * wraps this with registration + the handler, and the client build's scrub\n * transform emits a call to this factory in place of the server module so the\n * browser bundle carries only the ref, never the handler or its server imports.\n *\n * The returned value is callable-typed but throws if invoked directly — it is\n * always dispatched via `injectServerFn`/`ServerFnClient`, never called.\n */\nexport function createServerFnRef<In, Out>(\n config: ServerFnRefConfig,\n): ServerFn<In, Out> {\n if (!config.id) {\n throw new Error(\n '[analog] serverFn is missing its build-derived id. Server functions require the Analog build transform (@analogjs/platform / @analogjs/vite-plugin-nitro); a raw import without it is not supported.',\n );\n }\n const method: ServerFnMethod =\n config.method ?? (config.input ? 'POST' : 'GET');\n const url = `/_analog/fn/${config.id}`;\n\n const ref = (() => {\n throw new Error(\n `serverFn \"${config.id}\" must be called via injectServerFn/ServerFnClient`,\n );\n }) as unknown as ServerFn<In, Out>;\n\n return Object.assign(ref, {\n __serverFn: true as const,\n id: config.id,\n url,\n method,\n });\n}\n","import {\n DefaultUrlSerializer,\n PRIMARY_OUTLET,\n UrlSegment,\n UrlSegmentGroup,\n UrlTree,\n} from '@angular/router';\n\n/**\n * Typed route path utilities for Analog.\n *\n * This module provides:\n * - The `AnalogRouteTable` base interface (augmented by generated code)\n * - The `AnalogRoutePath` union type\n * - The `toRoute()` URL builder function\n *\n * Link construction does not require an injection context.\n */\n\n/**\n * Base interface for the typed route table.\n *\n * This interface is augmented by generated code in `src/routeTree.gen.d.ts`.\n * Without the generated declaration, typed helpers reject route paths.\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface, @typescript-eslint/no-empty-object-type\nexport interface AnalogRouteTable {}\n\n/**\n * Union of all valid route paths.\n *\n * When routes are generated, this is a string literal union.\n * Without the generated declaration, this is `never`.\n */\nexport type AnalogRoutePath = Extract<keyof AnalogRouteTable, string>;\n\n/**\n * Options for building a route URL.\n */\nexport interface RoutePathOptionsBase {\n params?: Record<string, string | number | (string | number)[] | undefined>;\n query?: Record<string, string | string[] | undefined>;\n hash?: string;\n}\n\n/** Raw parameter types from the generated route table. */\nexport type RouteParamsOutput<P extends string> =\n P extends keyof AnalogRouteTable\n ? AnalogRouteTable[P] extends { params: infer Params }\n ? Params\n : Record<string, unknown>\n : Record<string, unknown>;\n\n/**\n * Extracts the raw output type for route query params.\n */\nexport type RouteQueryOutput<P extends string> =\n P extends keyof AnalogRouteTable\n ? AnalogRouteTable[P] extends { query: infer O }\n ? O\n : Record<string, string | string[] | undefined>\n : Record<string, string | string[] | undefined>;\n\ntype RequiredRouteParamKeys<Params> =\n Params extends Record<string, never>\n ? never\n : {\n [K in keyof Params]-?: Record<string, never> extends Pick<Params, K>\n ? never\n : K;\n }[keyof Params];\n\ntype HasRequiredRouteParams<Params> = [RequiredRouteParamKeys<Params>] extends [\n never,\n]\n ? false\n : true;\n\ntype RouteParamsInput<Params> = {\n [K in keyof Params]: Exclude<Params[K], undefined> extends string[]\n ? undefined extends Params[K]\n ? (string | number)[]\n : [string | number, ...(string | number)[]]\n : Exclude<Params[K], undefined> extends string\n ? string | number\n : Params[K];\n};\n\n/**\n * Typed options that infer params from the route table when available.\n */\nexport type RoutePathOptions<P extends string = string> =\n P extends keyof AnalogRouteTable\n ? AnalogRouteTable[P] extends { params: infer Params }\n ? Params extends Record<string, never>\n ? {\n params?: never;\n query?: RouteQueryOutput<P>;\n hash?: string;\n }\n : HasRequiredRouteParams<Params> extends true\n ? {\n params: RouteParamsInput<Params>;\n query?: RouteQueryOutput<P>;\n hash?: string;\n }\n : {\n params?: RouteParamsInput<Params>;\n query?: RouteQueryOutput<P>;\n hash?: string;\n }\n : RoutePathOptionsBase\n : RoutePathOptionsBase;\n\n/**\n * Conditional args: require options when the route has params.\n */\nexport type RoutePathArgs<P extends string = string> =\n P extends keyof AnalogRouteTable\n ? AnalogRouteTable[P] extends { params: infer Params }\n ? Params extends Record<string, never>\n ? [options?: RoutePathOptions<P>]\n : HasRequiredRouteParams<Params> extends true\n ? [options: RoutePathOptions<P>]\n : [options?: RoutePathOptions<P>]\n : [options?: RoutePathOptionsBase]\n : [options?: RoutePathOptionsBase];\n\n/**\n * Result of `toRoute()` — contains properties that map directly\n * to Angular's `[routerLink]`, `[queryParams]`, and `[fragment]` inputs.\n */\nexport interface RouteLinkResult {\n path: string[];\n queryParams: Record<string, string | string[]> | null;\n fragment: string | undefined;\n}\n\n/**\n * Builds a typed route link object from a route path pattern and options.\n *\n * The returned object separates path, query params, and fragment for\n * direct use with Angular's routerLink directive inputs.\n *\n * @example\n * toRoute('/about')\n * // → { path: ['/', 'about'], queryParams: null, fragment: undefined }\n *\n * toRoute('/users/[id]', { params: { id: '42' } })\n * // → { path: ['/', 'users', '42'], queryParams: null, fragment: undefined }\n *\n * toRoute('/users/[id]', { params: { id: '42' }, query: { tab: 'settings' }, hash: 'bio' })\n * // → { path: ['/', 'users', '42'], queryParams: { tab: 'settings' }, fragment: 'bio' }\n *\n * @example Template usage\n * Compute the link in the component:\n * ```ts\n * readonly link = toRoute('/users/[id]', { params: { id: '42' } });\n * ```\n *\n * ```html\n * <a [routerLink]=\"link.path\" [queryParams]=\"link.queryParams\" [fragment]=\"link.fragment\">\n * ```\n */\nexport function toRoute<P extends AnalogRoutePath>(\n path: P,\n ...args: RoutePathArgs<P>\n): RouteLinkResult {\n const options = args[0] as RoutePathOptionsBase | undefined;\n return buildRouteLink(path as string, options);\n}\n\n/**\n * Internal: builds a `RouteLinkResult` from path and options.\n * Exported for direct use in tests (avoids generic constraints).\n */\nexport function buildRouteLink(\n path: string,\n options?: RoutePathOptionsBase,\n): RouteLinkResult {\n const resolvedPath = buildPath(path, options?.params);\n\n let queryParams: Record<string, string | string[]> | null = null;\n if (options?.query) {\n const filtered: Record<string, string | string[]> = {};\n let hasEntries = false;\n for (const [key, value] of Object.entries(options.query)) {\n if (value !== undefined) {\n filtered[key] = value;\n hasEntries = true;\n }\n }\n if (hasEntries) {\n queryParams = filtered;\n }\n }\n\n return {\n path: resolvedPath,\n queryParams,\n fragment: options?.hash,\n };\n}\n\nfunction buildPath(\n path: string,\n params: RoutePathOptionsBase['params'] = {},\n): string[] {\n const segments = path\n .split('/')\n .filter(Boolean)\n .flatMap((segment) => {\n const optional = segment.match(/^\\[\\[\\.\\.\\.([^\\]]+)\\]\\]$/);\n const catchAll = segment.match(/^\\[\\.\\.\\.([^\\]]+)\\]$/);\n const dynamic = segment.match(/^\\[([^\\]]+)\\]$/);\n const match = optional ?? catchAll ?? dynamic;\n if (!match) return [segment];\n const value = params[match[1]];\n if (value == null || (Array.isArray(value) && !value.length)) {\n if (optional) return [];\n throw new Error(\n `Missing required ${catchAll ? 'catch-all ' : ''}param \"${match[1]}\" for path \"${path}\"`,\n );\n }\n return Array.isArray(value) ? value.map(String) : [String(value)];\n });\n // A separate root command keeps slashes inside parameter values in one segment.\n return ['/', ...segments];\n}\n\n/** Internal URL serialization for programmatic navigation. */\nexport function buildUrl(path: string, options?: RoutePathOptionsBase): string {\n const link = buildRouteLink(path, options);\n const segments = link.path.slice(1).map((path) => new UrlSegment(path, {}));\n const root = new UrlSegmentGroup([], {\n [PRIMARY_OUTLET]: new UrlSegmentGroup(segments, {}),\n });\n return new DefaultUrlSerializer().serialize(\n new UrlTree(root, link.queryParams ?? {}, link.fragment ?? null),\n );\n}\n","import {\n Directive,\n inject,\n input,\n InputSignal,\n OnChanges,\n} from '@angular/core';\nimport { RouterLink } from '@angular/router';\n\nimport {\n AnalogRoutePath,\n buildRouteLink,\n RouteParamsOutput,\n RoutePathOptions,\n RoutePathOptionsBase,\n} from './to-route';\n\ntype LinkToDestination = {\n [P in AnalogRoutePath]: { path: P } & RoutePathOptions<P>;\n}[AnalogRoutePath];\n\ntype StaticRoutePath = {\n [P in AnalogRoutePath]: RouteParamsOutput<P> extends Record<string, never>\n ? P\n : never;\n}[AnalogRoutePath];\n\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: '[linkTo]',\n standalone: true,\n hostDirectives: [\n {\n directive: RouterLink,\n inputs: [\n 'target',\n 'queryParamsHandling',\n 'preserveFragment',\n 'skipLocationChange',\n 'replaceUrl',\n 'state',\n ],\n },\n ],\n})\nexport class LinkTo implements OnChanges {\n readonly linkTo: InputSignal<\n StaticRoutePath | LinkToDestination | null | undefined\n > = input.required<StaticRoutePath | LinkToDestination | null | undefined>();\n private readonly routerLink = inject(RouterLink);\n\n ngOnChanges(): void {\n const destination = this.linkTo() as\n | string\n | ({ path: string } & RoutePathOptionsBase)\n | null\n | undefined;\n const link = destination\n ? typeof destination === 'string'\n ? buildRouteLink(destination)\n : buildRouteLink(destination.path, destination)\n : null;\n\n this.routerLink.routerLink = link?.path ?? null;\n this.routerLink.queryParams = link?.queryParams ?? null;\n this.routerLink.fragment = link?.fragment;\n // Direct input assignments must also refresh href and RouterLinkActive.\n this.routerLink.ngOnChanges({});\n }\n}\n","import { inject } from '@angular/core';\nimport { type NavigationBehaviorOptions, Router } from '@angular/router';\n\nimport type {\n AnalogRoutePath,\n RoutePathArgs,\n RoutePathOptionsBase,\n} from './to-route';\nimport { buildUrl } from './to-route';\n\ntype NavigateWithExtrasArgs<P extends AnalogRoutePath> =\n [] extends RoutePathArgs<P>\n ?\n | [extras: NavigationBehaviorOptions]\n | [\n options: RoutePathArgs<P>[0] | undefined,\n extras: NavigationBehaviorOptions,\n ]\n : [options: RoutePathArgs<P>[0], extras: NavigationBehaviorOptions];\n\ntype TypedNavigate = {\n <P extends AnalogRoutePath>(\n path: P,\n ...args: RoutePathArgs<P>\n ): Promise<boolean>;\n <P extends AnalogRoutePath>(\n path: P,\n ...args: NavigateWithExtrasArgs<P>\n ): Promise<boolean>;\n};\n\nfunction isRoutePathOptionsBase(value: unknown): value is RoutePathOptionsBase {\n return (\n !!value &&\n typeof value === 'object' &&\n ('params' in value || 'query' in value || 'hash' in value)\n );\n}\n\n/**\n * Injects a typed navigate function.\n *\n * @example\n * ```ts\n * const navigate = injectNavigate();\n *\n * navigate('/users/[id]', { params: { id: '42' } }); // ✅\n * navigate('/users/[id]', { params: { id: 42 } }); // ✅\n *\n * // With navigation extras\n * navigate('/users/[id]', { params: { id: '42' } }, { replaceUrl: true });\n * ```\n */\nexport function injectNavigate(): TypedNavigate {\n const router = inject(Router);\n\n const navigate: TypedNavigate = (\n path: string,\n ...args: unknown[]\n ): Promise<boolean> => {\n let options: RoutePathOptionsBase | undefined;\n let extras: NavigationBehaviorOptions | undefined;\n\n if (args.length > 1) {\n options = args[0] as RoutePathOptionsBase | undefined;\n extras = args[1] as NavigationBehaviorOptions | undefined;\n } else if (args.length === 1) {\n if (isRoutePathOptionsBase(args[0])) {\n options = args[0];\n } else {\n extras = args[0] as NavigationBehaviorOptions;\n }\n }\n\n const url = buildUrl(path as string, options);\n return router.navigateByUrl(url, extras);\n };\n\n return navigate;\n}\n","import { inject, Injector, Signal } from '@angular/core';\nimport { ActivatedRoute } from '@angular/router';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { combineLatest, map, of } from 'rxjs';\n\nimport type {\n AnalogRoutePath,\n RouteParamsOutput,\n RouteQueryOutput,\n} from './to-route';\n\nfunction extractCatchAllParams(\n routePath: string,\n): { name: string; type: 'catchAll' | 'optionalCatchAll' }[] {\n const params: {\n name: string;\n type: 'catchAll' | 'optionalCatchAll';\n }[] = [];\n for (const segment of routePath.split('/')) {\n const optional = segment.match(/^\\[\\[\\.\\.\\.([^\\]]+)\\]\\]$/);\n const required = segment.match(/^\\[\\.\\.\\.([^\\]]+)\\]$/);\n if (optional) {\n params.push({ name: optional[1], type: 'optionalCatchAll' });\n } else if (required) {\n params.push({ name: required[1], type: 'catchAll' });\n }\n }\n return params;\n}\n\n/** Read raw route params; catch-all segments are returned as arrays. */\nexport function injectParams<P extends AnalogRoutePath>(\n _from: P,\n options?: { injector?: Injector },\n): Signal<RouteParamsOutput<P>> {\n const injector = options?.injector;\n const route = injector\n ? injector.get(ActivatedRoute)\n : inject(ActivatedRoute);\n const ancestors = route.pathFromRoot ?? [route];\n const catchAllParams = extractCatchAllParams(_from);\n return toSignal(\n combineLatest([\n combineLatest(ancestors.map((entry) => entry.params)),\n combineLatest(ancestors.map((entry) => entry.url ?? of([]))),\n ]).pipe(\n map(([values, segments]) => {\n const params = Object.assign({}, ...values);\n for (const param of catchAllParams) {\n const source = ancestors.findIndex((entry, index) =>\n param.type === 'catchAll'\n ? entry.routeConfig?.path === '**'\n : !!entry.routeConfig?.matcher &&\n values[index][param.name] != null,\n );\n if (source !== -1) {\n params[param.name] = segments[source].map(\n (segment) => segment.path,\n );\n }\n }\n return params as RouteParamsOutput<P>;\n }),\n ),\n { requireSync: true, injector },\n );\n}\n\n/** Read raw query params as a signal. No schema coercion is performed. */\nexport function injectQuery<P extends AnalogRoutePath>(\n _from: P,\n options?: { injector?: Injector },\n): Signal<RouteQueryOutput<P>> {\n const injector = options?.injector;\n const route = injector\n ? injector.get(ActivatedRoute)\n : inject(ActivatedRoute);\n return toSignal(\n route.queryParams.pipe(map((params) => params as RouteQueryOutput<P>)),\n { requireSync: true, injector },\n );\n}\n"],"mappings":";;;;;;;;;;AAyCA,MAAa,mBAAmB,UAA0B;CACxD,OAAO;AACT;AAOA,MAAa,qBAAoB;CAC/B,OAAO,OAAO,MAAM;AACtB;AAOA,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,WACV,SAAS,IAAI,cAAc,IAC3B,OAAO,cAAc;CACzB,MAAM,YAAY,MAAM,gBAAgB,CAAC,KAAK;CAC9C,MAAM,iBAAiB,sBAAsB,KAAK;CAClD,OAAO,SACL,cAAc,CACZ,cAAc,UAAU,KAAK,UAAU,MAAM,MAAM,CAAC,GACpD,cAAc,UAAU,KAAK,UAAU,MAAM,OAAO,GAAG,CAAA,CAAE,CAAC,CAAC,CAC5D,CAAA,CAAC,CAAC,KACD,KAAK,CAAC,QAAQ,cAAa;EACzB,MAAM,SAAS,OAAO,OAAO,CAAA,GAAI,GAAG,MAAM;EAC1C,KAAK,MAAM,SAAS,gBAAgB;GAClC,MAAM,SAAS,UAAU,WAAW,OAAO,UACzC,MAAM,SAAS,aACX,MAAM,aAAa,SAAS,OAC5B,CAAC,CAAC,MAAM,aAAa,WACrB,OAAO,MAAM,CAAC,MAAM,SAAS,IAAI;GAEvC,IAAI,WAAW,IACb,OAAO,MAAM,QAAQ,SAAS,OAAO,CAAC,KACnC,YAAY,QAAQ,IAAI;EAG/B;EACA,OAAO;CACT,CAAC,CAAC,GAEJ;EAAE,aAAa;EAAM;CAAQ,CAAE;AAEnC;AAGA,SAAgB,YACd,OACA,SAAiC;CAEjC,MAAM,WAAW,SAAS;CAI1B,OAAO,UAHO,WACV,SAAS,IAAI,cAAc,IAC3B,OAAO,cAAc,EAEvB,CAAM,YAAY,KAAK,KAAK,WAAW,MAA6B,CAAC,GACrE;EAAE,aAAa;EAAM;CAAQ,CAAE;AAEnC"}
|
|
1
|
+
{"version":3,"file":"analogjs-router.mjs","names":[],"sources":["../../../../packages/router/src/lib/define-route.ts","../../../../packages/router/src/lib/cookie-interceptor.ts","../../../../packages/router/src/lib/provide-file-router.ts","../../../../packages/router/src/lib/inject-load.ts","../../../../packages/router/src/lib/get-load-resolver.ts","../../../../packages/router/src/lib/cache-key.ts","../../../../packages/router/src/lib/request-context.ts","../../../../packages/router/src/lib/form-action.directive.ts","../../../../packages/router/src/lib/validation-errors.ts","../../../../packages/router/src/lib/debug/index.ts","../../../../packages/router/src/lib/server-fn/dispatcher.ts","../../../../packages/router/src/lib/server-fn/inject-server-fn.ts","../../../../packages/router/src/lib/server-fn/server-fn-ref.ts","../../../../packages/router/src/lib/to-route.ts","../../../../packages/router/src/lib/inject-typed-params.ts","../../../../packages/router/src/lib/link-to.directive.ts","../../../../packages/router/src/lib/inject-navigate.ts"],"sourcesContent":["import { inject } from '@angular/core';\nimport { Route as NgRoute, Router } from '@angular/router';\nimport { ActivatedRoute } from '@angular/router';\n\ntype RouteOmitted =\n | 'component'\n | 'loadComponent'\n | 'loadChildren'\n | 'path'\n | 'pathMatch';\n\ntype RestrictedRoute = Omit<NgRoute, RouteOmitted>;\n\n/**\n * @deprecated Use `RouteMeta` type instead.\n * For more info see: https://github.com/analogjs/analog/issues/223\n *\n * Defines additional route config metadata. This\n * object is merged into the route config with\n * the predefined file-based route.\n *\n * @usageNotes\n *\n * ```\n * import { Component } from '@angular/core';\n * import { defineRouteMeta } from '@analogjs/router';\n *\n * export const routeMeta = defineRouteMeta({\n * title: 'Welcome'\n * });\n *\n * @Component({\n * template: `Home`,\n * standalone: true,\n * })\n * export default class HomeComponent {}\n * ```\n *\n * @param route\n * @returns\n */\nexport const defineRouteMeta = (route: RestrictedRoute) => {\n return route;\n};\n\n/**\n * Returns the instance of Angular Router\n *\n * @returns The router\n */\nexport const injectRouter = () => {\n return inject(Router);\n};\n\n/**\n * Returns the instance of the Activate Route for the component\n *\n * @returns The activated route\n */\nexport const injectActivatedRoute = () => {\n return inject(ActivatedRoute);\n};\n","import { isPlatformServer } from '@angular/common';\nimport { HttpHandlerFn, HttpHeaders, HttpRequest } from '@angular/common/http';\nimport { PLATFORM_ID, inject } from '@angular/core';\nimport { injectRequest } from '@analogjs/router/tokens';\n\nexport function cookieInterceptor(\n req: HttpRequest<unknown>,\n next: HttpHandlerFn,\n location = inject(PLATFORM_ID),\n serverRequest = injectRequest(),\n) {\n if (isPlatformServer(location) && req.url.includes('/_analog/')) {\n let headers = new HttpHeaders();\n const cookies = serverRequest?.headers.cookie;\n headers = headers.set('cookie', cookies ?? '');\n\n const cookiedRequest = req.clone({\n headers,\n });\n\n return next(cookiedRequest);\n } else {\n return next(req);\n }\n}\n","import {\n ENVIRONMENT_INITIALIZER,\n EnvironmentProviders,\n makeEnvironmentProviders,\n} from '@angular/core';\nimport { provideRouter, RouterFeatures, ROUTES, Routes } from '@angular/router';\nimport { API_PREFIX } from '@analogjs/router/tokens';\nimport { ɵHTTP_ROOT_INTERCEPTOR_FNS as HTTP_ROOT_INTERCEPTOR_FNS } from '@angular/common/http';\n\nimport { routes } from './routes';\nimport { updateMetaTagsOnRouteChange } from './meta-tags';\nimport { cookieInterceptor } from './cookie-interceptor';\n\ndeclare const ANALOG_API_PREFIX: string;\n\n/**\n * Sets up providers for the Angular router, and registers\n * file-based routes. Additional features can be provided\n * to further configure the behavior of the router.\n *\n * @param features\n * @returns Providers and features to configure the router with routes\n */\nexport function provideFileRouter(\n ...features: RouterFeatures[]\n): EnvironmentProviders {\n const extraRoutesFeature = features.filter((feat) => feat.ɵkind >= 100);\n const routerFeatures = features.filter((feat) => feat.ɵkind < 100);\n\n return makeEnvironmentProviders([\n extraRoutesFeature.map((erf) => erf.ɵproviders),\n provideRouter(routes, ...routerFeatures),\n {\n provide: ENVIRONMENT_INITIALIZER,\n multi: true,\n useValue: () => updateMetaTagsOnRouteChange(),\n },\n {\n provide: HTTP_ROOT_INTERCEPTOR_FNS,\n multi: true,\n useValue: cookieInterceptor,\n },\n {\n provide: API_PREFIX,\n useFactory() {\n return typeof ANALOG_API_PREFIX !== 'undefined'\n ? ANALOG_API_PREFIX\n : 'api';\n },\n },\n ]);\n}\n\n/**\n * Provides extra custom routes in addition to the routes\n * discovered from the filesystem-based routing. These routes are\n * inserted before the filesystem-based routes, and take priority in\n * route matching.\n */\nexport function withExtraRoutes(routes: Routes): RouterFeatures {\n return {\n ɵkind: 100 as number,\n ɵproviders: [{ provide: ROUTES, useValue: routes, multi: true }],\n };\n}\n","import { Injector, inject } from '@angular/core';\nimport { ActivatedRoute } from '@angular/router';\nimport { Observable, map } from 'rxjs';\n\nimport { PageServerLoad } from './route-types';\nimport type { AnalogRouteWithLoad, RouteLoadOutput } from './to-route';\n\n/** Reads the result of the page's server `load` function, typed by route path. */\nexport function injectLoad<P extends AnalogRouteWithLoad>(\n path: P,\n options?: { injector?: Injector },\n): Observable<RouteLoadOutput<P>>;\nexport function injectLoad<\n T extends (pageServerLoad: PageServerLoad) => Promise<any>,\n>(options?: { injector?: Injector }): Observable<Awaited<ReturnType<T>>>;\nexport function injectLoad(\n pathOrOptions?: string | { injector?: Injector },\n options?: { injector?: Injector },\n): Observable<unknown> {\n const injector =\n (typeof pathOrOptions === 'string' ? options : pathOrOptions)?.injector ??\n inject(Injector);\n const route = injector.get(ActivatedRoute);\n\n return route.data.pipe(map((data) => data['load']));\n}\n","import { ActivatedRouteSnapshot } from '@angular/router';\n\n/**\n * Get server load resolver data for the route\n *\n * @param route Provides the route to get server load resolver\n * @returns Returns server load resolver data for the route\n */\nexport async function getLoadResolver<T>(\n route: ActivatedRouteSnapshot,\n): Promise<T> {\n return route.routeConfig?.resolve?.['load']?.(route);\n}\n","import { HttpParams, HttpRequest } from '@angular/common/http';\nimport { StateKey, makeStateKey } from '@angular/core';\n\n// Length-prefix each atom (netstring style) so no field, parameter key, or\n// parameter value can be crafted to shift another's boundary. Without this a\n// hash over delimiter-joined fields still collides on ambiguous inputs, e.g.\n// `?tag=x&tag=y` and `?tag=x,y` both serialize to `tag=x,y`.\nfunction encodeAtom(value: string): string {\n return `${value.length}:${value}`;\n}\n\nfunction sortAndConcatParams(params: HttpParams | URLSearchParams): string {\n const keys = [...new Set(params.keys())].sort();\n const atoms: string[] = [];\n for (const key of keys) {\n for (const value of params.getAll(key) ?? []) {\n atoms.push(encodeAtom(key), encodeAtom(value));\n }\n }\n return atoms.join('');\n}\n\nexport function makeCacheKey(\n request: HttpRequest<any>,\n mappedRequestUrl: string,\n): StateKey<unknown> {\n const { params, method, responseType } = request;\n const encodedParams = sortAndConcatParams(params);\n\n let serializedBody = request.serializeBody();\n if (serializedBody instanceof URLSearchParams) {\n serializedBody = sortAndConcatParams(serializedBody);\n } else if (typeof serializedBody !== 'string') {\n serializedBody = '';\n }\n\n const key = [\n method,\n responseType,\n mappedRequestUrl,\n serializedBody,\n encodedParams,\n ]\n .map(encodeAtom)\n .join('');\n\n const hash = generateHash(key);\n\n return makeStateKey(hash);\n}\n\n/**\n * SHA-256 round constants (first 32 bits of the fractional parts of the cube\n * roots of the first 64 primes).\n */\nconst SHA256_ROUND_CONSTANTS = /* @__PURE__ */ new Uint32Array([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1,\n 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,\n 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786,\n 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,\n 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,\n 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b,\n 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,\n 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,\n 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,\n]);\n\nlet textEncoder: TextEncoder | undefined;\n\n/**\n * Generates a SHA-256 hash of a string. This mirrors Angular's `HttpTransferCache`\n * key derivation: a synchronous SHA-256 is used because the Web Crypto API is\n * asynchronous, whereas cache-key derivation in the interceptor must stay\n * synchronous. The previous 32-bit DJB2 hash had a keyspace small enough for an\n * attacker to craft colliding requests and poison the transfer cache.\n */\nfunction generateHash(value: string): string {\n textEncoder ??= new TextEncoder();\n const inputBytes = textEncoder.encode(value);\n\n // Initial hash values (first 32 bits of the fractional parts of the square\n // roots of the first 8 primes).\n let hashState0 = 0x6a09e667;\n let hashState1 = 0xbb67ae85;\n let hashState2 = 0x3c6ef372;\n let hashState3 = 0xa54ff53a;\n let hashState4 = 0x510e527f;\n let hashState5 = 0x9b05688c;\n let hashState6 = 0x1f83d9ab;\n let hashState7 = 0x5be0cd19;\n\n const messageLengthInBits = inputBytes.length * 8;\n const paddedLengthInBytes = (((inputBytes.length + 8) >> 6) + 1) << 6;\n const paddedBytes = new Uint8Array(paddedLengthInBytes);\n paddedBytes.set(inputBytes);\n paddedBytes[inputBytes.length] = 0x80;\n\n const paddedBytesView = new DataView(paddedBytes.buffer);\n const lowBits = messageLengthInBits >>> 0;\n const highBits = (messageLengthInBits / 0x100000000) >>> 0;\n paddedBytesView.setUint32(paddedLengthInBytes - 8, highBits, false);\n paddedBytesView.setUint32(paddedLengthInBytes - 4, lowBits, false);\n\n const messageSchedule = new Uint32Array(64);\n for (\n let chunkOffset = 0;\n chunkOffset < paddedLengthInBytes;\n chunkOffset += 64\n ) {\n for (let i = 0; i < 16; i++) {\n messageSchedule[i] = paddedBytesView.getUint32(\n chunkOffset + i * 4,\n false,\n );\n }\n\n for (let i = 16; i < 64; i++) {\n const prevWord15 = messageSchedule[i - 15];\n const sigma0 =\n (((prevWord15 >>> 7) | (prevWord15 << 25)) ^\n ((prevWord15 >>> 18) | (prevWord15 << 14)) ^\n (prevWord15 >>> 3)) >>>\n 0;\n\n const prevWord2 = messageSchedule[i - 2];\n const sigma1 =\n (((prevWord2 >>> 17) | (prevWord2 << 15)) ^\n ((prevWord2 >>> 19) | (prevWord2 << 13)) ^\n (prevWord2 >>> 10)) >>>\n 0;\n\n messageSchedule[i] =\n (messageSchedule[i - 16] + sigma0 + messageSchedule[i - 7] + sigma1) >>>\n 0;\n }\n\n let workingStateA = hashState0;\n let workingStateB = hashState1;\n let workingStateC = hashState2;\n let workingStateD = hashState3;\n let workingStateE = hashState4;\n let workingStateF = hashState5;\n let workingStateG = hashState6;\n let workingStateH = hashState7;\n\n for (let i = 0; i < 64; i++) {\n const capitalSigma1 =\n (((workingStateE >>> 6) | (workingStateE << 26)) ^\n ((workingStateE >>> 11) | (workingStateE << 21)) ^\n ((workingStateE >>> 25) | (workingStateE << 7))) >>>\n 0;\n const chFunction =\n ((workingStateE & workingStateF) ^ (~workingStateE & workingStateG)) >>>\n 0;\n const temp1 =\n (workingStateH +\n capitalSigma1 +\n chFunction +\n SHA256_ROUND_CONSTANTS[i] +\n messageSchedule[i]) >>>\n 0;\n\n const capitalSigma0 =\n (((workingStateA >>> 2) | (workingStateA << 30)) ^\n ((workingStateA >>> 13) | (workingStateA << 19)) ^\n ((workingStateA >>> 22) | (workingStateA << 10))) >>>\n 0;\n const majFunction =\n ((workingStateA & workingStateB) ^\n (workingStateA & workingStateC) ^\n (workingStateB & workingStateC)) >>>\n 0;\n const temp2 = (capitalSigma0 + majFunction) >>> 0;\n\n workingStateH = workingStateG;\n workingStateG = workingStateF;\n workingStateF = workingStateE;\n workingStateE = (workingStateD + temp1) >>> 0;\n workingStateD = workingStateC;\n workingStateC = workingStateB;\n workingStateB = workingStateA;\n workingStateA = (temp1 + temp2) >>> 0;\n }\n\n hashState0 = (hashState0 + workingStateA) >>> 0;\n hashState1 = (hashState1 + workingStateB) >>> 0;\n hashState2 = (hashState2 + workingStateC) >>> 0;\n hashState3 = (hashState3 + workingStateD) >>> 0;\n hashState4 = (hashState4 + workingStateE) >>> 0;\n hashState5 = (hashState5 + workingStateF) >>> 0;\n hashState6 = (hashState6 + workingStateG) >>> 0;\n hashState7 = (hashState7 + workingStateH) >>> 0;\n }\n\n return [\n hashState0,\n hashState1,\n hashState2,\n hashState3,\n hashState4,\n hashState5,\n hashState6,\n hashState7,\n ]\n .map((x) => x.toString(16).padStart(8, '0'))\n .join('');\n}\n","import { TransferState, inject, makeStateKey } from '@angular/core';\nimport {\n HttpHandlerFn,\n HttpHeaders,\n HttpRequest,\n HttpResponse,\n} from '@angular/common/http';\n\nimport { from, of } from 'rxjs';\n\nimport { injectBaseURL, injectAPIPrefix } from '@analogjs/router/tokens';\n\nimport { makeCacheKey } from './cache-key';\n\n/**\n * Interceptor that is server-aware when making HttpClient requests.\n * Server-side requests use the full URL\n * Prerendering uses the internal Nitro $fetch function, along with state transfer\n * Client-side requests use the window.location.origin\n *\n * @param req HttpRequest<unknown>\n * @param next HttpHandlerFn\n * @returns\n */\nexport function requestContextInterceptor(\n req: HttpRequest<unknown>,\n next: HttpHandlerFn,\n) {\n const apiPrefix = injectAPIPrefix();\n const baseUrl = injectBaseURL();\n const transferState = inject(TransferState);\n\n // during prerendering with Nitro\n if (\n typeof global !== 'undefined' &&\n global.$fetch &&\n baseUrl &&\n (req.url.startsWith('/') ||\n req.url.startsWith(baseUrl) ||\n req.url.startsWith(`/${apiPrefix}`))\n ) {\n const requestUrl = new URL(req.urlWithParams, baseUrl);\n const fetchUrl = `${requestUrl.pathname}${requestUrl.search}`;\n const cacheKey = makeCacheKey(req, fetchUrl);\n const storeKey = makeStateKey<unknown>(`analog_${cacheKey}`);\n\n const responseType =\n req.responseType === 'arraybuffer' ? 'arrayBuffer' : req.responseType;\n\n return from(\n global.$fetch\n .raw(fetchUrl, {\n method: req.method as any,\n body: req.body ? req.body : undefined,\n responseType,\n headers: req.headers.keys().reduce((hdrs, current) => {\n return {\n ...hdrs,\n [current]: req.headers.get(current),\n };\n }, {}),\n })\n .then((res) => {\n const cacheResponse = {\n body: res._data,\n headers: new HttpHeaders(res.headers),\n status: 200,\n statusText: 'OK',\n url: fetchUrl,\n };\n const transferResponse = new HttpResponse(cacheResponse);\n\n transferState.set(storeKey, cacheResponse);\n return transferResponse;\n }),\n );\n }\n\n // on the client\n if (\n !import.meta.env.SSR &&\n (req.url.startsWith('/') || req.url.includes('/_analog/'))\n ) {\n // /_analog/ requests are full URLs\n const toAbsoluteUrl = (url: string) => new URL(url, window.location.origin);\n const requestUrl = toAbsoluteUrl(req.url).href;\n const { pathname, search } = toAbsoluteUrl(req.urlWithParams);\n const cacheKey = makeCacheKey(req, `${pathname}${search}`);\n const storeKey = makeStateKey<unknown>(`analog_${cacheKey}`);\n const cacheRestoreResponse = transferState.get(storeKey, null);\n\n if (cacheRestoreResponse) {\n transferState.remove(storeKey);\n return of(new HttpResponse(cacheRestoreResponse));\n }\n\n return next(\n req.clone({\n url: requestUrl,\n }),\n );\n }\n\n // on the server\n if (baseUrl && (req.url.startsWith('/') || req.url.startsWith(baseUrl))) {\n const requestUrl =\n req.url.startsWith(baseUrl) && !req.url.startsWith('/')\n ? req.url\n : `${baseUrl}${req.url}`;\n\n return next(\n req.clone({\n url: requestUrl,\n }),\n );\n }\n\n return next(req);\n}\n","import {\n booleanAttribute,\n Directive,\n effect,\n ElementRef,\n inject,\n Injector,\n input,\n output,\n Renderer2,\n runInInjectionContext,\n signal,\n} from '@angular/core';\nimport { ActivatedRoute, Params, Router } from '@angular/router';\n\nimport { injectRouteEndpointURL } from './inject-route-endpoint-url';\nimport { ANALOG_META_KEY } from './endpoints';\n\nexport type FormActionState =\n | 'submitting'\n | 'error'\n | 'redirect'\n | 'success'\n | 'navigate';\n\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: 'form[action],form[method],form[enhanceForm]',\n host: {\n '(submit)': `submitted($event)`,\n },\n standalone: true,\n})\nexport class FormAction {\n action = input<string>('');\n enhanceForm = input(false, { transform: booleanAttribute });\n // eslint-disable-next-line @angular-eslint/no-output-on-prefix\n onSuccess = output<unknown>();\n // eslint-disable-next-line @angular-eslint/no-output-on-prefix\n onError = output<unknown>();\n state = output<FormActionState>();\n private currentState = signal<FormActionState | 'idle'>('idle');\n private injector = inject(Injector);\n private router = inject(Router);\n private route = inject(ActivatedRoute);\n private path = this._getPath();\n\n constructor() {\n const form = inject(ElementRef<HTMLFormElement>).nativeElement;\n const renderer = inject(Renderer2);\n effect((onCleanup) => {\n if (!this.enhanceForm()) {\n return;\n }\n\n const previous = {\n 'data-state': form.getAttribute('data-state'),\n 'aria-busy': form.getAttribute('aria-busy'),\n };\n const state = this.currentState();\n renderer.setAttribute(form, 'data-state', state);\n if (state === 'submitting') {\n renderer.setAttribute(form, 'aria-busy', 'true');\n } else {\n renderer.removeAttribute(form, 'aria-busy');\n }\n onCleanup(() => {\n for (const [name, value] of Object.entries(previous)) {\n if (value === null) {\n renderer.removeAttribute(form, name);\n } else {\n renderer.setAttribute(form, name, value);\n }\n }\n });\n });\n }\n\n submitted($event: any) {\n $event.preventDefault();\n\n this._emitState('submitting');\n const body = new FormData($event.target);\n\n if (this.enhanceForm()) {\n const form = $event.target as HTMLFormElement;\n try {\n const action =\n this.action().trim() || form.getAttribute('action')?.trim();\n if (form.method.toUpperCase() === 'GET') {\n this._handleEnhancedGet(body, action || this.router.url);\n } else {\n const path = action\n ? new URL(action, window.location.href).toString()\n : this._getPath();\n void this._handleEnhancedPost(body, path, form.method);\n }\n } catch {\n this._emitState('error');\n }\n return;\n }\n\n if ($event.target.method.toUpperCase() === 'GET') {\n this._handleGet(body, this.router.url);\n } else {\n this._handlePost(body, this.path, $event);\n }\n }\n\n private _handleGet(body: FormData, path: string) {\n const params: Params = {};\n body.forEach((formVal, formKey) => (params[formKey] = formVal));\n\n this._emitState('navigate');\n const url = path.split('?')[0];\n this.router.navigate([url], {\n queryParams: params,\n onSameUrlNavigation: 'reload',\n });\n }\n\n private _handlePost(\n body: FormData,\n path: string,\n $event: { target: HTMLFormElement } & Event,\n ) {\n fetch(path, {\n method: $event.target.method,\n body,\n })\n .then((res) => {\n if (res.ok) {\n if (res.redirected) {\n const redirectUrl = new URL(res.url).pathname;\n this._emitState('redirect');\n this.router.navigate([redirectUrl]);\n } else if (this._isJSON(res.headers.get('Content-type'))) {\n res.json().then((result) => {\n this.onSuccess.emit(result);\n this._emitState('success');\n });\n } else {\n res.text().then((result) => {\n this.onSuccess.emit(result);\n this._emitState('success');\n });\n }\n } else {\n if (res.headers.get('X-Analog-Errors')) {\n res.json().then((errors: unknown) => {\n this.onError.emit(errors);\n this._emitState('error');\n });\n } else {\n this._emitState('error');\n }\n }\n })\n .catch((_) => {\n this._emitState('error');\n });\n }\n\n private _getPath() {\n const snapshot = this.route.snapshot;\n if (snapshot.routeConfig && ANALOG_META_KEY in snapshot.routeConfig) {\n return runInInjectionContext(this.injector, () =>\n injectRouteEndpointURL(snapshot),\n ).pathname;\n }\n\n return `/api/_analog/pages${window.location.pathname}`;\n }\n\n private _handleEnhancedGet(body: FormData, path: string) {\n const url = new URL(path, window.location.href);\n const params = new URLSearchParams(url.search);\n body.forEach((_value, key) => params.delete(key));\n body.forEach((value, key) => {\n params.append(key, value instanceof File ? value.name : value);\n });\n url.search = params.toString();\n\n this._emitState('navigate');\n this._navigateTo(url);\n }\n\n private async _handleEnhancedPost(\n body: FormData,\n path: string,\n method: string,\n ) {\n try {\n const response = await fetch(path, { method, body });\n if (response.ok) {\n if (response.redirected) {\n this._emitState('redirect');\n this._navigateTo(new URL(response.url, window.location.href));\n } else {\n const result = this._isJSON(response.headers.get('Content-type'))\n ? await response.json()\n : await response.text();\n this.onSuccess.emit(result);\n this._emitState('success');\n }\n } else {\n if (response.headers.get('X-Analog-Errors')) {\n this.onError.emit(await response.json());\n }\n this._emitState('error');\n }\n } catch {\n this._emitState('error');\n }\n }\n\n private _emitState(state: FormActionState) {\n this.currentState.set(state);\n this.state.emit(state);\n }\n\n private _navigateTo(url: URL) {\n if (url.origin === window.location.origin) {\n void this.router.navigateByUrl(\n `${url.pathname}${url.search}${url.hash}`,\n {\n onSameUrlNavigation: 'reload',\n },\n );\n return;\n }\n\n window.location.assign(url.toString());\n }\n\n private _isJSON(contentType: string | null): boolean {\n const mime = contentType ? contentType.split(';') : [];\n const essence = mime[0];\n\n return essence === 'application/json';\n }\n}\n","import type { StandardSchemaV1 } from '@analogjs/router/server/actions';\n\nexport type ValidationFieldErrors = Record<string, string[]>;\n\nfunction getPathSegmentKey(\n segment: string | number | symbol | { key: string | number | symbol },\n) {\n return typeof segment === 'object' ? segment.key : segment;\n}\n\nexport function issuePathToFieldName(\n path: ReadonlyArray<\n string | number | symbol | { key: string | number | symbol }\n >,\n): string {\n return path.map((segment) => String(getPathSegmentKey(segment))).join('.');\n}\n\nexport function issuesToFieldErrors(\n issues: ReadonlyArray<StandardSchemaV1.Issue>,\n): ValidationFieldErrors {\n return issues.reduce<ValidationFieldErrors>((errors, issue) => {\n if (!issue.path?.length) {\n return errors;\n }\n\n const fieldName = issuePathToFieldName(issue.path);\n errors[fieldName] ??= [];\n errors[fieldName].push(issue.message);\n return errors;\n }, Object.create(null));\n}\n\nexport function issuesToFormErrors(\n issues: ReadonlyArray<StandardSchemaV1.Issue>,\n): string[] {\n return issues\n .filter((issue) => !issue.path?.length)\n .map((issue) => issue.message);\n}\n","import { ROUTES } from '@angular/router';\n\n/**\n * Provides routes that provide additional\n * pages for displaying and debugging\n * routes.\n */\nexport function withDebugRoutes() {\n const routes = [\n {\n path: '__analog/routes',\n loadComponent: () => import('./debug.page'),\n },\n ];\n\n return {\n ɵkind: 101 as number,\n ɵproviders: [{ provide: ROUTES, useValue: routes, multi: true }],\n };\n}\n","import { InjectionToken, type Injector } from '@angular/core';\n\nimport type { ServerFn } from './types';\n\n/**\n * In-process transport for a server function call.\n *\n * Provided on the server by `provideServerContext`, so during SSR a server\n * function runs in the same process — and the same request injector — as the\n * render instead of making an HTTP request back into the app. Absent in the\n * browser, where `ServerFnClient` falls back to `HttpClient`.\n *\n * `injector` is the **app environment injector** — `ServerFnClient` is\n * `providedIn: 'root'`, and SSR bootstraps a fresh application per request, so\n * its injector is both per-request and the right scope for a handler to resolve\n * from. It is passed rather than captured from the token because\n * `provideServerContext` is applied as *platform* providers, which sit above\n * the app's `providedIn: 'root'` services.\n *\n * Deliberately not a component's node injector: a handler resolves app-level\n * services, and making that depend on which component happened to call it would\n * be surprising and unportable.\n */\nexport type ServerFnDispatcher = <In, Out>(\n fn: ServerFn<In, Out>,\n input: In,\n injector: Injector,\n) => Promise<Out>;\n\nexport const SERVER_FN_DISPATCHER = new InjectionToken<ServerFnDispatcher>(\n '@analogjs/router Server Function Dispatcher',\n);\n","import {\n Injectable,\n Injector,\n assertInInjectionContext,\n inject,\n makeStateKey,\n resource,\n TransferState,\n type ResourceRef,\n} from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { firstValueFrom } from 'rxjs';\n\nimport type { ServerFn } from './types';\nimport { SERVER_FN_DISPATCHER } from './dispatcher';\n\n/**\n * Client transport for server functions. In the browser it goes through Angular\n * `HttpClient`, so client `HttpInterceptorFn`s apply. During SSR the dispatcher\n * token is provided, and the call short-circuits the HTTP round-trip: the\n * handler runs in-process in the current request injector. Lives in the client\n * entry (client-safe).\n */\n@Injectable({ providedIn: 'root' })\nexport class ServerFnClient {\n private readonly http = inject(HttpClient);\n private readonly transferState = inject(TransferState);\n private readonly injector = inject(Injector);\n private readonly dispatcher = inject(SERVER_FN_DISPATCHER, {\n optional: true,\n });\n\n /** True while rendering on the server (the in-process dispatcher is provided). */\n get isServer(): boolean {\n return !!this.dispatcher;\n }\n\n async call<In, Out>(fn: ServerFn<In, Out>, input: In): Promise<Out> {\n if (this.dispatcher) {\n return this.dispatcher(fn, input, this.injector);\n }\n\n const request$ =\n fn.method === 'GET'\n ? this.http.get<Out>(fn.url)\n : this.http.post<Out>(fn.url, input ?? {});\n return firstValueFrom(request$);\n }\n\n /** Key a read's value for TransferState hydration (fn id + input). */\n stateKey<Out>(fn: ServerFn<unknown, Out>, input: unknown) {\n return makeStateKey<Out>(`__analog_fn_${fn.id}_${stableInput(input)}`);\n }\n\n readSeed<Out>(fn: ServerFn<unknown, Out>, input: unknown): Out | undefined {\n const key = this.stateKey(fn, input);\n if (this.transferState.hasKey(key)) {\n const value = this.transferState.get(key, undefined as unknown as Out);\n this.transferState.remove(key); // single-use\n return value;\n }\n return undefined;\n }\n\n writeSeed<Out>(fn: ServerFn<unknown, Out>, input: unknown, value: Out): void {\n this.transferState.set(this.stateKey(fn, input), value);\n }\n}\n\n/** No-op provider hook; ServerFnClient is `providedIn: 'root'`. */\nexport function provideServerFnClient() {\n return [] as const;\n}\n\n// Stable sentinel for the input-less read: `resource()` treats an `undefined`\n// params value as \"idle, don't load\", so an input-less read must yield a\n// defined-but-ignored params. It is never sent — the call uses `undefined`.\nconst NO_INPUT = Symbol('analog.serverFn.noInput');\n\n/**\n * Reactive read of a server function as an Angular `resource()`.\n *\n * `args` is optional: omit it for an input-less read (the resource loads once);\n * provide it for an input-bearing read (returning `undefined` from `args` leaves\n * the resource idle until inputs are ready, the standard resource pattern). For\n * imperative calls (mutations, event handlers) use `injectServerFnMutation`.\n */\nexport function injectServerFn<Out>(\n fn: ServerFn<void, Out>,\n): ResourceRef<Out | undefined>;\nexport function injectServerFn<In, Out>(\n fn: ServerFn<In, Out>,\n args: () => In | undefined,\n): ResourceRef<Out | undefined>;\nexport function injectServerFn<In, Out>(\n fn: ServerFn<In, Out>,\n args?: () => In | undefined,\n): ResourceRef<Out | undefined> {\n assertInInjectionContext(injectServerFn);\n const client = inject(ServerFnClient);\n\n return resource<Out | undefined, unknown>({\n params: () => (args ? args() : NO_INPUT),\n loader: async ({ params }) => {\n const input = (params === NO_INPUT ? undefined : params) as In;\n // Hydrate from the SSR seed on first client render; else fetch and (on\n // the server) seed for the client.\n const seeded = client.readSeed(fn as ServerFn<unknown, Out>, input);\n if (seeded !== undefined) return seeded;\n const value = await client.call(fn, input);\n if (client.isServer) {\n client.writeSeed(fn as ServerFn<unknown, Out>, input, value);\n }\n return value;\n },\n });\n}\n\n/**\n * Imperative binding of a server function: returns a callable that dispatches\n * the call through `HttpClient` (so client interceptors apply) and resolves the\n * result. Use for mutations and event-driven calls; use `injectServerFn` for\n * reactive reads.\n */\nexport function injectServerFnMutation<In, Out>(\n fn: ServerFn<In, Out>,\n): (input: In) => Promise<Out> {\n assertInInjectionContext(injectServerFnMutation);\n const client = inject(ServerFnClient);\n return (input: In) => client.call(fn, input);\n}\n\nfunction stableInput(input: unknown): string {\n if (input === undefined || input === null) return '_';\n return JSON.stringify(input);\n}\n","import type { ServerFn, ServerFnMethod } from './types';\n\nexport interface ServerFnRefConfig {\n id?: string;\n method?: ServerFnMethod;\n /**\n * Only its presence matters here: when `method` is omitted, a config with an\n * `input` schema defaults to `POST`, otherwise `GET`. The schema itself is\n * never used to build the ref — validation happens server-side.\n */\n input?: unknown;\n}\n\n/**\n * Builds a server-function reference: the client-safe `{ __serverFn, id, url,\n * method }` metadata that `injectServerFn`/`ServerFnClient` dispatch through.\n *\n * Shared by both sides so they produce identical refs: the server `serverFn`\n * wraps this with registration + the handler, and the client build's scrub\n * transform emits a call to this factory in place of the server module so the\n * browser bundle carries only the ref, never the handler or its server imports.\n *\n * The returned value is callable-typed but throws if invoked directly — it is\n * always dispatched via `injectServerFn`/`ServerFnClient`, never called.\n */\nexport function createServerFnRef<In, Out>(\n config: ServerFnRefConfig,\n): ServerFn<In, Out> {\n if (!config.id) {\n throw new Error(\n '[analog] serverFn is missing its build-derived id. Server functions require the Analog build transform (@analogjs/platform / @analogjs/vite-plugin-nitro); a raw import without it is not supported.',\n );\n }\n const method: ServerFnMethod =\n config.method ?? (config.input ? 'POST' : 'GET');\n const url = `/_analog/fn/${config.id}`;\n\n const ref = (() => {\n throw new Error(\n `serverFn \"${config.id}\" must be called via injectServerFn/ServerFnClient`,\n );\n }) as unknown as ServerFn<In, Out>;\n\n return Object.assign(ref, {\n __serverFn: true as const,\n id: config.id,\n url,\n method,\n });\n}\n","import {\n type ActivatedRoute,\n DefaultUrlSerializer,\n PRIMARY_OUTLET,\n type ResolveFn,\n UrlSegment,\n UrlSegmentGroup,\n UrlTree,\n} from '@angular/router';\n\n/**\n * Typed route path utilities for Analog.\n *\n * This module provides:\n * - The `AnalogRouteTable` base interface (augmented by generated code)\n * - The `AnalogRoutePath` union type\n * - The `toRoute()` URL builder function\n *\n * Link construction does not require an injection context.\n */\n\n/**\n * Base interface for the typed route table.\n *\n * This interface is augmented by generated code in `src/routeTree.gen.d.ts`.\n * Without the generated declaration, typed helpers reject route paths.\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface, @typescript-eslint/no-empty-object-type\nexport interface AnalogRouteTable {}\n\n/**\n * Union of all valid route paths.\n *\n * When routes are generated, this is a string literal union.\n * Without the generated declaration, this is `never`.\n */\nexport type AnalogRoutePath = Extract<keyof AnalogRouteTable, string>;\n\ntype QueryValue = string | number | boolean;\n\n/**\n * Query values accepted when building URLs. Angular converts them to strings\n * and drops `null` and `undefined`, or removes those keys when merging.\n */\ntype RouteQueryInput = Record<\n string,\n QueryValue | QueryValue[] | null | undefined\n>;\n\n/**\n * Options for building a route URL.\n */\nexport interface RoutePathOptionsBase {\n params?: Record<string, string | number | (string | number)[] | undefined>;\n query?: RouteQueryInput;\n hash?: string;\n}\n\n/** Raw parameter types from the generated route table. */\nexport type RouteParamsOutput<P extends string> =\n P extends keyof AnalogRouteTable\n ? AnalogRouteTable[P] extends { params: infer Params }\n ? Params\n : Record<string, unknown>\n : Record<string, unknown>;\n\n/**\n * Extracts the raw output type for route query params.\n */\nexport type RouteQueryOutput<P extends string> =\n P extends keyof AnalogRouteTable\n ? AnalogRouteTable[P] extends { query: infer O }\n ? O\n : Record<string, string | string[] | undefined>\n : Record<string, string | string[] | undefined>;\n\ntype RequiredRouteParamKeys<Params> =\n Params extends Record<string, never>\n ? never\n : {\n [K in keyof Params]-?: Record<string, never> extends Pick<Params, K>\n ? never\n : K;\n }[keyof Params];\n\ntype HasRequiredRouteParams<Params> = [RequiredRouteParamKeys<Params>] extends [\n never,\n]\n ? false\n : true;\n\ntype RouteParamsInput<Params> = {\n [K in keyof Params]: Exclude<Params[K], undefined> extends string[]\n ? undefined extends Params[K]\n ? (string | number)[]\n : [string | number, ...(string | number)[]]\n : Exclude<Params[K], undefined> extends string\n ? string | number\n : Params[K];\n};\n\n/**\n * Typed options that infer params from the route table when available.\n */\nexport type RoutePathOptions<P extends string = string> =\n P extends keyof AnalogRouteTable\n ? AnalogRouteTable[P] extends { params: infer Params }\n ? Params extends Record<string, never>\n ? {\n params?: never;\n query?: RouteQueryInput;\n hash?: string;\n }\n : HasRequiredRouteParams<Params> extends true\n ? {\n params: RouteParamsInput<Params>;\n query?: RouteQueryInput;\n hash?: string;\n }\n : {\n params?: RouteParamsInput<Params>;\n query?: RouteQueryInput;\n hash?: string;\n }\n : RoutePathOptionsBase\n : RoutePathOptionsBase;\n\n/**\n * Conditional args: require options when the route has params.\n */\nexport type RoutePathArgs<P extends string = string> =\n P extends keyof AnalogRouteTable\n ? AnalogRouteTable[P] extends { params: infer Params }\n ? Params extends Record<string, never>\n ? [options?: RoutePathOptions<P>]\n : HasRequiredRouteParams<Params> extends true\n ? [options: RoutePathOptions<P>]\n : [options?: RoutePathOptions<P>]\n : [options?: RoutePathOptionsBase]\n : [options?: RoutePathOptionsBase];\n\ntype EmptyObject = Record<never, never>;\ntype Simplify<T> = { [K in keyof T]: T[K] };\ntype Merge<A, B> = Omit<A, keyof B> & B;\n\n// Annotating `routeMeta` as `RouteMeta` widens these objects to index signatures.\ntype MetaObject<T> = unknown extends T\n ? EmptyObject\n : string extends keyof NonNullable<T>\n ? Record<string, unknown>\n : NonNullable<T>;\n\ntype StaticRouteData<Meta> = Meta extends { data?: infer Data }\n ? MetaObject<Data>\n : EmptyObject;\n\ntype RouteResolvers<Meta> = Meta extends { resolve?: infer Resolvers }\n ? MetaObject<Resolvers>\n : EmptyObject;\n\ntype ResolvedRouteData<Meta> = {\n [K in keyof RouteResolvers<Meta>]: RouteResolvers<Meta>[K] extends ResolveFn<\n infer T\n >\n ? T\n : unknown;\n};\n\ntype RouteMetaData<Meta> = Merge<\n StaticRouteData<Meta>,\n ResolvedRouteData<Meta>\n>;\n\n// Routes inherit parent data; child keys override parent keys.\ntype InheritedRouteData<Metas, Data = EmptyObject> = Metas extends [\n infer Meta,\n ...infer Rest,\n]\n ? InheritedRouteData<\n Rest,\n Merge<Data, RouteMetaData<Exclude<Meta, { redirectTo: string }>>>\n >\n : Data;\n\ntype RouteResourceMap<Meta> = Meta extends {\n resources?: (ctx: never) => infer R;\n}\n ? Awaited<R> extends Record<PropertyKey, unknown>\n ? Awaited<R>\n : EmptyObject\n : EmptyObject;\n\ntype PageRouteMetas<P extends keyof AnalogRouteTable> = [\n ...(AnalogRouteTable[P] extends {\n layoutRouteMeta: infer Metas extends unknown[];\n }\n ? Metas\n : []),\n ...(AnalogRouteTable[P] extends { routeMeta: infer Meta } ? [Meta] : []),\n];\n\ntype PageLoadData<P extends keyof AnalogRouteTable> =\n AnalogRouteTable[P] extends { load: unknown }\n ? { load: RouteLoadOutput<P> }\n : EmptyObject;\n\n/** Route paths whose page has a server `load` function. */\nexport type AnalogRouteWithLoad = {\n [P in AnalogRoutePath]: AnalogRouteTable[P] extends { load: unknown }\n ? P\n : never;\n}[AnalogRoutePath];\n\n/** Resolved result of a page's server `load` function. */\nexport type RouteLoadOutput<P extends string> = P extends keyof AnalogRouteTable\n ? AnalogRouteTable[P] extends { load: (...args: never[]) => infer R }\n ? Awaited<R>\n : never\n : never;\n\n/**\n * Data for a page route: static `routeMeta.data` and `routeMeta.resolve`\n * results from its layouts and the page, and the page's server `load` result.\n */\nexport type RouteDataOutput<P extends string> = P extends keyof AnalogRouteTable\n ? Simplify<\n Omit<InheritedRouteData<PageRouteMetas<P>>, 'load'> & PageLoadData<P>\n >\n : Record<string, unknown>;\n\n/**\n * Resources for a page route: `routeMeta.resources` results defined on the page.\n */\nexport type RouteResourcesOutput<P extends string> =\n P extends keyof AnalogRouteTable\n ? AnalogRouteTable[P] extends { routeMeta: infer Meta }\n ? Simplify<RouteResourceMap<Exclude<Meta, { redirectTo: string }>>>\n : EmptyObject\n : ActivatedRoute extends { resources: infer Resources }\n ? Resources\n : EmptyObject;\n\ntype SplitPath<S extends string> = S extends ''\n ? []\n : S extends `${infer Head}/${infer Tail}`\n ? [Head, ...SplitPath<Tail>]\n : [S];\ntype Segments<P extends string> = P extends `/${infer Rest}`\n ? SplitPath<Rest>\n : SplitPath<P>;\ntype JoinPath<S extends string[]> = S extends [\n infer Head extends string,\n ...infer Tail extends string[],\n]\n ? Tail extends []\n ? Head\n : `${Head}/${JoinPath<Tail>}`\n : '';\ntype Pop<S extends string[]> = S extends [\n ...infer Init extends string[],\n string,\n]\n ? Init\n : [];\ntype ParentPath<P extends string> = `/${JoinPath<Pop<Segments<P>>>}`;\ntype LastSegment<P extends string> =\n Segments<P> extends [...string[], infer Last extends string] ? Last : never;\n\ntype ResolveSegments<\n Base extends string[],\n Parts extends string[],\n> = Parts extends [infer Head extends string, ...infer Tail extends string[]]\n ? ResolveSegments<\n Head extends '.' ? Base : Head extends '..' ? Pop<Base> : [...Base, Head],\n Tail\n >\n : Base;\n\n/** Resolves a relative target against the `From` route path. */\nexport type ResolveRoutePath<\n From extends string,\n To extends string,\n> = To extends `/${string}`\n ? To\n : `/${JoinPath<ResolveSegments<Segments<From>, SplitPath<To>>>}`;\n\ntype PathPrefix<Base extends string> = Base extends '/' ? '/' : `${Base}/`;\n\n/** Route paths nested below `Base`, relative to it. */\ntype ChildPaths<\n Base extends string,\n P extends string = AnalogRoutePath,\n> = P extends `${PathPrefix<Base>}${infer Rest}`\n ? Rest extends ''\n ? never\n : Rest\n : never;\n\n// Each target is reachable through its nearest shared ancestor only.\ntype AncestorTargets<From extends string, Up extends string> = From extends '/'\n ? never\n :\n | (ParentPath<From> extends AnalogRoutePath ? Up : never)\n | `${Up}/${Exclude<\n ChildPaths<ParentPath<From>>,\n LastSegment<From> | `${LastSegment<From>}/${string}`\n >}`\n | AncestorTargets<ParentPath<From>, `${Up}/..`>;\n\n/** Relative targets from `From`: `.`, `./child`, `..`, and `../sibling`. */\nexport type RelativeRouteTarget<From extends string> =\n | '.'\n | `./${ChildPaths<From>}`\n | AncestorTargets<From, '..'>;\n\n/** Absolute route paths plus targets relative to `From`. */\nexport type ScopedRouteTarget<From extends string> =\n | AnalogRoutePath\n | RelativeRouteTarget<From>;\n\ntype SegmentParam<S extends string> = S extends `[[...${infer Name}]]`\n ? Name\n : S extends `[...${infer Name}]`\n ? Name\n : S extends `[${infer Name}]`\n ? Name\n : never;\n\n// Params in the leading segments shared by both paths, matching Angular's relative navigation.\ntype SharedParams<A extends string[], B extends string[]> = A extends [\n infer Head extends string,\n ...infer ATail extends string[],\n]\n ? B extends [Head, ...infer BTail extends string[]]\n ? SegmentParam<Head> | SharedParams<ATail, BTail>\n : never\n : never;\n\ntype WithOptional<T, K extends PropertyKey> = Simplify<\n Omit<T, K> & Partial<Pick<T, Extract<keyof T, K>>>\n>;\n\ntype ScopedParamsInput<From extends string, To extends string> = WithOptional<\n RouteParamsInput<RouteParamsOutput<To>>,\n SharedParams<Segments<From>, Segments<To>>\n>;\n\n/** Options for a route path; params shared with `From` default to current values. */\nexport type ScopedRoutePathOptions<From extends string, To extends string> =\n RouteParamsOutput<To> extends Record<string, never>\n ? { params?: never; query?: RouteQueryInput; hash?: string }\n : HasRequiredRouteParams<ScopedParamsInput<From, To>> extends true\n ? {\n params: ScopedParamsInput<From, To>;\n query?: RouteQueryInput;\n hash?: string;\n }\n : {\n params?: ScopedParamsInput<From, To>;\n query?: RouteQueryInput;\n hash?: string;\n };\n\n/** Conditional args for a target resolved against `From`. */\nexport type ScopedRoutePathArgs<From extends string, Target extends string> =\n ScopedRoutePathOptions<From, ResolveRoutePath<From, Target>> extends infer O\n ? EmptyObject extends O\n ? [options?: O]\n : [options: O]\n : never;\n\n/**\n * Result of `toRoute()` — contains properties that map directly\n * to Angular's `[routerLink]`, `[queryParams]`, and `[fragment]` inputs.\n */\nexport interface RouteLinkResult {\n path: string[];\n queryParams: RouteQueryInput | null;\n fragment: string | undefined;\n}\n\n/**\n * Builds a typed route link object from a route path pattern and options.\n *\n * The returned object separates path, query params, and fragment for\n * direct use with Angular's routerLink directive inputs.\n *\n * @example\n * toRoute('/about')\n * // → { path: ['/', 'about'], queryParams: null, fragment: undefined }\n *\n * toRoute('/users/[id]', { params: { id: '42' } })\n * // → { path: ['/', 'users', '42'], queryParams: null, fragment: undefined }\n *\n * toRoute('/users/[id]', { params: { id: '42' }, query: { tab: 'settings' }, hash: 'bio' })\n * // → { path: ['/', 'users', '42'], queryParams: { tab: 'settings' }, fragment: 'bio' }\n *\n * @example Template usage\n * Compute the link in the component:\n * ```ts\n * readonly link = toRoute('/users/[id]', { params: { id: '42' } });\n * ```\n *\n * ```html\n * <a [routerLink]=\"link.path\" [queryParams]=\"link.queryParams\" [fragment]=\"link.fragment\">\n * ```\n */\nexport function toRoute<P extends AnalogRoutePath>(\n path: P,\n ...args: RoutePathArgs<P>\n): RouteLinkResult {\n const options = args[0] as RoutePathOptionsBase | undefined;\n return buildRouteLink(path as string, options);\n}\n\n/**\n * Internal: builds a `RouteLinkResult` from path and options.\n * Exported for direct use in tests (avoids generic constraints).\n */\nexport function buildRouteLink(\n path: string,\n options?: RoutePathOptionsBase,\n): RouteLinkResult {\n return {\n path: buildPath(path, options?.params),\n queryParams: options?.query ?? null,\n fragment: options?.hash,\n };\n}\n\nfunction buildPath(\n path: string,\n params: RoutePathOptionsBase['params'] = {},\n): string[] {\n const segments = path\n .split('/')\n .filter(Boolean)\n .flatMap((segment) => {\n const optional = segment.match(/^\\[\\[\\.\\.\\.([^\\]]+)\\]\\]$/);\n const catchAll = segment.match(/^\\[\\.\\.\\.([^\\]]+)\\]$/);\n const dynamic = segment.match(/^\\[([^\\]]+)\\]$/);\n const match = optional ?? catchAll ?? dynamic;\n if (!match) return [segment];\n const value = params[match[1]];\n if (value == null || (Array.isArray(value) && !value.length)) {\n if (optional) return [];\n throw new Error(\n `Missing required ${catchAll ? 'catch-all ' : ''}param \"${match[1]}\" for path \"${path}\"`,\n );\n }\n return Array.isArray(value) ? value.map(String) : [String(value)];\n });\n // A separate root command keeps slashes inside parameter values in one segment.\n return ['/', ...segments];\n}\n\n/** Internal URL serialization for programmatic navigation. */\nexport function buildUrl(path: string, options?: RoutePathOptionsBase): string {\n const link = buildRouteLink(path, options);\n const segments = link.path.slice(1).map((path) => new UrlSegment(path, {}));\n const root = new UrlSegmentGroup([], {\n [PRIMARY_OUTLET]: new UrlSegmentGroup(segments, {}),\n });\n const queryParams = link.queryParams\n ? Object.fromEntries(\n Object.entries(link.queryParams).filter(([, value]) => value != null),\n )\n : {};\n return new DefaultUrlSerializer().serialize(\n new UrlTree(root, queryParams, link.fragment ?? null),\n );\n}\n\n/** Internal: resolves `.` and `..` segments in `to` against the `from` route path. */\nexport function resolveRoutePath(from: string, to: string): string {\n if (to.startsWith('/')) return to;\n const segments = from.split('/').filter(Boolean);\n for (const part of to.split('/')) {\n if (part === '..') {\n segments.pop();\n } else if (part && part !== '.') {\n segments.push(part);\n }\n }\n return '/' + segments.join('/');\n}\n\n/**\n * Internal: resolves `target` against the `from` route path. Params in the\n * leading segments shared with `from` default to the `current` values.\n */\nexport function resolveScopedRoute(\n from: string,\n target: string,\n current: Record<string, unknown>,\n options?: RoutePathOptionsBase,\n): { path: string; options: RoutePathOptionsBase } {\n const path = resolveRoutePath(from, target);\n const fromSegments = from.split('/').filter(Boolean);\n const toSegments = path.split('/').filter(Boolean);\n const params: Record<string, unknown> = {};\n for (\n let i = 0;\n i < toSegments.length && toSegments[i] === fromSegments[i];\n i++\n ) {\n const name = paramName(toSegments[i]);\n if (name) params[name] = current[name];\n }\n return {\n path,\n options: {\n ...options,\n params: {\n ...params,\n ...options?.params,\n } as RoutePathOptionsBase['params'],\n },\n };\n}\n\nfunction paramName(segment: string): string | undefined {\n return (segment.match(/^\\[\\[\\.\\.\\.([^\\]]+)\\]\\]$/) ??\n segment.match(/^\\[\\.\\.\\.([^\\]]+)\\]$/) ??\n segment.match(/^\\[([^\\]]+)\\]$/))?.[1];\n}\n","import { inject, Injector, Signal } from '@angular/core';\nimport { ActivatedRoute } from '@angular/router';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { combineLatest, map, Observable, of } from 'rxjs';\n\nimport type {\n AnalogRoutePath,\n RouteDataOutput,\n RouteParamsOutput,\n RouteQueryOutput,\n RouteResourcesOutput,\n} from './to-route';\n\nfunction extractCatchAllParams(\n routePath: string,\n): { name: string; type: 'catchAll' | 'optionalCatchAll' }[] {\n const params: {\n name: string;\n type: 'catchAll' | 'optionalCatchAll';\n }[] = [];\n for (const segment of routePath.split('/')) {\n const optional = segment.match(/^\\[\\[\\.\\.\\.([^\\]]+)\\]\\]$/);\n const required = segment.match(/^\\[\\.\\.\\.([^\\]]+)\\]$/);\n if (optional) {\n params.push({ name: optional[1], type: 'optionalCatchAll' });\n } else if (required) {\n params.push({ name: required[1], type: 'catchAll' });\n }\n }\n return params;\n}\n\n/** Internal: params for `route` and its ancestors, with catch-alls as arrays. */\nexport function observeRouteParams(\n route: ActivatedRoute,\n routePath: string,\n): Observable<Record<string, unknown>> {\n const ancestors = route.pathFromRoot ?? [route];\n const catchAllParams = extractCatchAllParams(routePath);\n return combineLatest([\n combineLatest(ancestors.map((entry) => entry.params)),\n combineLatest(ancestors.map((entry) => entry.url ?? of([]))),\n ]).pipe(\n map(([values, segments]) => {\n const params = Object.assign({}, ...values);\n for (const param of catchAllParams) {\n const source = ancestors.findIndex((entry, index) =>\n param.type === 'catchAll'\n ? entry.routeConfig?.path === '**'\n : !!entry.routeConfig?.matcher && values[index][param.name] != null,\n );\n if (source !== -1) {\n params[param.name] = segments[source].map((segment) => segment.path);\n }\n }\n return params;\n }),\n );\n}\n\ntype InjectOptions = { injector?: Injector };\n\n// Accepts `(from, options)` or `(options)`.\nfunction resolveArgs(\n fromOrOptions: string | InjectOptions | undefined,\n options: InjectOptions | undefined,\n) {\n const typed = typeof fromOrOptions === 'string';\n const injector = (typed ? options : fromOrOptions)?.injector;\n return {\n from: typed ? fromOrOptions : '',\n injector,\n route: injector ? injector.get(ActivatedRoute) : inject(ActivatedRoute),\n };\n}\n\n/** Read raw route params; catch-all segments are returned as arrays. */\nexport function injectParams<P extends AnalogRoutePath>(\n from: P,\n options?: InjectOptions,\n): Signal<RouteParamsOutput<P>>;\n/** Read untyped route params. Catch-all segments require a route path. */\nexport function injectParams(\n options?: InjectOptions,\n): Signal<Record<string, string | undefined>>;\nexport function injectParams(\n fromOrOptions?: string | InjectOptions,\n options?: InjectOptions,\n): Signal<unknown> {\n const { from, injector, route } = resolveArgs(fromOrOptions, options);\n return toSignal(observeRouteParams(route, from), {\n requireSync: true,\n injector,\n });\n}\n\n/** Read raw query params as a signal. No schema coercion is performed. */\nexport function injectQuery<P extends AnalogRoutePath>(\n from: P,\n options?: InjectOptions,\n): Signal<RouteQueryOutput<P>>;\n/** Read raw query params as a signal. */\nexport function injectQuery(\n options?: InjectOptions,\n): Signal<Record<string, string | string[] | undefined>>;\nexport function injectQuery(\n fromOrOptions?: string | InjectOptions,\n options?: InjectOptions,\n): Signal<unknown> {\n const { injector, route } = resolveArgs(fromOrOptions, options);\n return toSignal(route.queryParams, { requireSync: true, injector });\n}\n\n/**\n * Read route data as a signal: static `routeMeta.data` and `routeMeta.resolve`\n * results from the page and its layouts, and the page's server `load` result\n * under `load`.\n */\nexport function injectRouteData<P extends AnalogRoutePath>(\n from: P,\n options?: InjectOptions,\n): Signal<RouteDataOutput<P>>;\n/** Read untyped route data as a signal. */\nexport function injectRouteData(\n options?: InjectOptions,\n): Signal<Record<string, unknown>>;\nexport function injectRouteData(\n fromOrOptions?: string | InjectOptions,\n options?: InjectOptions,\n): Signal<unknown> {\n const { injector, route } = resolveArgs(fromOrOptions, options);\n return toSignal(route.data, { requireSync: true, injector });\n}\n\n/**\n * Access route resources: returns resources defined on the route and its\n * ancestor layouts via `routeMeta.resources`. Requires `withRouterResources()`.\n */\nexport function injectResources<P extends AnalogRoutePath>(\n from: P,\n options?: InjectOptions,\n): RouteResourcesOutput<P>;\n/** Access untyped route resources. */\nexport function injectResources(\n options?: InjectOptions,\n): RouteResourcesOutput<string>;\nexport function injectResources(\n fromOrOptions?: string | InjectOptions,\n options?: InjectOptions,\n): unknown {\n const { route } = resolveArgs(fromOrOptions, options);\n return 'resources' in route ? (route.resources ?? {}) : {};\n}\n\nexport { injectResources as injectRouteResources };\n","import {\n Directive,\n inject,\n input,\n InputSignal,\n OnChanges,\n OnDestroy,\n} from '@angular/core';\nimport { ActivatedRoute, RouterLink } from '@angular/router';\nimport type { Subscription } from 'rxjs';\n\nimport { observeRouteParams } from './inject-typed-params';\nimport {\n AnalogRoutePath,\n buildRouteLink,\n resolveScopedRoute,\n ResolveRoutePath,\n RouteParamsOutput,\n RoutePathOptions,\n RoutePathOptionsBase,\n ScopedRoutePathArgs,\n ScopedRoutePathOptions,\n ScopedRouteTarget,\n} from './to-route';\n\ntype LinkToDestination = {\n [P in AnalogRoutePath]: { path: P } & RoutePathOptions<P>;\n}[AnalogRoutePath];\n\ntype StaticRoutePath = {\n [P in AnalogRoutePath]: RouteParamsOutput<P> extends Record<string, never>\n ? P\n : never;\n}[AnalogRoutePath];\n\ntype ScopedDestination<From extends AnalogRoutePath> = {\n [T in ScopedRouteTarget<From>]: { path: T } & ScopedRoutePathOptions<\n From,\n ResolveRoutePath<From, T>\n >;\n}[ScopedRouteTarget<From>];\n\ntype ScopedStaticTarget<From extends AnalogRoutePath> = {\n [T in ScopedRouteTarget<From>]: [] extends ScopedRoutePathArgs<From, T>\n ? T\n : never;\n}[ScopedRouteTarget<From>];\n\n/** Destinations accepted by `[linkTo]`, relative to `From` when provided. */\nexport type LinkToInput<From = undefined> =\n // Angular infers `any` for `From` when the `from` input is not bound.\n | (unknown extends From\n ? StaticRoutePath | LinkToDestination\n : From extends AnalogRoutePath\n ? ScopedStaticTarget<From> | ScopedDestination<From>\n : StaticRoutePath | LinkToDestination)\n | null\n | undefined;\n\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: '[linkTo]',\n standalone: true,\n hostDirectives: [\n {\n directive: RouterLink,\n inputs: [\n 'target',\n 'queryParamsHandling',\n 'preserveFragment',\n 'skipLocationChange',\n 'replaceUrl',\n 'state',\n ],\n },\n ],\n})\nexport class LinkTo<From = undefined> implements OnChanges, OnDestroy {\n readonly linkTo: InputSignal<LinkToInput<From>> =\n input.required<LinkToInput<From>>();\n /** The current route's path. Enables relative destinations and param inheritance. */\n // Constrain the input, not the generic, to avoid expanding every route pair\n // while Angular infers the scope of an unscoped link.\n readonly from: InputSignal<(From & AnalogRoutePath) | undefined> = input<\n From & AnalogRoutePath\n >();\n private readonly routerLink = inject(RouterLink);\n private readonly route = inject(ActivatedRoute);\n private currentParams: Record<string, unknown> = {};\n private paramsFrom?: string;\n private paramsSubscription?: Subscription;\n\n ngOnChanges(): void {\n const from = this.from();\n if (from !== this.paramsFrom) {\n this.paramsFrom = from;\n this.paramsSubscription?.unsubscribe();\n this.paramsSubscription = from\n ? observeRouteParams(this.route, from).subscribe((params) => {\n this.currentParams = params;\n this.update();\n })\n : undefined;\n }\n this.update();\n }\n\n ngOnDestroy(): void {\n this.paramsSubscription?.unsubscribe();\n }\n\n private update(): void {\n const destination = this.linkTo() as\n | string\n | ({ path: string } & RoutePathOptionsBase)\n | null\n | undefined;\n const from = this.from();\n let link = null;\n if (destination) {\n const { path, ...options }: { path: string } & RoutePathOptionsBase =\n typeof destination === 'string' ? { path: destination } : destination;\n if (from) {\n const scoped = resolveScopedRoute(\n from,\n path,\n this.currentParams,\n options,\n );\n link = buildRouteLink(scoped.path, scoped.options);\n } else {\n link = buildRouteLink(path, options);\n }\n }\n\n this.routerLink.routerLink = link?.path ?? null;\n this.routerLink.queryParams = link?.queryParams ?? null;\n this.routerLink.fragment = link?.fragment;\n // Direct input assignments must also refresh href and RouterLinkActive.\n this.routerLink.ngOnChanges({});\n }\n}\n","import { inject, Injector } from '@angular/core';\nimport {\n type NavigationBehaviorOptions,\n Router,\n type UrlCreationOptions,\n} from '@angular/router';\n\nimport { injectParams, injectQuery } from './inject-typed-params';\nimport type {\n AnalogRoutePath,\n ResolveRoutePath,\n RouteParamsOutput,\n RoutePathArgs,\n RoutePathOptionsBase,\n RouteQueryOutput,\n ScopedRoutePathOptions,\n ScopedRouteTarget,\n} from './to-route';\nimport { buildRouteLink, resolveScopedRoute } from './to-route';\n\n/** Angular navigation extras; `query` and `hash` replace `queryParams` and `fragment`. */\ntype NavigateExtras = NavigationBehaviorOptions &\n Pick<UrlCreationOptions, 'queryParamsHandling' | 'preserveFragment'>;\n\ntype WithExtrasArgs<Args extends [options?: unknown]> = [] extends Args\n ?\n | [extras: NavigateExtras]\n | [options: Args[0] | undefined, extras: NavigateExtras]\n : [options: Args[0], extras: NavigateExtras];\n\ntype TypedNavigate = {\n <P extends AnalogRoutePath>(\n path: P,\n ...args: RoutePathArgs<P>\n ): Promise<boolean>;\n <P extends AnalogRoutePath>(\n path: P,\n ...args: WithExtrasArgs<RoutePathArgs<P>>\n ): Promise<boolean>;\n};\n\n// `params` and `query` may also be computed from the current route's values.\ntype WithUpdaters<From extends string, O> = {\n [K in keyof O]: K extends 'params'\n ? O[K] | ((prev: RouteParamsOutput<From>) => Exclude<O[K], undefined>)\n : K extends 'query'\n ? O[K] | ((prev: RouteQueryOutput<From>) => Exclude<O[K], undefined>)\n : O[K];\n};\n\ntype ScopedNavigateArgs<From extends string, T extends string> =\n WithUpdaters<\n From,\n ScopedRoutePathOptions<From, ResolveRoutePath<From, T>>\n > extends infer O\n ? Record<never, never> extends O\n ? [options?: O]\n : [options: O]\n : never;\n\ntype ScopedNavigate<From extends AnalogRoutePath> = {\n <T extends ScopedRouteTarget<From>>(\n target: T,\n ...args: ScopedNavigateArgs<From, T>\n ): Promise<boolean>;\n <T extends ScopedRouteTarget<From>>(\n target: T,\n ...args: WithExtrasArgs<ScopedNavigateArgs<From, T>>\n ): Promise<boolean>;\n};\n\nfunction isRoutePathOptionsBase(value: unknown): value is RoutePathOptionsBase {\n return (\n !!value &&\n typeof value === 'object' &&\n ('params' in value || 'query' in value || 'hash' in value)\n );\n}\n\nfunction update<T>(value: T, current: unknown): T {\n return typeof value === 'function' ? value(current) : value;\n}\n\n/**\n * Injects a typed navigate function.\n *\n * @example\n * ```ts\n * const navigate = injectNavigate();\n *\n * navigate('/users/[id]', { params: { id: '42' } }); // ✅\n * navigate('/users/[id]', { params: { id: 42 } }); // ✅\n *\n * // With navigation extras\n * navigate('/users/[id]', { params: { id: '42' } }, { replaceUrl: true });\n * navigate('/search', { query: { page: 2 } }, { queryParamsHandling: 'merge' });\n * ```\n */\nexport function injectNavigate(): TypedNavigate;\n/**\n * Injects a navigate function scoped to the current route, `from`.\n *\n * Targets may be relative (`.`, `./child`, `..`, `../sibling`). Params in the\n * leading segments the target shares with `from` default to current values.\n * `params` and `query` may be functions of the current values.\n *\n * @example\n * ```ts\n * // In the component for /users/[id]\n * const navigate = injectNavigate('/users/[id]');\n *\n * navigate('./posts'); // /users/42/posts\n * navigate('.', { params: { id: 43 } }); // /users/43\n * navigate('..'); // /users\n * navigate('.', { params: (prev) => ({ id: Number(prev.id) + 1 }) });\n * ```\n */\nexport function injectNavigate<From extends AnalogRoutePath>(\n from: From,\n options?: { injector?: Injector },\n): ScopedNavigate<From>;\nexport function injectNavigate(\n from?: string,\n options?: { injector?: Injector },\n): (target: string, ...args: unknown[]) => Promise<boolean> {\n const injector = options?.injector ?? inject(Injector);\n const router = injector.get(Router);\n const currentParams = from\n ? injectParams(from as AnalogRoutePath, { injector })\n : undefined;\n const currentQuery = from\n ? injectQuery(from as AnalogRoutePath, { injector })\n : undefined;\n\n return (target: string, ...args: unknown[]): Promise<boolean> => {\n let options: RoutePathOptionsBase | undefined;\n let extras: NavigateExtras | undefined;\n\n if (args.length > 1) {\n options = args[0] as RoutePathOptionsBase | undefined;\n extras = args[1] as NavigateExtras | undefined;\n } else if (args.length === 1) {\n if (isRoutePathOptionsBase(args[0])) {\n options = args[0];\n } else {\n extras = args[0] as NavigateExtras;\n }\n }\n\n let path = target;\n if (from && currentParams && currentQuery) {\n const params = currentParams();\n ({ path, options } = resolveScopedRoute(from, target, params, {\n ...options,\n params: update(options?.params, params),\n query: update(options?.query, currentQuery()),\n }));\n }\n const link = buildRouteLink(path, options);\n return router.navigate(link.path, {\n ...extras,\n queryParams: link.queryParams,\n fragment: link.fragment,\n });\n };\n}\n"],"mappings":";;;;;;;;;;AAyCA,MAAa,mBAAmB,UAA0B;CACxD,OAAO;AACT;AAOA,MAAa,qBAAoB;CAC/B,OAAO,OAAO,MAAM;AACtB;AAOA,MAAa,6BAA4B;CACvC,OAAO,OAAO,cAAc;AAC9B;ACxDA,SAAgB,kBACd,KACA,MACA,WAAW,OAAO,WAAW,GAC7B,gBAAgB,cAAa,GAAE;CAE/B,IAAI,iBAAiB,QAAQ,KAAK,IAAI,IAAI,SAAS,WAAW,GAAG;EAC/D,IAAI,UAAU,IAAI,YAAW;EAC7B,MAAM,UAAU,eAAe,QAAQ;EACvC,UAAU,QAAQ,IAAI,UAAU,WAAW,EAAE;EAM7C,OAAO,KAJgB,IAAI,MAAM,EAC/B,QACD,CAEW,CAAc;CAC5B,OACE,OAAO,KAAK,GAAG;AAEnB;ACDA,SAAgB,kBACd,GAAG,UAA0B;CAE7B,MAAM,qBAAqB,SAAS,QAAQ,SAAS,KAAK,SAAS,GAAG;CACtE,MAAM,iBAAiB,SAAS,QAAQ,SAAS,KAAK,QAAQ,GAAG;CAEjE,OAAO,yBAAyB;EAC9B,mBAAmB,KAAK,QAAQ,IAAI,UAAU;EAC9C,cAAc,QAAQ,GAAG,cAAc;EACvC;GACE,SAAS;GACT,OAAO;GACP,gBAAgB,4BAA2B;EAC5C;EACD;GACE,SAAS;GACT,OAAO;GACP,UAAU;EACX;EACD;GACE,SAAS;GACT,aAAU;IACR,OAAO,OAAO,sBAAsB,cAChC,oBACA;GACN;EACD;CACF,CAAA;AACH;AAQA,SAAgB,gBAAgB,QAAc;CA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UAAU,aAChB,YAAY,SAAS,WAAW,SAAS,UAAU;AAExD;AAEA,SAAS,OAAU,OAAU,SAAgB;CAC3C,OAAO,OAAO,UAAU,aAAa,MAAM,OAAO,IAAI;AACxD;AAwCA,SAAgB,eACd,MACA,SAAiC;CAEjC,MAAM,WAAW,SAAS,YAAY,OAAO,QAAQ;CACrD,MAAM,SAAS,SAAS,IAAI,MAAM;CAClC,MAAM,gBAAgB,OAClB,aAAa,MAAyB,EAAE,SAAQ,CAAE,IAClD;CACJ,MAAM,eAAe,OACjB,YAAY,MAAyB,EAAE,SAAQ,CAAE,IACjD;CAEJ,QAAQ,QAAgB,GAAG,SAAqC;EAC9D,IAAI;EACJ,IAAI;EAEJ,IAAI,KAAK,SAAS,GAAG;GACnB,UAAU,KAAK;GACf,SAAS,KAAK;EAChB,OAAO,IAAI,KAAK,WAAW,GACzB,IAAI,uBAAuB,KAAK,EAAE,GAChC,UAAU,KAAK;OAEf,SAAS,KAAK;EAIlB,IAAI,OAAO;EACX,IAAI,QAAQ,iBAAiB,cAAc;GACzC,MAAM,SAAS,cAAa;GAC5B,CAAC,CAAE,MAAM,WAAY,mBAAmB,MAAM,QAAQ,QAAQ;IAC5D,GAAG;IACH,QAAQ,OAAO,SAAS,QAAQ,MAAM;IACtC,OAAO,OAAO,SAAS,OAAO,aAAY,CAAE;GAC7C,CAAA;EACH;EACA,MAAM,OAAO,eAAe,MAAM,OAAO;EACzC,OAAO,OAAO,SAAS,KAAK,MAAM;GAChC,GAAG;GACH,aAAa,KAAK;GAClB,UAAU,KAAK;EAChB,CAAA;CACH;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@analogjs/router",
|
|
3
|
-
"version": "2.8.0-beta.
|
|
3
|
+
"version": "2.8.0-beta.16",
|
|
4
4
|
"description": "Filesystem-based routing for Angular",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Brandon Roberts <robertsbt@gmail.com>",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"url": "https://github.com/sponsors/brandonroberts"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"@analogjs/content": "^2.8.0-beta.
|
|
27
|
+
"@analogjs/content": "^2.8.0-beta.16",
|
|
28
28
|
"@angular/core": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0",
|
|
29
29
|
"@angular/router": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0",
|
|
30
30
|
"@tanstack/angular-query-experimental": "^5.80.0"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import { EnvironmentProviders, InjectionToken, Injector, InputSignal, OnChanges, ResourceRef, Signal, Type } from "@angular/core";
|
|
2
|
+
import { EnvironmentProviders, InjectionToken, Injector, InputSignal, OnChanges, OnDestroy, ResourceRef, Signal, Type } from "@angular/core";
|
|
3
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";
|
|
4
|
+
import { ActivatedRoute, ActivatedRouteSnapshot, CanActivateChildFn, CanActivateFn, CanDeactivateFn, CanMatchFn, DeprecatedGuard, NavigationBehaviorOptions, ResolveFn, Route, Router, RouterFeatures, Routes, UrlCreationOptions } from "@angular/router";
|
|
5
5
|
import { H3Event, H3EventContext } from "h3";
|
|
6
6
|
import { $Fetch } from "nitropack";
|
|
7
7
|
import { Observable } from "rxjs";
|
|
@@ -145,6 +145,226 @@ export type PageServerLoad = {
|
|
|
145
145
|
event: H3Event;
|
|
146
146
|
};
|
|
147
147
|
export type LoadResult<A extends (pageServerLoad: PageServerLoad) => Promise<any>> = Awaited<ReturnType<A>>;
|
|
148
|
+
/**
|
|
149
|
+
* Typed route path utilities for Analog.
|
|
150
|
+
*
|
|
151
|
+
* This module provides:
|
|
152
|
+
* - The `AnalogRouteTable` base interface (augmented by generated code)
|
|
153
|
+
* - The `AnalogRoutePath` union type
|
|
154
|
+
* - The `toRoute()` URL builder function
|
|
155
|
+
*
|
|
156
|
+
* Link construction does not require an injection context.
|
|
157
|
+
*/
|
|
158
|
+
/**
|
|
159
|
+
* Base interface for the typed route table.
|
|
160
|
+
*
|
|
161
|
+
* This interface is augmented by generated code in `src/routeTree.gen.d.ts`.
|
|
162
|
+
* Without the generated declaration, typed helpers reject route paths.
|
|
163
|
+
*/
|
|
164
|
+
interface AnalogRouteTable {}
|
|
165
|
+
/**
|
|
166
|
+
* Union of all valid route paths.
|
|
167
|
+
*
|
|
168
|
+
* When routes are generated, this is a string literal union.
|
|
169
|
+
* Without the generated declaration, this is `never`.
|
|
170
|
+
*/
|
|
171
|
+
type AnalogRoutePath = Extract<keyof AnalogRouteTable, string>;
|
|
172
|
+
type QueryValue = string | number | boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Query values accepted when building URLs. Angular converts them to strings
|
|
175
|
+
* and drops `null` and `undefined`, or removes those keys when merging.
|
|
176
|
+
*/
|
|
177
|
+
type RouteQueryInput = Record<string, QueryValue | QueryValue[] | null | undefined>;
|
|
178
|
+
/**
|
|
179
|
+
* Options for building a route URL.
|
|
180
|
+
*/
|
|
181
|
+
interface RoutePathOptionsBase {
|
|
182
|
+
params?: Record<string, string | number | (string | number)[] | undefined>;
|
|
183
|
+
query?: RouteQueryInput;
|
|
184
|
+
hash?: string;
|
|
185
|
+
}
|
|
186
|
+
/** Raw parameter types from the generated route table. */
|
|
187
|
+
type RouteParamsOutput<P extends string> = P extends keyof AnalogRouteTable ? AnalogRouteTable[P] extends {
|
|
188
|
+
params: infer Params;
|
|
189
|
+
} ? Params : Record<string, unknown> : Record<string, unknown>;
|
|
190
|
+
/**
|
|
191
|
+
* Extracts the raw output type for route query params.
|
|
192
|
+
*/
|
|
193
|
+
type RouteQueryOutput<P extends string> = P extends keyof AnalogRouteTable ? AnalogRouteTable[P] extends {
|
|
194
|
+
query: infer O;
|
|
195
|
+
} ? O : Record<string, string | string[] | undefined> : Record<string, string | string[] | undefined>;
|
|
196
|
+
type RequiredRouteParamKeys<Params> = Params extends Record<string, never> ? never : { [K in keyof Params]-?: Record<string, never> extends Pick<Params, K> ? never : K; }[keyof Params];
|
|
197
|
+
type HasRequiredRouteParams<Params> = [RequiredRouteParamKeys<Params>] extends [never] ? false : true;
|
|
198
|
+
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]; };
|
|
199
|
+
/**
|
|
200
|
+
* Typed options that infer params from the route table when available.
|
|
201
|
+
*/
|
|
202
|
+
type RoutePathOptions<P extends string = string> = P extends keyof AnalogRouteTable ? AnalogRouteTable[P] extends {
|
|
203
|
+
params: infer Params;
|
|
204
|
+
} ? Params extends Record<string, never> ? {
|
|
205
|
+
params?: never;
|
|
206
|
+
query?: RouteQueryInput;
|
|
207
|
+
hash?: string;
|
|
208
|
+
} : HasRequiredRouteParams<Params> extends true ? {
|
|
209
|
+
params: RouteParamsInput<Params>;
|
|
210
|
+
query?: RouteQueryInput;
|
|
211
|
+
hash?: string;
|
|
212
|
+
} : {
|
|
213
|
+
params?: RouteParamsInput<Params>;
|
|
214
|
+
query?: RouteQueryInput;
|
|
215
|
+
hash?: string;
|
|
216
|
+
} : RoutePathOptionsBase : RoutePathOptionsBase;
|
|
217
|
+
/**
|
|
218
|
+
* Conditional args: require options when the route has params.
|
|
219
|
+
*/
|
|
220
|
+
type RoutePathArgs<P extends string = string> = P extends keyof AnalogRouteTable ? AnalogRouteTable[P] extends {
|
|
221
|
+
params: infer Params;
|
|
222
|
+
} ? Params extends Record<string, never> ? [options?: RoutePathOptions<P>] : HasRequiredRouteParams<Params> extends true ? [options: RoutePathOptions<P>] : [options?: RoutePathOptions<P>] : [options?: RoutePathOptionsBase] : [options?: RoutePathOptionsBase];
|
|
223
|
+
type EmptyObject = Record<never, never>;
|
|
224
|
+
type Simplify<T> = { [K in keyof T]: T[K]; };
|
|
225
|
+
type Merge<A, B> = Omit<A, keyof B> & B;
|
|
226
|
+
type MetaObject<T> = unknown extends T ? EmptyObject : string extends keyof NonNullable<T> ? Record<string, unknown> : NonNullable<T>;
|
|
227
|
+
type StaticRouteData<Meta> = Meta extends {
|
|
228
|
+
data?: infer Data;
|
|
229
|
+
} ? MetaObject<Data> : EmptyObject;
|
|
230
|
+
type RouteResolvers<Meta> = Meta extends {
|
|
231
|
+
resolve?: infer Resolvers;
|
|
232
|
+
} ? MetaObject<Resolvers> : EmptyObject;
|
|
233
|
+
type ResolvedRouteData<Meta> = { [K in keyof RouteResolvers<Meta>]: RouteResolvers<Meta>[K] extends ResolveFn<infer T> ? T : unknown; };
|
|
234
|
+
type RouteMetaData<Meta> = Merge<StaticRouteData<Meta>, ResolvedRouteData<Meta>>;
|
|
235
|
+
type InheritedRouteData<Metas, Data = EmptyObject> = Metas extends [infer Meta, ...infer Rest] ? InheritedRouteData<Rest, Merge<Data, RouteMetaData<Exclude<Meta, {
|
|
236
|
+
redirectTo: string;
|
|
237
|
+
}>>>> : Data;
|
|
238
|
+
type RouteResourceMap<Meta> = Meta extends {
|
|
239
|
+
resources?: (ctx: never) => infer R;
|
|
240
|
+
} ? Awaited<R> extends Record<PropertyKey, unknown> ? Awaited<R> : EmptyObject : EmptyObject;
|
|
241
|
+
type PageRouteMetas<P extends keyof AnalogRouteTable> = [...(AnalogRouteTable[P] extends {
|
|
242
|
+
layoutRouteMeta: infer Metas extends unknown[];
|
|
243
|
+
} ? Metas : []), ...(AnalogRouteTable[P] extends {
|
|
244
|
+
routeMeta: infer Meta;
|
|
245
|
+
} ? [Meta] : [])];
|
|
246
|
+
type PageLoadData<P extends keyof AnalogRouteTable> = AnalogRouteTable[P] extends {
|
|
247
|
+
load: unknown;
|
|
248
|
+
} ? {
|
|
249
|
+
load: RouteLoadOutput<P>;
|
|
250
|
+
} : EmptyObject;
|
|
251
|
+
/** Route paths whose page has a server `load` function. */
|
|
252
|
+
type AnalogRouteWithLoad = { [P in AnalogRoutePath]: AnalogRouteTable[P] extends {
|
|
253
|
+
load: unknown;
|
|
254
|
+
} ? P : never; }[AnalogRoutePath];
|
|
255
|
+
/** Resolved result of a page's server `load` function. */
|
|
256
|
+
type RouteLoadOutput<P extends string> = P extends keyof AnalogRouteTable ? AnalogRouteTable[P] extends {
|
|
257
|
+
load: (...args: never[]) => infer R;
|
|
258
|
+
} ? Awaited<R> : never : never;
|
|
259
|
+
/**
|
|
260
|
+
* Data for a page route: static `routeMeta.data` and `routeMeta.resolve`
|
|
261
|
+
* results from its layouts and the page, and the page's server `load` result.
|
|
262
|
+
*/
|
|
263
|
+
type RouteDataOutput<P extends string> = P extends keyof AnalogRouteTable ? Simplify<Omit<InheritedRouteData<PageRouteMetas<P>>, 'load'> & PageLoadData<P>> : Record<string, unknown>;
|
|
264
|
+
/**
|
|
265
|
+
* Resources for a page route: `routeMeta.resources` results defined on the page.
|
|
266
|
+
*/
|
|
267
|
+
type RouteResourcesOutput<P extends string> = P extends keyof AnalogRouteTable ? AnalogRouteTable[P] extends {
|
|
268
|
+
routeMeta: infer Meta;
|
|
269
|
+
} ? Simplify<RouteResourceMap<Exclude<Meta, {
|
|
270
|
+
redirectTo: string;
|
|
271
|
+
}>>> : EmptyObject : ActivatedRoute extends {
|
|
272
|
+
resources: infer Resources;
|
|
273
|
+
} ? Resources : EmptyObject;
|
|
274
|
+
type SplitPath<S extends string> = S extends '' ? [] : S extends `${infer Head}/${infer Tail}` ? [Head, ...SplitPath<Tail>] : [S];
|
|
275
|
+
type Segments<P extends string> = P extends `/${infer Rest}` ? SplitPath<Rest> : SplitPath<P>;
|
|
276
|
+
type JoinPath<S extends string[]> = S extends [infer Head extends string, ...infer Tail extends string[]] ? Tail extends [] ? Head : `${Head}/${JoinPath<Tail>}` : '';
|
|
277
|
+
type Pop<S extends string[]> = S extends [...infer Init extends string[], string] ? Init : [];
|
|
278
|
+
type ParentPath<P extends string> = `/${JoinPath<Pop<Segments<P>>>}`;
|
|
279
|
+
type LastSegment<P extends string> = Segments<P> extends [...string[], infer Last extends string] ? Last : never;
|
|
280
|
+
type ResolveSegments<Base extends string[], Parts extends string[]> = Parts extends [infer Head extends string, ...infer Tail extends string[]] ? ResolveSegments<Head extends '.' ? Base : Head extends '..' ? Pop<Base> : [...Base, Head], Tail> : Base;
|
|
281
|
+
/** Resolves a relative target against the `From` route path. */
|
|
282
|
+
type ResolveRoutePath<From extends string, To extends string> = To extends `/${string}` ? To : `/${JoinPath<ResolveSegments<Segments<From>, SplitPath<To>>>}`;
|
|
283
|
+
type PathPrefix<Base extends string> = Base extends '/' ? '/' : `${Base}/`;
|
|
284
|
+
/** Route paths nested below `Base`, relative to it. */
|
|
285
|
+
type ChildPaths<Base extends string, P extends string = AnalogRoutePath> = P extends `${PathPrefix<Base>}${infer Rest}` ? Rest extends '' ? never : Rest : never;
|
|
286
|
+
type AncestorTargets<From extends string, Up extends string> = From extends '/' ? never : (ParentPath<From> extends AnalogRoutePath ? Up : never) | `${Up}/${Exclude<ChildPaths<ParentPath<From>>, LastSegment<From> | `${LastSegment<From>}/${string}`>}` | AncestorTargets<ParentPath<From>, `${Up}/..`>;
|
|
287
|
+
/** Relative targets from `From`: `.`, `./child`, `..`, and `../sibling`. */
|
|
288
|
+
type RelativeRouteTarget<From extends string> = '.' | `./${ChildPaths<From>}` | AncestorTargets<From, '..'>;
|
|
289
|
+
/** Absolute route paths plus targets relative to `From`. */
|
|
290
|
+
type ScopedRouteTarget<From extends string> = AnalogRoutePath | RelativeRouteTarget<From>;
|
|
291
|
+
type SegmentParam<S extends string> = S extends `[[...${infer Name}]]` ? Name : S extends `[...${infer Name}]` ? Name : S extends `[${infer Name}]` ? Name : never;
|
|
292
|
+
type SharedParams<A extends string[], B extends string[]> = A extends [infer Head extends string, ...infer ATail extends string[]] ? B extends [Head, ...infer BTail extends string[]] ? SegmentParam<Head> | SharedParams<ATail, BTail> : never : never;
|
|
293
|
+
type WithOptional<T, K extends PropertyKey> = Simplify<Omit<T, K> & Partial<Pick<T, Extract<keyof T, K>>>>;
|
|
294
|
+
type ScopedParamsInput<From extends string, To extends string> = WithOptional<RouteParamsInput<RouteParamsOutput<To>>, SharedParams<Segments<From>, Segments<To>>>;
|
|
295
|
+
/** Options for a route path; params shared with `From` default to current values. */
|
|
296
|
+
type ScopedRoutePathOptions<From extends string, To extends string> = RouteParamsOutput<To> extends Record<string, never> ? {
|
|
297
|
+
params?: never;
|
|
298
|
+
query?: RouteQueryInput;
|
|
299
|
+
hash?: string;
|
|
300
|
+
} : HasRequiredRouteParams<ScopedParamsInput<From, To>> extends true ? {
|
|
301
|
+
params: ScopedParamsInput<From, To>;
|
|
302
|
+
query?: RouteQueryInput;
|
|
303
|
+
hash?: string;
|
|
304
|
+
} : {
|
|
305
|
+
params?: ScopedParamsInput<From, To>;
|
|
306
|
+
query?: RouteQueryInput;
|
|
307
|
+
hash?: string;
|
|
308
|
+
};
|
|
309
|
+
/** Conditional args for a target resolved against `From`. */
|
|
310
|
+
type ScopedRoutePathArgs<From extends string, Target extends string> = ScopedRoutePathOptions<From, ResolveRoutePath<From, Target>> extends (infer O) ? EmptyObject extends O ? [options?: O] : [options: O] : never;
|
|
311
|
+
/**
|
|
312
|
+
* Result of `toRoute()` — contains properties that map directly
|
|
313
|
+
* to Angular's `[routerLink]`, `[queryParams]`, and `[fragment]` inputs.
|
|
314
|
+
*/
|
|
315
|
+
interface RouteLinkResult {
|
|
316
|
+
path: string[];
|
|
317
|
+
queryParams: RouteQueryInput | null;
|
|
318
|
+
fragment: string | undefined;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Builds a typed route link object from a route path pattern and options.
|
|
322
|
+
*
|
|
323
|
+
* The returned object separates path, query params, and fragment for
|
|
324
|
+
* direct use with Angular's routerLink directive inputs.
|
|
325
|
+
*
|
|
326
|
+
* @example
|
|
327
|
+
* toRoute('/about')
|
|
328
|
+
* // → { path: ['/', 'about'], queryParams: null, fragment: undefined }
|
|
329
|
+
*
|
|
330
|
+
* toRoute('/users/[id]', { params: { id: '42' } })
|
|
331
|
+
* // → { path: ['/', 'users', '42'], queryParams: null, fragment: undefined }
|
|
332
|
+
*
|
|
333
|
+
* toRoute('/users/[id]', { params: { id: '42' }, query: { tab: 'settings' }, hash: 'bio' })
|
|
334
|
+
* // → { path: ['/', 'users', '42'], queryParams: { tab: 'settings' }, fragment: 'bio' }
|
|
335
|
+
*
|
|
336
|
+
* @example Template usage
|
|
337
|
+
* Compute the link in the component:
|
|
338
|
+
* ```ts
|
|
339
|
+
* readonly link = toRoute('/users/[id]', { params: { id: '42' } });
|
|
340
|
+
* ```
|
|
341
|
+
*
|
|
342
|
+
* ```html
|
|
343
|
+
* <a [routerLink]="link.path" [queryParams]="link.queryParams" [fragment]="link.fragment">
|
|
344
|
+
* ```
|
|
345
|
+
*/
|
|
346
|
+
export declare function toRoute<P extends AnalogRoutePath>(path: P, ...args: RoutePathArgs<P>): RouteLinkResult;
|
|
347
|
+
/**
|
|
348
|
+
* Internal: builds a `RouteLinkResult` from path and options.
|
|
349
|
+
* Exported for direct use in tests (avoids generic constraints).
|
|
350
|
+
*/
|
|
351
|
+
declare function buildRouteLink(path: string, options?: RoutePathOptionsBase): RouteLinkResult;
|
|
352
|
+
/** Internal URL serialization for programmatic navigation. */
|
|
353
|
+
declare function buildUrl(path: string, options?: RoutePathOptionsBase): string;
|
|
354
|
+
/** Internal: resolves `.` and `..` segments in `to` against the `from` route path. */
|
|
355
|
+
declare function resolveRoutePath(from: string, to: string): string;
|
|
356
|
+
/**
|
|
357
|
+
* Internal: resolves `target` against the `from` route path. Params in the
|
|
358
|
+
* leading segments shared with `from` default to the `current` values.
|
|
359
|
+
*/
|
|
360
|
+
declare function resolveScopedRoute(from: string, target: string, current: Record<string, unknown>, options?: RoutePathOptionsBase): {
|
|
361
|
+
path: string;
|
|
362
|
+
options: RoutePathOptionsBase;
|
|
363
|
+
};
|
|
364
|
+
/** Reads the result of the page's server `load` function, typed by route path. */
|
|
365
|
+
export declare function injectLoad<P extends AnalogRouteWithLoad>(path: P, options?: {
|
|
366
|
+
injector?: Injector;
|
|
367
|
+
}): Observable<RouteLoadOutput<P>>;
|
|
148
368
|
export declare function injectLoad<T extends (pageServerLoad: PageServerLoad) => Promise<any>>(options?: {
|
|
149
369
|
injector?: Injector;
|
|
150
370
|
}): Observable<Awaited<ReturnType<T>>>;
|
|
@@ -393,133 +613,40 @@ export declare function createServerFnRef<In, Out>(config: ServerFnRefConfig): S
|
|
|
393
613
|
*/
|
|
394
614
|
type ServerFnDispatcher = <In, Out>(fn: ServerFn<In, Out>, input: In, injector: Injector) => Promise<Out>;
|
|
395
615
|
export declare const SERVER_FN_DISPATCHER: InjectionToken<ServerFnDispatcher>;
|
|
396
|
-
/**
|
|
397
|
-
* Typed route path utilities for Analog.
|
|
398
|
-
*
|
|
399
|
-
* This module provides:
|
|
400
|
-
* - The `AnalogRouteTable` base interface (augmented by generated code)
|
|
401
|
-
* - The `AnalogRoutePath` union type
|
|
402
|
-
* - The `toRoute()` URL builder function
|
|
403
|
-
*
|
|
404
|
-
* Link construction does not require an injection context.
|
|
405
|
-
*/
|
|
406
|
-
/**
|
|
407
|
-
* Base interface for the typed route table.
|
|
408
|
-
*
|
|
409
|
-
* This interface is augmented by generated code in `src/routeTree.gen.d.ts`.
|
|
410
|
-
* Without the generated declaration, typed helpers reject route paths.
|
|
411
|
-
*/
|
|
412
|
-
interface AnalogRouteTable {}
|
|
413
|
-
/**
|
|
414
|
-
* Union of all valid route paths.
|
|
415
|
-
*
|
|
416
|
-
* When routes are generated, this is a string literal union.
|
|
417
|
-
* Without the generated declaration, this is `never`.
|
|
418
|
-
*/
|
|
419
|
-
type AnalogRoutePath = Extract<keyof AnalogRouteTable, string>;
|
|
420
|
-
/**
|
|
421
|
-
* Options for building a route URL.
|
|
422
|
-
*/
|
|
423
|
-
interface RoutePathOptionsBase {
|
|
424
|
-
params?: Record<string, string | number | (string | number)[] | undefined>;
|
|
425
|
-
query?: Record<string, string | string[] | undefined>;
|
|
426
|
-
hash?: string;
|
|
427
|
-
}
|
|
428
|
-
/** Raw parameter types from the generated route table. */
|
|
429
|
-
type RouteParamsOutput<P extends string> = P extends keyof AnalogRouteTable ? AnalogRouteTable[P] extends {
|
|
430
|
-
params: infer Params;
|
|
431
|
-
} ? Params : Record<string, unknown> : Record<string, unknown>;
|
|
432
|
-
/**
|
|
433
|
-
* Extracts the raw output type for route query params.
|
|
434
|
-
*/
|
|
435
|
-
type RouteQueryOutput<P extends string> = P extends keyof AnalogRouteTable ? AnalogRouteTable[P] extends {
|
|
436
|
-
query: infer O;
|
|
437
|
-
} ? O : Record<string, string | string[] | undefined> : Record<string, string | string[] | undefined>;
|
|
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]; };
|
|
441
|
-
/**
|
|
442
|
-
* Typed options that infer params from the route table when available.
|
|
443
|
-
*/
|
|
444
|
-
type RoutePathOptions<P extends string = string> = P extends keyof AnalogRouteTable ? AnalogRouteTable[P] extends {
|
|
445
|
-
params: infer Params;
|
|
446
|
-
} ? Params extends Record<string, never> ? {
|
|
447
|
-
params?: never;
|
|
448
|
-
query?: RouteQueryOutput<P>;
|
|
449
|
-
hash?: string;
|
|
450
|
-
} : HasRequiredRouteParams<Params> extends true ? {
|
|
451
|
-
params: RouteParamsInput<Params>;
|
|
452
|
-
query?: RouteQueryOutput<P>;
|
|
453
|
-
hash?: string;
|
|
454
|
-
} : {
|
|
455
|
-
params?: RouteParamsInput<Params>;
|
|
456
|
-
query?: RouteQueryOutput<P>;
|
|
457
|
-
hash?: string;
|
|
458
|
-
} : RoutePathOptionsBase : RoutePathOptionsBase;
|
|
459
|
-
/**
|
|
460
|
-
* Conditional args: require options when the route has params.
|
|
461
|
-
*/
|
|
462
|
-
type RoutePathArgs<P extends string = string> = P extends keyof AnalogRouteTable ? AnalogRouteTable[P] extends {
|
|
463
|
-
params: infer Params;
|
|
464
|
-
} ? Params extends Record<string, never> ? [options?: RoutePathOptions<P>] : HasRequiredRouteParams<Params> extends true ? [options: RoutePathOptions<P>] : [options?: RoutePathOptions<P>] : [options?: RoutePathOptionsBase] : [options?: RoutePathOptionsBase];
|
|
465
|
-
/**
|
|
466
|
-
* Result of `toRoute()` — contains properties that map directly
|
|
467
|
-
* to Angular's `[routerLink]`, `[queryParams]`, and `[fragment]` inputs.
|
|
468
|
-
*/
|
|
469
|
-
interface RouteLinkResult {
|
|
470
|
-
path: string[];
|
|
471
|
-
queryParams: Record<string, string | string[]> | null;
|
|
472
|
-
fragment: string | undefined;
|
|
473
|
-
}
|
|
474
|
-
/**
|
|
475
|
-
* Builds a typed route link object from a route path pattern and options.
|
|
476
|
-
*
|
|
477
|
-
* The returned object separates path, query params, and fragment for
|
|
478
|
-
* direct use with Angular's routerLink directive inputs.
|
|
479
|
-
*
|
|
480
|
-
* @example
|
|
481
|
-
* toRoute('/about')
|
|
482
|
-
* // → { path: ['/', 'about'], queryParams: null, fragment: undefined }
|
|
483
|
-
*
|
|
484
|
-
* toRoute('/users/[id]', { params: { id: '42' } })
|
|
485
|
-
* // → { path: ['/', 'users', '42'], queryParams: null, fragment: undefined }
|
|
486
|
-
*
|
|
487
|
-
* toRoute('/users/[id]', { params: { id: '42' }, query: { tab: 'settings' }, hash: 'bio' })
|
|
488
|
-
* // → { path: ['/', 'users', '42'], queryParams: { tab: 'settings' }, fragment: 'bio' }
|
|
489
|
-
*
|
|
490
|
-
* @example Template usage
|
|
491
|
-
* Compute the link in the component:
|
|
492
|
-
* ```ts
|
|
493
|
-
* readonly link = toRoute('/users/[id]', { params: { id: '42' } });
|
|
494
|
-
* ```
|
|
495
|
-
*
|
|
496
|
-
* ```html
|
|
497
|
-
* <a [routerLink]="link.path" [queryParams]="link.queryParams" [fragment]="link.fragment">
|
|
498
|
-
* ```
|
|
499
|
-
*/
|
|
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
616
|
type LinkToDestination = { [P in AnalogRoutePath]: {
|
|
509
617
|
path: P;
|
|
510
618
|
} & RoutePathOptions<P>; }[AnalogRoutePath];
|
|
511
619
|
type StaticRoutePath = { [P in AnalogRoutePath]: RouteParamsOutput<P> extends Record<string, never> ? P : never; }[AnalogRoutePath];
|
|
512
|
-
|
|
513
|
-
|
|
620
|
+
type ScopedDestination<From extends AnalogRoutePath> = { [T in ScopedRouteTarget<From>]: {
|
|
621
|
+
path: T;
|
|
622
|
+
} & ScopedRoutePathOptions<From, ResolveRoutePath<From, T>>; }[ScopedRouteTarget<From>];
|
|
623
|
+
type ScopedStaticTarget<From extends AnalogRoutePath> = { [T in ScopedRouteTarget<From>]: [] extends ScopedRoutePathArgs<From, T> ? T : never; }[ScopedRouteTarget<From>];
|
|
624
|
+
/** Destinations accepted by `[linkTo]`, relative to `From` when provided. */
|
|
625
|
+
type LinkToInput<From = undefined> = (unknown extends From ? StaticRoutePath | LinkToDestination : From extends AnalogRoutePath ? ScopedStaticTarget<From> | ScopedDestination<From> : StaticRoutePath | LinkToDestination) | null | undefined;
|
|
626
|
+
export declare class LinkTo<From = undefined> implements OnChanges, OnDestroy {
|
|
627
|
+
readonly linkTo: InputSignal<LinkToInput<From>>;
|
|
628
|
+
/** The current route's path. Enables relative destinations and param inheritance. */
|
|
629
|
+
readonly from: InputSignal<(From & AnalogRoutePath) | undefined>;
|
|
514
630
|
private readonly routerLink;
|
|
631
|
+
private readonly route;
|
|
632
|
+
private currentParams;
|
|
633
|
+
private paramsFrom?;
|
|
634
|
+
private paramsSubscription?;
|
|
515
635
|
ngOnChanges(): void;
|
|
516
|
-
|
|
517
|
-
|
|
636
|
+
ngOnDestroy(): void;
|
|
637
|
+
private update;
|
|
638
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LinkTo<any>, never>;
|
|
639
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<LinkTo<any>, "[linkTo]", never, {
|
|
518
640
|
"linkTo": {
|
|
519
641
|
"alias": "linkTo";
|
|
520
642
|
"required": true;
|
|
521
643
|
"isSignal": true;
|
|
522
644
|
};
|
|
645
|
+
"from": {
|
|
646
|
+
"alias": "from";
|
|
647
|
+
"required": false;
|
|
648
|
+
"isSignal": true;
|
|
649
|
+
};
|
|
523
650
|
}, {}, never, never, true, [{
|
|
524
651
|
directive: typeof i1.RouterLink;
|
|
525
652
|
inputs: {
|
|
@@ -533,10 +660,18 @@ export declare class LinkTo implements OnChanges {
|
|
|
533
660
|
outputs: {};
|
|
534
661
|
}]>;
|
|
535
662
|
}
|
|
536
|
-
|
|
663
|
+
/** Angular navigation extras; `query` and `hash` replace `queryParams` and `fragment`. */
|
|
664
|
+
type NavigateExtras = NavigationBehaviorOptions & Pick<UrlCreationOptions, 'queryParamsHandling' | 'preserveFragment'>;
|
|
665
|
+
type WithExtrasArgs<Args extends [options?: unknown]> = [] extends Args ? [extras: NavigateExtras] | [options: Args[0] | undefined, extras: NavigateExtras] : [options: Args[0], extras: NavigateExtras];
|
|
537
666
|
type TypedNavigate = {
|
|
538
667
|
<P extends AnalogRoutePath>(path: P, ...args: RoutePathArgs<P>): Promise<boolean>;
|
|
539
|
-
<P extends AnalogRoutePath>(path: P, ...args:
|
|
668
|
+
<P extends AnalogRoutePath>(path: P, ...args: WithExtrasArgs<RoutePathArgs<P>>): Promise<boolean>;
|
|
669
|
+
};
|
|
670
|
+
type WithUpdaters<From extends string, O> = { [K in keyof O]: K extends 'params' ? O[K] | ((prev: RouteParamsOutput<From>) => Exclude<O[K], undefined>) : K extends 'query' ? O[K] | ((prev: RouteQueryOutput<From>) => Exclude<O[K], undefined>) : O[K]; };
|
|
671
|
+
type ScopedNavigateArgs<From extends string, T extends string> = WithUpdaters<From, ScopedRoutePathOptions<From, ResolveRoutePath<From, T>>> extends (infer O) ? Record<never, never> extends O ? [options?: O] : [options: O] : never;
|
|
672
|
+
type ScopedNavigate<From extends AnalogRoutePath> = {
|
|
673
|
+
<T extends ScopedRouteTarget<From>>(target: T, ...args: ScopedNavigateArgs<From, T>): Promise<boolean>;
|
|
674
|
+
<T extends ScopedRouteTarget<From>>(target: T, ...args: WithExtrasArgs<ScopedNavigateArgs<From, T>>): Promise<boolean>;
|
|
540
675
|
};
|
|
541
676
|
/**
|
|
542
677
|
* Injects a typed navigate function.
|
|
@@ -550,15 +685,57 @@ type TypedNavigate = {
|
|
|
550
685
|
*
|
|
551
686
|
* // With navigation extras
|
|
552
687
|
* navigate('/users/[id]', { params: { id: '42' } }, { replaceUrl: true });
|
|
688
|
+
* navigate('/search', { query: { page: 2 } }, { queryParamsHandling: 'merge' });
|
|
553
689
|
* ```
|
|
554
690
|
*/
|
|
555
691
|
export declare function injectNavigate(): TypedNavigate;
|
|
556
|
-
/**
|
|
557
|
-
|
|
692
|
+
/**
|
|
693
|
+
* Injects a navigate function scoped to the current route, `from`.
|
|
694
|
+
*
|
|
695
|
+
* Targets may be relative (`.`, `./child`, `..`, `../sibling`). Params in the
|
|
696
|
+
* leading segments the target shares with `from` default to current values.
|
|
697
|
+
* `params` and `query` may be functions of the current values.
|
|
698
|
+
*
|
|
699
|
+
* @example
|
|
700
|
+
* ```ts
|
|
701
|
+
* // In the component for /users/[id]
|
|
702
|
+
* const navigate = injectNavigate('/users/[id]');
|
|
703
|
+
*
|
|
704
|
+
* navigate('./posts'); // /users/42/posts
|
|
705
|
+
* navigate('.', { params: { id: 43 } }); // /users/43
|
|
706
|
+
* navigate('..'); // /users
|
|
707
|
+
* navigate('.', { params: (prev) => ({ id: Number(prev.id) + 1 }) });
|
|
708
|
+
* ```
|
|
709
|
+
*/
|
|
710
|
+
export declare function injectNavigate<From extends AnalogRoutePath>(from: From, options?: {
|
|
558
711
|
injector?: Injector;
|
|
559
|
-
}):
|
|
560
|
-
/**
|
|
561
|
-
|
|
712
|
+
}): ScopedNavigate<From>;
|
|
713
|
+
/** Internal: params for `route` and its ancestors, with catch-alls as arrays. */
|
|
714
|
+
declare function observeRouteParams(route: ActivatedRoute, routePath: string): Observable<Record<string, unknown>>;
|
|
715
|
+
type InjectOptions = {
|
|
562
716
|
injector?: Injector;
|
|
563
|
-
}
|
|
564
|
-
|
|
717
|
+
};
|
|
718
|
+
/** Read raw route params; catch-all segments are returned as arrays. */
|
|
719
|
+
export declare function injectParams<P extends AnalogRoutePath>(from: P, options?: InjectOptions): Signal<RouteParamsOutput<P>>;
|
|
720
|
+
/** Read untyped route params. Catch-all segments require a route path. */
|
|
721
|
+
export declare function injectParams(options?: InjectOptions): Signal<Record<string, string | undefined>>;
|
|
722
|
+
/** Read raw query params as a signal. No schema coercion is performed. */
|
|
723
|
+
export declare function injectQuery<P extends AnalogRoutePath>(from: P, options?: InjectOptions): Signal<RouteQueryOutput<P>>;
|
|
724
|
+
/** Read raw query params as a signal. */
|
|
725
|
+
export declare function injectQuery(options?: InjectOptions): Signal<Record<string, string | string[] | undefined>>;
|
|
726
|
+
/**
|
|
727
|
+
* Read route data as a signal: static `routeMeta.data` and `routeMeta.resolve`
|
|
728
|
+
* results from the page and its layouts, and the page's server `load` result
|
|
729
|
+
* under `load`.
|
|
730
|
+
*/
|
|
731
|
+
export declare function injectRouteData<P extends AnalogRoutePath>(from: P, options?: InjectOptions): Signal<RouteDataOutput<P>>;
|
|
732
|
+
/** Read untyped route data as a signal. */
|
|
733
|
+
export declare function injectRouteData(options?: InjectOptions): Signal<Record<string, unknown>>;
|
|
734
|
+
/**
|
|
735
|
+
* Access route resources: returns resources defined on the route and its
|
|
736
|
+
* ancestor layouts via `routeMeta.resources`. Requires `withRouterResources()`.
|
|
737
|
+
*/
|
|
738
|
+
export declare function injectResources<P extends AnalogRoutePath>(from: P, options?: InjectOptions): RouteResourcesOutput<P>;
|
|
739
|
+
/** Access untyped route resources. */
|
|
740
|
+
export declare function injectResources(options?: InjectOptions): RouteResourcesOutput<string>;
|
|
741
|
+
export { type AnalogRoutePath, type AnalogRouteTable, type Files, type FormActionState, type LinkToInput, type RouteDataOutput, type RouteExport, type RouteLoadOutput, type RoutePathOptions, type RouteResourcesOutput, type ServerFn, type ServerFnConfig, type ServerFnContext, type ServerFnDef, type ServerFnDispatcher, type ServerFnHandler, type ServerFnMethod, type ServerFnRefConfig, type StandardSchemaV1, type ValidationFieldErrors, injectResources as injectRouteResources };
|