lithent 1.3.4 → 1.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -59,12 +59,12 @@ pnpm add lithent
59
59
 
60
60
  #### Or Use CDN
61
61
 
62
- * UMD : https://cdn.jsdelivr.net/npm/lithent@1.3.4/dist/lithent.umd.js
63
- * UMD-HELPER: https://cdn.jsdelivr.net/npm/lithent@1.3.4/helper/dist/lithentHelper.umd.js
64
- * UMD-TAG: https://cdn.jsdelivr.net/npm/lithent@1.3.4/tag/dist/lithentTag.umd.js
65
- * ESM : https://cdn.jsdelivr.net/npm/lithent@1.3.4/dist/lithent.mjs
66
- * ESM-HELPER: https://cdn.jsdelivr.net/npm/lithent@1.3.4/helper/dist/lithentHelper.mjs
67
- * ESM-TAG: https://cdn.jsdelivr.net/npm/lithent@1.3.4/tag/dist/lithentTag.mjs
62
+ * UMD : https://cdn.jsdelivr.net/npm/lithent@1.4.0/dist/lithent.umd.js
63
+ * UMD-HELPER: https://cdn.jsdelivr.net/npm/lithent@1.4.0/helper/dist/lithentHelper.umd.js
64
+ * UMD-TAG: https://cdn.jsdelivr.net/npm/lithent@1.4.0/tag/dist/lithentTag.umd.js
65
+ * ESM : https://cdn.jsdelivr.net/npm/lithent@1.4.0/dist/lithent.mjs
66
+ * ESM-HELPER: https://cdn.jsdelivr.net/npm/lithent@1.4.0/helper/dist/lithentHelper.mjs
67
+ * ESM-TAG: https://cdn.jsdelivr.net/npm/lithent@1.4.0/tag/dist/lithentTag.mjs
68
68
 
69
69
 
70
70
  It's easier to use lithent with JSX or HTM.
@@ -116,9 +116,9 @@ const destroy = render(lTag`<${Component} />`, document.getElementById('root'),
116
116
  #### With UMD
117
117
 
118
118
  ```html
119
- <script src="https://cdn.jsdelivr.net/npm/lithent@1.3.4/dist/lithent.umd.js"></script>
120
- <!--script src="https://cdn.jsdelivr.net/npm/lithent@1.3.4/helper/dist/lithentHelper.umd.js"></script-->
121
- <script src="https://cdn.jsdelivr.net/npm/lithent@1.3.4/tag/dist/lithentTag.umd.js"></script>
119
+ <script src="https://cdn.jsdelivr.net/npm/lithent@1.4.0/dist/lithent.umd.js"></script>
120
+ <!--script src="https://cdn.jsdelivr.net/npm/lithent@1.4.0/helper/dist/lithentHelper.umd.js"></script-->
121
+ <script src="https://cdn.jsdelivr.net/npm/lithent@1.4.0/tag/dist/lithentTag.umd.js"></script>
122
122
 
123
123
  <div id="root"></div>
124
124
 
package/dist/lithent.mjs CHANGED
@@ -381,7 +381,7 @@ const updateProps$1 = (props, element, oldProps) => {
381
381
  const originalProps = { ...oldProps };
382
382
  entries(props || {}).forEach(([dataKey, dataValue]) => {
383
383
  let chkRemoveProp = true;
384
- if (dataKey === "key")
384
+ if (dataKey === "key" || dataValue === originalProps[dataKey])
385
385
  ;
386
386
  else if (dataKey === "innerHTML" && typeof dataValue === "string") {
387
387
  element.innerHTML = dataValue;
@@ -1 +1 @@
1
- {"version":3,"file":"lithent.mjs","sources":["../src/utils/predicator.ts","../src/utils/index.ts","../src/utils/universalRef.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) =>\n checkPlainWDomType(newWDom) &&\n originalWDom?.type === newWDom.type &&\n (newWDom.type !== 'loop' ||\n (newWDom.type === 'loop' &&\n checkExisty(getKey((newWDom.children || [])[0])) &&\n checkExisty(getKey((originalWDom.children || [])[0]))));\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 checkOptionElement = (element: any): element is HTMLElement =>\n element.nodeType === 1 && element.tagName === 'OPTION';\n\nexport const checkTextareaElement = (element: any): element is HTMLElement =>\n element.nodeType === 1 && element.tagName === 'TEXTAREA';\n\nexport const checkCheckableElement = (element: any): element is HTMLElement =>\n element.nodeType === 1 && ['radio', 'checkbox'].includes(element.type);\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: checkNormalTypeElement,\n t: checkNormalTypeElement,\n e: checkSameTagElement,\n f: checkSameFragment,\n et: checkNormalTypeElement,\n};\n","import { WDom } from '@/types';\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;\n","import { ComponentRef, ComponentSubKey, Props } from '@/types';\n\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 = (compKey: Props, subKey: ComponentSubKey) =>\n componentRef.get(compKey)![subKey];\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';\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 checkOptionElement,\n checkTextareaElement,\n checkCheckableElement,\n checkVirtualType,\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) => {\n wrapElement ??= document.body;\n wDom.isRoot = true;\n wDom.wrapElement = wrapElement;\n\n const Dom = wDomToDom(wDom);\n\n if (afterElement) {\n wDom.afterElement = afterElement;\n wrapElement.insertBefore(Dom, afterElement);\n } else {\n wrapElement.appendChild(Dom);\n }\n\n execMountedQueue();\n\n return () => {\n const component = componentRef.get(wDom.compProps || {})?.vd.value;\n if (component) {\n runUnmountQueueFromWDom(component);\n recursiveRemoveEvent(component);\n rootDelete(component);\n }\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 (newWDom.el?.nodeType === 1) {\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 if (item.el?.nodeType === 1) {\n parent.removeChild(item?.el);\n } else if (item.el?.nodeType === 11) {\n findChildWithRemoveElement(item, parent);\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 (nextEl) {\n parentEl.insertBefore(newElement, nextEl);\n } else {\n parentEl.appendChild(newElement);\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) {\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\n) => {\n const originalProps = { ...oldProps };\n\n entries(props || {}).forEach(([dataKey, dataValue]: [string, unknown]) => {\n let chkRemoveProp = true;\n if (dataKey === 'key') {\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) ? originalProps.style : {},\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 (checkCheckableElement(element) && dataKey === 'checked') {\n (element as HTMLInputElement).checked = !!dataValue;\n } else if (checkTextareaElement(element) && dataKey === 'value') {\n (element as HTMLInputElement).value = dataValue as string;\n } else if (checkOptionElement(element) && dataKey === 'selected') {\n (element as HTMLOptionElement).selected = !!dataValue;\n } else if (dataKey) {\n [chkRemoveProp, dataValue] = makeAttrDataValue(dataValue);\n\n if (chkRemoveProp) {\n setAttr(\n getAttrKey(dataKey),\n element as HTMLElement,\n dataValue as string\n );\n }\n }\n\n if (chkRemoveProp) {\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 makeAttrDataValue = (dataValue: unknown): [boolean, string] => {\n let allowSetAttr = true;\n if (typeof dataValue === 'boolean') {\n if (!dataValue) {\n allowSetAttr = false;\n }\n\n dataValue = '';\n }\n\n return [allowSetAttr, String(dataValue)];\n};\n\nconst wDomToDom = (wDom: WDom) => {\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 (isVirtualType) {\n element = DF();\n } else if (type === 'element' && tag) {\n element = xmlnsRef.value\n ? document.createElementNS(xmlnsRef.value, tag)\n : CE(tag);\n } else if (type === 'text' && checkExisty(text)) {\n element = document.createTextNode(String(text));\n } else {\n element = CE('e');\n }\n\n wDomChildrenToDom(children, element);\n updateProps(props, element);\n\n wDom.el = element as HTMLElement;\n\n addMountedQueue(wDom);\n\n if (tag === 'svg') {\n xmlnsRef.value = '';\n }\n\n return element;\n};\n\nconst wDomChildrenToDom = (\n children: WDom[],\n parentElement?: HTMLElement | Element | DocumentFragment | Text\n) => {\n const elementChildren = children.reduce(\n (acc: DocumentFragment, childItem: WDom) => {\n if (childItem.type) {\n acc.appendChild(wDomToDom(childItem));\n }\n\n return acc;\n },\n DF()\n );\n\n if (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\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\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\n remakeWDom.children = remakeChildrenForDiff(...param);\n remakeWDom.needRerender = needRerender;\n\n inheritPropForRender(remakeWDom, originalWDom, needRerender);\n\n if (originalWDom) {\n delete originalWDom.children;\n }\n\n return remakeWDom;\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?.compKey) {\n runUnmountQueueFromWDom(originalWDom);\n recursiveRemoveEvent(originalWDom);\n }\n remakeWDom.oldChildren = originalWDom?.children;\n }\n\n remakeWDom.oldProps = originalWDom?.props;\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\n let result: RenderType | undefined;\n if (isEmptyElement) {\n result = 'D';\n } else if (isSameText) {\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\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\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\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\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\nconst remakeChildrenForDiff = (\n newWDom: WDom,\n isSameType: boolean,\n originalWDom?: WDom\n) =>\n isSameType && originalWDom\n ? remakeChildrenForUpdate(newWDom, originalWDom)\n : remakeChildrenForAdd(newWDom);\n\nconst remakeChildrenForAdd = (newWDom: WDom) =>\n (newWDom.children || []).map((item: WDom) =>\n assign(makeNewWDomTree(item), { getParent: () => newWDom })\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\nconst remakeChildrenForLoopUpdate = (newWDom: WDom, originalWDom: WDom) => {\n const [remakedChildren, unUsedChildren] = diffLoopChildren(\n newWDom,\n originalWDom\n );\n\n unUsedChildren.map(unusedItem => {\n runUnmountQueueFromWDom(unusedItem);\n recursiveRemoveEvent(unusedItem);\n typeDelete(unusedItem);\n });\n\n return remakedChildren;\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\nconst findSameKeyOriginalItem = (item: WDom, originalChildren: WDom[]) =>\n originalChildren.find(\n orignalChildItem => getKey(orignalChildItem) === getKey(item)\n );\n","import { Props, WDom, RedrawQueueList } from '@/types';\nimport { componentRef } from '@/utils/universalRef';\n\nlet redrawQueue: { compKey: Props; exec: () => void }[] = [];\nlet redrawQueueTimeout: boolean = false;\n\nexport const setRedrawAction = (compKey: Props, exec: () => void) => {\n componentRef.get(compKey)!.up = () => {\n redrawQueue.push({\n compKey,\n exec,\n });\n\n if (!redrawQueueTimeout) {\n redrawQueueTimeout = true;\n queueMicrotask(execRedrawQueue);\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 recursiveGetChildKeys = (wDom: WDom, result: Props[]) => {\n (wDom.children || []).forEach(item => {\n const childComKey = item.compKey;\n if (childComKey) {\n result.push(childComKey);\n }\n\n recursiveGetChildKeys(item, result);\n });\n};\n\nconst execRedrawQueue = () => {\n let childItemList: Props[] = [];\n\n redrawQueue.forEach(item => {\n const childVd = componentRef.get(item.compKey)?.vd?.value;\n if (childVd) {\n recursiveGetChildKeys(childVd, childItemList);\n }\n });\n\n const addedKey: Props[] = [];\n const result = redrawQueue.reduce((acc, item) => {\n const { compKey } = item;\n\n if (childItemList.includes(compKey) || addedKey.includes(compKey)) {\n return acc;\n }\n\n addedKey.push(compKey);\n acc.push(item);\n\n return acc;\n }, [] as RedrawQueueList);\n\n while (result.length) {\n const action = result.shift();\n if (action) {\n action.exec();\n }\n }\n\n redrawQueue = [];\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} 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\nexport const Fragment = (_props: Props, ...children: WDom[]) => ({\n type: 'fragment',\n children,\n});\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\nexport const mount =\n <T>(component: Component<T>) =>\n (_props: T, _children: WDom[]) =>\n component;\n\nconst reRenderCustomComponent = (\n tag: TagFunction,\n props: Props,\n children: WDom[],\n originalWDom: WDom\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 wDomUpdate(newWDomTree);\n};\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 const originalWDom = customNode;\n\n setRedrawAction(compKey, () =>\n reRenderCustomComponent(tag, props, children, originalWDom)\n );\n\n (getComponentSubInfo(compKey, 'vd') as { value: WDom }).value = customNode;\n\n return customNode;\n };\n\n return { tagName, ctor, props, children, resolve };\n};\n\nconst makeCustomNode = (\n componentMaker: (props: Props) => WDom,\n compKey: Props,\n tag: TagFunction,\n props: Props,\n children: WDom[]\n) => {\n const customNode = componentMaker(props);\n if (customNode.reRender) {\n throw new Error(\n 'Avoid the case where the first element of a component is a component. Instead of \"mount(()=>()=><Component />)\" replace it with something like \"mount(()=>()=><Fragment><Component /></Fragment>)\".'\n );\n }\n\n addComponentProps(\n customNode,\n compKey,\n tag,\n props,\n children,\n makeReRender(componentMaker, compKey, tag, props, children)\n );\n\n return customNode;\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\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 originalWDom = componentMaker(props);\n\n setRedrawAction(compKey, () =>\n reRenderCustomComponent(tag, props, children, originalWDom)\n );\n\n addComponentProps(originalWDom, compKey, tag, props, children, reRender);\n\n (getComponentSubInfo(compKey, 'vd') as { value: WDom }).value = originalWDom;\n\n return originalWDom;\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\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 tag,\n props,\n children,\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\nconst makeChildrenItem = (item: MiddleStateWDom): WDom => {\n if (item === null || item === undefined || item === false) {\n return { type: null };\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 children,\n };\n nodeParentPointer.value = node;\n\n return node;\n } else if (typeof item === 'string' || typeof item === 'number') {\n return { type: 'text', text: item };\n }\n\n return item;\n};\n","export const ref = <T>(initValue: T) => ({ value: initValue });\nexport const nextTick = () => Promise.resolve();\n"],"names":["updateProps","getParent"],"mappings":"AAoBA,MAAM,qBAAqB,CAAC,SAC1B,OAAO,SAAS,YAAY,EAAE,aAAa;AAE7C,MAAM,iBAAiB,CAAC,MAAiB,aACvC,mBAAmB,IAAI,KAAK,KAAK,SAAS;AAE5C,MAAM,2BAA2B,CAC/B,SACA,iBAEA,UA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Q;AAAA,EACnC;AAEO,SAAA;AAAA,IACL,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;AAEA,MAAM,iBAAiB,CACrB,mBACA,aAEA,SAAS;AAAA,EAAI,CAAC,SACZ,OAAO,iBAAiB,IAAI,GAAG,EAAE,WAAW,MAAM,kBAAkB,OAAO;AAC7E;AAEF,MAAM,mBAAmB,CAAC,SAAgC;AACxD,MAAI,SAAS,QAAQ,SAAS,UAAa,SAAS,OAAO;AAClD,WAAA,EAAE,MAAM;EACN,WAAA,MAAM,QAAQ,IAAI,GAAG;AACxB,UAAA,oBAAiC,EAAE,OAAO,OAAU;AACpD,UAAA,WAAW,eAAe,mBAAmB,IAAI;AACvD,UAAM,OAAO;AAAA,MACX,MAAM;AAAA,MACN;AAAA,IAAA;AAEF,sBAAkB,QAAQ;AAEnB,WAAA;AAAA,aACE,OAAO,SAAS,YAAY,OAAO,SAAS,UAAU;AAC/D,WAAO,EAAE,MAAM,QAAQ,MAAM,KAAK;AAAA,EACpC;AAEO,SAAA;AACT;ACpPO,MAAM,MAAM,CAAI,eAAkB,EAAE,OAAO,UAAU;AAC/C,MAAA,WAAW,MAAM,QAAQ,QAAQ;"}
1
+ {"version":3,"file":"lithent.mjs","sources":["../src/utils/predicator.ts","../src/utils/index.ts","../src/utils/universalRef.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) =>\n checkPlainWDomType(newWDom) &&\n originalWDom?.type === newWDom.type &&\n (newWDom.type !== 'loop' ||\n (newWDom.type === 'loop' &&\n checkExisty(getKey((newWDom.children || [])[0])) &&\n checkExisty(getKey((originalWDom.children || [])[0]))));\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 checkOptionElement = (element: any): element is HTMLElement =>\n element.nodeType === 1 && element.tagName === 'OPTION';\n\nexport const checkTextareaElement = (element: any): element is HTMLElement =>\n element.nodeType === 1 && element.tagName === 'TEXTAREA';\n\nexport const checkCheckableElement = (element: any): element is HTMLElement =>\n element.nodeType === 1 && ['radio', 'checkbox'].includes(element.type);\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: checkNormalTypeElement,\n t: checkNormalTypeElement,\n e: checkSameTagElement,\n f: checkSameFragment,\n et: checkNormalTypeElement,\n};\n","import { WDom } from '@/types';\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;\n","import { ComponentRef, ComponentSubKey, Props } from '@/types';\n\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 = (compKey: Props, subKey: ComponentSubKey) =>\n componentRef.get(compKey)![subKey];\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';\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 checkOptionElement,\n checkTextareaElement,\n checkCheckableElement,\n checkVirtualType,\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) => {\n wrapElement ??= document.body;\n wDom.isRoot = true;\n wDom.wrapElement = wrapElement;\n\n const Dom = wDomToDom(wDom);\n\n if (afterElement) {\n wDom.afterElement = afterElement;\n wrapElement.insertBefore(Dom, afterElement);\n } else {\n wrapElement.appendChild(Dom);\n }\n\n execMountedQueue();\n\n return () => {\n const component = componentRef.get(wDom.compProps || {})?.vd.value;\n if (component) {\n runUnmountQueueFromWDom(component);\n recursiveRemoveEvent(component);\n rootDelete(component);\n }\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 (newWDom.el?.nodeType === 1) {\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 if (item.el?.nodeType === 1) {\n parent.removeChild(item?.el);\n } else if (item.el?.nodeType === 11) {\n findChildWithRemoveElement(item, parent);\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 (nextEl) {\n parentEl.insertBefore(newElement, nextEl);\n } else {\n parentEl.appendChild(newElement);\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) {\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\n) => {\n const originalProps = { ...oldProps };\n\n entries(props || {}).forEach(([dataKey, dataValue]: [string, unknown]) => {\n let chkRemoveProp = true;\n\n if (dataKey === 'key' || dataValue === originalProps[dataKey]) {\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) ? originalProps.style : {},\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 (checkCheckableElement(element) && dataKey === 'checked') {\n (element as HTMLInputElement).checked = !!dataValue;\n } else if (checkTextareaElement(element) && dataKey === 'value') {\n (element as HTMLInputElement).value = dataValue as string;\n } else if (checkOptionElement(element) && dataKey === 'selected') {\n (element as HTMLOptionElement).selected = !!dataValue;\n } else if (dataKey) {\n [chkRemoveProp, dataValue] = makeAttrDataValue(dataValue);\n\n if (chkRemoveProp) {\n setAttr(\n getAttrKey(dataKey),\n element as HTMLElement,\n dataValue as string\n );\n }\n }\n\n if (chkRemoveProp) {\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 makeAttrDataValue = (dataValue: unknown): [boolean, string] => {\n let allowSetAttr = true;\n if (typeof dataValue === 'boolean') {\n if (!dataValue) {\n allowSetAttr = false;\n }\n\n dataValue = '';\n }\n\n return [allowSetAttr, String(dataValue)];\n};\n\nconst wDomToDom = (wDom: WDom) => {\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 (isVirtualType) {\n element = DF();\n } else if (type === 'element' && tag) {\n element = xmlnsRef.value\n ? document.createElementNS(xmlnsRef.value, tag)\n : CE(tag);\n } else if (type === 'text' && checkExisty(text)) {\n element = document.createTextNode(String(text));\n } else {\n element = CE('e');\n }\n\n wDomChildrenToDom(children, element);\n updateProps(props, element);\n\n wDom.el = element as HTMLElement;\n\n addMountedQueue(wDom);\n\n if (tag === 'svg') {\n xmlnsRef.value = '';\n }\n\n return element;\n};\n\nconst wDomChildrenToDom = (\n children: WDom[],\n parentElement?: HTMLElement | Element | DocumentFragment | Text\n) => {\n const elementChildren = children.reduce(\n (acc: DocumentFragment, childItem: WDom) => {\n if (childItem.type) {\n acc.appendChild(wDomToDom(childItem));\n }\n\n return acc;\n },\n DF()\n );\n\n if (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\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\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\n remakeWDom.children = remakeChildrenForDiff(...param);\n remakeWDom.needRerender = needRerender;\n\n inheritPropForRender(remakeWDom, originalWDom, needRerender);\n\n if (originalWDom) {\n delete originalWDom.children;\n }\n\n return remakeWDom;\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?.compKey) {\n runUnmountQueueFromWDom(originalWDom);\n recursiveRemoveEvent(originalWDom);\n }\n remakeWDom.oldChildren = originalWDom?.children;\n }\n\n remakeWDom.oldProps = originalWDom?.props;\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\n let result: RenderType | undefined;\n if (isEmptyElement) {\n result = 'D';\n } else if (isSameText) {\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\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\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\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\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\nconst remakeChildrenForDiff = (\n newWDom: WDom,\n isSameType: boolean,\n originalWDom?: WDom\n) =>\n isSameType && originalWDom\n ? remakeChildrenForUpdate(newWDom, originalWDom)\n : remakeChildrenForAdd(newWDom);\n\nconst remakeChildrenForAdd = (newWDom: WDom) =>\n (newWDom.children || []).map((item: WDom) =>\n assign(makeNewWDomTree(item), { getParent: () => newWDom })\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\nconst remakeChildrenForLoopUpdate = (newWDom: WDom, originalWDom: WDom) => {\n const [remakedChildren, unUsedChildren] = diffLoopChildren(\n newWDom,\n originalWDom\n );\n\n unUsedChildren.map(unusedItem => {\n runUnmountQueueFromWDom(unusedItem);\n recursiveRemoveEvent(unusedItem);\n typeDelete(unusedItem);\n });\n\n return remakedChildren;\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\nconst findSameKeyOriginalItem = (item: WDom, originalChildren: WDom[]) =>\n originalChildren.find(\n orignalChildItem => getKey(orignalChildItem) === getKey(item)\n );\n","import { Props, WDom, RedrawQueueList } from '@/types';\nimport { componentRef } from '@/utils/universalRef';\n\nlet redrawQueue: { compKey: Props; exec: () => void }[] = [];\nlet redrawQueueTimeout: boolean = false;\n\nexport const setRedrawAction = (compKey: Props, exec: () => void) => {\n componentRef.get(compKey)!.up = () => {\n redrawQueue.push({\n compKey,\n exec,\n });\n\n if (!redrawQueueTimeout) {\n redrawQueueTimeout = true;\n queueMicrotask(execRedrawQueue);\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 recursiveGetChildKeys = (wDom: WDom, result: Props[]) => {\n (wDom.children || []).forEach(item => {\n const childComKey = item.compKey;\n if (childComKey) {\n result.push(childComKey);\n }\n\n recursiveGetChildKeys(item, result);\n });\n};\n\nconst execRedrawQueue = () => {\n let childItemList: Props[] = [];\n\n redrawQueue.forEach(item => {\n const childVd = componentRef.get(item.compKey)?.vd?.value;\n if (childVd) {\n recursiveGetChildKeys(childVd, childItemList);\n }\n });\n\n const addedKey: Props[] = [];\n const result = redrawQueue.reduce((acc, item) => {\n const { compKey } = item;\n\n if (childItemList.includes(compKey) || addedKey.includes(compKey)) {\n return acc;\n }\n\n addedKey.push(compKey);\n acc.push(item);\n\n return acc;\n }, [] as RedrawQueueList);\n\n while (result.length) {\n const action = result.shift();\n if (action) {\n action.exec();\n }\n }\n\n redrawQueue = [];\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} 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\nexport const Fragment = (_props: Props, ...children: WDom[]) => ({\n type: 'fragment',\n children,\n});\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\nexport const mount =\n <T>(component: Component<T>) =>\n (_props: T, _children: WDom[]) =>\n component;\n\nconst reRenderCustomComponent = (\n tag: TagFunction,\n props: Props,\n children: WDom[],\n originalWDom: WDom\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 wDomUpdate(newWDomTree);\n};\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 const originalWDom = customNode;\n\n setRedrawAction(compKey, () =>\n reRenderCustomComponent(tag, props, children, originalWDom)\n );\n\n (getComponentSubInfo(compKey, 'vd') as { value: WDom }).value = customNode;\n\n return customNode;\n };\n\n return { tagName, ctor, props, children, resolve };\n};\n\nconst makeCustomNode = (\n componentMaker: (props: Props) => WDom,\n compKey: Props,\n tag: TagFunction,\n props: Props,\n children: WDom[]\n) => {\n const customNode = componentMaker(props);\n if (customNode.reRender) {\n throw new Error(\n 'Avoid the case where the first element of a component is a component. Instead of \"mount(()=>()=><Component />)\" replace it with something like \"mount(()=>()=><Fragment><Component /></Fragment>)\".'\n );\n }\n\n addComponentProps(\n customNode,\n compKey,\n tag,\n props,\n children,\n makeReRender(componentMaker, compKey, tag, props, children)\n );\n\n return customNode;\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\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 originalWDom = componentMaker(props);\n\n setRedrawAction(compKey, () =>\n reRenderCustomComponent(tag, props, children, originalWDom)\n );\n\n addComponentProps(originalWDom, compKey, tag, props, children, reRender);\n\n (getComponentSubInfo(compKey, 'vd') as { value: WDom }).value = originalWDom;\n\n return originalWDom;\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\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 tag,\n props,\n children,\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\nconst makeChildrenItem = (item: MiddleStateWDom): WDom => {\n if (item === null || item === undefined || item === false) {\n return { type: null };\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 children,\n };\n nodeParentPointer.value = node;\n\n return node;\n } else if (typeof item === 'string' || typeof item === 'number') {\n return { type: 'text', text: item };\n }\n\n return item;\n};\n","export const ref = <T>(initValue: T) => ({ value: initValue });\nexport const nextTick = () => Promise.resolve();\n"],"names":["updateProps","getParent"],"mappings":"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OACA,aACG;AACC,MAAA,sBAAsB,GAAG,GAAG;AACvB,WAAA,SAAS,OAAO,GAAG,QAAQ;AAAA,EAAA,WACzB,6BAA6B,GAAG,GAAG;AAC5C,UAAM,uBAAuB,iBAAiB,KAAK,OAAO,QAAQ;AAElE,WAAO,YAAY,QACf,uBACA,qBAAqB,QAAQ;AAAA,EACnC;AAEO,SAAA;AAAA,IACL,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;AAEA,MAAM,iBAAiB,CACrB,mBACA,aAEA,SAAS;AAAA,EAAI,CAAC,SACZ,OAAO,iBAAiB,IAAI,GAAG,EAAE,WAAW,MAAM,kBAAkB,OAAO;AAC7E;AAEF,MAAM,mBAAmB,CAAC,SAAgC;AACxD,MAAI,SAAS,QAAQ,SAAS,UAAa,SAAS,OAAO;AAClD,WAAA,EAAE,MAAM;EACN,WAAA,MAAM,QAAQ,IAAI,GAAG;AACxB,UAAA,oBAAiC,EAAE,OAAO,OAAU;AACpD,UAAA,WAAW,eAAe,mBAAmB,IAAI;AACvD,UAAM,OAAO;AAAA,MACX,MAAM;AAAA,MACN;AAAA,IAAA;AAEF,sBAAkB,QAAQ;AAEnB,WAAA;AAAA,aACE,OAAO,SAAS,YAAY,OAAO,SAAS,UAAU;AAC/D,WAAO,EAAE,MAAM,QAAQ,MAAM,KAAK;AAAA,EACpC;AAEO,SAAA;AACT;ACpPO,MAAM,MAAM,CAAI,eAAkB,EAAE,OAAO,UAAU;AAC/C,MAAA,WAAW,MAAM,QAAQ,QAAQ;"}
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).lithent={})}(this,(function(e){"use strict";const t=e=>"object"==typeof e&&!("resolve"in e),n=(e,n)=>t(e)&&e.type===n,l=(e,n)=>t(e)&&(null==n?void 0:n.type)===e.type&&("loop"!==e.type||"loop"===e.type&&u(o((e.children||[])[0]))&&u(o((n.children||[])[0]))),o=e=>{var t,n;return(null==(t=null==e?void 0:e.compProps)?void 0:t.key)??(null==(n=null==e?void 0:e.props)?void 0:n.key)},r=e=>e&&["fragment","loop"].includes(e),d=e=>"function"==typeof e&&!c(e)||"object"==typeof e&&"resolve"in e,c=e=>"function"==typeof e&&e===xe,i=e=>t(e)&&!e.type,u=e=>null!=e,p=(e,t)=>"style"===e&&"object"==typeof t,s={c:(e,t)=>"ctor"in e?e.ctor===(null==t?void 0:t.ctor):e===(null==t?void 0:t.ctor),l:l,t:l,e:(e,n)=>{var l,o;return t(e)&&"element"===(null==n?void 0:n.type)&&(null==n?void 0:n.tag)===e.tag&&(null==(l=null==n?void 0:n.children)?void 0:l.length)===(null==(o=null==e?void 0:e.children)?void 0:o.length)},f:(e,n)=>{var l,o;return t(e)&&"fragment"===(null==n?void 0:n.type)&&(null==(l=null==n?void 0:n.children)?void 0:l.length)===(null==(o=null==e?void 0:e.children)?void 0:o.length)},et:l},a=e=>e.getParent&&e.getParent(),v=Object.entries,h=Object.keys,m=Object.assign,f={value:""},y={value:{}},g={value:!1},E=new WeakMap,C=()=>y.value,R=(e,t)=>E.get(e)[t],x=e=>{y.value=e,(e=>{E.set(e,{vd:{value:null},up:()=>{},upR:[],upS:{value:0},upD:[],upCB:[],mts:[],umts:[]})})(e)},S=e=>{const{compKey:t}=e;t&&P(t),b(e)},b=e=>{(e.children||[]).forEach((e=>{e.compKey?S(e):b(e)}))},P=e=>{const t=E.get(e);t&&(t.umts.forEach((e=>e())),t.umts=[],E.delete(e))};let T=[];const N=()=>{T.forEach((e=>k(e))),T=[]},k=e=>{const{compKey:t}=e;if(t){const e=E.get(t),n=null==e?void 0:e.mts,l=null==e?void 0:e.upS;y.value=t,l&&(l.value=0),n&&(e.mts=[],n.forEach((e=>{const t=e();var n;t&&(n=t,E.get(C()).umts.push(n))})))}},w=(e,t=(()=>[]))=>{const n=E.get(C()),{upD:l,upS:o}=n,r=l[o.value];if(r&&A(r,t())){const t=e();t&&n.upCB.push(t)}l[o.value]=t(),o.value+=1},A=(e,t)=>!e.length||e.some(((e,n)=>e!==t[n])),K=e=>e.replace(/^on(.*)/,((e,t)=>t.toLowerCase())),j=()=>new DocumentFragment,O=e=>document.createElement(e),U=e=>{const{needRerender:t}=e;t&&"N"!==t&&({A:q,D:L,R:z,U:J,CNSU:J,SR:H,SU:I}[t](e),delete e.needRerender,delete e.oldChildren,delete e.oldProps)},B=e=>{e.props&&e.el&&G(e.props,e.el),(e.children||[]).forEach((e=>{B(e)}))},D=e=>{M(e,e.wrapElement)},L=e=>{e.oldProps&&e.el&&G(e.oldProps,e.el),M(e,le(a(e)))},M=(e,t)=>{var n,l;t&&e.el&&(1===(null==(n=e.el)?void 0:n.nodeType)?t.removeChild(e.el):11===(null==(l=e.el)?void 0:l.nodeType)&&F(e,t),delete e.el)},F=(e,t)=>{((null==e?void 0:e.oldChildren)||(null==e?void 0:e.children)||[]).forEach((e=>{var n,l;1===(null==(n=e.el)?void 0:n.nodeType)?t.removeChild(null==e?void 0:e.el):11===(null==(l=e.el)?void 0:l.nodeType)&&F(e,t)}))},H=e=>{L(e),q(e)},I=e=>{J(e);if("CNSU"!==a(e).needRerender){const t=V(e);q(e,t)}},q=(e,t)=>{t||(t=_(e));const n=a(e);if(n.type){const l=le(n),o="loop"===n.type&&n.needRerender&&"CNSU"!==n.needRerender?W(n,a(n)):W(e,n);t&&l&&(o?l.insertBefore(t,o):l.appendChild(t),N())}},V=e=>r(e.type)?((null==e?void 0:e.children)||[]).reduce(((e,t)=>{const n=V(t);return n&&e.appendChild(n),e}),j()):e.el,W=(e,t)=>{const n=t.children||[],l=n.indexOf(e)+1,o=n.slice(l),d=X(o),c=t.type||"";return d||(!t.isRoot&&r(c)?W(t,a(t)):t.isRoot&&r(c)&&t.afterElement?t.afterElement:void 0)},X=e=>e.reduce(((e,t)=>{const n=t.type,l=t.el,o=n&&r(n);return e||(o?X(t.children||[]):l&&11!==l.nodeType?l:e)}),void 0),z=e=>{const t=a(e),n=e.el;if(t.type&&n)if(11===n.nodeType)H(e);else{const l=le(t),o=_(e);l&&l.replaceChild(o,n),N()}},G=(e,t)=>{v(e||{}).forEach((([e,n])=>{e.match(/^on/)&&t.removeEventListener(K(e),n)}))},J=e=>{var t;const n=e.el;if("text"!==e.type){if(n){const{oldProps:l,props:o}=e;Y(o,n,l),delete e.oldProps,"input"===e.tag&&(n.value=String((null==(t=null==e?void 0:e.props)?void 0:t.value)||""))}(e.children||[]).forEach((e=>U(e))),(e=>{const{compKey:t}=e;if(t){const n=E.get(t),l=null==n?void 0:n.upCB,o=null==n?void 0:n.upS;y.value=t,o&&(o.value=0),e.ctor&&l&&(n.upCB=[],l.forEach((e=>e())))}})(e)}else Q(e)},Q=e=>{const t=e.el;t&&(t.nodeValue=String(e.text))},Y=(e,t,n)=>{const l={...n};v(e||{}).forEach((([e,n])=>{let o=!0;var r;"key"===e||("innerHTML"===e&&"string"==typeof n?t.innerHTML=n:p(e,n)?ne(n,p(e,l.style)?l.style:{},t):((e,t)=>"ref"===e&&"object"==typeof t)(e,n)?n.value=t:e.match(/^on/)?te(t,e,n,l[e]):(e=>1===e.nodeType&&["radio","checkbox"].includes(e.type))(t)&&"checked"===e?t.checked=!!n:(e=>1===e.nodeType&&"TEXTAREA"===e.tagName)(t)&&"value"===e?t.value=n:(e=>1===e.nodeType&&"OPTION"===e.tagName)(t)&&"selected"===e?t.selected=!!n:e&&([o,n]=$(n),o&&Z("className"===(r=e)?"class":r,t,n))),o&&delete l[e]})),h(l).forEach((e=>t.removeAttribute(e)))},Z=(e,t,n)=>{f.value&&"xmlns"!==e?t.setAttributeNS(null,e,n):t.setAttribute(e,n)},$=e=>{let t=!0;return"boolean"==typeof e&&(e||(t=!1),e=""),[t,String(e)]},_=e=>{let t;const{type:n,tag:l,text:o,props:d,children:c=[]}=e,i=r(n);return"svg"===l&&(f.value=String(null==d?void 0:d.xmlns)),t=i?j():"element"===n&&l?f.value?document.createElementNS(f.value,l):O(l):"text"===n&&u(o)?document.createTextNode(String(o)):O("e"),ee(c,t),Y(d,t),e.el=t,(e=>{e.compKey&&T.push(e)})(e),"svg"===l&&(f.value=""),t},ee=(e,t)=>{const n=e.reduce(((e,t)=>(t.type&&e.appendChild(_(t)),e)),j());t&&n.hasChildNodes()&&t.appendChild(n)},te=(e,t,n,l)=>{const o=K(t);l!==n&&(l&&e.removeEventListener(o,l),n&&e.addEventListener(o,n))},ne=(e,t,n)=>{const l={...t},o=null==n?void 0:n.style;o&&(v(e).forEach((([e,t])=>{o[e]=t,delete l[e]})),v(l).forEach((([e])=>o[e]="")))},le=e=>{const t=r(e.type);return e.isRoot&&t?e.wrapElement:t?le(a(e)):e.el},oe=(e,t)=>re(e,s[(e=>{let t="et";return d(e)?t="c":n(e,"fragment")?t="f":n(e,"element")?t="e":n(e,"loop")?t="l":n(e,"text")?t="t":i(e)&&(t="et"),t})(e)](e,t),t),re=(e,t,n)=>{const l=pe(e,t,n),o=[l,t,n],r=ce(...o);return l.children=se(...o),l.needRerender=r,de(l,n,r),n&&delete n.children,l},de=(e,t,n)=>{"A"!==n&&t&&(e.el=t.el),n&&["D","R","SR"].includes(n)&&((null==t?void 0:t.compKey)&&(S(t),B(t)),e.oldChildren=null==t?void 0:t.children),e.oldProps=null==t?void 0:t.props},ce=(e,t,n)=>{const l=n&&n.type,r=i(e),d=e.isRoot,c=n&&a(n),p=!d&&(null==c?void 0:c.type),s=o(e),v="loop"===p&&u(s),h="text"===e.type&&t&&e.text===(null==n?void 0:n.text);let m;return m=r?"D":h?"N":l?t?v?"SU":"U":v?"SR":"R":"A","loop"===e.type&&"U"===m&&n&&ie(e,n)&&(m="CNSU"),m},ie=(e,t)=>{const n=[...(null==t?void 0:t.children)||[]],l=[...(null==e?void 0:e.children)||[]].filter((e=>n.find((t=>o(e)===o(t))))),r=n.filter((e=>l.find((t=>o(e)===o(t)))));let d=r.length===l.length;return d&&(d=r.every(((e,t)=>o(e)===o(l[t])))),d},ue=(e,t)=>{const{compProps:n,compChild:l}=e,{props:o,children:r}=t;n&&((e,t)=>{e&&t!==e&&(h(e).forEach((t=>delete e[t])),v(t||{}).forEach((([t,n])=>e[t]=n)))})(n,o),l&&((e,t)=>{e&&t!==e&&(e.splice(0,e.length),t&&t.forEach((t=>e.push(t))))})(l,r);return e.reRender&&e.reRender()},pe=(e,t,n)=>d(e)?t&&n?ue(n,e):e.resolve():e,se=(e,t,n)=>t&&n?ve(e,n):ae(e),ae=e=>(e.children||[]).map((t=>m(oe(t),{getParent:()=>e}))),ve=(e,t)=>"loop"===e.type&&u(o((e.children||[])[0]))?he(e,t):(e.children||[]).map(((n,l)=>m(oe(n,(t.children||[])[l]),{getParent:()=>e}))),he=(e,t)=>{const[n,l]=me(e,t);return l.map((e=>{S(e),B(e),L(e)})),n},me=(e,t)=>{const n=[...e.children||[]],l=[...t.children||[]];return[n.map((t=>{const n=fe(t,l),o=oe(t,n);return n&&l.splice(l.indexOf(n),1),o.getParent=()=>e,o})),l]},fe=(e,t)=>t.find((t=>o(t)===o(e)));let ye=[],ge=!1;const Ee=(e,t)=>{E.get(e).up=()=>{ye.push({compKey:e,exec:t}),ge||(ge=!0,queueMicrotask(Re))}},Ce=(e,t)=>{(e.children||[]).forEach((e=>{const n=e.compKey;n&&t.push(n),Ce(e,t)}))},Re=()=>{let e=[];ye.forEach((t=>{var n,l;const o=null==(l=null==(n=E.get(t.compKey))?void 0:n.vd)?void 0:l.value;o&&Ce(o,e)}));const t=[],n=ye.reduce(((n,l)=>{const{compKey:o}=l;return e.includes(o)||t.includes(o)||(t.push(o),n.push(l)),n}),[]);for(;n.length;){const e=n.shift();e&&e.exec()}ye=[],ge=!1},xe=(e,...t)=>({type:"fragment",children:t}),Se=(e,t,n,l)=>{var o;g.value=!0;const r=be(e,t,n),d=oe(r,l),{isRoot:c,getParent:i,wrapElement:u,afterElement:p}=l;if(d.getParent=i,!c&&i){const e=(null==(o=i())?void 0:o.children)||[],t=e.indexOf(l);e.splice(t,1,d)}else d.isRoot=!0,d.wrapElement=u,d.afterElement=p;g.value=!1,U(d)},be=(e,t,n)=>({tagName:e.name,ctor:e,props:t,children:n,resolve:(l=t)=>{x(l);const o=e(t,n)((e=>()=>{var t;const n=null==(t=E.get(e))?void 0:t.up;let l=!1;return n&&(n(),l=!0),l})(l),t,n),r=Pe(o,l,e,t,n),d=r;return Ee(l,(()=>Se(e,t,n,d))),R(l,"vd").value=r,r}}),Pe=(e,t,n,l,o)=>{const r=e(l);if(r.reRender)throw new Error('Avoid the case where the first element of a component is a component. Instead of "mount(()=>()=><Component />)" replace it with something like "mount(()=>()=><Fragment><Component /></Fragment>)".');return ke(r,t,n,l,o,Te(e,t,n,l,o)),r},Te=(e,t,n,l,o)=>{const r=()=>Ne(e,t,n,l,o,r);return r},Ne=(e,t,n,l,o,r)=>{(e=>{y.value=e})(t),(()=>{var e;const t=null==(e=E.get(C()))?void 0:e.upR;(null==t?void 0:t.length)&&t.forEach((e=>e()))})();const d=e(l);return Ee(t,(()=>Se(n,l,o,d))),ke(d,t,n,l,o,r),R(t,"vd").value=d,d},ke=(e,t,n,l,o,r)=>{m(e,{compProps:l,compChild:o,ctor:n,tagName:n.name,compKey:t,reRender:r})},we=(e,t,n)=>{if(c(e))return xe(t,...n);if(d(e)){const l=be(e,t,n);return g.value?l:l.resolve()}return{type:"element",tag:e,props:t,children:n}},Ae=(e,t)=>t.map((t=>m(Ke(t),{getParent:()=>e.value}))),Ke=e=>{if(null==e||!1===e)return{type:null};if(Array.isArray(e)){const t={value:void 0},n={type:"loop",children:Ae(t,e)};return t.value=n,n}return"string"==typeof e||"number"==typeof e?{type:"text",text:e}:e};e.Fragment=xe,e.h=(e,t,...n)=>{const l={value:void 0},o=t||{},r=Ae(l,n),c=we(e,o,r);return d(c)||(l.value=c),c},e.mount=e=>(t,n)=>e,e.mountCallback=e=>E.get(C()).mts.push(e),e.nextTick=()=>Promise.resolve(),e.ref=e=>({value:e}),e.render=(e,t,n)=>{t??(t=document.body),e.isRoot=!0,e.wrapElement=t;const l=_(e);return n?(e.afterElement=n,t.insertBefore(l,n)):t.appendChild(l),N(),()=>{var t;const n=null==(t=E.get(e.compProps||{}))?void 0:t.vd.value;n&&(S(n),B(n),D(n))}},e.updateCallback=(e,t=(()=>[]))=>{E.get(C()).upR.push((()=>w(e,t))),w(e,t)},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).lithent={})}(this,(function(e){"use strict";const t=e=>"object"==typeof e&&!("resolve"in e),n=(e,n)=>t(e)&&e.type===n,l=(e,n)=>t(e)&&(null==n?void 0:n.type)===e.type&&("loop"!==e.type||"loop"===e.type&&u(o((e.children||[])[0]))&&u(o((n.children||[])[0]))),o=e=>{var t,n;return(null==(t=null==e?void 0:e.compProps)?void 0:t.key)??(null==(n=null==e?void 0:e.props)?void 0:n.key)},r=e=>e&&["fragment","loop"].includes(e),d=e=>"function"==typeof e&&!c(e)||"object"==typeof e&&"resolve"in e,c=e=>"function"==typeof e&&e===xe,i=e=>t(e)&&!e.type,u=e=>null!=e,p=(e,t)=>"style"===e&&"object"==typeof t,s={c:(e,t)=>"ctor"in e?e.ctor===(null==t?void 0:t.ctor):e===(null==t?void 0:t.ctor),l:l,t:l,e:(e,n)=>{var l,o;return t(e)&&"element"===(null==n?void 0:n.type)&&(null==n?void 0:n.tag)===e.tag&&(null==(l=null==n?void 0:n.children)?void 0:l.length)===(null==(o=null==e?void 0:e.children)?void 0:o.length)},f:(e,n)=>{var l,o;return t(e)&&"fragment"===(null==n?void 0:n.type)&&(null==(l=null==n?void 0:n.children)?void 0:l.length)===(null==(o=null==e?void 0:e.children)?void 0:o.length)},et:l},a=e=>e.getParent&&e.getParent(),v=Object.entries,h=Object.keys,m=Object.assign,f={value:""},y={value:{}},g={value:!1},E=new WeakMap,C=()=>y.value,R=(e,t)=>E.get(e)[t],x=e=>{y.value=e,(e=>{E.set(e,{vd:{value:null},up:()=>{},upR:[],upS:{value:0},upD:[],upCB:[],mts:[],umts:[]})})(e)},S=e=>{const{compKey:t}=e;t&&P(t),b(e)},b=e=>{(e.children||[]).forEach((e=>{e.compKey?S(e):b(e)}))},P=e=>{const t=E.get(e);t&&(t.umts.forEach((e=>e())),t.umts=[],E.delete(e))};let T=[];const N=()=>{T.forEach((e=>k(e))),T=[]},k=e=>{const{compKey:t}=e;if(t){const e=E.get(t),n=null==e?void 0:e.mts,l=null==e?void 0:e.upS;y.value=t,l&&(l.value=0),n&&(e.mts=[],n.forEach((e=>{const t=e();var n;t&&(n=t,E.get(C()).umts.push(n))})))}},w=(e,t=(()=>[]))=>{const n=E.get(C()),{upD:l,upS:o}=n,r=l[o.value];if(r&&A(r,t())){const t=e();t&&n.upCB.push(t)}l[o.value]=t(),o.value+=1},A=(e,t)=>!e.length||e.some(((e,n)=>e!==t[n])),K=e=>e.replace(/^on(.*)/,((e,t)=>t.toLowerCase())),j=()=>new DocumentFragment,O=e=>document.createElement(e),U=e=>{const{needRerender:t}=e;t&&"N"!==t&&({A:q,D:L,R:z,U:J,CNSU:J,SR:H,SU:I}[t](e),delete e.needRerender,delete e.oldChildren,delete e.oldProps)},B=e=>{e.props&&e.el&&G(e.props,e.el),(e.children||[]).forEach((e=>{B(e)}))},D=e=>{M(e,e.wrapElement)},L=e=>{e.oldProps&&e.el&&G(e.oldProps,e.el),M(e,le(a(e)))},M=(e,t)=>{var n,l;t&&e.el&&(1===(null==(n=e.el)?void 0:n.nodeType)?t.removeChild(e.el):11===(null==(l=e.el)?void 0:l.nodeType)&&F(e,t),delete e.el)},F=(e,t)=>{((null==e?void 0:e.oldChildren)||(null==e?void 0:e.children)||[]).forEach((e=>{var n,l;1===(null==(n=e.el)?void 0:n.nodeType)?t.removeChild(null==e?void 0:e.el):11===(null==(l=e.el)?void 0:l.nodeType)&&F(e,t)}))},H=e=>{L(e),q(e)},I=e=>{J(e);if("CNSU"!==a(e).needRerender){const t=V(e);q(e,t)}},q=(e,t)=>{t||(t=_(e));const n=a(e);if(n.type){const l=le(n),o="loop"===n.type&&n.needRerender&&"CNSU"!==n.needRerender?W(n,a(n)):W(e,n);t&&l&&(o?l.insertBefore(t,o):l.appendChild(t),N())}},V=e=>r(e.type)?((null==e?void 0:e.children)||[]).reduce(((e,t)=>{const n=V(t);return n&&e.appendChild(n),e}),j()):e.el,W=(e,t)=>{const n=t.children||[],l=n.indexOf(e)+1,o=n.slice(l),d=X(o),c=t.type||"";return d||(!t.isRoot&&r(c)?W(t,a(t)):t.isRoot&&r(c)&&t.afterElement?t.afterElement:void 0)},X=e=>e.reduce(((e,t)=>{const n=t.type,l=t.el,o=n&&r(n);return e||(o?X(t.children||[]):l&&11!==l.nodeType?l:e)}),void 0),z=e=>{const t=a(e),n=e.el;if(t.type&&n)if(11===n.nodeType)H(e);else{const l=le(t),o=_(e);l&&l.replaceChild(o,n),N()}},G=(e,t)=>{v(e||{}).forEach((([e,n])=>{e.match(/^on/)&&t.removeEventListener(K(e),n)}))},J=e=>{var t;const n=e.el;if("text"!==e.type){if(n){const{oldProps:l,props:o}=e;Y(o,n,l),delete e.oldProps,"input"===e.tag&&(n.value=String((null==(t=null==e?void 0:e.props)?void 0:t.value)||""))}(e.children||[]).forEach((e=>U(e))),(e=>{const{compKey:t}=e;if(t){const n=E.get(t),l=null==n?void 0:n.upCB,o=null==n?void 0:n.upS;y.value=t,o&&(o.value=0),e.ctor&&l&&(n.upCB=[],l.forEach((e=>e())))}})(e)}else Q(e)},Q=e=>{const t=e.el;t&&(t.nodeValue=String(e.text))},Y=(e,t,n)=>{const l={...n};v(e||{}).forEach((([e,n])=>{let o=!0;var r;"key"===e||n===l[e]||("innerHTML"===e&&"string"==typeof n?t.innerHTML=n:p(e,n)?ne(n,p(e,l.style)?l.style:{},t):((e,t)=>"ref"===e&&"object"==typeof t)(e,n)?n.value=t:e.match(/^on/)?te(t,e,n,l[e]):(e=>1===e.nodeType&&["radio","checkbox"].includes(e.type))(t)&&"checked"===e?t.checked=!!n:(e=>1===e.nodeType&&"TEXTAREA"===e.tagName)(t)&&"value"===e?t.value=n:(e=>1===e.nodeType&&"OPTION"===e.tagName)(t)&&"selected"===e?t.selected=!!n:e&&([o,n]=$(n),o&&Z("className"===(r=e)?"class":r,t,n))),o&&delete l[e]})),h(l).forEach((e=>t.removeAttribute(e)))},Z=(e,t,n)=>{f.value&&"xmlns"!==e?t.setAttributeNS(null,e,n):t.setAttribute(e,n)},$=e=>{let t=!0;return"boolean"==typeof e&&(e||(t=!1),e=""),[t,String(e)]},_=e=>{let t;const{type:n,tag:l,text:o,props:d,children:c=[]}=e,i=r(n);return"svg"===l&&(f.value=String(null==d?void 0:d.xmlns)),t=i?j():"element"===n&&l?f.value?document.createElementNS(f.value,l):O(l):"text"===n&&u(o)?document.createTextNode(String(o)):O("e"),ee(c,t),Y(d,t),e.el=t,(e=>{e.compKey&&T.push(e)})(e),"svg"===l&&(f.value=""),t},ee=(e,t)=>{const n=e.reduce(((e,t)=>(t.type&&e.appendChild(_(t)),e)),j());t&&n.hasChildNodes()&&t.appendChild(n)},te=(e,t,n,l)=>{const o=K(t);l!==n&&(l&&e.removeEventListener(o,l),n&&e.addEventListener(o,n))},ne=(e,t,n)=>{const l={...t},o=null==n?void 0:n.style;o&&(v(e).forEach((([e,t])=>{o[e]=t,delete l[e]})),v(l).forEach((([e])=>o[e]="")))},le=e=>{const t=r(e.type);return e.isRoot&&t?e.wrapElement:t?le(a(e)):e.el},oe=(e,t)=>re(e,s[(e=>{let t="et";return d(e)?t="c":n(e,"fragment")?t="f":n(e,"element")?t="e":n(e,"loop")?t="l":n(e,"text")?t="t":i(e)&&(t="et"),t})(e)](e,t),t),re=(e,t,n)=>{const l=pe(e,t,n),o=[l,t,n],r=ce(...o);return l.children=se(...o),l.needRerender=r,de(l,n,r),n&&delete n.children,l},de=(e,t,n)=>{"A"!==n&&t&&(e.el=t.el),n&&["D","R","SR"].includes(n)&&((null==t?void 0:t.compKey)&&(S(t),B(t)),e.oldChildren=null==t?void 0:t.children),e.oldProps=null==t?void 0:t.props},ce=(e,t,n)=>{const l=n&&n.type,r=i(e),d=e.isRoot,c=n&&a(n),p=!d&&(null==c?void 0:c.type),s=o(e),v="loop"===p&&u(s),h="text"===e.type&&t&&e.text===(null==n?void 0:n.text);let m;return m=r?"D":h?"N":l?t?v?"SU":"U":v?"SR":"R":"A","loop"===e.type&&"U"===m&&n&&ie(e,n)&&(m="CNSU"),m},ie=(e,t)=>{const n=[...(null==t?void 0:t.children)||[]],l=[...(null==e?void 0:e.children)||[]].filter((e=>n.find((t=>o(e)===o(t))))),r=n.filter((e=>l.find((t=>o(e)===o(t)))));let d=r.length===l.length;return d&&(d=r.every(((e,t)=>o(e)===o(l[t])))),d},ue=(e,t)=>{const{compProps:n,compChild:l}=e,{props:o,children:r}=t;n&&((e,t)=>{e&&t!==e&&(h(e).forEach((t=>delete e[t])),v(t||{}).forEach((([t,n])=>e[t]=n)))})(n,o),l&&((e,t)=>{e&&t!==e&&(e.splice(0,e.length),t&&t.forEach((t=>e.push(t))))})(l,r);return e.reRender&&e.reRender()},pe=(e,t,n)=>d(e)?t&&n?ue(n,e):e.resolve():e,se=(e,t,n)=>t&&n?ve(e,n):ae(e),ae=e=>(e.children||[]).map((t=>m(oe(t),{getParent:()=>e}))),ve=(e,t)=>"loop"===e.type&&u(o((e.children||[])[0]))?he(e,t):(e.children||[]).map(((n,l)=>m(oe(n,(t.children||[])[l]),{getParent:()=>e}))),he=(e,t)=>{const[n,l]=me(e,t);return l.map((e=>{S(e),B(e),L(e)})),n},me=(e,t)=>{const n=[...e.children||[]],l=[...t.children||[]];return[n.map((t=>{const n=fe(t,l),o=oe(t,n);return n&&l.splice(l.indexOf(n),1),o.getParent=()=>e,o})),l]},fe=(e,t)=>t.find((t=>o(t)===o(e)));let ye=[],ge=!1;const Ee=(e,t)=>{E.get(e).up=()=>{ye.push({compKey:e,exec:t}),ge||(ge=!0,queueMicrotask(Re))}},Ce=(e,t)=>{(e.children||[]).forEach((e=>{const n=e.compKey;n&&t.push(n),Ce(e,t)}))},Re=()=>{let e=[];ye.forEach((t=>{var n,l;const o=null==(l=null==(n=E.get(t.compKey))?void 0:n.vd)?void 0:l.value;o&&Ce(o,e)}));const t=[],n=ye.reduce(((n,l)=>{const{compKey:o}=l;return e.includes(o)||t.includes(o)||(t.push(o),n.push(l)),n}),[]);for(;n.length;){const e=n.shift();e&&e.exec()}ye=[],ge=!1},xe=(e,...t)=>({type:"fragment",children:t}),Se=(e,t,n,l)=>{var o;g.value=!0;const r=be(e,t,n),d=oe(r,l),{isRoot:c,getParent:i,wrapElement:u,afterElement:p}=l;if(d.getParent=i,!c&&i){const e=(null==(o=i())?void 0:o.children)||[],t=e.indexOf(l);e.splice(t,1,d)}else d.isRoot=!0,d.wrapElement=u,d.afterElement=p;g.value=!1,U(d)},be=(e,t,n)=>({tagName:e.name,ctor:e,props:t,children:n,resolve:(l=t)=>{x(l);const o=e(t,n)((e=>()=>{var t;const n=null==(t=E.get(e))?void 0:t.up;let l=!1;return n&&(n(),l=!0),l})(l),t,n),r=Pe(o,l,e,t,n),d=r;return Ee(l,(()=>Se(e,t,n,d))),R(l,"vd").value=r,r}}),Pe=(e,t,n,l,o)=>{const r=e(l);if(r.reRender)throw new Error('Avoid the case where the first element of a component is a component. Instead of "mount(()=>()=><Component />)" replace it with something like "mount(()=>()=><Fragment><Component /></Fragment>)".');return ke(r,t,n,l,o,Te(e,t,n,l,o)),r},Te=(e,t,n,l,o)=>{const r=()=>Ne(e,t,n,l,o,r);return r},Ne=(e,t,n,l,o,r)=>{(e=>{y.value=e})(t),(()=>{var e;const t=null==(e=E.get(C()))?void 0:e.upR;(null==t?void 0:t.length)&&t.forEach((e=>e()))})();const d=e(l);return Ee(t,(()=>Se(n,l,o,d))),ke(d,t,n,l,o,r),R(t,"vd").value=d,d},ke=(e,t,n,l,o,r)=>{m(e,{compProps:l,compChild:o,ctor:n,tagName:n.name,compKey:t,reRender:r})},we=(e,t,n)=>{if(c(e))return xe(t,...n);if(d(e)){const l=be(e,t,n);return g.value?l:l.resolve()}return{type:"element",tag:e,props:t,children:n}},Ae=(e,t)=>t.map((t=>m(Ke(t),{getParent:()=>e.value}))),Ke=e=>{if(null==e||!1===e)return{type:null};if(Array.isArray(e)){const t={value:void 0},n={type:"loop",children:Ae(t,e)};return t.value=n,n}return"string"==typeof e||"number"==typeof e?{type:"text",text:e}:e};e.Fragment=xe,e.h=(e,t,...n)=>{const l={value:void 0},o=t||{},r=Ae(l,n),c=we(e,o,r);return d(c)||(l.value=c),c},e.mount=e=>(t,n)=>e,e.mountCallback=e=>E.get(C()).mts.push(e),e.nextTick=()=>Promise.resolve(),e.ref=e=>({value:e}),e.render=(e,t,n)=>{t??(t=document.body),e.isRoot=!0,e.wrapElement=t;const l=_(e);return n?(e.afterElement=n,t.insertBefore(l,n)):t.appendChild(l),N(),()=>{var t;const n=null==(t=E.get(e.compProps||{}))?void 0:t.vd.value;n&&(S(n),B(n),D(n))}},e.updateCallback=(e,t=(()=>[]))=>{E.get(C()).upR.push((()=>w(e,t))),w(e,t)},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
2
2
  //# sourceMappingURL=lithent.umd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lithent.umd.js","sources":["../src/utils/predicator.ts","../src/utils/index.ts","../src/utils/universalRef.ts","../src/hook/unmount.ts","../src/hook/mountCallback.ts","../src/hook/useUpdate.ts","../src/render.ts","../src/diff.ts","../src/utils/redraw.ts","../src/wDom.ts","../src/hook/updateCallback.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) =>\n checkPlainWDomType(newWDom) &&\n originalWDom?.type === newWDom.type &&\n (newWDom.type !== 'loop' ||\n (newWDom.type === 'loop' &&\n checkExisty(getKey((newWDom.children || [])[0])) &&\n checkExisty(getKey((originalWDom.children || [])[0]))));\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 checkOptionElement = (element: any): element is HTMLElement =>\n element.nodeType === 1 && element.tagName === 'OPTION';\n\nexport const checkTextareaElement = (element: any): element is HTMLElement =>\n element.nodeType === 1 && element.tagName === 'TEXTAREA';\n\nexport const checkCheckableElement = (element: any): element is HTMLElement =>\n element.nodeType === 1 && ['radio', 'checkbox'].includes(element.type);\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: checkNormalTypeElement,\n t: checkNormalTypeElement,\n e: checkSameTagElement,\n f: checkSameFragment,\n et: checkNormalTypeElement,\n};\n","import { WDom } from '@/types';\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;\n","import { ComponentRef, ComponentSubKey, Props } from '@/types';\n\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 = (compKey: Props, subKey: ComponentSubKey) =>\n componentRef.get(compKey)![subKey];\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';\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 checkOptionElement,\n checkTextareaElement,\n checkCheckableElement,\n checkVirtualType,\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) => {\n wrapElement ??= document.body;\n wDom.isRoot = true;\n wDom.wrapElement = wrapElement;\n\n const Dom = wDomToDom(wDom);\n\n if (afterElement) {\n wDom.afterElement = afterElement;\n wrapElement.insertBefore(Dom, afterElement);\n } else {\n wrapElement.appendChild(Dom);\n }\n\n execMountedQueue();\n\n return () => {\n const component = componentRef.get(wDom.compProps || {})?.vd.value;\n if (component) {\n runUnmountQueueFromWDom(component);\n recursiveRemoveEvent(component);\n rootDelete(component);\n }\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 (newWDom.el?.nodeType === 1) {\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 if (item.el?.nodeType === 1) {\n parent.removeChild(item?.el);\n } else if (item.el?.nodeType === 11) {\n findChildWithRemoveElement(item, parent);\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 (nextEl) {\n parentEl.insertBefore(newElement, nextEl);\n } else {\n parentEl.appendChild(newElement);\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) {\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\n) => {\n const originalProps = { ...oldProps };\n\n entries(props || {}).forEach(([dataKey, dataValue]: [string, unknown]) => {\n let chkRemoveProp = true;\n if (dataKey === 'key') {\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) ? originalProps.style : {},\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 (checkCheckableElement(element) && dataKey === 'checked') {\n (element as HTMLInputElement).checked = !!dataValue;\n } else if (checkTextareaElement(element) && dataKey === 'value') {\n (element as HTMLInputElement).value = dataValue as string;\n } else if (checkOptionElement(element) && dataKey === 'selected') {\n (element as HTMLOptionElement).selected = !!dataValue;\n } else if (dataKey) {\n [chkRemoveProp, dataValue] = makeAttrDataValue(dataValue);\n\n if (chkRemoveProp) {\n setAttr(\n getAttrKey(dataKey),\n element as HTMLElement,\n dataValue as string\n );\n }\n }\n\n if (chkRemoveProp) {\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 makeAttrDataValue = (dataValue: unknown): [boolean, string] => {\n let allowSetAttr = true;\n if (typeof dataValue === 'boolean') {\n if (!dataValue) {\n allowSetAttr = false;\n }\n\n dataValue = '';\n }\n\n return [allowSetAttr, String(dataValue)];\n};\n\nconst wDomToDom = (wDom: WDom) => {\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 (isVirtualType) {\n element = DF();\n } else if (type === 'element' && tag) {\n element = xmlnsRef.value\n ? document.createElementNS(xmlnsRef.value, tag)\n : CE(tag);\n } else if (type === 'text' && checkExisty(text)) {\n element = document.createTextNode(String(text));\n } else {\n element = CE('e');\n }\n\n wDomChildrenToDom(children, element);\n updateProps(props, element);\n\n wDom.el = element as HTMLElement;\n\n addMountedQueue(wDom);\n\n if (tag === 'svg') {\n xmlnsRef.value = '';\n }\n\n return element;\n};\n\nconst wDomChildrenToDom = (\n children: WDom[],\n parentElement?: HTMLElement | Element | DocumentFragment | Text\n) => {\n const elementChildren = children.reduce(\n (acc: DocumentFragment, childItem: WDom) => {\n if (childItem.type) {\n acc.appendChild(wDomToDom(childItem));\n }\n\n return acc;\n },\n DF()\n );\n\n if (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\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\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\n remakeWDom.children = remakeChildrenForDiff(...param);\n remakeWDom.needRerender = needRerender;\n\n inheritPropForRender(remakeWDom, originalWDom, needRerender);\n\n if (originalWDom) {\n delete originalWDom.children;\n }\n\n return remakeWDom;\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?.compKey) {\n runUnmountQueueFromWDom(originalWDom);\n recursiveRemoveEvent(originalWDom);\n }\n remakeWDom.oldChildren = originalWDom?.children;\n }\n\n remakeWDom.oldProps = originalWDom?.props;\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\n let result: RenderType | undefined;\n if (isEmptyElement) {\n result = 'D';\n } else if (isSameText) {\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\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\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\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\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\nconst remakeChildrenForDiff = (\n newWDom: WDom,\n isSameType: boolean,\n originalWDom?: WDom\n) =>\n isSameType && originalWDom\n ? remakeChildrenForUpdate(newWDom, originalWDom)\n : remakeChildrenForAdd(newWDom);\n\nconst remakeChildrenForAdd = (newWDom: WDom) =>\n (newWDom.children || []).map((item: WDom) =>\n assign(makeNewWDomTree(item), { getParent: () => newWDom })\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\nconst remakeChildrenForLoopUpdate = (newWDom: WDom, originalWDom: WDom) => {\n const [remakedChildren, unUsedChildren] = diffLoopChildren(\n newWDom,\n originalWDom\n );\n\n unUsedChildren.map(unusedItem => {\n runUnmountQueueFromWDom(unusedItem);\n recursiveRemoveEvent(unusedItem);\n typeDelete(unusedItem);\n });\n\n return remakedChildren;\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\nconst findSameKeyOriginalItem = (item: WDom, originalChildren: WDom[]) =>\n originalChildren.find(\n orignalChildItem => getKey(orignalChildItem) === getKey(item)\n );\n","import { Props, WDom, RedrawQueueList } from '@/types';\nimport { componentRef } from '@/utils/universalRef';\n\nlet redrawQueue: { compKey: Props; exec: () => void }[] = [];\nlet redrawQueueTimeout: boolean = false;\n\nexport const setRedrawAction = (compKey: Props, exec: () => void) => {\n componentRef.get(compKey)!.up = () => {\n redrawQueue.push({\n compKey,\n exec,\n });\n\n if (!redrawQueueTimeout) {\n redrawQueueTimeout = true;\n queueMicrotask(execRedrawQueue);\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 recursiveGetChildKeys = (wDom: WDom, result: Props[]) => {\n (wDom.children || []).forEach(item => {\n const childComKey = item.compKey;\n if (childComKey) {\n result.push(childComKey);\n }\n\n recursiveGetChildKeys(item, result);\n });\n};\n\nconst execRedrawQueue = () => {\n let childItemList: Props[] = [];\n\n redrawQueue.forEach(item => {\n const childVd = componentRef.get(item.compKey)?.vd?.value;\n if (childVd) {\n recursiveGetChildKeys(childVd, childItemList);\n }\n });\n\n const addedKey: Props[] = [];\n const result = redrawQueue.reduce((acc, item) => {\n const { compKey } = item;\n\n if (childItemList.includes(compKey) || addedKey.includes(compKey)) {\n return acc;\n }\n\n addedKey.push(compKey);\n acc.push(item);\n\n return acc;\n }, [] as RedrawQueueList);\n\n while (result.length) {\n const action = result.shift();\n if (action) {\n action.exec();\n }\n }\n\n redrawQueue = [];\n redrawQueueTimeout = false;\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} 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\nexport const Fragment = (_props: Props, ...children: WDom[]) => ({\n type: 'fragment',\n children,\n});\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\nexport const mount =\n <T>(component: Component<T>) =>\n (_props: T, _children: WDom[]) =>\n component;\n\nconst reRenderCustomComponent = (\n tag: TagFunction,\n props: Props,\n children: WDom[],\n originalWDom: WDom\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 wDomUpdate(newWDomTree);\n};\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 const originalWDom = customNode;\n\n setRedrawAction(compKey, () =>\n reRenderCustomComponent(tag, props, children, originalWDom)\n );\n\n (getComponentSubInfo(compKey, 'vd') as { value: WDom }).value = customNode;\n\n return customNode;\n };\n\n return { tagName, ctor, props, children, resolve };\n};\n\nconst makeCustomNode = (\n componentMaker: (props: Props) => WDom,\n compKey: Props,\n tag: TagFunction,\n props: Props,\n children: WDom[]\n) => {\n const customNode = componentMaker(props);\n if (customNode.reRender) {\n throw new Error(\n 'Avoid the case where the first element of a component is a component. Instead of \"mount(()=>()=><Component />)\" replace it with something like \"mount(()=>()=><Fragment><Component /></Fragment>)\".'\n );\n }\n\n addComponentProps(\n customNode,\n compKey,\n tag,\n props,\n children,\n makeReRender(componentMaker, compKey, tag, props, children)\n );\n\n return customNode;\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\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 originalWDom = componentMaker(props);\n\n setRedrawAction(compKey, () =>\n reRenderCustomComponent(tag, props, children, originalWDom)\n );\n\n addComponentProps(originalWDom, compKey, tag, props, children, reRender);\n\n (getComponentSubInfo(compKey, 'vd') as { value: WDom }).value = originalWDom;\n\n return originalWDom;\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\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 tag,\n props,\n children,\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\nconst makeChildrenItem = (item: MiddleStateWDom): WDom => {\n if (item === null || item === undefined || item === false) {\n return { type: null };\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 children,\n };\n nodeParentPointer.value = node;\n\n return node;\n } else if (typeof item === 'string' || typeof item === 'number') {\n return { type: 'text', text: item };\n }\n\n return item;\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","export const ref = <T>(initValue: T) => ({ value: initValue });\nexport const nextTick = () => Promise.resolve();\n"],"names":["checkPlainWDomType","wDom","checkPlainType","typeName","type","checkNormalTypeElement","newWDom","originalWDom","checkExisty","getKey","children","target","_a","compProps","key","_b","props","checkVirtualType","includes","checkCustemComponentFunction","checkFragmentFunction","Fragment","checkEmptyElement","value","checkStyleData","dataKey","dataValue","checkSameWDomWithOriginal","c","ctor","l","t","e","tag","length","f","et","getParent","vDom","entries","Object","keys","assign","xmlnsRef","compKeyRef","needDiffRef","componentRef","WeakMap","getComponentKey","getComponentSubInfo","compKey","subKey","get","initMountHookState","set","vd","up","upR","upS","upD","upCB","mts","umts","setComponetRef","runUnmountQueueFromWDom","removeItem","recursiveRunUnmount","forEach","item","subInfo","effect","delete","mountedQueue","execMountedQueue","runMountedQueueFromWDom","component","queue","sequence","callback","effectAction","push","useUpdated","dependencies","def","checkNeedPushQueue","originalDefs","newDefs","some","index","getEventName","eventKey","replace","_match","p1","toLowerCase","DF","DocumentFragment","CE","document","createElement","wDomUpdate","newWDomTree","needRerender","A","typeAdd","D","typeDelete","R","typeReplace","U","typeUpdate","CNSU","SR","typeSortedReplace","SU","typeSortedUpdate","oldChildren","oldProps","recursiveRemoveEvent","el","removeEvent","childItem","rootDelete","deleteRealDom","wrapElement","findRealParentElement","parent","nodeType","removeChild","findChildWithRemoveElement","newElement","getElementFromFragment","wDomToDom","parentWDom","parentEl","nextEl","startFindNextBrotherElement","insertBefore","appendChild","reduce","acc","element","brothers","nextIndex","indexOf","candidiateBrothers","slice","finedNextEl","findChildFragmentNextElement","parentType","isRoot","afterElement","targetEl","bItem","isFragment","orignalElement","parentElement","replaceChild","match","removeEventListener","updateProps$1","String","runUpdatedQueueFromWDom","updateText","nodeValue","text","updateProps","originalProps","chkRemoveProp","keyName","innerHTML","updateStyle","style","checkRefData","updateEvent","checkCheckableElement","checked","tagName","checkTextareaElement","checkOptionElement","selected","makeAttrDataValue","setAttr","removeAttribute","setAttributeNS","setAttribute","allowSetAttr","isVirtualType","xmlns","createElementNS","createTextNode","wDomChildrenToDom","addMountedQueue","elementChildren","hasChildNodes","newEventHandler","oldEventHandler","eventName","addEventListener","oldStyle","originalStyle","elementStyle","styleKey","makeNewWDomTree","remakeNewWDom","result","getWDomType","isSameType","remakeWDom","generalize","param","addReRenderTypeProperty","remakeChildrenForDiff","inheritPropForRender","existOriginalWDom","isEmptyElement","originalParentWDom","origParentType","isKeyCheckedWDom","isSameText","chkDiffLoopOrder","origChildren","newChildren","filter","find","newItem","filteredChildren","isSame","every","runUpdate","infoVdom","compChild","infoProps","infoChidren","splice","childrenItem","updateChildren","reRender","resolve","remakeChildrenForUpdate","remakeChildrenForAdd","map","remakeChildrenForLoopUpdate","remakedChildren","unUsedChildren","diffLoopChildren","unusedItem","originalChildren","originalItem","findSameKeyOriginalItem","orignalChildItem","redrawQueue","redrawQueueTimeout","setRedrawAction","exec","queueMicrotask","execRedrawQueue","recursiveGetChildKeys","childComKey","childItemList","childVd","addedKey","action","shift","_props","reRenderCustomComponent","makeWDomResolver","name","componentMaker","componentUpdate","customNode","makeCustomNode","Error","addComponentProps","makeReRender","wDomMaker","initUpdateHookState","updateReqs","makeNode","componetMakeResolver","remakeChildren","nodeParentPointer","makeChildrenItem","Array","isArray","node","newProps","_children","Promise","initValue","body","Dom"],"mappings":"+OAoBA,MAAMA,EAAsBC,GACV,iBAATA,KAAuB,YAAaA,GAEvCC,EAAiB,CAACD,EAAiBE,IACvCH,EAAmBC,IAASA,EAAKG,OAASD,EA2BtCE,EAAyB,CAC7BC,EACAC,IAEAP,EAAmBM,KACL,MAAdC,OAAc,EAAAA,EAAAH,QAASE,EAAQF,OACb,SAAjBE,EAAQF,MACW,SAAjBE,EAAQF,MACPI,EAAYC,GAAQH,EAAQI,UAAY,IAAI,MAC5CF,EAAYC,GAAQF,EAAaG,UAAY,IAAI,MAE1CD,EAAUE,YACrB,OAAA,OAAAC,EAAA,MAAAD,OAAA,EAAAA,EAAQE,gBAAR,EAAAD,EAAmBE,OAAO,OAAAC,EAAA,M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EACrC,CAAEhE,KAAM,OAAQiK,KAAMjG,GAGxBA,CAAA,oBAnNQ,CACfnC,EACAjB,KACGN,KAEG,MAAA+Q,EAAiC,CAAElQ,WAAO,GAC1CuQ,EAAW9Q,GAAS,GACpB8M,EAAc0D,GAAeC,EAAmB/Q,GAChDmR,EAAOP,GAASrP,EAAK6P,EAAUhE,GAM9B,OAJF3M,EAA6B0Q,KAChCJ,EAAkBlQ,MAAQsQ,GAGrBA,CAAA,UAIHlN,GACJ,CAAC6L,EAAWuB,IACVpN,kBLjC0BI,GAC5BjC,EAAaM,IAAIJ,KAAoBa,IAAImB,KAAKD,cOnBxB,IAAMiN,QAAQlD,gBADfmD,IAAkB,CAAE1Q,MAAO0Q,aL0B5B,CACpBhS,EACA2H,EACA2B,KAEA3B,IAAAA,EAAgB1B,SAASgM,MACzBjS,EAAKqJ,QAAS,EACdrJ,EAAK2H,YAAcA,EAEb,MAAAuK,EAAM/J,EAAUnI,GAWtB,OATIsJ,GACFtJ,EAAKsJ,aAAeA,EACR3B,EAAAa,aAAa0J,EAAK5I,IAE9B3B,EAAYc,YAAYyJ,OAKnB,WACC,MAAAxN,EAAY,OAAA/D,IAAawC,IAAInD,EAAKY,WAAa,CAAE,SAArC,EAAAD,EAAwC2C,GAAGhC,MACzDoD,IACFX,EAAwBW,GACxB2C,EAAqB3C,GACrB+C,EAAW/C,GACb,CAAA,mBIhD0B,CAC5BI,EACAG,EAA4B,KAAM,OAEfpC,EAAaM,IAAIJ,KAAoBS,IAE7CuB,MAAK,IAAMC,EAAWF,EAAcG,KAC/CD,EAAWF,EAAcG,EAAY"}
1
+ {"version":3,"file":"lithent.umd.js","sources":["../src/utils/predicator.ts","../src/utils/index.ts","../src/utils/universalRef.ts","../src/hook/unmount.ts","../src/hook/mountCallback.ts","../src/hook/useUpdate.ts","../src/render.ts","../src/diff.ts","../src/utils/redraw.ts","../src/wDom.ts","../src/hook/updateCallback.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) =>\n checkPlainWDomType(newWDom) &&\n originalWDom?.type === newWDom.type &&\n (newWDom.type !== 'loop' ||\n (newWDom.type === 'loop' &&\n checkExisty(getKey((newWDom.children || [])[0])) &&\n checkExisty(getKey((originalWDom.children || [])[0]))));\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 checkOptionElement = (element: any): element is HTMLElement =>\n element.nodeType === 1 && element.tagName === 'OPTION';\n\nexport const checkTextareaElement = (element: any): element is HTMLElement =>\n element.nodeType === 1 && element.tagName === 'TEXTAREA';\n\nexport const checkCheckableElement = (element: any): element is HTMLElement =>\n element.nodeType === 1 && ['radio', 'checkbox'].includes(element.type);\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: checkNormalTypeElement,\n t: checkNormalTypeElement,\n e: checkSameTagElement,\n f: checkSameFragment,\n et: checkNormalTypeElement,\n};\n","import { WDom } from '@/types';\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;\n","import { ComponentRef, ComponentSubKey, Props } from '@/types';\n\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 = (compKey: Props, subKey: ComponentSubKey) =>\n componentRef.get(compKey)![subKey];\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';\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 checkOptionElement,\n checkTextareaElement,\n checkCheckableElement,\n checkVirtualType,\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) => {\n wrapElement ??= document.body;\n wDom.isRoot = true;\n wDom.wrapElement = wrapElement;\n\n const Dom = wDomToDom(wDom);\n\n if (afterElement) {\n wDom.afterElement = afterElement;\n wrapElement.insertBefore(Dom, afterElement);\n } else {\n wrapElement.appendChild(Dom);\n }\n\n execMountedQueue();\n\n return () => {\n const component = componentRef.get(wDom.compProps || {})?.vd.value;\n if (component) {\n runUnmountQueueFromWDom(component);\n recursiveRemoveEvent(component);\n rootDelete(component);\n }\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 (newWDom.el?.nodeType === 1) {\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 if (item.el?.nodeType === 1) {\n parent.removeChild(item?.el);\n } else if (item.el?.nodeType === 11) {\n findChildWithRemoveElement(item, parent);\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 (nextEl) {\n parentEl.insertBefore(newElement, nextEl);\n } else {\n parentEl.appendChild(newElement);\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) {\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\n) => {\n const originalProps = { ...oldProps };\n\n entries(props || {}).forEach(([dataKey, dataValue]: [string, unknown]) => {\n let chkRemoveProp = true;\n\n if (dataKey === 'key' || dataValue === originalProps[dataKey]) {\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) ? originalProps.style : {},\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 (checkCheckableElement(element) && dataKey === 'checked') {\n (element as HTMLInputElement).checked = !!dataValue;\n } else if (checkTextareaElement(element) && dataKey === 'value') {\n (element as HTMLInputElement).value = dataValue as string;\n } else if (checkOptionElement(element) && dataKey === 'selected') {\n (element as HTMLOptionElement).selected = !!dataValue;\n } else if (dataKey) {\n [chkRemoveProp, dataValue] = makeAttrDataValue(dataValue);\n\n if (chkRemoveProp) {\n setAttr(\n getAttrKey(dataKey),\n element as HTMLElement,\n dataValue as string\n );\n }\n }\n\n if (chkRemoveProp) {\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 makeAttrDataValue = (dataValue: unknown): [boolean, string] => {\n let allowSetAttr = true;\n if (typeof dataValue === 'boolean') {\n if (!dataValue) {\n allowSetAttr = false;\n }\n\n dataValue = '';\n }\n\n return [allowSetAttr, String(dataValue)];\n};\n\nconst wDomToDom = (wDom: WDom) => {\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 (isVirtualType) {\n element = DF();\n } else if (type === 'element' && tag) {\n element = xmlnsRef.value\n ? document.createElementNS(xmlnsRef.value, tag)\n : CE(tag);\n } else if (type === 'text' && checkExisty(text)) {\n element = document.createTextNode(String(text));\n } else {\n element = CE('e');\n }\n\n wDomChildrenToDom(children, element);\n updateProps(props, element);\n\n wDom.el = element as HTMLElement;\n\n addMountedQueue(wDom);\n\n if (tag === 'svg') {\n xmlnsRef.value = '';\n }\n\n return element;\n};\n\nconst wDomChildrenToDom = (\n children: WDom[],\n parentElement?: HTMLElement | Element | DocumentFragment | Text\n) => {\n const elementChildren = children.reduce(\n (acc: DocumentFragment, childItem: WDom) => {\n if (childItem.type) {\n acc.appendChild(wDomToDom(childItem));\n }\n\n return acc;\n },\n DF()\n );\n\n if (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\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\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\n remakeWDom.children = remakeChildrenForDiff(...param);\n remakeWDom.needRerender = needRerender;\n\n inheritPropForRender(remakeWDom, originalWDom, needRerender);\n\n if (originalWDom) {\n delete originalWDom.children;\n }\n\n return remakeWDom;\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?.compKey) {\n runUnmountQueueFromWDom(originalWDom);\n recursiveRemoveEvent(originalWDom);\n }\n remakeWDom.oldChildren = originalWDom?.children;\n }\n\n remakeWDom.oldProps = originalWDom?.props;\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\n let result: RenderType | undefined;\n if (isEmptyElement) {\n result = 'D';\n } else if (isSameText) {\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\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\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\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\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\nconst remakeChildrenForDiff = (\n newWDom: WDom,\n isSameType: boolean,\n originalWDom?: WDom\n) =>\n isSameType && originalWDom\n ? remakeChildrenForUpdate(newWDom, originalWDom)\n : remakeChildrenForAdd(newWDom);\n\nconst remakeChildrenForAdd = (newWDom: WDom) =>\n (newWDom.children || []).map((item: WDom) =>\n assign(makeNewWDomTree(item), { getParent: () => newWDom })\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\nconst remakeChildrenForLoopUpdate = (newWDom: WDom, originalWDom: WDom) => {\n const [remakedChildren, unUsedChildren] = diffLoopChildren(\n newWDom,\n originalWDom\n );\n\n unUsedChildren.map(unusedItem => {\n runUnmountQueueFromWDom(unusedItem);\n recursiveRemoveEvent(unusedItem);\n typeDelete(unusedItem);\n });\n\n return remakedChildren;\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\nconst findSameKeyOriginalItem = (item: WDom, originalChildren: WDom[]) =>\n originalChildren.find(\n orignalChildItem => getKey(orignalChildItem) === getKey(item)\n );\n","import { Props, WDom, RedrawQueueList } from '@/types';\nimport { componentRef } from '@/utils/universalRef';\n\nlet redrawQueue: { compKey: Props; exec: () => void }[] = [];\nlet redrawQueueTimeout: boolean = false;\n\nexport const setRedrawAction = (compKey: Props, exec: () => void) => {\n componentRef.get(compKey)!.up = () => {\n redrawQueue.push({\n compKey,\n exec,\n });\n\n if (!redrawQueueTimeout) {\n redrawQueueTimeout = true;\n queueMicrotask(execRedrawQueue);\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 recursiveGetChildKeys = (wDom: WDom, result: Props[]) => {\n (wDom.children || []).forEach(item => {\n const childComKey = item.compKey;\n if (childComKey) {\n result.push(childComKey);\n }\n\n recursiveGetChildKeys(item, result);\n });\n};\n\nconst execRedrawQueue = () => {\n let childItemList: Props[] = [];\n\n redrawQueue.forEach(item => {\n const childVd = componentRef.get(item.compKey)?.vd?.value;\n if (childVd) {\n recursiveGetChildKeys(childVd, childItemList);\n }\n });\n\n const addedKey: Props[] = [];\n const result = redrawQueue.reduce((acc, item) => {\n const { compKey } = item;\n\n if (childItemList.includes(compKey) || addedKey.includes(compKey)) {\n return acc;\n }\n\n addedKey.push(compKey);\n acc.push(item);\n\n return acc;\n }, [] as RedrawQueueList);\n\n while (result.length) {\n const action = result.shift();\n if (action) {\n action.exec();\n }\n }\n\n redrawQueue = [];\n redrawQueueTimeout = false;\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} 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\nexport const Fragment = (_props: Props, ...children: WDom[]) => ({\n type: 'fragment',\n children,\n});\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\nexport const mount =\n <T>(component: Component<T>) =>\n (_props: T, _children: WDom[]) =>\n component;\n\nconst reRenderCustomComponent = (\n tag: TagFunction,\n props: Props,\n children: WDom[],\n originalWDom: WDom\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 wDomUpdate(newWDomTree);\n};\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 const originalWDom = customNode;\n\n setRedrawAction(compKey, () =>\n reRenderCustomComponent(tag, props, children, originalWDom)\n );\n\n (getComponentSubInfo(compKey, 'vd') as { value: WDom }).value = customNode;\n\n return customNode;\n };\n\n return { tagName, ctor, props, children, resolve };\n};\n\nconst makeCustomNode = (\n componentMaker: (props: Props) => WDom,\n compKey: Props,\n tag: TagFunction,\n props: Props,\n children: WDom[]\n) => {\n const customNode = componentMaker(props);\n if (customNode.reRender) {\n throw new Error(\n 'Avoid the case where the first element of a component is a component. Instead of \"mount(()=>()=><Component />)\" replace it with something like \"mount(()=>()=><Fragment><Component /></Fragment>)\".'\n );\n }\n\n addComponentProps(\n customNode,\n compKey,\n tag,\n props,\n children,\n makeReRender(componentMaker, compKey, tag, props, children)\n );\n\n return customNode;\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\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 originalWDom = componentMaker(props);\n\n setRedrawAction(compKey, () =>\n reRenderCustomComponent(tag, props, children, originalWDom)\n );\n\n addComponentProps(originalWDom, compKey, tag, props, children, reRender);\n\n (getComponentSubInfo(compKey, 'vd') as { value: WDom }).value = originalWDom;\n\n return originalWDom;\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\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 tag,\n props,\n children,\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\nconst makeChildrenItem = (item: MiddleStateWDom): WDom => {\n if (item === null || item === undefined || item === false) {\n return { type: null };\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 children,\n };\n nodeParentPointer.value = node;\n\n return node;\n } else if (typeof item === 'string' || typeof item === 'number') {\n return { type: 'text', text: item };\n }\n\n return item;\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","export const ref = <T>(initValue: T) => ({ value: initValue });\nexport const nextTick = () => Promise.resolve();\n"],"names":["checkPlainWDomType","wDom","checkPlainType","typeName","type","checkNormalTypeElement","newWDom","originalWDom","checkExisty","getKey","children","target","_a","compProps","key","_b","props","checkVirtualType","includes","checkCustemComponentFunction","checkFragmentFunction","Fragment","checkEmptyElement","value","checkStyleData","dataKey","dataValue","checkSameWDomWithOriginal","c","ctor","l","t","e","tag","length","f","et","getParent","vDom","entries","Object","keys","assign","xmlnsRef","compKeyRef","needDiffRef","componentRef","WeakMap","getComponentKey","getComponentSubInfo","compKey","subKey","get","initMountHookState","set","vd","up","upR","upS","upD","upCB","mts","umts","setComponetRef","runUnmountQueueFromWDom","removeItem","recursiveRunUnmount","forEach","item","subInfo","effect","delete","mountedQueue","execMountedQueue","runMountedQueueFromWDom","component","queue","sequence","callback","effectAction","push","useUpdated","dependencies","def","checkNeedPushQueue","originalDefs","newDefs","some","index","getEventName","eventKey","replace","_match","p1","toLowerCase","DF","DocumentFragment","CE","document","createElement","wDomUpdate","newWDomTree","needRerender","A","typeAdd","D","typeDelete","R","typeReplace","U","typeUpdate","CNSU","SR","typeSortedReplace","SU","typeSortedUpdate","oldChildren","oldProps","recursiveRemoveEvent","el","removeEvent","childItem","rootDelete","deleteRealDom","wrapElement","findRealParentElement","parent","nodeType","removeChild","findChildWithRemoveElement","newElement","getElementFromFragment","wDomToDom","parentWDom","parentEl","nextEl","startFindNextBrotherElement","insertBefore","appendChild","reduce","acc","element","brothers","nextIndex","indexOf","candidiateBrothers","slice","finedNextEl","findChildFragmentNextElement","parentType","isRoot","afterElement","targetEl","bItem","isFragment","orignalElement","parentElement","replaceChild","match","removeEventListener","updateProps$1","String","runUpdatedQueueFromWDom","updateText","nodeValue","text","updateProps","originalProps","chkRemoveProp","keyName","innerHTML","updateStyle","style","checkRefData","updateEvent","checkCheckableElement","checked","tagName","checkTextareaElement","checkOptionElement","selected","makeAttrDataValue","setAttr","removeAttribute","setAttributeNS","setAttribute","allowSetAttr","isVirtualType","xmlns","createElementNS","createTextNode","wDomChildrenToDom","addMountedQueue","elementChildren","hasChildNodes","newEventHandler","oldEventHandler","eventName","addEventListener","oldStyle","originalStyle","elementStyle","styleKey","makeNewWDomTree","remakeNewWDom","result","getWDomType","isSameType","remakeWDom","generalize","param","addReRenderTypeProperty","remakeChildrenForDiff","inheritPropForRender","existOriginalWDom","isEmptyElement","originalParentWDom","origParentType","isKeyCheckedWDom","isSameText","chkDiffLoopOrder","origChildren","newChildren","filter","find","newItem","filteredChildren","isSame","every","runUpdate","infoVdom","compChild","infoProps","infoChidren","splice","childrenItem","updateChildren","reRender","resolve","remakeChildrenForUpdate","remakeChildrenForAdd","map","remakeChildrenForLoopUpdate","remakedChildren","unUsedChildren","diffLoopChildren","unusedItem","originalChildren","originalItem","findSameKeyOriginalItem","orignalChildItem","redrawQueue","redrawQueueTimeout","setRedrawAction","exec","queueMicrotask","execRedrawQueue","recursiveGetChildKeys","childComKey","childItemList","childVd","addedKey","action","shift","_props","reRenderCustomComponent","makeWDomResolver","name","componentMaker","componentUpdate","customNode","makeCustomNode","Error","addComponentProps","makeReRender","wDomMaker","initUpdateHookState","updateReqs","makeNode","componetMakeResolver","remakeChildren","nodeParentPointer","makeChildrenItem","Array","isArray","node","newProps","_children","Promise","initValue","body","Dom"],"mappings":"+OAoBA,MAAMA,EAAsBC,GACV,iBAATA,KAAuB,YAAaA,GAEvCC,EAAiB,CAACD,EAAiBE,IACvCH,EAAmBC,IAASA,EAAKG,OAASD,EA2BtCE,EAAyB,CAC7BC,EACAC,IAEAP,EAAmBM,KACL,MAAdC,OAAc,EAAAA,EAAAH,QAASE,EAAQF,OACb,SAAjBE,EAAQF,MACW,SAAjBE,EAAQF,MAC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
+ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const c of r)if(c.type==="childList")for(const s of c.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&o(s)}).observe(document,{childList:!0,subtree:!0});function n(r){const c={};return r.integrity&&(c.integrity=r.integrity),r.referrerPolicy&&(c.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?c.credentials="include":r.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function o(r){if(r.ep)return;r.ep=!0;const c=n(r);fetch(r.href,c)}})();const R=e=>typeof e=="object"&&!("resolve"in e),x=(e,t)=>R(e)&&e.type===t,xe=(e,t)=>"ctor"in e?e.ctor===(t==null?void 0:t.ctor):e===(t==null?void 0:t.ctor),me=(e,t)=>{var n,o;return R(e)&&(t==null?void 0:t.type)==="fragment"&&((n=t==null?void 0:t.children)==null?void 0:n.length)===((o=e==null?void 0:e.children)==null?void 0:o.length)},Se=(e,t)=>{var n,o;return R(e)&&(t==null?void 0:t.type)==="element"&&(t==null?void 0:t.tag)===e.tag&&((n=t==null?void 0:t.children)==null?void 0:n.length)===((o=e==null?void 0:e.children)==null?void 0:o.length)},I=(e,t)=>R(e)&&(t==null?void 0:t.type)===e.type&&(e.type!=="loop"||e.type==="loop"&&g(a((e.children||[])[0]))&&g(a((t.children||[])[0]))),a=e=>{var t,n;return((t=e==null?void 0:e.compProps)==null?void 0:t.key)??((n=e==null?void 0:e.props)==null?void 0:n.key)},y=e=>e&&["fragment","loop"].includes(e),b=e=>typeof e=="function"&&!K(e)||typeof e=="object"&&"resolve"in e,K=e=>typeof e=="function"&&e===A,w=e=>R(e)&&!e.type,g=e=>e!=null,$=(e,t)=>e==="style"&&typeof t=="object",be=(e,t)=>e==="ref"&&typeof t=="object",Ne=e=>e.nodeType===1&&e.tagName==="OPTION",Te=e=>e.nodeType===1&&e.tagName==="TEXTAREA",Ue=e=>e.nodeType===1&&["radio","checkbox"].includes(e.type),Fe=e=>{let t="et";return b(e)?t="c":x(e,"fragment")?t="f":x(e,"element")?t="e":x(e,"loop")?t="l":x(e,"text")?t="t":w(e)&&(t="et"),t},Oe={c:xe,l:I,t:I,e:Se,f:me,et:I},v=e=>e.getParent&&e.getParent(),k=Object.entries,D=Object.keys,N=Object.assign,C={value:""},E={value:{}},Q={value:!1},i=new WeakMap,_e=e=>{i.set(e,{vd:{value:null},up:()=>{},upR:[],upS:{value:0},upD:[],upCB:[],mts:[],umts:[]})},P=()=>E.value,W=(e,t)=>i.get(e)[t],Ae=e=>E.value=e,Le=e=>{E.value=e,_e(e)},Me=e=>{i.get(P()).umts.push(e)},T=e=>{const{compKey:t}=e;t&&Ie(t),ee(e)},ee=e=>{(e.children||[]).forEach(t=>{t.compKey?T(t):ee(t)})},Ie=e=>{const t=i.get(e);t&&(t.umts.forEach(n=>n()),t.umts=[],i.delete(e))};let q=[];const z=()=>{q.forEach(e=>qe(e)),q=[]},Qe=e=>{e.compKey&&q.push(e)},te=e=>i.get(P()).mts.push(e),qe=e=>{const{compKey:t}=e;if(t){const n=i.get(t),o=n==null?void 0:n.mts,r=n==null?void 0:n.upS;E.value=t,r&&(r.value=0),o&&(n.mts=[],o.forEach(c=>{const s=c();s&&Me(s)}))}},H=(e,t=()=>[])=>{const n=i.get(P()),{upD:o,upS:r}=n,c=o[r.value];if(c&&Ve(c,t())){const s=e();s&&n.upCB.push(s)}o[r.value]=t(),r.value+=1},Be=e=>{const{compKey:t}=e;if(t){const n=i.get(t),o=n==null?void 0:n.upCB,r=n==null?void 0:n.upS;E.value=t,r&&(r.value=0),e.ctor&&o&&(n.upCB=[],o.forEach(c=>c()))}},Ve=(e,t)=>e.length?e.some((n,o)=>n!==t[o]):!0,je=e=>e==="className"?"class":e,ne=e=>e.replace(/^on(.*)/,(t,n)=>n.toLowerCase()),G=()=>new DocumentFragment,Z=e=>document.createElement(e),Ye=(e,t,n)=>{t??(t=document.body),e.isRoot=!0,e.wrapElement=t;const o=F(e);return n?(e.afterElement=n,t.insertBefore(o,n)):t.appendChild(o),z(),()=>{var r;const c=(r=i.get(e.compProps||{}))==null?void 0:r.vd.value;c&&(T(c),U(c),ze(c))}},oe=e=>{const{needRerender:t}=e;t&&t!=="N"&&({A:X,D:J,R:Je,U:V,CNSU:V,SR:se,SU:Ge}[t](e),delete e.needRerender,delete e.oldChildren,delete e.oldProps)},U=e=>{e.props&&e.el&&ie(e.props,e.el),(e.children||[]).forEach(t=>{U(t)})},ze=e=>{re(e,e.wrapElement)},J=e=>{e.oldProps&&e.el&&ie(e.oldProps,e.el),re(e,O(v(e)))},re=(e,t)=>{var n,o;t&&e.el&&(((n=e.el)==null?void 0:n.nodeType)===1?t.removeChild(e.el):((o=e.el)==null?void 0:o.nodeType)===11&&ce(e,t),delete e.el)},ce=(e,t)=>{((e==null?void 0:e.oldChildren)||(e==null?void 0:e.children)||[]).forEach(n=>{var o,r;((o=n.el)==null?void 0:o.nodeType)===1?t.removeChild(n==null?void 0:n.el):((r=n.el)==null?void 0:r.nodeType)===11&&ce(n,t)})},se=e=>{J(e),X(e)},Ge=e=>{if(V(e),v(e).needRerender!=="CNSU"){const n=le(e);X(e,n)}},X=(e,t)=>{t||(t=F(e));const n=v(e);if(n.type){const o=O(n),c=n.type==="loop"&&n.needRerender&&n.needRerender!=="CNSU"?B(n,v(n)):B(e,n);t&&o&&(c?o.insertBefore(t,c):o.appendChild(t),z())}},le=e=>y(e.type)?((e==null?void 0:e.children)||[]).reduce((t,n)=>{const o=le(n);return o&&t.appendChild(o),t},G()):e.el,B=(e,t)=>{const n=t.children||[],r=n.indexOf(e)+1,c=n.slice(r),s=ue(c),u=t.type||"";if(s)return s;if(!t.isRoot&&y(u))return B(t,v(t));if(t.isRoot&&y(u)&&t.afterElement)return t.afterElement},ue=e=>e.reduce((t,n)=>{const o=n.type,r=n.el,c=o&&y(o);return t||(c?ue(n.children||[]):r&&r.nodeType!==11?r:t)},void 0),Je=e=>{const t=v(e),n=e.el;if(t.type&&n)if(n.nodeType===11)se(e);else{const o=O(t),r=F(e);o&&o.replaceChild(r,n),z()}},ie=(e,t)=>{k(e||{}).forEach(([n,o])=>{n.match(/^on/)&&t.removeEventListener(ne(n),o)})},V=e=>{var t;const n=e.el;if(e.type==="text"){Xe(e);return}if(n){const{oldProps:o,props:r}=e;de(r,n,o),delete e.oldProps,e.tag==="input"&&(n.value=String(((t=e==null?void 0:e.props)==null?void 0:t.value)||""))}(e.children||[]).forEach(o=>oe(o)),Be(e)},Xe=e=>{const t=e.el;t&&(t.nodeValue=String(e.text))},de=(e,t,n)=>{const o={...n};k(e||{}).forEach(([r,c])=>{let s=!0;r==="key"||c===o[r]||(r==="innerHTML"&&typeof c=="string"?t.innerHTML=c:$(r,c)?we(c,$(r,o.style)?o.style:{},t):be(r,c)?c.value=t:r.match(/^on/)?Ke(t,r,c,o[r]):Ue(t)&&r==="checked"?t.checked=!!c:Te(t)&&r==="value"?t.value=c:Ne(t)&&r==="selected"?t.selected=!!c:r&&([s,c]=He(c),s&&$e(je(r),t,c))),s&&delete o[r]}),D(o).forEach(r=>t.removeAttribute(r))},$e=(e,t,n)=>{C.value&&e!=="xmlns"?t.setAttributeNS(null,e,n):t.setAttribute(e,n)},He=e=>{let t=!0;return typeof e=="boolean"&&(e||(t=!1),e=""),[t,String(e)]},F=e=>{let t;const{type:n,tag:o,text:r,props:c,children:s=[]}=e,u=y(n);return o==="svg"&&(C.value=String(c==null?void 0:c.xmlns)),u?t=G():n==="element"&&o?t=C.value?document.createElementNS(C.value,o):Z(o):n==="text"&&g(r)?t=document.createTextNode(String(r)):t=Z("e"),Ze(s,t),de(c,t),e.el=t,Qe(e),o==="svg"&&(C.value=""),t},Ze=(e,t)=>{const n=e.reduce((o,r)=>(r.type&&o.appendChild(F(r)),o),G());t&&n.hasChildNodes()&&t.appendChild(n)},Ke=(e,t,n,o)=>{const r=ne(t);o!==n&&(o&&e.removeEventListener(r,o),n&&e.addEventListener(r,n))},we=(e,t,n)=>{const o={...t},r=n==null?void 0:n.style;r&&(k(e).forEach(([c,s])=>{r[c]=s,delete o[c]}),k(o).forEach(([c])=>r[c]=""))},O=e=>{const t=y(e.type);return e.isRoot&&t?e.wrapElement:t?O(v(e)):e.el},_=(e,t)=>De(e,Oe[Fe(e)](e,t),t),De=(e,t,n)=>{const o=ct(e,t,n),r=[o,t,n],c=et(...r);return o.children=st(...r),o.needRerender=c,We(o,n,c),n&&delete n.children,o},We=(e,t,n)=>{n!=="A"&&t&&(e.el=t.el),n&&["D","R","SR"].includes(n)&&(t!=null&&t.compKey&&(T(t),U(t)),e.oldChildren=t==null?void 0:t.children),e.oldProps=t==null?void 0:t.props},et=(e,t,n)=>{const o=n&&n.type,r=w(e),c=e.isRoot,s=n&&v(n),u=!c&&(s==null?void 0:s.type),p=a(e),d=u==="loop"&&g(p),h=e.type==="text"&&t&&e.text===(n==null?void 0:n.text);let f;return r?f="D":h?f="N":o?t?f=d?"SU":"U":f=d?"SR":"R":f="A",e.type==="loop"&&f==="U"&&n&&tt(e,n)&&(f="CNSU"),f},tt=(e,t)=>{const n=[...(t==null?void 0:t.children)||[]],o=[...(e==null?void 0:e.children)||[]].filter(s=>n.find(u=>a(s)===a(u))),r=n.filter(s=>o.find(u=>a(s)===a(u)));let c=r.length===o.length;return c&&(c=r.every((s,u)=>a(s)===a(o[u]))),c},nt=(e,t)=>{e&&t!==e&&(D(e).forEach(n=>delete e[n]),k(t||{}).forEach(([n,o])=>e[n]=o))},ot=(e,t)=>{e&&t!==e&&(e.splice(0,e.length),t&&t.forEach(n=>e.push(n)))},rt=(e,t)=>{const{compProps:n,compChild:o}=e,{props:r,children:c}=t;return n&&nt(n,r),o&&ot(o,c),e.reRender&&e.reRender()},ct=(e,t,n)=>b(e)?t&&n?rt(n,e):e.resolve():e,st=(e,t,n)=>t&&n?ut(e,n):lt(e),lt=e=>(e.children||[]).map(t=>N(_(t),{getParent:()=>e})),ut=(e,t)=>e.type==="loop"&&g(a((e.children||[])[0]))?it(e,t):(e.children||[]).map((n,o)=>N(_(n,(t.children||[])[o]),{getParent:()=>e})),it=(e,t)=>{const[n,o]=dt(e,t);return o.map(r=>{T(r),U(r),J(r)}),n},dt=(e,t)=>{const n=[...e.children||[]],o=[...t.children||[]];return[n.map(c=>{const s=ft(c,o),u=_(c,s);return s&&o.splice(o.indexOf(s),1),u.getParent=()=>e,u}),o]},ft=(e,t)=>t.find(n=>a(n)===a(e));let m=[],j=!1;const fe=(e,t)=>{i.get(e).up=()=>{m.push({compKey:e,exec:t}),j||(j=!0,queueMicrotask(at))}},pt=e=>()=>{var t;const n=(t=i.get(e))==null?void 0:t.up;let o=!1;return n&&(n(),o=!0),o},pe=(e,t)=>{(e.children||[]).forEach(n=>{const o=n.compKey;o&&t.push(o),pe(n,t)})},at=()=>{let e=[];m.forEach(o=>{var r,c;const s=(c=(r=i.get(o.compKey))==null?void 0:r.vd)==null?void 0:c.value;s&&pe(s,e)});const t=[],n=m.reduce((o,r)=>{const{compKey:c}=r;return e.includes(c)||t.includes(c)||(t.push(c),o.push(r)),o},[]);for(;n.length;){const o=n.shift();o&&o.exec()}m=[],j=!1},ae=(e,t=()=>[])=>{i.get(P()).upR.push(()=>H(e,t)),H(e,t)},ht=()=>{var e;const t=(e=i.get(P()))==null?void 0:e.upR;t!=null&&t.length&&t.forEach(n=>n())},A=(e,...t)=>({type:"fragment",children:t}),l=(e,t,...n)=>{const o={value:void 0},r=t||{},c=ge(o,n),s=gt(e,r,c);return b(s)||(o.value=s),s},he=e=>(t,n)=>e,ve=(e,t,n,o)=>{var r;Q.value=!0;const c=ye(e,t,n),s=_(c,o),{isRoot:u,getParent:p,wrapElement:d,afterElement:h}=o;if(s.getParent=p,!u&&p){const f=((r=p())==null?void 0:r.children)||[],L=f.indexOf(o);f.splice(L,1,s)}else s.isRoot=!0,s.wrapElement=d,s.afterElement=h;Q.value=!1,oe(s)},ye=(e,t,n)=>({tagName:e.name,ctor:e,props:t,children:n,resolve:(s=t)=>{Le(s);const p=e(t,n)(pt(s),t,n),d=vt(p,s,e,t,n),h=d;return fe(s,()=>ve(e,t,n,h)),W(s,"vd").value=d,d}}),vt=(e,t,n,o,r)=>{const c=e(o);if(c.reRender)throw new Error('Avoid the case where the first element of a component is a component. Instead of "mount(()=>()=><Component />)" replace it with something like "mount(()=>()=><Fragment><Component /></Fragment>)".');return Ce(c,t,n,o,r,yt(e,t,n,o,r)),c},yt=(e,t,n,o,r)=>{const c=()=>Ct(e,t,n,o,r,c);return c},Ct=(e,t,n,o,r,c)=>{Ae(t),ht();const s=e(o);return fe(t,()=>ve(n,o,r,s)),Ce(s,t,n,o,r,c),W(t,"vd").value=s,s},Ce=(e,t,n,o,r,c)=>{N(e,{compProps:o,compChild:r,ctor:n,tagName:n.name,compKey:t,reRender:c})},gt=(e,t,n)=>{if(K(e))return A(t,...n);if(b(e)){const o=ye(e,t,n);return Q.value?o:o.resolve()}return{type:"element",tag:e,props:t,children:n}},ge=(e,t)=>t.map(n=>N(kt(n),{getParent:()=>e.value})),kt=e=>{if(e==null||e===!1)return{type:null};if(Array.isArray(e)){const t={value:void 0},o={type:"loop",children:ge(t,e)};return t.value=o,o}else if(typeof e=="string"||typeof e=="number")return{type:"text",text:e};return e},Rt=e=>({value:e}),Y=(e,t)=>{let n=e;return{get value(){return n},get v(){return n},set value(o){n=o,t()},set v(o){n=o,t()}}},Et=e=>{let t=e;return{get value(){return t()},get v(){return t()},set value(n){throw new Error("You can't change 'computed'")},set v(n){throw new Error("You can't change 'computed'")}}},Pt=(e,t=()=>{},n=()=>[])=>{te(()=>(e(),t)),ae(()=>(t&&t(),e),n)},ke=new Map,S={},xt=e=>{const t=Symbol();return ke.set(t,e),n=>(n&&(S[t]??(S[t]=[]),S[t].push(n)),mt(t))},mt=e=>new Proxy(ke.get(e),{get(t,n){return t[n]},set(t,n,o){t[n]=o;const r=S[e],c=[];return r.forEach(s=>{s()||c.push(s)}),c.forEach(s=>r.splice(r.indexOf(s),1)),!0}}),St=he((e,t,n)=>{const o=Y(1,e),r=Y('"destructuring" the "props" value directly from the mount function will cause referencing issues, so if you want to use it, you need to "destructuring" it from the internal function (updater).',e),c=()=>t.parentValue,s=t.parentValue,u=Et(()=>o.v+d+t.parentValue),p=xt({text:"s",count:0})(e);let d=t.parentValue;const h=Rt(null),f=()=>{o.v=o.v+1,d+=1},L=M=>{r.v=M.target.value},Re=()=>{p.count+=1,p.text+="1"},Ee=()=>(console.log("MOUNTED",h),()=>console.log("UNMOUNT")),Pe=()=>(console.log("UPDATE - parentValue"),()=>console.log("UPDATED"));return te(Ee),ae(Pe,()=>[t.parentValue]),Pt(()=>console.log("INJECT"),()=>console.log("CLEAN_UP"),()=>[o.v]),({parentValue:M})=>l(A,null,l("div",null,l("textarea",{value:r.v,onInput:L,style:{width:"300px",height:"100px"}})),l("div",null,r.v),l("div",null,l("div",{style:{color:"blue"}},"parentValueFromRef: ",t.parentValue," (working)"),l("div",{style:{color:"blue"}},"parentValueFromFunction: ",c()," (working)"),l("div",{style:{color:"blue"}},"parentValueFromUpdaterDestructuring: ",M," (working)"),l("div",{style:{color:"red"}},"parentValueFromMounterDestructuring: ",s," (not working)")),l("div",null,l("div",{ref:h},"count: ",o.v),l("div",null,"sum: ",o.v+d+t.parentValue),l("div",null,"sum(computed): ",u.v),l("div",null,"notRefValue: ",d),l("div",null,"localStore(text): ",p.text),l("div",null,"localStore(count): ",p.count)),l("button",{onClick:f},"Increase"),l("button",{onClick:Re},"localStoreUpdate"),n)}),bt=he(e=>{const t=Y(7,e),n=()=>{t.v=t.v+1},o=()=>{t.v=t.v-1};return()=>l(A,null,l(St,{parentValue:t.v},l("button",{onClick:n},"Increase - Parent")),l("button",{onClick:o},"Decrease - Parent"))}),Nt=l(bt,null);Ye(Nt,document.getElementById("root"));
2
+ //# sourceMappingURL=index-290c744c.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-290c744c.js","sources":["../../../dist/lithent.mjs","../../../helper/dist/lithentHelper.mjs","../../src/index.tsx"],"sourcesContent":["const checkPlainWDomType = (wDom) => typeof wDom === \"object\" && !(\"resolve\" in wDom);\nconst checkPlainType = (wDom, typeName) => checkPlainWDomType(wDom) && wDom.type === typeName;\nconst checkSameCustomComponent = (newWDom, originalWDom) => \"ctor\" in newWDom ? newWDom.ctor === (originalWDom == null ? void 0 : originalWDom.ctor) : newWDom === (originalWDom == null ? void 0 : originalWDom.ctor);\nconst checkSameFragment = (newWDom, originalWDom) => {\n var _a, _b;\n return checkPlainWDomType(newWDom) && (originalWDom == null ? void 0 : originalWDom.type) === \"fragment\" && ((_a = originalWDom == null ? void 0 : originalWDom.children) == null ? void 0 : _a.length) === ((_b = newWDom == null ? void 0 : newWDom.children) == null ? void 0 : _b.length);\n};\nconst checkSameTagElement = (newWDom, originalWDom) => {\n var _a, _b;\n return checkPlainWDomType(newWDom) && (originalWDom == null ? void 0 : originalWDom.type) === \"element\" && (originalWDom == null ? void 0 : originalWDom.tag) === newWDom.tag && ((_a = originalWDom == null ? void 0 : originalWDom.children) == null ? void 0 : _a.length) === ((_b = newWDom == null ? void 0 : newWDom.children) == null ? void 0 : _b.length);\n};\nconst checkNormalTypeElement = (newWDom, originalWDom) => checkPlainWDomType(newWDom) && (originalWDom == null ? void 0 : originalWDom.type) === newWDom.type && (newWDom.type !== \"loop\" || newWDom.type === \"loop\" && checkExisty(getKey((newWDom.children || [])[0])) && checkExisty(getKey((originalWDom.children || [])[0])));\nconst getKey = (target) => {\n var _a, _b;\n return ((_a = target == null ? void 0 : target.compProps) == null ? void 0 : _a.key) ?? ((_b = target == null ? void 0 : target.props) == null ? void 0 : _b.key);\n};\nconst checkVirtualType = (type) => type && [\"fragment\", \"loop\"].includes(type);\nconst checkCustemComponentFunction = (target) => typeof target === \"function\" && !checkFragmentFunction(target) || typeof target === \"object\" && \"resolve\" in target;\nconst checkFragmentFunction = (target) => typeof target === \"function\" && target === Fragment;\nconst checkEmptyElement = (wDom) => checkPlainWDomType(wDom) && !wDom.type;\nconst checkExisty = (value) => value !== null && value !== void 0;\nconst checkStyleData = (dataKey, dataValue) => dataKey === \"style\" && typeof dataValue === \"object\";\nconst checkRefData = (dataKey, dataValue) => dataKey === \"ref\" && typeof dataValue === \"object\";\nconst checkOptionElement = (element) => element.nodeType === 1 && element.tagName === \"OPTION\";\nconst checkTextareaElement = (element) => element.nodeType === 1 && element.tagName === \"TEXTAREA\";\nconst checkCheckableElement = (element) => element.nodeType === 1 && [\"radio\", \"checkbox\"].includes(element.type);\nconst getWDomType = (wDom) => {\n let result = \"et\";\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 return result;\n};\nconst checkSameWDomWithOriginal = {\n c: checkSameCustomComponent,\n l: checkNormalTypeElement,\n t: checkNormalTypeElement,\n e: checkSameTagElement,\n f: checkSameFragment,\n et: checkNormalTypeElement\n};\nconst getParent = (vDom) => vDom.getParent && vDom.getParent();\nconst entries = Object.entries;\nconst keys = Object.keys;\nconst assign = Object.assign;\nconst xmlnsRef = { value: \"\" };\nconst compKeyRef = { value: {} };\nconst needDiffRef = { value: false };\nconst componentRef = /* @__PURE__ */ new WeakMap();\nconst setComponetRef = (compKey) => {\n componentRef.set(compKey, {\n vd: { value: null },\n up: () => {\n },\n upR: [],\n upS: { value: 0 },\n upD: [],\n upCB: [],\n mts: [],\n umts: []\n });\n};\nconst getComponentKey = () => compKeyRef.value;\nconst getComponentSubInfo = (compKey, subKey) => componentRef.get(compKey)[subKey];\nconst initUpdateHookState = (compKey) => compKeyRef.value = compKey;\nconst initMountHookState = (compKey) => {\n compKeyRef.value = compKey;\n setComponetRef(compKey);\n};\nconst unmount = (effectAction) => {\n componentRef.get(getComponentKey()).umts.push(effectAction);\n};\nconst runUnmountQueueFromWDom = (newWDom) => {\n const { compKey } = newWDom;\n if (compKey) {\n removeItem(compKey);\n }\n recursiveRunUnmount(newWDom);\n};\nconst recursiveRunUnmount = (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};\nconst removeItem = (compKey) => {\n const subInfo = componentRef.get(compKey);\n if (subInfo) {\n subInfo.umts.forEach((effect) => effect());\n subInfo.umts = [];\n componentRef.delete(compKey);\n }\n};\nlet mountedQueue = [];\nconst execMountedQueue = () => {\n mountedQueue.forEach((item) => runMountedQueueFromWDom(item));\n mountedQueue = [];\n};\nconst addMountedQueue = (wDom) => {\n if (wDom.compKey) {\n mountedQueue.push(wDom);\n }\n};\nconst mountCallback = (effectAction) => componentRef.get(getComponentKey()).mts.push(effectAction);\nconst runMountedQueueFromWDom = (newWDom) => {\n const { compKey } = newWDom;\n if (compKey) {\n const component = componentRef.get(compKey);\n const queue = component == null ? void 0 : component.mts;\n const sequence = component == null ? void 0 : component.upS;\n compKeyRef.value = compKey;\n if (sequence) {\n sequence.value = 0;\n }\n if (queue) {\n component.mts = [];\n queue.forEach((effect) => {\n const callback = effect();\n if (callback) {\n unmount(callback);\n }\n });\n }\n }\n};\nconst useUpdated = (effectAction, dependencies = () => []) => {\n const component = componentRef.get(getComponentKey());\n const { upD, upS } = component;\n const def = upD[upS.value];\n if (def && checkNeedPushQueue(def, dependencies())) {\n const callback = effectAction();\n if (callback) {\n component.upCB.push(callback);\n }\n }\n upD[upS.value] = dependencies();\n upS.value += 1;\n};\nconst runUpdatedQueueFromWDom = (newWDom) => {\n const { compKey } = newWDom;\n if (compKey) {\n const component = componentRef.get(compKey);\n const queue = component == null ? void 0 : component.upCB;\n const sequence = component == null ? void 0 : component.upS;\n compKeyRef.value = compKey;\n if (sequence) {\n sequence.value = 0;\n }\n if (newWDom.ctor && queue) {\n component.upCB = [];\n queue.forEach((effect) => effect());\n }\n }\n};\nconst checkNeedPushQueue = (originalDefs, newDefs) => !originalDefs.length ? true : originalDefs.some((def, index) => def !== newDefs[index]);\nconst getAttrKey = (keyName) => keyName === \"className\" ? \"class\" : keyName;\nconst getEventName = (eventKey) => eventKey.replace(/^on(.*)/, (_match, p1) => p1.toLowerCase());\nconst DF = () => new DocumentFragment();\nconst CE = (t) => document.createElement(t);\nconst render = (wDom, wrapElement, afterElement) => {\n wrapElement ?? (wrapElement = document.body);\n wDom.isRoot = true;\n wDom.wrapElement = wrapElement;\n const Dom = wDomToDom(wDom);\n if (afterElement) {\n wDom.afterElement = afterElement;\n wrapElement.insertBefore(Dom, afterElement);\n } else {\n wrapElement.appendChild(Dom);\n }\n execMountedQueue();\n return () => {\n var _a;\n const component = (_a = componentRef.get(wDom.compProps || {})) == null ? void 0 : _a.vd.value;\n if (component) {\n runUnmountQueueFromWDom(component);\n recursiveRemoveEvent(component);\n rootDelete(component);\n }\n };\n};\nconst wDomUpdate = (newWDomTree) => {\n const { needRerender } = newWDomTree;\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 delete newWDomTree.needRerender;\n delete newWDomTree.oldChildren;\n delete newWDomTree.oldProps;\n }\n};\nconst recursiveRemoveEvent = (originalWDom) => {\n if (originalWDom.props && originalWDom.el) {\n removeEvent(originalWDom.props, originalWDom.el);\n }\n (originalWDom.children || []).forEach((childItem) => {\n recursiveRemoveEvent(childItem);\n });\n};\nconst rootDelete = (newWDom) => {\n deleteRealDom(newWDom, newWDom.wrapElement);\n};\nconst typeDelete = (newWDom) => {\n if (newWDom.oldProps && newWDom.el) {\n removeEvent(newWDom.oldProps, newWDom.el);\n }\n deleteRealDom(\n newWDom,\n findRealParentElement(getParent(newWDom))\n );\n};\nconst deleteRealDom = (newWDom, parent) => {\n var _a, _b;\n if (parent && newWDom.el) {\n if (((_a = newWDom.el) == null ? void 0 : _a.nodeType) === 1) {\n parent.removeChild(newWDom.el);\n } else if (((_b = newWDom.el) == null ? void 0 : _b.nodeType) === 11) {\n findChildWithRemoveElement(newWDom, parent);\n }\n delete newWDom.el;\n }\n};\nconst findChildWithRemoveElement = (newWDom, parent) => {\n ((newWDom == null ? void 0 : newWDom.oldChildren) || (newWDom == null ? void 0 : newWDom.children) || []).forEach((item) => {\n var _a, _b;\n if (((_a = item.el) == null ? void 0 : _a.nodeType) === 1) {\n parent.removeChild(item == null ? void 0 : item.el);\n } else if (((_b = item.el) == null ? void 0 : _b.nodeType) === 11) {\n findChildWithRemoveElement(item, parent);\n }\n });\n};\nconst typeSortedReplace = (newWDom) => {\n typeDelete(newWDom);\n typeAdd(newWDom);\n};\nconst typeSortedUpdate = (newWDom) => {\n typeUpdate(newWDom);\n const parentWDom = getParent(newWDom);\n if (parentWDom.needRerender !== \"CNSU\") {\n const newElement = getElementFromFragment(newWDom);\n typeAdd(newWDom, newElement);\n }\n};\nconst typeAdd = (newWDom, newElement) => {\n if (!newElement) {\n newElement = wDomToDom(newWDom);\n }\n const parentWDom = getParent(newWDom);\n if (parentWDom.type) {\n const parentEl = findRealParentElement(parentWDom);\n const isLoop = parentWDom.type === \"loop\";\n const nextEl = isLoop && parentWDom.needRerender && parentWDom.needRerender !== \"CNSU\" ? startFindNextBrotherElement(parentWDom, getParent(parentWDom)) : startFindNextBrotherElement(newWDom, parentWDom);\n if (newElement && parentEl) {\n if (nextEl) {\n parentEl.insertBefore(newElement, nextEl);\n } else {\n parentEl.appendChild(newElement);\n }\n execMountedQueue();\n }\n }\n};\nconst getElementFromFragment = (newWDom) => {\n if (checkVirtualType(newWDom.type)) {\n return ((newWDom == null ? void 0 : newWDom.children) || []).reduce((acc, item) => {\n const element = getElementFromFragment(item);\n if (element) {\n acc.appendChild(element);\n }\n return acc;\n }, DF());\n }\n return newWDom.el;\n};\nconst startFindNextBrotherElement = (wDom, parentWDom) => {\n const brothers = parentWDom.children || [];\n const index = brothers.indexOf(wDom);\n const nextIndex = index + 1;\n const candidiateBrothers = brothers.slice(nextIndex);\n const finedNextEl = findChildFragmentNextElement(candidiateBrothers);\n const parentType = parentWDom.type || \"\";\n if (finedNextEl) {\n return finedNextEl;\n }\n if (!parentWDom.isRoot && checkVirtualType(parentType)) {\n return startFindNextBrotherElement(parentWDom, getParent(parentWDom));\n } else if (parentWDom.isRoot && checkVirtualType(parentType) && parentWDom.afterElement) {\n return parentWDom.afterElement;\n }\n return void 0;\n};\nconst findChildFragmentNextElement = (candidiateBrothers) => candidiateBrothers.reduce(\n (targetEl, bItem) => {\n const type = bItem.type;\n const el = bItem.el;\n const isFragment = type && checkVirtualType(type);\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 return targetEl;\n },\n void 0\n);\nconst typeReplace = (newWDom) => {\n const parentWDom = getParent(newWDom);\n const orignalElement = newWDom.el;\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 if (parentElement) {\n parentElement.replaceChild(newElement, orignalElement);\n }\n execMountedQueue();\n }\n }\n};\nconst removeEvent = (oldProps, element) => {\n entries(oldProps || {}).forEach(([dataKey, dataValue]) => {\n if (dataKey.match(/^on/)) {\n element.removeEventListener(\n getEventName(dataKey),\n dataValue\n );\n }\n });\n};\nconst typeUpdate = (newWDom) => {\n var _a;\n const element = newWDom.el;\n if (newWDom.type === \"text\") {\n updateText(newWDom);\n return;\n }\n if (element) {\n const { oldProps, props } = newWDom;\n updateProps$1(props, element, oldProps);\n delete newWDom.oldProps;\n if (newWDom.tag === \"input\") {\n element.value = String(((_a = newWDom == null ? void 0 : newWDom.props) == null ? void 0 : _a.value) || \"\");\n }\n }\n (newWDom.children || []).forEach((childItem) => wDomUpdate(childItem));\n runUpdatedQueueFromWDom(newWDom);\n};\nconst updateText = (newWDom) => {\n const element = newWDom.el;\n if (element) {\n element.nodeValue = String(newWDom.text);\n }\n};\nconst updateProps$1 = (props, element, oldProps) => {\n const originalProps = { ...oldProps };\n entries(props || {}).forEach(([dataKey, dataValue]) => {\n let chkRemoveProp = true;\n if (dataKey === \"key\" || dataValue === originalProps[dataKey])\n ;\n else if (dataKey === \"innerHTML\" && typeof dataValue === \"string\") {\n element.innerHTML = dataValue;\n } else if (checkStyleData(dataKey, dataValue)) {\n updateStyle(\n dataValue,\n checkStyleData(dataKey, originalProps.style) ? originalProps.style : {},\n element\n );\n } else if (checkRefData(dataKey, dataValue)) {\n dataValue.value = element;\n } else if (dataKey.match(/^on/)) {\n updateEvent(\n element,\n dataKey,\n dataValue,\n originalProps[dataKey]\n );\n } else if (checkCheckableElement(element) && dataKey === \"checked\") {\n element.checked = !!dataValue;\n } else if (checkTextareaElement(element) && dataKey === \"value\") {\n element.value = dataValue;\n } else if (checkOptionElement(element) && dataKey === \"selected\") {\n element.selected = !!dataValue;\n } else if (dataKey) {\n [chkRemoveProp, dataValue] = makeAttrDataValue(dataValue);\n if (chkRemoveProp) {\n setAttr(\n getAttrKey(dataKey),\n element,\n dataValue\n );\n }\n }\n if (chkRemoveProp) {\n delete originalProps[dataKey];\n }\n });\n keys(originalProps).forEach(\n (dataKey) => element.removeAttribute(dataKey)\n );\n};\nconst setAttr = (dataKey, element, dataValue) => {\n if (xmlnsRef.value && dataKey !== \"xmlns\") {\n element.setAttributeNS(null, dataKey, dataValue);\n } else {\n element.setAttribute(dataKey, dataValue);\n }\n};\nconst makeAttrDataValue = (dataValue) => {\n let allowSetAttr = true;\n if (typeof dataValue === \"boolean\") {\n if (!dataValue) {\n allowSetAttr = false;\n }\n dataValue = \"\";\n }\n return [allowSetAttr, String(dataValue)];\n};\nconst wDomToDom = (wDom) => {\n let element;\n const { type, tag, text, props, children = [] } = wDom;\n const isVirtualType = checkVirtualType(type);\n if (tag === \"svg\") {\n xmlnsRef.value = String(props == null ? void 0 : props.xmlns);\n }\n if (isVirtualType) {\n element = DF();\n } else if (type === \"element\" && tag) {\n element = xmlnsRef.value ? document.createElementNS(xmlnsRef.value, tag) : CE(tag);\n } else if (type === \"text\" && checkExisty(text)) {\n element = document.createTextNode(String(text));\n } else {\n element = CE(\"e\");\n }\n wDomChildrenToDom(children, element);\n updateProps$1(props, element);\n wDom.el = element;\n addMountedQueue(wDom);\n if (tag === \"svg\") {\n xmlnsRef.value = \"\";\n }\n return element;\n};\nconst wDomChildrenToDom = (children, parentElement) => {\n const elementChildren = children.reduce(\n (acc, childItem) => {\n if (childItem.type) {\n acc.appendChild(wDomToDom(childItem));\n }\n return acc;\n },\n DF()\n );\n if (parentElement && elementChildren.hasChildNodes()) {\n parentElement.appendChild(elementChildren);\n }\n};\nconst updateEvent = (element, eventKey, newEventHandler, oldEventHandler) => {\n const eventName = getEventName(eventKey);\n if (oldEventHandler !== newEventHandler) {\n if (oldEventHandler) {\n element.removeEventListener(eventName, oldEventHandler);\n }\n if (newEventHandler) {\n element.addEventListener(eventName, newEventHandler);\n }\n }\n};\nconst updateStyle = (style, oldStyle, element) => {\n const originalStyle = { ...oldStyle };\n const elementStyle = element == null ? void 0 : element.style;\n if (elementStyle) {\n entries(style).forEach(([styleKey, dataValue]) => {\n elementStyle[styleKey] = dataValue;\n delete originalStyle[styleKey];\n });\n entries(originalStyle).forEach(\n ([styleKey]) => elementStyle[styleKey] = \"\"\n );\n }\n};\nconst findRealParentElement = (vDom) => {\n const isVirtualType = checkVirtualType(vDom.type);\n if (vDom.isRoot && isVirtualType) {\n return vDom.wrapElement;\n }\n if (!isVirtualType) {\n return vDom.el;\n }\n return findRealParentElement(getParent(vDom));\n};\nconst makeNewWDomTree = (newWDom, originalWDom) => remakeNewWDom(\n newWDom,\n checkSameWDomWithOriginal[getWDomType(newWDom)](newWDom, originalWDom),\n originalWDom\n);\nconst remakeNewWDom = (newWDom, isSameType, originalWDom) => {\n const remakeWDom = generalize(newWDom, isSameType, originalWDom);\n const param = [\n remakeWDom,\n isSameType,\n originalWDom\n ];\n const needRerender = addReRenderTypeProperty(...param);\n remakeWDom.children = remakeChildrenForDiff(...param);\n remakeWDom.needRerender = needRerender;\n inheritPropForRender(remakeWDom, originalWDom, needRerender);\n if (originalWDom) {\n delete originalWDom.children;\n }\n return remakeWDom;\n};\nconst inheritPropForRender = (remakeWDom, originalWDom, needRerender) => {\n if (needRerender !== \"A\" && originalWDom) {\n remakeWDom.el = originalWDom.el;\n }\n if (needRerender && [\"D\", \"R\", \"SR\"].includes(needRerender)) {\n if (originalWDom == null ? void 0 : originalWDom.compKey) {\n runUnmountQueueFromWDom(originalWDom);\n recursiveRemoveEvent(originalWDom);\n }\n remakeWDom.oldChildren = originalWDom == null ? void 0 : originalWDom.children;\n }\n remakeWDom.oldProps = originalWDom == null ? void 0 : originalWDom.props;\n};\nconst addReRenderTypeProperty = (newWDom, isSameType, originalWDom) => {\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 == null ? void 0 : originalParentWDom.type);\n const key = getKey(newWDom);\n const isKeyCheckedWDom = origParentType === \"loop\" && checkExisty(key);\n const isSameText = newWDom.type === \"text\" && isSameType && newWDom.text === (originalWDom == null ? void 0 : originalWDom.text);\n let result;\n if (isEmptyElement) {\n result = \"D\";\n } else if (isSameText) {\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 if (newWDom.type === \"loop\" && result === \"U\" && originalWDom && chkDiffLoopOrder(newWDom, originalWDom)) {\n result = \"CNSU\";\n }\n return result;\n};\nconst chkDiffLoopOrder = (newWDom, originalWDom) => {\n const origChildren = [...(originalWDom == null ? void 0 : originalWDom.children) || []];\n const newChildren = [...(newWDom == null ? void 0 : newWDom.children) || []].filter(\n (item) => origChildren.find((newItem) => getKey(item) === getKey(newItem))\n );\n const filteredChildren = origChildren.filter(\n (item) => newChildren.find((newItem) => getKey(item) === getKey(newItem))\n );\n let isSame = filteredChildren.length === newChildren.length;\n if (isSame) {\n isSame = filteredChildren.every(\n (item, index) => getKey(item) === getKey(newChildren[index])\n );\n }\n return isSame;\n};\nconst updateProps = (props, infoProps) => {\n if (props && infoProps !== props) {\n keys(props).forEach((key) => delete props[key]);\n entries(infoProps || {}).forEach(([key, value]) => props[key] = value);\n }\n};\nconst updateChildren = (children, infoChidren) => {\n if (children && infoChidren !== children) {\n children.splice(0, children.length);\n if (infoChidren) {\n infoChidren.forEach((childrenItem) => children.push(childrenItem));\n }\n }\n};\nconst runUpdate = (vDom, infoVdom) => {\n const { compProps: props, compChild: children } = vDom;\n const { props: infoProps, children: infoChidren } = infoVdom;\n if (props) {\n updateProps(props, infoProps);\n }\n if (children) {\n updateChildren(children, infoChidren);\n }\n const newVDom = vDom.reRender && vDom.reRender();\n return newVDom;\n};\nconst generalize = (newWDom, isSameType, originalWDom) => {\n if (checkCustemComponentFunction(newWDom)) {\n return isSameType && originalWDom ? runUpdate(originalWDom, newWDom) : newWDom.resolve();\n }\n return newWDom;\n};\nconst remakeChildrenForDiff = (newWDom, isSameType, originalWDom) => isSameType && originalWDom ? remakeChildrenForUpdate(newWDom, originalWDom) : remakeChildrenForAdd(newWDom);\nconst remakeChildrenForAdd = (newWDom) => (newWDom.children || []).map(\n (item) => assign(makeNewWDomTree(item), { getParent: () => newWDom })\n);\nconst remakeChildrenForUpdate = (newWDom, originalWDom) => newWDom.type === \"loop\" && checkExisty(getKey((newWDom.children || [])[0])) ? remakeChildrenForLoopUpdate(newWDom, originalWDom) : (newWDom.children || []).map(\n (item, index) => assign(makeNewWDomTree(item, (originalWDom.children || [])[index]), {\n getParent: () => newWDom\n })\n);\nconst remakeChildrenForLoopUpdate = (newWDom, originalWDom) => {\n const [remakedChildren, unUsedChildren] = diffLoopChildren(\n newWDom,\n originalWDom\n );\n unUsedChildren.map((unusedItem) => {\n runUnmountQueueFromWDom(unusedItem);\n recursiveRemoveEvent(unusedItem);\n typeDelete(unusedItem);\n });\n return remakedChildren;\n};\nconst diffLoopChildren = (newWDom, originalWDom) => {\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 if (originalItem) {\n originalChildren.splice(originalChildren.indexOf(originalItem), 1);\n }\n childItem.getParent = () => newWDom;\n return childItem;\n });\n return [remakedChildren, originalChildren];\n};\nconst findSameKeyOriginalItem = (item, originalChildren) => originalChildren.find(\n (orignalChildItem) => getKey(orignalChildItem) === getKey(item)\n);\nlet redrawQueue = [];\nlet redrawQueueTimeout = false;\nconst setRedrawAction = (compKey, exec) => {\n componentRef.get(compKey).up = () => {\n redrawQueue.push({\n compKey,\n exec\n });\n if (!redrawQueueTimeout) {\n redrawQueueTimeout = true;\n queueMicrotask(execRedrawQueue);\n }\n };\n};\nconst componentUpdate = (compKey) => () => {\n var _a;\n const up = (_a = componentRef.get(compKey)) == null ? void 0 : _a.up;\n let result = false;\n if (up) {\n up();\n result = true;\n }\n return result;\n};\nconst recursiveGetChildKeys = (wDom, result) => {\n (wDom.children || []).forEach((item) => {\n const childComKey = item.compKey;\n if (childComKey) {\n result.push(childComKey);\n }\n recursiveGetChildKeys(item, result);\n });\n};\nconst execRedrawQueue = () => {\n let childItemList = [];\n redrawQueue.forEach((item) => {\n var _a, _b;\n const childVd = (_b = (_a = componentRef.get(item.compKey)) == null ? void 0 : _a.vd) == null ? void 0 : _b.value;\n if (childVd) {\n recursiveGetChildKeys(childVd, childItemList);\n }\n });\n const addedKey = [];\n const result = redrawQueue.reduce((acc, item) => {\n const { compKey } = item;\n if (childItemList.includes(compKey) || addedKey.includes(compKey)) {\n return acc;\n }\n addedKey.push(compKey);\n acc.push(item);\n return acc;\n }, []);\n while (result.length) {\n const action = result.shift();\n if (action) {\n action.exec();\n }\n }\n redrawQueue = [];\n redrawQueueTimeout = false;\n};\nconst updateCallback = (effectAction, dependencies = () => []) => {\n const updateReqs = componentRef.get(getComponentKey()).upR;\n updateReqs.push(() => useUpdated(effectAction, dependencies));\n useUpdated(effectAction, dependencies);\n};\nconst runUpdateCallback = () => {\n var _a;\n const updateReqs = (_a = componentRef.get(getComponentKey())) == null ? void 0 : _a.upR;\n if (updateReqs == null ? void 0 : updateReqs.length) {\n updateReqs.forEach((callback) => callback());\n }\n};\nconst Fragment = (_props, ...children) => ({\n type: \"fragment\",\n children\n});\nconst h = (tag, props, ...children) => {\n const nodeParentPointer = { value: void 0 };\n const newProps = props || {};\n const newChildren = remakeChildren(nodeParentPointer, children);\n const node = makeNode(tag, newProps, newChildren);\n if (!checkCustemComponentFunction(node)) {\n nodeParentPointer.value = node;\n }\n return node;\n};\nconst mount = (component) => (_props, _children) => component;\nconst reRenderCustomComponent = (tag, props, children, originalWDom) => {\n var _a;\n needDiffRef.value = true;\n const newWDom = makeWDomResolver(tag, props, children);\n const newWDomTree = makeNewWDomTree(newWDom, originalWDom);\n const { isRoot, getParent: getParent2, wrapElement, afterElement } = originalWDom;\n newWDomTree.getParent = getParent2;\n if (!isRoot && getParent2) {\n const brothers = ((_a = getParent2()) == null ? void 0 : _a.children) || [];\n const index = brothers.indexOf(originalWDom);\n brothers.splice(index, 1, newWDomTree);\n } else {\n newWDomTree.isRoot = true;\n newWDomTree.wrapElement = wrapElement;\n newWDomTree.afterElement = afterElement;\n }\n needDiffRef.value = false;\n wDomUpdate(newWDomTree);\n};\nconst makeWDomResolver = (tag, props, children) => {\n const tagName = tag.name;\n const ctor = tag;\n const resolve = (compKey = props) => {\n initMountHookState(compKey);\n const component = tag(props, children);\n const componentMaker = component(componentUpdate(compKey), props, children);\n const customNode = makeCustomNode(\n componentMaker,\n compKey,\n tag,\n props,\n children\n );\n const originalWDom = customNode;\n setRedrawAction(\n compKey,\n () => reRenderCustomComponent(tag, props, children, originalWDom)\n );\n getComponentSubInfo(compKey, \"vd\").value = customNode;\n return customNode;\n };\n return { tagName, ctor, props, children, resolve };\n};\nconst makeCustomNode = (componentMaker, compKey, tag, props, children) => {\n const customNode = componentMaker(props);\n if (customNode.reRender) {\n throw new Error(\n 'Avoid the case where the first element of a component is a component. Instead of \"mount(()=>()=><Component />)\" replace it with something like \"mount(()=>()=><Fragment><Component /></Fragment>)\".'\n );\n }\n addComponentProps(\n customNode,\n compKey,\n tag,\n props,\n children,\n makeReRender(componentMaker, compKey, tag, props, children)\n );\n return customNode;\n};\nconst makeReRender = (componentMaker, compKey, tag, props, children) => {\n const reRender = () => wDomMaker(componentMaker, compKey, tag, props, children, reRender);\n return reRender;\n};\nconst wDomMaker = (componentMaker, compKey, tag, props, children, reRender) => {\n initUpdateHookState(compKey);\n runUpdateCallback();\n const originalWDom = componentMaker(props);\n setRedrawAction(\n compKey,\n () => reRenderCustomComponent(tag, props, children, originalWDom)\n );\n addComponentProps(originalWDom, compKey, tag, props, children, reRender);\n getComponentSubInfo(compKey, \"vd\").value = originalWDom;\n return originalWDom;\n};\nconst addComponentProps = (wDom, compKey, tag, props, children, reRender) => {\n assign(wDom, {\n compProps: props,\n compChild: children,\n ctor: tag,\n tagName: tag.name,\n compKey,\n reRender\n });\n};\nconst makeNode = (tag, props, children) => {\n if (checkFragmentFunction(tag)) {\n return Fragment(props, ...children);\n } else if (checkCustemComponentFunction(tag)) {\n const componetMakeResolver = makeWDomResolver(tag, props, children);\n return needDiffRef.value ? componetMakeResolver : componetMakeResolver.resolve();\n }\n return {\n type: \"element\",\n tag,\n props,\n children\n };\n};\nconst remakeChildren = (nodeParentPointer, children) => children.map(\n (item) => assign(makeChildrenItem(item), { getParent: () => nodeParentPointer.value })\n);\nconst makeChildrenItem = (item) => {\n if (item === null || item === void 0 || item === false) {\n return { type: null };\n } else if (Array.isArray(item)) {\n const nodeParentPointer = { value: void 0 };\n const children = remakeChildren(nodeParentPointer, item);\n const node = {\n type: \"loop\",\n children\n };\n nodeParentPointer.value = node;\n return node;\n } else if (typeof item === \"string\" || typeof item === \"number\") {\n return { type: \"text\", text: item };\n }\n return item;\n};\nconst ref = (initValue) => ({ value: initValue });\nconst nextTick = () => Promise.resolve();\nexport {\n Fragment,\n h,\n mount,\n mountCallback,\n nextTick,\n ref,\n render,\n updateCallback\n};\n//# sourceMappingURL=lithent.mjs.map\n","import { mountCallback as a, updateCallback as p, nextTick as h, render as i } from \"lithent\";\nconst v = (r, t) => {\n let e = r;\n return {\n get value() {\n return e;\n },\n get v() {\n return e;\n },\n set value(n) {\n e = n, t();\n },\n set v(n) {\n e = n, t();\n }\n };\n}, m = (r) => {\n let t = r;\n return {\n get value() {\n return t();\n },\n get v() {\n return t();\n },\n set value(e) {\n throw new Error(\"You can't change 'computed'\");\n },\n set v(e) {\n throw new Error(\"You can't change 'computed'\");\n }\n };\n}, d = (r, t = () => {\n}, e = () => []) => {\n a(() => (r(), t)), p(() => (t && t(), r), e);\n}, l = /* @__PURE__ */ new Map(), u = {}, x = (r) => {\n const t = Symbol();\n return l.set(t, r), (e) => (e && (u[t] ?? (u[t] = []), u[t].push(e)), f(t));\n}, f = (r) => new Proxy(l.get(r), {\n get(t, e) {\n return t[e];\n },\n set(t, e, n) {\n t[e] = n;\n const c = u[r], s = [];\n return c.forEach((o) => {\n o() || s.push(o);\n }), s.forEach(\n (o) => c.splice(c.indexOf(o), 1)\n ), !0;\n }\n}), E = (r, t, e) => {\n let n = () => {\n };\n return h().then(() => {\n n = i(r(), t, e);\n }), () => n();\n};\nexport {\n m as computed,\n d as effect,\n E as nextTickRender,\n v as state,\n x as store\n};\n//# sourceMappingURL=lithentHelper.mjs.map\n","// example.jsx\nimport {\n h,\n Fragment,\n render,\n ref,\n mountCallback,\n updateCallback,\n mount,\n} from 'lithent';\nimport { state, computed, effect, store } from 'lithent/helper';\n\n// This is the \"mount\" function.\n// This function is only executed on mount, and on update, only updates `props` and then executes the internal return function.\n// childen is passed as the second argument.\nconst ChildComponent = mount<{ parentValue: number }>(\n (renew, props, children) => {\n // The value is used as a \"getter\" to make it easy to get and write to in the higher-order functions it returns\n const count = state<number>(1, renew);\n const text = state<string>(\n '\"destructuring\" the \"props\" value directly from the mount function will cause referencing issues, so if you want to use it, you need to \"destructuring\" it from the internal function (updater).',\n renew\n );\n const getParentValue = () => props.parentValue;\n const parentValueFromMount = props.parentValue;\n const summ = computed<number>(\n () => count.v + notRefValue + props.parentValue\n );\n\n const localStore = store<{ text: string; count: number }>({\n text: 's',\n count: 0,\n })(renew);\n /*\n // To share a store, make it externally and use `asign`.\n const asignStore = store<{ text: string; count: number }>({ text: 's', count: 0 });\n\n const sharedStore = asignStore(nenew);\n */\n\n // Even if you don't use a ref, the private value is always maintained as a regular variable.\n let notRefValue = props.parentValue;\n\n // Ref is only used to reference the DOM.\n const domRef = ref(null);\n\n const increase = () => {\n count.v = count.v + 1;\n notRefValue += 1;\n };\n\n const handleInputChane = (event: InputEvent) => {\n text.v = (event.target as HTMLInputElement).value;\n };\n\n const localStoreUpdate = () => {\n localStore.count += 1;\n localStore.text += '1';\n };\n\n const handleMounted = () => {\n console.log('MOUNTED', domRef);\n\n return () => console.log('UNMOUNT');\n };\n const handleUpdated = () => {\n console.log('UPDATE - parentValue');\n\n return () => console.log('UPDATED');\n };\n\n mountCallback(handleMounted);\n updateCallback(handleUpdated, () => [props.parentValue]); // Only Defs Updated (using a closure to update a value)\n\n // Behaves like `react`'s `useEffect`\n effect(\n () => console.log('INJECT'),\n () => console.log('CLEAN_UP'),\n () => [count.v]\n );\n\n // Wrap in a function and return (using a closure to hold the value)\n // This is the \"update\" function.\n return ({ parentValue }) => (\n <Fragment>\n {/* Note that the event is onInput (we use the native event name to avoid confusion). */}\n <div>\n <textarea\n value={text.v}\n onInput={handleInputChane}\n style={{ width: '300px', height: '100px' }}\n />\n </div>\n <div>{text.v}</div>\n <div>\n <div style={{ color: 'blue' }}>\n parentValueFromRef: {props.parentValue} (working)\n </div>\n <div style={{ color: 'blue' }}>\n parentValueFromFunction: {getParentValue()} (working)\n </div>\n <div style={{ color: 'blue' }}>\n parentValueFromUpdaterDestructuring: {parentValue} (working)\n </div>\n <div style={{ color: 'red' }}>\n parentValueFromMounterDestructuring: {parentValueFromMount} (not\n working)\n </div>\n </div>\n <div>\n <div ref={domRef}>count: {count.v}</div>\n <div>sum: {count.v + notRefValue + props.parentValue}</div>\n <div>sum(computed): {summ.v}</div>\n {/* It doesn't pull it out from under the reference, it uses the value directly, so you can just use it. */}\n <div>notRefValue: {notRefValue}</div>\n <div>localStore(text): {localStore.text}</div>\n <div>localStore(count): {localStore.count}</div>\n </div>\n <button onClick={increase}>Increase</button>\n <button onClick={localStoreUpdate}>localStoreUpdate</button>\n {children}\n </Fragment>\n );\n }\n);\n\nconst Root = mount(renew => {\n const parentNumber = state<number>(7, renew);\n\n const increaseParent = () => {\n parentNumber.v = parentNumber.v + 1;\n };\n\n const decreaseParent = () => {\n parentNumber.v = parentNumber.v - 1;\n };\n\n return () => (\n <Fragment>\n <ChildComponent parentValue={parentNumber.v}>\n <button onClick={increaseParent}>Increase - Parent</button>\n </ChildComponent>\n <button onClick={decreaseParent}>Decrease - Parent</button>\n </Fragment>\n );\n});\nconst root = <Root />;\n\nrender(root, document.getElementById('root'));\n"],"names":["checkPlainWDomType","wDom","checkPlainType","typeName","checkSameCustomComponent","newWDom","originalWDom","checkSameFragment","_a","_b","checkSameTagElement","checkNormalTypeElement","checkExisty","getKey","target","checkVirtualType","type","checkCustemComponentFunction","checkFragmentFunction","Fragment","checkEmptyElement","value","checkStyleData","dataKey","dataValue","checkRefData","checkOptionElement","element","checkTextareaElement","checkCheckableElement","getWDomType","result","checkSameWDomWithOriginal","getParent","vDom","entries","keys","assign","xmlnsRef","compKeyRef","needDiffRef","componentRef","setComponetRef","compKey","getComponentKey","getComponentSubInfo","subKey","initUpdateHookState","initMountHookState","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","Dom","wDomToDom","recursiveRemoveEvent","rootDelete","wDomUpdate","newWDomTree","needRerender","typeAdd","typeDelete","typeReplace","typeUpdate","typeSortedReplace","typeSortedUpdate","removeEvent","childItem","deleteRealDom","findRealParentElement","parent","findChildWithRemoveElement","newElement","getElementFromFragment","parentWDom","parentEl","nextEl","startFindNextBrotherElement","acc","brothers","nextIndex","candidiateBrothers","finedNextEl","findChildFragmentNextElement","parentType","targetEl","bItem","el","isFragment","orignalElement","parentElement","oldProps","updateText","props","updateProps$1","originalProps","chkRemoveProp","updateStyle","updateEvent","makeAttrDataValue","setAttr","allowSetAttr","tag","text","children","isVirtualType","wDomChildrenToDom","elementChildren","newEventHandler","oldEventHandler","eventName","style","oldStyle","originalStyle","elementStyle","styleKey","makeNewWDomTree","remakeNewWDom","isSameType","remakeWDom","generalize","param","addReRenderTypeProperty","remakeChildrenForDiff","inheritPropForRender","existOriginalWDom","isEmptyElement","isRoot","originalParentWDom","origParentType","key","isKeyCheckedWDom","isSameText","chkDiffLoopOrder","origChildren","newChildren","newItem","filteredChildren","isSame","updateProps","infoProps","updateChildren","infoChidren","childrenItem","runUpdate","infoVdom","remakeChildrenForUpdate","remakeChildrenForAdd","remakeChildrenForLoopUpdate","remakedChildren","unUsedChildren","diffLoopChildren","unusedItem","originalChildren","originalItem","findSameKeyOriginalItem","orignalChildItem","redrawQueue","redrawQueueTimeout","setRedrawAction","exec","execRedrawQueue","componentUpdate","up","recursiveGetChildKeys","childComKey","childItemList","childVd","addedKey","action","updateCallback","runUpdateCallback","updateReqs","_props","h","nodeParentPointer","newProps","remakeChildren","node","makeNode","mount","_children","reRenderCustomComponent","makeWDomResolver","getParent2","componentMaker","customNode","makeCustomNode","addComponentProps","makeReRender","reRender","wDomMaker","componetMakeResolver","makeChildrenItem","ref","initValue","v","r","e","n","m","d","a","p","l","u","x","f","c","s","o","ChildComponent","renew","count","state","getParentValue","parentValueFromMount","summ","computed","notRefValue","localStore","store","domRef","increase","handleInputChane","event","localStoreUpdate","handleMounted","handleUpdated","parentValue","Root","parentNumber","increaseParent","decreaseParent","root"],"mappings":"ssBAAA,MAAMA,EAAsBC,GAAS,OAAOA,GAAS,UAAY,EAAE,YAAaA,GAC1EC,EAAiB,CAACD,EAAME,IAAaH,EAAmBC,CAAI,GAAKA,EAAK,OAASE,EAC/EC,GAA2B,CAACC,EAASC,IAAiB,SAAUD,EAAUA,EAAQ,QAAUC,GAAgB,KAAO,OAASA,EAAa,MAAQD,KAAaC,GAAgB,KAAO,OAASA,EAAa,MAC3MC,GAAoB,CAACF,EAASC,IAAiB,CACnD,IAAIE,EAAIC,EACR,OAAOT,EAAmBK,CAAO,IAAMC,GAAgB,KAAO,OAASA,EAAa,QAAU,cAAgBE,EAAKF,GAAgB,KAAO,OAASA,EAAa,WAAa,KAAO,OAASE,EAAG,YAAcC,EAAKJ,GAAW,KAAO,OAASA,EAAQ,WAAa,KAAO,OAASI,EAAG,OACxR,EACMC,GAAsB,CAACL,EAASC,IAAiB,CACrD,IAAIE,EAAIC,EACR,OAAOT,EAAmBK,CAAO,IAAMC,GAAgB,KAAO,OAASA,EAAa,QAAU,YAAcA,GAAgB,KAAO,OAASA,EAAa,OAASD,EAAQ,OAASG,EAAKF,GAAgB,KAAO,OAASA,EAAa,WAAa,KAAO,OAASE,EAAG,YAAcC,EAAKJ,GAAW,KAAO,OAASA,EAAQ,WAAa,KAAO,OAASI,EAAG,OAC7V,EACME,EAAyB,CAACN,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C,EAAA,MAAA,KACEA,EAAA,MAAA,CAAI,IAAKgD,GAAQ,UAAQT,EAAM,CAAE,EAClCvC,EAAC,MAAI,KAAA,QAAMuC,EAAM,EAAIM,EAAc9H,EAAM,WAAY,EACrDiF,EAAC,MAAI,KAAA,kBAAgB2C,EAAK,CAAE,EAE5B3C,EAAC,MAAI,KAAA,gBAAc6C,CAAY,EAC/B7C,EAAC,MAAI,KAAA,qBAAmB8C,EAAW,IAAK,EACvC9C,EAAA,MAAA,KAAI,sBAAoB8C,EAAW,KAAM,CAC5C,EACC9C,EAAA,SAAA,CAAO,QAASiD,GAAU,UAAQ,EAClCjD,EAAA,SAAA,CAAO,QAASoD,EAAA,EAAkB,kBAAgB,EAClD1H,CACH,CAEJ,CACF,EAEM8H,GAAOlD,GAAegC,GAAA,CACpB,MAAAmB,EAAejB,EAAc,EAAGF,CAAK,EAErCoB,EAAiB,IAAM,CACdD,EAAA,EAAIA,EAAa,EAAI,CAAA,EAG9BE,EAAiB,IAAM,CACdF,EAAA,EAAIA,EAAa,EAAI,CAAA,EAG7B,MAAA,MACJvP,EACC,KAAA8L,EAACqC,IAAe,YAAaoB,EAAa,GACvCzD,EAAA,SAAA,CAAO,QAAS0D,CAAgB,EAAA,mBAAiB,CACpD,EACA1D,EAAC,UAAO,QAAS2D,GAAgB,mBAAiB,CACpD,CAEJ,CAAC,EACKC,KAAQJ,GAAK,IAAA,EAEnBpL,GAAOwL,GAAM,SAAS,eAAe,MAAM,CAAC"}
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>lithent</title>
7
- <script type="module" crossorigin src="/assets/index-7b9ee4b8.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-290c744c.js"></script>
8
8
  </head>
9
9
  <body>
10
10
  <section id="root"></section>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lithent",
3
- "version": "1.3.4",
3
+ "version": "1.3.5",
4
4
  "description": "An extensible virtual DOM library for lightweight use in a variety of environments.",
5
5
  "packageManager": "pnpm@7.6.0",
6
6
  "main": "./dist/lithent.umd.js",
package/src/render.ts CHANGED
@@ -310,7 +310,8 @@ const updateProps = (
310
310
 
311
311
  entries(props || {}).forEach(([dataKey, dataValue]: [string, unknown]) => {
312
312
  let chkRemoveProp = true;
313
- if (dataKey === 'key') {
313
+
314
+ if (dataKey === 'key' || dataValue === originalProps[dataKey]) {
314
315
  // Do nothing
315
316
  } else if (dataKey === 'innerHTML' && typeof dataValue === 'string') {
316
317
  (element as HTMLElement).innerHTML = dataValue;
@@ -1,2 +0,0 @@
1
- (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const c of r)if(c.type==="childList")for(const s of c.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&o(s)}).observe(document,{childList:!0,subtree:!0});function n(r){const c={};return r.integrity&&(c.integrity=r.integrity),r.referrerPolicy&&(c.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?c.credentials="include":r.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function o(r){if(r.ep)return;r.ep=!0;const c=n(r);fetch(r.href,c)}})();const R=e=>typeof e=="object"&&!("resolve"in e),x=(e,t)=>R(e)&&e.type===t,xe=(e,t)=>"ctor"in e?e.ctor===(t==null?void 0:t.ctor):e===(t==null?void 0:t.ctor),me=(e,t)=>{var n,o;return R(e)&&(t==null?void 0:t.type)==="fragment"&&((n=t==null?void 0:t.children)==null?void 0:n.length)===((o=e==null?void 0:e.children)==null?void 0:o.length)},Se=(e,t)=>{var n,o;return R(e)&&(t==null?void 0:t.type)==="element"&&(t==null?void 0:t.tag)===e.tag&&((n=t==null?void 0:t.children)==null?void 0:n.length)===((o=e==null?void 0:e.children)==null?void 0:o.length)},I=(e,t)=>R(e)&&(t==null?void 0:t.type)===e.type&&(e.type!=="loop"||e.type==="loop"&&g(a((e.children||[])[0]))&&g(a((t.children||[])[0]))),a=e=>{var t,n;return((t=e==null?void 0:e.compProps)==null?void 0:t.key)??((n=e==null?void 0:e.props)==null?void 0:n.key)},y=e=>e&&["fragment","loop"].includes(e),b=e=>typeof e=="function"&&!K(e)||typeof e=="object"&&"resolve"in e,K=e=>typeof e=="function"&&e===A,w=e=>R(e)&&!e.type,g=e=>e!=null,$=(e,t)=>e==="style"&&typeof t=="object",be=(e,t)=>e==="ref"&&typeof t=="object",Ne=e=>e.nodeType===1&&e.tagName==="OPTION",Te=e=>e.nodeType===1&&e.tagName==="TEXTAREA",Ue=e=>e.nodeType===1&&["radio","checkbox"].includes(e.type),Fe=e=>{let t="et";return b(e)?t="c":x(e,"fragment")?t="f":x(e,"element")?t="e":x(e,"loop")?t="l":x(e,"text")?t="t":w(e)&&(t="et"),t},Oe={c:xe,l:I,t:I,e:Se,f:me,et:I},v=e=>e.getParent&&e.getParent(),k=Object.entries,D=Object.keys,N=Object.assign,C={value:""},E={value:{}},Q={value:!1},i=new WeakMap,_e=e=>{i.set(e,{vd:{value:null},up:()=>{},upR:[],upS:{value:0},upD:[],upCB:[],mts:[],umts:[]})},P=()=>E.value,W=(e,t)=>i.get(e)[t],Ae=e=>E.value=e,Le=e=>{E.value=e,_e(e)},Me=e=>{i.get(P()).umts.push(e)},T=e=>{const{compKey:t}=e;t&&Ie(t),ee(e)},ee=e=>{(e.children||[]).forEach(t=>{t.compKey?T(t):ee(t)})},Ie=e=>{const t=i.get(e);t&&(t.umts.forEach(n=>n()),t.umts=[],i.delete(e))};let q=[];const z=()=>{q.forEach(e=>qe(e)),q=[]},Qe=e=>{e.compKey&&q.push(e)},te=e=>i.get(P()).mts.push(e),qe=e=>{const{compKey:t}=e;if(t){const n=i.get(t),o=n==null?void 0:n.mts,r=n==null?void 0:n.upS;E.value=t,r&&(r.value=0),o&&(n.mts=[],o.forEach(c=>{const s=c();s&&Me(s)}))}},H=(e,t=()=>[])=>{const n=i.get(P()),{upD:o,upS:r}=n,c=o[r.value];if(c&&Ve(c,t())){const s=e();s&&n.upCB.push(s)}o[r.value]=t(),r.value+=1},Be=e=>{const{compKey:t}=e;if(t){const n=i.get(t),o=n==null?void 0:n.upCB,r=n==null?void 0:n.upS;E.value=t,r&&(r.value=0),e.ctor&&o&&(n.upCB=[],o.forEach(c=>c()))}},Ve=(e,t)=>e.length?e.some((n,o)=>n!==t[o]):!0,je=e=>e==="className"?"class":e,ne=e=>e.replace(/^on(.*)/,(t,n)=>n.toLowerCase()),G=()=>new DocumentFragment,Z=e=>document.createElement(e),Ye=(e,t,n)=>{t??(t=document.body),e.isRoot=!0,e.wrapElement=t;const o=F(e);return n?(e.afterElement=n,t.insertBefore(o,n)):t.appendChild(o),z(),()=>{var r;const c=(r=i.get(e.compProps||{}))==null?void 0:r.vd.value;c&&(T(c),U(c),ze(c))}},oe=e=>{const{needRerender:t}=e;t&&t!=="N"&&({A:X,D:J,R:Je,U:V,CNSU:V,SR:se,SU:Ge}[t](e),delete e.needRerender,delete e.oldChildren,delete e.oldProps)},U=e=>{e.props&&e.el&&ie(e.props,e.el),(e.children||[]).forEach(t=>{U(t)})},ze=e=>{re(e,e.wrapElement)},J=e=>{e.oldProps&&e.el&&ie(e.oldProps,e.el),re(e,O(v(e)))},re=(e,t)=>{var n,o;t&&e.el&&(((n=e.el)==null?void 0:n.nodeType)===1?t.removeChild(e.el):((o=e.el)==null?void 0:o.nodeType)===11&&ce(e,t),delete e.el)},ce=(e,t)=>{((e==null?void 0:e.oldChildren)||(e==null?void 0:e.children)||[]).forEach(n=>{var o,r;((o=n.el)==null?void 0:o.nodeType)===1?t.removeChild(n==null?void 0:n.el):((r=n.el)==null?void 0:r.nodeType)===11&&ce(n,t)})},se=e=>{J(e),X(e)},Ge=e=>{if(V(e),v(e).needRerender!=="CNSU"){const n=le(e);X(e,n)}},X=(e,t)=>{t||(t=F(e));const n=v(e);if(n.type){const o=O(n),c=n.type==="loop"&&n.needRerender&&n.needRerender!=="CNSU"?B(n,v(n)):B(e,n);t&&o&&(c?o.insertBefore(t,c):o.appendChild(t),z())}},le=e=>y(e.type)?((e==null?void 0:e.children)||[]).reduce((t,n)=>{const o=le(n);return o&&t.appendChild(o),t},G()):e.el,B=(e,t)=>{const n=t.children||[],r=n.indexOf(e)+1,c=n.slice(r),s=ue(c),u=t.type||"";if(s)return s;if(!t.isRoot&&y(u))return B(t,v(t));if(t.isRoot&&y(u)&&t.afterElement)return t.afterElement},ue=e=>e.reduce((t,n)=>{const o=n.type,r=n.el,c=o&&y(o);return t||(c?ue(n.children||[]):r&&r.nodeType!==11?r:t)},void 0),Je=e=>{const t=v(e),n=e.el;if(t.type&&n)if(n.nodeType===11)se(e);else{const o=O(t),r=F(e);o&&o.replaceChild(r,n),z()}},ie=(e,t)=>{k(e||{}).forEach(([n,o])=>{n.match(/^on/)&&t.removeEventListener(ne(n),o)})},V=e=>{var t;const n=e.el;if(e.type==="text"){Xe(e);return}if(n){const{oldProps:o,props:r}=e;de(r,n,o),delete e.oldProps,e.tag==="input"&&(n.value=String(((t=e==null?void 0:e.props)==null?void 0:t.value)||""))}(e.children||[]).forEach(o=>oe(o)),Be(e)},Xe=e=>{const t=e.el;t&&(t.nodeValue=String(e.text))},de=(e,t,n)=>{const o={...n};k(e||{}).forEach(([r,c])=>{let s=!0;r==="key"||(r==="innerHTML"&&typeof c=="string"?t.innerHTML=c:$(r,c)?we(c,$(r,o.style)?o.style:{},t):be(r,c)?c.value=t:r.match(/^on/)?Ke(t,r,c,o[r]):Ue(t)&&r==="checked"?t.checked=!!c:Te(t)&&r==="value"?t.value=c:Ne(t)&&r==="selected"?t.selected=!!c:r&&([s,c]=He(c),s&&$e(je(r),t,c))),s&&delete o[r]}),D(o).forEach(r=>t.removeAttribute(r))},$e=(e,t,n)=>{C.value&&e!=="xmlns"?t.setAttributeNS(null,e,n):t.setAttribute(e,n)},He=e=>{let t=!0;return typeof e=="boolean"&&(e||(t=!1),e=""),[t,String(e)]},F=e=>{let t;const{type:n,tag:o,text:r,props:c,children:s=[]}=e,u=y(n);return o==="svg"&&(C.value=String(c==null?void 0:c.xmlns)),u?t=G():n==="element"&&o?t=C.value?document.createElementNS(C.value,o):Z(o):n==="text"&&g(r)?t=document.createTextNode(String(r)):t=Z("e"),Ze(s,t),de(c,t),e.el=t,Qe(e),o==="svg"&&(C.value=""),t},Ze=(e,t)=>{const n=e.reduce((o,r)=>(r.type&&o.appendChild(F(r)),o),G());t&&n.hasChildNodes()&&t.appendChild(n)},Ke=(e,t,n,o)=>{const r=ne(t);o!==n&&(o&&e.removeEventListener(r,o),n&&e.addEventListener(r,n))},we=(e,t,n)=>{const o={...t},r=n==null?void 0:n.style;r&&(k(e).forEach(([c,s])=>{r[c]=s,delete o[c]}),k(o).forEach(([c])=>r[c]=""))},O=e=>{const t=y(e.type);return e.isRoot&&t?e.wrapElement:t?O(v(e)):e.el},_=(e,t)=>De(e,Oe[Fe(e)](e,t),t),De=(e,t,n)=>{const o=ct(e,t,n),r=[o,t,n],c=et(...r);return o.children=st(...r),o.needRerender=c,We(o,n,c),n&&delete n.children,o},We=(e,t,n)=>{n!=="A"&&t&&(e.el=t.el),n&&["D","R","SR"].includes(n)&&(t!=null&&t.compKey&&(T(t),U(t)),e.oldChildren=t==null?void 0:t.children),e.oldProps=t==null?void 0:t.props},et=(e,t,n)=>{const o=n&&n.type,r=w(e),c=e.isRoot,s=n&&v(n),u=!c&&(s==null?void 0:s.type),p=a(e),d=u==="loop"&&g(p),h=e.type==="text"&&t&&e.text===(n==null?void 0:n.text);let f;return r?f="D":h?f="N":o?t?f=d?"SU":"U":f=d?"SR":"R":f="A",e.type==="loop"&&f==="U"&&n&&tt(e,n)&&(f="CNSU"),f},tt=(e,t)=>{const n=[...(t==null?void 0:t.children)||[]],o=[...(e==null?void 0:e.children)||[]].filter(s=>n.find(u=>a(s)===a(u))),r=n.filter(s=>o.find(u=>a(s)===a(u)));let c=r.length===o.length;return c&&(c=r.every((s,u)=>a(s)===a(o[u]))),c},nt=(e,t)=>{e&&t!==e&&(D(e).forEach(n=>delete e[n]),k(t||{}).forEach(([n,o])=>e[n]=o))},ot=(e,t)=>{e&&t!==e&&(e.splice(0,e.length),t&&t.forEach(n=>e.push(n)))},rt=(e,t)=>{const{compProps:n,compChild:o}=e,{props:r,children:c}=t;return n&&nt(n,r),o&&ot(o,c),e.reRender&&e.reRender()},ct=(e,t,n)=>b(e)?t&&n?rt(n,e):e.resolve():e,st=(e,t,n)=>t&&n?ut(e,n):lt(e),lt=e=>(e.children||[]).map(t=>N(_(t),{getParent:()=>e})),ut=(e,t)=>e.type==="loop"&&g(a((e.children||[])[0]))?it(e,t):(e.children||[]).map((n,o)=>N(_(n,(t.children||[])[o]),{getParent:()=>e})),it=(e,t)=>{const[n,o]=dt(e,t);return o.map(r=>{T(r),U(r),J(r)}),n},dt=(e,t)=>{const n=[...e.children||[]],o=[...t.children||[]];return[n.map(c=>{const s=ft(c,o),u=_(c,s);return s&&o.splice(o.indexOf(s),1),u.getParent=()=>e,u}),o]},ft=(e,t)=>t.find(n=>a(n)===a(e));let m=[],j=!1;const fe=(e,t)=>{i.get(e).up=()=>{m.push({compKey:e,exec:t}),j||(j=!0,queueMicrotask(at))}},pt=e=>()=>{var t;const n=(t=i.get(e))==null?void 0:t.up;let o=!1;return n&&(n(),o=!0),o},pe=(e,t)=>{(e.children||[]).forEach(n=>{const o=n.compKey;o&&t.push(o),pe(n,t)})},at=()=>{let e=[];m.forEach(o=>{var r,c;const s=(c=(r=i.get(o.compKey))==null?void 0:r.vd)==null?void 0:c.value;s&&pe(s,e)});const t=[],n=m.reduce((o,r)=>{const{compKey:c}=r;return e.includes(c)||t.includes(c)||(t.push(c),o.push(r)),o},[]);for(;n.length;){const o=n.shift();o&&o.exec()}m=[],j=!1},ae=(e,t=()=>[])=>{i.get(P()).upR.push(()=>H(e,t)),H(e,t)},ht=()=>{var e;const t=(e=i.get(P()))==null?void 0:e.upR;t!=null&&t.length&&t.forEach(n=>n())},A=(e,...t)=>({type:"fragment",children:t}),l=(e,t,...n)=>{const o={value:void 0},r=t||{},c=ge(o,n),s=gt(e,r,c);return b(s)||(o.value=s),s},he=e=>(t,n)=>e,ve=(e,t,n,o)=>{var r;Q.value=!0;const c=ye(e,t,n),s=_(c,o),{isRoot:u,getParent:p,wrapElement:d,afterElement:h}=o;if(s.getParent=p,!u&&p){const f=((r=p())==null?void 0:r.children)||[],L=f.indexOf(o);f.splice(L,1,s)}else s.isRoot=!0,s.wrapElement=d,s.afterElement=h;Q.value=!1,oe(s)},ye=(e,t,n)=>({tagName:e.name,ctor:e,props:t,children:n,resolve:(s=t)=>{Le(s);const p=e(t,n)(pt(s),t,n),d=vt(p,s,e,t,n),h=d;return fe(s,()=>ve(e,t,n,h)),W(s,"vd").value=d,d}}),vt=(e,t,n,o,r)=>{const c=e(o);if(c.reRender)throw new Error('Avoid the case where the first element of a component is a component. Instead of "mount(()=>()=><Component />)" replace it with something like "mount(()=>()=><Fragment><Component /></Fragment>)".');return Ce(c,t,n,o,r,yt(e,t,n,o,r)),c},yt=(e,t,n,o,r)=>{const c=()=>Ct(e,t,n,o,r,c);return c},Ct=(e,t,n,o,r,c)=>{Ae(t),ht();const s=e(o);return fe(t,()=>ve(n,o,r,s)),Ce(s,t,n,o,r,c),W(t,"vd").value=s,s},Ce=(e,t,n,o,r,c)=>{N(e,{compProps:o,compChild:r,ctor:n,tagName:n.name,compKey:t,reRender:c})},gt=(e,t,n)=>{if(K(e))return A(t,...n);if(b(e)){const o=ye(e,t,n);return Q.value?o:o.resolve()}return{type:"element",tag:e,props:t,children:n}},ge=(e,t)=>t.map(n=>N(kt(n),{getParent:()=>e.value})),kt=e=>{if(e==null||e===!1)return{type:null};if(Array.isArray(e)){const t={value:void 0},o={type:"loop",children:ge(t,e)};return t.value=o,o}else if(typeof e=="string"||typeof e=="number")return{type:"text",text:e};return e},Rt=e=>({value:e}),Y=(e,t)=>{let n=e;return{get value(){return n},get v(){return n},set value(o){n=o,t()},set v(o){n=o,t()}}},Et=e=>{let t=e;return{get value(){return t()},get v(){return t()},set value(n){throw new Error("You can't change 'computed'")},set v(n){throw new Error("You can't change 'computed'")}}},Pt=(e,t=()=>{},n=()=>[])=>{te(()=>(e(),t)),ae(()=>(t&&t(),e),n)},ke=new Map,S={},xt=e=>{const t=Symbol();return ke.set(t,e),n=>(n&&(S[t]??(S[t]=[]),S[t].push(n)),mt(t))},mt=e=>new Proxy(ke.get(e),{get(t,n){return t[n]},set(t,n,o){t[n]=o;const r=S[e],c=[];return r.forEach(s=>{s()||c.push(s)}),c.forEach(s=>r.splice(r.indexOf(s),1)),!0}}),St=he((e,t,n)=>{const o=Y(1,e),r=Y('"destructuring" the "props" value directly from the mount function will cause referencing issues, so if you want to use it, you need to "destructuring" it from the internal function (updater).',e),c=()=>t.parentValue,s=t.parentValue,u=Et(()=>o.v+d+t.parentValue),p=xt({text:"s",count:0})(e);let d=t.parentValue;const h=Rt(null),f=()=>{o.v=o.v+1,d+=1},L=M=>{r.v=M.target.value},Re=()=>{p.count+=1,p.text+="1"},Ee=()=>(console.log("MOUNTED",h),()=>console.log("UNMOUNT")),Pe=()=>(console.log("UPDATE - parentValue"),()=>console.log("UPDATED"));return te(Ee),ae(Pe,()=>[t.parentValue]),Pt(()=>console.log("INJECT"),()=>console.log("CLEAN_UP"),()=>[o.v]),({parentValue:M})=>l(A,null,l("div",null,l("textarea",{value:r.v,onInput:L,style:{width:"300px",height:"100px"}})),l("div",null,r.v),l("div",null,l("div",{style:{color:"blue"}},"parentValueFromRef: ",t.parentValue," (working)"),l("div",{style:{color:"blue"}},"parentValueFromFunction: ",c()," (working)"),l("div",{style:{color:"blue"}},"parentValueFromUpdaterDestructuring: ",M," (working)"),l("div",{style:{color:"red"}},"parentValueFromMounterDestructuring: ",s," (not working)")),l("div",null,l("div",{ref:h},"count: ",o.v),l("div",null,"sum: ",o.v+d+t.parentValue),l("div",null,"sum(computed): ",u.v),l("div",null,"notRefValue: ",d),l("div",null,"localStore(text): ",p.text),l("div",null,"localStore(count): ",p.count)),l("button",{onClick:f},"Increase"),l("button",{onClick:Re},"localStoreUpdate"),n)}),bt=he(e=>{const t=Y(7,e),n=()=>{t.v=t.v+1},o=()=>{t.v=t.v-1};return()=>l(A,null,l(St,{parentValue:t.v},l("button",{onClick:n},"Increase - Parent")),l("button",{onClick:o},"Decrease - Parent"))}),Nt=l(bt,null);Ye(Nt,document.getElementById("root"));
2
- //# sourceMappingURL=index-7b9ee4b8.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-7b9ee4b8.js","sources":["../../../dist/lithent.mjs","../../../helper/dist/lithentHelper.mjs","../../src/index.tsx"],"sourcesContent":["const checkPlainWDomType = (wDom) => typeof wDom === \"object\" && !(\"resolve\" in wDom);\nconst checkPlainType = (wDom, typeName) => checkPlainWDomType(wDom) && wDom.type === typeName;\nconst checkSameCustomComponent = (newWDom, originalWDom) => \"ctor\" in newWDom ? newWDom.ctor === (originalWDom == null ? void 0 : originalWDom.ctor) : newWDom === (originalWDom == null ? void 0 : originalWDom.ctor);\nconst checkSameFragment = (newWDom, originalWDom) => {\n var _a, _b;\n return checkPlainWDomType(newWDom) && (originalWDom == null ? void 0 : originalWDom.type) === \"fragment\" && ((_a = originalWDom == null ? void 0 : originalWDom.children) == null ? void 0 : _a.length) === ((_b = newWDom == null ? void 0 : newWDom.children) == null ? void 0 : _b.length);\n};\nconst checkSameTagElement = (newWDom, originalWDom) => {\n var _a, _b;\n return checkPlainWDomType(newWDom) && (originalWDom == null ? void 0 : originalWDom.type) === \"element\" && (originalWDom == null ? void 0 : originalWDom.tag) === newWDom.tag && ((_a = originalWDom == null ? void 0 : originalWDom.children) == null ? void 0 : _a.length) === ((_b = newWDom == null ? void 0 : newWDom.children) == null ? void 0 : _b.length);\n};\nconst checkNormalTypeElement = (newWDom, originalWDom) => checkPlainWDomType(newWDom) && (originalWDom == null ? void 0 : originalWDom.type) === newWDom.type && (newWDom.type !== \"loop\" || newWDom.type === \"loop\" && checkExisty(getKey((newWDom.children || [])[0])) && checkExisty(getKey((originalWDom.children || [])[0])));\nconst getKey = (target) => {\n var _a, _b;\n return ((_a = target == null ? void 0 : target.compProps) == null ? void 0 : _a.key) ?? ((_b = target == null ? void 0 : target.props) == null ? void 0 : _b.key);\n};\nconst checkVirtualType = (type) => type && [\"fragment\", \"loop\"].includes(type);\nconst checkCustemComponentFunction = (target) => typeof target === \"function\" && !checkFragmentFunction(target) || typeof target === \"object\" && \"resolve\" in target;\nconst checkFragmentFunction = (target) => typeof target === \"function\" && target === Fragment;\nconst checkEmptyElement = (wDom) => checkPlainWDomType(wDom) && !wDom.type;\nconst checkExisty = (value) => value !== null && value !== void 0;\nconst checkStyleData = (dataKey, dataValue) => dataKey === \"style\" && typeof dataValue === \"object\";\nconst checkRefData = (dataKey, dataValue) => dataKey === \"ref\" && typeof dataValue === \"object\";\nconst checkOptionElement = (element) => element.nodeType === 1 && element.tagName === \"OPTION\";\nconst checkTextareaElement = (element) => element.nodeType === 1 && element.tagName === \"TEXTAREA\";\nconst checkCheckableElement = (element) => element.nodeType === 1 && [\"radio\", \"checkbox\"].includes(element.type);\nconst getWDomType = (wDom) => {\n let result = \"et\";\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 return result;\n};\nconst checkSameWDomWithOriginal = {\n c: checkSameCustomComponent,\n l: checkNormalTypeElement,\n t: checkNormalTypeElement,\n e: checkSameTagElement,\n f: checkSameFragment,\n et: checkNormalTypeElement\n};\nconst getParent = (vDom) => vDom.getParent && vDom.getParent();\nconst entries = Object.entries;\nconst keys = Object.keys;\nconst assign = Object.assign;\nconst xmlnsRef = { value: \"\" };\nconst compKeyRef = { value: {} };\nconst needDiffRef = { value: false };\nconst componentRef = /* @__PURE__ */ new WeakMap();\nconst setComponetRef = (compKey) => {\n componentRef.set(compKey, {\n vd: { value: null },\n up: () => {\n },\n upR: [],\n upS: { value: 0 },\n upD: [],\n upCB: [],\n mts: [],\n umts: []\n });\n};\nconst getComponentKey = () => compKeyRef.value;\nconst getComponentSubInfo = (compKey, subKey) => componentRef.get(compKey)[subKey];\nconst initUpdateHookState = (compKey) => compKeyRef.value = compKey;\nconst initMountHookState = (compKey) => {\n compKeyRef.value = compKey;\n setComponetRef(compKey);\n};\nconst unmount = (effectAction) => {\n componentRef.get(getComponentKey()).umts.push(effectAction);\n};\nconst runUnmountQueueFromWDom = (newWDom) => {\n const { compKey } = newWDom;\n if (compKey) {\n removeItem(compKey);\n }\n recursiveRunUnmount(newWDom);\n};\nconst recursiveRunUnmount = (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};\nconst removeItem = (compKey) => {\n const subInfo = componentRef.get(compKey);\n if (subInfo) {\n subInfo.umts.forEach((effect) => effect());\n subInfo.umts = [];\n componentRef.delete(compKey);\n }\n};\nlet mountedQueue = [];\nconst execMountedQueue = () => {\n mountedQueue.forEach((item) => runMountedQueueFromWDom(item));\n mountedQueue = [];\n};\nconst addMountedQueue = (wDom) => {\n if (wDom.compKey) {\n mountedQueue.push(wDom);\n }\n};\nconst mountCallback = (effectAction) => componentRef.get(getComponentKey()).mts.push(effectAction);\nconst runMountedQueueFromWDom = (newWDom) => {\n const { compKey } = newWDom;\n if (compKey) {\n const component = componentRef.get(compKey);\n const queue = component == null ? void 0 : component.mts;\n const sequence = component == null ? void 0 : component.upS;\n compKeyRef.value = compKey;\n if (sequence) {\n sequence.value = 0;\n }\n if (queue) {\n component.mts = [];\n queue.forEach((effect) => {\n const callback = effect();\n if (callback) {\n unmount(callback);\n }\n });\n }\n }\n};\nconst useUpdated = (effectAction, dependencies = () => []) => {\n const component = componentRef.get(getComponentKey());\n const { upD, upS } = component;\n const def = upD[upS.value];\n if (def && checkNeedPushQueue(def, dependencies())) {\n const callback = effectAction();\n if (callback) {\n component.upCB.push(callback);\n }\n }\n upD[upS.value] = dependencies();\n upS.value += 1;\n};\nconst runUpdatedQueueFromWDom = (newWDom) => {\n const { compKey } = newWDom;\n if (compKey) {\n const component = componentRef.get(compKey);\n const queue = component == null ? void 0 : component.upCB;\n const sequence = component == null ? void 0 : component.upS;\n compKeyRef.value = compKey;\n if (sequence) {\n sequence.value = 0;\n }\n if (newWDom.ctor && queue) {\n component.upCB = [];\n queue.forEach((effect) => effect());\n }\n }\n};\nconst checkNeedPushQueue = (originalDefs, newDefs) => !originalDefs.length ? true : originalDefs.some((def, index) => def !== newDefs[index]);\nconst getAttrKey = (keyName) => keyName === \"className\" ? \"class\" : keyName;\nconst getEventName = (eventKey) => eventKey.replace(/^on(.*)/, (_match, p1) => p1.toLowerCase());\nconst DF = () => new DocumentFragment();\nconst CE = (t) => document.createElement(t);\nconst render = (wDom, wrapElement, afterElement) => {\n wrapElement ?? (wrapElement = document.body);\n wDom.isRoot = true;\n wDom.wrapElement = wrapElement;\n const Dom = wDomToDom(wDom);\n if (afterElement) {\n wDom.afterElement = afterElement;\n wrapElement.insertBefore(Dom, afterElement);\n } else {\n wrapElement.appendChild(Dom);\n }\n execMountedQueue();\n return () => {\n var _a;\n const component = (_a = componentRef.get(wDom.compProps || {})) == null ? void 0 : _a.vd.value;\n if (component) {\n runUnmountQueueFromWDom(component);\n recursiveRemoveEvent(component);\n rootDelete(component);\n }\n };\n};\nconst wDomUpdate = (newWDomTree) => {\n const { needRerender } = newWDomTree;\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 delete newWDomTree.needRerender;\n delete newWDomTree.oldChildren;\n delete newWDomTree.oldProps;\n }\n};\nconst recursiveRemoveEvent = (originalWDom) => {\n if (originalWDom.props && originalWDom.el) {\n removeEvent(originalWDom.props, originalWDom.el);\n }\n (originalWDom.children || []).forEach((childItem) => {\n recursiveRemoveEvent(childItem);\n });\n};\nconst rootDelete = (newWDom) => {\n deleteRealDom(newWDom, newWDom.wrapElement);\n};\nconst typeDelete = (newWDom) => {\n if (newWDom.oldProps && newWDom.el) {\n removeEvent(newWDom.oldProps, newWDom.el);\n }\n deleteRealDom(\n newWDom,\n findRealParentElement(getParent(newWDom))\n );\n};\nconst deleteRealDom = (newWDom, parent) => {\n var _a, _b;\n if (parent && newWDom.el) {\n if (((_a = newWDom.el) == null ? void 0 : _a.nodeType) === 1) {\n parent.removeChild(newWDom.el);\n } else if (((_b = newWDom.el) == null ? void 0 : _b.nodeType) === 11) {\n findChildWithRemoveElement(newWDom, parent);\n }\n delete newWDom.el;\n }\n};\nconst findChildWithRemoveElement = (newWDom, parent) => {\n ((newWDom == null ? void 0 : newWDom.oldChildren) || (newWDom == null ? void 0 : newWDom.children) || []).forEach((item) => {\n var _a, _b;\n if (((_a = item.el) == null ? void 0 : _a.nodeType) === 1) {\n parent.removeChild(item == null ? void 0 : item.el);\n } else if (((_b = item.el) == null ? void 0 : _b.nodeType) === 11) {\n findChildWithRemoveElement(item, parent);\n }\n });\n};\nconst typeSortedReplace = (newWDom) => {\n typeDelete(newWDom);\n typeAdd(newWDom);\n};\nconst typeSortedUpdate = (newWDom) => {\n typeUpdate(newWDom);\n const parentWDom = getParent(newWDom);\n if (parentWDom.needRerender !== \"CNSU\") {\n const newElement = getElementFromFragment(newWDom);\n typeAdd(newWDom, newElement);\n }\n};\nconst typeAdd = (newWDom, newElement) => {\n if (!newElement) {\n newElement = wDomToDom(newWDom);\n }\n const parentWDom = getParent(newWDom);\n if (parentWDom.type) {\n const parentEl = findRealParentElement(parentWDom);\n const isLoop = parentWDom.type === \"loop\";\n const nextEl = isLoop && parentWDom.needRerender && parentWDom.needRerender !== \"CNSU\" ? startFindNextBrotherElement(parentWDom, getParent(parentWDom)) : startFindNextBrotherElement(newWDom, parentWDom);\n if (newElement && parentEl) {\n if (nextEl) {\n parentEl.insertBefore(newElement, nextEl);\n } else {\n parentEl.appendChild(newElement);\n }\n execMountedQueue();\n }\n }\n};\nconst getElementFromFragment = (newWDom) => {\n if (checkVirtualType(newWDom.type)) {\n return ((newWDom == null ? void 0 : newWDom.children) || []).reduce((acc, item) => {\n const element = getElementFromFragment(item);\n if (element) {\n acc.appendChild(element);\n }\n return acc;\n }, DF());\n }\n return newWDom.el;\n};\nconst startFindNextBrotherElement = (wDom, parentWDom) => {\n const brothers = parentWDom.children || [];\n const index = brothers.indexOf(wDom);\n const nextIndex = index + 1;\n const candidiateBrothers = brothers.slice(nextIndex);\n const finedNextEl = findChildFragmentNextElement(candidiateBrothers);\n const parentType = parentWDom.type || \"\";\n if (finedNextEl) {\n return finedNextEl;\n }\n if (!parentWDom.isRoot && checkVirtualType(parentType)) {\n return startFindNextBrotherElement(parentWDom, getParent(parentWDom));\n } else if (parentWDom.isRoot && checkVirtualType(parentType) && parentWDom.afterElement) {\n return parentWDom.afterElement;\n }\n return void 0;\n};\nconst findChildFragmentNextElement = (candidiateBrothers) => candidiateBrothers.reduce(\n (targetEl, bItem) => {\n const type = bItem.type;\n const el = bItem.el;\n const isFragment = type && checkVirtualType(type);\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 return targetEl;\n },\n void 0\n);\nconst typeReplace = (newWDom) => {\n const parentWDom = getParent(newWDom);\n const orignalElement = newWDom.el;\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 if (parentElement) {\n parentElement.replaceChild(newElement, orignalElement);\n }\n execMountedQueue();\n }\n }\n};\nconst removeEvent = (oldProps, element) => {\n entries(oldProps || {}).forEach(([dataKey, dataValue]) => {\n if (dataKey.match(/^on/)) {\n element.removeEventListener(\n getEventName(dataKey),\n dataValue\n );\n }\n });\n};\nconst typeUpdate = (newWDom) => {\n var _a;\n const element = newWDom.el;\n if (newWDom.type === \"text\") {\n updateText(newWDom);\n return;\n }\n if (element) {\n const { oldProps, props } = newWDom;\n updateProps$1(props, element, oldProps);\n delete newWDom.oldProps;\n if (newWDom.tag === \"input\") {\n element.value = String(((_a = newWDom == null ? void 0 : newWDom.props) == null ? void 0 : _a.value) || \"\");\n }\n }\n (newWDom.children || []).forEach((childItem) => wDomUpdate(childItem));\n runUpdatedQueueFromWDom(newWDom);\n};\nconst updateText = (newWDom) => {\n const element = newWDom.el;\n if (element) {\n element.nodeValue = String(newWDom.text);\n }\n};\nconst updateProps$1 = (props, element, oldProps) => {\n const originalProps = { ...oldProps };\n entries(props || {}).forEach(([dataKey, dataValue]) => {\n let chkRemoveProp = true;\n if (dataKey === \"key\")\n ;\n else if (dataKey === \"innerHTML\" && typeof dataValue === \"string\") {\n element.innerHTML = dataValue;\n } else if (checkStyleData(dataKey, dataValue)) {\n updateStyle(\n dataValue,\n checkStyleData(dataKey, originalProps.style) ? originalProps.style : {},\n element\n );\n } else if (checkRefData(dataKey, dataValue)) {\n dataValue.value = element;\n } else if (dataKey.match(/^on/)) {\n updateEvent(\n element,\n dataKey,\n dataValue,\n originalProps[dataKey]\n );\n } else if (checkCheckableElement(element) && dataKey === \"checked\") {\n element.checked = !!dataValue;\n } else if (checkTextareaElement(element) && dataKey === \"value\") {\n element.value = dataValue;\n } else if (checkOptionElement(element) && dataKey === \"selected\") {\n element.selected = !!dataValue;\n } else if (dataKey) {\n [chkRemoveProp, dataValue] = makeAttrDataValue(dataValue);\n if (chkRemoveProp) {\n setAttr(\n getAttrKey(dataKey),\n element,\n dataValue\n );\n }\n }\n if (chkRemoveProp) {\n delete originalProps[dataKey];\n }\n });\n keys(originalProps).forEach(\n (dataKey) => element.removeAttribute(dataKey)\n );\n};\nconst setAttr = (dataKey, element, dataValue) => {\n if (xmlnsRef.value && dataKey !== \"xmlns\") {\n element.setAttributeNS(null, dataKey, dataValue);\n } else {\n element.setAttribute(dataKey, dataValue);\n }\n};\nconst makeAttrDataValue = (dataValue) => {\n let allowSetAttr = true;\n if (typeof dataValue === \"boolean\") {\n if (!dataValue) {\n allowSetAttr = false;\n }\n dataValue = \"\";\n }\n return [allowSetAttr, String(dataValue)];\n};\nconst wDomToDom = (wDom) => {\n let element;\n const { type, tag, text, props, children = [] } = wDom;\n const isVirtualType = checkVirtualType(type);\n if (tag === \"svg\") {\n xmlnsRef.value = String(props == null ? void 0 : props.xmlns);\n }\n if (isVirtualType) {\n element = DF();\n } else if (type === \"element\" && tag) {\n element = xmlnsRef.value ? document.createElementNS(xmlnsRef.value, tag) : CE(tag);\n } else if (type === \"text\" && checkExisty(text)) {\n element = document.createTextNode(String(text));\n } else {\n element = CE(\"e\");\n }\n wDomChildrenToDom(children, element);\n updateProps$1(props, element);\n wDom.el = element;\n addMountedQueue(wDom);\n if (tag === \"svg\") {\n xmlnsRef.value = \"\";\n }\n return element;\n};\nconst wDomChildrenToDom = (children, parentElement) => {\n const elementChildren = children.reduce(\n (acc, childItem) => {\n if (childItem.type) {\n acc.appendChild(wDomToDom(childItem));\n }\n return acc;\n },\n DF()\n );\n if (parentElement && elementChildren.hasChildNodes()) {\n parentElement.appendChild(elementChildren);\n }\n};\nconst updateEvent = (element, eventKey, newEventHandler, oldEventHandler) => {\n const eventName = getEventName(eventKey);\n if (oldEventHandler !== newEventHandler) {\n if (oldEventHandler) {\n element.removeEventListener(eventName, oldEventHandler);\n }\n if (newEventHandler) {\n element.addEventListener(eventName, newEventHandler);\n }\n }\n};\nconst updateStyle = (style, oldStyle, element) => {\n const originalStyle = { ...oldStyle };\n const elementStyle = element == null ? void 0 : element.style;\n if (elementStyle) {\n entries(style).forEach(([styleKey, dataValue]) => {\n elementStyle[styleKey] = dataValue;\n delete originalStyle[styleKey];\n });\n entries(originalStyle).forEach(\n ([styleKey]) => elementStyle[styleKey] = \"\"\n );\n }\n};\nconst findRealParentElement = (vDom) => {\n const isVirtualType = checkVirtualType(vDom.type);\n if (vDom.isRoot && isVirtualType) {\n return vDom.wrapElement;\n }\n if (!isVirtualType) {\n return vDom.el;\n }\n return findRealParentElement(getParent(vDom));\n};\nconst makeNewWDomTree = (newWDom, originalWDom) => remakeNewWDom(\n newWDom,\n checkSameWDomWithOriginal[getWDomType(newWDom)](newWDom, originalWDom),\n originalWDom\n);\nconst remakeNewWDom = (newWDom, isSameType, originalWDom) => {\n const remakeWDom = generalize(newWDom, isSameType, originalWDom);\n const param = [\n remakeWDom,\n isSameType,\n originalWDom\n ];\n const needRerender = addReRenderTypeProperty(...param);\n remakeWDom.children = remakeChildrenForDiff(...param);\n remakeWDom.needRerender = needRerender;\n inheritPropForRender(remakeWDom, originalWDom, needRerender);\n if (originalWDom) {\n delete originalWDom.children;\n }\n return remakeWDom;\n};\nconst inheritPropForRender = (remakeWDom, originalWDom, needRerender) => {\n if (needRerender !== \"A\" && originalWDom) {\n remakeWDom.el = originalWDom.el;\n }\n if (needRerender && [\"D\", \"R\", \"SR\"].includes(needRerender)) {\n if (originalWDom == null ? void 0 : originalWDom.compKey) {\n runUnmountQueueFromWDom(originalWDom);\n recursiveRemoveEvent(originalWDom);\n }\n remakeWDom.oldChildren = originalWDom == null ? void 0 : originalWDom.children;\n }\n remakeWDom.oldProps = originalWDom == null ? void 0 : originalWDom.props;\n};\nconst addReRenderTypeProperty = (newWDom, isSameType, originalWDom) => {\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 == null ? void 0 : originalParentWDom.type);\n const key = getKey(newWDom);\n const isKeyCheckedWDom = origParentType === \"loop\" && checkExisty(key);\n const isSameText = newWDom.type === \"text\" && isSameType && newWDom.text === (originalWDom == null ? void 0 : originalWDom.text);\n let result;\n if (isEmptyElement) {\n result = \"D\";\n } else if (isSameText) {\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 if (newWDom.type === \"loop\" && result === \"U\" && originalWDom && chkDiffLoopOrder(newWDom, originalWDom)) {\n result = \"CNSU\";\n }\n return result;\n};\nconst chkDiffLoopOrder = (newWDom, originalWDom) => {\n const origChildren = [...(originalWDom == null ? void 0 : originalWDom.children) || []];\n const newChildren = [...(newWDom == null ? void 0 : newWDom.children) || []].filter(\n (item) => origChildren.find((newItem) => getKey(item) === getKey(newItem))\n );\n const filteredChildren = origChildren.filter(\n (item) => newChildren.find((newItem) => getKey(item) === getKey(newItem))\n );\n let isSame = filteredChildren.length === newChildren.length;\n if (isSame) {\n isSame = filteredChildren.every(\n (item, index) => getKey(item) === getKey(newChildren[index])\n );\n }\n return isSame;\n};\nconst updateProps = (props, infoProps) => {\n if (props && infoProps !== props) {\n keys(props).forEach((key) => delete props[key]);\n entries(infoProps || {}).forEach(([key, value]) => props[key] = value);\n }\n};\nconst updateChildren = (children, infoChidren) => {\n if (children && infoChidren !== children) {\n children.splice(0, children.length);\n if (infoChidren) {\n infoChidren.forEach((childrenItem) => children.push(childrenItem));\n }\n }\n};\nconst runUpdate = (vDom, infoVdom) => {\n const { compProps: props, compChild: children } = vDom;\n const { props: infoProps, children: infoChidren } = infoVdom;\n if (props) {\n updateProps(props, infoProps);\n }\n if (children) {\n updateChildren(children, infoChidren);\n }\n const newVDom = vDom.reRender && vDom.reRender();\n return newVDom;\n};\nconst generalize = (newWDom, isSameType, originalWDom) => {\n if (checkCustemComponentFunction(newWDom)) {\n return isSameType && originalWDom ? runUpdate(originalWDom, newWDom) : newWDom.resolve();\n }\n return newWDom;\n};\nconst remakeChildrenForDiff = (newWDom, isSameType, originalWDom) => isSameType && originalWDom ? remakeChildrenForUpdate(newWDom, originalWDom) : remakeChildrenForAdd(newWDom);\nconst remakeChildrenForAdd = (newWDom) => (newWDom.children || []).map(\n (item) => assign(makeNewWDomTree(item), { getParent: () => newWDom })\n);\nconst remakeChildrenForUpdate = (newWDom, originalWDom) => newWDom.type === \"loop\" && checkExisty(getKey((newWDom.children || [])[0])) ? remakeChildrenForLoopUpdate(newWDom, originalWDom) : (newWDom.children || []).map(\n (item, index) => assign(makeNewWDomTree(item, (originalWDom.children || [])[index]), {\n getParent: () => newWDom\n })\n);\nconst remakeChildrenForLoopUpdate = (newWDom, originalWDom) => {\n const [remakedChildren, unUsedChildren] = diffLoopChildren(\n newWDom,\n originalWDom\n );\n unUsedChildren.map((unusedItem) => {\n runUnmountQueueFromWDom(unusedItem);\n recursiveRemoveEvent(unusedItem);\n typeDelete(unusedItem);\n });\n return remakedChildren;\n};\nconst diffLoopChildren = (newWDom, originalWDom) => {\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 if (originalItem) {\n originalChildren.splice(originalChildren.indexOf(originalItem), 1);\n }\n childItem.getParent = () => newWDom;\n return childItem;\n });\n return [remakedChildren, originalChildren];\n};\nconst findSameKeyOriginalItem = (item, originalChildren) => originalChildren.find(\n (orignalChildItem) => getKey(orignalChildItem) === getKey(item)\n);\nlet redrawQueue = [];\nlet redrawQueueTimeout = false;\nconst setRedrawAction = (compKey, exec) => {\n componentRef.get(compKey).up = () => {\n redrawQueue.push({\n compKey,\n exec\n });\n if (!redrawQueueTimeout) {\n redrawQueueTimeout = true;\n queueMicrotask(execRedrawQueue);\n }\n };\n};\nconst componentUpdate = (compKey) => () => {\n var _a;\n const up = (_a = componentRef.get(compKey)) == null ? void 0 : _a.up;\n let result = false;\n if (up) {\n up();\n result = true;\n }\n return result;\n};\nconst recursiveGetChildKeys = (wDom, result) => {\n (wDom.children || []).forEach((item) => {\n const childComKey = item.compKey;\n if (childComKey) {\n result.push(childComKey);\n }\n recursiveGetChildKeys(item, result);\n });\n};\nconst execRedrawQueue = () => {\n let childItemList = [];\n redrawQueue.forEach((item) => {\n var _a, _b;\n const childVd = (_b = (_a = componentRef.get(item.compKey)) == null ? void 0 : _a.vd) == null ? void 0 : _b.value;\n if (childVd) {\n recursiveGetChildKeys(childVd, childItemList);\n }\n });\n const addedKey = [];\n const result = redrawQueue.reduce((acc, item) => {\n const { compKey } = item;\n if (childItemList.includes(compKey) || addedKey.includes(compKey)) {\n return acc;\n }\n addedKey.push(compKey);\n acc.push(item);\n return acc;\n }, []);\n while (result.length) {\n const action = result.shift();\n if (action) {\n action.exec();\n }\n }\n redrawQueue = [];\n redrawQueueTimeout = false;\n};\nconst updateCallback = (effectAction, dependencies = () => []) => {\n const updateReqs = componentRef.get(getComponentKey()).upR;\n updateReqs.push(() => useUpdated(effectAction, dependencies));\n useUpdated(effectAction, dependencies);\n};\nconst runUpdateCallback = () => {\n var _a;\n const updateReqs = (_a = componentRef.get(getComponentKey())) == null ? void 0 : _a.upR;\n if (updateReqs == null ? void 0 : updateReqs.length) {\n updateReqs.forEach((callback) => callback());\n }\n};\nconst Fragment = (_props, ...children) => ({\n type: \"fragment\",\n children\n});\nconst h = (tag, props, ...children) => {\n const nodeParentPointer = { value: void 0 };\n const newProps = props || {};\n const newChildren = remakeChildren(nodeParentPointer, children);\n const node = makeNode(tag, newProps, newChildren);\n if (!checkCustemComponentFunction(node)) {\n nodeParentPointer.value = node;\n }\n return node;\n};\nconst mount = (component) => (_props, _children) => component;\nconst reRenderCustomComponent = (tag, props, children, originalWDom) => {\n var _a;\n needDiffRef.value = true;\n const newWDom = makeWDomResolver(tag, props, children);\n const newWDomTree = makeNewWDomTree(newWDom, originalWDom);\n const { isRoot, getParent: getParent2, wrapElement, afterElement } = originalWDom;\n newWDomTree.getParent = getParent2;\n if (!isRoot && getParent2) {\n const brothers = ((_a = getParent2()) == null ? void 0 : _a.children) || [];\n const index = brothers.indexOf(originalWDom);\n brothers.splice(index, 1, newWDomTree);\n } else {\n newWDomTree.isRoot = true;\n newWDomTree.wrapElement = wrapElement;\n newWDomTree.afterElement = afterElement;\n }\n needDiffRef.value = false;\n wDomUpdate(newWDomTree);\n};\nconst makeWDomResolver = (tag, props, children) => {\n const tagName = tag.name;\n const ctor = tag;\n const resolve = (compKey = props) => {\n initMountHookState(compKey);\n const component = tag(props, children);\n const componentMaker = component(componentUpdate(compKey), props, children);\n const customNode = makeCustomNode(\n componentMaker,\n compKey,\n tag,\n props,\n children\n );\n const originalWDom = customNode;\n setRedrawAction(\n compKey,\n () => reRenderCustomComponent(tag, props, children, originalWDom)\n );\n getComponentSubInfo(compKey, \"vd\").value = customNode;\n return customNode;\n };\n return { tagName, ctor, props, children, resolve };\n};\nconst makeCustomNode = (componentMaker, compKey, tag, props, children) => {\n const customNode = componentMaker(props);\n if (customNode.reRender) {\n throw new Error(\n 'Avoid the case where the first element of a component is a component. Instead of \"mount(()=>()=><Component />)\" replace it with something like \"mount(()=>()=><Fragment><Component /></Fragment>)\".'\n );\n }\n addComponentProps(\n customNode,\n compKey,\n tag,\n props,\n children,\n makeReRender(componentMaker, compKey, tag, props, children)\n );\n return customNode;\n};\nconst makeReRender = (componentMaker, compKey, tag, props, children) => {\n const reRender = () => wDomMaker(componentMaker, compKey, tag, props, children, reRender);\n return reRender;\n};\nconst wDomMaker = (componentMaker, compKey, tag, props, children, reRender) => {\n initUpdateHookState(compKey);\n runUpdateCallback();\n const originalWDom = componentMaker(props);\n setRedrawAction(\n compKey,\n () => reRenderCustomComponent(tag, props, children, originalWDom)\n );\n addComponentProps(originalWDom, compKey, tag, props, children, reRender);\n getComponentSubInfo(compKey, \"vd\").value = originalWDom;\n return originalWDom;\n};\nconst addComponentProps = (wDom, compKey, tag, props, children, reRender) => {\n assign(wDom, {\n compProps: props,\n compChild: children,\n ctor: tag,\n tagName: tag.name,\n compKey,\n reRender\n });\n};\nconst makeNode = (tag, props, children) => {\n if (checkFragmentFunction(tag)) {\n return Fragment(props, ...children);\n } else if (checkCustemComponentFunction(tag)) {\n const componetMakeResolver = makeWDomResolver(tag, props, children);\n return needDiffRef.value ? componetMakeResolver : componetMakeResolver.resolve();\n }\n return {\n type: \"element\",\n tag,\n props,\n children\n };\n};\nconst remakeChildren = (nodeParentPointer, children) => children.map(\n (item) => assign(makeChildrenItem(item), { getParent: () => nodeParentPointer.value })\n);\nconst makeChildrenItem = (item) => {\n if (item === null || item === void 0 || item === false) {\n return { type: null };\n } else if (Array.isArray(item)) {\n const nodeParentPointer = { value: void 0 };\n const children = remakeChildren(nodeParentPointer, item);\n const node = {\n type: \"loop\",\n children\n };\n nodeParentPointer.value = node;\n return node;\n } else if (typeof item === \"string\" || typeof item === \"number\") {\n return { type: \"text\", text: item };\n }\n return item;\n};\nconst ref = (initValue) => ({ value: initValue });\nconst nextTick = () => Promise.resolve();\nexport {\n Fragment,\n h,\n mount,\n mountCallback,\n nextTick,\n ref,\n render,\n updateCallback\n};\n//# sourceMappingURL=lithent.mjs.map\n","import { mountCallback as a, updateCallback as p, nextTick as h, render as i } from \"lithent\";\nconst v = (r, t) => {\n let e = r;\n return {\n get value() {\n return e;\n },\n get v() {\n return e;\n },\n set value(n) {\n e = n, t();\n },\n set v(n) {\n e = n, t();\n }\n };\n}, m = (r) => {\n let t = r;\n return {\n get value() {\n return t();\n },\n get v() {\n return t();\n },\n set value(e) {\n throw new Error(\"You can't change 'computed'\");\n },\n set v(e) {\n throw new Error(\"You can't change 'computed'\");\n }\n };\n}, d = (r, t = () => {\n}, e = () => []) => {\n a(() => (r(), t)), p(() => (t && t(), r), e);\n}, l = /* @__PURE__ */ new Map(), u = {}, x = (r) => {\n const t = Symbol();\n return l.set(t, r), (e) => (e && (u[t] ?? (u[t] = []), u[t].push(e)), f(t));\n}, f = (r) => new Proxy(l.get(r), {\n get(t, e) {\n return t[e];\n },\n set(t, e, n) {\n t[e] = n;\n const c = u[r], s = [];\n return c.forEach((o) => {\n o() || s.push(o);\n }), s.forEach(\n (o) => c.splice(c.indexOf(o), 1)\n ), !0;\n }\n}), E = (r, t, e) => {\n let n = () => {\n };\n return h().then(() => {\n n = i(r(), t, e);\n }), () => n();\n};\nexport {\n m as computed,\n d as effect,\n E as nextTickRender,\n v as state,\n x as store\n};\n//# sourceMappingURL=lithentHelper.mjs.map\n","// example.jsx\nimport {\n h,\n Fragment,\n render,\n ref,\n mountCallback,\n updateCallback,\n mount,\n} from 'lithent';\nimport { state, computed, effect, store } from 'lithent/helper';\n\n// This is the \"mount\" function.\n// This function is only executed on mount, and on update, only updates `props` and then executes the internal return function.\n// childen is passed as the second argument.\nconst ChildComponent = mount<{ parentValue: number }>(\n (renew, props, children) => {\n // The value is used as a \"getter\" to make it easy to get and write to in the higher-order functions it returns\n const count = state<number>(1, renew);\n const text = state<string>(\n '\"destructuring\" the \"props\" value directly from the mount function will cause referencing issues, so if you want to use it, you need to \"destructuring\" it from the internal function (updater).',\n renew\n );\n const getParentValue = () => props.parentValue;\n const parentValueFromMount = props.parentValue;\n const summ = computed<number>(\n () => count.v + notRefValue + props.parentValue\n );\n\n const localStore = store<{ text: string; count: number }>({\n text: 's',\n count: 0,\n })(renew);\n /*\n // To share a store, make it externally and use `asign`.\n const asignStore = store<{ text: string; count: number }>({ text: 's', count: 0 });\n\n const sharedStore = asignStore(nenew);\n */\n\n // Even if you don't use a ref, the private value is always maintained as a regular variable.\n let notRefValue = props.parentValue;\n\n // Ref is only used to reference the DOM.\n const domRef = ref(null);\n\n const increase = () => {\n count.v = count.v + 1;\n notRefValue += 1;\n };\n\n const handleInputChane = (event: InputEvent) => {\n text.v = (event.target as HTMLInputElement).value;\n };\n\n const localStoreUpdate = () => {\n localStore.count += 1;\n localStore.text += '1';\n };\n\n const handleMounted = () => {\n console.log('MOUNTED', domRef);\n\n return () => console.log('UNMOUNT');\n };\n const handleUpdated = () => {\n console.log('UPDATE - parentValue');\n\n return () => console.log('UPDATED');\n };\n\n mountCallback(handleMounted);\n updateCallback(handleUpdated, () => [props.parentValue]); // Only Defs Updated (using a closure to update a value)\n\n // Behaves like `react`'s `useEffect`\n effect(\n () => console.log('INJECT'),\n () => console.log('CLEAN_UP'),\n () => [count.v]\n );\n\n // Wrap in a function and return (using a closure to hold the value)\n // This is the \"update\" function.\n return ({ parentValue }) => (\n <Fragment>\n {/* Note that the event is onInput (we use the native event name to avoid confusion). */}\n <div>\n <textarea\n value={text.v}\n onInput={handleInputChane}\n style={{ width: '300px', height: '100px' }}\n />\n </div>\n <div>{text.v}</div>\n <div>\n <div style={{ color: 'blue' }}>\n parentValueFromRef: {props.parentValue} (working)\n </div>\n <div style={{ color: 'blue' }}>\n parentValueFromFunction: {getParentValue()} (working)\n </div>\n <div style={{ color: 'blue' }}>\n parentValueFromUpdaterDestructuring: {parentValue} (working)\n </div>\n <div style={{ color: 'red' }}>\n parentValueFromMounterDestructuring: {parentValueFromMount} (not\n working)\n </div>\n </div>\n <div>\n <div ref={domRef}>count: {count.v}</div>\n <div>sum: {count.v + notRefValue + props.parentValue}</div>\n <div>sum(computed): {summ.v}</div>\n {/* It doesn't pull it out from under the reference, it uses the value directly, so you can just use it. */}\n <div>notRefValue: {notRefValue}</div>\n <div>localStore(text): {localStore.text}</div>\n <div>localStore(count): {localStore.count}</div>\n </div>\n <button onClick={increase}>Increase</button>\n <button onClick={localStoreUpdate}>localStoreUpdate</button>\n {children}\n </Fragment>\n );\n }\n);\n\nconst Root = mount(renew => {\n const parentNumber = state<number>(7, renew);\n\n const increaseParent = () => {\n parentNumber.v = parentNumber.v + 1;\n };\n\n const decreaseParent = () => {\n parentNumber.v = parentNumber.v - 1;\n };\n\n return () => (\n <Fragment>\n <ChildComponent parentValue={parentNumber.v}>\n <button onClick={increaseParent}>Increase - Parent</button>\n </ChildComponent>\n <button onClick={decreaseParent}>Decrease - Parent</button>\n </Fragment>\n );\n});\nconst root = <Root />;\n\nrender(root, document.getElementById('root'));\n"],"names":["checkPlainWDomType","wDom","checkPlainType","typeName","checkSameCustomComponent","newWDom","originalWDom","checkSameFragment","_a","_b","checkSameTagElement","checkNormalTypeElement","checkExisty","getKey","target","checkVirtualType","type","checkCustemComponentFunction","checkFragmentFunction","Fragment","checkEmptyElement","value","checkStyleData","dataKey","dataValue","checkRefData","checkOptionElement","element","checkTextareaElement","checkCheckableElement","getWDomType","result","checkSameWDomWithOriginal","getParent","vDom","entries","keys","assign","xmlnsRef","compKeyRef","needDiffRef","componentRef","setComponetRef","compKey","getComponentKey","getComponentSubInfo","subKey","initUpdateHookState","initMountHookState","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","Dom","wDomToDom","recursiveRemoveEvent","rootDelete","wDomUpdate","newWDomTree","needRerender","typeAdd","typeDelete","typeReplace","typeUpdate","typeSortedReplace","typeSortedUpdate","removeEvent","childItem","deleteRealDom","findRealParentElement","parent","findChildWithRemoveElement","newElement","getElementFromFragment","parentWDom","parentEl","nextEl","startFindNextBrotherElement","acc","brothers","nextIndex","candidiateBrothers","finedNextEl","findChildFragmentNextElement","parentType","targetEl","bItem","el","isFragment","orignalElement","parentElement","oldProps","updateText","props","updateProps$1","originalProps","chkRemoveProp","updateStyle","updateEvent","makeAttrDataValue","setAttr","allowSetAttr","tag","text","children","isVirtualType","wDomChildrenToDom","elementChildren","newEventHandler","oldEventHandler","eventName","style","oldStyle","originalStyle","elementStyle","styleKey","makeNewWDomTree","remakeNewWDom","isSameType","remakeWDom","generalize","param","addReRenderTypeProperty","remakeChildrenForDiff","inheritPropForRender","existOriginalWDom","isEmptyElement","isRoot","originalParentWDom","origParentType","key","isKeyCheckedWDom","isSameText","chkDiffLoopOrder","origChildren","newChildren","newItem","filteredChildren","isSame","updateProps","infoProps","updateChildren","infoChidren","childrenItem","runUpdate","infoVdom","remakeChildrenForUpdate","remakeChildrenForAdd","remakeChildrenForLoopUpdate","remakedChildren","unUsedChildren","diffLoopChildren","unusedItem","originalChildren","originalItem","findSameKeyOriginalItem","orignalChildItem","redrawQueue","redrawQueueTimeout","setRedrawAction","exec","execRedrawQueue","componentUpdate","up","recursiveGetChildKeys","childComKey","childItemList","childVd","addedKey","action","updateCallback","runUpdateCallback","updateReqs","_props","h","nodeParentPointer","newProps","remakeChildren","node","makeNode","mount","_children","reRenderCustomComponent","makeWDomResolver","getParent2","componentMaker","customNode","makeCustomNode","addComponentProps","makeReRender","reRender","wDomMaker","componetMakeResolver","makeChildrenItem","ref","initValue","v","r","e","n","m","d","a","p","l","u","x","f","c","s","o","ChildComponent","renew","count","state","getParentValue","parentValueFromMount","summ","computed","notRefValue","localStore","store","domRef","increase","handleInputChane","event","localStoreUpdate","handleMounted","handleUpdated","parentValue","Root","parentNumber","increaseParent","decreaseParent","root"],"mappings":"ssBAAA,MAAMA,EAAsBC,GAAS,OAAOA,GAAS,UAAY,EAAE,YAAaA,GAC1EC,EAAiB,CAACD,EAAME,IAAaH,EAAmBC,CAAI,GAAKA,EAAK,OAASE,EAC/EC,GAA2B,CAACC,EAASC,IAAiB,SAAUD,EAAUA,EAAQ,QAAUC,GAAgB,KAAO,OAASA,EAAa,MAAQD,KAAaC,GAAgB,KAAO,OAASA,EAAa,MAC3MC,GAAoB,CAACF,EAASC,IAAiB,CACnD,IAAIE,EAAIC,EACR,OAAOT,EAAmBK,CAAO,IAAMC,GAAgB,KAAO,OAASA,EAAa,QAAU,cAAgBE,EAAKF,GAAgB,KAAO,OAASA,EAAa,WAAa,KAAO,OAASE,EAAG,YA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