lithent 1.18.2 → 1.18.4
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 +15 -15
- package/dist/index.d.ts +2 -1
- package/dist/lithent.mjs +34 -33
- package/dist/lithent.mjs.map +1 -1
- package/dist/lithent.umd.js +1 -1
- package/dist/lithent.umd.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/universalRef.d.ts +2 -2
- package/examples/dist/assets/{index-CoLsHZbl.js → index-GZ-P6cMy.js} +2 -2
- package/examples/dist/assets/index-GZ-P6cMy.js.map +1 -0
- package/examples/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/hook/mountCallback.ts +3 -3
- package/src/hook/unmount.ts +4 -4
- package/src/hook/updateCallback.ts +3 -3
- package/src/hook/useUpdate.ts +3 -3
- package/src/index.ts +2 -1
- package/src/render.ts +2 -2
- package/src/types/index.ts +1 -1
- package/src/utils/redraw.ts +4 -4
- package/src/utils/universalRef.ts +5 -5
- package/ssr/dist/lithentSsr.mjs +125 -91
- package/ssr/dist/lithentSsr.mjs.map +1 -1
- package/ssr/dist/lithentSsr.umd.js +2 -2
- package/ssr/dist/lithentSsr.umd.js.map +1 -1
- package/ssr/src/hydration.ts +3 -1
- package/ssr/src/tests/tostring.tsx +22 -7
- package/examples/dist/assets/index-CoLsHZbl.js.map +0 -1
package/dist/lithent.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(f,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(f=typeof globalThis<"u"?globalThis:f||self,p(f.lithent={}))})(this,function(f){"use strict";const p=e=>typeof e=="object"&&!("resolve"in e),T=(e,t)=>p(e)&&e.type===t,ye=(e,t)=>"ctor"in e?e.ctor===(t==null?void 0:t.ctor):e===(t==null?void 0:t.ctor),Ce=(e,t)=>{var s,c;return p(e)&&(t==null?void 0:t.type)==="fragment"&&((s=t==null?void 0:t.children)==null?void 0:s.length)===((c=e==null?void 0:e.children)==null?void 0:c.length)},ve=(e,t)=>{var s,c;return p(e)&&(t==null?void 0:t.type)==="element"&&(t==null?void 0:t.tag)===e.tag&&((s=t==null?void 0:t.children)==null?void 0:s.length)===((c=e==null?void 0:e.children)==null?void 0:c.length)},Y=(e,t)=>p(e)&&(t==null?void 0:t.type)===e.type,ke=(e,t)=>{var s,c;return p(e)&&(t==null?void 0:t.type)===e.type&&(a(d((e.children||[])[0]))&&a(d(((t==null?void 0:t.children)||[])[0]))||((s=t==null?void 0:t.children)==null?void 0:s.length)===((c=e==null?void 0:e.children)==null?void 0:c.length))},d=e=>{var t,s;return((t=e==null?void 0:e.compProps)==null?void 0:t.key)??((s=e==null?void 0:e.props)==null?void 0:s.key)},k=e=>e&&["fragment","loop"].includes(e),b=e=>typeof e=="function"&&!Z(e)||typeof e=="object"&&"resolve"in e,Z=e=>typeof e=="function"&&e===O,H=e=>p(e)&&!e.type,a=e=>e!=null,V=(e,t)=>e==="style"&&typeof t=="object",Re=(e,t)=>e==="ref"&&typeof t=="object",ae=(e,t)=>{const s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);return s&&s.get&&s.set},Ee=e=>{let t="et";return b(e)?t="c":T(e,"fragment")?t="f":T(e,"element")?t="e":T(e,"loop")?t="l":T(e,"text")?t="t":H(e)&&(t="et"),t},Pe={c:ye,l:ke,t:Y,e:ve,f:Ce,et:Y},R=Symbol.for("lithentWDomSymbol"),E={value:""},P={value:{}},Q={value:!1},o=new WeakMap,Se=e=>{o.set(e,{vd:{value:null},up:()=>{},upR:[],upS:{value:0},upD:[],upCB:[],mts:[],umts:[]})},S=()=>P.value,K=(e,t)=>o.get(e)?o.get(e)[t]:null,Ne=e=>P.value=e,Te=e=>{P.value=e,Se(e)},y=e=>e.getParent&&e.getParent(),N=Object.entries,g=Object.keys,x=Object.assign,be=e=>typeof e=="object"&&!Array.isArray(e)&&!Object.getOwnPropertySymbols(e).includes(R),xe=e=>{o.get(S()).umts.push(e)},U=e=>{const{compKey:t}=e;t&&Ue(t),m(e)},m=e=>{(e.children||[]).forEach(t=>{t.compKey?U(t):m(t)})},Ue=e=>{const t=o.get(e);t&&(t.umts.forEach(s=>s()),t.umts=[],o.delete(e))};let B=[];const q=()=>{B.forEach(e=>Me(e)),B=[]},Fe=e=>{e.compKey&&B.push(e)},Le=e=>{var t;return(((t=o.get(S()))==null?void 0:t.mts)||[]).push(e)},Me=e=>{const{compKey:t}=e;if(t){const s=o.get(t),c=s==null?void 0:s.mts,r=s==null?void 0:s.upS;P.value=t,r&&(r.value=0),c&&(s.mts=[],c.forEach(n=>{const u=n();u&&xe(u)}))}},w=(e,t=()=>[])=>{const s=o.get(S()),{upD:c,upS:r}=s,n=c[r.value];if(n&&Oe(n,t())){const u=e();u&&s.upCB.push(u)}c[r.value]=t(),r.value+=1},Ae=e=>{const{compKey:t}=e;if(t){const s=o.get(t),c=s==null?void 0:s.upCB,r=s==null?void 0:s.upS;P.value=t,r&&(r.value=0),e.ctor&&c&&(s.upCB=[],c.forEach(n=>n()))}},Oe=(e,t)=>e.length?e.some((s,c)=>s!==t[c]):!0,je=e=>e==="className"?"class":e,W=e=>e.replace(/^on(.*)/,(t,s)=>s.toLowerCase()),_=()=>new DocumentFragment,D=e=>document.createElement(e),Qe=(e,t,s,c)=>{e.isRoot=!0,t??(t=document.body),e.wrapElement=t;const r=L(e,c);return s?(e.afterElement=s,t.insertBefore(r,s)):c||(t.tagName==="HTML"?t.replaceWith(r):t.appendChild(r)),q(),()=>{var u;const n=(u=o.get(e.compProps||{}))==null?void 0:u.vd.value;n&&U(n),F(n||e),Be(n||e)}},ee=e=>{const{needRerender:t}=e;t&&t!=="N"&&({A:z,D:I,R:_e,U:G,CNSU:G,SR:ce,SU:qe}[t](e),delete e.needRerender,delete e.oldChildren,delete e.oldProps)},F=e=>{e.props&&e.el&&ue(e.props,e.el),(e.children||[]).forEach(t=>{F(t)})},Be=e=>{te(e,e.wrapElement)},I=e=>{e.oldProps&&e.el&&ue(e.oldProps,e.el),te(e,M(y(e)))},te=(e,t)=>{var s,c;t&&e.el&&([1,3].includes((s=e.el)==null?void 0:s.nodeType)?t.removeChild(e.el):((c=e.el)==null?void 0:c.nodeType)===11&&se(e),delete e.el)},se=(e,t)=>{((e==null?void 0:e.oldChildren)||(e==null?void 0:e.children)||[]).forEach(s=>{var r;const c=(r=s.el)==null?void 0:r.nodeType;c&&([1,3].includes(c)?s.el.tagName==="HTML"?s.el.innerHTML="":s.el.remove():c===11&&se(s))})},ce=e=>{I(e),z(e)},qe=e=>{if(G(e),y(e).needRerender!=="CNSU"){const s=ne(e);z(e,s)}},z=(e,t)=>{t||(t=L(e));const s=y(e);if(s.type){const c=M(s),n=s.type==="loop"&&s.needRerender&&s.needRerender!=="CNSU"?$(s,y(s)):$(e,s);t&&c&&(e.tag!=="portal"&&(n?c.insertBefore(t,n):c.appendChild(t)),q())}},ne=e=>k(e.type)?((e==null?void 0:e.children)||[]).reduce((t,s)=>{const c=ne(s);return c&&t.appendChild(c),t},_()):e.el,$=(e,t)=>{const s=t.children||[],r=s.indexOf(e)+1,n=s.slice(r),u=re(n),l=t.type||"";if(u)return u;if(!t.isRoot&&k(l))return $(t,y(t));if(t.isRoot&&k(l)&&t.afterElement)return t.afterElement},re=e=>e.reduce((t,s)=>{const c=s.type,r=s.el,n=c&&k(c);return t||(n?re(s.children||[]):r&&r.nodeType!==11?r:t)},void 0),_e=e=>{const t=y(e),s=e.el;if(t.type&&s)if(s.nodeType===11)ce(e);else{const c=M(t),r=L(e);c&&e.tag!=="portal"&&c.replaceChild(r,s),q()}},ue=(e,t)=>{N(e||{}).forEach(([s,c])=>{s.match(/^on/)&&t.removeEventListener(W(s),c)})},G=e=>{var s;const t=e.el;if(e.type==="text"){Ie(e);return}if(t){const{oldProps:c,props:r}=e;le(r,t,c),delete e.oldProps,e.tag==="input"&&(t.value=String(((s=e==null?void 0:e.props)==null?void 0:s.value)||""))}(e.children||[]).forEach(c=>ee(c)),Ae(e)},Ie=e=>{const t=e.el;t&&(t.nodeValue=String(e.text))},le=(e,t,s,c)=>{const r={...s};N(e||{}).forEach(([n,u])=>{c&&n.match(/^on/)?fe(t,n,u,r[n]):(n==="key"||u===r[n]||n==="portal"&&typeof u=="object"||(n==="innerHTML"&&typeof u=="string"?t.innerHTML=u:V(n,u)?Ge(u,V(n,r.style)?r.style:{},t):Re(n,u)?u.value=t:n.match(/^on/)?fe(t,n,u,r[n]):n&&(n!=="type"&&ae(t,n)?t[n]=u:ze(je(n),t,u))),delete r[n])}),g(r).forEach(n=>t.removeAttribute(n))},ze=(e,t,s)=>{E.value&&e!=="xmlns"?t.setAttributeNS(null,e,s):t.setAttribute(e,s)},L=(e,t)=>{let s;const{type:c,tag:r,text:n,props:u,children:l=[]}=e,C=k(c);return r==="svg"&&(E.value=String(u==null?void 0:u.xmlns)),t?s=e.el:(C?s=_():c==="element"&&r?r==="portal"&&(u!=null&&u.portal)?s=u.portal:s=E.value?document.createElementNS(E.value,r):D(r):c==="text"&&a(n)?s=document.createTextNode(String(n)):s=D("e"),e.el=s),$e(l,s,t),le(u,s,null,t),Fe(e),r==="svg"&&(E.value=""),s},$e=(e,t,s)=>{const c=e.reduce((r,n)=>{if(n.type){const u=L(n,s);n.tag!=="portal"&&!s&&r.appendChild(u)}return r},_());!s&&t&&c.hasChildNodes()&&t.appendChild(c)},fe=(e,t,s,c)=>{const r=W(t);c!==s&&(c&&e.removeEventListener(r,c),s&&e.addEventListener(r,s))},Ge=(e,t,s)=>{const c={...t},r=s==null?void 0:s.style;r&&(N(e).forEach(([n,u])=>{r[n]=u,delete c[n]}),N(c).forEach(([n])=>r[n]=""))},M=e=>{const t=k(e.type);return e.isRoot&&t?e.wrapElement:t?M(y(e)):e.el},A=(e,t)=>Je(e,Pe[Ee(e)](e,t),t),Je=(e,t,s)=>{const c=ge(e,t,s),r=[c,t,s],n=Ye(...r),u=n==="N";return u||(c.children=me(...r)),c.needRerender=n,Xe(c,s,n),!u&&s&&(s.isLegacy=!0,delete s.children),c},Xe=(e,t,s)=>{s!=="A"&&t&&(e.el=t.el),s&&["D","R","SR"].includes(s)&&(t&&(U(t),F(t)),e.oldChildren=t==null?void 0:t.children),e.oldProps=t==null?void 0:t.props},Ye=(e,t,s)=>{const c=s&&s.type,r=H(e),n=e.isRoot,u=s&&y(s),l=!n&&(u==null?void 0:u.type),C=d(e),i=l==="loop"&&a(C),v=e.type==="text"&&t&&e.text===(s==null?void 0:s.text),j=e===s;let h;return r?h="D":v||j?h="N":c?t?h=i?"SU":"U":h=i?"SR":"R":h="A",e.type==="loop"&&h==="U"&&s&&Ze(e,s)&&(h="CNSU"),h},Ze=(e,t)=>{const s=[...(t==null?void 0:t.children)||[]],c=[...(e==null?void 0:e.children)||[]].filter(u=>s.find(l=>d(u)===d(l))),r=s.filter(u=>c.find(l=>d(u)===d(l)));let n=r.length===c.length;return n&&(n=r.every((u,l)=>d(u)===d(c[l]))),n},He=(e,t)=>{e&&t!==e&&(g(e).forEach(s=>delete e[s]),N(t||{}).forEach(([s,c])=>e[s]=c))},Ve=(e,t)=>{e&&t!==e&&(e.splice(0,e.length),t&&t.forEach(s=>e.push(s)))},Ke=(e,t)=>{const{compProps:s,compChild:c}=e,{props:r,children:n}=t;return s&&He(s,r),c&&Ve(c,n),e.reRender&&e.reRender()},ge=(e,t,s)=>b(e)?t&&s?Ke(s,e):e.resolve():e,me=(e,t,s)=>t&&s?We(e,s):we(e),we=e=>(e.children||[]).map(t=>x(A(t),{getParent:()=>e})),We=(e,t)=>e.type==="loop"&&a(d((e.children||[])[0]))?De(e,t):(e.children||[]).map((s,c)=>x(A(s,(t.children||[])[c]),{getParent:()=>e})),De=(e,t)=>{const[s,c]=et(e,t);return c.forEach(r=>{U(r),F(r),I(r)}),s},et=(e,t)=>{const s=[...e.children||[]],c=[...t.children||[]];return[s.map(n=>{const u=tt(n,c),l=A(n,u);return u&&c.splice(c.indexOf(u),1),l.getParent=()=>e,l}),c]},tt=(e,t)=>t.find(s=>d(s)===d(e)),J=new Map;let X=!1;const st=(e,t)=>{o.get(e)&&(o.get(e).up=()=>{J.set(e,t),X||(X=!0,queueMicrotask(ct))})},oe=e=>()=>{var c;const t=(c=o.get(e))==null?void 0:c.up;let s=!1;return t&&(t(),s=!0),s},ct=()=>{J.forEach(e=>{e()}),J.clear(),X=!1},nt=(e,t=()=>[])=>{o.get(S()).upR.push(()=>w(e,t)),w(e,t)},rt=()=>{var t;const e=(t=o.get(S()))==null?void 0:t.upR;e!=null&&e.length&&e.forEach(s=>s())},O=(e,...t)=>({type:"fragment",[R]:!0,children:t}),de=(e,t,...s)=>{const c={value:void 0},r=t||{},n=ie(c,s),u=ht(e,r,n);return b(u)||(c.value=u),u},ut=(e,t)=>de("portal",{portal:t},e),lt=e=>(t,s)=>e,ft=(e,t,s,c)=>{var v;if(c.isLegacy)return;Q.value=!0;const r=pe(e,t,s),n=A(r,c),{isRoot:u,getParent:l,wrapElement:C,afterElement:i}=c;if(n.getParent=l,!u&&l){const j=((v=l())==null?void 0:v.children)||[],h=j.indexOf(c);j.splice(h,1,n)}else n.isRoot=!0,n.wrapElement=C,n.afterElement=i;Q.value=!1,ee(n)},pe=(e,t,s)=>({tagName:e.name,ctor:e,props:t,children:s,resolve:(u=t)=>{Te(u);const l=e(t,s),i=(typeof l=="function"?l:()=>()=>l)(oe(u),t,s);return ot(i,u,e,t,s)}}),ot=(e,t,s,c,r)=>{let n=e,u=e(c);u.reRender&&(n=C=>{const i=e(C),v=O({},i);return i.getParent=()=>v,v},u=n(c));const l=dt(n,t,s,c,r);return he(u,t,s,c,r,l),u},dt=(e,t,s,c,r)=>{const n=()=>pt(e,t,s,c,r,n);return n},pt=(e,t,s,c,r,n)=>{Ne(t),rt();const u=e(c);return he(u,t,s,c,r,n),u},he=(e,t,s,c,r,n)=>{x(e,{compProps:c,compChild:r,ctor:s,tagName:s.name,compKey:t,reRender:n}),st(t,()=>ft(s,c,r,e)),K(t,"vd")&&(K(t,"vd").value=e)},ht=(e,t,s)=>{if(Z(e))return O(t,...s);if(b(e)){const c=pe(e,t,s);return Q.value?c:c.resolve()}return{type:"element",[R]:!0,tag:e,props:t,children:s}},ie=(e,t)=>t.map(s=>x(it(s),{getParent:()=>e.value})),it=e=>{if(e==null||e===!1)return{type:null,[R]:!0};if(Array.isArray(e)){const t={value:void 0},s=ie(t,e),c={type:"loop",[R]:!0,children:s};return t.value=c,c}else if(typeof e=="string"||typeof e=="number")return{type:"text",[R]:!0,text:e};return e},yt=e=>({value:e}),Ct=()=>Promise.resolve();f.Fragment=O,f.componentUpdate=oe,f.h=de,f.isPropType=be,f.mount=lt,f.mountCallback=Le,f.nextTick=Ct,f.portal=ut,f.ref=yt,f.render=Qe,f.updateCallback=nt,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(f,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(f=typeof globalThis<"u"?globalThis:f||self,p(f.lithent={}))})(this,function(f){"use strict";const p=e=>typeof e=="object"&&!("resolve"in e),T=(e,t)=>p(e)&&e.type===t,ye=(e,t)=>"ctor"in e?e.ctor===(t==null?void 0:t.ctor):e===(t==null?void 0:t.ctor),Ce=(e,t)=>{var s,c;return p(e)&&(t==null?void 0:t.type)==="fragment"&&((s=t==null?void 0:t.children)==null?void 0:s.length)===((c=e==null?void 0:e.children)==null?void 0:c.length)},ve=(e,t)=>{var s,c;return p(e)&&(t==null?void 0:t.type)==="element"&&(t==null?void 0:t.tag)===e.tag&&((s=t==null?void 0:t.children)==null?void 0:s.length)===((c=e==null?void 0:e.children)==null?void 0:c.length)},Y=(e,t)=>p(e)&&(t==null?void 0:t.type)===e.type,ke=(e,t)=>{var s,c;return p(e)&&(t==null?void 0:t.type)===e.type&&(a(d((e.children||[])[0]))&&a(d(((t==null?void 0:t.children)||[])[0]))||((s=t==null?void 0:t.children)==null?void 0:s.length)===((c=e==null?void 0:e.children)==null?void 0:c.length))},d=e=>{var t,s;return((t=e==null?void 0:e.compProps)==null?void 0:t.key)??((s=e==null?void 0:e.props)==null?void 0:s.key)},k=e=>e&&["fragment","loop"].includes(e),b=e=>typeof e=="function"&&!Z(e)||typeof e=="object"&&"resolve"in e,Z=e=>typeof e=="function"&&e===O,H=e=>p(e)&&!e.type,a=e=>e!=null,V=(e,t)=>e==="style"&&typeof t=="object",Re=(e,t)=>e==="ref"&&typeof t=="object",ae=(e,t)=>{const s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);return s&&s.get&&s.set},Ee=e=>{let t="et";return b(e)?t="c":T(e,"fragment")?t="f":T(e,"element")?t="e":T(e,"loop")?t="l":T(e,"text")?t="t":H(e)&&(t="et"),t},Pe={c:ye,l:ke,t:Y,e:ve,f:Ce,et:Y},R=Symbol.for("lithentWDomSymbol"),E={value:""},P={value:{}},Q={value:!1},o=new WeakMap,Se=e=>{o.set(e,{vd:{value:null},up:()=>{},upR:[],upS:{value:0},upD:[],upCB:[],mts:[],umts:[]})},S=()=>P.value,K=(e,t)=>o.get(e)?o.get(e)[t]:null,Ne=e=>P.value=e,Te=e=>{P.value=e,Se(e)},y=e=>e.getParent&&e.getParent(),N=Object.entries,g=Object.keys,x=Object.assign,be=e=>typeof e=="object"&&!Array.isArray(e)&&!Object.getOwnPropertySymbols(e).includes(R),xe=e=>{o.get(S()).umts.push(e)},U=e=>{const{compKey:t}=e;t&&Ue(t),m(e)},m=e=>{(e.children||[]).forEach(t=>{t.compKey?U(t):m(t)})},Ue=e=>{const t=o.get(e);t&&(t.umts.forEach(s=>s()),t.umts=[],o.delete(e))};let B=[];const q=()=>{B.forEach(e=>Le(e)),B=[]},Fe=e=>{e.compKey&&B.push(e)},Me=e=>{var t;return(((t=o.get(S()))==null?void 0:t.mts)||[]).push(e)},Le=e=>{const{compKey:t}=e;if(t){const s=o.get(t),c=s==null?void 0:s.mts,r=s==null?void 0:s.upS;P.value=t,r&&(r.value=0),c&&(s.mts=[],c.forEach(n=>{const u=n();u&&xe(u)}))}},w=(e,t=()=>[])=>{const s=o.get(S()),{upD:c,upS:r}=s,n=c[r.value];if(n&&Oe(n,t())){const u=e();u&&s.upCB.push(u)}c[r.value]=t(),r.value+=1},Ae=e=>{const{compKey:t}=e;if(t){const s=o.get(t),c=s==null?void 0:s.upCB,r=s==null?void 0:s.upS;P.value=t,r&&(r.value=0),e.ctor&&c&&(s.upCB=[],c.forEach(n=>n()))}},Oe=(e,t)=>e.length?e.some((s,c)=>s!==t[c]):!0,je=e=>e==="className"?"class":e,W=e=>e.replace(/^on(.*)/,(t,s)=>s.toLowerCase()),_=()=>new DocumentFragment,D=e=>document.createElement(e),Qe=(e,t,s,c)=>{e.isRoot=!0,t??(t=document.body),e.wrapElement=t;const r=M(e,c);return s?(e.afterElement=s,t.insertBefore(r,s)):c||(t.tagName==="HTML"?t.replaceWith(r):t.appendChild(r)),q(),()=>{var u;const n=(u=o.get(e.compProps||{}))==null?void 0:u.vd.value;n&&U(n),F(n||e),Be(n||e)}},ee=e=>{const{needRerender:t}=e;t&&t!=="N"&&({A:z,D:I,R:_e,U:G,CNSU:G,SR:ce,SU:qe}[t](e),delete e.needRerender,delete e.oldChildren,delete e.oldProps)},F=e=>{e.props&&e.el&&ue(e.props,e.el),(e.children||[]).forEach(t=>{F(t)})},Be=e=>{te(e,e.wrapElement)},I=e=>{e.oldProps&&e.el&&ue(e.oldProps,e.el),te(e,L(y(e)))},te=(e,t)=>{var s,c;t&&e.el&&([1,3].includes((s=e.el)==null?void 0:s.nodeType)?t.removeChild(e.el):((c=e.el)==null?void 0:c.nodeType)===11&&se(e),delete e.el)},se=(e,t)=>{((e==null?void 0:e.oldChildren)||(e==null?void 0:e.children)||[]).forEach(s=>{var r;const c=(r=s.el)==null?void 0:r.nodeType;c&&([1,3].includes(c)?s.el.tagName==="HTML"?s.el.innerHTML="":s.el.remove():c===11&&se(s))})},ce=e=>{I(e),z(e)},qe=e=>{if(G(e),y(e).needRerender!=="CNSU"){const s=ne(e);z(e,s)}},z=(e,t)=>{t||(t=M(e));const s=y(e);if(s.type){const c=L(s),n=s.type==="loop"&&s.needRerender&&s.needRerender!=="CNSU"?$(s,y(s)):$(e,s);t&&c&&(e.tag!=="portal"&&(n?c.insertBefore(t,n):c.appendChild(t)),q())}},ne=e=>k(e.type)?((e==null?void 0:e.children)||[]).reduce((t,s)=>{const c=ne(s);return c&&t.appendChild(c),t},_()):e.el,$=(e,t)=>{const s=t.children||[],r=s.indexOf(e)+1,n=s.slice(r),u=re(n),l=t.type||"";if(u)return u;if(!t.isRoot&&k(l))return $(t,y(t));if(t.isRoot&&k(l)&&t.afterElement)return t.afterElement},re=e=>e.reduce((t,s)=>{const c=s.type,r=s.el,n=c&&k(c);return t||(n?re(s.children||[]):r&&r.nodeType!==11?r:t)},void 0),_e=e=>{const t=y(e),s=e.el;if(t.type&&s)if(s.nodeType===11)ce(e);else{const c=L(t),r=M(e);c&&e.tag!=="portal"&&c.replaceChild(r,s),q()}},ue=(e,t)=>{N(e||{}).forEach(([s,c])=>{s.match(/^on/)&&t.removeEventListener(W(s),c)})},G=e=>{var s;const t=e.el;if(e.type==="text"){Ie(e);return}if(t){const{oldProps:c,props:r}=e;le(r,t,c),delete e.oldProps,e.tag==="input"&&(t.value=String(((s=e==null?void 0:e.props)==null?void 0:s.value)||""))}(e.children||[]).forEach(c=>ee(c)),Ae(e)},Ie=e=>{const t=e.el;t&&(t.nodeValue=String(e.text))},le=(e,t,s,c)=>{const r={...s};N(e||{}).forEach(([n,u])=>{c&&n.match(/^on/)?fe(t,n,u,r[n]):(n==="key"||u===r[n]||n==="portal"&&typeof u=="object"||(n==="innerHTML"&&typeof u=="string"?t.innerHTML=u:V(n,u)?Ge(u,V(n,r.style)?r.style:{},t):Re(n,u)?u.value=t:n.match(/^on/)?fe(t,n,u,r[n]):n&&(n!=="type"&&ae(t,n)?t[n]=u:ze(je(n),t,u))),delete r[n])}),g(r).forEach(n=>t.removeAttribute(n))},ze=(e,t,s)=>{E.value&&e!=="xmlns"?t.setAttributeNS(null,e,s):t.setAttribute(e,s)},M=(e,t)=>{let s;const{type:c,tag:r,text:n,props:u,children:l=[]}=e,C=k(c);return r==="svg"&&(E.value=String(u==null?void 0:u.xmlns)),t?s=e.el:(C?s=_():c==="element"&&r?r==="portal"&&(u!=null&&u.portal)?s=u.portal:s=E.value?document.createElementNS(E.value,r):D(r):c==="text"&&a(n)?s=document.createTextNode(String(n)):s=D("e"),e.el=s),$e(l,s,t),le(u,s,null,t),Fe(e),r==="svg"&&(E.value=""),s},$e=(e,t,s)=>{const c=e.reduce((r,n)=>{if(n.type){const u=M(n,s);n.tag!=="portal"&&!s&&r.appendChild(u)}return r},_());!s&&t&&c.hasChildNodes()&&t.appendChild(c)},fe=(e,t,s,c)=>{const r=W(t);c!==s&&(c&&e.removeEventListener(r,c),s&&e.addEventListener(r,s))},Ge=(e,t,s)=>{const c={...t},r=s==null?void 0:s.style;r&&(N(e).forEach(([n,u])=>{r[n]=u,delete c[n]}),N(c).forEach(([n])=>r[n]=""))},L=e=>{const t=k(e.type);return e.isRoot&&t?e.wrapElement:t?L(y(e)):e.el},A=(e,t)=>Je(e,Pe[Ee(e)](e,t),t),Je=(e,t,s)=>{const c=ge(e,t,s),r=[c,t,s],n=Ye(...r),u=n==="N";return u||(c.children=me(...r)),c.needRerender=n,Xe(c,s,n),!u&&s&&(s.isLegacy=!0,delete s.children),c},Xe=(e,t,s)=>{s!=="A"&&t&&(e.el=t.el),s&&["D","R","SR"].includes(s)&&(t&&(U(t),F(t)),e.oldChildren=t==null?void 0:t.children),e.oldProps=t==null?void 0:t.props},Ye=(e,t,s)=>{const c=s&&s.type,r=H(e),n=e.isRoot,u=s&&y(s),l=!n&&(u==null?void 0:u.type),C=d(e),i=l==="loop"&&a(C),v=e.type==="text"&&t&&e.text===(s==null?void 0:s.text),j=e===s;let h;return r?h="D":v||j?h="N":c?t?h=i?"SU":"U":h=i?"SR":"R":h="A",e.type==="loop"&&h==="U"&&s&&Ze(e,s)&&(h="CNSU"),h},Ze=(e,t)=>{const s=[...(t==null?void 0:t.children)||[]],c=[...(e==null?void 0:e.children)||[]].filter(u=>s.find(l=>d(u)===d(l))),r=s.filter(u=>c.find(l=>d(u)===d(l)));let n=r.length===c.length;return n&&(n=r.every((u,l)=>d(u)===d(c[l]))),n},He=(e,t)=>{e&&t!==e&&(g(e).forEach(s=>delete e[s]),N(t||{}).forEach(([s,c])=>e[s]=c))},Ve=(e,t)=>{e&&t!==e&&(e.splice(0,e.length),t&&t.forEach(s=>e.push(s)))},Ke=(e,t)=>{const{compProps:s,compChild:c}=e,{props:r,children:n}=t;return s&&He(s,r),c&&Ve(c,n),e.reRender&&e.reRender()},ge=(e,t,s)=>b(e)?t&&s?Ke(s,e):e.resolve():e,me=(e,t,s)=>t&&s?We(e,s):we(e),we=e=>(e.children||[]).map(t=>x(A(t),{getParent:()=>e})),We=(e,t)=>e.type==="loop"&&a(d((e.children||[])[0]))?De(e,t):(e.children||[]).map((s,c)=>x(A(s,(t.children||[])[c]),{getParent:()=>e})),De=(e,t)=>{const[s,c]=et(e,t);return c.forEach(r=>{U(r),F(r),I(r)}),s},et=(e,t)=>{const s=[...e.children||[]],c=[...t.children||[]];return[s.map(n=>{const u=tt(n,c),l=A(n,u);return u&&c.splice(c.indexOf(u),1),l.getParent=()=>e,l}),c]},tt=(e,t)=>t.find(s=>d(s)===d(e)),J=new Map;let X=!1;const st=(e,t)=>{o.get(e)&&(o.get(e).up=()=>{J.set(e,t),X||(X=!0,queueMicrotask(ct))})},oe=e=>()=>{var c;const t=(c=o.get(e))==null?void 0:c.up;let s=!1;return t&&(t(),s=!0),s},ct=()=>{J.forEach(e=>{e()}),J.clear(),X=!1},nt=(e,t=()=>[])=>{o.get(S()).upR.push(()=>w(e,t)),w(e,t)},rt=()=>{var t;const e=(t=o.get(S()))==null?void 0:t.upR;e!=null&&e.length&&e.forEach(s=>s())},O=(e,...t)=>({type:"fragment",[R]:!0,children:t}),de=(e,t,...s)=>{const c={value:void 0},r=t||{},n=ie(c,s),u=ht(e,r,n);return b(u)||(c.value=u),u},ut=(e,t)=>de("portal",{portal:t},e),lt=e=>(t,s)=>e,ft=(e,t,s,c)=>{var v;if(c.isLegacy)return;Q.value=!0;const r=pe(e,t,s),n=A(r,c),{isRoot:u,getParent:l,wrapElement:C,afterElement:i}=c;if(n.getParent=l,!u&&l){const j=((v=l())==null?void 0:v.children)||[],h=j.indexOf(c);j.splice(h,1,n)}else n.isRoot=!0,n.wrapElement=C,n.afterElement=i;Q.value=!1,ee(n)},pe=(e,t,s)=>({tagName:e.name,ctor:e,props:t,children:s,resolve:(u=t)=>{Te(u);const l=e(t,s),i=(typeof l=="function"?l:()=>()=>l)(oe(u),t,s);return ot(i,u,e,t,s)}}),ot=(e,t,s,c,r)=>{let n=e,u=e(c);u.reRender&&(n=C=>{const i=e(C),v=O({},i);return i.getParent=()=>v,v},u=n(c));const l=dt(n,t,s,c,r);return he(u,t,s,c,r,l),u},dt=(e,t,s,c,r)=>{const n=()=>pt(e,t,s,c,r,n);return n},pt=(e,t,s,c,r,n)=>{Ne(t),rt();const u=e(c);return he(u,t,s,c,r,n),u},he=(e,t,s,c,r,n)=>{x(e,{compProps:c,compChild:r,ctor:s,tagName:s.name,compKey:t,reRender:n}),st(t,()=>ft(s,c,r,e)),K(t,"vd")&&(K(t,"vd").value=e)},ht=(e,t,s)=>{if(Z(e))return O(t,...s);if(b(e)){const c=pe(e,t,s);return Q.value?c:c.resolve()}return{type:"element",[R]:!0,tag:e,props:t,children:s}},ie=(e,t)=>t.map(s=>x(it(s),{getParent:()=>e.value})),it=e=>{if(e==null||e===!1)return{type:null,[R]:!0};if(Array.isArray(e)){const t={value:void 0},s=ie(t,e),c={type:"loop",[R]:!0,children:s};return t.value=c,c}else if(typeof e=="string"||typeof e=="number")return{type:"text",[R]:!0,text:e};return e},yt=e=>({value:e}),Ct=()=>Promise.resolve();f.Fragment=O,f.componentMap=o,f.componentUpdate=oe,f.h=de,f.isPropType=be,f.mount=lt,f.mountCallback=Me,f.nextTick=Ct,f.portal=ut,f.ref=yt,f.render=Qe,f.updateCallback=nt,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=lithent.umd.js.map
|
package/dist/lithent.umd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lithent.umd.js","sources":["../src/utils/predicator.ts","../src/utils/universalRef.ts","../src/utils/index.ts","../src/hook/unmount.ts","../src/hook/mountCallback.ts","../src/hook/useUpdate.ts","../src/render.ts","../src/diff.ts","../src/utils/redraw.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 WDomParam =\n | string\n | WDom\n | TagFunction\n | TagFunctionResolver\n | FragmentFunction;\n\n/**\n * Predicator\n */\n\nconst checkPlainWDomType = (wDom: WDomParam): wDom is WDom =>\n typeof wDom === 'object' && !('resolve' in wDom);\n\nconst checkPlainType = (wDom: WDomParam, typeName: string) =>\n checkPlainWDomType(wDom) && wDom.type === typeName;\n\nconst checkSameCustomComponent = (\n newWDom: WDom | TagFunction | TagFunctionResolver,\n originalWDom?: WDom\n) =>\n 'ctor' in newWDom\n ? newWDom.ctor === originalWDom?.ctor\n : newWDom === originalWDom?.ctor;\n\nconst checkSameFragment = (\n newWDom: WDom | TagFunction | TagFunctionResolver,\n originalWDom?: WDom\n) =>\n checkPlainWDomType(newWDom) &&\n originalWDom?.type === 'fragment' &&\n originalWDom?.children?.length === newWDom?.children?.length;\n\nconst checkSameTagElement = (\n newWDom: WDom | TagFunction | TagFunctionResolver,\n originalWDom?: WDom\n) =>\n checkPlainWDomType(newWDom) &&\n originalWDom?.type === 'element' &&\n originalWDom?.tag === newWDom.tag &&\n originalWDom?.children?.length === newWDom?.children?.length;\n\nconst checkNormalTypeElement = (\n newWDom: WDom | TagFunction | TagFunctionResolver,\n originalWDom?: WDom\n) => checkPlainWDomType(newWDom) && originalWDom?.type === newWDom.type;\n\nconst checkLoopTypeElement = (\n newWDom: WDom | TagFunction | TagFunctionResolver,\n originalWDom?: WDom\n) =>\n checkPlainWDomType(newWDom) &&\n originalWDom?.type === newWDom.type &&\n ((checkExisty(getKey((newWDom.children || [])[0])) &&\n checkExisty(getKey((originalWDom?.children || [])[0]))) ||\n originalWDom?.children?.length === newWDom?.children?.length);\n\nexport const getKey = (target: WDom) =>\n target?.compProps?.key ?? target?.props?.key;\n\nexport const checkVirtualType = (type?: string | null) =>\n type && ['fragment', 'loop'].includes(type);\n\nexport const checkCustemComponentFunction = (\n target: WDomParam\n): target is TagFunction | TagFunctionResolver =>\n (typeof target === 'function' && !checkFragmentFunction(target)) ||\n (typeof target === 'object' && 'resolve' in target);\n\nexport const checkFragmentFunction = (\n target: unknown\n): target is FragmentFunction =>\n typeof target === 'function' && target === Fragment;\n\nexport const checkEmptyElement = (wDom: WDomParam) =>\n checkPlainWDomType(wDom) && !wDom.type;\n\nexport const checkExisty = (value: unknown) =>\n value !== null && value !== undefined;\n\nexport const checkStyleData = (\n dataKey: string,\n dataValue: unknown\n): dataValue is Record<string, string> =>\n dataKey === 'style' && typeof dataValue === 'object';\n\nexport const checkRefData = (\n dataKey: string,\n dataValue: unknown\n): dataValue is {\n value: HTMLElement | Element | DocumentFragment | Text | undefined;\n} => dataKey === 'ref' && typeof dataValue === 'object';\n\nexport const hasAccessorMethods = (target: unknown, dataKey: string) => {\n const descriptor = Object.getOwnPropertyDescriptor(\n target!.constructor.prototype,\n dataKey\n );\n\n return descriptor && descriptor.get && descriptor.set;\n};\n\nexport const getWDomType = (\n wDom: WDom | TagFunction | TagFunctionResolver\n): WDomType => {\n let result: WDomType = 'et';\n\n if (checkCustemComponentFunction(wDom)) {\n result = 'c';\n } else if (checkPlainType(wDom, 'fragment')) {\n result = 'f';\n } else if (checkPlainType(wDom, 'element')) {\n result = 'e';\n } else if (checkPlainType(wDom, 'loop')) {\n result = 'l';\n } else if (checkPlainType(wDom, 'text')) {\n result = 't';\n } else if (checkEmptyElement(wDom)) {\n result = 'et';\n }\n\n return result;\n};\n\nexport const checkSameWDomWithOriginal = {\n c: checkSameCustomComponent,\n l: checkLoopTypeElement,\n t: checkNormalTypeElement,\n e: checkSameTagElement,\n f: checkSameFragment,\n et: checkNormalTypeElement,\n};\n","import { ComponentRef, ComponentSubKey, Props } from '@/types';\n\nexport const wdomSymbol = Symbol.for('lithentWDomSymbol');\nexport const xmlnsRef: { value: string } = { value: '' };\nexport const compKeyRef: { value: Props } = { value: {} };\nexport const needDiffRef: { value: boolean } = { value: false };\nexport const componentRef: ComponentRef = new WeakMap();\n\nconst setComponetRef = (compKey: Props) => {\n componentRef.set(compKey, {\n vd: { value: null },\n up: () => {},\n upR: [],\n upS: { value: 0 },\n upD: [],\n upCB: [],\n mts: [],\n umts: [],\n });\n};\n\nexport const getComponentKey = () => compKeyRef.value;\n\nexport const getComponentSubInfo = (\n compKey: Props,\n subKey: ComponentSubKey\n) => {\n if (componentRef.get(compKey)) {\n return componentRef.get(compKey)![subKey];\n }\n return null;\n};\n\nexport const initUpdateHookState = (compKey: Props) =>\n (compKeyRef.value = compKey);\n\nexport const initMountHookState = (compKey: Props) => {\n compKeyRef.value = compKey;\n setComponetRef(compKey);\n};\n","import { WDom, Props } from '@/types';\n\nimport { wdomSymbol } from '@/utils/universalRef';\n\nexport const getParent = (vDom: WDom) =>\n (vDom.getParent && vDom.getParent()) as WDom;\n\nexport const entries = Object.entries;\nexport const keys = Object.keys;\nexport const assign = Object.assign;\nexport const isPropType = (obj: unknown): obj is Props => {\n return (\n typeof obj === 'object' &&\n !Array.isArray(obj) &&\n !Object.getOwnPropertySymbols(obj).includes(wdomSymbol)\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 { compKey } = newWDom;\n\n if (compKey) {\n removeItem(compKey);\n }\n recursiveRunUnmount(newWDom);\n};\n\nconst recursiveRunUnmount = (wDom: WDom) => {\n (wDom.children || []).forEach(item => {\n const childComKey = item.compKey;\n if (childComKey) {\n runUnmountQueueFromWDom(item);\n } else {\n recursiveRunUnmount(item);\n }\n });\n};\n\nconst removeItem = (compKey: Props) => {\n const subInfo = componentRef.get(compKey);\n if (subInfo) {\n subInfo!.umts.forEach(effect => effect());\n subInfo!.umts = [];\n componentRef.delete(compKey);\n }\n};\n","import { WDom } from '@/types';\nimport {\n compKeyRef,\n componentRef,\n getComponentKey,\n} from '@/utils/universalRef';\nimport { unmount } from '@/hook/unmount';\n\nlet mountedQueue: WDom[] = [];\n\nexport const execMountedQueue = () => {\n mountedQueue.forEach(item => runMountedQueueFromWDom(item));\n mountedQueue = [];\n};\nexport const addMountedQueue = (wDom: WDom) => {\n if (wDom.compKey) {\n mountedQueue.push(wDom);\n }\n};\nexport const mountCallback = (effectAction: () => void) =>\n (componentRef.get(getComponentKey())?.mts || []).push(effectAction);\n\nexport const runMountedQueueFromWDom = (newWDom: WDom) => {\n const { compKey } = newWDom;\n\n if (compKey) {\n const component = componentRef.get(compKey);\n const queue = component?.mts;\n const sequence = component?.upS;\n\n compKeyRef.value = compKey;\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 compKeyRef,\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 { compKey } = newWDom;\n\n if (compKey) {\n const component = componentRef.get(compKey);\n const queue = component?.upCB;\n const sequence = component?.upS;\n\n compKeyRef.value = compKey;\n\n if (sequence) {\n sequence.value = 0;\n }\n\n if (newWDom.ctor && queue) {\n component.upCB = [];\n queue.forEach((effect: Function) => effect());\n }\n }\n};\n\nconst checkNeedPushQueue = (originalDefs: unknown[], newDefs: unknown[]) =>\n !originalDefs.length\n ? true\n : originalDefs.some((def, index) => def !== newDefs[index]);\n","import { WDom, Props } from '@/types';\nimport {\n checkStyleData,\n checkRefData,\n checkExisty,\n checkVirtualType,\n hasAccessorMethods,\n} from '@/utils/predicator';\n\nimport { componentRef, xmlnsRef } from '@/utils/universalRef';\nimport { runUnmountQueueFromWDom } from '@/hook/unmount';\nimport { execMountedQueue, addMountedQueue } from '@/hook/mountCallback';\nimport { runUpdatedQueueFromWDom } from '@/hook/useUpdate';\nimport { getParent, entries, keys } from '@/utils';\n\nconst getAttrKey = (keyName: string) =>\n keyName === 'className' ? 'class' : keyName;\n\nconst getEventName = (eventKey: string) =>\n eventKey.replace(/^on(.*)/, (_match, p1) => p1.toLowerCase());\n\nconst DF = () => new DocumentFragment();\nconst CE = (t: string) => document.createElement(t);\n\nexport const render = (\n wDom: WDom,\n wrapElement: HTMLElement | null,\n afterElement?: HTMLElement | null,\n isHydration?: boolean\n) => {\n wDom.isRoot = true;\n wrapElement ??= document.body;\n wDom.wrapElement = wrapElement;\n\n const Dom = wDomToDom(wDom, isHydration);\n\n if (afterElement) {\n wDom.afterElement = afterElement;\n wrapElement.insertBefore(Dom, afterElement);\n } else if (!isHydration) {\n if (wrapElement.tagName === 'HTML') {\n wrapElement.replaceWith(Dom);\n } else {\n wrapElement.appendChild(Dom);\n }\n }\n\n execMountedQueue();\n\n return () => {\n const component = componentRef.get(wDom.compProps || {})?.vd.value;\n\n if (component) {\n runUnmountQueueFromWDom(component);\n }\n\n recursiveRemoveEvent(component || wDom);\n rootDelete(component || wDom);\n };\n};\n\nexport const wDomUpdate = (newWDomTree: WDom) => {\n const { needRerender } = newWDomTree;\n\n if (needRerender && needRerender !== 'N') {\n ({\n A: typeAdd,\n D: typeDelete,\n R: typeReplace,\n U: typeUpdate,\n CNSU: typeUpdate,\n SR: typeSortedReplace,\n SU: typeSortedUpdate,\n })[needRerender](newWDomTree);\n\n delete newWDomTree.needRerender;\n delete newWDomTree.oldChildren;\n delete newWDomTree.oldProps;\n }\n};\n\nexport const recursiveRemoveEvent = (originalWDom: WDom) => {\n if (originalWDom.props && originalWDom.el) {\n removeEvent(originalWDom.props, originalWDom.el);\n }\n\n (originalWDom.children || []).forEach((childItem: WDom) => {\n recursiveRemoveEvent(childItem);\n });\n};\n\nconst rootDelete = (newWDom: WDom) => {\n deleteRealDom(newWDom, newWDom.wrapElement as HTMLElement);\n};\n\nexport const typeDelete = (newWDom: WDom) => {\n if (newWDom.oldProps && newWDom.el) {\n removeEvent(newWDom.oldProps, newWDom.el);\n }\n\n deleteRealDom(\n newWDom,\n findRealParentElement(getParent(newWDom)) as HTMLElement\n );\n};\n\nconst deleteRealDom = (newWDom: WDom, parent: HTMLElement) => {\n if (parent && newWDom.el) {\n if ([1, 3].includes(newWDom.el?.nodeType)) {\n parent.removeChild(newWDom.el);\n } else if (newWDom.el?.nodeType === 11) {\n findChildWithRemoveElement(newWDom, parent as HTMLElement);\n }\n delete newWDom.el;\n }\n};\n\nconst findChildWithRemoveElement = (newWDom: WDom, parent: HTMLElement) => {\n (newWDom?.oldChildren || newWDom?.children || []).forEach(item => {\n const nodeType = item.el?.nodeType;\n if (nodeType) {\n if ([1, 3].includes(nodeType)) {\n if ((item.el as HTMLElement).tagName === 'HTML') {\n (item.el as HTMLElement).innerHTML = '';\n } else {\n (item.el as HTMLElement).remove();\n }\n } else if (nodeType === 11) {\n findChildWithRemoveElement(item, parent);\n }\n }\n });\n};\n\nconst typeSortedReplace = (newWDom: WDom) => {\n typeDelete(newWDom);\n typeAdd(newWDom);\n};\n\nconst typeSortedUpdate = (newWDom: WDom) => {\n typeUpdate(newWDom);\n\n const parentWDom = getParent(newWDom);\n if (parentWDom.needRerender !== 'CNSU') {\n const newElement = getElementFromFragment(newWDom);\n\n typeAdd(newWDom, newElement);\n }\n};\n\nconst typeAdd = (\n newWDom: WDom,\n newElement?: HTMLElement | DocumentFragment | Text\n) => {\n if (!newElement) {\n newElement = wDomToDom(newWDom) as HTMLElement;\n }\n\n const parentWDom = getParent(newWDom);\n if (parentWDom.type) {\n const parentEl = findRealParentElement(parentWDom);\n const isLoop = parentWDom.type === 'loop';\n const nextEl =\n isLoop && parentWDom.needRerender && parentWDom.needRerender !== 'CNSU'\n ? startFindNextBrotherElement(parentWDom, getParent(parentWDom))\n : startFindNextBrotherElement(newWDom, parentWDom);\n\n if (newElement && parentEl) {\n if (newWDom.tag !== 'portal') {\n if (nextEl) {\n parentEl.insertBefore(newElement, nextEl);\n } else {\n parentEl.appendChild(newElement);\n }\n }\n\n execMountedQueue();\n }\n }\n};\n\nconst getElementFromFragment = (newWDom: WDom) => {\n if (checkVirtualType(newWDom.type)) {\n return (newWDom?.children || []).reduce((acc, item) => {\n const element = getElementFromFragment(item);\n\n if (element) {\n acc.appendChild(element);\n }\n return acc;\n }, DF());\n }\n\n return newWDom.el;\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 && checkVirtualType(parentType)) {\n return startFindNextBrotherElement(parentWDom, getParent(parentWDom));\n } else if (\n parentWDom.isRoot &&\n checkVirtualType(parentType) &&\n parentWDom.afterElement\n ) {\n return parentWDom.afterElement;\n }\n\n return undefined;\n};\n\nconst findChildFragmentNextElement = (\n candidiateBrothers: WDom[]\n): HTMLElement | DocumentFragment | Text | undefined =>\n candidiateBrothers.reduce(\n (\n targetEl: HTMLElement | DocumentFragment | Text | undefined,\n bItem: WDom\n ) => {\n const type = bItem.type;\n const el = bItem.el;\n const isFragment = type && checkVirtualType(type);\n\n if (targetEl) {\n return targetEl;\n } else if (isFragment) {\n return findChildFragmentNextElement(bItem.children || []);\n } else if (el && el.nodeType !== 11) {\n return el;\n }\n\n return targetEl;\n },\n undefined\n );\n\nconst typeReplace = (newWDom: WDom) => {\n const parentWDom = getParent(newWDom);\n const orignalElement = newWDom.el;\n\n if (parentWDom.type && orignalElement) {\n if (orignalElement.nodeType === 11) {\n typeSortedReplace(newWDom);\n } else {\n const parentElement = findRealParentElement(parentWDom);\n const newElement = wDomToDom(newWDom);\n\n if (parentElement && newWDom.tag !== 'portal') {\n parentElement.replaceChild(newElement, orignalElement);\n }\n execMountedQueue();\n }\n }\n};\n\nconst removeEvent = (\n oldProps: Props,\n element: HTMLElement | DocumentFragment | Text\n) => {\n entries(oldProps || {}).forEach(([dataKey, dataValue]: [string, unknown]) => {\n if (dataKey.match(/^on/)) {\n element.removeEventListener(\n getEventName(dataKey),\n dataValue as (e: Event) => void\n );\n }\n });\n};\n\nconst typeUpdate = (newWDom: WDom) => {\n const element = newWDom.el;\n\n if (newWDom.type === 'text') {\n updateText(newWDom);\n\n return;\n }\n\n if (element) {\n const { oldProps, props } = newWDom;\n\n updateProps(props, element, oldProps);\n\n delete newWDom.oldProps;\n\n if (newWDom.tag === 'input') {\n (element as HTMLInputElement).value = String(newWDom?.props?.value || '');\n }\n }\n\n (newWDom.children || []).forEach((childItem: WDom) => wDomUpdate(childItem));\n\n runUpdatedQueueFromWDom(newWDom);\n};\n\nconst updateText = (newWDom: WDom) => {\n const element = newWDom.el;\n\n if (element) {\n element.nodeValue = String(newWDom.text);\n }\n};\n\nconst updateProps = (\n props?: Props,\n element?: HTMLElement | Element | DocumentFragment | Text,\n oldProps?: Props | null,\n isHydration?: boolean\n) => {\n const originalProps = { ...oldProps };\n\n entries(props || {}).forEach(([dataKey, dataValue]: [string, unknown]) => {\n if (isHydration && dataKey.match(/^on/)) {\n updateEvent(\n element as HTMLElement,\n dataKey,\n dataValue as (e: Event) => void,\n originalProps[dataKey] as (e: Event) => void\n );\n } else {\n if (dataKey === 'key' || dataValue === originalProps[dataKey]) {\n // Do nothing\n } else if (dataKey === 'portal' && typeof dataValue === 'object') {\n // Do nothing\n } else if (dataKey === 'innerHTML' && typeof dataValue === 'string') {\n (element as HTMLElement).innerHTML = dataValue;\n } else if (checkStyleData(dataKey, dataValue)) {\n updateStyle(\n dataValue,\n checkStyleData(dataKey, originalProps.style)\n ? originalProps.style\n : {},\n element\n );\n } else if (checkRefData(dataKey, dataValue)) {\n dataValue.value = element;\n } else if (dataKey.match(/^on/)) {\n updateEvent(\n element as HTMLElement,\n dataKey,\n dataValue as (e: Event) => void,\n originalProps[dataKey] as (e: Event) => void\n );\n } else if (dataKey) {\n if (dataKey !== 'type' && hasAccessorMethods(element, dataKey)) {\n (element as { [key: string]: any })[dataKey] = dataValue;\n } else {\n setAttr(\n getAttrKey(dataKey),\n element as HTMLElement,\n dataValue as string\n );\n }\n }\n\n delete originalProps[dataKey];\n }\n });\n\n keys(originalProps).forEach(dataKey =>\n (element as HTMLElement).removeAttribute(dataKey)\n );\n};\n\nconst setAttr = (dataKey: string, element: HTMLElement, dataValue: string) => {\n if (xmlnsRef.value && dataKey !== 'xmlns') {\n element.setAttributeNS(null, dataKey, dataValue);\n } else {\n element.setAttribute(dataKey, dataValue);\n }\n};\n\nconst wDomToDom = (wDom: WDom, isHydration?: boolean): HTMLElement => {\n let element;\n const { type, tag, text, props, children = [] } = wDom;\n const isVirtualType = checkVirtualType(type);\n\n if (tag === 'svg') {\n xmlnsRef.value = String(props?.xmlns);\n }\n\n if (!isHydration) {\n if (isVirtualType) {\n element = DF();\n } else if (type === 'element' && tag) {\n if (tag === 'portal' && props?.portal) {\n element = props.portal as HTMLElement;\n } else {\n element = xmlnsRef.value\n ? document.createElementNS(xmlnsRef.value, tag)\n : CE(tag);\n }\n } else if (type === 'text' && checkExisty(text)) {\n element = document.createTextNode(String(text));\n } else {\n element = CE('e');\n }\n\n wDom.el = element as HTMLElement;\n } else {\n element = wDom.el;\n }\n\n wDomChildrenToDom(children, element, isHydration);\n\n updateProps(props, element, null, isHydration);\n\n addMountedQueue(wDom);\n\n if (tag === 'svg') {\n xmlnsRef.value = '';\n }\n\n return element as HTMLElement;\n};\n\nconst wDomChildrenToDom = (\n children: WDom[],\n parentElement?: HTMLElement | Element | DocumentFragment | Text,\n isHydration?: boolean\n) => {\n const elementChildren = children.reduce(\n (acc: DocumentFragment, childItem: WDom) => {\n if (childItem.type) {\n const childElement = wDomToDom(childItem, isHydration);\n\n if (childItem.tag !== 'portal' && !isHydration) {\n acc.appendChild(childElement);\n }\n }\n\n return acc;\n },\n DF()\n );\n\n if (!isHydration && parentElement && elementChildren.hasChildNodes()) {\n parentElement.appendChild(elementChildren);\n }\n};\n\nconst updateEvent = (\n element: HTMLElement,\n eventKey: string,\n newEventHandler: (e: Event) => void,\n oldEventHandler: (e: Event) => void\n) => {\n const eventName = getEventName(eventKey);\n\n if (oldEventHandler !== newEventHandler) {\n if (oldEventHandler) {\n element.removeEventListener(eventName, oldEventHandler);\n }\n\n if (newEventHandler) {\n element.addEventListener(eventName, newEventHandler);\n }\n }\n};\n\nconst updateStyle = (\n style: Record<string, string>,\n oldStyle: Record<string, string>,\n element?: HTMLElement | Element | DocumentFragment | Text\n) => {\n const originalStyle = { ...oldStyle };\n const elementStyle = (element as HTMLElement)?.style;\n\n if (elementStyle) {\n entries(style).forEach(([styleKey, dataValue]) => {\n (elementStyle as any)[styleKey] = dataValue;\n delete originalStyle[styleKey];\n });\n\n 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 = checkVirtualType(vDom.type);\n if (vDom.isRoot && isVirtualType) {\n return vDom.wrapElement;\n }\n\n if (!isVirtualType) {\n return vDom.el as HTMLElement;\n }\n\n return findRealParentElement(getParent(vDom));\n};\n","import { WDom, TagFunctionResolver, RenderType, Props } from '@/types';\nimport { checkCustemComponentFunction, getKey } from '@/utils/predicator';\nimport { getParent } from '@/utils';\nimport { typeDelete, recursiveRemoveEvent } from '@/render';\nimport {\n checkEmptyElement,\n checkSameWDomWithOriginal,\n getWDomType,\n checkExisty,\n} from '@/utils/predicator';\n\nimport { runUnmountQueueFromWDom } from '@/hook/unmount';\nimport { assign, keys, entries } from '@/utils';\n\n/**\n * The starting point of the diffing process between the original virtual DOM and the new virtual DOM for re-rendering.\n */\nexport const makeNewWDomTree = (\n newWDom: WDom | TagFunctionResolver,\n originalWDom?: WDom\n) =>\n remakeNewWDom(\n newWDom,\n checkSameWDomWithOriginal[getWDomType(newWDom)](newWDom, originalWDom),\n originalWDom\n );\n\n/**\n * Create a new virtual DOM after comparing with the previous virtual DOM\n */\nconst remakeNewWDom = (\n newWDom: WDom | TagFunctionResolver,\n isSameType: boolean,\n originalWDom?: WDom\n) => {\n const remakeWDom = generalize(newWDom, isSameType, originalWDom);\n const param: [newWDom: WDom, isSameType: boolean, originalWDom?: WDom] = [\n remakeWDom,\n isSameType,\n originalWDom,\n ];\n const needRerender = addReRenderTypeProperty(...param);\n const isNoting = needRerender === 'N';\n\n if (!isNoting) {\n remakeWDom.children = remakeChildrenForDiff(...param);\n }\n\n remakeWDom.needRerender = needRerender;\n inheritPropForRender(remakeWDom, originalWDom, needRerender);\n\n if (!isNoting && originalWDom) {\n originalWDom.isLegacy = true;\n delete originalWDom.children;\n }\n\n return remakeWDom;\n};\n\n/**\n * Handle what the new virtual DOM should inherit or reconcile from the original virtual DOM.\n */\nconst inheritPropForRender = (\n remakeWDom: WDom,\n originalWDom?: WDom,\n needRerender?: RenderType\n) => {\n if (needRerender !== 'A' && originalWDom) {\n remakeWDom.el = originalWDom.el;\n }\n\n if (needRerender && ['D', 'R', 'SR'].includes(needRerender)) {\n if (originalWDom) {\n runUnmountQueueFromWDom(originalWDom);\n recursiveRemoveEvent(originalWDom);\n }\n remakeWDom.oldChildren = originalWDom?.children;\n }\n\n remakeWDom.oldProps = originalWDom?.props;\n};\n\n/**\n * Indicate the state information for the new virtual DOM to be reflected in the real DOM.\n */\nconst addReRenderTypeProperty = (\n newWDom: WDom,\n isSameType: boolean,\n originalWDom?: WDom\n): RenderType | undefined => {\n const existOriginalWDom = originalWDom && originalWDom.type;\n const isEmptyElement = checkEmptyElement(newWDom);\n const isRoot = newWDom.isRoot;\n const originalParentWDom = originalWDom && getParent(originalWDom);\n const origParentType = !isRoot && originalParentWDom?.type;\n const key = getKey(newWDom);\n const isKeyCheckedWDom = origParentType === 'loop' && checkExisty(key);\n const isSameText =\n newWDom.type === 'text' &&\n isSameType &&\n newWDom.text === originalWDom?.text;\n const isSameWDom = newWDom === originalWDom;\n\n let result: RenderType | undefined;\n if (isEmptyElement) {\n result = 'D';\n } else if (isSameText || isSameWDom) {\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 if (\n newWDom.type === 'loop' &&\n result === 'U' &&\n originalWDom &&\n chkDiffLoopOrder(newWDom, originalWDom)\n ) {\n result = 'CNSU';\n }\n\n return result;\n};\n\n/**\n * Check if a reverse order swap is needed when updating types that require reordering.\n */\nconst chkDiffLoopOrder = (newWDom: WDom, originalWDom: WDom) => {\n const origChildren = [...(originalWDom?.children || [])];\n const newChildren = [...(newWDom?.children || [])].filter(item =>\n origChildren.find(newItem => getKey(item) === getKey(newItem))\n );\n const filteredChildren = origChildren.filter(item =>\n newChildren.find(newItem => getKey(item) === getKey(newItem))\n );\n let isSame = filteredChildren.length === newChildren.length;\n\n if (isSame) {\n isSame = filteredChildren.every(\n (item, index) => getKey(item) === getKey(newChildren[index])\n );\n }\n\n return isSame;\n};\n\n/**\n * Handling virtual DOM attribute updates.\n */\nconst updateProps = (props: Props, infoProps: Props) => {\n if (props && infoProps !== props) {\n keys(props).forEach(key => delete props[key]);\n\n entries(infoProps || {}).forEach(([key, value]) => (props[key] = value));\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\n/**\n * Start handling when the virtual DOM is updated rather than completely replaced with a new type.\n * (Reflect the state of props or children to ensure the new state is applied)\n * (Handle the reflection of the new state while ensuring that the actual references of props or children are not changed)\n */\nconst runUpdate = (vDom: WDom, infoVdom: TagFunctionResolver) => {\n const { compProps: props, compChild: children } = vDom;\n const { props: infoProps, children: infoChidren } = infoVdom;\n\n if (props) {\n updateProps(props, infoProps);\n }\n\n if (children) {\n updateChildren(children, infoChidren);\n }\n\n const newVDom = vDom.reRender && vDom.reRender();\n\n return newVDom as WDom;\n};\n\n/**\n * Replace the compared virtual DOM with the new virtual DOM or simply update it.\n */\nconst generalize = (\n newWDom: WDom | TagFunctionResolver,\n isSameType: boolean,\n originalWDom?: WDom\n): WDom => {\n if (checkCustemComponentFunction(newWDom)) {\n return isSameType && originalWDom\n ? runUpdate(originalWDom, newWDom)\n : newWDom.resolve();\n }\n\n return newWDom;\n};\n\n/**\n * 자식 가상돔들도 전부 재귀처리하며 똑같은 처리를 해준다.\n */\nconst remakeChildrenForDiff = (\n newWDom: WDom,\n isSameType: boolean,\n originalWDom?: WDom\n) =>\n isSameType && originalWDom\n ? remakeChildrenForUpdate(newWDom, originalWDom)\n : remakeChildrenForAdd(newWDom);\n\n/**\n * Recursive handling for the creation of a new virtual DOM.\n */\nconst remakeChildrenForAdd = (newWDom: WDom) =>\n (newWDom.children || []).map((item: WDom) =>\n assign(makeNewWDomTree(item), { getParent: () => newWDom })\n );\n\n/**\n * Recursive handling for updates, not additions.\n */\nconst remakeChildrenForUpdate = (newWDom: WDom, originalWDom: WDom) =>\n newWDom.type === 'loop' && checkExisty(getKey((newWDom.children || [])[0]))\n ? remakeChildrenForLoopUpdate(newWDom, originalWDom)\n : (newWDom.children || []).map((item: WDom, index: number) =>\n assign(makeNewWDomTree(item, (originalWDom.children || [])[index]), {\n getParent: () => newWDom,\n })\n );\n\n/**\n * Handling virtual DOM of loop-type elements.\n */\nconst remakeChildrenForLoopUpdate = (newWDom: WDom, originalWDom: WDom) => {\n const [remakedChildren, unUsedChildren] = diffLoopChildren(\n newWDom,\n originalWDom\n );\n\n unUsedChildren.forEach(unusedItem => {\n runUnmountQueueFromWDom(unusedItem);\n recursiveRemoveEvent(unusedItem);\n typeDelete(unusedItem);\n });\n\n return remakedChildren;\n};\n\n/**\n * Recursive handling of loop-type virtual DOM elements.\n */\nconst diffLoopChildren = (newWDom: WDom, originalWDom: WDom) => {\n const newChildren = [...(newWDom.children || [])];\n const originalChildren = [...(originalWDom.children || [])];\n const remakedChildren = newChildren.map(item => {\n const originalItem = findSameKeyOriginalItem(item, originalChildren);\n const childItem = makeNewWDomTree(item, originalItem);\n\n if (originalItem) {\n originalChildren.splice(originalChildren.indexOf(originalItem), 1);\n }\n\n childItem.getParent = () => newWDom;\n\n return childItem;\n });\n\n return [remakedChildren, originalChildren];\n};\n\n/**\n * When comparing loop-type virtual DOM elements, use the key to determine the comparison\n */\nconst findSameKeyOriginalItem = (item: WDom, originalChildren: WDom[]) =>\n originalChildren.find(\n orignalChildItem => getKey(orignalChildItem) === getKey(item)\n );\n","import { Props } from '@/types';\nimport { componentRef } from '@/utils/universalRef';\n\nconst redrawQueue = new Map<Props, () => void>();\nlet redrawQueueTimeout: boolean = false;\n\nexport const setRedrawAction = (compKey: Props, exec: () => void) => {\n if (componentRef.get(compKey)) {\n componentRef.get(compKey)!.up = () => {\n redrawQueue.set(compKey, exec);\n\n if (!redrawQueueTimeout) {\n redrawQueueTimeout = true;\n queueMicrotask(execRedrawQueue);\n }\n };\n }\n};\n\nexport const componentUpdate = (compKey: Props) => () => {\n const up = componentRef.get(compKey)?.up;\n let result = false;\n if (up) {\n up();\n result = true;\n }\n\n return result;\n};\n\nconst execRedrawQueue = () => {\n redrawQueue.forEach((item: () => void) => {\n item();\n });\n\n redrawQueue.clear();\n redrawQueueTimeout = false;\n};\n","import { componentRef, getComponentKey } 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","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 needDiffRef,\n getComponentSubInfo,\n wdomSymbol,\n} from '@/utils/universalRef';\nimport { setRedrawAction, componentUpdate } from '@/utils/redraw';\nimport { runUpdateCallback } from '@/hook/updateCallback';\nimport {\n checkFragmentFunction,\n checkCustemComponentFunction,\n} from '@/utils/predicator';\nimport { assign } from '@/utils';\n\n/**\n * It allows grouping multiple elements together.\n */\nexport const Fragment = (_props: Props, ...children: WDom[]) =>\n ({\n type: 'fragment',\n [wdomSymbol]: true,\n children,\n }) as WDom;\n\n/**\n * Element creation\n */\nexport const h = (\n tag: TagFunction | FragmentFunction | string,\n props: Props,\n ...children: MiddleStateWDomChildren\n) => {\n const nodeParentPointer: NodePointer = { value: undefined };\n const newProps = props || {};\n const newChildren = remakeChildren(nodeParentPointer, children);\n const node = makeNode(tag, newProps, newChildren);\n\n if (!checkCustemComponentFunction(node)) {\n nodeParentPointer.value = node;\n }\n\n return node;\n};\n\n/**\n * Enables portals\n */\nexport const portal = (wDom: WDom, portal: HTMLElement) => {\n return h('portal', { portal }, wDom);\n};\n\n/**\n * It helps with component creation.\n */\nexport const mount =\n <T>(component: Component<T>) =>\n (_props: T, _children?: MiddleStateWDomChildren) =>\n component;\n\n/**\n * It re-renders starting from a specific component.\n */\nconst reRenderCustomComponent = (\n tag: TagFunction,\n props: Props,\n children: WDom[],\n originalWDom: WDom\n) => {\n if (originalWDom.isLegacy) {\n return;\n }\n needDiffRef.value = true;\n\n const newWDom = makeWDomResolver(tag, props, children);\n const newWDomTree = makeNewWDomTree(newWDom, originalWDom);\n const { isRoot, getParent, wrapElement, afterElement } = originalWDom;\n\n newWDomTree.getParent = getParent;\n\n if (!isRoot && getParent) {\n const brothers = getParent()?.children || [];\n const index = brothers.indexOf(originalWDom);\n\n brothers.splice(index, 1, newWDomTree);\n } else {\n newWDomTree.isRoot = true;\n newWDomTree.wrapElement = wrapElement;\n newWDomTree.afterElement = afterElement;\n }\n\n needDiffRef.value = false;\n\n wDomUpdate(newWDomTree);\n};\n\n/**\n * Create an intermediate step for diffing between the existing virtual DOM and the new one during re-rendering\n */\nconst makeWDomResolver = (tag: TagFunction, props: Props, children: WDom[]) => {\n const tagName = tag.name;\n const ctor = tag;\n // 리졸브는 컴포넌트를 새로 만든다.\n const resolve = (compKey = props) => {\n initMountHookState(compKey);\n\n const initialComponent = tag(props, children);\n const component =\n typeof initialComponent === 'function'\n ? initialComponent\n : () => () => initialComponent;\n const componentMaker = component(componentUpdate(compKey), props, children);\n\n const customNode = makeCustomNode(\n componentMaker,\n compKey,\n tag,\n props,\n children\n );\n\n return customNode;\n };\n\n return { tagName, ctor, props, children, resolve };\n};\n\n/**\n * Create the actual virtual DOM node from the component.\n */\nconst makeCustomNode = (\n componentMaker: (props: Props) => WDom,\n compKey: Props,\n tag: TagFunction,\n props: Props,\n children: WDom[]\n) => {\n let newCustomComponentMaker = componentMaker;\n let customNode = componentMaker(props);\n\n if (customNode.reRender) {\n newCustomComponentMaker = (newProps: Props): WDom => {\n const customNode = componentMaker(newProps);\n const newNode = Fragment({}, customNode);\n\n customNode.getParent = () => newNode;\n\n return newNode;\n };\n\n customNode = newCustomComponentMaker(props);\n }\n\n const reRender = makeReRender(\n newCustomComponentMaker,\n compKey,\n tag,\n props,\n children\n );\n\n addComponentProps(customNode, compKey, tag, props, children, reRender);\n\n return customNode;\n};\n\n/**\n * When the virtual DOM is actually created from the component, generate a re-render method for future redraws.\n */\nconst makeReRender = (\n componentMaker: (props: Props) => WDom,\n compKey: Props,\n tag: TagFunction,\n props: Props,\n children: WDom[]\n) => {\n const reRender = () =>\n wDomMaker(componentMaker, compKey, tag, props, children, reRender);\n return reRender;\n};\n\n/**\n * The starting point for redrawing from the re-render method\n */\nconst wDomMaker = (\n componentMaker: (props: Props) => WDom,\n compKey: Props,\n tag: TagFunction,\n props: Props,\n children: WDom[],\n reRender: () => WDom\n) => {\n initUpdateHookState(compKey);\n runUpdateCallback();\n\n const customNode = componentMaker(props);\n\n addComponentProps(customNode, compKey, tag, props, children, reRender);\n\n return customNode;\n};\n\n/**\n * When creating a custom component node, attach additional information attributes to the virtual DOM object.\n */\nconst addComponentProps = (\n wDom: WDom,\n compKey: Props,\n tag: TagFunction,\n props: Props,\n children: WDom[],\n reRender: () => WDom\n) => {\n assign(wDom, {\n compProps: props,\n compChild: children,\n ctor: tag,\n tagName: tag.name,\n compKey,\n reRender,\n });\n\n setRedrawAction(compKey, () =>\n reRenderCustomComponent(tag, props, children, wDom)\n );\n\n if (getComponentSubInfo(compKey, 'vd')) {\n (getComponentSubInfo(compKey, 'vd') as { value: WDom }).value = wDom;\n }\n};\n\n/**\n * The starting point where the virtual DOM is created from the h function.\n */\nconst makeNode = (\n tag: TagFunction | FragmentFunction | string,\n props: Props,\n children: WDom[]\n) => {\n if (checkFragmentFunction(tag)) {\n return Fragment(props, ...children);\n } else if (checkCustemComponentFunction(tag)) {\n const componetMakeResolver = makeWDomResolver(tag, props, children);\n\n return needDiffRef.value\n ? componetMakeResolver\n : componetMakeResolver.resolve();\n }\n\n return {\n type: 'element',\n [wdomSymbol]: true,\n tag,\n props,\n children,\n } as WDom;\n};\n\n/**\n * The starting point for recursively processing the child virtual DOM elements.\n */\nconst remakeChildren = (\n nodeParentPointer: NodePointer,\n children: MiddleStateWDomChildren\n): WDom[] =>\n children.map((item: MiddleStateWDom) =>\n assign(makeChildrenItem(item), { getParent: () => nodeParentPointer.value })\n );\n\n/**\n * Recursively process the child virtual DOM elements.\n */\nconst makeChildrenItem = (item: MiddleStateWDom): WDom => {\n if (item === null || item === undefined || item === false) {\n return { type: null, [wdomSymbol]: true } as WDom;\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 [wdomSymbol]: true,\n children,\n } as WDom;\n nodeParentPointer.value = node;\n\n return node;\n } else if (typeof item === 'string' || typeof item === 'number') {\n return { type: 'text', [wdomSymbol]: true, text: item } as WDom;\n }\n\n return item;\n};\n","export const ref = <T>(initValue: T) => ({ value: initValue });\nexport const nextTick = () => Promise.resolve();\n"],"names":["checkPlainWDomType","wDom","checkPlainType","typeName","checkSameCustomComponent","newWDom","originalWDom","checkSameFragment","_a","_b","checkSameTagElement","checkNormalTypeElement","checkLoopTypeElement","checkExisty","getKey","target","checkVirtualType","type","checkCustemComponentFunction","checkFragmentFunction","Fragment","checkEmptyElement","value","checkStyleData","dataKey","dataValue","checkRefData","hasAccessorMethods","descriptor","getWDomType","result","checkSameWDomWithOriginal","wdomSymbol","xmlnsRef","compKeyRef","needDiffRef","componentRef","setComponetRef","compKey","getComponentKey","getComponentSubInfo","subKey","initUpdateHookState","initMountHookState","getParent","vDom","entries","keys","assign","isPropType","obj","unmount","effectAction","runUnmountQueueFromWDom","removeItem","recursiveRunUnmount","item","subInfo","effect","mountedQueue","execMountedQueue","runMountedQueueFromWDom","addMountedQueue","mountCallback","component","queue","sequence","callback","useUpdated","dependencies","upD","upS","def","checkNeedPushQueue","runUpdatedQueueFromWDom","originalDefs","newDefs","index","getAttrKey","keyName","getEventName","eventKey","_match","p1","DF","CE","t","render","wrapElement","afterElement","isHydration","Dom","wDomToDom","recursiveRemoveEvent","rootDelete","wDomUpdate","newWDomTree","needRerender","typeAdd","typeDelete","typeReplace","typeUpdate","typeSortedReplace","typeSortedUpdate","removeEvent","childItem","deleteRealDom","findRealParentElement","parent","findChildWithRemoveElement","nodeType","newElement","getElementFromFragment","parentWDom","parentEl","nextEl","startFindNextBrotherElement","acc","element","brothers","nextIndex","candidiateBrothers","finedNextEl","findChildFragmentNextElement","parentType","targetEl","bItem","el","isFragment","orignalElement","parentElement","oldProps","updateText","props","updateProps","originalProps","updateEvent","updateStyle","setAttr","tag","text","children","isVirtualType","wDomChildrenToDom","elementChildren","childElement","newEventHandler","oldEventHandler","eventName","style","oldStyle","originalStyle","elementStyle","styleKey","makeNewWDomTree","remakeNewWDom","isSameType","remakeWDom","generalize","param","addReRenderTypeProperty","isNoting","remakeChildrenForDiff","inheritPropForRender","existOriginalWDom","isEmptyElement","isRoot","originalParentWDom","origParentType","key","isKeyCheckedWDom","isSameText","isSameWDom","chkDiffLoopOrder","origChildren","newChildren","newItem","filteredChildren","isSame","infoProps","updateChildren","infoChidren","childrenItem","runUpdate","infoVdom","remakeChildrenForUpdate","remakeChildrenForAdd","remakeChildrenForLoopUpdate","remakedChildren","unUsedChildren","diffLoopChildren","unusedItem","originalChildren","originalItem","findSameKeyOriginalItem","orignalChildItem","redrawQueue","redrawQueueTimeout","setRedrawAction","exec","execRedrawQueue","componentUpdate","up","updateCallback","runUpdateCallback","updateReqs","_props","h","nodeParentPointer","newProps","remakeChildren","node","makeNode","portal","mount","_children","reRenderCustomComponent","makeWDomResolver","initialComponent","componentMaker","makeCustomNode","newCustomComponentMaker","customNode","newNode","reRender","makeReRender","addComponentProps","wDomMaker","componetMakeResolver","makeChildrenItem","ref","initValue","nextTick"],"mappings":"+NAoBA,MAAMA,EAAsBC,GAC1B,OAAOA,GAAS,UAAY,EAAE,YAAaA,GAEvCC,EAAiB,CAACD,EAAiBE,IACvCH,EAAmBC,CAAI,GAAKA,EAAK,OAASE,EAEtCC,GAA2B,CAC/BC,EACAC,IAEA,SAAUD,EACNA,EAAQ,QAASC,GAAA,YAAAA,EAAc,MAC/BD,KAAYC,GAAA,YAAAA,EAAc,MAE1BC,GAAoB,CACxBF,EACAC,IAEA,SAAA,OAAAN,EAAmBK,CAAO,IAC1BC,GAAA,YAAAA,EAAc,QAAS,cACvBE,EAAAF,GAAA,YAAAA,EAAc,WAAd,YAAAE,EAAwB,YAAWC,EAAAJ,GAAA,YAAAA,EAAS,WAAT,YAAAI,EAAmB,SAElDC,GAAsB,CAC1BL,EACAC,IAEA,SAAA,OAAAN,EAAmBK,CAAO,IAC1BC,GAAA,YAAAA,EAAc,QAAS,YACvBA,GAAA,YAAAA,EAAc,OAAQD,EAAQ,OAC9BG,EAAAF,GAAA,YAAAA,EAAc,WAAd,YAAAE,EAAwB,YAAWC,EAAAJ,GAAA,YAAAA,EAAS,WAAT,YAAAI,EAAmB,SAElDE,EAAyB,CAC7BN,EACAC,IACGN,EAAmBK,CAAO,IAAKC,GAAA,YAAAA,EAAc,QAASD,EAAQ,KAE7DO,GAAuB,CAC3BP,EACAC,IAEA,SAAA,OAAAN,EAAmBK,CAAO,IAC1BC,GAAA,YAAAA,EAAc,QAASD,EAAQ,OAC7BQ,EAAYC,GAAQT,EAAQ,UAAY,IAAI,CAAC,CAAC,CAAC,GAC/CQ,EAAYC,IAAQR,GAAA,YAAAA,EAAc,WAAY,CAAA,GAAI,CAAC,CAAC,CAAC,KACrDE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,CAAU,EAAG,GACd,IAAA2G,EACA,MAAAN,EACA,SAAAQ,CAAA,CAEJ,EAKMqE,GAAiB,CACrBF,EACAnE,IAEAA,EAAS,IAAKrF,GACZR,EAAOqL,GAAiB7K,CAAI,EAAG,CAAE,UAAW,IAAMwJ,EAAkB,MAAO,CAC7E,EAKIqB,GAAoB7K,GAAgC,CACxD,GAAIA,GAAS,MAA8BA,IAAS,GAClD,MAAO,CAAE,KAAM,KAAM,CAACxB,CAAU,EAAG,EAAK,EAC/B,GAAA,MAAM,QAAQwB,CAAI,EAAG,CACxB,MAAAwJ,EAAiC,CAAE,MAAO,MAAU,EACpDnE,EAAWqE,GAAeF,EAAmBxJ,CAAI,EACjD2J,EAAO,CACX,KAAM,OACN,CAACnL,CAAU,EAAG,GACd,SAAA6G,CAAA,EAEF,OAAAmE,EAAkB,MAAQG,EAEnBA,UACE,OAAO3J,GAAS,UAAY,OAAOA,GAAS,SAC9C,MAAA,CAAE,KAAM,OAAQ,CAACxB,CAAU,EAAG,GAAM,KAAMwB,GAG5C,OAAAA,CACT,EChTa8K,GAAUC,IAAkB,CAAE,MAAOA,CAAU,GAC/CC,GAAW,IAAM,QAAQ,QAAQ"}
|
|
1
|
+
{"version":3,"file":"lithent.umd.js","sources":["../src/utils/predicator.ts","../src/utils/universalRef.ts","../src/utils/index.ts","../src/hook/unmount.ts","../src/hook/mountCallback.ts","../src/hook/useUpdate.ts","../src/render.ts","../src/diff.ts","../src/utils/redraw.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 WDomParam =\n | string\n | WDom\n | TagFunction\n | TagFunctionResolver\n | FragmentFunction;\n\n/**\n * Predicator\n */\n\nconst checkPlainWDomType = (wDom: WDomParam): wDom is WDom =>\n typeof wDom === 'object' && !('resolve' in wDom);\n\nconst checkPlainType = (wDom: WDomParam, typeName: string) =>\n checkPlainWDomType(wDom) && wDom.type === typeName;\n\nconst checkSameCustomComponent = (\n newWDom: WDom | TagFunction | TagFunctionResolver,\n originalWDom?: WDom\n) =>\n 'ctor' in newWDom\n ? newWDom.ctor === originalWDom?.ctor\n : newWDom === originalWDom?.ctor;\n\nconst checkSameFragment = (\n newWDom: WDom | TagFunction | TagFunctionResolver,\n originalWDom?: WDom\n) =>\n checkPlainWDomType(newWDom) &&\n originalWDom?.type === 'fragment' &&\n originalWDom?.children?.length === newWDom?.children?.length;\n\nconst checkSameTagElement = (\n newWDom: WDom | TagFunction | TagFunctionResolver,\n originalWDom?: WDom\n) =>\n checkPlainWDomType(newWDom) &&\n originalWDom?.type === 'element' &&\n originalWDom?.tag === newWDom.tag &&\n originalWDom?.children?.length === newWDom?.children?.length;\n\nconst checkNormalTypeElement = (\n newWDom: WDom | TagFunction | TagFunctionResolver,\n originalWDom?: WDom\n) => checkPlainWDomType(newWDom) && originalWDom?.type === newWDom.type;\n\nconst checkLoopTypeElement = (\n newWDom: WDom | TagFunction | TagFunctionResolver,\n originalWDom?: WDom\n) =>\n checkPlainWDomType(newWDom) &&\n originalWDom?.type === newWDom.type &&\n ((checkExisty(getKey((newWDom.children || [])[0])) &&\n checkExisty(getKey((originalWDom?.children || [])[0]))) ||\n originalWDom?.children?.length === newWDom?.children?.length);\n\nexport const getKey = (target: WDom) =>\n target?.compProps?.key ?? target?.props?.key;\n\nexport const checkVirtualType = (type?: string | null) =>\n type && ['fragment', 'loop'].includes(type);\n\nexport const checkCustemComponentFunction = (\n target: WDomParam\n): target is TagFunction | TagFunctionResolver =>\n (typeof target === 'function' && !checkFragmentFunction(target)) ||\n (typeof target === 'object' && 'resolve' in target);\n\nexport const checkFragmentFunction = (\n target: unknown\n): target is FragmentFunction =>\n typeof target === 'function' && target === Fragment;\n\nexport const checkEmptyElement = (wDom: WDomParam) =>\n checkPlainWDomType(wDom) && !wDom.type;\n\nexport const checkExisty = (value: unknown) =>\n value !== null && value !== undefined;\n\nexport const checkStyleData = (\n dataKey: string,\n dataValue: unknown\n): dataValue is Record<string, string> =>\n dataKey === 'style' && typeof dataValue === 'object';\n\nexport const checkRefData = (\n dataKey: string,\n dataValue: unknown\n): dataValue is {\n value: HTMLElement | Element | DocumentFragment | Text | undefined;\n} => dataKey === 'ref' && typeof dataValue === 'object';\n\nexport const hasAccessorMethods = (target: unknown, dataKey: string) => {\n const descriptor = Object.getOwnPropertyDescriptor(\n target!.constructor.prototype,\n dataKey\n );\n\n return descriptor && descriptor.get && descriptor.set;\n};\n\nexport const getWDomType = (\n wDom: WDom | TagFunction | TagFunctionResolver\n): WDomType => {\n let result: WDomType = 'et';\n\n if (checkCustemComponentFunction(wDom)) {\n result = 'c';\n } else if (checkPlainType(wDom, 'fragment')) {\n result = 'f';\n } else if (checkPlainType(wDom, 'element')) {\n result = 'e';\n } else if (checkPlainType(wDom, 'loop')) {\n result = 'l';\n } else if (checkPlainType(wDom, 'text')) {\n result = 't';\n } else if (checkEmptyElement(wDom)) {\n result = 'et';\n }\n\n return result;\n};\n\nexport const checkSameWDomWithOriginal = {\n c: checkSameCustomComponent,\n l: checkLoopTypeElement,\n t: checkNormalTypeElement,\n e: checkSameTagElement,\n f: checkSameFragment,\n et: checkNormalTypeElement,\n};\n","import { ComponentMap, ComponentSubKey, Props } from '@/types';\n\nexport const wdomSymbol = Symbol.for('lithentWDomSymbol');\nexport const xmlnsRef: { value: string } = { value: '' };\nexport const compKeyRef: { value: Props } = { value: {} };\nexport const needDiffRef: { value: boolean } = { value: false };\nexport const componentMap: ComponentMap = new WeakMap();\n\nconst setComponetRef = (compKey: Props) => {\n componentMap.set(compKey, {\n vd: { value: null },\n up: () => {},\n upR: [],\n upS: { value: 0 },\n upD: [],\n upCB: [],\n mts: [],\n umts: [],\n });\n};\n\nexport const getComponentKey = () => compKeyRef.value;\n\nexport const getComponentSubInfo = (\n compKey: Props,\n subKey: ComponentSubKey\n) => {\n if (componentMap.get(compKey)) {\n return componentMap.get(compKey)![subKey];\n }\n return null;\n};\n\nexport const initUpdateHookState = (compKey: Props) =>\n (compKeyRef.value = compKey);\n\nexport const initMountHookState = (compKey: Props) => {\n compKeyRef.value = compKey;\n setComponetRef(compKey);\n};\n","import { WDom, Props } from '@/types';\n\nimport { wdomSymbol } from '@/utils/universalRef';\n\nexport const getParent = (vDom: WDom) =>\n (vDom.getParent && vDom.getParent()) as WDom;\n\nexport const entries = Object.entries;\nexport const keys = Object.keys;\nexport const assign = Object.assign;\nexport const isPropType = (obj: unknown): obj is Props => {\n return (\n typeof obj === 'object' &&\n !Array.isArray(obj) &&\n !Object.getOwnPropertySymbols(obj).includes(wdomSymbol)\n );\n};\n","import { WDom, Props } from '@/types';\nimport { componentMap, getComponentKey } from '@/utils/universalRef';\n\nexport const unmount = (effectAction: () => void) => {\n componentMap.get(getComponentKey())!.umts.push(effectAction);\n};\n\nexport const runUnmountQueueFromWDom = (newWDom: WDom) => {\n const { compKey } = newWDom;\n\n if (compKey) {\n removeItem(compKey);\n }\n recursiveRunUnmount(newWDom);\n};\n\nconst recursiveRunUnmount = (wDom: WDom) => {\n (wDom.children || []).forEach(item => {\n const childComKey = item.compKey;\n if (childComKey) {\n runUnmountQueueFromWDom(item);\n } else {\n recursiveRunUnmount(item);\n }\n });\n};\n\nconst removeItem = (compKey: Props) => {\n const subInfo = componentMap.get(compKey);\n if (subInfo) {\n subInfo!.umts.forEach(effect => effect());\n subInfo!.umts = [];\n componentMap.delete(compKey);\n }\n};\n","import { WDom } from '@/types';\nimport {\n compKeyRef,\n componentMap,\n getComponentKey,\n} from '@/utils/universalRef';\nimport { unmount } from '@/hook/unmount';\n\nlet mountedQueue: WDom[] = [];\n\nexport const execMountedQueue = () => {\n mountedQueue.forEach(item => runMountedQueueFromWDom(item));\n mountedQueue = [];\n};\nexport const addMountedQueue = (wDom: WDom) => {\n if (wDom.compKey) {\n mountedQueue.push(wDom);\n }\n};\nexport const mountCallback = (effectAction: () => void) =>\n (componentMap.get(getComponentKey())?.mts || []).push(effectAction);\n\nexport const runMountedQueueFromWDom = (newWDom: WDom) => {\n const { compKey } = newWDom;\n\n if (compKey) {\n const component = componentMap.get(compKey);\n const queue = component?.mts;\n const sequence = component?.upS;\n\n compKeyRef.value = compKey;\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 compKeyRef,\n componentMap,\n getComponentKey,\n} from '@/utils/universalRef';\n\nexport const useUpdated = (\n effectAction: () => (() => void) | void,\n dependencies: () => any[] = () => []\n) => {\n const component = componentMap.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 { compKey } = newWDom;\n\n if (compKey) {\n const component = componentMap.get(compKey);\n const queue = component?.upCB;\n const sequence = component?.upS;\n\n compKeyRef.value = compKey;\n\n if (sequence) {\n sequence.value = 0;\n }\n\n if (newWDom.ctor && queue) {\n component.upCB = [];\n queue.forEach((effect: Function) => effect());\n }\n }\n};\n\nconst checkNeedPushQueue = (originalDefs: unknown[], newDefs: unknown[]) =>\n !originalDefs.length\n ? true\n : originalDefs.some((def, index) => def !== newDefs[index]);\n","import { WDom, Props } from '@/types';\nimport {\n checkStyleData,\n checkRefData,\n checkExisty,\n checkVirtualType,\n hasAccessorMethods,\n} from '@/utils/predicator';\n\nimport { componentMap, xmlnsRef } from '@/utils/universalRef';\nimport { runUnmountQueueFromWDom } from '@/hook/unmount';\nimport { execMountedQueue, addMountedQueue } from '@/hook/mountCallback';\nimport { runUpdatedQueueFromWDom } from '@/hook/useUpdate';\nimport { getParent, entries, keys } from '@/utils';\n\nconst getAttrKey = (keyName: string) =>\n keyName === 'className' ? 'class' : keyName;\n\nconst getEventName = (eventKey: string) =>\n eventKey.replace(/^on(.*)/, (_match, p1) => p1.toLowerCase());\n\nconst DF = () => new DocumentFragment();\nconst CE = (t: string) => document.createElement(t);\n\nexport const render = (\n wDom: WDom,\n wrapElement: HTMLElement | null,\n afterElement?: HTMLElement | null,\n isHydration?: boolean\n) => {\n wDom.isRoot = true;\n wrapElement ??= document.body;\n wDom.wrapElement = wrapElement;\n\n const Dom = wDomToDom(wDom, isHydration);\n\n if (afterElement) {\n wDom.afterElement = afterElement;\n wrapElement.insertBefore(Dom, afterElement);\n } else if (!isHydration) {\n if (wrapElement.tagName === 'HTML') {\n wrapElement.replaceWith(Dom);\n } else {\n wrapElement.appendChild(Dom);\n }\n }\n\n execMountedQueue();\n\n return () => {\n const component = componentMap.get(wDom.compProps || {})?.vd.value;\n\n if (component) {\n runUnmountQueueFromWDom(component);\n }\n\n recursiveRemoveEvent(component || wDom);\n rootDelete(component || wDom);\n };\n};\n\nexport const wDomUpdate = (newWDomTree: WDom) => {\n const { needRerender } = newWDomTree;\n\n if (needRerender && needRerender !== 'N') {\n ({\n A: typeAdd,\n D: typeDelete,\n R: typeReplace,\n U: typeUpdate,\n CNSU: typeUpdate,\n SR: typeSortedReplace,\n SU: typeSortedUpdate,\n })[needRerender](newWDomTree);\n\n delete newWDomTree.needRerender;\n delete newWDomTree.oldChildren;\n delete newWDomTree.oldProps;\n }\n};\n\nexport const recursiveRemoveEvent = (originalWDom: WDom) => {\n if (originalWDom.props && originalWDom.el) {\n removeEvent(originalWDom.props, originalWDom.el);\n }\n\n (originalWDom.children || []).forEach((childItem: WDom) => {\n recursiveRemoveEvent(childItem);\n });\n};\n\nconst rootDelete = (newWDom: WDom) => {\n deleteRealDom(newWDom, newWDom.wrapElement as HTMLElement);\n};\n\nexport const typeDelete = (newWDom: WDom) => {\n if (newWDom.oldProps && newWDom.el) {\n removeEvent(newWDom.oldProps, newWDom.el);\n }\n\n deleteRealDom(\n newWDom,\n findRealParentElement(getParent(newWDom)) as HTMLElement\n );\n};\n\nconst deleteRealDom = (newWDom: WDom, parent: HTMLElement) => {\n if (parent && newWDom.el) {\n if ([1, 3].includes(newWDom.el?.nodeType)) {\n parent.removeChild(newWDom.el);\n } else if (newWDom.el?.nodeType === 11) {\n findChildWithRemoveElement(newWDom, parent as HTMLElement);\n }\n delete newWDom.el;\n }\n};\n\nconst findChildWithRemoveElement = (newWDom: WDom, parent: HTMLElement) => {\n (newWDom?.oldChildren || newWDom?.children || []).forEach(item => {\n const nodeType = item.el?.nodeType;\n if (nodeType) {\n if ([1, 3].includes(nodeType)) {\n if ((item.el as HTMLElement).tagName === 'HTML') {\n (item.el as HTMLElement).innerHTML = '';\n } else {\n (item.el as HTMLElement).remove();\n }\n } else if (nodeType === 11) {\n findChildWithRemoveElement(item, parent);\n }\n }\n });\n};\n\nconst typeSortedReplace = (newWDom: WDom) => {\n typeDelete(newWDom);\n typeAdd(newWDom);\n};\n\nconst typeSortedUpdate = (newWDom: WDom) => {\n typeUpdate(newWDom);\n\n const parentWDom = getParent(newWDom);\n if (parentWDom.needRerender !== 'CNSU') {\n const newElement = getElementFromFragment(newWDom);\n\n typeAdd(newWDom, newElement);\n }\n};\n\nconst typeAdd = (\n newWDom: WDom,\n newElement?: HTMLElement | DocumentFragment | Text\n) => {\n if (!newElement) {\n newElement = wDomToDom(newWDom) as HTMLElement;\n }\n\n const parentWDom = getParent(newWDom);\n if (parentWDom.type) {\n const parentEl = findRealParentElement(parentWDom);\n const isLoop = parentWDom.type === 'loop';\n const nextEl =\n isLoop && parentWDom.needRerender && parentWDom.needRerender !== 'CNSU'\n ? startFindNextBrotherElement(parentWDom, getParent(parentWDom))\n : startFindNextBrotherElement(newWDom, parentWDom);\n\n if (newElement && parentEl) {\n if (newWDom.tag !== 'portal') {\n if (nextEl) {\n parentEl.insertBefore(newElement, nextEl);\n } else {\n parentEl.appendChild(newElement);\n }\n }\n\n execMountedQueue();\n }\n }\n};\n\nconst getElementFromFragment = (newWDom: WDom) => {\n if (checkVirtualType(newWDom.type)) {\n return (newWDom?.children || []).reduce((acc, item) => {\n const element = getElementFromFragment(item);\n\n if (element) {\n acc.appendChild(element);\n }\n return acc;\n }, DF());\n }\n\n return newWDom.el;\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 && checkVirtualType(parentType)) {\n return startFindNextBrotherElement(parentWDom, getParent(parentWDom));\n } else if (\n parentWDom.isRoot &&\n checkVirtualType(parentType) &&\n parentWDom.afterElement\n ) {\n return parentWDom.afterElement;\n }\n\n return undefined;\n};\n\nconst findChildFragmentNextElement = (\n candidiateBrothers: WDom[]\n): HTMLElement | DocumentFragment | Text | undefined =>\n candidiateBrothers.reduce(\n (\n targetEl: HTMLElement | DocumentFragment | Text | undefined,\n bItem: WDom\n ) => {\n const type = bItem.type;\n const el = bItem.el;\n const isFragment = type && checkVirtualType(type);\n\n if (targetEl) {\n return targetEl;\n } else if (isFragment) {\n return findChildFragmentNextElement(bItem.children || []);\n } else if (el && el.nodeType !== 11) {\n return el;\n }\n\n return targetEl;\n },\n undefined\n );\n\nconst typeReplace = (newWDom: WDom) => {\n const parentWDom = getParent(newWDom);\n const orignalElement = newWDom.el;\n\n if (parentWDom.type && orignalElement) {\n if (orignalElement.nodeType === 11) {\n typeSortedReplace(newWDom);\n } else {\n const parentElement = findRealParentElement(parentWDom);\n const newElement = wDomToDom(newWDom);\n\n if (parentElement && newWDom.tag !== 'portal') {\n parentElement.replaceChild(newElement, orignalElement);\n }\n execMountedQueue();\n }\n }\n};\n\nconst removeEvent = (\n oldProps: Props,\n element: HTMLElement | DocumentFragment | Text\n) => {\n entries(oldProps || {}).forEach(([dataKey, dataValue]: [string, unknown]) => {\n if (dataKey.match(/^on/)) {\n element.removeEventListener(\n getEventName(dataKey),\n dataValue as (e: Event) => void\n );\n }\n });\n};\n\nconst typeUpdate = (newWDom: WDom) => {\n const element = newWDom.el;\n\n if (newWDom.type === 'text') {\n updateText(newWDom);\n\n return;\n }\n\n if (element) {\n const { oldProps, props } = newWDom;\n\n updateProps(props, element, oldProps);\n\n delete newWDom.oldProps;\n\n if (newWDom.tag === 'input') {\n (element as HTMLInputElement).value = String(newWDom?.props?.value || '');\n }\n }\n\n (newWDom.children || []).forEach((childItem: WDom) => wDomUpdate(childItem));\n\n runUpdatedQueueFromWDom(newWDom);\n};\n\nconst updateText = (newWDom: WDom) => {\n const element = newWDom.el;\n\n if (element) {\n element.nodeValue = String(newWDom.text);\n }\n};\n\nconst updateProps = (\n props?: Props,\n element?: HTMLElement | Element | DocumentFragment | Text,\n oldProps?: Props | null,\n isHydration?: boolean\n) => {\n const originalProps = { ...oldProps };\n\n entries(props || {}).forEach(([dataKey, dataValue]: [string, unknown]) => {\n if (isHydration && dataKey.match(/^on/)) {\n updateEvent(\n element as HTMLElement,\n dataKey,\n dataValue as (e: Event) => void,\n originalProps[dataKey] as (e: Event) => void\n );\n } else {\n if (dataKey === 'key' || dataValue === originalProps[dataKey]) {\n // Do nothing\n } else if (dataKey === 'portal' && typeof dataValue === 'object') {\n // Do nothing\n } else if (dataKey === 'innerHTML' && typeof dataValue === 'string') {\n (element as HTMLElement).innerHTML = dataValue;\n } else if (checkStyleData(dataKey, dataValue)) {\n updateStyle(\n dataValue,\n checkStyleData(dataKey, originalProps.style)\n ? originalProps.style\n : {},\n element\n );\n } else if (checkRefData(dataKey, dataValue)) {\n dataValue.value = element;\n } else if (dataKey.match(/^on/)) {\n updateEvent(\n element as HTMLElement,\n dataKey,\n dataValue as (e: Event) => void,\n originalProps[dataKey] as (e: Event) => void\n );\n } else if (dataKey) {\n if (dataKey !== 'type' && hasAccessorMethods(element, dataKey)) {\n (element as { [key: string]: any })[dataKey] = dataValue;\n } else {\n setAttr(\n getAttrKey(dataKey),\n element as HTMLElement,\n dataValue as string\n );\n }\n }\n\n delete originalProps[dataKey];\n }\n });\n\n keys(originalProps).forEach(dataKey =>\n (element as HTMLElement).removeAttribute(dataKey)\n );\n};\n\nconst setAttr = (dataKey: string, element: HTMLElement, dataValue: string) => {\n if (xmlnsRef.value && dataKey !== 'xmlns') {\n element.setAttributeNS(null, dataKey, dataValue);\n } else {\n element.setAttribute(dataKey, dataValue);\n }\n};\n\nconst wDomToDom = (wDom: WDom, isHydration?: boolean): HTMLElement => {\n let element;\n const { type, tag, text, props, children = [] } = wDom;\n const isVirtualType = checkVirtualType(type);\n\n if (tag === 'svg') {\n xmlnsRef.value = String(props?.xmlns);\n }\n\n if (!isHydration) {\n if (isVirtualType) {\n element = DF();\n } else if (type === 'element' && tag) {\n if (tag === 'portal' && props?.portal) {\n element = props.portal as HTMLElement;\n } else {\n element = xmlnsRef.value\n ? document.createElementNS(xmlnsRef.value, tag)\n : CE(tag);\n }\n } else if (type === 'text' && checkExisty(text)) {\n element = document.createTextNode(String(text));\n } else {\n element = CE('e');\n }\n\n wDom.el = element as HTMLElement;\n } else {\n element = wDom.el;\n }\n\n wDomChildrenToDom(children, element, isHydration);\n\n updateProps(props, element, null, isHydration);\n\n addMountedQueue(wDom);\n\n if (tag === 'svg') {\n xmlnsRef.value = '';\n }\n\n return element as HTMLElement;\n};\n\nconst wDomChildrenToDom = (\n children: WDom[],\n parentElement?: HTMLElement | Element | DocumentFragment | Text,\n isHydration?: boolean\n) => {\n const elementChildren = children.reduce(\n (acc: DocumentFragment, childItem: WDom) => {\n if (childItem.type) {\n const childElement = wDomToDom(childItem, isHydration);\n\n if (childItem.tag !== 'portal' && !isHydration) {\n acc.appendChild(childElement);\n }\n }\n\n return acc;\n },\n DF()\n );\n\n if (!isHydration && parentElement && elementChildren.hasChildNodes()) {\n parentElement.appendChild(elementChildren);\n }\n};\n\nconst updateEvent = (\n element: HTMLElement,\n eventKey: string,\n newEventHandler: (e: Event) => void,\n oldEventHandler: (e: Event) => void\n) => {\n const eventName = getEventName(eventKey);\n\n if (oldEventHandler !== newEventHandler) {\n if (oldEventHandler) {\n element.removeEventListener(eventName, oldEventHandler);\n }\n\n if (newEventHandler) {\n element.addEventListener(eventName, newEventHandler);\n }\n }\n};\n\nconst updateStyle = (\n style: Record<string, string>,\n oldStyle: Record<string, string>,\n element?: HTMLElement | Element | DocumentFragment | Text\n) => {\n const originalStyle = { ...oldStyle };\n const elementStyle = (element as HTMLElement)?.style;\n\n if (elementStyle) {\n entries(style).forEach(([styleKey, dataValue]) => {\n (elementStyle as any)[styleKey] = dataValue;\n delete originalStyle[styleKey];\n });\n\n 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 = checkVirtualType(vDom.type);\n if (vDom.isRoot && isVirtualType) {\n return vDom.wrapElement;\n }\n\n if (!isVirtualType) {\n return vDom.el as HTMLElement;\n }\n\n return findRealParentElement(getParent(vDom));\n};\n","import { WDom, TagFunctionResolver, RenderType, Props } from '@/types';\nimport { checkCustemComponentFunction, getKey } from '@/utils/predicator';\nimport { getParent } from '@/utils';\nimport { typeDelete, recursiveRemoveEvent } from '@/render';\nimport {\n checkEmptyElement,\n checkSameWDomWithOriginal,\n getWDomType,\n checkExisty,\n} from '@/utils/predicator';\n\nimport { runUnmountQueueFromWDom } from '@/hook/unmount';\nimport { assign, keys, entries } from '@/utils';\n\n/**\n * The starting point of the diffing process between the original virtual DOM and the new virtual DOM for re-rendering.\n */\nexport const makeNewWDomTree = (\n newWDom: WDom | TagFunctionResolver,\n originalWDom?: WDom\n) =>\n remakeNewWDom(\n newWDom,\n checkSameWDomWithOriginal[getWDomType(newWDom)](newWDom, originalWDom),\n originalWDom\n );\n\n/**\n * Create a new virtual DOM after comparing with the previous virtual DOM\n */\nconst remakeNewWDom = (\n newWDom: WDom | TagFunctionResolver,\n isSameType: boolean,\n originalWDom?: WDom\n) => {\n const remakeWDom = generalize(newWDom, isSameType, originalWDom);\n const param: [newWDom: WDom, isSameType: boolean, originalWDom?: WDom] = [\n remakeWDom,\n isSameType,\n originalWDom,\n ];\n const needRerender = addReRenderTypeProperty(...param);\n const isNoting = needRerender === 'N';\n\n if (!isNoting) {\n remakeWDom.children = remakeChildrenForDiff(...param);\n }\n\n remakeWDom.needRerender = needRerender;\n inheritPropForRender(remakeWDom, originalWDom, needRerender);\n\n if (!isNoting && originalWDom) {\n originalWDom.isLegacy = true;\n delete originalWDom.children;\n }\n\n return remakeWDom;\n};\n\n/**\n * Handle what the new virtual DOM should inherit or reconcile from the original virtual DOM.\n */\nconst inheritPropForRender = (\n remakeWDom: WDom,\n originalWDom?: WDom,\n needRerender?: RenderType\n) => {\n if (needRerender !== 'A' && originalWDom) {\n remakeWDom.el = originalWDom.el;\n }\n\n if (needRerender && ['D', 'R', 'SR'].includes(needRerender)) {\n if (originalWDom) {\n runUnmountQueueFromWDom(originalWDom);\n recursiveRemoveEvent(originalWDom);\n }\n remakeWDom.oldChildren = originalWDom?.children;\n }\n\n remakeWDom.oldProps = originalWDom?.props;\n};\n\n/**\n * Indicate the state information for the new virtual DOM to be reflected in the real DOM.\n */\nconst addReRenderTypeProperty = (\n newWDom: WDom,\n isSameType: boolean,\n originalWDom?: WDom\n): RenderType | undefined => {\n const existOriginalWDom = originalWDom && originalWDom.type;\n const isEmptyElement = checkEmptyElement(newWDom);\n const isRoot = newWDom.isRoot;\n const originalParentWDom = originalWDom && getParent(originalWDom);\n const origParentType = !isRoot && originalParentWDom?.type;\n const key = getKey(newWDom);\n const isKeyCheckedWDom = origParentType === 'loop' && checkExisty(key);\n const isSameText =\n newWDom.type === 'text' &&\n isSameType &&\n newWDom.text === originalWDom?.text;\n const isSameWDom = newWDom === originalWDom;\n\n let result: RenderType | undefined;\n if (isEmptyElement) {\n result = 'D';\n } else if (isSameText || isSameWDom) {\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 if (\n newWDom.type === 'loop' &&\n result === 'U' &&\n originalWDom &&\n chkDiffLoopOrder(newWDom, originalWDom)\n ) {\n result = 'CNSU';\n }\n\n return result;\n};\n\n/**\n * Check if a reverse order swap is needed when updating types that require reordering.\n */\nconst chkDiffLoopOrder = (newWDom: WDom, originalWDom: WDom) => {\n const origChildren = [...(originalWDom?.children || [])];\n const newChildren = [...(newWDom?.children || [])].filter(item =>\n origChildren.find(newItem => getKey(item) === getKey(newItem))\n );\n const filteredChildren = origChildren.filter(item =>\n newChildren.find(newItem => getKey(item) === getKey(newItem))\n );\n let isSame = filteredChildren.length === newChildren.length;\n\n if (isSame) {\n isSame = filteredChildren.every(\n (item, index) => getKey(item) === getKey(newChildren[index])\n );\n }\n\n return isSame;\n};\n\n/**\n * Handling virtual DOM attribute updates.\n */\nconst updateProps = (props: Props, infoProps: Props) => {\n if (props && infoProps !== props) {\n keys(props).forEach(key => delete props[key]);\n\n entries(infoProps || {}).forEach(([key, value]) => (props[key] = value));\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\n/**\n * Start handling when the virtual DOM is updated rather than completely replaced with a new type.\n * (Reflect the state of props or children to ensure the new state is applied)\n * (Handle the reflection of the new state while ensuring that the actual references of props or children are not changed)\n */\nconst runUpdate = (vDom: WDom, infoVdom: TagFunctionResolver) => {\n const { compProps: props, compChild: children } = vDom;\n const { props: infoProps, children: infoChidren } = infoVdom;\n\n if (props) {\n updateProps(props, infoProps);\n }\n\n if (children) {\n updateChildren(children, infoChidren);\n }\n\n const newVDom = vDom.reRender && vDom.reRender();\n\n return newVDom as WDom;\n};\n\n/**\n * Replace the compared virtual DOM with the new virtual DOM or simply update it.\n */\nconst generalize = (\n newWDom: WDom | TagFunctionResolver,\n isSameType: boolean,\n originalWDom?: WDom\n): WDom => {\n if (checkCustemComponentFunction(newWDom)) {\n return isSameType && originalWDom\n ? runUpdate(originalWDom, newWDom)\n : newWDom.resolve();\n }\n\n return newWDom;\n};\n\n/**\n * 자식 가상돔들도 전부 재귀처리하며 똑같은 처리를 해준다.\n */\nconst remakeChildrenForDiff = (\n newWDom: WDom,\n isSameType: boolean,\n originalWDom?: WDom\n) =>\n isSameType && originalWDom\n ? remakeChildrenForUpdate(newWDom, originalWDom)\n : remakeChildrenForAdd(newWDom);\n\n/**\n * Recursive handling for the creation of a new virtual DOM.\n */\nconst remakeChildrenForAdd = (newWDom: WDom) =>\n (newWDom.children || []).map((item: WDom) =>\n assign(makeNewWDomTree(item), { getParent: () => newWDom })\n );\n\n/**\n * Recursive handling for updates, not additions.\n */\nconst remakeChildrenForUpdate = (newWDom: WDom, originalWDom: WDom) =>\n newWDom.type === 'loop' && checkExisty(getKey((newWDom.children || [])[0]))\n ? remakeChildrenForLoopUpdate(newWDom, originalWDom)\n : (newWDom.children || []).map((item: WDom, index: number) =>\n assign(makeNewWDomTree(item, (originalWDom.children || [])[index]), {\n getParent: () => newWDom,\n })\n );\n\n/**\n * Handling virtual DOM of loop-type elements.\n */\nconst remakeChildrenForLoopUpdate = (newWDom: WDom, originalWDom: WDom) => {\n const [remakedChildren, unUsedChildren] = diffLoopChildren(\n newWDom,\n originalWDom\n );\n\n unUsedChildren.forEach(unusedItem => {\n runUnmountQueueFromWDom(unusedItem);\n recursiveRemoveEvent(unusedItem);\n typeDelete(unusedItem);\n });\n\n return remakedChildren;\n};\n\n/**\n * Recursive handling of loop-type virtual DOM elements.\n */\nconst diffLoopChildren = (newWDom: WDom, originalWDom: WDom) => {\n const newChildren = [...(newWDom.children || [])];\n const originalChildren = [...(originalWDom.children || [])];\n const remakedChildren = newChildren.map(item => {\n const originalItem = findSameKeyOriginalItem(item, originalChildren);\n const childItem = makeNewWDomTree(item, originalItem);\n\n if (originalItem) {\n originalChildren.splice(originalChildren.indexOf(originalItem), 1);\n }\n\n childItem.getParent = () => newWDom;\n\n return childItem;\n });\n\n return [remakedChildren, originalChildren];\n};\n\n/**\n * When comparing loop-type virtual DOM elements, use the key to determine the comparison\n */\nconst findSameKeyOriginalItem = (item: WDom, originalChildren: WDom[]) =>\n originalChildren.find(\n orignalChildItem => getKey(orignalChildItem) === getKey(item)\n );\n","import { Props } from '@/types';\nimport { componentMap } from '@/utils/universalRef';\n\nconst redrawQueue = new Map<Props, () => void>();\nlet redrawQueueTimeout: boolean = false;\n\nexport const setRedrawAction = (compKey: Props, exec: () => void) => {\n if (componentMap.get(compKey)) {\n componentMap.get(compKey)!.up = () => {\n redrawQueue.set(compKey, exec);\n\n if (!redrawQueueTimeout) {\n redrawQueueTimeout = true;\n queueMicrotask(execRedrawQueue);\n }\n };\n }\n};\n\nexport const componentUpdate = (compKey: Props) => () => {\n const up = componentMap.get(compKey)?.up;\n let result = false;\n if (up) {\n up();\n result = true;\n }\n\n return result;\n};\n\nconst execRedrawQueue = () => {\n redrawQueue.forEach((item: () => void) => {\n item();\n });\n\n redrawQueue.clear();\n redrawQueueTimeout = false;\n};\n","import { componentMap, getComponentKey } from '@/utils/universalRef';\n\nimport { useUpdated } from '@/hook/useUpdate';\n\nexport const updateCallback = (\n effectAction: () => (() => void) | void,\n dependencies: () => any[] = () => []\n) => {\n const updateReqs = componentMap.get(getComponentKey())!.upR;\n\n updateReqs.push(() => useUpdated(effectAction, dependencies));\n useUpdated(effectAction, dependencies);\n};\n\nexport const runUpdateCallback = () => {\n const updateReqs = componentMap.get(getComponentKey())?.upR;\n\n if (updateReqs?.length) {\n updateReqs.forEach(callback => callback());\n }\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 needDiffRef,\n getComponentSubInfo,\n wdomSymbol,\n} from '@/utils/universalRef';\nimport { setRedrawAction, componentUpdate } from '@/utils/redraw';\nimport { runUpdateCallback } from '@/hook/updateCallback';\nimport {\n checkFragmentFunction,\n checkCustemComponentFunction,\n} from '@/utils/predicator';\nimport { assign } from '@/utils';\n\n/**\n * It allows grouping multiple elements together.\n */\nexport const Fragment = (_props: Props, ...children: WDom[]) =>\n ({\n type: 'fragment',\n [wdomSymbol]: true,\n children,\n }) as WDom;\n\n/**\n * Element creation\n */\nexport const h = (\n tag: TagFunction | FragmentFunction | string,\n props: Props,\n ...children: MiddleStateWDomChildren\n) => {\n const nodeParentPointer: NodePointer = { value: undefined };\n const newProps = props || {};\n const newChildren = remakeChildren(nodeParentPointer, children);\n const node = makeNode(tag, newProps, newChildren);\n\n if (!checkCustemComponentFunction(node)) {\n nodeParentPointer.value = node;\n }\n\n return node;\n};\n\n/**\n * Enables portals\n */\nexport const portal = (wDom: WDom, portal: HTMLElement) => {\n return h('portal', { portal }, wDom);\n};\n\n/**\n * It helps with component creation.\n */\nexport const mount =\n <T>(component: Component<T>) =>\n (_props: T, _children?: MiddleStateWDomChildren) =>\n component;\n\n/**\n * It re-renders starting from a specific component.\n */\nconst reRenderCustomComponent = (\n tag: TagFunction,\n props: Props,\n children: WDom[],\n originalWDom: WDom\n) => {\n if (originalWDom.isLegacy) {\n return;\n }\n needDiffRef.value = true;\n\n const newWDom = makeWDomResolver(tag, props, children);\n const newWDomTree = makeNewWDomTree(newWDom, originalWDom);\n const { isRoot, getParent, wrapElement, afterElement } = originalWDom;\n\n newWDomTree.getParent = getParent;\n\n if (!isRoot && getParent) {\n const brothers = getParent()?.children || [];\n const index = brothers.indexOf(originalWDom);\n\n brothers.splice(index, 1, newWDomTree);\n } else {\n newWDomTree.isRoot = true;\n newWDomTree.wrapElement = wrapElement;\n newWDomTree.afterElement = afterElement;\n }\n\n needDiffRef.value = false;\n\n wDomUpdate(newWDomTree);\n};\n\n/**\n * Create an intermediate step for diffing between the existing virtual DOM and the new one during re-rendering\n */\nconst makeWDomResolver = (tag: TagFunction, props: Props, children: WDom[]) => {\n const tagName = tag.name;\n const ctor = tag;\n // 리졸브는 컴포넌트를 새로 만든다.\n const resolve = (compKey = props) => {\n initMountHookState(compKey);\n\n const initialComponent = tag(props, children);\n const component =\n typeof initialComponent === 'function'\n ? initialComponent\n : () => () => initialComponent;\n const componentMaker = component(componentUpdate(compKey), props, children);\n\n const customNode = makeCustomNode(\n componentMaker,\n compKey,\n tag,\n props,\n children\n );\n\n return customNode;\n };\n\n return { tagName, ctor, props, children, resolve };\n};\n\n/**\n * Create the actual virtual DOM node from the component.\n */\nconst makeCustomNode = (\n componentMaker: (props: Props) => WDom,\n compKey: Props,\n tag: TagFunction,\n props: Props,\n children: WDom[]\n) => {\n let newCustomComponentMaker = componentMaker;\n let customNode = componentMaker(props);\n\n if (customNode.reRender) {\n newCustomComponentMaker = (newProps: Props): WDom => {\n const customNode = componentMaker(newProps);\n const newNode = Fragment({}, customNode);\n\n customNode.getParent = () => newNode;\n\n return newNode;\n };\n\n customNode = newCustomComponentMaker(props);\n }\n\n const reRender = makeReRender(\n newCustomComponentMaker,\n compKey,\n tag,\n props,\n children\n );\n\n addComponentProps(customNode, compKey, tag, props, children, reRender);\n\n return customNode;\n};\n\n/**\n * When the virtual DOM is actually created from the component, generate a re-render method for future redraws.\n */\nconst makeReRender = (\n componentMaker: (props: Props) => WDom,\n compKey: Props,\n tag: TagFunction,\n props: Props,\n children: WDom[]\n) => {\n const reRender = () =>\n wDomMaker(componentMaker, compKey, tag, props, children, reRender);\n return reRender;\n};\n\n/**\n * The starting point for redrawing from the re-render method\n */\nconst wDomMaker = (\n componentMaker: (props: Props) => WDom,\n compKey: Props,\n tag: TagFunction,\n props: Props,\n children: WDom[],\n reRender: () => WDom\n) => {\n initUpdateHookState(compKey);\n runUpdateCallback();\n\n const customNode = componentMaker(props);\n\n addComponentProps(customNode, compKey, tag, props, children, reRender);\n\n return customNode;\n};\n\n/**\n * When creating a custom component node, attach additional information attributes to the virtual DOM object.\n */\nconst addComponentProps = (\n wDom: WDom,\n compKey: Props,\n tag: TagFunction,\n props: Props,\n children: WDom[],\n reRender: () => WDom\n) => {\n assign(wDom, {\n compProps: props,\n compChild: children,\n ctor: tag,\n tagName: tag.name,\n compKey,\n reRender,\n });\n\n setRedrawAction(compKey, () =>\n reRenderCustomComponent(tag, props, children, wDom)\n );\n\n if (getComponentSubInfo(compKey, 'vd')) {\n (getComponentSubInfo(compKey, 'vd') as { value: WDom }).value = wDom;\n }\n};\n\n/**\n * The starting point where the virtual DOM is created from the h function.\n */\nconst makeNode = (\n tag: TagFunction | FragmentFunction | string,\n props: Props,\n children: WDom[]\n) => {\n if (checkFragmentFunction(tag)) {\n return Fragment(props, ...children);\n } else if (checkCustemComponentFunction(tag)) {\n const componetMakeResolver = makeWDomResolver(tag, props, children);\n\n return needDiffRef.value\n ? componetMakeResolver\n : componetMakeResolver.resolve();\n }\n\n return {\n type: 'element',\n [wdomSymbol]: true,\n tag,\n props,\n children,\n } as WDom;\n};\n\n/**\n * The starting point for recursively processing the child virtual DOM elements.\n */\nconst remakeChildren = (\n nodeParentPointer: NodePointer,\n children: MiddleStateWDomChildren\n): WDom[] =>\n children.map((item: MiddleStateWDom) =>\n assign(makeChildrenItem(item), { getParent: () => nodeParentPointer.value })\n );\n\n/**\n * Recursively process the child virtual DOM elements.\n */\nconst makeChildrenItem = (item: MiddleStateWDom): WDom => {\n if (item === null || item === undefined || item === false) {\n return { type: null, [wdomSymbol]: true } as WDom;\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 [wdomSymbol]: true,\n children,\n } as WDom;\n nodeParentPointer.value = node;\n\n return node;\n } else if (typeof item === 'string' || typeof item === 'number') {\n return { type: 'text', [wdomSymbol]: true, text: item } as WDom;\n }\n\n return item;\n};\n","export const ref = <T>(initValue: T) => ({ value: initValue });\nexport const nextTick = () => Promise.resolve();\n"],"names":["checkPlainWDomType","wDom","checkPlainType","typeName","checkSameCustomComponent","newWDom","originalWDom","checkSameFragment","_a","_b","checkSameTagElement","checkNormalTypeElement","checkLoopTypeElement","checkExisty","getKey","target","checkVirtualType","type","checkCustemComponentFunction","checkFragmentFunction","Fragment","checkEmptyElement","value","checkStyleData","dataKey","dataValue","checkRefData","hasAccessorMethods","descriptor","getWDomType","result","checkSameWDomWithOriginal","wdomSymbol","xmlnsRef","compKeyRef","needDiffRef","componentMap","setComponetRef","compKey","getComponentKey","getComponentSubInfo","subKey","initUpdateHookState","initMountHookState","getParent","vDom","entries","keys","assign","isPropType","obj","unmount","effectAction","runUnmountQueueFromWDom","removeItem","recursiveRunUnmount","item","subInfo","effect","mountedQueue","execMountedQueue","runMountedQueueFromWDom","addMountedQueue","mountCallback","component","queue","sequence","callback","useUpdated","dependencies","upD","upS","def","checkNeedPushQueue","runUpdatedQueueFromWDom","originalDefs","newDefs","index","getAttrKey","keyName","getEventName","eventKey","_match","p1","DF","CE","t","render","wrapElement","afterElement","isHydration","Dom","wDomToDom","recursiveRemoveEvent","rootDelete","wDomUpdate","newWDomTree","needRerender","typeAdd","typeDelete","typeReplace","typeUpdate","typeSortedReplace","typeSortedUpdate","removeEvent","childItem","deleteRealDom","findRealParentElement","parent","findChildWithRemoveElement","nodeType","newElement","getElementFromFragment","parentWDom","parentEl","nextEl","startFindNextBrotherElement","acc","element","brothers","nextIndex","candidiateBrothers","finedNextEl","findChildFragmentNextElement","parentType","targetEl","bItem","el","isFragment","orignalElement","parentElement","oldProps","updateText","props","updateProps","originalProps","updateEvent","updateStyle","setAttr","tag","text","children","isVirtualType","wDomChildrenToDom","elementChildren","childElement","newEventHandler","oldEventHandler","eventName","style","oldStyle","originalStyle","elementStyle","styleKey","makeNewWDomTree","remakeNewWDom","isSameType","remakeWDom","generalize","param","addReRenderTypeProperty","isNoting","remakeChildrenForDiff","inheritPropForRender","existOriginalWDom","isEmptyElement","isRoot","originalParentWDom","origParentType","key","isKeyCheckedWDom","isSameText","isSameWDom","chkDiffLoopOrder","origChildren","newChildren","newItem","filteredChildren","isSame","infoProps","updateChildren","infoChidren","childrenItem","runUpdate","infoVdom","remakeChildrenForUpdate","remakeChildrenForAdd","remakeChildrenForLoopUpdate","remakedChildren","unUsedChildren","diffLoopChildren","unusedItem","originalChildren","originalItem","findSameKeyOriginalItem","orignalChildItem","redrawQueue","redrawQueueTimeout","setRedrawAction","exec","execRedrawQueue","componentUpdate","up","updateCallback","runUpdateCallback","updateReqs","_props","h","nodeParentPointer","newProps","remakeChildren","node","makeNode","portal","mount","_children","reRenderCustomComponent","makeWDomResolver","initialComponent","componentMaker","makeCustomNode","newCustomComponentMaker","customNode","newNode","reRender","makeReRender","addComponentProps","wDomMaker","componetMakeResolver","makeChildrenItem","ref","initValue","nextTick"],"mappings":"+NAoBA,MAAMA,EAAsBC,GAC1B,OAAOA,GAAS,UAAY,EAAE,YAAaA,GAEvCC,EAAiB,CAACD,EAAiBE,IACvCH,EAAmBC,CAAI,GAAKA,EAAK,OAASE,EAEtCC,GAA2B,CAC/BC,EACAC,IAEA,SAAUD,EACNA,EAAQ,QAASC,GAAA,YAAAA,EAAc,MAC/BD,KAAYC,GAAA,YAAAA,EAAc,MAE1BC,GAAoB,CACxBF,EACAC,IAEA,SAAA,OAAAN,EAAmBK,CAAO,IAC1BC,GAAA,YAAAA,EAAc,QAAS,cACvBE,EAAAF,GAAA,YAAAA,EAAc,WAAd,YAAAE,EAAwB,YAAWC,EAAAJ,GAAA,YAAAA,EAAS,WAAT,YAAAI,EAAmB,SAElDC,GAAsB,CAC1BL,EACAC,IAEA,SAAA,OAAAN,E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OA,CAAU,GAC/CC,GAAW,IAAM,QAAQ,QAAQ"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ export interface WDom {
|
|
|
47
47
|
}
|
|
48
48
|
export type RenderType = 'A' | 'D' | 'R' | 'U' | 'SR' | 'SU' | 'CNSU' | 'N';
|
|
49
49
|
export type ComponentSubKey = 'vd' | 'up' | 'upR' | 'upS' | 'upD' | 'upCB' | 'mts' | 'umts';
|
|
50
|
-
export type
|
|
50
|
+
export type ComponentMap = WeakMap<Props, ComponentInfo>;
|
|
51
51
|
export type ComponentInfo = {
|
|
52
52
|
vd: {
|
|
53
53
|
value: null | WDom;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentMap, ComponentSubKey, Props } from '../types';
|
|
2
2
|
export declare const wdomSymbol: unique symbol;
|
|
3
3
|
export declare const xmlnsRef: {
|
|
4
4
|
value: string;
|
|
@@ -9,7 +9,7 @@ export declare const compKeyRef: {
|
|
|
9
9
|
export declare const needDiffRef: {
|
|
10
10
|
value: boolean;
|
|
11
11
|
};
|
|
12
|
-
export declare const
|
|
12
|
+
export declare const componentMap: ComponentMap;
|
|
13
13
|
export declare const getComponentKey: () => Props;
|
|
14
14
|
export declare const getComponentSubInfo: (compKey: Props, subKey: ComponentSubKey) => {
|
|
15
15
|
value: import('../types').WDom | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function n(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(l){if(l.ep)return;l.ep=!0;const o=n(l);fetch(l.href,o)}})();const E=e=>typeof e=="object"&&!("resolve"in e),N=(e,t)=>E(e)&&e.type===t,Ce=(e,t)=>"ctor"in e?e.ctor===(t==null?void 0:t.ctor):e===(t==null?void 0:t.ctor),Re=(e,t)=>{var n,r;return E(e)&&(t==null?void 0:t.type)==="fragment"&&((n=t==null?void 0:t.children)==null?void 0:n.length)===((r=e==null?void 0:e.children)==null?void 0:r.length)},we=(e,t)=>{var n,r;return E(e)&&(t==null?void 0:t.type)==="element"&&(t==null?void 0:t.tag)===e.tag&&((n=t==null?void 0:t.children)==null?void 0:n.length)===((r=e==null?void 0:e.children)==null?void 0:r.length)},J=(e,t)=>E(e)&&(t==null?void 0:t.type)===e.type,xe=(e,t)=>{var n,r;return E(e)&&(t==null?void 0:t.type)===e.type&&(S(h((e.children||[])[0]))&&S(h(((t==null?void 0:t.children)||[])[0]))||((n=t==null?void 0:t.children)==null?void 0:n.length)===((r=e==null?void 0:e.children)==null?void 0:r.length))},h=e=>{var t,n;return((t=e==null?void 0:e.compProps)==null?void 0:t.key)??((n=e==null?void 0:e.props)==null?void 0:n.key)},y=e=>e&&["fragment","loop"].includes(e),U=e=>typeof e=="function"&&!ne(e)||typeof e=="object"&&"resolve"in e,ne=e=>typeof e=="function"&&e===x,re=e=>E(e)&&!e.type,S=e=>e!=null,_=(e,t)=>e==="style"&&typeof t=="object",Ne=(e,t)=>e==="ref"&&typeof t=="object",Ue=(e,t)=>{const n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);return n&&n.get&&n.set},Le=e=>{let t="et";return U(e)?t="c":N(e,"fragment")?t="f":N(e,"element")?t="e":N(e,"loop")?t="l":N(e,"text")?t="t":re(e)&&(t="et"),t},Oe={c:Ce,l:xe,t:J,e:we,f:Re,et:J},P=Symbol.for("lithentWDomSymbol"),b={value:""},R={value:{}},j={value:!1},p=new WeakMap,Ve=e=>{p.set(e,{vd:{value:null},up:()=>{},upR:[],upS:{value:0},upD:[],upCB:[],mts:[],umts:[]})},w=()=>R.value,z=(e,t)=>p.get(e)?p.get(e)[t]:null,Ae=e=>R.value=e,Te=e=>{R.value=e,Ve(e)},m=e=>e.getParent&&e.getParent(),C=Object.entries,le=Object.keys,L=Object.assign,De=e=>{p.get(w()).umts.push(e)},O=e=>{const{compKey:t}=e;t&&Me(t),oe(e)},oe=e=>{(e.children||[]).forEach(t=>{t.compKey?O(t):oe(t)})},Me=e=>{const t=p.get(e);t&&(t.umts.forEach(n=>n()),t.umts=[],p.delete(e))};let k=[];const H=()=>{k.forEach(e=>ke(e)),k=[]},je=e=>{e.compKey&&k.push(e)},ce=e=>{var t;return(((t=p.get(w()))==null?void 0:t.mts)||[]).push(e)},ke=e=>{const{compKey:t}=e;if(t){const n=p.get(t),r=n==null?void 0:n.mts,l=n==null?void 0:n.upS;R.value=t,l&&(l.value=0),r&&(n.mts=[],r.forEach(o=>{const c=o();c&&De(c)}))}},G=(e,t=()=>[])=>{const n=p.get(w()),{upD:r,upS:l}=n,o=r[l.value];if(o&&Fe(o,t())){const c=e();c&&n.upCB.push(c)}r[l.value]=t(),l.value+=1},$e=e=>{const{compKey:t}=e;if(t){const n=p.get(t),r=n==null?void 0:n.upCB,l=n==null?void 0:n.upS;R.value=t,l&&(l.value=0),e.ctor&&r&&(n.upCB=[],r.forEach(o=>o()))}},Fe=(e,t)=>e.length?e.some((n,r)=>n!==t[r]):!0,Ie=e=>e==="className"?"class":e,ue=e=>e.replace(/^on(.*)/,(t,n)=>n.toLowerCase()),W=()=>new DocumentFragment,Q=e=>document.createElement(e),Ke=(e,t,n,r)=>{e.isRoot=!0,t??(t=document.body),e.wrapElement=t;const l=A(e,r);return t.tagName==="HTML"?t.replaceWith(l):t.appendChild(l),H(),()=>{var o;const c=(o=p.get(e.compProps||{}))==null?void 0:o.vd.value;c&&O(c),V(c||e),Be(c||e)}},ie=e=>{const{needRerender:t}=e;t&&t!=="N"&&({A:Y,D:q,R:We,U:F,CNSU:F,SR:se,SU:He}[t](e),delete e.needRerender,delete e.oldChildren,delete e.oldProps)},V=e=>{e.props&&e.el&&he(e.props,e.el),(e.children||[]).forEach(t=>{V(t)})},Be=e=>{ae(e,e.wrapElement)},q=e=>{e.oldProps&&e.el&&he(e.oldProps,e.el),ae(e,T(m(e)))},ae=(e,t)=>{var n,r;t&&e.el&&([1,3].includes((n=e.el)==null?void 0:n.nodeType)?t.removeChild(e.el):((r=e.el)==null?void 0:r.nodeType)===11&&de(e),delete e.el)},de=(e,t)=>{((e==null?void 0:e.oldChildren)||(e==null?void 0:e.children)||[]).forEach(n=>{var r;const l=(r=n.el)==null?void 0:r.nodeType;l&&([1,3].includes(l)?n.el.tagName==="HTML"?n.el.innerHTML="":n.el.remove():l===11&&de(n))})},se=e=>{q(e),Y(e)},He=e=>{if(F(e),m(e).needRerender!=="CNSU"){const t=pe(e);Y(e,t)}},Y=(e,t)=>{t||(t=A(e));const n=m(e);if(n.type){const r=T(n),l=n.type==="loop"&&n.needRerender&&n.needRerender!=="CNSU"?$(n,m(n)):$(e,n);t&&r&&(e.tag!=="portal"&&(l?r.insertBefore(t,l):r.appendChild(t)),H())}},pe=e=>y(e.type)?((e==null?void 0:e.children)||[]).reduce((t,n)=>{const r=pe(n);return r&&t.appendChild(r),t},W()):e.el,$=(e,t)=>{const n=t.children||[],r=n.indexOf(e)+1,l=n.slice(r),o=ve(l),c=t.type||"";if(o)return o;if(!t.isRoot&&y(c))return $(t,m(t));if(t.isRoot&&y(c)&&t.afterElement)return t.afterElement},ve=e=>e.reduce((t,n)=>{const r=n.type,l=n.el,o=r&&y(r);return t||(o?ve(n.children||[]):l&&l.nodeType!==11?l:t)},void 0),We=e=>{const t=m(e),n=e.el;if(t.type&&n)if(n.nodeType===11)se(e);else{const r=T(t),l=A(e);r&&e.tag!=="portal"&&r.replaceChild(l,n),H()}},he=(e,t)=>{C(e||{}).forEach(([n,r])=>{n.match(/^on/)&&t.removeEventListener(ue(n),r)})},F=e=>{var t;const n=e.el;if(e.type==="text"){qe(e);return}if(n){const{oldProps:r,props:l}=e;fe(l,n,r),delete e.oldProps,e.tag==="input"&&(n.value=String(((t=e==null?void 0:e.props)==null?void 0:t.value)||""))}(e.children||[]).forEach(r=>ie(r)),$e(e)},qe=e=>{const t=e.el;t&&(t.nodeValue=String(e.text))},fe=(e,t,n,r)=>{const l={...n};C(e||{}).forEach(([o,c])=>{o==="key"||c===l[o]||o==="portal"&&typeof c=="object"||(o==="innerHTML"&&typeof c=="string"?t.innerHTML=c:_(o,c)?ze(c,_(o,l.style)?l.style:{},t):Ne(o,c)?c.value=t:o.match(/^on/)?_e(t,o,c,l[o]):o&&(o!=="type"&&Ue(t,o)?t[o]=c:Ye(Ie(o),t,c))),delete l[o]}),le(l).forEach(o=>t.removeAttribute(o))},Ye=(e,t,n)=>{b.value&&e!=="xmlns"?t.setAttributeNS(null,e,n):t.setAttribute(e,n)},A=(e,t)=>{let n;const{type:r,tag:l,text:o,props:c,children:i=[]}=e,u=y(r);return l==="svg"&&(b.value=String(c==null?void 0:c.xmlns)),u?n=W():r==="element"&&l?l==="portal"&&c!=null&&c.portal?n=c.portal:n=b.value?document.createElementNS(b.value,l):Q(l):r==="text"&&S(o)?n=document.createTextNode(String(o)):n=Q("e"),e.el=n,Je(i,n,t),fe(c,n,null),je(e),l==="svg"&&(b.value=""),n},Je=(e,t,n)=>{const r=e.reduce((l,o)=>{if(o.type){const c=A(o,n);o.tag!=="portal"&&!n&&l.appendChild(c)}return l},W());t&&r.hasChildNodes()&&t.appendChild(r)},_e=(e,t,n,r)=>{const l=ue(t);r!==n&&(r&&e.removeEventListener(l,r),n&&e.addEventListener(l,n))},ze=(e,t,n)=>{const r={...t},l=n==null?void 0:n.style;l&&(C(e).forEach(([o,c])=>{l[o]=c,delete r[o]}),C(r).forEach(([o])=>l[o]=""))},T=e=>{const t=y(e.type);return e.isRoot&&t?e.wrapElement:t?T(m(e)):e.el},D=(e,t)=>Ge(e,Oe[Le(e)](e,t),t),Ge=(e,t,n)=>{const r=rt(e,t,n),l=[r,t,n],o=Xe(...l),c=o==="N";return c||(r.children=lt(...l)),r.needRerender=o,Qe(r,n,o),!c&&n&&(n.isLegacy=!0,delete n.children),r},Qe=(e,t,n)=>{n!=="A"&&t&&(e.el=t.el),n&&["D","R","SR"].includes(n)&&(t&&(O(t),V(t)),e.oldChildren=t==null?void 0:t.children),e.oldProps=t==null?void 0:t.props},Xe=(e,t,n)=>{const r=n&&n.type,l=re(e),o=e.isRoot,c=n&&m(n),i=!o&&(c==null?void 0:c.type),u=h(e),s=i==="loop"&&S(u),v=e.type==="text"&&t&&e.text===(n==null?void 0:n.text),f=e===n;let d;return l?d="D":v||f?d="N":r?t?d=s?"SU":"U":d=s?"SR":"R":d="A",e.type==="loop"&&d==="U"&&n&&Ze(e,n)&&(d="CNSU"),d},Ze=(e,t)=>{const n=[...(t==null?void 0:t.children)||[]],r=[...(e==null?void 0:e.children)||[]].filter(c=>n.find(i=>h(c)===h(i))),l=n.filter(c=>r.find(i=>h(c)===h(i)));let o=l.length===r.length;return o&&(o=l.every((c,i)=>h(c)===h(r[i]))),o},et=(e,t)=>{e&&t!==e&&(le(e).forEach(n=>delete e[n]),C(t||{}).forEach(([n,r])=>e[n]=r))},tt=(e,t)=>{e&&t!==e&&(e.splice(0,e.length),t&&t.forEach(n=>e.push(n)))},nt=(e,t)=>{const{compProps:n,compChild:r}=e,{props:l,children:o}=t;return n&&et(n,l),r&&tt(r,o),e.reRender&&e.reRender()},rt=(e,t,n)=>U(e)?t&&n?nt(n,e):e.resolve():e,lt=(e,t,n)=>t&&n?ct(e,n):ot(e),ot=e=>(e.children||[]).map(t=>L(D(t),{getParent:()=>e})),ct=(e,t)=>e.type==="loop"&&S(h((e.children||[])[0]))?ut(e,t):(e.children||[]).map((n,r)=>L(D(n,(t.children||[])[r]),{getParent:()=>e})),ut=(e,t)=>{const[n,r]=it(e,t);return r.forEach(l=>{O(l),V(l),q(l)}),n},it=(e,t)=>{const n=[...e.children||[]],r=[...t.children||[]];return[n.map(l=>{const o=at(l,r),c=D(l,o);return o&&r.splice(r.indexOf(o),1),c.getParent=()=>e,c}),r]},at=(e,t)=>t.find(n=>h(n)===h(e)),I=new Map;let K=!1;const dt=(e,t)=>{p.get(e)&&(p.get(e).up=()=>{I.set(e,t),K||(K=!0,queueMicrotask(pt))})},st=e=>()=>{var t;const n=(t=p.get(e))==null?void 0:t.up;let r=!1;return n&&(n(),r=!0),r},pt=()=>{I.forEach(e=>{e()}),I.clear(),K=!1},me=(e,t=()=>[])=>{p.get(w()).upR.push(()=>G(e,t)),G(e,t)},vt=()=>{var e;const t=(e=p.get(w()))==null?void 0:e.upR;t!=null&&t.length&&t.forEach(n=>n())},x=(e,...t)=>({type:"fragment",[P]:!0,children:t}),X=(e,t,...n)=>{const r={value:void 0},l=t||{},o=be(r,n),c=yt(e,l,o);return U(c)||(r.value=c),c},ge=e=>(t,n)=>e,ht=(e,t,n,r)=>{var l;if(r.isLegacy)return;j.value=!0;const o=ye(e,t,n),c=D(o,r),{isRoot:i,getParent:u,wrapElement:s,afterElement:v}=r;if(c.getParent=u,!i&&u){const f=((l=u())==null?void 0:l.children)||[],d=f.indexOf(r);f.splice(d,1,c)}else c.isRoot=!0,c.wrapElement=s,c.afterElement=v;j.value=!1,ie(c)},ye=(e,t,n)=>({tagName:e.name,ctor:e,props:t,children:n,resolve:(r=t)=>{Te(r);const l=e(t,n),o=(typeof l=="function"?l:()=>()=>l)(st(r),t,n);return ft(o,r,e,t,n)}}),ft=(e,t,n,r,l)=>{let o=e,c=e(r);c.reRender&&(o=u=>{const s=e(u),v=x({},s);return s.getParent=()=>v,v},c=o(r));const i=mt(o,t,n,r,l);return Ee(c,t,n,r,l,i),c},mt=(e,t,n,r,l)=>{const o=()=>gt(e,t,n,r,l,o);return o},gt=(e,t,n,r,l,o)=>{Ae(t),vt();const c=e(r);return Ee(c,t,n,r,l,o),c},Ee=(e,t,n,r,l,o)=>{L(e,{compProps:r,compChild:l,ctor:n,tagName:n.name,compKey:t,reRender:o}),dt(t,()=>ht(n,r,l,e)),z(t,"vd")&&(z(t,"vd").value=e)},yt=(e,t,n)=>{if(ne(e))return x(t,...n);if(U(e)){const r=ye(e,t,n);return j.value?r:r.resolve()}return{type:"element",[P]:!0,tag:e,props:t,children:n}},be=(e,t)=>t.map(n=>L(Et(n),{getParent:()=>e.value})),Et=e=>{if(e==null||e===!1)return{type:null,[P]:!0};if(Array.isArray(e)){const t={value:void 0},n=be(t,e),r={type:"loop",[P]:!0,children:n};return t.value=r,r}else if(typeof e=="string"||typeof e=="number")return{type:"text",[P]:!0,text:e};return e},bt=e=>({value:e});function a(e,t,n,r,l,o){const{children:c,...i}=t;if(c!=null){const u=Array.isArray(c)?c:[c];return X(e,{...i,key:n},...u)}return X(e,{...i,key:n})}const B=(e,t)=>{let n=e;return{get value(){return n},get v(){return n},set value(r){n=r,t()},set v(r){n=r,t()}}},Pt=e=>{let t=e;return{get value(){return t()},get v(){return t()},set value(n){throw new Error("You can't change 'computed'")},set v(n){throw new Error("You can't change 'computed'")}}},St=(e,t=()=>{},n=()=>[])=>{ce(()=>(e(),t)),me(()=>(t&&t(),e),n)},Ct={cache:!0};function Rt(e){const t={value:!1},n=!Array.isArray(e)&&typeof e=="object"&&e!==null?e:{value:e},r=new Set,l=[],o=new WeakMap;return(c,i,u)=>{const{cache:s}=Object.assign({},Ct,u||{});if(s&&c&&o.has(c))return o.get(c);const v={},f=new Set;let d={value:null},g=()=>{};return l.push(v),c&&i&&(g=()=>c(d.value),d.value=Z(n,t,r,f,l,g,v),t.value=!0,i(d.value),t.value=!1),d.value||(d.value=Z(n,t,r,f,l),c&&(g=()=>c(d.value),r.add(g))),c&&(xt(g,r,v,f),o.set(c,d.value)),d.value}}function Z(e,t,n,r,l,o,c){return new Proxy(e,{get(i,u){return o&&c&&t.value&&(c[u]??(c[u]=new Set),c[u].has(o)||(c[u].add(o),r.add(u))),i[u]},set(i,u,s){return i[u]===s||(i[u]=s,wt(n,l,u)),!0}})}function wt(e,t=[],n){const r=new Set;te(e).forEach(l=>r.add(l)),(t||[]).forEach(l=>{const o=l[n]||new Set;te(o).forEach(c=>r.add(c)),ee(r,o)}),ee(r,e)}function ee(e,t){e.forEach(n=>{t.delete(n)})}function te(e){const t=[];return e.forEach(n=>{n()===!1&&t.push(n)}),t}function xt(e,t,n,r){const l=e();l instanceof AbortSignal&&l.addEventListener("abort",()=>{const o=n||{};t.delete(e),Object.entries(o).forEach(([c,i])=>{i.delete(e),r.delete(c)})})}const Nt=ge((e,t,n)=>{const r=B(1,e),l=B('"destructuring" the "props" value directly from the mount function will cause referencing issues, so if you want to use it, you need to "destructuring" it from the internal function (updater).',e),o=()=>t.parentValue,c=t.parentValue,i=Pt(()=>r.v+s+t.parentValue),u=Rt({text:"s",count:0})(e);let s=t.parentValue;const v=bt(null),f=()=>{r.v=r.v+1,s+=1},d=M=>{l.v=M.target.value},g=()=>{u.count+=1,u.text+="1"},Pe=()=>(console.log("MOUNTED",v),()=>console.log("UNMOUNT")),Se=()=>(console.log("UPDATE - parentValue"),()=>console.log("UPDATED"));return ce(Pe),me(Se,()=>[t.parentValue]),St(()=>console.log("INJECT"),()=>console.log("CLEAN_UP"),()=>[r.v]),({parentValue:M})=>a(x,{children:[a("div",{children:a("textarea",{value:l.v,onInput:d,style:{width:"300px",height:"100px"}})}),a("div",{children:l.v}),a("div",{children:[a("div",{style:{color:"blue"},children:["parentValueFromRef: ",t.parentValue," (working)"]}),a("div",{style:{color:"blue"},children:["parentValueFromFunction: ",o()," (working)"]}),a("div",{style:{color:"blue"},children:["parentValueFromUpdaterDestructuring: ",M," (working)"]}),a("div",{style:{color:"red"},children:["parentValueFromMounterDestructuring: ",c," (not working)"]})]}),a("div",{children:[a("div",{ref:v,children:["count: ",r.v]}),a("div",{children:["sum: ",r.v+s+t.parentValue]}),a("div",{children:["sum(computed): ",i.v]}),a("div",{children:["notRefValue: ",s]}),a("div",{children:["localStore(text): ",u.text]}),a("div",{children:["localStore(count): ",u.count]})]}),a("button",{onClick:f,children:"Increase"}),a("button",{onClick:g,children:"localStoreUpdate"}),n]})}),Ut=ge(e=>{const t=B(7,e),n=()=>{t.v=t.v+1},r=()=>{t.v=t.v-1};return()=>a(x,{children:[a(Nt,{parentValue:t.v,children:a("button",{onClick:n,children:"Increase - Parent"})}),a("button",{onClick:r,children:"Decrease - Parent"})]})}),Lt=a(Ut,{});Ke(Lt,document.getElementById("root"));
|
|
2
|
-
//# sourceMappingURL=index-
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function n(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(l){if(l.ep)return;l.ep=!0;const o=n(l);fetch(l.href,o)}})();const E=e=>typeof e=="object"&&!("resolve"in e),N=(e,t)=>E(e)&&e.type===t,Ce=(e,t)=>"ctor"in e?e.ctor===(t==null?void 0:t.ctor):e===(t==null?void 0:t.ctor),Re=(e,t)=>{var n,r;return E(e)&&(t==null?void 0:t.type)==="fragment"&&((n=t==null?void 0:t.children)==null?void 0:n.length)===((r=e==null?void 0:e.children)==null?void 0:r.length)},we=(e,t)=>{var n,r;return E(e)&&(t==null?void 0:t.type)==="element"&&(t==null?void 0:t.tag)===e.tag&&((n=t==null?void 0:t.children)==null?void 0:n.length)===((r=e==null?void 0:e.children)==null?void 0:r.length)},J=(e,t)=>E(e)&&(t==null?void 0:t.type)===e.type,xe=(e,t)=>{var n,r;return E(e)&&(t==null?void 0:t.type)===e.type&&(S(h((e.children||[])[0]))&&S(h(((t==null?void 0:t.children)||[])[0]))||((n=t==null?void 0:t.children)==null?void 0:n.length)===((r=e==null?void 0:e.children)==null?void 0:r.length))},h=e=>{var t,n;return((t=e==null?void 0:e.compProps)==null?void 0:t.key)??((n=e==null?void 0:e.props)==null?void 0:n.key)},y=e=>e&&["fragment","loop"].includes(e),U=e=>typeof e=="function"&&!ne(e)||typeof e=="object"&&"resolve"in e,ne=e=>typeof e=="function"&&e===x,re=e=>E(e)&&!e.type,S=e=>e!=null,_=(e,t)=>e==="style"&&typeof t=="object",Ne=(e,t)=>e==="ref"&&typeof t=="object",Ue=(e,t)=>{const n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);return n&&n.get&&n.set},Le=e=>{let t="et";return U(e)?t="c":N(e,"fragment")?t="f":N(e,"element")?t="e":N(e,"loop")?t="l":N(e,"text")?t="t":re(e)&&(t="et"),t},Oe={c:Ce,l:xe,t:J,e:we,f:Re,et:J},P=Symbol.for("lithentWDomSymbol"),b={value:""},R={value:{}},j={value:!1},p=new WeakMap,Ve=e=>{p.set(e,{vd:{value:null},up:()=>{},upR:[],upS:{value:0},upD:[],upCB:[],mts:[],umts:[]})},w=()=>R.value,z=(e,t)=>p.get(e)?p.get(e)[t]:null,Ae=e=>R.value=e,Te=e=>{R.value=e,Ve(e)},m=e=>e.getParent&&e.getParent(),C=Object.entries,le=Object.keys,L=Object.assign,De=e=>{p.get(w()).umts.push(e)},O=e=>{const{compKey:t}=e;t&&Me(t),oe(e)},oe=e=>{(e.children||[]).forEach(t=>{t.compKey?O(t):oe(t)})},Me=e=>{const t=p.get(e);t&&(t.umts.forEach(n=>n()),t.umts=[],p.delete(e))};let k=[];const H=()=>{k.forEach(e=>ke(e)),k=[]},je=e=>{e.compKey&&k.push(e)},ce=e=>{var t;return(((t=p.get(w()))==null?void 0:t.mts)||[]).push(e)},ke=e=>{const{compKey:t}=e;if(t){const n=p.get(t),r=n==null?void 0:n.mts,l=n==null?void 0:n.upS;R.value=t,l&&(l.value=0),r&&(n.mts=[],r.forEach(o=>{const c=o();c&&De(c)}))}},G=(e,t=()=>[])=>{const n=p.get(w()),{upD:r,upS:l}=n,o=r[l.value];if(o&&Fe(o,t())){const c=e();c&&n.upCB.push(c)}r[l.value]=t(),l.value+=1},$e=e=>{const{compKey:t}=e;if(t){const n=p.get(t),r=n==null?void 0:n.upCB,l=n==null?void 0:n.upS;R.value=t,l&&(l.value=0),e.ctor&&r&&(n.upCB=[],r.forEach(o=>o()))}},Fe=(e,t)=>e.length?e.some((n,r)=>n!==t[r]):!0,Ie=e=>e==="className"?"class":e,ue=e=>e.replace(/^on(.*)/,(t,n)=>n.toLowerCase()),W=()=>new DocumentFragment,Q=e=>document.createElement(e),Ke=(e,t,n,r)=>{e.isRoot=!0,t??(t=document.body),e.wrapElement=t;const l=A(e,r);return t.tagName==="HTML"?t.replaceWith(l):t.appendChild(l),H(),()=>{var o;const c=(o=p.get(e.compProps||{}))==null?void 0:o.vd.value;c&&O(c),V(c||e),Be(c||e)}},ie=e=>{const{needRerender:t}=e;t&&t!=="N"&&({A:Y,D:q,R:We,U:F,CNSU:F,SR:se,SU:He}[t](e),delete e.needRerender,delete e.oldChildren,delete e.oldProps)},V=e=>{e.props&&e.el&&he(e.props,e.el),(e.children||[]).forEach(t=>{V(t)})},Be=e=>{de(e,e.wrapElement)},q=e=>{e.oldProps&&e.el&&he(e.oldProps,e.el),de(e,T(m(e)))},de=(e,t)=>{var n,r;t&&e.el&&([1,3].includes((n=e.el)==null?void 0:n.nodeType)?t.removeChild(e.el):((r=e.el)==null?void 0:r.nodeType)===11&&ae(e),delete e.el)},ae=(e,t)=>{((e==null?void 0:e.oldChildren)||(e==null?void 0:e.children)||[]).forEach(n=>{var r;const l=(r=n.el)==null?void 0:r.nodeType;l&&([1,3].includes(l)?n.el.tagName==="HTML"?n.el.innerHTML="":n.el.remove():l===11&&ae(n))})},se=e=>{q(e),Y(e)},He=e=>{if(F(e),m(e).needRerender!=="CNSU"){const t=pe(e);Y(e,t)}},Y=(e,t)=>{t||(t=A(e));const n=m(e);if(n.type){const r=T(n),l=n.type==="loop"&&n.needRerender&&n.needRerender!=="CNSU"?$(n,m(n)):$(e,n);t&&r&&(e.tag!=="portal"&&(l?r.insertBefore(t,l):r.appendChild(t)),H())}},pe=e=>y(e.type)?((e==null?void 0:e.children)||[]).reduce((t,n)=>{const r=pe(n);return r&&t.appendChild(r),t},W()):e.el,$=(e,t)=>{const n=t.children||[],r=n.indexOf(e)+1,l=n.slice(r),o=ve(l),c=t.type||"";if(o)return o;if(!t.isRoot&&y(c))return $(t,m(t));if(t.isRoot&&y(c)&&t.afterElement)return t.afterElement},ve=e=>e.reduce((t,n)=>{const r=n.type,l=n.el,o=r&&y(r);return t||(o?ve(n.children||[]):l&&l.nodeType!==11?l:t)},void 0),We=e=>{const t=m(e),n=e.el;if(t.type&&n)if(n.nodeType===11)se(e);else{const r=T(t),l=A(e);r&&e.tag!=="portal"&&r.replaceChild(l,n),H()}},he=(e,t)=>{C(e||{}).forEach(([n,r])=>{n.match(/^on/)&&t.removeEventListener(ue(n),r)})},F=e=>{var t;const n=e.el;if(e.type==="text"){qe(e);return}if(n){const{oldProps:r,props:l}=e;fe(l,n,r),delete e.oldProps,e.tag==="input"&&(n.value=String(((t=e==null?void 0:e.props)==null?void 0:t.value)||""))}(e.children||[]).forEach(r=>ie(r)),$e(e)},qe=e=>{const t=e.el;t&&(t.nodeValue=String(e.text))},fe=(e,t,n,r)=>{const l={...n};C(e||{}).forEach(([o,c])=>{o==="key"||c===l[o]||o==="portal"&&typeof c=="object"||(o==="innerHTML"&&typeof c=="string"?t.innerHTML=c:_(o,c)?ze(c,_(o,l.style)?l.style:{},t):Ne(o,c)?c.value=t:o.match(/^on/)?_e(t,o,c,l[o]):o&&(o!=="type"&&Ue(t,o)?t[o]=c:Ye(Ie(o),t,c))),delete l[o]}),le(l).forEach(o=>t.removeAttribute(o))},Ye=(e,t,n)=>{b.value&&e!=="xmlns"?t.setAttributeNS(null,e,n):t.setAttribute(e,n)},A=(e,t)=>{let n;const{type:r,tag:l,text:o,props:c,children:i=[]}=e,u=y(r);return l==="svg"&&(b.value=String(c==null?void 0:c.xmlns)),u?n=W():r==="element"&&l?l==="portal"&&c!=null&&c.portal?n=c.portal:n=b.value?document.createElementNS(b.value,l):Q(l):r==="text"&&S(o)?n=document.createTextNode(String(o)):n=Q("e"),e.el=n,Je(i,n,t),fe(c,n,null),je(e),l==="svg"&&(b.value=""),n},Je=(e,t,n)=>{const r=e.reduce((l,o)=>{if(o.type){const c=A(o,n);o.tag!=="portal"&&!n&&l.appendChild(c)}return l},W());t&&r.hasChildNodes()&&t.appendChild(r)},_e=(e,t,n,r)=>{const l=ue(t);r!==n&&(r&&e.removeEventListener(l,r),n&&e.addEventListener(l,n))},ze=(e,t,n)=>{const r={...t},l=n==null?void 0:n.style;l&&(C(e).forEach(([o,c])=>{l[o]=c,delete r[o]}),C(r).forEach(([o])=>l[o]=""))},T=e=>{const t=y(e.type);return e.isRoot&&t?e.wrapElement:t?T(m(e)):e.el},D=(e,t)=>Ge(e,Oe[Le(e)](e,t),t),Ge=(e,t,n)=>{const r=rt(e,t,n),l=[r,t,n],o=Xe(...l),c=o==="N";return c||(r.children=lt(...l)),r.needRerender=o,Qe(r,n,o),!c&&n&&(n.isLegacy=!0,delete n.children),r},Qe=(e,t,n)=>{n!=="A"&&t&&(e.el=t.el),n&&["D","R","SR"].includes(n)&&(t&&(O(t),V(t)),e.oldChildren=t==null?void 0:t.children),e.oldProps=t==null?void 0:t.props},Xe=(e,t,n)=>{const r=n&&n.type,l=re(e),o=e.isRoot,c=n&&m(n),i=!o&&(c==null?void 0:c.type),u=h(e),s=i==="loop"&&S(u),v=e.type==="text"&&t&&e.text===(n==null?void 0:n.text),f=e===n;let a;return l?a="D":v||f?a="N":r?t?a=s?"SU":"U":a=s?"SR":"R":a="A",e.type==="loop"&&a==="U"&&n&&Ze(e,n)&&(a="CNSU"),a},Ze=(e,t)=>{const n=[...(t==null?void 0:t.children)||[]],r=[...(e==null?void 0:e.children)||[]].filter(c=>n.find(i=>h(c)===h(i))),l=n.filter(c=>r.find(i=>h(c)===h(i)));let o=l.length===r.length;return o&&(o=l.every((c,i)=>h(c)===h(r[i]))),o},et=(e,t)=>{e&&t!==e&&(le(e).forEach(n=>delete e[n]),C(t||{}).forEach(([n,r])=>e[n]=r))},tt=(e,t)=>{e&&t!==e&&(e.splice(0,e.length),t&&t.forEach(n=>e.push(n)))},nt=(e,t)=>{const{compProps:n,compChild:r}=e,{props:l,children:o}=t;return n&&et(n,l),r&&tt(r,o),e.reRender&&e.reRender()},rt=(e,t,n)=>U(e)?t&&n?nt(n,e):e.resolve():e,lt=(e,t,n)=>t&&n?ct(e,n):ot(e),ot=e=>(e.children||[]).map(t=>L(D(t),{getParent:()=>e})),ct=(e,t)=>e.type==="loop"&&S(h((e.children||[])[0]))?ut(e,t):(e.children||[]).map((n,r)=>L(D(n,(t.children||[])[r]),{getParent:()=>e})),ut=(e,t)=>{const[n,r]=it(e,t);return r.forEach(l=>{O(l),V(l),q(l)}),n},it=(e,t)=>{const n=[...e.children||[]],r=[...t.children||[]];return[n.map(l=>{const o=dt(l,r),c=D(l,o);return o&&r.splice(r.indexOf(o),1),c.getParent=()=>e,c}),r]},dt=(e,t)=>t.find(n=>h(n)===h(e)),I=new Map;let K=!1;const at=(e,t)=>{p.get(e)&&(p.get(e).up=()=>{I.set(e,t),K||(K=!0,queueMicrotask(pt))})},st=e=>()=>{var t;const n=(t=p.get(e))==null?void 0:t.up;let r=!1;return n&&(n(),r=!0),r},pt=()=>{I.forEach(e=>{e()}),I.clear(),K=!1},me=(e,t=()=>[])=>{p.get(w()).upR.push(()=>G(e,t)),G(e,t)},vt=()=>{var e;const t=(e=p.get(w()))==null?void 0:e.upR;t!=null&&t.length&&t.forEach(n=>n())},x=(e,...t)=>({type:"fragment",[P]:!0,children:t}),X=(e,t,...n)=>{const r={value:void 0},l=t||{},o=be(r,n),c=yt(e,l,o);return U(c)||(r.value=c),c},ge=e=>(t,n)=>e,ht=(e,t,n,r)=>{var l;if(r.isLegacy)return;j.value=!0;const o=ye(e,t,n),c=D(o,r),{isRoot:i,getParent:u,wrapElement:s,afterElement:v}=r;if(c.getParent=u,!i&&u){const f=((l=u())==null?void 0:l.children)||[],a=f.indexOf(r);f.splice(a,1,c)}else c.isRoot=!0,c.wrapElement=s,c.afterElement=v;j.value=!1,ie(c)},ye=(e,t,n)=>({tagName:e.name,ctor:e,props:t,children:n,resolve:(r=t)=>{Te(r);const l=e(t,n),o=(typeof l=="function"?l:()=>()=>l)(st(r),t,n);return ft(o,r,e,t,n)}}),ft=(e,t,n,r,l)=>{let o=e,c=e(r);c.reRender&&(o=u=>{const s=e(u),v=x({},s);return s.getParent=()=>v,v},c=o(r));const i=mt(o,t,n,r,l);return Ee(c,t,n,r,l,i),c},mt=(e,t,n,r,l)=>{const o=()=>gt(e,t,n,r,l,o);return o},gt=(e,t,n,r,l,o)=>{Ae(t),vt();const c=e(r);return Ee(c,t,n,r,l,o),c},Ee=(e,t,n,r,l,o)=>{L(e,{compProps:r,compChild:l,ctor:n,tagName:n.name,compKey:t,reRender:o}),at(t,()=>ht(n,r,l,e)),z(t,"vd")&&(z(t,"vd").value=e)},yt=(e,t,n)=>{if(ne(e))return x(t,...n);if(U(e)){const r=ye(e,t,n);return j.value?r:r.resolve()}return{type:"element",[P]:!0,tag:e,props:t,children:n}},be=(e,t)=>t.map(n=>L(Et(n),{getParent:()=>e.value})),Et=e=>{if(e==null||e===!1)return{type:null,[P]:!0};if(Array.isArray(e)){const t={value:void 0},n=be(t,e),r={type:"loop",[P]:!0,children:n};return t.value=r,r}else if(typeof e=="string"||typeof e=="number")return{type:"text",[P]:!0,text:e};return e},bt=e=>({value:e});function d(e,t,n,r,l,o){const{children:c,...i}=t;if(c!=null){const u=Array.isArray(c)?c:[c];return X(e,{...i,key:n},...u)}return X(e,{...i,key:n})}const B=(e,t)=>{let n=e;return{get value(){return n},get v(){return n},set value(r){n=r,t()},set v(r){n=r,t()}}},Pt=e=>{let t=e;return{get value(){return t()},get v(){return t()},set value(n){throw new Error("You can't change 'computed'")},set v(n){throw new Error("You can't change 'computed'")}}},St=(e,t=()=>{},n=()=>[])=>{ce(()=>(e(),t)),me(()=>(t&&t(),e),n)},Ct={cache:!0};function Rt(e){const t={value:!1},n=!Array.isArray(e)&&typeof e=="object"&&e!==null?e:{value:e},r=new Set,l=[],o=new WeakMap;return(c,i,u)=>{const{cache:s}=Object.assign({},Ct,u||{});if(s&&c&&o.has(c))return o.get(c);const v={},f=new Set;let a={value:null},g=()=>{};return l.push(v),c&&i&&(g=()=>c(a.value),a.value=Z(n,t,r,f,l,g,v),t.value=!0,i(a.value),t.value=!1),a.value||(a.value=Z(n,t,r,f,l),c&&(g=()=>c(a.value),r.add(g))),c&&(xt(g,r,v,f),o.set(c,a.value)),a.value}}function Z(e,t,n,r,l,o,c){return new Proxy(e,{get(i,u){return o&&c&&t.value&&(c[u]??(c[u]=new Set),c[u].has(o)||(c[u].add(o),r.add(u))),i[u]},set(i,u,s){return i[u]===s||(i[u]=s,wt(n,l,u)),!0}})}function wt(e,t=[],n){const r=new Set;te(e).forEach(l=>r.add(l)),(t||[]).forEach(l=>{const o=l[n]||new Set;te(o).forEach(c=>r.add(c)),ee(r,o)}),ee(r,e)}function ee(e,t){e.forEach(n=>{t.delete(n)})}function te(e){const t=[];return e.forEach(n=>{n()===!1&&t.push(n)}),t}function xt(e,t,n,r){const l=e();l instanceof AbortSignal&&l.addEventListener("abort",()=>{const o=n||{};t.delete(e),Object.entries(o).forEach(([c,i])=>{i.delete(e),r.delete(c)})})}const Nt=ge((e,t,n)=>{const r=B(1,e),l=B('"destructuring" the "props" value directly from the mount function will cause referencing issues, so if you want to use it, you need to "destructuring" it from the internal function (updater).',e),o=()=>t.parentValue,c=t.parentValue,i=Pt(()=>r.v+s+t.parentValue),u=Rt({text:"s",count:0})(e);let s=t.parentValue;const v=bt(null),f=()=>{r.v=r.v+1,s+=1},a=M=>{l.v=M.target.value},g=()=>{u.count+=1,u.text+="1"},Pe=()=>(console.log("MOUNTED",v),()=>console.log("UNMOUNT")),Se=()=>(console.log("UPDATE - parentValue"),()=>console.log("UPDATED"));return ce(Pe),me(Se,()=>[t.parentValue]),St(()=>console.log("INJECT"),()=>console.log("CLEAN_UP"),()=>[r.v]),({parentValue:M})=>d(x,{children:[d("div",{children:d("textarea",{value:l.v,onInput:a,style:{width:"300px",height:"100px"}})}),d("div",{children:l.v}),d("div",{children:[d("div",{style:{color:"blue"},children:["parentValueFromRef: ",t.parentValue," (working)"]}),d("div",{style:{color:"blue"},children:["parentValueFromFunction: ",o()," (working)"]}),d("div",{style:{color:"blue"},children:["parentValueFromUpdaterDestructuring: ",M," (working)"]}),d("div",{style:{color:"red"},children:["parentValueFromMounterDestructuring: ",c," (not working)"]})]}),d("div",{children:[d("div",{ref:v,children:["count: ",r.v]}),d("div",{children:["sum: ",r.v+s+t.parentValue]}),d("div",{children:["sum(computed): ",i.v]}),d("div",{children:["notRefValue: ",s]}),d("div",{children:["localStore(text): ",u.text]}),d("div",{children:["localStore(count): ",u.count]})]}),d("button",{onClick:f,children:"Increase"}),d("button",{onClick:g,children:"localStoreUpdate"}),n]})}),Ut=ge(e=>{const t=B(7,e),n=()=>{t.v=t.v+1},r=()=>{t.v=t.v-1};return()=>d(x,{children:[d(Nt,{parentValue:t.v,children:d("button",{onClick:n,children:"Increase - Parent"})}),d("button",{onClick:r,children:"Decrease - Parent"})]})}),Lt=d(Ut,{});Ke(Lt,document.getElementById("root"));
|
|
2
|
+
//# sourceMappingURL=index-GZ-P6cMy.js.map
|