flexium 0.8.14

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.
Files changed (154) hide show
  1. package/README.md +219 -0
  2. package/dist/DrawText-CeXBL8Ev.d.ts +309 -0
  3. package/dist/DrawText-JB58mpQT.d.cts +309 -0
  4. package/dist/Motion-BrOAJzgH.d.cts +87 -0
  5. package/dist/Motion-BrOAJzgH.d.ts +87 -0
  6. package/dist/advanced.d.cts +30 -0
  7. package/dist/advanced.d.ts +30 -0
  8. package/dist/advanced.js +2 -0
  9. package/dist/advanced.js.map +1 -0
  10. package/dist/advanced.mjs +2 -0
  11. package/dist/advanced.mjs.map +1 -0
  12. package/dist/canvas.d.cts +22 -0
  13. package/dist/canvas.d.ts +22 -0
  14. package/dist/canvas.js +2 -0
  15. package/dist/canvas.js.map +1 -0
  16. package/dist/canvas.mjs +2 -0
  17. package/dist/canvas.mjs.map +1 -0
  18. package/dist/chunk-2MVKTSFR.mjs +3 -0
  19. package/dist/chunk-2MVKTSFR.mjs.map +1 -0
  20. package/dist/chunk-2U4DW375.mjs +2 -0
  21. package/dist/chunk-2U4DW375.mjs.map +1 -0
  22. package/dist/chunk-3P6DMEGB.js +2 -0
  23. package/dist/chunk-3P6DMEGB.js.map +1 -0
  24. package/dist/chunk-5S3ZQ2LB.mjs +3 -0
  25. package/dist/chunk-5S3ZQ2LB.mjs.map +1 -0
  26. package/dist/chunk-CNY6FPKJ.js +2 -0
  27. package/dist/chunk-CNY6FPKJ.js.map +1 -0
  28. package/dist/chunk-CZYIK6FD.mjs +2 -0
  29. package/dist/chunk-CZYIK6FD.mjs.map +1 -0
  30. package/dist/chunk-DOGIWSDA.js +2 -0
  31. package/dist/chunk-DOGIWSDA.js.map +1 -0
  32. package/dist/chunk-EX2GURH5.mjs +3 -0
  33. package/dist/chunk-EX2GURH5.mjs.map +1 -0
  34. package/dist/chunk-GDBJ322I.js +2 -0
  35. package/dist/chunk-GDBJ322I.js.map +1 -0
  36. package/dist/chunk-I7UCVARB.js +2 -0
  37. package/dist/chunk-I7UCVARB.js.map +1 -0
  38. package/dist/chunk-KNF5ERPK.mjs +2 -0
  39. package/dist/chunk-KNF5ERPK.mjs.map +1 -0
  40. package/dist/chunk-MLZTCKTH.mjs +2 -0
  41. package/dist/chunk-MLZTCKTH.mjs.map +1 -0
  42. package/dist/chunk-OPAQ4R4M.mjs +2 -0
  43. package/dist/chunk-OPAQ4R4M.mjs.map +1 -0
  44. package/dist/chunk-Q7IWDVJ4.js +2 -0
  45. package/dist/chunk-Q7IWDVJ4.js.map +1 -0
  46. package/dist/chunk-R5CS7UZG.mjs +2 -0
  47. package/dist/chunk-R5CS7UZG.mjs.map +1 -0
  48. package/dist/chunk-REETNY2Z.js +3 -0
  49. package/dist/chunk-REETNY2Z.js.map +1 -0
  50. package/dist/chunk-ROYFUJN5.js +3 -0
  51. package/dist/chunk-ROYFUJN5.js.map +1 -0
  52. package/dist/chunk-U6C6VDVZ.js +2 -0
  53. package/dist/chunk-U6C6VDVZ.js.map +1 -0
  54. package/dist/chunk-V4K6WOXN.js +3 -0
  55. package/dist/chunk-V4K6WOXN.js.map +1 -0
  56. package/dist/chunk-WQFQO5LK.js +2 -0
  57. package/dist/chunk-WQFQO5LK.js.map +1 -0
  58. package/dist/chunk-WVEJT7HD.mjs +2 -0
  59. package/dist/chunk-WVEJT7HD.mjs.map +1 -0
  60. package/dist/chunk-ZNPYN2TZ.mjs +2 -0
  61. package/dist/chunk-ZNPYN2TZ.mjs.map +1 -0
  62. package/dist/core.d.cts +24 -0
  63. package/dist/core.d.ts +24 -0
  64. package/dist/core.js +2 -0
  65. package/dist/core.js.map +1 -0
  66. package/dist/core.mjs +2 -0
  67. package/dist/core.mjs.map +1 -0
  68. package/dist/dom.d.cts +36 -0
  69. package/dist/dom.d.ts +36 -0
  70. package/dist/dom.js +2 -0
  71. package/dist/dom.js.map +1 -0
  72. package/dist/dom.mjs +2 -0
  73. package/dist/dom.mjs.map +1 -0
  74. package/dist/index.d.cts +26 -0
  75. package/dist/index.d.ts +26 -0
  76. package/dist/index.js +2 -0
  77. package/dist/index.js.map +1 -0
  78. package/dist/index.mjs +2 -0
  79. package/dist/index.mjs.map +1 -0
  80. package/dist/interactive.d.cts +161 -0
  81. package/dist/interactive.d.ts +161 -0
  82. package/dist/interactive.js +2 -0
  83. package/dist/interactive.js.map +1 -0
  84. package/dist/interactive.mjs +2 -0
  85. package/dist/interactive.mjs.map +1 -0
  86. package/dist/jsx-dev-runtime.d.cts +2 -0
  87. package/dist/jsx-dev-runtime.d.ts +2 -0
  88. package/dist/jsx-dev-runtime.js +2 -0
  89. package/dist/jsx-dev-runtime.js.map +1 -0
  90. package/dist/jsx-dev-runtime.mjs +2 -0
  91. package/dist/jsx-dev-runtime.mjs.map +1 -0
  92. package/dist/jsx-runtime.d.cts +78 -0
  93. package/dist/jsx-runtime.d.ts +78 -0
  94. package/dist/jsx-runtime.js +2 -0
  95. package/dist/jsx-runtime.js.map +1 -0
  96. package/dist/jsx-runtime.mjs +2 -0
  97. package/dist/jsx-runtime.mjs.map +1 -0
  98. package/dist/metafile-cjs.json +1 -0
  99. package/dist/metafile-esm.json +1 -0
  100. package/dist/portal-BpcIlK9y.d.cts +206 -0
  101. package/dist/portal-DBwz7gD0.d.ts +206 -0
  102. package/dist/primitives/layout.d.cts +295 -0
  103. package/dist/primitives/layout.d.ts +295 -0
  104. package/dist/primitives/layout.js +2 -0
  105. package/dist/primitives/layout.js.map +1 -0
  106. package/dist/primitives/layout.mjs +2 -0
  107. package/dist/primitives/layout.mjs.map +1 -0
  108. package/dist/primitives/motion.d.cts +230 -0
  109. package/dist/primitives/motion.d.ts +230 -0
  110. package/dist/primitives/motion.js +2 -0
  111. package/dist/primitives/motion.js.map +1 -0
  112. package/dist/primitives/motion.mjs +2 -0
  113. package/dist/primitives/motion.mjs.map +1 -0
  114. package/dist/primitives/ui.d.cts +81 -0
  115. package/dist/primitives/ui.d.ts +81 -0
  116. package/dist/primitives/ui.js +2 -0
  117. package/dist/primitives/ui.js.map +1 -0
  118. package/dist/primitives/ui.mjs +2 -0
  119. package/dist/primitives/ui.mjs.map +1 -0
  120. package/dist/primitives.d.cts +92 -0
  121. package/dist/primitives.d.ts +92 -0
  122. package/dist/primitives.js +2 -0
  123. package/dist/primitives.js.map +1 -0
  124. package/dist/primitives.mjs +2 -0
  125. package/dist/primitives.mjs.map +1 -0
  126. package/dist/renderer-DSLb-FGg.d.cts +135 -0
  127. package/dist/renderer-DSLb-FGg.d.ts +135 -0
  128. package/dist/router.d.cts +126 -0
  129. package/dist/router.d.ts +126 -0
  130. package/dist/router.js +2 -0
  131. package/dist/router.js.map +1 -0
  132. package/dist/router.mjs +2 -0
  133. package/dist/router.mjs.map +1 -0
  134. package/dist/server.d.cts +3 -0
  135. package/dist/server.d.ts +3 -0
  136. package/dist/server.js +2 -0
  137. package/dist/server.js.map +1 -0
  138. package/dist/server.mjs +2 -0
  139. package/dist/server.mjs.map +1 -0
  140. package/dist/signal-PWBIM6JV.mjs +2 -0
  141. package/dist/signal-PWBIM6JV.mjs.map +1 -0
  142. package/dist/signal-XZXQ4VYQ.js +2 -0
  143. package/dist/signal-XZXQ4VYQ.js.map +1 -0
  144. package/dist/signal-mNtlF8-v.d.cts +158 -0
  145. package/dist/signal-mNtlF8-v.d.ts +158 -0
  146. package/dist/state-kK9sQh9s.d.cts +73 -0
  147. package/dist/state-kK9sQh9s.d.ts +73 -0
  148. package/dist/test-exports.d.cts +17 -0
  149. package/dist/test-exports.d.ts +17 -0
  150. package/dist/test-exports.js +2 -0
  151. package/dist/test-exports.js.map +1 -0
  152. package/dist/test-exports.mjs +2 -0
  153. package/dist/test-exports.mjs.map +1 -0
  154. package/package.json +173 -0
@@ -0,0 +1,3 @@
1
+ import {c as c$2}from'./chunk-CZYIK6FD.mjs';import {d,e,b as b$2,c as c$1,a as a$1}from'./chunk-2U4DW375.mjs';import {c}from'./chunk-WVEJT7HD.mjs';import {j as j$1,b as b$1,a,n,m,o,h}from'./chunk-5S3ZQ2LB.mjs';var ae=new Set,fe=new Set(["focus","blur","mouseenter","mouseleave","load","unload","scroll"]),j=new WeakMap;function Ee(e){e.target;let n=e.type.toLowerCase(),o=!fe.has(n),i=e.composedPath?.()||[],r=e.target;if(i.length===0&&r)for(;r;)i.push(r),r=r.parentNode;for(let l of i){let a$1=l;if(a$1===document||!a$1)break;let d=j.get(a$1);if(d?.has(n)){let s=d.get(n);if(s){try{s(e);}catch(c){b$1(a.EVENT_HANDLER_FAILED,{eventType:n},c);}if(e.cancelBubble)return}}if(!o)break}}function Se(e){if(!(typeof document>"u")&&!ae.has(e)){let t=fe.has(e);document.addEventListener(e,Ee,{capture:t}),ae.add(e);}}var J={on(e,t,n){let o=t.toLowerCase(),i=j.get(e);i||(i=new Map,j.set(e,i)),i.set(o,n),Se(o);},off(e,t){let n=t.toLowerCase(),o=j.get(e);o&&o.delete(n);}};var z={width:{cssProp:"width",transform:"px"},height:{cssProp:"height",transform:"px"},flexDirection:{cssProp:"flexDirection",transform:"none"},justifyContent:{cssProp:"justifyContent",transform:"none"},alignItems:{cssProp:"alignItems",transform:"none"},alignSelf:{cssProp:"alignSelf",transform:"none"},flexWrap:{cssProp:"flexWrap",transform:"none"},flex:{cssProp:"flex",transform:"string"},gap:{cssProp:"gap",transform:"px"},justify:{cssProp:"justifyContent",transform:"none"},align:{cssProp:"alignItems",transform:"none"},bg:{cssProp:"backgroundColor",transform:"none"},color:{cssProp:"color",transform:"none"},borderRadius:{cssProp:"borderRadius",transform:"px"},borderWidth:{cssProp:"borderWidth",transform:"px",sideEffect:(e,t)=>{t!==void 0&&e.borderStyle!=="solid"&&(e.borderStyle="solid");}},borderColor:{cssProp:"borderColor",transform:"none"},opacity:{cssProp:"opacity",transform:"string"},fontSize:{cssProp:"fontSize",transform:"px"},fontWeight:{cssProp:"fontWeight",transform:"string"},fontFamily:{cssProp:"fontFamily",transform:"none"},lineHeight:{cssProp:"lineHeight",transform:"string"},textAlign:{cssProp:"textAlign",transform:"none"},padding:{cssProp:"padding",transform:"px"},paddingTop:{cssProp:"paddingTop",transform:"px"},paddingRight:{cssProp:"paddingRight",transform:"px"},paddingBottom:{cssProp:"paddingBottom",transform:"px"},paddingLeft:{cssProp:"paddingLeft",transform:"px"},margin:{cssProp:"margin",transform:"px"},marginTop:{cssProp:"marginTop",transform:"px"},marginRight:{cssProp:"marginRight",transform:"px"},marginBottom:{cssProp:"marginBottom",transform:"px"},marginLeft:{cssProp:"marginLeft",transform:"px"}},pe={Row:"div",Column:"div",Stack:"div",Text:"span",Button:"button",Input:"input",Container:"div"},K={onPress:"click",onHover:"mouseenter",onChange:"input",onFocus:"focus",onBlur:"blur"},ue=new Set(["children","key","ref","className","style","width","height","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","margin","marginTop","marginRight","marginBottom","marginLeft","gap","flex","flexDirection","flexWrap","justifyContent","alignItems","alignSelf","align","justify","bg","color","borderRadius","borderWidth","borderColor","opacity","fontSize","fontWeight","fontFamily","lineHeight","textAlign"]),Te="http://www.w3.org/2000/svg",Le=new Set(["svg","path","circle","rect","line","polyline","polygon","ellipse","g","text","tspan","defs","use","symbol","marker","linearGradient","radialGradient","stop","clipPath","pattern","mask","filter"]),ke={viewBox:"viewBox",preserveAspectRatio:"preserveAspectRatio",strokeWidth:"stroke-width",strokeLinecap:"stroke-linecap",strokeLinejoin:"stroke-linejoin",strokeDasharray:"stroke-dasharray",strokeDashoffset:"stroke-dashoffset",fillOpacity:"fill-opacity",strokeOpacity:"stroke-opacity",stopColor:"stop-color",stopOpacity:"stop-opacity",clipPath:"clip-path",markerEnd:"marker-end",markerStart:"marker-start",markerMid:"marker-mid"};function Ae(e){return typeof e=="number"?`${e}px`:e}var me=new Map;function ge(e){let t=me.get(e);return t===void 0&&(t=e.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`),me.set(e,t)),t}function Re(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function we(e,t){if(e!=null)switch(t){case "px":return Ae(e);case "string":return String(e);case "none":default:return e}}function Fe(e,t,n){let o=e.style,i=t.style,r=n.style;if(i!==r){if(i&&typeof i=="object")for(let d in i)(!r||!(d in r))&&o.setProperty(ge(d),"");if(r&&typeof r=="object")for(let d in r){let s=r[d];(!i||i[d]!==s)&&o.setProperty(ge(d),s);}}let l=e.getAttribute("data-flexium-type");(n.flexDirection||n.justifyContent||n.alignItems||n.flexWrap||n.gap!==void 0||n.justify||n.align||l==="Row"||l==="Column"||l==="Stack")&&(o.display!=="flex"&&(o.display="flex"),l==="Row"&&o.flexDirection!=="row"&&(o.flexDirection="row"),l==="Column"&&o.flexDirection!=="column"&&(o.flexDirection="column"));for(let d in t)if(d in z&&!(d in n)){let s=z[d],c=s.cssProp;o[c]!==""&&(o[c]=""),s.sideEffect&&s.sideEffect(o,void 0);}for(let d in n)if(d in z){let s=t[d],c=n[d];if(s===c)continue;let p=z[d],m=we(c,p.transform),f=p.cssProp;m===void 0?o[f]!==""&&(o[f]=""):o[f]!==m&&(o[f]=m),p.sideEffect&&p.sideEffect(o,m);}}function he(e){if(typeof e=="string")return e;if(Array.isArray(e)){let t="";for(let n=0;n<e.length;n++){let o=e[n];if(!o)continue;let i=typeof o=="string"?o:he(o);i&&(t=t?`${t} ${i}`:i);}return t}if(typeof e=="object"&&e!==null){let t="";for(let n in e)e[n]&&(t=t?`${t} ${n}`:n);return t}return ""}var Q=class{createNode(t,n){let o=pe[t]??t,i;return Le.has(o)?i=document.createElementNS(Te,o):i=document.createElement(o),pe[t]&&i.setAttribute("data-flexium-type",t),this.updateNode(i,{},n),i}updateNode(t,n,o){if(o.className!==n.className){let r=he(o.className);t instanceof SVGElement?t.setAttribute("class",r):t.className=r;}Fe(t,n,o);for(let r in n)if(!(r in o)){if(typeof r=="symbol")continue;if(r.startsWith("on")){let l=K[r]||r.slice(2).toLowerCase();this.removeEventListener(t,l,n[r]);}else ue.has(r)||t.removeAttribute(r);}let i=Reflect.ownKeys(o);for(let r of i){if(typeof r=="symbol")continue;let l=r,a=o[l],d=n[l];if(a!==d){if(l.startsWith("on")){let s=K[l]||l.slice(2).toLowerCase();d&&this.removeEventListener(t,s,d),a&&this.addEventListener(t,s,a);}else if(!ue.has(l))if(a==null||a===false)t.removeAttribute(l);else if(a===true)t.setAttribute(l,"");else {let s=ke[l]||l;t.setAttribute(s,Re(String(a)));}}}}appendChild(t,n){t.appendChild(n);}insertBefore(t,n,o){t.insertBefore(n,o);}nextSibling(t){return t.nextSibling}removeChild(t,n){t.removeChild(n);}createTextNode(t){return document.createTextNode(t)}updateTextNode(t,n){t.textContent=n;}addEventListener(t,n,o){let i=K[n]||n;J.on(t,i,o);}removeEventListener(t,n,o){let i=K[n]||n;J.off(t,i);}},g=new Q;var ee=Symbol("flexium.list");function te(e){return e!==null&&typeof e=="object"&&ee in e&&e[ee]===true}function Pe(e,t){return typeof e=="number"?e:e.mode==="fixed"?e.itemHeight:e.estimatedItemHeight}function De(e,t,n,o,i){let r=o*n;if(o===0)return {startIndex:0,endIndex:-1,totalHeight:0};let l=Math.floor(e/n),a=Math.ceil(t/n),d=l+a;return {startIndex:Math.max(0,l-i),endIndex:Math.min(o-1,d+i),totalHeight:r}}function ne(e,t,n,o){return e.virtual?Ie(e,t,n,o):Me(e,t,n,o)}function Me(e,t,n,o){let{each:i,renderItem:r,getKey:l,class:a,style:d}=e,s=document.createElement("div");s.setAttribute("role","list"),a&&(s.className=a),d&&Object.entries(d).forEach(([f,u])=>{s.style[f]=typeof u=="number"?`${u}px`:u;}),t.appendChild(s);let c=new Map,p=(f,u)=>l?l(f,u):u,m=j$1(()=>{let f=i()||[],u=new Set;f.forEach((L,h$1)=>{let E=p(L,h$1);if(u.add(E),!c.has(E)){let x=h(h$1),S=r(L,()=>x()),v=n(S);v&&v instanceof HTMLElement&&(v.setAttribute("role","listitem"),s.appendChild(v),c.set(E,{node:v,dispose:()=>{try{o(v);}catch{}}}));}});for(let[L,h]of c)u.has(L)||(h.dispose(),h.node.parentNode===s&&s.removeChild(h.node),c.delete(L));});return ()=>{m();for(let f of c.values())f.dispose();c.clear(),s.parentNode===t&&t.removeChild(s);}}function Ie(e,t,n,o){let{each:i,renderItem:r,height:l,width:a,itemSize:d,overscan:s,getKey:c,onScroll:p,onVisibleRangeChange:m}=e;if(!l||!d)return console.warn("List: height and itemSize are required when virtual is true"),()=>{};let f=document.createElement("div");f.style.height=typeof l=="number"?`${l}px`:l,f.style.width=a?typeof a=="number"?`${a}px`:a:"100%",f.style.overflow="auto",f.style.position="relative",f.setAttribute("role","list"),f.setAttribute("tabindex","0");let u=document.createElement("div");u.style.position="relative",u.style.width="100%",u.style.willChange="transform",f.appendChild(u),t.appendChild(f);let L=h(0),h$1=new Map,E=-1,x=-1,S=()=>{L.set(f.scrollTop),p?.(f.scrollTop);};f.addEventListener("scroll",S,{passive:true});let v=(R,_)=>c?c(R,_):_,xe=j$1(()=>{let R=i()||[],_=L(),Ce=f.clientHeight||parseFloat(String(l)),H=Pe(d),{startIndex:B,endIndex:V,totalHeight:be}=De(_,Ce,H,R.length,s);u.style.height=`${be}px`,f.setAttribute("aria-rowcount",String(R.length)),(B!==E||V!==x)&&(m?.(B,V),E=B,x=V);let oe=new Set;for(let N=B;N<=V&&N<R.length;N++){let F=R[N],G=v(F,N);oe.add(G);let P=h$1.get(G);if(P){P.indexSig.peek()!==N&&P.indexSig.set(N);let M=P.node;M.style.transform=`translateY(${N*H}px)`,M.setAttribute("aria-rowindex",String(N+1));}else {let M=h(N),ve=r(F,()=>M()),C=n(ve);C&&C instanceof HTMLElement&&(C.style.position="absolute",C.style.top="0",C.style.left="0",C.style.right="0",C.style.transform=`translateY(${N*H}px)`,C.style.height=`${H}px`,C.style.boxSizing="border-box",C.setAttribute("role","listitem"),C.setAttribute("aria-rowindex",String(N+1)),u.appendChild(C),P={item:F,key:G,node:C,indexSig:M,dispose:()=>{try{o(C);}catch{}}},h$1.set(G,P));}}for(let[N,F]of h$1)oe.has(N)||(F.dispose(),F.node.parentNode===u&&u.removeChild(F.node),h$1.delete(N));});return ()=>{xe(),f.removeEventListener("scroll",S);for(let R of h$1.values())R.dispose();h$1.clear(),f.parentNode===t&&t.removeChild(f);}}var ye=new WeakMap;function w(e){return ye.get(e)}function D(e,t){ye.set(e,t);}function U(e,t,n,o){let i=t&&t.length>0,r=n&&n.length>0;if(!i&&!r)return;if(!r){for(let s of t){let c=s&&w(s);c&&(b(c),g.removeChild(e,c));}return}if(!i){let s=document.createDocumentFragment();for(let c of n){let p=y(c,void 0);p&&(D(c,p),s.appendChild(p));}o?e.insertBefore(s,o):e.appendChild(s);return}let l=new Map;for(let s=0;s<t.length;s++){let c=t[s],p=c.key??`__idx_${s}_${c.type}`;l.set(p,c);}let a=new Set,d=e.firstChild;for(let s=0;s<n.length;s++){let c=n[s],p=c.key??`__idx_${s}_${c.type}`;a.add(p);let m=l.get(p),f=d;if(!m||m.type!==c.type){let u=y(c,void 0);u&&(D(c,u),e.insertBefore(u,f));}else {_e(m,c);let u=w(c);u&&(d!==u?e.insertBefore(u,f):d=d?.nextSibling||null);}}for(let[s,c]of l){let p=w(c);!a.has(s)&&p&&(b(p),p.parentNode===e&&g.removeChild(e,p));}}function _e(e,t){let n=w(e);if(!n||(D(t,n),typeof t.type!="string"))return;g.updateNode(n,e.props,t.props);let o=e.children||[],i=t.children||[];if(!(o.length===0&&i.length===0)){if(i.length===1&&(typeof i[0]=="string"||typeof i[0]=="number")&&n.firstChild?.nodeType===Node.TEXT_NODE&&n.childNodes.length===1){let r=String(i[0]);String(o[0])!==r&&g.updateTextNode(n.firstChild,r);return}U(n,o,i,null);}}var I=new WeakMap;function X(e,t){let n=I.get(e);n||(n=new Set,I.set(e,n)),n.add(t);}function y(e$1,t){if(e$1==null||typeof e$1=="boolean")return null;if(te(e$1)){let n=t||document.createDocumentFragment(),o=ne(e$1,n,r=>y(r),b),i=document.createTextNode("");return X(i,o),t?n.firstChild:n}if(d(e$1)){let n=e(e$1);if(n){let o=document.createTextNode(""),i=t||document.createDocumentFragment();g.appendChild(i,o);let r=o,l=j$1(()=>{let a$1=n.value,d=o.parentNode;if(d)if((typeof a$1=="string"||typeof a$1=="number")&&r&&r.nodeType===Node.TEXT_NODE&&r!==o)g.updateTextNode(r,String(a$1));else {let s=y(a$1);if(s)r&&r!==o&&r.parentNode===d?r.nodeType===Node.TEXT_NODE&&s.nodeType===Node.TEXT_NODE?g.updateTextNode(r,s.textContent||""):(d.replaceChild(s,r),r=s):(d.insertBefore(s,o.nextSibling),r=s);else {if(r&&r!==o&&r.parentNode===d)try{d.removeChild(r);}catch(c){b$1(a.DOM_CLEANUP_FAILED,{operation:"removeChild"},c);}r=o;}}});return X(o,l),t?o:i}}if(n(e$1)||typeof e$1=="function"){let n$1=document.createTextNode(""),o=t||document.createDocumentFragment();g.appendChild(o,n$1);let i=[],r=null,l=[],a$1=j$1(()=>{let d=n(e$1)?e$1.value:e$1(),s=n$1.parentNode;if(s){if(Array.isArray(d)){let c=d.filter(p=>p!=null);if(l.length>0){let p=n$1.nextSibling;U(s,l,c,p);}else {for(let m of i)if(b(m),m.parentNode===s)try{s.removeChild(m);}catch(f){b$1(a.DOM_CLEANUP_FAILED,{operation:"removeChild"},f);}i=[];let p=document.createDocumentFragment();for(let m of c){let f=y(m,p);f&&typeof m=="object"&&D(m,f);}i=Array.from(p.childNodes),s.insertBefore(p,n$1.nextSibling);}l=c,r=d;return}if(l.length>0){for(let c of l){let p=w(c);if(p&&p.parentNode===s){b(p);try{s.removeChild(p);}catch(m){b$1(a.DOM_CLEANUP_FAILED,{operation:"removeChild"},m);}}}l=[];}if(d!==r){for(let c of i)if(b(c),c.parentNode===s)try{s.removeChild(c);}catch(p){b$1(a.DOM_CLEANUP_FAILED,{operation:"removeChild"},p);}if(i=[],typeof d=="string"||typeof d=="number"){let c=g.createTextNode(String(d));s.insertBefore(c,n$1.nextSibling),i=[c];}else {let c=y(d);c&&(c.nodeType===Node.DOCUMENT_FRAGMENT_NODE?(i=Array.from(c.childNodes),s.insertBefore(c,n$1.nextSibling)):(s.insertBefore(c,n$1.nextSibling),i=[c]));}r=d;}}});return X(n$1,a$1),t?n$1:o}if(Array.isArray(e$1)){let n=document.createDocumentFragment();for(let o of e$1)y(o,n);return t&&g.appendChild(t,n),n}if(typeof e$1=="string"||typeof e$1=="number"){let n=g.createTextNode(String(e$1));return t&&g.appendChild(t,n),n}if(c(e$1)){if(typeof e$1.type=="function"){let i=e$1.type,r=document.createTextNode(""),l=t||document.createDocumentFragment();g.appendChild(l,r);let a$2=[],d=[],s=b$2(),c$3=j$1(()=>{c$1(s),m(p=>{o(p);let m=i._contextId;m&&c$2(m,e$1.props.value);let f;try{a$1(s),f=i({...e$1.props,children:e$1.children});}finally{a$1(null);}if(Array.isArray(f)&&f.every(x=>c(x)&&x.type!=="fragment")){let x=r.parentNode;if(x){let S=f;U(x,d,S,r.nextSibling),d=S,a$2=S.map(v=>w(v)).filter(v=>v!=null);return}}let h=r.parentNode;if(h){for(let x of a$2)if(b(x),x.parentNode===h)try{h.removeChild(x);}catch(S){b$1(a.DOM_CLEANUP_FAILED,{operation:"removeChild"},S);}}a$2=[],d=[];let E=document.createDocumentFragment();y(f,E),h&&(a$2=Array.from(E.childNodes),h.insertBefore(E,r.nextSibling));});});return X(r,c$3),t?r:l}if(e$1.type==="fragment"){let i=document.createDocumentFragment();for(let r of e$1.children)y(r,i);return t&&g.appendChild(t,i),i}let n=g.createNode(e$1.type,e$1.props),o$1=He(n,e$1.props);o$1.length>0&&I.set(n,new Set(o$1));for(let i of e$1.children)y(i,n);return t&&g.appendChild(t,n),n}return null}var Y=Symbol("uninitialized");function He(e,t){let n$1=[];for(let o in t){let i=t[o];if(!o.startsWith("on")){if(n(i)){let r=Y,l=j$1(()=>{let a=i.value;a!==r&&(g.updateNode(e,{[o]:r===Y?void 0:r},{[o]:a}),r=a);});n$1.push(l);continue}if(typeof i=="function"){let r=Y,l=j$1(()=>{try{let a=i();a!==r&&(g.updateNode(e,{[o]:r===Y?void 0:r},{[o]:a}),r=a);}catch(a$1){b$1(a.DOM_CLEANUP_FAILED,{operation:"updateNode",prop:o},a$1);}});n$1.push(l);}}}return n$1}function b(e){let t=I.get(e);if(t&&(t.forEach(n=>n()),I.delete(e)),e.childNodes&&e.childNodes.length>0){let n=Array.from(e.childNodes);for(let o of n)b(o);}}function Ne(e){let t=null,n=null;return {render(o){n&&(b(n),e.innerHTML="",n=null),t&&(t(),t=null),t=j$1(()=>{e.innerHTML="",n=y(o,e);});},unmount(){t&&(t(),t=null),b(e),e.innerHTML="";}}}function at(e,t){return t.innerHTML="",y(e,t)}function ft(e){return Ne(e)}function gt(e){if(typeof document>"u")return null;let t=e.mount||document.body,n=document.createComment("portal"),o$1=null;return o$1=y(e.children,t),o(()=>{o$1&&(b(o$1),o$1.parentNode===t&&t.removeChild(o$1));}),n}
2
+ export{Q as a,g as b,ee as c,te as d,y as e,Ne as f,at as g,ft as h,gt as i};//# sourceMappingURL=chunk-EX2GURH5.mjs.map
3
+ //# sourceMappingURL=chunk-EX2GURH5.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/renderers/dom/events.ts","../src/renderers/dom/index.ts","../src/primitives/List/List.ts","../src/renderers/dom/node-map.ts","../src/renderers/dom/reconcile.ts","../src/renderers/dom/reactive.ts","../src/renderers/dom/render.ts","../src/renderers/dom/portal.ts"],"names":["globalListeners","NON_BUBBLING_EVENTS","nodeHandlers","dispatchEvent","event","eventType","bubbles","path","current","node","targetNode","handlers","handler","error","logError","ErrorCodes","ensureGlobalListener","eventName","capture","eventDelegator","lowerEvent","STYLE_PROPS_CONFIG","style","value","ELEMENT_MAPPING","EVENT_MAPPING","SKIP_PROPS","SVG_NAMESPACE","SVG_TAGS","SVG_ATTR_MAP","px","kebabCache","toKebabCase","str","result","letter","escapeAttrValue","transformValue","transform","updateStyles","element","oldProps","newProps","oldStyle","newStyle","key","val","type","propName","config","cssProp","oldValue","newValue","transformedValue","normalizeClass","i","item","normalized","k","DOMRenderer","props","tagName","className","keys","strKey","newVal","oldVal","attrName","parent","child","beforeChild","text","domEvent","_handler","domRenderer","LIST_MARKER","isListComponent","getItemHeight","_index","calculateVisibleRangeFixed","scrollTop","viewportHeight","itemHeight","totalItems","overscan","totalHeight","start","visibleCount","end","mountListComponent","comp","mountFn","cleanupFn","mountVirtualList","mountSimpleList","each","renderItem","getKey","container","cache","getItemKey","index","disposeEffect","effect","list","currentKeys","indexSig","signal","vnode","entry","height","width","itemSize","onScroll","onVisibleRangeChange","innerContainer","scrollTopSig","prevStartIndex","prevEndIndex","handleScroll","currentScrollTop","startIndex","endIndex","visibleKeys","fnodeToNode","getNode","fnode","setNode","reconcileArrays","oldFNodes","newFNodes","nextSibling","hasOld","hasNew","cleanupReactive","fragment","newFNode","mountReactive","keyToOldFNode","seen","currentChild","oldFNode","refNode","patchNode","oldChildren","newChildren","newText","REACTIVE_BINDINGS","registerReactiveBinding","dispose","bindings","listDispose","childNode","marker","isStateValue","sig","getStateSignal","startNode","currentNode","currentContainer","newNode","e","isSignal","currentNodes","currentFNode","currentFNodeList","c","childFNode","textNode","isFNode","component","componentInstance","createComponentInstance","resetHookIndex","root","disposeRoot","onCleanup","contextId","pushProvider","setCurrentComponent","fn","n","currentParent","domNode","disposeProps","setupReactiveProps","UNINITIALIZED","disposers","prevValue","children","createReactiveRoot","rootDispose","currentRootNode","render","createRoot","Portal","placeholder","portalContent"],"mappings":"kNAIA,IAAMA,EAAAA,CAAkB,IAAI,GAAA,CAGtBC,EAAAA,CAAsB,IAAI,IAAI,CAClC,OAAA,CACA,MAAA,CACA,YAAA,CACA,YAAA,CACA,MAAA,CACA,SACA,QACF,CAAC,CAAA,CAIKC,CAAAA,CAAe,IAAI,OAAA,CAKzB,SAASC,EAAAA,CAAcC,CAAAA,CAAc,CACtBA,CAAAA,CAAM,WACbC,CAAAA,CAAYD,CAAAA,CAAM,IAAA,CAAK,WAAA,EAAY,CACnCE,CAAAA,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AM,CACVqB,MACF/D,CAAAA,CAAgB+D,GAAa,CAAA,CACzBA,GAAAA,CAAc,UAAA,GAAenG,CAAAA,EAC/BA,CAAAA,CAAU,WAAA,CAAYmG,GAAa,CAAA,EAGzC,CAAC,CAAA,CAEMD,CACT","file":"chunk-EX2GURH5.mjs","sourcesContent":["import type { EventHandler } from '../../core/renderer'\nimport { logError, ErrorCodes } from '../../core/errors'\n\n// Map of event names to global listener status\nconst globalListeners = new Set<string>()\n\n// Events that do not bubble and must be captured\nconst NON_BUBBLING_EVENTS = new Set([\n 'focus',\n 'blur',\n 'mouseenter',\n 'mouseleave',\n 'load',\n 'unload',\n 'scroll',\n])\n\n// WeakMap to store event handlers for each node\n// Key: DOM Node, Value: Map<EventName, Handler>\nconst nodeHandlers = new WeakMap<Node, Map<string, EventHandler>>()\n\n/**\n * Global event dispatcher that handles delegation\n */\nfunction dispatchEvent(event: Event) {\n let target = event.target as Node | null\n const eventType = event.type.toLowerCase()\n const bubbles = !NON_BUBBLING_EVENTS.has(eventType)\n\n // Use composedPath if available (handles Shadow DOM and is faster)\n // Fallback to parentNode traversal for older browsers\n const path = event.composedPath?.() || []\n let current: Node | null = event.target as Node\n\n if (path.length === 0 && current) {\n // Build path manually if composedPath not available\n while (current) {\n path.push(current)\n current = current.parentNode\n }\n }\n\n for (const node of path) {\n const targetNode = node as Node\n // Stop at document or if we hit the end\n if (targetNode === document || !targetNode) break\n\n const handlers = nodeHandlers.get(targetNode)\n if (handlers?.has(eventType)) {\n const handler = handlers.get(eventType)\n if (handler) {\n try {\n handler(event)\n } catch (error) {\n logError(ErrorCodes.EVENT_HANDLER_FAILED, { eventType }, error)\n }\n if (event.cancelBubble) return\n }\n }\n\n if (!bubbles) break\n }\n}\n\n/**\n * Register a global event listener for delegation\n */\nfunction ensureGlobalListener(eventName: string) {\n // SSR guard\n if (typeof document === 'undefined') return\n\n if (!globalListeners.has(eventName)) {\n const capture = NON_BUBBLING_EVENTS.has(eventName)\n document.addEventListener(eventName, dispatchEvent, { capture })\n globalListeners.add(eventName)\n }\n}\n\n/**\n * Clear all global event listeners (useful for SSR cleanup and testing)\n */\nexport function clearGlobalListeners(): void {\n // SSR guard\n if (typeof document === 'undefined') return\n\n for (const eventName of globalListeners) {\n const capture = NON_BUBBLING_EVENTS.has(eventName)\n document.removeEventListener(eventName, dispatchEvent, { capture })\n }\n globalListeners.clear()\n}\n\n/**\n * Event Delegation System\n */\nexport const eventDelegator = {\n /**\n * Attach an event handler to a node (virtual attachment)\n */\n on(node: Node, eventName: string, handler: EventHandler) {\n // normalize event name (e.g., 'click' -> 'click')\n const lowerEvent = eventName.toLowerCase()\n\n let handlers = nodeHandlers.get(node)\n if (!handlers) {\n handlers = new Map()\n nodeHandlers.set(node, handlers)\n }\n\n handlers.set(lowerEvent, handler)\n ensureGlobalListener(lowerEvent)\n },\n\n /**\n * Detach an event handler from a node\n */\n off(node: Node, eventName: string) {\n const lowerEvent = eventName.toLowerCase()\n const handlers = nodeHandlers.get(node)\n if (handlers) {\n handlers.delete(lowerEvent)\n }\n },\n}\n","import type { Renderer, EventHandler } from '../../core/renderer'\nimport { eventDelegator } from './events'\n\n/**\n * Style property configuration for data-driven updates\n */\ninterface StylePropConfig {\n /** CSS property name to set */\n cssProp: string\n /** Transform function (e.g., px for pixel values) */\n transform?: 'px' | 'string' | 'none'\n /** Additional side effect when setting this property */\n sideEffect?: (style: CSSStyleDeclaration, value: string | undefined) => void\n}\n\n/**\n * Data-driven style property mappings\n * Maps Flexium props to CSS properties with optional transformations\n */\nconst STYLE_PROPS_CONFIG: Record<string, StylePropConfig> = {\n // Layout\n width: { cssProp: 'width', transform: 'px' },\n height: { cssProp: 'height', transform: 'px' },\n\n // Flex properties\n flexDirection: { cssProp: 'flexDirection', transform: 'none' },\n justifyContent: { cssProp: 'justifyContent', transform: 'none' },\n alignItems: { cssProp: 'alignItems', transform: 'none' },\n alignSelf: { cssProp: 'alignSelf', transform: 'none' },\n flexWrap: { cssProp: 'flexWrap', transform: 'none' },\n flex: { cssProp: 'flex', transform: 'string' },\n gap: { cssProp: 'gap', transform: 'px' },\n\n // Shorthands\n justify: { cssProp: 'justifyContent', transform: 'none' },\n align: { cssProp: 'alignItems', transform: 'none' },\n\n // Visual\n bg: { cssProp: 'backgroundColor', transform: 'none' },\n color: { cssProp: 'color', transform: 'none' },\n borderRadius: { cssProp: 'borderRadius', transform: 'px' },\n borderWidth: {\n cssProp: 'borderWidth',\n transform: 'px',\n sideEffect: (style, value) => {\n if (value !== undefined && style.borderStyle !== 'solid') {\n style.borderStyle = 'solid'\n }\n },\n },\n borderColor: { cssProp: 'borderColor', transform: 'none' },\n opacity: { cssProp: 'opacity', transform: 'string' },\n\n // Typography\n fontSize: { cssProp: 'fontSize', transform: 'px' },\n fontWeight: { cssProp: 'fontWeight', transform: 'string' },\n fontFamily: { cssProp: 'fontFamily', transform: 'none' },\n lineHeight: { cssProp: 'lineHeight', transform: 'string' },\n textAlign: { cssProp: 'textAlign', transform: 'none' },\n\n // Padding\n padding: { cssProp: 'padding', transform: 'px' },\n paddingTop: { cssProp: 'paddingTop', transform: 'px' },\n paddingRight: { cssProp: 'paddingRight', transform: 'px' },\n paddingBottom: { cssProp: 'paddingBottom', transform: 'px' },\n paddingLeft: { cssProp: 'paddingLeft', transform: 'px' },\n\n // Margin\n margin: { cssProp: 'margin', transform: 'px' },\n marginTop: { cssProp: 'marginTop', transform: 'px' },\n marginRight: { cssProp: 'marginRight', transform: 'px' },\n marginBottom: { cssProp: 'marginBottom', transform: 'px' },\n marginLeft: { cssProp: 'marginLeft', transform: 'px' },\n}\n\n/**\n * Component type to HTML element mapping\n */\nconst ELEMENT_MAPPING: Record<string, string> = {\n Row: 'div',\n Column: 'div',\n Stack: 'div',\n Text: 'span',\n Button: 'button',\n Input: 'input',\n Container: 'div',\n}\n\n/**\n * Event name mapping (platform-agnostic to DOM)\n */\nconst EVENT_MAPPING: Record<string, string> = {\n onPress: 'click',\n onHover: 'mouseenter',\n onChange: 'input',\n onFocus: 'focus',\n onBlur: 'blur',\n}\n\n/**\n * Props that should not be set as DOM attributes\n */\nconst SKIP_PROPS = new Set([\n 'children',\n 'key',\n 'ref',\n 'className',\n 'style',\n // Layout props (handled via style)\n 'width',\n 'height',\n 'padding',\n 'paddingTop',\n 'paddingRight',\n 'paddingBottom',\n 'paddingLeft',\n 'margin',\n 'marginTop',\n 'marginRight',\n 'marginBottom',\n 'marginLeft',\n 'gap',\n 'flex',\n 'flexDirection',\n 'flexWrap',\n 'justifyContent',\n 'alignItems',\n 'alignSelf',\n // Shorthand flexbox props\n 'align',\n 'justify',\n // Visual props (handled via style)\n 'bg',\n 'color',\n 'borderRadius',\n 'borderWidth',\n 'borderColor',\n 'opacity',\n // Typography props\n 'fontSize',\n 'fontWeight',\n 'fontFamily',\n 'lineHeight',\n 'textAlign',\n])\n\n/**\n * SVG Namespace URI\n */\nconst SVG_NAMESPACE = 'http://www.w3.org/2000/svg'\n\n/**\n * Common SVG tags that require namespace\n */\nconst SVG_TAGS = new Set([\n 'svg',\n 'path',\n 'circle',\n 'rect',\n 'line',\n 'polyline',\n 'polygon',\n 'ellipse',\n 'g',\n 'text',\n 'tspan',\n 'defs',\n 'use',\n 'symbol',\n 'marker',\n 'linearGradient',\n 'radialGradient',\n 'stop',\n 'clipPath',\n 'pattern',\n 'mask',\n 'filter',\n])\n\n/**\n * SVG Attribute Case Mapping\n * React-like camelCase to SVG case-sensitive attributes\n */\nconst SVG_ATTR_MAP: Record<string, string> = {\n viewBox: 'viewBox',\n preserveAspectRatio: 'preserveAspectRatio',\n strokeWidth: 'stroke-width',\n strokeLinecap: 'stroke-linecap',\n strokeLinejoin: 'stroke-linejoin',\n strokeDasharray: 'stroke-dasharray',\n strokeDashoffset: 'stroke-dashoffset',\n fillOpacity: 'fill-opacity',\n strokeOpacity: 'stroke-opacity',\n stopColor: 'stop-color',\n stopOpacity: 'stop-opacity',\n clipPath: 'clip-path',\n markerEnd: 'marker-end',\n markerStart: 'marker-start',\n markerMid: 'marker-mid',\n}\n\n/**\n * Convert pixel value to CSS string\n */\nfunction px(value: number | string): string {\n return typeof value === 'number' ? `${value}px` : value\n}\n\n/**\n * Cache for camelCase to kebab-case conversions\n * Avoids repeated regex operations for common CSS properties\n */\nconst kebabCache = new Map<string, string>()\n\n/**\n * Convert camelCase to kebab-case for CSS property names\n * Uses memoization for performance\n */\nfunction toKebabCase(str: string): string {\n let result = kebabCache.get(str)\n if (result === undefined) {\n result = str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)\n kebabCache.set(str, result)\n }\n return result\n}\n\n/**\n * Escape special characters in HTML attribute values to prevent XSS\n * @param value - Attribute value to escape\n * @returns Escaped value safe for HTML attributes\n */\nexport function escapeAttrValue(value: string): string {\n return value\n .replace(/&/g, '&amp;')\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&#39;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n}\n\n/**\n * Transform a value based on the config type\n */\nfunction transformValue(\n value: unknown,\n transform: StylePropConfig['transform']\n): string | undefined {\n if (value === undefined || value === null) return undefined\n switch (transform) {\n case 'px':\n return px(value as number | string)\n case 'string':\n return String(value)\n case 'none':\n default:\n return value as string\n }\n}\n\n/**\n * Apply style props to DOM element efficiently\n */\nfunction updateStyles(\n element: HTMLElement | SVGElement,\n oldProps: Record<string, unknown>,\n newProps: Record<string, unknown>\n): void {\n const style = element.style\n\n // 1. Handle 'style' object prop\n const oldStyle = oldProps.style as Record<string, string> | undefined\n const newStyle = newProps.style as Record<string, string> | undefined\n\n if (oldStyle !== newStyle) {\n if (oldStyle && typeof oldStyle === 'object') {\n for (const key in oldStyle) {\n if (!newStyle || !(key in newStyle)) {\n // Convert camelCase to kebab-case for CSS property names\n style.setProperty(toKebabCase(key), '')\n }\n }\n }\n if (newStyle && typeof newStyle === 'object') {\n for (const key in newStyle) {\n const val = newStyle[key]\n if (!oldStyle || oldStyle[key] !== val) {\n // Convert camelCase to kebab-case for CSS property names\n style.setProperty(toKebabCase(key), val)\n }\n }\n }\n }\n\n // 2. Flexbox setup (display: flex)\n const type = element.getAttribute('data-flexium-type')\n const needsFlex =\n newProps.flexDirection ||\n newProps.justifyContent ||\n newProps.alignItems ||\n newProps.flexWrap ||\n newProps.gap !== undefined ||\n newProps.justify ||\n newProps.align ||\n type === 'Row' ||\n type === 'Column' ||\n type === 'Stack'\n\n if (needsFlex) {\n if (style.display !== 'flex') style.display = 'flex'\n if (type === 'Row' && style.flexDirection !== 'row')\n style.flexDirection = 'row'\n if (type === 'Column' && style.flexDirection !== 'column')\n style.flexDirection = 'column'\n }\n\n // 3. Handle Flexium specific style props - only check props that exist\n // Optimized: iterate directly without creating intermediate Set\n\n // Check oldProps for removed style props\n for (const propName in oldProps) {\n if (propName in STYLE_PROPS_CONFIG && !(propName in newProps)) {\n const config = STYLE_PROPS_CONFIG[propName]\n const cssProp = config.cssProp as keyof CSSStyleDeclaration\n\n if (style[cssProp] !== '') {\n ; (style as unknown as Record<string, string>)[cssProp as string] = ''\n }\n\n // Apply any side effects\n if (config.sideEffect) {\n config.sideEffect(style, undefined)\n }\n }\n }\n\n // Check newProps for added/updated style props\n for (const propName in newProps) {\n if (propName in STYLE_PROPS_CONFIG) {\n const oldValue = oldProps[propName]\n const newValue = newProps[propName]\n\n if (oldValue === newValue) continue\n\n const config = STYLE_PROPS_CONFIG[propName]\n const transformedValue = transformValue(newValue, config.transform)\n const cssProp = config.cssProp as keyof CSSStyleDeclaration\n\n // Update the style property\n if (transformedValue === undefined) {\n if (style[cssProp] !== '') {\n ; (style as unknown as Record<string, string>)[cssProp as string] = ''\n }\n } else {\n if (style[cssProp] !== transformedValue) {\n ; (style as unknown as Record<string, string>)[cssProp as string] =\n transformedValue\n }\n }\n\n // Apply any side effects\n if (config.sideEffect) {\n config.sideEffect(style, transformedValue)\n }\n }\n }\n}\n\n/**\n * Normalize className prop (supports string, array, object)\n * Optimized single-pass implementation without recursion overhead\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction normalizeClass(value: any): string {\n if (typeof value === 'string') return value\n if (Array.isArray(value)) {\n // Single-pass iteration without intermediate arrays\n let result = ''\n for (let i = 0; i < value.length; i++) {\n const item = value[i]\n if (!item) continue\n const normalized = typeof item === 'string' ? item : normalizeClass(item)\n if (normalized) {\n result = result ? `${result} ${normalized}` : normalized\n }\n }\n return result\n }\n if (typeof value === 'object' && value !== null) {\n // Single-pass iteration without intermediate arrays\n let result = ''\n for (const k in value) {\n if (value[k]) {\n result = result ? `${result} ${k}` : k\n }\n }\n return result\n }\n return ''\n}\n\n/**\n * DOM Renderer implementation\n */\nexport class DOMRenderer implements Renderer {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n createNode(type: string, props: Record<string, any>): HTMLElement | SVGElement {\n // Map component type to HTML element\n const tagName = ELEMENT_MAPPING[type] ?? type\n\n let element: HTMLElement | SVGElement\n\n if (SVG_TAGS.has(tagName)) {\n element = document.createElementNS(SVG_NAMESPACE, tagName) as SVGElement\n } else {\n element = document.createElement(tagName)\n }\n\n // Store original type for reference\n if (ELEMENT_MAPPING[type]) {\n element.setAttribute('data-flexium-type', type)\n }\n\n // Apply all props (treat oldProps as empty)\n this.updateNode(element, {}, props)\n\n return element\n }\n\n updateNode(\n node: HTMLElement | SVGElement,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n oldProps: Record<string, any>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n newProps: Record<string, any>\n ): void {\n // 1. Handle className\n if (newProps.className !== oldProps.className) {\n const className = normalizeClass(newProps.className)\n if (node instanceof SVGElement) {\n node.setAttribute('class', className)\n } else {\n node.className = className\n }\n }\n\n // 2. Update Styles (Efficiently)\n updateStyles(node, oldProps, newProps)\n\n // 3. Handle Events & Attributes\n // We iterate over merged keys to handle additions, updates, and removals in one pass if possible\n // But separating old and new is easier for now.\n\n // Remove deleted props\n for (const key in oldProps) {\n if (!(key in newProps)) {\n // Ignore Symbols\n if (typeof key === 'symbol') continue\n\n if (key.startsWith('on')) {\n const eventName = EVENT_MAPPING[key] || key.slice(2).toLowerCase()\n this.removeEventListener(node, eventName, oldProps[key])\n } else if (!SKIP_PROPS.has(key)) {\n node.removeAttribute(key)\n }\n }\n }\n\n // Add/Update new props\n const keys = Reflect.ownKeys(newProps) // Get string and symbol keys\n for (const key of keys) {\n // Ignore Symbols (Synapse keys)\n if (typeof key === 'symbol') continue\n\n // Cast key to string for accessing record\n const strKey = key\n const newVal = newProps[strKey]\n const oldVal = oldProps[strKey]\n\n if (newVal === oldVal) continue\n\n if (strKey.startsWith('on')) {\n const eventName = EVENT_MAPPING[strKey] || strKey.slice(2).toLowerCase()\n if (oldVal) this.removeEventListener(node, eventName, oldVal)\n if (newVal) this.addEventListener(node, eventName, newVal)\n } else if (!SKIP_PROPS.has(strKey)) {\n if (newVal === null || newVal === undefined || newVal === false) {\n node.removeAttribute(strKey)\n } else if (newVal === true) {\n node.setAttribute(strKey, '')\n } else {\n // Handle SVG attributes\n const attrName = SVG_ATTR_MAP[strKey] || strKey\n\n // Escape attribute value to prevent XSS attacks\n node.setAttribute(attrName, escapeAttrValue(String(newVal)))\n }\n }\n }\n }\n\n appendChild(parent: Node, child: Node): void {\n parent.appendChild(child)\n }\n\n insertBefore(parent: Node, child: Node, beforeChild: Node | null): void {\n parent.insertBefore(child, beforeChild)\n }\n\n nextSibling(node: Node): Node | null {\n return node.nextSibling\n }\n\n removeChild(parent: Node, child: Node): void {\n // No need to manually cleanup listeners if using WeakMap in delegator\n // The nodeHandlers WeakMap will automatically release entries when node is garbage collected\n parent.removeChild(child)\n }\n\n createTextNode(text: string): Text {\n return document.createTextNode(text)\n }\n\n updateTextNode(node: Text, text: string): void {\n node.textContent = text\n }\n\n addEventListener(node: Node, event: string, handler: EventHandler): void {\n // Use Event Delegation\n // Map to DOM event name\n const domEvent = EVENT_MAPPING[event] || event\n eventDelegator.on(node, domEvent, handler)\n }\n\n removeEventListener(node: Node, event: string, _handler: EventHandler): void {\n // Use Event Delegation\n // Map to DOM event name\n const domEvent = EVENT_MAPPING[event] || event\n eventDelegator.off(node, domEvent)\n }\n}\n\n/**\n * Default DOM renderer instance\n */\nexport const domRenderer = new DOMRenderer()\n","import { signal, effect } from '../../core/signal'\nimport type { FNode } from '../../core/renderer'\nimport type {\n ListProps,\n ListComponent,\n ListCacheEntry,\n SizeConfig,\n} from './types'\n\n/** Marker symbol for List components */\nexport const LIST_MARKER = Symbol('flexium.list')\n\n/**\n * Check if a value is a ListComponent\n */\nexport function isListComponent<T>(\n value: unknown\n): value is ListComponent<T> {\n return (\n value !== null &&\n typeof value === 'object' &&\n LIST_MARKER in value &&\n (value as Record<symbol, unknown>)[LIST_MARKER] === true\n )\n}\n\n\n/**\n * List - Render lists with optional virtualization\n *\n * By default, renders all items. Set `virtual` to true for large lists\n * to only render visible items.\n *\n * @example\n * ```tsx\n * // Simple list (renders all items)\n * <List each={items}>\n * {(item, index) => <div>{item.name}</div>}\n * </List>\n *\n * // Virtual list (for large datasets)\n * <List\n * each={items}\n * virtual\n * height={400}\n * itemSize={50}\n * >\n * {(item, index) => <div>{index()}: {item.name}</div>}\n * </List>\n * ```\n */\nexport function List<T>(props: ListProps<T>): ListComponent<T> {\n const {\n each,\n children,\n virtual = false,\n height,\n width,\n itemSize,\n overscan = 3,\n getKey,\n onScroll,\n onVisibleRangeChange,\n class: className,\n style,\n } = props\n\n const component: ListComponent<T> = {\n [LIST_MARKER]: true,\n each,\n renderItem: children,\n virtual,\n height,\n width,\n itemSize,\n overscan,\n getKey,\n onScroll,\n onVisibleRangeChange,\n class: className,\n style,\n }\n\n return component\n}\n\n/**\n * Get item height based on configuration\n */\nfunction getItemHeight(config: number | SizeConfig, _index: number): number {\n if (typeof config === 'number') {\n return config\n }\n if (config.mode === 'fixed') {\n return config.itemHeight\n }\n // Variable mode - use estimated height\n return config.estimatedItemHeight\n}\n\n/**\n * Calculate visible range for fixed-height items\n */\nfunction calculateVisibleRangeFixed(\n scrollTop: number,\n viewportHeight: number,\n itemHeight: number,\n totalItems: number,\n overscan: number\n): { startIndex: number; endIndex: number; totalHeight: number } {\n const totalHeight = totalItems * itemHeight\n\n if (totalItems === 0) {\n return { startIndex: 0, endIndex: -1, totalHeight: 0 }\n }\n\n const start = Math.floor(scrollTop / itemHeight)\n const visibleCount = Math.ceil(viewportHeight / itemHeight)\n const end = start + visibleCount\n\n return {\n startIndex: Math.max(0, start - overscan),\n endIndex: Math.min(totalItems - 1, end + overscan),\n totalHeight,\n }\n}\n\n/**\n * Mount a List component to the DOM with efficient rendering.\n *\n * Handles both simple and virtual lists:\n * - Simple lists render all items immediately with key-based caching\n * - Virtual lists only render visible items for optimal performance with large datasets\n *\n * @internal Used by the reactive renderer\n * @param comp - The ListComponent to mount\n * @param parent - Parent DOM node to mount into\n * @param mountFn - Function to mount an FNode to the DOM\n * @param cleanupFn - Function to cleanup a DOM node and its bindings\n * @returns Dispose function to cleanup all list items and effects\n *\n * @example\n * ```tsx\n * // This is called automatically by mountReactive when it encounters a List:\n * <List each={items} virtual height={400} itemSize={50}>\n * {(item, index) => <Row>{index()}: {item.name}</Row>}\n * </List>\n * ```\n */\nexport function mountListComponent<T>(\n comp: ListComponent<T>,\n parent: Node,\n mountFn: (vnode: FNode) => Node | null,\n cleanupFn: (node: Node) => void\n): () => void {\n if (comp.virtual) {\n return mountVirtualList(comp, parent, mountFn, cleanupFn)\n } else {\n return mountSimpleList(comp, parent, mountFn, cleanupFn)\n }\n}\n\n/**\n * Mount a simple (non-virtual) list\n */\nfunction mountSimpleList<T>(\n comp: ListComponent<T>,\n parent: Node,\n mountFn: (vnode: FNode) => Node | null,\n cleanupFn: (node: Node) => void\n): () => void {\n const { each, renderItem, getKey, class: className, style } = comp\n\n // Create container\n const container = document.createElement('div')\n container.setAttribute('role', 'list')\n if (className) container.className = className\n if (style) {\n Object.entries(style).forEach(([key, value]) => {\n ; (container.style as unknown as Record<string, string>)[key] =\n typeof value === 'number' ? `${value}px` : value\n })\n }\n\n parent.appendChild(container)\n\n // Cache for rendered items\n const cache = new Map<string | number, { node: Node; dispose: () => void }>()\n\n // Get key for item\n const getItemKey = (item: T, index: number): string | number => {\n if (getKey) {\n return getKey(item, index)\n }\n return index\n }\n\n // Render effect\n const disposeEffect = effect(() => {\n const list = each() || []\n const currentKeys = new Set<string | number>()\n\n // Render items\n list.forEach((item, index) => {\n const key = getItemKey(item, index)\n currentKeys.add(key)\n\n if (!cache.has(key)) {\n const indexSig = signal(index)\n const vnode = renderItem(item, () => indexSig())\n const node = mountFn(vnode)\n\n if (node && node instanceof HTMLElement) {\n node.setAttribute('role', 'listitem')\n container.appendChild(node)\n\n cache.set(key, {\n node,\n dispose: () => {\n try {\n cleanupFn(node)\n } catch {\n // Ignore cleanup errors\n }\n },\n })\n }\n }\n })\n\n // Remove items no longer in list\n for (const [key, entry] of cache) {\n if (!currentKeys.has(key)) {\n entry.dispose()\n if (entry.node.parentNode === container) {\n container.removeChild(entry.node)\n }\n cache.delete(key)\n }\n }\n })\n\n // Cleanup\n return () => {\n disposeEffect()\n for (const entry of cache.values()) {\n entry.dispose()\n }\n cache.clear()\n if (container.parentNode === parent) {\n parent.removeChild(container)\n }\n }\n}\n\n/**\n * Mount a virtual (windowed) list\n */\nfunction mountVirtualList<T>(\n comp: ListComponent<T>,\n parent: Node,\n mountFn: (node: FNode) => Node | null,\n cleanupFn: (node: Node) => void\n): () => void {\n const {\n each,\n renderItem,\n height,\n width,\n itemSize,\n overscan,\n getKey,\n onScroll,\n onVisibleRangeChange,\n } = comp\n\n if (!height || !itemSize) {\n console.warn('List: height and itemSize are required when virtual is true')\n return () => { }\n }\n\n // Create container structure\n const container = document.createElement('div')\n container.style.height = typeof height === 'number' ? `${height}px` : height\n container.style.width = width\n ? typeof width === 'number'\n ? `${width}px`\n : width\n : '100%'\n container.style.overflow = 'auto'\n container.style.position = 'relative'\n\n // Accessibility attributes\n container.setAttribute('role', 'list')\n container.setAttribute('tabindex', '0')\n\n const innerContainer = document.createElement('div')\n innerContainer.style.position = 'relative'\n innerContainer.style.width = '100%'\n innerContainer.style.willChange = 'transform'\n\n container.appendChild(innerContainer)\n parent.appendChild(container)\n\n // Reactive state\n const scrollTopSig = signal(0)\n const cache = new Map<string | number, ListCacheEntry<T>>()\n\n // Track previous visible range\n let prevStartIndex = -1\n let prevEndIndex = -1\n\n // Scroll handler\n const handleScroll = () => {\n scrollTopSig.set(container.scrollTop)\n onScroll?.(container.scrollTop)\n }\n\n container.addEventListener('scroll', handleScroll, { passive: true })\n\n // Get key for item\n const getItemKey = (item: T, index: number): string | number => {\n if (getKey) {\n return getKey(item, index)\n }\n return index\n }\n\n // Main render effect\n const disposeEffect = effect(() => {\n const list = each() || []\n const currentScrollTop = scrollTopSig()\n const viewportHeight = container.clientHeight || parseFloat(String(height))\n const itemHeight = getItemHeight(itemSize, 0)\n\n // Calculate visible range\n const { startIndex, endIndex, totalHeight } = calculateVisibleRangeFixed(\n currentScrollTop,\n viewportHeight,\n itemHeight,\n list.length,\n overscan\n )\n\n // Update spacer height\n innerContainer.style.height = `${totalHeight}px`\n\n // Update ARIA attributes\n container.setAttribute('aria-rowcount', String(list.length))\n\n // Notify visible range change\n if (startIndex !== prevStartIndex || endIndex !== prevEndIndex) {\n onVisibleRangeChange?.(startIndex, endIndex)\n prevStartIndex = startIndex\n prevEndIndex = endIndex\n }\n\n // Track which keys are currently visible\n const visibleKeys = new Set<string | number>()\n\n // Render visible items\n for (let i = startIndex; i <= endIndex && i < list.length; i++) {\n const item = list[i]\n const key = getItemKey(item, i)\n visibleKeys.add(key)\n\n let entry = cache.get(key)\n\n if (!entry) {\n // Create new item\n const indexSig = signal(i)\n const vnode = renderItem(item, () => indexSig())\n const node = mountFn(vnode)\n\n if (node && node instanceof HTMLElement) {\n // Position the item\n node.style.position = 'absolute'\n node.style.top = '0'\n node.style.left = '0'\n node.style.right = '0'\n node.style.transform = `translateY(${i * itemHeight}px)`\n node.style.height = `${itemHeight}px`\n node.style.boxSizing = 'border-box'\n node.setAttribute('role', 'listitem')\n node.setAttribute('aria-rowindex', String(i + 1))\n\n innerContainer.appendChild(node)\n\n entry = {\n item,\n key,\n node,\n indexSig,\n dispose: () => {\n try {\n cleanupFn(node)\n } catch {\n // Ignore cleanup errors\n }\n },\n }\n cache.set(key, entry)\n }\n } else {\n // Update existing item position\n if (entry.indexSig.peek() !== i) {\n entry.indexSig.set(i)\n }\n const node = entry.node as HTMLElement\n node.style.transform = `translateY(${i * itemHeight}px)`\n node.setAttribute('aria-rowindex', String(i + 1))\n }\n }\n\n // Remove items no longer visible\n for (const [key, entry] of cache) {\n if (!visibleKeys.has(key)) {\n entry.dispose()\n if (entry.node.parentNode === innerContainer) {\n innerContainer.removeChild(entry.node)\n }\n cache.delete(key)\n }\n }\n })\n\n // Cleanup function\n return () => {\n disposeEffect()\n container.removeEventListener('scroll', handleScroll)\n\n for (const entry of cache.values()) {\n entry.dispose()\n }\n cache.clear()\n\n if (container.parentNode === parent) {\n parent.removeChild(container)\n }\n }\n}\n\nexport default List\n","/**\n * FNode to DOM Node mapping using WeakMap\n *\n * This replaces the _node property on FNode with a clean separation.\n * WeakMap ensures nodes are garbage collected when FNodes are no longer referenced.\n */\n\nimport type { FNode } from '../../core/renderer'\n\nconst fnodeToNode = new WeakMap<FNode, Node>()\n\n/**\n * Get the DOM node associated with an FNode\n */\nexport function getNode(fnode: FNode): Node | undefined {\n return fnodeToNode.get(fnode)\n}\n\n/**\n * Set the DOM node associated with an FNode\n */\nexport function setNode(fnode: FNode, node: Node): void {\n fnodeToNode.set(fnode, node)\n}\n\n/**\n * Check if an FNode has an associated DOM node\n */\nexport function hasNode(fnode: FNode): boolean {\n return fnodeToNode.has(fnode)\n}\n\n/**\n * Remove the DOM node association from an FNode\n */\nexport function deleteNode(fnode: FNode): boolean {\n return fnodeToNode.delete(fnode)\n}\n","import { FNode } from '../../core/renderer'\nimport { domRenderer } from './index'\nimport { mountReactive, cleanupReactive } from './reactive'\nimport { getNode, setNode } from './node-map'\n\n/**\n * Reconcile two arrays of FNodes using hybrid key-based approach.\n * Simple Map lookup + position check for optimal DOM operations.\n *\n * @param parent The parent DOM node\n * @param oldFNodes The array of old FNodes (with attached DOM nodes)\n * @param newFNodes The array of new FNodes\n * @param nextSibling The node to insert before (for the end of the list)\n */\nexport function reconcileArrays(\n parent: Node,\n oldFNodes: FNode[],\n newFNodes: FNode[],\n nextSibling: Node | null\n): void {\n const hasOld = oldFNodes && oldFNodes.length > 0\n const hasNew = newFNodes && newFNodes.length > 0\n\n // Fast path: both empty\n if (!hasOld && !hasNew) return\n\n // Fast path: remove all\n if (!hasNew) {\n for (const fnode of oldFNodes) {\n const node = fnode && getNode(fnode)\n if (node) {\n cleanupReactive(node)\n domRenderer.removeChild(parent, node)\n }\n }\n return\n }\n\n // Fast path: add all\n if (!hasOld) {\n const fragment = document.createDocumentFragment()\n for (const newFNode of newFNodes) {\n const node = mountReactive(newFNode, undefined)\n if (node) {\n setNode(newFNode, node)\n fragment.appendChild(node)\n }\n }\n if (nextSibling) {\n parent.insertBefore(fragment, nextSibling)\n } else {\n parent.appendChild(fragment)\n }\n return\n }\n\n // Build key → FNode map from old nodes\n const keyToOldFNode = new Map<string | number | undefined, FNode>()\n for (let i = 0; i < oldFNodes.length; i++) {\n const fnode = oldFNodes[i]\n // Use key if available, otherwise use index with type prefix for uniqueness\n const key = fnode.key ?? `__idx_${i}_${fnode.type}`\n keyToOldFNode.set(key, fnode)\n }\n\n const seen = new Set<string | number | undefined>()\n\n // Forward pass: process new nodes\n let currentChild = parent.firstChild\n\n for (let i = 0; i < newFNodes.length; i++) {\n const newFNode = newFNodes[i]\n const key = newFNode.key ?? `__idx_${i}_${newFNode.type}`\n seen.add(key)\n\n const oldFNode = keyToOldFNode.get(key)\n\n // Determine the reference node for insertion\n // If currentChild is valid, insert before it. Otherwise append (refNode is null).\n const refNode = currentChild\n\n if (!oldFNode || oldFNode.type !== newFNode.type) {\n // New node or type changed: create and insert\n const node = mountReactive(newFNode, undefined)\n if (node) {\n setNode(newFNode, node)\n parent.insertBefore(node, refNode)\n // We inserted a new node before currentChild, so currentChild is still the next one to process\n }\n // If type changed, old node will be removed in cleanup pass\n } else {\n // Existing node: patch and maybe move\n patchNode(oldFNode, newFNode)\n\n const node = getNode(newFNode)\n if (node) {\n if (currentChild !== node) {\n // Position wrong: move to correct position (before currentChild)\n parent.insertBefore(node, refNode)\n // We moved the node here. currentChild is still the next one to process.\n } else {\n // Position correct: match!\n // Advance pointer since we consumed this node\n currentChild = currentChild?.nextSibling || null\n }\n }\n }\n }\n\n // Cleanup pass: remove nodes not in new list\n for (const [key, fnode] of keyToOldFNode) {\n const node = getNode(fnode)\n if (!seen.has(key) && node) {\n cleanupReactive(node)\n // Check if node is still attached before removing\n if (node.parentNode === parent) {\n domRenderer.removeChild(parent, node)\n }\n }\n }\n}\n\n/**\n * Patch an existing FNode with new props and children\n */\nfunction patchNode(oldFNode: FNode, newFNode: FNode) {\n const node = getNode(oldFNode) as HTMLElement\n if (!node) return\n\n // Transfer DOM reference\n setNode(newFNode, node)\n\n // Only patch element nodes (not components)\n if (typeof newFNode.type !== 'string') return\n\n // Update props\n domRenderer.updateNode(node, oldFNode.props, newFNode.props)\n\n // Update children\n const oldChildren = oldFNode.children || []\n const newChildren = newFNode.children || []\n\n if (oldChildren.length === 0 && newChildren.length === 0) return\n\n // Fast path: single text/number child\n if (\n newChildren.length === 1 &&\n (typeof newChildren[0] === 'string' || typeof newChildren[0] === 'number') &&\n node.firstChild?.nodeType === Node.TEXT_NODE &&\n node.childNodes.length === 1\n ) {\n const newText = String(newChildren[0])\n const oldText = String(oldChildren[0])\n if (oldText !== newText) {\n domRenderer.updateTextNode(node.firstChild as Text, newText)\n }\n return\n }\n\n // Recursive reconciliation for nested children\n reconcileArrays(\n node,\n oldChildren as FNode[],\n newChildren as FNode[],\n null\n )\n}\n","/**\n * Reactive DOM Rendering\n *\n * Integrates the signal system with the DOM renderer to enable fine-grained\n * reactive updates. Only the specific DOM nodes that depend on changed signals\n * will be updated, without re-rendering the entire component tree.\n */\n\nimport type { FNode } from '../../core/renderer'\nimport { effect, isSignal, onCleanup, root } from '../../core/signal'\nimport type { Signal, Computed } from '../../core/signal'\nimport { domRenderer } from './index'\nimport { isFNode } from './f'\nimport {\n pushProvider,\n} from '../../core/context'\nimport { reconcileArrays } from './reconcile'\nimport {\n isStateValue,\n getStateSignal,\n setCurrentComponent,\n createComponentInstance,\n resetHookIndex,\n} from '../../core/state'\nimport {\n isListComponent,\n mountListComponent,\n ListComponent,\n} from '../../primitives/List'\nimport { logError, ErrorCodes } from '../../core/errors'\nimport { setNode, getNode } from './node-map'\n\nconst REACTIVE_BINDINGS = new WeakMap<Node, Set<() => void>>()\n\n/**\n * Register a dispose function for a node's reactive bindings.\n * Ensures the bindings set exists and adds the dispose function to it.\n */\nfunction registerReactiveBinding(node: Node, dispose: () => void): void {\n let bindings = REACTIVE_BINDINGS.get(node)\n if (!bindings) {\n bindings = new Set()\n REACTIVE_BINDINGS.set(node, bindings)\n }\n bindings.add(dispose)\n}\n\n/**\n * Mount a virtual node reactively to the DOM.\n *\n * This is the core rendering function that handles all node types:\n * - FNodes (both built-in elements and function components)\n * - Strings and numbers (text nodes)\n * - Signals and computed values (reactive children)\n * - StateValues from the state() API\n * - ListComponents\n * - Arrays and fragments\n *\n * Reactive values are automatically tracked and DOM updates occur\n * only when the specific values change (fine-grained reactivity).\n *\n * @param vnode - The virtual node to mount\n * @param container - Optional parent node to append to\n * @returns The created DOM node, or null for empty/boolean values\n *\n * @example\n * ```tsx\n * // Mount a simple element\n * const node = mountReactive(<div>Hello</div>, document.body)\n *\n * // Mount a reactive signal\n * const count = signal(0)\n * mountReactive(() => <span>{count.value}</span>, container)\n * ```\n */\nexport function mountReactive(\n node:\n | FNode\n | string\n | number\n | boolean\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | Signal<any>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | Computed<any>\n | null\n | undefined\n | Function\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | any[]\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | ListComponent<any>,\n container?: Node\n): Node | null {\n // Handle null/undefined/boolean (falsy JSX values)\n if (node === null || node === undefined || typeof node === 'boolean') {\n return null\n }\n\n // Handle List component\n if (isListComponent(node)) {\n const parent = container || document.createDocumentFragment()\n\n const listDispose = mountListComponent(\n node,\n parent,\n (childNode) => mountReactive(childNode),\n cleanupReactive\n )\n\n // Create a marker for cleanup tracking\n const marker = document.createTextNode('')\n registerReactiveBinding(marker, listDispose)\n\n return container ? parent.firstChild : parent\n }\n\n // Handle StateValue (from state() API)\n if (isStateValue(node)) {\n const sig = getStateSignal(node)\n if (sig) {\n const startNode = document.createTextNode('')\n const parent = container || document.createDocumentFragment()\n domRenderer.appendChild(parent, startNode)\n\n let currentNode: Node | null = startNode\n\n const dispose = effect(() => {\n const value = sig.value\n const currentContainer = startNode.parentNode\n if (!currentContainer) return\n\n if (\n (typeof value === 'string' || typeof value === 'number') &&\n currentNode &&\n currentNode.nodeType === Node.TEXT_NODE &&\n currentNode !== startNode\n ) {\n domRenderer.updateTextNode(currentNode as Text, String(value))\n } else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const newNode = mountReactive(value as any)\n if (newNode) {\n if (currentNode && currentNode !== startNode) {\n if (currentNode.parentNode === currentContainer) {\n // Optimize: if both old and new are text nodes, just update content\n if (\n currentNode.nodeType === Node.TEXT_NODE &&\n newNode.nodeType === Node.TEXT_NODE\n ) {\n domRenderer.updateTextNode(\n currentNode as Text,\n newNode.textContent || ''\n )\n // Don't update currentNode reference since we reused it\n } else {\n currentContainer.replaceChild(newNode, currentNode)\n currentNode = newNode\n }\n } else {\n currentContainer.insertBefore(newNode, startNode.nextSibling)\n currentNode = newNode\n }\n } else {\n currentContainer.insertBefore(newNode, startNode.nextSibling)\n currentNode = newNode\n }\n } else {\n if (\n currentNode &&\n currentNode !== startNode &&\n currentNode.parentNode === currentContainer\n ) {\n try {\n currentContainer.removeChild(currentNode)\n } catch (e) {\n logError(ErrorCodes.DOM_CLEANUP_FAILED, { operation: 'removeChild' }, e)\n }\n }\n currentNode = startNode\n }\n }\n })\n\n registerReactiveBinding(startNode, dispose)\n\n return container ? startNode : parent\n }\n }\n\n // Handle signals and functions (reactive children)\n if (isSignal(node) || typeof node === 'function') {\n const startNode = document.createTextNode('')\n const parent = container || document.createDocumentFragment()\n domRenderer.appendChild(parent, startNode)\n\n let currentNodes: Node[] = []\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let currentFNode: any = null\n let currentFNodeList: FNode[] = []\n\n const dispose = effect(() => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const value = isSignal(node) ? (node as Signal<any>).value : (node as () => unknown)()\n const currentContainer = startNode.parentNode\n\n // Safety check: if node is detached, we can't update siblings\n if (!currentContainer) return\n\n if (Array.isArray(value)) {\n const newFNodes = value.filter((c) => c != null)\n if (currentFNodeList.length > 0) {\n const nextSibling = startNode.nextSibling\n // Note: reconcileArrays expects parent, oldFNodes, newFNodes, nextSibling\n reconcileArrays(\n currentContainer,\n currentFNodeList,\n newFNodes,\n nextSibling\n )\n } else {\n // Clean up old nodes first\n for (const childNode of currentNodes) {\n cleanupReactive(childNode)\n if (childNode.parentNode === currentContainer) {\n try {\n currentContainer.removeChild(childNode)\n } catch (e) {\n logError(ErrorCodes.DOM_CLEANUP_FAILED, { operation: 'removeChild' }, e)\n }\n }\n }\n currentNodes = []\n\n const fragment = document.createDocumentFragment()\n for (const child of newFNodes) {\n const childNode = mountReactive(child, fragment)\n if (childNode && typeof child === 'object') {\n setNode(child, childNode)\n }\n }\n currentNodes = Array.from(fragment.childNodes)\n currentContainer.insertBefore(fragment, startNode.nextSibling)\n }\n currentFNodeList = newFNodes\n currentFNode = value\n return\n }\n\n if (currentFNodeList.length > 0) {\n for (const childFNode of currentFNodeList) {\n const childNode = getNode(childFNode)\n if (childNode && childNode.parentNode === currentContainer) {\n cleanupReactive(childNode)\n try {\n currentContainer.removeChild(childNode)\n } catch (e) {\n logError(ErrorCodes.DOM_CLEANUP_FAILED, { operation: 'removeChild' }, e)\n }\n }\n }\n currentFNodeList = []\n }\n\n if (value !== currentFNode) {\n // Clean up old nodes first\n for (const childNode of currentNodes) {\n cleanupReactive(childNode)\n if (childNode.parentNode === currentContainer) {\n try {\n currentContainer.removeChild(childNode)\n } catch (e) {\n logError(ErrorCodes.DOM_CLEANUP_FAILED, { operation: 'removeChild' }, e)\n }\n }\n }\n currentNodes = []\n\n if (\n (typeof value === 'string' || typeof value === 'number')\n ) {\n const textNode = domRenderer.createTextNode(String(value))\n currentContainer.insertBefore(textNode, startNode.nextSibling)\n currentNodes = [textNode]\n } else {\n const newNode = mountReactive(value)\n if (newNode) {\n // If newNode is a fragment, track all children\n if (newNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n currentNodes = Array.from(newNode.childNodes)\n currentContainer.insertBefore(newNode, startNode.nextSibling)\n } else {\n currentContainer.insertBefore(newNode, startNode.nextSibling)\n currentNodes = [newNode]\n }\n }\n }\n currentFNode = value\n }\n })\n\n registerReactiveBinding(startNode, dispose)\n\n return container ? startNode : parent\n }\n\n if (Array.isArray(node)) {\n const fragment = document.createDocumentFragment()\n for (const child of node) {\n mountReactive(child, fragment)\n }\n if (container) {\n domRenderer.appendChild(container, fragment)\n }\n return fragment\n }\n\n // Handle text nodes\n if (typeof node === 'string' || typeof node === 'number') {\n const textNode = domRenderer.createTextNode(String(node))\n if (container) domRenderer.appendChild(container, textNode)\n return textNode\n }\n\n // Handle FNodes\n if (isFNode(node)) {\n // Handle function components\n if (typeof node.type === 'function') {\n const component = node.type\n const startNode = document.createTextNode('')\n const parent = container || document.createDocumentFragment()\n domRenderer.appendChild(parent, startNode)\n\n let currentNodes: Node[] = []\n let currentFNodeList: FNode[] = []\n\n // Create component instance for hook tracking\n const componentInstance = createComponentInstance()\n\n const dispose = effect(() => {\n try {\n // Reset hook index for each render\n resetHookIndex(componentInstance)\n\n // Use root() to track any effects created inside the component\n // These will be automatically cleaned up when disposeRoot is called\n // Use root() to track any effects created inside the component\n // These will be automatically cleaned up when disposeRoot is called\n root((disposeRoot) => {\n // Register disposeRoot to cleanup component's internal effects\n onCleanup(disposeRoot)\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const contextId = (component as any)._contextId\n if (contextId) {\n pushProvider(contextId, node.props.value)\n }\n\n let result\n try {\n // Set current component for hook tracking\n setCurrentComponent(componentInstance)\n result = component({ ...node.props, children: node.children })\n } finally {\n // Clear current component\n setCurrentComponent(null)\n }\n\n // Attempt Reconciliation for Arrays (e.g. items.map)\n // This enables efficient list updates without full re-render\n const isArray = Array.isArray(result)\n // Check if it's a list of FNodes (elements) that we can reconcile\n // We skip reconciliation for primitives or fragments to be safe for now\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const canReconcile = isArray && (result as unknown as any[]).every(item =>\n isFNode(item) && item.type !== 'fragment'\n )\n\n if (canReconcile) {\n const parent = startNode.parentNode\n if (parent) {\n // Normalize result to FNode[] (already checked, but for type safety)\n const newFNodes = result as unknown as FNode[]\n\n // Use reconcileArrays to diff/patch the DOM\n reconcileArrays(\n parent,\n currentFNodeList,\n newFNodes,\n startNode.nextSibling\n )\n\n // Update state for next render\n currentFNodeList = newFNodes\n // Update currentNodes so we know what to remove if we switch to fallback\n currentNodes = newFNodes.map(fn => getNode(fn)).filter(n => n != null) as Node[]\n return\n }\n }\n\n // Fallback: Standard Mount (Destroy & Recreate)\n // Clean up old nodes first\n const currentParent = startNode.parentNode\n if (currentParent) {\n // If we were using reconciliation, currentFNodeList handles the nodes\n // If not, currentNodes handles them.\n // We iterate currentNodes to be safe.\n for (const childNode of currentNodes) {\n cleanupReactive(childNode)\n // Only remove if still attached (reconcileArrays might have moved them)\n if (childNode.parentNode === currentParent) {\n try {\n currentParent.removeChild(childNode)\n } catch (e) {\n logError(ErrorCodes.DOM_CLEANUP_FAILED, { operation: 'removeChild' }, e)\n }\n }\n }\n }\n currentNodes = []\n currentFNodeList = []\n\n const fragment = document.createDocumentFragment()\n mountReactive(result, fragment)\n\n if (currentParent) {\n currentNodes = Array.from(fragment.childNodes)\n currentParent.insertBefore(fragment, startNode.nextSibling)\n }\n })\n } finally {\n // No popProvider needed with Owner-based context\n }\n })\n\n registerReactiveBinding(startNode, dispose)\n\n return container ? startNode : parent\n }\n\n // Handle fragments\n if (node.type === 'fragment') {\n const fragment = document.createDocumentFragment()\n for (const child of node.children) {\n mountReactive(child, fragment)\n }\n if (container) {\n domRenderer.appendChild(container, fragment)\n }\n return fragment\n }\n\n // Handle built-in elements\n const domNode = domRenderer.createNode(node.type, node.props)\n const disposeProps = setupReactiveProps(domNode, node.props)\n if (disposeProps.length > 0) {\n REACTIVE_BINDINGS.set(domNode, new Set(disposeProps))\n }\n\n for (const child of node.children) {\n mountReactive(child, domNode)\n }\n\n if (container) {\n domRenderer.appendChild(container, domNode)\n }\n\n return domNode\n }\n\n return null\n}\n\n// Sentinel value to detect first run\nconst UNINITIALIZED = Symbol('uninitialized')\n\nfunction setupReactiveProps(\n node: HTMLElement | SVGElement,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n props: Record<string, any>\n): (() => void)[] {\n const disposers: (() => void)[] = []\n for (const key in props) {\n const value = props[key]\n if (key.startsWith('on')) continue\n\n if (isSignal(value)) {\n // Track previous value to avoid unnecessary DOM updates\n // Use sentinel for first run to ensure initial value is set\n let prevValue: unknown = UNINITIALIZED\n const dispose = effect(() => {\n const newValue = value.value\n // Only update DOM if value actually changed (always update on first run)\n if (newValue !== prevValue) {\n domRenderer.updateNode(\n node,\n { [key]: prevValue === UNINITIALIZED ? undefined : prevValue },\n { [key]: newValue }\n )\n prevValue = newValue\n }\n })\n disposers.push(dispose)\n continue\n }\n\n if (typeof value === 'function') {\n // Track previous value to avoid unnecessary DOM updates\n // Use sentinel for first run to ensure initial value is set\n let prevValue: unknown = UNINITIALIZED\n const dispose = effect(() => {\n try {\n const newValue = value()\n // Only update DOM if value actually changed (always update on first run)\n if (newValue !== prevValue) {\n domRenderer.updateNode(\n node,\n { [key]: prevValue === UNINITIALIZED ? undefined : prevValue },\n { [key]: newValue }\n )\n prevValue = newValue\n }\n } catch (e) {\n logError(ErrorCodes.DOM_CLEANUP_FAILED, { operation: 'updateNode', prop: key }, e)\n }\n })\n disposers.push(dispose)\n }\n }\n return disposers\n}\n\nexport function cleanupReactive(node: Node): void {\n const bindings = REACTIVE_BINDINGS.get(node)\n if (bindings) {\n bindings.forEach((dispose) => dispose())\n REACTIVE_BINDINGS.delete(node)\n }\n if (node.childNodes && node.childNodes.length > 0) {\n const children = Array.from(node.childNodes)\n for (const child of children) {\n cleanupReactive(child)\n }\n }\n}\n\nexport function createReactiveRoot(container: HTMLElement) {\n let rootDispose: (() => void) | null = null\n let currentRootNode: Node | null = null\n\n return {\n render(node: FNode) {\n if (currentRootNode) {\n cleanupReactive(currentRootNode)\n container.innerHTML = ''\n currentRootNode = null\n }\n if (rootDispose) {\n rootDispose()\n rootDispose = null\n }\n\n rootDispose = effect(() => {\n container.innerHTML = ''\n currentRootNode = mountReactive(node, container)\n })\n },\n unmount() {\n if (rootDispose) {\n rootDispose()\n rootDispose = null\n }\n cleanupReactive(container)\n container.innerHTML = ''\n },\n }\n}\n\n/**\n * Create a reactive text node that updates when the getter returns a new value\n */\nexport function reactiveText(getText: () => string): Text {\n const textNode = document.createTextNode('')\n const dispose = effect(() => {\n const text = getText()\n domRenderer.updateTextNode(textNode, text)\n })\n registerReactiveBinding(textNode, dispose)\n return textNode\n}\n","/**\n * DOM Render Function\n *\n * This module provides the main render function for mounting components to the DOM.\n * It includes simple reconciliation logic for mounting and unmounting components.\n *\n * Note: This module uses reactive rendering internally via mountReactive.\n * For root-level rendering with cleanup support, use createReactiveRoot.\n */\n\nimport type { FNode, FNodeChild } from '../../core/renderer'\nimport { domRenderer } from './index'\nimport { isFNode } from './f'\nimport { mountReactive, createReactiveRoot } from './reactive'\n\n/**\n * Internal node data stored on DOM nodes\n */\ninterface NodeData {\n vnode: FNode | null\n props: Record<string, unknown>\n}\n\nconst NODE_DATA = new WeakMap<Node, NodeData>()\n\n/**\n * Render a component to a DOM container with automatic reactivity\n *\n * This function uses reactive rendering by default, which means:\n * - Signals passed as children automatically update the DOM\n * - Signals in props automatically update element properties\n * - Component functions automatically re-render when signals change\n *\n * @param vnode - Flexium node to render\n * @returns The rendered DOM node\n *\n * @example\n * const count = signal(0);\n * render(f('div', {}, [count]), document.body);\n * // The div will automatically update when count changes\n */\n/**\n * Mounts a Flexium node to a container\n * @param node - Flexium node to render\n * @param container - DOM element to mount to\n */\nexport function render(\n node: FNode | string | number | null | undefined | Function,\n container: HTMLElement\n): Node | null {\n // Clear container\n container.innerHTML = ''\n return mountReactive(node, container)\n}\n\n/**\n * Internal function to mount a node\n */\nfunction mountNode(node: FNodeChild | Function): Node | null {\n // Handle primitives\n if (node === null || node === undefined || typeof node === 'boolean') {\n return null\n }\n\n // Handle arrays (fragments)\n if (Array.isArray(node)) {\n const fragment = document.createDocumentFragment()\n for (const child of node) {\n const childNode = mountNode(child)\n if (childNode) {\n domRenderer.appendChild(fragment, childNode)\n }\n }\n return fragment\n }\n\n // Handle functions (signals or components returning functions)\n if (typeof node === 'function') {\n return mountNode(node())\n }\n\n // Handle strings/numbers\n if (typeof node === 'string' || typeof node === 'number') {\n return domRenderer.createTextNode(String(node))\n }\n\n // Handle FNodes\n if (isFNode(node)) {\n // Handle function components\n if (typeof node.type === 'function') {\n const component = node.type\n const result = component({ ...node.props, children: node.children })\n return mountNode(result)\n }\n\n // Handle fragments\n if (node.type === 'fragment') {\n const fragment = document.createDocumentFragment()\n for (const child of node.children) {\n const childNode = mountNode(child)\n if (childNode) {\n domRenderer.appendChild(fragment, childNode)\n }\n }\n return fragment\n }\n\n // Handle DOM elements\n const domNode = domRenderer.createNode(node.type, node.props)\n\n // Handle children\n for (const child of node.children) {\n const childNode = mountNode(child)\n if (childNode) {\n domRenderer.appendChild(domNode, childNode)\n }\n }\n\n return domNode\n }\n\n return null\n}\n\n/**\n * Unmount a DOM node and clean up\n */\nfunction unmount(node: Node): void {\n // Clean up children first\n const childNodes = Array.from(node.childNodes)\n for (const child of childNodes) {\n unmount(child)\n }\n\n // Remove from parent\n if (node.parentNode) {\n node.parentNode.removeChild(node)\n }\n\n // Clean up stored data\n NODE_DATA.delete(node)\n}\n\n/**\n * Update an existing DOM node with a new flexium node\n * (Simple implementation - will be enhanced with proper reconciliation later)\n */\nexport function update(\n node: HTMLElement,\n oldVNode: FNode,\n newVNode: FNode\n): void {\n // If types don't match, replace the node\n if (oldVNode.type !== newVNode.type) {\n const newNode = mountNode(newVNode)\n if (newNode && node.parentNode) {\n node.parentNode.replaceChild(newNode, node)\n }\n unmount(node)\n return\n }\n\n // Update props\n domRenderer.updateNode(node, oldVNode.props, newVNode.props)\n\n // Update stored data\n NODE_DATA.set(node, {\n vnode: newVNode,\n props: newVNode.props,\n })\n\n // Update children (simple approach for now)\n const oldChildren = oldVNode.children\n const newChildren = newVNode.children\n\n // Simple reconciliation: update/add/remove based on index\n const maxLength = Math.max(oldChildren.length, newChildren.length)\n\n for (let i = 0; i < maxLength; i++) {\n const oldChild = oldChildren[i]\n const newChild = newChildren[i]\n const childNode = node.childNodes[i]\n\n if (!newChild) {\n // Remove old child\n if (childNode) {\n unmount(childNode)\n }\n } else if (!oldChild) {\n // Add new child\n const newChildNode = mountNode(newChild)\n if (newChildNode) {\n domRenderer.appendChild(node, newChildNode)\n }\n } else if (typeof oldChild === 'string' || typeof oldChild === 'number') {\n // Update text node\n if (typeof newChild === 'string' || typeof newChild === 'number') {\n if (oldChild !== newChild && childNode) {\n domRenderer.updateTextNode(childNode as Text, String(newChild))\n }\n } else {\n // Replace text with element\n const newChildNode = mountNode(newChild)\n if (newChildNode && childNode) {\n node.replaceChild(newChildNode, childNode)\n unmount(childNode)\n }\n }\n } else if (isFNode(oldChild)) {\n if (typeof newChild === 'string' || typeof newChild === 'number') {\n // Replace element with text\n const newChildNode = mountNode(newChild)\n if (newChildNode && childNode) {\n node.replaceChild(newChildNode, childNode)\n unmount(childNode)\n }\n } else if (isFNode(newChild)) {\n // Update element\n if (childNode instanceof HTMLElement) {\n update(childNode, oldChild, newChild)\n }\n }\n }\n }\n}\n\n/**\n * Create a root for rendering with automatic reactivity\n *\n * This creates a root that supports fine-grained reactive updates.\n * Signals are automatically tracked and only the affected DOM nodes are updated.\n *\n * @param container - DOM element to render into\n * @returns Root object with render and unmount methods\n *\n * @example\n * const root = createRoot(document.body);\n * const count = signal(0);\n * root.render(f('div', {}, [count]));\n * // Later: count.value++ will automatically update the DOM\n */\nexport function createRoot(container: HTMLElement) {\n // Use reactive root for automatic signal tracking\n return createReactiveRoot(container)\n}\n\n","import { mountReactive, cleanupReactive } from './reactive'\nimport { onCleanup } from '../../core/signal'\n\ninterface PortalProps {\n mount?: HTMLElement\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n children: any\n}\n\n/**\n * <Portal> component renders its children into a different part of the DOM.\n * Useful for modals, tooltips, etc.\n *\n * @example\n * <Portal mount={document.body}>\n * <div class=\"modal\">...</div>\n * </Portal>\n */\nexport function Portal(props: PortalProps) {\n // SSR guard: return null placeholder on server\n if (typeof document === 'undefined') {\n return null\n }\n\n const container = props.mount || document.body\n\n // Placeholder to keep position in the VDOM tree\n const placeholder = document.createComment('portal')\n\n // We use a fragment to hold portal content references\n let portalContent: Node | null = null\n\n // Mount children to the target container\n // This runs synchronously when Portal component is executed (inside effect)\n portalContent = mountReactive(props.children, container)\n\n // Cleanup when Portal is unmounted\n onCleanup(() => {\n if (portalContent) {\n cleanupReactive(portalContent)\n if (portalContent.parentNode === container) {\n container.removeChild(portalContent)\n }\n }\n })\n\n return placeholder\n}\n"]}
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunkROYFUJN5_js=require('./chunk-ROYFUJN5.js');function x(i){if(!i)return {};let n={};i.display&&(n.display=i.display),i.flex!==void 0&&(n.flex=i.flex),i.flexDirection&&(n.flexDirection=i.flexDirection),i.flexWrap&&(n.flexWrap=i.flexWrap),i.justifyContent&&(n.justifyContent=i.justifyContent),i.alignItems&&(n.alignItems=i.alignItems),i.alignSelf&&(n.alignSelf=i.alignSelf),i.gap!==void 0&&(n.gap=`${i.gap}px`),i.padding!==void 0&&(n.padding=`${i.padding}px`),i.paddingTop!==void 0&&(n.paddingTop=`${i.paddingTop}px`),i.paddingRight!==void 0&&(n.paddingRight=`${i.paddingRight}px`),i.paddingBottom!==void 0&&(n.paddingBottom=`${i.paddingBottom}px`),i.paddingLeft!==void 0&&(n.paddingLeft=`${i.paddingLeft}px`),i.paddingHorizontal!==void 0&&(n.paddingLeft=`${i.paddingHorizontal}px`,n.paddingRight=`${i.paddingHorizontal}px`),i.paddingVertical!==void 0&&(n.paddingTop=`${i.paddingVertical}px`,n.paddingBottom=`${i.paddingVertical}px`),i.margin!==void 0&&(n.margin=`${i.margin}px`),i.marginTop!==void 0&&(n.marginTop=`${i.marginTop}px`),i.marginRight!==void 0&&(n.marginRight=`${i.marginRight}px`),i.marginBottom!==void 0&&(n.marginBottom=`${i.marginBottom}px`),i.marginLeft!==void 0&&(n.marginLeft=`${i.marginLeft}px`),i.marginHorizontal!==void 0&&(n.marginLeft=`${i.marginHorizontal}px`,n.marginRight=`${i.marginHorizontal}px`),i.marginVertical!==void 0&&(n.marginTop=`${i.marginVertical}px`,n.marginBottom=`${i.marginVertical}px`),i.width!==void 0&&(n.width=typeof i.width=="number"?`${i.width}px`:i.width),i.height!==void 0&&(n.height=typeof i.height=="number"?`${i.height}px`:i.height),i.minWidth!==void 0&&(n.minWidth=`${i.minWidth}px`),i.maxWidth!==void 0&&(n.maxWidth=`${i.maxWidth}px`),i.minHeight!==void 0&&(n.minHeight=`${i.minHeight}px`),i.maxHeight!==void 0&&(n.maxHeight=`${i.maxHeight}px`),i.backgroundColor&&(n.backgroundColor=i.backgroundColor),i.borderRadius!==void 0&&(n.borderRadius=`${i.borderRadius}px`),i.borderTopLeftRadius!==void 0&&(n.borderTopLeftRadius=`${i.borderTopLeftRadius}px`),i.borderTopRightRadius!==void 0&&(n.borderTopRightRadius=`${i.borderTopRightRadius}px`),i.borderBottomLeftRadius!==void 0&&(n.borderBottomLeftRadius=`${i.borderBottomLeftRadius}px`),i.borderBottomRightRadius!==void 0&&(n.borderBottomRightRadius=`${i.borderBottomRightRadius}px`),i.opacity!==void 0&&(n.opacity=i.opacity),i.borderWidth!==void 0&&(n.borderWidth=`${i.borderWidth}px`),i.borderColor&&(n.borderColor=i.borderColor),i.borderTopWidth!==void 0&&(n.borderTopWidth=`${i.borderTopWidth}px`),i.borderRightWidth!==void 0&&(n.borderRightWidth=`${i.borderRightWidth}px`),i.borderBottomWidth!==void 0&&(n.borderBottomWidth=`${i.borderBottomWidth}px`),i.borderLeftWidth!==void 0&&(n.borderLeftWidth=`${i.borderLeftWidth}px`),i.position&&(n.position=i.position),i.top!==void 0&&(n.top=`${i.top}px`),i.right!==void 0&&(n.right=`${i.right}px`),i.bottom!==void 0&&(n.bottom=`${i.bottom}px`),i.left!==void 0&&(n.left=`${i.left}px`),i.zIndex!==void 0&&(n.zIndex=i.zIndex),i.transform&&(n.transform=i.transform);let o=i;return o.color&&(n.color=o.color),o.fontSize!==void 0&&(n.fontSize=`${o.fontSize}px`),o.fontWeight&&(n.fontWeight=o.fontWeight),o.fontFamily&&(n.fontFamily=o.fontFamily),o.fontStyle&&(n.fontStyle=o.fontStyle),o.textAlign&&(n.textAlign=o.textAlign),o.textDecoration&&(n.textDecoration=o.textDecoration),o.lineHeight!==void 0&&(n.lineHeight=`${o.lineHeight}px`),o.letterSpacing!==void 0&&(n.letterSpacing=`${o.letterSpacing}px`),n}function k(i){return chunkROYFUJN5_js.n(i)}function e(i){return k(i)||i!==null&&typeof i=="object"&&"value"in i&&"peek"in i?i.value:i}function b(i,n,o,r){if(!n)return;let d=Array.isArray(n)?n:[n];for(let t of d)if(!(!t||!t.type))switch(t.type){case "canvas-rect":D(i,t.props);break;case "canvas-circle":W(i,t.props);break;case "canvas-path":C(i,t.props);break;case "canvas-text":S(i,t.props);break;case "canvas-line":v(i,t.props);break;case "canvas-arc":T(i,t.props);break}}function D(i,n){let o=e(n.x),r=e(n.y),d=e(n.width),t=e(n.height),a=e(n.fill),f=e(n.stroke),p=e(n.strokeWidth),g=e(n.opacity);i.save(),g!==void 0&&(i.globalAlpha=g),a&&(i.fillStyle=a,i.fillRect(o,r,d,t)),f&&(i.strokeStyle=f,i.lineWidth=p||1,i.strokeRect(o,r,d,t)),i.restore();}function W(i,n){let o=e(n.x),r=e(n.y),d=e(n.radius),t=e(n.fill),a=e(n.stroke),f=e(n.strokeWidth),p=e(n.opacity);i.save(),p!==void 0&&(i.globalAlpha=p),i.beginPath(),i.arc(o,r,d,0,2*Math.PI),t&&(i.fillStyle=t,i.fill()),a&&(i.strokeStyle=a,i.lineWidth=f||1,i.stroke()),i.restore();}function C(i,n){let o=e(n.d),r=e(n.fill),d=e(n.stroke),t=e(n.strokeWidth),a=e(n.opacity);i.save(),a!==void 0&&(i.globalAlpha=a);let f=new Path2D(o);r&&(i.fillStyle=r,i.fill(f)),d&&(i.strokeStyle=d,i.lineWidth=t||1,i.stroke(f)),i.restore();}function S(i,n){let o=e(n.x),r=e(n.y),d=e(n.text),t=e(n.fill),a=e(n.fontSize)||12,f=e(n.fontFamily)||"sans-serif",p=e(n.fontWeight)||"normal",g=e(n.textAlign)||"left",m=e(n.textBaseline)||"alphabetic";i.save(),i.font=`${p} ${a}px ${f}`,i.textAlign=g,i.textBaseline=m,t&&(i.fillStyle=t,i.fillText(d,o,r)),i.restore();}function v(i,n){let o=e(n.x1),r=e(n.y1),d=e(n.x2),t=e(n.y2),a=e(n.stroke)||"black",f=e(n.strokeWidth)||1,p=e(n.opacity);i.save(),p!==void 0&&(i.globalAlpha=p),i.beginPath(),i.moveTo(o,r),i.lineTo(d,t),i.strokeStyle=a,i.lineWidth=f,i.stroke(),i.restore();}function T(i,n){let o=e(n.x),r=e(n.y),d=e(n.radius),t=e(n.startAngle),a=e(n.endAngle),f=e(n.counterclockwise)||false,p=e(n.fill),g=e(n.stroke),m=e(n.strokeWidth),h=e(n.opacity);i.save(),h!==void 0&&(i.globalAlpha=h),i.beginPath(),i.arc(o,r,d,t,a,f),p&&(i.fillStyle=p,i.fill()),g&&(i.strokeStyle=g,i.lineWidth=m||1,i.stroke()),i.restore();}function N(i){let{width:n,height:o,children:r,style:d,id:t,...a}=i;return {type:"canvas",props:{...a,id:t,width:n,height:o,style:x(d),ref:f=>{if(!f||typeof requestAnimationFrame>"u")return;let p=f.getContext("2d");p&&import('./signal-XZXQ4VYQ.js').then(({effect:g,onCleanup:m,isSignal:h})=>{let c,R=()=>{c!==void 0&&cancelAnimationFrame(c),c=requestAnimationFrame(()=>{p.clearRect(0,0,n,o),b(p,r),c=void 0;});};g(()=>{let w=Array.isArray(r)?r:[r];for(let u of w)if(u&&u.props)for(let $ in u.props){let s=u.props[$];h(s)&&s.value;}R(),m(()=>{c!==void 0&&(cancelAnimationFrame(c),c=void 0);});});}).catch(g=>{console.error("[Flexium Canvas] Failed to load signal module:",g);});}},children:[]}}function I(i){return {type:"canvas-rect",props:i,children:[]}}function j(i){return {type:"canvas-circle",props:i,children:[]}}function M(i){return {type:"canvas-arc",props:i,children:[]}}function E(i){return {type:"canvas-line",props:i,children:[]}}function J(i){return {type:"canvas-path",props:i,children:[]}}function O(i){return {type:"canvas-text",props:i,children:[]}}exports.a=x;exports.b=e;exports.c=b;exports.d=N;exports.e=I;exports.f=j;exports.g=M;exports.h=E;exports.i=J;exports.j=O;//# sourceMappingURL=chunk-GDBJ322I.js.map
2
+ //# sourceMappingURL=chunk-GDBJ322I.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/primitives/utils.ts","../src/primitives/canvas/utils.ts","../src/primitives/canvas/renderer.ts","../src/primitives/canvas/Canvas.ts","../src/primitives/canvas/DrawRect.ts","../src/primitives/canvas/DrawCircle.ts","../src/primitives/canvas/DrawArc.ts","../src/primitives/canvas/DrawLine.ts","../src/primitives/canvas/DrawPath.ts","../src/primitives/canvas/DrawText.ts"],"names":["normalizeStyle","style","css","textStyle","isSignal","value","unwrapSignal","renderCanvasChildren","ctx","children","_width","_height","childArray","child","renderRect","renderCircle","renderPath","renderText","renderLine","renderArc","props","x","y","width","height","fill","stroke","strokeWidth","opacity","radius","d","path","text","fontSize","fontFamily","fontWeight","textAlign","textBaseline","x1","y1","x2","y2","startAngle","endAngle","counterclockwise","Canvas","id","rest","canvas","effect","onCleanup","rafId","scheduleRender","key","err","DrawRect","DrawCircle","DrawArc","DrawLine","DrawPath","DrawText"],"mappings":"iEASO,SAASA,EACdC,CAAAA,CAEqB,CACrB,GAAI,CAACA,EAAO,OAAO,EAAC,CAGpB,IAAMC,EAA2B,EAAC,CAG9BD,EAAM,OAAA,GAASC,CAAAA,CAAI,QAAUD,CAAAA,CAAM,OAAA,CAAA,CACnCA,CAAAA,CAAM,IAAA,GAAS,SAAWC,CAAAA,CAAI,IAAA,CAAOD,EAAM,IAAA,CAAA,CAC3CA,CAAAA,CAAM,gBAAeC,CAAAA,CAAI,aAAA,CAAgBD,CAAAA,CAAM,aAAA,CAAA,CAC/CA,EAAM,QAAA,GAAUC,CAAAA,CAAI,SAAWD,CAAAA,CAAM,QAAA,CAAA,CACrCA,EAAM,cAAA,GAAgBC,CAAAA,CAAI,cAAA,CAAiBD,CAAAA,CAAM,gBACjDA,CAAAA,CAAM,UAAA,GAAYC,EAAI,UAAA,CAAaD,CAAAA,CAAM,YACzCA,CAAAA,CAAM,SAAA,GAAWC,CAAAA,CAAI,SAAA,CAAYD,EAAM,SAAA,CAAA,CACvCA,CAAAA,CAAM,MAAQ,MAAA,GAAWC,CAAAA,CAAI,IAAM,CAAA,EAAGD,CAAAA,CAAM,GAAG,CAAA,EAAA,CAAA,CAAA,CAG/CA,EAAM,OAAA,GAAY,MAAA,GAAWC,EAAI,OAAA,CAAU,CAAA,EAAGD,EAAM,OAAO,CAAA,EAAA,CAAA,CAAA,CAC3DA,CA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A,CAAU,EACZ,CACF,CCxFO,SAASC,CAAAA,CAASnC,CAAAA,CAA6B,CACpD,OAAO,CACL,IAAA,CAAM,cACN,KAAA,CAAAA,CAAAA,CACA,SAAU,EACZ,CACF,CCNO,SAASoC,CAAAA,CAAWpC,CAAAA,CAA+B,CACxD,OAAO,CACL,KAAM,eAAA,CACN,KAAA,CAAAA,CAAAA,CACA,QAAA,CAAU,EACZ,CACF,CCNO,SAASqC,CAAAA,CAAQrC,EAA4B,CAClD,OAAO,CACL,IAAA,CAAM,aACN,KAAA,CAAAA,CAAAA,CACA,SAAU,EACZ,CACF,CCNO,SAASsC,CAAAA,CAAStC,CAAAA,CAA6B,CACpD,OAAO,CACL,KAAM,aAAA,CACN,KAAA,CAAAA,EACA,QAAA,CAAU,EACZ,CACF,CCNO,SAASuC,CAAAA,CAASvC,EAA6B,CACpD,OAAO,CACL,IAAA,CAAM,aAAA,CACN,KAAA,CAAAA,CAAAA,CACA,SAAU,EACZ,CACF,CCNO,SAASwC,EAASxC,CAAAA,CAA6B,CACpD,OAAO,CACL,KAAM,aAAA,CACN,KAAA,CAAAA,EACA,QAAA,CAAU,EACZ,CACF","file":"chunk-GDBJ322I.js","sourcesContent":["/**\n * Primitive utilities\n */\n\nimport type { CommonStyle, TextStyle } from './types'\n\n/**\n * Normalize CommonStyle to CSS properties\n */\nexport function normalizeStyle(\n style?: CommonStyle | TextStyle\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): Record<string, any> {\n if (!style) return {}\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const css: Record<string, any> = {}\n\n // Layout\n if (style.display) css.display = style.display\n if (style.flex !== undefined) css.flex = style.flex\n if (style.flexDirection) css.flexDirection = style.flexDirection\n if (style.flexWrap) css.flexWrap = style.flexWrap\n if (style.justifyContent) css.justifyContent = style.justifyContent\n if (style.alignItems) css.alignItems = style.alignItems\n if (style.alignSelf) css.alignSelf = style.alignSelf\n if (style.gap !== undefined) css.gap = `${style.gap}px`\n\n // Spacing - padding\n if (style.padding !== undefined) css.padding = `${style.padding}px`\n if (style.paddingTop !== undefined) css.paddingTop = `${style.paddingTop}px`\n if (style.paddingRight !== undefined)\n css.paddingRight = `${style.paddingRight}px`\n if (style.paddingBottom !== undefined)\n css.paddingBottom = `${style.paddingBottom}px`\n if (style.paddingLeft !== undefined)\n css.paddingLeft = `${style.paddingLeft}px`\n if (style.paddingHorizontal !== undefined) {\n css.paddingLeft = `${style.paddingHorizontal}px`\n css.paddingRight = `${style.paddingHorizontal}px`\n }\n if (style.paddingVertical !== undefined) {\n css.paddingTop = `${style.paddingVertical}px`\n css.paddingBottom = `${style.paddingVertical}px`\n }\n\n // Spacing - margin\n if (style.margin !== undefined) css.margin = `${style.margin}px`\n if (style.marginTop !== undefined) css.marginTop = `${style.marginTop}px`\n if (style.marginRight !== undefined)\n css.marginRight = `${style.marginRight}px`\n if (style.marginBottom !== undefined)\n css.marginBottom = `${style.marginBottom}px`\n if (style.marginLeft !== undefined) css.marginLeft = `${style.marginLeft}px`\n if (style.marginHorizontal !== undefined) {\n css.marginLeft = `${style.marginHorizontal}px`\n css.marginRight = `${style.marginHorizontal}px`\n }\n if (style.marginVertical !== undefined) {\n css.marginTop = `${style.marginVertical}px`\n css.marginBottom = `${style.marginVertical}px`\n }\n\n // Sizing\n if (style.width !== undefined)\n css.width =\n typeof style.width === 'number' ? `${style.width}px` : style.width\n if (style.height !== undefined)\n css.height =\n typeof style.height === 'number' ? `${style.height}px` : style.height\n if (style.minWidth !== undefined) css.minWidth = `${style.minWidth}px`\n if (style.maxWidth !== undefined) css.maxWidth = `${style.maxWidth}px`\n if (style.minHeight !== undefined) css.minHeight = `${style.minHeight}px`\n if (style.maxHeight !== undefined) css.maxHeight = `${style.maxHeight}px`\n\n // Visual\n if (style.backgroundColor) css.backgroundColor = style.backgroundColor\n if (style.borderRadius !== undefined)\n css.borderRadius = `${style.borderRadius}px`\n if (style.borderTopLeftRadius !== undefined)\n css.borderTopLeftRadius = `${style.borderTopLeftRadius}px`\n if (style.borderTopRightRadius !== undefined)\n css.borderTopRightRadius = `${style.borderTopRightRadius}px`\n if (style.borderBottomLeftRadius !== undefined)\n css.borderBottomLeftRadius = `${style.borderBottomLeftRadius}px`\n if (style.borderBottomRightRadius !== undefined)\n css.borderBottomRightRadius = `${style.borderBottomRightRadius}px`\n if (style.opacity !== undefined) css.opacity = style.opacity\n\n // Border\n if (style.borderWidth !== undefined)\n css.borderWidth = `${style.borderWidth}px`\n if (style.borderColor) css.borderColor = style.borderColor\n if (style.borderTopWidth !== undefined)\n css.borderTopWidth = `${style.borderTopWidth}px`\n if (style.borderRightWidth !== undefined)\n css.borderRightWidth = `${style.borderRightWidth}px`\n if (style.borderBottomWidth !== undefined)\n css.borderBottomWidth = `${style.borderBottomWidth}px`\n if (style.borderLeftWidth !== undefined)\n css.borderLeftWidth = `${style.borderLeftWidth}px`\n\n // Position\n if (style.position) css.position = style.position\n if (style.top !== undefined) css.top = `${style.top}px`\n if (style.right !== undefined) css.right = `${style.right}px`\n if (style.bottom !== undefined) css.bottom = `${style.bottom}px`\n if (style.left !== undefined) css.left = `${style.left}px`\n if (style.zIndex !== undefined) css.zIndex = style.zIndex\n\n // Transform\n if (style.transform) css.transform = style.transform\n\n // Text-specific (if TextStyle)\n const textStyle = style as TextStyle\n if (textStyle.color) css.color = textStyle.color\n if (textStyle.fontSize !== undefined) css.fontSize = `${textStyle.fontSize}px`\n if (textStyle.fontWeight) css.fontWeight = textStyle.fontWeight\n if (textStyle.fontFamily) css.fontFamily = textStyle.fontFamily\n if (textStyle.fontStyle) css.fontStyle = textStyle.fontStyle\n if (textStyle.textAlign) css.textAlign = textStyle.textAlign\n if (textStyle.textDecoration) css.textDecoration = textStyle.textDecoration\n if (textStyle.lineHeight !== undefined)\n css.lineHeight = `${textStyle.lineHeight}px`\n if (textStyle.letterSpacing !== undefined)\n css.letterSpacing = `${textStyle.letterSpacing}px`\n\n return css\n}\n","/**\n * Canvas utilities\n */\n\nimport { isSignal as coreIsSignal } from '../../core/signal'\nimport type { Signal } from '../../core/signal'\n\n/**\n * Check if a value is a Signal\n */\nexport function isSignal<T>(value: T | Signal<T>): value is Signal<T> {\n // Use core isSignal which checks for SIGNAL_MARKER symbol\n // Signals are functions with properties, not plain objects\n return coreIsSignal(value)\n}\n\n/**\n * Unwrap a value that might be a Signal\n */\nexport function unwrapSignal<T>(value: T | Signal<T>): T {\n // Check for real signals first (have SIGNAL_MARKER)\n if (isSignal(value)) {\n return value.value\n }\n // Handle signal-like objects (for testing) - duck typing\n // Check if it's an object with a 'value' property\n if (\n value !== null &&\n typeof value === 'object' &&\n 'value' in value &&\n 'peek' in value\n ) {\n return (value as any).value\n }\n return value\n}\n","/**\n * Canvas renderer - renders canvas primitives to canvas context\n */\n\nimport type {\n DrawRectProps,\n DrawCircleProps,\n DrawPathProps,\n DrawTextProps,\n DrawLineProps,\n DrawArcProps,\n} from '../types'\nimport { unwrapSignal } from './utils'\n\n/**\n * Render canvas children to context\n */\nexport function renderCanvasChildren(\n ctx: CanvasRenderingContext2D,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n children: any,\n _width: number,\n _height: number\n): void {\n if (!children) return\n\n const childArray = Array.isArray(children) ? children : [children]\n\n for (const child of childArray) {\n if (!child || !child.type) continue\n\n switch (child.type) {\n case 'canvas-rect':\n renderRect(ctx, child.props)\n break\n case 'canvas-circle':\n renderCircle(ctx, child.props)\n break\n case 'canvas-path':\n renderPath(ctx, child.props)\n break\n case 'canvas-text':\n renderText(ctx, child.props)\n break\n case 'canvas-line':\n renderLine(ctx, child.props)\n break\n case 'canvas-arc':\n renderArc(ctx, child.props)\n break\n }\n }\n}\n\n/**\n * Render rectangle\n */\nfunction renderRect(ctx: CanvasRenderingContext2D, props: DrawRectProps): void {\n const x = unwrapSignal(props.x)\n const y = unwrapSignal(props.y)\n const width = unwrapSignal(props.width)\n const height = unwrapSignal(props.height)\n const fill = unwrapSignal(props.fill)\n const stroke = unwrapSignal(props.stroke)\n const strokeWidth = unwrapSignal(props.strokeWidth)\n const opacity = unwrapSignal(props.opacity)\n\n ctx.save()\n\n if (opacity !== undefined) {\n ctx.globalAlpha = opacity\n }\n\n if (fill) {\n ctx.fillStyle = fill\n ctx.fillRect(x, y, width, height)\n }\n\n if (stroke) {\n ctx.strokeStyle = stroke\n ctx.lineWidth = strokeWidth || 1\n ctx.strokeRect(x, y, width, height)\n }\n\n ctx.restore()\n}\n\n/**\n * Render circle\n */\nfunction renderCircle(\n ctx: CanvasRenderingContext2D,\n props: DrawCircleProps\n): void {\n const x = unwrapSignal(props.x)\n const y = unwrapSignal(props.y)\n const radius = unwrapSignal(props.radius)\n const fill = unwrapSignal(props.fill)\n const stroke = unwrapSignal(props.stroke)\n const strokeWidth = unwrapSignal(props.strokeWidth)\n const opacity = unwrapSignal(props.opacity)\n\n ctx.save()\n\n if (opacity !== undefined) {\n ctx.globalAlpha = opacity\n }\n\n ctx.beginPath()\n ctx.arc(x, y, radius, 0, 2 * Math.PI)\n\n if (fill) {\n ctx.fillStyle = fill\n ctx.fill()\n }\n\n if (stroke) {\n ctx.strokeStyle = stroke\n ctx.lineWidth = strokeWidth || 1\n ctx.stroke()\n }\n\n ctx.restore()\n}\n\n/**\n * Render path\n */\nfunction renderPath(ctx: CanvasRenderingContext2D, props: DrawPathProps): void {\n const d = unwrapSignal(props.d)\n const fill = unwrapSignal(props.fill)\n const stroke = unwrapSignal(props.stroke)\n const strokeWidth = unwrapSignal(props.strokeWidth)\n const opacity = unwrapSignal(props.opacity)\n\n ctx.save()\n\n if (opacity !== undefined) {\n ctx.globalAlpha = opacity\n }\n\n // Parse SVG path (simplified - only supports basic commands)\n const path = new Path2D(d)\n\n if (fill) {\n ctx.fillStyle = fill\n ctx.fill(path)\n }\n\n if (stroke) {\n ctx.strokeStyle = stroke\n ctx.lineWidth = strokeWidth || 1\n ctx.stroke(path)\n }\n\n ctx.restore()\n}\n\n/**\n * Render text\n */\nfunction renderText(ctx: CanvasRenderingContext2D, props: DrawTextProps): void {\n const x = unwrapSignal(props.x)\n const y = unwrapSignal(props.y)\n const text = unwrapSignal(props.text)\n const fill = unwrapSignal(props.fill)\n const fontSize = unwrapSignal(props.fontSize) || 12\n const fontFamily = unwrapSignal(props.fontFamily) || 'sans-serif'\n const fontWeight = unwrapSignal(props.fontWeight) || 'normal'\n const textAlign = unwrapSignal(props.textAlign) || 'left'\n const textBaseline = unwrapSignal(props.textBaseline) || 'alphabetic'\n\n ctx.save()\n\n ctx.font = `${fontWeight} ${fontSize}px ${fontFamily}`\n ctx.textAlign = textAlign\n ctx.textBaseline = textBaseline\n\n if (fill) {\n ctx.fillStyle = fill\n ctx.fillText(text, x, y)\n }\n\n ctx.restore()\n}\n\n/**\n * Render line\n */\nfunction renderLine(ctx: CanvasRenderingContext2D, props: DrawLineProps): void {\n const x1 = unwrapSignal(props.x1)\n const y1 = unwrapSignal(props.y1)\n const x2 = unwrapSignal(props.x2)\n const y2 = unwrapSignal(props.y2)\n const stroke = unwrapSignal(props.stroke) || 'black'\n const strokeWidth = unwrapSignal(props.strokeWidth) || 1\n const opacity = unwrapSignal(props.opacity)\n\n ctx.save()\n\n if (opacity !== undefined) {\n ctx.globalAlpha = opacity\n }\n\n ctx.beginPath()\n ctx.moveTo(x1, y1)\n ctx.lineTo(x2, y2)\n\n ctx.strokeStyle = stroke\n ctx.lineWidth = strokeWidth\n ctx.stroke()\n\n ctx.restore()\n}\n\n/**\n * Render arc\n */\nfunction renderArc(ctx: CanvasRenderingContext2D, props: DrawArcProps): void {\n const x = unwrapSignal(props.x)\n const y = unwrapSignal(props.y)\n const radius = unwrapSignal(props.radius)\n const startAngle = unwrapSignal(props.startAngle)\n const endAngle = unwrapSignal(props.endAngle)\n const counterclockwise = unwrapSignal(props.counterclockwise) || false\n const fill = unwrapSignal(props.fill)\n const stroke = unwrapSignal(props.stroke)\n const strokeWidth = unwrapSignal(props.strokeWidth)\n const opacity = unwrapSignal(props.opacity)\n\n ctx.save()\n\n if (opacity !== undefined) {\n ctx.globalAlpha = opacity\n }\n\n ctx.beginPath()\n ctx.arc(x, y, radius, startAngle, endAngle, counterclockwise)\n\n if (fill) {\n ctx.fillStyle = fill\n ctx.fill()\n }\n\n if (stroke) {\n ctx.strokeStyle = stroke\n ctx.lineWidth = strokeWidth || 1\n ctx.stroke()\n }\n\n ctx.restore()\n}\n","/**\n * Canvas - Declarative canvas container with JSX drawing\n *\n * Supports Signal-based reactive rendering\n *\n * @example\n * ```tsx\n * const x = signal(50)\n *\n * <Canvas width={300} height={200}>\n * <Rect x={x} y={50} width={100} height={50} fill=\"blue\" />\n * <Circle x={150} y={100} radius={30} fill=\"red\" />\n * </Canvas>\n * ```\n */\n\nimport type { FNode } from '../../types'\nimport type { CanvasProps } from '../types'\nimport { normalizeStyle } from '../utils'\nimport { renderCanvasChildren } from './renderer'\n\nexport function Canvas(props: CanvasProps): FNode {\n const { width, height, children, style, id, ...rest } = props\n\n return {\n type: 'canvas',\n props: {\n ...rest,\n id,\n width,\n height,\n style: normalizeStyle(style),\n // Attach canvas renderer when element is mounted\n ref: (canvas: HTMLCanvasElement | null) => {\n if (!canvas) return\n\n // SSR guard: skip canvas rendering on server\n if (typeof requestAnimationFrame === 'undefined') return\n\n const ctx = canvas.getContext('2d')\n if (!ctx) return\n\n // Render canvas children with effect for reactivity\n // Import effect and onCleanup dynamically to avoid circular deps\n import('../../core/signal')\n .then(({ effect, onCleanup, isSignal }) => {\n let rafId: number | undefined\n\n const scheduleRender = () => {\n if (rafId !== undefined) {\n cancelAnimationFrame(rafId)\n }\n\n rafId = requestAnimationFrame(() => {\n // Clear canvas\n ctx.clearRect(0, 0, width, height)\n\n // Render all children\n renderCanvasChildren(ctx, children, width, height)\n\n rafId = undefined\n })\n }\n\n effect(() => {\n // To track signal dependencies, we need to access them in the effect\n // Walk through children and touch any signals to track dependencies\n const childArray = Array.isArray(children) ? children : [children]\n for (const child of childArray) {\n if (child && child.props) {\n // Touch each prop to track signal dependencies\n for (const key in child.props) {\n const value = child.props[key]\n // If it's a signal, access its value to track it\n if (isSignal(value)) {\n void value.value // Touch the signal to track dependency\n }\n }\n }\n }\n\n // Now schedule the actual render\n scheduleRender()\n\n // Cleanup RAF when effect is disposed\n onCleanup(() => {\n if (rafId !== undefined) {\n cancelAnimationFrame(rafId)\n rafId = undefined\n }\n })\n })\n })\n .catch((err) => {\n console.error('[Flexium Canvas] Failed to load signal module:', err)\n })\n },\n },\n children: [],\n }\n}\n","/**\n * DrawRect - Canvas rectangle primitive\n *\n * @example\n * ```tsx\n * <DrawRect x={10} y={10} width={100} height={50} fill=\"blue\" />\n * ```\n */\n\nimport type { FNode } from '../../types'\nimport type { DrawRectProps } from '../types'\n\nexport function DrawRect(props: DrawRectProps): FNode {\n return {\n type: 'canvas-rect',\n props,\n children: [],\n }\n}\n","/**\n * DrawCircle - Canvas circle primitive\n *\n * @example\n * ```tsx\n * <DrawCircle x={100} y={100} radius={50} fill=\"red\" />\n * ```\n */\n\nimport type { FNode } from '../../types'\nimport type { DrawCircleProps } from '../types'\n\nexport function DrawCircle(props: DrawCircleProps): FNode {\n return {\n type: 'canvas-circle',\n props,\n children: [],\n }\n}\n","/**\n * DrawArc - Canvas arc primitive\n *\n * @example\n * ```tsx\n * <DrawArc x={100} y={100} radius={50} startAngle={0} endAngle={Math.PI} fill=\"green\" />\n * ```\n */\n\nimport type { FNode } from '../../types'\nimport type { DrawArcProps } from '../types'\n\nexport function DrawArc(props: DrawArcProps): FNode {\n return {\n type: 'canvas-arc',\n props,\n children: [],\n }\n}\n","/**\n * DrawLine - Canvas line primitive\n *\n * @example\n * ```tsx\n * <DrawLine x1={10} y1={10} x2={100} y2={100} stroke=\"black\" strokeWidth={2} />\n * ```\n */\n\nimport type { FNode } from '../../types'\nimport type { DrawLineProps } from '../types'\n\nexport function DrawLine(props: DrawLineProps): FNode {\n return {\n type: 'canvas-line',\n props,\n children: [],\n }\n}\n","/**\n * DrawPath - Canvas path primitive\n *\n * @example\n * ```tsx\n * <DrawPath d=\"M 10 10 L 100 100\" stroke=\"black\" strokeWidth={2} />\n * ```\n */\n\nimport type { FNode } from '../../types'\nimport type { DrawPathProps } from '../types'\n\nexport function DrawPath(props: DrawPathProps): FNode {\n return {\n type: 'canvas-path',\n props,\n children: [],\n }\n}\n","/**\n * DrawText - Canvas text primitive\n *\n * @example\n * ```tsx\n * <DrawText x={50} y={50} text=\"Hello Canvas\" fontSize={20} fill=\"black\" />\n * ```\n */\n\nimport type { FNode } from '../../types'\nimport type { DrawTextProps } from '../types'\n\nexport function DrawText(props: DrawTextProps): FNode {\n return {\n type: 'canvas-text',\n props,\n children: [],\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunkROYFUJN5_js=require('./chunk-ROYFUJN5.js');var g=Symbol.for("flexium.stateSignal");function j(e,a){let n=e;return n._signal=e,n._stateActions=a,n}function I(e){return {value:void 0,peek:e.peek,_signal:e,_isComputed:true}}function K(e){let a=e;return a._signal=e,a}var u=new Map,R=1e4,O=false,m=null;function E(e){m=e;}function G(){return {id:Symbol("component"),hookIndex:0,hooks:[]}}function H(e){e.hookIndex=0;}var z=new WeakMap;function C(e){if(typeof e=="string")return e;let a=z.get(e);if(a!==void 0)return a;try{let n=JSON.stringify(e);return z.set(e,n),n}catch(n){return console.warn("[Flexium] Failed to serialize state key, using fallback:",n),String(e)}}function k(){process.env.NODE_ENV!=="production"&&!O&&u.size>=R&&(O=true,console.warn(`[Flexium] Global state registry has ${u.size} entries. Consider using state.delete(key) to clean up unused states, or state.clear() to reset all global states.`));}function F(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&g in e}function W(e){return F(e)?e[g]:null}function y(e){let a=function(){return e.value};return new Proxy(a,{apply(){return e.value},get(p,o){if(o===g)return e;if(o===Symbol.toPrimitive)return S=>e.value;if(o==="valueOf")return ()=>e.value;if(o==="toString")return ()=>String(e.value);if(o==="toJSON")return ()=>e.value;let r=e.value;if(r!==null&&typeof r=="object"){let S=r[o];return typeof S=="function"?S.bind(r):S}},has(p,o){if(o===g)return true;let r=e.value;return r!==null&&typeof r=="object"?o in r:false},ownKeys(p){let o=e.value;return o!==null&&typeof o=="object"?Reflect.ownKeys(o):[]},getOwnPropertyDescriptor(p,o){if(o===g)return {configurable:true,enumerable:false,value:e};let r=e.value;if(r!==null&&typeof r=="object"){let S=Object.getOwnPropertyDescriptor(r,o);if(S)return {...S,configurable:true}}}})}function i(e,a){let n=a?.key?C(a.key):void 0,p=a?.params;if(m&&!n){let t=m,c=t.hookIndex++;if(c<t.hooks.length)return t.hooks[c];let b=m;m=null;let l=i(e,a);return m=b,t.hooks.push(l),l}if(n&&u.has(n)){let t=u.get(n),c="loading"in t&&t._stateActions?.refetch!==void 0,b=t._isComputed,l=y(t._signal);if(b)return [l];if(c){let T=t._stateActions?.refetch||(()=>{}),[d]=i(()=>t.error?"error":t.loading?"loading":t.value!==void 0?"success":"idle"),[f]=i(()=>t.error);return [l,T,d,f]}return [l,T=>{typeof T=="function"?t.value=T(t.peek()):t.value=T;}]}if(typeof e=="function"){let t=e,c=p!==void 0?()=>t(p):t;if(t.constructor.name==="AsyncFunction"){let[d,f]=chunkROYFUJN5_js.p(c,async A=>A),s=j(d,f);n&&(u.set(n,s),k());let v=y(s._signal),[w]=i(()=>s.error?"error":s.loading?"loading":s.value!==void 0?"success":"idle"),[P]=i(()=>s.error);return [v,f.refetch,w,P]}let l;try{l=c();}catch{let d=chunkROYFUJN5_js.i(c),f=I(d);return n&&(u.set(n,f),k()),[y(d)]}if(l instanceof Promise){let[d,f]=chunkROYFUJN5_js.p(c,async A=>A),s=j(d,f);n&&(u.set(n,s),k());let v=y(s._signal),[w]=i(()=>s.error?"error":s.loading?"loading":s.value!==void 0?"success":"idle"),[P]=i(()=>s.error);return [v,f.refetch,w,P]}let V=chunkROYFUJN5_js.i(c),T=I(V);return n&&(u.set(n,T),k()),[y(V)]}let o=chunkROYFUJN5_js.h(e),r=K(o);return n&&(u.set(n,r),k()),[y(o),t=>{typeof t=="function"?o.value=t(o.peek()):o.value=t;}]}i.delete=function(e){let a=C(e);return u.delete(a)};i.clear=function(){u.clear(),O=false;};i.has=function(e){let a=C(e);return u.has(a)};Object.defineProperty(i,"size",{get:()=>u.size,enumerable:true});var J=i;exports.a=E;exports.b=G;exports.c=H;exports.d=F;exports.e=W;exports.f=J;//# sourceMappingURL=chunk-I7UCVARB.js.map
2
+ //# sourceMappingURL=chunk-I7UCVARB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/state.ts"],"names":["STATE_SIGNAL","toStateObject","res","actions","s","toComputedStateObject","comp","toSignalStateObject","sig","globalStateRegistry","DEV_WARNING_THRESHOLD","hasWarnedAboutSize","currentComponent","setCurrentComponent","instance","createComponentInstance","resetHookIndex","keyCache","serializeKey","key","cached","serialized","error","checkRegistrySize","isStateValue","value","getStateSignal","stateValue","createStateProxy","target","_target","prop","_hint","currentValue","propValue","desc","state","initialValueOrFetcher","options","params","hookIndex","savedComponent","result","isAsync","isComputed","proxy","refetch","statusValue","errorValue","newValue","originalFn","fn","resActions","createResource","val","testResult","computed","signal","serializedKey","_state"],"mappings":"iEAMO,IAAMA,CAAAA,CAAe,OAAO,GAAA,CAAI,qBAAqB,EA2B5D,SAASC,CAAAA,CACPC,CAAAA,CACAC,CAAAA,CACa,CACb,IAAMC,EAAIF,CAAAA,CACV,OAAAE,EAAE,OAAA,CAAUF,CAAAA,CACZE,EAAE,aAAA,CAAgBD,CAAAA,CACXC,CACT,CAMA,SAASC,CAAAA,CAAyBC,EAAgC,CAChE,OAAO,CACL,KAAA,CAAO,MAAA,CACP,KAAMA,CAAAA,CAAK,IAAA,CACX,OAAA,CAASA,CAAAA,CACT,WAAA,CAAa,IACf,CACF,CAMA,SAASC,EAAuBC,CAAAA,CAA6B,CAC3D,IAAMJ,CAAAA,CAAII,CAAAA,CACV,OAAAJ,CAAAA,CAAE,OAAA,CAAUI,CAAAA,CACLJ,CACT,CAGA,IAAMK,EAAsB,IAAI,GAAA,CAG1BC,EAAwB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A,CAAaC,CAAG,CAAA,CACtC,OAAOV,EAAoB,MAAA,CAAOiD,CAAa,CACjD,CAAA,CAUAtB,CAAAA,CAAM,KAAA,CAAQ,UAAiB,CAC7B3B,CAAAA,CAAoB,OAAM,CAC1BE,CAAAA,CAAqB,MACvB,CAAA,CAYAyB,CAAAA,CAAM,GAAA,CAAM,SAASjB,CAAAA,CAAwB,CAC3C,IAAMuC,CAAAA,CAAgBxC,CAAAA,CAAaC,CAAG,CAAA,CACtC,OAAOV,EAAoB,GAAA,CAAIiD,CAAa,CAC9C,CAAA,CAKA,MAAA,CAAO,cAAA,CAAetB,EAAO,MAAA,CAAQ,CACnC,GAAA,CAAK,IAAM3B,CAAAA,CAAoB,IAAA,CAC/B,WAAY,IACd,CAAC,CAAA,CAGD,IAAMkD,CAAAA,CAASvB","file":"chunk-I7UCVARB.js","sourcesContent":["import { signal, computed as createComputed, createResource } from './signal'\nimport type { Signal, Computed, Resource } from './signal'\n\n/** Symbol to identify StateProxy and access underlying signal */\n// Use Symbol.for() to ensure the symbol is shared across module boundaries\n// This is important for Vite dev mode where modules may be loaded separately\nexport const STATE_SIGNAL = Symbol.for('flexium.stateSignal')\n\n/** Internal state object that may be a Signal, Computed, or Resource */\ninterface StateObject {\n value: unknown\n peek: () => unknown\n loading?: boolean\n error?: unknown\n state?: 'unresolved' | 'pending' | 'ready' | 'refreshing' | 'errored'\n latest?: unknown\n read?: () => unknown\n _stateActions?: StateActions\n _signal?: Signal<unknown> | Computed<unknown> | Resource<unknown>\n _isComputed?: boolean\n}\n\n/** Actions available for state mutation */\ninterface StateActions {\n mutate?: (value: unknown) => void\n refetch?: () => void\n}\n\n/**\n * Type-safe helper to wrap Resource as StateObject.\n * Consolidates unsafe type assertions in one place.\n * @internal\n */\nfunction toStateObject<T>(\n res: Resource<T>,\n actions: { mutate: (v: T | undefined) => void; refetch: () => void }\n): StateObject {\n const s = res as unknown as StateObject\n s._signal = res as Resource<unknown>\n s._stateActions = actions as StateActions\n return s\n}\n\n/**\n * Type-safe helper to create a computed StateObject.\n * @internal\n */\nfunction toComputedStateObject<T>(comp: Computed<T>): StateObject {\n return {\n value: undefined,\n peek: comp.peek,\n _signal: comp as Computed<unknown>,\n _isComputed: true,\n }\n}\n\n/**\n * Type-safe helper to wrap Signal as StateObject.\n * @internal\n */\nfunction toSignalStateObject<T>(sig: Signal<T>): StateObject {\n const s = sig as unknown as StateObject\n s._signal = sig as Signal<unknown>\n return s\n}\n\n// Global registry for keyed states\nconst globalStateRegistry = new Map<string, StateObject>()\n\n// Dev mode warning thresholds\nconst DEV_WARNING_THRESHOLD = 10000\nlet hasWarnedAboutSize = false\n\n// ============================================================================\n// Component Hook System - enables state() inside components\n// ============================================================================\n\ninterface ComponentInstance {\n id: symbol\n hookIndex: number\n hooks: unknown[]\n}\n\nlet currentComponent: ComponentInstance | null = null\n\n/**\n * Set the current component context for hook tracking.\n * Called by the renderer before executing a component function.\n * @internal\n */\nexport function setCurrentComponent(instance: ComponentInstance | null): void {\n currentComponent = instance\n}\n\n/**\n * Get the current component context.\n * @internal\n */\nexport function getCurrentComponent(): ComponentInstance | null {\n return currentComponent\n}\n\n/**\n * Create a new component instance for hook tracking.\n * @internal\n */\nexport function createComponentInstance(): ComponentInstance {\n return {\n id: Symbol('component'),\n hookIndex: 0,\n hooks: [],\n }\n}\n\n/**\n * Reset hook index for re-renders.\n * @internal\n */\nexport function resetHookIndex(instance: ComponentInstance): void {\n instance.hookIndex = 0\n}\n\n/** Key type - string or array of serializable values */\nexport type StateKey = string | readonly (string | number | boolean | null | undefined | object)[]\n\n// Cache for array key serialization to avoid repeated JSON.stringify calls\nconst keyCache = new WeakMap<readonly unknown[], string>()\n\n/**\n * Serialize a key to a string for registry lookup.\n * Arrays are JSON-stringified for consistent comparison.\n * Uses WeakMap cache to avoid repeated serialization of array keys.\n */\nfunction serializeKey(key: StateKey): string {\n if (typeof key === 'string') {\n return key\n }\n\n // Check cache first for array keys\n const cached = keyCache.get(key)\n if (cached !== undefined) {\n return cached\n }\n\n try {\n const serialized = JSON.stringify(key)\n keyCache.set(key, serialized)\n return serialized\n } catch (error) {\n // Handle circular references or other serialization errors\n console.warn('[Flexium] Failed to serialize state key, using fallback:', error)\n const fallback = String(key)\n return fallback\n }\n}\n\n/**\n * Check global state registry size and warn in development mode.\n * Does not enforce hard limits - use state.delete() or state.clear() for cleanup.\n * @internal\n */\nfunction checkRegistrySize(): void {\n if (\n process.env.NODE_ENV !== 'production' &&\n !hasWarnedAboutSize &&\n globalStateRegistry.size >= DEV_WARNING_THRESHOLD\n ) {\n hasWarnedAboutSize = true\n console.warn(\n `[Flexium] Global state registry has ${globalStateRegistry.size} entries. ` +\n `Consider using state.delete(key) to clean up unused states, ` +\n `or state.clear() to reset all global states.`\n )\n }\n}\n\n/** Action function type for state mutation */\nexport type StateAction<T> = (newValue: T | ((prev: T) => T)) => void\n\n/**\n * StateValue type - a value-like proxy that behaves like T.\n * Can be used directly in expressions and JSX.\n */\nexport type StateValue<T> = T & (() => T)\n\n/**\n * Check if a value is a StateValue (created by the state() API).\n * Useful for type guards and runtime detection of reactive state.\n * @internal\n * @param value - The value to check\n * @returns true if the value is a StateValue proxy, false otherwise\n *\n * @example\n * ```tsx\n * const count = state(0)\n * isStateValue(count) // true\n * isStateValue(5) // false\n * ```\n */\nexport function isStateValue(value: unknown): boolean {\n return (\n (typeof value === 'object' || typeof value === 'function') &&\n value !== null &&\n STATE_SIGNAL in value\n )\n}\n\n/**\n * Get the underlying signal from a StateValue proxy.\n * Used internally for reactive binding detection and DOM updates.\n * @internal\n * @param stateValue - The StateValue proxy to extract the signal from\n * @returns The underlying Signal if stateValue is a StateValue, null otherwise\n *\n * @example\n * ```tsx\n * const count = state(0)\n * const signal = getStateSignal(count) // Returns the internal Signal<number>\n * ```\n */\nexport function getStateSignal(stateValue: unknown): Signal<unknown> | null {\n if (isStateValue(stateValue)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (stateValue as any)[STATE_SIGNAL]\n }\n return null\n}\n\n/**\n * Create a reactive proxy that behaves like a value but stays reactive.\n * The proxy is also callable - calling it returns the current value.\n * This ensures compatibility with code expecting getter functions.\n */\nfunction createStateProxy<T>(sig: Signal<T> | Computed<T>): StateValue<T> {\n // Use a function as the target so the proxy is callable\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const target = function() { return sig.value } as any\n\n const proxy = new Proxy(target, {\n // Make the proxy callable - returns current value\n apply() {\n return sig.value\n },\n\n get(_target, prop) {\n // Return underlying signal for reactive binding detection\n if (prop === STATE_SIGNAL) {\n return sig\n }\n\n // Symbol.toPrimitive - called for +, -, ==, template literals, etc.\n if (prop === Symbol.toPrimitive) {\n return (_hint: string) => sig.value\n }\n\n // valueOf - called for numeric operations\n if (prop === 'valueOf') {\n return () => sig.value\n }\n\n // toString - called for string concatenation\n if (prop === 'toString') {\n return () => String(sig.value)\n }\n\n // toJSON - called for JSON.stringify\n if (prop === 'toJSON') {\n return () => sig.value\n }\n\n // For object/array values, access properties on current value\n // Note: accessing sig.value here tracks the signal in any enclosing effect\n const currentValue = sig.value\n\n if (currentValue !== null && typeof currentValue === 'object') {\n const propValue = (currentValue as Record<string | symbol, unknown>)[prop]\n // If it's a function (like array methods), bind it to the current value\n if (typeof propValue === 'function') {\n return propValue.bind(currentValue)\n }\n return propValue\n }\n\n return undefined\n },\n\n // For property checks (like 'length' in array)\n has(_target, prop) {\n if (prop === STATE_SIGNAL) return true\n const currentValue = sig.value\n if (currentValue !== null && typeof currentValue === 'object') {\n return prop in (currentValue as object)\n }\n return false\n },\n\n // For Object.keys, for...in loops\n ownKeys(_target) {\n const currentValue = sig.value\n if (currentValue !== null && typeof currentValue === 'object') {\n return Reflect.ownKeys(currentValue as object)\n }\n return []\n },\n\n getOwnPropertyDescriptor(_target, prop) {\n if (prop === STATE_SIGNAL) {\n return { configurable: true, enumerable: false, value: sig }\n }\n const currentValue = sig.value\n if (currentValue !== null && typeof currentValue === 'object') {\n const desc = Object.getOwnPropertyDescriptor(currentValue as object, prop)\n if (desc) {\n // Make it configurable to satisfy Proxy invariants\n return { ...desc, configurable: true }\n }\n }\n return undefined\n },\n })\n\n return proxy as StateValue<T>\n}\n\n/** Async state status */\nexport type AsyncStatus = 'idle' | 'loading' | 'success' | 'error'\n\n/** Options for state() */\nexport interface StateOptions<P = unknown> {\n /**\n * Key for global state sharing. Can be a string or array.\n * Array keys are useful for hierarchical namespacing.\n * @example\n * state('light', { key: 'theme' })\n * state(null, { key: ['user', 'profile', userId] })\n */\n key?: StateKey\n /**\n * Parameters to pass to the function (for computed/async state).\n * Improves DX by making dependencies explicit.\n * @example\n * state(\n * async ({ userId }) => fetch(`/api/users/${userId}`),\n * { key: ['user', userId], params: { userId } }\n * )\n */\n params?: P\n}\n\n/**\n * Unified State API\n *\n * One function for all reactive state needs - always returns an array for consistency:\n * 1. Simple state: const [count, setCount] = state(0)\n * 2. Derived state: const [doubled] = state(() => count * 2)\n * 3. Async state: const [data, refetch, status, error] = state(async () => fetch(...))\n * 4. Global state: const [theme, setTheme] = state('light', { key: 'theme' })\n * 5. With params: const [user] = state(async (p) => fetch(`/api/${p.id}`), { params: { id } })\n *\n * @example\n * ```tsx\n * function Counter() {\n * const [count, setCount] = state(0)\n * const [doubled] = state(() => count * 2)\n * return <Button onPress={() => setCount(count + 1)}>{doubled}</Button>\n * }\n * ```\n */\n// Static methods interface for the state function\ninterface StateFunction {\n // Overloads\n <T>(initialValue: T, options?: StateOptions): [StateValue<T>, StateAction<T>]\n <T, P>(computeFn: (params: P) => T, options: StateOptions<P> & { params: P }): [StateValue<T>]\n <T>(computeFn: () => T, options?: StateOptions): [StateValue<T>]\n <T, P>(fetcher: (params: P) => Promise<T>, options: StateOptions<P> & { params: P }): [StateValue<T | undefined>, () => void, StateValue<AsyncStatus>, StateValue<unknown>]\n <T>(fetcher: () => Promise<T>, options?: StateOptions): [StateValue<T | undefined>, () => void, StateValue<AsyncStatus>, StateValue<unknown>]\n\n /** Delete a specific global state by key */\n delete: (key: StateKey) => boolean\n /** Clear all global states */\n clear: () => void\n /** Check if a global state exists */\n has: (key: StateKey) => boolean\n /** Current number of global states */\n readonly size: number\n}\n\n// Overload 1: Value → [StateValue, Setter]\nfunction state<T>(\n initialValue: T,\n options?: StateOptions\n): [StateValue<T>, StateAction<T>]\n\n// Overload 2: Sync function with params → [StateValue] (derived, no setter)\nfunction state<T, P>(\n computeFn: (params: P) => T,\n options: StateOptions<P> & { params: P }\n): [StateValue<T>]\n\n// Overload 3: Sync function without params → [StateValue] (derived, no setter)\nfunction state<T>(\n computeFn: () => T,\n options?: StateOptions\n): [StateValue<T>]\n\n// Overload 4: Async function with params → [StateValue, refetch, status, error]\nfunction state<T, P>(\n fetcher: (params: P) => Promise<T>,\n options: StateOptions<P> & { params: P }\n): [StateValue<T | undefined>, () => void, StateValue<AsyncStatus>, StateValue<unknown>]\n\n// Overload 5: Async function without params → [StateValue, refetch, status, error]\nfunction state<T>(\n fetcher: () => Promise<T>,\n options?: StateOptions\n): [StateValue<T | undefined>, () => void, StateValue<AsyncStatus>, StateValue<unknown>]\n\nfunction state<T, P = unknown>(\n initialValueOrFetcher: T | ((params?: P) => T) | ((params?: P) => Promise<T>),\n options?: StateOptions<P>\n): [StateValue<T>] | [StateValue<T>, StateAction<T>] | [StateValue<T | undefined>, () => void, StateValue<AsyncStatus>, StateValue<unknown>] {\n const key = options?.key ? serializeKey(options.key) : undefined\n const params = options?.params\n\n // 0. Hook System - reuse state from previous render if inside a component\n if (currentComponent && !key) {\n const comp = currentComponent\n const hookIndex = comp.hookIndex++\n\n // Return existing hook if available\n if (hookIndex < comp.hooks.length) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return comp.hooks[hookIndex] as any\n }\n\n // Create new state and store in hooks array\n // Temporarily clear currentComponent to avoid infinite recursion\n const savedComponent = currentComponent\n currentComponent = null\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result = state(initialValueOrFetcher as any, options as any)\n currentComponent = savedComponent\n\n comp.hooks.push(result)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return result as any\n }\n\n // 1. Check Global Registry for keyed state\n if (key && globalStateRegistry.has(key)) {\n const cached = globalStateRegistry.get(key)!\n const isAsync = 'loading' in cached && cached._stateActions?.refetch !== undefined\n const isComputed = cached._isComputed\n\n const proxy = createStateProxy(cached._signal as Signal<T>)\n\n if (isComputed) {\n return [proxy] as [StateValue<T>]\n }\n\n if (isAsync) {\n const refetch = cached._stateActions?.refetch || (() => {})\n // Use state() for derived values - dogfooding the unified API\n const [statusValue] = state<AsyncStatus>(() => {\n if (cached.error) return 'error'\n if (cached.loading) return 'loading'\n if (cached.value !== undefined) return 'success'\n return 'idle'\n })\n const [errorValue] = state<unknown>(() => cached.error)\n return [proxy, refetch, statusValue, errorValue] as [StateValue<T | undefined>, () => void, StateValue<AsyncStatus>, StateValue<unknown>]\n }\n\n const setter: StateAction<T> = (newValue) => {\n if (typeof newValue === 'function') {\n cached.value = (newValue as (prev: T) => T)(cached.peek() as T)\n } else {\n cached.value = newValue\n }\n }\n return [proxy, setter] as [StateValue<T>, StateAction<T>]\n }\n\n // 2. Handle function input (computed or async)\n if (typeof initialValueOrFetcher === 'function') {\n const originalFn = initialValueOrFetcher as (params?: P) => T | Promise<T>\n // Wrap function to inject params if provided\n const fn = params !== undefined\n ? () => originalFn(params)\n : originalFn as () => T | Promise<T>\n\n // Try to detect if it's async by checking constructor name\n // This handles `async () => ...` functions\n const isAsyncFn = originalFn.constructor.name === 'AsyncFunction'\n\n if (isAsyncFn) {\n // Async function → Resource\n const [res, resActions] = createResource(fn, async (val) => val)\n const s = toStateObject(res, resActions)\n\n if (key) {\n globalStateRegistry.set(key, s)\n checkRegistrySize()\n }\n\n const proxy = createStateProxy(s._signal as Signal<T>)\n // Use state() for derived values - dogfooding the unified API\n const [statusValue] = state<AsyncStatus>(() => {\n if (s.error) return 'error'\n if (s.loading) return 'loading'\n if (s.value !== undefined) return 'success'\n return 'idle'\n })\n const [errorValue] = state<unknown>(() => s.error)\n\n return [proxy, resActions.refetch, statusValue, errorValue] as [StateValue<T | undefined>, () => void, StateValue<AsyncStatus>, StateValue<unknown>]\n }\n\n // Sync function → Computed\n // First, try running to check if it returns a Promise (for non-async functions that return Promise)\n let testResult: T | Promise<T>\n try {\n testResult = fn()\n } catch {\n // If it throws during initial call, treat as computed (will throw on access)\n const comp = createComputed(fn as () => T)\n const s = toComputedStateObject(comp)\n if (key) {\n globalStateRegistry.set(key, s)\n checkRegistrySize()\n }\n return [createStateProxy(comp)] as [StateValue<T>]\n }\n\n if (testResult instanceof Promise) {\n // It's a Promise-returning function → Resource\n const [res, resActions] = createResource(fn, async (val) => val)\n const s = toStateObject(res, resActions)\n\n if (key) {\n globalStateRegistry.set(key, s)\n checkRegistrySize()\n }\n\n const proxy = createStateProxy(s._signal as Signal<T>)\n // Use state() for derived values - dogfooding the unified API\n const [statusValue] = state<AsyncStatus>(() => {\n if (s.error) return 'error'\n if (s.loading) return 'loading'\n if (s.value !== undefined) return 'success'\n return 'idle'\n })\n const [errorValue] = state<unknown>(() => s.error)\n\n return [proxy, resActions.refetch, statusValue, errorValue] as [StateValue<T | undefined>, () => void, StateValue<AsyncStatus>, StateValue<unknown>]\n }\n\n // Sync function → Computed (memoized derived value)\n const comp = createComputed(fn as () => T)\n const s = toComputedStateObject(comp)\n if (key) {\n globalStateRegistry.set(key, s)\n checkRegistrySize()\n }\n return [createStateProxy(comp)] as [StateValue<T>]\n }\n\n // 3. Plain value → Signal with setter\n const sig = signal<T>(initialValueOrFetcher)\n const s = toSignalStateObject(sig)\n\n if (key) {\n globalStateRegistry.set(key, s)\n checkRegistrySize()\n }\n\n const proxy = createStateProxy(sig)\n const setter: StateAction<T> = (newValue) => {\n if (typeof newValue === 'function') {\n sig.value = (newValue as (prev: T) => T)(sig.peek())\n } else {\n sig.value = newValue\n }\n }\n\n return [proxy, setter] as [StateValue<T>, StateAction<T>]\n}\n\n/**\n * Delete a specific global state by key\n * @param key - The key of the state to delete\n * @returns true if the state was deleted, false if it didn't exist\n *\n * @example\n * ```ts\n * state.delete('theme')\n * state.delete(['user', 'profile', userId])\n * ```\n */\nstate.delete = function(key: StateKey): boolean {\n const serializedKey = serializeKey(key)\n return globalStateRegistry.delete(serializedKey)\n}\n\n/**\n * Clear all global states (useful for testing or resetting app)\n *\n * @example\n * ```ts\n * state.clear()\n * ```\n */\nstate.clear = function(): void {\n globalStateRegistry.clear()\n hasWarnedAboutSize = false\n}\n\n/**\n * Check if a global state exists\n * @param key - The key to check\n * @returns true if the state exists\n *\n * @example\n * ```ts\n * if (state.has('theme')) { ... }\n * ```\n */\nstate.has = function(key: StateKey): boolean {\n const serializedKey = serializeKey(key)\n return globalStateRegistry.has(serializedKey)\n}\n\n/**\n * Get the current number of global states\n */\nObject.defineProperty(state, 'size', {\n get: () => globalStateRegistry.size,\n enumerable: true,\n})\n\n// Export with proper typing (cast to include static methods)\nconst _state = state as StateFunction\nexport { _state as state }\n"]}
@@ -0,0 +1,2 @@
1
+ function d(e,n,r,o){return {type:e,props:n,children:r,key:o??void 0}}export{d as a};//# sourceMappingURL=chunk-KNF5ERPK.mjs.map
2
+ //# sourceMappingURL=chunk-KNF5ERPK.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/fnode.ts"],"names":["createFNode","type","props","children","key"],"mappings":"AAMO,SAASA,EACdC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACO,CACP,OAAO,CACL,IAAA,CAAAH,CAAAA,CACA,MAAAC,CAAAA,CACA,QAAA,CAAAC,EACA,GAAA,CAAKC,CAAAA,EAAO,MACd,CACF","file":"chunk-KNF5ERPK.mjs","sourcesContent":["import type { FNode, FNodeChild } from './renderer'\n\n/**\n * Creates an FNode ensuring consistent object shape (Monomorphism).\n * This is crucial for JS engine optimization (Hidden Classes).\n */\nexport function createFNode(\n type: string | Function,\n props: Record<string, unknown>,\n children: FNodeChild[],\n key?: string | number | null\n): FNode {\n return {\n type,\n props,\n children,\n key: key ?? undefined,\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import {a}from'./chunk-WVEJT7HD.mjs';import {o}from'./chunk-5S3ZQ2LB.mjs';function m(e){let t={},i=[];return e.x!==void 0&&i.push(`translateX(${e.x}px)`),e.y!==void 0&&i.push(`translateY(${e.y}px)`),e.scale!==void 0?i.push(`scale(${e.scale})`):(e.scaleX!==void 0&&i.push(`scaleX(${e.scaleX})`),e.scaleY!==void 0&&i.push(`scaleY(${e.scaleY})`)),e.rotate!==void 0&&i.push(`rotate(${e.rotate}deg)`),i.length>0&&(t.transform=i.join(" ")),e.opacity!==void 0&&(t.opacity=e.opacity.toString()),e.width!==void 0&&(t.width=typeof e.width=="number"?`${e.width}px`:e.width),e.height!==void 0&&(t.height=typeof e.height=="number"?`${e.height}px`:e.height),t}function L(e){let t=e.tension??170,i=e.friction??26,o=e.mass??1,r=t,n=i,s=o,l=Math.sqrt(r/s),c=n/(2*Math.sqrt(r*s)),u=4.6/(c*l)*1e3;return c<1?{duration:u,easing:"cubic-bezier(0.34, 1.56, 0.64, 1)"}:{duration:u,easing:"cubic-bezier(0.22, 1, 0.36, 1)"}}var d=null,x=null;function A(){if(d===null)if(typeof window<"u"&&window.matchMedia){let e=window.matchMedia("(prefers-reduced-motion: reduce)");d=e.matches;let t=i=>{d=i.matches;};e.addEventListener("change",t),x=()=>{e.removeEventListener("change",t),d=null,x=null;};}else d=false;return d}function O(){x&&x();}var f=class{constructor(t){this.animation=null;this.resizeObserver=null;this.previousSize=null;this.element=t;}animate(t){let{initial:i,animate:o,duration:r=300,spring:n,easing:s="ease-out",delay:l=0}=t;if(!o)return;if(this.cancel(),A()){let a=m(o);Object.assign(this.element.style,{transform:a.transform||"",opacity:a.opacity||"",width:a.width||"",height:a.height||""}),t.onAnimationStart&&t.onAnimationStart(),t.onAnimationComplete&&t.onAnimationComplete();return}if(i){let a=m(i);Object.assign(this.element.style,{transform:a.transform||"",opacity:a.opacity||"",width:a.width||"",height:a.height||""});}let c=i?m(i):{},u=m(o),h=r,g=s;if(n){let a=L(n);h=a.duration,g=a.easing;}this.animation=this.element.animate([c,u],{duration:h,easing:g,delay:l,fill:"forwards"}),t.onAnimationStart&&t.onAnimationStart(),this.animation.onfinish=()=>{t.onAnimationComplete&&t.onAnimationComplete();};}async animateExit(t,i=300,o="ease-in"){if(this.cancel(),A()){let n=m(t);Object.assign(this.element.style,{transform:n.transform||"",opacity:n.opacity||"",width:n.width||"",height:n.height||""});return}let r=m(t);this.animation=this.element.animate([{},r],{duration:i,easing:o,fill:"forwards"}),await this.animation.finished;}enableLayoutAnimation(t=300,i="ease-out"){let o=this.element.getBoundingClientRect();this.previousSize={width:o.width,height:o.height},this.resizeObserver=new ResizeObserver(r=>{for(let n of r){if(!this.previousSize){this.previousSize={width:n.contentRect.width,height:n.contentRect.height};return}let s=n.contentRect.width,l=n.contentRect.height;(s!==this.previousSize.width||l!==this.previousSize.height)&&(this.cancel(),this.animation=this.element.animate([{width:`${this.previousSize.width}px`,height:`${this.previousSize.height}px`},{width:`${s}px`,height:`${l}px`}],{duration:t,easing:i,fill:"forwards"}),this.previousSize={width:s,height:l});}}),this.resizeObserver.observe(this.element);}disableLayoutAnimation(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null,this.previousSize=null);}cancel(){this.animation&&(this.animation.cancel(),this.animation=null);}dispose(){this.cancel(),this.disableLayoutAnimation();}};function R(e){switch(e){case "fade":return {enter:{opacity:0},enterTo:{opacity:1},exit:{opacity:0}};case "slide-up":return {enter:{opacity:0,y:20},enterTo:{opacity:1,y:0},exit:{opacity:0,y:-20}};case "slide-down":return {enter:{opacity:0,y:-20},enterTo:{opacity:1,y:0},exit:{opacity:0,y:20}};case "slide-left":return {enter:{opacity:0,x:20},enterTo:{opacity:1,x:0},exit:{opacity:0,x:-20}};case "slide-right":return {enter:{opacity:0,x:-20},enterTo:{opacity:1,x:0},exit:{opacity:0,x:20}};case "scale":return {enter:{scale:.9},enterTo:{scale:1},exit:{scale:.9}};case "scale-fade":return {enter:{opacity:0,scale:.95},enterTo:{opacity:1,scale:1},exit:{opacity:0,scale:.95}};default:return {enter:{},enterTo:{},exit:{}}}}var y=null;function $(e){let{preset:t,enter:i,enterTo:o$1,exit:r,enterTiming:n={duration:300,easing:"ease-out"},exitTiming:s={duration:200,easing:"ease-in"},onEnterStart:l,onEnterComplete:c,onExitStart:u,onExitComplete:h,children:g}=e,a$1=t?R(t):null,P=i??a$1?.enter??{},C=o$1??a$1?.enterTo??{},S=r??a$1?.exit??{},b=null,p=null,M=y?.registerChild()??0,z=y?.staggerDelay??0,E=M*z;return o(async()=>{b&&p&&(u?.(),await p.animateExit(S,s.duration,s.easing),h?.());}),a("div",{style:{display:"contents"},ref:T=>{T&&(b=T,p=new f(T),queueMicrotask(()=>{p&&(l?.(),p.animate({initial:P,animate:C,duration:n.duration,easing:n.easing,delay:(n.delay??0)+E,onAnimationComplete:c}));}));}},g)}function G(e){let{stagger:t=50,children:i}=e,o=0,r={registerChild:()=>o++,staggerDelay:t};return ()=>{o=0;let n=y;y=r;try{return i}finally{y=n;}}}var D={fade:{preset:"fade"},slideUp:{preset:"slide-up"},slideDown:{preset:"slide-down"},slideLeft:{preset:"slide-left"},slideRight:{preset:"slide-right"},scale:{preset:"scale"},scaleFade:{preset:"scale-fade"},modal:{enter:{opacity:0,scale:.95,y:-10},enterTo:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},enterTiming:{duration:200,easing:"cubic-bezier(0.16, 1, 0.3, 1)"},exitTiming:{duration:150,easing:"ease-in"}},dropdown:{enter:{opacity:0,y:-8,scale:.95},enterTo:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},enterTiming:{duration:150,easing:"ease-out"},exitTiming:{duration:100,easing:"ease-in"}},tooltip:{enter:{opacity:0,scale:.9},enterTo:{opacity:1,scale:1},exit:{opacity:0,scale:.9},enterTiming:{duration:100,easing:"ease-out"},exitTiming:{duration:75,easing:"ease-in"}},notification:{enter:{opacity:0,x:100},enterTo:{opacity:1,x:0},exit:{opacity:0,x:100},enterTiming:{duration:300,easing:"cubic-bezier(0.16, 1, 0.3, 1)"},exitTiming:{duration:200,easing:"ease-in"}},page:{enter:{opacity:0},enterTo:{opacity:1},exit:{opacity:0},enterTiming:{duration:200,easing:"ease-out"},exitTiming:{duration:150,easing:"ease-in"}}};export{O as a,f as b,$ as c,G as d,D as e};//# sourceMappingURL=chunk-MLZTCKTH.mjs.map
2
+ //# sourceMappingURL=chunk-MLZTCKTH.mjs.map