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