@tanstack/react-router 0.0.1-beta.204 → 0.0.1-beta.205
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/build/cjs/RouterProvider.js +961 -0
- package/build/cjs/RouterProvider.js.map +1 -0
- package/build/cjs/fileRoute.js +29 -0
- package/build/cjs/fileRoute.js.map +1 -0
- package/build/cjs/index.js +69 -21
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/path.js +211 -0
- package/build/cjs/path.js.map +1 -0
- package/build/cjs/qss.js +65 -0
- package/build/cjs/qss.js.map +1 -0
- package/build/cjs/react.js +148 -190
- package/build/cjs/react.js.map +1 -1
- package/build/cjs/redirects.js +27 -0
- package/build/cjs/redirects.js.map +1 -0
- package/build/cjs/route.js +136 -0
- package/build/cjs/route.js.map +1 -0
- package/build/cjs/router.js +203 -0
- package/build/cjs/router.js.map +1 -0
- package/build/cjs/searchParams.js +83 -0
- package/build/cjs/searchParams.js.map +1 -0
- package/build/cjs/utils.js +196 -0
- package/build/cjs/utils.js.map +1 -0
- package/build/esm/index.js +1799 -211
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +385 -164
- package/build/types/RouteMatch.d.ts +23 -0
- package/build/types/RouterProvider.d.ts +54 -0
- package/build/types/awaited.d.ts +0 -8
- package/build/types/defer.d.ts +0 -0
- package/build/types/fileRoute.d.ts +17 -0
- package/build/types/history.d.ts +7 -0
- package/build/types/index.d.ts +17 -4
- package/build/types/link.d.ts +98 -0
- package/build/types/location.d.ts +14 -0
- package/build/types/path.d.ts +16 -0
- package/build/types/qss.d.ts +2 -0
- package/build/types/react.d.ts +23 -83
- package/build/types/redirects.d.ts +10 -0
- package/build/types/route.d.ts +222 -0
- package/build/types/routeInfo.d.ts +22 -0
- package/build/types/router.d.ts +115 -0
- package/build/types/scroll-restoration.d.ts +0 -3
- package/build/types/searchParams.d.ts +7 -0
- package/build/types/utils.d.ts +48 -0
- package/build/umd/index.development.js +1116 -1540
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +2 -33
- package/build/umd/index.production.js.map +1 -1
- package/package.json +4 -4
- package/src/RouteMatch.ts +28 -0
- package/src/RouterProvider.tsx +1384 -0
- package/src/awaited.tsx +40 -40
- package/src/defer.ts +55 -0
- package/src/fileRoute.ts +143 -0
- package/src/history.ts +8 -0
- package/src/index.tsx +18 -5
- package/src/link.ts +347 -0
- package/src/location.ts +14 -0
- package/src/path.ts +256 -0
- package/src/qss.ts +53 -0
- package/src/react.tsx +174 -422
- package/src/redirects.ts +31 -0
- package/src/route.ts +710 -0
- package/src/routeInfo.ts +68 -0
- package/src/router.ts +373 -0
- package/src/scroll-restoration.tsx +205 -27
- package/src/searchParams.ts +78 -0
- package/src/utils.ts +257 -0
- package/build/cjs/awaited.js +0 -45
- package/build/cjs/awaited.js.map +0 -1
- package/build/cjs/scroll-restoration.js +0 -56
- package/build/cjs/scroll-restoration.js.map +0 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AnyRoute } from './route';
|
|
2
|
+
import { ParseRoute, FullSearchSchema, RouteById, RouteIds } from './routeInfo';
|
|
3
|
+
export interface RouteMatch<TRouteTree extends AnyRoute = AnyRoute, TRouteId extends RouteIds<TRouteTree> = ParseRoute<TRouteTree>['id']> {
|
|
4
|
+
id: string;
|
|
5
|
+
routeId: TRouteId;
|
|
6
|
+
pathname: string;
|
|
7
|
+
params: RouteById<TRouteTree, TRouteId>['types']['allParams'];
|
|
8
|
+
status: 'pending' | 'success' | 'error';
|
|
9
|
+
isFetching: boolean;
|
|
10
|
+
invalid: boolean;
|
|
11
|
+
error: unknown;
|
|
12
|
+
paramsError: unknown;
|
|
13
|
+
searchError: unknown;
|
|
14
|
+
updatedAt: number;
|
|
15
|
+
loadPromise?: Promise<void>;
|
|
16
|
+
__resolveLoadPromise?: () => void;
|
|
17
|
+
meta: RouteById<TRouteTree, TRouteId>['types']['allMeta'];
|
|
18
|
+
routeSearch: RouteById<TRouteTree, TRouteId>['types']['searchSchema'];
|
|
19
|
+
search: FullSearchSchema<TRouteTree> & RouteById<TRouteTree, TRouteId>['types']['fullSearchSchema'];
|
|
20
|
+
fetchedAt: number;
|
|
21
|
+
abortController: AbortController;
|
|
22
|
+
}
|
|
23
|
+
export type AnyRouteMatch = RouteMatch<any>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { RegisteredRouter, DehydratedRouteMatch, RouterOptions } from './router';
|
|
3
|
+
import { ParsedLocation } from './location';
|
|
4
|
+
import { RouteMatch } from './RouteMatch';
|
|
5
|
+
import { NoInfer } from './utils';
|
|
6
|
+
import { RouterProps } from './react';
|
|
7
|
+
import { RouteById, RoutePaths, RoutesById } from './routeInfo';
|
|
8
|
+
import { LinkInfo, LinkOptions, NavigateOptions, ResolveRelativePath, ToOptions } from './link';
|
|
9
|
+
import { RouterHistory } from '.';
|
|
10
|
+
import { AnyRoute } from './route';
|
|
11
|
+
import { RouterState } from './router';
|
|
12
|
+
export interface CommitLocationOptions {
|
|
13
|
+
replace?: boolean;
|
|
14
|
+
resetScroll?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface MatchLocation {
|
|
17
|
+
to?: string | number | null;
|
|
18
|
+
fuzzy?: boolean;
|
|
19
|
+
caseSensitive?: boolean;
|
|
20
|
+
from?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface MatchRouteOptions {
|
|
23
|
+
pending?: boolean;
|
|
24
|
+
caseSensitive?: boolean;
|
|
25
|
+
includeSearch?: boolean;
|
|
26
|
+
fuzzy?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export type BuildLinkFn<TRouteTree extends AnyRoute> = <TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = ''>(state: RouterState, dest: LinkOptions<TRouteTree, TFrom, TTo>) => LinkInfo;
|
|
29
|
+
export type NavigateFn<TRouteTree extends AnyRoute> = <TRouteTree extends AnyRoute, TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> = TFrom, TMaskTo extends string = ''>({ from, to, ...rest }: NavigateOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>) => Promise<void>;
|
|
30
|
+
export type MatchRouteFn<TRouteTree extends AnyRoute> = <TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TResolved = ResolveRelativePath<TFrom, NoInfer<TTo>>>(state: RouterState<TRouteTree>, location: ToOptions<TRouteTree, TFrom, TTo>, opts?: MatchRouteOptions) => false | RouteById<TRouteTree, TResolved>['types']['allParams'];
|
|
31
|
+
export type LoadFn = (opts?: {
|
|
32
|
+
next?: ParsedLocation;
|
|
33
|
+
throwOnError?: boolean;
|
|
34
|
+
__dehydratedMatches?: DehydratedRouteMatch[];
|
|
35
|
+
}) => Promise<void>;
|
|
36
|
+
export type RouterContext<TRouteTree extends AnyRoute> = {
|
|
37
|
+
buildLink: BuildLinkFn<TRouteTree>;
|
|
38
|
+
state: RouterState<TRouteTree>;
|
|
39
|
+
navigate: NavigateFn<TRouteTree>;
|
|
40
|
+
matchRoute: MatchRouteFn<TRouteTree>;
|
|
41
|
+
routeTree: TRouteTree;
|
|
42
|
+
routesById: RoutesById<TRouteTree>;
|
|
43
|
+
options: RouterOptions<TRouteTree>;
|
|
44
|
+
history: RouterHistory;
|
|
45
|
+
load: LoadFn;
|
|
46
|
+
};
|
|
47
|
+
export declare const routerContext: React.Context<RouterContext<any>>;
|
|
48
|
+
export declare function getInitialRouterState(location: ParsedLocation): RouterState<any>;
|
|
49
|
+
export declare function RouterProvider<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TDehydrated extends Record<string, any> = Record<string, any>>({ router, ...rest }: RouterProps<TRouteTree, TDehydrated>): JSX.Element;
|
|
50
|
+
export declare class SearchParamError extends Error {
|
|
51
|
+
}
|
|
52
|
+
export declare class PathParamError extends Error {
|
|
53
|
+
}
|
|
54
|
+
export declare function getRouteMatch<TRouteTree extends AnyRoute>(state: RouterState<TRouteTree>, id: string): undefined | RouteMatch<TRouteTree>;
|
package/build/types/awaited.d.ts
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { DeferredPromise } from '@tanstack/router-core';
|
|
2
|
-
export type AwaitOptions<T> = {
|
|
3
|
-
promise: DeferredPromise<T>;
|
|
4
|
-
};
|
|
5
|
-
export declare function useAwaited<T>({ promise }: AwaitOptions<T>): [T];
|
|
6
|
-
export declare function Await<T>(props: AwaitOptions<T> & {
|
|
7
|
-
children: (result: T) => JSX.Element;
|
|
8
|
-
}): JSX.Element;
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AnyRoute, ResolveFullPath, RouteMeta, AnyContext, RouteOptions, UpdatableRouteOptions, Route, AnyPathParams, RootRouteId, TrimPathLeft, RouteConstraints } from './route';
|
|
2
|
+
import { Assign, Expand, IsAny } from './utils';
|
|
3
|
+
export interface FileRoutesByPath {
|
|
4
|
+
}
|
|
5
|
+
type Replace<S extends string, From extends string, To extends string> = S extends `${infer Start}${From}${infer Rest}` ? `${Start}${To}${Replace<Rest, From, To>}` : S;
|
|
6
|
+
export type TrimLeft<T extends string, S extends string> = T extends `${S}${infer U}` ? U : T;
|
|
7
|
+
export type TrimRight<T extends string, S extends string> = T extends `${infer U}${S}` ? U : T;
|
|
8
|
+
export type Trim<T extends string, S extends string> = TrimLeft<TrimRight<T, S>, S>;
|
|
9
|
+
export type RemoveUnderScores<T extends string> = Replace<Replace<TrimRight<TrimLeft<T, '/_'>, '_'>, '_/', '/'>, '/_', '/'>;
|
|
10
|
+
export type ResolveFilePath<TParentRoute extends AnyRoute, TFilePath extends string> = TParentRoute['id'] extends RootRouteId ? TrimPathLeft<TFilePath> : Replace<TrimPathLeft<TFilePath>, TrimPathLeft<TParentRoute['types']['customId']>, ''>;
|
|
11
|
+
export type FileRoutePath<TParentRoute extends AnyRoute, TFilePath extends string> = ResolveFilePath<TParentRoute, TFilePath> extends `_${infer _}` ? string : ResolveFilePath<TParentRoute, TFilePath>;
|
|
12
|
+
export declare class FileRoute<TFilePath extends keyof FileRoutesByPath, TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'], TId extends RouteConstraints['TId'] = TFilePath, TPath extends RouteConstraints['TPath'] = FileRoutePath<TParentRoute, TFilePath>, TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, RemoveUnderScores<TPath>>> {
|
|
13
|
+
path: TFilePath;
|
|
14
|
+
constructor(path: TFilePath);
|
|
15
|
+
createRoute: <TSearchSchema extends import("./route").AnySearchSchema = {}, TFullSearchSchema extends import("./route").AnySearchSchema = Expand<Assign<import("./route").InferFullSearchSchema<TParentRoute>, TSearchSchema>>, TParams extends Record<string, any> = (TrimLeft<TrimRight<import("./link").Split<TPath, true>[number], "_">, "_"> extends infer T ? T extends TrimLeft<TrimRight<import("./link").Split<TPath, true>[number], "_">, "_"> ? T extends `$${infer L}` ? L : never : never : never) extends never ? AnyPathParams : Record<TrimLeft<TrimRight<import("./link").Split<TPath, true>[number], "_">, "_"> extends infer T ? T extends TrimLeft<TrimRight<import("./link").Split<TPath, true>[number], "_">, "_"> ? T extends `$${infer L}` ? L : never : never : never, string>, TAllParams extends Record<string, any> = IsAny<TParentRoute["types"]["allParams"], TParams, TParentRoute["types"]["allParams"] & TParams>, TRouteMeta extends RouteMeta = RouteMeta, TContext extends Expand<Assign<IsAny<TParentRoute["types"]["allMeta"], {}, TParentRoute["types"]["allMeta"]>, TRouteMeta>> = Expand<Assign<IsAny<TParentRoute["types"]["allMeta"], {}, TParentRoute["types"]["allMeta"]>, TRouteMeta>>, TRouterMeta extends AnyContext = AnyContext, TChildren extends unknown = unknown, TRouteTree extends AnyRoute = AnyRoute>(options: Omit<RouteOptions<TParentRoute, string, string, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteMeta, TContext>, "id" | "path" | "getParentRoute"> & UpdatableRouteOptions<TFullSearchSchema, TAllParams, TContext>) => Route<TParentRoute, TPath, TFullPath, TFilePath, TId, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteMeta, TContext, TRouterMeta, TChildren, TRouteTree>;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
package/build/types/index.d.ts
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export * from '@tanstack/history';
|
|
2
|
+
export { default as invariant } from 'tiny-invariant';
|
|
3
|
+
export { default as warning } from 'tiny-warning';
|
|
4
|
+
export * from './link';
|
|
5
|
+
export * from './path';
|
|
6
|
+
export * from './qss';
|
|
7
|
+
export * from './route';
|
|
8
|
+
export * from './fileRoute';
|
|
9
|
+
export * from './routeInfo';
|
|
10
|
+
export * from './router';
|
|
11
|
+
export * from './searchParams';
|
|
12
|
+
export * from './utils';
|
|
3
13
|
export * from './react';
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
14
|
+
export * from './history';
|
|
15
|
+
export * from './RouteMatch';
|
|
16
|
+
export * from './redirects';
|
|
17
|
+
export * from './location';
|
|
18
|
+
export * from './RouterProvider';
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Trim } from './fileRoute';
|
|
2
|
+
import { AnyRoute } from './route';
|
|
3
|
+
import { AllParams, FullSearchSchema, RouteByPath, RouteIds, RoutePaths } from './routeInfo';
|
|
4
|
+
import { RegisteredRouter } from './router';
|
|
5
|
+
import { LocationState } from './location';
|
|
6
|
+
import { ParsedLocation } from './location';
|
|
7
|
+
import { Expand, NoInfer, NonNullableUpdater, PickRequired, UnionToIntersection, Updater } from './utils';
|
|
8
|
+
export type LinkInfo = {
|
|
9
|
+
type: 'external';
|
|
10
|
+
href: string;
|
|
11
|
+
} | {
|
|
12
|
+
type: 'internal';
|
|
13
|
+
next: ParsedLocation;
|
|
14
|
+
handleFocus: (e: any) => void;
|
|
15
|
+
handleClick: (e: any) => void;
|
|
16
|
+
handleEnter: (e: any) => void;
|
|
17
|
+
handleLeave: (e: any) => void;
|
|
18
|
+
handleTouchStart: (e: any) => void;
|
|
19
|
+
isActive: boolean;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
};
|
|
22
|
+
export type CleanPath<T extends string> = T extends `${infer L}//${infer R}` ? CleanPath<`${CleanPath<L>}/${CleanPath<R>}`> : T extends `${infer L}//` ? `${CleanPath<L>}/` : T extends `//${infer L}` ? `/${CleanPath<L>}` : T;
|
|
23
|
+
export type Split<S, TIncludeTrailingSlash = true> = S extends unknown ? string extends S ? string[] : S extends string ? CleanPath<S> extends '' ? [] : TIncludeTrailingSlash extends true ? CleanPath<S> extends `${infer T}/` ? [...Split<T>, '/'] : CleanPath<S> extends `/${infer U}` ? Split<U> : CleanPath<S> extends `${infer T}/${infer U}` ? [...Split<T>, ...Split<U>] : [S] : CleanPath<S> extends `${infer T}/${infer U}` ? [...Split<T>, ...Split<U>] : S extends string ? [S] : never : never : never;
|
|
24
|
+
export type ParsePathParams<T extends string> = keyof {
|
|
25
|
+
[K in Trim<Split<T>[number], '_'> as K extends `$${infer L}` ? L : never]: K;
|
|
26
|
+
};
|
|
27
|
+
export type Join<T, Delimiter extends string = '/'> = T extends [] ? '' : T extends [infer L extends string] ? L : T extends [infer L extends string, ...infer Tail extends [...string[]]] ? CleanPath<`${L}${Delimiter}${Join<Tail>}`> : never;
|
|
28
|
+
export type Last<T extends any[]> = T extends [...infer _, infer L] ? L : never;
|
|
29
|
+
export type RelativeToPathAutoComplete<AllPaths extends string, TFrom extends string, TTo extends string, SplitPaths extends string[] = Split<AllPaths, false>> = TTo extends `..${infer _}` ? SplitPaths extends [
|
|
30
|
+
...Split<ResolveRelativePath<TFrom, TTo>, false>,
|
|
31
|
+
...infer TToRest
|
|
32
|
+
] ? `${CleanPath<Join<[
|
|
33
|
+
...Split<TTo, false>,
|
|
34
|
+
...(TToRest | (Split<ResolveRelativePath<TFrom, TTo>, false>['length'] extends 1 ? never : ['../']))
|
|
35
|
+
]>>}` : never : TTo extends `./${infer RestTTo}` ? SplitPaths extends [
|
|
36
|
+
...Split<TFrom, false>,
|
|
37
|
+
...Split<RestTTo, false>,
|
|
38
|
+
...infer RestPath
|
|
39
|
+
] ? `${TTo}${Join<RestPath>}` : never : (TFrom extends `/` ? never : SplitPaths extends [...Split<TFrom, false>, ...infer RestPath] ? Join<RestPath> extends {
|
|
40
|
+
length: 0;
|
|
41
|
+
} ? never : './' : never) | (TFrom extends `/` ? never : '../') | AllPaths;
|
|
42
|
+
export type NavigateOptions<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> = TFrom, TMaskTo extends string = ''> = ToOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> & {
|
|
43
|
+
replace?: boolean;
|
|
44
|
+
resetScroll?: boolean;
|
|
45
|
+
};
|
|
46
|
+
export type ToOptions<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> = '/', TMaskTo extends string = ''> = ToSubOptions<TRouteTree, TFrom, TTo> & {
|
|
47
|
+
mask?: ToMaskOptions<TRouteTree, TMaskFrom, TMaskTo>;
|
|
48
|
+
};
|
|
49
|
+
export type ToMaskOptions<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TMaskFrom extends RoutePaths<TRouteTree> = '/', TMaskTo extends string = ''> = ToSubOptions<TRouteTree, TMaskFrom, TMaskTo> & {
|
|
50
|
+
unmaskOnReload?: boolean;
|
|
51
|
+
};
|
|
52
|
+
export type ToSubOptions<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TResolved = ResolveRelativePath<TFrom, NoInfer<TTo>>> = {
|
|
53
|
+
to?: ToPathOption<TRouteTree, TFrom, TTo>;
|
|
54
|
+
hash?: true | Updater<string>;
|
|
55
|
+
state?: true | NonNullableUpdater<LocationState>;
|
|
56
|
+
from?: TFrom;
|
|
57
|
+
} & CheckPath<TRouteTree, NoInfer<TResolved>, {}> & SearchParamOptions<TRouteTree, TFrom, TTo, TResolved> & PathParamOptions<TRouteTree, TFrom, TResolved>;
|
|
58
|
+
export type SearchParamOptions<TRouteTree extends AnyRoute, TFrom, TTo, TResolved = ResolveRelativePath<TFrom, NoInfer<TTo>>, TFromSearchEnsured = '/' extends TFrom ? FullSearchSchema<TRouteTree> : Expand<UnionToIntersection<PickRequired<RouteByPath<TRouteTree, TFrom>['types']['fullSearchSchema']>>>, TFromSearchOptional = Omit<AllParams<TRouteTree>, keyof TFromSearchEnsured>, TFromSearch = Expand<TFromSearchEnsured & TFromSearchOptional>, TToSearch = '' extends TTo ? FullSearchSchema<TRouteTree> : Expand<RouteByPath<TRouteTree, TResolved>['types']['fullSearchSchema']>> = keyof PickRequired<TToSearch> extends never ? {
|
|
59
|
+
search?: true | SearchReducer<TFromSearch, TToSearch>;
|
|
60
|
+
} : {
|
|
61
|
+
search: TFromSearchEnsured extends PickRequired<TToSearch> ? true | SearchReducer<TFromSearch, TToSearch> : SearchReducer<TFromSearch, TToSearch>;
|
|
62
|
+
};
|
|
63
|
+
type SearchReducer<TFrom, TTo> = TTo | ((current: TFrom) => TTo);
|
|
64
|
+
export type PathParamOptions<TRouteTree extends AnyRoute, TFrom, TTo, TFromParamsEnsured = Expand<UnionToIntersection<PickRequired<RouteByPath<TRouteTree, TFrom>['types']['allParams']>>>, TFromParamsOptional = Omit<AllParams<TRouteTree>, keyof TFromParamsEnsured>, TFromParams = Expand<TFromParamsOptional & TFromParamsEnsured>, TToParams = Expand<RouteByPath<TRouteTree, TTo>['types']['allParams']>> = keyof PickRequired<TToParams> extends never ? {
|
|
65
|
+
params?: true | ParamsReducer<TFromParams, TToParams>;
|
|
66
|
+
} : {
|
|
67
|
+
params: TFromParamsEnsured extends PickRequired<TToParams> ? true | ParamsReducer<TFromParams, TToParams> : ParamsReducer<TFromParams, TToParams>;
|
|
68
|
+
};
|
|
69
|
+
type ParamsReducer<TFrom, TTo> = TTo | ((current: TFrom) => TTo);
|
|
70
|
+
export type ToPathOption<TRouteTree extends AnyRoute = AnyRoute, TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = ''> = TTo | RelativeToPathAutoComplete<RoutePaths<TRouteTree>, NoInfer<TFrom> extends string ? NoInfer<TFrom> : '', NoInfer<TTo> & string>;
|
|
71
|
+
export type ToIdOption<TRouteTree extends AnyRoute = AnyRoute, TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = ''> = TTo | RelativeToPathAutoComplete<RouteIds<TRouteTree>, NoInfer<TFrom> extends string ? NoInfer<TFrom> : '', NoInfer<TTo> & string>;
|
|
72
|
+
export interface ActiveOptions {
|
|
73
|
+
exact?: boolean;
|
|
74
|
+
includeHash?: boolean;
|
|
75
|
+
includeSearch?: boolean;
|
|
76
|
+
}
|
|
77
|
+
export type LinkOptions<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> = TFrom, TMaskTo extends string = ''> = NavigateOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> & {
|
|
78
|
+
target?: HTMLAnchorElement['target'];
|
|
79
|
+
activeOptions?: ActiveOptions;
|
|
80
|
+
preload?: false | 'intent';
|
|
81
|
+
preloadDelay?: number;
|
|
82
|
+
disabled?: boolean;
|
|
83
|
+
};
|
|
84
|
+
export type CheckRelativePath<TRouteTree extends AnyRoute, TFrom, TTo> = TTo extends string ? TFrom extends string ? ResolveRelativePath<TFrom, TTo> extends RoutePaths<TRouteTree> ? {} : {
|
|
85
|
+
Error: `${TFrom} + ${TTo} resolves to ${ResolveRelativePath<TFrom, TTo>}, which is not a valid route path.`;
|
|
86
|
+
'Valid Route Paths': RoutePaths<TRouteTree>;
|
|
87
|
+
} : {} : {};
|
|
88
|
+
export type CheckPath<TRouteTree extends AnyRoute, TPath, TPass> = Exclude<TPath, RoutePaths<TRouteTree>> extends never ? TPass : CheckPathError<TRouteTree, Exclude<TPath, RoutePaths<TRouteTree>>>;
|
|
89
|
+
export type CheckPathError<TRouteTree extends AnyRoute, TInvalids> = {
|
|
90
|
+
to: RoutePaths<TRouteTree>;
|
|
91
|
+
};
|
|
92
|
+
export type CheckId<TRouteTree extends AnyRoute, TPath, TPass> = Exclude<TPath, RouteIds<TRouteTree>> extends never ? TPass : CheckIdError<TRouteTree, Exclude<TPath, RouteIds<TRouteTree>>>;
|
|
93
|
+
export type CheckIdError<TRouteTree extends AnyRoute, TInvalids> = {
|
|
94
|
+
Error: `${TInvalids extends string ? TInvalids : never} is not a valid route ID.`;
|
|
95
|
+
'Valid Route IDs': RouteIds<TRouteTree>;
|
|
96
|
+
};
|
|
97
|
+
export type ResolveRelativePath<TFrom, TTo = '.'> = TFrom extends string ? TTo extends string ? TTo extends '.' ? TFrom : TTo extends `./` ? Join<[TFrom, '/']> : TTo extends `./${infer TRest}` ? ResolveRelativePath<TFrom, TRest> : TTo extends `/${infer TRest}` ? TTo : Split<TTo> extends ['..', ...infer ToRest] ? Split<TFrom> extends [...infer FromRest, infer FromTail] ? ToRest extends ['/'] ? Join<[...FromRest, '/']> : ResolveRelativePath<Join<FromRest>, Join<ToRest>> : never : Split<TTo> extends ['.', ...infer ToRest] ? ToRest extends ['/'] ? Join<[TFrom, '/']> : ResolveRelativePath<TFrom, Join<ToRest>> : CleanPath<Join<['/', ...Split<TFrom>, ...Split<TTo>]>> : never : never;
|
|
98
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HistoryState } from '@tanstack/history';
|
|
2
|
+
import { AnySearchSchema } from './route';
|
|
3
|
+
export interface ParsedLocation<TSearchObj extends AnySearchSchema = {}> {
|
|
4
|
+
href: string;
|
|
5
|
+
pathname: string;
|
|
6
|
+
search: TSearchObj;
|
|
7
|
+
searchStr: string;
|
|
8
|
+
state: HistoryState;
|
|
9
|
+
hash: string;
|
|
10
|
+
maskedLocation?: ParsedLocation<TSearchObj>;
|
|
11
|
+
unmaskOnReload?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface LocationState {
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MatchLocation } from './RouterProvider';
|
|
2
|
+
import { AnyPathParams } from './route';
|
|
3
|
+
export interface Segment {
|
|
4
|
+
type: 'pathname' | 'param' | 'wildcard';
|
|
5
|
+
value: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function joinPaths(paths: (string | undefined)[]): string;
|
|
8
|
+
export declare function cleanPath(path: string): string;
|
|
9
|
+
export declare function trimPathLeft(path: string): string;
|
|
10
|
+
export declare function trimPathRight(path: string): string;
|
|
11
|
+
export declare function trimPath(path: string): string;
|
|
12
|
+
export declare function resolvePath(basepath: string, base: string, to: string): string;
|
|
13
|
+
export declare function parsePathname(pathname?: string): Segment[];
|
|
14
|
+
export declare function interpolatePath(path: string | undefined, params: any, leaveWildcards?: boolean): string;
|
|
15
|
+
export declare function matchPathname(basepath: string, currentPathname: string, matchLocation: Pick<MatchLocation, 'to' | 'fuzzy' | 'caseSensitive'>): AnyPathParams | undefined;
|
|
16
|
+
export declare function matchByPath(basepath: string, from: string, matchLocation: Pick<MatchLocation, 'to' | 'caseSensitive' | 'fuzzy'>): Record<string, string> | undefined;
|
package/build/types/react.d.ts
CHANGED
|
@@ -1,61 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
interface RegisterRouteComponent<TLoader = unknown, TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TAllContext extends Record<string, any> = AnyContext> {
|
|
12
|
-
RouteComponent: RouteComponent<RouteProps<TLoader, TFullSearchSchema, TAllParams, TAllContext>>;
|
|
13
|
-
}
|
|
14
|
-
interface RegisterErrorRouteComponent<TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TAllContext extends Record<string, any> = AnyContext> {
|
|
15
|
-
ErrorRouteComponent: RouteComponent<ErrorRouteProps<TFullSearchSchema, TAllParams, TAllContext>>;
|
|
16
|
-
}
|
|
17
|
-
interface RegisterPendingRouteComponent<TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TAllContext extends Record<string, any> = AnyContext> {
|
|
18
|
-
PendingRouteComponent: RouteComponent<PendingRouteProps<TFullSearchSchema, TAllParams, TAllContext>>;
|
|
19
|
-
}
|
|
20
|
-
interface Route<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>, TLoaderContext extends RouteConstraints['TLoaderContext'] = AnyContext, TLoader = unknown, TSearchSchema extends RouteConstraints['TSearchSchema'] = {}, TFullSearchSchema extends RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TParams extends RouteConstraints['TParams'] = Expand<Record<ParsePathParams<TPath>, string>>, TAllParams extends RouteConstraints['TAllParams'] = ResolveAllParams<TParentRoute, TParams>, TRouteContext extends RouteConstraints['TRouteContext'] = RouteContext, TAllContext extends RouteConstraints['TAllContext'] = Expand<DeepMergeAll<[
|
|
21
|
-
IsAny<TParentRoute['types']['context'], {}>,
|
|
22
|
-
TLoaderContext,
|
|
23
|
-
TRouteContext
|
|
24
|
-
]>>, TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext, TChildren extends RouteConstraints['TChildren'] = unknown, TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute> {
|
|
25
|
-
useMatch: <TSelected = TAllContext>(opts?: {
|
|
26
|
-
select?: (search: TAllContext) => TSelected;
|
|
27
|
-
}) => TSelected;
|
|
28
|
-
useLoader: <TSelected = TLoader>(opts?: {
|
|
29
|
-
select?: (search: TLoader) => TSelected;
|
|
30
|
-
}) => UseLoaderResult<TSelected>;
|
|
31
|
-
useRouteContext: <TSelected = TAllContext>(opts?: {
|
|
32
|
-
select?: (search: TAllContext) => TSelected;
|
|
33
|
-
}) => TSelected;
|
|
34
|
-
useSearch: <TSelected = TFullSearchSchema>(opts?: {
|
|
35
|
-
select?: (search: TFullSearchSchema) => TSelected;
|
|
36
|
-
}) => TSelected;
|
|
37
|
-
useParams: <TSelected = TAllParams>(opts?: {
|
|
38
|
-
select?: (search: TAllParams) => TSelected;
|
|
39
|
-
}) => TSelected;
|
|
40
|
-
}
|
|
41
|
-
interface RegisterRouteProps<TLoader = unknown, TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TAllContext extends Record<string, any> = AnyContext> {
|
|
42
|
-
RouteProps: RouteProps<TLoader, TFullSearchSchema, TAllParams, TAllContext>;
|
|
43
|
-
}
|
|
44
|
-
interface RegisterPendingRouteProps<TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TAllContext extends Record<string, any> = AnyContext> {
|
|
45
|
-
PendingRouteProps: PendingRouteProps<TFullSearchSchema, TAllParams, TAllContext>;
|
|
46
|
-
}
|
|
47
|
-
interface RegisterErrorRouteProps<TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TAllContext extends Record<string, any> = AnyContext> {
|
|
48
|
-
ErrorRouteProps: ErrorRouteProps;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
export type RouteProps<TLoader = unknown, TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TAllContext extends Record<string, any> = AnyContext> = {
|
|
52
|
-
useLoader: <TSelected = TLoader>(opts?: {
|
|
53
|
-
select?: (search: TLoader) => TSelected;
|
|
54
|
-
}) => UseLoaderResult<TSelected>;
|
|
2
|
+
import { LinkOptions, ToOptions, ResolveRelativePath, NavigateOptions } from './link';
|
|
3
|
+
import { AnySearchSchema, AnyPathParams, AnyContext, AnyRoute } from './route';
|
|
4
|
+
import { RoutePaths, RouteByPath, RouteIds, ParseRoute, RoutesById, RouteById, AllParams } from './routeInfo';
|
|
5
|
+
import { RegisteredRouter, RouterOptions, Router, RouterState } from './router';
|
|
6
|
+
import { RouteMatch } from './RouteMatch';
|
|
7
|
+
import { NoInfer } from './utils';
|
|
8
|
+
import { MatchRouteOptions, RouterContext } from './RouterProvider';
|
|
9
|
+
export type RouteProps<TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TAllContext extends Record<string, any> = AnyContext> = {
|
|
55
10
|
useMatch: <TSelected = TAllContext>(opts?: {
|
|
56
11
|
select?: (search: TAllContext) => TSelected;
|
|
57
12
|
}) => TSelected;
|
|
58
|
-
|
|
13
|
+
useRouteMeta: <TSelected = TAllContext>(opts?: {
|
|
59
14
|
select?: (search: TAllContext) => TSelected;
|
|
60
15
|
}) => TSelected;
|
|
61
16
|
useSearch: <TSelected = TFullSearchSchema>(opts?: {
|
|
@@ -70,22 +25,17 @@ export type ErrorRouteProps<TFullSearchSchema extends Record<string, any> = AnyS
|
|
|
70
25
|
info: {
|
|
71
26
|
componentStack: string;
|
|
72
27
|
};
|
|
73
|
-
} &
|
|
74
|
-
export type PendingRouteProps<TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TAllContext extends Record<string, any> = AnyContext> =
|
|
28
|
+
} & RouteProps<TFullSearchSchema, TAllParams, TAllContext>;
|
|
29
|
+
export type PendingRouteProps<TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TAllContext extends Record<string, any> = AnyContext> = RouteProps<TFullSearchSchema, TAllParams, TAllContext>;
|
|
75
30
|
type ReactNode = any;
|
|
76
31
|
export type SyncRouteComponent<TProps> = ((props: TProps) => ReactNode) | React.LazyExoticComponent<(props: TProps) => ReactNode>;
|
|
77
32
|
export type AsyncRouteComponent<TProps> = SyncRouteComponent<TProps> & {
|
|
78
33
|
preload?: () => Promise<void>;
|
|
79
34
|
};
|
|
80
|
-
export type
|
|
81
|
-
export type
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
componentStack: string;
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
export type AnyRouteComponent = RouteComponent<AnyRouteProps>;
|
|
88
|
-
export type RouteComponent<TProps> = AsyncRouteComponent<TProps>;
|
|
35
|
+
export type RouteComponent<TFullSearchSchema extends Record<string, any>, TAllParams extends AnyPathParams, TAllContext extends Record<string, any>> = AsyncRouteComponent<RouteProps<TFullSearchSchema, TAllParams, TAllContext>>;
|
|
36
|
+
export type ErrorRouteComponent<TFullSearchSchema extends Record<string, any>, TAllParams extends AnyPathParams, TAllContext extends Record<string, any>> = AsyncRouteComponent<ErrorRouteProps<TFullSearchSchema, TAllParams, TAllContext>>;
|
|
37
|
+
export type PendingRouteComponent<TFullSearchSchema extends Record<string, any>, TAllParams extends AnyPathParams, TAllContext extends Record<string, any>> = AsyncRouteComponent<PendingRouteProps<TFullSearchSchema, TAllParams, TAllContext>>;
|
|
38
|
+
export type AnyRouteComponent = RouteComponent<any, any, any>;
|
|
89
39
|
export declare function lazyRouteComponent<T extends Record<string, any>, TKey extends keyof T = 'default'>(importer: () => Promise<T>, exportName?: TKey): T[TKey] extends (props: infer TProps) => any ? AsyncRouteComponent<TProps> : never;
|
|
90
40
|
export type LinkPropsOptions<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> = '/', TMaskTo extends string = ''> = LinkOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> & {
|
|
91
41
|
activeProps?: React.AnchorHTMLAttributes<HTMLAnchorElement> | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>);
|
|
@@ -113,17 +63,15 @@ export interface LinkComponent<TProps extends Record<string, any> = {}> {
|
|
|
113
63
|
}
|
|
114
64
|
export declare const Link: LinkComponent;
|
|
115
65
|
export declare function Navigate<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> = '/', TMaskTo extends string = ''>(props: NavigateOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>): null;
|
|
116
|
-
export declare const
|
|
117
|
-
export declare const routerContext: React.Context<import("@tanstack/router-core").AnyRouter>;
|
|
66
|
+
export declare const matchesContext: React.Context<RouteMatch<AnyRoute, any>[]>;
|
|
118
67
|
export type RouterProps<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TDehydrated extends Record<string, any> = Record<string, any>> = Omit<RouterOptions<TRouteTree, TDehydrated>, 'context'> & {
|
|
119
68
|
router: Router<TRouteTree>;
|
|
120
|
-
context?: Partial<RouterOptions<TRouteTree, TDehydrated>['
|
|
69
|
+
context?: Partial<RouterOptions<TRouteTree, TDehydrated>['meta']>;
|
|
121
70
|
};
|
|
122
|
-
export declare function
|
|
123
|
-
|
|
71
|
+
export declare function useRouter<TRouteTree extends AnyRoute = RegisteredRouter['routeTree']>(): RouterContext<TRouteTree>;
|
|
72
|
+
export declare function useRouterState<TSelected = RouterState<RegisteredRouter['routeTree']>>(opts?: {
|
|
73
|
+
select: (state: RouterState<RegisteredRouter['routeTree']>) => TSelected;
|
|
124
74
|
}): TSelected;
|
|
125
|
-
export declare function RouterProvider<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TDehydrated extends Record<string, any> = Record<string, any>>({ router, ...rest }: RouterProps<TRouteTree, TDehydrated>): JSX.Element;
|
|
126
|
-
export declare function useRouter(): RegisteredRouter;
|
|
127
75
|
export declare function useMatches<T = RouteMatch[]>(opts?: {
|
|
128
76
|
select?: (matches: RouteMatch[]) => T;
|
|
129
77
|
}): T;
|
|
@@ -138,14 +86,8 @@ export declare function useMatch<TRouteTree extends AnyRoute = RegisteredRouter[
|
|
|
138
86
|
select?: (match: TRouteMatchState) => TSelected;
|
|
139
87
|
}): TStrict extends true ? TRouteMatchState : TRouteMatchState | undefined;
|
|
140
88
|
export type RouteFromIdOrRoute<T, TRouteTree extends AnyRoute = RegisteredRouter['routeTree']> = T extends ParseRoute<TRouteTree> ? T : T extends RouteIds<TRouteTree> ? RoutesById<TRouteTree>[T] : T extends string ? RouteIds<TRouteTree> : never;
|
|
141
|
-
export declare function
|
|
142
|
-
select?: (search:
|
|
143
|
-
}): TStrict extends true ? TSelected : TSelected | undefined;
|
|
144
|
-
export declare function useRouterContext<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RouteIds<TRouteTree> = RouteIds<TRouteTree>, TStrict extends boolean = true, TContext = RouteById<TRouteTree, TFrom>['types']['context'], TSelected = TContext>(opts: StrictOrFrom<TFrom> & {
|
|
145
|
-
select?: (search: TContext) => TSelected;
|
|
146
|
-
}): TStrict extends true ? TSelected : TSelected | undefined;
|
|
147
|
-
export declare function useRouteContext<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RouteIds<TRouteTree> = RouteIds<TRouteTree>, TStrict extends boolean = true, TRouteContext = RouteById<TRouteTree, TFrom>['types']['context'], TSelected = TRouteContext>(opts: StrictOrFrom<TFrom> & {
|
|
148
|
-
select?: (search: TRouteContext) => TSelected;
|
|
89
|
+
export declare function useRouteMeta<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RouteIds<TRouteTree> = RouteIds<TRouteTree>, TStrict extends boolean = true, TRouteMeta = RouteById<TRouteTree, TFrom>['types']['allMeta'], TSelected = TRouteMeta>(opts: StrictOrFrom<TFrom> & {
|
|
90
|
+
select?: (search: TRouteMeta) => TSelected;
|
|
149
91
|
}): TStrict extends true ? TSelected : TSelected | undefined;
|
|
150
92
|
export declare function useSearch<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RouteIds<TRouteTree> = RouteIds<TRouteTree>, TStrict extends boolean = true, TSearch = RouteById<TRouteTree, TFrom>['types']['fullSearchSchema'], TSelected = TSearch>(opts: StrictOrFrom<TFrom> & {
|
|
151
93
|
select?: (search: TSearch) => TSelected;
|
|
@@ -157,11 +99,9 @@ export declare function useNavigate<TRouteTree extends AnyRoute = RegisteredRout
|
|
|
157
99
|
from?: TDefaultFrom;
|
|
158
100
|
}): <TFrom extends RoutePaths<TRouteTree> = TDefaultFrom, TTo extends string = "", TMaskFrom extends RoutePaths<TRouteTree> = "/", TMaskTo extends string = "">(opts?: NavigateOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> | undefined) => Promise<void>;
|
|
159
101
|
export declare function useMatchRoute<TRouteTree extends AnyRoute = RegisteredRouter['routeTree']>(): <TFrom extends RoutePaths<TRouteTree> = "/", TTo extends string = "", TMaskFrom extends RoutePaths<TRouteTree> = "/", TMaskTo extends string = "", TResolved extends string = ResolveRelativePath<TFrom, NoInfer<TTo>>>(opts: MakeUseMatchRouteOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>) => false | RouteById<TRouteTree, TResolved>["types"]["allParams"];
|
|
102
|
+
export declare function Matches(): JSX.Element;
|
|
160
103
|
export declare function MatchRoute<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> = '/', TMaskTo extends string = ''>(props: MakeMatchRouteOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>): any;
|
|
161
104
|
export declare function Outlet(): JSX.Element | null;
|
|
162
|
-
export declare function useInjectHtml(): (html: string | (() => Promise<string> | string)) => void;
|
|
163
|
-
export declare function useDehydrate(): <T>(key: any, data: T | (() => T | Promise<T>)) => () => T | undefined;
|
|
164
|
-
export declare function useHydrate(): <T = unknown>(key: any) => T;
|
|
165
105
|
export declare function CatchBoundary(props: {
|
|
166
106
|
resetKey: string;
|
|
167
107
|
children: any;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NavigateOptions } from './link';
|
|
2
|
+
import { AnyRoute } from './route';
|
|
3
|
+
import { RoutePaths } from './routeInfo';
|
|
4
|
+
import { RegisteredRouter } from './router';
|
|
5
|
+
export type AnyRedirect = Redirect<any, any, any>;
|
|
6
|
+
export type Redirect<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> = TFrom, TMaskTo extends string = ''> = NavigateOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> & {
|
|
7
|
+
code?: number;
|
|
8
|
+
};
|
|
9
|
+
export declare function redirect<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = ''>(opts: Redirect<TRouteTree, TFrom, TTo>): Redirect<TRouteTree, TFrom, TTo>;
|
|
10
|
+
export declare function isRedirect(obj: any): obj is AnyRedirect;
|