@tanstack/solid-router 1.120.2 → 1.120.4-alpha.1
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 +18 -6
- package/dist/cjs/HeadContent.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 +1 -1
- package/dist/cjs/link.cjs.map +1 -1
- package/dist/cjs/link.d.cts +4 -1
- package/dist/cjs/route.cjs.map +1 -1
- package/dist/cjs/route.d.cts +1 -1
- package/dist/cjs/router.cjs +8 -0
- 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 +18 -6
- package/dist/esm/HeadContent.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 +1 -1
- package/dist/esm/link.d.ts +4 -1
- package/dist/esm/link.js.map +1 -1
- package/dist/esm/route.d.ts +1 -1
- package/dist/esm/route.js.map +1 -1
- package/dist/esm/router.js +8 -0
- 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 +25 -10
- package/dist/source/HeadContent.jsx.map +1 -1
- package/dist/source/fileRoute.d.ts +16 -5
- package/dist/source/fileRoute.js +8 -0
- 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/link.d.ts +4 -1
- package/dist/source/link.jsx.map +1 -1
- package/dist/source/route.d.ts +1 -1
- package/dist/source/route.jsx +6 -6
- package/dist/source/route.jsx.map +1 -1
- package/dist/source/router.js +11 -0
- 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 +23 -3
- package/src/fileRoute.ts +26 -4
- package/src/index.tsx +2 -0
- package/src/link.tsx +19 -14
- package/src/route.tsx +8 -8
- package/src/router.ts +9 -0
- package/src/useBlocker.tsx +4 -1
package/src/link.tsx
CHANGED
|
@@ -522,20 +522,25 @@ export type LinkComponent<
|
|
|
522
522
|
props: LinkComponentProps<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,
|
|
523
523
|
) => Solid.JSX.Element
|
|
524
524
|
|
|
525
|
-
export
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
525
|
+
export interface LinkComponentRoute<
|
|
526
|
+
in out TDefaultFrom extends string = string,
|
|
527
|
+
> {
|
|
528
|
+
defaultFrom: TDefaultFrom
|
|
529
|
+
<
|
|
530
|
+
TRouter extends AnyRouter = RegisteredRouter,
|
|
531
|
+
const TTo extends string | undefined = undefined,
|
|
532
|
+
const TMaskTo extends string = '',
|
|
533
|
+
>(
|
|
534
|
+
props: LinkComponentProps<
|
|
535
|
+
'a',
|
|
536
|
+
TRouter,
|
|
537
|
+
this['defaultFrom'],
|
|
538
|
+
TTo,
|
|
539
|
+
this['defaultFrom'],
|
|
540
|
+
TMaskTo
|
|
541
|
+
>,
|
|
542
|
+
): Solid.JSX.Element
|
|
543
|
+
}
|
|
539
544
|
|
|
540
545
|
export function createLink<const TComp>(
|
|
541
546
|
Comp: Constrain<TComp, any, (props: CreateLinkProps) => Solid.JSX.Element>,
|
package/src/route.tsx
CHANGED
|
@@ -53,8 +53,8 @@ declare module '@tanstack/router-core' {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
export interface RouteExtensions<
|
|
56
|
-
TId extends string,
|
|
57
|
-
TFullPath extends string,
|
|
56
|
+
in out TId extends string,
|
|
57
|
+
in out TFullPath extends string,
|
|
58
58
|
> {
|
|
59
59
|
useMatch: UseMatchRoute<TId>
|
|
60
60
|
useRouteContext: UseRouteContextRoute<TId>
|
|
@@ -132,13 +132,13 @@ export class RouteApi<
|
|
|
132
132
|
return notFound({ routeId: this.id as string, ...opts })
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
Link: LinkComponentRoute<RouteTypesById<TRouter, TId>['fullPath']> = (
|
|
135
|
+
Link: LinkComponentRoute<RouteTypesById<TRouter, TId>['fullPath']> = ((
|
|
136
136
|
props,
|
|
137
137
|
) => {
|
|
138
138
|
const router = useRouter()
|
|
139
139
|
const fullPath = router.routesById[this.id as string].fullPath
|
|
140
140
|
return <Link from={fullPath as never} {...props} />
|
|
141
|
-
}
|
|
141
|
+
}) as LinkComponentRoute<RouteTypesById<TRouter, TId>['fullPath']>
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
export class Route<
|
|
@@ -242,9 +242,9 @@ export class Route<
|
|
|
242
242
|
return useNavigate({ from: this.fullPath })
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
Link: LinkComponentRoute<TFullPath> = (props) => {
|
|
245
|
+
Link: LinkComponentRoute<TFullPath> = ((props) => {
|
|
246
246
|
return <Link from={this.fullPath} {...props} />
|
|
247
|
-
}
|
|
247
|
+
}) as LinkComponentRoute<TFullPath>
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
export function createRoute<
|
|
@@ -427,9 +427,9 @@ export class RootRoute<
|
|
|
427
427
|
return useNavigate({ from: this.fullPath })
|
|
428
428
|
}
|
|
429
429
|
|
|
430
|
-
Link: LinkComponentRoute<'/'> = (props) => {
|
|
430
|
+
Link: LinkComponentRoute<'/'> = ((props) => {
|
|
431
431
|
return <Link from={this.fullPath} {...(props as any)} />
|
|
432
|
-
}
|
|
432
|
+
}) as LinkComponentRoute<'/'>
|
|
433
433
|
}
|
|
434
434
|
|
|
435
435
|
export function createRouteMask<
|
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,
|
|
@@ -101,3 +102,11 @@ export class Router<
|
|
|
101
102
|
super(options)
|
|
102
103
|
}
|
|
103
104
|
}
|
|
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,7 +180,10 @@ export function useBlocker(
|
|
|
180
180
|
location: HistoryLocation,
|
|
181
181
|
): AnyShouldBlockFnLocation {
|
|
182
182
|
const parsedLocation = router.parseLocation(undefined, location)
|
|
183
|
-
const matchedRoutes = router.getMatchedRoutes(
|
|
183
|
+
const matchedRoutes = router.getMatchedRoutes(
|
|
184
|
+
parsedLocation.pathname,
|
|
185
|
+
undefined,
|
|
186
|
+
)
|
|
184
187
|
if (matchedRoutes.foundRoute === undefined) {
|
|
185
188
|
throw new Error(`No route found for location ${location.href}`)
|
|
186
189
|
}
|