@tanstack/solid-router 1.120.4-alpha.19 → 1.120.4
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.
- package/dist/cjs/HeadContent.cjs +6 -18
- package/dist/cjs/HeadContent.cjs.map +1 -1
- package/dist/cjs/Match.cjs +0 -20
- package/dist/cjs/Match.cjs.map +1 -1
- package/dist/cjs/Matches.cjs.map +1 -1
- package/dist/cjs/Matches.d.cts +2 -2
- package/dist/cjs/ScrollRestoration.cjs +2 -2
- package/dist/cjs/ScrollRestoration.cjs.map +1 -1
- package/dist/cjs/fileRoute.cjs +0 -8
- package/dist/cjs/fileRoute.cjs.map +1 -1
- package/dist/cjs/fileRoute.d.cts +5 -16
- package/dist/cjs/index.d.cts +1 -1
- package/dist/cjs/router.cjs +0 -8
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/useBlocker.cjs +1 -1
- package/dist/cjs/useBlocker.cjs.map +1 -1
- package/dist/esm/HeadContent.js +6 -18
- package/dist/esm/HeadContent.js.map +1 -1
- package/dist/esm/Match.js +0 -20
- package/dist/esm/Match.js.map +1 -1
- package/dist/esm/Matches.d.ts +2 -2
- package/dist/esm/Matches.js.map +1 -1
- package/dist/esm/ScrollRestoration.js +2 -2
- package/dist/esm/ScrollRestoration.js.map +1 -1
- package/dist/esm/fileRoute.d.ts +5 -16
- package/dist/esm/fileRoute.js +0 -8
- package/dist/esm/fileRoute.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/router.js +0 -8
- package/dist/esm/router.js.map +1 -1
- package/dist/esm/useBlocker.js +1 -1
- package/dist/esm/useBlocker.js.map +1 -1
- package/dist/source/HeadContent.jsx +10 -25
- package/dist/source/HeadContent.jsx.map +1 -1
- package/dist/source/Match.jsx +0 -6
- package/dist/source/Match.jsx.map +1 -1
- package/dist/source/Matches.d.ts +2 -2
- package/dist/source/Matches.jsx.map +1 -1
- package/dist/source/ScrollRestoration.jsx +1 -1
- package/dist/source/ScrollRestoration.jsx.map +1 -1
- package/dist/source/fileRoute.d.ts +5 -16
- package/dist/source/fileRoute.js +0 -8
- package/dist/source/fileRoute.js.map +1 -1
- package/dist/source/index.d.ts +1 -1
- package/dist/source/index.jsx.map +1 -1
- package/dist/source/router.js +0 -11
- package/dist/source/router.js.map +1 -1
- package/dist/source/useBlocker.jsx +1 -1
- package/dist/source/useBlocker.jsx.map +1 -1
- package/package.json +3 -3
- package/src/HeadContent.tsx +3 -23
- package/src/Match.tsx +0 -10
- package/src/Matches.tsx +1 -2
- package/src/ScrollRestoration.tsx +1 -1
- package/src/fileRoute.ts +4 -26
- package/src/index.tsx +3 -4
- package/src/router.ts +0 -9
- package/src/useBlocker.tsx +1 -4
package/src/fileRoute.ts
CHANGED
|
@@ -28,7 +28,6 @@ import type {
|
|
|
28
28
|
RouteIds,
|
|
29
29
|
RouteLoaderFn,
|
|
30
30
|
UpdatableRouteOptions,
|
|
31
|
-
UseNavigateResult,
|
|
32
31
|
} from '@tanstack/router-core'
|
|
33
32
|
import type { UseLoaderDepsRoute } from './useLoaderDeps'
|
|
34
33
|
import type { UseLoaderDataRoute } from './useLoaderData'
|
|
@@ -42,13 +41,8 @@ export function createFileRoute<
|
|
|
42
41
|
TFullPath extends
|
|
43
42
|
RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath'],
|
|
44
43
|
>(
|
|
45
|
-
path
|
|
44
|
+
path: TFilePath,
|
|
46
45
|
): FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>['createRoute'] {
|
|
47
|
-
if (typeof path === 'object') {
|
|
48
|
-
return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {
|
|
49
|
-
silent: true,
|
|
50
|
-
}).createRoute(path) as any
|
|
51
|
-
}
|
|
52
46
|
return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {
|
|
53
47
|
silent: true,
|
|
54
48
|
}).createRoute
|
|
@@ -69,7 +63,7 @@ export class FileRoute<
|
|
|
69
63
|
silent?: boolean
|
|
70
64
|
|
|
71
65
|
constructor(
|
|
72
|
-
public path
|
|
66
|
+
public path: TFilePath,
|
|
73
67
|
_opts?: { silent: boolean },
|
|
74
68
|
) {
|
|
75
69
|
this.silent = _opts?.silent
|
|
@@ -165,18 +159,6 @@ export function FileRouteLoader<
|
|
|
165
159
|
return (loaderFn) => loaderFn as any
|
|
166
160
|
}
|
|
167
161
|
|
|
168
|
-
declare module '@tanstack/router-core' {
|
|
169
|
-
export interface LazyRoute<in out TRoute extends AnyRoute> {
|
|
170
|
-
useMatch: UseMatchRoute<TRoute['id']>
|
|
171
|
-
useRouteContext: UseRouteContextRoute<TRoute['id']>
|
|
172
|
-
useSearch: UseSearchRoute<TRoute['id']>
|
|
173
|
-
useParams: UseParamsRoute<TRoute['id']>
|
|
174
|
-
useLoaderDeps: UseLoaderDepsRoute<TRoute['id']>
|
|
175
|
-
useLoaderData: UseLoaderDataRoute<TRoute['id']>
|
|
176
|
-
useNavigate: () => UseNavigateResult<TRoute['fullPath']>
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
162
|
export class LazyRoute<TRoute extends AnyRoute> {
|
|
181
163
|
options: {
|
|
182
164
|
id: string
|
|
@@ -226,7 +208,7 @@ export class LazyRoute<TRoute extends AnyRoute> {
|
|
|
226
208
|
return useLoaderData({ ...opts, from: this.options.id } as any)
|
|
227
209
|
}
|
|
228
210
|
|
|
229
|
-
useNavigate = ()
|
|
211
|
+
useNavigate = () => {
|
|
230
212
|
const router = useRouter()
|
|
231
213
|
return useNavigate({ from: router.routesById[this.options.id].fullPath })
|
|
232
214
|
}
|
|
@@ -247,10 +229,6 @@ export function createLazyRoute<
|
|
|
247
229
|
export function createLazyFileRoute<
|
|
248
230
|
TFilePath extends keyof FileRoutesByPath,
|
|
249
231
|
TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],
|
|
250
|
-
>(id: TFilePath)
|
|
251
|
-
if (typeof id === 'object') {
|
|
252
|
-
return new LazyRoute<TRoute>(id) as any
|
|
253
|
-
}
|
|
254
|
-
|
|
232
|
+
>(id: TFilePath) {
|
|
255
233
|
return (opts: LazyRouteOptions) => new LazyRoute<TRoute>({ id, ...opts })
|
|
256
234
|
}
|
package/src/index.tsx
CHANGED
|
@@ -47,6 +47,7 @@ export type {
|
|
|
47
47
|
DeferredPromiseState,
|
|
48
48
|
DeferredPromise,
|
|
49
49
|
ParsedLocation,
|
|
50
|
+
ParsePathParams,
|
|
50
51
|
RemoveTrailingSlashes,
|
|
51
52
|
RemoveLeadingSlashes,
|
|
52
53
|
ActiveOptions,
|
|
@@ -55,8 +56,6 @@ export type {
|
|
|
55
56
|
RootRouteId,
|
|
56
57
|
AnyPathParams,
|
|
57
58
|
ResolveParams,
|
|
58
|
-
ResolveOptionalParams,
|
|
59
|
-
ResolveRequiredParams,
|
|
60
59
|
SearchSchemaInput,
|
|
61
60
|
AnyContext,
|
|
62
61
|
RouteContext,
|
|
@@ -78,6 +77,8 @@ export type {
|
|
|
78
77
|
TrimPath,
|
|
79
78
|
TrimPathLeft,
|
|
80
79
|
TrimPathRight,
|
|
80
|
+
ParseSplatParams,
|
|
81
|
+
SplatParams,
|
|
81
82
|
StringifyParamsFn,
|
|
82
83
|
ParamsOptions,
|
|
83
84
|
InferAllParams,
|
|
@@ -206,8 +207,6 @@ export type {
|
|
|
206
207
|
InjectedHtmlEntry,
|
|
207
208
|
RouterErrorSerializer,
|
|
208
209
|
SerializerExtensions,
|
|
209
|
-
CreateFileRoute,
|
|
210
|
-
CreateLazyFileRoute,
|
|
211
210
|
} from '@tanstack/router-core'
|
|
212
211
|
|
|
213
212
|
export {
|
package/src/router.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { RouterCore } from '@tanstack/router-core'
|
|
2
|
-
import { createFileRoute, createLazyFileRoute } from './fileRoute'
|
|
3
2
|
import type { RouterHistory } from '@tanstack/history'
|
|
4
3
|
import type {
|
|
5
4
|
AnyRoute,
|
|
@@ -102,11 +101,3 @@ export class Router<
|
|
|
102
101
|
super(options)
|
|
103
102
|
}
|
|
104
103
|
}
|
|
105
|
-
|
|
106
|
-
if (typeof globalThis !== 'undefined') {
|
|
107
|
-
;(globalThis as any).createFileRoute = createFileRoute
|
|
108
|
-
;(globalThis as any).createLazyFileRoute = createLazyFileRoute
|
|
109
|
-
} else if (typeof window !== 'undefined') {
|
|
110
|
-
;(window as any).createFileRoute = createFileRoute
|
|
111
|
-
;(window as any).createFileRoute = createLazyFileRoute
|
|
112
|
-
}
|
package/src/useBlocker.tsx
CHANGED
|
@@ -180,10 +180,7 @@ export function useBlocker(
|
|
|
180
180
|
location: HistoryLocation,
|
|
181
181
|
): AnyShouldBlockFnLocation {
|
|
182
182
|
const parsedLocation = router.parseLocation(undefined, location)
|
|
183
|
-
const matchedRoutes = router.getMatchedRoutes(
|
|
184
|
-
parsedLocation.pathname,
|
|
185
|
-
undefined,
|
|
186
|
-
)
|
|
183
|
+
const matchedRoutes = router.getMatchedRoutes(parsedLocation)
|
|
187
184
|
if (matchedRoutes.foundRoute === undefined) {
|
|
188
185
|
throw new Error(`No route found for location ${location.href}`)
|
|
189
186
|
}
|