UNPKG

flexium

Version:

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

1 lines 65.9 kB
{"version":3,"sources":["../src/core/suspense.ts","../src/renderers/dom/events.ts","../src/renderers/dom/index.ts","../src/renderers/dom/reconcile.ts","../src/renderers/dom/reactive.ts","../src/renderers/dom/portal.ts"],"names":["SuspenseCtx","createContext","Suspense","props","pendingCount","signal","contextValue","promise","untrack","h","globalListeners","NON_BUBBLING_EVENTS","nodeHandlers","dispatchEvent","event","target","eventType","bubbles","handlers","handler","ensureGlobalListener","eventName","capture","eventDelegator","node","lowerEvent","ELEMENT_MAPPING","EVENT_MAPPING","SKIP_PROPS","px","value","updateStyles","element","oldProps","newProps","style","oldStyle","newStyle","key","val","update","prop","type","normalizeClass","k","DOMRenderer","tagName","newVal","oldVal","parent","child","beforeChild","text","domEvent","_handler","domRenderer","reconcileArrays","oldVNodes","newVNodes","nextSibling","oldStartIdx","oldEndIdx","newStartIdx","newEndIdx","oldStartVNode","oldEndVNode","newStartVNode","newEndVNode","oldKeyToIdx","isSameKey","patchNode","createKeyMap","idxInOld","newNode","mountReactive","vnodeToMove","before","i","nodeToRemove","cleanupReactive","n1","n2","children","start","end","map","oldVNode","newVNode","oldChildren","newChildren","REACTIVE_BINDINGS","vnode","isSignal","startNode","wrapperFragment","currentNode","currentVNode","currentVNodeList","dispose","effect","c","container","fragment","childNode","targetNode","resultNode","isVNode","component","contextId","pushProvider","result","err","suspense","useContext","popProvider","disposeProps","setupReactiveProps","disposers","computedValue","bindings","renderReactive","createReactiveRoot","rootDispose","batch","Portal","placeholder","portalContent","onCleanup"],"mappings":"0HAQO,IAAMA,CAAAA,CAAcC,CAAAA,CAA2C,IAAI,CAAA,CAEnE,SAASC,EAAAA,CAASC,CAAAA,CAAyC,CAC9D,IAAMC,EAAeC,GAAAA,CAAO,CAAC,CAAA,CAavBC,CAAAA,CAAqC,CAAE,eAAA,CAXpBC,CAAAA,EAA0B,CAC/CC,CAAAA,CAAQ,IAAM,CACVJ,CAAAA,C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AAc,QAAQ,EAG/CC,CAAAA,CAA6B,IAAA,CAIjC,OAAAA,CAAAA,CAAgBpD,EAAcvE,GAAAA,CAAM,QAAA,CAAUkG,CAAS,CAAA,CAGvD0B,EAAU,IAAM,CACVD,CAAAA,GACF/C,CAAAA,CAAgB+C,CAAa,CAAA,CACzBA,CAAAA,CAAc,UAAA,GAAezB,CAAAA,EAC/BA,EAAU,WAAA,CAAYyB,CAAa,CAAA,EAGzC,CAAC,EAEMD,CACT","file":"chunk-JV5YLJIQ.mjs","sourcesContent":["import { createContext } from './context';\nimport { signal, untrack } from './signal';\nimport { h } from '../renderers/dom/h';\n\nexport interface SuspenseContextValue {\n registerPromise: (promise: Promise<any>) => void;\n}\n\nexport const SuspenseCtx = createContext<SuspenseContextValue | null>(null);\n\nexport function Suspense(props: { fallback: any, children: any }) {\n const pendingCount = signal(0);\n \n const registerPromise = (promise: Promise<any>) => {\n untrack(() => {\n pendingCount.value++;\n promise.then(() => {\n pendingCount.value--;\n }, () => {\n pendingCount.value--;\n });\n });\n };\n \n const contextValue: SuspenseContextValue = { registerPromise };\n \n return () => {\n const isPending = pendingCount.value > 0;\n \n if (isPending) {\n return props.fallback;\n }\n \n // If not pending, try to render children.\n // If children throw Promise during this render, mountReactive catches it,\n // calls registerPromise, and returns placeholder.\n // registerPromise updates signal -> trigger re-render -> loop?\n \n // 1. Suspense render (count=0). Returns Provider(children).\n // 2. mountReactive renders children. Child throws.\n // 3. mountReactive catches, calls registerPromise.\n // 4. registerPromise: count=1. Signal updated.\n // 5. Suspense effect triggers re-render.\n // 6. Suspense render (count=1). Returns fallback.\n // 7. mountReactive renders fallback. DOM updates.\n \n // 8. Promise resolves. count=0. Signal updated.\n // 9. Suspense render (count=0). Returns Provider(children).\n // 10. mountReactive renders children. Child calls read(). Value is ready. No throw.\n // 11. Success.\n \n return h(SuspenseCtx.Provider, { value: contextValue }, props.children);\n };\n}\n","import type { EventHandler } from '../../core/renderer';\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 // Bubble up from target to document (or just target if non-bubbling)\n while (target && target !== document) {\n const handlers = nodeHandlers.get(target);\n if (handlers && handlers.has(eventType)) {\n const handler = handlers.get(eventType);\n if (handler) {\n handler(event);\n if (event.cancelBubble) {\n break;\n }\n }\n }\n \n if (!bubbles) break; // Stop if event doesn't bubble\n \n target = target.parentNode;\n }\n}\n\n/**\n * Register a global event listener for delegation\n */\nfunction ensureGlobalListener(eventName: string) {\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 * 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 * 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 View: 'div',\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 * 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 * Apply style props to DOM element efficiently\n */\nfunction updateStyles(element: HTMLElement, oldProps: Record<string, any>, newProps: Record<string, any>): void {\n const style = element.style;\n\n // 1. Handle 'style' object prop\n const oldStyle = oldProps.style;\n const newStyle = newProps.style;\n \n if (oldStyle !== newStyle) {\n if (oldStyle && typeof oldStyle === 'object') {\n for (const key in oldStyle) {\n if (!newStyle || !(key in newStyle)) {\n if ((style as any)[key] !== '') (style as any)[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 (style as any)[key] = val;\n }\n }\n }\n }\n\n // 2. Handle Flexium specific style props\n // Helper to update individual style property if changed\n const update = (prop: string, value: string | undefined) => {\n // Note: accessing style[prop] is slow, maybe better to just assign?\n // Browsers optimize redundant assignment, but string conversion has cost.\n // Let's trust browser for simple properties, but we handle logic.\n if (value === undefined) {\n if ((style as any)[prop] !== '') (style as any)[prop] = '';\n } else {\n if ((style as any)[prop] !== value) (style as any)[prop] = value;\n }\n };\n\n // Layout\n if (oldProps.width !== newProps.width) update('width', newProps.width !== undefined ? px(newProps.width) : undefined);\n if (oldProps.height !== newProps.height) update('height', newProps.height !== undefined ? px(newProps.height) : undefined);\n\n // Flexbox setup (display: flex)\n const type = element.getAttribute('data-flexium-type');\n const needsFlex = (\n newProps.flexDirection || newProps.justifyContent || newProps.alignItems || \n newProps.flexWrap || newProps.gap !== undefined || newProps.justify || newProps.align ||\n type === 'Row' || type === 'Column' || type === 'Stack'\n );\n\n if (needsFlex) {\n if (style.display !== 'flex') style.display = 'flex';\n \n if (type === 'Row' && style.flexDirection !== 'row') style.flexDirection = 'row';\n if (type === 'Column' && style.flexDirection !== 'column') style.flexDirection = 'column';\n }\n\n // Flex properties\n if (oldProps.flexDirection !== newProps.flexDirection) update('flexDirection', newProps.flexDirection);\n if (oldProps.justifyContent !== newProps.justifyContent) update('justifyContent', newProps.justifyContent);\n if (oldProps.alignItems !== newProps.alignItems) update('alignItems', newProps.alignItems);\n if (oldProps.alignSelf !== newProps.alignSelf) update('alignSelf', newProps.alignSelf);\n if (oldProps.flexWrap !== newProps.flexWrap) update('flexWrap', newProps.flexWrap);\n if (oldProps.flex !== newProps.flex) update('flex', newProps.flex !== undefined ? String(newProps.flex) : undefined);\n if (oldProps.gap !== newProps.gap) update('gap', newProps.gap !== undefined ? px(newProps.gap) : undefined);\n\n // Shorthands\n if (oldProps.justify !== newProps.justify) update('justifyContent', newProps.justify);\n if (oldProps.align !== newProps.align) update('alignItems', newProps.align);\n\n // Visual\n if (oldProps.bg !== newProps.bg) update('backgroundColor', newProps.bg);\n if (oldProps.color !== newProps.color) update('color', newProps.color);\n if (oldProps.borderRadius !== newProps.borderRadius) update('borderRadius', newProps.borderRadius !== undefined ? px(newProps.borderRadius) : undefined);\n if (oldProps.borderWidth !== newProps.borderWidth) {\n update('borderWidth', newProps.borderWidth !== undefined ? px(newProps.borderWidth) : undefined);\n if (newProps.borderWidth !== undefined && style.borderStyle !== 'solid') style.borderStyle = 'solid';\n }\n if (oldProps.borderColor !== newProps.borderColor) update('borderColor', newProps.borderColor);\n if (oldProps.opacity !== newProps.opacity) update('opacity', newProps.opacity !== undefined ? String(newProps.opacity) : undefined);\n\n // Typography\n if (oldProps.fontSize !== newProps.fontSize) update('fontSize', newProps.fontSize !== undefined ? px(newProps.fontSize) : undefined);\n if (oldProps.fontWeight !== newProps.fontWeight) update('fontWeight', newProps.fontWeight !== undefined ? String(newProps.fontWeight) : undefined);\n if (oldProps.fontFamily !== newProps.fontFamily) update('fontFamily', newProps.fontFamily);\n if (oldProps.lineHeight !== newProps.lineHeight) update('lineHeight', newProps.lineHeight !== undefined ? String(newProps.lineHeight) : undefined);\n if (oldProps.textAlign !== newProps.textAlign) update('textAlign', newProps.textAlign);\n \n // Padding/Margin\n // Optimization: Check general first\n if (oldProps.padding !== newProps.padding) update('padding', newProps.padding !== undefined ? px(newProps.padding) : undefined);\n if (oldProps.paddingTop !== newProps.paddingTop) update('paddingTop', newProps.paddingTop !== undefined ? px(newProps.paddingTop) : undefined);\n if (oldProps.paddingRight !== newProps.paddingRight) update('paddingRight', newProps.paddingRight !== undefined ? px(newProps.paddingRight) : undefined);\n if (oldProps.paddingBottom !== newProps.paddingBottom) update('paddingBottom', newProps.paddingBottom !== undefined ? px(newProps.paddingBottom) : undefined);\n if (oldProps.paddingLeft !== newProps.paddingLeft) update('paddingLeft', newProps.paddingLeft !== undefined ? px(newProps.paddingLeft) : undefined);\n\n if (oldProps.margin !== newProps.margin) update('margin', newProps.margin !== undefined ? px(newProps.margin) : undefined);\n if (oldProps.marginTop !== newProps.marginTop) update('marginTop', newProps.marginTop !== undefined ? px(newProps.marginTop) : undefined);\n if (oldProps.marginRight !== newProps.marginRight) update('marginRight', newProps.marginRight !== undefined ? px(newProps.marginRight) : undefined);\n if (oldProps.marginBottom !== newProps.marginBottom) update('marginBottom', newProps.marginBottom !== undefined ? px(newProps.marginBottom) : undefined);\n if (oldProps.marginLeft !== newProps.marginLeft) update('marginLeft', newProps.marginLeft !== undefined ? px(newProps.marginLeft) : undefined);\n}\n\n/**\n * Normalize className prop (supports string, array, object)\n */\nfunction normalizeClass(value: any): string {\n if (typeof value === 'string') return value;\n if (Array.isArray(value)) {\n return value.map(normalizeClass).filter(Boolean).join(' ');\n }\n if (typeof value === 'object' && value !== null) {\n return Object.keys(value).filter(k => value[k]).join(' ');\n }\n return '';\n}\n\n/**\n * DOM Renderer implementation\n */\nexport class DOMRenderer implements Renderer {\n createNode(type: string, props: Record<string, any>): HTMLElement {\n // Map component type to HTML element\n const tagName = ELEMENT_MAPPING[type] || type;\n const element = document.createElement(tagName);\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,\n oldProps: Record<string, any>,\n newProps: Record<string, any>\n ): void {\n // 1. Handle className\n if (newProps.className !== oldProps.className) {\n node.className = normalizeClass(newProps.className);\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 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 for (const key in newProps) {\n const newVal = newProps[key];\n const oldVal = oldProps[key];\n\n if (newVal === oldVal) continue;\n\n if (key.startsWith('on')) {\n const eventName = EVENT_MAPPING[key] || key.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(key)) {\n if (newVal === null || newVal === undefined || newVal === false) {\n node.removeAttribute(key);\n } else if (newVal === true) {\n node.setAttribute(key, '');\n } else {\n node.setAttribute(key, 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 { VNode } from '../../core/renderer';\nimport { domRenderer } from './index';\nimport { mountReactive, cleanupReactive } from './reactive';\n\n/**\n * Reconcile two arrays of VNodes using keyed diffing.\n * This implementation handles both DOM reordering (moves) and updates (patches).\n * \n * @param parent The parent DOM node\n * @param oldVNodes The array of old VNodes (with attached DOM nodes)\n * @param newVNodes The array of new VNodes\n * @param nextSibling The node to insert before (for the end of the list)\n */\nexport function reconcileArrays(\n parent: Node,\n oldVNodes: VNode[],\n newVNodes: VNode[],\n nextSibling: Node | null\n): void {\n let oldStartIdx = 0;\n let oldEndIdx = oldVNodes.length - 1;\n let newStartIdx = 0;\n let newEndIdx = newVNodes.length - 1;\n\n let oldStartVNode = oldVNodes[0];\n let oldEndVNode = oldVNodes[oldEndIdx];\n let newStartVNode = newVNodes[0];\n let newEndVNode = newVNodes[newEndIdx];\n\n let oldKeyToIdx: Map<string | number, number> | undefined;\n\n // While both lists have unvisited nodes\n while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {\n // Skip nulls in old list (from previous moves)\n if (oldStartVNode == null) {\n oldStartVNode = oldVNodes[++oldStartIdx];\n } else if (oldEndVNode == null) {\n oldEndVNode = oldVNodes[--oldEndIdx];\n } \n \n // 1. Same Start: Key matches at the beginning\n else if (isSameKey(oldStartVNode, newStartVNode)) {\n patchNode(oldStartVNode, newStartVNode);\n \n oldStartVNode = oldVNodes[++oldStartIdx];\n newStartVNode = newVNodes[++newStartIdx];\n }\n\n // 2. Same End: Key matches at the end\n else if (isSameKey(oldEndVNode, newEndVNode)) {\n patchNode(oldEndVNode, newEndVNode);\n \n oldEndVNode = oldVNodes[--oldEndIdx];\n newEndVNode = newVNodes[--newEndIdx];\n }\n\n // 3. Reversed: Old Start matches New End (Move Right)\n else if (isSameKey(oldStartVNode, newEndVNode)) {\n patchNode(oldStartVNode, newEndVNode);\n // Move the old start node to AFTER the old end node\n domRenderer.insertBefore(parent, oldStartVNode._node!, domRenderer.nextSibling(oldEndVNode._node!));\n \n oldStartVNode = oldVNodes[++oldStartIdx];\n newEndVNode = newVNodes[--newEndIdx];\n }\n\n // 4. Reversed: Old End matches New Start (Move Left)\n else if (isSameKey(oldEndVNode, newStartVNode)) {\n patchNode(oldEndVNode, newStartVNode);\n // Move the old end node to BEFORE the old start node\n domRenderer.insertBefore(parent, oldEndVNode._node!, oldStartVNode._node!);\n \n oldEndVNode = oldVNodes[--oldEndIdx];\n newStartVNode = newVNodes[++newStartIdx];\n }\n\n // 5. Keyed Mode: Search in map\n else {\n if (!oldKeyToIdx) {\n oldKeyToIdx = createKeyMap(oldVNodes, oldStartIdx, oldEndIdx);\n }\n\n const key = newStartVNode.key;\n const idxInOld = key != null ? oldKeyToIdx.get(key) : undefined;\n\n if (idxInOld === undefined) {\n // New node: Create and insert\n const newNode = mountReactive(newStartVNode, undefined); // Don't append yet\n if (newNode) {\n newStartVNode._node = newNode;\n domRenderer.insertBefore(parent, newNode, oldStartVNode._node!);\n }\n } else {\n // Node exists: Move and Patch\n const vnodeToMove = oldVNodes[idxInOld];\n patchNode(vnodeToMove, newStartVNode);\n \n // Mark as processed in old list\n oldVNodes[idxInOld] = undefined as any; \n \n domRenderer.insertBefore(parent, vnodeToMove._node!, oldStartVNode._node!);\n }\n \n newStartVNode = newVNodes[++newStartIdx];\n }\n }\n\n // Add remaining new nodes\n if (oldStartIdx > oldEndIdx) {\n const before = newVNodes[newEndIdx + 1] == null ? nextSibling : newVNodes[newEndIdx + 1]._node;\n for (let i = newStartIdx; i <= newEndIdx; i++) {\n const newNode = mountReactive(newVNodes[i], undefined);\n if (newNode) {\n newVNodes[i]._node = newNode;\n domRenderer.insertBefore(parent, newNode, before!);\n }\n }\n }\n\n // Remove remaining old nodes\n else if (newStartIdx > newEndIdx) {\n for (let i = oldStartIdx; i <= oldEndIdx; i++) {\n const nodeToRemove = oldVNodes[i];\n if (nodeToRemove && nodeToRemove._node) {\n cleanupReactive(nodeToRemove._node);\n domRenderer.removeChild(parent, nodeToRemove._node);\n }\n }\n }\n}\n\nfunction isSameKey(n1: VNode, n2: VNode): boolean {\n return n1.key === n2.key && n1.type === n2.type;\n}\n\nfunction createKeyMap(children: VNode[], start: number, end: number): Map<string | number, number> {\n const map = new Map<string | number, number>();\n for (let i = start; i <= end; i++) {\n const key = children[i].key;\n if (key != null) {\n map.set(key, i);\n }\n }\n return map;\n}\n\n/**\n * Patch an existing VNode with new props and children\n */\nfunction patchNode(oldVNode: VNode, newVNode: VNode) {\n const node = oldVNode._node as HTMLElement;\n if (!node) return;\n\n // Transfer DOM reference\n newVNode._node = node;\n\n // 1. Element Node: Update props and children\n if (typeof newVNode.type === 'string') {\n // Update props\n domRenderer.updateNode(node, oldVNode.props, newVNode.props);\n \n // Update children\n const oldChildren = oldVNode.children || [];\n const newChildren = newVNode.children || [];\n \n if (oldChildren.length > 0 || newChildren.length > 0) {\n // If children are text content, updateNode handles it if implemented, \n // but typically children array contains VNodes or primitives.\n // mountReactive normalizes text to Text Nodes, but VNode structure might have raw strings.\n \n // Ideally we should normalize children before reconcile.\n // For now, let's assume children are VNodes or compatible.\n // If children are purely text strings, reconcileArrays might fail if not VNodes.\n \n // Simple check: if both are single text/number child, update text content directly\n if (newChildren.length === 1 && \n (typeof newChildren[0] === 'string' || typeof newChildren[0] === 'number') &&\n node.firstChild && node.firstChild.nodeType === Node.TEXT_NODE && \n node.childNodes.length === 1) {\n \n if (String(oldChildren[0]) !== String(newChildren[0])) {\n domRenderer.updateTextNode(node.firstChild as Text, String(newChildren[0]));\n }\n return;\n }\n\n reconcileArrays(node, oldChildren as VNode[], newChildren as VNode[], null);\n }\n } \n \n // 2. Component Node: Can't easily patch without instance state.\n // In the current architecture, components are executed in mountReactive and return a DOM node.\n // We don't store the component \"instance\" or \"update\" function.\n // So we can't update the component with new props.\n // \n // Fallback: If it's a component, we assume it's handled by internal reactivity if props are signals.\n // If props are raw values and changed, we unfortunately can't update it without remounting.\n // \n // BUT, for the specific case of the benchmark where Row returns a 'div',\n // the reconcileArrays is called on the children of 'App'.\n // 'App' renders: [ { type: Row }, { type: Row } ... ]\n // reconcileArrays sees VNodes with type=Row.\n // It calls patchNode(RowVNode, RowVNode).\n // \n // Here we are stuck. We can't patch 'Row' because we don't have the 'div' VNode it returned.\n // The 'div' VNode was created inside mountReactive -> effect -> component().\n //\n // To support VDOM-style component updates, we would need to change VNode structure to store instance/cleanup.\n //\n // However, if the benchmark used h('div') directly instead of h(Row), it would work with the logic above.\n //\n // Optimization for Benchmark:\n // Since we can't patch components properly yet, let's leave it as no-op for components.\n // Users should use Signals for updates inside components.\n // Or use Element VNodes directly in lists for VDOM-style diffing support.\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 { VNode } from '../../core/renderer';\nimport { effect, batch, isSignal } from '../../core/signal';\nimport type { Signal, Computed } from '../../core/signal';\nimport { domRenderer } from './index';\nimport { isVNode } from './h';\nimport { pushProvider, popProvider, useContext } from '../../core/context';\nimport { reconcileArrays } from './reconcile';\nimport { SuspenseCtx } from '../../core/suspense';\n\n/**\n * Track reactive bindings for cleanup\n */\nconst REACTIVE_BINDINGS = new WeakMap<Node, Set<() => void>>();\n\n/**\n * Mount a virtual node with reactive tracking\n *\n * This function creates DOM nodes and automatically sets up reactive effects\n * for any signal dependencies in props or children.\n */\nexport function mountReactive(\n vnode: VNode | string | number | Signal<any> | Computed<any> | null | undefined |