lithent 1.21.1 → 1.21.2
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/lithent.mjs +186 -170
- package/dist/lithent.mjs.map +1 -1
- package/dist/lithent.umd.js +1 -1
- package/dist/lithent.umd.js.map +1 -1
- package/dist/types/index.d.ts +3 -3
- package/examples/dist/assets/index-DYJGSNhf.js +2 -0
- package/examples/dist/assets/index-DYJGSNhf.js.map +1 -0
- package/examples/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/render.ts +56 -19
- package/src/tests/core-nullUpdater.test.tsx +33 -0
- package/src/types/index.ts +11 -4
- package/src/wDom.ts +6 -4
- package/examples/dist/assets/index-C8ubEFcX.js +0 -2
- package/examples/dist/assets/index-C8ubEFcX.js.map +0 -1
package/dist/lithent.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const h = Symbol.for("lithentWDomSymbol"), P = { value: "" }, v = { value: null }, a = { value: !1 },
|
|
2
|
-
let
|
|
1
|
+
const h = Symbol.for("lithentWDomSymbol"), P = { value: "" }, v = { value: null }, a = { value: !1 }, f = /* @__PURE__ */ new WeakMap(), W = /* @__PURE__ */ new WeakSet();
|
|
2
|
+
let D = !1;
|
|
3
3
|
const Ce = (e) => {
|
|
4
|
-
|
|
4
|
+
f.set(e, {
|
|
5
5
|
vd: { value: null },
|
|
6
6
|
up: () => {
|
|
7
7
|
},
|
|
@@ -14,90 +14,90 @@ const Ce = (e) => {
|
|
|
14
14
|
wdCB: []
|
|
15
15
|
// WDom creation callback queue
|
|
16
16
|
});
|
|
17
|
-
}, d = () => v.value,
|
|
18
|
-
const n =
|
|
17
|
+
}, d = () => v.value, $ = (e, t) => {
|
|
18
|
+
const n = f.get(e);
|
|
19
19
|
return n ? n[t] : null;
|
|
20
20
|
}, ve = (e) => {
|
|
21
21
|
v.value = e;
|
|
22
22
|
}, ke = (e) => {
|
|
23
23
|
v.value = e, Ce(e);
|
|
24
24
|
}, Ct = (e) => {
|
|
25
|
-
|
|
26
|
-
}, Re = () =>
|
|
27
|
-
const t =
|
|
25
|
+
D = e;
|
|
26
|
+
}, Re = () => D, ee = (e) => {
|
|
27
|
+
const t = f.get(e);
|
|
28
28
|
t && (t.umts.forEach((n) => n()), t.umts = []);
|
|
29
29
|
}, vt = (e) => {
|
|
30
|
-
|
|
31
|
-
}, i = (e) => e.getParent && e.getParent(), x = Object.entries,
|
|
30
|
+
ee(e), f.delete(e);
|
|
31
|
+
}, i = (e) => e.getParent && e.getParent(), x = Object.entries, te = Object.keys, k = (e) => typeof e == "object" && e !== null, b = Object.assign, kt = (e) => k(e) && !Array.isArray(e) && !Object.getOwnPropertySymbols(e).includes(h), R = (e) => k(e) && !("resolve" in e), S = (e, t) => R(e) && e.type === t, Pe = (e, t) => "ctor" in e ? e.ctor === (t && t.ctor) : e === (t && t.ctor), xe = (e, t) => !!(R(e) && t && t.type === "f" && t.children && t.children.length === (e.children && e.children.length)), Se = (e, t) => !!(R(e) && t && t.type === "e" && t.tag === e.tag && t.children && t.children.length === (e.children && e.children.length)), V = (e, t) => !!(R(e) && t && t.type === e.type), Ee = (e, t) => !!(R(e) && t && t.type === e.type && (C((e.children || [])[0]) && C((t.children || [])[0]) || t.children && e.children && t.children.length === e.children.length)), p = (e) => (e && e.compProps && e.compProps.key) ?? (e && e.props && e.props.key), y = (e) => e && ["f", "l"].includes(e), L = (e) => typeof e == "function" && !ne(e) || k(e) && "resolve" in e, ne = (e) => typeof e == "function" && e === N, Me = (e) => R(e) && !e.type, C = (e) => ce(p(e)), ce = (e) => e != null, K = (e, t) => e === "style" && k(t), Te = (e, t) => e === "ref" && k(t), Ne = (e, t) => {
|
|
32
32
|
const n = Object.getOwnPropertyDescriptor(
|
|
33
33
|
e.constructor.prototype,
|
|
34
34
|
t
|
|
35
35
|
);
|
|
36
36
|
return n && n.get && n.set;
|
|
37
|
-
}, be = (e) =>
|
|
37
|
+
}, be = (e) => L(e) ? "c" : S(e, "f") ? "f" : S(e, "e") ? "e" : S(e, "l") ? "l" : S(e, "t") ? "t" : "et", Le = {
|
|
38
38
|
c: Pe,
|
|
39
|
-
l:
|
|
40
|
-
t:
|
|
41
|
-
e:
|
|
39
|
+
l: Ee,
|
|
40
|
+
t: V,
|
|
41
|
+
e: Se,
|
|
42
42
|
f: xe,
|
|
43
|
-
et:
|
|
44
|
-
},
|
|
43
|
+
et: V
|
|
44
|
+
}, se = (e) => {
|
|
45
45
|
const t = d();
|
|
46
46
|
if (t) {
|
|
47
|
-
const n =
|
|
47
|
+
const n = f.get(t);
|
|
48
48
|
n && n.umts.push(e);
|
|
49
49
|
}
|
|
50
|
-
},
|
|
50
|
+
}, F = (e) => {
|
|
51
51
|
const { compKey: t } = e;
|
|
52
|
-
t && Fe(t),
|
|
53
|
-
},
|
|
52
|
+
t && Fe(t), re(e);
|
|
53
|
+
}, re = (e) => {
|
|
54
54
|
(e.children || []).forEach((t) => {
|
|
55
|
-
t.compKey ?
|
|
55
|
+
t.compKey ? F(t) : re(t);
|
|
56
56
|
});
|
|
57
57
|
}, Fe = (e) => {
|
|
58
|
-
|
|
58
|
+
ee(e), Re() || f.delete(e);
|
|
59
59
|
};
|
|
60
|
-
let
|
|
60
|
+
let j = [];
|
|
61
61
|
const Ue = (e) => {
|
|
62
|
-
e.compKey &&
|
|
63
|
-
},
|
|
64
|
-
|
|
62
|
+
e.compKey && j.push(e);
|
|
63
|
+
}, E = () => {
|
|
64
|
+
j.forEach((e) => Oe(e)), j = [];
|
|
65
65
|
}, Rt = (e) => {
|
|
66
66
|
const t = d();
|
|
67
67
|
if (t) {
|
|
68
|
-
const n =
|
|
68
|
+
const n = f.get(t);
|
|
69
69
|
n && n.mts.push(e);
|
|
70
70
|
}
|
|
71
71
|
}, Oe = (e) => {
|
|
72
72
|
const { compKey: t } = e;
|
|
73
73
|
if (t) {
|
|
74
|
-
const n =
|
|
74
|
+
const n = f.get(t);
|
|
75
75
|
if (!n) return;
|
|
76
76
|
const { mts: c, upS: r } = n;
|
|
77
77
|
v.value = t, r && (r.value = 0), c && (n.mts = [], c.forEach((s) => {
|
|
78
78
|
const o = s();
|
|
79
|
-
o &&
|
|
79
|
+
o && se(o);
|
|
80
80
|
}));
|
|
81
81
|
}
|
|
82
82
|
}, Pt = (e) => {
|
|
83
83
|
const t = d();
|
|
84
84
|
if (t) {
|
|
85
|
-
const n =
|
|
85
|
+
const n = f.get(t);
|
|
86
86
|
n && n.wdCB.push(e);
|
|
87
87
|
}
|
|
88
|
-
},
|
|
88
|
+
}, ge = (e) => {
|
|
89
89
|
const { compKey: t } = e;
|
|
90
90
|
if (t) {
|
|
91
|
-
const n =
|
|
91
|
+
const n = f.get(t), c = n && n.wdCB;
|
|
92
92
|
v.value = t, c && c.length > 0 && (n.wdCB = [], c.forEach((r) => {
|
|
93
93
|
const s = r();
|
|
94
|
-
s && typeof s == "function" &&
|
|
94
|
+
s && typeof s == "function" && se(s);
|
|
95
95
|
}));
|
|
96
96
|
}
|
|
97
|
-
},
|
|
97
|
+
}, m = (e, t = () => []) => {
|
|
98
98
|
const n = d();
|
|
99
99
|
if (!n) return;
|
|
100
|
-
const c =
|
|
100
|
+
const c = f.get(n);
|
|
101
101
|
if (!c) return;
|
|
102
102
|
const { upD: r, upS: s } = c, o = r[s.value], l = t();
|
|
103
103
|
if (o && Be(o, l)) {
|
|
@@ -105,33 +105,32 @@ const Ue = (e) => {
|
|
|
105
105
|
u && c.upCB.push(u);
|
|
106
106
|
}
|
|
107
107
|
r[s.value] = l, s.value += 1;
|
|
108
|
-
},
|
|
108
|
+
}, Ae = (e) => {
|
|
109
109
|
const { compKey: t } = e;
|
|
110
110
|
if (t) {
|
|
111
|
-
const n =
|
|
111
|
+
const n = f.get(t);
|
|
112
112
|
if (!n) return;
|
|
113
113
|
const { upCB: c, upS: r } = n;
|
|
114
114
|
v.value = t, r && (r.value = 0), e.ctor && c && (n.upCB = [], c.forEach((s) => s()));
|
|
115
115
|
}
|
|
116
|
-
}, Be = (e, t) => e.length ? e.some((n, c) => n !== t[c]) : !0,
|
|
116
|
+
}, Be = (e, t) => e.length ? e.some((n, c) => n !== t[c]) : !0, M = () => new DocumentFragment(), Qe = (e) => document.createElement(e), xt = (e, t, n, c) => {
|
|
117
117
|
e.isRoot = !0, t = t || document.body, e.we = t;
|
|
118
|
-
const r =
|
|
119
|
-
return n ? (e.ae = n, t.insertBefore(r, n)) : c || (t.tagName === "HTML" ? t.replaceWith(r) : t.appendChild(r)),
|
|
120
|
-
const s =
|
|
121
|
-
o !== e &&
|
|
118
|
+
const r = O(e, c);
|
|
119
|
+
return n ? (e.ae = n, t.insertBefore(r, n)) : c || (t.tagName === "HTML" ? t.replaceWith(r) : t.appendChild(r)), E(), () => {
|
|
120
|
+
const s = f.get(e.compProps || {}), o = s && s.vd.value || e;
|
|
121
|
+
o !== e && F(o), U(o), je(o);
|
|
122
122
|
};
|
|
123
|
-
},
|
|
124
|
-
e.props && e.el &&
|
|
125
|
-
|
|
123
|
+
}, U = (e) => {
|
|
124
|
+
e.props && e.el && fe(e.props, e.el), (e.children || []).forEach((t) => {
|
|
125
|
+
U(t);
|
|
126
126
|
});
|
|
127
|
-
}, je = (e) =>
|
|
128
|
-
e.op && e.el &&
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}, ce = (e, t) => {
|
|
127
|
+
}, je = (e) => oe(e, e.we), J = (e) => {
|
|
128
|
+
e.op && e.el && fe(e.op, e.el);
|
|
129
|
+
const t = i(e), n = e.isRoot ? e.we : t ? g(t) : void 0;
|
|
130
|
+
n && oe(e, n);
|
|
131
|
+
}, oe = (e, t) => {
|
|
132
|
+
t && e.el && (e.el.nodeType === 11 || (e == null ? void 0 : e.tag) === "portal" ? le(e) : [1, 3].includes(e.el.nodeType) && t.removeChild(e.el), delete e.el);
|
|
133
|
+
}, le = (e, t) => {
|
|
135
134
|
(e && e.oc || e && e.children || []).forEach(
|
|
136
135
|
(n) => {
|
|
137
136
|
const c = n.el && n.el.nodeType;
|
|
@@ -139,40 +138,51 @@ const Ue = (e) => {
|
|
|
139
138
|
if ([1, 3].includes(c)) {
|
|
140
139
|
const r = n.el;
|
|
141
140
|
r.tagName === "HTML" ? r.innerHTML = "" : r.remove();
|
|
142
|
-
} else c === 11 &&
|
|
141
|
+
} else c === 11 && le(n);
|
|
143
142
|
}
|
|
144
143
|
);
|
|
145
|
-
},
|
|
146
|
-
|
|
144
|
+
}, q = (e) => {
|
|
145
|
+
J(e), T(e);
|
|
147
146
|
}, qe = (e) => {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
147
|
+
z(e);
|
|
148
|
+
const t = i(e);
|
|
149
|
+
if (!t) {
|
|
150
|
+
if (e.isRoot) {
|
|
151
|
+
const n = _(e);
|
|
152
|
+
T(e, n);
|
|
153
|
+
}
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
if (t.nr !== "L") {
|
|
157
|
+
const n = _(e);
|
|
158
|
+
T(e, n);
|
|
151
159
|
}
|
|
152
|
-
},
|
|
153
|
-
t || (t =
|
|
160
|
+
}, T = (e, t) => {
|
|
161
|
+
t || (t = O(e));
|
|
154
162
|
const n = i(e);
|
|
155
|
-
if (n.type) {
|
|
156
|
-
|
|
157
|
-
|
|
163
|
+
if (!n || !n.type) {
|
|
164
|
+
e.isRoot && e.we && t && e.tag !== "portal" && (e.ae ? e.we.insertBefore(t, e.ae) : e.we.tagName === "HTML" ? e.we.replaceWith(t) : e.we.appendChild(t), E());
|
|
165
|
+
return;
|
|
158
166
|
}
|
|
159
|
-
|
|
160
|
-
|
|
167
|
+
const c = g(n), s = n.type === "l" && n.nr && n.nr !== "L" ? I(n, i(n)) : I(e, n);
|
|
168
|
+
t && c && (e.tag !== "portal" && (s ? c.insertBefore(t, s) : c.appendChild(t)), E());
|
|
169
|
+
}, _ = (e) => y(e.type) ? (e && e.children || []).reduce((t, n) => {
|
|
170
|
+
const c = _(n);
|
|
161
171
|
return c && t.appendChild(c), t;
|
|
162
|
-
},
|
|
163
|
-
const n = t.children || [], r = n.indexOf(e) + 1, s = n.slice(r), o =
|
|
172
|
+
}, M()) : e.el, I = (e, t) => {
|
|
173
|
+
const n = t.children || [], r = n.indexOf(e) + 1, s = n.slice(r), o = ue(s), l = t.type || "";
|
|
164
174
|
if (o)
|
|
165
175
|
return o;
|
|
166
176
|
if (!t.isRoot && y(l))
|
|
167
|
-
return
|
|
177
|
+
return I(t, i(t));
|
|
168
178
|
if (t.isRoot && y(l) && t.ae)
|
|
169
179
|
return t.ae;
|
|
170
|
-
},
|
|
180
|
+
}, ue = (e) => e.reduce(
|
|
171
181
|
(t, n) => {
|
|
172
182
|
if (t) return t;
|
|
173
183
|
const { type: c, el: r } = n;
|
|
174
184
|
if (c && y(c)) {
|
|
175
|
-
const s =
|
|
185
|
+
const s = ue(n.children || []);
|
|
176
186
|
if (s) return s;
|
|
177
187
|
}
|
|
178
188
|
return r && r.nodeType !== 11 ? r : t;
|
|
@@ -180,101 +190,107 @@ const Ue = (e) => {
|
|
|
180
190
|
void 0
|
|
181
191
|
), _e = (e) => {
|
|
182
192
|
const t = i(e), n = e.el;
|
|
183
|
-
if (
|
|
193
|
+
if (e.isRoot && !t && n) {
|
|
194
|
+
q(e);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
if (t && t.type && n)
|
|
184
198
|
if (n.nodeType === 11)
|
|
185
|
-
|
|
199
|
+
q(e);
|
|
186
200
|
else {
|
|
187
|
-
const c =
|
|
188
|
-
c && e.tag !== "portal" && c.replaceChild(r, n),
|
|
201
|
+
const c = g(t), r = O(e);
|
|
202
|
+
c && e.tag !== "portal" && c.replaceChild(r, n), E();
|
|
189
203
|
}
|
|
190
|
-
},
|
|
204
|
+
}, fe = (e, t) => {
|
|
191
205
|
x(e || {}).forEach(([n, c]) => {
|
|
192
206
|
n.match(/^on/) && t.removeEventListener(
|
|
193
207
|
n.slice(2).toLowerCase(),
|
|
194
208
|
c
|
|
195
209
|
);
|
|
196
210
|
});
|
|
197
|
-
},
|
|
211
|
+
}, z = (e) => {
|
|
198
212
|
if (e.type === "t") {
|
|
199
213
|
ze(e);
|
|
200
214
|
return;
|
|
201
215
|
}
|
|
202
216
|
if (e.el) {
|
|
203
217
|
const { op: t, props: n } = e;
|
|
204
|
-
|
|
218
|
+
ie(n, e.el, t), delete e.op, e.tag === "input" && (e.el.value = String(
|
|
205
219
|
n && n.value || ""
|
|
206
220
|
));
|
|
207
221
|
}
|
|
208
|
-
(e.children || []).forEach((t) =>
|
|
209
|
-
},
|
|
222
|
+
(e.children || []).forEach((t) => pe(t)), Ae(e);
|
|
223
|
+
}, pe = (e) => {
|
|
210
224
|
const { nr: t } = e;
|
|
211
225
|
t !== void 0 && t !== "N" && (Ie[t](e), delete e.nr, delete e.oc, delete e.op);
|
|
212
226
|
}, Ie = {
|
|
213
|
-
A:
|
|
214
|
-
D:
|
|
227
|
+
A: T,
|
|
228
|
+
D: J,
|
|
215
229
|
R: _e,
|
|
216
|
-
U:
|
|
217
|
-
S:
|
|
230
|
+
U: z,
|
|
231
|
+
S: q,
|
|
218
232
|
T: qe,
|
|
219
|
-
L:
|
|
233
|
+
L: z
|
|
220
234
|
}, ze = (e) => {
|
|
221
235
|
e.el && (e.el.nodeValue = String(e.text));
|
|
222
|
-
},
|
|
236
|
+
}, ie = (e, t, n, c) => {
|
|
223
237
|
const r = n || {};
|
|
224
238
|
x(e || {}).forEach(([s, o]) => {
|
|
225
239
|
if (o === r[s]) {
|
|
226
240
|
delete r[s];
|
|
227
241
|
return;
|
|
228
242
|
}
|
|
229
|
-
c && s.match(/^on/) ?
|
|
243
|
+
c && s.match(/^on/) ? w(
|
|
230
244
|
t,
|
|
231
245
|
s,
|
|
232
246
|
o,
|
|
233
247
|
r[s]
|
|
234
|
-
) : (s === "key" || o === r[s] || s === "portal" && k(o) || (s === "innerHTML" && typeof o == "string" ? t.innerHTML = o :
|
|
248
|
+
) : (s === "key" || o === r[s] || s === "portal" && k(o) || (s === "innerHTML" && typeof o == "string" ? t.innerHTML = o : K(s, o) ? Je(
|
|
235
249
|
o,
|
|
236
|
-
|
|
250
|
+
K(s, r.style) ? r.style : {},
|
|
237
251
|
t
|
|
238
|
-
) : Te(s, o) ? o.value = t : s.match(/^on/) ?
|
|
252
|
+
) : Te(s, o) ? o.value = t : s.match(/^on/) ? w(
|
|
239
253
|
t,
|
|
240
254
|
s,
|
|
241
255
|
o,
|
|
242
256
|
r[s]
|
|
243
|
-
) : s && (s !== "type" && Ne(t, s) ? t[s] = o :
|
|
257
|
+
) : s && (s !== "type" && Ne(t, s) ? t[s] = o : He(
|
|
244
258
|
s === "className" ? "class" : s,
|
|
245
259
|
t,
|
|
246
260
|
o
|
|
247
261
|
))), delete r[s]);
|
|
248
|
-
}),
|
|
262
|
+
}), te(r).forEach(
|
|
249
263
|
(s) => t.removeAttribute(s)
|
|
250
264
|
);
|
|
251
|
-
},
|
|
265
|
+
}, He = (e, t, n) => P.value && e !== "xmlns" ? t.setAttributeNS(null, e, n) : t.setAttribute(e, n), O = (e, t) => {
|
|
252
266
|
let n;
|
|
253
267
|
const { type: c, tag: r, text: s, props: o, children: l = [] } = e, u = y(c);
|
|
254
|
-
if (
|
|
268
|
+
if (ge(e), r === "svg" && (P.value = String(o && o.xmlns)), t)
|
|
255
269
|
n = e.el;
|
|
256
270
|
else {
|
|
257
|
-
if (
|
|
258
|
-
n =
|
|
271
|
+
if (!c)
|
|
272
|
+
n = M();
|
|
273
|
+
else if (u)
|
|
274
|
+
n = M();
|
|
259
275
|
else if (c === "e" && r)
|
|
260
276
|
r === "portal" && o && o.portal ? n = o.portal : n = P.value ? document.createElementNS(P.value, r) : Qe(r);
|
|
261
|
-
else if (c === "t" &&
|
|
277
|
+
else if (c === "t" && ce(s))
|
|
262
278
|
n = document.createTextNode(String(s));
|
|
263
279
|
else
|
|
264
280
|
throw Error("Invalid wDom");
|
|
265
281
|
e.el = n;
|
|
266
282
|
}
|
|
267
|
-
return
|
|
268
|
-
},
|
|
283
|
+
return Ge(l, n, t), ie(o, n, null, t), Ue(e), r === "svg" && (P.value = ""), n;
|
|
284
|
+
}, Ge = (e, t, n) => {
|
|
269
285
|
const c = e.reduce((r, s) => {
|
|
270
286
|
if (s.type) {
|
|
271
|
-
const o =
|
|
287
|
+
const o = O(s, n);
|
|
272
288
|
s.tag !== "portal" && !n && r.appendChild(o);
|
|
273
289
|
}
|
|
274
290
|
return r;
|
|
275
|
-
},
|
|
291
|
+
}, M());
|
|
276
292
|
!n && t && c.hasChildNodes() && t.appendChild(c);
|
|
277
|
-
},
|
|
293
|
+
}, w = (e, t, n, c) => {
|
|
278
294
|
const r = t.slice(2).toLowerCase();
|
|
279
295
|
c !== n && (c && e.removeEventListener(r, c), n && e.addEventListener(r, n));
|
|
280
296
|
}, Je = (e, t, n) => {
|
|
@@ -286,10 +302,10 @@ const Ue = (e) => {
|
|
|
286
302
|
}), x(c).forEach(([l]) => {
|
|
287
303
|
o[l] = "";
|
|
288
304
|
});
|
|
289
|
-
},
|
|
305
|
+
}, g = (e) => {
|
|
290
306
|
const t = y(e.type);
|
|
291
|
-
return e.isRoot && t ? e.we : t ?
|
|
292
|
-
},
|
|
307
|
+
return e.isRoot && t ? e.we : t ? g(i(e)) : e.el;
|
|
308
|
+
}, A = (e, t) => Xe(
|
|
293
309
|
e,
|
|
294
310
|
Le[be(e)](e, t),
|
|
295
311
|
t
|
|
@@ -305,7 +321,7 @@ const Ue = (e) => {
|
|
|
305
321
|
n
|
|
306
322
|
)), c.nr = r, Ye(c, n, r), !s && n && (n.il = !0, delete n.children), (n == null ? void 0 : n.tag) === "portal" && (c.tag = "portal"), c;
|
|
307
323
|
}, Ye = (e, t, n) => {
|
|
308
|
-
n !== "A" && t && (e.el = t.el), (n === "D" || n === "R" || n === "S") && (t && (
|
|
324
|
+
n !== "A" && t && (e.el = t.el), (n === "D" || n === "R" || n === "S") && (t && (F(t), U(t)), e.oc = t && t.children), e.op = t && t.props;
|
|
309
325
|
}, Ze = (e, t, n) => {
|
|
310
326
|
if (Me(e)) return "D";
|
|
311
327
|
if (e.type === "t" && t && e.text === (n && n.text) || e === n) return "N";
|
|
@@ -317,25 +333,25 @@ const Ue = (e) => {
|
|
|
317
333
|
if (!C((e.children || [])[0]) || !C((t.children || [])[0]))
|
|
318
334
|
return !1;
|
|
319
335
|
const n = [...t && t.children || []], c = [...e && e.children || []].filter(
|
|
320
|
-
(o) => n.find((l) =>
|
|
336
|
+
(o) => n.find((l) => p(o) === p(l))
|
|
321
337
|
), r = n.filter(
|
|
322
|
-
(o) => c.find((l) =>
|
|
338
|
+
(o) => c.find((l) => p(o) === p(l))
|
|
323
339
|
);
|
|
324
340
|
let s = r.length === c.length;
|
|
325
341
|
return s && (s = r.every(
|
|
326
|
-
(o, l) =>
|
|
342
|
+
(o, l) => p(o) === p(c[l])
|
|
327
343
|
)), s;
|
|
328
344
|
}, Ve = (e, t) => {
|
|
329
|
-
e && t !== e && (
|
|
345
|
+
e && t !== e && (te(e).forEach((n) => delete e[n]), x(t || {}).forEach(([n, c]) => e[n] = c));
|
|
330
346
|
}, Ke = (e, t) => {
|
|
331
347
|
e && (e.splice(0, e.length), t && t.forEach((n) => e.push(n)));
|
|
332
348
|
}, me = (e, t) => {
|
|
333
349
|
const { compProps: n, compChild: c } = e, { props: r, children: s } = t;
|
|
334
350
|
return n && Ve(n, r), c && s && c !== s && Ke(c, s), e.reRender && e.reRender();
|
|
335
|
-
}, we = (e, t, n) =>
|
|
336
|
-
(t) =>
|
|
351
|
+
}, we = (e, t, n) => L(e) ? t && n ? me(n, e) : e.resolve() : e, We = (e, t, n) => t && n ? et(e, n) : De(e), De = (e) => (e.children || []).map(
|
|
352
|
+
(t) => b(A(t), { getParent: () => e })
|
|
337
353
|
), et = (e, t) => e.type === "l" && C((e.children || [])[0]) ? tt(e, t) : (e.children || []).map(
|
|
338
|
-
(n, c) =>
|
|
354
|
+
(n, c) => b(A(n, (t.children || [])[c]), {
|
|
339
355
|
getParent: () => e
|
|
340
356
|
})
|
|
341
357
|
), tt = (e, t) => {
|
|
@@ -344,49 +360,49 @@ const Ue = (e) => {
|
|
|
344
360
|
t
|
|
345
361
|
);
|
|
346
362
|
return c.forEach((r) => {
|
|
347
|
-
|
|
363
|
+
F(r), U(r), J(r);
|
|
348
364
|
}), n;
|
|
349
365
|
}, nt = (e, t) => {
|
|
350
366
|
const n = [...t.children || []];
|
|
351
367
|
return [(e.children || []).map((r) => {
|
|
352
|
-
const s = ct(r, n), o =
|
|
368
|
+
const s = ct(r, n), o = A(r, s);
|
|
353
369
|
return s && n.splice(n.indexOf(s), 1), o.getParent = () => e, o;
|
|
354
370
|
}), n];
|
|
355
371
|
}, ct = (e, t) => t.find(
|
|
356
|
-
(n) =>
|
|
357
|
-
),
|
|
358
|
-
let
|
|
372
|
+
(n) => p(n) === p(e)
|
|
373
|
+
), H = /* @__PURE__ */ new Map();
|
|
374
|
+
let G = !1;
|
|
359
375
|
const st = (e, t) => {
|
|
360
|
-
const n =
|
|
376
|
+
const n = f.get(e);
|
|
361
377
|
n && (n.up = () => {
|
|
362
|
-
|
|
378
|
+
H.set(e, t), G || (G = !0, queueMicrotask(rt));
|
|
363
379
|
});
|
|
364
|
-
},
|
|
365
|
-
const t =
|
|
380
|
+
}, de = (e) => () => {
|
|
381
|
+
const t = f.get(e), n = t && t.up;
|
|
366
382
|
return n ? (n(), !0) : !1;
|
|
367
383
|
}, rt = () => {
|
|
368
|
-
|
|
384
|
+
H.forEach((e) => {
|
|
369
385
|
e();
|
|
370
|
-
}),
|
|
371
|
-
},
|
|
386
|
+
}), H.clear(), G = !1;
|
|
387
|
+
}, St = (e, t = () => []) => {
|
|
372
388
|
const n = d();
|
|
373
389
|
if (!n) return;
|
|
374
|
-
const c =
|
|
375
|
-
c && (c.upR.push(() =>
|
|
390
|
+
const c = f.get(n);
|
|
391
|
+
c && (c.upR.push(() => m(e, t)), m(e, t));
|
|
376
392
|
}, ot = () => {
|
|
377
393
|
const e = d();
|
|
378
394
|
if (!e) return;
|
|
379
|
-
const t =
|
|
395
|
+
const t = f.get(e), n = t && t.upR;
|
|
380
396
|
n && n.length && n.forEach((c) => c());
|
|
381
|
-
},
|
|
397
|
+
}, N = (e, ...t) => ({
|
|
382
398
|
type: "f",
|
|
383
399
|
// fragment
|
|
384
400
|
[h]: !0,
|
|
385
401
|
children: t
|
|
386
402
|
}), lt = (e, t, ...n) => {
|
|
387
|
-
const c = { value: void 0 }, r =
|
|
388
|
-
return
|
|
389
|
-
},
|
|
403
|
+
const c = { value: void 0 }, r = he(c, n), s = pt(e, t || {}, r);
|
|
404
|
+
return L(s) || (c.value = s), s;
|
|
405
|
+
}, Et = (e, t) => lt("portal", { portal: t }, e), Mt = (e) => (t, n) => e, Tt = (e) => (t, n) => (W.add(e), e), ut = (e, t, n) => {
|
|
390
406
|
const c = (r, s) => {
|
|
391
407
|
if (!(!r || s.has(r))) {
|
|
392
408
|
if (s.add(r), r.compChild) {
|
|
@@ -397,22 +413,22 @@ const st = (e, t) => {
|
|
|
397
413
|
}
|
|
398
414
|
};
|
|
399
415
|
c(e, /* @__PURE__ */ new Set());
|
|
400
|
-
},
|
|
416
|
+
}, ft = (e, t, n, c) => {
|
|
401
417
|
if (c.il)
|
|
402
418
|
return;
|
|
403
419
|
a.value = !0;
|
|
404
|
-
const r =
|
|
420
|
+
const r = ae(e, t, n), s = A(r, c), { isRoot: o, getParent: l, we: u, ae: B } = c;
|
|
405
421
|
if (s.getParent = l, !o && l) {
|
|
406
|
-
const
|
|
407
|
-
|
|
422
|
+
const Q = l(), Y = Q && Q.children || [], Z = Y.indexOf(c);
|
|
423
|
+
Z !== -1 && Y.splice(Z, 1, s), ut(Q, c, s);
|
|
408
424
|
} else
|
|
409
|
-
s.isRoot = !0, s.we = u, s.ae =
|
|
410
|
-
a.value = !1,
|
|
411
|
-
},
|
|
412
|
-
if (
|
|
413
|
-
return
|
|
414
|
-
if (
|
|
415
|
-
const c =
|
|
425
|
+
s.isRoot = !0, s.we = u, s.ae = B;
|
|
426
|
+
a.value = !1, pe(s);
|
|
427
|
+
}, pt = (e, t, n) => {
|
|
428
|
+
if (ne(e))
|
|
429
|
+
return N(t, ...n);
|
|
430
|
+
if (L(e)) {
|
|
431
|
+
const c = ae(e, t, n);
|
|
416
432
|
return a.value ? c : c.resolve();
|
|
417
433
|
}
|
|
418
434
|
return {
|
|
@@ -423,13 +439,13 @@ const st = (e, t) => {
|
|
|
423
439
|
props: t,
|
|
424
440
|
children: n
|
|
425
441
|
};
|
|
426
|
-
},
|
|
427
|
-
(n) =>
|
|
428
|
-
),
|
|
442
|
+
}, he = (e, t) => t.map(
|
|
443
|
+
(n) => b(X(n), { getParent: () => e.value })
|
|
444
|
+
), X = (e) => {
|
|
429
445
|
if (e == null || e === !1)
|
|
430
446
|
return { type: null, [h]: !0 };
|
|
431
447
|
if (Array.isArray(e)) {
|
|
432
|
-
const t = { value: void 0 }, n =
|
|
448
|
+
const t = { value: void 0 }, n = he(t, e), c = {
|
|
433
449
|
type: "l",
|
|
434
450
|
// loop (array mapping)
|
|
435
451
|
[h]: !0,
|
|
@@ -446,7 +462,7 @@ const st = (e, t) => {
|
|
|
446
462
|
let o;
|
|
447
463
|
if (typeof s == "function") {
|
|
448
464
|
const u = s;
|
|
449
|
-
o =
|
|
465
|
+
o = W.has(u) ? u(t, n) : u(de(c), t, n);
|
|
450
466
|
} else
|
|
451
467
|
o = (u) => e(u, n);
|
|
452
468
|
const l = dt(
|
|
@@ -457,28 +473,28 @@ const st = (e, t) => {
|
|
|
457
473
|
n
|
|
458
474
|
);
|
|
459
475
|
return a.value = r, l;
|
|
460
|
-
},
|
|
476
|
+
}, ae = (e, t, n) => {
|
|
461
477
|
const c = e, r = n, s = it(e, t, r);
|
|
462
478
|
return { ctor: c, props: t, children: r, resolve: s };
|
|
463
479
|
}, dt = (e, t, n, c, r) => {
|
|
464
|
-
const { wrappedComponentMaker:
|
|
465
|
-
e,
|
|
466
|
-
c
|
|
467
|
-
), l = ht(
|
|
480
|
+
const s = (B) => X(e(B)), { wrappedComponentMaker: o, customNode: l } = yt(
|
|
468
481
|
s,
|
|
482
|
+
c
|
|
483
|
+
), u = ht(
|
|
484
|
+
o,
|
|
469
485
|
t,
|
|
470
486
|
n,
|
|
471
487
|
c,
|
|
472
488
|
r
|
|
473
489
|
);
|
|
474
|
-
return
|
|
490
|
+
return ye(l, t, n, c, r, u), l;
|
|
475
491
|
}, ht = (e, t, n, c, r) => {
|
|
476
492
|
const s = () => at(e, t, n, c, r, s);
|
|
477
493
|
return s;
|
|
478
494
|
}, at = (e, t, n, c, r, s) => {
|
|
479
495
|
ve(t), ot();
|
|
480
496
|
const o = e(c);
|
|
481
|
-
return
|
|
497
|
+
return ye(o, t, n, c, r, s), o;
|
|
482
498
|
}, yt = (e, t) => {
|
|
483
499
|
let n = e(t);
|
|
484
500
|
if (!n.reRender)
|
|
@@ -486,15 +502,15 @@ const st = (e, t) => {
|
|
|
486
502
|
const c = (r) => {
|
|
487
503
|
const s = e(r);
|
|
488
504
|
if (!s || !s.reRender) {
|
|
489
|
-
const l =
|
|
505
|
+
const l = X(s), u = N({}, l);
|
|
490
506
|
return l.getParent = () => u, u;
|
|
491
507
|
}
|
|
492
|
-
const o =
|
|
508
|
+
const o = N({}, s);
|
|
493
509
|
return s.getParent = () => o, o;
|
|
494
510
|
};
|
|
495
511
|
return n = c(t), { wrappedComponentMaker: c, customNode: n };
|
|
496
|
-
},
|
|
497
|
-
|
|
512
|
+
}, ye = (e, t, n, c, r, s) => {
|
|
513
|
+
b(e, {
|
|
498
514
|
compProps: c,
|
|
499
515
|
compChild: r,
|
|
500
516
|
ctor: n,
|
|
@@ -502,38 +518,38 @@ const st = (e, t) => {
|
|
|
502
518
|
reRender: s
|
|
503
519
|
}), st(
|
|
504
520
|
t,
|
|
505
|
-
() =>
|
|
521
|
+
() => ft(
|
|
506
522
|
n,
|
|
507
523
|
e.compProps || c,
|
|
508
524
|
e.compChild || r,
|
|
509
525
|
e
|
|
510
526
|
)
|
|
511
|
-
),
|
|
527
|
+
), $(t, "vd") && ($(t, "vd").value = e);
|
|
512
528
|
}, Nt = (e) => ({ value: e }), bt = () => Promise.resolve(), Lt = () => {
|
|
513
529
|
const e = d();
|
|
514
|
-
return e ?
|
|
530
|
+
return e ? de(e) : () => !1;
|
|
515
531
|
};
|
|
516
532
|
export {
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
533
|
+
N as Fragment,
|
|
534
|
+
f as componentMap,
|
|
535
|
+
de as componentUpdate,
|
|
520
536
|
vt as disposeComponentEntry,
|
|
521
537
|
d as getComponentKey,
|
|
522
|
-
|
|
538
|
+
$ as getComponentSubInfo,
|
|
523
539
|
lt as h,
|
|
524
540
|
kt as isPropType,
|
|
525
541
|
Tt as lmount,
|
|
526
|
-
|
|
542
|
+
W as lmountComponentSet,
|
|
527
543
|
Mt as mount,
|
|
528
544
|
Rt as mountCallback,
|
|
529
545
|
Pt as mountReadyCallback,
|
|
530
546
|
bt as nextTick,
|
|
531
|
-
|
|
547
|
+
Et as portal,
|
|
532
548
|
Nt as ref,
|
|
533
549
|
xt as render,
|
|
534
|
-
|
|
550
|
+
ft as replaceWDom,
|
|
535
551
|
Ct as setComponentMapManualMode,
|
|
536
|
-
|
|
552
|
+
St as updateCallback,
|
|
537
553
|
Lt as useRenew
|
|
538
554
|
};
|
|
539
555
|
//# sourceMappingURL=lithent.mjs.map
|