UNPKG

flexium

Version:

A lightweight, signals-based UI framework with cross-platform renderers

2 lines 1.04 kB
import {b}from'./chunk-Z7JNAX53.mjs';function w(e){let{each:r,children:n}=e,l=n[0],i=new Map;return ()=>{let a=r()||[],o=new Map,s=a.map((t,f)=>{let c=i.get(t);if(c)c.indexSig.peek()!==f&&c.indexSig.set(f);else {let u=b(f),d=l(t,u);d.key==null&&(t!=null&&t.id!=null?d.key=t.id:(typeof t=="string"||typeof t=="number")&&(d.key=t)),c={vnode:d,indexSig:u};}return o.set(t,c),c.vnode});return i=o,s}}function g(e){return ()=>{let r=e.when();if(r){let n=e.children[0];return typeof n=="function"&&e.children.length===1?n(r):n}return e.fallback?typeof e.fallback=="function"?e.fallback():e.fallback:null}}function y(e){return e}function N(e){return ()=>{let r=Array.isArray(e.children)?e.children:[e.children];for(let n of r.flat())if(n&&n.type===y){let l=n.props.when,i=typeof l=="function"?l():l;if(i){let a=n.children;if(a&&a.length>0){let o=a[0];return typeof o=="function"?o(i):o}return null}}return e.fallback||null}}export{w as a,g as b,y as c,N as d};//# sourceMappingURL=chunk-S5WORXR2.mjs.map //# sourceMappingURL=chunk-S5WORXR2.mjs.map