lithent 1.0.5 → 1.0.7

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,7 +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.97 kB / gzip: 3.92 kB)`
12
+ `(9.86 kB │ gzip: 3.91 kB)`
13
13
 
14
14
  ## 🚩 Table of Contents
15
15
 
@@ -60,10 +60,10 @@ pnpm add lithent
60
60
 
61
61
  #### Or Use CDN
62
62
 
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
63
+ * UMD : https://cdn.jsdelivr.net/npm/lithent@1.0.7/dist/lithent.umd.js
64
+ * UMD-HELPER: https://cdn.jsdelivr.net/npm/lithent@1.0.7/helper/dist/lithentHelper.umd.js
65
+ * ESM : https://cdn.jsdelivr.net/npm/lithent@1.0.7/dist/lithent.mjs
66
+ * ESM-HELPER: https://cdn.jsdelivr.net/npm/lithent@1.0.7/helper/dist/lithentHelper.mjs
67
67
 
68
68
 
69
69
  It's easier to use lithent with JSX or HTM.
@@ -121,8 +121,8 @@ const destroy = render(html`<${Component} />`, document.getElementById('root'),
121
121
  #### With UMD
122
122
 
123
123
  ```html
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-->
124
+ <script src="https://cdn.jsdelivr.net/npm/lithent@1.0.7/dist/lithent.umd.js"></script>
125
+ <!--script src="https://cdn.jsdelivr.net/npm/lithent@1.0.7/helper/dist/lithentHelper.umd.js"></script-->
126
126
  <script src="https://cdnjs.cloudflare.com/ajax/libs/htm/3.1.1/htm.js"></script>
127
127
 
128
128
  <div id="root"></div>
package/dist/lithent.mjs CHANGED
@@ -1,40 +1,23 @@
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) => {
1
+ const C = (e) => typeof e == "object" && !("resolve" in e), x = (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
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
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
- }, U = (e, t) => {
8
- var s, c;
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
- }, i = (e) => {
7
+ }, U = (e, t) => C(e) && (t == null ? void 0 : t.type) === e.type && (e.type !== "loop" || e.type === "loop" && a(i((e.children || [])[0])) && a(i((t.children || [])[0]))), i = (e) => {
11
8
  var t, s;
12
9
  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) => {
10
+ }, v = (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, a = (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), ae = (e) => {
14
11
  let t = "et";
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
- }, Ce = {
12
+ return T(e) ? t = "c" : x(e, "fragment") ? t = "f" : x(e, "element") ? t = "e" : x(e, "loop") ? t = "l" : x(e, "text") ? t = "t" : H(e) && (t = "et"), t;
13
+ }, ke = {
17
14
  c: fe,
18
15
  l: U,
19
16
  t: U,
20
17
  e: pe,
21
18
  f: de,
22
19
  et: U
23
- }, p = (e) => e.getParent && e.getParent(), ae = (e, t) => {
24
- const { compProps: s, compChild: c } = e, { props: n, children: r } = 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
- e && t !== e && (e.splice(0, e.length), t && t.forEach((s) => e.push(s)));
30
- };
31
- let x = [], A = !1;
32
- const v = { value: "" }, a = { value: {} }, O = { value: !1 }, u = /* @__PURE__ */ new WeakMap(), xe = (e) => () => {
33
- var c;
34
- const t = (c = u.get(e)) == null ? void 0 : c.up;
35
- let s = !1;
36
- return t && (t(), s = !0), s;
37
- }, Pe = (e) => {
20
+ }, p = (e) => e.getParent && e.getParent(), J = (e) => e.replace(/^on(.*)/, (t, s) => s.toLowerCase()), G = (e) => e === "className" ? "class" : e, k = Object.entries, Y = Object.keys, S = Object.assign, y = { value: "" }, R = { value: {} }, A = { value: !1 }, u = /* @__PURE__ */ new WeakMap(), Ce = (e) => {
38
21
  u.set(e, {
39
22
  vd: { value: null },
40
23
  up: () => {
@@ -46,183 +29,155 @@ const v = { value: "" }, a = { value: {} }, O = { value: !1 }, u = /* @__PURE__
46
29
  mts: [],
47
30
  umts: []
48
31
  });
49
- }, R = () => a.value, Z = (e, t) => u.get(e)[t], V = (e, t) => {
50
- u.get(e).up = () => {
51
- x.push({
52
- compKey: e,
53
- exec: t
54
- }), A || (A = !0, queueMicrotask(Ne));
55
- };
56
- }, Te = (e) => a.value = e, Se = (e) => {
57
- a.value = e, Pe(e);
58
- }, K = (e, t) => {
59
- (e.children || []).forEach((s) => {
60
- const c = s.compKey;
61
- c && t.push(c), K(s, t);
62
- });
63
- }, Ne = () => {
64
- let e = [];
65
- x.forEach((c) => {
66
- var r, o;
67
- const n = (o = (r = u.get(c.compKey)) == null ? void 0 : r.vd) == null ? void 0 : o.value;
68
- n && K(n, e);
69
- });
70
- const t = [], s = x.reduce((c, n) => {
71
- const { compKey: r } = n;
72
- return e.includes(r) || t.includes(r) || (t.push(r), c.push(n)), c;
73
- }, []);
74
- for (; s.length; ) {
75
- const c = s.shift();
76
- c && c.exec();
77
- }
78
- x = [], A = !1;
79
- }, be = (e) => {
80
- u.get(R()).umts.push(e);
32
+ }, E = () => R.value, Z = (e, t) => u.get(e)[t], Re = (e) => R.value = e, Ee = (e) => {
33
+ R.value = e, Ce(e);
34
+ }, xe = (e) => {
35
+ u.get(E()).umts.push(e);
81
36
  }, Q = (e) => {
82
37
  const { compKey: t } = e;
83
- t && Fe(t), g(e);
84
- }, g = (e) => {
38
+ t && Pe(t), V(e);
39
+ }, V = (e) => {
85
40
  (e.children || []).forEach((t) => {
86
- t.compKey ? Q(t) : g(t);
41
+ t.compKey ? Q(t) : V(t);
87
42
  });
88
- }, Fe = (e) => {
43
+ }, Pe = (e) => {
89
44
  const t = u.get(e);
90
45
  t && (t.umts.forEach((s) => s()), t.umts = [], u.delete(e));
91
46
  };
92
- let L = [];
47
+ let O = [];
93
48
  const B = () => {
94
- L.forEach((e) => Ae(e)), L = [];
95
- }, Ue = (e) => {
96
- e.compKey && L.push(e);
97
- }, ct = (e) => u.get(R()).mts.push(e), Ae = (e) => {
49
+ O.forEach((e) => Se(e)), O = [];
50
+ }, Te = (e) => {
51
+ e.compKey && O.push(e);
52
+ }, ct = (e) => u.get(E()).mts.push(e), Se = (e) => {
98
53
  const { compKey: t } = e;
99
54
  if (t) {
100
55
  const s = u.get(t), c = s == null ? void 0 : s.mts, n = s == null ? void 0 : s.upS;
101
- a.value = t, n && (n.value = 0), c && (s.mts = [], c.forEach((r) => {
56
+ R.value = t, n && (n.value = 0), c && (s.mts = [], c.forEach((r) => {
102
57
  const o = r();
103
- o && be(o);
58
+ o && xe(o);
104
59
  }));
105
60
  }
106
61
  }, X = (e, t = () => []) => {
107
- const s = u.get(R()), { upD: c, upS: n } = s, r = c[n.value];
108
- if (r && Le(r, t())) {
62
+ const s = u.get(E()), { upD: c, upS: n } = s, r = c[n.value];
63
+ if (r && be(r, t())) {
109
64
  const o = e();
110
65
  o && s.upCB.push(o);
111
66
  }
112
67
  c[n.value] = t(), n.value += 1;
113
- }, Oe = (e) => {
68
+ }, Ne = (e) => {
114
69
  const { compKey: t } = e;
115
70
  if (t) {
116
71
  const s = u.get(t), c = s == null ? void 0 : s.upCB, n = s == null ? void 0 : s.upS;
117
- a.value = t, n && (n.value = 0), e.ctor && c && (s.upCB = [], c.forEach((r) => r()));
72
+ R.value = t, n && (n.value = 0), e.ctor && c && (s.upCB = [], c.forEach((r) => r()));
118
73
  }
119
- }, Le = (e, t) => !e.length && !e.length ? !0 : e.some((s, c) => s !== t[c]), nt = (e, t, s) => {
74
+ }, be = (e, t) => !e.length && !e.length ? !0 : e.some((s, c) => s !== t[c]), nt = (e, t, s) => {
120
75
  t ?? (t = document.body), e.isRoot = !0, e.wrapElement = t;
121
76
  const c = N(e);
122
77
  return s ? (e.afterElement = s, t.insertBefore(c, s)) : t.appendChild(c), B(), () => {
123
78
  var r;
124
79
  const n = (r = u.get(e.compProps || {})) == null ? void 0 : r.vd.value;
125
- n && (Q(n), j(n), Me(n));
80
+ n && (Q(n), j(n), Fe(n));
126
81
  };
127
- }, m = (e) => {
82
+ }, K = (e) => {
128
83
  const { needRerender: t } = e;
129
84
  t && t !== "N" && {
130
85
  A: q,
131
86
  D: I,
132
- R: Be,
133
- U: je,
134
- SR: D,
135
- SU: Qe
87
+ R: Ae,
88
+ U: Oe,
89
+ SR: w,
90
+ SU: Ue
136
91
  }[t](e);
137
92
  }, j = (e) => {
138
- e.props && e.el && te(e.props, e.el), (e.children || []).forEach((t) => {
93
+ e.props && e.el && D(e.props, e.el), (e.children || []).forEach((t) => {
139
94
  j(t);
140
95
  });
141
- }, Me = (e) => {
142
- w(e, e.wrapElement);
96
+ }, Fe = (e) => {
97
+ g(e, e.wrapElement);
143
98
  }, I = (e) => {
144
- e.oldProps && e.el && te(e.oldProps, e.el), w(
99
+ e.oldProps && e.el && D(e.oldProps, e.el), g(
145
100
  e,
146
101
  b(p(e))
147
102
  );
148
- }, w = (e, t) => {
103
+ }, g = (e, t) => {
149
104
  var s, c;
150
- t && e.el && (((s = e.el) == null ? void 0 : s.nodeType) === 1 ? t.removeChild(e.el) : ((c = e.el) == null ? void 0 : c.nodeType) === 11 && W(e, t), delete e.el);
151
- }, W = (e, t) => {
105
+ t && e.el && (((s = e.el) == null ? void 0 : s.nodeType) === 1 ? t.removeChild(e.el) : ((c = e.el) == null ? void 0 : c.nodeType) === 11 && m(e, t), delete e.el);
106
+ }, m = (e, t) => {
152
107
  ((e == null ? void 0 : e.oldChildren) || (e == null ? void 0 : e.children) || []).forEach((s) => {
153
108
  var c, n;
154
- ((c = s.el) == null ? void 0 : c.nodeType) === 1 ? t.removeChild(s == null ? void 0 : s.el) : ((n = s.el) == null ? void 0 : n.nodeType) === 11 && W(s, t);
109
+ ((c = s.el) == null ? void 0 : c.nodeType) === 1 ? t.removeChild(s == null ? void 0 : s.el) : ((n = s.el) == null ? void 0 : n.nodeType) === 11 && m(s, t);
155
110
  });
156
- }, D = (e) => {
111
+ }, w = (e) => {
157
112
  I(e), q(e);
158
- }, Qe = (e) => {
113
+ }, Ue = (e) => {
159
114
  I(e), q(e, e.el);
160
115
  }, q = (e, t) => {
161
116
  t || (t = N(e));
162
117
  const s = p(e);
163
118
  if (s.type) {
164
- const c = b(s), r = s.type === "loop" ? M(s, p(s)) : M(e, s);
119
+ const c = b(s), r = s.type === "loop" ? L(s, p(s)) : L(e, s);
165
120
  t && c && (r ? c.insertBefore(t, r) : c.appendChild(t), B());
166
121
  }
167
- }, M = (e, t) => {
168
- const s = t.children || [], n = s.indexOf(e) + 1, r = s.slice(n), o = ee(r), l = t.type || "";
122
+ }, L = (e, t) => {
123
+ const s = t.children || [], n = s.indexOf(e) + 1, r = s.slice(n), o = W(r), l = t.type || "";
169
124
  if (o)
170
125
  return o;
171
- if (!t.isRoot && P(l))
172
- return M(t, p(t));
173
- if (t.isRoot && t.afterElement)
126
+ if (!t.isRoot && v(l))
127
+ return L(t, p(t));
128
+ if (t.isRoot && v(l) && t.afterElement)
174
129
  return t.afterElement;
175
- }, ee = (e) => e.reduce(
130
+ }, W = (e) => e.reduce(
176
131
  (t, s) => {
177
- const c = s.type, n = s.el, r = c && P(c);
178
- return t || (r ? ee(s.children || []) : n && n.nodeType !== 11 ? n : t);
132
+ const c = s.type, n = s.el, r = c && v(c);
133
+ return t || (r ? W(s.children || []) : n && n.nodeType !== 11 ? n : t);
179
134
  },
180
135
  void 0
181
- ), Be = (e) => {
136
+ ), Ae = (e) => {
182
137
  const t = p(e), s = e.el;
183
138
  if (t.type && s)
184
139
  if (s.nodeType === 11)
185
- D(e);
140
+ w(e);
186
141
  else {
187
142
  const c = b(t), n = N(e);
188
143
  c && c.replaceChild(n, s), B();
189
144
  }
190
- }, te = (e, t) => {
145
+ }, D = (e, t) => {
191
146
  k(e || {}).forEach(([s, c]) => {
192
147
  s.match(/^on/) && t.removeEventListener(
193
148
  J(s),
194
149
  c
195
150
  );
196
151
  });
197
- }, je = (e) => {
152
+ }, Oe = (e) => {
198
153
  var s;
199
154
  const t = e.el;
200
155
  if (e.type === "text") {
201
- Ie(e);
156
+ Le(e);
202
157
  return;
203
158
  }
204
159
  if (t) {
205
160
  const { oldProps: c, props: n } = e;
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) || ""));
161
+ ee(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
162
  }
208
- (e.children || []).forEach((c) => m(c)), Oe(e);
209
- }, Ie = (e) => {
163
+ (e.children || []).forEach((c) => K(c)), Ne(e);
164
+ }, Le = (e) => {
210
165
  const t = e.el;
211
166
  t && (t.nodeValue = String(e.text));
212
- }, se = (e, t, s) => {
167
+ }, ee = (e, t, s) => {
213
168
  const c = { ...s };
214
169
  k(e || {}).forEach(([n, r]) => {
215
170
  let o = !0;
216
- n === "key" || (n === "innerHTML" && typeof r == "string" ? t.innerHTML = r : z(n, r) ? Ge(
171
+ n === "key" || (n === "innerHTML" && typeof r == "string" ? t.innerHTML = r : z(n, r) ? je(
217
172
  r,
218
173
  z(n, c.style) ? c.style : {},
219
174
  t
220
- ) : he(n, r) ? r.value = t : n.match(/^on/) ? ze(
175
+ ) : he(n, r) ? r.value = t : n.match(/^on/) ? Be(
221
176
  t,
222
177
  n,
223
178
  r,
224
179
  c[n]
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(
180
+ ) : ve(t) && n === "checked" ? t.checked = !!r : ye(t) && n === "value" ? t.value = r : ie(t) && n === "selected" ? t.selected = !!r : n && ([o, r] = Me(r), o && (y.value && n !== "xmlns" ? t.setAttributeNS(
226
181
  null,
227
182
  G(n),
228
183
  r
@@ -233,23 +188,23 @@ const B = () => {
233
188
  }), Y(c).forEach(
234
189
  (n) => t.removeAttribute(n)
235
190
  );
236
- }, qe = (e) => {
191
+ }, Me = (e) => {
237
192
  let t = !0;
238
193
  return typeof e == "boolean" && (e || (t = !1), e = ""), [t, String(e)];
239
194
  }, N = (e) => {
240
195
  let 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;
243
- }, _e = (e, t) => {
196
+ const { type: s, tag: c, text: n, props: r, children: o = [] } = e, l = v(s);
197
+ 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" && a(n) ? t = document.createTextNode(String(n)) : t = document.createElement("e"), Qe(o, t), ee(r, t), e.el = t, Te(e), c === "svg" && (y.value = ""), t;
198
+ }, Qe = (e, t) => {
244
199
  const s = e.reduce(
245
200
  (c, n) => (n.type && c.appendChild(N(n)), c),
246
201
  new DocumentFragment()
247
202
  );
248
203
  t && s.hasChildNodes() && t.appendChild(s);
249
- }, ze = (e, t, s, c) => {
204
+ }, Be = (e, t, s, c) => {
250
205
  const n = J(t);
251
206
  c !== s && (c && e.removeEventListener(n, c), s && e.addEventListener(n, s));
252
- }, Ge = (e, t, s) => {
207
+ }, je = (e, t, s) => {
253
208
  const c = { ...t }, n = s == null ? void 0 : s.style;
254
209
  n && (k(e).forEach(([r, o]) => {
255
210
  n[r] = o, delete c[r];
@@ -257,33 +212,40 @@ const B = () => {
257
212
  ([r]) => n[r] = ""
258
213
  ));
259
214
  }, b = (e) => {
260
- const t = P(e.type);
215
+ const t = v(e.type);
261
216
  return e.isRoot && t ? e.wrapElement : t ? b(p(e)) : e.el;
262
- }, F = (e, t) => Xe(
217
+ }, F = (e, t) => Ie(
263
218
  e,
264
- Ce[ke(e)](e, t),
219
+ ke[ae(e)](e, t),
265
220
  t
266
- ), Xe = (e, t, s) => {
267
- const c = Je(e, t, s), n = [
221
+ ), Ie = (e, t, s) => {
222
+ const c = $e(e, t, s), n = [
268
223
  c,
269
224
  t,
270
225
  s
271
- ], r = He(...n);
272
- return c.children = Ye(...n), c.needRerender = r, $e(c, s, r), c;
273
- }, $e = (e, t, s) => {
226
+ ], r = _e(...n);
227
+ return c.children = He(...n), c.needRerender = r, qe(c, s, r), c;
228
+ }, qe = (e, t, s) => {
274
229
  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;
275
- }, He = (e, t, s) => {
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);
230
+ }, _e = (e, t, s) => {
231
+ const c = s && s.type, n = H(e), o = !!e.getParent && p(e).type, l = i(e), h = o === "loop" && a(l), d = e.type === "text" && t && e.text === (s == null ? void 0 : s.text);
277
232
  let f;
278
233
  return n ? f = "D" : d ? f = "N" : c ? t ? f = h ? "SU" : "U" : f = h ? "SR" : "R" : f = "A", f;
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(
234
+ }, ze = (e, t) => {
235
+ e && t !== e && (Y(e).forEach((s) => delete e[s]), k(t || {}).forEach(([s, c]) => e[s] = c));
236
+ }, Ge = (e, t) => {
237
+ e && t !== e && (e.splice(0, e.length), t && t.forEach((s) => e.push(s)));
238
+ }, Xe = (e, t) => {
239
+ const { compProps: s, compChild: c } = e, { props: n, children: r } = t;
240
+ return s && ze(s, n), c && Ge(c, r), e.reRender && e.reRender();
241
+ }, $e = (e, t, s) => T(e) ? t && s ? Xe(s, e) : e.resolve() : e, He = (e, t, s) => t && s ? Ye(e, s) : Je(e), Je = (e) => (e.children || []).map(
280
242
  (t) => S(F(t), { getParent: () => e })
281
- ), Ve = (e, t) => e.type === "loop" && y(i((e.children || [])[0])) ? Ke(e, t) : (e.children || []).map(
243
+ ), Ye = (e, t) => e.type === "loop" && a(i((e.children || [])[0])) ? Ze(e, t) : (e.children || []).map(
282
244
  (s, c) => S(F(s, (t.children || [])[c]), {
283
245
  getParent: () => e
284
246
  })
285
- ), Ke = (e, t) => {
286
- const [s, c] = ge(
247
+ ), Ze = (e, t) => {
248
+ const [s, c] = Ve(
287
249
  e,
288
250
  t
289
251
  );
@@ -291,19 +253,54 @@ const B = () => {
291
253
  const r = n.el;
292
254
  r != null && r.parentNode && r.parentNode.removeChild(r);
293
255
  }), s;
294
- }, ge = (e, t) => {
256
+ }, Ve = (e, t) => {
295
257
  const s = [...e.children || []], c = [...t.children || []];
296
258
  return [s.map((r) => {
297
- const o = me(r, c), l = F(r, o);
259
+ const o = Ke(r, c), l = F(r, o);
298
260
  return o && c.splice(c.indexOf(o), 1), l.getParent = () => e, l;
299
261
  }), c];
300
- }, me = (e, t) => t.find(
262
+ }, Ke = (e, t) => t.find(
301
263
  (s) => i(s) === i(e)
302
- ), rt = (e, t = () => []) => {
303
- u.get(R()).upR.push(() => X(e, t)), X(e, t);
264
+ );
265
+ let P = [], M = !1;
266
+ const te = (e, t) => {
267
+ u.get(e).up = () => {
268
+ P.push({
269
+ compKey: e,
270
+ exec: t
271
+ }), M || (M = !0, queueMicrotask(me));
272
+ };
273
+ }, ge = (e) => () => {
274
+ var c;
275
+ const t = (c = u.get(e)) == null ? void 0 : c.up;
276
+ let s = !1;
277
+ return t && (t(), s = !0), s;
278
+ }, se = (e, t) => {
279
+ (e.children || []).forEach((s) => {
280
+ const c = s.compKey;
281
+ c && t.push(c), se(s, t);
282
+ });
283
+ }, me = () => {
284
+ let e = [];
285
+ P.forEach((c) => {
286
+ var r, o;
287
+ const n = (o = (r = u.get(c.compKey)) == null ? void 0 : r.vd) == null ? void 0 : o.value;
288
+ n && se(n, e);
289
+ });
290
+ const t = [], s = P.reduce((c, n) => {
291
+ const { compKey: r } = n;
292
+ return e.includes(r) || t.includes(r) || (t.push(r), c.push(n)), c;
293
+ }, []);
294
+ for (; s.length; ) {
295
+ const c = s.shift();
296
+ c && c.exec();
297
+ }
298
+ P = [], M = !1;
299
+ }, rt = (e, t = () => []) => {
300
+ u.get(E()).upR.push(() => X(e, t)), X(e, t);
304
301
  }, we = () => {
305
302
  var t;
306
- const e = (t = u.get(R())) == null ? void 0 : t.upR;
303
+ const e = (t = u.get(E())) == null ? void 0 : t.upR;
307
304
  e != null && e.length && e.forEach((s) => s());
308
305
  }, ce = (e, ...t) => ({
309
306
  type: "fragment",
@@ -313,24 +310,24 @@ const B = () => {
313
310
  return T(o) || (c.value = o), o;
314
311
  }, ut = (e) => (t, s) => e, ne = (e, t, s, c) => {
315
312
  var f;
316
- O.value = !0;
313
+ A.value = !0;
317
314
  const n = re(e, t, s), r = F(n, c), { isRoot: o, getParent: l, wrapElement: h, afterElement: d } = c;
318
315
  if (r.getParent = l, !o && l) {
319
316
  const _ = ((f = l()) == null ? void 0 : f.children) || [], le = _.indexOf(c);
320
317
  _.splice(le, 1, r);
321
318
  } else
322
319
  r.isRoot = !0, r.wrapElement = h, r.afterElement = d;
323
- O.value = !1, m(r);
320
+ A.value = !1, K(r);
324
321
  }, 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(
322
+ Ee(o);
323
+ const h = e(t, s)(ge(o), t, s), d = We(
327
324
  h,
328
325
  o,
329
326
  e,
330
327
  t,
331
328
  s
332
329
  ), f = d;
333
- return V(
330
+ return te(
334
331
  o,
335
332
  () => ne(e, t, s, f)
336
333
  ), Z(o, "vd").value = d, d;
@@ -352,9 +349,9 @@ const B = () => {
352
349
  const r = () => et(e, t, s, c, n, r);
353
350
  return r;
354
351
  }, et = (e, t, s, c, n, r) => {
355
- Te(t), we();
352
+ Re(t), we();
356
353
  const o = e(c);
357
- return V(
354
+ return te(
358
355
  t,
359
356
  () => ne(s, c, n, o)
360
357
  ), oe(o, t, s, c, n, r), Z(t, "vd").value = o, o;
@@ -372,7 +369,7 @@ const B = () => {
372
369
  return ce(t, ...s);
373
370
  if (T(e)) {
374
371
  const c = re(e, t, s);
375
- return O.value ? c : c.resolve();
372
+ return A.value ? c : c.resolve();
376
373
  }
377
374
  return {
378
375
  type: "element",