lithent 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +202 -0
- package/dist/diff.d.ts +14 -0
- package/dist/hook/mountCallback.d.ts +3 -0
- package/dist/hook/ref.d.ts +3 -0
- package/dist/hook/unmount.d.ts +3 -0
- package/dist/hook/updateCallback.d.ts +2 -0
- package/dist/hook/useUpdate.d.ts +3 -0
- package/dist/index.d.ts +29 -0
- package/dist/lithent.mjs +867 -0
- package/dist/lithent.mjs.map +1 -0
- package/dist/lithent.umd.js +2 -0
- package/dist/lithent.umd.js.map +1 -0
- package/dist/render.d.ts +15 -0
- package/dist/types/index.d.ts +65 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/predicator.d.ts +36 -0
- package/dist/utils/universalRef.d.ts +59 -0
- package/dist/wDom.d.ts +17 -0
- package/examples/dist/assets/index.e76a0ef8.js +2 -0
- package/examples/dist/assets/index.e76a0ef8.js.map +1 -0
- package/examples/dist/index.html +13 -0
- package/examples/package.json +33 -0
- package/examples/src/index.tsx +109 -0
- package/helper/dist/hook/computed.d.ts +4 -0
- package/helper/dist/hook/effect.d.ts +1 -0
- package/helper/dist/hook/state.d.ts +4 -0
- package/helper/dist/hook/store.d.ts +8 -0
- package/helper/dist/index.d.ts +4 -0
- package/helper/dist/lithentHelper.mjs +56 -0
- package/helper/dist/lithentHelper.mjs.map +1 -0
- package/helper/dist/lithentHelper.umd.js +2 -0
- package/helper/dist/lithentHelper.umd.js.map +1 -0
- package/helper/package.json +32 -0
- package/helper/src/hook/computed.ts +23 -0
- package/helper/src/hook/effect.ts +20 -0
- package/helper/src/hook/state.ts +26 -0
- package/helper/src/hook/store.ts +25 -0
- package/helper/src/index.ts +4 -0
- package/package.json +90 -0
- package/router/dist/Router.d.ts +4 -0
- package/router/dist/Router.mjs +56 -0
- package/router/dist/Router.mjs.map +1 -0
- package/router/dist/Router.umd.js +2 -0
- package/router/dist/Router.umd.js.map +1 -0
- package/router/dist/hook/params.d.ts +2 -0
- package/router/package.json +37 -0
- package/router/src/Router.tsx +63 -0
- package/router/src/components/Main.tsx +14 -0
- package/router/src/components/Sub.tsx +7 -0
- package/router/src/components/Sub2.tsx +17 -0
- package/router/src/example.tsx +19 -0
- package/router/src/hook/params.ts +9 -0
- package/src/diff.ts +235 -0
- package/src/examples/callback.tsx +81 -0
- package/src/examples/insert.tsx +36 -0
- package/src/examples/loop.tsx +33 -0
- package/src/examples/nested.tsx +44 -0
- package/src/examples/renew.tsx +29 -0
- package/src/examples/selectbox.tsx +42 -0
- package/src/examples/textarea.tsx +24 -0
- package/src/hook/mountCallback.ts +41 -0
- package/src/hook/ref.ts +1 -0
- package/src/hook/unmount.ts +26 -0
- package/src/hook/updateCallback.ts +29 -0
- package/src/hook/useUpdate.ts +51 -0
- package/src/index.ts +50 -0
- package/src/render.ts +409 -0
- package/src/types/index.ts +107 -0
- package/src/utils/index.ts +52 -0
- package/src/utils/predicator.ts +119 -0
- package/src/utils/universalRef.ts +137 -0
- package/src/wDom.ts +284 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.e76a0ef8.js","sources":["../../vite/modulepreload-polyfill","../../../dist/lithent.mjs","../../../helper/dist/lithentHelper.mjs","../../src/index.tsx"],"sourcesContent":["__VITE_IS_MODERN__&&(function polyfill() {\n const relList = document.createElement('link').relList;\n if (relList && relList.supports && relList.supports('modulepreload')) {\n return;\n }\n for (const link of document.querySelectorAll('link[rel=\"modulepreload\"]')) {\n processPreload(link);\n }\n new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (mutation.type !== 'childList') {\n continue;\n }\n for (const node of mutation.addedNodes) {\n if (node.tagName === 'LINK' && node.rel === 'modulepreload')\n processPreload(node);\n }\n }\n }).observe(document, { childList: true, subtree: true });\n function getFetchOpts(script) {\n const fetchOpts = {};\n if (script.integrity)\n fetchOpts.integrity = script.integrity;\n if (script.referrerpolicy)\n fetchOpts.referrerPolicy = script.referrerpolicy;\n if (script.crossorigin === 'use-credentials')\n fetchOpts.credentials = 'include';\n else if (script.crossorigin === 'anonymous')\n fetchOpts.credentials = 'omit';\n else\n fetchOpts.credentials = 'same-origin';\n return fetchOpts;\n }\n function processPreload(link) {\n if (link.ep)\n // ep marker = processed\n return;\n link.ep = true;\n // prepopulate the load record\n const fetchOpts = getFetchOpts(link);\n fetch(link.href, fetchOpts);\n }\n}());","const checkCustemComponentFunction = (target) => typeof target === \"function\" && !checkFragmentFunction(target) || typeof target === \"object\" && \"resolve\" in target;\nconst checkFragmentFunction = (target) => typeof target === \"function\" && target === Fragment;\nconst checkPlainWDomType = (wDom) => typeof wDom === \"object\" && !(\"resolve\" in wDom);\nconst checkPlainType = (wDom, typeName) => checkPlainWDomType(wDom) && wDom.type === typeName;\nconst checkEmptyElement = (wDom) => checkPlainWDomType(wDom) && !wDom.type;\nconst checkSameCustomComponent = ({\n originalWDom,\n newWDom\n}) => newWDom.constructor === (originalWDom == null ? void 0 : originalWDom.constructor);\nconst checkSameFragment = ({ originalWDom, newWDom }) => {\n var _a, _b;\n return checkPlainWDomType(newWDom) && (originalWDom == null ? void 0 : originalWDom.type) === \"fragment\" && ((_a = originalWDom == null ? void 0 : originalWDom.children) == null ? void 0 : _a.length) === ((_b = newWDom == null ? void 0 : newWDom.children) == null ? void 0 : _b.length);\n};\nconst checkSameTagElement = ({ originalWDom, newWDom }) => checkPlainWDomType(newWDom) && (originalWDom == null ? void 0 : originalWDom.type) === \"element\" && (originalWDom == null ? void 0 : originalWDom.tag) === newWDom.tag;\nconst checkNormalTypeElement = ({ originalWDom, newWDom }) => checkPlainWDomType(newWDom) && (originalWDom == null ? void 0 : originalWDom.type) === newWDom.type;\nconst checkExisty = (value) => value !== null && value !== void 0;\nconst checkFunction = (target) => typeof target === \"function\";\nconst checkStyleData = (dataKey, dataValue) => dataKey === \"style\" && typeof dataValue === \"object\";\nconst checkRefData = (dataKey, dataValue) => dataKey === \"ref\" && typeof dataValue === \"object\";\nconst checkOptionElement = (element) => {\n return element.nodeType === 1 && element.tagName === \"OPTION\";\n};\nconst checkNormalAttribute = (dataValue) => typeof dataValue === \"number\" || typeof dataValue === \"string\";\nconst getWDomType = (wDom) => {\n let result;\n if (checkCustemComponentFunction(wDom)) {\n result = \"c\";\n } else if (checkPlainType(wDom, \"fragment\")) {\n result = \"f\";\n } else if (checkPlainType(wDom, \"element\")) {\n result = \"e\";\n } else if (checkPlainType(wDom, \"loop\")) {\n result = \"l\";\n } else if (checkPlainType(wDom, \"text\")) {\n result = \"t\";\n } else if (checkEmptyElement(wDom)) {\n result = \"et\";\n }\n return result;\n};\nconst checkSameWDomWithOriginal = {\n c: checkSameCustomComponent,\n l: checkNormalTypeElement,\n t: checkNormalTypeElement,\n e: checkSameTagElement,\n f: checkSameFragment,\n et: checkNormalTypeElement\n};\nconst getParent = (vDom) => {\n const parentVDom = vDom.getParent && vDom.getParent();\n if (!parentVDom) {\n throw Error(\"Not found parent vDom\");\n }\n return parentVDom;\n};\nconst reRender = (vDom, infoVdom) => {\n const { componentProps: props, componentChildren: children } = vDom;\n const { props: infoProps, children: infoChidren } = infoVdom;\n if (props) {\n updateProps$1(props, infoProps);\n }\n if (children) {\n updateChildren(children, infoChidren);\n }\n const newVDom = vDom.reRender && vDom.reRender();\n if (!newVDom) {\n throw Error(\"Unable reRender\");\n }\n return newVDom;\n};\nconst updateProps$1 = (props, infoProps) => {\n if (props && infoProps !== props) {\n Object.keys(props).forEach((key) => delete props[key]);\n Object.entries(infoProps || {}).forEach(\n ([key, value]) => props[key] = value\n );\n }\n};\nconst updateChildren = (children, infoChidren) => {\n if (children && infoChidren !== children) {\n children.splice(0, children.length);\n if (infoChidren) {\n infoChidren.forEach((childrenItem) => children.push(childrenItem));\n }\n }\n};\nconst componentKeyRef = { value: {} };\nconst needDiffRef = { value: false };\nconst componentRef = /* @__PURE__ */ new WeakMap();\nconst redrawQueue = { value: [] };\nconst redrawQueueTimeout = { value: null };\nconst nodeChildKeyList = { value: [] };\nconst pushNodeChildKey = (key) => nodeChildKeyList.value.forEach((item) => item.value.push(key));\nconst removeNodeChildKey = (item) => {\n nodeChildKeyList.value.splice(nodeChildKeyList.value.indexOf(item), 1);\n};\nconst cleanNodeChildKey = () => nodeChildKeyList.value = [];\nconst dataStoreStore = {};\nconst dataStoreRenderQueue = {};\nconst componentRender = (componentKey) => () => {\n var _a;\n const up = (_a = componentRef.get(componentKey)) == null ? void 0 : _a.up;\n if (up) {\n up();\n return true;\n } else {\n return false;\n }\n};\nconst setComponetRef = (componentKey) => {\n componentRef.set(componentKey, {\n up: () => {\n },\n upR: [],\n upS: { value: 0 },\n upD: [],\n upCB: [],\n mts: [],\n umts: []\n });\n};\nconst getComponentKey = () => componentKeyRef.value;\nconst setRedrawAction = ({\n componentKey,\n nodeChildKey,\n exec\n}) => {\n componentRef.get(componentKey).up = () => {\n redrawQueue.value.push({\n componentKey,\n nodeChildKey: nodeChildKey.value,\n exec\n });\n if (!redrawQueueTimeout.value) {\n redrawQueueTimeout.value = setTimeout(execRedrawQueue);\n }\n };\n};\nconst initUpdateHookState = (componentKey) => componentKeyRef.value = componentKey;\nconst initMountHookState = (componentKey) => {\n componentKeyRef.value = componentKey;\n setComponetRef(componentKey);\n};\nconst execRedrawQueue = () => {\n let childItemList = [];\n redrawQueue.value.forEach((item) => {\n childItemList = childItemList.concat(item.nodeChildKey);\n });\n const addedKey = [];\n const result = redrawQueue.value.reduce((acc, item) => {\n const { componentKey } = item;\n if (childItemList.includes(componentKey) || addedKey.includes(componentKey)) {\n return acc;\n }\n addedKey.push(componentKey);\n acc.push(item);\n return acc;\n }, []);\n while (result.length) {\n const action = result.shift();\n if (action) {\n action.exec();\n }\n }\n};\nconst unmount = (effectAction) => {\n componentRef.get(getComponentKey()).umts.push(effectAction);\n};\nconst runUnmountQueueFromWDom = (newWDom) => {\n const { componentKey, nodeChildKey } = newWDom;\n const childKeys = nodeChildKey == null ? void 0 : nodeChildKey.value;\n if (componentKey) {\n removeItem(componentKey);\n }\n if (childKeys) {\n childKeys.forEach((childKey) => removeItem(childKey));\n }\n};\nconst removeItem = (componentKey) => {\n const queue = componentRef.get(componentKey).umts;\n componentRef.get(componentKey).umts = [];\n queue.forEach((effect) => effect());\n componentRef.delete(componentKey);\n};\nconst mountCallback = (effectAction) => {\n const mts = componentRef.get(getComponentKey()).mts;\n mts.push(effectAction);\n};\nconst runMountedQueueFromWDom = (newWDom) => {\n const { componentKey } = newWDom;\n if (componentKey) {\n const component = componentRef.get(componentKey);\n const queue = component == null ? void 0 : component.mts;\n const sequence = component == null ? void 0 : component.upS;\n componentKeyRef.value = componentKey;\n if (sequence) {\n sequence.value = 0;\n }\n if (queue) {\n component.mts = [];\n queue.forEach((effect) => {\n const callback = effect();\n if (callback) {\n unmount(callback);\n }\n });\n }\n }\n};\nconst useUpdated = (effectAction, dependencies = () => []) => {\n const component = componentRef.get(getComponentKey());\n const { upD, upS } = component;\n const def = upD[upS.value];\n if (def && checkNeedPushQueue(def, dependencies())) {\n const callback = effectAction();\n if (callback) {\n component.upCB.push(callback);\n }\n }\n upD[upS.value] = dependencies();\n upS.value += 1;\n};\nconst runUpdatedQueueFromWDom = (newWDom) => {\n const { componentKey } = newWDom;\n if (componentKey) {\n const component = componentRef.get(componentKey);\n const queue = component == null ? void 0 : component.upCB;\n const sequence = component == null ? void 0 : component.upS;\n componentKeyRef.value = componentKey;\n if (sequence) {\n sequence.value = 0;\n }\n if (newWDom.constructor && queue) {\n component.upCB = [];\n queue.forEach((effect) => effect());\n }\n }\n};\nconst checkNeedPushQueue = (originalDefs, newDefs) => !originalDefs.length && !originalDefs.length ? true : originalDefs.some((def, index) => def !== newDefs[index]);\nconst render = (wDom, wrapElement, afterElement) => {\n if (!wrapElement) {\n throw Error(\"WrapELement is null\");\n }\n wDom.isRoot = true;\n wDom.wrapElement = wrapElement;\n const Dom = wDomToDom(wDom, true);\n if (afterElement) {\n wrapElement.insertBefore(Dom, afterElement);\n } else {\n wrapElement.appendChild(Dom);\n }\n};\nconst wDomUpdate = (newWDomTree) => {\n const { needRerender } = newWDomTree;\n if (needRerender && needRerender !== \"N\") {\n const exec = {\n A: typeAdd,\n D: typeDelete,\n R: typeReplace,\n U: typeUpdate,\n SR: typeSortedReplace,\n SU: typeSortedUpdate\n }[needRerender];\n exec(newWDomTree);\n }\n};\nconst recursiveRemoveEvent = (originalWDom) => {\n if (originalWDom.props && originalWDom.el) {\n removeEvent(originalWDom.props, originalWDom.el);\n }\n (originalWDom.children || []).forEach((childItem) => {\n recursiveRemoveEvent(childItem);\n });\n};\nconst typeDelete = (newWDom) => {\n var _a, _b;\n const parent = findRealParentElement(newWDom);\n if (newWDom.oldProps && newWDom.el) {\n removeEvent(newWDom.oldProps, newWDom.el);\n }\n if (parent && newWDom.el) {\n if (((_a = newWDom.el) == null ? void 0 : _a.nodeType) === 1) {\n parent.removeChild(newWDom.el);\n } else if (((_b = newWDom.el) == null ? void 0 : _b.nodeType) === 11) {\n findChildWithRemoveElement(newWDom, parent);\n }\n delete newWDom.el;\n }\n};\nconst findChildWithRemoveElement = (newWDom, parent) => {\n ((newWDom == null ? void 0 : newWDom.children) || []).forEach((item) => {\n var _a, _b;\n if (((_a = item.el) == null ? void 0 : _a.nodeType) === 1) {\n parent.removeChild(item == null ? void 0 : item.el);\n } else if (((_b = item.el) == null ? void 0 : _b.nodeType) === 11) {\n findChildWithRemoveElement(item, parent);\n }\n });\n};\nconst typeSortedReplace = (newWDom) => {\n typeDelete(newWDom);\n typeAdd(newWDom);\n};\nconst typeSortedUpdate = (newWDom) => {\n typeDelete(newWDom);\n typeAdd(newWDom, newWDom.el);\n};\nconst typeAdd = (newWDom, newElement) => {\n if (!newElement) {\n newElement = wDomToDom(newWDom, true);\n }\n const parentWDom = getParent(newWDom);\n if (parentWDom.type) {\n const parentEl = findRealParentElement(parentWDom);\n const nextEl = startFindNextBrotherElement(newWDom, parentWDom);\n if (newElement && parentEl) {\n if (nextEl) {\n parentEl.insertBefore(newElement, nextEl);\n } else {\n parentEl.appendChild(newElement);\n }\n }\n }\n runMountedQueueFromWDom(newWDom);\n};\nconst startFindNextBrotherElement = (wDom, parentWDom) => {\n const brothers = parentWDom.children || [];\n const index = brothers.indexOf(wDom);\n const nextIndex = index + 1;\n const candidiateBrothers = brothers.slice(nextIndex);\n const finedNextEl = findChildFragmentNextElement(candidiateBrothers);\n const parentType = parentWDom.type || \"\";\n if (finedNextEl) {\n return finedNextEl;\n }\n if (!parentWDom.isRoot && [\"fragment\", \"loop\"].includes(parentType)) {\n return startFindNextBrotherElement(parentWDom, getParent(parentWDom));\n }\n return void 0;\n};\nconst findChildFragmentNextElement = (candidiateBrothers) => candidiateBrothers.reduce(\n (targetEl, bItem) => {\n const type = bItem.type;\n const el = bItem.el;\n const isFragment = type && [\"fragment\", \"loop\"].includes(type);\n if (targetEl) {\n return targetEl;\n } else if (isFragment) {\n return findChildFragmentNextElement(bItem.children || []);\n } else if (el && el.nodeType !== 11) {\n return el;\n }\n return targetEl;\n },\n void 0\n);\nconst typeReplace = (newWDom) => {\n const parentWDom = getParent(newWDom);\n const orignalElement = newWDom.el;\n if (parentWDom.type && orignalElement) {\n const parentElement = parentWDom.el;\n const newElement = wDomToDom(newWDom, true);\n if (newWDom.oldProps) {\n removeEvent(newWDom.oldProps, orignalElement);\n }\n if (parentElement) {\n parentElement.replaceChild(newElement, orignalElement);\n }\n }\n runMountedQueueFromWDom(newWDom);\n};\nconst removeEvent = (oldProps, element) => {\n if (element) {\n Object.entries(oldProps || {}).forEach(\n ([dataKey, dataValue]) => {\n if (dataKey.match(/^on/)) {\n element.removeEventListener(dataKey, dataValue);\n }\n }\n );\n }\n};\nconst typeUpdate = (newWDom) => {\n var _a;\n const element = newWDom.el;\n if (newWDom.type === \"text\") {\n updateText(newWDom);\n return;\n }\n if (element) {\n const { oldProps, props } = newWDom;\n updateProps({ oldProps, props, element });\n delete newWDom.oldProps;\n if (newWDom.tag === \"input\") {\n element.value = String(((_a = newWDom == null ? void 0 : newWDom.props) == null ? void 0 : _a.value) || \"\");\n }\n }\n (newWDom.children || []).forEach((childItem) => wDomUpdate(childItem));\n runUpdatedQueueFromWDom(newWDom);\n};\nconst updateText = (newWDom) => {\n const element = newWDom.el;\n if (element) {\n element.nodeValue = String(newWDom.text);\n }\n};\nconst updateProps = ({\n oldProps,\n props,\n element\n}) => {\n const originalProps = { ...oldProps };\n Object.entries(props || {}).forEach(\n ([dataKey, dataValue]) => {\n if (dataKey === \"key\")\n ;\n else if (checkStyleData(dataKey, dataValue)) {\n const style = dataValue;\n const oldStyle = checkStyleData(dataKey, originalProps.style) || {};\n updateStyle({ style, oldStyle, element });\n } else if (checkRefData(dataKey, dataValue)) {\n dataValue.value = element;\n } else if (dataKey.match(/^on/)) {\n updateEvent({\n element,\n eventKey: dataKey,\n newEventHandler: dataValue,\n oldEventHandler: originalProps[dataKey]\n });\n } else if (checkNormalAttribute(dataValue)) {\n element.setAttribute(dataKey, String(dataValue));\n } else if (checkOptionElement(element) && dataKey === \"selected\") {\n element.selected = !!dataValue;\n }\n delete originalProps[dataKey];\n }\n );\n Object.keys(originalProps).forEach(\n (dataKey) => element.removeAttribute(dataKey)\n );\n};\nconst wDomToDom = (wDom, init) => {\n let element;\n const { type, tag, text, props, children = [] } = wDom;\n const isVirtualType = type === \"fragment\" || type === \"loop\";\n if (isVirtualType) {\n element = new DocumentFragment();\n } else if (type === \"element\" && tag) {\n element = document.createElement(tag);\n } else if (type === \"text\" && checkExisty(text)) {\n element = document.createTextNode(String(text));\n }\n wDomChildrenToDom(children, element, init);\n updateProps({ props, element });\n wDom.el = element;\n runMountedQueueFromWDom(wDom);\n return element || document.createElement(\"div\");\n};\nconst wDomChildrenToDom = (children, parentElement, init) => {\n if (init) {\n const elementChildren = children.reduce(\n (acc, childItem) => {\n if (childItem.type) {\n acc.appendChild(wDomToDom(childItem, init));\n }\n return acc;\n },\n new DocumentFragment()\n );\n if (parentElement && elementChildren.hasChildNodes()) {\n parentElement.appendChild(elementChildren);\n }\n }\n};\nconst updateEvent = ({\n element,\n eventKey,\n newEventHandler,\n oldEventHandler\n}) => {\n const eventName = eventKey.replace(\n /^on(.*)/,\n (_match, p1) => p1.toLowerCase()\n );\n if (oldEventHandler !== newEventHandler) {\n if (oldEventHandler) {\n element.removeEventListener(eventName, oldEventHandler);\n }\n if (newEventHandler) {\n element.addEventListener(eventName, newEventHandler);\n }\n }\n};\nconst updateStyle = ({\n style,\n oldStyle,\n element\n}) => {\n const originalStyle = { ...oldStyle };\n const elementStyle = element == null ? void 0 : element.style;\n if (elementStyle) {\n Object.entries(style).forEach(([styleKey, dataValue]) => {\n elementStyle.setProperty(styleKey, dataValue);\n delete originalStyle[styleKey];\n });\n Object.entries(originalStyle).forEach(\n ([styleKey]) => elementStyle.removeProperty(styleKey)\n );\n }\n};\nconst findRealParentElement = (vDom) => {\n var _a, _b;\n const isVirtualType = vDom.type === \"fragment\" || vDom.type === \"loop\" || !vDom.type && ((_a = vDom == null ? void 0 : vDom.el) == null ? void 0 : _a.nodeType) === 11;\n if (vDom.isRoot && isVirtualType) {\n return vDom.wrapElement;\n }\n if (!isVirtualType) {\n return (_b = vDom.el) == null ? void 0 : _b.parentNode;\n }\n const parentVDom = getParent(vDom);\n return findRealParentElement(parentVDom);\n};\nconst makeNewWDomTree = ({\n originalWDom,\n newWDom\n}) => {\n const type = getWDomType(newWDom);\n if (!type) {\n throw new Error(\"Unknown type wdom\");\n }\n const isSameType = checkSameWDomWithOriginal[type]({ originalWDom, newWDom });\n const result = remakeNewWDom({ originalWDom, newWDom, isSameType });\n if (result == null ? void 0 : result.nodeChildKey) {\n removeNodeChildKey(result.nodeChildKey);\n }\n return result;\n};\nconst remakeNewWDom = ({\n newWDom,\n originalWDom,\n isSameType\n}) => {\n const remakeWDom = generalize({ newWDom, originalWDom, isSameType });\n remakeWDom.children = remakeChildrenForDiff({\n isSameType,\n newWDom: remakeWDom,\n originalWDom\n });\n const needRerender = addReRenderTypeProperty({\n originalWDom,\n newWDom: remakeWDom,\n isSameType\n });\n remakeWDom.needRerender = needRerender;\n if (needRerender !== \"A\" && originalWDom) {\n remakeWDom.el = originalWDom.el;\n }\n if (needRerender && [\"D\", \"R\", \"SR\"].includes(needRerender) && (originalWDom == null ? void 0 : originalWDom.componentKey)) {\n runUnmountQueueFromWDom(originalWDom);\n recursiveRemoveEvent(originalWDom);\n remakeWDom.children = originalWDom.children;\n }\n remakeWDom.oldProps = originalWDom == null ? void 0 : originalWDom.props;\n return remakeWDom;\n};\nconst addReRenderTypeProperty = ({\n originalWDom,\n newWDom,\n isSameType\n}) => {\n const existOriginalWDom = originalWDom && originalWDom.type;\n const isEmptyElement = checkEmptyElement(newWDom);\n const isRoot = !newWDom.getParent;\n const parentType = !isRoot && getParent(newWDom).type;\n const key = getKey(newWDom);\n const isKeyCheckedWDom = parentType === \"loop\" && checkExisty(key);\n const isSameText = newWDom.type === \"text\" && isSameType && newWDom.text === (originalWDom == null ? void 0 : originalWDom.text);\n let result;\n if (isEmptyElement) {\n result = \"D\";\n } else if (isSameText) {\n result = \"N\";\n } else if (!existOriginalWDom) {\n result = \"A\";\n } else if (isSameType) {\n result = isKeyCheckedWDom ? \"SU\" : \"U\";\n } else {\n result = isKeyCheckedWDom ? \"SR\" : \"R\";\n }\n return result;\n};\nconst generalize = ({\n newWDom,\n originalWDom,\n isSameType\n}) => {\n if (checkCustemComponentFunction(newWDom)) {\n return isSameType && originalWDom ? reRender(originalWDom, newWDom) : newWDom.resolve();\n }\n return newWDom;\n};\nconst remakeChildrenForDiff = ({\n isSameType,\n newWDom,\n originalWDom\n}) => isSameType && originalWDom ? remakeChildrenForUpdate(newWDom, originalWDom) : remakeChildrenForAdd(newWDom);\nconst remakeChildrenForAdd = (newWDom) => (newWDom.children || []).map((item) => {\n const childItem = makeNewWDomTree({ newWDom: item });\n childItem.getParent = () => newWDom;\n return childItem;\n});\nconst remakeChildrenForUpdate = (newWDom, originalWDom) => {\n if (newWDom.type === \"loop\" && checkExisty(getKey((newWDom.children || [])[0]))) {\n return remakeChildrenForLoopUpdate(newWDom, originalWDom);\n }\n return (newWDom.children || []).map((item, index) => {\n const childItem = makeNewWDomTree({\n newWDom: item,\n originalWDom: (originalWDom.children || [])[index]\n });\n childItem.getParent = () => newWDom;\n return childItem;\n });\n};\nconst remakeChildrenForLoopUpdate = (newWDom, originalWDom) => {\n const { remakedChildren, unUsedChildren } = diffLoopChildren(\n newWDom,\n originalWDom\n );\n unUsedChildren.map((unusedItem) => {\n const el = unusedItem.el;\n if (el && el.parentNode) {\n el.parentNode.removeChild(el);\n }\n });\n return remakedChildren;\n};\nconst diffLoopChildren = (newWDom, originalWDom) => {\n const newChildren = [...newWDom.children || []];\n const originalChildren = [...originalWDom.children || []];\n const remakedChildren = newChildren.map((item) => {\n const originalItem = findSameKeyOriginalItem(item, originalChildren);\n const childItem = makeNewWDomTree({\n newWDom: item,\n originalWDom: originalItem\n });\n if (originalItem) {\n originalChildren.splice(originalChildren.indexOf(originalItem), 1);\n }\n childItem.getParent = () => newWDom;\n return childItem;\n });\n return {\n remakedChildren,\n unUsedChildren: originalChildren\n };\n};\nconst findSameKeyOriginalItem = (item, originalChildren) => {\n const key = getKey(item);\n return originalChildren.find(\n (orignalChildItem) => getKey(orignalChildItem) === key\n );\n};\nconst getKey = (target) => {\n var _a, _b, _c;\n return (_c = (_a = target == null ? void 0 : target.componentProps) == null ? void 0 : _a.key) != null ? _c : (_b = target == null ? void 0 : target.props) == null ? void 0 : _b.key;\n};\nconst updateCallback = (effectAction, dependencies = () => []) => {\n const updateReqs = componentRef.get(getComponentKey()).upR;\n updateReqs.push(() => useUpdated(effectAction, dependencies));\n useUpdated(effectAction, dependencies);\n};\nconst runUpdateCallback = () => {\n var _a;\n const updateReqs = (_a = componentRef.get(getComponentKey())) == null ? void 0 : _a.upR;\n if (updateReqs == null ? void 0 : updateReqs.length) {\n updateReqs.forEach((callback) => callback());\n }\n redrawQueue.value = [];\n redrawQueueTimeout.value = null;\n};\nconst Fragment = (_props, ...children) => ({\n type: \"fragment\",\n children\n});\nconst h = (tag, props, ...children) => {\n const nodeParentPointer = { value: void 0 };\n const newProps = props || {};\n const newChildren = remakeChildren(nodeParentPointer, children);\n const node = makeNode({\n tag,\n props: newProps,\n children: newChildren\n });\n if (!checkCustemComponentFunction(node)) {\n nodeParentPointer.value = node;\n }\n return node;\n};\nconst mount = (component) => (_props, _children) => component;\nconst reRenderCustomComponent = ({\n tag,\n props,\n children,\n originalWDom\n}) => {\n var _a;\n needDiffRef.value = true;\n cleanNodeChildKey();\n const newWDom = makeWDomResolver({ tag, props, children });\n const newWDomTree = makeNewWDomTree({ originalWDom, newWDom });\n const { isRoot, getParent: getParent2, wrapElement } = originalWDom;\n newWDomTree.getParent = getParent2;\n if (!isRoot && getParent2) {\n const brothers = ((_a = getParent2()) == null ? void 0 : _a.children) || [];\n const index = brothers.indexOf(originalWDom);\n brothers.splice(index, 1, newWDomTree);\n } else {\n newWDomTree.isRoot = true;\n newWDomTree.wrapElement = wrapElement;\n }\n wDomUpdate(newWDomTree);\n needDiffRef.value = false;\n};\nconst makeWDomResolver = ({\n tag,\n props,\n children\n}) => {\n const tagName = tag.name;\n const constructor = tag;\n const resolve = (componentKey = props) => {\n initMountHookState(componentKey);\n const nodeChildKey = { value: [] };\n pushNodeChildKey(componentKey);\n nodeChildKeyList.value.push(nodeChildKey);\n const component = tag(props, children);\n const componentMaker = component(\n componentRender(componentKey),\n props,\n children\n );\n const customNode = makeCustomNode({\n componentMaker,\n componentKey,\n tag,\n props,\n children,\n nodeChildKey\n });\n const originalWDom = customNode;\n setRedrawAction({\n componentKey,\n nodeChildKey,\n exec: () => reRenderCustomComponent({ tag, props, children, originalWDom })\n });\n if (!needDiffRef.value) {\n removeNodeChildKey(nodeChildKey);\n }\n return customNode;\n };\n return { tagName, constructor, props, children, resolve };\n};\nconst makeCustomNode = (wDomInfo) => {\n const { componentMaker } = wDomInfo;\n const customNode = componentMaker();\n const reRender2 = makeReRender(wDomInfo);\n addComponentProps(customNode, { ...wDomInfo, reRender: reRender2 });\n return customNode;\n};\nconst makeReRender = (wDomInfo) => {\n const reRender2 = () => wDomMaker({ ...wDomInfo, reRender: reRender2 });\n return reRender2;\n};\nconst wDomMaker = (wDomInfo) => {\n const { componentMaker, componentKey, tag, props, children } = wDomInfo;\n initUpdateHookState(componentKey);\n runUpdateCallback();\n const nodeChildKey = { value: [] };\n pushNodeChildKey(componentKey);\n nodeChildKeyList.value.push(nodeChildKey);\n const originalWDom = componentMaker();\n wDomInfo.nodeChildKey = nodeChildKey;\n setRedrawAction({\n componentKey,\n nodeChildKey,\n exec: () => reRenderCustomComponent({ tag, props, children, originalWDom })\n });\n addComponentProps(originalWDom, wDomInfo);\n if (!needDiffRef.value) {\n removeNodeChildKey(nodeChildKey);\n }\n return originalWDom;\n};\nconst addComponentProps = (wDom, info) => {\n const { componentKey, tag, props, children, reRender: reRender2, nodeChildKey } = info;\n Object.assign(wDom, {\n componentProps: props,\n componentChildren: children,\n constructor: tag,\n tagName: tag.name,\n componentKey,\n nodeChildKey,\n reRender: reRender2\n });\n};\nconst makeNode = ({\n tag,\n props,\n children\n}) => {\n if (checkFragmentFunction(tag)) {\n return Fragment(props, ...children);\n } else if (checkCustemComponentFunction(tag)) {\n const componetMakeResolver = makeWDomResolver({ tag, props, children });\n return needDiffRef.value ? componetMakeResolver : componetMakeResolver.resolve();\n }\n return {\n type: \"element\",\n tag,\n props,\n children\n };\n};\nconst remakeChildren = (nodeParentPointer, children) => children.map((item) => {\n const childItem = makeChildrenItem(item);\n childItem.getParent = () => nodeParentPointer.value;\n return childItem;\n});\nconst makeChildrenItem = (item) => {\n if (item === null || item === void 0 || item === false) {\n return { type: null };\n } else if (Array.isArray(item)) {\n const nodeParentPointer = { value: void 0 };\n const children = remakeChildren(nodeParentPointer, item);\n const node = {\n type: \"loop\",\n children\n };\n nodeParentPointer.value = node;\n return node;\n } else if (typeof item === \"string\" || typeof item === \"number\") {\n return { type: \"text\", text: item };\n }\n return item;\n};\nconst ref = (initValue) => ({ value: initValue });\nconst ext = {\n componentRef,\n componentKeyRef,\n dataStoreStore,\n dataStoreRenderQueue,\n checkFunction,\n getComponentKey,\n componentRender\n};\nexport {\n Fragment,\n ext,\n h,\n mount,\n mountCallback,\n ref,\n render,\n updateCallback\n};\n//# sourceMappingURL=lithent.mjs.map\n","import { mountCallback as o, updateCallback as a } from \"lithent\";\nconst s = (r, e) => {\n let t = r;\n return {\n get value() {\n return t;\n },\n get v() {\n return t;\n },\n set value(u) {\n t = u, e();\n },\n set v(u) {\n t = u, e();\n }\n };\n}, v = (r) => {\n let e = r;\n return {\n get value() {\n return e();\n },\n get v() {\n return e();\n },\n set value(t) {\n throw new Error(\"You can't change 'computed'\");\n },\n set v(t) {\n throw new Error(\"You can't change 'computed'\");\n }\n };\n}, g = (r, e, t = () => []) => {\n o(() => (r(), e)), a(() => (e(), r), t);\n}, p = (r, e) => c({\n initValue: r,\n renew: e\n}), c = ({\n initValue: r,\n renew: e\n}) => new Proxy(r, {\n get(t, u) {\n return t[u];\n },\n set(t, u, n) {\n return t[u] = n, e(), !0;\n }\n});\nexport {\n v as computed,\n g as effect,\n s as state,\n p as store\n};\n//# sourceMappingURL=lithentHelper.mjs.map\n","// example.jsx\nimport {\n h,\n Fragment,\n render,\n ref,\n mountCallback,\n updateCallback,\n mount,\n} from 'lithent';\nimport { state, computed, effect } from 'lithent-helper';\n\n// This is the \"mount\" function.\n// This function is only executed on mount, and on update, only updates `props` and then executes the internal return function.\n// childen is passed as the second argument.\nconst ChildComponent = mount<{ parentValue: number }>(\n (renew, props, children) => {\n // The value is used as a \"getter\" to make it easy to get and write to in the higher-order functions it returns\n const count = state<number>(1, renew);\n const text = state<string>('text', renew);\n const getParentValue = () => props.parentValue;\n const parentValue = props.parentValue;\n const summ = computed<() => number>(\n () => count.v + notRefValue + props.parentValue\n );\n\n // Even if you don't use a ref, the private value is always maintained as a regular variable.\n let notRefValue = props.parentValue;\n\n // Ref is only used to reference the DOM.\n const domRef = ref(null);\n\n const increase = () => {\n count.v = count.v + 1;\n notRefValue += 1;\n };\n\n const handleInputChane = (event: InputEvent) => {\n text.v = (event.target as HTMLInputElement).value;\n };\n\n const handleMounted = () => {\n console.log('MOUNTED', domRef);\n\n return () => console.log('UNMOUNT');\n };\n const handleUpdated = () => {\n console.log('UPDATE - parentValue');\n\n return () => console.log('UPDATED');\n };\n\n mountCallback(handleMounted);\n updateCallback(handleUpdated, () => [props.parentValue]); // Only Defs Updated (using a closure to update a value)\n\n // Behaves like `react`'s `useEffect`\n effect(\n () => console.log('INJECT'),\n () => console.log('CLEAN_UP'),\n () => [count.v]\n );\n\n // Wrap in a function and return (using a closure to hold the value)\n // This is the \"update\" function.\n return () => (\n <Fragment>\n {/* Note that the event is onInput (we use the native event name to avoid confusion). */}\n <input type=\"text\" value={text.v} onInput={handleInputChane} />\n <div ref={domRef}>count: {count.v}</div>\n {/* When the value is updated from the parent component, the function declared inside is executed, so you need to use the `props.` call by reference to output the latest value of the updated property. */}\n <div>parentValue: {props.parentValue} (working)</div>\n <div>parentValue: {getParentValue()} (working)</div>\n <div>parentValue: {parentValue} (not working)</div>\n <div>sum: {count.v + notRefValue + props.parentValue}</div>\n <div>sum(computed): {summ.v}</div>\n {/* It doesn't pull it out from under the reference, it uses the value directly, so you can just use it. */}\n <div>notRefValue: {notRefValue}</div>\n {children}\n <button onClick={increase}>Increase</button>\n </Fragment>\n );\n }\n);\n\nconst Root = mount(renew => {\n const parentNumber = state<number>(7, renew);\n\n const increaseParent = () => {\n parentNumber.v = parentNumber.v + 1;\n };\n\n const decreaseParent = () => {\n parentNumber.v = parentNumber.v - 1;\n };\n\n return () => (\n <Fragment>\n <button onClick={decreaseParent}>Decrease - Parent</button>\n <div>\n <ChildComponent parentValue={parentNumber.v}>\n <button onClick={increaseParent}>Increase - Parent</button>\n </ChildComponent>\n </div>\n </Fragment>\n );\n});\nconst root = <Root />;\n\nrender(root, document.getElementById('root'));\n"],"names":["relList","link","processPreload","mutations","mutation","node","getFetchOpts","script","fetchOpts","checkCustemComponentFunction","target","checkFragmentFunction","Fragment","checkPlainWDomType","wDom","checkPlainType","typeName","checkEmptyElement","checkSameCustomComponent","originalWDom","newWDom","checkSameFragment","_a","_b","checkSameTagElement","checkNormalTypeElement","checkExisty","value","checkStyleData","dataKey","dataValue","checkRefData","checkOptionElement","element","checkNormalAttribute","getWDomType","result","checkSameWDomWithOriginal","getParent","vDom","parentVDom","reRender","infoVdom","props","children","infoProps","infoChidren","updateProps$1","updateChildren","newVDom","key","childrenItem","componentKeyRef","needDiffRef","componentRef","redrawQueue","redrawQueueTimeout","nodeChildKeyList","pushNodeChildKey","item","removeNodeChildKey","cleanNodeChildKey","componentRender","componentKey","up","setComponetRef","getComponentKey","setRedrawAction","nodeChildKey","exec","execRedrawQueue","initUpdateHookState","initMountHookState","childItemList","addedKey","acc","action","unmount","effectAction","runUnmountQueueFromWDom","childKeys","removeItem","childKey","queue","effect","mountCallback","runMountedQueueFromWDom","component","sequence","callback","useUpdated","dependencies","upD","upS","def","checkNeedPushQueue","runUpdatedQueueFromWDom","originalDefs","newDefs","index","render","wrapElement","afterElement","Dom","wDomToDom","wDomUpdate","newWDomTree","needRerender","typeAdd","typeDelete","typeReplace","typeUpdate","typeSortedReplace","typeSortedUpdate","recursiveRemoveEvent","removeEvent","childItem","parent","findRealParentElement","findChildWithRemoveElement","newElement","parentWDom","parentEl","nextEl","startFindNextBrotherElement","brothers","nextIndex","candidiateBrothers","finedNextEl","findChildFragmentNextElement","parentType","targetEl","bItem","type","el","isFragment","orignalElement","parentElement","oldProps","updateText","updateProps","originalProps","style","oldStyle","updateStyle","updateEvent","init","tag","text","wDomChildrenToDom","elementChildren","eventKey","newEventHandler","oldEventHandler","eventName","_match","p1","originalStyle","elementStyle","styleKey","isVirtualType","makeNewWDomTree","isSameType","remakeNewWDom","remakeWDom","generalize","remakeChildrenForDiff","addReRenderTypeProperty","existOriginalWDom","isEmptyElement","getKey","isKeyCheckedWDom","isSameText","remakeChildrenForUpdate","remakeChildrenForAdd","remakeChildrenForLoopUpdate","remakedChildren","unUsedChildren","diffLoopChildren","unusedItem","newChildren","originalChildren","originalItem","findSameKeyOriginalItem","orignalChildItem","_c","updateCallback","runUpdateCallback","updateReqs","_props","h","nodeParentPointer","newProps","remakeChildren","makeNode","mount","_children","reRenderCustomComponent","makeWDomResolver","isRoot","getParent2","componentMaker","customNode","makeCustomNode","wDomInfo","reRender2","makeReRender","addComponentProps","wDomMaker","info","componetMakeResolver","makeChildrenItem","ref","initValue","s","r","e","t","u","v","g","o","a","ChildComponent","renew","count","state","getParentValue","parentValue","summ","computed","notRefValue","domRef","increase","handleInputChane","event","handleMounted","handleUpdated","Root","parentNumber","increaseParent","decreaseParent","root"],"mappings":"CAAqB,UAAoB,CACrC,MAAMA,EAAU,SAAS,cAAc,MAAM,EAAE,QAC/C,GAAIA,GAAWA,EAAQ,UAAYA,EAAQ,SAAS,eAAe,EAC/D,OAEJ,UAAWC,KAAQ,SAAS,iBAAiB,2BAA2B,EACpEC,EAAeD,CAAI,EAEvB,IAAI,iBAAkBE,GAAc,CAChC,UAAWC,KAAYD,EACnB,GAAIC,EAAS,OAAS,YAGtB,UAAWC,KAAQD,EAAS,WACpBC,EAAK,UAAY,QAAUA,EAAK,MAAQ,iBACxCH,EAAeG,CAAI,CAGvC,CAAK,EAAE,QAAQ,SAAU,CAAE,UAAW,GAAM,QAAS,EAAI,CAAE,EACvD,SAASC,EAAaC,EAAQ,CAC1B,MAAMC,EAAY,CAAA,EAClB,OAAID,EAAO,YACPC,EAAU,UAAYD,EAAO,WAC7BA,EAAO,iBACPC,EAAU,eAAiBD,EAAO,gBAClCA,EAAO,cAAgB,kBACvBC,EAAU,YAAc,UACnBD,EAAO,cAAgB,YAC5BC,EAAU,YAAc,OAExBA,EAAU,YAAc,cACrBA,CACV,CACD,SAASN,EAAeD,EAAM,CAC1B,GAAIA,EAAK,GAEL,OACJA,EAAK,GAAK,GAEV,MAA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AAA,OACEiC,GAAe,CAAA,YAAagB,EAAa,CAAA,EACvCjD,EAAA,SAAA,CAAO,QAASkD,CAAgB,EAAA,mBAAiB,CACpD,CACF,CACF,CAEJ,CAAC,EACKE,KAAQJ,GAAK,IAAA,EAEnB1I,GAAO8I,GAAM,SAAS,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>lithent</title>
|
|
7
|
+
<script type="module" crossorigin src="/assets/index.e76a0ef8.js"></script>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<section id="root"></section>
|
|
11
|
+
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "lithent-examples",
|
|
3
|
+
"version": "0.21.0",
|
|
4
|
+
"description": "lithentExamples",
|
|
5
|
+
"private": true,
|
|
6
|
+
"packageManager": "pnpm@7.6.0",
|
|
7
|
+
"main": "./dist/lithentExamples.umd.js",
|
|
8
|
+
"module": "./dist/lithentExamples.mjs",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"dev": "vite",
|
|
12
|
+
"watch": "vite build --watch",
|
|
13
|
+
"build": "vite build"
|
|
14
|
+
},
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=16.16.0"
|
|
17
|
+
},
|
|
18
|
+
"author": "",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https@github.com:superlucky84/lithent.git"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/superlucky84/lithent",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"keywords": ["lithent"],
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"lithent": "workspace:*",
|
|
28
|
+
"lithent-helper": "workspace:*"
|
|
29
|
+
},
|
|
30
|
+
"volta": {
|
|
31
|
+
"node": "20.3.0"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// example.jsx
|
|
2
|
+
import {
|
|
3
|
+
h,
|
|
4
|
+
Fragment,
|
|
5
|
+
render,
|
|
6
|
+
ref,
|
|
7
|
+
mountCallback,
|
|
8
|
+
updateCallback,
|
|
9
|
+
mount,
|
|
10
|
+
} from 'lithent';
|
|
11
|
+
import { state, computed, effect } from 'lithent-helper';
|
|
12
|
+
|
|
13
|
+
// This is the "mount" function.
|
|
14
|
+
// This function is only executed on mount, and on update, only updates `props` and then executes the internal return function.
|
|
15
|
+
// childen is passed as the second argument.
|
|
16
|
+
const ChildComponent = mount<{ parentValue: number }>(
|
|
17
|
+
(renew, props, children) => {
|
|
18
|
+
// The value is used as a "getter" to make it easy to get and write to in the higher-order functions it returns
|
|
19
|
+
const count = state<number>(1, renew);
|
|
20
|
+
const text = state<string>('text', renew);
|
|
21
|
+
const getParentValue = () => props.parentValue;
|
|
22
|
+
const parentValue = props.parentValue;
|
|
23
|
+
const summ = computed<() => number>(
|
|
24
|
+
() => count.v + notRefValue + props.parentValue
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
// Even if you don't use a ref, the private value is always maintained as a regular variable.
|
|
28
|
+
let notRefValue = props.parentValue;
|
|
29
|
+
|
|
30
|
+
// Ref is only used to reference the DOM.
|
|
31
|
+
const domRef = ref(null);
|
|
32
|
+
|
|
33
|
+
const increase = () => {
|
|
34
|
+
count.v = count.v + 1;
|
|
35
|
+
notRefValue += 1;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const handleInputChane = (event: InputEvent) => {
|
|
39
|
+
text.v = (event.target as HTMLInputElement).value;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const handleMounted = () => {
|
|
43
|
+
console.log('MOUNTED', domRef);
|
|
44
|
+
|
|
45
|
+
return () => console.log('UNMOUNT');
|
|
46
|
+
};
|
|
47
|
+
const handleUpdated = () => {
|
|
48
|
+
console.log('UPDATE - parentValue');
|
|
49
|
+
|
|
50
|
+
return () => console.log('UPDATED');
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
mountCallback(handleMounted);
|
|
54
|
+
updateCallback(handleUpdated, () => [props.parentValue]); // Only Defs Updated (using a closure to update a value)
|
|
55
|
+
|
|
56
|
+
// Behaves like `react`'s `useEffect`
|
|
57
|
+
effect(
|
|
58
|
+
() => console.log('INJECT'),
|
|
59
|
+
() => console.log('CLEAN_UP'),
|
|
60
|
+
() => [count.v]
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
// Wrap in a function and return (using a closure to hold the value)
|
|
64
|
+
// This is the "update" function.
|
|
65
|
+
return () => (
|
|
66
|
+
<Fragment>
|
|
67
|
+
{/* Note that the event is onInput (we use the native event name to avoid confusion). */}
|
|
68
|
+
<input type="text" value={text.v} onInput={handleInputChane} />
|
|
69
|
+
<div ref={domRef}>count: {count.v}</div>
|
|
70
|
+
{/* 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. */}
|
|
71
|
+
<div>parentValue: {props.parentValue} (working)</div>
|
|
72
|
+
<div>parentValue: {getParentValue()} (working)</div>
|
|
73
|
+
<div>parentValue: {parentValue} (not working)</div>
|
|
74
|
+
<div>sum: {count.v + notRefValue + props.parentValue}</div>
|
|
75
|
+
<div>sum(computed): {summ.v}</div>
|
|
76
|
+
{/* It doesn't pull it out from under the reference, it uses the value directly, so you can just use it. */}
|
|
77
|
+
<div>notRefValue: {notRefValue}</div>
|
|
78
|
+
{children}
|
|
79
|
+
<button onClick={increase}>Increase</button>
|
|
80
|
+
</Fragment>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
const Root = mount(renew => {
|
|
86
|
+
const parentNumber = state<number>(7, renew);
|
|
87
|
+
|
|
88
|
+
const increaseParent = () => {
|
|
89
|
+
parentNumber.v = parentNumber.v + 1;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const decreaseParent = () => {
|
|
93
|
+
parentNumber.v = parentNumber.v - 1;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
return () => (
|
|
97
|
+
<Fragment>
|
|
98
|
+
<button onClick={decreaseParent}>Decrease - Parent</button>
|
|
99
|
+
<div>
|
|
100
|
+
<ChildComponent parentValue={parentNumber.v}>
|
|
101
|
+
<button onClick={increaseParent}>Increase - Parent</button>
|
|
102
|
+
</ChildComponent>
|
|
103
|
+
</div>
|
|
104
|
+
</Fragment>
|
|
105
|
+
);
|
|
106
|
+
});
|
|
107
|
+
const root = <Root />;
|
|
108
|
+
|
|
109
|
+
render(root, document.getElementById('root'));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const effect: (forward: () => (() => void) | void, backward: () => (() => void) | void, dependencies?: () => any[]) => void;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { mountCallback as o, updateCallback as a } from "lithent";
|
|
2
|
+
const s = (r, e) => {
|
|
3
|
+
let t = r;
|
|
4
|
+
return {
|
|
5
|
+
get value() {
|
|
6
|
+
return t;
|
|
7
|
+
},
|
|
8
|
+
get v() {
|
|
9
|
+
return t;
|
|
10
|
+
},
|
|
11
|
+
set value(u) {
|
|
12
|
+
t = u, e();
|
|
13
|
+
},
|
|
14
|
+
set v(u) {
|
|
15
|
+
t = u, e();
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}, v = (r) => {
|
|
19
|
+
let e = r;
|
|
20
|
+
return {
|
|
21
|
+
get value() {
|
|
22
|
+
return e();
|
|
23
|
+
},
|
|
24
|
+
get v() {
|
|
25
|
+
return e();
|
|
26
|
+
},
|
|
27
|
+
set value(t) {
|
|
28
|
+
throw new Error("You can't change 'computed'");
|
|
29
|
+
},
|
|
30
|
+
set v(t) {
|
|
31
|
+
throw new Error("You can't change 'computed'");
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}, g = (r, e, t = () => []) => {
|
|
35
|
+
o(() => (r(), e)), a(() => (e(), r), t);
|
|
36
|
+
}, p = (r, e) => c({
|
|
37
|
+
initValue: r,
|
|
38
|
+
renew: e
|
|
39
|
+
}), c = ({
|
|
40
|
+
initValue: r,
|
|
41
|
+
renew: e
|
|
42
|
+
}) => new Proxy(r, {
|
|
43
|
+
get(t, u) {
|
|
44
|
+
return t[u];
|
|
45
|
+
},
|
|
46
|
+
set(t, u, n) {
|
|
47
|
+
return t[u] = n, e(), !0;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
export {
|
|
51
|
+
v as computed,
|
|
52
|
+
g as effect,
|
|
53
|
+
s as state,
|
|
54
|
+
p as store
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=lithentHelper.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lithentHelper.mjs","sources":["../src/hook/state.ts","../src/hook/computed.ts","../src/hook/effect.ts","../src/hook/store.ts"],"sourcesContent":["export const state = <T>(\n value: T,\n renew: () => boolean\n): {\n value: T;\n v: T;\n} => {\n let result = value;\n\n return {\n get value() {\n return result;\n },\n get v() {\n return result;\n },\n set value(newValue: T) {\n result = newValue;\n renew();\n },\n set v(newValue: T) {\n result = newValue;\n renew();\n },\n };\n};\n","export const computed = <T extends Function>(\n value: T\n): {\n value: T;\n v: T;\n} => {\n let result = value;\n\n return {\n get value() {\n return result();\n },\n get v() {\n return result();\n },\n set value(_newValue: T) {\n throw new Error(`You can't change 'computed'`);\n },\n set v(_newValue: T) {\n throw new Error(`You can't change 'computed'`);\n },\n };\n};\n","import { updateCallback } from 'lithent';\nimport { mountCallback } from 'lithent';\n\nexport const effect = (\n forward: () => (() => void) | void,\n backward: () => (() => void) | void,\n dependencies: () => any[] = () => []\n) => {\n mountCallback(() => {\n forward();\n\n return backward;\n });\n\n updateCallback(() => {\n backward();\n\n return forward;\n }, dependencies);\n};\n","export const store = <T extends {}>(initValue: T, renew: () => boolean) => {\n return updater<T>({\n initValue,\n renew,\n });\n};\n\nexport const updater = <T extends { [key: string | symbol]: unknown }>({\n initValue,\n renew,\n}: {\n initValue: T;\n renew: () => void;\n}) =>\n new Proxy(initValue, {\n get(target: T, prop: string) {\n return target[prop];\n },\n set(target, prop: keyof T, value) {\n target[prop] = value;\n renew();\n\n return true;\n },\n });\n"],"names":["state","value","renew","result","newValue","computed","_newValue","effect","forward","backward","dependencies","mountCallback","updateCallback","store","initValue","updater","target","prop"],"mappings":";AAAa,MAAAA,IAAQ,CACnBC,GACAC,MAIG;AACH,MAAIC,IAASF;AAEN,SAAA;AAAA,IACL,IAAI,QAAQ;AACH,aAAAE;AAAA,IACT;AAAA,IACA,IAAI,IAAI;AACC,aAAAA;AAAA,IACT;AAAA,IACA,IAAI,MAAMC,GAAa;AACZ,MAAAD,IAAAC,GACHF;IACR;AAAA,IACA,IAAI,EAAEE,GAAa;AACR,MAAAD,IAAAC,GACHF;IACR;AAAA,EAAA;AAEJ,GCzBaG,IAAW,CACtBJ,MAIG;AACH,MAAIE,IAASF;AAEN,SAAA;AAAA,IACL,IAAI,QAAQ;AACV,aAAOE,EAAO;AAAA,IAChB;AAAA,IACA,IAAI,IAAI;AACN,aAAOA,EAAO;AAAA,IAChB;AAAA,IACA,IAAI,MAAMG,GAAc;AAChB,YAAA,IAAI,MAAM,6BAA6B;AAAA,IAC/C;AAAA,IACA,IAAI,EAAEA,GAAc;AACZ,YAAA,IAAI,MAAM,6BAA6B;AAAA,IAC/C;AAAA,EAAA;AAEJ,GCnBaC,IAAS,CACpBC,GACAC,GACAC,IAA4B,MAAM,CAAA,MAC/B;AACH,EAAAC,EAAc,OACJH,KAEDC,EACR,GAEDG,EAAe,OACJH,KAEFD,IACNE,CAAY;AACjB,GCnBaG,IAAQ,CAAeC,GAAcZ,MACzCa,EAAW;AAAA,EAChB,WAAAD;AAAA,EACA,OAAAZ;AAAA,CACD,GAGUa,IAAU,CAAgD;AAAA,EACrE,WAAAD;AAAA,EACA,OAAAZ;AACF,MAIE,IAAI,MAAMY,GAAW;AAAA,EACnB,IAAIE,GAAWC,GAAc;AAC3B,WAAOD,EAAOC;AAAA,EAChB;AAAA,EACA,IAAID,GAAQC,GAAehB,GAAO;AAChC,WAAAe,EAAOC,KAAQhB,GACTC,KAEC;AAAA,EACT;AACF,CAAC;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(function(n,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("lithent")):typeof define=="function"&&define.amd?define(["exports","lithent"],o):(n=typeof globalThis<"u"?globalThis:n||self,o(n.lithentHelper={},n.lithent))})(this,function(n,o){"use strict";const l=(u,e)=>{let t=u;return{get value(){return t},get v(){return t},set value(r){t=r,e()},set v(r){t=r,e()}}},s=u=>{let e=u;return{get value(){return e()},get v(){return e()},set value(t){throw new Error("You can't change 'computed'")},set v(t){throw new Error("You can't change 'computed'")}}},c=(u,e,t=()=>[])=>{o.mountCallback(()=>(u(),e)),o.updateCallback(()=>(e(),u),t)},i=(u,e)=>a({initValue:u,renew:e}),a=({initValue:u,renew:e})=>new Proxy(u,{get(t,r){return t[r]},set(t,r,d){return t[r]=d,e(),!0}});n.computed=s,n.effect=c,n.state=l,n.store=i,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
2
|
+
//# sourceMappingURL=lithentHelper.umd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lithentHelper.umd.js","sources":["../src/hook/state.ts","../src/hook/computed.ts","../src/hook/effect.ts","../src/hook/store.ts"],"sourcesContent":["export const state = <T>(\n value: T,\n renew: () => boolean\n): {\n value: T;\n v: T;\n} => {\n let result = value;\n\n return {\n get value() {\n return result;\n },\n get v() {\n return result;\n },\n set value(newValue: T) {\n result = newValue;\n renew();\n },\n set v(newValue: T) {\n result = newValue;\n renew();\n },\n };\n};\n","export const computed = <T extends Function>(\n value: T\n): {\n value: T;\n v: T;\n} => {\n let result = value;\n\n return {\n get value() {\n return result();\n },\n get v() {\n return result();\n },\n set value(_newValue: T) {\n throw new Error(`You can't change 'computed'`);\n },\n set v(_newValue: T) {\n throw new Error(`You can't change 'computed'`);\n },\n };\n};\n","import { updateCallback } from 'lithent';\nimport { mountCallback } from 'lithent';\n\nexport const effect = (\n forward: () => (() => void) | void,\n backward: () => (() => void) | void,\n dependencies: () => any[] = () => []\n) => {\n mountCallback(() => {\n forward();\n\n return backward;\n });\n\n updateCallback(() => {\n backward();\n\n return forward;\n }, dependencies);\n};\n","export const store = <T extends {}>(initValue: T, renew: () => boolean) => {\n return updater<T>({\n initValue,\n renew,\n });\n};\n\nexport const updater = <T extends { [key: string | symbol]: unknown }>({\n initValue,\n renew,\n}: {\n initValue: T;\n renew: () => void;\n}) =>\n new Proxy(initValue, {\n get(target: T, prop: string) {\n return target[prop];\n },\n set(target, prop: keyof T, value) {\n target[prop] = value;\n renew();\n\n return true;\n },\n });\n"],"names":["state","value","renew","result","newValue","computed","_newValue","effect","forward","backward","dependencies","mountCallback","updateCallback","store","initValue","updater","target","prop"],"mappings":"8QAAa,MAAAA,EAAQ,CACnBC,EACAC,IAIG,CACH,IAAIC,EAASF,EAEN,MAAA,CACL,IAAI,OAAQ,CACH,OAAAE,CACT,EACA,IAAI,GAAI,CACC,OAAAA,CACT,EACA,IAAI,MAAMC,EAAa,CACZD,EAAAC,EACHF,GACR,EACA,IAAI,EAAEE,EAAa,CACRD,EAAAC,EACHF,GACR,CAAA,CAEJ,ECzBaG,EACXJ,GAIG,CACH,IAAIE,EAASF,EAEN,MAAA,CACL,IAAI,OAAQ,CACV,OAAOE,EAAO,CAChB,EACA,IAAI,GAAI,CACN,OAAOA,EAAO,CAChB,EACA,IAAI,MAAMG,EAAc,CAChB,MAAA,IAAI,MAAM,6BAA6B,CAC/C,EACA,IAAI,EAAEA,EAAc,CACZ,MAAA,IAAI,MAAM,6BAA6B,CAC/C,CAAA,CAEJ,ECnBaC,EAAS,CACpBC,EACAC,EACAC,EAA4B,IAAM,CAAA,IAC/B,CACHC,EAAAA,cAAc,KACJH,IAEDC,EACR,EAEDG,EAAAA,eAAe,KACJH,IAEFD,GACNE,CAAY,CACjB,ECnBaG,EAAQ,CAAeC,EAAcZ,IACzCa,EAAW,CAChB,UAAAD,EACA,MAAAZ,CAAA,CACD,EAGUa,EAAU,CAAgD,CACrE,UAAAD,EACA,MAAAZ,CACF,IAIE,IAAI,MAAMY,EAAW,CACnB,IAAIE,EAAWC,EAAc,CAC3B,OAAOD,EAAOC,EAChB,EACA,IAAID,EAAQC,EAAehB,EAAO,CAChC,OAAAe,EAAOC,GAAQhB,EACTC,IAEC,EACT,CACF,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "lithent-helper",
|
|
3
|
+
"version": "0.21.0",
|
|
4
|
+
"description": "lithentHelper",
|
|
5
|
+
"private": true,
|
|
6
|
+
"packageManager": "pnpm@7.6.0",
|
|
7
|
+
"main": "./dist/lithentHelper.umd.js",
|
|
8
|
+
"module": "./dist/lithentHelper.mjs",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"dev": "vite",
|
|
12
|
+
"watch": "vite build --watch",
|
|
13
|
+
"build": "vite build"
|
|
14
|
+
},
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=16.16.0"
|
|
17
|
+
},
|
|
18
|
+
"author": "",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https@github.com:superlucky84/lithent.git"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/superlucky84/lithent",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"keywords": ["lithent"],
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"lithent": "workspace:*"
|
|
28
|
+
},
|
|
29
|
+
"volta": {
|
|
30
|
+
"node": "20.3.0"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const computed = <T extends Function>(
|
|
2
|
+
value: T
|
|
3
|
+
): {
|
|
4
|
+
value: T;
|
|
5
|
+
v: T;
|
|
6
|
+
} => {
|
|
7
|
+
let result = value;
|
|
8
|
+
|
|
9
|
+
return {
|
|
10
|
+
get value() {
|
|
11
|
+
return result();
|
|
12
|
+
},
|
|
13
|
+
get v() {
|
|
14
|
+
return result();
|
|
15
|
+
},
|
|
16
|
+
set value(_newValue: T) {
|
|
17
|
+
throw new Error(`You can't change 'computed'`);
|
|
18
|
+
},
|
|
19
|
+
set v(_newValue: T) {
|
|
20
|
+
throw new Error(`You can't change 'computed'`);
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { updateCallback } from 'lithent';
|
|
2
|
+
import { mountCallback } from 'lithent';
|
|
3
|
+
|
|
4
|
+
export const effect = (
|
|
5
|
+
forward: () => (() => void) | void,
|
|
6
|
+
backward: () => (() => void) | void,
|
|
7
|
+
dependencies: () => any[] = () => []
|
|
8
|
+
) => {
|
|
9
|
+
mountCallback(() => {
|
|
10
|
+
forward();
|
|
11
|
+
|
|
12
|
+
return backward;
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
updateCallback(() => {
|
|
16
|
+
backward();
|
|
17
|
+
|
|
18
|
+
return forward;
|
|
19
|
+
}, dependencies);
|
|
20
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const state = <T>(
|
|
2
|
+
value: T,
|
|
3
|
+
renew: () => boolean
|
|
4
|
+
): {
|
|
5
|
+
value: T;
|
|
6
|
+
v: T;
|
|
7
|
+
} => {
|
|
8
|
+
let result = value;
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
get value() {
|
|
12
|
+
return result;
|
|
13
|
+
},
|
|
14
|
+
get v() {
|
|
15
|
+
return result;
|
|
16
|
+
},
|
|
17
|
+
set value(newValue: T) {
|
|
18
|
+
result = newValue;
|
|
19
|
+
renew();
|
|
20
|
+
},
|
|
21
|
+
set v(newValue: T) {
|
|
22
|
+
result = newValue;
|
|
23
|
+
renew();
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const store = <T extends {}>(initValue: T, renew: () => boolean) => {
|
|
2
|
+
return updater<T>({
|
|
3
|
+
initValue,
|
|
4
|
+
renew,
|
|
5
|
+
});
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const updater = <T extends { [key: string | symbol]: unknown }>({
|
|
9
|
+
initValue,
|
|
10
|
+
renew,
|
|
11
|
+
}: {
|
|
12
|
+
initValue: T;
|
|
13
|
+
renew: () => void;
|
|
14
|
+
}) =>
|
|
15
|
+
new Proxy(initValue, {
|
|
16
|
+
get(target: T, prop: string) {
|
|
17
|
+
return target[prop];
|
|
18
|
+
},
|
|
19
|
+
set(target, prop: keyof T, value) {
|
|
20
|
+
target[prop] = value;
|
|
21
|
+
renew();
|
|
22
|
+
|
|
23
|
+
return true;
|
|
24
|
+
},
|
|
25
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "lithent",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "lithent",
|
|
5
|
+
"packageManager": "pnpm@7.6.0",
|
|
6
|
+
"main": "./dist/lithent.umd.js",
|
|
7
|
+
"module": "./dist/lithent.mjs",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/lithent.mjs",
|
|
12
|
+
"require": "./dist/lithent.umd.js"
|
|
13
|
+
},
|
|
14
|
+
"./helper": {
|
|
15
|
+
"types": "./helper/dist/index.d.ts",
|
|
16
|
+
"import": "./helper/dist/lithentHelper.mjs",
|
|
17
|
+
"require": "./helper/dist/lithentHelper.umd.js"
|
|
18
|
+
},
|
|
19
|
+
"./router": {
|
|
20
|
+
"types": "./router/dist/Router.d.ts",
|
|
21
|
+
"import": "./router/dist/Router.mjs",
|
|
22
|
+
"require": "./router/dist/Router.umd.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=20.3.0"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"src",
|
|
31
|
+
"dist",
|
|
32
|
+
"helper/dist",
|
|
33
|
+
"helper/src",
|
|
34
|
+
"helper/package.json",
|
|
35
|
+
"router/dist",
|
|
36
|
+
"router/src",
|
|
37
|
+
"router/package.json",
|
|
38
|
+
"examples/dist",
|
|
39
|
+
"examples/src",
|
|
40
|
+
"examples/package.json"
|
|
41
|
+
],
|
|
42
|
+
"author": "",
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "https://github.com/superlucky84/lithent.git"
|
|
46
|
+
},
|
|
47
|
+
"homepage": "https://github.com/superlucky84/lithent",
|
|
48
|
+
"license": "MIT",
|
|
49
|
+
"keywords": [
|
|
50
|
+
"lithent"
|
|
51
|
+
],
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@babel/cli": "^7.18.9",
|
|
54
|
+
"@babel/core": "^7.18.9",
|
|
55
|
+
"@babel/plugin-transform-react-jsx": "^7.18.6",
|
|
56
|
+
"@babel/preset-typescript": "^7.18.6",
|
|
57
|
+
"@nabla/vite-plugin-eslint": "^1.4.1",
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "^5.30.7",
|
|
59
|
+
"@typescript-eslint/parser": "^5.30.7",
|
|
60
|
+
"babel-plugin-module-resolver": "^4.1.0",
|
|
61
|
+
"eslint": "^7.32.0",
|
|
62
|
+
"eslint-config-prettier": "^8.3.0",
|
|
63
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
64
|
+
"prettier": "^2.3.2",
|
|
65
|
+
"terser": "^5.17.7",
|
|
66
|
+
"typescript": "^4.7.4",
|
|
67
|
+
"vite": "3.2.7",
|
|
68
|
+
"vite-plugin-checker": "^0.4.9",
|
|
69
|
+
"vite-plugin-dts": "^2.3.0"
|
|
70
|
+
},
|
|
71
|
+
"volta": {
|
|
72
|
+
"node": "20.3.0"
|
|
73
|
+
},
|
|
74
|
+
"scripts": {
|
|
75
|
+
"dev:core": "vite",
|
|
76
|
+
"dev:examples": "pnpm --filter lithent-examples dev",
|
|
77
|
+
"build:core": "vite build",
|
|
78
|
+
"build:helper": "pnpm --filter lithent-helper build",
|
|
79
|
+
"watch:core": "vite build --watch",
|
|
80
|
+
"watch:helper": "pnpm --filter lithent-helper watch",
|
|
81
|
+
"build": "pnpm build:core && pnpm -r build",
|
|
82
|
+
"dev": "pnpm watch:core & pnpm watch:helper & pnpm dev:examples",
|
|
83
|
+
"test": "jest",
|
|
84
|
+
"test:watch": "jest --watch",
|
|
85
|
+
"clean": "pnpm clean:dist && pnpm clean:module",
|
|
86
|
+
"clean:dist": "pnpm -r exec rm -rf dist && rm -rf dist",
|
|
87
|
+
"clean:module": "pnpm -r exec rm -rf dist node_modules && rm -rf node_modules",
|
|
88
|
+
"dev:docs": "pnpm --filter lithent-docs dev"
|
|
89
|
+
}
|
|
90
|
+
}
|