@manyducks.co/dolla 2.0.0-alpha.12 → 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 +595 -588
- 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 +26 -6
- 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/docs/http.md +5 -0
- package/docs/i18n.md +5 -0
- package/docs/router.md +5 -0
- package/docs/states.md +5 -0
- package/docs/views.md +5 -0
- 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,22 +1,22 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var Pt = Object.defineProperty;
|
|
2
|
+
var ot = (i) => {
|
|
3
3
|
throw TypeError(i);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var S = (i, e, t) =>
|
|
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
|
},
|
|
12
12
|
get _() {
|
|
13
|
-
return s(i, e,
|
|
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
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
f(this, T);
|
|
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,65 +76,65 @@ 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
|
|
110
|
-
...
|
|
108
|
+
Q = new WeakMap(), Be = new WeakMap(), T = new WeakSet(), j = async function(e, t, r) {
|
|
109
|
+
return Ht({
|
|
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:
|
|
126
|
+
const { status: r, statusText: a, method: n, uri: o } = t, h = `${r} ${a}: Request failed (${n.toUpperCase()} ${o})`;
|
|
127
127
|
super(h);
|
|
128
128
|
S(this, "response");
|
|
129
129
|
this.response = t;
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
async function
|
|
133
|
-
const { headers: e, query: t, fetch:
|
|
132
|
+
async function Ht(i) {
|
|
133
|
+
const { headers: e, query: t, fetch: r, middleware: a } = i, n = {
|
|
134
134
|
method: i.method,
|
|
135
135
|
uri: i.uri,
|
|
136
136
|
get sameOrigin() {
|
|
137
|
-
return !
|
|
137
|
+
return !n.uri.startsWith("http");
|
|
138
138
|
},
|
|
139
139
|
query: new URLSearchParams(),
|
|
140
140
|
headers: new Headers(),
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
168
|
const h = async () => {
|
|
169
|
-
const l =
|
|
170
|
-
let
|
|
171
|
-
!
|
|
172
|
-
const
|
|
173
|
-
method:
|
|
174
|
-
headers:
|
|
175
|
-
body:
|
|
176
|
-
}), u = Object.fromEntries(
|
|
177
|
-
let
|
|
178
|
-
y != null && y.includes("application/json") ?
|
|
179
|
-
method:
|
|
180
|
-
uri:
|
|
181
|
-
status:
|
|
182
|
-
statusText:
|
|
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
|
+
method: n.method,
|
|
174
|
+
headers: n.headers,
|
|
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
|
+
method: n.method,
|
|
180
|
+
uri: n.uri,
|
|
181
|
+
status: m.status,
|
|
182
|
+
statusText: m.statusText,
|
|
183
183
|
headers: u,
|
|
184
|
-
body:
|
|
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
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
|
-
|
|
202
|
+
f(this, te);
|
|
204
203
|
S(this, "dolla");
|
|
205
204
|
S(this, "config");
|
|
206
|
-
|
|
207
|
-
|
|
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,144 +225,144 @@ class Ht {
|
|
|
226
225
|
throw new Error("HTTP request failed.");
|
|
227
226
|
}
|
|
228
227
|
}
|
|
229
|
-
if (e
|
|
228
|
+
if (e) {
|
|
229
|
+
const t = E(this, te, Xe).call(this, e);
|
|
230
|
+
for (const r of t)
|
|
231
|
+
s(this, ie).set(r[0], r[1]);
|
|
232
|
+
} else
|
|
230
233
|
throw new Error("Language could not be loaded.");
|
|
231
|
-
{
|
|
232
|
-
const t = k(this, ne, Je).call(this, e);
|
|
233
|
-
for (const n of t)
|
|
234
|
-
s(this, le).set(n[0], n[1]);
|
|
235
|
-
console.log(t);
|
|
236
|
-
}
|
|
237
234
|
}
|
|
238
235
|
getTemplate(e) {
|
|
239
|
-
return s(this,
|
|
236
|
+
return s(this, ie).get(e) ?? {
|
|
237
|
+
segments: [{ type: 0, text: `[MISSING: ${e}]` }]
|
|
238
|
+
};
|
|
240
239
|
}
|
|
241
240
|
hasTemplate(e) {
|
|
242
|
-
return s(this,
|
|
241
|
+
return s(this, ie).has(e);
|
|
243
242
|
}
|
|
244
243
|
}
|
|
245
|
-
|
|
246
|
-
const
|
|
244
|
+
ze = new WeakMap(), ie = new WeakMap(), te = new WeakSet(), Xe = function(e, t = []) {
|
|
245
|
+
const r = [];
|
|
247
246
|
for (const a in e)
|
|
248
|
-
switch (
|
|
247
|
+
switch (ut(e[a])) {
|
|
249
248
|
case "string":
|
|
250
|
-
|
|
249
|
+
r.push([[...t, a].join("."), E(this, te, bt).call(this, e[a])]);
|
|
251
250
|
break;
|
|
252
251
|
case "object":
|
|
253
|
-
|
|
252
|
+
r.push(...E(this, te, Xe).call(this, e[a], [...t, a]));
|
|
254
253
|
break;
|
|
255
254
|
default:
|
|
256
255
|
throw new Error(
|
|
257
|
-
`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])}`
|
|
258
257
|
);
|
|
259
258
|
}
|
|
260
|
-
return
|
|
261
|
-
},
|
|
259
|
+
return r;
|
|
260
|
+
}, bt = function(e) {
|
|
262
261
|
let t;
|
|
263
262
|
((u) => {
|
|
264
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";
|
|
265
264
|
})(t || (t = {}));
|
|
266
|
-
const
|
|
265
|
+
const r = {
|
|
267
266
|
segments: []
|
|
268
267
|
};
|
|
269
|
-
let a = "",
|
|
270
|
-
const
|
|
268
|
+
let a = "", n = 0, o = 0, h, l, d;
|
|
269
|
+
const g = () => {
|
|
271
270
|
h = {
|
|
272
271
|
type: 1,
|
|
273
272
|
name: "",
|
|
274
273
|
formats: []
|
|
275
274
|
};
|
|
276
|
-
},
|
|
275
|
+
}, m = () => {
|
|
277
276
|
l = {
|
|
278
277
|
name: "",
|
|
279
278
|
options: {}
|
|
280
279
|
};
|
|
281
280
|
};
|
|
282
|
-
for (;
|
|
283
|
-
if (o !== 0 && e[
|
|
284
|
-
|
|
281
|
+
for (; n < e.length; ) {
|
|
282
|
+
if (o !== 0 && e[n] === " ") {
|
|
283
|
+
n++;
|
|
285
284
|
continue;
|
|
286
285
|
}
|
|
287
286
|
switch (o) {
|
|
288
287
|
case 0:
|
|
289
|
-
e[
|
|
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++);
|
|
290
289
|
break;
|
|
291
290
|
case 1:
|
|
292
|
-
e[
|
|
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++);
|
|
293
292
|
break;
|
|
294
293
|
case 2:
|
|
295
|
-
e[
|
|
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++);
|
|
296
295
|
break;
|
|
297
296
|
case 3:
|
|
298
|
-
e[
|
|
297
|
+
e[n] === ")" || (e[n] === ":" ? (o = 4, n += 1, d = a, a = "") : e[n] === "}" && e[n + 1] === "}" || (a += e[n], n++));
|
|
299
298
|
break;
|
|
300
299
|
case 4:
|
|
301
|
-
e[
|
|
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++);
|
|
302
301
|
break;
|
|
303
302
|
case 5:
|
|
304
|
-
e[
|
|
303
|
+
e[n] === "|" ? (o = 2, n += 1, m()) : e[n] === "}" && e[n + 1] === "}" && (o = 0, n += 2, r.segments.push(h));
|
|
305
304
|
break;
|
|
306
305
|
}
|
|
307
306
|
}
|
|
308
|
-
return o === 0 && a.length > 0 &&
|
|
307
|
+
return o === 0 && a.length > 0 && r.segments.push({ type: 0, text: a }), r;
|
|
309
308
|
};
|
|
310
|
-
var
|
|
311
|
-
class
|
|
309
|
+
var be, q, x, ve, $e, Ee, ke, O, vt, Ze, et, tt, $t;
|
|
310
|
+
class Wt {
|
|
312
311
|
constructor(e) {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
312
|
+
f(this, O);
|
|
313
|
+
f(this, be);
|
|
314
|
+
f(this, q);
|
|
315
|
+
f(this, x, /* @__PURE__ */ new Map());
|
|
316
|
+
f(this, ve, []);
|
|
317
|
+
f(this, $e, /* @__PURE__ */ new Map());
|
|
318
|
+
f(this, Ee, "auto");
|
|
320
319
|
S(this, "$locale");
|
|
321
|
-
|
|
322
|
-
b(this,
|
|
323
|
-
const [t,
|
|
324
|
-
this.$locale = t, b(this,
|
|
325
|
-
s(this,
|
|
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));
|
|
326
325
|
});
|
|
327
326
|
}
|
|
328
327
|
get locales() {
|
|
329
|
-
return [...s(this,
|
|
328
|
+
return [...s(this, x).keys()];
|
|
330
329
|
}
|
|
331
330
|
setup(e) {
|
|
332
331
|
if (e.translations.forEach((t) => {
|
|
333
|
-
s(this,
|
|
332
|
+
s(this, x).set(t.locale, new It(t, s(this, be)));
|
|
334
333
|
}), e.locale && e.locale !== "auto") {
|
|
335
|
-
if (!e.translations.some((
|
|
334
|
+
if (!e.translations.some((r) => r.locale === e.locale))
|
|
336
335
|
throw new Error(`Initial locale '${e.locale}' is not registered in the locales array.`);
|
|
337
|
-
b(this,
|
|
336
|
+
b(this, Ee, e.locale);
|
|
338
337
|
}
|
|
339
|
-
s(this,
|
|
340
|
-
`${s(this,
|
|
338
|
+
s(this, q).info(
|
|
339
|
+
`${s(this, x).size} language${s(this, x).size === 1 ? "" : "s"} supported: '${[...s(this, x).keys()].join("', '")}'`
|
|
341
340
|
);
|
|
342
341
|
}
|
|
343
342
|
async setLocale(e) {
|
|
344
343
|
var a;
|
|
345
344
|
let t;
|
|
346
345
|
if (e === "auto") {
|
|
347
|
-
let
|
|
346
|
+
let n = [];
|
|
348
347
|
if (typeof navigator == "object") {
|
|
349
348
|
const o = navigator;
|
|
350
|
-
((a = o.languages) == null ? void 0 : a.length) > 0 ?
|
|
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);
|
|
351
350
|
}
|
|
352
|
-
for (const o of
|
|
353
|
-
s(this,
|
|
351
|
+
for (const o of n)
|
|
352
|
+
s(this, x).has(o) && (t = o);
|
|
354
353
|
} else
|
|
355
|
-
s(this,
|
|
354
|
+
s(this, x).has(e) && (t = e);
|
|
356
355
|
if (t == null) {
|
|
357
|
-
const
|
|
358
|
-
|
|
356
|
+
const n = s(this, x).keys().next().value;
|
|
357
|
+
n && (t = n);
|
|
359
358
|
}
|
|
360
|
-
if (!t || !s(this,
|
|
361
|
-
throw new Error(`
|
|
362
|
-
const
|
|
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);
|
|
363
362
|
try {
|
|
364
|
-
await
|
|
365
|
-
} catch (
|
|
366
|
-
|
|
363
|
+
await r.load(), b(this, ve, []), s(this, ke).call(this, t), s(this, q).info("set language to " + t);
|
|
364
|
+
} catch (n) {
|
|
365
|
+
n instanceof Error && s(this, q).crash(n);
|
|
367
366
|
}
|
|
368
367
|
}
|
|
369
368
|
/**
|
|
@@ -380,32 +379,34 @@ class It {
|
|
|
380
379
|
throw new Error(
|
|
381
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"'`
|
|
382
381
|
);
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
n
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
382
|
+
let r = [], a = [];
|
|
383
|
+
for (const n in t)
|
|
384
|
+
r.push(n), a.push(t[n]);
|
|
385
|
+
return we([this.$locale, ...a], (n, ...o) => {
|
|
386
|
+
if (n == null)
|
|
387
|
+
return "[NO LOCALE SET]";
|
|
388
|
+
const h = {};
|
|
389
|
+
for (let l = 0; l < o.length; l++)
|
|
390
|
+
h[r[l]] = o[l];
|
|
391
|
+
return E(this, O, vt).call(this, n, e, h);
|
|
392
|
+
});
|
|
392
393
|
}
|
|
393
394
|
/**
|
|
394
395
|
* Add a custom format callback.
|
|
395
396
|
*
|
|
396
397
|
* @example
|
|
397
|
-
* Dolla.i18n.addFormat("
|
|
398
|
-
*
|
|
398
|
+
* Dolla.i18n.addFormat("uppercase", (locale, value, options) => {
|
|
399
|
+
* return value.toUpperCase();
|
|
399
400
|
* });
|
|
400
401
|
*
|
|
401
402
|
* {
|
|
402
|
-
* "
|
|
403
|
+
* "greeting": "Hello, {{name|uppercase}}!"
|
|
403
404
|
* }
|
|
404
405
|
*
|
|
405
|
-
* t("
|
|
406
|
+
* t("greeting", {name: "world"}); // State<"Hello, WORLD!">
|
|
406
407
|
*/
|
|
407
408
|
addFormat(e, t) {
|
|
408
|
-
s(this,
|
|
409
|
+
s(this, $e).set(e, t);
|
|
409
410
|
}
|
|
410
411
|
/**
|
|
411
412
|
* Creates an `Intl.Collator` configured for the current locale.
|
|
@@ -422,7 +423,7 @@ class It {
|
|
|
422
423
|
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options
|
|
423
424
|
*/
|
|
424
425
|
number(e, t) {
|
|
425
|
-
return
|
|
426
|
+
return we([this.$locale, e], (r, a) => E(this, O, Ze).call(this, a, t));
|
|
426
427
|
}
|
|
427
428
|
/**
|
|
428
429
|
* Returns a State containing the date formatted for the current locale. Uses `Intl.DateTimeFormat` under the hood.
|
|
@@ -434,7 +435,7 @@ class It {
|
|
|
434
435
|
* const $formatted = Dolla.i18n.dateTime(date, { dateFormat: "short" });
|
|
435
436
|
*/
|
|
436
437
|
dateTime(e, t) {
|
|
437
|
-
return
|
|
438
|
+
return we([this.$locale, e], (r, a) => E(this, O, et).call(this, a, t));
|
|
438
439
|
}
|
|
439
440
|
/**
|
|
440
441
|
* Returns a State containing the date formatted for the current locale. Uses `Intl.DateTimeFormat` under the hood.
|
|
@@ -446,87 +447,83 @@ class It {
|
|
|
446
447
|
* const $formatted = Dolla.i18n.list(list, { });
|
|
447
448
|
*/
|
|
448
449
|
list(e, t) {
|
|
449
|
-
return
|
|
450
|
+
return we([this.$locale, e], (r, a) => E(this, O, tt).call(this, a, t));
|
|
450
451
|
}
|
|
451
452
|
}
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
const
|
|
457
|
-
if (o) return o;
|
|
458
|
-
const h = s(this, L).get(e);
|
|
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);
|
|
456
|
+
if (a) return a;
|
|
457
|
+
const n = s(this, x).get(e);
|
|
459
458
|
if (r.context != null && (t += "_" + r.context), r.count != null)
|
|
460
459
|
if (r.ordinal) {
|
|
461
|
-
const
|
|
462
|
-
|
|
460
|
+
const d = `${t}_ordinal_(=${r.count})`;
|
|
461
|
+
n.hasTemplate(d) ? t = d : t += "_ordinal_" + new Intl.PluralRules(e, { type: "ordinal" }).select(r.count);
|
|
463
462
|
} else {
|
|
464
|
-
const
|
|
465
|
-
|
|
463
|
+
const d = `${t}_(=${r.count})`;
|
|
464
|
+
n.hasTemplate(d) ? t = d : t += "_" + new Intl.PluralRules(e).select(r.count);
|
|
466
465
|
}
|
|
467
|
-
const
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
if (
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
const V = new Error(
|
|
482
|
-
`Failed to load format '${y.name}' when processing '${t}', template: ${l}`
|
|
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}`
|
|
483
480
|
);
|
|
484
|
-
throw s(this,
|
|
481
|
+
throw s(this, q).crash(k), k;
|
|
485
482
|
}
|
|
486
|
-
|
|
483
|
+
g = y(e, g, u.options);
|
|
487
484
|
}
|
|
488
|
-
|
|
485
|
+
h += g;
|
|
489
486
|
}
|
|
490
|
-
return
|
|
491
|
-
},
|
|
487
|
+
return h;
|
|
488
|
+
}, Ze = function(e, t) {
|
|
492
489
|
return new Intl.NumberFormat(this.$locale.get(), t).format(e);
|
|
493
|
-
},
|
|
490
|
+
}, et = function(e, t) {
|
|
494
491
|
return new Intl.DateTimeFormat(this.$locale.get(), t).format(
|
|
495
492
|
typeof e == "string" ? new Date(e) : e
|
|
496
493
|
);
|
|
497
|
-
},
|
|
494
|
+
}, tt = function(e, t) {
|
|
498
495
|
return new Intl.ListFormat(this.$locale.get(), t).format(e);
|
|
499
496
|
}, // relativeTime(): State<string> {
|
|
500
497
|
// }
|
|
501
|
-
|
|
502
|
-
for (const
|
|
503
|
-
if (
|
|
504
|
-
return
|
|
498
|
+
$t = function(e, t) {
|
|
499
|
+
for (const r of s(this, ve))
|
|
500
|
+
if (r[0] === e && Rt(r[1], t))
|
|
501
|
+
return r[2];
|
|
505
502
|
};
|
|
506
503
|
function Gt(i, e) {
|
|
507
504
|
const t = String(e).split(/[\.\[\]]/).filter((a) => a.trim() !== "");
|
|
508
|
-
let
|
|
505
|
+
let r = i;
|
|
509
506
|
for (; t.length > 0; ) {
|
|
510
507
|
const a = t.shift();
|
|
511
|
-
|
|
508
|
+
r != null ? r = r[a] : r = void 0;
|
|
512
509
|
}
|
|
513
|
-
return
|
|
510
|
+
return r;
|
|
514
511
|
}
|
|
515
|
-
var
|
|
516
|
-
class
|
|
512
|
+
var J, Pe, U, H, oe, F, le, Ce;
|
|
513
|
+
class Bt {
|
|
517
514
|
constructor(e) {
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
515
|
+
f(this, le);
|
|
516
|
+
f(this, J);
|
|
517
|
+
f(this, Pe);
|
|
521
518
|
// Keyed updates ensure only the most recent callback queued with a certain key
|
|
522
519
|
// will be called, keeping DOM operations to a minimum.
|
|
523
|
-
|
|
520
|
+
f(this, U, /* @__PURE__ */ new Map());
|
|
524
521
|
// All unkeyed updates are run on every batch.
|
|
525
|
-
|
|
522
|
+
f(this, H, []);
|
|
526
523
|
// All read callbacks are run before updates on every batch.
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
b(this,
|
|
524
|
+
f(this, oe, []);
|
|
525
|
+
f(this, F, !1);
|
|
526
|
+
b(this, J, e), b(this, Pe, e.createLogger("dolla/render"));
|
|
530
527
|
}
|
|
531
528
|
/**
|
|
532
529
|
* Queues a callback to run in the next render batch.
|
|
@@ -534,12 +531,12 @@ class Wt {
|
|
|
534
531
|
* Returns a Promise that resolves once the callback has run.
|
|
535
532
|
*/
|
|
536
533
|
update(e, t) {
|
|
537
|
-
return new Promise((
|
|
538
|
-
t ? s(this,
|
|
539
|
-
e(),
|
|
540
|
-
}) : s(this,
|
|
541
|
-
e(),
|
|
542
|
-
}), !s(this,
|
|
534
|
+
return new Promise((r) => {
|
|
535
|
+
t ? s(this, U).set(t, () => {
|
|
536
|
+
e(), r();
|
|
537
|
+
}) : s(this, H).push(() => {
|
|
538
|
+
e(), r();
|
|
539
|
+
}), !s(this, F) && s(this, J).isMounted && (b(this, F, !0), E(this, le, Ce).call(this));
|
|
543
540
|
});
|
|
544
541
|
}
|
|
545
542
|
/**
|
|
@@ -549,49 +546,49 @@ class Wt {
|
|
|
549
546
|
*/
|
|
550
547
|
read(e) {
|
|
551
548
|
return new Promise((t) => {
|
|
552
|
-
s(this,
|
|
549
|
+
s(this, oe).push(() => {
|
|
553
550
|
e(), t();
|
|
554
|
-
}), !s(this,
|
|
551
|
+
}), !s(this, F) && s(this, J).isMounted && (b(this, F, !0), E(this, le, Ce).call(this));
|
|
555
552
|
});
|
|
556
553
|
}
|
|
557
554
|
}
|
|
558
|
-
|
|
559
|
-
const e = s(this,
|
|
560
|
-
if ((!s(this,
|
|
561
|
-
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))
|
|
562
559
|
t();
|
|
563
|
-
b(this,
|
|
560
|
+
b(this, oe, []);
|
|
564
561
|
return;
|
|
565
562
|
}
|
|
566
563
|
requestAnimationFrame(() => {
|
|
567
|
-
s(this, Pe).info(`Batching ${s(this,
|
|
568
|
-
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())
|
|
569
566
|
t();
|
|
570
|
-
s(this,
|
|
571
|
-
for (const t of s(this,
|
|
567
|
+
s(this, U).clear();
|
|
568
|
+
for (const t of s(this, H))
|
|
572
569
|
t();
|
|
573
|
-
b(this,
|
|
570
|
+
b(this, H, []), E(this, le, Ce).call(this);
|
|
574
571
|
});
|
|
575
572
|
};
|
|
576
|
-
function
|
|
577
|
-
return
|
|
573
|
+
function fe() {
|
|
574
|
+
return fe = Object.assign ? Object.assign.bind() : function(i) {
|
|
578
575
|
for (var e = 1; e < arguments.length; e++) {
|
|
579
576
|
var t = arguments[e];
|
|
580
|
-
for (var
|
|
577
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (i[r] = t[r]);
|
|
581
578
|
}
|
|
582
579
|
return i;
|
|
583
|
-
},
|
|
580
|
+
}, fe.apply(null, arguments);
|
|
584
581
|
}
|
|
585
|
-
var
|
|
582
|
+
var _;
|
|
586
583
|
(function(i) {
|
|
587
584
|
i.Pop = "POP", i.Push = "PUSH", i.Replace = "REPLACE";
|
|
588
|
-
})(
|
|
589
|
-
var
|
|
585
|
+
})(_ || (_ = {}));
|
|
586
|
+
var He = process.env.NODE_ENV !== "production" ? function(i) {
|
|
590
587
|
return Object.freeze(i);
|
|
591
588
|
} : function(i) {
|
|
592
589
|
return i;
|
|
593
590
|
};
|
|
594
|
-
function
|
|
591
|
+
function Ve(i, e) {
|
|
595
592
|
if (!i) {
|
|
596
593
|
typeof console < "u" && console.warn(e);
|
|
597
594
|
try {
|
|
@@ -600,13 +597,13 @@ function Ce(i, e) {
|
|
|
600
597
|
}
|
|
601
598
|
}
|
|
602
599
|
}
|
|
603
|
-
var
|
|
604
|
-
function
|
|
600
|
+
var Ie = "beforeunload", zt = "hashchange", Et = "popstate";
|
|
601
|
+
function Kt(i) {
|
|
605
602
|
i === void 0 && (i = {});
|
|
606
|
-
var e = i, t = e.window,
|
|
607
|
-
function
|
|
608
|
-
var w =
|
|
609
|
-
return [$.idx,
|
|
603
|
+
var e = i, t = e.window, r = t === void 0 ? document.defaultView : t, a = r.history;
|
|
604
|
+
function n() {
|
|
605
|
+
var w = r.location, c = w.pathname, p = w.search, v = w.hash, $ = a.state || {};
|
|
606
|
+
return [$.idx, He({
|
|
610
607
|
pathname: c,
|
|
611
608
|
search: p,
|
|
612
609
|
hash: v,
|
|
@@ -619,19 +616,19 @@ function Bt(i) {
|
|
|
619
616
|
if (o)
|
|
620
617
|
y.call(o), o = null;
|
|
621
618
|
else {
|
|
622
|
-
var w =
|
|
619
|
+
var w = _.Pop, c = n(), p = c[0], v = c[1];
|
|
623
620
|
if (y.length)
|
|
624
621
|
if (p != null) {
|
|
625
|
-
var $ =
|
|
622
|
+
var $ = g - p;
|
|
626
623
|
$ && (o = {
|
|
627
624
|
action: w,
|
|
628
625
|
location: v,
|
|
629
626
|
retry: function() {
|
|
630
|
-
|
|
627
|
+
C($ * -1);
|
|
631
628
|
}
|
|
632
|
-
},
|
|
629
|
+
}, C($));
|
|
633
630
|
} else
|
|
634
|
-
process.env.NODE_ENV !== "production" &&
|
|
631
|
+
process.env.NODE_ENV !== "production" && Ve(
|
|
635
632
|
!1,
|
|
636
633
|
// TODO: Write up a doc that explains our blocking strategy in
|
|
637
634
|
// detail and link to it here so people can understand better what
|
|
@@ -639,33 +636,33 @@ function Bt(i) {
|
|
|
639
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."
|
|
640
637
|
);
|
|
641
638
|
else
|
|
642
|
-
|
|
639
|
+
re(w);
|
|
643
640
|
}
|
|
644
641
|
}
|
|
645
|
-
|
|
646
|
-
var l =
|
|
647
|
-
|
|
648
|
-
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
|
|
649
646
|
}), ""));
|
|
650
|
-
function
|
|
651
|
-
return typeof w == "string" ? w :
|
|
647
|
+
function k(w) {
|
|
648
|
+
return typeof w == "string" ? w : qe(w);
|
|
652
649
|
}
|
|
653
|
-
function
|
|
654
|
-
return c === void 0 && (c = null),
|
|
655
|
-
pathname:
|
|
650
|
+
function de(w, c) {
|
|
651
|
+
return c === void 0 && (c = null), He(fe({
|
|
652
|
+
pathname: m.pathname,
|
|
656
653
|
hash: "",
|
|
657
654
|
search: ""
|
|
658
|
-
}, typeof w == "string" ?
|
|
655
|
+
}, typeof w == "string" ? rt(w) : w, {
|
|
659
656
|
state: c,
|
|
660
|
-
key:
|
|
657
|
+
key: kt()
|
|
661
658
|
}));
|
|
662
659
|
}
|
|
663
|
-
function
|
|
660
|
+
function pe(w, c) {
|
|
664
661
|
return [{
|
|
665
662
|
usr: w.state,
|
|
666
663
|
key: w.key,
|
|
667
664
|
idx: c
|
|
668
|
-
},
|
|
665
|
+
}, k(w)];
|
|
669
666
|
}
|
|
670
667
|
function me(w, c, p) {
|
|
671
668
|
return !y.length || (y.call({
|
|
@@ -674,82 +671,82 @@ function Bt(i) {
|
|
|
674
671
|
retry: p
|
|
675
672
|
}), !1);
|
|
676
673
|
}
|
|
677
|
-
function
|
|
674
|
+
function re(w) {
|
|
678
675
|
l = w;
|
|
679
|
-
var c =
|
|
680
|
-
|
|
676
|
+
var c = n();
|
|
677
|
+
g = c[0], m = c[1], u.call({
|
|
681
678
|
action: l,
|
|
682
|
-
location:
|
|
679
|
+
location: m
|
|
683
680
|
});
|
|
684
681
|
}
|
|
685
|
-
function
|
|
686
|
-
var p =
|
|
682
|
+
function ne(w, c) {
|
|
683
|
+
var p = _.Push, v = de(w, c);
|
|
687
684
|
function $() {
|
|
688
|
-
|
|
685
|
+
ne(w, c);
|
|
689
686
|
}
|
|
690
687
|
if (me(p, v, $)) {
|
|
691
|
-
var
|
|
688
|
+
var L = pe(v, g + 1), N = L[0], D = L[1];
|
|
692
689
|
try {
|
|
693
|
-
a.pushState(
|
|
690
|
+
a.pushState(N, "", D);
|
|
694
691
|
} catch {
|
|
695
|
-
|
|
692
|
+
r.location.assign(D);
|
|
696
693
|
}
|
|
697
|
-
|
|
694
|
+
re(p);
|
|
698
695
|
}
|
|
699
696
|
}
|
|
700
|
-
function
|
|
701
|
-
var p =
|
|
697
|
+
function ge(w, c) {
|
|
698
|
+
var p = _.Replace, v = de(w, c);
|
|
702
699
|
function $() {
|
|
703
|
-
|
|
700
|
+
ge(w, c);
|
|
704
701
|
}
|
|
705
702
|
if (me(p, v, $)) {
|
|
706
|
-
var
|
|
707
|
-
a.replaceState(
|
|
703
|
+
var L = pe(v, g), N = L[0], D = L[1];
|
|
704
|
+
a.replaceState(N, "", D), re(p);
|
|
708
705
|
}
|
|
709
706
|
}
|
|
710
|
-
function
|
|
707
|
+
function C(w) {
|
|
711
708
|
a.go(w);
|
|
712
709
|
}
|
|
713
|
-
var
|
|
710
|
+
var K = {
|
|
714
711
|
get action() {
|
|
715
712
|
return l;
|
|
716
713
|
},
|
|
717
714
|
get location() {
|
|
718
|
-
return
|
|
715
|
+
return m;
|
|
719
716
|
},
|
|
720
|
-
createHref:
|
|
721
|
-
push:
|
|
722
|
-
replace:
|
|
723
|
-
go:
|
|
717
|
+
createHref: k,
|
|
718
|
+
push: ne,
|
|
719
|
+
replace: ge,
|
|
720
|
+
go: C,
|
|
724
721
|
back: function() {
|
|
725
|
-
|
|
722
|
+
C(-1);
|
|
726
723
|
},
|
|
727
724
|
forward: function() {
|
|
728
|
-
|
|
725
|
+
C(1);
|
|
729
726
|
},
|
|
730
727
|
listen: function(c) {
|
|
731
728
|
return u.push(c);
|
|
732
729
|
},
|
|
733
730
|
block: function(c) {
|
|
734
731
|
var p = y.push(c);
|
|
735
|
-
return y.length === 1 &&
|
|
736
|
-
p(), y.length ||
|
|
732
|
+
return y.length === 1 && r.addEventListener(Ie, We), function() {
|
|
733
|
+
p(), y.length || r.removeEventListener(Ie, We);
|
|
737
734
|
};
|
|
738
735
|
}
|
|
739
736
|
};
|
|
740
|
-
return
|
|
737
|
+
return K;
|
|
741
738
|
}
|
|
742
|
-
function
|
|
739
|
+
function Qt(i) {
|
|
743
740
|
i === void 0 && (i = {});
|
|
744
|
-
var e = i, t = e.window,
|
|
745
|
-
function
|
|
746
|
-
var c =
|
|
747
|
-
return [
|
|
741
|
+
var e = i, t = e.window, r = t === void 0 ? document.defaultView : t, a = r.history;
|
|
742
|
+
function n() {
|
|
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({
|
|
748
745
|
pathname: v,
|
|
749
|
-
search:
|
|
750
|
-
hash:
|
|
751
|
-
state:
|
|
752
|
-
key:
|
|
746
|
+
search: L,
|
|
747
|
+
hash: D,
|
|
748
|
+
state: A.usr || null,
|
|
749
|
+
key: A.key || "default"
|
|
753
750
|
})];
|
|
754
751
|
}
|
|
755
752
|
var o = null;
|
|
@@ -757,19 +754,19 @@ function Kt(i) {
|
|
|
757
754
|
if (o)
|
|
758
755
|
y.call(o), o = null;
|
|
759
756
|
else {
|
|
760
|
-
var c =
|
|
757
|
+
var c = _.Pop, p = n(), v = p[0], $ = p[1];
|
|
761
758
|
if (y.length)
|
|
762
759
|
if (v != null) {
|
|
763
|
-
var
|
|
764
|
-
|
|
760
|
+
var L = g - v;
|
|
761
|
+
L && (o = {
|
|
765
762
|
action: c,
|
|
766
763
|
location: $,
|
|
767
764
|
retry: function() {
|
|
768
|
-
|
|
765
|
+
K(L * -1);
|
|
769
766
|
}
|
|
770
|
-
},
|
|
767
|
+
}, K(L));
|
|
771
768
|
} else
|
|
772
|
-
process.env.NODE_ENV !== "production" &&
|
|
769
|
+
process.env.NODE_ENV !== "production" && Ve(
|
|
773
770
|
!1,
|
|
774
771
|
// TODO: Write up a doc that explains our blocking strategy in
|
|
775
772
|
// detail and link to it here so people can understand better
|
|
@@ -777,36 +774,36 @@ function Kt(i) {
|
|
|
777
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."
|
|
778
775
|
);
|
|
779
776
|
else
|
|
780
|
-
|
|
777
|
+
ne(c);
|
|
781
778
|
}
|
|
782
779
|
}
|
|
783
|
-
|
|
784
|
-
var c =
|
|
785
|
-
|
|
780
|
+
r.addEventListener(Et, h), r.addEventListener(zt, function() {
|
|
781
|
+
var c = n(), p = c[1];
|
|
782
|
+
qe(p) !== qe(m) && h();
|
|
786
783
|
});
|
|
787
|
-
var l =
|
|
788
|
-
|
|
789
|
-
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
|
|
790
787
|
}), ""));
|
|
791
|
-
function
|
|
788
|
+
function k() {
|
|
792
789
|
var c = document.querySelector("base"), p = "";
|
|
793
790
|
if (c && c.getAttribute("href")) {
|
|
794
|
-
var v =
|
|
791
|
+
var v = r.location.href, $ = v.indexOf("#");
|
|
795
792
|
p = $ === -1 ? v : v.slice(0, $);
|
|
796
793
|
}
|
|
797
794
|
return p;
|
|
798
795
|
}
|
|
799
|
-
function
|
|
800
|
-
return
|
|
796
|
+
function de(c) {
|
|
797
|
+
return k() + "#" + (typeof c == "string" ? c : qe(c));
|
|
801
798
|
}
|
|
802
|
-
function
|
|
803
|
-
return p === void 0 && (p = null),
|
|
804
|
-
pathname:
|
|
799
|
+
function pe(c, p) {
|
|
800
|
+
return p === void 0 && (p = null), He(fe({
|
|
801
|
+
pathname: m.pathname,
|
|
805
802
|
hash: "",
|
|
806
803
|
search: ""
|
|
807
|
-
}, typeof c == "string" ?
|
|
804
|
+
}, typeof c == "string" ? rt(c) : c, {
|
|
808
805
|
state: p,
|
|
809
|
-
key:
|
|
806
|
+
key: kt()
|
|
810
807
|
}));
|
|
811
808
|
}
|
|
812
809
|
function me(c, p) {
|
|
@@ -814,49 +811,49 @@ function Kt(i) {
|
|
|
814
811
|
usr: c.state,
|
|
815
812
|
key: c.key,
|
|
816
813
|
idx: p
|
|
817
|
-
},
|
|
814
|
+
}, de(c)];
|
|
818
815
|
}
|
|
819
|
-
function
|
|
816
|
+
function re(c, p, v) {
|
|
820
817
|
return !y.length || (y.call({
|
|
821
818
|
action: c,
|
|
822
819
|
location: p,
|
|
823
820
|
retry: v
|
|
824
821
|
}), !1);
|
|
825
822
|
}
|
|
826
|
-
function
|
|
823
|
+
function ne(c) {
|
|
827
824
|
l = c;
|
|
828
|
-
var p =
|
|
829
|
-
|
|
825
|
+
var p = n();
|
|
826
|
+
g = p[0], m = p[1], u.call({
|
|
830
827
|
action: l,
|
|
831
|
-
location:
|
|
828
|
+
location: m
|
|
832
829
|
});
|
|
833
830
|
}
|
|
834
|
-
function
|
|
835
|
-
var v =
|
|
836
|
-
function
|
|
837
|
-
|
|
831
|
+
function ge(c, p) {
|
|
832
|
+
var v = _.Push, $ = pe(c, p);
|
|
833
|
+
function L() {
|
|
834
|
+
ge(c, p);
|
|
838
835
|
}
|
|
839
|
-
if (process.env.NODE_ENV !== "production" &&
|
|
840
|
-
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];
|
|
841
838
|
try {
|
|
842
|
-
a.pushState(
|
|
839
|
+
a.pushState(D, "", A);
|
|
843
840
|
} catch {
|
|
844
|
-
|
|
841
|
+
r.location.assign(A);
|
|
845
842
|
}
|
|
846
|
-
|
|
843
|
+
ne(v);
|
|
847
844
|
}
|
|
848
845
|
}
|
|
849
|
-
function
|
|
850
|
-
var v =
|
|
851
|
-
function
|
|
852
|
-
|
|
846
|
+
function C(c, p) {
|
|
847
|
+
var v = _.Replace, $ = pe(c, p);
|
|
848
|
+
function L() {
|
|
849
|
+
C(c, p);
|
|
853
850
|
}
|
|
854
|
-
if (process.env.NODE_ENV !== "production" &&
|
|
855
|
-
var
|
|
856
|
-
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);
|
|
857
854
|
}
|
|
858
855
|
}
|
|
859
|
-
function
|
|
856
|
+
function K(c) {
|
|
860
857
|
a.go(c);
|
|
861
858
|
}
|
|
862
859
|
var w = {
|
|
@@ -864,34 +861,34 @@ function Kt(i) {
|
|
|
864
861
|
return l;
|
|
865
862
|
},
|
|
866
863
|
get location() {
|
|
867
|
-
return
|
|
864
|
+
return m;
|
|
868
865
|
},
|
|
869
|
-
createHref:
|
|
870
|
-
push:
|
|
871
|
-
replace:
|
|
872
|
-
go:
|
|
866
|
+
createHref: de,
|
|
867
|
+
push: ge,
|
|
868
|
+
replace: C,
|
|
869
|
+
go: K,
|
|
873
870
|
back: function() {
|
|
874
|
-
|
|
871
|
+
K(-1);
|
|
875
872
|
},
|
|
876
873
|
forward: function() {
|
|
877
|
-
|
|
874
|
+
K(1);
|
|
878
875
|
},
|
|
879
876
|
listen: function(p) {
|
|
880
877
|
return u.push(p);
|
|
881
878
|
},
|
|
882
879
|
block: function(p) {
|
|
883
880
|
var v = y.push(p);
|
|
884
|
-
return y.length === 1 &&
|
|
885
|
-
v(), y.length ||
|
|
881
|
+
return y.length === 1 && r.addEventListener(Ie, We), function() {
|
|
882
|
+
v(), y.length || r.removeEventListener(Ie, We);
|
|
886
883
|
};
|
|
887
884
|
}
|
|
888
885
|
};
|
|
889
886
|
return w;
|
|
890
887
|
}
|
|
891
|
-
function
|
|
888
|
+
function We(i) {
|
|
892
889
|
i.preventDefault(), i.returnValue = "";
|
|
893
890
|
}
|
|
894
|
-
function
|
|
891
|
+
function Ge() {
|
|
895
892
|
var i = [];
|
|
896
893
|
return {
|
|
897
894
|
get length() {
|
|
@@ -899,127 +896,127 @@ function Ie() {
|
|
|
899
896
|
},
|
|
900
897
|
push: function(t) {
|
|
901
898
|
return i.push(t), function() {
|
|
902
|
-
i = i.filter(function(
|
|
903
|
-
return
|
|
899
|
+
i = i.filter(function(r) {
|
|
900
|
+
return r !== t;
|
|
904
901
|
});
|
|
905
902
|
};
|
|
906
903
|
},
|
|
907
904
|
call: function(t) {
|
|
908
|
-
i.forEach(function(
|
|
909
|
-
return
|
|
905
|
+
i.forEach(function(r) {
|
|
906
|
+
return r && r(t);
|
|
910
907
|
});
|
|
911
908
|
}
|
|
912
909
|
};
|
|
913
910
|
}
|
|
914
|
-
function
|
|
911
|
+
function kt() {
|
|
915
912
|
return Math.random().toString(36).substr(2, 8);
|
|
916
913
|
}
|
|
917
|
-
function
|
|
918
|
-
var e = i.pathname, t = e === void 0 ? "/" : e,
|
|
914
|
+
function qe(i) {
|
|
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;
|
|
919
916
|
return a && a !== "?" && (t += a.charAt(0) === "?" ? a : "?" + a), o && o !== "#" && (t += o.charAt(0) === "#" ? o : "#" + o), t;
|
|
920
917
|
}
|
|
921
|
-
function
|
|
918
|
+
function rt(i) {
|
|
922
919
|
var e = {};
|
|
923
920
|
if (i) {
|
|
924
921
|
var t = i.indexOf("#");
|
|
925
922
|
t >= 0 && (e.hash = i.substr(t), i = i.substr(0, t));
|
|
926
|
-
var
|
|
927
|
-
|
|
923
|
+
var r = i.indexOf("?");
|
|
924
|
+
r >= 0 && (e.search = i.substr(r), i = i.substr(0, r)), i && (e.pathname = i);
|
|
928
925
|
}
|
|
929
926
|
return e;
|
|
930
927
|
}
|
|
931
|
-
function
|
|
932
|
-
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 !== "");
|
|
933
930
|
}
|
|
934
|
-
function
|
|
931
|
+
function ae(i) {
|
|
935
932
|
var t;
|
|
936
|
-
|
|
937
|
-
(
|
|
933
|
+
xt(
|
|
934
|
+
(r) => it(r == null ? void 0 : r.toString),
|
|
938
935
|
i,
|
|
939
936
|
"Expected `parts` to be an array of objects with a .toString() method. Got type: %t, value: %v"
|
|
940
|
-
), i = i.filter((
|
|
937
|
+
), i = i.filter((r) => r).flatMap(String);
|
|
941
938
|
let e = (t = i.shift()) == null ? void 0 : t.toString();
|
|
942
939
|
if (e) {
|
|
943
|
-
for (const
|
|
944
|
-
|
|
940
|
+
for (const r of i.map((a) => a.toString()))
|
|
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;
|
|
945
942
|
e && e !== "/" && e.endsWith("/") && (e = e.slice(0, e.length - 1));
|
|
946
943
|
}
|
|
947
944
|
return e ?? "";
|
|
948
945
|
}
|
|
949
|
-
function
|
|
950
|
-
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("/"))
|
|
951
948
|
return e;
|
|
952
949
|
let t = i;
|
|
953
950
|
for (; ; )
|
|
954
951
|
if (e.startsWith("..")) {
|
|
955
|
-
for (let
|
|
956
|
-
if (t[
|
|
957
|
-
t = t.slice(0,
|
|
952
|
+
for (let r = t.length; r > 0; --r)
|
|
953
|
+
if (t[r] === "/" || r === 0) {
|
|
954
|
+
t = t.slice(0, r), e = e.replace(/^\.\.\/?/, "");
|
|
958
955
|
break;
|
|
959
956
|
}
|
|
960
957
|
} else if (e.startsWith("."))
|
|
961
958
|
e = e.replace(/^\.\/?/, "");
|
|
962
959
|
else
|
|
963
960
|
break;
|
|
964
|
-
return
|
|
961
|
+
return ae([t, e]);
|
|
965
962
|
}
|
|
966
|
-
function
|
|
963
|
+
function nt(i) {
|
|
967
964
|
if (!i) return {};
|
|
968
965
|
i.startsWith("?") && (i = i.slice(1));
|
|
969
966
|
const e = i.split("&").filter((t) => t.trim() !== "").map((t) => {
|
|
970
|
-
const [
|
|
971
|
-
return a.toLowerCase() === "true" ? [
|
|
967
|
+
const [r, a] = t.split("=").map((n) => n.trim());
|
|
968
|
+
return a.toLowerCase() === "true" ? [r, !0] : a.toLowerCase() === "false" ? [r, !1] : isNaN(Number(a)) ? [r, a] : [r, Number(a)];
|
|
972
969
|
});
|
|
973
970
|
return Object.fromEntries(e);
|
|
974
971
|
}
|
|
975
|
-
function
|
|
972
|
+
function mt(i, e, t = {}) {
|
|
976
973
|
var o;
|
|
977
|
-
const [
|
|
974
|
+
const [r, a] = e.split("?"), n = ye(r);
|
|
978
975
|
e: for (const h of i) {
|
|
979
976
|
const { fragments: l } = h;
|
|
980
|
-
if (!(((o = l[l.length - 1]) == null ? void 0 : o.type) === 3) && l.length !==
|
|
977
|
+
if (!(((o = l[l.length - 1]) == null ? void 0 : o.type) === 3) && l.length !== n.length || t.willMatch && !t.willMatch(h))
|
|
981
978
|
continue e;
|
|
982
|
-
const
|
|
979
|
+
const g = [];
|
|
983
980
|
t: for (let u = 0; u < l.length; u++) {
|
|
984
|
-
const y =
|
|
985
|
-
if (y == null &&
|
|
981
|
+
const y = n[u], k = l[u];
|
|
982
|
+
if (y == null && k.type !== 3)
|
|
986
983
|
continue e;
|
|
987
|
-
switch (
|
|
984
|
+
switch (k.type) {
|
|
988
985
|
case 1:
|
|
989
|
-
if (
|
|
990
|
-
|
|
986
|
+
if (k.name.toLowerCase() === y.toLowerCase()) {
|
|
987
|
+
g.push(k);
|
|
991
988
|
break;
|
|
992
989
|
} else
|
|
993
990
|
continue e;
|
|
994
991
|
case 2:
|
|
995
|
-
|
|
992
|
+
g.push({ ...k, value: y });
|
|
996
993
|
break;
|
|
997
994
|
case 3:
|
|
998
|
-
|
|
995
|
+
g.push({ ...k, value: n.slice(u).join("/") });
|
|
999
996
|
break t;
|
|
1000
997
|
case 4:
|
|
1001
998
|
if (isNaN(Number(y)))
|
|
1002
999
|
continue e;
|
|
1003
|
-
|
|
1000
|
+
g.push({ ...k, value: Number(y) });
|
|
1004
1001
|
break;
|
|
1005
1002
|
default:
|
|
1006
|
-
throw new Error(`Unknown fragment type: ${
|
|
1003
|
+
throw new Error(`Unknown fragment type: ${k.type}`);
|
|
1007
1004
|
}
|
|
1008
1005
|
}
|
|
1009
|
-
const
|
|
1010
|
-
for (const u of
|
|
1011
|
-
u.type === 2 && (
|
|
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));
|
|
1012
1009
|
return {
|
|
1013
|
-
path: "/" +
|
|
1010
|
+
path: "/" + g.map((u) => u.value).join("/"),
|
|
1014
1011
|
pattern: "/" + l.map((u) => u.type === 2 ? `{${u.name}}` : u.type === 4 ? `{#${u.name}}` : u.name).join("/"),
|
|
1015
|
-
params:
|
|
1016
|
-
query:
|
|
1012
|
+
params: m,
|
|
1013
|
+
query: nt(a),
|
|
1017
1014
|
meta: h.meta
|
|
1018
1015
|
};
|
|
1019
1016
|
}
|
|
1020
1017
|
}
|
|
1021
|
-
function
|
|
1022
|
-
const e = [], t = [],
|
|
1018
|
+
function Jt(i) {
|
|
1019
|
+
const e = [], t = [], r = [], a = [];
|
|
1023
1020
|
for (const o of i) {
|
|
1024
1021
|
const { fragments: h } = o;
|
|
1025
1022
|
h.some(
|
|
@@ -1031,17 +1028,17 @@ function Qt(i) {
|
|
|
1031
1028
|
) ? t.push(o) : h.some(
|
|
1032
1029
|
(l) => l.type === 2
|
|
1033
1030
|
/* Param */
|
|
1034
|
-
) ?
|
|
1031
|
+
) ? r.push(o) : e.push(o);
|
|
1035
1032
|
}
|
|
1036
|
-
const
|
|
1037
|
-
return e.sort(
|
|
1033
|
+
const n = (o, h) => o.fragments.length > h.fragments.length ? -1 : 1;
|
|
1034
|
+
return e.sort(n), t.sort(n), r.sort(n), a.sort(n), [...e, ...t, ...r, ...a];
|
|
1038
1035
|
}
|
|
1039
|
-
function
|
|
1040
|
-
const e =
|
|
1041
|
-
for (let
|
|
1042
|
-
const a = e[
|
|
1036
|
+
function Yt(i) {
|
|
1037
|
+
const e = ye(i), t = [];
|
|
1038
|
+
for (let r = 0; r < e.length; r++) {
|
|
1039
|
+
const a = e[r];
|
|
1043
1040
|
if (a === "*") {
|
|
1044
|
-
if (
|
|
1041
|
+
if (r !== e.length - 1)
|
|
1045
1042
|
throw new Error(`Wildcard must be at the end of a pattern. Received: ${i}`);
|
|
1046
1043
|
t.push({
|
|
1047
1044
|
type: 3,
|
|
@@ -1060,65 +1057,65 @@ function Jt(i) {
|
|
|
1060
1057
|
}
|
|
1061
1058
|
return t;
|
|
1062
1059
|
}
|
|
1063
|
-
var Se, M,
|
|
1064
|
-
class
|
|
1060
|
+
var Se, M, Y, Le, P, Ke, I, Re, X, Z, ce, ue, he, xe, z, at, st;
|
|
1061
|
+
class Xt {
|
|
1065
1062
|
constructor(e, t) {
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1063
|
+
f(this, z);
|
|
1064
|
+
f(this, Se);
|
|
1065
|
+
f(this, M);
|
|
1066
|
+
f(this, Y);
|
|
1067
|
+
f(this, Le, Ye());
|
|
1068
|
+
f(this, P);
|
|
1069
|
+
f(this, Ke, 0);
|
|
1070
|
+
f(this, I, []);
|
|
1071
|
+
f(this, Re);
|
|
1072
|
+
f(this, X, []);
|
|
1075
1073
|
// Callbacks that need to be called on unmount.
|
|
1076
|
-
|
|
1074
|
+
f(this, Z, []);
|
|
1077
1075
|
/**
|
|
1078
1076
|
* The currently matched route pattern, if any.
|
|
1079
1077
|
*/
|
|
1080
1078
|
S(this, "$pattern");
|
|
1081
|
-
|
|
1079
|
+
f(this, ce);
|
|
1082
1080
|
/**
|
|
1083
1081
|
* The current URL path.
|
|
1084
1082
|
*/
|
|
1085
1083
|
S(this, "$path");
|
|
1086
|
-
|
|
1084
|
+
f(this, ue);
|
|
1087
1085
|
/**
|
|
1088
1086
|
* The current named path params.
|
|
1089
1087
|
*/
|
|
1090
1088
|
S(this, "$params");
|
|
1091
|
-
|
|
1089
|
+
f(this, he);
|
|
1092
1090
|
/**
|
|
1093
1091
|
* The current query params. Changes to this object will be reflected in the URL.
|
|
1094
1092
|
*/
|
|
1095
1093
|
S(this, "$query");
|
|
1096
|
-
|
|
1097
|
-
b(this, Se, e), b(this, M, e.createLogger("dolla/router")), b(this,
|
|
1098
|
-
const [
|
|
1099
|
-
|
|
1094
|
+
f(this, xe);
|
|
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 ?? "")
|
|
1100
1098
|
);
|
|
1101
|
-
this.$pattern =
|
|
1102
|
-
s(this, P) != null && (s(this,
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
let u = g.getAttribute("href");
|
|
1116
|
-
s(this, M).info("Intercepted link click", g, u), /^https?:\/\/|^\//.test(u) || (u = ie([s(this, P).location.pathname, u])), s(this, P).push(u);
|
|
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);
|
|
1117
1113
|
})
|
|
1118
|
-
), 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));
|
|
1119
1115
|
}), e.onUnmount(() => {
|
|
1120
|
-
for (; s(this,
|
|
1121
|
-
s(this,
|
|
1116
|
+
for (; s(this, Z).length > 0; )
|
|
1117
|
+
s(this, Z).pop()();
|
|
1118
|
+
s(this, Le).stopAll();
|
|
1122
1119
|
});
|
|
1123
1120
|
}
|
|
1124
1121
|
setup(e) {
|
|
@@ -1128,20 +1125,20 @@ class Yt {
|
|
|
1128
1125
|
);
|
|
1129
1126
|
return;
|
|
1130
1127
|
}
|
|
1131
|
-
e.style === "hash" ? b(this, P,
|
|
1132
|
-
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) => ({
|
|
1133
1130
|
pattern: t.pattern,
|
|
1134
1131
|
meta: t.meta,
|
|
1135
|
-
fragments:
|
|
1132
|
+
fragments: Yt(t.pattern)
|
|
1136
1133
|
}))
|
|
1137
1134
|
));
|
|
1138
|
-
for (const t of s(this,
|
|
1135
|
+
for (const t of s(this, X))
|
|
1139
1136
|
if (t.meta.redirect) {
|
|
1140
|
-
let
|
|
1141
|
-
if (!
|
|
1142
|
-
if (
|
|
1143
|
-
willMatch(
|
|
1144
|
-
return
|
|
1137
|
+
let r;
|
|
1138
|
+
if (!it(t.meta.redirect)) if (V(t.meta.redirect)) {
|
|
1139
|
+
if (r = t.meta.redirect, !mt(s(this, X), r, {
|
|
1140
|
+
willMatch(n) {
|
|
1141
|
+
return n !== t;
|
|
1145
1142
|
}
|
|
1146
1143
|
}))
|
|
1147
1144
|
throw new Error(
|
|
@@ -1167,8 +1164,8 @@ class Yt {
|
|
|
1167
1164
|
);
|
|
1168
1165
|
return;
|
|
1169
1166
|
}
|
|
1170
|
-
let
|
|
1171
|
-
Array.isArray(e) ?
|
|
1167
|
+
let 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);
|
|
1172
1169
|
}
|
|
1173
1170
|
/**
|
|
1174
1171
|
* Navigate backward. Pass a number of steps to hit the back button that many times.
|
|
@@ -1199,13 +1196,13 @@ class Yt {
|
|
|
1199
1196
|
s(this, P).go(e);
|
|
1200
1197
|
}
|
|
1201
1198
|
}
|
|
1202
|
-
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(), /**
|
|
1203
1200
|
* Parses a route definition object into a set of matchable routes.
|
|
1204
1201
|
*
|
|
1205
1202
|
* @param route - Route config object.
|
|
1206
1203
|
* @param layers - Array of parent layers. Passed when this function calls itself on nested routes.
|
|
1207
1204
|
*/
|
|
1208
|
-
|
|
1205
|
+
at = function(e, t = [], r = []) {
|
|
1209
1206
|
if (!(typeof e == "object" && !Array.isArray(e)) || typeof e.path != "string")
|
|
1210
1207
|
throw new TypeError(`Route configs must be objects with a 'path' string property. Got: ${e}`);
|
|
1211
1208
|
if (e.redirect && e.routes)
|
|
@@ -1216,144 +1213,146 @@ rt = function(e, t = [], n = []) {
|
|
|
1216
1213
|
throw new Error("Route must have a 'view', a 'redirect', or a set of nested 'routes'.");
|
|
1217
1214
|
let a = [];
|
|
1218
1215
|
for (const l of t)
|
|
1219
|
-
a.push(...
|
|
1220
|
-
a.push(...
|
|
1221
|
-
const
|
|
1216
|
+
a.push(...ye(l.path));
|
|
1217
|
+
a.push(...ye(e.path)), a[a.length - 1] === "*" && a.pop();
|
|
1218
|
+
const n = [];
|
|
1222
1219
|
if (e.redirect) {
|
|
1223
1220
|
let l = e.redirect;
|
|
1224
|
-
return
|
|
1225
|
-
pattern: "/" +
|
|
1221
|
+
return V(l) && (l = Ue(ae(a), l), l.startsWith("/") || (l = "/" + l)), n.push({
|
|
1222
|
+
pattern: "/" + ae([...a, ...ye(e.path)]),
|
|
1226
1223
|
meta: {
|
|
1227
1224
|
redirect: l
|
|
1228
1225
|
}
|
|
1229
|
-
}),
|
|
1226
|
+
}), n;
|
|
1230
1227
|
}
|
|
1231
|
-
let o =
|
|
1228
|
+
let o = yt;
|
|
1232
1229
|
if (typeof e.view == "function")
|
|
1233
1230
|
o = e.view;
|
|
1234
1231
|
else if (e.view)
|
|
1235
1232
|
throw new TypeError(`Route '${e.path}' expected a view function or undefined. Got: ${e.view}`);
|
|
1236
|
-
const h = { id:
|
|
1233
|
+
const h = { id: lt(this, Ke)._++, view: o };
|
|
1237
1234
|
if (e.routes)
|
|
1238
1235
|
for (const l of e.routes)
|
|
1239
|
-
|
|
1236
|
+
n.push(...E(this, z, at).call(this, l, [...t, e], [...r, h]));
|
|
1240
1237
|
else
|
|
1241
|
-
|
|
1242
|
-
pattern: parent ?
|
|
1238
|
+
n.push({
|
|
1239
|
+
pattern: parent ? ae([...t.map((l) => l.path), e.path]) : e.path,
|
|
1243
1240
|
meta: {
|
|
1244
1241
|
pattern: e.path,
|
|
1245
|
-
layers: [...
|
|
1242
|
+
layers: [...r, h],
|
|
1246
1243
|
beforeMatch: e.beforeMatch
|
|
1247
1244
|
}
|
|
1248
1245
|
});
|
|
1249
|
-
return
|
|
1250
|
-
},
|
|
1251
|
-
e.search !== s(this, Re) && (b(this, Re, e.search), s(this, xe).call(this,
|
|
1252
|
-
const t =
|
|
1246
|
+
return n;
|
|
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);
|
|
1253
1250
|
if (!t) {
|
|
1254
|
-
s(this,
|
|
1251
|
+
s(this, ce).call(this, null), s(this, ue).call(this, e.pathname), s(this, he).call(this, {
|
|
1255
1252
|
wildcard: e.pathname
|
|
1256
1253
|
});
|
|
1257
1254
|
return;
|
|
1258
1255
|
}
|
|
1259
1256
|
if (t.meta.beforeMatch && await t.meta.beforeMatch({
|
|
1260
1257
|
// TODO: Allow setting context variables from here.
|
|
1261
|
-
redirect: (
|
|
1258
|
+
redirect: (r) => {
|
|
1262
1259
|
throw new Error("Redirect not yet implemented.");
|
|
1263
1260
|
}
|
|
1264
1261
|
}), t.meta.redirect != null)
|
|
1265
1262
|
if (typeof t.meta.redirect == "string") {
|
|
1266
|
-
const
|
|
1267
|
-
s(this, M).info(`↩️ redirecting from '${t.path}' to '${
|
|
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);
|
|
1268
1265
|
} else if (typeof t.meta.redirect == "function") {
|
|
1269
|
-
const
|
|
1266
|
+
const r = {
|
|
1270
1267
|
path: t.path,
|
|
1271
1268
|
pattern: t.pattern,
|
|
1272
1269
|
params: t.params,
|
|
1273
1270
|
query: t.query
|
|
1274
1271
|
};
|
|
1275
|
-
let a = await t.meta.redirect(
|
|
1272
|
+
let a = await t.meta.redirect(r);
|
|
1276
1273
|
if (typeof a != "string")
|
|
1277
1274
|
throw new Error("Redirect function must return a path to redirect to.");
|
|
1278
|
-
a.startsWith("/") || (a =
|
|
1275
|
+
a.startsWith("/") || (a = Ue(t.path, a)), s(this, M).info(`Redirecting to: '${a}'`), s(this, P).replace(a);
|
|
1279
1276
|
} else
|
|
1280
1277
|
throw new TypeError("Redirect must either be a path string or a function.");
|
|
1281
|
-
else if (s(this, M).info(`📍 navigating to '${t.path}'`), s(this,
|
|
1282
|
-
s(this,
|
|
1283
|
-
const
|
|
1284
|
-
for (let a = 0; a <
|
|
1285
|
-
const
|
|
1286
|
-
if ((o == null ? void 0 : o.id) !==
|
|
1287
|
-
b(this,
|
|
1288
|
-
const h = 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);
|
|
1280
|
+
const r = t.meta.layers;
|
|
1281
|
+
for (let a = 0; a < r.length; a++) {
|
|
1282
|
+
const n = r[a], o = s(this, I)[a];
|
|
1283
|
+
if ((o == null ? void 0 : o.id) !== n.id) {
|
|
1284
|
+
b(this, I, s(this, I).slice(0, a));
|
|
1285
|
+
const h = s(this, I).at(-1);
|
|
1289
1286
|
o && o.node.isMounted && o.node.unmount();
|
|
1290
1287
|
let l;
|
|
1291
|
-
h ? l = h.node.setChildView(
|
|
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 });
|
|
1292
1289
|
}
|
|
1293
1290
|
}
|
|
1294
1291
|
}
|
|
1295
1292
|
};
|
|
1296
|
-
const
|
|
1297
|
-
function
|
|
1298
|
-
function n
|
|
1299
|
-
return !
|
|
1293
|
+
const Zt = /(noopener|noreferrer) (noopener|noreferrer)/, er = /^[\w-_]+:/;
|
|
1294
|
+
function tr(i, e, t = window) {
|
|
1295
|
+
function r(n) {
|
|
1296
|
+
return !n || n === i ? null : n.localName !== "a" || n.href === void 0 ? r(n.parentNode) : n;
|
|
1300
1297
|
}
|
|
1301
|
-
function a(
|
|
1302
|
-
if (
|
|
1298
|
+
function a(n) {
|
|
1299
|
+
if (n.button && n.button !== 0 || n.ctrlKey || n.metaKey || n.altKey || n.shiftKey || n.defaultPrevented)
|
|
1303
1300
|
return;
|
|
1304
|
-
const o = n
|
|
1305
|
-
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" &&
|
|
1301
|
+
const o = r(n.target);
|
|
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)));
|
|
1306
1303
|
}
|
|
1307
1304
|
return i.addEventListener("click", a), function() {
|
|
1308
1305
|
i.removeEventListener("click", a);
|
|
1309
1306
|
};
|
|
1310
1307
|
}
|
|
1311
|
-
function
|
|
1308
|
+
function rr(i, e) {
|
|
1312
1309
|
for (const t in e) {
|
|
1313
|
-
const
|
|
1314
|
-
i = i.replace(`{${t}}`,
|
|
1310
|
+
const r = e[t].toString();
|
|
1311
|
+
i = i.replace(`{${t}}`, r).replace(`{#${t}}`, r);
|
|
1315
1312
|
}
|
|
1316
1313
|
return i;
|
|
1317
1314
|
}
|
|
1318
|
-
var
|
|
1319
|
-
class
|
|
1315
|
+
var W, Oe, G, ee, Ne, Me, Te, De, _e, Ae, R, B;
|
|
1316
|
+
class nr {
|
|
1320
1317
|
constructor() {
|
|
1321
1318
|
S(this, "http");
|
|
1322
1319
|
S(this, "i18n");
|
|
1323
1320
|
S(this, "render");
|
|
1324
1321
|
S(this, "router");
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
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());
|
|
1328
|
+
f(this, Te, []);
|
|
1329
|
+
f(this, De, []);
|
|
1330
|
+
f(this, _e, []);
|
|
1331
|
+
f(this, Ae, []);
|
|
1332
|
+
f(this, R, {
|
|
1335
1333
|
info: "development",
|
|
1336
1334
|
log: "development",
|
|
1337
1335
|
warn: "development",
|
|
1338
1336
|
error: !0
|
|
1339
1337
|
});
|
|
1340
|
-
|
|
1341
|
-
S(this, "
|
|
1342
|
-
S(this, "
|
|
1343
|
-
S(this, "
|
|
1344
|
-
S(this, "
|
|
1345
|
-
S(this, "
|
|
1346
|
-
S(this, "
|
|
1347
|
-
S(this, "
|
|
1348
|
-
S(this, "
|
|
1349
|
-
S(this, "
|
|
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);
|
|
1350
1349
|
const e = this;
|
|
1351
|
-
this.http = new
|
|
1350
|
+
this.http = new Vt(), this.i18n = new Wt(this), this.render = new Bt(this), this.router = new Xt(this, {
|
|
1352
1351
|
get rootElement() {
|
|
1353
|
-
return s(e,
|
|
1352
|
+
return s(e, G);
|
|
1354
1353
|
},
|
|
1355
1354
|
get rootView() {
|
|
1356
|
-
return s(e,
|
|
1355
|
+
return s(e, ee);
|
|
1357
1356
|
}
|
|
1358
1357
|
});
|
|
1359
1358
|
}
|
|
@@ -1361,21 +1360,21 @@ class rr {
|
|
|
1361
1360
|
* True when the app is connected to a DOM node and displayed to the user.
|
|
1362
1361
|
*/
|
|
1363
1362
|
get isMounted() {
|
|
1364
|
-
return s(this,
|
|
1363
|
+
return s(this, W);
|
|
1365
1364
|
}
|
|
1366
1365
|
/**
|
|
1367
1366
|
* Get the current environment that this app is running in.
|
|
1368
1367
|
* Environment affects which log messages will print and how much debugging info is included in the DOM.
|
|
1369
1368
|
*/
|
|
1370
1369
|
getEnv() {
|
|
1371
|
-
return s(this,
|
|
1370
|
+
return s(this, Oe);
|
|
1372
1371
|
}
|
|
1373
1372
|
/**
|
|
1374
1373
|
* Sets the environment that this app is running in.
|
|
1375
1374
|
* Environment affects which log messages will print and how much debugging info is included in the DOM.
|
|
1376
1375
|
*/
|
|
1377
1376
|
setEnv(e) {
|
|
1378
|
-
b(this,
|
|
1377
|
+
b(this, Oe, e);
|
|
1379
1378
|
}
|
|
1380
1379
|
/**
|
|
1381
1380
|
* Sets the view that will be shown when the `crash` method is called on any logger.
|
|
@@ -1385,23 +1384,23 @@ class rr {
|
|
|
1385
1384
|
b(this, Ne, e);
|
|
1386
1385
|
}
|
|
1387
1386
|
async mount(e, t) {
|
|
1388
|
-
if (s(this,
|
|
1387
|
+
if (s(this, W))
|
|
1389
1388
|
throw new Error("Dolla is already mounted.");
|
|
1390
|
-
if (
|
|
1389
|
+
if (V(e)) {
|
|
1391
1390
|
const a = document.querySelector(e);
|
|
1392
|
-
|
|
1391
|
+
dt(HTMLElement, a, `Selector '${e}' did not match any element.`), b(this, G, a);
|
|
1393
1392
|
} else
|
|
1394
|
-
|
|
1395
|
-
let
|
|
1396
|
-
t ?
|
|
1397
|
-
for (const a of s(this,
|
|
1393
|
+
dt(HTMLElement, e, "Expected an HTML element or a selector string. Got type: %t, value: %v"), b(this, G, e);
|
|
1394
|
+
let r;
|
|
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))
|
|
1398
1397
|
a();
|
|
1399
1398
|
}
|
|
1400
1399
|
async unmount() {
|
|
1401
1400
|
var e;
|
|
1402
|
-
if (s(this,
|
|
1403
|
-
await Promise.all(s(this,
|
|
1404
|
-
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))
|
|
1405
1404
|
t();
|
|
1406
1405
|
}
|
|
1407
1406
|
}
|
|
@@ -1410,53 +1409,53 @@ class rr {
|
|
|
1410
1409
|
* it will be awaited before mounting finishes. Use this to perform initial setup before the app is displayed to the user.
|
|
1411
1410
|
*/
|
|
1412
1411
|
beforeMount(e) {
|
|
1413
|
-
s(this,
|
|
1412
|
+
s(this, Te).push(e);
|
|
1414
1413
|
}
|
|
1415
1414
|
/**
|
|
1416
1415
|
* Registers a `callback` to run after the app is mounted.
|
|
1417
1416
|
*/
|
|
1418
1417
|
onMount(e) {
|
|
1419
|
-
s(this,
|
|
1418
|
+
s(this, De).push(e);
|
|
1420
1419
|
}
|
|
1421
1420
|
/**
|
|
1422
1421
|
* Registers a `callback` to run after `Dolla.unmount` is called, before the app is unmounted. If `callback` returns a Promise,
|
|
1423
1422
|
* it will be awaited before unmounting finishes. Use this to perform cleanup.
|
|
1424
1423
|
*/
|
|
1425
1424
|
beforeUnmount(e) {
|
|
1426
|
-
s(this,
|
|
1425
|
+
s(this, _e).push(e);
|
|
1427
1426
|
}
|
|
1428
1427
|
/**
|
|
1429
1428
|
* Registers a `callback` to run after the app is unmounted.
|
|
1430
1429
|
*/
|
|
1431
1430
|
onUnmount(e) {
|
|
1432
|
-
s(this,
|
|
1431
|
+
s(this, Ae).push(e);
|
|
1433
1432
|
}
|
|
1434
1433
|
/**
|
|
1435
1434
|
* Update log type toggles. Values that are not passed will remain unchanged.
|
|
1436
1435
|
*/
|
|
1437
1436
|
setLoggles(e) {
|
|
1438
1437
|
for (const t in e) {
|
|
1439
|
-
const
|
|
1440
|
-
|
|
1438
|
+
const r = e[t];
|
|
1439
|
+
r && (s(this, R)[t] = r);
|
|
1441
1440
|
}
|
|
1442
1441
|
}
|
|
1443
1442
|
setLogFilter(e) {
|
|
1444
|
-
b(this,
|
|
1443
|
+
b(this, B, ht(e));
|
|
1445
1444
|
}
|
|
1446
1445
|
createLogger(e, t) {
|
|
1447
|
-
const
|
|
1446
|
+
const r = ft(e), a = (t == null ? void 0 : t.console) ?? _t(), n = this;
|
|
1448
1447
|
return {
|
|
1449
1448
|
get info() {
|
|
1450
1449
|
var h;
|
|
1451
|
-
const o =
|
|
1452
|
-
if (s(
|
|
1453
|
-
return
|
|
1450
|
+
const o = r.get();
|
|
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;
|
|
1454
1453
|
{
|
|
1455
1454
|
let l = `%c${o}`;
|
|
1456
1455
|
return t != null && t.uid ? l += ` %c[uid: %c${t.uid}%c]` : l += "%c%c%c", a.info.bind(
|
|
1457
1456
|
a,
|
|
1458
1457
|
l,
|
|
1459
|
-
`color:${
|
|
1458
|
+
`color:${Fe(l)};font-weight:bold`,
|
|
1460
1459
|
"color:#777",
|
|
1461
1460
|
"color:#aaa",
|
|
1462
1461
|
"color:#777"
|
|
@@ -1465,15 +1464,15 @@ class rr {
|
|
|
1465
1464
|
},
|
|
1466
1465
|
get log() {
|
|
1467
1466
|
var h;
|
|
1468
|
-
const o =
|
|
1469
|
-
if (s(
|
|
1470
|
-
return
|
|
1467
|
+
const o = r.get();
|
|
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;
|
|
1471
1470
|
{
|
|
1472
1471
|
let l = `%c${o}`;
|
|
1473
1472
|
return t != null && t.uid ? l += ` %c[uid: %c${t.uid}%c]` : l += "%c%c%c", a.log.bind(
|
|
1474
1473
|
a,
|
|
1475
1474
|
l,
|
|
1476
|
-
`color:${
|
|
1475
|
+
`color:${Fe(l)};font-weight:bold`,
|
|
1477
1476
|
"color:#777",
|
|
1478
1477
|
"color:#aaa",
|
|
1479
1478
|
"color:#777"
|
|
@@ -1482,15 +1481,15 @@ class rr {
|
|
|
1482
1481
|
},
|
|
1483
1482
|
get warn() {
|
|
1484
1483
|
var h;
|
|
1485
|
-
const o =
|
|
1486
|
-
if (s(
|
|
1487
|
-
return
|
|
1484
|
+
const o = r.get();
|
|
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;
|
|
1488
1487
|
{
|
|
1489
1488
|
let l = `%c${o}`;
|
|
1490
1489
|
return t != null && t.uid ? l += ` %c[uid: %c${t.uid}%c]` : l += "%c%c%c", a.warn.bind(
|
|
1491
1490
|
a,
|
|
1492
1491
|
l,
|
|
1493
|
-
`color:${
|
|
1492
|
+
`color:${Fe(l)};font-weight:bold`,
|
|
1494
1493
|
"color:#777",
|
|
1495
1494
|
"color:#aaa",
|
|
1496
1495
|
"color:#777"
|
|
@@ -1499,15 +1498,15 @@ class rr {
|
|
|
1499
1498
|
},
|
|
1500
1499
|
get error() {
|
|
1501
1500
|
var h;
|
|
1502
|
-
const o =
|
|
1503
|
-
if (s(
|
|
1504
|
-
return
|
|
1501
|
+
const o = r.get();
|
|
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;
|
|
1505
1504
|
{
|
|
1506
1505
|
let l = `%c${o}`;
|
|
1507
1506
|
return t != null && t.uid ? l += ` %c[uid: %c${t.uid}%c]` : l += "%c%c%c", a.error.bind(
|
|
1508
1507
|
a,
|
|
1509
1508
|
l,
|
|
1510
|
-
`color:${
|
|
1509
|
+
`color:${Fe(l)};font-weight:bold`,
|
|
1511
1510
|
"color:#777",
|
|
1512
1511
|
"color:#aaa",
|
|
1513
1512
|
"color:#777"
|
|
@@ -1515,45 +1514,53 @@ class rr {
|
|
|
1515
1514
|
}
|
|
1516
1515
|
},
|
|
1517
1516
|
crash(o) {
|
|
1518
|
-
throw
|
|
1517
|
+
throw n.isMounted && (n.unmount(), n.constructView(s(n, Ne), {
|
|
1519
1518
|
error: o,
|
|
1520
|
-
loggerName:
|
|
1519
|
+
loggerName: r.get(),
|
|
1521
1520
|
uid: t == null ? void 0 : t.uid
|
|
1522
|
-
}).mount(s(
|
|
1521
|
+
}).mount(s(n, G))), o;
|
|
1523
1522
|
}
|
|
1524
1523
|
};
|
|
1525
1524
|
}
|
|
1526
1525
|
/**
|
|
1527
1526
|
*
|
|
1528
1527
|
*/
|
|
1529
|
-
constructView(e, t,
|
|
1530
|
-
return
|
|
1528
|
+
constructView(e, t, r = []) {
|
|
1529
|
+
return At({ root: this, data: {} }, e, t, r);
|
|
1531
1530
|
}
|
|
1532
1531
|
/**
|
|
1533
1532
|
*
|
|
1534
1533
|
*/
|
|
1535
1534
|
constructMarkup(e) {
|
|
1536
|
-
return
|
|
1535
|
+
return jt(Ft({ root: this, data: {} }, e));
|
|
1537
1536
|
}
|
|
1538
1537
|
}
|
|
1539
|
-
|
|
1540
|
-
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
|
+
}
|
|
1541
1546
|
export {
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
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
|
|
1558
1565
|
};
|
|
1559
1566
|
//# sourceMappingURL=index.js.map
|