@manyducks.co/dolla 3.1.0 → 3.2.0
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/index.d.ts +1 -1
- package/dist/core/signals.d.ts +33 -1
- package/dist/core-2CFW0uRa.js +1047 -0
- package/dist/core-2CFW0uRa.js.map +1 -0
- package/dist/index.js +2 -4
- package/dist/jsx-dev-runtime.js +1 -1
- package/dist/jsx-runtime.js +1 -1
- package/dist/router/types.d.ts +4 -3
- package/dist/router/utils.d.ts +1 -1
- package/dist/router.js +148 -150
- package/dist/router.js.map +1 -1
- package/dist/translate.js +24 -24
- package/package.json +1 -1
- package/dist/context-B5blupD2.js +0 -363
- package/dist/context-B5blupD2.js.map +0 -1
- package/dist/core-JHktdqjt.js +0 -242
- package/dist/core-JHktdqjt.js.map +0 -1
- package/dist/signals-CMJPGr_M.js +0 -354
- package/dist/signals-CMJPGr_M.js.map +0 -1
|
@@ -0,0 +1,1047 @@
|
|
|
1
|
+
//#region src/utils.ts
|
|
2
|
+
var e = 0;
|
|
3
|
+
function t() {
|
|
4
|
+
return (e++).toString(36);
|
|
5
|
+
}
|
|
6
|
+
function n(e, t) {
|
|
7
|
+
let n = {};
|
|
8
|
+
for (let r in t) e.includes(r) || (n[r] = t[r]);
|
|
9
|
+
return n;
|
|
10
|
+
}
|
|
11
|
+
function r(e, t) {
|
|
12
|
+
if (!e) throw TypeError(t);
|
|
13
|
+
}
|
|
14
|
+
function i(e) {
|
|
15
|
+
return Array.isArray(e);
|
|
16
|
+
}
|
|
17
|
+
function a(e) {
|
|
18
|
+
return typeof e == "string";
|
|
19
|
+
}
|
|
20
|
+
function o(e) {
|
|
21
|
+
return typeof e == "function" && !s(e);
|
|
22
|
+
}
|
|
23
|
+
function s(e) {
|
|
24
|
+
return /^\s*class\s+/.test(String(e));
|
|
25
|
+
}
|
|
26
|
+
function c(e) {
|
|
27
|
+
return typeof e == "number" && !isNaN(e);
|
|
28
|
+
}
|
|
29
|
+
function l(e) {
|
|
30
|
+
return typeof e == "object" && !!e && !i(e);
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/core/signals.ts
|
|
34
|
+
var u = /* @__PURE__ */ function(e) {
|
|
35
|
+
return e[e.None = 0] = "None", e[e.Mutable = 1] = "Mutable", e[e.Watching = 2] = "Watching", e[e.RecursedCheck = 4] = "RecursedCheck", e[e.Recursed = 8] = "Recursed", e[e.Dirty = 16] = "Dirty", e[e.Pending = 32] = "Pending", e;
|
|
36
|
+
}(u || {}), d = 0, f = 0, p = 0, m = 0, h, g = [];
|
|
37
|
+
function _(e, t, n) {
|
|
38
|
+
let r = t._depsTail;
|
|
39
|
+
if (r !== void 0 && r._dep === e) return;
|
|
40
|
+
let i = r === void 0 ? t._deps : r._nextDep;
|
|
41
|
+
if (i !== void 0 && i._dep === e) {
|
|
42
|
+
i._version = n, t._depsTail = i;
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
let a = e._subsTail;
|
|
46
|
+
if (a !== void 0 && a._version === n && a._sub === t) return;
|
|
47
|
+
let o = t._depsTail = e._subsTail = {
|
|
48
|
+
_version: n,
|
|
49
|
+
_dep: e,
|
|
50
|
+
_sub: t,
|
|
51
|
+
_prevDep: r,
|
|
52
|
+
_nextDep: i,
|
|
53
|
+
_prevSub: a,
|
|
54
|
+
_nextSub: void 0
|
|
55
|
+
};
|
|
56
|
+
i !== void 0 && (i._prevDep = o), r === void 0 ? t._deps = o : r._nextDep = o, a === void 0 ? e._subs = o : a._nextSub = o;
|
|
57
|
+
}
|
|
58
|
+
function ee(e) {
|
|
59
|
+
e._flags & u.Mutable ? e._depsTail !== void 0 && (e._depsTail = void 0, e._flags = u.Mutable | u.Dirty, S(e)) : me.call(e);
|
|
60
|
+
}
|
|
61
|
+
function te(e, t = e._sub) {
|
|
62
|
+
let n = e._dep, r = e._prevDep, i = e._nextDep, a = e._nextSub, o = e._prevSub;
|
|
63
|
+
return i === void 0 ? t._depsTail = r : i._prevDep = r, r === void 0 ? t._deps = i : r._nextDep = i, a === void 0 ? n._subsTail = o : a._prevSub = o, o === void 0 ? (n._subs = a) === void 0 && ee(n) : o._nextSub = a, i;
|
|
64
|
+
}
|
|
65
|
+
function v(e) {
|
|
66
|
+
let t = m, n = t;
|
|
67
|
+
do
|
|
68
|
+
if (g[t++] = e, e._flags &= ~u.Watching, e = e._subs?._sub, e === void 0 || !(e._flags & u.Watching)) break;
|
|
69
|
+
while (!0);
|
|
70
|
+
for (m = t; n < --t;) {
|
|
71
|
+
let e = g[n];
|
|
72
|
+
g[n++] = g[t], g[t] = e;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function ne(e) {
|
|
76
|
+
return e._depsTail === void 0 ? se(e) : oe(e);
|
|
77
|
+
}
|
|
78
|
+
function re(e) {
|
|
79
|
+
let t = e._nextSub, n;
|
|
80
|
+
top: do {
|
|
81
|
+
let r = e._sub, i = r._flags;
|
|
82
|
+
if (i & (u.RecursedCheck | u.Recursed | u.Dirty | u.Pending) ? i & (u.RecursedCheck | u.Recursed) ? i & u.RecursedCheck ? !(i & (u.Dirty | u.Pending)) && ae(e, r) ? (r._flags = i | (u.Recursed | u.Pending), i &= u.Mutable) : i = u.None : r._flags = i & ~u.Recursed | u.Pending : i = u.None : r._flags = i | u.Pending, i & u.Watching && v(r), i & u.Mutable) {
|
|
83
|
+
let i = r._subs;
|
|
84
|
+
if (i !== void 0) {
|
|
85
|
+
let r = (e = i)._nextSub;
|
|
86
|
+
r !== void 0 && (n = {
|
|
87
|
+
_value: t,
|
|
88
|
+
_prev: n
|
|
89
|
+
}, t = r);
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if ((e = t) !== void 0) {
|
|
94
|
+
t = e._nextSub;
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
for (; n !== void 0;) if (e = n._value, n = n._prev, e !== void 0) {
|
|
98
|
+
t = e._nextSub;
|
|
99
|
+
continue top;
|
|
100
|
+
}
|
|
101
|
+
break;
|
|
102
|
+
} while (!0);
|
|
103
|
+
}
|
|
104
|
+
function ie(e, t) {
|
|
105
|
+
let n, r = 0, i = !1;
|
|
106
|
+
top: do {
|
|
107
|
+
let a = e._dep, o = a._flags;
|
|
108
|
+
if (t._flags & u.Dirty) i = !0;
|
|
109
|
+
else if ((o & (u.Mutable | u.Dirty)) === (u.Mutable | u.Dirty)) {
|
|
110
|
+
if (ne(a)) {
|
|
111
|
+
let e = a._subs;
|
|
112
|
+
e._nextSub !== void 0 && y(e), i = !0;
|
|
113
|
+
}
|
|
114
|
+
} else if ((o & (u.Mutable | u.Pending)) === (u.Mutable | u.Pending)) {
|
|
115
|
+
(e._nextSub !== void 0 || e._prevSub !== void 0) && (n = {
|
|
116
|
+
_value: e,
|
|
117
|
+
_prev: n
|
|
118
|
+
}), e = a._deps, t = a, ++r;
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
if (!i) {
|
|
122
|
+
let t = e._nextDep;
|
|
123
|
+
if (t !== void 0) {
|
|
124
|
+
e = t;
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
for (; r--;) {
|
|
129
|
+
let r = t._subs, a = r._nextSub !== void 0;
|
|
130
|
+
if (a ? (e = n._value, n = n._prev) : e = r, i) {
|
|
131
|
+
if (ne(t)) {
|
|
132
|
+
a && y(r), t = e._sub;
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
i = !1;
|
|
136
|
+
} else t._flags &= ~u.Pending;
|
|
137
|
+
t = e._sub;
|
|
138
|
+
let o = e._nextDep;
|
|
139
|
+
if (o !== void 0) {
|
|
140
|
+
e = o;
|
|
141
|
+
continue top;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return i;
|
|
145
|
+
} while (!0);
|
|
146
|
+
}
|
|
147
|
+
function y(e) {
|
|
148
|
+
do {
|
|
149
|
+
let t = e._sub, n = t._flags;
|
|
150
|
+
(n & (u.Pending | u.Dirty)) === u.Pending && (t._flags = n | u.Dirty, (n & (u.Watching | u.RecursedCheck)) === u.Watching && v(t));
|
|
151
|
+
} while ((e = e._nextSub) !== void 0);
|
|
152
|
+
}
|
|
153
|
+
function ae(e, t) {
|
|
154
|
+
let n = t._depsTail;
|
|
155
|
+
for (; n !== void 0;) {
|
|
156
|
+
if (n === e) return !0;
|
|
157
|
+
n = n._prevDep;
|
|
158
|
+
}
|
|
159
|
+
return !1;
|
|
160
|
+
}
|
|
161
|
+
function b(e) {
|
|
162
|
+
let t = h;
|
|
163
|
+
return h = e, t;
|
|
164
|
+
}
|
|
165
|
+
function oe(e) {
|
|
166
|
+
++d, e._depsTail = void 0, e._flags = u.Mutable | u.RecursedCheck;
|
|
167
|
+
let t = b(e);
|
|
168
|
+
try {
|
|
169
|
+
let t = e._value;
|
|
170
|
+
return t !== (e._value = e._getter(t));
|
|
171
|
+
} finally {
|
|
172
|
+
h = t, e._flags &= ~u.RecursedCheck, S(e);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function se(e) {
|
|
176
|
+
e._flags = u.Mutable;
|
|
177
|
+
let t = e._currentValue !== (e._currentValue = e._pendingValue);
|
|
178
|
+
return e._skipEqualValues ? t : !0;
|
|
179
|
+
}
|
|
180
|
+
function ce(e) {
|
|
181
|
+
let t = e._flags;
|
|
182
|
+
if (t & u.Dirty || t & u.Pending && ie(e._deps, e)) {
|
|
183
|
+
++d, e._depsTail = void 0, e._flags = u.Watching | u.RecursedCheck;
|
|
184
|
+
let t = b(e);
|
|
185
|
+
try {
|
|
186
|
+
e._cleanup?.(), e._cleanup = void 0;
|
|
187
|
+
let t = e._fn();
|
|
188
|
+
o(t) && (e._cleanup = t);
|
|
189
|
+
} finally {
|
|
190
|
+
h = t, e._flags &= ~u.RecursedCheck, S(e);
|
|
191
|
+
}
|
|
192
|
+
} else e._flags = u.Watching;
|
|
193
|
+
}
|
|
194
|
+
function x() {
|
|
195
|
+
try {
|
|
196
|
+
for (; p < m;) {
|
|
197
|
+
let e = g[p];
|
|
198
|
+
g[p++] = void 0, ce(e);
|
|
199
|
+
}
|
|
200
|
+
} finally {
|
|
201
|
+
for (; p < m;) {
|
|
202
|
+
let e = g[p];
|
|
203
|
+
g[p++] = void 0, e._flags |= u.Watching | u.Recursed;
|
|
204
|
+
}
|
|
205
|
+
p = 0, m = 0;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
function S(e) {
|
|
209
|
+
let t = e._depsTail, n = t === void 0 ? e._deps : t._nextDep;
|
|
210
|
+
for (; n !== void 0;) n = te(n, e);
|
|
211
|
+
}
|
|
212
|
+
function le(e, t) {
|
|
213
|
+
return o(e) ? D(() => e(t)) : e;
|
|
214
|
+
}
|
|
215
|
+
function ue() {
|
|
216
|
+
let e = this._flags;
|
|
217
|
+
if (e & u.Dirty || e & u.Pending && (ie(this._deps, this) || (this._flags = e & ~u.Pending, !1))) {
|
|
218
|
+
if (oe(this)) {
|
|
219
|
+
let e = this._subs;
|
|
220
|
+
e !== void 0 && y(e);
|
|
221
|
+
}
|
|
222
|
+
} else if (!e) {
|
|
223
|
+
this._flags = u.Mutable | u.RecursedCheck;
|
|
224
|
+
let e = b(this);
|
|
225
|
+
try {
|
|
226
|
+
this._value = E(this._getter());
|
|
227
|
+
} finally {
|
|
228
|
+
h = e, this._flags &= ~u.RecursedCheck;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
let t = h;
|
|
232
|
+
return t !== void 0 && _(this, t, d), this._value;
|
|
233
|
+
}
|
|
234
|
+
function de(e) {
|
|
235
|
+
let t = le(e, this._value);
|
|
236
|
+
if (this._value !== t) {
|
|
237
|
+
this._value = t, this._flags &= ~(u.Dirty | u.Pending);
|
|
238
|
+
let e = this._subs;
|
|
239
|
+
for (; e !== void 0;) {
|
|
240
|
+
let t = e._sub, n = t._flags;
|
|
241
|
+
(n & (u.Dirty | u.Pending)) === 0 && (t._flags = n | u.Dirty, v(t)), e = e._nextSub;
|
|
242
|
+
}
|
|
243
|
+
f || x();
|
|
244
|
+
}
|
|
245
|
+
return t;
|
|
246
|
+
}
|
|
247
|
+
function fe() {
|
|
248
|
+
if (this._flags & u.Dirty && se(this)) {
|
|
249
|
+
let e = this._subs;
|
|
250
|
+
e !== void 0 && y(e);
|
|
251
|
+
}
|
|
252
|
+
let e = h;
|
|
253
|
+
for (; e !== void 0;) {
|
|
254
|
+
if (e._flags & (u.Mutable | u.Watching)) {
|
|
255
|
+
_(this, e, d);
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
e = e._subs?._sub;
|
|
259
|
+
}
|
|
260
|
+
return this._currentValue;
|
|
261
|
+
}
|
|
262
|
+
function pe(e) {
|
|
263
|
+
let t = le(e, this._pendingValue);
|
|
264
|
+
if (this._pendingValue !== (this._pendingValue = t)) {
|
|
265
|
+
this._flags = u.Mutable | u.Dirty;
|
|
266
|
+
let e = this._subs;
|
|
267
|
+
e !== void 0 && (re(e), f || x());
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
function me() {
|
|
271
|
+
this._depsTail = void 0, this._flags = u.None, S(this);
|
|
272
|
+
let e = this._subs;
|
|
273
|
+
e !== void 0 && te(e), this._cleanup?.(), this._cleanup = void 0;
|
|
274
|
+
}
|
|
275
|
+
function C(e) {
|
|
276
|
+
if (o(e)) {
|
|
277
|
+
let t = {
|
|
278
|
+
_value: void 0,
|
|
279
|
+
_subs: void 0,
|
|
280
|
+
_subsTail: void 0,
|
|
281
|
+
_deps: void 0,
|
|
282
|
+
_depsTail: void 0,
|
|
283
|
+
_flags: u.None,
|
|
284
|
+
_getter: e
|
|
285
|
+
};
|
|
286
|
+
return [ue.bind(t), de.bind(t)];
|
|
287
|
+
} else {
|
|
288
|
+
let t = {
|
|
289
|
+
_currentValue: e,
|
|
290
|
+
_pendingValue: e,
|
|
291
|
+
_subs: void 0,
|
|
292
|
+
_subsTail: void 0,
|
|
293
|
+
_flags: u.Mutable,
|
|
294
|
+
_skipEqualValues: !0
|
|
295
|
+
};
|
|
296
|
+
return [fe.bind(t), pe.bind(t)];
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
function w(e) {
|
|
300
|
+
return o(e) ? ue.bind({
|
|
301
|
+
_value: void 0,
|
|
302
|
+
_subs: void 0,
|
|
303
|
+
_subsTail: void 0,
|
|
304
|
+
_deps: void 0,
|
|
305
|
+
_depsTail: void 0,
|
|
306
|
+
_flags: u.None,
|
|
307
|
+
_getter: e
|
|
308
|
+
}) : () => e;
|
|
309
|
+
}
|
|
310
|
+
function T(e) {
|
|
311
|
+
let t = {
|
|
312
|
+
_fn: e,
|
|
313
|
+
_cleanup: void 0,
|
|
314
|
+
_subs: void 0,
|
|
315
|
+
_subsTail: void 0,
|
|
316
|
+
_deps: void 0,
|
|
317
|
+
_depsTail: void 0,
|
|
318
|
+
_flags: u.Watching | u.RecursedCheck
|
|
319
|
+
}, n = b(t);
|
|
320
|
+
n !== void 0 && _(t, n, 0);
|
|
321
|
+
try {
|
|
322
|
+
let e = t._fn();
|
|
323
|
+
o(e) && (t._cleanup = e);
|
|
324
|
+
} finally {
|
|
325
|
+
h = n, t._flags &= ~u.RecursedCheck;
|
|
326
|
+
}
|
|
327
|
+
return me.bind(t);
|
|
328
|
+
}
|
|
329
|
+
function E(e) {
|
|
330
|
+
return o(e) ? e() : e;
|
|
331
|
+
}
|
|
332
|
+
function D(e) {
|
|
333
|
+
let t = b(void 0);
|
|
334
|
+
try {
|
|
335
|
+
return E(e);
|
|
336
|
+
} finally {
|
|
337
|
+
b(t);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
function he(e) {
|
|
341
|
+
++f;
|
|
342
|
+
try {
|
|
343
|
+
e();
|
|
344
|
+
} finally {
|
|
345
|
+
--f || x();
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
function O(e, t) {
|
|
349
|
+
return T(() => {
|
|
350
|
+
let n = e();
|
|
351
|
+
D(() => t(n));
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
function k({ value: e, signal: t }) {
|
|
355
|
+
return {
|
|
356
|
+
get latest() {
|
|
357
|
+
return D(e);
|
|
358
|
+
},
|
|
359
|
+
current: e,
|
|
360
|
+
next() {
|
|
361
|
+
return new Promise((n, r) => {
|
|
362
|
+
let i = !1, a = T(() => {
|
|
363
|
+
let t = e();
|
|
364
|
+
i ? (n(t), a()) : i = !0;
|
|
365
|
+
});
|
|
366
|
+
t.addEventListener("abort", () => {
|
|
367
|
+
r(/* @__PURE__ */ Error("Aborted by the parent context unmounting.")), a();
|
|
368
|
+
});
|
|
369
|
+
});
|
|
370
|
+
},
|
|
371
|
+
map(n) {
|
|
372
|
+
return k({
|
|
373
|
+
value: w((t) => n(e(), t)),
|
|
374
|
+
signal: t
|
|
375
|
+
});
|
|
376
|
+
},
|
|
377
|
+
reduce(n, r) {
|
|
378
|
+
return k({
|
|
379
|
+
value: w((t) => n(t ?? r, e())),
|
|
380
|
+
signal: t
|
|
381
|
+
});
|
|
382
|
+
},
|
|
383
|
+
filter(n, r) {
|
|
384
|
+
return k({
|
|
385
|
+
value: w((t) => {
|
|
386
|
+
let i = e();
|
|
387
|
+
return n(i, t) ? i : t ?? r;
|
|
388
|
+
}),
|
|
389
|
+
signal: t
|
|
390
|
+
});
|
|
391
|
+
},
|
|
392
|
+
throttle(n) {
|
|
393
|
+
let [r, i] = C(D(e)), a = Date.now() + n;
|
|
394
|
+
return k({
|
|
395
|
+
value: w(() => {
|
|
396
|
+
let t = r(), n = e(), o = Date.now();
|
|
397
|
+
return o >= a ? (a = o, i(n)) : t;
|
|
398
|
+
}),
|
|
399
|
+
signal: t
|
|
400
|
+
});
|
|
401
|
+
},
|
|
402
|
+
debounce(n) {
|
|
403
|
+
let [r, i] = C(D(e)), a = !1, o;
|
|
404
|
+
return t.addEventListener("abort", () => {
|
|
405
|
+
clearTimeout(o);
|
|
406
|
+
}), k({
|
|
407
|
+
value: w(() => {
|
|
408
|
+
let t = r(), s = e();
|
|
409
|
+
return a || (clearTimeout(o), o = setTimeout(() => {
|
|
410
|
+
a = !0, i(s), a = !1, o = void 0;
|
|
411
|
+
}, n)), t;
|
|
412
|
+
}),
|
|
413
|
+
signal: t
|
|
414
|
+
});
|
|
415
|
+
},
|
|
416
|
+
delay(n, r) {
|
|
417
|
+
let [i, a] = C(r ?? D(e)), o = !1, s;
|
|
418
|
+
return t.addEventListener("abort", () => {
|
|
419
|
+
clearTimeout(s);
|
|
420
|
+
}), k({
|
|
421
|
+
value: w(() => {
|
|
422
|
+
let t = i(), r = e();
|
|
423
|
+
return o || (s = setTimeout(() => {
|
|
424
|
+
o = !0, a(r), o = !1, s = void 0;
|
|
425
|
+
}, n)), t;
|
|
426
|
+
}),
|
|
427
|
+
signal: t
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
function ge(e) {
|
|
433
|
+
let t = {
|
|
434
|
+
_currentValue: e?.initialValue,
|
|
435
|
+
_pendingValue: e?.initialValue,
|
|
436
|
+
_subs: void 0,
|
|
437
|
+
_subsTail: void 0,
|
|
438
|
+
_flags: u.Mutable,
|
|
439
|
+
_skipEqualValues: !1
|
|
440
|
+
}, n = fe.bind(t), r = pe.bind(t), i = new AbortController(), a = k({
|
|
441
|
+
value: n,
|
|
442
|
+
signal: i.signal
|
|
443
|
+
});
|
|
444
|
+
return e?.context && X(e.context, () => {
|
|
445
|
+
i.abort();
|
|
446
|
+
}), [a, r];
|
|
447
|
+
}
|
|
448
|
+
//#endregion
|
|
449
|
+
//#region src/core/markup/types.ts
|
|
450
|
+
var _e = Symbol(), ve = Symbol(), ye = Symbol(), A = class {
|
|
451
|
+
static [ye] = !0;
|
|
452
|
+
get [ve]() {
|
|
453
|
+
return !0;
|
|
454
|
+
}
|
|
455
|
+
}, j = class extends A {
|
|
456
|
+
#e;
|
|
457
|
+
constructor(e, t) {
|
|
458
|
+
super(), this.#e = t;
|
|
459
|
+
}
|
|
460
|
+
getRoot() {
|
|
461
|
+
return this.#e;
|
|
462
|
+
}
|
|
463
|
+
isMounted() {
|
|
464
|
+
return this.#e.parentNode != null;
|
|
465
|
+
}
|
|
466
|
+
mount(e, t) {
|
|
467
|
+
B(e, this.#e, t);
|
|
468
|
+
}
|
|
469
|
+
unmount(e = !1) {
|
|
470
|
+
e || this.#e.parentNode?.removeChild(this.#e);
|
|
471
|
+
}
|
|
472
|
+
move(e, t) {
|
|
473
|
+
Ae(e, this.#e, t);
|
|
474
|
+
}
|
|
475
|
+
};
|
|
476
|
+
//#endregion
|
|
477
|
+
//#region src/core/markup/scheduler.ts
|
|
478
|
+
function M(e) {
|
|
479
|
+
e();
|
|
480
|
+
}
|
|
481
|
+
//#endregion
|
|
482
|
+
//#region src/core/markup/nodes/dynamic.ts
|
|
483
|
+
var N = class extends A {
|
|
484
|
+
#e = V("");
|
|
485
|
+
#t = [];
|
|
486
|
+
#n;
|
|
487
|
+
#r;
|
|
488
|
+
#i;
|
|
489
|
+
constructor(e, t) {
|
|
490
|
+
super(), this.#n = e, this.#r = t;
|
|
491
|
+
}
|
|
492
|
+
getRoot() {
|
|
493
|
+
return this.#e;
|
|
494
|
+
}
|
|
495
|
+
isMounted() {
|
|
496
|
+
return this.#e.parentNode != null;
|
|
497
|
+
}
|
|
498
|
+
mount(e, t) {
|
|
499
|
+
this.isMounted() || (B(e, this.#e, t), this.#i = O(this.#r, (e) => {
|
|
500
|
+
M(() => {
|
|
501
|
+
this.#o(e);
|
|
502
|
+
});
|
|
503
|
+
}));
|
|
504
|
+
}
|
|
505
|
+
unmount(e = !1) {
|
|
506
|
+
this.#i?.(), this.isMounted() && (e || this.#e.parentNode?.removeChild(this.#e), this.#a(e));
|
|
507
|
+
}
|
|
508
|
+
move(e, t) {
|
|
509
|
+
let n = t?.nextSibling ?? null;
|
|
510
|
+
if (e.moveBefore) try {
|
|
511
|
+
e.moveBefore(this.#e, n), n = this.#e.nextSibling;
|
|
512
|
+
for (let t = 0; t < this.#t.length; t++) {
|
|
513
|
+
let r = this.#t[t].getRoot();
|
|
514
|
+
r && e.moveBefore(r, n);
|
|
515
|
+
}
|
|
516
|
+
return;
|
|
517
|
+
} catch {}
|
|
518
|
+
e.insertBefore(this.#e, n), n = this.#e.nextSibling;
|
|
519
|
+
for (let t = 0; t < this.#t.length; t++) this.#t[t].move(e, this.#t[t - 1]?.getRoot() ?? this.#e);
|
|
520
|
+
}
|
|
521
|
+
#a(e) {
|
|
522
|
+
for (let t = 0; t < this.#t.length; t++) this.#t[t].unmount(e);
|
|
523
|
+
this.#t.length = 0;
|
|
524
|
+
}
|
|
525
|
+
#o(e) {
|
|
526
|
+
if (!this.isMounted()) return;
|
|
527
|
+
if ((typeof e == "string" || typeof e == "number") && this.#t.length === 1) {
|
|
528
|
+
let t = this.#t[0];
|
|
529
|
+
if (t instanceof j) {
|
|
530
|
+
let n = t.getRoot();
|
|
531
|
+
if (n && n.nodeType === Node.TEXT_NODE) {
|
|
532
|
+
n.nodeValue = String(e);
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
if (this.#a(!1), e == null || e === !1) return;
|
|
538
|
+
let t = z(this.#n, e), n = this.#e.parentElement, r = this.#e;
|
|
539
|
+
for (let e = 0; e < t.length; e++) {
|
|
540
|
+
let i = t[e];
|
|
541
|
+
i.mount(n, r), this.#t.push(i);
|
|
542
|
+
let a = i.getRoot();
|
|
543
|
+
a && (r = a);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}, be = Symbol("parentElement"), P = Symbol("debug"), F = Symbol("isSVG"), xe = ["ref", "children"], Se = class extends A {
|
|
547
|
+
#e;
|
|
548
|
+
#t;
|
|
549
|
+
#n;
|
|
550
|
+
#r = !1;
|
|
551
|
+
#i = [];
|
|
552
|
+
#a = /* @__PURE__ */ new Set();
|
|
553
|
+
#o;
|
|
554
|
+
constructor(e, t, n) {
|
|
555
|
+
if (super(), this.#t = n, this.#n = e, t === "svg" ? (this.#n = K(e), this.#n[F] = !0, this.#r = !0) : this.#n[F] && t === "foreignObject" && (this.#n = K(e), this.#n[F] = !1, this.#r = !1), this.#n[F] ? this.#e = document.createElementNS("http://www.w3.org/2000/svg", t) : this.#e = document.createElement(t), this.#n[P]) {
|
|
556
|
+
let e = Fe(this.#n);
|
|
557
|
+
e && (this.#e.dataset.view = e.context.name);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
getRoot() {
|
|
561
|
+
return this.#e;
|
|
562
|
+
}
|
|
563
|
+
isMounted() {
|
|
564
|
+
return this.#e.parentNode != null;
|
|
565
|
+
}
|
|
566
|
+
mount(e, t) {
|
|
567
|
+
let r = this.isMounted();
|
|
568
|
+
if (!r && (this.#c(this.#e, n(xe, this.#t)), this.#t.children)) {
|
|
569
|
+
this.#i = z(this.#n, this.#t.children);
|
|
570
|
+
for (let e of this.#i) e.mount(this.#e);
|
|
571
|
+
}
|
|
572
|
+
let i = t?.nextSibling ?? null;
|
|
573
|
+
if ((this.#e.parentNode !== e || this.#e.nextSibling !== i) && B(e, this.#e, i), !r) {
|
|
574
|
+
if (o(this.#t.ref)) {
|
|
575
|
+
let e = this.#t.ref(this.#e);
|
|
576
|
+
o(e) && (this.#o = e);
|
|
577
|
+
}
|
|
578
|
+
this.#r && q(this.#n);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
unmount(e = !1) {
|
|
582
|
+
!e && this.#e.parentNode && this.#e.parentNode.removeChild(this.#e);
|
|
583
|
+
for (let e of this.#i) e.unmount(!0);
|
|
584
|
+
this.#a.forEach((e) => e()), this.#a.clear(), this.#r && J(this.#n), this.#o &&= (this.#o(), void 0), this.#i.length = 0;
|
|
585
|
+
}
|
|
586
|
+
move(e, t) {
|
|
587
|
+
if (e.moveBefore) try {
|
|
588
|
+
e.moveBefore(this.#e, t?.nextSibling ?? null);
|
|
589
|
+
return;
|
|
590
|
+
} catch {}
|
|
591
|
+
this.mount(e, t);
|
|
592
|
+
}
|
|
593
|
+
#s(e, t) {
|
|
594
|
+
o(e) ? this.#a.add(O(e, (e) => {
|
|
595
|
+
M(() => t(e));
|
|
596
|
+
})) : t(e);
|
|
597
|
+
}
|
|
598
|
+
#c(e, t) {
|
|
599
|
+
for (let n in t) {
|
|
600
|
+
let r = t[n];
|
|
601
|
+
if (n === "style") this.#l(e, r);
|
|
602
|
+
else if (n === "class" || n === "className") this.#u(e, r);
|
|
603
|
+
else if (n === "for") this.#s(r, (t) => {
|
|
604
|
+
e.htmlFor = t;
|
|
605
|
+
});
|
|
606
|
+
else if (n[0] === "." || n.startsWith("prop:")) {
|
|
607
|
+
let t = n.substring(5);
|
|
608
|
+
this.#s(r, (n) => {
|
|
609
|
+
e[t] = n;
|
|
610
|
+
});
|
|
611
|
+
} else if (n[0] === ":" || n.startsWith("attr:")) {
|
|
612
|
+
let t = n.substring(5).toLowerCase();
|
|
613
|
+
this.#s(r, (n) => {
|
|
614
|
+
I(e, t, n);
|
|
615
|
+
});
|
|
616
|
+
} else if (n[0] === "@" && o(r)) {
|
|
617
|
+
let t = n.substring(1);
|
|
618
|
+
this.#a.add(H(e, t, r));
|
|
619
|
+
} else if (n.startsWith("on") && o(r)) {
|
|
620
|
+
let t = n.toLowerCase().slice(2);
|
|
621
|
+
this.#a.add(H(e, t, r));
|
|
622
|
+
} else n in e && !this.#n[F] ? typeof e[n] == "boolean" ? this.#s(r, (t) => {
|
|
623
|
+
let r = !!t;
|
|
624
|
+
e[n] = r, I(e, n, r);
|
|
625
|
+
}) : this.#s(r, (t) => {
|
|
626
|
+
e[n] = t;
|
|
627
|
+
}) : this.#s(r, (t) => {
|
|
628
|
+
I(e, n, t);
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
#l(e, t) {
|
|
633
|
+
let n = /* @__PURE__ */ new Set(), r = (t) => {
|
|
634
|
+
n.forEach((e) => {
|
|
635
|
+
e(), this.#a.delete(e);
|
|
636
|
+
}), n.clear(), e.style.cssText = "";
|
|
637
|
+
let r = we(t);
|
|
638
|
+
for (let [t, { value: i, priority: a }] of Object.entries(r)) if (o(i)) {
|
|
639
|
+
let r = O(i, (n) => {
|
|
640
|
+
n ? e.style.setProperty(t, Ee(n), a) : e.style.removeProperty(t);
|
|
641
|
+
});
|
|
642
|
+
this.#a.add(r), n.add(r);
|
|
643
|
+
} else i != null && e.style.setProperty(t, Ee(i), a);
|
|
644
|
+
};
|
|
645
|
+
o(t) ? this.#a.add(O(t, r)) : r(t);
|
|
646
|
+
}
|
|
647
|
+
#u(e, t) {
|
|
648
|
+
let n = /* @__PURE__ */ new Set(), r = (t) => {
|
|
649
|
+
n.forEach((e) => {
|
|
650
|
+
e(), this.#a.delete(e);
|
|
651
|
+
}), n.clear(), I(e, "class", null);
|
|
652
|
+
let r = Ce(t);
|
|
653
|
+
for (let [t, i] of Object.entries(r)) if (t !== "undefined") if (o(i)) {
|
|
654
|
+
let r = O(i, (n) => e.classList.toggle(t, !!n));
|
|
655
|
+
this.#a.add(r), n.add(r);
|
|
656
|
+
} else i && e.classList.add(t);
|
|
657
|
+
};
|
|
658
|
+
o(t) ? this.#a.add(O(t, r)) : r(t);
|
|
659
|
+
}
|
|
660
|
+
};
|
|
661
|
+
function Ce(e) {
|
|
662
|
+
return a(e) ? Object.fromEntries(e.split(" ").map((e) => [e, !0])) : i(e) ? Object.assign({}, ...e.filter(Boolean).map(Ce)) : l(e) ? e : {};
|
|
663
|
+
}
|
|
664
|
+
function we(e) {
|
|
665
|
+
return a(e) ? Object.fromEntries(e.split(";").filter((e) => e.trim()).map((e) => {
|
|
666
|
+
let [t, n] = e.split(":");
|
|
667
|
+
return [Te(t.trim()), {
|
|
668
|
+
value: n.replace("!important", "").trim(),
|
|
669
|
+
priority: n.includes("!important") ? "important" : ""
|
|
670
|
+
}];
|
|
671
|
+
})) : i(e) ? Object.assign({}, ...e.filter(Boolean).map(we)) : l(e) ? Object.fromEntries(Object.entries(e).map(([e, t]) => [e.startsWith("--") ? e : Te(e), { value: t }])) : {};
|
|
672
|
+
}
|
|
673
|
+
function Te(e) {
|
|
674
|
+
return e.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (e, t) => (t ? "-" : "") + e.toLowerCase());
|
|
675
|
+
}
|
|
676
|
+
function Ee(e) {
|
|
677
|
+
return c(e) ? `${e}px` : e;
|
|
678
|
+
}
|
|
679
|
+
function I(e, t, n) {
|
|
680
|
+
n ? e.setAttribute(t, String(n)) : e.removeAttribute(t);
|
|
681
|
+
}
|
|
682
|
+
//#endregion
|
|
683
|
+
//#region src/core/markup/utils.ts
|
|
684
|
+
function L(e, t) {
|
|
685
|
+
return {
|
|
686
|
+
[_e]: !0,
|
|
687
|
+
type: e,
|
|
688
|
+
props: t
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
function De(e) {
|
|
692
|
+
return e && e[_e];
|
|
693
|
+
}
|
|
694
|
+
function Oe(e) {
|
|
695
|
+
return e && e[ve];
|
|
696
|
+
}
|
|
697
|
+
function ke(e) {
|
|
698
|
+
return e && e[ye];
|
|
699
|
+
}
|
|
700
|
+
function R(e, t = K()) {
|
|
701
|
+
let n = z(t, e);
|
|
702
|
+
return n.length === 1 ? n[0] : new N(t, () => n);
|
|
703
|
+
}
|
|
704
|
+
function z(e, ...t) {
|
|
705
|
+
let n = [];
|
|
706
|
+
function r(t) {
|
|
707
|
+
if (!(t == null || t === !1)) if (i(t)) for (let e = 0; e < t.length; e++) r(t[e]);
|
|
708
|
+
else if (a(t) || c(t)) n.push(new j(e, V(String(t))));
|
|
709
|
+
else if (De(t)) {
|
|
710
|
+
let { type: r, props: i } = t;
|
|
711
|
+
ke(r) ? n.push(new r(e, ...i.args)) : o(r) ? n.push(new U(e, r, i)) : a(r) && n.push(new Se(e, r, i));
|
|
712
|
+
} else Oe(t) ? n.push(t) : t instanceof Node ? n.push(new j(e, t)) : o(t) && n.push(new N(e, t));
|
|
713
|
+
}
|
|
714
|
+
for (let e = 0; e < t.length; e++) r(t[e]);
|
|
715
|
+
return n;
|
|
716
|
+
}
|
|
717
|
+
function B(e, t, n) {
|
|
718
|
+
n ? e.insertBefore(t, n?.nextSibling) : e.appendChild(t);
|
|
719
|
+
}
|
|
720
|
+
function V(e) {
|
|
721
|
+
return document.createTextNode(e);
|
|
722
|
+
}
|
|
723
|
+
function Ae(e, t, n) {
|
|
724
|
+
let r = n?.nextSibling ?? null;
|
|
725
|
+
if (e.moveBefore) try {
|
|
726
|
+
e.moveBefore(t, r);
|
|
727
|
+
return;
|
|
728
|
+
} catch {}
|
|
729
|
+
e.insertBefore(t, r);
|
|
730
|
+
}
|
|
731
|
+
function H(e, t, n) {
|
|
732
|
+
return e.addEventListener(t, n), () => e.removeEventListener(t, n);
|
|
733
|
+
}
|
|
734
|
+
//#endregion
|
|
735
|
+
//#region src/core/markup/nodes/view.ts
|
|
736
|
+
var je = Symbol.for("ViewNode"), U = class extends A {
|
|
737
|
+
#e;
|
|
738
|
+
#t;
|
|
739
|
+
#n;
|
|
740
|
+
context;
|
|
741
|
+
constructor(e, t, n) {
|
|
742
|
+
super(), this.context = K(e), this.context[je] = this, this.context.name = t.name, this.#e = n, this.#t = t;
|
|
743
|
+
}
|
|
744
|
+
getRoot() {
|
|
745
|
+
return this.#n?.getRoot();
|
|
746
|
+
}
|
|
747
|
+
isMounted() {
|
|
748
|
+
return this.context.isMounted;
|
|
749
|
+
}
|
|
750
|
+
mount(e, t) {
|
|
751
|
+
let n = this.isMounted();
|
|
752
|
+
if (!n) {
|
|
753
|
+
let e = D(() => this.#t.call(this.context, this.#e, this.context));
|
|
754
|
+
e != null && e !== !1 ? this.#n = R(e, this.context) : this.#n = new j(this.context, V(""));
|
|
755
|
+
}
|
|
756
|
+
this.#n.mount(e, t), n || q(this.context);
|
|
757
|
+
}
|
|
758
|
+
unmount(e = !1) {
|
|
759
|
+
this.#n?.unmount(e), J(this.context);
|
|
760
|
+
}
|
|
761
|
+
move(e, t) {
|
|
762
|
+
this.#n?.move(e, t);
|
|
763
|
+
}
|
|
764
|
+
}, W = Symbol("Context.mountListeners"), G = Symbol("Context.cleanupListeners");
|
|
765
|
+
function K(e) {
|
|
766
|
+
return Object.assign(Object.create(e ?? null), { isMounted: !1 });
|
|
767
|
+
}
|
|
768
|
+
function q(e) {
|
|
769
|
+
e.isMounted || (e.isMounted = !0, Me(e, W));
|
|
770
|
+
}
|
|
771
|
+
function J(e) {
|
|
772
|
+
e.isMounted && (e.isMounted = !1, Me(e, G));
|
|
773
|
+
}
|
|
774
|
+
function Me(e, t) {
|
|
775
|
+
if (Object.hasOwn(e, t)) {
|
|
776
|
+
for (let n of e[t]) n();
|
|
777
|
+
e[t].length = 0;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
function Y(e, t) {
|
|
781
|
+
Object.hasOwn(e, W) ? e[W].push(t) : e[W] = [t];
|
|
782
|
+
}
|
|
783
|
+
function X(e, t) {
|
|
784
|
+
Object.hasOwn(e, G) ? e[G].push(t) : e[G] = [t];
|
|
785
|
+
}
|
|
786
|
+
function Ne(e, t) {
|
|
787
|
+
e.isMounted ? X(e, T(t)) : Y(e, () => {
|
|
788
|
+
X(e, T(t));
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
function Pe(e) {
|
|
792
|
+
return e[be];
|
|
793
|
+
}
|
|
794
|
+
function Fe(e) {
|
|
795
|
+
return e[je];
|
|
796
|
+
}
|
|
797
|
+
var Z = Symbol("Dolla.StoreId");
|
|
798
|
+
function Ie(e, t, ...n) {
|
|
799
|
+
t[Z] ??= Symbol(t.name), r(!Object.hasOwn(e, t[Z]), "Store was already provided on this context.");
|
|
800
|
+
let i = K(e);
|
|
801
|
+
return Y(e, () => q(i)), X(e, () => J(i)), i.name = t.name, e[t[Z]] = t.call(i, n[0], i);
|
|
802
|
+
}
|
|
803
|
+
function Le(e, t) {
|
|
804
|
+
let n = t[Z], i = n ? e[n] : void 0;
|
|
805
|
+
return r(i != null, `Store '${t.name}' is not provided by this context.`), i;
|
|
806
|
+
}
|
|
807
|
+
//#endregion
|
|
808
|
+
//#region src/core/root.ts
|
|
809
|
+
function Re(e, t) {
|
|
810
|
+
let n = a(e) ? document.querySelector(e) : e;
|
|
811
|
+
r(n, "Element cannot be null.");
|
|
812
|
+
let i = K();
|
|
813
|
+
i.name = "dolla:root";
|
|
814
|
+
let s = [], c = [];
|
|
815
|
+
i[be] = n, i[P] = !!t?.debug;
|
|
816
|
+
let l = null, u = {
|
|
817
|
+
plugin: d,
|
|
818
|
+
mount: f,
|
|
819
|
+
unmount: p
|
|
820
|
+
};
|
|
821
|
+
function d(e) {
|
|
822
|
+
return s.push(e), u;
|
|
823
|
+
}
|
|
824
|
+
async function f(e) {
|
|
825
|
+
if (i.isMounted) return;
|
|
826
|
+
let t = await Promise.all(s.map((e) => e(i)));
|
|
827
|
+
for (let e of t) o(e) && c.push(e);
|
|
828
|
+
l = o(e) ? new U(i, e, {}) : R(e, i), l?.mount(n), q(i);
|
|
829
|
+
}
|
|
830
|
+
async function p() {
|
|
831
|
+
i.isMounted && (l?.unmount(!1), l = null, J(i), await Promise.all(c.map((e) => e())), c.length = 0);
|
|
832
|
+
}
|
|
833
|
+
return u;
|
|
834
|
+
}
|
|
835
|
+
//#endregion
|
|
836
|
+
//#region src/core/debug.ts
|
|
837
|
+
var ze = () => {}, Be = {
|
|
838
|
+
trace: 1,
|
|
839
|
+
info: 1,
|
|
840
|
+
log: 2,
|
|
841
|
+
warn: 3,
|
|
842
|
+
error: 4,
|
|
843
|
+
silent: 5
|
|
844
|
+
}, Ve = 1, He = (e) => !e.startsWith("dolla:"), Ue = (e) => {
|
|
845
|
+
Ve = Be[e] || 1;
|
|
846
|
+
}, We = (e) => {
|
|
847
|
+
He = e;
|
|
848
|
+
}, Q = globalThis.console || {};
|
|
849
|
+
function Ge(e, ...t) {
|
|
850
|
+
let n = e.name, r, i = (e, i) => {
|
|
851
|
+
if (i < Ve || !He(n) || !Q[e]) return ze;
|
|
852
|
+
if (!r) {
|
|
853
|
+
let e = "%c" + n, i = [`color:${qe(n)};font-weight:bold`];
|
|
854
|
+
for (let [n, r] of t) e += `%c[${n}: %c${r}%c]`, i.push("color:#777", "color:#aaa", "color:#777");
|
|
855
|
+
r = [e, ...i];
|
|
856
|
+
}
|
|
857
|
+
return Q[e].bind(Q, ...r);
|
|
858
|
+
};
|
|
859
|
+
return {
|
|
860
|
+
get info() {
|
|
861
|
+
return i("info", 1);
|
|
862
|
+
},
|
|
863
|
+
get trace() {
|
|
864
|
+
return i("trace", 1);
|
|
865
|
+
},
|
|
866
|
+
get log() {
|
|
867
|
+
return i("log", 2);
|
|
868
|
+
},
|
|
869
|
+
get warn() {
|
|
870
|
+
return i("warn", 3);
|
|
871
|
+
},
|
|
872
|
+
get error() {
|
|
873
|
+
return i("error", 4);
|
|
874
|
+
}
|
|
875
|
+
};
|
|
876
|
+
}
|
|
877
|
+
function Ke(e, ...t) {
|
|
878
|
+
let n = K();
|
|
879
|
+
return n.name = e, Ge(n, ...t);
|
|
880
|
+
}
|
|
881
|
+
function qe(e) {
|
|
882
|
+
let t = 0;
|
|
883
|
+
for (let n = 0; n < e.length; n++) t = (t + e.charCodeAt(n) * 10) % 360;
|
|
884
|
+
return `oklch(0.68 0.15 ${t}deg)`;
|
|
885
|
+
}
|
|
886
|
+
//#endregion
|
|
887
|
+
//#region src/core/markup/nodes/portal.ts
|
|
888
|
+
var Je = class extends A {
|
|
889
|
+
#e = V("");
|
|
890
|
+
#t;
|
|
891
|
+
#n;
|
|
892
|
+
#r;
|
|
893
|
+
#i;
|
|
894
|
+
constructor(e, t, n) {
|
|
895
|
+
super(), this.#t = e, this.#n = t, this.#r = n;
|
|
896
|
+
}
|
|
897
|
+
getRoot() {
|
|
898
|
+
return this.#e;
|
|
899
|
+
}
|
|
900
|
+
isMounted() {
|
|
901
|
+
return this.#e.parentNode != null;
|
|
902
|
+
}
|
|
903
|
+
mount(e, t) {
|
|
904
|
+
this.isMounted() || (B(e, this.#e, t), this.#i ||= R(this.#n, this.#t), this.#i.mount(this.#r));
|
|
905
|
+
}
|
|
906
|
+
unmount(e = !1) {
|
|
907
|
+
this.isMounted() && (e || this.#e.parentNode?.removeChild(this.#e), this.#i?.isMounted() && this.#i.unmount(!1));
|
|
908
|
+
}
|
|
909
|
+
move(e, t) {
|
|
910
|
+
Ae(e, this.#e, t);
|
|
911
|
+
}
|
|
912
|
+
}, Ye = class extends A {
|
|
913
|
+
#e = V("");
|
|
914
|
+
#t;
|
|
915
|
+
#n;
|
|
916
|
+
#r;
|
|
917
|
+
#i;
|
|
918
|
+
#a = null;
|
|
919
|
+
#o = /* @__PURE__ */ new Map();
|
|
920
|
+
constructor(e, t, n, r) {
|
|
921
|
+
super(), this.#t = e, this.#n = t, this.#r = n, this.#i = r;
|
|
922
|
+
}
|
|
923
|
+
getRoot() {
|
|
924
|
+
return this.#e;
|
|
925
|
+
}
|
|
926
|
+
isMounted() {
|
|
927
|
+
return this.#e.parentNode != null;
|
|
928
|
+
}
|
|
929
|
+
mount(e, t) {
|
|
930
|
+
this.isMounted() || (B(e, this.#e, t), this.#a = O(this.#n, (e) => {
|
|
931
|
+
M(() => {
|
|
932
|
+
this._update(Array.from(e));
|
|
933
|
+
});
|
|
934
|
+
}));
|
|
935
|
+
}
|
|
936
|
+
unmount(e = !1) {
|
|
937
|
+
this.#a &&= (this.#a(), null), !e && this.isMounted() && this.#e.parentNode?.removeChild(this.#e), this._cleanup(e);
|
|
938
|
+
}
|
|
939
|
+
move(e, t) {
|
|
940
|
+
return this.mount(e, t);
|
|
941
|
+
}
|
|
942
|
+
_cleanup(e) {
|
|
943
|
+
for (let t of this.#o.values()) t._node.unmount(e);
|
|
944
|
+
this.#o.clear();
|
|
945
|
+
}
|
|
946
|
+
_update(e) {
|
|
947
|
+
if (!this.isMounted()) return;
|
|
948
|
+
if (e.length === 0) return this._cleanup(!1);
|
|
949
|
+
let t = /* @__PURE__ */ new Map();
|
|
950
|
+
he(() => {
|
|
951
|
+
let n = new Set(e.map((e, t) => this.#r(e, t)));
|
|
952
|
+
for (let [e, t] of this.#o.entries()) n.has(e) || t._node.unmount(!1);
|
|
953
|
+
for (let r = 0; r < e.length; r++) {
|
|
954
|
+
let i = e[r], a = this.#r(i, r), o = this.#o.get(a);
|
|
955
|
+
if (o && n.has(a)) o._setItem(i), o._setIndex(r);
|
|
956
|
+
else {
|
|
957
|
+
let [e, t] = C(i), [n, s] = C(r);
|
|
958
|
+
o = {
|
|
959
|
+
_key: a,
|
|
960
|
+
_node: R(this.#i(() => e(), () => n()), this.#t),
|
|
961
|
+
_item: e,
|
|
962
|
+
_setItem: t,
|
|
963
|
+
_index: n,
|
|
964
|
+
_setIndex: s
|
|
965
|
+
};
|
|
966
|
+
}
|
|
967
|
+
t.set(a, o);
|
|
968
|
+
}
|
|
969
|
+
}), this.#o = t;
|
|
970
|
+
let n = this.#e.parentElement, r = this.#e;
|
|
971
|
+
for (let e of this.#o.values()) {
|
|
972
|
+
let t = r.nextSibling;
|
|
973
|
+
e._node.isMounted() ? e._node.getRoot() !== t && e._node.move(n, r) : e._node.mount(n, r), r = e._node.getRoot();
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
};
|
|
977
|
+
//#endregion
|
|
978
|
+
//#region src/core/markup/helpers.ts
|
|
979
|
+
function Xe(e, t, n) {
|
|
980
|
+
return o(e) ? L(Ye, { args: [
|
|
981
|
+
e,
|
|
982
|
+
t,
|
|
983
|
+
n
|
|
984
|
+
] }) : Array.from(e).map((e, t) => n(() => e, () => t));
|
|
985
|
+
}
|
|
986
|
+
function Ze(e, t, n) {
|
|
987
|
+
return o(e) ? L(N, { args: [w(() => e() ? t : n)] }) : e ? t : n;
|
|
988
|
+
}
|
|
989
|
+
function Qe(e, t, n) {
|
|
990
|
+
return Ze(e, t, n);
|
|
991
|
+
}
|
|
992
|
+
function $e(e, t, n) {
|
|
993
|
+
return Ze(e, n, t);
|
|
994
|
+
}
|
|
995
|
+
function et(e, t) {
|
|
996
|
+
return L(Je, { args: [t, e] });
|
|
997
|
+
}
|
|
998
|
+
//#endregion
|
|
999
|
+
//#region src/core/markup/html.ts
|
|
1000
|
+
var $ = /* @__PURE__ */ function(e) {
|
|
1001
|
+
return e[e.Slash = 0] = "Slash", e[e.Text = 1] = "Text", e[e.Whitespace = 2] = "Whitespace", e[e.TagName = 3] = "TagName", e[e.Comment = 4] = "Comment", e[e.PropSet = 5] = "PropSet", e[e.PropAppend = 6] = "PropAppend", e;
|
|
1002
|
+
}($ || {});
|
|
1003
|
+
function tt(e, ...t) {
|
|
1004
|
+
let n = [e, ...t], r = $.Text, i = "", a = "", o = [0], s = "", c = (e) => {
|
|
1005
|
+
r === $.Text && (e || (i = i.replace(/^\s*\n\s*|\s*\n\s*$/g, ""))) ? o.push(e ? n[e] : i) : r === $.TagName && (e || i) ? (o[1] = e ? n[e] : i, r = $.Whitespace) : r === $.Whitespace && i === "..." && e ? o[2] = Object.assign(o[2] || {}, n[e]) : r === $.Whitespace && i && !e ? (o[2] = o[2] || {})[i] = !0 : r >= $.PropSet && (r === $.PropSet ? ((o[2] = o[2] || {})[s] = e ? i ? i + n[e] : n[e] : i, r = $.PropAppend) : (e || i) && (o[2][s] += e ? i + n[e] : i)), i = "";
|
|
1006
|
+
};
|
|
1007
|
+
for (let t = 0; t < e.length; t++) {
|
|
1008
|
+
t && (r === $.Text && c(), c(t));
|
|
1009
|
+
for (let n = 0; n < e[t].length; n++) {
|
|
1010
|
+
let l = e[t][n];
|
|
1011
|
+
if (r === $.Text) l === "<" ? (c(), o = [
|
|
1012
|
+
o,
|
|
1013
|
+
"",
|
|
1014
|
+
null
|
|
1015
|
+
], r = $.TagName) : i += l;
|
|
1016
|
+
else if (r === $.Comment) i === "--" && l === ">" ? (r = $.Text, i = "") : i = l + i[0];
|
|
1017
|
+
else if (a) l === a ? a = "" : i += l;
|
|
1018
|
+
else if (l === "\"" || l === "'") a = l;
|
|
1019
|
+
else if (l === ">") c(), r = $.Text;
|
|
1020
|
+
else if (r) if (l === "=") r = $.PropSet, s = i, i = "";
|
|
1021
|
+
else if (l === "/" && (r < $.PropSet || e[t][n + 1] === ">")) {
|
|
1022
|
+
c(), r === $.TagName && (o = o[0]);
|
|
1023
|
+
let e = o;
|
|
1024
|
+
o = o[0];
|
|
1025
|
+
let t = e[1], n = e[2] || {}, i = e.slice(3);
|
|
1026
|
+
o.push(L(t, {
|
|
1027
|
+
...n,
|
|
1028
|
+
children: i
|
|
1029
|
+
})), r = $.Slash;
|
|
1030
|
+
} else l === " " || l === " " || l === "\n" || l === "\r" ? (c(), r = $.Whitespace) : i += l;
|
|
1031
|
+
r === $.TagName && i === "!--" && (r = $.Comment, o = o[0]);
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
return c(), o.length > 2 ? o.slice(1) : o[1];
|
|
1035
|
+
}
|
|
1036
|
+
//#endregion
|
|
1037
|
+
//#region src/core/ref.ts
|
|
1038
|
+
function nt() {
|
|
1039
|
+
let e;
|
|
1040
|
+
return ((...t) => t.length ? (e = t[0], () => {
|
|
1041
|
+
e = void 0;
|
|
1042
|
+
}) : e);
|
|
1043
|
+
}
|
|
1044
|
+
//#endregion
|
|
1045
|
+
export { ge as A, R as C, w as D, he as E, i as F, o as I, l as L, O as M, E as N, C as O, r as P, a as R, L as S, N as T, X as _, $e as a, U as b, Ge as c, Re as d, Ie as f, Le as g, Pe as h, Xe as i, D as j, T as k, We as l, Fe as m, tt as n, Qe as o, K as p, et as r, Ke as s, nt as t, Ue as u, Ne as v, P as w, H as x, Y as y, t as z };
|
|
1046
|
+
|
|
1047
|
+
//# sourceMappingURL=core-2CFW0uRa.js.map
|