lithent 0.1.0 → 0.30.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 +14 -30
- package/dist/index.d.ts +2 -17
- package/dist/lithent.mjs +11 -22
- 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/universalRef.d.ts +2 -18
- package/examples/dist/assets/index.91a636db.js +2 -0
- package/examples/dist/assets/index.91a636db.js.map +1 -0
- package/examples/dist/index.html +1 -1
- package/examples/src/index.tsx +26 -1
- package/helper/dist/hook/store.d.ts +4 -7
- package/helper/dist/index.d.ts +1 -1
- package/helper/dist/lithentHelper.mjs +42 -31
- package/helper/dist/lithentHelper.mjs.map +1 -1
- package/helper/dist/lithentHelper.umd.js +1 -1
- package/helper/dist/lithentHelper.umd.js.map +1 -1
- package/helper/src/hook/store.ts +56 -13
- package/helper/src/index.ts +1 -1
- package/package.json +23 -21
- package/router/dist/Router.mjs +5 -5
- package/router/dist/Router.mjs.map +1 -1
- package/router/dist/Router.umd.js +1 -1
- package/router/dist/Router.umd.js.map +1 -1
- package/src/index.ts +1 -21
- package/src/utils/universalRef.ts +11 -21
- package/src/wDom.ts +3 -11
- package/examples/dist/assets/index.e76a0ef8.js +0 -2
- package/examples/dist/assets/index.e76a0ef8.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/index.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 DiffParam = {\n originalWDom?: WDom;\n newWDom: WDom | TagFunction | TagFunctionResolver;\n};\n\ntype WDomParam =\n | string\n | WDom\n | TagFunction\n | TagFunctionResolver\n | FragmentFunction;\n\n/**\n * Predicator\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 checkPlainWDomType = (wDom: WDomParam): wDom is WDom =>\n typeof wDom === 'object' && !('resolve' in wDom);\n\nexport const checkPlainType = (wDom: WDomParam, typeName: string) =>\n checkPlainWDomType(wDom) && wDom.type === typeName;\n\nexport const checkEmptyElement = (wDom: WDomParam) =>\n checkPlainWDomType(wDom) && !wDom.type;\n\nexport const checkSameCustomComponent = ({\n originalWDom,\n newWDom,\n}: DiffParam) => newWDom.constructor === originalWDom?.constructor;\n\nexport const checkSameFragment = ({ originalWDom, newWDom }: DiffParam) =>\n checkPlainWDomType(newWDom) &&\n originalWDom?.type === 'fragment' &&\n originalWDom?.children?.length === newWDom?.children?.length;\n\nexport const checkSameTagElement = ({ originalWDom, newWDom }: DiffParam) =>\n checkPlainWDomType(newWDom) &&\n originalWDom?.type === 'element' &&\n originalWDom?.tag === newWDom.tag;\n\nexport const checkNormalTypeElement = ({ originalWDom, newWDom }: DiffParam) =>\n checkPlainWDomType(newWDom) && originalWDom?.type === newWDom.type;\n\nexport const checkExisty = (value: unknown) =>\n value !== null && value !== undefined;\n\nexport const checkFunction = (target: unknown): target is Function =>\n typeof target === 'function';\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 return element.nodeType === 1 && element.tagName === 'OPTION';\n};\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 | undefined => {\n let result: WDomType | undefined;\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 if (!parentVDom) {\n throw Error('Not found parent vDom');\n }\n\n return parentVDom;\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 if (!newVDom) {\n throw Error('Unable reRender');\n }\n\n return newVDom;\n};\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 {\n UseDataStoreValue,\n ComponentRef,\n ComponentSubKey,\n Props,\n NodeChildKey,\n} from '@/types';\n\ntype redrawQueueList = {\n componentKey: Props;\n nodeChildKey: 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; nodeChildKey: Props[]; exec: () => void }[];\n} = { value: [] };\nexport const redrawQueueTimeout: { value: null | number } = { value: null };\nexport const nodeChildKeyList: { value: NodeChildKey[] } = { value: [] };\n\nexport const pushNodeChildKey = (key: Props) =>\n nodeChildKeyList.value.forEach(item => item.value.push(key));\n\nexport const removeNodeChildKey = (item: NodeChildKey) => {\n nodeChildKeyList.value.splice(nodeChildKeyList.value.indexOf(item), 1);\n};\n\nexport const cleanNodeChildKey = () => (nodeChildKeyList.value = []);\n\n/**\n * DataStore\n */\nexport const dataStoreStore: { [key: string]: UseDataStoreValue } = {};\nexport const dataStoreRenderQueue: {\n [key: string]: (() => boolean)[];\n} = {};\n\n/**\n * Router\n */\nexport const routerParams: { value: { [key: string]: string } } = { value: {} };\n\nexport const componentRender = (componentKey: Props) => () => {\n const up = componentRef.get(componentKey)?.up;\n if (up) {\n up();\n return true;\n } else {\n return false;\n }\n};\n\nexport const setComponetRef = (componentKey: Props) => {\n componentRef.set(componentKey, {\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 = ({\n componentKey,\n nodeChildKey,\n exec,\n}: {\n componentKey: Props;\n nodeChildKey: { value: Props[] };\n exec: () => void;\n}) => {\n componentRef.get(componentKey)!.up = () => {\n redrawQueue.value.push({\n componentKey,\n nodeChildKey: nodeChildKey.value,\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 execRedrawQueue = () => {\n let childItemList: Props[] = [];\n\n redrawQueue.value.forEach(item => {\n childItemList = childItemList.concat(item.nodeChildKey);\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, nodeChildKey } = newWDom;\n const childKeys = nodeChildKey?.value;\n\n if (componentKey) {\n removeItem(componentKey);\n }\n\n if (childKeys) {\n childKeys.forEach(childKey => removeItem(childKey));\n }\n};\n\nconst removeItem = (componentKey: Props) => {\n const queue = componentRef.get(componentKey)!.umts;\n componentRef.get(componentKey)!.umts = [];\n queue.forEach(effect => effect());\n componentRef.delete(componentKey);\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","/**\n * Rerender시 실제 dom에 반영해줘야 하는 상태\n *\n * 1. (ADD). 가상돔 비교시 오리지날이 없으면 새로 추가되는 dom으로 판단한다.\n * 2. (REPLACE). 오리지날이 있고 같은 엘리먼트타입이 아닌 경우 해당 위치의 태그 자체를 교체해준다.\n * 3. (UPDATE). 오리지날이 있고 같은 타입이면 dom의 속성만 변경해 주며, 텍스트 노드일 경우는 텍스트를 교체해준다.\n * 4. (DELETE). 오리지날이 있고 새로운 엘리먼트 타입은 null타입일 경우 dom을 삭제한다.\n * 5. (SORTED-REPLACE). loop의 경우 REPLACE라도 키값에 의해 순서가 변경될 수 있으므로 새로운 dom을 단순히 기존 위치에 교체하지 않고 새로 삼입하여 정렬한다.\n * 6. (SORTED-UPDATE). loop의 경우 UPDATE라도 키값에 의해 순서가 변경될수 있으므로 재 삽입하여 정렬한다.\n * 7. (NONE). text타입의 경우 text가 같다면 변경이 필요 없으므로 방치한다. (Todo. 다른 타입의 경우 처리필요)\n */\n\nimport { WDom, Props } from '@/types';\nimport {\n checkStyleData,\n checkRefData,\n checkNormalAttribute,\n checkExisty,\n checkOptionElement,\n} from '@/utils/predicator';\nimport { runMountedQueueFromWDom } from '@/hook/mountCallback';\nimport { runUpdatedQueueFromWDom } from '@/hook/useUpdate';\nimport { getParent } from '@/utils';\n\nexport const render = (\n wDom: WDom,\n wrapElement: HTMLElement | null,\n afterElement?: HTMLElement | null\n) => {\n if (!wrapElement) {\n throw Error('WrapELement is null');\n }\n wDom.isRoot = true;\n wDom.wrapElement = wrapElement;\n\n const Dom = wDomToDom(wDom, true);\n\n if (afterElement) {\n wrapElement.insertBefore(Dom, afterElement);\n } else {\n wrapElement.appendChild(Dom);\n }\n};\n\nexport const wDomUpdate = (newWDomTree: WDom) => {\n const { needRerender } = newWDomTree;\n\n if (needRerender && needRerender !== 'N') {\n const exec = {\n A: typeAdd,\n D: typeDelete,\n R: typeReplace,\n U: typeUpdate,\n SR: typeSortedReplace,\n SU: typeSortedUpdate,\n }[needRerender];\n exec(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 typeDelete = (newWDom: WDom) => {\n const parent = findRealParentElement(newWDom);\n\n if (newWDom.oldProps && newWDom.el) {\n removeEvent(newWDom.oldProps, newWDom.el);\n }\n\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?.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, true);\n }\n\n const parentWDom = getParent(newWDom);\n if (parentWDom.type) {\n const parentEl = findRealParentElement(parentWDom);\n const nextEl = 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 }\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 const parentElement = parentWDom.el;\n const newElement = wDomToDom(newWDom, true);\n\n if (newWDom.oldProps) {\n removeEvent(newWDom.oldProps, orignalElement);\n }\n\n if (parentElement) {\n parentElement.replaceChild(newElement, orignalElement);\n }\n }\n\n runMountedQueueFromWDom(newWDom);\n};\n\nconst removeEvent = (\n oldProps: Props,\n element?: HTMLElement | DocumentFragment | Text\n) => {\n if (element) {\n Object.entries(oldProps || {}).forEach(\n ([dataKey, dataValue]: [string, unknown]) => {\n if (dataKey.match(/^on/)) {\n element.removeEventListener(dataKey, 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({ oldProps, props, element });\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 oldProps,\n props,\n element,\n}: {\n oldProps?: Props;\n props?: Props;\n element?: HTMLElement | DocumentFragment | Text;\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 (checkStyleData(dataKey, dataValue)) {\n const style = dataValue;\n const oldStyle = checkStyleData(dataKey, originalProps.style) || {};\n\n updateStyle({ style, oldStyle, element });\n } else if (checkRefData(dataKey, dataValue)) {\n dataValue.value = element;\n } else if (dataKey.match(/^on/)) {\n updateEvent({\n element: element as HTMLElement,\n eventKey: dataKey,\n newEventHandler: dataValue as (e: Event) => void,\n oldEventHandler: originalProps[dataKey] as (e: Event) => void,\n });\n } else if (checkNormalAttribute(dataValue)) {\n (element as HTMLElement).setAttribute(dataKey, String(dataValue));\n } else if (checkOptionElement(element) && dataKey === 'selected') {\n (element as HTMLOptionElement).selected = !!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, init: boolean) => {\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 }\n\n wDomChildrenToDom(children, element, init);\n updateProps({ props, element });\n\n wDom.el = element;\n\n runMountedQueueFromWDom(wDom);\n\n return element || document.createElement('div');\n};\n\nconst wDomChildrenToDom = (\n children: WDom[],\n parentElement?: HTMLElement | DocumentFragment | Text,\n init?: boolean\n) => {\n if (init) {\n const elementChildren = children.reduce(\n (acc: DocumentFragment, childItem: WDom) => {\n if (childItem.type) {\n acc.appendChild(wDomToDom(childItem, init));\n }\n\n return acc;\n },\n new DocumentFragment()\n );\n\n if (parentElement && elementChildren.hasChildNodes()) {\n parentElement.appendChild(elementChildren);\n }\n }\n};\n\nconst updateEvent = ({\n element,\n eventKey,\n newEventHandler,\n oldEventHandler,\n}: {\n element: HTMLElement;\n eventKey: string;\n newEventHandler: (e: Event) => void;\n oldEventHandler: (e: Event) => void;\n}) => {\n const eventName = eventKey.replace(/^on(.*)/, (_match, p1) =>\n p1.toLowerCase()\n );\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,\n oldStyle,\n element,\n}: {\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.setProperty(styleKey, dataValue);\n delete originalStyle[styleKey];\n });\n\n Object.entries(originalStyle).forEach(([styleKey]) =>\n elementStyle.removeProperty(styleKey)\n );\n }\n};\n\nconst findRealParentElement = (\n vDom: WDom\n): HTMLElement | DocumentFragment | Text | undefined => {\n const isVirtualType =\n vDom.type === 'fragment' ||\n vDom.type === 'loop' ||\n (!vDom.type && vDom?.el?.nodeType === 11);\n\n if (vDom.isRoot && isVirtualType) {\n return vDom.wrapElement;\n }\n\n if (!isVirtualType) {\n return vDom.el?.parentNode as HTMLElement;\n }\n\n const parentVDom = getParent(vDom);\n\n return findRealParentElement(parentVDom);\n};\n","/**\n * 변경점의 컴포넌트로 부터 기존트리와 상태를 비교하며 새로 가상돔 트리를 새로 만든다.\n * (오리지널 가상돔으로 부터 유의미한 상태를 유지해야 하는 경우를 판별하여 새로운 트리를 만듬)\n *\n * 1. 동일한 트리의 위치해 있고 오리지널과 컴포넌트의 타입이 같은경우 기존 상태를 계승한다.\n * 2. 동일한 컴포넌트가 아니라고 판단되는 경우에는 기존 상태를 무시하는 새로운 트리를 생성한다.\n * 3. fragment타입의 경우에는 children의 갯수까지 같아야지 같은 타입이라고 판단한다.\n * 4. loop타입의 자식들은 같은 키값을 가졌는지로 동일한지 판단하며 키값이 없을경우 fragment타입처럼 취급한다.\n */\nimport { 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';\nimport { removeNodeChildKey } from '@/utils/universalRef';\n\ntype DiffPrimaryParam = {\n originalWDom?: WDom;\n newWDom: WDom | TagFunctionResolver;\n isSameType: boolean;\n};\n\ntype DiffSecondeParam = {\n originalWDom?: WDom;\n newWDom: WDom;\n isSameType: boolean;\n};\n\nexport const makeNewWDomTree = ({\n originalWDom,\n newWDom,\n}: {\n originalWDom?: WDom;\n newWDom: WDom | TagFunctionResolver;\n}) => {\n const type = getWDomType(newWDom);\n\n if (!type) {\n throw new Error('Unknown type wdom');\n }\n const isSameType = checkSameWDomWithOriginal[type]({ originalWDom, newWDom });\n\n const result = remakeNewWDom({ originalWDom, newWDom, isSameType });\n\n if (result?.nodeChildKey) {\n removeNodeChildKey(result.nodeChildKey);\n }\n\n return result;\n};\n\nconst remakeNewWDom = ({\n newWDom,\n originalWDom,\n isSameType,\n}: DiffPrimaryParam) => {\n const remakeWDom = generalize({ newWDom, originalWDom, isSameType });\n\n remakeWDom.children = remakeChildrenForDiff({\n isSameType,\n newWDom: remakeWDom,\n originalWDom,\n });\n\n const needRerender = addReRenderTypeProperty({\n originalWDom,\n newWDom: remakeWDom,\n isSameType,\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.children = originalWDom.children;\n }\n\n remakeWDom.oldProps = originalWDom?.props;\n\n return remakeWDom;\n};\n\nconst addReRenderTypeProperty = ({\n originalWDom,\n newWDom,\n isSameType,\n}: DiffSecondeParam): 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,\n originalWDom,\n isSameType,\n}: DiffPrimaryParam): 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 isSameType,\n newWDom,\n originalWDom,\n}: DiffSecondeParam) =>\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({ newWDom: 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 newWDom: item,\n originalWDom: (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 && 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({\n newWDom: item,\n originalWDom: originalItem,\n });\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 NodeChildKey,\n Component,\n} from '@/types';\n\nimport { makeNewWDomTree } from '@/diff';\nimport { wDomUpdate } from '@/render';\nimport {\n initUpdateHookState,\n initMountHookState,\n setRedrawAction,\n needDiffRef,\n pushNodeChildKey,\n nodeChildKeyList,\n removeNodeChildKey,\n cleanNodeChildKey,\n componentRender,\n} from '@/utils/universalRef';\nimport { runUpdateCallback } from '@/hook/updateCallback';\nimport {\n checkFragmentFunction,\n checkCustemComponentFunction,\n} from '@/utils/predicator';\n\nexport type Children = WDom[];\n\ntype WDomInfoParam = {\n componentMaker: () => WDom;\n componentKey: Props;\n tag: TagFunction;\n props: Props;\n children: WDom[];\n nodeChildKey: { value: Props[] };\n};\ntype WDomInfoWithRenderParam = WDomInfoParam & {\n reRender: () => WDom;\n};\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({\n tag,\n props: newProps,\n children: newChildren,\n });\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,\n props,\n children,\n originalWDom,\n}: {\n tag: TagFunction;\n props: Props;\n children: WDom[];\n originalWDom: WDom;\n}) => {\n needDiffRef.value = true;\n cleanNodeChildKey();\n\n const newWDom = makeWDomResolver({ tag, props, children });\n const newWDomTree = makeNewWDomTree({ originalWDom, newWDom });\n const { isRoot, getParent, wrapElement } = 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 }\n\n wDomUpdate(newWDomTree);\n\n needDiffRef.value = false;\n};\n\nconst makeWDomResolver = ({\n tag,\n props,\n children,\n}: {\n tag: TagFunction;\n props: Props;\n children: WDom[];\n}) => {\n const tagName = tag.name;\n const constructor = tag;\n // 리졸브는 컴포넌트를 새로 만든다.\n const resolve = (componentKey = props) => {\n initMountHookState(componentKey);\n\n const nodeChildKey: NodeChildKey = { value: [] };\n pushNodeChildKey(componentKey);\n nodeChildKeyList.value.push(nodeChildKey);\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 nodeChildKey,\n });\n\n const originalWDom = customNode;\n\n setRedrawAction({\n componentKey,\n nodeChildKey,\n exec: () =>\n reRenderCustomComponent({ tag, props, children, originalWDom }),\n });\n\n // update의 경우 diff 에서 제거\n if (!needDiffRef.value) {\n removeNodeChildKey(nodeChildKey);\n }\n\n return customNode;\n };\n\n return { tagName, constructor, props, children, resolve };\n};\n\nconst makeCustomNode = (wDomInfo: WDomInfoParam) => {\n const { componentMaker } = wDomInfo;\n const customNode = componentMaker();\n const reRender = makeReRender(wDomInfo);\n\n addComponentProps(customNode, { ...wDomInfo, reRender });\n\n return customNode;\n};\n\nconst makeReRender = (wDomInfo: WDomInfoParam) => {\n const reRender = () => wDomMaker({ ...wDomInfo, reRender });\n\n return reRender;\n};\n\nconst wDomMaker = (wDomInfo: WDomInfoWithRenderParam) => {\n const { componentMaker, componentKey, tag, props, children } = wDomInfo;\n\n initUpdateHookState(componentKey);\n runUpdateCallback();\n\n const nodeChildKey: NodeChildKey = { value: [] };\n pushNodeChildKey(componentKey);\n nodeChildKeyList.value.push(nodeChildKey);\n\n const originalWDom = componentMaker();\n\n wDomInfo.nodeChildKey = nodeChildKey;\n\n setRedrawAction({\n componentKey,\n nodeChildKey,\n exec: () => reRenderCustomComponent({ tag, props, children, originalWDom }),\n });\n\n addComponentProps(originalWDom, wDomInfo);\n\n // update의 경우 diff 에서 제거\n if (!needDiffRef.value) {\n removeNodeChildKey(nodeChildKey);\n }\n\n return originalWDom;\n};\n\nconst addComponentProps = (wDom: WDom, info: WDomInfoWithRenderParam) => {\n const { componentKey, tag, props, children, reRender, nodeChildKey } = info;\n\n Object.assign(wDom, {\n componentProps: props,\n componentChildren: children,\n constructor: tag,\n tagName: tag.name,\n componentKey,\n nodeChildKey,\n reRender,\n });\n};\n\nconst makeNode = ({\n tag,\n props,\n children,\n}: {\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","import { h, Fragment, mount } from '@/wDom';\nimport { render } from '@/render';\nimport { mountCallback } from '@/hook/mountCallback';\nimport { updateCallback } from '@/hook/updateCallback';\nimport { ref } from '@/hook/ref';\nimport { checkFunction } from '@/utils/predicator';\nimport {\n componentRef,\n componentKeyRef,\n dataStoreStore,\n dataStoreRenderQueue,\n getComponentKey,\n componentRender,\n} from '@/utils/universalRef';\n\nconst ext = {\n componentRef,\n componentKeyRef,\n dataStoreStore,\n dataStoreRenderQueue,\n checkFunction,\n getComponentKey,\n componentRender,\n};\n\nexport type {\n WDom,\n TagFunction,\n TagFunctionResolver,\n FragmentFunction,\n ComponentSubKey,\n ComponentRef,\n Props,\n Renew,\n MiddleStateWDomChildren,\n MiddleStateWDom,\n UseDataStoreValue,\n NodePointer,\n Param,\n} from '@/types';\n\ndeclare global {\n namespace JSX {\n interface IntrinsicElements {\n [name: string]: any;\n }\n }\n}\n\nexport { h, Fragment, render, mount, mountCallback, updateCallback, ref, ext };\n","export const ref = <T>(initValue: T) => ({ value: initValue });\n"],"names":["checkCustemComponentFunction","target","checkFragmentFunction","Fragment","checkPlainWDomType","wDom","checkPlainType","typeName","type","checkEmptyElement","checkNormalTypeElement","originalWDom","newWDom","checkExisty","value","checkStyleData","dataKey","dataValue","checkSameWDomWithOriginal","c","constructor","l","t","e","tag","f","_a","children","length","_b","et","getParent","vDom","parentVDom","Error","updateProps","props","infoProps","Object","keys","forEach","key","entries","updateChildren","infoChidren","splice","childrenItem","push","componentKeyRef","needDiffRef","componentRef","WeakMap","redrawQueue","redrawQueueTimeout","nodeChildKeyList","pushNodeChildKey","item","removeNodeChildKey","indexOf","componentRender","componentKey","up","get","getComponentKey","setRedrawAction","nodeChildKey","exec","setTimeout","execRedrawQueue","initMountHookState","set","upR","upS","upD","upCB","mts","umts","setComponetRef","childItemList","concat","addedKey","result","reduce","acc","includes","action","shift","removeItem","queue","effect","delete","runMountedQueueFromWDom","component","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","parent","findRealParentElement","oldProps","nodeType","removeChild","findChildWithRemoveElement","newElement","wDomToDom","parentWDom","parentEl","nextEl","startFindNextBrotherElement","insertBefore","appendChild","brothers","nextIndex","candidiateBrothers","slice","finedNextEl","findChildFragmentNextElement","parentType","isRoot","targetEl","bItem","isFragment","orignalElement","parentElement","replaceChild","element","match","removeEventListener","String","runUpdatedQueueFromWDom","updateText","nodeValue","text","originalProps","style","oldStyle","updateStyle","checkRefData","updateEvent","eventKey","newEventHandler","oldEventHandler","checkNormalAttribute","setAttribute","tagName","checkOptionElement","selected","removeAttribute","init","DocumentFragment","document","createElement","createTextNode","wDomChildrenToDom","elementChildren","hasChildNodes","eventName","replace","_match","p1","toLowerCase","addEventListener","originalStyle","elementStyle","styleKey","setProperty","removeProperty","isVirtualType","wrapElement","parentNode","makeNewWDomTree","getWDomType","isSameType","remakeNewWDom","remakeWDom","generalize","remakeChildrenForDiff","addReRenderTypeProperty","childKeys","childKey","runUnmountQueueFromWDom","existOriginalWDom","isEmptyElement","getKey","isKeyCheckedWDom","isSameText","infoVdom","componentProps","componentChildren","newVDom","reRender","resolve","remakeChildrenForUpdate","remakeChildrenForAdd","map","remakeChildrenForLoopUpdate","remakedChildren","unUsedChildren","diffLoopChildren","unusedItem","newChildren","originalChildren","originalItem","findSameKeyOriginalItem","find","orignalChildItem","_c","_props","reRenderCustomComponent","makeWDomResolver","name","componentMaker","customNode","makeCustomNode","wDomInfo","makeReRender","addComponentProps","wDomMaker","initUpdateHookState","updateReqs","info","assign","makeNode","componetMakeResolver","remakeChildren","nodeParentPointer","makeChildrenItem","Array","isArray","node","ext","dataStoreStore","dataStoreRenderQueue","checkFunction","newProps","_children","initValue","afterElement","Dom"],"mappings":"+OAwBO,MAAMA,EACXC,GAEmB,mBAAXA,IAA0BC,EAAsBD,IACrC,iBAAXA,GAAuB,YAAaA,EAEjCC,EACXD,GAEkB,mBAAXA,GAAyBA,IAAWE,GAEhCC,EAAsBC,GACjB,iBAATA,KAAuB,YAAaA,GAEhCC,EAAiB,CAACD,EAAiBE,IAC9CH,EAAmBC,IAASA,EAAKG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6C4BlQ,GACV,mBAAXA,EU7CP8D,kBACAJ,8CF4Be,CACfnC,EACAY,KACGT,KAEG,MAAAgO,EAAiC,CAAE7O,WAAO,GAC1CsP,EAAWhO,GAAS,GACpB8L,EAAcwB,GAAeC,EAAmBhO,GAChDoO,EAAOP,GAAS,CACpBhO,MACAY,MAAOgO,EACPzO,SAAUuM,IAOL,OAJFlO,EAA6B+P,KAChCJ,EAAkB7O,MAAQiP,GAGrBA,CAAA,UAIHnK,GACJ,CAAC6I,EAAW4B,IACVzK,kBJjE0BG,IAChB7C,EAAaY,IAAIC,KAAoBY,IAE7C5B,KAAKgD,EAAY,QOZAuK,IAAkB,CAAExP,MAAOwP,aLwB5B,CACpBjQ,EACA6L,EACAqE,KAEA,IAAKrE,EACH,MAAMhK,MAAM,uBAEd7B,EAAK2I,QAAS,EACd3I,EAAK6L,YAAcA,EAEb,MAAAsE,EAAMtI,EAAU7H,GAAM,GAExBkQ,EACUrE,EAAA3D,aAAaiI,EAAKD,GAE9BrE,EAAY1D,YAAYgI,EAC1B,mBGhC4B,CAC5BzK,EACAE,EAA4B,KAAM,OAEf/C,EAAaY,IAAIC,KAAoBQ,IAE7CxB,MAAK,IAAMiD,EAAWD,EAAcE,KAC/CD,EAAWD,EAAcE,EAAY"}
|
|
1
|
+
{"version":3,"file":"lithent.umd.js","sources":["../src/utils/predicator.ts","../src/utils/index.ts","../src/utils/universalRef.ts","../src/hook/unmount.ts","../src/hook/mountCallback.ts","../src/hook/useUpdate.ts","../src/render.ts","../src/diff.ts","../src/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 DiffParam = {\n originalWDom?: WDom;\n newWDom: WDom | TagFunction | TagFunctionResolver;\n};\n\ntype WDomParam =\n | string\n | WDom\n | TagFunction\n | TagFunctionResolver\n | FragmentFunction;\n\n/**\n * Predicator\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 checkPlainWDomType = (wDom: WDomParam): wDom is WDom =>\n typeof wDom === 'object' && !('resolve' in wDom);\n\nexport const checkPlainType = (wDom: WDomParam, typeName: string) =>\n checkPlainWDomType(wDom) && wDom.type === typeName;\n\nexport const checkEmptyElement = (wDom: WDomParam) =>\n checkPlainWDomType(wDom) && !wDom.type;\n\nexport const checkSameCustomComponent = ({\n originalWDom,\n newWDom,\n}: DiffParam) => newWDom.constructor === originalWDom?.constructor;\n\nexport const checkSameFragment = ({ originalWDom, newWDom }: DiffParam) =>\n checkPlainWDomType(newWDom) &&\n originalWDom?.type === 'fragment' &&\n originalWDom?.children?.length === newWDom?.children?.length;\n\nexport const checkSameTagElement = ({ originalWDom, newWDom }: DiffParam) =>\n checkPlainWDomType(newWDom) &&\n originalWDom?.type === 'element' &&\n originalWDom?.tag === newWDom.tag;\n\nexport const checkNormalTypeElement = ({ originalWDom, newWDom }: DiffParam) =>\n checkPlainWDomType(newWDom) && originalWDom?.type === newWDom.type;\n\nexport const checkExisty = (value: unknown) =>\n value !== null && value !== undefined;\n\nexport const checkFunction = (target: unknown): target is Function =>\n typeof target === 'function';\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 return element.nodeType === 1 && element.tagName === 'OPTION';\n};\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 | undefined => {\n let result: WDomType | undefined;\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 if (!parentVDom) {\n throw Error('Not found parent vDom');\n }\n\n return parentVDom;\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 if (!newVDom) {\n throw Error('Unable reRender');\n }\n\n return newVDom;\n};\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, NodeChildKey } from '@/types';\n\ntype redrawQueueList = {\n componentKey: Props;\n nodeChildKey: 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; nodeChildKey: Props[]; exec: () => void }[];\n} = { value: [] };\nexport const redrawQueueTimeout: { value: null | number } = { value: null };\nexport const nodeChildKeyList: { value: NodeChildKey[] } = { value: [] };\n\nexport const pushNodeChildKey = (key: Props) =>\n nodeChildKeyList.value.forEach(item => item.value.push(key));\n\nexport const removeNodeChildKey = (item: NodeChildKey) => {\n nodeChildKeyList.value.splice(nodeChildKeyList.value.indexOf(item), 1);\n};\n\nexport const cleanNodeChildKey = () => (nodeChildKeyList.value = []);\n\nexport const startMakeNodeChildKey = (componentKey: Props) => {\n const nodeChildKey: NodeChildKey = { value: [] };\n pushNodeChildKey(componentKey);\n nodeChildKeyList.value.push(nodeChildKey);\n\n return nodeChildKey;\n};\n\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\nexport const setComponetRef = (componentKey: Props) => {\n componentRef.set(componentKey, {\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 = ({\n componentKey,\n nodeChildKey,\n exec,\n}: {\n componentKey: Props;\n nodeChildKey: { value: Props[] };\n exec: () => void;\n}) => {\n componentRef.get(componentKey)!.up = () => {\n redrawQueue.value.push({\n componentKey,\n nodeChildKey: nodeChildKey.value,\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 execRedrawQueue = () => {\n let childItemList: Props[] = [];\n\n redrawQueue.value.forEach(item => {\n childItemList = childItemList.concat(item.nodeChildKey);\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, nodeChildKey } = newWDom;\n const childKeys = nodeChildKey?.value;\n\n if (componentKey) {\n removeItem(componentKey);\n }\n\n if (childKeys) {\n childKeys.forEach(childKey => removeItem(childKey));\n }\n};\n\nconst removeItem = (componentKey: Props) => {\n const queue = componentRef.get(componentKey)!.umts;\n componentRef.get(componentKey)!.umts = [];\n queue.forEach(effect => effect());\n componentRef.delete(componentKey);\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","/**\n * Rerender시 실제 dom에 반영해줘야 하는 상태\n *\n * 1. (ADD). 가상돔 비교시 오리지날이 없으면 새로 추가되는 dom으로 판단한다.\n * 2. (REPLACE). 오리지날이 있고 같은 엘리먼트타입이 아닌 경우 해당 위치의 태그 자체를 교체해준다.\n * 3. (UPDATE). 오리지날이 있고 같은 타입이면 dom의 속성만 변경해 주며, 텍스트 노드일 경우는 텍스트를 교체해준다.\n * 4. (DELETE). 오리지날이 있고 새로운 엘리먼트 타입은 null타입일 경우 dom을 삭제한다.\n * 5. (SORTED-REPLACE). loop의 경우 REPLACE라도 키값에 의해 순서가 변경될 수 있으므로 새로운 dom을 단순히 기존 위치에 교체하지 않고 새로 삼입하여 정렬한다.\n * 6. (SORTED-UPDATE). loop의 경우 UPDATE라도 키값에 의해 순서가 변경될수 있으므로 재 삽입하여 정렬한다.\n * 7. (NONE). text타입의 경우 text가 같다면 변경이 필요 없으므로 방치한다. (Todo. 다른 타입의 경우 처리필요)\n */\n\nimport { WDom, Props } from '@/types';\nimport {\n checkStyleData,\n checkRefData,\n checkNormalAttribute,\n checkExisty,\n checkOptionElement,\n} from '@/utils/predicator';\nimport { runMountedQueueFromWDom } from '@/hook/mountCallback';\nimport { runUpdatedQueueFromWDom } from '@/hook/useUpdate';\nimport { getParent } from '@/utils';\n\nexport const render = (\n wDom: WDom,\n wrapElement: HTMLElement | null,\n afterElement?: HTMLElement | null\n) => {\n if (!wrapElement) {\n throw Error('WrapELement is null');\n }\n wDom.isRoot = true;\n wDom.wrapElement = wrapElement;\n\n const Dom = wDomToDom(wDom, true);\n\n if (afterElement) {\n wrapElement.insertBefore(Dom, afterElement);\n } else {\n wrapElement.appendChild(Dom);\n }\n};\n\nexport const wDomUpdate = (newWDomTree: WDom) => {\n const { needRerender } = newWDomTree;\n\n if (needRerender && needRerender !== 'N') {\n const exec = {\n A: typeAdd,\n D: typeDelete,\n R: typeReplace,\n U: typeUpdate,\n SR: typeSortedReplace,\n SU: typeSortedUpdate,\n }[needRerender];\n exec(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 typeDelete = (newWDom: WDom) => {\n const parent = findRealParentElement(newWDom);\n\n if (newWDom.oldProps && newWDom.el) {\n removeEvent(newWDom.oldProps, newWDom.el);\n }\n\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?.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, true);\n }\n\n const parentWDom = getParent(newWDom);\n if (parentWDom.type) {\n const parentEl = findRealParentElement(parentWDom);\n const nextEl = 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 }\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 const parentElement = parentWDom.el;\n const newElement = wDomToDom(newWDom, true);\n\n if (newWDom.oldProps) {\n removeEvent(newWDom.oldProps, orignalElement);\n }\n\n if (parentElement) {\n parentElement.replaceChild(newElement, orignalElement);\n }\n }\n\n runMountedQueueFromWDom(newWDom);\n};\n\nconst removeEvent = (\n oldProps: Props,\n element?: HTMLElement | DocumentFragment | Text\n) => {\n if (element) {\n Object.entries(oldProps || {}).forEach(\n ([dataKey, dataValue]: [string, unknown]) => {\n if (dataKey.match(/^on/)) {\n element.removeEventListener(dataKey, 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({ oldProps, props, element });\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 oldProps,\n props,\n element,\n}: {\n oldProps?: Props;\n props?: Props;\n element?: HTMLElement | DocumentFragment | Text;\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 (checkStyleData(dataKey, dataValue)) {\n const style = dataValue;\n const oldStyle = checkStyleData(dataKey, originalProps.style) || {};\n\n updateStyle({ style, oldStyle, element });\n } else if (checkRefData(dataKey, dataValue)) {\n dataValue.value = element;\n } else if (dataKey.match(/^on/)) {\n updateEvent({\n element: element as HTMLElement,\n eventKey: dataKey,\n newEventHandler: dataValue as (e: Event) => void,\n oldEventHandler: originalProps[dataKey] as (e: Event) => void,\n });\n } else if (checkNormalAttribute(dataValue)) {\n (element as HTMLElement).setAttribute(dataKey, String(dataValue));\n } else if (checkOptionElement(element) && dataKey === 'selected') {\n (element as HTMLOptionElement).selected = !!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, init: boolean) => {\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 }\n\n wDomChildrenToDom(children, element, init);\n updateProps({ props, element });\n\n wDom.el = element;\n\n runMountedQueueFromWDom(wDom);\n\n return element || document.createElement('div');\n};\n\nconst wDomChildrenToDom = (\n children: WDom[],\n parentElement?: HTMLElement | DocumentFragment | Text,\n init?: boolean\n) => {\n if (init) {\n const elementChildren = children.reduce(\n (acc: DocumentFragment, childItem: WDom) => {\n if (childItem.type) {\n acc.appendChild(wDomToDom(childItem, init));\n }\n\n return acc;\n },\n new DocumentFragment()\n );\n\n if (parentElement && elementChildren.hasChildNodes()) {\n parentElement.appendChild(elementChildren);\n }\n }\n};\n\nconst updateEvent = ({\n element,\n eventKey,\n newEventHandler,\n oldEventHandler,\n}: {\n element: HTMLElement;\n eventKey: string;\n newEventHandler: (e: Event) => void;\n oldEventHandler: (e: Event) => void;\n}) => {\n const eventName = eventKey.replace(/^on(.*)/, (_match, p1) =>\n p1.toLowerCase()\n );\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,\n oldStyle,\n element,\n}: {\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.setProperty(styleKey, dataValue);\n delete originalStyle[styleKey];\n });\n\n Object.entries(originalStyle).forEach(([styleKey]) =>\n elementStyle.removeProperty(styleKey)\n );\n }\n};\n\nconst findRealParentElement = (\n vDom: WDom\n): HTMLElement | DocumentFragment | Text | undefined => {\n const isVirtualType =\n vDom.type === 'fragment' ||\n vDom.type === 'loop' ||\n (!vDom.type && vDom?.el?.nodeType === 11);\n\n if (vDom.isRoot && isVirtualType) {\n return vDom.wrapElement;\n }\n\n if (!isVirtualType) {\n return vDom.el?.parentNode as HTMLElement;\n }\n\n const parentVDom = getParent(vDom);\n\n return findRealParentElement(parentVDom);\n};\n","/**\n * 변경점의 컴포넌트로 부터 기존트리와 상태를 비교하며 새로 가상돔 트리를 새로 만든다.\n * (오리지널 가상돔으로 부터 유의미한 상태를 유지해야 하는 경우를 판별하여 새로운 트리를 만듬)\n *\n * 1. 동일한 트리의 위치해 있고 오리지널과 컴포넌트의 타입이 같은경우 기존 상태를 계승한다.\n * 2. 동일한 컴포넌트가 아니라고 판단되는 경우에는 기존 상태를 무시하는 새로운 트리를 생성한다.\n * 3. fragment타입의 경우에는 children의 갯수까지 같아야지 같은 타입이라고 판단한다.\n * 4. loop타입의 자식들은 같은 키값을 가졌는지로 동일한지 판단하며 키값이 없을경우 fragment타입처럼 취급한다.\n */\nimport { 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';\nimport { removeNodeChildKey } from '@/utils/universalRef';\n\ntype DiffPrimaryParam = {\n originalWDom?: WDom;\n newWDom: WDom | TagFunctionResolver;\n isSameType: boolean;\n};\n\ntype DiffSecondeParam = {\n originalWDom?: WDom;\n newWDom: WDom;\n isSameType: boolean;\n};\n\nexport const makeNewWDomTree = ({\n originalWDom,\n newWDom,\n}: {\n originalWDom?: WDom;\n newWDom: WDom | TagFunctionResolver;\n}) => {\n const type = getWDomType(newWDom);\n\n if (!type) {\n throw new Error('Unknown type wdom');\n }\n const isSameType = checkSameWDomWithOriginal[type]({ originalWDom, newWDom });\n\n const result = remakeNewWDom({ originalWDom, newWDom, isSameType });\n\n if (result?.nodeChildKey) {\n removeNodeChildKey(result.nodeChildKey);\n }\n\n return result;\n};\n\nconst remakeNewWDom = ({\n newWDom,\n originalWDom,\n isSameType,\n}: DiffPrimaryParam) => {\n const remakeWDom = generalize({ newWDom, originalWDom, isSameType });\n\n remakeWDom.children = remakeChildrenForDiff({\n isSameType,\n newWDom: remakeWDom,\n originalWDom,\n });\n\n const needRerender = addReRenderTypeProperty({\n originalWDom,\n newWDom: remakeWDom,\n isSameType,\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.children = originalWDom.children;\n }\n\n remakeWDom.oldProps = originalWDom?.props;\n\n return remakeWDom;\n};\n\nconst addReRenderTypeProperty = ({\n originalWDom,\n newWDom,\n isSameType,\n}: DiffSecondeParam): 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,\n originalWDom,\n isSameType,\n}: DiffPrimaryParam): 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 isSameType,\n newWDom,\n originalWDom,\n}: DiffSecondeParam) =>\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({ newWDom: 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 newWDom: item,\n originalWDom: (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 && 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({\n newWDom: item,\n originalWDom: originalItem,\n });\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 removeNodeChildKey,\n cleanNodeChildKey,\n componentRender,\n startMakeNodeChildKey,\n} from '@/utils/universalRef';\nimport { runUpdateCallback } from '@/hook/updateCallback';\nimport {\n checkFragmentFunction,\n checkCustemComponentFunction,\n} from '@/utils/predicator';\n\nexport type Children = WDom[];\n\ntype WDomInfoParam = {\n componentMaker: () => WDom;\n componentKey: Props;\n tag: TagFunction;\n props: Props;\n children: WDom[];\n nodeChildKey: { value: Props[] };\n};\ntype WDomInfoWithRenderParam = WDomInfoParam & {\n reRender: () => WDom;\n};\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({\n tag,\n props: newProps,\n children: newChildren,\n });\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,\n props,\n children,\n originalWDom,\n}: {\n tag: TagFunction;\n props: Props;\n children: WDom[];\n originalWDom: WDom;\n}) => {\n needDiffRef.value = true;\n cleanNodeChildKey();\n\n const newWDom = makeWDomResolver({ tag, props, children });\n const newWDomTree = makeNewWDomTree({ originalWDom, newWDom });\n const { isRoot, getParent, wrapElement } = 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 }\n\n wDomUpdate(newWDomTree);\n\n needDiffRef.value = false;\n};\n\nconst makeWDomResolver = ({\n tag,\n props,\n children,\n}: {\n tag: TagFunction;\n props: Props;\n children: WDom[];\n}) => {\n const tagName = tag.name;\n const constructor = tag;\n // 리졸브는 컴포넌트를 새로 만든다.\n const resolve = (componentKey = props) => {\n initMountHookState(componentKey);\n\n const nodeChildKey = startMakeNodeChildKey(componentKey);\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 nodeChildKey,\n });\n\n const originalWDom = customNode;\n\n setRedrawAction({\n componentKey,\n nodeChildKey,\n exec: () =>\n reRenderCustomComponent({ tag, props, children, originalWDom }),\n });\n\n // update의 경우 diff 에서 제거\n if (!needDiffRef.value) {\n removeNodeChildKey(nodeChildKey);\n }\n\n return customNode;\n };\n\n return { tagName, constructor, props, children, resolve };\n};\n\nconst makeCustomNode = (wDomInfo: WDomInfoParam) => {\n const { componentMaker } = wDomInfo;\n const customNode = componentMaker();\n const reRender = makeReRender(wDomInfo);\n\n addComponentProps(customNode, { ...wDomInfo, reRender });\n\n return customNode;\n};\n\nconst makeReRender = (wDomInfo: WDomInfoParam) => {\n const reRender = () => wDomMaker({ ...wDomInfo, reRender });\n\n return reRender;\n};\n\nconst wDomMaker = (wDomInfo: WDomInfoWithRenderParam) => {\n const { componentMaker, componentKey, tag, props, children } = wDomInfo;\n\n initUpdateHookState(componentKey);\n runUpdateCallback();\n\n const nodeChildKey = startMakeNodeChildKey(componentKey);\n const originalWDom = componentMaker();\n\n wDomInfo.nodeChildKey = nodeChildKey;\n\n setRedrawAction({\n componentKey,\n nodeChildKey,\n exec: () => reRenderCustomComponent({ tag, props, children, originalWDom }),\n });\n\n addComponentProps(originalWDom, wDomInfo);\n\n // update의 경우 diff 에서 제거\n if (!needDiffRef.value) {\n removeNodeChildKey(nodeChildKey);\n }\n\n return originalWDom;\n};\n\nconst addComponentProps = (wDom: WDom, info: WDomInfoWithRenderParam) => {\n const { componentKey, tag, props, children, reRender, nodeChildKey } = info;\n\n Object.assign(wDom, {\n componentProps: props,\n componentChildren: children,\n constructor: tag,\n tagName: tag.name,\n componentKey,\n nodeChildKey,\n reRender,\n });\n};\n\nconst makeNode = ({\n tag,\n props,\n children,\n}: {\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":["checkCustemComponentFunction","target","checkFragmentFunction","Fragment","checkPlainWDomType","wDom","checkPlainType","typeName","type","checkEmptyElement","checkNormalTypeElement","originalWDom","newWDom","checkExisty","value","checkStyleData","dataKey","dataValue","checkSameWDomWithOriginal","c","constructor","l","t","e","tag","f","_a","children","length","_b","et","getParent","vDom","parentVDom","Error","updateProps","props","infoProps","Object","keys","forEach","key","entries","updateChildren","infoChidren","splice","childrenItem","push","componentKeyRef","needDiffRef","componentRef","WeakMap","redrawQueue","redrawQueueTimeout","nodeChildKeyList","removeNodeChildKey","item","indexOf","startMakeNodeChildKey","componentKey","nodeChildKey","getComponentKey","setRedrawAction","exec","get","up","setTimeout","execRedrawQueue","initMountHookState","set","upR","upS","upD","upCB","mts","umts","setComponetRef","childItemList","concat","addedKey","result","reduce","acc","includes","action","shift","removeItem","queue","effect","delete","runMountedQueueFromWDom","component","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","parent","findRealParentElement","oldProps","nodeType","removeChild","findChildWithRemoveElement","newElement","wDomToDom","parentWDom","parentEl","nextEl","startFindNextBrotherElement","insertBefore","appendChild","brothers","nextIndex","candidiateBrothers","slice","finedNextEl","findChildFragmentNextElement","parentType","isRoot","targetEl","bItem","isFragment","orignalElement","parentElement","replaceChild","element","match","removeEventListener","String","runUpdatedQueueFromWDom","updateText","nodeValue","text","originalProps","style","oldStyle","updateStyle","checkRefData","updateEvent","eventKey","newEventHandler","oldEventHandler","checkNormalAttribute","setAttribute","tagName","checkOptionElement","selected","removeAttribute","init","DocumentFragment","document","createElement","createTextNode","wDomChildrenToDom","elementChildren","hasChildNodes","eventName","replace","_match","p1","toLowerCase","addEventListener","originalStyle","elementStyle","styleKey","setProperty","removeProperty","isVirtualType","wrapElement","parentNode","makeNewWDomTree","getWDomType","isSameType","remakeNewWDom","remakeWDom","generalize","remakeChildrenForDiff","addReRenderTypeProperty","childKeys","childKey","runUnmountQueueFromWDom","existOriginalWDom","isEmptyElement","getKey","isKeyCheckedWDom","isSameText","infoVdom","componentProps","componentChildren","newVDom","reRender","resolve","remakeChildrenForUpdate","remakeChildrenForAdd","map","remakeChildrenForLoopUpdate","remakedChildren","unUsedChildren","diffLoopChildren","unusedItem","newChildren","originalChildren","originalItem","findSameKeyOriginalItem","find","orignalChildItem","_c","_props","reRenderCustomComponent","makeWDomResolver","name","componentMaker","componentRender","customNode","makeCustomNode","wDomInfo","makeReRender","addComponentProps","wDomMaker","initUpdateHookState","updateReqs","info","assign","makeNode","componetMakeResolver","remakeChildren","nodeParentPointer","makeChildrenItem","Array","isArray","node","newProps","_children","initValue","afterElement","Dom"],"mappings":"+OAwBO,MAAMA,EACXC,GAEmB,mBAAXA,IAA0BC,EAAsBD,IACrC,iBAAXA,GAAuB,YAAaA,EAEjCC,EACXD,GAEkB,mBAAXA,GAAyBA,IAAWE,GAEhCC,EAAsBC,GACjB,iBAATA,KAAuB,YAAaA,GAEhCC,EAAiB,CAACD,EAAiBE,IAC9CH,EAAmBC,IAASA,EAAKG,OAASD,EAE/BE,EAAqBJ,GAChCD,EAAmBC,KAAUA,EAAKG,KAiBvBE,EAAyB,EAAGC,eAAcC,aACrDR,EAAmBQ,KAA0B,MAAdD,OAAc,EAAAA,EAAAH,QAASI,EAAQJ,KAEnDK,EAAeC,GAC1BA,QAKWC,EAAiB,CAC5BC,EACAC,IAEY,UAAZD,GAA4C,iBAAdC,EAuCnBC,EAA4B,CACvCC,EApEsC,EACtCR,eACAC,aACeA,EAAQQ,eAA8B,MAAdT,OAAc,EAAAA,EAAAS,aAkErDC,EAAGX,EACHY,EAAGZ,EACHa,EA7DiC,EAAGZ,eAAcC,aAClDR,EAAmBQ,IACI,aAAT,MAAdD,OAAc,EAAAA,EAAAH,QACd,MAAAG,OAAA,EAAAA,EAAca,OAAQZ,EAAQY,IA2D9BC,EAnE+B,EAAGd,eAAcC,sBAC7B,OAAAR,EAAAQ,IACI,cAAvB,MAAAD,OAAA,EAAAA,EAAcH,QACd,OAAAkB,EAAc,MAAAf,OAAA,EAAAA,EAAAgB,eAAU,EAAAD,EAAAE,WAAW,OAAAC,EAAS,MAAAjB,OAAA,EAAAA,EAAAe,eAAU,EAAAE,EAAAD,OAAA,EAiEtDE,GAAIpB,GCnHOqB,EAAaC,IACxB,MAAMC,EAAaD,EAAKD,WAAaC,EAAKD,YAE1C,IAAKE,EACH,MAAMC,MAAM,yBAGP,OAAAD,CAAA,EAwBHE,EAAc,CAACC,EAAcC,KAC7BD,GAASC,IAAcD,IAClBE,OAAAC,KAAKH,G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mM,EAAiC,CAAE7O,WAAO,GAE1CiP,EAAO,CACXvP,KAAM,OACNmB,SAHe+N,GAAeC,EAAmBnM,IAO5C,OAFPmM,EAAkB7O,MAAQiP,EAEnBA,QACkB,iBAATvM,GAAqC,iBAATA,EACrC,CAAEhD,KAAM,OAAQqJ,KAAMrG,GAGxBA,CAAA,oBAlOQ,CACfhC,EACAY,KACGT,KAEG,MAAAgO,EAAiC,CAAE7O,WAAO,GAC1CkP,EAAW5N,GAAS,GACpB6L,EAAcyB,GAAeC,EAAmBhO,GAChDoO,EAAOP,GAAS,CACpBhO,MACAY,MAAO4N,EACPrO,SAAUsM,IAOL,OAJFjO,EAA6B+P,KAChCJ,EAAkB7O,MAAQiP,GAGrBA,CAAA,UAIHpK,GACJ,CAAC6I,EAAWyB,IACVtK,kBJ/D0BG,IAChB5C,EAAac,IAAIH,KAAoBa,IAE7C3B,KAAK+C,EAAY,QMZAoK,IAAkB,CAAEpP,MAAOoP,aJwB5B,CACpB7P,EACA4L,EACAkE,KAEA,IAAKlE,EACH,MAAM/J,MAAM,uBAEd7B,EAAK0I,QAAS,EACd1I,EAAK4L,YAAcA,EAEb,MAAAmE,EAAMnI,EAAU5H,GAAM,GAExB8P,EACUlE,EAAA3D,aAAa8H,EAAKD,GAE9BlE,EAAY1D,YAAY6H,EAC1B,mBGhC4B,CAC5BtK,EACAE,EAA4B,KAAM,OAEf9C,EAAac,IAAIH,KAAoBS,IAE7CvB,MAAK,IAAMgD,EAAWD,EAAcE,KAC/CD,EAAWD,EAAcE,EAAY"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentRef, ComponentSubKey, Props, NodeChildKey } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Common
|
|
4
4
|
*/
|
|
@@ -25,23 +25,7 @@ export declare const nodeChildKeyList: {
|
|
|
25
25
|
export declare const pushNodeChildKey: (key: Props) => void;
|
|
26
26
|
export declare const removeNodeChildKey: (item: NodeChildKey) => void;
|
|
27
27
|
export declare const cleanNodeChildKey: () => never[];
|
|
28
|
-
|
|
29
|
-
* DataStore
|
|
30
|
-
*/
|
|
31
|
-
export declare const dataStoreStore: {
|
|
32
|
-
[key: string]: UseDataStoreValue;
|
|
33
|
-
};
|
|
34
|
-
export declare const dataStoreRenderQueue: {
|
|
35
|
-
[key: string]: (() => boolean)[];
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Router
|
|
39
|
-
*/
|
|
40
|
-
export declare const routerParams: {
|
|
41
|
-
value: {
|
|
42
|
-
[key: string]: string;
|
|
43
|
-
};
|
|
44
|
-
};
|
|
28
|
+
export declare const startMakeNodeChildKey: (componentKey: Props) => NodeChildKey;
|
|
45
29
|
export declare const componentRender: (componentKey: Props) => () => boolean;
|
|
46
30
|
export declare const setComponetRef: (componentKey: Props) => void;
|
|
47
31
|
export declare const getComponentKey: () => Props;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const c of r)if(c.type==="childList")for(const l of c.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&o(l)}).observe(document,{childList:!0,subtree:!0});function n(r){const c={};return r.integrity&&(c.integrity=r.integrity),r.referrerpolicy&&(c.referrerPolicy=r.referrerpolicy),r.crossorigin==="use-credentials"?c.credentials="include":r.crossorigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function o(r){if(r.ep)return;r.ep=!0;const c=n(r);fetch(r.href,c)}})();const x=e=>typeof e=="function"&&!B(e)||typeof e=="object"&&"resolve"in e,B=e=>typeof e=="function"&&e===S,y=e=>typeof e=="object"&&!("resolve"in e),R=(e,t)=>y(e)&&e.type===t,Q=e=>y(e)&&!e.type,de=({originalWDom:e,newWDom:t})=>t.constructor===(e==null?void 0:e.constructor),ae=({originalWDom:e,newWDom:t})=>{var n,o;return y(t)&&(e==null?void 0:e.type)==="fragment"&&((n=e==null?void 0:e.children)==null?void 0:n.length)===((o=t==null?void 0:t.children)==null?void 0:o.length)},pe=({originalWDom:e,newWDom:t})=>y(t)&&(e==null?void 0:e.type)==="element"&&(e==null?void 0:e.tag)===t.tag,T=({originalWDom:e,newWDom:t})=>y(t)&&(e==null?void 0:e.type)===t.type,_=e=>e!=null,j=(e,t)=>e==="style"&&typeof t=="object",fe=(e,t)=>e==="ref"&&typeof t=="object",he=e=>e.nodeType===1&&e.tagName==="OPTION",ve=e=>typeof e=="number"||typeof e=="string",ye=e=>{let t;return x(e)?t="c":R(e,"fragment")?t="f":R(e,"element")?t="e":R(e,"loop")?t="l":R(e,"text")?t="t":Q(e)&&(t="et"),t},Ce={c:de,l:T,t:T,e:pe,f:ae,et:T},C=e=>{const t=e.getParent&&e.getParent();if(!t)throw Error("Not found parent vDom");return t},me=(e,t)=>{const{componentProps:n,componentChildren:o}=e,{props:r,children:c}=t;n&&ke(n,r),o&&Re(o,c);const l=e.reRender&&e.reRender();if(!l)throw Error("Unable reRender");return l},ke=(e,t)=>{e&&t!==e&&(Object.keys(e).forEach(n=>delete e[n]),Object.entries(t||{}).forEach(([n,o])=>e[n]=o))},Re=(e,t)=>{e&&t!==e&&(e.splice(0,e.length),t&&t.forEach(n=>e.push(n)))},m={value:{}},h={value:!1},a=new WeakMap,E={value:[]},U={value:null},v={value:[]},ge=e=>v.value.forEach(t=>t.value.push(e)),F=e=>{v.value.splice(v.value.indexOf(e),1)},Ee=()=>v.value=[],Y=e=>{const t={value:[]};return ge(e),v.value.push(t),t},Pe=e=>()=>{var t;const n=(t=a.get(e))==null?void 0:t.up;let o=!1;return n&&(n(),o=!0),o},xe=e=>{a.set(e,{up:()=>{},upR:[],upS:{value:0},upD:[],upCB:[],mts:[],umts:[]})},k=()=>m.value,z=({componentKey:e,nodeChildKey:t,exec:n})=>{a.get(e).up=()=>{E.value.push({componentKey:e,nodeChildKey:t.value,exec:n}),U.value||(U.value=setTimeout(Se))}},Ne=e=>m.value=e,be=e=>{m.value=e,xe(e)},Se=()=>{let e=[];E.value.forEach(o=>{e=e.concat(o.nodeChildKey)});const t=[],n=E.value.reduce((o,r)=>{const{componentKey:c}=r;return e.includes(c)||t.includes(c)||(t.push(c),o.push(r)),o},[]);for(;n.length;){const o=n.shift();o&&o.exec()}},Te=e=>{a.get(k()).umts.push(e)},Ue=e=>{const{componentKey:t,nodeChildKey:n}=e,o=n==null?void 0:n.value;t&&I(t),o&&o.forEach(r=>I(r))},I=e=>{const t=a.get(e).umts;a.get(e).umts=[],t.forEach(n=>n()),a.delete(e)},J=e=>{a.get(k()).mts.push(e)},L=e=>{const{componentKey:t}=e;if(t){const n=a.get(t),o=n==null?void 0:n.mts,r=n==null?void 0:n.upS;m.value=t,r&&(r.value=0),o&&(n.mts=[],o.forEach(c=>{const l=c();l&&Te(l)}))}},q=(e,t=()=>[])=>{const n=a.get(k()),{upD:o,upS:r}=n,c=o[r.value];if(c&&_e(c,t())){const l=e();l&&n.upCB.push(l)}o[r.value]=t(),r.value+=1},Oe=e=>{const{componentKey:t}=e;if(t){const n=a.get(t),o=n==null?void 0:n.upCB,r=n==null?void 0:n.upS;m.value=t,r&&(r.value=0),e.constructor&&o&&(n.upCB=[],o.forEach(c=>c()))}},_e=(e,t)=>!e.length&&!e.length?!0:e.some((n,o)=>n!==t[o]),Fe=(e,t,n)=>{if(!t)throw Error("WrapELement is null");e.isRoot=!0,e.wrapElement=t;const o=N(e,!0);n?t.insertBefore(o,n):t.appendChild(o)},$=e=>{const{needRerender:t}=e;if(t&&t!=="N"){const n={A,D:V,R:Ae,U:Me,SR:Le,SU:Ve}[t];n(e)}},G=e=>{e.props&&e.el&&M(e.props,e.el),(e.children||[]).forEach(t=>{G(t)})},V=e=>{var t,n;const o=K(e);e.oldProps&&e.el&&M(e.oldProps,e.el),o&&e.el&&(((t=e.el)==null?void 0:t.nodeType)===1?o.removeChild(e.el):((n=e.el)==null?void 0:n.nodeType)===11&&H(e,o),delete e.el)},H=(e,t)=>{((e==null?void 0:e.children)||[]).forEach(n=>{var o,r;((o=n.el)==null?void 0:o.nodeType)===1?t.removeChild(n==null?void 0:n.el):((r=n.el)==null?void 0:r.nodeType)===11&&H(n,t)})},Le=e=>{V(e),A(e)},Ve=e=>{V(e),A(e,e.el)},A=(e,t)=>{t||(t=N(e,!0));const n=C(e);if(n.type){const o=K(n),r=X(e,n);t&&o&&(r?o.insertBefore(t,r):o.appendChild(t))}L(e)},X=(e,t)=>{const n=t.children||[],r=n.indexOf(e)+1,c=n.slice(r),l=Z(c),s=t.type||"";if(l)return l;if(!t.isRoot&&["fragment","loop"].includes(s))return X(t,C(t))},Z=e=>e.reduce((t,n)=>{const o=n.type,r=n.el,c=o&&["fragment","loop"].includes(o);return t||(c?Z(n.children||[]):r&&r.nodeType!==11?r:t)},void 0),Ae=e=>{const t=C(e),n=e.el;if(t.type&&n){const o=t.el,r=N(e,!0);e.oldProps&&M(e.oldProps,n),o&&o.replaceChild(r,n)}L(e)},M=(e,t)=>{t&&Object.entries(e||{}).forEach(([n,o])=>{n.match(/^on/)&&t.removeEventListener(n,o)})},Me=e=>{var t;const n=e.el;if(e.type==="text"){Ke(e);return}if(n){const{oldProps:o,props:r}=e;w({oldProps:o,props:r,element:n}),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=>$(o)),Oe(e)},Ke=e=>{const t=e.el;t&&(t.nodeValue=String(e.text))},w=({oldProps:e,props:t,element:n})=>{const o={...e};Object.entries(t||{}).forEach(([r,c])=>{if(r!=="key")if(j(r,c)){const l=c,s=j(r,o.style)||{};qe({style:l,oldStyle:s,element:n})}else fe(r,c)?c.value=n:r.match(/^on/)?Ie({element:n,eventKey:r,newEventHandler:c,oldEventHandler:o[r]}):ve(c)?n.setAttribute(r,String(c)):he(n)&&r==="selected"&&(n.selected=!!c);delete o[r]}),Object.keys(o).forEach(r=>n.removeAttribute(r))},N=(e,t)=>{let n;const{type:o,tag:r,text:c,props:l,children:s=[]}=e;return o==="fragment"||o==="loop"?n=new DocumentFragment:o==="element"&&r?n=document.createElement(r):o==="text"&&_(c)&&(n=document.createTextNode(String(c))),je(s,n,t),w({props:l,element:n}),e.el=n,L(e),n||document.createElement("div")},je=(e,t,n)=>{if(n){const o=e.reduce((r,c)=>(c.type&&r.appendChild(N(c,n)),r),new DocumentFragment);t&&o.hasChildNodes()&&t.appendChild(o)}},Ie=({element:e,eventKey:t,newEventHandler:n,oldEventHandler:o})=>{const r=t.replace(/^on(.*)/,(c,l)=>l.toLowerCase());o!==n&&(o&&e.removeEventListener(r,o),n&&e.addEventListener(r,n))},qe=({style:e,oldStyle:t,element:n})=>{const o={...t},r=n==null?void 0:n.style;r&&(Object.entries(e).forEach(([c,l])=>{r.setProperty(c,l),delete o[c]}),Object.entries(o).forEach(([c])=>r.removeProperty(c)))},K=e=>{var t,n;const o=e.type==="fragment"||e.type==="loop"||!e.type&&((t=e==null?void 0:e.el)==null?void 0:t.nodeType)===11;if(e.isRoot&&o)return e.wrapElement;if(!o)return(n=e.el)==null?void 0:n.parentNode;const r=C(e);return K(r)},b=({originalWDom:e,newWDom:t})=>{const n=ye(t);if(!n)throw new Error("Unknown type wdom");const o=Ce[n]({originalWDom:e,newWDom:t}),r=Be({originalWDom:e,newWDom:t,isSameType:o});return r!=null&&r.nodeChildKey&&F(r.nodeChildKey),r},Be=({newWDom:e,originalWDom:t,isSameType:n})=>{const o=Ye({newWDom:e,originalWDom:t,isSameType:n});o.children=ze({isSameType:n,newWDom:o,originalWDom:t});const r=Qe({originalWDom:t,newWDom:o,isSameType:n});return o.needRerender=r,r!=="A"&&t&&(o.el=t.el),r&&["D","R","SR"].includes(r)&&(t==null?void 0:t.componentKey)&&(Ue(t),G(t),o.children=t.children),o.oldProps=t==null?void 0:t.props,o},Qe=({originalWDom:e,newWDom:t,isSameType:n})=>{const o=e&&e.type,r=Q(t),l=!!t.getParent&&C(t).type,s=P(t),d=l==="loop"&&_(s),p=t.type==="text"&&n&&t.text===(e==null?void 0:e.text);let i;return r?i="D":p?i="N":o?n?i=d?"SU":"U":i=d?"SR":"R":i="A",i},Ye=({newWDom:e,originalWDom:t,isSameType:n})=>x(e)?n&&t?me(t,e):e.resolve():e,ze=({isSameType:e,newWDom:t,originalWDom:n})=>e&&n?$e(t,n):Je(t),Je=e=>(e.children||[]).map(t=>{const n=b({newWDom:t});return n.getParent=()=>e,n}),$e=(e,t)=>e.type==="loop"&&_(P((e.children||[])[0]))?Ge(e,t):(e.children||[]).map((n,o)=>{const r=b({newWDom:n,originalWDom:(t.children||[])[o]});return r.getParent=()=>e,r}),Ge=(e,t)=>{const{remakedChildren:n,unUsedChildren:o}=He(e,t);return o.map(r=>{const c=r.el;c&&c.parentNode&&c.parentNode.removeChild(c)}),n},He=(e,t)=>{const n=[...e.children||[]],o=[...t.children||[]];return{remakedChildren:n.map(c=>{const l=Xe(c,o),s=b({newWDom:c,originalWDom:l});return l&&o.splice(o.indexOf(l),1),s.getParent=()=>e,s}),unUsedChildren:o}},Xe=(e,t)=>{const n=P(e);return t.find(o=>P(o)===n)},P=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},W=(e,t=()=>[])=>{a.get(k()).upR.push(()=>q(e,t)),q(e,t)},Ze=()=>{var e;const t=(e=a.get(k()))==null?void 0:e.upR;t!=null&&t.length&&t.forEach(n=>n()),E.value=[],U.value=null},S=(e,...t)=>({type:"fragment",children:t}),u=(e,t,...n)=>{const o={value:void 0},r=t||{},c=oe(o,n),l=et({tag:e,props:r,children:c});return x(l)||(o.value=l),l},D=e=>(t,n)=>e,ee=({tag:e,props:t,children:n,originalWDom:o})=>{var r;h.value=!0,Ee();const c=te({tag:e,props:t,children:n}),l=b({originalWDom:o,newWDom:c}),{isRoot:s,getParent:d,wrapElement:p}=o;if(l.getParent=d,!s&&d){const i=((r=d())==null?void 0:r.children)||[],f=i.indexOf(o);i.splice(f,1,l)}else l.isRoot=!0,l.wrapElement=p;$(l),h.value=!1},te=({tag:e,props:t,children:n})=>({tagName:e.name,constructor:e,props:t,children:n,resolve:(l=t)=>{be(l);const s=Y(l),p=e(t,n)(Pe(l),t,n),i=we({componentMaker:p,componentKey:l,tag:e,props:t,children:n,nodeChildKey:s}),f=i;return z({componentKey:l,nodeChildKey:s,exec:()=>ee({tag:e,props:t,children:n,originalWDom:f})}),h.value||F(s),i}}),we=e=>{const{componentMaker:t}=e,n=t(),o=We(e);return ne(n,{...e,reRender:o}),n},We=e=>{const t=()=>De({...e,reRender:t});return t},De=e=>{const{componentMaker:t,componentKey:n,tag:o,props:r,children:c}=e;Ne(n),Ze();const l=Y(n),s=t();return e.nodeChildKey=l,z({componentKey:n,nodeChildKey:l,exec:()=>ee({tag:o,props:r,children:c,originalWDom:s})}),ne(s,e),h.value||F(l),s},ne=(e,t)=>{const{componentKey:n,tag:o,props:r,children:c,reRender:l,nodeChildKey:s}=t;Object.assign(e,{componentProps:r,componentChildren:c,constructor:o,tagName:o.name,componentKey:n,nodeChildKey:s,reRender:l})},et=({tag:e,props:t,children:n})=>{if(B(e))return S(t,...n);if(x(e)){const o=te({tag:e,props:t,children:n});return h.value?o:o.resolve()}return{type:"element",tag:e,props:t,children:n}},oe=(e,t)=>t.map(n=>{const o=tt(n);return o.getParent=()=>e.value,o}),tt=e=>{if(e==null||e===!1)return{type:null};if(Array.isArray(e)){const t={value:void 0},o={type:"loop",children:oe(t,e)};return t.value=o,o}else if(typeof e=="string"||typeof e=="number")return{type:"text",text:e};return e},nt=e=>({value:e}),O=(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()}}},ot=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'")}}},rt=(e,t,n=()=>[])=>{J(()=>(e(),t)),W(()=>(t(),e),n)},re=new Map,g={},ct=(e,{storeKey:t=Symbol(),renew:n}={})=>(re.set(t,e),n&&(g[t]!=null||(g[t]=[]),g[t].push(n)),lt(t)),lt=e=>new Proxy(re.get(e),{get(t,n){return t[n]},set(t,n,o){t[n]=o;const r=g[e],c=[];return r.forEach(l=>{l()||c.push(l)}),c.forEach(l=>r.splice(r.indexOf(l),1)),!0}}),st=D((e,t,n)=>{const o=O(1,e),r=O("text",e),c=()=>t.parentValue,l=t.parentValue,s=ot(()=>o.v+p+t.parentValue),d=ct({text:"s",count:0},{renew:e});let p=t.parentValue;const i=nt(null),f=()=>{o.v=o.v+1,p+=1},ce=ie=>{r.v=ie.target.value},le=()=>{d.count+=1,d.text+="1"},se=()=>(console.log("MOUNTED",i),()=>console.log("UNMOUNT")),ue=()=>(console.log("UPDATE - parentValue"),()=>console.log("UPDATED"));return J(se),W(ue,()=>[t.parentValue]),rt(()=>console.log("INJECT"),()=>console.log("CLEAN_UP"),()=>[o.v]),()=>u(S,null,u("input",{type:"text",value:r.v,onInput:ce}),u("div",{ref:i},"count: ",o.v),u("div",null,"parentValue: ",t.parentValue," (working)"),u("div",null,"parentValue: ",c()," (working)"),u("div",null,"parentValue: ",l," (not working)"),u("div",null,"sum: ",o.v+p+t.parentValue),u("div",null,"sum(computed): ",s.v),u("div",null,"notRefValue: ",p),u("div",null,"localStore(text): ",d.text),u("div",null,"localStore(count): ",d.count),n,u("button",{onClick:f},"Increase"),u("button",{onClick:le},"localStoreUpdate"))}),ut=D(e=>{const t=O(7,e),n=()=>{t.v=t.v+1},o=()=>{t.v=t.v-1};return()=>u(S,null,u("button",{onClick:o},"Decrease - Parent"),u("div",null,u(st,{parentValue:t.v},u("button",{onClick:n},"Increase - Parent"))))}),it=u(ut,null);Fe(it,document.getElementById("root"));
|
|
2
|
+
//# sourceMappingURL=index.91a636db.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.91a636db.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 checkCustemComponentFunction = (target) => typeof target === \"function\" && !checkFragmentFunction(target) || typeof target === \"object\" && \"resolve\" in target;\nconst checkFragmentFunction = (target) => typeof target === \"function\" && target === Fragment;\nconst checkPlainWDomType = (wDom) => typeof wDom === \"object\" && !(\"resolve\" in wDom);\nconst checkPlainType = (wDom, typeName) => checkPlainWDomType(wDom) && wDom.type === typeName;\nconst checkEmptyElement = (wDom) => checkPlainWDomType(wDom) && !wDom.type;\nconst checkSameCustomComponent = ({\n originalWDom,\n newWDom\n}) => newWDom.constructor === (originalWDom == null ? void 0 : originalWDom.constructor);\nconst checkSameFragment = ({ originalWDom, newWDom }) => {\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 = ({ originalWDom, newWDom }) => checkPlainWDomType(newWDom) && (originalWDom == null ? void 0 : originalWDom.type) === \"element\" && (originalWDom == null ? void 0 : originalWDom.tag) === newWDom.tag;\nconst checkNormalTypeElement = ({ originalWDom, newWDom }) => checkPlainWDomType(newWDom) && (originalWDom == null ? void 0 : originalWDom.type) === newWDom.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) => {\n return element.nodeType === 1 && element.tagName === \"OPTION\";\n};\nconst checkNormalAttribute = (dataValue) => typeof dataValue === \"number\" || typeof dataValue === \"string\";\nconst getWDomType = (wDom) => {\n let result;\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 if (!parentVDom) {\n throw Error(\"Not found parent vDom\");\n }\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 if (!newVDom) {\n throw Error(\"Unable reRender\");\n }\n return newVDom;\n};\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 componentKeyRef = { value: {} };\nconst needDiffRef = { value: false };\nconst componentRef = /* @__PURE__ */ new WeakMap();\nconst redrawQueue = { value: [] };\nconst redrawQueueTimeout = { value: null };\nconst nodeChildKeyList = { value: [] };\nconst pushNodeChildKey = (key) => nodeChildKeyList.value.forEach((item) => item.value.push(key));\nconst removeNodeChildKey = (item) => {\n nodeChildKeyList.value.splice(nodeChildKeyList.value.indexOf(item), 1);\n};\nconst cleanNodeChildKey = () => nodeChildKeyList.value = [];\nconst startMakeNodeChildKey = (componentKey) => {\n const nodeChildKey = { value: [] };\n pushNodeChildKey(componentKey);\n nodeChildKeyList.value.push(nodeChildKey);\n return nodeChildKey;\n};\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 up: () => {\n },\n upR: [],\n upS: { value: 0 },\n upD: [],\n upCB: [],\n mts: [],\n umts: []\n });\n};\nconst getComponentKey = () => componentKeyRef.value;\nconst setRedrawAction = ({\n componentKey,\n nodeChildKey,\n exec\n}) => {\n componentRef.get(componentKey).up = () => {\n redrawQueue.value.push({\n componentKey,\n nodeChildKey: nodeChildKey.value,\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 execRedrawQueue = () => {\n let childItemList = [];\n redrawQueue.value.forEach((item) => {\n childItemList = childItemList.concat(item.nodeChildKey);\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, nodeChildKey } = newWDom;\n const childKeys = nodeChildKey == null ? void 0 : nodeChildKey.value;\n if (componentKey) {\n removeItem(componentKey);\n }\n if (childKeys) {\n childKeys.forEach((childKey) => removeItem(childKey));\n }\n};\nconst removeItem = (componentKey) => {\n const queue = componentRef.get(componentKey).umts;\n componentRef.get(componentKey).umts = [];\n queue.forEach((effect) => effect());\n componentRef.delete(componentKey);\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 if (!wrapElement) {\n throw Error(\"WrapELement is null\");\n }\n wDom.isRoot = true;\n wDom.wrapElement = wrapElement;\n const Dom = wDomToDom(wDom, true);\n if (afterElement) {\n wrapElement.insertBefore(Dom, afterElement);\n } else {\n wrapElement.appendChild(Dom);\n }\n};\nconst wDomUpdate = (newWDomTree) => {\n const { needRerender } = newWDomTree;\n if (needRerender && needRerender !== \"N\") {\n const exec = {\n A: typeAdd,\n D: typeDelete,\n R: typeReplace,\n U: typeUpdate,\n SR: typeSortedReplace,\n SU: typeSortedUpdate\n }[needRerender];\n exec(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 typeDelete = (newWDom) => {\n var _a, _b;\n const parent = findRealParentElement(newWDom);\n if (newWDom.oldProps && newWDom.el) {\n removeEvent(newWDom.oldProps, newWDom.el);\n }\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.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, true);\n }\n const parentWDom = getParent(newWDom);\n if (parentWDom.type) {\n const parentEl = findRealParentElement(parentWDom);\n const nextEl = 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 }\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 const parentElement = parentWDom.el;\n const newElement = wDomToDom(newWDom, true);\n if (newWDom.oldProps) {\n removeEvent(newWDom.oldProps, orignalElement);\n }\n if (parentElement) {\n parentElement.replaceChild(newElement, orignalElement);\n }\n }\n runMountedQueueFromWDom(newWDom);\n};\nconst removeEvent = (oldProps, element) => {\n if (element) {\n Object.entries(oldProps || {}).forEach(\n ([dataKey, dataValue]) => {\n if (dataKey.match(/^on/)) {\n element.removeEventListener(dataKey, 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({ oldProps, props, element });\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 = ({\n oldProps,\n props,\n element\n}) => {\n const originalProps = { ...oldProps };\n Object.entries(props || {}).forEach(\n ([dataKey, dataValue]) => {\n if (dataKey === \"key\")\n ;\n else if (checkStyleData(dataKey, dataValue)) {\n const style = dataValue;\n const oldStyle = checkStyleData(dataKey, originalProps.style) || {};\n updateStyle({ style, oldStyle, element });\n } else if (checkRefData(dataKey, dataValue)) {\n dataValue.value = element;\n } else if (dataKey.match(/^on/)) {\n updateEvent({\n element,\n eventKey: dataKey,\n newEventHandler: dataValue,\n oldEventHandler: originalProps[dataKey]\n });\n } else if (checkNormalAttribute(dataValue)) {\n element.setAttribute(dataKey, String(dataValue));\n } else if (checkOptionElement(element) && dataKey === \"selected\") {\n element.selected = !!dataValue;\n }\n delete originalProps[dataKey];\n }\n );\n Object.keys(originalProps).forEach(\n (dataKey) => element.removeAttribute(dataKey)\n );\n};\nconst wDomToDom = (wDom, init) => {\n let element;\n const { type, tag, text, props, children = [] } = wDom;\n const isVirtualType = type === \"fragment\" || type === \"loop\";\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 }\n wDomChildrenToDom(children, element, init);\n updateProps({ props, element });\n wDom.el = element;\n runMountedQueueFromWDom(wDom);\n return element || document.createElement(\"div\");\n};\nconst wDomChildrenToDom = (children, parentElement, init) => {\n if (init) {\n const elementChildren = children.reduce(\n (acc, childItem) => {\n if (childItem.type) {\n acc.appendChild(wDomToDom(childItem, init));\n }\n return acc;\n },\n new DocumentFragment()\n );\n if (parentElement && elementChildren.hasChildNodes()) {\n parentElement.appendChild(elementChildren);\n }\n }\n};\nconst updateEvent = ({\n element,\n eventKey,\n newEventHandler,\n oldEventHandler\n}) => {\n const eventName = eventKey.replace(\n /^on(.*)/,\n (_match, p1) => p1.toLowerCase()\n );\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 = ({\n style,\n oldStyle,\n element\n}) => {\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.setProperty(styleKey, dataValue);\n delete originalStyle[styleKey];\n });\n Object.entries(originalStyle).forEach(\n ([styleKey]) => elementStyle.removeProperty(styleKey)\n );\n }\n};\nconst findRealParentElement = (vDom) => {\n var _a, _b;\n const isVirtualType = vDom.type === \"fragment\" || vDom.type === \"loop\" || !vDom.type && ((_a = vDom == null ? void 0 : vDom.el) == null ? void 0 : _a.nodeType) === 11;\n if (vDom.isRoot && isVirtualType) {\n return vDom.wrapElement;\n }\n if (!isVirtualType) {\n return (_b = vDom.el) == null ? void 0 : _b.parentNode;\n }\n const parentVDom = getParent(vDom);\n return findRealParentElement(parentVDom);\n};\nconst makeNewWDomTree = ({\n originalWDom,\n newWDom\n}) => {\n const type = getWDomType(newWDom);\n if (!type) {\n throw new Error(\"Unknown type wdom\");\n }\n const isSameType = checkSameWDomWithOriginal[type]({ originalWDom, newWDom });\n const result = remakeNewWDom({ originalWDom, newWDom, isSameType });\n if (result == null ? void 0 : result.nodeChildKey) {\n removeNodeChildKey(result.nodeChildKey);\n }\n return result;\n};\nconst remakeNewWDom = ({\n newWDom,\n originalWDom,\n isSameType\n}) => {\n const remakeWDom = generalize({ newWDom, originalWDom, isSameType });\n remakeWDom.children = remakeChildrenForDiff({\n isSameType,\n newWDom: remakeWDom,\n originalWDom\n });\n const needRerender = addReRenderTypeProperty({\n originalWDom,\n newWDom: remakeWDom,\n isSameType\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.children = originalWDom.children;\n }\n remakeWDom.oldProps = originalWDom == null ? void 0 : originalWDom.props;\n return remakeWDom;\n};\nconst addReRenderTypeProperty = ({\n originalWDom,\n newWDom,\n isSameType\n}) => {\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 = ({\n newWDom,\n originalWDom,\n isSameType\n}) => {\n if (checkCustemComponentFunction(newWDom)) {\n return isSameType && originalWDom ? reRender(originalWDom, newWDom) : newWDom.resolve();\n }\n return newWDom;\n};\nconst remakeChildrenForDiff = ({\n isSameType,\n newWDom,\n originalWDom\n}) => isSameType && originalWDom ? remakeChildrenForUpdate(newWDom, originalWDom) : remakeChildrenForAdd(newWDom);\nconst remakeChildrenForAdd = (newWDom) => (newWDom.children || []).map((item) => {\n const childItem = makeNewWDomTree({ newWDom: 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 newWDom: item,\n originalWDom: (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 && 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({\n newWDom: item,\n originalWDom: originalItem\n });\n if (originalItem) {\n originalChildren.splice(originalChildren.indexOf(originalItem), 1);\n }\n childItem.getParent = () => newWDom;\n return childItem;\n });\n return {\n remakedChildren,\n unUsedChildren: originalChildren\n };\n};\nconst findSameKeyOriginalItem = (item, originalChildren) => {\n const key = getKey(item);\n return originalChildren.find(\n (orignalChildItem) => getKey(orignalChildItem) === key\n );\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({\n tag,\n props: newProps,\n children: newChildren\n });\n if (!checkCustemComponentFunction(node)) {\n nodeParentPointer.value = node;\n }\n return node;\n};\nconst mount = (component) => (_props, _children) => component;\nconst reRenderCustomComponent = ({\n tag,\n props,\n children,\n originalWDom\n}) => {\n var _a;\n needDiffRef.value = true;\n cleanNodeChildKey();\n const newWDom = makeWDomResolver({ tag, props, children });\n const newWDomTree = makeNewWDomTree({ originalWDom, newWDom });\n const { isRoot, getParent: getParent2, wrapElement } = 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 }\n wDomUpdate(newWDomTree);\n needDiffRef.value = false;\n};\nconst makeWDomResolver = ({\n tag,\n props,\n children\n}) => {\n const tagName = tag.name;\n const constructor = tag;\n const resolve = (componentKey = props) => {\n initMountHookState(componentKey);\n const nodeChildKey = startMakeNodeChildKey(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 nodeChildKey\n });\n const originalWDom = customNode;\n setRedrawAction({\n componentKey,\n nodeChildKey,\n exec: () => reRenderCustomComponent({ tag, props, children, originalWDom })\n });\n if (!needDiffRef.value) {\n removeNodeChildKey(nodeChildKey);\n }\n return customNode;\n };\n return { tagName, constructor, props, children, resolve };\n};\nconst makeCustomNode = (wDomInfo) => {\n const { componentMaker } = wDomInfo;\n const customNode = componentMaker();\n const reRender2 = makeReRender(wDomInfo);\n addComponentProps(customNode, { ...wDomInfo, reRender: reRender2 });\n return customNode;\n};\nconst makeReRender = (wDomInfo) => {\n const reRender2 = () => wDomMaker({ ...wDomInfo, reRender: reRender2 });\n return reRender2;\n};\nconst wDomMaker = (wDomInfo) => {\n const { componentMaker, componentKey, tag, props, children } = wDomInfo;\n initUpdateHookState(componentKey);\n runUpdateCallback();\n const nodeChildKey = startMakeNodeChildKey(componentKey);\n const originalWDom = componentMaker();\n wDomInfo.nodeChildKey = nodeChildKey;\n setRedrawAction({\n componentKey,\n nodeChildKey,\n exec: () => reRenderCustomComponent({ tag, props, children, originalWDom })\n });\n addComponentProps(originalWDom, wDomInfo);\n if (!needDiffRef.value) {\n removeNodeChildKey(nodeChildKey);\n }\n return originalWDom;\n};\nconst addComponentProps = (wDom, info) => {\n const { componentKey, tag, props, children, reRender: reRender2, nodeChildKey } = info;\n Object.assign(wDom, {\n componentProps: props,\n componentChildren: children,\n constructor: tag,\n tagName: tag.name,\n componentKey,\n nodeChildKey,\n reRender: reRender2\n });\n};\nconst makeNode = ({\n tag,\n props,\n children\n}) => {\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 p, updateCallback as h } from \"lithent\";\nconst g = (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, e = () => []) => {\n p(() => (r(), t)), h(() => (t(), r), e);\n}, s = /* @__PURE__ */ new Map(), u = {}, v = (r, {\n storeKey: t = Symbol(),\n renew: e\n} = {}) => {\n var n;\n return s.set(t, r), e && ((n = u[t]) != null || (u[t] = []), u[t].push(e)), l(t);\n}, w = (r, t) => {\n if (!s.get(r))\n throw new Error(\"store is not exist\");\n return u[r].push(t), l(r);\n}, l = (r) => new Proxy(s.get(r), {\n get(t, e) {\n return t[e];\n },\n set(t, e, n) {\n t[e] = n;\n const c = u[r], a = [];\n return c.forEach((o) => {\n o() || a.push(o);\n }), a.forEach(\n (o) => c.splice(c.indexOf(o), 1)\n ), !0;\n }\n});\nexport {\n f as computed,\n m as effect,\n v as makeStore,\n g as state,\n w as subscribeStore\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, makeStore } 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>('text', renew);\n const getParentValue = () => props.parentValue;\n const parentValue = props.parentValue;\n const summ = computed<() => number>(\n () => count.v + notRefValue + props.parentValue\n );\n\n const localStore = makeStore<{ text: string; count: number }>(\n { text: 's', count: 0 },\n {\n // key is optional (Can be omitted here as it is only used locally)\n renew,\n }\n );\n /*\n // To share a store, make it externally and use `join`.\n makeStore<{ text: string; count: number }>(\n { text: 's', count: 0 },\n { storeKey: 'sharedStore' }\n );\n\n const sharedStore = subscribeStore<{ text: string; count: number }>('shardStore', 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 () => (\n <Fragment>\n {/* Note that the event is onInput (we use the native event name to avoid confusion). */}\n <input type=\"text\" value={text.v} onInput={handleInputChane} />\n <div ref={domRef}>count: {count.v}</div>\n {/* When the value is updated from the parent component, the function declared inside is executed, so you need to use the `props.` call by reference to output the latest value of the updated property. */}\n <div>parentValue: {props.parentValue} (working)</div>\n <div>parentValue: {getParentValue()} (working)</div>\n <div>parentValue: {parentValue} (not working)</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 {children}\n <button onClick={increase}>Increase</button>\n <button onClick={localStoreUpdate}>localStoreUpdate</button>\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 <button onClick={decreaseParent}>Decrease - Parent</button>\n <div>\n <ChildComponent parentValue={parentNumber.v}>\n <button onClick={increaseParent}>Increase - Parent</button>\n </ChildComponent>\n </div>\n </Fragment>\n );\n});\nconst root = <Root />;\n\nrender(root, document.getElementById('root'));\n"],"names":["relList","link","processPreload","mutations","mutation","node","getFetchOpts","script","fetchOpts","checkCustemComponentFunction","target","checkFragmentFunction","Fragment","checkPlainWDomType","wDom","checkPlainType","typeName","checkEmptyElement","checkSameCustomComponent","originalWDom","newWDom","checkSameFragment","_a","_b","checkSameTagElement","checkNormalTypeElement","checkExisty","value","checkStyleData","dataKey","dataValue","checkRefData","checkOptionElement","element","checkNormalAttribute","getWDomType","result","checkSameWDomWithOriginal","getParent","vDom","parentVDom","reRender","infoVdom","props","children","infoProps","infoChidren","updateProps$1","updateChildren","newVDom","key","childrenItem","componentKeyRef","needDiffRef","componentRef","redrawQueue","redrawQueueTimeout","nodeChildKeyList","pushNodeChildKey","item","removeNodeChildKey","cleanNodeChildKey","startMakeNodeChildKey","componentKey","nodeChildKey","componentRender","up","setComponetRef","getComponentKey","setRedrawAction","exec","execRedrawQueue","initUpdateHookState","initMountHookState","childItemList","addedKey","acc","action","unmount","effectAction","runUnmountQueueFromWDom","childKeys","removeItem","childKey","queue","effect","mountCallback","runMountedQueueFromWDom","component","sequence","callback","useUpdated","dependencies","upD","upS","def","checkNeedPushQueue","runUpdatedQueueFromWDom","originalDefs","newDefs","index","render","wrapElement","afterElement","Dom","wDomToDom","wDomUpdate","newWDomTree","needRerender","typeAdd","typeDelete","typeReplace","typeUpdate","typeSortedReplace","typeSortedUpdate","recursiveRemoveEvent","removeEvent","childItem","parent","findRealParentElement","findChildWithRemoveElement","newElement","parentWDom","parentEl","nextEl","startFindNextBrotherElement","brothers","nextIndex","candidiateBrothers","finedNextEl","findChildFragmentNextElement","parentType","targetEl","bItem","type","el","isFragment","orignalElement","parentElement","oldProps","updateText","updateProps","originalProps","style","oldStyle","updateStyle","updateEvent","init","tag","text","wDomChildrenToDom","elementChildren","eventKey","newEventHandler","oldEventHandler","eventName","_match","p1","originalStyle","elementStyle","styleKey","isVirtualType","makeNewWDomTree","isSameType","remakeNewWDom","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","wDomInfo","reRender2","makeReRender","addComponentProps","wDomMaker","info","componetMakeResolver","makeChildrenItem","ref","initValue","g","r","e","n","f","m","p","s","u","v","l","c","a","o","ChildComponent","renew","count","state","getParentValue","parentValue","summ","computed","notRefValue","localStore","makeStore","domRef","increase","handleInputChane","event","localStoreUpdate","handleMounted","handleUpdated","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,UAAYD,EAAO,WAC7BA,EAAO,iBACPC,EAAU,eAAiBD,EAAO,gBAClCA,EAAO,cAAgB,kBACvBC,EAAU,YAAc,UACnBD,EAAO,cAAgB,YAC5BC,EAAU,YAAc,OAExBA,EAAU,YAAc,cACrBA,CACV,CACD,SAASN,EAAeD,EAAM,CAC1B,GAAIA,EAAK,GAEL,OACJA,EAAK,GAAK,GAEV,MAAMO,EAAYF,EAAaL,CAAI,EACnC,MAAMA,EAAK,KAAMO,CAAS,CAC7B,CACL,KC1CA,MAAMC,EAAgCC,GAAW,OAAOA,GAAW,YAAc,CAACC,EAAsBD,CAAM,GAAK,OAAOA,GAAW,UAAY,YAAaA,EACxJC,EAAyBD,GAAW,OAAOA,GAAW,YAAcA,I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AE,YAAU,EAC9C1C,EAAC,WAAI,gBAAc2C,EAAY,gBAAc,EAC7C3C,EAAC,MAAI,KAAA,QAAMwC,EAAM,EAAIM,EAAclM,EAAM,WAAY,IACpD,MAAI,KAAA,kBAAgBgM,EAAK,CAAE,EAE3B5C,EAAA,MAAA,KAAI,gBAAc8C,CAAY,IAC9B,MAAI,KAAA,qBAAmBC,EAAW,IAAK,EACvC/C,EAAA,MAAA,KAAI,sBAAoB+C,EAAW,KAAM,EACzClM,EACDmJ,EAAC,UAAO,QAASkD,CAAA,EAAU,UAAQ,EACnClD,EAAC,UAAO,QAASqD,EAAA,EAAkB,kBAAgB,CACrD,CAEJ,CACF,EAEMG,GAAOnD,EAAekC,GAAA,CACpB,MAAAkB,EAAehB,EAAc,EAAGF,CAAK,EAErCmB,EAAiB,IAAM,CACdD,EAAA,EAAIA,EAAa,EAAI,CAAA,EAG9BE,EAAiB,IAAM,CACdF,EAAA,EAAIA,EAAa,EAAI,CAAA,EAG7B,MAAA,MACJ5O,EACC,KAAAmL,EAAC,UAAO,QAAS2D,CAAA,EAAgB,mBAAiB,EACjD3D,EAAA,MAAA,OACEsC,GAAe,CAAA,YAAamB,EAAa,CAAA,EACvCzD,EAAA,SAAA,CAAO,QAAS0D,CAAgB,EAAA,mBAAiB,CACpD,CACF,CACF,CAEJ,CAAC,EACKE,KAAQJ,GAAK,IAAA,EAEnBlJ,GAAOsJ,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.91a636db.js"></script>
|
|
8
8
|
</head>
|
|
9
9
|
<body>
|
|
10
10
|
<section id="root"></section>
|
package/examples/src/index.tsx
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
updateCallback,
|
|
9
9
|
mount,
|
|
10
10
|
} from 'lithent';
|
|
11
|
-
import { state, computed, effect } from 'lithent-helper';
|
|
11
|
+
import { state, computed, effect, makeStore } from 'lithent-helper';
|
|
12
12
|
|
|
13
13
|
// This is the "mount" function.
|
|
14
14
|
// This function is only executed on mount, and on update, only updates `props` and then executes the internal return function.
|
|
@@ -24,6 +24,23 @@ const ChildComponent = mount<{ parentValue: number }>(
|
|
|
24
24
|
() => count.v + notRefValue + props.parentValue
|
|
25
25
|
);
|
|
26
26
|
|
|
27
|
+
const localStore = makeStore<{ text: string; count: number }>(
|
|
28
|
+
{ text: 's', count: 0 },
|
|
29
|
+
{
|
|
30
|
+
// key is optional (Can be omitted here as it is only used locally)
|
|
31
|
+
renew,
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
/*
|
|
35
|
+
// To share a store, make it externally and use `join`.
|
|
36
|
+
makeStore<{ text: string; count: number }>(
|
|
37
|
+
{ text: 's', count: 0 },
|
|
38
|
+
{ storeKey: 'sharedStore' }
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const sharedStore = subscribeStore<{ text: string; count: number }>('shardStore', nenew);
|
|
42
|
+
*/
|
|
43
|
+
|
|
27
44
|
// Even if you don't use a ref, the private value is always maintained as a regular variable.
|
|
28
45
|
let notRefValue = props.parentValue;
|
|
29
46
|
|
|
@@ -39,6 +56,11 @@ const ChildComponent = mount<{ parentValue: number }>(
|
|
|
39
56
|
text.v = (event.target as HTMLInputElement).value;
|
|
40
57
|
};
|
|
41
58
|
|
|
59
|
+
const localStoreUpdate = () => {
|
|
60
|
+
localStore.count += 1;
|
|
61
|
+
localStore.text += '1';
|
|
62
|
+
};
|
|
63
|
+
|
|
42
64
|
const handleMounted = () => {
|
|
43
65
|
console.log('MOUNTED', domRef);
|
|
44
66
|
|
|
@@ -75,8 +97,11 @@ const ChildComponent = mount<{ parentValue: number }>(
|
|
|
75
97
|
<div>sum(computed): {summ.v}</div>
|
|
76
98
|
{/* It doesn't pull it out from under the reference, it uses the value directly, so you can just use it. */}
|
|
77
99
|
<div>notRefValue: {notRefValue}</div>
|
|
100
|
+
<div>localStore(text): {localStore.text}</div>
|
|
101
|
+
<div>localStore(count): {localStore.count}</div>
|
|
78
102
|
{children}
|
|
79
103
|
<button onClick={increase}>Increase</button>
|
|
104
|
+
<button onClick={localStoreUpdate}>localStoreUpdate</button>
|
|
80
105
|
</Fragment>
|
|
81
106
|
);
|
|
82
107
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
[key: symbol]: unknown;
|
|
5
|
-
}>({ initValue, renew, }: {
|
|
6
|
-
initValue: T;
|
|
7
|
-
renew: () => void;
|
|
1
|
+
export declare const makeStore: <T extends {}>(value: T, { storeKey, renew, }?: {
|
|
2
|
+
storeKey?: string | symbol | undefined;
|
|
3
|
+
renew?: (() => boolean) | undefined;
|
|
8
4
|
}) => T;
|
|
5
|
+
export declare const subscribeStore: <T extends {}>(storeKey: string | symbol, renew: () => boolean) => T;
|
package/helper/dist/index.d.ts
CHANGED