@manyducks.co/dolla 2.0.0-alpha.13 → 2.0.0-alpha.14
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 +4 -2
- package/dist/index.js +548 -539
- 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 +18 -8
- package/dist/modules/dolla.d.ts +7 -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 +3 -3
- 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-MfPKbG0F.js +1303 -0
- package/dist/passthrough-MfPKbG0F.js.map +1 -0
- package/dist/state.d.ts +14 -1
- package/dist/view.d.ts +4 -4
- package/notes/scratch.md +50 -0
- package/package.json +1 -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 Pt = Object.defineProperty;
|
|
2
|
+
var ot = (i) => {
|
|
3
3
|
throw TypeError(i);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var s = (i, e, t) => (
|
|
8
|
-
var
|
|
5
|
+
var St = (i, e, t) => e in i ? Pt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
6
|
+
var S = (i, e, t) => St(i, typeof e != "symbol" ? e + "" : e, t), Qe = (i, e, t) => e.has(i) || ot("Cannot " + t);
|
|
7
|
+
var s = (i, e, t) => (Qe(i, e, "read from private field"), t ? t.call(i) : e.get(i)), f = (i, e, t) => e.has(i) ? ot("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), b = (i, e, t, r) => (Qe(i, e, "write to private field"), r ? r.call(i, t) : e.set(i, t), t), E = (i, e, t) => (Qe(i, e, "access private method"), t);
|
|
8
|
+
var lt = (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 ct, c as Lt, i as Je, d as we, a as Rt, b as it, e as V, t as ut, f as se, g as wt, j as xt, k as Ye, P as yt, l as ht, m as Ot, n as Nt, o as ft, v as Mt, p as Tt, q as Dt, r as dt, s as pt, u as _t, w as je, x as Fe, y as At, z as jt, A as Ft } from "./passthrough-MfPKbG0F.js";
|
|
17
|
+
import { B as fr, C as dr, D as pr } from "./passthrough-MfPKbG0F.js";
|
|
18
|
+
function Ct(i) {
|
|
19
|
+
return ct`
|
|
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
|
+
${Lt(i.uid, ct`<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 Q, Be, T, j;
|
|
66
|
+
class Vt {
|
|
67
67
|
constructor() {
|
|
68
68
|
f(this, T);
|
|
69
|
-
f(this,
|
|
70
|
-
f(this,
|
|
69
|
+
f(this, Q, []);
|
|
70
|
+
f(this, Be, qt());
|
|
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, Q).push(e), () => {
|
|
80
|
+
s(this, Q).splice(s(this, Q).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
|
+
Q = new WeakMap(), Be = new WeakMap(), T = new WeakSet(), j = async function(e, t, r) {
|
|
109
|
+
return Ht({
|
|
110
110
|
...r,
|
|
111
111
|
method: e,
|
|
112
112
|
uri: t,
|
|
113
|
-
middleware: s(this,
|
|
114
|
-
fetch: s(this,
|
|
113
|
+
middleware: s(this, Q),
|
|
114
|
+
fetch: s(this, Be)
|
|
115
115
|
});
|
|
116
116
|
};
|
|
117
|
-
function
|
|
117
|
+
function qt() {
|
|
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 Ut 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 Ht(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") && Je(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 Ut(o);
|
|
197
197
|
return o;
|
|
198
198
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
class Ht {
|
|
199
|
+
var ze, ie, te, Xe, bt;
|
|
200
|
+
class It {
|
|
202
201
|
constructor(e, t) {
|
|
203
|
-
f(this,
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
f(this,
|
|
207
|
-
f(this,
|
|
202
|
+
f(this, te);
|
|
203
|
+
S(this, "dolla");
|
|
204
|
+
S(this, "config");
|
|
205
|
+
f(this, ze, !1);
|
|
206
|
+
f(this, ie, /* @__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, ze)) {
|
|
212
|
+
if (it(this.config.fetch)) {
|
|
213
|
+
if (e = await this.config.fetch(), !Je(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 (Je(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, te, Xe).call(this, e);
|
|
233
230
|
for (const r of t)
|
|
234
|
-
s(this,
|
|
235
|
-
}
|
|
231
|
+
s(this, ie).set(r[0], r[1]);
|
|
232
|
+
} else
|
|
233
|
+
throw new Error("Language could not be loaded.");
|
|
236
234
|
}
|
|
237
235
|
getTemplate(e) {
|
|
238
|
-
return s(this,
|
|
236
|
+
return s(this, ie).get(e) ?? {
|
|
237
|
+
segments: [{ type: 0, text: `[MISSING: ${e}]` }]
|
|
238
|
+
};
|
|
239
239
|
}
|
|
240
240
|
hasTemplate(e) {
|
|
241
|
-
return s(this,
|
|
241
|
+
return s(this, ie).has(e);
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
|
-
|
|
244
|
+
ze = new WeakMap(), ie = new WeakMap(), te = new WeakSet(), Xe = function(e, t = []) {
|
|
245
245
|
const r = [];
|
|
246
246
|
for (const a in e)
|
|
247
|
-
switch (
|
|
247
|
+
switch (ut(e[a])) {
|
|
248
248
|
case "string":
|
|
249
|
-
r.push([[...t, a].join("."),
|
|
249
|
+
r.push([[...t, a].join("."), E(this, te, bt).call(this, e[a])]);
|
|
250
250
|
break;
|
|
251
251
|
case "object":
|
|
252
|
-
r.push(...
|
|
252
|
+
r.push(...E(this, te, Xe).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: ${ut(e[a])}`
|
|
257
257
|
);
|
|
258
258
|
}
|
|
259
259
|
return r;
|
|
260
|
-
},
|
|
260
|
+
}, bt = 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
|
|
310
|
-
class
|
|
309
|
+
var be, q, x, ve, $e, Ee, ke, O, vt, Ze, et, tt, $t;
|
|
310
|
+
class Wt {
|
|
311
311
|
constructor(e) {
|
|
312
|
-
f(this,
|
|
313
|
-
f(this,
|
|
312
|
+
f(this, O);
|
|
313
|
+
f(this, be);
|
|
314
314
|
f(this, q);
|
|
315
|
-
f(this,
|
|
316
|
-
f(this,
|
|
317
|
-
f(this,
|
|
318
|
-
f(this,
|
|
319
|
-
|
|
320
|
-
f(this,
|
|
321
|
-
b(this,
|
|
322
|
-
const [t, r] =
|
|
323
|
-
this.$locale = t, b(this,
|
|
324
|
-
s(this,
|
|
315
|
+
f(this, x, /* @__PURE__ */ new Map());
|
|
316
|
+
f(this, ve, []);
|
|
317
|
+
f(this, $e, /* @__PURE__ */ new Map());
|
|
318
|
+
f(this, Ee, "auto");
|
|
319
|
+
S(this, "$locale");
|
|
320
|
+
f(this, ke);
|
|
321
|
+
b(this, be, e), b(this, q, e.createLogger("dolla/i18n"));
|
|
322
|
+
const [t, r] = se();
|
|
323
|
+
this.$locale = t, b(this, ke, r), this.addFormat("number", (a, n, o) => E(this, O, Ze).call(this, Number(n), o)), this.addFormat("datetime", (a, n, o) => E(this, O, et).call(this, n, o)), this.addFormat("list", (a, n, o) => E(this, O, tt).call(this, n, o)), e.beforeMount(async () => {
|
|
324
|
+
s(this, x).size > 0 && await this.setLocale(s(this, Ee));
|
|
325
325
|
});
|
|
326
326
|
}
|
|
327
327
|
get locales() {
|
|
328
|
-
return [...s(this,
|
|
328
|
+
return [...s(this, x).keys()];
|
|
329
329
|
}
|
|
330
330
|
setup(e) {
|
|
331
331
|
if (e.translations.forEach((t) => {
|
|
332
|
-
s(this,
|
|
332
|
+
s(this, x).set(t.locale, new It(t, s(this, be)));
|
|
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
|
-
b(this,
|
|
336
|
+
b(this, Ee, e.locale);
|
|
337
337
|
}
|
|
338
338
|
s(this, q).info(
|
|
339
|
-
`${s(this,
|
|
339
|
+
`${s(this, x).size} language${s(this, x).size === 1 ? "" : "s"} supported: '${[...s(this, x).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, x).has(o) && (t = o);
|
|
353
353
|
} else
|
|
354
|
-
s(this,
|
|
354
|
+
s(this, x).has(e) && (t = e);
|
|
355
355
|
if (t == null) {
|
|
356
|
-
const n = s(this,
|
|
356
|
+
const n = s(this, x).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, x).has(t))
|
|
360
|
+
throw new Error(`Locale '${e}' has no translation.`);
|
|
361
|
+
const r = s(this, x).get(t);
|
|
362
362
|
try {
|
|
363
|
-
await r.load(), b(this,
|
|
363
|
+
await r.load(), b(this, ve, []), s(this, ke).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
|
-
return
|
|
388
|
-
|
|
385
|
+
return we([this.$locale, ...a], (n, ...o) => {
|
|
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, vt).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, $e).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
|
|
426
|
+
return we([this.$locale, e], (r, a) => E(this, O, Ze).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
|
|
438
|
+
return we([this.$locale, e], (r, a) => E(this, O, et).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,58 +447,57 @@ class It {
|
|
|
447
447
|
* const $formatted = Dolla.i18n.list(list, { });
|
|
448
448
|
*/
|
|
449
449
|
list(e, t) {
|
|
450
|
-
return
|
|
450
|
+
return we([this.$locale, e], (r, a) => E(this, O, tt).call(this, a, t));
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
|
-
|
|
454
|
-
|
|
453
|
+
be = new WeakMap(), q = new WeakMap(), x = new WeakMap(), ve = new WeakMap(), $e = new WeakMap(), Ee = new WeakMap(), ke = new WeakMap(), O = new WeakSet(), vt = function(e, t, r) {
|
|
454
|
+
var l;
|
|
455
|
+
const a = E(this, O, $t).call(this, t, r);
|
|
455
456
|
if (a) return a;
|
|
456
|
-
const n = s(this,
|
|
457
|
+
const n = s(this, x).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 = Gt(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, $e).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
|
+
}, Ze = function(e, t) {
|
|
490
489
|
return new Intl.NumberFormat(this.$locale.get(), t).format(e);
|
|
491
|
-
},
|
|
490
|
+
}, et = 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
|
+
}, tt = function(e, t) {
|
|
496
495
|
return new Intl.ListFormat(this.$locale.get(), t).format(e);
|
|
497
496
|
}, // relativeTime(): State<string> {
|
|
498
497
|
// }
|
|
499
|
-
|
|
500
|
-
for (const r of s(this,
|
|
501
|
-
if (r[0] === e &&
|
|
498
|
+
$t = function(e, t) {
|
|
499
|
+
for (const r of s(this, ve))
|
|
500
|
+
if (r[0] === e && Rt(r[1], t))
|
|
502
501
|
return r[2];
|
|
503
502
|
};
|
|
504
503
|
function Gt(i, e) {
|
|
@@ -510,21 +509,21 @@ function Gt(i, e) {
|
|
|
510
509
|
}
|
|
511
510
|
return r;
|
|
512
511
|
}
|
|
513
|
-
var
|
|
514
|
-
class
|
|
512
|
+
var J, Pe, U, H, oe, F, le, Ce;
|
|
513
|
+
class Bt {
|
|
515
514
|
constructor(e) {
|
|
516
|
-
f(this,
|
|
517
|
-
f(this,
|
|
515
|
+
f(this, le);
|
|
516
|
+
f(this, J);
|
|
518
517
|
f(this, Pe);
|
|
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
|
-
f(this,
|
|
526
|
-
f(this,
|
|
527
|
-
b(this,
|
|
524
|
+
f(this, oe, []);
|
|
525
|
+
f(this, F, !1);
|
|
526
|
+
b(this, J, e), b(this, Pe, 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,
|
|
539
|
+
}), !s(this, F) && s(this, J).isMounted && (b(this, F, !0), E(this, le, Ce).call(this));
|
|
541
540
|
});
|
|
542
541
|
}
|
|
543
542
|
/**
|
|
@@ -547,49 +546,49 @@ class Wt {
|
|
|
547
546
|
*/
|
|
548
547
|
read(e) {
|
|
549
548
|
return new Promise((t) => {
|
|
550
|
-
s(this,
|
|
549
|
+
s(this, oe).push(() => {
|
|
551
550
|
e(), t();
|
|
552
|
-
}), !s(this,
|
|
551
|
+
}), !s(this, F) && s(this, J).isMounted && (b(this, F, !0), E(this, le, Ce).call(this));
|
|
553
552
|
});
|
|
554
553
|
}
|
|
555
554
|
}
|
|
556
|
-
|
|
557
|
-
const e = s(this,
|
|
558
|
-
if ((!s(this,
|
|
559
|
-
for (const t of s(this,
|
|
555
|
+
J = new WeakMap(), Pe = new WeakMap(), U = new WeakMap(), H = new WeakMap(), oe = new WeakMap(), F = new WeakMap(), le = new WeakSet(), Ce = function() {
|
|
556
|
+
const e = s(this, U).size + s(this, H).length;
|
|
557
|
+
if ((!s(this, J).isMounted || e === 0) && b(this, F, !1), !s(this, F)) {
|
|
558
|
+
for (const t of s(this, oe))
|
|
560
559
|
t();
|
|
561
|
-
b(this,
|
|
560
|
+
b(this, oe, []);
|
|
562
561
|
return;
|
|
563
562
|
}
|
|
564
563
|
requestAnimationFrame(() => {
|
|
565
|
-
s(this, Pe).info(`Batching ${s(this,
|
|
566
|
-
for (const t of s(this,
|
|
564
|
+
s(this, Pe).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, le, Ce).call(this);
|
|
572
571
|
});
|
|
573
572
|
};
|
|
574
|
-
function
|
|
575
|
-
return
|
|
573
|
+
function fe() {
|
|
574
|
+
return fe = Object.assign ? Object.assign.bind() : function(i) {
|
|
576
575
|
for (var e = 1; e < arguments.length; e++) {
|
|
577
576
|
var t = arguments[e];
|
|
578
577
|
for (var r in t) ({}).hasOwnProperty.call(t, r) && (i[r] = t[r]);
|
|
579
578
|
}
|
|
580
579
|
return i;
|
|
581
|
-
},
|
|
580
|
+
}, fe.apply(null, arguments);
|
|
582
581
|
}
|
|
583
|
-
var
|
|
582
|
+
var _;
|
|
584
583
|
(function(i) {
|
|
585
584
|
i.Pop = "POP", i.Push = "PUSH", i.Replace = "REPLACE";
|
|
586
|
-
})(
|
|
587
|
-
var
|
|
585
|
+
})(_ || (_ = {}));
|
|
586
|
+
var He = 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 Ve(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 Ie = "beforeunload", zt = "hashchange", Et = "popstate";
|
|
601
|
+
function Kt(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, He({
|
|
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 =
|
|
619
|
+
var w = _.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
|
+
C($ * -1);
|
|
629
628
|
}
|
|
630
|
-
},
|
|
629
|
+
}, C($));
|
|
631
630
|
} else
|
|
632
|
-
process.env.NODE_ENV !== "production" &&
|
|
631
|
+
process.env.NODE_ENV !== "production" && Ve(
|
|
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
|
|
@@ -637,137 +636,137 @@ function Bt(i) {
|
|
|
637
636
|
"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation."
|
|
638
637
|
);
|
|
639
638
|
else
|
|
640
|
-
|
|
639
|
+
re(w);
|
|
641
640
|
}
|
|
642
641
|
}
|
|
643
|
-
r.addEventListener(
|
|
644
|
-
var l =
|
|
645
|
-
|
|
646
|
-
idx:
|
|
642
|
+
r.addEventListener(Et, h);
|
|
643
|
+
var l = _.Pop, d = n(), g = d[0], m = d[1], u = Ge(), y = Ge();
|
|
644
|
+
g == null && (g = 0, a.replaceState(fe({}, 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 : qe(w);
|
|
650
649
|
}
|
|
651
|
-
function
|
|
652
|
-
return c === void 0 && (c = null),
|
|
653
|
-
pathname:
|
|
650
|
+
function de(w, c) {
|
|
651
|
+
return c === void 0 && (c = null), He(fe({
|
|
652
|
+
pathname: m.pathname,
|
|
654
653
|
hash: "",
|
|
655
654
|
search: ""
|
|
656
|
-
}, typeof w == "string" ?
|
|
655
|
+
}, typeof w == "string" ? rt(w) : w, {
|
|
657
656
|
state: c,
|
|
658
|
-
key:
|
|
657
|
+
key: kt()
|
|
659
658
|
}));
|
|
660
659
|
}
|
|
661
|
-
function
|
|
660
|
+
function pe(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 me(w, c,
|
|
667
|
+
function me(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
|
-
function
|
|
674
|
+
function re(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
|
-
function
|
|
684
|
-
var
|
|
682
|
+
function ne(w, c) {
|
|
683
|
+
var p = _.Push, v = de(w, c);
|
|
685
684
|
function $() {
|
|
686
|
-
|
|
685
|
+
ne(w, c);
|
|
687
686
|
}
|
|
688
|
-
if (me(
|
|
689
|
-
var
|
|
687
|
+
if (me(p, v, $)) {
|
|
688
|
+
var L = pe(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
|
-
|
|
694
|
+
re(p);
|
|
696
695
|
}
|
|
697
696
|
}
|
|
698
|
-
function
|
|
699
|
-
var
|
|
697
|
+
function ge(w, c) {
|
|
698
|
+
var p = _.Replace, v = de(w, c);
|
|
700
699
|
function $() {
|
|
701
|
-
|
|
700
|
+
ge(w, c);
|
|
702
701
|
}
|
|
703
|
-
if (me(
|
|
704
|
-
var
|
|
705
|
-
a.replaceState(
|
|
702
|
+
if (me(p, v, $)) {
|
|
703
|
+
var L = pe(v, g), N = L[0], D = L[1];
|
|
704
|
+
a.replaceState(N, "", D), re(p);
|
|
706
705
|
}
|
|
707
706
|
}
|
|
708
|
-
function
|
|
707
|
+
function C(w) {
|
|
709
708
|
a.go(w);
|
|
710
709
|
}
|
|
711
|
-
var
|
|
710
|
+
var K = {
|
|
712
711
|
get action() {
|
|
713
712
|
return l;
|
|
714
713
|
},
|
|
715
714
|
get location() {
|
|
716
|
-
return
|
|
715
|
+
return m;
|
|
717
716
|
},
|
|
718
|
-
createHref:
|
|
719
|
-
push:
|
|
720
|
-
replace:
|
|
721
|
-
go:
|
|
717
|
+
createHref: k,
|
|
718
|
+
push: ne,
|
|
719
|
+
replace: ge,
|
|
720
|
+
go: C,
|
|
722
721
|
back: function() {
|
|
723
|
-
|
|
722
|
+
C(-1);
|
|
724
723
|
},
|
|
725
724
|
forward: function() {
|
|
726
|
-
|
|
725
|
+
C(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(Ie, We), function() {
|
|
733
|
+
p(), y.length || r.removeEventListener(Ie, We);
|
|
735
734
|
};
|
|
736
735
|
}
|
|
737
736
|
};
|
|
738
|
-
return
|
|
737
|
+
return K;
|
|
739
738
|
}
|
|
740
|
-
function
|
|
739
|
+
function Qt(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 = rt(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 = a.state || {};
|
|
744
|
+
return [A.idx, He({
|
|
746
745
|
pathname: v,
|
|
747
|
-
search:
|
|
748
|
-
hash:
|
|
749
|
-
state:
|
|
750
|
-
key:
|
|
746
|
+
search: L,
|
|
747
|
+
hash: D,
|
|
748
|
+
state: A.usr || null,
|
|
749
|
+
key: A.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 =
|
|
757
|
+
var c = _.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
|
+
K(L * -1);
|
|
767
766
|
}
|
|
768
|
-
},
|
|
767
|
+
}, K(L));
|
|
769
768
|
} else
|
|
770
|
-
process.env.NODE_ENV !== "production" &&
|
|
769
|
+
process.env.NODE_ENV !== "production" && Ve(
|
|
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
|
|
@@ -775,86 +774,86 @@ function Kt(i) {
|
|
|
775
774
|
"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation."
|
|
776
775
|
);
|
|
777
776
|
else
|
|
778
|
-
|
|
777
|
+
ne(c);
|
|
779
778
|
}
|
|
780
779
|
}
|
|
781
|
-
r.addEventListener(
|
|
782
|
-
var c = n(),
|
|
783
|
-
|
|
780
|
+
r.addEventListener(Et, h), r.addEventListener(zt, function() {
|
|
781
|
+
var c = n(), p = c[1];
|
|
782
|
+
qe(p) !== qe(m) && h();
|
|
784
783
|
});
|
|
785
|
-
var l =
|
|
786
|
-
|
|
787
|
-
idx:
|
|
784
|
+
var l = _.Pop, d = n(), g = d[0], m = d[1], u = Ge(), y = Ge();
|
|
785
|
+
g == null && (g = 0, a.replaceState(fe({}, 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
|
-
function
|
|
798
|
-
return
|
|
796
|
+
function de(c) {
|
|
797
|
+
return k() + "#" + (typeof c == "string" ? c : qe(c));
|
|
799
798
|
}
|
|
800
|
-
function
|
|
801
|
-
return
|
|
802
|
-
pathname:
|
|
799
|
+
function pe(c, p) {
|
|
800
|
+
return p === void 0 && (p = null), He(fe({
|
|
801
|
+
pathname: m.pathname,
|
|
803
802
|
hash: "",
|
|
804
803
|
search: ""
|
|
805
|
-
}, typeof c == "string" ?
|
|
806
|
-
state:
|
|
807
|
-
key:
|
|
804
|
+
}, typeof c == "string" ? rt(c) : c, {
|
|
805
|
+
state: p,
|
|
806
|
+
key: kt()
|
|
808
807
|
}));
|
|
809
808
|
}
|
|
810
|
-
function me(c,
|
|
809
|
+
function me(c, p) {
|
|
811
810
|
return [{
|
|
812
811
|
usr: c.state,
|
|
813
812
|
key: c.key,
|
|
814
|
-
idx:
|
|
815
|
-
},
|
|
813
|
+
idx: p
|
|
814
|
+
}, de(c)];
|
|
816
815
|
}
|
|
817
|
-
function
|
|
816
|
+
function re(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
|
-
function
|
|
823
|
+
function ne(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
|
|
833
|
-
var v =
|
|
834
|
-
function
|
|
835
|
-
|
|
831
|
+
function ge(c, p) {
|
|
832
|
+
var v = _.Push, $ = pe(c, p);
|
|
833
|
+
function L() {
|
|
834
|
+
ge(c, p);
|
|
836
835
|
}
|
|
837
|
-
if (process.env.NODE_ENV !== "production" &&
|
|
838
|
-
var
|
|
836
|
+
if (process.env.NODE_ENV !== "production" && Ve($.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.push(" + JSON.stringify(c) + ")"), re(v, $, L)) {
|
|
837
|
+
var N = me($, g + 1), D = N[0], A = N[1];
|
|
839
838
|
try {
|
|
840
|
-
a.pushState(
|
|
839
|
+
a.pushState(D, "", A);
|
|
841
840
|
} catch {
|
|
842
|
-
r.location.assign(
|
|
841
|
+
r.location.assign(A);
|
|
843
842
|
}
|
|
844
|
-
|
|
843
|
+
ne(v);
|
|
845
844
|
}
|
|
846
845
|
}
|
|
847
|
-
function
|
|
848
|
-
var v =
|
|
849
|
-
function
|
|
850
|
-
|
|
846
|
+
function C(c, p) {
|
|
847
|
+
var v = _.Replace, $ = pe(c, p);
|
|
848
|
+
function L() {
|
|
849
|
+
C(c, p);
|
|
851
850
|
}
|
|
852
|
-
if (process.env.NODE_ENV !== "production" &&
|
|
853
|
-
var
|
|
854
|
-
a.replaceState(
|
|
851
|
+
if (process.env.NODE_ENV !== "production" && Ve($.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.replace(" + JSON.stringify(c) + ")"), re(v, $, L)) {
|
|
852
|
+
var N = me($, g), D = N[0], A = N[1];
|
|
853
|
+
a.replaceState(D, "", A), ne(v);
|
|
855
854
|
}
|
|
856
855
|
}
|
|
857
|
-
function
|
|
856
|
+
function K(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
|
-
createHref:
|
|
868
|
-
push:
|
|
869
|
-
replace:
|
|
870
|
-
go:
|
|
866
|
+
createHref: de,
|
|
867
|
+
push: ge,
|
|
868
|
+
replace: C,
|
|
869
|
+
go: K,
|
|
871
870
|
back: function() {
|
|
872
|
-
|
|
871
|
+
K(-1);
|
|
873
872
|
},
|
|
874
873
|
forward: function() {
|
|
875
|
-
|
|
874
|
+
K(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(Ie, We), function() {
|
|
882
|
+
v(), y.length || r.removeEventListener(Ie, We);
|
|
884
883
|
};
|
|
885
884
|
}
|
|
886
885
|
};
|
|
887
886
|
return w;
|
|
888
887
|
}
|
|
889
|
-
function
|
|
888
|
+
function We(i) {
|
|
890
889
|
i.preventDefault(), i.returnValue = "";
|
|
891
890
|
}
|
|
892
|
-
function
|
|
891
|
+
function Ge() {
|
|
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 kt() {
|
|
913
912
|
return Math.random().toString(36).substr(2, 8);
|
|
914
913
|
}
|
|
915
|
-
function
|
|
914
|
+
function qe(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 rt(i) {
|
|
920
919
|
var e = {};
|
|
921
920
|
if (i) {
|
|
922
921
|
var t = i.indexOf("#");
|
|
@@ -926,26 +925,26 @@ function et(i) {
|
|
|
926
925
|
}
|
|
927
926
|
return e;
|
|
928
927
|
}
|
|
929
|
-
function
|
|
930
|
-
return
|
|
928
|
+
function ye(i) {
|
|
929
|
+
return wt(i, "Expected `path` to be a string. Got type: %t, value: %v"), i.split("/").map((e) => e.trim()).filter((e) => e !== "");
|
|
931
930
|
}
|
|
932
|
-
function
|
|
931
|
+
function ae(i) {
|
|
933
932
|
var t;
|
|
934
|
-
|
|
935
|
-
(r) =>
|
|
933
|
+
xt(
|
|
934
|
+
(r) => it(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 = Ue(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 Ue(i, e) {
|
|
947
|
+
if (wt(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 (; ; )
|
|
@@ -959,9 +958,9 @@ function Fe(i, e) {
|
|
|
959
958
|
e = e.replace(/^\.\/?/, "");
|
|
960
959
|
else
|
|
961
960
|
break;
|
|
962
|
-
return
|
|
961
|
+
return ae([t, e]);
|
|
963
962
|
}
|
|
964
|
-
function
|
|
963
|
+
function nt(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,72 +969,72 @@ function tt(i) {
|
|
|
970
969
|
});
|
|
971
970
|
return Object.fromEntries(e);
|
|
972
971
|
}
|
|
973
|
-
function
|
|
972
|
+
function mt(i, e, t = {}) {
|
|
974
973
|
var o;
|
|
975
|
-
const [r, a] = e.split("?"), n =
|
|
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(
|
|
974
|
+
const [r, a] = e.split("?"), n = ye(r);
|
|
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 = /* @__PURE__ */ Object.create(null);
|
|
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: nt(a),
|
|
1014
|
+
meta: h.meta
|
|
1016
1015
|
};
|
|
1017
1016
|
}
|
|
1018
1017
|
}
|
|
1019
|
-
function
|
|
1018
|
+
function Jt(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
|
|
1038
|
-
const e =
|
|
1036
|
+
function Yt(i) {
|
|
1037
|
+
const e = ye(i), t = [];
|
|
1039
1038
|
for (let r = 0; r < e.length; r++) {
|
|
1040
1039
|
const a = e[r];
|
|
1041
1040
|
if (a === "*") {
|
|
@@ -1058,65 +1057,65 @@ function Jt(i) {
|
|
|
1058
1057
|
}
|
|
1059
1058
|
return t;
|
|
1060
1059
|
}
|
|
1061
|
-
var Se, M,
|
|
1062
|
-
class
|
|
1060
|
+
var Se, M, Y, Le, P, Ke, I, Re, X, Z, ce, ue, he, xe, z, at, st;
|
|
1061
|
+
class Xt {
|
|
1063
1062
|
constructor(e, t) {
|
|
1064
|
-
f(this,
|
|
1063
|
+
f(this, z);
|
|
1065
1064
|
f(this, Se);
|
|
1066
1065
|
f(this, M);
|
|
1067
|
-
f(this,
|
|
1068
|
-
f(this,
|
|
1069
|
-
f(this,
|
|
1070
|
-
f(this,
|
|
1066
|
+
f(this, Y);
|
|
1067
|
+
f(this, Le, Ye());
|
|
1068
|
+
f(this, P);
|
|
1069
|
+
f(this, Ke, 0);
|
|
1070
|
+
f(this, I, []);
|
|
1071
1071
|
f(this, Re);
|
|
1072
|
-
f(this,
|
|
1072
|
+
f(this, X, []);
|
|
1073
1073
|
// Callbacks that need to be called on unmount.
|
|
1074
|
-
f(this,
|
|
1074
|
+
f(this, Z, []);
|
|
1075
1075
|
/**
|
|
1076
1076
|
* The currently matched route pattern, if any.
|
|
1077
1077
|
*/
|
|
1078
|
-
|
|
1079
|
-
f(this,
|
|
1078
|
+
S(this, "$pattern");
|
|
1079
|
+
f(this, ce);
|
|
1080
1080
|
/**
|
|
1081
1081
|
* The current URL path.
|
|
1082
1082
|
*/
|
|
1083
|
-
|
|
1084
|
-
f(this,
|
|
1083
|
+
S(this, "$path");
|
|
1084
|
+
f(this, ue);
|
|
1085
1085
|
/**
|
|
1086
1086
|
* The current named path params.
|
|
1087
1087
|
*/
|
|
1088
|
-
|
|
1089
|
-
f(this,
|
|
1088
|
+
S(this, "$params");
|
|
1089
|
+
f(this, he);
|
|
1090
1090
|
/**
|
|
1091
1091
|
* The current query params. Changes to this object will be reflected in the URL.
|
|
1092
1092
|
*/
|
|
1093
|
-
|
|
1093
|
+
S(this, "$query");
|
|
1094
1094
|
f(this, xe);
|
|
1095
|
-
b(this, Se, e), b(this, M, e.createLogger("dolla/router")), b(this,
|
|
1096
|
-
const [r, a] =
|
|
1097
|
-
|
|
1095
|
+
b(this, Se, e), b(this, M, e.createLogger("dolla/router")), b(this, Y, t);
|
|
1096
|
+
const [r, a] = se(null), [n, o] = se(""), [h, l] = se({}), [d, g] = se(
|
|
1097
|
+
nt(typeof window > "u" ? "" : window.location.search ?? "")
|
|
1098
1098
|
);
|
|
1099
|
-
this.$pattern = r, b(this,
|
|
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, ce, a), this.$path = n, b(this, ue, o), this.$params = h, b(this, he, l), this.$query = d, b(this, xe, g), e.beforeMount(() => {
|
|
1100
|
+
s(this, P) != null && (s(this, Le).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, Z).push(s(this, P).listen(E(this, z, st).bind(this))), E(this, z, st).call(this, s(this, P)), s(this, Z).push(
|
|
1110
|
+
tr(s(this, Y).rootElement, (m) => {
|
|
1111
|
+
let u = m.getAttribute("href");
|
|
1112
|
+
s(this, M).info("Intercepted link click", m, u), /^https?:\/\/|^\//.test(u) || (u = ae([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, Y).rootElement));
|
|
1117
1115
|
}), e.onUnmount(() => {
|
|
1118
|
-
for (; s(this,
|
|
1119
|
-
s(this,
|
|
1116
|
+
for (; s(this, Z).length > 0; )
|
|
1117
|
+
s(this, Z).pop()();
|
|
1118
|
+
s(this, Le).stopAll();
|
|
1120
1119
|
});
|
|
1121
1120
|
}
|
|
1122
1121
|
setup(e) {
|
|
@@ -1126,18 +1125,18 @@ class Yt {
|
|
|
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, Qt()) : b(this, P, Kt()), b(this, X, Jt(
|
|
1129
|
+
e.routes.flatMap((t) => E(this, z, at).call(this, t)).map((t) => ({
|
|
1131
1130
|
pattern: t.pattern,
|
|
1132
1131
|
meta: t.meta,
|
|
1133
|
-
fragments:
|
|
1132
|
+
fragments: Yt(t.pattern)
|
|
1134
1133
|
}))
|
|
1135
1134
|
));
|
|
1136
|
-
for (const t of s(this,
|
|
1135
|
+
for (const t of s(this, X))
|
|
1137
1136
|
if (t.meta.redirect) {
|
|
1138
1137
|
let r;
|
|
1139
|
-
if (!
|
|
1140
|
-
if (r = t.meta.redirect, !
|
|
1138
|
+
if (!it(t.meta.redirect)) if (V(t.meta.redirect)) {
|
|
1139
|
+
if (r = t.meta.redirect, !mt(s(this, X), 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 =
|
|
1168
|
+
Array.isArray(e) ? r = ae(e) : r = e.toString(), r = Ue(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
|
-
Se = new WeakMap(), M = new WeakMap(),
|
|
1199
|
+
Se = new WeakMap(), M = new WeakMap(), Y = new WeakMap(), Le = new WeakMap(), P = new WeakMap(), Ke = new WeakMap(), I = new WeakMap(), Re = new WeakMap(), X = new WeakMap(), Z = new WeakMap(), ce = new WeakMap(), ue = new WeakMap(), he = new WeakMap(), xe = new WeakMap(), z = 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
|
+
at = 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)
|
|
@@ -1214,42 +1213,42 @@ rt = function(e, t = [], r = []) {
|
|
|
1214
1213
|
throw new Error("Route must have a 'view', a 'redirect', or a set of nested 'routes'.");
|
|
1215
1214
|
let a = [];
|
|
1216
1215
|
for (const l of t)
|
|
1217
|
-
a.push(...
|
|
1218
|
-
a.push(...
|
|
1216
|
+
a.push(...ye(l.path));
|
|
1217
|
+
a.push(...ye(e.path)), a[a.length - 1] === "*" && a.pop();
|
|
1219
1218
|
const n = [];
|
|
1220
1219
|
if (e.redirect) {
|
|
1221
1220
|
let l = e.redirect;
|
|
1222
|
-
return
|
|
1223
|
-
pattern: "/" +
|
|
1221
|
+
return V(l) && (l = Ue(ae(a), l), l.startsWith("/") || (l = "/" + l)), n.push({
|
|
1222
|
+
pattern: "/" + ae([...a, ...ye(e.path)]),
|
|
1224
1223
|
meta: {
|
|
1225
1224
|
redirect: l
|
|
1226
1225
|
}
|
|
1227
1226
|
}), n;
|
|
1228
1227
|
}
|
|
1229
|
-
let o =
|
|
1228
|
+
let o = yt;
|
|
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: lt(this, Ke)._++, view: o };
|
|
1235
1234
|
if (e.routes)
|
|
1236
1235
|
for (const l of e.routes)
|
|
1237
|
-
n.push(...
|
|
1236
|
+
n.push(...E(this, z, at).call(this, l, [...t, e], [...r, h]));
|
|
1238
1237
|
else
|
|
1239
1238
|
n.push({
|
|
1240
|
-
pattern: parent ?
|
|
1239
|
+
pattern: parent ? ae([...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, xe).call(this,
|
|
1250
|
-
const t =
|
|
1247
|
+
}, st = async function({ location: e }) {
|
|
1248
|
+
e.search !== s(this, Re) && (b(this, Re, e.search), s(this, xe).call(this, nt(e.search)));
|
|
1249
|
+
const t = mt(s(this, X), e.pathname);
|
|
1251
1250
|
if (!t) {
|
|
1252
|
-
s(this,
|
|
1251
|
+
s(this, ce).call(this, null), s(this, ue).call(this, e.pathname), s(this, he).call(this, {
|
|
1253
1252
|
wildcard: e.pathname
|
|
1254
1253
|
});
|
|
1255
1254
|
return;
|
|
@@ -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 = rr(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 = Ue(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
|
-
else if (s(this, M).info(`📍 navigating to '${t.path}'`), s(this,
|
|
1280
|
-
s(this,
|
|
1278
|
+
else if (s(this, M).info(`📍 navigating to '${t.path}'`), s(this, ue).call(this, t.path), s(this, he).call(this, t.params), t.pattern !== this.$pattern.get()) {
|
|
1279
|
+
s(this, ce).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, Y).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 Zt = /(noopener|noreferrer) (noopener|noreferrer)/, er = /^[\w-_]+:/;
|
|
1294
|
+
function tr(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,58 +1299,60 @@ 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" && Zt.test(o.getAttribute("rel")) || er.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 rr(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, Oe, G, ee, Ne, Me, Te, De, _e, Ae, R, B;
|
|
1316
|
+
class nr {
|
|
1318
1317
|
constructor() {
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
f(this,
|
|
1324
|
-
f(this,
|
|
1325
|
-
f(this,
|
|
1326
|
-
f(this,
|
|
1327
|
-
f(this, Ne,
|
|
1328
|
-
f(this,
|
|
1329
|
-
f(this, Me, []);
|
|
1318
|
+
S(this, "http");
|
|
1319
|
+
S(this, "i18n");
|
|
1320
|
+
S(this, "render");
|
|
1321
|
+
S(this, "router");
|
|
1322
|
+
f(this, W, !1);
|
|
1323
|
+
f(this, Oe, "production");
|
|
1324
|
+
f(this, G);
|
|
1325
|
+
f(this, ee);
|
|
1326
|
+
f(this, Ne, Ct);
|
|
1327
|
+
f(this, Me, Ye());
|
|
1330
1328
|
f(this, Te, []);
|
|
1331
|
-
f(this,
|
|
1332
|
-
f(this,
|
|
1329
|
+
f(this, De, []);
|
|
1330
|
+
f(this, _e, []);
|
|
1331
|
+
f(this, Ae, []);
|
|
1332
|
+
f(this, R, {
|
|
1333
1333
|
info: "development",
|
|
1334
1334
|
log: "development",
|
|
1335
1335
|
warn: "development",
|
|
1336
1336
|
error: !0
|
|
1337
1337
|
});
|
|
1338
|
-
f(this,
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1338
|
+
f(this, B, ht("*,-dolla/*"));
|
|
1339
|
+
S(this, "watch", s(this, Me).watch);
|
|
1340
|
+
S(this, "createState", se);
|
|
1341
|
+
S(this, "createSettableState", Ot);
|
|
1342
|
+
S(this, "toSettableState", Nt);
|
|
1343
|
+
S(this, "toState", ft);
|
|
1344
|
+
S(this, "valueOf", Mt);
|
|
1345
|
+
S(this, "derive", we);
|
|
1346
|
+
S(this, "createWatcher", Ye);
|
|
1347
|
+
S(this, "createRef", Tt);
|
|
1348
|
+
S(this, "isRef", Dt);
|
|
1348
1349
|
const e = this;
|
|
1349
|
-
this.http = new
|
|
1350
|
+
this.http = new Vt(), this.i18n = new Wt(this), this.render = new Bt(this), this.router = new Xt(this, {
|
|
1350
1351
|
get rootElement() {
|
|
1351
|
-
return s(e,
|
|
1352
|
+
return s(e, G);
|
|
1352
1353
|
},
|
|
1353
1354
|
get rootView() {
|
|
1354
|
-
return s(e,
|
|
1355
|
+
return s(e, ee);
|
|
1355
1356
|
}
|
|
1356
1357
|
});
|
|
1357
1358
|
}
|
|
@@ -1359,21 +1360,21 @@ class rr {
|
|
|
1359
1360
|
* True when the app is connected to a DOM node and displayed to the user.
|
|
1360
1361
|
*/
|
|
1361
1362
|
get isMounted() {
|
|
1362
|
-
return s(this,
|
|
1363
|
+
return s(this, W);
|
|
1363
1364
|
}
|
|
1364
1365
|
/**
|
|
1365
1366
|
* Get the current environment that this app is running in.
|
|
1366
1367
|
* Environment affects which log messages will print and how much debugging info is included in the DOM.
|
|
1367
1368
|
*/
|
|
1368
1369
|
getEnv() {
|
|
1369
|
-
return s(this,
|
|
1370
|
+
return s(this, Oe);
|
|
1370
1371
|
}
|
|
1371
1372
|
/**
|
|
1372
1373
|
* Sets the environment that this app is running in.
|
|
1373
1374
|
* Environment affects which log messages will print and how much debugging info is included in the DOM.
|
|
1374
1375
|
*/
|
|
1375
1376
|
setEnv(e) {
|
|
1376
|
-
b(this,
|
|
1377
|
+
b(this, Oe, e);
|
|
1377
1378
|
}
|
|
1378
1379
|
/**
|
|
1379
1380
|
* Sets the view that will be shown when the `crash` method is called on any logger.
|
|
@@ -1383,23 +1384,23 @@ class rr {
|
|
|
1383
1384
|
b(this, Ne, e);
|
|
1384
1385
|
}
|
|
1385
1386
|
async mount(e, t) {
|
|
1386
|
-
if (s(this,
|
|
1387
|
+
if (s(this, W))
|
|
1387
1388
|
throw new Error("Dolla is already mounted.");
|
|
1388
|
-
if (
|
|
1389
|
+
if (V(e)) {
|
|
1389
1390
|
const a = document.querySelector(e);
|
|
1390
|
-
|
|
1391
|
+
dt(HTMLElement, a, `Selector '${e}' did not match any element.`), b(this, G, a);
|
|
1391
1392
|
} else
|
|
1392
|
-
|
|
1393
|
+
dt(HTMLElement, e, "Expected an HTML element or a selector string. Got type: %t, value: %v"), b(this, G, e);
|
|
1393
1394
|
let r;
|
|
1394
|
-
t ? r =
|
|
1395
|
-
for (const a of s(this,
|
|
1395
|
+
t ? r = pt(t) : r = pt(yt), b(this, ee, this.constructView(r.type, r.props)), await Promise.all(s(this, Te).map((a) => a())), s(this, ee).mount(s(this, G)), b(this, W, !0);
|
|
1396
|
+
for (const a of s(this, De))
|
|
1396
1397
|
a();
|
|
1397
1398
|
}
|
|
1398
1399
|
async unmount() {
|
|
1399
1400
|
var e;
|
|
1400
|
-
if (s(this,
|
|
1401
|
-
await Promise.all(s(this,
|
|
1402
|
-
for (const t of s(this,
|
|
1401
|
+
if (s(this, W)) {
|
|
1402
|
+
await Promise.all(s(this, _e).map((t) => t())), (e = s(this, ee)) == null || e.unmount(), s(this, Me).stopAll(), b(this, W, !1);
|
|
1403
|
+
for (const t of s(this, Ae))
|
|
1403
1404
|
t();
|
|
1404
1405
|
}
|
|
1405
1406
|
}
|
|
@@ -1408,26 +1409,26 @@ class rr {
|
|
|
1408
1409
|
* it will be awaited before mounting finishes. Use this to perform initial setup before the app is displayed to the user.
|
|
1409
1410
|
*/
|
|
1410
1411
|
beforeMount(e) {
|
|
1411
|
-
s(this,
|
|
1412
|
+
s(this, Te).push(e);
|
|
1412
1413
|
}
|
|
1413
1414
|
/**
|
|
1414
1415
|
* Registers a `callback` to run after the app is mounted.
|
|
1415
1416
|
*/
|
|
1416
1417
|
onMount(e) {
|
|
1417
|
-
s(this,
|
|
1418
|
+
s(this, De).push(e);
|
|
1418
1419
|
}
|
|
1419
1420
|
/**
|
|
1420
1421
|
* Registers a `callback` to run after `Dolla.unmount` is called, before the app is unmounted. If `callback` returns a Promise,
|
|
1421
1422
|
* it will be awaited before unmounting finishes. Use this to perform cleanup.
|
|
1422
1423
|
*/
|
|
1423
1424
|
beforeUnmount(e) {
|
|
1424
|
-
s(this,
|
|
1425
|
+
s(this, _e).push(e);
|
|
1425
1426
|
}
|
|
1426
1427
|
/**
|
|
1427
1428
|
* Registers a `callback` to run after the app is unmounted.
|
|
1428
1429
|
*/
|
|
1429
1430
|
onUnmount(e) {
|
|
1430
|
-
s(this,
|
|
1431
|
+
s(this, Ae).push(e);
|
|
1431
1432
|
}
|
|
1432
1433
|
/**
|
|
1433
1434
|
* Update log type toggles. Values that are not passed will remain unchanged.
|
|
@@ -1435,26 +1436,26 @@ class rr {
|
|
|
1435
1436
|
setLoggles(e) {
|
|
1436
1437
|
for (const t in e) {
|
|
1437
1438
|
const r = e[t];
|
|
1438
|
-
r && (s(this,
|
|
1439
|
+
r && (s(this, R)[t] = r);
|
|
1439
1440
|
}
|
|
1440
1441
|
}
|
|
1441
1442
|
setLogFilter(e) {
|
|
1442
|
-
b(this,
|
|
1443
|
+
b(this, B, ht(e));
|
|
1443
1444
|
}
|
|
1444
1445
|
createLogger(e, t) {
|
|
1445
|
-
const r =
|
|
1446
|
+
const r = ft(e), a = (t == null ? void 0 : t.console) ?? _t(), n = this;
|
|
1446
1447
|
return {
|
|
1447
1448
|
get info() {
|
|
1448
|
-
var
|
|
1449
|
+
var h;
|
|
1449
1450
|
const o = r.get();
|
|
1450
|
-
if (s(n,
|
|
1451
|
-
return
|
|
1451
|
+
if (s(n, R).info === !1 || V(s(n, R).info) && s(n, R).info !== n.getEnv() || !s(h = n, B).call(h, o))
|
|
1452
|
+
return je;
|
|
1452
1453
|
{
|
|
1453
1454
|
let l = `%c${o}`;
|
|
1454
1455
|
return t != null && t.uid ? l += ` %c[uid: %c${t.uid}%c]` : l += "%c%c%c", a.info.bind(
|
|
1455
1456
|
a,
|
|
1456
1457
|
l,
|
|
1457
|
-
`color:${
|
|
1458
|
+
`color:${Fe(l)};font-weight:bold`,
|
|
1458
1459
|
"color:#777",
|
|
1459
1460
|
"color:#aaa",
|
|
1460
1461
|
"color:#777"
|
|
@@ -1462,16 +1463,16 @@ class rr {
|
|
|
1462
1463
|
}
|
|
1463
1464
|
},
|
|
1464
1465
|
get log() {
|
|
1465
|
-
var
|
|
1466
|
+
var h;
|
|
1466
1467
|
const o = r.get();
|
|
1467
|
-
if (s(n,
|
|
1468
|
-
return
|
|
1468
|
+
if (s(n, R).log === !1 || V(s(n, R).log) && s(n, R).log !== n.getEnv() || !s(h = n, B).call(h, o))
|
|
1469
|
+
return je;
|
|
1469
1470
|
{
|
|
1470
1471
|
let l = `%c${o}`;
|
|
1471
1472
|
return t != null && t.uid ? l += ` %c[uid: %c${t.uid}%c]` : l += "%c%c%c", a.log.bind(
|
|
1472
1473
|
a,
|
|
1473
1474
|
l,
|
|
1474
|
-
`color:${
|
|
1475
|
+
`color:${Fe(l)};font-weight:bold`,
|
|
1475
1476
|
"color:#777",
|
|
1476
1477
|
"color:#aaa",
|
|
1477
1478
|
"color:#777"
|
|
@@ -1479,16 +1480,16 @@ class rr {
|
|
|
1479
1480
|
}
|
|
1480
1481
|
},
|
|
1481
1482
|
get warn() {
|
|
1482
|
-
var
|
|
1483
|
+
var h;
|
|
1483
1484
|
const o = r.get();
|
|
1484
|
-
if (s(n,
|
|
1485
|
-
return
|
|
1485
|
+
if (s(n, R).warn === !1 || V(s(n, R).warn) && s(n, R).warn !== n.getEnv() || !s(h = n, B).call(h, o))
|
|
1486
|
+
return je;
|
|
1486
1487
|
{
|
|
1487
1488
|
let l = `%c${o}`;
|
|
1488
1489
|
return t != null && t.uid ? l += ` %c[uid: %c${t.uid}%c]` : l += "%c%c%c", a.warn.bind(
|
|
1489
1490
|
a,
|
|
1490
1491
|
l,
|
|
1491
|
-
`color:${
|
|
1492
|
+
`color:${Fe(l)};font-weight:bold`,
|
|
1492
1493
|
"color:#777",
|
|
1493
1494
|
"color:#aaa",
|
|
1494
1495
|
"color:#777"
|
|
@@ -1496,16 +1497,16 @@ class rr {
|
|
|
1496
1497
|
}
|
|
1497
1498
|
},
|
|
1498
1499
|
get error() {
|
|
1499
|
-
var
|
|
1500
|
+
var h;
|
|
1500
1501
|
const o = r.get();
|
|
1501
|
-
if (s(n,
|
|
1502
|
-
return
|
|
1502
|
+
if (s(n, R).error === !1 || V(s(n, R).error) && s(n, R).error !== n.getEnv() || !s(h = n, B).call(h, o))
|
|
1503
|
+
return je;
|
|
1503
1504
|
{
|
|
1504
1505
|
let l = `%c${o}`;
|
|
1505
1506
|
return t != null && t.uid ? l += ` %c[uid: %c${t.uid}%c]` : l += "%c%c%c", a.error.bind(
|
|
1506
1507
|
a,
|
|
1507
1508
|
l,
|
|
1508
|
-
`color:${
|
|
1509
|
+
`color:${Fe(l)};font-weight:bold`,
|
|
1509
1510
|
"color:#777",
|
|
1510
1511
|
"color:#aaa",
|
|
1511
1512
|
"color:#777"
|
|
@@ -1517,7 +1518,7 @@ class rr {
|
|
|
1517
1518
|
error: o,
|
|
1518
1519
|
loggerName: r.get(),
|
|
1519
1520
|
uid: t == null ? void 0 : t.uid
|
|
1520
|
-
}).mount(s(n,
|
|
1521
|
+
}).mount(s(n, G))), o;
|
|
1521
1522
|
}
|
|
1522
1523
|
};
|
|
1523
1524
|
}
|
|
@@ -1525,33 +1526,41 @@ class rr {
|
|
|
1525
1526
|
*
|
|
1526
1527
|
*/
|
|
1527
1528
|
constructView(e, t, r = []) {
|
|
1528
|
-
return
|
|
1529
|
+
return At({ root: this, data: {} }, e, t, r);
|
|
1529
1530
|
}
|
|
1530
1531
|
/**
|
|
1531
1532
|
*
|
|
1532
1533
|
*/
|
|
1533
1534
|
constructMarkup(e) {
|
|
1534
|
-
return
|
|
1535
|
+
return jt(Ft({ root: this, data: {} }, e));
|
|
1535
1536
|
}
|
|
1536
1537
|
}
|
|
1537
|
-
|
|
1538
|
-
const
|
|
1538
|
+
W = new WeakMap(), Oe = new WeakMap(), G = new WeakMap(), ee = new WeakMap(), Ne = new WeakMap(), Me = new WeakMap(), Te = new WeakMap(), De = new WeakMap(), _e = new WeakMap(), Ae = new WeakMap(), R = new WeakMap(), B = new WeakMap();
|
|
1539
|
+
const gt = new nr(), or = gt.i18n.t.bind(gt.i18n);
|
|
1540
|
+
function lr(i) {
|
|
1541
|
+
typeof window < "u" && (window.DOLLA_DEV_DEBUG = i);
|
|
1542
|
+
}
|
|
1543
|
+
function cr() {
|
|
1544
|
+
return typeof window < "u" ? window.DOLLA_DEV_DEBUG === !0 : !1;
|
|
1545
|
+
}
|
|
1539
1546
|
export {
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
Nt as
|
|
1547
|
+
Lt as cond,
|
|
1548
|
+
pt as createMarkup,
|
|
1549
|
+
Tt as createRef,
|
|
1550
|
+
Ot as createSettableState,
|
|
1551
|
+
fr as createSetter,
|
|
1552
|
+
se as createState,
|
|
1553
|
+
gt as default,
|
|
1554
|
+
we as derive,
|
|
1555
|
+
cr as getDevDebug,
|
|
1556
|
+
ct as html,
|
|
1557
|
+
Dt as isRef,
|
|
1558
|
+
dr as portal,
|
|
1559
|
+
pr as repeat,
|
|
1560
|
+
lr as setDevDebug,
|
|
1561
|
+
or as t,
|
|
1562
|
+
Nt as toSettableState,
|
|
1563
|
+
ft as toState,
|
|
1564
|
+
Mt as valueOf
|
|
1556
1565
|
};
|
|
1557
1566
|
//# sourceMappingURL=index.js.map
|