ezh 0.3.3 → 0.3.8

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.
@@ -1 +1 @@
1
- import{b as e,k as t,l as n,r}from"./el.min.js";const o=r;let s=!1,i=!1,c=!0;const d=(e,t)=>{c=!1;const n=new Error(e),r=n.stack;if(r){const e=r.indexOf("\n");let o=e;for(let e=0;e<t;e++)o=r.indexOf("\n",o+1);n.stack=r.substring(0,e)+r.substring(o)}return n},l=(e,t)=>{if(n.id&&!i&&c)throw d("Models should not be modified while rendering",3);s=!0,o(e,t),s=!1};(()=>{e(l);const r=t.get.bind(t),o=t.set.bind(t);t.get=e=>{if(!s&&!n.id&&c)throw d("All the elements must be in a closure that passed to h.render()",3);const t=r(e);if(t){const e=t;if(n.id&&!i)if(e.h<n.ver)e.h=n.ver;else if(c)throw d('This element already exists, "key" prop is required when it is in a loop',3);return e.data}return t},t.set=(e,t)=>{if(t.ver>=0){let e,n,r=0;const o=t,s=o.X;o.X=(e,t)=>{const n=s(e,t);return r=0,n},Object.defineProperty(t,"$",{get(){if(++r>1&&c)throw d('The "useState" function can only be called once in the com function',3);return n},set(t){n=t,n&&(e=n.hook,e&&(n.hook=(t,n)=>{i=!0;const r=e(t,n);return i=!1,r}))}})}const r={h:n.ver,data:t};return o(e,r)}})();
1
+ import{b as e,l as t,j as n,r}from"./el.min.js";const i=n,o=r;let s=!1,c=!1,a=!0;const d=(e,t)=>{a=!1;const n=new Error(e),r=n.stack;if(r){const e=r.indexOf("\n");let i=e;for(let e=0;e<t;e++)i=r.indexOf("\n",i+1);n.stack=r.substring(0,e)+r.substring(i)}return n},l=(e,t)=>{if(n.id&&!c&&a)throw d("Data models should not be modified while rendering",3);s=!0,o(e,t),s=!1};(()=>{e(l);const r=t.get.bind(t),o=t.set.bind(t);t.get=e=>{if(!s&&!n.id&&a)throw d("All the elements must be in a closure that passed to h.render()",3);const t=r(e);if(t){const e=t;if(n.id&&!c)if(e.m<n.ver)e.m=n.ver;else if(a)throw d('This element already exists, "key" prop is required when it is in a loop',3);return e.data}return t},t.set=(e,t)=>{if(t.ver>=0){let e,n,r=-1;const i=t,o=i.Y;i.Y=(e,t)=>{r=0;const n=o(e,t);return r=-1,n},Object.defineProperty(t,"$",{get(){if(r>=0&&n&&++r>1&&a)throw d('The "useState" API can only be called once in a com function',3);return n},set(t){n=t,n&&(e=n.$,Object.defineProperty(n,"$",{get:()=>e,set(t){e=t?(e,n,r)=>{c=!0,t(e,n,r),c=!1}:void 0}}),n.$=e)}})}const r={m:n.ver,data:t};return o(e,r)},Object.defineProperty(i,"$w",{get(){if(a)throw d('The "watchMount" API can only be called in a com function',3)},set(){}})})();
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 r=()=>!1,n=new Set,a=new Set,s=new class{constructor(){this.c=[]}au(){return!this.c.length}pop(){const{c:e}=this,t=e.pop(),i=e[0];if(t){if(!i)return t;const{length:r}=e,n=r>>>1;let a,s,o,l=0;for(;l<n&&(o=2*l+1,a=e[o],o+1<r&&(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}N(e){const{c:t}=this;let i,r,n=t.push(e)-1;for(;n&&e.id<(i=t[r=n-1>>>1]).id;)t[n]=i,n=r;t[n]=e}c},o=new Map,l=[],h=[],d={id:"",index:0,firstElement:null,attachTo:r,move:r,detachFrom:r,update:r,refresh:r,release:r,ver:0,markChanged:r,watchMountChange:r,onMountChange:r};let c,f="",u=2e4,m=0,p=0;const g=new Map;let v=d;let w=(e,t)=>document.createElement(e);const b={svg:(e,t)=>(t.Z(),document.createElementNS("http://www.w3.org/2000/svg",e)),math:(e,t)=>(t.Z(),document.createElementNS("http://www.w3.org/1998/Math/MathML",e)),foreignObject:(e,t)=>"foreignObject"!==e?document.createElement(e):(t.Z(),document.createElementNS("http://www.w3.org/2000/svg",e))},x=()=>{if(++p>=m){for(const e of a)if(a.delete(e),e.id)e.release();else if(--p<m){a.add(e);break}}else a.add(Object.create(d));c&&(c=setTimeout(x,u))},k=()=>{let e;do{for(;e=s.pop();){const{newChildren:t,parent:i}=e;t&&(i&&E(i)?(e.refresh(t),i.currentBefore=void 0):e.ver&&e.watchMountChange("r",(e,t)=>{t&&(e.watchMountChange("r",void 0),s.N(e))}))}for(const[i,r]of o){const{parent:n}=i,a=!!n&&E(n);a!==r&&(o.set(i,a),i.onMountChange(a),e=t)}}while(e);if(m)for(const e of n)e.parent||a.add(e);else for(const e of n)e.parent||e.release();n.clear()},C=(e,t=[],i=0)=>{let r=e[i];for(;;){if(r&&void 0!==r.id)t.push(r);else if(null!=r)switch(typeof r){case"object":C(r,t);break;case"function":r=r();continue;case"boolean":case"number":case"bigint":r=""+r;default:t.push(new S("",r))}if(!(++i<e.length))break;r=e[i]}return t},y=(e,t,i)=>{let r;const n=e.length;let a=t,s=0;for(;s<n;){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=C(a,a.slice(0,s),s);continue}if(r!==a)break}r||t.parent===i||(r=e),s++}return s===a.length?r:a===t?C(a,e.slice(0,s),s):a},E=e=>{let t=e;do{if(t.parent===t)return!0;t=t.parent}while(t);return!1},B=(e,t,i,r)=>{let n,a,s;if(t!==e&&e.length){const o=[];let l;for(a=t.length,n=1e7;--a>=0;)if(s=t[a],s.parent===i){const e=a-s.index;e===n?(l.size++,s.index=a):(l={from:s.index,to:a,size:1},n=e,s.index=-o.push(l))}else 1e7!==n&&(n=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,!r){if(d===l){f++,a-=l.size,i.currentBefore=void 0;continue}if(d.from>l.from){n=f;do{c-=d.size,d=h[++n]}while(d.from>l.from&&c>0);if(c>0){a-=l.size,i.currentBefore=void 0,f=n;continue}}}n=a-l.size;do{s.move()}while(--a>n&&(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 S{constructor(e,t){this.id=e,this.index=0,this.a5=t}id;parent;index;firstElement;attachTo(e){this.firstElement||(this.firstElement=document.createTextNode(this.a5));const{parent:t,firstElement:i,index:r}=this;this.id&&(t?(n.add(this),i.remove()):a.delete(this)),this.parent=e;let s=e.currentBefore;void 0===s&&(s=e.findNextSiblingElement(r)),e.element.insertBefore(i,s),e.currentBefore=i}move(){const{parent:e,index:t,firstElement:i}=this;let r=e.currentBefore;void 0===r&&(r=e.findNextSiblingElement(t)),e.element.insertBefore(i,r),e.currentBefore=i}detachFrom(e){this.parent===e&&(this.firstElement.remove(),this.parent=void 0,this.id&&n.add(this))}update(e){return this.a5!==e&&(this.a5=e,this.firstElement&&(this.firstElement.nodeValue=e)),!1}refresh(){}release(e){this.parent===e&&(e&&this.firstElement.remove(),g.delete(this.id))}a5}class z{constructor(e,t,r){this.id=e,this.index=0,this.newChildren=this.d=r?C(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:r}=this;if(t){n.add(this);for(let e=i.length-1;e>=0;e--)i[e].detachFrom(this)}else a.delete(this);this.parent=e;const s=r||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)B(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,n.add(this)}}update(e,t){if(t){const e=y(this.d,t,this);if(e)return this.newChildren=e,!0}return!1}refresh(e){B(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)}g.delete(this.id)}}findNextSiblingElement(e){const t=this.newChildren||this.d;let i,r=e+1,n=t[r];for(;n;){if(i=n.firstElement,i)return i;n=t[++r]}return i=this.parent.currentBefore,void 0!==i?i:this.parent.findNextSiblingElement(this.index)}d}class M{constructor(e,r,n,a,s,o){if(this.id=e,this.index=0,this.firstElement=this.element=w(r,this),this.newChildren=this.d=o?C(a):a||i,n){if(this.m=t,this.q=-1,"select"===r){const e=this.element,t=n,i=t.value;if(i){t.value=void 0;const r=this.refresh;this.refresh=n=>{if(B(this.d,n,this),this.d=n,this.newChildren=void 0,Array.isArray(i)){const t=i,[r,n,a]=t;e.value=a;const s=t[3]=e=>r[n]=e.target.value;e.addEventListener("change",s)}else e.value=i;t.value=i,this.refresh=r}}}this.update(n),this.q=s??0}else this.m=n,this.q=0}id;element;parent;newChildren;index;currentBefore;firstElement;attachTo(e){const{parent:t,element:i,newChildren:r,index:n}=this;t?i.remove():a.delete(this),this.parent=e,r&&this.refresh(r);let s=e.currentBefore;void 0===s&&(s=e.findNextSiblingElement(n)),e.element.insertBefore(i,s),e.currentBefore=i}move(){const{parent:e,newChildren:t,index:i,element:r}=this;t&&this.refresh(t);let n=e.currentBefore;void 0===n&&(n=e.findNextSiblingElement(i)),e.element.insertBefore(r,n),e.currentBefore=r}detachFrom(e){this.parent===e&&(this.element.remove(),this.parent=void 0,n.add(this))}update(i,r){const{element:n,m:a,q:s}=this;if(a&&s){this.m=i;let r=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?n.setAttribute(t,o):n[s]=o;break}case"number":case"boolean":case"function":n[s]=o;break;default:if(Array.isArray(o)){const[e,t,i]=o;if(l){const[r,a,h,d]=l;if(h!==i&&n[s]!==i&&(n[s]=i),r===e&&a===t)o[3]=d;else{const i=o[3]=i=>e[t]=i.target[s];n.removeEventListener("change",d),n.addEventListener("change",i)}}else{n[s]=i;const r=o[3]=i=>e[t]=i.target[s];n.addEventListener("change",r)}break}if("style"===s){if(!l){const e=n.style,t={};let r=0;for(const i in o){const n=o[i];t[i]=n,r++,e[i]=n}i[s]=t,t.i=r;break}const e=n.style,t={};let r=0,a=l.i;for(const i in o){const n=o[i];t[i]=n,i in l&&a--,r++,n!==l[s]&&(e[i]=n)}if(i[s]=t,t.i=r,a)for(const t in l)if(!(t in o)&&(e[t]=null,! --a))break;break}n[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)?n.removeEventListener("change",l[3]):l===t&&(n[s]=o):n[s]=o;break;default:n[s]=o}if(! --r)break}}if(r){const e=y(this.d,r,this);if(e)return this.newChildren=e,!0}return!1}refresh(e){B(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);g.delete(this.id)}}findNextSiblingElement(e){const t=this.newChildren||this.d;let i,r=e+1,n=t[r];for(;n;){if(i=n.firstElement,i)return i;n=t[++r]}return null}Z(){this.update=this.aE}aE(t,i){const{element:r,m:n,q:a}=this;if(n&&a){this.m=t;let i=a;for(const a in t){const s=t[a],o=n[a];if(s!==o)if(null!=s)switch(typeof s){case"string":r.setAttribute(e[a]??a,s);break;case"number":case"boolean":r.setAttribute(e[a]??a,""+s);break;case"function":r[a]=s;break;default:if("style"===a){if(!o){const e=r.style,i={};let n=0;for(const t in s){const r=s[t];i[t]=r,n++,e[t]=r}t[a]=i,i.i=n;break}const e=r.style,i={};let n=0,l=o.i;for(const t in s){const r=s[t];i[t]=r,t in o&&l--,n++,r!==o[a]&&(e[t]=r)}if(t[a]=i,i.i=n,l)for(const t in o)if(!(t in s)&&(e[t]=null,! --l))break;break}r[a]=s}else{switch(typeof o){case"string":case"number":case"boolean":r.removeAttribute(e[a]??a);break;default:r[a]=s}}if(! --i)break}}if(i){const e=y(this.d,i,this);if(e)return this.newChildren=e,!0}return!1}m;d;q}class ${constructor(e,t,r,n,a,s){this.id=e,this.index=0,this.ver=0,this.X=t,this.m=r,this.newChildren=this.d=s?C(n):n||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:r}=this;this.parent=e,i?this.refresh(i):r&&(r.index=this.index,r.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,n.add(this))}update(e,t){const{m:i,d:r,q:n}=this;if(this.m=e,t){const e=y(r,t,this.parent);if(e)return this.newChildren=e,!0}if(!this.newChildren&&n){let t=n;for(const n in i){if(i[n]!==e[n])return this.newChildren=r,!0;if(! --t)break}}return!1}refresh(e){const{parent:i,h:r,index:n}=this,a=v;v=this,this.ver++;let s=this.X(this.m||t,e);if(s!==r)switch(typeof s){case"boolean":case"number":case"bigint":s=""+s;case"string":s=new S("",s),this.h=s,s.index=n,s.attachTo(i),r?.detachFrom(i);break;default:s?(this.h=s,s.index=n,s.attachTo(i),r?.detachFrom(i)):(this.h=void 0,r?.detachFrom(i))}else r&&(r.parent!==i?(r.index=n,r.attachTo(i)):r.index!==n&&(r.index=n,r.move()));this.d=e,this.newChildren=void 0,v=a}release(e){this.parent===e&&(this.h?.release(e),this.parent=void 0,g.delete(this.id),this.z&&(this.z=void 0,o.delete(this)))}markChanged(){return!this.newChildren&&(this.newChildren=this.d,!0)}watchMountChange(e,t){const{z:i,parent:r}=this;if(t){if(!i)return this.z=(new Map).set(e,t),void o.set(this,!!r&&E(r));i.set(e,t)}else i?.delete(e)&&(i.size||(this.z=void 0,o.delete(this)))}onMountChange(e){for(const[,t]of this.z)t(this,e)}X;m;d;q;h;z}class T{constructor(e,t){this.id=e,this.element=t,this.parent=this}id;element;parent;currentBefore;findNextSiblingElement(e){return null}render(e){this.a6||(this.a6=new $(this.id,e,null,i),g.set(this.id,this.a6),this.a6.attachTo(this))}a6}const N=(e,t)=>{if(v.id){let i=e[t];i||(i=new Map,e[t]=i),i.set(v.id,v.ver)}};let A=(e,t)=>{const i=e[t];if(i){for(const[e,t]of i){const i=g.get(e);i?.ver===t&&i.markChanged()&&(s.au()&&queueMicrotask(k),s.N(i))}i.clear()}};const F=e=>A=e,R=a.delete;a.delete=r;const L=(e,t=2e4)=>{if(e>=0&&t>=1e3){if(u=t,m&&clearTimeout(c),e)a.delete=R,c=setTimeout(x,u);else if(c){c=void 0;for(let e=0;e<m;e++)x();a.delete=r}return m=e,!0}return!1},O=()=>{f=h.pop()};var q;!function(e){e.render=(e,t)=>{const i=(l.length||"")+"|",r=new T(i,e);l.push(r),r.render(t)},e.$=(e,t,i,r,n,a)=>{const o=`${v.id}${e}${f}`;let l=g.get(o);return l?((i||r)&&l.update(i,r)&&s.N(l),l):(l=new M(o,t,i,r,n,a),g.set(o,l),l)},e.$c=(e,t,i,r,n,a)=>{const o=`${v.id}${e}${f}`;let l=g.get(o);return l?((i||r)&&l.update(i,r)&&s.N(l),l):(l=new $(o,t,i,r,n,a),g.set(o,l),l)},e.$f=(e,t,i)=>{const r=`${v.id}${e}${f}`;let n=g.get(r);return n?(t&&n.update(null,t)&&s.N(n),n):(n=new z(r,t,i),g.set(r,n),n)},e.$k=e=>(h.push(f),f=`${f||"{"}${e}}`,O),e.$n=e=>{const t=w;return w=b[e],()=>{w=t}},e.$s=(e,t)=>(e(),t),e.$t=(e,t,i)=>{const r=`${v.id}${e}${f}`;let n=g.get(r);return n?(i&&n.update(t),n):(n=new S(r,t),g.set(n.id,n),n)}}(q||(q={}));export{q as $,N as a,F as b,L as c,g as k,v as l,A as r};
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};
package/lib/index.d.ts CHANGED
@@ -416,25 +416,9 @@ export type TagProps<T extends TagTypes> = Partial<EzTagElementNameMap[T]>;
416
416
  export type ElementProps = {
417
417
  [K in TagTypes]: TagProps<K>;
418
418
  };
419
+ declare const _sIEzEl: unique symbol
419
420
  export interface IEzElement {
420
- readonly id: string;
421
- readonly parent?: ITagElement;
422
- newChildren?: IEzElement[];
423
- index: number;
424
- get firstElement(): Element | Text | null;
425
- attachTo(target: ITagElement): void;
426
- detachFrom(target: ITagElement): void;
427
- move(): void;
428
- update(props: unknown | null, children?: ChildElement[]): boolean;
429
- refresh(newChildren: IEzElement[]): void;
430
- release(target?: ITagElement): void;
431
- }
432
- export interface ITagElement {
433
- readonly id: string;
434
- readonly parent?: ITagElement;
435
- readonly element: Element;
436
- currentBefore?: Element | Text | null;
437
- findNextSiblingElement(index: number): Element | Text | null;
421
+ [_sIEzEl]: 1
438
422
  }
439
423
  export type EzElement = IEzElement | boolean | number | bigint | string | null | undefined;
440
424
  export type ChildElement = EzElement | (() => EzElement | EzElement[]) | (EzElement | (() => EzElement | EzElement[]))[];
@@ -449,9 +433,9 @@ export type PropsWithChildren<P extends object> = ComProps<{
449
433
  export type Com<P extends object = object> = (props: ComProps<P>, children?: ChildElement[]) => EzElement;
450
434
  export type Container<P extends object = object> = (props: PropsWithChildren<P>, children?: ChildElement[]) => EzElement;
451
435
  export type CheckAuthFunc = (url: string) => string | void;
452
- declare const _sIRoute: unique symbol;
436
+ declare const _sIRoute: unique symbol
453
437
  export interface IRoute<ParamT extends Record<string, string>> {
454
- [_sIRoute]: 1;
438
+ [_sIRoute]: 1
455
439
  }
456
440
  export type RouteMap = {
457
441
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -480,11 +464,12 @@ export type RouteLinkProp<ParamT extends Record<string, string>> = {
480
464
  children?: ChildElement[] | ChildElement;
481
465
  };
482
466
  export interface INameSpaceChecker {
483
- Z(): void;
467
+ a2(): void;
484
468
  }
485
- declare const al: Record<string, (y: string, J: INameSpaceChecker) => Element>;
469
+ declare const ao: Record<string, (_: string, K: INameSpaceChecker) => Element>;
486
470
  export declare const addComReader: (readerRecord: ReaderRecord, key: string | symbol | number) => void;
487
471
  export declare let refreshComReaders: (readerRecord: ReaderRecord, key: string | symbol | number) => void;
472
+ export declare const watchMount: (onMounted?: () => void, onUnmounted?: () => void) => void;
488
473
  export declare const configGC: (waitIntervals: number, interval?: number) => boolean;
489
474
  export declare namespace $ezh {
490
475
  function ezh<T extends keyof EzTagElementNameMap, P extends object>(tag: T | Com<P>, props: TagProps<T> | P | null, ...children: ChildElement[]): IEzElement;
@@ -493,7 +478,7 @@ export declare namespace $ezh {
493
478
  const $c: <P extends object>(id: string, entry: Com<P>, props: P | null, children?: ChildElement[], check?: number, mutableChild?: 1) => IEzElement;
494
479
  const $f: (id: string, children?: ChildElement[], mutableChild?: 1) => IEzElement;
495
480
  const $k: (key: string | number) => (() => void);
496
- const $n: (ns: keyof typeof al) => (() => void);
481
+ const $n: (ns: keyof typeof ao) => (() => void);
497
482
  const $s: (cb: () => void, element: IEzElement) => IEzElement;
498
483
  const $t: (id: string, text: string, mayChange?: 1) => IEzElement;
499
484
  namespace JSX {
@@ -515,7 +500,8 @@ export declare const bindData: <T extends State<T>, K extends keyof T>(data: T,
515
500
  K,
516
501
  T[K]
517
502
  ];
518
- export declare const useState: <T extends State<T>>(initial: T, hookFunc?: (ver: number, state: T) => void) => T;
503
+ export declare const resetOnRemount: <T extends State<T>>(ver: number, state: T, initial: T) => void;
504
+ export declare const useState: <T extends State<T>>(initial: T, hook?: (ver: number, state: T, initial: T) => void) => T;
519
505
  export declare const Effect: Com<{
520
506
  on?: () => void;
521
507
  off?: () => void;
package/lib/index.min.js CHANGED
@@ -1 +1 @@
1
- import{l as t,a as e,r as o,$ as s}from"./el.min.js";export{c as configGC}from"./el.min.js";const r=Symbol(),n=Array.prototype,i=e;let a=(t,e)=>{a=o,a(t,e)};const l=t=>function(...e){const o=this.length;let s,i;switch(t){case n.push:s=o,i=s+e.length;break;case n.unshift:s=0,i=e.length;break;case n.fill:s=e[1],void 0===s||s<=-o?s=0:s<0&&(s=o+s),i=e[2],void 0===i||i>o?i=o:i<=-o?i=0:i<0&&(i=o+i);break;case n.sort:case n.reverse:s=i=0;break;case n.pop:s=i=o-1;break;case n.shift:s=i=0;break;default:s=e[0],s<0&&(s=o+s),i=e.length>2?e.length-2:0,e[1],i+=s}const c=t.bind(this)(...e),l=this[r];let h;for(let t=s;t<i;t++){switch(h=this[t],typeof h){case"object":if(h){for(;t<i;)h=this[t],h&&!h[r]&&(this[t]=p(h)),t++;break}case"undefined":continue}break}return o!==this.length&&a(l,"length"),a(l,Symbol.iterator),c},h={push:l(n.push),unshift:l(n.unshift),fill:l(n.fill),sort:l(n.sort),reverse:l(n.reverse),pop:l(n.pop),shift:l(n.shift),splice:l(n.splice)},f={get(t,e){if(e!==r){let o=t[e];if(o&&o===n[e]){const s=h[e];if(s)return s.bind(t);o=o.bind(t)}return i(t[r],"length"!==e?Symbol.iterator:e),o}return t},set(t,e,o){if(e!==r){if(t[e]===o)return!0;const s=t[r];return o&&"object"==typeof o&&(o=p(o)),t[e]=o,"length"===e&&a(s,e),a(s,Symbol.iterator),!0}return((t,e)=>{const o=e.length,s=t.length;let n;for(let s=0;s<o;s++){let i=e[s];if(i&&"object"==typeof i){do{i=e[s],n=t[s],i?n?n!==i&&(n[r]=i):t[s]=p(i):t[s]=i}while(++s<o);break}if(null!=i){do{t[s]=e[s]}while(++s<o);break}t[s]=i}const i=t[r];s!==o&&(s>o&&(t.length=o),a(i,"length")),a(i,Symbol.iterator)})(t,o),!0},has:(t,e)=>(i(t[r],isNaN(parseInt(e))?e:Symbol.iterator),e in t),deleteProperty:(t,e)=>(isNaN(parseInt(e))||(e=Symbol.iterator),void 0!==t[e]&&a(t[r],e),delete t[e])},u={get(t,e){if(e!==r){const o=t[e];return i(t[r],e),o}return t},set(t,e,o,s){if(e!==r){if(t[e]===o)return!0;const s=t[r];return o&&"object"==typeof o&&(o=p(o)),t[e]=o,a(s,e),!0}return((t,e,o)=>{const s={...t};let n;for(const i in o){delete s[i];const c=o[i];c&&"object"==typeof c&&(n=t[i],n)?n[r]=c:t[i]!==c&&(e[i]=c)}for(const t in s)delete e[t]})(t,s,o),!0},has:(t,e)=>(i(t[r],e),e in t),deleteProperty:(t,e)=>(void 0!==t[e]&&a(t[r],e),delete t[e])},p=t=>{let e;if(Array.isArray(t)){e=[];const o=t.length;for(let s=0;s<o;s++){let r=t[s];if(r&&"object"==typeof r){do{e[s]=(r=t[s])&&p(r)}while(++s<o);break}if(null!=r){do{e[s]=t[s]}while(++s<o);break}e[s]=r}t=new Proxy(e,f)}else{e={};for(const o in t){const s=t[o];e[o]=s&&"object"==typeof s?p(s):s}t=new Proxy(e,u)}return e[r]={},t},d=(t,e)=>[t,e,t[e]],w=(e,o)=>{const s=t;if(s.id){let t=s.$;if(t){const{state:e,hook:o}=t;return o?.(++t.ver,e),e}const{state:r,hook:n}=t=s.$={state:p(e),ver:1,hook:o};return n&&(s.watchMountChange("s",(e,o)=>((t,e)=>{if(!e){const{state:e,hook:o}=t;t.ver=0,o(0,e)}})(t,o)),n(1,r)),r}return p(e)},g={},$=({on:t,off:e})=>(w(g,o=>o<=1&&(o?t?.():e?.())),null);let b=0;const y=w({ver:0}),v=()=>y.ver=++b,m=(t,e)=>{const{pathname:o,search:s,hash:r}=window.location;t!==`${o}${s}${r}`&&(e?window.history.replaceState(void 0,"",t):window.history.pushState(void 0,"",t),queueMicrotask(v))};window.addEventListener("popstate",v);const k=/^(\/([*a-zA-Z0-9_.~-]+|:\w+))*\/?$/,S=/^[a-zA-Z0-9_.~-]+(&[a-zA-Z0-9_.~-]+)*$/,A=/[*.+?^${}()|[\]\\]/g,j=/\\\*/g,N=/:(\w+)/g,x=encodeURIComponent,E=decodeURIComponent;class _{constructor(t,e,o){this.com=t,this.r=e,this.l=o,this.e=[];const{path:s,a:r,c:n}=this.v(e);this.s=this.K(s),this.g=r?this.w(r):void 0,this.i=n?this.w(n):void 0,e.includes("*")&&(this.y=()=>{throw new Error("Wildcard route does not support build")})}com;l;y(t){const{r:e,e:o,g:s,i:r}=this;let n=e;o.forEach(e=>{const o=t[e]??"";n=n.replace(`:${e}`,x(o))});const i=this._("?",t,s),c=this._("#",t,r);return`${n}${i}${c}`}L(t){const{path:e,a:o,c:s}=this.v(t),{s:r,e:n,g:i,i:c}=this,a=e.match(r);if(a){const t={};return n.forEach((e,o)=>{t[e]=E(a[o+1])}),i&&o&&this.A(t,o,i),c&&s&&this.A(t,s,c),t}}v(t){const e=t.indexOf("?"),o=t.indexOf("#",e>=0?e:0);let s=t,r="",n="";return e>=0&&(s=t.substring(0,e),r=t.substring(e+1,o>=0?o:void 0)),o>=0&&(e<0&&(s=t.substring(0,o)),n=t.substring(o+1)),{path:s,a:r,c:n}}K(t){let e=t,o="";if(e.endsWith("/**")&&(e=e.substring(0,e.length-3),o="/.*"),e.includes("**")||!k.test(e))throw new Error(`Illegal path pattern '${t}'`);const{e:s}=this,r=e.replace(A,"\\$&").replace(j,"[A-Za-z0-9_~.-]+").replace(N,(t,e)=>(s.push(e),"([^/]+)"));return new RegExp(`^${r}${o}$`)}w(t){if(!S.test(t))throw new Error(`Illegal query string pattern '${t}'`);const e=t.split("&"),o=new Set;for(const t of e)o.add(t);return o}A(t,e,o){const s=e.split("&");for(const e of s){const[s,r]=e.split("=");o.has(s)&&(t[s]=E(r))}}_(t,e,o){if(o){const s=[];for(const t of o){const o=e[t];void 0!==o&&s.push(`${t}=${x(o)}`)}if(s.length)return t+s.join("&")}return""}r;s;e;g;i}const I=(t,e,o)=>new _(t,e,!o),z=({routes:t,notFound:e,checkAuth:o})=>{b=y.ver;const{pathname:r,search:n,hash:i}=window.location,c=`${r}${n}${i}`,{$s:a,$k:l,$c:h}=s;for(const e in t){const s=t[e],r=s.L(c);if(r){if(o&&s.l){const t=o(c);if(t)return void m(t)}return a(l(e),h("$",s.com,r,void 0,-1))}}return e?a(l("404"),h("$",e,{})):void 0},C=(t,e,o)=>{t.preventDefault();const{pathname:s,search:r,hash:n}=window.location;e!==`${s}${r}${n}`&&(o?window.history.replaceState(void 0,"",e):window.history.pushState(void 0,"",e),y.ver=++b)},P=(t,e)=>{const{href:o,className:r,style:n,title:i,replace:c}=t,a=o?t=>C(t,o,c):void 0;return s.$("$","a",{className:r,style:n,title:i,href:o,onclick:a},e,-1,1)},Z=(t,e)=>{const{route:o,params:r,className:n,style:i,title:c,replace:a}=t,l=o.y(r);return s.$("$","a",{className:n,style:i,title:c,href:l,onclick:t=>C(t,l,a)},e,-1,1)};export{s as $ezh,$ as Effect,P as Link,Z as RouteLink,z as Router,e as addComReader,d as bindData,m as navigate,o as refreshComReaders,I as route,w as useState};
1
+ import{j as t,a as e,r as o,$ as s}from"./el.min.js";export{c as configGC,w as watchMount}from"./el.min.js";const r=Symbol(),n=Array.prototype,i=e;let a=(t,e)=>{a=o,a(t,e)};const l=t=>function(...e){const o=this.length;let s,i;switch(t){case n.push:s=o,i=s+e.length;break;case n.unshift:s=0,i=e.length;break;case n.fill:s=e[1],void 0===s||s<=-o?s=0:s<0&&(s=o+s),i=e[2],void 0===i||i>o?i=o:i<=-o?i=0:i<0&&(i=o+i);break;case n.sort:case n.reverse:s=i=0;break;case n.pop:s=i=o-1;break;case n.shift:s=i=0;break;default:s=e[0],s<0&&(s=o+s),i=e.length>2?e.length-2:0,e[1],i+=s}const c=t.bind(this)(...e),l=this[r];let h;for(let t=s;t<i;t++){switch(h=this[t],typeof h){case"object":if(h){for(;t<i;)h=this[t],h&&!h[r]&&(this[t]=p(h)),t++;break}case"undefined":continue}break}return o!==this.length&&a(l,"length"),a(l,Symbol.iterator),c},h={push:l(n.push),unshift:l(n.unshift),fill:l(n.fill),sort:l(n.sort),reverse:l(n.reverse),pop:l(n.pop),shift:l(n.shift),splice:l(n.splice)},u={get(t,e){if(e!==r){let o=t[e];if(o&&o===n[e]){const s=h[e];if(s)return s.bind(t);o=o.bind(t)}return i(t[r],"length"!==e?Symbol.iterator:e),o}return t},set(t,e,o){if(e!==r){if(t[e]===o)return!0;const s=t[r];return o&&"object"==typeof o&&(o=p(o)),t[e]=o,"length"===e&&a(s,e),a(s,Symbol.iterator),!0}return((t,e)=>{const o=e.length,s=t.length;let n;for(let s=0;s<o;s++){let i=e[s];if(i&&"object"==typeof i){do{i=e[s],n=t[s],i?n?n!==i&&(n[r]=i):t[s]=p(i):t[s]=i}while(++s<o);break}if(null!=i){do{t[s]=e[s]}while(++s<o);break}t[s]=i}const i=t[r];s!==o&&(s>o&&(t.length=o),a(i,"length")),a(i,Symbol.iterator)})(t,o),!0},has:(t,e)=>(i(t[r],isNaN(parseInt(e))?e:Symbol.iterator),e in t),deleteProperty:(t,e)=>(isNaN(parseInt(e))||(e=Symbol.iterator),void 0!==t[e]&&a(t[r],e),delete t[e])},f={get(t,e){if(e!==r){const o=t[e];return i(t[r],e),o}return t},set(t,e,o,s){if(e!==r){if(t[e]===o)return!0;const s=t[r];return o&&"object"==typeof o&&(o=p(o)),t[e]=o,a(s,e),!0}return((t,e,o)=>{const s={...t};let n;for(const i in o){delete s[i];const a=o[i];a&&"object"==typeof a&&(n=t[i],n)?n[r]=a:t[i]!==a&&(e[i]=a)}for(const t in s)delete e[t]})(t,s,o),!0},has:(t,e)=>(i(t[r],e),e in t),deleteProperty:(t,e)=>(void 0!==t[e]&&a(t[r],e),delete t[e])},p=t=>{let e;if(Array.isArray(t)){e=[];const o=t.length;for(let s=0;s<o;s++){let r=t[s];if(r&&"object"==typeof r){do{e[s]=(r=t[s])&&p(r)}while(++s<o);break}if(null!=r){do{e[s]=t[s]}while(++s<o);break}e[s]=r}t=new Proxy(e,u)}else{e={};for(const o in t){const s=t[o];e[o]=s&&"object"==typeof s?p(s):s}t=new Proxy(e,f)}return e[r]={},t},d=(t,e)=>[t,e,t[e]],$=(t,e,o)=>{1===t&&(e[r]=o)},b=(t,e)=>{if(!e){const e=t.$;e.ver=0;const{state:o,$:s}=e;s(0,o,o),t.markChanged()}},g=(e,o)=>{const s=t;if(s.id){let t=s.$;if(t){const{state:s,$:r}=t;return r&&o&&(t.$=o,t.$(++t.ver,s,e)),s}const{state:r,$:n}=t=s.$={state:p(e),ver:1,$:o};return n&&(s.watchMountChange("s",b),n(1,r,e)),r}return p(e)},v={},y=({on:t,off:e})=>(g(v,o=>o<=1&&(o?t?.():e?.())),null);let m=0;const k=g({ver:0}),S=()=>k.ver=++m,j=(t,e)=>{const{pathname:o,search:s,hash:r}=window.location;t!==`${o}${s}${r}`&&(e?window.history.replaceState(void 0,"",t):window.history.pushState(void 0,"",t),queueMicrotask(S))};window.addEventListener("popstate",S);const A=/^(\/([*a-zA-Z0-9_.~-]+|:\w+))*\/?$/,I=/^[a-zA-Z0-9_.~-]+(&[a-zA-Z0-9_.~-]+)*$/,N=/[*.+?^${}()|[\]\\]/g,x=/\\\*/g,E=/:(\w+)/g,C=encodeURIComponent,z=decodeURIComponent;class P{constructor(t,e,o){this.com=t,this.o=e,this.auth=o,this.e=[];const{path:s,a:r,c:n}=this.t(e);this.p=this.I(s),this.g=r?this.u(r):void 0,this.i=n?this.u(n):void 0,e.includes("*")&&(this.build=()=>{throw new Error("Wildcard route does not support build")})}com;auth;build(t){const{o:e,e:o,g:s,i:r}=this;let n=e;o.forEach(e=>{const o=t[e]??"";n=n.replace(`:${e}`,C(o))});const i=this.v("?",t,s),a=this.v("#",t,r);return`${n}${i}${a}`}parse(t){const{path:e,a:o,c:s}=this.t(t),{p:r,e:n,g:i,i:a}=this,c=e.match(r);if(c){const t={};return n.forEach((e,o)=>{t[e]=z(c[o+1])}),i&&o&&this.w(t,o,i),a&&s&&this.w(t,s,a),t}}t(t){const e=t.indexOf("?"),o=t.indexOf("#",e>=0?e:0);let s=t,r="",n="";return e>=0&&(s=t.substring(0,e),r=t.substring(e+1,o>=0?o:void 0)),o>=0&&(e<0&&(s=t.substring(0,o)),n=t.substring(o+1)),{path:s,a:r,c:n}}I(t){let e=t,o="";if(e.endsWith("/**")&&(e=e.substring(0,e.length-3),o="/.*"),e.includes("**")||!A.test(e))throw new Error(`Illegal path pattern '${t}'`);const{e:s}=this,r=e.replace(N,"\\$&").replace(x,"[A-Za-z0-9_~.-]+").replace(E,(t,e)=>(s.push(e),"([^/]+)"));return new RegExp(`^${r}${o}$`)}u(t){if(!I.test(t))throw new Error(`Illegal query string pattern '${t}'`);const e=t.split("&"),o=new Set;for(const t of e)o.add(t);return o}w(t,e,o){const s=e.split("&");for(const e of s){const[s,r]=e.split("=");o.has(s)&&(t[s]=z(r))}}v(t,e,o){if(o){const s=[];for(const t of o){const o=e[t];void 0!==o&&s.push(`${t}=${C(o)}`)}if(s.length)return t+s.join("&")}return""}o;p;e;g;i}const Z=(t,e,o)=>new P(t,e,!o),_=({routes:t,notFound:e,checkAuth:o})=>{m=k.ver;const{pathname:r,search:n,hash:i}=window.location,a=`${r}${n}${i}`,{$s:c,$k:l,$c:h}=s;for(const e in t){const s=t[e],r=s.parse(a);if(r){if(o&&s.auth){const t=o(a);if(t)return void j(t)}return c(l(e),h("$",s.com,r,void 0,-1))}}return e?c(l("404"),h("$",e,{})):void 0},M=(t,e,o)=>{t.preventDefault();const{pathname:s,search:r,hash:n}=window.location;e!==`${s}${r}${n}`&&(o?window.history.replaceState(void 0,"",e):window.history.pushState(void 0,"",e),k.ver=++m)},R=(t,e)=>{const{href:o,className:r,style:n,title:i,replace:a}=t,c=o?t=>M(t,o,a):void 0;return s.$("$","a",{className:r,style:n,title:i,href:o,onclick:c},e,-1,1)},q=(t,e)=>{const{route:o,params:r,className:n,style:i,title:a,replace:c}=t,l=o.build(r);return s.$("$","a",{className:n,style:i,title:a,href:l,onclick:t=>M(t,l,c)},e,-1,1)};export{s as $ezh,y as Effect,R as Link,q as RouteLink,_ as Router,e as addComReader,d as bindData,j as navigate,o as refreshComReaders,$ as resetOnRemount,Z as route,g as useState};
package/package.json CHANGED
@@ -1,12 +1,6 @@
1
1
  {
2
2
  "name": "ezh",
3
- "version": "0.3.3",
4
- "scripts": {
5
- "start": "webpack serve"
6
- },
7
- "files": [
8
- "./lib/*"
9
- ],
3
+ "version": "0.3.8",
10
4
  "module": "./lib/index.min.js",
11
5
  "typings": "./lib/index.d.ts",
12
6
  "exports": {
@@ -23,10 +17,14 @@
23
17
  ],
24
18
  "author": "Andy Deng",
25
19
  "license": "MIT",
20
+ "files": [
21
+ "./lib/*"
22
+ ],
26
23
  "devDependencies": {
27
24
  "@eslint/eslintrc": "^3.2.0",
28
25
  "@eslint/js": "^9.19.0",
29
26
  "@rollup/plugin-terser": "^0.4.4",
27
+ "@types/node": "^25.0.3",
30
28
  "@typescript-eslint/eslint-plugin": "^8.25.0",
31
29
  "@typescript-eslint/parser": "^8.25.0",
32
30
  "css-loader": "^7.1.2",
@@ -35,15 +33,15 @@
35
33
  "eslint-plugin-import": "^2.31.0",
36
34
  "ezh-trans": "^0.2.2",
37
35
  "globals": "^16.5.0",
38
- "log-class": "^1.0.3",
39
- "minify-ts": "^1.2.8",
36
+ "log-class": "^1.0.6",
37
+ "minify-ts": "^1.3.1",
40
38
  "rollup": "^4.54.0",
41
39
  "sass": "^1.86.0",
42
40
  "sass-loader": "^16.0.5",
43
41
  "style-loader": "^4.0.0",
44
42
  "terser": "^5.44.1",
45
43
  "ts-loader": "^9.5.2",
46
- "typescript": "^5.8.2",
44
+ "typescript": "^5.9.3",
47
45
  "webpack": "^5.98.0",
48
46
  "webpack-cli": "^6.0.1",
49
47
  "webpack-dev-server": "^5.2.0"