@manyducks.co/dolla 2.0.0-alpha.13 → 2.0.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +4 -2
- package/dist/index.js +548 -539
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.js +2 -2
- package/dist/jsx-runtime.js +2 -2
- package/dist/markup.d.ts +18 -8
- package/dist/modules/dolla.d.ts +7 -6
- package/dist/modules/i18n.d.ts +22 -2
- package/dist/modules/router.d.ts +2 -2
- package/dist/nodes/cond.d.ts +3 -3
- package/dist/nodes/html.d.ts +3 -3
- package/dist/nodes/observer.d.ts +4 -3
- package/dist/nodes/outlet.d.ts +6 -6
- package/dist/nodes/portal.d.ts +3 -3
- package/dist/nodes/repeat.d.ts +3 -3
- package/dist/nodes/text.d.ts +2 -2
- package/dist/passthrough-MfPKbG0F.js +1303 -0
- package/dist/passthrough-MfPKbG0F.js.map +1 -0
- package/dist/state.d.ts +14 -1
- package/dist/view.d.ts +4 -4
- package/notes/scratch.md +50 -0
- package/package.json +1 -1
- package/dist/passthrough-Bz5ZF4jn.js +0 -1279
- package/dist/passthrough-Bz5ZF4jn.js.map +0 -1
|
@@ -0,0 +1,1303 @@
|
|
|
1
|
+
var ue = Object.defineProperty;
|
|
2
|
+
var ce = (t, e, r) => e in t ? ue(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var h = (t, e, r) => ce(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
+
function le(t) {
|
|
5
|
+
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
6
|
+
}
|
|
7
|
+
var j = { exports: {} }, z;
|
|
8
|
+
function ae() {
|
|
9
|
+
return z || (z = 1, function(t, e) {
|
|
10
|
+
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
11
|
+
var r = /* @__PURE__ */ function() {
|
|
12
|
+
function u(a, d) {
|
|
13
|
+
var f = [], w = !0, b = !1, v = void 0;
|
|
14
|
+
try {
|
|
15
|
+
for (var $, k = a[Symbol.iterator](); !(w = ($ = k.next()).done) && (f.push($.value), !(d && f.length === d)); w = !0) ;
|
|
16
|
+
} catch (y) {
|
|
17
|
+
b = !0, v = y;
|
|
18
|
+
} finally {
|
|
19
|
+
try {
|
|
20
|
+
!w && k.return && k.return();
|
|
21
|
+
} finally {
|
|
22
|
+
if (b) throw v;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return f;
|
|
26
|
+
}
|
|
27
|
+
return function(a, d) {
|
|
28
|
+
if (Array.isArray(a)) return a;
|
|
29
|
+
if (Symbol.iterator in Object(a)) return u(a, d);
|
|
30
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
31
|
+
};
|
|
32
|
+
}(), n = function(u) {
|
|
33
|
+
return u.reduce(function(a, d) {
|
|
34
|
+
return 16 > d ? a + "0" + d.toString(16) : a + d.toString(16);
|
|
35
|
+
}, "#");
|
|
36
|
+
}, o = function(u, a, d) {
|
|
37
|
+
var f = 0.5 > d ? d * (1 + a) : d + a - d * a, w = 2 * d - f, b = function(y, m, l) {
|
|
38
|
+
var p = Math.round, g = 0 > l ? l + 1 : 1 < l ? l - 1 : l;
|
|
39
|
+
return g = g < 1 / 6 ? y + 6 * (m - y) * g : g < 1 / 2 ? m : g < 2 / 3 ? y + 6 * (m - y) * (2 / 3 - g) : y, p(255 * g);
|
|
40
|
+
}, v = b(w, f, u + 1 / 3), $ = b(w, f, u), k = b(w, f, u - 1 / 3);
|
|
41
|
+
return [v, $, k];
|
|
42
|
+
}, i = function(u, a, d, f) {
|
|
43
|
+
var w = u % 1007 / 1007, b = function(y, m, l) {
|
|
44
|
+
return y * (l - m) + m;
|
|
45
|
+
}, v = b(w, a.min, a.max), $ = b(w, d.min, d.max), k = b(w, f.max, f.min);
|
|
46
|
+
return [v, $, k];
|
|
47
|
+
}, s = function(u) {
|
|
48
|
+
return u.split("").reduce(function(a, d, f) {
|
|
49
|
+
return a * d.charCodeAt(0) * f + 1;
|
|
50
|
+
}, 1);
|
|
51
|
+
}, c = function(u) {
|
|
52
|
+
var a = u.str, d = u.hue, f = d === void 0 ? { min: 0, max: 360 } : d, w = u.sat, b = w === void 0 ? { min: 0.35, max: 0.65 } : w, v = u.light, $ = v === void 0 ? { min: 0.3, max: 0.7 } : v, k = u.hashFunction, y = k === void 0 ? s : k, m = u.scheme, l = m === void 0 ? "hex" : m, p = i(y(a), f, b, $), g = r(p, 3), N = g[0], W = g[1], H = g[2], D = o(N / 360, W, H), se = n(D);
|
|
53
|
+
return l === "hsl" ? [N, W, H] : l === "rgb" ? D : se;
|
|
54
|
+
};
|
|
55
|
+
e.default = c, t.exports = e.default;
|
|
56
|
+
}(j, j.exports)), j.exports;
|
|
57
|
+
}
|
|
58
|
+
var de = ae();
|
|
59
|
+
const he = /* @__PURE__ */ le(de);
|
|
60
|
+
function q(t) {
|
|
61
|
+
if (t === void 0)
|
|
62
|
+
return "undefined";
|
|
63
|
+
if (t === null)
|
|
64
|
+
return "null";
|
|
65
|
+
const e = typeof t;
|
|
66
|
+
switch (e) {
|
|
67
|
+
case "number":
|
|
68
|
+
return isNaN(t) ? "NaN" : "number";
|
|
69
|
+
case "function":
|
|
70
|
+
return Q(t) ? "class" : e;
|
|
71
|
+
case "object":
|
|
72
|
+
return F(t) ? "array" : pe(t) ? "promise" : e;
|
|
73
|
+
default:
|
|
74
|
+
return e;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function F(t) {
|
|
78
|
+
return Array.isArray(t);
|
|
79
|
+
}
|
|
80
|
+
function J(...t) {
|
|
81
|
+
const e = t[0], r = (n) => F(n) && n.every((o) => e(o));
|
|
82
|
+
return t.length < 2 ? r : r(t[1]);
|
|
83
|
+
}
|
|
84
|
+
function Pe(...t) {
|
|
85
|
+
const e = t[0], r = M(t[2]) ? t[2] : "Expected an array of valid items. Got type: %t, value: %v", n = (o) => {
|
|
86
|
+
if (F(o) && o.every((i) => e(i)))
|
|
87
|
+
return !0;
|
|
88
|
+
throw new TypeError(G(o, r));
|
|
89
|
+
};
|
|
90
|
+
return t.length < 2 ? n : n(t[1]);
|
|
91
|
+
}
|
|
92
|
+
function M(t) {
|
|
93
|
+
return typeof t == "string";
|
|
94
|
+
}
|
|
95
|
+
function je(t, e) {
|
|
96
|
+
if (M(t))
|
|
97
|
+
return !0;
|
|
98
|
+
throw new TypeError(G(t, e ?? "Expected a string. Got type: %t, value: %v"));
|
|
99
|
+
}
|
|
100
|
+
function E(t) {
|
|
101
|
+
return typeof t == "function" && !Q(t);
|
|
102
|
+
}
|
|
103
|
+
function fe(t) {
|
|
104
|
+
return typeof t == "number" && !isNaN(t);
|
|
105
|
+
}
|
|
106
|
+
function pe(t) {
|
|
107
|
+
if (t == null) return !1;
|
|
108
|
+
const e = t;
|
|
109
|
+
return e instanceof Promise || E(e.then) && E(e.catch) && E(e.finally);
|
|
110
|
+
}
|
|
111
|
+
function Q(t) {
|
|
112
|
+
return typeof t == "function" && /^\s*class\s+/.test(t.toString());
|
|
113
|
+
}
|
|
114
|
+
function _e(...t) {
|
|
115
|
+
const e = t[0], r = M(t[2]) ? t[2] : `Expected instance of ${e.name}. Got type: %t, value: %v`, n = (o) => {
|
|
116
|
+
if (o instanceof e)
|
|
117
|
+
return !0;
|
|
118
|
+
throw new TypeError(G(o, r));
|
|
119
|
+
};
|
|
120
|
+
return t.length < 2 ? n : n(t[1]);
|
|
121
|
+
}
|
|
122
|
+
function L(t) {
|
|
123
|
+
return t != null && typeof t == "object" && !F(t);
|
|
124
|
+
}
|
|
125
|
+
function G(t, e) {
|
|
126
|
+
var o;
|
|
127
|
+
const r = q(t), n = ((o = t == null ? void 0 : t.toString) == null ? void 0 : o.call(t)) || String(t);
|
|
128
|
+
return e.replaceAll("%t", r).replaceAll("%v", n);
|
|
129
|
+
}
|
|
130
|
+
const me = () => {
|
|
131
|
+
};
|
|
132
|
+
function Z(t) {
|
|
133
|
+
return t != null && typeof t == "object" && !Array.isArray(t) && Object.getPrototypeOf(t) === Object.getPrototypeOf({});
|
|
134
|
+
}
|
|
135
|
+
function _(t, e) {
|
|
136
|
+
if (t === e)
|
|
137
|
+
return !0;
|
|
138
|
+
if (C(t) || C(e))
|
|
139
|
+
return !1;
|
|
140
|
+
if (Z(t) && Z(e)) {
|
|
141
|
+
const r = Object.keys(t), n = Object.keys(e);
|
|
142
|
+
if (r.length !== n.length)
|
|
143
|
+
return !1;
|
|
144
|
+
for (const o in t)
|
|
145
|
+
if (!_(t[o], e[o]))
|
|
146
|
+
return !1;
|
|
147
|
+
return !0;
|
|
148
|
+
}
|
|
149
|
+
if (Array.isArray(t) && Array.isArray(e)) {
|
|
150
|
+
if (t.length !== e.length)
|
|
151
|
+
return !1;
|
|
152
|
+
for (const r in t)
|
|
153
|
+
if (!_(t[r], e[r]))
|
|
154
|
+
return !1;
|
|
155
|
+
return !0;
|
|
156
|
+
}
|
|
157
|
+
return t === e;
|
|
158
|
+
}
|
|
159
|
+
function ye(t, e) {
|
|
160
|
+
const r = (n) => {
|
|
161
|
+
const o = {};
|
|
162
|
+
for (const i in n)
|
|
163
|
+
t.includes(i) || (o[i] = n[i]);
|
|
164
|
+
return o;
|
|
165
|
+
};
|
|
166
|
+
return e == null ? r : r(e);
|
|
167
|
+
}
|
|
168
|
+
function Ue() {
|
|
169
|
+
if (typeof window < "u" && window.console)
|
|
170
|
+
return window.console;
|
|
171
|
+
if (typeof global < "u" && global.console)
|
|
172
|
+
return global.console;
|
|
173
|
+
}
|
|
174
|
+
function Le(t) {
|
|
175
|
+
return he({
|
|
176
|
+
str: t,
|
|
177
|
+
sat: { min: 0.35, max: 0.55 },
|
|
178
|
+
light: { min: 0.6, max: 0.6 }
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
function Ie(t) {
|
|
182
|
+
if (t instanceof RegExp)
|
|
183
|
+
return (n) => t.test(n);
|
|
184
|
+
const e = {
|
|
185
|
+
positive: [],
|
|
186
|
+
negative: []
|
|
187
|
+
}, r = t.split(",").map((n) => n.trim()).filter((n) => n !== "");
|
|
188
|
+
for (let n of r) {
|
|
189
|
+
let o = "positive";
|
|
190
|
+
n.startsWith("-") && (o = "negative", n = n.slice(1)), n === "*" ? e[o].push(function() {
|
|
191
|
+
return !0;
|
|
192
|
+
}) : n.endsWith("*") ? e[o].push(function(i) {
|
|
193
|
+
return i.startsWith(n.slice(0, n.length - 1));
|
|
194
|
+
}) : e[o].push(function(i) {
|
|
195
|
+
return i === n;
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
return function(n) {
|
|
199
|
+
const { positive: o, negative: i } = e;
|
|
200
|
+
return !(i.some((s) => s(n)) || o.length > 0 && !o.some((s) => s(n)));
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
const U = {
|
|
204
|
+
watcherCount: 0,
|
|
205
|
+
increment() {
|
|
206
|
+
this.watcherCount++, this._bump();
|
|
207
|
+
},
|
|
208
|
+
decrement() {
|
|
209
|
+
this.watcherCount--, this._bump();
|
|
210
|
+
},
|
|
211
|
+
_timeout: null,
|
|
212
|
+
_bump() {
|
|
213
|
+
window.DOLLA_DEV_DEBUG === !0 && !this._timeout && (this._timeout = setTimeout(() => {
|
|
214
|
+
console.log({ watcherCount: this.watcherCount }), this._timeout = null;
|
|
215
|
+
}, 200));
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
function C(t) {
|
|
219
|
+
return !(t == null || typeof t != "object" || typeof t.get != "function" || typeof t.watch != "function");
|
|
220
|
+
}
|
|
221
|
+
function B(t) {
|
|
222
|
+
return !(t == null || typeof t != "object" || typeof t.set != "function" || typeof t.get != "function" || typeof t.watch != "function");
|
|
223
|
+
}
|
|
224
|
+
function O(t) {
|
|
225
|
+
return C(t) ? t.get() : t;
|
|
226
|
+
}
|
|
227
|
+
function I(t) {
|
|
228
|
+
return B(t) ? {
|
|
229
|
+
get: t.get,
|
|
230
|
+
watch: t.watch
|
|
231
|
+
} : C(t) ? t : {
|
|
232
|
+
get() {
|
|
233
|
+
return t;
|
|
234
|
+
},
|
|
235
|
+
watch(e, r = {}) {
|
|
236
|
+
return r != null && r.lazy || e(t), me;
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
function qe(t, e) {
|
|
241
|
+
const [r, n] = T(t, e);
|
|
242
|
+
return {
|
|
243
|
+
get: r.get,
|
|
244
|
+
watch: r.watch,
|
|
245
|
+
set: n
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
function Ge(t, e) {
|
|
249
|
+
return {
|
|
250
|
+
get: t.get,
|
|
251
|
+
watch: t.watch,
|
|
252
|
+
set: e
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
function Be(t, e) {
|
|
256
|
+
return function(n) {
|
|
257
|
+
const o = t.get();
|
|
258
|
+
let i;
|
|
259
|
+
typeof n == "function" ? i = n(o) : i = n, e(i, o);
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
function T(t, e) {
|
|
263
|
+
let r = t, n = [];
|
|
264
|
+
function o() {
|
|
265
|
+
for (const u of n)
|
|
266
|
+
try {
|
|
267
|
+
u(r);
|
|
268
|
+
} catch (a) {
|
|
269
|
+
console.warn("error in state watcher", u), console.error(a);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function i(u, a) {
|
|
273
|
+
return e != null && e.equality ? e.equality(u, a) : _(u, a);
|
|
274
|
+
}
|
|
275
|
+
const s = {
|
|
276
|
+
get() {
|
|
277
|
+
return O(r);
|
|
278
|
+
},
|
|
279
|
+
watch(u, a) {
|
|
280
|
+
return n.push(u), a != null && a.lazy || u(s.get()), U.increment(), function() {
|
|
281
|
+
n.splice(n.indexOf(u), 1), U.decrement();
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
function c(u) {
|
|
286
|
+
let a;
|
|
287
|
+
typeof u == "function" ? a = u(r) : a = u, i(a, r) || (r = a, o());
|
|
288
|
+
}
|
|
289
|
+
return [s, c];
|
|
290
|
+
}
|
|
291
|
+
const ge = Symbol("EMPTY");
|
|
292
|
+
function we(t, e, r) {
|
|
293
|
+
t = t.map(I);
|
|
294
|
+
let n = new Array(t.length).fill(ge, 0, t.length), o, i = [], s = !1;
|
|
295
|
+
const c = R();
|
|
296
|
+
let u, a;
|
|
297
|
+
function d(m = b()) {
|
|
298
|
+
for (const l of i)
|
|
299
|
+
l(m);
|
|
300
|
+
}
|
|
301
|
+
function f(m, l) {
|
|
302
|
+
return r != null && r.equality ? r.equality(m, l) : _(m, l);
|
|
303
|
+
}
|
|
304
|
+
function w() {
|
|
305
|
+
const m = t.map((l) => l.get());
|
|
306
|
+
for (let l = 0; l < t.length; l++)
|
|
307
|
+
if (!f(m[l], n[l])) {
|
|
308
|
+
v(e(...m)), n = m;
|
|
309
|
+
break;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
function b() {
|
|
313
|
+
return s || w(), a = O(o), a;
|
|
314
|
+
}
|
|
315
|
+
function v(m) {
|
|
316
|
+
m !== o && (u && (u(), u = void 0), o = m, a = O(m), C(m) && s && (u = m.watch((l) => {
|
|
317
|
+
const p = O(l);
|
|
318
|
+
f(p, a) || (a = p, d(p));
|
|
319
|
+
})));
|
|
320
|
+
}
|
|
321
|
+
function $() {
|
|
322
|
+
let m = [...n];
|
|
323
|
+
for (let l = 0; l < t.length; l++)
|
|
324
|
+
c.watch([t[l]], (p) => {
|
|
325
|
+
const g = n[l];
|
|
326
|
+
if (n[l] = p, s && !f(p, g)) {
|
|
327
|
+
try {
|
|
328
|
+
let N = e(...n);
|
|
329
|
+
v(N);
|
|
330
|
+
} catch (N) {
|
|
331
|
+
console.warn("error when updating source values", n, e.toString()), console.error(N);
|
|
332
|
+
}
|
|
333
|
+
d(O(o));
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
s = !0;
|
|
337
|
+
for (let l = 0; l < t.length; l++)
|
|
338
|
+
if (!f(n[l], m[l])) {
|
|
339
|
+
v(e(...n)), d(O(o));
|
|
340
|
+
break;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
function k() {
|
|
344
|
+
c.stopAll(), u && (u(), u = void 0), s = !1;
|
|
345
|
+
}
|
|
346
|
+
return {
|
|
347
|
+
get() {
|
|
348
|
+
return b();
|
|
349
|
+
},
|
|
350
|
+
watch(m, l) {
|
|
351
|
+
return s || $(), i.push(m), l != null && l.lazy || m(b()), U.increment(), function() {
|
|
352
|
+
i.splice(i.indexOf(m), 1), s && i.length === 0 && k(), U.decrement();
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
function R() {
|
|
358
|
+
const t = [];
|
|
359
|
+
return {
|
|
360
|
+
watch(e, r) {
|
|
361
|
+
if (e.length === 0)
|
|
362
|
+
throw new TypeError("Expected at least one state to watch.");
|
|
363
|
+
e = e.map(I);
|
|
364
|
+
let n;
|
|
365
|
+
return e.length > 1 ? n = we(e, r).watch(() => null) : n = e[0].watch(r), t.push(n), () => {
|
|
366
|
+
let o = t.indexOf(n);
|
|
367
|
+
o > -1 && t.splice(o, 1), n();
|
|
368
|
+
};
|
|
369
|
+
},
|
|
370
|
+
stopAll() {
|
|
371
|
+
for (; t.length > 0; )
|
|
372
|
+
t.pop()();
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
function be(t) {
|
|
377
|
+
for (var e, r, n = arguments, o = 1, i = "", s = "", c = [0], u = function(f) {
|
|
378
|
+
o === 1 && (f || (i = i.replace(/^\s*\n\s*|\s*\n\s*$/g, ""))) ? c.push(f ? n[f] : i) : o === 3 && (f || i) ? (c[1] = f ? n[f] : i, o = 2) : o === 2 && i === "..." && f ? c[2] = Object.assign(c[2] || {}, n[f]) : o === 2 && i && !f ? (c[2] = c[2] || {})[i] = !0 : o >= 5 && (o === 5 ? ((c[2] = c[2] || {})[r] = f ? i ? i + n[f] : n[f] : i, o = 6) : (f || i) && (c[2][r] += f ? i + n[f] : i)), i = "";
|
|
379
|
+
}, a = 0; a < t.length; a++) {
|
|
380
|
+
a && (o === 1 && u(), u(a));
|
|
381
|
+
for (var d = 0; d < t[a].length; d++) e = t[a][d], o === 1 ? e === "<" ? (u(), c = [c, "", null], o = 3) : i += e : o === 4 ? i === "--" && e === ">" ? (o = 1, i = "") : i = e + i[0] : s ? e === s ? s = "" : i += e : e === '"' || e === "'" ? s = e : e === ">" ? (u(), o = 1) : o && (e === "=" ? (o = 5, r = i, i = "") : e === "/" && (o < 5 || t[a][d + 1] === ">") ? (u(), o === 3 && (c = c[0]), o = c, (c = c[0]).push(this.apply(null, o.slice(1))), o = 0) : e === " " || e === " " || e === `
|
|
382
|
+
` || e === "\r" ? (u(), o = 2) : i += e), o === 3 && i === "!--" && (o = 4, c = c[0]);
|
|
383
|
+
}
|
|
384
|
+
return u(), c.length > 2 ? c.slice(1) : c[1];
|
|
385
|
+
}
|
|
386
|
+
class Ce {
|
|
387
|
+
constructor(e) {
|
|
388
|
+
h(this, "node");
|
|
389
|
+
h(this, "endNode");
|
|
390
|
+
h(this, "$predicate");
|
|
391
|
+
h(this, "stopCallback");
|
|
392
|
+
h(this, "thenContent");
|
|
393
|
+
h(this, "elseContent");
|
|
394
|
+
h(this, "connectedContent", []);
|
|
395
|
+
h(this, "elementContext");
|
|
396
|
+
h(this, "initialUpdateHappened", !1);
|
|
397
|
+
h(this, "previousValue");
|
|
398
|
+
this.$predicate = e.$predicate, this.thenContent = e.thenContent ? P(e.thenContent) : void 0, this.elseContent = e.elseContent ? P(e.elseContent) : void 0, this.elementContext = e.elementContext, this.elementContext.root.getEnv() === "development" ? (this.node = document.createComment("Conditional"), this.endNode = document.createComment("/Conditional")) : (this.node = document.createTextNode(""), this.endNode = document.createTextNode(""));
|
|
399
|
+
}
|
|
400
|
+
get isMounted() {
|
|
401
|
+
return this.node.parentNode != null;
|
|
402
|
+
}
|
|
403
|
+
mount(e, r) {
|
|
404
|
+
this.isMounted || (e.insertBefore(this.node, (r == null ? void 0 : r.nextSibling) ?? null), this.elementContext.root.getEnv() === "development" && e.insertBefore(this.endNode, this.node.nextSibling), this.stopCallback = this.$predicate.watch((n) => {
|
|
405
|
+
(!this.initialUpdateHappened || n && !this.previousValue || !n && this.previousValue) && (this.update(n), this.initialUpdateHappened = !0, this.previousValue = n);
|
|
406
|
+
}));
|
|
407
|
+
}
|
|
408
|
+
unmount() {
|
|
409
|
+
var e, r;
|
|
410
|
+
this.stopCallback && (this.stopCallback(), this.stopCallback = void 0);
|
|
411
|
+
for (const n of this.connectedContent)
|
|
412
|
+
n.unmount();
|
|
413
|
+
this.connectedContent = [], this.isMounted && ((e = this.node.parentNode) == null || e.removeChild(this.node), (r = this.endNode.parentNode) == null || r.removeChild(this.endNode));
|
|
414
|
+
}
|
|
415
|
+
update(e) {
|
|
416
|
+
var r;
|
|
417
|
+
for (const n of this.connectedContent)
|
|
418
|
+
n.unmount();
|
|
419
|
+
if (this.connectedContent = [], this.node.parentNode != null) {
|
|
420
|
+
e && this.thenContent ? this.connectedContent = S(this.elementContext, this.thenContent) : !e && this.elseContent && (this.connectedContent = S(this.elementContext, this.elseContent));
|
|
421
|
+
for (let n = 0; n < this.connectedContent.length; n++) {
|
|
422
|
+
const o = this.connectedContent[n], i = ((r = this.connectedContent[n - 1]) == null ? void 0 : r.node) ?? this.node;
|
|
423
|
+
o.mount(this.node.parentNode, i);
|
|
424
|
+
}
|
|
425
|
+
this.elementContext.root.getEnv() === "development" && (this.node.textContent = `Conditional (${e ? "truthy" : "falsy"})`);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
const ve = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
430
|
+
let X = (t = 21) => {
|
|
431
|
+
let e = "", r = crypto.getRandomValues(new Uint8Array(t |= 0));
|
|
432
|
+
for (; t--; )
|
|
433
|
+
e += ve[r[t] & 63];
|
|
434
|
+
return e;
|
|
435
|
+
};
|
|
436
|
+
const ke = (t) => /^on[A-Z]/.test(t);
|
|
437
|
+
class $e {
|
|
438
|
+
constructor({ tag: e, props: r, children: n, elementContext: o }) {
|
|
439
|
+
h(this, "node");
|
|
440
|
+
h(this, "props");
|
|
441
|
+
h(this, "children");
|
|
442
|
+
h(this, "stopCallbacks", []);
|
|
443
|
+
h(this, "elementContext");
|
|
444
|
+
h(this, "uniqueId", X());
|
|
445
|
+
// Track the ref so we can nullify it on unmount.
|
|
446
|
+
h(this, "ref");
|
|
447
|
+
// Prevents 'onClickOutside' handlers from firing in the same cycle in which the element is connected.
|
|
448
|
+
h(this, "canClickAway", !1);
|
|
449
|
+
if (o = { ...o }, e.toLowerCase() === "svg" && (o.isSVG = !0), o.isSVG ? this.node = document.createElementNS("http://www.w3.org/2000/svg", e) : this.node = document.createElement(e), o.root.getEnv() === "development" && (this.node.dataset.uniqueId = this.uniqueId), r.ref)
|
|
450
|
+
if (re(r.ref))
|
|
451
|
+
this.ref = r.ref;
|
|
452
|
+
else
|
|
453
|
+
throw new Error("Expected ref to be a Ref object. Got: " + r.ref);
|
|
454
|
+
this.props = {
|
|
455
|
+
...ye(["ref", "class", "className"], r),
|
|
456
|
+
class: r.className ?? r.class
|
|
457
|
+
}, this.children = n ? S(o, n) : [], this.elementContext = o;
|
|
458
|
+
}
|
|
459
|
+
get isMounted() {
|
|
460
|
+
return this.node.parentNode != null;
|
|
461
|
+
}
|
|
462
|
+
mount(e, r) {
|
|
463
|
+
if (e == null)
|
|
464
|
+
throw new Error(`HTML element requires a parent element as the first argument to connect. Got: ${e}`);
|
|
465
|
+
if (!this.isMounted) {
|
|
466
|
+
for (const n of this.children)
|
|
467
|
+
n.mount(this.node);
|
|
468
|
+
this.applyProps(this.node, this.props), this.props.style && this.applyStyles(this.node, this.props.style, this.stopCallbacks), this.props.class && this.applyClasses(this.node, this.props.class, this.stopCallbacks);
|
|
469
|
+
}
|
|
470
|
+
e.insertBefore(this.node, (r == null ? void 0 : r.nextSibling) ?? null), this.ref && (this.ref.node = this.node), setTimeout(() => {
|
|
471
|
+
this.canClickAway = !0;
|
|
472
|
+
}, 0);
|
|
473
|
+
}
|
|
474
|
+
unmount() {
|
|
475
|
+
var e;
|
|
476
|
+
if (this.isMounted) {
|
|
477
|
+
for (const r of this.children)
|
|
478
|
+
r.unmount();
|
|
479
|
+
this.ref && (this.ref.node = void 0), (e = this.node.parentNode) == null || e.removeChild(this.node), this.canClickAway = !1;
|
|
480
|
+
for (const r of this.stopCallbacks)
|
|
481
|
+
r();
|
|
482
|
+
this.stopCallbacks = [];
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
getUpdateKey(e, r) {
|
|
486
|
+
return `${this.uniqueId}:${e}:${r}`;
|
|
487
|
+
}
|
|
488
|
+
applyProps(e, r) {
|
|
489
|
+
const n = (o, i, s) => {
|
|
490
|
+
C(o) ? this.stopCallbacks.push(
|
|
491
|
+
o.watch((c) => {
|
|
492
|
+
this.elementContext.root.render.update(() => {
|
|
493
|
+
i(c);
|
|
494
|
+
}, s);
|
|
495
|
+
})
|
|
496
|
+
) : this.elementContext.root.render.update(() => {
|
|
497
|
+
i(o);
|
|
498
|
+
}, s);
|
|
499
|
+
};
|
|
500
|
+
for (const o in r) {
|
|
501
|
+
const i = r[o];
|
|
502
|
+
if (o === "attributes") {
|
|
503
|
+
const s = i;
|
|
504
|
+
for (const c in s)
|
|
505
|
+
n(
|
|
506
|
+
s[c],
|
|
507
|
+
(u) => {
|
|
508
|
+
u == null ? e.removeAttribute(c) : e.setAttribute(c, String(u));
|
|
509
|
+
},
|
|
510
|
+
this.getUpdateKey("attr", c)
|
|
511
|
+
);
|
|
512
|
+
} else if (o === "eventListeners") {
|
|
513
|
+
const s = i;
|
|
514
|
+
for (const c in s) {
|
|
515
|
+
const u = C(i) ? (a) => i.get()(a) : i;
|
|
516
|
+
e.addEventListener(c, u), this.stopCallbacks.push(() => {
|
|
517
|
+
e.removeEventListener(c, u);
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
} else if (o === "onClickOutside" || o === "onclickoutside") {
|
|
521
|
+
const s = (u) => {
|
|
522
|
+
this.canClickAway && !e.contains(u.target) && (C(i) ? i.get()(u) : i(u));
|
|
523
|
+
}, c = { capture: !0 };
|
|
524
|
+
window.addEventListener("click", s, c), this.stopCallbacks.push(() => {
|
|
525
|
+
window.removeEventListener("click", s, c);
|
|
526
|
+
});
|
|
527
|
+
} else if (o === "$$value") {
|
|
528
|
+
if (!B(i))
|
|
529
|
+
throw new TypeError(`$$value attribute must be a settable state. Got: ${i}`);
|
|
530
|
+
n(
|
|
531
|
+
i,
|
|
532
|
+
(c) => {
|
|
533
|
+
c == null ? e.value = "" : e.value = String(c);
|
|
534
|
+
},
|
|
535
|
+
this.getUpdateKey("attr", "value")
|
|
536
|
+
);
|
|
537
|
+
const s = (c) => {
|
|
538
|
+
const u = Ne(i.get(), c.currentTarget.value);
|
|
539
|
+
i.set(u);
|
|
540
|
+
};
|
|
541
|
+
e.addEventListener("input", s), this.stopCallbacks.push(() => {
|
|
542
|
+
e.removeEventListener("input", s);
|
|
543
|
+
});
|
|
544
|
+
} else if (ke(o)) {
|
|
545
|
+
const s = o.slice(2).toLowerCase(), c = C(i) ? (u) => i.get()(u) : i;
|
|
546
|
+
e.addEventListener(s, c), this.stopCallbacks.push(() => {
|
|
547
|
+
e.removeEventListener(s, c);
|
|
548
|
+
});
|
|
549
|
+
} else if (o.includes("-"))
|
|
550
|
+
n(
|
|
551
|
+
i,
|
|
552
|
+
(s) => {
|
|
553
|
+
s == null ? e.removeAttribute(o) : e.setAttribute(o, String(s));
|
|
554
|
+
},
|
|
555
|
+
this.getUpdateKey("attr", o)
|
|
556
|
+
);
|
|
557
|
+
else if (!xe.includes(o))
|
|
558
|
+
if (this.elementContext.isSVG)
|
|
559
|
+
n(
|
|
560
|
+
i,
|
|
561
|
+
(s) => {
|
|
562
|
+
s != null ? e.setAttribute(o, String(r[o])) : e.removeAttribute(o);
|
|
563
|
+
},
|
|
564
|
+
this.getUpdateKey("attr", o)
|
|
565
|
+
);
|
|
566
|
+
else
|
|
567
|
+
switch (o) {
|
|
568
|
+
case "contentEditable":
|
|
569
|
+
case "value":
|
|
570
|
+
n(
|
|
571
|
+
i,
|
|
572
|
+
(s) => {
|
|
573
|
+
e[o] = String(s);
|
|
574
|
+
},
|
|
575
|
+
this.getUpdateKey("prop", o)
|
|
576
|
+
);
|
|
577
|
+
break;
|
|
578
|
+
case "for":
|
|
579
|
+
n(
|
|
580
|
+
i,
|
|
581
|
+
(s) => {
|
|
582
|
+
e.htmlFor = s;
|
|
583
|
+
},
|
|
584
|
+
this.getUpdateKey("prop", "htmlFor")
|
|
585
|
+
);
|
|
586
|
+
break;
|
|
587
|
+
case "checked":
|
|
588
|
+
n(
|
|
589
|
+
i,
|
|
590
|
+
(s) => {
|
|
591
|
+
e.checked = s, s ? e.setAttribute("checked", "") : e.removeAttribute("checked");
|
|
592
|
+
},
|
|
593
|
+
this.getUpdateKey("prop", "checked")
|
|
594
|
+
);
|
|
595
|
+
break;
|
|
596
|
+
// Attribute-aliased props
|
|
597
|
+
case "exportParts":
|
|
598
|
+
case "part":
|
|
599
|
+
case "translate":
|
|
600
|
+
case "type":
|
|
601
|
+
case "title": {
|
|
602
|
+
const s = o.toLowerCase();
|
|
603
|
+
n(
|
|
604
|
+
i,
|
|
605
|
+
(c) => {
|
|
606
|
+
c == null ? e.removeAttribute(s) : e.setAttribute(s, String(c));
|
|
607
|
+
},
|
|
608
|
+
this.getUpdateKey("attr", s)
|
|
609
|
+
);
|
|
610
|
+
break;
|
|
611
|
+
}
|
|
612
|
+
case "autocomplete":
|
|
613
|
+
case "autocapitalize":
|
|
614
|
+
n(
|
|
615
|
+
i,
|
|
616
|
+
(s) => {
|
|
617
|
+
typeof s == "string" ? e.autocomplete = s : s ? e.autocomplete = "on" : e.autocomplete = "off";
|
|
618
|
+
},
|
|
619
|
+
this.getUpdateKey("prop", o)
|
|
620
|
+
);
|
|
621
|
+
break;
|
|
622
|
+
default: {
|
|
623
|
+
n(
|
|
624
|
+
i,
|
|
625
|
+
(s) => {
|
|
626
|
+
e[o] = s;
|
|
627
|
+
},
|
|
628
|
+
this.getUpdateKey("prop", o)
|
|
629
|
+
);
|
|
630
|
+
break;
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
applyStyles(e, r, n) {
|
|
636
|
+
const o = [];
|
|
637
|
+
if (C(r)) {
|
|
638
|
+
let i;
|
|
639
|
+
const s = r.watch((c) => {
|
|
640
|
+
this.elementContext.root.render.update(
|
|
641
|
+
() => {
|
|
642
|
+
E(i) && i(), e.style.cssText = "", i = this.applyStyles(e, c, n);
|
|
643
|
+
},
|
|
644
|
+
this.getUpdateKey("styles", "*")
|
|
645
|
+
);
|
|
646
|
+
});
|
|
647
|
+
n.push(s), o.push(s);
|
|
648
|
+
} else {
|
|
649
|
+
const i = te(r);
|
|
650
|
+
for (const s in i) {
|
|
651
|
+
const { value: c, priority: u } = i[s];
|
|
652
|
+
if (C(c)) {
|
|
653
|
+
const a = c.watch((d) => {
|
|
654
|
+
this.elementContext.root.render.update(() => {
|
|
655
|
+
d ? e.style.setProperty(s, String(d), u) : e.style.removeProperty(s);
|
|
656
|
+
});
|
|
657
|
+
});
|
|
658
|
+
n.push(a), o.push(a);
|
|
659
|
+
} else c != null && e.style.setProperty(s, String(c));
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
return function() {
|
|
663
|
+
for (const s of o)
|
|
664
|
+
s(), n.splice(n.indexOf(s), 1);
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
applyClasses(e, r, n) {
|
|
668
|
+
const o = [];
|
|
669
|
+
if (C(r)) {
|
|
670
|
+
let i;
|
|
671
|
+
const s = r.watch((c) => {
|
|
672
|
+
this.elementContext.root.render.update(
|
|
673
|
+
() => {
|
|
674
|
+
E(i) && i(), e.removeAttribute("class"), i = this.applyClasses(e, c, n);
|
|
675
|
+
},
|
|
676
|
+
this.getUpdateKey("attr", "class")
|
|
677
|
+
);
|
|
678
|
+
});
|
|
679
|
+
n.push(s), o.push(s);
|
|
680
|
+
} else {
|
|
681
|
+
const i = ee(r);
|
|
682
|
+
for (const s in i) {
|
|
683
|
+
const c = i[s];
|
|
684
|
+
if (C(c)) {
|
|
685
|
+
const u = c.watch((a) => {
|
|
686
|
+
this.elementContext.root.render.update(() => {
|
|
687
|
+
a ? e.classList.add(s) : e.classList.remove(s);
|
|
688
|
+
});
|
|
689
|
+
});
|
|
690
|
+
n.push(u), o.push(u);
|
|
691
|
+
} else c && e.classList.add(s);
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
return function() {
|
|
695
|
+
for (const s of o)
|
|
696
|
+
s(), n.splice(n.indexOf(s), 1);
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
function ee(t) {
|
|
701
|
+
let e = {};
|
|
702
|
+
if (M(t)) {
|
|
703
|
+
const r = t.split(" ");
|
|
704
|
+
for (const n of r)
|
|
705
|
+
e[n] = !0;
|
|
706
|
+
} else L(t) ? Object.assign(e, t) : Array.isArray(t) && Array.from(t).filter(Boolean).forEach((r) => {
|
|
707
|
+
Object.assign(e, ee(r));
|
|
708
|
+
});
|
|
709
|
+
return delete e.undefined, e;
|
|
710
|
+
}
|
|
711
|
+
function te(t) {
|
|
712
|
+
let e = {};
|
|
713
|
+
if (M(t)) {
|
|
714
|
+
const r = t.split(";").filter((n) => n.trim() !== "");
|
|
715
|
+
for (const n of r) {
|
|
716
|
+
const [o, i] = n.split(":"), s = {
|
|
717
|
+
value: i
|
|
718
|
+
};
|
|
719
|
+
i.includes("!important") ? (s.priority = "important", s.value = i.replace("!important", "").trim()) : s.value = i.trim(), e[Y(o.trim())] = s;
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
if (L(t))
|
|
723
|
+
for (const r in t)
|
|
724
|
+
r.startsWith("--") ? e[r] = { value: t[r] } : e[Y(r)] = { value: t[r] };
|
|
725
|
+
else Array.isArray(t) && Array.from(t).filter((r) => r != null).forEach((r) => {
|
|
726
|
+
Object.assign(e, te(r));
|
|
727
|
+
});
|
|
728
|
+
return e;
|
|
729
|
+
}
|
|
730
|
+
function Y(t) {
|
|
731
|
+
return t.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (e, r) => (r ? "-" : "") + e.toLowerCase());
|
|
732
|
+
}
|
|
733
|
+
function Ne(t, e) {
|
|
734
|
+
const r = typeof t;
|
|
735
|
+
return r === "string" ? String(e) : r === "number" ? Number(e) : r === "boolean" ? !!e : e;
|
|
736
|
+
}
|
|
737
|
+
const xe = ["ref", "children", "class", "style", "data"];
|
|
738
|
+
class Se {
|
|
739
|
+
constructor({ states: e, renderFn: r, elementContext: n }) {
|
|
740
|
+
h(this, "node");
|
|
741
|
+
h(this, "endNode");
|
|
742
|
+
h(this, "connectedViews", []);
|
|
743
|
+
h(this, "renderFn");
|
|
744
|
+
h(this, "elementContext");
|
|
745
|
+
h(this, "observerControls");
|
|
746
|
+
h(this, "watcher", R());
|
|
747
|
+
this.elementContext = n, this.renderFn = r, this.node = document.createComment("Observer"), this.endNode = document.createComment("/Observer");
|
|
748
|
+
let o;
|
|
749
|
+
this.observerControls = {
|
|
750
|
+
start: () => {
|
|
751
|
+
o == null && (o = this.watcher.watch(e, (...i) => {
|
|
752
|
+
const s = this.renderFn(...i);
|
|
753
|
+
if (!ie(s))
|
|
754
|
+
throw console.error(s), new TypeError(
|
|
755
|
+
`Observer received invalid value to render. Got type: ${q(s)}, value: ${s}`
|
|
756
|
+
);
|
|
757
|
+
Array.isArray(s) ? this.update(...s) : this.update(s);
|
|
758
|
+
}));
|
|
759
|
+
},
|
|
760
|
+
stop: () => {
|
|
761
|
+
o != null && (o(), o = void 0);
|
|
762
|
+
}
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
get isMounted() {
|
|
766
|
+
return this.node.parentNode != null;
|
|
767
|
+
}
|
|
768
|
+
mount(e, r) {
|
|
769
|
+
this.isMounted || (e.insertBefore(this.node, (r == null ? void 0 : r.nextSibling) ?? null), this.observerControls.start());
|
|
770
|
+
}
|
|
771
|
+
unmount() {
|
|
772
|
+
var e;
|
|
773
|
+
this.observerControls.stop(), this.watcher.stopAll(), this.isMounted && (this.cleanup(), (e = this.node.parentNode) == null || e.removeChild(this.node));
|
|
774
|
+
}
|
|
775
|
+
cleanup() {
|
|
776
|
+
var e;
|
|
777
|
+
for (; this.connectedViews.length > 0; )
|
|
778
|
+
(e = this.connectedViews.pop()) == null || e.unmount();
|
|
779
|
+
}
|
|
780
|
+
update(...e) {
|
|
781
|
+
var n, o;
|
|
782
|
+
if (this.cleanup(), e == null || !this.isMounted)
|
|
783
|
+
return;
|
|
784
|
+
const r = e.map((i) => ne(i) ? i : V(i) ? A(S(this.elementContext, i)) : A(S(this.elementContext, P(i))));
|
|
785
|
+
for (const i of r) {
|
|
786
|
+
const s = ((n = this.connectedViews.at(-1)) == null ? void 0 : n.node) || this.node;
|
|
787
|
+
i.mount(this.node.parentNode, s), this.connectedViews.push(i);
|
|
788
|
+
}
|
|
789
|
+
if (this.elementContext.root.getEnv() === "development") {
|
|
790
|
+
const i = (o = this.connectedViews.at(-1)) == null ? void 0 : o.node;
|
|
791
|
+
this.endNode.previousSibling !== i && this.node.parentNode.insertBefore(this.endNode, (i == null ? void 0 : i.nextSibling) ?? null);
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
class Ee {
|
|
796
|
+
constructor(e) {
|
|
797
|
+
h(this, "node");
|
|
798
|
+
h(this, "endNode");
|
|
799
|
+
h(this, "$children");
|
|
800
|
+
h(this, "stopCallback");
|
|
801
|
+
h(this, "mountedChildren", []);
|
|
802
|
+
h(this, "elementContext");
|
|
803
|
+
this.$children = e.$children, this.elementContext = e.elementContext, this.elementContext.root.getEnv() === "development" ? (this.node = document.createComment("Outlet"), this.endNode = document.createComment("/Outlet")) : (this.node = document.createTextNode(""), this.endNode = document.createTextNode(""));
|
|
804
|
+
}
|
|
805
|
+
get isMounted() {
|
|
806
|
+
var e;
|
|
807
|
+
return ((e = this.node) == null ? void 0 : e.parentNode) != null;
|
|
808
|
+
}
|
|
809
|
+
mount(e, r) {
|
|
810
|
+
this.isMounted || (e.insertBefore(this.node, (r == null ? void 0 : r.nextSibling) ?? null), this.stopCallback = this.$children.watch((n) => {
|
|
811
|
+
this.update(n);
|
|
812
|
+
}));
|
|
813
|
+
}
|
|
814
|
+
unmount() {
|
|
815
|
+
var e;
|
|
816
|
+
if (this.stopCallback && (this.stopCallback(), this.stopCallback = void 0), this.isMounted) {
|
|
817
|
+
for (const r of this.mountedChildren)
|
|
818
|
+
r.unmount();
|
|
819
|
+
this.mountedChildren = [], (e = this.endNode.parentNode) == null || e.removeChild(this.endNode);
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
update(e) {
|
|
823
|
+
var r, n, o;
|
|
824
|
+
for (const i of this.mountedChildren)
|
|
825
|
+
i.unmount();
|
|
826
|
+
for (let i = 0; i < e.length; i++) {
|
|
827
|
+
const s = e[i], c = i > 0 ? e[i] : void 0;
|
|
828
|
+
s.mount(this.node.parentElement, c == null ? void 0 : c.node);
|
|
829
|
+
}
|
|
830
|
+
this.mountedChildren = e, this.elementContext.root.getEnv() === "development" && (this.node.textContent = `Outlet (${e.length} ${e.length === 1 ? "child" : "children"})`, (o = this.node.parentElement) == null || o.insertBefore(
|
|
831
|
+
this.endNode,
|
|
832
|
+
((n = (r = this.mountedChildren[this.mountedChildren.length - 1]) == null ? void 0 : r.node) == null ? void 0 : n.nextSibling) ?? null
|
|
833
|
+
));
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
class Ae {
|
|
837
|
+
constructor(e) {
|
|
838
|
+
h(this, "config");
|
|
839
|
+
h(this, "element");
|
|
840
|
+
this.config = e;
|
|
841
|
+
}
|
|
842
|
+
get isMounted() {
|
|
843
|
+
return this.element ? this.element.isMounted : !1;
|
|
844
|
+
}
|
|
845
|
+
mount(e, r) {
|
|
846
|
+
const { content: n, parent: o } = this.config;
|
|
847
|
+
ne(n) ? this.element = n : V(n) ? this.element = A(S(this.config.elementContext, n)) : this.element = A(S(this.config.elementContext, P(n))), this.element.mount(o);
|
|
848
|
+
}
|
|
849
|
+
unmount() {
|
|
850
|
+
var e;
|
|
851
|
+
(e = this.element) != null && e.isMounted && this.element.unmount();
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
function K(t, e, r, n = []) {
|
|
855
|
+
t = { ...t, data: {}, parent: t };
|
|
856
|
+
const [o, i] = T(S(t, n));
|
|
857
|
+
let s = !1;
|
|
858
|
+
const c = R(), u = [], a = [], d = [], f = [], w = X(), [b, v] = T(e.name), $ = t.root.createLogger(b, { uid: w }), k = {
|
|
859
|
+
get uid() {
|
|
860
|
+
return w;
|
|
861
|
+
},
|
|
862
|
+
set(l, p) {
|
|
863
|
+
t.data[l] = p;
|
|
864
|
+
},
|
|
865
|
+
get(l) {
|
|
866
|
+
let p = t;
|
|
867
|
+
for (; ; ) {
|
|
868
|
+
if (l in p.data)
|
|
869
|
+
return p.data[l];
|
|
870
|
+
if (p.parent)
|
|
871
|
+
p = p.parent;
|
|
872
|
+
else
|
|
873
|
+
break;
|
|
874
|
+
}
|
|
875
|
+
return null;
|
|
876
|
+
},
|
|
877
|
+
getAll() {
|
|
878
|
+
const l = [];
|
|
879
|
+
let p = t;
|
|
880
|
+
for (; l.push(p.data), p.parent; )
|
|
881
|
+
p = p.parent;
|
|
882
|
+
const g = {};
|
|
883
|
+
for (const N of l.reverse())
|
|
884
|
+
Object.assign(g, N);
|
|
885
|
+
return g;
|
|
886
|
+
},
|
|
887
|
+
setName(l) {
|
|
888
|
+
v(l);
|
|
889
|
+
},
|
|
890
|
+
beforeMount(l) {
|
|
891
|
+
u.push(l);
|
|
892
|
+
},
|
|
893
|
+
onMount(l) {
|
|
894
|
+
a.push(l);
|
|
895
|
+
},
|
|
896
|
+
beforeUnmount(l) {
|
|
897
|
+
d.push(l);
|
|
898
|
+
},
|
|
899
|
+
onUnmount(l) {
|
|
900
|
+
f.push(l);
|
|
901
|
+
},
|
|
902
|
+
watch(l, p) {
|
|
903
|
+
if (s)
|
|
904
|
+
return c.watch(l, p);
|
|
905
|
+
{
|
|
906
|
+
let g, N = !1;
|
|
907
|
+
return a.push(() => {
|
|
908
|
+
N || (g = c.watch(l, p));
|
|
909
|
+
}), () => {
|
|
910
|
+
g != null && (N = !0, g());
|
|
911
|
+
};
|
|
912
|
+
}
|
|
913
|
+
},
|
|
914
|
+
outlet() {
|
|
915
|
+
return x("$outlet", { $children: o });
|
|
916
|
+
}
|
|
917
|
+
};
|
|
918
|
+
Object.assign(k, $);
|
|
919
|
+
let y;
|
|
920
|
+
function m() {
|
|
921
|
+
let l;
|
|
922
|
+
try {
|
|
923
|
+
l = e(r, k);
|
|
924
|
+
} catch (p) {
|
|
925
|
+
throw p instanceof Error && $.crash(p), p;
|
|
926
|
+
}
|
|
927
|
+
if (l instanceof Promise)
|
|
928
|
+
throw new TypeError("View function cannot return a Promise.");
|
|
929
|
+
if (l !== null) if (l instanceof Node)
|
|
930
|
+
y = A(S(t, x("$node", { value: l })));
|
|
931
|
+
else if (V(l) || J(V, l))
|
|
932
|
+
y = A(S(t, l));
|
|
933
|
+
else if (C(l))
|
|
934
|
+
y = A(
|
|
935
|
+
S(t, x("$observer", { states: [l], renderFn: (p) => p }))
|
|
936
|
+
);
|
|
937
|
+
else {
|
|
938
|
+
const p = new TypeError(
|
|
939
|
+
`Expected '${e.name}' function to return a DOM node, Markup element, Readable or null. Got: ${q(l)}`
|
|
940
|
+
);
|
|
941
|
+
$.crash(p);
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
return {
|
|
945
|
+
get node() {
|
|
946
|
+
return y == null ? void 0 : y.node;
|
|
947
|
+
},
|
|
948
|
+
get isMounted() {
|
|
949
|
+
return s;
|
|
950
|
+
},
|
|
951
|
+
mount(l, p) {
|
|
952
|
+
const g = s;
|
|
953
|
+
if (!g)
|
|
954
|
+
for (m(); u.length > 0; )
|
|
955
|
+
u.shift()();
|
|
956
|
+
y && y.mount(l, p), g || (s = !0, requestAnimationFrame(() => {
|
|
957
|
+
for (; a.length > 0; )
|
|
958
|
+
a.shift()();
|
|
959
|
+
}));
|
|
960
|
+
},
|
|
961
|
+
unmount() {
|
|
962
|
+
for (; d.length > 0; )
|
|
963
|
+
d.shift()();
|
|
964
|
+
for (y && y.unmount(), s = !1; f.length > 0; )
|
|
965
|
+
f.shift()();
|
|
966
|
+
c.stopAll();
|
|
967
|
+
},
|
|
968
|
+
setChildView(l) {
|
|
969
|
+
const p = K(t, l, {});
|
|
970
|
+
return i([p]), p;
|
|
971
|
+
}
|
|
972
|
+
};
|
|
973
|
+
}
|
|
974
|
+
class Me {
|
|
975
|
+
constructor({ elementContext: e, $items: r, renderFn: n, keyFn: o }) {
|
|
976
|
+
h(this, "node");
|
|
977
|
+
h(this, "endNode");
|
|
978
|
+
h(this, "$items");
|
|
979
|
+
h(this, "stopCallback");
|
|
980
|
+
h(this, "connectedItems", []);
|
|
981
|
+
h(this, "elementContext");
|
|
982
|
+
h(this, "renderFn");
|
|
983
|
+
h(this, "keyFn");
|
|
984
|
+
this.elementContext = e, this.$items = r, this.renderFn = n, this.keyFn = o, this.elementContext.root.getEnv() === "development" ? (this.node = document.createComment("Repeat"), this.endNode = document.createComment("/Repeat")) : (this.node = document.createTextNode(""), this.endNode = document.createTextNode(""));
|
|
985
|
+
}
|
|
986
|
+
get isMounted() {
|
|
987
|
+
return this.node.parentNode != null;
|
|
988
|
+
}
|
|
989
|
+
mount(e, r) {
|
|
990
|
+
this.isMounted || (e.insertBefore(this.node, (r == null ? void 0 : r.nextSibling) ?? null), this.stopCallback = this.$items.watch((n) => {
|
|
991
|
+
this._update(Array.from(n));
|
|
992
|
+
}));
|
|
993
|
+
}
|
|
994
|
+
unmount() {
|
|
995
|
+
var e, r;
|
|
996
|
+
this.stopCallback && (this.stopCallback(), this.stopCallback = void 0), this.isMounted && ((e = this.node.parentNode) == null || e.removeChild(this.node), (r = this.endNode.parentNode) == null || r.removeChild(this.endNode)), this._cleanup();
|
|
997
|
+
}
|
|
998
|
+
_cleanup() {
|
|
999
|
+
for (const e of this.connectedItems)
|
|
1000
|
+
e.element.unmount();
|
|
1001
|
+
this.connectedItems = [];
|
|
1002
|
+
}
|
|
1003
|
+
_update(e) {
|
|
1004
|
+
var i, s, c;
|
|
1005
|
+
if (e.length === 0 || !this.isMounted)
|
|
1006
|
+
return this._cleanup();
|
|
1007
|
+
const r = [];
|
|
1008
|
+
let n = 0;
|
|
1009
|
+
for (const u of e)
|
|
1010
|
+
r.push({
|
|
1011
|
+
key: this.keyFn(u, n),
|
|
1012
|
+
value: u,
|
|
1013
|
+
index: n++
|
|
1014
|
+
});
|
|
1015
|
+
const o = [];
|
|
1016
|
+
for (const u of this.connectedItems)
|
|
1017
|
+
r.find((d) => d.key === u.key) || u.element.unmount();
|
|
1018
|
+
for (const u of r) {
|
|
1019
|
+
const a = this.connectedItems.find((d) => d.key === u.key);
|
|
1020
|
+
if (a)
|
|
1021
|
+
a.setValue(u.value), a.setIndex(u.index), o[u.index] = a;
|
|
1022
|
+
else {
|
|
1023
|
+
const [d, f] = T(u.value), [w, b] = T(u.index);
|
|
1024
|
+
o[u.index] = {
|
|
1025
|
+
key: u.key,
|
|
1026
|
+
$value: d,
|
|
1027
|
+
setValue: f,
|
|
1028
|
+
$index: w,
|
|
1029
|
+
setIndex: b,
|
|
1030
|
+
element: K(this.elementContext, Oe, {
|
|
1031
|
+
$value: d,
|
|
1032
|
+
$index: w,
|
|
1033
|
+
renderFn: this.renderFn
|
|
1034
|
+
})
|
|
1035
|
+
};
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
for (let u = 0; u < o.length; u++) {
|
|
1039
|
+
const a = o[u], d = ((i = o[u - 1]) == null ? void 0 : i.element.node) ?? this.node;
|
|
1040
|
+
a.element.mount(this.node.parentNode, d);
|
|
1041
|
+
}
|
|
1042
|
+
if (this.connectedItems = o, this.elementContext.root.getEnv() === "development") {
|
|
1043
|
+
this.node.textContent = `Repeat (${o.length} item${o.length === 1 ? "" : "s"})`;
|
|
1044
|
+
const u = ((s = o.at(-1)) == null ? void 0 : s.element.node) ?? this.node;
|
|
1045
|
+
(c = this.node.parentNode) == null || c.insertBefore(this.endNode, u.nextSibling);
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
function Oe({ $value: t, $index: e, renderFn: r }, n) {
|
|
1050
|
+
return r(t, e, n);
|
|
1051
|
+
}
|
|
1052
|
+
class Te {
|
|
1053
|
+
constructor({ value: e }) {
|
|
1054
|
+
h(this, "node", document.createTextNode(""));
|
|
1055
|
+
h(this, "value", "");
|
|
1056
|
+
h(this, "stopCallback");
|
|
1057
|
+
this.value = e;
|
|
1058
|
+
}
|
|
1059
|
+
get isMounted() {
|
|
1060
|
+
return this.node.parentNode != null;
|
|
1061
|
+
}
|
|
1062
|
+
async mount(e, r = null) {
|
|
1063
|
+
this.isMounted || (C(this.value) ? this.stopCallback = this.value.watch((n) => {
|
|
1064
|
+
this.update(n);
|
|
1065
|
+
}) : this.update(this.value)), e.insertBefore(this.node, (r == null ? void 0 : r.nextSibling) ?? null);
|
|
1066
|
+
}
|
|
1067
|
+
async unmount() {
|
|
1068
|
+
this.isMounted && (this.stopCallback && (this.stopCallback(), this.stopCallback = void 0), this.node.parentNode.removeChild(this.node));
|
|
1069
|
+
}
|
|
1070
|
+
update(e) {
|
|
1071
|
+
e != null ? this.node.textContent = e.toString() : this.node.textContent = "";
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
function V(t) {
|
|
1075
|
+
return L(t) && (typeof t.type == "string" || typeof t.type == "function") && Array.isArray(t.children);
|
|
1076
|
+
}
|
|
1077
|
+
function ne(t) {
|
|
1078
|
+
return L(t) && E(t.connect) && E(t.disconnect);
|
|
1079
|
+
}
|
|
1080
|
+
function P(t) {
|
|
1081
|
+
return F(t) || (t = [t]), t.flat(1 / 0).filter((e) => e != null && e !== !1).map((e) => {
|
|
1082
|
+
if (e instanceof Node)
|
|
1083
|
+
return x("$node", { value: e });
|
|
1084
|
+
if (e instanceof oe)
|
|
1085
|
+
return x("$node", { value: e.node });
|
|
1086
|
+
if (V(e))
|
|
1087
|
+
return e;
|
|
1088
|
+
if (M(e) || fe(e))
|
|
1089
|
+
return x("$text", { value: e });
|
|
1090
|
+
if (C(e))
|
|
1091
|
+
return x("$observer", {
|
|
1092
|
+
states: [e],
|
|
1093
|
+
renderFn: (r) => r
|
|
1094
|
+
});
|
|
1095
|
+
throw console.error(e), new TypeError(`Unexpected child type. Got: ${e}`);
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1098
|
+
function x(t, e, ...r) {
|
|
1099
|
+
return e != null && Ve(e), {
|
|
1100
|
+
type: t,
|
|
1101
|
+
props: e,
|
|
1102
|
+
children: P(r)
|
|
1103
|
+
};
|
|
1104
|
+
}
|
|
1105
|
+
function Ve(t) {
|
|
1106
|
+
if (t.ref && !re(t.ref))
|
|
1107
|
+
throw console.warn(t.ref), new TypeError(`Prop 'ref' must be a Ref object. Got: ${t.ref}`);
|
|
1108
|
+
for (const e in t)
|
|
1109
|
+
if (e.startsWith("$$") && t[e] !== void 0) {
|
|
1110
|
+
if (!B(t[e]))
|
|
1111
|
+
throw new TypeError(`Prop '${e}' is named as a SettableState but value is not. Got: ${t[e]}`);
|
|
1112
|
+
} else if (e.startsWith("$") && t[e] !== void 0 && !C(t[e]))
|
|
1113
|
+
throw new TypeError(`Prop '${e}' is named as a State but value is not. Got: ${t[e]}`);
|
|
1114
|
+
}
|
|
1115
|
+
const Re = be.bind(x);
|
|
1116
|
+
function Ke(t, e, r) {
|
|
1117
|
+
const n = I(t);
|
|
1118
|
+
return x("$cond", {
|
|
1119
|
+
$predicate: n,
|
|
1120
|
+
thenContent: e,
|
|
1121
|
+
elseContent: r
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
function We(t, e, r) {
|
|
1125
|
+
const n = I(t);
|
|
1126
|
+
return x("$repeat", { $items: n, keyFn: e, renderFn: r });
|
|
1127
|
+
}
|
|
1128
|
+
function He(t, e) {
|
|
1129
|
+
return x("$portal", { parent: t, content: e });
|
|
1130
|
+
}
|
|
1131
|
+
function De() {
|
|
1132
|
+
const [t, e] = T();
|
|
1133
|
+
return {
|
|
1134
|
+
get: t.get,
|
|
1135
|
+
watch: t.watch,
|
|
1136
|
+
get node() {
|
|
1137
|
+
return t.get();
|
|
1138
|
+
},
|
|
1139
|
+
set node(r) {
|
|
1140
|
+
e(r);
|
|
1141
|
+
}
|
|
1142
|
+
};
|
|
1143
|
+
}
|
|
1144
|
+
function re(t) {
|
|
1145
|
+
return !(t == null || typeof t != "object" || !t.hasOwnProperty("node"));
|
|
1146
|
+
}
|
|
1147
|
+
class oe {
|
|
1148
|
+
constructor(e) {
|
|
1149
|
+
h(this, "node");
|
|
1150
|
+
this.node = e;
|
|
1151
|
+
}
|
|
1152
|
+
get isMounted() {
|
|
1153
|
+
return this.node.parentNode != null;
|
|
1154
|
+
}
|
|
1155
|
+
async mount(e, r) {
|
|
1156
|
+
e.insertBefore(this.node, (r == null ? void 0 : r.nextSibling) ?? null);
|
|
1157
|
+
}
|
|
1158
|
+
async unmount() {
|
|
1159
|
+
this.node.parentNode && this.node.parentNode.removeChild(this.node);
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
function S(t, e) {
|
|
1163
|
+
return (F(e) ? e : [e]).map((n) => {
|
|
1164
|
+
if (E(n.type))
|
|
1165
|
+
return K(t, n.type, n.props, n.children);
|
|
1166
|
+
if (M(n.type))
|
|
1167
|
+
switch (n.type) {
|
|
1168
|
+
case "$node": {
|
|
1169
|
+
const o = n.props;
|
|
1170
|
+
return new oe(o.value);
|
|
1171
|
+
}
|
|
1172
|
+
case "$text": {
|
|
1173
|
+
const o = n.props;
|
|
1174
|
+
return new Te({
|
|
1175
|
+
value: o.value
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
case "$cond": {
|
|
1179
|
+
const o = n.props;
|
|
1180
|
+
return new Ce({
|
|
1181
|
+
$predicate: o.$predicate,
|
|
1182
|
+
thenContent: o.thenContent,
|
|
1183
|
+
elseContent: o.elseContent,
|
|
1184
|
+
elementContext: t
|
|
1185
|
+
});
|
|
1186
|
+
}
|
|
1187
|
+
case "$repeat": {
|
|
1188
|
+
const o = n.props;
|
|
1189
|
+
return new Me({
|
|
1190
|
+
$items: o.$items,
|
|
1191
|
+
keyFn: o.keyFn,
|
|
1192
|
+
renderFn: o.renderFn,
|
|
1193
|
+
elementContext: t
|
|
1194
|
+
});
|
|
1195
|
+
}
|
|
1196
|
+
case "$observer": {
|
|
1197
|
+
const o = n.props;
|
|
1198
|
+
return new Se({
|
|
1199
|
+
states: o.states,
|
|
1200
|
+
renderFn: o.renderFn,
|
|
1201
|
+
elementContext: t
|
|
1202
|
+
});
|
|
1203
|
+
}
|
|
1204
|
+
case "$outlet": {
|
|
1205
|
+
const o = n.props;
|
|
1206
|
+
return new Ee({
|
|
1207
|
+
$children: o.$children,
|
|
1208
|
+
elementContext: t
|
|
1209
|
+
});
|
|
1210
|
+
}
|
|
1211
|
+
case "$portal": {
|
|
1212
|
+
const o = n.props;
|
|
1213
|
+
return new Ae({
|
|
1214
|
+
content: o.content,
|
|
1215
|
+
parent: o.parent,
|
|
1216
|
+
elementContext: t
|
|
1217
|
+
});
|
|
1218
|
+
}
|
|
1219
|
+
default:
|
|
1220
|
+
if (n.type.startsWith("$"))
|
|
1221
|
+
throw new Error(`Unknown markup type: ${n.type}`);
|
|
1222
|
+
return new $e({
|
|
1223
|
+
tag: n.type,
|
|
1224
|
+
props: n.props ?? {},
|
|
1225
|
+
children: n.children,
|
|
1226
|
+
elementContext: t
|
|
1227
|
+
});
|
|
1228
|
+
}
|
|
1229
|
+
else
|
|
1230
|
+
throw new TypeError(`Expected a string or view function. Got: ${n.type}`);
|
|
1231
|
+
});
|
|
1232
|
+
}
|
|
1233
|
+
function A(t) {
|
|
1234
|
+
if (t.length === 1)
|
|
1235
|
+
return t[0];
|
|
1236
|
+
const e = document.createComment("Fragment");
|
|
1237
|
+
let r = !1;
|
|
1238
|
+
return {
|
|
1239
|
+
get node() {
|
|
1240
|
+
return e;
|
|
1241
|
+
},
|
|
1242
|
+
get isMounted() {
|
|
1243
|
+
return r;
|
|
1244
|
+
},
|
|
1245
|
+
mount(n, o) {
|
|
1246
|
+
var i;
|
|
1247
|
+
n.insertBefore(e, o || null);
|
|
1248
|
+
for (const s of t) {
|
|
1249
|
+
const c = ((i = t[t.length - 1]) == null ? void 0 : i.node) ?? e;
|
|
1250
|
+
s.mount(n, c);
|
|
1251
|
+
}
|
|
1252
|
+
r = !0;
|
|
1253
|
+
},
|
|
1254
|
+
unmount() {
|
|
1255
|
+
if (r) {
|
|
1256
|
+
for (const n of t)
|
|
1257
|
+
n.unmount();
|
|
1258
|
+
e.remove();
|
|
1259
|
+
}
|
|
1260
|
+
r = !1;
|
|
1261
|
+
}
|
|
1262
|
+
};
|
|
1263
|
+
}
|
|
1264
|
+
function ie(t) {
|
|
1265
|
+
return t == null || t === !1 || typeof t == "string" || typeof t == "number" || V(t) || C(t) || J(ie, t);
|
|
1266
|
+
}
|
|
1267
|
+
function ze(t, e) {
|
|
1268
|
+
return e.outlet();
|
|
1269
|
+
}
|
|
1270
|
+
export {
|
|
1271
|
+
S as A,
|
|
1272
|
+
Be as B,
|
|
1273
|
+
He as C,
|
|
1274
|
+
We as D,
|
|
1275
|
+
ze as P,
|
|
1276
|
+
_ as a,
|
|
1277
|
+
E as b,
|
|
1278
|
+
Ke as c,
|
|
1279
|
+
we as d,
|
|
1280
|
+
M as e,
|
|
1281
|
+
T as f,
|
|
1282
|
+
je as g,
|
|
1283
|
+
Re as h,
|
|
1284
|
+
L as i,
|
|
1285
|
+
Pe as j,
|
|
1286
|
+
R as k,
|
|
1287
|
+
Ie as l,
|
|
1288
|
+
qe as m,
|
|
1289
|
+
Ge as n,
|
|
1290
|
+
I as o,
|
|
1291
|
+
De as p,
|
|
1292
|
+
re as q,
|
|
1293
|
+
_e as r,
|
|
1294
|
+
x as s,
|
|
1295
|
+
q as t,
|
|
1296
|
+
Ue as u,
|
|
1297
|
+
O as v,
|
|
1298
|
+
me as w,
|
|
1299
|
+
Le as x,
|
|
1300
|
+
K as y,
|
|
1301
|
+
A as z
|
|
1302
|
+
};
|
|
1303
|
+
//# sourceMappingURL=passthrough-MfPKbG0F.js.map
|