essor 0.0.13-beta.1 → 0.0.13-beta.3
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/dist/essor.cjs.js +33 -40
- package/dist/essor.cjs.js.map +1 -1
- package/dist/essor.d.cts +1 -1
- package/dist/essor.d.ts +1 -1
- package/dist/essor.dev.cjs.js +867 -1169
- package/dist/essor.dev.esm.js +849 -1149
- package/dist/essor.esm.js +6 -11
- package/dist/essor.esm.js.map +1 -1
- package/package.json +4 -4
package/dist/essor.cjs.js
CHANGED
|
@@ -1,58 +1,51 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* essor v0.0.13-beta.
|
|
4
|
+
* essor v0.0.13-beta.3
|
|
5
5
|
* (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
6
6
|
* @license MIT
|
|
7
7
|
**/
|
|
8
|
-
var bt="0.0.13-beta.1";var yt=t=>t!==null&&typeof t=="object";var q=Array.isArray;function X(t){return typeof t=="string"}function Nt(t){return typeof t=="symbol"}function St(t){return t==null}var b=t=>typeof t=="function";function Y(t){return t===!1||t===null||t===void 0}function z(t){return Array.isArray(t)?t.flat():[t]}function w(t,e){return X(t)?t.indexOf(e)===0:!1}function _t(t){return t.replaceAll(/["&'<>]/g,e=>{switch(e){case"&":return "&";case"<":return "<";case">":return ">";case'"':return """;case"'":return "'";default:return e}})}var wt=t=>t.replaceAll(/[A-Z]+/g,(e,r)=>`${r>0?"-":""}${e.toLocaleLowerCase()}`);var Ct=t=>t.charAt(0).toUpperCase()+t.slice(1);var re=Object.defineProperty,Et=Object.getOwnPropertySymbols,ne=Object.prototype.hasOwnProperty,se=Object.prototype.propertyIsEnumerable,Mt=(t,e,r)=>e in t?re(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,D=(t,e)=>{for(var r in e||(e={}))ne.call(e,r)&&Mt(t,r,e[r]);if(Et)for(var r of Et(e))se.call(e,r)&&Mt(t,r,e[r]);return t},_=t=>t!==null&&typeof t=="object",k=Array.isArray;function ie(t){return typeof t=="string"}function ct(t){return R.call(t)==="[object Set]"}function $t(t){return R.call(t)==="[object WeakMap]"}function Lt(t){return R.call(t)==="[object WeakSet]"}function at(t){return R.call(t)==="[object Map]"}var ut=t=>typeof t=="function",It=t=>R.call(t)==="[object Object]";function Tt(t){return ie(t)?!Number.isNaN(Number(t)):!1}var R=Object.prototype.toString,oe=Object.prototype.hasOwnProperty,lt=(t,e)=>oe.call(t,e),$=(t,e)=>t!==e&&(t===t||e===e),Wt=Function.prototype;function A(t,e){return Array.isArray(e)?e.includes(t):ut(e)?e(t):!1}function x(t,...e){console.warn.apply(console,[`[Essor warn]: ${t}`].concat(e));}var tt=[],et=[],Ot=Promise.resolve(),rt=!1;function ft(t){return t?Ot.then(t):Ot}function ce(t){tt.includes(t)||(tt.push(t),Ht());}function Ht(){rt||(rt=!0,ft(le));}function ae(t){ue(t,et);}function ue(t,e){e.includes(t)||(e.push(t),Ht());}function le(){rt=!1,fe();let t;for(;t=tt.shift();)t&&t();}function fe(){for(;et.length>0;){let t=et.shift();t&&t();}}var y=null,he=null,nt=new WeakMap,V=new WeakMap,L=Symbol("ReactiveSymbol"),I=Symbol("__raw"),Pt=Symbol("SignalValueKey"),jt=Symbol("ComputedValueKey"),st=Symbol("ReactiveArrayKey"),g=Symbol("ReactiveCollectionKey"),M=Symbol("ReactiveWeakCollectionKey"),it=!1,B=new Set;function f(t,e){if(!y&&!he)return;let r=nt.get(t);r||(r=new Map,nt.set(t,r));let n=r.get(e);n||(n=new Set,r.set(e,n)),y&&n.add(y);}function v(t,e){let r=nt.get(t);if(!r)return;let n=r.get(e);n&&n.forEach(s=>{if(lt(s,"active")&&!s.active){n.delete(s);return}it?B.add(s):s();});}var Ft=class{constructor(t,e=!1){this.__signal=!0,this._shallow=e,this._value=t;}get value(){return f(this,Pt),_(this._value)&&!this._shallow?W(this._value):this._value}set value(t){p(t)&&(t=t.peek()),$(t,this._value)&&(this._value=t,v(this,Pt));}peek(){return this._value}};function J(t){return p(t)?t:new Ft(t)}function Kt(t){return new Ft(t,!0)}function p(t){return !!(t&&(t!=null&&t.__signal))}var pe=class{constructor(t){this.fn=t,this.__computed=!0;let e=y;y=this.run.bind(this),this._value=this.fn(),y=e;}peek(){return this._value}run(){let t=this.fn();$(t,this._value)&&(this._value=t,v(this,jt));}get value(){return f(this,jt),this._value}};function de(t){return new pe(t)}function qt(t){return !!(t&&t.__computed)}function me(t,e){return e==="sync"?()=>t():e==="pre"?()=>ae(t):()=>{ft(()=>ce(t));}}function T(t,e={}){let{flush:r="pre",onTrack:n,onTrigger:s}=e;function i(){let a=y;y=i.init?i:i.scheduler,t(),s&&s(),y=a;}let o=me(i,r);return i.scheduler=o,i.init=!0,i.active=!0,n&&n(),i(),()=>{i.active=!1,y=null;}}function zt(t,e){return !t||!_(t)?(x("initialValues must be an object,will return initial value!",t),t):Object.entries(t).reduce((n,[s,i])=>(n[s]=A(s,e)||p(i)?i:J(i),n),{})}function ge(t,e){return t?p(t)?t.peek():k(t)?t.map(r=>ge(r,e)):It(t)?Object.entries(t).reduce((r,[n,s])=>(A(n,e)?r[n]=s:r[n]=p(s)?s.peek():O(s)?h(s):s,r),{}):t:{}}function O(t){return !!(t&&typeof t=="object"&&t[L])}function W(t,e){return ht(t,!1,e)}function Xe(t,e){return ht(t,!0,e)}function h(t){return !_(t)||!O(t)?t:t[I]}var ve=(t,e)=>({get(r,n,s){if(n===L)return !0;if(n===I)return r;let i=Reflect.get(r,n,s),o=p(i)?i.value:i;return A(n,e)?o:(f(r,n),_(o)&&!t?W(o):o)},set(r,n,s,i){if(A(n,e))return Reflect.set(r,n,s,i),!0;let o=Reflect.get(r,n,i);p(o)&&(o=o.value),p(s)&&(s=s.value);let a=Reflect.set(r,n,s,i);return $(s,o)&&v(r,n),a},deleteProperty(r,n){let s=Reflect.get(r,n),i=Reflect.deleteProperty(r,n);return s!==void 0&&v(r,n),i}}),At=be();function be(){let t={};return ["includes","indexOf","lastIndexOf"].forEach(e=>{t[e]=function(...r){let n=this;for(let i=0,o=this.length;i<o;i++)f(n,`${i}`);let s=n[e](...r);return s===-1||s===!1?n[e](...r):s};}),["push","pop","shift","unshift","splice","sort","reverse","fill","copyWithin"].forEach(e=>{t[e]=function(...r){let n=h(this),s=n[e].apply(this,r);return v(n,st),s};}),["forEach","map","filter","reduce","reduceRight","some","every","find","findIndex","findLast","findLastIndex","entries","keys","values"].forEach(e=>{t[e]=function(...r){let n=h(this);return f(n,st),n[e].apply(this,r)};}),t}var ye=(t,e)=>({get(r,n,s){if(n===L)return !0;if(n===I)return r;if(At.hasOwnProperty(n))return Reflect.get(At,n,s);let i=Reflect.get(r,n,s);return A(n,e)?i:(Tt(n)&&f(r,n),f(r,"length"),_(i)&&!t?ht(i):i)},set(r,n,s,i){let o=Reflect.get(r,n,i),a=Reflect.set(r,n,s,i);return $(s,o)&&(Tt(n)&&v(r,n),n==="length"&&v(r,"length")),a}}),Ne={get(t,e){return e===L?!0:e===I?t:((e===Symbol.iterator||e==="size")&&f(t,g),Reflect.get(lt(xt,e)&&e in t?xt:t,e,t))}},Se={get(t,e){return e===L?!0:e===I?t:Reflect.get(lt(kt,e)&&e in t?kt:t,e,t)}},xt={get(t){let e=h(this);return f(e,g),e.get(t)},set(t,e){let r=h(this),n=r.set(t,e);return v(r,g),n},add(t){let e=h(this),r=e.add(t);return v(e,g),r},has(t){let e=h(this);return f(e,g),e.has(t)},delete(t){let e=h(this),r=e.has(t),n=e.delete(t);return r&&v(e,g),n},clear(){let t=h(this),e=t.size>0,r=t.clear();return e&&v(t,g),r},forEach(t,e){let r=h(this);f(r,g),r.forEach((n,s)=>{t.call(e,n,s,r);});},get size(){let t=h(this);return f(t,g),t.size},keys(){let t=h(this);return f(t,g),t.keys()},values(){let t=h(this);return f(t,g),t.values()},entries(){let t=h(this);return f(t,g),t.entries()},[Symbol.iterator](){let t=h(this);return f(t,g),t[Symbol.iterator]()}},kt={get(t){let e=h(this);return f(e,M),e.get(t)},set(t,e){let r=h(this),n=r.set(t,e);return v(r,M),n},add(t){let e=h(this),r=e.add(t);return v(e,M),r},has(t){let e=h(this);return f(e,M),e.has(t)},delete(t){let e=h(this),r=e.delete(t);return v(e,M),r}};function ht(t,e=!1,r){if(!_(t)||O(t))return t;if(V.has(t))return V.get(t);let n;k(t)?(f(t,st),n=ye(e,r)):ct(t)||at(t)?(f(t,g),n=Ne):Lt(t)||$t(t)?(f(t,M),n=Se):n=ve(e,r);let s=new Proxy(t,n);return V.set(t,s),s}function Ye(t){if(!O(t)){x("clearReactive: argument must be a reactive object");return}if($t(t)||Lt(t)){x("clearReactive: WeakMap and WeakSet are not clearable");return}_e(()=>{k(t)?t.length=0:ct(t)||at(t)?t.clear():_(t)&&Object.keys(t).forEach(e=>{delete t[e];});});}function _e(t){try{it=!0,t();}finally{it=!1,we();}}function we(){B.size>0&&(B.forEach(t=>t()),B.clear());}function Ve(t,e,r){return Me(t,e,r)}var Rt=void 0,U,ot=!1;function Ce(t){U=t,ot||(ot=!0,ft(Ee));}function Ee(){U==null||U(),U=null,ot=!1;}function Me(t,e,{deep:r,immediate:n}={}){let s,i=k(t);if(p(t)||qt(t))s=()=>t.value;else if(O(t))s=()=>D({},t);else if(i)s=()=>t.map(c=>Te(c));else if(ut(t))s=t;else return x("Invalid source type",t),Wt;if(e&&r){let c=s,u=r===!0?1/0:r;s=()=>j(c(),u);}let o=i?Array.from({length:t.length}).fill(Rt):Rt,a=!1,l=()=>{let c=s();$(c,o)&&(n&&e&&(e(c,o),o=c),a&&e&&Ce(()=>{e(c,o),o=c;}),!a&&(o=c));},d=T(l,{flush:"sync"});return a=!0,n&&l(),d}function Te(t){return p(t)||qt(t)?t.value:O(t)?D({},t):ut(t)?t():(x("Invalid source",t),Wt)}function j(t,e=1/0,r){if(e<=0||!_(t)||(r=r||new Set,r.has(t)))return t;if(r.add(t),e--,p(t))j(t.value,e,r);else if(k(t))for(let n of t)j(n,e,r);else if(ct(t)||at(t))t.forEach(n=>{j(n,e,r);});else if(It(t))for(let n in t)j(t[n],e,r);return t}function Oe(t){let{state:e,getters:r,actions:n}=t,s=D({},e!=null?e:{}),i=W(e!=null?e:{}),o=[],a=[],d=D({state:i},{patch$(c){Object.assign(i,c),o.forEach(u=>u(i)),a.forEach(u=>u(i));},subscribe$(c){o.push(c);},unsubscribe$(c){let u=o.indexOf(c);u!==-1&&o.splice(u,1);},onAction$(c){a.push(c);},reset$(){Object.assign(i,s);}});for(let c in r){let u=r[c];u&&Object.defineProperty(d,c,{get(){return de(u.bind(i,i)).value},enumerable:!0,configurable:!0});}for(let c in n){let u=n[c];u&&(d[c]=u.bind(i));}return d}function tr(t){return function(){return Oe(t)}}var Pe=Object.defineProperty,Bt=Object.getOwnPropertySymbols,je=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,Ut=(t,e,r)=>e in t?Pe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xe=(t,e)=>{for(var r in e||(e={}))je.call(e,r)&&Ut(t,r,e[r]);if(Bt)for(var r of Bt(e))Ae.call(e,r)&&Ut(t,r,e[r]);return t},dt=class H{constructor(){this.hooks={mounted:new Set,destroy:new Set};}addEventListener(){}removeEventListener(){}addHook(e,r){var n;(n=this.hooks[e])==null||n.add(r);}getContext(e){return H.context[e]}setContext(e,r){H.context[e]=r;}initRef(){H.ref=this;}removeRef(){H.ref=null;}};dt.ref=null;dt.context={};var E=dt,mt=class extends E{constructor(t,e,r){super(),this.template=t,this.props=e,this.key=r,this.proxyProps={},this.emitter=new Set,this.mounted=!1,this.rootNode=null,this.context={},this.trackMap=new Map,this.proxyProps=zt(e,n=>w(n,"on")||w(n,"update")),this.key=this.key||e.key;}get firstChild(){var t,e;return (e=(t=this.rootNode)==null?void 0:t.firstChild)!=null?e:null}get isConnected(){var t,e;return (e=(t=this.rootNode)==null?void 0:t.isConnected)!=null?e:!1}inheritNode(t){this.context=t.context,this.hooks=t.hooks,Object.assign(this.proxyProps,t.proxyProps),this.rootNode=t.rootNode,this.trackMap=t.trackMap;let e=this.props;this.props=t.props,this.patchProps(e);}mount(t,e){var r,n,s,i;if(!b(this.template))throw new Error("Template must be a function");if(this.isConnected)return (n=(r=this.rootNode)==null?void 0:r.mount(t,e))!=null?n:[];this.initRef(),this.rootNode=this.template(W(this.proxyProps,["children"])),this.removeRef(),this.mounted=!0;let o=(i=(s=this.rootNode)==null?void 0:s.mount(t,e))!=null?i:[];return this.hooks.mounted.forEach(a=>a()),this.patchProps(this.props),o}unmount(){var t;this.hooks.destroy.forEach(e=>e()),Object.values(this.hooks).forEach(e=>e.clear()),(t=this.rootNode)==null||t.unmount(),this.rootNode=null,this.proxyProps={},this.mounted=!1,this.emitter.forEach(e=>e());}getNodeTrack(t,e){let r=this.trackMap.get(t);return r||(r={cleanup:()=>{}},this.trackMap.set(t,r)),e||r.cleanup(),r}patchProps(t){var e,r,n,s;for(let[i,o]of Object.entries(t))if(w(i,"on")&&((e=this.rootNode)!=null&&e.nodes)){let a=i.slice(2).toLowerCase(),l=o,d=N(this.rootNode.nodes[0],a,l);this.emitter.add(d);}else if(i==="ref")t[i].value=(r=this.rootNode)==null?void 0:r.nodes[0];else if(w(i,"update"))t[i]=p(o)?o.value:o;else if(i!=="children"){let a=(s=(n=this.proxyProps)[i])!=null?s:n[i]=J(o),l=this.getNodeTrack(i);l.cleanup=T(()=>{a.value=b(o)?o():o;});}this.props=t;}};function cr(t,e,r){return X(t)&&(Ie(t)&&(t=We(t),e={1:e}),t===""&&(e={0:e}),t=ke(t)),b(t)?new mt(t,e,r):new Vt(t,e,r)}function ar(t){return t instanceof mt}function S(t){return t instanceof mt||t instanceof Vt}function ke(t){let e=document.createElement("template");return e.innerHTML=Le(t),e}function ur(t){return t.children}var Xt="area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr",Re="a,abbr,acronym,address,applet,area,article,aside,audio,b,base,basefont,bdi,bdo,bgsound,big,blink,blockquote,body,br,button,canvas,caption,center,cite,code,col,colgroup,command,content,data,datalist,dd,del,details,dfn,dialog,dir,div,dl,dt,em,embed,fieldset,figcaption,figure,font,footer,form,frame,frameset,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,i,iframe,image,img,input,ins,kbd,keygen,label,legend,li,link,listing,main,map,mark,marquee,menu,menuitem,meta,meter,nav,nobr,noframes,noscript,object,ol,optgroup,option,output,p,param,picture,plaintext,pre,progress,q,rb,rp,rt,rtc,ruby,s,samp,script,section,select,shadow,small,source,spacer,span,strike,strong,style,sub,summary,sup,table,tbody,td,template,textarea,tfoot,th,thead,time,title,tr,track,tt,u,ul,var,video,wbr,xmp";function Dt(t){if(S(t)||t instanceof Node)return t;let e=Y(t)?"":String(t);return document.createTextNode(e)}function C(t,e,r=null){let n=S(r)?r.firstChild:r;S(e)?e.mount(t,n):n?n.before(e):t.append(e);}function F(t){S(t)?t.unmount():t.parentNode&&t.remove();}function Yt(t,e,r){C(t,e,r),F(r);}function Jt(t,e,r){if(e==="class"){typeof r=="string"?t.className=r:Array.isArray(r)?t.className=r.join(" "):r&&typeof r=="object"&&(t.className=Object.entries(r).reduce((n,[s,i])=>n+(i?` ${s}`:""),"").trim());return}if(e==="style"){if(typeof r=="string")t.style.cssText=r;else if(r&&typeof r=="object"){let n=r;Object.keys(n).forEach(s=>{t.style.setProperty(wt(s),String(n[s]));});}return}Y(r)?t.removeAttribute(e):r===!0?t.setAttribute(e,""):t instanceof HTMLInputElement?t.value=String(r):t.setAttribute(e,String(r));}function $e(t,e){if(t instanceof HTMLInputElement)switch(t.type){case"checkbox":return N(t,"change",()=>{e(!!t.checked);});case"date":return N(t,"change",()=>{e(t.value?t.value:"");});case"file":return N(t,"change",()=>{t.files&&e(t.files);});case"number":return N(t,"input",()=>{let r=Number.parseFloat(t.value);e(Number.isNaN(r)?"":String(r));});case"radio":return N(t,"change",()=>{e(t.checked?t.value:"");});case"text":return N(t,"input",()=>{e(t.value);})}if(t instanceof HTMLSelectElement)return N(t,"change",()=>{e(t.value);});if(t instanceof HTMLTextAreaElement)return N(t,"input",()=>{e(t.value);})}var Gt=Promise.resolve();function lr(t){return t?Gt.then(t):Gt}function N(t,e,r){return t.addEventListener(e,r),()=>t.removeEventListener(e,r)}function Le(t){let e=Xt.split(","),r=[],n=[],s=/<\/?([\da-z-]+)([^>]*)>/gi,i=0;for(;;){let o=s.exec(t);if(!o)break;let[a,l]=o,d=a[1]==="/";if(n.push(t.slice(i,o.index)),i=o.index+a.length,d){for(;r.length>0&&r[r.length-1]!==l;){let c=r.pop();c&&n.push(`</${c}>`);}r.length>0&&r.pop();}else e.includes(l)||r.push(l);n.push(a);}for(n.push(t.slice(i));r.length>0;){let o=r.pop();o&&n.push(`</${o}>`);}return n.join("")}function Ie(t){return Re.split(",").includes(t)}function We(t){return Xt.split(",").includes(t)?`<${t}/>`:`<${t}></${t}>`}function He(t,e,r,n){let s=new Map,i=Array.from(e.values()),o=i.length;if(e.size>0&&r.length===0){if(t.childNodes.length===o+(n?1:0))t.innerHTML="",n&&C(t,n);else {let c=document.createRange(),u=i[0],m=S(u)?u.firstChild:u;c.setStartBefore(m),n?c.setEndBefore(n):c.setEndAfter(t),c.deleteContents();}return i.forEach(c=>{S(c)&&c.unmount();}),s}let a=[],l=Ke(r),d=0;for(let[c,u]of r.entries()){let m=i[d],P=G(m,c);for(;m&&!l.has(P);)F(m),e.delete(P),m=i[++d],P=G(m,c);let gt=G(u,c),Q=e.get(gt);if(Q&&(u=Fe(t,Q,u)),m)if(m===Q)d++;else {let vt=document.createComment("");C(t,vt,m),a.push([vt,u]);}else C(t,u,n);s.set(gt,u);}return a.forEach(([c,u])=>Yt(t,u,c)),e.forEach((c,u)=>{c.isConnected&&!s.has(u)&&F(c);}),s}function Fe(t,e,r){return e===r?e:S(e)&&S(r)&&e.template===r.template?(r.inheritNode(e),r):e instanceof Text&&r instanceof Text?(e.textContent!==r.textContent&&(e.textContent=r.textContent),e):(Yt(t,r,e),r)}function Ke(t){let e=new Map;for(let[r,n]of t.entries()){let s=G(n,r);e.set(s,n);}return e}function G(t,e){if(S(t)){let r=t.key;if(r!=null)return String(r)}return `_$${e}$`}var Vt=class te{constructor(e,r,n){this.template=e,this.props=r,this.key=n,this.treeMap=new Map,this.mounted=!1,this.nodes=[],this.provides={},this.trackMap=new Map,this.parent=null,this.key=this.key||r.key;}get firstChild(){var e;return (e=this.nodes[0])!=null?e:null}get isConnected(){return this.mounted}addEventListener(){}removeEventListener(){}mount(e,r){var n;if(this.parent=e,this.isConnected)return this.nodes.forEach(o=>C(e,o,r)),this.nodes;let s=this.template.content.cloneNode(!0),i=s.firstChild;return (n=i==null?void 0:i.hasAttribute)!=null&&n.call(i,"_svg_")&&(i.remove(),i==null||i.childNodes.forEach(o=>{s.append(o);})),this.nodes=Array.from(s.childNodes),this.mapNodeTree(e,s),C(e,s,r),this.patchNodes(this.props),this.mounted=!0,this.nodes}unmount(){this.trackMap.forEach(e=>{var r,n;(r=e.cleanup)==null||r.call(e),(n=e.lastNodes)==null||n.forEach(s=>{e.isRoot?F(s):s instanceof te&&s.unmount();});}),this.trackMap.clear(),this.treeMap.clear(),this.nodes.forEach(e=>F(e)),this.nodes=[],this.mounted=!1;}mapNodeTree(e,r){let n=1;this.treeMap.set(0,e);let s=i=>{i.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&this.treeMap.set(n++,i);let o=i.firstChild;for(;o;)s(o),o=o.nextSibling;};s(r);}patchNodes(e){for(let r in e){let n=Number(r),s=this.treeMap.get(n);if(s){let i=this.props[r];this.patchNode(r,s,i,n===0);}}this.props=e;}getNodeTrack(e,r,n){var s;let i=this.trackMap.get(e);return i||(i={cleanup:()=>{}},r&&(i.lastNodes=new Map),n&&(i.isRoot=!0),this.trackMap.set(e,i)),(s=i.cleanup)==null||s.call(i),i}inheritNode(e){this.mounted=e.mounted,this.nodes=e.nodes,this.trackMap=e.trackMap,this.treeMap=e.treeMap;let r=this.props;this.props=e.props,this.patchNodes(r);}patchNode(e,r,n,s){for(let i in n)if(i==="children"&&n.children)if(q(n.children))n.children.filter(Boolean).forEach((o,a)=>{var l;let[d,c]=q(o)?o:[o,null],u=St(c)?null:(l=this.treeMap.get(c))!=null?l:null,m=`${e}:${i}:${a}`,P=this.getNodeTrack(m,!0,s);Qt(P,r,d,u);});else {let o=`${e}:${i}:0`,a=this.getNodeTrack(o,!0,s);Qt(a,r,n.children,null);}else if(i==="ref")n[i].value=r;else if(w(i,"on")){let o=i.slice(2).toLocaleLowerCase(),a=this.getNodeTrack(`${e}:${i}`),l=n[i];a.cleanup=N(r,o,l);}else if(!w(i,"update")){let o=this.getNodeTrack(`${e}:${i}`),a=n[i],l=p(a)?a:J(a);Zt(o,r,i,l.value);let d=T(()=>{l.value=p(a)?a.value:a,Zt(o,r,i,l.value);}),c,u=`update${Ct(i)}`;n[u]&&(c=$e(r,m=>{n[u](m);})),o.cleanup=()=>{d&&d(),c&&c();};}}};function Zt(t,e,r,n){let s=e;s.setAttribute&&(b(n)?t.cleanup=T(()=>{Jt(s,r,n());}):Jt(s,r,n));}function Qt(t,e,r,n){b(r)?t.cleanup=T(()=>{let s=z(r()).map(Dt);t.lastNodes=He(e,t.lastNodes,s,n);}):z(r).forEach((s,i)=>{let o=Dt(s);t.lastNodes.set(String(i),o),C(e,o,n);});}function fr(t){var e;Z("onMounted"),(e=E.ref)==null||e.addHook("mounted",t);}function hr(t){var e;Z("onDestroy"),(e=E.ref)==null||e.addHook("destroy",t);}function Z(t,e){E.ref||console.error(`"${t}"(key: ${Nt(e)?e.toString():e}) can only be called within the component function body
|
|
9
|
-
and cannot be used in asynchronous or deferred calls.`);}function
|
|
10
|
-
* @estjs/
|
|
8
|
+
var Ce="0.0.13-beta.3";var E=e=>e!==null&&typeof e=="object";var g=Array.isArray;function W(e){return typeof e=="string"}function we(e){return typeof e=="symbol"}function G(e){return R.call(e)==="[object Set]"}function Q(e){return R.call(e)==="[object WeakMap]"}function Y(e){return R.call(e)==="[object WeakSet]"}function B(e){return R.call(e)==="[object Map]"}function ke(e){return e==null}var m=e=>typeof e=="function";function ee(e){return e===!1||e===null||e===void 0}var te=e=>R.call(e)==="[object Object]";function ne(e){return W(e)?!Number.isNaN(Number(e)):!1}var R=Object.prototype.toString;var tt=Object.prototype.hasOwnProperty,K=(e,t)=>tt.call(e,t);function re(e){return g(e)?e.flat():[e]}var k=(e,t)=>e!==t&&(e===e||t===t),ie=Function.prototype;function M(e,t){return W(e)?e.indexOf(t)===0:!1}function Me(e){return e.replaceAll(/["&'<>]/g,t=>{switch(t){case"&":return "&";case"<":return "<";case">":return ">";case'"':return """;case"'":return "'";default:return t}})}function P(e,t){return g(t)?t.includes(e):m(t)?t(e):!1}var xe=e=>e.replaceAll(/[A-Z]+/g,(t,n)=>`${n>0?"-":""}${t.toLocaleLowerCase()}`);var Te=e=>e.charAt(0).toUpperCase()+e.slice(1);function se(e,...t){console.warn.apply(console,[`[Essor warn]: ${e}`].concat(t));}var nt=Object.defineProperty,Oe=Object.getOwnPropertySymbols,rt=Object.prototype.hasOwnProperty,it=Object.prototype.propertyIsEnumerable,$e=(e,t,n)=>t in e?nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,V=(e,t)=>{for(var n in t||(t={}))rt.call(t,n)&&$e(e,n,t[n]);if(Oe)for(var n of Oe(t))it.call(t,n)&&$e(e,n,t[n]);return e},le=[],ae=[],je=Promise.resolve(),ce=!1;function pe(e){return e?je.then(e):je}function st(e){le.includes(e)||(le.push(e),De());}function De(){ce||(ce=!0,pe(at));}function ot(e){lt(e,ae);}function lt(e,t){t.includes(e)||(t.push(e),De());}function at(){ce=!1,ct();let e;for(;e=le.shift();)e&&e();}function ct(){for(;ae.length>0;){let e=ae.shift();e&&e();}}function ut(e,t){return t==="sync"?()=>e():t==="pre"?()=>ot(e):()=>{pe(()=>st(e));}}var y=null,ue=new WeakMap,oe=new WeakMap,L=Symbol(""),I=Symbol(""),Re=Symbol(""),Pe=Symbol(""),fe=Symbol(""),v=Symbol(""),x=Symbol(""),he=!1,q=new Set;function h(e,t){if(!y)return;let n=ue.get(e);n||(n=new Map,ue.set(e,n));let r=n.get(t);r||(r=new Set,n.set(t,r)),y&&r.add(y);}function b(e,t){let n=ue.get(e);if(!n)return;let r=n.get(t);r&&r.forEach(i=>{if(K(i,"active")&&!i.active){r.delete(i);return}he?q.add(i):i();});}var me=class{constructor(e,t=!1){this.__signal=!0,this.__shallow=t,this.__value=e;}get value(){return h(this,Re),E(this.__value)&&!this.__shallow?D(this.__value):this.__value}set value(e){p(e)&&(e=e.peek()),k(e,this.__value)&&(this.__value=e,b(this,Re));}peek(){return this.__value}};function ge(e){return p(e)?e:new me(e)}function Kt(e){return new me(e,!0)}function Fe(e){return new me(e,!0)}function p(e){return !!(e&&e!=null&&e.__signal)}var ft=class{constructor(e){this.fn=e,this.__computed=!0;let t=y;y=this.run.bind(this),this.__value=this.fn(),y=t;}peek(){return this.__value}run(){let e=this.fn();k(e,this.__value)&&(this.__value=e,b(this,Pe));}get value(){return h(this,Pe),this.__value}};function ht(e){return new ft(e)}function ze(e){return !!(e&&e.__computed)}function T(e,t={}){let{flush:n="pre",onTrack:r,onTrigger:i}=t;function s(){let l=y;y=s.init?s:s.scheduler,e(),i&&i(),y=l;}let o=ut(s,n);return s.scheduler=o,s.init=!0,s.active=!0,r&&r(),s(),()=>{s.active=!1,y=null;}}function qt(e,t){return !e||!E(e)?e:Object.entries(e).reduce((n,[r,i])=>(n[r]=P(r,t)||p(i)?i:ge(i),n),{})}function f(e){return e&&(H(e)?e[I]:p(e)?e.peek():g(e)?e.map(t=>f(t)):te(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,f(n)])):e)}function H(e){return !!(e&&typeof e=="object"&&e[L])}function ve(e,t){return D(e,!1,t)}function Ut(e,t){return D(e,!0,t)}var dt=(e,t)=>({get(n,r,i){if(r===L)return !0;if(r===I)return n;let s=Reflect.get(n,r,i),o=p(s)?s.value:s;return P(r,t)?o:(h(n,r),E(o)&&!e?D(o):o)},set(n,r,i,s){if(P(r,t))return Reflect.set(n,r,i,s),!0;let o=Reflect.get(n,r,s);p(o)&&(o=o.value),p(i)&&(i=i.value);let l=Reflect.set(n,r,i,s);return k(i,o)&&b(n,r),l},deleteProperty(n,r){let i=Reflect.get(n,r),s=Reflect.deleteProperty(n,r);return i!==void 0&&b(n,r),s}}),Ae=pt();function pt(){let e={};return ["includes","indexOf","lastIndexOf"].forEach(t=>{e[t]=function(...n){let r=f(this);for(let s=0,o=this.length;s<o;s++)h(r,`${s}`);let i=r[t](...n);return i===-1||i===!1?r[t](...n):i};}),["push","pop","shift","unshift","splice","sort","reverse"].forEach(t=>{e[t]=function(...n){let r=f(this),i=r[t].apply(this,n);return b(r,fe),i};}),["forEach","map","filter","reduce","reduceRight","some","every","find","findIndex","findLast","findLastIndex","entries","keys","values"].forEach(t=>{e[t]=function(...n){let r=f(this);return h(r,fe),r[t].apply(this,n)};}),e}var mt=(e,t)=>({get(n,r,i){if(r===L)return !0;if(r===I)return n;if(Ae.hasOwnProperty(r))return Reflect.get(Ae,r,i);let s=Reflect.get(n,r,i);return P(r,t)?s:(ne(r)&&h(n,r),h(n,"length"),E(s)&&!e?D(s):s)},set(n,r,i,s){let o=Reflect.get(n,r,s),l=Reflect.set(n,r,i,s);return k(i,o)&&(ne(r)&&b(n,r),(r==="length"||!o)&&b(n,"length")),l}}),gt={get(e,t){return t===L?!0:t===I?e:((t===Symbol.iterator||t==="size")&&h(e,v),Reflect.get(K(Le,t)&&t in e?Le:e,t,e))}},vt={get(e,t){return t===L?!0:t===I?e:Reflect.get(K(Ie,t)&&t in e?Ie:e,t,e)}},Le={get(e){let t=f(this);return h(t,v),t.get(e)},set(e,t){let n=f(this),r=n.set(e,t);return b(n,v),r},add(e){let t=f(this),n=t.add(e);return b(t,v),n},has(e){let t=f(this);return h(t,v),t.has(e)},delete(e){let t=f(this),n=t.has(e),r=t.delete(e);return n&&b(t,v),r},clear(){let e=f(this),t=e.size>0,n=e.clear();return t&&b(e,v),n},forEach(e,t){let n=f(this);h(n,v),n.forEach((r,i)=>{e.call(t,r,i,n);});},get size(){let e=f(this);return h(e,v),e.size},keys(){let e=f(this);return h(e,v),e.keys()},values(){let e=f(this);return h(e,v),e.values()},entries(){let e=f(this);return h(e,v),e.entries()},[Symbol.iterator](){let e=f(this);return h(e,v),e[Symbol.iterator]()}},Ie={get(e){let t=f(this);return h(t,x),t.get(e)},set(e,t){let n=f(this),r=n.set(e,t);return b(n,x),r},add(e){let t=f(this),n=t.add(e);return b(t,x),n},has(e){let t=f(this);return h(t,x),t.has(e)},delete(e){let t=f(this),n=t.delete(e);return b(t,x),n}};function D(e,t=!1,n){if(!E(e)||H(e))return e;if(oe.has(e))return oe.get(e);let r;g(e)?(h(e,fe),r=mt(t,n)):G(e)||B(e)?(h(e,v),r=gt):Y(e)||Q(e)?(h(e,x),r=vt):r=dt(t,n);let i=new Proxy(e,r);return oe.set(e,i),i}function Vt(e){H(e)&&(Q(e)||Y(e)||bt(()=>{g(e)?e.length=0:G(e)||B(e)?e.clear():E(e)&&Object.keys(e).forEach(t=>{delete e[t];});}));}function bt(e){try{he=!0,e();}finally{he=!1,yt();}}function yt(){q.size>0&&(q.forEach(e=>e()),q.clear());}function Xt(e,t,n){return _t(e,t,n)}var He=void 0,U,de=!1;function Nt(e){U=e,de||(de=!0,pe(St));}function St(){U==null||U(),U=null,de=!1;}function _t(e,t,{deep:n,immediate:r}={}){let i,s=g(e);if(p(e)||ze(e))i=()=>e.value;else if(H(e))i=()=>V({},e);else if(s)i=()=>e.map(a=>Et(a));else if(m(e))i=e;else return se("Invalid source type",e),ie;if(t&&n){let a=i,d=n===!0?1/0:n;i=()=>A(a(),d);}let o=s?Array.from({length:e.length}).fill(He):He,l=!1,u=()=>{let a=i();k(a,o)&&(r&&t&&(t(a,o),o=a),l&&t&&Nt(()=>{t(a,o),o=a;}),!l&&(o=a));},c=T(u,{flush:"sync"});return l=!0,r&&u(),c}function Et(e){return p(e)||ze(e)?e.value:H(e)?V({},e):m(e)?e():(se("Invalid source",e),ie)}function A(e,t=1/0,n){if(t<=0||!E(e)||(n=n||new Set,n.has(e)))return e;if(n.add(e),t--,p(e))A(e.value,t,n);else if(g(e))for(let r of e)A(r,t,n);else if(G(e)||B(e))e.forEach(r=>{A(r,t,n);});else if(te(e))for(let r in e)A(e[r],t,n);return e}function Ct(e){let{state:t,getters:n,actions:r}=e,i=V({},t!=null?t:{}),s=ve(t!=null?t:{}),o=[],l=[],u=V({state:s},{patch$(c){Object.assign(s,c),o.forEach(a=>a(s)),l.forEach(a=>a(s));},subscribe$(c){o.push(c);},unsubscribe$(c){let a=o.indexOf(c);a!==-1&&o.splice(a,1);},onAction$(c){l.push(c);},reset$(){Object.assign(s,i);}});for(let c in n){let a=n[c];a&&Object.defineProperty(u,c,{get(){return ht(a.bind(s,s)).value},enumerable:!0,configurable:!0});}for(let c in r){let a=r[c];a&&(u[c]=a.bind(s));}return u}function Jt(e){return function(){return Ct(e)}}var Ue=new Map,wt=class{constructor(){this.renderMode=0;}get isSSG(){return this.renderMode===1}get isSSR(){return this.renderMode===2}get isClient(){return this.renderMode===0}setSSR(){this.renderMode=2;}setSSG(){this.renderMode=1;}setClient(){this.renderMode=0;}},S=new wt;function kt(e,t){Ue.set(e,{index:t});}function Mt(e){return Ue.get(e).index}var be=class F{constructor(){this.hooks={mounted:new Set,destroy:new Set};}addEventListener(){}removeEventListener(){}addHook(t,n){var r;(r=this.hooks[t])==null||r.add(n);}getContext(t){return F.context[t]}setContext(t,n){F.context[t]=n;}initRef(){F.ref=this;}removeRef(){F.ref=null;}clearHooks(){Object.values(this.hooks).forEach(t=>t.clear());}};be.ref=null;be.context={};var w=be;function ye(e){return e instanceof Ne}var O=1,Ne=class extends w{constructor(e,t={},n){if(super(),this.template=e,this.props=t,this.key=n,kt(e,O),g(this.template)){let r=" __PLACEHOLDER__ ",s=this.template.join(r).replaceAll(/(<[^>]+>)|([^<]+)/g,(o,l,u)=>l?l.includes("data-ci")?o:l.replace(/<\s*([\da-z]+)(\s[^>]*)?>/i,(c,a,d)=>`<${a} data-ci="${O}"${d||""}>`):u&&u.replace(r,"").trim()?`<!--0-${O}-->${u}<!$>`:o);this.template=s.split(r);}}mount(){this.initRef();let e=this.render();return this.removeRef(),e}render(){if(m(this.template)){let t=this.template(this.props);return ye(t)?t.mount():String(t)}let e=this.template;return Object.keys(this.props).forEach(t=>{let n=this.props[t],r=n.children;xt(n);let i=e.findIndex(s=>s.includes(`data-hk="${t}"`));r&&r.forEach(([s])=>{O++;let o=Ve(s,n);this.template[i]+=o;}),this.template[i].replaceAll(`data-hk="${t}"`,`data-hk="${t}" ${Tt(n)}`);}),e.join("")}};function xt(e){Object.entries(e).forEach(([t,n])=>{t==="children"||m(n)?delete e[t]:p(n)&&(e[t]=n.value);});}function Tt(e){return Object.entries(e).filter(([t,n])=>t!=="children"&&!m(n)).map(([t,n])=>`${t}="${Me(String(n))}"`).join(" ")}function Ve(e,t){if(m(e))return Ve(e(t),t);if(p(e))return `<!--1-${O}-->${e.value}<!$>`;if(ye(e)){let n=e.mount();return m(n)?n(t):Ze(n)}else return `<!--1-${O}-->${e}<!$>`}var Xe="area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr".split(","),Ot="a,abbr,acronym,address,applet,area,article,aside,audio,b,base,basefont,bdi,bdo,bgsound,big,blink,blockquote,body,br,button,canvas,caption,center,cite,code,col,colgroup,command,content,data,datalist,dd,del,details,dfn,dialog,dir,div,dl,dt,em,embed,fieldset,figcaption,figure,font,footer,form,frame,frameset,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,i,iframe,image,img,input,ins,kbd,keygen,label,legend,li,link,listing,main,map,mark,marquee,menu,menuitem,meta,meter,nav,nobr,noframes,noscript,object,ol,optgroup,option,output,p,param,picture,plaintext,pre,progress,q,rb,rp,rt,rtc,ruby,s,samp,script,section,select,shadow,small,source,spacer,span,strike,strong,style,sub,summary,sup,table,tbody,td,template,textarea,tfoot,th,thead,time,title,tr,track,tt,u,ul,var,video,wbr,xmp".split(",");function We(e){if(_(e)||e instanceof Node||ye(e))return e;let t=ee(e)?"":String(e);return document.createTextNode(t)}function C(e,t,n=null){let r=_(n)?n.firstChild:n,i=S.isSSR;_(t)?t.mount(e,r):r&&!i?r.before(t):i||e.append(t);}function X(e){_(e)?e.unmount():e.parentNode&&e.remove();}function Je(e,t,n){C(e,t,n),X(n);}function Ge(e,t,n){if(t==="class"){typeof n=="string"?e.className=n:g(n)?e.className=n.join(" "):n&&typeof n=="object"&&(e.className=Object.entries(n).reduce((r,[i,s])=>r+(s?` ${i}`:""),"").trim());return}if(t==="style"){if(typeof n=="string")e.style.cssText=n;else if(n&&typeof n=="object"){let r=n;Object.keys(r).forEach(i=>{e.style.setProperty(xe(i),String(r[i]));});}return}ee(n)?e.removeAttribute(t):n===!0?e.setAttribute(t,""):e instanceof HTMLInputElement&&t==="value"?e.value=String(n):e.setAttribute(t,String(n));}function $t(e,t){if(e instanceof HTMLInputElement)switch(e.type){case"checkbox":return N(e,"change",()=>{t(!!e.checked);});case"date":return N(e,"change",()=>{t(e.value?e.value:"");});case"file":return N(e,"change",()=>{e.files&&t(e.files);});case"number":return N(e,"input",()=>{let n=Number.parseFloat(e.value);t(Number.isNaN(n)?"":String(n));});case"radio":return N(e,"change",()=>{t(e.checked?e.value:"");});case"text":return N(e,"input",()=>{t(e.value);})}if(e instanceof HTMLSelectElement)return N(e,"change",()=>{t(e.value);});if(e instanceof HTMLTextAreaElement)return N(e,"input",()=>{t(e.value);})}Promise.resolve();function N(e,t,n){return e.addEventListener(t,n),()=>e.removeEventListener(t,n)}function jt(e){let t=[],n=[],r=/<\/?([\da-z-]+)([^>]*)>/gi,i=0;for(;;){let s=r.exec(e);if(!s)break;let[o,l]=s,u=o[1]==="/";if(n.push(e.slice(i,s.index)),i=s.index+o.length,u){for(;t.length>0&&t[t.length-1]!==l;){let c=t.pop();c&&n.push(`</${c}>`);}t.length>0&&t.pop();}else Xe.includes(l)||t.push(l);n.push(o);}for(n.push(e.slice(i));t.length>0;){let s=t.pop();s&&n.push(`</${s}>`);}return n.join("")}function Rt(e){return Ot.includes(e)}function Pt(e){return Xe.includes(e)?`<${e}/>`:`<${e}></${e}>`}function Ze(e){return p(e)?e.value:e}var Se=class extends w{constructor(e,t,n){super(),this.template=e,this.props=t,this.key=n,this.emitter=new Set,this.rootNode=null,this.trackMap=new Map,this.proxyProps=t?ve(t,r=>M(r,"on")||M(r,"update")||r==="children"):{};}get firstChild(){var e,t;return (t=(e=this.rootNode)==null?void 0:e.firstChild)!=null?t:null}get isConnected(){var e,t;return (t=(e=this.rootNode)==null?void 0:e.isConnected)!=null?t:!1}mount(e,t){var n,r,i,s;if(!m(this.template))throw new Error("Template must be a function");if(this.isConnected)return (r=(n=this.rootNode)==null?void 0:n.mount(e,t))!=null?r:[];this.initRef(),this.rootNode=this.template(this.proxyProps);let o=(s=(i=this.rootNode)==null?void 0:i.mount(e,t))!=null?s:[];return this.hooks.mounted.forEach(l=>l()),this.patchProps(this.props),this.removeRef(),o}unmount(){var e;this.hooks.destroy.forEach(t=>t()),this.clearHooks(),(e=this.rootNode)==null||e.unmount(),this.rootNode=null,this.proxyProps={};for(let t of this.emitter)t();this.emitter.clear();}inheritNode(e){Object.assign(this.proxyProps,e.proxyProps),this.rootNode=e.rootNode,this.trackMap=e.trackMap,this.hooks=e.hooks;let t=this.props;this.props=e.props,this.patchProps(t);}getNodeTrack(e){let t=this.trackMap.get(e);return t||(t={cleanup:()=>{}},this.trackMap.set(e,t)),t.cleanup(),t}patchProps(e){var t,n;if(e){for(let[r,i]of Object.entries(e))if(M(r,"on")&&((t=this.rootNode)!=null&&t.firstChild)){let s=r.slice(2).toLowerCase(),o=N(this.rootNode.nodes[0],s,i);this.emitter.add(o);}else if(r==="ref")i.value=(n=this.rootNode)==null?void 0:n.firstChild;else if(M(r,"update"))this.props[r]=Ze(i);else if(r!=="children"){let s=this.getNodeTrack(r);s.cleanup=T(()=>{this.proxyProps[r]=m(i)?i():i;});}this.props=e;}}};function At(e,t,n,r){let i=new Map,s=Array.from(t.values());if(t.size>0&&n.length===0)return Lt(e,s,r),i;let o=[],l=Ht(n),u=0;for(let[c,a]of n.entries()){let d=s[u],j=$(d,c);for(;d&&!l.has(j);)X(d),t.delete(j),d=s[++u],j=$(d,c);let _e=$(a,c),Z=t.get(_e);if(Z&&(a=It(e,Z,a)),d)if(d===Z)u++;else {let Ee=document.createComment("");C(e,Ee,d),o.push([Ee,a]);}else C(e,a,r);i.set(_e,a);}return o.forEach(([c,a])=>Je(e,a,c)),t.forEach((c,a)=>{c.isConnected&&!i.has(a)&&X(c);}),i}function Lt(e,t,n){if(e.childNodes.length===t.length+(n?1:0))e.innerHTML="",n&&C(e,n);else {let r=document.createRange(),i=t[0],s=_(i)?i.firstChild:i;r.setStartBefore(s),n?r.setEndBefore(n):r.setEndAfter(e),r.deleteContents();}t.forEach(r=>{_(r)&&r.unmount();});}function It(e,t,n){return t===n?t:_(t)&&_(n)&&t.template===n.template?(n.inheritNode(t),n):t instanceof Text&&n instanceof Text?(t.textContent!==n.textContent&&(t.textContent=n.textContent),t):(Je(e,n,t),n)}function Ht(e){let t=new Map;for(let[n,r]of e.entries()){let i=$(r,n);t.set(i,r);}return t}function $(e,t){if(_(e)){let n=e.key;if(n!=null)return String(n)}return `_$${t}$`}var Qe=class{constructor(e,t,n){this.template=e,this.props=t,this.key=n,this.treeMap=new Map,this.mounted=!1,this.nodes=[],this.trackMap=new Map,this.bindValueKeys=[],this.parent=null,this.key||(this.key=t==null?void 0:t.key),S.isSSR&&(this.componentIndex=Mt(this.template));}addEventListener(){}removeEventListener(){}get firstChild(){var e;return (e=this.nodes[0])!=null?e:null}get isConnected(){return this.mounted}mount(e,t){var n;if(this.parent=e,this.isConnected)return this.nodes.forEach(s=>C(e,s,t)),this.nodes;g(this.template)&&(this.template=et(this.template.join("")));let r=this.template.content.cloneNode(!0),i=r.firstChild;return (n=i==null?void 0:i.hasAttribute)!=null&&n.call(i,"_svg_")&&(i.remove(),i==null||i.childNodes.forEach(s=>{r.append(s);})),this.nodes=Array.from(r.childNodes),S.isSSR?this.mapSSGNodeTree(e):this.mapNodeTree(e,r),C(e,r,t),this.patchProps(this.props),this.mounted=!0,this.nodes}unmount(){this.trackMap.forEach(e=>{var t;(t=e.cleanup)==null||t.call(e);}),this.trackMap.clear(),this.treeMap.clear(),this.nodes.forEach(e=>X(e)),this.nodes=[],this.mounted=!1;}patchProps(e){e&&(Object.entries(e).forEach(([t,n])=>{let r=Number(t),i=this.treeMap.get(r);i&&this.patchProp(t,i,n,r===0);}),this.props=e);}inheritNode(e){this.mounted=e.mounted,this.nodes=e.nodes,this.trackMap=e.trackMap,this.treeMap=e.treeMap;let t=this.props;this.props=e.props,this.patchProps(t);}mapSSGNodeTree(e){this.treeMap.set(0,e);let t=n=>{var r;if(n.nodeType!==Node.DOCUMENT_FRAGMENT_NODE){if(n.nodeType===Node.COMMENT_NODE){let[s,o]=((r=n.textContent)==null?void 0:r.split("-"))||"";if(+s==0&&+o===this.componentIndex){let l=n.nextSibling;this.treeMap.set(+o,l);}}else if(n.nodeType!==Node.TEXT_NODE){let{ci:s="-1",hk:o}=(n==null?void 0:n.dataset)||{};o&&+s===this.componentIndex&&this.treeMap.set(+o,n);}}let i=n.firstChild;for(;i;)t(i),i=i.nextSibling;};t(e);}mapNodeTree(e,t){let n=1;this.treeMap.set(0,e);let r=i=>{i.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&this.treeMap.set(n++,i);let s=i.firstChild;for(;s;)r(s),s=s.nextSibling;};r(t);}getNodeTrack(e,t,n){var r;let i=this.trackMap.get(e);return i||(i={cleanup:()=>{}},t&&(i.lastNodes=new Map),n&&(i.isRoot=!0),this.trackMap.set(e,i)),(r=i.cleanup)==null||r.call(i),i}patchProp(e,t,n,r){for(let i in n)if(i==="children"&&n.children)if(g(n.children))n.children.filter(Boolean).forEach((s,o)=>{var l;let[u,c]=g(s)?s:[s,null],a=ke(c)?null:(l=this.treeMap.get(c))!=null?l:null,d=`${e}:${i}:${o}`,j=this.getNodeTrack(d,!0,r);Be(j,t,u,a);});else {let s=`${e}:${i}:0`,o=this.getNodeTrack(s,!0,r);Be(o,t,n.children,null);}else if(i==="ref")n[i].value=t;else if(M(i,"on")){let s=i.slice(2).toLocaleLowerCase(),o=this.getNodeTrack(`${e}:${i}`),l=n[i];o.cleanup=N(t,s,l);}else {let s=`update${Te(i)}`;if(this.bindValueKeys.includes(i))break;n[s]&&this.bindValueKeys.push(s);let o=this.getNodeTrack(`${e}:${i}`),l=n[i],u=p(l)?l:ge(l);qe(o,t,i,u.value);let c=T(()=>{u.value=p(l)?l.value:l,qe(o,t,i,u.value);}),a;n[s]&&!Dt(i)&&(a=$t(t,d=>{n[s](d);})),o.cleanup=()=>{c&&c(),a&&a();};}}};function Be(e,t,n,r){m(n)?e.cleanup=T(()=>{let i=re(n()).map(We);S.isSSR?e.lastNodes=Ke(t,i,r):e.lastNodes=At(t,e.lastNodes,i,r);}):re(n).forEach((i,s)=>{let o=We(i),l=$(o,s);S.isSSR?e.lastNodes=Ke(t,[o],r):(e.lastNodes.set(l,o),C(t,o,r));});}function Ke(e,t,n){let r=new Map,i=Array.from(e.childNodes).filter(s=>{var o,l;return s.nodeType===Node.TEXT_NODE&&((o=s.previousSibling)==null?void 0:o.nodeType)===Node.COMMENT_NODE&&((l=s.nextSibling)==null?void 0:l.nodeType)===Node.COMMENT_NODE});return t.forEach((s,o)=>{let l=$(s,o);s.nodeType===Node.TEXT_NODE?i.forEach(u=>{s.textContent===u.textContent&&e.replaceChild(s,u);}):C(e,s,n),r.set(l,s);}),r}function qe(e,t,n,r){let i=t;i.setAttribute&&(m(r)?e.cleanup=T(()=>{Ge(i,n,r());}):Ge(i,n,r));}function Ye(e,t,n){return W(e)&&(Rt(e)?(e=Pt(e),t={1:t}):e===""&&(t={0:t}),e=et(e)),m(e)?new Se(e,t,n):new Qe(e,t,n)}function Dt(e){return e instanceof Se}function _(e){return e instanceof Se||e instanceof Qe}function et(e){let t=document.createElement("template");return t.innerHTML=jt(e),t}function rn(e){return e.children}function sn(e){var t;J("onMounted"),(t=w.ref)==null||t.addHook("mounted",e);}function on(e){var t;J("onDestroy"),(t=w.ref)==null||t.addHook("destroy",e);}function J(e,t){w.ref||console.error(`"${e}"(key: ${we(t)?t.toString():t}) can only be called within the component function body
|
|
9
|
+
and cannot be used in asynchronous or deferred calls.`);}function ln(e,t){var n;J("useProvide",e),(n=w.ref)==null||n.setContext(e,t);}function an(e,t){var n;return J("useInject",e),((n=w.ref)==null?void 0:n.getContext(e))||t}function cn(){return Fe(null)}function un(e,t){S.setSSG();let r=new Ne(e,t||{}).mount();return S.setClient(),r}function fn(e,t){let n=typeof t=="string"?document.querySelector(t):t;if(!n)throw new Error(`Could not find container: ${t}`);S.setSSR(),Ye(e).mount(n),S.setClient();}function hn(e,t){return S.isSSG?new Ne(e,t):Ye(e,t)}globalThis&&(globalThis.__essor_version__=Ce);/**
|
|
10
|
+
* @estjs/signal v0.0.13-beta.3
|
|
11
11
|
* (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
12
12
|
* @license MIT
|
|
13
13
|
**/
|
|
14
14
|
/**
|
|
15
|
-
* @estjs/
|
|
16
|
-
* (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
17
|
-
* @license MIT
|
|
18
|
-
**/
|
|
19
|
-
/**
|
|
20
|
-
* @estjs/template v0.0.13-beta.1
|
|
15
|
+
* @estjs/template v0.0.13-beta.3
|
|
21
16
|
* (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
22
17
|
* @license MIT
|
|
23
18
|
**/
|
|
24
19
|
|
|
25
|
-
exports.
|
|
26
|
-
exports.
|
|
27
|
-
exports.
|
|
28
|
-
exports.
|
|
29
|
-
exports.
|
|
30
|
-
exports.
|
|
31
|
-
exports.
|
|
32
|
-
exports.
|
|
33
|
-
exports.
|
|
34
|
-
exports.
|
|
35
|
-
exports.isReactive = O;
|
|
20
|
+
exports.Fragment = rn;
|
|
21
|
+
exports.clearReactive = Vt;
|
|
22
|
+
exports.createStore = Jt;
|
|
23
|
+
exports.essor_version = Ce;
|
|
24
|
+
exports.h = Ye;
|
|
25
|
+
exports.hydrate = fn;
|
|
26
|
+
exports.isComponent = Dt;
|
|
27
|
+
exports.isComputed = ze;
|
|
28
|
+
exports.isJsxElement = _;
|
|
29
|
+
exports.isReactive = H;
|
|
36
30
|
exports.isSignal = p;
|
|
37
|
-
exports.
|
|
38
|
-
exports.
|
|
39
|
-
exports.
|
|
40
|
-
exports.
|
|
41
|
-
exports.
|
|
42
|
-
exports.
|
|
43
|
-
exports.
|
|
44
|
-
exports.
|
|
45
|
-
exports.
|
|
46
|
-
exports.
|
|
47
|
-
exports.
|
|
48
|
-
exports.useBatch = _e;
|
|
49
|
-
exports.useComputed = de;
|
|
31
|
+
exports.onDestroy = on;
|
|
32
|
+
exports.onMount = sn;
|
|
33
|
+
exports.renderToString = un;
|
|
34
|
+
exports.shallowReactive = Ut;
|
|
35
|
+
exports.shallowSignal = Fe;
|
|
36
|
+
exports.signalObject = qt;
|
|
37
|
+
exports.ssg = hn;
|
|
38
|
+
exports.template = et;
|
|
39
|
+
exports.toRaw = f;
|
|
40
|
+
exports.useBatch = bt;
|
|
41
|
+
exports.useComputed = ht;
|
|
50
42
|
exports.useEffect = T;
|
|
51
|
-
exports.useInject =
|
|
52
|
-
exports.useProvide =
|
|
53
|
-
exports.useReactive =
|
|
54
|
-
exports.useRef =
|
|
55
|
-
exports.
|
|
56
|
-
exports.
|
|
43
|
+
exports.useInject = an;
|
|
44
|
+
exports.useProvide = ln;
|
|
45
|
+
exports.useReactive = ve;
|
|
46
|
+
exports.useRef = cn;
|
|
47
|
+
exports.useShallowSignal = Kt;
|
|
48
|
+
exports.useSignal = ge;
|
|
49
|
+
exports.useWatch = Xt;
|
|
57
50
|
//# sourceMappingURL=essor.cjs.js.map
|
|
58
51
|
//# sourceMappingURL=essor.cjs.js.map
|