@manyducks.co/dolla 2.0.0-alpha.3 → 2.0.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +9 -9
- package/dist/index.js +493 -463
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.js +2 -2
- package/dist/jsx-runtime.js +2 -2
- package/dist/nodes/html.d.ts +7 -2
- package/dist/{passthrough-DrtCifRF.js → passthrough-CtoBcpag.js} +410 -393
- package/dist/passthrough-CtoBcpag.js.map +1 -0
- package/package.json +8 -12
- package/tests/signals.test.js +6 -6
- package/dist/passthrough-DrtCifRF.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
var pt = Object.defineProperty;
|
|
2
|
-
var Ze = (
|
|
3
|
-
throw TypeError(
|
|
2
|
+
var Ze = (a) => {
|
|
3
|
+
throw TypeError(a);
|
|
4
4
|
};
|
|
5
|
-
var mt = (
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var et = (
|
|
9
|
-
set _(
|
|
10
|
-
|
|
5
|
+
var mt = (a, e, t) => e in a ? pt(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
|
|
6
|
+
var L = (a, e, t) => mt(a, typeof e != "symbol" ? e + "" : e, t), Fe = (a, e, t) => e.has(a) || Ze("Cannot " + t);
|
|
7
|
+
var n = (a, e, t) => (Fe(a, e, "read from private field"), t ? t.call(a) : e.get(a)), h = (a, e, t) => e.has(a) ? Ze("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(a) : e.set(a, t), p = (a, e, t, r) => (Fe(a, e, "write to private field"), r ? r.call(a, t) : e.set(a, t), t), P = (a, e, t) => (Fe(a, e, "access private method"), t);
|
|
8
|
+
var et = (a, e, t, r) => ({
|
|
9
|
+
set _(i) {
|
|
10
|
+
p(a, e, i, t);
|
|
11
11
|
},
|
|
12
12
|
get _() {
|
|
13
|
-
return a
|
|
13
|
+
return n(a, e, r);
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
-
import { h as tt, c as yt, i as Ie, s as Ge, a as wt, d as Be, b as bt, e as Xe, f as
|
|
17
|
-
import { B as rr, C as nr, D as ar } from "./passthrough-
|
|
18
|
-
function Nt(
|
|
16
|
+
import { h as tt, c as yt, i as Ie, s as Ge, a as wt, d as Be, b as bt, e as Xe, f as V, g as K, j as lt, k as vt, w as ut, P as ht, l as rt, m as $t, t as Et, n as kt, o as Lt, p as Pt, q as nt, r as at, u as St, v as Oe, x as Te, y as Rt, z as xt, A as Mt } from "./passthrough-CtoBcpag.js";
|
|
17
|
+
import { B as rr, C as nr, D as ar } from "./passthrough-CtoBcpag.js";
|
|
18
|
+
function Nt(a) {
|
|
19
19
|
return tt`
|
|
20
20
|
<div
|
|
21
21
|
style=${{
|
|
@@ -29,8 +29,8 @@ function Nt(n) {
|
|
|
29
29
|
>
|
|
30
30
|
<h1 style=${{ marginBottom: "0.5rem" }}>The app has crashed</h1>
|
|
31
31
|
<p style=${{ marginBottom: "0.25rem" }}>
|
|
32
|
-
<span style=${{ fontFamily: "monospace" }}>${
|
|
33
|
-
${yt(
|
|
32
|
+
<span style=${{ fontFamily: "monospace" }}>${a.loggerName}</span>
|
|
33
|
+
${yt(a.uid, tt`<span style=${{ fontFamily: "monospace", opacity: 0.5 }}> [uid: ${a.uid}]</span>`)}
|
|
34
34
|
${" "}says:
|
|
35
35
|
</p>
|
|
36
36
|
<blockquote
|
|
@@ -53,21 +53,21 @@ function Nt(n) {
|
|
|
53
53
|
fontWeight: "bold"
|
|
54
54
|
}}
|
|
55
55
|
>
|
|
56
|
-
${
|
|
56
|
+
${a.error.name}
|
|
57
57
|
</span>
|
|
58
|
-
${
|
|
58
|
+
${a.error.message}
|
|
59
59
|
</blockquote>
|
|
60
60
|
|
|
61
61
|
<p>Please see the browser console for details.</p>
|
|
62
62
|
</div>
|
|
63
63
|
`;
|
|
64
64
|
}
|
|
65
|
-
var J, _e,
|
|
65
|
+
var J, _e, O, D;
|
|
66
66
|
class Ot {
|
|
67
67
|
constructor() {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
h(this, O);
|
|
69
|
+
h(this, J, []);
|
|
70
|
+
h(this, _e, Tt());
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
73
73
|
* Adds a new middleware that will apply to subsequent requests.
|
|
@@ -76,42 +76,42 @@ class Ot {
|
|
|
76
76
|
* @param middleware - A middleware function that will intercept requests.
|
|
77
77
|
*/
|
|
78
78
|
use(e) {
|
|
79
|
-
return
|
|
80
|
-
|
|
79
|
+
return n(this, J).push(e), () => {
|
|
80
|
+
n(this, J).splice(n(this, J).indexOf(e), 1);
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
async get(e, t) {
|
|
84
|
-
return P(this,
|
|
84
|
+
return P(this, O, D).call(this, "get", e, t);
|
|
85
85
|
}
|
|
86
86
|
async put(e, t) {
|
|
87
|
-
return P(this,
|
|
87
|
+
return P(this, O, D).call(this, "put", e, t);
|
|
88
88
|
}
|
|
89
89
|
async patch(e, t) {
|
|
90
|
-
return P(this,
|
|
90
|
+
return P(this, O, D).call(this, "patch", e, t);
|
|
91
91
|
}
|
|
92
92
|
async post(e, t) {
|
|
93
|
-
return P(this,
|
|
93
|
+
return P(this, O, D).call(this, "post", e, t);
|
|
94
94
|
}
|
|
95
95
|
async delete(e, t) {
|
|
96
|
-
return P(this,
|
|
96
|
+
return P(this, O, D).call(this, "delete", e, t);
|
|
97
97
|
}
|
|
98
98
|
async head(e, t) {
|
|
99
|
-
return P(this,
|
|
99
|
+
return P(this, O, D).call(this, "head", e, t);
|
|
100
100
|
}
|
|
101
101
|
async options(e, t) {
|
|
102
|
-
return P(this,
|
|
102
|
+
return P(this, O, D).call(this, "options", e, t);
|
|
103
103
|
}
|
|
104
104
|
async trace(e, t) {
|
|
105
|
-
return P(this,
|
|
105
|
+
return P(this, O, D).call(this, "trace", e, t);
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
J = new WeakMap(), _e = new WeakMap(),
|
|
108
|
+
J = new WeakMap(), _e = new WeakMap(), O = new WeakSet(), D = async function(e, t, r) {
|
|
109
109
|
return jt({
|
|
110
110
|
...r,
|
|
111
111
|
method: e,
|
|
112
112
|
uri: t,
|
|
113
|
-
middleware:
|
|
114
|
-
fetch:
|
|
113
|
+
middleware: n(this, J),
|
|
114
|
+
fetch: n(this, _e)
|
|
115
115
|
});
|
|
116
116
|
};
|
|
117
117
|
function Tt() {
|
|
@@ -123,71 +123,71 @@ function Tt() {
|
|
|
123
123
|
}
|
|
124
124
|
class At extends Error {
|
|
125
125
|
constructor(t) {
|
|
126
|
-
const { status: r, statusText:
|
|
126
|
+
const { status: r, statusText: i, method: s, uri: o } = t, f = `${r} ${i}: Request failed (${s.toUpperCase()} ${o})`;
|
|
127
127
|
super(f);
|
|
128
|
-
|
|
128
|
+
L(this, "response");
|
|
129
129
|
this.response = t;
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
async function jt(
|
|
133
|
-
const { headers: e, query: t, fetch: r, middleware:
|
|
134
|
-
method:
|
|
135
|
-
uri:
|
|
132
|
+
async function jt(a) {
|
|
133
|
+
const { headers: e, query: t, fetch: r, middleware: i } = a, s = {
|
|
134
|
+
method: a.method,
|
|
135
|
+
uri: a.uri,
|
|
136
136
|
get sameOrigin() {
|
|
137
|
-
return !
|
|
137
|
+
return !s.uri.startsWith("http");
|
|
138
138
|
},
|
|
139
139
|
query: new URLSearchParams(),
|
|
140
140
|
headers: new Headers(),
|
|
141
|
-
body:
|
|
141
|
+
body: a.body
|
|
142
142
|
};
|
|
143
143
|
if (e)
|
|
144
144
|
if (e instanceof Map || e instanceof Headers)
|
|
145
145
|
e.forEach((c, y) => {
|
|
146
|
-
|
|
146
|
+
s.headers.set(y, c);
|
|
147
147
|
});
|
|
148
148
|
else if (e != null && typeof e == "object" && !Array.isArray(e))
|
|
149
149
|
for (const c in e) {
|
|
150
150
|
const y = e[c];
|
|
151
|
-
y instanceof Date ?
|
|
151
|
+
y instanceof Date ? s.headers.set(c, y.toISOString()) : y != null && s.headers.set(c, String(y));
|
|
152
152
|
}
|
|
153
153
|
else
|
|
154
154
|
throw new TypeError(`Unknown headers type. Got: ${e}`);
|
|
155
155
|
if (t)
|
|
156
156
|
if (t instanceof Map || t instanceof URLSearchParams)
|
|
157
157
|
t.forEach((c, y) => {
|
|
158
|
-
|
|
158
|
+
s.query.set(y, c);
|
|
159
159
|
});
|
|
160
160
|
else if (t != null && typeof t == "object" && !Array.isArray(t))
|
|
161
161
|
for (const c in t) {
|
|
162
162
|
const y = t[c];
|
|
163
|
-
y instanceof Date ?
|
|
163
|
+
y instanceof Date ? s.query.set(c, y.toISOString()) : y != null && s.query.set(c, String(y));
|
|
164
164
|
}
|
|
165
165
|
else
|
|
166
166
|
throw new TypeError(`Unknown query params type. Got: ${t}`);
|
|
167
167
|
let o;
|
|
168
168
|
const f = async () => {
|
|
169
|
-
const c =
|
|
169
|
+
const c = s.query.toString(), y = c.length > 0 ? s.uri + "?" + c : s.uri;
|
|
170
170
|
let w;
|
|
171
|
-
!
|
|
172
|
-
const
|
|
173
|
-
method:
|
|
174
|
-
headers:
|
|
171
|
+
!s.headers.has("content-type") && Ie(s.body) ? (s.headers.set("content-type", "application/json"), w = JSON.stringify(s.body)) : w = s.body;
|
|
172
|
+
const m = await r(y, {
|
|
173
|
+
method: s.method,
|
|
174
|
+
headers: s.headers,
|
|
175
175
|
body: w
|
|
176
|
-
}), d = Object.fromEntries(
|
|
176
|
+
}), d = Object.fromEntries(m.headers.entries()), b = d["content-type"];
|
|
177
177
|
let $;
|
|
178
|
-
b != null && b.includes("application/json") ? $ = await
|
|
179
|
-
method:
|
|
180
|
-
uri:
|
|
181
|
-
status:
|
|
182
|
-
statusText:
|
|
178
|
+
b != null && b.includes("application/json") ? $ = await m.json() : b != null && b.includes("application/x-www-form-urlencoded") ? $ = await m.formData() : $ = await m.text(), o = {
|
|
179
|
+
method: s.method,
|
|
180
|
+
uri: s.uri,
|
|
181
|
+
status: m.status,
|
|
182
|
+
statusText: m.statusText,
|
|
183
183
|
headers: d,
|
|
184
184
|
body: $
|
|
185
185
|
};
|
|
186
186
|
};
|
|
187
|
-
if (
|
|
187
|
+
if (i.length > 0) {
|
|
188
188
|
const c = (y = 0) => {
|
|
189
|
-
const w =
|
|
190
|
-
return async () => w(
|
|
189
|
+
const w = i[y], m = i[y + 1] ? c(y + 1) : f;
|
|
190
|
+
return async () => w(s, async () => (await m(), o));
|
|
191
191
|
};
|
|
192
192
|
await c()();
|
|
193
193
|
} else
|
|
@@ -198,9 +198,9 @@ async function jt(n) {
|
|
|
198
198
|
}
|
|
199
199
|
class Ct {
|
|
200
200
|
constructor(e, t) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
201
|
+
L(this, "dolla");
|
|
202
|
+
L(this, "config");
|
|
203
|
+
L(this, "strings");
|
|
204
204
|
this.config = e, this.dolla = t;
|
|
205
205
|
}
|
|
206
206
|
async load() {
|
|
@@ -211,7 +211,7 @@ class Ct {
|
|
|
211
211
|
this.strings = e;
|
|
212
212
|
else
|
|
213
213
|
throw new Error(`Fetch function did not return an object of language strings: ${e}`);
|
|
214
|
-
} else if (
|
|
214
|
+
} else if (V(this.config.path)) {
|
|
215
215
|
const e = await this.dolla.http.get(this.config.path);
|
|
216
216
|
if (e.status >= 200 && e.status < 300)
|
|
217
217
|
if (Ie(e.body))
|
|
@@ -229,65 +229,65 @@ class Ct {
|
|
|
229
229
|
return this.strings;
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
|
-
var
|
|
233
|
-
class
|
|
232
|
+
var we, Y, x, se, be, ve, ie, $e, We, ft;
|
|
233
|
+
class Dt {
|
|
234
234
|
constructor(e) {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
const [t, r] = K(), [
|
|
247
|
-
this.$current = t,
|
|
248
|
-
|
|
235
|
+
h(this, We);
|
|
236
|
+
h(this, we);
|
|
237
|
+
h(this, Y);
|
|
238
|
+
h(this, x, /* @__PURE__ */ new Map());
|
|
239
|
+
h(this, se, []);
|
|
240
|
+
h(this, be, "auto");
|
|
241
|
+
L(this, "$current");
|
|
242
|
+
h(this, ve);
|
|
243
|
+
h(this, ie);
|
|
244
|
+
h(this, $e);
|
|
245
|
+
p(this, we, e), p(this, Y, e.createLogger("dolla/language"));
|
|
246
|
+
const [t, r] = K(), [i, s] = K();
|
|
247
|
+
this.$current = t, p(this, ve, r), p(this, ie, i), p(this, $e, s), e.beforeMount(async () => {
|
|
248
|
+
n(this, x).size > 0 && await this.setLanguage(n(this, be));
|
|
249
249
|
});
|
|
250
250
|
}
|
|
251
251
|
get supportedLanguages() {
|
|
252
|
-
return [...
|
|
252
|
+
return [...n(this, x).keys()];
|
|
253
253
|
}
|
|
254
254
|
setup(e) {
|
|
255
255
|
if (e.languages.forEach((t) => {
|
|
256
|
-
|
|
256
|
+
n(this, x).set(t.name, new Ct(t, n(this, we)));
|
|
257
257
|
}), e.initialLanguage && e.initialLanguage !== "auto") {
|
|
258
258
|
if (!e.languages.some((r) => r.name === e.initialLanguage))
|
|
259
259
|
throw new Error(`Initial language '${e.initialLanguage}' has no registered translation.`);
|
|
260
|
-
|
|
260
|
+
p(this, be, e.initialLanguage);
|
|
261
261
|
}
|
|
262
|
-
|
|
263
|
-
`${
|
|
262
|
+
n(this, Y).info(
|
|
263
|
+
`${n(this, x).size} language${n(this, x).size === 1 ? "" : "s"} supported: '${[...n(this, x).keys()].join("', '")}'`
|
|
264
264
|
);
|
|
265
265
|
}
|
|
266
266
|
async setLanguage(e) {
|
|
267
|
-
var
|
|
267
|
+
var i;
|
|
268
268
|
let t;
|
|
269
269
|
if (e === "auto") {
|
|
270
|
-
let
|
|
270
|
+
let s = [];
|
|
271
271
|
if (typeof navigator == "object") {
|
|
272
272
|
const o = navigator;
|
|
273
|
-
((
|
|
273
|
+
((i = o.languages) == null ? void 0 : i.length) > 0 ? s.push(...o.languages) : o.language ? s.push(o.language) : o.browserLanguage ? s.push(o.browserLanguage) : o.userLanguage && s.push(o.userLanguage);
|
|
274
274
|
}
|
|
275
|
-
for (const o of
|
|
276
|
-
|
|
275
|
+
for (const o of s)
|
|
276
|
+
n(this, x).has(o) && (t = o);
|
|
277
277
|
} else
|
|
278
|
-
|
|
278
|
+
n(this, x).has(e) && (t = e);
|
|
279
279
|
if (t == null) {
|
|
280
|
-
const
|
|
281
|
-
|
|
280
|
+
const s = n(this, x).keys().next().value;
|
|
281
|
+
s && (t = s);
|
|
282
282
|
}
|
|
283
|
-
if (!t || !
|
|
283
|
+
if (!t || !n(this, x).has(t))
|
|
284
284
|
throw new Error(`Language '${e}' is not configured for this app.`);
|
|
285
|
-
const r =
|
|
285
|
+
const r = n(this, x).get(t);
|
|
286
286
|
try {
|
|
287
|
-
const
|
|
288
|
-
|
|
289
|
-
} catch (
|
|
290
|
-
|
|
287
|
+
const s = await r.load();
|
|
288
|
+
n(this, $e).call(this, s), n(this, ve).call(this, t), n(this, Y).info("set language to " + t);
|
|
289
|
+
} catch (s) {
|
|
290
|
+
s instanceof Error && n(this, Y).crash(s);
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
293
|
/**
|
|
@@ -302,71 +302,71 @@ class qt {
|
|
|
302
302
|
`The 't' function cannot be destructured. If you need a standalone version you can import it like so: 'import { t } from "@manyducks.co/dolla"'`
|
|
303
303
|
);
|
|
304
304
|
if (!this.$current.get())
|
|
305
|
-
return
|
|
305
|
+
return qt;
|
|
306
306
|
const r = P(this, We, ft).call(this, e, t);
|
|
307
307
|
if (r)
|
|
308
308
|
return r;
|
|
309
309
|
if (t) {
|
|
310
|
-
const
|
|
310
|
+
const s = {};
|
|
311
311
|
for (const [f, c] of Object.entries(t))
|
|
312
|
-
wt(c) && (
|
|
313
|
-
const o = Object.entries(
|
|
312
|
+
wt(c) && (s[f] = c);
|
|
313
|
+
const o = Object.entries(s);
|
|
314
314
|
if (o.length > 0) {
|
|
315
|
-
const f = o.map((y) => y[1]), c = Be([
|
|
316
|
-
const
|
|
315
|
+
const f = o.map((y) => y[1]), c = Be([n(this, ie), ...f], (y, ...w) => {
|
|
316
|
+
const m = w.map(($, j) => o[j]), d = {
|
|
317
317
|
...t
|
|
318
318
|
};
|
|
319
|
-
for (let $ = 0; $ <
|
|
320
|
-
const j =
|
|
319
|
+
for (let $ = 0; $ < m.length; $++) {
|
|
320
|
+
const j = m[$][0];
|
|
321
321
|
d[j] = w[$];
|
|
322
322
|
}
|
|
323
|
-
const b =
|
|
324
|
-
return
|
|
323
|
+
const b = it(y, e) || `[NO TRANSLATION: ${e}]`;
|
|
324
|
+
return st(b, d);
|
|
325
325
|
});
|
|
326
|
-
return
|
|
326
|
+
return n(this, se).push([e, t, c]), c;
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
|
-
const
|
|
330
|
-
let o =
|
|
331
|
-
return t && (o =
|
|
329
|
+
const i = Be([n(this, ie)], (s) => {
|
|
330
|
+
let o = it(s, e) || `[NO TRANSLATION: ${e}]`;
|
|
331
|
+
return t && (o = st(o, t)), o;
|
|
332
332
|
});
|
|
333
|
-
return
|
|
333
|
+
return n(this, se).push([e, t, i]), i;
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
|
-
|
|
337
|
-
for (const r of
|
|
336
|
+
we = new WeakMap(), Y = new WeakMap(), x = new WeakMap(), se = new WeakMap(), be = new WeakMap(), ve = new WeakMap(), ie = new WeakMap(), $e = new WeakMap(), We = new WeakSet(), ft = function(e, t) {
|
|
337
|
+
for (const r of n(this, se))
|
|
338
338
|
if (r[0] === e && bt(r[1], t))
|
|
339
339
|
return r[2];
|
|
340
340
|
};
|
|
341
|
-
const
|
|
342
|
-
function
|
|
341
|
+
const qt = Ge("[NO LANGUAGE SET]");
|
|
342
|
+
function st(a, e) {
|
|
343
343
|
for (const t in e)
|
|
344
|
-
|
|
345
|
-
return
|
|
344
|
+
a = a.replace(`{{${t}}}`, String(e[t]));
|
|
345
|
+
return a;
|
|
346
346
|
}
|
|
347
|
-
function
|
|
348
|
-
const t = String(e).split(/[\.\[\]]/).filter((
|
|
349
|
-
let r =
|
|
347
|
+
function it(a, e) {
|
|
348
|
+
const t = String(e).split(/[\.\[\]]/).filter((i) => i.trim() !== "");
|
|
349
|
+
let r = a;
|
|
350
350
|
for (; t.length > 0; ) {
|
|
351
|
-
const
|
|
352
|
-
r != null ? r = r[
|
|
351
|
+
const i = t.shift();
|
|
352
|
+
r != null ? r = r[i] : r = void 0;
|
|
353
353
|
}
|
|
354
354
|
return r;
|
|
355
355
|
}
|
|
356
|
-
var X,
|
|
357
|
-
class
|
|
356
|
+
var X, Ee, H, _, oe, q, ce, Ae;
|
|
357
|
+
class Ut {
|
|
358
358
|
constructor(e) {
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
359
|
+
h(this, ce);
|
|
360
|
+
h(this, X);
|
|
361
|
+
h(this, Ee);
|
|
362
362
|
// Keyed updates ensure only the most recent callback queued with a certain key
|
|
363
363
|
// will be called, keeping DOM operations to a minimum.
|
|
364
|
-
|
|
364
|
+
h(this, H, /* @__PURE__ */ new Map());
|
|
365
365
|
// All unkeyed updates are run on every batch.
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
366
|
+
h(this, _, []);
|
|
367
|
+
h(this, oe, []);
|
|
368
|
+
h(this, q, !1);
|
|
369
|
+
p(this, X, e), p(this, Ee, e.createLogger("dolla/render"));
|
|
370
370
|
}
|
|
371
371
|
/**
|
|
372
372
|
* Queues a callback to run in the next render batch.
|
|
@@ -375,11 +375,11 @@ class Vt {
|
|
|
375
375
|
*/
|
|
376
376
|
update(e, t) {
|
|
377
377
|
return new Promise((r) => {
|
|
378
|
-
t ?
|
|
378
|
+
t ? n(this, H).set(t, () => {
|
|
379
379
|
e(), r();
|
|
380
|
-
}) :
|
|
380
|
+
}) : n(this, _).push(() => {
|
|
381
381
|
e(), r();
|
|
382
|
-
}), !
|
|
382
|
+
}), !n(this, q) && n(this, X).isMounted && (p(this, q, !0), P(this, ce, Ae).call(this));
|
|
383
383
|
});
|
|
384
384
|
}
|
|
385
385
|
/**
|
|
@@ -389,51 +389,50 @@ class Vt {
|
|
|
389
389
|
*/
|
|
390
390
|
async read(e) {
|
|
391
391
|
return new Promise((t) => {
|
|
392
|
-
|
|
392
|
+
n(this, oe).push(() => {
|
|
393
393
|
e(), t();
|
|
394
|
-
}), !
|
|
394
|
+
}), !n(this, q) && n(this, X).isMounted && (p(this, q, !0), P(this, ce, Ae).call(this));
|
|
395
395
|
});
|
|
396
396
|
}
|
|
397
397
|
}
|
|
398
|
-
X = new WeakMap(),
|
|
399
|
-
const e =
|
|
400
|
-
if ((!
|
|
401
|
-
for (const t of
|
|
398
|
+
X = new WeakMap(), Ee = new WeakMap(), H = new WeakMap(), _ = new WeakMap(), oe = new WeakMap(), q = new WeakMap(), ce = new WeakSet(), Ae = function() {
|
|
399
|
+
const e = n(this, H).size + n(this, _).length;
|
|
400
|
+
if ((!n(this, X).isMounted || e === 0) && p(this, q, !1), !n(this, q)) {
|
|
401
|
+
for (const t of n(this, oe))
|
|
402
402
|
t();
|
|
403
|
-
|
|
403
|
+
p(this, oe, []);
|
|
404
404
|
return;
|
|
405
405
|
}
|
|
406
406
|
requestAnimationFrame(() => {
|
|
407
|
-
|
|
408
|
-
for (const t of
|
|
407
|
+
n(this, Ee).info(`Batching ${n(this, H).size + n(this, _).length} queued DOM update(s).`);
|
|
408
|
+
for (const t of n(this, H).values())
|
|
409
409
|
t();
|
|
410
|
-
|
|
411
|
-
for (const t of
|
|
410
|
+
n(this, H).clear();
|
|
411
|
+
for (const t of n(this, _))
|
|
412
412
|
t();
|
|
413
|
-
|
|
413
|
+
p(this, _, []), P(this, ce, Ae).call(this);
|
|
414
414
|
});
|
|
415
415
|
};
|
|
416
|
-
function
|
|
417
|
-
return
|
|
416
|
+
function de() {
|
|
417
|
+
return de = Object.assign ? Object.assign.bind() : function(a) {
|
|
418
418
|
for (var e = 1; e < arguments.length; e++) {
|
|
419
419
|
var t = arguments[e];
|
|
420
|
-
for (var r in t)
|
|
421
|
-
Object.prototype.hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
420
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (a[r] = t[r]);
|
|
422
421
|
}
|
|
423
|
-
return
|
|
424
|
-
},
|
|
422
|
+
return a;
|
|
423
|
+
}, de.apply(null, arguments);
|
|
425
424
|
}
|
|
426
425
|
var A;
|
|
427
|
-
(function(
|
|
428
|
-
|
|
426
|
+
(function(a) {
|
|
427
|
+
a.Pop = "POP", a.Push = "PUSH", a.Replace = "REPLACE";
|
|
429
428
|
})(A || (A = {}));
|
|
430
|
-
var
|
|
431
|
-
return Object.freeze(
|
|
432
|
-
} : function(
|
|
433
|
-
return
|
|
429
|
+
var qe = process.env.NODE_ENV !== "production" ? function(a) {
|
|
430
|
+
return Object.freeze(a);
|
|
431
|
+
} : function(a) {
|
|
432
|
+
return a;
|
|
434
433
|
};
|
|
435
|
-
function je(
|
|
436
|
-
if (!
|
|
434
|
+
function je(a, e) {
|
|
435
|
+
if (!a) {
|
|
437
436
|
typeof console < "u" && console.warn(e);
|
|
438
437
|
try {
|
|
439
438
|
throw new Error(e);
|
|
@@ -441,15 +440,15 @@ function je(n, e) {
|
|
|
441
440
|
}
|
|
442
441
|
}
|
|
443
442
|
}
|
|
444
|
-
var
|
|
445
|
-
function Ht(
|
|
446
|
-
|
|
447
|
-
var e =
|
|
448
|
-
function
|
|
449
|
-
var g = r.location, l = g.pathname,
|
|
450
|
-
return [E.idx,
|
|
443
|
+
var Ue = "beforeunload", Vt = "hashchange", dt = "popstate";
|
|
444
|
+
function Ht(a) {
|
|
445
|
+
a === void 0 && (a = {});
|
|
446
|
+
var e = a, t = e.window, r = t === void 0 ? document.defaultView : t, i = r.history;
|
|
447
|
+
function s() {
|
|
448
|
+
var g = r.location, l = g.pathname, u = g.search, v = g.hash, E = i.state || {};
|
|
449
|
+
return [E.idx, qe({
|
|
451
450
|
pathname: l,
|
|
452
|
-
search:
|
|
451
|
+
search: u,
|
|
453
452
|
hash: v,
|
|
454
453
|
state: E.usr || null,
|
|
455
454
|
key: E.key || "default"
|
|
@@ -460,17 +459,17 @@ function Ht(n) {
|
|
|
460
459
|
if (o)
|
|
461
460
|
b.call(o), o = null;
|
|
462
461
|
else {
|
|
463
|
-
var g = A.Pop, l =
|
|
462
|
+
var g = A.Pop, l = s(), u = l[0], v = l[1];
|
|
464
463
|
if (b.length)
|
|
465
|
-
if (
|
|
466
|
-
var E = w -
|
|
464
|
+
if (u != null) {
|
|
465
|
+
var E = w - u;
|
|
467
466
|
E && (o = {
|
|
468
467
|
action: g,
|
|
469
468
|
location: v,
|
|
470
469
|
retry: function() {
|
|
471
|
-
|
|
470
|
+
U(E * -1);
|
|
472
471
|
}
|
|
473
|
-
},
|
|
472
|
+
}, U(E));
|
|
474
473
|
} else
|
|
475
474
|
process.env.NODE_ENV !== "production" && je(
|
|
476
475
|
!1,
|
|
@@ -484,16 +483,16 @@ function Ht(n) {
|
|
|
484
483
|
}
|
|
485
484
|
}
|
|
486
485
|
r.addEventListener(dt, f);
|
|
487
|
-
var c = A.Pop, y =
|
|
488
|
-
w == null && (w = 0,
|
|
486
|
+
var c = A.Pop, y = s(), w = y[0], m = y[1], d = He(), b = He();
|
|
487
|
+
w == null && (w = 0, i.replaceState(de({}, i.state, {
|
|
489
488
|
idx: w
|
|
490
489
|
}), ""));
|
|
491
490
|
function $(g) {
|
|
492
491
|
return typeof g == "string" ? g : Ce(g);
|
|
493
492
|
}
|
|
494
493
|
function j(g, l) {
|
|
495
|
-
return l === void 0 && (l = null),
|
|
496
|
-
pathname:
|
|
494
|
+
return l === void 0 && (l = null), qe(de({
|
|
495
|
+
pathname: m.pathname,
|
|
497
496
|
hash: "",
|
|
498
497
|
search: ""
|
|
499
498
|
}, typeof g == "string" ? Qe(g) : g, {
|
|
@@ -501,94 +500,94 @@ function Ht(n) {
|
|
|
501
500
|
key: gt()
|
|
502
501
|
}));
|
|
503
502
|
}
|
|
504
|
-
function
|
|
503
|
+
function ge(g, l) {
|
|
505
504
|
return [{
|
|
506
505
|
usr: g.state,
|
|
507
506
|
key: g.key,
|
|
508
507
|
idx: l
|
|
509
508
|
}, $(g)];
|
|
510
509
|
}
|
|
511
|
-
function
|
|
510
|
+
function pe(g, l, u) {
|
|
512
511
|
return !b.length || (b.call({
|
|
513
512
|
action: g,
|
|
514
513
|
location: l,
|
|
515
|
-
retry:
|
|
514
|
+
retry: u
|
|
516
515
|
}), !1);
|
|
517
516
|
}
|
|
518
517
|
function re(g) {
|
|
519
518
|
c = g;
|
|
520
|
-
var l =
|
|
521
|
-
w = l[0],
|
|
519
|
+
var l = s();
|
|
520
|
+
w = l[0], m = l[1], d.call({
|
|
522
521
|
action: c,
|
|
523
|
-
location:
|
|
522
|
+
location: m
|
|
524
523
|
});
|
|
525
524
|
}
|
|
526
525
|
function ne(g, l) {
|
|
527
|
-
var
|
|
526
|
+
var u = A.Push, v = j(g, l);
|
|
528
527
|
function E() {
|
|
529
528
|
ne(g, l);
|
|
530
529
|
}
|
|
531
|
-
if (
|
|
532
|
-
var S =
|
|
530
|
+
if (pe(u, v, E)) {
|
|
531
|
+
var S = ge(v, w + 1), N = S[0], T = S[1];
|
|
533
532
|
try {
|
|
534
|
-
|
|
533
|
+
i.pushState(N, "", T);
|
|
535
534
|
} catch {
|
|
536
|
-
r.location.assign(
|
|
535
|
+
r.location.assign(T);
|
|
537
536
|
}
|
|
538
|
-
re(
|
|
537
|
+
re(u);
|
|
539
538
|
}
|
|
540
539
|
}
|
|
541
|
-
function
|
|
542
|
-
var
|
|
540
|
+
function me(g, l) {
|
|
541
|
+
var u = A.Replace, v = j(g, l);
|
|
543
542
|
function E() {
|
|
544
|
-
|
|
543
|
+
me(g, l);
|
|
545
544
|
}
|
|
546
|
-
if (
|
|
547
|
-
var S =
|
|
548
|
-
|
|
545
|
+
if (pe(u, v, E)) {
|
|
546
|
+
var S = ge(v, w), N = S[0], T = S[1];
|
|
547
|
+
i.replaceState(N, "", T), re(u);
|
|
549
548
|
}
|
|
550
549
|
}
|
|
551
|
-
function
|
|
552
|
-
|
|
550
|
+
function U(g) {
|
|
551
|
+
i.go(g);
|
|
553
552
|
}
|
|
554
553
|
var Q = {
|
|
555
554
|
get action() {
|
|
556
555
|
return c;
|
|
557
556
|
},
|
|
558
557
|
get location() {
|
|
559
|
-
return
|
|
558
|
+
return m;
|
|
560
559
|
},
|
|
561
560
|
createHref: $,
|
|
562
561
|
push: ne,
|
|
563
|
-
replace:
|
|
564
|
-
go:
|
|
562
|
+
replace: me,
|
|
563
|
+
go: U,
|
|
565
564
|
back: function() {
|
|
566
|
-
|
|
565
|
+
U(-1);
|
|
567
566
|
},
|
|
568
567
|
forward: function() {
|
|
569
|
-
|
|
568
|
+
U(1);
|
|
570
569
|
},
|
|
571
570
|
listen: function(l) {
|
|
572
571
|
return d.push(l);
|
|
573
572
|
},
|
|
574
573
|
block: function(l) {
|
|
575
|
-
var
|
|
576
|
-
return b.length === 1 && r.addEventListener(
|
|
577
|
-
|
|
574
|
+
var u = b.push(l);
|
|
575
|
+
return b.length === 1 && r.addEventListener(Ue, Ve), function() {
|
|
576
|
+
u(), b.length || r.removeEventListener(Ue, Ve);
|
|
578
577
|
};
|
|
579
578
|
}
|
|
580
579
|
};
|
|
581
580
|
return Q;
|
|
582
581
|
}
|
|
583
|
-
function _t(
|
|
584
|
-
|
|
585
|
-
var e =
|
|
586
|
-
function
|
|
587
|
-
var l = Qe(r.location.hash.substr(1)),
|
|
588
|
-
return [C.idx,
|
|
582
|
+
function _t(a) {
|
|
583
|
+
a === void 0 && (a = {});
|
|
584
|
+
var e = a, t = e.window, r = t === void 0 ? document.defaultView : t, i = r.history;
|
|
585
|
+
function s() {
|
|
586
|
+
var l = Qe(r.location.hash.substr(1)), u = l.pathname, v = u === void 0 ? "/" : u, E = l.search, S = E === void 0 ? "" : E, N = l.hash, T = N === void 0 ? "" : N, C = i.state || {};
|
|
587
|
+
return [C.idx, qe({
|
|
589
588
|
pathname: v,
|
|
590
589
|
search: S,
|
|
591
|
-
hash:
|
|
590
|
+
hash: T,
|
|
592
591
|
state: C.usr || null,
|
|
593
592
|
key: C.key || "default"
|
|
594
593
|
})];
|
|
@@ -598,7 +597,7 @@ function _t(n) {
|
|
|
598
597
|
if (o)
|
|
599
598
|
b.call(o), o = null;
|
|
600
599
|
else {
|
|
601
|
-
var l = A.Pop,
|
|
600
|
+
var l = A.Pop, u = s(), v = u[0], E = u[1];
|
|
602
601
|
if (b.length)
|
|
603
602
|
if (v != null) {
|
|
604
603
|
var S = w - v;
|
|
@@ -621,95 +620,95 @@ function _t(n) {
|
|
|
621
620
|
ne(l);
|
|
622
621
|
}
|
|
623
622
|
}
|
|
624
|
-
r.addEventListener(dt, f), r.addEventListener(
|
|
625
|
-
var l =
|
|
626
|
-
Ce(
|
|
623
|
+
r.addEventListener(dt, f), r.addEventListener(Vt, function() {
|
|
624
|
+
var l = s(), u = l[1];
|
|
625
|
+
Ce(u) !== Ce(m) && f();
|
|
627
626
|
});
|
|
628
|
-
var c = A.Pop, y =
|
|
629
|
-
w == null && (w = 0,
|
|
627
|
+
var c = A.Pop, y = s(), w = y[0], m = y[1], d = He(), b = He();
|
|
628
|
+
w == null && (w = 0, i.replaceState(de({}, i.state, {
|
|
630
629
|
idx: w
|
|
631
630
|
}), ""));
|
|
632
631
|
function $() {
|
|
633
|
-
var l = document.querySelector("base"),
|
|
632
|
+
var l = document.querySelector("base"), u = "";
|
|
634
633
|
if (l && l.getAttribute("href")) {
|
|
635
634
|
var v = r.location.href, E = v.indexOf("#");
|
|
636
|
-
|
|
635
|
+
u = E === -1 ? v : v.slice(0, E);
|
|
637
636
|
}
|
|
638
|
-
return
|
|
637
|
+
return u;
|
|
639
638
|
}
|
|
640
639
|
function j(l) {
|
|
641
640
|
return $() + "#" + (typeof l == "string" ? l : Ce(l));
|
|
642
641
|
}
|
|
643
|
-
function
|
|
644
|
-
return
|
|
645
|
-
pathname:
|
|
642
|
+
function ge(l, u) {
|
|
643
|
+
return u === void 0 && (u = null), qe(de({
|
|
644
|
+
pathname: m.pathname,
|
|
646
645
|
hash: "",
|
|
647
646
|
search: ""
|
|
648
647
|
}, typeof l == "string" ? Qe(l) : l, {
|
|
649
|
-
state:
|
|
648
|
+
state: u,
|
|
650
649
|
key: gt()
|
|
651
650
|
}));
|
|
652
651
|
}
|
|
653
|
-
function
|
|
652
|
+
function pe(l, u) {
|
|
654
653
|
return [{
|
|
655
654
|
usr: l.state,
|
|
656
655
|
key: l.key,
|
|
657
|
-
idx:
|
|
656
|
+
idx: u
|
|
658
657
|
}, j(l)];
|
|
659
658
|
}
|
|
660
|
-
function re(l,
|
|
659
|
+
function re(l, u, v) {
|
|
661
660
|
return !b.length || (b.call({
|
|
662
661
|
action: l,
|
|
663
|
-
location:
|
|
662
|
+
location: u,
|
|
664
663
|
retry: v
|
|
665
664
|
}), !1);
|
|
666
665
|
}
|
|
667
666
|
function ne(l) {
|
|
668
667
|
c = l;
|
|
669
|
-
var
|
|
670
|
-
w =
|
|
668
|
+
var u = s();
|
|
669
|
+
w = u[0], m = u[1], d.call({
|
|
671
670
|
action: c,
|
|
672
|
-
location:
|
|
671
|
+
location: m
|
|
673
672
|
});
|
|
674
673
|
}
|
|
675
|
-
function
|
|
676
|
-
var v = A.Push, E =
|
|
674
|
+
function me(l, u) {
|
|
675
|
+
var v = A.Push, E = ge(l, u);
|
|
677
676
|
function S() {
|
|
678
|
-
|
|
677
|
+
me(l, u);
|
|
679
678
|
}
|
|
680
679
|
if (process.env.NODE_ENV !== "production" && je(E.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.push(" + JSON.stringify(l) + ")"), re(v, E, S)) {
|
|
681
|
-
var
|
|
680
|
+
var N = pe(E, w + 1), T = N[0], C = N[1];
|
|
682
681
|
try {
|
|
683
|
-
|
|
682
|
+
i.pushState(T, "", C);
|
|
684
683
|
} catch {
|
|
685
684
|
r.location.assign(C);
|
|
686
685
|
}
|
|
687
686
|
ne(v);
|
|
688
687
|
}
|
|
689
688
|
}
|
|
690
|
-
function
|
|
691
|
-
var v = A.Replace, E =
|
|
689
|
+
function U(l, u) {
|
|
690
|
+
var v = A.Replace, E = ge(l, u);
|
|
692
691
|
function S() {
|
|
693
|
-
|
|
692
|
+
U(l, u);
|
|
694
693
|
}
|
|
695
694
|
if (process.env.NODE_ENV !== "production" && je(E.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.replace(" + JSON.stringify(l) + ")"), re(v, E, S)) {
|
|
696
|
-
var
|
|
697
|
-
|
|
695
|
+
var N = pe(E, w), T = N[0], C = N[1];
|
|
696
|
+
i.replaceState(T, "", C), ne(v);
|
|
698
697
|
}
|
|
699
698
|
}
|
|
700
699
|
function Q(l) {
|
|
701
|
-
|
|
700
|
+
i.go(l);
|
|
702
701
|
}
|
|
703
702
|
var g = {
|
|
704
703
|
get action() {
|
|
705
704
|
return c;
|
|
706
705
|
},
|
|
707
706
|
get location() {
|
|
708
|
-
return
|
|
707
|
+
return m;
|
|
709
708
|
},
|
|
710
709
|
createHref: j,
|
|
711
|
-
push:
|
|
712
|
-
replace:
|
|
710
|
+
push: me,
|
|
711
|
+
replace: U,
|
|
713
712
|
go: Q,
|
|
714
713
|
back: function() {
|
|
715
714
|
Q(-1);
|
|
@@ -717,36 +716,36 @@ function _t(n) {
|
|
|
717
716
|
forward: function() {
|
|
718
717
|
Q(1);
|
|
719
718
|
},
|
|
720
|
-
listen: function(
|
|
721
|
-
return d.push(
|
|
719
|
+
listen: function(u) {
|
|
720
|
+
return d.push(u);
|
|
722
721
|
},
|
|
723
|
-
block: function(
|
|
724
|
-
var v = b.push(
|
|
725
|
-
return b.length === 1 && r.addEventListener(
|
|
726
|
-
v(), b.length || r.removeEventListener(
|
|
722
|
+
block: function(u) {
|
|
723
|
+
var v = b.push(u);
|
|
724
|
+
return b.length === 1 && r.addEventListener(Ue, Ve), function() {
|
|
725
|
+
v(), b.length || r.removeEventListener(Ue, Ve);
|
|
727
726
|
};
|
|
728
727
|
}
|
|
729
728
|
};
|
|
730
729
|
return g;
|
|
731
730
|
}
|
|
732
|
-
function
|
|
733
|
-
|
|
731
|
+
function Ve(a) {
|
|
732
|
+
a.preventDefault(), a.returnValue = "";
|
|
734
733
|
}
|
|
735
734
|
function He() {
|
|
736
|
-
var
|
|
735
|
+
var a = [];
|
|
737
736
|
return {
|
|
738
737
|
get length() {
|
|
739
|
-
return
|
|
738
|
+
return a.length;
|
|
740
739
|
},
|
|
741
740
|
push: function(t) {
|
|
742
|
-
return
|
|
743
|
-
|
|
741
|
+
return a.push(t), function() {
|
|
742
|
+
a = a.filter(function(r) {
|
|
744
743
|
return r !== t;
|
|
745
744
|
});
|
|
746
745
|
};
|
|
747
746
|
},
|
|
748
747
|
call: function(t) {
|
|
749
|
-
|
|
748
|
+
a.forEach(function(r) {
|
|
750
749
|
return r && r(t);
|
|
751
750
|
});
|
|
752
751
|
}
|
|
@@ -755,42 +754,42 @@ function He() {
|
|
|
755
754
|
function gt() {
|
|
756
755
|
return Math.random().toString(36).substr(2, 8);
|
|
757
756
|
}
|
|
758
|
-
function Ce(
|
|
759
|
-
var e =
|
|
760
|
-
return
|
|
757
|
+
function Ce(a) {
|
|
758
|
+
var e = a.pathname, t = e === void 0 ? "/" : e, r = a.search, i = r === void 0 ? "" : r, s = a.hash, o = s === void 0 ? "" : s;
|
|
759
|
+
return i && i !== "?" && (t += i.charAt(0) === "?" ? i : "?" + i), o && o !== "#" && (t += o.charAt(0) === "#" ? o : "#" + o), t;
|
|
761
760
|
}
|
|
762
|
-
function Qe(
|
|
761
|
+
function Qe(a) {
|
|
763
762
|
var e = {};
|
|
764
|
-
if (
|
|
765
|
-
var t =
|
|
766
|
-
t >= 0 && (e.hash =
|
|
767
|
-
var r =
|
|
768
|
-
r >= 0 && (e.search =
|
|
763
|
+
if (a) {
|
|
764
|
+
var t = a.indexOf("#");
|
|
765
|
+
t >= 0 && (e.hash = a.substr(t), a = a.substr(0, t));
|
|
766
|
+
var r = a.indexOf("?");
|
|
767
|
+
r >= 0 && (e.search = a.substr(r), a = a.substr(0, r)), a && (e.pathname = a);
|
|
769
768
|
}
|
|
770
769
|
return e;
|
|
771
770
|
}
|
|
772
|
-
function
|
|
773
|
-
return lt(
|
|
771
|
+
function ye(a) {
|
|
772
|
+
return lt(a, "Expected `path` to be a string. Got type: %t, value: %v"), a.split("/").map((e) => e.trim()).filter((e) => e !== "");
|
|
774
773
|
}
|
|
775
|
-
function ae(
|
|
774
|
+
function ae(a) {
|
|
776
775
|
var t;
|
|
777
776
|
vt(
|
|
778
777
|
(r) => Xe(r == null ? void 0 : r.toString),
|
|
779
|
-
|
|
778
|
+
a,
|
|
780
779
|
"Expected `parts` to be an array of objects with a .toString() method. Got type: %t, value: %v"
|
|
781
|
-
),
|
|
782
|
-
let e = (t =
|
|
780
|
+
), a = a.filter((r) => r).flatMap(String);
|
|
781
|
+
let e = (t = a.shift()) == null ? void 0 : t.toString();
|
|
783
782
|
if (e) {
|
|
784
|
-
for (const r of
|
|
785
|
-
r.startsWith(".") ? e =
|
|
783
|
+
for (const r of a.map((i) => i.toString()))
|
|
784
|
+
r.startsWith(".") ? e = De(e, r) : e[e.length - 1] !== "/" ? r[0] !== "/" ? e += "/" + r : e += r : r[0] === "/" ? e += r.slice(1) : e += r;
|
|
786
785
|
e && e !== "/" && e.endsWith("/") && (e = e.slice(0, e.length - 1));
|
|
787
786
|
}
|
|
788
787
|
return e ?? "";
|
|
789
788
|
}
|
|
790
|
-
function
|
|
791
|
-
if (lt(
|
|
789
|
+
function De(a, e) {
|
|
790
|
+
if (lt(a, "Expected `base` to be a string. Got type: %t, value: %v"), e == null && (e = a, a = ""), e.startsWith("/"))
|
|
792
791
|
return e;
|
|
793
|
-
let t =
|
|
792
|
+
let t = a;
|
|
794
793
|
for (; ; )
|
|
795
794
|
if (e.startsWith("..")) {
|
|
796
795
|
for (let r = t.length; r > 0; --r)
|
|
@@ -804,25 +803,25 @@ function qe(n, e) {
|
|
|
804
803
|
break;
|
|
805
804
|
return ae([t, e]);
|
|
806
805
|
}
|
|
807
|
-
function Ke(
|
|
808
|
-
if (!
|
|
809
|
-
|
|
810
|
-
const e =
|
|
811
|
-
const [r,
|
|
812
|
-
return
|
|
806
|
+
function Ke(a) {
|
|
807
|
+
if (!a) return {};
|
|
808
|
+
a.startsWith("?") && (a = a.slice(1));
|
|
809
|
+
const e = a.split("&").filter((t) => t.trim() !== "").map((t) => {
|
|
810
|
+
const [r, i] = t.split("=").map((s) => s.trim());
|
|
811
|
+
return i.toLowerCase() === "true" ? [r, !0] : i.toLowerCase() === "false" ? [r, !1] : isNaN(Number(i)) ? [r, i] : [r, Number(i)];
|
|
813
812
|
});
|
|
814
813
|
return Object.fromEntries(e);
|
|
815
814
|
}
|
|
816
|
-
function ot(
|
|
815
|
+
function ot(a, e, t = {}) {
|
|
817
816
|
var o;
|
|
818
|
-
const [r,
|
|
819
|
-
e: for (const f of
|
|
817
|
+
const [r, i] = e.split("?"), s = ye(r);
|
|
818
|
+
e: for (const f of a) {
|
|
820
819
|
const { fragments: c } = f;
|
|
821
|
-
if (!(((o = c[c.length - 1]) == null ? void 0 : o.type) === 3) && c.length !==
|
|
820
|
+
if (!(((o = c[c.length - 1]) == null ? void 0 : o.type) === 3) && c.length !== s.length || t.willMatch && !t.willMatch(f))
|
|
822
821
|
continue e;
|
|
823
822
|
const w = [];
|
|
824
823
|
t: for (let d = 0; d < c.length; d++) {
|
|
825
|
-
const b =
|
|
824
|
+
const b = s[d], $ = c[d];
|
|
826
825
|
if (b == null && $.type !== 3)
|
|
827
826
|
continue e;
|
|
828
827
|
switch ($.type) {
|
|
@@ -836,7 +835,7 @@ function ot(n, e, t = {}) {
|
|
|
836
835
|
w.push({ ...$, value: b });
|
|
837
836
|
break;
|
|
838
837
|
case 3:
|
|
839
|
-
w.push({ ...$, value:
|
|
838
|
+
w.push({ ...$, value: s.slice(d).join("/") });
|
|
840
839
|
break t;
|
|
841
840
|
case 4:
|
|
842
841
|
if (isNaN(Number(b)))
|
|
@@ -847,26 +846,26 @@ function ot(n, e, t = {}) {
|
|
|
847
846
|
throw new Error(`Unknown fragment type: ${$.type}`);
|
|
848
847
|
}
|
|
849
848
|
}
|
|
850
|
-
const
|
|
849
|
+
const m = /* @__PURE__ */ Object.create(null);
|
|
851
850
|
for (const d of w)
|
|
852
|
-
d.type === 2 && (
|
|
851
|
+
d.type === 2 && (m[d.name] = decodeURIComponent(d.value)), d.type === 4 && (m[d.name] = d.value), d.type === 3 && (m.wildcard = "/" + decodeURIComponent(d.value));
|
|
853
852
|
return {
|
|
854
853
|
path: "/" + w.map((d) => d.value).join("/"),
|
|
855
854
|
pattern: "/" + c.map((d) => d.type === 2 ? `{${d.name}}` : d.type === 4 ? `{#${d.name}}` : d.name).join("/"),
|
|
856
|
-
params:
|
|
857
|
-
query: Ke(
|
|
855
|
+
params: m,
|
|
856
|
+
query: Ke(i),
|
|
858
857
|
meta: f.meta
|
|
859
858
|
};
|
|
860
859
|
}
|
|
861
860
|
}
|
|
862
|
-
function Wt(
|
|
863
|
-
const e = [], t = [], r = [],
|
|
864
|
-
for (const o of
|
|
861
|
+
function Wt(a) {
|
|
862
|
+
const e = [], t = [], r = [], i = [];
|
|
863
|
+
for (const o of a) {
|
|
865
864
|
const { fragments: f } = o;
|
|
866
865
|
f.some(
|
|
867
866
|
(c) => c.type === 3
|
|
868
867
|
/* Wildcard */
|
|
869
|
-
) ?
|
|
868
|
+
) ? i.push(o) : f.some(
|
|
870
869
|
(c) => c.type === 4
|
|
871
870
|
/* NumericParam */
|
|
872
871
|
) ? t.push(o) : f.some(
|
|
@@ -874,107 +873,115 @@ function Wt(n) {
|
|
|
874
873
|
/* Param */
|
|
875
874
|
) ? r.push(o) : e.push(o);
|
|
876
875
|
}
|
|
877
|
-
const
|
|
878
|
-
return e.sort(
|
|
876
|
+
const s = (o, f) => o.fragments.length > f.fragments.length ? -1 : 1;
|
|
877
|
+
return e.sort(s), t.sort(s), r.sort(s), i.sort(s), [...e, ...t, ...r, ...i];
|
|
879
878
|
}
|
|
880
|
-
function zt(
|
|
881
|
-
const e =
|
|
879
|
+
function zt(a) {
|
|
880
|
+
const e = ye(a), t = [];
|
|
882
881
|
for (let r = 0; r < e.length; r++) {
|
|
883
|
-
const
|
|
884
|
-
if (
|
|
882
|
+
const i = e[r];
|
|
883
|
+
if (i === "*") {
|
|
885
884
|
if (r !== e.length - 1)
|
|
886
|
-
throw new Error(`Wildcard must be at the end of a pattern. Received: ${
|
|
885
|
+
throw new Error(`Wildcard must be at the end of a pattern. Received: ${a}`);
|
|
887
886
|
t.push({
|
|
888
887
|
type: 3,
|
|
889
888
|
name: "*",
|
|
890
889
|
value: null
|
|
891
890
|
});
|
|
892
|
-
} else
|
|
893
|
-
type:
|
|
894
|
-
name:
|
|
891
|
+
} else i.at(0) === "{" && i.at(-1) === "}" ? t.push({
|
|
892
|
+
type: i[1] === "#" ? 4 : 2,
|
|
893
|
+
name: i[1] === "#" ? i.slice(2, -1) : i.slice(1, -1),
|
|
895
894
|
value: null
|
|
896
895
|
}) : t.push({
|
|
897
896
|
type: 1,
|
|
898
|
-
name:
|
|
899
|
-
value:
|
|
897
|
+
name: i,
|
|
898
|
+
value: i
|
|
900
899
|
});
|
|
901
900
|
}
|
|
902
901
|
return t;
|
|
903
902
|
}
|
|
904
|
-
var
|
|
903
|
+
var le, M, Z, k, ze, W, ke, ee, z, ue, he, fe, Le, B, Je, Ye;
|
|
905
904
|
class Ft {
|
|
906
905
|
constructor(e, t) {
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
906
|
+
h(this, B);
|
|
907
|
+
h(this, le);
|
|
908
|
+
h(this, M);
|
|
909
|
+
h(this, Z);
|
|
910
|
+
h(this, k);
|
|
911
|
+
h(this, ze, 0);
|
|
912
|
+
h(this, W, []);
|
|
913
|
+
h(this, ke);
|
|
914
|
+
h(this, ee, []);
|
|
916
915
|
// Callbacks that need to be called on unmount.
|
|
917
|
-
|
|
916
|
+
h(this, z, []);
|
|
918
917
|
/**
|
|
919
918
|
* The currently matched route pattern, if any.
|
|
920
919
|
*/
|
|
921
|
-
|
|
922
|
-
|
|
920
|
+
L(this, "$pattern");
|
|
921
|
+
h(this, ue);
|
|
923
922
|
/**
|
|
924
923
|
* The current URL path.
|
|
925
924
|
*/
|
|
926
|
-
|
|
927
|
-
|
|
925
|
+
L(this, "$path");
|
|
926
|
+
h(this, he);
|
|
928
927
|
/**
|
|
929
928
|
* The current named path params.
|
|
930
929
|
*/
|
|
931
|
-
|
|
932
|
-
|
|
930
|
+
L(this, "$params");
|
|
931
|
+
h(this, fe);
|
|
933
932
|
/**
|
|
934
933
|
* The current query params. Changes to this object will be reflected in the URL.
|
|
935
934
|
*/
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
const [r,
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
935
|
+
L(this, "$query");
|
|
936
|
+
h(this, Le);
|
|
937
|
+
p(this, le, e), p(this, M, e.createLogger("dolla/router")), p(this, Z, t);
|
|
938
|
+
const [r, i] = K(null), [s, o] = K(""), [f, c] = K({}), [y, w] = K(
|
|
939
|
+
Ke(typeof window > "u" ? "" : window.location.search ?? "")
|
|
940
|
+
);
|
|
941
|
+
this.$pattern = r, p(this, ue, i), this.$path = s, p(this, he, o), this.$params = f, p(this, fe, c), this.$query = y, p(this, Le, w), e.beforeMount(() => {
|
|
942
|
+
n(this, k) != null && (n(this, z).push(
|
|
943
|
+
ut([y], (m) => {
|
|
943
944
|
const d = new URLSearchParams();
|
|
944
|
-
for (const $ in
|
|
945
|
-
d.set($, String(
|
|
945
|
+
for (const $ in m)
|
|
946
|
+
d.set($, String(m[$]));
|
|
946
947
|
const b = "?" + d.toString();
|
|
947
|
-
b !=
|
|
948
|
-
pathname:
|
|
948
|
+
b != n(this, k).location.search && n(this, k).replace({
|
|
949
|
+
pathname: n(this, k).location.pathname,
|
|
949
950
|
search: b
|
|
950
951
|
});
|
|
951
952
|
})
|
|
952
|
-
),
|
|
953
|
-
Bt(
|
|
954
|
-
let d =
|
|
955
|
-
|
|
953
|
+
), n(this, z).push(n(this, k).listen(P(this, B, Ye).bind(this))), P(this, B, Ye).call(this, n(this, k)), n(this, z).push(
|
|
954
|
+
Bt(n(this, Z).rootElement, (m) => {
|
|
955
|
+
let d = m.getAttribute("href");
|
|
956
|
+
n(this, M).info("Intercepted link click", m, d), /^https?:\/\/|^\//.test(d) || (d = ae([n(this, k).location.pathname, d])), n(this, k).push(d);
|
|
956
957
|
})
|
|
957
|
-
),
|
|
958
|
+
), n(this, M).info("Intercepting <a> clicks within root element:", n(this, Z).rootElement));
|
|
958
959
|
}), e.onUnmount(() => {
|
|
959
|
-
for (;
|
|
960
|
-
|
|
960
|
+
for (; n(this, z).length > 0; )
|
|
961
|
+
n(this, z).pop()();
|
|
961
962
|
});
|
|
962
963
|
}
|
|
963
964
|
setup(e) {
|
|
964
|
-
|
|
965
|
+
if (n(this, le).isMounted) {
|
|
966
|
+
n(this, M).crash(
|
|
967
|
+
new Error("Dolla is already mounted. Router setup must be called before Dolla.mount is called.")
|
|
968
|
+
);
|
|
969
|
+
return;
|
|
970
|
+
}
|
|
971
|
+
e.style === "hash" ? p(this, k, _t()) : p(this, k, Ht()), p(this, ee, Wt(
|
|
965
972
|
e.routes.flatMap((t) => P(this, B, Je).call(this, t)).map((t) => ({
|
|
966
973
|
pattern: t.pattern,
|
|
967
974
|
meta: t.meta,
|
|
968
975
|
fragments: zt(t.pattern)
|
|
969
976
|
}))
|
|
970
977
|
));
|
|
971
|
-
for (const t of
|
|
978
|
+
for (const t of n(this, ee))
|
|
972
979
|
if (t.meta.redirect) {
|
|
973
980
|
let r;
|
|
974
|
-
if (!Xe(t.meta.redirect)) if (
|
|
975
|
-
if (r = t.meta.redirect, !ot(
|
|
976
|
-
willMatch(
|
|
977
|
-
return
|
|
981
|
+
if (!Xe(t.meta.redirect)) if (V(t.meta.redirect)) {
|
|
982
|
+
if (r = t.meta.redirect, !ot(n(this, ee), r, {
|
|
983
|
+
willMatch(s) {
|
|
984
|
+
return s !== t;
|
|
978
985
|
}
|
|
979
986
|
}))
|
|
980
987
|
throw new Error(
|
|
@@ -992,23 +999,47 @@ class Ft {
|
|
|
992
999
|
* navigate(["/users", 215], { replace: true }); // replace current history entry with `/users/215`
|
|
993
1000
|
*/
|
|
994
1001
|
go(e, t = {}) {
|
|
1002
|
+
if (n(this, k) == null) {
|
|
1003
|
+
n(this, M).crash(
|
|
1004
|
+
new Error(
|
|
1005
|
+
"Router.go was called, but the router was never configured! Run 'Dolla.router.setup' before 'Dolla.mount' to configure routes."
|
|
1006
|
+
)
|
|
1007
|
+
);
|
|
1008
|
+
return;
|
|
1009
|
+
}
|
|
995
1010
|
let r;
|
|
996
|
-
Array.isArray(e) ? r = ae(e) : r = e.toString(), r =
|
|
1011
|
+
Array.isArray(e) ? r = ae(e) : r = e.toString(), r = De(n(this, k).location.pathname, r), t.preserveQuery && (r += n(this, k).location.search), t.replace ? n(this, k).replace(r) : n(this, k).push(r);
|
|
997
1012
|
}
|
|
998
1013
|
/**
|
|
999
1014
|
* Navigate backward. Pass a number of steps to hit the back button that many times.
|
|
1000
1015
|
*/
|
|
1001
1016
|
back(e = 1) {
|
|
1002
|
-
|
|
1017
|
+
if (n(this, k) == null) {
|
|
1018
|
+
n(this, M).crash(
|
|
1019
|
+
new Error(
|
|
1020
|
+
"Router.back was called, but the router was never configured! Run 'Dolla.router.setup' before 'Dolla.mount' to configure routes."
|
|
1021
|
+
)
|
|
1022
|
+
);
|
|
1023
|
+
return;
|
|
1024
|
+
}
|
|
1025
|
+
n(this, k).go(-e);
|
|
1003
1026
|
}
|
|
1004
1027
|
/**
|
|
1005
1028
|
* Navigate forward. Pass a number of steps to hit the forward button that many times.
|
|
1006
1029
|
*/
|
|
1007
1030
|
forward(e = 1) {
|
|
1008
|
-
|
|
1031
|
+
if (n(this, k) == null) {
|
|
1032
|
+
n(this, M).crash(
|
|
1033
|
+
new Error(
|
|
1034
|
+
"Router.forward was called, but the router was never configured! Run 'Dolla.router.setup' before 'Dolla.mount' to configure routes."
|
|
1035
|
+
)
|
|
1036
|
+
);
|
|
1037
|
+
return;
|
|
1038
|
+
}
|
|
1039
|
+
n(this, k).go(e);
|
|
1009
1040
|
}
|
|
1010
1041
|
}
|
|
1011
|
-
|
|
1042
|
+
le = new WeakMap(), M = new WeakMap(), Z = new WeakMap(), k = new WeakMap(), ze = new WeakMap(), W = new WeakMap(), ke = new WeakMap(), ee = new WeakMap(), z = new WeakMap(), ue = new WeakMap(), he = new WeakMap(), fe = new WeakMap(), Le = new WeakMap(), B = new WeakSet(), /**
|
|
1012
1043
|
* Parses a route definition object into a set of matchable routes.
|
|
1013
1044
|
*
|
|
1014
1045
|
* @param route - Route config object.
|
|
@@ -1023,21 +1054,21 @@ Je = function(e, t = [], r = []) {
|
|
|
1023
1054
|
throw new Error("Route cannot have both a 'redirect' and a 'view'.");
|
|
1024
1055
|
if (!e.view && !e.routes && !e.redirect)
|
|
1025
1056
|
throw new Error("Route must have a 'view', a 'redirect', or a set of nested 'routes'.");
|
|
1026
|
-
let
|
|
1057
|
+
let i = [];
|
|
1027
1058
|
for (const c of t)
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
const
|
|
1059
|
+
i.push(...ye(c.path));
|
|
1060
|
+
i.push(...ye(e.path)), i[i.length - 1] === "*" && i.pop();
|
|
1061
|
+
const s = [];
|
|
1031
1062
|
if (e.redirect) {
|
|
1032
1063
|
let c = e.redirect;
|
|
1033
|
-
return
|
|
1034
|
-
pattern: "/" + ae([...
|
|
1064
|
+
return V(c) && (c = De(ae(i), c), c.startsWith("/") || (c = "/" + c)), s.push({
|
|
1065
|
+
pattern: "/" + ae([...i, ...ye(e.path)]),
|
|
1035
1066
|
meta: {
|
|
1036
1067
|
redirect: c
|
|
1037
1068
|
}
|
|
1038
|
-
}),
|
|
1069
|
+
}), s;
|
|
1039
1070
|
}
|
|
1040
|
-
let o =
|
|
1071
|
+
let o = ht;
|
|
1041
1072
|
if (typeof e.view == "function")
|
|
1042
1073
|
o = e.view;
|
|
1043
1074
|
else if (e.view)
|
|
@@ -1045,9 +1076,9 @@ Je = function(e, t = [], r = []) {
|
|
|
1045
1076
|
const f = { id: et(this, ze)._++, view: o };
|
|
1046
1077
|
if (e.routes)
|
|
1047
1078
|
for (const c of e.routes)
|
|
1048
|
-
|
|
1079
|
+
s.push(...P(this, B, Je).call(this, c, [...t, e], [...r, f]));
|
|
1049
1080
|
else
|
|
1050
|
-
|
|
1081
|
+
s.push({
|
|
1051
1082
|
pattern: parent ? ae([...t.map((c) => c.path), e.path]) : e.path,
|
|
1052
1083
|
meta: {
|
|
1053
1084
|
pattern: e.path,
|
|
@@ -1055,12 +1086,12 @@ Je = function(e, t = [], r = []) {
|
|
|
1055
1086
|
beforeMatch: e.beforeMatch
|
|
1056
1087
|
}
|
|
1057
1088
|
});
|
|
1058
|
-
return
|
|
1089
|
+
return s;
|
|
1059
1090
|
}, Ye = async function({ location: e }) {
|
|
1060
|
-
e.search !==
|
|
1061
|
-
const t = ot(
|
|
1091
|
+
e.search !== n(this, ke) && (p(this, ke, e.search), n(this, Le).call(this, Ke(e.search)));
|
|
1092
|
+
const t = ot(n(this, ee), e.pathname);
|
|
1062
1093
|
if (!t) {
|
|
1063
|
-
|
|
1094
|
+
n(this, ue).call(this, null), n(this, he).call(this, e.pathname), n(this, fe).call(this, {
|
|
1064
1095
|
wildcard: e.pathname
|
|
1065
1096
|
});
|
|
1066
1097
|
return;
|
|
@@ -1069,10 +1100,10 @@ Je = function(e, t = [], r = []) {
|
|
|
1069
1100
|
redirect: (r) => {
|
|
1070
1101
|
throw new Error("Redirect not yet implemented.");
|
|
1071
1102
|
}
|
|
1072
|
-
}),
|
|
1103
|
+
}), n(this, M).info(`Matched route: '${t.pattern}' ('${t.path}')`), t.meta.redirect != null)
|
|
1073
1104
|
if (typeof t.meta.redirect == "string") {
|
|
1074
1105
|
const r = Qt(t.meta.redirect, t.params);
|
|
1075
|
-
|
|
1106
|
+
n(this, M).info(`Redirecting to: '${r}'`), n(this, k).replace(r);
|
|
1076
1107
|
} else if (typeof t.meta.redirect == "function") {
|
|
1077
1108
|
const r = {
|
|
1078
1109
|
path: t.path,
|
|
@@ -1080,86 +1111,86 @@ Je = function(e, t = [], r = []) {
|
|
|
1080
1111
|
params: t.params,
|
|
1081
1112
|
query: t.query
|
|
1082
1113
|
};
|
|
1083
|
-
let
|
|
1084
|
-
if (typeof
|
|
1114
|
+
let i = await t.meta.redirect(r);
|
|
1115
|
+
if (typeof i != "string")
|
|
1085
1116
|
throw new Error("Redirect function must return a path to redirect to.");
|
|
1086
|
-
|
|
1117
|
+
i.startsWith("/") || (i = De(t.path, i)), n(this, M).info(`Redirecting to: '${i}'`), n(this, k).replace(i);
|
|
1087
1118
|
} else
|
|
1088
1119
|
throw new TypeError("Redirect must either be a path string or a function.");
|
|
1089
|
-
else if (
|
|
1090
|
-
|
|
1120
|
+
else if (n(this, he).call(this, t.path), n(this, fe).call(this, t.params), t.pattern !== this.$pattern.get()) {
|
|
1121
|
+
n(this, ue).call(this, t.pattern);
|
|
1091
1122
|
const r = t.meta.layers;
|
|
1092
|
-
for (let
|
|
1093
|
-
const
|
|
1094
|
-
if ((o == null ? void 0 : o.id) !==
|
|
1095
|
-
|
|
1096
|
-
const f =
|
|
1097
|
-
o && o.node.isMounted && o.node.unmount(), f ? f.node.setChildren([c]) :
|
|
1123
|
+
for (let i = 0; i < r.length; i++) {
|
|
1124
|
+
const s = r[i], o = n(this, W)[i];
|
|
1125
|
+
if ((o == null ? void 0 : o.id) !== s.id) {
|
|
1126
|
+
n(this, M).info(`Replacing layer @${i} (active ID: ${o == null ? void 0 : o.id}, matched ID: ${s.id})`), p(this, W, n(this, W).slice(0, i));
|
|
1127
|
+
const f = n(this, W).at(-1), c = n(this, le).constructView(s.view, {});
|
|
1128
|
+
o && o.node.isMounted && o.node.unmount(), f ? f.node.setChildren([c]) : n(this, Z).rootView.setChildren([c]), n(this, W).push({ id: s.id, node: c });
|
|
1098
1129
|
}
|
|
1099
1130
|
}
|
|
1100
1131
|
}
|
|
1101
1132
|
};
|
|
1102
1133
|
const It = /(noopener|noreferrer) (noopener|noreferrer)/, Gt = /^[\w-_]+:/;
|
|
1103
|
-
function Bt(
|
|
1104
|
-
function r(
|
|
1105
|
-
return !
|
|
1134
|
+
function Bt(a, e, t = window) {
|
|
1135
|
+
function r(s) {
|
|
1136
|
+
return !s || s === a ? null : s.localName !== "a" || s.href === void 0 ? r(s.parentNode) : s;
|
|
1106
1137
|
}
|
|
1107
|
-
function s
|
|
1108
|
-
if (
|
|
1138
|
+
function i(s) {
|
|
1139
|
+
if (s.button && s.button !== 0 || s.ctrlKey || s.metaKey || s.altKey || s.shiftKey || s.defaultPrevented)
|
|
1109
1140
|
return;
|
|
1110
|
-
const o = r(
|
|
1111
|
-
o && (t.location.protocol !== o.protocol || t.location.hostname !== o.hostname || t.location.port !== o.port || o.hasAttribute("data-router-ignore") || o.hasAttribute("download") || o.getAttribute("target") === "_blank" && It.test(o.getAttribute("rel")) || Gt.test(o.getAttribute("href")) || (
|
|
1141
|
+
const o = r(s.target);
|
|
1142
|
+
o && (t.location.protocol !== o.protocol || t.location.hostname !== o.hostname || t.location.port !== o.port || o.hasAttribute("data-router-ignore") || o.hasAttribute("download") || o.getAttribute("target") === "_blank" && It.test(o.getAttribute("rel")) || Gt.test(o.getAttribute("href")) || (s.preventDefault(), e(o)));
|
|
1112
1143
|
}
|
|
1113
|
-
return
|
|
1114
|
-
|
|
1144
|
+
return a.addEventListener("click", i), function() {
|
|
1145
|
+
a.removeEventListener("click", i);
|
|
1115
1146
|
};
|
|
1116
1147
|
}
|
|
1117
|
-
function Qt(
|
|
1148
|
+
function Qt(a, e) {
|
|
1118
1149
|
for (const t in e) {
|
|
1119
1150
|
const r = e[t].toString();
|
|
1120
|
-
|
|
1151
|
+
a = a.replace(`{${t}}`, r).replace(`{#${t}}`, r);
|
|
1121
1152
|
}
|
|
1122
|
-
return
|
|
1153
|
+
return a;
|
|
1123
1154
|
}
|
|
1124
1155
|
var F, Pe, I, te, Se, Re, xe, Me, Ne, R, G;
|
|
1125
1156
|
class Kt {
|
|
1126
1157
|
constructor() {
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1158
|
+
L(this, "http");
|
|
1159
|
+
L(this, "language");
|
|
1160
|
+
L(this, "render");
|
|
1161
|
+
L(this, "router");
|
|
1162
|
+
h(this, F, !1);
|
|
1163
|
+
h(this, Pe, "production");
|
|
1164
|
+
h(this, I);
|
|
1165
|
+
h(this, te);
|
|
1166
|
+
h(this, Se, Nt);
|
|
1167
|
+
h(this, Re, []);
|
|
1168
|
+
h(this, xe, []);
|
|
1169
|
+
h(this, Me, []);
|
|
1170
|
+
h(this, Ne, []);
|
|
1171
|
+
h(this, R, {
|
|
1141
1172
|
info: "development",
|
|
1142
1173
|
log: "development",
|
|
1143
1174
|
warn: "development",
|
|
1144
1175
|
error: !0
|
|
1145
1176
|
});
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1177
|
+
h(this, G, rt("*,-dolla/*"));
|
|
1178
|
+
L(this, "createSignal", K);
|
|
1179
|
+
L(this, "createSettableSignal", $t);
|
|
1180
|
+
L(this, "toSettableSignal", Et);
|
|
1181
|
+
L(this, "signalify", Ge);
|
|
1182
|
+
L(this, "designalify", kt);
|
|
1183
|
+
L(this, "derive", Be);
|
|
1184
|
+
L(this, "watch", ut);
|
|
1185
|
+
L(this, "createRef", Lt);
|
|
1186
|
+
L(this, "isRef", Pt);
|
|
1156
1187
|
const e = this;
|
|
1157
|
-
this.http = new Ot(), this.language = new
|
|
1188
|
+
this.http = new Ot(), this.language = new Dt(this), this.render = new Ut(this), this.router = new Ft(this, {
|
|
1158
1189
|
get rootElement() {
|
|
1159
|
-
return
|
|
1190
|
+
return n(e, I);
|
|
1160
1191
|
},
|
|
1161
1192
|
get rootView() {
|
|
1162
|
-
return
|
|
1193
|
+
return n(e, te);
|
|
1163
1194
|
}
|
|
1164
1195
|
});
|
|
1165
1196
|
}
|
|
@@ -1167,47 +1198,47 @@ class Kt {
|
|
|
1167
1198
|
* True when the app is connected to a DOM node and displayed to the user.
|
|
1168
1199
|
*/
|
|
1169
1200
|
get isMounted() {
|
|
1170
|
-
return
|
|
1201
|
+
return n(this, F);
|
|
1171
1202
|
}
|
|
1172
1203
|
/**
|
|
1173
1204
|
* Get the current environment that this app is running in.
|
|
1174
1205
|
* Environment affects which log messages will print and how much debugging info is included in the DOM.
|
|
1175
1206
|
*/
|
|
1176
1207
|
getEnv() {
|
|
1177
|
-
return
|
|
1208
|
+
return n(this, Pe);
|
|
1178
1209
|
}
|
|
1179
1210
|
/**
|
|
1180
1211
|
* Sets the environment that this app is running in.
|
|
1181
1212
|
* Environment affects which log messages will print and how much debugging info is included in the DOM.
|
|
1182
1213
|
*/
|
|
1183
1214
|
setEnv(e) {
|
|
1184
|
-
|
|
1215
|
+
p(this, Pe, e);
|
|
1185
1216
|
}
|
|
1186
1217
|
/**
|
|
1187
1218
|
* Sets the view that will be shown when the `crash` method is called on any logger.
|
|
1188
1219
|
* When a crash is reported the app will be unmounted and replaced with this crash page.
|
|
1189
1220
|
*/
|
|
1190
1221
|
setCrashView(e) {
|
|
1191
|
-
|
|
1222
|
+
p(this, Se, e);
|
|
1192
1223
|
}
|
|
1193
1224
|
async mount(e, t) {
|
|
1194
|
-
if (
|
|
1225
|
+
if (n(this, F))
|
|
1195
1226
|
throw new Error("Dolla is already mounted.");
|
|
1196
|
-
if (
|
|
1197
|
-
const
|
|
1198
|
-
nt(HTMLElement,
|
|
1227
|
+
if (V(e)) {
|
|
1228
|
+
const i = document.querySelector(e);
|
|
1229
|
+
nt(HTMLElement, i, `Selector '${e}' did not match any element.`), p(this, I, i);
|
|
1199
1230
|
} else
|
|
1200
|
-
nt(HTMLElement, e, "Expected an HTML element or a selector string. Got type: %t, value: %v"),
|
|
1231
|
+
nt(HTMLElement, e, "Expected an HTML element or a selector string. Got type: %t, value: %v"), p(this, I, e);
|
|
1201
1232
|
let r;
|
|
1202
|
-
t ? r = at(t) : r = at(
|
|
1203
|
-
for (const
|
|
1204
|
-
|
|
1233
|
+
t ? r = at(t) : r = at(ht), p(this, te, this.constructView(r.type, r.props)), await Promise.all(n(this, Re).map((i) => i())), n(this, te).mount(n(this, I)), p(this, F, !0);
|
|
1234
|
+
for (const i of n(this, xe))
|
|
1235
|
+
i();
|
|
1205
1236
|
}
|
|
1206
1237
|
async unmount() {
|
|
1207
1238
|
var e;
|
|
1208
|
-
if (
|
|
1209
|
-
await Promise.all(
|
|
1210
|
-
for (const t of
|
|
1239
|
+
if (n(this, F)) {
|
|
1240
|
+
await Promise.all(n(this, Me).map((t) => t())), (e = n(this, te)) == null || e.unmount(), p(this, F, !1);
|
|
1241
|
+
for (const t of n(this, Ne))
|
|
1211
1242
|
t();
|
|
1212
1243
|
}
|
|
1213
1244
|
}
|
|
@@ -1216,26 +1247,26 @@ class Kt {
|
|
|
1216
1247
|
* it will be awaited before mounting finishes. Use this to perform initial setup before the app is displayed to the user.
|
|
1217
1248
|
*/
|
|
1218
1249
|
beforeMount(e) {
|
|
1219
|
-
|
|
1250
|
+
n(this, Re).push(e);
|
|
1220
1251
|
}
|
|
1221
1252
|
/**
|
|
1222
1253
|
* Registers a `callback` to run after the app is mounted.
|
|
1223
1254
|
*/
|
|
1224
1255
|
onMount(e) {
|
|
1225
|
-
|
|
1256
|
+
n(this, xe).push(e);
|
|
1226
1257
|
}
|
|
1227
1258
|
/**
|
|
1228
1259
|
* Registers a `callback` to run after `Dolla.unmount` is called, before the app is unmounted. If `callback` returns a Promise,
|
|
1229
1260
|
* it will be awaited before unmounting finishes. Use this to perform cleanup.
|
|
1230
1261
|
*/
|
|
1231
1262
|
beforeUnmount(e) {
|
|
1232
|
-
|
|
1263
|
+
n(this, Me).push(e);
|
|
1233
1264
|
}
|
|
1234
1265
|
/**
|
|
1235
1266
|
* Registers a `callback` to run after the app is unmounted.
|
|
1236
1267
|
*/
|
|
1237
1268
|
onUnmount(e) {
|
|
1238
|
-
|
|
1269
|
+
n(this, Ne).push(e);
|
|
1239
1270
|
}
|
|
1240
1271
|
/**
|
|
1241
1272
|
* Update log type toggles. Values that are not passed will remain unchanged.
|
|
@@ -1243,24 +1274,24 @@ class Kt {
|
|
|
1243
1274
|
setLoggles(e) {
|
|
1244
1275
|
for (const t in e) {
|
|
1245
1276
|
const r = e[t];
|
|
1246
|
-
r && (
|
|
1277
|
+
r && (n(this, R)[t] = r);
|
|
1247
1278
|
}
|
|
1248
1279
|
}
|
|
1249
1280
|
setLogFilter(e) {
|
|
1250
|
-
|
|
1281
|
+
p(this, G, rt(e));
|
|
1251
1282
|
}
|
|
1252
1283
|
createLogger(e, t) {
|
|
1253
|
-
const r = Ge(e),
|
|
1284
|
+
const r = Ge(e), i = (t == null ? void 0 : t.console) ?? St(), s = this;
|
|
1254
1285
|
return {
|
|
1255
1286
|
get info() {
|
|
1256
1287
|
var f;
|
|
1257
1288
|
const o = r.get();
|
|
1258
|
-
if (
|
|
1289
|
+
if (n(s, R).info === !1 || V(n(s, R).info) && n(s, R).info !== s.getEnv() || !n(f = s, G).call(f, o))
|
|
1259
1290
|
return Oe;
|
|
1260
1291
|
{
|
|
1261
1292
|
let c = `%c${o}`;
|
|
1262
|
-
return t != null && t.uid ? c += ` %c[uid: %c${t.uid}%c]` : c += "%c%c%c",
|
|
1263
|
-
|
|
1293
|
+
return t != null && t.uid ? c += ` %c[uid: %c${t.uid}%c]` : c += "%c%c%c", i.info.bind(
|
|
1294
|
+
i,
|
|
1264
1295
|
c,
|
|
1265
1296
|
`color:${Te(c)};font-weight:bold`,
|
|
1266
1297
|
"color:#777",
|
|
@@ -1272,12 +1303,12 @@ class Kt {
|
|
|
1272
1303
|
get log() {
|
|
1273
1304
|
var f;
|
|
1274
1305
|
const o = r.get();
|
|
1275
|
-
if (
|
|
1306
|
+
if (n(s, R).log === !1 || V(n(s, R).log) && n(s, R).log !== s.getEnv() || !n(f = s, G).call(f, o))
|
|
1276
1307
|
return Oe;
|
|
1277
1308
|
{
|
|
1278
1309
|
let c = `%c${o}`;
|
|
1279
|
-
return t != null && t.uid ? c += ` %c[uid: %c${t.uid}%c]` : c += "%c%c%c",
|
|
1280
|
-
|
|
1310
|
+
return t != null && t.uid ? c += ` %c[uid: %c${t.uid}%c]` : c += "%c%c%c", i.log.bind(
|
|
1311
|
+
i,
|
|
1281
1312
|
c,
|
|
1282
1313
|
`color:${Te(c)};font-weight:bold`,
|
|
1283
1314
|
"color:#777",
|
|
@@ -1289,12 +1320,12 @@ class Kt {
|
|
|
1289
1320
|
get warn() {
|
|
1290
1321
|
var f;
|
|
1291
1322
|
const o = r.get();
|
|
1292
|
-
if (
|
|
1323
|
+
if (n(s, R).warn === !1 || V(n(s, R).warn) && n(s, R).warn !== s.getEnv() || !n(f = s, G).call(f, o))
|
|
1293
1324
|
return Oe;
|
|
1294
1325
|
{
|
|
1295
1326
|
let c = `%c${o}`;
|
|
1296
|
-
return t != null && t.uid ? c += ` %c[uid: %c${t.uid}%c]` : c += "%c%c%c",
|
|
1297
|
-
|
|
1327
|
+
return t != null && t.uid ? c += ` %c[uid: %c${t.uid}%c]` : c += "%c%c%c", i.warn.bind(
|
|
1328
|
+
i,
|
|
1298
1329
|
c,
|
|
1299
1330
|
`color:${Te(c)};font-weight:bold`,
|
|
1300
1331
|
"color:#777",
|
|
@@ -1306,12 +1337,12 @@ class Kt {
|
|
|
1306
1337
|
get error() {
|
|
1307
1338
|
var f;
|
|
1308
1339
|
const o = r.get();
|
|
1309
|
-
if (
|
|
1340
|
+
if (n(s, R).error === !1 || V(n(s, R).error) && n(s, R).error !== s.getEnv() || !n(f = s, G).call(f, o))
|
|
1310
1341
|
return Oe;
|
|
1311
1342
|
{
|
|
1312
1343
|
let c = `%c${o}`;
|
|
1313
|
-
return t != null && t.uid ? c += ` %c[uid: %c${t.uid}%c]` : c += "%c%c%c",
|
|
1314
|
-
|
|
1344
|
+
return t != null && t.uid ? c += ` %c[uid: %c${t.uid}%c]` : c += "%c%c%c", i.error.bind(
|
|
1345
|
+
i,
|
|
1315
1346
|
c,
|
|
1316
1347
|
`color:${Te(c)};font-weight:bold`,
|
|
1317
1348
|
"color:#777",
|
|
@@ -1321,11 +1352,11 @@ class Kt {
|
|
|
1321
1352
|
}
|
|
1322
1353
|
},
|
|
1323
1354
|
crash(o) {
|
|
1324
|
-
throw
|
|
1355
|
+
throw s.isMounted && (s.unmount(), s.constructView(n(s, Se), {
|
|
1325
1356
|
error: o,
|
|
1326
1357
|
loggerName: r.get(),
|
|
1327
1358
|
uid: t == null ? void 0 : t.uid
|
|
1328
|
-
}).mount(
|
|
1359
|
+
}).mount(n(s, I))), o;
|
|
1329
1360
|
}
|
|
1330
1361
|
};
|
|
1331
1362
|
}
|
|
@@ -1360,7 +1391,6 @@ export {
|
|
|
1360
1391
|
ar as repeat,
|
|
1361
1392
|
Ge as signalify,
|
|
1362
1393
|
Zt as t,
|
|
1363
|
-
Et as toSettableSignal
|
|
1364
|
-
ht as watch
|
|
1394
|
+
Et as toSettableSignal
|
|
1365
1395
|
};
|
|
1366
1396
|
//# sourceMappingURL=index.js.map
|