@manyducks.co/dolla 2.0.0-alpha.6 → 2.0.0-alpha.61

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