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