@tanstack/react-router 0.0.1-beta.269 → 0.0.1-beta.270

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.
@@ -13,14 +13,12 @@ export interface RouteMatch<TRouteTree extends AnyRoute = AnyRoute, TRouteId ext
13
13
  status: 'pending' | 'success' | 'error';
14
14
  isFetching: boolean;
15
15
  showPending: boolean;
16
- invalid: boolean;
17
16
  error: unknown;
18
17
  paramsError: unknown;
19
18
  searchError: unknown;
20
19
  updatedAt: number;
21
20
  loadPromise?: Promise<void>;
22
21
  loaderData?: RouteById<TRouteTree, TRouteId>['types']['loaderData'];
23
- __resolveLoadPromise?: () => void;
24
22
  routeContext: RouteById<TRouteTree, TRouteId>['types']['routeContext'];
25
23
  context: RouteById<TRouteTree, TRouteId>['types']['allContext'];
26
24
  search: FullSearchSchema<TRouteTree> & RouteById<TRouteTree, TRouteId>['types']['fullSearchSchema'];
@@ -41,8 +39,8 @@ export interface MatchRouteOptions {
41
39
  includeSearch?: boolean;
42
40
  fuzzy?: boolean;
43
41
  }
44
- export type MakeUseMatchRouteOptions<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> = '/', TMaskTo extends string = ''> = ToOptions<AnyRoute, TFrom, TTo, TMaskFrom, TMaskTo> & MatchRouteOptions;
45
- 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"];
42
+ export type UseMatchRouteOptions<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> = '/', TMaskTo extends string = ''> = ToOptions<AnyRoute, TFrom, TTo, TMaskFrom, TMaskTo> & MatchRouteOptions;
43
+ 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: UseMatchRouteOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>) => false | RouteById<TRouteTree, TResolved>["types"]["allParams"];
46
44
  export type MakeMatchRouteOptions<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> = '/', TMaskTo extends string = ''> = ToOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> & MatchRouteOptions & {
47
45
  children?: ((params?: RouteByPath<TRouteTree, ResolveRelativePath<TFrom, NoInfer<TTo>>>['types']['allParams']) => ReactNode) | React.ReactNode;
48
46
  };
@@ -53,6 +51,9 @@ export declare function useMatch<TRouteTree extends AnyRoute = RegisteredRouter[
53
51
  export declare function useMatches<T = RouteMatch[]>(opts?: {
54
52
  select?: (matches: RouteMatch[]) => T;
55
53
  }): T;
54
+ export declare function useParentMatches<T = RouteMatch[]>(opts?: {
55
+ select?: (matches: RouteMatch[]) => T;
56
+ }): T;
56
57
  export declare function useLoaderData<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RouteIds<TRouteTree> = RouteIds<TRouteTree>, TStrict extends boolean = true, TRouteMatch extends RouteMatch<TRouteTree, TFrom> = RouteMatch<TRouteTree, TFrom>, TSelected = Required<TRouteMatch>['loaderData']>(opts: StrictOrFrom<TFrom> & {
57
58
  select?: (match: TRouteMatch) => TSelected;
58
59
  }): TStrict extends true ? TSelected : TSelected | undefined;
@@ -18,16 +18,16 @@ export declare class FileRoute<TFilePath extends keyof FileRoutesByPath, TParent
18
18
  } & {
19
19
  caseSensitive?: boolean | undefined;
20
20
  wrapInSuspense?: boolean | undefined;
21
- component?: import("./route").RouteComponent<TFullSearchSchema, TAllParams, TContext, TLoaderData> | undefined;
22
- errorComponent?: import("./route").ErrorRouteComponent<TFullSearchSchema, TAllParams, TContext> | undefined;
23
- pendingComponent?: import("./route").PendingRouteComponent<TFullSearchSchema, TAllParams, TContext> | undefined;
21
+ component?: import("./route").RouteComponent | undefined;
22
+ errorComponent?: false | import("./route").RouteComponent | null | undefined;
23
+ pendingComponent?: import("./route").RouteComponent | undefined;
24
24
  pendingMs?: number | undefined;
25
25
  pendingMinMs?: number | undefined;
26
26
  preSearchFilters?: import("./route").SearchFilter<TFullSearchSchema, TFullSearchSchema>[] | undefined;
27
27
  postSearchFilters?: import("./route").SearchFilter<TFullSearchSchema, TFullSearchSchema>[] | undefined;
28
28
  onError?: ((err: any) => void) | undefined;
29
29
  onEnter?: ((match: import("./Matches").AnyRouteMatch) => void) | undefined;
30
- onTransition?: ((match: import("./Matches").AnyRouteMatch) => void) | undefined;
30
+ onStay?: ((match: import("./Matches").AnyRouteMatch) => void) | undefined;
31
31
  onLeave?: ((match: import("./Matches").AnyRouteMatch) => void) | undefined;
32
32
  }) | undefined) => Route<TParentRoute, TPath, TFullPath, TFilePath, TId, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContext, TContext, TRouterContext, TLoaderData, TChildren, TRouteTree>;
33
33
  }
@@ -1,2 +1,2 @@
1
- import { AsyncRouteComponent } from './route';
2
- 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;
1
+ import { RouteComponent } from './route';
2
+ export declare function lazyRouteComponent<T extends Record<string, any>, TKey extends keyof T = 'default'>(importer: () => Promise<T>, exportName?: TKey): T[TKey] extends (props: any) => any ? RouteComponent : never;
@@ -1,11 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import { Trim } from './fileRoute';
3
- import { LocationState } from './location';
4
3
  import { AnyRoute, ReactNode } from './route';
5
4
  import { AllParams, FullSearchSchema, RouteByPath, RouteIds, RoutePaths } from './routeInfo';
6
5
  import { RegisteredRouter } from './router';
7
- import { MakeLinkOptions, MakeLinkPropsOptions } from './useNavigate';
6
+ import { LinkProps, UseLinkPropsOptions } from './useNavigate';
8
7
  import { Expand, NoInfer, NonNullableUpdater, PickRequired, UnionToIntersection, Updater } from './utils';
8
+ import { HistoryState } from '@tanstack/history';
9
9
  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;
10
10
  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;
11
11
  export type ParsePathParams<T extends string> = keyof {
@@ -40,7 +40,7 @@ export type ToMaskOptions<TRouteTree extends AnyRoute = RegisteredRouter['routeT
40
40
  export type ToSubOptions<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TResolved = ResolveRelativePath<TFrom, NoInfer<TTo>>> = {
41
41
  to?: ToPathOption<TRouteTree, TFrom, TTo>;
42
42
  hash?: true | Updater<string>;
43
- state?: true | NonNullableUpdater<LocationState>;
43
+ state?: true | NonNullableUpdater<HistoryState>;
44
44
  from?: TFrom;
45
45
  } & CheckPath<TRouteTree, NoInfer<TResolved>, {}> & SearchParamOptions<TRouteTree, TFrom, TTo, TResolved> & PathParamOptions<TRouteTree, TFrom, TResolved>;
46
46
  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 ? {
@@ -83,9 +83,9 @@ export type CheckIdError<TRouteTree extends AnyRoute, TInvalids> = {
83
83
  'Valid Route IDs': RouteIds<TRouteTree>;
84
84
  };
85
85
  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;
86
- export declare function useLinkProps<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> = '/', TMaskTo extends string = ''>(options: MakeLinkPropsOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>): React.AnchorHTMLAttributes<HTMLAnchorElement>;
86
+ export declare function useLinkProps<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> = '/', TMaskTo extends string = ''>(options: UseLinkPropsOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>): React.AnchorHTMLAttributes<HTMLAnchorElement>;
87
87
  export interface LinkComponent<TProps extends Record<string, any> = {}> {
88
- <TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> = '/', TMaskTo extends string = ''>(props: MakeLinkOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> & TProps & React.RefAttributes<HTMLAnchorElement>): ReactNode;
88
+ <TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> = '/', TMaskTo extends string = ''>(props: LinkProps<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> & TProps & React.RefAttributes<HTMLAnchorElement>): ReactNode;
89
89
  }
90
90
  export declare const Link: LinkComponent;
91
91
  export {};
@@ -10,5 +10,3 @@ export interface ParsedLocation<TSearchObj extends AnySearchSchema = {}> {
10
10
  maskedLocation?: ParsedLocation<TSearchObj>;
11
11
  unmaskOnReload?: boolean;
12
12
  }
13
- export interface LocationState {
14
- }
@@ -29,7 +29,7 @@ export type MetaOptions = keyof PickRequired<RouteMeta> extends never ? {
29
29
  } : {
30
30
  meta: RouteMeta;
31
31
  };
32
- export type RouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TSearchSchema extends Record<string, any> = {}, TFullSearchSchema extends Record<string, any> = TSearchSchema, TParams extends AnyPathParams = AnyPathParams, TAllParams extends AnyPathParams = TParams, TRouteContext extends RouteContext = RouteContext, TAllContext extends Record<string, any> = AnyContext, TLoaderData extends any = unknown> = BaseRouteOptions<TParentRoute, TCustomId, TPath, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContext, TAllContext, TLoaderData> & UpdatableRouteOptions<NoInfer<TFullSearchSchema>, NoInfer<TAllParams>, NoInfer<TAllContext>, NoInfer<TLoaderData>>;
32
+ export type RouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TSearchSchema extends Record<string, any> = {}, TFullSearchSchema extends Record<string, any> = TSearchSchema, TParams extends AnyPathParams = AnyPathParams, TAllParams extends AnyPathParams = TParams, TRouteContext extends RouteContext = RouteContext, TAllContext extends Record<string, any> = AnyContext, TLoaderData extends any = unknown> = BaseRouteOptions<TParentRoute, TCustomId, TPath, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContext, TAllContext, TLoaderData> & UpdatableRouteOptions<NoInfer<TFullSearchSchema>>;
33
33
  export type ParamsFallback<TPath extends string, TParams> = unknown extends TParams ? Record<ParsePathParams<TPath>, string> : TParams;
34
34
  export type BaseRouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TSearchSchema extends Record<string, any> = {}, TFullSearchSchema extends Record<string, any> = TSearchSchema, TParams extends AnyPathParams = {}, TAllParams = ParamsFallback<TPath, TParams>, TRouteContext extends RouteContext = RouteContext, TAllContext extends Record<string, any> = AnyContext, TLoaderData extends any = unknown> = RoutePathOptions<TCustomId, TPath> & {
35
35
  getParentRoute: () => TParentRoute;
@@ -63,19 +63,19 @@ type BeforeLoadFn<TFullSearchSchema extends Record<string, any>, TParentRoute ex
63
63
  buildLocation: BuildLocationFn<AnyRoute>;
64
64
  cause: 'enter' | 'stay';
65
65
  }) => Promise<TRouteContext> | TRouteContext | void;
66
- export type UpdatableRouteOptions<TFullSearchSchema extends Record<string, any>, TAllParams extends AnyPathParams, TAllContext extends AnyContext, TLoaderData extends any = unknown> = MetaOptions & {
66
+ export type UpdatableRouteOptions<TFullSearchSchema extends Record<string, any>> = MetaOptions & {
67
67
  caseSensitive?: boolean;
68
68
  wrapInSuspense?: boolean;
69
- component?: RouteComponent<TFullSearchSchema, TAllParams, TAllContext, TLoaderData>;
70
- errorComponent?: ErrorRouteComponent<TFullSearchSchema, TAllParams, TAllContext>;
71
- pendingComponent?: PendingRouteComponent<TFullSearchSchema, TAllParams, TAllContext>;
69
+ component?: RouteComponent;
70
+ errorComponent?: false | null | RouteComponent;
71
+ pendingComponent?: RouteComponent;
72
72
  pendingMs?: number;
73
73
  pendingMinMs?: number;
74
74
  preSearchFilters?: SearchFilter<TFullSearchSchema>[];
75
75
  postSearchFilters?: SearchFilter<TFullSearchSchema>[];
76
76
  onError?: (err: any) => void;
77
77
  onEnter?: (match: AnyRouteMatch) => void;
78
- onTransition?: (match: AnyRouteMatch) => void;
78
+ onStay?: (match: AnyRouteMatch) => void;
79
79
  onLeave?: (match: AnyRouteMatch) => void;
80
80
  };
81
81
  export type ParseParamsOption<TPath extends string, TParams> = ParseParamsFn<TPath, TParams>;
@@ -117,12 +117,6 @@ export type ResolveFullSearchSchema<TParentRoute, TSearchSchema> = Expand<Assign
117
117
  export interface AnyRoute extends Route<any, any, any, any, any, any, any, any, any, any, any, any, any, any> {
118
118
  }
119
119
  export type MergeFromFromParent<T, U> = IsAny<T, U, T & U>;
120
- export type StreamedPromise<T> = {
121
- promise: Promise<T>;
122
- status: 'resolved' | 'pending';
123
- data: T;
124
- resolve: (value: T) => void;
125
- };
126
120
  export type ResolveAllParams<TParentRoute extends AnyRoute, TParams extends AnyPathParams> = Record<never, string> extends TParentRoute['types']['allParams'] ? TParams : Expand<UnionToIntersection<TParentRoute['types']['allParams'] & TParams> & {}>;
127
121
  export type RouteConstraints = {
128
122
  TParentRoute: AnyRoute;
@@ -198,7 +192,7 @@ export declare class Route<TParentRoute extends RouteConstraints['TParentRoute']
198
192
  originalIndex: number;
199
193
  }) => void;
200
194
  addChildren: <TNewChildren extends AnyRoute[]>(children: TNewChildren) => Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContext, TAllContext, TRouterContext, TNewChildren, TRouteTree, AnyRoute>;
201
- update: (options: UpdatableRouteOptions<TFullSearchSchema, TAllParams, Expand<Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>>, TLoaderData>) => this;
195
+ update: (options: UpdatableRouteOptions<TFullSearchSchema>) => this;
202
196
  useMatch: <TSelected = TAllContext>(opts?: {
203
197
  select?: ((search: TAllContext) => TSelected) | undefined;
204
198
  } | undefined) => TSelected;
@@ -260,40 +254,17 @@ export type RouteMask<TRouteTree extends AnyRoute> = {
260
254
  export declare function createRouteMask<TRouteTree extends AnyRoute, TFrom extends RoutePaths<TRouteTree>, TTo extends string>(opts: {
261
255
  routeTree: TRouteTree;
262
256
  } & ToSubOptions<TRouteTree, TFrom, TTo>): RouteMask<TRouteTree>;
263
- export type RouteProps<TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TAllContext extends Record<string, any> = AnyContext, TLoaderData extends any = unknown> = {
264
- useMatch: <TSelected = TAllContext>(opts?: {
265
- select?: (search: TAllContext) => TSelected;
266
- }) => TSelected;
267
- useRouteContext: <TSelected = TAllContext>(opts?: {
268
- select?: (search: TAllContext) => TSelected;
269
- }) => TSelected;
270
- useSearch: <TSelected = TFullSearchSchema>(opts?: {
271
- select?: (search: TFullSearchSchema) => TSelected;
272
- }) => TSelected;
273
- useParams: <TSelected = TAllParams>(opts?: {
274
- select?: (search: TAllParams) => TSelected;
275
- }) => TSelected;
276
- useLoaderData: <TSelected = TLoaderData>(opts?: {
277
- select?: (search: TLoaderData) => TSelected;
278
- }) => TSelected;
279
- };
280
257
  export type ErrorRouteProps<TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TAllContext extends Record<string, any> = AnyContext> = {
281
258
  error: unknown;
282
259
  info: {
283
260
  componentStack: string;
284
261
  };
285
- } & RouteProps<TFullSearchSchema, TAllParams, TAllContext>;
286
- export type PendingRouteProps<TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TAllContext extends Record<string, any> = AnyContext> = RouteProps<TFullSearchSchema, TAllParams, TAllContext>;
262
+ };
287
263
  export type ReactNode = any;
288
- export type SyncRouteComponent<TProps> = ((props: TProps) => ReactNode) | React.LazyExoticComponent<(props: TProps) => ReactNode>;
289
- export type AsyncRouteComponent<TProps> = SyncRouteComponent<TProps> & {
264
+ export type SyncRouteComponent = (() => JSX.Element) | React.LazyExoticComponent<() => JSX.Element>;
265
+ export type RouteComponent = SyncRouteComponent & {
290
266
  preload?: () => Promise<void>;
291
267
  };
292
- export type RouteComponent<TFullSearchSchema extends Record<string, any>, TAllParams extends AnyPathParams, TAllContext extends Record<string, any>, TLoaderData extends any = unknown> = AsyncRouteComponent<RouteProps<TFullSearchSchema, TAllParams, TAllContext, TLoaderData>>;
293
- export type ErrorRouteComponent<TFullSearchSchema extends Record<string, any>, TAllParams extends AnyPathParams, TAllContext extends Record<string, any>> = AsyncRouteComponent<ErrorRouteProps<TFullSearchSchema, TAllParams, TAllContext>>;
294
- export type PendingRouteComponent<TFullSearchSchema extends Record<string, any>, TAllParams extends AnyPathParams, TAllContext extends Record<string, any>> = AsyncRouteComponent<PendingRouteProps<TFullSearchSchema, TAllParams, TAllContext>>;
295
- export type AnyRouteComponent = RouteComponent<any, any, any, any>;
296
- export type ComponentPropsFromRoute<TRoute> = TRoute extends (() => infer T extends AnyRoute) ? ComponentPropsFromRoute<T> : TRoute extends Route<infer TParentRoute, infer TPath, infer TFullPath, infer TCustomId, infer TId, infer TSearchSchema, infer TFullSearchSchema, infer TParams, infer TAllParams, infer TRouteContext, infer TAllContext, infer TRouterContext, infer TLoaderData, infer TChildren> ? RouteProps<TFullSearchSchema, TAllParams, TAllContext, TLoaderData> : {};
297
268
  export declare class NotFoundRoute<TParentRoute extends AnyRootRoute, TSearchSchema extends RouteConstraints['TSearchSchema'] = {}, TFullSearchSchema extends RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TRouteContext extends RouteConstraints['TRouteContext'] = RouteContext, TAllContext extends Expand<Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>> = Expand<Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>>, TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext, TLoaderData extends any = unknown, TChildren extends RouteConstraints['TChildren'] = unknown, TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute> extends Route<TParentRoute, '/404', '/404', '404', '404', TSearchSchema, TFullSearchSchema, {}, {}, TRouteContext, TAllContext, TRouterContext, TLoaderData, TChildren, TRouteTree> {
298
269
  constructor(options: Omit<RouteOptions<TParentRoute, string, string, TSearchSchema, TFullSearchSchema, {}, {}, TRouteContext, TAllContext, TLoaderData>, 'caseSensitive' | 'parseParams' | 'stringifyParams' | 'path' | 'id'>);
299
270
  }
@@ -1,13 +1,12 @@
1
1
  /// <reference types="react" />
2
- import { RouterHistory } from '@tanstack/history';
2
+ import { HistoryState, RouterHistory } from '@tanstack/history';
3
3
  import { Store } from '@tanstack/store';
4
- import { AnySearchSchema, AnyRoute, AnyContext, AnyPathParams, RouteMask } from './route';
4
+ import { AnySearchSchema, AnyRoute, AnyContext, RouteMask } from './route';
5
5
  import { FullSearchSchema, RoutesById, RoutesByPath } from './routeInfo';
6
6
  import { PickAsRequired, Updater, NonNullableUpdater, Timeout } from './utils';
7
- import { ErrorRouteComponent, PendingRouteComponent, RouteComponent } from './route';
7
+ import { RouteComponent } from './route';
8
8
  import { AnyRouteMatch, RouteMatch } from './Matches';
9
9
  import { ParsedLocation } from './location';
10
- import { LocationState } from './location';
11
10
  import { SearchSerializer, SearchParser } from './searchParams';
12
11
  import { BuildLocationFn, CommitLocationOptions, InjectedHtmlEntry, MatchRouteFn, NavigateFn } from './RouterProvider';
13
12
  declare global {
@@ -37,9 +36,9 @@ export interface RouterOptions<TRouteTree extends AnyRoute, TDehydrated extends
37
36
  parseSearch?: SearchParser;
38
37
  defaultPreload?: false | 'intent';
39
38
  defaultPreloadDelay?: number;
40
- defaultComponent?: RouteComponent<AnySearchSchema, AnyPathParams, AnyContext>;
41
- defaultErrorComponent?: ErrorRouteComponent<AnySearchSchema, AnyPathParams, AnyContext>;
42
- defaultPendingComponent?: PendingRouteComponent<AnySearchSchema, AnyPathParams, AnyContext>;
39
+ defaultComponent?: RouteComponent;
40
+ defaultErrorComponent?: RouteComponent;
41
+ defaultPendingComponent?: RouteComponent;
43
42
  defaultPendingMs?: number;
44
43
  defaultPendingMinMs?: number;
45
44
  caseSensitive?: boolean;
@@ -71,13 +70,13 @@ export interface BuildNextOptions {
71
70
  params?: true | Updater<unknown>;
72
71
  search?: true | Updater<unknown>;
73
72
  hash?: true | Updater<string>;
74
- state?: true | NonNullableUpdater<LocationState>;
73
+ state?: true | NonNullableUpdater<HistoryState>;
75
74
  mask?: {
76
75
  to?: string | number | null;
77
76
  params?: true | Updater<unknown>;
78
77
  search?: true | Updater<unknown>;
79
78
  hash?: true | Updater<string>;
80
- state?: true | NonNullableUpdater<LocationState>;
79
+ state?: true | NonNullableUpdater<HistoryState>;
81
80
  unmaskOnReload?: boolean;
82
81
  };
83
82
  from?: string;
@@ -85,7 +84,7 @@ export interface BuildNextOptions {
85
84
  export interface DehydratedRouterState {
86
85
  dehydratedMatches: DehydratedRouteMatch[];
87
86
  }
88
- export type DehydratedRouteMatch = Pick<RouteMatch, 'fetchedAt' | 'invalid' | 'id' | 'status' | 'updatedAt'>;
87
+ export type DehydratedRouteMatch = Pick<RouteMatch, 'fetchedAt' | 'id' | 'status' | 'updatedAt'>;
89
88
  export interface DehydratedRouter {
90
89
  state: DehydratedRouterState;
91
90
  }
@@ -6,15 +6,14 @@ import { RegisteredRouter } from './router';
6
6
  export declare function useNavigate<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TDefaultFrom extends RoutePaths<TRouteTree> = '/'>(defaultOpts?: {
7
7
  from?: TDefaultFrom;
8
8
  }): <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>;
9
- export declare function typedNavigate<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TDefaultFrom extends RoutePaths<TRouteTree> = '/'>(navigate: (opts: NavigateOptions<any>) => Promise<void>): <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>;
10
9
  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;
11
- export type MakeLinkPropsOptions<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> = '/', TMaskTo extends string = ''> = LinkPropsOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> & React.AnchorHTMLAttributes<HTMLAnchorElement>;
12
- export type MakeLinkOptions<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> = '/', TMaskTo extends string = ''> = LinkPropsOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> & {
10
+ export type UseLinkPropsOptions<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> = '/', TMaskTo extends string = ''> = ActiveLinkOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> & React.AnchorHTMLAttributes<HTMLAnchorElement>;
11
+ export type LinkProps<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> = '/', TMaskTo extends string = ''> = ActiveLinkOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> & {
13
12
  children?: React.ReactNode | ((state: {
14
13
  isActive: boolean;
15
14
  }) => React.ReactNode);
16
15
  };
17
- 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> & {
16
+ export type ActiveLinkOptions<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> & {
18
17
  activeProps?: React.AnchorHTMLAttributes<HTMLAnchorElement> | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>);
19
18
  inactiveProps?: React.AnchorHTMLAttributes<HTMLAnchorElement> | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>);
20
19
  };