lithent 0.36.2 → 0.37.0
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 +51 -1
- package/dist/lithent.mjs +36 -25
- package/dist/lithent.mjs.map +1 -1
- package/dist/lithent.umd.js +1 -1
- package/dist/lithent.umd.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/predicator.d.ts +1 -1
- package/dist/utils/universalRef.d.ts +3 -0
- package/dist/wDom.d.ts +0 -1
- package/examples/dist/assets/index.b6b5ca4e.js +2 -0
- package/examples/dist/assets/index.b6b5ca4e.js.map +1 -0
- package/examples/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/diff.ts +5 -12
- package/src/examples/svg.tsx +44 -0
- package/src/render.ts +36 -21
- package/src/utils/index.ts +3 -0
- package/src/utils/predicator.ts +3 -2
- package/src/utils/universalRef.ts +1 -0
- package/src/wDom.ts +5 -7
- package/examples/dist/assets/index.f15c0062.js +0 -2
- package/examples/dist/assets/index.f15c0062.js.map +0 -1
package/dist/lithent.umd.js.map
CHANGED
|
@@ -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/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) => newWDom.constructor === originalWDom?.constructor;\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 (originalWDom?.children?.length === newWDom?.children?.length ||\n newWDom.type === 'loop');\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 { value: HTMLElement | 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 checkNormalAttribute = (\n dataValue: unknown\n): dataValue is number | string =>\n typeof dataValue === 'number' || typeof dataValue === 'string';\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, TagFunctionResolver, Props } from '@/types';\n\nexport const getParent = (vDom: WDom) => {\n const parentVDom = vDom.getParent && vDom.getParent();\n\n return parentVDom as WDom;\n};\n\nexport const reRender = (vDom: WDom, infoVdom: TagFunctionResolver) => {\n const { componentProps: props, componentChildren: 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\nexport const getEventName = (eventKey: string) =>\n eventKey.replace(/^on(.*)/, (_match, p1) => p1.toLowerCase());\n\nconst updateProps = (props: Props, infoProps: Props) => {\n if (props && infoProps !== props) {\n Object.keys(props).forEach(key => delete props[key]);\n\n Object.entries(infoProps || {}).forEach(\n ([key, value]) => (props[key] = value)\n );\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","import { ComponentRef, ComponentSubKey, Props, WDom } from '@/types';\n\ntype RedrawQueueList = {\n componentKey: Props;\n exec: () => void;\n}[];\n\n/**\n * Common\n */\nexport const componentKeyRef: { value: Props } = { value: {} };\nexport const needDiffRef: { value: boolean } = { value: false };\nexport const componentRef: ComponentRef = new WeakMap();\nexport const redrawQueue: {\n value: { componentKey: Props; exec: () => void }[];\n} = { value: [] };\nexport const redrawQueueTimeout: { value: null | number } = { value: null };\nexport const componentRender = (componentKey: Props) => () => {\n const up = componentRef.get(componentKey)?.up;\n let result = false;\n if (up) {\n up();\n result = true;\n }\n\n return result;\n};\n\nconst setComponetRef = (componentKey: Props) => {\n componentRef.set(componentKey, {\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 = () => componentKeyRef.value;\n\nexport const getComponentSubInfo = (\n componentKey: Props,\n subKey: ComponentSubKey\n) => componentRef.get(componentKey)![subKey];\n\nexport const setRedrawAction = (componentKey: Props, exec: () => void) => {\n componentRef.get(componentKey)!.up = () => {\n redrawQueue.value.push({\n componentKey,\n exec,\n });\n if (!redrawQueueTimeout.value) {\n redrawQueueTimeout.value = setTimeout(execRedrawQueue);\n }\n };\n};\n\nexport const initUpdateHookState = (componentKey: Props) =>\n (componentKeyRef.value = componentKey);\n\nexport const initMountHookState = (componentKey: Props) => {\n componentKeyRef.value = componentKey;\n setComponetRef(componentKey);\n};\n\nconst recursiveGetChildKeys = (wDom: WDom, result: Props[]) => {\n (wDom.children || []).forEach(item => {\n const childComKey = item.componentKey;\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.value.forEach(item => {\n const childVd = componentRef.get(item.componentKey)?.vd?.value;\n if (childVd) {\n recursiveGetChildKeys(childVd, childItemList);\n }\n });\n\n const addedKey: Props[] = [];\n const result = redrawQueue.value.reduce((acc, item) => {\n const { componentKey } = item;\n\n if (\n childItemList.includes(componentKey) ||\n addedKey.includes(componentKey)\n ) {\n return acc;\n }\n\n addedKey.push(componentKey);\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","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 { componentKey } = newWDom;\n\n if (componentKey) {\n removeItem(componentKey);\n }\n recursiveRunUnmount(newWDom);\n};\n\nconst recursiveRunUnmount = (wDom: WDom) => {\n (wDom.children || []).forEach(item => {\n const childComKey = item.componentKey;\n if (childComKey) {\n runUnmountQueueFromWDom(item);\n } else {\n recursiveRunUnmount(item);\n }\n });\n};\n\nconst removeItem = (componentKey: Props) => {\n const subInfo = componentRef.get(componentKey);\n if (subInfo) {\n subInfo!.umts.forEach(effect => effect());\n subInfo!.umts = [];\n componentRef.delete(componentKey);\n }\n};\n","import { WDom } from '@/types';\nimport {\n componentKeyRef,\n componentRef,\n getComponentKey,\n} from '@/utils/universalRef';\n\nimport { unmount } from '@/hook/unmount';\n\nexport const mountCallback = (effectAction: () => void) => {\n const mts = componentRef.get(getComponentKey())!.mts;\n\n mts.push(effectAction);\n};\n\nexport const runMountedQueueFromWDom = (newWDom: WDom) => {\n const { componentKey } = newWDom;\n\n if (componentKey) {\n const component = componentRef.get(componentKey);\n const queue = component?.mts;\n const sequence = component?.upS;\n\n componentKeyRef.value = componentKey;\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 componentKeyRef,\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 { componentKey } = newWDom;\n\n if (componentKey) {\n const component = componentRef.get(componentKey);\n const queue = component?.upCB;\n const sequence = component?.upS;\n\n componentKeyRef.value = componentKey;\n\n if (sequence) {\n sequence.value = 0;\n }\n\n if (newWDom.constructor && queue) {\n component.upCB = [];\n queue.forEach((effect: Function) => effect());\n }\n }\n};\n\nconst checkNeedPushQueue = (originalDefs: unknown[], newDefs: unknown[]) =>\n !originalDefs.length && !originalDefs.length\n ? true\n : originalDefs.some((def, index) => def !== newDefs[index]);\n","import { WDom, Props } from '@/types';\nimport {\n checkStyleData,\n checkRefData,\n checkNormalAttribute,\n checkExisty,\n checkOptionElement,\n checkTextareaElement,\n checkCheckableElement,\n} from '@/utils/predicator';\n\nimport { componentRef } from '@/utils/universalRef';\nimport { runUnmountQueueFromWDom } from '@/hook/unmount';\nimport { runMountedQueueFromWDom } from '@/hook/mountCallback';\nimport { runUpdatedQueueFromWDom } from '@/hook/useUpdate';\nimport { getParent, getEventName } from '@/utils';\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 return () => {\n if (wDom.componentProps) {\n const component = componentRef.get(wDom.componentProps)?.vd.value;\n if (component) {\n runUnmountQueueFromWDom(component);\n recursiveRemoveEvent(component);\n rootDelete(component);\n }\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 SR: typeSortedReplace,\n SU: typeSortedUpdate,\n })[needRerender](newWDomTree);\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\nconst 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 typeDelete(newWDom);\n typeAdd(newWDom, newWDom.el);\n};\n\nconst typeAdd = (\n newWDom: WDom,\n newElement?: HTMLElement | DocumentFragment | Text\n) => {\n if (!newElement) {\n newElement = wDomToDom(newWDom);\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 = isLoop\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 }\n\n runMountedQueueFromWDom(newWDom);\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 && ['fragment', 'loop'].includes(parentType)) {\n return startFindNextBrotherElement(parentWDom, getParent(parentWDom));\n } else if (parentWDom.isRoot && parentWDom.afterElement) {\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 && ['fragment', 'loop'].includes(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 }\n }\n\n runMountedQueueFromWDom(newWDom);\n};\n\nconst removeEvent = (\n oldProps: Props,\n element: HTMLElement | DocumentFragment | Text\n) => {\n Object.entries(oldProps || {}).forEach(\n ([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};\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 | DocumentFragment | Text,\n oldProps?: Props\n) => {\n const originalProps = { ...oldProps };\n\n Object.entries(props || {}).forEach(\n ([dataKey, dataValue]: [string, unknown]) => {\n if (dataKey === 'key') {\n // Do nothing\n } else if (\n dataKey === 'innerHTML' &&\n element &&\n typeof dataValue === 'string'\n ) {\n (element as HTMLElement).innerHTML = dataValue;\n } else if (checkStyleData(dataKey, dataValue)) {\n updateStyle(\n dataValue,\n checkStyleData(dataKey, originalProps.style)\n ? originalProps.style\n : {},\n element\n );\n } else if (checkRefData(dataKey, dataValue)) {\n dataValue.value = element;\n } else if (dataKey.match(/^on/)) {\n updateEvent(\n element as HTMLElement,\n dataKey,\n dataValue as (e: Event) => void,\n originalProps[dataKey] as (e: Event) => void\n );\n } else if (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 (checkNormalAttribute(dataValue)) {\n (element as HTMLElement).setAttribute(dataKey, String(dataValue));\n }\n\n delete originalProps[dataKey];\n }\n );\n\n Object.keys(originalProps).forEach(dataKey =>\n (element as HTMLElement).removeAttribute(dataKey)\n );\n};\n\nconst wDomToDom = (wDom: WDom) => {\n let element;\n const { type, tag, text, props, children = [] } = wDom;\n const isVirtualType = type === 'fragment' || type === 'loop';\n\n if (isVirtualType) {\n element = new DocumentFragment();\n } else if (type === 'element' && tag) {\n element = document.createElement(tag);\n } else if (type === 'text' && checkExisty(text)) {\n element = document.createTextNode(String(text));\n } else {\n element = document.createElement('e');\n }\n\n wDomChildrenToDom(children, element);\n updateProps(props, element);\n\n wDom.el = element;\n\n runMountedQueueFromWDom(wDom);\n\n return element;\n};\n\nconst wDomChildrenToDom = (\n children: WDom[],\n parentElement?: HTMLElement | 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 new DocumentFragment()\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 | DocumentFragment | Text\n) => {\n const originalStyle = { ...oldStyle };\n const elementStyle = (element as HTMLElement)?.style;\n\n if (elementStyle) {\n Object.entries(style).forEach(([styleKey, dataValue]) => {\n (elementStyle as any)[styleKey] = dataValue;\n delete originalStyle[styleKey];\n });\n\n Object.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 = vDom.type === 'fragment' || vDom.type === 'loop';\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 } from '@/types';\nimport { checkCustemComponentFunction } from '@/utils/predicator';\nimport { getParent, reRender } from '@/utils';\nimport { recursiveRemoveEvent } from '@/render';\nimport {\n checkEmptyElement,\n checkSameWDomWithOriginal,\n getWDomType,\n checkExisty,\n} from '@/utils/predicator';\n\nimport { runUnmountQueueFromWDom } from '@/hook/unmount';\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\n remakeWDom.children = remakeChildrenForDiff(\n remakeWDom,\n isSameType,\n originalWDom\n );\n\n const needRerender = addReRenderTypeProperty(\n remakeWDom,\n isSameType,\n originalWDom\n );\n\n remakeWDom.needRerender = needRerender;\n\n if (needRerender !== 'A' && originalWDom) {\n remakeWDom.el = originalWDom.el;\n }\n\n if (\n needRerender &&\n ['D', 'R', 'SR'].includes(needRerender) &&\n originalWDom?.componentKey\n ) {\n runUnmountQueueFromWDom(originalWDom);\n recursiveRemoveEvent(originalWDom);\n remakeWDom.oldChildren = originalWDom.children;\n }\n\n remakeWDom.oldProps = originalWDom?.props;\n\n return remakeWDom;\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.getParent;\n const parentType = !isRoot && getParent(newWDom).type;\n const key = getKey(newWDom);\n const isKeyCheckedWDom = parentType === '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 return result;\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 ? reRender(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 const childItem = makeNewWDomTree(item);\n\n childItem.getParent = () => newWDom;\n\n return childItem;\n });\n\nconst remakeChildrenForUpdate = (newWDom: WDom, originalWDom: WDom) => {\n if (\n newWDom.type === 'loop' &&\n checkExisty(getKey((newWDom.children || [])[0]))\n ) {\n return remakeChildrenForLoopUpdate(newWDom, originalWDom);\n }\n\n return (newWDom.children || []).map((item: WDom, index: number) => {\n const childItem = makeNewWDomTree(\n item,\n (originalWDom.children || [])[index]\n );\n\n childItem.getParent = () => newWDom;\n\n return childItem;\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 const el = unusedItem.el;\n\n if (el?.parentNode) {\n el.parentNode.removeChild(el);\n }\n });\n\n return remakedChildren;\n};\n\nconst diffLoopChildren = (newWDom: WDom, originalWDom: WDom) => {\n const newChildren = [...(newWDom.children || [])];\n const originalChildren = [...(originalWDom.children || [])];\n\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 {\n remakedChildren,\n unUsedChildren: originalChildren,\n };\n};\n\nconst findSameKeyOriginalItem = (item: WDom, originalChildren: WDom[]) => {\n const key = getKey(item);\n\n return originalChildren.find(\n orignalChildItem => getKey(orignalChildItem) === key\n );\n};\n\nconst getKey = (target: WDom) =>\n target?.componentProps?.key ?? target?.props?.key;\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 setRedrawAction,\n needDiffRef,\n componentRender,\n getComponentSubInfo,\n} from '@/utils/universalRef';\nimport { runUpdateCallback } from '@/hook/updateCallback';\nimport {\n checkFragmentFunction,\n checkCustemComponentFunction,\n} from '@/utils/predicator';\n\nexport type Children = WDom[];\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 constructor = tag;\n // 리졸브는 컴포넌트를 새로 만든다.\n const resolve = (componentKey = props) => {\n initMountHookState(componentKey);\n\n const component = tag(props, children);\n const componentMaker = component(\n componentRender(componentKey),\n props,\n children\n );\n\n const customNode = makeCustomNode(\n componentMaker,\n componentKey,\n tag,\n props,\n children\n );\n\n const originalWDom = customNode;\n\n setRedrawAction(componentKey, () =>\n reRenderCustomComponent(tag, props, children, originalWDom)\n );\n\n (getComponentSubInfo(componentKey, 'vd') as { value: WDom }).value =\n customNode;\n\n return customNode;\n };\n\n return { tagName, constructor, props, children, resolve };\n};\n\nconst makeCustomNode = (\n componentMaker: (props: Props) => WDom,\n componentKey: Props,\n tag: TagFunction,\n props: Props,\n children: WDom[]\n) => {\n const customNode = componentMaker(props);\n const reRender = makeReRender(\n componentMaker,\n componentKey,\n tag,\n props,\n children\n );\n\n addComponentProps(customNode, componentKey, tag, props, children, reRender);\n\n return customNode;\n};\n\nconst makeReRender = (\n componentMaker: (props: Props) => WDom,\n componentKey: Props,\n tag: TagFunction,\n props: Props,\n children: WDom[]\n) => {\n const reRender = () =>\n wDomMaker(componentMaker, componentKey, tag, props, children, reRender);\n return reRender;\n};\n\nconst wDomMaker = (\n componentMaker: (props: Props) => WDom,\n componentKey: Props,\n tag: TagFunction,\n props: Props,\n children: WDom[],\n reRender: () => WDom\n) => {\n initUpdateHookState(componentKey);\n runUpdateCallback();\n\n const originalWDom = componentMaker(props);\n\n setRedrawAction(componentKey, () =>\n reRenderCustomComponent(tag, props, children, originalWDom)\n );\n\n addComponentProps(originalWDom, componentKey, tag, props, children, reRender);\n\n (getComponentSubInfo(componentKey, 'vd') as { value: WDom }).value =\n originalWDom;\n\n return originalWDom;\n};\n\nconst addComponentProps = (\n wDom: WDom,\n componentKey: Props,\n tag: TagFunction,\n props: Props,\n children: WDom[],\n reRender: () => WDom\n) => {\n Object.assign(wDom, {\n componentProps: props,\n componentChildren: children,\n constructor: tag,\n tagName: tag.name,\n componentKey,\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 const childItem = makeChildrenItem(item);\n\n childItem.getParent = () => nodeParentPointer.value;\n\n return childItem;\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 {\n componentRef,\n redrawQueue,\n redrawQueueTimeout,\n getComponentKey,\n} 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 redrawQueue.value = [];\n redrawQueueTimeout.value = null;\n};\n","export const ref = <T>(initValue: T) => ({ value: initValue });\n"],"names":["checkPlainWDomType","wDom","checkPlainType","typeName","type","checkNormalTypeElement","newWDom","originalWDom","_a","children","length","_b","checkCustemComponentFunction","target","checkFragmentFunction","Fragment","checkEmptyElement","checkExisty","value","checkStyleData","dataKey","dataValue","checkSameWDomWithOriginal","c","constructor","l","t","e","tag","f","et","getParent","vDom","getEventName","eventKey","replace","_match","p1","toLowerCase","updateProps","props","infoProps","Object","keys","forEach","key","entries","updateChildren","infoChidren","splice","childrenItem","push","componentKeyRef","needDiffRef","componentRef","WeakMap","redrawQueue","redrawQueueTimeout","getComponentKey","getComponentSubInfo","componentKey","subKey","get","setRedrawAction","exec","up","setTimeout","execRedrawQueue","initMountHookState","set","vd","upR","upS","upD","upCB","mts","umts","setComponetRef","recursiveGetChildKeys","result","item","childComKey","childItemList","childVd","addedKey","reduce","acc","includes","action","shift","runUnmountQueueFromWDom","removeItem","recursiveRunUnmount","subInfo","effect","delete","runMountedQueueFromWDom","component","queue","sequence","callback","effectAction","useUpdated","dependencies","def","checkNeedPushQueue","originalDefs","newDefs","some","index","wDomUpdate","newWDomTree","needRerender","A","typeAdd","D","typeDelete","R","typeReplace","U","typeUpdate","SR","typeSortedReplace","SU","typeSortedUpdate","recursiveRemoveEvent","el","removeEvent","childItem","rootDelete","deleteRealDom","wrapElement","oldProps","findRealParentElement","parent","nodeType","removeChild","findChildWithRemoveElement","oldChildren","newElement","wDomToDom","parentWDom","parentEl","nextEl","startFindNextBrotherElement","insertBefore","appendChild","brothers","nextIndex","indexOf","candidiateBrothers","slice","finedNextEl","findChildFragmentNextElement","parentType","isRoot","afterElement","targetEl","bItem","isFragment","orignalElement","parentElement","replaceChild","element","match","removeEventListener","String","runUpdatedQueueFromWDom","updateText","nodeValue","text","originalProps","innerHTML","updateStyle","style","checkRefData","updateEvent","checkCheckableElement","checked","tagName","checkTextareaElement","checkOptionElement","selected","checkNormalAttribute","setAttribute","removeAttribute","DocumentFragment","document","createElement","createTextNode","wDomChildrenToDom","elementChildren","hasChildNodes","newEventHandler","oldEventHandler","eventName","addEventListener","oldStyle","originalStyle","elementStyle","styleKey","isVirtualType","makeNewWDomTree","remakeNewWDom","getWDomType","isSameType","remakeWDom","generalize","remakeChildrenForDiff","addReRenderTypeProperty","existOriginalWDom","isEmptyElement","getKey","isKeyCheckedWDom","isSameText","infoVdom","componentProps","componentChildren","reRender","resolve","remakeChildrenForUpdate","remakeChildrenForAdd","map","remakeChildrenForLoopUpdate","remakedChildren","unUsedChildren","diffLoopChildren","unusedItem","parentNode","newChildren","originalChildren","originalItem","findSameKeyOriginalItem","find","orignalChildItem","_c","_props","reRenderCustomComponent","makeWDomResolver","name","componentMaker","componentRender","customNode","makeCustomNode","makeReRender","addComponentProps","wDomMaker","initUpdateHookState","updateReqs","assign","makeNode","componetMakeResolver","remakeChildren","nodeParentPointer","makeChildrenItem","Array","isArray","node","newProps","_children","initValue","body","Dom"],"mappings":"+OAoBA,MAAMA,EAAsBC,G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alRef.ts","../src/hook/unmount.ts","../src/hook/mountCallback.ts","../src/hook/useUpdate.ts","../src/render.ts","../src/diff.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) => newWDom.constructor === originalWDom?.constructor;\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 (originalWDom?.children?.length === newWDom?.children?.length ||\n newWDom.type === 'loop');\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 checkNormalAttribute = (\n dataValue: unknown\n): dataValue is number | string =>\n typeof dataValue === 'number' || typeof dataValue === 'string';\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, TagFunctionResolver, Props } from '@/types';\n\nexport const getParent = (vDom: WDom) => {\n const parentVDom = vDom.getParent && vDom.getParent();\n\n return parentVDom as WDom;\n};\n\nexport const reRender = (vDom: WDom, infoVdom: TagFunctionResolver) => {\n const { componentProps: props, componentChildren: 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\nexport const getEventName = (eventKey: string) =>\n eventKey.replace(/^on(.*)/, (_match, p1) => p1.toLowerCase());\n\nexport const getAttrKey = (keyName: string) =>\n keyName === 'className' ? 'class' : keyName;\n\nconst updateProps = (props: Props, infoProps: Props) => {\n if (props && infoProps !== props) {\n Object.keys(props).forEach(key => delete props[key]);\n\n Object.entries(infoProps || {}).forEach(\n ([key, value]) => (props[key] = value)\n );\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","import { ComponentRef, ComponentSubKey, Props, WDom } from '@/types';\n\ntype RedrawQueueList = {\n componentKey: Props;\n exec: () => void;\n}[];\n\n/**\n * Common\n */\nexport const xmlnsRef: { value: string } = { value: '' };\nexport const componentKeyRef: { value: Props } = { value: {} };\nexport const needDiffRef: { value: boolean } = { value: false };\nexport const componentRef: ComponentRef = new WeakMap();\nexport const redrawQueue: {\n value: { componentKey: Props; exec: () => void }[];\n} = { value: [] };\nexport const redrawQueueTimeout: { value: null | number } = { value: null };\nexport const componentRender = (componentKey: Props) => () => {\n const up = componentRef.get(componentKey)?.up;\n let result = false;\n if (up) {\n up();\n result = true;\n }\n\n return result;\n};\n\nconst setComponetRef = (componentKey: Props) => {\n componentRef.set(componentKey, {\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 = () => componentKeyRef.value;\n\nexport const getComponentSubInfo = (\n componentKey: Props,\n subKey: ComponentSubKey\n) => componentRef.get(componentKey)![subKey];\n\nexport const setRedrawAction = (componentKey: Props, exec: () => void) => {\n componentRef.get(componentKey)!.up = () => {\n redrawQueue.value.push({\n componentKey,\n exec,\n });\n if (!redrawQueueTimeout.value) {\n redrawQueueTimeout.value = setTimeout(execRedrawQueue);\n }\n };\n};\n\nexport const initUpdateHookState = (componentKey: Props) =>\n (componentKeyRef.value = componentKey);\n\nexport const initMountHookState = (componentKey: Props) => {\n componentKeyRef.value = componentKey;\n setComponetRef(componentKey);\n};\n\nconst recursiveGetChildKeys = (wDom: WDom, result: Props[]) => {\n (wDom.children || []).forEach(item => {\n const childComKey = item.componentKey;\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.value.forEach(item => {\n const childVd = componentRef.get(item.componentKey)?.vd?.value;\n if (childVd) {\n recursiveGetChildKeys(childVd, childItemList);\n }\n });\n\n const addedKey: Props[] = [];\n const result = redrawQueue.value.reduce((acc, item) => {\n const { componentKey } = item;\n\n if (\n childItemList.includes(componentKey) ||\n addedKey.includes(componentKey)\n ) {\n return acc;\n }\n\n addedKey.push(componentKey);\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","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 { componentKey } = newWDom;\n\n if (componentKey) {\n removeItem(componentKey);\n }\n recursiveRunUnmount(newWDom);\n};\n\nconst recursiveRunUnmount = (wDom: WDom) => {\n (wDom.children || []).forEach(item => {\n const childComKey = item.componentKey;\n if (childComKey) {\n runUnmountQueueFromWDom(item);\n } else {\n recursiveRunUnmount(item);\n }\n });\n};\n\nconst removeItem = (componentKey: Props) => {\n const subInfo = componentRef.get(componentKey);\n if (subInfo) {\n subInfo!.umts.forEach(effect => effect());\n subInfo!.umts = [];\n componentRef.delete(componentKey);\n }\n};\n","import { WDom } from '@/types';\nimport {\n componentKeyRef,\n componentRef,\n getComponentKey,\n} from '@/utils/universalRef';\n\nimport { unmount } from '@/hook/unmount';\n\nexport const mountCallback = (effectAction: () => void) => {\n const mts = componentRef.get(getComponentKey())!.mts;\n\n mts.push(effectAction);\n};\n\nexport const runMountedQueueFromWDom = (newWDom: WDom) => {\n const { componentKey } = newWDom;\n\n if (componentKey) {\n const component = componentRef.get(componentKey);\n const queue = component?.mts;\n const sequence = component?.upS;\n\n componentKeyRef.value = componentKey;\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 componentKeyRef,\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 { componentKey } = newWDom;\n\n if (componentKey) {\n const component = componentRef.get(componentKey);\n const queue = component?.upCB;\n const sequence = component?.upS;\n\n componentKeyRef.value = componentKey;\n\n if (sequence) {\n sequence.value = 0;\n }\n\n if (newWDom.constructor && queue) {\n component.upCB = [];\n queue.forEach((effect: Function) => effect());\n }\n }\n};\n\nconst checkNeedPushQueue = (originalDefs: unknown[], newDefs: unknown[]) =>\n !originalDefs.length && !originalDefs.length\n ? true\n : originalDefs.some((def, index) => def !== newDefs[index]);\n","import { WDom, Props } from '@/types';\nimport {\n checkStyleData,\n checkRefData,\n checkNormalAttribute,\n checkExisty,\n checkOptionElement,\n checkTextareaElement,\n checkCheckableElement,\n} from '@/utils/predicator';\n\nimport { componentRef, xmlnsRef } from '@/utils/universalRef';\nimport { runUnmountQueueFromWDom } from '@/hook/unmount';\nimport { runMountedQueueFromWDom } from '@/hook/mountCallback';\nimport { runUpdatedQueueFromWDom } from '@/hook/useUpdate';\nimport { getParent, getEventName, getAttrKey } from '@/utils';\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 return () => {\n const component = componentRef.get(wDom.componentProps || {})?.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 SR: typeSortedReplace,\n SU: typeSortedUpdate,\n })[needRerender](newWDomTree);\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\nconst 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 typeDelete(newWDom);\n typeAdd(newWDom, newWDom.el);\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 = isLoop\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 }\n\n runMountedQueueFromWDom(newWDom);\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 && ['fragment', 'loop'].includes(parentType)) {\n return startFindNextBrotherElement(parentWDom, getParent(parentWDom));\n } else if (parentWDom.isRoot && parentWDom.afterElement) {\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 && ['fragment', 'loop'].includes(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 }\n }\n\n runMountedQueueFromWDom(newWDom);\n};\n\nconst removeEvent = (\n oldProps: Props,\n element: HTMLElement | DocumentFragment | Text\n) => {\n Object.entries(oldProps || {}).forEach(\n ([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};\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 Object.entries(props || {}).forEach(\n ([dataKey, dataValue]: [string, unknown]) => {\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)\n ? originalProps.style\n : {},\n element\n );\n } else if (checkRefData(dataKey, dataValue)) {\n dataValue.value = element;\n } else if (dataKey.match(/^on/)) {\n updateEvent(\n element as HTMLElement,\n dataKey,\n dataValue as (e: Event) => void,\n originalProps[dataKey] as (e: Event) => void\n );\n } else if (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 (checkNormalAttribute(dataValue)) {\n if (xmlnsRef.value && dataKey !== 'xmlns') {\n (element as HTMLElement).setAttributeNS(\n null,\n getAttrKey(dataKey),\n String(dataValue)\n );\n } else {\n (element as HTMLElement).setAttribute(\n getAttrKey(dataKey),\n String(dataValue)\n );\n }\n }\n\n delete originalProps[dataKey];\n }\n );\n\n Object.keys(originalProps).forEach(dataKey =>\n (element as HTMLElement).removeAttribute(dataKey)\n );\n};\n\nconst wDomToDom = (wDom: WDom) => {\n let element;\n const { type, tag, text, props, children = [] } = wDom;\n const isVirtualType = type === 'fragment' || type === 'loop';\n\n if (tag === 'svg') {\n xmlnsRef.value = String(props?.xmlns);\n }\n\n if (isVirtualType) {\n element = new DocumentFragment();\n } else if (type === 'element' && tag) {\n element = xmlnsRef.value\n ? document.createElementNS(xmlnsRef.value, tag)\n : document.createElement(tag);\n } else if (type === 'text' && checkExisty(text)) {\n element = document.createTextNode(String(text));\n } else {\n element = document.createElement('e');\n }\n\n wDomChildrenToDom(children, element);\n updateProps(props, element);\n\n wDom.el = element as HTMLElement;\n\n runMountedQueueFromWDom(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 new DocumentFragment()\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 Object.entries(style).forEach(([styleKey, dataValue]) => {\n (elementStyle as any)[styleKey] = dataValue;\n delete originalStyle[styleKey];\n });\n\n Object.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 = vDom.type === 'fragment' || vDom.type === 'loop';\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 } from '@/types';\nimport { checkCustemComponentFunction } from '@/utils/predicator';\nimport { getParent, reRender } from '@/utils';\nimport { recursiveRemoveEvent } from '@/render';\nimport {\n checkEmptyElement,\n checkSameWDomWithOriginal,\n getWDomType,\n checkExisty,\n} from '@/utils/predicator';\n\nimport { runUnmountQueueFromWDom } from '@/hook/unmount';\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\n remakeWDom.children = remakeChildrenForDiff(\n remakeWDom,\n isSameType,\n originalWDom\n );\n\n const needRerender = addReRenderTypeProperty(\n remakeWDom,\n isSameType,\n originalWDom\n );\n\n remakeWDom.needRerender = needRerender;\n\n if (needRerender !== 'A' && originalWDom) {\n remakeWDom.el = originalWDom.el;\n }\n\n if (\n needRerender &&\n ['D', 'R', 'SR'].includes(needRerender) &&\n originalWDom?.componentKey\n ) {\n runUnmountQueueFromWDom(originalWDom);\n recursiveRemoveEvent(originalWDom);\n remakeWDom.oldChildren = originalWDom.children;\n }\n\n remakeWDom.oldProps = originalWDom?.props;\n\n return remakeWDom;\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.getParent;\n const parentType = !isRoot && getParent(newWDom).type;\n const key = getKey(newWDom);\n const isKeyCheckedWDom = parentType === '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 return result;\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 ? reRender(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 const childItem = makeNewWDomTree(item);\n\n childItem.getParent = () => newWDom;\n\n return childItem;\n });\n\nconst remakeChildrenForUpdate = (newWDom: WDom, originalWDom: WDom) => {\n if (\n newWDom.type === 'loop' &&\n checkExisty(getKey((newWDom.children || [])[0]))\n ) {\n return remakeChildrenForLoopUpdate(newWDom, originalWDom);\n }\n\n return (newWDom.children || []).map((item: WDom, index: number) => {\n const childItem = makeNewWDomTree(\n item,\n (originalWDom.children || [])[index]\n );\n\n childItem.getParent = () => newWDom;\n\n return childItem;\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 const el = unusedItem.el;\n\n if (el?.parentNode) {\n el.parentNode.removeChild(el);\n }\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\nconst getKey = (target: WDom) =>\n target?.componentProps?.key ?? target?.props?.key;\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 setRedrawAction,\n needDiffRef,\n componentRender,\n getComponentSubInfo,\n} from '@/utils/universalRef';\nimport { runUpdateCallback } from '@/hook/updateCallback';\nimport {\n checkFragmentFunction,\n checkCustemComponentFunction,\n} from '@/utils/predicator';\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 constructor = tag;\n // 리졸브는 컴포넌트를 새로 만든다.\n const resolve = (componentKey = props) => {\n initMountHookState(componentKey);\n\n const component = tag(props, children);\n const componentMaker = component(\n componentRender(componentKey),\n props,\n children\n );\n\n const customNode = makeCustomNode(\n componentMaker,\n componentKey,\n tag,\n props,\n children\n );\n\n const originalWDom = customNode;\n\n setRedrawAction(componentKey, () =>\n reRenderCustomComponent(tag, props, children, originalWDom)\n );\n\n (getComponentSubInfo(componentKey, 'vd') as { value: WDom }).value =\n customNode;\n\n return customNode;\n };\n\n return { tagName, constructor, props, children, resolve };\n};\n\nconst makeCustomNode = (\n componentMaker: (props: Props) => WDom,\n componentKey: Props,\n tag: TagFunction,\n props: Props,\n children: WDom[]\n) => {\n const customNode = componentMaker(props);\n\n addComponentProps(\n customNode,\n componentKey,\n tag,\n props,\n children,\n makeReRender(componentMaker, componentKey, tag, props, children)\n );\n\n return customNode;\n};\n\nconst makeReRender = (\n componentMaker: (props: Props) => WDom,\n componentKey: Props,\n tag: TagFunction,\n props: Props,\n children: WDom[]\n) => {\n const reRender = () =>\n wDomMaker(componentMaker, componentKey, tag, props, children, reRender);\n return reRender;\n};\n\nconst wDomMaker = (\n componentMaker: (props: Props) => WDom,\n componentKey: Props,\n tag: TagFunction,\n props: Props,\n children: WDom[],\n reRender: () => WDom\n) => {\n initUpdateHookState(componentKey);\n runUpdateCallback();\n\n const originalWDom = componentMaker(props);\n\n setRedrawAction(componentKey, () =>\n reRenderCustomComponent(tag, props, children, originalWDom)\n );\n\n addComponentProps(originalWDom, componentKey, tag, props, children, reRender);\n\n (getComponentSubInfo(componentKey, 'vd') as { value: WDom }).value =\n originalWDom;\n\n return originalWDom;\n};\n\nconst addComponentProps = (\n wDom: WDom,\n componentKey: Props,\n tag: TagFunction,\n props: Props,\n children: WDom[],\n reRender: () => WDom\n) => {\n Object.assign(wDom, {\n componentProps: props,\n componentChildren: children,\n constructor: tag,\n tagName: tag.name,\n componentKey,\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 const childItem = makeChildrenItem(item);\n\n childItem.getParent = () => nodeParentPointer.value;\n\n return childItem;\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 {\n componentRef,\n redrawQueue,\n redrawQueueTimeout,\n getComponentKey,\n} 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 redrawQueue.value = [];\n redrawQueueTimeout.value = null;\n};\n","export const ref = <T>(initValue: T) => ({ value: initValue });\n"],"names":["checkPlainWDomType","wDom","checkPlainType","typeName","type","checkNormalTypeElement","newWDom","originalWDom","_a","children","length","_b","checkCustemComponentFunction","target","checkFragmentFunction","Fragment","checkEmptyElement","checkExisty","value","checkStyleData","dataKey","dataValue","checkSameWDomWithOriginal","c","constructor","l","t","e","tag","f","et","getParent","vDom","getEventName","eventKey","replace","_match","p1","toLowerCase","getAttrKey","keyName","updateProps","props","infoProps","Object","keys","forEach","key","entries","updateChildren","infoChidren","splice","childrenItem","push","xmlnsRef","componentKeyRef","needDiffRef","componentRef","WeakMap","redrawQueue","redrawQueueTimeout","getComponentKey","getComponentSubInfo","componentKey","subKey","get","setRedrawAction","exec","up","setTimeout","execRedrawQueue","initMountHookState","set","vd","upR","upS","upD","upCB","mts","umts","setComponetRef","recursiveGetChildKeys","result","item","childComKey","childItemList","childVd","addedKey","reduce","acc","includes","action","shift","runUnmountQueueFromWDom","removeItem","recursiveRunUnmount","subInfo","effect","delete","runMountedQueueFromWDom","component","queue","sequence","callback","effectAction","useUpdated","dependencies","def","checkNeedPushQueue","originalDefs","newDefs","some","index","wDomUpdate","newWDomTree","needRerender","A","typeAdd","D","typeDelete","R","typeReplace","U","typeUpdate","SR","typeSortedReplace","SU","typeSortedUpdate","recursiveRemoveEvent","el","removeEvent","childItem","rootDelete","deleteRealDom","wrapElement","oldProps","findRealParentElement","parent","nodeType","removeChild","findChildWithRemoveElement","oldChildren","newElement","wDomToDom","parentWDom","parentEl","nextEl","startFindNextBrotherElement","insertBefore","appendChild","brothers","nextIndex","indexOf","candidiateBrothers","slice","finedNextEl","findChildFragmentNextElement","parentType","isRoot","afterElement","targetEl","bItem","isFragment","orignalElement","parentElement","replaceChild","element","match","removeEventListener","String","runUpdatedQueueFromWDom","updateText","nodeValue","text","originalProps","innerHTML","updateStyle","style","checkRefData","updateEvent","checkCheckableElement","checked","tagName","checkTextareaElement","checkOptionElement","selected","checkNormalAttribute","setAttributeNS","setAttribute","removeAttribute","isVirtualType","xmlns","DocumentFragment","document","createElementNS","createElement","createTextNode","wDomChildrenToDom","elementChildren","hasChildNodes","newEventHandler","oldEventHandler","eventName","addEventListener","oldStyle","originalStyle","elementStyle","styleKey","makeNewWDomTree","remakeNewWDom","getWDomType","isSameType","remakeWDom","generalize","remakeChildrenForDiff","addReRenderTypeProperty","existOriginalWDom","isEmptyElement","getKey","isKeyCheckedWDom","isSameText","infoVdom","componentProps","componentChildren","reRender","resolve","remakeChildrenForUpdate","remakeChildrenForAdd","map","remakeChildrenForLoopUpdate","remakedChildren","unUsedChildren","diffLoopChildren","unusedItem","parentNode","newChildren","originalChildren","originalItem","findSameKeyOriginalItem","find","orignalChildItem","_c","_props","reRenderCustomComponent","makeWDomResolver","name","componentMaker","componentRender","customNode","makeCustomNode","addComponentProps","makeReRender","wDomMaker","initUpdateHookState","updateReqs","assign","makeNode","componetMakeResolver","remakeChildren","nodeParentPointer","makeChildrenItem","Array","isArray","node","newProps","_children","initValue","body","Dom"],"mappings":"+OAoBA,MAAMA,EAAsBC,GACV,iBAATA,KAAuB,YAAaA,GAEvCC,EAAiB,CAACD,EAAiBE,IACvCH,EAAmBC,IAASA,EAAKG,OAASD,EAwBtCE,EAAyB,CAC7BC,EACAC,aAEA,OAAAP,EAAmBM,KACL,MAAdC,OAAc,EAAAA,EAAAH,QAASE,EAAQF,QAC9B,OAAAI,EAAA,MAAAD,OAAA,EAAAA,EAAcE,eAAd,EAAAD,EAAwBE,WAAW,OAAAC,EAAS,MAAAL,OAAA,EAAAA,EAAAG,eAAU,EAAAE,EAAAD,SACpC,SAAjBJ,EAAQF,KAAS,EAERQ,EACXC,GAEmB,mBAAXA,IAA0BC,EAAsBD,IACrC,iBAAXA,GAAuB,YAAaA,EAEjCC,EACX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A,EACrC,CAAE/E,KAAM,OAAQyK,KAAM1F,GAGxBA,CAAA,oBAxNQ,CACfvD,EACAc,KACGjC,KAEG,MAAA0P,EAAiC,CAAEjP,WAAO,GAC1CsP,EAAW9N,GAAS,GACpBiM,EAAcuB,GAAeC,EAAmB1P,GAChD8P,EAAOP,GAASpO,EAAK4O,EAAU7B,GAM9B,OAJF/N,EAA6B2P,KAChCJ,EAAkBjP,MAAQqP,GAGrBA,CAAA,UAIHnK,GACJ,CAAC8I,EAAWuB,IACVrK,kBJ3C0BI,IAChB/C,EAAaQ,IAAIJ,KAAoBiB,IAE7CzB,KAAKmD,EAAY,QMZAkK,IAAkB,CAAExP,MAAOwP,aJiB5B,CACpBzQ,EACAqI,EACAyB,KAEA,MAAAzB,IAAAA,EAAgB2D,SAAS0E,MACzB1Q,EAAK6J,QAAS,EACd7J,EAAKqI,YAAcA,EAEb,MAAAsI,EAAM7H,EAAU9I,GAStB,OAPI8J,GACF9J,EAAK8J,aAAeA,EACRzB,EAAAc,aAAawH,EAAK7G,IAE9BzB,EAAYe,YAAYuH,GAGnB,WACC,MAAAxK,EAAY,OAAA5F,IAAayD,IAAIhE,EAAK6N,gBAAkB,CAAE,SAA1C,EAAAtN,EAA6CiE,GAAGvD,MAC9DkF,IACFP,EAAwBO,GACxB4B,EAAqB5B,GACrBgC,EAAWhC,GACb,CAAA,mBGhC0B,CAC5BI,EACAE,EAA4B,KAAM,OAEfjD,EAAaQ,IAAIJ,KAAoBa,IAE7CrB,MAAK,IAAMoD,EAAWD,EAAcE,KAC/CD,EAAWD,EAAcE,EAAY"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -2,3 +2,4 @@ import { WDom, TagFunctionResolver } from '../types';
|
|
|
2
2
|
export declare const getParent: (vDom: WDom) => WDom;
|
|
3
3
|
export declare const reRender: (vDom: WDom, infoVdom: TagFunctionResolver) => WDom;
|
|
4
4
|
export declare const getEventName: (eventKey: string) => string;
|
|
5
|
+
export declare const getAttrKey: (keyName: string) => string;
|
|
@@ -6,7 +6,7 @@ export declare const checkEmptyElement: (wDom: WDomParam) => boolean;
|
|
|
6
6
|
export declare const checkExisty: (value: unknown) => boolean;
|
|
7
7
|
export declare const checkStyleData: (dataKey: string, dataValue: unknown) => dataValue is Record<string, string>;
|
|
8
8
|
export declare const checkRefData: (dataKey: string, dataValue: unknown) => dataValue is {
|
|
9
|
-
value: HTMLElement | DocumentFragment | Text | undefined;
|
|
9
|
+
value: HTMLElement | Element | DocumentFragment | Text | undefined;
|
|
10
10
|
};
|
|
11
11
|
export declare const checkOptionElement: (element: any) => element is HTMLElement;
|
|
12
12
|
export declare const checkTextareaElement: (element: any) => element is HTMLElement;
|
package/dist/wDom.d.ts
CHANGED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))o(l);new MutationObserver(l=>{for(const r of l)if(r.type==="childList")for(const c of r.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&o(c)}).observe(document,{childList:!0,subtree:!0});function n(l){const r={};return l.integrity&&(r.integrity=l.integrity),l.referrerpolicy&&(r.referrerPolicy=l.referrerpolicy),l.crossorigin==="use-credentials"?r.credentials="include":l.crossorigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function o(l){if(l.ep)return;l.ep=!0;const r=n(l);fetch(l.href,r)}})();const h=e=>typeof e=="object"&&!("resolve"in e),k=(e,t)=>h(e)&&e.type===t,he=(e,t)=>e.constructor===(t==null?void 0:t.constructor),ye=(e,t)=>{var n,o;return h(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)},ge=(e,t)=>{var n,o;return h(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)},_=(e,t)=>{var n,o;return h(e)&&(t==null?void 0:t.type)===e.type&&(((n=t==null?void 0:t.children)==null?void 0:n.length)===((o=e==null?void 0:e.children)==null?void 0:o.length)||e.type==="loop")},b=e=>typeof e=="function"&&!z(e)||typeof e=="object"&&"resolve"in e,z=e=>typeof e=="function"&&e===S,G=e=>h(e)&&!e.type,L=e=>e!=null,Q=(e,t)=>e==="style"&&typeof t=="object",Ce=(e,t)=>e==="ref"&&typeof t=="object",ke=e=>e.nodeType===1&&e.tagName==="OPTION",me=e=>e.nodeType===1&&e.tagName==="TEXTAREA",Re=e=>e.nodeType===1&&["radio","checkbox"].includes(e.type),Ee=e=>typeof e=="number"||typeof e=="string",be=e=>{let t="et";return b(e)?t="c":k(e,"fragment")?t="f":k(e,"element")?t="e":k(e,"loop")?t="l":k(e,"text")?t="t":G(e)&&(t="et"),t},Pe={c:he,l:_,t:_,e:ge,f:ye,et:_},p=e=>e.getParent&&e.getParent(),xe=(e,t)=>{const{componentProps:n,componentChildren:o}=e,{props:l,children:r}=t;return n&&Ne(n,l),o&&Se(o,r),e.reRender&&e.reRender()},J=e=>e.replace(/^on(.*)/,(t,n)=>n.toLowerCase()),Y=e=>e==="className"?"class":e,Ne=(e,t)=>{e&&t!==e&&(Object.keys(e).forEach(n=>delete e[n]),Object.entries(t||{}).forEach(([n,o])=>e[n]=o))},Se=(e,t)=>{e&&t!==e&&(e.splice(0,e.length),t&&t.forEach(n=>e.push(n)))},v={value:""},y={value:{}},F={value:!1},u=new WeakMap,R={value:[]},O={value:null},Te=e=>()=>{var t;const n=(t=u.get(e))==null?void 0:t.up;let o=!1;return n&&(n(),o=!0),o},Ue=e=>{u.set(e,{vd:{value:null},up:()=>{},upR:[],upS:{value:0},upD:[],upCB:[],mts:[],umts:[]})},g=()=>y.value,X=(e,t)=>u.get(e)[t],H=(e,t)=>{u.get(e).up=()=>{R.value.push({componentKey:e,exec:t}),O.value||(O.value=setTimeout(Oe))}},_e=e=>y.value=e,Fe=e=>{y.value=e,Ue(e)},Z=(e,t)=>{(e.children||[]).forEach(n=>{const o=n.componentKey;o&&t.push(o),Z(n,t)})},Oe=()=>{let e=[];R.value.forEach(o=>{var l,r;const c=(r=(l=u.get(o.componentKey))==null?void 0:l.vd)==null?void 0:r.value;c&&Z(c,e)});const t=[],n=R.value.reduce((o,l)=>{const{componentKey:r}=l;return e.includes(r)||t.includes(r)||(t.push(r),o.push(l)),o},[]);for(;n.length;){const o=n.shift();o&&o.exec()}},Ae=e=>{u.get(g()).umts.push(e)},M=e=>{const{componentKey:t}=e;t&&Ie(t),K(e)},K=e=>{(e.children||[]).forEach(t=>{t.componentKey?M(t):K(t)})},Ie=e=>{const t=u.get(e);t&&(t.umts.forEach(n=>n()),t.umts=[],u.delete(e))},w=e=>{u.get(g()).mts.push(e)},j=e=>{const{componentKey:t}=e;if(t){const n=u.get(t),o=n==null?void 0:n.mts,l=n==null?void 0:n.upS;y.value=t,l&&(l.value=0),o&&(n.mts=[],o.forEach(r=>{const c=r();c&&Ae(c)}))}},$=(e,t=()=>[])=>{const n=u.get(g()),{upD:o,upS:l}=n,r=o[l.value];if(r&&Me(r,t())){const c=e();c&&n.upCB.push(c)}o[l.value]=t(),l.value+=1},Le=e=>{const{componentKey:t}=e;if(t){const n=u.get(t),o=n==null?void 0:n.upCB,l=n==null?void 0:n.upS;y.value=t,l&&(l.value=0),e.constructor&&o&&(n.upCB=[],o.forEach(r=>r()))}},Me=(e,t)=>!e.length&&!e.length?!0:e.some((n,o)=>n!==t[o]),je=(e,t,n)=>{t!=null||(t=document.body),e.isRoot=!0,e.wrapElement=t;const o=P(e);return n?(e.afterElement=n,t.insertBefore(o,n)):t.appendChild(o),()=>{var l;const r=(l=u.get(e.componentProps||{}))==null?void 0:l.vd.value;r&&(M(r),V(r),Ve(r))}},D=e=>{const{needRerender:t}=e;t&&t!=="N"&&{A:q,D:B,R:qe,U:Qe,SR:te,SU:Be}[t](e)},V=e=>{e.props&&e.el&&oe(e.props,e.el),(e.children||[]).forEach(t=>{V(t)})},Ve=e=>{W(e,e.wrapElement)},B=e=>{e.oldProps&&e.el&&oe(e.oldProps,e.el),W(e,x(p(e)))},W=(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&&ee(e,t),delete e.el)},ee=(e,t)=>{((e==null?void 0:e.oldChildren)||(e==null?void 0:e.children)||[]).forEach(n=>{var o,l;((o=n.el)==null?void 0:o.nodeType)===1?t.removeChild(n==null?void 0:n.el):((l=n.el)==null?void 0:l.nodeType)===11&&ee(n,t)})},te=e=>{B(e),q(e)},Be=e=>{B(e),q(e,e.el)},q=(e,t)=>{t||(t=P(e));const n=p(e);if(n.type){const o=x(n),r=n.type==="loop"?A(n,p(n)):A(e,n);t&&o&&(r?o.insertBefore(t,r):o.appendChild(t))}j(e)},A=(e,t)=>{const n=t.children||[],l=n.indexOf(e)+1,r=n.slice(l),c=ne(r),i=t.type||"";if(c)return c;if(!t.isRoot&&["fragment","loop"].includes(i))return A(t,p(t));if(t.isRoot&&t.afterElement)return t.afterElement},ne=e=>e.reduce((t,n)=>{const o=n.type,l=n.el,r=o&&["fragment","loop"].includes(o);return t||(r?ne(n.children||[]):l&&l.nodeType!==11?l:t)},void 0),qe=e=>{const t=p(e),n=e.el;if(t.type&&n)if(n.nodeType===11)te(e);else{const o=x(t),l=P(e);o&&o.replaceChild(l,n)}j(e)},oe=(e,t)=>{Object.entries(e||{}).forEach(([n,o])=>{n.match(/^on/)&&t.removeEventListener(J(n),o)})},Qe=e=>{var t;const n=e.el;if(e.type==="text"){Ye(e);return}if(n){const{oldProps:o,props:l}=e;le(l,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=>D(o)),Le(e)},Ye=e=>{const t=e.el;t&&(t.nodeValue=String(e.text))},le=(e,t,n)=>{const o={...n};Object.entries(e||{}).forEach(([l,r])=>{l==="key"||(l==="innerHTML"&&typeof r=="string"?t.innerHTML=r:Q(l,r)?Ge(r,Q(l,o.style)?o.style:{},t):Ce(l,r)?r.value=t:l.match(/^on/)?ze(t,l,r,o[l]):Re(t)&&l==="checked"?t.checked=!!r:me(t)&&l==="value"?t.value=r:ke(t)&&l==="selected"?t.selected=!!r:Ee(r)&&(v.value&&l!=="xmlns"?t.setAttributeNS(null,Y(l),String(r)):t.setAttribute(Y(l),String(r)))),delete o[l]}),Object.keys(o).forEach(l=>t.removeAttribute(l))},P=e=>{let t;const{type:n,tag:o,text:l,props:r,children:c=[]}=e,i=n==="fragment"||n==="loop";return o==="svg"&&(v.value=String(r==null?void 0:r.xmlns)),i?t=new DocumentFragment:n==="element"&&o?t=v.value?document.createElementNS(v.value,o):document.createElement(o):n==="text"&&L(l)?t=document.createTextNode(String(l)):t=document.createElement("e"),$e(c,t),le(r,t),e.el=t,j(e),o==="svg"&&(v.value=""),t},$e=(e,t)=>{const n=e.reduce((o,l)=>(l.type&&o.appendChild(P(l)),o),new DocumentFragment);t&&n.hasChildNodes()&&t.appendChild(n)},ze=(e,t,n,o)=>{const l=J(t);o!==n&&(o&&e.removeEventListener(l,o),n&&e.addEventListener(l,n))},Ge=(e,t,n)=>{const o={...t},l=n==null?void 0:n.style;l&&(Object.entries(e).forEach(([r,c])=>{l[r]=c,delete o[r]}),Object.entries(o).forEach(([r])=>l[r]=""))},x=e=>{const t=e.type==="fragment"||e.type==="loop";return e.isRoot&&t?e.wrapElement:t?x(p(e)):e.el},N=(e,t)=>Je(e,Pe[be(e)](e,t),t),Je=(e,t,n)=>{const o=He(e,t,n);o.children=Ze(o,t,n);const l=Xe(o,t,n);return o.needRerender=l,l!=="A"&&n&&(o.el=n.el),l&&["D","R","SR"].includes(l)&&(n==null?void 0:n.componentKey)&&(M(n),V(n),o.oldChildren=n.children),o.oldProps=n==null?void 0:n.props,o},Xe=(e,t,n)=>{const o=n&&n.type,l=G(e),c=!!e.getParent&&p(e).type,i=E(e),d=c==="loop"&&L(i),f=e.type==="text"&&t&&e.text===(n==null?void 0:n.text);let a;return l?a="D":f?a="N":o?t?a=d?"SU":"U":a=d?"SR":"R":a="A",a},He=(e,t,n)=>b(e)?t&&n?xe(n,e):e.resolve():e,Ze=(e,t,n)=>t&&n?we(e,n):Ke(e),Ke=e=>(e.children||[]).map(t=>{const n=N(t);return n.getParent=()=>e,n}),we=(e,t)=>e.type==="loop"&&L(E((e.children||[])[0]))?De(e,t):(e.children||[]).map((n,o)=>{const l=N(n,(t.children||[])[o]);return l.getParent=()=>e,l}),De=(e,t)=>{const[n,o]=We(e,t);return o.map(l=>{const r=l.el;r!=null&&r.parentNode&&r.parentNode.removeChild(r)}),n},We=(e,t)=>{const n=[...e.children||[]],o=[...t.children||[]];return[n.map(r=>{const c=et(r,o),i=N(r,c);return c&&o.splice(o.indexOf(c),1),i.getParent=()=>e,i}),o]},et=(e,t)=>t.find(n=>E(n)===E(e)),E=e=>{var t,n,o;return(o=(t=e==null?void 0:e.componentProps)==null?void 0:t.key)!=null?o:(n=e==null?void 0:e.props)==null?void 0:n.key},re=(e,t=()=>[])=>{u.get(g()).upR.push(()=>$(e,t)),$(e,t)},tt=()=>{var e;const t=(e=u.get(g()))==null?void 0:e.upR;t!=null&&t.length&&t.forEach(n=>n()),R.value=[],O.value=null},S=(e,...t)=>({type:"fragment",children:t}),s=(e,t,...n)=>{const o={value:void 0},l=t||{},r=de(o,n),c=rt(e,l,r);return b(c)||(o.value=c),c},ce=e=>(t,n)=>e,se=(e,t,n,o)=>{var l;F.value=!0;const r=ue(e,t,n),c=N(r,o),{isRoot:i,getParent:d,wrapElement:f,afterElement:a}=o;if(c.getParent=d,!i&&d){const C=((l=d())==null?void 0:l.children)||[],T=C.indexOf(o);C.splice(T,1,c)}else c.isRoot=!0,c.wrapElement=f,c.afterElement=a;F.value=!1,D(c)},ue=(e,t,n)=>({tagName:e.name,constructor:e,props:t,children:n,resolve:(c=t)=>{Fe(c);const d=e(t,n)(Te(c),t,n),f=nt(d,c,e,t,n),a=f;return H(c,()=>se(e,t,n,a)),X(c,"vd").value=f,f}}),nt=(e,t,n,o,l)=>{const r=e(o);return ie(r,t,n,o,l,ot(e,t,n,o,l)),r},ot=(e,t,n,o,l)=>{const r=()=>lt(e,t,n,o,l,r);return r},lt=(e,t,n,o,l,r)=>{_e(t),tt();const c=e(o);return H(t,()=>se(n,o,l,c)),ie(c,t,n,o,l,r),X(t,"vd").value=c,c},ie=(e,t,n,o,l,r)=>{Object.assign(e,{componentProps:o,componentChildren:l,constructor:n,tagName:n.name,componentKey:t,reRender:r})},rt=(e,t,n)=>{if(z(e))return S(t,...n);if(b(e)){const o=ue(e,t,n);return F.value?o:o.resolve()}return{type:"element",tag:e,props:t,children:n}},de=(e,t)=>t.map(n=>{const o=ct(n);return o.getParent=()=>e.value,o}),ct=e=>{if(e==null||e===!1)return{type:null};if(Array.isArray(e)){const t={value:void 0},o={type:"loop",children:de(t,e)};return t.value=o,o}else if(typeof e=="string"||typeof e=="number")return{type:"text",text:e};return e},st=e=>({value:e}),I=(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()}}},ut=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'")}}},it=(e,t=()=>{},n=()=>[])=>{w(()=>(e(),t)),re(()=>(t&&t(),e),n)},ae=new Map,m={},dt=e=>{const t=Symbol();return ae.set(t,e),n=>(m[t]!=null||(m[t]=[]),m[t].push(n),at(t))},at=e=>new Proxy(ae.get(e),{get(t,n){return t[n]},set(t,n,o){t[n]=o;const l=m[e],r=[];return l.forEach(c=>{c()||r.push(c)}),r.forEach(c=>l.splice(l.indexOf(c),1)),!0}}),ft=ce((e,t,n)=>{const o=I(1,e),l=I('"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),r=()=>t.parentValue,c=t.parentValue,i=ut(()=>o.v+f+t.parentValue),d=dt({text:"s",count:0})(e);let f=t.parentValue;const a=st(null),C=()=>{o.v=o.v+1,f+=1},T=U=>{l.v=U.target.value},fe=()=>{d.count+=1,d.text+="1"},pe=()=>(console.log("MOUNTED",a),()=>console.log("UNMOUNT")),ve=()=>(console.log("UPDATE - parentValue"),()=>console.log("UPDATED"));return w(pe),re(ve,()=>[t.parentValue]),it(()=>console.log("INJECT"),()=>console.log("CLEAN_UP"),()=>[o.v]),({parentValue:U})=>s(S,null,s("div",null,s("textarea",{value:l.v,onInput:T,style:{width:"300px",height:"100px"}})),s("div",null,l.v),s("div",null,s("div",{style:{color:"blue"}},"parentValueFromRef: ",t.parentValue," (working)"),s("div",{style:{color:"blue"}},"parentValueFromFunction: ",r()," (working)"),s("div",{style:{color:"blue"}},"parentValueFromUpdaterDestructuring: ",U," (working)"),s("div",{style:{color:"red"}},"parentValueFromMounterDestructuring: ",c," (not working)")),s("div",null,s("div",{ref:a},"count: ",o.v),s("div",null,"sum: ",o.v+f+t.parentValue),s("div",null,"sum(computed): ",i.v),s("div",null,"notRefValue: ",f),s("div",null,"localStore(text): ",d.text),s("div",null,"localStore(count): ",d.count)),s("button",{onClick:C},"Increase"),s("button",{onClick:fe},"localStoreUpdate"),n)}),pt=ce(e=>{const t=I(7,e),n=()=>{t.v=t.v+1},o=()=>{t.v=t.v-1};return()=>s(S,null,s(ft,{parentValue:t.v},s("button",{onClick:n},"Increase - Parent")),s("button",{onClick:o},"Decrease - Parent"))}),vt=s(pt,null);je(vt,document.getElementById("root"));
|
|
2
|
+
//# sourceMappingURL=index.b6b5ca4e.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.b6b5ca4e.js","sources":["../../vite/modulepreload-polyfill","../../../dist/lithent.mjs","../../../helper/dist/lithentHelper.mjs","../../src/index.tsx"],"sourcesContent":["__VITE_IS_MODERN__&&(function polyfill() {\n const relList = document.createElement('link').relList;\n if (relList && relList.supports && relList.supports('modulepreload')) {\n return;\n }\n for (const link of document.querySelectorAll('link[rel=\"modulepreload\"]')) {\n processPreload(link);\n }\n new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (mutation.type !== 'childList') {\n continue;\n }\n for (const node of mutation.addedNodes) {\n if (node.tagName === 'LINK' && node.rel === 'modulepreload')\n processPreload(node);\n }\n }\n }).observe(document, { childList: true, subtree: true });\n function getFetchOpts(script) {\n const fetchOpts = {};\n if (script.integrity)\n fetchOpts.integrity = script.integrity;\n if (script.referrerpolicy)\n fetchOpts.referrerPolicy = script.referrerpolicy;\n if (script.crossorigin === 'use-credentials')\n fetchOpts.credentials = 'include';\n else if (script.crossorigin === 'anonymous')\n fetchOpts.credentials = 'omit';\n else\n fetchOpts.credentials = 'same-origin';\n return fetchOpts;\n }\n function processPreload(link) {\n if (link.ep)\n // ep marker = processed\n return;\n link.ep = true;\n // prepopulate the load record\n const fetchOpts = getFetchOpts(link);\n fetch(link.href, fetchOpts);\n }\n}());","const checkPlainWDomType = (wDom) => typeof wDom === \"object\" && !(\"resolve\" in wDom);\nconst checkPlainType = (wDom, typeName) => checkPlainWDomType(wDom) && wDom.type === typeName;\nconst checkSameCustomComponent = (newWDom, originalWDom) => newWDom.constructor === (originalWDom == null ? void 0 : originalWDom.constructor);\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) => {\n var _a, _b;\n return checkPlainWDomType(newWDom) && (originalWDom == null ? void 0 : originalWDom.type) === newWDom.type && (((_a = originalWDom == null ? void 0 : originalWDom.children) == null ? void 0 : _a.length) === ((_b = newWDom == null ? void 0 : newWDom.children) == null ? void 0 : _b.length) || newWDom.type === \"loop\");\n};\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 checkNormalAttribute = (dataValue) => typeof dataValue === \"number\" || typeof dataValue === \"string\";\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) => {\n const parentVDom = vDom.getParent && vDom.getParent();\n return parentVDom;\n};\nconst reRender = (vDom, infoVdom) => {\n const { componentProps: props, componentChildren: children } = vDom;\n const { props: infoProps, children: infoChidren } = infoVdom;\n if (props) {\n updateProps$1(props, infoProps);\n }\n if (children) {\n updateChildren(children, infoChidren);\n }\n const newVDom = vDom.reRender && vDom.reRender();\n return newVDom;\n};\nconst getEventName = (eventKey) => eventKey.replace(/^on(.*)/, (_match, p1) => p1.toLowerCase());\nconst getAttrKey = (keyName) => keyName === \"className\" ? \"class\" : keyName;\nconst updateProps$1 = (props, infoProps) => {\n if (props && infoProps !== props) {\n Object.keys(props).forEach((key) => delete props[key]);\n Object.entries(infoProps || {}).forEach(\n ([key, value]) => props[key] = value\n );\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 xmlnsRef = { value: \"\" };\nconst componentKeyRef = { value: {} };\nconst needDiffRef = { value: false };\nconst componentRef = /* @__PURE__ */ new WeakMap();\nconst redrawQueue = { value: [] };\nconst redrawQueueTimeout = { value: null };\nconst componentRender = (componentKey) => () => {\n var _a;\n const up = (_a = componentRef.get(componentKey)) == null ? void 0 : _a.up;\n let result = false;\n if (up) {\n up();\n result = true;\n }\n return result;\n};\nconst setComponetRef = (componentKey) => {\n componentRef.set(componentKey, {\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 = () => componentKeyRef.value;\nconst getComponentSubInfo = (componentKey, subKey) => componentRef.get(componentKey)[subKey];\nconst setRedrawAction = (componentKey, exec) => {\n componentRef.get(componentKey).up = () => {\n redrawQueue.value.push({\n componentKey,\n exec\n });\n if (!redrawQueueTimeout.value) {\n redrawQueueTimeout.value = setTimeout(execRedrawQueue);\n }\n };\n};\nconst initUpdateHookState = (componentKey) => componentKeyRef.value = componentKey;\nconst initMountHookState = (componentKey) => {\n componentKeyRef.value = componentKey;\n setComponetRef(componentKey);\n};\nconst recursiveGetChildKeys = (wDom, result) => {\n (wDom.children || []).forEach((item) => {\n const childComKey = item.componentKey;\n if (childComKey) {\n result.push(childComKey);\n }\n recursiveGetChildKeys(item, result);\n });\n};\nconst execRedrawQueue = () => {\n let childItemList = [];\n redrawQueue.value.forEach((item) => {\n var _a, _b;\n const childVd = (_b = (_a = componentRef.get(item.componentKey)) == 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.value.reduce((acc, item) => {\n const { componentKey } = item;\n if (childItemList.includes(componentKey) || addedKey.includes(componentKey)) {\n return acc;\n }\n addedKey.push(componentKey);\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};\nconst unmount = (effectAction) => {\n componentRef.get(getComponentKey()).umts.push(effectAction);\n};\nconst runUnmountQueueFromWDom = (newWDom) => {\n const { componentKey } = newWDom;\n if (componentKey) {\n removeItem(componentKey);\n }\n recursiveRunUnmount(newWDom);\n};\nconst recursiveRunUnmount = (wDom) => {\n (wDom.children || []).forEach((item) => {\n const childComKey = item.componentKey;\n if (childComKey) {\n runUnmountQueueFromWDom(item);\n } else {\n recursiveRunUnmount(item);\n }\n });\n};\nconst removeItem = (componentKey) => {\n const subInfo = componentRef.get(componentKey);\n if (subInfo) {\n subInfo.umts.forEach((effect) => effect());\n subInfo.umts = [];\n componentRef.delete(componentKey);\n }\n};\nconst mountCallback = (effectAction) => {\n const mts = componentRef.get(getComponentKey()).mts;\n mts.push(effectAction);\n};\nconst runMountedQueueFromWDom = (newWDom) => {\n const { componentKey } = newWDom;\n if (componentKey) {\n const component = componentRef.get(componentKey);\n const queue = component == null ? void 0 : component.mts;\n const sequence = component == null ? void 0 : component.upS;\n componentKeyRef.value = componentKey;\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 { componentKey } = newWDom;\n if (componentKey) {\n const component = componentRef.get(componentKey);\n const queue = component == null ? void 0 : component.upCB;\n const sequence = component == null ? void 0 : component.upS;\n componentKeyRef.value = componentKey;\n if (sequence) {\n sequence.value = 0;\n }\n if (newWDom.constructor && queue) {\n component.upCB = [];\n queue.forEach((effect) => effect());\n }\n }\n};\nconst checkNeedPushQueue = (originalDefs, newDefs) => !originalDefs.length && !originalDefs.length ? true : originalDefs.some((def, index) => def !== newDefs[index]);\nconst render = (wDom, wrapElement, afterElement) => {\n wrapElement != null ? 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 return () => {\n var _a;\n const component = (_a = componentRef.get(wDom.componentProps || {})) == 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 SR: typeSortedReplace,\n SU: typeSortedUpdate\n })[needRerender](newWDomTree);\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 typeDelete(newWDom);\n typeAdd(newWDom, newWDom.el);\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 ? 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 }\n }\n runMountedQueueFromWDom(newWDom);\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 && [\"fragment\", \"loop\"].includes(parentType)) {\n return startFindNextBrotherElement(parentWDom, getParent(parentWDom));\n } else if (parentWDom.isRoot && 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 && [\"fragment\", \"loop\"].includes(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 }\n }\n runMountedQueueFromWDom(newWDom);\n};\nconst removeEvent = (oldProps, element) => {\n Object.entries(oldProps || {}).forEach(\n ([dataKey, dataValue]) => {\n if (dataKey.match(/^on/)) {\n element.removeEventListener(\n getEventName(dataKey),\n dataValue\n );\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(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 = (props, element, oldProps) => {\n const originalProps = { ...oldProps };\n Object.entries(props || {}).forEach(\n ([dataKey, dataValue]) => {\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 (checkNormalAttribute(dataValue)) {\n if (xmlnsRef.value && dataKey !== \"xmlns\") {\n element.setAttributeNS(\n null,\n getAttrKey(dataKey),\n String(dataValue)\n );\n } else {\n element.setAttribute(\n getAttrKey(dataKey),\n String(dataValue)\n );\n }\n }\n delete originalProps[dataKey];\n }\n );\n Object.keys(originalProps).forEach(\n (dataKey) => element.removeAttribute(dataKey)\n );\n};\nconst wDomToDom = (wDom) => {\n let element;\n const { type, tag, text, props, children = [] } = wDom;\n const isVirtualType = type === \"fragment\" || type === \"loop\";\n if (tag === \"svg\") {\n xmlnsRef.value = String(props == null ? void 0 : props.xmlns);\n }\n if (isVirtualType) {\n element = new DocumentFragment();\n } else if (type === \"element\" && tag) {\n element = xmlnsRef.value ? document.createElementNS(xmlnsRef.value, tag) : document.createElement(tag);\n } else if (type === \"text\" && checkExisty(text)) {\n element = document.createTextNode(String(text));\n } else {\n element = document.createElement(\"e\");\n }\n wDomChildrenToDom(children, element);\n updateProps(props, element);\n wDom.el = element;\n runMountedQueueFromWDom(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 new DocumentFragment()\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 Object.entries(style).forEach(([styleKey, dataValue]) => {\n elementStyle[styleKey] = dataValue;\n delete originalStyle[styleKey];\n });\n Object.entries(originalStyle).forEach(\n ([styleKey]) => elementStyle[styleKey] = \"\"\n );\n }\n};\nconst findRealParentElement = (vDom) => {\n const isVirtualType = vDom.type === \"fragment\" || vDom.type === \"loop\";\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 remakeWDom.children = remakeChildrenForDiff(\n remakeWDom,\n isSameType,\n originalWDom\n );\n const needRerender = addReRenderTypeProperty(\n remakeWDom,\n isSameType,\n originalWDom\n );\n remakeWDom.needRerender = needRerender;\n if (needRerender !== \"A\" && originalWDom) {\n remakeWDom.el = originalWDom.el;\n }\n if (needRerender && [\"D\", \"R\", \"SR\"].includes(needRerender) && (originalWDom == null ? void 0 : originalWDom.componentKey)) {\n runUnmountQueueFromWDom(originalWDom);\n recursiveRemoveEvent(originalWDom);\n remakeWDom.oldChildren = originalWDom.children;\n }\n remakeWDom.oldProps = originalWDom == null ? void 0 : originalWDom.props;\n return remakeWDom;\n};\nconst addReRenderTypeProperty = (newWDom, isSameType, originalWDom) => {\n const existOriginalWDom = originalWDom && originalWDom.type;\n const isEmptyElement = checkEmptyElement(newWDom);\n const isRoot = !newWDom.getParent;\n const parentType = !isRoot && getParent(newWDom).type;\n const key = getKey(newWDom);\n const isKeyCheckedWDom = parentType === \"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 return result;\n};\nconst generalize = (newWDom, isSameType, originalWDom) => {\n if (checkCustemComponentFunction(newWDom)) {\n return isSameType && originalWDom ? reRender(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((item) => {\n const childItem = makeNewWDomTree(item);\n childItem.getParent = () => newWDom;\n return childItem;\n});\nconst remakeChildrenForUpdate = (newWDom, originalWDom) => {\n if (newWDom.type === \"loop\" && checkExisty(getKey((newWDom.children || [])[0]))) {\n return remakeChildrenForLoopUpdate(newWDom, originalWDom);\n }\n return (newWDom.children || []).map((item, index) => {\n const childItem = makeNewWDomTree(\n item,\n (originalWDom.children || [])[index]\n );\n childItem.getParent = () => newWDom;\n return childItem;\n });\n};\nconst remakeChildrenForLoopUpdate = (newWDom, originalWDom) => {\n const [remakedChildren, unUsedChildren] = diffLoopChildren(\n newWDom,\n originalWDom\n );\n unUsedChildren.map((unusedItem) => {\n const el = unusedItem.el;\n if (el == null ? void 0 : el.parentNode) {\n el.parentNode.removeChild(el);\n }\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);\nconst getKey = (target) => {\n var _a, _b, _c;\n return (_c = (_a = target == null ? void 0 : target.componentProps) == null ? void 0 : _a.key) != null ? _c : (_b = target == null ? void 0 : target.props) == null ? void 0 : _b.key;\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 redrawQueue.value = [];\n redrawQueueTimeout.value = null;\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 constructor = tag;\n const resolve = (componentKey = props) => {\n initMountHookState(componentKey);\n const component = tag(props, children);\n const componentMaker = component(\n componentRender(componentKey),\n props,\n children\n );\n const customNode = makeCustomNode(\n componentMaker,\n componentKey,\n tag,\n props,\n children\n );\n const originalWDom = customNode;\n setRedrawAction(\n componentKey,\n () => reRenderCustomComponent(tag, props, children, originalWDom)\n );\n getComponentSubInfo(componentKey, \"vd\").value = customNode;\n return customNode;\n };\n return { tagName, constructor, props, children, resolve };\n};\nconst makeCustomNode = (componentMaker, componentKey, tag, props, children) => {\n const customNode = componentMaker(props);\n addComponentProps(\n customNode,\n componentKey,\n tag,\n props,\n children,\n makeReRender(componentMaker, componentKey, tag, props, children)\n );\n return customNode;\n};\nconst makeReRender = (componentMaker, componentKey, tag, props, children) => {\n const reRender2 = () => wDomMaker(componentMaker, componentKey, tag, props, children, reRender2);\n return reRender2;\n};\nconst wDomMaker = (componentMaker, componentKey, tag, props, children, reRender2) => {\n initUpdateHookState(componentKey);\n runUpdateCallback();\n const originalWDom = componentMaker(props);\n setRedrawAction(\n componentKey,\n () => reRenderCustomComponent(tag, props, children, originalWDom)\n );\n addComponentProps(originalWDom, componentKey, tag, props, children, reRender2);\n getComponentSubInfo(componentKey, \"vd\").value = originalWDom;\n return originalWDom;\n};\nconst addComponentProps = (wDom, componentKey, tag, props, children, reRender2) => {\n Object.assign(wDom, {\n componentProps: props,\n componentChildren: children,\n constructor: tag,\n tagName: tag.name,\n componentKey,\n reRender: reRender2\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((item) => {\n const childItem = makeChildrenItem(item);\n childItem.getParent = () => nodeParentPointer.value;\n return childItem;\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 });\nexport {\n Fragment,\n h,\n mount,\n mountCallback,\n ref,\n render,\n updateCallback\n};\n//# sourceMappingURL=lithent.mjs.map\n","import { mountCallback as a, updateCallback as p } 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}, f = (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}, m = (r, t = () => {\n}, e = () => []) => {\n a(() => (r(), t)), p(() => (t && t(), r), e);\n}, l = /* @__PURE__ */ new Map(), u = {}, i = (r) => {\n const t = Symbol();\n return l.set(t, r), (e) => {\n var n;\n return (n = u[t]) != null || (u[t] = []), u[t].push(e), h(t);\n };\n}, h = (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 s = u[r], c = [];\n return s.forEach((o) => {\n o() || c.push(o);\n }), c.forEach(\n (o) => s.splice(s.indexOf(o), 1)\n ), !0;\n }\n});\nexport {\n f as computed,\n m as effect,\n v as state,\n i 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":["relList","link","processPreload","mutations","mutation","node","getFetchOpts","script","fetchOpts","checkPlainWDomType","wDom","checkPlainType","typeName","checkSameCustomComponent","newWDom","originalWDom","checkSameFragment","_a","_b","checkSameTagElement","checkNormalTypeElement","checkCustemComponentFunction","target","checkFragmentFunction","Fragment","checkEmptyElement","checkExisty","value","checkStyleData","dataKey","dataValue","checkRefData","checkOptionElement","element","checkTextareaElement","checkCheckableElement","checkNormalAttribute","getWDomType","result","checkSameWDomWithOriginal","getParent","vDom","reRender","infoVdom","props","children","infoProps","infoChidren","updateProps$1","updateChildren","getEventName","eventKey","_match","p1","getAttrKey","keyName","key","childrenItem","xmlnsRef","componentKeyRef","needDiffRef","componentRef","redrawQueue","redrawQueueTimeout","componentRender","componentKey","up","setComponetRef","getComponentKey","getComponentSubInfo","subKey","setRedrawAction","exec","execRedrawQueue","initUpdateHookState","initMountHookState","recursiveGetChildKeys","item","childComKey","childItemList","childVd","addedKey","acc","action","unmount","effectAction","runUnmountQueueFromWDom","removeItem","recursiveRunUnmount","subInfo","effect","mountCallback","runMountedQueueFromWDom","component","queue","sequence","callback","useUpdated","dependencies","upD","upS","def","checkNeedPushQueue","runUpdatedQueueFromWDom","originalDefs","newDefs","index","render","wrapElement","afterElement","Dom","wDomToDom","recursiveRemoveEvent","rootDelete","wDomUpdate","newWDomTree","needRerender","typeAdd","typeDelete","typeReplace","typeUpdate","typeSortedReplace","typeSortedUpdate","removeEvent","childItem","deleteRealDom","findRealParentElement","parent","findChildWithRemoveElement","newElement","parentWDom","parentEl","nextEl","startFindNextBrotherElement","brothers","nextIndex","candidiateBrothers","finedNextEl","findChildFragmentNextElement","parentType","targetEl","bItem","type","el","isFragment","orignalElement","parentElement","oldProps","updateText","updateProps","originalProps","updateStyle","updateEvent","tag","text","isVirtualType","wDomChildrenToDom","elementChildren","newEventHandler","oldEventHandler","eventName","style","oldStyle","originalStyle","elementStyle","styleKey","makeNewWDomTree","remakeNewWDom","isSameType","remakeWDom","generalize","remakeChildrenForDiff","addReRenderTypeProperty","existOriginalWDom","isEmptyElement","getKey","isKeyCheckedWDom","isSameText","remakeChildrenForUpdate","remakeChildrenForAdd","remakeChildrenForLoopUpdate","remakedChildren","unUsedChildren","diffLoopChildren","unusedItem","newChildren","originalChildren","originalItem","findSameKeyOriginalItem","orignalChildItem","_c","updateCallback","runUpdateCallback","updateReqs","_props","h","nodeParentPointer","newProps","remakeChildren","makeNode","mount","_children","reRenderCustomComponent","makeWDomResolver","isRoot","getParent2","componentMaker","customNode","makeCustomNode","addComponentProps","makeReRender","reRender2","wDomMaker","componetMakeResolver","makeChildrenItem","ref","initValue","v","r","e","n","f","m","a","p","l","u","i","s","c","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":"CAAqB,UAAoB,CACrC,MAAMA,EAAU,SAAS,cAAc,MAAM,EAAE,QAC/C,GAAIA,GAAWA,EAAQ,UAAYA,EAAQ,SAAS,eAAe,EAC/D,OAEJ,UAAWC,KAAQ,SAAS,iBAAiB,2BAA2B,EACpEC,EAAeD,CAAI,EAEvB,IAAI,iBAAkBE,GAAc,CAChC,UAAWC,KAAYD,EACnB,GAAIC,EAAS,OAAS,YAGtB,UAAWC,KAAQD,EAAS,WACpBC,EAAK,UAAY,QAAUA,EAAK,MAAQ,iBACxCH,EAAeG,CAAI,CAGvC,CAAK,EAAE,QAAQ,SAAU,CAAE,UAAW,GAAM,QAAS,EAAI,CAAE,EACvD,SAASC,EAAaC,EAAQ,CAC1B,MAAMC,EAAY,CAAA,EAClB,OAAID,EAAO,YACPC,EAAU,UAA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ACJnO,EACC,KAAA2K,EAACoC,IAAe,YAAaoB,EAAa,GACvCxD,EAAA,SAAA,CAAO,QAASyD,CAAgB,EAAA,mBAAiB,CACpD,EACAzD,EAAC,UAAO,QAAS0D,GAAgB,mBAAiB,CACpD,CAEJ,CAAC,EACKC,KAAQJ,GAAK,IAAA,EAEnB/I,GAAOmJ,GAAM,SAAS,eAAe,MAAM,CAAC"}
|
package/examples/dist/index.html
CHANGED
|
@@ -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.
|
|
7
|
+
<script type="module" crossorigin src="/assets/index.b6b5ca4e.js"></script>
|
|
8
8
|
</head>
|
|
9
9
|
<body>
|
|
10
10
|
<section id="root"></section>
|
package/package.json
CHANGED
package/src/diff.ts
CHANGED
|
@@ -146,7 +146,7 @@ const remakeChildrenForUpdate = (newWDom: WDom, originalWDom: WDom) => {
|
|
|
146
146
|
};
|
|
147
147
|
|
|
148
148
|
const remakeChildrenForLoopUpdate = (newWDom: WDom, originalWDom: WDom) => {
|
|
149
|
-
const
|
|
149
|
+
const [remakedChildren, unUsedChildren] = diffLoopChildren(
|
|
150
150
|
newWDom,
|
|
151
151
|
originalWDom
|
|
152
152
|
);
|
|
@@ -165,7 +165,6 @@ const remakeChildrenForLoopUpdate = (newWDom: WDom, originalWDom: WDom) => {
|
|
|
165
165
|
const diffLoopChildren = (newWDom: WDom, originalWDom: WDom) => {
|
|
166
166
|
const newChildren = [...(newWDom.children || [])];
|
|
167
167
|
const originalChildren = [...(originalWDom.children || [])];
|
|
168
|
-
|
|
169
168
|
const remakedChildren = newChildren.map(item => {
|
|
170
169
|
const originalItem = findSameKeyOriginalItem(item, originalChildren);
|
|
171
170
|
const childItem = makeNewWDomTree(item, originalItem);
|
|
@@ -179,19 +178,13 @@ const diffLoopChildren = (newWDom: WDom, originalWDom: WDom) => {
|
|
|
179
178
|
return childItem;
|
|
180
179
|
});
|
|
181
180
|
|
|
182
|
-
return
|
|
183
|
-
remakedChildren,
|
|
184
|
-
unUsedChildren: originalChildren,
|
|
185
|
-
};
|
|
181
|
+
return [remakedChildren, originalChildren];
|
|
186
182
|
};
|
|
187
183
|
|
|
188
|
-
const findSameKeyOriginalItem = (item: WDom, originalChildren: WDom[]) =>
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
return originalChildren.find(
|
|
192
|
-
orignalChildItem => getKey(orignalChildItem) === key
|
|
184
|
+
const findSameKeyOriginalItem = (item: WDom, originalChildren: WDom[]) =>
|
|
185
|
+
originalChildren.find(
|
|
186
|
+
orignalChildItem => getKey(orignalChildItem) === getKey(item)
|
|
193
187
|
);
|
|
194
|
-
};
|
|
195
188
|
|
|
196
189
|
const getKey = (target: WDom) =>
|
|
197
190
|
target?.componentProps?.key ?? target?.props?.key;
|