lithent 1.18.4 → 1.18.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
@@ -90,14 +90,14 @@ pnpm add lithent
90
90
 
91
91
  #### Or Use CDN
92
92
 
93
- * UMD : https://cdn.jsdelivr.net/npm/lithent@1.18.4/dist/lithent.umd.js
94
- * UMD-HELPER: https://cdn.jsdelivr.net/npm/lithent@1.18.4/helper/dist/lithentHelper.umd.js
95
- * UMD-FTAGS: https://cdn.jsdelivr.net/npm/lithent@1.18.4/ftags/dist/lithentFTags.umd.js
96
- * UMD-TAG: https://cdn.jsdelivr.net/npm/lithent@1.18.4/tag/dist/lithentTag.umd.js
97
- * ESM : https://cdn.jsdelivr.net/npm/lithent@1.18.4/dist/lithent.mjs
98
- * ESM-HELPER: https://cdn.jsdelivr.net/npm/lithent@1.18.4/helper/dist/lithentHelper.mjs
99
- * ESM-FTAGS: https://cdn.jsdelivr.net/npm/lithent@1.18.4/ftags/dist/lithentFTags.mjs
100
- * ESM-TAG: https://cdn.jsdelivr.net/npm/lithent@1.18.4/tag/dist/lithentTag.mjs
93
+ * UMD : https://cdn.jsdelivr.net/npm/lithent@1.18.5/dist/lithent.umd.js
94
+ * UMD-HELPER: https://cdn.jsdelivr.net/npm/lithent@1.18.5/helper/dist/lithentHelper.umd.js
95
+ * UMD-FTAGS: https://cdn.jsdelivr.net/npm/lithent@1.18.5/ftags/dist/lithentFTags.umd.js
96
+ * UMD-TAG: https://cdn.jsdelivr.net/npm/lithent@1.18.5/tag/dist/lithentTag.umd.js
97
+ * ESM : https://cdn.jsdelivr.net/npm/lithent@1.18.5/dist/lithent.mjs
98
+ * ESM-HELPER: https://cdn.jsdelivr.net/npm/lithent@1.18.5/helper/dist/lithentHelper.mjs
99
+ * ESM-FTAGS: https://cdn.jsdelivr.net/npm/lithent@1.18.5/ftags/dist/lithentFTags.mjs
100
+ * ESM-TAG: https://cdn.jsdelivr.net/npm/lithent@1.18.5/tag/dist/lithentTag.mjs
101
101
 
102
102
 
103
103
  It's easier to use lithent with JSX or HTM.
@@ -122,9 +122,9 @@ import { fTags, fFragment, fMount } from 'lithent/ftags';
122
122
  const { section, div, p, br, strong } = fTags;
123
123
 
124
124
  /* UMD
125
- <script src="https://cdn.jsdelivr.net/npm/lithent@1.18.4/dist/lithent.umd.js"></script>
126
- <script src="https://cdn.jsdelivr.net/npm/lithent@1.18.4/helper/dist/lithentHelper.umd.js"></script>
127
- <script src="https://cdn.jsdelivr.net/npm/lithent@1.18.4/ftags/dist/lithentFTags.umd.js"></script>
125
+ <script src="https://cdn.jsdelivr.net/npm/lithent@1.18.5/dist/lithent.umd.js"></script>
126
+ <script src="https://cdn.jsdelivr.net/npm/lithent@1.18.5/helper/dist/lithentHelper.umd.js"></script>
127
+ <script src="https://cdn.jsdelivr.net/npm/lithent@1.18.5/ftags/dist/lithentFTags.umd.js"></script>
128
128
 
129
129
  const { render } = lithent;
130
130
  const { fTags, fMount, fFragment } = lithentFTags;
@@ -197,10 +197,10 @@ const destroy = render(lTag`<${Component} />`, document.getElementById('root'),
197
197
  #### With UMD
198
198
 
199
199
  ```html
200
- <script src="https://cdn.jsdelivr.net/npm/lithent@1.18.4/dist/lithent.umd.js"></script>
201
- <!--script src="https://cdn.jsdelivr.net/npm/lithent@1.18.4/helper/dist/lithentHelper.umd.js"></script-->
202
- <script src="https://cdn.jsdelivr.net/npm/lithent@1.18.4/tag/dist/lithentTag.umd.js"></script>
203
- <!--script src="https://cdn.jsdelivr.net/npm/lithent@1.18.4/ftags/dist/lithentFTags.umd.js"></script-->
200
+ <script src="https://cdn.jsdelivr.net/npm/lithent@1.18.5/dist/lithent.umd.js"></script>
201
+ <!--script src="https://cdn.jsdelivr.net/npm/lithent@1.18.5/helper/dist/lithentHelper.umd.js"></script-->
202
+ <script src="https://cdn.jsdelivr.net/npm/lithent@1.18.5/tag/dist/lithentTag.umd.js"></script>
203
+ <!--script src="https://cdn.jsdelivr.net/npm/lithent@1.18.5/ftags/dist/lithentFTags.umd.js"></script-->
204
204
 
205
205
  <div id="root"></div>
206
206
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { h, Fragment, portal, mount } from './wDom';
1
+ export { h, Fragment, portal, mount, replaceWDom } from './wDom';
2
2
  export { isPropType } from './utils';
3
3
  export { componentUpdate } from './utils/redraw';
4
4
  export { componentMap } from './utils/universalRef';
package/dist/lithent.mjs CHANGED
@@ -1,32 +1,32 @@
1
- const R = (e) => typeof e == "object" && !("resolve" in e), N = (e, t) => R(e) && e.type === t, de = (e, t) => "ctor" in e ? e.ctor === (t == null ? void 0 : t.ctor) : e === (t == null ? void 0 : t.ctor), he = (e, t) => {
1
+ const k = (e) => typeof e == "object" && !("resolve" in e), N = (e, t) => k(e) && e.type === t, de = (e, t) => "ctor" in e ? e.ctor === (t == null ? void 0 : t.ctor) : e === (t == null ? void 0 : t.ctor), he = (e, t) => {
2
2
  var s, c;
3
- return R(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 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);
4
4
  }, ie = (e, t) => {
5
5
  var s, c;
6
- return R(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
- }, X = (e, t) => R(e) && (t == null ? void 0 : t.type) === e.type, ye = (e, t) => {
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);
7
+ }, X = (e, t) => k(e) && (t == null ? void 0 : t.type) === e.type, ye = (e, t) => {
8
8
  var s, c;
9
- return R(e) && (t == null ? void 0 : t.type) === e.type && (E(o((e.children || [])[0])) && E(o(((t == null ? void 0 : t.children) || [])[0])) || ((s = t == null ? void 0 : t.children) == null ? void 0 : s.length) === ((c = e == null ? void 0 : e.children) == null ? void 0 : c.length));
9
+ return k(e) && (t == null ? void 0 : t.type) === e.type && (E(o((e.children || [])[0])) && E(o(((t == null ? void 0 : t.children) || [])[0])) || ((s = t == null ? void 0 : t.children) == null ? void 0 : s.length) === ((c = e == null ? void 0 : e.children) == null ? void 0 : c.length));
10
10
  }, o = (e) => {
11
11
  var t, s;
12
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
- }, v = (e) => e && ["fragment", "loop"].includes(e), T = (e) => typeof e == "function" && !g(e) || typeof e == "object" && "resolve" in e, g = (e) => typeof e == "function" && e === J, m = (e) => R(e) && !e.type, E = (e) => e != null, Y = (e, t) => e === "style" && typeof t == "object", Ce = (e, t) => e === "ref" && typeof t == "object", ve = (e, t) => {
13
+ }, C = (e) => e && ["fragment", "loop"].includes(e), T = (e) => typeof e == "function" && !g(e) || typeof e == "object" && "resolve" in e, g = (e) => typeof e == "function" && e === J, m = (e) => k(e) && !e.type, E = (e) => e != null, Y = (e, t) => e === "style" && typeof t == "object", ve = (e, t) => e === "ref" && typeof t == "object", Ce = (e, t) => {
14
14
  const s = Object.getOwnPropertyDescriptor(
15
15
  e.constructor.prototype,
16
16
  t
17
17
  );
18
18
  return s && s.get && s.set;
19
- }, Re = (e) => {
19
+ }, ke = (e) => {
20
20
  let t = "et";
21
21
  return T(e) ? t = "c" : N(e, "fragment") ? t = "f" : N(e, "element") ? t = "e" : N(e, "loop") ? t = "l" : N(e, "text") ? t = "t" : m(e) && (t = "et"), t;
22
- }, ke = {
22
+ }, Re = {
23
23
  c: de,
24
24
  l: ye,
25
25
  t: X,
26
26
  e: ie,
27
27
  f: he,
28
28
  et: X
29
- }, C = Symbol.for("lithentWDomSymbol"), k = { value: "" }, S = { value: {} }, O = { value: !1 }, f = /* @__PURE__ */ new WeakMap(), Ee = (e) => {
29
+ }, v = Symbol.for("lithentWDomSymbol"), R = { value: "" }, S = { value: {} }, O = { value: !1 }, f = /* @__PURE__ */ new WeakMap(), Ee = (e) => {
30
30
  f.set(e, {
31
31
  vd: { value: null },
32
32
  up: () => {
@@ -40,7 +40,7 @@ const R = (e) => typeof e == "object" && !("resolve" in e), N = (e, t) => R(e) &
40
40
  });
41
41
  }, a = () => S.value, Z = (e, t) => f.get(e) ? f.get(e)[t] : null, Pe = (e) => S.value = e, Se = (e) => {
42
42
  S.value = e, Ee(e);
43
- }, y = (e) => e.getParent && e.getParent(), P = Object.entries, w = Object.keys, b = Object.assign, lt = (e) => typeof e == "object" && !Array.isArray(e) && !Object.getOwnPropertySymbols(e).includes(C), ae = (e) => {
43
+ }, y = (e) => e.getParent && e.getParent(), P = Object.entries, w = Object.keys, b = Object.assign, lt = (e) => typeof e == "object" && !Array.isArray(e) && !Object.getOwnPropertySymbols(e).includes(v), ae = (e) => {
44
44
  f.get(a()).umts.push(e);
45
45
  }, U = (e) => {
46
46
  const { compKey: t } = e;
@@ -136,20 +136,20 @@ const I = () => {
136
136
  const c = M(s), n = s.type === "loop" && s.needRerender && s.needRerender !== "CNSU" ? j(s, y(s)) : j(e, s);
137
137
  t && c && (e.tag !== "portal" && (n ? c.insertBefore(t, n) : c.appendChild(t)), I());
138
138
  }
139
- }, ne = (e) => v(e.type) ? ((e == null ? void 0 : e.children) || []).reduce((t, s) => {
139
+ }, ne = (e) => C(e.type) ? ((e == null ? void 0 : e.children) || []).reduce((t, s) => {
140
140
  const c = ne(s);
141
141
  return c && t.appendChild(c), t;
142
142
  }, z()) : e.el, j = (e, t) => {
143
143
  const s = t.children || [], r = s.indexOf(e) + 1, n = s.slice(r), u = re(n), l = t.type || "";
144
144
  if (u)
145
145
  return u;
146
- if (!t.isRoot && v(l))
146
+ if (!t.isRoot && C(l))
147
147
  return j(t, y(t));
148
- if (t.isRoot && v(l) && t.afterElement)
148
+ if (t.isRoot && C(l) && t.afterElement)
149
149
  return t.afterElement;
150
150
  }, re = (e) => e.reduce(
151
151
  (t, s) => {
152
- const c = s.type, r = s.el, n = c && v(c);
152
+ const c = s.type, r = s.el, n = c && C(c);
153
153
  return t || (n ? re(s.children || []) : r && r.nodeType !== 11 ? r : t);
154
154
  },
155
155
  void 0
@@ -196,12 +196,12 @@ const I = () => {
196
196
  u,
197
197
  Y(n, r.style) ? r.style : {},
198
198
  t
199
- ) : Ce(n, u) ? u.value = t : n.match(/^on/) ? K(
199
+ ) : ve(n, u) ? u.value = t : n.match(/^on/) ? K(
200
200
  t,
201
201
  n,
202
202
  u,
203
203
  r[n]
204
- ) : n && (n !== "type" && ve(t, n) ? t[n] = u : Qe(
204
+ ) : n && (n !== "type" && Ce(t, n) ? t[n] = u : Qe(
205
205
  Fe(n),
206
206
  t,
207
207
  u
@@ -210,11 +210,11 @@ const I = () => {
210
210
  (n) => t.removeAttribute(n)
211
211
  );
212
212
  }, Qe = (e, t, s) => {
213
- k.value && e !== "xmlns" ? t.setAttributeNS(null, e, s) : t.setAttribute(e, s);
213
+ R.value && e !== "xmlns" ? t.setAttributeNS(null, e, s) : t.setAttribute(e, s);
214
214
  }, L = (e, t) => {
215
215
  let s;
216
- const { type: c, tag: r, text: n, props: u, children: l = [] } = e, h = v(c);
217
- return r === "svg" && (k.value = String(u == null ? void 0 : u.xmlns)), t ? s = e.el : (h ? s = z() : c === "element" && r ? r === "portal" && (u != null && u.portal) ? s = u.portal : s = k.value ? document.createElementNS(k.value, r) : V(r) : c === "text" && E(n) ? s = document.createTextNode(String(n)) : s = V("e"), e.el = s), je(l, s, t), le(u, s, null, t), Ne(e), r === "svg" && (k.value = ""), s;
216
+ const { type: c, tag: r, text: n, props: u, children: l = [] } = e, h = C(c);
217
+ return r === "svg" && (R.value = String(u == null ? void 0 : u.xmlns)), t ? s = e.el : (h ? s = z() : c === "element" && r ? r === "portal" && (u != null && u.portal) ? s = u.portal : s = R.value ? document.createElementNS(R.value, r) : V(r) : c === "text" && E(n) ? s = document.createTextNode(String(n)) : s = V("e"), e.el = s), je(l, s, t), le(u, s, null, t), Ne(e), r === "svg" && (R.value = ""), s;
218
218
  }, je = (e, t, s) => {
219
219
  const c = e.reduce(
220
220
  (r, n) => {
@@ -238,11 +238,11 @@ const I = () => {
238
238
  ([n]) => r[n] = ""
239
239
  ));
240
240
  }, M = (e) => {
241
- const t = v(e.type);
241
+ const t = C(e.type);
242
242
  return e.isRoot && t ? e.wrapElement : t ? M(y(e)) : e.el;
243
243
  }, A = (e, t) => qe(
244
244
  e,
245
- ke[Re(e)](e, t),
245
+ Re[ke(e)](e, t),
246
246
  t
247
247
  ), qe = (e, t, s) => {
248
248
  const c = Xe(e, t, s), r = [
@@ -319,7 +319,7 @@ const me = (e, t) => {
319
319
  e != null && e.length && e.forEach((s) => s());
320
320
  }, J = (e, ...t) => ({
321
321
  type: "fragment",
322
- [C]: !0,
322
+ [v]: !0,
323
323
  children: t
324
324
  }), et = (e, t, ...s) => {
325
325
  const c = { value: void 0 }, r = t || {}, n = pe(c, s), u = rt(e, r, n);
@@ -375,10 +375,7 @@ const me = (e, t) => {
375
375
  tagName: s.name,
376
376
  compKey: t,
377
377
  reRender: n
378
- }), me(
379
- t,
380
- () => tt(s, c, r, e)
381
- ), Z(t, "vd") && (Z(t, "vd").value = e);
378
+ }), me(t, () => tt(s, c, r, e)), Z(t, "vd") && (Z(t, "vd").value = e);
382
379
  }, rt = (e, t, s) => {
383
380
  if (g(e))
384
381
  return J(t, ...s);
@@ -388,7 +385,7 @@ const me = (e, t) => {
388
385
  }
389
386
  return {
390
387
  type: "element",
391
- [C]: !0,
388
+ [v]: !0,
392
389
  tag: e,
393
390
  props: t,
394
391
  children: s
@@ -397,16 +394,16 @@ const me = (e, t) => {
397
394
  (s) => b(ut(s), { getParent: () => e.value })
398
395
  ), ut = (e) => {
399
396
  if (e == null || e === !1)
400
- return { type: null, [C]: !0 };
397
+ return { type: null, [v]: !0 };
401
398
  if (Array.isArray(e)) {
402
399
  const t = { value: void 0 }, s = pe(t, e), c = {
403
400
  type: "loop",
404
- [C]: !0,
401
+ [v]: !0,
405
402
  children: s
406
403
  };
407
404
  return t.value = c, c;
408
405
  } else if (typeof e == "string" || typeof e == "number")
409
- return { type: "text", [C]: !0, text: e };
406
+ return { type: "text", [v]: !0, text: e };
410
407
  return e;
411
408
  }, it = (e) => ({ value: e }), yt = () => Promise.resolve();
412
409
  export {
@@ -421,6 +418,7 @@ export {
421
418
  dt as portal,
422
419
  it as ref,
423
420
  ot as render,
421
+ tt as replaceWDom,
424
422
  pt as updateCallback
425
423
  };
426
424
  //# sourceMappingURL=lithent.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"lithent.mjs","sources":["../src/utils/predicator.ts","../src/utils/universalRef.ts","../src/utils/index.ts","../src/hook/unmount.ts","../src/hook/mountCallback.ts","../src/hook/useUpdate.ts","../src/render.ts","../src/diff.ts","../src/utils/redraw.ts","../src/hook/updateCallback.ts","../src/wDom.ts","../src/hook/ref.ts"],"sourcesContent":["import { Fragment } from '@/wDom';\nimport {\n WDom,\n TagFunction,\n TagFunctionResolver,\n FragmentFunction,\n WDomType,\n} from '@/types';\n\ntype WDomParam =\n | string\n | WDom\n | TagFunction\n | TagFunctionResolver\n | FragmentFunction;\n\n/**\n * Predicator\n */\n\nconst checkPlainWDomType = (wDom: WDomParam): wDom is WDom =>\n typeof wDom === 'object' && !('resolve' in wDom);\n\nconst checkPlainType = (wDom: WDomParam, typeName: string) =>\n checkPlainWDomType(wDom) && wDom.type === typeName;\n\nconst checkSameCustomComponent = (\n newWDom: WDom | TagFunction | TagFunctionResolver,\n originalWDom?: WDom\n) =>\n 'ctor' in newWDom\n ? newWDom.ctor === originalWDom?.ctor\n : newWDom === originalWDom?.ctor;\n\nconst checkSameFragment = (\n newWDom: WDom | TagFunction | TagFunctionResolver,\n originalWDom?: WDom\n) =>\n checkPlainWDomType(newWDom) &&\n originalWDom?.type === 'fragment' &&\n originalWDom?.children?.length === newWDom?.children?.length;\n\nconst checkSameTagElement = (\n newWDom: WDom | TagFunction | TagFunctionResolver,\n originalWDom?: WDom\n) =>\n checkPlainWDomType(newWDom) &&\n originalWDom?.type === 'element' &&\n originalWDom?.tag === newWDom.tag &&\n originalWDom?.children?.length === newWDom?.children?.length;\n\nconst checkNormalTypeElement = (\n newWDom: WDom | TagFunction | TagFunctionResolver,\n originalWDom?: WDom\n) => checkPlainWDomType(newWDom) && originalWDom?.type === newWDom.type;\n\nconst checkLoopTypeElement = (\n newWDom: WDom | TagFunction | TagFunctionResolver,\n originalWDom?: WDom\n) =>\n checkPlainWDomType(newWDom) &&\n originalWDom?.type === newWDom.type &&\n ((checkExisty(getKey((newWDom.children || [])[0])) &&\n checkExisty(getKey((originalWDom?.children || [])[0]))) ||\n originalWDom?.children?.length === newWDom?.children?.length);\n\nexport const getKey = (target: WDom) =>\n target?.compProps?.key ?? target?.props?.key;\n\nexport const checkVirtualType = (type?: string | null) =>\n type && ['fragment', 'loop'].includes(type);\n\nexport const checkCustemComponentFunction = (\n target: WDomParam\n): target is TagFunction | TagFunctionResolver =>\n (typeof target === 'function' && !checkFragmentFunction(target)) ||\n (typeof target === 'object' && 'resolve' in target);\n\nexport const checkFragmentFunction = (\n target: unknown\n): target is FragmentFunction =>\n typeof target === 'function' && target === Fragment;\n\nexport const checkEmptyElement = (wDom: WDomParam) =>\n checkPlainWDomType(wDom) && !wDom.type;\n\nexport const checkExisty = (value: unknown) =>\n value !== null && value !== undefined;\n\nexport const checkStyleData = (\n dataKey: string,\n dataValue: unknown\n): dataValue is Record<string, string> =>\n dataKey === 'style' && typeof dataValue === 'object';\n\nexport const checkRefData = (\n dataKey: string,\n dataValue: unknown\n): dataValue is {\n value: HTMLElement | Element | DocumentFragment | Text | undefined;\n} => dataKey === 'ref' && typeof dataValue === 'object';\n\nexport const hasAccessorMethods = (target: unknown, dataKey: string) => {\n const descriptor = Object.getOwnPropertyDescriptor(\n target!.constructor.prototype,\n dataKey\n );\n\n return descriptor && descriptor.get && descriptor.set;\n};\n\nexport const getWDomType = (\n wDom: WDom | TagFunction | TagFunctionResolver\n): WDomType => {\n let result: WDomType = 'et';\n\n if (checkCustemComponentFunction(wDom)) {\n result = 'c';\n } else if (checkPlainType(wDom, 'fragment')) {\n result = 'f';\n } else if (checkPlainType(wDom, 'element')) {\n result = 'e';\n } else if (checkPlainType(wDom, 'loop')) {\n result = 'l';\n } else if (checkPlainType(wDom, 'text')) {\n result = 't';\n } else if (checkEmptyElement(wDom)) {\n result = 'et';\n }\n\n return result;\n};\n\nexport const checkSameWDomWithOriginal = {\n c: checkSameCustomComponent,\n l: checkLoopTypeElement,\n t: checkNormalTypeElement,\n e: checkSameTagElement,\n f: checkSameFragment,\n et: checkNormalTypeElement,\n};\n","import { ComponentMap, ComponentSubKey, Props } from '@/types';\n\nexport const wdomSymbol = Symbol.for('lithentWDomSymbol');\nexport const xmlnsRef: { value: string } = { value: '' };\nexport const compKeyRef: { value: Props } = { value: {} };\nexport const needDiffRef: { value: boolean } = { value: false };\nexport const componentMap: ComponentMap = new WeakMap();\n\nconst setComponetRef = (compKey: Props) => {\n componentMap.set(compKey, {\n vd: { value: null },\n up: () => {},\n upR: [],\n upS: { value: 0 },\n upD: [],\n upCB: [],\n mts: [],\n umts: [],\n });\n};\n\nexport const getComponentKey = () => compKeyRef.value;\n\nexport const getComponentSubInfo = (\n compKey: Props,\n subKey: ComponentSubKey\n) => {\n if (componentMap.get(compKey)) {\n return componentMap.get(compKey)![subKey];\n }\n return null;\n};\n\nexport const initUpdateHookState = (compKey: Props) =>\n (compKeyRef.value = compKey);\n\nexport const initMountHookState = (compKey: Props) => {\n compKeyRef.value = compKey;\n setComponetRef(compKey);\n};\n","import { WDom, Props } from '@/types';\n\nimport { wdomSymbol } from '@/utils/universalRef';\n\nexport const getParent = (vDom: WDom) =>\n (vDom.getParent && vDom.getParent()) as WDom;\n\nexport const entries = Object.entries;\nexport const keys = Object.keys;\nexport const assign = Object.assign;\nexport const isPropType = (obj: unknown): obj is Props => {\n return (\n typeof obj === 'object' &&\n !Array.isArray(obj) &&\n !Object.getOwnPropertySymbols(obj).includes(wdomSymbol)\n );\n};\n","import { WDom, Props } from '@/types';\nimport { componentMap, getComponentKey } from '@/utils/universalRef';\n\nexport const unmount = (effectAction: () => void) => {\n componentMap.get(getComponentKey())!.umts.push(effectAction);\n};\n\nexport const runUnmountQueueFromWDom = (newWDom: WDom) => {\n const { compKey } = newWDom;\n\n if (compKey) {\n removeItem(compKey);\n }\n recursiveRunUnmount(newWDom);\n};\n\nconst recursiveRunUnmount = (wDom: WDom) => {\n (wDom.children || []).forEach(item => {\n const childComKey = item.compKey;\n if (childComKey) {\n runUnmountQueueFromWDom(item);\n } else {\n recursiveRunUnmount(item);\n }\n });\n};\n\nconst removeItem = (compKey: Props) => {\n const subInfo = componentMap.get(compKey);\n if (subInfo) {\n subInfo!.umts.forEach(effect => effect());\n subInfo!.umts = [];\n componentMap.delete(compKey);\n }\n};\n","import { WDom } from '@/types';\nimport {\n compKeyRef,\n componentMap,\n getComponentKey,\n} from '@/utils/universalRef';\nimport { unmount } from '@/hook/unmount';\n\nlet mountedQueue: WDom[] = [];\n\nexport const execMountedQueue = () => {\n mountedQueue.forEach(item => runMountedQueueFromWDom(item));\n mountedQueue = [];\n};\nexport const addMountedQueue = (wDom: WDom) => {\n if (wDom.compKey) {\n mountedQueue.push(wDom);\n }\n};\nexport const mountCallback = (effectAction: () => void) =>\n (componentMap.get(getComponentKey())?.mts || []).push(effectAction);\n\nexport const runMountedQueueFromWDom = (newWDom: WDom) => {\n const { compKey } = newWDom;\n\n if (compKey) {\n const component = componentMap.get(compKey);\n const queue = component?.mts;\n const sequence = component?.upS;\n\n compKeyRef.value = compKey;\n\n if (sequence) {\n sequence.value = 0;\n }\n\n if (queue) {\n component.mts = [];\n\n queue.forEach((effect: Function) => {\n const callback = effect();\n if (callback) {\n unmount(callback);\n }\n });\n }\n }\n};\n","import { WDom } from '@/types';\nimport {\n compKeyRef,\n componentMap,\n getComponentKey,\n} from '@/utils/universalRef';\n\nexport const useUpdated = (\n effectAction: () => (() => void) | void,\n dependencies: () => any[] = () => []\n) => {\n const component = componentMap.get(getComponentKey());\n const { upD, upS } = component!;\n const def = upD[upS.value];\n\n if (def && checkNeedPushQueue(def, dependencies())) {\n const callback = effectAction();\n if (callback) {\n component!.upCB.push(callback);\n }\n }\n\n upD[upS.value] = dependencies();\n upS.value += 1;\n};\n\nexport const runUpdatedQueueFromWDom = (newWDom: WDom) => {\n const { compKey } = newWDom;\n\n if (compKey) {\n const component = componentMap.get(compKey);\n const queue = component?.upCB;\n const sequence = component?.upS;\n\n compKeyRef.value = compKey;\n\n if (sequence) {\n sequence.value = 0;\n }\n\n if (newWDom.ctor && queue) {\n component.upCB = [];\n queue.forEach((effect: Function) => effect());\n }\n }\n};\n\nconst checkNeedPushQueue = (originalDefs: unknown[], newDefs: unknown[]) =>\n !originalDefs.length\n ? true\n : originalDefs.some((def, index) => def !== newDefs[index]);\n","import { WDom, Props } from '@/types';\nimport {\n checkStyleData,\n checkRefData,\n checkExisty,\n checkVirtualType,\n hasAccessorMethods,\n} from '@/utils/predicator';\n\nimport { componentMap, xmlnsRef } from '@/utils/universalRef';\nimport { runUnmountQueueFromWDom } from '@/hook/unmount';\nimport { execMountedQueue, addMountedQueue } from '@/hook/mountCallback';\nimport { runUpdatedQueueFromWDom } from '@/hook/useUpdate';\nimport { getParent, entries, keys } from '@/utils';\n\nconst getAttrKey = (keyName: string) =>\n keyName === 'className' ? 'class' : keyName;\n\nconst getEventName = (eventKey: string) =>\n eventKey.replace(/^on(.*)/, (_match, p1) => p1.toLowerCase());\n\nconst DF = () => new DocumentFragment();\nconst CE = (t: string) => document.createElement(t);\n\nexport const render = (\n wDom: WDom,\n wrapElement: HTMLElement | null,\n afterElement?: HTMLElement | null,\n isHydration?: boolean\n) => {\n wDom.isRoot = true;\n wrapElement ??= document.body;\n wDom.wrapElement = wrapElement;\n\n const Dom = wDomToDom(wDom, isHydration);\n\n if (afterElement) {\n wDom.afterElement = afterElement;\n wrapElement.insertBefore(Dom, afterElement);\n } else if (!isHydration) {\n if (wrapElement.tagName === 'HTML') {\n wrapElement.replaceWith(Dom);\n } else {\n wrapElement.appendChild(Dom);\n }\n }\n\n execMountedQueue();\n\n return () => {\n const component = componentMap.get(wDom.compProps || {})?.vd.value;\n\n if (component) {\n runUnmountQueueFromWDom(component);\n }\n\n recursiveRemoveEvent(component || wDom);\n rootDelete(component || wDom);\n };\n};\n\nexport const wDomUpdate = (newWDomTree: WDom) => {\n const { needRerender } = newWDomTree;\n\n if (needRerender && needRerender !== 'N') {\n ({\n A: typeAdd,\n D: typeDelete,\n R: typeReplace,\n U: typeUpdate,\n CNSU: typeUpdate,\n SR: typeSortedReplace,\n SU: typeSortedUpdate,\n })[needRerender](newWDomTree);\n\n delete newWDomTree.needRerender;\n delete newWDomTree.oldChildren;\n delete newWDomTree.oldProps;\n }\n};\n\nexport const recursiveRemoveEvent = (originalWDom: WDom) => {\n if (originalWDom.props && originalWDom.el) {\n removeEvent(originalWDom.props, originalWDom.el);\n }\n\n (originalWDom.children || []).forEach((childItem: WDom) => {\n recursiveRemoveEvent(childItem);\n });\n};\n\nconst rootDelete = (newWDom: WDom) => {\n deleteRealDom(newWDom, newWDom.wrapElement as HTMLElement);\n};\n\nexport const typeDelete = (newWDom: WDom) => {\n if (newWDom.oldProps && newWDom.el) {\n removeEvent(newWDom.oldProps, newWDom.el);\n }\n\n deleteRealDom(\n newWDom,\n findRealParentElement(getParent(newWDom)) as HTMLElement\n );\n};\n\nconst deleteRealDom = (newWDom: WDom, parent: HTMLElement) => {\n if (parent && newWDom.el) {\n if ([1, 3].includes(newWDom.el?.nodeType)) {\n parent.removeChild(newWDom.el);\n } else if (newWDom.el?.nodeType === 11) {\n findChildWithRemoveElement(newWDom, parent as HTMLElement);\n }\n delete newWDom.el;\n }\n};\n\nconst findChildWithRemoveElement = (newWDom: WDom, parent: HTMLElement) => {\n (newWDom?.oldChildren || newWDom?.children || []).forEach(item => {\n const nodeType = item.el?.nodeType;\n if (nodeType) {\n if ([1, 3].includes(nodeType)) {\n if ((item.el as HTMLElement).tagName === 'HTML') {\n (item.el as HTMLElement).innerHTML = '';\n } else {\n (item.el as HTMLElement).remove();\n }\n } else if (nodeType === 11) {\n findChildWithRemoveElement(item, parent);\n }\n }\n });\n};\n\nconst typeSortedReplace = (newWDom: WDom) => {\n typeDelete(newWDom);\n typeAdd(newWDom);\n};\n\nconst typeSortedUpdate = (newWDom: WDom) => {\n typeUpdate(newWDom);\n\n const parentWDom = getParent(newWDom);\n if (parentWDom.needRerender !== 'CNSU') {\n const newElement = getElementFromFragment(newWDom);\n\n typeAdd(newWDom, newElement);\n }\n};\n\nconst typeAdd = (\n newWDom: WDom,\n newElement?: HTMLElement | DocumentFragment | Text\n) => {\n if (!newElement) {\n newElement = wDomToDom(newWDom) as HTMLElement;\n }\n\n const parentWDom = getParent(newWDom);\n if (parentWDom.type) {\n const parentEl = findRealParentElement(parentWDom);\n const isLoop = parentWDom.type === 'loop';\n const nextEl =\n isLoop && parentWDom.needRerender && parentWDom.needRerender !== 'CNSU'\n ? startFindNextBrotherElement(parentWDom, getParent(parentWDom))\n : startFindNextBrotherElement(newWDom, parentWDom);\n\n if (newElement && parentEl) {\n if (newWDom.tag !== 'portal') {\n if (nextEl) {\n parentEl.insertBefore(newElement, nextEl);\n } else {\n parentEl.appendChild(newElement);\n }\n }\n\n execMountedQueue();\n }\n }\n};\n\nconst getElementFromFragment = (newWDom: WDom) => {\n if (checkVirtualType(newWDom.type)) {\n return (newWDom?.children || []).reduce((acc, item) => {\n const element = getElementFromFragment(item);\n\n if (element) {\n acc.appendChild(element);\n }\n return acc;\n }, DF());\n }\n\n return newWDom.el;\n};\n\nconst startFindNextBrotherElement = (\n wDom: WDom,\n parentWDom: WDom\n): HTMLElement | DocumentFragment | Text | undefined => {\n const brothers = parentWDom.children || [];\n const index = brothers.indexOf(wDom);\n const nextIndex = index + 1;\n const candidiateBrothers = brothers.slice(nextIndex);\n\n const finedNextEl = findChildFragmentNextElement(candidiateBrothers);\n const parentType = parentWDom.type || '';\n\n if (finedNextEl) {\n return finedNextEl;\n }\n\n if (!parentWDom.isRoot && checkVirtualType(parentType)) {\n return startFindNextBrotherElement(parentWDom, getParent(parentWDom));\n } else if (\n parentWDom.isRoot &&\n checkVirtualType(parentType) &&\n parentWDom.afterElement\n ) {\n return parentWDom.afterElement;\n }\n\n return undefined;\n};\n\nconst findChildFragmentNextElement = (\n candidiateBrothers: WDom[]\n): HTMLElement | DocumentFragment | Text | undefined =>\n candidiateBrothers.reduce(\n (\n targetEl: HTMLElement | DocumentFragment | Text | undefined,\n bItem: WDom\n ) => {\n const type = bItem.type;\n const el = bItem.el;\n const isFragment = type && checkVirtualType(type);\n\n if (targetEl) {\n return targetEl;\n } else if (isFragment) {\n return findChildFragmentNextElement(bItem.children || []);\n } else if (el && el.nodeType !== 11) {\n return el;\n }\n\n return targetEl;\n },\n undefined\n );\n\nconst typeReplace = (newWDom: WDom) => {\n const parentWDom = getParent(newWDom);\n const orignalElement = newWDom.el;\n\n if (parentWDom.type && orignalElement) {\n if (orignalElement.nodeType === 11) {\n typeSortedReplace(newWDom);\n } else {\n const parentElement = findRealParentElement(parentWDom);\n const newElement = wDomToDom(newWDom);\n\n if (parentElement && newWDom.tag !== 'portal') {\n parentElement.replaceChild(newElement, orignalElement);\n }\n execMountedQueue();\n }\n }\n};\n\nconst removeEvent = (\n oldProps: Props,\n element: HTMLElement | DocumentFragment | Text\n) => {\n entries(oldProps || {}).forEach(([dataKey, dataValue]: [string, unknown]) => {\n if (dataKey.match(/^on/)) {\n element.removeEventListener(\n getEventName(dataKey),\n dataValue as (e: Event) => void\n );\n }\n });\n};\n\nconst typeUpdate = (newWDom: WDom) => {\n const element = newWDom.el;\n\n if (newWDom.type === 'text') {\n updateText(newWDom);\n\n return;\n }\n\n if (element) {\n const { oldProps, props } = newWDom;\n\n updateProps(props, element, oldProps);\n\n delete newWDom.oldProps;\n\n if (newWDom.tag === 'input') {\n (element as HTMLInputElement).value = String(newWDom?.props?.value || '');\n }\n }\n\n (newWDom.children || []).forEach((childItem: WDom) => wDomUpdate(childItem));\n\n runUpdatedQueueFromWDom(newWDom);\n};\n\nconst updateText = (newWDom: WDom) => {\n const element = newWDom.el;\n\n if (element) {\n element.nodeValue = String(newWDom.text);\n }\n};\n\nconst updateProps = (\n props?: Props,\n element?: HTMLElement | Element | DocumentFragment | Text,\n oldProps?: Props | null,\n isHydration?: boolean\n) => {\n const originalProps = { ...oldProps };\n\n entries(props || {}).forEach(([dataKey, dataValue]: [string, unknown]) => {\n if (isHydration && dataKey.match(/^on/)) {\n updateEvent(\n element as HTMLElement,\n dataKey,\n dataValue as (e: Event) => void,\n originalProps[dataKey] as (e: Event) => void\n );\n } else {\n if (dataKey === 'key' || dataValue === originalProps[dataKey]) {\n // Do nothing\n } else if (dataKey === 'portal' && typeof dataValue === 'object') {\n // Do nothing\n } else if (dataKey === 'innerHTML' && typeof dataValue === 'string') {\n (element as HTMLElement).innerHTML = dataValue;\n } else if (checkStyleData(dataKey, dataValue)) {\n updateStyle(\n dataValue,\n checkStyleData(dataKey, originalProps.style)\n ? originalProps.style\n : {},\n element\n );\n } else if (checkRefData(dataKey, dataValue)) {\n dataValue.value = element;\n } else if (dataKey.match(/^on/)) {\n updateEvent(\n element as HTMLElement,\n dataKey,\n dataValue as (e: Event) => void,\n originalProps[dataKey] as (e: Event) => void\n );\n } else if (dataKey) {\n if (dataKey !== 'type' && hasAccessorMethods(element, dataKey)) {\n (element as { [key: string]: any })[dataKey] = dataValue;\n } else {\n setAttr(\n getAttrKey(dataKey),\n element as HTMLElement,\n dataValue as string\n );\n }\n }\n\n delete originalProps[dataKey];\n }\n });\n\n keys(originalProps).forEach(dataKey =>\n (element as HTMLElement).removeAttribute(dataKey)\n );\n};\n\nconst setAttr = (dataKey: string, element: HTMLElement, dataValue: string) => {\n if (xmlnsRef.value && dataKey !== 'xmlns') {\n element.setAttributeNS(null, dataKey, dataValue);\n } else {\n element.setAttribute(dataKey, dataValue);\n }\n};\n\nconst wDomToDom = (wDom: WDom, isHydration?: boolean): HTMLElement => {\n let element;\n const { type, tag, text, props, children = [] } = wDom;\n const isVirtualType = checkVirtualType(type);\n\n if (tag === 'svg') {\n xmlnsRef.value = String(props?.xmlns);\n }\n\n if (!isHydration) {\n if (isVirtualType) {\n element = DF();\n } else if (type === 'element' && tag) {\n if (tag === 'portal' && props?.portal) {\n element = props.portal as HTMLElement;\n } else {\n element = xmlnsRef.value\n ? document.createElementNS(xmlnsRef.value, tag)\n : CE(tag);\n }\n } else if (type === 'text' && checkExisty(text)) {\n element = document.createTextNode(String(text));\n } else {\n element = CE('e');\n }\n\n wDom.el = element as HTMLElement;\n } else {\n element = wDom.el;\n }\n\n wDomChildrenToDom(children, element, isHydration);\n\n updateProps(props, element, null, isHydration);\n\n addMountedQueue(wDom);\n\n if (tag === 'svg') {\n xmlnsRef.value = '';\n }\n\n return element as HTMLElement;\n};\n\nconst wDomChildrenToDom = (\n children: WDom[],\n parentElement?: HTMLElement | Element | DocumentFragment | Text,\n isHydration?: boolean\n) => {\n const elementChildren = children.reduce(\n (acc: DocumentFragment, childItem: WDom) => {\n if (childItem.type) {\n const childElement = wDomToDom(childItem, isHydration);\n\n if (childItem.tag !== 'portal' && !isHydration) {\n acc.appendChild(childElement);\n }\n }\n\n return acc;\n },\n DF()\n );\n\n if (!isHydration && parentElement && elementChildren.hasChildNodes()) {\n parentElement.appendChild(elementChildren);\n }\n};\n\nconst updateEvent = (\n element: HTMLElement,\n eventKey: string,\n newEventHandler: (e: Event) => void,\n oldEventHandler: (e: Event) => void\n) => {\n const eventName = getEventName(eventKey);\n\n if (oldEventHandler !== newEventHandler) {\n if (oldEventHandler) {\n element.removeEventListener(eventName, oldEventHandler);\n }\n\n if (newEventHandler) {\n element.addEventListener(eventName, newEventHandler);\n }\n }\n};\n\nconst updateStyle = (\n style: Record<string, string>,\n oldStyle: Record<string, string>,\n element?: HTMLElement | Element | DocumentFragment | Text\n) => {\n const originalStyle = { ...oldStyle };\n const elementStyle = (element as HTMLElement)?.style;\n\n if (elementStyle) {\n entries(style).forEach(([styleKey, dataValue]) => {\n (elementStyle as any)[styleKey] = dataValue;\n delete originalStyle[styleKey];\n });\n\n entries(originalStyle).forEach(\n ([styleKey]) => ((elementStyle as any)[styleKey] = '')\n );\n }\n};\n\nconst findRealParentElement = (\n vDom: WDom\n): HTMLElement | DocumentFragment | Text | undefined => {\n const isVirtualType = checkVirtualType(vDom.type);\n if (vDom.isRoot && isVirtualType) {\n return vDom.wrapElement;\n }\n\n if (!isVirtualType) {\n return vDom.el as HTMLElement;\n }\n\n return findRealParentElement(getParent(vDom));\n};\n","import { WDom, TagFunctionResolver, RenderType, Props } from '@/types';\nimport { checkCustemComponentFunction, getKey } from '@/utils/predicator';\nimport { getParent } from '@/utils';\nimport { typeDelete, recursiveRemoveEvent } from '@/render';\nimport {\n checkEmptyElement,\n checkSameWDomWithOriginal,\n getWDomType,\n checkExisty,\n} from '@/utils/predicator';\n\nimport { runUnmountQueueFromWDom } from '@/hook/unmount';\nimport { assign, keys, entries } from '@/utils';\n\n/**\n * The starting point of the diffing process between the original virtual DOM and the new virtual DOM for re-rendering.\n */\nexport const makeNewWDomTree = (\n newWDom: WDom | TagFunctionResolver,\n originalWDom?: WDom\n) =>\n remakeNewWDom(\n newWDom,\n checkSameWDomWithOriginal[getWDomType(newWDom)](newWDom, originalWDom),\n originalWDom\n );\n\n/**\n * Create a new virtual DOM after comparing with the previous virtual DOM\n */\nconst remakeNewWDom = (\n newWDom: WDom | TagFunctionResolver,\n isSameType: boolean,\n originalWDom?: WDom\n) => {\n const remakeWDom = generalize(newWDom, isSameType, originalWDom);\n const param: [newWDom: WDom, isSameType: boolean, originalWDom?: WDom] = [\n remakeWDom,\n isSameType,\n originalWDom,\n ];\n const needRerender = addReRenderTypeProperty(...param);\n const isNoting = needRerender === 'N';\n\n if (!isNoting) {\n remakeWDom.children = remakeChildrenForDiff(...param);\n }\n\n remakeWDom.needRerender = needRerender;\n inheritPropForRender(remakeWDom, originalWDom, needRerender);\n\n if (!isNoting && originalWDom) {\n originalWDom.isLegacy = true;\n delete originalWDom.children;\n }\n\n return remakeWDom;\n};\n\n/**\n * Handle what the new virtual DOM should inherit or reconcile from the original virtual DOM.\n */\nconst inheritPropForRender = (\n remakeWDom: WDom,\n originalWDom?: WDom,\n needRerender?: RenderType\n) => {\n if (needRerender !== 'A' && originalWDom) {\n remakeWDom.el = originalWDom.el;\n }\n\n if (needRerender && ['D', 'R', 'SR'].includes(needRerender)) {\n if (originalWDom) {\n runUnmountQueueFromWDom(originalWDom);\n recursiveRemoveEvent(originalWDom);\n }\n remakeWDom.oldChildren = originalWDom?.children;\n }\n\n remakeWDom.oldProps = originalWDom?.props;\n};\n\n/**\n * Indicate the state information for the new virtual DOM to be reflected in the real DOM.\n */\nconst addReRenderTypeProperty = (\n newWDom: WDom,\n isSameType: boolean,\n originalWDom?: WDom\n): RenderType | undefined => {\n const existOriginalWDom = originalWDom && originalWDom.type;\n const isEmptyElement = checkEmptyElement(newWDom);\n const isRoot = newWDom.isRoot;\n const originalParentWDom = originalWDom && getParent(originalWDom);\n const origParentType = !isRoot && originalParentWDom?.type;\n const key = getKey(newWDom);\n const isKeyCheckedWDom = origParentType === 'loop' && checkExisty(key);\n const isSameText =\n newWDom.type === 'text' &&\n isSameType &&\n newWDom.text === originalWDom?.text;\n const isSameWDom = newWDom === originalWDom;\n\n let result: RenderType | undefined;\n if (isEmptyElement) {\n result = 'D';\n } else if (isSameText || isSameWDom) {\n result = 'N';\n } else if (!existOriginalWDom) {\n result = 'A';\n } else if (isSameType) {\n result = isKeyCheckedWDom ? 'SU' : 'U';\n } else {\n result = isKeyCheckedWDom ? 'SR' : 'R';\n }\n\n if (\n newWDom.type === 'loop' &&\n result === 'U' &&\n originalWDom &&\n chkDiffLoopOrder(newWDom, originalWDom)\n ) {\n result = 'CNSU';\n }\n\n return result;\n};\n\n/**\n * Check if a reverse order swap is needed when updating types that require reordering.\n */\nconst chkDiffLoopOrder = (newWDom: WDom, originalWDom: WDom) => {\n const origChildren = [...(originalWDom?.children || [])];\n const newChildren = [...(newWDom?.children || [])].filter(item =>\n origChildren.find(newItem => getKey(item) === getKey(newItem))\n );\n const filteredChildren = origChildren.filter(item =>\n newChildren.find(newItem => getKey(item) === getKey(newItem))\n );\n let isSame = filteredChildren.length === newChildren.length;\n\n if (isSame) {\n isSame = filteredChildren.every(\n (item, index) => getKey(item) === getKey(newChildren[index])\n );\n }\n\n return isSame;\n};\n\n/**\n * Handling virtual DOM attribute updates.\n */\nconst updateProps = (props: Props, infoProps: Props) => {\n if (props && infoProps !== props) {\n keys(props).forEach(key => delete props[key]);\n\n entries(infoProps || {}).forEach(([key, value]) => (props[key] = value));\n }\n};\n\nconst updateChildren = (children: WDom[], infoChidren: WDom[]) => {\n if (children && infoChidren !== children) {\n children.splice(0, children.length);\n\n if (infoChidren) {\n infoChidren.forEach(childrenItem => children.push(childrenItem));\n }\n }\n};\n\n/**\n * Start handling when the virtual DOM is updated rather than completely replaced with a new type.\n * (Reflect the state of props or children to ensure the new state is applied)\n * (Handle the reflection of the new state while ensuring that the actual references of props or children are not changed)\n */\nconst runUpdate = (vDom: WDom, infoVdom: TagFunctionResolver) => {\n const { compProps: props, compChild: children } = vDom;\n const { props: infoProps, children: infoChidren } = infoVdom;\n\n if (props) {\n updateProps(props, infoProps);\n }\n\n if (children) {\n updateChildren(children, infoChidren);\n }\n\n const newVDom = vDom.reRender && vDom.reRender();\n\n return newVDom as WDom;\n};\n\n/**\n * Replace the compared virtual DOM with the new virtual DOM or simply update it.\n */\nconst generalize = (\n newWDom: WDom | TagFunctionResolver,\n isSameType: boolean,\n originalWDom?: WDom\n): WDom => {\n if (checkCustemComponentFunction(newWDom)) {\n return isSameType && originalWDom\n ? runUpdate(originalWDom, newWDom)\n : newWDom.resolve();\n }\n\n return newWDom;\n};\n\n/**\n * 자식 가상돔들도 전부 재귀처리하며 똑같은 처리를 해준다.\n */\nconst remakeChildrenForDiff = (\n newWDom: WDom,\n isSameType: boolean,\n originalWDom?: WDom\n) =>\n isSameType && originalWDom\n ? remakeChildrenForUpdate(newWDom, originalWDom)\n : remakeChildrenForAdd(newWDom);\n\n/**\n * Recursive handling for the creation of a new virtual DOM.\n */\nconst remakeChildrenForAdd = (newWDom: WDom) =>\n (newWDom.children || []).map((item: WDom) =>\n assign(makeNewWDomTree(item), { getParent: () => newWDom })\n );\n\n/**\n * Recursive handling for updates, not additions.\n */\nconst remakeChildrenForUpdate = (newWDom: WDom, originalWDom: WDom) =>\n newWDom.type === 'loop' && checkExisty(getKey((newWDom.children || [])[0]))\n ? remakeChildrenForLoopUpdate(newWDom, originalWDom)\n : (newWDom.children || []).map((item: WDom, index: number) =>\n assign(makeNewWDomTree(item, (originalWDom.children || [])[index]), {\n getParent: () => newWDom,\n })\n );\n\n/**\n * Handling virtual DOM of loop-type elements.\n */\nconst remakeChildrenForLoopUpdate = (newWDom: WDom, originalWDom: WDom) => {\n const [remakedChildren, unUsedChildren] = diffLoopChildren(\n newWDom,\n originalWDom\n );\n\n unUsedChildren.forEach(unusedItem => {\n runUnmountQueueFromWDom(unusedItem);\n recursiveRemoveEvent(unusedItem);\n typeDelete(unusedItem);\n });\n\n return remakedChildren;\n};\n\n/**\n * Recursive handling of loop-type virtual DOM elements.\n */\nconst diffLoopChildren = (newWDom: WDom, originalWDom: WDom) => {\n const newChildren = [...(newWDom.children || [])];\n const originalChildren = [...(originalWDom.children || [])];\n const remakedChildren = newChildren.map(item => {\n const originalItem = findSameKeyOriginalItem(item, originalChildren);\n const childItem = makeNewWDomTree(item, originalItem);\n\n if (originalItem) {\n originalChildren.splice(originalChildren.indexOf(originalItem), 1);\n }\n\n childItem.getParent = () => newWDom;\n\n return childItem;\n });\n\n return [remakedChildren, originalChildren];\n};\n\n/**\n * When comparing loop-type virtual DOM elements, use the key to determine the comparison\n */\nconst findSameKeyOriginalItem = (item: WDom, originalChildren: WDom[]) =>\n originalChildren.find(\n orignalChildItem => getKey(orignalChildItem) === getKey(item)\n );\n","import { Props } from '@/types';\nimport { componentMap } from '@/utils/universalRef';\n\nconst redrawQueue = new Map<Props, () => void>();\nlet redrawQueueTimeout: boolean = false;\n\nexport const setRedrawAction = (compKey: Props, exec: () => void) => {\n if (componentMap.get(compKey)) {\n componentMap.get(compKey)!.up = () => {\n redrawQueue.set(compKey, exec);\n\n if (!redrawQueueTimeout) {\n redrawQueueTimeout = true;\n queueMicrotask(execRedrawQueue);\n }\n };\n }\n};\n\nexport const componentUpdate = (compKey: Props) => () => {\n const up = componentMap.get(compKey)?.up;\n let result = false;\n if (up) {\n up();\n result = true;\n }\n\n return result;\n};\n\nconst execRedrawQueue = () => {\n redrawQueue.forEach((item: () => void) => {\n item();\n });\n\n redrawQueue.clear();\n redrawQueueTimeout = false;\n};\n","import { componentMap, getComponentKey } from '@/utils/universalRef';\n\nimport { useUpdated } from '@/hook/useUpdate';\n\nexport const updateCallback = (\n effectAction: () => (() => void) | void,\n dependencies: () => any[] = () => []\n) => {\n const updateReqs = componentMap.get(getComponentKey())!.upR;\n\n updateReqs.push(() => useUpdated(effectAction, dependencies));\n useUpdated(effectAction, dependencies);\n};\n\nexport const runUpdateCallback = () => {\n const updateReqs = componentMap.get(getComponentKey())?.upR;\n\n if (updateReqs?.length) {\n updateReqs.forEach(callback => callback());\n }\n};\n","import {\n WDom,\n TagFunction,\n FragmentFunction,\n Props,\n MiddleStateWDomChildren,\n MiddleStateWDom,\n NodePointer,\n Component,\n} from '@/types';\n\nimport { makeNewWDomTree } from '@/diff';\nimport { wDomUpdate } from '@/render';\nimport {\n initUpdateHookState,\n initMountHookState,\n needDiffRef,\n getComponentSubInfo,\n wdomSymbol,\n} from '@/utils/universalRef';\nimport { setRedrawAction, componentUpdate } from '@/utils/redraw';\nimport { runUpdateCallback } from '@/hook/updateCallback';\nimport {\n checkFragmentFunction,\n checkCustemComponentFunction,\n} from '@/utils/predicator';\nimport { assign } from '@/utils';\n\n/**\n * It allows grouping multiple elements together.\n */\nexport const Fragment = (_props: Props, ...children: WDom[]) =>\n ({\n type: 'fragment',\n [wdomSymbol]: true,\n children,\n }) as WDom;\n\n/**\n * Element creation\n */\nexport const h = (\n tag: TagFunction | FragmentFunction | string,\n props: Props,\n ...children: MiddleStateWDomChildren\n) => {\n const nodeParentPointer: NodePointer = { value: undefined };\n const newProps = props || {};\n const newChildren = remakeChildren(nodeParentPointer, children);\n const node = makeNode(tag, newProps, newChildren);\n\n if (!checkCustemComponentFunction(node)) {\n nodeParentPointer.value = node;\n }\n\n return node;\n};\n\n/**\n * Enables portals\n */\nexport const portal = (wDom: WDom, portal: HTMLElement) => {\n return h('portal', { portal }, wDom);\n};\n\n/**\n * It helps with component creation.\n */\nexport const mount =\n <T>(component: Component<T>) =>\n (_props: T, _children?: MiddleStateWDomChildren) =>\n component;\n\n/**\n * It re-renders starting from a specific component.\n */\nconst reRenderCustomComponent = (\n tag: TagFunction,\n props: Props,\n children: WDom[],\n originalWDom: WDom\n) => {\n if (originalWDom.isLegacy) {\n return;\n }\n needDiffRef.value = true;\n\n const newWDom = makeWDomResolver(tag, props, children);\n const newWDomTree = makeNewWDomTree(newWDom, originalWDom);\n const { isRoot, getParent, wrapElement, afterElement } = originalWDom;\n\n newWDomTree.getParent = getParent;\n\n if (!isRoot && getParent) {\n const brothers = getParent()?.children || [];\n const index = brothers.indexOf(originalWDom);\n\n brothers.splice(index, 1, newWDomTree);\n } else {\n newWDomTree.isRoot = true;\n newWDomTree.wrapElement = wrapElement;\n newWDomTree.afterElement = afterElement;\n }\n\n needDiffRef.value = false;\n\n wDomUpdate(newWDomTree);\n};\n\n/**\n * Create an intermediate step for diffing between the existing virtual DOM and the new one during re-rendering\n */\nconst makeWDomResolver = (tag: TagFunction, props: Props, children: WDom[]) => {\n const tagName = tag.name;\n const ctor = tag;\n // 리졸브는 컴포넌트를 새로 만든다.\n const resolve = (compKey = props) => {\n initMountHookState(compKey);\n\n const initialComponent = tag(props, children);\n const component =\n typeof initialComponent === 'function'\n ? initialComponent\n : () => () => initialComponent;\n const componentMaker = component(componentUpdate(compKey), props, children);\n\n const customNode = makeCustomNode(\n componentMaker,\n compKey,\n tag,\n props,\n children\n );\n\n return customNode;\n };\n\n return { tagName, ctor, props, children, resolve };\n};\n\n/**\n * Create the actual virtual DOM node from the component.\n */\nconst makeCustomNode = (\n componentMaker: (props: Props) => WDom,\n compKey: Props,\n tag: TagFunction,\n props: Props,\n children: WDom[]\n) => {\n let newCustomComponentMaker = componentMaker;\n let customNode = componentMaker(props);\n\n if (customNode.reRender) {\n newCustomComponentMaker = (newProps: Props): WDom => {\n const customNode = componentMaker(newProps);\n const newNode = Fragment({}, customNode);\n\n customNode.getParent = () => newNode;\n\n return newNode;\n };\n\n customNode = newCustomComponentMaker(props);\n }\n\n const reRender = makeReRender(\n newCustomComponentMaker,\n compKey,\n tag,\n props,\n children\n );\n\n addComponentProps(customNode, compKey, tag, props, children, reRender);\n\n return customNode;\n};\n\n/**\n * When the virtual DOM is actually created from the component, generate a re-render method for future redraws.\n */\nconst makeReRender = (\n componentMaker: (props: Props) => WDom,\n compKey: Props,\n tag: TagFunction,\n props: Props,\n children: WDom[]\n) => {\n const reRender = () =>\n wDomMaker(componentMaker, compKey, tag, props, children, reRender);\n return reRender;\n};\n\n/**\n * The starting point for redrawing from the re-render method\n */\nconst wDomMaker = (\n componentMaker: (props: Props) => WDom,\n compKey: Props,\n tag: TagFunction,\n props: Props,\n children: WDom[],\n reRender: () => WDom\n) => {\n initUpdateHookState(compKey);\n runUpdateCallback();\n\n const customNode = componentMaker(props);\n\n addComponentProps(customNode, compKey, tag, props, children, reRender);\n\n return customNode;\n};\n\n/**\n * When creating a custom component node, attach additional information attributes to the virtual DOM object.\n */\nconst addComponentProps = (\n wDom: WDom,\n compKey: Props,\n tag: TagFunction,\n props: Props,\n children: WDom[],\n reRender: () => WDom\n) => {\n assign(wDom, {\n compProps: props,\n compChild: children,\n ctor: tag,\n tagName: tag.name,\n compKey,\n reRender,\n });\n\n setRedrawAction(compKey, () =>\n reRenderCustomComponent(tag, props, children, wDom)\n );\n\n if (getComponentSubInfo(compKey, 'vd')) {\n (getComponentSubInfo(compKey, 'vd') as { value: WDom }).value = wDom;\n }\n};\n\n/**\n * The starting point where the virtual DOM is created from the h function.\n */\nconst makeNode = (\n tag: TagFunction | FragmentFunction | string,\n props: Props,\n children: WDom[]\n) => {\n if (checkFragmentFunction(tag)) {\n return Fragment(props, ...children);\n } else if (checkCustemComponentFunction(tag)) {\n const componetMakeResolver = makeWDomResolver(tag, props, children);\n\n return needDiffRef.value\n ? componetMakeResolver\n : componetMakeResolver.resolve();\n }\n\n return {\n type: 'element',\n [wdomSymbol]: true,\n tag,\n props,\n children,\n } as WDom;\n};\n\n/**\n * The starting point for recursively processing the child virtual DOM elements.\n */\nconst remakeChildren = (\n nodeParentPointer: NodePointer,\n children: MiddleStateWDomChildren\n): WDom[] =>\n children.map((item: MiddleStateWDom) =>\n assign(makeChildrenItem(item), { getParent: () => nodeParentPointer.value })\n );\n\n/**\n * Recursively process the child virtual DOM elements.\n */\nconst makeChildrenItem = (item: MiddleStateWDom): WDom => {\n if (item === null || item === undefined || item === false) {\n return { type: null, [wdomSymbol]: true } as WDom;\n } else if (Array.isArray(item)) {\n const nodeParentPointer: NodePointer = { value: undefined };\n const children = remakeChildren(nodeParentPointer, item);\n const node = {\n type: 'loop',\n [wdomSymbol]: true,\n children,\n } as WDom;\n nodeParentPointer.value = node;\n\n return node;\n } else if (typeof item === 'string' || typeof item === 'number') {\n return { type: 'text', [wdomSymbol]: true, text: item } as WDom;\n }\n\n return item;\n};\n","export const ref = <T>(initValue: T) => ({ value: initValue });\nexport const nextTick = () => Promise.resolve();\n"],"names":["checkPlainWDomType","wDom","checkPlainType","typeName","checkSameCustomComponent","newWDom","originalWDom","checkSameFragment","_a","_b","checkSameTagElement","checkNormalTypeElement","checkLoopTypeElement","checkExisty","getKey","target","checkVirtualType","type","checkCustemComponentFunction","checkFragmentFunction","Fragment","checkEmptyElement","value","checkStyleData","dataKey","dataValue","checkRefData","hasAccessorMethods","descriptor","getWDomType","result","checkSameWDomWithOriginal","wdomSymbol","xmlnsRef","compKeyRef","needDiffRef","componentMap","setComponetRef","compKey","getComponentKey","getComponentSubInfo","subKey","initUpdateHookState","initMountHookState","getParent","vDom","entries","keys","assign","isPropType","obj","unmount","effectAction","runUnmountQueueFromWDom","removeItem","recursiveRunUnmount","item","subInfo","effect","mountedQueue","execMountedQueue","runMountedQueueFromWDom","addMountedQueue","mountCallback","component","queue","sequence","callback","useUpdated","dependencies","upD","upS","def","checkNeedPushQueue","runUpdatedQueueFromWDom","originalDefs","newDefs","index","getAttrKey","keyName","getEventName","eventKey","_match","p1","DF","CE","t","render","wrapElement","afterElement","isHydration","Dom","wDomToDom","recursiveRemoveEvent","rootDelete","wDomUpdate","newWDomTree","needRerender","typeAdd","typeDelete","typeReplace","typeUpdate","typeSortedReplace","typeSortedUpdate","removeEvent","childItem","deleteRealDom","findRealParentElement","parent","findChildWithRemoveElement","nodeType","newElement","getElementFromFragment","parentWDom","parentEl","nextEl","startFindNextBrotherElement","acc","element","brothers","nextIndex","candidiateBrothers","finedNextEl","findChildFragmentNextElement","parentType","targetEl","bItem","el","isFragment","orignalElement","parentElement","oldProps","updateText","props","updateProps","originalProps","updateEvent","updateStyle","setAttr","tag","text","children","isVirtualType","wDomChildrenToDom","elementChildren","childElement","newEventHandler","oldEventHandler","eventName","style","oldStyle","originalStyle","elementStyle","styleKey","makeNewWDomTree","remakeNewWDom","isSameType","remakeWDom","generalize","param","addReRenderTypeProperty","isNoting","remakeChildrenForDiff","inheritPropForRender","existOriginalWDom","isEmptyElement","isRoot","originalParentWDom","origParentType","key","isKeyCheckedWDom","isSameText","isSameWDom","chkDiffLoopOrder","origChildren","newChildren","newItem","filteredChildren","isSame","infoProps","updateChildren","infoChidren","childrenItem","runUpdate","infoVdom","remakeChildrenForUpdate","remakeChildrenForAdd","remakeChildrenForLoopUpdate","remakedChildren","unUsedChildren","diffLoopChildren","unusedItem","originalChildren","originalItem","findSameKeyOriginalItem","orignalChildItem","redrawQueue","redrawQueueTimeout","setRedrawAction","exec","execRedrawQueue","componentUpdate","up","updateCallback","runUpdateCallback","updateReqs","_props","h","nodeParentPointer","newProps","remakeChildren","node","makeNode","portal","mount","_children","reRenderCustomComponent","makeWDomResolver","initialComponent","componentMaker","makeCustomNode","newCustomComponentMaker","customNode","newNode","reRender","makeReRender","addComponentProps","wDomMaker","componetMakeResolver","makeChildrenItem","ref","initValue","nextTick"],"mappings":"AAoBA,MAAMA,IAAqB,CAACC,MAC1B,OAAOA,KAAS,YAAY,EAAE,aAAaA,IAEvCC,IAAiB,CAACD,GAAiBE,MACvCH,EAAmBC,CAAI,KAAKA,EAAK,SAASE,GAEtCC,KAA2B,CAC/BC,GACAC,MAEA,UAAUD,IACNA,EAAQ,UAASC,KAAA,gBAAAA,EAAc,QAC/BD,OAAYC,KAAA,gBAAAA,EAAc,OAE1BC,KAAoB,CACxBF,GACAC,MAEA;AAlBF,MAAAE,GAAAC;AAkBE,SAAAT,EAAmBK,CAAO,MAC1BC,KAAA,gBAAAA,EAAc,UAAS,gBACvBE,IAAAF,KAAA,gBAAAA,EAAc,aAAd,gBAAAE,EAAwB,cAAWC,IAAAJ,KAAA,gBAAAA,EAAS,aAAT,gBAAAI,EAAmB;AAAA,GAElDC,KAAsB,CAC1BL,GACAC,MAEA;AA1BF,MAAAE,GAAAC;AA0BE,SAAAT,EAAmBK,CAAO,MAC1BC,KAAA,gBAAAA,EAAc,UAAS,cACvBA,KAAA,gBAAAA,EAAc,SAAQD,EAAQ,SAC9BG,IAAAF,KAAA,gBAAAA,EAAc,aAAd,gBAAAE,EAAwB,cAA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8BA,MAAS;AAClD,WAAO,EAAE,MAAM,MAAM,CAACxB,CAAU,GAAG,GAAK;AAC/B,MAAA,MAAM,QAAQwB,CAAI,GAAG;AACxB,UAAAwJ,IAAiC,EAAE,OAAO,OAAU,GACpDnE,IAAWqE,GAAeF,GAAmBxJ,CAAI,GACjD2J,IAAO;AAAA,MACX,MAAM;AAAA,MACN,CAACnL,CAAU,GAAG;AAAA,MACd,UAAA6G;AAAA,IAAA;AAEF,WAAAmE,EAAkB,QAAQG,GAEnBA;AAAA,aACE,OAAO3J,KAAS,YAAY,OAAOA,KAAS;AAC9C,WAAA,EAAE,MAAM,QAAQ,CAACxB,CAAU,GAAG,IAAM,MAAMwB;AAG5C,SAAAA;AACT,GChTa8K,KAAM,CAAIC,OAAkB,EAAE,OAAOA,EAAU,IAC/CC,KAAW,MAAM,QAAQ,QAAQ;"}
1
+ {"version":3,"file":"lithent.mjs","sources":["../src/utils/predicator.ts","../src/utils/universalRef.ts","../src/utils/index.ts","../src/hook/unmount.ts","../src/hook/mountCallback.ts","../src/hook/useUpdate.ts","../src/render.ts","../src/diff.ts","../src/utils/redraw.ts","../src/hook/updateCallback.ts","../src/wDom.ts","../src/hook/ref.ts"],"sourcesContent":["import { Fragment } from '@/wDom';\nimport {\n WDom,\n TagFunction,\n TagFunctionResolver,\n FragmentFunction,\n WDomType,\n} from '@/types';\n\ntype WDomParam =\n | string\n | WDom\n | TagFunction\n | TagFunctionResolver\n | FragmentFunction;\n\n/**\n * Predicator\n */\n\nconst checkPlainWDomType = (wDom: WDomParam): wDom is WDom =>\n typeof wDom === 'object' && !('resolve' in wDom);\n\nconst checkPlainType = (wDom: WDomParam, typeName: string) =>\n checkPlainWDomType(wDom) && wDom.type === typeName;\n\nconst checkSameCustomComponent = (\n newWDom: WDom | TagFunction | TagFunctionResolver,\n originalWDom?: WDom\n) =>\n 'ctor' in newWDom\n ? newWDom.ctor === originalWDom?.ctor\n : newWDom === originalWDom?.ctor;\n\nconst checkSameFragment = (\n newWDom: WDom | TagFunction | TagFunctionResolver,\n originalWDom?: WDom\n) =>\n checkPlainWDomType(newWDom) &&\n originalWDom?.type === 'fragment' &&\n originalWDom?.children?.length === newWDom?.children?.length;\n\nconst checkSameTagElement = (\n newWDom: WDom | TagFunction | TagFunctionResolver,\n originalWDom?: WDom\n) =>\n checkPlainWDomType(newWDom) &&\n originalWDom?.type === 'element' &&\n originalWDom?.tag === newWDom.tag &&\n originalWDom?.children?.length === newWDom?.children?.length;\n\nconst checkNormalTypeElement = (\n newWDom: WDom | TagFunction | TagFunctionResolver,\n originalWDom?: WDom\n) => checkPlainWDomType(newWDom) && originalWDom?.type === newWDom.type;\n\nconst checkLoopTypeElement = (\n newWDom: WDom | TagFunction | TagFunctionResolver,\n originalWDom?: WDom\n) =>\n checkPlainWDomType(newWDom) &&\n originalWDom?.type === newWDom.type &&\n ((checkExisty(getKey((newWDom.children || [])[0])) &&\n checkExisty(getKey((originalWDom?.children || [])[0]))) ||\n originalWDom?.children?.length === newWDom?.children?.length);\n\nexport const getKey = (target: WDom) =>\n target?.compProps?.key ?? target?.props?.key;\n\nexport const checkVirtualType = (type?: string | null) =>\n type && ['fragment', 'loop'].includes(type);\n\nexport const checkCustemComponentFunction = (\n target: WDomParam\n): target is TagFunction | TagFunctionResolver =>\n (typeof target === 'function' && !checkFragmentFunction(target)) ||\n (typeof target === 'object' && 'resolve' in target);\n\nexport const checkFragmentFunction = (\n target: unknown\n): target is FragmentFunction =>\n typeof target === 'function' && target === Fragment;\n\nexport const checkEmptyElement = (wDom: WDomParam) =>\n checkPlainWDomType(wDom) && !wDom.type;\n\nexport const checkExisty = (value: unknown) =>\n value !== null && value !== undefined;\n\nexport const checkStyleData = (\n dataKey: string,\n dataValue: unknown\n): dataValue is Record<string, string> =>\n dataKey === 'style' && typeof dataValue === 'object';\n\nexport const checkRefData = (\n dataKey: string,\n dataValue: unknown\n): dataValue is {\n value: HTMLElement | Element | DocumentFragment | Text | undefined;\n} => dataKey === 'ref' && typeof dataValue === 'object';\n\nexport const hasAccessorMethods = (target: unknown, dataKey: string) => {\n const descriptor = Object.getOwnPropertyDescriptor(\n target!.constructor.prototype,\n dataKey\n );\n\n return descriptor && descriptor.get && descriptor.set;\n};\n\nexport const getWDomType = (\n wDom: WDom | TagFunction | TagFunctionResolver\n): WDomType => {\n let result: WDomType = 'et';\n\n if (checkCustemComponentFunction(wDom)) {\n result = 'c';\n } else if (checkPlainType(wDom, 'fragment')) {\n result = 'f';\n } else if (checkPlainType(wDom, 'element')) {\n result = 'e';\n } else if (checkPlainType(wDom, 'loop')) {\n result = 'l';\n } else if (checkPlainType(wDom, 'text')) {\n result = 't';\n } else if (checkEmptyElement(wDom)) {\n result = 'et';\n }\n\n return result;\n};\n\nexport const checkSameWDomWithOriginal = {\n c: checkSameCustomComponent,\n l: checkLoopTypeElement,\n t: checkNormalTypeElement,\n e: checkSameTagElement,\n f: checkSameFragment,\n et: checkNormalTypeElement,\n};\n","import { ComponentMap, ComponentSubKey, Props } from '@/types';\n\nexport const wdomSymbol = Symbol.for('lithentWDomSymbol');\nexport const xmlnsRef: { value: string } = { value: '' };\nexport const compKeyRef: { value: Props } = { value: {} };\nexport const needDiffRef: { value: boolean } = { value: false };\nexport const componentMap: ComponentMap = new WeakMap();\n\nconst setComponetRef = (compKey: Props) => {\n componentMap.set(compKey, {\n vd: { value: null },\n up: () => {},\n upR: [],\n upS: { value: 0 },\n upD: [],\n upCB: [],\n mts: [],\n umts: [],\n });\n};\n\nexport const getComponentKey = () => compKeyRef.value;\n\nexport const getComponentSubInfo = (\n compKey: Props,\n subKey: ComponentSubKey\n) => {\n if (componentMap.get(compKey)) {\n return componentMap.get(compKey)![subKey];\n }\n return null;\n};\n\nexport const initUpdateHookState = (compKey: Props) =>\n (compKeyRef.value = compKey);\n\nexport const initMountHookState = (compKey: Props) => {\n compKeyRef.value = compKey;\n setComponetRef(compKey);\n};\n","import { WDom, Props } from '@/types';\n\nimport { wdomSymbol } from '@/utils/universalRef';\n\nexport const getParent = (vDom: WDom) =>\n (vDom.getParent && vDom.getParent()) as WDom;\n\nexport const entries = Object.entries;\nexport const keys = Object.keys;\nexport const assign = Object.assign;\nexport const isPropType = (obj: unknown): obj is Props => {\n return (\n typeof obj === 'object' &&\n !Array.isArray(obj) &&\n !Object.getOwnPropertySymbols(obj).includes(wdomSymbol)\n );\n};\n","import { WDom, Props } from '@/types';\nimport { componentMap, getComponentKey } from '@/utils/universalRef';\n\nexport const unmount = (effectAction: () => void) => {\n componentMap.get(getComponentKey())!.umts.push(effectAction);\n};\n\nexport const runUnmountQueueFromWDom = (newWDom: WDom) => {\n const { compKey } = newWDom;\n\n if (compKey) {\n removeItem(compKey);\n }\n recursiveRunUnmount(newWDom);\n};\n\nconst recursiveRunUnmount = (wDom: WDom) => {\n (wDom.children || []).forEach(item => {\n const childComKey = item.compKey;\n if (childComKey) {\n runUnmountQueueFromWDom(item);\n } else {\n recursiveRunUnmount(item);\n }\n });\n};\n\nconst removeItem = (compKey: Props) => {\n const subInfo = componentMap.get(compKey);\n if (subInfo) {\n subInfo!.umts.forEach(effect => effect());\n subInfo!.umts = [];\n componentMap.delete(compKey);\n }\n};\n","import { WDom } from '@/types';\nimport {\n compKeyRef,\n componentMap,\n getComponentKey,\n} from '@/utils/universalRef';\nimport { unmount } from '@/hook/unmount';\n\nlet mountedQueue: WDom[] = [];\n\nexport const execMountedQueue = () => {\n mountedQueue.forEach(item => runMountedQueueFromWDom(item));\n mountedQueue = [];\n};\nexport const addMountedQueue = (wDom: WDom) => {\n if (wDom.compKey) {\n mountedQueue.push(wDom);\n }\n};\nexport const mountCallback = (effectAction: () => void) =>\n (componentMap.get(getComponentKey())?.mts || []).push(effectAction);\n\nexport const runMountedQueueFromWDom = (newWDom: WDom) => {\n const { compKey } = newWDom;\n\n if (compKey) {\n const component = componentMap.get(compKey);\n const queue = component?.mts;\n const sequence = component?.upS;\n\n compKeyRef.value = compKey;\n\n if (sequence) {\n sequence.value = 0;\n }\n\n if (queue) {\n component.mts = [];\n\n queue.forEach((effect: Function) => {\n const callback = effect();\n if (callback) {\n unmount(callback);\n }\n });\n }\n }\n};\n","import { WDom } from '@/types';\nimport {\n compKeyRef,\n componentMap,\n getComponentKey,\n} from '@/utils/universalRef';\n\nexport const useUpdated = (\n effectAction: () => (() => void) | void,\n dependencies: () => any[] = () => []\n) => {\n const component = componentMap.get(getComponentKey());\n const { upD, upS } = component!;\n const def = upD[upS.value];\n\n if (def && checkNeedPushQueue(def, dependencies())) {\n const callback = effectAction();\n if (callback) {\n component!.upCB.push(callback);\n }\n }\n\n upD[upS.value] = dependencies();\n upS.value += 1;\n};\n\nexport const runUpdatedQueueFromWDom = (newWDom: WDom) => {\n const { compKey } = newWDom;\n\n if (compKey) {\n const component = componentMap.get(compKey);\n const queue = component?.upCB;\n const sequence = component?.upS;\n\n compKeyRef.value = compKey;\n\n if (sequence) {\n sequence.value = 0;\n }\n\n if (newWDom.ctor && queue) {\n component.upCB = [];\n queue.forEach((effect: Function) => effect());\n }\n }\n};\n\nconst checkNeedPushQueue = (originalDefs: unknown[], newDefs: unknown[]) =>\n !originalDefs.length\n ? true\n : originalDefs.some((def, index) => def !== newDefs[index]);\n","import { WDom, Props } from '@/types';\nimport {\n checkStyleData,\n checkRefData,\n checkExisty,\n checkVirtualType,\n hasAccessorMethods,\n} from '@/utils/predicator';\n\nimport { componentMap, xmlnsRef } from '@/utils/universalRef';\nimport { runUnmountQueueFromWDom } from '@/hook/unmount';\nimport { execMountedQueue, addMountedQueue } from '@/hook/mountCallback';\nimport { runUpdatedQueueFromWDom } from '@/hook/useUpdate';\nimport { getParent, entries, keys } from '@/utils';\n\nconst getAttrKey = (keyName: string) =>\n keyName === 'className' ? 'class' : keyName;\n\nconst getEventName = (eventKey: string) =>\n eventKey.replace(/^on(.*)/, (_match, p1) => p1.toLowerCase());\n\nconst DF = () => new DocumentFragment();\nconst CE = (t: string) => document.createElement(t);\n\nexport const render = (\n wDom: WDom,\n wrapElement: HTMLElement | null,\n afterElement?: HTMLElement | null,\n isHydration?: boolean\n) => {\n wDom.isRoot = true;\n wrapElement ??= document.body;\n wDom.wrapElement = wrapElement;\n\n const Dom = wDomToDom(wDom, isHydration);\n\n if (afterElement) {\n wDom.afterElement = afterElement;\n wrapElement.insertBefore(Dom, afterElement);\n } else if (!isHydration) {\n if (wrapElement.tagName === 'HTML') {\n wrapElement.replaceWith(Dom);\n } else {\n wrapElement.appendChild(Dom);\n }\n }\n\n execMountedQueue();\n\n return () => {\n const component = componentMap.get(wDom.compProps || {})?.vd.value;\n\n if (component) {\n runUnmountQueueFromWDom(component);\n }\n\n recursiveRemoveEvent(component || wDom);\n rootDelete(component || wDom);\n };\n};\n\nexport const wDomUpdate = (newWDomTree: WDom) => {\n const { needRerender } = newWDomTree;\n\n if (needRerender && needRerender !== 'N') {\n ({\n A: typeAdd,\n D: typeDelete,\n R: typeReplace,\n U: typeUpdate,\n CNSU: typeUpdate,\n SR: typeSortedReplace,\n SU: typeSortedUpdate,\n })[needRerender](newWDomTree);\n\n delete newWDomTree.needRerender;\n delete newWDomTree.oldChildren;\n delete newWDomTree.oldProps;\n }\n};\n\nexport const recursiveRemoveEvent = (originalWDom: WDom) => {\n if (originalWDom.props && originalWDom.el) {\n removeEvent(originalWDom.props, originalWDom.el);\n }\n\n (originalWDom.children || []).forEach((childItem: WDom) => {\n recursiveRemoveEvent(childItem);\n });\n};\n\nconst rootDelete = (newWDom: WDom) => {\n deleteRealDom(newWDom, newWDom.wrapElement as HTMLElement);\n};\n\nexport const typeDelete = (newWDom: WDom) => {\n if (newWDom.oldProps && newWDom.el) {\n removeEvent(newWDom.oldProps, newWDom.el);\n }\n\n deleteRealDom(\n newWDom,\n findRealParentElement(getParent(newWDom)) as HTMLElement\n );\n};\n\nconst deleteRealDom = (newWDom: WDom, parent: HTMLElement) => {\n if (parent && newWDom.el) {\n if ([1, 3].includes(newWDom.el?.nodeType)) {\n parent.removeChild(newWDom.el);\n } else if (newWDom.el?.nodeType === 11) {\n findChildWithRemoveElement(newWDom, parent as HTMLElement);\n }\n delete newWDom.el;\n }\n};\n\nconst findChildWithRemoveElement = (newWDom: WDom, parent: HTMLElement) => {\n (newWDom?.oldChildren || newWDom?.children || []).forEach(item => {\n const nodeType = item.el?.nodeType;\n if (nodeType) {\n if ([1, 3].includes(nodeType)) {\n if ((item.el as HTMLElement).tagName === 'HTML') {\n (item.el as HTMLElement).innerHTML = '';\n } else {\n (item.el as HTMLElement).remove();\n }\n } else if (nodeType === 11) {\n findChildWithRemoveElement(item, parent);\n }\n }\n });\n};\n\nconst typeSortedReplace = (newWDom: WDom) => {\n typeDelete(newWDom);\n typeAdd(newWDom);\n};\n\nconst typeSortedUpdate = (newWDom: WDom) => {\n typeUpdate(newWDom);\n\n const parentWDom = getParent(newWDom);\n if (parentWDom.needRerender !== 'CNSU') {\n const newElement = getElementFromFragment(newWDom);\n\n typeAdd(newWDom, newElement);\n }\n};\n\nconst typeAdd = (\n newWDom: WDom,\n newElement?: HTMLElement | DocumentFragment | Text\n) => {\n if (!newElement) {\n newElement = wDomToDom(newWDom) as HTMLElement;\n }\n\n const parentWDom = getParent(newWDom);\n if (parentWDom.type) {\n const parentEl = findRealParentElement(parentWDom);\n const isLoop = parentWDom.type === 'loop';\n const nextEl =\n isLoop && parentWDom.needRerender && parentWDom.needRerender !== 'CNSU'\n ? startFindNextBrotherElement(parentWDom, getParent(parentWDom))\n : startFindNextBrotherElement(newWDom, parentWDom);\n\n if (newElement && parentEl) {\n if (newWDom.tag !== 'portal') {\n if (nextEl) {\n parentEl.insertBefore(newElement, nextEl);\n } else {\n parentEl.appendChild(newElement);\n }\n }\n\n execMountedQueue();\n }\n }\n};\n\nconst getElementFromFragment = (newWDom: WDom) => {\n if (checkVirtualType(newWDom.type)) {\n return (newWDom?.children || []).reduce((acc, item) => {\n const element = getElementFromFragment(item);\n\n if (element) {\n acc.appendChild(element);\n }\n return acc;\n }, DF());\n }\n\n return newWDom.el;\n};\n\nconst startFindNextBrotherElement = (\n wDom: WDom,\n parentWDom: WDom\n): HTMLElement | DocumentFragment | Text | undefined => {\n const brothers = parentWDom.children || [];\n const index = brothers.indexOf(wDom);\n const nextIndex = index + 1;\n const candidiateBrothers = brothers.slice(nextIndex);\n\n const finedNextEl = findChildFragmentNextElement(candidiateBrothers);\n const parentType = parentWDom.type || '';\n\n if (finedNextEl) {\n return finedNextEl;\n }\n\n if (!parentWDom.isRoot && checkVirtualType(parentType)) {\n return startFindNextBrotherElement(parentWDom, getParent(parentWDom));\n } else if (\n parentWDom.isRoot &&\n checkVirtualType(parentType) &&\n parentWDom.afterElement\n ) {\n return parentWDom.afterElement;\n }\n\n return undefined;\n};\n\nconst findChildFragmentNextElement = (\n candidiateBrothers: WDom[]\n): HTMLElement | DocumentFragment | Text | undefined =>\n candidiateBrothers.reduce(\n (\n targetEl: HTMLElement | DocumentFragment | Text | undefined,\n bItem: WDom\n ) => {\n const type = bItem.type;\n const el = bItem.el;\n const isFragment = type && checkVirtualType(type);\n\n if (targetEl) {\n return targetEl;\n } else if (isFragment) {\n return findChildFragmentNextElement(bItem.children || []);\n } else if (el && el.nodeType !== 11) {\n return el;\n }\n\n return targetEl;\n },\n undefined\n );\n\nconst typeReplace = (newWDom: WDom) => {\n const parentWDom = getParent(newWDom);\n const orignalElement = newWDom.el;\n\n if (parentWDom.type && orignalElement) {\n if (orignalElement.nodeType === 11) {\n typeSortedReplace(newWDom);\n } else {\n const parentElement = findRealParentElement(parentWDom);\n const newElement = wDomToDom(newWDom);\n\n if (parentElement && newWDom.tag !== 'portal') {\n parentElement.replaceChild(newElement, orignalElement);\n }\n execMountedQueue();\n }\n }\n};\n\nconst removeEvent = (\n oldProps: Props,\n element: HTMLElement | DocumentFragment | Text\n) => {\n entries(oldProps || {}).forEach(([dataKey, dataValue]: [string, unknown]) => {\n if (dataKey.match(/^on/)) {\n element.removeEventListener(\n getEventName(dataKey),\n dataValue as (e: Event) => void\n );\n }\n });\n};\n\nconst typeUpdate = (newWDom: WDom) => {\n const element = newWDom.el;\n\n if (newWDom.type === 'text') {\n updateText(newWDom);\n\n return;\n }\n\n if (element) {\n const { oldProps, props } = newWDom;\n\n updateProps(props, element, oldProps);\n\n delete newWDom.oldProps;\n\n if (newWDom.tag === 'input') {\n (element as HTMLInputElement).value = String(newWDom?.props?.value || '');\n }\n }\n\n (newWDom.children || []).forEach((childItem: WDom) => wDomUpdate(childItem));\n\n runUpdatedQueueFromWDom(newWDom);\n};\n\nconst updateText = (newWDom: WDom) => {\n const element = newWDom.el;\n\n if (element) {\n element.nodeValue = String(newWDom.text);\n }\n};\n\nconst updateProps = (\n props?: Props,\n element?: HTMLElement | Element | DocumentFragment | Text,\n oldProps?: Props | null,\n isHydration?: boolean\n) => {\n const originalProps = { ...oldProps };\n\n entries(props || {}).forEach(([dataKey, dataValue]: [string, unknown]) => {\n if (isHydration && dataKey.match(/^on/)) {\n updateEvent(\n element as HTMLElement,\n dataKey,\n dataValue as (e: Event) => void,\n originalProps[dataKey] as (e: Event) => void\n );\n } else {\n if (dataKey === 'key' || dataValue === originalProps[dataKey]) {\n // Do nothing\n } else if (dataKey === 'portal' && typeof dataValue === 'object') {\n // Do nothing\n } else if (dataKey === 'innerHTML' && typeof dataValue === 'string') {\n (element as HTMLElement).innerHTML = dataValue;\n } else if (checkStyleData(dataKey, dataValue)) {\n updateStyle(\n dataValue,\n checkStyleData(dataKey, originalProps.style)\n ? originalProps.style\n : {},\n element\n );\n } else if (checkRefData(dataKey, dataValue)) {\n dataValue.value = element;\n } else if (dataKey.match(/^on/)) {\n updateEvent(\n element as HTMLElement,\n dataKey,\n dataValue as (e: Event) => void,\n originalProps[dataKey] as (e: Event) => void\n );\n } else if (dataKey) {\n if (dataKey !== 'type' && hasAccessorMethods(element, dataKey)) {\n (element as { [key: string]: any })[dataKey] = dataValue;\n } else {\n setAttr(\n getAttrKey(dataKey),\n element as HTMLElement,\n dataValue as string\n );\n }\n }\n\n delete originalProps[dataKey];\n }\n });\n\n keys(originalProps).forEach(dataKey =>\n (element as HTMLElement).removeAttribute(dataKey)\n );\n};\n\nconst setAttr = (dataKey: string, element: HTMLElement, dataValue: string) => {\n if (xmlnsRef.value && dataKey !== 'xmlns') {\n element.setAttributeNS(null, dataKey, dataValue);\n } else {\n element.setAttribute(dataKey, dataValue);\n }\n};\n\nconst wDomToDom = (wDom: WDom, isHydration?: boolean): HTMLElement => {\n let element;\n const { type, tag, text, props, children = [] } = wDom;\n const isVirtualType = checkVirtualType(type);\n\n if (tag === 'svg') {\n xmlnsRef.value = String(props?.xmlns);\n }\n\n if (!isHydration) {\n if (isVirtualType) {\n element = DF();\n } else if (type === 'element' && tag) {\n if (tag === 'portal' && props?.portal) {\n element = props.portal as HTMLElement;\n } else {\n element = xmlnsRef.value\n ? document.createElementNS(xmlnsRef.value, tag)\n : CE(tag);\n }\n } else if (type === 'text' && checkExisty(text)) {\n element = document.createTextNode(String(text));\n } else {\n element = CE('e');\n }\n\n wDom.el = element as HTMLElement;\n } else {\n element = wDom.el;\n }\n\n wDomChildrenToDom(children, element, isHydration);\n\n updateProps(props, element, null, isHydration);\n\n addMountedQueue(wDom);\n\n if (tag === 'svg') {\n xmlnsRef.value = '';\n }\n\n return element as HTMLElement;\n};\n\nconst wDomChildrenToDom = (\n children: WDom[],\n parentElement?: HTMLElement | Element | DocumentFragment | Text,\n isHydration?: boolean\n) => {\n const elementChildren = children.reduce(\n (acc: DocumentFragment, childItem: WDom) => {\n if (childItem.type) {\n const childElement = wDomToDom(childItem, isHydration);\n\n if (childItem.tag !== 'portal' && !isHydration) {\n acc.appendChild(childElement);\n }\n }\n\n return acc;\n },\n DF()\n );\n\n if (!isHydration && parentElement && elementChildren.hasChildNodes()) {\n parentElement.appendChild(elementChildren);\n }\n};\n\nconst updateEvent = (\n element: HTMLElement,\n eventKey: string,\n newEventHandler: (e: Event) => void,\n oldEventHandler: (e: Event) => void\n) => {\n const eventName = getEventName(eventKey);\n\n if (oldEventHandler !== newEventHandler) {\n if (oldEventHandler) {\n element.removeEventListener(eventName, oldEventHandler);\n }\n\n if (newEventHandler) {\n element.addEventListener(eventName, newEventHandler);\n }\n }\n};\n\nconst updateStyle = (\n style: Record<string, string>,\n oldStyle: Record<string, string>,\n element?: HTMLElement | Element | DocumentFragment | Text\n) => {\n const originalStyle = { ...oldStyle };\n const elementStyle = (element as HTMLElement)?.style;\n\n if (elementStyle) {\n entries(style).forEach(([styleKey, dataValue]) => {\n (elementStyle as any)[styleKey] = dataValue;\n delete originalStyle[styleKey];\n });\n\n entries(originalStyle).forEach(\n ([styleKey]) => ((elementStyle as any)[styleKey] = '')\n );\n }\n};\n\nconst findRealParentElement = (\n vDom: WDom\n): HTMLElement | DocumentFragment | Text | undefined => {\n const isVirtualType = checkVirtualType(vDom.type);\n if (vDom.isRoot && isVirtualType) {\n return vDom.wrapElement;\n }\n\n if (!isVirtualType) {\n return vDom.el as HTMLElement;\n }\n\n return findRealParentElement(getParent(vDom));\n};\n","import { WDom, TagFunctionResolver, RenderType, Props } from '@/types';\nimport { checkCustemComponentFunction, getKey } from '@/utils/predicator';\nimport { getParent } from '@/utils';\nimport { typeDelete, recursiveRemoveEvent } from '@/render';\nimport {\n checkEmptyElement,\n checkSameWDomWithOriginal,\n getWDomType,\n checkExisty,\n} from '@/utils/predicator';\n\nimport { runUnmountQueueFromWDom } from '@/hook/unmount';\nimport { assign, keys, entries } from '@/utils';\n\n/**\n * The starting point of the diffing process between the original virtual DOM and the new virtual DOM for re-rendering.\n */\nexport const makeNewWDomTree = (\n newWDom: WDom | TagFunctionResolver,\n originalWDom?: WDom\n) =>\n remakeNewWDom(\n newWDom,\n checkSameWDomWithOriginal[getWDomType(newWDom)](newWDom, originalWDom),\n originalWDom\n );\n\n/**\n * Create a new virtual DOM after comparing with the previous virtual DOM\n */\nconst remakeNewWDom = (\n newWDom: WDom | TagFunctionResolver,\n isSameType: boolean,\n originalWDom?: WDom\n) => {\n const remakeWDom = generalize(newWDom, isSameType, originalWDom);\n const param: [newWDom: WDom, isSameType: boolean, originalWDom?: WDom] = [\n remakeWDom,\n isSameType,\n originalWDom,\n ];\n const needRerender = addReRenderTypeProperty(...param);\n const isNoting = needRerender === 'N';\n\n if (!isNoting) {\n remakeWDom.children = remakeChildrenForDiff(...param);\n }\n\n remakeWDom.needRerender = needRerender;\n inheritPropForRender(remakeWDom, originalWDom, needRerender);\n\n if (!isNoting && originalWDom) {\n originalWDom.isLegacy = true;\n delete originalWDom.children;\n }\n\n return remakeWDom;\n};\n\n/**\n * Handle what the new virtual DOM should inherit or reconcile from the original virtual DOM.\n */\nconst inheritPropForRender = (\n remakeWDom: WDom,\n originalWDom?: WDom,\n needRerender?: RenderType\n) => {\n if (needRerender !== 'A' && originalWDom) {\n remakeWDom.el = originalWDom.el;\n }\n\n if (needRerender && ['D', 'R', 'SR'].includes(needRerender)) {\n if (originalWDom) {\n runUnmountQueueFromWDom(originalWDom);\n recursiveRemoveEvent(originalWDom);\n }\n remakeWDom.oldChildren = originalWDom?.children;\n }\n\n remakeWDom.oldProps = originalWDom?.props;\n};\n\n/**\n * Indicate the state information for the new virtual DOM to be reflected in the real DOM.\n */\nconst addReRenderTypeProperty = (\n newWDom: WDom,\n isSameType: boolean,\n originalWDom?: WDom\n): RenderType | undefined => {\n const existOriginalWDom = originalWDom && originalWDom.type;\n const isEmptyElement = checkEmptyElement(newWDom);\n const isRoot = newWDom.isRoot;\n const originalParentWDom = originalWDom && getParent(originalWDom);\n const origParentType = !isRoot && originalParentWDom?.type;\n const key = getKey(newWDom);\n const isKeyCheckedWDom = origParentType === 'loop' && checkExisty(key);\n const isSameText =\n newWDom.type === 'text' &&\n isSameType &&\n newWDom.text === originalWDom?.text;\n const isSameWDom = newWDom === originalWDom;\n\n let result: RenderType | undefined;\n if (isEmptyElement) {\n result = 'D';\n } else if (isSameText || isSameWDom) {\n result = 'N';\n } else if (!existOriginalWDom) {\n result = 'A';\n } else if (isSameType) {\n result = isKeyCheckedWDom ? 'SU' : 'U';\n } else {\n result = isKeyCheckedWDom ? 'SR' : 'R';\n }\n\n if (\n newWDom.type === 'loop' &&\n result === 'U' &&\n originalWDom &&\n chkDiffLoopOrder(newWDom, originalWDom)\n ) {\n result = 'CNSU';\n }\n\n return result;\n};\n\n/**\n * Check if a reverse order swap is needed when updating types that require reordering.\n */\nconst chkDiffLoopOrder = (newWDom: WDom, originalWDom: WDom) => {\n const origChildren = [...(originalWDom?.children || [])];\n const newChildren = [...(newWDom?.children || [])].filter(item =>\n origChildren.find(newItem => getKey(item) === getKey(newItem))\n );\n const filteredChildren = origChildren.filter(item =>\n newChildren.find(newItem => getKey(item) === getKey(newItem))\n );\n let isSame = filteredChildren.length === newChildren.length;\n\n if (isSame) {\n isSame = filteredChildren.every(\n (item, index) => getKey(item) === getKey(newChildren[index])\n );\n }\n\n return isSame;\n};\n\n/**\n * Handling virtual DOM attribute updates.\n */\nconst updateProps = (props: Props, infoProps: Props) => {\n if (props && infoProps !== props) {\n keys(props).forEach(key => delete props[key]);\n\n entries(infoProps || {}).forEach(([key, value]) => (props[key] = value));\n }\n};\n\nconst updateChildren = (children: WDom[], infoChidren: WDom[]) => {\n if (children && infoChidren !== children) {\n children.splice(0, children.length);\n\n if (infoChidren) {\n infoChidren.forEach(childrenItem => children.push(childrenItem));\n }\n }\n};\n\n/**\n * Start handling when the virtual DOM is updated rather than completely replaced with a new type.\n * (Reflect the state of props or children to ensure the new state is applied)\n * (Handle the reflection of the new state while ensuring that the actual references of props or children are not changed)\n */\nconst runUpdate = (vDom: WDom, infoVdom: TagFunctionResolver) => {\n const { compProps: props, compChild: children } = vDom;\n const { props: infoProps, children: infoChidren } = infoVdom;\n\n if (props) {\n updateProps(props, infoProps);\n }\n\n if (children) {\n updateChildren(children, infoChidren);\n }\n\n const newVDom = vDom.reRender && vDom.reRender();\n\n return newVDom as WDom;\n};\n\n/**\n * Replace the compared virtual DOM with the new virtual DOM or simply update it.\n */\nconst generalize = (\n newWDom: WDom | TagFunctionResolver,\n isSameType: boolean,\n originalWDom?: WDom\n): WDom => {\n if (checkCustemComponentFunction(newWDom)) {\n return isSameType && originalWDom\n ? runUpdate(originalWDom, newWDom)\n : newWDom.resolve();\n }\n\n return newWDom;\n};\n\n/**\n * 자식 가상돔들도 전부 재귀처리하며 똑같은 처리를 해준다.\n */\nconst remakeChildrenForDiff = (\n newWDom: WDom,\n isSameType: boolean,\n originalWDom?: WDom\n) =>\n isSameType && originalWDom\n ? remakeChildrenForUpdate(newWDom, originalWDom)\n : remakeChildrenForAdd(newWDom);\n\n/**\n * Recursive handling for the creation of a new virtual DOM.\n */\nconst remakeChildrenForAdd = (newWDom: WDom) =>\n (newWDom.children || []).map((item: WDom) =>\n assign(makeNewWDomTree(item), { getParent: () => newWDom })\n );\n\n/**\n * Recursive handling for updates, not additions.\n */\nconst remakeChildrenForUpdate = (newWDom: WDom, originalWDom: WDom) =>\n newWDom.type === 'loop' && checkExisty(getKey((newWDom.children || [])[0]))\n ? remakeChildrenForLoopUpdate(newWDom, originalWDom)\n : (newWDom.children || []).map((item: WDom, index: number) =>\n assign(makeNewWDomTree(item, (originalWDom.children || [])[index]), {\n getParent: () => newWDom,\n })\n );\n\n/**\n * Handling virtual DOM of loop-type elements.\n */\nconst remakeChildrenForLoopUpdate = (newWDom: WDom, originalWDom: WDom) => {\n const [remakedChildren, unUsedChildren] = diffLoopChildren(\n newWDom,\n originalWDom\n );\n\n unUsedChildren.forEach(unusedItem => {\n runUnmountQueueFromWDom(unusedItem);\n recursiveRemoveEvent(unusedItem);\n typeDelete(unusedItem);\n });\n\n return remakedChildren;\n};\n\n/**\n * Recursive handling of loop-type virtual DOM elements.\n */\nconst diffLoopChildren = (newWDom: WDom, originalWDom: WDom) => {\n const newChildren = [...(newWDom.children || [])];\n const originalChildren = [...(originalWDom.children || [])];\n const remakedChildren = newChildren.map(item => {\n const originalItem = findSameKeyOriginalItem(item, originalChildren);\n const childItem = makeNewWDomTree(item, originalItem);\n\n if (originalItem) {\n originalChildren.splice(originalChildren.indexOf(originalItem), 1);\n }\n\n childItem.getParent = () => newWDom;\n\n return childItem;\n });\n\n return [remakedChildren, originalChildren];\n};\n\n/**\n * When comparing loop-type virtual DOM elements, use the key to determine the comparison\n */\nconst findSameKeyOriginalItem = (item: WDom, originalChildren: WDom[]) =>\n originalChildren.find(\n orignalChildItem => getKey(orignalChildItem) === getKey(item)\n );\n","import { Props } from '@/types';\nimport { componentMap } from '@/utils/universalRef';\n\nconst redrawQueue = new Map<Props, () => void>();\nlet redrawQueueTimeout: boolean = false;\n\nexport const setRedrawAction = (compKey: Props, exec: () => void) => {\n if (componentMap.get(compKey)) {\n componentMap.get(compKey)!.up = () => {\n redrawQueue.set(compKey, exec);\n\n if (!redrawQueueTimeout) {\n redrawQueueTimeout = true;\n queueMicrotask(execRedrawQueue);\n }\n };\n }\n};\n\nexport const componentUpdate = (compKey: Props) => () => {\n const up = componentMap.get(compKey)?.up;\n let result = false;\n if (up) {\n up();\n result = true;\n }\n\n return result;\n};\n\nconst execRedrawQueue = () => {\n redrawQueue.forEach((item: () => void) => {\n item();\n });\n\n redrawQueue.clear();\n redrawQueueTimeout = false;\n};\n","import { componentMap, getComponentKey } from '@/utils/universalRef';\n\nimport { useUpdated } from '@/hook/useUpdate';\n\nexport const updateCallback = (\n effectAction: () => (() => void) | void,\n dependencies: () => any[] = () => []\n) => {\n const updateReqs = componentMap.get(getComponentKey())!.upR;\n\n updateReqs.push(() => useUpdated(effectAction, dependencies));\n useUpdated(effectAction, dependencies);\n};\n\nexport const runUpdateCallback = () => {\n const updateReqs = componentMap.get(getComponentKey())?.upR;\n\n if (updateReqs?.length) {\n updateReqs.forEach(callback => callback());\n }\n};\n","import {\n WDom,\n TagFunction,\n FragmentFunction,\n Props,\n MiddleStateWDomChildren,\n MiddleStateWDom,\n NodePointer,\n Component,\n} from '@/types';\n\nimport { makeNewWDomTree } from '@/diff';\nimport { wDomUpdate } from '@/render';\nimport {\n initUpdateHookState,\n initMountHookState,\n needDiffRef,\n getComponentSubInfo,\n wdomSymbol,\n} from '@/utils/universalRef';\nimport { setRedrawAction, componentUpdate } from '@/utils/redraw';\nimport { runUpdateCallback } from '@/hook/updateCallback';\nimport {\n checkFragmentFunction,\n checkCustemComponentFunction,\n} from '@/utils/predicator';\nimport { assign } from '@/utils';\n\n/**\n * It allows grouping multiple elements together.\n */\nexport const Fragment = (_props: Props, ...children: WDom[]) =>\n ({\n type: 'fragment',\n [wdomSymbol]: true,\n children,\n }) as WDom;\n\n/**\n * Element creation\n */\nexport const h = (\n tag: TagFunction | FragmentFunction | string,\n props: Props,\n ...children: MiddleStateWDomChildren\n) => {\n const nodeParentPointer: NodePointer = { value: undefined };\n const newProps = props || {};\n const newChildren = remakeChildren(nodeParentPointer, children);\n const node = makeNode(tag, newProps, newChildren);\n\n if (!checkCustemComponentFunction(node)) {\n nodeParentPointer.value = node;\n }\n\n return node;\n};\n\n/**\n * Enables portals\n */\nexport const portal = (wDom: WDom, portal: HTMLElement) => {\n return h('portal', { portal }, wDom);\n};\n\n/**\n * It helps with component creation.\n */\nexport const mount =\n <T>(component: Component<T>) =>\n (_props: T, _children?: MiddleStateWDomChildren) =>\n component;\n\n/**\n * It re-renders starting from a specific component.\n */\nexport const replaceWDom = (\n tag: TagFunction,\n props: Props,\n children: WDom[],\n originalWDom: WDom\n) => {\n if (originalWDom.isLegacy) {\n return;\n }\n needDiffRef.value = true;\n\n const newWDom = makeWDomResolver(tag, props, children);\n const newWDomTree = makeNewWDomTree(newWDom, originalWDom);\n const { isRoot, getParent, wrapElement, afterElement } = originalWDom;\n\n newWDomTree.getParent = getParent;\n\n if (!isRoot && getParent) {\n const brothers = getParent()?.children || [];\n const index = brothers.indexOf(originalWDom);\n\n brothers.splice(index, 1, newWDomTree);\n } else {\n newWDomTree.isRoot = true;\n newWDomTree.wrapElement = wrapElement;\n newWDomTree.afterElement = afterElement;\n }\n\n needDiffRef.value = false;\n\n wDomUpdate(newWDomTree);\n};\n\n/**\n * Create an intermediate step for diffing between the existing virtual DOM and the new one during re-rendering\n */\nconst makeWDomResolver = (tag: TagFunction, props: Props, children: WDom[]) => {\n const tagName = tag.name;\n const ctor = tag;\n // 리졸브는 컴포넌트를 새로 만든다.\n const resolve = (compKey = props) => {\n initMountHookState(compKey);\n\n const initialComponent = tag(props, children);\n const component =\n typeof initialComponent === 'function'\n ? initialComponent\n : () => () => initialComponent;\n const componentMaker = component(componentUpdate(compKey), props, children);\n\n const customNode = makeCustomNode(\n componentMaker,\n compKey,\n tag,\n props,\n children\n );\n\n return customNode;\n };\n\n return { tagName, ctor, props, children, resolve };\n};\n\n/**\n * Create the actual virtual DOM node from the component.\n */\nconst makeCustomNode = (\n componentMaker: (props: Props) => WDom,\n compKey: Props,\n tag: TagFunction,\n props: Props,\n children: WDom[]\n) => {\n let newCustomComponentMaker = componentMaker;\n let customNode = componentMaker(props);\n\n if (customNode.reRender) {\n newCustomComponentMaker = (newProps: Props): WDom => {\n const customNode = componentMaker(newProps);\n const newNode = Fragment({}, customNode);\n\n customNode.getParent = () => newNode;\n\n return newNode;\n };\n\n customNode = newCustomComponentMaker(props);\n }\n\n const reRender = makeReRender(\n newCustomComponentMaker,\n compKey,\n tag,\n props,\n children\n );\n\n addComponentProps(customNode, compKey, tag, props, children, reRender);\n\n return customNode;\n};\n\n/**\n * When the virtual DOM is actually created from the component, generate a re-render method for future redraws.\n */\nconst makeReRender = (\n componentMaker: (props: Props) => WDom,\n compKey: Props,\n tag: TagFunction,\n props: Props,\n children: WDom[]\n) => {\n const reRender = () =>\n wDomMaker(componentMaker, compKey, tag, props, children, reRender);\n return reRender;\n};\n\n/**\n * The starting point for redrawing from the re-render method\n */\nconst wDomMaker = (\n componentMaker: (props: Props) => WDom,\n compKey: Props,\n tag: TagFunction,\n props: Props,\n children: WDom[],\n reRender: () => WDom\n) => {\n initUpdateHookState(compKey);\n runUpdateCallback();\n\n const customNode = componentMaker(props);\n\n addComponentProps(customNode, compKey, tag, props, children, reRender);\n\n return customNode;\n};\n\n/**\n * When creating a custom component node, attach additional information attributes to the virtual DOM object.\n */\nconst addComponentProps = (\n wDom: WDom,\n compKey: Props,\n tag: TagFunction,\n props: Props,\n children: WDom[],\n reRender: () => WDom\n) => {\n assign(wDom, {\n compProps: props,\n compChild: children,\n ctor: tag,\n tagName: tag.name,\n compKey,\n reRender,\n });\n\n setRedrawAction(compKey, () => replaceWDom(tag, props, children, wDom));\n\n if (getComponentSubInfo(compKey, 'vd')) {\n (getComponentSubInfo(compKey, 'vd') as { value: WDom }).value = wDom;\n }\n};\n\n/**\n * The starting point where the virtual DOM is created from the h function.\n */\nconst makeNode = (\n tag: TagFunction | FragmentFunction | string,\n props: Props,\n children: WDom[]\n) => {\n if (checkFragmentFunction(tag)) {\n return Fragment(props, ...children);\n } else if (checkCustemComponentFunction(tag)) {\n const componetMakeResolver = makeWDomResolver(tag, props, children);\n\n return needDiffRef.value\n ? componetMakeResolver\n : componetMakeResolver.resolve();\n }\n\n return {\n type: 'element',\n [wdomSymbol]: true,\n tag,\n props,\n children,\n } as WDom;\n};\n\n/**\n * The starting point for recursively processing the child virtual DOM elements.\n */\nconst remakeChildren = (\n nodeParentPointer: NodePointer,\n children: MiddleStateWDomChildren\n): WDom[] =>\n children.map((item: MiddleStateWDom) =>\n assign(makeChildrenItem(item), { getParent: () => nodeParentPointer.value })\n );\n\n/**\n * Recursively process the child virtual DOM elements.\n */\nconst makeChildrenItem = (item: MiddleStateWDom): WDom => {\n if (item === null || item === undefined || item === false) {\n return { type: null, [wdomSymbol]: true } as WDom;\n } else if (Array.isArray(item)) {\n const nodeParentPointer: NodePointer = { value: undefined };\n const children = remakeChildren(nodeParentPointer, item);\n const node = {\n type: 'loop',\n [wdomSymbol]: true,\n children,\n } as WDom;\n nodeParentPointer.value = node;\n\n return node;\n } else if (typeof item === 'string' || typeof item === 'number') {\n return { type: 'text', [wdomSymbol]: true, text: item } as WDom;\n }\n\n return item;\n};\n","export const ref = <T>(initValue: T) => ({ value: initValue });\nexport const nextTick = () => Promise.resolve();\n"],"names":["checkPlainWDomType","wDom","checkPlainType","typeName","checkSameCustomComponent","newWDom","originalWDom","checkSameFragment","_a","_b","checkSameTagElement","checkNormalTypeElement","checkLoopTypeElement","checkExisty","getKey","target","checkVirtualType","type","checkCustemComponentFunction","checkFragmentFunction","Fragment","checkEmptyElement","value","checkStyleData","dataKey","dataValue","checkRefData","hasAccessorMethods","descriptor","getWDomType","result","checkSameWDomWithOriginal","wdomSymbol","xmlnsRef","compKeyRef","needDiffRef","componentMap","setComponetRef","compKey","getComponentKey","getComponentSubInfo","subKey","initUpdateHookState","initMountHookState","getParent","vDom","entries","keys","assign","isPropType","obj","unmount","effectAction","runUnmountQueueFromWDom","removeItem","recursiveRunUnmount","item","subInfo","effect","mountedQueue","execMountedQueue","runMountedQueueFromWDom","addMountedQueue","mountCallback","component","queue","sequence","callback","useUpdated","dependencies","upD","upS","def","checkNeedPushQueue","runUpdatedQueueFromWDom","originalDefs","newDefs","index","getAttrKey","keyName","getEventName","eventKey","_match","p1","DF","CE","t","render","wrapElement","afterElement","isHydration","Dom","wDomToDom","recursiveRemoveEvent","rootDelete","wDomUpdate","newWDomTree","needRerender","typeAdd","typeDelete","typeReplace","typeUpdate","typeSortedReplace","typeSortedUpdate","removeEvent","childItem","deleteRealDom","findRealParentElement","parent","findChildWithRemoveElement","nodeType","newElement","getElementFromFragment","parentWDom","parentEl","nextEl","startFindNextBrotherElement","acc","element","brothers","nextIndex","candidiateBrothers","finedNextEl","findChildFragmentNextElement","parentType","targetEl","bItem","el","isFragment","orignalElement","parentElement","oldProps","updateText","props","updateProps","originalProps","updateEvent","updateStyle","setAttr","tag","text","children","isVirtualType","wDomChildrenToDom","elementChildren","childElement","newEventHandler","oldEventHandler","eventName","style","oldStyle","originalStyle","elementStyle","styleKey","makeNewWDomTree","remakeNewWDom","isSameType","remakeWDom","generalize","param","addReRenderTypeProperty","isNoting","remakeChildrenForDiff","inheritPropForRender","existOriginalWDom","isEmptyElement","isRoot","originalParentWDom","origParentType","key","isKeyCheckedWDom","isSameText","isSameWDom","chkDiffLoopOrder","origChildren","newChildren","newItem","filteredChildren","isSame","infoProps","updateChildren","infoChidren","childrenItem","runUpdate","infoVdom","remakeChildrenForUpdate","remakeChildrenForAdd","remakeChildrenForLoopUpdate","remakedChildren","unUsedChildren","diffLoopChildren","unusedItem","originalChildren","originalItem","findSameKeyOriginalItem","orignalChildItem","redrawQueue","redrawQueueTimeout","setRedrawAction","exec","execRedrawQueue","componentUpdate","up","updateCallback","runUpdateCallback","updateReqs","_props","h","nodeParentPointer","newProps","remakeChildren","node","makeNode","portal","mount","_children","replaceWDom","makeWDomResolver","initialComponent","componentMaker","makeCustomNode","newCustomComponentMaker","customNode","newNode","reRender","makeReRender","addComponentProps","wDomMaker","componetMakeResolver","makeChildrenItem","ref","initValue","nextTick"],"mappings":"AAoBA,MAAMA,IAAqB,CAACC,MAC1B,OAAOA,KAAS,YAAY,EAAE,aAAaA,IAEvCC,IAAiB,CAACD,GAAiBE,MACvCH,EAAmBC,CAAI,KAAKA,EAAK,SAASE,GAEtCC,KAA2B,CAC/BC,GACAC,MAEA,UAAUD,IACNA,EAAQ,UAASC,KAAA,gBAAAA,EAAc,QAC/BD,OAAYC,KAAA,gBAAAA,EAAc,OAE1BC,KAAoB,CACxBF,GACAC,MAEA;AAlBF,MAAAE,GAAAC;AAkBE,SAAAT,EAAmBK,CAAO,MAC1BC,KAAA,gBAAAA,EAAc,UAAS,gBACvBE,IAAAF,KAAA,gBAAAA,EAAc,aAAd,gBAAAE,EAAwB,cAAWC,IAAAJ,KAAA,gBAAAA,EAAS,aAAT,gBAAAI,EAAmB;AAAA,GAElDC,KAAsB,CAC1BL,GACAC,MAEA;AA1BF,MAAAE,GAAAC;AA0BE,SAAAT,EAAmBK,CAAO,MAC1BC,KAAA,gBAAAA,EAAc,UAAS,cACvBA,KAAA,gBAAAA,EAAc,SAAQD,EAAQ,SAC9BG,IAAAF,KAAA,gBAAAA,EAAc,aAAd,gBAAAE,EAAwB,cAAWC,IAAAJ,KAAA,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