@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
package/build/cjs/utils.js
CHANGED
|
@@ -12,6 +12,21 @@
|
|
|
12
12
|
|
|
13
13
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
14
|
|
|
15
|
+
// type Compute<T> = { [K in keyof T]: T[K] } | never
|
|
16
|
+
|
|
17
|
+
// type AllKeys<T> = T extends any ? keyof T : never
|
|
18
|
+
|
|
19
|
+
// export type MergeUnion<T, Keys extends keyof T = keyof T> = Compute<
|
|
20
|
+
// {
|
|
21
|
+
// [K in Keys]: T[Keys]
|
|
22
|
+
// } & {
|
|
23
|
+
// [K in AllKeys<T>]?: T extends any
|
|
24
|
+
// ? K extends keyof T
|
|
25
|
+
// ? T[K]
|
|
26
|
+
// : never
|
|
27
|
+
// : never
|
|
28
|
+
// }
|
|
29
|
+
// >
|
|
15
30
|
function last(arr) {
|
|
16
31
|
return arr[arr.length - 1];
|
|
17
32
|
}
|
package/build/cjs/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../src/utils.ts"],"sourcesContent":["export type NoInfer<T> = [T][T extends any ? 0 : never]\nexport type IsAny<T, Y, N> = 1 extends 0 & T ? Y : N\nexport type IsAnyBoolean<T> = 1 extends 0 & T ? true : false\nexport type IsKnown<T, Y, N> = unknown extends T ? N : Y\nexport type PickAsRequired<T, K extends keyof T> = Omit<T, K> &\n Required<Pick<T, K>>\nexport type PickAsPartial<T, K extends keyof T> = Omit<T, K> &\n Partial<Pick<T, K>>\nexport type PickUnsafe<T, K> = K extends keyof T ? Pick<T, K> : never\nexport type PickExtra<T, K> = {\n [TKey in keyof K as string extends TKey\n ? never\n : TKey extends keyof T\n ? never\n : TKey]: K[TKey]\n}\n\nexport type PickRequired<T> = {\n [K in keyof T as undefined extends T[K] ? never : K]: T[K]\n}\n\nexport type Expand<T> = T extends object\n ? T extends infer O\n ? { [K in keyof O]: O[K] }\n : never\n : T\n\nexport type UnionToIntersection<U> = (\n U extends any ? (k: U) => void : never\n) extends (k: infer I) => any\n ? I\n : never\n\
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../src/utils.ts"],"sourcesContent":["export type NoInfer<T> = [T][T extends any ? 0 : never]\nexport type IsAny<T, Y, N> = 1 extends 0 & T ? Y : N\nexport type IsAnyBoolean<T> = 1 extends 0 & T ? true : false\nexport type IsKnown<T, Y, N> = unknown extends T ? N : Y\nexport type PickAsRequired<T, K extends keyof T> = Omit<T, K> &\n Required<Pick<T, K>>\nexport type PickAsPartial<T, K extends keyof T> = Omit<T, K> &\n Partial<Pick<T, K>>\nexport type PickUnsafe<T, K> = K extends keyof T ? Pick<T, K> : never\nexport type PickExtra<T, K> = {\n [TKey in keyof K as string extends TKey\n ? never\n : TKey extends keyof T\n ? never\n : TKey]: K[TKey]\n}\n\nexport type PickRequired<T> = {\n [K in keyof T as undefined extends T[K] ? never : K]: T[K]\n}\n\nexport type Expand<T> = T extends object\n ? T extends infer O\n ? { [K in keyof O]: O[K] }\n : never\n : T\n\nexport type UnionToIntersection<U> = (\n U extends any ? (k: U) => void : never\n) extends (k: infer I) => any\n ? I\n : never\n\n// type Compute<T> = { [K in keyof T]: T[K] } | never\n\n// type AllKeys<T> = T extends any ? keyof T : never\n\n// export type MergeUnion<T, Keys extends keyof T = keyof T> = Compute<\n// {\n// [K in Keys]: T[Keys]\n// } & {\n// [K in AllKeys<T>]?: T extends any\n// ? K extends keyof T\n// ? T[K]\n// : never\n// : never\n// }\n// >\n\nexport type Values<O> = O[ValueKeys<O>]\nexport type ValueKeys<O> = Extract<keyof O, PropertyKey>\n\nexport type DeepAwaited<T> = T extends Promise<infer A>\n ? DeepAwaited<A>\n : T extends Record<infer A, Promise<infer B>>\n ? { [K in A]: DeepAwaited<B> }\n : T\n\nexport type PathParamMask<TRoutePath extends string> =\n TRoutePath extends `${infer L}/$${infer C}/${infer R}`\n ? PathParamMask<`${L}/${string}/${R}`>\n : TRoutePath extends `${infer L}/$${infer C}`\n ? PathParamMask<`${L}/${string}`>\n : TRoutePath\n\nexport type Timeout = ReturnType<typeof setTimeout>\n\nexport type Updater<TPrevious, TResult = TPrevious> =\n | TResult\n | ((prev?: TPrevious) => TResult)\n\nexport type NonNullableUpdater<TPrevious, TResult = TPrevious> =\n | TResult\n | ((prev: TPrevious) => TResult)\n\nexport type PickExtract<T, U> = {\n [K in keyof T as T[K] extends U ? K : never]: T[K]\n}\n\nexport type PickExclude<T, U> = {\n [K in keyof T as T[K] extends U ? never : K]: T[K]\n}\n\nexport function last<T>(arr: T[]) {\n return arr[arr.length - 1]\n}\n\nfunction isFunction(d: any): d is Function {\n return typeof d === 'function'\n}\n\nexport function functionalUpdate<TResult>(\n updater: Updater<TResult> | NonNullableUpdater<TResult>,\n previous: TResult,\n): TResult {\n if (isFunction(updater)) {\n return updater(previous as TResult)\n }\n\n return updater\n}\n\nexport function pick<T, K extends keyof T>(parent: T, keys: K[]): Pick<T, K> {\n return keys.reduce((obj: any, key: K) => {\n obj[key] = parent[key]\n return obj\n }, {} as any)\n}\n\n/**\n * This function returns `a` if `b` is deeply equal.\n * If not, it will replace any deeply equal children of `b` with those of `a`.\n * This can be used for structural sharing between immutable JSON values for example.\n * Do not use this with signals\n */\nexport function replaceEqualDeep<T>(prev: any, _next: T): T {\n if (prev === _next) {\n return prev\n }\n\n const next = _next as any\n\n const array = Array.isArray(prev) && Array.isArray(next)\n\n if (array || (isPlainObject(prev) && isPlainObject(next))) {\n const prevSize = array ? prev.length : Object.keys(prev).length\n const nextItems = array ? next : Object.keys(next)\n const nextSize = nextItems.length\n const copy: any = array ? [] : {}\n\n let equalItems = 0\n\n for (let i = 0; i < nextSize; i++) {\n const key = array ? i : nextItems[i]\n copy[key] = replaceEqualDeep(prev[key], next[key])\n if (copy[key] === prev[key]) {\n equalItems++\n }\n }\n\n return prevSize === nextSize && equalItems === prevSize ? prev : copy\n }\n\n return next\n}\n\n// Copied from: https://github.com/jonschlinkert/is-plain-object\nexport function isPlainObject(o: any) {\n if (!hasObjectPrototype(o)) {\n return false\n }\n\n // If has modified constructor\n const ctor = o.constructor\n if (typeof ctor === 'undefined') {\n return true\n }\n\n // If has modified prototype\n const prot = ctor.prototype\n if (!hasObjectPrototype(prot)) {\n return false\n }\n\n // If constructor does not have an Object-specific method\n if (!prot.hasOwnProperty('isPrototypeOf')) {\n return false\n }\n\n // Most likely a plain Object\n return true\n}\n\nfunction hasObjectPrototype(o: any) {\n return Object.prototype.toString.call(o) === '[object Object]'\n}\n\nexport function partialDeepEqual(a: any, b: any): boolean {\n if (a === b) {\n return true\n }\n\n if (typeof a !== typeof b) {\n return false\n }\n\n if (isPlainObject(a) && isPlainObject(b)) {\n return !Object.keys(b).some((key) => !partialDeepEqual(a[key], b[key]))\n }\n\n if (Array.isArray(a) && Array.isArray(b)) {\n return (\n a.length === b.length &&\n a.every((item, index) => partialDeepEqual(item, b[index]))\n )\n }\n\n return false\n}\n"],"names":["last","arr","length","isFunction","d","functionalUpdate","updater","previous","pick","parent","keys","reduce","obj","key","replaceEqualDeep","prev","_next","next","array","Array","isArray","isPlainObject","prevSize","Object","nextItems","nextSize","copy","equalItems","i","o","hasObjectPrototype","ctor","constructor","prot","prototype","hasOwnProperty","toString","call","partialDeepEqual","a","b","some","every","item","index"],"mappings":"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"}
|
package/build/esm/index.js
CHANGED
|
@@ -76,11 +76,13 @@ function createHistory(opts) {
|
|
|
76
76
|
};
|
|
77
77
|
},
|
|
78
78
|
push: (path, state) => {
|
|
79
|
+
assignKey(state);
|
|
79
80
|
queueTask(() => {
|
|
80
81
|
opts.pushState(path, state);
|
|
81
82
|
});
|
|
82
83
|
},
|
|
83
84
|
replace: (path, state) => {
|
|
85
|
+
assignKey(state);
|
|
84
86
|
queueTask(() => {
|
|
85
87
|
opts.replaceState(path, state);
|
|
86
88
|
});
|
|
@@ -117,6 +119,16 @@ function createHistory(opts) {
|
|
|
117
119
|
}
|
|
118
120
|
};
|
|
119
121
|
}
|
|
122
|
+
function assignKey(state) {
|
|
123
|
+
state.key = createRandomKey();
|
|
124
|
+
// if (state.__actualLocation) {
|
|
125
|
+
// state.__actualLocation.state = {
|
|
126
|
+
// ...state.__actualLocation.state,
|
|
127
|
+
// key,
|
|
128
|
+
// }
|
|
129
|
+
// }
|
|
130
|
+
}
|
|
131
|
+
|
|
120
132
|
function createBrowserHistory(opts) {
|
|
121
133
|
const getHref = opts?.getHref ?? (() => `${window.location.pathname}${window.location.search}${window.location.hash}`);
|
|
122
134
|
const createHref = opts?.createHref ?? (path => path);
|
|
@@ -146,16 +158,10 @@ function createBrowserHistory(opts) {
|
|
|
146
158
|
};
|
|
147
159
|
},
|
|
148
160
|
pushState: (path, state) => {
|
|
149
|
-
window.history.pushState(
|
|
150
|
-
...state,
|
|
151
|
-
key: createRandomKey()
|
|
152
|
-
}, '', createHref(path));
|
|
161
|
+
window.history.pushState(state, '', createHref(path));
|
|
153
162
|
},
|
|
154
163
|
replaceState: (path, state) => {
|
|
155
|
-
window.history.replaceState(
|
|
156
|
-
...state,
|
|
157
|
-
key: createRandomKey()
|
|
158
|
-
}, '', createHref(path));
|
|
164
|
+
window.history.replaceState(state, '', createHref(path));
|
|
159
165
|
},
|
|
160
166
|
back: () => window.history.back(),
|
|
161
167
|
forward: () => window.history.forward(),
|
|
@@ -174,24 +180,20 @@ function createMemoryHistory(opts = {
|
|
|
174
180
|
}) {
|
|
175
181
|
const entries = opts.initialEntries;
|
|
176
182
|
let index = opts.initialIndex ?? entries.length - 1;
|
|
177
|
-
let currentState = {
|
|
183
|
+
let currentState = {
|
|
184
|
+
key: createRandomKey()
|
|
185
|
+
};
|
|
178
186
|
const getLocation = () => parseLocation(entries[index], currentState);
|
|
179
187
|
return createHistory({
|
|
180
188
|
getLocation,
|
|
181
189
|
subscriber: false,
|
|
182
190
|
pushState: (path, state) => {
|
|
183
|
-
currentState =
|
|
184
|
-
...state,
|
|
185
|
-
key: createRandomKey()
|
|
186
|
-
};
|
|
191
|
+
currentState = state;
|
|
187
192
|
entries.push(path);
|
|
188
193
|
index++;
|
|
189
194
|
},
|
|
190
195
|
replaceState: (path, state) => {
|
|
191
|
-
currentState =
|
|
192
|
-
...state,
|
|
193
|
-
key: createRandomKey()
|
|
194
|
-
};
|
|
196
|
+
currentState = state;
|
|
195
197
|
entries[index] = path;
|
|
196
198
|
},
|
|
197
199
|
back: () => {
|
|
@@ -212,7 +214,7 @@ function parseLocation(href, state) {
|
|
|
212
214
|
pathname: href.substring(0, hashIndex > 0 ? searchIndex > 0 ? Math.min(hashIndex, searchIndex) : hashIndex : searchIndex > 0 ? searchIndex : href.length),
|
|
213
215
|
hash: hashIndex > -1 ? href.substring(hashIndex) : '',
|
|
214
216
|
search: searchIndex > -1 ? href.slice(searchIndex, hashIndex === -1 ? undefined : hashIndex) : '',
|
|
215
|
-
state
|
|
217
|
+
state: state || {}
|
|
216
218
|
};
|
|
217
219
|
}
|
|
218
220
|
|
|
@@ -221,6 +223,21 @@ function createRandomKey() {
|
|
|
221
223
|
return (Math.random() + 1).toString(36).substring(7);
|
|
222
224
|
}
|
|
223
225
|
|
|
226
|
+
// type Compute<T> = { [K in keyof T]: T[K] } | never
|
|
227
|
+
|
|
228
|
+
// type AllKeys<T> = T extends any ? keyof T : never
|
|
229
|
+
|
|
230
|
+
// export type MergeUnion<T, Keys extends keyof T = keyof T> = Compute<
|
|
231
|
+
// {
|
|
232
|
+
// [K in Keys]: T[Keys]
|
|
233
|
+
// } & {
|
|
234
|
+
// [K in AllKeys<T>]?: T extends any
|
|
235
|
+
// ? K extends keyof T
|
|
236
|
+
// ? T[K]
|
|
237
|
+
// : never
|
|
238
|
+
// : never
|
|
239
|
+
// }
|
|
240
|
+
// >
|
|
224
241
|
function last(arr) {
|
|
225
242
|
return arr[arr.length - 1];
|
|
226
243
|
}
|
|
@@ -630,6 +647,9 @@ class RootRoute extends Route {
|
|
|
630
647
|
super(options);
|
|
631
648
|
}
|
|
632
649
|
}
|
|
650
|
+
function createRouteMask(opts) {
|
|
651
|
+
return opts;
|
|
652
|
+
}
|
|
633
653
|
|
|
634
654
|
class FileRoute {
|
|
635
655
|
constructor(path) {
|
|
@@ -713,6 +733,9 @@ const preloadWarning = 'Error preloading route! ☝️';
|
|
|
713
733
|
class Router {
|
|
714
734
|
#unsubHistory;
|
|
715
735
|
resetNextScroll = false;
|
|
736
|
+
tempLocationKey = `${Math.round(Math.random() * 10000000)}`;
|
|
737
|
+
// nextTemporaryLocation?: ParsedLocation<FullSearchSchema<TRouteTree>>
|
|
738
|
+
|
|
716
739
|
constructor(options) {
|
|
717
740
|
this.options = {
|
|
718
741
|
defaultPreloadDelay: 50,
|
|
@@ -761,15 +784,15 @@ class Router {
|
|
|
761
784
|
});
|
|
762
785
|
this.state = this.__store.state;
|
|
763
786
|
this.update(options);
|
|
764
|
-
const
|
|
765
|
-
hash: true,
|
|
766
|
-
fromCurrent: true,
|
|
787
|
+
const nextLocation = this.buildLocation({
|
|
767
788
|
search: true,
|
|
789
|
+
params: true,
|
|
790
|
+
hash: true,
|
|
768
791
|
state: true
|
|
769
792
|
});
|
|
770
|
-
if (this.state.location.href !==
|
|
793
|
+
if (this.state.location.href !== nextLocation.href) {
|
|
771
794
|
this.#commitLocation({
|
|
772
|
-
...
|
|
795
|
+
...nextLocation,
|
|
773
796
|
replace: true
|
|
774
797
|
});
|
|
775
798
|
}
|
|
@@ -812,8 +835,10 @@ class Router {
|
|
|
812
835
|
};
|
|
813
836
|
};
|
|
814
837
|
#onFocus = () => {
|
|
815
|
-
if (this.options.
|
|
816
|
-
this.invalidate(
|
|
838
|
+
if (this.options.reloadOnWindowFocus ?? true) {
|
|
839
|
+
this.invalidate({
|
|
840
|
+
__fromFocus: true
|
|
841
|
+
});
|
|
817
842
|
}
|
|
818
843
|
};
|
|
819
844
|
update = opts => {
|
|
@@ -852,14 +877,6 @@ class Router {
|
|
|
852
877
|
}
|
|
853
878
|
return this;
|
|
854
879
|
};
|
|
855
|
-
buildNext = opts => {
|
|
856
|
-
const next = this.#buildLocation(opts);
|
|
857
|
-
const __matches = this.matchRoutes(next.pathname, next.search);
|
|
858
|
-
return this.#buildLocation({
|
|
859
|
-
...opts,
|
|
860
|
-
__matches
|
|
861
|
-
});
|
|
862
|
-
};
|
|
863
880
|
cancelMatches = () => {
|
|
864
881
|
this.state.matches.forEach(match => {
|
|
865
882
|
this.cancelMatch(match.id);
|
|
@@ -918,7 +935,7 @@ class Router {
|
|
|
918
935
|
try {
|
|
919
936
|
// Load the matches
|
|
920
937
|
try {
|
|
921
|
-
await this.loadMatches(pendingMatches);
|
|
938
|
+
await this.loadMatches(pendingMatches.map(d => d.id));
|
|
922
939
|
} catch (err) {
|
|
923
940
|
// swallow this error, since we'll display the
|
|
924
941
|
// errors on the route components
|
|
@@ -967,10 +984,19 @@ class Router {
|
|
|
967
984
|
return this.latestLoadPromise;
|
|
968
985
|
};
|
|
969
986
|
#mergeMatches = (prevMatchesById, nextMatches) => {
|
|
970
|
-
|
|
971
|
-
...prevMatchesById
|
|
972
|
-
...Object.fromEntries(nextMatches.map(match => [match.id, match]))
|
|
987
|
+
let matchesById = {
|
|
988
|
+
...prevMatchesById
|
|
973
989
|
};
|
|
990
|
+
nextMatches.forEach(match => {
|
|
991
|
+
if (!matchesById[match.id]) {
|
|
992
|
+
matchesById[match.id] = match;
|
|
993
|
+
}
|
|
994
|
+
matchesById[match.id] = {
|
|
995
|
+
...matchesById[match.id],
|
|
996
|
+
...match
|
|
997
|
+
};
|
|
998
|
+
});
|
|
999
|
+
return matchesById;
|
|
974
1000
|
};
|
|
975
1001
|
getRoute = id => {
|
|
976
1002
|
const route = this.routesById[id];
|
|
@@ -978,7 +1004,7 @@ class Router {
|
|
|
978
1004
|
return route;
|
|
979
1005
|
};
|
|
980
1006
|
preloadRoute = async (navigateOpts = this.state.location) => {
|
|
981
|
-
|
|
1007
|
+
let next = this.buildLocation(navigateOpts);
|
|
982
1008
|
const matches = this.matchRoutes(next.pathname, next.search, {
|
|
983
1009
|
throwOnError: true
|
|
984
1010
|
});
|
|
@@ -988,11 +1014,11 @@ class Router {
|
|
|
988
1014
|
matchesById: this.#mergeMatches(s.matchesById, matches)
|
|
989
1015
|
};
|
|
990
1016
|
});
|
|
991
|
-
await this.loadMatches(matches, {
|
|
1017
|
+
await this.loadMatches(matches.map(d => d.id), {
|
|
992
1018
|
preload: true,
|
|
993
1019
|
maxAge: navigateOpts.maxAge
|
|
994
1020
|
});
|
|
995
|
-
return matches;
|
|
1021
|
+
return [last(matches), matches];
|
|
996
1022
|
};
|
|
997
1023
|
cleanMatches = () => {
|
|
998
1024
|
const now = Date.now();
|
|
@@ -1146,8 +1172,8 @@ class Router {
|
|
|
1146
1172
|
});
|
|
1147
1173
|
return matches;
|
|
1148
1174
|
};
|
|
1149
|
-
loadMatches = async (
|
|
1150
|
-
const getFreshMatches = () =>
|
|
1175
|
+
loadMatches = async (matchIds, opts) => {
|
|
1176
|
+
const getFreshMatches = () => matchIds.map(d => this.getRouteMatch(d));
|
|
1151
1177
|
if (!opts?.preload) {
|
|
1152
1178
|
getFreshMatches().forEach(match => {
|
|
1153
1179
|
// Update each match with its latest route data
|
|
@@ -1227,8 +1253,9 @@ class Router {
|
|
|
1227
1253
|
}
|
|
1228
1254
|
}
|
|
1229
1255
|
} catch (err) {
|
|
1230
|
-
if (
|
|
1231
|
-
this.navigate(err);
|
|
1256
|
+
if (isRedirect(err)) {
|
|
1257
|
+
if (!opts?.preload) this.navigate(err);
|
|
1258
|
+
return;
|
|
1232
1259
|
}
|
|
1233
1260
|
throw err;
|
|
1234
1261
|
}
|
|
@@ -1337,13 +1364,13 @@ class Router {
|
|
|
1337
1364
|
isExternal = true;
|
|
1338
1365
|
} catch (e) {}
|
|
1339
1366
|
invariant(!isExternal, 'Attempting to navigate to external url with this.navigate!');
|
|
1340
|
-
return this.#
|
|
1367
|
+
return this.#buildAndCommitLocation({
|
|
1341
1368
|
from: fromString,
|
|
1342
1369
|
to: toString,
|
|
1343
1370
|
search,
|
|
1344
1371
|
hash,
|
|
1345
|
-
replace,
|
|
1346
1372
|
params,
|
|
1373
|
+
replace,
|
|
1347
1374
|
resetScroll
|
|
1348
1375
|
});
|
|
1349
1376
|
};
|
|
@@ -1352,7 +1379,7 @@ class Router {
|
|
|
1352
1379
|
...location,
|
|
1353
1380
|
to: location.to ? this.resolvePath(location.from ?? '', location.to) : undefined
|
|
1354
1381
|
};
|
|
1355
|
-
const next = this.
|
|
1382
|
+
const next = this.buildLocation(location);
|
|
1356
1383
|
if (opts?.pending && this.state.status !== 'pending') {
|
|
1357
1384
|
return false;
|
|
1358
1385
|
}
|
|
@@ -1385,6 +1412,7 @@ class Router {
|
|
|
1385
1412
|
preloadDelay: userPreloadDelay,
|
|
1386
1413
|
disabled,
|
|
1387
1414
|
state,
|
|
1415
|
+
mask,
|
|
1388
1416
|
resetScroll
|
|
1389
1417
|
}) => {
|
|
1390
1418
|
// If this link simply reloads the current route,
|
|
@@ -1408,9 +1436,10 @@ class Router {
|
|
|
1408
1436
|
hash,
|
|
1409
1437
|
replace,
|
|
1410
1438
|
state,
|
|
1439
|
+
mask,
|
|
1411
1440
|
resetScroll
|
|
1412
1441
|
};
|
|
1413
|
-
const next = this.
|
|
1442
|
+
const next = this.buildLocation(nextOpts);
|
|
1414
1443
|
preload = preload ?? this.options.defaultPreload;
|
|
1415
1444
|
const preloadDelay = userPreloadDelay ?? this.options.defaultPreloadDelay ?? 0;
|
|
1416
1445
|
|
|
@@ -1432,7 +1461,11 @@ class Router {
|
|
|
1432
1461
|
e.preventDefault();
|
|
1433
1462
|
|
|
1434
1463
|
// All is well? Navigate!
|
|
1435
|
-
this.#commitLocation(
|
|
1464
|
+
this.#commitLocation({
|
|
1465
|
+
...next,
|
|
1466
|
+
replace,
|
|
1467
|
+
resetScroll
|
|
1468
|
+
});
|
|
1436
1469
|
}
|
|
1437
1470
|
};
|
|
1438
1471
|
|
|
@@ -1645,84 +1678,180 @@ class Router {
|
|
|
1645
1678
|
});
|
|
1646
1679
|
};
|
|
1647
1680
|
#parseLocation = previousLocation => {
|
|
1648
|
-
|
|
1681
|
+
const parse = ({
|
|
1649
1682
|
pathname,
|
|
1650
1683
|
search,
|
|
1651
1684
|
hash,
|
|
1652
1685
|
state
|
|
1653
|
-
}
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1686
|
+
}) => {
|
|
1687
|
+
const parsedSearch = this.options.parseSearch(search);
|
|
1688
|
+
return {
|
|
1689
|
+
pathname: pathname,
|
|
1690
|
+
searchStr: search,
|
|
1691
|
+
search: replaceEqualDeep(previousLocation?.search, parsedSearch),
|
|
1692
|
+
hash: hash.split('#').reverse()[0] ?? '',
|
|
1693
|
+
href: `${pathname}${search}${hash}`,
|
|
1694
|
+
state: replaceEqualDeep(previousLocation?.state, state)
|
|
1695
|
+
};
|
|
1663
1696
|
};
|
|
1697
|
+
const location = parse(this.history.location);
|
|
1698
|
+
let {
|
|
1699
|
+
__tempLocation,
|
|
1700
|
+
__tempKey
|
|
1701
|
+
} = location.state;
|
|
1702
|
+
if (__tempLocation && (!__tempKey || __tempKey === this.tempLocationKey)) {
|
|
1703
|
+
// Sync up the location keys
|
|
1704
|
+
const parsedTempLocation = parse(__tempLocation);
|
|
1705
|
+
parsedTempLocation.state.key = location.state.key;
|
|
1706
|
+
delete parsedTempLocation.state.__tempLocation;
|
|
1707
|
+
return {
|
|
1708
|
+
...parsedTempLocation,
|
|
1709
|
+
maskedLocation: location
|
|
1710
|
+
};
|
|
1711
|
+
}
|
|
1712
|
+
return location;
|
|
1664
1713
|
};
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1714
|
+
buildLocation = (opts = {}) => {
|
|
1715
|
+
const build = (dest = {}, matches) => {
|
|
1716
|
+
const from = this.state.location;
|
|
1717
|
+
const fromPathname = dest.from ?? from.pathname;
|
|
1718
|
+
let pathname = resolvePath(this.basepath ?? '/', fromPathname, `${dest.to ?? ''}`);
|
|
1719
|
+
const fromMatches = this.matchRoutes(fromPathname, from.search);
|
|
1720
|
+
const prevParams = {
|
|
1721
|
+
...last(fromMatches)?.params
|
|
1722
|
+
};
|
|
1723
|
+
let nextParams = (dest.params ?? true) === true ? prevParams : functionalUpdate(dest.params, prevParams);
|
|
1724
|
+
if (nextParams) {
|
|
1725
|
+
matches?.map(d => this.getRoute(d.routeId).options.stringifyParams).filter(Boolean).forEach(fn => {
|
|
1726
|
+
nextParams = {
|
|
1727
|
+
...nextParams,
|
|
1728
|
+
...fn(nextParams)
|
|
1729
|
+
};
|
|
1730
|
+
});
|
|
1731
|
+
}
|
|
1732
|
+
pathname = interpolatePath(pathname, nextParams ?? {});
|
|
1733
|
+
const preSearchFilters = matches?.map(match => this.getRoute(match.routeId).options.preSearchFilters ?? []).flat().filter(Boolean) ?? [];
|
|
1734
|
+
const postSearchFilters = matches?.map(match => this.getRoute(match.routeId).options.postSearchFilters ?? []).flat().filter(Boolean) ?? [];
|
|
1735
|
+
|
|
1736
|
+
// Pre filters first
|
|
1737
|
+
const preFilteredSearch = preSearchFilters?.length ? preSearchFilters?.reduce((prev, next) => next(prev), from.search) : from.search;
|
|
1738
|
+
|
|
1739
|
+
// Then the link/navigate function
|
|
1740
|
+
const destSearch = dest.search === true ? preFilteredSearch // Preserve resolvedFrom true
|
|
1741
|
+
: dest.search ? functionalUpdate(dest.search, preFilteredSearch) ?? {} // Updater
|
|
1742
|
+
: preSearchFilters?.length ? preFilteredSearch // Preserve resolvedFrom filters
|
|
1743
|
+
: {};
|
|
1744
|
+
|
|
1745
|
+
// Then post filters
|
|
1746
|
+
const postFilteredSearch = postSearchFilters?.length ? postSearchFilters.reduce((prev, next) => next(prev), destSearch) : destSearch;
|
|
1747
|
+
const search = replaceEqualDeep(from.search, postFilteredSearch);
|
|
1748
|
+
const searchStr = this.options.stringifySearch(search);
|
|
1749
|
+
const hash = dest.hash === true ? from.hash : dest.hash ? functionalUpdate(dest.hash, from.hash) : from.hash;
|
|
1750
|
+
const hashStr = hash ? `#${hash}` : '';
|
|
1751
|
+
let nextState = dest.state === true ? from.state : dest.state ? functionalUpdate(dest.state, from.state) : from.state;
|
|
1752
|
+
nextState = replaceEqualDeep(from.state, nextState);
|
|
1753
|
+
return {
|
|
1754
|
+
pathname,
|
|
1755
|
+
search,
|
|
1756
|
+
searchStr,
|
|
1757
|
+
state: nextState,
|
|
1758
|
+
hash,
|
|
1759
|
+
href: this.history.createHref(`${pathname}${searchStr}${hashStr}`),
|
|
1760
|
+
unmaskOnReload: dest.unmaskOnReload
|
|
1761
|
+
};
|
|
1672
1762
|
};
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1763
|
+
const buildWithMatches = (dest = {}, maskedDest) => {
|
|
1764
|
+
let next = build(dest);
|
|
1765
|
+
let maskedNext = maskedDest ? build(maskedDest) : undefined;
|
|
1766
|
+
if (!maskedNext) {
|
|
1767
|
+
let params = {};
|
|
1768
|
+
let foundMask = this.options.routeMasks?.find(d => {
|
|
1769
|
+
const match = matchPathname(this.basepath, next.pathname, {
|
|
1770
|
+
to: d.from,
|
|
1771
|
+
fuzzy: false
|
|
1772
|
+
});
|
|
1773
|
+
if (match) {
|
|
1774
|
+
params = match;
|
|
1775
|
+
return true;
|
|
1776
|
+
}
|
|
1777
|
+
return false;
|
|
1778
|
+
});
|
|
1779
|
+
if (foundMask) {
|
|
1780
|
+
foundMask = {
|
|
1781
|
+
...foundMask,
|
|
1782
|
+
from: interpolatePath(foundMask.from, params)
|
|
1783
|
+
};
|
|
1784
|
+
maskedDest = foundMask;
|
|
1785
|
+
maskedNext = build(maskedDest);
|
|
1786
|
+
}
|
|
1787
|
+
}
|
|
1788
|
+
const nextMatches = this.matchRoutes(next.pathname, next.search);
|
|
1789
|
+
const maskedMatches = maskedNext ? this.matchRoutes(maskedNext.pathname, maskedNext.search) : undefined;
|
|
1790
|
+
const maskedFinal = maskedNext ? build(maskedDest, maskedMatches) : undefined;
|
|
1791
|
+
const final = build(dest, nextMatches);
|
|
1792
|
+
if (maskedFinal) {
|
|
1793
|
+
final.maskedLocation = maskedFinal;
|
|
1794
|
+
}
|
|
1795
|
+
return final;
|
|
1796
|
+
};
|
|
1797
|
+
if (opts.mask) {
|
|
1798
|
+
return buildWithMatches(opts, {
|
|
1799
|
+
...pick(opts, ['from']),
|
|
1800
|
+
...opts.mask
|
|
1680
1801
|
});
|
|
1681
1802
|
}
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
// Then post filters
|
|
1696
|
-
const postFilteredSearch = postSearchFilters?.length ? postSearchFilters.reduce((prev, next) => next(prev), destSearch) : destSearch;
|
|
1697
|
-
const search = replaceEqualDeep(this.state.location.search, postFilteredSearch);
|
|
1698
|
-
const searchStr = this.options.stringifySearch(search);
|
|
1699
|
-
const hash = dest.hash === true ? this.state.location.hash : functionalUpdate(dest.hash, this.state.location.hash);
|
|
1700
|
-
const hashStr = hash ? `#${hash}` : '';
|
|
1701
|
-
const nextState = dest.state === true ? this.state.location.state : functionalUpdate(dest.state, this.state.location.state);
|
|
1702
|
-
return {
|
|
1703
|
-
pathname,
|
|
1704
|
-
search,
|
|
1705
|
-
searchStr,
|
|
1706
|
-
state: nextState,
|
|
1707
|
-
hash,
|
|
1708
|
-
href: this.history.createHref(`${pathname}${searchStr}${hashStr}`),
|
|
1709
|
-
key: dest.key
|
|
1710
|
-
};
|
|
1803
|
+
return buildWithMatches(opts);
|
|
1804
|
+
};
|
|
1805
|
+
#buildAndCommitLocation = ({
|
|
1806
|
+
replace,
|
|
1807
|
+
resetScroll,
|
|
1808
|
+
...rest
|
|
1809
|
+
} = {}) => {
|
|
1810
|
+
const location = this.buildLocation(rest);
|
|
1811
|
+
return this.#commitLocation({
|
|
1812
|
+
...location,
|
|
1813
|
+
replace,
|
|
1814
|
+
resetScroll
|
|
1815
|
+
});
|
|
1711
1816
|
};
|
|
1712
|
-
#commitLocation = async
|
|
1713
|
-
const next = this.buildNext(location);
|
|
1817
|
+
#commitLocation = async next => {
|
|
1714
1818
|
if (this.navigateTimeout) clearTimeout(this.navigateTimeout);
|
|
1715
1819
|
let nextAction = 'replace';
|
|
1716
|
-
if (!
|
|
1820
|
+
if (!next.replace) {
|
|
1717
1821
|
nextAction = 'push';
|
|
1718
1822
|
}
|
|
1719
1823
|
const isSameUrl = this.state.location.href === next.href;
|
|
1720
|
-
if (isSameUrl
|
|
1824
|
+
if (isSameUrl) {
|
|
1721
1825
|
nextAction = 'replace';
|
|
1722
1826
|
}
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1827
|
+
let {
|
|
1828
|
+
maskedLocation,
|
|
1829
|
+
...nextHistory
|
|
1830
|
+
} = next;
|
|
1831
|
+
if (maskedLocation) {
|
|
1832
|
+
nextHistory = {
|
|
1833
|
+
...maskedLocation,
|
|
1834
|
+
state: {
|
|
1835
|
+
...maskedLocation.state,
|
|
1836
|
+
__tempKey: undefined,
|
|
1837
|
+
__tempLocation: {
|
|
1838
|
+
...nextHistory,
|
|
1839
|
+
search: nextHistory.searchStr,
|
|
1840
|
+
state: {
|
|
1841
|
+
...nextHistory.state,
|
|
1842
|
+
__tempKey: undefined,
|
|
1843
|
+
__tempLocation: undefined,
|
|
1844
|
+
key: undefined
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
};
|
|
1849
|
+
if (nextHistory.unmaskOnReload ?? this.options.unmaskOnReload ?? false) {
|
|
1850
|
+
nextHistory.state.__tempKey = this.tempLocationKey;
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
this.history[nextAction === 'push' ? 'push' : 'replace'](nextHistory.href, nextHistory.state);
|
|
1854
|
+
this.resetNextScroll = next.resetScroll ?? true;
|
|
1726
1855
|
return this.latestLoadPromise;
|
|
1727
1856
|
};
|
|
1728
1857
|
getRouteMatch = id => {
|
|
@@ -1771,25 +1900,26 @@ class Router {
|
|
|
1771
1900
|
if (childMatch) {
|
|
1772
1901
|
return this.invalidate({
|
|
1773
1902
|
matchId: childMatch.id,
|
|
1774
|
-
reload: false
|
|
1903
|
+
reload: false,
|
|
1904
|
+
__fromFocus: opts.__fromFocus
|
|
1775
1905
|
});
|
|
1776
1906
|
}
|
|
1777
1907
|
} else {
|
|
1778
1908
|
this.__store.batch(() => {
|
|
1779
1909
|
Object.values(this.state.matchesById).forEach(match => {
|
|
1780
|
-
this.
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1910
|
+
const route = this.getRoute(match.routeId);
|
|
1911
|
+
const shouldInvalidate = opts?.__fromFocus ? route.options.reloadOnWindowFocus ?? true : true;
|
|
1912
|
+
if (shouldInvalidate) {
|
|
1913
|
+
this.setRouteMatch(match.id, s => ({
|
|
1914
|
+
...s,
|
|
1915
|
+
invalid: true
|
|
1916
|
+
}));
|
|
1917
|
+
}
|
|
1784
1918
|
});
|
|
1785
1919
|
});
|
|
1786
1920
|
}
|
|
1787
1921
|
if (opts?.reload ?? true) {
|
|
1788
|
-
return this.
|
|
1789
|
-
fromCurrent: true,
|
|
1790
|
-
replace: true,
|
|
1791
|
-
search: true
|
|
1792
|
-
});
|
|
1922
|
+
return this.load();
|
|
1793
1923
|
}
|
|
1794
1924
|
};
|
|
1795
1925
|
}
|
|
@@ -1856,7 +1986,7 @@ let weakScrolledElementsByRestoreKey = {};
|
|
|
1856
1986
|
let cache;
|
|
1857
1987
|
let pathDidChange = false;
|
|
1858
1988
|
const sessionsStorage = typeof window !== 'undefined' && window.sessionStorage;
|
|
1859
|
-
const defaultGetKey = location => location.key;
|
|
1989
|
+
const defaultGetKey = location => location.state.key;
|
|
1860
1990
|
function watchScrollPositions(router, opts) {
|
|
1861
1991
|
const getKey = opts?.getKey || defaultGetKey;
|
|
1862
1992
|
if (sessionsStorage) {
|
|
@@ -1994,5 +2124,5 @@ function isDehydratedDeferred(obj) {
|
|
|
1994
2124
|
return typeof obj === 'object' && obj !== null && !(obj instanceof Promise) && !obj.then && '__deferredState' in obj;
|
|
1995
2125
|
}
|
|
1996
2126
|
|
|
1997
|
-
export { FileRoute, PathParamError, RootRoute, Route, Router, RouterContext, SearchParamError, cleanPath, componentTypes, createBrowserHistory, createHashHistory, createMemoryHistory, decode, defaultParseSearch, defaultStringifySearch, defer, encode, functionalUpdate, interpolatePath, isDehydratedDeferred, isMatchInvalid, isPlainObject, isRedirect, joinPaths, last, lazyFn, matchByPath, matchPathname, parsePathname, parseSearchWith, partialDeepEqual, pick, redirect, replaceEqualDeep, resolvePath, restoreScrollPositions, rootRouteId, stringifySearchWith, trimPath, trimPathLeft, trimPathRight, watchScrollPositions };
|
|
2127
|
+
export { FileRoute, PathParamError, RootRoute, Route, Router, RouterContext, SearchParamError, cleanPath, componentTypes, createBrowserHistory, createHashHistory, createMemoryHistory, createRouteMask, decode, defaultParseSearch, defaultStringifySearch, defer, encode, functionalUpdate, interpolatePath, isDehydratedDeferred, isMatchInvalid, isPlainObject, isRedirect, joinPaths, last, lazyFn, matchByPath, matchPathname, parsePathname, parseSearchWith, partialDeepEqual, pick, redirect, replaceEqualDeep, resolvePath, restoreScrollPositions, rootRouteId, stringifySearchWith, trimPath, trimPathLeft, trimPathRight, watchScrollPositions };
|
|
1998
2128
|
//# sourceMappingURL=index.js.map
|