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