@manyducks.co/dolla 2.0.0-alpha.31 → 2.0.0-alpha.32
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/core/context.d.ts +12 -4
- package/dist/core/dolla.d.ts +11 -3
- package/dist/core/markup.d.ts +23 -2
- package/dist/core/nodes/view.d.ts +1 -2
- package/dist/core/store.d.ts +3 -9
- package/dist/index.d.ts +1 -2
- package/dist/index.js +157 -163
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.js +2 -2
- package/dist/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx-runtime.js +2 -2
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/{markup-D1i09ddt.js → markup-C-1VlVZi.js} +578 -608
- package/dist/markup-C-1VlVZi.js.map +1 -0
- package/dist/modules/router.d.ts +2 -2
- package/docs/i18n.md +2 -2
- package/docs/router.md +12 -9
- package/docs/state.md +2 -2
- package/docs/stores.md +5 -6
- package/docs/views.md +53 -67
- package/notes/scratch.md +135 -0
- package/notes/stores.md +14 -32
- package/package.json +1 -1
- package/build.js +0 -34
- package/dist/markup-D1i09ddt.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
var ue = Object.defineProperty;
|
|
2
|
-
var
|
|
2
|
+
var At = (o) => {
|
|
3
3
|
throw TypeError(o);
|
|
4
4
|
};
|
|
5
5
|
var fe = (o, t, e) => t in o ? ue(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
|
|
6
|
-
var d = (o, t, e) => fe(o, typeof t != "symbol" ? t + "" : t, e), Pt = (o, t, e) => t.has(o) ||
|
|
7
|
-
var i = (o, t, e) => (Pt(o, t, "read from private field"), e ? e.call(o) : t.get(o)), l = (o, t, e) => t.has(o) ?
|
|
8
|
-
var
|
|
6
|
+
var d = (o, t, e) => fe(o, typeof t != "symbol" ? t + "" : t, e), Pt = (o, t, e) => t.has(o) || At("Cannot " + e);
|
|
7
|
+
var i = (o, t, e) => (Pt(o, t, "read from private field"), e ? e.call(o) : t.get(o)), l = (o, t, e) => t.has(o) ? At("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(o) : t.set(o, e), m = (o, t, e, s) => (Pt(o, t, "write to private field"), s ? s.call(o, e) : t.set(o, e), e), f = (o, t, e) => (Pt(o, t, "access private method"), e);
|
|
8
|
+
var st = (o, t, e, s) => ({
|
|
9
9
|
set _(n) {
|
|
10
10
|
m(o, t, n, e);
|
|
11
11
|
},
|
|
@@ -13,15 +13,15 @@ var et = (o, t, e, s) => ({
|
|
|
13
13
|
return i(o, t, s);
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
-
import { a as Zt, b as de, i as
|
|
17
|
-
import { F as
|
|
18
|
-
function
|
|
16
|
+
import { a as Zt, b as de, i as tt, I as te, c as me, d as Wt, e as x, s as Gt, f as v, g as et, P as ee, h as we, t as Bt, j as Ht, k as pe, l as zt, p as ge, m as Kt, S as ye, n as be, o as $e, q as Ee, r as ve, u as ke, C as Re, v as Qt, w as Jt, x as Se, y as vt, z as kt, V as _e, A as Le, B as Me, D as xe } from "./markup-C-1VlVZi.js";
|
|
17
|
+
import { F as ls, G as hs, E as cs } from "./markup-C-1VlVZi.js";
|
|
18
|
+
function nt(o) {
|
|
19
19
|
return Zt(o, "Expected `path` to be a string. Got type: %t, value: %v"), o.split("/").map((t) => t.trim()).filter((t) => t !== "");
|
|
20
20
|
}
|
|
21
21
|
function z(o) {
|
|
22
22
|
var e;
|
|
23
23
|
de(
|
|
24
|
-
(s) =>
|
|
24
|
+
(s) => tt(s == null ? void 0 : s.toString),
|
|
25
25
|
o,
|
|
26
26
|
"Expected `parts` to be an array of objects with a .toString() method. Got type: %t, value: %v"
|
|
27
27
|
), o = o.filter((s) => s).flatMap(String);
|
|
@@ -61,33 +61,33 @@ function De(o) {
|
|
|
61
61
|
}
|
|
62
62
|
function se(o, t, e = {}) {
|
|
63
63
|
var a;
|
|
64
|
-
const [s, n] = t.split("?"), r =
|
|
64
|
+
const [s, n] = t.split("?"), r = nt(s);
|
|
65
65
|
t: for (const c of o) {
|
|
66
66
|
const { fragments: h } = c;
|
|
67
67
|
if (!(((a = h[h.length - 1]) == null ? void 0 : a.type) === 3) && h.length !== r.length || e.willMatch && !e.willMatch(c))
|
|
68
68
|
continue t;
|
|
69
69
|
const E = [];
|
|
70
70
|
e: for (let u = 0; u < h.length; u++) {
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
71
|
+
const F = r[u], R = h[u];
|
|
72
|
+
if (F == null && R.type !== 3)
|
|
73
73
|
continue t;
|
|
74
74
|
switch (R.type) {
|
|
75
75
|
case 1:
|
|
76
|
-
if (R.name.toLowerCase() ===
|
|
76
|
+
if (R.name.toLowerCase() === F.toLowerCase()) {
|
|
77
77
|
E.push(R);
|
|
78
78
|
break;
|
|
79
79
|
} else
|
|
80
80
|
continue t;
|
|
81
81
|
case 2:
|
|
82
|
-
E.push({ ...R, value:
|
|
82
|
+
E.push({ ...R, value: F });
|
|
83
83
|
break;
|
|
84
84
|
case 3:
|
|
85
85
|
E.push({ ...R, value: r.slice(u).join("/") });
|
|
86
86
|
break e;
|
|
87
87
|
case 4:
|
|
88
|
-
if (isNaN(Number(
|
|
88
|
+
if (isNaN(Number(F)))
|
|
89
89
|
continue t;
|
|
90
|
-
E.push({ ...R, value: Number(
|
|
90
|
+
E.push({ ...R, value: Number(F) });
|
|
91
91
|
break;
|
|
92
92
|
default:
|
|
93
93
|
throw new Error(`Unknown fragment type: ${R.type}`);
|
|
@@ -105,7 +105,7 @@ function se(o, t, e = {}) {
|
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function Fe(o) {
|
|
109
109
|
const t = [], e = [], s = [], n = [];
|
|
110
110
|
for (const a of o) {
|
|
111
111
|
const { fragments: c } = a;
|
|
@@ -123,8 +123,8 @@ function Pe(o) {
|
|
|
123
123
|
const r = (a, c) => a.fragments.length > c.fragments.length ? -1 : 1;
|
|
124
124
|
return t.sort(r), e.sort(r), s.sort(r), n.sort(r), [...t, ...e, ...s, ...n];
|
|
125
125
|
}
|
|
126
|
-
function
|
|
127
|
-
const t =
|
|
126
|
+
function Pe(o) {
|
|
127
|
+
const t = nt(o), e = [];
|
|
128
128
|
for (let s = 0; s < t.length; s++) {
|
|
129
129
|
const n = t[s];
|
|
130
130
|
if (n === "*") {
|
|
@@ -147,21 +147,21 @@ function Te(o) {
|
|
|
147
147
|
}
|
|
148
148
|
return e;
|
|
149
149
|
}
|
|
150
|
-
function
|
|
151
|
-
return new
|
|
150
|
+
function ss(o) {
|
|
151
|
+
return new Ne(o);
|
|
152
152
|
}
|
|
153
153
|
const re = Symbol.for("DollaRouterMountMethod"), ne = Symbol.for("DollaRouterUnmountMethod");
|
|
154
|
-
function
|
|
154
|
+
function Tt(o) {
|
|
155
155
|
return (o == null ? void 0 : o[te]) === !0;
|
|
156
156
|
}
|
|
157
|
-
async function
|
|
157
|
+
async function Te(o, t) {
|
|
158
158
|
return o[re](t);
|
|
159
159
|
}
|
|
160
|
-
async function
|
|
160
|
+
async function Oe(o) {
|
|
161
161
|
return o[ne]();
|
|
162
162
|
}
|
|
163
|
-
var Yt, K, L, _t, P, Q, it, I, q, T, at, p,
|
|
164
|
-
class
|
|
163
|
+
var Yt, K, L, _t, P, Q, it, I, q, T, at, p, Ot, ie, ae, rt, Nt, oe, Ut;
|
|
164
|
+
class Ne {
|
|
165
165
|
constructor(t) {
|
|
166
166
|
l(this, p);
|
|
167
167
|
d(this, Yt, !0);
|
|
@@ -198,27 +198,27 @@ class Ue {
|
|
|
198
198
|
* The current query params. Changes to this object will be reflected in the URL.
|
|
199
199
|
*/
|
|
200
200
|
d(this, "$query");
|
|
201
|
-
me(t, "Options must be an object. Got: %t"), [
|
|
202
|
-
t.routes.flatMap((e) => f(this, p,
|
|
201
|
+
me(t, "Options must be an object. Got: %t"), [st(this, T)._, st(this, at)._] = Wt(), this.$pattern = x([i(this, T)], (e) => e == null ? void 0 : e.pattern), this.$path = x([i(this, T)], (e) => (e == null ? void 0 : e.path) ?? window.location.pathname), this.$params = x([i(this, T)], (e) => (e == null ? void 0 : e.params) ?? {}, { equals: Gt }), this.$query = x([i(this, T)], (e) => (e == null ? void 0 : e.query) ?? {}, { equals: Gt }), t.hash && m(this, I, !0), m(this, Q, Fe(
|
|
202
|
+
t.routes.flatMap((e) => f(this, p, Ut).call(this, e)).map((e) => ({
|
|
203
203
|
pattern: e.pattern,
|
|
204
204
|
meta: e.meta,
|
|
205
|
-
fragments:
|
|
205
|
+
fragments: Pe(e.pattern)
|
|
206
206
|
}))
|
|
207
|
-
)),
|
|
207
|
+
)), Ie(i(this, Q));
|
|
208
208
|
}
|
|
209
209
|
async [(Yt = te, re)](t) {
|
|
210
210
|
m(this, K, t), m(this, L, t.createLogger("Dolla.router"));
|
|
211
211
|
const e = () => {
|
|
212
|
-
f(this, p,
|
|
212
|
+
f(this, p, rt).call(this);
|
|
213
213
|
};
|
|
214
214
|
window.addEventListener("popstate", e), i(this, q).push(() => window.removeEventListener("popstate", e));
|
|
215
215
|
const s = t.getRootElement();
|
|
216
216
|
i(this, q).push(
|
|
217
|
-
|
|
217
|
+
je(s, (n) => {
|
|
218
218
|
let r = n.getAttribute("href");
|
|
219
|
-
i(this, L).info("intercepted click on <a> tag", n), /^https?:\/\/|^\//.test(r) || (r = z([window.location.pathname, r])), f(this, p,
|
|
219
|
+
i(this, L).info("intercepted click on <a> tag", n), /^https?:\/\/|^\//.test(r) || (r = z([window.location.pathname, r])), f(this, p, Ot).call(this, r);
|
|
220
220
|
})
|
|
221
|
-
), i(this, L).info("will intercept clicks on <a> tags within root element", s), m(this, it, !0), await f(this, p,
|
|
221
|
+
), i(this, L).info("will intercept clicks on <a> tags within root element", s), m(this, it, !0), await f(this, p, rt).call(this);
|
|
222
222
|
}
|
|
223
223
|
async [ne]() {
|
|
224
224
|
for (const t of i(this, q))
|
|
@@ -241,27 +241,27 @@ class Ue {
|
|
|
241
241
|
* Navigates to another route.
|
|
242
242
|
*
|
|
243
243
|
* @example
|
|
244
|
-
*
|
|
245
|
-
*
|
|
244
|
+
* router.go("/login"); // navigate to `/login`
|
|
245
|
+
* router.go["/users", 215], { replace: true }); // replace current history entry with `/users/215`
|
|
246
246
|
*/
|
|
247
247
|
go(t, e = {}) {
|
|
248
248
|
if (i(this, K) == null)
|
|
249
249
|
throw new Error("Routa methods won't work until you register it: Dolla.use(Routa, { /* ...options */ })");
|
|
250
250
|
let s;
|
|
251
|
-
Array.isArray(t) ? s = z(t) : s = t.toString(), s = Rt(window.location.pathname, s), e.preserveQuery && (s += window.location.search), e.replace ? f(this, p, ie).call(this, s) : f(this, p,
|
|
251
|
+
Array.isArray(t) ? s = z(t) : s = t.toString(), s = Rt(window.location.pathname, s), e.preserveQuery && (s += window.location.search), e.replace ? f(this, p, ie).call(this, s) : f(this, p, Ot).call(this, s);
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
|
-
K = new WeakMap(), L = new WeakMap(), _t = new WeakMap(), P = new WeakMap(), Q = new WeakMap(), it = new WeakMap(), I = new WeakMap(), q = new WeakMap(), T = new WeakMap(), at = new WeakMap(), p = new WeakSet(),
|
|
254
|
+
K = new WeakMap(), L = new WeakMap(), _t = new WeakMap(), P = new WeakMap(), Q = new WeakMap(), it = new WeakMap(), I = new WeakMap(), q = new WeakMap(), T = new WeakMap(), at = new WeakMap(), p = new WeakSet(), Ot = function(t, e) {
|
|
255
255
|
var s;
|
|
256
|
-
(s = i(this, L)) == null || s.info("(push)", t), window.history.pushState(e, "", i(this, I) ? "/#" + t : t), f(this, p,
|
|
256
|
+
(s = i(this, L)) == null || s.info("(push)", t), window.history.pushState(e, "", i(this, I) ? "/#" + t : t), f(this, p, rt).call(this, t);
|
|
257
257
|
}, ie = function(t, e) {
|
|
258
258
|
var s;
|
|
259
|
-
(s = i(this, L)) == null || s.info("(replace)", t), window.history.replaceState(e, "", i(this, I) ? "/#" + t : t), f(this, p,
|
|
259
|
+
(s = i(this, L)) == null || s.info("(replace)", t), window.history.replaceState(e, "", i(this, I) ? "/#" + t : t), f(this, p, rt).call(this, t);
|
|
260
260
|
}, ae = function() {
|
|
261
261
|
return i(this, I) ? new URL(window.location.hash.slice(1), window.location.origin) : new URL(window.location.pathname, window.location.origin);
|
|
262
|
-
},
|
|
262
|
+
}, rt = async function(t) {
|
|
263
263
|
var c;
|
|
264
|
-
const e = i(this, L), s = (c = i(this, K)) == null ? void 0 : c.getRootView(), n = t ? new URL(t, window.location.origin) : f(this, p, ae).call(this), { match: r, journey: a } = await f(this, p,
|
|
264
|
+
const e = i(this, L), s = (c = i(this, K)) == null ? void 0 : c.getRootView(), n = t ? new URL(t, window.location.origin) : f(this, p, ae).call(this), { match: r, journey: a } = await f(this, p, Nt).call(this, n);
|
|
265
265
|
for (const h of a)
|
|
266
266
|
switch (h.kind) {
|
|
267
267
|
case "match":
|
|
@@ -278,9 +278,9 @@ K = new WeakMap(), L = new WeakMap(), _t = new WeakMap(), P = new WeakMap(), Q =
|
|
|
278
278
|
const h = this.$pattern.get();
|
|
279
279
|
i(this, at).call(this, r), s && r.pattern !== h && f(this, p, oe).call(this, s, r);
|
|
280
280
|
} else
|
|
281
|
-
i(this, it) && e.crash(new
|
|
281
|
+
i(this, it) && e.crash(new qe(`Failed to match route '${n.pathname}'`));
|
|
282
282
|
return { match: r, journey: a };
|
|
283
|
-
},
|
|
283
|
+
}, Nt = async function(t, e = []) {
|
|
284
284
|
const s = se(i(this, Q), t.pathname);
|
|
285
285
|
if (!s)
|
|
286
286
|
return {
|
|
@@ -296,8 +296,8 @@ K = new WeakMap(), L = new WeakMap(), _t = new WeakMap(), P = new WeakMap(), Q =
|
|
|
296
296
|
}), n != null) {
|
|
297
297
|
let r;
|
|
298
298
|
if (v(n))
|
|
299
|
-
r =
|
|
300
|
-
else if (
|
|
299
|
+
r = Ve(n, s.params);
|
|
300
|
+
else if (tt(n)) {
|
|
301
301
|
const a = {
|
|
302
302
|
path: s.path,
|
|
303
303
|
pattern: s.pattern,
|
|
@@ -309,7 +309,7 @@ K = new WeakMap(), L = new WeakMap(), _t = new WeakMap(), P = new WeakMap(), Q =
|
|
|
309
309
|
r.startsWith("/") || (r = Rt(s.path, r));
|
|
310
310
|
} else
|
|
311
311
|
throw new TypeError("Redirect must either be a path string or a function.");
|
|
312
|
-
return f(this, p,
|
|
312
|
+
return f(this, p, Nt).call(this, new URL(r, window.location.origin), [
|
|
313
313
|
...e,
|
|
314
314
|
{ kind: "redirect", message: `redirecting '${s.path}' -> '${r}'` }
|
|
315
315
|
]);
|
|
@@ -334,8 +334,8 @@ oe = function(t, e) {
|
|
|
334
334
|
* @param route - Route config object.
|
|
335
335
|
* @param layers - Array of parent layers. Passed when this function calls itself on nested routes.
|
|
336
336
|
*/
|
|
337
|
-
|
|
338
|
-
if (!
|
|
337
|
+
Ut = function(t, e = [], s = []) {
|
|
338
|
+
if (!et(t) || !v(t.path))
|
|
339
339
|
throw new TypeError(`Route configs must be objects with a 'path' string property. Got: ${t}`);
|
|
340
340
|
if (t.redirect && t.routes)
|
|
341
341
|
throw new Error("Route cannot have both a 'redirect' and nested 'routes'.");
|
|
@@ -345,27 +345,27 @@ Ct = function(t, e = [], s = []) {
|
|
|
345
345
|
throw new Error("Route must have a 'view', a 'redirect', or a set of nested 'routes'.");
|
|
346
346
|
let n = [];
|
|
347
347
|
for (const h of e)
|
|
348
|
-
n.push(...
|
|
349
|
-
n.push(...
|
|
348
|
+
n.push(...nt(h.path));
|
|
349
|
+
n.push(...nt(t.path)), n[n.length - 1] === "*" && n.pop();
|
|
350
350
|
const r = [];
|
|
351
351
|
if (t.redirect) {
|
|
352
352
|
let h = t.redirect;
|
|
353
353
|
return v(h) && (h = Rt(z(n), h), h.startsWith("/") || (h = "/" + h)), r.push({
|
|
354
|
-
pattern: "/" + z([...n, ...
|
|
354
|
+
pattern: "/" + z([...n, ...nt(t.path)]),
|
|
355
355
|
meta: {
|
|
356
356
|
redirect: h
|
|
357
357
|
}
|
|
358
358
|
}), r;
|
|
359
359
|
}
|
|
360
360
|
let a = ee;
|
|
361
|
-
if (
|
|
361
|
+
if (tt(t.view))
|
|
362
362
|
a = t.view;
|
|
363
363
|
else if (t.view)
|
|
364
364
|
throw new TypeError(`Route '${t.path}' expected a view function or undefined. Got: ${t.view}`);
|
|
365
|
-
const c = { id:
|
|
365
|
+
const c = { id: st(this, _t)._++, view: a };
|
|
366
366
|
if (t.routes)
|
|
367
367
|
for (const h of t.routes)
|
|
368
|
-
r.push(...f(this, p,
|
|
368
|
+
r.push(...f(this, p, Ut).call(this, h, [...e, t], [...s, c]));
|
|
369
369
|
else
|
|
370
370
|
r.push({
|
|
371
371
|
pattern: parent ? z([...e.map((h) => h.path), t.path]) : t.path,
|
|
@@ -377,8 +377,8 @@ Ct = function(t, e = [], s = []) {
|
|
|
377
377
|
});
|
|
378
378
|
return r;
|
|
379
379
|
};
|
|
380
|
-
const
|
|
381
|
-
function
|
|
380
|
+
const Ue = /(noopener|noreferrer) (noopener|noreferrer)/, Ce = /^[\w-_]+:/;
|
|
381
|
+
function je(o, t, e = window) {
|
|
382
382
|
function s(r) {
|
|
383
383
|
return !r || r === o ? null : r.localName !== "a" || r.href === void 0 ? s(r.parentNode) : r;
|
|
384
384
|
}
|
|
@@ -386,24 +386,24 @@ function Ve(o, t, e = window) {
|
|
|
386
386
|
if (r.button && r.button !== 0 || r.ctrlKey || r.metaKey || r.altKey || r.shiftKey || r.defaultPrevented)
|
|
387
387
|
return;
|
|
388
388
|
const a = s(r.target);
|
|
389
|
-
a && (e.location.protocol !== a.protocol || e.location.hostname !== a.hostname || e.location.port !== a.port || a.hasAttribute("data-router-ignore") || a.hasAttribute("download") || a.getAttribute("target") === "_blank" &&
|
|
389
|
+
a && (e.location.protocol !== a.protocol || e.location.hostname !== a.hostname || e.location.port !== a.port || a.hasAttribute("data-router-ignore") || a.hasAttribute("download") || a.getAttribute("target") === "_blank" && Ue.test(a.getAttribute("rel")) || Ce.test(a.getAttribute("href")) || (r.preventDefault(), t(a)));
|
|
390
390
|
}
|
|
391
391
|
return o.addEventListener("click", n), function() {
|
|
392
392
|
o.removeEventListener("click", n);
|
|
393
393
|
};
|
|
394
394
|
}
|
|
395
|
-
function
|
|
395
|
+
function Ve(o, t) {
|
|
396
396
|
for (const e in t) {
|
|
397
397
|
const s = t[e].toString();
|
|
398
398
|
o = o.replace(`{${e}}`, s).replace(`{#${e}}`, s);
|
|
399
399
|
}
|
|
400
400
|
return o;
|
|
401
401
|
}
|
|
402
|
-
function
|
|
402
|
+
function Ie(o) {
|
|
403
403
|
for (const t of o)
|
|
404
404
|
if (t.meta.redirect) {
|
|
405
405
|
let e;
|
|
406
|
-
if (!
|
|
406
|
+
if (!tt(t.meta.redirect)) if (v(t.meta.redirect)) {
|
|
407
407
|
if (e = t.meta.redirect, !se(o, e, {
|
|
408
408
|
willMatch(n) {
|
|
409
409
|
return n !== t;
|
|
@@ -414,14 +414,14 @@ function qe(o) {
|
|
|
414
414
|
throw new TypeError(`Expected a string or redirect function. Got: ${t.meta.redirect}`);
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
|
-
class
|
|
417
|
+
class qe extends Error {
|
|
418
418
|
}
|
|
419
419
|
var W, Lt, Mt, ot, S, _;
|
|
420
|
-
class
|
|
420
|
+
class We {
|
|
421
421
|
constructor(t) {
|
|
422
422
|
l(this, S);
|
|
423
423
|
l(this, W, []);
|
|
424
|
-
l(this, Lt,
|
|
424
|
+
l(this, Lt, Ae());
|
|
425
425
|
l(this, Mt);
|
|
426
426
|
l(this, ot);
|
|
427
427
|
m(this, Mt, t), m(this, ot, t.createLogger("Dolla.http"));
|
|
@@ -463,7 +463,7 @@ class Ae {
|
|
|
463
463
|
}
|
|
464
464
|
}
|
|
465
465
|
W = new WeakMap(), Lt = new WeakMap(), Mt = new WeakMap(), ot = new WeakMap(), S = new WeakSet(), _ = async function(t, e, s) {
|
|
466
|
-
return new
|
|
466
|
+
return new He({
|
|
467
467
|
...s,
|
|
468
468
|
method: t,
|
|
469
469
|
uri: e,
|
|
@@ -472,14 +472,14 @@ W = new WeakMap(), Lt = new WeakMap(), Mt = new WeakMap(), ot = new WeakMap(), S
|
|
|
472
472
|
logger: i(this, ot)
|
|
473
473
|
}).fetch();
|
|
474
474
|
};
|
|
475
|
-
function
|
|
475
|
+
function Ae() {
|
|
476
476
|
if (typeof window < "u" && window.fetch)
|
|
477
477
|
return window.fetch.bind(window);
|
|
478
478
|
if (typeof global < "u" && global.fetch)
|
|
479
479
|
return global.fetch.bind(global);
|
|
480
480
|
throw new Error("Running in neither browser nor node. Please run this app in one of the supported environments.");
|
|
481
481
|
}
|
|
482
|
-
class
|
|
482
|
+
class Ge extends Error {
|
|
483
483
|
constructor(e) {
|
|
484
484
|
const { status: s, statusText: n, method: r, url: a } = e, c = `${s} ${n}: Request failed (${r.toUpperCase()} ${a.toString()})`;
|
|
485
485
|
super(c);
|
|
@@ -504,7 +504,7 @@ class Be {
|
|
|
504
504
|
t.forEach((e, s) => {
|
|
505
505
|
this.headers.set(s, e);
|
|
506
506
|
});
|
|
507
|
-
else if (
|
|
507
|
+
else if (et(t))
|
|
508
508
|
for (const e in t) {
|
|
509
509
|
const s = t[e];
|
|
510
510
|
s instanceof Date ? this.headers.set(e, s.toISOString()) : s != null && this.headers.set(e, String(s));
|
|
@@ -518,7 +518,7 @@ class Be {
|
|
|
518
518
|
t.forEach((e, s) => {
|
|
519
519
|
this.url.searchParams.set(s, e);
|
|
520
520
|
});
|
|
521
|
-
else if (
|
|
521
|
+
else if (et(t))
|
|
522
522
|
for (const e in t) {
|
|
523
523
|
const s = t[e];
|
|
524
524
|
s instanceof Date ? this.url.searchParams.set(e, s.toISOString()) : s != null && this.url.searchParams.set(e, String(s));
|
|
@@ -527,7 +527,7 @@ class Be {
|
|
|
527
527
|
throw new TypeError(`Unknown query params type. Got: ${t}`);
|
|
528
528
|
}
|
|
529
529
|
}
|
|
530
|
-
class
|
|
530
|
+
class He {
|
|
531
531
|
constructor(t) {
|
|
532
532
|
d(this, "_middleware");
|
|
533
533
|
d(this, "_fetch");
|
|
@@ -545,14 +545,14 @@ class ze {
|
|
|
545
545
|
} else
|
|
546
546
|
await this._handler();
|
|
547
547
|
if (this._response.status < 200 || this._response.status >= 400)
|
|
548
|
-
throw new
|
|
548
|
+
throw new Ge(this._response);
|
|
549
549
|
return this._response;
|
|
550
550
|
}
|
|
551
551
|
// This is the function that performs the actual request after the final middleware.
|
|
552
552
|
async _handler() {
|
|
553
553
|
let t;
|
|
554
554
|
const e = this._request;
|
|
555
|
-
!e.headers.has("content-type") &&
|
|
555
|
+
!e.headers.has("content-type") && et(e.body) ? (e.headers.set("content-type", "application/json"), t = JSON.stringify(e.body)) : t = e.body;
|
|
556
556
|
const s = await this._fetch(e.url.toString(), {
|
|
557
557
|
method: e.method,
|
|
558
558
|
headers: e.headers,
|
|
@@ -569,10 +569,10 @@ class ze {
|
|
|
569
569
|
};
|
|
570
570
|
}
|
|
571
571
|
}
|
|
572
|
-
var xt, J,
|
|
573
|
-
class
|
|
572
|
+
var xt, J, H, Ct, le;
|
|
573
|
+
class ze {
|
|
574
574
|
constructor(t, e) {
|
|
575
|
-
l(this,
|
|
575
|
+
l(this, H);
|
|
576
576
|
d(this, "dolla");
|
|
577
577
|
d(this, "config");
|
|
578
578
|
l(this, xt, !1);
|
|
@@ -582,14 +582,14 @@ class Ke {
|
|
|
582
582
|
async load() {
|
|
583
583
|
let t;
|
|
584
584
|
if (!i(this, xt)) {
|
|
585
|
-
if (
|
|
586
|
-
if (t = await this.config.fetch(), !
|
|
585
|
+
if (tt(this.config.fetch)) {
|
|
586
|
+
if (t = await this.config.fetch(), !et(t))
|
|
587
587
|
throw new Error(`Fetch function did not return an object of language strings: ${t}`);
|
|
588
588
|
} else if (v(this.config.path)) {
|
|
589
589
|
const e = await fetch(this.config.path);
|
|
590
590
|
if (e.ok) {
|
|
591
591
|
const s = await e.json();
|
|
592
|
-
if (
|
|
592
|
+
if (et(s))
|
|
593
593
|
t = s;
|
|
594
594
|
else
|
|
595
595
|
throw new Error(
|
|
@@ -600,7 +600,7 @@ class Ke {
|
|
|
600
600
|
}
|
|
601
601
|
}
|
|
602
602
|
if (t) {
|
|
603
|
-
const e = f(this,
|
|
603
|
+
const e = f(this, H, Ct).call(this, t);
|
|
604
604
|
for (const s of e)
|
|
605
605
|
i(this, J).set(s[0], s[1]);
|
|
606
606
|
} else
|
|
@@ -615,15 +615,15 @@ class Ke {
|
|
|
615
615
|
return i(this, J).has(t);
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
|
-
xt = new WeakMap(), J = new WeakMap(),
|
|
618
|
+
xt = new WeakMap(), J = new WeakMap(), H = new WeakSet(), Ct = function(t, e = []) {
|
|
619
619
|
const s = [];
|
|
620
620
|
for (const n in t)
|
|
621
621
|
switch (Bt(t[n])) {
|
|
622
622
|
case "string":
|
|
623
|
-
s.push([[...e, n].join("."), f(this,
|
|
623
|
+
s.push([[...e, n].join("."), f(this, H, le).call(this, t[n])]);
|
|
624
624
|
break;
|
|
625
625
|
case "object":
|
|
626
|
-
s.push(...f(this,
|
|
626
|
+
s.push(...f(this, H, Ct).call(this, t[n], [...e, n]));
|
|
627
627
|
break;
|
|
628
628
|
default:
|
|
629
629
|
throw new Error(
|
|
@@ -680,8 +680,8 @@ xt = new WeakMap(), J = new WeakMap(), B = new WeakSet(), jt = function(t, e = [
|
|
|
680
680
|
}
|
|
681
681
|
return a === 0 && n.length > 0 && s.segments.push({ type: 0, text: n }), s;
|
|
682
682
|
};
|
|
683
|
-
var lt, O, b, ht, ct, ut, ft, $, he, Vt, It,
|
|
684
|
-
class
|
|
683
|
+
var lt, O, b, ht, ct, ut, ft, $, he, jt, Vt, It, ce;
|
|
684
|
+
class Ke {
|
|
685
685
|
constructor(t) {
|
|
686
686
|
l(this, $);
|
|
687
687
|
l(this, lt);
|
|
@@ -693,8 +693,8 @@ class Qe {
|
|
|
693
693
|
d(this, "$locale");
|
|
694
694
|
l(this, ft);
|
|
695
695
|
m(this, lt, t), m(this, O, t.createLogger("Dolla.i18n"));
|
|
696
|
-
const [e, s] =
|
|
697
|
-
this.$locale = e, m(this, ft, s), this.addFormat("number", (n, r, a) => f(this, $,
|
|
696
|
+
const [e, s] = Wt();
|
|
697
|
+
this.$locale = e, m(this, ft, s), this.addFormat("number", (n, r, a) => f(this, $, jt).call(this, Number(r), a)), this.addFormat("datetime", (n, r, a) => f(this, $, Vt).call(this, r, a)), this.addFormat("list", (n, r, a) => f(this, $, It).call(this, r, a)), t.beforeMount(async () => {
|
|
698
698
|
i(this, b).size > 0 && await this.setLocale(i(this, ut));
|
|
699
699
|
});
|
|
700
700
|
}
|
|
@@ -703,7 +703,7 @@ class Qe {
|
|
|
703
703
|
}
|
|
704
704
|
setup(t) {
|
|
705
705
|
if (t.translations.forEach((e) => {
|
|
706
|
-
i(this, b).set(e.locale, new
|
|
706
|
+
i(this, b).set(e.locale, new ze(e, i(this, lt)));
|
|
707
707
|
}), t.locale && t.locale !== "auto") {
|
|
708
708
|
if (!t.translations.some((s) => s.locale === t.locale))
|
|
709
709
|
throw new Error(`Initial locale '${t.locale}' is not registered in the locales array.`);
|
|
@@ -797,7 +797,7 @@ class Qe {
|
|
|
797
797
|
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options
|
|
798
798
|
*/
|
|
799
799
|
number(t, e) {
|
|
800
|
-
return x([this.$locale, t], (s, n) => f(this, $,
|
|
800
|
+
return x([this.$locale, t], (s, n) => f(this, $, jt).call(this, n, e));
|
|
801
801
|
}
|
|
802
802
|
/**
|
|
803
803
|
* Returns a State containing the date formatted for the current locale. Uses `Intl.DateTimeFormat` under the hood.
|
|
@@ -809,7 +809,7 @@ class Qe {
|
|
|
809
809
|
* const $formatted = Dolla.i18n.dateTime(date, { dateFormat: "short" });
|
|
810
810
|
*/
|
|
811
811
|
dateTime(t, e) {
|
|
812
|
-
return x([this.$locale, t], (s, n) => f(this, $,
|
|
812
|
+
return x([this.$locale, t], (s, n) => f(this, $, Vt).call(this, n, e));
|
|
813
813
|
}
|
|
814
814
|
/**
|
|
815
815
|
* Returns a State containing the date formatted for the current locale. Uses `Intl.DateTimeFormat` under the hood.
|
|
@@ -821,7 +821,7 @@ class Qe {
|
|
|
821
821
|
* const $formatted = Dolla.i18n.list(list, { });
|
|
822
822
|
*/
|
|
823
823
|
list(t, e) {
|
|
824
|
-
return x([this.$locale, t], (s, n) => f(this, $,
|
|
824
|
+
return x([this.$locale, t], (s, n) => f(this, $, It).call(this, n, e));
|
|
825
825
|
}
|
|
826
826
|
}
|
|
827
827
|
lt = new WeakMap(), O = new WeakMap(), b = new WeakMap(), ht = new WeakMap(), ct = new WeakMap(), ut = new WeakMap(), ft = new WeakMap(), $ = new WeakSet(), he = function(t, e, s) {
|
|
@@ -843,27 +843,27 @@ lt = new WeakMap(), O = new WeakMap(), b = new WeakMap(), ht = new WeakMap(), ct
|
|
|
843
843
|
if (w.type === 0)
|
|
844
844
|
c += w.text;
|
|
845
845
|
else if (w.type === 1) {
|
|
846
|
-
let E =
|
|
846
|
+
let E = Qe(s, w.name);
|
|
847
847
|
const k = ((h = s.formatOverrides) == null ? void 0 : h[w.name]) ?? [...w.formats];
|
|
848
848
|
w.name === "count" && k.length === 0 && k.push({ name: "number", options: {} });
|
|
849
849
|
for (const u of k) {
|
|
850
|
-
const
|
|
851
|
-
if (
|
|
850
|
+
const F = i(this, ct).get(u.name);
|
|
851
|
+
if (F == null) {
|
|
852
852
|
const R = new Error(
|
|
853
853
|
`Failed to load format '${u.name}' when processing '${e}', template: ${a}`
|
|
854
854
|
);
|
|
855
855
|
throw i(this, O).crash(R), R;
|
|
856
856
|
}
|
|
857
|
-
E =
|
|
857
|
+
E = F(t, E, u.options);
|
|
858
858
|
}
|
|
859
859
|
c += E;
|
|
860
860
|
}
|
|
861
861
|
return c;
|
|
862
|
-
},
|
|
862
|
+
}, jt = function(t, e) {
|
|
863
863
|
return new Intl.NumberFormat(this.$locale.get(), e).format(t);
|
|
864
|
-
},
|
|
864
|
+
}, Vt = function(t, e) {
|
|
865
865
|
return new Intl.DateTimeFormat(this.$locale.get(), e).format(v(t) ? new Date(t) : t);
|
|
866
|
-
},
|
|
866
|
+
}, It = function(t, e) {
|
|
867
867
|
return new Intl.ListFormat(this.$locale.get(), e).format(t);
|
|
868
868
|
}, // relativeTime(): State<string> {
|
|
869
869
|
// }
|
|
@@ -872,7 +872,7 @@ ce = function(t, e) {
|
|
|
872
872
|
if (s[0] === t && we(s[1], e))
|
|
873
873
|
return s[2];
|
|
874
874
|
};
|
|
875
|
-
function
|
|
875
|
+
function Qe(o, t) {
|
|
876
876
|
const e = String(t).split(/[\.\[\]]/).filter((n) => n.trim() !== "");
|
|
877
877
|
let s = o;
|
|
878
878
|
for (; e.length > 0; ) {
|
|
@@ -881,8 +881,8 @@ function Je(o, t) {
|
|
|
881
881
|
}
|
|
882
882
|
return s;
|
|
883
883
|
}
|
|
884
|
-
function
|
|
885
|
-
return
|
|
884
|
+
function Je(o) {
|
|
885
|
+
return Ht`
|
|
886
886
|
<div
|
|
887
887
|
style=${{
|
|
888
888
|
backgroundColor: "#880000",
|
|
@@ -896,7 +896,7 @@ function Xe(o) {
|
|
|
896
896
|
<h1 style=${{ marginBottom: "0.5rem" }}>The app has crashed</h1>
|
|
897
897
|
<p style=${{ marginBottom: "0.25rem" }}>
|
|
898
898
|
<span style=${{ fontFamily: "monospace" }}>${o.loggerName}</span>
|
|
899
|
-
${pe(o.uid,
|
|
899
|
+
${pe(o.uid, Ht`<span style=${{ fontFamily: "monospace", opacity: 0.5 }}> [uid: ${o.uid}]</span>`)}
|
|
900
900
|
${" "}says:
|
|
901
901
|
</p>
|
|
902
902
|
<blockquote
|
|
@@ -928,10 +928,10 @@ function Xe(o) {
|
|
|
928
928
|
</div>
|
|
929
929
|
`;
|
|
930
930
|
}
|
|
931
|
-
var dt, X, N, A, G, Y,
|
|
932
|
-
class
|
|
931
|
+
var dt, X, N, A, G, Y, Dt, M, mt, D, qt, St;
|
|
932
|
+
class Xe {
|
|
933
933
|
constructor(t) {
|
|
934
|
-
l(this,
|
|
934
|
+
l(this, D);
|
|
935
935
|
l(this, dt);
|
|
936
936
|
l(this, X);
|
|
937
937
|
// Keys ensure only the most recent callback queued with a certain key
|
|
@@ -946,7 +946,7 @@ class Ye {
|
|
|
946
946
|
// This may not be desirable, because while it does prevent hitching it sometimes leaves
|
|
947
947
|
// the state partially rendered for a brief second and certain elements can be seen to update after the fact.
|
|
948
948
|
// But the tradeoff here is snappier navigation with possibly slightly out of date DOM updates on heavy pages.
|
|
949
|
-
l(this,
|
|
949
|
+
l(this, Dt, !0);
|
|
950
950
|
l(this, M, 0);
|
|
951
951
|
l(this, mt, new Intl.NumberFormat("en-US", {
|
|
952
952
|
maximumFractionDigits: 2,
|
|
@@ -961,22 +961,22 @@ class Ye {
|
|
|
961
961
|
* Queues a callback that runs before the next batch of writes.
|
|
962
962
|
*/
|
|
963
963
|
read(t) {
|
|
964
|
-
i(this, G).push(t), f(this,
|
|
964
|
+
i(this, G).push(t), f(this, D, qt).call(this);
|
|
965
965
|
}
|
|
966
966
|
/**
|
|
967
967
|
* Queues a callback to run in the next render batch.
|
|
968
968
|
* Always put DOM mutations in a write callback when possible to help Dolla batch them efficiently.
|
|
969
969
|
*/
|
|
970
970
|
write(t, e) {
|
|
971
|
-
e ? i(this, N).set(e, t) : i(this, A).push(t), f(this,
|
|
971
|
+
e ? i(this, N).set(e, t) : i(this, A).push(t), f(this, D, qt).call(this);
|
|
972
972
|
}
|
|
973
973
|
}
|
|
974
|
-
dt = new WeakMap(), X = new WeakMap(), N = new WeakMap(), A = new WeakMap(), G = new WeakMap(), Y = new WeakMap(),
|
|
974
|
+
dt = new WeakMap(), X = new WeakMap(), N = new WeakMap(), A = new WeakMap(), G = new WeakMap(), Y = new WeakMap(), Dt = new WeakMap(), M = new WeakMap(), mt = new WeakMap(), D = new WeakSet(), qt = function() {
|
|
975
975
|
if (!i(this, Y)) {
|
|
976
976
|
m(this, Y, !0);
|
|
977
977
|
const t = i(this, dt).getEnv() === "development";
|
|
978
978
|
queueMicrotask(() => {
|
|
979
|
-
f(this,
|
|
979
|
+
f(this, D, St).call(this, t);
|
|
980
980
|
});
|
|
981
981
|
}
|
|
982
982
|
}, St = function(t = !1) {
|
|
@@ -984,10 +984,10 @@ dt = new WeakMap(), X = new WeakMap(), N = new WeakMap(), A = new WeakMap(), G =
|
|
|
984
984
|
let s = 0;
|
|
985
985
|
const n = i(this, G).length + i(this, N).size + i(this, A).length;
|
|
986
986
|
let r = 0;
|
|
987
|
-
const a = () => (r++, s = performance.now() - e, i(this,
|
|
987
|
+
const a = () => (r++, s = performance.now() - e, i(this, Dt) && s > 12 && r < n ? (st(this, M)._++, t && i(this, X).warn(
|
|
988
988
|
`⚠️ Deferring batch to next frame. Performed ${r} of ${n} batched operation${r === 1 ? "" : "s"} in ${i(this, mt).format(s)} (deferral ${i(this, M)}).`
|
|
989
989
|
), requestAnimationFrame(() => {
|
|
990
|
-
f(this,
|
|
990
|
+
f(this, D, St).call(this, t);
|
|
991
991
|
}), !0) : !1), c = [...i(this, N).entries()];
|
|
992
992
|
let h, w;
|
|
993
993
|
for (; w = i(this, G).shift(); )
|
|
@@ -999,11 +999,11 @@ dt = new WeakMap(), X = new WeakMap(), N = new WeakMap(), A = new WeakMap(), G =
|
|
|
999
999
|
t && i(this, X)[s > 16 ? "warn" : "info"](
|
|
1000
1000
|
`${s > 16 ? "⚠️ (>=16ms) " : ""}Executed ${r} operation${r === 1 ? "" : "s"} in ${i(this, mt).format(s)}${i(this, M) > 0 ? ` (after ${i(this, M)} deferral${i(this, M) === 1 ? "" : "s"})` : ""}.`
|
|
1001
1001
|
), m(this, M, 0), i(this, G).length || i(this, N).size || i(this, A).length ? queueMicrotask(() => {
|
|
1002
|
-
f(this,
|
|
1002
|
+
f(this, D, St).call(this, t);
|
|
1003
1003
|
}) : m(this, Y, !1);
|
|
1004
1004
|
};
|
|
1005
|
-
var U, wt, C,
|
|
1006
|
-
class
|
|
1005
|
+
var U, wt, C, B, pt, gt, Z, yt, bt, $t, Et, g, y, j, V, Ft;
|
|
1006
|
+
class Ye {
|
|
1007
1007
|
constructor() {
|
|
1008
1008
|
d(this, "batch");
|
|
1009
1009
|
// Remove `private` when there are public methods to call.
|
|
@@ -1013,9 +1013,9 @@ class Ze {
|
|
|
1013
1013
|
l(this, U, !1);
|
|
1014
1014
|
l(this, wt, "production");
|
|
1015
1015
|
l(this, C);
|
|
1016
|
-
l(this,
|
|
1017
|
-
l(this, pt,
|
|
1018
|
-
l(this, gt,
|
|
1016
|
+
l(this, B);
|
|
1017
|
+
l(this, pt, Je);
|
|
1018
|
+
l(this, gt, zt());
|
|
1019
1019
|
l(this, Z);
|
|
1020
1020
|
l(this, yt, []);
|
|
1021
1021
|
l(this, bt, []);
|
|
@@ -1034,21 +1034,21 @@ class Ze {
|
|
|
1034
1034
|
warn: "development",
|
|
1035
1035
|
error: !0
|
|
1036
1036
|
});
|
|
1037
|
-
l(this, j,
|
|
1037
|
+
l(this, j, Kt("*,-Dolla.*"));
|
|
1038
1038
|
l(this, V, /* @__PURE__ */ new Map());
|
|
1039
1039
|
// Registration functions for modules.
|
|
1040
1040
|
// All modules will be registered before mount.
|
|
1041
|
-
l(this,
|
|
1041
|
+
l(this, Ft, []);
|
|
1042
1042
|
d(this, "watch", i(this, gt).watch);
|
|
1043
|
-
d(this, "createState",
|
|
1043
|
+
d(this, "createState", Wt);
|
|
1044
1044
|
d(this, "toState", be);
|
|
1045
1045
|
d(this, "toValue", $e);
|
|
1046
1046
|
d(this, "isState", Ee);
|
|
1047
1047
|
d(this, "derive", x);
|
|
1048
|
-
d(this, "createWatcher",
|
|
1048
|
+
d(this, "createWatcher", zt);
|
|
1049
1049
|
d(this, "createRef", ve);
|
|
1050
1050
|
d(this, "isRef", ke);
|
|
1051
|
-
this.batch = new
|
|
1051
|
+
this.batch = new Xe(this), this.stats = new ye(this), this.http = new We(this), this.i18n = new Ke(this);
|
|
1052
1052
|
}
|
|
1053
1053
|
/**
|
|
1054
1054
|
* True when the app is connected to a DOM node and displayed to the user.
|
|
@@ -1087,7 +1087,7 @@ class Ze {
|
|
|
1087
1087
|
* Returns the top level view Dolla is rendering inside the root element. This will return undefined until Dolla.mount() is called.
|
|
1088
1088
|
*/
|
|
1089
1089
|
getRootView() {
|
|
1090
|
-
return i(this,
|
|
1090
|
+
return i(this, B);
|
|
1091
1091
|
}
|
|
1092
1092
|
/**
|
|
1093
1093
|
* Sets a context variable and returns its value. Context variables are accessible on the app and in child views.
|
|
@@ -1147,27 +1147,23 @@ class Ze {
|
|
|
1147
1147
|
emit(t, e) {
|
|
1148
1148
|
return i(this, g).emitter.emit(t, new Re(t, e));
|
|
1149
1149
|
}
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
if (!t.attach(i(this, g))) {
|
|
1155
|
-
let s = t.name ? `'${t.name}'` : "this store";
|
|
1156
|
-
console.warn(`An instance of ${s} was already attached to this context.`);
|
|
1150
|
+
attachStore(t, e) {
|
|
1151
|
+
if (!new xe(t, e).attach(i(this, g))) {
|
|
1152
|
+
let r = t.name ? `'${t.name}'` : "this store";
|
|
1153
|
+
console.warn(`An instance of ${r} was already attached to this context.`);
|
|
1157
1154
|
}
|
|
1158
1155
|
}
|
|
1159
1156
|
/**
|
|
1160
1157
|
* Gets the nearest instance of a store. Throws an error if the store isn't provided higher in the tree.
|
|
1161
1158
|
*/
|
|
1162
1159
|
useStore(t) {
|
|
1163
|
-
if (
|
|
1164
|
-
const e =
|
|
1165
|
-
if (
|
|
1166
|
-
throw new
|
|
1167
|
-
return
|
|
1168
|
-
} else
|
|
1169
|
-
|
|
1170
|
-
) : new Tt("Invalid store.");
|
|
1160
|
+
if (tt(t)) {
|
|
1161
|
+
const e = i(this, g).stores.get(t);
|
|
1162
|
+
if (e == null)
|
|
1163
|
+
throw new Qt("Store not found on this context.");
|
|
1164
|
+
return e.value;
|
|
1165
|
+
} else
|
|
1166
|
+
throw new Qt("Invalid store.");
|
|
1171
1167
|
}
|
|
1172
1168
|
async mount(t, e) {
|
|
1173
1169
|
if (i(this, U))
|
|
@@ -1177,9 +1173,9 @@ class Ze {
|
|
|
1177
1173
|
Jt(HTMLElement, r, `Selector '${t}' did not match any element.`), m(this, C, r);
|
|
1178
1174
|
} else
|
|
1179
1175
|
Jt(HTMLElement, t, "Expected an HTML element or a selector string. Got type: %t, value: %v"), m(this, C, t);
|
|
1180
|
-
|
|
1181
|
-
const s =
|
|
1182
|
-
m(this,
|
|
1176
|
+
Tt(e) && m(this, Z, e);
|
|
1177
|
+
const s = Tt(e) ? ee : e, n = Se(s);
|
|
1178
|
+
m(this, B, this.constructView(n.type, n.props)), await Promise.all(i(this, Ft).map((r) => r())), Tt(e) && await Te(e, this), await Promise.all(i(this, yt).map((r) => r())), i(this, B).mount(i(this, C)), m(this, U, !0);
|
|
1183
1179
|
for (const r of i(this, g).stores.values())
|
|
1184
1180
|
r.handleMount();
|
|
1185
1181
|
for (const r of i(this, bt))
|
|
@@ -1188,7 +1184,7 @@ class Ze {
|
|
|
1188
1184
|
async unmount() {
|
|
1189
1185
|
var t;
|
|
1190
1186
|
if (i(this, U)) {
|
|
1191
|
-
await Promise.all(i(this, $t).map((e) => e())), (t = i(this,
|
|
1187
|
+
await Promise.all(i(this, $t).map((e) => e())), (t = i(this, B)) == null || t.unmount(!1), i(this, gt).stopAll(), i(this, Z) && await Oe(i(this, Z)), m(this, U, !1);
|
|
1192
1188
|
for (const e of i(this, Et))
|
|
1193
1189
|
e();
|
|
1194
1190
|
}
|
|
@@ -1229,10 +1225,10 @@ class Ze {
|
|
|
1229
1225
|
}
|
|
1230
1226
|
}
|
|
1231
1227
|
setLogFilter(t) {
|
|
1232
|
-
m(this, j,
|
|
1228
|
+
m(this, j, Kt(t));
|
|
1233
1229
|
}
|
|
1234
1230
|
createLogger(t, e) {
|
|
1235
|
-
const s = (e == null ? void 0 : e.console) ??
|
|
1231
|
+
const s = (e == null ? void 0 : e.console) ?? Ze(), n = this;
|
|
1236
1232
|
return {
|
|
1237
1233
|
setName(r) {
|
|
1238
1234
|
return t = r, this;
|
|
@@ -1314,50 +1310,48 @@ class Ze {
|
|
|
1314
1310
|
*
|
|
1315
1311
|
*/
|
|
1316
1312
|
constructView(t, e, s = []) {
|
|
1317
|
-
return new
|
|
1313
|
+
return new _e(i(this, g), t, e, s);
|
|
1318
1314
|
}
|
|
1319
1315
|
/**
|
|
1320
1316
|
*
|
|
1321
1317
|
*/
|
|
1322
1318
|
constructMarkup(t) {
|
|
1323
|
-
return
|
|
1319
|
+
return Le(Me(i(this, g), t));
|
|
1324
1320
|
}
|
|
1325
1321
|
}
|
|
1326
|
-
U = new WeakMap(), wt = new WeakMap(), C = new WeakMap(),
|
|
1327
|
-
function
|
|
1322
|
+
U = new WeakMap(), wt = new WeakMap(), C = new WeakMap(), B = new WeakMap(), pt = new WeakMap(), gt = new WeakMap(), Z = new WeakMap(), yt = new WeakMap(), bt = new WeakMap(), $t = new WeakMap(), Et = new WeakMap(), g = new WeakMap(), y = new WeakMap(), j = new WeakMap(), V = new WeakMap(), Ft = new WeakMap();
|
|
1323
|
+
function Ze() {
|
|
1328
1324
|
if (typeof window < "u" && window.console)
|
|
1329
1325
|
return window.console;
|
|
1330
1326
|
if (typeof global < "u" && global.console)
|
|
1331
1327
|
return global.console;
|
|
1332
1328
|
}
|
|
1333
|
-
const Xt = new
|
|
1334
|
-
function
|
|
1329
|
+
const Xt = new Ye(), rs = Xt.i18n.t.bind(Xt.i18n);
|
|
1330
|
+
function ns(o) {
|
|
1335
1331
|
typeof window < "u" && (window.DOLLA_DEV_DEBUG = o);
|
|
1336
1332
|
}
|
|
1337
|
-
function
|
|
1333
|
+
function is() {
|
|
1338
1334
|
return typeof window < "u" ? window.DOLLA_DEV_DEBUG === !0 : !1;
|
|
1339
1335
|
}
|
|
1340
1336
|
export {
|
|
1341
1337
|
pe as cond,
|
|
1342
|
-
|
|
1338
|
+
Se as createMarkup,
|
|
1343
1339
|
ve as createRef,
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
hs as createStore,
|
|
1347
|
-
cs as createView,
|
|
1340
|
+
ss as createRouter,
|
|
1341
|
+
Wt as createState,
|
|
1348
1342
|
we as deepEqual,
|
|
1349
1343
|
Xt as default,
|
|
1350
1344
|
x as derive,
|
|
1351
|
-
|
|
1352
|
-
|
|
1345
|
+
is as getDevDebug,
|
|
1346
|
+
Ht as html,
|
|
1353
1347
|
ke as isRef,
|
|
1354
1348
|
Ee as isState,
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1349
|
+
ls as portal,
|
|
1350
|
+
hs as repeat,
|
|
1351
|
+
ns as setDevDebug,
|
|
1352
|
+
Gt as shallowEqual,
|
|
1353
|
+
cs as strictEqual,
|
|
1354
|
+
rs as t,
|
|
1361
1355
|
be as toState,
|
|
1362
1356
|
$e as toValue
|
|
1363
1357
|
};
|