lithent 1.16.0 → 1.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -15
- package/dist/diff.d.ts +1 -1
- package/dist/lithent.mjs.map +1 -1
- package/dist/lithent.umd.js.map +1 -1
- package/dist/wDom.d.ts +4 -4
- package/jsx-runtime/dist/index.d.ts +10 -0
- package/jsx-runtime/dist/jsxRuntime.mjs +17 -0
- package/jsx-runtime/dist/jsxRuntime.mjs.map +1 -0
- package/jsx-runtime/dist/jsxRuntime.umd.js +2 -0
- package/jsx-runtime/dist/jsxRuntime.umd.js.map +1 -0
- package/jsx-runtime/package.json +35 -0
- package/jsx-runtime/src/index.ts +34 -0
- package/package.json +25 -11
- package/src/diff.ts +15 -15
- package/src/wDom.ts +14 -14
package/README.md
CHANGED
|
@@ -28,6 +28,7 @@ used lightly in a variety of situations.
|
|
|
28
28
|
- [Thanks for the introduction](#thanks-for-the-introduction)
|
|
29
29
|
- [Why Use Lithent](#why-use-lithent)
|
|
30
30
|
- [Basic Guide](#basic-guide)
|
|
31
|
+
- [Lithent Ssr Boilerplate](#lithent-ssr-boilerplate)
|
|
31
32
|
- [How To Install](#how-to-install)
|
|
32
33
|
- [Use NPM](#use-npm)
|
|
33
34
|
- [Use CDN](#or-use-cdn)
|
|
@@ -68,6 +69,17 @@ JavaScript users are used to using closures and love to develop with them.
|
|
|
68
69
|
|
|
69
70
|
- https://superlucky84.github.io/lithent/
|
|
70
71
|
|
|
72
|
+
## Lithent Ssr Boilerplate
|
|
73
|
+
|
|
74
|
+
`Lithent-Ssr-Boilerplate` is a boilerplate designed for building server-side rendering (SSR) websites using the [Lithent](https://superlucky84.github.io/lithent/) UI library.
|
|
75
|
+
|
|
76
|
+
* [README](https://github.com/superlucky84/lithent/tree/master/createLithent#readme)
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npx create-lithent-ssr@latest
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
|
|
71
83
|
## How To Install
|
|
72
84
|
|
|
73
85
|
#### Use NPM
|
|
@@ -78,14 +90,14 @@ pnpm add lithent
|
|
|
78
90
|
|
|
79
91
|
#### Or Use CDN
|
|
80
92
|
|
|
81
|
-
* UMD : https://cdn.jsdelivr.net/npm/lithent@1.
|
|
82
|
-
* UMD-HELPER: https://cdn.jsdelivr.net/npm/lithent@1.
|
|
83
|
-
* UMD-FTAGS: https://cdn.jsdelivr.net/npm/lithent@1.
|
|
84
|
-
* UMD-TAG: https://cdn.jsdelivr.net/npm/lithent@1.
|
|
85
|
-
* ESM : https://cdn.jsdelivr.net/npm/lithent@1.
|
|
86
|
-
* ESM-HELPER: https://cdn.jsdelivr.net/npm/lithent@1.
|
|
87
|
-
* ESM-FTAGS: https://cdn.jsdelivr.net/npm/lithent@1.
|
|
88
|
-
* ESM-TAG: https://cdn.jsdelivr.net/npm/lithent@1.
|
|
93
|
+
* UMD : https://cdn.jsdelivr.net/npm/lithent@1.17.2/dist/lithent.umd.js
|
|
94
|
+
* UMD-HELPER: https://cdn.jsdelivr.net/npm/lithent@1.17.2/helper/dist/lithentHelper.umd.js
|
|
95
|
+
* UMD-FTAGS: https://cdn.jsdelivr.net/npm/lithent@1.17.2/ftags/dist/lithentFTags.umd.js
|
|
96
|
+
* UMD-TAG: https://cdn.jsdelivr.net/npm/lithent@1.17.2/tag/dist/lithentTag.umd.js
|
|
97
|
+
* ESM : https://cdn.jsdelivr.net/npm/lithent@1.17.2/dist/lithent.mjs
|
|
98
|
+
* ESM-HELPER: https://cdn.jsdelivr.net/npm/lithent@1.17.2/helper/dist/lithentHelper.mjs
|
|
99
|
+
* ESM-FTAGS: https://cdn.jsdelivr.net/npm/lithent@1.17.2/ftags/dist/lithentFTags.mjs
|
|
100
|
+
* ESM-TAG: https://cdn.jsdelivr.net/npm/lithent@1.17.2/tag/dist/lithentTag.mjs
|
|
89
101
|
|
|
90
102
|
|
|
91
103
|
It's easier to use lithent with JSX or HTM.
|
|
@@ -110,9 +122,9 @@ import { fTags, fFragment, fMount } from 'lithent/ftags';
|
|
|
110
122
|
const { section, div, p, br, strong } = fTags;
|
|
111
123
|
|
|
112
124
|
/* UMD
|
|
113
|
-
<script src="https://cdn.jsdelivr.net/npm/lithent@1.
|
|
114
|
-
<script src="https://cdn.jsdelivr.net/npm/lithent@1.
|
|
115
|
-
<script src="https://cdn.jsdelivr.net/npm/lithent@1.
|
|
125
|
+
<script src="https://cdn.jsdelivr.net/npm/lithent@1.17.2/dist/lithent.umd.js"></script>
|
|
126
|
+
<script src="https://cdn.jsdelivr.net/npm/lithent@1.17.2/helper/dist/lithentHelper.umd.js"></script>
|
|
127
|
+
<script src="https://cdn.jsdelivr.net/npm/lithent@1.17.2/ftags/dist/lithentFTags.umd.js"></script>
|
|
116
128
|
|
|
117
129
|
const { render } = lithent;
|
|
118
130
|
const { fTags, fMount, fFragment } = lithentFTags;
|
|
@@ -185,10 +197,10 @@ const destroy = render(lTag`<${Component} />`, document.getElementById('root'),
|
|
|
185
197
|
#### With UMD
|
|
186
198
|
|
|
187
199
|
```html
|
|
188
|
-
<script src="https://cdn.jsdelivr.net/npm/lithent@1.
|
|
189
|
-
<!--script src="https://cdn.jsdelivr.net/npm/lithent@1.
|
|
190
|
-
<script src="https://cdn.jsdelivr.net/npm/lithent@1.
|
|
191
|
-
<!--script src="https://cdn.jsdelivr.net/npm/lithent@1.
|
|
200
|
+
<script src="https://cdn.jsdelivr.net/npm/lithent@1.17.2/dist/lithent.umd.js"></script>
|
|
201
|
+
<!--script src="https://cdn.jsdelivr.net/npm/lithent@1.17.2/helper/dist/lithentHelper.umd.js"></script-->
|
|
202
|
+
<script src="https://cdn.jsdelivr.net/npm/lithent@1.17.2/tag/dist/lithentTag.umd.js"></script>
|
|
203
|
+
<!--script src="https://cdn.jsdelivr.net/npm/lithent@1.17.2/ftags/dist/lithentFTags.umd.js"></script-->
|
|
192
204
|
|
|
193
205
|
<div id="root"></div>
|
|
194
206
|
|
package/dist/diff.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WDom, TagFunctionResolver } from './types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* The starting point of the diffing process between the original virtual DOM and the new virtual DOM for re-rendering.
|
|
4
4
|
*/
|
|
5
5
|
export declare const makeNewWDomTree: (newWDom: WDom | TagFunctionResolver, originalWDom?: WDom) => WDom;
|
package/dist/lithent.mjs.map
CHANGED
|
@@ -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 { ComponentRef, 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 componentRef: ComponentRef = new WeakMap();\n\nconst setComponetRef = (compKey: Props) => {\n componentRef.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 (componentRef.get(compKey)) {\n return componentRef.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 { componentRef, getComponentKey } from '@/utils/universalRef';\n\nexport const unmount = (effectAction: () => void) => {\n componentRef.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 = componentRef.get(compKey);\n if (subInfo) {\n subInfo!.umts.forEach(effect => effect());\n subInfo!.umts = [];\n componentRef.delete(compKey);\n }\n};\n","import { WDom } from '@/types';\nimport {\n compKeyRef,\n componentRef,\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 (componentRef.get(getComponentKey())?.mts || []).push(effectAction);\n\nexport const runMountedQueueFromWDom = (newWDom: WDom) => {\n const { compKey } = newWDom;\n\n if (compKey) {\n const component = componentRef.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 componentRef,\n getComponentKey,\n} from '@/utils/universalRef';\n\nexport const useUpdated = (\n effectAction: () => (() => void) | void,\n dependencies: () => any[] = () => []\n) => {\n const component = componentRef.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 = componentRef.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 { componentRef, 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 = componentRef.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 * 원본 가상돔과 리랜더링을 위한 새로운 가상돔 diff 처리의 시작점\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 * 가상돔 비교후 새로운 가상돔 생성\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 * 새로운 가상돔이 원본 가상돔으로부터 물려받아야 하거나 청산할 것을 처리\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 * 새로운 가상돔이 실제돔으로 반영하기 위한 상태 정보 표기\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 * 재정렬하며 업데이트 해야 하는 타입일때 실제로 역순 위치 교환이 필요한지 체크\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 * 가상돔 속성 업데이트 처리\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 * 가상돔이 새로운 종류로 완전 교체되지 않고 단순 업데이트 될때 처리 시작\n * (새로운 상태가 반영되도록 props나 children 상태 반영)\n * (새로운 상태를 반영하면서도 props 나 children의 실제 참조가 변경되지 않도록 처리)\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 * 비교가 끝난 가상돔을 새로운 가상돔으로 교체하거나, 그냥 업데이트 시켜줌\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 * 새로운 가상돔 생을을 위한 재귀 처리\n */\nconst remakeChildrenForAdd = (newWDom: WDom) =>\n (newWDom.children || []).map((item: WDom) =>\n assign(makeNewWDomTree(item), { getParent: () => newWDom })\n );\n\n/**\n * 추가가 아닌 업데이트트 위한 재귀처리\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 * 반복문 타입의 가상돔 처리\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 * 반복문 타입의 가상돔의 재귀처리\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 * 반복문 타입의 가상돔의 비교처리를 할때 키를 참고하여 비교판단\n */\nconst findSameKeyOriginalItem = (item: WDom, originalChildren: WDom[]) =>\n originalChildren.find(\n orignalChildItem => getKey(orignalChildItem) === getKey(item)\n );\n","import { Props } from '@/types';\nimport { componentRef } from '@/utils/universalRef';\n\nconst redrawQueue = new Map<Props, () => void>();\nlet redrawQueueTimeout: boolean = false;\n\nexport const setRedrawAction = (compKey: Props, exec: () => void) => {\n if (componentRef.get(compKey)) {\n componentRef.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 = componentRef.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 { componentRef, 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 = componentRef.get(getComponentKey())!.upR;\n\n updateReqs.push(() => useUpdated(effectAction, dependencies));\n useUpdated(effectAction, dependencies);\n};\n\nexport const runUpdateCallback = () => {\n const updateReqs = componentRef.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 * 여러 요소를 그룹화 할수 있게 해준다.\n */\nexport const Fragment = (_props: Props, ...children: WDom[]) =>\n ({\n type: 'fragment',\n [wdomSymbol]: true,\n children,\n } as WDom);\n\n/**\n * 엘리먼트 생성 (createElement)\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 * 포털을 가능하게 해준다.\n */\nexport const portal = (wDom: WDom, portal: HTMLElement) => {\n return h('portal', { portal }, wDom);\n};\n\n/**\n * 컴포넌트 생성을 도와준다\n */\nexport const mount =\n <T>(component: Component<T>) =>\n (_props: T, _children?: MiddleStateWDomChildren) =>\n component;\n\n/**\n * 특정 컴포넌트부터 새로 그려준다.\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 * 가상돔을 리랜더링 할때 기존 가상돔과 diff를 위한 중간단계 생성\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 component = tag(props, children);\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 * 컴포넌트로 부터 실제 가상돔 노드를 만든다.\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 * 컴포넌트로 부터 실제로 가상돔이 만들어질때, 추후 다시그리기 위한 리랜더 메서드 생성\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 * 리렌더 메서드로 부터 다시그리기 위한 시작점\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 * 커스텀 컴포넌트 노드를만들때 가상돔 객체에 기타 정보 속성을 붙여준다\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 * h 함수로 부터 가상돔이 만들어지는 시작점\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 * 가상돔의 자식 가상돔들을 재귀 처리해주는 시작점\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 * 가상돔의 자식 가상돔들을 재귀 처리\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","componentRef","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","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,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AG,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,GC5Sa6K,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 { ComponentRef, 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 componentRef: ComponentRef = new WeakMap();\n\nconst setComponetRef = (compKey: Props) => {\n componentRef.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 (componentRef.get(compKey)) {\n return componentRef.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 { componentRef, getComponentKey } from '@/utils/universalRef';\n\nexport const unmount = (effectAction: () => void) => {\n componentRef.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 = componentRef.get(compKey);\n if (subInfo) {\n subInfo!.umts.forEach(effect => effect());\n subInfo!.umts = [];\n componentRef.delete(compKey);\n }\n};\n","import { WDom } from '@/types';\nimport {\n compKeyRef,\n componentRef,\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 (componentRef.get(getComponentKey())?.mts || []).push(effectAction);\n\nexport const runMountedQueueFromWDom = (newWDom: WDom) => {\n const { compKey } = newWDom;\n\n if (compKey) {\n const component = componentRef.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 componentRef,\n getComponentKey,\n} from '@/utils/universalRef';\n\nexport const useUpdated = (\n effectAction: () => (() => void) | void,\n dependencies: () => any[] = () => []\n) => {\n const component = componentRef.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 = componentRef.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 { componentRef, 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 = componentRef.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 { componentRef } from '@/utils/universalRef';\n\nconst redrawQueue = new Map<Props, () => void>();\nlet redrawQueueTimeout: boolean = false;\n\nexport const setRedrawAction = (compKey: Props, exec: () => void) => {\n if (componentRef.get(compKey)) {\n componentRef.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 = componentRef.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 { componentRef, 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 = componentRef.get(getComponentKey())!.upR;\n\n updateReqs.push(() => useUpdated(effectAction, dependencies));\n useUpdated(effectAction, dependencies);\n};\n\nexport const runUpdateCallback = () => {\n const updateReqs = componentRef.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 component = tag(props, children);\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","componentRef","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","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,gBAAAA,EAAS,aAAT,gBAAAI,EAAmB;AAAA,GAElDE,IAAyB,CAC7BN,GACAC,MACGN,EAAmBK,CAA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mBxJ,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,GC5Sa6K,KAAM,CAAIC,OAAkB,EAAE,OAAOA,EAAU,IAC/CC,KAAW,MAAM,QAAQ,QAAQ;"}
|
package/dist/lithent.umd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lithent.umd.js","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 { ComponentRef, 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 componentRef: ComponentRef = new WeakMap();\n\nconst setComponetRef = (compKey: Props) => {\n componentRef.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 (componentRef.get(compKey)) {\n return componentRef.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 { componentRef, getComponentKey } from '@/utils/universalRef';\n\nexport const unmount = (effectAction: () => void) => {\n componentRef.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 = componentRef.get(compKey);\n if (subInfo) {\n subInfo!.umts.forEach(effect => effect());\n subInfo!.umts = [];\n componentRef.delete(compKey);\n }\n};\n","import { WDom } from '@/types';\nimport {\n compKeyRef,\n componentRef,\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 (componentRef.get(getComponentKey())?.mts || []).push(effectAction);\n\nexport const runMountedQueueFromWDom = (newWDom: WDom) => {\n const { compKey } = newWDom;\n\n if (compKey) {\n const component = componentRef.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 componentRef,\n getComponentKey,\n} from '@/utils/universalRef';\n\nexport const useUpdated = (\n effectAction: () => (() => void) | void,\n dependencies: () => any[] = () => []\n) => {\n const component = componentRef.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 = componentRef.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 { componentRef, 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 = componentRef.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 * 원본 가상돔과 리랜더링을 위한 새로운 가상돔 diff 처리의 시작점\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 * 가상돔 비교후 새로운 가상돔 생성\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 * 새로운 가상돔이 원본 가상돔으로부터 물려받아야 하거나 청산할 것을 처리\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 * 새로운 가상돔이 실제돔으로 반영하기 위한 상태 정보 표기\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 * 재정렬하며 업데이트 해야 하는 타입일때 실제로 역순 위치 교환이 필요한지 체크\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 * 가상돔 속성 업데이트 처리\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 * 가상돔이 새로운 종류로 완전 교체되지 않고 단순 업데이트 될때 처리 시작\n * (새로운 상태가 반영되도록 props나 children 상태 반영)\n * (새로운 상태를 반영하면서도 props 나 children의 실제 참조가 변경되지 않도록 처리)\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 * 비교가 끝난 가상돔을 새로운 가상돔으로 교체하거나, 그냥 업데이트 시켜줌\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 * 새로운 가상돔 생을을 위한 재귀 처리\n */\nconst remakeChildrenForAdd = (newWDom: WDom) =>\n (newWDom.children || []).map((item: WDom) =>\n assign(makeNewWDomTree(item), { getParent: () => newWDom })\n );\n\n/**\n * 추가가 아닌 업데이트트 위한 재귀처리\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 * 반복문 타입의 가상돔 처리\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 * 반복문 타입의 가상돔의 재귀처리\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 * 반복문 타입의 가상돔의 비교처리를 할때 키를 참고하여 비교판단\n */\nconst findSameKeyOriginalItem = (item: WDom, originalChildren: WDom[]) =>\n originalChildren.find(\n orignalChildItem => getKey(orignalChildItem) === getKey(item)\n );\n","import { Props } from '@/types';\nimport { componentRef } from '@/utils/universalRef';\n\nconst redrawQueue = new Map<Props, () => void>();\nlet redrawQueueTimeout: boolean = false;\n\nexport const setRedrawAction = (compKey: Props, exec: () => void) => {\n if (componentRef.get(compKey)) {\n componentRef.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 = componentRef.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 { componentRef, 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 = componentRef.get(getComponentKey())!.upR;\n\n updateReqs.push(() => useUpdated(effectAction, dependencies));\n useUpdated(effectAction, dependencies);\n};\n\nexport const runUpdateCallback = () => {\n const updateReqs = componentRef.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 * 여러 요소를 그룹화 할수 있게 해준다.\n */\nexport const Fragment = (_props: Props, ...children: WDom[]) =>\n ({\n type: 'fragment',\n [wdomSymbol]: true,\n children,\n } as WDom);\n\n/**\n * 엘리먼트 생성 (createElement)\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 * 포털을 가능하게 해준다.\n */\nexport const portal = (wDom: WDom, portal: HTMLElement) => {\n return h('portal', { portal }, wDom);\n};\n\n/**\n * 컴포넌트 생성을 도와준다\n */\nexport const mount =\n <T>(component: Component<T>) =>\n (_props: T, _children?: MiddleStateWDomChildren) =>\n component;\n\n/**\n * 특정 컴포넌트부터 새로 그려준다.\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 * 가상돔을 리랜더링 할때 기존 가상돔과 diff를 위한 중간단계 생성\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 component = tag(props, children);\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 * 컴포넌트로 부터 실제 가상돔 노드를 만든다.\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 * 컴포넌트로 부터 실제로 가상돔이 만들어질때, 추후 다시그리기 위한 리랜더 메서드 생성\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 * 리렌더 메서드로 부터 다시그리기 위한 시작점\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 * 커스텀 컴포넌트 노드를만들때 가상돔 객체에 기타 정보 속성을 붙여준다\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 * h 함수로 부터 가상돔이 만들어지는 시작점\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 * 가상돔의 자식 가상돔들을 재귀 처리해주는 시작점\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 * 가상돔의 자식 가상돔들을 재귀 처리\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","componentRef","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","componentMaker","makeCustomNode","newCustomComponentMaker","customNode","newNode","reRender","makeReRender","addComponentProps","wDomMaker","componetMakeResolver","makeChildrenItem","ref","initValue","nextTick"],"mappings":"+NAoBA,MAAMA,EAAsBC,GAC1B,OAAOA,GAAS,UAAY,EAAE,YAAaA,GAEvCC,EAAiB,CAACD,EAAiBE,IACvCH,EAAmBC,CAAI,GAAKA,EAAK,OAASE,EAEtCC,GAA2B,CAC/BC,EACAC,IAEA,SAAUD,EACNA,EAAQ,QAASC,GAAA,YAAAA,EAAc,MAC/BD,KAAYC,GAAA,YAAAA,EAAc,MAE1BC,GAAoB,CACxBF,EACAC,IAEA,SAAA,OAAAN,EAAmBK,CAAO,IAC1BC,GAAA,YAAAA,EAAc,QAAS,cACvBE,EAAAF,GAAA,YAAAA,EAAc,WAAd,YAAAE,EAAwB,YAAWC,EAAAJ,GAAA,YAAAA,EAAS,WAAT,YAAAI,EAAmB,SAElDC,GAAsB,CAC1BL,EACAC,IAEA,SAAA,OAAAN,EAAmBK,CAAO,IAC1BC,GAAA,YAAAA,EAAc,QAAS,YACvBA,GAAA,YAAAA,EAAc,OAAQD,EAAQ,OAC9BG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,CAAI,CAAA,EAGhDuC,EAAoBF,EAAS,IAAI,IAClCE,EAAoBF,EAAS,IAAI,EAAsB,MAAQrC,EAEpE,EAKMmN,GAAW,CACfzE,EACAN,EACAQ,IACG,CACC,GAAA1H,EAAsBwH,CAAG,EACpB,OAAAvH,EAASiH,EAAO,GAAGQ,CAAQ,EACpC,GAAW3H,EAA6ByH,CAAG,EAAG,CAC5C,MAAMwF,EAAuBV,GAAiB9E,EAAKN,EAAOQ,CAAQ,EAElE,OAAO1G,EAAY,MACfgM,EACAA,EAAqB,QAAQ,CACnC,CAEO,MAAA,CACL,KAAM,UACN,CAACnM,CAAU,EAAG,GACd,IAAA2G,EACA,MAAAN,EACA,SAAAQ,CAAA,CAEJ,EAKMqE,GAAiB,CACrBF,EACAnE,IAEAA,EAAS,IAAKrF,GACZR,EAAOoL,GAAiB5K,CAAI,EAAG,CAAE,UAAW,IAAMwJ,EAAkB,MAAO,CAC7E,EAKIoB,GAAoB5K,GAAgC,CACxD,GAAIA,GAAS,MAA8BA,IAAS,GAClD,MAAO,CAAE,KAAM,KAAM,CAACxB,CAAU,EAAG,EAAK,EAC/B,GAAA,MAAM,QAAQwB,CAAI,EAAG,CACxB,MAAAwJ,EAAiC,CAAE,MAAO,MAAU,EACpDnE,EAAWqE,GAAeF,EAAmBxJ,CAAI,EACjD2J,EAAO,CACX,KAAM,OACN,CAACnL,CAAU,EAAG,GACd,SAAA6G,CAAA,EAEF,OAAAmE,EAAkB,MAAQG,EAEnBA,UACE,OAAO3J,GAAS,UAAY,OAAOA,GAAS,SAC9C,MAAA,CAAE,KAAM,OAAQ,CAACxB,CAAU,EAAG,GAAM,KAAMwB,GAG5C,OAAAA,CACT,EC5Sa6K,GAAUC,IAAkB,CAAE,MAAOA,CAAU,GAC/CC,GAAW,IAAM,QAAQ,QAAQ"}
|
|
1
|
+
{"version":3,"file":"lithent.umd.js","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 { ComponentRef, 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 componentRef: ComponentRef = new WeakMap();\n\nconst setComponetRef = (compKey: Props) => {\n componentRef.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 (componentRef.get(compKey)) {\n return componentRef.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 { componentRef, getComponentKey } from '@/utils/universalRef';\n\nexport const unmount = (effectAction: () => void) => {\n componentRef.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 = componentRef.get(compKey);\n if (subInfo) {\n subInfo!.umts.forEach(effect => effect());\n subInfo!.umts = [];\n componentRef.delete(compKey);\n }\n};\n","import { WDom } from '@/types';\nimport {\n compKeyRef,\n componentRef,\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 (componentRef.get(getComponentKey())?.mts || []).push(effectAction);\n\nexport const runMountedQueueFromWDom = (newWDom: WDom) => {\n const { compKey } = newWDom;\n\n if (compKey) {\n const component = componentRef.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 componentRef,\n getComponentKey,\n} from '@/utils/universalRef';\n\nexport const useUpdated = (\n effectAction: () => (() => void) | void,\n dependencies: () => any[] = () => []\n) => {\n const component = componentRef.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 = componentRef.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 { componentRef, 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 = componentRef.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 { componentRef } from '@/utils/universalRef';\n\nconst redrawQueue = new Map<Props, () => void>();\nlet redrawQueueTimeout: boolean = false;\n\nexport const setRedrawAction = (compKey: Props, exec: () => void) => {\n if (componentRef.get(compKey)) {\n componentRef.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 = componentRef.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 { componentRef, 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 = componentRef.get(getComponentKey())!.upR;\n\n updateReqs.push(() => useUpdated(effectAction, dependencies));\n useUpdated(effectAction, dependencies);\n};\n\nexport const runUpdateCallback = () => {\n const updateReqs = componentRef.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 component = tag(props, children);\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","componentRef","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","componentMaker","makeCustomNode","newCustomComponentMaker","customNode","newNode","reRender","makeReRender","addComponentProps","wDomMaker","componetMakeResolver","makeChildrenItem","ref","initValue","nextTick"],"mappings":"+NAoBA,MAAMA,EAAsBC,GAC1B,OAAOA,GAAS,UAAY,EAAE,YAAaA,GAEvCC,EAAiB,CAACD,EAAiBE,IACvCH,EAAmBC,CAAI,GAAKA,EAAK,OAASE,EAEtCC,GAA2B,CAC/BC,EACAC,IAEA,SAAUD,EAC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CAAI,EACjD2J,EAAO,CACX,KAAM,OACN,CAACnL,CAAU,EAAG,GACd,SAAA6G,CAAA,EAEF,OAAAmE,EAAkB,MAAQG,EAEnBA,UACE,OAAO3J,GAAS,UAAY,OAAOA,GAAS,SAC9C,MAAA,CAAE,KAAM,OAAQ,CAACxB,CAAU,EAAG,GAAM,KAAMwB,GAG5C,OAAAA,CACT,EC5Sa6K,GAAUC,IAAkB,CAAE,MAAOA,CAAU,GAC/CC,GAAW,IAAM,QAAQ,QAAQ"}
|
package/dist/wDom.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { WDom, TagFunction, FragmentFunction, Props, MiddleStateWDomChildren, Component } from './types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* It allows grouping multiple elements together.
|
|
4
4
|
*/
|
|
5
5
|
export declare const Fragment: (_props: Props, ...children: WDom[]) => WDom;
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Element creation
|
|
8
8
|
*/
|
|
9
9
|
export declare const h: (tag: TagFunction | FragmentFunction | string, props: Props, ...children: MiddleStateWDomChildren) => WDom | {
|
|
10
10
|
tagName: string;
|
|
@@ -14,7 +14,7 @@ export declare const h: (tag: TagFunction | FragmentFunction | string, props: Pr
|
|
|
14
14
|
resolve: (compKey?: Props) => WDom;
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Enables portals
|
|
18
18
|
*/
|
|
19
19
|
export declare const portal: (wDom: WDom, portal: HTMLElement) => WDom | {
|
|
20
20
|
tagName: string;
|
|
@@ -24,6 +24,6 @@ export declare const portal: (wDom: WDom, portal: HTMLElement) => WDom | {
|
|
|
24
24
|
resolve: (compKey?: Props) => WDom;
|
|
25
25
|
};
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* It helps with component creation.
|
|
28
28
|
*/
|
|
29
29
|
export declare const mount: <T>(component: Component<T>) => (_props: T, _children?: MiddleStateWDomChildren) => Component<T>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Fragment } from 'lithent';
|
|
2
|
+
import type { Props, TagFunction, FragmentFunction } from 'lithent';
|
|
3
|
+
declare function createWNode(type: TagFunction | FragmentFunction | string, orgProps: Props, key: unknown, _isStaticChildren: boolean, _source: unknown, _self: unknown): import("lithent").WDom | {
|
|
4
|
+
tagName: string;
|
|
5
|
+
ctor: TagFunction;
|
|
6
|
+
props: Props;
|
|
7
|
+
children: import("lithent").WDom[];
|
|
8
|
+
resolve: (compKey?: Props | undefined) => import("lithent").WDom;
|
|
9
|
+
};
|
|
10
|
+
export { createWNode as jsx, createWNode as jsxs, createWNode as jsxDEV, Fragment, };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { h as o } from "lithent";
|
|
2
|
+
import { Fragment as m } from "lithent";
|
|
3
|
+
function d(s, t, e, a, c, f) {
|
|
4
|
+
const { children: r, ...n } = t;
|
|
5
|
+
if (r) {
|
|
6
|
+
const i = Array.isArray(r) ? r : [r];
|
|
7
|
+
return o(s, { ...n, key: e }, ...i);
|
|
8
|
+
}
|
|
9
|
+
return o(s, { ...n, key: e });
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
m as Fragment,
|
|
13
|
+
d as jsx,
|
|
14
|
+
d as jsxDEV,
|
|
15
|
+
d as jsxs
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=jsxRuntime.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsxRuntime.mjs","sources":["../src/index.ts"],"sourcesContent":["import { h, Fragment } from 'lithent';\nimport type {\n Props,\n TagFunction,\n FragmentFunction,\n MiddleStateWDomChildren,\n} from 'lithent';\n\nfunction createWNode(\n type: TagFunction | FragmentFunction | string,\n orgProps: Props,\n key: unknown,\n _isStaticChildren: boolean,\n _source: unknown,\n _self: unknown\n) {\n const { children, ...props } = orgProps;\n if (children) {\n const newChildren: MiddleStateWDomChildren = !Array.isArray(children)\n ? [children]\n : children;\n\n return h(type, { ...props, key } as Props, ...newChildren);\n }\n\n return h(type, { ...props, key } as Props);\n}\n\nexport {\n createWNode as jsx,\n createWNode as jsxs,\n createWNode as jsxDEV,\n Fragment,\n};\n"],"names":["createWNode","type","orgProps","key","_isStaticChildren","_source","_self","children","props","newChildren","h"],"mappings":";;AAQA,SAASA,EACPC,GACAC,GACAC,GACAC,GACAC,GACAC,GACA;AACA,QAAM,EAAE,UAAAC,GAAU,GAAGC,EAAA,IAAUN;AAC/B,MAAIK,GAAU;AACN,UAAAE,IAAwC,MAAM,QAAQF,CAAQ,IAEhEA,IADA,CAACA,CAAQ;AAGN,WAAAG,EAAET,GAAM,EAAE,GAAGO,GAAO,KAAAL,EAAI,GAAY,GAAGM,CAAW;AAAA,EAC3D;AAEA,SAAOC,EAAET,GAAM,EAAE,GAAGO,GAAO,KAAAL,EAAc,CAAA;AAC3C;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(function(e,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("lithent")):typeof define=="function"&&define.amd?define(["exports","lithent"],n):(e=typeof globalThis<"u"?globalThis:e||self,n(e.jsxRuntime={},e.lithent))})(this,function(e,n){"use strict";function i(r,d,s,o,c,h){const{children:t,...u}=d;if(t){const f=Array.isArray(t)?t:[t];return n.h(r,{...u,key:s},...f)}return n.h(r,{...u,key:s})}Object.defineProperty(e,"Fragment",{enumerable:!0,get:()=>n.Fragment}),e.jsx=i,e.jsxDEV=i,e.jsxs=i,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|
|
2
|
+
//# sourceMappingURL=jsxRuntime.umd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsxRuntime.umd.js","sources":["../src/index.ts"],"sourcesContent":["import { h, Fragment } from 'lithent';\nimport type {\n Props,\n TagFunction,\n FragmentFunction,\n MiddleStateWDomChildren,\n} from 'lithent';\n\nfunction createWNode(\n type: TagFunction | FragmentFunction | string,\n orgProps: Props,\n key: unknown,\n _isStaticChildren: boolean,\n _source: unknown,\n _self: unknown\n) {\n const { children, ...props } = orgProps;\n if (children) {\n const newChildren: MiddleStateWDomChildren = !Array.isArray(children)\n ? [children]\n : children;\n\n return h(type, { ...props, key } as Props, ...newChildren);\n }\n\n return h(type, { ...props, key } as Props);\n}\n\nexport {\n createWNode as jsx,\n createWNode as jsxs,\n createWNode as jsxDEV,\n Fragment,\n};\n"],"names":["createWNode","type","orgProps","key","_isStaticChildren","_source","_self","children","props","newChildren","h"],"mappings":"2QAQA,SAASA,EACPC,EACAC,EACAC,EACAC,EACAC,EACAC,EACA,CACA,KAAM,CAAE,SAAAC,EAAU,GAAGC,CAAA,EAAUN,EAC/B,GAAIK,EAAU,CACN,MAAAE,EAAwC,MAAM,QAAQF,CAAQ,EAEhEA,EADA,CAACA,CAAQ,EAGN,OAAAG,EAAAA,EAAET,EAAM,CAAE,GAAGO,EAAO,IAAAL,CAAI,EAAY,GAAGM,CAAW,CAC3D,CAEA,OAAOC,EAAAA,EAAET,EAAM,CAAE,GAAGO,EAAO,IAAAL,CAAc,CAAA,CAC3C"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "module",
|
|
3
|
+
"name": "jsx-runtime",
|
|
4
|
+
"version": "0.21.0",
|
|
5
|
+
"description": "Lithent JSX runtime",
|
|
6
|
+
"private": true,
|
|
7
|
+
"packageManager": "pnpm@7.6.0",
|
|
8
|
+
"main": "./dist/jsxRuntime.umd.js",
|
|
9
|
+
"module": "./dist/jsxRuntime.mjs",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"dev": "vite",
|
|
13
|
+
"test": "vitest run --reporter verbose",
|
|
14
|
+
"test:dev": "vitest",
|
|
15
|
+
"watch": "vite build --watch",
|
|
16
|
+
"build": "vite build"
|
|
17
|
+
},
|
|
18
|
+
"author": "",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https@github.com:superlucky84/lithent.git"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/superlucky84/lithent",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"keywords": ["lithent"],
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"lithent": "workspace:*"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"lithent": "^1.0.0"
|
|
31
|
+
},
|
|
32
|
+
"volta": {
|
|
33
|
+
"node": "20.3.0"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { h, Fragment } from 'lithent';
|
|
2
|
+
import type {
|
|
3
|
+
Props,
|
|
4
|
+
TagFunction,
|
|
5
|
+
FragmentFunction,
|
|
6
|
+
MiddleStateWDomChildren,
|
|
7
|
+
} from 'lithent';
|
|
8
|
+
|
|
9
|
+
function createWNode(
|
|
10
|
+
type: TagFunction | FragmentFunction | string,
|
|
11
|
+
orgProps: Props,
|
|
12
|
+
key: unknown,
|
|
13
|
+
_isStaticChildren: boolean,
|
|
14
|
+
_source: unknown,
|
|
15
|
+
_self: unknown
|
|
16
|
+
) {
|
|
17
|
+
const { children, ...props } = orgProps;
|
|
18
|
+
if (children) {
|
|
19
|
+
const newChildren: MiddleStateWDomChildren = !Array.isArray(children)
|
|
20
|
+
? [children]
|
|
21
|
+
: children;
|
|
22
|
+
|
|
23
|
+
return h(type, { ...props, key } as Props, ...newChildren);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return h(type, { ...props, key } as Props);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
createWNode as jsx,
|
|
31
|
+
createWNode as jsxs,
|
|
32
|
+
createWNode as jsxDEV,
|
|
33
|
+
Fragment,
|
|
34
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "lithent",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.17.2",
|
|
5
5
|
"description": "An extensible virtual DOM library for lightweight use in a variety of environments.",
|
|
6
6
|
"packageManager": "pnpm@9.12.3",
|
|
7
7
|
"main": "./dist/lithent.umd.js",
|
|
@@ -15,13 +15,14 @@
|
|
|
15
15
|
"dev:docs": "pnpm watch:core & pnpm watch:helper & pnpm --filter lithent-docs dev",
|
|
16
16
|
"build:core": "vite build",
|
|
17
17
|
"build:helper": "pnpm --filter lithent-helper build",
|
|
18
|
+
"build:jsxruntime": "pnpm --filter jsx-runtime build",
|
|
18
19
|
"build:ssr": "pnpm --filter lithent-ssr build",
|
|
19
20
|
"build:tag": "pnpm --filter lithent-tag build",
|
|
20
21
|
"build:ftags": "pnpm --filter lithent-ftags build",
|
|
21
22
|
"build:examples": "pnpm --filter lithent-examples build",
|
|
22
23
|
"build:docs": "pnpm --filter lithent-docs build",
|
|
23
|
-
"build:sequence": "pnpm build:core && pnpm build:helper && pnpm build:ssr",
|
|
24
|
-
"build:parallel": "pnpm --filter '!lithent-helper' --filter '!lithent-ssr' --filter '!create-lithent-ssr' build",
|
|
24
|
+
"build:sequence": "pnpm build:core && pnpm build:jsxruntime && pnpm build:helper && pnpm build:ssr",
|
|
25
|
+
"build:parallel": "pnpm --filter '!jsx-runtime' --filter '!lithent-helper' --filter '!lithent-ssr' --filter '!create-lithent-ssr' build",
|
|
25
26
|
"build": "pnpm run build:sequence && pnpm run build:parallel",
|
|
26
27
|
"watch:core": "vite build --watch",
|
|
27
28
|
"watch:helper": "pnpm --filter lithent-helper watch",
|
|
@@ -38,6 +39,16 @@
|
|
|
38
39
|
"import": "./dist/lithent.mjs",
|
|
39
40
|
"require": "./dist/lithent.umd.js"
|
|
40
41
|
},
|
|
42
|
+
"./jsx-runtime": {
|
|
43
|
+
"types": "./jsx-runtime/dist/index.d.ts",
|
|
44
|
+
"import": "./jsx-runtime/dist/jsxRuntime.mjs",
|
|
45
|
+
"require": "./jsx-runtime/dist/jsxRuntime.umd.js"
|
|
46
|
+
},
|
|
47
|
+
"./jsx-dev-runtime": {
|
|
48
|
+
"types": "./jsx-runtime/dist/index.d.ts",
|
|
49
|
+
"import": "./jsx-runtime/dist/jsxRuntime.mjs",
|
|
50
|
+
"require": "./jsx-runtime/dist/jsxRuntime.umd.js"
|
|
51
|
+
},
|
|
41
52
|
"./helper": {
|
|
42
53
|
"types": "./helper/dist/index.d.ts",
|
|
43
54
|
"import": "./helper/dist/lithentHelper.mjs",
|
|
@@ -63,6 +74,9 @@
|
|
|
63
74
|
"files": [
|
|
64
75
|
"src",
|
|
65
76
|
"dist",
|
|
77
|
+
"jsx-runtime/dist",
|
|
78
|
+
"jsx-runtime/src",
|
|
79
|
+
"jsx-runtime/package.json",
|
|
66
80
|
"helper/dist",
|
|
67
81
|
"helper/src",
|
|
68
82
|
"helper/package.json",
|
|
@@ -91,20 +105,20 @@
|
|
|
91
105
|
],
|
|
92
106
|
"devDependencies": {
|
|
93
107
|
"@testing-library/jest-dom": "^6.5.0",
|
|
94
|
-
"eslint": "^8.
|
|
95
|
-
"eslint
|
|
96
|
-
"eslint
|
|
108
|
+
"@typescript-eslint/eslint-plugin": "^8.17.0",
|
|
109
|
+
"@typescript-eslint/parser": "^8.17.0",
|
|
110
|
+
"eslint": "^9.16.0",
|
|
111
|
+
"eslint-config-prettier": "^9.1.0",
|
|
112
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
97
113
|
"happy-dom": "^9.20.3",
|
|
98
114
|
"jsdom": "^22.1.0",
|
|
99
|
-
"prettier": "^
|
|
115
|
+
"prettier": "^3.4.2",
|
|
100
116
|
"terser": "^5.18.1",
|
|
101
117
|
"typescript": "^5.6.3",
|
|
102
118
|
"vite": "^5.4.8",
|
|
103
|
-
"vite-plugin-checker": "^0.
|
|
119
|
+
"vite-plugin-checker": "^0.8.0",
|
|
104
120
|
"vite-plugin-dts": "^2.3.0",
|
|
105
|
-
"vitest": "^2.1.2"
|
|
106
|
-
"@typescript-eslint/eslint-plugin": "^8.12.2",
|
|
107
|
-
"@typescript-eslint/parser": "^8.12.2"
|
|
121
|
+
"vitest": "^2.1.2"
|
|
108
122
|
},
|
|
109
123
|
"volta": {
|
|
110
124
|
"node": "20.3.0",
|
package/src/diff.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { runUnmountQueueFromWDom } from '@/hook/unmount';
|
|
|
13
13
|
import { assign, keys, entries } from '@/utils';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* The starting point of the diffing process between the original virtual DOM and the new virtual DOM for re-rendering.
|
|
17
17
|
*/
|
|
18
18
|
export const makeNewWDomTree = (
|
|
19
19
|
newWDom: WDom | TagFunctionResolver,
|
|
@@ -26,7 +26,7 @@ export const makeNewWDomTree = (
|
|
|
26
26
|
);
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* Create a new virtual DOM after comparing with the previous virtual DOM
|
|
30
30
|
*/
|
|
31
31
|
const remakeNewWDom = (
|
|
32
32
|
newWDom: WDom | TagFunctionResolver,
|
|
@@ -58,7 +58,7 @@ const remakeNewWDom = (
|
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
|
-
*
|
|
61
|
+
* Handle what the new virtual DOM should inherit or reconcile from the original virtual DOM.
|
|
62
62
|
*/
|
|
63
63
|
const inheritPropForRender = (
|
|
64
64
|
remakeWDom: WDom,
|
|
@@ -81,7 +81,7 @@ const inheritPropForRender = (
|
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
|
-
*
|
|
84
|
+
* Indicate the state information for the new virtual DOM to be reflected in the real DOM.
|
|
85
85
|
*/
|
|
86
86
|
const addReRenderTypeProperty = (
|
|
87
87
|
newWDom: WDom,
|
|
@@ -127,7 +127,7 @@ const addReRenderTypeProperty = (
|
|
|
127
127
|
};
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
|
-
*
|
|
130
|
+
* Check if a reverse order swap is needed when updating types that require reordering.
|
|
131
131
|
*/
|
|
132
132
|
const chkDiffLoopOrder = (newWDom: WDom, originalWDom: WDom) => {
|
|
133
133
|
const origChildren = [...(originalWDom?.children || [])];
|
|
@@ -149,7 +149,7 @@ const chkDiffLoopOrder = (newWDom: WDom, originalWDom: WDom) => {
|
|
|
149
149
|
};
|
|
150
150
|
|
|
151
151
|
/**
|
|
152
|
-
*
|
|
152
|
+
* Handling virtual DOM attribute updates.
|
|
153
153
|
*/
|
|
154
154
|
const updateProps = (props: Props, infoProps: Props) => {
|
|
155
155
|
if (props && infoProps !== props) {
|
|
@@ -170,9 +170,9 @@ const updateChildren = (children: WDom[], infoChidren: WDom[]) => {
|
|
|
170
170
|
};
|
|
171
171
|
|
|
172
172
|
/**
|
|
173
|
-
*
|
|
174
|
-
* (
|
|
175
|
-
* (
|
|
173
|
+
* Start handling when the virtual DOM is updated rather than completely replaced with a new type.
|
|
174
|
+
* (Reflect the state of props or children to ensure the new state is applied)
|
|
175
|
+
* (Handle the reflection of the new state while ensuring that the actual references of props or children are not changed)
|
|
176
176
|
*/
|
|
177
177
|
const runUpdate = (vDom: WDom, infoVdom: TagFunctionResolver) => {
|
|
178
178
|
const { compProps: props, compChild: children } = vDom;
|
|
@@ -192,7 +192,7 @@ const runUpdate = (vDom: WDom, infoVdom: TagFunctionResolver) => {
|
|
|
192
192
|
};
|
|
193
193
|
|
|
194
194
|
/**
|
|
195
|
-
*
|
|
195
|
+
* Replace the compared virtual DOM with the new virtual DOM or simply update it.
|
|
196
196
|
*/
|
|
197
197
|
const generalize = (
|
|
198
198
|
newWDom: WDom | TagFunctionResolver,
|
|
@@ -221,7 +221,7 @@ const remakeChildrenForDiff = (
|
|
|
221
221
|
: remakeChildrenForAdd(newWDom);
|
|
222
222
|
|
|
223
223
|
/**
|
|
224
|
-
*
|
|
224
|
+
* Recursive handling for the creation of a new virtual DOM.
|
|
225
225
|
*/
|
|
226
226
|
const remakeChildrenForAdd = (newWDom: WDom) =>
|
|
227
227
|
(newWDom.children || []).map((item: WDom) =>
|
|
@@ -229,7 +229,7 @@ const remakeChildrenForAdd = (newWDom: WDom) =>
|
|
|
229
229
|
);
|
|
230
230
|
|
|
231
231
|
/**
|
|
232
|
-
*
|
|
232
|
+
* Recursive handling for updates, not additions.
|
|
233
233
|
*/
|
|
234
234
|
const remakeChildrenForUpdate = (newWDom: WDom, originalWDom: WDom) =>
|
|
235
235
|
newWDom.type === 'loop' && checkExisty(getKey((newWDom.children || [])[0]))
|
|
@@ -241,7 +241,7 @@ const remakeChildrenForUpdate = (newWDom: WDom, originalWDom: WDom) =>
|
|
|
241
241
|
);
|
|
242
242
|
|
|
243
243
|
/**
|
|
244
|
-
*
|
|
244
|
+
* Handling virtual DOM of loop-type elements.
|
|
245
245
|
*/
|
|
246
246
|
const remakeChildrenForLoopUpdate = (newWDom: WDom, originalWDom: WDom) => {
|
|
247
247
|
const [remakedChildren, unUsedChildren] = diffLoopChildren(
|
|
@@ -259,7 +259,7 @@ const remakeChildrenForLoopUpdate = (newWDom: WDom, originalWDom: WDom) => {
|
|
|
259
259
|
};
|
|
260
260
|
|
|
261
261
|
/**
|
|
262
|
-
*
|
|
262
|
+
* Recursive handling of loop-type virtual DOM elements.
|
|
263
263
|
*/
|
|
264
264
|
const diffLoopChildren = (newWDom: WDom, originalWDom: WDom) => {
|
|
265
265
|
const newChildren = [...(newWDom.children || [])];
|
|
@@ -281,7 +281,7 @@ const diffLoopChildren = (newWDom: WDom, originalWDom: WDom) => {
|
|
|
281
281
|
};
|
|
282
282
|
|
|
283
283
|
/**
|
|
284
|
-
*
|
|
284
|
+
* When comparing loop-type virtual DOM elements, use the key to determine the comparison
|
|
285
285
|
*/
|
|
286
286
|
const findSameKeyOriginalItem = (item: WDom, originalChildren: WDom[]) =>
|
|
287
287
|
originalChildren.find(
|
package/src/wDom.ts
CHANGED
|
@@ -27,17 +27,17 @@ import {
|
|
|
27
27
|
import { assign } from '@/utils';
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* It allows grouping multiple elements together.
|
|
31
31
|
*/
|
|
32
32
|
export const Fragment = (_props: Props, ...children: WDom[]) =>
|
|
33
33
|
({
|
|
34
34
|
type: 'fragment',
|
|
35
35
|
[wdomSymbol]: true,
|
|
36
36
|
children,
|
|
37
|
-
} as WDom
|
|
37
|
+
}) as WDom;
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
40
|
+
* Element creation
|
|
41
41
|
*/
|
|
42
42
|
export const h = (
|
|
43
43
|
tag: TagFunction | FragmentFunction | string,
|
|
@@ -57,14 +57,14 @@ export const h = (
|
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
|
-
*
|
|
60
|
+
* Enables portals
|
|
61
61
|
*/
|
|
62
62
|
export const portal = (wDom: WDom, portal: HTMLElement) => {
|
|
63
63
|
return h('portal', { portal }, wDom);
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
|
-
*
|
|
67
|
+
* It helps with component creation.
|
|
68
68
|
*/
|
|
69
69
|
export const mount =
|
|
70
70
|
<T>(component: Component<T>) =>
|
|
@@ -72,7 +72,7 @@ export const mount =
|
|
|
72
72
|
component;
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
|
-
*
|
|
75
|
+
* It re-renders starting from a specific component.
|
|
76
76
|
*/
|
|
77
77
|
const reRenderCustomComponent = (
|
|
78
78
|
tag: TagFunction,
|
|
@@ -108,7 +108,7 @@ const reRenderCustomComponent = (
|
|
|
108
108
|
};
|
|
109
109
|
|
|
110
110
|
/**
|
|
111
|
-
*
|
|
111
|
+
* Create an intermediate step for diffing between the existing virtual DOM and the new one during re-rendering
|
|
112
112
|
*/
|
|
113
113
|
const makeWDomResolver = (tag: TagFunction, props: Props, children: WDom[]) => {
|
|
114
114
|
const tagName = tag.name;
|
|
@@ -135,7 +135,7 @@ const makeWDomResolver = (tag: TagFunction, props: Props, children: WDom[]) => {
|
|
|
135
135
|
};
|
|
136
136
|
|
|
137
137
|
/**
|
|
138
|
-
*
|
|
138
|
+
* Create the actual virtual DOM node from the component.
|
|
139
139
|
*/
|
|
140
140
|
const makeCustomNode = (
|
|
141
141
|
componentMaker: (props: Props) => WDom,
|
|
@@ -174,7 +174,7 @@ const makeCustomNode = (
|
|
|
174
174
|
};
|
|
175
175
|
|
|
176
176
|
/**
|
|
177
|
-
*
|
|
177
|
+
* When the virtual DOM is actually created from the component, generate a re-render method for future redraws.
|
|
178
178
|
*/
|
|
179
179
|
const makeReRender = (
|
|
180
180
|
componentMaker: (props: Props) => WDom,
|
|
@@ -189,7 +189,7 @@ const makeReRender = (
|
|
|
189
189
|
};
|
|
190
190
|
|
|
191
191
|
/**
|
|
192
|
-
*
|
|
192
|
+
* The starting point for redrawing from the re-render method
|
|
193
193
|
*/
|
|
194
194
|
const wDomMaker = (
|
|
195
195
|
componentMaker: (props: Props) => WDom,
|
|
@@ -210,7 +210,7 @@ const wDomMaker = (
|
|
|
210
210
|
};
|
|
211
211
|
|
|
212
212
|
/**
|
|
213
|
-
*
|
|
213
|
+
* When creating a custom component node, attach additional information attributes to the virtual DOM object.
|
|
214
214
|
*/
|
|
215
215
|
const addComponentProps = (
|
|
216
216
|
wDom: WDom,
|
|
@@ -239,7 +239,7 @@ const addComponentProps = (
|
|
|
239
239
|
};
|
|
240
240
|
|
|
241
241
|
/**
|
|
242
|
-
*
|
|
242
|
+
* The starting point where the virtual DOM is created from the h function.
|
|
243
243
|
*/
|
|
244
244
|
const makeNode = (
|
|
245
245
|
tag: TagFunction | FragmentFunction | string,
|
|
@@ -266,7 +266,7 @@ const makeNode = (
|
|
|
266
266
|
};
|
|
267
267
|
|
|
268
268
|
/**
|
|
269
|
-
*
|
|
269
|
+
* The starting point for recursively processing the child virtual DOM elements.
|
|
270
270
|
*/
|
|
271
271
|
const remakeChildren = (
|
|
272
272
|
nodeParentPointer: NodePointer,
|
|
@@ -277,7 +277,7 @@ const remakeChildren = (
|
|
|
277
277
|
);
|
|
278
278
|
|
|
279
279
|
/**
|
|
280
|
-
*
|
|
280
|
+
* Recursively process the child virtual DOM elements.
|
|
281
281
|
*/
|
|
282
282
|
const makeChildrenItem = (item: MiddleStateWDom): WDom => {
|
|
283
283
|
if (item === null || item === undefined || item === false) {
|