@tanstack/router-core 1.115.0 → 1.117.0
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/redirect.cjs.map +1 -1
- package/dist/cjs/redirect.d.cts +1 -1
- package/dist/cjs/router.cjs +9 -1
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +7 -1
- package/dist/esm/redirect.d.ts +1 -1
- package/dist/esm/redirect.js.map +1 -1
- package/dist/esm/router.d.ts +7 -1
- package/dist/esm/router.js +9 -1
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/redirect.ts +2 -2
- package/src/router.ts +23 -2
package/package.json
CHANGED
package/src/redirect.ts
CHANGED
|
@@ -51,8 +51,8 @@ export type ResolvedRedirect<
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
export function redirect<
|
|
54
|
-
TRouter extends RegisteredRouter,
|
|
55
|
-
const TTo extends string | undefined,
|
|
54
|
+
TRouter extends AnyRouter = RegisteredRouter,
|
|
55
|
+
const TTo extends string | undefined = '.',
|
|
56
56
|
const TFrom extends string = string,
|
|
57
57
|
const TMaskFrom extends string = TFrom,
|
|
58
58
|
const TMaskTo extends string = '',
|
package/src/router.ts
CHANGED
|
@@ -670,7 +670,15 @@ export type AnyRouterWithContext<TContext> = RouterCore<
|
|
|
670
670
|
export type AnyRouter = RouterCore<any, any, any, any, any>
|
|
671
671
|
|
|
672
672
|
export interface ViewTransitionOptions {
|
|
673
|
-
types:
|
|
673
|
+
types:
|
|
674
|
+
| Array<string>
|
|
675
|
+
| ((locationChangeInfo: {
|
|
676
|
+
fromLocation?: ParsedLocation
|
|
677
|
+
toLocation: ParsedLocation
|
|
678
|
+
pathChanged: boolean
|
|
679
|
+
hrefChanged: boolean
|
|
680
|
+
hashChanged: boolean
|
|
681
|
+
}) => Array<string>)
|
|
674
682
|
}
|
|
675
683
|
|
|
676
684
|
export function defaultSerializeError(err: unknown) {
|
|
@@ -2172,9 +2180,22 @@ export class RouterCore<
|
|
|
2172
2180
|
typeof shouldViewTransition === 'object' &&
|
|
2173
2181
|
this.isViewTransitionTypesSupported
|
|
2174
2182
|
) {
|
|
2183
|
+
const next = this.latestLocation
|
|
2184
|
+
const prevLocation = this.state.resolvedLocation
|
|
2185
|
+
|
|
2186
|
+
const resolvedViewTransitionTypes =
|
|
2187
|
+
typeof shouldViewTransition.types === 'function'
|
|
2188
|
+
? shouldViewTransition.types(
|
|
2189
|
+
getLocationChangeInfo({
|
|
2190
|
+
resolvedLocation: prevLocation,
|
|
2191
|
+
location: next,
|
|
2192
|
+
}),
|
|
2193
|
+
)
|
|
2194
|
+
: shouldViewTransition.types
|
|
2195
|
+
|
|
2175
2196
|
startViewTransitionParams = {
|
|
2176
2197
|
update: fn,
|
|
2177
|
-
types:
|
|
2198
|
+
types: resolvedViewTransitionTypes,
|
|
2178
2199
|
}
|
|
2179
2200
|
} else {
|
|
2180
2201
|
startViewTransitionParams = fn
|