lithent 0.30.0 → 0.31.1

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
@@ -46,7 +46,7 @@ import {
46
46
  updateCallback,
47
47
  mount,
48
48
  } from 'lithent';
49
- import { state, computed, effect } from 'lithent/helper';
49
+ import { state, computed, effect, store } 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.
@@ -55,13 +55,27 @@ 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);
58
- const text = state<string>('text', renew);
58
+ const text = state<string>(
59
+ '"destructuring" the "props" value directly from the mount function will cause referencing issues, so if you want to use it, you need to "destructuring" it from the internal function (updater).',
60
+ renew
61
+ );
59
62
  const getParentValue = () => props.parentValue;
60
- const parentValue = props.parentValue;
61
- const summ = computed<() => number>(
63
+ const parentValueFromMount = props.parentValue;
64
+ const summ = computed<number>(
62
65
  () => count.v + notRefValue + props.parentValue
63
66
  );
64
67
 
68
+ const localStore = store<{ text: string; count: number }>({
69
+ text: 's',
70
+ count: 0,
71
+ })(renew);
72
+ /*
73
+ // To share a store, make it externally and use `asign`.
74
+ const asignStore = store<{ text: string; count: number }>({ text: 's', count: 0 });
75
+
76
+ const sharedStore = asignStore(nenew);
77
+ */
78
+
65
79
  // Even if you don't use a ref, the private value is always maintained as a regular variable.
66
80
  let notRefValue = props.parentValue;
67
81
 
@@ -77,6 +91,11 @@ const ChildComponent = mount<{ parentValue: number }>(
77
91
  text.v = (event.target as HTMLInputElement).value;
78
92
  };
79
93
 
94
+ const localStoreUpdate = () => {
95
+ localStore.count += 1;
96
+ localStore.text += '1';
97
+ };
98
+
80
99
  const handleMounted = () => {
81
100
  console.log('MOUNTED', domRef);
82
101
 
@@ -100,21 +119,44 @@ const ChildComponent = mount<{ parentValue: number }>(
100
119
 
101
120
  // Wrap in a function and return (using a closure to hold the value)
102
121
  // This is the "update" function.
103
- return () => (
122
+ return ({ parentValue }) => (
104
123
  <Fragment>
105
124
  {/* Note that the event is onInput (we use the native event name to avoid confusion). */}
106
- <input type="text" value={text.v} onInput={handleInputChane} />
107
- <div ref={domRef}>count: {count.v}</div>
108
- {/* When the value is updated from the parent component, the function declared inside is executed, so you need to use the `props.` call by reference to output the latest value of the updated property. */}
109
- <div>parentValue: {props.parentValue} (working)</div>
110
- <div>parentValue: {getParentValue()} (working)</div>
111
- <div>parentValue: {parentValue} (not working)</div>
112
- <div>sum: {count.v + notRefValue + props.parentValue}</div>
113
- <div>sum(computed): {summ.v}</div>
114
- {/* It doesn't pull it out from under the reference, it uses the value directly, so you can just use it. */}
115
- <div>notRefValue: {notRefValue}</div>
116
- {children}
125
+ <div>
126
+ <textarea
127
+ value={text.v}
128
+ onInput={handleInputChane}
129
+ style={{ width: '300px', height: '100px' }}
130
+ />
131
+ </div>
132
+ <div>{text.v}</div>
133
+ <div>
134
+ <div style={{ color: 'blue' }}>
135
+ parentValueFromRef: {props.parentValue} (working)
136
+ </div>
137
+ <div style={{ color: 'blue' }}>
138
+ parentValueFromFunction: {getParentValue()} (working)
139
+ </div>
140
+ <div style={{ color: 'blue' }}>
141
+ parentValueFromUpdaterDestructuring: {parentValue} (working)
142
+ </div>
143
+ <div style={{ color: 'red' }}>
144
+ parentValueFromMounterDestructuring: {parentValueFromMount} (not
145
+ working)
146
+ </div>
147
+ </div>
148
+ <div>
149
+ <div ref={domRef}>count: {count.v}</div>
150
+ <div>sum: {count.v + notRefValue + props.parentValue}</div>
151
+ <div>sum(computed): {summ.v}</div>
152
+ {/* It doesn't pull it out from under the reference, it uses the value directly, so you can just use it. */}
153
+ <div>notRefValue: {notRefValue}</div>
154
+ <div>localStore(text): {localStore.text}</div>
155
+ <div>localStore(count): {localStore.count}</div>
156
+ </div>
117
157
  <button onClick={increase}>Increase</button>
158
+ <button onClick={localStoreUpdate}>localStoreUpdate</button>
159
+ {children}
118
160
  </Fragment>
119
161
  );
120
162
  }
@@ -133,18 +175,15 @@ const Root = mount(renew => {
133
175
 
134
176
  return () => (
135
177
  <Fragment>
178
+ <ChildComponent parentValue={parentNumber.v}>
179
+ <button onClick={increaseParent}>Increase - Parent</button>
180
+ </ChildComponent>
136
181
  <button onClick={decreaseParent}>Decrease - Parent</button>
137
- <div>
138
- <ChildComponent parentValue={parentNumber.v}>
139
- <button onClick={increaseParent}>Increase - Parent</button>
140
- </ChildComponent>
141
- </div>
142
182
  </Fragment>
143
183
  );
144
184
  });
145
- const root = <Root />;
146
185
 
147
- render(root, document.getElementById('root'));
186
+ render(<Root />, document.getElementById('root'));
148
187
  ```
149
188
 
150
189
  # Develop
package/dist/lithent.mjs CHANGED
@@ -19,6 +19,9 @@ const checkRefData = (dataKey, dataValue) => dataKey === "ref" && typeof dataVal
19
19
  const checkOptionElement = (element) => {
20
20
  return element.nodeType === 1 && element.tagName === "OPTION";
21
21
  };
22
+ const checkTextareaElement = (element) => {
23
+ return element.nodeType === 1 && element.tagName === "TEXTAREA";
24
+ };
22
25
  const checkNormalAttribute = (dataValue) => typeof dataValue === "number" || typeof dataValue === "string";
23
26
  const getWDomType = (wDom) => {
24
27
  let result;
@@ -430,10 +433,12 @@ const updateProps = ({
430
433
  newEventHandler: dataValue,
431
434
  oldEventHandler: originalProps[dataKey]
432
435
  });
433
- } else if (checkNormalAttribute(dataValue)) {
434
- element.setAttribute(dataKey, String(dataValue));
436
+ } else if (checkTextareaElement(element) && dataKey === "value") {
437
+ element.value = dataValue;
435
438
  } else if (checkOptionElement(element) && dataKey === "selected") {
436
439
  element.selected = !!dataValue;
440
+ } else if (checkNormalAttribute(dataValue)) {
441
+ element.setAttribute(dataKey, String(dataValue));
437
442
  }
438
443
  delete originalProps[dataKey];
439
444
  }
@@ -503,11 +508,11 @@ const updateStyle = ({
503
508
  const elementStyle = element == null ? void 0 : element.style;
504
509
  if (elementStyle) {
505
510
  Object.entries(style).forEach(([styleKey, dataValue]) => {
506
- elementStyle.setProperty(styleKey, dataValue);
511
+ elementStyle[styleKey] = dataValue;
507
512
  delete originalStyle[styleKey];
508
513
  });
509
514
  Object.entries(originalStyle).forEach(
510
- ([styleKey]) => elementStyle.removeProperty(styleKey)
515
+ ([styleKey]) => elementStyle[styleKey] = ""
511
516
  );
512
517
  }
513
518
  };
@@ -763,8 +768,8 @@ const makeWDomResolver = ({
763
768
  return { tagName, constructor, props, children, resolve };
764
769
  };
765
770
  const makeCustomNode = (wDomInfo) => {
766
- const { componentMaker } = wDomInfo;
767
- const customNode = componentMaker();
771
+ const { componentMaker, props } = wDomInfo;
772
+ const customNode = componentMaker(props);
768
773
  const reRender2 = makeReRender(wDomInfo);
769
774
  addComponentProps(customNode, { ...wDomInfo, reRender: reRender2 });
770
775
  return customNode;
@@ -778,7 +783,7 @@ const wDomMaker = (wDomInfo) => {
778
783
  initUpdateHookState(componentKey);
779
784
  runUpdateCallback();
780
785
  const nodeChildKey = startMakeNodeChildKey(componentKey);
781
- const originalWDom = componentMaker();
786
+ const originalWDom = componentMaker(props);
782
787
  wDomInfo.nodeChildKey = nodeChildKey;
783
788
  setRedrawAction({
784
789
  componentKey,
@@ -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"],"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,6C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BAAsB,GAAG,GAAG;AACvB,WAAA,SAAS,OAAO,GAAG,QAAQ;AAAA,EAAA,WACzB,6BAA6B,GAAG,GAAG;AAC5C,UAAM,uBAAuB,iBAAiB,EAAE,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
+ {"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 checkTextareaElement = (element: any): element is HTMLElement => {\n return element.nodeType === 1 && element.tagName === 'TEXTAREA';\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 checkTextareaElement,\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 (checkTextareaElement(element) && dataKey === 'value') {\n (element as HTMLInputElement).value = dataValue as string;\n } else if (checkOptionElement(element) && dataKey === 'selected') {\n (element as HTMLOptionElement).selected = !!dataValue;\n } else if (checkNormalAttribute(dataValue)) {\n (element as HTMLElement).setAttribute(dataKey, String(dataValue));\n }\n\n delete originalProps[dataKey];\n }\n );\n\n Object.keys(originalProps).forEach(dataKey =>\n (element as HTMLElement).removeAttribute(dataKey)\n );\n};\n\nconst wDomToDom = (wDom: WDom, 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 as any)[styleKey] = dataValue;\n delete originalStyle[styleKey];\n });\n\n Object.entries(originalStyle).forEach(\n ([styleKey]) => ((elementStyle as any)[styleKey] = '')\n );\n }\n};\n\nconst findRealParentElement = (\n vDom: WDom\n): HTMLElement | DocumentFragment | Text | undefined => {\n const isVirtualType =\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: (props: Props) => 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, props } = wDomInfo;\n const customNode = componentMaker(props);\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(props);\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,WA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B,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===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"}})}));
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,a={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},c=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:[]},g={value:null},f={value:[]},D=e=>{f.value.splice(f.value.indexOf(e),1)},W=e=>{const n={value:[]};var o;return o=e,f.value.forEach((e=>e.value.push(o))),f.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}),g.value||(g.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()}},S=e=>{const n=h.get(e).umts;h.get(e).umts=[],n.forEach((e=>e())),h.delete(e)},b=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))})))}},R=(e,n=(()=>[]))=>{const o=h.get(E()),{upD:t,upS:l}=o,r=t[l.value];if(r&&T(r,n())){const n=e();n&&o.upCB.push(n)}t[l.value]=n(),l.value+=1},T=(e,n)=>!e.length&&!e.length||e.some(((e,o)=>e!==n[o])),x=e=>{const{needRerender:n}=e;if(n&&"N"!==n){(0,{A:A,D:O,R:M,U:H,SR:k,SU:N}[n])(e)}},P=e=>{e.props&&e.el&&L(e.props,e.el),(e.children||[]).forEach((e=>{P(e)}))},O=e=>{var n,o;const t=z(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),A(e)},N=e=>{O(e),A(e,e.el)},A=(e,n)=>{n||(n=I(e,!0));const o=c(e);if(o.type){const t=z(o),l=U(e,o);n&&t&&(l?t.insertBefore(n,l):t.appendChild(n))}b(e)},U=(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)?U(n,c(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=c(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)}b(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=>x(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)||{};q({style:l,oldStyle:r,element:o})}else((e,n)=>"ref"===e&&"object"==typeof n)(e,n)?n.value=o:e.match(/^on/)?X({element:o,eventKey:e,newEventHandler:n,oldEventHandler:t[e]}):(e=>1===e.nodeType&&"TEXTAREA"===e.tagName)(o)&&"value"===e?o.value=n:(e=>1===e.nodeType&&"OPTION"===e.tagName)(o)&&"selected"===e?o.selected=!!n:(e=>"number"==typeof e||"string"==typeof e)(n)&&o.setAttribute(e,String(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,b(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)}},X=({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))},q=({style:e,oldStyle:n,element:o})=>{const t={...n},l=null==o?void 0:o.style;l&&(Object.entries(e).forEach((([e,n])=>{l[e]=n,delete t[e]})),Object.entries(t).forEach((([e])=>l[e]="")))},z=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=c(e);return z(l)},G=({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=a[t]({originalWDom:e,newWDom:o}),d=J({originalWDom:e,newWDom:o,isSameType:i});return(null==d?void 0:d.nodeChildKey)&&D(d.nodeChildKey),d},J=({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=Q({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&&S(n),t&&t.forEach((e=>S(e)))})(n),P(n),t.children=n.children),t.oldProps=null==n?void 0:n.props,t},Q=({originalWDom:e,newWDom:n,isSameType:o})=>{const t=e&&e.type,l=r(n),i=!!n.getParent&&c(n).type,p=le(n),a="loop"===i&&d(p),u="text"===n.type&&o&&n.text===(null==e?void 0:e.text);let s;return s=l?"D":u?"N":t?o?a?"SU":"U":a?"SR":"R":"A",s},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&&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,Z=({isSameType:e,newWDom:n,originalWDom:o})=>e&&o?ee(n,o):$(n),$=e=>(e.children||[]).map((n=>{const o=G({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=G({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=G({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,f.value=[];const r=de({tag:e,props:n,children:o}),i=G({originalWDom:t,newWDom:r}),{isRoot:d,getParent:p,wrapElement:a}=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=a;x(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,props:o}=e,t=n(o),l=ae(e);return ue(t,{...e,reRender:l}),t},ae=e=>{const n=()=>ce({...e,reRender:n});return n},ce=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=[],g.value=null})();const i=W(o),d=n(l);return e.nodeChildKey=i,w({componentKey:o,nodeChildKey:i,exec:()=>ie({tag:t,props:l,children:r,originalWDom:d})}),ue(d,e),v.value||D(i),d},ue=(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})},se=({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=se({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((()=>R(e,n))),R(e,n)},Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
2
2
  //# sourceMappingURL=lithent.umd.js.map