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