xote 4.4.0 → 4.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/xote.cjs +1 -1
- package/dist/xote.mjs +311 -297
- package/dist/xote.umd.js +1 -1
- package/package.json +1 -1
- package/src/Xote__Component.res +15 -5
- package/src/Xote__Component.res.mjs +22 -7
package/dist/xote.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let U={contents:0};function Q(){return U.contents=U.contents+1|0,U.contents}function Re(e){return e===void 0?{BS_PRIVATE_NESTED_SOME_NONE:0}:e!==null&&e.BS_PRIVATE_NESTED_SOME_NONE!==void 0?{BS_PRIVATE_NESTED_SOME_NONE:e.BS_PRIVATE_NESTED_SOME_NONE+1|0}:e}function xe(e){if(e!=null)return Re(e)}function oe(e){if(e===null||e.BS_PRIVATE_NESTED_SOME_NONE===void 0)return e;let t=e.BS_PRIVATE_NESTED_SOME_NONE;if(t!==0)return{BS_PRIVATE_NESTED_SOME_NONE:t-1|0}}function Y(e,t){return e!==void 0?oe(e):t}function Pe(e,t,n){return e.reduce(n,t)}function De(e,t){let n=e.length,r=new Array(n),l=0;for(let u=0;u<n;++u){let a=e[u],o=t(a);o!==void 0&&(r[l]=oe(o),l=l+1|0)}return r.length=l,r}function Fe(e,t){let n=0;for(;;){let r=n;if(r===e.length)return;let l=t(e[r]);if(l!==void 0)return l;n=r+1|0}}let h=new Map,j=new Map,L=new Map,p={contents:void 0},I=new Set,k={contents:!1},y={contents:!1};function Z(e){if(j.get(e)===void 0){j.set(e,new Set);return}}function Le(e,t){let n=j.get(e);if(n!==void 0){n.forEach(t);return}}function Ge(e,t){let n=j.get(e);if(n!==void 0){n.add(t);return}}function Be(e,t){let n=j.get(e);if(n!==void 0){n.delete(t);return}}function Ve(e){return Array.from(Y(j.get(e),new Set).values())}function ce(e,t){let n=p.contents;p.contents=e;try{let r=t();return p.contents=n,r}catch(r){throw p.contents=n,r}}function ze(e){let t=p.contents;p.contents=void 0;try{let n=e();return p.contents=t,n}catch(n){throw p.contents=t,n}}function We(e){let t=p.contents;return t!==void 0?t===e:!1}function Ke(e){if(!k.contents){k.contents=!0;try{e(),k.contents=!1;return}catch(t){throw k.contents=!1,t}}}function Xe(e,t){Z(t);let n=We(e),r=h.get(e);if(n&&r!==void 0&&!r.deps.has(t))return r.deps.add(t),Ge(t,e)}function R(e){e.deps.forEach(t=>Be(t,e.id)),e.deps.clear()}function qe(e){let t=L.get(e);if(t===void 0)return;L.delete(e);let n=h.get(t);if(n!==void 0){R(n),h.delete(t);return}}function de(e){return Pe(e,0,(t,n)=>n>t?n:t)}function He(e){let t=[];return e.deps.forEach(n=>Le(n,r=>{if(r===e.id)return;let l=h.get(r);if(l===void 0)return;if(typeof l.kind=="object"){t.push(l.level);return}})),de(t)+1|0}function Ue(e){let t=[];return e.deps.forEach(n=>{let r=L.get(n);if(r===void 0||r===e.id)return;let l=h.get(r);if(l!==void 0){t.push(l.level);return}}),de(t)+1|0}function z(e){return typeof e.kind=="object"?Ue(e):He(e)}function Je(e,t){let n=h.get(e),r=h.get(t);if(n===void 0)return r!==void 0?1:0;if(r===void 0)return-1;let u=typeof n.kind=="object"?0:1,o=typeof r.kind=="object"?0:1,c=u-o|0;return c!==0?c:n.level-r.level|0}function Qe(e){y.contents=!0,R(e),ce(e.id,()=>{e.run(),y.contents=!1}),e.level=z(e)}function se(){for(;I.size>0;){let e=Array.from(I.values());I.clear(),e.sort(Je),e.forEach(t=>{let n=h.get(t);if(n!==void 0)return Qe(n)})}}function ae(e){if(Z(e),Ve(e).forEach(t=>{let n=h.get(t);if(n===void 0)return;let r=n.kind;if(typeof r=="object")return n.dirty?void 0:(n.dirty=!0,ae(r.VAL));I.add(t)}),I.size>0)return Ke(se)}function fe(e){let t=L.get(e);if(t===void 0)return;let n=h.get(t);if(n!==void 0&&n.dirty){y.contents=!0,R(n),ce(t,()=>{n.run(),n.dirty=!1,y.contents=!1}),n.level=z(n);return}}function Ye(e){let t=k.contents;k.contents=!0;try{let n=e();return t||(k.contents=!1,I.size>0&&se()),n}catch(n){throw t||(k.contents=!1),n}}let Ze=ze,et=Z;function pe(e,t,n){let r=Q();return et(r),{id:r,value:{contents:e},version:{contents:0},equals:Y(n,(l,u)=>l===u),name:t}}function tt(e){fe(e.id);let t=p.contents;return t!==void 0&&Xe(t,e.id),e.value.contents}function nt(e){return fe(e.id),e.value.contents}function me(e,t){let n;try{n=!e.equals(e.value.contents,t)}catch{n=!0}if(n)return e.value.contents=t,e.version.contents=e.version.contents+1|0,ae(e.id)}function rt(e,t){me(e,t(e.value.contents))}let lt,ut,it=Ye,ot=Ze;const ct=Object.freeze(Object.defineProperty({__proto__:null,Id:lt,Scheduler:ut,batch:it,get:tt,make:pe,peek:nt,set:me,untrack:ot,update:rt},Symbol.toStringTag,{value:"Module"}));function he(e,t,n,r){return{id:e,kind:t,run:n,deps:new Set,level:0,dirty:!0,name:r}}function dt(e,t){let n=Q(),r={contents:void 0},u=he(n,"Effect",()=>{let c=r.contents;c!==void 0&&c(),r.contents=e()},t);h.set(n,u),y.contents=!0,R(u);let a=p.contents;p.contents=n;try{u.run(),y.contents=!1}catch(c){throw p.contents=a,y.contents=!1,c}return p.contents=a,u.level=z(u),{dispose:()=>{let c=h.get(n);if(c===void 0)return;let x=r.contents;x!==void 0&&x(),R(c),h.delete(n)}}}let st,at,ft;const pt=Object.freeze(Object.defineProperty({__proto__:null,Id:st,Observer:at,Scheduler:ft,run:dt},Symbol.toStringTag,{value:"Module"}));function mt(e,t){let n=pe(void 0,t,void 0),r=Q(),l=()=>{let o=e();n.value.contents=o},u=he(r,{NAME:"Computed",VAL:n.id},l,void 0);h.set(r,u),y.contents=!0,R(u);let a=p.contents;p.contents=r;try{u.run(),u.dirty=!1,y.contents=!1}catch(o){throw p.contents=a,y.contents=!1,o}return p.contents=a,u.level=z(u),L.set(n.id,r),n}function ht(e){qe(e.id)}let _t,gt,St,Et;const vt=Object.freeze(Object.defineProperty({__proto__:null,Id:_t,Observer:St,Scheduler:Et,Signal:gt,dispose:ht,make:mt},Symbol.toStringTag,{value:"Module"}));let s=ct,S=vt,w=pt;function _e(e){return De(e.split("/"),t=>{if(t!=="")return t.startsWith(":")?{TAG:"Param",_0:t.slice(1)}:{TAG:"Static",_0:t}})}function ge(e,t){let n=t.split("/").filter(u=>u!=="");if(e.length!==n.length)return"NoMatch";let r={};return e.every((u,a)=>{let o=n[a];return u.TAG==="Static"?o===u._0:(r[u._0]=o,!0)})?{TAG:"Match",_0:r}:"NoMatch"}function ee(e,t){return ge(_e(e),t)}const yt=Object.freeze(Object.defineProperty({__proto__:null,match:ee,matchPath:ge,parsePattern:_e},Symbol.toStringTag,{value:"Module"}));function bt(e,t){delete e[t]}let wt={},V={contents:void 0};function kt(){return{disposers:[],computeds:[]}}function C(e,t){let n=V.contents;V.contents=e;let r=t();return V.contents=n,r}function N(e,t){e.disposers.push(t)}function Se(e){e.disposers.forEach(t=>t.dispose()),e.computeds.forEach(t=>S.dispose(t))}function M(e,t){e.__xote_owner__=t}function Ee(e){return xe(e.__xote_owner__)}let Ot={currentOwner:V,createOwner:kt,runWithOwner:C,addDisposer:N,disposeOwner:Se,setOwner:M,getOwner:Ee};function ve(e,t){return[e,{TAG:"Static",_0:t}]}function ye(e,t){return[e,{TAG:"SignalValue",_0:t}]}function be(e,t){return[e,{TAG:"Compute",_0:t}]}let Tt={$$static:ve,signal:ye,computed:be};function F(e){let t=Ee(e);t!==void 0&&Se(t),Array.from(e.childNodes||[]).forEach(F)}function b(e){switch(e.TAG){case"Element":let t=e.children,n=e.events,r=e.attrs,l=document.createElement(e.tag),u={disposers:[],computeds:[]};return M(l,u),C(u,()=>{r.forEach(i=>{let m=i[1],g=i[0];switch(m.TAG){case"Static":l.setAttribute(g,m._0);return;case"SignalValue":let E=m._0;l.setAttribute(g,s.peek(E));let v=w.run(()=>{l.setAttribute(g,s.get(E))},void 0);return N(u,v);case"Compute":let D=m._0;l.setAttribute(g,D());let $=w.run(()=>{l.setAttribute(g,D())},void 0);return N(u,$)}}),n.forEach(i=>{l.addEventListener(i[0],i[1])}),t.forEach(i=>{let m=b(i);l.appendChild(m)})}),l;case"Text":return document.createTextNode(e._0);case"SignalText":let a=e._0,o=document.createTextNode(s.peek(a)),c={disposers:[],computeds:[]};return M(o,c),C(c,()=>{let i=w.run(()=>{o.textContent=s.get(a)},void 0);N(c,i)}),o;case"Fragment":let x=document.createDocumentFragment();return e._0.forEach(i=>{let m=b(i);x.appendChild(m)}),x;case"SignalFragment":let Ae=e._0,W={disposers:[],computeds:[]},A=document.createElement("div");return A.setAttribute("style","display: contents"),M(A,W),C(W,()=>{let i=w.run(()=>{let m=s.get(Ae);Array.from(A.childNodes||[]).forEach(F),A.innerHTML="",m.forEach(E=>{let v=b(E);A.appendChild(v)})},void 0);N(W,i)}),A;case"LazyComponent":let ne={disposers:[],computeds:[]},$e=C(ne,e._0),re=b($e);return M(re,ne),re;case"KeyedList":let K=e.renderItem,X=e.keyFn,le=e.signal,q={disposers:[],computeds:[]},H=document.createComment(" keyed-list-start "),P=document.createComment(" keyed-list-end ");M(H,q);let O={},Ce=()=>{let i=P.parentNode;if(i==null)return;let m=s.get(le),g={};m.forEach(d=>{g[X(d)]=d});let E=[];Object.keys(O).forEach(d=>{if(g[d]===void 0){E.push(d);return}}),E.forEach(d=>{let f=O[d];if(f!==void 0){F(f.element),f.element.remove(),bt(O,d);return}});let v=[],D={};m.forEach(d=>{let f=X(d),B=O[f];if(B!==void 0){if(B.item!==d){D[f]=!0;let Ie=K(d),je=b(Ie),ie={key:f,item:d,element:je};v.push(ie),O[f]=ie;return}v.push(B);return}let Ne=K(d),Me=b(Ne),ue={key:f,item:d,element:Me};v.push(ue),O[f]=ue});let $={contents:H.nextSibling};v.forEach(d=>{let f=$.contents;if(f==null){i.insertBefore(d.element,P);return}if(f===P){i.insertBefore(d.element,P);return}if(f===d.element){$.contents=f.nextSibling;return}Y(D[d.key],!1)?(F(f),i.replaceChild(d.element,f),$.contents=d.element.nextSibling):(i.insertBefore(d.element,f),$.contents=d.element.nextSibling)})},G=document.createDocumentFragment();return G.appendChild(H),s.peek(le).forEach(i=>{let m=X(i),g=K(i),E=b(g),v={key:m,item:i,element:E};O[m]=v,G.appendChild(E)}),G.appendChild(P),C(q,()=>{let i=w.run(()=>{Ce()},void 0);N(q,i)}),G}}let At={disposeElement:F,render:b};function $t(e){return{TAG:"Text",_0:e}}function Ct(e){return{TAG:"SignalText",_0:S.make(e,void 0)}}function Nt(e){return{TAG:"Fragment",_0:e}}function te(e){return{TAG:"SignalFragment",_0:e}}function Mt(e,t){return{TAG:"SignalFragment",_0:S.make(()=>s.get(e).map(t),void 0)}}function It(e,t,n){return{TAG:"KeyedList",signal:e,keyFn:t,renderItem:n}}function _(e,t,n,r,l){let u=t!==void 0?t:[].map(c=>c),a=n!==void 0?n:[].map(c=>c),o=r!==void 0?r:[].map(c=>c);return{TAG:"Element",tag:e,attrs:u,events:a,children:o}}function jt(e,t,n,r){return _("div",e,t,n)}function Rt(e,t,n,r){return _("span",e,t,n)}function xt(e,t,n,r){return _("button",e,t,n)}function Pt(e,t,n){return _("input",e,t,void 0)}function Dt(e,t,n,r){return _("h1",e,t,n)}function Ft(e,t,n,r){return _("h2",e,t,n)}function Lt(e,t,n,r){return _("h3",e,t,n)}function Gt(e,t,n,r){return _("p",e,t,n)}function Bt(e,t,n,r){return _("ul",e,t,n)}function Vt(e,t,n,r){return _("li",e,t,n)}function we(e,t,n,r){return _("a",e,t,n)}function ke(e,t){let n=b(e);t.appendChild(n)}function zt(e,t){let n=document.getElementById(t);if(n==null){console.error("Container element not found: "+t);return}else return ke(e,n)}let Oe=ve,Wt=ye,Kt=be;const Xt=Object.freeze(Object.defineProperty({__proto__:null,Attributes:Tt,DOM:wt,Reactivity:Ot,Render:At,a:we,attr:Oe,button:xt,computedAttr:Kt,div:jt,element:_,fragment:Nt,h1:Dt,h2:Ft,h3:Lt,input:Pt,keyedList:It,li:Vt,list:Mt,mount:ke,mountById:zt,p:Gt,signalAttr:Wt,signalFragment:te,span:Rt,text:$t,textSignal:Ct,ul:Bt},Symbol.toStringTag,{value:"Module"}));let T=s.make({pathname:"/",search:"",hash:""},void 0,void 0);function J(){return{pathname:window.location.pathname,search:window.location.search,hash:window.location.hash}}function qt(){s.set(T,J());let e=t=>s.set(T,J());window.addEventListener("popstate",e)}function Te(e,t,n,r){let l=t!==void 0?t:"",u=n!==void 0?n:"",a={pathname:e,search:l,hash:u},o=e+l+u,c={};window.history.pushState(c,"",o),s.set(T,a)}function Ht(e,t,n,r){let l=t!==void 0?t:"",u=n!==void 0?n:"",a={pathname:e,search:l,hash:u},o=e+l+u,c={};window.history.replaceState(c,"",o),s.set(T,a)}function Ut(e,t){return te(S.make(()=>{let n=s.get(T),r=ee(e,n.pathname);return typeof r!="object"?[]:[t(r._0)]},void 0))}function Jt(e){return te(S.make(()=>{let t=s.get(T),n=Fe(e,r=>{let l=ee(r.pattern,t.pathname);if(typeof l=="object")return r.render(l._0)});return n!==void 0?[n]:[]},void 0))}function Qt(e,t,n,r){let l=t!==void 0?t:[],u=n!==void 0?n:[],a=o=>{o.preventDefault(),Te(e,void 0,void 0)};return we(l.concat([Oe("href",e)]),[["click",a]],u)}let Yt,Zt;const en=Object.freeze(Object.defineProperty({__proto__:null,Component:Yt,Route:Zt,getCurrentLocation:J,init:qt,link:Qt,location:T,push:Te,replace:Ht,route:Ut,routes:Jt},Symbol.toStringTag,{value:"Module"}));let tn=s.Id,nn=s.Scheduler,rn=s.make,ln=s.get,un=s.peek,on=s.set,cn=s.update,dn=s.batch,sn=s.untrack,an={Id:tn,Scheduler:nn,make:rn,get:ln,peek:un,set:on,update:cn,batch:dn,untrack:sn},fn=S.Id,pn=S.Signal,mn=S.Observer,hn=S.Scheduler,_n=S.make,gn=S.dispose,Sn={Id:fn,Signal:pn,Observer:mn,Scheduler:hn,make:_n,dispose:gn},En=w.Id,vn=w.Observer,yn=w.Scheduler,bn=w.run,wn={Id:En,Observer:vn,Scheduler:yn,run:bn},kn=Xt,On=yt,Tn=en;exports.Component=kn;exports.Computed=Sn;exports.Effect=wn;exports.Route=On;exports.Router=Tn;exports.Signal=an;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let J={contents:0};function Y(){return J.contents=J.contents+1|0,J.contents}function Pe(e){return e===void 0?{BS_PRIVATE_NESTED_SOME_NONE:0}:e!==null&&e.BS_PRIVATE_NESTED_SOME_NONE!==void 0?{BS_PRIVATE_NESTED_SOME_NONE:e.BS_PRIVATE_NESTED_SOME_NONE+1|0}:e}function xe(e){if(e!=null)return Pe(e)}function ce(e){if(e===null||e.BS_PRIVATE_NESTED_SOME_NONE===void 0)return e;let t=e.BS_PRIVATE_NESTED_SOME_NONE;if(t!==0)return{BS_PRIVATE_NESTED_SOME_NONE:t-1|0}}function Z(e,t){return e!==void 0?ce(e):t}function De(e,t,n){return e.reduce(n,t)}function Fe(e,t){let n=e.length,r=new Array(n),l=0;for(let u=0;u<n;++u){let a=e[u],o=t(a);o!==void 0&&(r[l]=ce(o),l=l+1|0)}return r.length=l,r}function Le(e,t){let n=0;for(;;){let r=n;if(r===e.length)return;let l=t(e[r]);if(l!==void 0)return l;n=r+1|0}}let h=new Map,R=new Map,G=new Map,p={contents:void 0},j=new Set,k={contents:!1},y={contents:!1};function ee(e){if(R.get(e)===void 0){R.set(e,new Set);return}}function Ge(e,t){let n=R.get(e);if(n!==void 0){n.forEach(t);return}}function Be(e,t){let n=R.get(e);if(n!==void 0){n.add(t);return}}function Ve(e,t){let n=R.get(e);if(n!==void 0){n.delete(t);return}}function ze(e){return Array.from(Z(R.get(e),new Set).values())}function de(e,t){let n=p.contents;p.contents=e;try{let r=t();return p.contents=n,r}catch(r){throw p.contents=n,r}}function We(e){let t=p.contents;p.contents=void 0;try{let n=e();return p.contents=t,n}catch(n){throw p.contents=t,n}}function Ke(e){let t=p.contents;return t!==void 0?t===e:!1}function Xe(e){if(!k.contents){k.contents=!0;try{e(),k.contents=!1;return}catch(t){throw k.contents=!1,t}}}function qe(e,t){ee(t);let n=Ke(e),r=h.get(e);if(n&&r!==void 0&&!r.deps.has(t))return r.deps.add(t),Be(t,e)}function P(e){e.deps.forEach(t=>Ve(t,e.id)),e.deps.clear()}function He(e){let t=G.get(e);if(t===void 0)return;G.delete(e);let n=h.get(t);if(n!==void 0){P(n),h.delete(t);return}}function se(e){return De(e,0,(t,n)=>n>t?n:t)}function Ue(e){let t=[];return e.deps.forEach(n=>Ge(n,r=>{if(r===e.id)return;let l=h.get(r);if(l===void 0)return;if(typeof l.kind=="object"){t.push(l.level);return}})),se(t)+1|0}function Je(e){let t=[];return e.deps.forEach(n=>{let r=G.get(n);if(r===void 0||r===e.id)return;let l=h.get(r);if(l!==void 0){t.push(l.level);return}}),se(t)+1|0}function W(e){return typeof e.kind=="object"?Je(e):Ue(e)}function Qe(e,t){let n=h.get(e),r=h.get(t);if(n===void 0)return r!==void 0?1:0;if(r===void 0)return-1;let u=typeof n.kind=="object"?0:1,o=typeof r.kind=="object"?0:1,c=u-o|0;return c!==0?c:n.level-r.level|0}function Ye(e){y.contents=!0,P(e),de(e.id,()=>{e.run(),y.contents=!1}),e.level=W(e)}function ae(){for(;j.size>0;){let e=Array.from(j.values());j.clear(),e.sort(Qe),e.forEach(t=>{let n=h.get(t);if(n!==void 0)return Ye(n)})}}function fe(e){if(ee(e),ze(e).forEach(t=>{let n=h.get(t);if(n===void 0)return;let r=n.kind;if(typeof r=="object")return n.dirty?void 0:(n.dirty=!0,fe(r.VAL));j.add(t)}),j.size>0)return Xe(ae)}function pe(e){let t=G.get(e);if(t===void 0)return;let n=h.get(t);if(n!==void 0&&n.dirty){y.contents=!0,P(n),de(t,()=>{n.run(),n.dirty=!1,y.contents=!1}),n.level=W(n);return}}function Ze(e){let t=k.contents;k.contents=!0;try{let n=e();return t||(k.contents=!1,j.size>0&&ae()),n}catch(n){throw t||(k.contents=!1),n}}let et=We,tt=ee;function me(e,t,n){let r=Y();return tt(r),{id:r,value:{contents:e},version:{contents:0},equals:Z(n,(l,u)=>l===u),name:t}}function nt(e){pe(e.id);let t=p.contents;return t!==void 0&&qe(t,e.id),e.value.contents}function rt(e){return pe(e.id),e.value.contents}function he(e,t){let n;try{n=!e.equals(e.value.contents,t)}catch{n=!0}if(n)return e.value.contents=t,e.version.contents=e.version.contents+1|0,fe(e.id)}function lt(e,t){he(e,t(e.value.contents))}let ut,it,ot=Ze,ct=et;const dt=Object.freeze(Object.defineProperty({__proto__:null,Id:ut,Scheduler:it,batch:ot,get:nt,make:me,peek:rt,set:he,untrack:ct,update:lt},Symbol.toStringTag,{value:"Module"}));function _e(e,t,n,r){return{id:e,kind:t,run:n,deps:new Set,level:0,dirty:!0,name:r}}function st(e,t){let n=Y(),r={contents:void 0},u=_e(n,"Effect",()=>{let c=r.contents;c!==void 0&&c(),r.contents=e()},t);h.set(n,u),y.contents=!0,P(u);let a=p.contents;p.contents=n;try{u.run(),y.contents=!1}catch(c){throw p.contents=a,y.contents=!1,c}return p.contents=a,u.level=W(u),{dispose:()=>{let c=h.get(n);if(c===void 0)return;let x=r.contents;x!==void 0&&x(),P(c),h.delete(n)}}}let at,ft,pt;const mt=Object.freeze(Object.defineProperty({__proto__:null,Id:at,Observer:ft,Scheduler:pt,run:st},Symbol.toStringTag,{value:"Module"}));function ht(e,t){let n=me(void 0,t,void 0),r=Y(),l=()=>{let o=e();n.value.contents=o},u=_e(r,{NAME:"Computed",VAL:n.id},l,void 0);h.set(r,u),y.contents=!0,P(u);let a=p.contents;p.contents=r;try{u.run(),u.dirty=!1,y.contents=!1}catch(o){throw p.contents=a,y.contents=!1,o}return p.contents=a,u.level=W(u),G.set(n.id,r),n}function _t(e){He(e.id)}let gt,St,Et,vt;const yt=Object.freeze(Object.defineProperty({__proto__:null,Id:gt,Observer:Et,Scheduler:vt,Signal:St,dispose:_t,make:ht},Symbol.toStringTag,{value:"Module"}));let s=dt,S=yt,w=mt;function ge(e){return Fe(e.split("/"),t=>{if(t!=="")return t.startsWith(":")?{TAG:"Param",_0:t.slice(1)}:{TAG:"Static",_0:t}})}function Se(e,t){let n=t.split("/").filter(u=>u!=="");if(e.length!==n.length)return"NoMatch";let r={};return e.every((u,a)=>{let o=n[a];return u.TAG==="Static"?o===u._0:(r[u._0]=o,!0)})?{TAG:"Match",_0:r}:"NoMatch"}function te(e,t){return Se(ge(e),t)}const bt=Object.freeze(Object.defineProperty({__proto__:null,match:te,matchPath:Se,parsePattern:ge},Symbol.toStringTag,{value:"Module"}));function wt(e,t){delete e[t]}function C(e,t,n){switch(t){case"checked":e.checked=n==="true";return;case"value":e.value=n;return;default:e.setAttribute(t,n);return}}let kt={setAttrOrProp:C},z={contents:void 0};function Ot(){return{disposers:[],computeds:[]}}function N(e,t){let n=z.contents;z.contents=e;let r=t();return z.contents=n,r}function M(e,t){e.disposers.push(t)}function Ee(e){e.disposers.forEach(t=>t.dispose()),e.computeds.forEach(t=>S.dispose(t))}function I(e,t){e.__xote_owner__=t}function ve(e){return xe(e.__xote_owner__)}let Tt={currentOwner:z,createOwner:Ot,runWithOwner:N,addDisposer:M,disposeOwner:Ee,setOwner:I,getOwner:ve};function ye(e,t){return[e,{TAG:"Static",_0:t}]}function be(e,t){return[e,{TAG:"SignalValue",_0:t}]}function we(e,t){return[e,{TAG:"Compute",_0:t}]}let At={$$static:ye,signal:be,computed:we};function L(e){let t=ve(e);t!==void 0&&Ee(t),Array.from(e.childNodes||[]).forEach(L)}function b(e){switch(e.TAG){case"Element":let t=e.children,n=e.events,r=e.attrs,l=document.createElement(e.tag),u={disposers:[],computeds:[]};return I(l,u),N(u,()=>{r.forEach(i=>{let m=i[1],g=i[0];switch(m.TAG){case"Static":return C(l,g,m._0);case"SignalValue":let E=m._0;C(l,g,s.peek(E));let v=w.run(()=>{C(l,g,s.get(E))},void 0);return M(u,v);case"Compute":let F=m._0;C(l,g,F());let $=w.run(()=>{C(l,g,F())},void 0);return M(u,$)}}),n.forEach(i=>{l.addEventListener(i[0],i[1])}),t.forEach(i=>{let m=b(i);l.appendChild(m)})}),l;case"Text":return document.createTextNode(e._0);case"SignalText":let a=e._0,o=document.createTextNode(s.peek(a)),c={disposers:[],computeds:[]};return I(o,c),N(c,()=>{let i=w.run(()=>{o.textContent=s.get(a)},void 0);M(c,i)}),o;case"Fragment":let x=document.createDocumentFragment();return e._0.forEach(i=>{let m=b(i);x.appendChild(m)}),x;case"SignalFragment":let $e=e._0,K={disposers:[],computeds:[]},A=document.createElement("div");return A.setAttribute("style","display: contents"),I(A,K),N(K,()=>{let i=w.run(()=>{let m=s.get($e);Array.from(A.childNodes||[]).forEach(L),A.innerHTML="",m.forEach(E=>{let v=b(E);A.appendChild(v)})},void 0);M(K,i)}),A;case"LazyComponent":let re={disposers:[],computeds:[]},Ce=N(re,e._0),le=b(Ce);return I(le,re),le;case"KeyedList":let X=e.renderItem,q=e.keyFn,ue=e.signal,H={disposers:[],computeds:[]},U=document.createComment(" keyed-list-start "),D=document.createComment(" keyed-list-end ");I(U,H);let O={},Ne=()=>{let i=D.parentNode;if(i==null)return;let m=s.get(ue),g={};m.forEach(d=>{g[q(d)]=d});let E=[];Object.keys(O).forEach(d=>{if(g[d]===void 0){E.push(d);return}}),E.forEach(d=>{let f=O[d];if(f!==void 0){L(f.element),f.element.remove(),wt(O,d);return}});let v=[],F={};m.forEach(d=>{let f=q(d),V=O[f];if(V!==void 0){if(V.item!==d){F[f]=!0;let je=X(d),Re=b(je),oe={key:f,item:d,element:Re};v.push(oe),O[f]=oe;return}v.push(V);return}let Me=X(d),Ie=b(Me),ie={key:f,item:d,element:Ie};v.push(ie),O[f]=ie});let $={contents:U.nextSibling};v.forEach(d=>{let f=$.contents;if(f==null){i.insertBefore(d.element,D);return}if(f===D){i.insertBefore(d.element,D);return}if(f===d.element){$.contents=f.nextSibling;return}Z(F[d.key],!1)?(L(f),i.replaceChild(d.element,f),$.contents=d.element.nextSibling):(i.insertBefore(d.element,f),$.contents=d.element.nextSibling)})},B=document.createDocumentFragment();return B.appendChild(U),s.peek(ue).forEach(i=>{let m=q(i),g=X(i),E=b(g),v={key:m,item:i,element:E};O[m]=v,B.appendChild(E)}),B.appendChild(D),N(H,()=>{let i=w.run(()=>{Ne()},void 0);M(H,i)}),B}}let $t={disposeElement:L,render:b};function Ct(e){return{TAG:"Text",_0:e}}function Nt(e){return{TAG:"SignalText",_0:S.make(e,void 0)}}function Mt(e){return{TAG:"Fragment",_0:e}}function ne(e){return{TAG:"SignalFragment",_0:e}}function It(e,t){return{TAG:"SignalFragment",_0:S.make(()=>s.get(e).map(t),void 0)}}function jt(e,t,n){return{TAG:"KeyedList",signal:e,keyFn:t,renderItem:n}}function _(e,t,n,r,l){let u=t!==void 0?t:[].map(c=>c),a=n!==void 0?n:[].map(c=>c),o=r!==void 0?r:[].map(c=>c);return{TAG:"Element",tag:e,attrs:u,events:a,children:o}}function Rt(e,t,n,r){return _("div",e,t,n)}function Pt(e,t,n,r){return _("span",e,t,n)}function xt(e,t,n,r){return _("button",e,t,n)}function Dt(e,t,n){return _("input",e,t,void 0)}function Ft(e,t,n,r){return _("h1",e,t,n)}function Lt(e,t,n,r){return _("h2",e,t,n)}function Gt(e,t,n,r){return _("h3",e,t,n)}function Bt(e,t,n,r){return _("p",e,t,n)}function Vt(e,t,n,r){return _("ul",e,t,n)}function zt(e,t,n,r){return _("li",e,t,n)}function ke(e,t,n,r){return _("a",e,t,n)}function Oe(e,t){let n=b(e);t.appendChild(n)}function Wt(e,t){let n=document.getElementById(t);if(n==null){console.error("Container element not found: "+t);return}else return Oe(e,n)}let Te=ye,Kt=be,Xt=we;const qt=Object.freeze(Object.defineProperty({__proto__:null,Attributes:At,DOM:kt,Reactivity:Tt,Render:$t,a:ke,attr:Te,button:xt,computedAttr:Xt,div:Rt,element:_,fragment:Mt,h1:Ft,h2:Lt,h3:Gt,input:Dt,keyedList:jt,li:zt,list:It,mount:Oe,mountById:Wt,p:Bt,signalAttr:Kt,signalFragment:ne,span:Pt,text:Ct,textSignal:Nt,ul:Vt},Symbol.toStringTag,{value:"Module"}));let T=s.make({pathname:"/",search:"",hash:""},void 0,void 0);function Q(){return{pathname:window.location.pathname,search:window.location.search,hash:window.location.hash}}function Ht(){s.set(T,Q());let e=t=>s.set(T,Q());window.addEventListener("popstate",e)}function Ae(e,t,n,r){let l=t!==void 0?t:"",u=n!==void 0?n:"",a={pathname:e,search:l,hash:u},o=e+l+u,c={};window.history.pushState(c,"",o),s.set(T,a)}function Ut(e,t,n,r){let l=t!==void 0?t:"",u=n!==void 0?n:"",a={pathname:e,search:l,hash:u},o=e+l+u,c={};window.history.replaceState(c,"",o),s.set(T,a)}function Jt(e,t){return ne(S.make(()=>{let n=s.get(T),r=te(e,n.pathname);return typeof r!="object"?[]:[t(r._0)]},void 0))}function Qt(e){return ne(S.make(()=>{let t=s.get(T),n=Le(e,r=>{let l=te(r.pattern,t.pathname);if(typeof l=="object")return r.render(l._0)});return n!==void 0?[n]:[]},void 0))}function Yt(e,t,n,r){let l=t!==void 0?t:[],u=n!==void 0?n:[],a=o=>{o.preventDefault(),Ae(e,void 0,void 0)};return ke(l.concat([Te("href",e)]),[["click",a]],u)}let Zt,en;const tn=Object.freeze(Object.defineProperty({__proto__:null,Component:Zt,Route:en,getCurrentLocation:Q,init:Ht,link:Yt,location:T,push:Ae,replace:Ut,route:Jt,routes:Qt},Symbol.toStringTag,{value:"Module"}));let nn=s.Id,rn=s.Scheduler,ln=s.make,un=s.get,on=s.peek,cn=s.set,dn=s.update,sn=s.batch,an=s.untrack,fn={Id:nn,Scheduler:rn,make:ln,get:un,peek:on,set:cn,update:dn,batch:sn,untrack:an},pn=S.Id,mn=S.Signal,hn=S.Observer,_n=S.Scheduler,gn=S.make,Sn=S.dispose,En={Id:pn,Signal:mn,Observer:hn,Scheduler:_n,make:gn,dispose:Sn},vn=w.Id,yn=w.Observer,bn=w.Scheduler,wn=w.run,kn={Id:vn,Observer:yn,Scheduler:bn,run:wn},On=qt,Tn=bt,An=tn;exports.Component=On;exports.Computed=En;exports.Effect=kn;exports.Route=Tn;exports.Router=An;exports.Signal=fn;
|
package/dist/xote.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
let
|
|
1
|
+
let J = {
|
|
2
2
|
contents: 0
|
|
3
3
|
};
|
|
4
|
-
function
|
|
5
|
-
return
|
|
4
|
+
function Y() {
|
|
5
|
+
return J.contents = J.contents + 1 | 0, J.contents;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function Pe(e) {
|
|
8
8
|
return e === void 0 ? {
|
|
9
9
|
BS_PRIVATE_NESTED_SOME_NONE: 0
|
|
10
10
|
} : e !== null && e.BS_PRIVATE_NESTED_SOME_NONE !== void 0 ? {
|
|
@@ -13,9 +13,9 @@ function xe(e) {
|
|
|
13
13
|
}
|
|
14
14
|
function Re(e) {
|
|
15
15
|
if (e != null)
|
|
16
|
-
return
|
|
16
|
+
return Pe(e);
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function ce(e) {
|
|
19
19
|
if (e === null || e.BS_PRIVATE_NESTED_SOME_NONE === void 0)
|
|
20
20
|
return e;
|
|
21
21
|
let t = e.BS_PRIVATE_NESTED_SOME_NONE;
|
|
@@ -24,8 +24,8 @@ function oe(e) {
|
|
|
24
24
|
BS_PRIVATE_NESTED_SOME_NONE: t - 1 | 0
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
return e !== void 0 ?
|
|
27
|
+
function Z(e, t) {
|
|
28
|
+
return e !== void 0 ? ce(e) : t;
|
|
29
29
|
}
|
|
30
30
|
function De(e, t, n) {
|
|
31
31
|
return e.reduce(n, t);
|
|
@@ -34,7 +34,7 @@ function Fe(e, t) {
|
|
|
34
34
|
let n = e.length, r = new Array(n), l = 0;
|
|
35
35
|
for (let u = 0; u < n; ++u) {
|
|
36
36
|
let a = e[u], o = t(a);
|
|
37
|
-
o !== void 0 && (r[l] =
|
|
37
|
+
o !== void 0 && (r[l] = ce(o), l = l + 1 | 0);
|
|
38
38
|
}
|
|
39
39
|
return r.length = l, r;
|
|
40
40
|
}
|
|
@@ -50,44 +50,44 @@ function Le(e, t) {
|
|
|
50
50
|
n = r + 1 | 0;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
let h = /* @__PURE__ */ new Map(),
|
|
53
|
+
let h = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map(), G = /* @__PURE__ */ new Map(), p = {
|
|
54
54
|
contents: void 0
|
|
55
|
-
},
|
|
55
|
+
}, j = /* @__PURE__ */ new Set(), k = {
|
|
56
56
|
contents: !1
|
|
57
57
|
}, y = {
|
|
58
58
|
contents: !1
|
|
59
59
|
};
|
|
60
|
-
function
|
|
61
|
-
if (
|
|
62
|
-
|
|
60
|
+
function ee(e) {
|
|
61
|
+
if (x.get(e) === void 0) {
|
|
62
|
+
x.set(e, /* @__PURE__ */ new Set());
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
let n =
|
|
66
|
+
function Ge(e, t) {
|
|
67
|
+
let n = x.get(e);
|
|
68
68
|
if (n !== void 0) {
|
|
69
69
|
n.forEach(t);
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
function
|
|
74
|
-
let n =
|
|
73
|
+
function Be(e, t) {
|
|
74
|
+
let n = x.get(e);
|
|
75
75
|
if (n !== void 0) {
|
|
76
76
|
n.add(t);
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
function
|
|
81
|
-
let n =
|
|
80
|
+
function Ve(e, t) {
|
|
81
|
+
let n = x.get(e);
|
|
82
82
|
if (n !== void 0) {
|
|
83
83
|
n.delete(t);
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
function
|
|
88
|
-
return Array.from(
|
|
87
|
+
function ze(e) {
|
|
88
|
+
return Array.from(Z(x.get(e), /* @__PURE__ */ new Set()).values());
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function de(e, t) {
|
|
91
91
|
let n = p.contents;
|
|
92
92
|
p.contents = e;
|
|
93
93
|
try {
|
|
@@ -97,7 +97,7 @@ function ce(e, t) {
|
|
|
97
97
|
throw p.contents = n, r;
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function We(e) {
|
|
101
101
|
let t = p.contents;
|
|
102
102
|
p.contents = void 0;
|
|
103
103
|
try {
|
|
@@ -107,11 +107,11 @@ function ze(e) {
|
|
|
107
107
|
throw p.contents = t, n;
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function Ke(e) {
|
|
111
111
|
let t = p.contents;
|
|
112
112
|
return t !== void 0 ? t === e : !1;
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function Xe(e) {
|
|
115
115
|
if (!k.contents) {
|
|
116
116
|
k.contents = !0;
|
|
117
117
|
try {
|
|
@@ -122,32 +122,32 @@ function Ke(e) {
|
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
function
|
|
126
|
-
|
|
127
|
-
let n =
|
|
125
|
+
function qe(e, t) {
|
|
126
|
+
ee(t);
|
|
127
|
+
let n = Ke(e), r = h.get(e);
|
|
128
128
|
if (n && r !== void 0 && !r.deps.has(t))
|
|
129
|
-
return r.deps.add(t),
|
|
129
|
+
return r.deps.add(t), Be(t, e);
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
e.deps.forEach((t) =>
|
|
131
|
+
function P(e) {
|
|
132
|
+
e.deps.forEach((t) => Ve(t, e.id)), e.deps.clear();
|
|
133
133
|
}
|
|
134
|
-
function
|
|
135
|
-
let t =
|
|
134
|
+
function He(e) {
|
|
135
|
+
let t = G.get(e);
|
|
136
136
|
if (t === void 0)
|
|
137
137
|
return;
|
|
138
|
-
|
|
138
|
+
G.delete(e);
|
|
139
139
|
let n = h.get(t);
|
|
140
140
|
if (n !== void 0) {
|
|
141
|
-
|
|
141
|
+
P(n), h.delete(t);
|
|
142
142
|
return;
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
function
|
|
145
|
+
function se(e) {
|
|
146
146
|
return De(e, 0, (t, n) => n > t ? n : t);
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function Ue(e) {
|
|
149
149
|
let t = [];
|
|
150
|
-
return e.deps.forEach((n) =>
|
|
150
|
+
return e.deps.forEach((n) => Ge(n, (r) => {
|
|
151
151
|
if (r === e.id)
|
|
152
152
|
return;
|
|
153
153
|
let l = h.get(r);
|
|
@@ -157,12 +157,12 @@ function He(e) {
|
|
|
157
157
|
t.push(l.level);
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
160
|
-
})),
|
|
160
|
+
})), se(t) + 1 | 0;
|
|
161
161
|
}
|
|
162
|
-
function
|
|
162
|
+
function Je(e) {
|
|
163
163
|
let t = [];
|
|
164
164
|
return e.deps.forEach((n) => {
|
|
165
|
-
let r =
|
|
165
|
+
let r = G.get(n);
|
|
166
166
|
if (r === void 0 || r === e.id)
|
|
167
167
|
return;
|
|
168
168
|
let l = h.get(r);
|
|
@@ -170,12 +170,12 @@ function Ue(e) {
|
|
|
170
170
|
t.push(l.level);
|
|
171
171
|
return;
|
|
172
172
|
}
|
|
173
|
-
}),
|
|
173
|
+
}), se(t) + 1 | 0;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
176
|
-
return typeof e.kind == "object" ?
|
|
175
|
+
function W(e) {
|
|
176
|
+
return typeof e.kind == "object" ? Je(e) : Ue(e);
|
|
177
177
|
}
|
|
178
|
-
function
|
|
178
|
+
function Qe(e, t) {
|
|
179
179
|
let n = h.get(e), r = h.get(t);
|
|
180
180
|
if (n === void 0)
|
|
181
181
|
return r !== void 0 ? 1 : 0;
|
|
@@ -184,59 +184,59 @@ function Je(e, t) {
|
|
|
184
184
|
let u = typeof n.kind == "object" ? 0 : 1, o = typeof r.kind == "object" ? 0 : 1, c = u - o | 0;
|
|
185
185
|
return c !== 0 ? c : n.level - r.level | 0;
|
|
186
186
|
}
|
|
187
|
-
function
|
|
188
|
-
y.contents = !0,
|
|
187
|
+
function Ye(e) {
|
|
188
|
+
y.contents = !0, P(e), de(e.id, () => {
|
|
189
189
|
e.run(), y.contents = !1;
|
|
190
|
-
}), e.level =
|
|
190
|
+
}), e.level = W(e);
|
|
191
191
|
}
|
|
192
|
-
function
|
|
193
|
-
for (;
|
|
194
|
-
let e = Array.from(
|
|
195
|
-
|
|
192
|
+
function ae() {
|
|
193
|
+
for (; j.size > 0; ) {
|
|
194
|
+
let e = Array.from(j.values());
|
|
195
|
+
j.clear(), e.sort(Qe), e.forEach((t) => {
|
|
196
196
|
let n = h.get(t);
|
|
197
197
|
if (n !== void 0)
|
|
198
|
-
return
|
|
198
|
+
return Ye(n);
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
|
-
function
|
|
203
|
-
if (
|
|
202
|
+
function fe(e) {
|
|
203
|
+
if (ee(e), ze(e).forEach((t) => {
|
|
204
204
|
let n = h.get(t);
|
|
205
205
|
if (n === void 0)
|
|
206
206
|
return;
|
|
207
207
|
let r = n.kind;
|
|
208
208
|
if (typeof r == "object")
|
|
209
|
-
return n.dirty ? void 0 : (n.dirty = !0,
|
|
210
|
-
|
|
211
|
-
}),
|
|
212
|
-
return
|
|
209
|
+
return n.dirty ? void 0 : (n.dirty = !0, fe(r.VAL));
|
|
210
|
+
j.add(t);
|
|
211
|
+
}), j.size > 0)
|
|
212
|
+
return Xe(ae);
|
|
213
213
|
}
|
|
214
|
-
function
|
|
215
|
-
let t =
|
|
214
|
+
function pe(e) {
|
|
215
|
+
let t = G.get(e);
|
|
216
216
|
if (t === void 0)
|
|
217
217
|
return;
|
|
218
218
|
let n = h.get(t);
|
|
219
219
|
if (n !== void 0 && n.dirty) {
|
|
220
|
-
y.contents = !0,
|
|
220
|
+
y.contents = !0, P(n), de(t, () => {
|
|
221
221
|
n.run(), n.dirty = !1, y.contents = !1;
|
|
222
|
-
}), n.level =
|
|
222
|
+
}), n.level = W(n);
|
|
223
223
|
return;
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function Ze(e) {
|
|
227
227
|
let t = k.contents;
|
|
228
228
|
k.contents = !0;
|
|
229
229
|
try {
|
|
230
230
|
let n = e();
|
|
231
|
-
return t || (k.contents = !1,
|
|
231
|
+
return t || (k.contents = !1, j.size > 0 && ae()), n;
|
|
232
232
|
} catch (n) {
|
|
233
233
|
throw t || (k.contents = !1), n;
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
let
|
|
237
|
-
function
|
|
238
|
-
let r =
|
|
239
|
-
return
|
|
236
|
+
let et = We, tt = ee;
|
|
237
|
+
function me(e, t, n) {
|
|
238
|
+
let r = Y();
|
|
239
|
+
return tt(r), {
|
|
240
240
|
id: r,
|
|
241
241
|
value: {
|
|
242
242
|
contents: e
|
|
@@ -244,19 +244,19 @@ function pe(e, t, n) {
|
|
|
244
244
|
version: {
|
|
245
245
|
contents: 0
|
|
246
246
|
},
|
|
247
|
-
equals:
|
|
247
|
+
equals: Z(n, (l, u) => l === u),
|
|
248
248
|
name: t
|
|
249
249
|
};
|
|
250
250
|
}
|
|
251
|
-
function
|
|
252
|
-
|
|
251
|
+
function nt(e) {
|
|
252
|
+
pe(e.id);
|
|
253
253
|
let t = p.contents;
|
|
254
|
-
return t !== void 0 &&
|
|
254
|
+
return t !== void 0 && qe(t, e.id), e.value.contents;
|
|
255
255
|
}
|
|
256
|
-
function
|
|
257
|
-
return
|
|
256
|
+
function rt(e) {
|
|
257
|
+
return pe(e.id), e.value.contents;
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function he(e, t) {
|
|
260
260
|
let n;
|
|
261
261
|
try {
|
|
262
262
|
n = !e.equals(e.value.contents, t);
|
|
@@ -264,25 +264,25 @@ function me(e, t) {
|
|
|
264
264
|
n = !0;
|
|
265
265
|
}
|
|
266
266
|
if (n)
|
|
267
|
-
return e.value.contents = t, e.version.contents = e.version.contents + 1 | 0,
|
|
267
|
+
return e.value.contents = t, e.version.contents = e.version.contents + 1 | 0, fe(e.id);
|
|
268
268
|
}
|
|
269
|
-
function
|
|
270
|
-
|
|
269
|
+
function lt(e, t) {
|
|
270
|
+
he(e, t(e.value.contents));
|
|
271
271
|
}
|
|
272
|
-
let
|
|
273
|
-
const
|
|
272
|
+
let ut, it, ot = Ze, ct = et;
|
|
273
|
+
const dt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
274
274
|
__proto__: null,
|
|
275
|
-
Id:
|
|
276
|
-
Scheduler:
|
|
277
|
-
batch:
|
|
278
|
-
get:
|
|
279
|
-
make:
|
|
280
|
-
peek:
|
|
281
|
-
set:
|
|
282
|
-
untrack:
|
|
283
|
-
update:
|
|
275
|
+
Id: ut,
|
|
276
|
+
Scheduler: it,
|
|
277
|
+
batch: ot,
|
|
278
|
+
get: nt,
|
|
279
|
+
make: me,
|
|
280
|
+
peek: rt,
|
|
281
|
+
set: he,
|
|
282
|
+
untrack: ct,
|
|
283
|
+
update: lt
|
|
284
284
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
285
|
-
function
|
|
285
|
+
function _e(e, t, n, r) {
|
|
286
286
|
return {
|
|
287
287
|
id: e,
|
|
288
288
|
kind: t,
|
|
@@ -293,14 +293,14 @@ function he(e, t, n, r) {
|
|
|
293
293
|
name: r
|
|
294
294
|
};
|
|
295
295
|
}
|
|
296
|
-
function
|
|
297
|
-
let n =
|
|
296
|
+
function st(e, t) {
|
|
297
|
+
let n = Y(), r = {
|
|
298
298
|
contents: void 0
|
|
299
|
-
}, u =
|
|
299
|
+
}, u = _e(n, "Effect", () => {
|
|
300
300
|
let c = r.contents;
|
|
301
301
|
c !== void 0 && c(), r.contents = e();
|
|
302
302
|
}, t);
|
|
303
|
-
h.set(n, u), y.contents = !0,
|
|
303
|
+
h.set(n, u), y.contents = !0, P(u);
|
|
304
304
|
let a = p.contents;
|
|
305
305
|
p.contents = n;
|
|
306
306
|
try {
|
|
@@ -308,33 +308,33 @@ function dt(e, t) {
|
|
|
308
308
|
} catch (c) {
|
|
309
309
|
throw p.contents = a, y.contents = !1, c;
|
|
310
310
|
}
|
|
311
|
-
return p.contents = a, u.level =
|
|
311
|
+
return p.contents = a, u.level = W(u), {
|
|
312
312
|
dispose: () => {
|
|
313
313
|
let c = h.get(n);
|
|
314
314
|
if (c === void 0)
|
|
315
315
|
return;
|
|
316
316
|
let R = r.contents;
|
|
317
|
-
R !== void 0 && R(),
|
|
317
|
+
R !== void 0 && R(), P(c), h.delete(n);
|
|
318
318
|
}
|
|
319
319
|
};
|
|
320
320
|
}
|
|
321
|
-
let
|
|
322
|
-
const
|
|
321
|
+
let at, ft, pt;
|
|
322
|
+
const mt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
323
323
|
__proto__: null,
|
|
324
|
-
Id:
|
|
325
|
-
Observer:
|
|
326
|
-
Scheduler:
|
|
327
|
-
run:
|
|
324
|
+
Id: at,
|
|
325
|
+
Observer: ft,
|
|
326
|
+
Scheduler: pt,
|
|
327
|
+
run: st
|
|
328
328
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
329
|
-
function
|
|
330
|
-
let n =
|
|
329
|
+
function ht(e, t) {
|
|
330
|
+
let n = me(void 0, t, void 0), r = Y(), l = () => {
|
|
331
331
|
let o = e();
|
|
332
332
|
n.value.contents = o;
|
|
333
|
-
}, u =
|
|
333
|
+
}, u = _e(r, {
|
|
334
334
|
NAME: "Computed",
|
|
335
335
|
VAL: n.id
|
|
336
336
|
}, l, void 0);
|
|
337
|
-
h.set(r, u), y.contents = !0,
|
|
337
|
+
h.set(r, u), y.contents = !0, P(u);
|
|
338
338
|
let a = p.contents;
|
|
339
339
|
p.contents = r;
|
|
340
340
|
try {
|
|
@@ -342,23 +342,23 @@ function mt(e, t) {
|
|
|
342
342
|
} catch (o) {
|
|
343
343
|
throw p.contents = a, y.contents = !1, o;
|
|
344
344
|
}
|
|
345
|
-
return p.contents = a, u.level =
|
|
345
|
+
return p.contents = a, u.level = W(u), G.set(n.id, r), n;
|
|
346
346
|
}
|
|
347
|
-
function
|
|
348
|
-
|
|
347
|
+
function _t(e) {
|
|
348
|
+
He(e.id);
|
|
349
349
|
}
|
|
350
|
-
let
|
|
351
|
-
const
|
|
350
|
+
let gt, St, Et, vt;
|
|
351
|
+
const yt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
352
352
|
__proto__: null,
|
|
353
|
-
Id:
|
|
354
|
-
Observer:
|
|
355
|
-
Scheduler:
|
|
356
|
-
Signal:
|
|
357
|
-
dispose:
|
|
358
|
-
make:
|
|
353
|
+
Id: gt,
|
|
354
|
+
Observer: Et,
|
|
355
|
+
Scheduler: vt,
|
|
356
|
+
Signal: St,
|
|
357
|
+
dispose: _t,
|
|
358
|
+
make: ht
|
|
359
359
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
360
|
-
let s =
|
|
361
|
-
function
|
|
360
|
+
let s = dt, S = yt, w = mt;
|
|
361
|
+
function ge(e) {
|
|
362
362
|
return Fe(e.split("/"), (t) => {
|
|
363
363
|
if (t !== "")
|
|
364
364
|
return t.startsWith(":") ? {
|
|
@@ -370,7 +370,7 @@ function _e(e) {
|
|
|
370
370
|
};
|
|
371
371
|
});
|
|
372
372
|
}
|
|
373
|
-
function
|
|
373
|
+
function Se(e, t) {
|
|
374
374
|
let n = t.split("/").filter((u) => u !== "");
|
|
375
375
|
if (e.length !== n.length)
|
|
376
376
|
return "NoMatch";
|
|
@@ -383,55 +383,70 @@ function ge(e, t) {
|
|
|
383
383
|
_0: r
|
|
384
384
|
} : "NoMatch";
|
|
385
385
|
}
|
|
386
|
-
function
|
|
387
|
-
return ge(
|
|
386
|
+
function te(e, t) {
|
|
387
|
+
return Se(ge(e), t);
|
|
388
388
|
}
|
|
389
|
-
const
|
|
389
|
+
const bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
390
390
|
__proto__: null,
|
|
391
|
-
match:
|
|
392
|
-
matchPath:
|
|
393
|
-
parsePattern:
|
|
391
|
+
match: te,
|
|
392
|
+
matchPath: Se,
|
|
393
|
+
parsePattern: ge
|
|
394
394
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
395
|
-
function
|
|
395
|
+
function wt(e, t) {
|
|
396
396
|
delete e[t];
|
|
397
397
|
}
|
|
398
|
-
|
|
398
|
+
function C(e, t, n) {
|
|
399
|
+
switch (t) {
|
|
400
|
+
case "checked":
|
|
401
|
+
e.checked = n === "true";
|
|
402
|
+
return;
|
|
403
|
+
case "value":
|
|
404
|
+
e.value = n;
|
|
405
|
+
return;
|
|
406
|
+
default:
|
|
407
|
+
e.setAttribute(t, n);
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
let kt = {
|
|
412
|
+
setAttrOrProp: C
|
|
413
|
+
}, z = {
|
|
399
414
|
contents: void 0
|
|
400
415
|
};
|
|
401
|
-
function
|
|
416
|
+
function Ot() {
|
|
402
417
|
return {
|
|
403
418
|
disposers: [],
|
|
404
419
|
computeds: []
|
|
405
420
|
};
|
|
406
421
|
}
|
|
407
|
-
function
|
|
408
|
-
let n =
|
|
409
|
-
|
|
422
|
+
function N(e, t) {
|
|
423
|
+
let n = z.contents;
|
|
424
|
+
z.contents = e;
|
|
410
425
|
let r = t();
|
|
411
|
-
return
|
|
426
|
+
return z.contents = n, r;
|
|
412
427
|
}
|
|
413
|
-
function
|
|
428
|
+
function M(e, t) {
|
|
414
429
|
e.disposers.push(t);
|
|
415
430
|
}
|
|
416
|
-
function
|
|
431
|
+
function Ee(e) {
|
|
417
432
|
e.disposers.forEach((t) => t.dispose()), e.computeds.forEach((t) => S.dispose(t));
|
|
418
433
|
}
|
|
419
|
-
function
|
|
434
|
+
function I(e, t) {
|
|
420
435
|
e.__xote_owner__ = t;
|
|
421
436
|
}
|
|
422
|
-
function
|
|
437
|
+
function ve(e) {
|
|
423
438
|
return Re(e.__xote_owner__);
|
|
424
439
|
}
|
|
425
|
-
let
|
|
426
|
-
currentOwner:
|
|
427
|
-
createOwner:
|
|
428
|
-
runWithOwner:
|
|
429
|
-
addDisposer:
|
|
430
|
-
disposeOwner:
|
|
431
|
-
setOwner:
|
|
432
|
-
getOwner:
|
|
440
|
+
let Tt = {
|
|
441
|
+
currentOwner: z,
|
|
442
|
+
createOwner: Ot,
|
|
443
|
+
runWithOwner: N,
|
|
444
|
+
addDisposer: M,
|
|
445
|
+
disposeOwner: Ee,
|
|
446
|
+
setOwner: I,
|
|
447
|
+
getOwner: ve
|
|
433
448
|
};
|
|
434
|
-
function
|
|
449
|
+
function ye(e, t) {
|
|
435
450
|
return [
|
|
436
451
|
e,
|
|
437
452
|
{
|
|
@@ -440,7 +455,7 @@ function ve(e, t) {
|
|
|
440
455
|
}
|
|
441
456
|
];
|
|
442
457
|
}
|
|
443
|
-
function
|
|
458
|
+
function be(e, t) {
|
|
444
459
|
return [
|
|
445
460
|
e,
|
|
446
461
|
{
|
|
@@ -449,7 +464,7 @@ function ye(e, t) {
|
|
|
449
464
|
}
|
|
450
465
|
];
|
|
451
466
|
}
|
|
452
|
-
function
|
|
467
|
+
function we(e, t) {
|
|
453
468
|
return [
|
|
454
469
|
e,
|
|
455
470
|
{
|
|
@@ -458,14 +473,14 @@ function be(e, t) {
|
|
|
458
473
|
}
|
|
459
474
|
];
|
|
460
475
|
}
|
|
461
|
-
let
|
|
462
|
-
$$static:
|
|
463
|
-
signal:
|
|
464
|
-
computed:
|
|
476
|
+
let At = {
|
|
477
|
+
$$static: ye,
|
|
478
|
+
signal: be,
|
|
479
|
+
computed: we
|
|
465
480
|
};
|
|
466
481
|
function L(e) {
|
|
467
|
-
let t =
|
|
468
|
-
t !== void 0 &&
|
|
482
|
+
let t = ve(e);
|
|
483
|
+
t !== void 0 && Ee(t), Array.from(e.childNodes || []).forEach(L);
|
|
469
484
|
}
|
|
470
485
|
function b(e) {
|
|
471
486
|
switch (e.TAG) {
|
|
@@ -474,27 +489,26 @@ function b(e) {
|
|
|
474
489
|
disposers: [],
|
|
475
490
|
computeds: []
|
|
476
491
|
};
|
|
477
|
-
return
|
|
492
|
+
return I(l, u), N(u, () => {
|
|
478
493
|
r.forEach((i) => {
|
|
479
494
|
let m = i[1], g = i[0];
|
|
480
495
|
switch (m.TAG) {
|
|
481
496
|
case "Static":
|
|
482
|
-
l
|
|
483
|
-
return;
|
|
497
|
+
return C(l, g, m._0);
|
|
484
498
|
case "SignalValue":
|
|
485
499
|
let E = m._0;
|
|
486
|
-
l
|
|
500
|
+
C(l, g, s.peek(E));
|
|
487
501
|
let v = w.run(() => {
|
|
488
|
-
l
|
|
502
|
+
C(l, g, s.get(E));
|
|
489
503
|
}, void 0);
|
|
490
|
-
return
|
|
504
|
+
return M(u, v);
|
|
491
505
|
case "Compute":
|
|
492
506
|
let F = m._0;
|
|
493
|
-
l
|
|
507
|
+
C(l, g, F());
|
|
494
508
|
let $ = w.run(() => {
|
|
495
|
-
l
|
|
509
|
+
C(l, g, F());
|
|
496
510
|
}, void 0);
|
|
497
|
-
return
|
|
511
|
+
return M(u, $);
|
|
498
512
|
}
|
|
499
513
|
}), n.forEach((i) => {
|
|
500
514
|
l.addEventListener(i[0], i[1]);
|
|
@@ -510,11 +524,11 @@ function b(e) {
|
|
|
510
524
|
disposers: [],
|
|
511
525
|
computeds: []
|
|
512
526
|
};
|
|
513
|
-
return
|
|
527
|
+
return I(o, c), N(c, () => {
|
|
514
528
|
let i = w.run(() => {
|
|
515
529
|
o.textContent = s.get(a);
|
|
516
530
|
}, void 0);
|
|
517
|
-
|
|
531
|
+
M(c, i);
|
|
518
532
|
}), o;
|
|
519
533
|
case "Fragment":
|
|
520
534
|
let R = document.createDocumentFragment();
|
|
@@ -523,39 +537,39 @@ function b(e) {
|
|
|
523
537
|
R.appendChild(m);
|
|
524
538
|
}), R;
|
|
525
539
|
case "SignalFragment":
|
|
526
|
-
let
|
|
540
|
+
let $e = e._0, K = {
|
|
527
541
|
disposers: [],
|
|
528
542
|
computeds: []
|
|
529
543
|
}, A = document.createElement("div");
|
|
530
|
-
return A.setAttribute("style", "display: contents"),
|
|
544
|
+
return A.setAttribute("style", "display: contents"), I(A, K), N(K, () => {
|
|
531
545
|
let i = w.run(() => {
|
|
532
|
-
let m = s.get(
|
|
546
|
+
let m = s.get($e);
|
|
533
547
|
Array.from(A.childNodes || []).forEach(L), A.innerHTML = "", m.forEach((E) => {
|
|
534
548
|
let v = b(E);
|
|
535
549
|
A.appendChild(v);
|
|
536
550
|
});
|
|
537
551
|
}, void 0);
|
|
538
|
-
|
|
552
|
+
M(K, i);
|
|
539
553
|
}), A;
|
|
540
554
|
case "LazyComponent":
|
|
541
|
-
let
|
|
555
|
+
let re = {
|
|
542
556
|
disposers: [],
|
|
543
557
|
computeds: []
|
|
544
|
-
},
|
|
545
|
-
return
|
|
558
|
+
}, Ce = N(re, e._0), le = b(Ce);
|
|
559
|
+
return I(le, re), le;
|
|
546
560
|
case "KeyedList":
|
|
547
|
-
let
|
|
561
|
+
let X = e.renderItem, q = e.keyFn, ue = e.signal, H = {
|
|
548
562
|
disposers: [],
|
|
549
563
|
computeds: []
|
|
550
|
-
},
|
|
551
|
-
|
|
552
|
-
let O = {},
|
|
564
|
+
}, U = document.createComment(" keyed-list-start "), D = document.createComment(" keyed-list-end ");
|
|
565
|
+
I(U, H);
|
|
566
|
+
let O = {}, Ne = () => {
|
|
553
567
|
let i = D.parentNode;
|
|
554
568
|
if (i == null)
|
|
555
569
|
return;
|
|
556
|
-
let m = s.get(
|
|
570
|
+
let m = s.get(ue), g = {};
|
|
557
571
|
m.forEach((d) => {
|
|
558
|
-
g[
|
|
572
|
+
g[q(d)] = d;
|
|
559
573
|
});
|
|
560
574
|
let E = [];
|
|
561
575
|
Object.keys(O).forEach((d) => {
|
|
@@ -566,36 +580,36 @@ function b(e) {
|
|
|
566
580
|
}), E.forEach((d) => {
|
|
567
581
|
let f = O[d];
|
|
568
582
|
if (f !== void 0) {
|
|
569
|
-
L(f.element), f.element.remove(),
|
|
583
|
+
L(f.element), f.element.remove(), wt(O, d);
|
|
570
584
|
return;
|
|
571
585
|
}
|
|
572
586
|
});
|
|
573
587
|
let v = [], F = {};
|
|
574
588
|
m.forEach((d) => {
|
|
575
|
-
let f =
|
|
576
|
-
if (
|
|
577
|
-
if (
|
|
589
|
+
let f = q(d), V = O[f];
|
|
590
|
+
if (V !== void 0) {
|
|
591
|
+
if (V.item !== d) {
|
|
578
592
|
F[f] = !0;
|
|
579
|
-
let
|
|
593
|
+
let je = X(d), xe = b(je), oe = {
|
|
580
594
|
key: f,
|
|
581
595
|
item: d,
|
|
582
|
-
element:
|
|
596
|
+
element: xe
|
|
583
597
|
};
|
|
584
|
-
v.push(
|
|
598
|
+
v.push(oe), O[f] = oe;
|
|
585
599
|
return;
|
|
586
600
|
}
|
|
587
|
-
v.push(
|
|
601
|
+
v.push(V);
|
|
588
602
|
return;
|
|
589
603
|
}
|
|
590
|
-
let
|
|
604
|
+
let Me = X(d), Ie = b(Me), ie = {
|
|
591
605
|
key: f,
|
|
592
606
|
item: d,
|
|
593
|
-
element:
|
|
607
|
+
element: Ie
|
|
594
608
|
};
|
|
595
|
-
v.push(
|
|
609
|
+
v.push(ie), O[f] = ie;
|
|
596
610
|
});
|
|
597
611
|
let $ = {
|
|
598
|
-
contents:
|
|
612
|
+
contents: U.nextSibling
|
|
599
613
|
};
|
|
600
614
|
v.forEach((d) => {
|
|
601
615
|
let f = $.contents;
|
|
@@ -611,59 +625,59 @@ function b(e) {
|
|
|
611
625
|
$.contents = f.nextSibling;
|
|
612
626
|
return;
|
|
613
627
|
}
|
|
614
|
-
|
|
628
|
+
Z(F[d.key], !1) ? (L(f), i.replaceChild(d.element, f), $.contents = d.element.nextSibling) : (i.insertBefore(d.element, f), $.contents = d.element.nextSibling);
|
|
615
629
|
});
|
|
616
|
-
},
|
|
617
|
-
return
|
|
618
|
-
let m =
|
|
630
|
+
}, B = document.createDocumentFragment();
|
|
631
|
+
return B.appendChild(U), s.peek(ue).forEach((i) => {
|
|
632
|
+
let m = q(i), g = X(i), E = b(g), v = {
|
|
619
633
|
key: m,
|
|
620
634
|
item: i,
|
|
621
635
|
element: E
|
|
622
636
|
};
|
|
623
|
-
O[m] = v,
|
|
624
|
-
}),
|
|
637
|
+
O[m] = v, B.appendChild(E);
|
|
638
|
+
}), B.appendChild(D), N(H, () => {
|
|
625
639
|
let i = w.run(() => {
|
|
626
|
-
|
|
640
|
+
Ne();
|
|
627
641
|
}, void 0);
|
|
628
|
-
|
|
629
|
-
}),
|
|
642
|
+
M(H, i);
|
|
643
|
+
}), B;
|
|
630
644
|
}
|
|
631
645
|
}
|
|
632
|
-
let
|
|
646
|
+
let $t = {
|
|
633
647
|
disposeElement: L,
|
|
634
648
|
render: b
|
|
635
649
|
};
|
|
636
|
-
function
|
|
650
|
+
function Ct(e) {
|
|
637
651
|
return {
|
|
638
652
|
TAG: "Text",
|
|
639
653
|
_0: e
|
|
640
654
|
};
|
|
641
655
|
}
|
|
642
|
-
function
|
|
656
|
+
function Nt(e) {
|
|
643
657
|
return {
|
|
644
658
|
TAG: "SignalText",
|
|
645
659
|
_0: S.make(e, void 0)
|
|
646
660
|
};
|
|
647
661
|
}
|
|
648
|
-
function
|
|
662
|
+
function Mt(e) {
|
|
649
663
|
return {
|
|
650
664
|
TAG: "Fragment",
|
|
651
665
|
_0: e
|
|
652
666
|
};
|
|
653
667
|
}
|
|
654
|
-
function
|
|
668
|
+
function ne(e) {
|
|
655
669
|
return {
|
|
656
670
|
TAG: "SignalFragment",
|
|
657
671
|
_0: e
|
|
658
672
|
};
|
|
659
673
|
}
|
|
660
|
-
function
|
|
674
|
+
function It(e, t) {
|
|
661
675
|
return {
|
|
662
676
|
TAG: "SignalFragment",
|
|
663
677
|
_0: S.make(() => s.get(e).map(t), void 0)
|
|
664
678
|
};
|
|
665
679
|
}
|
|
666
|
-
function
|
|
680
|
+
function jt(e, t, n) {
|
|
667
681
|
return {
|
|
668
682
|
TAG: "KeyedList",
|
|
669
683
|
signal: e,
|
|
@@ -681,10 +695,10 @@ function _(e, t, n, r, l) {
|
|
|
681
695
|
children: o
|
|
682
696
|
};
|
|
683
697
|
}
|
|
684
|
-
function
|
|
698
|
+
function xt(e, t, n, r) {
|
|
685
699
|
return _("div", e, t, n);
|
|
686
700
|
}
|
|
687
|
-
function
|
|
701
|
+
function Pt(e, t, n, r) {
|
|
688
702
|
return _("span", e, t, n);
|
|
689
703
|
}
|
|
690
704
|
function Rt(e, t, n, r) {
|
|
@@ -699,82 +713,82 @@ function Ft(e, t, n, r) {
|
|
|
699
713
|
function Lt(e, t, n, r) {
|
|
700
714
|
return _("h2", e, t, n);
|
|
701
715
|
}
|
|
702
|
-
function
|
|
716
|
+
function Gt(e, t, n, r) {
|
|
703
717
|
return _("h3", e, t, n);
|
|
704
718
|
}
|
|
705
|
-
function
|
|
719
|
+
function Bt(e, t, n, r) {
|
|
706
720
|
return _("p", e, t, n);
|
|
707
721
|
}
|
|
708
|
-
function
|
|
722
|
+
function Vt(e, t, n, r) {
|
|
709
723
|
return _("ul", e, t, n);
|
|
710
724
|
}
|
|
711
|
-
function
|
|
725
|
+
function zt(e, t, n, r) {
|
|
712
726
|
return _("li", e, t, n);
|
|
713
727
|
}
|
|
714
|
-
function
|
|
728
|
+
function ke(e, t, n, r) {
|
|
715
729
|
return _("a", e, t, n);
|
|
716
730
|
}
|
|
717
|
-
function
|
|
731
|
+
function Oe(e, t) {
|
|
718
732
|
let n = b(e);
|
|
719
733
|
t.appendChild(n);
|
|
720
734
|
}
|
|
721
|
-
function
|
|
735
|
+
function Wt(e, t) {
|
|
722
736
|
let n = document.getElementById(t);
|
|
723
737
|
if (n == null) {
|
|
724
738
|
console.error("Container element not found: " + t);
|
|
725
739
|
return;
|
|
726
740
|
} else
|
|
727
|
-
return
|
|
741
|
+
return Oe(e, n);
|
|
728
742
|
}
|
|
729
|
-
let
|
|
730
|
-
const
|
|
743
|
+
let Te = ye, Kt = be, Xt = we;
|
|
744
|
+
const qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
731
745
|
__proto__: null,
|
|
732
|
-
Attributes:
|
|
733
|
-
DOM:
|
|
734
|
-
Reactivity:
|
|
735
|
-
Render:
|
|
736
|
-
a:
|
|
737
|
-
attr:
|
|
746
|
+
Attributes: At,
|
|
747
|
+
DOM: kt,
|
|
748
|
+
Reactivity: Tt,
|
|
749
|
+
Render: $t,
|
|
750
|
+
a: ke,
|
|
751
|
+
attr: Te,
|
|
738
752
|
button: Rt,
|
|
739
|
-
computedAttr:
|
|
740
|
-
div:
|
|
753
|
+
computedAttr: Xt,
|
|
754
|
+
div: xt,
|
|
741
755
|
element: _,
|
|
742
|
-
fragment:
|
|
756
|
+
fragment: Mt,
|
|
743
757
|
h1: Ft,
|
|
744
758
|
h2: Lt,
|
|
745
|
-
h3:
|
|
759
|
+
h3: Gt,
|
|
746
760
|
input: Dt,
|
|
747
|
-
keyedList:
|
|
748
|
-
li:
|
|
749
|
-
list:
|
|
750
|
-
mount:
|
|
751
|
-
mountById:
|
|
752
|
-
p:
|
|
753
|
-
signalAttr:
|
|
754
|
-
signalFragment:
|
|
755
|
-
span:
|
|
756
|
-
text:
|
|
757
|
-
textSignal:
|
|
758
|
-
ul:
|
|
761
|
+
keyedList: jt,
|
|
762
|
+
li: zt,
|
|
763
|
+
list: It,
|
|
764
|
+
mount: Oe,
|
|
765
|
+
mountById: Wt,
|
|
766
|
+
p: Bt,
|
|
767
|
+
signalAttr: Kt,
|
|
768
|
+
signalFragment: ne,
|
|
769
|
+
span: Pt,
|
|
770
|
+
text: Ct,
|
|
771
|
+
textSignal: Nt,
|
|
772
|
+
ul: Vt
|
|
759
773
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
760
774
|
let T = s.make({
|
|
761
775
|
pathname: "/",
|
|
762
776
|
search: "",
|
|
763
777
|
hash: ""
|
|
764
778
|
}, void 0, void 0);
|
|
765
|
-
function
|
|
779
|
+
function Q() {
|
|
766
780
|
return {
|
|
767
781
|
pathname: window.location.pathname,
|
|
768
782
|
search: window.location.search,
|
|
769
783
|
hash: window.location.hash
|
|
770
784
|
};
|
|
771
785
|
}
|
|
772
|
-
function
|
|
773
|
-
s.set(T,
|
|
774
|
-
let e = (t) => s.set(T,
|
|
786
|
+
function Ht() {
|
|
787
|
+
s.set(T, Q());
|
|
788
|
+
let e = (t) => s.set(T, Q());
|
|
775
789
|
window.addEventListener("popstate", e);
|
|
776
790
|
}
|
|
777
|
-
function
|
|
791
|
+
function Ae(e, t, n, r) {
|
|
778
792
|
let l = t !== void 0 ? t : "", u = n !== void 0 ? n : "", a = {
|
|
779
793
|
pathname: e,
|
|
780
794
|
search: l,
|
|
@@ -782,7 +796,7 @@ function Te(e, t, n, r) {
|
|
|
782
796
|
}, o = e + l + u, c = {};
|
|
783
797
|
window.history.pushState(c, "", o), s.set(T, a);
|
|
784
798
|
}
|
|
785
|
-
function
|
|
799
|
+
function Ut(e, t, n, r) {
|
|
786
800
|
let l = t !== void 0 ? t : "", u = n !== void 0 ? n : "", a = {
|
|
787
801
|
pathname: e,
|
|
788
802
|
search: l,
|
|
@@ -790,73 +804,73 @@ function Ht(e, t, n, r) {
|
|
|
790
804
|
}, o = e + l + u, c = {};
|
|
791
805
|
window.history.replaceState(c, "", o), s.set(T, a);
|
|
792
806
|
}
|
|
793
|
-
function
|
|
794
|
-
return
|
|
795
|
-
let n = s.get(T), r =
|
|
807
|
+
function Jt(e, t) {
|
|
808
|
+
return ne(S.make(() => {
|
|
809
|
+
let n = s.get(T), r = te(e, n.pathname);
|
|
796
810
|
return typeof r != "object" ? [] : [t(r._0)];
|
|
797
811
|
}, void 0));
|
|
798
812
|
}
|
|
799
|
-
function
|
|
800
|
-
return
|
|
813
|
+
function Qt(e) {
|
|
814
|
+
return ne(S.make(() => {
|
|
801
815
|
let t = s.get(T), n = Le(e, (r) => {
|
|
802
|
-
let l =
|
|
816
|
+
let l = te(r.pattern, t.pathname);
|
|
803
817
|
if (typeof l == "object")
|
|
804
818
|
return r.render(l._0);
|
|
805
819
|
});
|
|
806
820
|
return n !== void 0 ? [n] : [];
|
|
807
821
|
}, void 0));
|
|
808
822
|
}
|
|
809
|
-
function
|
|
823
|
+
function Yt(e, t, n, r) {
|
|
810
824
|
let l = t !== void 0 ? t : [], u = n !== void 0 ? n : [], a = (o) => {
|
|
811
|
-
o.preventDefault(),
|
|
825
|
+
o.preventDefault(), Ae(e, void 0, void 0);
|
|
812
826
|
};
|
|
813
|
-
return
|
|
827
|
+
return ke(l.concat([Te("href", e)]), [[
|
|
814
828
|
"click",
|
|
815
829
|
a
|
|
816
830
|
]], u);
|
|
817
831
|
}
|
|
818
|
-
let
|
|
819
|
-
const
|
|
832
|
+
let Zt, en;
|
|
833
|
+
const tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
820
834
|
__proto__: null,
|
|
821
|
-
Component:
|
|
822
|
-
Route:
|
|
823
|
-
getCurrentLocation:
|
|
824
|
-
init:
|
|
825
|
-
link:
|
|
835
|
+
Component: Zt,
|
|
836
|
+
Route: en,
|
|
837
|
+
getCurrentLocation: Q,
|
|
838
|
+
init: Ht,
|
|
839
|
+
link: Yt,
|
|
826
840
|
location: T,
|
|
827
|
-
push:
|
|
828
|
-
replace:
|
|
829
|
-
route:
|
|
830
|
-
routes:
|
|
841
|
+
push: Ae,
|
|
842
|
+
replace: Ut,
|
|
843
|
+
route: Jt,
|
|
844
|
+
routes: Qt
|
|
831
845
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
832
|
-
let
|
|
833
|
-
Id:
|
|
834
|
-
Scheduler:
|
|
835
|
-
make:
|
|
836
|
-
get:
|
|
837
|
-
peek:
|
|
838
|
-
set:
|
|
839
|
-
update:
|
|
840
|
-
batch:
|
|
841
|
-
untrack:
|
|
842
|
-
},
|
|
843
|
-
Id:
|
|
844
|
-
Signal:
|
|
845
|
-
Observer:
|
|
846
|
-
Scheduler:
|
|
847
|
-
make:
|
|
848
|
-
dispose:
|
|
849
|
-
},
|
|
850
|
-
Id:
|
|
851
|
-
Observer:
|
|
852
|
-
Scheduler:
|
|
853
|
-
run:
|
|
854
|
-
},
|
|
846
|
+
let nn = s.Id, rn = s.Scheduler, ln = s.make, un = s.get, on = s.peek, cn = s.set, dn = s.update, sn = s.batch, an = s.untrack, wn = {
|
|
847
|
+
Id: nn,
|
|
848
|
+
Scheduler: rn,
|
|
849
|
+
make: ln,
|
|
850
|
+
get: un,
|
|
851
|
+
peek: on,
|
|
852
|
+
set: cn,
|
|
853
|
+
update: dn,
|
|
854
|
+
batch: sn,
|
|
855
|
+
untrack: an
|
|
856
|
+
}, fn = S.Id, pn = S.Signal, mn = S.Observer, hn = S.Scheduler, _n = S.make, gn = S.dispose, kn = {
|
|
857
|
+
Id: fn,
|
|
858
|
+
Signal: pn,
|
|
859
|
+
Observer: mn,
|
|
860
|
+
Scheduler: hn,
|
|
861
|
+
make: _n,
|
|
862
|
+
dispose: gn
|
|
863
|
+
}, Sn = w.Id, En = w.Observer, vn = w.Scheduler, yn = w.run, On = {
|
|
864
|
+
Id: Sn,
|
|
865
|
+
Observer: En,
|
|
866
|
+
Scheduler: vn,
|
|
867
|
+
run: yn
|
|
868
|
+
}, Tn = qt, An = bt, $n = tn;
|
|
855
869
|
export {
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
870
|
+
Tn as Component,
|
|
871
|
+
kn as Computed,
|
|
872
|
+
On as Effect,
|
|
873
|
+
An as Route,
|
|
874
|
+
$n as Router,
|
|
875
|
+
wn as Signal
|
|
862
876
|
};
|
package/dist/xote.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(g,T){typeof exports=="object"&&typeof module<"u"?T(exports):typeof define=="function"&&define.amd?define(["exports"],T):(g=typeof globalThis<"u"?globalThis:g||self,T(g.xote={}))})(this,(function(g){"use strict";let T={contents:0};function X(){return T.contents=T.contents+1|0,T.contents}function Ae(e){return e===void 0?{BS_PRIVATE_NESTED_SOME_NONE:0}:e!==null&&e.BS_PRIVATE_NESTED_SOME_NONE!==void 0?{BS_PRIVATE_NESTED_SOME_NONE:e.BS_PRIVATE_NESTED_SOME_NONE+1|0}:e}function Ce(e){if(e!=null)return Ae(e)}function re(e){if(e===null||e.BS_PRIVATE_NESTED_SOME_NONE===void 0)return e;let t=e.BS_PRIVATE_NESTED_SOME_NONE;if(t!==0)return{BS_PRIVATE_NESTED_SOME_NONE:t-1|0}}function q(e,t){return e!==void 0?re(e):t}function Ne(e,t,n){return e.reduce(n,t)}function Ie(e,t){let n=e.length,r=new Array(n),l=0;for(let u=0;u<n;++u){let a=e[u],c=t(a);c!==void 0&&(r[l]=re(c),l=l+1|0)}return r.length=l,r}function Me(e,t){let n=0;for(;;){let r=n;if(r===e.length)return;let l=t(e[r]);if(l!==void 0)return l;n=r+1|0}}let h=new Map,C=new Map,F=new Map,p={contents:void 0},N=new Set,O={contents:!1},b={contents:!1};function H(e){if(C.get(e)===void 0){C.set(e,new Set);return}}function je(e,t){let n=C.get(e);if(n!==void 0){n.forEach(t);return}}function Re(e,t){let n=C.get(e);if(n!==void 0){n.add(t);return}}function Pe(e,t){let n=C.get(e);if(n!==void 0){n.delete(t);return}}function De(e){return Array.from(q(C.get(e),new Set).values())}function le(e,t){let n=p.contents;p.contents=e;try{let r=t();return p.contents=n,r}catch(r){throw p.contents=n,r}}function Fe(e){let t=p.contents;p.contents=void 0;try{let n=e();return p.contents=t,n}catch(n){throw p.contents=t,n}}function Le(e){let t=p.contents;return t!==void 0?t===e:!1}function xe(e){if(!O.contents){O.contents=!0;try{e(),O.contents=!1;return}catch(t){throw O.contents=!1,t}}}function Ge(e,t){H(t);let n=Le(e),r=h.get(e);if(n&&r!==void 0&&!r.deps.has(t))return r.deps.add(t),Re(t,e)}function I(e){e.deps.forEach(t=>Pe(t,e.id)),e.deps.clear()}function Be(e){let t=F.get(e);if(t===void 0)return;F.delete(e);let n=h.get(t);if(n!==void 0){I(n),h.delete(t);return}}function ue(e){return Ne(e,0,(t,n)=>n>t?n:t)}function Ve(e){let t=[];return e.deps.forEach(n=>je(n,r=>{if(r===e.id)return;let l=h.get(r);if(l===void 0)return;if(typeof l.kind=="object"){t.push(l.level);return}})),ue(t)+1|0}function ze(e){let t=[];return e.deps.forEach(n=>{let r=F.get(n);if(r===void 0||r===e.id)return;let l=h.get(r);if(l!==void 0){t.push(l.level);return}}),ue(t)+1|0}function V(e){return typeof e.kind=="object"?ze(e):Ve(e)}function We(e,t){let n=h.get(e),r=h.get(t);if(n===void 0)return r!==void 0?1:0;if(r===void 0)return-1;let u=typeof n.kind=="object"?0:1,c=typeof r.kind=="object"?0:1,d=u-c|0;return d!==0?d:n.level-r.level|0}function Ke(e){b.contents=!0,I(e),le(e.id,()=>{e.run(),b.contents=!1}),e.level=V(e)}function ie(){for(;N.size>0;){let e=Array.from(N.values());N.clear(),e.sort(We),e.forEach(t=>{let n=h.get(t);if(n!==void 0)return Ke(n)})}}function oe(e){if(H(e),De(e).forEach(t=>{let n=h.get(t);if(n===void 0)return;let r=n.kind;if(typeof r=="object")return n.dirty?void 0:(n.dirty=!0,oe(r.VAL));N.add(t)}),N.size>0)return xe(ie)}function ce(e){let t=F.get(e);if(t===void 0)return;let n=h.get(t);if(n!==void 0&&n.dirty){b.contents=!0,I(n),le(t,()=>{n.run(),n.dirty=!1,b.contents=!1}),n.level=V(n);return}}function Xe(e){let t=O.contents;O.contents=!0;try{let n=e();return t||(O.contents=!1,N.size>0&&ie()),n}catch(n){throw t||(O.contents=!1),n}}let qe=Fe,He=H;function de(e,t,n){let r=X();return He(r),{id:r,value:{contents:e},version:{contents:0},equals:q(n,(l,u)=>l===u),name:t}}function Ue(e){ce(e.id);let t=p.contents;return t!==void 0&&Ge(t,e.id),e.value.contents}function Je(e){return ce(e.id),e.value.contents}function se(e,t){let n;try{n=!e.equals(e.value.contents,t)}catch{n=!0}if(n)return e.value.contents=t,e.version.contents=e.version.contents+1|0,oe(e.id)}function Qe(e,t){se(e,t(e.value.contents))}const Ye=Object.freeze(Object.defineProperty({__proto__:null,Id:void 0,Scheduler:void 0,batch:Xe,get:Ue,make:de,peek:Je,set:se,untrack:qe,update:Qe},Symbol.toStringTag,{value:"Module"}));function ae(e,t,n,r){return{id:e,kind:t,run:n,deps:new Set,level:0,dirty:!0,name:r}}function Ze(e,t){let n=X(),r={contents:void 0},u=ae(n,"Effect",()=>{let d=r.contents;d!==void 0&&d(),r.contents=e()},t);h.set(n,u),b.contents=!0,I(u);let a=p.contents;p.contents=n;try{u.run(),b.contents=!1}catch(d){throw p.contents=a,b.contents=!1,d}return p.contents=a,u.level=V(u),{dispose:()=>{let d=h.get(n);if(d===void 0)return;let x=r.contents;x!==void 0&&x(),I(d),h.delete(n)}}}const et=Object.freeze(Object.defineProperty({__proto__:null,Id:void 0,Observer:void 0,Scheduler:void 0,run:Ze},Symbol.toStringTag,{value:"Module"}));function tt(e,t){let n=de(void 0,t,void 0),r=X(),l=()=>{let c=e();n.value.contents=c},u=ae(r,{NAME:"Computed",VAL:n.id},l,void 0);h.set(r,u),b.contents=!0,I(u);let a=p.contents;p.contents=r;try{u.run(),u.dirty=!1,b.contents=!1}catch(c){throw p.contents=a,b.contents=!1,c}return p.contents=a,u.level=V(u),F.set(n.id,r),n}function nt(e){Be(e.id)}const rt=Object.freeze(Object.defineProperty({__proto__:null,Id:void 0,Observer:void 0,Scheduler:void 0,Signal:void 0,dispose:nt,make:tt},Symbol.toStringTag,{value:"Module"}));let o=Ye,S=rt,w=et;function fe(e){return Ie(e.split("/"),t=>{if(t!=="")return t.startsWith(":")?{TAG:"Param",_0:t.slice(1)}:{TAG:"Static",_0:t}})}function pe(e,t){let n=t.split("/").filter(u=>u!=="");if(e.length!==n.length)return"NoMatch";let r={};return e.every((u,a)=>{let c=n[a];return u.TAG==="Static"?c===u._0:(r[u._0]=c,!0)})?{TAG:"Match",_0:r}:"NoMatch"}function U(e,t){return pe(fe(e),t)}const lt=Object.freeze(Object.defineProperty({__proto__:null,match:U,matchPath:pe,parsePattern:fe},Symbol.toStringTag,{value:"Module"}));function ut(e,t){delete e[t]}let it={},z={contents:void 0};function ot(){return{disposers:[],computeds:[]}}function M(e,t){let n=z.contents;z.contents=e;let r=t();return z.contents=n,r}function j(e,t){e.disposers.push(t)}function me(e){e.disposers.forEach(t=>t.dispose()),e.computeds.forEach(t=>S.dispose(t))}function R(e,t){e.__xote_owner__=t}function he(e){return Ce(e.__xote_owner__)}let ct={currentOwner:z,createOwner:ot,runWithOwner:M,addDisposer:j,disposeOwner:me,setOwner:R,getOwner:he};function _e(e,t){return[e,{TAG:"Static",_0:t}]}function ge(e,t){return[e,{TAG:"SignalValue",_0:t}]}function Se(e,t){return[e,{TAG:"Compute",_0:t}]}let dt={$$static:_e,signal:ge,computed:Se};function L(e){let t=he(e);t!==void 0&&me(t),Array.from(e.childNodes||[]).forEach(L)}function k(e){switch(e.TAG){case"Element":let t=e.children,n=e.events,r=e.attrs,l=document.createElement(e.tag),u={disposers:[],computeds:[]};return R(l,u),M(u,()=>{r.forEach(i=>{let m=i[1],E=i[0];switch(m.TAG){case"Static":l.setAttribute(E,m._0);return;case"SignalValue":let v=m._0;l.setAttribute(E,o.peek(v));let y=w.run(()=>{l.setAttribute(E,o.get(v))},void 0);return j(u,y);case"Compute":let B=m._0;l.setAttribute(E,B());let D=w.run(()=>{l.setAttribute(E,B())},void 0);return j(u,D)}}),n.forEach(i=>{l.addEventListener(i[0],i[1])}),t.forEach(i=>{let m=k(i);l.appendChild(m)})}),l;case"Text":return document.createTextNode(e._0);case"SignalText":let a=e._0,c=document.createTextNode(o.peek(a)),d={disposers:[],computeds:[]};return R(c,d),M(d,()=>{let i=w.run(()=>{c.textContent=o.get(a)},void 0);j(d,i)}),c;case"Fragment":let x=document.createDocumentFragment();return e._0.forEach(i=>{let m=k(i);x.appendChild(m)}),x;case"SignalFragment":let un=e._0,Y={disposers:[],computeds:[]},P=document.createElement("div");return P.setAttribute("style","display: contents"),R(P,Y),M(Y,()=>{let i=w.run(()=>{let m=o.get(un);Array.from(P.childNodes||[]).forEach(L),P.innerHTML="",m.forEach(v=>{let y=k(v);P.appendChild(y)})},void 0);j(Y,i)}),P;case"LazyComponent":let we={disposers:[],computeds:[]},on=M(we,e._0),ke=k(on);return R(ke,we),ke;case"KeyedList":let Z=e.renderItem,ee=e.keyFn,Oe=e.signal,te={disposers:[],computeds:[]},ne=document.createComment(" keyed-list-start "),G=document.createComment(" keyed-list-end ");R(ne,te);let A={},cn=()=>{let i=G.parentNode;if(i==null)return;let m=o.get(Oe),E={};m.forEach(s=>{E[ee(s)]=s});let v=[];Object.keys(A).forEach(s=>{if(E[s]===void 0){v.push(s);return}}),v.forEach(s=>{let f=A[s];if(f!==void 0){L(f.element),f.element.remove(),ut(A,s);return}});let y=[],B={};m.forEach(s=>{let f=ee(s),K=A[f];if(K!==void 0){if(K.item!==s){B[f]=!0;let an=Z(s),fn=k(an),$e={key:f,item:s,element:fn};y.push($e),A[f]=$e;return}y.push(K);return}let dn=Z(s),sn=k(dn),Te={key:f,item:s,element:sn};y.push(Te),A[f]=Te});let D={contents:ne.nextSibling};y.forEach(s=>{let f=D.contents;if(f==null){i.insertBefore(s.element,G);return}if(f===G){i.insertBefore(s.element,G);return}if(f===s.element){D.contents=f.nextSibling;return}q(B[s.key],!1)?(L(f),i.replaceChild(s.element,f),D.contents=s.element.nextSibling):(i.insertBefore(s.element,f),D.contents=s.element.nextSibling)})},W=document.createDocumentFragment();return W.appendChild(ne),o.peek(Oe).forEach(i=>{let m=ee(i),E=Z(i),v=k(E),y={key:m,item:i,element:v};A[m]=y,W.appendChild(v)}),W.appendChild(G),M(te,()=>{let i=w.run(()=>{cn()},void 0);j(te,i)}),W}}let st={disposeElement:L,render:k};function at(e){return{TAG:"Text",_0:e}}function ft(e){return{TAG:"SignalText",_0:S.make(e,void 0)}}function pt(e){return{TAG:"Fragment",_0:e}}function J(e){return{TAG:"SignalFragment",_0:e}}function mt(e,t){return{TAG:"SignalFragment",_0:S.make(()=>o.get(e).map(t),void 0)}}function ht(e,t,n){return{TAG:"KeyedList",signal:e,keyFn:t,renderItem:n}}function _(e,t,n,r,l){let u=t!==void 0?t:[].map(d=>d),a=n!==void 0?n:[].map(d=>d),c=r!==void 0?r:[].map(d=>d);return{TAG:"Element",tag:e,attrs:u,events:a,children:c}}function _t(e,t,n,r){return _("div",e,t,n)}function gt(e,t,n,r){return _("span",e,t,n)}function St(e,t,n,r){return _("button",e,t,n)}function Et(e,t,n){return _("input",e,t,void 0)}function bt(e,t,n,r){return _("h1",e,t,n)}function vt(e,t,n,r){return _("h2",e,t,n)}function yt(e,t,n,r){return _("h3",e,t,n)}function wt(e,t,n,r){return _("p",e,t,n)}function kt(e,t,n,r){return _("ul",e,t,n)}function Ot(e,t,n,r){return _("li",e,t,n)}function Ee(e,t,n,r){return _("a",e,t,n)}function be(e,t){let n=k(e);t.appendChild(n)}function Tt(e,t){let n=document.getElementById(t);if(n==null){console.error("Container element not found: "+t);return}else return be(e,n)}let ve=_e;const $t=Object.freeze(Object.defineProperty({__proto__:null,Attributes:dt,DOM:it,Reactivity:ct,Render:st,a:Ee,attr:ve,button:St,computedAttr:Se,div:_t,element:_,fragment:pt,h1:bt,h2:vt,h3:yt,input:Et,keyedList:ht,li:Ot,list:mt,mount:be,mountById:Tt,p:wt,signalAttr:ge,signalFragment:J,span:gt,text:at,textSignal:ft,ul:kt},Symbol.toStringTag,{value:"Module"}));let $=o.make({pathname:"/",search:"",hash:""},void 0,void 0);function Q(){return{pathname:window.location.pathname,search:window.location.search,hash:window.location.hash}}function At(){o.set($,Q());let e=t=>o.set($,Q());window.addEventListener("popstate",e)}function ye(e,t,n,r){let l=t!==void 0?t:"",u=n!==void 0?n:"",a={pathname:e,search:l,hash:u},c=e+l+u,d={};window.history.pushState(d,"",c),o.set($,a)}function Ct(e,t,n,r){let l=t!==void 0?t:"",u=n!==void 0?n:"",a={pathname:e,search:l,hash:u},c=e+l+u,d={};window.history.replaceState(d,"",c),o.set($,a)}function Nt(e,t){return J(S.make(()=>{let n=o.get($),r=U(e,n.pathname);return typeof r!="object"?[]:[t(r._0)]},void 0))}function It(e){return J(S.make(()=>{let t=o.get($),n=Me(e,r=>{let l=U(r.pattern,t.pathname);if(typeof l=="object")return r.render(l._0)});return n!==void 0?[n]:[]},void 0))}function Mt(e,t,n,r){let l=t!==void 0?t:[],u=n!==void 0?n:[],a=c=>{c.preventDefault(),ye(e,void 0,void 0)};return Ee(l.concat([ve("href",e)]),[["click",a]],u)}const jt=Object.freeze(Object.defineProperty({__proto__:null,Component:void 0,Route:void 0,getCurrentLocation:Q,init:At,link:Mt,location:$,push:ye,replace:Ct,route:Nt,routes:It},Symbol.toStringTag,{value:"Module"}));let Rt=o.Id,Pt=o.Scheduler,Dt=o.make,Ft=o.get,Lt=o.peek,xt=o.set,Gt=o.update,Bt=o.batch,Vt=o.untrack,zt={Id:Rt,Scheduler:Pt,make:Dt,get:Ft,peek:Lt,set:xt,update:Gt,batch:Bt,untrack:Vt},Wt=S.Id,Kt=S.Signal,Xt=S.Observer,qt=S.Scheduler,Ht=S.make,Ut=S.dispose,Jt={Id:Wt,Signal:Kt,Observer:Xt,Scheduler:qt,make:Ht,dispose:Ut},Qt=w.Id,Yt=w.Observer,Zt=w.Scheduler,en=w.run,tn={Id:Qt,Observer:Yt,Scheduler:Zt,run:en},nn=$t,rn=lt,ln=jt;g.Component=nn,g.Computed=Jt,g.Effect=tn,g.Route=rn,g.Router=ln,g.Signal=zt,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(g,T){typeof exports=="object"&&typeof module<"u"?T(exports):typeof define=="function"&&define.amd?define(["exports"],T):(g=typeof globalThis<"u"?globalThis:g||self,T(g.xote={}))})(this,(function(g){"use strict";let T={contents:0};function q(){return T.contents=T.contents+1|0,T.contents}function Ce(e){return e===void 0?{BS_PRIVATE_NESTED_SOME_NONE:0}:e!==null&&e.BS_PRIVATE_NESTED_SOME_NONE!==void 0?{BS_PRIVATE_NESTED_SOME_NONE:e.BS_PRIVATE_NESTED_SOME_NONE+1|0}:e}function Ne(e){if(e!=null)return Ce(e)}function le(e){if(e===null||e.BS_PRIVATE_NESTED_SOME_NONE===void 0)return e;let t=e.BS_PRIVATE_NESTED_SOME_NONE;if(t!==0)return{BS_PRIVATE_NESTED_SOME_NONE:t-1|0}}function H(e,t){return e!==void 0?le(e):t}function Ie(e,t,n){return e.reduce(n,t)}function Me(e,t){let n=e.length,r=new Array(n),l=0;for(let u=0;u<n;++u){let a=e[u],c=t(a);c!==void 0&&(r[l]=le(c),l=l+1|0)}return r.length=l,r}function je(e,t){let n=0;for(;;){let r=n;if(r===e.length)return;let l=t(e[r]);if(l!==void 0)return l;n=r+1|0}}let h=new Map,C=new Map,L=new Map,p={contents:void 0},N=new Set,k={contents:!1},v={contents:!1};function U(e){if(C.get(e)===void 0){C.set(e,new Set);return}}function Re(e,t){let n=C.get(e);if(n!==void 0){n.forEach(t);return}}function Pe(e,t){let n=C.get(e);if(n!==void 0){n.add(t);return}}function De(e,t){let n=C.get(e);if(n!==void 0){n.delete(t);return}}function Fe(e){return Array.from(H(C.get(e),new Set).values())}function ue(e,t){let n=p.contents;p.contents=e;try{let r=t();return p.contents=n,r}catch(r){throw p.contents=n,r}}function Le(e){let t=p.contents;p.contents=void 0;try{let n=e();return p.contents=t,n}catch(n){throw p.contents=t,n}}function xe(e){let t=p.contents;return t!==void 0?t===e:!1}function Ge(e){if(!k.contents){k.contents=!0;try{e(),k.contents=!1;return}catch(t){throw k.contents=!1,t}}}function Be(e,t){U(t);let n=xe(e),r=h.get(e);if(n&&r!==void 0&&!r.deps.has(t))return r.deps.add(t),Pe(t,e)}function I(e){e.deps.forEach(t=>De(t,e.id)),e.deps.clear()}function Ve(e){let t=L.get(e);if(t===void 0)return;L.delete(e);let n=h.get(t);if(n!==void 0){I(n),h.delete(t);return}}function ie(e){return Ie(e,0,(t,n)=>n>t?n:t)}function ze(e){let t=[];return e.deps.forEach(n=>Re(n,r=>{if(r===e.id)return;let l=h.get(r);if(l===void 0)return;if(typeof l.kind=="object"){t.push(l.level);return}})),ie(t)+1|0}function We(e){let t=[];return e.deps.forEach(n=>{let r=L.get(n);if(r===void 0||r===e.id)return;let l=h.get(r);if(l!==void 0){t.push(l.level);return}}),ie(t)+1|0}function z(e){return typeof e.kind=="object"?We(e):ze(e)}function Ke(e,t){let n=h.get(e),r=h.get(t);if(n===void 0)return r!==void 0?1:0;if(r===void 0)return-1;let u=typeof n.kind=="object"?0:1,c=typeof r.kind=="object"?0:1,d=u-c|0;return d!==0?d:n.level-r.level|0}function Xe(e){v.contents=!0,I(e),ue(e.id,()=>{e.run(),v.contents=!1}),e.level=z(e)}function oe(){for(;N.size>0;){let e=Array.from(N.values());N.clear(),e.sort(Ke),e.forEach(t=>{let n=h.get(t);if(n!==void 0)return Xe(n)})}}function ce(e){if(U(e),Fe(e).forEach(t=>{let n=h.get(t);if(n===void 0)return;let r=n.kind;if(typeof r=="object")return n.dirty?void 0:(n.dirty=!0,ce(r.VAL));N.add(t)}),N.size>0)return Ge(oe)}function de(e){let t=L.get(e);if(t===void 0)return;let n=h.get(t);if(n!==void 0&&n.dirty){v.contents=!0,I(n),ue(t,()=>{n.run(),n.dirty=!1,v.contents=!1}),n.level=z(n);return}}function qe(e){let t=k.contents;k.contents=!0;try{let n=e();return t||(k.contents=!1,N.size>0&&oe()),n}catch(n){throw t||(k.contents=!1),n}}let He=Le,Ue=U;function se(e,t,n){let r=q();return Ue(r),{id:r,value:{contents:e},version:{contents:0},equals:H(n,(l,u)=>l===u),name:t}}function Je(e){de(e.id);let t=p.contents;return t!==void 0&&Be(t,e.id),e.value.contents}function Qe(e){return de(e.id),e.value.contents}function ae(e,t){let n;try{n=!e.equals(e.value.contents,t)}catch{n=!0}if(n)return e.value.contents=t,e.version.contents=e.version.contents+1|0,ce(e.id)}function Ye(e,t){ae(e,t(e.value.contents))}const Ze=Object.freeze(Object.defineProperty({__proto__:null,Id:void 0,Scheduler:void 0,batch:qe,get:Je,make:se,peek:Qe,set:ae,untrack:He,update:Ye},Symbol.toStringTag,{value:"Module"}));function fe(e,t,n,r){return{id:e,kind:t,run:n,deps:new Set,level:0,dirty:!0,name:r}}function et(e,t){let n=q(),r={contents:void 0},u=fe(n,"Effect",()=>{let d=r.contents;d!==void 0&&d(),r.contents=e()},t);h.set(n,u),v.contents=!0,I(u);let a=p.contents;p.contents=n;try{u.run(),v.contents=!1}catch(d){throw p.contents=a,v.contents=!1,d}return p.contents=a,u.level=z(u),{dispose:()=>{let d=h.get(n);if(d===void 0)return;let G=r.contents;G!==void 0&&G(),I(d),h.delete(n)}}}const tt=Object.freeze(Object.defineProperty({__proto__:null,Id:void 0,Observer:void 0,Scheduler:void 0,run:et},Symbol.toStringTag,{value:"Module"}));function nt(e,t){let n=se(void 0,t,void 0),r=q(),l=()=>{let c=e();n.value.contents=c},u=fe(r,{NAME:"Computed",VAL:n.id},l,void 0);h.set(r,u),v.contents=!0,I(u);let a=p.contents;p.contents=r;try{u.run(),u.dirty=!1,v.contents=!1}catch(c){throw p.contents=a,v.contents=!1,c}return p.contents=a,u.level=z(u),L.set(n.id,r),n}function rt(e){Ve(e.id)}const lt=Object.freeze(Object.defineProperty({__proto__:null,Id:void 0,Observer:void 0,Scheduler:void 0,Signal:void 0,dispose:rt,make:nt},Symbol.toStringTag,{value:"Module"}));let o=Ze,S=lt,w=tt;function pe(e){return Me(e.split("/"),t=>{if(t!=="")return t.startsWith(":")?{TAG:"Param",_0:t.slice(1)}:{TAG:"Static",_0:t}})}function me(e,t){let n=t.split("/").filter(u=>u!=="");if(e.length!==n.length)return"NoMatch";let r={};return e.every((u,a)=>{let c=n[a];return u.TAG==="Static"?c===u._0:(r[u._0]=c,!0)})?{TAG:"Match",_0:r}:"NoMatch"}function J(e,t){return me(pe(e),t)}const ut=Object.freeze(Object.defineProperty({__proto__:null,match:J,matchPath:me,parsePattern:pe},Symbol.toStringTag,{value:"Module"}));function it(e,t){delete e[t]}function M(e,t,n){switch(t){case"checked":e.checked=n==="true";return;case"value":e.value=n;return;default:e.setAttribute(t,n);return}}let ot={setAttrOrProp:M},W={contents:void 0};function ct(){return{disposers:[],computeds:[]}}function j(e,t){let n=W.contents;W.contents=e;let r=t();return W.contents=n,r}function R(e,t){e.disposers.push(t)}function he(e){e.disposers.forEach(t=>t.dispose()),e.computeds.forEach(t=>S.dispose(t))}function P(e,t){e.__xote_owner__=t}function _e(e){return Ne(e.__xote_owner__)}let dt={currentOwner:W,createOwner:ct,runWithOwner:j,addDisposer:R,disposeOwner:he,setOwner:P,getOwner:_e};function ge(e,t){return[e,{TAG:"Static",_0:t}]}function Se(e,t){return[e,{TAG:"SignalValue",_0:t}]}function Ee(e,t){return[e,{TAG:"Compute",_0:t}]}let st={$$static:ge,signal:Se,computed:Ee};function x(e){let t=_e(e);t!==void 0&&he(t),Array.from(e.childNodes||[]).forEach(x)}function O(e){switch(e.TAG){case"Element":let t=e.children,n=e.events,r=e.attrs,l=document.createElement(e.tag),u={disposers:[],computeds:[]};return P(l,u),j(u,()=>{r.forEach(i=>{let m=i[1],E=i[0];switch(m.TAG){case"Static":return M(l,E,m._0);case"SignalValue":let y=m._0;M(l,E,o.peek(y));let b=w.run(()=>{M(l,E,o.get(y))},void 0);return R(u,b);case"Compute":let V=m._0;M(l,E,V());let F=w.run(()=>{M(l,E,V())},void 0);return R(u,F)}}),n.forEach(i=>{l.addEventListener(i[0],i[1])}),t.forEach(i=>{let m=O(i);l.appendChild(m)})}),l;case"Text":return document.createTextNode(e._0);case"SignalText":let a=e._0,c=document.createTextNode(o.peek(a)),d={disposers:[],computeds:[]};return P(c,d),j(d,()=>{let i=w.run(()=>{c.textContent=o.get(a)},void 0);R(d,i)}),c;case"Fragment":let G=document.createDocumentFragment();return e._0.forEach(i=>{let m=O(i);G.appendChild(m)}),G;case"SignalFragment":let on=e._0,Z={disposers:[],computeds:[]},D=document.createElement("div");return D.setAttribute("style","display: contents"),P(D,Z),j(Z,()=>{let i=w.run(()=>{let m=o.get(on);Array.from(D.childNodes||[]).forEach(x),D.innerHTML="",m.forEach(y=>{let b=O(y);D.appendChild(b)})},void 0);R(Z,i)}),D;case"LazyComponent":let Oe={disposers:[],computeds:[]},cn=j(Oe,e._0),ke=O(cn);return P(ke,Oe),ke;case"KeyedList":let ee=e.renderItem,te=e.keyFn,Te=e.signal,ne={disposers:[],computeds:[]},re=document.createComment(" keyed-list-start "),B=document.createComment(" keyed-list-end ");P(re,ne);let A={},dn=()=>{let i=B.parentNode;if(i==null)return;let m=o.get(Te),E={};m.forEach(s=>{E[te(s)]=s});let y=[];Object.keys(A).forEach(s=>{if(E[s]===void 0){y.push(s);return}}),y.forEach(s=>{let f=A[s];if(f!==void 0){x(f.element),f.element.remove(),it(A,s);return}});let b=[],V={};m.forEach(s=>{let f=te(s),X=A[f];if(X!==void 0){if(X.item!==s){V[f]=!0;let fn=ee(s),pn=O(fn),Ae={key:f,item:s,element:pn};b.push(Ae),A[f]=Ae;return}b.push(X);return}let sn=ee(s),an=O(sn),$e={key:f,item:s,element:an};b.push($e),A[f]=$e});let F={contents:re.nextSibling};b.forEach(s=>{let f=F.contents;if(f==null){i.insertBefore(s.element,B);return}if(f===B){i.insertBefore(s.element,B);return}if(f===s.element){F.contents=f.nextSibling;return}H(V[s.key],!1)?(x(f),i.replaceChild(s.element,f),F.contents=s.element.nextSibling):(i.insertBefore(s.element,f),F.contents=s.element.nextSibling)})},K=document.createDocumentFragment();return K.appendChild(re),o.peek(Te).forEach(i=>{let m=te(i),E=ee(i),y=O(E),b={key:m,item:i,element:y};A[m]=b,K.appendChild(y)}),K.appendChild(B),j(ne,()=>{let i=w.run(()=>{dn()},void 0);R(ne,i)}),K}}let at={disposeElement:x,render:O};function ft(e){return{TAG:"Text",_0:e}}function pt(e){return{TAG:"SignalText",_0:S.make(e,void 0)}}function mt(e){return{TAG:"Fragment",_0:e}}function Q(e){return{TAG:"SignalFragment",_0:e}}function ht(e,t){return{TAG:"SignalFragment",_0:S.make(()=>o.get(e).map(t),void 0)}}function _t(e,t,n){return{TAG:"KeyedList",signal:e,keyFn:t,renderItem:n}}function _(e,t,n,r,l){let u=t!==void 0?t:[].map(d=>d),a=n!==void 0?n:[].map(d=>d),c=r!==void 0?r:[].map(d=>d);return{TAG:"Element",tag:e,attrs:u,events:a,children:c}}function gt(e,t,n,r){return _("div",e,t,n)}function St(e,t,n,r){return _("span",e,t,n)}function Et(e,t,n,r){return _("button",e,t,n)}function vt(e,t,n){return _("input",e,t,void 0)}function yt(e,t,n,r){return _("h1",e,t,n)}function bt(e,t,n,r){return _("h2",e,t,n)}function wt(e,t,n,r){return _("h3",e,t,n)}function Ot(e,t,n,r){return _("p",e,t,n)}function kt(e,t,n,r){return _("ul",e,t,n)}function Tt(e,t,n,r){return _("li",e,t,n)}function ve(e,t,n,r){return _("a",e,t,n)}function ye(e,t){let n=O(e);t.appendChild(n)}function $t(e,t){let n=document.getElementById(t);if(n==null){console.error("Container element not found: "+t);return}else return ye(e,n)}let be=ge;const At=Object.freeze(Object.defineProperty({__proto__:null,Attributes:st,DOM:ot,Reactivity:dt,Render:at,a:ve,attr:be,button:Et,computedAttr:Ee,div:gt,element:_,fragment:mt,h1:yt,h2:bt,h3:wt,input:vt,keyedList:_t,li:Tt,list:ht,mount:ye,mountById:$t,p:Ot,signalAttr:Se,signalFragment:Q,span:St,text:ft,textSignal:pt,ul:kt},Symbol.toStringTag,{value:"Module"}));let $=o.make({pathname:"/",search:"",hash:""},void 0,void 0);function Y(){return{pathname:window.location.pathname,search:window.location.search,hash:window.location.hash}}function Ct(){o.set($,Y());let e=t=>o.set($,Y());window.addEventListener("popstate",e)}function we(e,t,n,r){let l=t!==void 0?t:"",u=n!==void 0?n:"",a={pathname:e,search:l,hash:u},c=e+l+u,d={};window.history.pushState(d,"",c),o.set($,a)}function Nt(e,t,n,r){let l=t!==void 0?t:"",u=n!==void 0?n:"",a={pathname:e,search:l,hash:u},c=e+l+u,d={};window.history.replaceState(d,"",c),o.set($,a)}function It(e,t){return Q(S.make(()=>{let n=o.get($),r=J(e,n.pathname);return typeof r!="object"?[]:[t(r._0)]},void 0))}function Mt(e){return Q(S.make(()=>{let t=o.get($),n=je(e,r=>{let l=J(r.pattern,t.pathname);if(typeof l=="object")return r.render(l._0)});return n!==void 0?[n]:[]},void 0))}function jt(e,t,n,r){let l=t!==void 0?t:[],u=n!==void 0?n:[],a=c=>{c.preventDefault(),we(e,void 0,void 0)};return ve(l.concat([be("href",e)]),[["click",a]],u)}const Rt=Object.freeze(Object.defineProperty({__proto__:null,Component:void 0,Route:void 0,getCurrentLocation:Y,init:Ct,link:jt,location:$,push:we,replace:Nt,route:It,routes:Mt},Symbol.toStringTag,{value:"Module"}));let Pt=o.Id,Dt=o.Scheduler,Ft=o.make,Lt=o.get,xt=o.peek,Gt=o.set,Bt=o.update,Vt=o.batch,zt=o.untrack,Wt={Id:Pt,Scheduler:Dt,make:Ft,get:Lt,peek:xt,set:Gt,update:Bt,batch:Vt,untrack:zt},Kt=S.Id,Xt=S.Signal,qt=S.Observer,Ht=S.Scheduler,Ut=S.make,Jt=S.dispose,Qt={Id:Kt,Signal:Xt,Observer:qt,Scheduler:Ht,make:Ut,dispose:Jt},Yt=w.Id,Zt=w.Observer,en=w.Scheduler,tn=w.run,nn={Id:Yt,Observer:Zt,Scheduler:en,run:tn},rn=At,ln=ut,un=Rt;g.Component=rn,g.Computed=Qt,g.Effect=nn,g.Route=ln,g.Router=un,g.Signal=Wt,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
package/src/Xote__Component.res
CHANGED
|
@@ -29,6 +29,16 @@ module DOM = {
|
|
|
29
29
|
@send external insertBefore: (Dom.element, Dom.element, Dom.element) => unit = "insertBefore"
|
|
30
30
|
@set external setTextContent: (Dom.element, string) => unit = "textContent"
|
|
31
31
|
@set external setValue: (Dom.element, string) => unit = "value"
|
|
32
|
+
@set external setChecked: (Dom.element, bool) => unit = "checked"
|
|
33
|
+
|
|
34
|
+
/* Set attribute or property depending on attribute name */
|
|
35
|
+
let setAttrOrProp = (el: Dom.element, key: string, value: string): unit => {
|
|
36
|
+
switch key {
|
|
37
|
+
| "value" => setValue(el, value)
|
|
38
|
+
| "checked" => setChecked(el, value == "true")
|
|
39
|
+
| _ => setAttribute(el, key, value)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
32
42
|
}
|
|
33
43
|
|
|
34
44
|
/* ============================================================================
|
|
@@ -238,22 +248,22 @@ module Render = {
|
|
|
238
248
|
/* Set attributes */
|
|
239
249
|
attrs->Array.forEach(((key, value)) => {
|
|
240
250
|
switch value {
|
|
241
|
-
| Static(v) => DOM.
|
|
251
|
+
| Static(v) => DOM.setAttrOrProp(el, key, v)
|
|
242
252
|
| SignalValue(signal) => {
|
|
243
|
-
DOM.
|
|
253
|
+
DOM.setAttrOrProp(el, key, Signal.peek(signal))
|
|
244
254
|
let disposer = Effect.run(
|
|
245
255
|
() => {
|
|
246
|
-
DOM.
|
|
256
|
+
DOM.setAttrOrProp(el, key, Signal.get(signal))
|
|
247
257
|
None
|
|
248
258
|
},
|
|
249
259
|
)
|
|
250
260
|
addDisposer(owner, disposer)
|
|
251
261
|
}
|
|
252
262
|
| Compute(compute) => {
|
|
253
|
-
DOM.
|
|
263
|
+
DOM.setAttrOrProp(el, key, compute())
|
|
254
264
|
let disposer = Effect.run(
|
|
255
265
|
() => {
|
|
256
|
-
DOM.
|
|
266
|
+
DOM.setAttrOrProp(el, key, compute())
|
|
257
267
|
None
|
|
258
268
|
},
|
|
259
269
|
)
|
|
@@ -5,7 +5,23 @@ import * as Core__Dict from "@rescript/core/src/Core__Dict.res.mjs";
|
|
|
5
5
|
import * as Core__Option from "@rescript/core/src/Core__Option.res.mjs";
|
|
6
6
|
import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
function setAttrOrProp(el, key, value) {
|
|
9
|
+
switch (key) {
|
|
10
|
+
case "checked" :
|
|
11
|
+
el.checked = value === "true";
|
|
12
|
+
return;
|
|
13
|
+
case "value" :
|
|
14
|
+
el.value = value;
|
|
15
|
+
return;
|
|
16
|
+
default:
|
|
17
|
+
el.setAttribute(key, value);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let DOM = {
|
|
23
|
+
setAttrOrProp: setAttrOrProp
|
|
24
|
+
};
|
|
9
25
|
|
|
10
26
|
let currentOwner = {
|
|
11
27
|
contents: undefined
|
|
@@ -116,20 +132,19 @@ function render(node) {
|
|
|
116
132
|
let key = param[0];
|
|
117
133
|
switch (value.TAG) {
|
|
118
134
|
case "Static" :
|
|
119
|
-
el
|
|
120
|
-
return;
|
|
135
|
+
return setAttrOrProp(el, key, value._0);
|
|
121
136
|
case "SignalValue" :
|
|
122
137
|
let signal = value._0;
|
|
123
|
-
el
|
|
138
|
+
setAttrOrProp(el, key, Signals.Signal.peek(signal));
|
|
124
139
|
let disposer = Signals.Effect.run(() => {
|
|
125
|
-
el
|
|
140
|
+
setAttrOrProp(el, key, Signals.Signal.get(signal));
|
|
126
141
|
}, undefined);
|
|
127
142
|
return addDisposer(owner, disposer);
|
|
128
143
|
case "Compute" :
|
|
129
144
|
let compute = value._0;
|
|
130
|
-
el
|
|
145
|
+
setAttrOrProp(el, key, compute());
|
|
131
146
|
let disposer$1 = Signals.Effect.run(() => {
|
|
132
|
-
el
|
|
147
|
+
setAttrOrProp(el, key, compute());
|
|
133
148
|
}, undefined);
|
|
134
149
|
return addDisposer(owner, disposer$1);
|
|
135
150
|
}
|