lithent 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -8
- package/dist/lithent.mjs +102 -98
- package/dist/lithent.mjs.map +1 -1
- package/dist/lithent.umd.js +1 -1
- package/dist/lithent.umd.js.map +1 -1
- package/dist/utils/predicator.d.ts +0 -1
- package/examples/dist/assets/index.f6f52820.js +2 -0
- package/examples/dist/assets/index.f6f52820.js.map +1 -0
- package/examples/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/render.ts +33 -14
- package/src/tests/renew.tsx +3 -2
- package/src/utils/predicator.ts +0 -5
- package/examples/dist/assets/index.1e9792b7.js +0 -2
- package/examples/dist/assets/index.1e9792b7.js.map +0 -1
- package/examples/dist/assets/index.48a8de86.js +0 -2
- package/examples/dist/assets/index.48a8de86.js.map +0 -1
package/README.md
CHANGED
|
@@ -9,8 +9,7 @@ used lightly in a variety of situations.
|
|
|
9
9
|
- https://superlucky84.github.io/lithent
|
|
10
10
|
- (This guide page is written in lithent.)
|
|
11
11
|
|
|
12
|
-
`(9.
|
|
13
|
-
|
|
12
|
+
`(9.64 KiB / gzip: 3.76 KiB)`
|
|
14
13
|
|
|
15
14
|
## 🚩 Table of Contents
|
|
16
15
|
|
|
@@ -61,10 +60,10 @@ pnpm add lithent
|
|
|
61
60
|
|
|
62
61
|
#### Or Use CDN
|
|
63
62
|
|
|
64
|
-
* UMD : https://cdn.jsdelivr.net/npm/lithent@1.0.
|
|
65
|
-
* UMD-HELPER: https://cdn.jsdelivr.net/npm/lithent@1.0.
|
|
66
|
-
* ESM : https://cdn.jsdelivr.net/npm/lithent@1.0.
|
|
67
|
-
* ESM-HELPER: https://cdn.jsdelivr.net/npm/lithent@1.0.
|
|
63
|
+
* UMD : https://cdn.jsdelivr.net/npm/lithent@1.0.4/dist/lithent.umd.js
|
|
64
|
+
* UMD-HELPER: https://cdn.jsdelivr.net/npm/lithent@1.0.4/helper/dist/lithentHelper.umd.js
|
|
65
|
+
* ESM : https://cdn.jsdelivr.net/npm/lithent@1.0.4/dist/lithent.mjs
|
|
66
|
+
* ESM-HELPER: https://cdn.jsdelivr.net/npm/lithent@1.0.4/helper/dist/lithentHelper.mjs
|
|
68
67
|
|
|
69
68
|
|
|
70
69
|
It's easier to use lithent with JSX or HTM.
|
|
@@ -124,8 +123,8 @@ const destroy = render(html`<${Component} />`, document.getElementById('root'));
|
|
|
124
123
|
#### With UMD
|
|
125
124
|
|
|
126
125
|
```html
|
|
127
|
-
<script src="https://cdn.jsdelivr.net/npm/lithent@1.0.
|
|
128
|
-
<!--script src="https://cdn.jsdelivr.net/npm/lithent@1.0.
|
|
126
|
+
<script src="https://cdn.jsdelivr.net/npm/lithent@1.0.4/dist/lithent.umd.js"></script>
|
|
127
|
+
<!--script src="https://cdn.jsdelivr.net/npm/lithent@1.0.4/helper/dist/lithentHelper.umd.js"></script-->
|
|
129
128
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/htm/3.1.1/htm.js"></script>
|
|
130
129
|
|
|
131
130
|
<div id="root"></div>
|
package/dist/lithent.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
const
|
|
1
|
+
const C = (e) => typeof e == "object" && !("resolve" in e), E = (e, t) => C(e) && e.type === t, fe = (e, t) => "ctor" in e ? e.ctor === (t == null ? void 0 : t.ctor) : e === (t == null ? void 0 : t.ctor), de = (e, t) => {
|
|
2
2
|
var s, c;
|
|
3
|
-
return
|
|
3
|
+
return C(e) && (t == null ? void 0 : t.type) === "fragment" && ((s = t == null ? void 0 : t.children) == null ? void 0 : s.length) === ((c = e == null ? void 0 : e.children) == null ? void 0 : c.length);
|
|
4
4
|
}, pe = (e, t) => {
|
|
5
5
|
var s, c;
|
|
6
|
-
return
|
|
6
|
+
return C(e) && (t == null ? void 0 : t.type) === "element" && (t == null ? void 0 : t.tag) === e.tag && ((s = t == null ? void 0 : t.children) == null ? void 0 : s.length) === ((c = e == null ? void 0 : e.children) == null ? void 0 : c.length);
|
|
7
7
|
}, U = (e, t) => {
|
|
8
8
|
var s, c;
|
|
9
|
-
return
|
|
9
|
+
return C(e) && (t == null ? void 0 : t.type) === e.type && (((s = t == null ? void 0 : t.children) == null ? void 0 : s.length) === ((c = e == null ? void 0 : e.children) == null ? void 0 : c.length) || e.type === "loop" && y(i((e.children || [])[0])) && y(i((t.children || [])[0])));
|
|
10
10
|
}, i = (e) => {
|
|
11
11
|
var t, s, c;
|
|
12
12
|
return (c = (t = e == null ? void 0 : e.compProps) == null ? void 0 : t.key) != null ? c : (s = e == null ? void 0 : e.props) == null ? void 0 : s.key;
|
|
13
|
-
}, P = (e) => e && ["fragment", "loop"].includes(e), T = (e) => typeof e == "function" && !$(e) || typeof e == "object" && "resolve" in e, $ = (e) => typeof e == "function" && e === ce, H = (e) =>
|
|
13
|
+
}, P = (e) => e && ["fragment", "loop"].includes(e), T = (e) => typeof e == "function" && !$(e) || typeof e == "object" && "resolve" in e, $ = (e) => typeof e == "function" && e === ce, H = (e) => C(e) && !e.type, y = (e) => e != null, z = (e, t) => e === "style" && typeof t == "object", he = (e, t) => e === "ref" && typeof t == "object", ie = (e) => e.nodeType === 1 && e.tagName === "OPTION", ve = (e) => e.nodeType === 1 && e.tagName === "TEXTAREA", ye = (e) => e.nodeType === 1 && ["radio", "checkbox"].includes(e.type), ke = (e) => {
|
|
14
14
|
let t = "et";
|
|
15
15
|
return T(e) ? t = "c" : E(e, "fragment") ? t = "f" : E(e, "element") ? t = "e" : E(e, "loop") ? t = "l" : E(e, "text") ? t = "t" : H(e) && (t = "et"), t;
|
|
16
|
-
},
|
|
16
|
+
}, Ce = {
|
|
17
17
|
c: fe,
|
|
18
18
|
l: U,
|
|
19
19
|
t: U,
|
|
@@ -22,20 +22,20 @@ const k = (e) => typeof e == "object" && !("resolve" in e), E = (e, t) => k(e) &
|
|
|
22
22
|
et: U
|
|
23
23
|
}, p = (e) => e.getParent && e.getParent(), Re = (e, t) => {
|
|
24
24
|
const { compProps: s, compChild: c } = e, { props: n, children: r } = t;
|
|
25
|
-
return s &&
|
|
26
|
-
}, J = (e) => e.replace(/^on(.*)/, (t, s) => s.toLowerCase()), G = (e) => e === "className" ? "class" : e,
|
|
27
|
-
e && t !== e && (Y(e).forEach((s) => delete e[s]),
|
|
28
|
-
},
|
|
25
|
+
return s && ae(s, n), c && Ee(c, r), e.reRender && e.reRender();
|
|
26
|
+
}, J = (e) => e.replace(/^on(.*)/, (t, s) => s.toLowerCase()), G = (e) => e === "className" ? "class" : e, k = Object.entries, Y = Object.keys, S = Object.assign, ae = (e, t) => {
|
|
27
|
+
e && t !== e && (Y(e).forEach((s) => delete e[s]), k(t || {}).forEach(([s, c]) => e[s] = c));
|
|
28
|
+
}, Ee = (e, t) => {
|
|
29
29
|
e && t !== e && (e.splice(0, e.length), t && t.forEach((s) => e.push(s)));
|
|
30
30
|
};
|
|
31
31
|
let x = [], A = !1;
|
|
32
|
-
const
|
|
32
|
+
const v = { value: "" }, R = { value: {} }, O = { value: !1 }, u = /* @__PURE__ */ new WeakMap(), xe = (e) => () => {
|
|
33
33
|
var c;
|
|
34
|
-
const t = (c =
|
|
34
|
+
const t = (c = u.get(e)) == null ? void 0 : c.up;
|
|
35
35
|
let s = !1;
|
|
36
36
|
return t && (t(), s = !0), s;
|
|
37
|
-
},
|
|
38
|
-
|
|
37
|
+
}, Pe = (e) => {
|
|
38
|
+
u.set(e, {
|
|
39
39
|
vd: { value: null },
|
|
40
40
|
up: () => {
|
|
41
41
|
},
|
|
@@ -46,25 +46,25 @@ const y = { value: "" }, a = { value: {} }, O = { value: !1 }, o = /* @__PURE__
|
|
|
46
46
|
mts: [],
|
|
47
47
|
umts: []
|
|
48
48
|
});
|
|
49
|
-
},
|
|
50
|
-
|
|
49
|
+
}, a = () => R.value, Z = (e, t) => u.get(e)[t], V = (e, t) => {
|
|
50
|
+
u.get(e).up = () => {
|
|
51
51
|
x.push({
|
|
52
52
|
compKey: e,
|
|
53
53
|
exec: t
|
|
54
|
-
}), A || (A = !0, queueMicrotask(
|
|
54
|
+
}), A || (A = !0, queueMicrotask(Ne));
|
|
55
55
|
};
|
|
56
|
-
},
|
|
57
|
-
|
|
56
|
+
}, Te = (e) => R.value = e, Se = (e) => {
|
|
57
|
+
R.value = e, Pe(e);
|
|
58
58
|
}, K = (e, t) => {
|
|
59
59
|
(e.children || []).forEach((s) => {
|
|
60
60
|
const c = s.compKey;
|
|
61
61
|
c && t.push(c), K(s, t);
|
|
62
62
|
});
|
|
63
|
-
},
|
|
63
|
+
}, Ne = () => {
|
|
64
64
|
let e = [];
|
|
65
65
|
x.forEach((c) => {
|
|
66
|
-
var r,
|
|
67
|
-
const n = (
|
|
66
|
+
var r, o;
|
|
67
|
+
const n = (o = (r = u.get(c.compKey)) == null ? void 0 : r.vd) == null ? void 0 : o.value;
|
|
68
68
|
n && K(n, e);
|
|
69
69
|
});
|
|
70
70
|
const t = [], s = x.reduce((c, n) => {
|
|
@@ -76,69 +76,69 @@ const y = { value: "" }, a = { value: {} }, O = { value: !1 }, o = /* @__PURE__
|
|
|
76
76
|
c && c.exec();
|
|
77
77
|
}
|
|
78
78
|
x = [], A = !1;
|
|
79
|
-
},
|
|
80
|
-
|
|
79
|
+
}, be = (e) => {
|
|
80
|
+
u.get(a()).umts.push(e);
|
|
81
81
|
}, Q = (e) => {
|
|
82
82
|
const { compKey: t } = e;
|
|
83
|
-
t &&
|
|
83
|
+
t && Fe(t), g(e);
|
|
84
84
|
}, g = (e) => {
|
|
85
85
|
(e.children || []).forEach((t) => {
|
|
86
86
|
t.compKey ? Q(t) : g(t);
|
|
87
87
|
});
|
|
88
|
-
},
|
|
89
|
-
const t =
|
|
90
|
-
t && (t.umts.forEach((s) => s()), t.umts = [],
|
|
88
|
+
}, Fe = (e) => {
|
|
89
|
+
const t = u.get(e);
|
|
90
|
+
t && (t.umts.forEach((s) => s()), t.umts = [], u.delete(e));
|
|
91
91
|
};
|
|
92
92
|
let L = [];
|
|
93
93
|
const B = () => {
|
|
94
|
-
L.forEach((e) =>
|
|
95
|
-
},
|
|
94
|
+
L.forEach((e) => Ae(e)), L = [];
|
|
95
|
+
}, Ue = (e) => {
|
|
96
96
|
e.compKey && L.push(e);
|
|
97
|
-
}, ct = (e) =>
|
|
97
|
+
}, ct = (e) => u.get(a()).mts.push(e), Ae = (e) => {
|
|
98
98
|
const { compKey: t } = e;
|
|
99
99
|
if (t) {
|
|
100
|
-
const s =
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
|
|
100
|
+
const s = u.get(t), c = s == null ? void 0 : s.mts, n = s == null ? void 0 : s.upS;
|
|
101
|
+
R.value = t, n && (n.value = 0), c && (s.mts = [], c.forEach((r) => {
|
|
102
|
+
const o = r();
|
|
103
|
+
o && be(o);
|
|
104
104
|
}));
|
|
105
105
|
}
|
|
106
106
|
}, X = (e, t = () => []) => {
|
|
107
|
-
const s =
|
|
108
|
-
if (r &&
|
|
109
|
-
const
|
|
110
|
-
|
|
107
|
+
const s = u.get(a()), { upD: c, upS: n } = s, r = c[n.value];
|
|
108
|
+
if (r && Le(r, t())) {
|
|
109
|
+
const o = e();
|
|
110
|
+
o && s.upCB.push(o);
|
|
111
111
|
}
|
|
112
112
|
c[n.value] = t(), n.value += 1;
|
|
113
|
-
},
|
|
113
|
+
}, Oe = (e) => {
|
|
114
114
|
const { compKey: t } = e;
|
|
115
115
|
if (t) {
|
|
116
|
-
const s =
|
|
117
|
-
|
|
116
|
+
const s = u.get(t), c = s == null ? void 0 : s.upCB, n = s == null ? void 0 : s.upS;
|
|
117
|
+
R.value = t, n && (n.value = 0), e.ctor && c && (s.upCB = [], c.forEach((r) => r()));
|
|
118
118
|
}
|
|
119
|
-
},
|
|
119
|
+
}, Le = (e, t) => !e.length && !e.length ? !0 : e.some((s, c) => s !== t[c]), nt = (e, t, s) => {
|
|
120
120
|
t != null || (t = document.body), e.isRoot = !0, e.wrapElement = t;
|
|
121
121
|
const c = N(e);
|
|
122
122
|
return s ? (e.afterElement = s, t.insertBefore(c, s)) : t.appendChild(c), B(), () => {
|
|
123
123
|
var r;
|
|
124
|
-
const n = (r =
|
|
125
|
-
n && (Q(n), j(n),
|
|
124
|
+
const n = (r = u.get(e.compProps || {})) == null ? void 0 : r.vd.value;
|
|
125
|
+
n && (Q(n), j(n), Me(n));
|
|
126
126
|
};
|
|
127
127
|
}, m = (e) => {
|
|
128
128
|
const { needRerender: t } = e;
|
|
129
129
|
t && t !== "N" && {
|
|
130
130
|
A: q,
|
|
131
131
|
D: I,
|
|
132
|
-
R:
|
|
133
|
-
U:
|
|
132
|
+
R: Be,
|
|
133
|
+
U: je,
|
|
134
134
|
SR: D,
|
|
135
|
-
SU:
|
|
135
|
+
SU: Qe
|
|
136
136
|
}[t](e);
|
|
137
137
|
}, j = (e) => {
|
|
138
138
|
e.props && e.el && te(e.props, e.el), (e.children || []).forEach((t) => {
|
|
139
139
|
j(t);
|
|
140
140
|
});
|
|
141
|
-
},
|
|
141
|
+
}, Me = (e) => {
|
|
142
142
|
w(e, e.wrapElement);
|
|
143
143
|
}, I = (e) => {
|
|
144
144
|
e.oldProps && e.el && te(e.oldProps, e.el), w(
|
|
@@ -155,7 +155,7 @@ const B = () => {
|
|
|
155
155
|
});
|
|
156
156
|
}, D = (e) => {
|
|
157
157
|
I(e), q(e);
|
|
158
|
-
},
|
|
158
|
+
}, Qe = (e) => {
|
|
159
159
|
I(e), q(e, e.el);
|
|
160
160
|
}, q = (e, t) => {
|
|
161
161
|
t || (t = N(e));
|
|
@@ -165,9 +165,9 @@ const B = () => {
|
|
|
165
165
|
t && c && (r ? c.insertBefore(t, r) : c.appendChild(t), B());
|
|
166
166
|
}
|
|
167
167
|
}, M = (e, t) => {
|
|
168
|
-
const s = t.children || [], n = s.indexOf(e) + 1, r = s.slice(n),
|
|
169
|
-
if (
|
|
170
|
-
return
|
|
168
|
+
const s = t.children || [], n = s.indexOf(e) + 1, r = s.slice(n), o = ee(r), l = t.type || "";
|
|
169
|
+
if (o)
|
|
170
|
+
return o;
|
|
171
171
|
if (!t.isRoot && P(l))
|
|
172
172
|
return M(t, p(t));
|
|
173
173
|
if (t.isRoot && t.afterElement)
|
|
@@ -178,7 +178,7 @@ const B = () => {
|
|
|
178
178
|
return t || (r ? ee(s.children || []) : n && n.nodeType !== 11 ? n : t);
|
|
179
179
|
},
|
|
180
180
|
void 0
|
|
181
|
-
),
|
|
181
|
+
), Be = (e) => {
|
|
182
182
|
const t = p(e), s = e.el;
|
|
183
183
|
if (t.type && s)
|
|
184
184
|
if (s.nodeType === 11)
|
|
@@ -188,30 +188,31 @@ const B = () => {
|
|
|
188
188
|
c && c.replaceChild(n, s), B();
|
|
189
189
|
}
|
|
190
190
|
}, te = (e, t) => {
|
|
191
|
-
|
|
191
|
+
k(e || {}).forEach(([s, c]) => {
|
|
192
192
|
s.match(/^on/) && t.removeEventListener(
|
|
193
193
|
J(s),
|
|
194
194
|
c
|
|
195
195
|
);
|
|
196
196
|
});
|
|
197
|
-
},
|
|
197
|
+
}, je = (e) => {
|
|
198
198
|
var s;
|
|
199
199
|
const t = e.el;
|
|
200
200
|
if (e.type === "text") {
|
|
201
|
-
|
|
201
|
+
Ie(e);
|
|
202
202
|
return;
|
|
203
203
|
}
|
|
204
204
|
if (t) {
|
|
205
205
|
const { oldProps: c, props: n } = e;
|
|
206
206
|
se(n, t, c), delete e.oldProps, e.tag === "input" && (t.value = String(((s = e == null ? void 0 : e.props) == null ? void 0 : s.value) || ""));
|
|
207
207
|
}
|
|
208
|
-
(e.children || []).forEach((c) => m(c)),
|
|
209
|
-
},
|
|
208
|
+
(e.children || []).forEach((c) => m(c)), Oe(e);
|
|
209
|
+
}, Ie = (e) => {
|
|
210
210
|
const t = e.el;
|
|
211
211
|
t && (t.nodeValue = String(e.text));
|
|
212
212
|
}, se = (e, t, s) => {
|
|
213
213
|
const c = { ...s };
|
|
214
|
-
|
|
214
|
+
k(e || {}).forEach(([n, r]) => {
|
|
215
|
+
let o = !0;
|
|
215
216
|
n === "key" || (n === "innerHTML" && typeof r == "string" ? t.innerHTML = r : z(n, r) ? Ge(
|
|
216
217
|
r,
|
|
217
218
|
z(n, c.style) ? c.style : {},
|
|
@@ -221,21 +222,24 @@ const B = () => {
|
|
|
221
222
|
n,
|
|
222
223
|
r,
|
|
223
224
|
c[n]
|
|
224
|
-
) :
|
|
225
|
+
) : ye(t) && n === "checked" ? t.checked = !!r : ve(t) && n === "value" ? t.value = r : ie(t) && n === "selected" ? t.selected = !!r : n && ([o, r] = qe(r), o && (v.value && n !== "xmlns" ? t.setAttributeNS(
|
|
225
226
|
null,
|
|
226
227
|
G(n),
|
|
227
|
-
|
|
228
|
+
r
|
|
228
229
|
) : t.setAttribute(
|
|
229
230
|
G(n),
|
|
230
|
-
|
|
231
|
-
))), delete c[n];
|
|
231
|
+
r
|
|
232
|
+
)))), o && delete c[n];
|
|
232
233
|
}), Y(c).forEach(
|
|
233
234
|
(n) => t.removeAttribute(n)
|
|
234
235
|
);
|
|
236
|
+
}, qe = (e) => {
|
|
237
|
+
let t = !0;
|
|
238
|
+
return typeof e == "boolean" && (e || (t = !1), e = ""), [t, String(e)];
|
|
235
239
|
}, N = (e) => {
|
|
236
240
|
let t;
|
|
237
|
-
const { type: s, tag: c, text: n, props: r, children:
|
|
238
|
-
return c === "svg" && (
|
|
241
|
+
const { type: s, tag: c, text: n, props: r, children: o = [] } = e, l = P(s);
|
|
242
|
+
return c === "svg" && (v.value = String(r == null ? void 0 : r.xmlns)), l ? t = new DocumentFragment() : s === "element" && c ? t = v.value ? document.createElementNS(v.value, c) : document.createElement(c) : s === "text" && y(n) ? t = document.createTextNode(String(n)) : t = document.createElement("e"), _e(o, t), se(r, t), e.el = t, Ue(e), c === "svg" && (v.value = ""), t;
|
|
239
243
|
}, _e = (e, t) => {
|
|
240
244
|
const s = e.reduce(
|
|
241
245
|
(c, n) => (n.type && c.appendChild(N(n)), c),
|
|
@@ -247,9 +251,9 @@ const B = () => {
|
|
|
247
251
|
c !== s && (c && e.removeEventListener(n, c), s && e.addEventListener(n, s));
|
|
248
252
|
}, Ge = (e, t, s) => {
|
|
249
253
|
const c = { ...t }, n = s == null ? void 0 : s.style;
|
|
250
|
-
n && (
|
|
251
|
-
n[r] =
|
|
252
|
-
}),
|
|
254
|
+
n && (k(e).forEach(([r, o]) => {
|
|
255
|
+
n[r] = o, delete c[r];
|
|
256
|
+
}), k(c).forEach(
|
|
253
257
|
([r]) => n[r] = ""
|
|
254
258
|
));
|
|
255
259
|
}, b = (e) => {
|
|
@@ -257,7 +261,7 @@ const B = () => {
|
|
|
257
261
|
return e.isRoot && t ? e.wrapElement : t ? b(p(e)) : e.el;
|
|
258
262
|
}, F = (e, t) => Xe(
|
|
259
263
|
e,
|
|
260
|
-
|
|
264
|
+
Ce[ke(e)](e, t),
|
|
261
265
|
t
|
|
262
266
|
), Xe = (e, t, s) => {
|
|
263
267
|
const c = Je(e, t, s), n = [
|
|
@@ -269,12 +273,12 @@ const B = () => {
|
|
|
269
273
|
}, $e = (e, t, s) => {
|
|
270
274
|
s !== "A" && t && (e.el = t.el), s && ["D", "R", "SR"].includes(s) && (t != null && t.compKey && (Q(t), j(t)), e.oldChildren = t == null ? void 0 : t.children), e.oldProps = t == null ? void 0 : t.props;
|
|
271
275
|
}, He = (e, t, s) => {
|
|
272
|
-
const c = s && s.type, n = H(e),
|
|
276
|
+
const c = s && s.type, n = H(e), o = !!e.getParent && p(e).type, l = i(e), h = o === "loop" && y(l), d = e.type === "text" && t && e.text === (s == null ? void 0 : s.text);
|
|
273
277
|
let f;
|
|
274
278
|
return n ? f = "D" : d ? f = "N" : c ? t ? f = h ? "SU" : "U" : f = h ? "SR" : "R" : f = "A", f;
|
|
275
279
|
}, Je = (e, t, s) => T(e) ? t && s ? Re(s, e) : e.resolve() : e, Ye = (e, t, s) => t && s ? Ve(e, s) : Ze(e), Ze = (e) => (e.children || []).map(
|
|
276
280
|
(t) => S(F(t), { getParent: () => e })
|
|
277
|
-
), Ve = (e, t) => e.type === "loop" &&
|
|
281
|
+
), Ve = (e, t) => e.type === "loop" && y(i((e.children || [])[0])) ? Ke(e, t) : (e.children || []).map(
|
|
278
282
|
(s, c) => S(F(s, (t.children || [])[c]), {
|
|
279
283
|
getParent: () => e
|
|
280
284
|
})
|
|
@@ -290,49 +294,49 @@ const B = () => {
|
|
|
290
294
|
}, ge = (e, t) => {
|
|
291
295
|
const s = [...e.children || []], c = [...t.children || []];
|
|
292
296
|
return [s.map((r) => {
|
|
293
|
-
const
|
|
294
|
-
return
|
|
297
|
+
const o = me(r, c), l = F(r, o);
|
|
298
|
+
return o && c.splice(c.indexOf(o), 1), l.getParent = () => e, l;
|
|
295
299
|
}), c];
|
|
296
300
|
}, me = (e, t) => t.find(
|
|
297
301
|
(s) => i(s) === i(e)
|
|
298
302
|
), rt = (e, t = () => []) => {
|
|
299
|
-
|
|
303
|
+
u.get(a()).upR.push(() => X(e, t)), X(e, t);
|
|
300
304
|
}, we = () => {
|
|
301
305
|
var t;
|
|
302
|
-
const e = (t =
|
|
306
|
+
const e = (t = u.get(a())) == null ? void 0 : t.upR;
|
|
303
307
|
e != null && e.length && e.forEach((s) => s());
|
|
304
308
|
}, ce = (e, ...t) => ({
|
|
305
309
|
type: "fragment",
|
|
306
310
|
children: t
|
|
307
|
-
}),
|
|
308
|
-
const c = { value: void 0 }, n = t || {}, r =
|
|
309
|
-
return T(
|
|
310
|
-
},
|
|
311
|
+
}), ot = (e, t, ...s) => {
|
|
312
|
+
const c = { value: void 0 }, n = t || {}, r = ue(c, s), o = tt(e, n, r);
|
|
313
|
+
return T(o) || (c.value = o), o;
|
|
314
|
+
}, ut = (e) => (t, s) => e, ne = (e, t, s, c) => {
|
|
311
315
|
var f;
|
|
312
316
|
O.value = !0;
|
|
313
|
-
const n = re(e, t, s), r = F(n, c), { isRoot:
|
|
314
|
-
if (r.getParent = l, !
|
|
317
|
+
const n = re(e, t, s), r = F(n, c), { isRoot: o, getParent: l, wrapElement: h, afterElement: d } = c;
|
|
318
|
+
if (r.getParent = l, !o && l) {
|
|
315
319
|
const _ = ((f = l()) == null ? void 0 : f.children) || [], le = _.indexOf(c);
|
|
316
320
|
_.splice(le, 1, r);
|
|
317
321
|
} else
|
|
318
322
|
r.isRoot = !0, r.wrapElement = h, r.afterElement = d;
|
|
319
323
|
O.value = !1, m(r);
|
|
320
|
-
}, re = (e, t, s) => ({ tagName: e.name, ctor: e, props: t, children: s, resolve: (
|
|
321
|
-
|
|
322
|
-
const h = e(t, s)(
|
|
324
|
+
}, re = (e, t, s) => ({ tagName: e.name, ctor: e, props: t, children: s, resolve: (o = t) => {
|
|
325
|
+
Se(o);
|
|
326
|
+
const h = e(t, s)(xe(o), t, s), d = We(
|
|
323
327
|
h,
|
|
324
|
-
|
|
328
|
+
o,
|
|
325
329
|
e,
|
|
326
330
|
t,
|
|
327
331
|
s
|
|
328
332
|
), f = d;
|
|
329
333
|
return V(
|
|
330
|
-
|
|
334
|
+
o,
|
|
331
335
|
() => ne(e, t, s, f)
|
|
332
|
-
), Z(
|
|
336
|
+
), Z(o, "vd").value = d, d;
|
|
333
337
|
} }), We = (e, t, s, c, n) => {
|
|
334
338
|
const r = e(c);
|
|
335
|
-
return
|
|
339
|
+
return oe(
|
|
336
340
|
r,
|
|
337
341
|
t,
|
|
338
342
|
s,
|
|
@@ -344,13 +348,13 @@ const B = () => {
|
|
|
344
348
|
const r = () => et(e, t, s, c, n, r);
|
|
345
349
|
return r;
|
|
346
350
|
}, et = (e, t, s, c, n, r) => {
|
|
347
|
-
|
|
348
|
-
const
|
|
351
|
+
Te(t), we();
|
|
352
|
+
const o = e(c);
|
|
349
353
|
return V(
|
|
350
354
|
t,
|
|
351
|
-
() => ne(s, c, n,
|
|
352
|
-
),
|
|
353
|
-
},
|
|
355
|
+
() => ne(s, c, n, o)
|
|
356
|
+
), oe(o, t, s, c, n, r), Z(t, "vd").value = o, o;
|
|
357
|
+
}, oe = (e, t, s, c, n, r) => {
|
|
354
358
|
S(e, {
|
|
355
359
|
compProps: c,
|
|
356
360
|
compChild: n,
|
|
@@ -372,7 +376,7 @@ const B = () => {
|
|
|
372
376
|
props: t,
|
|
373
377
|
children: s
|
|
374
378
|
};
|
|
375
|
-
},
|
|
379
|
+
}, ue = (e, t) => t.map(
|
|
376
380
|
(s) => S(st(s), { getParent: () => e.value })
|
|
377
381
|
), st = (e) => {
|
|
378
382
|
if (e == null || e === !1)
|
|
@@ -380,7 +384,7 @@ const B = () => {
|
|
|
380
384
|
if (Array.isArray(e)) {
|
|
381
385
|
const t = { value: void 0 }, c = {
|
|
382
386
|
type: "loop",
|
|
383
|
-
children:
|
|
387
|
+
children: ue(t, e)
|
|
384
388
|
};
|
|
385
389
|
return t.value = c, c;
|
|
386
390
|
} else if (typeof e == "string" || typeof e == "number")
|
|
@@ -389,8 +393,8 @@ const B = () => {
|
|
|
389
393
|
}, lt = (e) => ({ value: e }), ft = () => Promise.resolve();
|
|
390
394
|
export {
|
|
391
395
|
ce as Fragment,
|
|
392
|
-
|
|
393
|
-
|
|
396
|
+
ot as h,
|
|
397
|
+
ut as mount,
|
|
394
398
|
ct as mountCallback,
|
|
395
399
|
ft as nextTick,
|
|
396
400
|
lt as ref,
|