@manyducks.co/dolla 2.0.0-alpha.60 → 2.0.0-alpha.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/context.d.ts +23 -6
- package/dist/core/context.test.d.ts +1 -0
- package/dist/core/index.d.ts +6 -5
- package/dist/core/logger.test.d.ts +0 -0
- package/dist/core/markup.d.ts +12 -39
- package/dist/core/markup.test.d.ts +0 -0
- package/dist/core/mount.test.d.ts +0 -0
- package/dist/core/nodes/_markup.d.ts +36 -0
- package/dist/core/nodes/dom.d.ts +5 -6
- package/dist/core/nodes/dynamic.d.ts +6 -13
- package/dist/core/nodes/{html.d.ts → element.d.ts} +9 -8
- package/dist/core/nodes/portal.d.ts +6 -7
- package/dist/core/nodes/repeat.d.ts +8 -6
- package/dist/core/nodes/view.d.ts +6 -5
- package/dist/core/ref.test.d.ts +1 -0
- package/dist/core/signals.d.ts +17 -2
- package/dist/core/views/default-crash-view.d.ts +5 -2
- package/dist/core/views/for.d.ts +23 -0
- package/dist/core/views/show.d.ts +26 -0
- package/dist/hooks/index.d.ts +64 -0
- package/dist/hooks/index.test.d.ts +1 -0
- package/dist/hooks.js +69 -0
- package/dist/hooks.js.map +1 -0
- package/dist/i18n.js +49 -49
- package/dist/i18n.js.map +1 -1
- package/dist/index.js +61 -58
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.js +1 -1
- package/dist/jsx-runtime.js +1 -1
- package/dist/logger-Bl496yfY.js +91 -0
- package/dist/logger-Bl496yfY.js.map +1 -0
- package/dist/markup-UzKSsawX.js +1037 -0
- package/dist/markup-UzKSsawX.js.map +1 -0
- package/dist/ref-BD79iqlg.js +15 -0
- package/dist/ref-BD79iqlg.js.map +1 -0
- package/dist/router/router.d.ts +33 -18
- package/dist/{router-BpuJQ6OA.js → router-BXBX8lnO.js} +217 -190
- package/dist/router-BXBX8lnO.js.map +1 -0
- package/dist/router.js +1 -1
- package/dist/signals-gCwiIe5X.js +450 -0
- package/dist/signals-gCwiIe5X.js.map +1 -0
- package/dist/types.d.ts +1 -1
- package/docs/hooks.md +211 -0
- package/docs/i18n.md +1 -1
- package/notes/scratch.md +23 -1
- package/package.json +5 -1
- package/vite.config.js +1 -0
- package/dist/core/symbols.d.ts +0 -2
- package/dist/logger-MPwl-Xqu.js +0 -524
- package/dist/logger-MPwl-Xqu.js.map +0 -1
- package/dist/markup-BGlfQYQk.js +0 -996
- package/dist/markup-BGlfQYQk.js.map +0 -1
- package/dist/router-BpuJQ6OA.js.map +0 -1
package/dist/markup-BGlfQYQk.js
DELETED
|
@@ -1,996 +0,0 @@
|
|
|
1
|
-
var ut = Object.defineProperty;
|
|
2
|
-
var j = (o) => {
|
|
3
|
-
throw TypeError(o);
|
|
4
|
-
};
|
|
5
|
-
var lt = (o, t, e) => t in o ? ut(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
|
|
6
|
-
var c = (o, t, e) => lt(o, typeof t != "symbol" ? t + "" : t, e), R = (o, t, e) => t.has(o) || j("Cannot " + e);
|
|
7
|
-
var L = (o, t, e) => (R(o, t, "read from private field"), e ? e.call(o) : t.get(o)), V = (o, t, e) => t.has(o) ? j("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(o) : t.set(o, e), O = (o, t, e, s) => (R(o, t, "write to private field"), s ? s.call(o, e) : t.set(o, e), e);
|
|
8
|
-
import { c as f, t as dt, i as D, b as C } from "./typeChecking-CbltMOUt.js";
|
|
9
|
-
import { u as E, h as ft, g as y, k as st, e as w, t as it, c as mt, l as pt, m as bt, b as gt, $ as _, d as wt } from "./logger-MPwl-Xqu.js";
|
|
10
|
-
var b = /* @__PURE__ */ ((o) => (o[o.WILL_MOUNT = 0] = "WILL_MOUNT", o[o.DID_MOUNT = 1] = "DID_MOUNT", o[o.WILL_UNMOUNT = 2] = "WILL_UNMOUNT", o[o.DID_UNMOUNT = 3] = "DID_UNMOUNT", o[o.DISPOSE = 4] = "DISPOSE", o))(b || {});
|
|
11
|
-
const T = Symbol("name"), l = Symbol("lifecycle"), p = Symbol("parent"), v = Symbol("stores"), g = Symbol("state");
|
|
12
|
-
class yt {
|
|
13
|
-
constructor(t) {
|
|
14
|
-
c(this, "context");
|
|
15
|
-
c(this, "state", 0);
|
|
16
|
-
c(this, "listeners", /* @__PURE__ */ new Map());
|
|
17
|
-
c(this, "bound");
|
|
18
|
-
this.context = t;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Listen for a certain event to be emitted. Listeners are called when the event results in a state change.
|
|
22
|
-
*/
|
|
23
|
-
on(t, e) {
|
|
24
|
-
const s = this.listeners.get(t);
|
|
25
|
-
s ? s.add(e) : this.listeners.set(t, /* @__PURE__ */ new Set([e]));
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Stop a particular listener from being called when an event is emitted.
|
|
29
|
-
*/
|
|
30
|
-
off(t, e) {
|
|
31
|
-
const s = this.listeners.get(t);
|
|
32
|
-
s && (s.delete(e), s.size === 0 && this.listeners.delete(t));
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Advance the lifecycle state machine.
|
|
36
|
-
*/
|
|
37
|
-
emit(t) {
|
|
38
|
-
switch (t) {
|
|
39
|
-
case 0: {
|
|
40
|
-
this.state < 1 ? (this.state = 1, this.notify(t)) : this.context.crash(new Error(`Tried to WILL_MOUNT context at state ${this.state}`));
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
case 1: {
|
|
44
|
-
this.state >= 1 && this.state < 2 ? (this.state = 2, this.notify(t)) : this.context.crash(new Error(`Tried to WILL_UNMOUNT context at state ${this.state}`));
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
case 2: {
|
|
48
|
-
this.state >= 2 && this.state < 3 ? (this.notify(t), this.state = 3) : this.context.crash(new Error(`Tried to WILL_UNMOUNT context at state ${this.state}`));
|
|
49
|
-
break;
|
|
50
|
-
}
|
|
51
|
-
case 3: {
|
|
52
|
-
this.state >= 3 && this.state < 4 ? (this.state = 4 % 4, this.notify(t)) : this.context.crash(new Error(`Tried to DID_UNMOUNT context at state ${this.state}`));
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
case 4: {
|
|
56
|
-
this.state === 0 ? (this.notify(t), this.listeners.clear(), this.bound = void 0, this.context[g] = void 0, this.context[v] = void 0, this.state = 5) : this.context.crash(new Error(`Tried to DISPOSE context at state ${this.state}`));
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Bind `context` to this lifecycle; when any event is emitted here it will be emitted for `context` as well.
|
|
63
|
-
*/
|
|
64
|
-
bind(t) {
|
|
65
|
-
this.bound ? this.bound.add(t) : this.bound = /* @__PURE__ */ new Set([t]);
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Call all the event's listeners and re-emit to bound contexts.
|
|
69
|
-
*/
|
|
70
|
-
notify(t) {
|
|
71
|
-
const e = this.listeners.get(t);
|
|
72
|
-
if (e)
|
|
73
|
-
for (const s of e)
|
|
74
|
-
s();
|
|
75
|
-
if (this.bound)
|
|
76
|
-
for (const s of this.bound)
|
|
77
|
-
s[l].emit(t);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
var H, z, F, Z, K, x;
|
|
81
|
-
K = T, Z = l, F = p, z = v, H = g;
|
|
82
|
-
const I = class I {
|
|
83
|
-
constructor(t, e) {
|
|
84
|
-
V(this, x);
|
|
85
|
-
c(this, K);
|
|
86
|
-
c(this, Z, new yt(this));
|
|
87
|
-
c(this, F);
|
|
88
|
-
c(this, z);
|
|
89
|
-
c(this, H);
|
|
90
|
-
O(this, x, t), this[T] = E(t);
|
|
91
|
-
const s = ft(() => y(L(this, x)), e == null ? void 0 : e.logger), i = Object.getOwnPropertyDescriptors(s);
|
|
92
|
-
for (const n in i)
|
|
93
|
-
Object.defineProperty(this, n, i[n]);
|
|
94
|
-
}
|
|
95
|
-
get isMounted() {
|
|
96
|
-
const { state: t } = this[l];
|
|
97
|
-
return t >= 2 && t < 4;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Returns a new Context with this one as its parent.
|
|
101
|
-
*/
|
|
102
|
-
static linked(t, e, s) {
|
|
103
|
-
const i = new I(e, s);
|
|
104
|
-
return i[p] = t, s != null && s.bindLifecycleToParent && t[l].bind(i), i;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Emit a lifecycle event to `context`.
|
|
108
|
-
*/
|
|
109
|
-
static emit(t, e) {
|
|
110
|
-
t[l].emit(e);
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Traverses _parent contexts until arriving at one that doesn't have a parent itself.
|
|
114
|
-
* Returns null if this context is the parent.
|
|
115
|
-
*/
|
|
116
|
-
static getRoot(t) {
|
|
117
|
-
let e = t[p];
|
|
118
|
-
for (; e != null && e[p]; )
|
|
119
|
-
e = e[p];
|
|
120
|
-
return e ?? null;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Returns the current name of this context.
|
|
124
|
-
*/
|
|
125
|
-
getName() {
|
|
126
|
-
return E(L(this, x));
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Sets a new name for this context.
|
|
130
|
-
*/
|
|
131
|
-
setName(t) {
|
|
132
|
-
O(this, x, t), this[T] = E(t);
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Creates an instance of a store and attaches it to this context.
|
|
136
|
-
*/
|
|
137
|
-
addStore(t, e) {
|
|
138
|
-
var i;
|
|
139
|
-
if ((i = this[v]) != null && i.get(t)) {
|
|
140
|
-
let n = t.name ? `'${t.name}'` : "this store";
|
|
141
|
-
throw this.crash(new U(`An instance of ${n} was already added on this context.`));
|
|
142
|
-
}
|
|
143
|
-
const s = I.linked(this, t.name, {
|
|
144
|
-
bindLifecycleToParent: !0,
|
|
145
|
-
logger: { tag: st(), tagName: "uid" }
|
|
146
|
-
});
|
|
147
|
-
try {
|
|
148
|
-
this[v] || (this[v] = /* @__PURE__ */ new Map());
|
|
149
|
-
const n = t.call(s, e, s);
|
|
150
|
-
this[v].set(t, n);
|
|
151
|
-
} catch (n) {
|
|
152
|
-
throw this.crash(n);
|
|
153
|
-
}
|
|
154
|
-
return this;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Retrieves the nearest instance of `store`. If this context doesn't have it, the parent context is checked. This process continues until either:
|
|
158
|
-
* 1. An instance of the store is found and returned.
|
|
159
|
-
* 2. No instance is found and an error is thrown.
|
|
160
|
-
*/
|
|
161
|
-
getStore(t) {
|
|
162
|
-
var i;
|
|
163
|
-
if (!f(t))
|
|
164
|
-
throw new U("Invalid store.");
|
|
165
|
-
let e = this, s;
|
|
166
|
-
for (; s = (i = e[v]) == null ? void 0 : i.get(t), s == null && e[p] != null; )
|
|
167
|
-
e = e[p];
|
|
168
|
-
if (s == null)
|
|
169
|
-
throw this.crash(new U(`Store '${t.name}' is not provided by this context.`));
|
|
170
|
-
return s;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Schedule a callback function to run just before this context is mounted.
|
|
174
|
-
*/
|
|
175
|
-
beforeMount(t) {
|
|
176
|
-
return this[l].on(0, t), () => this[l].off(0, t);
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Schedule a callback function to run after this context is mounted.
|
|
180
|
-
*/
|
|
181
|
-
onMount(t) {
|
|
182
|
-
return this[l].on(1, t), () => this[l].off(1, t);
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Schedule a callback function to run just before this context is unmounted.
|
|
186
|
-
*/
|
|
187
|
-
beforeUnmount(t) {
|
|
188
|
-
return this[l].on(2, t), () => this[l].off(2, t);
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Schedule a callback function to run after this context is unmounted.
|
|
192
|
-
*/
|
|
193
|
-
onUnmount(t) {
|
|
194
|
-
return this[l].on(3, t), () => this[l].off(3, t);
|
|
195
|
-
}
|
|
196
|
-
effect(t) {
|
|
197
|
-
const e = () => {
|
|
198
|
-
try {
|
|
199
|
-
return t();
|
|
200
|
-
} catch (s) {
|
|
201
|
-
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"));
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
if (this[l].state >= 1) {
|
|
205
|
-
const s = w(e);
|
|
206
|
-
return this[l].on(3, s), s;
|
|
207
|
-
} else {
|
|
208
|
-
let s, i = !1;
|
|
209
|
-
return this[l].on(0, () => {
|
|
210
|
-
i || (s = w(e), this[l].on(3, s));
|
|
211
|
-
}), () => {
|
|
212
|
-
s != null && (i = !0, s());
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
getState(t, e) {
|
|
217
|
-
var s;
|
|
218
|
-
if (arguments.length > 0) {
|
|
219
|
-
let i = this, n;
|
|
220
|
-
for (; n = (s = i[g]) == null ? void 0 : s.get(t), n === void 0 && i[p] != null; )
|
|
221
|
-
i = i[p];
|
|
222
|
-
if (n === void 0) {
|
|
223
|
-
if (arguments.length > 1)
|
|
224
|
-
return e;
|
|
225
|
-
throw new Error(`Expected a value for '${String(t)}' but got undefined.`);
|
|
226
|
-
}
|
|
227
|
-
return n;
|
|
228
|
-
} else {
|
|
229
|
-
let i = this;
|
|
230
|
-
const n = [];
|
|
231
|
-
for (; i[g] && n.push(...i[g].entries()), i[p] != null; )
|
|
232
|
-
i = i[p];
|
|
233
|
-
return new Map(n.reverse());
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
setState() {
|
|
237
|
-
if (this[g] || (this[g] = /* @__PURE__ */ new Map()), arguments.length === 2)
|
|
238
|
-
this[g].set(arguments[0], arguments[1]);
|
|
239
|
-
else if (dt(arguments[0]) === "array")
|
|
240
|
-
for (const [t, e] of arguments[0])
|
|
241
|
-
e === void 0 ? this[g].delete(t) : this[g].set(t, e);
|
|
242
|
-
else
|
|
243
|
-
throw new Error("Invalid arguments.");
|
|
244
|
-
return this;
|
|
245
|
-
}
|
|
246
|
-
};
|
|
247
|
-
x = new WeakMap();
|
|
248
|
-
let d = I;
|
|
249
|
-
function _t(o, t) {
|
|
250
|
-
return new d(o, t);
|
|
251
|
-
}
|
|
252
|
-
class U extends Error {
|
|
253
|
-
}
|
|
254
|
-
const N = Symbol("type"), k = Symbol("MarkupNode");
|
|
255
|
-
var Y;
|
|
256
|
-
Y = N;
|
|
257
|
-
class $ {
|
|
258
|
-
constructor(t) {
|
|
259
|
-
c(this, Y, k);
|
|
260
|
-
c(this, "root");
|
|
261
|
-
this.root = t;
|
|
262
|
-
}
|
|
263
|
-
isMounted() {
|
|
264
|
-
return this.root.parentNode != null;
|
|
265
|
-
}
|
|
266
|
-
mount(t, e) {
|
|
267
|
-
t.insertBefore(this.root, (e == null ? void 0 : e.nextSibling) ?? null);
|
|
268
|
-
}
|
|
269
|
-
unmount(t = !1) {
|
|
270
|
-
!t && this.root.parentNode && this.root.parentNode.removeChild(this.root);
|
|
271
|
-
}
|
|
272
|
-
move(t, e) {
|
|
273
|
-
if ("moveBefore" in t && this.root instanceof Element)
|
|
274
|
-
try {
|
|
275
|
-
t.moveBefore(this.root, (e == null ? void 0 : e.nextSibling) ?? null);
|
|
276
|
-
} catch {
|
|
277
|
-
this.mount(t, e);
|
|
278
|
-
}
|
|
279
|
-
else
|
|
280
|
-
this.mount(t, e);
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
var J;
|
|
284
|
-
J = N;
|
|
285
|
-
class A {
|
|
286
|
-
constructor(t, e) {
|
|
287
|
-
c(this, J, k);
|
|
288
|
-
c(this, "root", document.createTextNode(""));
|
|
289
|
-
c(this, "children", []);
|
|
290
|
-
c(this, "context");
|
|
291
|
-
c(this, "$slot");
|
|
292
|
-
c(this, "unsubscribe");
|
|
293
|
-
this.context = t, this.$slot = e;
|
|
294
|
-
}
|
|
295
|
-
isMounted() {
|
|
296
|
-
return this.root.parentElement != null;
|
|
297
|
-
}
|
|
298
|
-
mount(t, e) {
|
|
299
|
-
this.isMounted() || (t.insertBefore(this.root, (e == null ? void 0 : e.nextSibling) ?? null), this.unsubscribe = w(() => {
|
|
300
|
-
try {
|
|
301
|
-
const s = this.$slot();
|
|
302
|
-
E(() => {
|
|
303
|
-
this.update(it(s));
|
|
304
|
-
});
|
|
305
|
-
} catch (s) {
|
|
306
|
-
this.context.crash(s);
|
|
307
|
-
}
|
|
308
|
-
}));
|
|
309
|
-
}
|
|
310
|
-
unmount(t = !1) {
|
|
311
|
-
var e, s;
|
|
312
|
-
(e = this.unsubscribe) == null || e.call(this), this.isMounted() && (this.cleanup(t), (s = this.root.parentNode) == null || s.removeChild(this.root));
|
|
313
|
-
}
|
|
314
|
-
move(t, e) {
|
|
315
|
-
var s, i, n;
|
|
316
|
-
if ("moveBefore" in t)
|
|
317
|
-
try {
|
|
318
|
-
t.moveBefore(this.root, (e == null ? void 0 : e.nextSibling) ?? null);
|
|
319
|
-
for (let r = 0; r < this.children.length; r++)
|
|
320
|
-
this.children[r].move(t, ((s = this.children[r - 1]) == null ? void 0 : s.root) ?? this.root);
|
|
321
|
-
t.moveBefore(this.root, ((n = (i = this.children.at(-1)) == null ? void 0 : i.root) == null ? void 0 : n.nextSibling) ?? null);
|
|
322
|
-
} catch {
|
|
323
|
-
this.mount(t, e);
|
|
324
|
-
}
|
|
325
|
-
else
|
|
326
|
-
this.mount(t, e);
|
|
327
|
-
}
|
|
328
|
-
cleanup(t) {
|
|
329
|
-
for (const e of this.children)
|
|
330
|
-
e.isMounted() && e.unmount(t);
|
|
331
|
-
this.children.length = 0;
|
|
332
|
-
}
|
|
333
|
-
update(t) {
|
|
334
|
-
var s;
|
|
335
|
-
if (this.cleanup(!1), t.length === 0 || !this.isMounted()) return;
|
|
336
|
-
const e = B(this.context, t);
|
|
337
|
-
for (const i of e) {
|
|
338
|
-
const n = ((s = this.children.at(-1)) == null ? void 0 : s.root) || this.root;
|
|
339
|
-
i.mount(this.root.parentElement, n), this.children.push(i);
|
|
340
|
-
}
|
|
341
|
-
this.moveMarker();
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* Move marker node to end of children.
|
|
345
|
-
*/
|
|
346
|
-
moveMarker() {
|
|
347
|
-
var s, i;
|
|
348
|
-
const t = this.root.parentElement, e = ((i = (s = this.children.at(-1)) == null ? void 0 : s.root) == null ? void 0 : i.nextSibling) ?? null;
|
|
349
|
-
"moveBefore" in t ? t.moveBefore(this.root, e) : t.insertBefore(this.root, e);
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
const ot = Symbol("View");
|
|
353
|
-
var Q;
|
|
354
|
-
Q = N;
|
|
355
|
-
class nt {
|
|
356
|
-
/**
|
|
357
|
-
* @param context - Parent contenxt to link to.
|
|
358
|
-
* @param view - View function to mount.
|
|
359
|
-
* @param props - Props to pass to view function.
|
|
360
|
-
*/
|
|
361
|
-
constructor(t, e, s) {
|
|
362
|
-
c(this, Q, k);
|
|
363
|
-
c(this, "uniqueId", st());
|
|
364
|
-
c(this, "context");
|
|
365
|
-
c(this, "props");
|
|
366
|
-
c(this, "view");
|
|
367
|
-
c(this, "node");
|
|
368
|
-
this.context = d.linked(t, e.name ?? "anonymous view", {
|
|
369
|
-
logger: {
|
|
370
|
-
tag: this.uniqueId,
|
|
371
|
-
tagName: "uid"
|
|
372
|
-
}
|
|
373
|
-
}), this.context.setState(ot, this), this.props = s, this.view = e;
|
|
374
|
-
}
|
|
375
|
-
get root() {
|
|
376
|
-
var t;
|
|
377
|
-
return (t = this.node) == null ? void 0 : t.root;
|
|
378
|
-
}
|
|
379
|
-
isMounted() {
|
|
380
|
-
var t;
|
|
381
|
-
return ((t = this.node) == null ? void 0 : t.isMounted()) ?? !1;
|
|
382
|
-
}
|
|
383
|
-
mount(t, e) {
|
|
384
|
-
const s = this.isMounted();
|
|
385
|
-
if (!s) {
|
|
386
|
-
const { context: i, props: n, view: r } = this;
|
|
387
|
-
try {
|
|
388
|
-
const a = r.call(i, n, i);
|
|
389
|
-
a != null && a !== !1 && (this.node = ht(a, i));
|
|
390
|
-
} catch (a) {
|
|
391
|
-
throw a instanceof Error && i.crash(a), a;
|
|
392
|
-
}
|
|
393
|
-
d.emit(this.context, b.WILL_MOUNT);
|
|
394
|
-
}
|
|
395
|
-
this.node && this.node.mount(t, e), s || d.emit(this.context, b.DID_MOUNT);
|
|
396
|
-
}
|
|
397
|
-
unmount(t = !1) {
|
|
398
|
-
d.emit(this.context, b.WILL_UNMOUNT), this.node && this.node.unmount(t), d.emit(this.context, b.DID_UNMOUNT), d.emit(this.context, b.DISPOSE);
|
|
399
|
-
}
|
|
400
|
-
move(t, e) {
|
|
401
|
-
var s;
|
|
402
|
-
(s = this.node) == null || s.move(t, e);
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
const vt = (o) => /^on[A-Z]/.test(o), P = Symbol("HTML.isSVG"), xt = ["class", "className", "ref", "mixin", "children"];
|
|
406
|
-
var X;
|
|
407
|
-
X = N;
|
|
408
|
-
class Nt {
|
|
409
|
-
constructor(t, e, s) {
|
|
410
|
-
c(this, X, k);
|
|
411
|
-
c(this, "root");
|
|
412
|
-
c(this, "parentContext");
|
|
413
|
-
c(this, "context");
|
|
414
|
-
c(this, "tag");
|
|
415
|
-
c(this, "props");
|
|
416
|
-
c(this, "childNodes", []);
|
|
417
|
-
c(this, "unsubscribers", []);
|
|
418
|
-
// Track the ref so we can nullify it on unmount.
|
|
419
|
-
c(this, "ref");
|
|
420
|
-
// Prevents 'onClickOutside' handlers from firing in the same cycle in which the element is connected.
|
|
421
|
-
c(this, "canClickAway", !1);
|
|
422
|
-
if (this.parentContext = t, this.tag = e, this.props = s, this.context = d.linked(this.parentContext, q.bind(this)), e.toLowerCase() === "svg" && this.context.setState(P, !0), this.context.getState(P, !1) ? this.root = document.createElementNS("http://www.w3.org/2000/svg", e) : this.root = document.createElement(e), mt() === "development") {
|
|
423
|
-
const n = this.context.getState(ot, null);
|
|
424
|
-
n && (this.root.dataset.view = n.context.getName());
|
|
425
|
-
}
|
|
426
|
-
if (s.mixin)
|
|
427
|
-
for (const n of it(s.mixin))
|
|
428
|
-
n(
|
|
429
|
-
this.root,
|
|
430
|
-
d.linked(this.context, q.bind(this), {
|
|
431
|
-
bindLifecycleToParent: !0,
|
|
432
|
-
logger: { tagName: n.name === "mixin" ? void 0 : "mixin", tag: n.name }
|
|
433
|
-
})
|
|
434
|
-
);
|
|
435
|
-
const i = s.className ?? s.class;
|
|
436
|
-
if (this.applyProps(this.root, pt(xt, s)), s.style && this.applyStyles(this.root, s.style, this.unsubscribers), i && this.applyClasses(this.root, i, this.unsubscribers), s.ref)
|
|
437
|
-
if (f(s.ref))
|
|
438
|
-
this.ref = s.ref, this.ref(this.root);
|
|
439
|
-
else
|
|
440
|
-
throw new Error("Expected ref to be a function. Got: " + s.ref);
|
|
441
|
-
s.children && (this.childNodes = B(this.context, s.children));
|
|
442
|
-
}
|
|
443
|
-
isMounted() {
|
|
444
|
-
return this.context.isMounted;
|
|
445
|
-
}
|
|
446
|
-
mount(t, e) {
|
|
447
|
-
const s = this.isMounted();
|
|
448
|
-
if (!s) {
|
|
449
|
-
d.emit(this.context, b.WILL_MOUNT);
|
|
450
|
-
for (let i = 0; i < this.childNodes.length; i++) {
|
|
451
|
-
const n = this.childNodes[i], r = i > 0 ? this.childNodes[i - 1].root : void 0;
|
|
452
|
-
n.mount(this.root, r);
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
t.insertBefore(this.root, (e == null ? void 0 : e.nextSibling) ?? null), this.canClickAway = !0, s || d.emit(this.context, b.DID_MOUNT);
|
|
456
|
-
}
|
|
457
|
-
unmount(t = !1) {
|
|
458
|
-
var e;
|
|
459
|
-
d.emit(this.context, b.WILL_UNMOUNT), t || (e = this.root.parentNode) == null || e.removeChild(this.root);
|
|
460
|
-
for (const s of this.childNodes)
|
|
461
|
-
s.unmount(!0);
|
|
462
|
-
this.canClickAway = !1;
|
|
463
|
-
for (const s of this.unsubscribers)
|
|
464
|
-
s();
|
|
465
|
-
this.unsubscribers.length = 0, this.ref && this.ref(void 0), d.emit(this.context, b.DID_UNMOUNT), d.emit(this.context, b.DISPOSE);
|
|
466
|
-
}
|
|
467
|
-
move(t, e) {
|
|
468
|
-
if ("moveBefore" in t)
|
|
469
|
-
try {
|
|
470
|
-
t.moveBefore(this.root, (e == null ? void 0 : e.nextSibling) ?? null);
|
|
471
|
-
} catch {
|
|
472
|
-
this.mount(t, e);
|
|
473
|
-
}
|
|
474
|
-
else
|
|
475
|
-
this.mount(t, e);
|
|
476
|
-
}
|
|
477
|
-
attachProp(t, e) {
|
|
478
|
-
f(t) ? this.unsubscribers.push(
|
|
479
|
-
w(() => {
|
|
480
|
-
try {
|
|
481
|
-
e(t());
|
|
482
|
-
} catch (s) {
|
|
483
|
-
this.context.error(s), this.context.crash(s);
|
|
484
|
-
}
|
|
485
|
-
})
|
|
486
|
-
) : e(t);
|
|
487
|
-
}
|
|
488
|
-
applyProps(t, e) {
|
|
489
|
-
for (const s in e) {
|
|
490
|
-
const i = e[s];
|
|
491
|
-
if (s === "on:clickoutside" || s === "onClickOutside" || s === "onclickoutside") {
|
|
492
|
-
const n = (a) => {
|
|
493
|
-
this.canClickAway && !t.contains(a.target) && i(a);
|
|
494
|
-
}, r = { capture: !0 };
|
|
495
|
-
window.addEventListener("click", n, r), this.unsubscribers.push(() => {
|
|
496
|
-
window.removeEventListener("click", n, r);
|
|
497
|
-
});
|
|
498
|
-
} else if (s.startsWith("prop:")) {
|
|
499
|
-
const n = s.substring(5);
|
|
500
|
-
this.attachProp(i, (r) => {
|
|
501
|
-
t[n] = r;
|
|
502
|
-
});
|
|
503
|
-
} else if (s.startsWith("on:")) {
|
|
504
|
-
const n = s.substring(3);
|
|
505
|
-
let r;
|
|
506
|
-
f(i) ? (t.addEventListener(n, i), this.unsubscribers.push(() => {
|
|
507
|
-
t.removeEventListener(n, i);
|
|
508
|
-
})) : this.attachProp(i, (a) => {
|
|
509
|
-
!a && r ? t.removeEventListener(n, r) : a != null && (r && r !== a && t.removeEventListener(n, r), t.addEventListener(n, a)), r = a;
|
|
510
|
-
});
|
|
511
|
-
} else if (s.startsWith("attr:")) {
|
|
512
|
-
const n = s.substring(5).toLowerCase();
|
|
513
|
-
this.attachProp(i, (r) => {
|
|
514
|
-
r != null ? t.setAttribute(n, String(r)) : t.removeAttribute(n);
|
|
515
|
-
});
|
|
516
|
-
} else if (f(i) && vt(s)) {
|
|
517
|
-
const n = s.slice(2).toLowerCase(), r = i;
|
|
518
|
-
t.addEventListener(n, r), this.unsubscribers.push(() => {
|
|
519
|
-
t.removeEventListener(n, r);
|
|
520
|
-
});
|
|
521
|
-
} else if (s.startsWith("on") && f(i) && kt.includes(s.substring(2)))
|
|
522
|
-
t[s] = i, this.unsubscribers.push(() => {
|
|
523
|
-
t[s] = void 0;
|
|
524
|
-
});
|
|
525
|
-
else if (s.includes("-"))
|
|
526
|
-
this.attachProp(i, (n) => {
|
|
527
|
-
n == null ? t.removeAttribute(s) : t.setAttribute(s, String(n));
|
|
528
|
-
});
|
|
529
|
-
else if (this.context.getState(P, !1))
|
|
530
|
-
this.attachProp(i, (n) => {
|
|
531
|
-
n != null ? t.setAttribute(s, String(e[s])) : t.removeAttribute(s);
|
|
532
|
-
});
|
|
533
|
-
else
|
|
534
|
-
switch (s) {
|
|
535
|
-
case "contentEditable":
|
|
536
|
-
case "value":
|
|
537
|
-
this.attachProp(i, (r) => {
|
|
538
|
-
t[s] = String(r);
|
|
539
|
-
});
|
|
540
|
-
break;
|
|
541
|
-
case "for":
|
|
542
|
-
this.attachProp(i, (r) => {
|
|
543
|
-
t.htmlFor = r;
|
|
544
|
-
});
|
|
545
|
-
break;
|
|
546
|
-
case "innerHTML":
|
|
547
|
-
this.attachProp(i, (r) => {
|
|
548
|
-
t.innerHTML = r;
|
|
549
|
-
});
|
|
550
|
-
break;
|
|
551
|
-
case "title":
|
|
552
|
-
this.attachProp(i, (r) => {
|
|
553
|
-
r == null ? t.removeAttribute(s) : t.setAttribute(s, String(r));
|
|
554
|
-
});
|
|
555
|
-
case "checked":
|
|
556
|
-
this.attachProp(i, (r) => {
|
|
557
|
-
t.checked = r, r ? t.setAttribute("checked", "") : t.removeAttribute("checked");
|
|
558
|
-
});
|
|
559
|
-
break;
|
|
560
|
-
case "dataset":
|
|
561
|
-
let n = {};
|
|
562
|
-
this.attachProp(i, (r) => {
|
|
563
|
-
if (D(r)) {
|
|
564
|
-
const a = {};
|
|
565
|
-
for (const u in r)
|
|
566
|
-
a[bt(u)] = String(r[u]);
|
|
567
|
-
for (const u in n)
|
|
568
|
-
Object.hasOwn(n, u) && !Object.hasOwn(a, u) && (delete t.dataset[u], delete n[u]);
|
|
569
|
-
for (const u in a)
|
|
570
|
-
n[u] !== a[u] && (t.dataset[u] = a[u], n[u] = a[u]);
|
|
571
|
-
} else
|
|
572
|
-
for (const a in n)
|
|
573
|
-
delete t.dataset[a];
|
|
574
|
-
});
|
|
575
|
-
break;
|
|
576
|
-
case "autocomplete":
|
|
577
|
-
case "autocapitalize":
|
|
578
|
-
this.attachProp(i, (r) => {
|
|
579
|
-
typeof r == "string" ? t[s] = r : r ? t[s] = "on" : t[s] = "off";
|
|
580
|
-
});
|
|
581
|
-
break;
|
|
582
|
-
default: {
|
|
583
|
-
this.attachProp(i, (r) => {
|
|
584
|
-
t[s] = r;
|
|
585
|
-
});
|
|
586
|
-
break;
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
applyStyles(t, e, s) {
|
|
592
|
-
const i = [];
|
|
593
|
-
if (f(e)) {
|
|
594
|
-
let n;
|
|
595
|
-
const r = w(() => {
|
|
596
|
-
f(n) && n(), t.style.cssText = "", n = this.applyStyles(t, y(e), s);
|
|
597
|
-
});
|
|
598
|
-
s.push(r), i.push(r);
|
|
599
|
-
} else {
|
|
600
|
-
const n = ct(e);
|
|
601
|
-
for (const r in n) {
|
|
602
|
-
const { value: a, priority: u } = n[r];
|
|
603
|
-
if (f(a)) {
|
|
604
|
-
const h = w(() => {
|
|
605
|
-
y(a) ? t.style.setProperty(r, String(y(a)), u) : t.style.removeProperty(r);
|
|
606
|
-
});
|
|
607
|
-
s.push(h), i.push(h);
|
|
608
|
-
} else a != null && t.style.setProperty(r, String(a));
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
return function() {
|
|
612
|
-
for (const r of i)
|
|
613
|
-
r(), s.splice(s.indexOf(r), 1);
|
|
614
|
-
};
|
|
615
|
-
}
|
|
616
|
-
applyClasses(t, e, s) {
|
|
617
|
-
const i = [];
|
|
618
|
-
if (f(e)) {
|
|
619
|
-
let n;
|
|
620
|
-
const r = w(() => {
|
|
621
|
-
f(n) && n(), t.removeAttribute("class"), n = this.applyClasses(t, y(e), s);
|
|
622
|
-
});
|
|
623
|
-
s.push(r), i.push(r);
|
|
624
|
-
} else {
|
|
625
|
-
const n = rt(e);
|
|
626
|
-
for (const r in n) {
|
|
627
|
-
const a = n[r];
|
|
628
|
-
if (f(a)) {
|
|
629
|
-
const u = w(() => {
|
|
630
|
-
y(a) ? t.classList.add(r) : t.classList.remove(r);
|
|
631
|
-
});
|
|
632
|
-
s.push(u), i.push(u);
|
|
633
|
-
} else a && t.classList.add(r);
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
return function() {
|
|
637
|
-
for (const r of i)
|
|
638
|
-
r(), s.splice(s.indexOf(r), 1);
|
|
639
|
-
};
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
function rt(o) {
|
|
643
|
-
let t = {};
|
|
644
|
-
if (C(o)) {
|
|
645
|
-
const e = o.split(" ");
|
|
646
|
-
for (const s of e)
|
|
647
|
-
t[s] = !0;
|
|
648
|
-
} else D(o) ? Object.assign(t, o) : Array.isArray(o) && Array.from(o).filter(Boolean).forEach((e) => {
|
|
649
|
-
Object.assign(t, rt(e));
|
|
650
|
-
});
|
|
651
|
-
return delete t.undefined, t;
|
|
652
|
-
}
|
|
653
|
-
function ct(o) {
|
|
654
|
-
let t = {};
|
|
655
|
-
if (C(o)) {
|
|
656
|
-
const e = o.split(";").filter((s) => s.trim() !== "");
|
|
657
|
-
for (const s of e) {
|
|
658
|
-
const [i, n] = s.split(":"), r = {
|
|
659
|
-
value: n
|
|
660
|
-
};
|
|
661
|
-
n.includes("!important") ? (r.priority = "important", r.value = n.replace("!important", "").trim()) : r.value = n.trim(), t[G(i.trim())] = r;
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
if (D(o))
|
|
665
|
-
for (const e in o)
|
|
666
|
-
e.startsWith("--") ? t[e] = { value: o[e] } : t[G(e)] = { value: o[e] };
|
|
667
|
-
else Array.isArray(o) && Array.from(o).filter((e) => e != null).forEach((e) => {
|
|
668
|
-
Object.assign(t, ct(e));
|
|
669
|
-
});
|
|
670
|
-
return t;
|
|
671
|
-
}
|
|
672
|
-
function q() {
|
|
673
|
-
if (this.root == null) return this.tag;
|
|
674
|
-
let o = this.root.tagName.toLowerCase();
|
|
675
|
-
if (this.root.id && (o += `#${this.root.id}`), this.root.classList.length > 0)
|
|
676
|
-
for (const t of this.root.classList.values())
|
|
677
|
-
o += `.${t}`;
|
|
678
|
-
return o;
|
|
679
|
-
}
|
|
680
|
-
function G(o) {
|
|
681
|
-
return o.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (t, e) => (e ? "-" : "") + t.toLowerCase());
|
|
682
|
-
}
|
|
683
|
-
const kt = [
|
|
684
|
-
// Element
|
|
685
|
-
"animationcancel",
|
|
686
|
-
"animationend",
|
|
687
|
-
"animationiteration",
|
|
688
|
-
"animationstart",
|
|
689
|
-
"auxclick",
|
|
690
|
-
"beforeinput",
|
|
691
|
-
"beforematch",
|
|
692
|
-
"beforexrselect",
|
|
693
|
-
"blur",
|
|
694
|
-
"click",
|
|
695
|
-
"compositionend",
|
|
696
|
-
"compositionstart",
|
|
697
|
-
"compositionupdate",
|
|
698
|
-
"contentvisibilityautostatechange",
|
|
699
|
-
"contextmenu",
|
|
700
|
-
"copy",
|
|
701
|
-
"cut",
|
|
702
|
-
"dblclick",
|
|
703
|
-
"focus",
|
|
704
|
-
"focusin",
|
|
705
|
-
"focusout",
|
|
706
|
-
"fullscreenchange",
|
|
707
|
-
"fullscreenerror",
|
|
708
|
-
"gotpointercapture",
|
|
709
|
-
"input",
|
|
710
|
-
"keydown",
|
|
711
|
-
"keyup",
|
|
712
|
-
"lostpointercapture",
|
|
713
|
-
"mousedown",
|
|
714
|
-
"mouseenter",
|
|
715
|
-
"mouseleave",
|
|
716
|
-
"mousemove",
|
|
717
|
-
"mouseout",
|
|
718
|
-
"mouseover",
|
|
719
|
-
"mouseup",
|
|
720
|
-
"paste",
|
|
721
|
-
"pointercancel",
|
|
722
|
-
"pointerdown",
|
|
723
|
-
"pointerenter",
|
|
724
|
-
"pointerleave",
|
|
725
|
-
"pointermove",
|
|
726
|
-
"pointerout",
|
|
727
|
-
"pointerover",
|
|
728
|
-
"pointerrawupdate",
|
|
729
|
-
"pointerup",
|
|
730
|
-
"scroll",
|
|
731
|
-
"scrollend",
|
|
732
|
-
"scrollsnapchange",
|
|
733
|
-
"scrollsnapchanging",
|
|
734
|
-
"securitypolicyviolation",
|
|
735
|
-
"touchcancel",
|
|
736
|
-
"touchend",
|
|
737
|
-
"touchmove",
|
|
738
|
-
"touchstart",
|
|
739
|
-
"transitioncancel",
|
|
740
|
-
"transitionend",
|
|
741
|
-
"transitionrun",
|
|
742
|
-
"transitionstart",
|
|
743
|
-
"webkitmouseforcechanged",
|
|
744
|
-
"webkitmouseforcedown",
|
|
745
|
-
"webkitmouseforceup",
|
|
746
|
-
"webkimouseforcewillbegin",
|
|
747
|
-
"wheel",
|
|
748
|
-
// HTMLElement
|
|
749
|
-
"beforetoggle",
|
|
750
|
-
"change",
|
|
751
|
-
"command",
|
|
752
|
-
"drag",
|
|
753
|
-
"dragend",
|
|
754
|
-
"dragenter",
|
|
755
|
-
"dragleave",
|
|
756
|
-
"dragover",
|
|
757
|
-
"dragstart",
|
|
758
|
-
"drop",
|
|
759
|
-
"error",
|
|
760
|
-
"load",
|
|
761
|
-
"toggle",
|
|
762
|
-
// HTMLInputElement
|
|
763
|
-
"cancel",
|
|
764
|
-
"invalid",
|
|
765
|
-
"search",
|
|
766
|
-
"select",
|
|
767
|
-
"selectionchange",
|
|
768
|
-
// HTMLFormElement
|
|
769
|
-
"formdata",
|
|
770
|
-
"reset",
|
|
771
|
-
"submit"
|
|
772
|
-
];
|
|
773
|
-
var tt;
|
|
774
|
-
tt = N;
|
|
775
|
-
class Mt {
|
|
776
|
-
constructor(t, e, s) {
|
|
777
|
-
c(this, tt, k);
|
|
778
|
-
c(this, "context");
|
|
779
|
-
c(this, "content");
|
|
780
|
-
c(this, "parent");
|
|
781
|
-
c(this, "element");
|
|
782
|
-
this.context = t, this.content = e, this.parent = s;
|
|
783
|
-
}
|
|
784
|
-
isMounted() {
|
|
785
|
-
return this.element ? this.element.isMounted() : !1;
|
|
786
|
-
}
|
|
787
|
-
mount(t, e) {
|
|
788
|
-
this.element = ht(this.content, this.context), this.element.mount(this.parent);
|
|
789
|
-
}
|
|
790
|
-
unmount(t = !1) {
|
|
791
|
-
var e;
|
|
792
|
-
(e = this.element) != null && e.isMounted() && this.element.unmount(!1);
|
|
793
|
-
}
|
|
794
|
-
move(t, e) {
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
var et;
|
|
798
|
-
et = N;
|
|
799
|
-
class St {
|
|
800
|
-
constructor(t, e, s, i) {
|
|
801
|
-
c(this, et, k);
|
|
802
|
-
c(this, "root", document.createTextNode(""));
|
|
803
|
-
c(this, "context");
|
|
804
|
-
c(this, "items");
|
|
805
|
-
c(this, "key");
|
|
806
|
-
c(this, "render");
|
|
807
|
-
c(this, "unsubscribe", null);
|
|
808
|
-
c(this, "connectedItems", /* @__PURE__ */ new Map());
|
|
809
|
-
this.context = t, this.items = e, this.key = s, this.render = i;
|
|
810
|
-
}
|
|
811
|
-
isMounted() {
|
|
812
|
-
return this.root.parentElement != null;
|
|
813
|
-
}
|
|
814
|
-
mount(t, e) {
|
|
815
|
-
this.isMounted() || (t.insertBefore(this.root, (e == null ? void 0 : e.nextSibling) ?? null), this.unsubscribe = w(() => {
|
|
816
|
-
let s = this.items();
|
|
817
|
-
s == null && (s = [], this.context.warn("repeat() received empty value for items", s)), E(() => {
|
|
818
|
-
this._update(Array.from(s));
|
|
819
|
-
});
|
|
820
|
-
}));
|
|
821
|
-
}
|
|
822
|
-
unmount(t = !1) {
|
|
823
|
-
var e;
|
|
824
|
-
this.unsubscribe && (this.unsubscribe(), this.unsubscribe = null), !t && this.isMounted() && ((e = this.root.parentNode) == null || e.removeChild(this.root)), this._cleanup(t);
|
|
825
|
-
}
|
|
826
|
-
move(t, e) {
|
|
827
|
-
return this.mount(t, e);
|
|
828
|
-
}
|
|
829
|
-
_cleanup(t) {
|
|
830
|
-
for (const e of this.connectedItems.values())
|
|
831
|
-
e.node.unmount(t);
|
|
832
|
-
this.connectedItems.clear();
|
|
833
|
-
}
|
|
834
|
-
_update(t) {
|
|
835
|
-
var r, a, u;
|
|
836
|
-
if (t.length === 0 || !this.isMounted())
|
|
837
|
-
return this._cleanup(!1);
|
|
838
|
-
const e = /* @__PURE__ */ new Map();
|
|
839
|
-
let s = 0;
|
|
840
|
-
for (const h of t) {
|
|
841
|
-
const m = this.key(h, s);
|
|
842
|
-
e.set(m, {
|
|
843
|
-
key: m,
|
|
844
|
-
value: h,
|
|
845
|
-
index: s++
|
|
846
|
-
});
|
|
847
|
-
}
|
|
848
|
-
const i = [];
|
|
849
|
-
for (const h of this.connectedItems.values())
|
|
850
|
-
!e.has(h.key) && h.node.isMounted() && h.node.unmount(!1);
|
|
851
|
-
gt(() => {
|
|
852
|
-
for (const h of e.values()) {
|
|
853
|
-
const m = this.connectedItems.get(h.key);
|
|
854
|
-
if (m && m.node.isMounted())
|
|
855
|
-
m.$item(h.value), m.$index(h.index), i[h.index] = m;
|
|
856
|
-
else {
|
|
857
|
-
const M = _(h.value, { equals: wt }), S = _(h.index);
|
|
858
|
-
i[h.index] = {
|
|
859
|
-
key: h.key,
|
|
860
|
-
$item: M,
|
|
861
|
-
$index: S,
|
|
862
|
-
node: new nt(this.context, It, {
|
|
863
|
-
$item: () => M(),
|
|
864
|
-
$index: () => S(),
|
|
865
|
-
render: this.render
|
|
866
|
-
})
|
|
867
|
-
};
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
});
|
|
871
|
-
for (let h = 0; h < i.length; h++) {
|
|
872
|
-
const m = i[h], M = ((r = i[h - 1]) == null ? void 0 : r.node.root) ?? this.root, S = this.connectedItems.get(m.key);
|
|
873
|
-
S && S.node.isMounted() ? m.node.move(this.root.parentElement, M) : m.node.mount(this.root.parentElement, M);
|
|
874
|
-
}
|
|
875
|
-
this.connectedItems.clear();
|
|
876
|
-
for (const h of i)
|
|
877
|
-
this.connectedItems.set(h.key, h);
|
|
878
|
-
const n = ((a = i.at(-1)) == null ? void 0 : a.node.root) ?? this.root;
|
|
879
|
-
(u = this.root.parentNode) == null || u.insertBefore(this.root, n.nextSibling);
|
|
880
|
-
}
|
|
881
|
-
}
|
|
882
|
-
const Et = "dolla.RepeatItemView";
|
|
883
|
-
function It(o, t) {
|
|
884
|
-
return t.setName(Et), o.render.call(t, o.$item, o.$index, t);
|
|
885
|
-
}
|
|
886
|
-
class at {
|
|
887
|
-
constructor(t, e) {
|
|
888
|
-
/**
|
|
889
|
-
* In the case of a view, type will be the View function itself. It can also hold an identifier for special nodes like "$cond", "$repeat", etc.
|
|
890
|
-
* DOM nodes can be created by name, such as HTML elements like "div", "ul" or "span", SVG elements like ""
|
|
891
|
-
*/
|
|
892
|
-
c(this, "type");
|
|
893
|
-
/**
|
|
894
|
-
* Data that will be passed to a new MarkupNode instance when it is constructed.
|
|
895
|
-
* Includes a `children` prop if children were passed.
|
|
896
|
-
*/
|
|
897
|
-
c(this, "props");
|
|
898
|
-
this.type = t, this.props = e;
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
function Lt(o) {
|
|
902
|
-
return (o == null ? void 0 : o[N]) === k;
|
|
903
|
-
}
|
|
904
|
-
var Ot = /* @__PURE__ */ ((o) => (o.DOM = "$dom", o.Dynamic = "$dynamic", o.Portal = "$portal", o.Repeat = "$repeat", o))(Ot || {});
|
|
905
|
-
function W(o, t) {
|
|
906
|
-
return new at(o, t ?? {});
|
|
907
|
-
}
|
|
908
|
-
function Tt(o, t, e) {
|
|
909
|
-
return W("$dynamic", {
|
|
910
|
-
source: _(() => {
|
|
911
|
-
const s = y(o);
|
|
912
|
-
return s && t ? t : !s && e ? e : null;
|
|
913
|
-
})
|
|
914
|
-
});
|
|
915
|
-
}
|
|
916
|
-
function At(o, t, e) {
|
|
917
|
-
return Tt(o, e, t);
|
|
918
|
-
}
|
|
919
|
-
function Dt(o, t, e) {
|
|
920
|
-
return W("$repeat", { items: () => y(o), key: t, render: e });
|
|
921
|
-
}
|
|
922
|
-
function Ct(o, t) {
|
|
923
|
-
return W("$portal", { parent: o, content: t });
|
|
924
|
-
}
|
|
925
|
-
function ht(o, t = new d("$")) {
|
|
926
|
-
const e = B(t, [o]);
|
|
927
|
-
return e.length === 1 ? e[0] : new A(t, () => e);
|
|
928
|
-
}
|
|
929
|
-
function B(o, ...t) {
|
|
930
|
-
const e = t.flat(1 / 0), s = [];
|
|
931
|
-
for (const i of e)
|
|
932
|
-
if (!(i == null || i === !1)) {
|
|
933
|
-
if (i instanceof Node) {
|
|
934
|
-
s.push(new $(i));
|
|
935
|
-
continue;
|
|
936
|
-
}
|
|
937
|
-
if (i instanceof at)
|
|
938
|
-
if (f(i.type)) {
|
|
939
|
-
s.push(new nt(o, i.type, i.props));
|
|
940
|
-
continue;
|
|
941
|
-
} else if (C(i.type))
|
|
942
|
-
switch (i.type) {
|
|
943
|
-
case "$dom": {
|
|
944
|
-
const n = i.props;
|
|
945
|
-
s.push(new $(n.value));
|
|
946
|
-
continue;
|
|
947
|
-
}
|
|
948
|
-
case "$dynamic": {
|
|
949
|
-
const n = i.props;
|
|
950
|
-
s.push(new A(o, n.source));
|
|
951
|
-
continue;
|
|
952
|
-
}
|
|
953
|
-
case "$portal": {
|
|
954
|
-
const n = i.props;
|
|
955
|
-
s.push(new Mt(o, n.content, n.parent));
|
|
956
|
-
continue;
|
|
957
|
-
}
|
|
958
|
-
case "$repeat": {
|
|
959
|
-
const n = i.props;
|
|
960
|
-
s.push(new St(o, n.items, n.key, n.render));
|
|
961
|
-
continue;
|
|
962
|
-
}
|
|
963
|
-
default:
|
|
964
|
-
s.push(new Nt(o, i.type, i.props));
|
|
965
|
-
continue;
|
|
966
|
-
}
|
|
967
|
-
else
|
|
968
|
-
throw new TypeError(`Expected a string or view function. Got: ${i.type}`);
|
|
969
|
-
if (Lt(i)) {
|
|
970
|
-
s.push(i);
|
|
971
|
-
continue;
|
|
972
|
-
}
|
|
973
|
-
if (f(i)) {
|
|
974
|
-
s.push(new A(o, i));
|
|
975
|
-
continue;
|
|
976
|
-
}
|
|
977
|
-
s.push(new $(document.createTextNode(String(i))));
|
|
978
|
-
}
|
|
979
|
-
return s;
|
|
980
|
-
}
|
|
981
|
-
export {
|
|
982
|
-
d as C,
|
|
983
|
-
A as D,
|
|
984
|
-
b as L,
|
|
985
|
-
Ot as M,
|
|
986
|
-
nt as V,
|
|
987
|
-
Dt as a,
|
|
988
|
-
at as b,
|
|
989
|
-
_t as c,
|
|
990
|
-
W as m,
|
|
991
|
-
Ct as p,
|
|
992
|
-
ht as r,
|
|
993
|
-
At as u,
|
|
994
|
-
Tt as w
|
|
995
|
-
};
|
|
996
|
-
//# sourceMappingURL=markup-BGlfQYQk.js.map
|