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