@vielzeug/wayfinder 2.0.0 → 2.2.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/README.md +2 -2
- package/dist/_dev.cjs.map +1 -1
- package/dist/_dev.js.map +1 -1
- package/dist/compile.cjs +1 -1
- package/dist/compile.cjs.map +1 -1
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +1 -1
- package/dist/compile.js.map +1 -1
- package/dist/context.cjs +1 -1
- package/dist/context.cjs.map +1 -1
- package/dist/context.d.ts +4 -4
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +2 -2
- package/dist/context.js.map +1 -1
- package/dist/errors.cjs +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +0 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +1 -4
- package/dist/errors.js.map +1 -1
- package/dist/guards.cjs.map +1 -1
- package/dist/guards.d.ts +1 -1
- package/dist/guards.js.map +1 -1
- package/dist/history.cjs +1 -1
- package/dist/history.cjs.map +1 -1
- package/dist/history.d.ts.map +1 -1
- package/dist/history.js +3 -1
- package/dist/history.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/path.cjs +1 -1
- package/dist/path.cjs.map +1 -1
- package/dist/path.d.ts.map +1 -1
- package/dist/path.js +6 -2
- package/dist/path.js.map +1 -1
- package/dist/router.cjs +1 -1
- package/dist/router.cjs.map +1 -1
- package/dist/router.d.ts +3 -4
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +100 -96
- package/dist/router.js.map +1 -1
- package/dist/types.d.ts +13 -14
- package/dist/types.d.ts.map +1 -1
- package/dist/wayfinder.cjs +1 -1
- package/dist/wayfinder.cjs.map +1 -1
- package/dist/wayfinder.iife.js +1 -1
- package/dist/wayfinder.iife.js.map +1 -1
- package/dist/wayfinder.js +1 -1
- package/dist/wayfinder.js.map +1 -1
- package/package.json +22 -28
- package/dist/devtools.cjs +0 -2
- package/dist/devtools.cjs.map +0 -1
- package/dist/devtools.d.ts +0 -47
- package/dist/devtools.d.ts.map +0 -1
- package/dist/devtools.js +0 -13
- package/dist/devtools.js.map +0 -1
package/dist/router.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { WayfinderDisposedError as e, WayfinderRedirectLoopError as t, WayfinderRouteError as n } from "./errors.js";
|
|
2
|
+
import { createBrowserHistory as r } from "./history.js";
|
|
3
|
+
import { createNavigationCoordinator as i } from "./_navigation.js";
|
|
4
|
+
import { buildPreloadKey as a, buildUrl as o, joinPaths as s, matchRouteFor as c, matchesPrefix as l, normalizePath as u, parseQuery as d, readLocation as f, stripBase as p } from "./path.js";
|
|
5
|
+
import { compileRoutes as m } from "./compile.js";
|
|
6
|
+
import { buildMatchBranch as h, createRouteContext as g, createRouteState as _, executeMiddlewarePipeline as v, reportError as y } from "./context.js";
|
|
7
|
+
import { runLeaveBlockers as b } from "./guards.js";
|
|
8
8
|
import { createHydrationManager as x } from "./hydration.js";
|
|
9
9
|
import { createPreloadManager as S } from "./preload.js";
|
|
10
10
|
//#region src/router.ts
|
|
11
11
|
function C(e, t) {
|
|
12
|
-
let
|
|
13
|
-
if (
|
|
12
|
+
let r = t.get(e);
|
|
13
|
+
if (r) return r;
|
|
14
14
|
let i = [...t.keys()].join(", ");
|
|
15
|
-
throw new
|
|
15
|
+
throw new n(i ? `Unknown route name: ${e}. Available routes: ${i}` : `Unknown route name: ${e}`);
|
|
16
16
|
}
|
|
17
17
|
function w(e, t, n = "/") {
|
|
18
18
|
if ("path" in e) return e.path;
|
|
19
|
-
let r = C(e.name, t), i =
|
|
19
|
+
let r = C(e.name, t), i = o(n, r.path, e.params, e.query);
|
|
20
20
|
return e.hash ? `${i}#${e.hash}` : i;
|
|
21
21
|
}
|
|
22
22
|
var T = Symbol("wayfinder.errorContext");
|
|
@@ -40,7 +40,7 @@ var k = class {
|
|
|
40
40
|
#s;
|
|
41
41
|
#c;
|
|
42
42
|
#l = /* @__PURE__ */ new Set();
|
|
43
|
-
#u =
|
|
43
|
+
#u = i();
|
|
44
44
|
#d;
|
|
45
45
|
#f = !1;
|
|
46
46
|
#p = new AbortController();
|
|
@@ -52,8 +52,8 @@ var k = class {
|
|
|
52
52
|
#y;
|
|
53
53
|
ready;
|
|
54
54
|
constructor(e) {
|
|
55
|
-
let t =
|
|
56
|
-
if (this.#e =
|
|
55
|
+
let t = m(e);
|
|
56
|
+
if (this.#e = u(e.base ?? "/"), this.#t = e.middleware ?? [], this.#n = e.coerceSearch, this.#r = e.history ?? r(), this.#s = e.viewTransition ?? !1, this.#o = e.scroll, this.#c = e.onError, this.#i = t.records, this.#a = t.routesByName, this.#_ = x(), this.#v = S(), this.#d = _({
|
|
57
57
|
location: {
|
|
58
58
|
hash: "",
|
|
59
59
|
historyState: null,
|
|
@@ -82,14 +82,14 @@ var k = class {
|
|
|
82
82
|
};
|
|
83
83
|
} else this.#g = null;
|
|
84
84
|
this.#y = this.#x();
|
|
85
|
-
let { hash: n, pathname:
|
|
86
|
-
this.#m = `${
|
|
87
|
-
let
|
|
88
|
-
this.ready = this.#F(
|
|
89
|
-
if (!
|
|
85
|
+
let { hash: n, pathname: i, search: a } = this.#r.location;
|
|
86
|
+
this.#m = `${i}${a}${n}`;
|
|
87
|
+
let o = this.#u.begin();
|
|
88
|
+
this.ready = this.#F(o, f(this.#e, this.#r), (e, t) => {
|
|
89
|
+
if (!o.isCurrent()) return;
|
|
90
90
|
let n = this.#z(e);
|
|
91
91
|
t && this.#r.replace(n, e.historyState), this.#m = n;
|
|
92
|
-
}).then(() => void 0), this.#w(this.ready, { source: "initial-navigation" }), this.beforeLeave = this.beforeLeave.bind(this), this.dispose = this.dispose.bind(this), this.getSnapshot = this.getSnapshot.bind(this), this.isActive = this.isActive.bind(this), this.
|
|
92
|
+
}, void 0, 0, !1).then(() => void 0), this.#w(this.ready, { source: "initial-navigation" }), this.beforeLeave = this.beforeLeave.bind(this), this.dispose = this.dispose.bind(this), this.getSnapshot = this.getSnapshot.bind(this), this.isActive = this.isActive.bind(this), this.load = this.load.bind(this), this.match = this.match.bind(this), this.navigate = this.navigate.bind(this), this.preload = this.preload.bind(this), this.subscribe = this.subscribe.bind(this), this.url = this.url.bind(this), this.waitFor = this.waitFor.bind(this);
|
|
93
93
|
}
|
|
94
94
|
getSnapshot() {
|
|
95
95
|
return this.#d;
|
|
@@ -105,34 +105,34 @@ var k = class {
|
|
|
105
105
|
}
|
|
106
106
|
url(e, t, n) {
|
|
107
107
|
let r = C(e, this.#a);
|
|
108
|
-
return
|
|
108
|
+
return o(this.#e, r.path, t, n);
|
|
109
109
|
}
|
|
110
110
|
isActive(e, t = {}) {
|
|
111
111
|
let n = C(e, this.#a), r = this.#d.location.pathname;
|
|
112
|
-
return t.exact ?? !1 ?
|
|
112
|
+
return t.exact ?? !1 ? c(r, [n]).record != null : l(r, n);
|
|
113
113
|
}
|
|
114
|
-
|
|
115
|
-
let t =
|
|
114
|
+
match(e) {
|
|
115
|
+
let t = p(u(e), this.#e), { params: n, record: r } = c(t, this.#i);
|
|
116
116
|
if (!r || r.redirect) return null;
|
|
117
|
-
let i = this.#_.effectiveDefs(r), a =
|
|
117
|
+
let i = this.#_.effectiveDefs(r), a = h(i, n, t, i.map(() => void 0));
|
|
118
118
|
return a.length ? a : null;
|
|
119
119
|
}
|
|
120
|
-
async
|
|
120
|
+
async load(e, t) {
|
|
121
121
|
let n = await this.#k(e);
|
|
122
122
|
if (n.type !== "matched") return null;
|
|
123
123
|
let { location: r, params: i, record: a, resolvedQuery: o } = n, s = this.#_.effectiveDefs(a), c = s.some((e) => e.dataFn != null), l = s.map(() => void 0), u, d = "idle";
|
|
124
124
|
if (c) {
|
|
125
|
-
let e = t?.signal ?? new AbortController().signal, n =
|
|
125
|
+
let e = t?.signal ?? new AbortController().signal, n = h(s, i, r.pathname, l), a = g(r, o, i, n, () => Promise.resolve());
|
|
126
126
|
try {
|
|
127
127
|
l = await this.#D(s, a, e);
|
|
128
128
|
} catch (e) {
|
|
129
129
|
u = e, d = "error";
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
return
|
|
132
|
+
return _({
|
|
133
133
|
error: u,
|
|
134
134
|
location: r,
|
|
135
|
-
matches:
|
|
135
|
+
matches: h(s, i, r.pathname, l),
|
|
136
136
|
status: d
|
|
137
137
|
});
|
|
138
138
|
}
|
|
@@ -157,12 +157,12 @@ var k = class {
|
|
|
157
157
|
}
|
|
158
158
|
async preload(e, t, n) {
|
|
159
159
|
this.#b();
|
|
160
|
-
let r = C(e, this.#a),
|
|
160
|
+
let r = C(e, this.#a), i = a(this.#e, r.path, t, n), o = this.#v.getInflight(i);
|
|
161
161
|
if (o) return o;
|
|
162
|
-
let s = this.#A(
|
|
163
|
-
this.#v.untrack(
|
|
162
|
+
let s = this.#A(i, this.#p.signal, n).finally(() => {
|
|
163
|
+
this.#v.untrack(i);
|
|
164
164
|
});
|
|
165
|
-
this.#v.track(
|
|
165
|
+
this.#v.track(i, s);
|
|
166
166
|
try {
|
|
167
167
|
return await s;
|
|
168
168
|
} catch (e) {
|
|
@@ -186,13 +186,13 @@ var k = class {
|
|
|
186
186
|
return this.#f;
|
|
187
187
|
}
|
|
188
188
|
dispose() {
|
|
189
|
-
this.#f || (this.#f = !0, this.#l.clear(), this.#h.clear(), this.#u.invalidate(new
|
|
189
|
+
this.#f || (this.#f = !0, this.#l.clear(), this.#h.clear(), this.#u.invalidate(new e()), this.#y(), this.#p.abort(new e()));
|
|
190
190
|
}
|
|
191
191
|
[Symbol.dispose]() {
|
|
192
192
|
this.dispose();
|
|
193
193
|
}
|
|
194
194
|
#b() {
|
|
195
|
-
if (this.#f) throw new
|
|
195
|
+
if (this.#f) throw new e();
|
|
196
196
|
}
|
|
197
197
|
#x() {
|
|
198
198
|
return this.#r.onPopstate(() => {
|
|
@@ -201,21 +201,21 @@ var k = class {
|
|
|
201
201
|
});
|
|
202
202
|
}
|
|
203
203
|
async #S(e, t) {
|
|
204
|
-
let n = this.#u.begin(), r = this.#d.matches.map((e) => e.name), i = this.#B(e), a = await
|
|
204
|
+
let n = this.#u.begin(), r = this.#d.matches.map((e) => e.name), i = this.#B(e), a = await b(this.#l, r, i);
|
|
205
205
|
if (!n.isCurrent()) return;
|
|
206
206
|
if (!a) {
|
|
207
207
|
this.#r.replace(t, this.#d.location.historyState);
|
|
208
208
|
return;
|
|
209
209
|
}
|
|
210
|
-
let o = await this.#F(n,
|
|
210
|
+
let o = await this.#F(n, f(this.#e, this.#r), (e, t) => {
|
|
211
211
|
if (!n.isCurrent()) return;
|
|
212
212
|
let r = this.#z(e);
|
|
213
213
|
t && this.#r.replace(r, e.historyState), this.#m = r;
|
|
214
|
-
});
|
|
214
|
+
}, void 0, 0, !1);
|
|
215
215
|
n.isCurrent() && !o && this.#r.replace(t, this.#d.location.historyState);
|
|
216
216
|
}
|
|
217
217
|
#C(e, t) {
|
|
218
|
-
|
|
218
|
+
y(e, t, this.#c);
|
|
219
219
|
}
|
|
220
220
|
#w(e, t) {
|
|
221
221
|
e.catch((e) => {
|
|
@@ -223,7 +223,9 @@ var k = class {
|
|
|
223
223
|
});
|
|
224
224
|
}
|
|
225
225
|
#T() {
|
|
226
|
-
this.#h.forEach((e) =>
|
|
226
|
+
this.#h.forEach((e) => {
|
|
227
|
+
e(this.#d);
|
|
228
|
+
});
|
|
227
229
|
}
|
|
228
230
|
async #E(e, t) {
|
|
229
231
|
let n;
|
|
@@ -281,9 +283,9 @@ var k = class {
|
|
|
281
283
|
if (!r()) return;
|
|
282
284
|
l[n] = t;
|
|
283
285
|
let o = e.map((e, t) => s.includes(t) ? "streaming" : "idle");
|
|
284
|
-
this.#d =
|
|
286
|
+
this.#d = _({
|
|
285
287
|
location: i,
|
|
286
|
-
matches:
|
|
288
|
+
matches: h(e, a, i.pathname, l, o),
|
|
287
289
|
status: "streaming"
|
|
288
290
|
}), this.#T();
|
|
289
291
|
};
|
|
@@ -302,29 +304,29 @@ var k = class {
|
|
|
302
304
|
})), l;
|
|
303
305
|
}
|
|
304
306
|
async #k(e) {
|
|
305
|
-
let
|
|
307
|
+
let n = e;
|
|
306
308
|
for (let e = 0; e < 5; e += 1) {
|
|
307
|
-
let e = new URL(
|
|
309
|
+
let e = new URL(n, "http://localhost"), t = {
|
|
308
310
|
hash: e.hash.replace(/^#/, ""),
|
|
309
311
|
historyState: null,
|
|
310
|
-
pathname:
|
|
311
|
-
query:
|
|
312
|
-
}, r = await this.#j(
|
|
312
|
+
pathname: p(e.pathname, this.#e),
|
|
313
|
+
query: d(e.search)
|
|
314
|
+
}, r = await this.#j(t);
|
|
313
315
|
if (r.type !== "redirect") return r;
|
|
314
|
-
|
|
316
|
+
n = this.#L(r.redirectTo);
|
|
315
317
|
}
|
|
316
|
-
throw new
|
|
318
|
+
throw new t();
|
|
317
319
|
}
|
|
318
320
|
async #A(e, t, n) {
|
|
319
321
|
let r = await this.#k(e);
|
|
320
322
|
if (r.type !== "matched") return;
|
|
321
|
-
let { location:
|
|
323
|
+
let { location: i, params: o, record: s, resolvedQuery: c } = r, l = this.#_.effectiveDefs(s);
|
|
322
324
|
if (!l.some((e) => e.dataFn != null)) return;
|
|
323
|
-
let u =
|
|
324
|
-
this.#v.set(
|
|
325
|
+
let u = h(l, o, i.pathname, l.map(() => void 0)), d = g(i, c, o, u, () => Promise.resolve()), f = await this.#D(l, d, t);
|
|
326
|
+
this.#v.set(a(this.#e, s.path, o, n ?? i.query), f);
|
|
325
327
|
}
|
|
326
328
|
async #j(e) {
|
|
327
|
-
let { params: t, record: n } =
|
|
329
|
+
let { params: t, record: n } = c(e.pathname, this.#i);
|
|
328
330
|
if (!n) return {
|
|
329
331
|
location: e,
|
|
330
332
|
params: t,
|
|
@@ -345,7 +347,7 @@ var k = class {
|
|
|
345
347
|
await this.#_.hydrate(n);
|
|
346
348
|
let a = this.#_.effectiveDefs(n);
|
|
347
349
|
return {
|
|
348
|
-
branch:
|
|
350
|
+
branch: h(a, t, e.pathname, a.map(() => void 0)),
|
|
349
351
|
location: e,
|
|
350
352
|
params: t,
|
|
351
353
|
record: n,
|
|
@@ -366,27 +368,27 @@ var k = class {
|
|
|
366
368
|
throw await e.return(void 0).catch(() => void 0), t;
|
|
367
369
|
}
|
|
368
370
|
}
|
|
369
|
-
async #N(e, t, n, r,
|
|
370
|
-
if (!
|
|
371
|
-
let
|
|
372
|
-
if (
|
|
373
|
-
let
|
|
374
|
-
if (
|
|
371
|
+
async #N(e, t, n, r, i, o) {
|
|
372
|
+
if (!o()) return;
|
|
373
|
+
let s = this.#_.effectiveDefs(e), c = s.some((e) => e.dataFn != null), l = s.map(() => void 0);
|
|
374
|
+
if (c) {
|
|
375
|
+
let c = a(this.#e, e.path, r, n.query), u = this.#v.consume(c);
|
|
376
|
+
if (u) l = u;
|
|
375
377
|
else {
|
|
376
|
-
let
|
|
377
|
-
this.#d =
|
|
378
|
+
let a = s.map((e) => e.dataFn ? "loading" : "idle");
|
|
379
|
+
this.#d = _({
|
|
378
380
|
location: n,
|
|
379
|
-
matches:
|
|
381
|
+
matches: h(s, r, n.pathname, l, a),
|
|
380
382
|
status: "loading"
|
|
381
383
|
}), this.#T();
|
|
382
384
|
try {
|
|
383
|
-
|
|
385
|
+
l = await this.#O(s, t, i, o, n, r);
|
|
384
386
|
} catch (t) {
|
|
385
|
-
if (!
|
|
386
|
-
throw this.#d =
|
|
387
|
+
if (!o()) return;
|
|
388
|
+
throw this.#d = _({
|
|
387
389
|
error: t,
|
|
388
390
|
location: n,
|
|
389
|
-
matches:
|
|
391
|
+
matches: h(s, r, n.pathname, l),
|
|
390
392
|
status: "error"
|
|
391
393
|
}), E(t, {
|
|
392
394
|
routeName: e.leaf.name,
|
|
@@ -395,9 +397,9 @@ var k = class {
|
|
|
395
397
|
}
|
|
396
398
|
}
|
|
397
399
|
}
|
|
398
|
-
|
|
400
|
+
o() && (this.#d = _({
|
|
399
401
|
location: n,
|
|
400
|
-
matches:
|
|
402
|
+
matches: h(s, r, n.pathname, l),
|
|
401
403
|
status: "idle"
|
|
402
404
|
}));
|
|
403
405
|
}
|
|
@@ -411,50 +413,50 @@ var k = class {
|
|
|
411
413
|
}
|
|
412
414
|
await e();
|
|
413
415
|
}
|
|
414
|
-
async #F(e,
|
|
415
|
-
let s = this.#d, c = () => e.isCurrent() && !this.#f, l = await this.#j(
|
|
416
|
+
async #F(e, n, r, i, a = 0, o = !1) {
|
|
417
|
+
let s = this.#d, c = () => e.isCurrent() && !this.#f, l = await this.#j(n);
|
|
416
418
|
if (!c()) return !1;
|
|
417
419
|
if (l.type === "redirect") {
|
|
418
|
-
if (
|
|
419
|
-
return this.#F(e, this.#R(l.redirectTo,
|
|
420
|
+
if (a >= 5) throw new t();
|
|
421
|
+
return this.#F(e, this.#R(l.redirectTo, n.historyState), r, i, a + 1, !0);
|
|
420
422
|
}
|
|
421
423
|
if (l.type === "unmatched") {
|
|
422
424
|
if (this.#g) {
|
|
423
|
-
let
|
|
425
|
+
let t = [this.#g.leaf], a = h(t, {}, n.pathname, [void 0]), l = !1, u = !1, d = n.query;
|
|
424
426
|
if (this.#n) try {
|
|
425
|
-
d = this.#n(
|
|
427
|
+
d = this.#n(n.query);
|
|
426
428
|
} catch (e) {
|
|
427
429
|
this.#C(e, { source: "coerce-search" });
|
|
428
430
|
}
|
|
429
431
|
let f = async () => {
|
|
430
432
|
if (!c()) return;
|
|
431
|
-
let
|
|
432
|
-
u = await
|
|
433
|
-
c() && (l = !0,
|
|
433
|
+
let t = g(n, d, {}, a, (e, t) => this.navigate(e, t));
|
|
434
|
+
u = await v(t, [...this.#t, ...this.#g.ownMiddleware], async () => {
|
|
435
|
+
c() && (l = !0, r(n, o), c() && await this.#N(this.#g, t, n, {}, e.signal, c));
|
|
434
436
|
});
|
|
435
437
|
};
|
|
436
438
|
try {
|
|
437
|
-
await this.#P(f,
|
|
439
|
+
await this.#P(f, i);
|
|
438
440
|
} finally {
|
|
439
441
|
c() && l && (this.#T(), this.#I(this.#d, s));
|
|
440
442
|
}
|
|
441
443
|
return u && l;
|
|
442
444
|
}
|
|
443
|
-
return !c() || (
|
|
445
|
+
return !c() || (r(l.location, o), !c()) ? !1 : (this.#d = _({
|
|
444
446
|
location: l.location,
|
|
445
447
|
matches: [],
|
|
446
448
|
status: "idle"
|
|
447
449
|
}), this.#T(), this.#I(this.#d, s), !0);
|
|
448
450
|
}
|
|
449
|
-
let { branch: u, location: d, params: f, record: p, resolvedQuery:
|
|
451
|
+
let { branch: u, location: d, params: f, record: p, resolvedQuery: m } = l, y = !1, b = !1, x = async () => {
|
|
450
452
|
if (!c()) return;
|
|
451
|
-
let t =
|
|
452
|
-
b = await
|
|
453
|
-
c() && (y = !0,
|
|
453
|
+
let t = g(d, m, f, u, (e, t) => this.navigate(e, t));
|
|
454
|
+
b = await v(t, [...this.#t, ...p.ownMiddleware], async () => {
|
|
455
|
+
c() && (y = !0, r(d, o), c() && await this.#N(p, t, d, f, e.signal, c));
|
|
454
456
|
});
|
|
455
457
|
};
|
|
456
458
|
try {
|
|
457
|
-
await this.#P(x,
|
|
459
|
+
await this.#P(x, i);
|
|
458
460
|
} finally {
|
|
459
461
|
c() && y && (this.#T(), this.#I(this.#d, s));
|
|
460
462
|
}
|
|
@@ -472,43 +474,45 @@ var k = class {
|
|
|
472
474
|
}
|
|
473
475
|
}
|
|
474
476
|
#L(e) {
|
|
475
|
-
let t = new URL(e, "http://localhost"), n =
|
|
476
|
-
return `${
|
|
477
|
+
let t = new URL(e, "http://localhost"), n = p(t.pathname, this.#e);
|
|
478
|
+
return `${s(this.#e, n)}${t.search}${t.hash}`;
|
|
477
479
|
}
|
|
478
480
|
#R(e, t) {
|
|
479
481
|
let n = new URL(this.#L(e), "http://localhost");
|
|
480
482
|
return {
|
|
481
483
|
hash: n.hash.replace(/^#/, ""),
|
|
482
484
|
historyState: t,
|
|
483
|
-
pathname:
|
|
484
|
-
query:
|
|
485
|
+
pathname: p(n.pathname, this.#e),
|
|
486
|
+
query: d(n.search)
|
|
485
487
|
};
|
|
486
488
|
}
|
|
487
489
|
#z(e) {
|
|
488
490
|
let t = new URLSearchParams();
|
|
489
|
-
for (let [n, r] of Object.entries(e.query)) Array.isArray(r) ? r.forEach((e) =>
|
|
491
|
+
for (let [n, r] of Object.entries(e.query)) Array.isArray(r) ? r.forEach((e) => {
|
|
492
|
+
t.append(n, e);
|
|
493
|
+
}) : t.set(n, r);
|
|
490
494
|
let n = t.toString(), r = e.hash ? `#${e.hash}` : "";
|
|
491
|
-
return `${
|
|
495
|
+
return `${s(this.#e, e.pathname)}${n ? `?${n}` : ""}${r}`;
|
|
492
496
|
}
|
|
493
497
|
#B(e) {
|
|
494
|
-
let t = new URL(e, "http://localhost"), n =
|
|
498
|
+
let t = new URL(e, "http://localhost"), n = p(t.pathname, this.#e), { params: r, record: i } = c(n, this.#i);
|
|
495
499
|
return {
|
|
496
500
|
name: i?.leaf.name,
|
|
497
501
|
params: r,
|
|
498
502
|
pathname: n,
|
|
499
|
-
query:
|
|
503
|
+
query: d(t.search)
|
|
500
504
|
};
|
|
501
505
|
}
|
|
502
506
|
async #V(e, t = {}) {
|
|
503
507
|
this.#b();
|
|
504
508
|
let n = this.#L(e);
|
|
505
509
|
if (!t.force && n === this.#m) return;
|
|
506
|
-
let r = this.#u.begin(), i = this.#d.matches.map((e) => e.name), a = await
|
|
507
|
-
!r.isCurrent() || !a || await this.#F(r, this.#R(n, t.state),
|
|
510
|
+
let r = this.#u.begin(), i = this.#d.matches.map((e) => e.name), a = await b(this.#l, i, this.#B(n));
|
|
511
|
+
!r.isCurrent() || !a || await this.#F(r, this.#R(n, t.state), (e, t) => {
|
|
508
512
|
if (!r.isCurrent()) return;
|
|
509
513
|
let n = this.#z(e);
|
|
510
514
|
t ? this.#r.replace(n, e.historyState) : this.#r.push(n, e.historyState), this.#m = n;
|
|
511
|
-
});
|
|
515
|
+
}, t.viewTransition, 0, t.replace ?? !1);
|
|
512
516
|
}
|
|
513
517
|
};
|
|
514
518
|
function A(e) {
|