ezh 0.2.0 → 0.2.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/2.min.mjs +1 -0
- package/lib/3.min.mjs +1 -0
- package/lib/debugCheck.min.mjs +1 -0
- package/lib/index.d.ts +3 -3
- package/lib/index.min.mjs +1 -0
- package/package.json +4 -5
- package/lib/RbTree.js +0 -727
- package/lib/bundle.min.js +0 -1
- package/lib/debugCheck.d.ts +0 -2
- package/lib/debugCheck.js +0 -69
- package/lib/elements.js +0 -1256
- package/lib/index.js +0 -4
- package/lib/router.js +0 -111
- package/lib/state.js +0 -340
package/lib/bundle.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
class e{ad(){return!this.k}G(e){for(;e.parent?.e;){let t=e.parent,r=t.parent;if(t===r.c){const n=r.d;n?.e?(t.e=!1,n.e=!1,r.e=!0,e=r):(e===t.d&&(e=t,this.y(e),t=e.parent,r=t.parent),t.e=!1,r.e=!0,this.z(r))}else{const n=r.c;!0===n?.e?(t.e=!1,n.e=!1,r.e=!0,e=r):(e===t.c&&(e=t,this.z(e),t=e.parent,r=t.parent),t.e=!1,r.e=!0,this.y(r))}}this.k.e=!1}r(e){const{c:t,d:r,parent:n}=e;if(!t)return n?(n.c===e?n.c=r:n.d=r,r?(r.parent=n,void(r.e=!1)):void(e.e||this.H(n))):(this.k=r,void(r&&(r.parent=void 0,r.e=!1)));if(!r)return n?n.c===e?n.c=t:n.d=t:this.k=t,t.parent=n,void(t.e=!1);let i,a,s=r;if(s.c){do{s=s.c}while(s.c);a=s.d,i=s.parent,i.c===s?i.c=a:i.d=a,a&&(a.parent=i),s.d=r,r.parent=s}else i=s,a=s.d;n?n.c===e?n.c=s:n.d=s:this.k=s,s.parent=n,s.c=t,t.parent=s;const o=s.e;s.e=e.e,a?a.e=!1:o||this.H(i)}H(e){let t,r;for(;;){if(t===e.c){if(r=e.d,r.e){this.y(e),r.e=!1,e.e=!0,r=e.d;continue}if(r.d?.e)return this.y(e),r.e=e.e,e.e=!1,void(r.d.e=!1);if(r.c?.e){r.c.e=!1,this.z(r),r.e=!0,r=e.d;continue}}else{if(r=e.c,r.e){this.z(e),r.e=!1,e.e=!0,r=e.c;continue}if(r.c?.e)return this.z(e),r.e=e.e,e.e=!1,void(r.c.e=!1);if(r.d?.e){r.d.e=!1,this.y(r),r.e=!0,r=e.c;continue}}if(e.e)return e.e=!1,void(r.e=!0);if(r.e=!0,t=e,!t.parent)return;e=t.parent}}y(e){const t=e.d;e.d=t?.c,t?.c&&(t.c.parent=e),t.parent=e.parent,e.parent?e===e.parent.c?e.parent.c=t:e.parent.d=t:this.k=t,t.c=e,e.parent=t}z(e){const t=e.c;e.c=t?.d,t?.d&&(t.d.parent=e),t.parent=e.parent,e.parent?e===e.parent.d?e.parent.d=t:e.parent.c=t:this.k=t,t.d=e,e.parent=t}k}class t extends e{search(e){return this.I(e)?.value}delete(e){const t=this.I(e);if(t)return this.r(t),t.value}ap(e){let t=this.k;if(t){for(;t.c;)t=t.c;return e&&this.r(t),t.value}}M(e){let t=this.k;if(t){for(;t.d;)t=t.d;return e&&this.r(t),t.value}}_(e,t,r){let n=this.k;if(n){let i;for(;e!==n.key;){if(e<n.key){if(n.c){n=n.c;continue}i={key:e,value:t,e:!0,parent:n,c:void 0,d:void 0},n.c=i}else{if(n.d){n=n.d;continue}i={key:e,value:t,e:!0,parent:n,c:void 0,d:void 0},n.d=i}return void this.G(i)}const a=n.value;return r&&(n.value=t),a}this.k={key:e,value:t,e:!1,parent:void 0,c:void 0,d:void 0}}ae(e,t){let r=0,n=this.k;if(n){const i=[];if(void 0!==t)for(;;){if(t<n.key){if(n.c){i.push(n),n=n.c;continue}}else if(t>n.key){if(n.d){n=n.d;continue}return r}break}else for(;n.c;)i.push(n),n=n.c;let a;for(;;){const t=e(n.key,n.value);if(r++,2&t&&(a??(a=[])).push(n),1&t){r=-r;break}if(n.d)for(n=n.d;n.c;)i.push(n),n=n.c;else if(n=i.pop(),!n)break}if(a){let e=a.length;for(;e>0;)this.r(a[--e])}}return r}P(e,t){let r=0,n=this.k;if(n){const i=[];if(void 0!==t)for(;;){if(t>n.key){if(n.d){i.push(n),n=n.d;continue}}else if(t<n.key){if(n.c){n=n.c;continue}return r}break}else for(;n.d;)i.push(n),n=n.d;let a;for(;;){const t=e(n.key,n.value);if(r++,2&t&&(a??(a=[])).push(n),1&t){r=-r;break}if(n.c)for(n=n.c;n.d;)i.push(n),n=n.d;else if(n=i.pop(),!n)break}if(a){let e=a.length;for(;e>0;)this.r(a[--e])}}return r}I(e){let t=this.k;if(t)for(;e!==t.key;){if(e<t.key){if(t.c){t=t.c;continue}}else if(t.d){t=t.d;continue}return}return t}}const r={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"},n={},i=[];Object.freeze(n),Object.freeze(i);const a=()=>!1,s=[],o=new Set,l=new t,c=new t,h=[],u=[],d={id:"",index:0,firstElement:null,attachTo:a,move:a,detachFrom:a,update:a,refresh:a,release:a,version:1,markChanged:a,watchMountChange:a};let f,p="",m=2e4,v=0,g=0;const y=new t,b=new Map;let w=d,k=(e,t)=>document.createElement(e);const x={svg:(e,t)=>(t.a4(),document.createElementNS("http://www.w3.org/2000/svg",e)),math:(e,t)=>(t.a4(),document.createElementNS("http://www.w3.org/1998/Math/MathML",e)),foreignObject:(e,t)=>"foreignObject"!==e?document.createElement(e):(t.a4(),document.createElementNS("http://www.w3.org/2000/svg",e))},C=()=>{if(++g>=v){for(const e of o)if(o.delete(e),e.id)e.release();else if(--g<v){o.add(e);break}}else o.add(Object.create(d));f&&(f=setTimeout(C,m))},E=(e,t)=>{const r=["",t];for(;e.constructor!==O;)r.push(e.id),e=e.parent;return r.reverse().join(",")},P=()=>{let e;for(;e=y.ap(!0);){const{id:t,newChildren:r,parent:n}=e;r&&(n&&A(n)?(e.refresh(r),n.currentBefore=void 0):e.version&&l._(t,e))}for(const{parent:e,element:t}of s){if(t.parent!==e&&!c.ad()&&A(e)){const r=!t.parent,n=E(e,t.id);c.ae((e,t)=>e.startsWith(n)?(t.z(t.a0,r),2):1,n)}t.parent||(v?o.add(t):t.release())}s.length=0},S=(e,t=[],r=0)=>{let n=e[r];for(;;){if(n&&void 0!==n.id)t.push(n);else if(null!=n)switch(typeof n){case"object":S(n,t);break;case"function":n=n();continue;case"boolean":case"number":case"bigint":n=""+n;default:t.push(new B("",n))}if(!(++r<e.length))break;n=e[r]}return t},$=(e,t,r)=>{let n;const i=e.length;let a=t,s=0;for(;s<i;){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=S(a,a.slice(0,s),s);continue}if(n!==a)break}n||t.parent===r||(n=e),s++}return s===a.length?n:a===t?S(a,e.slice(0,s),s):a},A=e=>{let t=e;do{if(t.parent===t)return!0;t=t.parent}while(t);return!1},j=(e,t,r,n)=>{let i,a,s;if(t!==e&&e.length){const o=[];let l;for(a=t.length,i=1e7;--a>=0;)if(s=t[a],s.parent===r){const e=a-s.index;e===i?(l.C++,s.index=a):(l={from:s.index,to:a,C:1},i=e,s.index=-o.push(l))}else 1e7!==i&&(i=1e7);const c=[];for(a=e.length-1;a>=0;)s=e[a],s.index<0?(l=o[-s.index-1],c.push(l),a-=l.C):(s.detachFrom(r),a--);let h,u,d=0;for(a=t.length-1;a>=0;)if(s=t[a],s.parent!==r)s.index=a--,s.attachTo(r);else{if(l=o[-s.index-1],u=l.C,h=c[d],s.index=a,!n){if(h===l){d++,a-=l.C,r.currentBefore=void 0;continue}if(h.from>l.from){i=d;do{u-=h.C,h=c[++i]}while(h.from>l.from&&u>0);if(u>0){a-=l.C,r.currentBefore=void 0,d=i;continue}}}i=a-l.C;do{s.move()}while(--a>i&&(s=t[a]))}}else for(a=t.length-1;a>=0;a--)s=t[a],s.index=a,r!==s.parent&&s.attachTo(r);r.currentBefore=void 0};class B{constructor(e,t){this.id=e,this.index=0,this.ab=t}id;parent;index;firstElement;attachTo(e){this.firstElement||(this.firstElement=document.createTextNode(this.ab));const{parent:t,firstElement:r,index:n}=this;this.id&&(t?(s.push({parent:t,element:this}),r.remove()):o.delete(this)),this.parent=e;let i=e.currentBefore;void 0===i&&(i=e.findNextSiblingElement(n)),e.element.insertBefore(r,i),e.currentBefore=r}move(){const{parent:e,index:t,firstElement:r}=this;let n=e.currentBefore;void 0===n&&(n=e.findNextSiblingElement(t)),e.element.insertBefore(r,n),e.currentBefore=r}detachFrom(e){this.parent===e&&(this.firstElement.remove(),this.parent=void 0,this.id&&s.push({parent:e,element:this}))}update(e){return this.ab!==e&&(this.ab=e,this.firstElement&&(this.firstElement.nodeValue=e)),!1}refresh(){}release(e){this.parent===e&&(e&&this.firstElement.remove(),b.delete(this.id))}ab}class R{constructor(e,t,r){this.id=e,this.index=0,this.newChildren=this.d=r?S(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 r=e[t].firstElement;if(r)return r}return null}attachTo(e){const{parent:t,d:r,newChildren:n}=this;if(t){s.push({parent:t,element:this});for(let e=r.length-1;e>=0;e--)r[e].detachFrom(this)}else o.delete(this);this.parent=e;const i=n||r;for(let e=i.length-1;e>=0;e--){const t=i[e];t.index=e,t.attachTo(this)}e.currentBefore=this.currentBefore,this.currentBefore=void 0,this.d=i,this.newChildren=void 0}move(){const{d:e,newChildren:t}=this;if(t)j(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:t}=this;for(const e of t)e.detachFrom(this);this.parent=void 0,s.push({parent:e,element:this})}}update(e,t){if(t){const e=$(this.d,t,this);if(e)return this.newChildren=e,!0}return!1}refresh(e){j(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)}b.delete(this.id)}}findNextSiblingElement(e){const t=this.newChildren||this.d;let r,n=e+1,i=t[n];for(;i;){if(r=i.firstElement,r)return r;i=t[++n]}return r=this.parent.currentBefore,void 0!==r?r:this.parent.findNextSiblingElement(this.index)}d}class F{constructor(e,t,r,a,s,o){if(this.id=e,this.index=0,this.firstElement=this.element=k(t,this),this.newChildren=this.d=o?S(a):a||i,r){if(this.n=n,this.s=-1,"select"===t){const e=this.element,t=r,n=t.value;if(n){t.value=void 0;const r=this.refresh;this.refresh=i=>{if(j(this.d,i,this),this.d=i,this.newChildren=void 0,Array.isArray(n)){const t=n,[r,i,a]=t;e.value=a;const s=t[3]=e=>r[i]=e.target.value;e.addEventListener("change",s)}else e.value=n;t.value=n,this.refresh=r}}}this.update(r),this.s=s??0}else this.n=r,this.s=0}id;element;parent;newChildren;index;currentBefore;firstElement;attachTo(e){const{parent:t,element:r,newChildren:n,index:i}=this;t?(s.push({parent:t,element:this}),r.remove()):o.delete(this),this.parent=e,n&&this.refresh(n);let a=e.currentBefore;void 0===a&&(a=e.findNextSiblingElement(i)),e.element.insertBefore(r,a),e.currentBefore=r}move(){const{parent:e,newChildren:t,index:r,element:n}=this;t&&this.refresh(t);let i=e.currentBefore;void 0===i&&(i=e.findNextSiblingElement(r)),e.element.insertBefore(n,i),e.currentBefore=n}detachFrom(e){this.parent===e&&(this.element.remove(),this.parent=void 0,s.push({parent:e,element:this}))}update(e,t){const{element:i,n:a,s}=this;if(a&&s){this.n=e;let t=s;for(const s in e){const o=e[s],l=a[s];if(o!==l)if(null!=o)switch(typeof o){case"string":{const e=r[s];e?i.setAttribute(e,o):i[s]=o;break}case"number":case"boolean":case"function":i[s]=o;break;default:if(Array.isArray(o)){const[e,t,r]=o;if(l){const[n,a,c,h]=l;if(c!==r&&i[s]!==r&&(i[s]=r),n===e&&a===t)o[3]=h;else{const r=o[3]=r=>e[t]=r.target[s];i.removeEventListener("change",h),i.addEventListener("change",r)}}else{i[s]=r;const n=o[3]=r=>e[t]=r.target[s];i.addEventListener("change",n)}break}if("style"===s){if(!l){const t=i.style,r={};let n=0;for(const e in o){const i=o[e];r[e]=i,n++,t[e]=i}e[s]=r,r.j=n;break}const t=i.style,r={};let n=0,a=l.j;for(const e in o){const i=o[e];r[e]=i,e in l&&a--,n++,i!==l[s]&&(t[e]=i)}if(e[s]=r,r.j=n,a)for(const e in l)if(!(e in o)&&(t[e]=null,! --a))break;break}i[s]=o}else switch(typeof l){case"string":{const e=r[s];e?this.element.removeAttribute(e):this.element[s]=o;break}case"object":l?Array.isArray(l)?i.removeEventListener("change",l[3]):l===n&&(i[s]=o):i[s]=o;break;default:i[s]=o}if(! --t)break}}if(t){const e=$(this.d,t,this);if(e)return this.newChildren=e,!0}return!1}refresh(e){j(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);b.delete(this.id)}}findNextSiblingElement(e){const t=this.newChildren||this.d;let r,n=e+1,i=t[n];for(;i;){if(r=i.firstElement,r)return r;i=t[++n]}return null}a4(){this.update=this.aO}aO(e,t){const{element:n,n:i,s:a}=this;if(i&&a){this.n=e;let t=a;for(const a in e){const s=e[a],o=i[a];if(s!==o)if(null!=s)switch(typeof s){case"string":n.setAttribute(r[a]??a,s);break;case"number":case"boolean":n.setAttribute(r[a]??a,""+s);break;case"function":n[a]=s;break;default:if("style"===a){if(!o){const t=n.style,r={};let i=0;for(const e in s){const n=s[e];r[e]=n,i++,t[e]=n}e[a]=r,r.j=i;break}const t=n.style,r={};let i=0,l=o.j;for(const e in s){const n=s[e];r[e]=n,e in o&&l--,i++,n!==o[a]&&(t[e]=n)}if(e[a]=r,r.j=i,l)for(const e in o)if(!(e in s)&&(t[e]=null,! --l))break;break}n[a]=s}else switch(typeof o){case"string":case"number":case"boolean":n.removeAttribute(r[a]??a);break;default:n[a]=s}if(! --t)break}}if(t){const e=$(this.d,t,this);if(e)return this.newChildren=e,!0}return!1}n;d;s}class z{constructor(e,t,r,n,a,s){this.id=e,this.index=0,this.version=1,this.aB=t,this.n=r,this.newChildren=this.d=s?S(n):n||i,this.s=a??0}id;parent;newChildren;index;version;get firstElement(){return this.i?.firstElement||null}attachTo(e){const{parent:t,newChildren:r,i:n}=this;this.parent=e,r?this.refresh(r):n&&(n.index=this.index,n.attachTo(e)),t?s.push({parent:t,element:this}):o.delete(this)}move(){const{newChildren:e,i:t}=this;e?this.refresh(e):t&&(t.index=this.index,t.move())}detachFrom(e){this.parent===e&&(this.i?.detachFrom(e),this.parent=void 0,s.push({parent:e,element:this}))}update(e,t){const{n:r,d:n,s:i}=this;if(this.n=e,t){const e=$(n,t,this.parent);if(e)return this.newChildren=e,!0}if(!this.newChildren&&i){let t=i;for(const i in r){if(r[i]!==e[i])return this.newChildren=n,!0;if(! --t)break}}return!1}refresh(e){const{id:t,parent:r,i,index:a}=this,s=w;w=this;let o=this.aB(this.n||n,e);if(o!==i)switch(typeof o){case"boolean":case"number":case"bigint":o=""+o;case"string":o=new B("",o),this.i=o,o.index=a,o.attachTo(r),i?.detachFrom(r);break;default:o?(this.i=o,o.index=a,o.attachTo(r),i?.detachFrom(r),l.ad()||l.ae((e,r)=>e.startsWith(t)?r.parent&&A(r.parent)?(y._(e,r),2):0:1,t)):(this.i=void 0,i?.detachFrom(r))}else i&&(i.parent!==r?(i.index=a,i.attachTo(r)):i.index!==a&&(i.index=a,i.move()));this.d=e,this.newChildren=void 0,w=s}release(e){this.parent===e&&(this.i?.release(e),this.parent=void 0,this.newChildren&&l.delete(this.id),b.delete(this.id))}markChanged(){return!this.newChildren&&(this.newChildren=this.d,!0)}watchMountChange(e,t,r){const n=E(this.parent,this.id);c._(n+e,{z:t,a0:r},!0)}aB;n;d;s;i}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.ac||(this.ac=new z(this.id,e,null,i),b.set(this.id,this.ac),this.ac.attachTo(this))}ac}const T=(e,t)=>{if(w.id){let r=e[t];r||(r=new Map,e[t]=r),r.set(w.id,w.version)}};let I=(e,t)=>{const r=e[t];if(r){for(const[e,t]of r){const r=b.get(e);r?.version===t&&r.markChanged()&&(y.ad()&&queueMicrotask(P),y._(e,r))}r.clear()}};const M=(e,t=2e4)=>{if(e>=0&&t>=1e3){if(m=t,v&&clearTimeout(f),e)f=setTimeout(C,m);else if(f){f=void 0;for(let e=0;e<v;e++)C()}return v=e,!0}return!1},N=()=>{p=u.pop()};var _;!function(e){e.render=(e,t)=>{const r=(h.length||"")+"|",n=new O(r,e);h.push(n),n.render(t)},e.$=(e,t,r,n,i,a)=>{const s=`${w.id}${e}${p}`;let o=b.get(s);return o?((r||n)&&o.update(r,n)&&y._(s,o),o):(o=new F(s,t,r,n,i,a),b.set(s,o),o)},e.$c=(e,t,r,n,i,a)=>{const s=`${w.id}${e}${p}`;let o=b.get(s);return o?((r||n)&&o.update(r,n)&&y._(s,o),o):(o=new z(s,t,r,n,i,a),b.set(s,o),o)},e.$f=(e,t,r)=>{const n=`${w.id}${e}${p}`;let i=b.get(n);return i?(t&&i.update(null,t)&&y._(n,i),i):(i=new R(n,t,r),b.set(n,i),i)},e.$k=e=>(u.push(p),p=`${p||"{"}${e}}`,N),e.$n=e=>{const t=k;return k=x[e],()=>{k=t}},e.$s=(e,t)=>(e(),t),e.$t=(e,t,r)=>{const n=`${w.id}${e}${p}`;let i=b.get(n);return i?(r&&i.update(t),i):(i=new B(n,t),b.set(i.id,i),i)}}(_||(_={}));const q=Symbol(),U=Array.prototype,L=T;let Z=(e,t)=>{Z=I,Z(e,t)},V=!1;const D=new WeakMap,Q=e=>function(...t){const r=this.length;let n,i,a;switch(e){case U.push:n=r,i=n+t.length,a=r;break;case U.unshift:n=0,i=t.length,a=r;break;case U.fill:n=t[1],void 0===n||n<=-r?n=0:n<0&&(n=r+n),i=t[2],void 0===i||i>r?i=r:i<=-r?i=0:i<0&&(i=r+i),a=i;break;case U.sort:case U.reverse:n=i=0,a=r;break;case U.pop:n=i=r-1,a=r;break;case U.shift:n=i=0,a=r;break;default:n=t[0],n<0&&(n=r+n),i=t.length>2?t.length-2:0,a=t[1],void 0===a&&(a=r-n),a=a>0?a!==i?r:n+i:i?r:n,i+=n}const s=e.bind(this)(...t),o=this[q];let l;for(let e=n;e<i;e++){switch(l=this[e],typeof l){case"object":if(l){for(;e<i;)l=this[e],l&&!l[q]&&(this[e]=K(l)),e++;break}case"undefined":continue}break}return r!==this.length&&Z(o,"length"),Z(o,Symbol.iterator),s},H={push:Q(U.push),unshift:Q(U.unshift),fill:Q(U.fill),sort:Q(U.sort),reverse:Q(U.reverse),pop:Q(U.pop),shift:Q(U.shift),splice:Q(U.splice)},W={get(e,t){if(t!==q){let r=e[t];if(r&&r===U[t]){const n=H[t];if(n)return n.bind(e);r=r.bind(e)}return L(e[q],"length"!==t?Symbol.iterator:t),r}return e},set(e,t,r){if(t!==q){if(e[t]===r)return!0;const n=e[q];return r&&"object"==typeof r&&(r=K(r)),e[t]=r,"length"===t&&Z(n,t),Z(n,Symbol.iterator),!0}return((e,t)=>{const r=t.length,n=e.length;let i;for(let n=0;n<r;n++){let a=t[n];if(a&&"object"==typeof a){do{a=t[n],i=e[n],a?i?i!==a&&(i[q]=a):e[n]=K(a):e[n]=a}while(++n<r);break}if(null!=a){do{e[n]=t[n]}while(++n<r);break}e[n]=a}const a=e[q];n!==r&&(n>r&&(e.length=r),Z(a,"length")),Z(a,Symbol.iterator)})(e,r),!0},has:(e,t)=>(L(e[q],isNaN(parseInt(t))?t:Symbol.iterator),t in e),deleteProperty:(e,t)=>(isNaN(parseInt(t))||(t=Symbol.iterator),void 0!==e[t]&&Z(e[q],t),delete e[t])},G={get(e,t){if(t!==q){const r=e[t];return"id"!==t&&L(e[q],t),r}return e},set(e,t,r,n){if(t!==q){if(e[t]===r)return!0;const n=e[q];return r&&"object"==typeof r&&(r=K(r)),e[t]=r,Z(n,t),!0}return((e,t,r)=>{const n={...e};let i;for(const a in r){delete n[a];const s=r[a];s&&"object"==typeof s&&(i=e[a],i)?i[q]=s:e[a]!==s&&(t[a]=s)}for(const e in n)delete t[e]})(e,n,r),!0},has:(e,t)=>(L(e[q],t),t in e),deleteProperty:(e,t)=>(void 0!==e[t]&&Z(e[q],t),delete e[t])},K=e=>{let t;if(Array.isArray(e)){t=[];const r=e.length;for(let n=0;n<r;n++){let i=e[n];if(i&&"object"==typeof i){do{t[n]=(i=e[n])&&K(i)}while(++n<r);break}if(null!=i){do{t[n]=e[n]}while(++n<r);break}t[n]=i}e=new Proxy(t,W)}else{t={};for(const r in e){const n=e[r];t[r]=n&&"object"==typeof n?K(n):n}e=new Proxy(t,G)}return t[q]={},e},X=(e,t)=>{t?(e.ver=0,e.hook(0,e.state)):e.com.watchMountChange("s",X,e)},J=(e,t)=>[e,t,e[t]],Y=(e,t)=>{const r=w;if(r.id){let n=D.get(r);if(n){const{state:e,hook:t}=n;return t&&(n.ver||r.watchMountChange("s",X,n),V=!0,t(++n.ver,e),V=!1),e}const i=K(e);return n={com:r,state:i,ver:1,hook:t},D.set(r,n),t&&(r.watchMountChange("s",X,n),V=!0,t(1,i),V=!1),i}return K(e)};var ee=function(){return ee=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ee.apply(this,arguments)},te=function(e){return void 0===e&&(e={}),{arrayFormat:e.arrayFormat||"none",booleanFormat:e.booleanFormat||"none",nullFormat:e.nullFormat||"default"}},re=function(e){return encodeURIComponent(e)},ne=function(e){return decodeURIComponent(e)},ie=function(e,t){var r=te(t);return function(e){var t=e.indexOf("?");return-1===t?e:e.slice(t+1)}(e).split("&").reduce(function(e,t){var n=t.split("="),i=n[0],a=n[1],s=function(e){var t=e.indexOf("["),r=-1!==t;return{hasBrackets:r,name:r?e.slice(0,t):e}}(i),o=s.hasBrackets,l=s.name,c=e[l],h=function(e,t){if(void 0===e)return"empty-true"===t.booleanFormat||null;if("string"===t.booleanFormat){if("true"===e)return!0;if("false"===e)return!1}if("unicode"===t.booleanFormat){if("✓"===ne(e))return!0;if("✗"===ne(e))return!1}return"string"===t.nullFormat&&"null"===e?null:ne(e)}(a,r);return e[l]=void 0===c?o?[h]:h:(Array.isArray(c)?c:[c]).concat(h),e},{})},ae=/[^!$'()*+,;|:]/g,se=function(e){return e.replace(ae,function(e){return encodeURIComponent(e)})},oe={default:se,uri:encodeURI,uriComponent:encodeURIComponent,none:function(e){return e},legacy:encodeURI},le={default:decodeURIComponent,uri:decodeURI,uriComponent:decodeURIComponent,none:function(e){return e},legacy:decodeURIComponent},ce=function(e,t,r){var n=oe[t]||se;return r?String(e).split("/").map(n).join("/"):n(String(e))},he=function(e){return"("+(e?e.replace(/(^<|>$)/g,""):"[a-zA-Z0-9-_.~%':|=+\\*@$]+")+")"},ue=[{name:"url-parameter",pattern:/^:([a-zA-Z0-9-_]*[a-zA-Z0-9]{1})(<(.+?)>)?/,regex:function(e){return new RegExp(he(e[2]))}},{name:"url-parameter-splat",pattern:/^\*([a-zA-Z0-9-_]*[a-zA-Z0-9]{1})/,regex:/([^?]*)/},{name:"url-parameter-matrix",pattern:/^;([a-zA-Z0-9-_]*[a-zA-Z0-9]{1})(<(.+?)>)?/,regex:function(e){return new RegExp(";"+e[1]+"="+he(e[2]))}},{name:"query-parameter",pattern:/^(?:\?|&)(?::)?([a-zA-Z0-9-_]*[a-zA-Z0-9]{1})/},{name:"delimiter",pattern:/^(\/|\?)/,regex:function(e){return new RegExp("\\"+e[0])}},{name:"sub-delimiter",pattern:/^(!|&|-|_|\.|;)/,regex:function(e){return new RegExp(e[0])}},{name:"fragment",pattern:/^([0-9a-zA-Z]+)/,regex:function(e){return new RegExp(e[0])}}],de=function e(t,r){if(void 0===r&&(r=[]),!ue.some(function(n){var i=t.match(n.pattern);return!!i&&(r.push({type:n.name,match:i[0],val:i.slice(1,2),otherVal:i.slice(2),regex:n.regex instanceof Function?n.regex(i):n.regex}),i[0].length<t.length&&(r=e(t.substr(i[0].length),r)),!0)}))throw new Error("Could not parse path '"+t+"'");return r},fe=function(e){return null!=e},pe={urlParamsEncoding:"default"},me=function(){function e(e,t){if(!e)throw new Error("Missing path in Path constructor");this.path=e,this.options=ee(ee({},pe),t),this.tokens=de(e),this.hasUrlParams=this.tokens.filter(function(e){return/^url-parameter/.test(e.type)}).length>0,this.hasSpatParam=this.tokens.filter(function(e){return/splat$/.test(e.type)}).length>0,this.hasMatrixParams=this.tokens.filter(function(e){return/matrix$/.test(e.type)}).length>0,this.hasQueryParams=this.tokens.filter(function(e){return/^query-parameter/.test(e.type)}).length>0,this.spatParams=this.getParams("url-parameter-splat"),this.urlParams=this.getParams(/^url-parameter/),this.queryParams=this.getParams("query-parameter"),this.params=this.urlParams.concat(this.queryParams),this.source=this.tokens.filter(function(e){return void 0!==e.regex}).map(function(e){return e.regex.source}).join("")}return e.createPath=function(t,r){return new e(t,r)},e.prototype.isQueryParam=function(e){return-1!==this.queryParams.indexOf(e)},e.prototype.isSpatParam=function(e){return-1!==this.spatParams.indexOf(e)},e.prototype.test=function(e,t){var r=this,n=ee(ee({caseSensitive:!1,strictTrailingSlash:!1},this.options),t),i=function(e,t){return t||"\\/"===e?e:e.replace(/\\\/$/,"")+"(?:\\/)?"}(this.source,n.strictTrailingSlash),a=this.urlTest(e,i+(this.hasQueryParams?"(\\?.*$|$)":"$"),n.caseSensitive,n.urlParamsEncoding);if(!a||!this.hasQueryParams)return a;var s=ie(e,n.queryParams);return 0===Object.keys(s).filter(function(e){return!r.isQueryParam(e)}).length?(Object.keys(s).forEach(function(e){return a[e]=s[e]}),a):null},e.prototype.partialTest=function(e,t){var r=this,n=ee(ee({caseSensitive:!1,delimited:!0},this.options),t),i=function(e,t){return t?/(\/)$/.test(e)?e:e+"(\\/|\\?|\\.|;|$)":e}(this.source,n.delimited),a=this.urlTest(e,i,n.caseSensitive,n.urlParamsEncoding);if(!a)return a;if(!this.hasQueryParams)return a;var s=ie(e,n.queryParams);return Object.keys(s).filter(function(e){return r.isQueryParam(e)}).forEach(function(e){return function(e,t,r){void 0===r&&(r="");var n=e[t];return e[t]=void 0===n?r:Array.isArray(n)?n.concat(r):[n,r],e}(a,e,s[e])}),a},e.prototype.build=function(e,t){var r=this;void 0===e&&(e={});var n=ee(ee({ignoreConstraints:!1,ignoreSearch:!1,queryParams:{}},this.options),t),i=Object.keys(e).filter(function(e){return!r.isQueryParam(e)}).reduce(function(t,i){if(!fe(e[i]))return t;var a=e[i],s=r.isSpatParam(i);return"boolean"==typeof a?t[i]=a:Array.isArray(a)?t[i]=a.map(function(e){return ce(e,n.urlParamsEncoding,s)}):t[i]=ce(a,n.urlParamsEncoding,s),t},{});if(this.urlParams.some(function(t){return!fe(e[t])})){var a=this.urlParams.filter(function(t){return!fe(e[t])});throw new Error("Cannot build path: '"+this.path+"' requires missing parameters { "+a.join(", ")+" }")}if(!n.ignoreConstraints&&!this.tokens.filter(function(e){return/^url-parameter/.test(e.type)&&!/-splat$/.test(e.type)}).every(function(e){return new RegExp("^"+he(e.otherVal[0])+"$").test(i[e.val])}))throw new Error("Some parameters of '"+this.path+"' are of invalid format");var s=this.tokens.filter(function(e){return!1===/^query-parameter/.test(e.type)}).map(function(e){return"url-parameter-matrix"===e.type?";"+e.val+"="+i[e.val[0]]:/^url-parameter/.test(e.type)?i[e.val[0]]:e.match}).join("");if(n.ignoreSearch)return s;var o=function(e,t){var r=te(t);return Object.keys(e).filter(function(t){return void 0!==e[t]}).map(function(t){return function(e,t,r){return null===t?function(e,t){return"hidden"===t.nullFormat?"":"string"===t.nullFormat?e+"=null":e}(e,r):"boolean"==typeof t?function(e,t,r){return"empty-true"===r.booleanFormat&&t?e:e+"="+("unicode"===r.booleanFormat?t?"✓":"✗":t.toString())}(e,t,r):Array.isArray(t)?function(e,t,r){var n=function(e){return"index"===e.arrayFormat?function(e,t){return e+"["+t+"]"}:"brackets"===e.arrayFormat?function(e){return e+"[]"}:function(e){return e}}(r);return t.map(function(t,r){return n(e,r)+"="+re(t)}).join("&")}(e,t,r):e+"="+re(t)}(t,e[t],r)}).filter(Boolean).join("&")}(this.queryParams.filter(function(t){return-1!==Object.keys(e).indexOf(t)}).reduce(function(t,r){return t[r]=e[r],t},{}),n.queryParams);return o?s+"?"+o:s},e.prototype.getParams=function(e){var t=e instanceof RegExp?function(t){return e.test(t.type)}:function(t){return t.type===e};return this.tokens.filter(t).map(function(e){return e.val[0]})},e.prototype.urlTest=function(e,t,r,n){var i=this,a=new RegExp("^"+t,r?"":"i"),s=e.match(a);return s?this.urlParams.length?s.slice(1,this.urlParams.length+1).reduce(function(e,t,r){return e[i.urlParams[r]]=(le[n]||decodeURIComponent)(t),e},{}):{}:null},e}();let ve=0;const ge=Y({ver:0});window.addEventListener("popstate",()=>{ge.ver=++ve});const ye=(e,t)=>{const{pathname:r,search:n,hash:i}=window.location;e!==`${r}${n}${i}`&&(t?window.history.replaceState(void 0,"",e):window.history.pushState(void 0,"",e),queueMicrotask(()=>{ge.ver=++ve}))},be="ezhEZH";class we{constructor(e,t,r){this.com=e,this.b=me.createPath(t+be),this.needAuth=r}com;needAuth;parseParam(e){const t=this.b.test(e);if(t)return delete t[be],t}buildUrl(e){throw new Error("WildcardRoute does not support buildUrl")}b}class ke{constructor(e,t,r){this.com=e,this.b=me.createPath(t),this.needAuth=r}com;needAuth;parseParam(e){return this.b.test(e)}buildUrl(e){return this.b.build(e)}b}const xe=(e,t,r=!0)=>t.endsWith("*")?new we(e,t,r):new ke(e,t,r),Ce=({routes:e,notFound:t,checkAuth:r})=>{ve=ge.ver;const{pathname:n,search:i,hash:a}=window.location,s=`${n}${i}${a}`,{$s:o,$k:l,$c:c}=_;for(const t in e){const n=e[t],i=n.parseParam(s);if(i){if(r&&n.needAuth){const e=r(s);if(e)return void ye(e)}return o(l(t),c("_",n.com,i,void 0,-1))}}return t?o(l("404"),c("_",t,{})):void 0},Ee=(e,t,r)=>{e.preventDefault();const{pathname:n,search:i,hash:a}=window.location;t!==`${n}${i}${a}`&&(r?window.history.replaceState(void 0,"",t):window.history.pushState(void 0,"",t),ge.ver=++ve)},Pe=(e,t)=>{const{href:r,className:n,style:i,title:a,replace:s}=e,o=r?e=>Ee(e,r,s):void 0;return _.$("_","a",{className:n,style:i,title:a,href:r,onclick:o},t,-1,1)},Se=(e,t)=>{const{route:r,params:n,className:i,style:a,title:s,replace:o}=e,l=r.buildUrl(n);return _.$("_","a",{className:i,style:a,title:s,href:l,onclick:e=>Ee(e,l,o)},t,-1,1)};export{_ as $ezh,Pe as Link,Se as RouteLink,Ce as Router,T as addComReader,J as bindData,M as configGC,ye as navigate,I as refreshComReaders,xe as route,Y as useState};
|
package/lib/debugCheck.d.ts
DELETED
package/lib/debugCheck.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { o, J, m, refreshComReaders, aC } from './elements';
|
|
2
|
-
import { u, y } from './state';
|
|
3
|
-
const a = (text, k) => {
|
|
4
|
-
const g = new Error(text);
|
|
5
|
-
const stack = g.stack;
|
|
6
|
-
if (stack) {
|
|
7
|
-
const i = stack.indexOf('\n');
|
|
8
|
-
let d = i;
|
|
9
|
-
for (let b = 0; b < k; b++) {
|
|
10
|
-
d = stack.indexOf('\n', d + 1);
|
|
11
|
-
}
|
|
12
|
-
g.stack = stack.substring(0, i) + stack.substring(d);
|
|
13
|
-
}
|
|
14
|
-
return g;
|
|
15
|
-
};
|
|
16
|
-
const j = (target, l) => {
|
|
17
|
-
const { get, set } = target;
|
|
18
|
-
target.get = function (key) {
|
|
19
|
-
const e = get.bind(this)(key);
|
|
20
|
-
if (e) {
|
|
21
|
-
if (o.id && !u) {
|
|
22
|
-
if (e.f < J) {
|
|
23
|
-
e.f = J;
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
l();
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return e.data;
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
target.set = function (key, c) {
|
|
33
|
-
const q = {
|
|
34
|
-
f: J,
|
|
35
|
-
data: c,
|
|
36
|
-
};
|
|
37
|
-
return set.bind(this)(key, q);
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
const n = refreshComReaders;
|
|
41
|
-
let h = false;
|
|
42
|
-
const p = (readerRecord, key) => {
|
|
43
|
-
if (o.id) {
|
|
44
|
-
if (!u) {
|
|
45
|
-
throw a('Models should not be modified while rendering', 3);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
h = true;
|
|
49
|
-
n(readerRecord, key);
|
|
50
|
-
h = false;
|
|
51
|
-
};
|
|
52
|
-
const r = () => {
|
|
53
|
-
aC(p);
|
|
54
|
-
j(m, () => {
|
|
55
|
-
throw a('This element already exists, "key" prop is required when it is in a loop', 5);
|
|
56
|
-
});
|
|
57
|
-
j(y, () => {
|
|
58
|
-
throw a('The "useState" function can only be called once in the com function', 4);
|
|
59
|
-
});
|
|
60
|
-
const s = m.get;
|
|
61
|
-
m.get = function (key) {
|
|
62
|
-
if (!h && !o.id) {
|
|
63
|
-
throw a('All the elements must be in a closure that passed to h.render()', 3);
|
|
64
|
-
}
|
|
65
|
-
return s.bind(this)(key);
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
r();
|
|
69
|
-
//# sourceMappingURL=debugCheck.js.map
|