@tanstack/react-router 1.120.3 → 1.120.4-alpha.10
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 +23 -6
- package/dist/cjs/HeadContent.cjs.map +1 -1
- package/dist/cjs/Matches.cjs.map +1 -1
- package/dist/cjs/Matches.d.cts +2 -2
- package/dist/cjs/RouterProvider.cjs +10 -8
- package/dist/cjs/RouterProvider.cjs.map +1 -1
- package/dist/cjs/Scripts.cjs +2 -1
- package/dist/cjs/Scripts.cjs.map +1 -1
- package/dist/cjs/fileRoute.cjs +8 -0
- package/dist/cjs/fileRoute.cjs.map +1 -1
- package/dist/cjs/fileRoute.d.cts +16 -5
- package/dist/cjs/index.d.cts +2 -2
- package/dist/cjs/router.cjs +8 -0
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/useBlocker.cjs +4 -1
- package/dist/cjs/useBlocker.cjs.map +1 -1
- package/dist/esm/HeadContent.js +23 -6
- package/dist/esm/HeadContent.js.map +1 -1
- package/dist/esm/Matches.d.ts +2 -2
- package/dist/esm/Matches.js.map +1 -1
- package/dist/esm/RouterProvider.js +10 -8
- package/dist/esm/RouterProvider.js.map +1 -1
- package/dist/esm/Scripts.js +2 -1
- package/dist/esm/Scripts.js.map +1 -1
- package/dist/esm/fileRoute.d.ts +16 -5
- package/dist/esm/fileRoute.js +8 -0
- package/dist/esm/fileRoute.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/router.js +8 -0
- package/dist/esm/router.js.map +1 -1
- package/dist/esm/useBlocker.js +4 -1
- package/dist/esm/useBlocker.js.map +1 -1
- package/package.json +3 -3
- package/src/HeadContent.tsx +26 -3
- package/src/Matches.tsx +4 -1
- package/src/RouterProvider.tsx +11 -9
- package/src/Scripts.tsx +1 -0
- package/src/fileRoute.ts +26 -4
- package/src/index.tsx +4 -3
- package/src/router.ts +9 -0
- package/src/useBlocker.tsx +4 -1
package/src/index.tsx
CHANGED
|
@@ -48,7 +48,6 @@ export type {
|
|
|
48
48
|
DeferredPromiseState,
|
|
49
49
|
DeferredPromise,
|
|
50
50
|
ParsedLocation,
|
|
51
|
-
ParsePathParams,
|
|
52
51
|
RemoveTrailingSlashes,
|
|
53
52
|
RemoveLeadingSlashes,
|
|
54
53
|
ActiveOptions,
|
|
@@ -57,6 +56,8 @@ export type {
|
|
|
57
56
|
RootRouteId,
|
|
58
57
|
AnyPathParams,
|
|
59
58
|
ResolveParams,
|
|
59
|
+
ResolveOptionalParams,
|
|
60
|
+
ResolveRequiredParams,
|
|
60
61
|
SearchSchemaInput,
|
|
61
62
|
AnyContext,
|
|
62
63
|
RouteContext,
|
|
@@ -78,8 +79,6 @@ export type {
|
|
|
78
79
|
TrimPath,
|
|
79
80
|
TrimPathLeft,
|
|
80
81
|
TrimPathRight,
|
|
81
|
-
ParseSplatParams,
|
|
82
|
-
SplatParams,
|
|
83
82
|
StringifyParamsFn,
|
|
84
83
|
ParamsOptions,
|
|
85
84
|
InferAllParams,
|
|
@@ -126,6 +125,7 @@ export type {
|
|
|
126
125
|
RouteById,
|
|
127
126
|
RootRouteOptions,
|
|
128
127
|
SerializerExtensions,
|
|
128
|
+
CreateFileRoute,
|
|
129
129
|
} from '@tanstack/router-core'
|
|
130
130
|
|
|
131
131
|
export type * from './serializer'
|
|
@@ -237,6 +237,7 @@ export type {
|
|
|
237
237
|
RouteConstraints,
|
|
238
238
|
RouteMask,
|
|
239
239
|
MatchRouteOptions,
|
|
240
|
+
CreateLazyFileRoute,
|
|
240
241
|
} from '@tanstack/router-core'
|
|
241
242
|
export type {
|
|
242
243
|
UseLinkPropsOptions,
|
package/src/router.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RouterCore } from '@tanstack/router-core'
|
|
2
|
+
import { createFileRoute, createLazyFileRoute } from './fileRoute'
|
|
2
3
|
import type { RouterHistory } from '@tanstack/history'
|
|
3
4
|
import type {
|
|
4
5
|
AnyRoute,
|
|
@@ -105,3 +106,11 @@ export class Router<
|
|
|
105
106
|
super(options)
|
|
106
107
|
}
|
|
107
108
|
}
|
|
109
|
+
|
|
110
|
+
if (typeof globalThis !== 'undefined') {
|
|
111
|
+
;(globalThis as any).createFileRoute = createFileRoute
|
|
112
|
+
;(globalThis as any).createLazyFileRoute = createLazyFileRoute
|
|
113
|
+
} else if (typeof window !== 'undefined') {
|
|
114
|
+
;(window as any).createFileRoute = createFileRoute
|
|
115
|
+
;(window as any).createFileRoute = createLazyFileRoute
|
|
116
|
+
}
|
package/src/useBlocker.tsx
CHANGED
|
@@ -177,7 +177,10 @@ export function useBlocker(
|
|
|
177
177
|
location: HistoryLocation,
|
|
178
178
|
): AnyShouldBlockFnLocation {
|
|
179
179
|
const parsedLocation = router.parseLocation(undefined, location)
|
|
180
|
-
const matchedRoutes = router.getMatchedRoutes(
|
|
180
|
+
const matchedRoutes = router.getMatchedRoutes(
|
|
181
|
+
parsedLocation.pathname,
|
|
182
|
+
undefined,
|
|
183
|
+
)
|
|
181
184
|
if (matchedRoutes.foundRoute === undefined) {
|
|
182
185
|
throw new Error(`No route found for location ${location.href}`)
|
|
183
186
|
}
|