@tanstack/solid-router 1.112.10 → 1.112.12

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 (184) hide show
  1. package/dist/cjs/Match.cjs.map +1 -1
  2. package/dist/cjs/Matches.cjs.map +1 -1
  3. package/dist/cjs/Matches.d.cts +1 -8
  4. package/dist/cjs/RouterProvider.cjs.map +1 -1
  5. package/dist/cjs/RouterProvider.d.cts +4 -4
  6. package/dist/cjs/Transitioner.cjs +1 -1
  7. package/dist/cjs/Transitioner.cjs.map +1 -1
  8. package/dist/cjs/fileRoute.cjs.map +1 -1
  9. package/dist/cjs/fileRoute.d.cts +4 -7
  10. package/dist/cjs/index.d.cts +3 -5
  11. package/dist/cjs/link.cjs.map +1 -1
  12. package/dist/cjs/link.d.cts +1 -2
  13. package/dist/cjs/not-found.cjs.map +1 -1
  14. package/dist/cjs/not-found.d.cts +1 -2
  15. package/dist/cjs/redirects.cjs.map +1 -1
  16. package/dist/cjs/redirects.d.cts +1 -2
  17. package/dist/cjs/renderRouteNotFound.cjs.map +1 -1
  18. package/dist/cjs/renderRouteNotFound.d.cts +1 -2
  19. package/dist/cjs/route.cjs +15 -23
  20. package/dist/cjs/route.cjs.map +1 -1
  21. package/dist/cjs/route.d.cts +19 -50
  22. package/dist/cjs/router.cjs +25 -25
  23. package/dist/cjs/router.cjs.map +1 -1
  24. package/dist/cjs/router.d.cts +84 -454
  25. package/dist/cjs/routerContext.cjs.map +1 -1
  26. package/dist/cjs/routerContext.d.cts +2 -2
  27. package/dist/cjs/scroll-restoration.cjs.map +1 -1
  28. package/dist/cjs/scroll-restoration.d.cts +1 -2
  29. package/dist/cjs/typePrimitives.d.cts +1 -2
  30. package/dist/cjs/useBlocker.cjs.map +1 -1
  31. package/dist/cjs/useBlocker.d.cts +2 -3
  32. package/dist/cjs/useLoaderData.cjs.map +1 -1
  33. package/dist/cjs/useLoaderData.d.cts +1 -3
  34. package/dist/cjs/useLoaderDeps.cjs.map +1 -1
  35. package/dist/cjs/useLoaderDeps.d.cts +1 -3
  36. package/dist/cjs/useLocation.cjs.map +1 -1
  37. package/dist/cjs/useLocation.d.cts +1 -1
  38. package/dist/cjs/useMatch.cjs.map +1 -1
  39. package/dist/cjs/useMatch.d.cts +1 -3
  40. package/dist/cjs/useNavigate.cjs.map +1 -1
  41. package/dist/cjs/useNavigate.d.cts +1 -2
  42. package/dist/cjs/useParams.cjs.map +1 -1
  43. package/dist/cjs/useParams.d.cts +1 -3
  44. package/dist/cjs/useRouteContext.cjs.map +1 -1
  45. package/dist/cjs/useRouteContext.d.cts +1 -2
  46. package/dist/cjs/useRouter.cjs.map +1 -1
  47. package/dist/cjs/useRouter.d.cts +1 -1
  48. package/dist/cjs/useRouterState.cjs.map +1 -1
  49. package/dist/cjs/useRouterState.d.cts +1 -1
  50. package/dist/cjs/useSearch.cjs.map +1 -1
  51. package/dist/cjs/useSearch.d.cts +1 -3
  52. package/dist/cjs/utils.cjs.map +1 -1
  53. package/dist/cjs/utils.d.cts +0 -9
  54. package/dist/esm/Match.js.map +1 -1
  55. package/dist/esm/Matches.d.ts +1 -8
  56. package/dist/esm/Matches.js.map +1 -1
  57. package/dist/esm/RouterProvider.d.ts +4 -4
  58. package/dist/esm/RouterProvider.js.map +1 -1
  59. package/dist/esm/Transitioner.js +1 -1
  60. package/dist/esm/Transitioner.js.map +1 -1
  61. package/dist/esm/fileRoute.d.ts +4 -7
  62. package/dist/esm/fileRoute.js.map +1 -1
  63. package/dist/esm/index.d.ts +3 -5
  64. package/dist/esm/link.d.ts +1 -2
  65. package/dist/esm/link.js.map +1 -1
  66. package/dist/esm/not-found.d.ts +1 -2
  67. package/dist/esm/not-found.js.map +1 -1
  68. package/dist/esm/redirects.d.ts +1 -2
  69. package/dist/esm/redirects.js.map +1 -1
  70. package/dist/esm/renderRouteNotFound.d.ts +1 -2
  71. package/dist/esm/renderRouteNotFound.js.map +1 -1
  72. package/dist/esm/route.d.ts +19 -50
  73. package/dist/esm/route.js +15 -23
  74. package/dist/esm/route.js.map +1 -1
  75. package/dist/esm/router.d.ts +84 -454
  76. package/dist/esm/router.js +25 -25
  77. package/dist/esm/router.js.map +1 -1
  78. package/dist/esm/routerContext.d.ts +2 -2
  79. package/dist/esm/routerContext.js.map +1 -1
  80. package/dist/esm/scroll-restoration.d.ts +1 -2
  81. package/dist/esm/scroll-restoration.js.map +1 -1
  82. package/dist/esm/typePrimitives.d.ts +1 -2
  83. package/dist/esm/useBlocker.d.ts +2 -3
  84. package/dist/esm/useBlocker.js.map +1 -1
  85. package/dist/esm/useLoaderData.d.ts +1 -3
  86. package/dist/esm/useLoaderData.js.map +1 -1
  87. package/dist/esm/useLoaderDeps.d.ts +1 -3
  88. package/dist/esm/useLoaderDeps.js.map +1 -1
  89. package/dist/esm/useLocation.d.ts +1 -1
  90. package/dist/esm/useLocation.js.map +1 -1
  91. package/dist/esm/useMatch.d.ts +1 -3
  92. package/dist/esm/useMatch.js.map +1 -1
  93. package/dist/esm/useNavigate.d.ts +1 -2
  94. package/dist/esm/useNavigate.js.map +1 -1
  95. package/dist/esm/useParams.d.ts +1 -3
  96. package/dist/esm/useParams.js.map +1 -1
  97. package/dist/esm/useRouteContext.d.ts +1 -2
  98. package/dist/esm/useRouteContext.js.map +1 -1
  99. package/dist/esm/useRouter.d.ts +1 -1
  100. package/dist/esm/useRouter.js.map +1 -1
  101. package/dist/esm/useRouterState.d.ts +1 -1
  102. package/dist/esm/useRouterState.js.map +1 -1
  103. package/dist/esm/useSearch.d.ts +1 -3
  104. package/dist/esm/useSearch.js.map +1 -1
  105. package/dist/esm/utils.d.ts +0 -9
  106. package/dist/esm/utils.js.map +1 -1
  107. package/dist/source/Matches.d.ts +1 -8
  108. package/dist/source/Matches.jsx.map +1 -1
  109. package/dist/source/RouterProvider.d.ts +4 -4
  110. package/dist/source/RouterProvider.jsx.map +1 -1
  111. package/dist/source/Transitioner.jsx +1 -1
  112. package/dist/source/Transitioner.jsx.map +1 -1
  113. package/dist/source/fileRoute.d.ts +4 -7
  114. package/dist/source/fileRoute.js.map +1 -1
  115. package/dist/source/index.d.ts +3 -5
  116. package/dist/source/index.jsx.map +1 -1
  117. package/dist/source/link.d.ts +1 -2
  118. package/dist/source/link.jsx.map +1 -1
  119. package/dist/source/not-found.d.ts +1 -2
  120. package/dist/source/not-found.jsx.map +1 -1
  121. package/dist/source/redirects.d.ts +1 -2
  122. package/dist/source/renderRouteNotFound.d.ts +1 -2
  123. package/dist/source/renderRouteNotFound.jsx.map +1 -1
  124. package/dist/source/route.d.ts +19 -50
  125. package/dist/source/route.js +15 -23
  126. package/dist/source/route.js.map +1 -1
  127. package/dist/source/router.d.ts +83 -454
  128. package/dist/source/router.js +33 -22
  129. package/dist/source/router.js.map +1 -1
  130. package/dist/source/routerContext.d.ts +2 -2
  131. package/dist/source/routerContext.jsx.map +1 -1
  132. package/dist/source/scroll-restoration.d.ts +1 -2
  133. package/dist/source/scroll-restoration.jsx.map +1 -1
  134. package/dist/source/typePrimitives.d.ts +1 -2
  135. package/dist/source/useBlocker.d.ts +2 -3
  136. package/dist/source/useBlocker.jsx.map +1 -1
  137. package/dist/source/useLoaderData.d.ts +1 -3
  138. package/dist/source/useLoaderData.jsx.map +1 -1
  139. package/dist/source/useLoaderDeps.d.ts +1 -3
  140. package/dist/source/useLoaderDeps.jsx.map +1 -1
  141. package/dist/source/useLocation.d.ts +1 -1
  142. package/dist/source/useLocation.jsx.map +1 -1
  143. package/dist/source/useMatch.d.ts +1 -3
  144. package/dist/source/useMatch.jsx.map +1 -1
  145. package/dist/source/useNavigate.d.ts +1 -2
  146. package/dist/source/useNavigate.jsx.map +1 -1
  147. package/dist/source/useParams.d.ts +1 -3
  148. package/dist/source/useParams.jsx.map +1 -1
  149. package/dist/source/useRouteContext.d.ts +1 -2
  150. package/dist/source/useRouter.d.ts +1 -1
  151. package/dist/source/useRouterState.d.ts +1 -1
  152. package/dist/source/useRouterState.jsx.map +1 -1
  153. package/dist/source/useSearch.d.ts +1 -3
  154. package/dist/source/useSearch.jsx.map +1 -1
  155. package/dist/source/utils.d.ts +1 -10
  156. package/dist/source/utils.js.map +1 -1
  157. package/package.json +2 -2
  158. package/src/Match.tsx +1 -1
  159. package/src/Matches.tsx +4 -8
  160. package/src/RouterProvider.tsx +4 -7
  161. package/src/Transitioner.tsx +1 -1
  162. package/src/fileRoute.ts +9 -25
  163. package/src/index.tsx +22 -28
  164. package/src/link.tsx +2 -1
  165. package/src/not-found.tsx +1 -2
  166. package/src/redirects.ts +1 -1
  167. package/src/renderRouteNotFound.tsx +1 -2
  168. package/src/route.ts +93 -222
  169. package/src/router.ts +154 -596
  170. package/src/routerContext.tsx +3 -3
  171. package/src/scroll-restoration.tsx +6 -2
  172. package/src/typePrimitives.ts +2 -1
  173. package/src/useBlocker.tsx +7 -3
  174. package/src/useLoaderData.tsx +3 -2
  175. package/src/useLoaderDeps.tsx +3 -2
  176. package/src/useLocation.tsx +5 -1
  177. package/src/useMatch.tsx +3 -2
  178. package/src/useNavigate.tsx +2 -1
  179. package/src/useParams.tsx +3 -2
  180. package/src/useRouteContext.ts +2 -2
  181. package/src/useRouter.tsx +1 -1
  182. package/src/useRouterState.tsx +5 -1
  183. package/src/useSearch.tsx +3 -2
  184. package/src/utils.ts +0 -16
@@ -1,434 +1,77 @@
1
- import { Store, NoInfer } from '@tanstack/solid-store';
2
- import { HistoryLocation, HistoryState, ParsedHistoryState, RouterHistory } from '@tanstack/history';
3
- import { AnyContext, AnyRedirect, AnyRouteMatch, AnySchema, BuildLocationFn, CommitLocationOptions, ControlledPromise, FullSearchSchema, MakeRemountDepsOptionsUnion, MakeRouteMatch, MakeRouteMatchUnion, Manifest, NavigateFn, NavigateOptions, NonNullableUpdater, ParsedLocation, PickAsRequired, Register, ResolveRelativePath, ResolvedRedirect, RouteById, RoutePaths, RoutesById, RoutesByPath, SearchParser, SearchSerializer, StartSerializer, ToOptions, TrailingSlashOption, Updater, ViewTransitionOptions } from '@tanstack/router-core';
4
- import { AnyRoute, ErrorRouteComponent, NotFoundRouteComponent, RootRoute, RouteComponent, RouteMask } from './route.cjs';
5
- import { MatchRouteOptions } from './Matches.cjs';
1
+ import { Store } from '@tanstack/solid-store';
2
+ import { RouterHistory } from '@tanstack/history';
3
+ import { AnyRedirect, AnyRoute, AnyRouteMatch, AnyRouter, BuildLocationFn, BuildNextOptions, ClearCacheFn, CommitLocationFn, CommitLocationOptions, ControlledPromise, Router as CoreRouter, EmitFn, FullSearchSchema, GetMatchFn, GetMatchRoutesFn, InjectedHtmlEntry, InvalidateFn, LoadFn, MakeRouteMatch, Manifest, MatchRouteFn, MatchRoutesFn, NavigateFn, ParseLocationFn, ParsedLocation, PickAsRequired, PreloadRouteFn, ResolvedRedirect, RouterConstructorOptions, RouterEvent, RouterListener, RouterOptions, RouterState, RoutesById, RoutesByPath, StartSerializer, StartTransitionFn, SubscribeFn, TrailingSlashOption, UpdateFn, UpdateMatchFn, ViewTransitionOptions } from '@tanstack/router-core';
4
+ import { ErrorRouteComponent, NotFoundRouteComponent, RouteComponent } from './route.cjs';
6
5
  import { NotFoundError } from './not-found.cjs';
7
6
  import type * as Solid from 'solid-js';
8
- declare global {
9
- interface Window {
10
- __TSR_ROUTER__?: AnyRouter;
11
- }
12
- }
13
- export type AnyRouter = Router<any, any, any, any, any>;
14
- export type RegisteredRouter = Register extends {
15
- router: infer TRouter extends AnyRouter;
16
- } ? TRouter : AnyRouter;
17
- export type InferRouterContext<TRouteTree extends AnyRoute> = TRouteTree extends RootRoute<any, infer TRouterContext extends AnyContext, any, any, any, any, any, any> ? TRouterContext : AnyContext;
18
- export type ControllablePromise<T = any> = Promise<T> & {
19
- resolve: (value: T) => void;
20
- reject: (value?: any) => void;
21
- };
22
- export type RouterContextOptions<TRouteTree extends AnyRoute> = AnyContext extends InferRouterContext<TRouteTree> ? {
23
- context?: InferRouterContext<TRouteTree>;
24
- } : {
25
- context: InferRouterContext<TRouteTree>;
26
- };
27
- export type InjectedHtmlEntry = Promise<string>;
28
- export interface RouterOptions<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TRouterHistory extends RouterHistory = RouterHistory, TDehydrated extends Record<string, any> = Record<string, any>> {
29
- /**
30
- * The history object that will be used to manage the browser history.
31
- *
32
- * If not provided, a new createBrowserHistory instance will be created and used.
33
- *
34
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#history-property)
35
- * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/history-types)
36
- */
37
- history?: TRouterHistory;
38
- /**
39
- * A function that will be used to stringify search params when generating links.
40
- *
41
- * @default defaultStringifySearch
42
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#stringifysearch-method)
43
- * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/custom-search-param-serialization)
44
- */
45
- stringifySearch?: SearchSerializer;
46
- /**
47
- * A function that will be used to parse search params when parsing the current location.
48
- *
49
- * @default defaultParseSearch
50
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#parsesearch-method)
51
- * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/custom-search-param-serialization)
52
- */
53
- parseSearch?: SearchParser;
54
- /**
55
- * If `false`, routes will not be preloaded by default in any way.
56
- *
57
- * If `'intent'`, routes will be preloaded by default when the user hovers over a link or a `touchstart` event is detected on a `<Link>`.
58
- *
59
- * If `'viewport'`, routes will be preloaded by default when they are within the viewport.
60
- *
61
- * @default false
62
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreload-property)
63
- * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading)
64
- */
65
- defaultPreload?: false | 'intent' | 'viewport' | 'render';
66
- /**
67
- * The delay in milliseconds that a route must be hovered over or touched before it is preloaded.
68
- *
69
- * @default 50
70
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloaddelay-property)
71
- * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading#preload-delay)
72
- */
73
- defaultPreloadDelay?: number;
74
- /**
75
- * The default `component` a route should use if no component is provided.
76
- *
77
- * @default Outlet
78
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultcomponent-property)
79
- */
80
- defaultComponent?: RouteComponent;
81
- /**
82
- * The default `errorComponent` a route should use if no error component is provided.
83
- *
84
- * @default ErrorComponent
85
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaulterrorcomponent-property)
86
- * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#handling-errors-with-routeoptionserrorcomponent)
87
- */
88
- defaultErrorComponent?: ErrorRouteComponent;
89
- /**
90
- * The default `pendingComponent` a route should use if no pending component is provided.
91
- *
92
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpendingcomponent-property)
93
- * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#showing-a-pending-component)
94
- */
95
- defaultPendingComponent?: RouteComponent;
96
- /**
97
- * The default `pendingMs` a route should use if no pendingMs is provided.
98
- *
99
- * @default 1000
100
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpendingms-property)
101
- * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#avoiding-pending-component-flash)
102
- */
103
- defaultPendingMs?: number;
104
- /**
105
- * The default `pendingMinMs` a route should use if no pendingMinMs is provided.
106
- *
107
- * @default 500
108
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpendingminms-property)
109
- * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#avoiding-pending-component-flash)
110
- */
111
- defaultPendingMinMs?: number;
112
- /**
113
- * 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.
114
- *
115
- * @default 0
116
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultstaletime-property)
117
- * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#key-options)
118
- */
119
- defaultStaleTime?: number;
120
- /**
121
- * The default `preloadStaleTime` a route should use if no preloadStaleTime is provided.
122
- *
123
- * @default 30_000 `(30 seconds)`
124
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloadstaletime-property)
125
- * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading)
126
- */
127
- defaultPreloadStaleTime?: number;
128
- /**
129
- * The default `defaultPreloadGcTime` a route should use if no preloadGcTime is provided.
130
- *
131
- * @default 1_800_000 `(30 minutes)`
132
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloadgctime-property)
133
- * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading)
134
- */
135
- defaultPreloadGcTime?: number;
136
- /**
137
- * The default `onCatch` handler for errors caught by the Router ErrorBoundary
138
- *
139
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultoncatch-property)
140
- * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#handling-errors-with-routeoptionsoncatch)
141
- */
142
- defaultOnCatch?: (error: Error) => void;
143
- /**
144
- * If `true`, route navigations will called using `document.startViewTransition()`.
145
- *
146
- * If the browser does not support this api, this option will be ignored.
147
- *
148
- * See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition) for more information on how this function works.
149
- *
150
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultviewtransition-property)
151
- */
152
- defaultViewTransition?: boolean | ViewTransitionOptions;
153
- /**
154
- * The default `hashScrollIntoView` a route should use if no hashScrollIntoView is provided while navigating
155
- *
156
- * See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView) for more information on `ScrollIntoViewOptions`.
157
- *
158
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaulthashscrollintoview-property)
159
- */
160
- defaultHashScrollIntoView?: boolean | ScrollIntoViewOptions;
161
- /**
162
- * @default 'fuzzy'
163
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#notfoundmode-property)
164
- * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/not-found-errors#the-notfoundmode-option)
165
- */
166
- notFoundMode?: 'root' | 'fuzzy';
167
- /**
168
- * The default `gcTime` a route should use if no gcTime is provided.
169
- *
170
- * @default 1_800_000 `(30 minutes)`
171
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultgctime-property)
172
- * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#key-options)
173
- */
174
- defaultGcTime?: number;
175
- /**
176
- * If `true`, all routes will be matched as case-sensitive.
177
- *
178
- * @default false
179
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#casesensitive-property)
180
- */
181
- caseSensitive?: boolean;
182
- /**
183
- *
184
- * The route tree that will be used to configure the router instance.
185
- *
186
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#routetree-property)
187
- * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/routing/route-trees)
188
- */
189
- routeTree?: TRouteTree;
190
- /**
191
- * The basepath for then entire router. This is useful for mounting a router instance at a subpath.
192
- *
193
- * @default '/'
194
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#basepath-property)
195
- */
196
- basepath?: string;
197
- /**
198
- * The root context that will be provided to all routes in the route tree.
199
- *
200
- * This can be used to provide a context to all routes in the tree without having to provide it to each route individually.
201
- *
202
- * Optional or required if the root route was created with [`createRootRouteWithContext()`](https://tanstack.com/router/latest/docs/framework/react/api/router/createRootRouteWithContextFunction).
203
- *
204
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#context-property)
205
- * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/router-context)
206
- */
207
- context?: InferRouterContext<TRouteTree>;
208
- /**
209
- * A function that will be called when the router is dehydrated.
210
- *
211
- * The return value of this function will be serialized and stored in the router's dehydrated state.
212
- *
213
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#dehydrate-method)
214
- * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/external-data-loading#critical-dehydrationhydration)
215
- */
216
- dehydrate?: () => TDehydrated;
217
- /**
218
- * A function that will be called when the router is hydrated.
219
- *
220
- * The return value of this function will be serialized and stored in the router's dehydrated state.
221
- *
222
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#hydrate-method)
223
- * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/external-data-loading#critical-dehydrationhydration)
224
- */
225
- hydrate?: (dehydrated: TDehydrated) => void;
226
- /**
227
- * An array of route masks that will be used to mask routes in the route tree.
228
- *
229
- * 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.
230
- *
231
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#routemasks-property)
232
- * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/route-masking)
233
- */
234
- routeMasks?: Array<RouteMask<TRouteTree>>;
235
- /**
236
- * If `true`, route masks will, by default, be removed when the page is reloaded.
237
- *
238
- * 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.
239
- *
240
- * @default false
241
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#unmaskonreload-property)
242
- * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/route-masking#unmasking-on-page-reload)
243
- */
244
- unmaskOnReload?: boolean;
245
- /**
246
- * A component that will be used to wrap the entire router.
247
- *
248
- * This is useful for providing a context to the entire router.
249
- *
250
- * Only non-DOM-rendering components like providers should be used, anything else will cause a hydration error.
251
- *
252
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#wrap-property)
253
- */
254
- Wrap?: (props: {
255
- children: any;
256
- }) => Solid.JSX.Element;
257
- /**
258
- * A component that will be used to wrap the inner contents of the router.
259
- *
260
- * This is useful for providing a context to the inner contents of the router where you also need access to the router context and hooks.
261
- *
262
- * Only non-DOM-rendering components like providers should be used, anything else will cause a hydration error.
263
- *
264
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#innerwrap-property)
265
- */
266
- InnerWrap?: (props: {
267
- children: any;
268
- }) => Solid.JSX.Element;
269
- /**
270
- * Use `notFoundComponent` instead.
271
- *
272
- * @deprecated
273
- * See https://tanstack.com/router/v1/docs/guide/not-found-errors#migrating-from-notfoundroute for more info.
274
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#notfoundroute-property)
275
- */
276
- notFoundRoute?: AnyRoute;
277
- /**
278
- * The default `notFoundComponent` a route should use if no notFound component is provided.
279
- *
280
- * @default NotFound
281
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultnotfoundcomponent-property)
282
- * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/not-found-errors#default-router-wide-not-found-handling)
283
- */
284
- defaultNotFoundComponent?: NotFoundRouteComponent;
285
- /**
286
- * Configures how trailing slashes are treated.
287
- *
288
- * - `'always'` will add a trailing slash if not present
289
- * - `'never'` will remove the trailing slash if present
290
- * - `'preserve'` will not modify the trailing slash.
291
- *
292
- * @default 'never'
293
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#trailingslash-property)
294
- */
295
- trailingSlash?: TTrailingSlashOption;
296
- /**
297
- * 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.
298
- *
299
- * @default typeof document !== 'undefined'
300
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#isserver-property)
301
- */
302
- isServer?: boolean;
303
- defaultSsr?: boolean;
304
- search?: {
7
+ declare module '@tanstack/router-core' {
8
+ interface RouterOptionsExtensions {
305
9
  /**
306
- * Configures how unknown search params (= not returned by any `validateSearch`) are treated.
10
+ * A component that will be used to wrap the entire router.
307
11
  *
308
- * @default false
309
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#search.strict-property)
12
+ * This is useful for providing a context to the entire router.
13
+ *
14
+ * Only non-DOM-rendering components like providers should be used, anything else will cause a hydration error.
15
+ *
16
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#wrap-property)
310
17
  */
311
- strict?: boolean;
312
- };
313
- /**
314
- * Configures which URI characters are allowed in path params that would ordinarily be escaped by encodeURIComponent.
315
- *
316
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#pathparamsallowedcharacters-property)
317
- * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/path-params#allowed-characters)
318
- */
319
- pathParamsAllowedCharacters?: Array<';' | ':' | '@' | '&' | '=' | '+' | '$' | ','>;
320
- defaultRemountDeps?: (opts: MakeRemountDepsOptionsUnion<TRouteTree>) => any;
321
- /**
322
- * If `true`, scroll restoration will be enabled
323
- *
324
- * @default false
325
- */
326
- scrollRestoration?: boolean;
327
- /**
328
- * A function that will be called to get the key for the scroll restoration cache.
329
- *
330
- * @default (location) => location.href
331
- */
332
- getScrollRestorationKey?: (location: ParsedLocation) => string;
333
- /**
334
- * The default behavior for scroll restoration.
335
- *
336
- * @default 'auto'
337
- */
338
- scrollRestorationBehavior?: ScrollBehavior;
339
- /**
340
- * An array of selectors that will be used to scroll to the top of the page in addition to `window`
341
- *
342
- * @default ['window']
343
- */
344
- scrollToTopSelectors?: Array<string>;
345
- }
346
- export interface RouterErrorSerializer<TSerializedError> {
347
- serialize: (err: unknown) => TSerializedError;
348
- deserialize: (err: TSerializedError) => unknown;
349
- }
350
- export interface RouterState<TRouteTree extends AnyRoute = AnyRoute, TRouteMatch = MakeRouteMatchUnion> {
351
- status: 'pending' | 'idle';
352
- loadedAt: number;
353
- isLoading: boolean;
354
- isTransitioning: boolean;
355
- matches: Array<TRouteMatch>;
356
- pendingMatches?: Array<TRouteMatch>;
357
- cachedMatches: Array<TRouteMatch>;
358
- location: ParsedLocation<FullSearchSchema<TRouteTree>>;
359
- resolvedLocation?: ParsedLocation<FullSearchSchema<TRouteTree>>;
360
- statusCode: number;
361
- redirect?: ResolvedRedirect;
362
- }
363
- export type ListenerFn<TEvent extends RouterEvent> = (event: TEvent) => void;
364
- export interface BuildNextOptions {
365
- to?: string | number | null;
366
- params?: true | Updater<unknown>;
367
- search?: true | Updater<unknown>;
368
- hash?: true | Updater<string>;
369
- state?: true | NonNullableUpdater<ParsedHistoryState, HistoryState>;
370
- mask?: {
371
- to?: string | number | null;
372
- params?: true | Updater<unknown>;
373
- search?: true | Updater<unknown>;
374
- hash?: true | Updater<string>;
375
- state?: true | NonNullableUpdater<ParsedHistoryState, HistoryState>;
376
- unmaskOnReload?: boolean;
377
- };
378
- from?: string;
379
- _fromLocation?: ParsedLocation;
380
- href?: string;
381
- }
382
- export interface MatchedRoutesResult {
383
- matchedRoutes: Array<AnyRoute>;
384
- routeParams: Record<string, string>;
18
+ Wrap?: (props: {
19
+ children: any;
20
+ }) => Solid.JSX.Element;
21
+ /**
22
+ * A component that will be used to wrap the inner contents of the router.
23
+ *
24
+ * This is useful for providing a context to the inner contents of the router where you also need access to the router context and hooks.
25
+ *
26
+ * Only non-DOM-rendering components like providers should be used, anything else will cause a hydration error.
27
+ *
28
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#innerwrap-property)
29
+ */
30
+ InnerWrap?: (props: {
31
+ children: any;
32
+ }) => Solid.JSX.Element;
33
+ /**
34
+ * The default `component` a route should use if no component is provided.
35
+ *
36
+ * @default Outlet
37
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultcomponent-property)
38
+ */
39
+ defaultComponent?: RouteComponent;
40
+ /**
41
+ * The default `errorComponent` a route should use if no error component is provided.
42
+ *
43
+ * @default ErrorComponent
44
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaulterrorcomponent-property)
45
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#handling-errors-with-routeoptionserrorcomponent)
46
+ */
47
+ defaultErrorComponent?: ErrorRouteComponent;
48
+ /**
49
+ * The default `pendingComponent` a route should use if no pending component is provided.
50
+ *
51
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpendingcomponent-property)
52
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#showing-a-pending-component)
53
+ */
54
+ defaultPendingComponent?: RouteComponent;
55
+ /**
56
+ * The default `notFoundComponent` a route should use if no notFound component is provided.
57
+ *
58
+ * @default NotFound
59
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultnotfoundcomponent-property)
60
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/not-found-errors#default-router-wide-not-found-handling)
61
+ */
62
+ defaultNotFoundComponent?: NotFoundRouteComponent;
63
+ /**
64
+ * The default `onCatch` handler for errors caught by the Router ErrorBoundary
65
+ *
66
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultoncatch-property)
67
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#handling-errors-with-routeoptionsoncatch)
68
+ */
69
+ defaultOnCatch?: (error: Error) => void;
70
+ }
385
71
  }
386
- export type RouterConstructorOptions<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TRouterHistory extends RouterHistory, TDehydrated extends Record<string, any>> = Omit<RouterOptions<TRouteTree, TTrailingSlashOption, TRouterHistory, TDehydrated>, 'context'> & RouterContextOptions<TRouteTree>;
387
72
  export declare const componentTypes: readonly ["component", "errorComponent", "pendingComponent", "notFoundComponent"];
388
- type NavigationEventInfo = {
389
- fromLocation?: ParsedLocation;
390
- toLocation: ParsedLocation;
391
- pathChanged: boolean;
392
- hrefChanged: boolean;
393
- hashChanged: boolean;
394
- };
395
- export type RouterEvents = {
396
- onBeforeNavigate: {
397
- type: 'onBeforeNavigate';
398
- } & NavigationEventInfo;
399
- onBeforeLoad: {
400
- type: 'onBeforeLoad';
401
- } & NavigationEventInfo;
402
- onLoad: {
403
- type: 'onLoad';
404
- } & NavigationEventInfo;
405
- onResolved: {
406
- type: 'onResolved';
407
- } & NavigationEventInfo;
408
- onBeforeRouteMount: {
409
- type: 'onBeforeRouteMount';
410
- } & NavigationEventInfo;
411
- onInjectedHtml: {
412
- type: 'onInjectedHtml';
413
- promise: Promise<string>;
414
- };
415
- onRendered: {
416
- type: 'onRendered';
417
- } & NavigationEventInfo;
418
- };
419
- export type RouterEvent = RouterEvents[keyof RouterEvents];
420
- export type RouterListener<TRouterEvent extends RouterEvent> = {
421
- eventType: TRouterEvent['type'];
422
- fn: ListenerFn<TRouterEvent>;
423
- };
424
- export declare function createRouter<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TRouterHistory extends RouterHistory = RouterHistory, TDehydrated extends Record<string, any> = Record<string, any>, TSerializedError extends Record<string, any> = Record<string, any>>(options: undefined extends number ? 'strictNullChecks must be enabled in tsconfig.json' : RouterConstructorOptions<TRouteTree, TTrailingSlashOption, TRouterHistory, TDehydrated>): Router<TRouteTree, TTrailingSlashOption, TRouterHistory, TDehydrated, TSerializedError>;
425
- type MatchRoutesOpts = {
426
- preload?: boolean;
427
- throwOnError?: boolean;
428
- _buildLocation?: boolean;
429
- dest?: BuildNextOptions;
430
- };
431
- export declare class Router<in out TRouteTree extends AnyRoute, in out TTrailingSlashOption extends TrailingSlashOption, in out TRouterHistory extends RouterHistory = RouterHistory, in out TDehydrated extends Record<string, any> = Record<string, any>, in out TSerializedError extends Record<string, any> = Record<string, any>> {
73
+ export declare function createRouter<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TRouterHistory extends RouterHistory = RouterHistory, TDehydrated extends Record<string, any> = Record<string, any>>(options: undefined extends number ? 'strictNullChecks must be enabled in tsconfig.json' : RouterConstructorOptions<TRouteTree, TTrailingSlashOption, false, TRouterHistory, TDehydrated>): CoreRouter<TRouteTree, TTrailingSlashOption, false, TRouterHistory, TDehydrated>;
74
+ export declare class Router<in out TRouteTree extends AnyRoute, in out TTrailingSlashOption extends TrailingSlashOption, in out TRouterHistory extends RouterHistory = RouterHistory, in out TDehydrated extends Record<string, any> = Record<string, any>> implements CoreRouter<TRouteTree, TTrailingSlashOption, false, TRouterHistory, TDehydrated> {
432
75
  tempLocationKey: string | undefined;
433
76
  resetNextScroll: boolean;
434
77
  shouldViewTransition?: boolean | ViewTransitionOptions;
@@ -438,7 +81,7 @@ export declare class Router<in out TRouteTree extends AnyRoute, in out TTrailing
438
81
  isScrollRestoring: boolean;
439
82
  isScrollRestorationSetup: boolean;
440
83
  __store: Store<RouterState<TRouteTree>>;
441
- options: PickAsRequired<RouterOptions<TRouteTree, TTrailingSlashOption, TRouterHistory, TDehydrated>, 'stringifySearch' | 'parseSearch' | 'context'>;
84
+ options: PickAsRequired<RouterOptions<TRouteTree, TTrailingSlashOption, false, TRouterHistory, TDehydrated>, 'stringifySearch' | 'parseSearch' | 'context'>;
442
85
  history: TRouterHistory;
443
86
  latestLocation: ParsedLocation<FullSearchSchema<TRouteTree>>;
444
87
  basepath: string;
@@ -451,14 +94,14 @@ export declare class Router<in out TRouteTree extends AnyRoute, in out TTrailing
451
94
  /**
452
95
  * @deprecated Use the `createRouter` function instead
453
96
  */
454
- constructor(options: RouterConstructorOptions<TRouteTree, TTrailingSlashOption, TRouterHistory, TDehydrated>);
455
- startSolidTransition: (fn: () => void) => void;
456
- update: (newOptions: RouterConstructorOptions<TRouteTree, TTrailingSlashOption, TRouterHistory, TDehydrated>) => void;
97
+ constructor(options: RouterConstructorOptions<TRouteTree, TTrailingSlashOption, false, TRouterHistory, TDehydrated>);
98
+ startTransition: StartTransitionFn;
99
+ update: UpdateFn<TRouteTree, TTrailingSlashOption, false, TRouterHistory, TDehydrated>;
457
100
  get state(): RouterState<TRouteTree, import('@tanstack/router-core').RouteMatch<any, any, any, any, any, any, any>>;
458
101
  buildRouteTree: () => void;
459
- subscribe: <TType extends keyof RouterEvents>(eventType: TType, fn: ListenerFn<RouterEvents[TType]>) => () => void;
460
- emit: (routerEvent: RouterEvent) => void;
461
- parseLocation: (previousLocation?: ParsedLocation<FullSearchSchema<TRouteTree>>, locationToParse?: HistoryLocation) => ParsedLocation<FullSearchSchema<TRouteTree>>;
102
+ subscribe: SubscribeFn;
103
+ emit: EmitFn;
104
+ parseLocation: ParseLocationFn<TRouteTree>;
462
105
  resolvePathWithBase: (from: string, path: string) => string;
463
106
  get looseRoutesById(): Record<string, AnyRoute>;
464
107
  /**
@@ -470,28 +113,21 @@ export declare class Router<in out TRouteTree extends AnyRoute, in out TTrailing
470
113
  ): Array<AnyRouteMatch>;
471
114
  ```
472
115
  */
473
- matchRoutes(pathname: string, locationSearch: AnySchema, opts?: MatchRoutesOpts): Array<AnyRouteMatch>;
474
- matchRoutes(next: ParsedLocation, opts?: MatchRoutesOpts): Array<AnyRouteMatch>;
116
+ matchRoutes: MatchRoutesFn;
475
117
  private matchRoutesInternal;
476
- getMatchedRoutes: (next: ParsedLocation, dest?: BuildNextOptions) => {
477
- matchedRoutes: AnyRoute[];
478
- routeParams: Record<string, string>;
479
- foundRoute: AnyRoute | undefined;
480
- };
118
+ getMatchedRoutes: GetMatchRoutesFn;
481
119
  cancelMatch: (id: string) => void;
482
120
  cancelMatches: () => void;
483
121
  buildLocation: BuildLocationFn;
484
122
  commitLocationPromise: undefined | ControlledPromise<void>;
485
- commitLocation: ({ viewTransition, ignoreBlocker, ...next }: ParsedLocation & CommitLocationOptions) => Promise<void>;
123
+ commitLocation: CommitLocationFn;
486
124
  buildAndCommitLocation: ({ replace, resetScroll, hashScrollIntoView, viewTransition, ignoreBlocker, href, ...rest }?: BuildNextOptions & CommitLocationOptions) => Promise<void>;
487
125
  navigate: NavigateFn;
488
126
  latestLoadPromise: undefined | Promise<void>;
489
- load: (opts?: {
490
- sync?: boolean;
491
- }) => Promise<void>;
127
+ load: LoadFn;
492
128
  startViewTransition: (fn: () => Promise<void>) => void;
493
- updateMatch: (id: string, updater: (match: AnyRouteMatch) => AnyRouteMatch) => AnyRouteMatch;
494
- getMatch: (matchId: string) => import('@tanstack/router-core').RouteMatch<any, any, any, any, any, any, any> | undefined;
129
+ updateMatch: UpdateMatchFn;
130
+ getMatch: GetMatchFn;
495
131
  loadMatches: ({ location, matches, preload: allPreload, onReady, updateMatch, sync, }: {
496
132
  location: ParsedLocation;
497
133
  matches: Array<AnyRouteMatch>;
@@ -501,18 +137,13 @@ export declare class Router<in out TRouteTree extends AnyRoute, in out TTrailing
501
137
  getMatch?: (matchId: string) => AnyRouteMatch | undefined;
502
138
  sync?: boolean;
503
139
  }) => Promise<Array<MakeRouteMatch>>;
504
- invalidate: <TRouter extends AnyRouter = this>(opts?: {
505
- filter?: (d: MakeRouteMatchUnion<TRouter>) => boolean;
506
- sync?: boolean;
507
- }) => Promise<void>;
140
+ invalidate: InvalidateFn<this>;
508
141
  resolveRedirect: (err: AnyRedirect) => ResolvedRedirect;
509
- clearCache: <TRouter extends AnyRouter = this>(opts?: {
510
- filter?: (d: MakeRouteMatchUnion<TRouter>) => boolean;
511
- }) => void;
142
+ clearCache: ClearCacheFn<this>;
512
143
  clearExpiredCache: () => void;
513
144
  loadRouteChunk: (route: AnyRoute) => Promise<void[]>;
514
- preloadRoute: <TFrom extends RoutePaths<TRouteTree> | string = string, TTo extends string | undefined = undefined, TMaskFrom extends RoutePaths<TRouteTree> | string = TFrom, TMaskTo extends string = "">(opts: NavigateOptions<Router<TRouteTree, TTrailingSlashOption, TRouterHistory, TDehydrated, TSerializedError>, TFrom, TTo, TMaskFrom, TMaskTo>) => Promise<Array<AnyRouteMatch> | undefined>;
515
- matchRoute: <TFrom extends RoutePaths<TRouteTree> = "/", TTo extends string | undefined = undefined, TResolved = ResolveRelativePath<TFrom, NoInfer<TTo>>>(location: ToOptions<Router<TRouteTree, TTrailingSlashOption, TRouterHistory, TDehydrated, TSerializedError>, TFrom, TTo>, opts?: MatchRouteOptions) => false | RouteById<TRouteTree, TResolved>["types"]["allParams"];
145
+ preloadRoute: PreloadRouteFn<TRouteTree, TTrailingSlashOption, false, TRouterHistory>;
146
+ matchRoute: MatchRouteFn<TRouteTree, TTrailingSlashOption, false, TRouterHistory>;
516
147
  ssr?: {
517
148
  manifest: Manifest | undefined;
518
149
  serializer: StartSerializer;
@@ -544,4 +175,3 @@ export declare class SearchParamError extends Error {
544
175
  export declare class PathParamError extends Error {
545
176
  }
546
177
  export declare function getInitialRouterState(location: ParsedLocation): RouterState<any>;
547
- export {};
@@ -1 +1 @@
1
- {"version":3,"file":"routerContext.cjs","sources":["../../src/routerContext.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport type { AnyRouter, Router } from './router'\n\ndeclare global {\n interface Window {\n __TSR_ROUTER_CONTEXT__?: Solid.Context<AnyRouter>\n }\n}\n\nconst routerContext = Solid.createContext<Router<any, any, any>>(\n null as unknown as Router<any, any, any>,\n)\n\nexport function getRouterContext() {\n if (typeof document === 'undefined') {\n return routerContext\n }\n\n if (window.__TSR_ROUTER_CONTEXT__) {\n return window.__TSR_ROUTER_CONTEXT__\n }\n\n window.__TSR_ROUTER_CONTEXT__ = routerContext as any\n\n return routerContext\n}\n"],"names":["routerContext","Solid","createContext","getRouterContext","document","window","__TSR_ROUTER_CONTEXT__"],"mappings":";;;;;;;;;;;;;;;;;;;;AASA,MAAMA,gBAAgBC,iBAAMC,cAC1B,IACF;AAEO,SAASC,mBAAmB;AAC7B,MAAA,OAAOC,aAAa,aAAa;AAC5BJ,WAAAA;AAAAA,EAAAA;AAGT,MAAIK,OAAOC,wBAAwB;AACjC,WAAOD,OAAOC;AAAAA,EAAAA;AAGhBD,SAAOC,yBAAyBN;AAEzBA,SAAAA;AACT;;"}
1
+ {"version":3,"file":"routerContext.cjs","sources":["../../src/routerContext.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport type { AnyRouter } from '@tanstack/router-core'\n\ndeclare global {\n interface Window {\n __TSR_ROUTER_CONTEXT__?: Solid.Context<AnyRouter>\n }\n}\n\nconst routerContext = Solid.createContext<AnyRouter>(\n null as unknown as AnyRouter,\n)\n\nexport function getRouterContext() {\n if (typeof document === 'undefined') {\n return routerContext\n }\n\n if (window.__TSR_ROUTER_CONTEXT__) {\n return window.__TSR_ROUTER_CONTEXT__\n }\n\n window.__TSR_ROUTER_CONTEXT__ = routerContext as any\n\n return routerContext\n}\n"],"names":["routerContext","Solid","createContext","getRouterContext","document","window","__TSR_ROUTER_CONTEXT__"],"mappings":";;;;;;;;;;;;;;;;;;;;AASA,MAAMA,gBAAgBC,iBAAMC,cAC1B,IACF;AAEO,SAASC,mBAAmB;AAC7B,MAAA,OAAOC,aAAa,aAAa;AAC5BJ,WAAAA;AAAAA,EAAAA;AAGT,MAAIK,OAAOC,wBAAwB;AACjC,WAAOD,OAAOC;AAAAA,EAAAA;AAGhBD,SAAOC,yBAAyBN;AAEzBA,SAAAA;AACT;;"}
@@ -1,8 +1,8 @@
1
- import { AnyRouter, Router } from './router.cjs';
1
+ import { AnyRouter } from '@tanstack/router-core';
2
2
  import * as Solid from 'solid-js';
3
3
  declare global {
4
4
  interface Window {
5
5
  __TSR_ROUTER_CONTEXT__?: Solid.Context<AnyRouter>;
6
6
  }
7
7
  }
8
- export declare function getRouterContext(): Solid.Context<AnyRouter> | Solid.Context<Router<any, any, any, Record<string, any>, Record<string, any>>>;
8
+ export declare function getRouterContext(): Solid.Context<AnyRouter>;