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