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 CHANGED
@@ -1,19 +1,19 @@
1
- # Basic Usage
1
+ # litheNT Basic Usage
2
2
 
3
- Wwact is a virtualDOM implementation library that behaves similarly to React.
3
+ litheNT is a virtualDOM implementation library that behaves similarly to React.
4
4
 
5
5
  [production motive](https://medium.com/p/d14ba89373d3)
6
6
 
7
7
  A simpler style of library inspired by Reactjs.
8
8
 
9
- The idea of wwact is to keep the value associated with a `component` as a closure.
9
+ The idea of litheNT is to keep the value associated with a `component` as a closure.
10
10
 
11
11
  There aren't as many rules as in React, you just need to know how closures work in JSX and JavaScript.
12
12
 
13
13
  ## Install
14
14
 
15
15
  ```bash
16
- pnpm add wwact
16
+ pnpm add lithent
17
17
  ```
18
18
 
19
19
  ## Using JSX
@@ -44,14 +44,14 @@ import {
44
44
  ref,
45
45
  mountCallback,
46
46
  updateCallback,
47
- wwx,
48
- } from 'wwact';
49
- import { state, computed, effect } from 'wwact/helper';
47
+ mount,
48
+ } from 'lithent';
49
+ import { state, computed, effect } from 'lithent/helper';
50
50
 
51
51
  // This is the "mount" function.
52
52
  // This function is only executed on mount, and on update, only updates `props` and then executes the internal return function.
53
53
  // childen is passed as the second argument.
54
- const ChildComponent = wwx<{ parentValue: number }>(
54
+ const ChildComponent = mount<{ parentValue: number }>(
55
55
  (renew, props, children) => {
56
56
  // The value is used as a "getter" to make it easy to get and write to in the higher-order functions it returns
57
57
  const count = state<number>(1, renew);
@@ -120,7 +120,7 @@ const ChildComponent = wwx<{ parentValue: number }>(
120
120
  }
121
121
  );
122
122
 
123
- const Root = wwx(renew => {
123
+ const Root = mount(renew => {
124
124
  const parentNumber = state<number>(7, renew);
125
125
 
126
126
  const increaseParent = () => {
@@ -157,9 +157,9 @@ npm install -g pnpm
157
157
 
158
158
  ## project install
159
159
  ```bash
160
- git clone https://github.com/superlucky84/wwact.git
160
+ git clone https://github.com/superlucky84/lithent.git
161
161
 
162
- cd wwact
162
+ cd lithent
163
163
 
164
164
  pnpm install
165
165
  ```
@@ -171,32 +171,16 @@ pnpm build:all
171
171
 
172
172
  ## Running the development environment
173
173
  ```bash
174
- pnpm dev:wwact
174
+ pnpm dev
175
175
  ```
176
176
 
177
177
  ---
178
178
 
179
179
  # Packages
180
180
 
181
- ## wwact
181
+ ## lithent
182
182
 
183
- Main module
183
+ ## helper
184
184
 
185
185
  ## router
186
186
 
187
- Hash routing extension
188
-
189
- ## compiler
190
-
191
- Converter for using template syntax(.wwx)
192
-
193
- Can be used using `jsx` without using `wwx`
194
-
195
- ## vitePlugin
196
-
197
- A plugin to connect the template syntax (wwx) and the transpiler to the vite build tool
198
-
199
- ## wwveal
200
-
201
- Presentation tool made with wwact
202
-
package/dist/index.d.ts CHANGED
@@ -3,22 +3,7 @@ import { render } from './render';
3
3
  import { mountCallback } from './hook/mountCallback';
4
4
  import { updateCallback } from './hook/updateCallback';
5
5
  import { ref } from './hook/ref';
6
- declare const ext: {
7
- componentRef: import('./types').ComponentRef;
8
- componentKeyRef: {
9
- value: import('./types').Props;
10
- };
11
- dataStoreStore: {
12
- [key: string]: import('./types').UseDataStoreValue;
13
- };
14
- dataStoreRenderQueue: {
15
- [key: string]: (() => boolean)[];
16
- };
17
- checkFunction: (target: unknown) => target is Function;
18
- getComponentKey: () => import('./types').Props;
19
- componentRender: (componentKey: import('./types').Props) => () => boolean;
20
- };
21
- export type { WDom, TagFunction, TagFunctionResolver, FragmentFunction, ComponentSubKey, ComponentRef, Props, Renew, MiddleStateWDomChildren, MiddleStateWDom, UseDataStoreValue, NodePointer, Param, } from './types';
6
+ export type { WDom, TagFunction, TagFunctionResolver, FragmentFunction, ComponentSubKey, ComponentRef, Props, Renew, MiddleStateWDomChildren, MiddleStateWDom, NodePointer, Param, } from './types';
22
7
  declare global {
23
8
  namespace JSX {
24
9
  interface IntrinsicElements {
@@ -26,4 +11,4 @@ declare global {
26
11
  }
27
12
  }
28
13
  }
29
- export { h, Fragment, render, mount, mountCallback, updateCallback, ref, ext };
14
+ export { h, Fragment, render, mount, mountCallback, updateCallback, ref };
package/dist/lithent.mjs CHANGED
@@ -14,7 +14,6 @@ const checkSameFragment = ({ originalWDom, newWDom }) => {
14
14
  const checkSameTagElement = ({ originalWDom, newWDom }) => checkPlainWDomType(newWDom) && (originalWDom == null ? void 0 : originalWDom.type) === "element" && (originalWDom == null ? void 0 : originalWDom.tag) === newWDom.tag;
15
15
  const checkNormalTypeElement = ({ originalWDom, newWDom }) => checkPlainWDomType(newWDom) && (originalWDom == null ? void 0 : originalWDom.type) === newWDom.type;
16
16
  const checkExisty = (value) => value !== null && value !== void 0;
17
- const checkFunction = (target) => typeof target === "function";
18
17
  const checkStyleData = (dataKey, dataValue) => dataKey === "style" && typeof dataValue === "object";
19
18
  const checkRefData = (dataKey, dataValue) => dataKey === "ref" && typeof dataValue === "object";
20
19
  const checkOptionElement = (element) => {
@@ -95,17 +94,21 @@ const removeNodeChildKey = (item) => {
95
94
  nodeChildKeyList.value.splice(nodeChildKeyList.value.indexOf(item), 1);
96
95
  };
97
96
  const cleanNodeChildKey = () => nodeChildKeyList.value = [];
98
- const dataStoreStore = {};
99
- const dataStoreRenderQueue = {};
97
+ const startMakeNodeChildKey = (componentKey) => {
98
+ const nodeChildKey = { value: [] };
99
+ pushNodeChildKey(componentKey);
100
+ nodeChildKeyList.value.push(nodeChildKey);
101
+ return nodeChildKey;
102
+ };
100
103
  const componentRender = (componentKey) => () => {
101
104
  var _a;
102
105
  const up = (_a = componentRef.get(componentKey)) == null ? void 0 : _a.up;
106
+ let result = false;
103
107
  if (up) {
104
108
  up();
105
- return true;
106
- } else {
107
- return false;
109
+ result = true;
108
110
  }
111
+ return result;
109
112
  };
110
113
  const setComponetRef = (componentKey) => {
111
114
  componentRef.set(componentKey, {
@@ -731,9 +734,7 @@ const makeWDomResolver = ({
731
734
  const constructor = tag;
732
735
  const resolve = (componentKey = props) => {
733
736
  initMountHookState(componentKey);
734
- const nodeChildKey = { value: [] };
735
- pushNodeChildKey(componentKey);
736
- nodeChildKeyList.value.push(nodeChildKey);
737
+ const nodeChildKey = startMakeNodeChildKey(componentKey);
737
738
  const component = tag(props, children);
738
739
  const componentMaker = component(
739
740
  componentRender(componentKey),
@@ -776,9 +777,7 @@ const wDomMaker = (wDomInfo) => {
776
777
  const { componentMaker, componentKey, tag, props, children } = wDomInfo;
777
778
  initUpdateHookState(componentKey);
778
779
  runUpdateCallback();
779
- const nodeChildKey = { value: [] };
780
- pushNodeChildKey(componentKey);
781
- nodeChildKeyList.value.push(nodeChildKey);
780
+ const nodeChildKey = startMakeNodeChildKey(componentKey);
782
781
  const originalWDom = componentMaker();
783
782
  wDomInfo.nodeChildKey = nodeChildKey;
784
783
  setRedrawAction({
@@ -845,18 +844,8 @@ const makeChildrenItem = (item) => {
845
844
  return item;
846
845
  };
847
846
  const ref = (initValue) => ({ value: initValue });
848
- const ext = {
849
- componentRef,
850
- componentKeyRef,
851
- dataStoreStore,
852
- dataStoreRenderQueue,
853
- checkFunction,
854
- getComponentKey,
855
- componentRender
856
- };
857
847
  export {
858
848
  Fragment,
859
- ext,
860
849
  h,
861
850
  mount,
862
851
  mountCallback,
@@ -1 +1 @@
1
- {"version":3,"file":"lithent.mjs","sources":["../src/utils/predicator.ts","../src/utils/index.ts","../src/utils/universalRef.ts","../src/hook/unmount.ts","../src/hook/mountCallback.ts","../src/hook/useUpdate.ts","../src/render.ts","../src/diff.ts","../src/hook/updateCallback.ts","../src/wDom.ts","../src/hook/ref.ts","../src/index.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 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 {\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","export const ref = <T>(initValue: T) => ({ value: initValue });\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"],"names":["updateProps","getParent","reRender"],"mappings":"AAwBO,MAAM,+BAA+B,CAC1C,WAEC,OAAO,WAAW,cAAc,CAAC,sBAAsB,MAAM,KAC7D,OAAO,WAAW,YAAY,aAAa;AAEvC,MAAM,wBAAwB,CACnC,WAEA,OAAO,WAAW,cAAc,WAAW;AAEtC,MAAM,qBAAqB,CAAC,SACjC,OAAO,SAAS,YAAY,EAAE,aAAa;AAEhC,MAAA,iBAAiB,CAAC,MAAiB,aAC9C,mBAAmB,IAAI,KAAK,KAAK,SAAS;AAErC,MAAM,oBAAoB,CAAC,SAChC,mBAAmB,IAAI,KAAK,CAAC,KAAK;AAE7B,MAAM,2BAA2B,CAAC;AAAA,EACvC;AAAA,EACA;AACF,MAAiB,QAAQ,iBAAgB,6CAAc;AAEhD,MAAM,oBAAoB,CAAC,EAAE,cAAc,QAAA,MAChD;AA1BK;AA0BL,4BAAmB,OAAO,MAC1B,6CAAc,UAAS,gBACvB,kDAAc,aAAd,mBAAwB,cAAW,wCAAS,aAAT,mBAAmB;AAAA;AAEjD,MAAM,sBAAsB,CAAC,EAAE,cAAc,QAClD,MAAA,mBAAmB,OAAO,MAC1B,6CAAc,UAAS,cACvB,6CAAc,SAAQ,QAAQ;AAEnB,MAAA,yBAAyB,CAAC,EAAE,cAAc,cACrD,mBAAmB,OAAO,MAAK,6CAAc,UAAS,QAAQ;AAEzD,MAAM,cAAc,CAAC,UAC1B,UAAU,QAAQ,UAAU;AAEvB,MAAM,gBAAgB,C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B,IAAI;AAE7B,YAAA,YAAY,MAAM,kBAAkB;AAEvC,SAAA;AACT,CAAC;AAEH,MAAM,mBAAmB,CAAC,SAAgC;AACxD,MAAI,SAAS,QAAQ,SAAS,UAAa,SAAS,OAAO;AAClD,WAAA,EAAE,MAAM;EACN,WAAA,MAAM,QAAQ,IAAI,GAAG;AACxB,UAAA,oBAAiC,EAAE,OAAO,OAAU;AACpD,UAAA,WAAW,eAAe,mBAAmB,IAAI;AACvD,UAAM,OAAO;AAAA,MACX,MAAM;AAAA,MACN;AAAA,IAAA;AAEF,sBAAkB,QAAQ;AAEnB,WAAA;AAAA,aACE,OAAO,SAAS,YAAY,OAAO,SAAS,UAAU;AAC/D,WAAO,EAAE,MAAM,QAAQ,MAAM,KAAK;AAAA,EACpC;AAEO,SAAA;AACT;AC3RO,MAAM,MAAM,CAAI,eAAkB,EAAE,OAAO,UAAU;ACe5D,MAAM,MAAM;AAAA,EACV;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;"}
1
+ {"version":3,"file":"lithent.mjs","sources":["../src/utils/predicator.ts","../src/utils/index.ts","../src/utils/universalRef.ts","../src/hook/unmount.ts","../src/hook/mountCallback.ts","../src/hook/useUpdate.ts","../src/render.ts","../src/diff.ts","../src/hook/updateCallback.ts","../src/wDom.ts","../src/hook/ref.ts"],"sourcesContent":["import { Fragment } from '@/wDom';\nimport {\n WDom,\n TagFunction,\n TagFunctionResolver,\n FragmentFunction,\n WDomType,\n} from '@/types';\n\ntype 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 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 {\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","export const ref = <T>(initValue: T) => ({ value: initValue });\n"],"names":["updateProps","getParent","reRender"],"mappings":"AAwBO,MAAM,+BAA+B,CAC1C,WAEC,OAAO,WAAW,cAAc,CAAC,sBAAsB,MAAM,KAC7D,OAAO,WAAW,YAAY,aAAa;AAEvC,MAAM,wBAAwB,CACnC,WAEA,OAAO,WAAW,cAAc,WAAW;AAEtC,MAAM,qBAAqB,CAAC,SACjC,OAAO,SAAS,YAAY,EAAE,aAAa;AAEhC,MAAA,iBAAiB,CAAC,MAAiB,aAC9C,mBAAmB,IAAI,KAAK,KAAK,SAAS;AAErC,MAAM,oBAAoB,CAAC,SAChC,mBAAmB,IAAI,KAAK,CAAC,KAAK;AAE7B,MAAM,2BAA2B,CAAC;AAAA,EACvC;AAAA,EACA;AACF,MAAiB,QAAQ,iBAAgB,6CAAc;AAEhD,MAAM,oBAAoB,CAAC,EAAE,cAAc,QAAA,MAChD;AA1BK;AA0BL,4BAAmB,OAAO,MAC1B,6CAAc,UAAS,gBACvB,kDAAc,aAAd,mBAA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KAAK,OAAO,UAAU;AAEtE,WAAO,YAAY,QACf,uBACA,qBAAqB,QAAQ;AAAA,EACnC;AAEO,SAAA;AAAA,IACL,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;AAEA,MAAM,iBAAiB,CACrB,mBACA,aAEA,SAAS,IAAI,CAAC,SAA0B;AAChC,QAAA,YAAY,iBAAiB,IAAI;AAE7B,YAAA,YAAY,MAAM,kBAAkB;AAEvC,SAAA;AACT,CAAC;AAEH,MAAM,mBAAmB,CAAC,SAAgC;AACxD,MAAI,SAAS,QAAQ,SAAS,UAAa,SAAS,OAAO;AAClD,WAAA,EAAE,MAAM;EACN,WAAA,MAAM,QAAQ,IAAI,GAAG;AACxB,UAAA,oBAAiC,EAAE,OAAO,OAAU;AACpD,UAAA,WAAW,eAAe,mBAAmB,IAAI;AACvD,UAAM,OAAO;AAAA,MACX,MAAM;AAAA,MACN;AAAA,IAAA;AAEF,sBAAkB,QAAQ;AAEnB,WAAA;AAAA,aACE,OAAO,SAAS,YAAY,OAAO,SAAS,UAAU;AAC/D,WAAO,EAAE,MAAM,QAAQ,MAAM,KAAK;AAAA,EACpC;AAEO,SAAA;AACT;ACnRO,MAAM,MAAM,CAAI,eAAkB,EAAE,OAAO,UAAU;"}
@@ -1,2 +1,2 @@
1
- !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).lithent={})}(this,(function(e){"use strict";const n=e=>"function"==typeof e&&!o(e)||"object"==typeof e&&"resolve"in e,o=e=>"function"==typeof e&&e===ie,t=e=>"object"==typeof e&&!("resolve"in e),l=(e,n)=>t(e)&&e.type===n,r=e=>t(e)&&!e.type,i=({originalWDom:e,newWDom:n})=>t(n)&&(null==e?void 0:e.type)===n.type,p=e=>null!=e,c=(e,n)=>"style"===e&&"object"==typeof n,d={c:({originalWDom:e,newWDom:n})=>n.constructor===(null==e?void 0:e.constructor),l:i,t:i,e:({originalWDom:e,newWDom:n})=>t(n)&&"element"===(null==e?void 0:e.type)&&(null==e?void 0:e.tag)===n.tag,f:({originalWDom:e,newWDom:n})=>{var o,l;return t(n)&&"fragment"===(null==e?void 0:e.type)&&(null==(o=null==e?void 0:e.children)?void 0:o.length)===(null==(l=null==n?void 0:n.children)?void 0:l.length)},et:i},a=e=>{const n=e.getParent&&e.getParent();if(!n)throw Error("Not found parent vDom");return n},u=(e,n)=>{e&&n!==e&&(Object.keys(e).forEach((n=>delete e[n])),Object.entries(n||{}).forEach((([n,o])=>e[n]=o)))},s=(e,n)=>{e&&n!==e&&(e.splice(0,e.length),n&&n.forEach((n=>e.push(n))))},m={value:{}},v={value:!1},h=new WeakMap,y={value:[]},f={value:null},g={value:[]},D=e=>g.value.forEach((n=>n.value.push(e))),W=e=>{g.value.splice(g.value.indexOf(e),1)},E=e=>()=>{var n;const o=null==(n=h.get(e))?void 0:n.up;return!!o&&(o(),!0)},w=()=>m.value,C=({componentKey:e,nodeChildKey:n,exec:o})=>{h.get(e).up=()=>{y.value.push({componentKey:e,nodeChildKey:n.value,exec:o}),f.value||(f.value=setTimeout(S))}},K=e=>{m.value=e,(e=>{h.set(e,{up:()=>{},upR:[],upS:{value:0},upD:[],upCB:[],mts:[],umts:[]})})(e)},S=()=>{let e=[];y.value.forEach((n=>{e=e.concat(n.nodeChildKey)}));const n=[],o=y.value.reduce(((o,t)=>{const{componentKey:l}=t;return e.includes(l)||n.includes(l)||(n.push(l),o.push(t)),o}),[]);for(;o.length;){const e=o.shift();e&&e.exec()}},R=e=>{const n=h.get(e).umts;h.get(e).umts=[],n.forEach((e=>e())),h.delete(e)},P=e=>{const{componentKey:n}=e;if(n){const e=h.get(n),o=null==e?void 0:e.mts,t=null==e?void 0:e.upS;m.value=n,t&&(t.value=0),o&&(e.mts=[],o.forEach((e=>{const n=e();var o;n&&(o=n,h.get(w()).umts.push(o))})))}},b=(e,n=(()=>[]))=>{const o=h.get(w()),{upD:t,upS:l}=o,r=t[l.value];if(r&&x(r,n())){const n=e();n&&o.upCB.push(n)}t[l.value]=n(),l.value+=1},x=(e,n)=>!e.length&&!e.length||e.some(((e,o)=>e!==n[o])),T=e=>{const{needRerender:n}=e;if(n&&"N"!==n){(0,{A:A,D:O,R:L,U:H,SR:N,SU:U}[n])(e)}},k=e=>{e.props&&e.el&&F(e.props,e.el),(e.children||[]).forEach((e=>{k(e)}))},O=e=>{var n,o;const t=G(e);e.oldProps&&e.el&&F(e.oldProps,e.el),t&&e.el&&(1===(null==(n=e.el)?void 0:n.nodeType)?t.removeChild(e.el):11===(null==(o=e.el)?void 0:o.nodeType)&&j(e,t),delete e.el)},j=(e,n)=>{((null==e?void 0:e.children)||[]).forEach((e=>{var o,t;1===(null==(o=e.el)?void 0:o.nodeType)?n.removeChild(null==e?void 0:e.el):11===(null==(t=e.el)?void 0:t.nodeType)&&j(e,n)}))},N=e=>{O(e),A(e)},U=e=>{O(e),A(e,e.el)},A=(e,n)=>{n||(n=Q(e,!0));const o=a(e);if(o.type){const t=G(o),l=B(e,o);n&&t&&(l?t.insertBefore(n,l):t.appendChild(n))}P(e)},B=(e,n)=>{const o=n.children||[],t=o.indexOf(e)+1,l=o.slice(t),r=M(l),i=n.type||"";return r||(!n.isRoot&&["fragment","loop"].includes(i)?B(n,a(n)):void 0)},M=e=>e.reduce(((e,n)=>{const o=n.type,t=n.el,l=o&&["fragment","loop"].includes(o);return e||(l?M(n.children||[]):t&&11!==t.nodeType?t:e)}),void 0),L=e=>{const n=a(e),o=e.el;if(n.type&&o){const t=n.el,l=Q(e,!0);e.oldProps&&F(e.oldProps,o),t&&t.replaceChild(l,o)}P(e)},F=(e,n)=>{n&&Object.entries(e||{}).forEach((([e,o])=>{e.match(/^on/)&&n.removeEventListener(e,o)}))},H=e=>{var n;const o=e.el;if("text"!==e.type){if(o){const{oldProps:t,props:l}=e;I({oldProps:t,props:l,element:o}),delete e.oldProps,"input"===e.tag&&(o.value=String((null==(n=null==e?void 0:e.props)?void 0:n.value)||""))}(e.children||[]).forEach((e=>T(e))),(e=>{const{componentKey:n}=e;if(n){const o=h.get(n),t=null==o?void 0:o.upCB,l=null==o?void 0:o.upS;m.value=n,l&&(l.value=0),e.constructor&&t&&(o.upCB=[],t.forEach((e=>e())))}})(e)}else _(e)},_=e=>{const n=e.el;n&&(n.nodeValue=String(e.text))},I=({oldProps:e,props:n,element:o})=>{const t={...e};Object.entries(n||{}).forEach((([e,n])=>{if("key"===e);else if(c(e,n)){const l=n,r=c(e,t.style)||{};z({style:l,oldStyle:r,element:o})}else((e,n)=>"ref"===e&&"object"==typeof n)(e,n)?n.value=o:e.match(/^on/)?q({element:o,eventKey:e,newEventHandler:n,oldEventHandler:t[e]}):(e=>"number"==typeof e||"string"==typeof e)(n)?o.setAttribute(e,String(n)):(e=>1===e.nodeType&&"OPTION"===e.tagName)(o)&&"selected"===e&&(o.selected=!!n);delete t[e]})),Object.keys(t).forEach((e=>o.removeAttribute(e)))},Q=(e,n)=>{let o;const{type:t,tag:l,text:r,props:i,children:c=[]}=e;return"fragment"===t||"loop"===t?o=new DocumentFragment:"element"===t&&l?o=document.createElement(l):"text"===t&&p(r)&&(o=document.createTextNode(String(r))),V(c,o,n),I({props:i,element:o}),e.el=o,P(e),o||document.createElement("div")},V=(e,n,o)=>{if(o){const t=e.reduce(((e,n)=>(n.type&&e.appendChild(Q(n,o)),e)),new DocumentFragment);n&&t.hasChildNodes()&&n.appendChild(t)}},q=({element:e,eventKey:n,newEventHandler:o,oldEventHandler:t})=>{const l=n.replace(/^on(.*)/,((e,n)=>n.toLowerCase()));t!==o&&(t&&e.removeEventListener(l,t),o&&e.addEventListener(l,o))},z=({style:e,oldStyle:n,element:o})=>{const t={...n},l=null==o?void 0:o.style;l&&(Object.entries(e).forEach((([e,n])=>{l.setProperty(e,n),delete t[e]})),Object.entries(t).forEach((([e])=>l.removeProperty(e))))},G=e=>{var n,o;const t="fragment"===e.type||"loop"===e.type||!e.type&&11===(null==(n=null==e?void 0:e.el)?void 0:n.nodeType);if(e.isRoot&&t)return e.wrapElement;if(!t)return null==(o=e.el)?void 0:o.parentNode;const l=a(e);return G(l)},J=({originalWDom:e,newWDom:o})=>{const t=(e=>{let o;return n(e)?o="c":l(e,"fragment")?o="f":l(e,"element")?o="e":l(e,"loop")?o="l":l(e,"text")?o="t":r(e)&&(o="et"),o})(o);if(!t)throw new Error("Unknown type wdom");const i=d[t]({originalWDom:e,newWDom:o}),p=X({originalWDom:e,newWDom:o,isSameType:i});return(null==p?void 0:p.nodeChildKey)&&W(p.nodeChildKey),p},X=({newWDom:e,originalWDom:n,isSameType:o})=>{const t=Z({newWDom:e,originalWDom:n,isSameType:o});t.children=$({isSameType:o,newWDom:t,originalWDom:n});const l=Y({originalWDom:n,newWDom:t,isSameType:o});return t.needRerender=l,"A"!==l&&n&&(t.el=n.el),l&&["D","R","SR"].includes(l)&&(null==n?void 0:n.componentKey)&&((e=>{const{componentKey:n,nodeChildKey:o}=e,t=null==o?void 0:o.value;n&&R(n),t&&t.forEach((e=>R(e)))})(n),k(n),t.children=n.children),t.oldProps=null==n?void 0:n.props,t},Y=({originalWDom:e,newWDom:n,isSameType:o})=>{const t=e&&e.type,l=r(n),i=!!n.getParent&&a(n).type,c=re(n),d="loop"===i&&p(c),u="text"===n.type&&o&&n.text===(null==e?void 0:e.text);let s;return s=l?"D":u?"N":t?o?d?"SU":"U":d?"SR":"R":"A",s},Z=({newWDom:e,originalWDom:o,isSameType:t})=>n(e)?t&&o?((e,n)=>{const{componentProps:o,componentChildren:t}=e,{props:l,children:r}=n;o&&u(o,l),t&&s(t,r);const i=e.reRender&&e.reRender();if(!i)throw Error("Unable reRender");return i})(o,e):e.resolve():e,$=({isSameType:e,newWDom:n,originalWDom:o})=>e&&o?ne(n,o):ee(n),ee=e=>(e.children||[]).map((n=>{const o=J({newWDom:n});return o.getParent=()=>e,o})),ne=(e,n)=>"loop"===e.type&&p(re((e.children||[])[0]))?oe(e,n):(e.children||[]).map(((o,t)=>{const l=J({newWDom:o,originalWDom:(n.children||[])[t]});return l.getParent=()=>e,l})),oe=(e,n)=>{const{remakedChildren:o,unUsedChildren:t}=te(e,n);return t.map((e=>{const n=e.el;n&&n.parentNode&&n.parentNode.removeChild(n)})),o},te=(e,n)=>{const o=[...e.children||[]],t=[...n.children||[]];return{remakedChildren:o.map((n=>{const o=le(n,t),l=J({newWDom:n,originalWDom:o});return o&&t.splice(t.indexOf(o),1),l.getParent=()=>e,l})),unUsedChildren:t}},le=(e,n)=>{const o=re(e);return n.find((e=>re(e)===o))},re=e=>{var n,o,t;return null!=(t=null==(n=null==e?void 0:e.componentProps)?void 0:n.key)?t:null==(o=null==e?void 0:e.props)?void 0:o.key},ie=(e,...n)=>({type:"fragment",children:n}),pe=({tag:e,props:n,children:o,originalWDom:t})=>{var l;v.value=!0,g.value=[];const r=ce({tag:e,props:n,children:o}),i=J({originalWDom:t,newWDom:r}),{isRoot:p,getParent:c,wrapElement:d}=t;if(i.getParent=c,!p&&c){const e=(null==(l=c())?void 0:l.children)||[],n=e.indexOf(t);e.splice(n,1,i)}else i.isRoot=!0,i.wrapElement=d;T(i),v.value=!1},ce=({tag:e,props:n,children:o})=>({tagName:e.name,constructor:e,props:n,children:o,resolve:(t=n)=>{K(t);const l={value:[]};D(t),g.value.push(l);const r=e(n,o)(E(t),n,o),i=de({componentMaker:r,componentKey:t,tag:e,props:n,children:o,nodeChildKey:l}),p=i;return C({componentKey:t,nodeChildKey:l,exec:()=>pe({tag:e,props:n,children:o,originalWDom:p})}),v.value||W(l),i}}),de=e=>{const{componentMaker:n}=e,o=n(),t=ae(e);return se(o,{...e,reRender:t}),o},ae=e=>{const n=()=>ue({...e,reRender:n});return n},ue=e=>{const{componentMaker:n,componentKey:o,tag:t,props:l,children:r}=e;(e=>{m.value=e})(o),(()=>{var e;const n=null==(e=h.get(w()))?void 0:e.upR;(null==n?void 0:n.length)&&n.forEach((e=>e())),y.value=[],f.value=null})();const i={value:[]};D(o),g.value.push(i);const p=n();return e.nodeChildKey=i,C({componentKey:o,nodeChildKey:i,exec:()=>pe({tag:t,props:l,children:r,originalWDom:p})}),se(p,e),v.value||W(i),p},se=(e,n)=>{const{componentKey:o,tag:t,props:l,children:r,reRender:i,nodeChildKey:p}=n;Object.assign(e,{componentProps:l,componentChildren:r,constructor:t,tagName:t.name,componentKey:o,nodeChildKey:p,reRender:i})},me=({tag:e,props:t,children:l})=>{if(o(e))return ie(t,...l);if(n(e)){const n=ce({tag:e,props:t,children:l});return v.value?n:n.resolve()}return{type:"element",tag:e,props:t,children:l}},ve=(e,n)=>n.map((n=>{const o=he(n);return o.getParent=()=>e.value,o})),he=e=>{if(null==e||!1===e)return{type:null};if(Array.isArray(e)){const n={value:void 0},o={type:"loop",children:ve(n,e)};return n.value=o,o}return"string"==typeof e||"number"==typeof e?{type:"text",text:e}:e},ye={componentRef:h,componentKeyRef:m,dataStoreStore:{},dataStoreRenderQueue:{},checkFunction:e=>"function"==typeof e,getComponentKey:w,componentRender:E};e.Fragment=ie,e.ext=ye,e.h=(e,o,...t)=>{const l={value:void 0},r=o||{},i=ve(l,t),p=me({tag:e,props:r,children:i});return n(p)||(l.value=p),p},e.mount=e=>(n,o)=>e,e.mountCallback=e=>{h.get(w()).mts.push(e)},e.ref=e=>({value:e}),e.render=(e,n,o)=>{if(!n)throw Error("WrapELement is null");e.isRoot=!0,e.wrapElement=n;const t=Q(e,!0);o?n.insertBefore(t,o):n.appendChild(t)},e.updateCallback=(e,n=(()=>[]))=>{h.get(w()).upR.push((()=>b(e,n))),b(e,n)},Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
1
+ !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).lithent={})}(this,(function(e){"use strict";const n=e=>"function"==typeof e&&!o(e)||"object"==typeof e&&"resolve"in e,o=e=>"function"==typeof e&&e===re,t=e=>"object"==typeof e&&!("resolve"in e),l=(e,n)=>t(e)&&e.type===n,r=e=>t(e)&&!e.type,i=({originalWDom:e,newWDom:n})=>t(n)&&(null==e?void 0:e.type)===n.type,d=e=>null!=e,p=(e,n)=>"style"===e&&"object"==typeof n,c={c:({originalWDom:e,newWDom:n})=>n.constructor===(null==e?void 0:e.constructor),l:i,t:i,e:({originalWDom:e,newWDom:n})=>t(n)&&"element"===(null==e?void 0:e.type)&&(null==e?void 0:e.tag)===n.tag,f:({originalWDom:e,newWDom:n})=>{var o,l;return t(n)&&"fragment"===(null==e?void 0:e.type)&&(null==(o=null==e?void 0:e.children)?void 0:o.length)===(null==(l=null==n?void 0:n.children)?void 0:l.length)},et:i},a=e=>{const n=e.getParent&&e.getParent();if(!n)throw Error("Not found parent vDom");return n},s=(e,n)=>{e&&n!==e&&(Object.keys(e).forEach((n=>delete e[n])),Object.entries(n||{}).forEach((([n,o])=>e[n]=o)))},u=(e,n)=>{e&&n!==e&&(e.splice(0,e.length),n&&n.forEach((n=>e.push(n))))},m={value:{}},v={value:!1},h=new WeakMap,y={value:[]},f={value:null},g={value:[]},D=e=>{g.value.splice(g.value.indexOf(e),1)},W=e=>{const n={value:[]};var o;return o=e,g.value.forEach((e=>e.value.push(o))),g.value.push(n),n},E=()=>m.value,w=({componentKey:e,nodeChildKey:n,exec:o})=>{h.get(e).up=()=>{y.value.push({componentKey:e,nodeChildKey:n.value,exec:o}),f.value||(f.value=setTimeout(K))}},C=e=>{m.value=e,(e=>{h.set(e,{up:()=>{},upR:[],upS:{value:0},upD:[],upCB:[],mts:[],umts:[]})})(e)},K=()=>{let e=[];y.value.forEach((n=>{e=e.concat(n.nodeChildKey)}));const n=[],o=y.value.reduce(((o,t)=>{const{componentKey:l}=t;return e.includes(l)||n.includes(l)||(n.push(l),o.push(t)),o}),[]);for(;o.length;){const e=o.shift();e&&e.exec()}},P=e=>{const n=h.get(e).umts;h.get(e).umts=[],n.forEach((e=>e())),h.delete(e)},S=e=>{const{componentKey:n}=e;if(n){const e=h.get(n),o=null==e?void 0:e.mts,t=null==e?void 0:e.upS;m.value=n,t&&(t.value=0),o&&(e.mts=[],o.forEach((e=>{const n=e();var o;n&&(o=n,h.get(E()).umts.push(o))})))}},b=(e,n=(()=>[]))=>{const o=h.get(E()),{upD:t,upS:l}=o,r=t[l.value];if(r&&x(r,n())){const n=e();n&&o.upCB.push(n)}t[l.value]=n(),l.value+=1},x=(e,n)=>!e.length&&!e.length||e.some(((e,o)=>e!==n[o])),R=e=>{const{needRerender:n}=e;if(n&&"N"!==n){(0,{A:U,D:O,R:M,U:H,SR:k,SU:N}[n])(e)}},T=e=>{e.props&&e.el&&L(e.props,e.el),(e.children||[]).forEach((e=>{T(e)}))},O=e=>{var n,o;const t=G(e);e.oldProps&&e.el&&L(e.oldProps,e.el),t&&e.el&&(1===(null==(n=e.el)?void 0:n.nodeType)?t.removeChild(e.el):11===(null==(o=e.el)?void 0:o.nodeType)&&j(e,t),delete e.el)},j=(e,n)=>{((null==e?void 0:e.children)||[]).forEach((e=>{var o,t;1===(null==(o=e.el)?void 0:o.nodeType)?n.removeChild(null==e?void 0:e.el):11===(null==(t=e.el)?void 0:t.nodeType)&&j(e,n)}))},k=e=>{O(e),U(e)},N=e=>{O(e),U(e,e.el)},U=(e,n)=>{n||(n=I(e,!0));const o=a(e);if(o.type){const t=G(o),l=A(e,o);n&&t&&(l?t.insertBefore(n,l):t.appendChild(n))}S(e)},A=(e,n)=>{const o=n.children||[],t=o.indexOf(e)+1,l=o.slice(t),r=B(l),i=n.type||"";return r||(!n.isRoot&&["fragment","loop"].includes(i)?A(n,a(n)):void 0)},B=e=>e.reduce(((e,n)=>{const o=n.type,t=n.el,l=o&&["fragment","loop"].includes(o);return e||(l?B(n.children||[]):t&&11!==t.nodeType?t:e)}),void 0),M=e=>{const n=a(e),o=e.el;if(n.type&&o){const t=n.el,l=I(e,!0);e.oldProps&&L(e.oldProps,o),t&&t.replaceChild(l,o)}S(e)},L=(e,n)=>{n&&Object.entries(e||{}).forEach((([e,o])=>{e.match(/^on/)&&n.removeEventListener(e,o)}))},H=e=>{var n;const o=e.el;if("text"!==e.type){if(o){const{oldProps:t,props:l}=e;_({oldProps:t,props:l,element:o}),delete e.oldProps,"input"===e.tag&&(o.value=String((null==(n=null==e?void 0:e.props)?void 0:n.value)||""))}(e.children||[]).forEach((e=>R(e))),(e=>{const{componentKey:n}=e;if(n){const o=h.get(n),t=null==o?void 0:o.upCB,l=null==o?void 0:o.upS;m.value=n,l&&(l.value=0),e.constructor&&t&&(o.upCB=[],t.forEach((e=>e())))}})(e)}else F(e)},F=e=>{const n=e.el;n&&(n.nodeValue=String(e.text))},_=({oldProps:e,props:n,element:o})=>{const t={...e};Object.entries(n||{}).forEach((([e,n])=>{if("key"===e);else if(p(e,n)){const l=n,r=p(e,t.style)||{};z({style:l,oldStyle:r,element:o})}else((e,n)=>"ref"===e&&"object"==typeof n)(e,n)?n.value=o:e.match(/^on/)?q({element:o,eventKey:e,newEventHandler:n,oldEventHandler:t[e]}):(e=>"number"==typeof e||"string"==typeof e)(n)?o.setAttribute(e,String(n)):(e=>1===e.nodeType&&"OPTION"===e.tagName)(o)&&"selected"===e&&(o.selected=!!n);delete t[e]})),Object.keys(t).forEach((e=>o.removeAttribute(e)))},I=(e,n)=>{let o;const{type:t,tag:l,text:r,props:i,children:p=[]}=e;return"fragment"===t||"loop"===t?o=new DocumentFragment:"element"===t&&l?o=document.createElement(l):"text"===t&&d(r)&&(o=document.createTextNode(String(r))),V(p,o,n),_({props:i,element:o}),e.el=o,S(e),o||document.createElement("div")},V=(e,n,o)=>{if(o){const t=e.reduce(((e,n)=>(n.type&&e.appendChild(I(n,o)),e)),new DocumentFragment);n&&t.hasChildNodes()&&n.appendChild(t)}},q=({element:e,eventKey:n,newEventHandler:o,oldEventHandler:t})=>{const l=n.replace(/^on(.*)/,((e,n)=>n.toLowerCase()));t!==o&&(t&&e.removeEventListener(l,t),o&&e.addEventListener(l,o))},z=({style:e,oldStyle:n,element:o})=>{const t={...n},l=null==o?void 0:o.style;l&&(Object.entries(e).forEach((([e,n])=>{l.setProperty(e,n),delete t[e]})),Object.entries(t).forEach((([e])=>l.removeProperty(e))))},G=e=>{var n,o;const t="fragment"===e.type||"loop"===e.type||!e.type&&11===(null==(n=null==e?void 0:e.el)?void 0:n.nodeType);if(e.isRoot&&t)return e.wrapElement;if(!t)return null==(o=e.el)?void 0:o.parentNode;const l=a(e);return G(l)},J=({originalWDom:e,newWDom:o})=>{const t=(e=>{let o;return n(e)?o="c":l(e,"fragment")?o="f":l(e,"element")?o="e":l(e,"loop")?o="l":l(e,"text")?o="t":r(e)&&(o="et"),o})(o);if(!t)throw new Error("Unknown type wdom");const i=c[t]({originalWDom:e,newWDom:o}),d=Q({originalWDom:e,newWDom:o,isSameType:i});return(null==d?void 0:d.nodeChildKey)&&D(d.nodeChildKey),d},Q=({newWDom:e,originalWDom:n,isSameType:o})=>{const t=Y({newWDom:e,originalWDom:n,isSameType:o});t.children=Z({isSameType:o,newWDom:t,originalWDom:n});const l=X({originalWDom:n,newWDom:t,isSameType:o});return t.needRerender=l,"A"!==l&&n&&(t.el=n.el),l&&["D","R","SR"].includes(l)&&(null==n?void 0:n.componentKey)&&((e=>{const{componentKey:n,nodeChildKey:o}=e,t=null==o?void 0:o.value;n&&P(n),t&&t.forEach((e=>P(e)))})(n),T(n),t.children=n.children),t.oldProps=null==n?void 0:n.props,t},X=({originalWDom:e,newWDom:n,isSameType:o})=>{const t=e&&e.type,l=r(n),i=!!n.getParent&&a(n).type,p=le(n),c="loop"===i&&d(p),s="text"===n.type&&o&&n.text===(null==e?void 0:e.text);let u;return u=l?"D":s?"N":t?o?c?"SU":"U":c?"SR":"R":"A",u},Y=({newWDom:e,originalWDom:o,isSameType:t})=>n(e)?t&&o?((e,n)=>{const{componentProps:o,componentChildren:t}=e,{props:l,children:r}=n;o&&s(o,l),t&&u(t,r);const i=e.reRender&&e.reRender();if(!i)throw Error("Unable reRender");return i})(o,e):e.resolve():e,Z=({isSameType:e,newWDom:n,originalWDom:o})=>e&&o?ee(n,o):$(n),$=e=>(e.children||[]).map((n=>{const o=J({newWDom:n});return o.getParent=()=>e,o})),ee=(e,n)=>"loop"===e.type&&d(le((e.children||[])[0]))?ne(e,n):(e.children||[]).map(((o,t)=>{const l=J({newWDom:o,originalWDom:(n.children||[])[t]});return l.getParent=()=>e,l})),ne=(e,n)=>{const{remakedChildren:o,unUsedChildren:t}=oe(e,n);return t.map((e=>{const n=e.el;n&&n.parentNode&&n.parentNode.removeChild(n)})),o},oe=(e,n)=>{const o=[...e.children||[]],t=[...n.children||[]];return{remakedChildren:o.map((n=>{const o=te(n,t),l=J({newWDom:n,originalWDom:o});return o&&t.splice(t.indexOf(o),1),l.getParent=()=>e,l})),unUsedChildren:t}},te=(e,n)=>{const o=le(e);return n.find((e=>le(e)===o))},le=e=>{var n,o,t;return null!=(t=null==(n=null==e?void 0:e.componentProps)?void 0:n.key)?t:null==(o=null==e?void 0:e.props)?void 0:o.key},re=(e,...n)=>({type:"fragment",children:n}),ie=({tag:e,props:n,children:o,originalWDom:t})=>{var l;v.value=!0,g.value=[];const r=de({tag:e,props:n,children:o}),i=J({originalWDom:t,newWDom:r}),{isRoot:d,getParent:p,wrapElement:c}=t;if(i.getParent=p,!d&&p){const e=(null==(l=p())?void 0:l.children)||[],n=e.indexOf(t);e.splice(n,1,i)}else i.isRoot=!0,i.wrapElement=c;R(i),v.value=!1},de=({tag:e,props:n,children:o})=>({tagName:e.name,constructor:e,props:n,children:o,resolve:(t=n)=>{C(t);const l=W(t),r=e(n,o)((e=>()=>{var n;const o=null==(n=h.get(e))?void 0:n.up;let t=!1;return o&&(o(),t=!0),t})(t),n,o),i=pe({componentMaker:r,componentKey:t,tag:e,props:n,children:o,nodeChildKey:l}),d=i;return w({componentKey:t,nodeChildKey:l,exec:()=>ie({tag:e,props:n,children:o,originalWDom:d})}),v.value||D(l),i}}),pe=e=>{const{componentMaker:n}=e,o=n(),t=ce(e);return se(o,{...e,reRender:t}),o},ce=e=>{const n=()=>ae({...e,reRender:n});return n},ae=e=>{const{componentMaker:n,componentKey:o,tag:t,props:l,children:r}=e;(e=>{m.value=e})(o),(()=>{var e;const n=null==(e=h.get(E()))?void 0:e.upR;(null==n?void 0:n.length)&&n.forEach((e=>e())),y.value=[],f.value=null})();const i=W(o),d=n();return e.nodeChildKey=i,w({componentKey:o,nodeChildKey:i,exec:()=>ie({tag:t,props:l,children:r,originalWDom:d})}),se(d,e),v.value||D(i),d},se=(e,n)=>{const{componentKey:o,tag:t,props:l,children:r,reRender:i,nodeChildKey:d}=n;Object.assign(e,{componentProps:l,componentChildren:r,constructor:t,tagName:t.name,componentKey:o,nodeChildKey:d,reRender:i})},ue=({tag:e,props:t,children:l})=>{if(o(e))return re(t,...l);if(n(e)){const n=de({tag:e,props:t,children:l});return v.value?n:n.resolve()}return{type:"element",tag:e,props:t,children:l}},me=(e,n)=>n.map((n=>{const o=ve(n);return o.getParent=()=>e.value,o})),ve=e=>{if(null==e||!1===e)return{type:null};if(Array.isArray(e)){const n={value:void 0},o={type:"loop",children:me(n,e)};return n.value=o,o}return"string"==typeof e||"number"==typeof e?{type:"text",text:e}:e};e.Fragment=re,e.h=(e,o,...t)=>{const l={value:void 0},r=o||{},i=me(l,t),d=ue({tag:e,props:r,children:i});return n(d)||(l.value=d),d},e.mount=e=>(n,o)=>e,e.mountCallback=e=>{h.get(E()).mts.push(e)},e.ref=e=>({value:e}),e.render=(e,n,o)=>{if(!n)throw Error("WrapELement is null");e.isRoot=!0,e.wrapElement=n;const t=I(e,!0);o?n.insertBefore(t,o):n.appendChild(t)},e.updateCallback=(e,n=(()=>[]))=>{h.get(E()).upR.push((()=>b(e,n))),b(e,n)},Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
2
2
  //# sourceMappingURL=lithent.umd.js.map