flexium 0.9.1 → 0.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/dist/{DrawText-CJikXQjL.d.cts → DrawText-ccZrs3Xs.d.cts} +1 -1
- package/dist/{DrawText-Bvzl40Vi.d.ts → DrawText-ngwNNh8O.d.ts} +1 -1
- package/dist/advanced.d.cts +1 -1
- package/dist/advanced.d.ts +1 -1
- package/dist/advanced.js +1 -1
- package/dist/advanced.js.map +1 -1
- package/dist/advanced.mjs +1 -1
- package/dist/advanced.mjs.map +1 -1
- package/dist/canvas.d.cts +4 -4
- package/dist/canvas.d.ts +4 -4
- package/dist/canvas.js +1 -1
- package/dist/canvas.mjs +1 -1
- package/dist/chunk-3BQXIHYI.mjs +3 -0
- package/dist/chunk-3BQXIHYI.mjs.map +1 -0
- package/dist/chunk-5236IK5I.js +2 -0
- package/dist/chunk-5236IK5I.js.map +1 -0
- package/dist/{chunk-JHJHIMWD.js → chunk-63AW5ZOC.js} +2 -2
- package/dist/{chunk-JHJHIMWD.js.map → chunk-63AW5ZOC.js.map} +1 -1
- package/dist/chunk-AJT35P3Z.js +3 -0
- package/dist/chunk-AJT35P3Z.js.map +1 -0
- package/dist/chunk-AYQMU7XC.js +3 -0
- package/dist/chunk-AYQMU7XC.js.map +1 -0
- package/dist/chunk-B7VP6HBY.mjs +2 -0
- package/dist/chunk-B7VP6HBY.mjs.map +1 -0
- package/dist/{chunk-R5CS7UZG.mjs → chunk-BYHIHYRR.mjs} +2 -2
- package/dist/{chunk-R5CS7UZG.mjs.map → chunk-BYHIHYRR.mjs.map} +1 -1
- package/dist/chunk-FOPCQGWG.mjs +3 -0
- package/dist/chunk-FOPCQGWG.mjs.map +1 -0
- package/dist/chunk-HLPVL6EK.mjs +2 -0
- package/dist/{chunk-RUXAK74B.mjs.map → chunk-HLPVL6EK.mjs.map} +1 -1
- package/dist/{chunk-HDCPA76O.mjs → chunk-KJPIJNFH.mjs} +2 -2
- package/dist/chunk-KJPIJNFH.mjs.map +1 -0
- package/dist/chunk-PVPY55Z7.mjs +2 -0
- package/dist/{chunk-TRIEKNVZ.mjs.map → chunk-PVPY55Z7.mjs.map} +1 -1
- package/dist/chunk-Q7WT5IIF.mjs +3 -0
- package/dist/chunk-Q7WT5IIF.mjs.map +1 -0
- package/dist/chunk-REM6WIZS.mjs +2 -0
- package/dist/chunk-REM6WIZS.mjs.map +1 -0
- package/dist/chunk-RSI6RYJ7.js +2 -0
- package/dist/chunk-RSI6RYJ7.js.map +1 -0
- package/dist/{chunk-L4C5UBOX.js → chunk-WOHSSPKD.js} +2 -2
- package/dist/chunk-WOHSSPKD.js.map +1 -0
- package/dist/{chunk-DFG62GKW.js → chunk-WXEHDEIH.js} +2 -2
- package/dist/{chunk-DFG62GKW.js.map → chunk-WXEHDEIH.js.map} +1 -1
- package/dist/chunk-XKPRCSXK.js +3 -0
- package/dist/chunk-XKPRCSXK.js.map +1 -0
- package/dist/{chunk-3P6DMEGB.js → chunk-YDZ37ZZ4.js} +2 -2
- package/dist/{chunk-3P6DMEGB.js.map → chunk-YDZ37ZZ4.js.map} +1 -1
- package/dist/{components-D4WeooPi.d.ts → components-B7KQ8C-i.d.ts} +2 -2
- package/dist/{components-DZy2r6m5.d.cts → components-CxnAnbpI.d.cts} +2 -2
- package/dist/core.d.cts +48 -136
- package/dist/core.d.ts +48 -136
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/dom.d.cts +2 -2
- package/dist/dom.d.ts +2 -2
- package/dist/dom.js +1 -1
- package/dist/dom.js.map +1 -1
- package/dist/dom.mjs +1 -1
- package/dist/dom.mjs.map +1 -1
- package/dist/{effect-BlnnM1t5.d.cts → effect-14CxUU8r.d.cts} +8 -4
- package/dist/{effect-BlnnM1t5.d.ts → effect-14CxUU8r.d.ts} +8 -4
- package/dist/effect-3LUCHSAZ.mjs +2 -0
- package/dist/effect-3LUCHSAZ.mjs.map +1 -0
- package/dist/effect-K45UU3N4.js +2 -0
- package/dist/effect-K45UU3N4.js.map +1 -0
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/interactive.d.cts +15 -10
- package/dist/interactive.d.ts +15 -10
- package/dist/interactive.js +1 -1
- package/dist/interactive.js.map +1 -1
- package/dist/interactive.mjs +1 -1
- package/dist/interactive.mjs.map +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/{portal-C3ESJhlv.d.ts → portal-CVqrpmHd.d.ts} +2 -2
- package/dist/{portal-CAEbiMUZ.d.cts → portal-NLlE-fNZ.d.cts} +2 -2
- package/dist/primitives/layout.js +1 -1
- package/dist/primitives/layout.mjs +1 -1
- package/dist/primitives/motion.js +1 -1
- package/dist/primitives/motion.mjs +1 -1
- package/dist/primitives/ui.d.cts +3 -3
- package/dist/primitives/ui.d.ts +3 -3
- package/dist/primitives/ui.js +1 -1
- package/dist/primitives/ui.js.map +1 -1
- package/dist/primitives/ui.mjs +1 -1
- package/dist/primitives/ui.mjs.map +1 -1
- package/dist/primitives.d.cts +4 -4
- package/dist/primitives.d.ts +4 -4
- package/dist/primitives.js +1 -1
- package/dist/primitives.js.map +1 -1
- package/dist/primitives.mjs +1 -1
- package/dist/primitives.mjs.map +1 -1
- package/dist/router.d.cts +3 -3
- package/dist/router.d.ts +3 -3
- package/dist/router.js +1 -1
- package/dist/router.mjs +1 -1
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +1 -1
- package/dist/server.mjs.map +1 -1
- package/dist/signal-2QUI7H7B.js +2 -0
- package/dist/{signal-3YZHUCLL.js.map → signal-2QUI7H7B.js.map} +1 -1
- package/dist/signal-C6936A3J.d.cts +175 -0
- package/dist/signal-C6936A3J.d.ts +175 -0
- package/dist/signal-L3ZWGOVT.mjs +2 -0
- package/dist/{signal-F2HEYB6F.mjs.map → signal-L3ZWGOVT.mjs.map} +1 -1
- package/dist/test-exports.d.cts +6 -6
- package/dist/test-exports.d.ts +6 -6
- package/dist/test-exports.js +1 -1
- package/dist/test-exports.mjs +1 -1
- package/package.json +2 -1
- package/dist/chunk-2ZHUQBNI.mjs +0 -2
- package/dist/chunk-2ZHUQBNI.mjs.map +0 -1
- package/dist/chunk-HDCPA76O.mjs.map +0 -1
- package/dist/chunk-J4CK5NRW.mjs +0 -3
- package/dist/chunk-J4CK5NRW.mjs.map +0 -1
- package/dist/chunk-JEDCNAAI.mjs +0 -3
- package/dist/chunk-JEDCNAAI.mjs.map +0 -1
- package/dist/chunk-L4C5UBOX.js.map +0 -1
- package/dist/chunk-M4ANLZ6P.js +0 -3
- package/dist/chunk-M4ANLZ6P.js.map +0 -1
- package/dist/chunk-RDA77IE6.js +0 -2
- package/dist/chunk-RDA77IE6.js.map +0 -1
- package/dist/chunk-RUXAK74B.mjs +0 -2
- package/dist/chunk-TRIEKNVZ.mjs +0 -2
- package/dist/chunk-VIVO4FHN.js +0 -3
- package/dist/chunk-VIVO4FHN.js.map +0 -1
- package/dist/chunk-XLE6SMWX.mjs +0 -3
- package/dist/chunk-XLE6SMWX.mjs.map +0 -1
- package/dist/chunk-YGMMJWAA.js +0 -3
- package/dist/chunk-YGMMJWAA.js.map +0 -1
- package/dist/signal-3YZHUCLL.js +0 -2
- package/dist/signal-Dxh9PsKr.d.cts +0 -69
- package/dist/signal-Dxh9PsKr.d.ts +0 -69
- package/dist/signal-F2HEYB6F.mjs +0 -2
package/dist/chunk-RUXAK74B.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {e}from'./chunk-J4CK5NRW.mjs';function u(n){let e=Symbol("context"),t=r=>r.children;return t._contextId=e,{id:e,Provider:t,defaultValue:n}}function c(n){let e$1=e();if(e$1&&e$1.context){let t=e$1.context[n.id];if(t!==void 0)return t}return n.defaultValue}function l(n,e$1){let t=e();t&&(t.context||(t.context={}),t.context[n]=e$1);}export{u as a,c as b,l as c};//# sourceMappingURL=chunk-RUXAK74B.mjs.map
|
|
2
|
-
//# sourceMappingURL=chunk-RUXAK74B.mjs.map
|
package/dist/chunk-TRIEKNVZ.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {a}from'./chunk-WVEJT7HD.mjs';import {m as m$1}from'./chunk-J4CK5NRW.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,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??a$1?.enterTo??{},S=r??a$1?.exit??{},b=null,p=null,M=y?.registerChild()??0,z=y?.staggerDelay??0,E=M*z;return m$1(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-TRIEKNVZ.mjs.map
|
|
2
|
-
//# sourceMappingURL=chunk-TRIEKNVZ.mjs.map
|
package/dist/chunk-VIVO4FHN.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkDFG62GKW_js=require('./chunk-DFG62GKW.js'),chunkRDA77IE6_js=require('./chunk-RDA77IE6.js'),chunkQ7IWDVJ4_js=require('./chunk-Q7IWDVJ4.js'),chunkYGMMJWAA_js=require('./chunk-YGMMJWAA.js');var ye=new Set,Ne=new Set(["focus","blur","mouseenter","mouseleave","load","unload","scroll"]),X=new WeakMap;function Ae(e){e.target;let n=e.type.toLowerCase(),o=!Ne.has(n),r=e.composedPath?.()||[],i=e.target;if(r.length===0&&i)for(;i;)r.push(i),i=i.parentNode;for(let d of r){let p=d;if(p===document||!p)break;let l=X.get(p);if(l?.has(n)){let s=l.get(n);if(s){try{s(e);}catch(a){chunkYGMMJWAA_js.b(chunkYGMMJWAA_js.a.EVENT_HANDLER_FAILED,{eventType:n},a);}if(e.cancelBubble)return}}if(!o)break}}function we(e){if(!(typeof document>"u")&&!ye.has(e)){let t=Ne.has(e);document.addEventListener(e,Ae,{capture:t}),ye.add(e);}}var oe={on(e,t,n){let o=t.toLowerCase(),r=X.get(e);r||(r=new Map,X.set(e,r)),r.set(o,n),we(o);},off(e,t){let n=t.toLowerCase(),o=X.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"}},xe={Row:"div",Column:"div",Stack:"div",Text:"span",Button:"button",Input:"input",Container:"div"},q={onPress:"click",onHover:"mouseenter",onChange:"input",onFocus:"focus",onBlur:"blur"},Ce=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"]),Re="http://www.w3.org/2000/svg",_e=new Set(["svg","path","circle","rect","line","polyline","polygon","ellipse","g","text","tspan","defs","use","symbol","marker","linearGradient","radialGradient","stop","clipPath","pattern","mask","filter"]),Fe={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 Me(e){return typeof e=="number"?`${e}px`:e}var be=new Map;function ve(e){let t=be.get(e);return t===void 0&&(t=e.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`),be.set(e,t)),t}function Pe(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function De(e,t){if(e!=null)switch(t){case "px":return Me(e);case "string":return String(e);case "none":default:return e}}function Ie(e,t,n){let o=e.style,r=t.style,i=n.style;if(r!==i){if(r&&typeof r=="object")for(let s in r)(!i||!(s in i))&&o.setProperty(ve(s),"");if(i&&typeof i=="object")for(let s in i){let a=i[s];(!r||r[s]!==a)&&o.setProperty(ve(s),a);}}let d=e.getAttribute("data-flexium-type");(n.flexDirection||n.justifyContent||n.alignItems||n.flexWrap||n.gap!==void 0||n.justify||n.align||d==="Row"||d==="Column"||d==="Stack")&&(o.display!=="flex"&&(o.display="flex"),d==="Row"&&o.flexDirection!=="row"&&(o.flexDirection="row"),d==="Column"&&o.flexDirection!=="column"&&(o.flexDirection="column"));let l=o;for(let s in t)if(s in Z&&!(s in n)){let a=Z[s],m=a.cssProp,f=l[m];f!==void 0&&f!==""&&(l[m]=""),a.sideEffect&&a.sideEffect(o,void 0);}for(let s in n)if(s in Z){let a=t[s],m=n[s];if(a===m)continue;let f=Z[s],c=De(m,f.transform),u=f.cssProp,N=l[u];c===void 0?N!==void 0&&N!==""&&(l[u]=""):N!==c&&(l[u]=c),f.sideEffect&&f.sideEffect(o,c);}}function Se(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 r=typeof o=="string"?o:Se(o);r&&(t=t?`${t} ${r}`:r);}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 re=class{createNode(t,n){let o=xe[t]??t,r;return _e.has(o)?r=document.createElementNS(Re,o):r=document.createElement(o),xe[t]&&r.setAttribute("data-flexium-type",t),this.updateNode(r,{},n),r}updateNode(t,n,o){if(o.className!==n.className){let i=Se(o.className);t instanceof SVGElement?t.setAttribute("class",i):t.className=i;}Ie(t,n,o);for(let i in n)if(!(i in o)){if(typeof i=="symbol")continue;if(i.startsWith("on")){let d=q[i]||i.slice(2).toLowerCase();this.removeEventListener(t,d,n[i]);}else Ce.has(i)||t.removeAttribute(i);}let r=Reflect.ownKeys(o);for(let i of r){if(typeof i=="symbol")continue;let d=i,p=o[d],l=n[d];if(p!==l){if(d.startsWith("on")){let s=q[d]||d.slice(2).toLowerCase();l&&this.removeEventListener(t,s,l),p&&this.addEventListener(t,s,p);}else if(!Ce.has(d))if(p==null||p===false)t.removeAttribute(d);else if(p===true)t.setAttribute(d,"");else {let s=Fe[d]||d;t.setAttribute(s,Pe(String(p)));}}}}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 r=q[n]||n;oe.on(t,r,o);}removeEventListener(t,n,o){let r=q[n]||n;oe.off(t,r);}},C=new re;var ie=Symbol("flexium.list");function se(e){return e!==null&&typeof e=="object"&&ie in e&&e[ie]===true}function He(e,t){return typeof e=="number"?e:e.mode==="fixed"?e.itemHeight:e.estimatedItemHeight}function Oe(e,t,n,o,r){let i=o*n;if(o===0)return {startIndex:0,endIndex:-1,totalHeight:0};let d=Math.floor(e/n),p=Math.ceil(t/n),l=d+p;return {startIndex:Math.max(0,d-r),endIndex:Math.min(o-1,l+r),totalHeight:i}}function de(e,t,n,o){return e.virtual?Ve(e,t,n,o):Be(e,t,n,o)}function Be(e,t,n,o){let{each:r,renderItem:i,getKey:d,class:p,style:l}=e,s=document.createElement("div");s.setAttribute("role","list"),p&&(s.className=p),l&&Object.entries(l).forEach(([c,u])=>{s.style[c]=typeof u=="number"?`${u}px`:u;}),t.appendChild(s);let a=new Map,m=(c,u)=>d?d(c,u):u,f=chunkYGMMJWAA_js.h(()=>{let c=r()||[],u=new Set;c.forEach((N,h)=>{let x=m(N,h);if(u.add(x),!a.has(x)){let L=chunkYGMMJWAA_js.j(h),y=i(N,()=>L()),g=n(y);g&&g instanceof HTMLElement&&(g.setAttribute("role","listitem"),s.appendChild(g),a.set(x,{node:g,dispose:()=>{try{o(g);}catch{}}}));}});for(let[N,h]of a)u.has(N)||(h.dispose(),h.node.parentNode===s&&s.removeChild(h.node),a.delete(N));});return ()=>{f();for(let c of a.values())c.dispose();a.clear(),s.parentNode===t&&t.removeChild(s);}}function Ve(e,t,n,o){let{each:r,renderItem:i,height:d,width:p,itemSize:l,overscan:s,getKey:a,onScroll:m,onVisibleRangeChange:f}=e;if(!d||!l)return console.warn("List: height and itemSize are required when virtual is true"),()=>{};let c=document.createElement("div");c.style.height=typeof d=="number"?`${d}px`:d,c.style.width=p?typeof p=="number"?`${p}px`:p:"100%",c.style.overflow="auto",c.style.position="relative",c.setAttribute("role","list"),c.setAttribute("tabindex","0");let u=document.createElement("div");u.style.position="relative",u.style.width="100%",u.style.willChange="transform",c.appendChild(u),t.appendChild(c);let N=chunkYGMMJWAA_js.j(0),h=new Map,x=-1,L=-1,y=()=>{N.set(c.scrollTop),m?.(c.scrollTop);};c.addEventListener("scroll",y,{passive:true});let g=(w,F)=>a?a(w,F):F,E=chunkYGMMJWAA_js.h(()=>{let w=r()||[],F=N(),G=c.clientHeight||parseFloat(String(d)),M=He(l),{startIndex:W,endIndex:j,totalHeight:Le}=Oe(F,G,M,w.length,s);u.style.height=`${Le}px`,c.setAttribute("aria-rowcount",String(w.length)),(W!==x||j!==L)&&(f?.(W,j),x=W,L=j);let ae=new Set;for(let v=W;v<=j&&v<w.length;v++){let D=w[v],K=g(D,v);ae.add(K);let I=h.get(K);if(I){I.indexSig.peek()!==v&&I.indexSig.set(v);let O=I.node;O.style.transform=`translateY(${v*M}px)`,O.setAttribute("aria-rowindex",String(v+1));}else {let O=chunkYGMMJWAA_js.j(v),ke=i(D,()=>O()),T=n(ke);T&&T instanceof HTMLElement&&(T.style.position="absolute",T.style.top="0",T.style.left="0",T.style.right="0",T.style.transform=`translateY(${v*M}px)`,T.style.height=`${M}px`,T.style.boxSizing="border-box",T.setAttribute("role","listitem"),T.setAttribute("aria-rowindex",String(v+1)),u.appendChild(T),I={item:D,key:K,node:T,indexSig:O,dispose:()=>{try{o(T);}catch{}}},h.set(K,I));}}for(let[v,D]of h)ae.has(v)||(D.dispose(),D.node.parentNode===u&&u.removeChild(D.node),h.delete(v));});return ()=>{E(),c.removeEventListener("scroll",y);for(let w of h.values())w.dispose();h.clear(),c.parentNode===t&&t.removeChild(c);}}var Ee=new WeakMap;function A(e){return Ee.get(e)}function P(e,t){Ee.set(e,t);}var V;(d=>{let e=[],t=[];function o(){if(e.length>0){let p=e.pop();return p.clear(),p}return new Map}d.getMap=o;function r(){if(t.length>0){let p=t.pop();return p.clear(),p}return new Set}d.getSet=r;function i(p,l){e.length<10&&e.push(p),t.length<10&&t.push(l);}d.release=i;})(V||(V={}));function Y(e,t,n,o){let r=t&&t.length>0,i=n&&n.length>0;if(!r&&!i)return;if(!i){for(let f of t){let c=f&&A(f);c&&(S(c),C.removeChild(e,c));}return}if(!r){let f=document.createDocumentFragment();for(let c of n){let u=b(c,void 0);u&&(P(c,u),f.appendChild(u));}o?e.insertBefore(f,o):e.appendChild(f);return}let d=t.length,p=n.length,l=5;if(d<=l&&p<=l){let f=0,c=0,u=e.firstChild;for(;f<d||c<p;){if(c>=p){for(;f<d;){let y=t[f++],g=y&&A(y);g&&(S(g),C.removeChild(e,g));}break}if(f>=d){let y=document.createDocumentFragment();for(;c<p;){let g=n[c++],E=b(g,void 0);E&&(P(g,E),y.appendChild(E));}o?e.insertBefore(y,o):e.appendChild(y);break}let N=t[f],h=n[c],x=N.key??`__idx_${f}_${N.type}`,L=h.key??`__idx_${c}_${h.type}`;if(x===L&&N.type===h.type)ce(N,h),u=u?.nextSibling||null,f++,c++;else {let y=false;for(let g=f+1;g<d;g++){let E=t[g];if((E.key??`__idx_${g}_${E.type}`)===L&&E.type===h.type){for(let F=f;F<g;F++){let G=t[F],M=G&&A(G);M&&(S(M),C.removeChild(e,M));}ce(E,h),f=g+1,c++,y=true;break}}if(!y){let g=b(h,void 0);g&&(P(h,g),e.insertBefore(g,u)),c++;}}}return}let s=V.getMap(),a=V.getSet();for(let f=0;f<d;f++){let c=t[f],u=c.key??`__idx_${f}_${c.type}`;s.set(u,c);}let m=e.firstChild;for(let f=0;f<n.length;f++){let c=n[f],u=c.key??`__idx_${f}_${c.type}`;a.add(u);let N=s.get(u),h=m;if(!N||N.type!==c.type){let x=b(c,void 0);x&&(P(c,x),e.insertBefore(x,h));}else {ce(N,c);let x=A(c);x&&(m!==x?e.insertBefore(x,h):m=m?.nextSibling||null);}}for(let[f,c]of s){let u=A(c);!a.has(f)&&u&&(S(u),u.parentNode===e&&C.removeChild(e,u));}V.release(s,a);}function ce(e,t){let n=A(e);if(!n||(P(t,n),typeof t.type!="string"))return;C.updateNode(n,e.props,t.props);let o=e.children||[],r=t.children||[];if(!(o.length===0&&r.length===0)){if(r.length===1&&(typeof r[0]=="string"||typeof r[0]=="number")&&n.firstChild?.nodeType===Node.TEXT_NODE&&n.childNodes.length===1){let i=String(r[0]);String(o[0])!==i&&C.updateTextNode(n.firstChild,i);return}Y(n,o,r,null);}}var $=new WeakMap,J=new Set,le=false;function ee(e){J.add(e),le||(le=true,requestAnimationFrame(()=>{$e();}));}function $e(){if(le=false,J.size===0)return;let e=Array.from(J);J.clear();for(let t=0;t<e.length;t++)e[t]();}function H(e,t){let n=$.get(e);n||(n=new Set,$.set(e,n)),n.add(t);}function b(e,t){if(e==null||typeof e=="boolean")return null;if(se(e)){let n=t||document.createDocumentFragment(),o=de(e,n,i=>b(i),S),r=document.createTextNode("");return H(r,o),t?n.firstChild:n}if(chunkRDA77IE6_js.d(e)){let n=chunkRDA77IE6_js.e(e);if(n){let o=document.createTextNode(""),r=t||document.createDocumentFragment();C.appendChild(r,o);let i=o,d=chunkYGMMJWAA_js.h(()=>{let p=n.value,l=o.parentNode;if(l)if((typeof p=="string"||typeof p=="number")&&i&&i.nodeType===Node.TEXT_NODE&&i!==o){let s=i,a=String(p);ee(()=>{C.updateTextNode(s,a);});}else {let s=b(p);if(s)if(i&&i!==o)if(i.parentNode===l)if(i.nodeType===Node.TEXT_NODE&&s.nodeType===Node.TEXT_NODE){let a=i,m=s.textContent||"";ee(()=>{C.updateTextNode(a,m);});}else l.replaceChild(s,i),i=s;else l.insertBefore(s,o.nextSibling),i=s;else l.insertBefore(s,o.nextSibling),i=s;else {if(i&&i!==o&&i.parentNode===l)try{l.removeChild(i);}catch(a){chunkYGMMJWAA_js.b(chunkYGMMJWAA_js.a.DOM_CLEANUP_FAILED,{operation:"removeChild"},a);}i=o;}}});return H(o,d),t?o:r}}if(chunkYGMMJWAA_js.l(e)||typeof e=="function"){let n=document.createTextNode(""),o=t||document.createDocumentFragment();C.appendChild(o,n);let r=[],i=null,d=[],p=chunkYGMMJWAA_js.h(()=>{let l=chunkYGMMJWAA_js.l(e)?e.value:e(),s=n.parentNode;if(s){if(Array.isArray(l)){let a=l.filter(m=>m!=null);if(d.length>0){let m=n.nextSibling;Y(s,d,a,m);}else {for(let f of r)if(S(f),f.parentNode===s)try{s.removeChild(f);}catch(c){chunkYGMMJWAA_js.b(chunkYGMMJWAA_js.a.DOM_CLEANUP_FAILED,{operation:"removeChild"},c);}r=[];let m=document.createDocumentFragment();for(let f of a){let c=b(f,m);c&&typeof f=="object"&&P(f,c);}r=Array.from(m.childNodes),s.insertBefore(m,n.nextSibling);}d=a,i=l;return}if(d.length>0){for(let a of d){let m=A(a);if(m&&m.parentNode===s){S(m);try{s.removeChild(m);}catch(f){chunkYGMMJWAA_js.b(chunkYGMMJWAA_js.a.DOM_CLEANUP_FAILED,{operation:"removeChild"},f);}}}d=[];}if(l!==i){for(let a of r)if(S(a),a.parentNode===s)try{s.removeChild(a);}catch(m){chunkYGMMJWAA_js.b(chunkYGMMJWAA_js.a.DOM_CLEANUP_FAILED,{operation:"removeChild"},m);}if(r=[],typeof l=="string"||typeof l=="number"){let a=C.createTextNode(String(l));s.insertBefore(a,n.nextSibling),r=[a];}else {let a=b(l);a&&(a.nodeType===Node.DOCUMENT_FRAGMENT_NODE?(r=Array.from(a.childNodes),s.insertBefore(a,n.nextSibling)):(s.insertBefore(a,n.nextSibling),r=[a]));}i=l;}}});return H(n,p),t?n:o}if(Array.isArray(e)){let n=document.createDocumentFragment();for(let o of e)b(o,n);return t&&C.appendChild(t,n),n}if(typeof e=="string"||typeof e=="number"){let n=C.createTextNode(String(e));return t&&C.appendChild(t,n),n}if(chunkQ7IWDVJ4_js.c(e)){if(typeof e.type=="function"){let i=e.type,d=document.createTextNode(""),p=t||document.createDocumentFragment();C.appendChild(p,d);let l=[],s=[],a=chunkRDA77IE6_js.b(),m=chunkYGMMJWAA_js.h(()=>{chunkRDA77IE6_js.c(a),chunkYGMMJWAA_js.f(f=>{chunkYGMMJWAA_js.m(f);let c=i._contextId;c&&chunkDFG62GKW_js.c(c,e.props.value);let u;try{chunkRDA77IE6_js.a(a);let y=e.children!==void 0?{...e.props,children:e.children}:e.props;u=i(y);}finally{chunkRDA77IE6_js.a(null);}if(Array.isArray(u)&&u.every(y=>chunkQ7IWDVJ4_js.c(y)&&y.type!=="fragment")){let y=d.parentNode;if(y){let g=u;Y(y,s,g,d.nextSibling),s=g,l=g.map(E=>A(E)).filter(E=>E!=null);return}}let x=d.parentNode;if(x){for(let y of l)if(S(y),y.parentNode===x)try{x.removeChild(y);}catch(g){chunkYGMMJWAA_js.b(chunkYGMMJWAA_js.a.DOM_CLEANUP_FAILED,{operation:"removeChild"},g);}}l=[],s=[];let L=document.createDocumentFragment();b(u,L),x&&(l=Array.from(L.childNodes),x.insertBefore(L,d.nextSibling));});});return H(d,m),t?d:p}if(e.type==="fragment"){let i=document.createDocumentFragment();for(let d of e.children)b(d,i);return t&&C.appendChild(t,i),i}let n=C.createNode(e.type,e.props),o=Ge(n,e.props);o.length>0&&$.set(n,new Set(o));for(let i of e.children)b(i,n);t&&C.appendChild(t,n);let r=e.props.ref;return r&&(typeof r=="function"?(r(n),H(n,()=>{r(null);})):typeof r=="object"&&"current"in r&&(r.current=n,H(n,()=>{r.current=null;}))),n}return null}var Q=Symbol("uninitialized");function Ge(e,t){let n=[],o=[];for(let r in t){if(r.startsWith("on"))continue;let i=t[r];(chunkYGMMJWAA_js.l(i)||typeof i=="function")&&o.push([r,i]);}for(let[r,i]of o)if(chunkYGMMJWAA_js.l(i)){let d=Q,p=chunkYGMMJWAA_js.h(()=>{let l=i.value;if(l!==d){let s=d===Q?void 0:d;ee(()=>{C.updateNode(e,{[r]:s},{[r]:l});}),d=l;}});n.push(p);}else {let d=Q,p=chunkYGMMJWAA_js.h(()=>{try{let l=i();if(l!==d){let s=d===Q?void 0:d;ee(()=>{C.updateNode(e,{[r]:s},{[r]:l});}),d=l;}}catch(l){chunkYGMMJWAA_js.b(chunkYGMMJWAA_js.a.DOM_CLEANUP_FAILED,{operation:"updateNode",prop:r},l);}});n.push(p);}return n}function S(e){let t=$.get(e);if(t&&(t.forEach(n=>n()),$.delete(e)),e.childNodes&&e.childNodes.length>0){let n=Array.from(e.childNodes);for(let o of n)S(o);}}function Te(e){let t=null,n=null,o=null;return {render(r){let i=o===r;!i&&n&&(S(n),e.childNodes.length===1?e.removeChild(n):e.innerHTML="",n=null),t&&(t(),t=null),t=chunkYGMMJWAA_js.h(()=>{!i&&e.firstChild&&(e.childNodes.length===1?e.removeChild(e.firstChild):e.innerHTML=""),n=b(r,e),o=r;});},unmount(){t&&(t(),t=null),S(e),e.childNodes.length===1?e.removeChild(e.firstChild):e.innerHTML="",n=null,o=null;}}}function gt(e,t){return t.innerHTML="",b(e,t)}function ht(e){return Te(e)}function Ct(e){if(typeof document>"u")return null;let t=e.mount||document.body,n=document.createComment("portal"),o=null;return o=b(e.children,t),chunkYGMMJWAA_js.m(()=>{o&&(S(o),o.parentNode===t&&t.removeChild(o));}),n}
|
|
2
|
-
exports.a=re;exports.b=C;exports.c=ie;exports.d=se;exports.e=b;exports.f=Te;exports.g=gt;exports.h=ht;exports.i=Ct;//# sourceMappingURL=chunk-VIVO4FHN.js.map
|
|
3
|
-
//# sourceMappingURL=chunk-VIVO4FHN.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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","styleRecord","propName","config","cssProp","currentValue","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","ReconciliationPool","mapPool","setPool","getMap","map","getSet","set","release","reconcileArrays","oldFNodes","newFNodes","nextSibling","hasOld","hasNew","cleanupReactive","fragment","newFNode","mountReactive","oldLen","newLen","SMALL_LIST_THRESHOLD","oldIdx","newIdx","currentChild","oldFNode","oldKey","newKey","patchNode","found","searchIdx","searchFNode","removeIdx","removeFNode","keyToOldFNode","seen","refNode","oldChildren","newChildren","newText","REACTIVE_BINDINGS","domUpdateQueue","isDOMUpdateScheduled","scheduleDOMUpdate","task","flushDOMUpdates","queue","registerReactiveBinding","dispose","bindings","listDispose","childNode","marker","isStateValue","sig","getStateSignal","startNode","currentNode","currentContainer","textNode","textValue","newNode","textContent","e","isSignal","currentNodes","currentFNode","currentFNodeList","c","childFNode","isFNode","component","componentInstance","createComponentInstance","resetHookIndex","root","disposeRoot","onCleanup","contextId","pushProvider","setCurrentComponent","componentProps","fn","n","currentParent","domNode","disposeProps","setupReactiveProps","ref","UNINITIALIZED","disposers","reactiveProps","prevValue","oldPropValue","children","createReactiveRoot","rootDispose","currentRootNode","isSameNode","render","createRoot","Portal","placeholder","portalContent"],"mappings":"iNAIA,IAAMA,EA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CAExB8H,CAAAA,CAAkB,IAAA,CAClB/B,CAAAA,CAAe,KACjB,CACF,CACF,CCxoBO,SAASiC,GACd3N,CAAAA,CACA2F,CAAAA,CACa,CAEb,OAAAA,CAAAA,CAAU,SAAA,CAAY,EAAA,CACf+C,CAAAA,CAAc1I,CAAAA,CAAM2F,CAAS,CACtC,CA4LO,SAASiI,EAAAA,CAAWjI,CAAAA,CAAwB,CAEjD,OAAO4H,EAAAA,CAAmB5H,CAAS,CACrC,CClOO,SAASkI,EAAAA,CAAOxK,CAAAA,CAAoB,CAEzC,GAAI,OAAO,QAAA,CAAa,GAAA,CACtB,OAAO,IAAA,CAGT,IAAMsC,EAAYtC,CAAAA,CAAM,KAAA,EAAS,QAAA,CAAS,IAAA,CAGpCyK,CAAAA,CAAc,QAAA,CAAS,aAAA,CAAc,QAAQ,CAAA,CAG/CC,CAAAA,CAA6B,IAAA,CAIjC,OAAAA,CAAAA,CAAgBrF,CAAAA,CAAcrF,CAAAA,CAAM,QAAA,CAAUsC,CAAS,CAAA,CAGvD0G,kBAAAA,CAAU,IAAM,CACV0B,CAAAA,GACFxF,CAAAA,CAAgBwF,CAAa,CAAA,CACzBA,CAAAA,CAAc,UAAA,GAAepI,CAAAA,EAC/BA,CAAAA,CAAU,WAAA,CAAYoI,CAAa,CAAA,EAGzC,CAAC,EAEMD,CACT","file":"chunk-VIVO4FHN.js","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, '&')\n .replace(/\"/g, '"')\n .replace(/'/g, ''')\n .replace(/</g, '<')\n .replace(/>/g, '>')\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 // Performance: Cache style access and avoid unnecessary checks\n const styleRecord = style as unknown as Record<string, string>\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 string\n\n // Performance: Only clear if actually set (avoid unnecessary DOM writes)\n const currentValue = styleRecord[cssProp]\n if (currentValue !== undefined && currentValue !== '') {\n styleRecord[cssProp] = ''\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 // Performance: Skip if value hasn't changed\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 string\n\n // Performance: Cache current value and only update if different\n const currentValue = styleRecord[cssProp]\n\n // Update the style property\n if (transformedValue === undefined) {\n // Only clear if actually set\n if (currentValue !== undefined && currentValue !== '') {\n styleRecord[cssProp] = ''\n }\n } else {\n // Only update if value actually changed\n if (currentValue !== transformedValue) {\n styleRecord[cssProp] = 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 * Object pool for Map/Set used in reconciliation to reduce GC pressure\n * Performance: Reuse Map and Set instances instead of creating new ones\n */\nnamespace ReconciliationPool {\n const mapPool: Map<string | number | undefined, FNode>[] = []\n const setPool: Set<string | number | undefined>[] = []\n const MAX_POOL_SIZE = 10\n\n export function getMap(): Map<string | number | undefined, FNode> {\n if (mapPool.length > 0) {\n const map = mapPool.pop()!\n map.clear()\n return map\n }\n return new Map()\n }\n\n export function getSet(): Set<string | number | undefined> {\n if (setPool.length > 0) {\n const set = setPool.pop()!\n set.clear()\n return set\n }\n return new Set()\n }\n\n export function release(\n map: Map<string | number | undefined, FNode>,\n set: Set<string | number | undefined>\n ): void {\n if (mapPool.length < MAX_POOL_SIZE) {\n mapPool.push(map)\n }\n if (setPool.length < MAX_POOL_SIZE) {\n setPool.push(set)\n }\n }\n}\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 // Performance: Fast path for small lists (5 or fewer items) - avoid Map/Set overhead\n const oldLen = oldFNodes.length\n const newLen = newFNodes.length\n const SMALL_LIST_THRESHOLD = 5\n\n if (oldLen <= SMALL_LIST_THRESHOLD && newLen <= SMALL_LIST_THRESHOLD) {\n // Simple linear reconciliation for small lists\n let oldIdx = 0\n let newIdx = 0\n let currentChild = parent.firstChild\n\n while (oldIdx < oldLen || newIdx < newLen) {\n if (newIdx >= newLen) {\n // Remove remaining old nodes\n while (oldIdx < oldLen) {\n const oldFNode = oldFNodes[oldIdx++]\n const node = oldFNode && getNode(oldFNode)\n if (node) {\n cleanupReactive(node)\n domRenderer.removeChild(parent, node)\n }\n }\n break\n }\n\n if (oldIdx >= oldLen) {\n // Add remaining new nodes\n const fragment = document.createDocumentFragment()\n while (newIdx < newLen) {\n const newFNode = newFNodes[newIdx++]\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 break\n }\n\n const oldFNode = oldFNodes[oldIdx]\n const newFNode = newFNodes[newIdx]\n const oldKey = oldFNode.key ?? `__idx_${oldIdx}_${oldFNode.type}`\n const newKey = newFNode.key ?? `__idx_${newIdx}_${newFNode.type}`\n\n if (oldKey === newKey && oldFNode.type === newFNode.type) {\n // Same node: patch and advance both\n patchNode(oldFNode, newFNode)\n currentChild = currentChild?.nextSibling || null\n oldIdx++\n newIdx++\n } else {\n // Different: check if we can find matching old node\n let found = false\n for (let searchIdx = oldIdx + 1; searchIdx < oldLen; searchIdx++) {\n const searchFNode = oldFNodes[searchIdx]\n const searchKey = searchFNode.key ?? `__idx_${searchIdx}_${searchFNode.type}`\n if (searchKey === newKey && searchFNode.type === newFNode.type) {\n // Found match: remove nodes between oldIdx and searchIdx, then patch\n for (let removeIdx = oldIdx; removeIdx < searchIdx; removeIdx++) {\n const removeFNode = oldFNodes[removeIdx]\n const node = removeFNode && getNode(removeFNode)\n if (node) {\n cleanupReactive(node)\n domRenderer.removeChild(parent, node)\n }\n }\n patchNode(searchFNode, newFNode)\n oldIdx = searchIdx + 1\n newIdx++\n found = true\n break\n }\n }\n if (!found) {\n // No match: insert new node\n const node = mountReactive(newFNode, undefined)\n if (node) {\n setNode(newFNode, node)\n parent.insertBefore(node, currentChild)\n }\n newIdx++\n }\n }\n }\n return\n }\n\n // Performance: Reuse Map/Set from pool to reduce GC pressure\n const keyToOldFNode = ReconciliationPool.getMap()\n const seen = ReconciliationPool.getSet()\n\n // Build key-to-node mapping\n for (let i = 0; i < oldLen; 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 // 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 // Performance: Return Map/Set to pool for reuse\n ReconciliationPool.release(keyToOldFNode, seen)\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 * DOM Update Batching System\n * Batches DOM updates using requestAnimationFrame to improve performance\n * when multiple signals update simultaneously.\n */\ntype DOMUpdateTask = () => void\n\nconst domUpdateQueue = new Set<DOMUpdateTask>()\nlet isDOMUpdateScheduled = false\n\n/**\n * Schedule a DOM update to be batched\n */\nfunction scheduleDOMUpdate(task: DOMUpdateTask): void {\n domUpdateQueue.add(task)\n if (!isDOMUpdateScheduled) {\n isDOMUpdateScheduled = true\n // Use requestAnimationFrame to batch DOM updates with browser rendering cycle\n requestAnimationFrame(() => {\n flushDOMUpdates()\n })\n }\n}\n\n/**\n * Flush all pending DOM updates\n */\nfunction flushDOMUpdates(): void {\n isDOMUpdateScheduled = false\n if (domUpdateQueue.size === 0) return\n\n // Performance: Convert Set to array for faster iteration\n const queue = Array.from(domUpdateQueue)\n domUpdateQueue.clear()\n\n // Execute all DOM updates\n for (let i = 0; i < queue.length; i++) {\n queue[i]()\n }\n}\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 // Performance: Batch simple text node updates\n const textNode = currentNode as Text\n const textValue = String(value)\n scheduleDOMUpdate(() => {\n domRenderer.updateTextNode(textNode, textValue)\n })\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 // Performance: Batch text node updates\n const textNode = currentNode as Text\n const textContent = newNode.textContent || ''\n scheduleDOMUpdate(() => {\n domRenderer.updateTextNode(textNode, 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 // Performance: Avoid object spread when children is undefined (reuse props object)\n const componentProps = node.children !== undefined\n ? { ...node.props, children: node.children }\n : node.props\n result = component(componentProps)\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 // Handle ref (callback or object with .current)\n const ref = node.props.ref\n if (ref) {\n if (typeof ref === 'function') {\n // Callback ref\n ref(domNode)\n registerReactiveBinding(domNode, () => {\n ref(null)\n })\n } else if (typeof ref === 'object' && 'current' in ref) {\n // Object ref (like useRef)\n ref.current = domNode\n registerReactiveBinding(domNode, () => {\n ref.current = null\n })\n }\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\n // Performance: Filter reactive props in a single pass\n // Only process props that are signals or functions (reactive props)\n // Skip event handlers (they are handled separately in updateNode)\n const reactiveProps: Array<[string, unknown]> = []\n for (const key in props) {\n // Skip event handlers (they are handled separately in updateNode)\n if (key.startsWith('on')) continue\n \n const value = props[key]\n // Only collect reactive props (signals or functions)\n if (isSignal(value) || typeof value === 'function') {\n reactiveProps.push([key, value])\n }\n }\n\n // Process only reactive props (reduces iterations)\n for (const [key, value] of reactiveProps) {\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 // Performance: Batch DOM node updates\n const oldPropValue = prevValue === UNINITIALIZED ? undefined : prevValue\n scheduleDOMUpdate(() => {\n domRenderer.updateNode(\n node,\n { [key]: oldPropValue },\n { [key]: newValue }\n )\n })\n prevValue = newValue\n }\n })\n disposers.push(dispose)\n } else {\n // value is a function (already checked in filter above)\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 // TypeScript: value is guaranteed to be a function here (checked in filter above)\n const newValue = (value as () => unknown)()\n // Only update DOM if value actually changed (always update on first run)\n if (newValue !== prevValue) {\n // Performance: Batch DOM node updates\n const oldPropValue = prevValue === UNINITIALIZED ? undefined : prevValue\n scheduleDOMUpdate(() => {\n domRenderer.updateNode(\n node,\n { [key]: oldPropValue },\n { [key]: newValue }\n )\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 let currentFNode: FNode | null = null\n\n return {\n render(node: FNode) {\n // Performance: If rendering the same node, skip cleanup (optimization for re-renders)\n const isSameNode = currentFNode === node\n\n if (!isSameNode && currentRootNode) {\n cleanupReactive(currentRootNode)\n // Performance: Use removeChild instead of innerHTML when possible (faster)\n // Only use innerHTML if container has many children\n if (container.childNodes.length === 1) {\n container.removeChild(currentRootNode)\n } else {\n container.innerHTML = ''\n }\n currentRootNode = null\n }\n\n if (rootDispose) {\n rootDispose()\n rootDispose = null\n }\n\n rootDispose = effect(() => {\n // Performance: Only clear if we have existing content and it's different\n if (!isSameNode && container.firstChild) {\n // Performance: Use removeChild for single child, innerHTML for multiple\n if (container.childNodes.length === 1) {\n container.removeChild(container.firstChild!)\n } else {\n container.innerHTML = ''\n }\n }\n currentRootNode = mountReactive(node, container)\n currentFNode = node\n })\n },\n unmount() {\n if (rootDispose) {\n rootDispose()\n rootDispose = null\n }\n cleanupReactive(container)\n // Performance: Use removeChild when possible\n if (container.childNodes.length === 1) {\n container.removeChild(container.firstChild!)\n } else {\n container.innerHTML = ''\n }\n currentRootNode = null\n currentFNode = null\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 // Performance: Batch text node updates\n scheduleDOMUpdate(() => {\n domRenderer.updateTextNode(textNode, text)\n })\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"]}
|
package/dist/chunk-XLE6SMWX.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import {a,b}from'./chunk-RUXAK74B.mjs';import {c,a as a$1}from'./chunk-WVEJT7HD.mjs';import {j as j$1,k as k$1}from'./chunk-J4CK5NRW.mjs';function F(){let t=()=>({pathname:"/",search:"",hash:"",query:{}}),e=()=>typeof window>"u"?t():{pathname:window.location.pathname,search:window.location.search,hash:window.location.hash,query:$(window.location.search)},r=j$1(e()),n=c=>{if(!(typeof window>"u")){if(N(c)){console.error("[Flexium Router] Blocked navigation to unsafe path:",c);return}window.history.pushState({},"",c),r.value=e();}},a=()=>{try{r.value=e();}catch(c){console.error("[Flexium Router] Error handling popstate:",c);}};return typeof window<"u"&&window.addEventListener("popstate",a),[r,n,()=>{typeof window<"u"&&window.removeEventListener("popstate",a);}]}function N(t){let e=t.trim().toLowerCase();return ["javascript:","data:","vbscript:","file:"].some(n=>e.startsWith(n))}function j(t){return t.replace(/<[^>]*>/g,"").replace(/javascript:/gi,"").replace(/on\w+\s*=/gi,"")}var O=new Set(["__proto__","constructor","prototype"]);function $(t){let e=new URLSearchParams(t),r=Object.create(null);return e.forEach((n,a)=>{let i=j(a),c=j(n);i&&!O.has(i)&&(r[i]=c);}),r}function B(t,e){let r=[],n=e.replace(/:([^/]+)/g,(l,h)=>(r.push(h),"([^/]+)")),a=new RegExp(`^${n}$`),i=t.match(a);if(!i)return {matches:false,params:{}};let c={};return i.slice(1).forEach((l,h)=>{c[r[h]]=l;}),{matches:true,params:c}}function k(t){let e=[],r=Array.isArray(t)?t:[t];for(let n of r){if(!c(n))continue;let{path:a,index:i,component:c$1,beforeEnter:l}=n.props,h=n.children;if(!c$1&&!h){console.warn(`[Flexium Router] Route "${a||"(index)"}" has no component and no children. Skipping.`);continue}let R={path:a||"",index:!!i,component:c$1||(()=>null),children:h?k(h):[],beforeEnter:l};e.push(R);}return e}function D(t,e){for(let r of t){let n=S(r,e,"");if(n)return n}return null}function S(t,e,r){let n=r;t.path&&(n=r.replace(/\/$/,"")+"/"+t.path.replace(/^\//,""));let a=t.children.length===0,i=A(n,!a),c=e.match(i);if(c){let[l,...h]=c,R=M(n,h),o={route:t,params:R,pathname:l};if(a)return l===e?[o]:null;for(let f of t.children){let u=S(f,e,n);if(u)return [o,...u]}if(l===e){let f=t.children.find(u=>u.index);return f?[o,{route:f,params:{},pathname:l}]:[o]}}return null}function A(t,e){let r=t.replace(/:([^/]+)/g,()=>"([^/]+)");return r==="/"&&e?new RegExp("^"):new RegExp(`^${r}${e?"(?:/|$)":"$"}`)}function M(t,e){let r={},n=0;return t.replace(/:([^/]+)/g,(a,i)=>(r[i]=e[n++],"")),r}var v=a(null),y=a(0);function V(){let t=b(v);if(!t)throw new Error("router() must be called within a <Router> component");return t}function et(t){let[e,r]=F(),n=Array.isArray(t.children)?t.children:[t.children],a=[],i=[];for(let o of n)c(o)&&typeof o.type=="function"&&o.type===z?i.push(o):a.push(o);let c$1=k(i),l=k$1(()=>{let o=e();return D(c$1,o.pathname)||[]}),h=k$1(()=>{let o=l();return o.length>0?o[o.length-1].params:{}}),R=new Proxy({location:e,params:h,navigate:r,matches:l},{get(o,f){let u=o[f];if(f==="location"||f==="params"||f==="matches"){let p=u,_=()=>p.value;return new Proxy(_,{apply(){return p.value},get(b,s){if(s==="value")return p.value;if(s==="peek")return p.peek;if(s===Symbol.toPrimitive||s==="toString"||s==="valueOf")return ()=>p.value;let d=p[s];if(typeof d=="function")return d.bind(p);let g=p.value;if(g!==null&&typeof g=="object"){let C=g[s];return typeof C=="function"?C.bind(g):C}return d},has(b,s){if(s==="value"||s==="peek")return true;let d=p.value;return d!==null&&typeof d=="object"?s in d:s in p},ownKeys(b){let s=p.value;return s!==null&&typeof s=="object"?Reflect.ownKeys(s):[]},getOwnPropertyDescriptor(b,s){let d=p.value;if(d!==null&&typeof d=="object"){let g=Object.getOwnPropertyDescriptor(d,s);if(g)return {...g,configurable:true}}}})}return u}});return ()=>{let o=l(),f=null;if(o.length>0){let u=o[0];u.route.beforeEnter?u.route.beforeEnter(u.params)!==false&&(f=a$1(y.Provider,{value:1},[a$1("div",{key:u.route.path,style:{display:"contents"}},[a$1(u.route.component,{params:u.params})])])):f=a$1(y.Provider,{value:1},[a$1("div",{key:u.route.path,style:{display:"contents"}},[a$1(u.route.component,{params:u.params})])]);}return a$1(v.Provider,{value:R},[...a,a$1("main",{id:"main"},[f])])}}function z(t){return null}function nt(){let t=b(v),e=b(y);return t?()=>{let r=t.matches();if(e>=r.length)return null;let n=r[e];if(n.route.beforeEnter&&n.route.beforeEnter(n.params)===false)return null;let a=n.route.component;return a$1(y.Provider,{value:e+1},[a$1(a,{params:n.params})])}:null}function rt(t){let e=V(),r=n=>{n.preventDefault(),e.navigate(t.to);};return a$1("a",{href:t.to,class:t.class,onclick:r},t.children)}
|
|
2
|
-
export{F as a,N as b,j as c,B as d,k as e,D as f,V as g,et as h,z as i,nt as j,rt as k};//# sourceMappingURL=chunk-XLE6SMWX.mjs.map
|
|
3
|
-
//# sourceMappingURL=chunk-XLE6SMWX.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/router/core.ts","../src/router/utils.ts","../src/router/context.ts","../src/router/components.ts"],"names":["createLocation","getDefaultLoc","getLoc","parseQuery","loc","signal","navigate","path","isUnsafePath","handlePopState","error","normalizedPath","protocol","sanitizeQueryValue","value","DANGEROUS_KEYS","search","params","query","key","sanitizedKey","sanitizedValue","matchPath","pathname","routePath","paramNames","regexPath","_","paramName","regex","match","index","createRoutesFromChildren","children","routes","childArray","child","isFNode","component","beforeEnter","nestedChildren","route","matchRoutes","location","result","matchRouteBranch","parentPath","fullPath","isLeaf","matcher","compilePath","matchedPath","paramValues","paramsObj","extractParams","currentMatch","childMatches","indexRoute","c","prefix","values","i","RouterCtx","createContext","RouteDepthCtx","router","ctx","context","Router","props","nonRouteChildren","routeChildren","Route","matches","computed","m","routerContext","target","prop","_target","innerProp","signalProp","currentValue","objProp","desc","ms","matchedContent","rootMatch","f","_props","Outlet","depth","Component","Link","r","handleClick","e"],"mappings":"0IA8BO,SAASA,CAAAA,EAAyE,CAEvF,IAAMC,CAAAA,CAAgB,KAAiB,CACrC,QAAA,CAAU,GAAA,CACV,MAAA,CAAQ,EAAA,CACR,IAAA,CAAM,EAAA,CACN,KAAA,CAAO,EACT,CAAA,CAAA,CAEMC,CAAAA,CAAS,IACT,OAAO,MAAA,CAAW,GAAA,CACbD,CAAAA,GAEF,CACL,QAAA,CAAU,MAAA,CAAO,QAAA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tBoB,IAuBtB,CAEO,SAAS+D,EAAAA,CAAKxB,CAAAA,CAAkB,CACrC,IAAMyB,CAAAA,CAAI7B,GAAO,CAEX8B,CAAAA,CAAeC,CAAAA,EAAa,CAChCA,CAAAA,CAAE,cAAA,EAAe,CACjBF,CAAAA,CAAE,SAASzB,CAAAA,CAAM,EAAE,EACrB,CAAA,CAEA,OAAOmB,GAAAA,CACL,GAAA,CACA,CACE,KAAMnB,CAAAA,CAAM,EAAA,CACZ,KAAA,CAAOA,CAAAA,CAAM,MACb,OAAA,CAAS0B,CACX,CAAA,CACA1B,CAAAA,CAAM,QACR,CACF","file":"chunk-XLE6SMWX.mjs","sourcesContent":["/**\n * Router Core Module\n *\n * Provides core routing functionality including location management,\n * path matching, and navigation.\n */\n\nimport { signal, Signal } from '../core/signal'\nimport { Location } from './types'\n\n/**\n * Creates a reactive location signal and navigate function.\n *\n * The location signal automatically updates when:\n * - navigate() is called\n * - Browser back/forward buttons are used (popstate event)\n *\n * @returns Tuple of [location signal, navigate function, cleanup function]\n *\n * @example\n * ```tsx\n * const [location, navigate, cleanup] = createLocation();\n * // Access current path\n * console.log(location().pathname);\n * // Navigate to new path\n * navigate('/users/123');\n * // Cleanup when done (removes popstate listener)\n * cleanup();\n * ```\n */\nexport function createLocation(): [Signal<Location>, (path: string) => void, () => void] {\n // SSR guard: return safe defaults on server\n const getDefaultLoc = (): Location => ({\n pathname: '/',\n search: '',\n hash: '',\n query: {},\n })\n\n const getLoc = (): Location => {\n if (typeof window === 'undefined') {\n return getDefaultLoc()\n }\n return {\n pathname: window.location.pathname,\n search: window.location.search,\n hash: window.location.hash,\n query: parseQuery(window.location.search),\n }\n }\n\n const loc = signal(getLoc())\n\n const navigate = (path: string) => {\n // SSR guard\n if (typeof window === 'undefined') return\n\n // Security: Validate path to prevent javascript: and other dangerous protocols\n if (isUnsafePath(path)) {\n console.error('[Flexium Router] Blocked navigation to unsafe path:', path)\n return\n }\n window.history.pushState({}, '', path)\n loc.value = getLoc()\n }\n\n // SSR guard for popstate listener\n const handlePopState = () => {\n try {\n loc.value = getLoc()\n } catch (error) {\n console.error('[Flexium Router] Error handling popstate:', error)\n }\n }\n\n if (typeof window !== 'undefined') {\n window.addEventListener('popstate', handlePopState)\n }\n\n // Cleanup function to remove listener\n const cleanup = () => {\n if (typeof window !== 'undefined') {\n window.removeEventListener('popstate', handlePopState)\n }\n }\n\n return [loc, navigate, cleanup]\n}\n\n/**\n * Check if a path contains unsafe protocols (XSS prevention)\n * @param path - Path to validate\n * @returns true if path is unsafe\n */\nexport function isUnsafePath(path: string): boolean {\n const normalizedPath = path.trim().toLowerCase()\n const unsafeProtocols = ['javascript:', 'data:', 'vbscript:', 'file:']\n return unsafeProtocols.some(protocol => normalizedPath.startsWith(protocol))\n}\n\n/**\n * Sanitize query parameter value to prevent XSS\n * @param value - Query parameter value\n * @returns Sanitized value\n */\nexport function sanitizeQueryValue(value: string): string {\n // Remove potential script tags and event handlers\n return value\n .replace(/<[^>]*>/g, '') // Remove HTML tags\n .replace(/javascript:/gi, '') // Remove javascript: protocol\n .replace(/on\\w+\\s*=/gi, '') // Remove event handlers like onclick=\n}\n\n/**\n * Parses URL search string into key-value object\n * @param search - URL search string (e.g., \"?foo=bar&baz=qux\")\n * @returns Object with query parameters\n */\n// Dangerous keys that could lead to prototype pollution\nconst DANGEROUS_KEYS = new Set(['__proto__', 'constructor', 'prototype'])\n\nfunction parseQuery(search: string): Record<string, string> {\n const params = new URLSearchParams(search)\n // Use Object.create(null) to prevent prototype pollution\n const query: Record<string, string> = Object.create(null)\n params.forEach((value, key) => {\n // Sanitize both key and value to prevent XSS\n const sanitizedKey = sanitizeQueryValue(key)\n const sanitizedValue = sanitizeQueryValue(value)\n // Block dangerous keys to prevent prototype pollution\n if (sanitizedKey && !DANGEROUS_KEYS.has(sanitizedKey)) {\n query[sanitizedKey] = sanitizedValue\n }\n })\n return query\n}\n\n/**\n * Matches a pathname against a route pattern.\n *\n * Supports dynamic segments with `:param` syntax.\n *\n * @param pathname - Current URL pathname (e.g., \"/users/123\")\n * @param routePath - Route pattern (e.g., \"/users/:id\")\n * @returns Object with `matches` boolean and extracted `params`\n *\n * @example\n * ```tsx\n * const result = matchPath('/users/123', '/users/:id');\n * // { matches: true, params: { id: '123' } }\n * ```\n */\nexport function matchPath(\n pathname: string,\n routePath: string\n): { matches: boolean; params: Record<string, string> } {\n const paramNames: string[] = []\n const regexPath = routePath.replace(/:([^/]+)/g, (_, paramName) => {\n paramNames.push(paramName)\n return '([^/]+)'\n })\n\n const regex = new RegExp(`^${regexPath}$`)\n const match = pathname.match(regex)\n\n if (!match) {\n return { matches: false, params: {} }\n }\n\n const params: Record<string, string> = {}\n match.slice(1).forEach((value, index) => {\n params[paramNames[index]] = value\n })\n\n return { matches: true, params }\n}\n","import { RouteDef, RouteMatch } from './types'\nimport type { FNodeChild } from '../core/renderer'\nimport { isFNode } from '../renderers/dom/f'\n\n/**\n * Flatten the children of <Router> or <Route> into a route configuration tree.\n * Note: This assumes `children` are FNodes representing <Route> components.\n */\nexport function createRoutesFromChildren(children: FNodeChild): RouteDef[] {\n const routes: RouteDef[] = []\n\n const childArray = Array.isArray(children) ? children : [children]\n\n for (const child of childArray) {\n if (!isFNode(child)) {\n continue\n }\n\n const { path, index, component, beforeEnter } = child.props as {\n path?: string\n index?: boolean\n component?: Function\n beforeEnter?: (\n params: Record<string, string>\n ) => boolean | Promise<boolean>\n }\n const nestedChildren = child.children\n\n // Skip routes without a component (unless they have children as layout routes)\n if (!component && !nestedChildren) {\n console.warn(\n `[Flexium Router] Route \"${path || '(index)'}\" has no component and no children. Skipping.`\n )\n continue\n }\n\n const route: RouteDef = {\n path: path || '',\n index: !!index,\n component: component || (() => null),\n children: nestedChildren ? createRoutesFromChildren(nestedChildren) : [],\n beforeEnter,\n }\n\n routes.push(route)\n }\n\n return routes\n}\n\n/**\n * Match a URL against a route tree.\n * Returns an array of matches (from root to leaf).\n */\nexport function matchRoutes(\n routes: RouteDef[],\n location: string\n): RouteMatch[] | null {\n for (const route of routes) {\n const result = matchRouteBranch(route, location, '')\n if (result) return result\n }\n return null\n}\n\nfunction matchRouteBranch(\n route: RouteDef,\n location: string,\n parentPath: string\n): RouteMatch[] | null {\n let fullPath = parentPath\n if (route.path) {\n fullPath =\n parentPath.replace(/\\/$/, '') + '/' + route.path.replace(/^\\//, '')\n }\n\n const isLeaf = route.children.length === 0\n const matcher = compilePath(fullPath, !isLeaf)\n const match = location.match(matcher)\n\n if (match) {\n const [matchedPath, ...paramValues] = match\n const paramsObj = extractParams(fullPath, paramValues)\n\n const currentMatch: RouteMatch = {\n route,\n params: paramsObj,\n pathname: matchedPath,\n }\n\n if (isLeaf) {\n // Exact match required for leaf\n if (matchedPath === location) return [currentMatch]\n return null\n }\n\n // Has children: try to match one of them\n // If no children match, and this route is an index route?\n // Or if this route matches partially, maybe an index child matches the rest?\n\n for (const child of route.children) {\n const childMatches = matchRouteBranch(child, location, fullPath)\n if (childMatches) {\n return [currentMatch, ...childMatches]\n }\n }\n\n // If no children matched, but we matched exactly this layout route?\n // E.g. /users matches /users layout, and maybe it renders index?\n if (matchedPath === location) {\n // Check for index route\n const indexRoute = route.children.find((c) => c.index)\n if (indexRoute) {\n return [\n currentMatch,\n { route: indexRoute, params: {}, pathname: matchedPath },\n ]\n }\n // Just the layout? Maybe.\n return [currentMatch]\n }\n }\n\n return null\n}\n\nfunction compilePath(path: string, prefix: boolean): RegExp {\n const regexPath = path.replace(/:([^/]+)/g, () => '([^/]+)')\n\n // If path is exactly \"/\", and we want prefix matching, it should match everything\n if (regexPath === '/' && prefix) {\n return new RegExp('^')\n }\n\n // If prefix matching allowed, ensure we match segment boundary\n return new RegExp(`^${regexPath}${prefix ? '(?:/|$)' : '$'}`)\n}\n\nfunction extractParams(path: string, values: string[]): Record<string, string> {\n const params: Record<string, string> = {}\n let i = 0\n // Re-parse to find param names... inefficient but works\n path.replace(/:([^/]+)/g, (_, paramName) => {\n params[paramName] = values[i++]\n return ''\n })\n return params\n}\n","import { createContext } from '../core/context'\nimport { RouterContext } from './types'\n\n// Global Router Context\nexport const RouterCtx = createContext<RouterContext | null>(null)\n\n// Current Route Depth Context (for Outlet)\n// Stores the index of the current match in the `matches` array\nexport const RouteDepthCtx = createContext<number>(0)\n","import { computed, type Signal, type Computed } from '../core/signal'\nimport { createLocation } from './core'\nimport { createRoutesFromChildren, matchRoutes } from './utils'\nimport { LinkProps, RouteProps, RouterContext } from './types'\nimport { f, isFNode } from '../renderers/dom/f'\nimport { RouterCtx, RouteDepthCtx } from './context'\nimport { context } from '../core/context'\nimport type { FNodeChild } from '../core/renderer'\n\n/**\n * Get the current router context.\n * Must be called within a <Router> component.\n *\n * @example\n * ```tsx\n * const r = router()\n * r.navigate('/dashboard')\n * ```\n */\nexport function router(): RouterContext {\n const ctx = context(RouterCtx)\n if (!ctx) {\n throw new Error('router() must be called within a <Router> component')\n }\n return ctx\n}\n\nexport function Router(props: { children: FNodeChild }) {\n const [location, navigate] = createLocation()\n\n // Separate Route children from non-Route children (like Nav, etc.)\n const childArray = Array.isArray(props.children) ? props.children : [props.children]\n const nonRouteChildren: FNodeChild[] = []\n const routeChildren: FNodeChild[] = []\n\n for (const child of childArray) {\n if (isFNode(child) && typeof child.type === 'function' && child.type === Route) {\n routeChildren.push(child)\n } else {\n nonRouteChildren.push(child)\n }\n }\n\n // Parse route configuration from Route children only\n const routes = createRoutesFromChildren(routeChildren)\n\n // Compute matches\n const matches = computed(() => {\n const loc = location()\n return matchRoutes(routes, loc.pathname) || []\n })\n\n const params = computed(() => {\n const m = matches()\n if (m.length > 0) {\n return m[m.length - 1].params\n }\n return {}\n })\n\n // Create routerContext as a stable object\n // The signals (location, params, matches) are already reactive\n // We create a proxy to ensure property access is properly tracked\n // When accessing location, params, or matches, automatically read the signal's value\n // to register subscriptions (similar to how state() proxy works)\n const routerContext: RouterContext = new Proxy({\n location,\n params,\n navigate,\n matches,\n }, {\n get(target, prop) {\n const value = target[prop as keyof RouterContext]\n \n // For signal/computed properties (location, params, matches),\n // return a proxy that automatically reads the signal's value when properties are accessed\n // This makes router() work like state() - property access triggers tracking\n if (prop === 'location' || prop === 'params' || prop === 'matches') {\n const signal = value as Signal<unknown> | Computed<unknown>\n \n // Create a callable target function (like state proxy does)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const target = () => signal.value\n \n // Return a proxy that wraps the signal and automatically reads its value\n // when properties are accessed, ensuring subscriptions are registered\n // This follows the same pattern as state() proxy for consistency\n return new Proxy(target, {\n // Make the proxy callable - returns current value\n apply() {\n return signal.value\n },\n \n get(_target, innerProp) {\n // Accessing .value triggers subscription registration via signal's value getter\n if (innerProp === 'value') {\n return signal.value\n }\n \n // Allow direct access to peek() without tracking\n if (innerProp === 'peek') {\n return signal.peek\n }\n \n // Calling as function also triggers subscription\n if (innerProp === Symbol.toPrimitive || innerProp === 'toString' || innerProp === 'valueOf') {\n return () => signal.value\n }\n \n // For other signal properties (set, etc.), access them normally\n const signalProp = (signal as any)[innerProp]\n if (typeof signalProp === 'function') {\n return signalProp.bind(signal)\n }\n \n // If the signal's value is an object, access its properties\n // This enables r.location.pathname and r.params.id to work and register subscriptions\n // Note: accessing signal.value here tracks the signal in any enclosing effect\n const currentValue = signal.value\n if (currentValue !== null && typeof currentValue === 'object') {\n const obj = currentValue as Record<string | symbol, unknown>\n const objProp = obj[innerProp]\n // If it's a function (like array methods), bind it to the current value\n if (typeof objProp === 'function') {\n return objProp.bind(currentValue)\n }\n return objProp\n }\n \n return signalProp\n },\n \n // For property checks (like 'id' in params)\n has(_target, innerProp) {\n if (innerProp === 'value' || innerProp === 'peek') return true\n const currentValue = signal.value\n if (currentValue !== null && typeof currentValue === 'object') {\n return innerProp in (currentValue as object)\n }\n return innerProp in signal\n },\n \n // For Object.keys, for...in loops\n ownKeys(_target) {\n const currentValue = signal.value\n if (currentValue !== null && typeof currentValue === 'object') {\n return Reflect.ownKeys(currentValue as object)\n }\n return []\n },\n \n getOwnPropertyDescriptor(_target, innerProp) {\n const currentValue = signal.value\n if (currentValue !== null && typeof currentValue === 'object') {\n const desc = Object.getOwnPropertyDescriptor(currentValue as object, innerProp)\n if (desc) {\n return { ...desc, configurable: true }\n }\n }\n return undefined\n }\n })\n }\n \n // For navigate, return as-is\n return value\n }\n }) as RouterContext\n\n return () => {\n const ms = matches()\n\n // Matched route component (or null if no match)\n let matchedContent: FNodeChild = null\n if (ms.length > 0) {\n const rootMatch = ms[0]\n\n // Check beforeEnter guard\n if (rootMatch.route.beforeEnter) {\n const result = rootMatch.route.beforeEnter(rootMatch.params)\n if (result !== false) {\n matchedContent = f(RouteDepthCtx.Provider, { value: 1 }, [\n f('div', { key: rootMatch.route.path, style: { display: 'contents' } }, [\n f(rootMatch.route.component, { params: rootMatch.params }),\n ]),\n ])\n }\n } else {\n matchedContent = f(RouteDepthCtx.Provider, { value: 1 }, [\n f('div', { key: rootMatch.route.path, style: { display: 'contents' } }, [\n f(rootMatch.route.component, { params: rootMatch.params }),\n ]),\n ])\n }\n }\n\n // Render non-Route children (like Nav) and the matched route wrapped in main\n return f(RouterCtx.Provider, { value: routerContext }, [\n ...nonRouteChildren,\n f('main', { id: 'main' }, [matchedContent]),\n ])\n }\n}\n\n/**\n * Route configuration component.\n * Doesn't render anything directly; used by Router to build the route tree.\n */\nexport function Route(_props: RouteProps) {\n return null\n}\n\n/**\n * Renders the child route content.\n */\nexport function Outlet() {\n const router = context(RouterCtx)\n const depth = context(RouteDepthCtx) // Default 0\n\n // Safety check\n if (!router) return null\n\n return () => {\n const ms = router.matches()\n\n // Check if we have a match at this depth\n if (depth >= ms.length) return null\n\n const match = ms[depth]\n\n // Check beforeEnter guard\n if (match.route.beforeEnter) {\n const result = match.route.beforeEnter(match.params)\n if (result === false) return null\n }\n\n const Component = match.route.component\n\n // Render component and provide next depth\n return f(RouteDepthCtx.Provider, { value: depth + 1 }, [\n f(Component, { params: match.params }),\n ])\n }\n}\n\nexport function Link(props: LinkProps) {\n const r = router()\n\n const handleClick = (e: Event) => {\n e.preventDefault()\n r.navigate(props.to)\n }\n\n return f(\n 'a',\n {\n href: props.to,\n class: props.class,\n onclick: handleClick,\n },\n props.children\n )\n}\n"]}
|
package/dist/chunk-YGMMJWAA.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
'use strict';var i={EFFECT_EXECUTION_FAILED:"FLX101",CLEANUP_OUTSIDE_EFFECT:"FLX102",SIGNAL_UPDATE_DURING_RENDER:"FLX103",COMPUTED_EXECUTION_FAILED:"FLX104",CONTEXT_MISSING_PROVIDER:"FLX201",ROUTER_OUTSIDE_PROVIDER:"FLX202",FORM_VALIDATION_FAILED:"FLX301",FORM_SUBMISSION_FAILED:"FLX302",ASYNC_VALIDATION_FAILED:"FLX303",BUTTON_HANDLER_FAILED:"FLX401",BUTTON_MISSING_ARIA_LABEL:"FLX402",COMPONENT_RENDER_FAILED:"FLX403",HYDRATION_MISMATCH:"FLX501",HYDRATION_TEXT_MISMATCH:"FLX502",HYDRATION_TAG_MISMATCH:"FLX503",HYDRATION_ATTRIBUTE_MISMATCH:"FLX504",DEVTOOLS_LISTENER_ERROR:"FLX601",UNCAUGHT_RENDER_ERROR:"FLX701",ERROR_BOUNDARY_CALLBACK_FAILED:"FLX702",DOM_CLEANUP_FAILED:"FLX703",EVENT_HANDLER_FAILED:"FLX801",KEYBOARD_HANDLER_FAILED:"FLX802",RESOURCE_FETCH_FAILED:"FLX901",RESOURCE_TIMEOUT:"FLX902"};function K(t){return typeof process<"u"&&process.env?.NODE_ENV!=="production"?{[i.EFFECT_EXECUTION_FAILED]:{message:"Effect execution failed",suggestion:"Check the effect callback for runtime errors. Consider wrapping async operations in try-catch."},[i.CLEANUP_OUTSIDE_EFFECT]:{message:"onCleanup must be called from within an effect",suggestion:"Move the onCleanup() call inside an effect() callback."},[i.SIGNAL_UPDATE_DURING_RENDER]:{message:"Signal was updated during render",suggestion:"Avoid updating signals inside render functions. Use effect() for side effects."},[i.CONTEXT_MISSING_PROVIDER]:{message:"Context used outside of Provider",suggestion:"Wrap your component tree with the appropriate Context.Provider."},[i.ROUTER_OUTSIDE_PROVIDER]:{message:"router() must be used within a <Router> component",suggestion:"Ensure your component is a descendant of <Router>."},[i.FORM_VALIDATION_FAILED]:{message:"Form field validation failed",suggestion:"Check the validation rules for the field and the input value."},[i.FORM_SUBMISSION_FAILED]:{message:"Form submission failed",suggestion:"Check the onSubmit handler and network connectivity."},[i.BUTTON_HANDLER_FAILED]:{message:"Button press handler failed",suggestion:"Check the onPress/onClick callback for errors."},[i.BUTTON_MISSING_ARIA_LABEL]:{message:"IconButton is missing an aria-label",suggestion:"Add an aria-label prop to IconButton for screen reader accessibility."},[i.HYDRATION_MISMATCH]:{message:"Hydration mismatch detected",suggestion:"Ensure server and client render the same content. Check for browser-only code."},[i.HYDRATION_TEXT_MISMATCH]:{message:"Text content mismatch during hydration",suggestion:"Server and client rendered different text. Check for Date.now(), Math.random(), or client-only data."},[i.HYDRATION_TAG_MISMATCH]:{message:"Element tag mismatch during hydration",suggestion:"Server and client rendered different elements. Verify conditional rendering logic."},[i.DEVTOOLS_LISTENER_ERROR]:{message:"DevTools listener threw an error",suggestion:"Check your DevTools event listener callback."},[i.UNCAUGHT_RENDER_ERROR]:{message:"Uncaught error during render",suggestion:"Wrap components with <ErrorBoundary> to catch and handle errors gracefully."},[i.ERROR_BOUNDARY_CALLBACK_FAILED]:{message:"ErrorBoundary callback failed",suggestion:"Check your onError or onReset callback for errors."},[i.COMPUTED_EXECUTION_FAILED]:{message:"Computed value execution failed",suggestion:"Check the computed callback for runtime errors. Ensure all dependencies are valid."},[i.ASYNC_VALIDATION_FAILED]:{message:"Async form validation failed",suggestion:"Check the async validation function and ensure it handles errors properly."},[i.COMPONENT_RENDER_FAILED]:{message:"Component render failed",suggestion:"Check the component function for runtime errors. Consider wrapping with <ErrorBoundary>."},[i.HYDRATION_ATTRIBUTE_MISMATCH]:{message:"Attribute mismatch during hydration",suggestion:"Server and client rendered different attribute values. Check for dynamic attributes."},[i.DOM_CLEANUP_FAILED]:{message:"DOM cleanup operation failed",suggestion:"A node may have been removed from the DOM unexpectedly. Check for manual DOM manipulation."},[i.EVENT_HANDLER_FAILED]:{message:"Event handler threw an error",suggestion:"Check your event handler callback. Consider adding try-catch for async operations."},[i.KEYBOARD_HANDLER_FAILED]:{message:"Keyboard event handler failed",suggestion:"Check the onKeyDown/onKeyUp handler for errors."},[i.RESOURCE_FETCH_FAILED]:{message:"Resource fetch failed",suggestion:"Check the async function and network connectivity. The resource will show an error state."},[i.RESOURCE_TIMEOUT]:{message:"Resource fetch timed out",suggestion:"The async operation took too long. Consider adding a timeout handler or retry logic."}}[t]||{message:`Error ${t}`}:{message:`Minified Error ${t}`}}function B(t,e,r){let n=K(t);return {code:t,message:n.message,suggestion:n.suggestion,context:e,originalError:r}}function X(t){let e=`[Flexium ${t.code}] ${t.message}`;if(t.context&&Object.keys(t.context).length>0){let r=Object.entries(t.context).map(([n,o])=>`${n}: ${JSON.stringify(o)}`).join(", ");e+=` (${r})`;}return t.suggestion&&(e+=`
|
|
2
|
-
\u2192 ${t.suggestion}`),e}function P(t,e,r){let n=B(t,e,r),o=X(n);r?console.error(o,r):console.error(o);}function G(t,e){let r=B(t,e),n=X(r);console.warn(n);}var v;(o=>{let t=[],e=0;function r(s,a){if(e>0){let u=t[--e];return u.dep=s,u.sub=a,u.prevSub=void 0,u.nextSub=void 0,u.prevDep=void 0,u.nextDep=void 0,u}return {dep:s,sub:a,prevSub:void 0,nextSub:void 0,prevDep:void 0,nextDep:void 0}}o.alloc=r;function n(s){s.dep=void 0,s.sub=void 0,s.prevSub=void 0,s.nextSub=void 0,s.prevDep=void 0,s.nextDep=void 0,e<1e4&&(t[e++]=s);}o.free=n;})(v||(v={}));var c;(r=>{function t(n,o){let s=v.alloc(n,o),a=o.depsHead;s.nextDep=a,a&&(a.prevDep=s),o.depsHead=s;let u=n.subsHead;s.nextSub=u,u&&(u.prevSub=s),n.subsHead=s;}r.connect=t;function e(n){let o=n.depsHead;for(;o;){let s=o.dep,a=o.nextDep,u=o.prevSub,l=o.nextSub;u?u.nextSub=l:s.subsHead=l,l&&(l.prevSub=u),v.free(o),o=a;}n.depsHead=void 0;}r.disconnectDependencies=e;})(c||(c={}));var V;(n=>{function t(o,s){return (o.flags&s)!==0}n.has=t;function e(o,s){o.flags|=s;}n.add=e;function r(o,s){o.flags&=~s;}n.remove=r;})(V||(V={}));var g=null;function f(){return g}function p(t){g=t;}function $(t){let e=g;g=null;try{return t()}finally{g=e;}}var h=null;function m(){return h}function O(t){h=t;}function j(t){let e=h,r={cleanups:[],context:e?Object.create(e.context):null,owner:e};h=r;let n=()=>{if(r.cleanups.length!==0){for(let o of r.cleanups)o();r.cleanups=[];}};try{return t(n)}finally{h=e;}}var T=0,R=new Set,b=new Set,x=false;function A(){x||(x=true,queueMicrotask(Y));}function Y(){if(x=false,b.size===0)return;let t=[];for(let e of b)t.push(e);b.clear();for(let e=0;e<t.length;e++)t[e].execute();}function C(t){b.add(t);}function L(t){R.add(t);}function k(){return T}function ne(t){let e;if(t){T++;try{e=t();}finally{if(T--,T===0){let r=[];for(let n of R)r.push(n);R.clear();for(let n=0;n<r.length;n++)r[n].execute();}}}return Y(),e}var F=class{constructor(e,r){this.fn=e;this.onError=r;this.cleanups=[];this.flags=0;this.nodeType=3;this.owner=null;this.owner=m();}execute(){if((this.flags&1)!==0){this.flags|=2;return}this.flags|=1;try{this.run();}finally{this.flags&=-2,(this.flags&2)!==0&&(this.flags&=-3,queueMicrotask(()=>this.execute()));}}run(){if(this.cleanups.length>0){for(let n=this.cleanups.length-1;n>=0;n--)this.cleanups[n]();this.cleanups=[];}c.disconnectDependencies(this);let e=f(),r=m();p(this),O(this.owner);try{let n=this.fn();typeof n=="function"&&this.cleanups.push(n);}catch(n){this.onError?this.onError(n):P(i.EFFECT_EXECUTION_FAILED,void 0,n);}finally{p(e),O(r);}}dispose(){if(this.cleanups.length>0){for(let e=this.cleanups.length-1;e>=0;e--)this.cleanups[e]();this.cleanups=[];}c.disconnectDependencies(this);}};function w(t,e){let r=new F(t,e?.onError);r.execute();let n=()=>r.dispose(),o=m();return o&&o.cleanups.push(n),n}var D=null;function Te(t){D=t;}var N=0,H=class{constructor(e){this._value=e;this.version=0;this.nodeType=1;}get(){let e=f();return e&&c.connect(this,e),this._value}set(e){this._value!==e&&(this._value=e,this.version=++N,this.notify());}peek(){return this._value}notify(){if(k()===0){if(this.subsHead){let e=false,r=this.subsHead;for(;r;){let n=r.sub;n.nodeType===2?n.execute():(C(n),e||(e=true,A())),r=r.nextSub;}}}else {let e=this.subsHead;for(;e;)e.sub&&L(e.sub),e=e.nextSub;}}},U=class{constructor(e){this.computeFn=e;this.version=0;this.nodeType=2;this.flags=12;this.lastCleanEpoch=0;}execute(){this.flags|=12,this.notify();}_updateIfDirty(){let e=this.flags;if((e&12)===0)return;if((e&4)===0&&(e&8)!==0&&!this._needsRefetch()){this.flags&=-9;return}this.flags&=-13,c.disconnectDependencies(this);let n=f();p(this);try{let o=this.computeFn();this._value!==o&&(this._value=o,this.version=++N),this.lastCleanEpoch=N;}finally{p(n);}}_needsRefetch(){if(!this.depsHead)return true;let e=this.depsHead;for(;e;){let r=e.dep;if(r.version>this.lastCleanEpoch)return true;if(r.nodeType===2){let n=r;if((n.flags&12)!==0){let a=n.version;if(n.peek(),n.version!==a&&n.version>this.lastCleanEpoch)return true}}e=e.nextDep;}return false}get(){let e=f();return e&&e!==this&&c.connect(this,e),(this.flags&12)!==0&&this._updateIfDirty(),this._value}peek(){return (this.flags&12)!==0&&this._updateIfDirty(),this._value}notify(){if(k()===0){if(this.subsHead){let e=false,r=this.subsHead;for(;r;){let n=r.sub;n.nodeType===2?n.execute():(C(n),e=true),r=r.nextSub;}e&&A();}}else {let e=this.subsHead;for(;e;)e.sub&&L(e.sub),e=e.nextSub;}}};function S(t){let e=new H(t),r=-1,n=function(){return e.get()};Object.defineProperty(n,"value",{get(){return e.get()},set(s){if(e.set(s),r>=0){let a=D;a?.onSignalUpdate&&a.onSignalUpdate(r,s);}},enumerable:true,configurable:true}),n.set=s=>{if(e.set(s),r>=0){let a=D;a?.onSignalUpdate&&a.onSignalUpdate(r,s);}},n.peek=()=>e.peek(),n[I]=true;let o=D;return o?.onSignalCreate&&(r=o.onSignalCreate(n)),n}function be(t){let e=new U(t),r=function(){return e.get()};return Object.defineProperty(r,"value",{get(){return e.get()},enumerable:true,configurable:true}),r.peek=()=>e.peek(),r[I]=true,r}var I=Symbol("flexium.signal");function z(t){return t!==null&&typeof t=="function"&&I in t}function Se(t){let e=f();e&&e.nodeType===3?e.cleanups.push(t):G(i.CLEANUP_OUTSIDE_EFFECT);}function De(t,e){let r=S(void 0),n=S(void 0),o=S(false),s=S("unresolved"),a=async(d,M=false)=>{M?(s.value="refreshing",o.value=true):(s.value="pending",o.value=true),n.value=void 0;let E=e(d,{value:r.peek(),refetching:M});u=E;try{let y=await E;u===E&&(r.value=y,s.value="ready",o.value=!1);}catch(y){u===E&&(n.value=y,s.value="errored",o.value=false);}},u=null,l=()=>typeof t=="function"?z(t)?t.value:t():t;w(()=>{let d=l();a(d,false);});let _=function(){return r()};return Object.defineProperties(_,{value:{get:()=>r.value},loading:{get:()=>o.value},error:{get:()=>n.value},state:{get:()=>s.value},latest:{get:()=>r.peek()},peek:{value:()=>r.peek()},set:{value:d=>r.set(d)}}),_[I]=true,[_,{mutate:d=>r.set(d),refetch:()=>a(l(),true)}]}exports.a=i;exports.b=P;exports.c=G;exports.d=$;exports.e=m;exports.f=j;exports.g=ne;exports.h=w;exports.i=Te;exports.j=S;exports.k=be;exports.l=z;exports.m=Se;exports.n=De;//# sourceMappingURL=chunk-YGMMJWAA.js.map
|
|
3
|
-
//# sourceMappingURL=chunk-YGMMJWAA.js.map
|