@manyducks.co/dolla 2.0.0-alpha.13 → 2.0.0-alpha.15
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 +20 -15
- package/dist/index.d.ts +7 -5
- package/dist/index.js +515 -484
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.js +2 -2
- package/dist/jsx-runtime.js +2 -2
- package/dist/markup.d.ts +19 -17
- package/dist/modules/dolla.d.ts +19 -6
- package/dist/modules/i18n.d.ts +22 -2
- package/dist/modules/router.d.ts +2 -2
- package/dist/nodes/cond.d.ts +3 -3
- package/dist/nodes/html.d.ts +5 -4
- package/dist/nodes/observer.d.ts +4 -3
- package/dist/nodes/outlet.d.ts +6 -6
- package/dist/nodes/portal.d.ts +3 -3
- package/dist/nodes/repeat.d.ts +3 -3
- package/dist/nodes/text.d.ts +2 -2
- package/dist/passthrough-CBbog_A9.js +1433 -0
- package/dist/passthrough-CBbog_A9.js.map +1 -0
- package/dist/state.d.ts +60 -11
- package/dist/types.d.ts +2 -2
- package/dist/view.d.ts +6 -6
- package/notes/scratch.md +50 -0
- package/package.json +2 -1
- package/dist/passthrough-Bz5ZF4jn.js +0 -1279
- package/dist/passthrough-Bz5ZF4jn.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var St = Object.defineProperty;
|
|
2
|
+
var lt = (i) => {
|
|
3
3
|
throw TypeError(i);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var s = (i, e, t) => (
|
|
8
|
-
var
|
|
5
|
+
var Lt = (i, e, t) => e in i ? St(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
6
|
+
var S = (i, e, t) => Lt(i, typeof e != "symbol" ? e + "" : e, t), Je = (i, e, t) => e.has(i) || lt("Cannot " + t);
|
|
7
|
+
var s = (i, e, t) => (Je(i, e, "read from private field"), t ? t.call(i) : e.get(i)), f = (i, e, t) => e.has(i) ? lt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), b = (i, e, t, r) => (Je(i, e, "write to private field"), r ? r.call(i, t) : e.set(i, t), t), E = (i, e, t) => (Je(i, e, "access private method"), t);
|
|
8
|
+
var ct = (i, e, t, r) => ({
|
|
9
9
|
set _(a) {
|
|
10
10
|
b(i, e, a, t);
|
|
11
11
|
},
|
|
@@ -13,10 +13,10 @@ var it = (i, e, t, r) => ({
|
|
|
13
13
|
return s(i, e, r);
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
-
import { h as
|
|
17
|
-
import { B as
|
|
18
|
-
function
|
|
19
|
-
return
|
|
16
|
+
import { h as ut, c as xt, i as Ye, a as ie, d as ye, b as Rt, e as ot, f as V, t as ht, g as yt, j as Ot, k as Xe, P as bt, l as ft, m as Nt, n as Mt, o as dt, v as Tt, p as Dt, q as At, r as pt, s as mt, u as _t, w as Ce, x as Fe, y as jt, z as Ct, A as Ft } from "./passthrough-CBbog_A9.js";
|
|
17
|
+
import { B as dr, C as pr, D as mr } from "./passthrough-CBbog_A9.js";
|
|
18
|
+
function Vt(i) {
|
|
19
|
+
return ut`
|
|
20
20
|
<div
|
|
21
21
|
style=${{
|
|
22
22
|
backgroundColor: "#880000",
|
|
@@ -30,7 +30,7 @@ function _t(i) {
|
|
|
30
30
|
<h1 style=${{ marginBottom: "0.5rem" }}>The app has crashed</h1>
|
|
31
31
|
<p style=${{ marginBottom: "0.25rem" }}>
|
|
32
32
|
<span style=${{ fontFamily: "monospace" }}>${i.loggerName}</span>
|
|
33
|
-
${
|
|
33
|
+
${xt(i.uid, ut`<span style=${{ fontFamily: "monospace", opacity: 0.5 }}> [uid: ${i.uid}]</span>`)}
|
|
34
34
|
${" "}says:
|
|
35
35
|
</p>
|
|
36
36
|
<blockquote
|
|
@@ -62,12 +62,12 @@ function _t(i) {
|
|
|
62
62
|
</div>
|
|
63
63
|
`;
|
|
64
64
|
}
|
|
65
|
-
var
|
|
66
|
-
class
|
|
65
|
+
var J, ze, T, j;
|
|
66
|
+
class qt {
|
|
67
67
|
constructor() {
|
|
68
68
|
f(this, T);
|
|
69
|
-
f(this,
|
|
70
|
-
f(this,
|
|
69
|
+
f(this, J, []);
|
|
70
|
+
f(this, ze, Ut());
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
73
73
|
* Adds a new middleware that will apply to subsequent requests.
|
|
@@ -76,60 +76,60 @@ class Ct {
|
|
|
76
76
|
* @param middleware - A middleware function that will intercept requests.
|
|
77
77
|
*/
|
|
78
78
|
use(e) {
|
|
79
|
-
return s(this,
|
|
80
|
-
s(this,
|
|
79
|
+
return s(this, J).push(e), () => {
|
|
80
|
+
s(this, J).splice(s(this, J).indexOf(e), 1);
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
async get(e, t) {
|
|
84
|
-
return
|
|
84
|
+
return E(this, T, j).call(this, "get", e, t);
|
|
85
85
|
}
|
|
86
86
|
async put(e, t) {
|
|
87
|
-
return
|
|
87
|
+
return E(this, T, j).call(this, "put", e, t);
|
|
88
88
|
}
|
|
89
89
|
async patch(e, t) {
|
|
90
|
-
return
|
|
90
|
+
return E(this, T, j).call(this, "patch", e, t);
|
|
91
91
|
}
|
|
92
92
|
async post(e, t) {
|
|
93
|
-
return
|
|
93
|
+
return E(this, T, j).call(this, "post", e, t);
|
|
94
94
|
}
|
|
95
95
|
async delete(e, t) {
|
|
96
|
-
return
|
|
96
|
+
return E(this, T, j).call(this, "delete", e, t);
|
|
97
97
|
}
|
|
98
98
|
async head(e, t) {
|
|
99
|
-
return
|
|
99
|
+
return E(this, T, j).call(this, "head", e, t);
|
|
100
100
|
}
|
|
101
101
|
async options(e, t) {
|
|
102
|
-
return
|
|
102
|
+
return E(this, T, j).call(this, "options", e, t);
|
|
103
103
|
}
|
|
104
104
|
async trace(e, t) {
|
|
105
|
-
return
|
|
105
|
+
return E(this, T, j).call(this, "trace", e, t);
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
|
|
109
|
-
return
|
|
108
|
+
J = new WeakMap(), ze = new WeakMap(), T = new WeakSet(), j = async function(e, t, r) {
|
|
109
|
+
return It({
|
|
110
110
|
...r,
|
|
111
111
|
method: e,
|
|
112
112
|
uri: t,
|
|
113
|
-
middleware: s(this,
|
|
114
|
-
fetch: s(this,
|
|
113
|
+
middleware: s(this, J),
|
|
114
|
+
fetch: s(this, ze)
|
|
115
115
|
});
|
|
116
116
|
};
|
|
117
|
-
function
|
|
117
|
+
function Ut() {
|
|
118
118
|
if (typeof window < "u" && window.fetch)
|
|
119
119
|
return window.fetch.bind(window);
|
|
120
120
|
if (typeof global < "u" && global.fetch)
|
|
121
121
|
return global.fetch.bind(global);
|
|
122
122
|
throw new Error("Running in neither browser nor node. Please run this app in one of the supported environments.");
|
|
123
123
|
}
|
|
124
|
-
class
|
|
124
|
+
class Ht extends Error {
|
|
125
125
|
constructor(t) {
|
|
126
|
-
const { status: r, statusText: a, method: n, uri: o } = t,
|
|
127
|
-
super(
|
|
128
|
-
|
|
126
|
+
const { status: r, statusText: a, method: n, uri: o } = t, h = `${r} ${a}: Request failed (${n.toUpperCase()} ${o})`;
|
|
127
|
+
super(h);
|
|
128
|
+
S(this, "response");
|
|
129
129
|
this.response = t;
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
async function
|
|
132
|
+
async function It(i) {
|
|
133
133
|
const { headers: e, query: t, fetch: r, middleware: a } = i, n = {
|
|
134
134
|
method: i.method,
|
|
135
135
|
uri: i.uri,
|
|
@@ -142,81 +142,80 @@ async function qt(i) {
|
|
|
142
142
|
};
|
|
143
143
|
if (e)
|
|
144
144
|
if (e instanceof Map || e instanceof Headers)
|
|
145
|
-
e.forEach((l,
|
|
146
|
-
n.headers.set(
|
|
145
|
+
e.forEach((l, d) => {
|
|
146
|
+
n.headers.set(d, l);
|
|
147
147
|
});
|
|
148
148
|
else if (e != null && typeof e == "object" && !Array.isArray(e))
|
|
149
149
|
for (const l in e) {
|
|
150
|
-
const
|
|
151
|
-
|
|
150
|
+
const d = e[l];
|
|
151
|
+
d instanceof Date ? n.headers.set(l, d.toISOString()) : d != null && n.headers.set(l, String(d));
|
|
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
|
-
t.forEach((l,
|
|
158
|
-
n.query.set(
|
|
157
|
+
t.forEach((l, d) => {
|
|
158
|
+
n.query.set(d, l);
|
|
159
159
|
});
|
|
160
160
|
else if (t != null && typeof t == "object" && !Array.isArray(t))
|
|
161
161
|
for (const l in t) {
|
|
162
|
-
const
|
|
163
|
-
|
|
162
|
+
const d = t[l];
|
|
163
|
+
d instanceof Date ? n.query.set(l, d.toISOString()) : d != null && n.query.set(l, String(d));
|
|
164
164
|
}
|
|
165
165
|
else
|
|
166
166
|
throw new TypeError(`Unknown query params type. Got: ${t}`);
|
|
167
167
|
let o;
|
|
168
|
-
const
|
|
169
|
-
const l = n.query.toString(),
|
|
170
|
-
let
|
|
171
|
-
!n.headers.has("content-type") &&
|
|
172
|
-
const
|
|
168
|
+
const h = async () => {
|
|
169
|
+
const l = n.query.toString(), d = l.length > 0 ? n.uri + "?" + l : n.uri;
|
|
170
|
+
let g;
|
|
171
|
+
!n.headers.has("content-type") && Ye(n.body) ? (n.headers.set("content-type", "application/json"), g = JSON.stringify(n.body)) : g = n.body;
|
|
172
|
+
const m = await r(d, {
|
|
173
173
|
method: n.method,
|
|
174
174
|
headers: n.headers,
|
|
175
|
-
body:
|
|
176
|
-
}),
|
|
177
|
-
let
|
|
178
|
-
y != null && y.includes("application/json") ?
|
|
175
|
+
body: g
|
|
176
|
+
}), u = Object.fromEntries(m.headers.entries()), y = u["content-type"];
|
|
177
|
+
let k;
|
|
178
|
+
y != null && y.includes("application/json") ? k = await m.json() : y != null && y.includes("application/x-www-form-urlencoded") ? k = await m.formData() : k = await m.text(), o = {
|
|
179
179
|
method: n.method,
|
|
180
180
|
uri: n.uri,
|
|
181
|
-
status:
|
|
182
|
-
statusText:
|
|
183
|
-
headers:
|
|
184
|
-
body:
|
|
181
|
+
status: m.status,
|
|
182
|
+
statusText: m.statusText,
|
|
183
|
+
headers: u,
|
|
184
|
+
body: k
|
|
185
185
|
};
|
|
186
186
|
};
|
|
187
187
|
if (a.length > 0) {
|
|
188
|
-
const l = (
|
|
189
|
-
const
|
|
190
|
-
return async () =>
|
|
188
|
+
const l = (d = 0) => {
|
|
189
|
+
const g = a[d], m = a[d + 1] ? l(d + 1) : h;
|
|
190
|
+
return async () => g(n, async () => (await m(), o));
|
|
191
191
|
};
|
|
192
192
|
await l()();
|
|
193
193
|
} else
|
|
194
|
-
await
|
|
194
|
+
await h();
|
|
195
195
|
if (o.status < 200 || o.status >= 400)
|
|
196
|
-
throw new
|
|
196
|
+
throw new Ht(o);
|
|
197
197
|
return o;
|
|
198
198
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
class Ht {
|
|
199
|
+
var Ke, oe, re, Ze, vt;
|
|
200
|
+
class Wt {
|
|
202
201
|
constructor(e, t) {
|
|
203
202
|
f(this, re);
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
f(this,
|
|
203
|
+
S(this, "dolla");
|
|
204
|
+
S(this, "config");
|
|
205
|
+
f(this, Ke, !1);
|
|
207
206
|
f(this, oe, /* @__PURE__ */ new Map());
|
|
208
207
|
this.config = e, this.dolla = t;
|
|
209
208
|
}
|
|
210
209
|
async load() {
|
|
211
210
|
let e;
|
|
212
|
-
if (!s(this,
|
|
213
|
-
if (
|
|
214
|
-
if (e = await this.config.fetch(), !
|
|
211
|
+
if (!s(this, Ke)) {
|
|
212
|
+
if (ot(this.config.fetch)) {
|
|
213
|
+
if (e = await this.config.fetch(), !Ye(e))
|
|
215
214
|
throw new Error(`Fetch function did not return an object of language strings: ${e}`);
|
|
216
|
-
} else if (
|
|
215
|
+
} else if (V(this.config.path)) {
|
|
217
216
|
const t = await this.dolla.http.get(this.config.path);
|
|
218
217
|
if (t.status >= 200 && t.status < 300)
|
|
219
|
-
if (
|
|
218
|
+
if (Ye(t.body))
|
|
220
219
|
e = t.body;
|
|
221
220
|
else
|
|
222
221
|
throw new Error(
|
|
@@ -226,53 +225,54 @@ class Ht {
|
|
|
226
225
|
throw new Error("HTTP request failed.");
|
|
227
226
|
}
|
|
228
227
|
}
|
|
229
|
-
if (e
|
|
230
|
-
|
|
231
|
-
{
|
|
232
|
-
const t = k(this, re, Je).call(this, e);
|
|
228
|
+
if (e) {
|
|
229
|
+
const t = E(this, re, Ze).call(this, e);
|
|
233
230
|
for (const r of t)
|
|
234
231
|
s(this, oe).set(r[0], r[1]);
|
|
235
|
-
}
|
|
232
|
+
} else
|
|
233
|
+
throw new Error("Language could not be loaded.");
|
|
236
234
|
}
|
|
237
235
|
getTemplate(e) {
|
|
238
|
-
return s(this, oe).get(e) ??
|
|
236
|
+
return s(this, oe).get(e) ?? {
|
|
237
|
+
segments: [{ type: 0, text: `[MISSING: ${e}]` }]
|
|
238
|
+
};
|
|
239
239
|
}
|
|
240
240
|
hasTemplate(e) {
|
|
241
241
|
return s(this, oe).has(e);
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
|
-
|
|
244
|
+
Ke = new WeakMap(), oe = new WeakMap(), re = new WeakSet(), Ze = function(e, t = []) {
|
|
245
245
|
const r = [];
|
|
246
246
|
for (const a in e)
|
|
247
|
-
switch (
|
|
247
|
+
switch (ht(e[a])) {
|
|
248
248
|
case "string":
|
|
249
|
-
r.push([[...t, a].join("."),
|
|
249
|
+
r.push([[...t, a].join("."), E(this, re, vt).call(this, e[a])]);
|
|
250
250
|
break;
|
|
251
251
|
case "object":
|
|
252
|
-
r.push(...
|
|
252
|
+
r.push(...E(this, re, Ze).call(this, e[a], [...t, a]));
|
|
253
253
|
break;
|
|
254
254
|
default:
|
|
255
255
|
throw new Error(
|
|
256
|
-
`Expected to find a string or object at ${[...t, a].join(".")}. Got: ${
|
|
256
|
+
`Expected to find a string or object at ${[...t, a].join(".")}. Got: ${ht(e[a])}`
|
|
257
257
|
);
|
|
258
258
|
}
|
|
259
259
|
return r;
|
|
260
|
-
},
|
|
260
|
+
}, vt = function(e) {
|
|
261
261
|
let t;
|
|
262
|
-
((
|
|
263
|
-
|
|
262
|
+
((u) => {
|
|
263
|
+
u[u.Static = 0] = "Static", u[u.ValueName = 1] = "ValueName", u[u.FormatName = 2] = "FormatName", u[u.FormatOptionName = 3] = "FormatOptionName", u[u.FormatOptionValue = 4] = "FormatOptionValue", u[u.FormatOptionEnd = 5] = "FormatOptionEnd";
|
|
264
264
|
})(t || (t = {}));
|
|
265
265
|
const r = {
|
|
266
266
|
segments: []
|
|
267
267
|
};
|
|
268
|
-
let a = "", n = 0, o = 0,
|
|
269
|
-
const
|
|
270
|
-
|
|
268
|
+
let a = "", n = 0, o = 0, h, l, d;
|
|
269
|
+
const g = () => {
|
|
270
|
+
h = {
|
|
271
271
|
type: 1,
|
|
272
272
|
name: "",
|
|
273
273
|
formats: []
|
|
274
274
|
};
|
|
275
|
-
},
|
|
275
|
+
}, m = () => {
|
|
276
276
|
l = {
|
|
277
277
|
name: "",
|
|
278
278
|
options: {}
|
|
@@ -285,58 +285,58 @@ We = new WeakMap(), oe = new WeakMap(), re = new WeakSet(), Je = function(e, t =
|
|
|
285
285
|
}
|
|
286
286
|
switch (o) {
|
|
287
287
|
case 0:
|
|
288
|
-
e[n] === "{" && e[n + 1] === "{" ? (o = 1, n += 2, a.length > 0 && (r.segments.push({ type: 0, text: a }), a = ""),
|
|
288
|
+
e[n] === "{" && e[n + 1] === "{" ? (o = 1, n += 2, a.length > 0 && (r.segments.push({ type: 0, text: a }), a = ""), g()) : (a += e[n], n++);
|
|
289
289
|
break;
|
|
290
290
|
case 1:
|
|
291
|
-
e[n] === "|" ? (o = 2, n += 1,
|
|
291
|
+
e[n] === "|" ? (o = 2, n += 1, h.name = a, a = "", m()) : e[n] === "}" && e[n + 1] === "}" ? (o = 0, n += 2, h.name = a, a = "", r.segments.push(h)) : (a += e[n], n++);
|
|
292
292
|
break;
|
|
293
293
|
case 2:
|
|
294
|
-
e[n] === "(" ? (o = 3, n += 1, l.name = a, a = "") : e[n] === "}" && e[n + 1] === "}" ? (o = 0, n += 2,
|
|
294
|
+
e[n] === "(" ? (o = 3, n += 1, l.name = a, a = "") : e[n] === "}" && e[n + 1] === "}" ? (o = 0, n += 2, h.formats.push(l), r.segments.push(h)) : (a += e[n], n++);
|
|
295
295
|
break;
|
|
296
296
|
case 3:
|
|
297
|
-
e[n] === ")" || (e[n] === ":" ? (o = 4, n += 1,
|
|
297
|
+
e[n] === ")" || (e[n] === ":" ? (o = 4, n += 1, d = a, a = "") : e[n] === "}" && e[n + 1] === "}" || (a += e[n], n++));
|
|
298
298
|
break;
|
|
299
299
|
case 4:
|
|
300
|
-
e[n] === ")" ? (o = 5, n += 1, l.options[
|
|
300
|
+
e[n] === ")" ? (o = 5, n += 1, l.options[d] = a, a = "", h.formats.push(l)) : e[n] === "," ? (o = 3, n += 1, l.options[d] = a, a = "") : e[n] === "}" && e[n + 1] === "}" || (a += e[n], n++);
|
|
301
301
|
break;
|
|
302
302
|
case 5:
|
|
303
|
-
e[n] === "|" ? (o = 2, n += 1,
|
|
303
|
+
e[n] === "|" ? (o = 2, n += 1, m()) : e[n] === "}" && e[n + 1] === "}" && (o = 0, n += 2, r.segments.push(h));
|
|
304
304
|
break;
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
307
|
return o === 0 && a.length > 0 && r.segments.push({ type: 0, text: a }), r;
|
|
308
308
|
};
|
|
309
|
-
var ve, q,
|
|
310
|
-
class
|
|
309
|
+
var ve, q, R, $e, Ee, ke, Pe, O, $t, et, tt, rt, Et;
|
|
310
|
+
class Gt {
|
|
311
311
|
constructor(e) {
|
|
312
|
-
f(this,
|
|
312
|
+
f(this, O);
|
|
313
313
|
f(this, ve);
|
|
314
314
|
f(this, q);
|
|
315
|
-
f(this,
|
|
315
|
+
f(this, R, /* @__PURE__ */ new Map());
|
|
316
316
|
f(this, $e, []);
|
|
317
|
-
f(this,
|
|
317
|
+
f(this, Ee, /* @__PURE__ */ new Map());
|
|
318
318
|
f(this, ke, "auto");
|
|
319
|
-
|
|
320
|
-
f(this,
|
|
319
|
+
S(this, "$locale");
|
|
320
|
+
f(this, Pe);
|
|
321
321
|
b(this, ve, e), b(this, q, e.createLogger("dolla/i18n"));
|
|
322
322
|
const [t, r] = ie();
|
|
323
|
-
this.$locale = t, b(this,
|
|
324
|
-
s(this,
|
|
323
|
+
this.$locale = t, b(this, Pe, r), this.addFormat("number", (a, n, o) => E(this, O, et).call(this, Number(n), o)), this.addFormat("datetime", (a, n, o) => E(this, O, tt).call(this, n, o)), this.addFormat("list", (a, n, o) => E(this, O, rt).call(this, n, o)), e.beforeMount(async () => {
|
|
324
|
+
s(this, R).size > 0 && await this.setLocale(s(this, ke));
|
|
325
325
|
});
|
|
326
326
|
}
|
|
327
327
|
get locales() {
|
|
328
|
-
return [...s(this,
|
|
328
|
+
return [...s(this, R).keys()];
|
|
329
329
|
}
|
|
330
330
|
setup(e) {
|
|
331
331
|
if (e.translations.forEach((t) => {
|
|
332
|
-
s(this,
|
|
332
|
+
s(this, R).set(t.locale, new Wt(t, s(this, ve)));
|
|
333
333
|
}), e.locale && e.locale !== "auto") {
|
|
334
334
|
if (!e.translations.some((r) => r.locale === e.locale))
|
|
335
335
|
throw new Error(`Initial locale '${e.locale}' is not registered in the locales array.`);
|
|
336
336
|
b(this, ke, e.locale);
|
|
337
337
|
}
|
|
338
338
|
s(this, q).info(
|
|
339
|
-
`${s(this,
|
|
339
|
+
`${s(this, R).size} language${s(this, R).size === 1 ? "" : "s"} supported: '${[...s(this, R).keys()].join("', '")}'`
|
|
340
340
|
);
|
|
341
341
|
}
|
|
342
342
|
async setLocale(e) {
|
|
@@ -349,18 +349,18 @@ class It {
|
|
|
349
349
|
((a = o.languages) == null ? void 0 : a.length) > 0 ? n.push(...o.languages) : o.language ? n.push(o.language) : o.browserLanguage ? n.push(o.browserLanguage) : o.userLanguage && n.push(o.userLanguage);
|
|
350
350
|
}
|
|
351
351
|
for (const o of n)
|
|
352
|
-
s(this,
|
|
352
|
+
s(this, R).has(o) && (t = o);
|
|
353
353
|
} else
|
|
354
|
-
s(this,
|
|
354
|
+
s(this, R).has(e) && (t = e);
|
|
355
355
|
if (t == null) {
|
|
356
|
-
const n = s(this,
|
|
356
|
+
const n = s(this, R).keys().next().value;
|
|
357
357
|
n && (t = n);
|
|
358
358
|
}
|
|
359
|
-
if (!t || !s(this,
|
|
360
|
-
throw new Error(`
|
|
361
|
-
const r = s(this,
|
|
359
|
+
if (!t || !s(this, R).has(t))
|
|
360
|
+
throw new Error(`Locale '${e}' has no translation.`);
|
|
361
|
+
const r = s(this, R).get(t);
|
|
362
362
|
try {
|
|
363
|
-
await r.load(), b(this, $e, []), s(this,
|
|
363
|
+
await r.load(), b(this, $e, []), s(this, Pe).call(this, t), s(this, q).info("set language to " + t);
|
|
364
364
|
} catch (n) {
|
|
365
365
|
n instanceof Error && s(this, q).crash(n);
|
|
366
366
|
}
|
|
@@ -379,16 +379,16 @@ class It {
|
|
|
379
379
|
throw new Error(
|
|
380
380
|
`The 't' function cannot be destructured. If you need a standalone version you can import it like so: 'import { t } from "@manyducks.co/dolla"'`
|
|
381
381
|
);
|
|
382
|
-
if (!this.$locale.get())
|
|
383
|
-
return Ut;
|
|
384
382
|
let r = [], a = [];
|
|
385
383
|
for (const n in t)
|
|
386
384
|
r.push(n), a.push(t[n]);
|
|
387
385
|
return ye([this.$locale, ...a], (n, ...o) => {
|
|
388
|
-
|
|
386
|
+
if (n == null)
|
|
387
|
+
return "[NO LOCALE SET]";
|
|
388
|
+
const h = {};
|
|
389
389
|
for (let l = 0; l < o.length; l++)
|
|
390
|
-
|
|
391
|
-
return
|
|
390
|
+
h[r[l]] = o[l];
|
|
391
|
+
return E(this, O, $t).call(this, n, e, h);
|
|
392
392
|
});
|
|
393
393
|
}
|
|
394
394
|
/**
|
|
@@ -406,7 +406,7 @@ class It {
|
|
|
406
406
|
* t("greeting", {name: "world"}); // State<"Hello, WORLD!">
|
|
407
407
|
*/
|
|
408
408
|
addFormat(e, t) {
|
|
409
|
-
s(this,
|
|
409
|
+
s(this, Ee).set(e, t);
|
|
410
410
|
}
|
|
411
411
|
/**
|
|
412
412
|
* Creates an `Intl.Collator` configured for the current locale.
|
|
@@ -423,7 +423,7 @@ class It {
|
|
|
423
423
|
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options
|
|
424
424
|
*/
|
|
425
425
|
number(e, t) {
|
|
426
|
-
return ye([this.$locale, e], (r, a) =>
|
|
426
|
+
return ye([this.$locale, e], (r, a) => E(this, O, et).call(this, a, t));
|
|
427
427
|
}
|
|
428
428
|
/**
|
|
429
429
|
* Returns a State containing the date formatted for the current locale. Uses `Intl.DateTimeFormat` under the hood.
|
|
@@ -435,7 +435,7 @@ class It {
|
|
|
435
435
|
* const $formatted = Dolla.i18n.dateTime(date, { dateFormat: "short" });
|
|
436
436
|
*/
|
|
437
437
|
dateTime(e, t) {
|
|
438
|
-
return ye([this.$locale, e], (r, a) =>
|
|
438
|
+
return ye([this.$locale, e], (r, a) => E(this, O, tt).call(this, a, t));
|
|
439
439
|
}
|
|
440
440
|
/**
|
|
441
441
|
* Returns a State containing the date formatted for the current locale. Uses `Intl.DateTimeFormat` under the hood.
|
|
@@ -447,61 +447,60 @@ class It {
|
|
|
447
447
|
* const $formatted = Dolla.i18n.list(list, { });
|
|
448
448
|
*/
|
|
449
449
|
list(e, t) {
|
|
450
|
-
return ye([this.$locale, e], (r, a) =>
|
|
450
|
+
return ye([this.$locale, e], (r, a) => E(this, O, rt).call(this, a, t));
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
|
-
ve = new WeakMap(), q = new WeakMap(),
|
|
454
|
-
|
|
453
|
+
ve = new WeakMap(), q = new WeakMap(), R = new WeakMap(), $e = new WeakMap(), Ee = new WeakMap(), ke = new WeakMap(), Pe = new WeakMap(), O = new WeakSet(), $t = function(e, t, r) {
|
|
454
|
+
var l;
|
|
455
|
+
const a = E(this, O, Et).call(this, t, r);
|
|
455
456
|
if (a) return a;
|
|
456
|
-
const n = s(this,
|
|
457
|
+
const n = s(this, R).get(e);
|
|
457
458
|
if (r.context != null && (t += "_" + r.context), r.count != null)
|
|
458
459
|
if (r.ordinal) {
|
|
459
|
-
const
|
|
460
|
-
n.hasTemplate(
|
|
460
|
+
const d = `${t}_ordinal_(=${r.count})`;
|
|
461
|
+
n.hasTemplate(d) ? t = d : t += "_ordinal_" + new Intl.PluralRules(e, { type: "ordinal" }).select(r.count);
|
|
461
462
|
} else {
|
|
462
|
-
const
|
|
463
|
-
n.hasTemplate(
|
|
463
|
+
const d = `${t}_(=${r.count})`;
|
|
464
|
+
n.hasTemplate(d) ? t = d : t += "_" + new Intl.PluralRules(e).select(r.count);
|
|
464
465
|
}
|
|
465
|
-
const o = n.getTemplate(t)
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
if (
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
const y = new Error(
|
|
480
|
-
`Failed to load format '${p.name}' when processing '${t}', template: ${o}`
|
|
466
|
+
const o = n.getTemplate(t);
|
|
467
|
+
let h = "";
|
|
468
|
+
for (const d of o.segments)
|
|
469
|
+
if (d.type === 0)
|
|
470
|
+
h += d.text;
|
|
471
|
+
else if (d.type === 1) {
|
|
472
|
+
let g = Bt(r, d.name);
|
|
473
|
+
const m = ((l = r.formatOverrides) == null ? void 0 : l[d.name]) ?? [...d.formats];
|
|
474
|
+
d.name === "count" && m.length === 0 && m.push({ name: "number", options: {} });
|
|
475
|
+
for (const u of m) {
|
|
476
|
+
const y = s(this, Ee).get(u.name);
|
|
477
|
+
if (y == null) {
|
|
478
|
+
const k = new Error(
|
|
479
|
+
`Failed to load format '${u.name}' when processing '${t}', template: ${o}`
|
|
481
480
|
);
|
|
482
|
-
throw s(this, q).crash(
|
|
481
|
+
throw s(this, q).crash(k), k;
|
|
483
482
|
}
|
|
484
|
-
|
|
483
|
+
g = y(e, g, u.options);
|
|
485
484
|
}
|
|
486
|
-
|
|
485
|
+
h += g;
|
|
487
486
|
}
|
|
488
|
-
return
|
|
489
|
-
},
|
|
487
|
+
return h;
|
|
488
|
+
}, et = function(e, t) {
|
|
490
489
|
return new Intl.NumberFormat(this.$locale.get(), t).format(e);
|
|
491
|
-
},
|
|
490
|
+
}, tt = function(e, t) {
|
|
492
491
|
return new Intl.DateTimeFormat(this.$locale.get(), t).format(
|
|
493
492
|
typeof e == "string" ? new Date(e) : e
|
|
494
493
|
);
|
|
495
|
-
},
|
|
494
|
+
}, rt = function(e, t) {
|
|
496
495
|
return new Intl.ListFormat(this.$locale.get(), t).format(e);
|
|
497
496
|
}, // relativeTime(): State<string> {
|
|
498
497
|
// }
|
|
499
|
-
|
|
498
|
+
Et = function(e, t) {
|
|
500
499
|
for (const r of s(this, $e))
|
|
501
|
-
if (r[0] === e &&
|
|
500
|
+
if (r[0] === e && Rt(r[1], t))
|
|
502
501
|
return r[2];
|
|
503
502
|
};
|
|
504
|
-
function
|
|
503
|
+
function Bt(i, e) {
|
|
505
504
|
const t = String(e).split(/[\.\[\]]/).filter((a) => a.trim() !== "");
|
|
506
505
|
let r = i;
|
|
507
506
|
for (; t.length > 0; ) {
|
|
@@ -510,21 +509,21 @@ function Gt(i, e) {
|
|
|
510
509
|
}
|
|
511
510
|
return r;
|
|
512
511
|
}
|
|
513
|
-
var
|
|
514
|
-
class
|
|
512
|
+
var Y, Se, U, H, le, C, ce, Ve;
|
|
513
|
+
class zt {
|
|
515
514
|
constructor(e) {
|
|
516
515
|
f(this, ce);
|
|
517
|
-
f(this,
|
|
518
|
-
f(this,
|
|
516
|
+
f(this, Y);
|
|
517
|
+
f(this, Se);
|
|
519
518
|
// Keyed updates ensure only the most recent callback queued with a certain key
|
|
520
519
|
// will be called, keeping DOM operations to a minimum.
|
|
521
|
-
f(this,
|
|
520
|
+
f(this, U, /* @__PURE__ */ new Map());
|
|
522
521
|
// All unkeyed updates are run on every batch.
|
|
523
|
-
f(this,
|
|
522
|
+
f(this, H, []);
|
|
524
523
|
// All read callbacks are run before updates on every batch.
|
|
525
524
|
f(this, le, []);
|
|
526
525
|
f(this, C, !1);
|
|
527
|
-
b(this,
|
|
526
|
+
b(this, Y, e), b(this, Se, e.createLogger("dolla/render"));
|
|
528
527
|
}
|
|
529
528
|
/**
|
|
530
529
|
* Queues a callback to run in the next render batch.
|
|
@@ -533,11 +532,11 @@ class Wt {
|
|
|
533
532
|
*/
|
|
534
533
|
update(e, t) {
|
|
535
534
|
return new Promise((r) => {
|
|
536
|
-
t ? s(this,
|
|
535
|
+
t ? s(this, U).set(t, () => {
|
|
537
536
|
e(), r();
|
|
538
|
-
}) : s(this,
|
|
537
|
+
}) : s(this, H).push(() => {
|
|
539
538
|
e(), r();
|
|
540
|
-
}), !s(this, C) && s(this,
|
|
539
|
+
}), !s(this, C) && s(this, Y).isMounted && (b(this, C, !0), E(this, ce, Ve).call(this));
|
|
541
540
|
});
|
|
542
541
|
}
|
|
543
542
|
/**
|
|
@@ -549,26 +548,26 @@ class Wt {
|
|
|
549
548
|
return new Promise((t) => {
|
|
550
549
|
s(this, le).push(() => {
|
|
551
550
|
e(), t();
|
|
552
|
-
}), !s(this, C) && s(this,
|
|
551
|
+
}), !s(this, C) && s(this, Y).isMounted && (b(this, C, !0), E(this, ce, Ve).call(this));
|
|
553
552
|
});
|
|
554
553
|
}
|
|
555
554
|
}
|
|
556
|
-
|
|
557
|
-
const e = s(this,
|
|
558
|
-
if ((!s(this,
|
|
555
|
+
Y = new WeakMap(), Se = new WeakMap(), U = new WeakMap(), H = new WeakMap(), le = new WeakMap(), C = new WeakMap(), ce = new WeakSet(), Ve = function() {
|
|
556
|
+
const e = s(this, U).size + s(this, H).length;
|
|
557
|
+
if ((!s(this, Y).isMounted || e === 0) && b(this, C, !1), !s(this, C)) {
|
|
559
558
|
for (const t of s(this, le))
|
|
560
559
|
t();
|
|
561
560
|
b(this, le, []);
|
|
562
561
|
return;
|
|
563
562
|
}
|
|
564
563
|
requestAnimationFrame(() => {
|
|
565
|
-
s(this,
|
|
566
|
-
for (const t of s(this,
|
|
564
|
+
s(this, Se).info(`Batching ${s(this, U).size + s(this, H).length} queued DOM update(s).`);
|
|
565
|
+
for (const t of s(this, U).values())
|
|
567
566
|
t();
|
|
568
|
-
s(this,
|
|
569
|
-
for (const t of s(this,
|
|
567
|
+
s(this, U).clear();
|
|
568
|
+
for (const t of s(this, H))
|
|
570
569
|
t();
|
|
571
|
-
b(this,
|
|
570
|
+
b(this, H, []), E(this, ce, Ve).call(this);
|
|
572
571
|
});
|
|
573
572
|
};
|
|
574
573
|
function de() {
|
|
@@ -584,12 +583,12 @@ var A;
|
|
|
584
583
|
(function(i) {
|
|
585
584
|
i.Pop = "POP", i.Push = "PUSH", i.Replace = "REPLACE";
|
|
586
585
|
})(A || (A = {}));
|
|
587
|
-
var
|
|
586
|
+
var Ie = process.env.NODE_ENV !== "production" ? function(i) {
|
|
588
587
|
return Object.freeze(i);
|
|
589
588
|
} : function(i) {
|
|
590
589
|
return i;
|
|
591
590
|
};
|
|
592
|
-
function
|
|
591
|
+
function qe(i, e) {
|
|
593
592
|
if (!i) {
|
|
594
593
|
typeof console < "u" && console.warn(e);
|
|
595
594
|
try {
|
|
@@ -598,38 +597,38 @@ function Ce(i, e) {
|
|
|
598
597
|
}
|
|
599
598
|
}
|
|
600
599
|
}
|
|
601
|
-
var
|
|
602
|
-
function
|
|
600
|
+
var We = "beforeunload", Kt = "hashchange", kt = "popstate";
|
|
601
|
+
function Qt(i) {
|
|
603
602
|
i === void 0 && (i = {});
|
|
604
603
|
var e = i, t = e.window, r = t === void 0 ? document.defaultView : t, a = r.history;
|
|
605
604
|
function n() {
|
|
606
|
-
var w = r.location, c = w.pathname,
|
|
607
|
-
return [$.idx,
|
|
605
|
+
var w = r.location, c = w.pathname, p = w.search, v = w.hash, $ = a.state || {};
|
|
606
|
+
return [$.idx, Ie({
|
|
608
607
|
pathname: c,
|
|
609
|
-
search:
|
|
608
|
+
search: p,
|
|
610
609
|
hash: v,
|
|
611
610
|
state: $.usr || null,
|
|
612
611
|
key: $.key || "default"
|
|
613
612
|
})];
|
|
614
613
|
}
|
|
615
614
|
var o = null;
|
|
616
|
-
function
|
|
615
|
+
function h() {
|
|
617
616
|
if (o)
|
|
618
617
|
y.call(o), o = null;
|
|
619
618
|
else {
|
|
620
|
-
var w = A.Pop, c = n(),
|
|
619
|
+
var w = A.Pop, c = n(), p = c[0], v = c[1];
|
|
621
620
|
if (y.length)
|
|
622
|
-
if (
|
|
623
|
-
var $ =
|
|
621
|
+
if (p != null) {
|
|
622
|
+
var $ = g - p;
|
|
624
623
|
$ && (o = {
|
|
625
624
|
action: w,
|
|
626
625
|
location: v,
|
|
627
626
|
retry: function() {
|
|
628
|
-
|
|
627
|
+
F($ * -1);
|
|
629
628
|
}
|
|
630
|
-
},
|
|
629
|
+
}, F($));
|
|
631
630
|
} else
|
|
632
|
-
process.env.NODE_ENV !== "production" &&
|
|
631
|
+
process.env.NODE_ENV !== "production" && qe(
|
|
633
632
|
!1,
|
|
634
633
|
// TODO: Write up a doc that explains our blocking strategy in
|
|
635
634
|
// detail and link to it here so people can understand better what
|
|
@@ -640,134 +639,134 @@ function Bt(i) {
|
|
|
640
639
|
ne(w);
|
|
641
640
|
}
|
|
642
641
|
}
|
|
643
|
-
r.addEventListener(
|
|
644
|
-
var l = A.Pop,
|
|
645
|
-
|
|
646
|
-
idx:
|
|
642
|
+
r.addEventListener(kt, h);
|
|
643
|
+
var l = A.Pop, d = n(), g = d[0], m = d[1], u = Be(), y = Be();
|
|
644
|
+
g == null && (g = 0, a.replaceState(de({}, a.state, {
|
|
645
|
+
idx: g
|
|
647
646
|
}), ""));
|
|
648
|
-
function
|
|
649
|
-
return typeof w == "string" ? w :
|
|
647
|
+
function k(w) {
|
|
648
|
+
return typeof w == "string" ? w : Ue(w);
|
|
650
649
|
}
|
|
651
650
|
function pe(w, c) {
|
|
652
|
-
return c === void 0 && (c = null),
|
|
653
|
-
pathname:
|
|
651
|
+
return c === void 0 && (c = null), Ie(de({
|
|
652
|
+
pathname: m.pathname,
|
|
654
653
|
hash: "",
|
|
655
654
|
search: ""
|
|
656
|
-
}, typeof w == "string" ?
|
|
655
|
+
}, typeof w == "string" ? nt(w) : w, {
|
|
657
656
|
state: c,
|
|
658
|
-
key:
|
|
657
|
+
key: Pt()
|
|
659
658
|
}));
|
|
660
659
|
}
|
|
661
|
-
function
|
|
660
|
+
function me(w, c) {
|
|
662
661
|
return [{
|
|
663
662
|
usr: w.state,
|
|
664
663
|
key: w.key,
|
|
665
664
|
idx: c
|
|
666
|
-
},
|
|
665
|
+
}, k(w)];
|
|
667
666
|
}
|
|
668
|
-
function
|
|
667
|
+
function ge(w, c, p) {
|
|
669
668
|
return !y.length || (y.call({
|
|
670
669
|
action: w,
|
|
671
670
|
location: c,
|
|
672
|
-
retry:
|
|
671
|
+
retry: p
|
|
673
672
|
}), !1);
|
|
674
673
|
}
|
|
675
674
|
function ne(w) {
|
|
676
675
|
l = w;
|
|
677
676
|
var c = n();
|
|
678
|
-
|
|
677
|
+
g = c[0], m = c[1], u.call({
|
|
679
678
|
action: l,
|
|
680
|
-
location:
|
|
679
|
+
location: m
|
|
681
680
|
});
|
|
682
681
|
}
|
|
683
682
|
function ae(w, c) {
|
|
684
|
-
var
|
|
683
|
+
var p = A.Push, v = pe(w, c);
|
|
685
684
|
function $() {
|
|
686
685
|
ae(w, c);
|
|
687
686
|
}
|
|
688
|
-
if (
|
|
689
|
-
var
|
|
687
|
+
if (ge(p, v, $)) {
|
|
688
|
+
var L = me(v, g + 1), N = L[0], D = L[1];
|
|
690
689
|
try {
|
|
691
|
-
a.pushState(
|
|
690
|
+
a.pushState(N, "", D);
|
|
692
691
|
} catch {
|
|
693
|
-
r.location.assign(
|
|
692
|
+
r.location.assign(D);
|
|
694
693
|
}
|
|
695
|
-
ne(
|
|
694
|
+
ne(p);
|
|
696
695
|
}
|
|
697
696
|
}
|
|
698
697
|
function we(w, c) {
|
|
699
|
-
var
|
|
698
|
+
var p = A.Replace, v = pe(w, c);
|
|
700
699
|
function $() {
|
|
701
700
|
we(w, c);
|
|
702
701
|
}
|
|
703
|
-
if (
|
|
704
|
-
var
|
|
705
|
-
a.replaceState(
|
|
702
|
+
if (ge(p, v, $)) {
|
|
703
|
+
var L = me(v, g), N = L[0], D = L[1];
|
|
704
|
+
a.replaceState(N, "", D), ne(p);
|
|
706
705
|
}
|
|
707
706
|
}
|
|
708
|
-
function
|
|
707
|
+
function F(w) {
|
|
709
708
|
a.go(w);
|
|
710
709
|
}
|
|
711
|
-
var
|
|
710
|
+
var Q = {
|
|
712
711
|
get action() {
|
|
713
712
|
return l;
|
|
714
713
|
},
|
|
715
714
|
get location() {
|
|
716
|
-
return
|
|
715
|
+
return m;
|
|
717
716
|
},
|
|
718
|
-
createHref:
|
|
717
|
+
createHref: k,
|
|
719
718
|
push: ae,
|
|
720
719
|
replace: we,
|
|
721
|
-
go:
|
|
720
|
+
go: F,
|
|
722
721
|
back: function() {
|
|
723
|
-
|
|
722
|
+
F(-1);
|
|
724
723
|
},
|
|
725
724
|
forward: function() {
|
|
726
|
-
|
|
725
|
+
F(1);
|
|
727
726
|
},
|
|
728
727
|
listen: function(c) {
|
|
729
|
-
return
|
|
728
|
+
return u.push(c);
|
|
730
729
|
},
|
|
731
730
|
block: function(c) {
|
|
732
|
-
var
|
|
733
|
-
return y.length === 1 && r.addEventListener(
|
|
734
|
-
|
|
731
|
+
var p = y.push(c);
|
|
732
|
+
return y.length === 1 && r.addEventListener(We, Ge), function() {
|
|
733
|
+
p(), y.length || r.removeEventListener(We, Ge);
|
|
735
734
|
};
|
|
736
735
|
}
|
|
737
736
|
};
|
|
738
|
-
return
|
|
737
|
+
return Q;
|
|
739
738
|
}
|
|
740
|
-
function
|
|
739
|
+
function Jt(i) {
|
|
741
740
|
i === void 0 && (i = {});
|
|
742
741
|
var e = i, t = e.window, r = t === void 0 ? document.defaultView : t, a = r.history;
|
|
743
742
|
function n() {
|
|
744
|
-
var c =
|
|
745
|
-
return [
|
|
743
|
+
var c = nt(r.location.hash.substr(1)), p = c.pathname, v = p === void 0 ? "/" : p, $ = c.search, L = $ === void 0 ? "" : $, N = c.hash, D = N === void 0 ? "" : N, _ = a.state || {};
|
|
744
|
+
return [_.idx, Ie({
|
|
746
745
|
pathname: v,
|
|
747
|
-
search:
|
|
748
|
-
hash:
|
|
749
|
-
state:
|
|
750
|
-
key:
|
|
746
|
+
search: L,
|
|
747
|
+
hash: D,
|
|
748
|
+
state: _.usr || null,
|
|
749
|
+
key: _.key || "default"
|
|
751
750
|
})];
|
|
752
751
|
}
|
|
753
752
|
var o = null;
|
|
754
|
-
function
|
|
753
|
+
function h() {
|
|
755
754
|
if (o)
|
|
756
755
|
y.call(o), o = null;
|
|
757
756
|
else {
|
|
758
|
-
var c = A.Pop,
|
|
757
|
+
var c = A.Pop, p = n(), v = p[0], $ = p[1];
|
|
759
758
|
if (y.length)
|
|
760
759
|
if (v != null) {
|
|
761
|
-
var
|
|
762
|
-
|
|
760
|
+
var L = g - v;
|
|
761
|
+
L && (o = {
|
|
763
762
|
action: c,
|
|
764
763
|
location: $,
|
|
765
764
|
retry: function() {
|
|
766
|
-
|
|
765
|
+
Q(L * -1);
|
|
767
766
|
}
|
|
768
|
-
},
|
|
767
|
+
}, Q(L));
|
|
769
768
|
} else
|
|
770
|
-
process.env.NODE_ENV !== "production" &&
|
|
769
|
+
process.env.NODE_ENV !== "production" && qe(
|
|
771
770
|
!1,
|
|
772
771
|
// TODO: Write up a doc that explains our blocking strategy in
|
|
773
772
|
// detail and link to it here so people can understand better
|
|
@@ -778,83 +777,83 @@ function Kt(i) {
|
|
|
778
777
|
ae(c);
|
|
779
778
|
}
|
|
780
779
|
}
|
|
781
|
-
r.addEventListener(
|
|
782
|
-
var c = n(),
|
|
783
|
-
|
|
780
|
+
r.addEventListener(kt, h), r.addEventListener(Kt, function() {
|
|
781
|
+
var c = n(), p = c[1];
|
|
782
|
+
Ue(p) !== Ue(m) && h();
|
|
784
783
|
});
|
|
785
|
-
var l = A.Pop,
|
|
786
|
-
|
|
787
|
-
idx:
|
|
784
|
+
var l = A.Pop, d = n(), g = d[0], m = d[1], u = Be(), y = Be();
|
|
785
|
+
g == null && (g = 0, a.replaceState(de({}, a.state, {
|
|
786
|
+
idx: g
|
|
788
787
|
}), ""));
|
|
789
|
-
function
|
|
790
|
-
var c = document.querySelector("base"),
|
|
788
|
+
function k() {
|
|
789
|
+
var c = document.querySelector("base"), p = "";
|
|
791
790
|
if (c && c.getAttribute("href")) {
|
|
792
791
|
var v = r.location.href, $ = v.indexOf("#");
|
|
793
|
-
|
|
792
|
+
p = $ === -1 ? v : v.slice(0, $);
|
|
794
793
|
}
|
|
795
|
-
return
|
|
794
|
+
return p;
|
|
796
795
|
}
|
|
797
796
|
function pe(c) {
|
|
798
|
-
return
|
|
797
|
+
return k() + "#" + (typeof c == "string" ? c : Ue(c));
|
|
799
798
|
}
|
|
800
|
-
function
|
|
801
|
-
return
|
|
802
|
-
pathname:
|
|
799
|
+
function me(c, p) {
|
|
800
|
+
return p === void 0 && (p = null), Ie(de({
|
|
801
|
+
pathname: m.pathname,
|
|
803
802
|
hash: "",
|
|
804
803
|
search: ""
|
|
805
|
-
}, typeof c == "string" ?
|
|
806
|
-
state:
|
|
807
|
-
key:
|
|
804
|
+
}, typeof c == "string" ? nt(c) : c, {
|
|
805
|
+
state: p,
|
|
806
|
+
key: Pt()
|
|
808
807
|
}));
|
|
809
808
|
}
|
|
810
|
-
function
|
|
809
|
+
function ge(c, p) {
|
|
811
810
|
return [{
|
|
812
811
|
usr: c.state,
|
|
813
812
|
key: c.key,
|
|
814
|
-
idx:
|
|
813
|
+
idx: p
|
|
815
814
|
}, pe(c)];
|
|
816
815
|
}
|
|
817
|
-
function ne(c,
|
|
816
|
+
function ne(c, p, v) {
|
|
818
817
|
return !y.length || (y.call({
|
|
819
818
|
action: c,
|
|
820
|
-
location:
|
|
819
|
+
location: p,
|
|
821
820
|
retry: v
|
|
822
821
|
}), !1);
|
|
823
822
|
}
|
|
824
823
|
function ae(c) {
|
|
825
824
|
l = c;
|
|
826
|
-
var
|
|
827
|
-
|
|
825
|
+
var p = n();
|
|
826
|
+
g = p[0], m = p[1], u.call({
|
|
828
827
|
action: l,
|
|
829
|
-
location:
|
|
828
|
+
location: m
|
|
830
829
|
});
|
|
831
830
|
}
|
|
832
|
-
function we(c,
|
|
833
|
-
var v = A.Push, $ =
|
|
834
|
-
function
|
|
835
|
-
we(c,
|
|
831
|
+
function we(c, p) {
|
|
832
|
+
var v = A.Push, $ = me(c, p);
|
|
833
|
+
function L() {
|
|
834
|
+
we(c, p);
|
|
836
835
|
}
|
|
837
|
-
if (process.env.NODE_ENV !== "production" &&
|
|
838
|
-
var
|
|
836
|
+
if (process.env.NODE_ENV !== "production" && qe($.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.push(" + JSON.stringify(c) + ")"), ne(v, $, L)) {
|
|
837
|
+
var N = ge($, g + 1), D = N[0], _ = N[1];
|
|
839
838
|
try {
|
|
840
|
-
a.pushState(
|
|
839
|
+
a.pushState(D, "", _);
|
|
841
840
|
} catch {
|
|
842
|
-
r.location.assign(
|
|
841
|
+
r.location.assign(_);
|
|
843
842
|
}
|
|
844
843
|
ae(v);
|
|
845
844
|
}
|
|
846
845
|
}
|
|
847
|
-
function
|
|
848
|
-
var v = A.Replace, $ =
|
|
849
|
-
function
|
|
850
|
-
|
|
846
|
+
function F(c, p) {
|
|
847
|
+
var v = A.Replace, $ = me(c, p);
|
|
848
|
+
function L() {
|
|
849
|
+
F(c, p);
|
|
851
850
|
}
|
|
852
|
-
if (process.env.NODE_ENV !== "production" &&
|
|
853
|
-
var
|
|
854
|
-
a.replaceState(
|
|
851
|
+
if (process.env.NODE_ENV !== "production" && qe($.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.replace(" + JSON.stringify(c) + ")"), ne(v, $, L)) {
|
|
852
|
+
var N = ge($, g), D = N[0], _ = N[1];
|
|
853
|
+
a.replaceState(D, "", _), ae(v);
|
|
855
854
|
}
|
|
856
855
|
}
|
|
857
|
-
function
|
|
856
|
+
function Q(c) {
|
|
858
857
|
a.go(c);
|
|
859
858
|
}
|
|
860
859
|
var w = {
|
|
@@ -862,34 +861,34 @@ function Kt(i) {
|
|
|
862
861
|
return l;
|
|
863
862
|
},
|
|
864
863
|
get location() {
|
|
865
|
-
return
|
|
864
|
+
return m;
|
|
866
865
|
},
|
|
867
866
|
createHref: pe,
|
|
868
867
|
push: we,
|
|
869
|
-
replace:
|
|
870
|
-
go:
|
|
868
|
+
replace: F,
|
|
869
|
+
go: Q,
|
|
871
870
|
back: function() {
|
|
872
|
-
|
|
871
|
+
Q(-1);
|
|
873
872
|
},
|
|
874
873
|
forward: function() {
|
|
875
|
-
|
|
874
|
+
Q(1);
|
|
876
875
|
},
|
|
877
|
-
listen: function(
|
|
878
|
-
return
|
|
876
|
+
listen: function(p) {
|
|
877
|
+
return u.push(p);
|
|
879
878
|
},
|
|
880
|
-
block: function(
|
|
881
|
-
var v = y.push(
|
|
882
|
-
return y.length === 1 && r.addEventListener(
|
|
883
|
-
v(), y.length || r.removeEventListener(
|
|
879
|
+
block: function(p) {
|
|
880
|
+
var v = y.push(p);
|
|
881
|
+
return y.length === 1 && r.addEventListener(We, Ge), function() {
|
|
882
|
+
v(), y.length || r.removeEventListener(We, Ge);
|
|
884
883
|
};
|
|
885
884
|
}
|
|
886
885
|
};
|
|
887
886
|
return w;
|
|
888
887
|
}
|
|
889
|
-
function
|
|
888
|
+
function Ge(i) {
|
|
890
889
|
i.preventDefault(), i.returnValue = "";
|
|
891
890
|
}
|
|
892
|
-
function
|
|
891
|
+
function Be() {
|
|
893
892
|
var i = [];
|
|
894
893
|
return {
|
|
895
894
|
get length() {
|
|
@@ -909,14 +908,14 @@ function Ie() {
|
|
|
909
908
|
}
|
|
910
909
|
};
|
|
911
910
|
}
|
|
912
|
-
function
|
|
911
|
+
function Pt() {
|
|
913
912
|
return Math.random().toString(36).substr(2, 8);
|
|
914
913
|
}
|
|
915
|
-
function
|
|
914
|
+
function Ue(i) {
|
|
916
915
|
var e = i.pathname, t = e === void 0 ? "/" : e, r = i.search, a = r === void 0 ? "" : r, n = i.hash, o = n === void 0 ? "" : n;
|
|
917
916
|
return a && a !== "?" && (t += a.charAt(0) === "?" ? a : "?" + a), o && o !== "#" && (t += o.charAt(0) === "#" ? o : "#" + o), t;
|
|
918
917
|
}
|
|
919
|
-
function
|
|
918
|
+
function nt(i) {
|
|
920
919
|
var e = {};
|
|
921
920
|
if (i) {
|
|
922
921
|
var t = i.indexOf("#");
|
|
@@ -927,25 +926,25 @@ function et(i) {
|
|
|
927
926
|
return e;
|
|
928
927
|
}
|
|
929
928
|
function be(i) {
|
|
930
|
-
return
|
|
929
|
+
return yt(i, "Expected `path` to be a string. Got type: %t, value: %v"), i.split("/").map((e) => e.trim()).filter((e) => e !== "");
|
|
931
930
|
}
|
|
932
931
|
function se(i) {
|
|
933
932
|
var t;
|
|
934
|
-
|
|
935
|
-
(r) =>
|
|
933
|
+
Ot(
|
|
934
|
+
(r) => ot(r == null ? void 0 : r.toString),
|
|
936
935
|
i,
|
|
937
936
|
"Expected `parts` to be an array of objects with a .toString() method. Got type: %t, value: %v"
|
|
938
937
|
), i = i.filter((r) => r).flatMap(String);
|
|
939
938
|
let e = (t = i.shift()) == null ? void 0 : t.toString();
|
|
940
939
|
if (e) {
|
|
941
940
|
for (const r of i.map((a) => a.toString()))
|
|
942
|
-
r.startsWith(".") ? e =
|
|
941
|
+
r.startsWith(".") ? e = He(e, r) : e[e.length - 1] !== "/" ? r[0] !== "/" ? e += "/" + r : e += r : r[0] === "/" ? e += r.slice(1) : e += r;
|
|
943
942
|
e && e !== "/" && e.endsWith("/") && (e = e.slice(0, e.length - 1));
|
|
944
943
|
}
|
|
945
944
|
return e ?? "";
|
|
946
945
|
}
|
|
947
|
-
function
|
|
948
|
-
if (
|
|
946
|
+
function He(i, e) {
|
|
947
|
+
if (yt(i, "Expected `base` to be a string. Got type: %t, value: %v"), e == null && (e = i, i = ""), e.startsWith("/"))
|
|
949
948
|
return e;
|
|
950
949
|
let t = i;
|
|
951
950
|
for (; ; )
|
|
@@ -961,7 +960,7 @@ function Fe(i, e) {
|
|
|
961
960
|
break;
|
|
962
961
|
return se([t, e]);
|
|
963
962
|
}
|
|
964
|
-
function
|
|
963
|
+
function at(i) {
|
|
965
964
|
if (!i) return {};
|
|
966
965
|
i.startsWith("?") && (i = i.slice(1));
|
|
967
966
|
const e = i.split("&").filter((t) => t.trim() !== "").map((t) => {
|
|
@@ -970,71 +969,71 @@ function tt(i) {
|
|
|
970
969
|
});
|
|
971
970
|
return Object.fromEntries(e);
|
|
972
971
|
}
|
|
973
|
-
function
|
|
972
|
+
function gt(i, e, t = {}) {
|
|
974
973
|
var o;
|
|
975
974
|
const [r, a] = e.split("?"), n = be(r);
|
|
976
|
-
e: for (const
|
|
977
|
-
const { fragments: l } =
|
|
978
|
-
if (!(((o = l[l.length - 1]) == null ? void 0 : o.type) === 3) && l.length !== n.length || t.willMatch && !t.willMatch(
|
|
975
|
+
e: for (const h of i) {
|
|
976
|
+
const { fragments: l } = h;
|
|
977
|
+
if (!(((o = l[l.length - 1]) == null ? void 0 : o.type) === 3) && l.length !== n.length || t.willMatch && !t.willMatch(h))
|
|
979
978
|
continue e;
|
|
980
|
-
const
|
|
981
|
-
t: for (let
|
|
982
|
-
const y = n[
|
|
983
|
-
if (y == null &&
|
|
979
|
+
const g = [];
|
|
980
|
+
t: for (let u = 0; u < l.length; u++) {
|
|
981
|
+
const y = n[u], k = l[u];
|
|
982
|
+
if (y == null && k.type !== 3)
|
|
984
983
|
continue e;
|
|
985
|
-
switch (
|
|
984
|
+
switch (k.type) {
|
|
986
985
|
case 1:
|
|
987
|
-
if (
|
|
988
|
-
|
|
986
|
+
if (k.name.toLowerCase() === y.toLowerCase()) {
|
|
987
|
+
g.push(k);
|
|
989
988
|
break;
|
|
990
989
|
} else
|
|
991
990
|
continue e;
|
|
992
991
|
case 2:
|
|
993
|
-
|
|
992
|
+
g.push({ ...k, value: y });
|
|
994
993
|
break;
|
|
995
994
|
case 3:
|
|
996
|
-
|
|
995
|
+
g.push({ ...k, value: n.slice(u).join("/") });
|
|
997
996
|
break t;
|
|
998
997
|
case 4:
|
|
999
998
|
if (isNaN(Number(y)))
|
|
1000
999
|
continue e;
|
|
1001
|
-
|
|
1000
|
+
g.push({ ...k, value: Number(y) });
|
|
1002
1001
|
break;
|
|
1003
1002
|
default:
|
|
1004
|
-
throw new Error(`Unknown fragment type: ${
|
|
1003
|
+
throw new Error(`Unknown fragment type: ${k.type}`);
|
|
1005
1004
|
}
|
|
1006
1005
|
}
|
|
1007
|
-
const
|
|
1008
|
-
for (const
|
|
1009
|
-
|
|
1006
|
+
const m = {};
|
|
1007
|
+
for (const u of g)
|
|
1008
|
+
u.type === 2 && (m[u.name] = decodeURIComponent(u.value)), u.type === 4 && (m[u.name] = u.value), u.type === 3 && (m.wildcard = "/" + decodeURIComponent(u.value));
|
|
1010
1009
|
return {
|
|
1011
|
-
path: "/" +
|
|
1012
|
-
pattern: "/" + l.map((
|
|
1013
|
-
params:
|
|
1014
|
-
query:
|
|
1015
|
-
meta:
|
|
1010
|
+
path: "/" + g.map((u) => u.value).join("/"),
|
|
1011
|
+
pattern: "/" + l.map((u) => u.type === 2 ? `{${u.name}}` : u.type === 4 ? `{#${u.name}}` : u.name).join("/"),
|
|
1012
|
+
params: m,
|
|
1013
|
+
query: at(a),
|
|
1014
|
+
meta: h.meta
|
|
1016
1015
|
};
|
|
1017
1016
|
}
|
|
1018
1017
|
}
|
|
1019
|
-
function
|
|
1018
|
+
function Yt(i) {
|
|
1020
1019
|
const e = [], t = [], r = [], a = [];
|
|
1021
1020
|
for (const o of i) {
|
|
1022
|
-
const { fragments:
|
|
1023
|
-
|
|
1021
|
+
const { fragments: h } = o;
|
|
1022
|
+
h.some(
|
|
1024
1023
|
(l) => l.type === 3
|
|
1025
1024
|
/* Wildcard */
|
|
1026
|
-
) ? a.push(o) :
|
|
1025
|
+
) ? a.push(o) : h.some(
|
|
1027
1026
|
(l) => l.type === 4
|
|
1028
1027
|
/* NumericParam */
|
|
1029
|
-
) ? t.push(o) :
|
|
1028
|
+
) ? t.push(o) : h.some(
|
|
1030
1029
|
(l) => l.type === 2
|
|
1031
1030
|
/* Param */
|
|
1032
1031
|
) ? r.push(o) : e.push(o);
|
|
1033
1032
|
}
|
|
1034
|
-
const n = (o,
|
|
1033
|
+
const n = (o, h) => o.fragments.length > h.fragments.length ? -1 : 1;
|
|
1035
1034
|
return e.sort(n), t.sort(n), r.sort(n), a.sort(n), [...e, ...t, ...r, ...a];
|
|
1036
1035
|
}
|
|
1037
|
-
function
|
|
1036
|
+
function Xt(i) {
|
|
1038
1037
|
const e = be(i), t = [];
|
|
1039
1038
|
for (let r = 0; r < e.length; r++) {
|
|
1040
1039
|
const a = e[r];
|
|
@@ -1058,86 +1057,86 @@ function Jt(i) {
|
|
|
1058
1057
|
}
|
|
1059
1058
|
return t;
|
|
1060
1059
|
}
|
|
1061
|
-
var
|
|
1062
|
-
class
|
|
1060
|
+
var Le, M, X, xe, P, Qe, I, Re, Z, ee, ue, he, fe, Oe, K, st, it;
|
|
1061
|
+
class Zt {
|
|
1063
1062
|
constructor(e, t) {
|
|
1064
|
-
f(this,
|
|
1065
|
-
f(this,
|
|
1063
|
+
f(this, K);
|
|
1064
|
+
f(this, Le);
|
|
1066
1065
|
f(this, M);
|
|
1067
|
-
f(this,
|
|
1068
|
-
f(this,
|
|
1069
|
-
f(this,
|
|
1070
|
-
f(this,
|
|
1066
|
+
f(this, X);
|
|
1067
|
+
f(this, xe, Xe());
|
|
1068
|
+
f(this, P);
|
|
1069
|
+
f(this, Qe, 0);
|
|
1070
|
+
f(this, I, []);
|
|
1071
1071
|
f(this, Re);
|
|
1072
|
-
f(this,
|
|
1072
|
+
f(this, Z, []);
|
|
1073
1073
|
// Callbacks that need to be called on unmount.
|
|
1074
|
-
f(this,
|
|
1074
|
+
f(this, ee, []);
|
|
1075
1075
|
/**
|
|
1076
1076
|
* The currently matched route pattern, if any.
|
|
1077
1077
|
*/
|
|
1078
|
-
|
|
1078
|
+
S(this, "$pattern");
|
|
1079
1079
|
f(this, ue);
|
|
1080
1080
|
/**
|
|
1081
1081
|
* The current URL path.
|
|
1082
1082
|
*/
|
|
1083
|
-
|
|
1083
|
+
S(this, "$path");
|
|
1084
1084
|
f(this, he);
|
|
1085
1085
|
/**
|
|
1086
1086
|
* The current named path params.
|
|
1087
1087
|
*/
|
|
1088
|
-
|
|
1088
|
+
S(this, "$params");
|
|
1089
1089
|
f(this, fe);
|
|
1090
1090
|
/**
|
|
1091
1091
|
* The current query params. Changes to this object will be reflected in the URL.
|
|
1092
1092
|
*/
|
|
1093
|
-
|
|
1094
|
-
f(this,
|
|
1095
|
-
b(this,
|
|
1096
|
-
const [r, a] = ie(null), [n, o] = ie(""), [
|
|
1097
|
-
|
|
1093
|
+
S(this, "$query");
|
|
1094
|
+
f(this, Oe);
|
|
1095
|
+
b(this, Le, e), b(this, M, e.createLogger("dolla/router")), b(this, X, t);
|
|
1096
|
+
const [r, a] = ie(null), [n, o] = ie(""), [h, l] = ie({}), [d, g] = ie(
|
|
1097
|
+
at(typeof window > "u" ? "" : window.location.search ?? "")
|
|
1098
1098
|
);
|
|
1099
|
-
this.$pattern = r, b(this, ue, a), this.$path = n, b(this, he, o), this.$params =
|
|
1100
|
-
s(this,
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
let h = p.getAttribute("href");
|
|
1114
|
-
s(this, M).info("Intercepted link click", p, h), /^https?:\/\/|^\//.test(h) || (h = se([s(this, E).location.pathname, h])), s(this, E).push(h);
|
|
1099
|
+
this.$pattern = r, b(this, ue, a), this.$path = n, b(this, he, o), this.$params = h, b(this, fe, l), this.$query = d, b(this, Oe, g), e.beforeMount(() => {
|
|
1100
|
+
s(this, P) != null && (s(this, xe).watch([d], (m) => {
|
|
1101
|
+
const u = new URLSearchParams();
|
|
1102
|
+
for (const k in m)
|
|
1103
|
+
u.set(k, String(m[k]));
|
|
1104
|
+
const y = "?" + u.toString();
|
|
1105
|
+
y != s(this, P).location.search && s(this, P).replace({
|
|
1106
|
+
pathname: s(this, P).location.pathname,
|
|
1107
|
+
search: y
|
|
1108
|
+
});
|
|
1109
|
+
}), s(this, ee).push(s(this, P).listen(E(this, K, it).bind(this))), E(this, K, it).call(this, s(this, P)), s(this, ee).push(
|
|
1110
|
+
rr(s(this, X).rootElement, (m) => {
|
|
1111
|
+
let u = m.getAttribute("href");
|
|
1112
|
+
s(this, M).info("Intercepted link click", m, u), /^https?:\/\/|^\//.test(u) || (u = se([s(this, P).location.pathname, u])), s(this, P).push(u);
|
|
1115
1113
|
})
|
|
1116
|
-
), s(this, M).info("Intercepting <a> clicks within root element:", s(this,
|
|
1114
|
+
), s(this, M).info("Intercepting <a> clicks within root element:", s(this, X).rootElement));
|
|
1117
1115
|
}), e.onUnmount(() => {
|
|
1118
|
-
for (; s(this,
|
|
1119
|
-
s(this,
|
|
1116
|
+
for (; s(this, ee).length > 0; )
|
|
1117
|
+
s(this, ee).pop()();
|
|
1118
|
+
s(this, xe).stopAll();
|
|
1120
1119
|
});
|
|
1121
1120
|
}
|
|
1122
1121
|
setup(e) {
|
|
1123
|
-
if (s(this,
|
|
1122
|
+
if (s(this, Le).isMounted) {
|
|
1124
1123
|
s(this, M).crash(
|
|
1125
1124
|
new Error("Dolla is already mounted. Router setup must be called before Dolla.mount is called.")
|
|
1126
1125
|
);
|
|
1127
1126
|
return;
|
|
1128
1127
|
}
|
|
1129
|
-
e.style === "hash" ? b(this,
|
|
1130
|
-
e.routes.flatMap((t) =>
|
|
1128
|
+
e.style === "hash" ? b(this, P, Jt()) : b(this, P, Qt()), b(this, Z, Yt(
|
|
1129
|
+
e.routes.flatMap((t) => E(this, K, st).call(this, t)).map((t) => ({
|
|
1131
1130
|
pattern: t.pattern,
|
|
1132
1131
|
meta: t.meta,
|
|
1133
|
-
fragments:
|
|
1132
|
+
fragments: Xt(t.pattern)
|
|
1134
1133
|
}))
|
|
1135
1134
|
));
|
|
1136
|
-
for (const t of s(this,
|
|
1135
|
+
for (const t of s(this, Z))
|
|
1137
1136
|
if (t.meta.redirect) {
|
|
1138
1137
|
let r;
|
|
1139
|
-
if (!
|
|
1140
|
-
if (r = t.meta.redirect, !
|
|
1138
|
+
if (!ot(t.meta.redirect)) if (V(t.meta.redirect)) {
|
|
1139
|
+
if (r = t.meta.redirect, !gt(s(this, Z), r, {
|
|
1141
1140
|
willMatch(n) {
|
|
1142
1141
|
return n !== t;
|
|
1143
1142
|
}
|
|
@@ -1157,7 +1156,7 @@ class Yt {
|
|
|
1157
1156
|
* Dolla.router.go["/users", 215], { replace: true }); // replace current history entry with `/users/215`
|
|
1158
1157
|
*/
|
|
1159
1158
|
go(e, t = {}) {
|
|
1160
|
-
if (s(this,
|
|
1159
|
+
if (s(this, P) == null) {
|
|
1161
1160
|
s(this, M).crash(
|
|
1162
1161
|
new Error(
|
|
1163
1162
|
"Router.go was called, but the router was never configured! Run 'Dolla.router.setup' before 'Dolla.mount' to configure routes."
|
|
@@ -1166,13 +1165,13 @@ class Yt {
|
|
|
1166
1165
|
return;
|
|
1167
1166
|
}
|
|
1168
1167
|
let r;
|
|
1169
|
-
Array.isArray(e) ? r = se(e) : r = e.toString(), r =
|
|
1168
|
+
Array.isArray(e) ? r = se(e) : r = e.toString(), r = He(s(this, P).location.pathname, r), t.preserveQuery && (r += s(this, P).location.search), t.replace ? s(this, P).replace(r) : s(this, P).push(r);
|
|
1170
1169
|
}
|
|
1171
1170
|
/**
|
|
1172
1171
|
* Navigate backward. Pass a number of steps to hit the back button that many times.
|
|
1173
1172
|
*/
|
|
1174
1173
|
back(e = 1) {
|
|
1175
|
-
if (s(this,
|
|
1174
|
+
if (s(this, P) == null) {
|
|
1176
1175
|
s(this, M).crash(
|
|
1177
1176
|
new Error(
|
|
1178
1177
|
"Router.back was called, but the router was never configured! Run 'Dolla.router.setup' before 'Dolla.mount' to configure routes."
|
|
@@ -1180,13 +1179,13 @@ class Yt {
|
|
|
1180
1179
|
);
|
|
1181
1180
|
return;
|
|
1182
1181
|
}
|
|
1183
|
-
s(this,
|
|
1182
|
+
s(this, P).go(-e);
|
|
1184
1183
|
}
|
|
1185
1184
|
/**
|
|
1186
1185
|
* Navigate forward. Pass a number of steps to hit the forward button that many times.
|
|
1187
1186
|
*/
|
|
1188
1187
|
forward(e = 1) {
|
|
1189
|
-
if (s(this,
|
|
1188
|
+
if (s(this, P) == null) {
|
|
1190
1189
|
s(this, M).crash(
|
|
1191
1190
|
new Error(
|
|
1192
1191
|
"Router.forward was called, but the router was never configured! Run 'Dolla.router.setup' before 'Dolla.mount' to configure routes."
|
|
@@ -1194,16 +1193,16 @@ class Yt {
|
|
|
1194
1193
|
);
|
|
1195
1194
|
return;
|
|
1196
1195
|
}
|
|
1197
|
-
s(this,
|
|
1196
|
+
s(this, P).go(e);
|
|
1198
1197
|
}
|
|
1199
1198
|
}
|
|
1200
|
-
|
|
1199
|
+
Le = new WeakMap(), M = new WeakMap(), X = new WeakMap(), xe = new WeakMap(), P = new WeakMap(), Qe = new WeakMap(), I = new WeakMap(), Re = new WeakMap(), Z = new WeakMap(), ee = new WeakMap(), ue = new WeakMap(), he = new WeakMap(), fe = new WeakMap(), Oe = new WeakMap(), K = new WeakSet(), /**
|
|
1201
1200
|
* Parses a route definition object into a set of matchable routes.
|
|
1202
1201
|
*
|
|
1203
1202
|
* @param route - Route config object.
|
|
1204
1203
|
* @param layers - Array of parent layers. Passed when this function calls itself on nested routes.
|
|
1205
1204
|
*/
|
|
1206
|
-
|
|
1205
|
+
st = function(e, t = [], r = []) {
|
|
1207
1206
|
if (!(typeof e == "object" && !Array.isArray(e)) || typeof e.path != "string")
|
|
1208
1207
|
throw new TypeError(`Route configs must be objects with a 'path' string property. Got: ${e}`);
|
|
1209
1208
|
if (e.redirect && e.routes)
|
|
@@ -1219,35 +1218,35 @@ rt = function(e, t = [], r = []) {
|
|
|
1219
1218
|
const n = [];
|
|
1220
1219
|
if (e.redirect) {
|
|
1221
1220
|
let l = e.redirect;
|
|
1222
|
-
return
|
|
1221
|
+
return V(l) && (l = He(se(a), l), l.startsWith("/") || (l = "/" + l)), n.push({
|
|
1223
1222
|
pattern: "/" + se([...a, ...be(e.path)]),
|
|
1224
1223
|
meta: {
|
|
1225
1224
|
redirect: l
|
|
1226
1225
|
}
|
|
1227
1226
|
}), n;
|
|
1228
1227
|
}
|
|
1229
|
-
let o =
|
|
1228
|
+
let o = bt;
|
|
1230
1229
|
if (typeof e.view == "function")
|
|
1231
1230
|
o = e.view;
|
|
1232
1231
|
else if (e.view)
|
|
1233
1232
|
throw new TypeError(`Route '${e.path}' expected a view function or undefined. Got: ${e.view}`);
|
|
1234
|
-
const
|
|
1233
|
+
const h = { id: ct(this, Qe)._++, view: o };
|
|
1235
1234
|
if (e.routes)
|
|
1236
1235
|
for (const l of e.routes)
|
|
1237
|
-
n.push(...
|
|
1236
|
+
n.push(...E(this, K, st).call(this, l, [...t, e], [...r, h]));
|
|
1238
1237
|
else
|
|
1239
1238
|
n.push({
|
|
1240
1239
|
pattern: parent ? se([...t.map((l) => l.path), e.path]) : e.path,
|
|
1241
1240
|
meta: {
|
|
1242
1241
|
pattern: e.path,
|
|
1243
|
-
layers: [...r,
|
|
1242
|
+
layers: [...r, h],
|
|
1244
1243
|
beforeMatch: e.beforeMatch
|
|
1245
1244
|
}
|
|
1246
1245
|
});
|
|
1247
1246
|
return n;
|
|
1248
|
-
},
|
|
1249
|
-
e.search !== s(this, Re) && (b(this, Re, e.search), s(this,
|
|
1250
|
-
const t =
|
|
1247
|
+
}, it = async function({ location: e }) {
|
|
1248
|
+
e.search !== s(this, Re) && (b(this, Re, e.search), s(this, Oe).call(this, at(e.search)));
|
|
1249
|
+
const t = gt(s(this, Z), e.pathname);
|
|
1251
1250
|
if (!t) {
|
|
1252
1251
|
s(this, ue).call(this, null), s(this, he).call(this, e.pathname), s(this, fe).call(this, {
|
|
1253
1252
|
wildcard: e.pathname
|
|
@@ -1261,8 +1260,8 @@ rt = function(e, t = [], r = []) {
|
|
|
1261
1260
|
}
|
|
1262
1261
|
}), t.meta.redirect != null)
|
|
1263
1262
|
if (typeof t.meta.redirect == "string") {
|
|
1264
|
-
const r =
|
|
1265
|
-
s(this, M).info(`↩️ redirecting from '${t.path}' to '${r}'`), s(this,
|
|
1263
|
+
const r = nr(t.meta.redirect, t.params);
|
|
1264
|
+
s(this, M).info(`↩️ redirecting from '${t.path}' to '${r}'`), s(this, P).replace(r);
|
|
1266
1265
|
} else if (typeof t.meta.redirect == "function") {
|
|
1267
1266
|
const r = {
|
|
1268
1267
|
path: t.path,
|
|
@@ -1273,26 +1272,26 @@ rt = function(e, t = [], r = []) {
|
|
|
1273
1272
|
let a = await t.meta.redirect(r);
|
|
1274
1273
|
if (typeof a != "string")
|
|
1275
1274
|
throw new Error("Redirect function must return a path to redirect to.");
|
|
1276
|
-
a.startsWith("/") || (a =
|
|
1275
|
+
a.startsWith("/") || (a = He(t.path, a)), s(this, M).info(`Redirecting to: '${a}'`), s(this, P).replace(a);
|
|
1277
1276
|
} else
|
|
1278
1277
|
throw new TypeError("Redirect must either be a path string or a function.");
|
|
1279
1278
|
else if (s(this, M).info(`📍 navigating to '${t.path}'`), s(this, he).call(this, t.path), s(this, fe).call(this, t.params), t.pattern !== this.$pattern.get()) {
|
|
1280
1279
|
s(this, ue).call(this, t.pattern);
|
|
1281
1280
|
const r = t.meta.layers;
|
|
1282
1281
|
for (let a = 0; a < r.length; a++) {
|
|
1283
|
-
const n = r[a], o = s(this,
|
|
1282
|
+
const n = r[a], o = s(this, I)[a];
|
|
1284
1283
|
if ((o == null ? void 0 : o.id) !== n.id) {
|
|
1285
|
-
b(this,
|
|
1286
|
-
const
|
|
1284
|
+
b(this, I, s(this, I).slice(0, a));
|
|
1285
|
+
const h = s(this, I).at(-1);
|
|
1287
1286
|
o && o.node.isMounted && o.node.unmount();
|
|
1288
1287
|
let l;
|
|
1289
|
-
|
|
1288
|
+
h ? l = h.node.setChildView(n.view) : l = s(this, X).rootView.setChildView(n.view), s(this, I).push({ id: n.id, node: l });
|
|
1290
1289
|
}
|
|
1291
1290
|
}
|
|
1292
1291
|
}
|
|
1293
1292
|
};
|
|
1294
|
-
const
|
|
1295
|
-
function
|
|
1293
|
+
const er = /(noopener|noreferrer) (noopener|noreferrer)/, tr = /^[\w-_]+:/;
|
|
1294
|
+
function rr(i, e, t = window) {
|
|
1296
1295
|
function r(n) {
|
|
1297
1296
|
return !n || n === i ? null : n.localName !== "a" || n.href === void 0 ? r(n.parentNode) : n;
|
|
1298
1297
|
}
|
|
@@ -1300,55 +1299,61 @@ function er(i, e, t = window) {
|
|
|
1300
1299
|
if (n.button && n.button !== 0 || n.ctrlKey || n.metaKey || n.altKey || n.shiftKey || n.defaultPrevented)
|
|
1301
1300
|
return;
|
|
1302
1301
|
const o = r(n.target);
|
|
1303
|
-
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" &&
|
|
1302
|
+
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" && er.test(o.getAttribute("rel")) || tr.test(o.getAttribute("href")) || (n.preventDefault(), e(o)));
|
|
1304
1303
|
}
|
|
1305
1304
|
return i.addEventListener("click", a), function() {
|
|
1306
1305
|
i.removeEventListener("click", a);
|
|
1307
1306
|
};
|
|
1308
1307
|
}
|
|
1309
|
-
function
|
|
1308
|
+
function nr(i, e) {
|
|
1310
1309
|
for (const t in e) {
|
|
1311
1310
|
const r = e[t].toString();
|
|
1312
1311
|
i = i.replace(`{${t}}`, r).replace(`{#${t}}`, r);
|
|
1313
1312
|
}
|
|
1314
1313
|
return i;
|
|
1315
1314
|
}
|
|
1316
|
-
var
|
|
1317
|
-
class
|
|
1315
|
+
var W, Ne, G, te, Me, Te, De, Ae, _e, je, B, x, z;
|
|
1316
|
+
class ar {
|
|
1318
1317
|
constructor() {
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
f(this,
|
|
1324
|
-
f(this,
|
|
1325
|
-
f(this,
|
|
1318
|
+
S(this, "http");
|
|
1319
|
+
S(this, "i18n");
|
|
1320
|
+
S(this, "render");
|
|
1321
|
+
S(this, "router");
|
|
1322
|
+
f(this, W, !1);
|
|
1323
|
+
f(this, Ne, "production");
|
|
1324
|
+
f(this, G);
|
|
1326
1325
|
f(this, te);
|
|
1327
|
-
f(this,
|
|
1328
|
-
f(this,
|
|
1329
|
-
f(this,
|
|
1330
|
-
f(this,
|
|
1326
|
+
f(this, Me, Vt);
|
|
1327
|
+
f(this, Te, Xe());
|
|
1328
|
+
f(this, De, []);
|
|
1329
|
+
f(this, Ae, []);
|
|
1330
|
+
f(this, _e, []);
|
|
1331
1331
|
f(this, je, []);
|
|
1332
|
+
f(this, B, {
|
|
1333
|
+
root: this,
|
|
1334
|
+
data: {}
|
|
1335
|
+
});
|
|
1332
1336
|
f(this, x, {
|
|
1333
1337
|
info: "development",
|
|
1334
1338
|
log: "development",
|
|
1335
1339
|
warn: "development",
|
|
1336
1340
|
error: !0
|
|
1337
1341
|
});
|
|
1338
|
-
f(this,
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1342
|
+
f(this, z, ft("*,-dolla/*"));
|
|
1343
|
+
S(this, "watch", s(this, Te).watch);
|
|
1344
|
+
S(this, "createState", ie);
|
|
1345
|
+
S(this, "createSettableState", Nt);
|
|
1346
|
+
S(this, "toSettableState", Mt);
|
|
1347
|
+
S(this, "toState", dt);
|
|
1348
|
+
S(this, "valueOf", Tt);
|
|
1349
|
+
S(this, "derive", ye);
|
|
1350
|
+
S(this, "createWatcher", Xe);
|
|
1351
|
+
S(this, "createRef", Dt);
|
|
1352
|
+
S(this, "isRef", At);
|
|
1348
1353
|
const e = this;
|
|
1349
|
-
this.http = new
|
|
1354
|
+
this.http = new qt(), this.i18n = new Gt(this), this.render = new zt(this), this.router = new Zt(this, {
|
|
1350
1355
|
get rootElement() {
|
|
1351
|
-
return s(e,
|
|
1356
|
+
return s(e, G);
|
|
1352
1357
|
},
|
|
1353
1358
|
get rootView() {
|
|
1354
1359
|
return s(e, te);
|
|
@@ -1359,46 +1364,64 @@ class rr {
|
|
|
1359
1364
|
* True when the app is connected to a DOM node and displayed to the user.
|
|
1360
1365
|
*/
|
|
1361
1366
|
get isMounted() {
|
|
1362
|
-
return s(this,
|
|
1367
|
+
return s(this, W);
|
|
1363
1368
|
}
|
|
1364
1369
|
/**
|
|
1365
1370
|
* Get the current environment that this app is running in.
|
|
1366
1371
|
* Environment affects which log messages will print and how much debugging info is included in the DOM.
|
|
1367
1372
|
*/
|
|
1368
1373
|
getEnv() {
|
|
1369
|
-
return s(this,
|
|
1374
|
+
return s(this, Ne);
|
|
1370
1375
|
}
|
|
1371
1376
|
/**
|
|
1372
1377
|
* Sets the environment that this app is running in.
|
|
1373
1378
|
* Environment affects which log messages will print and how much debugging info is included in the DOM.
|
|
1374
1379
|
*/
|
|
1375
1380
|
setEnv(e) {
|
|
1376
|
-
b(this,
|
|
1381
|
+
b(this, Ne, e);
|
|
1377
1382
|
}
|
|
1378
1383
|
/**
|
|
1379
1384
|
* Sets the view that will be shown when the `crash` method is called on any logger.
|
|
1380
1385
|
* When a crash is reported the app will be unmounted and replaced with this crash page.
|
|
1381
1386
|
*/
|
|
1382
1387
|
setCrashView(e) {
|
|
1383
|
-
b(this,
|
|
1388
|
+
b(this, Me, e);
|
|
1389
|
+
}
|
|
1390
|
+
/**
|
|
1391
|
+
* Sets a context variable and returns its value. Context variables are accessible on the app and in child views.
|
|
1392
|
+
*/
|
|
1393
|
+
set(e, t) {
|
|
1394
|
+
return s(this, B).data[e] = t, t;
|
|
1395
|
+
}
|
|
1396
|
+
/**
|
|
1397
|
+
* Gets the value of a context variable. Returns null if the variable is not set.
|
|
1398
|
+
*/
|
|
1399
|
+
get(e) {
|
|
1400
|
+
return s(this, B).data[e] ?? null;
|
|
1401
|
+
}
|
|
1402
|
+
/**
|
|
1403
|
+
* Returns an object of all context variables stored at the app level.
|
|
1404
|
+
*/
|
|
1405
|
+
getAll() {
|
|
1406
|
+
return { ...s(this, B).data };
|
|
1384
1407
|
}
|
|
1385
1408
|
async mount(e, t) {
|
|
1386
|
-
if (s(this,
|
|
1409
|
+
if (s(this, W))
|
|
1387
1410
|
throw new Error("Dolla is already mounted.");
|
|
1388
|
-
if (
|
|
1411
|
+
if (V(e)) {
|
|
1389
1412
|
const a = document.querySelector(e);
|
|
1390
|
-
|
|
1413
|
+
pt(HTMLElement, a, `Selector '${e}' did not match any element.`), b(this, G, a);
|
|
1391
1414
|
} else
|
|
1392
|
-
|
|
1415
|
+
pt(HTMLElement, e, "Expected an HTML element or a selector string. Got type: %t, value: %v"), b(this, G, e);
|
|
1393
1416
|
let r;
|
|
1394
|
-
t ? r =
|
|
1395
|
-
for (const a of s(this,
|
|
1417
|
+
t ? r = mt(t) : r = mt(bt), b(this, te, this.constructView(r.type, r.props)), await Promise.all(s(this, De).map((a) => a())), s(this, te).mount(s(this, G)), b(this, W, !0);
|
|
1418
|
+
for (const a of s(this, Ae))
|
|
1396
1419
|
a();
|
|
1397
1420
|
}
|
|
1398
1421
|
async unmount() {
|
|
1399
1422
|
var e;
|
|
1400
|
-
if (s(this,
|
|
1401
|
-
await Promise.all(s(this,
|
|
1423
|
+
if (s(this, W)) {
|
|
1424
|
+
await Promise.all(s(this, _e).map((t) => t())), (e = s(this, te)) == null || e.unmount(), s(this, Te).stopAll(), b(this, W, !1);
|
|
1402
1425
|
for (const t of s(this, je))
|
|
1403
1426
|
t();
|
|
1404
1427
|
}
|
|
@@ -1408,20 +1431,20 @@ class rr {
|
|
|
1408
1431
|
* it will be awaited before mounting finishes. Use this to perform initial setup before the app is displayed to the user.
|
|
1409
1432
|
*/
|
|
1410
1433
|
beforeMount(e) {
|
|
1411
|
-
s(this,
|
|
1434
|
+
s(this, De).push(e);
|
|
1412
1435
|
}
|
|
1413
1436
|
/**
|
|
1414
1437
|
* Registers a `callback` to run after the app is mounted.
|
|
1415
1438
|
*/
|
|
1416
1439
|
onMount(e) {
|
|
1417
|
-
s(this,
|
|
1440
|
+
s(this, Ae).push(e);
|
|
1418
1441
|
}
|
|
1419
1442
|
/**
|
|
1420
1443
|
* Registers a `callback` to run after `Dolla.unmount` is called, before the app is unmounted. If `callback` returns a Promise,
|
|
1421
1444
|
* it will be awaited before unmounting finishes. Use this to perform cleanup.
|
|
1422
1445
|
*/
|
|
1423
1446
|
beforeUnmount(e) {
|
|
1424
|
-
s(this,
|
|
1447
|
+
s(this, _e).push(e);
|
|
1425
1448
|
}
|
|
1426
1449
|
/**
|
|
1427
1450
|
* Registers a `callback` to run after the app is unmounted.
|
|
@@ -1439,22 +1462,22 @@ class rr {
|
|
|
1439
1462
|
}
|
|
1440
1463
|
}
|
|
1441
1464
|
setLogFilter(e) {
|
|
1442
|
-
b(this,
|
|
1465
|
+
b(this, z, ft(e));
|
|
1443
1466
|
}
|
|
1444
1467
|
createLogger(e, t) {
|
|
1445
|
-
const r =
|
|
1468
|
+
const r = dt(e), a = (t == null ? void 0 : t.console) ?? _t(), n = this;
|
|
1446
1469
|
return {
|
|
1447
1470
|
get info() {
|
|
1448
|
-
var
|
|
1471
|
+
var h;
|
|
1449
1472
|
const o = r.get();
|
|
1450
|
-
if (s(n, x).info === !1 ||
|
|
1451
|
-
return
|
|
1473
|
+
if (s(n, x).info === !1 || V(s(n, x).info) && s(n, x).info !== n.getEnv() || !s(h = n, z).call(h, o))
|
|
1474
|
+
return Ce;
|
|
1452
1475
|
{
|
|
1453
1476
|
let l = `%c${o}`;
|
|
1454
1477
|
return t != null && t.uid ? l += ` %c[uid: %c${t.uid}%c]` : l += "%c%c%c", a.info.bind(
|
|
1455
1478
|
a,
|
|
1456
1479
|
l,
|
|
1457
|
-
`color:${
|
|
1480
|
+
`color:${Fe(l)};font-weight:bold`,
|
|
1458
1481
|
"color:#777",
|
|
1459
1482
|
"color:#aaa",
|
|
1460
1483
|
"color:#777"
|
|
@@ -1462,16 +1485,16 @@ class rr {
|
|
|
1462
1485
|
}
|
|
1463
1486
|
},
|
|
1464
1487
|
get log() {
|
|
1465
|
-
var
|
|
1488
|
+
var h;
|
|
1466
1489
|
const o = r.get();
|
|
1467
|
-
if (s(n, x).log === !1 ||
|
|
1468
|
-
return
|
|
1490
|
+
if (s(n, x).log === !1 || V(s(n, x).log) && s(n, x).log !== n.getEnv() || !s(h = n, z).call(h, o))
|
|
1491
|
+
return Ce;
|
|
1469
1492
|
{
|
|
1470
1493
|
let l = `%c${o}`;
|
|
1471
1494
|
return t != null && t.uid ? l += ` %c[uid: %c${t.uid}%c]` : l += "%c%c%c", a.log.bind(
|
|
1472
1495
|
a,
|
|
1473
1496
|
l,
|
|
1474
|
-
`color:${
|
|
1497
|
+
`color:${Fe(l)};font-weight:bold`,
|
|
1475
1498
|
"color:#777",
|
|
1476
1499
|
"color:#aaa",
|
|
1477
1500
|
"color:#777"
|
|
@@ -1479,16 +1502,16 @@ class rr {
|
|
|
1479
1502
|
}
|
|
1480
1503
|
},
|
|
1481
1504
|
get warn() {
|
|
1482
|
-
var
|
|
1505
|
+
var h;
|
|
1483
1506
|
const o = r.get();
|
|
1484
|
-
if (s(n, x).warn === !1 ||
|
|
1485
|
-
return
|
|
1507
|
+
if (s(n, x).warn === !1 || V(s(n, x).warn) && s(n, x).warn !== n.getEnv() || !s(h = n, z).call(h, o))
|
|
1508
|
+
return Ce;
|
|
1486
1509
|
{
|
|
1487
1510
|
let l = `%c${o}`;
|
|
1488
1511
|
return t != null && t.uid ? l += ` %c[uid: %c${t.uid}%c]` : l += "%c%c%c", a.warn.bind(
|
|
1489
1512
|
a,
|
|
1490
1513
|
l,
|
|
1491
|
-
`color:${
|
|
1514
|
+
`color:${Fe(l)};font-weight:bold`,
|
|
1492
1515
|
"color:#777",
|
|
1493
1516
|
"color:#aaa",
|
|
1494
1517
|
"color:#777"
|
|
@@ -1496,16 +1519,16 @@ class rr {
|
|
|
1496
1519
|
}
|
|
1497
1520
|
},
|
|
1498
1521
|
get error() {
|
|
1499
|
-
var
|
|
1522
|
+
var h;
|
|
1500
1523
|
const o = r.get();
|
|
1501
|
-
if (s(n, x).error === !1 ||
|
|
1502
|
-
return
|
|
1524
|
+
if (s(n, x).error === !1 || V(s(n, x).error) && s(n, x).error !== n.getEnv() || !s(h = n, z).call(h, o))
|
|
1525
|
+
return Ce;
|
|
1503
1526
|
{
|
|
1504
1527
|
let l = `%c${o}`;
|
|
1505
1528
|
return t != null && t.uid ? l += ` %c[uid: %c${t.uid}%c]` : l += "%c%c%c", a.error.bind(
|
|
1506
1529
|
a,
|
|
1507
1530
|
l,
|
|
1508
|
-
`color:${
|
|
1531
|
+
`color:${Fe(l)};font-weight:bold`,
|
|
1509
1532
|
"color:#777",
|
|
1510
1533
|
"color:#aaa",
|
|
1511
1534
|
"color:#777"
|
|
@@ -1513,11 +1536,11 @@ class rr {
|
|
|
1513
1536
|
}
|
|
1514
1537
|
},
|
|
1515
1538
|
crash(o) {
|
|
1516
|
-
throw n.isMounted && (n.unmount(), n.constructView(s(n,
|
|
1539
|
+
throw n.isMounted && (n.unmount(), n.constructView(s(n, Me), {
|
|
1517
1540
|
error: o,
|
|
1518
1541
|
loggerName: r.get(),
|
|
1519
1542
|
uid: t == null ? void 0 : t.uid
|
|
1520
|
-
}).mount(s(n,
|
|
1543
|
+
}).mount(s(n, G))), o;
|
|
1521
1544
|
}
|
|
1522
1545
|
};
|
|
1523
1546
|
}
|
|
@@ -1525,33 +1548,41 @@ class rr {
|
|
|
1525
1548
|
*
|
|
1526
1549
|
*/
|
|
1527
1550
|
constructView(e, t, r = []) {
|
|
1528
|
-
return jt(
|
|
1551
|
+
return jt(s(this, B), e, t, r);
|
|
1529
1552
|
}
|
|
1530
1553
|
/**
|
|
1531
1554
|
*
|
|
1532
1555
|
*/
|
|
1533
1556
|
constructMarkup(e) {
|
|
1534
|
-
return
|
|
1557
|
+
return Ct(Ft(s(this, B), e));
|
|
1535
1558
|
}
|
|
1536
1559
|
}
|
|
1537
|
-
|
|
1538
|
-
const
|
|
1560
|
+
W = new WeakMap(), Ne = new WeakMap(), G = new WeakMap(), te = new WeakMap(), Me = new WeakMap(), Te = new WeakMap(), De = new WeakMap(), Ae = new WeakMap(), _e = new WeakMap(), je = new WeakMap(), B = new WeakMap(), x = new WeakMap(), z = new WeakMap();
|
|
1561
|
+
const wt = new ar(), lr = wt.i18n.t.bind(wt.i18n);
|
|
1562
|
+
function cr(i) {
|
|
1563
|
+
typeof window < "u" && (window.DOLLA_DEV_DEBUG = i);
|
|
1564
|
+
}
|
|
1565
|
+
function ur() {
|
|
1566
|
+
return typeof window < "u" ? window.DOLLA_DEV_DEBUG === !0 : !1;
|
|
1567
|
+
}
|
|
1539
1568
|
export {
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1569
|
+
xt as cond,
|
|
1570
|
+
mt as createMarkup,
|
|
1571
|
+
Dt as createRef,
|
|
1572
|
+
Nt as createSettableState,
|
|
1573
|
+
dr as createSetter,
|
|
1545
1574
|
ie as createState,
|
|
1546
|
-
|
|
1575
|
+
wt as default,
|
|
1547
1576
|
ye as derive,
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1577
|
+
ur as getDevDebug,
|
|
1578
|
+
ut as html,
|
|
1579
|
+
At as isRef,
|
|
1580
|
+
pr as portal,
|
|
1581
|
+
mr as repeat,
|
|
1582
|
+
cr as setDevDebug,
|
|
1583
|
+
lr as t,
|
|
1584
|
+
Mt as toSettableState,
|
|
1585
|
+
dt as toState,
|
|
1586
|
+
Tt as valueOf
|
|
1556
1587
|
};
|
|
1557
1588
|
//# sourceMappingURL=index.js.map
|