@calmdown/pyxis 1.0.0-rc.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/core-dev.d.ts +787 -0
- package/dist/core-dev.js +1828 -0
- package/dist/core-dev.js.map +1 -0
- package/dist/core.d.ts +737 -0
- package/dist/core.js +2 -0
- package/dist/core.js.map +1 -0
- package/dist/jsx-dev-runtime.d.ts +29 -0
- package/dist/jsx-dev-runtime.js +10 -0
- package/dist/jsx-runtime.d.ts +1 -0
- package/dist/jsx-runtime.js +1 -0
- package/dist/main.d.ts +65 -0
- package/dist/main.js +28 -0
- package/package.json +32 -0
package/dist/core.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function e(e){return e.$fn(e.$a0,e.$a1)}function t(e,t=s()){n(t,{$fn:r,$a0:t,$a1:e})}function n(e,t){(e.$onMount??=[]).push(t)}function r(e,t){let n=t();n&&a(e,{$fn:n})}function i(e,t=s()){a(t,{$fn:e})}function a(e,t){(e.$onUnmount??=[]).push(t)}let o=null;function s(){return o}function c(e){let t=o;return o=e,t}function l(e,t,n){let r=o;o=e;try{return t(n)}finally{o=r}}function u(e,t,n){d(e,t,{$fn:n}),n()}function d(e,t,n){t.$dt?(t.$dt.$an=n,n.$ap=t.$dt):t.$dh=n,n.$target=t,t.$dt=n,e.$dt?(e.$dt.$ln=n,n.$lp=e.$dt):e.$dh=n,n.$lifecycle=e,e.$dt=n}function f(e){let t=e.$target;if(!t)return;e.$ap?e.$ap.$an=e.$an:t.$dh===e&&(t.$dh=e.$an),e.$an?e.$an.$ap=e.$ap:t.$dt===e&&(t.$dt=e.$ap),e.$target=null,e.$ap=null,e.$an=null;let n=e.$lifecycle;e.$lp?e.$lp.$ln=e.$ln:n.$dh===e&&(n.$dh=e.$ln),e.$ln?e.$ln.$lp=e.$lp:n.$dt===e&&(n.$dt=e.$lp),e.$lifecycle=null,e.$lp=null,e.$ln=null}function p(e){let t=e.$dh,n,r;for(;t;)n=t.$target,t.$ap?t.$ap.$an=t.$an:n.$dh===t&&(n.$dh=t.$an),t.$an?t.$an.$ap=t.$ap:n.$dt===t&&(n.$dt=t.$ap),r=t.$ln,t.$lifecycle=null,t.$target=null,t.$ap=null,t.$an=null,t.$lp=null,t.$ln=null,t=r;e.$dh=null,e.$dt=null}function m(t){let n=!1,r=[],i=[],a={$epoch:1,$onTick:r,$onTock:i,$scheduleTick:()=>{n||(n=!0,t(o))}},o=()=>{try{let t=0,n;for(;t<r.length;t+=1)n=r[t],n.$life===n.$lifecycle.$life&&e(n);for(t=0;t<i.length;t+=1)n=i[t],n.$life===n.$lifecycle.$life&&e(n)}finally{n=!1,r.length=0,i.length=0,a.$epoch+=1}};return a}function h(e,t,n){let r=e.$scheduler;n.$se!==r.$epoch&&(n.$lifecycle=e,n.$life=e.$life,n.$se=r.$epoch,t.push(n),r.$scheduleTick())}function g(e,t){h(e,e.$scheduler.$onTick,t)}function _(e,t=s()){h(t,t.$scheduler.$onTick,{$fn:e})}function v(e,t){h(e,e.$scheduler.$onTock,t)}function y(e,t=s()){h(t,t.$scheduler.$onTock,{$fn:e})}function b(e,t=s()){S({$lifecycle:t,$life:t.$life,$block:e,$react:x,$cycle:0})}function x(e,t){if(e.$cycle>t){f(this);return}g(e.$lifecycle,e.$resolve??={$fn:S,$a0:e})}function S(e){e.$life===e.$lifecycle.$life&&(e.$dispose?.(),e.$dispose=T(e),!e.$tracksUnmount&&e.$dispose&&(e.$tracksUnmount=!0,a(e.$lifecycle,{$fn:C,$a0:e})))}function C(e){e.$dispose?.(),e.$dispose=null}let w=null;function T(e){e.$deps??=new WeakMap,e.$cycle+=1;let t=w,n=c(e.$lifecycle);w=e;try{return e.$block()}finally{c(n),w=t}}function E(e){if(!w||w.$life!==w.$lifecycle.$life)return;let t=w.$deps.get(e);t?(t.$a1=w.$cycle,t.$lifecycle||d(w.$lifecycle,e,t)):(d(w.$lifecycle,e,t={$fn:w.$react,$a0:w,$a1:w.$cycle}),w.$deps.set(e,t))}const D=Symbol();function O(e,t=s()){return j(e)?e:{[D]:!0,$value:e,$tracksValue:!0,$lifecycle:t,$lastValue:e,get:k,set:A}}function k(){return this.$value}function A(e){return Object.is(this.$value,e)?!1:(this.$value=e,!0)}function j(e){return typeof e==`object`&&!!e&&e[D]===!0}function M(e){return j(e)?(E(e),e.get()):e}function ee(e){return j(e)?e.get():e}function te(e,t,n=!1){return j(e)?((e.set(t)||n)&&(e.$force||=n,g(e.$lifecycle,e.$notify??={$fn:N,$a0:e})),e.get()):e}function ne(e,t,n=!1){return j(e)?((e.set(t(e.get()))||n)&&(e.$force||=n,g(e.$lifecycle,e.$notify??={$fn:N,$a0:e})),e.get()):e}function N(t){if(t.$tracksValue){let e=t.get();if(Object.is(t.$lastValue,e)&&!t.$force)return;t.$lastValue=e}t.$force=!1;let n=t.$dh,r;for(;n;)r=n.$an,e(n),n=r}function re(e,t,n,r,i,a){let{adapter:o}=t.$ng,s=null;j(e)?u(t.$ng,e,()=>{s=o.text(e.get()?.toString()??``,s)}):s=o.text(e.toString(),null),W(s,null,t,n,i,a)}function ie(){return{$symbol:Symbol()}}let P,F=!1;function ae(){return P}function I(e){P=e,F=!1}function oe(e){let{$symbol:t}=e,n=P,r;for(;n&&!(r=n[t]);)n=n.$parent;return r??null}function se(e,t){(!F||!P)&&(F=!0,P={$parent:P});let n=s(),r={[D]:!0,$lifecycle:n,$tracksValue:!0,$value:t,get:le,set:ue};if(t===void 0){let t=oe(e);t&&(r.get=ce,r.$ancestor=t,d(n,t,r.$dep={$fn:N,$a0:r}))}return P[e.$symbol]=r,r}function ce(){return this.$ancestor.get()}function le(){return this.$value}function ue(e){let t;return this.$ancestor?(t=this.$ancestor.get(),f(this.$dep),this.$dep=null,this.$ancestor=null,this.get=le):t=this.$value,this.$value=e,!Object.is(t,e)}const L=Symbol();function de(e,t){let n={adapter:e,mounted:!1,$isGroup:!0,$scheduler:m(e.tick),$extensions:t,$life:1,$pg:null,$ng:null,unmount:()=>H(n),mount:(t,r)=>{let i=!!e.batch,a=i?e.batch():t;V(r,n,a,t,null,i),i&&e.insert(a,t,null)}};return n.$ng=n,n}function R(e,t=null){let n=e.$ng,r={adapter:n.adapter,mounted:!1,$isGroup:!0,$scheduler:n.$scheduler,$extensions:n.$extensions,$life:1,$context:ae(),$pg:n,$ng:null};return r.$ng=r,z(r,e,t),r}function z(e,t,n=null){n?.$pg===t?n.$hp?(e.$hp=n.$hp,e.$hn=n,n.$hp.$hn=e,n.$hp=e):(e.$hp=null,e.$hn=t.$hh,t.$hh===n&&(n.$hp=e),t.$hh=e):(t.$ht?(t.$ht.$hn=e,e.$hp=t.$ht):t.$hh=e,t.$ht=e)}function B(e){e.$hp?e.$hp.$hn=e.$hn:e.$pg?.$hh===e&&(e.$pg.$hh=e.$hn),e.$hn?e.$hn.$hp=e.$hp:e.$pg?.$ht===e&&(e.$pg.$ht=e.$hp),e.$hp=null,e.$hn=null}function V(e,t,n,r,i,a){if(t.mounted){pe(t,n,i);return}let o=c(t);I(t.$context);try{U(e,t,n,r,i,a)}finally{c(o),t.mounted=!0,t.$pg?.mounted!==!1&&fe(t)}}function fe(t){let n=t.$hh;for(;n;)fe(n),n=n.$hn;let r;if(t.$isGroup&&t.mounted&&(r=t.$onMount)){let n=c(t);try{r.forEach(e)}finally{r.length=0,c(n)}}}function pe(e,t,n){let{adapter:r}=e,i=e.$hh;for(;i;)i.$isNative?r.insert(i.$nn,t,n):pe(i,t,n),i=i.$hn}function H(t,n=!0){if(t.$isGroup){if(t.mounted){let n;if(n=t.$onUnmount){let r=c(t);try{n.forEach(e)}finally{n.length=0,c(r)}}t.mounted=!1,t.$life+=1}p(t)}let{adapter:r}=t.$ng,i=t.$hh,a;for(;i;)i.$isNative&&n?(r.remove(i.$nn),H(i,!1)):H(i,n),a=i.$hn,i.$hp=null,i.$hn=null,i=a;t.$hh=null,t.$ht=null}function U(e,t,n,r,i,a){switch(typeof e){case`object`:if(e===null)break;if(Array.isArray(e)){let{length:o}=e,s=0;for(;s<o;s+=1)U(e[s],t,n,r,i,a);break}if(!j(e)){e[L]?.(e,t,n,r,i,a);break}case`string`:case`number`:case`boolean`:case`bigint`:re(e,t,n,r,i,a);break}}function W(e,t,n,r,i,a){let o=n;if(o.$isGroup){let t=null;if(i){let e=n.$ht;for(;e;){if(e.$isNative&&e.$nn===i){t=e;break}e=e.$hp}}z(o={$isNative:!0,$pg:o,$ng:o,$nn:e},n,t)}U(t,o,e,e,null,a),n.$ng.adapter.insert(e,r,i)}function me(e,t,n,r,i,a){U(e.children,t,n,r,i,a)}let he=function(e){return e[e.Change=1]=`Change`,e[e.Insert=2]=`Insert`,e[e.Remove=3]=`Remove`,e[e.Clear=4]=`Clear`,e}({});function G(){return{changes:[],lengthChange:0}}function ge({changes:e},t,n,r){let i=q(e,t,be);if(i<0)e.splice(~i,0,{kind:1,index:t,oldItem:n,newItem:r});else{let a=e[i];switch(a.kind){case 1:case 2:a.newItem=r;break;case 3:e.splice(i+1,0,{kind:1,index:t,oldItem:n,newItem:r});break}}}function _e(e,t,n){let{changes:r}=e,i=q(r,t,xe);if(i<0)i=~i,r.splice(i,0,{kind:2,index:t,newItem:n});else{let e=r[i];switch(e.kind){case 1:case 2:r.splice(i,0,{kind:2,index:t,newItem:n});break;case 3:e.kind=1,e.newItem=n;break}}let{length:a}=r;for(;++i<a;)r[i].index+=1;e.lengthChange+=1}function K(e,t,n){let{changes:r}=e,i=q(r,t,be);if(i<0)i=~i,r.splice(i,0,{kind:3,index:t,oldItem:n});else{let e=r[i];switch(e.kind){case 1:e.kind=3,e.newItem=void 0;break;case 2:r.splice(i--,1);break;case 3:r.splice(++i,0,{kind:3,index:t,oldItem:n});break}}let{length:a}=r;for(;++i<a;)--r[i].index;--e.lengthChange}function ve(e,t){let{changes:n}=e;n.length=0,n.push({kind:4,index:-1}),e.lengthChange-=t}function ye(e,t,n,r){let i=0,a=t.length,o=n.length;for(;i<a&&i<o&&r(t[i],n[i]);)i+=1;if(i===a&&i===o)return;for(;a>i&&o>i&&r(t[a-1],n[o-1]);)--a,--o;let s=(Math.min(a,o)+1)*2,c=a+o,l={$eq:r,$list0:t,$list1:n,$index0:i,$index1:i,$N:a,$M:o,$Z:s,$c:0,$buffer:new(c<=255?Uint8Array:c<=65535?Uint16Array:Uint32Array)(s+s),$stack:[],$stackTop:0,$pxs:-1,$pxe:-1,$pys:-1,$pye:-1,$oxs:-1,$oxe:-1,$oys:-1,$oye:-1},u=0,d,f,p,m,h,g;do{if(Se(l),l.$c===1)d=l.$oxs,f=l.$oxe,p=l.$oys,m=l.$oye;else if(l.$pxs>=0)d=l.$pxs,f=l.$pxe,p=l.$pys,m=l.$pye;else break;for(h=d;h<f;h+=1)K(e,d+u,t[h]);for(g=p;g<m;g+=1)_e(e,d+u,n[g]),u+=1;u-=f-d}while(l.$c<2)}const be=(e,t,n,r,i)=>{let a=n;for(;++a<i&&e[a].index===t;);return a-1},xe=(e,t,n,r,i)=>{let a=n;for(;--a>=r&&e[a].index===t;);return a+1};function q(e,t,n){let r=0,i=e.length,a,o;for(;r<i;)if(a=r+i>>>1,o=e[a].index,t<o)i=a;else if(t>o)r=a+1;else return n(e,t,a,r,i);return~r}function Se(e){let{$list0:t,$list1:n,$buffer:r,$stack:i,$eq:a}=e,{$index0:o,$index1:s,$N:c,$M:l,$Z:u,$c:d,$stackTop:f}=e,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M;for(;;)switch(d){case 0:Z_block:for(;c>0&&l>0;){p=c-l,m=c+l,h=m&1,g=o+c-1,_=s+l-1,b=(m+h)/2,r.fill(0,0,u+u);h_loop:for(y=0;y<=b;y+=1){for(S=2*Math.max(0,y-l)-y,C=y-2*Math.max(0,y-c),x=S;x<=C;x+=2){for(w=r[x-1-u*Math.floor((x-1)/u)],T=r[x+1-u*Math.floor((x+1)/u)],E=x===-y||x!==y&&w<T?T:w+1,D=E-x,O=E,k=D;O<c&&k<l&&a(t[o+O],n[s+k]);)O+=1,k+=1;if(r[x-u*Math.floor(x/u)]=O,h===1&&(v=p-x)>=1-y&&v<y&&O+r[u+v-u*Math.floor(v/u)]>=c)if(y>1||O!==E){i[f++]=o+O,i[f++]=s+k,i[f++]=c-O,i[f++]=l-k,c=E,l=D,u=2*(Math.min(c,l)+1);continue Z_block}else break h_loop}for(x=S;x<=C;x+=2){for(A=r[u+x-1-u*Math.floor((x-1)/u)],j=r[u+x+1-u*Math.floor((x+1)/u)],E=x===-y||x!==y&&A<j?j:A+1,D=E-x,O=E,k=D;O<c&&k<l&&a(t[g-O],n[_-k]);)O+=1,k+=1;if(r[u+x-u*Math.floor(x/u)]=O,h===0&&(v=p-x)>=-y&&v<=y&&O+r[v-u*Math.floor(v/u)]>=c)if(y>0||O!==E){i[f++]=o+c-E,i[f++]=s+l-D,i[f++]=E,i[f++]=D,c-=O,l-=k,u=2*(Math.min(c,l)+1);continue Z_block}else break h_loop}}if(c!==l){l>c?(o+=c,s+=c,l-=c,c=0):(o+=l,s+=l,c-=l,l=0);break}}if(c+l!==0){if(e.$pxe===o||e.$pye===s)e.$pxe=o+c,e.$pye=s+l;else if(M=e.$pxs,e.$oxs=e.$pxs,e.$oxe=e.$pxe,e.$oys=e.$pys,e.$oye=e.$pye,e.$pxs=o,e.$pxe=o+c,e.$pys=s,e.$pye=s+l,M>=0){e.$index0=o,e.$index1=s,e.$N=c,e.$M=l,e.$Z=u,e.$stackTop=f,e.$c=1;return}}case 1:if(f===0){e.$c=2;return}l=i[--f],c=i[--f],s=i[--f],o=i[--f],u=2*(Math.min(c,l)+1),d=0}}function Ce(e,t=s()){let n={[D]:!0,$lifecycle:t,use:we,get:De};return n.use(e,!1),n}function we(e,t=!0){this.$dep&&f(this.$dep);let n=this.get();j(e)?(this.$bound=e,this.$value=null,this.get=Te,this.set=Ee,d(this.$lifecycle,e,this.$dep??={$fn:N,$a0:this})):(this.$bound=null,this.$value=e,this.get=De,this.set=Oe),t&&!Object.is(n,this.get())&&g(this.$lifecycle,this.$notify??={$fn:N,$a0:this})}function Te(){return this.$bound.get()}function Ee(e){let t=this.$bound;return t.set(e)&&g(t.$lifecycle,t.$notify??={$fn:N,$a0:t}),!1}function De(){return this.$value}function Oe(){return!1}const ke={};function J(e,t,n){let r=Ae(t)?t:ke,i={},{length:a}=n,o=0,s;for(;o<a;o+=1)s=n[o],i[s]=Ce(r[s],e);return i.proxied=t,i}function Y(e,t,n){let r=Ae(t)?t:ke,{length:i}=n;e.proxied=t;let a=0,o;for(;a<i;a+=1)o=n[a],e[o].use(r[o])}function Ae(e){return typeof e==`object`&&!!e}function je(e,t,n,r,i,a){let o=e.source,s=e.proxy,c=s!==void 0,u=e.children[0],f=R(t),{adapter:p}=f,m=!!p.batch,h=p.marker(),g,_=!!o.$delta;d(f,o,{$fn:()=>{if(_){_=!1;return}let{changes:e,lengthChange:t}=o.$delta,n=e.length,i=g.length+t,a=Array(i),d=[],v=[],y,b=0,x=0,S=0,C=0,w,T,E,D=!1,O=r,k=null;for(;x<n;x+=1){for(w=e[x];C<w.index;)a[C++]=g[S++];switch(w.kind){case 1:y=a[C++]=g[S++],c?Y(y.$data,w.newItem,s):(H(y),T=g[S]?.$marker??h,W(y.$marker,null,y,r,T,!1),V(l(y,u,y.$data=w.newItem),y,r,r,T,!1));break;case 2:!c||b<t?(y=a[C++]=R(f,g[S]),y.$marker=p.marker(),y.$data=c?J(y,w.newItem,s):w.newItem,b+=1,T=g[S]?.$marker??h,D||(m?(D=!0,O=p.batch(),k=null):k=T),W(y.$marker,null,y,O,k,D),V(l(y,u,y.$data),y,O,r,k,D),D&&(b>=t||!(E=e[x+1])||E.kind!==2||E.index!==C)&&(p.insert(O,r,T),O=r,D=!1)):d.push({$index:C++,$item:w.newItem});break;case 3:y=g[S++],c?v.push(y):H(y),B(y);break;case 4:if(c)v=g,v.forEach(B),S=g.length;else for(;S<g.length;)y=g[S++],H(y),B(y);break}}for(;C<i;)a[C++]=g[S++];let A=d.length-1,j=v.length-1;for(;A>=0;)E=d[A--],y=a[E.$index]=v[j--],Y(y.$data,E.$item,s),z(y,f,T=a[E.$index+1]),V(l(y,u,y.$data),y,r,r,T?.$marker??h,!1);for(;j>=0;)y=v[j--],H(y),B(y);g=a}});{let e=n,t=i,d=m&&!a&&o.$items.length>0;d&&(e=p.batch(),t=null);let _=d||a;g=o.$items.map(n=>{let i=R(f);return i.$marker=p.marker(),i.$data=c?J(i,n,s):n,W(i.$marker,null,i,e,t,_),V(l(i,u,i.$data),i,e,r,t,_),i}),W(h,null,f,e,t,_),d&&p.insert(e,n,i)}V(null,f,n,r,i,a)}const Me=/^([^:]+?):(.+)$/,X=Symbol();function Z(e,t,n,r,i,a){let o=t.$ng,{adapter:s,$extensions:c}=o,l=s.element(e[X]),d,f,p;for(d in e)if(f=Me.exec(d),p=e[d],f)c[f[1]]?.set(l,f[2],p,o);else if(d!==`children`)if(j(p)){let e=d,t=p;u(o,t,()=>{s.set(l,e,t.get())})}else s.set(l,d,p);W(l,e.children,t,n,i,a)}function Ne(e,t,n,r,i,a){let o=e.when;if(!j(o)&&o===!1)return;let{children:s,data:c}=e,u=e.proxy,f=Object.hasOwn(e,`data`)?s[0]:()=>s,p=c;u&&(j(c)?(p=J(t.$ng,c.get(),u),d(t.$ng,c,{$fn:()=>{Y(p,c.get(),u)}})):p=J(t.$ng,c,u));let m=t.$ng.adapter,h=!!m.batch;if(!(j(o)||j(f)||!u&&j(c))){let e=h&&!a,o=n,s=i;e&&(o=m.batch(),s=null),U(f(p),t,o,r,s,e||a),e&&m.insert(o,n,i);return}let g=R(t),_=i;b(()=>{if(M(o)===!1)return;let e=h&&!a,t=n,i=_;return e&&(t=m.batch(),i=null),V(l(g,M(f),M(p)),g,t,r,i,e||a),e&&m.insert(t,n,_),()=>H(g)},t.$ng),_=m.marker(),W(_,null,t,n,i,a),a=!1,n=r}function Pe(e,t=s()){let n={[D]:!0,$dirty:!1,$value:null,$tracksValue:!0,$lifecycle:t,$life:t.$life,$lastValue:null,$cycle:0,$block:e,$react:Fe,get:Ie,set:Le},r=T(n);return n.$value=r,n.$lastValue=r,n}function Fe(e,t){if(e.$life!==e.$lifecycle.$life||e.$cycle>t){f(this);return}e.$dirty=!0,g(e.$lifecycle,e.$notify??={$fn:N,$a0:e})}function Ie(){return this.$dirty&&this.$life===this.$lifecycle.$life&&(this.$value=T(this),this.$dirty=!1),this.$value}function Le(){return!1}function Re(e,t=s()){return{$lifecycle:t,$items:e?Array.from(e):[],$delta:null,[Symbol.iterator]:Ge,size:Be,get:Ve,delta:He,raw:Ue,forEach:We,set:Ke,clear:qe,insertAt:Je,insertFirst:Ye,insertLast:Xe,remove:Ze,removeAt:Qe,removeFirst:$e,removeLast:et}}function ze(e,t,n=tt){let r=e.$items;e.$items=t.slice(),ye(e.$delta??=G(),r,t,n),$(e)}function Be(){return E(this),this.$items.length}function Ve(e){return E(this),this.$items[e]}function He(){return E(this),this.$delta}function Ue(){return E(this),this.$items}function We(e,t){E(this),this.$items.forEach(e,t)}function Ge(){return E(this),this.$items[Symbol.iterator]()}function Ke(e,t){Q(this,e);let n=this.$items[e];Object.is(t,n)||(this.$items[e]=t,this.$dh&&(ge(this.$delta??=G(),e,n,t),$(this)))}function qe(){let e=this.$items.length;this.$items.length=0,this.$dh&&(ve(this.$delta??=G(),e),$(this))}function Je(e,t){let{$items:n}=this;e===n.length?n.push(t):(Q(this,e),this.$items.splice(e,0,t)),this.$dh&&(_e(this.$delta??=G(),e,t),$(this))}function Ye(e){this.insertAt(0,e)}function Xe(e){this.insertAt(this.$items.length,e)}function Ze(e){let t=this.$items.indexOf(e);return t===-1?!1:(this.removeAt(t),!0)}function Qe(e){Q(this,e);let t=this.$items.splice(e,1)[0];return this.$dh&&(K(this.$delta??=G(),e,t),$(this)),t}function $e(){return this.$items.length>0?this.removeAt(0):void 0}function et(){let{length:e}=this.$items;return e>0?this.removeAt(e-1):void 0}function Q(e,t){if(t>=e.$items.length||t<0)throw RangeError()}function tt(e,t){return Object.is(e,t)}function $(e){g(e.$lifecycle,e.$notify??={$fn:nt,$a0:e}),v(e.$lifecycle,e.$cleanup??={$fn:rt,$a0:e})}function nt(t){let n=t.$dh,r;for(;n;)r=n.$an,e(n),n=r}function rt(e){e.$delta=null}const it={set:(e,t,r)=>{let i;switch(t){case`atom`:if(!j(r))return;i=at;break;case`call`:if(typeof r!=`function`)return;i=ot;break;default:return}let o=s();n(o,{$fn:i,$a0:r,$a1:e}),a(o,{$fn:i,$a0:r,$a1:null})}};function at(e,t){e.set(t)}function ot(e,t){e(t)}function st(e,t,n){let{length:r}=n,i=0,a=t[0];for(;i<r;)a+=e(n[i])+t[++i];return a}function ct(e,...t){return st(M,e,t)}function lt(e,...t){return st(ee,e,t)}function ut(e){let t={},n={build:()=>de(e,t),extend:(e,r)=>(t[e]=r,n)};return n}function dt(e){return(t,n,r,i,a,o)=>{let s=ae();try{I(s),U(e(t),n,r,i,a,o)}finally{I(s)}}}const ft=Object.freeze([]);function pt(e,t,n){let{children:r}=t;return t.children=r===void 0?ft:Array.isArray(r)?r:[r],t.key??=n,typeof e==`string`?(t[L]=Z,t[X]=e):t[L]=e,t}function mt(e,t,n){return t.key??=n,typeof e==`string`?(t[L]=Z,t[X]=e):t[L]=e,t}export{he as ChangeKind,me as Fragment,je as Iterator,Z as Native,it as RefExtension,Ne as Show,O as atomOf,u as bind,dt as component,oe as consumerOf,ie as createContext,Pe as derived,b as effect,R as fork,s as getLifecycle,se as host,W as insert,j as isAtom,pt as jsx,mt as jsxs,Re as listOf,V as mount,U as mountJsx,t as mounted,ee as peek,lt as peeks,Ce as proxyOf,ut as pyxis,M as read,ct as reads,ze as sync,_ as tick,y as tock,z as track,H as unmount,i as unmounted,B as untrack,ne as update,l as withLifecycle,te as write};
|
|
2
|
+
//# sourceMappingURL=core.js.map
|
package/dist/core.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","names":["getValue","setValue","notify","setValue","notify","notify","notify"],"sources":["../src/support/common.ts","../src/data/Lifecycle.ts","../src/data/Dependency.ts","../src/data/Scheduler.ts","../src/data/Effect.ts","../src/data/Atom.ts","../src/component/Text.ts","../src/data/Context.ts","../src/Renderer.ts","../src/component/Fragment.ts","../src/data/ListDelta.ts","../src/data/ProxyAtom.ts","../src/component/Iterator.ts","../src/component/Native.ts","../src/component/Show.ts","../src/data/Derivation.ts","../src/data/List.ts","../src/extension/RefExtension.ts","../src/support/text.ts","../src/Builder.ts","../src/Component.ts","../src/jsx.ts"],"sourcesContent":["import type { ArgsMax2, Callback } from \"./types\";\n\n/**\n * Invokes a Callback passing stored arguments and forwarding the return value.\n * @internal\n */\nexport function invoke<TArgs extends ArgsMax2, TReturn>(callback: Callback<TArgs, TReturn>): TReturn;\nexport function invoke(callback: Callback<ArgsMax2>) {\n\treturn callback.$fn(\n\t\tcallback.$a0,\n\t\tcallback.$a1,\n\t);\n}\n","import type { Callback, Nil } from \"~/support/types\";\n\nimport type { DependencyList } from \"./Dependency\";\nimport type { Scheduler } from \"./Scheduler\";\n\nexport interface Lifecycle extends DependencyList {\n\t/** whether this Lifecycle is currently mounted or not */\n\tmounted: boolean;\n\n\t/** @internal */\n\treadonly $scheduler: Scheduler;\n\n\t/**\n\t * tracks the life of this lifecycle, incremented each time it is resurrected - used for\n\t * detecting stale updates scheduled in a previous life\n\t * @internal\n\t */\n\t$life: number;\n\n\t/** @internal */\n\t$onMount?: Nil<Callback[]>;\n\n\t/** @internal */\n\t$onUnmount?: Nil<Callback[]>;\n}\n\nexport interface MountBlock {\n\t(): (() => void) | void;\n}\n\nexport interface UnmountBlock {\n\t(): void;\n}\n\n\n/**\n * Registers a callback to run just after the current Component has mounted.\n *\n * If a teardown callback is returned, it will be run just before the Component unmounts (equivalent\n * to adding a separate `unmounted` block).\n * @see {@link unmounted}\n */\nexport function mounted(block: MountBlock, lifecycle = getLifecycle()) {\n\tonMounted(lifecycle, {\n\t\t$fn: invokeMountedCallback,\n\t\t$a0: lifecycle,\n\t\t$a1: block,\n\t});\n}\n\n/** @internal */\nexport function onMounted(lifecycle: Lifecycle, callback: Callback) {\n\t(lifecycle.$onMount ??= []).push(callback);\n}\n\nfunction invokeMountedCallback(lifecycle: Lifecycle, block: MountBlock) {\n\tconst dispose = block();\n\tif (dispose) {\n\t\tonUnmounted(lifecycle, { $fn: dispose });\n\t}\n}\n\n\n/**\n * Registers a callback to run once the current Component is just about to unmount.\n * @see {@link mounted}\n */\nexport function unmounted(block: UnmountBlock, lifecycle = getLifecycle()) {\n\tonUnmounted(lifecycle, { $fn: block });\n}\n\n/** @internal */\nexport function onUnmounted(lifecycle: Lifecycle, callback: Callback) {\n\t(lifecycle.$onUnmount ??= []).push(callback);\n}\n\n\nlet $currentLifecycle: Lifecycle | null = null;\n\n/**\n * Gets the Lifecycle of the calling component.\n */\nexport function getLifecycle(): Lifecycle {\n\tif (__DEV__ && !$currentLifecycle) {\n\t\tthrow new Error(\"Cannot get current lifecycle. Are you creating an Atom outside of a Component?\");\n\t}\n\n\treturn $currentLifecycle!;\n}\n\n/** @internal */\nexport function setLifecycle(lifecycle: Lifecycle | null): Lifecycle | null {\n\tconst previous = $currentLifecycle;\n\t$currentLifecycle = lifecycle;\n\treturn previous;\n}\n\n/**\n * Runs a block of code with the provided Lifecycle. Calls to `getLifecycle` within the block will\n * return the specified object.\n * @see {@link getLifecycle}\n */\nexport function withLifecycle<TArgs extends [ arg?: any ], TReturn>(\n\tlifecycle: Lifecycle,\n\tblock: (...args: TArgs) => TReturn,\n\t...args: TArgs\n): TReturn;\n\nexport function withLifecycle(\n\tlifecycle: Lifecycle,\n\tblock: (arg: any) => any,\n\targ: any,\n) {\n\tconst previousLifecycle = $currentLifecycle;\n\t$currentLifecycle = lifecycle;\n\n\ttry {\n\t\treturn block(arg);\n\t}\n\tfinally {\n\t\t$currentLifecycle = previousLifecycle;\n\t}\n}\n","import type { ArgsMax2, Callback, Nil } from \"~/support/types\";\n\nimport type { Lifecycle } from \"./Lifecycle\";\n\n/**\n * A dependency callback of an Atom. The callback will be run whenever the relevant Atom changes.\n */\nexport interface Dependency<TArgs extends ArgsMax2 = ArgsMax2> extends Callback<TArgs> {\n\t/** @internal */\n\t$lifecycle?: Nil<Lifecycle>;\n\n\t/** @internal */\n\t$target?: Nil<DependencyList<TArgs>>;\n\n\t/**\n\t * Previous Dependency within an Atom's dependency list.\n\t * @internal\n\t */\n\t$ap?: Nil<Dependency<TArgs>>;\n\n\t/**\n\t * Next Dependency within an Atom's dependency list.\n\t * @internal\n\t */\n\t$an?: Nil<Dependency<TArgs>>;\n\n\t/**\n\t * Previous Dependency within a Lifecycle's dependency list.\n\t * @internal\n\t */\n\t$lp?: Nil<Dependency>;\n\n\t/**\n\t * Next Dependency within an Lifecycle's dependency list.\n\t * @internal\n\t */\n\t$ln?: Nil<Dependency>;\n}\n\nexport interface DependencyList<TArgs extends ArgsMax2 = ArgsMax2> {\n\t/**\n\t * The head of the dependencies linked list.\n\t * @internal\n\t */\n\t$dh?: Nil<Dependency<TArgs>>;\n\n\t/**\n\t * The tail of the dependencies linked list.\n\t * @internal\n\t */\n\t$dt?: Nil<Dependency<TArgs>>;\n}\n\nexport function bind(lifecycle: Lifecycle, target: DependencyList, block: () => void) {\n\tlink(lifecycle, target, { $fn: block });\n\tblock();\n}\n\n/**\n * Links a Dependency to an Atom and Lifecycle.\n * @internal\n */\nexport function link<TArgs extends ArgsMax2>(lifecycle: Lifecycle, target: DependencyList<TArgs>, dep: Dependency<TArgs>) {\n\t// link to target\n\tif (target.$dt) {\n\t\ttarget.$dt.$an = dep;\n\t\tdep.$ap = target.$dt;\n\t}\n\telse {\n\t\ttarget.$dh = dep;\n\t}\n\n\tdep.$target = target;\n\ttarget.$dt = dep;\n\n\t// link to lifecycle\n\tif (lifecycle.$dt) {\n\t\tlifecycle.$dt.$ln = dep as Dependency;\n\t\tdep.$lp = lifecycle.$dt;\n\t}\n\telse {\n\t\tlifecycle.$dh = dep as Dependency;\n\t}\n\n\tdep.$lifecycle = lifecycle;\n\tlifecycle.$dt = dep as Dependency;\n}\n\n/**\n * Unlinks a Dependency from the Atom and Lifecycle it has been linked to.\n * @internal\n */\nexport function unlink(dep: Dependency) {\n\tconst target = dep.$target;\n\tif (!target) {\n\t\treturn; // already unlinked?\n\t}\n\n\t// unlink from target\n\tif (dep.$ap) {\n\t\tdep.$ap.$an = dep.$an;\n\t}\n\telse if (target.$dh === dep) {\n\t\ttarget.$dh = dep.$an;\n\t}\n\n\tif (dep.$an) {\n\t\tdep.$an.$ap = dep.$ap;\n\t}\n\telse if (target.$dt === dep) {\n\t\ttarget.$dt = dep.$ap;\n\t}\n\n\tdep.$target = null;\n\tdep.$ap = null;\n\tdep.$an = null;\n\n\t// unlink from lifecycle\n\tconst lifecycle = dep.$lifecycle!;\n\tif (dep.$lp) {\n\t\tdep.$lp.$ln = dep.$ln;\n\t}\n\telse if (lifecycle.$dh === dep) {\n\t\tlifecycle.$dh = dep.$ln;\n\t}\n\n\tif (dep.$ln) {\n\t\tdep.$ln.$lp = dep.$lp;\n\t}\n\telse if (lifecycle.$dt === dep) {\n\t\tlifecycle.$dt = dep.$lp;\n\t}\n\n\tdep.$lifecycle = null;\n\tdep.$lp = null;\n\tdep.$ln = null;\n}\n\n/**\n * Unlinks all Dependencies managed by the given Lifecycle.\n * @internal\n */\nexport function unlinkAll(lifecycle: Lifecycle) {\n\tlet dep = lifecycle.$dh;\n\tlet atom;\n\tlet next;\n\n\twhile (dep) {\n\t\tatom = dep.$target!;\n\n\t\tif (dep.$ap) {\n\t\t\tdep.$ap.$an = dep.$an;\n\t\t}\n\t\telse if (atom.$dh === dep) {\n\t\t\tatom.$dh = dep.$an;\n\t\t}\n\n\t\tif (dep.$an) {\n\t\t\tdep.$an.$ap = dep.$ap;\n\t\t}\n\t\telse if (atom.$dt === dep) {\n\t\t\tatom.$dt = dep.$ap;\n\t\t}\n\n\t\tnext = dep.$ln;\n\t\tdep.$lifecycle = null;\n\t\tdep.$target = null;\n\t\tdep.$ap = null;\n\t\tdep.$an = null;\n\t\tdep.$lp = null;\n\t\tdep.$ln = null;\n\t\tdep = next;\n\t}\n\n\tlifecycle.$dh = null;\n\tlifecycle.$dt = null;\n}\n","import { invoke } from \"~/support/common\";\nimport type { ArgsMax2, Callback } from \"~/support/types\";\n\nimport { getLifecycle, type Lifecycle } from \"./Lifecycle\";\n\n/**\n * Manages a queue of scheduled updates.\n * @internal\n */\nexport interface Scheduler {\n\t/**\n\t * Schedules a new tick to execute, unless one is already pending or executing.\n\t */\n\treadonly $scheduleTick: () => void;\n\n\t/**\n\t * Array of pending update callbacks, cleared after each tick.\n\t */\n\treadonly $onTick: UpdateCallback[];\n\n\t/**\n\t * Array of pending end-of-update callbacks, cleared after each tick.\n\t */\n\treadonly $onTock: UpdateCallback[];\n\n\t/**\n\t * Increments with each scheduler tick. Used to deduplicate updates and detect dependency\n\t * cycles.\n\t */\n\t$epoch: number;\n}\n\n/**\n * An update callback that can be scheduled.\n * @see {@link Scheduler}\n * @internal\n */\nexport interface UpdateCallback<TArgs extends ArgsMax2 = ArgsMax2> extends Callback<TArgs> {\n\t/**\n\t * The Lifecycle responsible for this callback.\n\t */\n\t$lifecycle?: Lifecycle;\n\n\t/**\n\t * The life number of the Lifecycle when this callback was scheduled.\n\t */\n\t$life?: number;\n\n\t/**\n\t * Schedule epoch - tracked to prevent scheduling the same callback multiple times within\n\t * the same tick.\n\t */\n\t$se?: number;\n\n\t/**\n\t * Run epoch - only tracked in dev mode to detect dependency loops.\n\t */\n\t$re?: number;\n}\n\n/**\n * A function able to schedule a callback to be executed at a later time, e.g. `queueMicrotask`.\n * The function must guarantee that the callback will be eventually executed.\n */\nexport interface TickFn {\n\t(onTick: () => void): void;\n}\n\n/** @internal */\nexport function createScheduler(tick: TickFn) {\n\tlet isPending = false;\n\n\tconst ticks: UpdateCallback[] = [];\n\tconst tocks: UpdateCallback[] = [];\n\tconst scheduler: Scheduler = {\n\t\t$epoch: 1,\n\t\t$onTick: ticks,\n\t\t$onTock: tocks,\n\t\t$scheduleTick: () => {\n\t\t\tif (isPending) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tisPending = true;\n\t\t\ttick(update);\n\t\t},\n\t};\n\n\tconst update = () => {\n\t\ttry {\n\t\t\tlet index = 0;\n\t\t\tlet callback;\n\n\t\t\t// array lengths are re-read on each cycle, as they may increase when new updates get\n\t\t\t// added by the running code\n\n\t\t\t// run ticks\n\t\t\tfor (; index < ticks.length; index += 1) {\n\t\t\t\tcallback = ticks[index];\n\t\t\t\tif (callback.$life === callback.$lifecycle!.$life) {\n\t\t\t\t\tif (__DEV__) {\n\t\t\t\t\t\tcallback.$re = scheduler.$epoch;\n\t\t\t\t\t}\n\n\t\t\t\t\tinvoke(callback);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// run tocks\n\t\t\tfor (index = 0; index < tocks.length; index += 1) {\n\t\t\t\tcallback = tocks[index];\n\t\t\t\tif (callback.$life === callback.$lifecycle!.$life) {\n\t\t\t\t\tif (__DEV__) {\n\t\t\t\t\t\tcallback.$re = scheduler.$epoch;\n\t\t\t\t\t}\n\n\t\t\t\t\tinvoke(callback);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfinally {\n\t\t\tisPending = false;\n\t\t\tticks.length = 0;\n\t\t\ttocks.length = 0;\n\t\t\tscheduler.$epoch += 1;\n\t\t}\n\t};\n\n\treturn scheduler;\n}\n\nfunction schedule(lifecycle: Lifecycle, queue: UpdateCallback[], callback: UpdateCallback) {\n\tconst scheduler = lifecycle.$scheduler;\n\tif (callback.$se === scheduler.$epoch) {\n\t\tif (__DEV__ && callback.$re === scheduler.$epoch) {\n\t\t\t// if run epoch (::$re) matches, the callback already executed this tick and now is being\n\t\t\t// scheduled again in the same tick -> this is potentially an infinite loop, complain:\n\t\t\tthrow new Error(\"Refusing to re-schedule an update after it already executed, as it may cause an infinite loop. Are you mutating an Atom inside an effect that observes it?\");\n\t\t}\n\n\t\t// if schedule epoch (::$se) matches, the callback was already scheduled -> bail\n\t\treturn;\n\t}\n\n\tcallback.$lifecycle = lifecycle;\n\tcallback.$life = lifecycle.$life;\n\tcallback.$se = scheduler.$epoch;\n\tqueue.push(callback);\n\tscheduler.$scheduleTick();\n}\n\n/** @internal */\nexport function scheduleTick(lifecycle: Lifecycle, callback: UpdateCallback) {\n\tschedule(lifecycle, lifecycle.$scheduler.$onTick, callback);\n}\n\n/**\n * Runs a block of code on the next tick of the scheduler, synchronized with other updates. If a\n * tick is not currently pending, a new one is scheduled.\n */\nexport function tick(block: () => void, lifecycle = getLifecycle()) {\n\tschedule(lifecycle, lifecycle.$scheduler.$onTick, { $fn: block });\n}\n\n/** @internal */\nexport function scheduleTock(lifecycle: Lifecycle, callback: UpdateCallback) {\n\tschedule(lifecycle, lifecycle.$scheduler.$onTock, callback);\n}\n\n/**\n * Runs a block of code after the next tick of the scheduler, once all regular updates finished.\n * If a tick is not currently pending, a new one is scheduled.\n */\nexport function tock(block: () => void, lifecycle = getLifecycle()) {\n\tschedule(lifecycle, lifecycle.$scheduler.$onTock, { $fn: block });\n}\n","import type { Nil } from \"~/support/types\";\n\nimport { getLifecycle, onUnmounted, setLifecycle, type Lifecycle } from \"./Lifecycle\";\nimport { link, unlink, type Dependency, type DependencyList } from \"./Dependency\";\nimport { scheduleTick, type UpdateCallback } from \"./Scheduler\";\n\nexport interface EffectBlock {\n\t(): (() => void) | void;\n}\n\nexport interface Effect<T> {\n\t/** @internal */\n\treadonly $lifecycle: Lifecycle;\n\n\t/** @internal */\n\treadonly $life: number;\n\n\t/** @internal */\n\treadonly $block: () => T;\n\n\t/** @internal */\n\treadonly $react: (effect: this, epoch: number) => void;\n\n\t/**\n\t * Keeps track of the effect run cycle, incrementing on each effect run. Used to detect stale\n\t * dependencies and lazily unlink them.\n\t * @internal\n\t */\n\t$cycle: number;\n\n\t/** @internal */\n\t$deps?: WeakMap<DependencyList, EffectDependency>;\n\n\t/** @internal */\n\t$resolve?: UpdateCallback<[ effect: this ]>;\n\n\t/** @internal */\n\t$dispose?: Nil<() => void>;\n\n\t/** @internal */\n\t$tracksUnmount?: true;\n}\n\n/** @internal */\nexport type EffectDependency = Dependency<[ effect: Effect<any>, epoch: number ]>;\n\n/**\n * Creates an Effect - a block of logic executed each time any of the Atoms accessed within it\n * change. The block is first synchronously executed when the Effect is created.\n *\n * If a teardown callback is returned, it will be run before the next effect re-run, or on component\n * unmount.\n */\nexport function effect(block: EffectBlock, lifecycle = getLifecycle()) {\n\trunEffect({\n\t\t$lifecycle: lifecycle,\n\t\t$life: lifecycle.$life,\n\t\t$block: block,\n\t\t$react: scheduleEffect,\n\t\t$cycle: 0,\n\t});\n}\n\nfunction scheduleEffect(this: EffectDependency, effect: Effect<ReturnType<EffectBlock>>, cycle: number) {\n\t// lazy cleanup: when we get an update from a stale dependency, the reported epoch will be lower\n\t// than our current one (see the reportAccess function). We can unlink and skip the effect.\n\tif (effect.$cycle > cycle) {\n\t\tunlink(this);\n\t\treturn;\n\t}\n\n\t// we're already within a scheduler tick; the effect will therefore run synchronously despite\n\t// being \"scheduled\" - this also gives priority to already scheduled updates and prevents\n\t// potential infinite loops in case dependency cycles exist\n\tscheduleTick(effect.$lifecycle, effect.$resolve ??= {\n\t\t$fn: runEffect,\n\t\t$a0: effect,\n\t});\n}\n\nfunction runEffect(effect: Effect<ReturnType<EffectBlock>>) {\n\t// effect was scheduled in a previous life and is now stale\n\tif (effect.$life !== effect.$lifecycle.$life) {\n\t\treturn;\n\t}\n\n\teffect.$dispose?.();\n\teffect.$dispose = resolve(effect) as Nil<() => void>;\n\n\tif (!effect.$tracksUnmount && effect.$dispose) {\n\t\teffect.$tracksUnmount = true;\n\t\tonUnmounted(effect.$lifecycle, {\n\t\t\t$fn: teardownEffect,\n\t\t\t$a0: effect,\n\t\t});\n\t}\n}\n\nfunction teardownEffect(effect: Effect<ReturnType<EffectBlock>>) {\n\teffect.$dispose?.();\n\teffect.$dispose = null;\n}\n\nlet $currentEffect: Effect<any> | null = null;\n\n/**\n * Resolves an Effect: runs user logic tracking accessed Atoms and updating dependency links.\n * Returned value is forwarded.\n * @internal\n */\nexport function resolve<TEffect extends Effect<any>>(effect: TEffect): TEffect extends Effect<infer T> ? T : unknown {\n\teffect.$deps ??= new WeakMap();\n\teffect.$cycle += 1;\n\n\tconst previousEffect = $currentEffect;\n\tconst previousLifecycle = setLifecycle(effect.$lifecycle);\n\t$currentEffect = effect;\n\n\ttry {\n\t\treturn effect.$block();\n\t}\n\tfinally {\n\t\tsetLifecycle(previousLifecycle);\n\t\t$currentEffect = previousEffect;\n\t}\n}\n\n/**\n * Reports an Atom has been accessed. Does nothing if not within an Effect.\n * @internal\n */\nexport function reportAccess(atom: DependencyList) {\n\tif (!$currentEffect || $currentEffect.$life !== $currentEffect.$lifecycle.$life) {\n\t\treturn;\n\t}\n\n\tlet dep = $currentEffect.$deps!.get(atom);\n\tif (dep) {\n\t\t// refresh dependency to the current epoch\n\t\tdep.$a1 = $currentEffect.$cycle;\n\t\tif (!dep.$lifecycle) {\n\t\t\t// dep has become temporarily stale and got unlinked while still lingering in the\n\t\t\t// $deps WeakMap - that's okay, but must be re-linked now to work again\n\t\t\tlink($currentEffect.$lifecycle, atom, dep);\n\t\t}\n\t}\n\telse {\n\t\tlink($currentEffect.$lifecycle, atom, dep = {\n\t\t\t$fn: $currentEffect.$react,\n\t\t\t$a0: $currentEffect,\n\t\t\t$a1: $currentEffect.$cycle,\n\t\t});\n\n\t\t$currentEffect.$deps!.set(atom, dep);\n\t}\n}\n\n/**\n * Asserts that the current code is not running within an effect block.\n * Only used in development; In production, this function should be removed by the bundler.\n */\nexport function __DEV__assertNotEffect() {\n\tif (\n\t\t$currentEffect &&\n\t\t$currentEffect.$lifecycle === getLifecycle() &&\n\t\t$currentEffect.$life === $currentEffect.$lifecycle.$life\n\t) {\n\t\tthrow new Error(\"Attempt to create an Atom inside an effect block.\");\n\t}\n}\n","import { invoke } from \"~/support/common\";\nimport type { Nil } from \"~/support/types\";\n\nimport { getLifecycle, type Lifecycle } from \"./Lifecycle\";\nimport { __DEV__assertNotEffect, reportAccess } from \"./Effect\";\nimport { scheduleTick, type UpdateCallback } from \"./Scheduler\";\nimport type { DependencyList } from \"./Dependency\";\n\n/**\n * Pyxis Atom type guard marker.\n */\n// @ts-expect-error this is a unique symbol at runtime\nexport const S_ATOM: unique symbol = __DEV__ ? Symbol.for(\"pyxis:atom\") : Symbol();\n\n\n/** Contract for Atoms where they need to be read. */\nexport interface ReadonlyAtom<out T> extends DependencyList {\n\t/** Pyxis Atom type guard marker. */\n\treadonly [S_ATOM]: true;\n\n\t/**\n\t * Gets the value of this Atom. Only use this method when the target is guaranteed to be an\n\t * Atom, otherwise it is recommended to use the `read` or `peek` functions.\n\t *\n\t * This method does *not* report access, thus within effects it is analogous to `peek`.\n\t * @see {@link read}\n\t * @see {@link peek}\n\t */\n\tget: () => T;\n}\n\n/**\n * Holds any single value, managing reactions to its changes. Use the `read`, `write` functions to\n * access its value.\n * @see {@link read}\n * @see {@link write}\n */\nexport interface Atom<T = unknown> extends ReadonlyAtom<T> {\n\t/**\n\t * Sets the value of this Atom. Does nothing if this Atom is readonly. Only use this method when\n\t * the target is guaranteed to be an Atom, otherwise it is recommended to use the `write` or\n\t * `update` functions.\n\t *\n\t * This method does *not* send out any change notifications to observers!\n\t * @returns Boolean indicating whether the value of this Atom changed.\n\t * @see {@link write}\n\t * @see {@link update}\n\t */\n\tset: (value: T) => boolean;\n\n\t/** @internal */\n\treadonly $lifecycle: Lifecycle;\n\n\t/** @internal */\n\treadonly $tracksValue?: boolean;\n\n\t/** @internal */\n\t$lastValue?: T;\n\n\t/** @internal */\n\t$force?: boolean;\n\n\t/**\n\t * The notify callback of this Atom.\n\t * @internal\n\t */\n\t$notify?: UpdateCallback<[ self: Atom<T> ]>;\n\n\t/**\n\t * The ID of this Atom, only present in development mode with transpiler.\n\t * @internal\n\t */\n\t$devId?: string;\n}\n\ninterface DirectAtom<T> extends Atom<any> {\n\t$value: T;\n}\n\n/**\n * Union of the given type or an Atom of that type. Use the `read`, `peek`, `write`, `update` or\n * `isAtom` functions to interact with such values.\n * @see {@link read}\n * @see {@link peek}\n * @see {@link write}\n * @see {@link update}\n * @see {@link isAtom}\n */\nexport type MaybeAtom<T> = Atom<T> | T;\n\n/**\n * Union of the given type or the ReadAtom contract of that type. Use the `read`, `peek` or `isAtom`\n * functions to interact with such values.\n * @see {@link read}\n * @see {@link peek}\n * @see {@link isAtom}\n */\nexport type MaybeReadonlyAtom<T> = ReadonlyAtom<T> | T;\n\n/**\n * Creates an empty Atom; i.e. value set to `undefined`.\n */\nexport function atomOf<T>(): Atom<T | undefined>;\n\n/**\n * Creates an Atom initialized to the provided value. If the provided value is already an Atom, it\n * is returned as-is.\n * @see {@link isAtom}\n */\nexport function atomOf<T>(initialValue: MaybeAtom<T>, lifecycle?: Lifecycle, devId?: string): Atom<T>;\n\nexport function atomOf<T>(initialValue?: MaybeAtom<T>, lifecycle = getLifecycle()) {\n\tif (__DEV__) {\n\t\t__DEV__assertNotEffect();\n\t}\n\n\tif (isAtom(initialValue)) {\n\t\treturn initialValue;\n\t}\n\n\tconst atom: DirectAtom<T> = {\n\t\t[S_ATOM]: true,\n\t\t$value: initialValue as T,\n\t\t$tracksValue: true,\n\t\t$lifecycle: lifecycle,\n\t\t$lastValue: initialValue,\n\t\tget: getValue,\n\t\tset: setValue,\n\t};\n\n\tif (__DEV__) {\n\t\tconst devId = arguments[2];\n\t\tatom.$devId = devId;\n\t\tglobalThis.__PYXIS_HMR__.state.restore(lifecycle, devId, value => {\n\t\t\tatom.$value = value;\n\t\t});\n\t}\n\n\treturn atom;\n}\n\nfunction getValue<T>(this: DirectAtom<T>) {\n\treturn this.$value;\n}\n\nfunction setValue<T>(this: DirectAtom<T>, value: T) {\n\tif (Object.is(this.$value, value)) {\n\t\treturn false;\n\t}\n\n\tthis.$value = value;\n\tif (__DEV__) {\n\t\tglobalThis.__PYXIS_HMR__.state.preserve(this.$lifecycle, this.$devId, value);\n\t}\n\n\treturn true;\n}\n\n/**\n * Atom type guard, checks if the provided input is an Atom.\n */\nexport function isAtom<T = unknown>(input: Nil<MaybeAtom<T>>): input is Atom<T>;\nexport function isAtom<T = unknown>(input: Nil<MaybeReadonlyAtom<T>>): input is ReadonlyAtom<T>;\nexport function isAtom<T = unknown>(input: unknown): input is Atom<T>;\nexport function isAtom(input: unknown): input is Atom<any> {\n\treturn (\n\t\tinput !== null &&\n\t\ttypeof input === \"object\" &&\n\t\t(input as { [S_ATOM]?: true })[S_ATOM] === true\n\t);\n}\n\n/**\n * Checks if the provided input is an Atom and reads its value. Non-atom inputs are returned as-is.\n * Reports read access when inside an effect.\n * @see {@link isAtom}\n * @see {@link write}\n * @see {@link peek}\n * @see {@link update}\n */\nexport function read<A>(input: A): A extends MaybeReadonlyAtom<infer T> ? T : never;\nexport function read<T>(input: MaybeReadonlyAtom<T>) {\n\tif (isAtom<T>(input)) {\n\t\treportAccess(input);\n\t\treturn input.get();\n\t}\n\n\treturn input;\n}\n\n/**\n * Checks if the provided input is an Atom and reads its value. Non-atom inputs are returned as-is.\n * Does NOT report read access when inside an effect.\n * @see {@link isAtom}\n * @see {@link read}\n * @see {@link write}\n * @see {@link update}\n */\nexport function peek<A>(input: A): A extends MaybeReadonlyAtom<infer T> ? T : never;\nexport function peek<T>(input: MaybeReadonlyAtom<T>): T {\n\tif (isAtom<T>(input)) {\n\t\treturn input.get();\n\t}\n\n\treturn input;\n}\n\n/**\n * Checks if the provided input is an Atom, writes its value and returns the new value.\n *\n * Non-atom inputs are never modified in any way. Instead the provided new value is discarded and\n * the input is returned as-is.\n * @see {@link isAtom}\n * @see {@link read}\n * @see {@link write}\n * @see {@link update}\n */\nexport function write<A>(\n\tinput: A,\n\tvalue: A extends Atom<infer T> ? T : never,\n\tforce?: boolean,\n): A extends MaybeAtom<infer T> ? T : never;\n\nexport function write<T>(input: MaybeAtom<T>, value: T, force = false): T {\n\tif (isAtom(input)) {\n\t\tif (input.set(value) || force) {\n\t\t\tinput.$force ||= force;\n\t\t\tscheduleTick(input.$lifecycle, input.$notify ??= {\n\t\t\t\t$fn: notify,\n\t\t\t\t$a0: input,\n\t\t\t});\n\t\t}\n\n\t\treturn input.get();\n\t}\n\n\treturn input;\n}\n\n/**\n * Checks if the provided input is an Atom, updates its value using the provided transform function\n * and returns the new value.\n *\n * Non-atom inputs are never modified in any way and the input is returned as-is.\n * @see {@link isAtom}\n * @see {@link read}\n * @see {@link peek}\n * @see {@link write}\n */\nexport function update<A>(\n\tinput: A,\n\ttransform: A extends Atom<infer T> ? (value: T) => T : never,\n\tforce?: boolean,\n): A extends MaybeAtom<infer T> ? T : never;\n\nexport function update<T>(input: MaybeAtom<T>, transform: (value: T) => T, force = false): T {\n\tif (isAtom(input)) {\n\t\tif (input.set(transform(input.get())) || force) {\n\t\t\tinput.$force ||= force;\n\t\t\tscheduleTick(input.$lifecycle, input.$notify ??= {\n\t\t\t\t$fn: notify,\n\t\t\t\t$a0: input,\n\t\t\t});\n\t\t}\n\n\t\treturn input.get();\n\t}\n\n\treturn input;\n}\n\n/**\n * Notifies the dependencies of an Atom.\n * @internal\n */\nexport function notify<T>(input: Atom<T>) {\n\t// optimization: when Atom changes multiple times within a single update and ends up with the\n\t// same value it started with, the notification can be skipped\n\tif (input.$tracksValue) {\n\t\tconst newValue = input.get();\n\t\tif (Object.is(input.$lastValue, newValue) && !input.$force) {\n\t\t\treturn;\n\t\t}\n\n\t\tinput.$lastValue = newValue;\n\t}\n\n\tinput.$force = false;\n\n\tlet current = input.$dh;\n\tlet next;\n\twhile (current) {\n\t\tnext = current.$an;\n\t\tinvoke(current);\n\t\tcurrent = next;\n\t}\n}\n","import { isAtom } from \"~/data/Atom\";\nimport { bind } from \"~/data/Dependency\";\nimport type { JsxText } from \"~/Component\";\nimport { insert, type HNode } from \"~/Renderer\";\n\nexport function Text<TNode>(\n\tjsx: NonNullable<JsxText>,\n\thParent: HNode<TNode>,\n\tnUsedParent: TNode,\n\t_nRealParent: TNode,\n\tnBefore: TNode | null,\n\tisBatch: boolean,\n) {\n\tconst { adapter } = hParent.$ng;\n\tlet node: TNode | null = null;\n\n\tif (isAtom(jsx)) {\n\t\tbind(hParent.$ng, jsx, () => {\n\t\t\tnode = adapter.text(jsx.get()?.toString() ?? \"\", node);\n\t\t});\n\t}\n\telse {\n\t\t// static nil values are already filtered out by Renderer, never passed to this component\n\t\tnode = adapter.text(jsx.toString(), null);\n\t}\n\n\tinsert(node!, null, hParent, nUsedParent, nBefore, isBatch);\n}\n","import type { Nil } from \"~/support/types\";\n\nimport { notify, S_ATOM, type Atom } from \"./Atom\";\nimport { link, unlink, type Dependency } from \"./Dependency\";\nimport { __DEV__assertNotEffect } from \"./Effect\";\nimport { getLifecycle } from \"./Lifecycle\";\n\n/**\n * Describes a Context distributing data throughout the Component hierarchy.\n * @see {@link createContext}\n */\nexport interface Context<T> {\n\t/** @internal */\n\treadonly $symbol: symbol;\n\n\t/**\n\t * A fake property kept for TypeScript to properly type-check Context compatibility.\n\t * @deprecated **Type only, does not exist at runtime!**\n\t */\n\treadonly $contract?: (value: T) => void;\n}\n\n/**\n * Creates a typed Context that can be used to propagate observable data throughout entire component\n * trees without \"prop drilling.\"\n * @see {@link context}\n */\nexport function createContext<T>(devId?: string): Context<T>;\n\nexport function createContext<T>(): Context<T> {\n\tlet $symbol = Symbol();\n\tif (__DEV__) {\n\t\tconst devId = arguments[0];\n\t\t$symbol = globalThis.__PYXIS_HMR__.state.restore(createContext, devId) ?? $symbol;\n\t\tglobalThis.__PYXIS_HMR__.state.preserve(createContext, devId, $symbol);\n\t}\n\n\treturn { $symbol };\n}\n\n\n/** @internal */\nexport interface ContextContainer {\n\t[key: symbol]: unknown;\n\treadonly $parent?: Nil<ContextContainer>;\n}\n\nlet $currentContainer: ContextContainer | undefined;\nlet $isNewContainer = false;\n\n/** @internal */\nexport function getContextContainer() {\n\treturn $currentContainer;\n}\n\n/** @internal */\nexport function setContextContainer(container: ContextContainer | undefined) {\n\t$currentContainer = container;\n\t$isNewContainer = false;\n}\n\n\ninterface ContextAtom<T> extends Atom<T> {\n\t$dep?: Nil<Dependency>;\n\t$ancestor?: Nil<Atom<T>>;\n\t$value?: T;\n}\n\n/**\n * Gets a consumer Atom for the given Context. This atom will be read-only.\n * @see {@link host}\n */\nexport function consumerOf<T>(context: Context<T>): Atom<T> | null {\n\tif (__DEV__) {\n\t\t__DEV__assertNotEffect();\n\t}\n\n\tconst { $symbol } = context;\n\tlet ptr: Nil<ContextContainer> = $currentContainer;\n\tlet atom;\n\twhile (ptr && !(atom = ptr[$symbol] as Atom<T> | undefined)) {\n\t\tptr = ptr.$parent;\n\t}\n\n\treturn atom ?? null;\n}\n\n/**\n * Marks the current component as a host for the given context. Returns a mutable ContextAtom;\n * Values written to it will be propagated to any descendant component that consumes the context via\n * `consumerOf(context)`.\n * @see {@link consumerOf}\n */\nexport function host<T>(context: Context<T>, defaultValue?: T, devId?: string): ContextAtom<T>;\n\nexport function host<T>(context: Context<T>, defaultValue?: T) {\n\tif (__DEV__) {\n\t\t__DEV__assertNotEffect();\n\t}\n\n\tif (!$isNewContainer || !$currentContainer) {\n\t\t// split context, current component becomes a host\n\t\t$isNewContainer = true;\n\t\t$currentContainer = {\n\t\t\t$parent: $currentContainer,\n\t\t};\n\t}\n\n\tconst lifecycle = getLifecycle();\n\tif (__DEV__) {\n\t\tconst devId = arguments[2];\n\t\tglobalThis.__PYXIS_HMR__.state.restore(lifecycle, devId, value => {\n\t\t\tdefaultValue = value;\n\t\t});\n\t}\n\n\tconst localAtom: ContextAtom<T> = {\n\t\t[S_ATOM]: true,\n\t\t$lifecycle: lifecycle,\n\t\t$tracksValue: true,\n\t\t$value: defaultValue,\n\t\tget: getLocalValue,\n\t\tset: setValue,\n\t};\n\n\tif (defaultValue === undefined) {\n\t\tconst ancestorAtom = consumerOf(context);\n\t\tif (ancestorAtom) {\n\t\t\tlocalAtom.get = getAncestorValue;\n\t\t\tlocalAtom.$ancestor = ancestorAtom;\n\t\t\tlink(lifecycle, ancestorAtom, localAtom.$dep = {\n\t\t\t\t$fn: notify<T>,\n\t\t\t\t$a0: localAtom,\n\t\t\t});\n\t\t}\n\t}\n\n\tif (__DEV__) {\n\t\tlocalAtom.$devId = arguments[2];\n\t\tif (Object.hasOwn($currentContainer, context.$symbol)) {\n\t\t\tthrow new Error(\"Component declares multiple hosts of the same Context.\");\n\t\t}\n\t}\n\n\t$currentContainer[context.$symbol] = localAtom;\n\treturn localAtom;\n}\n\nfunction getAncestorValue<T>(this: ContextAtom<T>) {\n\treturn this.$ancestor!.get();\n}\n\nfunction getLocalValue<T>(this: ContextAtom<T>) {\n\treturn this.$value!;\n}\n\nfunction setValue<T>(this: ContextAtom<T>, value: T) {\n\tlet oldValue;\n\tif (this.$ancestor) {\n\t\toldValue = this.$ancestor.get();\n\t\tunlink(this.$dep!);\n\t\tthis.$dep = null;\n\t\tthis.$ancestor = null;\n\t\tthis.get = getLocalValue;\n\t}\n\telse {\n\t\toldValue = this.$value;\n\t}\n\n\tthis.$value = value;\n\tif (__DEV__) {\n\t\tglobalThis.__PYXIS_HMR__.state.preserve(this.$lifecycle, this.$devId, value);\n\t}\n\n\treturn !Object.is(oldValue, value);\n}\n","import { Text } from \"~/component/Text\";\nimport { isAtom } from \"~/data/Atom\";\nimport { getContextContainer, setContextContainer, type ContextContainer } from \"~/data/Context\";\nimport { setLifecycle, type Lifecycle } from \"~/data/Lifecycle\";\nimport { createScheduler } from \"~/data/Scheduler\";\nimport type { ElementsType, Mutable, Nil } from \"~/support/types\";\n\nimport type { Adapter, ExtensionsType } from \"./Adapter\";\nimport type { ComponentHandler, JsxResult } from \"./Component\";\nimport { invoke } from \"./support/common\";\nimport { unlinkAll } from \"./data/Dependency\";\n\n/** @internal */\n// @ts-expect-error this is a unique symbol at runtime\nexport const S_COMPONENT: unique symbol = __DEV__ ? Symbol.for(\"pyxis:component\") : Symbol();\n\nexport interface Renderer<TNode, TIntrinsicElements extends ElementsType = ElementsType> {\n\t/**\n\t * Carries information about the available intrinsic elements when using this Renderer.\n\t * @deprecated **Type only, does not exist at runtime!**\n\t */\n\treadonly $elements?: TIntrinsicElements;\n\n\tmount: (root: TNode, jsx: JsxResult) => void;\n\tunmount: () => void;\n}\n\nexport type ElementsOf<TRenderer> = TRenderer extends { readonly $elements?: infer TElements }\n\t? TElements\n\t: {};\n\n\nexport interface MountingGroup<TNode> extends Lifecycle, Hierarchy<TNode> {\n\treadonly $isGroup: true;\n\treadonly $isNative?: never;\n\n\t/** the Adapter rendering this MountingGroup */\n\treadonly adapter: Adapter<TNode>;\n\n\t/** @internal */\n\treadonly $extensions: ExtensionsType<TNode>;\n\n\t/** @internal */\n\treadonly $context?: ContextContainer;\n}\n\nexport interface NativeNode<TNode> extends Hierarchy<TNode> {\n\treadonly $isNative: true;\n\treadonly $isGroup?: never;\n\treadonly $nn: TNode;\n}\n\nexport interface Hierarchy<TNode> {\n\t/** @internal */\n\treadonly $isGroup?: true;\n\n\t/** @internal */\n\treadonly $isNative?: true;\n\n\t/**\n\t * the nearest mounting group - can be self\n\t * @internal\n\t */\n\treadonly $ng: MountingGroup<TNode>;\n\n\t/**\n\t * the nearest *ancestor* group this node belongs to\n\t * @internal\n\t */\n\treadonly $pg: MountingGroup<TNode> | null;\n\n\t/**\n\t * the nearest native node (ancestor or self) - on groups, this is only present in dev mode\n\t * @internal\n\t */\n\treadonly $nn?: TNode;\n\n\t/**\n\t * the first child of this h-node\n\t * @internal\n\t */\n\t$hh?: Nil<HNode<TNode>>;\n\n\t/**\n\t * the last child of this h-node\n\t * @internal\n\t */\n\t$ht?: Nil<HNode<TNode>>;\n\n\t/**\n\t * the previous sibling of this h-node\n\t * @internal\n\t */\n\t$hp?: Nil<HNode<TNode>>;\n\n\t/**\n\t * the next sibling of this h-node\n\t * @internal\n\t */\n\t$hn?: Nil<HNode<TNode>>;\n}\n\nexport type HNode<TNode> =\n\t| MountingGroup<TNode>\n\t| NativeNode<TNode>;\n\n\n/** @internal */\nexport function createRenderer<TNode, TIntrinsicElements extends ElementsType>(\n\tadapter: Adapter<TNode>,\n\textensions: ExtensionsType<TNode>,\n): Renderer<TNode, TIntrinsicElements> {\n\tconst hGroup: Mutable<MountingGroup<TNode> & Renderer<TNode, TIntrinsicElements>> = {\n\t\tadapter: adapter,\n\t\tmounted: false,\n\t\t$isGroup: true,\n\t\t$scheduler: createScheduler(adapter.tick),\n\t\t$extensions: extensions,\n\t\t$life: 1,\n\t\t$pg: null,\n\t\t$ng: null!,\n\t\tunmount: () => unmount(hGroup),\n\t\tmount: (nRoot, jsx) => {\n\t\t\tif (__DEV__) {\n\t\t\t\thGroup.$nn = nRoot;\n\t\t\t}\n\n\t\t\tconst isBatch = Boolean(adapter.batch);\n\t\t\tconst nParent = isBatch ? adapter.batch!() : nRoot;\n\t\t\tmount(jsx, hGroup, nParent, nRoot, null, isBatch);\n\t\t\tif (isBatch) {\n\t\t\t\tadapter.insert(nParent, nRoot, null);\n\t\t\t}\n\t\t},\n\t};\n\n\thGroup.$ng = hGroup;\n\tif (__DEV__) {\n\t\tglobalThis.__PYXIS_ROOT__ ??= hGroup;\n\t}\n\n\treturn hGroup;\n}\n\n/**\n * Creates a sub-group within the provided MountingGroup. Needed whenever a subtree needs to mount\n * or unmount dynamically.\n */\nexport function fork<TNode>(\n\thParent: HNode<TNode>,\n\thBefore: HNode<TNode> | null = null,\n): MountingGroup<TNode> {\n\tconst ng = hParent.$ng;\n\tconst hGroup: Mutable<MountingGroup<TNode>> = {\n\t\tadapter: ng.adapter,\n\t\tmounted: false,\n\t\t$isGroup: true,\n\t\t$scheduler: ng.$scheduler,\n\t\t$extensions: ng.$extensions,\n\t\t$life: 1,\n\t\t$context: getContextContainer(),\n\t\t$pg: ng,\n\t\t$ng: null!,\n\t};\n\n\thGroup.$ng = hGroup;\n\tif (__DEV__) {\n\t\thGroup.$nn = hParent.$nn;\n\t}\n\n\ttrack(hGroup, hParent, hBefore);\n\treturn hGroup;\n}\n\n/**\n * Adds a HNode to the hierarchy.\n */\nexport function track<TNode>(\n\thNode: HNode<TNode>,\n\thParent: HNode<TNode>,\n\thBefore: HNode<TNode> | null = null,\n) {\n\t// insert into hierarchy before given sibling\n\tif (hBefore?.$pg === hParent) {\n\t\tif (hBefore.$hp) {\n\t\t\thNode.$hp = hBefore.$hp;\n\t\t\thNode.$hn = hBefore;\n\t\t\thBefore.$hp.$hn = hNode;\n\t\t\thBefore.$hp = hNode;\n\t\t}\n\t\telse {\n\t\t\thNode.$hp = null;\n\t\t\thNode.$hn = hParent.$hh;\n\t\t\tif (hParent.$hh === hBefore) {\n\t\t\t\t// this should always run: since before has no previous sibling, it must be at the\n\t\t\t\t// head, otherwise the hierarchy is malformed and bad things will happen...\n\t\t\t\thBefore.$hp = hNode;\n\t\t\t}\n\n\t\t\thParent.$hh = hNode;\n\t\t}\n\t}\n\t// append at the tail of the hierarchy\n\telse {\n\t\tif (hParent.$ht) {\n\t\t\thParent.$ht.$hn = hNode;\n\t\t\thNode.$hp = hParent.$ht;\n\t\t}\n\t\telse {\n\t\t\thParent.$hh = hNode;\n\t\t}\n\n\t\thParent.$ht = hNode;\n\t}\n}\n\n/**\n * Removes a HNode from the tracking hierarchy.\n */\nexport function untrack<TNode>(hNode: HNode<TNode>) {\n\tif (hNode.$hp) {\n\t\thNode.$hp.$hn = hNode.$hn;\n\t}\n\telse if (hNode.$pg?.$hh === hNode) {\n\t\thNode.$pg.$hh = hNode.$hn;\n\t}\n\n\tif (hNode.$hn) {\n\t\thNode.$hn.$hp = hNode.$hp;\n\t}\n\telse if (hNode.$pg?.$ht === hNode) {\n\t\thNode.$pg.$ht = hNode.$hp;\n\t}\n\n\thNode.$hp = null;\n\thNode.$hn = null;\n}\n\n/**\n * Mounts a MountingGroup to the specified location in the node tree. If the group is already\n * mounted (i.e. its native nodes are already rendered somewhere), it is moved to the new location\n * without re-mounting Pyxis components.\n *\n * Note that for successfully moving a group within the tree, you should first `untrack` the group,\n * then re-`track` it to the new location and only then call `mount` to commit the move.\n * @see {@link track}\n * @see {@link untrack}\n */\nexport function mount<TNode>(\n\tjsx: any,\n\thGroup: MountingGroup<TNode>,\n\tnUsedParent: TNode,\n\tnRealParent: TNode,\n\tnBefore: TNode | null,\n\tisBatch: boolean,\n) {\n\tif (hGroup.mounted) {\n\t\treinsertNodes(hGroup, nUsedParent, nBefore);\n\t\treturn;\n\t}\n\n\tconst previousLifecycle = setLifecycle(hGroup);\n\tsetContextContainer(hGroup.$context);\n\ttry {\n\t\tmountJsx(jsx, hGroup, nUsedParent, nRealParent, nBefore, isBatch);\n\t}\n\tfinally {\n\t\tsetLifecycle(previousLifecycle);\n\t\thGroup.mounted = true;\n\n\t\t// only dispatch mount notifications when the parent group is already mounted, or if this is the\n\t\t// top-level group - otherwise, mount notification will arrive once the parent mounts\n\t\tif (hGroup.$pg?.mounted !== false) {\n\t\t\tnotifyMounted(hGroup);\n\t\t}\n\t}\n}\n\n/**\n * Only used by `mount`, do not call directly.\n *\n * Recursively (dept-first) runs components' `mounted` callbacks.\n * @see {@link mount}\n * @internal\n */\nfunction notifyMounted<TNode>(hNode: HNode<TNode>) {\n\tlet current = hNode.$hh;\n\twhile (current) {\n\t\tnotifyMounted(current);\n\t\tcurrent = current.$hn;\n\t}\n\n\tlet callbacks;\n\tif (hNode.$isGroup && hNode.mounted && (callbacks = hNode.$onMount)) {\n\t\tconst previousLifecycle = setLifecycle(hNode);\n\t\ttry {\n\t\t\tcallbacks.forEach(invoke);\n\t\t}\n\t\tfinally {\n\t\t\tcallbacks.length = 0;\n\t\t\tsetLifecycle(previousLifecycle);\n\t\t}\n\t}\n}\n\n/**\n * Only used by `mount`, do not call directly.\n *\n * Re-inserts native nodes of the given group to the specified location in the native tree. Only\n * moves the uppermost nodes - any children should move implicitly with them.\n * @see {@link mount}\n * @internal\n */\nfunction reinsertNodes<TNode>(hGroup: MountingGroup<TNode>, nParent: TNode, nBefore: TNode | null) {\n\tconst { adapter } = hGroup;\n\n\tlet current = hGroup.$hh;\n\twhile (current) {\n\t\tif (current.$isNative) {\n\t\t\tadapter.insert(current.$nn, nParent, nBefore);\n\t\t\t// no need to recurse, group is already mounted, so any sub-groups within this native\n\t\t\t// node have been already moved with it\n\t\t}\n\t\telse {\n\t\t\treinsertNodes(current, nParent, nBefore);\n\t\t}\n\n\t\tcurrent = current.$hn;\n\t}\n}\n\n/**\n * Unmounts the contents of a MountingGroup from the node tree. The group itself, though empty,\n * remains usable and can be remounted later.\n */\nexport function unmount<TNode>(group: MountingGroup<TNode>): void;\n\n/** @internal */\nexport function unmount<TNode>(hNode: HNode<TNode>, top?: boolean): void;\nexport function unmount<TNode>(hNode: HNode<TNode>, top: boolean = true) {\n\tif (hNode.$isGroup) {\n\t\tif (hNode.mounted) {\n\t\t\tlet callbacks;\n\t\t\tif (callbacks = hNode.$onUnmount) {\n\t\t\t\tconst previousLifecycle = setLifecycle(hNode);\n\t\t\t\ttry {\n\t\t\t\t\tcallbacks.forEach(invoke);\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\tcallbacks.length = 0;\n\t\t\t\t\tsetLifecycle(previousLifecycle);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\thNode.mounted = false;\n\t\t\thNode.$life += 1;\n\t\t}\n\n\t\t// unmounted groups shouldn't have anything to unlink, but a zombie dependency can have\n\t\t// catastrophic consequences, so...\n\t\tunlinkAll(hNode);\n\t}\n\n\tconst { adapter } = hNode.$ng;\n\tlet current = hNode.$hh;\n\tlet next;\n\n\twhile (current) {\n\t\tif (current.$isNative && top) {\n\t\t\tadapter.remove(current.$nn);\n\t\t\tunmount(current, false);\n\t\t}\n\t\telse {\n\t\t\tunmount(current, top);\n\t\t}\n\n\t\tnext = current.$hn;\n\t\tcurrent.$hp = null;\n\t\tcurrent.$hn = null;\n\t\tcurrent = next;\n\t}\n\n\thNode.$hh = null;\n\thNode.$ht = null;\n}\n\n/**\n * Mounts components described by the JsxResult to the specified location in the node tree.\n */\nexport function mountJsx<TNode>(\n\tjsx: any,\n\thParent: HNode<TNode>,\n\tnUsedParent: TNode,\n\tnRealParent: TNode,\n\tnBefore: TNode | null,\n\tisBatch: boolean,\n) {\n\tswitch (typeof jsx) {\n\t\tcase \"object\":\n\t\t\tif (jsx === null) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (Array.isArray(jsx)) {\n\t\t\t\tconst { length } = jsx;\n\t\t\t\tlet index = 0;\n\t\t\t\tfor (; index < length; index += 1) {\n\t\t\t\t\tmountJsx(jsx[index], hParent, nUsedParent, nRealParent, nBefore, isBatch);\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (!isAtom(jsx)) {\n\t\t\t\t(jsx[S_COMPONENT] as ComponentHandler | undefined)\n\t\t\t\t\t?.(jsx, hParent, nUsedParent, nRealParent, nBefore, isBatch);\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// fall through\n\n\t\tcase \"string\":\n\t\tcase \"number\":\n\t\tcase \"boolean\":\n\t\tcase \"bigint\":\n\t\t\tText(jsx, hParent, nUsedParent, nRealParent, nBefore, isBatch);\n\t\t\tbreak;\n\t}\n}\n\n/**\n * Inserts a native node and adds it to the tracking hierarchy. Necessary to preserve render order.\n * Should only be called by component handlers!\n */\nexport function insert<TNode>(\n\tnNode: TNode,\n\tchildren: any,\n\thParent: HNode<TNode>,\n\tnUsedParent: TNode,\n\tnBefore: TNode | null,\n\tisBatch: boolean,\n) {\n\tlet hNative = hParent;\n\tif (hNative.$isGroup) {\n\t\t// parent is a group, so this is its top-level node -> find insertion point\n\t\tlet hBefore = null;\n\t\tif (nBefore) {\n\t\t\tlet current = hParent.$ht;\n\t\t\twhile (current) {\n\t\t\t\tif (current.$isNative && current.$nn === nBefore) {\n\t\t\t\t\thBefore = current;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcurrent = current.$hp;\n\t\t\t}\n\t\t}\n\n\t\ttrack(hNative = {\n\t\t\t$isNative: true,\n\t\t\t$pg: hNative,\n\t\t\t$ng: hNative,\n\t\t\t$nn: nNode,\n\t\t}, hParent, hBefore);\n\t}\n\n\tmountJsx(children, hNative, nNode, nNode, null, isBatch);\n\thParent.$ng.adapter.insert(nNode, nUsedParent, nBefore);\n}\n","import type { Nil } from \"~/support/types\";\nimport type { JsxObject, JsxProps, JsxResult } from \"~/Component\";\nimport { mountJsx, type HNode } from \"~/Renderer\";\n\n// FUTURE: currently TypeScript has a bug causing it to skip checking fragment props in \"react-jsx\" mode\n// allowing users to supply fragment with invalid children\n// https://github.com/microsoft/TypeScript/issues/62358\n\nexport interface FragmentProps {\n\tchildren?: Nil<JsxResult>[];\n}\n\n/**\n * The built-in Fragment Component wrapping multiple Components.\n */\n// @ts-expect-error fake overload to enable use with JSX\nexport function Fragment(props: JsxProps<FragmentProps>): JsxResult;\n\nexport function Fragment<TNode>(\n\tjsx: JsxObject,\n\thParent: HNode<TNode>,\n\tnUsedParent: TNode,\n\tnRealParent: TNode,\n\tnBefore: TNode | null,\n\tisBatch: boolean,\n) {\n\tmountJsx(jsx.children, hParent, nUsedParent, nRealParent, nBefore, isBatch);\n}\n","// The Myers diff algorithm is adapted from the implementation by Logan R. Kearsley, MIT license.\n// https://github.com/gliese1337/fast-myers-diff\n//\n//\n// Copyright 2021 Logan R. Kearsley\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and\n// associated documentation files (the \"Software\"), to deal in the Software without restriction,\n// including without limitation the rights to use, copy, modify, merge, publish, distribute,\n// sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all copies or\n// substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT\n// NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n/** @internal */\nexport const LC_CHANGE = 1;\n\n/** @internal */\nexport const LC_INSERT = 2;\n\n/** @internal */\nexport const LC_REMOVE = 3;\n\n/** @internal */\nexport const LC_CLEAR = 4;\n\nexport enum ChangeKind {\n\tChange = LC_CHANGE,\n\tInsert = LC_INSERT,\n\tRemove = LC_REMOVE,\n\tClear = LC_CLEAR,\n}\n\nexport interface ListDelta<T> {\n\treadonly changes: ListChange<T>[];\n\tlengthChange: number;\n}\n\nexport type ListChange<T> =\n\t| ListItemChanged<T>\n\t| ListItemInserted<T>\n\t| ListItemRemoved<T>\n\t| ListCleared;\n\nexport interface ListItemChanged<T> {\n\tkind: ChangeKind.Change;\n\tindex: number;\n\toldItem: T;\n\tnewItem: T;\n}\n\nexport interface ListItemInserted<T> {\n\tkind: ChangeKind.Insert;\n\tindex: number;\n\tnewItem: T;\n}\n\nexport interface ListItemRemoved<T> {\n\tkind: ChangeKind.Remove;\n\tindex: number;\n\toldItem: T;\n}\n\nexport interface ListCleared {\n\tkind: ChangeKind.Clear;\n\tindex: number;\n}\n\nexport interface Equals<T> {\n\t(item0: T, item1: T): boolean;\n}\n\ninterface DiffState<T> {\n\treadonly $eq: Equals<T>;\n\treadonly $list0: readonly T[];\n\treadonly $list1: readonly T[];\n\t$index0: number;\n\t$index1: number;\n\t$N: number;\n\t$M: number;\n\t$Z: number;\n\t$c: number;\n\treadonly $buffer: Uint8Array | Uint16Array | Uint32Array;\n\treadonly $stack: number[];\n\t$stackTop: number;\n\t$pxs: number;\n\t$pxe: number;\n\t$pys: number;\n\t$pye: number;\n\t$oxs: number;\n\t$oxe: number;\n\t$oys: number;\n\t$oye: number;\n}\n\n\n/** @internal */\nexport const EMPTY_DELTA: ListDelta<any> = {\n\tchanges: [],\n\tlengthChange: 0,\n};\n\n/** @internal */\nexport function createDelta<T>(): ListDelta<T> {\n\treturn {\n\t\tchanges: [],\n\t\tlengthChange: 0,\n\t};\n}\n\n/** @internal */\nexport function itemChanged<T>({ changes: $changes }: ListDelta<T>, at: number, oldItem: T, newItem: T) {\n\tconst ci = binarySearch($changes, at, latest);\n\tif (ci < 0) {\n\t\t// nothing at this index, add new delta\n\t\t$changes.splice(~ci, 0, {\n\t\t\tkind: LC_CHANGE,\n\t\t\tindex: at,\n\t\t\toldItem,\n\t\t\tnewItem,\n\t\t});\n\t}\n\telse {\n\t\t// delta(s) exist at this index already, there can only be:\n\t\t// - change -> change item\n\t\t// - insert -> change item\n\t\t// - remove -> append change\n\t\tconst current = $changes[ci];\n\t\tswitch (current.kind) {\n\t\t\tcase LC_CHANGE:\n\t\t\tcase LC_INSERT:\n\t\t\t\tcurrent.newItem = newItem;\n\t\t\t\tbreak;\n\n\t\t\tcase LC_REMOVE:\n\t\t\t\t$changes.splice(ci + 1, 0, {\n\t\t\t\t\tkind: LC_CHANGE,\n\t\t\t\t\tindex: at,\n\t\t\t\t\toldItem,\n\t\t\t\t\tnewItem,\n\t\t\t\t});\n\n\t\t\t\tbreak;\n\t\t}\n\t}\n}\n\n/** @internal */\nexport function itemInserted<T>(delta: ListDelta<T>, at: number, item: T) {\n\tconst { changes: $changes } = delta;\n\n\tlet ci = binarySearch($changes, at, earliest);\n\tif (ci < 0) {\n\t\t// nothing at this index, add new delta\n\t\tci = ~ci;\n\t\t$changes.splice(ci, 0, {\n\t\t\tkind: LC_INSERT,\n\t\t\tindex: at,\n\t\t\tnewItem: item,\n\t\t});\n\t}\n\telse {\n\t\t// delta(s) exist at this index already, there can only be:\n\t\t// - change -> prepend with insert\n\t\t// - insert -> prepend another (new item before, existing get shifted right)\n\t\t// - remove -> replace with change\n\t\tconst current = $changes[ci];\n\t\tswitch (current.kind) {\n\t\t\tcase LC_CHANGE:\n\t\t\tcase LC_INSERT:\n\t\t\t\t$changes.splice(ci, 0, {\n\t\t\t\t\tkind: LC_INSERT,\n\t\t\t\t\tindex: at,\n\t\t\t\t\tnewItem: item,\n\t\t\t\t});\n\n\t\t\t\tbreak;\n\n\t\t\tcase LC_REMOVE:\n\t\t\t\t// insert cancels the removal -> the slot's old item is now replaced, becomes a change\n\t\t\t\t// (oldItem carries over from the removal, it's the item that was originally here)\n\t\t\t\t(current as unknown as ListItemChanged<T>).kind = LC_CHANGE;\n\t\t\t\t(current as unknown as ListItemChanged<T>).newItem = item;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\t// shift the indices of later changes\n\tconst { length } = $changes;\n\twhile (++ci < length) {\n\t\t$changes[ci].index += 1;\n\t}\n\n\t// update the overall change in list length\n\tdelta.lengthChange += 1;\n}\n\n/** @internal */\nexport function itemRemoved<T>(delta: ListDelta<T>, at: number, item: T) {\n\tconst { changes: $changes } = delta;\n\n\tlet ci = binarySearch($changes, at, latest);\n\tif (ci < 0) {\n\t\t// nothing at this index, add new delta\n\t\tci = ~ci;\n\t\t$changes.splice(ci, 0, {\n\t\t\tkind: LC_REMOVE,\n\t\t\tindex: at,\n\t\t\toldItem: item,\n\t\t});\n\t}\n\telse {\n\t\t// delta(s) exist at this index already, there can only be:\n\t\t// - change -> replace with removal\n\t\t// - insert -> remove it\n\t\t// - remove -> append another\n\t\tconst current = $changes[ci];\n\t\tswitch (current.kind) {\n\t\t\tcase LC_CHANGE:\n\t\t\t\t// removal cancels the change -> becomes a plain removal (oldItem carries over from\n\t\t\t\t// the change, it's the item originally at this index)\n\t\t\t\t(current as unknown as ListItemRemoved<T>).kind = LC_REMOVE;\n\t\t\t\t(current as unknown as ListItemChanged<undefined>).newItem = undefined;\n\t\t\t\tbreak;\n\n\t\t\tcase LC_INSERT:\n\t\t\t\t// canceling the insert shifts subsequent entries left so they must be re-indexed\n\t\t\t\t// -> adjust `ci` to start from the correct offset\n\t\t\t\t$changes.splice(ci--, 1);\n\t\t\t\tbreak;\n\n\t\t\tcase LC_REMOVE:\n\t\t\t\t$changes.splice(++ci, 0, {\n\t\t\t\t\tkind: LC_REMOVE,\n\t\t\t\t\tindex: at,\n\t\t\t\t\toldItem: item,\n\t\t\t\t});\n\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\t// shift the indices of later changes\n\tconst { length } = $changes;\n\twhile (++ci < length) {\n\t\t$changes[ci].index -= 1;\n\t}\n\n\t// update the overall change in list length\n\tdelta.lengthChange -= 1;\n}\n\n/** @internal */\nexport function listCleared<T>(delta: ListDelta<T>, count: number) {\n\tconst { changes: $changes } = delta;\n\t$changes.length = 0;\n\t$changes.push({\n\t\tkind: LC_CLEAR,\n\t\tindex: -1,\n\t});\n\n\tdelta.lengthChange -= count;\n}\n\n/** @internal */\nexport function listSynced<T>(delta: ListDelta<T>, oldState: readonly T[], newState: readonly T[], eq: Equals<T>) {\n\tlet index = 0;\n\tlet N = oldState.length;\n\tlet M = newState.length;\n\n\t// eliminate common prefix\n\twhile (index < N && index < M && eq(oldState[index], newState[index])) {\n\t\tindex += 1;\n\t}\n\n\t// check for list equality\n\tif (index === N && index === M) {\n\t\treturn;\n\t}\n\n\t// eliminate common suffix\n\twhile (N > index && M > index && eq(oldState[N - 1], newState[M - 1])) {\n\t\tN -= 1;\n\t\tM -= 1;\n\t}\n\n\t// run Myers diff on the smallest possible sub-lists\n\tconst Z = (Math.min(N, M) + 1) * 2;\n\tconst L = N + M;\n\tconst state: DiffState<T> = {\n\t\t$eq: eq,\n\t\t$list0: oldState,\n\t\t$list1: newState,\n\t\t$index0: index,\n\t\t$index1: index,\n\t\t$N: N,\n\t\t$M: M,\n\t\t$Z: Z,\n\t\t$c: 0,\n\t\t$buffer: new (L <= 0xff ? Uint8Array : L <= 0xffff ? Uint16Array : Uint32Array)(Z + Z),\n\t\t$stack: [],\n\t\t$stackTop: 0,\n\t\t$pxs: -1,\n\t\t$pxe: -1,\n\t\t$pys: -1,\n\t\t$pye: -1,\n\t\t$oxs: -1,\n\t\t$oxe: -1,\n\t\t$oys: -1,\n\t\t$oye: -1,\n\t};\n\n\tlet offset = 0;\n\tlet rs, re, is, ie, r, i;\n\tdo {\n\t\tmyersDiff(state);\n\t\tif (state.$c === 1) {\n\t\t\trs = state.$oxs;\n\t\t\tre = state.$oxe;\n\t\t\tis = state.$oys;\n\t\t\tie = state.$oye;\n\t\t}\n\t\telse if (state.$pxs >= 0) {\n\t\t\trs = state.$pxs;\n\t\t\tre = state.$pxe;\n\t\t\tis = state.$pys;\n\t\t\tie = state.$pye;\n\t\t}\n\t\telse {\n\t\t\tbreak;\n\t\t}\n\n\t\tfor (r = rs; r < re; r += 1) {\n\t\t\titemRemoved(delta, rs + offset, oldState[r]); // TODO: verify this\n\t\t}\n\n\t\tfor (i = is; i < ie; i += 1) {\n\t\t\titemInserted(delta, rs + offset, newState[i]);\n\t\t\toffset += 1;\n\t\t}\n\n\t\toffset -= re - rs;\n\t}\n\twhile (state.$c < 2);\n}\n\n\ninterface SearchBias {\n\t(changes: readonly ListChange<unknown>[], index: number, mid: number, min: number, max: number): number;\n}\n\nconst latest: SearchBias = (changes, index, mid, _min, max) => {\n\tlet i = mid;\n\twhile (++i < max && changes[i].index === index) ;\n\treturn i - 1;\n};\n\nconst earliest: SearchBias = (changes, index, mid, min, _max) => {\n\tlet i = mid;\n\twhile (--i >= min && changes[i].index === index) ;\n\treturn i + 1;\n};\n\nfunction binarySearch<T>(changes: readonly ListChange<T>[], index: number, bias: SearchBias) {\n\tlet min = 0;\n\tlet max = changes.length;\n\tlet mid;\n\tlet tmp;\n\n\twhile (min < max) {\n\t\tmid = (min + max) >>> 1;\n\t\ttmp = changes[mid].index;\n\n\t\tif (index < tmp) {\n\t\t\tmax = mid;\n\t\t}\n\t\telse if (index > tmp) {\n\t\t\tmin = mid + 1;\n\t\t}\n\t\telse {\n\t\t\t// found matching index, but there may be more deltas with the same index -> apply bias\n\t\t\treturn bias(changes, index, mid, min, max);\n\t\t}\n\t}\n\n\treturn ~min;\n}\n\nfunction myersDiff<T>(state: DiffState<T>) {\n\tconst { $list0, $list1, $buffer, $stack, $eq } = state;\n\tlet { $index0, $index1, $N, $M, $Z, $c, $stackTop } = state;\n\tlet W, L, parity, offsetX, offsetY, z, h, hMax, k, kMin, kMax, gkm, gkp, u, v, x, y, pkm, pkp, sx;\n\n\twhile (true) {\n\t\tswitch ($c) {\n\t\t\tcase 0: {\n\t\t\t\tZ_block: while ($N > 0 && $M > 0) {\n\t\t\t\t\tW = $N - $M;\n\t\t\t\t\tL = $N + $M;\n\t\t\t\t\tparity = L & 1;\n\t\t\t\t\toffsetX = $index0 + $N - 1;\n\t\t\t\t\toffsetY = $index1 + $M - 1;\n\t\t\t\t\thMax = (L + parity) / 2;\n\n\t\t\t\t\t$buffer.fill(0, 0, $Z + $Z);\n\t\t\t\t\th_loop: for (h = 0; h <= hMax; h += 1) {\n\t\t\t\t\t\tkMin = 2 * Math.max(0, h - $M) - h;\n\t\t\t\t\t\tkMax = h - 2 * Math.max(0, h - $N);\n\n\t\t\t\t\t\t// forward pass\n\t\t\t\t\t\tfor (k = kMin; k <= kMax; k += 2) {\n\t\t\t\t\t\t\tgkm = $buffer[k - 1 - $Z * Math.floor((k - 1)/$Z)];\n\t\t\t\t\t\t\tgkp = $buffer[k + 1 - $Z * Math.floor((k + 1)/$Z)];\n\t\t\t\t\t\t\tu = (k === -h || (k !== h && gkm < gkp)) ? gkp : gkm + 1;\n\t\t\t\t\t\t\tv = u - k;\n\t\t\t\t\t\t\tx = u;\n\t\t\t\t\t\t\ty = v;\n\t\t\t\t\t\t\twhile (x < $N && y < $M && $eq($list0[$index0 + x], $list1[$index1 + y])) {\n\t\t\t\t\t\t\t\tx += 1;\n\t\t\t\t\t\t\t\ty += 1;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t$buffer[k - $Z * Math.floor(k / $Z)] = x;\n\t\t\t\t\t\t\tif (parity === 1 && (z = W - k) >= 1 - h && z < h && x + $buffer[$Z + z - $Z * Math.floor(z / $Z)] >= $N) {\n\t\t\t\t\t\t\t\tif (h > 1 || x !== u) {\n\t\t\t\t\t\t\t\t\t$stack[$stackTop++] = $index0 + x;\n\t\t\t\t\t\t\t\t\t$stack[$stackTop++] = $index1 + y;\n\t\t\t\t\t\t\t\t\t$stack[$stackTop++] = $N - x;\n\t\t\t\t\t\t\t\t\t$stack[$stackTop++] = $M - y;\n\t\t\t\t\t\t\t\t\t$N = u;\n\t\t\t\t\t\t\t\t\t$M = v;\n\t\t\t\t\t\t\t\t\t$Z = 2 * (Math.min($N, $M) + 1);\n\t\t\t\t\t\t\t\t\tcontinue Z_block;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tbreak h_loop;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// reverse pass\n\t\t\t\t\t\tfor (k = kMin; k <= kMax; k += 2) {\n\t\t\t\t\t\t\tpkm = $buffer[$Z + k - 1 - $Z * Math.floor((k - 1)/$Z)];\n\t\t\t\t\t\t\tpkp = $buffer[$Z + k + 1 - $Z * Math.floor((k + 1)/$Z)];\n\t\t\t\t\t\t\tu = (k === -h || (k !== h && pkm < pkp)) ? pkp : pkm + 1;\n\t\t\t\t\t\t\tv = u - k;\n\t\t\t\t\t\t\tx = u;\n\t\t\t\t\t\t\ty = v;\n\t\t\t\t\t\t\twhile (x < $N && y < $M && $eq($list0[offsetX - x], $list1[offsetY - y])) {\n\t\t\t\t\t\t\t\tx += 1;\n\t\t\t\t\t\t\t\ty += 1;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t$buffer[$Z + k - $Z * Math.floor(k/$Z)] = x;\n\t\t\t\t\t\t\tif (parity === 0 && (z = W - k) >= -h && z <= h && x + $buffer[z - $Z * Math.floor(z/$Z)] >= $N) {\n\t\t\t\t\t\t\t\tif (h > 0 || x !== u) {\n\t\t\t\t\t\t\t\t\t$stack[$stackTop++] = $index0 + $N - u;\n\t\t\t\t\t\t\t\t\t$stack[$stackTop++] = $index1 + $M - v;\n\t\t\t\t\t\t\t\t\t$stack[$stackTop++] = u;\n\t\t\t\t\t\t\t\t\t$stack[$stackTop++] = v;\n\t\t\t\t\t\t\t\t\t$N = $N - x;\n\t\t\t\t\t\t\t\t\t$M = $M - y;\n\t\t\t\t\t\t\t\t\t$Z = 2 * (Math.min($N, $M) + 1);\n\t\t\t\t\t\t\t\t\tcontinue Z_block;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tbreak h_loop;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif ($N === $M) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ($M > $N) {\n\t\t\t\t\t\t$index0 += $N;\n\t\t\t\t\t\t$index1 += $N;\n\t\t\t\t\t\t$M -= $N;\n\t\t\t\t\t\t$N = 0;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t$index0 += $M;\n\t\t\t\t\t\t$index1 += $M;\n\t\t\t\t\t\t$N -= $M;\n\t\t\t\t\t\t$M = 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t// we already know either N or M is zero, so we can skip the extra check at the top of the loop\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t// yield delete_start, delete_end, insert_start, insert_end\n\t\t\t\t// at this point, at least one of N & M is zero, or we wouldn't have gotten out of the preceding loop yet\n\t\t\t\tif ($N + $M !== 0) {\n\t\t\t\t\tif (state.$pxe === $index0 || state.$pye === $index1) {\n\t\t\t\t\t\t// it is a contiguous difference, extend the existing one\n\t\t\t\t\t\tstate.$pxe = $index0 + $N;\n\t\t\t\t\t\tstate.$pye = $index1 + $M;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsx = state.$pxs;\n\t\t\t\t\t\tstate.$oxs = state.$pxs;\n\t\t\t\t\t\tstate.$oxe = state.$pxe;\n\t\t\t\t\t\tstate.$oys = state.$pys;\n\t\t\t\t\t\tstate.$oye = state.$pye;\n\n\t\t\t\t\t\t// defer this one until we can check the next one\n\t\t\t\t\t\tstate.$pxs = $index0;\n\t\t\t\t\t\tstate.$pxe = $index0 + $N;\n\t\t\t\t\t\tstate.$pys = $index1;\n\t\t\t\t\t\tstate.$pye = $index1 + $M;\n\n\t\t\t\t\t\tif (sx >= 0) {\n\t\t\t\t\t\t\tstate.$index0 = $index0;\n\t\t\t\t\t\t\tstate.$index1 = $index1;\n\t\t\t\t\t\t\tstate.$N = $N;\n\t\t\t\t\t\t\tstate.$M = $M;\n\t\t\t\t\t\t\tstate.$Z = $Z;\n\t\t\t\t\t\t\tstate.$stackTop = $stackTop;\n\t\t\t\t\t\t\tstate.$c = 1;\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcase 1: {\n\t\t\t\tif ($stackTop === 0) {\n\t\t\t\t\tstate.$c = 2;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t$M = $stack[--$stackTop];\n\t\t\t\t$N = $stack[--$stackTop];\n\t\t\t\t$index1 = $stack[--$stackTop];\n\t\t\t\t$index0 = $stack[--$stackTop];\n\t\t\t\t$Z = 2 * (Math.min($N, $M) + 1);\n\t\t\t\t$c = 0;\n\t\t\t}\n\t\t}\n\t}\n}\n","import type { Nil } from \"~/support/types\";\n\nimport { isAtom, notify, S_ATOM, type Atom, type MaybeAtom } from \"./Atom\";\nimport { link, unlink, type Dependency } from \"./Dependency\";\nimport { __DEV__assertNotEffect } from \"./Effect\";\nimport { getLifecycle, type Lifecycle } from \"./Lifecycle\";\nimport { scheduleTick } from \"./Scheduler\";\n\nexport interface ProxyAtom<T> extends Atom<T> {\n\t/**\n\t * Binds this ProxyAtom to a new value. If it is an Atom, the proxy will mirror it, otherwise it\n\t * will be a read-only atom with a static value until rebound.\n\t */\n\tuse(value: MaybeAtom<T>): void;\n\n\t/** @internal */\n\tuse(value: MaybeAtom<T>, canNotify?: boolean): void;\n\n\n\t/** @internal */\n\t$dep?: Dependency;\n\n\t/** @internal */\n\t$bound?: Nil<Atom<T>>;\n\n\t/** @internal */\n\t$value?: Nil<T>;\n}\n\n/**\n * Creates a ProxyAtom bound to the provided initial value. If it is an Atom, the proxy will mirror\n * it, otherwise it will be a read-only atom with a static value until rebound.\n */\nexport function proxyOf<T>(initialValue: MaybeAtom<T>, lifecycle = getLifecycle()): ProxyAtom<T> {\n\tif (__DEV__) {\n\t\t__DEV__assertNotEffect();\n\t}\n\n\t// `set` is assigned by the use call below\n\tconst self: Omit<ProxyAtom<T>, \"set\"> = {\n\t\t[S_ATOM]: true,\n\t\t$lifecycle: lifecycle,\n\t\tuse,\n\t\tget: getStaticValue,\n\t};\n\n\tself.use(initialValue, false);\n\treturn self as ProxyAtom<T>;\n}\n\nfunction use<T>(this: ProxyAtom<T>, value: MaybeAtom<T>, canNotify: boolean = true) {\n\tif (this.$dep) {\n\t\tunlink(this.$dep);\n\t}\n\n\tconst oldValue = this.get();\n\tif (isAtom(value)) {\n\t\tthis.$bound = value;\n\t\tthis.$value = null;\n\t\tthis.get = getBoundValue;\n\t\tthis.set = setBoundValue;\n\t\tlink(this.$lifecycle, value, this.$dep ??= {\n\t\t\t$fn: notify<T>,\n\t\t\t$a0: this,\n\t\t});\n\t}\n\telse {\n\t\tthis.$bound = null;\n\t\tthis.$value = value;\n\t\tthis.get = getStaticValue;\n\t\tthis.set = setStaticValue;\n\t}\n\n\tif (canNotify && !Object.is(oldValue, this.get())) {\n\t\tscheduleTick(this.$lifecycle, this.$notify ??= {\n\t\t\t$fn: notify,\n\t\t\t$a0: this,\n\t\t});\n\t}\n}\n\nfunction getBoundValue<T>(this: ProxyAtom<T>) {\n\t// calling raw `get` doesn't report access, which is what we want\n\t// sites accessing this proxy atom should do so via read, which will report\n\t// access on the proxy rather than the bound atom which may change\n\treturn this.$bound!.get();\n}\n\nfunction setBoundValue<T>(this: ProxyAtom<T>, value: T) {\n\t// set the bound atom and schedule a notification if it changed - copies the\n\t// behavior of `write`, skipping parts we don't need here.\n\tconst atom = this.$bound!;\n\tif (atom.set(value)) {\n\t\tscheduleTick(atom.$lifecycle, atom.$notify ??= {\n\t\t\t$fn: notify,\n\t\t\t$a0: atom,\n\t\t});\n\t}\n\n\t// always return false, even if the bound atom changed - this way the\n\t// `write` and `update` functions won't schedule a redundant notification\n\t// for this proxy\n\treturn false;\n}\n\nfunction getStaticValue<T>(this: ProxyAtom<T>) {\n\treturn this.$value!;\n}\n\nfunction setStaticValue(this: ProxyAtom<any>) {\n\treturn false;\n}\n\n/** @internal */\nexport type ProxyObject =\n\t& { proxied: any }\n\t& { [_ in PropertyKey]?: ProxyAtom<any> };\n\nexport type Proxied<T, P extends readonly (keyof T)[]> =\n\t& { readonly proxied: T }\n\t& { readonly [K in P[number]]: ProxyAtom<T[K] extends MaybeAtom<infer V> ? V : T[K]> };\n\nconst EMPTY_SOURCE: Record<PropertyKey, unknown> = {};\n\n/**\n * Copies select keys from a data object into a new object where values are all wrapped in\n * ProxyAtoms and can be updated later.\n * @see {@link updateProxy}\n * @internal\n **/\nexport function createProxy(lifecycle: Lifecycle, data: any, keys: readonly PropertyKey[]) {\n\tconst source = isObject(data) ? data : EMPTY_SOURCE;\n\tconst proxy = {} as ProxyObject;\n\tconst { length } = keys;\n\n\tlet index = 0;\n\tlet key;\n\n\tfor (; index < length; index += 1) {\n\t\tkey = keys[index];\n\t\tproxy[key] = proxyOf(source[key], lifecycle);\n\t}\n\n\tproxy.proxied = data;\n\treturn proxy;\n}\n\n/**\n * Updates the values proxied by a previously created proxy object. The keys array must be the same\n * as was used during creation (or a subset).\n * @see {@link createProxy}\n * @internal\n **/\nexport function updateProxy(proxy: ProxyObject, data: any, keys: readonly PropertyKey[]) {\n\tconst source = isObject(data) ? data : EMPTY_SOURCE;\n\tconst { length } = keys;\n\tproxy.proxied = data;\n\n\tlet index = 0;\n\tlet key;\n\n\tfor (; index < length; index += 1) {\n\t\tkey = keys[index];\n\t\tproxy[key]!.use(source[key]);\n\t}\n}\n\nfunction isObject(value: unknown): value is Record<PropertyKey, unknown> {\n\treturn value !== null && typeof value === \"object\";\n}\n","import { withLifecycle } from \"~/data/Lifecycle\";\nimport { link } from \"~/data/Dependency\";\nimport type { ReadonlyList } from \"~/data/List\";\nimport { LC_CHANGE, LC_CLEAR, LC_INSERT, LC_REMOVE } from \"~/data/ListDelta\";\nimport { createProxy, updateProxy, type Proxied } from \"~/data/ProxyAtom\";\nimport type { DataTemplate, JsxObject, JsxProps, JsxResult } from \"~/Component\";\nimport { fork, insert, mount, track, unmount, untrack, type MountingGroup, type HNode } from \"~/Renderer\";\n\nexport interface RemountIteratorProps<T> {\n\tsource: ReadonlyList<T>;\n\tproxy?: never; // discriminator\n\tchildren: [ template: DataTemplate<T> ];\n}\n\nexport interface ProxyIteratorProps<T, P extends readonly (keyof T)[]> {\n\tsource: ReadonlyList<T>;\n\tproxy: P;\n\tchildren: [ template: DataTemplate<Proxied<T, P>> ];\n}\n\ninterface IteratorItemGroup<TNode> extends MountingGroup<TNode> {\n\t$marker: TNode;\n\t$data?: any;\n}\n\ninterface PendingItem<T> {\n\treadonly $index: number;\n\treadonly $item: T;\n}\n\n/**\n * The built-in Iterator Component efficiently rendering collections of items\n * based on updates from a Pyxis `list`.\n */\n// @ts-expect-error fake overload to enable use with JSX\nexport function Iterator<T>(props: JsxProps<RemountIteratorProps<T>>): JsxResult;\n\nexport function Iterator<T, P extends readonly (keyof T)[]>(props: JsxProps<ProxyIteratorProps<T, P>>): JsxResult;\n\nexport function Iterator<TNode, T>(\n\tjsx: JsxObject,\n\thParent: HNode<TNode>,\n\tnUsedParent: TNode,\n\tnRealParent: TNode,\n\tnBefore: TNode | null,\n\tisBatch: boolean,\n) {\n\tconst source = jsx.source as ReadonlyList<T>;\n\tconst proxyKeys = jsx.proxy as readonly PropertyKey[] | undefined;\n\tconst isProxy = proxyKeys !== undefined;\n\tconst template = jsx.children[0] as DataTemplate<T>;\n\n\t// create master group\n\tconst hGroup = fork(hParent) as MountingGroup<TNode>;\n\n\tconst { adapter } = hGroup;\n\tconst shouldBatch = Boolean(adapter.batch);\n\tconst nListEndMarker = __DEV__ ? adapter.marker(\"/Iterator\") : adapter.marker();\n\n\t// list change handler\n\tlet items: IteratorItemGroup<TNode>[];\n\tlet skipDelta = Boolean(source.$delta);\n\tconst onDelta = () => {\n\t\tif (skipDelta) {\n\t\t\t// a delta might've been pending during initial render, but we already rendered against\n\t\t\t// the lists's up-to-date state, so such delta must be skipped -> bail out\n\t\t\tskipDelta = false;\n\t\t\treturn;\n\t\t}\n\n\t\tconst delta = source.$delta!;\n\t\tconst { changes, lengthChange } = delta;\n\t\tconst cMax = changes.length;\n\t\tconst iMax = items.length + lengthChange;\n\t\tconst newItems = new Array<IteratorItemGroup<TNode>>(iMax);\n\t\tconst pending: PendingItem<T>[] = [];\n\t\tlet recycled: IteratorItemGroup<TNode>[] = [];\n\t\tlet item: IteratorItemGroup<TNode>;\n\t\tlet inserted = 0;\n\t\tlet ci = 0; // change index\n\t\tlet oi = 0; // old items index\n\t\tlet ni = 0; // new items index\n\t\tlet change;\n\t\tlet ref;\n\t\tlet tmp;\n\n\t\t// batching\n\t\tlet isLocalBatch = false;\n\t\tlet nBatchParent = nRealParent;\n\t\tlet nBatchBefore: TNode | null = null;\n\n\t\tfor (; ci < cMax; ci += 1) {\n\t\t\tchange = changes[ci];\n\n\t\t\t// copy unchanged items\n\t\t\twhile (ni < change.index) {\n\t\t\t\tnewItems[ni++] = items[oi++];\n\t\t\t}\n\n\t\t\t// apply change\n\t\t\tswitch (change.kind) {\n\t\t\t\tcase LC_CHANGE:\n\t\t\t\t\titem = (newItems[ni++] = items[oi++]);\n\t\t\t\t\tif (isProxy) {\n\t\t\t\t\t\tupdateProxy(item.$data, change.newItem, proxyKeys);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t// no need to untrack and re-track, position doesn't change\n\t\t\t\t\t\tunmount(item);\n\n\t\t\t\t\t\t// unmount removes marker, we must re-insert it\n\t\t\t\t\t\tref = items[oi]?.$marker ?? nListEndMarker;\n\t\t\t\t\t\tinsert(\n\t\t\t\t\t\t\t/* hNode = */ item.$marker,\n\t\t\t\t\t\t\t/* children = */ null,\n\t\t\t\t\t\t\t/* hParent = */ item,\n\t\t\t\t\t\t\t/* nUsedParent = */ nRealParent,\n\t\t\t\t\t\t\t/* nBefore = */ ref,\n\t\t\t\t\t\t\t/* isBatch = */ false,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tmount(\n\t\t\t\t\t\t\t/* jsx = */ withLifecycle(item, template, (item.$data = change.newItem)),\n\t\t\t\t\t\t\t/* hGroup = */ item,\n\t\t\t\t\t\t\t/* nUsedParent = */ nRealParent,\n\t\t\t\t\t\t\t/* nRealParent = */ nRealParent,\n\t\t\t\t\t\t\t/* nBefore = */ ref,\n\t\t\t\t\t\t\t/* isBatch = */ false,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase LC_INSERT:\n\t\t\t\t\tif (!isProxy || inserted < lengthChange) {\n\t\t\t\t\t\t// we're either in remount mode, or no more items are available for recycling\n\t\t\t\t\t\titem = (newItems[ni++] = fork(hGroup, items[oi]) as IteratorItemGroup<TNode>);\n\t\t\t\t\t\titem.$marker = __DEV__ ? adapter.marker(\"IteratorItem\") : adapter.marker();\n\t\t\t\t\t\titem.$data = isProxy ? createProxy(item, change.newItem, proxyKeys) : change.newItem;\n\t\t\t\t\t\tinserted += 1;\n\n\t\t\t\t\t\tref = items[oi]?.$marker ?? nListEndMarker;\n\t\t\t\t\t\tif (!isLocalBatch) {\n\t\t\t\t\t\t\tif (shouldBatch) {\n\t\t\t\t\t\t\t\tisLocalBatch = true;\n\t\t\t\t\t\t\t\tnBatchParent = adapter.batch!();\n\t\t\t\t\t\t\t\tnBatchBefore = null;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tnBatchBefore = ref;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// insert start marker to preserve position in the document\n\t\t\t\t\t\tinsert(\n\t\t\t\t\t\t\t/* hNode = */ item.$marker,\n\t\t\t\t\t\t\t/* children = */ null,\n\t\t\t\t\t\t\t/* hParent = */ item,\n\t\t\t\t\t\t\t/* nUsedParent = */ nBatchParent,\n\t\t\t\t\t\t\t/* nBefore = */ nBatchBefore,\n\t\t\t\t\t\t\t/* isBatch = */ isLocalBatch,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tmount(\n\t\t\t\t\t\t\t/* jsx = */ withLifecycle(item, template, item.$data),\n\t\t\t\t\t\t\t/* hGroup = */ item,\n\t\t\t\t\t\t\t/* nUsedParent = */ nBatchParent,\n\t\t\t\t\t\t\t/* nRealParent = */ nRealParent,\n\t\t\t\t\t\t\t/* nBefore = */ nBatchBefore,\n\t\t\t\t\t\t\t/* isBatch = */ isLocalBatch,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tif (isLocalBatch && (\n\t\t\t\t\t\t\t// we must commit the current batch if:\n\t\t\t\t\t\t\tinserted >= lengthChange ||\t\t// next insert will use recycled\n\t\t\t\t\t\t\t!(tmp = changes[ci + 1]) ||\t\t// no next change exists\n\t\t\t\t\t\t\ttmp.kind !== LC_INSERT ||\t\t// next change is not an insert\n\t\t\t\t\t\t\ttmp.index !== ni\t\t\t\t// next insert is not consecutive\n\t\t\t\t\t\t)) {\n\t\t\t\t\t\t\tadapter.insert(nBatchParent, nRealParent, ref);\n\t\t\t\t\t\t\tnBatchParent = nRealParent;\n\t\t\t\t\t\t\tisLocalBatch = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t// we know enough items will be removed -> add a pending item\n\t\t\t\t\t\tpending.push({\n\t\t\t\t\t\t\t$index: ni++,\n\t\t\t\t\t\t\t$item: change.newItem,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase LC_REMOVE:\n\t\t\t\t\titem = items[oi++];\n\t\t\t\t\tif (isProxy) {\n\t\t\t\t\t\trecycled.push(item);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tunmount(item);\n\t\t\t\t\t}\n\n\t\t\t\t\tuntrack(item);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase LC_CLEAR:\n\t\t\t\t\t// clear is always the first change within a delta, has index = -1 and is only\n\t\t\t\t\t// ever followed by inserts - thus we can directly recycle the items array, it\n\t\t\t\t\t// won't get mutated\n\t\t\t\t\tif (isProxy) {\n\t\t\t\t\t\trecycled = items;\n\t\t\t\t\t\trecycled.forEach(untrack);\n\t\t\t\t\t\toi = items.length;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\twhile (oi < items.length) {\n\t\t\t\t\t\t\titem = items[oi++];\n\t\t\t\t\t\t\tunmount(item);\n\t\t\t\t\t\t\tuntrack(item);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// copy remaining unchanged\n\t\twhile (ni < iMax) {\n\t\t\tnewItems[ni++] = items[oi++];\n\t\t}\n\n\t\t// fulfill pending items with recycled ones\n\t\tlet pi = pending.length - 1; // pending items index\n\t\tlet ri = recycled.length - 1; // recycled items index\n\t\twhile (pi >= 0) {\n\t\t\ttmp = pending[pi--];\n\t\t\titem = (newItems[tmp.$index] = recycled[ri--]);\n\t\t\tupdateProxy(item.$data, tmp.$item, proxyKeys!);\n\t\t\ttrack(item, hGroup, ref = newItems[tmp.$index + 1]);\n\t\t\tmount(\n\t\t\t\t/* jsx = */ withLifecycle(item, template, item.$data),\n\t\t\t\t/* hGroup = */ item,\n\t\t\t\t/* nUsedParent = */ nRealParent,\n\t\t\t\t/* nRealParent = */ nRealParent,\n\t\t\t\t/* nBefore = */ ref?.$marker ?? nListEndMarker,\n\t\t\t\t/* isBatch = */ false,\n\t\t\t);\n\t\t}\n\n\t\t// unmount unused\n\t\twhile (ri >= 0) {\n\t\t\titem = recycled[ri--];\n\t\t\tunmount(item);\n\t\t\tuntrack(item);\n\t\t}\n\n\t\titems = newItems;\n\t};\n\n\tlink(hGroup, source, { $fn: onDelta });\n\n\t// initial render\n\t{\n\t\tlet nBatchParent = nUsedParent;\n\t\tlet nBatchBefore = nBefore;\n\n\t\tconst isLocalBatch = shouldBatch && !isBatch && source.$items.length > 0;\n\t\tif (isLocalBatch) {\n\t\t\tnBatchParent = adapter.batch!();\n\t\t\tnBatchBefore = null;\n\t\t}\n\n\t\tconst isAnyBatch = isLocalBatch || isBatch;\n\t\titems = source.$items.map((data) => {\n\t\t\tconst item = fork(hGroup) as IteratorItemGroup<TNode>;\n\t\t\titem.$marker = __DEV__ ? adapter.marker(\"IteratorItem\") : adapter.marker();\n\t\t\titem.$data = isProxy ? createProxy(item, data, proxyKeys) : data;\n\n\t\t\tinsert(item.$marker, null, item, nBatchParent, nBatchBefore, isAnyBatch);\n\t\t\tmount(\n\t\t\t\t/* jsx = */ withLifecycle(item, template, item.$data),\n\t\t\t\t/* hGroup = */ item,\n\t\t\t\t/* nUsedParent = */ nBatchParent,\n\t\t\t\t/* nRealParent = */ nRealParent,\n\t\t\t\t/* nBefore = */ nBatchBefore,\n\t\t\t\t/* isBatch = */ isAnyBatch,\n\t\t\t);\n\n\t\t\treturn item;\n\t\t});\n\n\t\t// insert end marker to preserve position in the document\n\t\tinsert(nListEndMarker, null, hGroup, nBatchParent, nBatchBefore, isAnyBatch);\n\n\t\t// commit batch, if it's local\n\t\tif (isLocalBatch) {\n\t\t\tadapter.insert(nBatchParent, nUsedParent, nBefore);\n\t\t}\n\t}\n\n\t// content is already rendered, only call mount (with empty jsx) to propagate mount notifications\n\tmount(null, hGroup, nUsedParent, nRealParent, nBefore, isBatch);\n}\n","import { isAtom } from \"~/data/Atom\";\nimport type { JsxObject } from \"~/Component\";\nimport { insert, type HNode } from \"~/Renderer\";\nimport { bind } from \"~/data/Dependency\";\n\nconst RE_EXT = /^([^:]+?):(.+)$/;\n\n/** @internal */\n// @ts-expect-error this is a unique symbol at runtime\nexport const S_TAG_NAME: unique symbol = __DEV__ ? Symbol.for(\"pyxis:tagName\") : Symbol();\n\nexport function Native<TNode>(\n\tjsx: JsxObject,\n\thParent: HNode<TNode>,\n\tnUsedParent: TNode,\n\t_nRealParent: TNode,\n\tnBefore: TNode | null,\n\tisBatch: boolean,\n) {\n\tconst hGroup = hParent.$ng;\n\tconst { adapter, $extensions } = hGroup;\n\tconst nNode = adapter.element(jsx[S_TAG_NAME]!);\n\n\tlet name;\n\tlet match;\n\tlet value;\n\n\t// for..in doesn't iterate symbol keys, so we don't need to manually exclude\n\t// internal symbols (S_COMPONENT, S_TAG_NAME, S_DEV_INFO), just children\n\tfor (name in jsx) {\n\t\tmatch = RE_EXT.exec(name);\n\t\tvalue = jsx[name];\n\t\tif (match) {\n\t\t\t$extensions[match[1]]?.set(nNode, match[2], value, hGroup);\n\t\t}\n\t\telse if (name !== \"children\") {\n\t\t\tif (isAtom(value)) {\n\t\t\t\tconst prop = name;\n\t\t\t\tconst atom = value;\n\t\t\t\tbind(hGroup, atom, () => {\n\t\t\t\t\tadapter.set(nNode, prop, atom.get());\n\t\t\t\t});\n\t\t\t}\n\t\t\telse {\n\t\t\t\tadapter.set(nNode, name, value);\n\t\t\t}\n\t\t}\n\t}\n\n\tinsert(nNode, jsx.children, hParent, nUsedParent, nBefore, isBatch);\n}\n","import { isAtom, read, type MaybeAtom, type ReadonlyAtom } from \"~/data/Atom\";\nimport { link } from \"~/data/Dependency\";\nimport { effect } from \"~/data/Effect\";\nimport { withLifecycle } from \"~/data/Lifecycle\";\nimport { createProxy, updateProxy, type Proxied, type ProxyObject } from \"~/data/ProxyAtom\";\nimport type { Nil } from \"~/support/types\";\nimport type { DataTemplate, JsxChildren, JsxObject, JsxProps, JsxResult } from \"~/Component\";\nimport { insert, mount, mountJsx, fork, unmount, type HNode } from \"~/Renderer\";\n\nexport interface ShowProps {\n\twhen?: MaybeAtom<boolean>;\n\tchildren: JsxChildren;\n}\n\nexport interface ShowDataProps<T> {\n\twhen?: MaybeAtom<boolean>;\n\tproxy?: never;\n\tdata: MaybeAtom<T>;\n\tchildren: [ template: DataTemplate<T> | ReadonlyAtom<Nil<DataTemplate<T>>> ];\n}\n\nexport interface ShowProxyDataProps<T, P extends readonly (keyof T)[]> {\n\twhen?: MaybeAtom<boolean>;\n\tproxy: P;\n\tdata: MaybeAtom<T>;\n\tchildren: [ template: DataTemplate<Proxied<T, P>> | ReadonlyAtom<Nil<DataTemplate<Proxied<T, P>>>> ];\n}\n\n/**\n * The built-in Show Component dynamically mounting and unmounting a Template\n * based on a reactive condition result.\n */\n// @ts-expect-error fake overload to enable use with JSX\nexport function Show(props: JsxProps<ShowProps>): JsxResult;\nexport function Show<T>(props: JsxProps<ShowDataProps<T>>): JsxResult;\nexport function Show<T, P extends readonly (keyof T)[]>(props: JsxProps<ShowProxyDataProps<T, P>>): JsxResult;\n\nexport function Show<TNode>(\n\tjsx: JsxObject,\n\thParent: HNode<TNode>,\n\tnUsedParent: TNode,\n\tnRealParent: TNode,\n\tnBefore: TNode | null,\n\tisBatch: boolean,\n) {\n\tconst when = jsx.when as MaybeAtom<boolean> | undefined;\n\tif (!isAtom(when) && when === false) {\n\t\t// when is statically set to false -> bail out early\n\t\treturn;\n\t}\n\n\tconst { children, data } = jsx;\n\tconst proxyKeys = jsx.proxy as readonly PropertyKey[] | undefined;\n\tconst template: MaybeAtom<(data: any) => any> = Object.hasOwn(jsx, \"data\")\n\t\t? children[0] as MaybeAtom<DataTemplate<any>> // enforced by overload typings\n\t\t: () => children;\n\n\tlet dataOrProxy: unknown = data;\n\tif (proxyKeys) {\n\t\tif (isAtom(data)) {\n\t\t\tdataOrProxy = createProxy(hParent.$ng, data.get(), proxyKeys);\n\t\t\tlink(hParent.$ng, data, {\n\t\t\t\t$fn: () => {\n\t\t\t\t\tupdateProxy(dataOrProxy as ProxyObject, data.get(), proxyKeys);\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t\telse {\n\t\t\tdataOrProxy = createProxy(hParent.$ng, data, proxyKeys);\n\t\t}\n\t}\n\n\t// prepare batching\n\tconst adapter = hParent.$ng.adapter;\n\tconst shouldBatch = Boolean(adapter.batch);\n\n\t// a sub-group for re-mounting is only necessary when either:\n\t// - `when` can change\n\t// - `template` can change\n\t// - `data` can change and we're not using a proxy\n\n\tif (!(isAtom(when) || isAtom(template) || (!proxyKeys && isAtom(data)))) {\n\t\tconst isLocalBatch = shouldBatch && !isBatch;\n\t\tlet nBatchParent = nUsedParent;\n\t\tlet nBatchBefore = nBefore;\n\t\tif (isLocalBatch) {\n\t\t\tnBatchParent = adapter.batch!();\n\t\t\tnBatchBefore = null;\n\t\t}\n\n\t\tmountJsx(\n\t\t\t/* jsx = */ template(dataOrProxy),\n\t\t\t/* hParent = */ hParent,\n\t\t\t/* nUsedParent = */ nBatchParent,\n\t\t\t/* nRealParent = */ nRealParent,\n\t\t\t/* nBefore = */ nBatchBefore,\n\t\t\t/* isBatch = */ isLocalBatch || isBatch,\n\t\t);\n\n\t\tif (isLocalBatch) {\n\t\t\tadapter.insert(nBatchParent, nUsedParent, nBefore);\n\t\t}\n\n\t\treturn;\n\t}\n\n\t// re-mounts may be necessary -> create a sub-group\n\tconst hGroup = fork(hParent);\n\n\t// (re-)render effect\n\tlet nMarker: TNode | null = nBefore;\n\teffect(() => {\n\t\tif (read(when) === false) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst isLocalBatch = shouldBatch && !isBatch;\n\t\tlet nBatchParent = nUsedParent;\n\t\tlet nBatchBefore = nMarker;\n\t\tif (isLocalBatch) {\n\t\t\tnBatchParent = adapter.batch!();\n\t\t\tnBatchBefore = null;\n\t\t}\n\n\t\tmount(\n\t\t\t/* jsx = */ withLifecycle(hGroup, read(template), read(dataOrProxy)),\n\t\t\t/* hGroup = */ hGroup,\n\t\t\t/* nUsedParent = */ nBatchParent,\n\t\t\t/* nRealParent = */ nRealParent,\n\t\t\t/* nBefore = */ nBatchBefore,\n\t\t\t/* isBatch = */ isLocalBatch || isBatch,\n\t\t);\n\n\t\tif (isLocalBatch) {\n\t\t\tadapter.insert(nBatchParent, nUsedParent, nMarker);\n\t\t}\n\n\t\treturn () => unmount(hGroup);\n\t}, hParent.$ng);\n\n\t// insert marker to preserve position in the document\n\tnMarker = __DEV__ ? adapter.marker(\"/Show\") : adapter.marker();\n\tinsert(\n\t\t/* hNode = */ nMarker,\n\t\t/* children = */ null,\n\t\t/* hParent = */ hParent,\n\t\t/* nUsedParent = */ nUsedParent,\n\t\t/* nBefore = */ nBefore,\n\t\t/* isBatch = */ isBatch,\n\t);\n\n\t// forget stale batch before future re-renders\n\tisBatch = false;\n\tnUsedParent = nRealParent;\n}\n","import { notify, S_ATOM, type Atom } from \"./Atom\";\nimport { getLifecycle } from \"./Lifecycle\";\nimport { unlink } from \"./Dependency\";\nimport { __DEV__assertNotEffect, resolve, type Effect, type EffectDependency } from \"./Effect\";\nimport { scheduleTick } from \"./Scheduler\";\n\n/**\n * Holds a value derived from values of other Atoms, managing reactions to their changes.\n * Derivations are read-only. Use the `read` function to access its value.\n * @see {@link read}\n */\nexport interface Derivation<T = unknown> extends Atom<T>, Effect<T> {\n\t/** @internal */\n\t$dirty: boolean;\n\n\t/** @internal */\n\t$value: T;\n}\n\n/**\n * Creates a Derivation - an Atom with its value computed from other Atoms. The block runs once\n * eagerly to compute the initial value, then re-runs within scheduler ticks whenever its source\n * Atoms change. Observers are only notified if the new value differs from the previous.\n */\nexport function derived<T>(block: () => T, lifecycle = getLifecycle()): Derivation<T> {\n\tif (__DEV__) {\n\t\t__DEV__assertNotEffect();\n\t}\n\n\tconst atom: Derivation<T> = {\n\t\t[S_ATOM]: true,\n\t\t$dirty: false,\n\t\t$value: null!,\n\t\t$tracksValue: true,\n\t\t$lifecycle: lifecycle,\n\t\t$life: lifecycle.$life,\n\t\t$lastValue: null!,\n\t\t$cycle: 0,\n\t\t$block: block,\n\t\t$react: scheduleNotify,\n\t\tget: getValue,\n\t\tset: setValue,\n\t};\n\n\tconst value = resolve(atom) as T;\n\tatom.$value = value;\n\tatom.$lastValue = value;\n\n\treturn atom;\n}\n\nfunction scheduleNotify(this: EffectDependency, derivation: Derivation<any>, cycle: number) {\n\tif (\n\t\t// derivation was scheduled in a previous life and this run is now stale\n\t\tderivation.$life !== derivation.$lifecycle.$life ||\n\n\t\t// when we get an update from a stale dependency, the reported cycle number will be lower\n\t\t// than our current one (see the reportAccess function). We can unlink the dep and bail out.\n\t\tderivation.$cycle > cycle\n\t) {\n\t\tunlink(this);\n\t\treturn;\n\t}\n\n\t// we're already within a scheduler tick; the effect will therefore run synchronously despite\n\t// being \"scheduled\" - this also gives priority to already scheduled updates and prevents\n\t// infinite loops when dependency cycles exist\n\tderivation.$dirty = true;\n\tscheduleTick(derivation.$lifecycle, derivation.$notify ??= {\n\t\t$fn: notify,\n\t\t$a0: derivation,\n\t});\n}\n\nfunction getValue<T>(this: Derivation<T>): T {\n\t// life number must match, otherwise we'd re-link deps within a lifecycle that already ended\n\tif (this.$dirty && this.$life === this.$lifecycle.$life) {\n\t\tthis.$value = resolve(this) as T;\n\t\tthis.$dirty = false;\n\t}\n\n\treturn this.$value!;\n}\n\nfunction setValue() {\n\treturn false;\n}\n","import { invoke } from \"~/support/common\";\nimport type { Nil } from \"~/support/types\";\n\nimport { getLifecycle, type Lifecycle } from \"./Lifecycle\";\nimport type { DependencyList } from \"./Dependency\";\nimport { __DEV__assertNotEffect, reportAccess } from \"./Effect\";\nimport { createDelta, itemChanged, itemInserted, itemRemoved, listCleared, listSynced, type Equals, type ListDelta } from \"./ListDelta\";\nimport { scheduleTick, scheduleTock, type UpdateCallback } from \"./Scheduler\";\n\nexport interface ReadonlyList<T> extends Iterable<T>, DependencyList {\n\t/**\n\t * Gets the size of this List.\n\t * Reactive in effects and derivations.\n\t */\n\tsize(): number;\n\n\t/**\n\t * Gets the item at the specified index. Return undefined when outside of the List's bounds.\n\t * Reactive in effects and derivations.\n\t */\n\tget(index: number): T | undefined;\n\n\t/**\n\t * Gets a set of changes made to this List within the current tick. Returns null when no changes\n\t * were made.\n\t * Reactive in effects and derivations.\n\t */\n\tdelta(): ListDelta<T> | null;\n\n\t/**\n\t * Gets the underlying array of items. The array is read-only, attempts to mutate this array\n\t * will cause observers to go out of sync.\n\t * Reactive in effects and derivations.\n\t */\n\traw(): readonly T[];\n\n\t/**\n\t * Runs the provided callback for each item of this List.\n\t * Reactive in effects and derivations.\n\t */\n\tforEach(callback: (item: T, index: number) => void, thisArg?: any): void;\n\n\t/** @internal */\n\treadonly $lifecycle: Lifecycle;\n\n\t/** @internal */\n\t$items: readonly T[];\n\n\t/** @internal */\n\t$delta: ListDelta<T> | null;\n\n\t/** @internal */\n\t$notify?: UpdateCallback<[ self: List<T> ]>;\n\n\t/** @internal */\n\t$cleanup?: UpdateCallback<[ self: List<T> ]>;\n\n\t/**\n\t * The ID of this List, used in development mode.\n\t * @internal\n\t */\n\t$devId?: string;\n}\n\nexport interface List<T> extends ReadonlyList<T> {\n\t/**\n\t * Sets the item at the specified index to a new value.\n\t * Observers are notified of this mutation.\n\t * @throws RangeError when index is out of bounds.\n\t */\n\tset(index: number, item: T): void;\n\n\t/**\n\t * Removes all items from this List.\n\t * Observers are notified of this mutation.\n\t */\n\tclear(): void;\n\n\t/**\n\t * Inserts a new item at the specified index.\n\t * Observers are notified of this mutation.\n\t * @throws RangeError when index is out of bounds.\n\t */\n\tinsertAt(index: number, item: T): void;\n\n\t/**\n\t * Inserts a new item at the start of this List.\n\t * Observers are notified of this mutation.\n\t */\n\tinsertFirst(item: T): void;\n\n\t/**\n\t * Inserts a new item at the end of this List.\n\t * Observers are notified of this mutation.\n\t */\n\tinsertLast(item: T): void;\n\n\t/**\n\t * Attempts to find and remove the first matching item from this List.\n\t * Observers are notified of this mutation.\n\t * @returns true if an item was found and removed, false otherwise.\n\t */\n\tremove(item: T): boolean;\n\n\t/**\n\t * Removes the item at the specified index.\n\t * Observers are notified of this mutation.\n\t * @returns the removed item.\n\t * @throws RangeError when index is out of bounds.\n\t */\n\tremoveAt(index: number): T;\n\n\t/**\n\t * Attempts to remove the first item of this List.\n\t * Observers are notified of this mutation.\n\t * @returns the removed item, or undefined if the List is empty.\n\t */\n\tremoveFirst(): T | undefined;\n\n\t/**\n\t * Attempts to remove the last item of this List.\n\t * Observers are notified of this mutation.\n\t * @returns the removed item, or undefined if the List is empty.\n\t */\n\tremoveLast(): T | undefined;\n\n\t/** @internal */\n\t$items: T[];\n}\n\n/**\n * Creates an empty List. This List emits deltas with each mutation which can be observed by\n * Components to efficiently update the rendered state.\n */\nexport function listOf<T>(): List<T>;\nexport function listOf<T>(source: Nil<never>, lifecycle?: Lifecycle, devId?: string): List<T>;\n\n/**\n * Creates a List initialized with items copied from the provided Iterable. This List emits deltas\n * with each mutation which can be observed by Components to efficiently update the rendered state.\n */\nexport function listOf<T>(source: Iterable<T>, lifecycle?: Lifecycle, devId?: string): List<T>;\n\nexport function listOf<T>(source?: Nil<Iterable<T>>, lifecycle = getLifecycle()): List<T> {\n\tif (__DEV__) {\n\t\t__DEV__assertNotEffect();\n\n\t\tconst devId = arguments[2];\n\t\tglobalThis.__PYXIS_HMR__.state.restore(lifecycle, devId, value => {\n\t\t\tif (Array.isArray(value)) {\n\t\t\t\tsource = value;\n\t\t\t}\n\t\t});\n\t}\n\n\tconst items = source ? Array.from(source) : [];\n\tconst list: List<T> = {\n\t\t$lifecycle: lifecycle,\n\t\t$items: items,\n\t\t$delta: null,\n\t\t[Symbol.iterator]: getIterator,\n\t\tsize,\n\t\tget,\n\t\tdelta,\n\t\traw,\n\t\tforEach,\n\t\tset,\n\t\tclear,\n\t\tinsertAt,\n\t\tinsertFirst,\n\t\tinsertLast,\n\t\tremove,\n\t\tremoveAt,\n\t\tremoveFirst,\n\t\tremoveLast,\n\t};\n\n\tif (__DEV__) {\n\t\tlist.$devId = arguments[2];\n\t}\n\n\treturn list;\n}\n\n/**\n * Synchronizes the provided List with the given data source. After this operation, the list will\n * contain an exact copy of the source.\n *\n * Note: This function is separated instead of being a List method since the underlying diff\n * algorithm (Myers) is a relatively large chunk of code which would otherwise always get included\n * into bundled builds. This way, tools like Terser can eliminate the extra code when unused.\n */\nexport function sync<T>(list: List<T>, source: readonly T[], eq: Equals<T> = defaultEquals) {\n\tconst oldState = list.$items;\n\tlist.$items = source.slice();\n\tlistSynced(list.$delta ??= createDelta(), oldState, source, eq);\n\tlistMutated(list);\n}\n\nfunction size(this: List<any>) {\n\treportAccess(this);\n\treturn this.$items.length;\n}\n\nfunction get(this: List<any>, index: number) {\n\treportAccess(this);\n\treturn this.$items[index];\n}\n\nfunction delta<T>(this: List<T>) {\n\treportAccess(this);\n\treturn this.$delta;\n}\n\nfunction raw<T>(this: List<T>): readonly T[] {\n\treportAccess(this);\n\treturn this.$items;\n}\n\nfunction forEach<T>(this: List<T>, callback: (item: T, index: number) => void, thisArg?: any) {\n\treportAccess(this);\n\tthis.$items.forEach(callback, thisArg);\n}\n\nfunction getIterator<T>(this: List<T>) {\n\treportAccess(this);\n\treturn this.$items[Symbol.iterator]();\n}\n\nfunction set<T>(this: List<T>, index: number, newItem: T) {\n\tassertIndex(this, index);\n\n\tconst oldItem = this.$items[index];\n\tif (Object.is(newItem, oldItem)) {\n\t\treturn;\n\t}\n\n\tthis.$items[index] = newItem;\n\n\t// only emit deltas when there are observers\n\tif (this.$dh) {\n\t\titemChanged(this.$delta ??= createDelta(), index, oldItem, newItem);\n\t\tlistMutated(this);\n\t}\n}\n\nfunction clear(this: List<any>) {\n\tconst count = this.$items.length;\n\tthis.$items.length = 0;\n\n\t// only emit deltas when there are observers\n\tif (this.$dh) {\n\t\tlistCleared(this.$delta ??= createDelta(), count);\n\t\tlistMutated(this);\n\t}\n}\n\nfunction insertAt<T>(this: List<T>, index: number, item: T) {\n\tconst { $items } = this;\n\tif (index === $items.length) {\n\t\t$items.push(item);\n\t}\n\telse {\n\t\tassertIndex(this, index);\n\t\tthis.$items.splice(index, 0, item);\n\t}\n\n\t// only emit deltas when there are observers\n\tif (this.$dh) {\n\t\titemInserted(this.$delta ??= createDelta(), index, item);\n\t\tlistMutated(this);\n\t}\n}\n\nfunction insertFirst<T>(this: List<T>, item: T) {\n\tthis.insertAt(0, item);\n}\n\nfunction insertLast<T>(this: List<T>, item: T) {\n\tthis.insertAt(this.$items.length, item);\n}\n\nfunction remove<T>(this: List<any>, item: T) {\n\tconst index = this.$items.indexOf(item);\n\tif (index === -1) {\n\t\treturn false;\n\t}\n\n\tthis.removeAt(index);\n\treturn true;\n}\n\nfunction removeAt<T>(this: List<T>, index: number) {\n\tassertIndex(this, index);\n\tconst item = this.$items.splice(index, 1)[0];\n\n\t// only emit deltas when there are observers\n\tif (this.$dh) {\n\t\titemRemoved(this.$delta ??= createDelta(), index, item);\n\t\tlistMutated(this);\n\t}\n\n\treturn item;\n}\n\nfunction removeFirst<T>(this: List<T>) {\n\treturn this.$items.length > 0 ? this.removeAt(0) : undefined;\n}\n\nfunction removeLast<T>(this: List<T>) {\n\tconst { length } = this.$items;\n\treturn length > 0 ? this.removeAt(length - 1) : undefined;\n}\n\nfunction assertIndex(list: List<any>, index: number) {\n\tif (index >= list.$items.length || index < 0) {\n\t\tif (__DEV__) {\n\t\t\tthrow new RangeError(\"list index out of bounds\");\n\t\t}\n\t\telse {\n\t\t\tthrow new RangeError();\n\t\t}\n\t}\n}\n\nfunction defaultEquals<T>(item0: T, item1: T) {\n\treturn Object.is(item0, item1);\n}\n\nfunction listMutated(list: List<any>) {\n\tif (__DEV__) {\n\t\tglobalThis.__PYXIS_HMR__.state.preserve(list.$lifecycle, list.$devId, list.$items);\n\t}\n\n\tscheduleTick(list.$lifecycle, list.$notify ??= {\n\t\t$fn: notify,\n\t\t$a0: list,\n\t});\n\n\tscheduleTock(list.$lifecycle, list.$cleanup ??= {\n\t\t$fn: cleanup,\n\t\t$a0: list,\n\t});\n}\n\nfunction notify(list: List<any>) {\n\tlet current = list.$dh;\n\tlet next;\n\n\twhile (current) {\n\t\tnext = current.$an;\n\t\tinvoke(current);\n\t\tcurrent = next;\n\t}\n}\n\nfunction cleanup(list: List<any>) {\n\tlist.$delta = null;\n}\n","import { isAtom, type Atom } from \"~/data/Atom\";\nimport type { ElementsType, NodeType } from \"~/support/types\";\nimport type { ExtensionProps } from \"~/Adapter\";\nimport type { MountingGroup } from \"~/Renderer\";\nimport { getLifecycle, onMounted, onUnmounted } from \"~/data/Lifecycle\";\n\nexport interface RefExtensionType {\n\t<TExtensionKey extends string, TElements extends ElementsType>(extensionKey: TExtensionKey, elements: TElements): {\n\t\t[TElementName in keyof TElements]: TElements[TElementName] & ExtensionProps<TExtensionKey, {\n\t\t\treadonly atom?: Atom<NodeType<TElements[TElementName]> | null>;\n\t\t\treadonly call?: RefFn<NodeType<TElements[TElementName]>>;\n\t\t}>;\n\t};\n\n\tset: (node: any, prop: string, value: any, group?: MountingGroup<any>) => void;\n}\n\nexport interface RefFn<TNode> {\n\t(node: TNode | null): void;\n}\n\n/**\n * Extension adding direct reference access to any element. Recommended prefix:\n * `\"ref\"`\n *\n * References can be stored into atoms:\n * ```tsx\n * const wrapperRef = atomOf<HTMLDivElement>();\n * <div ref:atom={wrapperRef} />\n * ```\n * or handled with a custom callback:\n * ```tsx\n * const onWrapperRef = (node: HTMLDivElement) => { ... };\n * <div ref:call={onWrapperRef} />\n * ```\n */\nexport const RefExtension = {\n\tset: (node: any, kind: string, value: any) => {\n\t\tlet method;\n\t\tswitch (kind) {\n\t\t\tcase \"atom\":\n\t\t\t\tif (!isAtom(value)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tmethod = refAtom;\n\t\t\t\tbreak;\n\n\t\t\tcase \"call\":\n\t\t\t\tif (typeof value !== \"function\") {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tmethod = refCall;\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\treturn;\n\t\t}\n\n\t\tconst lifecycle = getLifecycle();\n\t\tonMounted(lifecycle, {\n\t\t\t$fn: method,\n\t\t\t$a0: value,\n\t\t\t$a1: node,\n\t\t});\n\n\t\tonUnmounted(lifecycle, {\n\t\t\t$fn: method,\n\t\t\t$a0: value,\n\t\t\t$a1: null,\n\t\t});\n\t},\n} as RefExtensionType;\n\nfunction refAtom(atom: Atom<any>, node: any) {\n\tatom.set(node);\n}\n\nfunction refCall(setter: RefFn<any>, node: any) {\n\tsetter(node);\n}\n","import { peek, read } from \"~/data/Atom\";\nimport type { JsxText } from \"~/Component\";\n\nimport type { Nil } from \"./types\";\n\nfunction tag(\n\taccess: (value: JsxText) => Nil<string | number | bigint | boolean>,\n\tstrings: TemplateStringsArray,\n\tvalues: readonly JsxText[],\n): string {\n\tconst { length } = values;\n\n\tlet index = 0;\n\tlet text = strings[0];\n\twhile (index < length) {\n\t\ttext += access(values[index]) + strings[++index];\n\t}\n\n\treturn text;\n}\n\n/**\n * A template literal tag that automatically wraps each substitution in a `read` call.\n * @see {@link read}\n */\nexport function reads(strings: TemplateStringsArray, ...values: JsxText[]) {\n\treturn tag(read, strings, values);\n}\n\n/**\n * A template literal tag that automatically wraps each substitution in a `peek` call.\n * @see {@link peek}\n */\nexport function peeks(strings: TemplateStringsArray, ...values: JsxText[]) {\n\treturn tag(peek, strings, values);\n}\n","import type { ElementsType } from \"~/support/types\";\n\nimport type { Adapter, Extension, ExtensionsType } from \"./Adapter\";\nimport { createRenderer, type Renderer } from \"./Renderer\";\n\nexport interface PyxisBuilder<TNode, TIntrinsicElements extends ElementsType> {\n\tbuild: () => Renderer<TNode, TIntrinsicElements>;\n\n\textend: <TExtensionKey extends string, TExtendedIntrinsicElements extends ElementsType>(\n\t\textensionKey: TExtensionKey,\n\t\textension: (extensionKey: TExtensionKey, intrinsicElements: TIntrinsicElements) => TExtendedIntrinsicElements,\n\t) => PyxisBuilder<TNode, TExtendedIntrinsicElements>;\n}\n\nexport function pyxis<TNode, TIntrinsicElements extends ElementsType>(adapter: Adapter<TNode, TIntrinsicElements>) {\n\tconst extensions: ExtensionsType<TNode> = {};\n\tconst builder = {\n\t\tbuild: () => createRenderer(adapter, extensions),\n\t\textend: (extensionKey: string, extension: Extension<TNode>) => {\n\t\t\textensions[extensionKey] = extension;\n\t\t\treturn builder;\n\t\t},\n\t};\n\n\treturn builder as PyxisBuilder<TNode, TIntrinsicElements>;\n}\n","import type { S_TAG_NAME } from \"~/component/Native\";\nimport type { MaybeReadonlyAtom } from \"~/data/Atom\";\nimport { getContextContainer, setContextContainer } from \"~/data/Context\";\nimport { unmounted } from \"~/data/Lifecycle\";\nimport type { Nil, PropsType } from \"~/support/types\";\n\nimport { mount, mountJsx, S_COMPONENT, fork, unmount, type HNode, insert } from \"./Renderer\";\n\n/**\n * Represents a Pyxis Component function responsible for setting up a view model and returning a\n * chunk of JSX to be rendered.\n */\nexport interface Component<TProps extends PropsType = {}> {\n\t(props: TProps): JsxResult;\n}\n\nexport type PropsOf<T> = T extends Component<infer TProps> ? TProps : unknown;\n\n/**\n * Represents a template function returning a chunk of JSX to be rendered with specific input data.\n */\nexport interface DataTemplate<TData> {\n\t(data: TData): JsxResult;\n}\n\nexport interface ComponentBlock {\n\t(props: PropsType): JsxResult;\n}\n\nexport function component<TPropsArg extends [ {} ]>(\n\tblock: (...args: TPropsArg) => JsxResult,\n\tdevId?: string,\n): (...args: [ props: JsxProps<TPropsArg[0]> ]) => JsxResult;\n\nexport function component(\n\tblock: ComponentBlock,\n): ComponentHandler {\n\tlet devId: string | undefined; // gets removed by bundler in production\n\tif (__DEV__) {\n\t\tdevId = arguments[1];\n\t\tdevId && globalThis.__PYXIS_HMR__.component.upsert(devId, block);\n\t}\n\n\treturn (jsx, hParent, nUsedParent, nRealParent, nBefore, isBatch) => {\n\t\tconst context = getContextContainer();\n\t\ttry {\n\t\t\tif (__DEV__) {\n\t\t\t\tif (!import.meta.hot || !devId) {\n\t\t\t\t\tsetContextContainer(context); // allow child components to branch context\n\t\t\t\t\tmountJsx(block(jsx), hParent, nUsedParent, nRealParent, nBefore, isBatch);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst hGroup = fork(hParent);\n\t\t\t\tconst nMarker = hGroup.adapter.marker(`/${devId}`);\n\t\t\t\tinsert(nMarker, null, hParent, nUsedParent, nBefore, isBatch);\n\n\t\t\t\tconst unsubscribe = globalThis.__PYXIS_HMR__.component.subscribe(devId, impl => {\n\t\t\t\t\tunmount(hGroup);\n\t\t\t\t\tmount(\n\t\t\t\t\t\t/* jsx = */ {\n\t\t\t\t\t\t\t...jsx,\n\t\t\t\t\t\t\t[S_COMPONENT]: (() => (\n\t\t\t\t\t\t\t\tmountJsx(impl(jsx), hGroup, nUsedParent, nRealParent, nMarker, isBatch)\n\t\t\t\t\t\t\t)) satisfies ComponentHandler,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t/* hGroup = */ hGroup,\n\t\t\t\t\t\t/* nUsedParent = */ nUsedParent,\n\t\t\t\t\t\t/* nRealParent = */ nRealParent,\n\t\t\t\t\t\t/* nBefore = */ nMarker,\n\t\t\t\t\t\t/* isBatch = */ isBatch,\n\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\t\tunmounted(unsubscribe);\n\n\t\t\t\t// forget stale batch before future re-renders\n\t\t\t\tnUsedParent = nRealParent;\n\t\t\t\tisBatch = false;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tsetContextContainer(context); // allow child components to branch context\n\t\t\t\tmountJsx(block(jsx), hParent, nUsedParent, nRealParent, nBefore, isBatch);\n\t\t\t}\n\t\t}\n\t\tfinally {\n\t\t\t// reset back to this Component's container, prevents leakage of branched off child contexts\n\t\t\tsetContextContainer(context);\n\t\t}\n\t};\n}\n\n/**\n * Infers the props object for use with JSX. Because Pyxis always supplies components with child\n * arrays (or tuples), the type needs to be adjusted to reflect the internal mechanics.\n */\nexport type JsxProps<T> =\n\t& { readonly [K in keyof T]: K extends \"children\" ? JsxChildrenProp<T[K]> : T[K] }\n\t& (\"children\" extends keyof T ? {} : { readonly children?: [] });\n\n/**\n * When typing children as a single value tuple, it becomes unusable in 'react-jsx' mode. TS rejects\n * valid uses of such components with the error: \"This JSX tag's children prop expects type '[T]'\n * which requires multiple children, but only a single child was provided.\"\n *\n * Likely related to the fact that single children are passed to jsx() factory without wrapping\n * arrays.\n *\n * This utility type unwraps single value tuples, avoiding the problem.\n */\nexport type JsxChildrenProp<T> = T extends readonly [ any, any, ...any[] ]\n\t// component requires 2+ children, safe to pass the type as-is, just attach the readonly modifier\n\t? T extends readonly [ ...infer C ]\n\t\t? readonly [ ...C ]\n\t\t: T\n\t: T extends readonly [ infer SC ]\n\t\t// component requires a single child, unwrap the tuple\n\t\t? SC\n\t\t: T extends readonly (infer C)[]\n\t\t\t// component requires any number of children, pass as-is, but also append the unwrapped\n\t\t\t// type to allow single child use\n\t\t\t? readonly C[] | C\n\t\t\t// children typed as a non-array type, pass as-is\n\t\t\t: T;\n\n/**\n * Primitive types accepted to render as text.\n */\nexport type JsxText = MaybeReadonlyAtom<Nil<string | number | boolean | bigint>>;\n\n/**\n * Describes the objects returned by JSX factories.\n *\n * Pyxis uses very lightweight factories returning the props object directly,\n * adding a few extra props:\n *\n * - S_COMPONENT ... hidden, contains a reference to the ComponentHandler function\n * - S_TAG_NAME ... hidden, specifies the tag name, only populated for native elements\n * - children ... always present and always an array, empty array for childless components\n */\nexport interface JsxObject {\n\t[propName: string]: unknown;\n\treadonly children: readonly unknown[];\n\n\t/** @internal */\n\treadonly [S_COMPONENT]: ComponentHandler;\n\n\t/** @internal */\n\treadonly [S_TAG_NAME]?: string;\n}\n\n/**\n * Union of all admissible values within JSX.\n */\nexport type JsxResult = JsxObject | JsxText;\n\n/**\n * The type of JSX elements accepted as individual children by common components.\n */\nexport type JsxChildren = JsxResult | readonly JsxChildren[];\n\n/**\n * Utility type adding the standard `children` prop to the given props type.\n */\nexport type WithChildren<T extends PropsType> = T & { children?: JsxChildren };\n\n/** @internal */\nexport interface ComponentHandler {\n\t<TNode>(\n\t\tjsx: JsxObject,\n\t\thParent: HNode<TNode>,\n\t\tnUsedParent: TNode,\n\t\tnRealParent: TNode,\n\t\tnBefore: TNode | null,\n\t\tisBatch: boolean,\n\t): void;\n}\n","import { Native, S_TAG_NAME } from \"~/component/Native\";\nimport type { PropsType } from \"~/support/types\";\nimport type { Component, JsxResult } from \"~/Component\";\nimport { S_COMPONENT } from \"~/Renderer\";\n\nconst EMPTY_ARRAY = Object.freeze([] as const);\n\nexport function jsx(\n\ttagName: string,\n\tprops: PropsType,\n\tkey?: any,\n): JsxResult;\n\nexport function jsx<TProps extends PropsType>(\n\tcomponent: Component<TProps>,\n\tprops: TProps,\n\tkey?: any,\n): JsxResult;\n\nexport function jsx(\n\tcomponentOrTagName: Component<PropsType> | string,\n\tprops: any,\n\tkey?: any,\n) {\n\tconst { children } = props;\n\n\t// the `jsx` (dynamic) variant is called without wrapping arrays around\n\t// children, however it is also used for children provided from a variable\n\t// which may itself be an array, so we have to check\n\tprops.children = children === undefined\n\t\t? EMPTY_ARRAY\n\t\t: Array.isArray(children)\n\t\t\t? children\n\t\t\t: [ children ];\n\n\t// put back the `key` prop\n\tprops.key ??= key;\n\n\t// attach component info\n\tif (typeof componentOrTagName === \"string\") {\n\t\tprops[S_COMPONENT] = Native;\n\t\tprops[S_TAG_NAME] = componentOrTagName;\n\t}\n\telse {\n\t\tprops[S_COMPONENT] = componentOrTagName;\n\t}\n\n\treturn props;\n}\n\n\nexport function jsxs(\n\ttagName: string,\n\tprops: PropsType,\n\tkey?: any,\n): JsxResult;\n\nexport function jsxs<TProps extends PropsType>(\n\tcomponent: Component<TProps>,\n\tprops: TProps,\n\tkey?: any,\n): JsxResult;\n\nexport function jsxs(\n\tcomponentOrTagName: Component<PropsType> | string,\n\tprops: any,\n\tkey?: any,\n) {\n\t// the `jsxs` (static) variant is called with a wrapping array around\n\t// children, so we don't have to check it.\n\n\t// put back the `key` prop\n\tprops.key ??= key;\n\n\t// attach component info\n\tif (typeof componentOrTagName === \"string\") {\n\t\tprops[S_COMPONENT] = Native;\n\t\tprops[S_TAG_NAME] = componentOrTagName;\n\t}\n\telse {\n\t\tprops[S_COMPONENT] = componentOrTagName;\n\t}\n\n\treturn props;\n}\n"],"mappings":"AAOA,SAAgB,EAAO,EAA8B,CACpD,OAAO,EAAS,IACf,EAAS,IACT,EAAS,GACV,CACD,CC8BA,SAAgB,EAAQ,EAAmB,EAAY,EAAa,EAAG,CACtE,EAAU,EAAW,CACpB,IAAK,EACL,IAAK,EACL,IAAK,CACN,CAAC,CACF,CAGA,SAAgB,EAAU,EAAsB,EAAoB,EAClE,EAAU,WAAa,CAAC,EAAA,CAAG,KAAK,CAAQ,CAC1C,CAEA,SAAS,EAAsB,EAAsB,EAAmB,CACvE,IAAM,EAAU,EAAM,EAClB,GACH,EAAY,EAAW,CAAE,IAAK,CAAQ,CAAC,CAEzC,CAOA,SAAgB,EAAU,EAAqB,EAAY,EAAa,EAAG,CAC1E,EAAY,EAAW,CAAE,IAAK,CAAM,CAAC,CACtC,CAGA,SAAgB,EAAY,EAAsB,EAAoB,EACpE,EAAU,aAAe,CAAC,EAAA,CAAG,KAAK,CAAQ,CAC5C,CAGA,IAAI,EAAsC,KAK1C,SAAgB,GAA0B,CAKzC,OAAO,CACR,CAGA,SAAgB,EAAa,EAA+C,CAC3E,IAAM,EAAW,EAEjB,MADA,GAAoB,EACb,CACR,CAaA,SAAgB,EACf,EACA,EACA,EACC,CACD,IAAM,EAAoB,EAC1B,EAAoB,EAEpB,GAAI,CACH,OAAO,EAAM,CAAG,CACjB,QACQ,CACP,EAAoB,CACrB,CACD,CCrEA,SAAgB,EAAK,EAAsB,EAAwB,EAAmB,CACrF,EAAK,EAAW,EAAQ,CAAE,IAAK,CAAM,CAAC,EACtC,EAAM,CACP,CAMA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AM,CAAE,YAAa,EAuBrB,MAlBA,GAAM,SAAW,IAAa,IAAA,GAC3B,GACA,MAAM,QAAQ,CAAQ,EACrB,EACA,CAAE,CAAS,EAGf,EAAM,MAAQ,EAGV,OAAO,GAAuB,UACjC,EAAM,GAAe,EACrB,EAAM,GAAc,GAGpB,EAAM,GAAe,EAGf,CACR,CAeA,SAAgB,GACf,EACA,EACA,EACC,CAgBD,MAXA,GAAM,MAAQ,EAGV,OAAO,GAAuB,UACjC,EAAM,GAAe,EACrB,EAAM,GAAc,GAGpB,EAAM,GAAe,EAGf,CACR"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Component, Fragment, JsxResult, PropsType } from "@calmdown/pyxis/core";
|
|
2
|
+
|
|
3
|
+
export interface DevSourceInfo {
|
|
4
|
+
readonly fileName: string;
|
|
5
|
+
readonly lineNumber: number;
|
|
6
|
+
readonly columnNumber: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const S_DEV_INFO: unique symbol;
|
|
10
|
+
|
|
11
|
+
export function jsxDEV(
|
|
12
|
+
tagName: string,
|
|
13
|
+
props: PropsType,
|
|
14
|
+
key?: any,
|
|
15
|
+
isStaticChildren?: boolean,
|
|
16
|
+
source?: DevSourceInfo,
|
|
17
|
+
self?: any,
|
|
18
|
+
): JsxResult;
|
|
19
|
+
|
|
20
|
+
export function jsxDEV<TProps extends PropsType>(
|
|
21
|
+
tagName: Component<TProps>,
|
|
22
|
+
props: PropsType,
|
|
23
|
+
key?: any,
|
|
24
|
+
isStaticChildren?: boolean,
|
|
25
|
+
source?: DevSourceInfo,
|
|
26
|
+
self?: any,
|
|
27
|
+
): JsxResult;
|
|
28
|
+
|
|
29
|
+
export { Fragment };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "@calmdown/pyxis/core";
|
|
2
|
+
|
|
3
|
+
const S_DEV_INFO = Symbol.for("pyxis:devInfo");
|
|
4
|
+
|
|
5
|
+
function jsxDEV(componentOrTagName, props, key, isStaticChildren, source) {
|
|
6
|
+
props[S_DEV_INFO] = source;
|
|
7
|
+
return (isStaticChildren ? jsxs : jsx)(componentOrTagName, props, key);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { Fragment, jsxDEV, S_DEV_INFO };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Fragment, jsx, jsxs } from "@calmdown/pyxis/core";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Fragment, jsx, jsxs } from "@calmdown/pyxis/core";
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export {
|
|
2
|
+
ChangeKind,
|
|
3
|
+
Fragment,
|
|
4
|
+
Iterator,
|
|
5
|
+
RefExtension,
|
|
6
|
+
Show,
|
|
7
|
+
atomOf,
|
|
8
|
+
component,
|
|
9
|
+
consumerOf,
|
|
10
|
+
createContext,
|
|
11
|
+
derived,
|
|
12
|
+
effect,
|
|
13
|
+
host,
|
|
14
|
+
isAtom,
|
|
15
|
+
listOf,
|
|
16
|
+
mounted,
|
|
17
|
+
peek,
|
|
18
|
+
peeks,
|
|
19
|
+
pyxis,
|
|
20
|
+
read,
|
|
21
|
+
reads,
|
|
22
|
+
sync,
|
|
23
|
+
tick,
|
|
24
|
+
tock,
|
|
25
|
+
unmounted,
|
|
26
|
+
update,
|
|
27
|
+
write,
|
|
28
|
+
type Adapter,
|
|
29
|
+
type Atom,
|
|
30
|
+
type Component,
|
|
31
|
+
type Context,
|
|
32
|
+
type DataTemplate,
|
|
33
|
+
type Derivation,
|
|
34
|
+
type EffectBlock,
|
|
35
|
+
type ElementsOf,
|
|
36
|
+
type Equals,
|
|
37
|
+
type Extension,
|
|
38
|
+
type FragmentProps,
|
|
39
|
+
type JsxChildren,
|
|
40
|
+
type JsxResult,
|
|
41
|
+
type List,
|
|
42
|
+
type ListChange,
|
|
43
|
+
type ListCleared,
|
|
44
|
+
type ListDelta,
|
|
45
|
+
type ListItemChanged,
|
|
46
|
+
type ListItemInserted,
|
|
47
|
+
type ListItemRemoved,
|
|
48
|
+
type MaybeAtom,
|
|
49
|
+
type MaybeReadonlyAtom,
|
|
50
|
+
type MountBlock,
|
|
51
|
+
type PropsOf,
|
|
52
|
+
type PropsType,
|
|
53
|
+
type Proxied,
|
|
54
|
+
type ProxyAtom,
|
|
55
|
+
type ProxyIteratorProps,
|
|
56
|
+
type PyxisBuilder,
|
|
57
|
+
type ReadonlyAtom,
|
|
58
|
+
type ReadonlyList,
|
|
59
|
+
type RefExtensionType,
|
|
60
|
+
type RefFn,
|
|
61
|
+
type RemountIteratorProps,
|
|
62
|
+
type ShowProps,
|
|
63
|
+
type UnmountBlock,
|
|
64
|
+
type WithChildren,
|
|
65
|
+
} from "@calmdown/pyxis/core";
|
package/dist/main.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export {
|
|
2
|
+
ChangeKind,
|
|
3
|
+
Fragment,
|
|
4
|
+
Iterator,
|
|
5
|
+
RefExtension,
|
|
6
|
+
Show,
|
|
7
|
+
atomOf,
|
|
8
|
+
component,
|
|
9
|
+
consumerOf,
|
|
10
|
+
createContext,
|
|
11
|
+
derived,
|
|
12
|
+
effect,
|
|
13
|
+
host,
|
|
14
|
+
isAtom,
|
|
15
|
+
listOf,
|
|
16
|
+
mounted,
|
|
17
|
+
peek,
|
|
18
|
+
peeks,
|
|
19
|
+
pyxis,
|
|
20
|
+
read,
|
|
21
|
+
reads,
|
|
22
|
+
sync,
|
|
23
|
+
tick,
|
|
24
|
+
tock,
|
|
25
|
+
unmounted,
|
|
26
|
+
update,
|
|
27
|
+
write
|
|
28
|
+
} from "@calmdown/pyxis/core";
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@calmdown/pyxis",
|
|
3
|
+
"version": "1.0.0-rc.1",
|
|
4
|
+
"license": "ISC",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"import": "./dist/main.js",
|
|
9
|
+
"types": "./dist/main.d.ts"
|
|
10
|
+
},
|
|
11
|
+
"./core": {
|
|
12
|
+
"import": "./dist/core.js",
|
|
13
|
+
"types": "./dist/core.d.ts"
|
|
14
|
+
},
|
|
15
|
+
"./core-dev": {
|
|
16
|
+
"import": "./dist/core-dev.js",
|
|
17
|
+
"types": "./dist/core-dev.d.ts"
|
|
18
|
+
},
|
|
19
|
+
"./jsx-runtime": {
|
|
20
|
+
"import": "./dist/jsx-runtime.js",
|
|
21
|
+
"types": "./dist/jsx-runtime.d.ts"
|
|
22
|
+
},
|
|
23
|
+
"./jsx-dev-runtime": {
|
|
24
|
+
"import": "./dist/jsx-dev-runtime.js",
|
|
25
|
+
"types": "./dist/jsx-dev-runtime.d.ts"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"typescript": "6.0.3",
|
|
30
|
+
"build-logic": "0.0.0"
|
|
31
|
+
}
|
|
32
|
+
}
|