@manyducks.co/dolla 2.0.0-alpha.4 → 2.0.0-alpha.6
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 +162 -513
- package/dist/index.d.ts +10 -10
- package/dist/index.js +171 -172
- 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 +11 -11
- package/dist/modules/dolla.d.ts +7 -7
- package/dist/modules/language.d.ts +4 -4
- package/dist/modules/router.d.ts +4 -4
- package/dist/nodes/cond.d.ts +3 -3
- package/dist/nodes/html.d.ts +1 -1
- package/dist/nodes/observer.d.ts +4 -4
- package/dist/nodes/outlet.d.ts +3 -3
- package/dist/nodes/repeat.d.ts +9 -9
- package/dist/nodes/text.d.ts +3 -3
- package/dist/{passthrough-BSLd3foL.js → passthrough-CW8Ezjg-.js} +168 -169
- package/dist/passthrough-CW8Ezjg-.js.map +1 -0
- package/dist/state.d.ts +101 -0
- package/dist/types.d.ts +11 -11
- package/dist/view.d.ts +4 -4
- package/notes/readme-scratch.md +222 -0
- package/notes/scratch.md +1 -1
- package/package.json +1 -1
- package/tests/{signals.test.js → state.test.js} +6 -6
- package/dist/passthrough-BSLd3foL.js.map +0 -1
- package/dist/signals.d.ts +0 -101
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var f = (t, e, n) =>
|
|
4
|
-
function
|
|
1
|
+
var ue = Object.defineProperty;
|
|
2
|
+
var ce = (t, e, n) => e in t ? ue(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var f = (t, e, n) => ce(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
function le(t) {
|
|
5
5
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
6
6
|
}
|
|
7
7
|
var U = { exports: {} }, H;
|
|
8
|
-
function
|
|
8
|
+
function ae() {
|
|
9
9
|
return H || (H = 1, function(t, e) {
|
|
10
10
|
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
11
11
|
var n = /* @__PURE__ */ function() {
|
|
12
12
|
function u(a, d) {
|
|
13
|
-
var h = [], b = !0,
|
|
13
|
+
var h = [], b = !0, C = !1, v = void 0;
|
|
14
14
|
try {
|
|
15
15
|
for (var $, k = a[Symbol.iterator](); !(b = ($ = k.next()).done) && (h.push($.value), !(d && h.length === d)); b = !0) ;
|
|
16
16
|
} catch (m) {
|
|
17
|
-
|
|
17
|
+
C = !0, v = m;
|
|
18
18
|
} finally {
|
|
19
19
|
try {
|
|
20
20
|
!b && k.return && k.return();
|
|
21
21
|
} finally {
|
|
22
|
-
if (
|
|
22
|
+
if (C) throw v;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
return h;
|
|
@@ -34,30 +34,30 @@ function de() {
|
|
|
34
34
|
return 16 > d ? a + "0" + d.toString(16) : a + d.toString(16);
|
|
35
35
|
}, "#");
|
|
36
36
|
}, r = function(u, a, d) {
|
|
37
|
-
var h = 0.5 > d ? d * (1 + a) : d + a - d * a, b = 2 * d - h,
|
|
37
|
+
var h = 0.5 > d ? d * (1 + a) : d + a - d * a, b = 2 * d - h, C = function(m, p, l) {
|
|
38
38
|
var y = Math.round, g = 0 > l ? l + 1 : 1 < l ? l - 1 : l;
|
|
39
39
|
return g = g < 1 / 6 ? m + 6 * (p - m) * g : g < 1 / 2 ? p : g < 2 / 3 ? m + 6 * (p - m) * (2 / 3 - g) : m, y(255 * g);
|
|
40
|
-
}, v =
|
|
40
|
+
}, v = C(b, h, u + 1 / 3), $ = C(b, h, u), k = C(b, h, u - 1 / 3);
|
|
41
41
|
return [v, $, k];
|
|
42
42
|
}, i = function(u, a, d, h) {
|
|
43
|
-
var b = u % 1007 / 1007,
|
|
43
|
+
var b = u % 1007 / 1007, C = function(m, p, l) {
|
|
44
44
|
return m * (l - p) + p;
|
|
45
|
-
}, v =
|
|
45
|
+
}, v = C(b, a.min, a.max), $ = C(b, d.min, d.max), k = C(b, h.max, h.min);
|
|
46
46
|
return [v, $, k];
|
|
47
47
|
}, s = function(u) {
|
|
48
48
|
return u.split("").reduce(function(a, d, h) {
|
|
49
49
|
return a * d.charCodeAt(0) * h + 1;
|
|
50
50
|
}, 1);
|
|
51
51
|
}, c = function(u) {
|
|
52
|
-
var a = u.str, d = u.hue, h = d === void 0 ? { min: 0, max: 360 } : d, b = u.sat,
|
|
53
|
-
return l === "hsl" ? [
|
|
52
|
+
var a = u.str, d = u.hue, h = d === void 0 ? { min: 0, max: 360 } : d, b = u.sat, C = b === void 0 ? { min: 0.35, max: 0.65 } : b, v = u.light, $ = v === void 0 ? { min: 0.3, max: 0.7 } : v, k = u.hashFunction, m = k === void 0 ? s : k, p = u.scheme, l = p === void 0 ? "hex" : p, y = i(m(a), h, C, $), g = n(y, 3), S = g[0], F = g[1], K = g[2], W = r(S / 360, F, K), se = o(W);
|
|
53
|
+
return l === "hsl" ? [S, F, K] : l === "rgb" ? W : se;
|
|
54
54
|
};
|
|
55
55
|
e.default = c, t.exports = e.default;
|
|
56
56
|
}(U, U.exports)), U.exports;
|
|
57
57
|
}
|
|
58
|
-
var
|
|
59
|
-
const
|
|
60
|
-
function
|
|
58
|
+
var de = ae();
|
|
59
|
+
const fe = /* @__PURE__ */ le(de);
|
|
60
|
+
function _(t) {
|
|
61
61
|
if (t === void 0)
|
|
62
62
|
return "undefined";
|
|
63
63
|
if (t === null)
|
|
@@ -67,9 +67,9 @@ function G(t) {
|
|
|
67
67
|
case "number":
|
|
68
68
|
return isNaN(t) ? "NaN" : "number";
|
|
69
69
|
case "function":
|
|
70
|
-
return
|
|
70
|
+
return Y(t) ? "class" : e;
|
|
71
71
|
case "object":
|
|
72
|
-
return P(t) ? "array" :
|
|
72
|
+
return P(t) ? "array" : pe(t) ? "promise" : e;
|
|
73
73
|
default:
|
|
74
74
|
return e;
|
|
75
75
|
}
|
|
@@ -77,7 +77,7 @@ function G(t) {
|
|
|
77
77
|
function P(t) {
|
|
78
78
|
return Array.isArray(t);
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function Z(...t) {
|
|
81
81
|
const e = t[0], n = (o) => P(o) && o.every((r) => e(r));
|
|
82
82
|
return t.length < 2 ? n : n(t[1]);
|
|
83
83
|
}
|
|
@@ -85,7 +85,7 @@ function Fe(...t) {
|
|
|
85
85
|
const e = t[0], n = M(t[2]) ? t[2] : "Expected an array of valid items. Got type: %t, value: %v", o = (r) => {
|
|
86
86
|
if (P(r) && r.every((i) => e(i)))
|
|
87
87
|
return !0;
|
|
88
|
-
throw new TypeError(
|
|
88
|
+
throw new TypeError(R(r, n));
|
|
89
89
|
};
|
|
90
90
|
return t.length < 2 ? o : o(t[1]);
|
|
91
91
|
}
|
|
@@ -95,49 +95,49 @@ function M(t) {
|
|
|
95
95
|
function je(t, e) {
|
|
96
96
|
if (M(t))
|
|
97
97
|
return !0;
|
|
98
|
-
throw new TypeError(
|
|
98
|
+
throw new TypeError(R(t, e ?? "Expected a string. Got type: %t, value: %v"));
|
|
99
99
|
}
|
|
100
100
|
function E(t) {
|
|
101
|
-
return typeof t == "function" && !
|
|
101
|
+
return typeof t == "function" && !Y(t);
|
|
102
102
|
}
|
|
103
|
-
function
|
|
103
|
+
function he(t) {
|
|
104
104
|
return typeof t == "number" && !isNaN(t);
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function pe(t) {
|
|
107
107
|
if (t == null) return !1;
|
|
108
108
|
const e = t;
|
|
109
109
|
return e instanceof Promise || E(e.then) && E(e.catch) && E(e.finally);
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function Y(t) {
|
|
112
112
|
return typeof t == "function" && /^\s*class\s+/.test(t.toString());
|
|
113
113
|
}
|
|
114
114
|
function Ue(...t) {
|
|
115
115
|
const e = t[0], n = M(t[2]) ? t[2] : `Expected instance of ${e.name}. Got type: %t, value: %v`, o = (r) => {
|
|
116
116
|
if (r instanceof e)
|
|
117
117
|
return !0;
|
|
118
|
-
throw new TypeError(
|
|
118
|
+
throw new TypeError(R(r, n));
|
|
119
119
|
};
|
|
120
120
|
return t.length < 2 ? o : o(t[1]);
|
|
121
121
|
}
|
|
122
122
|
function L(t) {
|
|
123
123
|
return t != null && typeof t == "object" && !P(t);
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function R(t, e) {
|
|
126
126
|
var r;
|
|
127
|
-
const n =
|
|
127
|
+
const n = _(t), o = ((r = t == null ? void 0 : t.toString) == null ? void 0 : r.call(t)) || String(t);
|
|
128
128
|
return e.replaceAll("%t", n).replaceAll("%v", o);
|
|
129
129
|
}
|
|
130
|
-
const
|
|
130
|
+
const me = () => {
|
|
131
131
|
};
|
|
132
|
-
function
|
|
132
|
+
function z(t) {
|
|
133
133
|
return t != null && typeof t == "object" && !Array.isArray(t) && Object.getPrototypeOf(t) === Object.getPrototypeOf({});
|
|
134
134
|
}
|
|
135
135
|
function I(t, e) {
|
|
136
136
|
if (t === e)
|
|
137
137
|
return !0;
|
|
138
|
-
if (
|
|
138
|
+
if (w(t) || w(e))
|
|
139
139
|
return !1;
|
|
140
|
-
if (
|
|
140
|
+
if (z(t) && z(e)) {
|
|
141
141
|
const n = Object.keys(t), o = Object.keys(e);
|
|
142
142
|
if (n.length !== o.length)
|
|
143
143
|
return !1;
|
|
@@ -165,20 +165,20 @@ function ye(t, e) {
|
|
|
165
165
|
};
|
|
166
166
|
return e == null ? n : n(e);
|
|
167
167
|
}
|
|
168
|
-
function
|
|
168
|
+
function Ie() {
|
|
169
169
|
if (typeof window < "u" && window.console)
|
|
170
170
|
return window.console;
|
|
171
171
|
if (typeof global < "u" && global.console)
|
|
172
172
|
return global.console;
|
|
173
173
|
}
|
|
174
|
-
function
|
|
175
|
-
return
|
|
174
|
+
function Le(t) {
|
|
175
|
+
return fe({
|
|
176
176
|
str: t,
|
|
177
177
|
sat: { min: 0.35, max: 0.55 },
|
|
178
178
|
light: { min: 0.6, max: 0.6 }
|
|
179
179
|
});
|
|
180
180
|
}
|
|
181
|
-
function
|
|
181
|
+
function qe(t) {
|
|
182
182
|
if (t instanceof RegExp)
|
|
183
183
|
return (o) => t.test(o);
|
|
184
184
|
const e = {
|
|
@@ -200,19 +200,29 @@ function Ge(t) {
|
|
|
200
200
|
return !(i.some((s) => s(o)) || r.length > 0 && !r.some((s) => s(o)));
|
|
201
201
|
};
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function w(t) {
|
|
204
204
|
return !(t == null || typeof t != "object" || typeof t.get != "function" || typeof t.watch != "function");
|
|
205
205
|
}
|
|
206
|
-
function
|
|
206
|
+
function B(t) {
|
|
207
207
|
return !(t == null || typeof t != "object" || typeof t.set != "function" || typeof t.get != "function" || typeof t.watch != "function");
|
|
208
208
|
}
|
|
209
209
|
function O(t) {
|
|
210
|
-
return
|
|
210
|
+
return w(t) ? t.get() : t;
|
|
211
211
|
}
|
|
212
|
-
function
|
|
213
|
-
return
|
|
212
|
+
function q(t) {
|
|
213
|
+
return B(t) ? {
|
|
214
|
+
get: t.get,
|
|
215
|
+
watch: t.watch
|
|
216
|
+
} : w(t) ? t : {
|
|
217
|
+
get() {
|
|
218
|
+
return t;
|
|
219
|
+
},
|
|
220
|
+
watch(e, n = {}) {
|
|
221
|
+
return n != null && n.lazy || e(t), me;
|
|
222
|
+
}
|
|
223
|
+
};
|
|
214
224
|
}
|
|
215
|
-
function
|
|
225
|
+
function Ge(t, e) {
|
|
216
226
|
const [n, o] = T(t, e);
|
|
217
227
|
return {
|
|
218
228
|
get: n.get,
|
|
@@ -220,31 +230,20 @@ function _e(t, e) {
|
|
|
220
230
|
set: o
|
|
221
231
|
};
|
|
222
232
|
}
|
|
223
|
-
function
|
|
233
|
+
function _e(t, e) {
|
|
224
234
|
return {
|
|
225
235
|
get: t.get,
|
|
226
236
|
watch: t.watch,
|
|
227
237
|
set: e
|
|
228
238
|
};
|
|
229
239
|
}
|
|
230
|
-
function
|
|
240
|
+
function Re(t, e) {
|
|
231
241
|
return function(o) {
|
|
232
242
|
const r = t.get();
|
|
233
243
|
let i;
|
|
234
244
|
typeof o == "function" ? i = o(r) : i = o, e(i, r);
|
|
235
245
|
};
|
|
236
246
|
}
|
|
237
|
-
function R(t) {
|
|
238
|
-
return {
|
|
239
|
-
get() {
|
|
240
|
-
return t;
|
|
241
|
-
},
|
|
242
|
-
watch(e, n = {}) {
|
|
243
|
-
return n.lazy || e(t), function() {
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
247
|
function T(t, e) {
|
|
249
248
|
let n = t, o = [];
|
|
250
249
|
function r() {
|
|
@@ -272,9 +271,9 @@ function T(t, e) {
|
|
|
272
271
|
}
|
|
273
272
|
const ge = Symbol("EMPTY");
|
|
274
273
|
function be(t, e, n) {
|
|
275
|
-
t = t.map(
|
|
274
|
+
t = t.map(q);
|
|
276
275
|
let o = new Array(t.length).fill(ge, 0, t.length), r, i = [], s = !1, c = [], u, a;
|
|
277
|
-
function d(p =
|
|
276
|
+
function d(p = C()) {
|
|
278
277
|
for (const l of i)
|
|
279
278
|
l(p);
|
|
280
279
|
}
|
|
@@ -289,11 +288,11 @@ function be(t, e, n) {
|
|
|
289
288
|
break;
|
|
290
289
|
}
|
|
291
290
|
}
|
|
292
|
-
function
|
|
291
|
+
function C() {
|
|
293
292
|
return s || b(), a = O(r), a;
|
|
294
293
|
}
|
|
295
294
|
function v(p) {
|
|
296
|
-
p !== r && (u && (u(), u = void 0), r = p, a = O(p),
|
|
295
|
+
p !== r && (u && (u(), u = void 0), r = p, a = O(p), w(p) && s && (u = p.watch((l) => {
|
|
297
296
|
const y = O(l);
|
|
298
297
|
h(y, a) || (a = y, d(y));
|
|
299
298
|
})));
|
|
@@ -304,8 +303,8 @@ function be(t, e, n) {
|
|
|
304
303
|
const y = t[l];
|
|
305
304
|
c.push(
|
|
306
305
|
y.watch((g) => {
|
|
307
|
-
const
|
|
308
|
-
o[l] = g, s && !h(g,
|
|
306
|
+
const S = o[l];
|
|
307
|
+
o[l] = g, s && !h(g, S) && (v(e(...o)), d(O(r)));
|
|
309
308
|
})
|
|
310
309
|
);
|
|
311
310
|
}
|
|
@@ -323,21 +322,21 @@ function be(t, e, n) {
|
|
|
323
322
|
}
|
|
324
323
|
return {
|
|
325
324
|
get() {
|
|
326
|
-
return
|
|
325
|
+
return C();
|
|
327
326
|
},
|
|
328
327
|
watch(p, l) {
|
|
329
|
-
return s || $(), i.push(p), l != null && l.lazy || p(
|
|
328
|
+
return s || $(), i.push(p), l != null && l.lazy || p(C()), function() {
|
|
330
329
|
i.splice(i.indexOf(p), 1), s && i.length === 0 && k();
|
|
331
330
|
};
|
|
332
331
|
}
|
|
333
332
|
};
|
|
334
333
|
}
|
|
335
|
-
function
|
|
334
|
+
function G(t, e) {
|
|
336
335
|
if (t.length === 0)
|
|
337
|
-
throw new TypeError("Expected at least one
|
|
338
|
-
if (t.some((n) => !
|
|
339
|
-
throw new TypeError("All values must be
|
|
340
|
-
return t = t.map(
|
|
336
|
+
throw new TypeError("Expected at least one state.");
|
|
337
|
+
if (t.some((n) => !w(n)))
|
|
338
|
+
throw new TypeError("All values must be states");
|
|
339
|
+
return t = t.map(q), t.length > 1 ? be(t, e).watch(() => null) : t[0].watch(e);
|
|
341
340
|
}
|
|
342
341
|
function Ce(t) {
|
|
343
342
|
for (var e, n, o = arguments, r = 1, i = "", s = "", c = [0], u = function(h) {
|
|
@@ -383,7 +382,7 @@ class we {
|
|
|
383
382
|
for (const o of this.connectedContent)
|
|
384
383
|
o.unmount();
|
|
385
384
|
if (this.connectedContent = [], this.node.parentNode != null) {
|
|
386
|
-
e && this.thenContent ? this.connectedContent =
|
|
385
|
+
e && this.thenContent ? this.connectedContent = x(this.elementContext, this.thenContent) : !e && this.elseContent && (this.connectedContent = x(this.elementContext, this.elseContent));
|
|
387
386
|
for (let o = 0; o < this.connectedContent.length; o++) {
|
|
388
387
|
const r = this.connectedContent[o], i = ((n = this.connectedContent[o - 1]) == null ? void 0 : n.node) ?? this.node;
|
|
389
388
|
r.mount(this.node.parentNode, i);
|
|
@@ -393,7 +392,7 @@ class we {
|
|
|
393
392
|
}
|
|
394
393
|
}
|
|
395
394
|
const ve = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
396
|
-
let
|
|
395
|
+
let J = (t = 21) => {
|
|
397
396
|
let e = "", n = crypto.getRandomValues(new Uint8Array(t |= 0));
|
|
398
397
|
for (; t--; )
|
|
399
398
|
e += ve[n[t] & 63];
|
|
@@ -407,20 +406,20 @@ class $e {
|
|
|
407
406
|
f(this, "children");
|
|
408
407
|
f(this, "stopCallbacks", []);
|
|
409
408
|
f(this, "elementContext");
|
|
410
|
-
f(this, "uniqueId",
|
|
409
|
+
f(this, "uniqueId", J());
|
|
411
410
|
// Track the ref so we can nullify it on unmount.
|
|
412
411
|
f(this, "ref");
|
|
413
412
|
// Prevents 'onClickOutside' handlers from firing in the same cycle in which the element is connected.
|
|
414
413
|
f(this, "canClickAway", !1);
|
|
415
414
|
if (r = { ...r }, e.toLowerCase() === "svg" && (r.isSVG = !0), r.isSVG ? this.node = document.createElementNS("http://www.w3.org/2000/svg", e) : this.node = document.createElement(e), r.root.getEnv() === "development" && (this.node.dataset.uniqueId = this.uniqueId), n.ref)
|
|
416
|
-
if (
|
|
415
|
+
if (oe(n.ref))
|
|
417
416
|
this.ref = n.ref;
|
|
418
417
|
else
|
|
419
418
|
throw new Error("Expected ref to be a Ref object. Got: " + n.ref);
|
|
420
419
|
this.props = {
|
|
421
420
|
...ye(["ref", "class", "className"], n),
|
|
422
421
|
class: n.className ?? n.class
|
|
423
|
-
}, this.children = o ?
|
|
422
|
+
}, this.children = o ? x(r, o) : [], this.elementContext = r;
|
|
424
423
|
}
|
|
425
424
|
get isMounted() {
|
|
426
425
|
return this.node.parentNode != null;
|
|
@@ -453,7 +452,7 @@ class $e {
|
|
|
453
452
|
}
|
|
454
453
|
applyProps(e, n) {
|
|
455
454
|
const o = (r, i, s) => {
|
|
456
|
-
|
|
455
|
+
w(r) ? this.stopCallbacks.push(
|
|
457
456
|
r.watch((c) => {
|
|
458
457
|
this.elementContext.root.render.update(() => {
|
|
459
458
|
i(c);
|
|
@@ -478,21 +477,21 @@ class $e {
|
|
|
478
477
|
} else if (r === "eventListeners") {
|
|
479
478
|
const s = i;
|
|
480
479
|
for (const c in s) {
|
|
481
|
-
const u =
|
|
480
|
+
const u = w(i) ? (a) => i.get()(a) : i;
|
|
482
481
|
e.addEventListener(c, u), this.stopCallbacks.push(() => {
|
|
483
482
|
e.removeEventListener(c, u);
|
|
484
483
|
});
|
|
485
484
|
}
|
|
486
485
|
} else if (r === "onClickOutside" || r === "onclickoutside") {
|
|
487
486
|
const s = (u) => {
|
|
488
|
-
this.canClickAway && !e.contains(u.target) && (
|
|
487
|
+
this.canClickAway && !e.contains(u.target) && (w(i) ? i.get()(u) : i(u));
|
|
489
488
|
}, c = { capture: !0 };
|
|
490
489
|
window.addEventListener("click", s, c), this.stopCallbacks.push(() => {
|
|
491
490
|
window.removeEventListener("click", s, c);
|
|
492
491
|
});
|
|
493
492
|
} else if (r === "$$value") {
|
|
494
|
-
if (!
|
|
495
|
-
throw new TypeError(`$$value attribute must be a settable
|
|
493
|
+
if (!B(i))
|
|
494
|
+
throw new TypeError(`$$value attribute must be a settable state. Got: ${i}`);
|
|
496
495
|
o(
|
|
497
496
|
i,
|
|
498
497
|
(c) => {
|
|
@@ -508,7 +507,7 @@ class $e {
|
|
|
508
507
|
e.removeEventListener("input", s);
|
|
509
508
|
});
|
|
510
509
|
} else if (ke(r)) {
|
|
511
|
-
const s = r.slice(2).toLowerCase(), c =
|
|
510
|
+
const s = r.slice(2).toLowerCase(), c = w(i) ? (u) => i.get()(u) : i;
|
|
512
511
|
e.addEventListener(s, c), this.stopCallbacks.push(() => {
|
|
513
512
|
e.removeEventListener(s, c);
|
|
514
513
|
});
|
|
@@ -520,7 +519,7 @@ class $e {
|
|
|
520
519
|
},
|
|
521
520
|
this.getUpdateKey("attr", r)
|
|
522
521
|
);
|
|
523
|
-
else if (!
|
|
522
|
+
else if (!xe.includes(r))
|
|
524
523
|
if (this.elementContext.isSVG)
|
|
525
524
|
o(
|
|
526
525
|
i,
|
|
@@ -599,7 +598,7 @@ class $e {
|
|
|
599
598
|
}
|
|
600
599
|
applyStyles(e, n, o) {
|
|
601
600
|
const r = [];
|
|
602
|
-
if (
|
|
601
|
+
if (w(n)) {
|
|
603
602
|
let i;
|
|
604
603
|
const s = n.watch((c) => {
|
|
605
604
|
this.elementContext.root.render.update(
|
|
@@ -611,17 +610,17 @@ class $e {
|
|
|
611
610
|
});
|
|
612
611
|
o.push(s), r.push(s);
|
|
613
612
|
} else {
|
|
614
|
-
const i =
|
|
613
|
+
const i = X(n);
|
|
615
614
|
for (const s in i) {
|
|
616
615
|
const { value: c, priority: u } = i[s];
|
|
617
|
-
if (
|
|
616
|
+
if (w(c)) {
|
|
618
617
|
const a = c.watch((d) => {
|
|
619
618
|
this.elementContext.root.render.update(() => {
|
|
620
619
|
d ? e.style.setProperty(s, String(d), u) : e.style.removeProperty(s);
|
|
621
620
|
});
|
|
622
621
|
});
|
|
623
622
|
o.push(a), r.push(a);
|
|
624
|
-
} else c && e.style.setProperty(s, String(c));
|
|
623
|
+
} else c != null && e.style.setProperty(s, String(c));
|
|
625
624
|
}
|
|
626
625
|
}
|
|
627
626
|
return function() {
|
|
@@ -631,7 +630,7 @@ class $e {
|
|
|
631
630
|
}
|
|
632
631
|
applyClasses(e, n, o) {
|
|
633
632
|
const r = [];
|
|
634
|
-
if (
|
|
633
|
+
if (w(n)) {
|
|
635
634
|
let i;
|
|
636
635
|
const s = n.watch((c) => {
|
|
637
636
|
this.elementContext.root.render.update(
|
|
@@ -643,10 +642,10 @@ class $e {
|
|
|
643
642
|
});
|
|
644
643
|
o.push(s), r.push(s);
|
|
645
644
|
} else {
|
|
646
|
-
const i =
|
|
645
|
+
const i = Q(n);
|
|
647
646
|
for (const s in i) {
|
|
648
647
|
const c = i[s];
|
|
649
|
-
if (
|
|
648
|
+
if (w(c)) {
|
|
650
649
|
const u = c.watch((a) => {
|
|
651
650
|
this.elementContext.root.render.update(() => {
|
|
652
651
|
a ? e.classList.add(s) : e.classList.remove(s);
|
|
@@ -662,18 +661,18 @@ class $e {
|
|
|
662
661
|
};
|
|
663
662
|
}
|
|
664
663
|
}
|
|
665
|
-
function
|
|
664
|
+
function Q(t) {
|
|
666
665
|
let e = {};
|
|
667
666
|
if (M(t)) {
|
|
668
667
|
const n = t.split(" ");
|
|
669
668
|
for (const o of n)
|
|
670
669
|
e[o] = !0;
|
|
671
670
|
} else L(t) ? Object.assign(e, t) : Array.isArray(t) && Array.from(t).filter((n) => n != null).forEach((n) => {
|
|
672
|
-
Object.assign(e,
|
|
671
|
+
Object.assign(e, Q(n));
|
|
673
672
|
});
|
|
674
673
|
return e;
|
|
675
674
|
}
|
|
676
|
-
function
|
|
675
|
+
function X(t) {
|
|
677
676
|
let e = {};
|
|
678
677
|
if (M(t)) {
|
|
679
678
|
const n = t.split(";").filter((o) => o.trim() !== "");
|
|
@@ -681,27 +680,27 @@ function ee(t) {
|
|
|
681
680
|
const [r, i] = o.split(":"), s = {
|
|
682
681
|
value: i
|
|
683
682
|
};
|
|
684
|
-
i.includes("!important") ? (s.priority = "important", s.value = i.replace("!important", "").trim()) : s.value = i.trim(), e[
|
|
683
|
+
i.includes("!important") ? (s.priority = "important", s.value = i.replace("!important", "").trim()) : s.value = i.trim(), e[D(r.trim())] = s;
|
|
685
684
|
}
|
|
686
685
|
}
|
|
687
686
|
if (L(t))
|
|
688
687
|
for (const n in t)
|
|
689
|
-
e[
|
|
688
|
+
n.startsWith("--") ? e[n] = { value: t[n] } : e[D(n)] = { value: t[n] };
|
|
690
689
|
else Array.isArray(t) && Array.from(t).filter((n) => n != null).forEach((n) => {
|
|
691
|
-
Object.assign(e,
|
|
690
|
+
Object.assign(e, X(n));
|
|
692
691
|
});
|
|
693
692
|
return e;
|
|
694
693
|
}
|
|
695
|
-
function
|
|
694
|
+
function D(t) {
|
|
696
695
|
return t.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (e, n) => (n ? "-" : "") + e.toLowerCase());
|
|
697
696
|
}
|
|
698
697
|
function Ne(t, e) {
|
|
699
698
|
const n = typeof t;
|
|
700
699
|
return n === "string" ? String(e) : n === "number" ? Number(e) : n === "boolean" ? !!e : e;
|
|
701
700
|
}
|
|
702
|
-
const
|
|
703
|
-
class
|
|
704
|
-
constructor({
|
|
701
|
+
const xe = ["ref", "children", "class", "style", "data"];
|
|
702
|
+
class Se {
|
|
703
|
+
constructor({ states: e, renderFn: n, elementContext: o }) {
|
|
705
704
|
f(this, "node");
|
|
706
705
|
f(this, "endNode");
|
|
707
706
|
f(this, "connectedViews", []);
|
|
@@ -712,11 +711,11 @@ class xe {
|
|
|
712
711
|
let r;
|
|
713
712
|
this.observerControls = {
|
|
714
713
|
start: () => {
|
|
715
|
-
r == null && (r =
|
|
714
|
+
r == null && (r = G(e, (...i) => {
|
|
716
715
|
const s = this.renderFn(...i);
|
|
717
|
-
if (!
|
|
716
|
+
if (!ie(s))
|
|
718
717
|
throw console.error(s), new TypeError(
|
|
719
|
-
`Observer received invalid value to render. Got type: ${
|
|
718
|
+
`Observer received invalid value to render. Got type: ${_(s)}, value: ${s}`
|
|
720
719
|
);
|
|
721
720
|
Array.isArray(s) ? this.update(...s) : this.update(s);
|
|
722
721
|
}));
|
|
@@ -745,7 +744,7 @@ class xe {
|
|
|
745
744
|
var o, r;
|
|
746
745
|
if (this.cleanup(), e == null || !this.isMounted)
|
|
747
746
|
return;
|
|
748
|
-
const n = e.map((i) =>
|
|
747
|
+
const n = e.map((i) => ne(i) ? i : V(i) ? A(x(this.elementContext, i)) : A(x(this.elementContext, j(i))));
|
|
749
748
|
for (const i of n) {
|
|
750
749
|
const s = ((o = this.connectedViews.at(-1)) == null ? void 0 : o.node) || this.node;
|
|
751
750
|
i.mount(this.node.parentNode, s), this.connectedViews.push(i);
|
|
@@ -808,18 +807,18 @@ class Ae {
|
|
|
808
807
|
}
|
|
809
808
|
mount(e, n) {
|
|
810
809
|
const { content: o, parent: r } = this.config;
|
|
811
|
-
|
|
810
|
+
ne(o) ? this.handle = o : V(o) ? this.handle = A(x(this.config.elementContext, o)) : this.handle = A(x(this.config.elementContext, j(o))), this.handle.mount(r);
|
|
812
811
|
}
|
|
813
812
|
unmount() {
|
|
814
813
|
var e;
|
|
815
814
|
(e = this.handle) != null && e.isMounted && this.handle.unmount();
|
|
816
815
|
}
|
|
817
816
|
}
|
|
818
|
-
function
|
|
817
|
+
function ee(t, e, n, o = []) {
|
|
819
818
|
t = { ...t };
|
|
820
|
-
const [r, i] = T(
|
|
819
|
+
const [r, i] = T(x(t, o));
|
|
821
820
|
let s = !1;
|
|
822
|
-
const c = [], u = [], a = [], d = [], h = [], b =
|
|
821
|
+
const c = [], u = [], a = [], d = [], h = [], b = J(), [C, v] = T(e.name), $ = t.root.createLogger(C, { uid: b }), k = {
|
|
823
822
|
get uid() {
|
|
824
823
|
return b;
|
|
825
824
|
},
|
|
@@ -840,14 +839,14 @@ function te(t, e, n, o = []) {
|
|
|
840
839
|
},
|
|
841
840
|
watch(l, y) {
|
|
842
841
|
if (s) {
|
|
843
|
-
const g =
|
|
842
|
+
const g = G(l, y);
|
|
844
843
|
return c.push(g), g;
|
|
845
844
|
} else {
|
|
846
|
-
let g,
|
|
845
|
+
let g, S = !1;
|
|
847
846
|
return a.push(() => {
|
|
848
|
-
|
|
847
|
+
S || (g = G(l, y), c.push(g));
|
|
849
848
|
}), function F() {
|
|
850
|
-
F != null && (
|
|
849
|
+
F != null && (S = !0, F());
|
|
851
850
|
};
|
|
852
851
|
}
|
|
853
852
|
},
|
|
@@ -867,16 +866,16 @@ function te(t, e, n, o = []) {
|
|
|
867
866
|
if (l instanceof Promise)
|
|
868
867
|
throw new TypeError("View function cannot return a Promise.");
|
|
869
868
|
if (l !== null) if (l instanceof Node)
|
|
870
|
-
m = A(
|
|
871
|
-
else if (V(l) ||
|
|
872
|
-
m = A(
|
|
873
|
-
else if (
|
|
869
|
+
m = A(x(t, N("$node", { value: l })));
|
|
870
|
+
else if (V(l) || Z(V, l))
|
|
871
|
+
m = A(x(t, l));
|
|
872
|
+
else if (w(l))
|
|
874
873
|
m = A(
|
|
875
|
-
|
|
874
|
+
x(t, N("$observer", { states: [l], renderFn: (y) => y }))
|
|
876
875
|
);
|
|
877
876
|
else {
|
|
878
877
|
const y = new TypeError(
|
|
879
|
-
`Expected '${e.name}' function to return a DOM node, Markup element, Readable or null. Got: ${
|
|
878
|
+
`Expected '${e.name}' function to return a DOM node, Markup element, Readable or null. Got: ${_(l)}`
|
|
880
879
|
);
|
|
881
880
|
$.crash(y);
|
|
882
881
|
}
|
|
@@ -960,14 +959,14 @@ class Me {
|
|
|
960
959
|
if (a)
|
|
961
960
|
a.setValue(u.value), a.setIndex(u.index), r[u.index] = a;
|
|
962
961
|
else {
|
|
963
|
-
const [d, h] = T(u.value), [b,
|
|
962
|
+
const [d, h] = T(u.value), [b, C] = T(u.index);
|
|
964
963
|
r[u.index] = {
|
|
965
964
|
key: u.key,
|
|
966
965
|
$value: d,
|
|
967
966
|
setValue: h,
|
|
968
967
|
$index: b,
|
|
969
|
-
setIndex:
|
|
970
|
-
handle:
|
|
968
|
+
setIndex: C,
|
|
969
|
+
handle: ee(this.elementContext, Oe, {
|
|
971
970
|
$value: d,
|
|
972
971
|
$index: b,
|
|
973
972
|
renderFn: this.renderFn
|
|
@@ -1000,7 +999,7 @@ class Te {
|
|
|
1000
999
|
return this.node.parentNode != null;
|
|
1001
1000
|
}
|
|
1002
1001
|
async mount(e, n = null) {
|
|
1003
|
-
this.isMounted || (
|
|
1002
|
+
this.isMounted || (w(this.value) ? this.stopCallback = this.value.watch((o) => {
|
|
1004
1003
|
this.update(o);
|
|
1005
1004
|
}) : this.update(this.value)), e.insertBefore(this.node, (n == null ? void 0 : n.nextSibling) ?? null);
|
|
1006
1005
|
}
|
|
@@ -1011,26 +1010,26 @@ class Te {
|
|
|
1011
1010
|
e != null ? this.node.textContent = e.toString() : this.node.textContent = "";
|
|
1012
1011
|
}
|
|
1013
1012
|
}
|
|
1014
|
-
const
|
|
1013
|
+
const te = Symbol("Markup");
|
|
1015
1014
|
function V(t) {
|
|
1016
|
-
return L(t) && t[
|
|
1015
|
+
return L(t) && t[te] === !0;
|
|
1017
1016
|
}
|
|
1018
|
-
function
|
|
1017
|
+
function ne(t) {
|
|
1019
1018
|
return L(t) && E(t.connect) && E(t.disconnect);
|
|
1020
1019
|
}
|
|
1021
1020
|
function j(t) {
|
|
1022
1021
|
return P(t) || (t = [t]), t.flat(1 / 0).filter((e) => e != null && e !== !1).map((e) => {
|
|
1023
1022
|
if (e instanceof Node)
|
|
1024
1023
|
return N("$node", { value: e });
|
|
1025
|
-
if (e instanceof
|
|
1024
|
+
if (e instanceof re)
|
|
1026
1025
|
return N("$node", { value: e.node });
|
|
1027
1026
|
if (V(e))
|
|
1028
1027
|
return e;
|
|
1029
|
-
if (M(e) ||
|
|
1028
|
+
if (M(e) || he(e))
|
|
1030
1029
|
return N("$text", { value: e });
|
|
1031
|
-
if (
|
|
1030
|
+
if (w(e))
|
|
1032
1031
|
return N("$observer", {
|
|
1033
|
-
|
|
1032
|
+
states: [e],
|
|
1034
1033
|
renderFn: (n) => n
|
|
1035
1034
|
});
|
|
1036
1035
|
throw console.error(e), new TypeError(`Unexpected child type. Got: ${e}`);
|
|
@@ -1038,25 +1037,25 @@ function j(t) {
|
|
|
1038
1037
|
}
|
|
1039
1038
|
function N(t, e, ...n) {
|
|
1040
1039
|
return e != null && Ve(e), {
|
|
1041
|
-
[
|
|
1040
|
+
[te]: !0,
|
|
1042
1041
|
type: t,
|
|
1043
1042
|
props: e,
|
|
1044
1043
|
children: j(n)
|
|
1045
1044
|
};
|
|
1046
1045
|
}
|
|
1047
1046
|
function Ve(t) {
|
|
1048
|
-
if (t.ref && !
|
|
1047
|
+
if (t.ref && !oe(t.ref))
|
|
1049
1048
|
throw console.warn(t.ref), new TypeError(`Prop 'ref' must be a Ref object. Got: ${t.ref}`);
|
|
1050
1049
|
for (const e in t)
|
|
1051
1050
|
if (e.startsWith("$$") && t[e] !== void 0) {
|
|
1052
|
-
if (!
|
|
1053
|
-
throw new TypeError(`Prop '${e}' is named as a
|
|
1054
|
-
} else if (e.startsWith("$") && t[e] !== void 0 && !
|
|
1055
|
-
throw new TypeError(`Prop '${e}' is named as a
|
|
1051
|
+
if (!B(t[e]))
|
|
1052
|
+
throw new TypeError(`Prop '${e}' is named as a SettableState but value is not. Got: ${t[e]}`);
|
|
1053
|
+
} else if (e.startsWith("$") && t[e] !== void 0 && !w(t[e]))
|
|
1054
|
+
throw new TypeError(`Prop '${e}' is named as a State but value is not. Got: ${t[e]}`);
|
|
1056
1055
|
}
|
|
1057
|
-
const
|
|
1058
|
-
function
|
|
1059
|
-
const o =
|
|
1056
|
+
const Be = Ce.bind(N);
|
|
1057
|
+
function Ke(t, e, n) {
|
|
1058
|
+
const o = q(t);
|
|
1060
1059
|
return N("$cond", {
|
|
1061
1060
|
$predicate: o,
|
|
1062
1061
|
thenContent: e,
|
|
@@ -1064,13 +1063,13 @@ function He(t, e, n) {
|
|
|
1064
1063
|
});
|
|
1065
1064
|
}
|
|
1066
1065
|
function We(t, e, n) {
|
|
1067
|
-
const o =
|
|
1066
|
+
const o = q(t);
|
|
1068
1067
|
return N("$repeat", { $items: o, keyFn: e, renderFn: n });
|
|
1069
1068
|
}
|
|
1070
|
-
function
|
|
1069
|
+
function He(t, e) {
|
|
1071
1070
|
return N("$portal", { parent: t, content: e });
|
|
1072
1071
|
}
|
|
1073
|
-
function
|
|
1072
|
+
function ze() {
|
|
1074
1073
|
const [t, e] = T();
|
|
1075
1074
|
return {
|
|
1076
1075
|
get: t.get,
|
|
@@ -1083,10 +1082,10 @@ function De() {
|
|
|
1083
1082
|
}
|
|
1084
1083
|
};
|
|
1085
1084
|
}
|
|
1086
|
-
function
|
|
1085
|
+
function oe(t) {
|
|
1087
1086
|
return !(t == null || typeof t != "object" || !t.hasOwnProperty("node"));
|
|
1088
1087
|
}
|
|
1089
|
-
class
|
|
1088
|
+
class re {
|
|
1090
1089
|
constructor(e) {
|
|
1091
1090
|
f(this, "node");
|
|
1092
1091
|
this.node = e;
|
|
@@ -1101,15 +1100,15 @@ class ie {
|
|
|
1101
1100
|
this.node.parentNode && this.node.parentNode.removeChild(this.node);
|
|
1102
1101
|
}
|
|
1103
1102
|
}
|
|
1104
|
-
function
|
|
1103
|
+
function x(t, e) {
|
|
1105
1104
|
return (P(e) ? e : [e]).map((o) => {
|
|
1106
1105
|
if (E(o.type))
|
|
1107
|
-
return
|
|
1106
|
+
return ee(t, o.type, o.props, o.children);
|
|
1108
1107
|
if (M(o.type))
|
|
1109
1108
|
switch (o.type) {
|
|
1110
1109
|
case "$node": {
|
|
1111
1110
|
const r = o.props;
|
|
1112
|
-
return new
|
|
1111
|
+
return new re(r.value);
|
|
1113
1112
|
}
|
|
1114
1113
|
case "$text": {
|
|
1115
1114
|
const r = o.props;
|
|
@@ -1137,8 +1136,8 @@ function S(t, e) {
|
|
|
1137
1136
|
}
|
|
1138
1137
|
case "$observer": {
|
|
1139
1138
|
const r = o.props;
|
|
1140
|
-
return new
|
|
1141
|
-
|
|
1139
|
+
return new Se({
|
|
1140
|
+
states: r.states,
|
|
1142
1141
|
renderFn: r.renderFn,
|
|
1143
1142
|
elementContext: t
|
|
1144
1143
|
});
|
|
@@ -1203,43 +1202,43 @@ function A(t) {
|
|
|
1203
1202
|
}
|
|
1204
1203
|
};
|
|
1205
1204
|
}
|
|
1206
|
-
function
|
|
1207
|
-
return t == null || t === !1 || typeof t == "string" || typeof t == "number" || V(t) ||
|
|
1205
|
+
function ie(t) {
|
|
1206
|
+
return t == null || t === !1 || typeof t == "string" || typeof t == "number" || V(t) || w(t) || Z(ie, t);
|
|
1208
1207
|
}
|
|
1209
|
-
function
|
|
1208
|
+
function De(t, e) {
|
|
1210
1209
|
return e.outlet();
|
|
1211
1210
|
}
|
|
1212
1211
|
export {
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1212
|
+
x as A,
|
|
1213
|
+
Re as B,
|
|
1214
|
+
He as C,
|
|
1216
1215
|
We as D,
|
|
1217
|
-
|
|
1218
|
-
|
|
1216
|
+
De as P,
|
|
1217
|
+
w as a,
|
|
1219
1218
|
I as b,
|
|
1220
|
-
|
|
1219
|
+
Ke as c,
|
|
1221
1220
|
be as d,
|
|
1222
1221
|
E as e,
|
|
1223
1222
|
M as f,
|
|
1224
1223
|
T as g,
|
|
1225
|
-
|
|
1224
|
+
Be as h,
|
|
1226
1225
|
L as i,
|
|
1227
1226
|
je as j,
|
|
1228
1227
|
Fe as k,
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1228
|
+
qe as l,
|
|
1229
|
+
Ge as m,
|
|
1230
|
+
_e as n,
|
|
1231
|
+
ze as o,
|
|
1232
|
+
oe as p,
|
|
1234
1233
|
Ue as q,
|
|
1235
1234
|
N as r,
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1235
|
+
Ie as s,
|
|
1236
|
+
q as t,
|
|
1237
|
+
me as u,
|
|
1238
|
+
O as v,
|
|
1239
|
+
G as w,
|
|
1240
|
+
Le as x,
|
|
1241
|
+
ee as y,
|
|
1243
1242
|
A as z
|
|
1244
1243
|
};
|
|
1245
|
-
//# sourceMappingURL=passthrough-
|
|
1244
|
+
//# sourceMappingURL=passthrough-CW8Ezjg-.js.map
|