@benjavicente/angular-router-experimental 1.142.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +15 -0
- package/dist/fesm2022/tanstack-angular-router-experimental-experimental.mjs +920 -0
- package/dist/fesm2022/tanstack-angular-router-experimental.mjs +4131 -0
- package/dist/types/tanstack-angular-router-experimental-experimental.d.ts +110 -0
- package/dist/types/tanstack-angular-router-experimental.d.ts +733 -0
- package/experimental/injectRouteErrorHandler.ts +51 -0
- package/experimental/public_api.ts +8 -0
- package/package.json +98 -0
- package/src/DefaultNotFound.ts +9 -0
- package/src/Link.ts +352 -0
- package/src/Match.ts +338 -0
- package/src/Matches.ts +37 -0
- package/src/RouterProvider.ts +162 -0
- package/src/document/build-match-managed-document.ts +308 -0
- package/src/document/document-dehydration.ts +27 -0
- package/src/document/document-equality.ts +29 -0
- package/src/document/document-router-token.ts +6 -0
- package/src/document/index.ts +33 -0
- package/src/document/install-unified-document-sync.ts +108 -0
- package/src/document/managed-document-types.ts +36 -0
- package/src/document/managed-dom.ts +307 -0
- package/src/document/provide-tanstack-body-managed-tags.ts +78 -0
- package/src/document/provide-tanstack-document-title.ts +59 -0
- package/src/document/provide-tanstack-document.ts +62 -0
- package/src/document/provide-tanstack-head-managed-tags.ts +63 -0
- package/src/fileRoute.ts +232 -0
- package/src/index.ts +173 -0
- package/src/injectBlocker.ts +196 -0
- package/src/injectCanGoBack.ts +11 -0
- package/src/injectErrorState.ts +21 -0
- package/src/injectIntersectionObserver.ts +28 -0
- package/src/injectLoaderData.ts +49 -0
- package/src/injectLoaderDeps.ts +45 -0
- package/src/injectLocation.ts +38 -0
- package/src/injectMatch.ts +122 -0
- package/src/injectMatchRoute.ts +58 -0
- package/src/injectMatches.ts +79 -0
- package/src/injectNavigate.ts +24 -0
- package/src/injectParams.ts +71 -0
- package/src/injectRouteContext.ts +31 -0
- package/src/injectRouter.ts +17 -0
- package/src/injectRouterState.ts +53 -0
- package/src/injectSearch.ts +71 -0
- package/src/injectStore.ts +87 -0
- package/src/matchInjectorToken.ts +23 -0
- package/src/renderer/injectIsCatchingError.ts +40 -0
- package/src/renderer/injectRender.ts +69 -0
- package/src/route.ts +641 -0
- package/src/router.ts +141 -0
- package/src/routerInjectionToken.ts +24 -0
- package/src/routerStores.ts +107 -0
- package/src/ssr-scroll-restoration.ts +48 -0
- package/src/transitioner.ts +255 -0
|
@@ -0,0 +1,733 @@
|
|
|
1
|
+
import * as Angular from '@angular/core';
|
|
2
|
+
import { AnyContext } from '@benjavicente/router-core';
|
|
3
|
+
import { AnyRoute } from '@benjavicente/router-core';
|
|
4
|
+
import { AnyRouteMatch } from '@benjavicente/router-core';
|
|
5
|
+
import { AnyRouter } from '@benjavicente/router-core';
|
|
6
|
+
import { BaseRootRoute } from '@benjavicente/router-core';
|
|
7
|
+
import { BaseRoute } from '@benjavicente/router-core';
|
|
8
|
+
import { BaseRouteApi } from '@benjavicente/router-core';
|
|
9
|
+
import { BlockerFn } from '@benjavicente/history';
|
|
10
|
+
import { ConstrainLiteral } from '@benjavicente/router-core';
|
|
11
|
+
import { createBrowserHistory } from '@benjavicente/history';
|
|
12
|
+
import { CreateFileRoute } from '@benjavicente/router-core';
|
|
13
|
+
import { createHashHistory } from '@benjavicente/history';
|
|
14
|
+
import { createHistory } from '@benjavicente/history';
|
|
15
|
+
import { CreateLazyFileRoute } from '@benjavicente/router-core';
|
|
16
|
+
import { createMemoryHistory } from '@benjavicente/history';
|
|
17
|
+
import { createRouterConfig } from '@benjavicente/router-core';
|
|
18
|
+
import { CreateSignalOptions } from '@angular/core';
|
|
19
|
+
import { DeepPartial } from '@benjavicente/router-core';
|
|
20
|
+
import { EffectRef } from '@angular/core';
|
|
21
|
+
import { EnvironmentInjector } from '@angular/core';
|
|
22
|
+
import { Expand } from '@benjavicente/router-core';
|
|
23
|
+
import { FileBaseRouteOptions } from '@benjavicente/router-core';
|
|
24
|
+
import { FileRoutesByPath } from '@benjavicente/router-core';
|
|
25
|
+
import { FromPathOption } from '@benjavicente/router-core';
|
|
26
|
+
import { FullSearchSchema } from '@benjavicente/router-core';
|
|
27
|
+
import { HistoryAction } from '@benjavicente/history';
|
|
28
|
+
import { HistoryLocation } from '@benjavicente/history';
|
|
29
|
+
import { HistoryState } from '@benjavicente/history';
|
|
30
|
+
import { InjectionToken } from '@angular/core';
|
|
31
|
+
import { InputSignal } from '@angular/core';
|
|
32
|
+
import { isRedirect } from '@benjavicente/router-core';
|
|
33
|
+
import { lazyFn } from '@benjavicente/router-core';
|
|
34
|
+
import { LazyRouteOptions } from '@benjavicente/router-core';
|
|
35
|
+
import { LinkOptions } from '@benjavicente/router-core';
|
|
36
|
+
import { MakeOptionalPathParams } from '@benjavicente/router-core';
|
|
37
|
+
import { MakeOptionalSearchParams } from '@benjavicente/router-core';
|
|
38
|
+
import { MakeRouteMatch } from '@benjavicente/router-core';
|
|
39
|
+
import { MakeRouteMatchUnion } from '@benjavicente/router-core';
|
|
40
|
+
import { MaskOptions } from '@benjavicente/router-core';
|
|
41
|
+
import { MatchRouteOptions } from '@benjavicente/router-core';
|
|
42
|
+
import { NavigateOptions } from '@benjavicente/router-core';
|
|
43
|
+
import { NoInfer as NoInfer_2 } from '@benjavicente/router-core';
|
|
44
|
+
import { notFound } from '@benjavicente/router-core';
|
|
45
|
+
import { NotFoundError } from '@benjavicente/router-core';
|
|
46
|
+
import { ParsedLocation } from '@benjavicente/router-core';
|
|
47
|
+
import { ParsedPath } from '@benjavicente/history';
|
|
48
|
+
import { ParseRoute } from '@benjavicente/router-core';
|
|
49
|
+
import { Provider } from '@angular/core';
|
|
50
|
+
import { redirect } from '@benjavicente/router-core';
|
|
51
|
+
import { Register } from '@benjavicente/router-core';
|
|
52
|
+
import { RegisteredRouter } from '@benjavicente/router-core';
|
|
53
|
+
import { ResolveFullPath } from '@benjavicente/router-core';
|
|
54
|
+
import { ResolveId } from '@benjavicente/router-core';
|
|
55
|
+
import { ResolveParams } from '@benjavicente/router-core';
|
|
56
|
+
import { ResolveRoute } from '@benjavicente/router-core';
|
|
57
|
+
import { ResolveUseLoaderData } from '@benjavicente/router-core';
|
|
58
|
+
import { ResolveUseLoaderDeps } from '@benjavicente/router-core';
|
|
59
|
+
import { ResolveUseParams } from '@benjavicente/router-core';
|
|
60
|
+
import { ResolveUseSearch } from '@benjavicente/router-core';
|
|
61
|
+
import { retainSearchParams } from '@benjavicente/router-core';
|
|
62
|
+
import { RootRoute as RootRoute_2 } from '@benjavicente/router-core';
|
|
63
|
+
import { RootRouteId } from '@benjavicente/router-core';
|
|
64
|
+
import { RootRouteOptions } from '@benjavicente/router-core';
|
|
65
|
+
import { Route as Route_2 } from '@benjavicente/router-core';
|
|
66
|
+
import { RouteById } from '@benjavicente/router-core';
|
|
67
|
+
import { RouteConstraints } from '@benjavicente/router-core';
|
|
68
|
+
import { RouteIds } from '@benjavicente/router-core';
|
|
69
|
+
import { RouteMask } from '@benjavicente/router-core';
|
|
70
|
+
import { RouteOptions } from '@benjavicente/router-core';
|
|
71
|
+
import { RoutePaths } from '@benjavicente/router-core';
|
|
72
|
+
import { RouterContextOptions } from '@benjavicente/router-core';
|
|
73
|
+
import { RouterCore } from '@benjavicente/router-core';
|
|
74
|
+
import { RouterHistory } from '@benjavicente/history';
|
|
75
|
+
import { RouterManagedTag } from '@benjavicente/router-core';
|
|
76
|
+
import { RouterOptions } from '@benjavicente/router-core';
|
|
77
|
+
import { RouterState } from '@benjavicente/router-core';
|
|
78
|
+
import { RouteTypesById } from '@benjavicente/router-core';
|
|
79
|
+
import { Signal } from '@angular/core';
|
|
80
|
+
import { StrictOrFrom } from '@benjavicente/router-core';
|
|
81
|
+
import { ThrowConstraint } from '@benjavicente/router-core';
|
|
82
|
+
import { ThrowOrOptional } from '@benjavicente/router-core';
|
|
83
|
+
import { ToMaskOptions } from '@benjavicente/router-core';
|
|
84
|
+
import { ToSubOptionsProps } from '@benjavicente/router-core';
|
|
85
|
+
import { TrailingSlashOption } from '@benjavicente/router-core';
|
|
86
|
+
import { Type } from '@angular/core';
|
|
87
|
+
import { UpdatableRouteOptions } from '@benjavicente/router-core';
|
|
88
|
+
import { UseLoaderDataResult } from '@benjavicente/router-core';
|
|
89
|
+
import { UseLoaderDepsResult } from '@benjavicente/router-core';
|
|
90
|
+
import { UseNavigateResult } from '@benjavicente/router-core';
|
|
91
|
+
import { UseParamsResult } from '@benjavicente/router-core';
|
|
92
|
+
import { UseRouteContextBaseOptions } from '@benjavicente/router-core';
|
|
93
|
+
import { UseRouteContextOptions } from '@benjavicente/router-core';
|
|
94
|
+
import { UseRouteContextResult } from '@benjavicente/router-core';
|
|
95
|
+
import { UseSearchResult } from '@benjavicente/router-core';
|
|
96
|
+
import { WritableSignal } from '@angular/core';
|
|
97
|
+
|
|
98
|
+
declare interface ActiveLinkOptionProps {
|
|
99
|
+
activeProps?: ActiveLinkProps;
|
|
100
|
+
inactiveProps?: ActiveLinkProps;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
declare interface ActiveLinkProps {
|
|
104
|
+
class?: string;
|
|
105
|
+
style?: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export declare type AngularInjectFn = EnvironmentInjector['get'];
|
|
109
|
+
|
|
110
|
+
declare type AngularRouterConstructorOptions<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TDefaultStructuralSharingOption extends boolean, TRouterHistory extends RouterHistory, TDehydrated extends Record<string, any>> = Omit<RouterOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>, 'context' | 'serializationAdapters' | 'defaultSsr'> & AngularRouterContextOptions<TRouteTree>;
|
|
111
|
+
|
|
112
|
+
export declare type AngularRouterContext = {
|
|
113
|
+
inject: AngularInjectFn;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
declare type AngularRouterContextInput<TContext> = Omit<TContext, keyof AngularRouterContext> & Partial<Pick<TContext, Extract<keyof TContext, keyof AngularRouterContext>>>;
|
|
117
|
+
|
|
118
|
+
declare type AngularRouterContextOptions<TRouteTree extends AnyRoute> = {} extends Omit<InferAngularRouterContext<TRouteTree>, keyof AngularRouterContext> ? {
|
|
119
|
+
context?: AngularRouterContextInput<InferAngularRouterContext<TRouteTree>>;
|
|
120
|
+
} : {
|
|
121
|
+
context: AngularRouterContextInput<InferAngularRouterContext<TRouteTree>>;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export declare type AnyRootRoute = RootRoute<any, any, any, any, any, any, any, any, any, any>;
|
|
125
|
+
|
|
126
|
+
export { AnyRouter }
|
|
127
|
+
|
|
128
|
+
export { BlockerFn }
|
|
129
|
+
|
|
130
|
+
declare type BlockerResolver<TRouter extends AnyRouter = RegisteredRouter> = {
|
|
131
|
+
status: 'blocked';
|
|
132
|
+
current: MakeShouldBlockFnLocationUnion<TRouter>;
|
|
133
|
+
next: MakeShouldBlockFnLocationUnion<TRouter>;
|
|
134
|
+
action: HistoryAction;
|
|
135
|
+
proceed: () => void;
|
|
136
|
+
reset: () => void;
|
|
137
|
+
} | {
|
|
138
|
+
status: 'idle';
|
|
139
|
+
current: undefined;
|
|
140
|
+
next: undefined;
|
|
141
|
+
action: undefined;
|
|
142
|
+
proceed: undefined;
|
|
143
|
+
reset: undefined;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Full managed document for a single snapshot: match-derived tags plus one
|
|
148
|
+
* `takeBufferedScripts()` read (for tests and tooling). Prefer composing
|
|
149
|
+
* `buildMatchManagedDocumentContent` + a one-time dehydration prefix in SSR, as
|
|
150
|
+
* the body managed-tags provider does.
|
|
151
|
+
*/
|
|
152
|
+
export declare function buildManagedDocumentContent(router: AnyRouter): ManagedDocumentContent;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Document content from the current route tree only (meta, links, route body scripts, etc.).
|
|
156
|
+
* Does not call `takeBufferedScripts` — mirrors the route-derived arrays passed into
|
|
157
|
+
* `renderScripts` before the server-buffered script is unshifted in React/Solid/Vue.
|
|
158
|
+
*/
|
|
159
|
+
export declare function buildMatchManagedDocumentContent(router: AnyRouter): ManagedDocumentContent;
|
|
160
|
+
|
|
161
|
+
export { createBrowserHistory }
|
|
162
|
+
|
|
163
|
+
export { CreateFileRoute }
|
|
164
|
+
|
|
165
|
+
export declare function createFileRoute<TFilePath extends keyof FileRoutesByPath, TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'], TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'], TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'], TFullPath extends RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath']>(path?: TFilePath): InternalFileRouteFactory<TFilePath, TParentRoute, TId, TPath, TFullPath>['createRoute'];
|
|
166
|
+
|
|
167
|
+
export { createHashHistory }
|
|
168
|
+
|
|
169
|
+
export { createHistory }
|
|
170
|
+
|
|
171
|
+
export { CreateLazyFileRoute }
|
|
172
|
+
|
|
173
|
+
export declare function createLazyFileRoute<TFilePath extends keyof FileRoutesByPath, TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute']>(id: TFilePath): (opts: LazyRouteOptions) => LazyRoute<TRoute>;
|
|
174
|
+
|
|
175
|
+
export declare function createLazyRoute<TRouter extends AnyRouter = RegisteredRouter, TId extends string = string, TRoute extends AnyRoute = RouteById<TRouter['routeTree'], TId>>(id: ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>): (opts: LazyRouteOptions) => LazyRoute<TRoute>;
|
|
176
|
+
|
|
177
|
+
export { createMemoryHistory }
|
|
178
|
+
|
|
179
|
+
export declare function createRootRoute<TRegister = Register, TSearchValidator = undefined, TRouterContext = {}, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TSSR = unknown, THandlers = undefined>(options?: RootRouteOptions<TRegister, TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TSSR, THandlers>): RootRoute<TRegister, TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, unknown, unknown, TSSR, THandlers>;
|
|
180
|
+
|
|
181
|
+
export declare function createRootRouteWithContext<TRouterContext extends {}>(): <TRegister = Register, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TSearchValidator = undefined, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TSSR = unknown, THandlers = undefined>(options?: RootRouteOptions<TRegister, TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TSSR, THandlers>) => RootRoute<TRegister, TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, unknown, unknown, TSSR, THandlers>;
|
|
182
|
+
|
|
183
|
+
export declare function createRoute<TRegister = unknown, TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute, TPath extends RouteConstraints['TPath'] = '/', TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, TPath>, TCustomId extends RouteConstraints['TCustomId'] = string, TId extends RouteConstraints['TId'] = ResolveId<TParentRoute, TCustomId, TPath>, TSearchValidator = undefined, TParams = ResolveParams<TPath>, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TChildren = unknown, TSSR = unknown, THandlers = undefined>(options: RouteOptions<TRegister, TParentRoute, TId, TCustomId, TFullPath, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, AnyContext, TRouteContextFn, TBeforeLoadFn, TSSR, THandlers>): Route<TRegister, TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, AnyContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, unknown, TSSR, THandlers>;
|
|
184
|
+
|
|
185
|
+
export declare function createRouteMask<TRouteTree extends AnyRoute, TFrom extends string, TTo extends string>(opts: {
|
|
186
|
+
routeTree: TRouteTree;
|
|
187
|
+
} & ToMaskOptions<RouterCore<TRouteTree, 'never', false>, TFrom, TTo>): RouteMask<TRouteTree>;
|
|
188
|
+
|
|
189
|
+
export declare const createRouter: CreateRouterFn;
|
|
190
|
+
|
|
191
|
+
export { createRouterConfig }
|
|
192
|
+
|
|
193
|
+
declare type CreateRouterFn = <TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption = 'never', TDefaultStructuralSharingOption extends boolean = false, TRouterHistory extends RouterHistory = RouterHistory, TDehydrated extends Record<string, any> = Record<string, any>>(options: undefined extends number ? 'strictNullChecks must be enabled in tsconfig.json' : AngularRouterConstructorOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>) => Router<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>;
|
|
194
|
+
|
|
195
|
+
export declare type ErrorRouteComponent = () => Angular.Type<unknown>;
|
|
196
|
+
|
|
197
|
+
export { FileRoutesByPath }
|
|
198
|
+
|
|
199
|
+
export declare function getRouteApi<const TId, TRouter extends AnyRouter = RegisteredRouter>(id: ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>): RouteApi<TId, TRouter>;
|
|
200
|
+
|
|
201
|
+
export { HistoryLocation }
|
|
202
|
+
|
|
203
|
+
export { HistoryState }
|
|
204
|
+
|
|
205
|
+
declare type InferAngularRouterContext<TRouteTree extends AnyRoute> = TRouteTree['types']['routerContext'];
|
|
206
|
+
|
|
207
|
+
export declare function injectBlocker<TRouter extends AnyRouter = RegisteredRouter, TWithResolver extends boolean = boolean>(opts: InjectBlockerOpts<TRouter, TWithResolver>): TWithResolver extends true ? Angular.Signal<BlockerResolver<TRouter>> : void;
|
|
208
|
+
|
|
209
|
+
export declare type InjectBlockerOpts<TRouter extends AnyRouter = RegisteredRouter, TWithResolver extends boolean = boolean> = {
|
|
210
|
+
shouldBlockFn: ShouldBlockFn<TRouter>;
|
|
211
|
+
enableBeforeUnload?: boolean | (() => boolean);
|
|
212
|
+
disabled?: boolean | (() => boolean);
|
|
213
|
+
withResolver?: TWithResolver;
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
export declare function injectCanGoBack(): Signal<boolean>;
|
|
217
|
+
|
|
218
|
+
export declare function injectChildMatches<TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown>(opts?: InjectMatchesBaseOptions<TRouter, TSelected>): Angular.Signal<InjectMatchesResult<TRouter, TSelected>>;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Injects the error state to the error componenet.
|
|
222
|
+
*/
|
|
223
|
+
export declare function injectErrorState(): {
|
|
224
|
+
error: Error;
|
|
225
|
+
reset: () => void;
|
|
226
|
+
info: {
|
|
227
|
+
componentStack: string;
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
export declare function injectLoaderData<TRouter extends AnyRouter = RegisteredRouter, const TFrom extends string | undefined = undefined, TStrict extends boolean = true, TSelected = unknown>(opts: InjectLoaderDataOptions<TRouter, TFrom, TStrict, TSelected>): Angular.Signal<UseLoaderDataResult<TRouter, TFrom, TStrict, TSelected>>;
|
|
232
|
+
|
|
233
|
+
export declare interface InjectLoaderDataBaseOptions<TRouter extends AnyRouter, TFrom, TStrict extends boolean, TSelected> {
|
|
234
|
+
select?: (match: ResolveUseLoaderData<TRouter, TFrom, TStrict>) => TSelected;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export declare type InjectLoaderDataOptions<TRouter extends AnyRouter, TFrom extends string | undefined, TStrict extends boolean, TSelected> = StrictOrFrom<TRouter, TFrom, TStrict> & InjectLoaderDataBaseOptions<TRouter, TFrom, TStrict, TSelected>;
|
|
238
|
+
|
|
239
|
+
export declare type InjectLoaderDataRoute<out TFrom> = <TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown>(opts?: InjectLoaderDataBaseOptions<TRouter, TFrom, true, TSelected>) => Angular.Signal<UseLoaderDataResult<TRouter, TFrom, true, TSelected>>;
|
|
240
|
+
|
|
241
|
+
export declare function injectLoaderDeps<TRouter extends AnyRouter = RegisteredRouter, const TFrom extends string | undefined = undefined, TSelected = unknown>(opts: InjectLoaderDepsOptions<TRouter, TFrom, TSelected>): Angular.Signal<UseLoaderDepsResult<TRouter, TFrom, TSelected>>;
|
|
242
|
+
|
|
243
|
+
export declare interface InjectLoaderDepsBaseOptions<TRouter extends AnyRouter, TFrom, TSelected> {
|
|
244
|
+
select?: (deps: ResolveUseLoaderDeps<TRouter, TFrom>) => TSelected;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export declare type InjectLoaderDepsOptions<TRouter extends AnyRouter, TFrom extends string | undefined, TSelected> = StrictOrFrom<TRouter, TFrom> & InjectLoaderDepsBaseOptions<TRouter, TFrom, TSelected>;
|
|
248
|
+
|
|
249
|
+
export declare type InjectLoaderDepsRoute<out TFrom> = <TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown>(opts?: InjectLoaderDepsBaseOptions<TRouter, TFrom, TSelected>) => Angular.Signal<UseLoaderDepsResult<TRouter, TFrom, TSelected>>;
|
|
250
|
+
|
|
251
|
+
export declare function injectLocation<TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown>(opts?: InjectLocationOptions<TRouter, TSelected>): Angular.Signal<InjectLocationResult<TRouter, TSelected>>;
|
|
252
|
+
|
|
253
|
+
export declare interface InjectLocationOptions<TRouter extends AnyRouter, TSelected> {
|
|
254
|
+
select?: (location: RouterState<TRouter['routeTree']>['location']) => TSelected;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export declare type InjectLocationResult<TRouter extends AnyRouter, TSelected> = unknown extends TSelected ? RouterState<TRouter['routeTree']>['location'] : TSelected;
|
|
258
|
+
|
|
259
|
+
export declare function injectMatch<TRouter extends AnyRouter = RegisteredRouter, const TFrom extends string | undefined = undefined, TStrict extends boolean = true, TThrow extends boolean = true, TSelected = unknown>(opts: InjectMatchOptions<TRouter, TFrom, TStrict, ThrowConstraint<TStrict, TThrow>, TSelected>): Angular.Signal<ThrowOrOptional<InjectMatchResult<TRouter, TFrom, TStrict, TSelected>, TThrow>>;
|
|
260
|
+
|
|
261
|
+
export declare interface InjectMatchBaseOptions<TRouter extends AnyRouter, TFrom, TStrict extends boolean, TThrow extends boolean, TSelected> {
|
|
262
|
+
select?: (match: MakeRouteMatch<TRouter['routeTree'], TFrom, TStrict>) => TSelected;
|
|
263
|
+
shouldThrow?: TThrow;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export declare function injectMatches<TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown>(opts?: InjectMatchesBaseOptions<TRouter, TSelected>): Angular.Signal<InjectMatchesResult<TRouter, TSelected>>;
|
|
267
|
+
|
|
268
|
+
export declare interface InjectMatchesBaseOptions<TRouter extends AnyRouter, TSelected> {
|
|
269
|
+
select?: (matches: Array<MakeRouteMatchUnion<TRouter>>) => TSelected;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export declare type InjectMatchesResult<TRouter extends AnyRouter, TSelected> = unknown extends TSelected ? Array<MakeRouteMatchUnion<TRouter>> : TSelected;
|
|
273
|
+
|
|
274
|
+
export declare type InjectMatchOptions<TRouter extends AnyRouter, TFrom, TStrict extends boolean, TThrow extends boolean, TSelected> = StrictOrFrom<TRouter, TFrom, TStrict> & InjectMatchBaseOptions<TRouter, TFrom, TStrict, TThrow, TSelected>;
|
|
275
|
+
|
|
276
|
+
export declare type InjectMatchResult<TRouter extends AnyRouter, TFrom, TStrict extends boolean, TSelected> = unknown extends TSelected ? TStrict extends true ? MakeRouteMatch<TRouter['routeTree'], TFrom, TStrict> : MakeRouteMatchUnion<TRouter> : TSelected;
|
|
277
|
+
|
|
278
|
+
export declare type InjectMatchRoute<out TFrom> = <TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown>(opts?: InjectMatchBaseOptions<TRouter, TFrom, true, true, TSelected>) => Angular.Signal<InjectMatchResult<TRouter, TFrom, true, TSelected>>;
|
|
279
|
+
|
|
280
|
+
export declare function injectMatchRoute<TRouter extends AnyRouter = RegisteredRouter>(): <const TFrom extends string = string, const TTo extends string | undefined = undefined, const TMaskFrom extends string = TFrom, const TMaskTo extends string = "">(opts: InjectMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>) => Angular.Signal<false | Expand<ResolveRoute<TRouter, TFrom, NoInfer_2<TTo>>["types"]["allParams"]>>;
|
|
281
|
+
|
|
282
|
+
export declare type InjectMatchRouteOptions<TRouter extends AnyRouter = RegisteredRouter, TFrom extends string = string, TTo extends string | undefined = undefined, TMaskFrom extends string = TFrom, TMaskTo extends string = ''> = ToSubOptionsProps<TRouter, TFrom, TTo> & DeepPartial<MakeOptionalSearchParams<TRouter, TFrom, TTo>> & DeepPartial<MakeOptionalPathParams<TRouter, TFrom, TTo>> & MaskOptions<TRouter, TMaskFrom, TMaskTo> & MatchRouteOptions;
|
|
283
|
+
|
|
284
|
+
export declare function injectNavigate<TRouter extends AnyRouter = RegisteredRouter, TDefaultFrom extends string = string>(_defaultOpts?: {
|
|
285
|
+
from?: FromPathOption<TRouter, TDefaultFrom>;
|
|
286
|
+
}): UseNavigateResult<TDefaultFrom>;
|
|
287
|
+
|
|
288
|
+
export declare function injectParams<TRouter extends AnyRouter = RegisteredRouter, const TFrom extends string | undefined = undefined, TStrict extends boolean = true, TThrow extends boolean = true, TSelected = unknown>(opts: InjectParamsOptions<TRouter, TFrom, TStrict, ThrowConstraint<TStrict, TThrow>, TSelected>): Angular.Signal<ThrowOrOptional<UseParamsResult<TRouter, TFrom, true, TSelected>, TThrow>>;
|
|
289
|
+
|
|
290
|
+
export declare interface InjectParamsBaseOptions<TRouter extends AnyRouter, TFrom, TStrict extends boolean, TThrow extends boolean, TSelected> {
|
|
291
|
+
select?: (params: ResolveUseParams<TRouter, TFrom, TStrict>) => TSelected;
|
|
292
|
+
shouldThrow?: TThrow;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export declare type InjectParamsOptions<TRouter extends AnyRouter, TFrom extends string | undefined, TStrict extends boolean, TThrow extends boolean, TSelected> = StrictOrFrom<TRouter, TFrom, TStrict> & InjectParamsBaseOptions<TRouter, TFrom, TStrict, TThrow, TSelected>;
|
|
296
|
+
|
|
297
|
+
export declare type InjectParamsRoute<out TFrom> = <TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown>(opts?: InjectParamsBaseOptions<TRouter, TFrom, true, true, TSelected>) => Angular.Signal<UseParamsResult<TRouter, TFrom, true, TSelected>>;
|
|
298
|
+
|
|
299
|
+
export declare function injectParentMatches<TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown>(opts?: InjectMatchesBaseOptions<TRouter, TSelected>): Angular.Signal<InjectMatchesResult<TRouter, TSelected>>;
|
|
300
|
+
|
|
301
|
+
declare function injectRender(renderValueFn: () => RenderValue): void;
|
|
302
|
+
|
|
303
|
+
export declare function injectRouteContext<TRouter extends AnyRouter = RegisteredRouter, const TFrom extends string | undefined = undefined, TStrict extends boolean = true, TSelected = unknown>(opts: UseRouteContextOptions<TRouter, TFrom, TStrict, TSelected>): Angular.Signal<UseRouteContextResult<TRouter, TFrom, TStrict, TSelected>>;
|
|
304
|
+
|
|
305
|
+
export declare type InjectRouteContextRoute<out TFrom> = <TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown>(opts?: UseRouteContextBaseOptions<TRouter, TFrom, true, TSelected>) => Angular.Signal<UseRouteContextResult<TRouter, TFrom, true, TSelected>>;
|
|
306
|
+
|
|
307
|
+
export declare function injectRouter<TRouter extends AnyRouter = RegisteredRouter>(opts?: {
|
|
308
|
+
warn?: boolean;
|
|
309
|
+
}): TRouter;
|
|
310
|
+
|
|
311
|
+
export declare function injectRouterState<TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown>(opts?: InjectRouterStateOptions<TRouter, TSelected>): Angular.Signal<InjectRouterStateResult<TRouter, TSelected>>;
|
|
312
|
+
|
|
313
|
+
export declare type InjectRouterStateOptions<TRouter extends AnyRouter, TSelected> = {
|
|
314
|
+
router?: TRouter;
|
|
315
|
+
select?: (state: RouterState<TRouter['routeTree']>) => TSelected;
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
export declare type InjectRouterStateResult<TRouter extends AnyRouter, TSelected> = unknown extends TSelected ? RouterState<TRouter['routeTree']> : TSelected;
|
|
319
|
+
|
|
320
|
+
export declare function injectSearch<TRouter extends AnyRouter = RegisteredRouter, const TFrom extends string | undefined = undefined, TStrict extends boolean = true, TThrow extends boolean = true, TSelected = unknown>(opts: InjectSearchOptions<TRouter, TFrom, TStrict, ThrowConstraint<TStrict, TThrow>, TSelected>): Angular.Signal<ThrowOrOptional<UseSearchResult<TRouter, TFrom, TStrict, TSelected>, TThrow>>;
|
|
321
|
+
|
|
322
|
+
export declare interface InjectSearchBaseOptions<TRouter extends AnyRouter, TFrom, TStrict extends boolean, TThrow extends boolean, TSelected> {
|
|
323
|
+
select?: (state: ResolveUseSearch<TRouter, TFrom, TStrict>) => TSelected;
|
|
324
|
+
shouldThrow?: TThrow;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
export declare type InjectSearchOptions<TRouter extends AnyRouter, TFrom, TStrict extends boolean, TThrow extends boolean, TSelected> = StrictOrFrom<TRouter, TFrom, TStrict> & InjectSearchBaseOptions<TRouter, TFrom, TStrict, TThrow, TSelected>;
|
|
328
|
+
|
|
329
|
+
export declare type InjectSearchRoute<out TFrom> = <TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown>(opts?: InjectSearchBaseOptions<TRouter, TFrom, true, true, TSelected>) => Angular.Signal<UseSearchResult<TRouter, TFrom, true, TSelected>>;
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Injects the same inline scroll-restore script Solid/React emit on SSR
|
|
333
|
+
* (`ScrollRestoration` + `ScriptOnce`), so hydration can align window scroll
|
|
334
|
+
* with sessionStorage before the client router runs.
|
|
335
|
+
*/
|
|
336
|
+
export declare function injectSsrScrollRestorationScript(): void;
|
|
337
|
+
|
|
338
|
+
export declare function injectStore<TState, TSelected = NoInfer<TState>>(storeOrStoreSignal: ReadableStore<TState> | (() => ReadableStore<TState>), selector?: (state: NoInfer<TState>) => TSelected, options?: CreateSignalOptions<TSelected>): Signal<TSelected>;
|
|
339
|
+
|
|
340
|
+
declare class InternalFileRouteFactory<TFilePath extends keyof FileRoutesByPath, TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'], TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'], TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'], TFullPath extends RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath']> {
|
|
341
|
+
createRoute: <TRegister = Register, TSearchValidator = undefined, TParams = ResolveParams<TPath>, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TChildren = unknown, TSSR = unknown, TMiddlewares = unknown, THandlers = undefined>(options?: FileBaseRouteOptions<TRegister, TParentRoute, TId, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, AnyContext, TRouteContextFn, TBeforeLoadFn, AnyContext, TSSR, TMiddlewares, THandlers> & UpdatableRouteOptions<TParentRoute, TId, TFullPath, TParams, TSearchValidator, TLoaderFn, TLoaderDeps, AnyContext, TRouteContextFn, TBeforeLoadFn>) => Route_2<TRegister, TParentRoute, TPath, TFullPath, TFilePath, TId, TSearchValidator, TParams, AnyContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, unknown, TSSR, TMiddlewares, THandlers>;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
export { isRedirect }
|
|
345
|
+
|
|
346
|
+
export { lazyFn }
|
|
347
|
+
|
|
348
|
+
export declare class LazyRoute<TRoute extends AnyRoute> {
|
|
349
|
+
options: {
|
|
350
|
+
id: string;
|
|
351
|
+
} & LazyRouteOptions;
|
|
352
|
+
constructor(opts: {
|
|
353
|
+
id: string;
|
|
354
|
+
} & LazyRouteOptions);
|
|
355
|
+
injectMatch: InjectMatchRoute<TRoute['id']>;
|
|
356
|
+
injectRouteContext: InjectRouteContextRoute<TRoute['id']>;
|
|
357
|
+
injectSearch: InjectSearchRoute<TRoute['id']>;
|
|
358
|
+
injectParams: InjectParamsRoute<TRoute['id']>;
|
|
359
|
+
injectLoaderDeps: InjectLoaderDepsRoute<TRoute['id']>;
|
|
360
|
+
injectLoaderData: InjectLoaderDataRoute<TRoute['id']>;
|
|
361
|
+
injectNavigate: () => UseNavigateResult<TRoute["fullPath"]>;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
export declare class Link<TRouter extends AnyRouter = RegisteredRouter, TFrom extends RoutePaths<TRouter['routeTree']> | string = string, TTo extends string | undefined = '.', TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom, TMaskTo extends string = '.'> {
|
|
365
|
+
passiveEvents: void;
|
|
366
|
+
options: InputSignal<LinkInputOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>>;
|
|
367
|
+
protected router: AnyRouter;
|
|
368
|
+
protected isTransitioning: WritableSignal<boolean>;
|
|
369
|
+
protected from: Signal<(FromPathOption<TRouter, TFrom> & {}) | undefined>;
|
|
370
|
+
protected disabled: Signal<boolean>;
|
|
371
|
+
protected target: Signal<string | undefined>;
|
|
372
|
+
protected _options: Signal<LinkInputOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>>;
|
|
373
|
+
protected nextLocation: Signal<ParsedLocation< {}>>;
|
|
374
|
+
protected hrefOption: Signal< {
|
|
375
|
+
href: any;
|
|
376
|
+
external: boolean;
|
|
377
|
+
} | undefined>;
|
|
378
|
+
protected externalLink: Signal<any>;
|
|
379
|
+
protected preload: Signal<false | "intent" | "viewport" | "render" | undefined>;
|
|
380
|
+
protected preloadDelay: Signal<number>;
|
|
381
|
+
protected location: Signal<ParsedLocation<FullSearchSchema<TRouter["routeTree"]>>>;
|
|
382
|
+
protected isActiveProps: Signal<ActiveLinkProps | undefined>;
|
|
383
|
+
protected isActive: Signal<boolean>;
|
|
384
|
+
protected doPreload: () => void;
|
|
385
|
+
protected preloadViewportIoCallback: (entry: IntersectionObserverEntry | undefined) => void;
|
|
386
|
+
private viewportPreloader;
|
|
387
|
+
private hasRenderFetched;
|
|
388
|
+
private rendererPreloader;
|
|
389
|
+
protected handleClick: (event: MouseEvent) => void;
|
|
390
|
+
protected handleFocus: () => void;
|
|
391
|
+
protected handleTouchStart: () => void;
|
|
392
|
+
protected handleEnter: (event: MouseEvent) => void;
|
|
393
|
+
protected handleLeave: (event: MouseEvent) => void;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
export declare type LinkInputOptions<TRouter extends AnyRouter = RegisteredRouter, TFrom extends RoutePaths<TRouter['routeTree']> | string = string, TTo extends string | undefined = '.', TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom, TMaskTo extends string = '.'> = LinkOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & ActiveLinkOptionProps;
|
|
397
|
+
|
|
398
|
+
export { LinkOptions }
|
|
399
|
+
|
|
400
|
+
declare type MakeShouldBlockFnLocationUnion<TRouter extends AnyRouter = RegisteredRouter, TRoute extends AnyRoute = ParseRoute<TRouter['routeTree']>> = TRoute extends any ? ShouldBlockFnLocation<TRoute['id'], TRoute['fullPath'], TRoute['types']['allParams'], TRoute['types']['fullSearchSchema']> : never;
|
|
401
|
+
|
|
402
|
+
declare type ManagedDocumentContent = {
|
|
403
|
+
title?: string;
|
|
404
|
+
head: Array<ManagedTag>;
|
|
405
|
+
body: Array<ManagedTag>;
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
/** Route-driven tag with stable hash id for DOM reconciliation. */
|
|
409
|
+
declare type ManagedTag = Exclude<RouterManagedTag, {
|
|
410
|
+
tag: 'title';
|
|
411
|
+
}> & {
|
|
412
|
+
id: ManagedTagId;
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
declare type ManagedTagId = string;
|
|
416
|
+
|
|
417
|
+
export declare class Matches {
|
|
418
|
+
router: AnyRouter;
|
|
419
|
+
private matchId;
|
|
420
|
+
private ssrScrollRestoration;
|
|
421
|
+
transitioner: void;
|
|
422
|
+
render: void;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
export { NavigateOptions }
|
|
426
|
+
|
|
427
|
+
declare type NearestMatchContextValue = {
|
|
428
|
+
matchId: () => string | undefined;
|
|
429
|
+
routeId: () => string | undefined;
|
|
430
|
+
match: () => AnyRouteMatch | undefined;
|
|
431
|
+
hasPending: () => boolean;
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
export { notFound }
|
|
435
|
+
|
|
436
|
+
export declare class NotFoundRoute<TRegister, TParentRoute extends AnyRootRoute, TRouterContext = AnyContext, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TSearchValidator = undefined, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TChildren = unknown, TSSR = unknown, THandlers = undefined> extends Route<TRegister, TParentRoute, '/404', '/404', '404', '404', TSearchValidator, {}, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TSSR, THandlers> {
|
|
437
|
+
constructor(options: Omit<RouteOptions<TRegister, TParentRoute, string, string, string, string, TSearchValidator, {}, TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn, TSSR, THandlers>, 'caseSensitive' | 'parseParams' | 'stringifyParams' | 'path' | 'id' | 'params'>);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
export declare type NotFoundRouteComponent = () => Angular.Type<unknown>;
|
|
441
|
+
|
|
442
|
+
export declare class Outlet {
|
|
443
|
+
router: AnyRouter;
|
|
444
|
+
nearestMatch: NearestMatchContextValue;
|
|
445
|
+
currentMatch: Signal<AnyRouteMatch | undefined>;
|
|
446
|
+
routeId: Signal<string>;
|
|
447
|
+
route: Signal<AnyRoute>;
|
|
448
|
+
parentGlobalNotFound: Signal<boolean>;
|
|
449
|
+
childMatchIdByRouteId: Signal<Record<string, string>>;
|
|
450
|
+
childMatchId: Signal<string | null>;
|
|
451
|
+
render: void;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
export { ParsedPath }
|
|
455
|
+
|
|
456
|
+
/** Same as `provideTanstackDocument(router)` (all features enabled). */
|
|
457
|
+
export declare function provideHeadContent(router: AnyRouter): Angular.EnvironmentProviders;
|
|
458
|
+
|
|
459
|
+
export declare function provideTanstackBodyManagedTags(router: AnyRouter): Angular.EnvironmentProviders;
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Composes document sync from route matches. When title, head, and body are all
|
|
463
|
+
* enabled, uses a single `activeMatches` effect (same churn as legacy
|
|
464
|
+
* `provideHeadContent`). Partial feature sets use separate installers each with
|
|
465
|
+
* their own effect.
|
|
466
|
+
*/
|
|
467
|
+
export declare function provideTanstackDocument(router: AnyRouter, features?: TanstackDocumentFeatures): Angular.EnvironmentProviders;
|
|
468
|
+
|
|
469
|
+
export declare function provideTanstackDocumentTitle(router: AnyRouter): Angular.EnvironmentProviders;
|
|
470
|
+
|
|
471
|
+
export declare function provideTanstackHeadManagedTags(router: AnyRouter): Angular.EnvironmentProviders;
|
|
472
|
+
|
|
473
|
+
export declare function provideTanstackRouter({ router, context, options, }: TanstackRouterProviderOptions): ({
|
|
474
|
+
provide: InjectionToken<AnyRouter>;
|
|
475
|
+
useValue: AnyRouter;
|
|
476
|
+
useFactory?: undefined;
|
|
477
|
+
} | {
|
|
478
|
+
provide: InjectionToken<Partial<any>>;
|
|
479
|
+
useFactory: () => Partial<any>;
|
|
480
|
+
useValue?: undefined;
|
|
481
|
+
} | {
|
|
482
|
+
provide: InjectionToken<Omit<RouterInputs<AnyRouter, Record<string, any>>, "context" | "router">>;
|
|
483
|
+
useValue: Omit<RouterInputs<AnyRouter, Record<string, any>>, "context" | "router">;
|
|
484
|
+
useFactory?: undefined;
|
|
485
|
+
})[];
|
|
486
|
+
|
|
487
|
+
declare type ReadableStore<TState> = {
|
|
488
|
+
state: TState;
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
export { redirect }
|
|
492
|
+
|
|
493
|
+
export { Register }
|
|
494
|
+
|
|
495
|
+
export { RegisteredRouter }
|
|
496
|
+
|
|
497
|
+
declare type RenderValue = {
|
|
498
|
+
key?: string;
|
|
499
|
+
component: Type<any> | null | undefined;
|
|
500
|
+
inputs?: Record<string, () => unknown>;
|
|
501
|
+
providers?: Array<Provider>;
|
|
502
|
+
} | null | undefined;
|
|
503
|
+
|
|
504
|
+
export { retainSearchParams }
|
|
505
|
+
|
|
506
|
+
export declare class RootRoute<in out TRegister = Register, in out TSearchValidator = undefined, in out TRouterContext = {}, in out TRouteContextFn = AnyContext, in out TBeforeLoadFn = AnyContext, in out TLoaderDeps extends Record<string, any> = {}, in out TLoaderFn = undefined, in out TChildren = unknown, in out TFileRouteTypes = unknown, in out TSSR = unknown, in out THandlers = undefined> extends BaseRootRoute<TRegister, TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TFileRouteTypes, TSSR, THandlers> implements RootRoute_2<TRegister, TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TFileRouteTypes, TSSR, THandlers> {
|
|
507
|
+
/**
|
|
508
|
+
* @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.
|
|
509
|
+
*/
|
|
510
|
+
constructor(options?: RootRouteOptions<TRegister, TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TSSR, THandlers>);
|
|
511
|
+
injectMatch: InjectMatchRoute<RootRouteId>;
|
|
512
|
+
injectRouteContext: InjectRouteContextRoute<RootRouteId>;
|
|
513
|
+
injectSearch: InjectSearchRoute<RootRouteId>;
|
|
514
|
+
injectParams: InjectParamsRoute<RootRouteId>;
|
|
515
|
+
injectLoaderDeps: InjectLoaderDepsRoute<RootRouteId>;
|
|
516
|
+
injectLoaderData: InjectLoaderDataRoute<RootRouteId>;
|
|
517
|
+
injectNavigate: () => UseNavigateResult<"/">;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
export { RootRouteOptions }
|
|
521
|
+
|
|
522
|
+
export declare class Route<in out TRegister = unknown, in out TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute, in out TPath extends RouteConstraints['TPath'] = '/', in out TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, TPath>, in out TCustomId extends RouteConstraints['TCustomId'] = string, in out TId extends RouteConstraints['TId'] = ResolveId<TParentRoute, TCustomId, TPath>, in out TSearchValidator = undefined, in out TParams = ResolveParams<TPath>, in out TRouterContext = AnyContext, in out TRouteContextFn = AnyContext, in out TBeforeLoadFn = AnyContext, in out TLoaderDeps extends Record<string, any> = {}, in out TLoaderFn = undefined, in out TChildren = unknown, in out TFileRouteTypes = unknown, in out TSSR = unknown, in out TMiddlewares = unknown, in out THandlers = undefined> extends BaseRoute<TRegister, TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TFileRouteTypes, TSSR, TMiddlewares, THandlers> implements Route_2<TRegister, TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TFileRouteTypes, TSSR, TMiddlewares, THandlers> {
|
|
523
|
+
/**
|
|
524
|
+
* @deprecated Use the `createRoute` function instead.
|
|
525
|
+
*/
|
|
526
|
+
constructor(options?: RouteOptions<TRegister, TParentRoute, TId, TCustomId, TFullPath, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn, TSSR, TMiddlewares, THandlers>);
|
|
527
|
+
injectMatch: InjectMatchRoute<TId>;
|
|
528
|
+
injectRouteContext: InjectRouteContextRoute<TId>;
|
|
529
|
+
injectSearch: InjectSearchRoute<TId>;
|
|
530
|
+
injectParams: InjectParamsRoute<TId>;
|
|
531
|
+
injectLoaderDeps: InjectLoaderDepsRoute<TId>;
|
|
532
|
+
injectLoaderData: InjectLoaderDataRoute<TId>;
|
|
533
|
+
injectNavigate: () => UseNavigateResult<TFullPath>;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
export declare class RouteApi<TId, TRouter extends AnyRouter = RegisteredRouter> extends BaseRouteApi<TId, TRouter> {
|
|
537
|
+
/**
|
|
538
|
+
* @deprecated Use the `getRouteApi` function instead.
|
|
539
|
+
*/
|
|
540
|
+
constructor({ id }: {
|
|
541
|
+
id: TId;
|
|
542
|
+
});
|
|
543
|
+
injectMatch: InjectMatchRoute<TId>;
|
|
544
|
+
injectRouteContext: InjectRouteContextRoute<TId>;
|
|
545
|
+
injectSearch: InjectSearchRoute<TId>;
|
|
546
|
+
injectParams: InjectParamsRoute<TId>;
|
|
547
|
+
injectLoaderDeps: InjectLoaderDepsRoute<TId>;
|
|
548
|
+
injectLoaderData: InjectLoaderDataRoute<TId>;
|
|
549
|
+
injectNavigate: () => UseNavigateResult<RouteTypesById<TRouter, TId>["fullPath"]>;
|
|
550
|
+
notFound: (opts?: NotFoundError) => NotFoundError;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
export declare type RouteComponent<TComponent = unknown> = () => Angular.Type<TComponent>;
|
|
554
|
+
|
|
555
|
+
export declare class RouteMatch {
|
|
556
|
+
matchId: InputSignal<string>;
|
|
557
|
+
router: AnyRouter;
|
|
558
|
+
match: Signal<AnyRouteMatch | undefined>;
|
|
559
|
+
matchData: Signal<{
|
|
560
|
+
key: string | undefined;
|
|
561
|
+
route: AnyRoute;
|
|
562
|
+
match: AnyRouteMatch;
|
|
563
|
+
parentRouteId: any;
|
|
564
|
+
} | null>;
|
|
565
|
+
isFistRouteInRouteTree: Signal<boolean>;
|
|
566
|
+
resolvedNoSsr: Signal<boolean>;
|
|
567
|
+
shouldClientOnly: Signal<boolean>;
|
|
568
|
+
parentRouteIdSignal: Signal<any>;
|
|
569
|
+
rootRouteIdSignal: Signal<string>;
|
|
570
|
+
hasPendingMatch: Signal<boolean>;
|
|
571
|
+
pendingRouteIds: Signal<Record<string, boolean>>;
|
|
572
|
+
nearestMatchContext: NearestMatchContextValue;
|
|
573
|
+
isCatchingError: Signal<boolean>;
|
|
574
|
+
render: void;
|
|
575
|
+
onRendered: void;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
export { RouteOptions }
|
|
579
|
+
|
|
580
|
+
export declare class Router<in out TRouteTree extends AnyRoute, in out TTrailingSlashOption extends TrailingSlashOption = 'never', in out TDefaultStructuralSharingOption extends boolean = false, in out TRouterHistory extends RouterHistory = RouterHistory, in out TDehydrated extends Record<string, any> = Record<string, any>> extends RouterCore<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated> {
|
|
581
|
+
constructor(options: AngularRouterConstructorOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>);
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
export { RouterContextOptions }
|
|
585
|
+
|
|
586
|
+
export { RouterHistory }
|
|
587
|
+
|
|
588
|
+
declare type RouterInputs<TRouter extends AnyRouter = RegisteredRouter, TDehydrated extends Record<string, any> = Record<string, any>> = Omit<RouterOptions<TRouter['routeTree'], NonNullable<TRouter['options']['trailingSlash']>, false, TRouter['history'], TDehydrated>, 'context'> & {
|
|
589
|
+
router: TRouter;
|
|
590
|
+
context?: Partial<RouterOptions<TRouter['routeTree'], NonNullable<TRouter['options']['trailingSlash']>, false, TRouter['history'], TDehydrated>['context']>;
|
|
591
|
+
};
|
|
592
|
+
|
|
593
|
+
export declare class RouterProvider<TRouter extends AnyRouter = RegisteredRouter> {
|
|
594
|
+
readonly injectedContext: RouterInputs<TRouter>['context'];
|
|
595
|
+
readonly injectedOptions: Omit<RouterInputs<TRouter>, 'router' | 'context'>;
|
|
596
|
+
readonly injectedRouter: AnyRouter | null;
|
|
597
|
+
readonly context: InputSignal<RouterInputs<TRouter>['context']>;
|
|
598
|
+
readonly options: InputSignal<Omit<RouterInputs<TRouter>, 'router' | 'context'>>;
|
|
599
|
+
readonly routerInput: InputSignal<TRouter | undefined>;
|
|
600
|
+
readonly router: Signal<TRouter>;
|
|
601
|
+
readonly updateRouter: EffectRef;
|
|
602
|
+
readonly render: ReturnType<typeof injectRender>;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
export { RouterState }
|
|
606
|
+
|
|
607
|
+
export declare type ShouldBlockFn<TRouter extends AnyRouter = RegisteredRouter> = (args: ShouldBlockFnArgs<TRouter>) => boolean | Promise<boolean>;
|
|
608
|
+
|
|
609
|
+
declare type ShouldBlockFnArgs<TRouter extends AnyRouter = RegisteredRouter> = {
|
|
610
|
+
current: MakeShouldBlockFnLocationUnion<TRouter>;
|
|
611
|
+
next: MakeShouldBlockFnLocationUnion<TRouter>;
|
|
612
|
+
action: HistoryAction;
|
|
613
|
+
};
|
|
614
|
+
|
|
615
|
+
declare interface ShouldBlockFnLocation<out TRouteId, out TFullPath, out TAllParams, out TFullSearchSchema> {
|
|
616
|
+
routeId: TRouteId;
|
|
617
|
+
fullPath: TFullPath;
|
|
618
|
+
pathname: string;
|
|
619
|
+
params: TAllParams;
|
|
620
|
+
search: TFullSearchSchema;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
export declare type TanstackDocumentFeatures = {
|
|
624
|
+
/** Sync `document.title` from route meta (default: true). */
|
|
625
|
+
title?: boolean;
|
|
626
|
+
/** Managed `<head>` tags from matches (default: true). */
|
|
627
|
+
headTags?: boolean;
|
|
628
|
+
/** Managed `<body>` scripts: route/manifest scripts plus one SSR `takeBufferedScripts()` read (default: true). */
|
|
629
|
+
bodyScripts?: boolean;
|
|
630
|
+
};
|
|
631
|
+
|
|
632
|
+
declare type TanstackRouterProviderOptions = {
|
|
633
|
+
router: AnyRouter;
|
|
634
|
+
context?: RouterInputs['context'];
|
|
635
|
+
options?: Omit<RouterInputs, 'router' | 'context'>;
|
|
636
|
+
};
|
|
637
|
+
|
|
638
|
+
export declare type UseBlockerOpts<TRouter extends AnyRouter = RegisteredRouter, TWithResolver extends boolean = boolean> = {
|
|
639
|
+
shouldBlockFn: ShouldBlockFn<TRouter>;
|
|
640
|
+
enableBeforeUnload?: boolean | (() => boolean);
|
|
641
|
+
disabled?: boolean;
|
|
642
|
+
withResolver?: TWithResolver;
|
|
643
|
+
};
|
|
644
|
+
|
|
645
|
+
export { }
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
declare module '@benjavicente/router-core' {
|
|
649
|
+
interface UpdatableRouteOptionsExtensions {
|
|
650
|
+
component?: RouteComponent;
|
|
651
|
+
errorComponent?: false | null | undefined | ErrorRouteComponent;
|
|
652
|
+
notFoundComponent?: NotFoundRouteComponent;
|
|
653
|
+
pendingComponent?: RouteComponent;
|
|
654
|
+
}
|
|
655
|
+
interface RootRouteOptionsExtensions {
|
|
656
|
+
shellComponent?: Angular.Type<{
|
|
657
|
+
children: any;
|
|
658
|
+
}>;
|
|
659
|
+
}
|
|
660
|
+
interface RouteExtensions<in out TId extends string, in out TFullPath extends string> {
|
|
661
|
+
injectMatch: InjectMatchRoute<TId>;
|
|
662
|
+
injectRouteContext: InjectRouteContextRoute<TId>;
|
|
663
|
+
injectSearch: InjectSearchRoute<TId>;
|
|
664
|
+
injectParams: InjectParamsRoute<TId>;
|
|
665
|
+
injectLoaderDeps: InjectLoaderDepsRoute<TId>;
|
|
666
|
+
injectLoaderData: InjectLoaderDataRoute<TId>;
|
|
667
|
+
injectNavigate: () => UseNavigateResult<TFullPath>;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
|
|
672
|
+
declare module '@benjavicente/router-core' {
|
|
673
|
+
interface LazyRoute<in out TRoute extends AnyRoute> {
|
|
674
|
+
injectMatch: InjectMatchRoute<TRoute['id']>;
|
|
675
|
+
injectRouteContext: InjectRouteContextRoute<TRoute['id']>;
|
|
676
|
+
injectSearch: InjectSearchRoute<TRoute['id']>;
|
|
677
|
+
injectParams: InjectParamsRoute<TRoute['id']>;
|
|
678
|
+
injectLoaderDeps: InjectLoaderDepsRoute<TRoute['id']>;
|
|
679
|
+
injectLoaderData: InjectLoaderDataRoute<TRoute['id']>;
|
|
680
|
+
injectNavigate: () => UseNavigateResult<TRoute['fullPath']>;
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
|
|
685
|
+
declare module '@benjavicente/router-core' {
|
|
686
|
+
interface RouterOptionsExtensions {
|
|
687
|
+
/**
|
|
688
|
+
* The default `component` a route should use if no component is provided.
|
|
689
|
+
*
|
|
690
|
+
* @default Outlet
|
|
691
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/solid/api/router/RouterOptionsType#defaultcomponent-property)
|
|
692
|
+
*/
|
|
693
|
+
defaultComponent?: RouteComponent;
|
|
694
|
+
/**
|
|
695
|
+
* The default `errorComponent` a route should use if no error component is provided.
|
|
696
|
+
*
|
|
697
|
+
* @default ErrorComponent
|
|
698
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/solid/api/router/RouterOptionsType#defaulterrorcomponent-property)
|
|
699
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/solid/guide/data-loading#handling-errors-with-routeoptionserrorcomponent)
|
|
700
|
+
*/
|
|
701
|
+
defaultErrorComponent?: ErrorRouteComponent;
|
|
702
|
+
/**
|
|
703
|
+
* The default `pendingComponent` a route should use if no pending component is provided.
|
|
704
|
+
*
|
|
705
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/solid/api/router/RouterOptionsType#defaultpendingcomponent-property)
|
|
706
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/solid/guide/data-loading#showing-a-pending-component)
|
|
707
|
+
*/
|
|
708
|
+
defaultPendingComponent?: RouteComponent;
|
|
709
|
+
/**
|
|
710
|
+
* The default `notFoundComponent` a route should use if no notFound component is provided.
|
|
711
|
+
*
|
|
712
|
+
* @default NotFound
|
|
713
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/solid/api/router/RouterOptionsType#defaultnotfoundcomponent-property)
|
|
714
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/solid/guide/not-found-errors#default-router-wide-not-found-handling)
|
|
715
|
+
*/
|
|
716
|
+
defaultNotFoundComponent?: RouteComponent;
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
declare module '@benjavicente/router-core' {
|
|
722
|
+
interface RouterStores<in out TRouteTree extends AnyRoute> {
|
|
723
|
+
childMatchIdByRouteId: RouterReadableStore<Record<string, string>>;
|
|
724
|
+
pendingRouteIds: RouterReadableStore<Record<string, boolean>>;
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
|
|
729
|
+
declare global {
|
|
730
|
+
interface Window {
|
|
731
|
+
__TSR_ROUTER_INJECTION_KEY__?: Angular.InjectionToken<AnyRouter>;
|
|
732
|
+
}
|
|
733
|
+
}
|