@manyducks.co/dolla 3.3.0 → 4.1.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 +1 -1
- package/dist/core/context.d.ts +15 -1
- package/dist/core/debug.d.ts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/markup/nodes/view.d.ts +7 -1
- package/dist/core/root.d.ts +4 -6
- package/dist/core/signals.d.ts +11 -0
- package/dist/{core-BRSu5hVw.js → core-C4DWUGxz.js} +154 -113
- package/dist/core-C4DWUGxz.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/jsx-dev-runtime.js +1 -1
- package/dist/jsx-runtime.js +1 -1
- package/dist/router/index.d.ts +2 -3
- package/dist/router/router.d.ts +1 -1
- package/dist/router/store.d.ts +2 -2
- package/dist/router.js +193 -204
- package/dist/router.js.map +1 -1
- package/dist/translate/index.d.ts +1 -1
- package/dist/translate.js +45 -45
- package/dist/translate.js.map +1 -1
- package/package.json +1 -1
- package/dist/core-BRSu5hVw.js.map +0 -1
package/dist/router.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { B as e,
|
|
1
|
+
import { B as e, C as t, D as n, E as r, F as i, I as a, L as o, N as s, O as c, R as l, S as u, T as d, V as f, _ as p, b as m, c as h, h as g, k as _, p as v, s as y, y as b, z as x } from "./core-C4DWUGxz.js";
|
|
2
2
|
//#region src/router/utils.ts
|
|
3
|
-
function
|
|
3
|
+
function S(e) {
|
|
4
4
|
return e.split("/").map((e) => e.trim()).filter(Boolean);
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function C(e) {
|
|
7
7
|
let t = e.map((e) => e.toString()).filter(Boolean).join("/");
|
|
8
8
|
if (!t) return "";
|
|
9
9
|
let n = t.startsWith("/"), r = t.split("/"), i = [];
|
|
@@ -11,20 +11,20 @@ function w(e) {
|
|
|
11
11
|
let a = i.join("/");
|
|
12
12
|
return n && (a = "/" + a), a || (n ? "/" : "");
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
return t ?? (t = e, e = ""), t.startsWith("/") ?
|
|
14
|
+
function w(e, t = null) {
|
|
15
|
+
return t ?? (t = e, e = ""), t.startsWith("/") ? C([t]) : C([e, t]);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function T(e) {
|
|
18
18
|
return Object.fromEntries(new URLSearchParams(e));
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function E(e, t, n) {
|
|
21
21
|
let r = {};
|
|
22
22
|
if (n === !0) Object.assign(r, e);
|
|
23
|
-
else if (
|
|
23
|
+
else if (o(n)) for (let t of n) t in e && (r[t] = e[t]);
|
|
24
24
|
for (let [e, n] of Object.entries(t)) n === null ? delete r[e] : r[e] = n;
|
|
25
25
|
return new URLSearchParams(r);
|
|
26
26
|
}
|
|
27
|
-
var
|
|
27
|
+
var D = class {
|
|
28
28
|
staticChildren = /* @__PURE__ */ new Map();
|
|
29
29
|
numericChild = null;
|
|
30
30
|
paramChild = null;
|
|
@@ -33,77 +33,77 @@ var O = class {
|
|
|
33
33
|
paramName;
|
|
34
34
|
numericName;
|
|
35
35
|
};
|
|
36
|
-
function
|
|
37
|
-
let n = new
|
|
38
|
-
function
|
|
39
|
-
let r =
|
|
40
|
-
for (let e of r) if (e === "*") i = i.wildcardChild ??= new
|
|
41
|
-
else if (e.charCodeAt(0) === 123) e.charCodeAt(1) === 35 ? (i = i.numericChild ??= new
|
|
36
|
+
function O(t) {
|
|
37
|
+
let n = new D(), r = [];
|
|
38
|
+
function i(e, t) {
|
|
39
|
+
let r = S(e), i = n;
|
|
40
|
+
for (let e of r) if (e === "*") i = i.wildcardChild ??= new D();
|
|
41
|
+
else if (e.charCodeAt(0) === 123) e.charCodeAt(1) === 35 ? (i = i.numericChild ??= new D(), i.numericName = e.slice(2, -1)) : (i = i.paramChild ??= new D(), i.paramName = e.slice(1, -1));
|
|
42
42
|
else {
|
|
43
43
|
let t = e.toLowerCase(), n = i.staticChildren.get(t);
|
|
44
|
-
n || i.staticChildren.set(t, n = new
|
|
44
|
+
n || i.staticChildren.set(t, n = new D()), i = n;
|
|
45
45
|
}
|
|
46
46
|
i.route = t;
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
|
|
50
|
-
let
|
|
51
|
-
...
|
|
48
|
+
function o(t, n = [], s = []) {
|
|
49
|
+
a(x(t) && e(t.path), "Invalid route object");
|
|
50
|
+
let c = n.map((e) => e.path), u = n.at(-1), d = u && t.meta ? {
|
|
51
|
+
...u.meta,
|
|
52
52
|
...t.meta
|
|
53
|
-
} : t.meta || {}, p =
|
|
53
|
+
} : t.meta || {}, p = c.length ? C([...c, t.path]) : t.path, m = M(p);
|
|
54
54
|
if (t.redirect) {
|
|
55
|
-
|
|
56
|
-
let
|
|
57
|
-
|
|
55
|
+
a(!t.routes && !t.view, "Route cannot mix redirect with view/routes");
|
|
56
|
+
let n = t.redirect;
|
|
57
|
+
e(n) && (n = w(C(c), n), n.startsWith("/") || (n = "/" + n));
|
|
58
58
|
for (let t of m) {
|
|
59
|
-
let
|
|
59
|
+
let a = {
|
|
60
60
|
pattern: t,
|
|
61
|
-
meta:
|
|
62
|
-
redirect:
|
|
61
|
+
meta: d,
|
|
62
|
+
redirect: n
|
|
63
63
|
};
|
|
64
|
-
|
|
64
|
+
i(t, a), e(n) && r.push(a);
|
|
65
65
|
}
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
a(t.view || t.routes, "Route must have view, redirect, or routes");
|
|
69
69
|
let h = t.view || ((e) => e.children);
|
|
70
|
-
if (!
|
|
70
|
+
if (!l(h) && !h._lazy) throw TypeError(`Expected view function for ${t.path}`);
|
|
71
71
|
if (t.routes) {
|
|
72
|
-
let
|
|
73
|
-
id:
|
|
72
|
+
let e = {
|
|
73
|
+
id: f(),
|
|
74
74
|
pattern: p,
|
|
75
75
|
view: h,
|
|
76
76
|
preload: t.preload,
|
|
77
77
|
errorView: t.errorView
|
|
78
78
|
};
|
|
79
|
-
for (let
|
|
80
|
-
} else for (let
|
|
81
|
-
let
|
|
82
|
-
id:
|
|
83
|
-
pattern:
|
|
79
|
+
for (let r of t.routes) o(r, [...n, t], [...s, e]);
|
|
80
|
+
} else for (let e of m) {
|
|
81
|
+
let n = {
|
|
82
|
+
id: f(),
|
|
83
|
+
pattern: e,
|
|
84
84
|
view: h,
|
|
85
85
|
preload: t.preload,
|
|
86
86
|
errorView: t.errorView
|
|
87
87
|
};
|
|
88
|
-
|
|
89
|
-
pattern:
|
|
90
|
-
meta:
|
|
91
|
-
layers: [...
|
|
88
|
+
i(e, {
|
|
89
|
+
pattern: e,
|
|
90
|
+
meta: d,
|
|
91
|
+
layers: [...s, n]
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
for (let e of t)
|
|
96
|
-
for (let e of
|
|
95
|
+
for (let e of t) o(e);
|
|
96
|
+
for (let e of r) a(k(n, e.redirect, { willMatch: (t) => t !== e }), `Dead redirect: ${e.pattern} -> ${e.redirect}`);
|
|
97
97
|
return n;
|
|
98
98
|
}
|
|
99
|
-
function
|
|
100
|
-
let [r, i] = t.split("?"), a =
|
|
99
|
+
function k(e, t, n = {}) {
|
|
100
|
+
let [r, i] = t.split("?"), a = S(r), o = {};
|
|
101
101
|
function s(e, t) {
|
|
102
102
|
if (t === a.length) return e.route && (!n.willMatch || n.willMatch(e.route)) ? {
|
|
103
103
|
path: r || "/",
|
|
104
104
|
pattern: e.route.pattern,
|
|
105
105
|
params: { ...o },
|
|
106
|
-
query:
|
|
106
|
+
query: T(i || ""),
|
|
107
107
|
meta: e.route.meta,
|
|
108
108
|
layers: e.route.layers ?? [],
|
|
109
109
|
redirect: e.route.redirect
|
|
@@ -114,7 +114,7 @@ function A(e, t, n = {}) {
|
|
|
114
114
|
...o,
|
|
115
115
|
wildcard: "/"
|
|
116
116
|
},
|
|
117
|
-
query:
|
|
117
|
+
query: T(i || ""),
|
|
118
118
|
meta: e.wildcardChild.route.meta,
|
|
119
119
|
layers: e.wildcardChild.route.layers ?? [],
|
|
120
120
|
redirect: e.wildcardChild.route.redirect
|
|
@@ -143,7 +143,7 @@ function A(e, t, n = {}) {
|
|
|
143
143
|
...o,
|
|
144
144
|
wildcard: "/" + a.slice(t).map(decodeURIComponent).join("/")
|
|
145
145
|
},
|
|
146
|
-
query:
|
|
146
|
+
query: T(i || ""),
|
|
147
147
|
meta: e.wildcardChild.route.meta,
|
|
148
148
|
layers: e.wildcardChild.route.layers ?? [],
|
|
149
149
|
redirect: e.wildcardChild.route.redirect
|
|
@@ -151,28 +151,28 @@ function A(e, t, n = {}) {
|
|
|
151
151
|
}
|
|
152
152
|
return s(e, 0);
|
|
153
153
|
}
|
|
154
|
-
async function
|
|
155
|
-
let i =
|
|
156
|
-
if (!i) return { journey: [...
|
|
154
|
+
async function A(t, n, r = []) {
|
|
155
|
+
let i = k(t, n);
|
|
156
|
+
if (!i) return { journey: [...r, {
|
|
157
157
|
kind: "miss",
|
|
158
|
-
message: `no match for '${
|
|
158
|
+
message: `no match for '${n}'`
|
|
159
159
|
}] };
|
|
160
160
|
if (i.redirect != null) {
|
|
161
|
-
let
|
|
162
|
-
return
|
|
161
|
+
let n = i.redirect;
|
|
162
|
+
return e(n) ? n = N(n, i.params) : (n = await n(i), a(e(n), "Redirect function must return a path."), n.startsWith("/") || (n = w(i.path, n))), A(t, n, [...r, {
|
|
163
163
|
kind: "redirect",
|
|
164
|
-
message: `redirecting '${i.path}' -> '${
|
|
164
|
+
message: `redirecting '${i.path}' -> '${n}'`
|
|
165
165
|
}]);
|
|
166
166
|
}
|
|
167
167
|
return {
|
|
168
168
|
match: i,
|
|
169
|
-
journey: [...
|
|
169
|
+
journey: [...r, {
|
|
170
170
|
kind: "match",
|
|
171
171
|
message: `matched route '${i.path}'`
|
|
172
172
|
}]
|
|
173
173
|
};
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function j(e, t, n = window) {
|
|
176
176
|
function r(r) {
|
|
177
177
|
if (r.button && r.button !== 0 || r.ctrlKey || r.metaKey || r.altKey || r.shiftKey || r.defaultPrevented) return;
|
|
178
178
|
let i = r.target.closest("a");
|
|
@@ -182,8 +182,8 @@ function M(e, t, n = window) {
|
|
|
182
182
|
}
|
|
183
183
|
return e.addEventListener("click", r), () => e.removeEventListener("click", r);
|
|
184
184
|
}
|
|
185
|
-
function
|
|
186
|
-
let t =
|
|
185
|
+
function M(e) {
|
|
186
|
+
let t = S(e), n = [[]];
|
|
187
187
|
for (let e of t) {
|
|
188
188
|
let t = e.endsWith("?}"), r = t ? e.replace("?", "") : e;
|
|
189
189
|
if (t) {
|
|
@@ -193,89 +193,85 @@ function N(e) {
|
|
|
193
193
|
}
|
|
194
194
|
return n.map((e) => "/" + e.join("/")).map((e) => e === "/" ? e : e.replace(/\/$/, ""));
|
|
195
195
|
}
|
|
196
|
-
function
|
|
196
|
+
function N(e, t) {
|
|
197
197
|
for (let n in t) {
|
|
198
198
|
let r = String(t[n]);
|
|
199
199
|
e = e.replace(`{${n}}`, r).replace(`{#${n}}`, r).replace(`{${n}?}`, r).replace(`{#${n}?}`, r);
|
|
200
200
|
}
|
|
201
201
|
return e = e.replace(/\{#?[a-zA-Z0-9_]+\?\}/g, ""), e = e.replace(/\/+/g, "/"), e.length > 1 && e.endsWith("/") && (e = e.slice(0, -1)), e;
|
|
202
202
|
}
|
|
203
|
-
function
|
|
204
|
-
let
|
|
203
|
+
function P(e) {
|
|
204
|
+
let t = window.history.state?.index || 0;
|
|
205
205
|
window.history.state?.index === void 0 && window.history.replaceState({
|
|
206
206
|
...window.history.state,
|
|
207
207
|
key: Date.now().toString(),
|
|
208
|
-
index:
|
|
208
|
+
index: t
|
|
209
209
|
}, "");
|
|
210
|
-
let
|
|
210
|
+
let n = e ? () => window.location.hash.slice(1).split("?")[0] || "/" : () => window.location.pathname, r = e ? () => {
|
|
211
211
|
let e = window.location.hash, t = e.indexOf("?");
|
|
212
212
|
return t === -1 ? "" : e.slice(t);
|
|
213
|
-
} : () => window.location.search,
|
|
213
|
+
} : () => window.location.search, i = () => window.history.state?.key || "root";
|
|
214
214
|
return {
|
|
215
|
-
getPath:
|
|
216
|
-
getSearch:
|
|
217
|
-
getKey:
|
|
215
|
+
getPath: n,
|
|
216
|
+
getSearch: r,
|
|
217
|
+
getKey: i,
|
|
218
218
|
getIndex: () => window.history.state?.index || 0,
|
|
219
|
-
push: (
|
|
220
|
-
|
|
221
|
-
let
|
|
219
|
+
push: (n) => {
|
|
220
|
+
t++;
|
|
221
|
+
let r = e ? "/#" : "";
|
|
222
222
|
window.history.pushState({
|
|
223
|
-
key:
|
|
224
|
-
index:
|
|
225
|
-
}, "",
|
|
223
|
+
key: f(),
|
|
224
|
+
index: t
|
|
225
|
+
}, "", r + n);
|
|
226
226
|
},
|
|
227
|
-
replace: (
|
|
228
|
-
let r =
|
|
227
|
+
replace: (n) => {
|
|
228
|
+
let r = e ? "/#" : "";
|
|
229
229
|
window.history.replaceState({
|
|
230
|
-
key:
|
|
231
|
-
index:
|
|
232
|
-
}, "", r +
|
|
230
|
+
key: i(),
|
|
231
|
+
index: t
|
|
232
|
+
}, "", r + n);
|
|
233
233
|
}
|
|
234
234
|
};
|
|
235
235
|
}
|
|
236
236
|
//#endregion
|
|
237
237
|
//#region src/router/store.ts
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
t ? i.replace(n) : i.push(n), a();
|
|
238
|
+
var [F, I] = v("dolla:router", (e, t) => {
|
|
239
|
+
let n = h(e), { currentMatch: r, setCurrentMatch: a, progress: o, history: l, updateRoute: u, guards: d } = t;
|
|
240
|
+
async function f(e, t) {
|
|
241
|
+
for (let e of d) if (await e()) return;
|
|
242
|
+
n.info(`🗺️ navigating to '${e}'${t ? " (replace)" : ""}`);
|
|
243
|
+
let r = w(l.getPath(), e);
|
|
244
|
+
t ? l.replace(r) : l.push(r), u();
|
|
246
245
|
}
|
|
247
246
|
return {
|
|
248
|
-
path:
|
|
249
|
-
pattern:
|
|
250
|
-
params:
|
|
251
|
-
query:
|
|
252
|
-
meta:
|
|
253
|
-
progress:
|
|
254
|
-
setQuery(
|
|
255
|
-
let
|
|
256
|
-
|
|
257
|
-
...
|
|
258
|
-
query:
|
|
247
|
+
path: c(() => r().path),
|
|
248
|
+
pattern: c(() => r().pattern),
|
|
249
|
+
params: c(() => r().params),
|
|
250
|
+
query: c(() => r().query),
|
|
251
|
+
meta: c(() => r().meta),
|
|
252
|
+
progress: o,
|
|
253
|
+
setQuery(e) {
|
|
254
|
+
let t = s(r), n = E(t.query, e, !0), i = Object.fromEntries(n);
|
|
255
|
+
a({
|
|
256
|
+
...t,
|
|
257
|
+
query: i
|
|
259
258
|
});
|
|
260
|
-
let
|
|
261
|
-
return
|
|
259
|
+
let o = n.size ? "?" + n.toString() : "";
|
|
260
|
+
return l.replace(t.path + o), i;
|
|
262
261
|
},
|
|
263
262
|
back: (e = 1) => window.history.go(-e),
|
|
264
263
|
forward: (e = 1) => window.history.go(e),
|
|
265
|
-
push: (e) =>
|
|
266
|
-
replace: (e) =>
|
|
267
|
-
block: (e) => (
|
|
268
|
-
isActive(
|
|
269
|
-
return
|
|
270
|
-
let
|
|
271
|
-
return
|
|
264
|
+
push: (e) => f(e, !1),
|
|
265
|
+
replace: (e) => f(e, !0),
|
|
266
|
+
block: (e) => (d.add(e), () => d.delete(e)),
|
|
267
|
+
isActive(e, t = !1) {
|
|
268
|
+
return c(() => {
|
|
269
|
+
let n = i(e), a = n === "/" ? "/" : n.replace(/\/$/, ""), o = a === "/" ? "/" : a + "/", s = r().path, c = s === "/" ? "/" : s.replace(/\/$/, "");
|
|
270
|
+
return t ? c === a : c === a || c.startsWith(o);
|
|
272
271
|
});
|
|
273
272
|
}
|
|
274
273
|
};
|
|
275
|
-
}
|
|
276
|
-
//#endregion
|
|
277
|
-
//#region src/router/router.ts
|
|
278
|
-
var L = Symbol();
|
|
274
|
+
}), L = Symbol.for("$_ROUTER_ROOT_SLOT");
|
|
279
275
|
function R(e) {
|
|
280
276
|
return {
|
|
281
277
|
_lazy: !0,
|
|
@@ -283,133 +279,131 @@ function R(e) {
|
|
|
283
279
|
};
|
|
284
280
|
}
|
|
285
281
|
function z(e) {
|
|
286
|
-
return function(
|
|
282
|
+
return function(i) {
|
|
287
283
|
"scrollRestoration" in window.history && (window.history.scrollRestoration = "manual");
|
|
288
|
-
let
|
|
289
|
-
path:
|
|
284
|
+
let a = P(!!e.hash), o = /* @__PURE__ */ new Map(), c = a.getKey(), [l, f] = _({
|
|
285
|
+
path: a.getPath(),
|
|
290
286
|
pattern: "",
|
|
291
287
|
params: {},
|
|
292
|
-
query: Object.fromEntries(new URLSearchParams(
|
|
288
|
+
query: Object.fromEntries(new URLSearchParams(a.getSearch())),
|
|
293
289
|
meta: {}
|
|
294
|
-
}), [
|
|
295
|
-
|
|
296
|
-
let
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
i
|
|
305
|
-
let m = f ?? r.getPath(), { match: h, journey: g } = await j(C, m);
|
|
306
|
-
if (t[y]) for (let e = 0; e < g.length; e++) {
|
|
290
|
+
}), [h, v] = _(0), x = O(e.routes), S = /* @__PURE__ */ new Set(), C = y("dolla:router"), [w, T] = _();
|
|
291
|
+
i[L] = w;
|
|
292
|
+
let D = {
|
|
293
|
+
context: i,
|
|
294
|
+
slot: w,
|
|
295
|
+
setSlot: T
|
|
296
|
+
}, k = [];
|
|
297
|
+
async function M(u) {
|
|
298
|
+
o.set(c, window.scrollY);
|
|
299
|
+
let p = u ?? a.getPath(), { match: h, journey: g } = await A(x, p);
|
|
300
|
+
if (i[d]) for (let e = 0; e < g.length; e++) {
|
|
307
301
|
let t = g[e], n = `(update ${e + 1}/${g.length})`;
|
|
308
|
-
t.kind === "match" ?
|
|
302
|
+
t.kind === "match" ? C.info(`📍 ${n} ${t.message}`) : t.kind === "redirect" ? C.info(`↩️ ${n} ${t.message}`) : C.info(`💀 ${n} ${t.message}`);
|
|
309
303
|
}
|
|
310
|
-
if (!h) throw Error(`Failed to match route '${
|
|
311
|
-
let { layers:
|
|
312
|
-
for (let e = 0; e <
|
|
313
|
-
let t = `${
|
|
314
|
-
|
|
304
|
+
if (!h) throw Error(`Failed to match route '${p}'`);
|
|
305
|
+
let { layers: y, params: b } = h, S = [], w = 0;
|
|
306
|
+
for (let e = 0; e < y.length; e++) {
|
|
307
|
+
let t = `${y[e].id}:${N(y[e].pattern, b)}`;
|
|
308
|
+
S.push(t), w === e && k[e]?.key === t && w++;
|
|
315
309
|
}
|
|
316
|
-
let
|
|
317
|
-
for (let e =
|
|
318
|
-
let t =
|
|
319
|
-
t.preload &&
|
|
320
|
-
|
|
310
|
+
let T = [], O = [];
|
|
311
|
+
for (let e = w; e < y.length; e++) {
|
|
312
|
+
let t = y[e];
|
|
313
|
+
t.preload && T.push(Promise.resolve(t.preload(h)).then((t) => {
|
|
314
|
+
O[e - w] = t;
|
|
321
315
|
}));
|
|
322
316
|
let n = t.view;
|
|
323
|
-
n._lazy &&
|
|
317
|
+
n._lazy && T.push(n.load().then((e) => {
|
|
324
318
|
t.view = e.default ?? e;
|
|
325
319
|
}));
|
|
326
320
|
}
|
|
327
|
-
let
|
|
328
|
-
if (
|
|
329
|
-
|
|
330
|
-
let e = 0, t = .8 /
|
|
331
|
-
|
|
321
|
+
let j = null, M = -1;
|
|
322
|
+
if (T.length > 0) {
|
|
323
|
+
v(.1);
|
|
324
|
+
let e = 0, t = .8 / T.length;
|
|
325
|
+
T.forEach((n) => n.then(() => v(.1 + ++e * t)).catch(() => {}));
|
|
332
326
|
try {
|
|
333
|
-
await Promise.all(
|
|
327
|
+
await Promise.all(T);
|
|
334
328
|
} catch (e) {
|
|
335
|
-
if (
|
|
336
|
-
|
|
329
|
+
if (v(0), e instanceof V) return I.replace(e.redirectPath);
|
|
330
|
+
j = e instanceof Error ? e : Error(String(e)), M = w;
|
|
337
331
|
}
|
|
338
332
|
}
|
|
339
|
-
let
|
|
340
|
-
|
|
341
|
-
if (
|
|
333
|
+
let P = E(s(l).query, h.query, e.preserveQuery), F = P.toString(), L = h.path + (F ? `?${F}` : "");
|
|
334
|
+
L !== a.getPath() + a.getSearch() && a.replace(L), n(() => {
|
|
335
|
+
if (f({
|
|
342
336
|
...h,
|
|
343
|
-
query: Object.fromEntries(
|
|
344
|
-
}), !(
|
|
345
|
-
|
|
346
|
-
for (let e =
|
|
347
|
-
let
|
|
348
|
-
data:
|
|
349
|
-
children:
|
|
337
|
+
query: Object.fromEntries(P)
|
|
338
|
+
}), !(w === y.length && k.length === y.length)) {
|
|
339
|
+
k[w] && (k[w].node.unmount(), k.length = w);
|
|
340
|
+
for (let e = w; e < y.length; e++) {
|
|
341
|
+
let n = y[e], i = k[e - 1] ?? D, [a, o] = _(), s = n.view, c = {
|
|
342
|
+
data: O[e - w],
|
|
343
|
+
children: t(r, { args: [a] })
|
|
350
344
|
};
|
|
351
|
-
if (
|
|
352
|
-
if (!
|
|
353
|
-
|
|
345
|
+
if (j && e === M) {
|
|
346
|
+
if (!n.errorView) throw j;
|
|
347
|
+
s = n.errorView, c = { error: j };
|
|
354
348
|
}
|
|
355
|
-
let
|
|
356
|
-
if (
|
|
357
|
-
id:
|
|
358
|
-
key:
|
|
359
|
-
node:
|
|
360
|
-
context:
|
|
361
|
-
slot:
|
|
362
|
-
setSlot:
|
|
363
|
-
}),
|
|
349
|
+
let l = new m(i.context, s, c);
|
|
350
|
+
if (i.setSlot(l), k.push({
|
|
351
|
+
id: n.id,
|
|
352
|
+
key: S[e],
|
|
353
|
+
node: l,
|
|
354
|
+
context: l.context,
|
|
355
|
+
slot: a,
|
|
356
|
+
setSlot: o
|
|
357
|
+
}), j && e === M) break;
|
|
364
358
|
}
|
|
365
359
|
}
|
|
366
|
-
}),
|
|
367
|
-
window.scrollTo(0,
|
|
360
|
+
}), v(0), requestAnimationFrame(() => {
|
|
361
|
+
window.scrollTo(0, o.get(a.getKey()) ?? 0), c = a.getKey();
|
|
368
362
|
});
|
|
369
363
|
}
|
|
370
|
-
let
|
|
371
|
-
currentMatch:
|
|
372
|
-
setCurrentMatch:
|
|
373
|
-
progress:
|
|
374
|
-
history:
|
|
375
|
-
updateRoute:
|
|
376
|
-
guards:
|
|
364
|
+
let I = F(i, {
|
|
365
|
+
currentMatch: l,
|
|
366
|
+
setCurrentMatch: f,
|
|
367
|
+
progress: h,
|
|
368
|
+
history: a,
|
|
369
|
+
updateRoute: M,
|
|
370
|
+
guards: S
|
|
377
371
|
});
|
|
378
|
-
|
|
379
|
-
let e = !1,
|
|
372
|
+
b(i, () => {
|
|
373
|
+
let e = !1, t = !1, n = a.getIndex(), r = u(window, "popstate", async () => {
|
|
380
374
|
if (e) {
|
|
381
375
|
e = !1;
|
|
382
376
|
return;
|
|
383
377
|
}
|
|
384
|
-
if (
|
|
385
|
-
|
|
378
|
+
if (t) {
|
|
379
|
+
t = !1, n = a.getIndex(), M();
|
|
386
380
|
return;
|
|
387
381
|
}
|
|
388
|
-
let
|
|
389
|
-
if (
|
|
390
|
-
e = !0, window.history.go(
|
|
391
|
-
let
|
|
392
|
-
for (let e of
|
|
393
|
-
|
|
382
|
+
let r = a.getIndex(), i = n - r;
|
|
383
|
+
if (S.size > 0) {
|
|
384
|
+
e = !0, window.history.go(i);
|
|
385
|
+
let n = !1;
|
|
386
|
+
for (let e of S) if (await e()) {
|
|
387
|
+
n = !0;
|
|
394
388
|
break;
|
|
395
389
|
}
|
|
396
|
-
|
|
390
|
+
n || (t = !0, window.history.go(-i));
|
|
397
391
|
return;
|
|
398
392
|
}
|
|
399
|
-
|
|
400
|
-
}), o =
|
|
401
|
-
|
|
402
|
-
}), s =
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
}),
|
|
393
|
+
n = r, M();
|
|
394
|
+
}), o = u(window, "beforeunload", (e) => {
|
|
395
|
+
S.size > 0 && (e.preventDefault(), e.returnValue = "");
|
|
396
|
+
}), s = j(g(i), I.push);
|
|
397
|
+
p(i, () => {
|
|
398
|
+
r(), o(), s();
|
|
399
|
+
}), M();
|
|
406
400
|
});
|
|
407
401
|
};
|
|
408
402
|
}
|
|
409
403
|
function B() {
|
|
410
404
|
this.name = "dolla:router";
|
|
411
405
|
let e = this[L];
|
|
412
|
-
return
|
|
406
|
+
return a(e != null, "Router plugin not found on root."), new r(this, e);
|
|
413
407
|
}
|
|
414
408
|
var V = class extends Error {
|
|
415
409
|
constructor(e) {
|
|
@@ -417,11 +411,6 @@ var V = class extends Error {
|
|
|
417
411
|
}
|
|
418
412
|
};
|
|
419
413
|
//#endregion
|
|
420
|
-
|
|
421
|
-
function H(e) {
|
|
422
|
-
return g(e, I);
|
|
423
|
-
}
|
|
424
|
-
//#endregion
|
|
425
|
-
export { B as Outlet, V as RedirectError, z as createRouterPlugin, H as getRouter, R as lazy };
|
|
414
|
+
export { B as Outlet, V as RedirectError, z as createRouter, I as getRouter, R as lazy };
|
|
426
415
|
|
|
427
416
|
//# sourceMappingURL=router.js.map
|