@manyducks.co/dolla 2.0.0-alpha.53 → 2.0.0-alpha.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -12
- package/dist/core/context.d.ts +80 -54
- package/dist/core/index.d.ts +8 -7
- package/dist/core/logger.d.ts +9 -4
- package/dist/core/markup.d.ts +10 -10
- package/dist/core/mount.d.ts +11 -6
- package/dist/core/nodes/dynamic.d.ts +3 -3
- package/dist/core/nodes/html.d.ts +6 -5
- package/dist/core/nodes/outlet.d.ts +3 -4
- package/dist/core/nodes/portal.d.ts +2 -2
- package/dist/core/nodes/repeat.d.ts +6 -6
- package/dist/core/nodes/view.d.ts +13 -81
- package/dist/core/symbols.d.ts +0 -2
- package/dist/core/views/default-crash-view.d.ts +5 -1
- package/dist/core/views/fragment.d.ts +2 -2
- package/dist/fragment-VXM-P2tT.js +7 -0
- package/dist/fragment-VXM-P2tT.js.map +1 -0
- package/dist/http.js +1 -1
- package/dist/i18n.js +14 -14
- package/dist/i18n.js.map +1 -1
- package/dist/index.js +54 -61
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.js +8 -8
- package/dist/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx-runtime.js +9 -9
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/{logger-CByUPmlz.js → logger-CXdzxt1e.js} +178 -176
- package/dist/{logger-CByUPmlz.js.map → logger-CXdzxt1e.js.map} +1 -1
- package/dist/markup-yTuFdC0t.js +923 -0
- package/dist/markup-yTuFdC0t.js.map +1 -0
- package/dist/router/router.d.ts +9 -6
- package/dist/router-B-rtBG7i.js +488 -0
- package/dist/router-B-rtBG7i.js.map +1 -0
- package/dist/router.js +1 -1
- package/dist/router.js.map +1 -1
- package/dist/{typeChecking-EAVNeFyB.js → typeChecking-lgllKIVq.js} +5 -5
- package/dist/{typeChecking-EAVNeFyB.js.map → typeChecking-lgllKIVq.js.map} +1 -1
- package/dist/types.d.ts +21 -0
- package/docs/mixins.md +32 -0
- package/docs/ref.md +93 -0
- package/index.d.ts +1 -1
- package/notes/mixins.md +22 -0
- package/notes/scratch.md +24 -0
- package/package.json +2 -2
- package/dist/core/store.d.ts +0 -57
- package/dist/core/views/passthrough.d.ts +0 -5
- package/dist/fragment-DFnx8z2z.js +0 -8
- package/dist/fragment-DFnx8z2z.js.map +0 -1
- package/dist/router-W2HPWbeI.js +0 -482
- package/dist/router-W2HPWbeI.js.map +0 -1
- package/dist/view-CAEIbcZt.js +0 -932
- package/dist/view-CAEIbcZt.js.map +0 -1
package/dist/view-CAEIbcZt.js
DELETED
|
@@ -1,932 +0,0 @@
|
|
|
1
|
-
var ee = Object.defineProperty;
|
|
2
|
-
var te = (n, e, t) => e in n ? ee(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
-
var r = (n, e, t) => te(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { t as G, g as f, c as h, i as C, b as $, h as se, j as D } from "./typeChecking-EAVNeFyB.js";
|
|
5
|
-
import { e as d, p as y, g as w, b as ne, j as ie, $ as N, d as oe, k as R, f as z } from "./logger-CByUPmlz.js";
|
|
6
|
-
const W = /* @__PURE__ */ new Map(), S = {
|
|
7
|
-
stores: W
|
|
8
|
-
}, p = Symbol.for("DollaMarkupElement");
|
|
9
|
-
var _;
|
|
10
|
-
_ = p;
|
|
11
|
-
class I {
|
|
12
|
-
constructor(e) {
|
|
13
|
-
r(this, _, !0);
|
|
14
|
-
r(this, "domNode");
|
|
15
|
-
this.domNode = e;
|
|
16
|
-
}
|
|
17
|
-
get isMounted() {
|
|
18
|
-
return this.domNode.parentNode != null;
|
|
19
|
-
}
|
|
20
|
-
mount(e, t) {
|
|
21
|
-
e.insertBefore(this.domNode, (t == null ? void 0 : t.nextSibling) ?? null);
|
|
22
|
-
}
|
|
23
|
-
unmount(e = !1) {
|
|
24
|
-
this.domNode.parentNode && !e && this.domNode.parentNode.removeChild(this.domNode);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
var F;
|
|
28
|
-
F = p;
|
|
29
|
-
class re {
|
|
30
|
-
constructor(e) {
|
|
31
|
-
r(this, F, !0);
|
|
32
|
-
r(this, "domNode", document.createTextNode(""));
|
|
33
|
-
r(this, "children", []);
|
|
34
|
-
r(this, "elementContext");
|
|
35
|
-
r(this, "source");
|
|
36
|
-
r(this, "unsubscribe");
|
|
37
|
-
this.source = e.source, this.elementContext = e.elementContext;
|
|
38
|
-
}
|
|
39
|
-
get isMounted() {
|
|
40
|
-
return this.domNode.parentNode != null;
|
|
41
|
-
}
|
|
42
|
-
mount(e, t) {
|
|
43
|
-
this.isMounted || (e.insertBefore(this.domNode, (t == null ? void 0 : t.nextSibling) ?? null), this.unsubscribe = d(() => {
|
|
44
|
-
try {
|
|
45
|
-
const s = this.source();
|
|
46
|
-
if (!X(s))
|
|
47
|
-
throw console.error(s), new TypeError(
|
|
48
|
-
`Dynamic received invalid value to render. Got type: ${G(s)}, value: ${s}`
|
|
49
|
-
);
|
|
50
|
-
y(() => {
|
|
51
|
-
this.update(f(s) ? s : [s]);
|
|
52
|
-
});
|
|
53
|
-
} catch (s) {
|
|
54
|
-
const i = this.elementContext.view.logger;
|
|
55
|
-
i.error(s), i.crash(s);
|
|
56
|
-
}
|
|
57
|
-
}));
|
|
58
|
-
}
|
|
59
|
-
unmount(e = !1) {
|
|
60
|
-
var t, s;
|
|
61
|
-
(t = this.unsubscribe) == null || t.call(this), this.isMounted && (this.cleanup(e), (s = this.domNode.parentNode) == null || s.removeChild(this.domNode));
|
|
62
|
-
}
|
|
63
|
-
cleanup(e) {
|
|
64
|
-
for (const t of this.children)
|
|
65
|
-
t.unmount(e);
|
|
66
|
-
this.children = [];
|
|
67
|
-
}
|
|
68
|
-
update(e) {
|
|
69
|
-
var o, u, c;
|
|
70
|
-
if (this.cleanup(!1), e == null || e.length === 0 || !this.isMounted)
|
|
71
|
-
return;
|
|
72
|
-
const t = e.flatMap((a) => J(a) ? a : g(this.elementContext, M(a)));
|
|
73
|
-
for (const a of t) {
|
|
74
|
-
const l = ((o = this.children.at(-1)) == null ? void 0 : o.domNode) || this.domNode;
|
|
75
|
-
a.mount(this.domNode.parentNode, l), this.children.push(a);
|
|
76
|
-
}
|
|
77
|
-
const s = this.domNode.parentNode, i = ((c = (u = this.children.at(-1)) == null ? void 0 : u.domNode) == null ? void 0 : c.nextSibling) ?? null;
|
|
78
|
-
"moveBefore" in s ? s.moveBefore(this.domNode, i) : s.insertBefore(this.domNode, i);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
var U;
|
|
82
|
-
U = p;
|
|
83
|
-
class Z {
|
|
84
|
-
constructor(e) {
|
|
85
|
-
r(this, U, !0);
|
|
86
|
-
r(this, "domNode", document.createTextNode(""));
|
|
87
|
-
r(this, "isMounted", !1);
|
|
88
|
-
r(this, "source");
|
|
89
|
-
r(this, "elements", []);
|
|
90
|
-
r(this, "unsubscribe");
|
|
91
|
-
this.source = e;
|
|
92
|
-
}
|
|
93
|
-
mount(e, t) {
|
|
94
|
-
this.isMounted || (this.isMounted = !0, e.insertBefore(this.domNode, (t == null ? void 0 : t.nextSibling) ?? null), h(this.source) ? this.unsubscribe = d(() => {
|
|
95
|
-
const s = w(this.source);
|
|
96
|
-
y(() => {
|
|
97
|
-
this.update(s);
|
|
98
|
-
});
|
|
99
|
-
}) : this.update(this.elements));
|
|
100
|
-
}
|
|
101
|
-
unmount(e = !1) {
|
|
102
|
-
this.unsubscribe && (this.unsubscribe(), this.unsubscribe = void 0), this.isMounted && (this.cleanup(e), this.isMounted = !1);
|
|
103
|
-
}
|
|
104
|
-
cleanup(e) {
|
|
105
|
-
for (const t of this.elements)
|
|
106
|
-
t.unmount(e);
|
|
107
|
-
this.elements = [];
|
|
108
|
-
}
|
|
109
|
-
update(e) {
|
|
110
|
-
var t, s;
|
|
111
|
-
if (this.cleanup(!1), e.length > 0) {
|
|
112
|
-
for (let i = 0; i < e.length; i++) {
|
|
113
|
-
const o = e[i], u = i > 0 ? this.elements[i - 1] : void 0;
|
|
114
|
-
o.mount(this.domNode.parentElement, u == null ? void 0 : u.domNode), this.elements.push(o);
|
|
115
|
-
}
|
|
116
|
-
(s = this.domNode.parentNode) == null || s.insertBefore(this.domNode, ((t = this.elements.at(-1)) == null ? void 0 : t.domNode) ?? null);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
const ue = (n) => /^on[A-Z]/.test(n);
|
|
121
|
-
var T;
|
|
122
|
-
T = p;
|
|
123
|
-
class ce {
|
|
124
|
-
constructor({ tag: e, props: t, children: s, elementContext: i }) {
|
|
125
|
-
r(this, T, !0);
|
|
126
|
-
r(this, "domNode");
|
|
127
|
-
r(this, "props");
|
|
128
|
-
r(this, "childMarkup", []);
|
|
129
|
-
r(this, "children", []);
|
|
130
|
-
r(this, "unsubscribers", []);
|
|
131
|
-
r(this, "elementContext");
|
|
132
|
-
r(this, "logger");
|
|
133
|
-
// Track the ref so we can nullify it on unmount.
|
|
134
|
-
r(this, "ref");
|
|
135
|
-
// Prevents 'onClickOutside' handlers from firing in the same cycle in which the element is connected.
|
|
136
|
-
r(this, "canClickAway", !1);
|
|
137
|
-
if (e.toLowerCase() === "svg" && (i = {
|
|
138
|
-
...i,
|
|
139
|
-
isSVG: !0
|
|
140
|
-
}), this.logger = i.view.logger, i.isSVG ? this.domNode = document.createElementNS("http://www.w3.org/2000/svg", e) : this.domNode = document.createElement(e), ne() === "development" && y(i.view.name) && (this.domNode.dataset.view = y(i.view.name)), t.ref)
|
|
141
|
-
if (h(t.ref))
|
|
142
|
-
this.ref = t.ref, this.ref(this.domNode);
|
|
143
|
-
else
|
|
144
|
-
throw new Error("Expected ref to be a function. Got: " + t.ref);
|
|
145
|
-
this.props = {
|
|
146
|
-
...ie(["ref", "class", "className"], t),
|
|
147
|
-
class: t.className ?? t.class
|
|
148
|
-
}, s && (this.childMarkup = M(s)), this.elementContext = i;
|
|
149
|
-
}
|
|
150
|
-
get isMounted() {
|
|
151
|
-
return this.domNode.parentNode != null;
|
|
152
|
-
}
|
|
153
|
-
mount(e, t) {
|
|
154
|
-
if (e == null)
|
|
155
|
-
throw new Error(`HTML element requires a parent element as the first argument to connect. Got: ${e}`);
|
|
156
|
-
if (!this.isMounted) {
|
|
157
|
-
this.childMarkup.length > 0 && (this.children = g(this.elementContext, this.childMarkup));
|
|
158
|
-
for (let s = 0; s < this.children.length; s++) {
|
|
159
|
-
const i = this.children[s], o = s > 0 ? this.children[s - 1].domNode : void 0;
|
|
160
|
-
i.mount(this.domNode, o);
|
|
161
|
-
}
|
|
162
|
-
this.applyProps(this.domNode, this.props), this.props.style && this.applyStyles(this.domNode, this.props.style, this.unsubscribers), this.props.class && this.applyClasses(this.domNode, this.props.class, this.unsubscribers);
|
|
163
|
-
}
|
|
164
|
-
e.insertBefore(this.domNode, (t == null ? void 0 : t.nextSibling) ?? null), setTimeout(() => {
|
|
165
|
-
this.canClickAway = !0;
|
|
166
|
-
}, 0);
|
|
167
|
-
}
|
|
168
|
-
unmount(e = !1) {
|
|
169
|
-
var t;
|
|
170
|
-
if (this.isMounted) {
|
|
171
|
-
e || (t = this.domNode.parentNode) == null || t.removeChild(this.domNode);
|
|
172
|
-
for (const s of this.children)
|
|
173
|
-
s.unmount(!0);
|
|
174
|
-
this.ref && this.ref(void 0), this.canClickAway = !1;
|
|
175
|
-
for (const s of this.unsubscribers)
|
|
176
|
-
s();
|
|
177
|
-
this.unsubscribers.length = 0;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
attachProp(e, t) {
|
|
181
|
-
h(e) ? this.unsubscribers.push(
|
|
182
|
-
d(() => {
|
|
183
|
-
try {
|
|
184
|
-
t(e());
|
|
185
|
-
} catch (s) {
|
|
186
|
-
this.logger.error(s), this.logger.crash(s);
|
|
187
|
-
}
|
|
188
|
-
})
|
|
189
|
-
) : t(e);
|
|
190
|
-
}
|
|
191
|
-
applyProps(e, t) {
|
|
192
|
-
for (const s in t) {
|
|
193
|
-
const i = t[s];
|
|
194
|
-
if (s === "on:clickoutside" || s === "onClickOutside" || s === "onclickoutside") {
|
|
195
|
-
const o = (c) => {
|
|
196
|
-
this.canClickAway && !e.contains(c.target) && i(c);
|
|
197
|
-
}, u = { capture: !0 };
|
|
198
|
-
window.addEventListener("click", o, u), this.unsubscribers.push(() => {
|
|
199
|
-
window.removeEventListener("click", o, u);
|
|
200
|
-
});
|
|
201
|
-
} else if (h(i) && ue(s)) {
|
|
202
|
-
const o = s.slice(2).toLowerCase(), u = i;
|
|
203
|
-
e.addEventListener(o, u), this.unsubscribers.push(() => {
|
|
204
|
-
e.removeEventListener(o, u);
|
|
205
|
-
});
|
|
206
|
-
} else if (h(i) && he.includes(s)) {
|
|
207
|
-
const o = s.substring(2);
|
|
208
|
-
e.addEventListener(o, i), this.unsubscribers.push(() => {
|
|
209
|
-
e.removeEventListener(o, i);
|
|
210
|
-
});
|
|
211
|
-
} else if (s.includes("-"))
|
|
212
|
-
this.attachProp(i, (o) => {
|
|
213
|
-
o == null ? e.removeAttribute(s) : e.setAttribute(s, String(o));
|
|
214
|
-
});
|
|
215
|
-
else if (!le.includes(s))
|
|
216
|
-
if (this.elementContext.isSVG)
|
|
217
|
-
this.attachProp(i, (o) => {
|
|
218
|
-
o != null ? e.setAttribute(s, String(t[s])) : e.removeAttribute(s);
|
|
219
|
-
});
|
|
220
|
-
else
|
|
221
|
-
switch (s) {
|
|
222
|
-
case "contentEditable":
|
|
223
|
-
case "value":
|
|
224
|
-
this.attachProp(i, (o) => {
|
|
225
|
-
e[s] = String(o);
|
|
226
|
-
});
|
|
227
|
-
break;
|
|
228
|
-
case "for":
|
|
229
|
-
this.attachProp(i, (o) => {
|
|
230
|
-
e.htmlFor = o;
|
|
231
|
-
});
|
|
232
|
-
break;
|
|
233
|
-
case "title":
|
|
234
|
-
this.attachProp(i, (o) => {
|
|
235
|
-
o == null ? e.removeAttribute(s) : e.setAttribute(s, String(o));
|
|
236
|
-
});
|
|
237
|
-
case "checked":
|
|
238
|
-
this.attachProp(i, (o) => {
|
|
239
|
-
e.checked = o, o ? e.setAttribute("checked", "") : e.removeAttribute("checked");
|
|
240
|
-
});
|
|
241
|
-
break;
|
|
242
|
-
case "autocomplete":
|
|
243
|
-
case "autocapitalize":
|
|
244
|
-
this.attachProp(i, (o) => {
|
|
245
|
-
typeof o == "string" ? e[s] = o : o ? e[s] = "on" : e[s] = "off";
|
|
246
|
-
});
|
|
247
|
-
break;
|
|
248
|
-
default: {
|
|
249
|
-
if (s.startsWith("prop:")) {
|
|
250
|
-
const o = s.substring(5);
|
|
251
|
-
this.attachProp(i, (u) => {
|
|
252
|
-
e[o] = u;
|
|
253
|
-
});
|
|
254
|
-
} else if (s.startsWith("on:")) {
|
|
255
|
-
const o = s.substring(3);
|
|
256
|
-
let u;
|
|
257
|
-
h(i) ? (e.addEventListener(o, i), this.unsubscribers.push(() => {
|
|
258
|
-
e.removeEventListener(o, i);
|
|
259
|
-
})) : this.attachProp(i, (c) => {
|
|
260
|
-
!c && u ? e.removeEventListener(o, u) : c != null && (u && u !== c && e.removeEventListener(o, u), e.addEventListener(o, c)), u = c;
|
|
261
|
-
});
|
|
262
|
-
} else if (s.startsWith("attr:")) {
|
|
263
|
-
const o = s.substring(5).toLowerCase();
|
|
264
|
-
this.attachProp(i, (u) => {
|
|
265
|
-
u != null ? e.setAttribute(o, String(u)) : e.removeAttribute(o);
|
|
266
|
-
});
|
|
267
|
-
} else
|
|
268
|
-
this.attachProp(i, (o) => {
|
|
269
|
-
e[s] = o;
|
|
270
|
-
});
|
|
271
|
-
break;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
applyStyles(e, t, s) {
|
|
277
|
-
const i = [];
|
|
278
|
-
if (h(t)) {
|
|
279
|
-
let o;
|
|
280
|
-
const u = d(() => {
|
|
281
|
-
h(o) && o(), e.style.cssText = "", o = this.applyStyles(e, w(t), s);
|
|
282
|
-
});
|
|
283
|
-
s.push(u), i.push(u);
|
|
284
|
-
} else {
|
|
285
|
-
const o = K(t);
|
|
286
|
-
for (const u in o) {
|
|
287
|
-
const { value: c, priority: a } = o[u];
|
|
288
|
-
if (h(c)) {
|
|
289
|
-
const l = d(() => {
|
|
290
|
-
w(c) ? e.style.setProperty(u, String(w(c)), a) : e.style.removeProperty(u);
|
|
291
|
-
});
|
|
292
|
-
s.push(l), i.push(l);
|
|
293
|
-
} else c != null && e.style.setProperty(u, String(c));
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
return function() {
|
|
297
|
-
for (const u of i)
|
|
298
|
-
u(), s.splice(s.indexOf(u), 1);
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
applyClasses(e, t, s) {
|
|
302
|
-
const i = [];
|
|
303
|
-
if (h(t)) {
|
|
304
|
-
let o;
|
|
305
|
-
const u = d(() => {
|
|
306
|
-
h(o) && o(), e.removeAttribute("class"), o = this.applyClasses(e, w(t), s);
|
|
307
|
-
});
|
|
308
|
-
s.push(u), i.push(u);
|
|
309
|
-
} else {
|
|
310
|
-
const o = H(t);
|
|
311
|
-
for (const u in o) {
|
|
312
|
-
const c = o[u];
|
|
313
|
-
if (h(c)) {
|
|
314
|
-
const a = d(() => {
|
|
315
|
-
w(c) ? e.classList.add(u) : e.classList.remove(u);
|
|
316
|
-
});
|
|
317
|
-
s.push(a), i.push(a);
|
|
318
|
-
} else c && e.classList.add(u);
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
return function() {
|
|
322
|
-
for (const u of i)
|
|
323
|
-
u(), s.splice(s.indexOf(u), 1);
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
function H(n) {
|
|
328
|
-
let e = {};
|
|
329
|
-
if (C(n)) {
|
|
330
|
-
const t = n.split(" ");
|
|
331
|
-
for (const s of t)
|
|
332
|
-
e[s] = !0;
|
|
333
|
-
} else $(n) ? Object.assign(e, n) : Array.isArray(n) && Array.from(n).filter(Boolean).forEach((t) => {
|
|
334
|
-
Object.assign(e, H(t));
|
|
335
|
-
});
|
|
336
|
-
return delete e.undefined, e;
|
|
337
|
-
}
|
|
338
|
-
function K(n) {
|
|
339
|
-
let e = {};
|
|
340
|
-
if (C(n)) {
|
|
341
|
-
const t = n.split(";").filter((s) => s.trim() !== "");
|
|
342
|
-
for (const s of t) {
|
|
343
|
-
const [i, o] = s.split(":"), u = {
|
|
344
|
-
value: o
|
|
345
|
-
};
|
|
346
|
-
o.includes("!important") ? (u.priority = "important", u.value = o.replace("!important", "").trim()) : u.value = o.trim(), e[O(i.trim())] = u;
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
if ($(n))
|
|
350
|
-
for (const t in n)
|
|
351
|
-
t.startsWith("--") ? e[t] = { value: n[t] } : e[O(t)] = { value: n[t] };
|
|
352
|
-
else Array.isArray(n) && Array.from(n).filter((t) => t != null).forEach((t) => {
|
|
353
|
-
Object.assign(e, K(t));
|
|
354
|
-
});
|
|
355
|
-
return e;
|
|
356
|
-
}
|
|
357
|
-
function O(n) {
|
|
358
|
-
return n.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (e, t) => (t ? "-" : "") + e.toLowerCase());
|
|
359
|
-
}
|
|
360
|
-
const le = ["ref", "children", "class", "style", "data"], he = ["onsubmit", "onclick", "ontransitionend"];
|
|
361
|
-
var B;
|
|
362
|
-
B = p;
|
|
363
|
-
class ae {
|
|
364
|
-
constructor(e) {
|
|
365
|
-
r(this, B, !0);
|
|
366
|
-
r(this, "domNode", document.createTextNode(""));
|
|
367
|
-
r(this, "isMounted", !1);
|
|
368
|
-
r(this, "view");
|
|
369
|
-
r(this, "mountedView");
|
|
370
|
-
r(this, "unsubscribe");
|
|
371
|
-
this.view = e;
|
|
372
|
-
}
|
|
373
|
-
mount(e, t) {
|
|
374
|
-
this.isMounted || (this.isMounted = !0, e.insertBefore(this.domNode, (t == null ? void 0 : t.nextSibling) ?? null), this.unsubscribe = d(() => {
|
|
375
|
-
const s = this.view();
|
|
376
|
-
y(() => {
|
|
377
|
-
this.update(s);
|
|
378
|
-
});
|
|
379
|
-
}));
|
|
380
|
-
}
|
|
381
|
-
unmount(e = !1) {
|
|
382
|
-
this.unsubscribe && (this.unsubscribe(), this.unsubscribe = void 0), this.isMounted && (this.cleanup(e), this.isMounted = !1);
|
|
383
|
-
}
|
|
384
|
-
cleanup(e) {
|
|
385
|
-
this.mountedView && this.mountedView.unmount(e), this.mountedView = void 0;
|
|
386
|
-
}
|
|
387
|
-
update(e) {
|
|
388
|
-
this.cleanup(!1), e && (e.mount(this.domNode.parentElement, this.domNode), this.mountedView = e);
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
var j;
|
|
392
|
-
j = p;
|
|
393
|
-
class de {
|
|
394
|
-
constructor(e) {
|
|
395
|
-
r(this, j, !0);
|
|
396
|
-
r(this, "config");
|
|
397
|
-
r(this, "element");
|
|
398
|
-
this.config = e;
|
|
399
|
-
}
|
|
400
|
-
get isMounted() {
|
|
401
|
-
return this.element ? this.element.isMounted : !1;
|
|
402
|
-
}
|
|
403
|
-
mount(e, t) {
|
|
404
|
-
const { content: s, parent: i } = this.config;
|
|
405
|
-
J(s) ? this.element = s : this.element = L(g(this.config.elementContext, M(s))), this.element.mount(i);
|
|
406
|
-
}
|
|
407
|
-
unmount(e = !1) {
|
|
408
|
-
var t;
|
|
409
|
-
(t = this.element) != null && t.isMounted && this.element.unmount(!1);
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
var V;
|
|
413
|
-
V = p;
|
|
414
|
-
class fe {
|
|
415
|
-
constructor({ elementContext: e, items: t, renderFn: s, keyFn: i }) {
|
|
416
|
-
r(this, V, !0);
|
|
417
|
-
r(this, "domNode", document.createTextNode(""));
|
|
418
|
-
r(this, "items");
|
|
419
|
-
r(this, "unsubscribe", null);
|
|
420
|
-
r(this, "connectedItems", []);
|
|
421
|
-
r(this, "elementContext");
|
|
422
|
-
r(this, "renderFn");
|
|
423
|
-
r(this, "keyFn");
|
|
424
|
-
this.elementContext = e, this.items = t, this.renderFn = s, this.keyFn = i;
|
|
425
|
-
}
|
|
426
|
-
get isMounted() {
|
|
427
|
-
return this.domNode.parentNode != null;
|
|
428
|
-
}
|
|
429
|
-
mount(e, t) {
|
|
430
|
-
this.isMounted || (e.insertBefore(this.domNode, (t == null ? void 0 : t.nextSibling) ?? null), this.unsubscribe = d(() => {
|
|
431
|
-
let s = this.items();
|
|
432
|
-
s == null && (s = [], console.log("repeat received empty value", s, this)), y(() => {
|
|
433
|
-
this._update(Array.from(s));
|
|
434
|
-
});
|
|
435
|
-
}));
|
|
436
|
-
}
|
|
437
|
-
unmount(e = !1) {
|
|
438
|
-
var t;
|
|
439
|
-
this.unsubscribe && (this.unsubscribe(), this.unsubscribe = null), !e && this.isMounted && ((t = this.domNode.parentNode) == null || t.removeChild(this.domNode)), this._cleanup(e);
|
|
440
|
-
}
|
|
441
|
-
_cleanup(e) {
|
|
442
|
-
for (const t of this.connectedItems)
|
|
443
|
-
t.element.unmount(e);
|
|
444
|
-
this.connectedItems = [];
|
|
445
|
-
}
|
|
446
|
-
_update(e) {
|
|
447
|
-
var u, c, a;
|
|
448
|
-
if (e.length === 0 || !this.isMounted)
|
|
449
|
-
return this._cleanup(!1);
|
|
450
|
-
const t = [];
|
|
451
|
-
let s = 0;
|
|
452
|
-
for (const l of e)
|
|
453
|
-
t.push({
|
|
454
|
-
key: this.keyFn(l, s),
|
|
455
|
-
value: l,
|
|
456
|
-
index: s++
|
|
457
|
-
});
|
|
458
|
-
const i = [];
|
|
459
|
-
for (const l of this.connectedItems)
|
|
460
|
-
t.find((b) => b.key === l.key) || l.element.unmount(!1);
|
|
461
|
-
for (const l of t) {
|
|
462
|
-
const v = this.connectedItems.find((b) => b.key === l.key);
|
|
463
|
-
if (v)
|
|
464
|
-
v.item(l.value), v.index(l.index), i[l.index] = v;
|
|
465
|
-
else {
|
|
466
|
-
const b = N(l.value, { equals: oe }), P = N(l.index);
|
|
467
|
-
i[l.index] = {
|
|
468
|
-
key: l.key,
|
|
469
|
-
item: b,
|
|
470
|
-
index: P,
|
|
471
|
-
element: new k(this.elementContext, me, {
|
|
472
|
-
item: () => b(),
|
|
473
|
-
index: () => P(),
|
|
474
|
-
renderFn: this.renderFn
|
|
475
|
-
})
|
|
476
|
-
};
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
for (let l = 0; l < i.length; l++) {
|
|
480
|
-
const v = i[l], b = ((u = i[l - 1]) == null ? void 0 : u.element.domNode) ?? this.domNode;
|
|
481
|
-
v.element.mount(this.domNode.parentNode, b);
|
|
482
|
-
}
|
|
483
|
-
this.connectedItems = i;
|
|
484
|
-
const o = ((c = i.at(-1)) == null ? void 0 : c.element.domNode) ?? this.domNode;
|
|
485
|
-
(a = this.domNode.parentNode) == null || a.insertBefore(this.domNode, o.nextSibling);
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
function me(n, e) {
|
|
489
|
-
return e.name = "@RepeatItem", n.renderFn.call(e, n.item, n.index, e);
|
|
490
|
-
}
|
|
491
|
-
function E(n) {
|
|
492
|
-
return n instanceof Q;
|
|
493
|
-
}
|
|
494
|
-
function J(n) {
|
|
495
|
-
return (n == null ? void 0 : n[p]) === !0;
|
|
496
|
-
}
|
|
497
|
-
function M(n) {
|
|
498
|
-
f(n) || (n = [n]);
|
|
499
|
-
const e = [];
|
|
500
|
-
for (const t of n)
|
|
501
|
-
if (!(t == null || t === !1)) {
|
|
502
|
-
if (t instanceof Node) {
|
|
503
|
-
e.push(m("$node", { value: t }));
|
|
504
|
-
continue;
|
|
505
|
-
}
|
|
506
|
-
if (E(t)) {
|
|
507
|
-
e.push(t);
|
|
508
|
-
continue;
|
|
509
|
-
}
|
|
510
|
-
if (h(t)) {
|
|
511
|
-
e.push(m("$dynamic", { source: t }));
|
|
512
|
-
continue;
|
|
513
|
-
}
|
|
514
|
-
if (f(t)) {
|
|
515
|
-
e.push(...M(t));
|
|
516
|
-
continue;
|
|
517
|
-
}
|
|
518
|
-
e.push(m("$text", { value: t }));
|
|
519
|
-
}
|
|
520
|
-
return e;
|
|
521
|
-
}
|
|
522
|
-
function Me(n) {
|
|
523
|
-
return L(g(S, n));
|
|
524
|
-
}
|
|
525
|
-
function m(n, e, ...t) {
|
|
526
|
-
return new Q(n, e, ...t);
|
|
527
|
-
}
|
|
528
|
-
class Q {
|
|
529
|
-
constructor(e, t, ...s) {
|
|
530
|
-
r(this, "type");
|
|
531
|
-
r(this, "props");
|
|
532
|
-
r(this, "children");
|
|
533
|
-
this.type = e, this.props = t, this.children = s;
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
function pe(n, e, t) {
|
|
537
|
-
return m("$dynamic", {
|
|
538
|
-
source: N(() => {
|
|
539
|
-
const s = w(n);
|
|
540
|
-
return s && e ? e : !s && t ? t : null;
|
|
541
|
-
})
|
|
542
|
-
});
|
|
543
|
-
}
|
|
544
|
-
function xe(n, e, t) {
|
|
545
|
-
return pe(n, t, e);
|
|
546
|
-
}
|
|
547
|
-
function ke(n, e, t) {
|
|
548
|
-
return m("$repeat", { items: () => w(n), keyFn: e, renderFn: t });
|
|
549
|
-
}
|
|
550
|
-
function Le(n, e) {
|
|
551
|
-
return m("$portal", { parent: n, content: e });
|
|
552
|
-
}
|
|
553
|
-
function g(n, e) {
|
|
554
|
-
return (f(e) ? e : [e]).map((s) => {
|
|
555
|
-
if (h(s.type))
|
|
556
|
-
return new k(n, s.type, s.props, s.children);
|
|
557
|
-
if (C(s.type))
|
|
558
|
-
switch (s.type) {
|
|
559
|
-
case "$node": {
|
|
560
|
-
const i = s.props;
|
|
561
|
-
return new I(i.value);
|
|
562
|
-
}
|
|
563
|
-
case "$text": {
|
|
564
|
-
const i = s.props;
|
|
565
|
-
return new I(document.createTextNode(String(i.value)));
|
|
566
|
-
}
|
|
567
|
-
case "$repeat": {
|
|
568
|
-
const i = s.props;
|
|
569
|
-
return new fe({
|
|
570
|
-
items: i.items,
|
|
571
|
-
keyFn: i.keyFn,
|
|
572
|
-
renderFn: i.renderFn,
|
|
573
|
-
elementContext: n
|
|
574
|
-
});
|
|
575
|
-
}
|
|
576
|
-
case "$dynamic": {
|
|
577
|
-
const i = s.props;
|
|
578
|
-
return new re({
|
|
579
|
-
source: i.source,
|
|
580
|
-
elementContext: n
|
|
581
|
-
});
|
|
582
|
-
}
|
|
583
|
-
case "$fragment": {
|
|
584
|
-
const i = s.props;
|
|
585
|
-
return new Z(i.children);
|
|
586
|
-
}
|
|
587
|
-
case "$outlet": {
|
|
588
|
-
const i = s.props;
|
|
589
|
-
return new ae(i.view);
|
|
590
|
-
}
|
|
591
|
-
case "$portal": {
|
|
592
|
-
const i = s.props;
|
|
593
|
-
return new de({
|
|
594
|
-
content: i.content,
|
|
595
|
-
parent: i.parent,
|
|
596
|
-
elementContext: n
|
|
597
|
-
});
|
|
598
|
-
}
|
|
599
|
-
default:
|
|
600
|
-
return new ce({
|
|
601
|
-
tag: s.type,
|
|
602
|
-
props: s.props ?? {},
|
|
603
|
-
children: s.children,
|
|
604
|
-
elementContext: n
|
|
605
|
-
});
|
|
606
|
-
}
|
|
607
|
-
else
|
|
608
|
-
throw new TypeError(`Expected a string or view function. Got: ${s.type}`);
|
|
609
|
-
});
|
|
610
|
-
}
|
|
611
|
-
function L(n) {
|
|
612
|
-
return n.length === 1 ? n[0] : new Z(n);
|
|
613
|
-
}
|
|
614
|
-
function X(n) {
|
|
615
|
-
return n == null || n === !1 || h(n) || C(n) || se(n) || E(n) || D(X, n);
|
|
616
|
-
}
|
|
617
|
-
let be = class {
|
|
618
|
-
constructor(e) {
|
|
619
|
-
r(this, "store");
|
|
620
|
-
this.store = e;
|
|
621
|
-
const t = Object.getOwnPropertyDescriptors(this.store.logger);
|
|
622
|
-
for (const s in t)
|
|
623
|
-
s !== "setName" && Object.defineProperty(this, s, t[s]);
|
|
624
|
-
}
|
|
625
|
-
get isMounted() {
|
|
626
|
-
return this.store.isMounted;
|
|
627
|
-
}
|
|
628
|
-
get name() {
|
|
629
|
-
return y(this.store.name) || this.store.id;
|
|
630
|
-
}
|
|
631
|
-
set name(e) {
|
|
632
|
-
this.store.name(e);
|
|
633
|
-
}
|
|
634
|
-
get(e) {
|
|
635
|
-
if (h(e)) {
|
|
636
|
-
let t = this.store.elementContext, s;
|
|
637
|
-
for (; s = t.stores.get(e), s == null && t.parent != null; )
|
|
638
|
-
t = t.parent;
|
|
639
|
-
if (s == null)
|
|
640
|
-
throw new x(`Store '${e.name}' is not provided on this context.`);
|
|
641
|
-
return s.value;
|
|
642
|
-
} else
|
|
643
|
-
throw new x("Invalid store.");
|
|
644
|
-
}
|
|
645
|
-
onMount(e) {
|
|
646
|
-
this.store.lifecycleListeners.mount.push(e);
|
|
647
|
-
}
|
|
648
|
-
onUnmount(e) {
|
|
649
|
-
this.store.lifecycleListeners.unmount.push(e);
|
|
650
|
-
}
|
|
651
|
-
effect(e) {
|
|
652
|
-
const t = this.store, s = () => {
|
|
653
|
-
try {
|
|
654
|
-
return e();
|
|
655
|
-
} catch (i) {
|
|
656
|
-
i instanceof Error ? this.crash(i) : typeof i == "string" ? this.crash(new Error(i)) : (this.error(i), this.crash(new Error("Unknown error thrown in effect callback")));
|
|
657
|
-
}
|
|
658
|
-
};
|
|
659
|
-
if (t.isMounted) {
|
|
660
|
-
const i = d(s);
|
|
661
|
-
return t.lifecycleListeners.unmount.push(i), i;
|
|
662
|
-
} else {
|
|
663
|
-
let i, o = !1;
|
|
664
|
-
return t.lifecycleListeners.mount.push(() => {
|
|
665
|
-
o || (i = d(s), t.lifecycleListeners.unmount.push(i));
|
|
666
|
-
}), () => {
|
|
667
|
-
i != null && (o = !0, i());
|
|
668
|
-
};
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
};
|
|
672
|
-
class Y {
|
|
673
|
-
constructor(e, t) {
|
|
674
|
-
r(this, "fn");
|
|
675
|
-
r(this, "_options");
|
|
676
|
-
/**
|
|
677
|
-
* Value is guaranteed to be set after `attach` is called.
|
|
678
|
-
*/
|
|
679
|
-
r(this, "value");
|
|
680
|
-
r(this, "isMounted", !1);
|
|
681
|
-
r(this, "elementContext");
|
|
682
|
-
r(this, "lifecycleListeners", { mount: [], unmount: [] });
|
|
683
|
-
r(this, "logger");
|
|
684
|
-
r(this, "id", R());
|
|
685
|
-
r(this, "name", N(""));
|
|
686
|
-
this.fn = e, this.name(e.name), this._options = t;
|
|
687
|
-
}
|
|
688
|
-
/**
|
|
689
|
-
* Attaches this Store to the elementContext.
|
|
690
|
-
* Returns false if there was already an instance attached, and true otherwise.
|
|
691
|
-
*/
|
|
692
|
-
attach(e) {
|
|
693
|
-
if (e.stores.has(this.fn))
|
|
694
|
-
return !1;
|
|
695
|
-
this.elementContext = e, this.logger = z(this.name, { uid: this.id });
|
|
696
|
-
const t = new be(this);
|
|
697
|
-
try {
|
|
698
|
-
this.value = this.fn.call(t, this._options, t);
|
|
699
|
-
} catch (s) {
|
|
700
|
-
throw this.logger.crash(s), s;
|
|
701
|
-
}
|
|
702
|
-
return e.stores.set(this.fn, this), !0;
|
|
703
|
-
}
|
|
704
|
-
handleMount() {
|
|
705
|
-
this.isMounted = !0;
|
|
706
|
-
for (const e of this.lifecycleListeners.mount)
|
|
707
|
-
e();
|
|
708
|
-
this.lifecycleListeners.mount.length = 0;
|
|
709
|
-
}
|
|
710
|
-
handleUnmount() {
|
|
711
|
-
this.isMounted = !1;
|
|
712
|
-
for (const e of this.lifecycleListeners.unmount)
|
|
713
|
-
e();
|
|
714
|
-
this.lifecycleListeners.unmount.length = 0;
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
class x extends Error {
|
|
718
|
-
}
|
|
719
|
-
const Ce = Object.freeze({
|
|
720
|
-
provide(n, e) {
|
|
721
|
-
const t = new Y(n, e);
|
|
722
|
-
if (t.attach(S))
|
|
723
|
-
return t.value;
|
|
724
|
-
{
|
|
725
|
-
let i = n.name ? `'${n.name}'` : "this store";
|
|
726
|
-
return console.warn(`An instance of ${i} is already attached.`), this.get(n);
|
|
727
|
-
}
|
|
728
|
-
},
|
|
729
|
-
get(n) {
|
|
730
|
-
if (h(n)) {
|
|
731
|
-
const e = S.stores.get(n);
|
|
732
|
-
if (e == null) {
|
|
733
|
-
let t = n.name ? `'${n.name}'` : "this store";
|
|
734
|
-
throw new x(`No instance of ${t} is provided.`);
|
|
735
|
-
} else
|
|
736
|
-
return e.value;
|
|
737
|
-
} else
|
|
738
|
-
throw new x("Invalid store.");
|
|
739
|
-
}
|
|
740
|
-
});
|
|
741
|
-
class we {
|
|
742
|
-
constructor(e) {
|
|
743
|
-
r(this, "view");
|
|
744
|
-
this.view = e;
|
|
745
|
-
const t = Object.getOwnPropertyDescriptors(this.view.logger);
|
|
746
|
-
for (const s in t)
|
|
747
|
-
s !== "setName" && Object.defineProperty(this, s, t[s]);
|
|
748
|
-
}
|
|
749
|
-
get uid() {
|
|
750
|
-
return this.view.uniqueId;
|
|
751
|
-
}
|
|
752
|
-
get isMounted() {
|
|
753
|
-
return this.view.isMounted;
|
|
754
|
-
}
|
|
755
|
-
get name() {
|
|
756
|
-
return y(this.view.name) || this.uid;
|
|
757
|
-
}
|
|
758
|
-
set name(e) {
|
|
759
|
-
this.view.name(e);
|
|
760
|
-
}
|
|
761
|
-
provide(e, t) {
|
|
762
|
-
const s = new Y(e, t);
|
|
763
|
-
if (s.attach(this.view.elementContext))
|
|
764
|
-
return this.view.lifecycleListeners.mount.push(() => {
|
|
765
|
-
s.handleMount();
|
|
766
|
-
}), this.view.lifecycleListeners.unmount.push(() => {
|
|
767
|
-
s.handleUnmount();
|
|
768
|
-
}), s.value;
|
|
769
|
-
{
|
|
770
|
-
let o = e.name ? `'${e.name}'` : "this store";
|
|
771
|
-
return this.view.logger.warn(`An instance of ${o} was already attached to this context.`), this.get(e);
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
get(e) {
|
|
775
|
-
if (h(e)) {
|
|
776
|
-
let t = this.view.elementContext, s;
|
|
777
|
-
for (; s = t.stores.get(e), s == null && t.parent != null; )
|
|
778
|
-
t = t.parent;
|
|
779
|
-
if (s == null)
|
|
780
|
-
throw new x(`Store '${e.name}' is not provided on this context.`);
|
|
781
|
-
return s.value;
|
|
782
|
-
} else
|
|
783
|
-
throw new x("Invalid store.");
|
|
784
|
-
}
|
|
785
|
-
beforeMount(e) {
|
|
786
|
-
this.view.lifecycleListeners.beforeMount.push(e);
|
|
787
|
-
}
|
|
788
|
-
onMount(e) {
|
|
789
|
-
this.view.lifecycleListeners.mount.push(e);
|
|
790
|
-
}
|
|
791
|
-
beforeUnmount(e) {
|
|
792
|
-
this.view.lifecycleListeners.beforeUnmount.push(e);
|
|
793
|
-
}
|
|
794
|
-
onUnmount(e) {
|
|
795
|
-
this.view.lifecycleListeners.unmount.push(e);
|
|
796
|
-
}
|
|
797
|
-
effect(e) {
|
|
798
|
-
const t = () => {
|
|
799
|
-
try {
|
|
800
|
-
return e();
|
|
801
|
-
} catch (s) {
|
|
802
|
-
this.error(s), s instanceof Error ? this.crash(s) : typeof s == "string" ? this.crash(new Error(s)) : this.crash(new Error("Unknown error thrown in effect callback"));
|
|
803
|
-
}
|
|
804
|
-
};
|
|
805
|
-
if (this.view.isMounted) {
|
|
806
|
-
const s = d(t);
|
|
807
|
-
return this.view.lifecycleListeners.unmount.push(s), s;
|
|
808
|
-
} else {
|
|
809
|
-
let s, i = !1;
|
|
810
|
-
return this.view.lifecycleListeners.mount.push(() => {
|
|
811
|
-
i || (s = d(t), this.view.lifecycleListeners.unmount.push(s));
|
|
812
|
-
}), () => {
|
|
813
|
-
s != null && (i = !0, s());
|
|
814
|
-
};
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
outlet() {
|
|
818
|
-
return m("$outlet", { view: this.view.elementContext.route });
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
var q;
|
|
822
|
-
q = p;
|
|
823
|
-
const A = class A {
|
|
824
|
-
constructor(e, t, s, i) {
|
|
825
|
-
r(this, q, !0);
|
|
826
|
-
r(this, "uniqueId", R());
|
|
827
|
-
r(this, "elementContext");
|
|
828
|
-
r(this, "logger");
|
|
829
|
-
r(this, "props");
|
|
830
|
-
r(this, "fn");
|
|
831
|
-
r(this, "element");
|
|
832
|
-
r(this, "name", N(""));
|
|
833
|
-
r(this, "context");
|
|
834
|
-
r(this, "lifecycleListeners", { beforeMount: [], mount: [], beforeUnmount: [], unmount: [] });
|
|
835
|
-
r(this, "isMounted", !1);
|
|
836
|
-
this.name(t.name || "🌇 anonymous view"), this.elementContext = {
|
|
837
|
-
...e,
|
|
838
|
-
parent: e,
|
|
839
|
-
view: this,
|
|
840
|
-
stores: /* @__PURE__ */ new Map(),
|
|
841
|
-
route: N()
|
|
842
|
-
}, this.logger = z(this.name, { uid: this.uniqueId }), this.props = {
|
|
843
|
-
...s,
|
|
844
|
-
children: i
|
|
845
|
-
}, this.fn = t, this.context = new we(this);
|
|
846
|
-
}
|
|
847
|
-
/*===============================*\
|
|
848
|
-
|| "Public" API ||
|
|
849
|
-
\*===============================*/
|
|
850
|
-
get domNode() {
|
|
851
|
-
var e;
|
|
852
|
-
return (e = this.element) == null ? void 0 : e.domNode;
|
|
853
|
-
}
|
|
854
|
-
mount(e, t) {
|
|
855
|
-
const s = this.isMounted;
|
|
856
|
-
if (!s) {
|
|
857
|
-
this._initialize();
|
|
858
|
-
for (const i of this.lifecycleListeners.beforeMount)
|
|
859
|
-
i();
|
|
860
|
-
}
|
|
861
|
-
this.element && this.element.mount(e, t), s || (this.isMounted = !0, requestAnimationFrame(() => {
|
|
862
|
-
for (const i of this.lifecycleListeners.mount)
|
|
863
|
-
i();
|
|
864
|
-
}));
|
|
865
|
-
}
|
|
866
|
-
unmount(e = !1) {
|
|
867
|
-
for (const t of this.lifecycleListeners.beforeUnmount)
|
|
868
|
-
t();
|
|
869
|
-
this.element && this.element.unmount(e), this.isMounted = !1;
|
|
870
|
-
for (const t of this.lifecycleListeners.unmount)
|
|
871
|
-
t();
|
|
872
|
-
this.lifecycleListeners.beforeMount.length = 0, this.lifecycleListeners.mount.length = 0, this.lifecycleListeners.beforeUnmount.length = 0, this.lifecycleListeners.unmount.length = 0;
|
|
873
|
-
}
|
|
874
|
-
setRouteView(e) {
|
|
875
|
-
const t = new A(this.elementContext, e, {});
|
|
876
|
-
return this.elementContext.route(t), t;
|
|
877
|
-
}
|
|
878
|
-
/*===============================*\
|
|
879
|
-
|| Internal ||
|
|
880
|
-
\*===============================*/
|
|
881
|
-
_initialize() {
|
|
882
|
-
const { context: e } = this;
|
|
883
|
-
let t;
|
|
884
|
-
try {
|
|
885
|
-
t = this.fn.call(e, this.props, e);
|
|
886
|
-
} catch (s) {
|
|
887
|
-
throw s instanceof Error && this.logger.crash(s), s;
|
|
888
|
-
}
|
|
889
|
-
if (t !== null) if (t instanceof Node)
|
|
890
|
-
this.element = L(g(this.elementContext, m("$node", { value: t })));
|
|
891
|
-
else if (h(t))
|
|
892
|
-
this.element = L(
|
|
893
|
-
g(this.elementContext, m("$dynamic", { source: t }))
|
|
894
|
-
);
|
|
895
|
-
else if (E(t) || D(E, t))
|
|
896
|
-
this.element = L(g(this.elementContext, t));
|
|
897
|
-
else {
|
|
898
|
-
const s = new TypeError(
|
|
899
|
-
`Expected '${this.fn.name}' function to return a DOM node, Markup element, Signal or null. Got: ${G(t)}`
|
|
900
|
-
);
|
|
901
|
-
this.logger.crash(s);
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
};
|
|
905
|
-
let k = A;
|
|
906
|
-
const ye = {
|
|
907
|
-
stores: W
|
|
908
|
-
};
|
|
909
|
-
function Se(...n) {
|
|
910
|
-
if (h(n[0])) {
|
|
911
|
-
const e = n[0], t = f(n[1]) ? {} : n[1], s = f(n[2]) ? n[2] : f(n[1]) ? n[1] : [];
|
|
912
|
-
return new k(ye, e, t, M(s));
|
|
913
|
-
} else if ($(n[0]) && h(n[1])) {
|
|
914
|
-
const e = n[0], t = n[1], s = f(n[2]) ? {} : n[2], i = f(n[3]) ? n[3] : f(n[2]) ? n[2] : [];
|
|
915
|
-
return new k(e, t, s, i ? M(i) : []);
|
|
916
|
-
} else
|
|
917
|
-
throw new TypeError(
|
|
918
|
-
"Unexpected arguments; expected view, props and children, or context, view, props and children."
|
|
919
|
-
);
|
|
920
|
-
}
|
|
921
|
-
export {
|
|
922
|
-
Ce as S,
|
|
923
|
-
ke as a,
|
|
924
|
-
Me as b,
|
|
925
|
-
Se as c,
|
|
926
|
-
m,
|
|
927
|
-
Le as p,
|
|
928
|
-
S as r,
|
|
929
|
-
xe as u,
|
|
930
|
-
pe as w
|
|
931
|
-
};
|
|
932
|
-
//# sourceMappingURL=view-CAEIbcZt.js.map
|