@tanstack/router-core 1.112.8 → 1.112.18

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 +1 @@
1
- {"version":3,"file":"Matches.cjs","sources":["../../src/Matches.ts"],"sourcesContent":["import type { AnyRoute, StaticDataRouteOption } from './route'\nimport type {\n AllContext,\n AllLoaderData,\n AllParams,\n FullSearchSchema,\n ParseRoute,\n RouteById,\n RouteIds,\n} from './routeInfo'\nimport type { AnyRouter, RegisteredRouter } from './router'\nimport type { Constrain, ControlledPromise } from './utils'\n\nexport type AnyMatchAndValue = { match: any; value: any }\n\nexport type FindValueByIndex<\n TKey,\n TValue extends ReadonlyArray<any>,\n> = TKey extends `${infer TIndex extends number}` ? TValue[TIndex] : never\n\nexport type FindValueByKey<TKey, TValue> =\n TValue extends ReadonlyArray<any>\n ? FindValueByIndex<TKey, TValue>\n : TValue[TKey & keyof TValue]\n\nexport type CreateMatchAndValue<TMatch, TValue> = TValue extends any\n ? {\n match: TMatch\n value: TValue\n }\n : never\n\nexport type NextMatchAndValue<\n TKey,\n TMatchAndValue extends AnyMatchAndValue,\n> = TMatchAndValue extends any\n ? CreateMatchAndValue<\n TMatchAndValue['match'],\n FindValueByKey<TKey, TMatchAndValue['value']>\n >\n : never\n\nexport type IsMatchKeyOf<TValue> =\n TValue extends ReadonlyArray<any>\n ? number extends TValue['length']\n ? `${number}`\n : keyof TValue & `${number}`\n : TValue extends object\n ? keyof TValue & string\n : never\n\nexport type IsMatchPath<\n TParentPath extends string,\n TMatchAndValue extends AnyMatchAndValue,\n> = `${TParentPath}${IsMatchKeyOf<TMatchAndValue['value']>}`\n\nexport type IsMatchResult<\n TKey,\n TMatchAndValue extends AnyMatchAndValue,\n> = TMatchAndValue extends any\n ? TKey extends keyof TMatchAndValue['value']\n ? TMatchAndValue['match']\n : never\n : never\n\nexport type IsMatchParse<\n TPath,\n TMatchAndValue extends AnyMatchAndValue,\n TParentPath extends string = '',\n> = TPath extends `${string}.${string}`\n ? TPath extends `${infer TFirst}.${infer TRest}`\n ? IsMatchParse<\n TRest,\n NextMatchAndValue<TFirst, TMatchAndValue>,\n `${TParentPath}${TFirst}.`\n >\n : never\n : {\n path: IsMatchPath<TParentPath, TMatchAndValue>\n result: IsMatchResult<TPath, TMatchAndValue>\n }\n\nexport type IsMatch<TMatch, TPath> = IsMatchParse<\n TPath,\n TMatch extends any ? { match: TMatch; value: TMatch } : never\n>\n\n/**\n * Narrows matches based on a path\n * @experimental\n */\nexport const isMatch = <TMatch, TPath extends string>(\n match: TMatch,\n path: Constrain<TPath, IsMatch<TMatch, TPath>['path']>,\n): match is IsMatch<TMatch, TPath>['result'] => {\n const parts = (path as string).split('.')\n let part\n let value: any = match\n\n while ((part = parts.shift()) != null && value != null) {\n value = value[part]\n }\n\n return value != null\n}\n\nexport interface DefaultRouteMatchExtensions {\n scripts?: unknown\n links?: unknown\n headScripts?: unknown\n meta?: unknown\n}\n\nexport interface RouteMatchExtensions extends DefaultRouteMatchExtensions {}\n\nexport interface RouteMatch<\n out TRouteId,\n out TFullPath,\n out TAllParams,\n out TFullSearchSchema,\n out TLoaderData,\n out TAllContext,\n out TLoaderDeps,\n> extends RouteMatchExtensions {\n id: string\n routeId: TRouteId\n fullPath: TFullPath\n index: number\n pathname: string\n params: TAllParams\n _strictParams: TAllParams\n status: 'pending' | 'success' | 'error' | 'redirected' | 'notFound'\n isFetching: false | 'beforeLoad' | 'loader'\n error: unknown\n paramsError: unknown\n searchError: unknown\n updatedAt: number\n loadPromise?: ControlledPromise<void>\n beforeLoadPromise?: ControlledPromise<void>\n loaderPromise?: ControlledPromise<void>\n loaderData?: TLoaderData\n __routeContext: Record<string, unknown>\n __beforeLoadContext: Record<string, unknown>\n context: TAllContext\n search: TFullSearchSchema\n _strictSearch: TFullSearchSchema\n fetchCount: number\n abortController: AbortController\n cause: 'preload' | 'enter' | 'stay'\n loaderDeps: TLoaderDeps\n preload: boolean\n invalid: boolean\n headers?: Record<string, string>\n globalNotFound?: boolean\n staticData: StaticDataRouteOption\n minPendingPromise?: ControlledPromise<void>\n pendingTimeout?: ReturnType<typeof setTimeout>\n}\n\nexport type MakeRouteMatchFromRoute<TRoute extends AnyRoute> = RouteMatch<\n TRoute['types']['id'],\n TRoute['types']['fullPath'],\n TRoute['types']['allParams'],\n TRoute['types']['fullSearchSchema'],\n TRoute['types']['loaderData'],\n TRoute['types']['allContext'],\n TRoute['types']['loaderDeps']\n>\n\nexport type MakeRouteMatch<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TRouteId = RouteIds<TRouteTree>,\n TStrict extends boolean = true,\n> = RouteMatch<\n TRouteId,\n RouteById<TRouteTree, TRouteId>['types']['fullPath'],\n TStrict extends false\n ? AllParams<TRouteTree>\n : RouteById<TRouteTree, TRouteId>['types']['allParams'],\n TStrict extends false\n ? FullSearchSchema<TRouteTree>\n : RouteById<TRouteTree, TRouteId>['types']['fullSearchSchema'],\n TStrict extends false\n ? AllLoaderData<TRouteTree>\n : RouteById<TRouteTree, TRouteId>['types']['loaderData'],\n TStrict extends false\n ? AllContext<TRouteTree>\n : RouteById<TRouteTree, TRouteId>['types']['allContext'],\n RouteById<TRouteTree, TRouteId>['types']['loaderDeps']\n>\n\nexport type AnyRouteMatch = RouteMatch<any, any, any, any, any, any, any>\n\nexport type MakeRouteMatchUnion<\n TRouter extends AnyRouter = RegisteredRouter,\n TRoute extends AnyRoute = ParseRoute<TRouter['routeTree']>,\n> = TRoute extends any\n ? RouteMatch<\n TRoute['id'],\n TRoute['fullPath'],\n TRoute['types']['allParams'],\n TRoute['types']['fullSearchSchema'],\n TRoute['types']['loaderData'],\n TRoute['types']['allContext'],\n TRoute['types']['loaderDeps']\n >\n : never\n"],"names":[],"mappings":";;AA2Fa,MAAA,UAAU,CACrB,OACA,SAC8C;AACxC,QAAA,QAAS,KAAgB,MAAM,GAAG;AACpC,MAAA;AACJ,MAAI,QAAa;AAEjB,UAAQ,OAAO,MAAM,MAAY,MAAA,QAAQ,SAAS,MAAM;AACtD,YAAQ,MAAM,IAAI;AAAA,EAAA;AAGpB,SAAO,SAAS;AAClB;;"}
1
+ {"version":3,"file":"Matches.cjs","sources":["../../src/Matches.ts"],"sourcesContent":["import type { AnyRoute, StaticDataRouteOption } from './route'\nimport type {\n AllContext,\n AllLoaderData,\n AllParams,\n FullSearchSchema,\n ParseRoute,\n RouteById,\n RouteIds,\n} from './routeInfo'\nimport type { AnyRouter, RegisteredRouter } from './router'\nimport type { Constrain, ControlledPromise } from './utils'\n\nexport type AnyMatchAndValue = { match: any; value: any }\n\nexport type FindValueByIndex<\n TKey,\n TValue extends ReadonlyArray<any>,\n> = TKey extends `${infer TIndex extends number}` ? TValue[TIndex] : never\n\nexport type FindValueByKey<TKey, TValue> =\n TValue extends ReadonlyArray<any>\n ? FindValueByIndex<TKey, TValue>\n : TValue[TKey & keyof TValue]\n\nexport type CreateMatchAndValue<TMatch, TValue> = TValue extends any\n ? {\n match: TMatch\n value: TValue\n }\n : never\n\nexport type NextMatchAndValue<\n TKey,\n TMatchAndValue extends AnyMatchAndValue,\n> = TMatchAndValue extends any\n ? CreateMatchAndValue<\n TMatchAndValue['match'],\n FindValueByKey<TKey, TMatchAndValue['value']>\n >\n : never\n\nexport type IsMatchKeyOf<TValue> =\n TValue extends ReadonlyArray<any>\n ? number extends TValue['length']\n ? `${number}`\n : keyof TValue & `${number}`\n : TValue extends object\n ? keyof TValue & string\n : never\n\nexport type IsMatchPath<\n TParentPath extends string,\n TMatchAndValue extends AnyMatchAndValue,\n> = `${TParentPath}${IsMatchKeyOf<TMatchAndValue['value']>}`\n\nexport type IsMatchResult<\n TKey,\n TMatchAndValue extends AnyMatchAndValue,\n> = TMatchAndValue extends any\n ? TKey extends keyof TMatchAndValue['value']\n ? TMatchAndValue['match']\n : never\n : never\n\nexport type IsMatchParse<\n TPath,\n TMatchAndValue extends AnyMatchAndValue,\n TParentPath extends string = '',\n> = TPath extends `${string}.${string}`\n ? TPath extends `${infer TFirst}.${infer TRest}`\n ? IsMatchParse<\n TRest,\n NextMatchAndValue<TFirst, TMatchAndValue>,\n `${TParentPath}${TFirst}.`\n >\n : never\n : {\n path: IsMatchPath<TParentPath, TMatchAndValue>\n result: IsMatchResult<TPath, TMatchAndValue>\n }\n\nexport type IsMatch<TMatch, TPath> = IsMatchParse<\n TPath,\n TMatch extends any ? { match: TMatch; value: TMatch } : never\n>\n\n/**\n * Narrows matches based on a path\n * @experimental\n */\nexport const isMatch = <TMatch, TPath extends string>(\n match: TMatch,\n path: Constrain<TPath, IsMatch<TMatch, TPath>['path']>,\n): match is IsMatch<TMatch, TPath>['result'] => {\n const parts = (path as string).split('.')\n let part\n let value: any = match\n\n while ((part = parts.shift()) != null && value != null) {\n value = value[part]\n }\n\n return value != null\n}\n\nexport interface DefaultRouteMatchExtensions {\n scripts?: unknown\n links?: unknown\n headScripts?: unknown\n meta?: unknown\n}\n\nexport interface RouteMatchExtensions extends DefaultRouteMatchExtensions {}\n\nexport interface RouteMatch<\n out TRouteId,\n out TFullPath,\n out TAllParams,\n out TFullSearchSchema,\n out TLoaderData,\n out TAllContext,\n out TLoaderDeps,\n> extends RouteMatchExtensions {\n id: string\n routeId: TRouteId\n fullPath: TFullPath\n index: number\n pathname: string\n params: TAllParams\n _strictParams: TAllParams\n status: 'pending' | 'success' | 'error' | 'redirected' | 'notFound'\n isFetching: false | 'beforeLoad' | 'loader'\n error: unknown\n paramsError: unknown\n searchError: unknown\n updatedAt: number\n loadPromise?: ControlledPromise<void>\n beforeLoadPromise?: ControlledPromise<void>\n loaderPromise?: ControlledPromise<void>\n loaderData?: TLoaderData\n __routeContext: Record<string, unknown>\n __beforeLoadContext: Record<string, unknown>\n context: TAllContext\n search: TFullSearchSchema\n _strictSearch: TFullSearchSchema\n fetchCount: number\n abortController: AbortController\n cause: 'preload' | 'enter' | 'stay'\n loaderDeps: TLoaderDeps\n preload: boolean\n invalid: boolean\n headers?: Record<string, string>\n globalNotFound?: boolean\n staticData: StaticDataRouteOption\n minPendingPromise?: ControlledPromise<void>\n pendingTimeout?: ReturnType<typeof setTimeout>\n}\n\nexport type MakeRouteMatchFromRoute<TRoute extends AnyRoute> = RouteMatch<\n TRoute['types']['id'],\n TRoute['types']['fullPath'],\n TRoute['types']['allParams'],\n TRoute['types']['fullSearchSchema'],\n TRoute['types']['loaderData'],\n TRoute['types']['allContext'],\n TRoute['types']['loaderDeps']\n>\n\nexport type MakeRouteMatch<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TRouteId = RouteIds<TRouteTree>,\n TStrict extends boolean = true,\n> = RouteMatch<\n TRouteId,\n RouteById<TRouteTree, TRouteId>['types']['fullPath'],\n TStrict extends false\n ? AllParams<TRouteTree>\n : RouteById<TRouteTree, TRouteId>['types']['allParams'],\n TStrict extends false\n ? FullSearchSchema<TRouteTree>\n : RouteById<TRouteTree, TRouteId>['types']['fullSearchSchema'],\n TStrict extends false\n ? AllLoaderData<TRouteTree>\n : RouteById<TRouteTree, TRouteId>['types']['loaderData'],\n TStrict extends false\n ? AllContext<TRouteTree>\n : RouteById<TRouteTree, TRouteId>['types']['allContext'],\n RouteById<TRouteTree, TRouteId>['types']['loaderDeps']\n>\n\nexport type AnyRouteMatch = RouteMatch<any, any, any, any, any, any, any>\n\nexport type MakeRouteMatchUnion<\n TRouter extends AnyRouter = RegisteredRouter,\n TRoute extends AnyRoute = ParseRoute<TRouter['routeTree']>,\n> = TRoute extends any\n ? RouteMatch<\n TRoute['id'],\n TRoute['fullPath'],\n TRoute['types']['allParams'],\n TRoute['types']['fullSearchSchema'],\n TRoute['types']['loaderData'],\n TRoute['types']['allContext'],\n TRoute['types']['loaderDeps']\n >\n : never\n\nexport interface MatchRouteOptions {\n pending?: boolean\n caseSensitive?: boolean\n includeSearch?: boolean\n fuzzy?: boolean\n}\n"],"names":[],"mappings":";;AA2Fa,MAAA,UAAU,CACrB,OACA,SAC8C;AACxC,QAAA,QAAS,KAAgB,MAAM,GAAG;AACpC,MAAA;AACJ,MAAI,QAAa;AAEjB,UAAQ,OAAO,MAAM,MAAY,MAAA,QAAQ,SAAS,MAAM;AACtD,YAAQ,MAAM,IAAI;AAAA,EAAA;AAGpB,SAAO,SAAS;AAClB;;"}
@@ -76,3 +76,9 @@ export type MakeRouteMatchFromRoute<TRoute extends AnyRoute> = RouteMatch<TRoute
76
76
  export type MakeRouteMatch<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TRouteId = RouteIds<TRouteTree>, TStrict extends boolean = true> = RouteMatch<TRouteId, RouteById<TRouteTree, TRouteId>['types']['fullPath'], TStrict extends false ? AllParams<TRouteTree> : RouteById<TRouteTree, TRouteId>['types']['allParams'], TStrict extends false ? FullSearchSchema<TRouteTree> : RouteById<TRouteTree, TRouteId>['types']['fullSearchSchema'], TStrict extends false ? AllLoaderData<TRouteTree> : RouteById<TRouteTree, TRouteId>['types']['loaderData'], TStrict extends false ? AllContext<TRouteTree> : RouteById<TRouteTree, TRouteId>['types']['allContext'], RouteById<TRouteTree, TRouteId>['types']['loaderDeps']>;
77
77
  export type AnyRouteMatch = RouteMatch<any, any, any, any, any, any, any>;
78
78
  export type MakeRouteMatchUnion<TRouter extends AnyRouter = RegisteredRouter, TRoute extends AnyRoute = ParseRoute<TRouter['routeTree']>> = TRoute extends any ? RouteMatch<TRoute['id'], TRoute['fullPath'], TRoute['types']['allParams'], TRoute['types']['fullSearchSchema'], TRoute['types']['loaderData'], TRoute['types']['allContext'], TRoute['types']['loaderDeps']> : never;
79
+ export interface MatchRouteOptions {
80
+ pending?: boolean;
81
+ caseSensitive?: boolean;
82
+ includeSearch?: boolean;
83
+ fuzzy?: boolean;
84
+ }
@@ -1,4 +1,5 @@
1
- import { AnyRoute, RootRoute } from './route.cjs';
1
+ import { AnyContext, AnyPathParams, AnyRoute, UpdatableRouteOptions } from './route.cjs';
2
+ import { AnyValidator } from './validators.cjs';
2
3
  export interface FileRouteTypes {
3
4
  fileRoutesByFullPath: any;
4
5
  fullPaths: any;
@@ -7,6 +8,12 @@ export interface FileRouteTypes {
7
8
  id: any;
8
9
  fileRoutesById: any;
9
10
  }
10
- export type InferFileRouteTypes<TRouteTree extends AnyRoute> = TRouteTree extends RootRoute<any, any, any, any, any, any, any, infer TFileRouteTypes extends FileRouteTypes> ? unknown extends TFileRouteTypes ? never : TFileRouteTypes : never;
11
+ export type InferFileRouteTypes<TRouteTree extends AnyRoute> = unknown extends TRouteTree['types']['fileRouteTypes'] ? never : TRouteTree['types']['fileRouteTypes'] extends FileRouteTypes ? TRouteTree['types']['fileRouteTypes'] : never;
11
12
  export interface FileRoutesByPath {
12
13
  }
14
+ export type LazyRouteOptions = Pick<UpdatableRouteOptions<AnyRoute, string, string, AnyPathParams, AnyValidator, {}, AnyContext, AnyContext, AnyContext, AnyContext>, 'component' | 'errorComponent' | 'pendingComponent' | 'notFoundComponent'>;
15
+ export interface LazyRoute {
16
+ options: {
17
+ id: string;
18
+ } & LazyRouteOptions;
19
+ }
@@ -3,20 +3,20 @@ export type { DeferredPromiseState, DeferredPromise } from './defer.cjs';
3
3
  export { preloadWarning } from './link.cjs';
4
4
  export type { IsRequiredParams, ParsePathParams, AddTrailingSlash, RemoveTrailingSlashes, AddLeadingSlash, RemoveLeadingSlashes, ActiveOptions, LinkOptionsProps, ResolveCurrentPath, ResolveParentPath, ResolveRelativePath, LinkCurrentTargetElement, FindDescendantToPaths, InferDescendantToPaths, RelativeToPath, RelativeToParentPath, RelativeToCurrentPath, AbsoluteToPath, RelativeToPathAutoComplete, NavigateOptions, ToOptions, ToMaskOptions, ToSubOptions, ResolveRoute, SearchParamOptions, PathParamOptions, ToPathOption, LinkOptions, MakeOptionalPathParams, FromPathOption, MakeOptionalSearchParams, MaskOptions, ToSubOptionsProps, RequiredToOptions, } from './link.cjs';
5
5
  export type { RouteToPath, TrailingSlashOptionByRouter, ParseRoute, CodeRouteToPath, RouteIds, FullSearchSchema, FullSearchSchemaInput, AllParams, RouteById, AllContext, RoutePaths, RoutesById, RoutesByPath, AllLoaderData, RouteByPath, } from './routeInfo.cjs';
6
- export type { InferFileRouteTypes, FileRouteTypes, FileRoutesByPath, } from './fileRoute.cjs';
6
+ export type { InferFileRouteTypes, FileRouteTypes, FileRoutesByPath, LazyRoute, LazyRouteOptions, } from './fileRoute.cjs';
7
7
  export type { StartSerializer, Serializable, SerializerParse, SerializerParseBy, SerializerStringify, SerializerStringifyBy, } from './serializer.cjs';
8
8
  export type { ParsedLocation } from './location.cjs';
9
9
  export type { Manifest, RouterManagedTag } from './manifest.cjs';
10
10
  export { isMatch } from './Matches.cjs';
11
- export type { AnyMatchAndValue, FindValueByIndex, FindValueByKey, CreateMatchAndValue, NextMatchAndValue, IsMatchKeyOf, IsMatchPath, IsMatchResult, IsMatchParse, IsMatch, RouteMatch, RouteMatchExtensions, MakeRouteMatchUnion, MakeRouteMatch, AnyRouteMatch, MakeRouteMatchFromRoute, } from './Matches.cjs';
11
+ export type { AnyMatchAndValue, FindValueByIndex, FindValueByKey, CreateMatchAndValue, NextMatchAndValue, IsMatchKeyOf, IsMatchPath, IsMatchResult, IsMatchParse, IsMatch, RouteMatch, RouteMatchExtensions, MakeRouteMatchUnion, MakeRouteMatch, AnyRouteMatch, MakeRouteMatchFromRoute, MatchRouteOptions, } from './Matches.cjs';
12
12
  export { joinPaths, cleanPath, trimPathLeft, trimPathRight, trimPath, removeTrailingSlash, exactPathTest, resolvePath, parsePathname, interpolatePath, matchPathname, removeBasepath, matchByPath, } from './path.cjs';
13
13
  export type { Segment } from './path.cjs';
14
14
  export { encode, decode } from './qss.cjs';
15
15
  export { rootRouteId } from './root.cjs';
16
16
  export type { RootRouteId } from './root.cjs';
17
- export type { AnyPathParams, SearchSchemaInput, AnyContext, RouteContext, PreloadableObj, RoutePathOptions, StaticDataRouteOption, RoutePathOptionsIntersection, SearchFilter, SearchMiddlewareContext, SearchMiddleware, ResolveId, InferFullSearchSchema, InferFullSearchSchemaInput, InferAllParams, InferAllContext, MetaDescriptor, RouteLinkEntry, SearchValidator, AnySearchValidator, DefaultSearchValidator, ErrorRouteProps, ErrorComponentProps, NotFoundRouteProps, ParseSplatParams, SplatParams, ResolveParams, ParseParamsFn, StringifyParamsFn, ParamsOptions, UpdatableStaticRouteOption, LooseReturnType, LooseAsyncReturnType, ContextReturnType, ContextAsyncReturnType, ResolveRouteContext, ResolveLoaderData, RoutePrefix, TrimPath, TrimPathLeft, TrimPathRight, ResolveSearchSchemaFnInput, ResolveSearchSchemaInput, ResolveSearchSchemaFn, ResolveSearchSchema, ResolveFullSearchSchema, ResolveFullSearchSchemaInput, ResolveAllContext, BeforeLoadContextParameter, RouteContextParameter, ResolveAllParamsFromParent, AnyRoute, Route, RootRoute, RouteTypes, FullSearchSchemaOption, RemountDepsOptions, MakeRemountDepsOptionsUnion, ResolveFullPath, AnyRouteWithContext, RouteOptions, FileBaseRouteOptions, BaseRouteOptions, UpdatableRouteOptions, RouteLoaderFn, LoaderFnContext, RouteContextFn, RouteContextOptions, BeforeLoadFn, BeforeLoadContextOptions, ContextOptions, RootRouteOptions, UpdatableRouteOptionsExtensions, } from './route.cjs';
17
+ export type { AnyPathParams, SearchSchemaInput, AnyContext, RouteContext, PreloadableObj, RoutePathOptions, StaticDataRouteOption, RoutePathOptionsIntersection, SearchFilter, SearchMiddlewareContext, SearchMiddleware, ResolveId, InferFullSearchSchema, InferFullSearchSchemaInput, InferAllParams, InferAllContext, MetaDescriptor, RouteLinkEntry, SearchValidator, AnySearchValidator, DefaultSearchValidator, ErrorRouteProps, ErrorComponentProps, NotFoundRouteProps, ParseSplatParams, SplatParams, ResolveParams, ParseParamsFn, StringifyParamsFn, ParamsOptions, UpdatableStaticRouteOption, LooseReturnType, LooseAsyncReturnType, ContextReturnType, ContextAsyncReturnType, ResolveRouteContext, ResolveLoaderData, RoutePrefix, TrimPath, TrimPathLeft, TrimPathRight, ResolveSearchSchemaFnInput, ResolveSearchSchemaInput, ResolveSearchSchemaFn, ResolveSearchSchema, ResolveFullSearchSchema, ResolveFullSearchSchemaInput, ResolveAllContext, BeforeLoadContextParameter, RouteContextParameter, ResolveAllParamsFromParent, AnyRoute, Route, RouteTypes, FullSearchSchemaOption, RemountDepsOptions, MakeRemountDepsOptionsUnion, ResolveFullPath, AnyRouteWithContext, RouteOptions, FileBaseRouteOptions, BaseRouteOptions, UpdatableRouteOptions, RouteLoaderFn, LoaderFnContext, RouteContextFn, RouteContextOptions, BeforeLoadFn, BeforeLoadContextOptions, ContextOptions, RootRouteOptions, UpdatableRouteOptionsExtensions, RouteConstraints, RouteTypesById, RouteMask, RouteExtensions, RouteLazyFn, RouteAddChildrenFn, RouteAddFileChildrenFn, RouteAddFileTypesFn, } from './route.cjs';
18
18
  export { defaultSerializeError, getLocationChangeInfo } from './router.cjs';
19
- export type { ViewTransitionOptions, ExtractedBaseEntry, ExtractedStream, ExtractedPromise, ExtractedEntry, StreamState, TrailingSlashOption, Register, AnyRouter, AnyRouterWithContext, RegisteredRouter, } from './router.cjs';
19
+ export type { ViewTransitionOptions, ExtractedBaseEntry, ExtractedStream, ExtractedPromise, ExtractedEntry, StreamState, TrailingSlashOption, Register, AnyRouter, AnyRouterWithContext, RegisteredRouter, RouterState, BuildNextOptions, RouterListener, RouterEvent, ListenerFn, RouterEvents, MatchRoutesOpts, RouterOptionsExtensions, Router, DefaultRemountDepsFn, PreloadRouteFn, MatchRouteFn, RouterContextOptions, RouterOptions, RouterConstructorOptions, UpdateFn, ParseLocationFn, InvalidateFn, ControllablePromise, InjectedHtmlEntry, RouterErrorSerializer, MatchedRoutesResult, EmitFn, LoadFn, GetMatchFn, SubscribeFn, UpdateMatchFn, CommitLocationFn, GetMatchRoutesFn, MatchRoutesFn, StartTransitionFn, LoadRouteChunkFn, ServerSrr, ClearCacheFn, } from './router.cjs';
20
20
  export type { MatchLocation, CommitLocationOptions, NavigateFn, BuildLocationFn, } from './RouterProvider.cjs';
21
21
  export { retainSearchParams, stripSearchParams } from './searchMiddleware.cjs';
22
22
  export { defaultParseSearch, defaultStringifySearch, parseSearchWith, stringifySearchWith, } from './searchParams.cjs';
@@ -1,8 +1,9 @@
1
+ import { LazyRoute } from './fileRoute.cjs';
1
2
  import { NavigateOptions, ParsePathParams } from './link.cjs';
2
3
  import { ParsedLocation } from './location.cjs';
3
4
  import { AnyRouteMatch, MakeRouteMatchFromRoute, MakeRouteMatchUnion, RouteMatch } from './Matches.cjs';
4
5
  import { RootRouteId } from './root.cjs';
5
- import { ParseRoute } from './routeInfo.cjs';
6
+ import { ParseRoute, RouteById, RoutePaths } from './routeInfo.cjs';
6
7
  import { AnyRouter, RegisteredRouter } from './router.cjs';
7
8
  import { BuildLocationFn, NavigateFn } from './RouterProvider.cjs';
8
9
  import { Assign, Constrain, Expand, IntersectAssign, NoInfer } from './utils.cjs';
@@ -145,7 +146,7 @@ export interface RemountDepsOptions<in out TRouteId, in out TFullSearchSchema, i
145
146
  params: TAllParams;
146
147
  loaderDeps: TLoaderDeps;
147
148
  }
148
- export type MakeRemountDepsOptionsUnion<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TRoute extends AnyRoute = ParseRoute<TRouteTree>> = TRoute extends any ? RemountDepsOptions<TRoute['id'], TRoute['types']['fullSearchSchema'], TRoute['types']['allParams'], TRoute['types']['loaderDeps']> : never;
149
+ export type MakeRemountDepsOptionsUnion<TRouteTree extends AnyRoute = RegisteredRouter['routeTree']> = ParseRoute<TRouteTree> extends infer TRoute extends AnyRoute ? TRoute extends any ? RemountDepsOptions<TRoute['id'], TRoute['types']['fullSearchSchema'], TRoute['types']['allParams'], TRoute['types']['loaderDeps']> : never : never;
149
150
  export interface RouteTypes<in out TParentRoute extends AnyRoute, in out TPath extends string, in out TFullPath extends string, in out TCustomId extends string, in out TId extends string, in out TSearchValidator, in out TParams, in out TRouterContext, in out TRouteContextFn, in out TBeforeLoadFn, in out TLoaderDeps, in out TLoaderFn, in out TChildren, in out TFileRouteTypes> {
150
151
  parentRoute: TParentRoute;
151
152
  path: TPath;
@@ -171,23 +172,37 @@ export interface RouteTypes<in out TParentRoute extends AnyRoute, in out TPath e
171
172
  fileRouteTypes: TFileRouteTypes;
172
173
  }
173
174
  export type ResolveFullPath<TParentRoute extends AnyRoute, TPath extends string, TPrefixed = RoutePrefix<TParentRoute['fullPath'], TPath>> = TPrefixed extends RootRouteId ? '/' : TPrefixed;
174
- export interface Route<in out TParentRoute extends AnyRoute, in out TPath extends string, in out TFullPath extends string, in out TCustomId extends string, in out TId extends string, in out TSearchValidator, in out TParams, in out TRouterContext, in out TRouteContextFn, in out TBeforeLoadFn, in out TLoaderDeps, in out TLoaderFn, in out TChildren, in out TFileRouteTypes> {
175
+ export interface RouteExtensions<TId, TFullPath> {
176
+ }
177
+ export type RouteLazyFn<TRoute extends AnyRoute> = (lazyFn: () => Promise<LazyRoute>) => TRoute;
178
+ export type RouteAddChildrenFn<in out TParentRoute extends AnyRoute, in out TPath extends string, in out TFullPath extends string, in out TCustomId extends string, in out TId extends string, in out TSearchValidator, in out TParams, in out TRouterContext, in out TRouteContextFn, in out TBeforeLoadFn, in out TLoaderDeps extends Record<string, any>, in out TLoaderFn, in out TFileRouteTypes> = <const TNewChildren>(children: Constrain<TNewChildren, ReadonlyArray<AnyRoute> | Record<string, AnyRoute>>) => Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TNewChildren, TFileRouteTypes>;
179
+ export type RouteAddFileChildrenFn<in out TParentRoute extends AnyRoute, in out TPath extends string, in out TFullPath extends string, in out TCustomId extends string, in out TId extends string, in out TSearchValidator, in out TParams, in out TRouterContext, in out TRouteContextFn, in out TBeforeLoadFn, in out TLoaderDeps extends Record<string, any>, in out TLoaderFn, in out TFileRouteTypes> = <const TNewChildren>(children: TNewChildren) => Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TNewChildren, TFileRouteTypes>;
180
+ export type RouteAddFileTypesFn<TParentRoute extends AnyRoute, TPath extends string, TFullPath extends string, TCustomId extends string, TId extends string, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps extends Record<string, any>, TLoaderFn, TChildren> = <TNewFileRouteTypes>() => Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TNewFileRouteTypes>;
181
+ export interface Route<in out TParentRoute extends AnyRoute, in out TPath extends string, in out TFullPath extends string, in out TCustomId extends string, in out TId extends string, in out TSearchValidator, in out TParams, in out TRouterContext, in out TRouteContextFn, in out TBeforeLoadFn, in out TLoaderDeps extends Record<string, any>, in out TLoaderFn, in out TChildren, in out TFileRouteTypes> extends RouteExtensions<TId, TFullPath> {
175
182
  fullPath: TFullPath;
176
183
  path: TPath;
177
184
  id: TId;
185
+ parentRoute: TParentRoute;
186
+ children?: TChildren;
178
187
  types: RouteTypes<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TFileRouteTypes>;
188
+ options: RouteOptions<TParentRoute, TId, TCustomId, TFullPath, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn>;
189
+ isRoot: TParentRoute extends AnyRoute ? true : false;
190
+ _componentsPromise?: Promise<Array<void>>;
191
+ lazyFn?: () => Promise<LazyRoute>;
192
+ _lazyPromise?: Promise<void>;
193
+ rank: number;
194
+ to: TrimPathRight<TFullPath>;
195
+ init: (opts: {
196
+ originalIndex: number;
197
+ defaultSsr?: boolean;
198
+ }) => void;
199
+ update: (options: UpdatableRouteOptions<TParentRoute, TCustomId, TFullPath, TParams, TSearchValidator, TLoaderFn, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn>) => this;
200
+ lazy: RouteLazyFn<this>;
201
+ addChildren: RouteAddChildrenFn<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TFileRouteTypes>;
202
+ _addFileChildren: RouteAddFileChildrenFn<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TFileRouteTypes>;
203
+ _addFileTypes: RouteAddFileTypesFn<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren>;
179
204
  }
180
205
  export type AnyRoute = Route<any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
181
- export interface RootRoute<in out TSearchValidator, in out TRouterContext, in out TRouteContextFn, in out TBeforeLoadFn, in out TLoaderDeps extends Record<string, any>, in out TLoaderFn, in out TChildren, in out TFileRouteTypes> extends Route<any, // TParentRoute
182
- '/', // TPath
183
- '/', // TFullPath
184
- string, // TCustomId
185
- RootRouteId, // TId
186
- TSearchValidator, // TSearchValidator
187
- {}, // TParams
188
- TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, // TChildren
189
- TFileRouteTypes> {
190
- }
191
206
  export type AnyRouteWithContext<TContext> = AnyRoute & {
192
207
  types: {
193
208
  allContext: TContext;
@@ -240,7 +255,7 @@ export interface DefaultUpdatableRouteOptionsExtensions {
240
255
  notFoundComponent?: unknown;
241
256
  pendingComponent?: unknown;
242
257
  }
243
- export interface UpdatableRouteOptionsExtensions {
258
+ export interface UpdatableRouteOptionsExtensions extends DefaultUpdatableRouteOptionsExtensions {
244
259
  }
245
260
  export interface UpdatableRouteOptions<in out TParentRoute extends AnyRoute, in out TRouteId, in out TFullPath, in out TParams, in out TSearchValidator, in out TLoaderFn, in out TLoaderDeps, in out TRouterContext, in out TRouteContextFn, in out TBeforeLoadFn> extends UpdatableStaticRouteOption, UpdatableRouteOptionsExtensions {
246
261
  caseSensitive?: boolean;
@@ -303,6 +318,34 @@ RootRouteId, // TCustomId
303
318
  '', // TPath
304
319
  TSearchValidator, {}, // TParams
305
320
  TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn>, 'path' | 'id' | 'getParentRoute' | 'caseSensitive' | 'parseParams' | 'stringifyParams' | 'params'>;
321
+ export type RouteConstraints = {
322
+ TParentRoute: AnyRoute;
323
+ TPath: string;
324
+ TFullPath: string;
325
+ TCustomId: string;
326
+ TId: string;
327
+ TSearchSchema: AnySchema;
328
+ TFullSearchSchema: AnySchema;
329
+ TParams: Record<string, any>;
330
+ TAllParams: Record<string, any>;
331
+ TParentContext: AnyContext;
332
+ TRouteContext: RouteContext;
333
+ TAllContext: AnyContext;
334
+ TRouterContext: AnyContext;
335
+ TChildren: unknown;
336
+ TRouteTree: AnyRoute;
337
+ };
338
+ export type RouteTypesById<TRouter extends AnyRouter, TId> = RouteById<TRouter['routeTree'], TId>['types'];
339
+ export type RouteMask<TRouteTree extends AnyRoute> = {
340
+ routeTree: TRouteTree;
341
+ from: RoutePaths<TRouteTree>;
342
+ to?: any;
343
+ params?: any;
344
+ search?: any;
345
+ hash?: any;
346
+ state?: any;
347
+ unmaskOnReload?: boolean;
348
+ };
306
349
  /**
307
350
  * @deprecated Use `ErrorComponentProps` instead.
308
351
  */
@@ -1 +1 @@
1
- {"version":3,"file":"router.cjs","sources":["../../src/router.ts"],"sourcesContent":["import type { ParsedLocation } from './location'\nimport type { DeferredPromiseState } from './defer'\nimport type { ControlledPromise } from './utils'\nimport type { AnyRoute, AnyRouteWithContext } from './route'\n\nexport interface Register {\n // router: Router\n}\n\nexport type RegisteredRouter = Register extends {\n router: infer TRouter extends AnyRouter\n}\n ? TRouter\n : AnyRouter\n\nexport interface RouterOptions<\n in out TTrailingSlashOption extends TrailingSlashOption,\n> {\n trailingSlash?: TTrailingSlashOption\n}\n\nexport interface Router<\n in out TRouteTree extends AnyRoute,\n in out TTrailingSlashOption extends TrailingSlashOption,\n> {\n routeTree: TRouteTree\n options: RouterOptions<TTrailingSlashOption>\n}\n\nexport type AnyRouterWithContext<TContext> = Router<\n AnyRouteWithContext<TContext>,\n any\n>\n\nexport type AnyRouter = Router<any, any>\n\nexport interface ViewTransitionOptions {\n types: Array<string>\n}\n\nexport function defaultSerializeError(err: unknown) {\n if (err instanceof Error) {\n const obj = {\n name: err.name,\n message: err.message,\n }\n\n if (process.env.NODE_ENV === 'development') {\n ;(obj as any).stack = err.stack\n }\n\n return obj\n }\n\n return {\n data: err,\n }\n}\nexport interface ExtractedBaseEntry {\n dataType: '__beforeLoadContext' | 'loaderData'\n type: string\n path: Array<string>\n id: number\n matchIndex: number\n}\n\nexport interface ExtractedStream extends ExtractedBaseEntry {\n type: 'stream'\n streamState: StreamState\n}\n\nexport interface ExtractedPromise extends ExtractedBaseEntry {\n type: 'promise'\n promiseState: DeferredPromiseState<any>\n}\n\nexport type ExtractedEntry = ExtractedStream | ExtractedPromise\n\nexport type StreamState = {\n promises: Array<ControlledPromise<string | null>>\n}\n\nexport type TrailingSlashOption = 'always' | 'never' | 'preserve'\n\nexport function getLocationChangeInfo(routerState: {\n resolvedLocation?: ParsedLocation\n location: ParsedLocation\n}) {\n const fromLocation = routerState.resolvedLocation\n const toLocation = routerState.location\n const pathChanged = fromLocation?.pathname !== toLocation.pathname\n const hrefChanged = fromLocation?.href !== toLocation.href\n const hashChanged = fromLocation?.hash !== toLocation.hash\n return { fromLocation, toLocation, pathChanged, hrefChanged, hashChanged }\n}\n"],"names":[],"mappings":";;AAwCO,SAAS,sBAAsB,KAAc;AAClD,MAAI,eAAe,OAAO;AACxB,UAAM,MAAM;AAAA,MACV,MAAM,IAAI;AAAA,MACV,SAAS,IAAI;AAAA,IACf;AAEI,QAAA,QAAQ,IAAI,aAAa,eAAe;AACxC,UAAY,QAAQ,IAAI;AAAA,IAAA;AAGrB,WAAA;AAAA,EAAA;AAGF,SAAA;AAAA,IACL,MAAM;AAAA,EACR;AACF;AA2BO,SAAS,sBAAsB,aAGnC;AACD,QAAM,eAAe,YAAY;AACjC,QAAM,aAAa,YAAY;AACzB,QAAA,eAAc,6CAAc,cAAa,WAAW;AACpD,QAAA,eAAc,6CAAc,UAAS,WAAW;AAChD,QAAA,eAAc,6CAAc,UAAS,WAAW;AACtD,SAAO,EAAE,cAAc,YAAY,aAAa,aAAa,YAAY;AAC3E;;;"}
1
+ {"version":3,"file":"router.cjs","sources":["../../src/router.ts"],"sourcesContent":["import type { ParsedLocation } from './location'\nimport type { DeferredPromiseState } from './defer'\nimport type {\n ControlledPromise,\n NoInfer,\n NonNullableUpdater,\n Updater,\n} from './utils'\nimport type {\n AnyContext,\n AnyRoute,\n AnyRouteWithContext,\n MakeRemountDepsOptionsUnion,\n RouteMask,\n} from './route'\nimport type { Store } from '@tanstack/store'\nimport type {\n FullSearchSchema,\n RouteById,\n RoutePaths,\n RoutesById,\n RoutesByPath,\n} from './routeInfo'\nimport type {\n AnyRouteMatch,\n MakeRouteMatchUnion,\n MatchRouteOptions,\n} from './Matches'\nimport type { AnyRedirect, ResolvedRedirect } from './redirect'\nimport type {\n BuildLocationFn,\n CommitLocationOptions,\n NavigateFn,\n} from './RouterProvider'\nimport type {\n HistoryLocation,\n HistoryState,\n ParsedHistoryState,\n RouterHistory,\n} from '@tanstack/history'\nimport type { Manifest } from './manifest'\nimport type { StartSerializer } from './serializer'\nimport type { AnySchema } from './validators'\nimport type { NavigateOptions, ResolveRelativePath, ToOptions } from './link'\nimport type { SearchParser, SearchSerializer } from './searchParams'\n\ndeclare global {\n interface Window {\n __TSR_ROUTER__?: AnyRouter\n }\n}\n\nexport type ControllablePromise<T = any> = Promise<T> & {\n resolve: (value: T) => void\n reject: (value?: any) => void\n}\n\nexport type InjectedHtmlEntry = Promise<string>\n\nexport interface Register {\n // router: Router\n}\n\nexport type RegisteredRouter = Register extends {\n router: infer TRouter extends AnyRouter\n}\n ? TRouter\n : AnyRouter\n\nexport type DefaultRemountDepsFn<TRouteTree extends AnyRoute> = (\n opts: MakeRemountDepsOptionsUnion<TRouteTree>,\n) => any\n\nexport interface DefaultRouterOptionsExtensions {}\n\nexport interface RouterOptionsExtensions\n extends DefaultRouterOptionsExtensions {}\n\nexport interface RouterOptions<\n TRouteTree extends AnyRoute,\n TTrailingSlashOption extends TrailingSlashOption,\n TDefaultStructuralSharingOption extends boolean = false,\n TRouterHistory extends RouterHistory = RouterHistory,\n TDehydrated extends Record<string, any> = Record<string, any>,\n> extends RouterOptionsExtensions {\n /**\n * The history object that will be used to manage the browser history.\n *\n * If not provided, a new createBrowserHistory instance will be created and used.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#history-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/history-types)\n */\n history?: TRouterHistory\n /**\n * A function that will be used to stringify search params when generating links.\n *\n * @default defaultStringifySearch\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#stringifysearch-method)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/custom-search-param-serialization)\n */\n stringifySearch?: SearchSerializer\n /**\n * A function that will be used to parse search params when parsing the current location.\n *\n * @default defaultParseSearch\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#parsesearch-method)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/custom-search-param-serialization)\n */\n parseSearch?: SearchParser\n /**\n * If `false`, routes will not be preloaded by default in any way.\n *\n * If `'intent'`, routes will be preloaded by default when the user hovers over a link or a `touchstart` event is detected on a `<Link>`.\n *\n * If `'viewport'`, routes will be preloaded by default when they are within the viewport.\n *\n * @default false\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreload-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading)\n */\n defaultPreload?: false | 'intent' | 'viewport' | 'render'\n /**\n * The delay in milliseconds that a route must be hovered over or touched before it is preloaded.\n *\n * @default 50\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloaddelay-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading#preload-delay)\n */\n defaultPreloadDelay?: number\n /**\n * The default `pendingMs` a route should use if no pendingMs is provided.\n *\n * @default 1000\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpendingms-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#avoiding-pending-component-flash)\n */\n defaultPendingMs?: number\n /**\n * The default `pendingMinMs` a route should use if no pendingMinMs is provided.\n *\n * @default 500\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpendingminms-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#avoiding-pending-component-flash)\n */\n defaultPendingMinMs?: number\n /**\n * The default `staleTime` a route should use if no staleTime is provided. This is the time in milliseconds that a route will be considered fresh.\n *\n * @default 0\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultstaletime-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#key-options)\n */\n defaultStaleTime?: number\n /**\n * The default `preloadStaleTime` a route should use if no preloadStaleTime is provided.\n *\n * @default 30_000 `(30 seconds)`\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloadstaletime-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading)\n */\n defaultPreloadStaleTime?: number\n /**\n * The default `defaultPreloadGcTime` a route should use if no preloadGcTime is provided.\n *\n * @default 1_800_000 `(30 minutes)`\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloadgctime-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading)\n */\n defaultPreloadGcTime?: number\n /**\n * If `true`, route navigations will called using `document.startViewTransition()`.\n *\n * If the browser does not support this api, this option will be ignored.\n *\n * See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition) for more information on how this function works.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultviewtransition-property)\n */\n defaultViewTransition?: boolean | ViewTransitionOptions\n /**\n * The default `hashScrollIntoView` a route should use if no hashScrollIntoView is provided while navigating\n *\n * See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView) for more information on `ScrollIntoViewOptions`.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaulthashscrollintoview-property)\n */\n defaultHashScrollIntoView?: boolean | ScrollIntoViewOptions\n /**\n * @default 'fuzzy'\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#notfoundmode-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/not-found-errors#the-notfoundmode-option)\n */\n notFoundMode?: 'root' | 'fuzzy'\n /**\n * The default `gcTime` a route should use if no gcTime is provided.\n *\n * @default 1_800_000 `(30 minutes)`\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultgctime-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#key-options)\n */\n defaultGcTime?: number\n /**\n * If `true`, all routes will be matched as case-sensitive.\n *\n * @default false\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#casesensitive-property)\n */\n caseSensitive?: boolean\n /**\n *\n * The route tree that will be used to configure the router instance.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#routetree-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/routing/route-trees)\n */\n routeTree?: TRouteTree\n /**\n * The basepath for then entire router. This is useful for mounting a router instance at a subpath.\n *\n * @default '/'\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#basepath-property)\n */\n basepath?: string\n /**\n * The root context that will be provided to all routes in the route tree.\n *\n * This can be used to provide a context to all routes in the tree without having to provide it to each route individually.\n *\n * Optional or required if the root route was created with [`createRootRouteWithContext()`](https://tanstack.com/router/latest/docs/framework/react/api/router/createRootRouteWithContextFunction).\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#context-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/router-context)\n */\n context?: InferRouterContext<TRouteTree>\n /**\n * A function that will be called when the router is dehydrated.\n *\n * The return value of this function will be serialized and stored in the router's dehydrated state.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#dehydrate-method)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/external-data-loading#critical-dehydrationhydration)\n */\n dehydrate?: () => TDehydrated\n /**\n * A function that will be called when the router is hydrated.\n *\n * The return value of this function will be serialized and stored in the router's dehydrated state.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#hydrate-method)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/external-data-loading#critical-dehydrationhydration)\n */\n hydrate?: (dehydrated: TDehydrated) => void\n /**\n * An array of route masks that will be used to mask routes in the route tree.\n *\n * Route masking is when you display a route at a different path than the one it is configured to match, like a modal popup that when shared will unmask to the modal's content instead of the modal's context.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#routemasks-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/route-masking)\n */\n routeMasks?: Array<RouteMask<TRouteTree>>\n /**\n * If `true`, route masks will, by default, be removed when the page is reloaded.\n *\n * This can be overridden on a per-mask basis by setting the `unmaskOnReload` option on the mask, or on a per-navigation basis by setting the `unmaskOnReload` option in the `Navigate` options.\n *\n * @default false\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#unmaskonreload-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/route-masking#unmasking-on-page-reload)\n */\n unmaskOnReload?: boolean\n\n /**\n * Use `notFoundComponent` instead.\n *\n * @deprecated\n * See https://tanstack.com/router/v1/docs/guide/not-found-errors#migrating-from-notfoundroute for more info.\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#notfoundroute-property)\n */\n notFoundRoute?: AnyRoute\n /**\n * Configures how trailing slashes are treated.\n *\n * - `'always'` will add a trailing slash if not present\n * - `'never'` will remove the trailing slash if present\n * - `'preserve'` will not modify the trailing slash.\n *\n * @default 'never'\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#trailingslash-property)\n */\n trailingSlash?: TTrailingSlashOption\n /**\n * While usually automatic, sometimes it can be useful to force the router into a server-side state, e.g. when using the router in a non-browser environment that has access to a global.document object.\n *\n * @default typeof document !== 'undefined'\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#isserver-property)\n */\n isServer?: boolean\n\n defaultSsr?: boolean\n\n search?: {\n /**\n * Configures how unknown search params (= not returned by any `validateSearch`) are treated.\n *\n * @default false\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#search.strict-property)\n */\n strict?: boolean\n }\n\n /**\n * Configures whether structural sharing is enabled by default for fine-grained selectors.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultstructuralsharing-property)\n */\n defaultStructuralSharing?: TDefaultStructuralSharingOption\n\n /**\n * Configures which URI characters are allowed in path params that would ordinarily be escaped by encodeURIComponent.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#pathparamsallowedcharacters-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/path-params#allowed-characters)\n */\n pathParamsAllowedCharacters?: Array<\n ';' | ':' | '@' | '&' | '=' | '+' | '$' | ','\n >\n\n defaultRemountDeps?: DefaultRemountDepsFn<TRouteTree>\n\n /**\n * If `true`, scroll restoration will be enabled\n *\n * @default false\n */\n scrollRestoration?: boolean\n\n /**\n * A function that will be called to get the key for the scroll restoration cache.\n *\n * @default (location) => location.href\n */\n getScrollRestorationKey?: (location: ParsedLocation) => string\n /**\n * The default behavior for scroll restoration.\n *\n * @default 'auto'\n */\n scrollRestorationBehavior?: ScrollBehavior\n /**\n * An array of selectors that will be used to scroll to the top of the page in addition to `window`\n *\n * @default ['window']\n */\n scrollToTopSelectors?: Array<string>\n}\n\nexport interface RouterState<\n in out TRouteTree extends AnyRoute = AnyRoute,\n in out TRouteMatch = MakeRouteMatchUnion,\n> {\n status: 'pending' | 'idle'\n loadedAt: number\n isLoading: boolean\n isTransitioning: boolean\n matches: Array<TRouteMatch>\n pendingMatches?: Array<TRouteMatch>\n cachedMatches: Array<TRouteMatch>\n location: ParsedLocation<FullSearchSchema<TRouteTree>>\n resolvedLocation?: ParsedLocation<FullSearchSchema<TRouteTree>>\n statusCode: number\n redirect?: ResolvedRedirect\n}\n\nexport interface BuildNextOptions {\n to?: string | number | null\n params?: true | Updater<unknown>\n search?: true | Updater<unknown>\n hash?: true | Updater<string>\n state?: true | NonNullableUpdater<ParsedHistoryState, HistoryState>\n mask?: {\n to?: string | number | null\n params?: true | Updater<unknown>\n search?: true | Updater<unknown>\n hash?: true | Updater<string>\n state?: true | NonNullableUpdater<ParsedHistoryState, HistoryState>\n unmaskOnReload?: boolean\n }\n from?: string\n _fromLocation?: ParsedLocation\n href?: string\n}\n\ntype NavigationEventInfo = {\n fromLocation?: ParsedLocation\n toLocation: ParsedLocation\n pathChanged: boolean\n hrefChanged: boolean\n hashChanged: boolean\n}\n\nexport type RouterEvents = {\n onBeforeNavigate: {\n type: 'onBeforeNavigate'\n } & NavigationEventInfo\n onBeforeLoad: {\n type: 'onBeforeLoad'\n } & NavigationEventInfo\n onLoad: {\n type: 'onLoad'\n } & NavigationEventInfo\n onResolved: {\n type: 'onResolved'\n } & NavigationEventInfo\n onBeforeRouteMount: {\n type: 'onBeforeRouteMount'\n } & NavigationEventInfo\n onInjectedHtml: {\n type: 'onInjectedHtml'\n promise: Promise<string>\n }\n onRendered: {\n type: 'onRendered'\n } & NavigationEventInfo\n}\n\nexport type RouterEvent = RouterEvents[keyof RouterEvents]\n\nexport type ListenerFn<TEvent extends RouterEvent> = (event: TEvent) => void\n\nexport type RouterListener<TRouterEvent extends RouterEvent> = {\n eventType: TRouterEvent['type']\n fn: ListenerFn<TRouterEvent>\n}\n\nexport interface MatchRoutesOpts {\n preload?: boolean\n throwOnError?: boolean\n _buildLocation?: boolean\n dest?: BuildNextOptions\n}\n\nexport type InferRouterContext<TRouteTree extends AnyRoute> =\n TRouteTree['types']['routerContext']\n\nexport type RouterContextOptions<TRouteTree extends AnyRoute> =\n AnyContext extends InferRouterContext<TRouteTree>\n ? {\n context?: InferRouterContext<TRouteTree>\n }\n : {\n context: InferRouterContext<TRouteTree>\n }\n\nexport type RouterConstructorOptions<\n TRouteTree extends AnyRoute,\n TTrailingSlashOption extends TrailingSlashOption,\n TDefaultStructuralSharingOption extends boolean,\n TRouterHistory extends RouterHistory,\n TDehydrated extends Record<string, any>,\n> = Omit<\n RouterOptions<\n TRouteTree,\n TTrailingSlashOption,\n TDefaultStructuralSharingOption,\n TRouterHistory,\n TDehydrated\n >,\n 'context'\n> &\n RouterContextOptions<TRouteTree>\n\nexport interface RouterErrorSerializer<TSerializedError> {\n serialize: (err: unknown) => TSerializedError\n deserialize: (err: TSerializedError) => unknown\n}\n\nexport interface MatchedRoutesResult {\n matchedRoutes: Array<AnyRoute>\n routeParams: Record<string, string>\n}\n\nexport type PreloadRouteFn<\n TRouteTree extends AnyRoute,\n TTrailingSlashOption extends TrailingSlashOption,\n TDefaultStructuralSharingOption extends boolean,\n TRouterHistory extends RouterHistory,\n> = <\n TFrom extends RoutePaths<TRouteTree> | string = string,\n TTo extends string | undefined = undefined,\n TMaskFrom extends RoutePaths<TRouteTree> | string = TFrom,\n TMaskTo extends string = '',\n>(\n opts: NavigateOptions<\n Router<\n TRouteTree,\n TTrailingSlashOption,\n TDefaultStructuralSharingOption,\n TRouterHistory\n >,\n TFrom,\n TTo,\n TMaskFrom,\n TMaskTo\n >,\n) => Promise<Array<AnyRouteMatch> | undefined>\n\nexport type MatchRouteFn<\n TRouteTree extends AnyRoute,\n TTrailingSlashOption extends TrailingSlashOption,\n TDefaultStructuralSharingOption extends boolean,\n TRouterHistory extends RouterHistory,\n> = <\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string | undefined = undefined,\n TResolved = ResolveRelativePath<TFrom, NoInfer<TTo>>,\n>(\n location: ToOptions<\n Router<\n TRouteTree,\n TTrailingSlashOption,\n TDefaultStructuralSharingOption,\n TRouterHistory\n >,\n TFrom,\n TTo\n >,\n opts?: MatchRouteOptions,\n) => false | RouteById<TRouteTree, TResolved>['types']['allParams']\n\nexport type UpdateFn<\n TRouteTree extends AnyRoute,\n TTrailingSlashOption extends TrailingSlashOption,\n TDefaultStructuralSharingOption extends boolean,\n TRouterHistory extends RouterHistory,\n TDehydrated extends Record<string, any>,\n> = (\n newOptions: RouterConstructorOptions<\n TRouteTree,\n TTrailingSlashOption,\n TDefaultStructuralSharingOption,\n TRouterHistory,\n TDehydrated\n >,\n) => void\n\nexport type InvalidateFn<TRouter extends AnyRouter> = (opts?: {\n filter?: (d: MakeRouteMatchUnion<TRouter>) => boolean\n sync?: boolean\n}) => Promise<void>\n\nexport type ParseLocationFn<TRouteTree extends AnyRoute> = (\n previousLocation?: ParsedLocation<FullSearchSchema<TRouteTree>>,\n locationToParse?: HistoryLocation,\n) => ParsedLocation<FullSearchSchema<TRouteTree>>\n\nexport type GetMatchRoutesFn = (\n next: ParsedLocation,\n dest?: BuildNextOptions,\n) => {\n matchedRoutes: Array<AnyRoute>\n routeParams: Record<string, string>\n foundRoute: AnyRoute | undefined\n}\n\nexport type EmitFn = (routerEvent: RouterEvent) => void\n\nexport type LoadFn = (opts?: { sync?: boolean }) => Promise<void>\n\nexport type CommitLocationFn = ({\n viewTransition,\n ignoreBlocker,\n ...next\n}: ParsedLocation & CommitLocationOptions) => Promise<void>\n\nexport type StartTransitionFn = (fn: () => void) => void\n\nexport type SubscribeFn = <TType extends keyof RouterEvents>(\n eventType: TType,\n fn: ListenerFn<RouterEvents[TType]>,\n) => () => void\n\nexport interface MatchRoutesFn {\n (\n pathname: string,\n locationSearch: AnySchema,\n opts?: MatchRoutesOpts,\n ): Array<AnyRouteMatch>\n (next: ParsedLocation, opts?: MatchRoutesOpts): Array<AnyRouteMatch>\n (\n pathnameOrNext: string | ParsedLocation,\n locationSearchOrOpts?: AnySchema | MatchRoutesOpts,\n opts?: MatchRoutesOpts,\n ): Array<AnyRouteMatch>\n}\n\nexport type GetMatchFn = (matchId: string) => AnyRouteMatch | undefined\n\nexport type UpdateMatchFn = (\n id: string,\n updater: (match: AnyRouteMatch) => AnyRouteMatch,\n) => AnyRouteMatch\n\nexport type LoadRouteChunkFn = (route: AnyRoute) => Promise<Array<void>>\n\nexport type ResolveRedirect = (err: AnyRedirect) => ResolvedRedirect\n\nexport type ClearCacheFn<TRouter extends AnyRouter> = (opts?: {\n filter?: (d: MakeRouteMatchUnion<TRouter>) => boolean\n}) => void\n\nexport interface ServerSrr {\n injectedHtml: Array<InjectedHtmlEntry>\n injectHtml: (getHtml: () => string | Promise<string>) => Promise<void>\n injectScript: (\n getScript: () => string | Promise<string>,\n opts?: { logScript?: boolean },\n ) => Promise<void>\n streamValue: (key: string, value: any) => void\n streamedKeys: Set<string>\n onMatchSettled: (opts: { router: AnyRouter; match: AnyRouteMatch }) => any\n}\n\nexport interface Router<\n in out TRouteTree extends AnyRoute,\n in out TTrailingSlashOption extends TrailingSlashOption,\n in out TDefaultStructuralSharingOption extends boolean,\n in out TRouterHistory extends RouterHistory = RouterHistory,\n in out TDehydrated extends Record<string, any> = Record<string, any>,\n> {\n routeTree: TRouteTree\n options: RouterOptions<\n TRouteTree,\n TTrailingSlashOption,\n TDefaultStructuralSharingOption,\n TRouterHistory,\n TDehydrated\n >\n __store: Store<RouterState<TRouteTree>>\n navigate: NavigateFn\n history: TRouterHistory\n state: RouterState<TRouteTree>\n isServer: boolean\n clientSsr?: {\n getStreamedValue: <T>(key: string) => T | undefined\n }\n looseRoutesById: Record<string, AnyRoute>\n latestLocation: ParsedLocation<FullSearchSchema<TRouteTree>>\n isScrollRestoring: boolean\n resetNextScroll: boolean\n isScrollRestorationSetup: boolean\n ssr?: {\n manifest: Manifest | undefined\n serializer: StartSerializer\n }\n serverSsr?: ServerSrr\n basepath: string\n routesById: RoutesById<TRouteTree>\n routesByPath: RoutesByPath<TRouteTree>\n flatRoutes: Array<AnyRoute>\n parseLocation: ParseLocationFn<TRouteTree>\n getMatchedRoutes: GetMatchRoutesFn\n emit: EmitFn\n load: LoadFn\n commitLocation: CommitLocationFn\n buildLocation: BuildLocationFn\n startTransition: StartTransitionFn\n subscribe: SubscribeFn\n matchRoutes: MatchRoutesFn\n preloadRoute: PreloadRouteFn<\n TRouteTree,\n TTrailingSlashOption,\n TDefaultStructuralSharingOption,\n TRouterHistory\n >\n getMatch: GetMatchFn\n updateMatch: UpdateMatchFn\n matchRoute: MatchRouteFn<\n TRouteTree,\n TTrailingSlashOption,\n TDefaultStructuralSharingOption,\n TRouterHistory\n >\n update: UpdateFn<\n TRouteTree,\n TTrailingSlashOption,\n TDefaultStructuralSharingOption,\n TRouterHistory,\n TDehydrated\n >\n invalidate: InvalidateFn<\n Router<\n TRouteTree,\n TTrailingSlashOption,\n TDefaultStructuralSharingOption,\n TRouterHistory,\n TDehydrated\n >\n >\n loadRouteChunk: LoadRouteChunkFn\n resolveRedirect: ResolveRedirect\n buildRouteTree: () => void\n clearCache: ClearCacheFn<\n Router<\n TRouteTree,\n TTrailingSlashOption,\n TDefaultStructuralSharingOption,\n TRouterHistory,\n TDehydrated\n >\n >\n}\n\nexport type AnyRouterWithContext<TContext> = Router<\n AnyRouteWithContext<TContext>,\n any,\n any,\n any,\n any\n>\n\nexport type AnyRouter = Router<any, any, any, any, any>\n\nexport interface ViewTransitionOptions {\n types: Array<string>\n}\n\nexport function defaultSerializeError(err: unknown) {\n if (err instanceof Error) {\n const obj = {\n name: err.name,\n message: err.message,\n }\n\n if (process.env.NODE_ENV === 'development') {\n ;(obj as any).stack = err.stack\n }\n\n return obj\n }\n\n return {\n data: err,\n }\n}\nexport interface ExtractedBaseEntry {\n dataType: '__beforeLoadContext' | 'loaderData'\n type: string\n path: Array<string>\n id: number\n matchIndex: number\n}\n\nexport interface ExtractedStream extends ExtractedBaseEntry {\n type: 'stream'\n streamState: StreamState\n}\n\nexport interface ExtractedPromise extends ExtractedBaseEntry {\n type: 'promise'\n promiseState: DeferredPromiseState<any>\n}\n\nexport type ExtractedEntry = ExtractedStream | ExtractedPromise\n\nexport type StreamState = {\n promises: Array<ControlledPromise<string | null>>\n}\n\nexport type TrailingSlashOption = 'always' | 'never' | 'preserve'\n\nexport function getLocationChangeInfo(routerState: {\n resolvedLocation?: ParsedLocation\n location: ParsedLocation\n}) {\n const fromLocation = routerState.resolvedLocation\n const toLocation = routerState.location\n const pathChanged = fromLocation?.pathname !== toLocation.pathname\n const hrefChanged = fromLocation?.href !== toLocation.href\n const hashChanged = fromLocation?.hash !== toLocation.hash\n return { fromLocation, toLocation, pathChanged, hrefChanged, hashChanged }\n}\n"],"names":[],"mappings":";;AAwtBO,SAAS,sBAAsB,KAAc;AAClD,MAAI,eAAe,OAAO;AACxB,UAAM,MAAM;AAAA,MACV,MAAM,IAAI;AAAA,MACV,SAAS,IAAI;AAAA,IACf;AAEI,QAAA,QAAQ,IAAI,aAAa,eAAe;AACxC,UAAY,QAAQ,IAAI;AAAA,IAAA;AAGrB,WAAA;AAAA,EAAA;AAGF,SAAA;AAAA,IACL,MAAM;AAAA,EACR;AACF;AA2BO,SAAS,sBAAsB,aAGnC;AACD,QAAM,eAAe,YAAY;AACjC,QAAM,aAAa,YAAY;AACzB,QAAA,eAAc,6CAAc,cAAa,WAAW;AACpD,QAAA,eAAc,6CAAc,UAAS,WAAW;AAChD,QAAA,eAAc,6CAAc,UAAS,WAAW;AACtD,SAAO,EAAE,cAAc,YAAY,aAAa,aAAa,YAAY;AAC3E;;;"}