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