@manyducks.co/dolla 2.0.0-alpha.26 → 2.0.0-alpha.28
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 +6 -93
- package/dist/core/context.d.ts +88 -0
- package/dist/core/dolla.d.ts +33 -13
- package/dist/core/markup.d.ts +6 -23
- package/dist/core/nodes/dom.d.ts +13 -0
- package/dist/core/nodes/html.d.ts +7 -4
- package/dist/core/nodes/observer.d.ts +4 -3
- package/dist/core/nodes/outlet.d.ts +2 -2
- package/dist/core/nodes/portal.d.ts +5 -4
- package/dist/core/nodes/repeat.d.ts +4 -3
- package/dist/core/nodes/view.d.ts +17 -19
- package/dist/core/ref.d.ts +29 -0
- package/dist/core/state.d.ts +11 -44
- package/dist/core/stats.d.ts +31 -0
- package/dist/core/store.d.ts +44 -0
- package/dist/core/symbols.d.ts +6 -5
- package/dist/index.d.ts +5 -2
- package/dist/index.js +722 -659
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.js +2 -2
- package/dist/jsx-runtime.js +2 -2
- package/dist/modules/http.d.ts +3 -5
- package/dist/passthrough-1MySicTa.js +1476 -0
- package/dist/passthrough-1MySicTa.js.map +1 -0
- package/dist/types.d.ts +1 -2
- package/docs/setup.md +2 -1
- package/docs/state.md +133 -0
- package/notes/stores.md +73 -0
- package/package.json +2 -1
- package/dist/core/nodes/text.d.ts +0 -21
- package/dist/passthrough-CACEgFx5.js +0 -1301
- package/dist/passthrough-CACEgFx5.js.map +0 -1
- package/docs/states.md +0 -41
package/dist/index.js
CHANGED
|
@@ -1,144 +1,29 @@
|
|
|
1
1
|
var nt = Object.defineProperty;
|
|
2
|
-
var
|
|
2
|
+
var Ie = (o) => {
|
|
3
3
|
throw TypeError(o);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
set _(
|
|
10
|
-
|
|
5
|
+
var it = (o, e, t) => e in o ? nt(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
6
|
+
var d = (o, e, t) => it(o, typeof e != "symbol" ? e + "" : e, t), xe = (o, e, t) => e.has(o) || Ie("Cannot " + t);
|
|
7
|
+
var i = (o, e, t) => (xe(o, e, "read from private field"), t ? t.call(o) : e.get(o)), l = (o, e, t) => e.has(o) ? Ie("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(o) : e.set(o, t), m = (o, e, t, s) => (xe(o, e, "write to private field"), s ? s.call(o, t) : e.set(o, t), t), u = (o, e, t) => (xe(o, e, "access private method"), t);
|
|
8
|
+
var Z = (o, e, t, s) => ({
|
|
9
|
+
set _(r) {
|
|
10
|
+
m(o, e, r, t);
|
|
11
11
|
},
|
|
12
12
|
get _() {
|
|
13
|
-
return
|
|
13
|
+
return i(o, e, s);
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
<div
|
|
21
|
-
style=${{
|
|
22
|
-
backgroundColor: "#880000",
|
|
23
|
-
color: "#fff",
|
|
24
|
-
padding: "2rem",
|
|
25
|
-
position: "fixed",
|
|
26
|
-
inset: 0,
|
|
27
|
-
fontSize: "20px"
|
|
28
|
-
}}
|
|
29
|
-
>
|
|
30
|
-
<h1 style=${{ marginBottom: "0.5rem" }}>The app has crashed</h1>
|
|
31
|
-
<p style=${{ marginBottom: "0.25rem" }}>
|
|
32
|
-
<span style=${{ fontFamily: "monospace" }}>${o.loggerName}</span>
|
|
33
|
-
${it(o.uid, Ie`<span style=${{ fontFamily: "monospace", opacity: 0.5 }}> [uid: ${o.uid}]</span>`)}
|
|
34
|
-
${" "}says:
|
|
35
|
-
</p>
|
|
36
|
-
<blockquote
|
|
37
|
-
style=${{
|
|
38
|
-
backgroundColor: "#991111",
|
|
39
|
-
padding: "0.25em",
|
|
40
|
-
borderRadius: "6px",
|
|
41
|
-
fontFamily: "monospace",
|
|
42
|
-
marginBottom: "1rem"
|
|
43
|
-
}}
|
|
44
|
-
>
|
|
45
|
-
<span
|
|
46
|
-
style=${{
|
|
47
|
-
display: "inline-block",
|
|
48
|
-
backgroundColor: "red",
|
|
49
|
-
padding: "0.1em 0.4em",
|
|
50
|
-
marginRight: "0.5em",
|
|
51
|
-
borderRadius: "4px",
|
|
52
|
-
fontSize: "0.9em",
|
|
53
|
-
fontWeight: "bold"
|
|
54
|
-
}}
|
|
55
|
-
>
|
|
56
|
-
${o.error.name}
|
|
57
|
-
</span>
|
|
58
|
-
${o.error.message}
|
|
59
|
-
</blockquote>
|
|
60
|
-
|
|
61
|
-
<p>Please see the browser console for details.</p>
|
|
62
|
-
</div>
|
|
63
|
-
`;
|
|
64
|
-
}
|
|
65
|
-
var re, K, N, V, A, Q, Re, M, se, q, Ne, ve;
|
|
66
|
-
class bt {
|
|
16
|
+
import { i as Y, c as Ue, d as x, a as E, b as at, e as se, t as qe, f as Qe, g as ot, s as We, h as Ae, P as Je, j as Ge, k as lt, l as He, p as ht, m as Be, S as ct, n as ut, o as ft, q as dt, r as mt, u as wt, C as pt, v as gt, w as Fe, x as yt, y as ze, z as bt, A as be, B as $e, V as $t, D as vt, E as Et } from "./passthrough-1MySicTa.js";
|
|
17
|
+
import { F as Yt, J as Zt, H as es, I as ts, G as ss } from "./passthrough-1MySicTa.js";
|
|
18
|
+
var U, ke, Se, re, R, _;
|
|
19
|
+
class kt {
|
|
67
20
|
constructor(e) {
|
|
68
|
-
l(this,
|
|
21
|
+
l(this, R);
|
|
22
|
+
l(this, U, []);
|
|
23
|
+
l(this, ke, St());
|
|
24
|
+
l(this, Se);
|
|
69
25
|
l(this, re);
|
|
70
|
-
|
|
71
|
-
// Keys ensure only the most recent callback queued with a certain key
|
|
72
|
-
// will be called, keeping DOM operations to a minimum.
|
|
73
|
-
l(this, N, /* @__PURE__ */ new Map());
|
|
74
|
-
// All unkeyed writes are run on every batch.
|
|
75
|
-
l(this, V, []);
|
|
76
|
-
// All read callbacks are run before updates on every batch.
|
|
77
|
-
l(this, A, []);
|
|
78
|
-
l(this, Q, !1);
|
|
79
|
-
// When true, batches that would exceed 16ms will be split and deferred to a rAF.
|
|
80
|
-
// This may not be desirable, because while it does prevent hitching it sometimes leaves
|
|
81
|
-
// the state partially rendered for a brief second and certain elements can be seen to update after the fact.
|
|
82
|
-
// But the tradeoff here is snappier navigation with possibly slightly out of date DOM updates on heavy pages.
|
|
83
|
-
l(this, Re, !0);
|
|
84
|
-
l(this, M, 0);
|
|
85
|
-
l(this, se, new Intl.NumberFormat("en-US", { maximumFractionDigits: 2, minimumFractionDigits: 0 }));
|
|
86
|
-
g(this, re, e), g(this, K, e.createLogger("dolla/render"));
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Queues a callback that runs before the next batch of writes.
|
|
90
|
-
*/
|
|
91
|
-
read(e) {
|
|
92
|
-
a(this, A).push(e), d(this, q, Ne).call(this);
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Queues a callback to run in the next render batch.
|
|
96
|
-
* Always put DOM mutations in a write callback when possible to help Dolla batch them efficiently.
|
|
97
|
-
*/
|
|
98
|
-
write(e, t) {
|
|
99
|
-
t ? a(this, N).set(t, e) : a(this, V).push(e), d(this, q, Ne).call(this);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
re = new WeakMap(), K = new WeakMap(), N = new WeakMap(), V = new WeakMap(), A = new WeakMap(), Q = new WeakMap(), Re = new WeakMap(), M = new WeakMap(), se = new WeakMap(), q = new WeakSet(), Ne = function() {
|
|
103
|
-
if (!a(this, Q)) {
|
|
104
|
-
g(this, Q, !0);
|
|
105
|
-
const e = a(this, re).getEnv() === "development";
|
|
106
|
-
queueMicrotask(() => {
|
|
107
|
-
d(this, q, ve).call(this, e);
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
}, ve = function(e = !1) {
|
|
111
|
-
const t = performance.now();
|
|
112
|
-
let r = 0;
|
|
113
|
-
const n = a(this, A).length + a(this, N).size + a(this, V).length;
|
|
114
|
-
let s = 0;
|
|
115
|
-
const i = () => (s++, r = performance.now() - t, a(this, Re) && r > 12 && s < n ? (Y(this, M)._++, e && a(this, K).warn(
|
|
116
|
-
`⚠️ Deferring batch to next frame. Performed ${s} of ${n} batched operation${s === 1 ? "" : "s"} in ${a(this, se).format(r)}ms (deferral ${a(this, M)}).`
|
|
117
|
-
), requestAnimationFrame(() => {
|
|
118
|
-
d(this, q, ve).call(this, e);
|
|
119
|
-
}), !0) : !1), f = [...a(this, N).entries()];
|
|
120
|
-
let c, u;
|
|
121
|
-
for (; u = a(this, A).shift(); )
|
|
122
|
-
if (u(), i()) return;
|
|
123
|
-
for ([c, u] of f)
|
|
124
|
-
if (u(), a(this, N).delete(c), i()) return;
|
|
125
|
-
for (; u = a(this, V).shift(); )
|
|
126
|
-
if (u(), i()) return;
|
|
127
|
-
e && a(this, K)[r > 16 ? "warn" : "info"](
|
|
128
|
-
`${r > 16 ? "⚠️ (>=16ms) " : ""}Executed ${s} operation${s === 1 ? "" : "s"} in ${a(this, se).format(r)}ms${a(this, M) > 0 ? ` (after ${a(this, M)} deferral${a(this, M) === 1 ? "" : "s"})` : ""}.`
|
|
129
|
-
), g(this, M, 0), a(this, A).length || a(this, N).size || a(this, V).length ? queueMicrotask(() => {
|
|
130
|
-
d(this, q, ve).call(this, e);
|
|
131
|
-
}) : g(this, Q, !1);
|
|
132
|
-
};
|
|
133
|
-
var I, Se, Le, ne, S, L;
|
|
134
|
-
class $t {
|
|
135
|
-
constructor(e) {
|
|
136
|
-
l(this, S);
|
|
137
|
-
l(this, I, []);
|
|
138
|
-
l(this, Se, vt());
|
|
139
|
-
l(this, Le);
|
|
140
|
-
l(this, ne);
|
|
141
|
-
g(this, Le, e), g(this, ne, e.createLogger("dolla/http"));
|
|
26
|
+
m(this, Se, e), m(this, re, e.createLogger("Dolla.http"));
|
|
142
27
|
}
|
|
143
28
|
/**
|
|
144
29
|
* Adds a new middleware that will apply to subsequent requests.
|
|
@@ -147,295 +32,310 @@ class $t {
|
|
|
147
32
|
* @param middleware - A middleware function that will intercept requests.
|
|
148
33
|
*/
|
|
149
34
|
use(e) {
|
|
150
|
-
return
|
|
151
|
-
|
|
35
|
+
return i(this, U).push(e), () => {
|
|
36
|
+
i(this, U).splice(i(this, U).indexOf(e), 1);
|
|
152
37
|
};
|
|
153
38
|
}
|
|
154
39
|
async get(e, t) {
|
|
155
|
-
return
|
|
40
|
+
return u(this, R, _).call(this, "get", e, t);
|
|
156
41
|
}
|
|
157
42
|
async put(e, t) {
|
|
158
|
-
return
|
|
43
|
+
return u(this, R, _).call(this, "put", e, t);
|
|
159
44
|
}
|
|
160
45
|
async patch(e, t) {
|
|
161
|
-
return
|
|
46
|
+
return u(this, R, _).call(this, "patch", e, t);
|
|
162
47
|
}
|
|
163
48
|
async post(e, t) {
|
|
164
|
-
return
|
|
49
|
+
return u(this, R, _).call(this, "post", e, t);
|
|
165
50
|
}
|
|
166
51
|
async delete(e, t) {
|
|
167
|
-
return
|
|
52
|
+
return u(this, R, _).call(this, "delete", e, t);
|
|
168
53
|
}
|
|
169
54
|
async head(e, t) {
|
|
170
|
-
return
|
|
55
|
+
return u(this, R, _).call(this, "head", e, t);
|
|
171
56
|
}
|
|
172
57
|
async options(e, t) {
|
|
173
|
-
return
|
|
58
|
+
return u(this, R, _).call(this, "options", e, t);
|
|
174
59
|
}
|
|
175
60
|
async trace(e, t) {
|
|
176
|
-
return
|
|
61
|
+
return u(this, R, _).call(this, "trace", e, t);
|
|
177
62
|
}
|
|
178
63
|
}
|
|
179
|
-
|
|
180
|
-
return
|
|
181
|
-
...
|
|
64
|
+
U = new WeakMap(), ke = new WeakMap(), Se = new WeakMap(), re = new WeakMap(), R = new WeakSet(), _ = async function(e, t, s) {
|
|
65
|
+
return new Lt({
|
|
66
|
+
...s,
|
|
182
67
|
method: e,
|
|
183
68
|
uri: t,
|
|
184
|
-
middleware:
|
|
185
|
-
fetch:
|
|
186
|
-
logger:
|
|
187
|
-
});
|
|
69
|
+
middleware: i(this, U),
|
|
70
|
+
fetch: i(this, ke),
|
|
71
|
+
logger: i(this, re)
|
|
72
|
+
}).fetch();
|
|
188
73
|
};
|
|
189
|
-
function
|
|
74
|
+
function St() {
|
|
190
75
|
if (typeof window < "u" && window.fetch)
|
|
191
76
|
return window.fetch.bind(window);
|
|
192
77
|
if (typeof global < "u" && global.fetch)
|
|
193
78
|
return global.fetch.bind(global);
|
|
194
79
|
throw new Error("Running in neither browser nor node. Please run this app in one of the supported environments.");
|
|
195
80
|
}
|
|
196
|
-
class
|
|
81
|
+
class Rt extends Error {
|
|
197
82
|
constructor(t) {
|
|
198
|
-
const { status:
|
|
83
|
+
const { status: s, statusText: r, method: n, url: a } = t, f = `${s} ${r}: Request failed (${n.toUpperCase()} ${a.toString()})`;
|
|
199
84
|
super(f);
|
|
200
|
-
|
|
85
|
+
d(this, "response");
|
|
201
86
|
this.response = t;
|
|
202
87
|
}
|
|
203
88
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
if (e
|
|
217
|
-
e
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
89
|
+
class _t {
|
|
90
|
+
constructor(e) {
|
|
91
|
+
d(this, "method");
|
|
92
|
+
d(this, "url");
|
|
93
|
+
d(this, "headers", new Headers());
|
|
94
|
+
d(this, "body");
|
|
95
|
+
this.method = e.method, this.body = e.body, e.uri.startsWith("http") ? this.url = new URL(e.uri) : this.url = new URL(e.uri, window.location.origin), this._applyHeaders(e.headers), this._applyQueryParams(e.query);
|
|
96
|
+
}
|
|
97
|
+
get isSameOrigin() {
|
|
98
|
+
return this.url.origin === window.location.origin;
|
|
99
|
+
}
|
|
100
|
+
_applyHeaders(e) {
|
|
101
|
+
if (e != null)
|
|
102
|
+
if (e instanceof Map || e instanceof Headers)
|
|
103
|
+
e.forEach((t, s) => {
|
|
104
|
+
this.headers.set(s, t);
|
|
105
|
+
});
|
|
106
|
+
else if (Y(e))
|
|
107
|
+
for (const t in e) {
|
|
108
|
+
const s = e[t];
|
|
109
|
+
s instanceof Date ? this.headers.set(t, s.toISOString()) : s != null && this.headers.set(t, String(s));
|
|
110
|
+
}
|
|
111
|
+
else
|
|
112
|
+
throw new TypeError(`Unknown headers type. Got: ${e}`);
|
|
113
|
+
}
|
|
114
|
+
_applyQueryParams(e) {
|
|
115
|
+
if (e != null)
|
|
116
|
+
if (e instanceof Map || e instanceof URLSearchParams)
|
|
117
|
+
e.forEach((t, s) => {
|
|
118
|
+
this.url.searchParams.set(s, t);
|
|
119
|
+
});
|
|
120
|
+
else if (Y(e))
|
|
121
|
+
for (const t in e) {
|
|
122
|
+
const s = e[t];
|
|
123
|
+
s instanceof Date ? this.url.searchParams.set(t, s.toISOString()) : s != null && this.url.searchParams.set(t, String(s));
|
|
124
|
+
}
|
|
125
|
+
else
|
|
126
|
+
throw new TypeError(`Unknown query params type. Got: ${e}`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
class Lt {
|
|
130
|
+
constructor(e) {
|
|
131
|
+
d(this, "_middleware");
|
|
132
|
+
d(this, "_fetch");
|
|
133
|
+
d(this, "_request");
|
|
134
|
+
d(this, "_response");
|
|
135
|
+
this._middleware = e.middleware, this._fetch = e.fetch, this._request = new _t(e);
|
|
136
|
+
}
|
|
137
|
+
async fetch() {
|
|
138
|
+
if (this._middleware.length > 0) {
|
|
139
|
+
const e = (t = 0) => {
|
|
140
|
+
const s = this._middleware[t], r = this._middleware[t + 1] ? e(t + 1) : this._handler.bind(this);
|
|
141
|
+
return async () => s(this._request, async () => (await r(), this._response));
|
|
142
|
+
};
|
|
143
|
+
await e()();
|
|
144
|
+
} else
|
|
145
|
+
await this._handler();
|
|
146
|
+
if (this._response.status < 200 || this._response.status >= 400)
|
|
147
|
+
throw new Rt(this._response);
|
|
148
|
+
return this._response;
|
|
149
|
+
}
|
|
150
|
+
// This is the function that performs the actual request after the final middleware.
|
|
151
|
+
async _handler() {
|
|
152
|
+
let e;
|
|
153
|
+
const t = this._request;
|
|
154
|
+
!t.headers.has("content-type") && Y(t.body) ? (t.headers.set("content-type", "application/json"), e = JSON.stringify(t.body)) : e = t.body;
|
|
155
|
+
const s = await this._fetch(t.url.toString(), {
|
|
156
|
+
method: t.method,
|
|
157
|
+
headers: t.headers,
|
|
158
|
+
body: e
|
|
159
|
+
}), r = s.headers.get("content-type");
|
|
160
|
+
let n;
|
|
161
|
+
r != null && r.includes("application/json") ? n = await s.json() : r != null && r.includes("application/x-www-form-urlencoded") ? n = await s.formData() : n = await s.text(), this._response = {
|
|
162
|
+
method: t.method,
|
|
163
|
+
url: t.url,
|
|
164
|
+
status: s.status,
|
|
165
|
+
statusText: s.statusText,
|
|
166
|
+
headers: s.headers,
|
|
167
|
+
body: n
|
|
263
168
|
};
|
|
264
|
-
|
|
265
|
-
} else
|
|
266
|
-
await c();
|
|
267
|
-
if (f.status < 200 || f.status >= 400)
|
|
268
|
-
throw new Et(f);
|
|
269
|
-
return f;
|
|
169
|
+
}
|
|
270
170
|
}
|
|
271
|
-
var
|
|
272
|
-
class
|
|
171
|
+
var Re, K, B, De, Xe;
|
|
172
|
+
class Mt {
|
|
273
173
|
constructor(e, t) {
|
|
274
|
-
l(this,
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
l(this,
|
|
278
|
-
l(this,
|
|
174
|
+
l(this, B);
|
|
175
|
+
d(this, "dolla");
|
|
176
|
+
d(this, "config");
|
|
177
|
+
l(this, Re, !1);
|
|
178
|
+
l(this, K, /* @__PURE__ */ new Map());
|
|
279
179
|
this.config = e, this.dolla = t;
|
|
280
180
|
}
|
|
281
181
|
async load() {
|
|
282
182
|
let e;
|
|
283
|
-
if (!
|
|
284
|
-
if (
|
|
285
|
-
if (e = await this.config.fetch(), !
|
|
183
|
+
if (!i(this, Re)) {
|
|
184
|
+
if (se(this.config.fetch)) {
|
|
185
|
+
if (e = await this.config.fetch(), !Y(e))
|
|
286
186
|
throw new Error(`Fetch function did not return an object of language strings: ${e}`);
|
|
287
|
-
} else if (
|
|
187
|
+
} else if (E(this.config.path)) {
|
|
288
188
|
const t = await fetch(this.config.path);
|
|
289
189
|
if (t.ok) {
|
|
290
|
-
const
|
|
291
|
-
if (
|
|
292
|
-
e =
|
|
190
|
+
const s = await t.json();
|
|
191
|
+
if (Y(s))
|
|
192
|
+
e = s;
|
|
293
193
|
else
|
|
294
194
|
throw new Error(
|
|
295
|
-
`Language path '${this.config.path}' did not return an object of language strings: ${
|
|
195
|
+
`Language path '${this.config.path}' did not return an object of language strings: ${s}`
|
|
296
196
|
);
|
|
297
197
|
} else
|
|
298
198
|
throw new Error("HTTP request failed.");
|
|
299
199
|
}
|
|
300
200
|
}
|
|
301
201
|
if (e) {
|
|
302
|
-
const t =
|
|
303
|
-
for (const
|
|
304
|
-
|
|
202
|
+
const t = u(this, B, De).call(this, e);
|
|
203
|
+
for (const s of t)
|
|
204
|
+
i(this, K).set(s[0], s[1]);
|
|
305
205
|
} else
|
|
306
206
|
throw new Error("Language could not be loaded.");
|
|
307
207
|
}
|
|
308
208
|
getTemplate(e) {
|
|
309
|
-
return
|
|
209
|
+
return i(this, K).get(e) ?? {
|
|
310
210
|
segments: [{ type: 0, text: `[MISSING: ${e}]` }]
|
|
311
211
|
};
|
|
312
212
|
}
|
|
313
213
|
hasTemplate(e) {
|
|
314
|
-
return
|
|
214
|
+
return i(this, K).has(e);
|
|
315
215
|
}
|
|
316
216
|
}
|
|
317
|
-
|
|
318
|
-
const
|
|
319
|
-
for (const
|
|
320
|
-
switch (
|
|
217
|
+
Re = new WeakMap(), K = new WeakMap(), B = new WeakSet(), De = function(e, t = []) {
|
|
218
|
+
const s = [];
|
|
219
|
+
for (const r in e)
|
|
220
|
+
switch (qe(e[r])) {
|
|
321
221
|
case "string":
|
|
322
|
-
|
|
222
|
+
s.push([[...t, r].join("."), u(this, B, Xe).call(this, e[r])]);
|
|
323
223
|
break;
|
|
324
224
|
case "object":
|
|
325
|
-
|
|
225
|
+
s.push(...u(this, B, De).call(this, e[r], [...t, r]));
|
|
326
226
|
break;
|
|
327
227
|
default:
|
|
328
228
|
throw new Error(
|
|
329
|
-
`Expected to find a string or object at ${[...t,
|
|
229
|
+
`Expected to find a string or object at ${[...t, r].join(".")}. Got: ${qe(e[r])}`
|
|
330
230
|
);
|
|
331
231
|
}
|
|
332
|
-
return
|
|
232
|
+
return s;
|
|
333
233
|
}, Xe = function(e) {
|
|
334
234
|
let t;
|
|
335
|
-
((
|
|
336
|
-
|
|
235
|
+
((c) => {
|
|
236
|
+
c[c.Static = 0] = "Static", c[c.ValueName = 1] = "ValueName", c[c.FormatName = 2] = "FormatName", c[c.FormatOptionName = 3] = "FormatOptionName", c[c.FormatOptionValue = 4] = "FormatOptionValue", c[c.FormatOptionEnd = 5] = "FormatOptionEnd";
|
|
337
237
|
})(t || (t = {}));
|
|
338
|
-
const
|
|
238
|
+
const s = {
|
|
339
239
|
segments: []
|
|
340
240
|
};
|
|
341
|
-
let
|
|
342
|
-
const
|
|
241
|
+
let r = "", n = 0, a = 0, f, h, w;
|
|
242
|
+
const v = () => {
|
|
343
243
|
f = {
|
|
344
244
|
type: 1,
|
|
345
245
|
name: "",
|
|
346
246
|
formats: []
|
|
347
247
|
};
|
|
348
|
-
},
|
|
349
|
-
|
|
248
|
+
}, k = () => {
|
|
249
|
+
h = {
|
|
350
250
|
name: "",
|
|
351
251
|
options: {}
|
|
352
252
|
};
|
|
353
253
|
};
|
|
354
|
-
for (;
|
|
355
|
-
if (
|
|
356
|
-
|
|
254
|
+
for (; n < e.length; ) {
|
|
255
|
+
if (a !== 0 && e[n] === " ") {
|
|
256
|
+
n++;
|
|
357
257
|
continue;
|
|
358
258
|
}
|
|
359
|
-
switch (
|
|
259
|
+
switch (a) {
|
|
360
260
|
case 0:
|
|
361
|
-
e[
|
|
261
|
+
e[n] === "{" && e[n + 1] === "{" ? (a = 1, n += 2, r.length > 0 && (s.segments.push({ type: 0, text: r }), r = ""), v()) : (r += e[n], n++);
|
|
362
262
|
break;
|
|
363
263
|
case 1:
|
|
364
|
-
e[
|
|
264
|
+
e[n] === "|" ? (a = 2, n += 1, f.name = r, r = "", k()) : e[n] === "}" && e[n + 1] === "}" ? (a = 0, n += 2, f.name = r, r = "", s.segments.push(f)) : (r += e[n], n++);
|
|
365
265
|
break;
|
|
366
266
|
case 2:
|
|
367
|
-
e[
|
|
267
|
+
e[n] === "(" ? (a = 3, n += 1, h.name = r, r = "") : e[n] === "}" && e[n + 1] === "}" ? (a = 0, n += 2, f.formats.push(h), s.segments.push(f)) : (r += e[n], n++);
|
|
368
268
|
break;
|
|
369
269
|
case 3:
|
|
370
|
-
e[
|
|
270
|
+
e[n] === ")" || (e[n] === ":" ? (a = 4, n += 1, w = r, r = "") : e[n] === "}" && e[n + 1] === "}" || (r += e[n], n++));
|
|
371
271
|
break;
|
|
372
272
|
case 4:
|
|
373
|
-
e[
|
|
273
|
+
e[n] === ")" ? (a = 5, n += 1, h.options[w] = r, r = "", f.formats.push(h)) : e[n] === "," ? (a = 3, n += 1, h.options[w] = r, r = "") : e[n] === "}" && e[n + 1] === "}" || (r += e[n], n++);
|
|
374
274
|
break;
|
|
375
275
|
case 5:
|
|
376
|
-
e[
|
|
276
|
+
e[n] === "|" ? (a = 2, n += 1, k()) : e[n] === "}" && e[n + 1] === "}" && (a = 0, n += 2, s.segments.push(f));
|
|
377
277
|
break;
|
|
378
278
|
}
|
|
379
279
|
}
|
|
380
|
-
return
|
|
280
|
+
return a === 0 && r.length > 0 && s.segments.push({ type: 0, text: r }), s;
|
|
381
281
|
};
|
|
382
|
-
var
|
|
383
|
-
class
|
|
282
|
+
var ne, P, y, ie, ae, oe, le, b, Ye, Pe, Ne, Te, Ze;
|
|
283
|
+
class xt {
|
|
384
284
|
constructor(e) {
|
|
385
|
-
l(this,
|
|
386
|
-
l(this,
|
|
285
|
+
l(this, b);
|
|
286
|
+
l(this, ne);
|
|
387
287
|
l(this, P);
|
|
388
|
-
l(this,
|
|
288
|
+
l(this, y, /* @__PURE__ */ new Map());
|
|
389
289
|
l(this, ie, []);
|
|
390
|
-
l(this,
|
|
391
|
-
l(this,
|
|
392
|
-
|
|
393
|
-
l(this,
|
|
394
|
-
|
|
395
|
-
const [t,
|
|
396
|
-
this.$locale = t,
|
|
397
|
-
|
|
290
|
+
l(this, ae, /* @__PURE__ */ new Map());
|
|
291
|
+
l(this, oe, "auto");
|
|
292
|
+
d(this, "$locale");
|
|
293
|
+
l(this, le);
|
|
294
|
+
m(this, ne, e), m(this, P, e.createLogger("Dolla.i18n"));
|
|
295
|
+
const [t, s] = Ue();
|
|
296
|
+
this.$locale = t, m(this, le, s), this.addFormat("number", (r, n, a) => u(this, b, Pe).call(this, Number(n), a)), this.addFormat("datetime", (r, n, a) => u(this, b, Ne).call(this, n, a)), this.addFormat("list", (r, n, a) => u(this, b, Te).call(this, n, a)), e.beforeMount(async () => {
|
|
297
|
+
i(this, y).size > 0 && await this.setLocale(i(this, oe));
|
|
398
298
|
});
|
|
399
299
|
}
|
|
400
300
|
get locales() {
|
|
401
|
-
return [...
|
|
301
|
+
return [...i(this, y).keys()];
|
|
402
302
|
}
|
|
403
303
|
setup(e) {
|
|
404
304
|
if (e.translations.forEach((t) => {
|
|
405
|
-
|
|
305
|
+
i(this, y).set(t.locale, new Mt(t, i(this, ne)));
|
|
406
306
|
}), e.locale && e.locale !== "auto") {
|
|
407
|
-
if (!e.translations.some((
|
|
307
|
+
if (!e.translations.some((s) => s.locale === e.locale))
|
|
408
308
|
throw new Error(`Initial locale '${e.locale}' is not registered in the locales array.`);
|
|
409
|
-
|
|
309
|
+
m(this, oe, e.locale);
|
|
410
310
|
}
|
|
411
|
-
|
|
412
|
-
`${
|
|
311
|
+
i(this, P).info(
|
|
312
|
+
`${i(this, y).size} language${i(this, y).size === 1 ? "" : "s"} supported: '${[...i(this, y).keys()].join("', '")}'`
|
|
413
313
|
);
|
|
414
314
|
}
|
|
415
315
|
async setLocale(e) {
|
|
416
|
-
var
|
|
316
|
+
var r;
|
|
417
317
|
let t;
|
|
418
318
|
if (e === "auto") {
|
|
419
|
-
let
|
|
319
|
+
let n = [];
|
|
420
320
|
if (typeof navigator < "u") {
|
|
421
|
-
const
|
|
422
|
-
((
|
|
321
|
+
const a = navigator;
|
|
322
|
+
((r = a.languages) == null ? void 0 : r.length) > 0 ? n.push(...a.languages) : a.language ? n.push(a.language) : a.browserLanguage ? n.push(a.browserLanguage) : a.userLanguage && n.push(a.userLanguage);
|
|
423
323
|
}
|
|
424
|
-
for (const
|
|
425
|
-
|
|
324
|
+
for (const a of n)
|
|
325
|
+
i(this, y).has(a) && (t = a);
|
|
426
326
|
} else
|
|
427
|
-
|
|
327
|
+
i(this, y).has(e) && (t = e);
|
|
428
328
|
if (t == null) {
|
|
429
|
-
const
|
|
430
|
-
|
|
329
|
+
const n = i(this, y).keys().next().value;
|
|
330
|
+
n && (t = n);
|
|
431
331
|
}
|
|
432
|
-
if (!t || !
|
|
332
|
+
if (!t || !i(this, y).has(t))
|
|
433
333
|
throw new Error(`Locale '${e}' has no translation.`);
|
|
434
|
-
const
|
|
334
|
+
const s = i(this, y).get(t);
|
|
435
335
|
try {
|
|
436
|
-
await
|
|
437
|
-
} catch (
|
|
438
|
-
|
|
336
|
+
await s.load(), m(this, ie, []), i(this, le).call(this, t), i(this, P).info("set language to " + t);
|
|
337
|
+
} catch (n) {
|
|
338
|
+
n instanceof Error && i(this, P).crash(n);
|
|
439
339
|
}
|
|
440
340
|
}
|
|
441
341
|
/**
|
|
@@ -452,16 +352,16 @@ class St {
|
|
|
452
352
|
throw new Error(
|
|
453
353
|
`The 't' function cannot be destructured. If you need a standalone version you can import it like so: 'import { t } from "@manyducks.co/dolla"'`
|
|
454
354
|
);
|
|
455
|
-
let
|
|
456
|
-
for (const
|
|
457
|
-
|
|
458
|
-
return
|
|
459
|
-
if (
|
|
355
|
+
let s = [], r = [];
|
|
356
|
+
for (const n in t)
|
|
357
|
+
s.push(n), r.push(t[n]);
|
|
358
|
+
return x([this.$locale, ...r], (n, ...a) => {
|
|
359
|
+
if (n == null)
|
|
460
360
|
return "[NO LOCALE SET]";
|
|
461
361
|
const f = {};
|
|
462
|
-
for (let
|
|
463
|
-
f[
|
|
464
|
-
return
|
|
362
|
+
for (let h = 0; h < a.length; h++)
|
|
363
|
+
f[s[h]] = a[h];
|
|
364
|
+
return u(this, b, Ye).call(this, n, e, f);
|
|
465
365
|
});
|
|
466
366
|
}
|
|
467
367
|
/**
|
|
@@ -479,7 +379,7 @@ class St {
|
|
|
479
379
|
* t("greeting", {name: "world"}); // State<"Hello, WORLD!">
|
|
480
380
|
*/
|
|
481
381
|
addFormat(e, t) {
|
|
482
|
-
|
|
382
|
+
i(this, ae).set(e, t);
|
|
483
383
|
}
|
|
484
384
|
/**
|
|
485
385
|
* Creates an `Intl.Collator` configured for the current locale.
|
|
@@ -496,7 +396,7 @@ class St {
|
|
|
496
396
|
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options
|
|
497
397
|
*/
|
|
498
398
|
number(e, t) {
|
|
499
|
-
return
|
|
399
|
+
return x([this.$locale, e], (s, r) => u(this, b, Pe).call(this, r, t));
|
|
500
400
|
}
|
|
501
401
|
/**
|
|
502
402
|
* Returns a State containing the date formatted for the current locale. Uses `Intl.DateTimeFormat` under the hood.
|
|
@@ -508,7 +408,7 @@ class St {
|
|
|
508
408
|
* const $formatted = Dolla.i18n.dateTime(date, { dateFormat: "short" });
|
|
509
409
|
*/
|
|
510
410
|
dateTime(e, t) {
|
|
511
|
-
return
|
|
411
|
+
return x([this.$locale, e], (s, r) => u(this, b, Ne).call(this, r, t));
|
|
512
412
|
}
|
|
513
413
|
/**
|
|
514
414
|
* Returns a State containing the date formatted for the current locale. Uses `Intl.DateTimeFormat` under the hood.
|
|
@@ -520,263 +420,263 @@ class St {
|
|
|
520
420
|
* const $formatted = Dolla.i18n.list(list, { });
|
|
521
421
|
*/
|
|
522
422
|
list(e, t) {
|
|
523
|
-
return
|
|
423
|
+
return x([this.$locale, e], (s, r) => u(this, b, Te).call(this, r, t));
|
|
524
424
|
}
|
|
525
425
|
}
|
|
526
|
-
|
|
527
|
-
var
|
|
528
|
-
const
|
|
529
|
-
if (
|
|
530
|
-
const
|
|
531
|
-
if (
|
|
532
|
-
if (
|
|
533
|
-
const
|
|
534
|
-
|
|
426
|
+
ne = new WeakMap(), P = new WeakMap(), y = new WeakMap(), ie = new WeakMap(), ae = new WeakMap(), oe = new WeakMap(), le = new WeakMap(), b = new WeakSet(), Ye = function(e, t, s) {
|
|
427
|
+
var h;
|
|
428
|
+
const r = u(this, b, Ze).call(this, t, s);
|
|
429
|
+
if (r) return r;
|
|
430
|
+
const n = i(this, y).get(e);
|
|
431
|
+
if (s.context != null && (t += "_" + s.context), s.count != null)
|
|
432
|
+
if (s.ordinal) {
|
|
433
|
+
const w = `${t}_ordinal_(=${s.count})`;
|
|
434
|
+
n.hasTemplate(w) ? t = w : t += "_ordinal_" + new Intl.PluralRules(e, { type: "ordinal" }).select(s.count);
|
|
535
435
|
} else {
|
|
536
|
-
const
|
|
537
|
-
|
|
436
|
+
const w = `${t}_(=${s.count})`;
|
|
437
|
+
n.hasTemplate(w) ? t = w : t += "_" + new Intl.PluralRules(e).select(s.count);
|
|
538
438
|
}
|
|
539
|
-
const
|
|
439
|
+
const a = n.getTemplate(t);
|
|
540
440
|
let f = "";
|
|
541
|
-
for (const
|
|
542
|
-
if (
|
|
543
|
-
f +=
|
|
544
|
-
else if (
|
|
545
|
-
let
|
|
546
|
-
const
|
|
547
|
-
|
|
548
|
-
for (const
|
|
549
|
-
const
|
|
550
|
-
if (
|
|
551
|
-
const
|
|
552
|
-
`Failed to load format '${
|
|
441
|
+
for (const w of a.segments)
|
|
442
|
+
if (w.type === 0)
|
|
443
|
+
f += w.text;
|
|
444
|
+
else if (w.type === 1) {
|
|
445
|
+
let v = Ft(s, w.name);
|
|
446
|
+
const k = ((h = s.formatOverrides) == null ? void 0 : h[w.name]) ?? [...w.formats];
|
|
447
|
+
w.name === "count" && k.length === 0 && k.push({ name: "number", options: {} });
|
|
448
|
+
for (const c of k) {
|
|
449
|
+
const D = i(this, ae).get(c.name);
|
|
450
|
+
if (D == null) {
|
|
451
|
+
const S = new Error(
|
|
452
|
+
`Failed to load format '${c.name}' when processing '${t}', template: ${a}`
|
|
553
453
|
);
|
|
554
|
-
throw
|
|
454
|
+
throw i(this, P).crash(S), S;
|
|
555
455
|
}
|
|
556
|
-
|
|
456
|
+
v = D(e, v, c.options);
|
|
557
457
|
}
|
|
558
|
-
f +=
|
|
458
|
+
f += v;
|
|
559
459
|
}
|
|
560
460
|
return f;
|
|
561
|
-
},
|
|
461
|
+
}, Pe = function(e, t) {
|
|
562
462
|
return new Intl.NumberFormat(this.$locale.get(), t).format(e);
|
|
563
|
-
},
|
|
564
|
-
return new Intl.DateTimeFormat(this.$locale.get(), t).format(
|
|
565
|
-
},
|
|
463
|
+
}, Ne = function(e, t) {
|
|
464
|
+
return new Intl.DateTimeFormat(this.$locale.get(), t).format(E(e) ? new Date(e) : e);
|
|
465
|
+
}, Te = function(e, t) {
|
|
566
466
|
return new Intl.ListFormat(this.$locale.get(), t).format(e);
|
|
567
467
|
}, // relativeTime(): State<string> {
|
|
568
468
|
// }
|
|
569
469
|
Ze = function(e, t) {
|
|
570
|
-
for (const
|
|
571
|
-
if (
|
|
572
|
-
return
|
|
470
|
+
for (const s of i(this, ie))
|
|
471
|
+
if (s[0] === e && at(s[1], t))
|
|
472
|
+
return s[2];
|
|
573
473
|
};
|
|
574
|
-
function
|
|
575
|
-
const t = String(e).split(/[\.\[\]]/).filter((
|
|
576
|
-
let
|
|
474
|
+
function Ft(o, e) {
|
|
475
|
+
const t = String(e).split(/[\.\[\]]/).filter((r) => r.trim() !== "");
|
|
476
|
+
let s = o;
|
|
577
477
|
for (; t.length > 0; ) {
|
|
578
|
-
const
|
|
579
|
-
|
|
478
|
+
const r = t.shift();
|
|
479
|
+
s != null ? s = s[r] : s = void 0;
|
|
580
480
|
}
|
|
581
|
-
return
|
|
481
|
+
return s;
|
|
582
482
|
}
|
|
583
|
-
function
|
|
483
|
+
function te(o) {
|
|
584
484
|
return Qe(o, "Expected `path` to be a string. Got type: %t, value: %v"), o.split("/").map((e) => e.trim()).filter((e) => e !== "");
|
|
585
485
|
}
|
|
586
|
-
function
|
|
486
|
+
function z(o) {
|
|
587
487
|
var t;
|
|
588
|
-
|
|
589
|
-
(
|
|
488
|
+
ot(
|
|
489
|
+
(s) => se(s == null ? void 0 : s.toString),
|
|
590
490
|
o,
|
|
591
491
|
"Expected `parts` to be an array of objects with a .toString() method. Got type: %t, value: %v"
|
|
592
|
-
), o = o.filter((
|
|
492
|
+
), o = o.filter((s) => s).flatMap(String);
|
|
593
493
|
let e = (t = o.shift()) == null ? void 0 : t.toString();
|
|
594
494
|
if (e) {
|
|
595
|
-
for (const
|
|
596
|
-
|
|
495
|
+
for (const s of o.map((r) => r.toString()))
|
|
496
|
+
s.startsWith(".") ? e = ve(e, s) : e[e.length - 1] !== "/" ? s[0] !== "/" ? e += "/" + s : e += s : s[0] === "/" ? e += s.slice(1) : e += s;
|
|
597
497
|
e && e !== "/" && e.endsWith("/") && (e = e.slice(0, e.length - 1));
|
|
598
498
|
}
|
|
599
499
|
return e ?? "";
|
|
600
500
|
}
|
|
601
|
-
function
|
|
501
|
+
function ve(o, e) {
|
|
602
502
|
if (Qe(o, "Expected `base` to be a string. Got type: %t, value: %v"), e == null && (e = o, o = ""), e.startsWith("/"))
|
|
603
503
|
return e;
|
|
604
504
|
let t = o;
|
|
605
505
|
for (; ; )
|
|
606
506
|
if (e.startsWith("..")) {
|
|
607
|
-
for (let
|
|
608
|
-
if (t[
|
|
609
|
-
t = t.slice(0,
|
|
507
|
+
for (let s = t.length; s > 0; --s)
|
|
508
|
+
if (t[s] === "/" || s === 0) {
|
|
509
|
+
t = t.slice(0, s), e = e.replace(/^\.\.\/?/, "");
|
|
610
510
|
break;
|
|
611
511
|
}
|
|
612
512
|
} else if (e.startsWith("."))
|
|
613
513
|
e = e.replace(/^\.\/?/, "");
|
|
614
514
|
else
|
|
615
515
|
break;
|
|
616
|
-
return
|
|
516
|
+
return z([t, e]);
|
|
617
517
|
}
|
|
618
|
-
function
|
|
518
|
+
function Dt(o) {
|
|
619
519
|
if (!o) return {};
|
|
620
520
|
o.startsWith("?") && (o = o.slice(1));
|
|
621
521
|
const e = o.split("&").filter((t) => t.trim() !== "").map((t) => {
|
|
622
|
-
const [
|
|
623
|
-
return
|
|
522
|
+
const [s, r] = t.split("=").map((n) => n.trim());
|
|
523
|
+
return r.toLowerCase() === "true" ? [s, !0] : r.toLowerCase() === "false" ? [s, !1] : isNaN(Number(r)) ? [s, r] : [s, Number(r)];
|
|
624
524
|
});
|
|
625
525
|
return Object.fromEntries(e);
|
|
626
526
|
}
|
|
627
527
|
function et(o, e, t = {}) {
|
|
628
|
-
var
|
|
629
|
-
const [
|
|
528
|
+
var a;
|
|
529
|
+
const [s, r] = e.split("?"), n = te(s);
|
|
630
530
|
e: for (const f of o) {
|
|
631
|
-
const { fragments:
|
|
632
|
-
if (!(((
|
|
531
|
+
const { fragments: h } = f;
|
|
532
|
+
if (!(((a = h[h.length - 1]) == null ? void 0 : a.type) === 3) && h.length !== n.length || t.willMatch && !t.willMatch(f))
|
|
633
533
|
continue e;
|
|
634
|
-
const
|
|
635
|
-
t: for (let
|
|
636
|
-
const
|
|
637
|
-
if (
|
|
534
|
+
const v = [];
|
|
535
|
+
t: for (let c = 0; c < h.length; c++) {
|
|
536
|
+
const D = n[c], S = h[c];
|
|
537
|
+
if (D == null && S.type !== 3)
|
|
638
538
|
continue e;
|
|
639
|
-
switch (
|
|
539
|
+
switch (S.type) {
|
|
640
540
|
case 1:
|
|
641
|
-
if (
|
|
642
|
-
|
|
541
|
+
if (S.name.toLowerCase() === D.toLowerCase()) {
|
|
542
|
+
v.push(S);
|
|
643
543
|
break;
|
|
644
544
|
} else
|
|
645
545
|
continue e;
|
|
646
546
|
case 2:
|
|
647
|
-
|
|
547
|
+
v.push({ ...S, value: D });
|
|
648
548
|
break;
|
|
649
549
|
case 3:
|
|
650
|
-
|
|
550
|
+
v.push({ ...S, value: n.slice(c).join("/") });
|
|
651
551
|
break t;
|
|
652
552
|
case 4:
|
|
653
|
-
if (isNaN(Number(
|
|
553
|
+
if (isNaN(Number(D)))
|
|
654
554
|
continue e;
|
|
655
|
-
|
|
555
|
+
v.push({ ...S, value: Number(D) });
|
|
656
556
|
break;
|
|
657
557
|
default:
|
|
658
|
-
throw new Error(`Unknown fragment type: ${
|
|
558
|
+
throw new Error(`Unknown fragment type: ${S.type}`);
|
|
659
559
|
}
|
|
660
560
|
}
|
|
661
|
-
const
|
|
662
|
-
for (const
|
|
663
|
-
|
|
561
|
+
const k = {};
|
|
562
|
+
for (const c of v)
|
|
563
|
+
c.type === 2 && (k[c.name] = decodeURIComponent(c.value)), c.type === 4 && (k[c.name] = c.value), c.type === 3 && (k.wildcard = "/" + decodeURIComponent(c.value));
|
|
664
564
|
return {
|
|
665
|
-
path: "/" +
|
|
666
|
-
pattern: "/" +
|
|
667
|
-
params:
|
|
668
|
-
query:
|
|
565
|
+
path: "/" + v.map((c) => c.value).join("/"),
|
|
566
|
+
pattern: "/" + h.map((c) => c.type === 2 ? `{${c.name}}` : c.type === 4 ? `{#${c.name}}` : c.name).join("/"),
|
|
567
|
+
params: k,
|
|
568
|
+
query: Dt(r),
|
|
669
569
|
meta: f.meta
|
|
670
570
|
};
|
|
671
571
|
}
|
|
672
572
|
}
|
|
673
|
-
function
|
|
674
|
-
const e = [], t = [],
|
|
675
|
-
for (const
|
|
676
|
-
const { fragments: f } =
|
|
573
|
+
function Pt(o) {
|
|
574
|
+
const e = [], t = [], s = [], r = [];
|
|
575
|
+
for (const a of o) {
|
|
576
|
+
const { fragments: f } = a;
|
|
677
577
|
f.some(
|
|
678
|
-
(
|
|
578
|
+
(h) => h.type === 3
|
|
679
579
|
/* Wildcard */
|
|
680
|
-
) ?
|
|
681
|
-
(
|
|
580
|
+
) ? r.push(a) : f.some(
|
|
581
|
+
(h) => h.type === 4
|
|
682
582
|
/* NumericParam */
|
|
683
|
-
) ? t.push(
|
|
684
|
-
(
|
|
583
|
+
) ? t.push(a) : f.some(
|
|
584
|
+
(h) => h.type === 2
|
|
685
585
|
/* Param */
|
|
686
|
-
) ?
|
|
586
|
+
) ? s.push(a) : e.push(a);
|
|
687
587
|
}
|
|
688
|
-
const
|
|
689
|
-
return e.sort(
|
|
588
|
+
const n = (a, f) => a.fragments.length > f.fragments.length ? -1 : 1;
|
|
589
|
+
return e.sort(n), t.sort(n), s.sort(n), r.sort(n), [...e, ...t, ...s, ...r];
|
|
690
590
|
}
|
|
691
|
-
function
|
|
692
|
-
const e =
|
|
693
|
-
for (let
|
|
694
|
-
const
|
|
695
|
-
if (
|
|
696
|
-
if (
|
|
591
|
+
function Nt(o) {
|
|
592
|
+
const e = te(o), t = [];
|
|
593
|
+
for (let s = 0; s < e.length; s++) {
|
|
594
|
+
const r = e[s];
|
|
595
|
+
if (r === "*") {
|
|
596
|
+
if (s !== e.length - 1)
|
|
697
597
|
throw new Error(`Wildcard must be at the end of a pattern. Received: ${o}`);
|
|
698
598
|
t.push({
|
|
699
599
|
type: 3,
|
|
700
600
|
name: "*",
|
|
701
601
|
value: null
|
|
702
602
|
});
|
|
703
|
-
} else
|
|
704
|
-
type:
|
|
705
|
-
name:
|
|
603
|
+
} else r.at(0) === "{" && r.at(-1) === "}" ? t.push({
|
|
604
|
+
type: r[1] === "#" ? 4 : 2,
|
|
605
|
+
name: r[1] === "#" ? r.slice(2, -1) : r.slice(1, -1),
|
|
706
606
|
value: null
|
|
707
607
|
}) : t.push({
|
|
708
608
|
type: 1,
|
|
709
|
-
name:
|
|
710
|
-
value:
|
|
609
|
+
name: r,
|
|
610
|
+
value: r
|
|
711
611
|
});
|
|
712
612
|
}
|
|
713
613
|
return t;
|
|
714
614
|
}
|
|
715
|
-
var
|
|
716
|
-
class
|
|
615
|
+
var I, L, _e, N, Q, q, W, T, he, p, Ce, tt, st, ee, Oe, rt, je;
|
|
616
|
+
class Tt {
|
|
717
617
|
constructor(e) {
|
|
718
|
-
l(this,
|
|
719
|
-
l(this,
|
|
720
|
-
l(this,
|
|
721
|
-
l(this,
|
|
722
|
-
l(this,
|
|
723
|
-
l(this,
|
|
618
|
+
l(this, p);
|
|
619
|
+
l(this, I);
|
|
620
|
+
l(this, L);
|
|
621
|
+
l(this, _e, 0);
|
|
622
|
+
l(this, N, []);
|
|
623
|
+
l(this, Q, []);
|
|
724
624
|
/**
|
|
725
625
|
* Use hash routing when true. Configured in router options.
|
|
726
626
|
*/
|
|
727
|
-
l(this,
|
|
627
|
+
l(this, q, !1);
|
|
728
628
|
// Callbacks that need to be called on unmount.
|
|
729
|
-
l(this,
|
|
629
|
+
l(this, W, []);
|
|
730
630
|
/**
|
|
731
631
|
* The current match object.
|
|
732
632
|
*/
|
|
733
|
-
l(this,
|
|
633
|
+
l(this, T);
|
|
734
634
|
l(this, he);
|
|
735
635
|
/**
|
|
736
636
|
* The currently matched route pattern, if any.
|
|
737
637
|
*/
|
|
738
|
-
|
|
638
|
+
d(this, "$pattern");
|
|
739
639
|
/**
|
|
740
640
|
* The current URL path.
|
|
741
641
|
*/
|
|
742
|
-
|
|
642
|
+
d(this, "$path");
|
|
743
643
|
/**
|
|
744
644
|
* The current named path params.
|
|
745
645
|
*/
|
|
746
|
-
|
|
646
|
+
d(this, "$params");
|
|
747
647
|
/**
|
|
748
648
|
* The current query params. Changes to this object will be reflected in the URL.
|
|
749
649
|
*/
|
|
750
|
-
|
|
751
|
-
|
|
650
|
+
d(this, "$query");
|
|
651
|
+
m(this, I, e), m(this, L, e.createLogger("Dolla.router")), [Z(this, T)._, Z(this, he)._] = Ue(), this.$pattern = x([i(this, T)], (t) => t == null ? void 0 : t.pattern), this.$path = x([i(this, T)], (t) => (t == null ? void 0 : t.path) ?? window.location.pathname), this.$params = x([i(this, T)], (t) => (t == null ? void 0 : t.params) ?? {}, { equals: We }), this.$query = x([i(this, T)], (t) => (t == null ? void 0 : t.query) ?? {}, { equals: We }), e.beforeMount(async () => {
|
|
752
652
|
const t = () => {
|
|
753
|
-
|
|
653
|
+
u(this, p, ee).call(this);
|
|
754
654
|
};
|
|
755
|
-
window.addEventListener("popstate", t),
|
|
756
|
-
const
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
let
|
|
760
|
-
|
|
655
|
+
window.addEventListener("popstate", t), i(this, W).push(() => window.removeEventListener("popstate", t));
|
|
656
|
+
const s = e.getRootElement();
|
|
657
|
+
i(this, W).push(
|
|
658
|
+
jt(s, (r) => {
|
|
659
|
+
let n = r.getAttribute("href");
|
|
660
|
+
i(this, L).info("intercepted click on <a> tag", r), /^https?:\/\/|^\//.test(n) || (n = z([window.location.pathname, n])), u(this, p, Ce).call(this, n);
|
|
761
661
|
})
|
|
762
|
-
),
|
|
662
|
+
), i(this, L).info("will intercept clicks on <a> tags within root element", s), await u(this, p, ee).call(this);
|
|
763
663
|
}), e.onUnmount(() => {
|
|
764
|
-
for (const t of
|
|
664
|
+
for (const t of i(this, W))
|
|
765
665
|
t();
|
|
766
|
-
|
|
666
|
+
m(this, W, []);
|
|
767
667
|
});
|
|
768
668
|
}
|
|
769
669
|
async setup(e) {
|
|
770
|
-
|
|
771
|
-
!
|
|
670
|
+
Ae(e != null, "Options object must not be null. Got: %t"), Ae(
|
|
671
|
+
!i(this, I).isMounted,
|
|
772
672
|
"Dolla is already mounted. Dolla.router.setup() must be called before Dolla.mount()."
|
|
773
|
-
), e.hash &&
|
|
774
|
-
e.routes.flatMap((t) =>
|
|
673
|
+
), e.hash && m(this, q, !0), m(this, Q, Pt(
|
|
674
|
+
e.routes.flatMap((t) => u(this, p, je).call(this, t)).map((t) => ({
|
|
775
675
|
pattern: t.pattern,
|
|
776
676
|
meta: t.meta,
|
|
777
|
-
fragments:
|
|
677
|
+
fragments: Nt(t.pattern)
|
|
778
678
|
}))
|
|
779
|
-
)),
|
|
679
|
+
)), Ut(i(this, Q));
|
|
780
680
|
}
|
|
781
681
|
/**
|
|
782
682
|
* Navigate backward. Pass a number of steps to hit the back button that many times.
|
|
@@ -798,84 +698,84 @@ class qt {
|
|
|
798
698
|
* Dolla.router.go["/users", 215], { replace: true }); // replace current history entry with `/users/215`
|
|
799
699
|
*/
|
|
800
700
|
go(e, t = {}) {
|
|
801
|
-
if (
|
|
701
|
+
if (i(this, I) == null)
|
|
802
702
|
throw new Error("Routa methods won't work until you register it: Dolla.use(Routa, { /* ...options */ })");
|
|
803
|
-
let
|
|
804
|
-
Array.isArray(e) ?
|
|
703
|
+
let s;
|
|
704
|
+
Array.isArray(e) ? s = z(e) : s = e.toString(), s = ve(window.location.pathname, s), t.preserveQuery && (s += window.location.search), t.replace ? u(this, p, tt).call(this, s) : u(this, p, Ce).call(this, s);
|
|
805
705
|
}
|
|
806
706
|
}
|
|
807
|
-
|
|
808
|
-
|
|
707
|
+
I = new WeakMap(), L = new WeakMap(), _e = new WeakMap(), N = new WeakMap(), Q = new WeakMap(), q = new WeakMap(), W = new WeakMap(), T = new WeakMap(), he = new WeakMap(), p = new WeakSet(), Ce = function(e, t) {
|
|
708
|
+
i(this, L).info("(push)", e), window.history.pushState(t, "", i(this, q) ? "/#" + e : e), u(this, p, ee).call(this, e);
|
|
809
709
|
}, tt = function(e, t) {
|
|
810
|
-
|
|
811
|
-
},
|
|
812
|
-
return
|
|
813
|
-
},
|
|
814
|
-
const t =
|
|
815
|
-
for (const
|
|
816
|
-
switch (
|
|
710
|
+
i(this, L).info("(replace)", e), window.history.replaceState(t, "", i(this, q) ? "/#" + e : e), u(this, p, ee).call(this, e);
|
|
711
|
+
}, st = function() {
|
|
712
|
+
return i(this, q) ? new URL(window.location.hash.slice(1), window.location.origin) : new URL(window.location.pathname, window.location.origin);
|
|
713
|
+
}, ee = async function(e) {
|
|
714
|
+
const t = i(this, L), s = e ? new URL(e, window.location.origin) : u(this, p, st).call(this), { match: r, journey: n } = await u(this, p, Oe).call(this, s);
|
|
715
|
+
for (const a of n)
|
|
716
|
+
switch (a.kind) {
|
|
817
717
|
case "match":
|
|
818
|
-
t.info(`📍 ${
|
|
718
|
+
t.info(`📍 ${a.message}`);
|
|
819
719
|
break;
|
|
820
720
|
case "redirect":
|
|
821
|
-
t.info(`↩️ ${
|
|
721
|
+
t.info(`↩️ ${a.message}`);
|
|
822
722
|
break;
|
|
823
723
|
case "miss":
|
|
824
|
-
t.info(`💀 ${
|
|
724
|
+
t.info(`💀 ${a.message}`);
|
|
825
725
|
break;
|
|
826
726
|
}
|
|
827
|
-
if (
|
|
828
|
-
const
|
|
829
|
-
|
|
727
|
+
if (r) {
|
|
728
|
+
const a = this.$pattern.get();
|
|
729
|
+
i(this, he).call(this, r), r.pattern !== a && u(this, p, rt).call(this, r);
|
|
830
730
|
} else
|
|
831
|
-
t.crash(new
|
|
832
|
-
return { match:
|
|
731
|
+
t.crash(new It(`Failed to match route '${s.pathname}'`));
|
|
732
|
+
return { match: r, journey: n };
|
|
833
733
|
}, Oe = async function(e, t = []) {
|
|
834
|
-
const
|
|
835
|
-
if (!
|
|
734
|
+
const s = et(i(this, Q), e.pathname);
|
|
735
|
+
if (!s)
|
|
836
736
|
return {
|
|
837
737
|
match: null,
|
|
838
738
|
journey: [...t, { kind: "miss", message: `no match for '${e.pathname}'` }]
|
|
839
739
|
};
|
|
840
|
-
let
|
|
841
|
-
if (
|
|
740
|
+
let r = s.meta.redirect;
|
|
741
|
+
if (s.meta.beforeMatch && await s.meta.beforeMatch({
|
|
842
742
|
// TODO: Allow setting context variables from here? Would apply to the context of the matched view.
|
|
843
|
-
redirect: (
|
|
844
|
-
|
|
743
|
+
redirect: (n) => {
|
|
744
|
+
r = n;
|
|
845
745
|
}
|
|
846
|
-
}),
|
|
847
|
-
let
|
|
848
|
-
if (
|
|
849
|
-
|
|
850
|
-
else if (
|
|
851
|
-
const
|
|
852
|
-
path:
|
|
853
|
-
pattern:
|
|
854
|
-
params:
|
|
855
|
-
query:
|
|
746
|
+
}), r != null) {
|
|
747
|
+
let n;
|
|
748
|
+
if (E(r))
|
|
749
|
+
n = Vt(r, s.params);
|
|
750
|
+
else if (se(r)) {
|
|
751
|
+
const a = {
|
|
752
|
+
path: s.path,
|
|
753
|
+
pattern: s.pattern,
|
|
754
|
+
params: s.params,
|
|
755
|
+
query: s.query
|
|
856
756
|
};
|
|
857
|
-
if (
|
|
757
|
+
if (n = await r(a), !E(n))
|
|
858
758
|
throw new Error("Redirect function must return a path to redirect to.");
|
|
859
|
-
|
|
759
|
+
n.startsWith("/") || (n = ve(s.path, n));
|
|
860
760
|
} else
|
|
861
761
|
throw new TypeError("Redirect must either be a path string or a function.");
|
|
862
|
-
return
|
|
762
|
+
return u(this, p, Oe).call(this, new URL(n, window.location.origin), [
|
|
863
763
|
...t,
|
|
864
|
-
{ kind: "redirect", message: `redirecting '${
|
|
764
|
+
{ kind: "redirect", message: `redirecting '${s.path}' -> '${n}'` }
|
|
865
765
|
]);
|
|
866
766
|
} else
|
|
867
|
-
return { match:
|
|
767
|
+
return { match: s, journey: [...t, { kind: "match", message: `matched route '${s.path}'` }] };
|
|
868
768
|
}, /**
|
|
869
769
|
* Takes a matched route and mounts it.
|
|
870
770
|
*/
|
|
871
|
-
|
|
771
|
+
rt = function(e) {
|
|
872
772
|
const t = e.meta.layers;
|
|
873
|
-
for (let
|
|
874
|
-
const
|
|
875
|
-
if ((
|
|
876
|
-
|
|
877
|
-
const
|
|
878
|
-
|
|
773
|
+
for (let s = 0; s < t.length; s++) {
|
|
774
|
+
const r = t[s], n = i(this, N)[s];
|
|
775
|
+
if ((n == null ? void 0 : n.id) !== r.id) {
|
|
776
|
+
m(this, N, i(this, N).slice(0, s)), n == null || n.view.unmount();
|
|
777
|
+
const a = i(this, N).at(-1), h = ((a == null ? void 0 : a.view) ?? i(this, I).getRootView()).setChildView(r.view);
|
|
778
|
+
i(this, N).push({ id: r.id, view: h });
|
|
879
779
|
}
|
|
880
780
|
}
|
|
881
781
|
}, /**
|
|
@@ -884,8 +784,8 @@ st = function(e) {
|
|
|
884
784
|
* @param route - Route config object.
|
|
885
785
|
* @param layers - Array of parent layers. Passed when this function calls itself on nested routes.
|
|
886
786
|
*/
|
|
887
|
-
|
|
888
|
-
if (!
|
|
787
|
+
je = function(e, t = [], s = []) {
|
|
788
|
+
if (!Y(e) || !E(e.path))
|
|
889
789
|
throw new TypeError(`Route configs must be objects with a 'path' string property. Got: ${e}`);
|
|
890
790
|
if (e.redirect && e.routes)
|
|
891
791
|
throw new Error("Route cannot have both a 'redirect' and nested 'routes'.");
|
|
@@ -893,70 +793,70 @@ Ue = function(e, t = [], r = []) {
|
|
|
893
793
|
throw new Error("Route cannot have both a 'redirect' and a 'view'.");
|
|
894
794
|
if (!e.view && !e.routes && !e.redirect)
|
|
895
795
|
throw new Error("Route must have a 'view', a 'redirect', or a set of nested 'routes'.");
|
|
896
|
-
let
|
|
897
|
-
for (const
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
const
|
|
796
|
+
let r = [];
|
|
797
|
+
for (const h of t)
|
|
798
|
+
r.push(...te(h.path));
|
|
799
|
+
r.push(...te(e.path)), r[r.length - 1] === "*" && r.pop();
|
|
800
|
+
const n = [];
|
|
901
801
|
if (e.redirect) {
|
|
902
|
-
let
|
|
903
|
-
return
|
|
904
|
-
pattern: "/" +
|
|
802
|
+
let h = e.redirect;
|
|
803
|
+
return E(h) && (h = ve(z(r), h), h.startsWith("/") || (h = "/" + h)), n.push({
|
|
804
|
+
pattern: "/" + z([...r, ...te(e.path)]),
|
|
905
805
|
meta: {
|
|
906
|
-
redirect:
|
|
806
|
+
redirect: h
|
|
907
807
|
}
|
|
908
|
-
}),
|
|
808
|
+
}), n;
|
|
909
809
|
}
|
|
910
|
-
let
|
|
911
|
-
if (
|
|
912
|
-
|
|
810
|
+
let a = Je;
|
|
811
|
+
if (se(e.view))
|
|
812
|
+
a = e.view;
|
|
913
813
|
else if (e.view)
|
|
914
814
|
throw new TypeError(`Route '${e.path}' expected a view function or undefined. Got: ${e.view}`);
|
|
915
|
-
const f = { id:
|
|
815
|
+
const f = { id: Z(this, _e)._++, view: a };
|
|
916
816
|
if (e.routes)
|
|
917
|
-
for (const
|
|
918
|
-
|
|
817
|
+
for (const h of e.routes)
|
|
818
|
+
n.push(...u(this, p, je).call(this, h, [...t, e], [...s, f]));
|
|
919
819
|
else
|
|
920
|
-
|
|
921
|
-
pattern: parent ?
|
|
820
|
+
n.push({
|
|
821
|
+
pattern: parent ? z([...t.map((h) => h.path), e.path]) : e.path,
|
|
922
822
|
meta: {
|
|
923
823
|
pattern: e.path,
|
|
924
|
-
layers: [...
|
|
824
|
+
layers: [...s, f],
|
|
925
825
|
beforeMatch: e.beforeMatch
|
|
926
826
|
}
|
|
927
827
|
});
|
|
928
|
-
return
|
|
828
|
+
return n;
|
|
929
829
|
};
|
|
930
|
-
const
|
|
931
|
-
function
|
|
932
|
-
function
|
|
933
|
-
return !
|
|
830
|
+
const Ct = /(noopener|noreferrer) (noopener|noreferrer)/, Ot = /^[\w-_]+:/;
|
|
831
|
+
function jt(o, e, t = window) {
|
|
832
|
+
function s(n) {
|
|
833
|
+
return !n || n === o ? null : n.localName !== "a" || n.href === void 0 ? s(n.parentNode) : n;
|
|
934
834
|
}
|
|
935
|
-
function n
|
|
936
|
-
if (
|
|
835
|
+
function r(n) {
|
|
836
|
+
if (n.button && n.button !== 0 || n.ctrlKey || n.metaKey || n.altKey || n.shiftKey || n.defaultPrevented)
|
|
937
837
|
return;
|
|
938
|
-
const
|
|
939
|
-
|
|
838
|
+
const a = s(n.target);
|
|
839
|
+
a && (t.location.protocol !== a.protocol || t.location.hostname !== a.hostname || t.location.port !== a.port || a.hasAttribute("data-router-ignore") || a.hasAttribute("download") || a.getAttribute("target") === "_blank" && Ct.test(a.getAttribute("rel")) || Ot.test(a.getAttribute("href")) || (n.preventDefault(), e(a)));
|
|
940
840
|
}
|
|
941
|
-
return o.addEventListener("click",
|
|
942
|
-
o.removeEventListener("click",
|
|
841
|
+
return o.addEventListener("click", r), function() {
|
|
842
|
+
o.removeEventListener("click", r);
|
|
943
843
|
};
|
|
944
844
|
}
|
|
945
|
-
function
|
|
845
|
+
function Vt(o, e) {
|
|
946
846
|
for (const t in e) {
|
|
947
|
-
const
|
|
948
|
-
o = o.replace(`{${t}}`,
|
|
847
|
+
const s = e[t].toString();
|
|
848
|
+
o = o.replace(`{${t}}`, s).replace(`{#${t}}`, s);
|
|
949
849
|
}
|
|
950
850
|
return o;
|
|
951
851
|
}
|
|
952
|
-
function
|
|
852
|
+
function Ut(o) {
|
|
953
853
|
for (const e of o)
|
|
954
854
|
if (e.meta.redirect) {
|
|
955
855
|
let t;
|
|
956
|
-
if (!
|
|
856
|
+
if (!se(e.meta.redirect)) if (E(e.meta.redirect)) {
|
|
957
857
|
if (t = e.meta.redirect, !et(o, t, {
|
|
958
|
-
willMatch(
|
|
959
|
-
return
|
|
858
|
+
willMatch(r) {
|
|
859
|
+
return r !== e;
|
|
960
860
|
}
|
|
961
861
|
}))
|
|
962
862
|
throw new Error(`Found a redirect to an undefined URL. From '${e.pattern}' to '${e.meta.redirect}'`);
|
|
@@ -964,134 +864,295 @@ function jt(o) {
|
|
|
964
864
|
throw new TypeError(`Expected a string or redirect function. Got: ${e.meta.redirect}`);
|
|
965
865
|
}
|
|
966
866
|
}
|
|
967
|
-
class
|
|
867
|
+
class It extends Error {
|
|
968
868
|
}
|
|
969
|
-
|
|
970
|
-
|
|
869
|
+
function qt(o) {
|
|
870
|
+
return Ge`
|
|
871
|
+
<div
|
|
872
|
+
style=${{
|
|
873
|
+
backgroundColor: "#880000",
|
|
874
|
+
color: "#fff",
|
|
875
|
+
padding: "2rem",
|
|
876
|
+
position: "fixed",
|
|
877
|
+
inset: 0,
|
|
878
|
+
fontSize: "20px"
|
|
879
|
+
}}
|
|
880
|
+
>
|
|
881
|
+
<h1 style=${{ marginBottom: "0.5rem" }}>The app has crashed</h1>
|
|
882
|
+
<p style=${{ marginBottom: "0.25rem" }}>
|
|
883
|
+
<span style=${{ fontFamily: "monospace" }}>${o.loggerName}</span>
|
|
884
|
+
${lt(o.uid, Ge`<span style=${{ fontFamily: "monospace", opacity: 0.5 }}> [uid: ${o.uid}]</span>`)}
|
|
885
|
+
${" "}says:
|
|
886
|
+
</p>
|
|
887
|
+
<blockquote
|
|
888
|
+
style=${{
|
|
889
|
+
backgroundColor: "#991111",
|
|
890
|
+
padding: "0.25em",
|
|
891
|
+
borderRadius: "6px",
|
|
892
|
+
fontFamily: "monospace",
|
|
893
|
+
marginBottom: "1rem"
|
|
894
|
+
}}
|
|
895
|
+
>
|
|
896
|
+
<span
|
|
897
|
+
style=${{
|
|
898
|
+
display: "inline-block",
|
|
899
|
+
backgroundColor: "red",
|
|
900
|
+
padding: "0.1em 0.4em",
|
|
901
|
+
marginRight: "0.5em",
|
|
902
|
+
borderRadius: "4px",
|
|
903
|
+
fontSize: "0.9em",
|
|
904
|
+
fontWeight: "bold"
|
|
905
|
+
}}
|
|
906
|
+
>
|
|
907
|
+
${o.error.name}
|
|
908
|
+
</span>
|
|
909
|
+
${o.error.message}
|
|
910
|
+
</blockquote>
|
|
911
|
+
|
|
912
|
+
<p>Please see the browser console for details.</p>
|
|
913
|
+
</div>
|
|
914
|
+
`;
|
|
915
|
+
}
|
|
916
|
+
var ce, J, C, A, G, X, Le, M, ue, F, Ve, Ee;
|
|
917
|
+
class Wt {
|
|
918
|
+
constructor(e) {
|
|
919
|
+
l(this, F);
|
|
920
|
+
l(this, ce);
|
|
921
|
+
l(this, J);
|
|
922
|
+
// Keys ensure only the most recent callback queued with a certain key
|
|
923
|
+
// will be called, keeping DOM operations to a minimum.
|
|
924
|
+
l(this, C, /* @__PURE__ */ new Map());
|
|
925
|
+
// All unkeyed writes are run on every batch.
|
|
926
|
+
l(this, A, []);
|
|
927
|
+
// All read callbacks are run before updates on every batch.
|
|
928
|
+
l(this, G, []);
|
|
929
|
+
l(this, X, !1);
|
|
930
|
+
// When true, batches that would exceed 16ms will be split and deferred to a rAF.
|
|
931
|
+
// This may not be desirable, because while it does prevent hitching it sometimes leaves
|
|
932
|
+
// the state partially rendered for a brief second and certain elements can be seen to update after the fact.
|
|
933
|
+
// But the tradeoff here is snappier navigation with possibly slightly out of date DOM updates on heavy pages.
|
|
934
|
+
l(this, Le, !0);
|
|
935
|
+
l(this, M, 0);
|
|
936
|
+
l(this, ue, new Intl.NumberFormat("en-US", {
|
|
937
|
+
maximumFractionDigits: 2,
|
|
938
|
+
minimumFractionDigits: 0,
|
|
939
|
+
style: "unit",
|
|
940
|
+
unit: "millisecond",
|
|
941
|
+
unitDisplay: "short"
|
|
942
|
+
}));
|
|
943
|
+
m(this, ce, e), m(this, J, e.createLogger("Dolla.batch"));
|
|
944
|
+
}
|
|
945
|
+
/**
|
|
946
|
+
* Queues a callback that runs before the next batch of writes.
|
|
947
|
+
*/
|
|
948
|
+
read(e) {
|
|
949
|
+
i(this, G).push(e), u(this, F, Ve).call(this);
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* Queues a callback to run in the next render batch.
|
|
953
|
+
* Always put DOM mutations in a write callback when possible to help Dolla batch them efficiently.
|
|
954
|
+
*/
|
|
955
|
+
write(e, t) {
|
|
956
|
+
t ? i(this, C).set(t, e) : i(this, A).push(e), u(this, F, Ve).call(this);
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
ce = new WeakMap(), J = new WeakMap(), C = new WeakMap(), A = new WeakMap(), G = new WeakMap(), X = new WeakMap(), Le = new WeakMap(), M = new WeakMap(), ue = new WeakMap(), F = new WeakSet(), Ve = function() {
|
|
960
|
+
if (!i(this, X)) {
|
|
961
|
+
m(this, X, !0);
|
|
962
|
+
const e = i(this, ce).getEnv() === "development";
|
|
963
|
+
queueMicrotask(() => {
|
|
964
|
+
u(this, F, Ee).call(this, e);
|
|
965
|
+
});
|
|
966
|
+
}
|
|
967
|
+
}, Ee = function(e = !1) {
|
|
968
|
+
const t = performance.now();
|
|
969
|
+
let s = 0;
|
|
970
|
+
const r = i(this, G).length + i(this, C).size + i(this, A).length;
|
|
971
|
+
let n = 0;
|
|
972
|
+
const a = () => (n++, s = performance.now() - t, i(this, Le) && s > 12 && n < r ? (Z(this, M)._++, e && i(this, J).warn(
|
|
973
|
+
`⚠️ Deferring batch to next frame. Performed ${n} of ${r} batched operation${n === 1 ? "" : "s"} in ${i(this, ue).format(s)} (deferral ${i(this, M)}).`
|
|
974
|
+
), requestAnimationFrame(() => {
|
|
975
|
+
u(this, F, Ee).call(this, e);
|
|
976
|
+
}), !0) : !1), f = [...i(this, C).entries()];
|
|
977
|
+
let h, w;
|
|
978
|
+
for (; w = i(this, G).shift(); )
|
|
979
|
+
if (w(), a()) return;
|
|
980
|
+
for ([h, w] of f)
|
|
981
|
+
if (w(), i(this, C).delete(h), a()) return;
|
|
982
|
+
for (; w = i(this, A).shift(); )
|
|
983
|
+
if (w(), a()) return;
|
|
984
|
+
e && i(this, J)[s > 16 ? "warn" : "info"](
|
|
985
|
+
`${s > 16 ? "⚠️ (>=16ms) " : ""}Executed ${n} operation${n === 1 ? "" : "s"} in ${i(this, ue).format(s)}${i(this, M) > 0 ? ` (after ${i(this, M)} deferral${i(this, M) === 1 ? "" : "s"})` : ""}.`
|
|
986
|
+
), m(this, M, 0), i(this, G).length || i(this, C).size || i(this, A).length ? queueMicrotask(() => {
|
|
987
|
+
u(this, F, Ee).call(this, e);
|
|
988
|
+
}) : m(this, X, !1);
|
|
989
|
+
};
|
|
990
|
+
var O, fe, j, H, de, me, we, pe, ge, ye, $, g, V, Me;
|
|
991
|
+
class At {
|
|
971
992
|
constructor() {
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
l(this,
|
|
979
|
-
l(this,
|
|
980
|
-
l(this,
|
|
981
|
-
l(this,
|
|
982
|
-
l(this,
|
|
983
|
-
l(this,
|
|
984
|
-
l(this, pe, []);
|
|
993
|
+
d(this, "batch");
|
|
994
|
+
// Remove `private` when there are public methods to call.
|
|
995
|
+
d(this, "stats");
|
|
996
|
+
d(this, "http");
|
|
997
|
+
d(this, "i18n");
|
|
998
|
+
d(this, "router");
|
|
999
|
+
l(this, O, !1);
|
|
1000
|
+
l(this, fe, "production");
|
|
1001
|
+
l(this, j);
|
|
1002
|
+
l(this, H);
|
|
1003
|
+
l(this, de, qt);
|
|
1004
|
+
l(this, me, He());
|
|
985
1005
|
l(this, we, []);
|
|
986
|
-
l(this,
|
|
1006
|
+
l(this, pe, []);
|
|
1007
|
+
l(this, ge, []);
|
|
1008
|
+
l(this, ye, []);
|
|
1009
|
+
l(this, $, {
|
|
987
1010
|
root: this,
|
|
988
|
-
data: {}
|
|
1011
|
+
data: {},
|
|
1012
|
+
emitter: new ht(),
|
|
1013
|
+
stores: /* @__PURE__ */ new Map()
|
|
989
1014
|
});
|
|
990
|
-
l(this,
|
|
1015
|
+
l(this, g, {
|
|
991
1016
|
info: "development",
|
|
992
1017
|
log: "development",
|
|
993
1018
|
warn: "development",
|
|
994
1019
|
error: !0
|
|
995
1020
|
});
|
|
996
|
-
l(this,
|
|
1021
|
+
l(this, V, Be("*,-Dolla.*"));
|
|
997
1022
|
// Registration functions for modules.
|
|
998
1023
|
// All modules will be registered before mount.
|
|
999
|
-
l(this,
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
this.batch = new
|
|
1024
|
+
l(this, Me, []);
|
|
1025
|
+
d(this, "watch", i(this, me).watch);
|
|
1026
|
+
d(this, "createState", Ue);
|
|
1027
|
+
d(this, "toState", ut);
|
|
1028
|
+
d(this, "toValue", ft);
|
|
1029
|
+
d(this, "isState", dt);
|
|
1030
|
+
d(this, "derive", x);
|
|
1031
|
+
d(this, "createWatcher", He);
|
|
1032
|
+
d(this, "createRef", mt);
|
|
1033
|
+
d(this, "isRef", wt);
|
|
1034
|
+
this.batch = new Wt(this), this.stats = new ct(this), this.http = new kt(this), this.i18n = new xt(this), this.router = new Tt(this);
|
|
1010
1035
|
}
|
|
1011
1036
|
/**
|
|
1012
1037
|
* True when the app is connected to a DOM node and displayed to the user.
|
|
1013
1038
|
*/
|
|
1014
1039
|
get isMounted() {
|
|
1015
|
-
return
|
|
1040
|
+
return i(this, O);
|
|
1016
1041
|
}
|
|
1017
1042
|
/**
|
|
1018
1043
|
* Get the current environment that this app is running in.
|
|
1019
1044
|
* Environment affects which log messages will print and how much debugging info is included in the DOM.
|
|
1020
1045
|
*/
|
|
1021
1046
|
getEnv() {
|
|
1022
|
-
return
|
|
1047
|
+
return i(this, fe);
|
|
1023
1048
|
}
|
|
1024
1049
|
/**
|
|
1025
1050
|
* Sets the environment that this app is running in.
|
|
1026
1051
|
* Environment affects which log messages will print and how much debugging info is included in the DOM.
|
|
1027
1052
|
*/
|
|
1028
1053
|
setEnv(e) {
|
|
1029
|
-
|
|
1054
|
+
m(this, fe, e);
|
|
1030
1055
|
}
|
|
1031
1056
|
/**
|
|
1032
1057
|
* Sets the view that will be shown when the `crash` method is called on any logger.
|
|
1033
1058
|
* When a crash is reported the app will be unmounted and replaced with this crash page.
|
|
1034
1059
|
*/
|
|
1035
1060
|
setCrashView(e) {
|
|
1036
|
-
|
|
1061
|
+
m(this, de, e);
|
|
1037
1062
|
}
|
|
1038
1063
|
/**
|
|
1039
1064
|
* Returns the HTMLElement Dolla is mounted to. This will return undefined until Dolla.mount() is called.
|
|
1040
1065
|
*/
|
|
1041
1066
|
getRootElement() {
|
|
1042
|
-
return
|
|
1067
|
+
return i(this, j);
|
|
1043
1068
|
}
|
|
1044
1069
|
/**
|
|
1045
1070
|
* Returns the top level view Dolla is rendering inside the root element. This will return undefined until Dolla.mount() is called.
|
|
1046
1071
|
*/
|
|
1047
1072
|
getRootView() {
|
|
1048
|
-
return
|
|
1073
|
+
return i(this, H);
|
|
1049
1074
|
}
|
|
1050
|
-
/**
|
|
1051
|
-
* Registers a Dolla module.
|
|
1052
|
-
*/
|
|
1053
|
-
// use<O>(module: DollaModule<O>, options: O) {
|
|
1054
|
-
// this.#modules.push(async () => {
|
|
1055
|
-
// return module.register({ root: this, options });
|
|
1056
|
-
// });
|
|
1057
|
-
// return this;
|
|
1058
|
-
// }
|
|
1059
1075
|
/**
|
|
1060
1076
|
* Sets a context variable and returns its value. Context variables are accessible on the app and in child views.
|
|
1061
1077
|
*/
|
|
1062
1078
|
set(e, t) {
|
|
1063
|
-
return
|
|
1079
|
+
return i(this, $).data[e] = t, t;
|
|
1064
1080
|
}
|
|
1065
1081
|
/**
|
|
1066
1082
|
* Gets the value of a context variable. Returns null if the variable is not set.
|
|
1067
1083
|
*/
|
|
1068
1084
|
get(e) {
|
|
1069
|
-
return
|
|
1085
|
+
return i(this, $).data[e] ?? null;
|
|
1070
1086
|
}
|
|
1071
1087
|
/**
|
|
1072
1088
|
* Returns an object of all context variables stored at the app level.
|
|
1073
1089
|
*/
|
|
1074
|
-
getAll() {
|
|
1075
|
-
|
|
1090
|
+
// getAll(): Record<string | symbol, unknown> {
|
|
1091
|
+
// return { ...this.#rootElementContext.data };
|
|
1092
|
+
// }
|
|
1093
|
+
/**
|
|
1094
|
+
* Adds a listener to be called when `eventName` is emitted.
|
|
1095
|
+
*/
|
|
1096
|
+
on(e, t) {
|
|
1097
|
+
i(this, $).emitter.on(e, t);
|
|
1098
|
+
}
|
|
1099
|
+
/**
|
|
1100
|
+
* Removes a listener from the list to be called when `eventName` is emitted.
|
|
1101
|
+
*/
|
|
1102
|
+
off(e, t) {
|
|
1103
|
+
i(this, $).emitter.off(e, t);
|
|
1104
|
+
}
|
|
1105
|
+
/**
|
|
1106
|
+
* Adds a listener to be called when `eventName` is emitted. The listener is immediately removed after being called once.
|
|
1107
|
+
*/
|
|
1108
|
+
once(e, t) {
|
|
1109
|
+
i(this, $).emitter.once(e, t);
|
|
1110
|
+
}
|
|
1111
|
+
/**
|
|
1112
|
+
* Emits a new event to all listeners.
|
|
1113
|
+
*/
|
|
1114
|
+
emit(e, t) {
|
|
1115
|
+
return i(this, $).emitter.emit(e, new pt(e, t));
|
|
1116
|
+
}
|
|
1117
|
+
/**
|
|
1118
|
+
* Attaches a new store to this context.
|
|
1119
|
+
*/
|
|
1120
|
+
attachStore(e) {
|
|
1121
|
+
e.attach(i(this, $));
|
|
1122
|
+
}
|
|
1123
|
+
/**
|
|
1124
|
+
* Gets the nearest instance of a store. Throws an error if the store isn't provided higher in the tree.
|
|
1125
|
+
*/
|
|
1126
|
+
useStore(e) {
|
|
1127
|
+
if (gt(e)) {
|
|
1128
|
+
const t = e.key, s = i(this, $).stores.get(t);
|
|
1129
|
+
if (s == null)
|
|
1130
|
+
throw new Fe("Store not found on this context.");
|
|
1131
|
+
return s.value;
|
|
1132
|
+
} else throw yt(e) ? new Fe(
|
|
1133
|
+
"Received a Store instance. Please pass the Store factory function to useStore without calling it."
|
|
1134
|
+
) : new Fe("Invalid store.");
|
|
1076
1135
|
}
|
|
1077
1136
|
async mount(e, t) {
|
|
1078
|
-
if (
|
|
1137
|
+
if (i(this, O))
|
|
1079
1138
|
throw new Error("Dolla is already mounted.");
|
|
1080
|
-
if (
|
|
1081
|
-
const
|
|
1082
|
-
|
|
1139
|
+
if (E(e)) {
|
|
1140
|
+
const r = document.querySelector(e);
|
|
1141
|
+
ze(HTMLElement, r, `Selector '${e}' did not match any element.`), m(this, j, r);
|
|
1083
1142
|
} else
|
|
1084
|
-
|
|
1085
|
-
const
|
|
1086
|
-
|
|
1087
|
-
for (const
|
|
1088
|
-
|
|
1143
|
+
ze(HTMLElement, e, "Expected an HTML element or a selector string. Got type: %t, value: %v"), m(this, j, e);
|
|
1144
|
+
const s = bt(t ?? Je);
|
|
1145
|
+
m(this, H, this.constructView(s.type, s.props)), await Promise.all(i(this, Me).map((r) => r())), await Promise.all(i(this, we).map((r) => r())), i(this, H).mount(i(this, j)), m(this, O, !0);
|
|
1146
|
+
for (const r of i(this, pe))
|
|
1147
|
+
r();
|
|
1148
|
+
for (const r of i(this, $).stores.values())
|
|
1149
|
+
r.handleMount();
|
|
1089
1150
|
}
|
|
1090
1151
|
async unmount() {
|
|
1091
1152
|
var e;
|
|
1092
|
-
if (
|
|
1093
|
-
await Promise.all(
|
|
1094
|
-
for (const t of
|
|
1153
|
+
if (i(this, O)) {
|
|
1154
|
+
await Promise.all(i(this, ge).map((t) => t())), (e = i(this, H)) == null || e.unmount(!1), i(this, me).stopAll(), m(this, O, !1);
|
|
1155
|
+
for (const t of i(this, ye))
|
|
1095
1156
|
t();
|
|
1096
1157
|
}
|
|
1097
1158
|
}
|
|
@@ -1100,55 +1161,55 @@ class Ot {
|
|
|
1100
1161
|
* it will be awaited before mounting finishes. Use this to perform initial setup before the app is displayed to the user.
|
|
1101
1162
|
*/
|
|
1102
1163
|
beforeMount(e) {
|
|
1103
|
-
|
|
1164
|
+
i(this, we).push(e);
|
|
1104
1165
|
}
|
|
1105
1166
|
/**
|
|
1106
1167
|
* Registers a `callback` to run after the app is mounted.
|
|
1107
1168
|
*/
|
|
1108
1169
|
onMount(e) {
|
|
1109
|
-
|
|
1170
|
+
i(this, pe).push(e);
|
|
1110
1171
|
}
|
|
1111
1172
|
/**
|
|
1112
1173
|
* Registers a `callback` to run after `Dolla.unmount` is called, before the app is unmounted. If `callback` returns a Promise,
|
|
1113
1174
|
* it will be awaited before unmounting finishes. Use this to perform cleanup.
|
|
1114
1175
|
*/
|
|
1115
1176
|
beforeUnmount(e) {
|
|
1116
|
-
|
|
1177
|
+
i(this, ge).push(e);
|
|
1117
1178
|
}
|
|
1118
1179
|
/**
|
|
1119
1180
|
* Registers a `callback` to run after the app is unmounted.
|
|
1120
1181
|
*/
|
|
1121
1182
|
onUnmount(e) {
|
|
1122
|
-
|
|
1183
|
+
i(this, ye).push(e);
|
|
1123
1184
|
}
|
|
1124
1185
|
/**
|
|
1125
1186
|
* Update log type toggles. Values that are not passed will remain unchanged.
|
|
1126
1187
|
*/
|
|
1127
1188
|
setLoggles(e) {
|
|
1128
1189
|
for (const t in e) {
|
|
1129
|
-
const
|
|
1130
|
-
|
|
1190
|
+
const s = e[t];
|
|
1191
|
+
s && (i(this, g)[t] = s);
|
|
1131
1192
|
}
|
|
1132
1193
|
}
|
|
1133
1194
|
setLogFilter(e) {
|
|
1134
|
-
|
|
1195
|
+
m(this, V, Be(e));
|
|
1135
1196
|
}
|
|
1136
1197
|
createLogger(e, t) {
|
|
1137
|
-
const
|
|
1198
|
+
const s = (t == null ? void 0 : t.console) ?? Gt(), r = this;
|
|
1138
1199
|
return {
|
|
1139
|
-
setName(
|
|
1140
|
-
return e =
|
|
1200
|
+
setName(n) {
|
|
1201
|
+
return e = n, this;
|
|
1141
1202
|
},
|
|
1142
1203
|
get info() {
|
|
1143
|
-
var
|
|
1144
|
-
if (
|
|
1204
|
+
var n;
|
|
1205
|
+
if (i(r, g).info === !1 || E(i(r, g).info) && i(r, g).info !== r.getEnv() || !i(n = r, V).call(n, e))
|
|
1145
1206
|
return be;
|
|
1146
1207
|
{
|
|
1147
|
-
let
|
|
1148
|
-
return t != null && t.uid ?
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
`color:${$e(
|
|
1208
|
+
let a = `%c${e}`;
|
|
1209
|
+
return t != null && t.uid ? a += ` %c[uid: %c${t.uid}%c]` : a += "%c%c%c", s.info.bind(
|
|
1210
|
+
s,
|
|
1211
|
+
a,
|
|
1212
|
+
`color:${$e(a)};font-weight:bold`,
|
|
1152
1213
|
"color:#777",
|
|
1153
1214
|
"color:#aaa",
|
|
1154
1215
|
"color:#777"
|
|
@@ -1156,15 +1217,15 @@ class Ot {
|
|
|
1156
1217
|
}
|
|
1157
1218
|
},
|
|
1158
1219
|
get log() {
|
|
1159
|
-
var
|
|
1160
|
-
if (
|
|
1220
|
+
var n;
|
|
1221
|
+
if (i(r, g).log === !1 || E(i(r, g).log) && i(r, g).log !== r.getEnv() || !i(n = r, V).call(n, e))
|
|
1161
1222
|
return be;
|
|
1162
1223
|
{
|
|
1163
|
-
let
|
|
1164
|
-
return t != null && t.uid ?
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
`color:${$e(
|
|
1224
|
+
let a = `%c${e}`;
|
|
1225
|
+
return t != null && t.uid ? a += ` %c[uid: %c${t.uid}%c]` : a += "%c%c%c", s.log.bind(
|
|
1226
|
+
s,
|
|
1227
|
+
a,
|
|
1228
|
+
`color:${$e(a)};font-weight:bold`,
|
|
1168
1229
|
"color:#777",
|
|
1169
1230
|
"color:#aaa",
|
|
1170
1231
|
"color:#777"
|
|
@@ -1172,15 +1233,15 @@ class Ot {
|
|
|
1172
1233
|
}
|
|
1173
1234
|
},
|
|
1174
1235
|
get warn() {
|
|
1175
|
-
var
|
|
1176
|
-
if (
|
|
1236
|
+
var n;
|
|
1237
|
+
if (i(r, g).warn === !1 || E(i(r, g).warn) && i(r, g).warn !== r.getEnv() || !i(n = r, V).call(n, e))
|
|
1177
1238
|
return be;
|
|
1178
1239
|
{
|
|
1179
|
-
let
|
|
1180
|
-
return t != null && t.uid ?
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
`color:${$e(
|
|
1240
|
+
let a = `%c${e}`;
|
|
1241
|
+
return t != null && t.uid ? a += ` %c[uid: %c${t.uid}%c]` : a += "%c%c%c", s.warn.bind(
|
|
1242
|
+
s,
|
|
1243
|
+
a,
|
|
1244
|
+
`color:${$e(a)};font-weight:bold`,
|
|
1184
1245
|
"color:#777",
|
|
1185
1246
|
"color:#aaa",
|
|
1186
1247
|
"color:#777"
|
|
@@ -1188,76 +1249,78 @@ class Ot {
|
|
|
1188
1249
|
}
|
|
1189
1250
|
},
|
|
1190
1251
|
get error() {
|
|
1191
|
-
var
|
|
1192
|
-
if (
|
|
1252
|
+
var n;
|
|
1253
|
+
if (i(r, g).error === !1 || E(i(r, g).error) && i(r, g).error !== r.getEnv() || !i(n = r, V).call(n, e))
|
|
1193
1254
|
return be;
|
|
1194
1255
|
{
|
|
1195
|
-
let
|
|
1196
|
-
return t != null && t.uid ?
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
`color:${$e(
|
|
1256
|
+
let a = `%c${e}`;
|
|
1257
|
+
return t != null && t.uid ? a += ` %c[uid: %c${t.uid}%c]` : a += "%c%c%c", s.error.bind(
|
|
1258
|
+
s,
|
|
1259
|
+
a,
|
|
1260
|
+
`color:${$e(a)};font-weight:bold`,
|
|
1200
1261
|
"color:#777",
|
|
1201
1262
|
"color:#aaa",
|
|
1202
1263
|
"color:#777"
|
|
1203
1264
|
);
|
|
1204
1265
|
}
|
|
1205
1266
|
},
|
|
1206
|
-
crash(
|
|
1207
|
-
throw
|
|
1208
|
-
error:
|
|
1267
|
+
crash(n) {
|
|
1268
|
+
throw r.isMounted && (r.unmount(), r.constructView(i(r, de), {
|
|
1269
|
+
error: n,
|
|
1209
1270
|
loggerName: e,
|
|
1210
1271
|
uid: t == null ? void 0 : t.uid
|
|
1211
|
-
}).mount(
|
|
1272
|
+
}).mount(i(r, j))), n;
|
|
1212
1273
|
}
|
|
1213
1274
|
};
|
|
1214
1275
|
}
|
|
1215
1276
|
/**
|
|
1216
1277
|
*
|
|
1217
1278
|
*/
|
|
1218
|
-
constructView(e, t,
|
|
1219
|
-
return new
|
|
1279
|
+
constructView(e, t, s = []) {
|
|
1280
|
+
return new $t(i(this, $), e, t, s);
|
|
1220
1281
|
}
|
|
1221
1282
|
/**
|
|
1222
1283
|
*
|
|
1223
1284
|
*/
|
|
1224
1285
|
constructMarkup(e) {
|
|
1225
|
-
return
|
|
1286
|
+
return vt(Et(i(this, $), e));
|
|
1226
1287
|
}
|
|
1227
1288
|
}
|
|
1228
|
-
|
|
1229
|
-
function
|
|
1289
|
+
O = new WeakMap(), fe = new WeakMap(), j = new WeakMap(), H = new WeakMap(), de = new WeakMap(), me = new WeakMap(), we = new WeakMap(), pe = new WeakMap(), ge = new WeakMap(), ye = new WeakMap(), $ = new WeakMap(), g = new WeakMap(), V = new WeakMap(), Me = new WeakMap();
|
|
1290
|
+
function Gt() {
|
|
1230
1291
|
if (typeof window < "u" && window.console)
|
|
1231
1292
|
return window.console;
|
|
1232
1293
|
if (typeof global < "u" && global.console)
|
|
1233
1294
|
return global.console;
|
|
1234
1295
|
}
|
|
1235
|
-
const Ke = new
|
|
1236
|
-
function
|
|
1296
|
+
const Ke = new At(), zt = Ke.i18n.t.bind(Ke.i18n);
|
|
1297
|
+
function Kt(o) {
|
|
1237
1298
|
typeof window < "u" && (window.DOLLA_DEV_DEBUG = o);
|
|
1238
1299
|
}
|
|
1239
|
-
function
|
|
1300
|
+
function Qt() {
|
|
1240
1301
|
return typeof window < "u" ? window.DOLLA_DEV_DEBUG === !0 : !1;
|
|
1241
1302
|
}
|
|
1242
1303
|
export {
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1304
|
+
lt as cond,
|
|
1305
|
+
bt as createMarkup,
|
|
1306
|
+
mt as createRef,
|
|
1307
|
+
Ue as createState,
|
|
1308
|
+
Yt as createStore,
|
|
1309
|
+
Zt as createView,
|
|
1310
|
+
at as deepEqual,
|
|
1248
1311
|
Ke as default,
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1312
|
+
x as derive,
|
|
1313
|
+
Qt as getDevDebug,
|
|
1314
|
+
Ge as html,
|
|
1315
|
+
wt as isRef,
|
|
1316
|
+
dt as isState,
|
|
1317
|
+
es as portal,
|
|
1318
|
+
ts as repeat,
|
|
1319
|
+
Kt as setDevDebug,
|
|
1320
|
+
We as shallowEqual,
|
|
1321
|
+
ss as strictEqual,
|
|
1322
|
+
zt as t,
|
|
1323
|
+
ut as toState,
|
|
1324
|
+
ft as toValue
|
|
1262
1325
|
};
|
|
1263
1326
|
//# sourceMappingURL=index.js.map
|