@tanstack/router-core 1.121.15 → 1.121.17

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.
Files changed (125) hide show
  1. package/package.json +1 -1
  2. package/src/redirect.ts +3 -0
  3. package/src/router.ts +15 -4
  4. package/dist/cjs/Matches.cjs +0 -13
  5. package/dist/cjs/Matches.cjs.map +0 -1
  6. package/dist/cjs/Matches.d.cts +0 -109
  7. package/dist/cjs/RouterProvider.d.cts +0 -26
  8. package/dist/cjs/defer.cjs +0 -25
  9. package/dist/cjs/defer.cjs.map +0 -1
  10. package/dist/cjs/defer.d.cts +0 -20
  11. package/dist/cjs/fileRoute.d.cts +0 -23
  12. package/dist/cjs/history.d.cts +0 -8
  13. package/dist/cjs/index.cjs +0 -79
  14. package/dist/cjs/index.cjs.map +0 -1
  15. package/dist/cjs/index.d.cts +0 -41
  16. package/dist/cjs/link.cjs +0 -5
  17. package/dist/cjs/link.cjs.map +0 -1
  18. package/dist/cjs/link.d.cts +0 -212
  19. package/dist/cjs/location.d.cts +0 -12
  20. package/dist/cjs/manifest.d.cts +0 -24
  21. package/dist/cjs/not-found.cjs +0 -13
  22. package/dist/cjs/not-found.cjs.map +0 -1
  23. package/dist/cjs/not-found.d.cts +0 -20
  24. package/dist/cjs/path.cjs +0 -412
  25. package/dist/cjs/path.cjs.map +0 -1
  26. package/dist/cjs/path.d.cts +0 -56
  27. package/dist/cjs/qss.cjs +0 -36
  28. package/dist/cjs/qss.cjs.map +0 -1
  29. package/dist/cjs/qss.d.cts +0 -31
  30. package/dist/cjs/redirect.cjs +0 -39
  31. package/dist/cjs/redirect.cjs.map +0 -1
  32. package/dist/cjs/redirect.d.cts +0 -41
  33. package/dist/cjs/root.cjs +0 -5
  34. package/dist/cjs/root.cjs.map +0 -1
  35. package/dist/cjs/root.d.cts +0 -2
  36. package/dist/cjs/route.cjs +0 -119
  37. package/dist/cjs/route.cjs.map +0 -1
  38. package/dist/cjs/route.d.cts +0 -432
  39. package/dist/cjs/routeInfo.d.cts +0 -54
  40. package/dist/cjs/router.cjs +0 -1795
  41. package/dist/cjs/router.cjs.map +0 -1
  42. package/dist/cjs/router.d.cts +0 -627
  43. package/dist/cjs/scroll-restoration.cjs +0 -207
  44. package/dist/cjs/scroll-restoration.cjs.map +0 -1
  45. package/dist/cjs/scroll-restoration.d.cts +0 -38
  46. package/dist/cjs/searchMiddleware.cjs +0 -42
  47. package/dist/cjs/searchMiddleware.cjs.map +0 -1
  48. package/dist/cjs/searchMiddleware.d.cts +0 -5
  49. package/dist/cjs/searchParams.cjs +0 -61
  50. package/dist/cjs/searchParams.cjs.map +0 -1
  51. package/dist/cjs/searchParams.d.cts +0 -7
  52. package/dist/cjs/serializer.d.cts +0 -22
  53. package/dist/cjs/structuralSharing.d.cts +0 -4
  54. package/dist/cjs/typePrimitives.d.cts +0 -65
  55. package/dist/cjs/useLoaderData.d.cts +0 -5
  56. package/dist/cjs/useLoaderDeps.d.cts +0 -5
  57. package/dist/cjs/useNavigate.d.cts +0 -3
  58. package/dist/cjs/useParams.d.cts +0 -5
  59. package/dist/cjs/useRouteContext.d.cts +0 -9
  60. package/dist/cjs/useSearch.d.cts +0 -5
  61. package/dist/cjs/utils.cjs +0 -165
  62. package/dist/cjs/utils.cjs.map +0 -1
  63. package/dist/cjs/utils.d.cts +0 -94
  64. package/dist/cjs/validators.d.cts +0 -51
  65. package/dist/esm/Matches.d.ts +0 -109
  66. package/dist/esm/Matches.js +0 -13
  67. package/dist/esm/Matches.js.map +0 -1
  68. package/dist/esm/RouterProvider.d.ts +0 -26
  69. package/dist/esm/defer.d.ts +0 -20
  70. package/dist/esm/defer.js +0 -25
  71. package/dist/esm/defer.js.map +0 -1
  72. package/dist/esm/fileRoute.d.ts +0 -23
  73. package/dist/esm/history.d.ts +0 -8
  74. package/dist/esm/index.d.ts +0 -41
  75. package/dist/esm/index.js +0 -79
  76. package/dist/esm/index.js.map +0 -1
  77. package/dist/esm/link.d.ts +0 -212
  78. package/dist/esm/link.js +0 -5
  79. package/dist/esm/link.js.map +0 -1
  80. package/dist/esm/location.d.ts +0 -12
  81. package/dist/esm/manifest.d.ts +0 -24
  82. package/dist/esm/not-found.d.ts +0 -20
  83. package/dist/esm/not-found.js +0 -13
  84. package/dist/esm/not-found.js.map +0 -1
  85. package/dist/esm/path.d.ts +0 -56
  86. package/dist/esm/path.js +0 -412
  87. package/dist/esm/path.js.map +0 -1
  88. package/dist/esm/qss.d.ts +0 -31
  89. package/dist/esm/qss.js +0 -36
  90. package/dist/esm/qss.js.map +0 -1
  91. package/dist/esm/redirect.d.ts +0 -41
  92. package/dist/esm/redirect.js +0 -39
  93. package/dist/esm/redirect.js.map +0 -1
  94. package/dist/esm/root.d.ts +0 -2
  95. package/dist/esm/root.js +0 -5
  96. package/dist/esm/root.js.map +0 -1
  97. package/dist/esm/route.d.ts +0 -432
  98. package/dist/esm/route.js +0 -119
  99. package/dist/esm/route.js.map +0 -1
  100. package/dist/esm/routeInfo.d.ts +0 -54
  101. package/dist/esm/router.d.ts +0 -627
  102. package/dist/esm/router.js +0 -1795
  103. package/dist/esm/router.js.map +0 -1
  104. package/dist/esm/scroll-restoration.d.ts +0 -38
  105. package/dist/esm/scroll-restoration.js +0 -207
  106. package/dist/esm/scroll-restoration.js.map +0 -1
  107. package/dist/esm/searchMiddleware.d.ts +0 -5
  108. package/dist/esm/searchMiddleware.js +0 -42
  109. package/dist/esm/searchMiddleware.js.map +0 -1
  110. package/dist/esm/searchParams.d.ts +0 -7
  111. package/dist/esm/searchParams.js +0 -61
  112. package/dist/esm/searchParams.js.map +0 -1
  113. package/dist/esm/serializer.d.ts +0 -22
  114. package/dist/esm/structuralSharing.d.ts +0 -4
  115. package/dist/esm/typePrimitives.d.ts +0 -65
  116. package/dist/esm/useLoaderData.d.ts +0 -5
  117. package/dist/esm/useLoaderDeps.d.ts +0 -5
  118. package/dist/esm/useNavigate.d.ts +0 -3
  119. package/dist/esm/useParams.d.ts +0 -5
  120. package/dist/esm/useRouteContext.d.ts +0 -9
  121. package/dist/esm/useSearch.d.ts +0 -5
  122. package/dist/esm/utils.d.ts +0 -94
  123. package/dist/esm/utils.js +0 -165
  124. package/dist/esm/utils.js.map +0 -1
  125. package/dist/esm/validators.d.ts +0 -51
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/router-core",
3
- "version": "1.121.15",
3
+ "version": "1.121.17",
4
4
  "description": "Modern and scalable routing for React applications",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
package/src/redirect.ts CHANGED
@@ -73,6 +73,9 @@ export function redirect<
73
73
  }
74
74
 
75
75
  const headers = new Headers(opts.headers || {})
76
+ if (opts.href && headers.get('Location') === null) {
77
+ headers.set('Location', opts.href)
78
+ }
76
79
 
77
80
  const response = new Response(null, {
78
81
  status: opts.statusCode,
package/src/router.ts CHANGED
@@ -28,7 +28,7 @@ import { isNotFound } from './not-found'
28
28
  import { setupScrollRestoration } from './scroll-restoration'
29
29
  import { defaultParseSearch, defaultStringifySearch } from './searchParams'
30
30
  import { rootRouteId } from './root'
31
- import { isRedirect } from './redirect'
31
+ import { isRedirect, redirect } from './redirect'
32
32
  import type { SearchParser, SearchSerializer } from './searchParams'
33
33
  import type { AnyRedirect, ResolvedRedirect } from './redirect'
34
34
  import type {
@@ -1762,6 +1762,20 @@ export class RouterCore<
1762
1762
  this.cancelMatches()
1763
1763
  this.latestLocation = this.parseLocation(this.latestLocation)
1764
1764
 
1765
+ if (this.isServer) {
1766
+ // for SPAs on the initial load, this is handled by the Transitioner
1767
+ const nextLocation = this.buildLocation({
1768
+ to: this.latestLocation.pathname,
1769
+ search: true,
1770
+ params: true,
1771
+ hash: true,
1772
+ state: true,
1773
+ _includeValidateSearch: true,
1774
+ })
1775
+ if (trimPath(this.latestLocation.href) !== trimPath(nextLocation.href)) {
1776
+ throw redirect({ href: nextLocation.href })
1777
+ }
1778
+ }
1765
1779
  // Match the routes
1766
1780
  const pendingMatches = this.matchRoutes(this.latestLocation)
1767
1781
 
@@ -2181,9 +2195,6 @@ export class RouterCore<
2181
2195
  }, pendingMs)
2182
2196
  }
2183
2197
 
2184
- console.log(`Match ${matchId} is already loading`, {
2185
- match: this.getMatch(matchId),
2186
- })
2187
2198
  // Wait for the beforeLoad to resolve before we continue
2188
2199
  await existingMatch.beforeLoadPromise
2189
2200
  executeBeforeLoad = this.getMatch(matchId)!.status === 'error'
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const isMatch = (match, path) => {
4
- const parts = path.split(".");
5
- let part;
6
- let value = match;
7
- while ((part = parts.shift()) != null && value != null) {
8
- value = value[part];
9
- }
10
- return value != null;
11
- };
12
- exports.isMatch = isMatch;
13
- //# sourceMappingURL=Matches.cjs.map
@@ -1 +0,0 @@
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\n/**\n * The `MatchRouteOptions` type is used to describe the options that can be used when matching a route.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#matchrouteoptions-type)\n */\nexport interface MatchRouteOptions {\n /**\n * If `true`, will match against pending location instead of the current location.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#pending-property)\n */\n pending?: boolean\n /**\n * If `true`, will match against the current location with case sensitivity.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#casesensitive-property)\n */\n caseSensitive?: boolean\n /**\n * If `true`, will match against the current location's search params using a deep inclusive check. e.g. `{ a: 1 }` will match for a current location of `{ a: 1, b: 2 }`.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#includesearch-property)\n */\n includeSearch?: boolean\n /**\n * If `true`, will match against the current location using a fuzzy match. e.g. `/posts` will match for a current location of `/posts/123`.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#fuzzy-property)\n */\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;;"}
@@ -1,109 +0,0 @@
1
- import { AnyRoute, StaticDataRouteOption } from './route.cjs';
2
- import { AllContext, AllLoaderData, AllParams, FullSearchSchema, ParseRoute, RouteById, RouteIds } from './routeInfo.cjs';
3
- import { AnyRouter, RegisteredRouter } from './router.cjs';
4
- import { Constrain, ControlledPromise } from './utils.cjs';
5
- export type AnyMatchAndValue = {
6
- match: any;
7
- value: any;
8
- };
9
- export type FindValueByIndex<TKey, TValue extends ReadonlyArray<any>> = TKey extends `${infer TIndex extends number}` ? TValue[TIndex] : never;
10
- export type FindValueByKey<TKey, TValue> = TValue extends ReadonlyArray<any> ? FindValueByIndex<TKey, TValue> : TValue[TKey & keyof TValue];
11
- export type CreateMatchAndValue<TMatch, TValue> = TValue extends any ? {
12
- match: TMatch;
13
- value: TValue;
14
- } : never;
15
- export type NextMatchAndValue<TKey, TMatchAndValue extends AnyMatchAndValue> = TMatchAndValue extends any ? CreateMatchAndValue<TMatchAndValue['match'], FindValueByKey<TKey, TMatchAndValue['value']>> : never;
16
- export type IsMatchKeyOf<TValue> = TValue extends ReadonlyArray<any> ? number extends TValue['length'] ? `${number}` : keyof TValue & `${number}` : TValue extends object ? keyof TValue & string : never;
17
- export type IsMatchPath<TParentPath extends string, TMatchAndValue extends AnyMatchAndValue> = `${TParentPath}${IsMatchKeyOf<TMatchAndValue['value']>}`;
18
- export type IsMatchResult<TKey, TMatchAndValue extends AnyMatchAndValue> = TMatchAndValue extends any ? TKey extends keyof TMatchAndValue['value'] ? TMatchAndValue['match'] : never : never;
19
- export type IsMatchParse<TPath, TMatchAndValue extends AnyMatchAndValue, TParentPath extends string = ''> = TPath extends `${string}.${string}` ? TPath extends `${infer TFirst}.${infer TRest}` ? IsMatchParse<TRest, NextMatchAndValue<TFirst, TMatchAndValue>, `${TParentPath}${TFirst}.`> : never : {
20
- path: IsMatchPath<TParentPath, TMatchAndValue>;
21
- result: IsMatchResult<TPath, TMatchAndValue>;
22
- };
23
- export type IsMatch<TMatch, TPath> = IsMatchParse<TPath, TMatch extends any ? {
24
- match: TMatch;
25
- value: TMatch;
26
- } : never>;
27
- /**
28
- * Narrows matches based on a path
29
- * @experimental
30
- */
31
- export declare const isMatch: <TMatch, TPath extends string>(match: TMatch, path: Constrain<TPath, IsMatch<TMatch, TPath>["path"]>) => match is IsMatch<TMatch, TPath>["result"];
32
- export interface DefaultRouteMatchExtensions {
33
- scripts?: unknown;
34
- links?: unknown;
35
- headScripts?: unknown;
36
- meta?: unknown;
37
- }
38
- export interface RouteMatchExtensions extends DefaultRouteMatchExtensions {
39
- }
40
- export interface RouteMatch<out TRouteId, out TFullPath, out TAllParams, out TFullSearchSchema, out TLoaderData, out TAllContext, out TLoaderDeps> extends RouteMatchExtensions {
41
- id: string;
42
- routeId: TRouteId;
43
- fullPath: TFullPath;
44
- index: number;
45
- pathname: string;
46
- params: TAllParams;
47
- _strictParams: TAllParams;
48
- status: 'pending' | 'success' | 'error' | 'redirected' | 'notFound';
49
- isFetching: false | 'beforeLoad' | 'loader';
50
- error: unknown;
51
- paramsError: unknown;
52
- searchError: unknown;
53
- updatedAt: number;
54
- loadPromise?: ControlledPromise<void>;
55
- beforeLoadPromise?: ControlledPromise<void>;
56
- loaderPromise?: ControlledPromise<void>;
57
- loaderData?: TLoaderData;
58
- __routeContext: Record<string, unknown>;
59
- __beforeLoadContext: Record<string, unknown>;
60
- context: TAllContext;
61
- search: TFullSearchSchema;
62
- _strictSearch: TFullSearchSchema;
63
- fetchCount: number;
64
- abortController: AbortController;
65
- cause: 'preload' | 'enter' | 'stay';
66
- loaderDeps: TLoaderDeps;
67
- preload: boolean;
68
- invalid: boolean;
69
- headers?: Record<string, string>;
70
- globalNotFound?: boolean;
71
- staticData: StaticDataRouteOption;
72
- minPendingPromise?: ControlledPromise<void>;
73
- pendingTimeout?: ReturnType<typeof setTimeout>;
74
- }
75
- export type MakeRouteMatchFromRoute<TRoute extends AnyRoute> = RouteMatch<TRoute['types']['id'], TRoute['types']['fullPath'], TRoute['types']['allParams'], TRoute['types']['fullSearchSchema'], TRoute['types']['loaderData'], TRoute['types']['allContext'], TRoute['types']['loaderDeps']>;
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
- export type AnyRouteMatch = RouteMatch<any, any, any, any, any, any, any>;
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
- /**
80
- * The `MatchRouteOptions` type is used to describe the options that can be used when matching a route.
81
- *
82
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#matchrouteoptions-type)
83
- */
84
- export interface MatchRouteOptions {
85
- /**
86
- * If `true`, will match against pending location instead of the current location.
87
- *
88
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#pending-property)
89
- */
90
- pending?: boolean;
91
- /**
92
- * If `true`, will match against the current location with case sensitivity.
93
- *
94
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#casesensitive-property)
95
- */
96
- caseSensitive?: boolean;
97
- /**
98
- * If `true`, will match against the current location's search params using a deep inclusive check. e.g. `{ a: 1 }` will match for a current location of `{ a: 1, b: 2 }`.
99
- *
100
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#includesearch-property)
101
- */
102
- includeSearch?: boolean;
103
- /**
104
- * If `true`, will match against the current location using a fuzzy match. e.g. `/posts` will match for a current location of `/posts/123`.
105
- *
106
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#fuzzy-property)
107
- */
108
- fuzzy?: boolean;
109
- }
@@ -1,26 +0,0 @@
1
- import { NavigateOptions, ToOptions } from './link.cjs';
2
- import { ParsedLocation } from './location.cjs';
3
- import { RoutePaths } from './routeInfo.cjs';
4
- import { RegisteredRouter, ViewTransitionOptions } from './router.cjs';
5
- export interface MatchLocation {
6
- to?: string | number | null;
7
- fuzzy?: boolean;
8
- caseSensitive?: boolean;
9
- from?: string;
10
- }
11
- export interface CommitLocationOptions {
12
- replace?: boolean;
13
- resetScroll?: boolean;
14
- hashScrollIntoView?: boolean | ScrollIntoViewOptions;
15
- viewTransition?: boolean | ViewTransitionOptions;
16
- /**
17
- * @deprecated All navigations use React transitions under the hood now
18
- **/
19
- startTransition?: boolean;
20
- ignoreBlocker?: boolean;
21
- }
22
- export type NavigateFn = <TRouter extends RegisteredRouter, TTo extends string | undefined, TFrom extends RoutePaths<TRouter['routeTree']> | string = string, TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom, TMaskTo extends string = ''>(opts: NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>) => Promise<void> | void;
23
- export type BuildLocationFn = <TRouter extends RegisteredRouter, TTo extends string | undefined, TFrom extends RoutePaths<TRouter['routeTree']> | string = string, TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom, TMaskTo extends string = ''>(opts: ToOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & {
24
- leaveParams?: boolean;
25
- _includeValidateSearch?: boolean;
26
- }) => ParsedLocation;
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const router = require("./router.cjs");
4
- const TSR_DEFERRED_PROMISE = Symbol.for("TSR_DEFERRED_PROMISE");
5
- function defer(_promise, options) {
6
- const promise = _promise;
7
- if (promise[TSR_DEFERRED_PROMISE]) {
8
- return promise;
9
- }
10
- promise[TSR_DEFERRED_PROMISE] = { status: "pending" };
11
- promise.then((data) => {
12
- promise[TSR_DEFERRED_PROMISE].status = "success";
13
- promise[TSR_DEFERRED_PROMISE].data = data;
14
- }).catch((error) => {
15
- promise[TSR_DEFERRED_PROMISE].status = "error";
16
- promise[TSR_DEFERRED_PROMISE].error = {
17
- data: ((options == null ? void 0 : options.serializeError) ?? router.defaultSerializeError)(error),
18
- __isServerError: true
19
- };
20
- });
21
- return promise;
22
- }
23
- exports.TSR_DEFERRED_PROMISE = TSR_DEFERRED_PROMISE;
24
- exports.defer = defer;
25
- //# sourceMappingURL=defer.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"defer.cjs","sources":["../../src/defer.ts"],"sourcesContent":["import { defaultSerializeError } from './router'\n\nexport const TSR_DEFERRED_PROMISE = Symbol.for('TSR_DEFERRED_PROMISE')\n\nexport type DeferredPromiseState<T> =\n | {\n status: 'pending'\n data?: T\n error?: unknown\n }\n | {\n status: 'success'\n data: T\n }\n | {\n status: 'error'\n data?: T\n error: unknown\n }\n\nexport type DeferredPromise<T> = Promise<T> & {\n [TSR_DEFERRED_PROMISE]: DeferredPromiseState<T>\n}\n\nexport function defer<T>(\n _promise: Promise<T>,\n options?: {\n serializeError?: typeof defaultSerializeError\n },\n) {\n const promise = _promise as DeferredPromise<T>\n // this is already deferred promise\n if ((promise as any)[TSR_DEFERRED_PROMISE]) {\n return promise\n }\n promise[TSR_DEFERRED_PROMISE] = { status: 'pending' }\n\n promise\n .then((data) => {\n promise[TSR_DEFERRED_PROMISE].status = 'success'\n promise[TSR_DEFERRED_PROMISE].data = data\n })\n .catch((error) => {\n promise[TSR_DEFERRED_PROMISE].status = 'error'\n ;(promise[TSR_DEFERRED_PROMISE] as any).error = {\n data: (options?.serializeError ?? defaultSerializeError)(error),\n __isServerError: true,\n }\n })\n\n return promise\n}\n"],"names":["defaultSerializeError"],"mappings":";;;AAEa,MAAA,uBAAuB,OAAO,IAAI,sBAAsB;AAsBrD,SAAA,MACd,UACA,SAGA;AACA,QAAM,UAAU;AAEX,MAAA,QAAgB,oBAAoB,GAAG;AACnC,WAAA;AAAA,EAAA;AAET,UAAQ,oBAAoB,IAAI,EAAE,QAAQ,UAAU;AAGjD,UAAA,KAAK,CAAC,SAAS;AACN,YAAA,oBAAoB,EAAE,SAAS;AAC/B,YAAA,oBAAoB,EAAE,OAAO;AAAA,EAAA,CACtC,EACA,MAAM,CAAC,UAAU;AACR,YAAA,oBAAoB,EAAE,SAAS;AACrC,YAAQ,oBAAoB,EAAU,QAAQ;AAAA,MAC9C,QAAO,mCAAS,mBAAkBA,OAAAA,uBAAuB,KAAK;AAAA,MAC9D,iBAAiB;AAAA,IACnB;AAAA,EAAA,CACD;AAEI,SAAA;AACT;;;"}
@@ -1,20 +0,0 @@
1
- import { defaultSerializeError } from './router.cjs';
2
- export declare const TSR_DEFERRED_PROMISE: unique symbol;
3
- export type DeferredPromiseState<T> = {
4
- status: 'pending';
5
- data?: T;
6
- error?: unknown;
7
- } | {
8
- status: 'success';
9
- data: T;
10
- } | {
11
- status: 'error';
12
- data?: T;
13
- error: unknown;
14
- };
15
- export type DeferredPromise<T> = Promise<T> & {
16
- [TSR_DEFERRED_PROMISE]: DeferredPromiseState<T>;
17
- };
18
- export declare function defer<T>(_promise: Promise<T>, options?: {
19
- serializeError?: typeof defaultSerializeError;
20
- }): DeferredPromise<T>;
@@ -1,23 +0,0 @@
1
- import { AnyContext, AnyPathParams, AnyRoute, FileBaseRouteOptions, ResolveParams, Route, RouteConstraints, UpdatableRouteOptions } from './route.cjs';
2
- import { AnyValidator } from './validators.cjs';
3
- export interface FileRouteTypes {
4
- fileRoutesByFullPath: any;
5
- fullPaths: any;
6
- to: any;
7
- fileRoutesByTo: any;
8
- id: any;
9
- fileRoutesById: any;
10
- }
11
- export type InferFileRouteTypes<TRouteTree extends AnyRoute> = unknown extends TRouteTree['types']['fileRouteTypes'] ? never : TRouteTree['types']['fileRouteTypes'] extends FileRouteTypes ? TRouteTree['types']['fileRouteTypes'] : never;
12
- export interface FileRoutesByPath {
13
- }
14
- export interface FileRouteOptions<TFilePath extends string, TParentRoute extends AnyRoute, TId extends RouteConstraints['TId'], TPath extends RouteConstraints['TPath'], TFullPath extends RouteConstraints['TFullPath'], TSearchValidator = undefined, TParams = ResolveParams<TPath>, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined> extends FileBaseRouteOptions<TParentRoute, TId, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, AnyContext, TRouteContextFn, TBeforeLoadFn>, UpdatableRouteOptions<TParentRoute, TId, TFullPath, TParams, TSearchValidator, TLoaderFn, TLoaderDeps, AnyContext, TRouteContextFn, TBeforeLoadFn> {
15
- }
16
- export type CreateFileRoute<TFilePath extends string, TParentRoute extends AnyRoute, TId extends RouteConstraints['TId'], TPath extends RouteConstraints['TPath'], TFullPath extends RouteConstraints['TFullPath']> = <TSearchValidator = undefined, TParams = ResolveParams<TPath>, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined>(options?: FileRouteOptions<TFilePath, TParentRoute, TId, TPath, TFullPath, TSearchValidator, TParams, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn>) => Route<TParentRoute, TPath, TFullPath, TFilePath, TId, TSearchValidator, TParams, AnyContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, unknown, unknown>;
17
- export type LazyRouteOptions = Pick<UpdatableRouteOptions<AnyRoute, string, string, AnyPathParams, AnyValidator, {}, AnyContext, AnyContext, AnyContext, AnyContext>, 'component' | 'errorComponent' | 'pendingComponent' | 'notFoundComponent'>;
18
- export interface LazyRoute<in out TRoute extends AnyRoute> {
19
- options: {
20
- id: string;
21
- } & LazyRouteOptions;
22
- }
23
- export type CreateLazyFileRoute<TRoute extends AnyRoute> = (opts: LazyRouteOptions) => LazyRoute<TRoute>;
@@ -1,8 +0,0 @@
1
- declare module '@tanstack/history' {
2
- interface HistoryState {
3
- __tempLocation?: HistoryLocation;
4
- __tempKey?: string;
5
- __hashScrollIntoViewOptions?: boolean | ScrollIntoViewOptions;
6
- }
7
- }
8
- export {};
@@ -1,79 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const defer = require("./defer.cjs");
4
- const link = require("./link.cjs");
5
- const Matches = require("./Matches.cjs");
6
- const path = require("./path.cjs");
7
- const qss = require("./qss.cjs");
8
- const root = require("./root.cjs");
9
- const route = require("./route.cjs");
10
- const router = require("./router.cjs");
11
- const searchMiddleware = require("./searchMiddleware.cjs");
12
- const searchParams = require("./searchParams.cjs");
13
- const utils = require("./utils.cjs");
14
- const redirect = require("./redirect.cjs");
15
- const notFound = require("./not-found.cjs");
16
- const scrollRestoration = require("./scroll-restoration.cjs");
17
- exports.TSR_DEFERRED_PROMISE = defer.TSR_DEFERRED_PROMISE;
18
- exports.defer = defer.defer;
19
- exports.preloadWarning = link.preloadWarning;
20
- exports.isMatch = Matches.isMatch;
21
- exports.cleanPath = path.cleanPath;
22
- exports.exactPathTest = path.exactPathTest;
23
- exports.interpolatePath = path.interpolatePath;
24
- exports.joinPaths = path.joinPaths;
25
- exports.matchByPath = path.matchByPath;
26
- exports.matchPathname = path.matchPathname;
27
- exports.parsePathname = path.parsePathname;
28
- exports.removeBasepath = path.removeBasepath;
29
- exports.removeTrailingSlash = path.removeTrailingSlash;
30
- exports.resolvePath = path.resolvePath;
31
- exports.trimPath = path.trimPath;
32
- exports.trimPathLeft = path.trimPathLeft;
33
- exports.trimPathRight = path.trimPathRight;
34
- exports.decode = qss.decode;
35
- exports.encode = qss.encode;
36
- exports.rootRouteId = root.rootRouteId;
37
- exports.BaseRootRoute = route.BaseRootRoute;
38
- exports.BaseRoute = route.BaseRoute;
39
- exports.BaseRouteApi = route.BaseRouteApi;
40
- exports.PathParamError = router.PathParamError;
41
- exports.RouterCore = router.RouterCore;
42
- exports.SearchParamError = router.SearchParamError;
43
- exports.componentTypes = router.componentTypes;
44
- exports.defaultSerializeError = router.defaultSerializeError;
45
- exports.getInitialRouterState = router.getInitialRouterState;
46
- exports.getLocationChangeInfo = router.getLocationChangeInfo;
47
- exports.getMatchedRoutes = router.getMatchedRoutes;
48
- exports.lazyFn = router.lazyFn;
49
- exports.processRouteTree = router.processRouteTree;
50
- exports.retainSearchParams = searchMiddleware.retainSearchParams;
51
- exports.stripSearchParams = searchMiddleware.stripSearchParams;
52
- exports.defaultParseSearch = searchParams.defaultParseSearch;
53
- exports.defaultStringifySearch = searchParams.defaultStringifySearch;
54
- exports.parseSearchWith = searchParams.parseSearchWith;
55
- exports.stringifySearchWith = searchParams.stringifySearchWith;
56
- exports.createControlledPromise = utils.createControlledPromise;
57
- exports.deepEqual = utils.deepEqual;
58
- exports.escapeJSON = utils.escapeJSON;
59
- exports.functionalUpdate = utils.functionalUpdate;
60
- exports.isPlainArray = utils.isPlainArray;
61
- exports.isPlainObject = utils.isPlainObject;
62
- exports.last = utils.last;
63
- exports.pick = utils.pick;
64
- exports.replaceEqualDeep = utils.replaceEqualDeep;
65
- exports.shallow = utils.shallow;
66
- exports.isRedirect = redirect.isRedirect;
67
- exports.isResolvedRedirect = redirect.isResolvedRedirect;
68
- exports.parseRedirect = redirect.parseRedirect;
69
- exports.redirect = redirect.redirect;
70
- exports.isNotFound = notFound.isNotFound;
71
- exports.notFound = notFound.notFound;
72
- exports.defaultGetScrollRestorationKey = scrollRestoration.defaultGetScrollRestorationKey;
73
- exports.getCssSelector = scrollRestoration.getCssSelector;
74
- exports.handleHashScroll = scrollRestoration.handleHashScroll;
75
- exports.restoreScroll = scrollRestoration.restoreScroll;
76
- exports.scrollRestorationCache = scrollRestoration.scrollRestorationCache;
77
- exports.setupScrollRestoration = scrollRestoration.setupScrollRestoration;
78
- exports.storageKey = scrollRestoration.storageKey;
79
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,41 +0,0 @@
1
- export { TSR_DEFERRED_PROMISE, defer } from './defer.cjs';
2
- export type { DeferredPromiseState, DeferredPromise } from './defer.cjs';
3
- export { preloadWarning } from './link.cjs';
4
- export type { IsRequiredParams, 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
- 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, CreateFileRoute, LazyRoute, LazyRouteOptions, CreateLazyFileRoute, } from './fileRoute.cjs';
7
- export type { StartSerializer, Serializable, SerializerParse, SerializerParseBy, SerializerStringify, SerializerStringifyBy, SerializerExtensions, } from './serializer.cjs';
8
- export type { ParsedLocation } from './location.cjs';
9
- export type { Manifest, RouterManagedTag } from './manifest.cjs';
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, MatchRouteOptions, } from './Matches.cjs';
12
- export { joinPaths, cleanPath, trimPathLeft, trimPathRight, trimPath, removeTrailingSlash, exactPathTest, resolvePath, parsePathname, interpolatePath, matchPathname, removeBasepath, matchByPath, } from './path.cjs';
13
- export type { Segment } from './path.cjs';
14
- export { encode, decode } from './qss.cjs';
15
- export { rootRouteId } from './root.cjs';
16
- export type { RootRouteId } from './root.cjs';
17
- export { BaseRoute, BaseRouteApi, BaseRootRoute } from './route.cjs';
18
- 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, ResolveParams, ParseParamsFn, StringifyParamsFn, ParamsOptions, UpdatableStaticRouteOption, 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, BeforeLoadFn, ContextOptions, RouteContextOptions, BeforeLoadContextOptions, RootRouteOptions, UpdatableRouteOptionsExtensions, RouteConstraints, RouteTypesById, RouteMask, RouteExtensions, RouteLazyFn, RouteAddChildrenFn, RouteAddFileChildrenFn, RouteAddFileTypesFn, ResolveOptionalParams, ResolveRequiredParams, RootRoute, } from './route.cjs';
19
- export { defaultSerializeError, getLocationChangeInfo, RouterCore, componentTypes, lazyFn, SearchParamError, PathParamError, getInitialRouterState, processRouteTree, getMatchedRoutes, } from './router.cjs';
20
- export type { ViewTransitionOptions, ExtractedBaseEntry, ExtractedStream, ExtractedPromise, ExtractedEntry, StreamState, TrailingSlashOption, Register, AnyRouter, AnyRouterWithContext, RegisteredRouter, RouterState, BuildNextOptions, RouterListener, RouterEvent, ListenerFn, RouterEvents, MatchRoutesOpts, RouterOptionsExtensions, DefaultRemountDepsFn, PreloadRouteFn, MatchRouteFn, RouterContextOptions, RouterOptions, RouterConstructorOptions, UpdateFn, ParseLocationFn, InvalidateFn, ControllablePromise, InjectedHtmlEntry, RouterErrorSerializer, EmitFn, LoadFn, GetMatchFn, SubscribeFn, UpdateMatchFn, CommitLocationFn, GetMatchRoutesFn, MatchRoutesFn, StartTransitionFn, LoadRouteChunkFn, ServerSrr, ClearCacheFn, CreateRouterFn, ProcessRouteTreeResult, } from './router.cjs';
21
- export type { MatchLocation, CommitLocationOptions, NavigateFn, BuildLocationFn, } from './RouterProvider.cjs';
22
- export { retainSearchParams, stripSearchParams } from './searchMiddleware.cjs';
23
- export { defaultParseSearch, defaultStringifySearch, parseSearchWith, stringifySearchWith, } from './searchParams.cjs';
24
- export type { SearchSerializer, SearchParser } from './searchParams.cjs';
25
- export type { OptionalStructuralSharing } from './structuralSharing.cjs';
26
- export { last, functionalUpdate, pick, replaceEqualDeep, isPlainObject, isPlainArray, deepEqual, escapeJSON, shallow, createControlledPromise, } from './utils.cjs';
27
- export type { NoInfer, IsAny, PickAsRequired, PickRequired, PickOptional, WithoutEmpty, Expand, DeepPartial, MakeDifferenceOptional, IsUnion, IsNonEmptyObject, Assign, IntersectAssign, Timeout, Updater, NonNullableUpdater, StringLiteral, ThrowOrOptional, ThrowConstraint, ControlledPromise, ExtractObjects, PartialMergeAllObject, MergeAllPrimitive, ExtractPrimitives, PartialMergeAll, Constrain, ConstrainLiteral, UnionToIntersection, MergeAllObjects, MergeAll, ValidateJSON, StrictOrFrom, LooseReturnType, LooseAsyncReturnType, } from './utils.cjs';
28
- export type { StandardSchemaValidatorProps, StandardSchemaValidator, AnyStandardSchemaValidator, StandardSchemaValidatorTypes, AnyStandardSchemaValidateSuccess, AnyStandardSchemaValidateFailure, AnyStandardSchemaValidateIssue, AnyStandardSchemaValidateInput, AnyStandardSchemaValidate, ValidatorObj, AnyValidatorObj, ValidatorAdapter, AnyValidatorAdapter, AnyValidatorFn, ValidatorFn, Validator, AnyValidator, AnySchema, DefaultValidator, ResolveSearchValidatorInputFn, ResolveSearchValidatorInput, ResolveValidatorInputFn, ResolveValidatorInput, ResolveValidatorOutputFn, ResolveValidatorOutput, } from './validators.cjs';
29
- export type { UseRouteContextBaseOptions, UseRouteContextOptions, UseRouteContextResult, } from './useRouteContext.cjs';
30
- export type { UseSearchResult, ResolveUseSearch } from './useSearch.cjs';
31
- export type { UseParamsResult, ResolveUseParams } from './useParams.cjs';
32
- export type { UseNavigateResult } from './useNavigate.cjs';
33
- export type { UseLoaderDepsResult, ResolveUseLoaderDeps } from './useLoaderDeps.cjs';
34
- export type { UseLoaderDataResult, ResolveUseLoaderData } from './useLoaderData.cjs';
35
- export type { Redirect, ResolvedRedirect, AnyRedirect } from './redirect.cjs';
36
- export { redirect, isRedirect, isResolvedRedirect, parseRedirect, } from './redirect.cjs';
37
- export type { NotFoundError } from './not-found.cjs';
38
- export { isNotFound, notFound } from './not-found.cjs';
39
- export { defaultGetScrollRestorationKey, restoreScroll, storageKey, getCssSelector, scrollRestorationCache, setupScrollRestoration, handleHashScroll, } from './scroll-restoration.cjs';
40
- export type { ScrollRestorationOptions, ScrollRestorationEntry, } from './scroll-restoration.cjs';
41
- export type { ValidateFromPath, ValidateToPath, ValidateSearch, ValidateParams, InferFrom, InferTo, InferMaskTo, InferMaskFrom, ValidateNavigateOptions, ValidateNavigateOptionsArray, ValidateRedirectOptions, ValidateRedirectOptionsArray, ValidateId, InferStrict, InferShouldThrow, InferSelected, ValidateUseSearchResult, ValidateUseParamsResult, } from './typePrimitives.cjs';
package/dist/cjs/link.cjs DELETED
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const preloadWarning = "Error preloading route! ☝️";
4
- exports.preloadWarning = preloadWarning;
5
- //# sourceMappingURL=link.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"link.cjs","sources":["../../src/link.ts"],"sourcesContent":["import type { HistoryState, ParsedHistoryState } from '@tanstack/history'\nimport type {\n AllParams,\n CatchAllPaths,\n CurrentPath,\n FullSearchSchema,\n FullSearchSchemaInput,\n ParentPath,\n RouteByPath,\n RouteByToPath,\n RoutePaths,\n RouteToPath,\n ToPath,\n} from './routeInfo'\nimport type {\n AnyRouter,\n RegisteredRouter,\n ViewTransitionOptions,\n} from './router'\nimport type {\n ConstrainLiteral,\n Expand,\n MakeDifferenceOptional,\n NoInfer,\n NonNullableUpdater,\n Updater,\n} from './utils'\nimport type { ParsedLocation } from './location'\n\nexport type IsRequiredParams<TParams> =\n Record<never, never> extends TParams ? never : true\n\nexport interface ParsePathParamsResult<\n in out TRequired,\n in out TOptional,\n in out TRest,\n> {\n required: TRequired\n optional: TOptional\n rest: TRest\n}\n\nexport type AnyParsePathParamsResult = ParsePathParamsResult<\n string,\n string,\n string\n>\n\nexport type ParsePathParamsBoundaryStart<T extends string> =\n T extends `${infer TLeft}{-${infer TRight}`\n ? ParsePathParamsResult<\n ParsePathParams<TLeft>['required'],\n | ParsePathParams<TLeft>['optional']\n | ParsePathParams<TRight>['required']\n | ParsePathParams<TRight>['optional'],\n ParsePathParams<TRight>['rest']\n >\n : T extends `${infer TLeft}{${infer TRight}`\n ? ParsePathParamsResult<\n | ParsePathParams<TLeft>['required']\n | ParsePathParams<TRight>['required'],\n | ParsePathParams<TLeft>['optional']\n | ParsePathParams<TRight>['optional'],\n ParsePathParams<TRight>['rest']\n >\n : never\n\nexport type ParsePathParamsSymbol<T extends string> =\n T extends `${string}$${infer TRight}`\n ? TRight extends `${string}/${string}`\n ? TRight extends `${infer TParam}/${infer TRest}`\n ? TParam extends ''\n ? ParsePathParamsResult<\n ParsePathParams<TRest>['required'],\n '_splat' | ParsePathParams<TRest>['optional'],\n ParsePathParams<TRest>['rest']\n >\n : ParsePathParamsResult<\n TParam | ParsePathParams<TRest>['required'],\n ParsePathParams<TRest>['optional'],\n ParsePathParams<TRest>['rest']\n >\n : never\n : TRight extends ''\n ? ParsePathParamsResult<never, '_splat', never>\n : ParsePathParamsResult<TRight, never, never>\n : never\n\nexport type ParsePathParamsBoundaryEnd<T extends string> =\n T extends `${infer TLeft}}${infer TRight}`\n ? ParsePathParamsResult<\n | ParsePathParams<TLeft>['required']\n | ParsePathParams<TRight>['required'],\n | ParsePathParams<TLeft>['optional']\n | ParsePathParams<TRight>['optional'],\n ParsePathParams<TRight>['rest']\n >\n : never\n\nexport type ParsePathParamsEscapeStart<T extends string> =\n T extends `${infer TLeft}[${infer TRight}`\n ? ParsePathParamsResult<\n | ParsePathParams<TLeft>['required']\n | ParsePathParams<TRight>['required'],\n | ParsePathParams<TLeft>['optional']\n | ParsePathParams<TRight>['optional'],\n ParsePathParams<TRight>['rest']\n >\n : never\n\nexport type ParsePathParamsEscapeEnd<T extends string> =\n T extends `${string}]${infer TRight}` ? ParsePathParams<TRight> : never\n\nexport type ParsePathParams<T extends string> = T extends `${string}[${string}`\n ? ParsePathParamsEscapeStart<T>\n : T extends `${string}]${string}`\n ? ParsePathParamsEscapeEnd<T>\n : T extends `${string}}${string}`\n ? ParsePathParamsBoundaryEnd<T>\n : T extends `${string}{${string}`\n ? ParsePathParamsBoundaryStart<T>\n : T extends `${string}$${string}`\n ? ParsePathParamsSymbol<T>\n : never\n\nexport type AddTrailingSlash<T> = T extends `${string}/` ? T : `${T & string}/`\n\nexport type RemoveTrailingSlashes<T> = T & `${string}/` extends never\n ? T\n : T extends `${infer R}/`\n ? R\n : T\n\nexport type AddLeadingSlash<T> = T & `/${string}` extends never\n ? `/${T & string}`\n : T\n\nexport type RemoveLeadingSlashes<T> = T & `/${string}` extends never\n ? T\n : T extends `/${infer R}`\n ? R\n : T\n\ntype JoinPath<TLeft extends string, TRight extends string> = TRight extends ''\n ? TLeft\n : TLeft extends ''\n ? TRight\n : `${RemoveTrailingSlashes<TLeft>}/${RemoveLeadingSlashes<TRight>}`\n\ntype RemoveLastSegment<\n T extends string,\n TAcc extends string = '',\n> = T extends `${infer TSegment}/${infer TRest}`\n ? TRest & `${string}/${string}` extends never\n ? TRest extends ''\n ? TAcc\n : `${TAcc}${TSegment}`\n : RemoveLastSegment<TRest, `${TAcc}${TSegment}/`>\n : TAcc\n\nexport type ResolveCurrentPath<\n TFrom extends string,\n TTo extends string,\n> = TTo extends '.'\n ? TFrom\n : TTo extends './'\n ? AddTrailingSlash<TFrom>\n : TTo & `./${string}` extends never\n ? never\n : TTo extends `./${infer TRest}`\n ? AddLeadingSlash<JoinPath<TFrom, TRest>>\n : never\n\nexport type ResolveParentPath<\n TFrom extends string,\n TTo extends string,\n> = TTo extends '../' | '..'\n ? TFrom extends '' | '/'\n ? never\n : AddLeadingSlash<RemoveLastSegment<TFrom>>\n : TTo & `../${string}` extends never\n ? AddLeadingSlash<JoinPath<TFrom, TTo>>\n : TFrom extends '' | '/'\n ? never\n : TTo extends `../${infer ToRest}`\n ? ResolveParentPath<RemoveLastSegment<TFrom>, ToRest>\n : AddLeadingSlash<JoinPath<TFrom, TTo>>\n\nexport type ResolveRelativePath<TFrom, TTo = '.'> = string extends TFrom\n ? TTo\n : string extends TTo\n ? TFrom\n : undefined extends TTo\n ? TFrom\n : TTo extends string\n ? TFrom extends string\n ? TTo extends `/${string}`\n ? TTo\n : TTo extends `..${string}`\n ? ResolveParentPath<TFrom, TTo>\n : TTo extends `.${string}`\n ? ResolveCurrentPath<TFrom, TTo>\n : AddLeadingSlash<JoinPath<TFrom, TTo>>\n : never\n : never\n\nexport type FindDescendantToPaths<\n TRouter extends AnyRouter,\n TPrefix extends string,\n> = `${TPrefix}/${string}` & RouteToPath<TRouter>\n\nexport type InferDescendantToPaths<\n TRouter extends AnyRouter,\n TPrefix extends string,\n TPaths = FindDescendantToPaths<TRouter, TPrefix>,\n> = TPaths extends `${TPrefix}/`\n ? never\n : TPaths extends `${TPrefix}/${infer TRest}`\n ? TRest\n : never\n\nexport type RelativeToPath<\n TRouter extends AnyRouter,\n TTo extends string,\n TResolvedPath extends string,\n> =\n | (TResolvedPath & RouteToPath<TRouter> extends never\n ? never\n : ToPath<TRouter, TTo>)\n | `${RemoveTrailingSlashes<TTo>}/${InferDescendantToPaths<TRouter, RemoveTrailingSlashes<TResolvedPath>>}`\n\nexport type RelativeToParentPath<\n TRouter extends AnyRouter,\n TFrom extends string,\n TTo extends string,\n TResolvedPath extends string = ResolveRelativePath<TFrom, TTo>,\n> =\n | RelativeToPath<TRouter, TTo, TResolvedPath>\n | (TTo extends `${string}..` | `${string}../`\n ? TResolvedPath extends '/' | ''\n ? never\n : FindDescendantToPaths<\n TRouter,\n RemoveTrailingSlashes<TResolvedPath>\n > extends never\n ? never\n : `${RemoveTrailingSlashes<TTo>}/${ParentPath<TRouter>}`\n : never)\n\nexport type RelativeToCurrentPath<\n TRouter extends AnyRouter,\n TFrom extends string,\n TTo extends string,\n TResolvedPath extends string = ResolveRelativePath<TFrom, TTo>,\n> = RelativeToPath<TRouter, TTo, TResolvedPath> | CurrentPath<TRouter>\n\nexport type AbsoluteToPath<TRouter extends AnyRouter, TFrom extends string> =\n | (string extends TFrom\n ? CurrentPath<TRouter>\n : TFrom extends `/`\n ? never\n : CurrentPath<TRouter>)\n | (string extends TFrom\n ? ParentPath<TRouter>\n : TFrom extends `/`\n ? never\n : ParentPath<TRouter>)\n | RouteToPath<TRouter>\n | (TFrom extends '/'\n ? never\n : string extends TFrom\n ? never\n : InferDescendantToPaths<TRouter, RemoveTrailingSlashes<TFrom>>)\n\nexport type RelativeToPathAutoComplete<\n TRouter extends AnyRouter,\n TFrom extends string,\n TTo extends string,\n> = string extends TTo\n ? string\n : string extends TFrom\n ? AbsoluteToPath<TRouter, TFrom>\n : TTo & `..${string}` extends never\n ? TTo & `.${string}` extends never\n ? AbsoluteToPath<TRouter, TFrom>\n : RelativeToCurrentPath<TRouter, TFrom, TTo>\n : RelativeToParentPath<TRouter, TFrom, TTo>\n\nexport type NavigateOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = ToOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & NavigateOptionProps\n\n/**\n * The NavigateOptions type is used to describe the options that can be used when describing a navigation action in TanStack Router.\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType)\n */\nexport interface NavigateOptionProps {\n /**\n * If set to `true`, the router will scroll the element with an id matching the hash into view with default `ScrollIntoViewOptions`.\n * If set to `false`, the router will not scroll the element with an id matching the hash into view.\n * If set to `ScrollIntoViewOptions`, the router will scroll the element with an id matching the hash into view with the provided options.\n * @default true\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType#hashscrollintoview)\n * @see [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView)\n */\n hashScrollIntoView?: boolean | ScrollIntoViewOptions\n /**\n * `replace` is a boolean that determines whether the navigation should replace the current history entry or push a new one.\n * @default false\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType#replace)\n */\n replace?: boolean\n /**\n * Defaults to `true` so that the scroll position will be reset to 0,0 after the location is committed to the browser history.\n * If `false`, the scroll position will not be reset to 0,0 after the location is committed to history.\n * @default true\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType#resetscroll)\n */\n resetScroll?: boolean\n /** @deprecated All navigations now use startTransition under the hood */\n startTransition?: boolean\n /**\n * If set to `true`, the router will wrap the resulting navigation in a `document.startViewTransition()` call.\n * If `ViewTransitionOptions`, route navigations will be called using `document.startViewTransition({update, types})`\n * where `types` will be the strings array passed with `ViewTransitionOptions[\"types\"]`.\n * If the browser does not support viewTransition types, the navigation will fall back to normal `document.startTransition()`, same as if `true` was passed.\n *\n * If the browser does not support this api, this option will be ignored.\n * @default false\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType#viewtransition)\n * @see [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition)\n * @see [Google](https://developer.chrome.com/docs/web-platform/view-transitions/same-document#view-transition-types)\n */\n viewTransition?: boolean | ViewTransitionOptions\n /**\n * If `true`, navigation will ignore any blockers that might prevent it.\n * @default false\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType#ignoreblocker)\n */\n ignoreBlocker?: boolean\n /**\n * If `true`, navigation to a route inside of router will trigger a full page load instead of the traditional SPA navigation.\n * @default false\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType#reloaddocument)\n */\n reloadDocument?: boolean\n /**\n * This can be used instead of `to` to navigate to a fully built href, e.g. pointing to an external target.\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType#href)\n */\n href?: string\n}\n\nexport type ToOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = ToSubOptions<TRouter, TFrom, TTo> & MaskOptions<TRouter, TMaskFrom, TMaskTo>\n\nexport interface MaskOptions<\n in out TRouter extends AnyRouter,\n in out TMaskFrom extends string,\n in out TMaskTo extends string,\n> {\n _fromLocation?: ParsedLocation\n mask?: ToMaskOptions<TRouter, TMaskFrom, TMaskTo>\n}\n\nexport type ToMaskOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TMaskFrom extends string = string,\n TMaskTo extends string = '.',\n> = ToSubOptions<TRouter, TMaskFrom, TMaskTo> & {\n unmaskOnReload?: boolean\n}\n\nexport type ToSubOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n> = ToSubOptionsProps<TRouter, TFrom, TTo> &\n SearchParamOptions<TRouter, TFrom, TTo> &\n PathParamOptions<TRouter, TFrom, TTo>\n\nexport interface RequiredToOptions<\n in out TRouter extends AnyRouter,\n in out TFrom extends string,\n in out TTo extends string | undefined,\n> {\n to: ToPathOption<TRouter, TFrom, TTo> & {}\n}\n\nexport interface OptionalToOptions<\n in out TRouter extends AnyRouter,\n in out TFrom extends string,\n in out TTo extends string | undefined,\n> {\n to?: ToPathOption<TRouter, TFrom, TTo> & {}\n}\n\nexport type MakeToRequired<\n TRouter extends AnyRouter,\n TFrom extends string,\n TTo extends string | undefined,\n> = string extends TFrom\n ? string extends TTo\n ? OptionalToOptions<TRouter, TFrom, TTo>\n : TTo & CatchAllPaths<TRouter> extends never\n ? RequiredToOptions<TRouter, TFrom, TTo>\n : OptionalToOptions<TRouter, TFrom, TTo>\n : OptionalToOptions<TRouter, TFrom, TTo>\n\nexport type ToSubOptionsProps<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends RoutePaths<TRouter['routeTree']> | string = string,\n TTo extends string | undefined = '.',\n> = MakeToRequired<TRouter, TFrom, TTo> & {\n hash?: true | Updater<string>\n state?: true | NonNullableUpdater<ParsedHistoryState, HistoryState>\n from?: FromPathOption<TRouter, TFrom> & {}\n unsafeRelative?: 'path'\n}\n\nexport type ParamsReducerFn<\n in out TRouter extends AnyRouter,\n in out TParamVariant extends ParamVariant,\n in out TFrom,\n in out TTo,\n> = (\n current: Expand<ResolveFromParams<TRouter, TParamVariant, TFrom>>,\n) => Expand<ResolveRelativeToParams<TRouter, TParamVariant, TFrom, TTo>>\n\ntype ParamsReducer<\n TRouter extends AnyRouter,\n TParamVariant extends ParamVariant,\n TFrom,\n TTo,\n> =\n | Expand<ResolveRelativeToParams<TRouter, TParamVariant, TFrom, TTo>>\n | (ParamsReducerFn<TRouter, TParamVariant, TFrom, TTo> & {})\n\ntype ParamVariant = 'PATH' | 'SEARCH'\n\nexport type ResolveRoute<\n TRouter extends AnyRouter,\n TFrom,\n TTo,\n TPath = ResolveRelativePath<TFrom, TTo>,\n> = TPath extends string\n ? TFrom extends TPath\n ? RouteByPath<TRouter['routeTree'], TPath>\n : RouteByToPath<TRouter, TPath>\n : never\n\ntype ResolveFromParamType<TParamVariant extends ParamVariant> =\n TParamVariant extends 'PATH' ? 'allParams' : 'fullSearchSchema'\n\ntype ResolveFromAllParams<\n TRouter extends AnyRouter,\n TParamVariant extends ParamVariant,\n> = TParamVariant extends 'PATH'\n ? AllParams<TRouter['routeTree']>\n : FullSearchSchema<TRouter['routeTree']>\n\ntype ResolveFromParams<\n TRouter extends AnyRouter,\n TParamVariant extends ParamVariant,\n TFrom,\n> = string extends TFrom\n ? ResolveFromAllParams<TRouter, TParamVariant>\n : RouteByPath<\n TRouter['routeTree'],\n TFrom\n >['types'][ResolveFromParamType<TParamVariant>]\n\ntype ResolveToParamType<TParamVariant extends ParamVariant> =\n TParamVariant extends 'PATH' ? 'allParams' : 'fullSearchSchemaInput'\n\ntype ResolveAllToParams<\n TRouter extends AnyRouter,\n TParamVariant extends ParamVariant,\n> = TParamVariant extends 'PATH'\n ? AllParams<TRouter['routeTree']>\n : FullSearchSchemaInput<TRouter['routeTree']>\n\nexport type ResolveToParams<\n TRouter extends AnyRouter,\n TParamVariant extends ParamVariant,\n TFrom,\n TTo,\n> =\n ResolveRelativePath<TFrom, TTo> extends infer TPath\n ? undefined extends TPath\n ? never\n : string extends TPath\n ? ResolveAllToParams<TRouter, TParamVariant>\n : TPath extends CatchAllPaths<TRouter>\n ? ResolveAllToParams<TRouter, TParamVariant>\n : ResolveRoute<\n TRouter,\n TFrom,\n TTo\n >['types'][ResolveToParamType<TParamVariant>]\n : never\n\ntype ResolveRelativeToParams<\n TRouter extends AnyRouter,\n TParamVariant extends ParamVariant,\n TFrom,\n TTo,\n TToParams = ResolveToParams<TRouter, TParamVariant, TFrom, TTo>,\n> = TParamVariant extends 'SEARCH'\n ? TToParams\n : string extends TFrom\n ? TToParams\n : MakeDifferenceOptional<\n ResolveFromParams<TRouter, TParamVariant, TFrom>,\n TToParams\n >\n\nexport interface MakeOptionalSearchParams<\n in out TRouter extends AnyRouter,\n in out TFrom,\n in out TTo,\n> {\n search?: true | (ParamsReducer<TRouter, 'SEARCH', TFrom, TTo> & {})\n}\n\nexport interface MakeOptionalPathParams<\n in out TRouter extends AnyRouter,\n in out TFrom,\n in out TTo,\n> {\n params?: true | (ParamsReducer<TRouter, 'PATH', TFrom, TTo> & {})\n}\n\ntype MakeRequiredParamsReducer<\n TRouter extends AnyRouter,\n TParamVariant extends ParamVariant,\n TFrom,\n TTo,\n> =\n | (string extends TFrom\n ? never\n : ResolveFromParams<\n TRouter,\n TParamVariant,\n TFrom\n > extends ResolveRelativeToParams<TRouter, TParamVariant, TFrom, TTo>\n ? true\n : never)\n | (ParamsReducer<TRouter, TParamVariant, TFrom, TTo> & {})\n\nexport interface MakeRequiredPathParams<\n in out TRouter extends AnyRouter,\n in out TFrom,\n in out TTo,\n> {\n params: MakeRequiredParamsReducer<TRouter, 'PATH', TFrom, TTo> & {}\n}\n\nexport interface MakeRequiredSearchParams<\n in out TRouter extends AnyRouter,\n in out TFrom,\n in out TTo,\n> {\n search: MakeRequiredParamsReducer<TRouter, 'SEARCH', TFrom, TTo> & {}\n}\n\nexport type IsRequired<\n TRouter extends AnyRouter,\n TParamVariant extends ParamVariant,\n TFrom,\n TTo,\n> =\n ResolveRelativePath<TFrom, TTo> extends infer TPath\n ? undefined extends TPath\n ? never\n : TPath extends CatchAllPaths<TRouter>\n ? never\n : IsRequiredParams<\n ResolveRelativeToParams<TRouter, TParamVariant, TFrom, TTo>\n >\n : never\n\nexport type SearchParamOptions<TRouter extends AnyRouter, TFrom, TTo> =\n IsRequired<TRouter, 'SEARCH', TFrom, TTo> extends never\n ? MakeOptionalSearchParams<TRouter, TFrom, TTo>\n : MakeRequiredSearchParams<TRouter, TFrom, TTo>\n\nexport type PathParamOptions<TRouter extends AnyRouter, TFrom, TTo> =\n IsRequired<TRouter, 'PATH', TFrom, TTo> extends never\n ? MakeOptionalPathParams<TRouter, TFrom, TTo>\n : MakeRequiredPathParams<TRouter, TFrom, TTo>\n\nexport type ToPathOption<\n TRouter extends AnyRouter = AnyRouter,\n TFrom extends string = string,\n TTo extends string | undefined = string,\n> = ConstrainLiteral<\n TTo,\n RelativeToPathAutoComplete<\n TRouter,\n NoInfer<TFrom> extends string ? NoInfer<TFrom> : '',\n NoInfer<TTo> & string\n >\n>\n\nexport type FromPathOption<TRouter extends AnyRouter, TFrom> = ConstrainLiteral<\n TFrom,\n RoutePaths<TRouter['routeTree']>\n>\n\n/**\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/navigation#active-options)\n */\nexport interface ActiveOptions {\n /**\n * If true, the link will be active if the current route matches the `to` route path exactly (no children routes)\n * @default false\n */\n exact?: boolean\n /**\n * If true, the link will only be active if the current URL hash matches the `hash` prop\n * @default false\n */\n includeHash?: boolean\n /**\n * If true, the link will only be active if the current URL search params inclusively match the `search` prop\n * @default true\n */\n includeSearch?: boolean\n /**\n * This modifies the `includeSearch` behavior.\n * If true, properties in `search` that are explicitly `undefined` must NOT be present in the current URL search params for the link to be active.\n * @default false\n */\n explicitUndefined?: boolean\n}\n\nexport interface LinkOptionsProps {\n /**\n * The standard anchor tag target attribute\n */\n target?: HTMLAnchorElement['target']\n /**\n * Configurable options to determine if the link should be considered active or not\n * @default {exact:true,includeHash:true}\n */\n activeOptions?: ActiveOptions\n /**\n * The preloading strategy for this link\n * - `false` - No preloading\n * - `'intent'` - Preload the linked route on hover and cache it for this many milliseconds in hopes that the user will eventually navigate there.\n * - `'viewport'` - Preload the linked route when it enters the viewport\n */\n preload?: false | 'intent' | 'viewport' | 'render'\n /**\n * When a preload strategy is set, this delays the preload by this many milliseconds.\n * If the user exits the link before this delay, the preload will be cancelled.\n */\n preloadDelay?: number\n /**\n * Control whether the link should be disabled or not\n * If set to `true`, the link will be rendered without an `href` attribute\n * @default false\n */\n disabled?: boolean\n /**\n * When the preload strategy is set to `intent`, this controls the proximity of the link to the cursor before it is preloaded.\n * If the user exits this proximity before this delay, the preload will be cancelled.\n */\n preloadIntentProximity?: number\n}\n\nexport type LinkOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & LinkOptionsProps\n\nexport type LinkCurrentTargetElement = {\n preloadTimeout?: null | ReturnType<typeof setTimeout>\n}\n\nexport const preloadWarning = 'Error preloading route! ☝️'\n"],"names":[],"mappings":";;AAqrBO,MAAM,iBAAiB;;"}