@tanstack/router-core 0.0.1-beta.185 → 0.0.1-beta.187
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/build/cjs/fileRoute.js.map +1 -1
- package/build/cjs/history.js +20 -18
- package/build/cjs/history.js.map +1 -1
- package/build/cjs/index.js +1 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/route.js +4 -0
- package/build/cjs/route.js.map +1 -1
- package/build/cjs/router.js +211 -101
- package/build/cjs/router.js.map +1 -1
- package/build/cjs/scroll-restoration.js +1 -1
- package/build/cjs/scroll-restoration.js.map +1 -1
- package/build/cjs/utils.js +15 -0
- package/build/cjs/utils.js.map +1 -1
- package/build/esm/index.js +252 -122
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +132 -132
- package/build/types/fileRoute.d.ts +1 -0
- package/build/types/history.d.ts +8 -3
- package/build/types/link.d.ts +23 -18
- package/build/types/route.d.ts +23 -7
- package/build/types/routeInfo.d.ts +3 -3
- package/build/types/router.d.ts +30 -20
- package/build/types/utils.d.ts +2 -11
- package/build/umd/index.development.js +252 -121
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +2 -2
- package/build/umd/index.production.js.map +1 -1
- package/package.json +1 -1
- package/src/fileRoute.ts +3 -3
- package/src/history.ts +33 -25
- package/src/link.ts +66 -51
- package/src/route.ts +61 -16
- package/src/routeInfo.ts +3 -3
- package/src/router.ts +331 -177
- package/src/scroll-restoration.ts +1 -1
- package/src/utils.ts +21 -17
|
@@ -22,7 +22,7 @@ export type ScrollRestorationOptions = {
|
|
|
22
22
|
getKey?: (location: ParsedLocation) => string
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
const defaultGetKey = (location: ParsedLocation) => location.key!
|
|
25
|
+
const defaultGetKey = (location: ParsedLocation) => location.state.key!
|
|
26
26
|
|
|
27
27
|
export function watchScrollPositions(
|
|
28
28
|
router: AnyRouter,
|
package/src/utils.ts
CHANGED
|
@@ -31,21 +31,21 @@ export type UnionToIntersection<U> = (
|
|
|
31
31
|
? I
|
|
32
32
|
: never
|
|
33
33
|
|
|
34
|
-
type Compute<T> = { [K in keyof T]: T[K] } | never
|
|
35
|
-
|
|
36
|
-
type AllKeys<T> = T extends any ? keyof T : never
|
|
37
|
-
|
|
38
|
-
export type MergeUnion<T, Keys extends keyof T = keyof T> = Compute<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
>
|
|
34
|
+
// type Compute<T> = { [K in keyof T]: T[K] } | never
|
|
35
|
+
|
|
36
|
+
// type AllKeys<T> = T extends any ? keyof T : never
|
|
37
|
+
|
|
38
|
+
// export type MergeUnion<T, Keys extends keyof T = keyof T> = Compute<
|
|
39
|
+
// {
|
|
40
|
+
// [K in Keys]: T[Keys]
|
|
41
|
+
// } & {
|
|
42
|
+
// [K in AllKeys<T>]?: T extends any
|
|
43
|
+
// ? K extends keyof T
|
|
44
|
+
// ? T[K]
|
|
45
|
+
// : never
|
|
46
|
+
// : never
|
|
47
|
+
// }
|
|
48
|
+
// >
|
|
49
49
|
|
|
50
50
|
export type Values<O> = O[ValueKeys<O>]
|
|
51
51
|
export type ValueKeys<O> = Extract<keyof O, PropertyKey>
|
|
@@ -69,6 +69,10 @@ export type Updater<TPrevious, TResult = TPrevious> =
|
|
|
69
69
|
| TResult
|
|
70
70
|
| ((prev?: TPrevious) => TResult)
|
|
71
71
|
|
|
72
|
+
export type NonNullableUpdater<TPrevious, TResult = TPrevious> =
|
|
73
|
+
| TResult
|
|
74
|
+
| ((prev: TPrevious) => TResult)
|
|
75
|
+
|
|
72
76
|
export type PickExtract<T, U> = {
|
|
73
77
|
[K in keyof T as T[K] extends U ? K : never]: T[K]
|
|
74
78
|
}
|
|
@@ -86,9 +90,9 @@ function isFunction(d: any): d is Function {
|
|
|
86
90
|
}
|
|
87
91
|
|
|
88
92
|
export function functionalUpdate<TResult>(
|
|
89
|
-
updater: Updater<TResult>,
|
|
93
|
+
updater: Updater<TResult> | NonNullableUpdater<TResult>,
|
|
90
94
|
previous: TResult,
|
|
91
|
-
) {
|
|
95
|
+
): TResult {
|
|
92
96
|
if (isFunction(updater)) {
|
|
93
97
|
return updater(previous as TResult)
|
|
94
98
|
}
|