@tanstack/react-router 1.114.24 → 1.114.27

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.
@@ -1,8 +1,6 @@
1
- import { Store } from '@tanstack/react-store';
1
+ import { RouterCore, AnyRoute, CreateRouterFn, RouterConstructorOptions, TrailingSlashOption } from '@tanstack/router-core';
2
2
  import { RouterHistory } from '@tanstack/history';
3
- import { AnyRedirect, AnyRoute, AnyRouteMatch, AnyRouter, BuildLocationFn, BuildNextOptions, ClearCacheFn, CommitLocationFn, CommitLocationOptions, ControlledPromise, Router as CoreRouter, EmitFn, FullSearchSchema, GetMatchFn, GetMatchRoutesFn, InjectedHtmlEntry, InvalidateFn, LoadFn, MakeRouteMatch, Manifest, MatchRouteFn, MatchRoutesFn, NavigateFn, NotFoundError, ParseLocationFn, ParsedLocation, PickAsRequired, PreloadRouteFn, ResolvedRedirect, RouterConstructorOptions, RouterEvent, RouterListener, RouterOptions, RouterState, RoutesById, RoutesByPath, StartSerializer, StartTransitionFn, SubscribeFn, TrailingSlashOption, UpdateFn, UpdateMatchFn, ViewTransitionOptions } from '@tanstack/router-core';
4
3
  import { ErrorRouteComponent, NotFoundRouteComponent, RouteComponent } from './route.js';
5
- import type * as React from 'react';
6
4
  declare module '@tanstack/router-core' {
7
5
  interface RouterOptionsExtensions {
8
6
  /**
@@ -68,109 +66,7 @@ declare module '@tanstack/router-core' {
68
66
  defaultOnCatch?: (error: Error, errorInfo: React.ErrorInfo) => void;
69
67
  }
70
68
  }
71
- export declare const componentTypes: readonly ["component", "errorComponent", "pendingComponent", "notFoundComponent"];
72
- export declare function createRouter<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TDefaultStructuralSharingOption extends boolean, TRouterHistory extends RouterHistory = RouterHistory, TDehydrated extends Record<string, any> = Record<string, any>>(options: undefined extends number ? 'strictNullChecks must be enabled in tsconfig.json' : RouterConstructorOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>): CoreRouter<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>;
73
- export declare class Router<in out TRouteTree extends AnyRoute, in out TTrailingSlashOption extends TrailingSlashOption, in out TDefaultStructuralSharingOption extends boolean, in out TRouterHistory extends RouterHistory = RouterHistory, in out TDehydrated extends Record<string, any> = Record<string, any>> implements CoreRouter<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated> {
74
- tempLocationKey: string | undefined;
75
- resetNextScroll: boolean;
76
- shouldViewTransition?: boolean | ViewTransitionOptions;
77
- isViewTransitionTypesSupported?: boolean;
78
- subscribers: Set<RouterListener<RouterEvent>>;
79
- viewTransitionPromise?: ControlledPromise<true>;
80
- isScrollRestoring: boolean;
81
- isScrollRestorationSetup: boolean;
82
- __store: Store<RouterState<TRouteTree>>;
83
- options: PickAsRequired<RouterOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>, 'stringifySearch' | 'parseSearch' | 'context'>;
84
- history: TRouterHistory;
85
- latestLocation: ParsedLocation<FullSearchSchema<TRouteTree>>;
86
- basepath: string;
87
- routeTree: TRouteTree;
88
- routesById: RoutesById<TRouteTree>;
89
- routesByPath: RoutesByPath<TRouteTree>;
90
- flatRoutes: Array<AnyRoute>;
91
- isServer: boolean;
92
- pathParamsDecodeCharMap?: Map<string, string>;
93
- /**
94
- * @deprecated Use the `createRouter` function instead
95
- */
69
+ export declare const createRouter: CreateRouterFn;
70
+ 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> {
96
71
  constructor(options: RouterConstructorOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>);
97
- startTransition: StartTransitionFn;
98
- update: UpdateFn<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>;
99
- get state(): RouterState<TRouteTree, import('@tanstack/router-core').RouteMatch<any, any, any, any, any, any, any>>;
100
- buildRouteTree: () => void;
101
- subscribe: SubscribeFn;
102
- emit: EmitFn;
103
- parseLocation: ParseLocationFn<TRouteTree>;
104
- resolvePathWithBase: (from: string, path: string) => string;
105
- get looseRoutesById(): Record<string, AnyRoute>;
106
- /**
107
- @deprecated use the following signature instead
108
- ```ts
109
- matchRoutes (
110
- next: ParsedLocation,
111
- opts?: { preload?: boolean; throwOnError?: boolean },
112
- ): Array<AnyRouteMatch>;
113
- ```
114
- */
115
- matchRoutes: MatchRoutesFn;
116
- private matchRoutesInternal;
117
- getMatchedRoutes: GetMatchRoutesFn;
118
- cancelMatch: (id: string) => void;
119
- cancelMatches: () => void;
120
- buildLocation: BuildLocationFn;
121
- commitLocationPromise: undefined | ControlledPromise<void>;
122
- commitLocation: CommitLocationFn;
123
- buildAndCommitLocation: ({ replace, resetScroll, hashScrollIntoView, viewTransition, ignoreBlocker, href, ...rest }?: BuildNextOptions & CommitLocationOptions) => Promise<void>;
124
- navigate: NavigateFn;
125
- latestLoadPromise: undefined | Promise<void>;
126
- load: LoadFn;
127
- startViewTransition: (fn: () => Promise<void>) => void;
128
- updateMatch: UpdateMatchFn;
129
- getMatch: GetMatchFn;
130
- loadMatches: ({ location, matches, preload: allPreload, onReady, updateMatch, sync, }: {
131
- location: ParsedLocation;
132
- matches: Array<AnyRouteMatch>;
133
- preload?: boolean;
134
- onReady?: () => Promise<void>;
135
- updateMatch?: (id: string, updater: (match: AnyRouteMatch) => AnyRouteMatch) => void;
136
- getMatch?: (matchId: string) => AnyRouteMatch | undefined;
137
- sync?: boolean;
138
- }) => Promise<Array<MakeRouteMatch>>;
139
- invalidate: InvalidateFn<Router<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>>;
140
- resolveRedirect: (err: AnyRedirect) => ResolvedRedirect;
141
- clearCache: ClearCacheFn<this>;
142
- clearExpiredCache: () => void;
143
- loadRouteChunk: (route: AnyRoute) => Promise<void[]>;
144
- preloadRoute: PreloadRouteFn<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory>;
145
- matchRoute: MatchRouteFn<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory>;
146
- ssr?: {
147
- manifest: Manifest | undefined;
148
- serializer: StartSerializer;
149
- };
150
- serverSsr?: {
151
- injectedHtml: Array<InjectedHtmlEntry>;
152
- injectHtml: (getHtml: () => string | Promise<string>) => Promise<void>;
153
- injectScript: (getScript: () => string | Promise<string>, opts?: {
154
- logScript?: boolean;
155
- }) => Promise<void>;
156
- streamValue: (key: string, value: any) => void;
157
- streamedKeys: Set<string>;
158
- onMatchSettled: (opts: {
159
- router: AnyRouter;
160
- match: AnyRouteMatch;
161
- }) => any;
162
- };
163
- clientSsr?: {
164
- getStreamedValue: <T>(key: string) => T | undefined;
165
- };
166
- _handleNotFound: (matches: Array<AnyRouteMatch>, err: NotFoundError, { updateMatch, }?: {
167
- updateMatch?: (id: string, updater: (match: AnyRouteMatch) => AnyRouteMatch) => void;
168
- }) => void;
169
- hasNotFoundMatch: () => boolean;
170
72
  }
171
- export declare function lazyFn<T extends Record<string, (...args: Array<any>) => any>, TKey extends keyof T = 'default'>(fn: () => Promise<T>, key?: TKey): (...args: Parameters<T[TKey]>) => Promise<Awaited<ReturnType<T[TKey]>>>;
172
- export declare class SearchParamError extends Error {
173
- }
174
- export declare class PathParamError extends Error {
175
- }
176
- export declare function getInitialRouterState(location: ParsedLocation): RouterState<any>;