@manyducks.co/dolla 2.0.0-alpha.20 → 2.0.0-alpha.21
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/index.js +264 -262
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.js +2 -2
- package/dist/jsx-runtime.js +2 -2
- package/dist/markup.d.ts +2 -2
- package/dist/nodes/cond.d.ts +1 -1
- package/dist/nodes/html.d.ts +1 -1
- package/dist/nodes/observer.d.ts +1 -1
- package/dist/nodes/outlet.d.ts +1 -1
- package/dist/nodes/portal.d.ts +1 -1
- package/dist/nodes/repeat.d.ts +1 -1
- package/dist/nodes/text.d.ts +1 -1
- package/dist/{passthrough-DrILnMr2.js → passthrough-6Lrg96Id.js} +9 -9
- package/dist/passthrough-6Lrg96Id.js.map +1 -0
- package/dist/view.d.ts +1 -1
- package/package.json +1 -1
- package/dist/passthrough-DrILnMr2.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Dt = Object.defineProperty;
|
|
2
2
|
var pt = (i) => {
|
|
3
3
|
throw TypeError(i);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var P = (i, e, t) =>
|
|
7
|
-
var s = (i, e, t) => (Ze(i, e, "read from private field"), t ? t.call(i) : e.get(i)), h = (i, e, t) => e.has(i) ? pt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t),
|
|
5
|
+
var Nt = (i, e, t) => e in i ? Dt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
6
|
+
var P = (i, e, t) => Nt(i, typeof e != "symbol" ? e + "" : e, t), Ze = (i, e, t) => e.has(i) || pt("Cannot " + t);
|
|
7
|
+
var s = (i, e, t) => (Ze(i, e, "read from private field"), t ? t.call(i) : e.get(i)), h = (i, e, t) => e.has(i) ? pt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), b = (i, e, t, r) => (Ze(i, e, "write to private field"), r ? r.call(i, t) : e.set(i, t), t), v = (i, e, t) => (Ze(i, e, "access private method"), t);
|
|
8
8
|
var et = (i, e, t, r) => ({
|
|
9
9
|
set _(n) {
|
|
10
|
-
|
|
10
|
+
b(i, e, n, t);
|
|
11
11
|
},
|
|
12
12
|
get _() {
|
|
13
13
|
return s(i, e, r);
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
-
import { h as mt, c as jt, i as rt, g as Tt, a as
|
|
17
|
-
import { A as kr, B as Sr, C as Pr } from "./passthrough-
|
|
16
|
+
import { h as mt, c as jt, i as rt, g as Tt, a as oe, d as be, b as dt, e as V, t as gt, f as kt, j as Mt, k as nt, P as St, l as wt, m as qt, n as Ft, o as At, v as _t, p as Ct, q as Vt, r as yt, s as It, u as Ut, w as Ce, x as Ve, V as Ht, y as Wt, z as Bt } from "./passthrough-6Lrg96Id.js";
|
|
17
|
+
import { A as kr, B as Sr, C as Pr } from "./passthrough-6Lrg96Id.js";
|
|
18
18
|
function Gt(i) {
|
|
19
19
|
return mt`
|
|
20
20
|
<div
|
|
@@ -62,11 +62,11 @@ function Gt(i) {
|
|
|
62
62
|
</div>
|
|
63
63
|
`;
|
|
64
64
|
}
|
|
65
|
-
var
|
|
65
|
+
var J, Qe, j, F;
|
|
66
66
|
class zt {
|
|
67
67
|
constructor() {
|
|
68
|
-
h(this,
|
|
69
|
-
h(this,
|
|
68
|
+
h(this, j);
|
|
69
|
+
h(this, J, []);
|
|
70
70
|
h(this, Qe, Kt());
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
@@ -76,41 +76,41 @@ class zt {
|
|
|
76
76
|
* @param middleware - A middleware function that will intercept requests.
|
|
77
77
|
*/
|
|
78
78
|
use(e) {
|
|
79
|
-
return s(this,
|
|
80
|
-
s(this,
|
|
79
|
+
return s(this, J).push(e), () => {
|
|
80
|
+
s(this, J).splice(s(this, J).indexOf(e), 1);
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
async get(e, t) {
|
|
84
|
-
return
|
|
84
|
+
return v(this, j, F).call(this, "get", e, t);
|
|
85
85
|
}
|
|
86
86
|
async put(e, t) {
|
|
87
|
-
return
|
|
87
|
+
return v(this, j, F).call(this, "put", e, t);
|
|
88
88
|
}
|
|
89
89
|
async patch(e, t) {
|
|
90
|
-
return
|
|
90
|
+
return v(this, j, F).call(this, "patch", e, t);
|
|
91
91
|
}
|
|
92
92
|
async post(e, t) {
|
|
93
|
-
return
|
|
93
|
+
return v(this, j, F).call(this, "post", e, t);
|
|
94
94
|
}
|
|
95
95
|
async delete(e, t) {
|
|
96
|
-
return
|
|
96
|
+
return v(this, j, F).call(this, "delete", e, t);
|
|
97
97
|
}
|
|
98
98
|
async head(e, t) {
|
|
99
|
-
return
|
|
99
|
+
return v(this, j, F).call(this, "head", e, t);
|
|
100
100
|
}
|
|
101
101
|
async options(e, t) {
|
|
102
|
-
return
|
|
102
|
+
return v(this, j, F).call(this, "options", e, t);
|
|
103
103
|
}
|
|
104
104
|
async trace(e, t) {
|
|
105
|
-
return
|
|
105
|
+
return v(this, j, F).call(this, "trace", e, t);
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
|
|
108
|
+
J = new WeakMap(), Qe = new WeakMap(), j = new WeakSet(), F = async function(e, t, r) {
|
|
109
109
|
return Jt({
|
|
110
110
|
...r,
|
|
111
111
|
method: e,
|
|
112
112
|
uri: t,
|
|
113
|
-
middleware: s(this,
|
|
113
|
+
middleware: s(this, J),
|
|
114
114
|
fetch: s(this, Qe)
|
|
115
115
|
});
|
|
116
116
|
};
|
|
@@ -226,14 +226,14 @@ function Yt() {
|
|
|
226
226
|
}
|
|
227
227
|
var Xt = Yt();
|
|
228
228
|
const Zt = /* @__PURE__ */ Tt(Xt);
|
|
229
|
-
var Je,
|
|
229
|
+
var Je, le, ne, at, Pt;
|
|
230
230
|
class er {
|
|
231
231
|
constructor(e, t) {
|
|
232
|
-
h(this,
|
|
232
|
+
h(this, ne);
|
|
233
233
|
P(this, "dolla");
|
|
234
234
|
P(this, "config");
|
|
235
235
|
h(this, Je, !1);
|
|
236
|
-
h(this,
|
|
236
|
+
h(this, le, /* @__PURE__ */ new Map());
|
|
237
237
|
this.config = e, this.dolla = t;
|
|
238
238
|
}
|
|
239
239
|
async load() {
|
|
@@ -256,30 +256,30 @@ class er {
|
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
if (e) {
|
|
259
|
-
const t =
|
|
259
|
+
const t = v(this, ne, at).call(this, e);
|
|
260
260
|
for (const r of t)
|
|
261
|
-
s(this,
|
|
261
|
+
s(this, le).set(r[0], r[1]);
|
|
262
262
|
} else
|
|
263
263
|
throw new Error("Language could not be loaded.");
|
|
264
264
|
}
|
|
265
265
|
getTemplate(e) {
|
|
266
|
-
return s(this,
|
|
266
|
+
return s(this, le).get(e) ?? {
|
|
267
267
|
segments: [{ type: 0, text: `[MISSING: ${e}]` }]
|
|
268
268
|
};
|
|
269
269
|
}
|
|
270
270
|
hasTemplate(e) {
|
|
271
|
-
return s(this,
|
|
271
|
+
return s(this, le).has(e);
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
|
-
Je = new WeakMap(),
|
|
274
|
+
Je = new WeakMap(), le = new WeakMap(), ne = new WeakSet(), at = function(e, t = []) {
|
|
275
275
|
const r = [];
|
|
276
276
|
for (const n in e)
|
|
277
277
|
switch (gt(e[n])) {
|
|
278
278
|
case "string":
|
|
279
|
-
r.push([[...t, n].join("."),
|
|
279
|
+
r.push([[...t, n].join("."), v(this, ne, Pt).call(this, e[n])]);
|
|
280
280
|
break;
|
|
281
281
|
case "object":
|
|
282
|
-
r.push(...
|
|
282
|
+
r.push(...v(this, ne, at).call(this, e[n], [...t, n]));
|
|
283
283
|
break;
|
|
284
284
|
default:
|
|
285
285
|
throw new Error(
|
|
@@ -287,7 +287,7 @@ Je = new WeakMap(), ue = new WeakMap(), se = new WeakSet(), at = function(e, t =
|
|
|
287
287
|
);
|
|
288
288
|
}
|
|
289
289
|
return r;
|
|
290
|
-
},
|
|
290
|
+
}, Pt = function(e) {
|
|
291
291
|
let t;
|
|
292
292
|
((u) => {
|
|
293
293
|
u[u.Static = 0] = "Static", u[u.ValueName = 1] = "ValueName", u[u.FormatName = 2] = "FormatName", u[u.FormatOptionName = 3] = "FormatOptionName", u[u.FormatOptionValue = 4] = "FormatOptionValue", u[u.FormatOptionEnd = 5] = "FormatOptionEnd";
|
|
@@ -336,22 +336,22 @@ Je = new WeakMap(), ue = new WeakMap(), se = new WeakSet(), at = function(e, t =
|
|
|
336
336
|
}
|
|
337
337
|
return o === 0 && n.length > 0 && r.segments.push({ type: 0, text: n }), r;
|
|
338
338
|
};
|
|
339
|
-
var
|
|
339
|
+
var $e, I, L, Ee, ke, Se, Pe, R, xt, st, it, ot, Ot;
|
|
340
340
|
class tr {
|
|
341
341
|
constructor(e) {
|
|
342
342
|
h(this, R);
|
|
343
|
-
h(this,
|
|
343
|
+
h(this, $e);
|
|
344
344
|
h(this, I);
|
|
345
345
|
h(this, L, /* @__PURE__ */ new Map());
|
|
346
|
-
h(this,
|
|
347
|
-
h(this,
|
|
348
|
-
h(this,
|
|
346
|
+
h(this, Ee, []);
|
|
347
|
+
h(this, ke, /* @__PURE__ */ new Map());
|
|
348
|
+
h(this, Se, "auto");
|
|
349
349
|
P(this, "$locale");
|
|
350
|
-
h(this,
|
|
351
|
-
|
|
352
|
-
const [t, r] =
|
|
353
|
-
this.$locale = t,
|
|
354
|
-
s(this, L).size > 0 && await this.setLocale(s(this,
|
|
350
|
+
h(this, Pe);
|
|
351
|
+
b(this, $e, e), b(this, I, e.createLogger("dolla/i18n"));
|
|
352
|
+
const [t, r] = oe();
|
|
353
|
+
this.$locale = t, b(this, Pe, r), this.addFormat("number", (n, a, o) => v(this, R, st).call(this, Number(a), o)), this.addFormat("datetime", (n, a, o) => v(this, R, it).call(this, a, o)), this.addFormat("list", (n, a, o) => v(this, R, ot).call(this, a, o)), e.beforeMount(async () => {
|
|
354
|
+
s(this, L).size > 0 && await this.setLocale(s(this, Se));
|
|
355
355
|
});
|
|
356
356
|
}
|
|
357
357
|
get locales() {
|
|
@@ -359,11 +359,11 @@ class tr {
|
|
|
359
359
|
}
|
|
360
360
|
setup(e) {
|
|
361
361
|
if (e.translations.forEach((t) => {
|
|
362
|
-
s(this, L).set(t.locale, new er(t, s(this,
|
|
362
|
+
s(this, L).set(t.locale, new er(t, s(this, $e)));
|
|
363
363
|
}), e.locale && e.locale !== "auto") {
|
|
364
364
|
if (!e.translations.some((r) => r.locale === e.locale))
|
|
365
365
|
throw new Error(`Initial locale '${e.locale}' is not registered in the locales array.`);
|
|
366
|
-
|
|
366
|
+
b(this, Se, e.locale);
|
|
367
367
|
}
|
|
368
368
|
s(this, I).info(
|
|
369
369
|
`${s(this, L).size} language${s(this, L).size === 1 ? "" : "s"} supported: '${[...s(this, L).keys()].join("', '")}'`
|
|
@@ -390,7 +390,7 @@ class tr {
|
|
|
390
390
|
throw new Error(`Locale '${e}' has no translation.`);
|
|
391
391
|
const r = s(this, L).get(t);
|
|
392
392
|
try {
|
|
393
|
-
await r.load(),
|
|
393
|
+
await r.load(), b(this, Ee, []), s(this, Pe).call(this, t), s(this, I).info("set language to " + t);
|
|
394
394
|
} catch (a) {
|
|
395
395
|
a instanceof Error && s(this, I).crash(a);
|
|
396
396
|
}
|
|
@@ -418,7 +418,7 @@ class tr {
|
|
|
418
418
|
const p = {};
|
|
419
419
|
for (let l = 0; l < o.length; l++)
|
|
420
420
|
p[r[l]] = o[l];
|
|
421
|
-
return
|
|
421
|
+
return v(this, R, xt).call(this, a, e, p);
|
|
422
422
|
});
|
|
423
423
|
}
|
|
424
424
|
/**
|
|
@@ -436,7 +436,7 @@ class tr {
|
|
|
436
436
|
* t("greeting", {name: "world"}); // State<"Hello, WORLD!">
|
|
437
437
|
*/
|
|
438
438
|
addFormat(e, t) {
|
|
439
|
-
s(this,
|
|
439
|
+
s(this, ke).set(e, t);
|
|
440
440
|
}
|
|
441
441
|
/**
|
|
442
442
|
* Creates an `Intl.Collator` configured for the current locale.
|
|
@@ -453,7 +453,7 @@ class tr {
|
|
|
453
453
|
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options
|
|
454
454
|
*/
|
|
455
455
|
number(e, t) {
|
|
456
|
-
return be([this.$locale, e], (r, n) =>
|
|
456
|
+
return be([this.$locale, e], (r, n) => v(this, R, st).call(this, n, t));
|
|
457
457
|
}
|
|
458
458
|
/**
|
|
459
459
|
* Returns a State containing the date formatted for the current locale. Uses `Intl.DateTimeFormat` under the hood.
|
|
@@ -465,7 +465,7 @@ class tr {
|
|
|
465
465
|
* const $formatted = Dolla.i18n.dateTime(date, { dateFormat: "short" });
|
|
466
466
|
*/
|
|
467
467
|
dateTime(e, t) {
|
|
468
|
-
return be([this.$locale, e], (r, n) =>
|
|
468
|
+
return be([this.$locale, e], (r, n) => v(this, R, it).call(this, n, t));
|
|
469
469
|
}
|
|
470
470
|
/**
|
|
471
471
|
* Returns a State containing the date formatted for the current locale. Uses `Intl.DateTimeFormat` under the hood.
|
|
@@ -477,12 +477,12 @@ class tr {
|
|
|
477
477
|
* const $formatted = Dolla.i18n.list(list, { });
|
|
478
478
|
*/
|
|
479
479
|
list(e, t) {
|
|
480
|
-
return be([this.$locale, e], (r, n) =>
|
|
480
|
+
return be([this.$locale, e], (r, n) => v(this, R, ot).call(this, n, t));
|
|
481
481
|
}
|
|
482
482
|
}
|
|
483
|
-
|
|
483
|
+
$e = new WeakMap(), I = new WeakMap(), L = new WeakMap(), Ee = new WeakMap(), ke = new WeakMap(), Se = new WeakMap(), Pe = new WeakMap(), R = new WeakSet(), xt = function(e, t, r) {
|
|
484
484
|
var l;
|
|
485
|
-
const n =
|
|
485
|
+
const n = v(this, R, Ot).call(this, t, r);
|
|
486
486
|
if (n) return n;
|
|
487
487
|
const a = s(this, L).get(e);
|
|
488
488
|
if (r.context != null && (t += "_" + r.context), r.count != null)
|
|
@@ -503,7 +503,7 @@ Ee = new WeakMap(), I = new WeakMap(), L = new WeakMap(), ke = new WeakMap(), Se
|
|
|
503
503
|
const g = ((l = r.formatOverrides) == null ? void 0 : l[f.name]) ?? [...f.formats];
|
|
504
504
|
f.name === "count" && g.length === 0 && g.push({ name: "number", options: {} });
|
|
505
505
|
for (const u of g) {
|
|
506
|
-
const y = s(this,
|
|
506
|
+
const y = s(this, ke).get(u.name);
|
|
507
507
|
if (y == null) {
|
|
508
508
|
const k = new Error(
|
|
509
509
|
`Failed to load format '${u.name}' when processing '${t}', template: ${o}`
|
|
@@ -525,8 +525,8 @@ Ee = new WeakMap(), I = new WeakMap(), L = new WeakMap(), ke = new WeakMap(), Se
|
|
|
525
525
|
return new Intl.ListFormat(this.$locale.get(), t).format(e);
|
|
526
526
|
}, // relativeTime(): State<string> {
|
|
527
527
|
// }
|
|
528
|
-
|
|
529
|
-
for (const r of s(this,
|
|
528
|
+
Ot = function(e, t) {
|
|
529
|
+
for (const r of s(this, Ee))
|
|
530
530
|
if (r[0] === e && Zt(r[1], t))
|
|
531
531
|
return r[2];
|
|
532
532
|
};
|
|
@@ -539,20 +539,20 @@ function rr(i, e) {
|
|
|
539
539
|
}
|
|
540
540
|
return r;
|
|
541
541
|
}
|
|
542
|
-
var
|
|
542
|
+
var xe, ce, U, Y, X, ue, Ye, A, Oe, _, lt, Ie;
|
|
543
543
|
class nr {
|
|
544
544
|
constructor(e) {
|
|
545
545
|
h(this, _);
|
|
546
|
-
h(this,
|
|
547
|
-
h(this,
|
|
546
|
+
h(this, xe);
|
|
547
|
+
h(this, ce);
|
|
548
548
|
// Keys ensure only the most recent callback queued with a certain key
|
|
549
549
|
// will be called, keeping DOM operations to a minimum.
|
|
550
|
-
h(this,
|
|
550
|
+
h(this, U, /* @__PURE__ */ new Map());
|
|
551
551
|
// All unkeyed writes are run on every batch.
|
|
552
|
-
h(this,
|
|
552
|
+
h(this, Y, []);
|
|
553
553
|
// All read callbacks are run before updates on every batch.
|
|
554
|
-
h(this,
|
|
555
|
-
h(this,
|
|
554
|
+
h(this, X, []);
|
|
555
|
+
h(this, ue, !1);
|
|
556
556
|
// When true, batches that would exceed 16ms will be split and deferred to a rAF.
|
|
557
557
|
// This may not be desirable, because while it does prevent hitching it sometimes leaves
|
|
558
558
|
// the state partially rendered for a brief second and certain elements can be seen to update after the fact.
|
|
@@ -560,64 +560,66 @@ class nr {
|
|
|
560
560
|
h(this, Ye, !0);
|
|
561
561
|
h(this, A, 0);
|
|
562
562
|
h(this, Oe, new Intl.NumberFormat("en-US", { maximumFractionDigits: 2, minimumFractionDigits: 0 }));
|
|
563
|
-
|
|
563
|
+
b(this, xe, e), b(this, ce, e.createLogger("dolla/render"));
|
|
564
564
|
}
|
|
565
565
|
/**
|
|
566
566
|
* Queues a callback that runs before the next batch of writes.
|
|
567
567
|
*/
|
|
568
568
|
read(e) {
|
|
569
|
-
s(this,
|
|
569
|
+
s(this, X).push(e), v(this, _, lt).call(this);
|
|
570
570
|
}
|
|
571
571
|
/**
|
|
572
572
|
* Queues a callback to run in the next render batch.
|
|
573
573
|
* Always put DOM mutations in a write callback when possible to help Dolla batch them efficiently.
|
|
574
574
|
*/
|
|
575
575
|
write(e, t) {
|
|
576
|
-
|
|
576
|
+
t ? s(this, U).set(t, e) : s(this, Y).push(e), v(this, _, lt).call(this);
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
b(this,
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
579
|
+
xe = new WeakMap(), ce = new WeakMap(), U = new WeakMap(), Y = new WeakMap(), X = new WeakMap(), ue = new WeakMap(), Ye = new WeakMap(), A = new WeakMap(), Oe = new WeakMap(), _ = new WeakSet(), lt = function() {
|
|
580
|
+
if (!s(this, ue)) {
|
|
581
|
+
b(this, ue, !0);
|
|
582
|
+
const e = s(this, xe).getEnv() === "development";
|
|
583
|
+
queueMicrotask(() => {
|
|
584
|
+
v(this, _, Ie).call(this, e);
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
}, Ie = function(e = !1) {
|
|
586
588
|
const t = performance.now();
|
|
587
589
|
let r = 0;
|
|
588
|
-
const n = s(this,
|
|
590
|
+
const n = s(this, X).length + s(this, U).size + s(this, Y).length;
|
|
589
591
|
let a = 0;
|
|
590
|
-
const o = () => (a++, r = performance.now() - t, s(this, Ye) && r > 12 && a < n ? (et(this, A)._++, e && s(this,
|
|
592
|
+
const o = () => (a++, r = performance.now() - t, s(this, Ye) && r > 12 && a < n ? (et(this, A)._++, e && s(this, ce).warn(
|
|
591
593
|
`⚠️ Deferring batch to next frame. Performed ${a} of ${n} batched operation${a === 1 ? "" : "s"} in ${s(this, Oe).format(r)}ms (deferral ${s(this, A)}).`
|
|
592
594
|
), requestAnimationFrame(() => {
|
|
593
|
-
|
|
594
|
-
}), !0) : !1), p = [...s(this,
|
|
595
|
+
v(this, _, Ie).call(this, e);
|
|
596
|
+
}), !0) : !1), p = [...s(this, U).entries()];
|
|
595
597
|
let l;
|
|
596
|
-
for (; l = s(this,
|
|
598
|
+
for (; l = s(this, X).shift(); )
|
|
597
599
|
if (l(), o()) return;
|
|
598
600
|
for (const [f, m] of p)
|
|
599
|
-
if (m(), s(this,
|
|
600
|
-
for (; l = s(this,
|
|
601
|
+
if (m(), s(this, U).delete(f), o()) return;
|
|
602
|
+
for (; l = s(this, Y).shift(); )
|
|
601
603
|
if (l(), o()) return;
|
|
602
|
-
e && s(this,
|
|
604
|
+
e && s(this, ce)[r > 16 ? "warn" : "info"](
|
|
603
605
|
`${r > 16 ? "⚠️ (>=16ms) " : ""}Executed ${a} operation${a === 1 ? "" : "s"} in ${s(this, Oe).format(r)}ms${s(this, A) > 0 ? ` (after ${s(this, A)} deferral${s(this, A) === 1 ? "" : "s"})` : ""}.`
|
|
604
|
-
),
|
|
605
|
-
|
|
606
|
-
}) :
|
|
606
|
+
), b(this, A, 0), s(this, X).length || s(this, U).size || s(this, Y).length ? queueMicrotask(() => {
|
|
607
|
+
v(this, _, Ie).call(this, e);
|
|
608
|
+
}) : b(this, ue, !1);
|
|
607
609
|
};
|
|
608
|
-
function
|
|
609
|
-
return
|
|
610
|
+
function pe() {
|
|
611
|
+
return pe = Object.assign ? Object.assign.bind() : function(i) {
|
|
610
612
|
for (var e = 1; e < arguments.length; e++) {
|
|
611
613
|
var t = arguments[e];
|
|
612
614
|
for (var r in t) ({}).hasOwnProperty.call(t, r) && (i[r] = t[r]);
|
|
613
615
|
}
|
|
614
616
|
return i;
|
|
615
|
-
},
|
|
617
|
+
}, pe.apply(null, arguments);
|
|
616
618
|
}
|
|
617
|
-
var
|
|
619
|
+
var M;
|
|
618
620
|
(function(i) {
|
|
619
621
|
i.Pop = "POP", i.Push = "PUSH", i.Replace = "REPLACE";
|
|
620
|
-
})(
|
|
622
|
+
})(M || (M = {}));
|
|
621
623
|
var Be = process.env.NODE_ENV !== "production" ? function(i) {
|
|
622
624
|
return Object.freeze(i);
|
|
623
625
|
} : function(i) {
|
|
@@ -632,7 +634,7 @@ function Ue(i, e) {
|
|
|
632
634
|
}
|
|
633
635
|
}
|
|
634
636
|
}
|
|
635
|
-
var Ge = "beforeunload", ar = "hashchange",
|
|
637
|
+
var Ge = "beforeunload", ar = "hashchange", Lt = "popstate";
|
|
636
638
|
function sr(i) {
|
|
637
639
|
i === void 0 && (i = {});
|
|
638
640
|
var e = i, t = e.window, r = t === void 0 ? document.defaultView : t, n = r.history;
|
|
@@ -651,7 +653,7 @@ function sr(i) {
|
|
|
651
653
|
if (o)
|
|
652
654
|
y.call(o), o = null;
|
|
653
655
|
else {
|
|
654
|
-
var w =
|
|
656
|
+
var w = M.Pop, c = a(), d = c[0], $ = c[1];
|
|
655
657
|
if (y.length)
|
|
656
658
|
if (d != null) {
|
|
657
659
|
var E = m - d;
|
|
@@ -671,42 +673,42 @@ function sr(i) {
|
|
|
671
673
|
"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation."
|
|
672
674
|
);
|
|
673
675
|
else
|
|
674
|
-
|
|
676
|
+
ae(w);
|
|
675
677
|
}
|
|
676
678
|
}
|
|
677
|
-
r.addEventListener(
|
|
678
|
-
var l =
|
|
679
|
-
m == null && (m = 0, n.replaceState(
|
|
679
|
+
r.addEventListener(Lt, p);
|
|
680
|
+
var l = M.Pop, f = a(), m = f[0], g = f[1], u = Ke(), y = Ke();
|
|
681
|
+
m == null && (m = 0, n.replaceState(pe({}, n.state, {
|
|
680
682
|
idx: m
|
|
681
683
|
}), ""));
|
|
682
684
|
function k(w) {
|
|
683
685
|
return typeof w == "string" ? w : He(w);
|
|
684
686
|
}
|
|
685
|
-
function
|
|
686
|
-
return c === void 0 && (c = null), Be(
|
|
687
|
+
function me(w, c) {
|
|
688
|
+
return c === void 0 && (c = null), Be(pe({
|
|
687
689
|
pathname: g.pathname,
|
|
688
690
|
hash: "",
|
|
689
691
|
search: ""
|
|
690
692
|
}, typeof w == "string" ? ct(w) : w, {
|
|
691
693
|
state: c,
|
|
692
|
-
key:
|
|
694
|
+
key: Rt()
|
|
693
695
|
}));
|
|
694
696
|
}
|
|
695
|
-
function
|
|
697
|
+
function ge(w, c) {
|
|
696
698
|
return [{
|
|
697
699
|
usr: w.state,
|
|
698
700
|
key: w.key,
|
|
699
701
|
idx: c
|
|
700
702
|
}, k(w)];
|
|
701
703
|
}
|
|
702
|
-
function
|
|
704
|
+
function we(w, c, d) {
|
|
703
705
|
return !y.length || (y.call({
|
|
704
706
|
action: w,
|
|
705
707
|
location: c,
|
|
706
708
|
retry: d
|
|
707
709
|
}), !1);
|
|
708
710
|
}
|
|
709
|
-
function
|
|
711
|
+
function ae(w) {
|
|
710
712
|
l = w;
|
|
711
713
|
var c = a();
|
|
712
714
|
m = c[0], g = c[1], u.call({
|
|
@@ -714,35 +716,35 @@ function sr(i) {
|
|
|
714
716
|
location: g
|
|
715
717
|
});
|
|
716
718
|
}
|
|
717
|
-
function
|
|
718
|
-
var d =
|
|
719
|
+
function se(w, c) {
|
|
720
|
+
var d = M.Push, $ = me(w, c);
|
|
719
721
|
function E() {
|
|
720
|
-
|
|
722
|
+
se(w, c);
|
|
721
723
|
}
|
|
722
|
-
if (
|
|
723
|
-
var x =
|
|
724
|
+
if (we(d, $, E)) {
|
|
725
|
+
var x = ge($, m + 1), D = x[0], T = x[1];
|
|
724
726
|
try {
|
|
725
|
-
n.pushState(D, "",
|
|
727
|
+
n.pushState(D, "", T);
|
|
726
728
|
} catch {
|
|
727
|
-
r.location.assign(
|
|
729
|
+
r.location.assign(T);
|
|
728
730
|
}
|
|
729
|
-
|
|
731
|
+
ae(d);
|
|
730
732
|
}
|
|
731
733
|
}
|
|
732
|
-
function
|
|
733
|
-
var d =
|
|
734
|
+
function ye(w, c) {
|
|
735
|
+
var d = M.Replace, $ = me(w, c);
|
|
734
736
|
function E() {
|
|
735
|
-
|
|
737
|
+
ye(w, c);
|
|
736
738
|
}
|
|
737
|
-
if (
|
|
738
|
-
var x =
|
|
739
|
-
n.replaceState(D, "",
|
|
739
|
+
if (we(d, $, E)) {
|
|
740
|
+
var x = ge($, m), D = x[0], T = x[1];
|
|
741
|
+
n.replaceState(D, "", T), ae(d);
|
|
740
742
|
}
|
|
741
743
|
}
|
|
742
744
|
function C(w) {
|
|
743
745
|
n.go(w);
|
|
744
746
|
}
|
|
745
|
-
var
|
|
747
|
+
var Q = {
|
|
746
748
|
get action() {
|
|
747
749
|
return l;
|
|
748
750
|
},
|
|
@@ -750,8 +752,8 @@ function sr(i) {
|
|
|
750
752
|
return g;
|
|
751
753
|
},
|
|
752
754
|
createHref: k,
|
|
753
|
-
push:
|
|
754
|
-
replace:
|
|
755
|
+
push: se,
|
|
756
|
+
replace: ye,
|
|
755
757
|
go: C,
|
|
756
758
|
back: function() {
|
|
757
759
|
C(-1);
|
|
@@ -769,17 +771,17 @@ function sr(i) {
|
|
|
769
771
|
};
|
|
770
772
|
}
|
|
771
773
|
};
|
|
772
|
-
return
|
|
774
|
+
return Q;
|
|
773
775
|
}
|
|
774
776
|
function ir(i) {
|
|
775
777
|
i === void 0 && (i = {});
|
|
776
778
|
var e = i, t = e.window, r = t === void 0 ? document.defaultView : t, n = r.history;
|
|
777
779
|
function a() {
|
|
778
|
-
var c = ct(r.location.hash.substr(1)), d = c.pathname, $ = d === void 0 ? "/" : d, E = c.search, x = E === void 0 ? "" : E, D = c.hash,
|
|
780
|
+
var c = ct(r.location.hash.substr(1)), d = c.pathname, $ = d === void 0 ? "/" : d, E = c.search, x = E === void 0 ? "" : E, D = c.hash, T = D === void 0 ? "" : D, q = n.state || {};
|
|
779
781
|
return [q.idx, Be({
|
|
780
782
|
pathname: $,
|
|
781
783
|
search: x,
|
|
782
|
-
hash:
|
|
784
|
+
hash: T,
|
|
783
785
|
state: q.usr || null,
|
|
784
786
|
key: q.key || "default"
|
|
785
787
|
})];
|
|
@@ -789,7 +791,7 @@ function ir(i) {
|
|
|
789
791
|
if (o)
|
|
790
792
|
y.call(o), o = null;
|
|
791
793
|
else {
|
|
792
|
-
var c =
|
|
794
|
+
var c = M.Pop, d = a(), $ = d[0], E = d[1];
|
|
793
795
|
if (y.length)
|
|
794
796
|
if ($ != null) {
|
|
795
797
|
var x = m - $;
|
|
@@ -797,9 +799,9 @@ function ir(i) {
|
|
|
797
799
|
action: c,
|
|
798
800
|
location: E,
|
|
799
801
|
retry: function() {
|
|
800
|
-
|
|
802
|
+
Q(x * -1);
|
|
801
803
|
}
|
|
802
|
-
},
|
|
804
|
+
}, Q(x));
|
|
803
805
|
} else
|
|
804
806
|
process.env.NODE_ENV !== "production" && Ue(
|
|
805
807
|
!1,
|
|
@@ -809,15 +811,15 @@ function ir(i) {
|
|
|
809
811
|
"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation."
|
|
810
812
|
);
|
|
811
813
|
else
|
|
812
|
-
|
|
814
|
+
se(c);
|
|
813
815
|
}
|
|
814
816
|
}
|
|
815
|
-
r.addEventListener(
|
|
817
|
+
r.addEventListener(Lt, p), r.addEventListener(ar, function() {
|
|
816
818
|
var c = a(), d = c[1];
|
|
817
819
|
He(d) !== He(g) && p();
|
|
818
820
|
});
|
|
819
|
-
var l =
|
|
820
|
-
m == null && (m = 0, n.replaceState(
|
|
821
|
+
var l = M.Pop, f = a(), m = f[0], g = f[1], u = Ke(), y = Ke();
|
|
822
|
+
m == null && (m = 0, n.replaceState(pe({}, n.state, {
|
|
821
823
|
idx: m
|
|
822
824
|
}), ""));
|
|
823
825
|
function k() {
|
|
@@ -828,34 +830,34 @@ function ir(i) {
|
|
|
828
830
|
}
|
|
829
831
|
return d;
|
|
830
832
|
}
|
|
831
|
-
function
|
|
833
|
+
function me(c) {
|
|
832
834
|
return k() + "#" + (typeof c == "string" ? c : He(c));
|
|
833
835
|
}
|
|
834
|
-
function
|
|
835
|
-
return d === void 0 && (d = null), Be(
|
|
836
|
+
function ge(c, d) {
|
|
837
|
+
return d === void 0 && (d = null), Be(pe({
|
|
836
838
|
pathname: g.pathname,
|
|
837
839
|
hash: "",
|
|
838
840
|
search: ""
|
|
839
841
|
}, typeof c == "string" ? ct(c) : c, {
|
|
840
842
|
state: d,
|
|
841
|
-
key:
|
|
843
|
+
key: Rt()
|
|
842
844
|
}));
|
|
843
845
|
}
|
|
844
|
-
function
|
|
846
|
+
function we(c, d) {
|
|
845
847
|
return [{
|
|
846
848
|
usr: c.state,
|
|
847
849
|
key: c.key,
|
|
848
850
|
idx: d
|
|
849
|
-
},
|
|
851
|
+
}, me(c)];
|
|
850
852
|
}
|
|
851
|
-
function
|
|
853
|
+
function ae(c, d, $) {
|
|
852
854
|
return !y.length || (y.call({
|
|
853
855
|
action: c,
|
|
854
856
|
location: d,
|
|
855
857
|
retry: $
|
|
856
858
|
}), !1);
|
|
857
859
|
}
|
|
858
|
-
function
|
|
860
|
+
function se(c) {
|
|
859
861
|
l = c;
|
|
860
862
|
var d = a();
|
|
861
863
|
m = d[0], g = d[1], u.call({
|
|
@@ -863,32 +865,32 @@ function ir(i) {
|
|
|
863
865
|
location: g
|
|
864
866
|
});
|
|
865
867
|
}
|
|
866
|
-
function
|
|
867
|
-
var $ =
|
|
868
|
+
function ye(c, d) {
|
|
869
|
+
var $ = M.Push, E = ge(c, d);
|
|
868
870
|
function x() {
|
|
869
|
-
|
|
871
|
+
ye(c, d);
|
|
870
872
|
}
|
|
871
|
-
if (process.env.NODE_ENV !== "production" && Ue(E.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.push(" + JSON.stringify(c) + ")"),
|
|
872
|
-
var D =
|
|
873
|
+
if (process.env.NODE_ENV !== "production" && Ue(E.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.push(" + JSON.stringify(c) + ")"), ae($, E, x)) {
|
|
874
|
+
var D = we(E, m + 1), T = D[0], q = D[1];
|
|
873
875
|
try {
|
|
874
|
-
n.pushState(
|
|
876
|
+
n.pushState(T, "", q);
|
|
875
877
|
} catch {
|
|
876
878
|
r.location.assign(q);
|
|
877
879
|
}
|
|
878
|
-
|
|
880
|
+
se($);
|
|
879
881
|
}
|
|
880
882
|
}
|
|
881
883
|
function C(c, d) {
|
|
882
|
-
var $ =
|
|
884
|
+
var $ = M.Replace, E = ge(c, d);
|
|
883
885
|
function x() {
|
|
884
886
|
C(c, d);
|
|
885
887
|
}
|
|
886
|
-
if (process.env.NODE_ENV !== "production" && Ue(E.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.replace(" + JSON.stringify(c) + ")"),
|
|
887
|
-
var D =
|
|
888
|
-
n.replaceState(
|
|
888
|
+
if (process.env.NODE_ENV !== "production" && Ue(E.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.replace(" + JSON.stringify(c) + ")"), ae($, E, x)) {
|
|
889
|
+
var D = we(E, m), T = D[0], q = D[1];
|
|
890
|
+
n.replaceState(T, "", q), se($);
|
|
889
891
|
}
|
|
890
892
|
}
|
|
891
|
-
function
|
|
893
|
+
function Q(c) {
|
|
892
894
|
n.go(c);
|
|
893
895
|
}
|
|
894
896
|
var w = {
|
|
@@ -898,15 +900,15 @@ function ir(i) {
|
|
|
898
900
|
get location() {
|
|
899
901
|
return g;
|
|
900
902
|
},
|
|
901
|
-
createHref:
|
|
902
|
-
push:
|
|
903
|
+
createHref: me,
|
|
904
|
+
push: ye,
|
|
903
905
|
replace: C,
|
|
904
|
-
go:
|
|
906
|
+
go: Q,
|
|
905
907
|
back: function() {
|
|
906
|
-
|
|
908
|
+
Q(-1);
|
|
907
909
|
},
|
|
908
910
|
forward: function() {
|
|
909
|
-
|
|
911
|
+
Q(1);
|
|
910
912
|
},
|
|
911
913
|
listen: function(d) {
|
|
912
914
|
return u.push(d);
|
|
@@ -943,7 +945,7 @@ function Ke() {
|
|
|
943
945
|
}
|
|
944
946
|
};
|
|
945
947
|
}
|
|
946
|
-
function
|
|
948
|
+
function Rt() {
|
|
947
949
|
return Math.random().toString(36).substr(2, 8);
|
|
948
950
|
}
|
|
949
951
|
function He(i) {
|
|
@@ -960,12 +962,12 @@ function ct(i) {
|
|
|
960
962
|
}
|
|
961
963
|
return e;
|
|
962
964
|
}
|
|
963
|
-
function
|
|
964
|
-
return
|
|
965
|
+
function ve(i) {
|
|
966
|
+
return kt(i, "Expected `path` to be a string. Got type: %t, value: %v"), i.split("/").map((e) => e.trim()).filter((e) => e !== "");
|
|
965
967
|
}
|
|
966
|
-
function
|
|
968
|
+
function ie(i) {
|
|
967
969
|
var t;
|
|
968
|
-
|
|
970
|
+
Mt(
|
|
969
971
|
(r) => dt(r == null ? void 0 : r.toString),
|
|
970
972
|
i,
|
|
971
973
|
"Expected `parts` to be an array of objects with a .toString() method. Got type: %t, value: %v"
|
|
@@ -979,7 +981,7 @@ function le(i) {
|
|
|
979
981
|
return e ?? "";
|
|
980
982
|
}
|
|
981
983
|
function We(i, e) {
|
|
982
|
-
if (
|
|
984
|
+
if (kt(i, "Expected `base` to be a string. Got type: %t, value: %v"), e == null && (e = i, i = ""), e.startsWith("/"))
|
|
983
985
|
return e;
|
|
984
986
|
let t = i;
|
|
985
987
|
for (; ; )
|
|
@@ -993,7 +995,7 @@ function We(i, e) {
|
|
|
993
995
|
e = e.replace(/^\.\/?/, "");
|
|
994
996
|
else
|
|
995
997
|
break;
|
|
996
|
-
return
|
|
998
|
+
return ie([t, e]);
|
|
997
999
|
}
|
|
998
1000
|
function ut(i) {
|
|
999
1001
|
if (!i) return {};
|
|
@@ -1004,9 +1006,9 @@ function ut(i) {
|
|
|
1004
1006
|
});
|
|
1005
1007
|
return Object.fromEntries(e);
|
|
1006
1008
|
}
|
|
1007
|
-
function
|
|
1009
|
+
function vt(i, e, t = {}) {
|
|
1008
1010
|
var o;
|
|
1009
|
-
const [r, n] = e.split("?"), a =
|
|
1011
|
+
const [r, n] = e.split("?"), a = ve(r);
|
|
1010
1012
|
e: for (const p of i) {
|
|
1011
1013
|
const { fragments: l } = p;
|
|
1012
1014
|
if (!(((o = l[l.length - 1]) == null ? void 0 : o.type) === 3) && l.length !== a.length || t.willMatch && !t.willMatch(p))
|
|
@@ -1069,7 +1071,7 @@ function or(i) {
|
|
|
1069
1071
|
return e.sort(a), t.sort(a), r.sort(a), n.sort(a), [...e, ...t, ...r, ...n];
|
|
1070
1072
|
}
|
|
1071
1073
|
function lr(i) {
|
|
1072
|
-
const e =
|
|
1074
|
+
const e = ve(i), t = [];
|
|
1073
1075
|
for (let r = 0; r < e.length; r++) {
|
|
1074
1076
|
const n = e[r];
|
|
1075
1077
|
if (n === "*") {
|
|
@@ -1092,7 +1094,7 @@ function lr(i) {
|
|
|
1092
1094
|
}
|
|
1093
1095
|
return t;
|
|
1094
1096
|
}
|
|
1095
|
-
const
|
|
1097
|
+
const $t = (i, e) => {
|
|
1096
1098
|
if (Object.keys(i).length !== Object.keys(e).length)
|
|
1097
1099
|
return !1;
|
|
1098
1100
|
for (const t in i)
|
|
@@ -1100,47 +1102,47 @@ const Et = (i, e) => {
|
|
|
1100
1102
|
return !1;
|
|
1101
1103
|
return !0;
|
|
1102
1104
|
};
|
|
1103
|
-
var Le, N,
|
|
1105
|
+
var Le, N, Z, Re, S, Xe, H, De, ee, te, he, fe, de, Ne, K, ht, ft;
|
|
1104
1106
|
class cr {
|
|
1105
1107
|
constructor(e, t) {
|
|
1106
|
-
h(this,
|
|
1108
|
+
h(this, K);
|
|
1107
1109
|
h(this, Le);
|
|
1108
1110
|
h(this, N);
|
|
1109
|
-
h(this,
|
|
1111
|
+
h(this, Z);
|
|
1110
1112
|
h(this, Re, nt());
|
|
1111
1113
|
h(this, S);
|
|
1112
1114
|
h(this, Xe, 0);
|
|
1113
|
-
h(this,
|
|
1115
|
+
h(this, H, []);
|
|
1114
1116
|
h(this, De);
|
|
1115
|
-
h(this,
|
|
1117
|
+
h(this, ee, []);
|
|
1116
1118
|
// Callbacks that need to be called on unmount.
|
|
1117
|
-
h(this,
|
|
1119
|
+
h(this, te, []);
|
|
1118
1120
|
/**
|
|
1119
1121
|
* The currently matched route pattern, if any.
|
|
1120
1122
|
*/
|
|
1121
1123
|
P(this, "$pattern");
|
|
1122
|
-
h(this,
|
|
1124
|
+
h(this, he);
|
|
1123
1125
|
/**
|
|
1124
1126
|
* The current URL path.
|
|
1125
1127
|
*/
|
|
1126
1128
|
P(this, "$path");
|
|
1127
|
-
h(this,
|
|
1129
|
+
h(this, fe);
|
|
1128
1130
|
/**
|
|
1129
1131
|
* The current named path params.
|
|
1130
1132
|
*/
|
|
1131
1133
|
P(this, "$params");
|
|
1132
|
-
h(this,
|
|
1134
|
+
h(this, de);
|
|
1133
1135
|
/**
|
|
1134
1136
|
* The current query params. Changes to this object will be reflected in the URL.
|
|
1135
1137
|
*/
|
|
1136
1138
|
P(this, "$query");
|
|
1137
1139
|
h(this, Ne);
|
|
1138
|
-
|
|
1139
|
-
const [r, n] =
|
|
1140
|
+
b(this, Le, e), b(this, N, e.createLogger("dolla/router")), b(this, Z, t);
|
|
1141
|
+
const [r, n] = oe(null), [a, o] = oe(""), [p, l] = oe({}, { equals: $t }), [f, m] = oe(
|
|
1140
1142
|
ut(typeof window > "u" ? "" : window.location.search ?? ""),
|
|
1141
|
-
{ equals:
|
|
1143
|
+
{ equals: $t }
|
|
1142
1144
|
);
|
|
1143
|
-
this.$pattern = r,
|
|
1145
|
+
this.$pattern = r, b(this, he, n), this.$path = a, b(this, fe, o), this.$params = p, b(this, de, l), this.$query = f, b(this, Ne, m), e.beforeMount(() => {
|
|
1144
1146
|
s(this, S) != null && (s(this, Re).watch([f], (g) => {
|
|
1145
1147
|
const u = new URLSearchParams();
|
|
1146
1148
|
for (const k in g)
|
|
@@ -1150,15 +1152,15 @@ class cr {
|
|
|
1150
1152
|
pathname: s(this, S).location.pathname,
|
|
1151
1153
|
search: y
|
|
1152
1154
|
});
|
|
1153
|
-
}), s(this,
|
|
1154
|
-
fr(s(this,
|
|
1155
|
+
}), s(this, te).push(s(this, S).listen(v(this, K, ft).bind(this))), v(this, K, ft).call(this, s(this, S)), s(this, te).push(
|
|
1156
|
+
fr(s(this, Z).rootElement, (g) => {
|
|
1155
1157
|
let u = g.getAttribute("href");
|
|
1156
|
-
s(this, N).info("Intercepted link click", g, u), /^https?:\/\/|^\//.test(u) || (u =
|
|
1158
|
+
s(this, N).info("Intercepted link click", g, u), /^https?:\/\/|^\//.test(u) || (u = ie([s(this, S).location.pathname, u])), s(this, S).push(u);
|
|
1157
1159
|
})
|
|
1158
|
-
), s(this, N).info("Intercepting <a> clicks within root element:", s(this,
|
|
1160
|
+
), s(this, N).info("Intercepting <a> clicks within root element:", s(this, Z).rootElement));
|
|
1159
1161
|
}), e.onUnmount(() => {
|
|
1160
|
-
for (; s(this,
|
|
1161
|
-
s(this,
|
|
1162
|
+
for (; s(this, te).length > 0; )
|
|
1163
|
+
s(this, te).pop()();
|
|
1162
1164
|
s(this, Re).stopAll();
|
|
1163
1165
|
});
|
|
1164
1166
|
}
|
|
@@ -1169,18 +1171,18 @@ class cr {
|
|
|
1169
1171
|
);
|
|
1170
1172
|
return;
|
|
1171
1173
|
}
|
|
1172
|
-
e.style === "hash" ?
|
|
1173
|
-
e.routes.flatMap((t) =>
|
|
1174
|
+
e.style === "hash" ? b(this, S, ir()) : b(this, S, sr()), b(this, ee, or(
|
|
1175
|
+
e.routes.flatMap((t) => v(this, K, ht).call(this, t)).map((t) => ({
|
|
1174
1176
|
pattern: t.pattern,
|
|
1175
1177
|
meta: t.meta,
|
|
1176
1178
|
fragments: lr(t.pattern)
|
|
1177
1179
|
}))
|
|
1178
1180
|
));
|
|
1179
|
-
for (const t of s(this,
|
|
1181
|
+
for (const t of s(this, ee))
|
|
1180
1182
|
if (t.meta.redirect) {
|
|
1181
1183
|
let r;
|
|
1182
1184
|
if (!dt(t.meta.redirect)) if (V(t.meta.redirect)) {
|
|
1183
|
-
if (r = t.meta.redirect,
|
|
1185
|
+
if (r = t.meta.redirect, !vt(s(this, ee), r, {
|
|
1184
1186
|
willMatch(a) {
|
|
1185
1187
|
return a !== t;
|
|
1186
1188
|
}
|
|
@@ -1209,7 +1211,7 @@ class cr {
|
|
|
1209
1211
|
return;
|
|
1210
1212
|
}
|
|
1211
1213
|
let r;
|
|
1212
|
-
Array.isArray(e) ? r =
|
|
1214
|
+
Array.isArray(e) ? r = ie(e) : r = e.toString(), r = We(s(this, S).location.pathname, r), t.preserveQuery && (r += s(this, S).location.search), t.replace ? s(this, S).replace(r) : s(this, S).push(r);
|
|
1213
1215
|
}
|
|
1214
1216
|
/**
|
|
1215
1217
|
* Navigate backward. Pass a number of steps to hit the back button that many times.
|
|
@@ -1240,7 +1242,7 @@ class cr {
|
|
|
1240
1242
|
s(this, S).go(e);
|
|
1241
1243
|
}
|
|
1242
1244
|
}
|
|
1243
|
-
Le = new WeakMap(), N = new WeakMap(),
|
|
1245
|
+
Le = new WeakMap(), N = new WeakMap(), Z = new WeakMap(), Re = new WeakMap(), S = new WeakMap(), Xe = new WeakMap(), H = new WeakMap(), De = new WeakMap(), ee = new WeakMap(), te = new WeakMap(), he = new WeakMap(), fe = new WeakMap(), de = new WeakMap(), Ne = new WeakMap(), K = new WeakSet(), /**
|
|
1244
1246
|
* Parses a route definition object into a set of matchable routes.
|
|
1245
1247
|
*
|
|
1246
1248
|
* @param route - Route config object.
|
|
@@ -1257,19 +1259,19 @@ ht = function(e, t = [], r = []) {
|
|
|
1257
1259
|
throw new Error("Route must have a 'view', a 'redirect', or a set of nested 'routes'.");
|
|
1258
1260
|
let n = [];
|
|
1259
1261
|
for (const l of t)
|
|
1260
|
-
n.push(
|
|
1261
|
-
n.push(
|
|
1262
|
+
n.push(...ve(l.path));
|
|
1263
|
+
n.push(...ve(e.path)), n[n.length - 1] === "*" && n.pop();
|
|
1262
1264
|
const a = [];
|
|
1263
1265
|
if (e.redirect) {
|
|
1264
1266
|
let l = e.redirect;
|
|
1265
|
-
return V(l) && (l = We(
|
|
1266
|
-
pattern: "/" +
|
|
1267
|
+
return V(l) && (l = We(ie(n), l), l.startsWith("/") || (l = "/" + l)), a.push({
|
|
1268
|
+
pattern: "/" + ie([...n, ...ve(e.path)]),
|
|
1267
1269
|
meta: {
|
|
1268
1270
|
redirect: l
|
|
1269
1271
|
}
|
|
1270
1272
|
}), a;
|
|
1271
1273
|
}
|
|
1272
|
-
let o =
|
|
1274
|
+
let o = St;
|
|
1273
1275
|
if (typeof e.view == "function")
|
|
1274
1276
|
o = e.view;
|
|
1275
1277
|
else if (e.view)
|
|
@@ -1277,10 +1279,10 @@ ht = function(e, t = [], r = []) {
|
|
|
1277
1279
|
const p = { id: et(this, Xe)._++, view: o };
|
|
1278
1280
|
if (e.routes)
|
|
1279
1281
|
for (const l of e.routes)
|
|
1280
|
-
a.push(...
|
|
1282
|
+
a.push(...v(this, K, ht).call(this, l, [...t, e], [...r, p]));
|
|
1281
1283
|
else
|
|
1282
1284
|
a.push({
|
|
1283
|
-
pattern: parent ?
|
|
1285
|
+
pattern: parent ? ie([...t.map((l) => l.path), e.path]) : e.path,
|
|
1284
1286
|
meta: {
|
|
1285
1287
|
pattern: e.path,
|
|
1286
1288
|
layers: [...r, p],
|
|
@@ -1289,10 +1291,10 @@ ht = function(e, t = [], r = []) {
|
|
|
1289
1291
|
});
|
|
1290
1292
|
return a;
|
|
1291
1293
|
}, ft = async function({ location: e }) {
|
|
1292
|
-
e.search !== s(this, De) && (
|
|
1293
|
-
const t =
|
|
1294
|
+
e.search !== s(this, De) && (b(this, De, e.search), s(this, Ne).call(this, ut(e.search)));
|
|
1295
|
+
const t = vt(s(this, ee), e.pathname);
|
|
1294
1296
|
if (!t) {
|
|
1295
|
-
s(this,
|
|
1297
|
+
s(this, he).call(this, null), s(this, fe).call(this, e.pathname), s(this, de).call(this, {
|
|
1296
1298
|
wildcard: e.pathname
|
|
1297
1299
|
});
|
|
1298
1300
|
return;
|
|
@@ -1319,17 +1321,17 @@ ht = function(e, t = [], r = []) {
|
|
|
1319
1321
|
n.startsWith("/") || (n = We(t.path, n)), s(this, N).info(`Redirecting to: '${n}'`), s(this, S).replace(n);
|
|
1320
1322
|
} else
|
|
1321
1323
|
throw new TypeError("Redirect must either be a path string or a function.");
|
|
1322
|
-
else if (s(this, N).info(`📍 navigating to '${t.path}'`), s(this,
|
|
1323
|
-
s(this,
|
|
1324
|
+
else if (s(this, N).info(`📍 navigating to '${t.path}'`), s(this, fe).call(this, t.path), s(this, de).call(this, t.params), t.pattern !== this.$pattern.get()) {
|
|
1325
|
+
s(this, he).call(this, t.pattern);
|
|
1324
1326
|
const r = t.meta.layers;
|
|
1325
1327
|
for (let n = 0; n < r.length; n++) {
|
|
1326
|
-
const a = r[n], o = s(this,
|
|
1328
|
+
const a = r[n], o = s(this, H)[n];
|
|
1327
1329
|
if ((o == null ? void 0 : o.id) !== a.id) {
|
|
1328
|
-
|
|
1329
|
-
const p = s(this,
|
|
1330
|
+
b(this, H, s(this, H).slice(0, n));
|
|
1331
|
+
const p = s(this, H).at(-1);
|
|
1330
1332
|
o && o.node.isMounted && o.node.unmount(!1);
|
|
1331
1333
|
let l;
|
|
1332
|
-
p ? l = p.node.setChildView(a.view) : l = s(this,
|
|
1334
|
+
p ? l = p.node.setChildView(a.view) : l = s(this, Z).rootView.setChildView(a.view), s(this, H).push({ id: a.id, node: l });
|
|
1333
1335
|
}
|
|
1334
1336
|
}
|
|
1335
1337
|
}
|
|
@@ -1356,24 +1358,24 @@ function dr(i, e) {
|
|
|
1356
1358
|
}
|
|
1357
1359
|
return i;
|
|
1358
1360
|
}
|
|
1359
|
-
var
|
|
1361
|
+
var W, je, B, re, Te, Me, qe, Fe, Ae, _e, G, O, z;
|
|
1360
1362
|
class pr {
|
|
1361
1363
|
constructor() {
|
|
1362
1364
|
P(this, "http");
|
|
1363
1365
|
P(this, "i18n");
|
|
1364
1366
|
P(this, "render");
|
|
1365
1367
|
P(this, "router");
|
|
1366
|
-
h(this,
|
|
1367
|
-
h(this,
|
|
1368
|
-
h(this,
|
|
1369
|
-
h(this,
|
|
1370
|
-
h(this,
|
|
1371
|
-
h(this,
|
|
1368
|
+
h(this, W, !1);
|
|
1369
|
+
h(this, je, "production");
|
|
1370
|
+
h(this, B);
|
|
1371
|
+
h(this, re);
|
|
1372
|
+
h(this, Te, Gt);
|
|
1373
|
+
h(this, Me, nt());
|
|
1372
1374
|
h(this, qe, []);
|
|
1373
1375
|
h(this, Fe, []);
|
|
1374
1376
|
h(this, Ae, []);
|
|
1375
1377
|
h(this, _e, []);
|
|
1376
|
-
h(this,
|
|
1378
|
+
h(this, G, {
|
|
1377
1379
|
root: this,
|
|
1378
1380
|
data: {}
|
|
1379
1381
|
});
|
|
@@ -1383,24 +1385,24 @@ class pr {
|
|
|
1383
1385
|
warn: "development",
|
|
1384
1386
|
error: !0
|
|
1385
1387
|
});
|
|
1386
|
-
h(this,
|
|
1387
|
-
P(this, "watch", s(this,
|
|
1388
|
-
P(this, "createState",
|
|
1389
|
-
P(this, "createSettableState",
|
|
1390
|
-
P(this, "toSettableState",
|
|
1391
|
-
P(this, "toState",
|
|
1392
|
-
P(this, "valueOf",
|
|
1388
|
+
h(this, z, wt("*,-dolla/*"));
|
|
1389
|
+
P(this, "watch", s(this, Me).watch);
|
|
1390
|
+
P(this, "createState", oe);
|
|
1391
|
+
P(this, "createSettableState", qt);
|
|
1392
|
+
P(this, "toSettableState", Ft);
|
|
1393
|
+
P(this, "toState", At);
|
|
1394
|
+
P(this, "valueOf", _t);
|
|
1393
1395
|
P(this, "derive", be);
|
|
1394
1396
|
P(this, "createWatcher", nt);
|
|
1395
|
-
P(this, "createRef",
|
|
1396
|
-
P(this, "isRef",
|
|
1397
|
+
P(this, "createRef", Ct);
|
|
1398
|
+
P(this, "isRef", Vt);
|
|
1397
1399
|
const e = this;
|
|
1398
1400
|
this.http = new zt(), this.i18n = new tr(this), this.render = new nr(this), this.router = new cr(this, {
|
|
1399
1401
|
get rootElement() {
|
|
1400
|
-
return s(e,
|
|
1402
|
+
return s(e, B);
|
|
1401
1403
|
},
|
|
1402
1404
|
get rootView() {
|
|
1403
|
-
return s(e,
|
|
1405
|
+
return s(e, re);
|
|
1404
1406
|
}
|
|
1405
1407
|
});
|
|
1406
1408
|
}
|
|
@@ -1408,64 +1410,64 @@ class pr {
|
|
|
1408
1410
|
* True when the app is connected to a DOM node and displayed to the user.
|
|
1409
1411
|
*/
|
|
1410
1412
|
get isMounted() {
|
|
1411
|
-
return s(this,
|
|
1413
|
+
return s(this, W);
|
|
1412
1414
|
}
|
|
1413
1415
|
/**
|
|
1414
1416
|
* Get the current environment that this app is running in.
|
|
1415
1417
|
* Environment affects which log messages will print and how much debugging info is included in the DOM.
|
|
1416
1418
|
*/
|
|
1417
1419
|
getEnv() {
|
|
1418
|
-
return s(this,
|
|
1420
|
+
return s(this, je);
|
|
1419
1421
|
}
|
|
1420
1422
|
/**
|
|
1421
1423
|
* Sets the environment that this app is running in.
|
|
1422
1424
|
* Environment affects which log messages will print and how much debugging info is included in the DOM.
|
|
1423
1425
|
*/
|
|
1424
1426
|
setEnv(e) {
|
|
1425
|
-
|
|
1427
|
+
b(this, je, e);
|
|
1426
1428
|
}
|
|
1427
1429
|
/**
|
|
1428
1430
|
* Sets the view that will be shown when the `crash` method is called on any logger.
|
|
1429
1431
|
* When a crash is reported the app will be unmounted and replaced with this crash page.
|
|
1430
1432
|
*/
|
|
1431
1433
|
setCrashView(e) {
|
|
1432
|
-
|
|
1434
|
+
b(this, Te, e);
|
|
1433
1435
|
}
|
|
1434
1436
|
/**
|
|
1435
1437
|
* Sets a context variable and returns its value. Context variables are accessible on the app and in child views.
|
|
1436
1438
|
*/
|
|
1437
1439
|
set(e, t) {
|
|
1438
|
-
return s(this,
|
|
1440
|
+
return s(this, G).data[e] = t, t;
|
|
1439
1441
|
}
|
|
1440
1442
|
/**
|
|
1441
1443
|
* Gets the value of a context variable. Returns null if the variable is not set.
|
|
1442
1444
|
*/
|
|
1443
1445
|
get(e) {
|
|
1444
|
-
return s(this,
|
|
1446
|
+
return s(this, G).data[e] ?? null;
|
|
1445
1447
|
}
|
|
1446
1448
|
/**
|
|
1447
1449
|
* Returns an object of all context variables stored at the app level.
|
|
1448
1450
|
*/
|
|
1449
1451
|
getAll() {
|
|
1450
|
-
return { ...s(this,
|
|
1452
|
+
return { ...s(this, G).data };
|
|
1451
1453
|
}
|
|
1452
1454
|
async mount(e, t) {
|
|
1453
|
-
if (s(this,
|
|
1455
|
+
if (s(this, W))
|
|
1454
1456
|
throw new Error("Dolla is already mounted.");
|
|
1455
1457
|
if (V(e)) {
|
|
1456
1458
|
const n = document.querySelector(e);
|
|
1457
|
-
yt(HTMLElement, n, `Selector '${e}' did not match any element.`),
|
|
1459
|
+
yt(HTMLElement, n, `Selector '${e}' did not match any element.`), b(this, B, n);
|
|
1458
1460
|
} else
|
|
1459
|
-
yt(HTMLElement, e, "Expected an HTML element or a selector string. Got type: %t, value: %v"),
|
|
1460
|
-
|
|
1461
|
-
|
|
1461
|
+
yt(HTMLElement, e, "Expected an HTML element or a selector string. Got type: %t, value: %v"), b(this, B, e);
|
|
1462
|
+
const r = It(t ?? St);
|
|
1463
|
+
b(this, re, this.constructView(r.type, r.props)), await Promise.all(s(this, qe).map((n) => n())), s(this, re).mount(s(this, B)), b(this, W, !0);
|
|
1462
1464
|
for (const n of s(this, Fe))
|
|
1463
1465
|
n();
|
|
1464
1466
|
}
|
|
1465
1467
|
async unmount() {
|
|
1466
1468
|
var e;
|
|
1467
|
-
if (s(this,
|
|
1468
|
-
await Promise.all(s(this, Ae).map((t) => t())), (e = s(this,
|
|
1469
|
+
if (s(this, W)) {
|
|
1470
|
+
await Promise.all(s(this, Ae).map((t) => t())), (e = s(this, re)) == null || e.unmount(!1), s(this, Me).stopAll(), b(this, W, !1);
|
|
1469
1471
|
for (const t of s(this, _e))
|
|
1470
1472
|
t();
|
|
1471
1473
|
}
|
|
@@ -1506,7 +1508,7 @@ class pr {
|
|
|
1506
1508
|
}
|
|
1507
1509
|
}
|
|
1508
1510
|
setLogFilter(e) {
|
|
1509
|
-
|
|
1511
|
+
b(this, z, wt(e));
|
|
1510
1512
|
}
|
|
1511
1513
|
createLogger(e, t) {
|
|
1512
1514
|
const r = (t == null ? void 0 : t.console) ?? Ut(), n = this;
|
|
@@ -1516,7 +1518,7 @@ class pr {
|
|
|
1516
1518
|
},
|
|
1517
1519
|
get info() {
|
|
1518
1520
|
var a;
|
|
1519
|
-
if (s(n, O).info === !1 || V(s(n, O).info) && s(n, O).info !== n.getEnv() || !s(a = n,
|
|
1521
|
+
if (s(n, O).info === !1 || V(s(n, O).info) && s(n, O).info !== n.getEnv() || !s(a = n, z).call(a, e))
|
|
1520
1522
|
return Ce;
|
|
1521
1523
|
{
|
|
1522
1524
|
let o = `%c${e}`;
|
|
@@ -1532,7 +1534,7 @@ class pr {
|
|
|
1532
1534
|
},
|
|
1533
1535
|
get log() {
|
|
1534
1536
|
var a;
|
|
1535
|
-
if (s(n, O).log === !1 || V(s(n, O).log) && s(n, O).log !== n.getEnv() || !s(a = n,
|
|
1537
|
+
if (s(n, O).log === !1 || V(s(n, O).log) && s(n, O).log !== n.getEnv() || !s(a = n, z).call(a, e))
|
|
1536
1538
|
return Ce;
|
|
1537
1539
|
{
|
|
1538
1540
|
let o = `%c${e}`;
|
|
@@ -1548,7 +1550,7 @@ class pr {
|
|
|
1548
1550
|
},
|
|
1549
1551
|
get warn() {
|
|
1550
1552
|
var a;
|
|
1551
|
-
if (s(n, O).warn === !1 || V(s(n, O).warn) && s(n, O).warn !== n.getEnv() || !s(a = n,
|
|
1553
|
+
if (s(n, O).warn === !1 || V(s(n, O).warn) && s(n, O).warn !== n.getEnv() || !s(a = n, z).call(a, e))
|
|
1552
1554
|
return Ce;
|
|
1553
1555
|
{
|
|
1554
1556
|
let o = `%c${e}`;
|
|
@@ -1564,7 +1566,7 @@ class pr {
|
|
|
1564
1566
|
},
|
|
1565
1567
|
get error() {
|
|
1566
1568
|
var a;
|
|
1567
|
-
if (s(n, O).error === !1 || V(s(n, O).error) && s(n, O).error !== n.getEnv() || !s(a = n,
|
|
1569
|
+
if (s(n, O).error === !1 || V(s(n, O).error) && s(n, O).error !== n.getEnv() || !s(a = n, z).call(a, e))
|
|
1568
1570
|
return Ce;
|
|
1569
1571
|
{
|
|
1570
1572
|
let o = `%c${e}`;
|
|
@@ -1579,11 +1581,11 @@ class pr {
|
|
|
1579
1581
|
}
|
|
1580
1582
|
},
|
|
1581
1583
|
crash(a) {
|
|
1582
|
-
throw n.isMounted && (n.unmount(), n.constructView(s(n,
|
|
1584
|
+
throw n.isMounted && (n.unmount(), n.constructView(s(n, Te), {
|
|
1583
1585
|
error: a,
|
|
1584
1586
|
loggerName: e,
|
|
1585
1587
|
uid: t == null ? void 0 : t.uid
|
|
1586
|
-
}).mount(s(n,
|
|
1588
|
+
}).mount(s(n, B))), a;
|
|
1587
1589
|
}
|
|
1588
1590
|
};
|
|
1589
1591
|
}
|
|
@@ -1591,41 +1593,41 @@ class pr {
|
|
|
1591
1593
|
*
|
|
1592
1594
|
*/
|
|
1593
1595
|
constructView(e, t, r = []) {
|
|
1594
|
-
return new Ht(s(this,
|
|
1596
|
+
return new Ht(s(this, G), e, t, r);
|
|
1595
1597
|
}
|
|
1596
1598
|
/**
|
|
1597
1599
|
*
|
|
1598
1600
|
*/
|
|
1599
1601
|
constructMarkup(e) {
|
|
1600
|
-
return Wt(Bt(s(this,
|
|
1602
|
+
return Wt(Bt(s(this, G), e));
|
|
1601
1603
|
}
|
|
1602
1604
|
}
|
|
1603
|
-
|
|
1604
|
-
const
|
|
1605
|
-
function
|
|
1605
|
+
W = new WeakMap(), je = new WeakMap(), B = new WeakMap(), re = new WeakMap(), Te = new WeakMap(), Me = new WeakMap(), qe = new WeakMap(), Fe = new WeakMap(), Ae = new WeakMap(), _e = new WeakMap(), G = new WeakMap(), O = new WeakMap(), z = new WeakMap();
|
|
1606
|
+
const Et = new pr(), yr = Et.i18n.t.bind(Et.i18n);
|
|
1607
|
+
function br(i) {
|
|
1606
1608
|
typeof window < "u" && (window.DOLLA_DEV_DEBUG = i);
|
|
1607
1609
|
}
|
|
1608
|
-
function
|
|
1610
|
+
function vr() {
|
|
1609
1611
|
return typeof window < "u" ? window.DOLLA_DEV_DEBUG === !0 : !1;
|
|
1610
1612
|
}
|
|
1611
1613
|
export {
|
|
1612
1614
|
jt as cond,
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1615
|
+
It as createMarkup,
|
|
1616
|
+
Ct as createRef,
|
|
1617
|
+
qt as createSettableState,
|
|
1616
1618
|
kr as createSetter,
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
+
oe as createState,
|
|
1620
|
+
Et as default,
|
|
1619
1621
|
be as derive,
|
|
1620
|
-
|
|
1622
|
+
vr as getDevDebug,
|
|
1621
1623
|
mt as html,
|
|
1622
|
-
|
|
1624
|
+
Vt as isRef,
|
|
1623
1625
|
Sr as portal,
|
|
1624
1626
|
Pr as repeat,
|
|
1625
|
-
|
|
1627
|
+
br as setDevDebug,
|
|
1626
1628
|
yr as t,
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1629
|
+
Ft as toSettableState,
|
|
1630
|
+
At as toState,
|
|
1631
|
+
_t as valueOf
|
|
1630
1632
|
};
|
|
1631
1633
|
//# sourceMappingURL=index.js.map
|