ezh 0.3.8 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/el.min.js +1 -1
- package/lib/index.d.ts +2 -2
- package/package.json +3 -3
package/lib/el.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e={ariaAtomic:"aria-atomic",ariaAutoComplete:"aria-autocomplete",ariaBrailleLabel:"aria-braillelabel",ariaBrailleRoleDescription:"aria-brailleroledescription",ariaBusy:"aria-busy",ariaChecked:"aria-checked",ariaColCount:"aria-colcount",ariaColIndex:"aria-colindex",ariaColIndexText:"aria-colindextext",ariaColSpan:"aria-colspan",ariaCurrent:"aria-current",ariaDescription:"aria-description",ariaDisabled:"aria-disabled",ariaExpanded:"aria-expanded",ariaHasPopup:"aria-haspopup",ariaHidden:"aria-hidden",ariaInvalid:"aria-invalid",ariaKeyShortcuts:"aria-keyshortcuts",ariaLabel:"aria-label",ariaLevel:"aria-level",ariaLive:"aria-live",ariaModal:"aria-modal",ariaMultiLine:"aria-multiline",ariaMultiSelectable:"aria-multiselectable",ariaOrientation:"aria-orientation",ariaPlaceholder:"aria-placeholder",ariaPosInSet:"aria-posinset",ariaPressed:"aria-pressed",ariaReadOnly:"aria-readonly",ariaRequired:"aria-required",ariaRoleDescription:"aria-roledescription",ariaRowCount:"aria-rowcount",ariaRowIndex:"aria-rowindex",ariaRowIndexText:"aria-rowindextext",ariaRowSpan:"aria-rowspan",ariaSelected:"aria-selected",ariaSetSize:"aria-setsize",ariaSort:"aria-sort",ariaValueMax:"aria-valuemax",ariaValueMin:"aria-valuemin",ariaValueNow:"aria-valuenow",ariaValueText:"aria-valuetext",alignmentBaseline:"alignment-baseline",annotationXml:"annotation-xml",baselineShift:"baseline-shift",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",pointerEvents:"pointer-events",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strokeDasharray:"stroke-dasharray",strokeDashoffset:"stroke-dashoffset",strokeLinecap:"stroke-linecap",strokeLinejoin:"stroke-linejoin",strokeMiterlimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",style:"style",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",unicodeBidi:"unicode-bidi",vectorEffect:"vector-effect",wordSpacing:"word-spacing",writingMode:"writing-mode"},t={},i=[];Object.freeze(t),Object.freeze(i);const n=()=>!1,r=new Set,a=new Set,s=new class{constructor(){this.c=[]}ax(){return!this.c.length}pop(){const{c:e}=this,t=e.pop(),i=e[0];if(t){if(!i)return t;const{length:n}=e,r=n>>>1;let a,s,o,l=0;for(;l<r&&(o=2*l+1,a=e[o],o+1<n&&(s=e[o+1],s.id<a.id&&(a=s,o++)),a.id<t.id);)e[l]=a,l=o;e[l]=t}return i}O(e){const{c:t}=this;let i,n,r=t.push(e)-1;for(;r&&e.id<(i=t[n=r-1>>>1]).id;)t[r]=i,r=n;t[r]=e}c},o=new Map,l=new Set,h=[],d=[],c={id:"",index:0,firstElement:null,attachTo:n,move:n,detachFrom:n,update:n,refresh:n,release:n,ver:0,markChanged:n,watchMountChange:n,onMountChange:n};let f,u="",m=2e4,p=0,g=0;const w=new Map;let v=c;let b=(e,t)=>document.createElement(e);const x={svg:(e,t)=>(t.a2(),document.createElementNS("http://www.w3.org/2000/svg",e)),math:(e,t)=>(t.a2(),document.createElementNS("http://www.w3.org/1998/Math/MathML",e)),foreignObject:(e,t)=>"foreignObject"!==e?document.createElement(e):(t.a2(),document.createElementNS("http://www.w3.org/2000/svg",e))},k=()=>{if(++g>=p){for(const e of a)if(a.delete(e),e.id)e.release();else if(--g<p){a.add(e);break}}else a.add(Object.create(c));f&&(f=setTimeout(k,m))},C=(e,t)=>{t&&(e.watchMountChange("r",void 0),s.O(e))},y=()=>{let e;do{for(;e=s.pop();){const{newChildren:t,parent:i}=e;t&&(i&&S(i)?(e.refresh(t),i.currentBefore=void 0):e.ver&&e.watchMountChange("r",C))}for(const[i,n]of o){const{parent:r}=i,a=!!r&&S(r);a!==n&&(o.set(i,a),i.onMountChange(a),e=t)}}while(e);if(r.size){if(p)for(const e of r)e.parent||a.add(e);else for(const e of r)e.parent||e.release();r.clear()}if(l.size){for(const e of l){const{parent:t,$w:i}=e,{onMounted:n}=i;n&&t&&S(t)&&n()}l.clear()}},E=(e,t=[],i=0)=>{let n=e[i];for(;;){if(n&&void 0!==n.id)t.push(n);else if(null!=n)switch(typeof n){case"object":E(n,t);break;case"function":n=n();continue;case"boolean":case"number":case"bigint":n=""+n;default:t.push(new $("",n))}if(!(++i<e.length))break;n=e[i]}return t},B=(e,t,i)=>{let n;const r=e.length;let a=t,s=0;for(;s<r;){const t=e[s];if(t!==a[s]){if(s===a.length)return a;const e=a[s];if(!e||void 0===e.id){a=E(a,a.slice(0,s),s);continue}if(n!==a)break}n||t.parent===i||(n=e),s++}return s===a.length?n:a===t?E(a,e.slice(0,s),s):a},S=e=>{let t=e;do{if(t.parent===t)return!0;t=t.parent}while(t);return!1},M=(e,t,i,n)=>{let r,a,s;if(t!==e&&e.length){const o=[];let l;for(a=t.length,r=1e7;--a>=0;)if(s=t[a],s.parent===i){const e=a-s.index;e===r?(l.size++,s.index=a):(l={from:s.index,to:a,size:1},r=e,s.index=-o.push(l))}else 1e7!==r&&(r=1e7);const h=[];for(a=e.length-1;a>=0;)s=e[a],s.index<0?(l=o[-s.index-1],h.push(l),a-=l.size):(s.detachFrom(i),a--);let d,c,f=0;for(a=t.length-1;a>=0;)if(s=t[a],s.parent!==i)s.index=a--,s.attachTo(i);else{if(l=o[-s.index-1],c=l.size,d=h[f],s.index=a,!n){if(d===l){f++,a-=l.size,i.currentBefore=void 0;continue}if(d.from>l.from){r=f;do{c-=d.size,d=h[++r]}while(d.from>l.from&&c>0);if(c>0){a-=l.size,i.currentBefore=void 0,f=r;continue}}}r=a-l.size;do{s.move()}while(--a>r&&(s=t[a]))}}else for(a=t.length-1;a>=0;a--)s=t[a],s.index=a,i!==s.parent&&s.attachTo(i);i.currentBefore=void 0};class ${constructor(e,t){this.id=e,this.index=0,this.a9=t}id;parent;index;firstElement;attachTo(e){this.firstElement||(this.firstElement=document.createTextNode(this.a9));const{parent:t,firstElement:i,index:n}=this;this.id&&(t?(r.add(this),i.remove()):a.delete(this)),this.parent=e;let s=e.currentBefore;void 0===s&&(s=e.findNextSiblingElement(n)),e.element.insertBefore(i,s),e.currentBefore=i}move(){const{parent:e,index:t,firstElement:i}=this;let n=e.currentBefore;void 0===n&&(n=e.findNextSiblingElement(t)),e.element.insertBefore(i,n),e.currentBefore=i}detachFrom(e){this.parent===e&&(this.firstElement.remove(),this.parent=void 0,this.id&&r.add(this))}update(e){return this.a9!==e&&(this.a9=e,this.firstElement&&(this.firstElement.nodeValue=e)),!1}refresh(){}release(e){this.parent===e&&(e&&this.firstElement.remove(),w.delete(this.id))}a9}class A{constructor(e,t,n){this.id=e,this.index=0,this.newChildren=this.d=n?E(t):t||i}id;parent;index;newChildren;currentBefore;get element(){return this.parent.element}get firstElement(){const{d:e}=this;for(let t=0;t<e.length;t++){const i=e[t].firstElement;if(i)return i}return null}attachTo(e){const{parent:t,d:i,newChildren:n}=this;if(t){r.add(this);for(let e=i.length-1;e>=0;e--)i[e].detachFrom(this)}else a.delete(this);this.parent=e;const s=n||i;for(let e=s.length-1;e>=0;e--){const t=s[e];t.index=e,t.attachTo(this)}e.currentBefore=this.currentBefore,this.currentBefore=void 0,this.d=s,this.newChildren=void 0}move(){const{d:e,newChildren:t}=this;if(t)M(e,t,this,!0),this.d=t,this.newChildren=void 0;else{for(let t=e.length-1;t>=0;t--)e[t].move();this.currentBefore=void 0}}detachFrom(e){if(this.parent===e){const{d:e}=this;for(const t of e)t.detachFrom(this);this.parent=void 0,r.add(this)}}update(e,t){if(t){const e=B(this.d,t,this);if(e)return this.newChildren=e,!0}return!1}refresh(e){M(this.d,e,this),this.d=e,this.newChildren=void 0}release(e){if(this.parent===e){if(e){const{d:e}=this;for(const t of e)t.detachFrom(this)}w.delete(this.id)}}findNextSiblingElement(e){const t=this.newChildren||this.d;let i,n=e+1,r=t[n];for(;r;){if(i=r.firstElement,i)return i;r=t[++n]}return i=this.parent.currentBefore,void 0!==i?i:this.parent.findNextSiblingElement(this.index)}d}class z{constructor(e,n,r,a,s,o){if(this.id=e,this.index=0,this.firstElement=this.element=b(n,this),this.newChildren=this.d=o?E(a):a||i,r){if(this.m=t,this.q=-1,"select"===n){const e=this.element,t=r,i=t.value;if(i){t.value=void 0;const n=this.refresh;this.refresh=r=>{if(M(this.d,r,this),this.d=r,this.newChildren=void 0,Array.isArray(i)){const t=i,[n,r,a]=t;e.value=a;const s=t[3]=e=>n[r]=e.target.value;e.addEventListener("change",s)}else e.value=i;t.value=i,this.refresh=n}}}this.update(r),this.q=s??0}else this.m=r,this.q=0}id;element;parent;newChildren;index;currentBefore;firstElement;attachTo(e){const{parent:t,element:i,newChildren:n,index:r}=this;t?i.remove():a.delete(this),this.parent=e,n&&this.refresh(n);let s=e.currentBefore;void 0===s&&(s=e.findNextSiblingElement(r)),e.element.insertBefore(i,s),e.currentBefore=i}move(){const{parent:e,newChildren:t,index:i,element:n}=this;t&&this.refresh(t);let r=e.currentBefore;void 0===r&&(r=e.findNextSiblingElement(i)),e.element.insertBefore(n,r),e.currentBefore=n}detachFrom(e){this.parent===e&&(this.element.remove(),this.parent=void 0,r.add(this))}update(i,n){const{element:r,m:a,q:s}=this;if(a&&s){this.m=i;let n=s;for(const s in i){const o=i[s],l=a[s];if(o!==l)if(null!=o)switch(typeof o){case"string":{const t=e[s];t?r.setAttribute(t,o):r[s]=o;break}case"number":case"boolean":case"function":r[s]=o;break;default:if(Array.isArray(o)){const[e,t,i]=o;if(l){const[n,a,h,d]=l;if(h!==i&&r[s]!==i&&(r[s]=i),n===e&&a===t)o[3]=d;else{const i=o[3]=i=>e[t]=i.target[s];r.removeEventListener("change",d),r.addEventListener("change",i)}}else{r[s]=i;const n=o[3]=i=>e[t]=i.target[s];r.addEventListener("change",n)}break}if("style"===s){if(!l){const e=r.style,t={};let n=0;for(const i in o){const r=o[i];t[i]=r,n++,e[i]=r}i[s]=t,t.i=n;break}const e=r.style,t={};let n=0,a=l.i;for(const i in o){const r=o[i];t[i]=r,i in l&&a--,n++,r!==l[s]&&(e[i]=r)}if(i[s]=t,t.i=n,a)for(const t in l)if(!(t in o)&&(e[t]=null,! --a))break;break}r[s]=o}else switch(typeof l){case"string":{const t=e[s];t?this.element.removeAttribute(t):this.element[s]=o;break}case"object":l?Array.isArray(l)?r.removeEventListener("change",l[3]):l===t&&(r[s]=o):r[s]=o;break;default:r[s]=o}if(! --n)break}}if(n){const e=B(this.d,n,this);if(e)return this.newChildren=e,!0}return!1}refresh(e){M(this.d,e,this),this.d=e,this.newChildren=void 0}release(e){if(this.parent===e){e&&this.element.remove();const{d:t}=this;for(const e of t)e.release(this);w.delete(this.id)}}findNextSiblingElement(e){const t=this.newChildren||this.d;let i,n=e+1,r=t[n];for(;r;){if(i=r.firstElement,i)return i;r=t[++n]}return null}a2(){this.update=this.aI}aI(t,i){const{element:n,m:r,q:a}=this;if(r&&a){this.m=t;let i=a;for(const a in t){const s=t[a],o=r[a];if(s!==o)if(null!=s)switch(typeof s){case"string":n.setAttribute(e[a]??a,s);break;case"number":case"boolean":n.setAttribute(e[a]??a,""+s);break;case"function":n[a]=s;break;default:if("style"===a){if(!o){const e=n.style,i={};let r=0;for(const t in s){const n=s[t];i[t]=n,r++,e[t]=n}t[a]=i,i.i=r;break}const e=n.style,i={};let r=0,l=o.i;for(const t in s){const n=s[t];i[t]=n,t in o&&l--,r++,n!==o[a]&&(e[t]=n)}if(t[a]=i,i.i=r,l)for(const t in o)if(!(t in s)&&(e[t]=null,! --l))break;break}n[a]=s}else{switch(typeof o){case"string":case"number":case"boolean":n.removeAttribute(e[a]??a);break;default:n[a]=s}}if(! --i)break}}if(i){const e=B(this.d,i,this);if(e)return this.newChildren=e,!0}return!1}m;d;q}class T{constructor(e,t,n,r,a,s){this.id=e,this.index=0,this.ver=0,this.Y=t,this.m=n,this.newChildren=this.d=s?E(r):r||i,this.q=a??0}id;parent;newChildren;index;ver;$;get firstElement(){return this.h?.firstElement||null}attachTo(e){const{parent:t,newChildren:i,h:n}=this;this.parent=e,i?this.refresh(i):n&&(n.index=this.index,n.attachTo(e)),t||a.delete(this)}move(){const{newChildren:e,h:t}=this;e?this.refresh(e):t&&(t.index=this.index,t.move())}detachFrom(e){this.parent===e&&(this.h?.detachFrom(e),this.parent=void 0,r.add(this))}update(e,t){const{m:i,d:n,q:r}=this;if(this.m=e,t){const e=B(n,t,this.parent);if(e)return this.newChildren=e,!0}if(!this.newChildren&&r){let t=r;for(const r in i){if(i[r]!==e[r])return this.newChildren=n,!0;if(! --t)break}}return!1}refresh(e){const{parent:i,h:n,index:r}=this,a=v;v=this,this.ver++;let s=this.Y(this.m||t,e);if(s!==n)switch(typeof s){case"boolean":case"number":case"bigint":s=""+s;case"string":s=new $("",s),this.h=s,s.index=r,s.attachTo(i),n?.detachFrom(i);break;default:s?(this.h=s,s.index=r,s.attachTo(i),n?.detachFrom(i)):(this.h=void 0,n?.detachFrom(i))}else n&&(n.parent!==i?(n.index=r,n.attachTo(i)):n.index!==r&&(n.index=r,n.move()));this.d=e,this.newChildren=void 0,v=a}release(e){this.parent===e&&(this.h?.release(e),this.parent=void 0,w.delete(this.id),this.A&&(this.A=void 0,o.delete(this)))}markChanged(){this.newChildren||(this.newChildren=this.d,s.ax()&&queueMicrotask(y),s.O(this))}watchMountChange(e,t){const{A:i,parent:n}=this;if(t){if(!i)return this.A=(new Map).set(e,t),void o.set(this,!!n&&S(n));i.set(e,t)}else i?.delete(e)&&(i.size||(this.A=void 0,o.delete(this)))}onMountChange(e){for(const[,t]of this.A)t(this,e)}Y;m;d;q;h;A}class O{constructor(e,t){this.id=e,this.element=t,this.parent=this}id;element;parent;currentBefore;findNextSiblingElement(e){return null}render(e){this.aa||(this.aa=new T(this.id,e,null,i),w.set(this.id,this.aa),this.aa.attachTo(this))}aa}const F=(e,t)=>{if(v.id){let i=e[t];i||(i=new Map,e[t]=i),i.set(v.id,v.ver)}};let R=(e,t)=>{const i=e[t];if(i){for(const[e,t]of i){const i=w.get(e);i?.ver===t&&i.markChanged()}i.clear()}};const L=e=>R=e,N=(e,t)=>{if(!t){e.watchMountChange("w",void 0);const{onUnmounted:t}=e.$w;e.$w=void 0,e.markChanged(),t?.()}},q=(e,t)=>{let i=v.$w;i?(i.onMounted=e,i.onUnmounted=t):(i=v.$w={onMounted:e,onUnmounted:t},e&&l.add(v),v.watchMountChange("w",N))},j=a.delete;a.delete=n;const I=(e,t=2e4)=>{if(e>=0&&t>=1e3){if(m=t,p&&clearTimeout(f),e)a.delete=j,f=setTimeout(k,m);else if(f){f=void 0;for(let e=0;e<p;e++)k();a.delete=n}return p=e,!0}return!1},D=()=>{u=d.pop()};var V;!function(e){e.render=(e,t)=>{const i=(h.length||"")+"|",n=new O(i,e);h.push(n),n.render(t)},e.$=(e,t,i,n,r,a)=>{const o=`${v.id}${e}${u}`;let l=w.get(o);return l?((i||n)&&l.update(i,n)&&s.O(l),l):(l=new z(o,t,i,n,r,a),w.set(o,l),l)},e.$c=(e,t,i,n,r,a)=>{const o=`${v.id}${e}${u}`;let l=w.get(o);return l?((i||n)&&l.update(i,n)&&s.O(l),l):(l=new T(o,t,i,n,r,a),w.set(o,l),l)},e.$f=(e,t,i)=>{const n=`${v.id}${e}${u}`;let r=w.get(n);return r?(t&&r.update(null,t)&&s.O(r),r):(r=new A(n,t,i),w.set(n,r),r)},e.$k=e=>(d.push(u),u=`${u||"{"}${e}}`,D),e.$n=e=>{const t=b;return b=x[e],()=>{b=t}},e.$s=(e,t)=>(e(),t),e.$t=(e,t,i)=>{const n=`${v.id}${e}${u}`;let r=w.get(n);return r?(i&&r.update(t),r):(r=new $(n,t),w.set(r.id,r),r)}}(V||(V={}));export{V as $,F as a,L as b,I as c,v as j,w as l,R as r,q as w};
|
|
1
|
+
const e={ariaAtomic:"aria-atomic",ariaAutoComplete:"aria-autocomplete",ariaBrailleLabel:"aria-braillelabel",ariaBrailleRoleDescription:"aria-brailleroledescription",ariaBusy:"aria-busy",ariaChecked:"aria-checked",ariaColCount:"aria-colcount",ariaColIndex:"aria-colindex",ariaColIndexText:"aria-colindextext",ariaColSpan:"aria-colspan",ariaCurrent:"aria-current",ariaDescription:"aria-description",ariaDisabled:"aria-disabled",ariaExpanded:"aria-expanded",ariaHasPopup:"aria-haspopup",ariaHidden:"aria-hidden",ariaInvalid:"aria-invalid",ariaKeyShortcuts:"aria-keyshortcuts",ariaLabel:"aria-label",ariaLevel:"aria-level",ariaLive:"aria-live",ariaModal:"aria-modal",ariaMultiLine:"aria-multiline",ariaMultiSelectable:"aria-multiselectable",ariaOrientation:"aria-orientation",ariaPlaceholder:"aria-placeholder",ariaPosInSet:"aria-posinset",ariaPressed:"aria-pressed",ariaReadOnly:"aria-readonly",ariaRequired:"aria-required",ariaRoleDescription:"aria-roledescription",ariaRowCount:"aria-rowcount",ariaRowIndex:"aria-rowindex",ariaRowIndexText:"aria-rowindextext",ariaRowSpan:"aria-rowspan",ariaSelected:"aria-selected",ariaSetSize:"aria-setsize",ariaSort:"aria-sort",ariaValueMax:"aria-valuemax",ariaValueMin:"aria-valuemin",ariaValueNow:"aria-valuenow",ariaValueText:"aria-valuetext",alignmentBaseline:"alignment-baseline",annotationXml:"annotation-xml",baselineShift:"baseline-shift",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",pointerEvents:"pointer-events",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strokeDasharray:"stroke-dasharray",strokeDashoffset:"stroke-dashoffset",strokeLinecap:"stroke-linecap",strokeLinejoin:"stroke-linejoin",strokeMiterlimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",style:"style",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",unicodeBidi:"unicode-bidi",vectorEffect:"vector-effect",wordSpacing:"word-spacing",writingMode:"writing-mode"},t={},i=[];Object.freeze(t),Object.freeze(i);const n=()=>!1,r=new Set,a=new Set,s=new class{constructor(){this.c=[]}ax(){return!this.c.length}pop(){const{c:e}=this,t=e.pop(),i=e[0];if(t){if(!i)return t;const{length:n}=e,r=n>>>1;let a,s,o,l=0;for(;l<r&&(o=2*l+1,a=e[o],o+1<n&&(s=e[o+1],s.id<a.id&&(a=s,o++)),a.id<t.id);)e[l]=a,l=o;e[l]=t}return i}O(e){const{c:t}=this;let i,n,r=t.push(e)-1;for(;r&&e.id<(i=t[n=r-1>>>1]).id;)t[r]=i,r=n;t[r]=e}c},o=new Map,l=new Set,h=[],d=[],c={id:"",index:0,firstElement:null,attachTo:n,move:n,detachFrom:n,update:n,refresh:n,release:n,ver:0,markChanged:n,watchMountChange:n,onMountChange:n};let f,u="",m=2e4,p=0,g=0;const w=new Map;let v=c;let b=(e,t)=>document.createElement(e);const x={svg:(e,t)=>(t.a2(),document.createElementNS("http://www.w3.org/2000/svg",e)),math:(e,t)=>(t.a2(),document.createElementNS("http://www.w3.org/1998/Math/MathML",e)),foreignObject:(e,t)=>"foreignObject"!==e?document.createElement(e):(t.a2(),document.createElementNS("http://www.w3.org/2000/svg",e))},k=()=>{if(++g>=p){for(const e of a)if(a.delete(e),e.id)e.release();else if(--g<p){a.add(e);break}}else a.add(Object.create(c));f&&(f=setTimeout(k,m))},C=(e,t)=>{t&&(e.watchMountChange("r",void 0),s.O(e))},y=()=>{let e;do{for(;e=s.pop();){const{newChildren:t,parent:i}=e;t&&(i&&S(i)?(e.refresh(t),i.currentBefore=void 0):e.ver&&e.watchMountChange("r",C))}for(const[i,n]of o){const{parent:r}=i,a=!!r&&S(r);a!==n&&(o.set(i,a),i.onMountChange(a),e=t)}}while(e);if(r.size){if(p)for(const e of r)e.parent||a.add(e);else for(const e of r)e.parent||e.release();r.clear()}if(l.size){for(const e of l){const{parent:t,$w:i}=e,{context:n,onMounted:r}=i;r&&t&&S(t)&&r(n)}l.clear()}},E=(e,t=[],i=0)=>{let n=e[i];for(;;){if(n&&void 0!==n.id)t.push(n);else if(null!=n)switch(typeof n){case"object":E(n,t);break;case"function":n=n();continue;case"boolean":break;case"number":case"bigint":n=""+n;default:t.push(new $("",n))}if(!(++i<e.length))break;n=e[i]}return t},B=(e,t,i)=>{let n;const r=e.length;let a=t,s=0;for(;s<r;){const t=e[s];if(t!==a[s]){if(s===a.length)return a;const e=a[s];if(!e||void 0===e.id){a=E(a,a.slice(0,s),s);continue}if(n!==a)break}n||t.parent===i||(n=e),s++}return s===a.length?n:a===t?E(a,e.slice(0,s),s):a},S=e=>{let t=e;do{if(t.parent===t)return!0;t=t.parent}while(t);return!1},M=(e,t,i,n)=>{let r,a,s;if(t!==e&&e.length){const o=[];let l;for(a=t.length,r=1e7;--a>=0;)if(s=t[a],s.parent===i){const e=a-s.index;e===r?(l.size++,s.index=a):(l={from:s.index,to:a,size:1},r=e,s.index=-o.push(l))}else 1e7!==r&&(r=1e7);const h=[];for(a=e.length-1;a>=0;)s=e[a],s.index<0?(l=o[-s.index-1],h.push(l),a-=l.size):(s.detachFrom(i),a--);let d,c,f=0;for(a=t.length-1;a>=0;)if(s=t[a],s.parent!==i)s.index=a--,s.attachTo(i);else{if(l=o[-s.index-1],c=l.size,d=h[f],s.index=a,!n){if(d===l){f++,a-=l.size,i.currentBefore=void 0;continue}if(d.from>l.from){r=f;do{c-=d.size,d=h[++r]}while(d.from>l.from&&c>0);if(c>0){a-=l.size,i.currentBefore=void 0,f=r;continue}}}r=a-l.size;do{s.move()}while(--a>r&&(s=t[a]))}}else for(a=t.length-1;a>=0;a--)s=t[a],s.index=a,i!==s.parent&&s.attachTo(i);i.currentBefore=void 0};class ${constructor(e,t){this.id=e,this.index=0,this.a9=t}id;parent;index;firstElement;attachTo(e){this.firstElement||(this.firstElement=document.createTextNode(this.a9));const{parent:t,firstElement:i,index:n}=this;this.id&&(t?(r.add(this),i.remove()):a.delete(this)),this.parent=e;let s=e.currentBefore;void 0===s&&(s=e.findNextSiblingElement(n)),e.element.insertBefore(i,s),e.currentBefore=i}move(){const{parent:e,index:t,firstElement:i}=this;let n=e.currentBefore;void 0===n&&(n=e.findNextSiblingElement(t)),e.element.insertBefore(i,n),e.currentBefore=i}detachFrom(e){this.parent===e&&(this.firstElement.remove(),this.parent=void 0,this.id&&r.add(this))}update(e){return this.a9!==e&&(this.a9=e,this.firstElement&&(this.firstElement.nodeValue=e)),!1}refresh(){}release(e){this.parent===e&&(e&&this.firstElement.remove(),w.delete(this.id))}a9}class A{constructor(e,t,n){this.id=e,this.index=0,this.newChildren=this.d=n?E(t):t||i}id;parent;index;newChildren;currentBefore;get element(){return this.parent.element}get firstElement(){const{d:e}=this;for(let t=0;t<e.length;t++){const i=e[t].firstElement;if(i)return i}return null}attachTo(e){const{parent:t,d:i,newChildren:n}=this;if(t){r.add(this);for(let e=i.length-1;e>=0;e--)i[e].detachFrom(this)}else a.delete(this);this.parent=e;const s=n||i;for(let e=s.length-1;e>=0;e--){const t=s[e];t.index=e,t.attachTo(this)}e.currentBefore=this.currentBefore,this.currentBefore=void 0,this.d=s,this.newChildren=void 0}move(){const{d:e,newChildren:t}=this;if(t)M(e,t,this,!0),this.d=t,this.newChildren=void 0;else{for(let t=e.length-1;t>=0;t--)e[t].move();this.currentBefore=void 0}}detachFrom(e){if(this.parent===e){const{d:e}=this;for(const t of e)t.detachFrom(this);this.parent=void 0,r.add(this)}}update(e,t){if(t){const e=B(this.d,t,this);if(e)return this.newChildren=e,!0}return!1}refresh(e){M(this.d,e,this),this.d=e,this.newChildren=void 0}release(e){if(this.parent===e){if(e){const{d:e}=this;for(const t of e)t.detachFrom(this)}w.delete(this.id)}}findNextSiblingElement(e){const t=this.newChildren||this.d;let i,n=e+1,r=t[n];for(;r;){if(i=r.firstElement,i)return i;r=t[++n]}return i=this.parent.currentBefore,void 0!==i?i:this.parent.findNextSiblingElement(this.index)}d}class z{constructor(e,n,r,a,s,o){if(this.id=e,this.index=0,this.firstElement=this.element=b(n,this),this.newChildren=this.d=o?E(a):a||i,r){if(this.m=t,this.r=-1,"select"===n){const e=this.element,t=r,i=t.value;if(i){t.value=void 0;const n=this.refresh;this.refresh=r=>{if(M(this.d,r,this),this.d=r,this.newChildren=void 0,Array.isArray(i)){const t=i,[n,r,a]=t;e.value=a;const s=t[3]=e=>n[r]=e.target.value;e.addEventListener("change",s)}else e.value=i;t.value=i,this.refresh=n}}}this.update(r),this.r=s??0}else this.m=r,this.r=0}id;element;parent;newChildren;index;currentBefore;firstElement;attachTo(e){const{parent:t,element:i,newChildren:n,index:r}=this;t?i.remove():a.delete(this),this.parent=e,n&&this.refresh(n);let s=e.currentBefore;void 0===s&&(s=e.findNextSiblingElement(r)),e.element.insertBefore(i,s),e.currentBefore=i}move(){const{parent:e,newChildren:t,index:i,element:n}=this;t&&this.refresh(t);let r=e.currentBefore;void 0===r&&(r=e.findNextSiblingElement(i)),e.element.insertBefore(n,r),e.currentBefore=n}detachFrom(e){this.parent===e&&(this.element.remove(),this.parent=void 0,r.add(this))}update(i,n){const{element:r,m:a,r:s}=this;if(a&&s){this.m=i;let n=s;for(const s in i){const o=i[s],l=a[s];if(o!==l)if(null!=o)switch(typeof o){case"string":{const t=e[s];t?r.setAttribute(t,o):r[s]=o;break}case"number":case"boolean":case"function":r[s]=o;break;default:if(Array.isArray(o)){const[e,t,i]=o;if(l){const[n,a,h,d]=l;if(h!==i&&r[s]!==i&&(r[s]=i),n===e&&a===t)o[3]=d;else{const i=o[3]=i=>e[t]=i.target[s];r.removeEventListener("change",d),r.addEventListener("change",i)}}else{r[s]=i;const n=o[3]=i=>e[t]=i.target[s];r.addEventListener("change",n)}break}if("style"===s){if(!l){const e=r.style,t={};let n=0;for(const i in o){const r=o[i];t[i]=r,n++,e[i]=r}i[s]=t,t.i=n;break}const e=r.style,t={};let n=0,a=l.i;for(const i in o){const r=o[i];t[i]=r,i in l&&a--,n++,r!==l[s]&&(e[i]=r)}if(i[s]=t,t.i=n,a)for(const t in l)if(!(t in o)&&(e[t]=null,! --a))break;break}r[s]=o}else switch(typeof l){case"string":{const t=e[s];t?this.element.removeAttribute(t):this.element[s]=o;break}case"object":l?Array.isArray(l)?r.removeEventListener("change",l[3]):l===t&&(r[s]=o):r[s]=o;break;default:r[s]=o}if(! --n)break}}if(n){const e=B(this.d,n,this);if(e)return this.newChildren=e,!0}return!1}refresh(e){M(this.d,e,this),this.d=e,this.newChildren=void 0}release(e){if(this.parent===e){e&&this.element.remove();const{d:t}=this;for(const e of t)e.release(this);w.delete(this.id)}}findNextSiblingElement(e){const t=this.newChildren||this.d;let i,n=e+1,r=t[n];for(;r;){if(i=r.firstElement,i)return i;r=t[++n]}return null}a2(){this.update=this.aI}aI(t,i){const{element:n,m:r,r:a}=this;if(r&&a){this.m=t;let i=a;for(const a in t){const s=t[a],o=r[a];if(s!==o)if(null!=s)switch(typeof s){case"string":n.setAttribute(e[a]??a,s);break;case"number":case"boolean":n.setAttribute(e[a]??a,""+s);break;case"function":n[a]=s;break;default:if("style"===a){if(!o){const e=n.style,i={};let r=0;for(const t in s){const n=s[t];i[t]=n,r++,e[t]=n}t[a]=i,i.i=r;break}const e=n.style,i={};let r=0,l=o.i;for(const t in s){const n=s[t];i[t]=n,t in o&&l--,r++,n!==o[a]&&(e[t]=n)}if(t[a]=i,i.i=r,l)for(const t in o)if(!(t in s)&&(e[t]=null,! --l))break;break}n[a]=s}else{switch(typeof o){case"string":case"number":case"boolean":n.removeAttribute(e[a]??a);break;default:n[a]=s}}if(! --i)break}}if(i){const e=B(this.d,i,this);if(e)return this.newChildren=e,!0}return!1}m;d;r}class T{constructor(e,t,n,r,a,s){this.id=e,this.index=0,this.ver=0,this.Y=t,this.m=n,this.newChildren=this.d=s?E(r):r||i,this.r=a??0}id;parent;newChildren;index;ver;$;get firstElement(){return this.h?.firstElement||null}attachTo(e){const{parent:t,newChildren:i,h:n}=this;this.parent=e,i?this.refresh(i):n&&(n.index=this.index,n.attachTo(e)),t||a.delete(this)}move(){const{newChildren:e,h:t}=this;e?this.refresh(e):t&&(t.index=this.index,t.move())}detachFrom(e){this.parent===e&&(this.h?.detachFrom(e),this.parent=void 0,r.add(this))}update(e,t){const{m:i,d:n,r:r}=this;if(this.m=e,t){const e=B(n,t,this.parent);if(e)return this.newChildren=e,!0}if(!this.newChildren&&r){let t=r;for(const r in i){if(i[r]!==e[r])return this.newChildren=n,!0;if(! --t)break}}return!1}refresh(e){const{parent:i,h:n,index:r}=this,a=v;v=this,this.ver++;let s=this.Y(this.m||t,e);if(s!==n)switch(typeof s){case"boolean":break;case"number":case"bigint":s=""+s;case"string":s=new $("",s),this.h=s,s.index=r,s.attachTo(i),n?.detachFrom(i);break;default:s?(this.h=s,s.index=r,s.attachTo(i),n?.detachFrom(i)):(this.h=void 0,n?.detachFrom(i))}else n&&(n.parent!==i?(n.index=r,n.attachTo(i)):n.index!==r&&(n.index=r,n.move()));this.d=e,this.newChildren=void 0,v=a}release(e){this.parent===e&&(this.h?.release(e),this.parent=void 0,w.delete(this.id),this.A&&(this.A=void 0,o.delete(this)))}markChanged(){this.newChildren||(this.newChildren=this.d,s.ax()&&queueMicrotask(y),s.O(this))}watchMountChange(e,t){const{A:i,parent:n}=this;if(t){if(!i)return this.A=(new Map).set(e,t),void o.set(this,!!n&&S(n));i.set(e,t)}else i?.delete(e)&&(i.size||(this.A=void 0,o.delete(this)))}onMountChange(e){for(const[,t]of this.A)t(this,e)}Y;m;d;r;h;A}class O{constructor(e,t){this.id=e,this.element=t,this.parent=this}id;element;parent;currentBefore;findNextSiblingElement(e){return null}render(e){this.aa||(this.aa=new T(this.id,e,null,i),w.set(this.id,this.aa),this.aa.attachTo(this))}aa}const F=(e,t)=>{if(v.id){let i=e[t];i||(i=new Map,e[t]=i),i.set(v.id,v.ver)}};let R=(e,t)=>{const i=e[t];if(i){for(const[e,t]of i){const i=w.get(e);i?.ver===t&&i.markChanged()}i.clear()}};const L=e=>R=e,N=(e,t)=>{if(!t){e.watchMountChange("w",void 0);const{context:t,onUnmounted:i}=e.$w;e.$w=void 0,e.markChanged(),i?.(t)}},j=(e,t,i)=>{let n=v.$w;n?(n.context=e,n.onMounted=t,n.onUnmounted=i):(n=v.$w={context:e,onMounted:t,onUnmounted:i},t&&l.add(v),v.watchMountChange("w",N))},I=a.delete;a.delete=n;const D=(e,t=2e4)=>{if(e>=0&&t>=1e3){if(m=t,p&&clearTimeout(f),e)a.delete=I,f=setTimeout(k,m);else if(f){f=void 0;for(let e=0;e<p;e++)k();a.delete=n}return p=e,!0}return!1},V=()=>{u=d.pop()};var P;!function(e){e.render=(e,t)=>{const i=(h.length||"")+"|",n=new O(i,e);h.push(n),n.render(t)},e.$=(e,t,i,n,r,a)=>{const o=`${v.id}${e}${u}`;let l=w.get(o);return l?((i||n)&&l.update(i,n)&&s.O(l),l):(l=new z(o,t,i,n,r,a),w.set(o,l),l)},e.$c=(e,t,i,n,r,a)=>{const o=`${v.id}${e}${u}`;let l=w.get(o);return l?((i||n)&&l.update(i,n)&&s.O(l),l):(l=new T(o,t,i,n,r,a),w.set(o,l),l)},e.$f=(e,t,i)=>{const n=`${v.id}${e}${u}`;let r=w.get(n);return r?(t&&r.update(null,t)&&s.O(r),r):(r=new A(n,t,i),w.set(n,r),r)},e.$k=e=>(d.push(u),u=`${u||"{"}${e}}`,V),e.$n=e=>{const t=b;return b=x[e],()=>{b=t}},e.$s=(e,t)=>(e(),t),e.$t=(e,t,i)=>{const n=`${v.id}${e}${u}`;let r=w.get(n);return r?(i&&r.update(""+t),r):(r=new $(n,""+t),w.set(r.id,r),r)}}(P||(P={}));export{P as $,F as a,L as b,D as c,v as j,w as l,R as r,j as w};
|
package/lib/index.d.ts
CHANGED
|
@@ -469,7 +469,7 @@ export interface INameSpaceChecker {
|
|
|
469
469
|
declare const ao: Record<string, (_: string, K: INameSpaceChecker) => Element>;
|
|
470
470
|
export declare const addComReader: (readerRecord: ReaderRecord, key: string | symbol | number) => void;
|
|
471
471
|
export declare let refreshComReaders: (readerRecord: ReaderRecord, key: string | symbol | number) => void;
|
|
472
|
-
export declare const watchMount: (onMounted?: () => void, onUnmounted?: () => void) => void;
|
|
472
|
+
export declare const watchMount: <ContextT>(context: ContextT, onMounted?: (context: ContextT) => void, onUnmounted?: (context: ContextT) => void) => void;
|
|
473
473
|
export declare const configGC: (waitIntervals: number, interval?: number) => boolean;
|
|
474
474
|
export declare namespace $ezh {
|
|
475
475
|
function ezh<T extends keyof EzTagElementNameMap, P extends object>(tag: T | Com<P>, props: TagProps<T> | P | null, ...children: ChildElement[]): IEzElement;
|
|
@@ -480,7 +480,7 @@ export declare namespace $ezh {
|
|
|
480
480
|
const $k: (key: string | number) => (() => void);
|
|
481
481
|
const $n: (ns: keyof typeof ao) => (() => void);
|
|
482
482
|
const $s: (cb: () => void, element: IEzElement) => IEzElement;
|
|
483
|
-
const $t: (id: string, text: string, mayChange?: 1) => IEzElement;
|
|
483
|
+
const $t: (id: string, text: string | number | bigint, mayChange?: 1) => IEzElement;
|
|
484
484
|
namespace JSX {
|
|
485
485
|
type Element = EzElement;
|
|
486
486
|
type IntrinsicElements = ElementProps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ezh",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"module": "./lib/index.min.js",
|
|
5
5
|
"typings": "./lib/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"dts-bundle-generator": "^9.5.1",
|
|
32
32
|
"eslint": "^9.21.0",
|
|
33
33
|
"eslint-plugin-import": "^2.31.0",
|
|
34
|
-
"ezh-trans": "^0.
|
|
34
|
+
"ezh-trans": "^0.3.0",
|
|
35
35
|
"globals": "^16.5.0",
|
|
36
|
-
"log-class": "^1.0.
|
|
36
|
+
"log-class": "^1.0.7",
|
|
37
37
|
"minify-ts": "^1.3.1",
|
|
38
38
|
"rollup": "^4.54.0",
|
|
39
39
|
"sass": "^1.86.0",
|