@manyducks.co/dolla 2.0.0-alpha.5 → 2.0.0-alpha.50

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