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