lithent 1.0.3 → 1.0.5

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 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.60 KiB / gzip: 3.72 KiB)`
13
-
12
+ `(9.97 kB / gzip: 3.92 kB)`
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.3/dist/lithent.umd.js
65
- * UMD-HELPER: https://cdn.jsdelivr.net/npm/lithent@1.0.3/helper/dist/lithentHelper.umd.js
66
- * ESM : https://cdn.jsdelivr.net/npm/lithent@1.0.3/dist/lithent.mjs
67
- * ESM-HELPER: https://cdn.jsdelivr.net/npm/lithent@1.0.3/helper/dist/lithentHelper.mjs
63
+ * UMD : https://cdn.jsdelivr.net/npm/lithent@1.0.5/dist/lithent.umd.js
64
+ * UMD-HELPER: https://cdn.jsdelivr.net/npm/lithent@1.0.5/helper/dist/lithentHelper.umd.js
65
+ * ESM : https://cdn.jsdelivr.net/npm/lithent@1.0.5/dist/lithent.mjs
66
+ * ESM-HELPER: https://cdn.jsdelivr.net/npm/lithent@1.0.5/helper/dist/lithentHelper.mjs
68
67
 
69
68
 
70
69
  It's easier to use lithent with JSX or HTM.
@@ -114,18 +113,16 @@ const Component = mount((renew, _props) => {
114
113
  `;
115
114
  });
116
115
 
117
- // insertBefore
118
- // render(`<${Component} />`, document.getElementById('root'), document.getElementById('nextElement'));
119
-
120
- // appendChild
121
- const destroy = render(html`<${Component} />`, document.getElementById('root'));
116
+ // appendChild or insertBefore
117
+ // The third argument is an optional value for insertBefore.
118
+ const destroy = render(html`<${Component} />`, document.getElementById('root'), document.getElementById('#insert-before-this-element'));
122
119
  ```
123
120
 
124
121
  #### With UMD
125
122
 
126
123
  ```html
127
- <script src="https://cdn.jsdelivr.net/npm/lithent@1.0.3/dist/lithent.umd.js"></script>
128
- <!--script src="https://cdn.jsdelivr.net/npm/lithent@1.0.3/helper/dist/lithentHelper.umd.js"></script-->
124
+ <script src="https://cdn.jsdelivr.net/npm/lithent@1.0.5/dist/lithent.umd.js"></script>
125
+ <!--script src="https://cdn.jsdelivr.net/npm/lithent@1.0.5/helper/dist/lithentHelper.umd.js"></script-->
129
126
  <script src="https://cdnjs.cloudflare.com/ajax/libs/htm/3.1.1/htm.js"></script>
130
127
 
131
128
  <div id="root"></div>
@@ -152,7 +149,9 @@ const Component = mount(renew => {
152
149
  `;
153
150
  });
154
151
 
155
- const destroy = render(html`<${Component} />`, document.getElementById('root'));
152
+ // appendChild or insertBefore
153
+ // The third argument is an optional value for insertBefore.
154
+ const destroy = render(html`<${Component} />`, document.getElementById('root'), document.getElementById('#insert-before-this-element'));
156
155
  </script>
157
156
  ```
158
157
 
package/dist/lithent.mjs CHANGED
@@ -1,41 +1,41 @@
1
- const k = (e) => typeof e == "object" && !("resolve" in e), E = (e, t) => k(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) => {
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 k(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);
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 k(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);
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 k(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" && v(i((e.children || [])[0])) && v(i((t.children || [])[0])));
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
- var t, s, c;
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) => k(e) && !e.type, v = (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", ye = (e) => e.nodeType === 1 && e.tagName === "TEXTAREA", ve = (e) => e.nodeType === 1 && ["radio", "checkbox"].includes(e.type), Ce = (e) => typeof e == "number" || typeof e == "string", ke = (e) => {
11
+ var t, s;
12
+ return ((t = e == null ? void 0 : e.compProps) == null ? void 0 : t.key) ?? ((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) => 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
- }, ae = {
16
+ }, Ce = {
17
17
  c: fe,
18
18
  l: U,
19
19
  t: U,
20
20
  e: pe,
21
21
  f: de,
22
22
  et: U
23
- }, p = (e) => e.getParent && e.getParent(), Re = (e, t) => {
23
+ }, p = (e) => e.getParent && e.getParent(), ae = (e, t) => {
24
24
  const { compProps: s, compChild: c } = e, { props: n, children: r } = t;
25
- return s && Ee(s, n), c && xe(c, r), e.reRender && e.reRender();
26
- }, J = (e) => e.replace(/^on(.*)/, (t, s) => s.toLowerCase()), G = (e) => e === "className" ? "class" : e, C = Object.entries, Y = Object.keys, S = Object.assign, Ee = (e, t) => {
27
- e && t !== e && (Y(e).forEach((s) => delete e[s]), C(t || {}).forEach(([s, c]) => e[s] = c));
28
- }, xe = (e, t) => {
25
+ return s && Re(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, Re = (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 y = { value: "" }, a = { value: {} }, O = { value: !1 }, o = /* @__PURE__ */ new WeakMap(), Pe = (e) => () => {
32
+ const v = { value: "" }, a = { value: {} }, O = { value: !1 }, u = /* @__PURE__ */ new WeakMap(), xe = (e) => () => {
33
33
  var c;
34
- const t = (c = o.get(e)) == null ? void 0 : c.up;
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
- }, Te = (e) => {
38
- o.set(e, {
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
- }, R = () => a.value, Z = (e, t) => o.get(e)[t], V = (e, t) => {
50
- o.get(e).up = () => {
49
+ }, R = () => a.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(be));
54
+ }), A || (A = !0, queueMicrotask(Ne));
55
55
  };
56
- }, Se = (e) => a.value = e, Ne = (e) => {
57
- a.value = e, Te(e);
56
+ }, Te = (e) => a.value = e, Se = (e) => {
57
+ a.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
- }, be = () => {
63
+ }, Ne = () => {
64
64
  let e = [];
65
65
  x.forEach((c) => {
66
- var r, u;
67
- const n = (u = (r = o.get(c.compKey)) == null ? void 0 : r.vd) == null ? void 0 : u.value;
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
- }, Fe = (e) => {
80
- o.get(R()).umts.push(e);
79
+ }, be = (e) => {
80
+ u.get(R()).umts.push(e);
81
81
  }, Q = (e) => {
82
82
  const { compKey: t } = e;
83
- t && Ue(t), g(e);
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
- }, Ue = (e) => {
89
- const t = o.get(e);
90
- t && (t.umts.forEach((s) => s()), t.umts = [], o.delete(e));
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) => Oe(e)), L = [];
95
- }, Ae = (e) => {
94
+ L.forEach((e) => Ae(e)), L = [];
95
+ }, Ue = (e) => {
96
96
  e.compKey && L.push(e);
97
- }, ct = (e) => o.get(R()).mts.push(e), Oe = (e) => {
97
+ }, ct = (e) => u.get(R()).mts.push(e), Ae = (e) => {
98
98
  const { compKey: t } = e;
99
99
  if (t) {
100
- const s = o.get(t), c = s == null ? void 0 : s.mts, n = s == null ? void 0 : s.upS;
100
+ const s = u.get(t), c = s == null ? void 0 : s.mts, n = s == null ? void 0 : s.upS;
101
101
  a.value = t, n && (n.value = 0), c && (s.mts = [], c.forEach((r) => {
102
- const u = r();
103
- u && Fe(u);
102
+ const o = r();
103
+ o && be(o);
104
104
  }));
105
105
  }
106
106
  }, X = (e, t = () => []) => {
107
- const s = o.get(R()), { upD: c, upS: n } = s, r = c[n.value];
108
- if (r && Me(r, t())) {
109
- const u = e();
110
- u && s.upCB.push(u);
107
+ const s = u.get(R()), { 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
- }, Le = (e) => {
113
+ }, Oe = (e) => {
114
114
  const { compKey: t } = e;
115
115
  if (t) {
116
- const s = o.get(t), c = s == null ? void 0 : s.upCB, n = s == null ? void 0 : s.upS;
116
+ const s = u.get(t), c = s == null ? void 0 : s.upCB, n = s == null ? void 0 : s.upS;
117
117
  a.value = t, n && (n.value = 0), e.ctor && c && (s.upCB = [], c.forEach((r) => r()));
118
118
  }
119
- }, Me = (e, t) => !e.length && !e.length ? !0 : e.some((s, c) => s !== t[c]), nt = (e, t, s) => {
120
- t != null || (t = document.body), e.isRoot = !0, e.wrapElement = t;
119
+ }, Le = (e, t) => !e.length && !e.length ? !0 : e.some((s, c) => s !== t[c]), nt = (e, t, s) => {
120
+ t ?? (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 = o.get(e.compProps || {})) == null ? void 0 : r.vd.value;
125
- n && (Q(n), j(n), Qe(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: je,
133
- U: Ie,
132
+ R: Be,
133
+ U: je,
134
134
  SR: D,
135
- SU: Be
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
- }, Qe = (e) => {
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
- }, Be = (e) => {
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), u = ee(r), l = t.type || "";
169
- if (u)
170
- return u;
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
- ), je = (e) => {
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
- C(e || {}).forEach(([s, c]) => {
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
- }, Ie = (e) => {
197
+ }, je = (e) => {
198
198
  var s;
199
199
  const t = e.el;
200
200
  if (e.type === "text") {
201
- qe(e);
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)), Le(e);
209
- }, qe = (e) => {
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
- C(e || {}).forEach(([n, r]) => {
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
- ) : ve(t) && n === "checked" ? t.checked = !!r : ye(t) && n === "value" ? t.value = r : ie(t) && n === "selected" ? t.selected = !!r : Ce(r) && (y.value && n !== "xmlns" ? t.setAttributeNS(
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
- String(r)
228
+ r
228
229
  ) : t.setAttribute(
229
230
  G(n),
230
- String(r)
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: u = [] } = e, l = P(s);
238
- return c === "svg" && (y.value = String(r == null ? void 0 : r.xmlns)), l ? t = new DocumentFragment() : s === "element" && c ? t = y.value ? document.createElementNS(y.value, c) : document.createElement(c) : s === "text" && v(n) ? t = document.createTextNode(String(n)) : t = document.createElement("e"), _e(u, t), se(r, t), e.el = t, Ae(e), c === "svg" && (y.value = ""), t;
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 && (C(e).forEach(([r, u]) => {
251
- n[r] = u, delete c[r];
252
- }), C(c).forEach(
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
- ae[ke(e)](e, t),
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), u = !!e.getParent && p(e).type, l = i(e), h = u === "loop" && v(l), d = e.type === "text" && t && e.text === (s == null ? void 0 : s.text);
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
- }, 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(
279
+ }, Je = (e, t, s) => T(e) ? t && s ? ae(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" && v(i((e.children || [])[0])) ? Ke(e, t) : (e.children || []).map(
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,53 @@ const B = () => {
290
294
  }, ge = (e, t) => {
291
295
  const s = [...e.children || []], c = [...t.children || []];
292
296
  return [s.map((r) => {
293
- const u = me(r, c), l = F(r, u);
294
- return u && c.splice(c.indexOf(u), 1), l.getParent = () => e, l;
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
- o.get(R()).upR.push(() => X(e, t)), X(e, t);
303
+ u.get(R()).upR.push(() => X(e, t)), X(e, t);
300
304
  }, we = () => {
301
305
  var t;
302
- const e = (t = o.get(R())) == null ? void 0 : t.upR;
306
+ const e = (t = u.get(R())) == 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
- }), ut = (e, t, ...s) => {
308
- const c = { value: void 0 }, n = t || {}, r = oe(c, s), u = tt(e, n, r);
309
- return T(u) || (c.value = u), u;
310
- }, ot = (e) => (t, s) => e, ne = (e, t, s, c) => {
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: u, getParent: l, wrapElement: h, afterElement: d } = c;
314
- if (r.getParent = l, !u && 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: (u = t) => {
321
- Ne(u);
322
- const h = e(t, s)(Pe(u), t, s), d = We(
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
- u,
328
+ o,
325
329
  e,
326
330
  t,
327
331
  s
328
332
  ), f = d;
329
333
  return V(
330
- u,
334
+ o,
331
335
  () => ne(e, t, s, f)
332
- ), Z(u, "vd").value = d, d;
336
+ ), Z(o, "vd").value = d, d;
333
337
  } }), We = (e, t, s, c, n) => {
334
338
  const r = e(c);
335
- return ue(
339
+ if (r.reRender)
340
+ throw new Error(
341
+ 'The root of a component must not be a component, use "Fragment"'
342
+ );
343
+ return oe(
336
344
  r,
337
345
  t,
338
346
  s,
@@ -344,13 +352,13 @@ const B = () => {
344
352
  const r = () => et(e, t, s, c, n, r);
345
353
  return r;
346
354
  }, et = (e, t, s, c, n, r) => {
347
- Se(t), we();
348
- const u = e(c);
355
+ Te(t), we();
356
+ const o = e(c);
349
357
  return V(
350
358
  t,
351
- () => ne(s, c, n, u)
352
- ), ue(u, t, s, c, n, r), Z(t, "vd").value = u, u;
353
- }, ue = (e, t, s, c, n, r) => {
359
+ () => ne(s, c, n, o)
360
+ ), oe(o, t, s, c, n, r), Z(t, "vd").value = o, o;
361
+ }, oe = (e, t, s, c, n, r) => {
354
362
  S(e, {
355
363
  compProps: c,
356
364
  compChild: n,
@@ -372,7 +380,7 @@ const B = () => {
372
380
  props: t,
373
381
  children: s
374
382
  };
375
- }, oe = (e, t) => t.map(
383
+ }, ue = (e, t) => t.map(
376
384
  (s) => S(st(s), { getParent: () => e.value })
377
385
  ), st = (e) => {
378
386
  if (e == null || e === !1)
@@ -380,7 +388,7 @@ const B = () => {
380
388
  if (Array.isArray(e)) {
381
389
  const t = { value: void 0 }, c = {
382
390
  type: "loop",
383
- children: oe(t, e)
391
+ children: ue(t, e)
384
392
  };
385
393
  return t.value = c, c;
386
394
  } else if (typeof e == "string" || typeof e == "number")
@@ -389,8 +397,8 @@ const B = () => {
389
397
  }, lt = (e) => ({ value: e }), ft = () => Promise.resolve();
390
398
  export {
391
399
  ce as Fragment,
392
- ut as h,
393
- ot as mount,
400
+ ot as h,
401
+ ut as mount,
394
402
  ct as mountCallback,
395
403
  ft as nextTick,
396
404
  lt as ref,