flexium 0.10.4 → 0.10.7
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 +5 -5
- package/dist/{DrawText-ngwNNh8O.d.ts → DrawText-CVAKQ5wZ.d.cts} +42 -42
- package/dist/{DrawText-ccZrs3Xs.d.cts → DrawText-Dlh1L1Ar.d.ts} +42 -42
- 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 +5 -6
- package/dist/canvas.d.ts +5 -6
- package/dist/canvas.js +1 -1
- package/dist/canvas.mjs +1 -1
- package/dist/chunk-5ICRQIS2.js +3 -0
- package/dist/chunk-5ICRQIS2.js.map +1 -0
- package/dist/chunk-5K55ASOD.mjs +3 -0
- package/dist/chunk-5K55ASOD.mjs.map +1 -0
- package/dist/chunk-AZEHBSBG.js +3 -0
- package/dist/chunk-AZEHBSBG.js.map +1 -0
- package/dist/chunk-BBNYMXE7.mjs +2 -0
- package/dist/chunk-BBNYMXE7.mjs.map +1 -0
- package/dist/{chunk-WXEHDEIH.js → chunk-DZ7L3SHV.js} +2 -2
- package/dist/{chunk-WXEHDEIH.js.map → chunk-DZ7L3SHV.js.map} +1 -1
- package/dist/chunk-ECYYIQEX.mjs +3 -0
- package/dist/chunk-ECYYIQEX.mjs.map +1 -0
- package/dist/chunk-FDMJHFN7.mjs +2 -0
- package/dist/chunk-FDMJHFN7.mjs.map +1 -0
- package/dist/chunk-GKJQEOP7.mjs +2 -0
- package/dist/{chunk-PVPY55Z7.mjs.map → chunk-GKJQEOP7.mjs.map} +1 -1
- package/dist/chunk-GYDP6MFV.js +3 -0
- package/dist/chunk-GYDP6MFV.js.map +1 -0
- package/dist/chunk-HB5VPQTB.mjs +2 -0
- package/dist/chunk-HB5VPQTB.mjs.map +1 -0
- package/dist/chunk-OPAAGNBO.mjs +2 -0
- package/dist/{chunk-HLPVL6EK.mjs.map → chunk-OPAAGNBO.mjs.map} +1 -1
- package/dist/chunk-QPCIDSMM.js +2 -0
- package/dist/chunk-QPCIDSMM.js.map +1 -0
- package/dist/chunk-QZIX4FXS.mjs +2 -0
- package/dist/chunk-QZIX4FXS.mjs.map +1 -0
- package/dist/{chunk-63AW5ZOC.js → chunk-RMN5IPS5.js} +2 -2
- package/dist/{chunk-63AW5ZOC.js.map → chunk-RMN5IPS5.js.map} +1 -1
- package/dist/chunk-WWEWRI6S.js +2 -0
- package/dist/chunk-WWEWRI6S.js.map +1 -0
- package/dist/chunk-XJHWMHKF.js +2 -0
- package/dist/chunk-XJHWMHKF.js.map +1 -0
- package/dist/chunk-Y6KKAHLS.mjs +3 -0
- package/dist/chunk-Y6KKAHLS.mjs.map +1 -0
- package/dist/chunk-YPVRQKMW.js +2 -0
- package/dist/chunk-YPVRQKMW.js.map +1 -0
- package/dist/{components-CxnAnbpI.d.cts → components-BMbqsbMY.d.cts} +5 -5
- package/dist/{components-B7KQ8C-i.d.ts → components-C83mBQXW.d.ts} +5 -5
- package/dist/{effect-14CxUU8r.d.ts → core-CxHP8991.d.cts} +9 -1
- package/dist/{effect-14CxUU8r.d.cts → core-D0ggvjX3.d.ts} +9 -1
- package/dist/core.d.cts +2 -80
- package/dist/core.d.ts +2 -80
- 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-554ONNZR.js +2 -0
- package/dist/{effect-K45UU3N4.js.map → effect-554ONNZR.js.map} +1 -1
- package/dist/effect-T2GVIS3T.mjs +2 -0
- package/dist/{effect-3LUCHSAZ.mjs.map → effect-T2GVIS3T.mjs.map} +1 -1
- 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 +5 -5
- package/dist/interactive.d.ts +5 -5
- 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-NLlE-fNZ.d.cts → portal-BK_0Z0hE.d.cts} +2 -2
- package/dist/{portal-CVqrpmHd.d.ts → portal-CbguxtuQ.d.ts} +2 -2
- 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 -5
- package/dist/primitives.d.ts +4 -5
- 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/state-DitsMyev.d.cts +96 -0
- package/dist/state-DitsMyev.d.ts +96 -0
- package/dist/state-RYKSC35A.mjs +2 -0
- package/dist/state-RYKSC35A.mjs.map +1 -0
- package/dist/state-XUXPMCFJ.js +2 -0
- package/dist/state-XUXPMCFJ.js.map +1 -0
- package/dist/test-exports.d.cts +37 -7
- package/dist/test-exports.d.ts +37 -7
- package/dist/test-exports.js +1 -1
- package/dist/test-exports.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-3AWR7IKE.js +0 -2
- package/dist/chunk-3AWR7IKE.js.map +0 -1
- package/dist/chunk-3BQXIHYI.mjs +0 -3
- package/dist/chunk-3BQXIHYI.mjs.map +0 -1
- package/dist/chunk-5236IK5I.js +0 -2
- package/dist/chunk-5236IK5I.js.map +0 -1
- package/dist/chunk-6K44QCMT.mjs +0 -3
- package/dist/chunk-6K44QCMT.mjs.map +0 -1
- package/dist/chunk-7Q4UE442.mjs +0 -2
- package/dist/chunk-7Q4UE442.mjs.map +0 -1
- package/dist/chunk-AJT35P3Z.js +0 -3
- package/dist/chunk-AJT35P3Z.js.map +0 -1
- package/dist/chunk-AYQMU7XC.js +0 -3
- package/dist/chunk-AYQMU7XC.js.map +0 -1
- package/dist/chunk-B7VP6HBY.mjs +0 -2
- package/dist/chunk-B7VP6HBY.mjs.map +0 -1
- package/dist/chunk-HLPVL6EK.mjs +0 -2
- package/dist/chunk-KJPIJNFH.mjs +0 -2
- package/dist/chunk-KJPIJNFH.mjs.map +0 -1
- package/dist/chunk-PVPY55Z7.mjs +0 -2
- package/dist/chunk-Q7WT5IIF.mjs +0 -3
- package/dist/chunk-Q7WT5IIF.mjs.map +0 -1
- package/dist/chunk-S3EDPCYT.js +0 -3
- package/dist/chunk-S3EDPCYT.js.map +0 -1
- package/dist/chunk-WOHSSPKD.js +0 -2
- package/dist/chunk-WOHSSPKD.js.map +0 -1
- package/dist/effect-3LUCHSAZ.mjs +0 -2
- package/dist/effect-K45UU3N4.js +0 -2
- package/dist/signal-2QUI7H7B.js +0 -2
- package/dist/signal-2QUI7H7B.js.map +0 -1
- package/dist/signal-C6936A3J.d.cts +0 -175
- package/dist/signal-C6936A3J.d.ts +0 -175
- package/dist/signal-L3ZWGOVT.mjs +0 -2
- package/dist/signal-L3ZWGOVT.mjs.map +0 -1
|
@@ -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","SignalNode","vnode","entry","height","width","itemSize","onScroll","onVisibleRangeChange","innerContainer","scrollTopSig","prevStartIndex","prevEndIndex","handleScroll","currentScrollTop","startIndex","endIndex","visibleKeys","rowState","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":"qPAIA,IAAMA,EAAAA,CAAkB,IAAI,GAAA,CAGtBC,EAAAA,CAAsB,IAAI,GAAA,CAAI,CAClC,OAAA,CACA,MAAA,CACA,YAAA,CACA,YAAA,CACA,MAAA,CACA,QAAA,CACA,QACF,CAAC,CAAA,CAIKC,CAAAA,CAAe,IAAI,OAAA,CAKzB,SAASC,EAAAA,CAAcC,CAAAA,CAAc,CAEnC,IAAMC,CAAAA,CAAYD,CAAAA,CAAM,IAAA,CAAK,WAAA,GACvBE,CAAAA,CAAU,CAACL,EAAAA,CAAoB,GAAA,CAAII,CAAS,CAAA,CAI5CE,CAAAA,CAAOH,CAAAA,CAAM,YAAA,IAAe,EAAK,EAAC,CACpCI,CAAAA,CAAuBJ,CAAAA,CAAM,MAAA,CAEjC,GAAIG,CAAAA,CAAK,MAAA,GAAW,CAAA,EAAKC,CAAAA,CAEvB,KAAOA,CAAAA,EACLD,CAAAA,CAAK,IAAA,CAAKC,CAAO,CAAA,CACjBA,CAAAA,CAAUA,CAAAA,CAAQ,UAAA,CAItB,IAAA,IAAWC,CAAAA,IAAQF,CAAAA,CAAM,CACvB,IAAMG,CAAAA,CAAaD,CAAAA,CAEnB,GAAIC,CAAAA,GAAe,QAAA,EAAY,CAACA,CAAAA,CAAY,MAE5C,IAAMC,CAAAA,CAAWT,CAAAA,CAAa,GAAA,CAAIQ,CAAU,CAAA,CAC5C,GAAIC,CAAAA,EAAU,GA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cesContent":["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\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 { SignalNode } from '../../core/signal'\nimport { effect } from '../../core/effect'\nimport type { FNode } from '../../core/renderer'\nimport type {\n ListProps,\n ListComponent,\n ListCacheEntry,\n SizeConfig,\n} from './types'\n// import { SignalNode, effect } from '../../core/signal' -- Already imported at top\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 = new SignalNode(index)\n const vnode = renderItem(item, () => indexSig.get())\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 // Reactive state\n const scrollTopSig = new SignalNode(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 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.get()\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 // Use cache or create new row state\n let rowState = cache.get(key)?.state\n if (!rowState) {\n rowState = new SignalNode(item)\n } else {\n rowState.set(item)\n }\n\n if (!entry) {\n // Create new item\n const indexSig = new SignalNode(i)\n const vnode = renderItem(item, () => indexSig.get())\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 { isSignal, onCleanup } from '../../core/signal'\nimport { effect } from '../../core/effect'\nimport { root } from '../../core/owner'\nimport type { SignalNode, ComputedNode } 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 | SignalNode<any>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | ComputedNode<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.get()\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 SignalNode<any>).get() : (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.get()\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-7Q4UE442.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {h as h$1,e,d as d$1}from'./chunk-B7VP6HBY.mjs';var S=Symbol.for("flexium.stateSignal"),O=new WeakMap,F=new WeakMap,A=new WeakMap;function l(t,e,n){let s=O.get(t);s||(s=new Map,O.set(t,s));let o=s.get(e);if(!o){let a=n!==void 0?n:Reflect.get(t,e);o=new d$1(a),s.set(e,o);}return o}var Q={get(t,e){let n=A.get(t);if(e===S)return n;let s=F.get(n);if(s&&V(s),e==="peek")return n.peek.bind(n);let o=typeof n.peek=="function"&&typeof n.get=="function",a;if(o||l(n,"value"),a=n.get(),e===Symbol.toPrimitive||e==="valueOf")return ()=>a;if(e===Symbol.iterator)return l(a,"length").get(),l(a,"iterate").get(),a[Symbol.iterator].bind(a);if(a!==null&&typeof a=="object"){let c=Reflect.get(a,e);return typeof c=="function"?Array.isArray(a)&&["push","pop","shift","unshift","splice","sort","reverse"].includes(e)?function(...p){let x=c.apply(a,p);return a===n.get()&&l(n,"value").set(a),l(a,"length").set(a.length),a===n.get()&&l(n,"value").get(),x}:Array.isArray(a)?c.bind(a):a[e].bind(a):(l(a,e,c).get(),c!==null&&typeof c=="object"?H(c):c)}let u=a[e];return typeof u=="function"?u.bind(a):u},set(t,e,n){let o=A.get(t).get();if(o!==null&&typeof o=="object"){let a=Reflect.set(o,e,n);return l(o,e).set(n),a}return false},has(t,e){let n=A.get(t);if(e===S)return true;let s=n.get();return s===null?false:typeof s=="object"?Reflect.has(s,e):false},ownKeys(t){let n=A.get(t).get();return n===null||typeof n!="object"?Reflect.ownKeys(t):(Array.isArray(n)&&l(n,"length").get(),l(n,"iterate").get(),Reflect.ownKeys(n))},getOwnPropertyDescriptor(t,e){let n=A.get(t);if(e===S)return {configurable:true,enumerable:false,value:n};let s=n.get();if(s===null||typeof s!="object")return;let o=Reflect.getOwnPropertyDescriptor(s,e);return o&&(o.configurable=true),o}},U={get(t,e,n){if(e===S)return t;let s=Reflect.get(t,e,n);return l(t,e,s).get(),s!==null&&typeof s=="object"?H(s):s},set(t,e,n,s){let o=Reflect.set(t,e,n,s);return o&&l(t,e).set(n),o},has(t,e){return e===S?true:Reflect.has(t,e)}},z=new WeakMap;function H(t){let e=z.get(t);return e||(e=new Proxy(t,U),z.set(t,e)),e}var D=new WeakMap;function N(t){let e=D.get(t);if(e)return e;let n=()=>t.get();return A.set(n,t),e=new Proxy(n,Q),D.set(t,e),e}var T=null;function te(t){T=t;}function ne(){return {id:Symbol("component"),hookIndex:0,hooks:[]}}function se(t){t.hookIndex=0;}var g=new Map,h=new Map,y=new Map,m={enabled:true,maxIdleTime:300*1e3,checkInterval:60*1e3,minAccessCount:0},d=null;(typeof window<"u"||typeof globalThis<"u")&&setTimeout(()=>{m.enabled&&!d&&(d=setInterval(L,m.checkInterval),d&&typeof d=="object"&&"unref"in d&&typeof d.unref=="function"&&d.unref());},0);var X=1e4,j=false,B=new WeakMap;function v(t){if(typeof t=="string")return t;let e=B.get(t);if(e!==void 0)return e;try{let n=JSON.stringify(t);return B.set(t,n),n}catch{return String(t)}}function E(t,e){e&&(h.has(e)||h.set(e,new Set),h.get(e).add(t));}function _(t,e){if(!e)return;let n=h.get(e);n&&(n.delete(t),n.size===0&&h.delete(e));}function V(t,e,n){let s=Date.now(),o=y.get(t);o?(o.lastAccessed=s,o.accessCount++,o.referenceCount++,e&&o.namespace!==e&&(o.namespace&&_(t,o.namespace),o.namespace=e,E(t,e))):(y.set(t,{key:t,namespace:e,createdAt:s,lastAccessed:s,accessCount:1,referenceCount:1,signalRef:n&&typeof WeakRef<"u"?new WeakRef(n):void 0}),E(t,e));}function L(){if(!m.enabled)return;let t=Date.now(),e=[];for(let[n,s]of y.entries()){if(s.signalRef&&typeof WeakRef<"u"&&!s.signalRef.deref()){e.push(n);continue}t-s.lastAccessed>m.maxIdleTime&&s.referenceCount===0&&s.accessCount>=m.minAccessCount&&e.push(n);}for(let n of e)f.delete(n);e.length>0&&typeof process<"u"&&process.env?.NODE_ENV!=="production"&&console.log(`[Flexium] Auto-cleaned ${e.length} idle states`);}function K(t){return (typeof t=="object"||typeof t=="function")&&t!==null&&S in t}function oe(t){return K(t)?t[S]:null}function ae(t,e){return K(t)?t.peek()===e:false}function re(t){return K(t)?!!t.peek():false}function Y(t,e$1){if(T&&!e$1?.key){let r=T,i=r.hookIndex++;if(i<r.hooks.length)return r.hooks[i];let w=T;T=null;let I=f(t,e$1);return T=w,r.hooks.push(I),I}let n=e$1?.key,s=n?v(n):void 0,o=Array.isArray(n)&&n.length>0?String(n[0]):void 0,a=e$1?.params;if(s&&g.has(s)){let r=g.get(s);V(s,o,r.box);let i=[r.proxy];return r.setter&&i.push(r.setter),r.refetch&&i.push(r.refetch),r.status&&i.push(r.status),r.error&&i.push(r.error),i}let u,c,p,x,C;if(typeof t=="function"){let r=t,i=a!==void 0?()=>r(a):r,w;try{w=i();}catch{}if(r.constructor.name==="AsyncFunction"||w instanceof Promise){let[b,G]=h$1(i,async J=>J);u={get:()=>b.value,peek:()=>b.peek()},p=G.refetch;let $=new e(()=>b.loading?"loading":b.error?"error":b.state==="unresolved"?"idle":"success");x=N($);let q=new e(()=>b.error);C=N(q);}else u=new e(i);}else {let r=new d$1(t);u=r,c=i=>{typeof i=="function"?r.set(i(r.peek())):r.set(i);};}let M=N(u),k=[M];return c&&k.push(c),p&&(k.splice(1,0,p),x&&k.push(x),C&&k.push(C)),s&&(g.set(s,{box:u,proxy:M,setter:c,refetch:p,status:x,error:C,createdAt:Date.now(),lastAccessed:Date.now(),accessCount:1,referenceCount:1,key:s,namespace:o}),F.set(u,s),V(s,o,u),typeof process<"u"&&process.env?.NODE_ENV!=="production"&&!j&&g.size>=X&&(j=true,console.warn(`[Flexium] Registry size warning: ${g.size}`))),k}var f=Y;f.delete=function(t){let e=v(t),n=y.get(e);return n?.namespace&&_(e,n.namespace),y.delete(e),g.delete(e)};f.clear=function(){g.clear(),h.clear(),y.clear(),j=false;};f.has=function(t){return g.has(v(t))};f.clearByPrefix=function(t){let e=v(t),n=0,s=[];for(let[o]of y.entries()){if(o===e){s.push(o);continue}if(e.endsWith("]")){let a=e.slice(0,-1);o.startsWith(a)&&o.length>a.length&&o[a.length]===","&&s.push(o);}else o.startsWith(e)&&s.push(o);}for(let o of s)f.delete(o)&&n++;return n};f.getStats=function(){let t={};for(let[n,s]of h.entries())t[n]=s.size;let e=0;for(let n of y.values())e+=n.accessCount;return {total:g.size,byNamespace:t,topNamespaces:Object.entries(t).map(([n,s])=>({namespace:n,count:s})).sort((n,s)=>s.count-n.count).slice(0,10),averageAccessCount:y.size?e/y.size:0}};f.getNamespaceStats=function(t){let e=v(t),n=Array.isArray(t)&&t.length>0?String(t[0]):e,s=[],o=0;for(let[a,u]of y.entries()){let c=false;if(a===e)c=true;else if(e.endsWith("]")){let p=e.slice(0,-1);a.startsWith(p)&&a.length>p.length&&a[p.length]===","&&(c=true);}else a.startsWith(e)&&(c=true);c&&(s.push({key:a,accessCount:u.accessCount,createdAt:u.createdAt}),o+=u.accessCount);}return {namespace:n,count:s.length,totalAccessCount:o,averageAccessCount:s.length?o/s.length:0,states:s}};Object.defineProperty(f,"size",{get:()=>g.size,enumerable:true});f.enableAutoCleanup=t=>{Object.assign(m,t,{enabled:true}),d&&clearInterval(d),d=setInterval(L,m.checkInterval);};f.disableAutoCleanup=()=>{m.enabled=false,d&&clearInterval(d);};Object.defineProperty(f,"isAutoCleanupEnabled",{get:()=>m.enabled,enumerable:true});function ce(t){return {current:t}}export{te as a,ne as b,se as c,K as d,oe as e,ae as f,re as g,f as h,ce as i};//# sourceMappingURL=chunk-7Q4UE442.mjs.map
|
|
2
|
-
//# sourceMappingURL=chunk-7Q4UE442.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/state.ts"],"names":["STATE_SIGNAL","depMap","boxToKeyMap","targetBoxMap","getDep","target","key","initialValue","deps","dep","currentVal","SignalNode","hybridHandlers","prop","box","updateStateMetadata","isSignalLike","innerValue","val","args","result","createNestedProxy","newValue","success","desc","nestedHandlers","receiver","nestedProxyCache","proxy","proxyCache","createHybridProxy","currentComponent","setCurrentComponent","instance","createComponentInstance","resetHookIndex","globalStateRegistry","namespaceRegistry","stateMetadata","autoCleanupConfig","autoCleanupInterval","performAutoCleanup","DEV_WARNING_THRESHOLD","hasWarnedAboutSize","keyCache","serializeKey","cached","serialized","registerStateInNamespace","namespace","unregisterStateFromNamespace","set","signalRefTarget","now","existing","keysToRemove","metadata","state","isStateValue","value","getStateSignal","stateValue","equals","isTruthy","stateImplementation","initialValueOrFetcher","options","comp","hookIndex","saved","res","rawKey","params","entry","setter","refetch","statusProxy","errorProxy","originalFn","fn","testResult","actions","createResource","v","statusComp","ComputedNode","errorComp","node","sKey","meta","prefix","prefixStr","cleared","keysToDelete","raw","k","byNamespace","ns","keys","totalAccess","m","c","a","b","pStr","states","matched","ref","initial"],"mappings":"uDAKO,IAAMA,CAAAA,CAAe,MAAA,CAAO,GAAA,CAAI,qBAAqB,CAAA,CAwBtDC,EAAS,IAAI,OAAA,CACbC,CAAAA,CAAc,IAAI,OAAA,CAClBC,CAAAA,CAAe,IAAI,OAAA,CAEzB,SAASC,CAAAA,CAAOC,CAAAA,CAAgBC,CAAAA,CAAsBC,CAAAA,CAA6C,CACjG,IAAIC,CAAAA,CAAOP,CAAAA,CAAO,GAAA,CAAII,CAAM,CAAA,CACvBG,IACHA,CAAAA,CAAO,IAAI,GAAA,CACXP,CAAAA,CAAO,GAAA,CAAII,CAAAA,CAAQG,CAAI,CAAA,CAAA,CAEzB,IAAIC,CAAAA,CAAMD,CAAAA,CAAK,GAAA,CAAIF,CAAG,EACtB,GAAI,CAACG,CA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xG,SAASoE,EAAAA,CAAOC,CAAAA,CAAiC,CAAE,OAAO,CAAE,OAAA,CAASA,CAAQ,CAAE","file":"chunk-7Q4UE442.mjs","sourcesContent":["import { SignalNode, ComputedNode, createResource } from './signal'\n\n\n\n/** Symbol to identify StateProxy and access underlying signal */\nexport const STATE_SIGNAL = Symbol.for('flexium.stateSignal')\n\n/**\n * ------------------------------------------------------------------\n * Hybrid Proxy Architecture: Support Types\n * ------------------------------------------------------------------\n */\n\n/**\n * A \"Box\" is any object with a `value` property.\n * It serves as the stable target for our Proxy.\n */\ninterface Box<T> {\n get(): T\n set?(value: T): void\n peek(): T\n}\n\n/**\n * Dependency Map: Stores signals for object properties.\n * Key: Target Object (The inner value, OR the Box itself)\n * Value: Map<PropertyKey, Signal>\n */\n// Need to allow getDep to access SignalNode methods\nconst depMap = new WeakMap<object, Map<string | symbol, SignalNode<unknown>>>()\nconst boxToKeyMap = new WeakMap<object, string>()\nconst targetBoxMap = new WeakMap<object, Box<any>>()\n\nfunction getDep(target: object, key: string | symbol, initialValue?: unknown): SignalNode<unknown> {\n let deps = depMap.get(target)\n if (!deps) {\n deps = new Map()\n depMap.set(target, deps)\n }\n let dep = deps.get(key)\n if (!dep) {\n const currentVal = initialValue !== undefined ? initialValue : Reflect.get(target, key)\n dep = new SignalNode(currentVal)\n deps.set(key, dep)\n }\n return dep\n}\n\n/**\n * ------------------------------------------------------------------\n * Hybrid Proxy Handler\n * ------------------------------------------------------------------\n */\nconst hybridHandlers: ProxyHandler<Box<any>> = {\n get(target, prop) {\n const box = targetBoxMap.get(target)!\n if (prop === STATE_SIGNAL) return box\n\n // Access Tracking\n const key = boxToKeyMap.get(box)\n if (key) updateStateMetadata(key)\n\n if (prop === 'peek') {\n return box.peek.bind(box)\n }\n\n // Reactivity for the Root Value\n // Reactivity for the Root Value\n const isSignalLike = typeof (box as any).peek === 'function' && typeof (box as any).get === 'function'\n let innerValue: any\n\n if (isSignalLike) {\n innerValue = box.get()\n } else {\n getDep(box, 'value') // Should not happen if box is always a Node\n innerValue = box.get()\n }\n\n if (prop === Symbol.toPrimitive || prop === 'valueOf') {\n return () => innerValue\n }\n\n if (prop === Symbol.iterator) {\n // Track iteration\n getDep(innerValue, 'length').get()\n getDep(innerValue, 'iterate').get()\n return (innerValue as any)[Symbol.iterator].bind(innerValue)\n }\n\n // Recursive Forwarding\n if (innerValue !== null && typeof innerValue === 'object') {\n const val = Reflect.get(innerValue, prop)\n\n if (typeof val === 'function') {\n // Special handling for Array mutation methods\n if (Array.isArray(innerValue) && ['push', 'pop', 'shift', 'unshift', 'splice', 'sort', 'reverse'].includes(prop as string)) {\n return function (...args: any[]) {\n const result = (val as Function).apply(innerValue, args)\n // If innerValue is the root value of the box:\n if (innerValue === box.get()) {\n const dep = getDep(box, 'value')\n dep.set(innerValue) // force notify even if value is same object\n }\n\n // Arrays are tricky. We usually subscribe to 'iterate' or 'length'.\n // Notify length\n getDep(innerValue, 'length').set(innerValue.length)\n\n // Also notify 'iterate' key which `ownKeys` uses?\n // Or just force notify 'value' if it's the root.\n if (innerValue === box.get()) {\n getDep(box, 'value').get()\n }\n\n return result\n }\n }\n if (Array.isArray(innerValue)) {\n // Fix for .concat(): Array.prototype.concat treats proxies as objects unless Symbol.isConcatSpreadable is handled,\n // OR we bind to the raw array so it doesn't see the proxy.\n // But binding to 'receiver' (the proxy) is usually correct for other methods.\n // However, for .concat, we likely want the raw array behavior or correct proxy handling.\n // Simple fix: bind to innerValue (raw array) for non-mutating methods too, \n // or at least for concat if it causes issues.\n // .map, .filter etc return new arrays, so binding to innerValue is fine.\n return (val as Function).bind(innerValue)\n }\n return (innerValue as any)[prop].bind(innerValue)\n }\n\n getDep(innerValue, prop, val).get()\n\n if (val !== null && typeof val === 'object') {\n return createNestedProxy(val)\n }\n return val\n }\n\n const val = (innerValue as any)[prop]\n return typeof val === 'function' ? val.bind(innerValue) : val\n },\n\n set(target, prop, newValue) {\n const box = targetBoxMap.get(target)!\n const innerValue = box.get()\n if (innerValue !== null && typeof innerValue === 'object') {\n const success = Reflect.set(innerValue, prop, newValue)\n getDep(innerValue, prop).set(newValue)\n return success\n }\n return false\n },\n\n has(target, prop) {\n const box = targetBoxMap.get(target)!\n if (prop === STATE_SIGNAL) return true\n const innerValue = box.get()\n if (innerValue === null) return false\n if (typeof innerValue === 'object') {\n return Reflect.has(innerValue, prop)\n }\n return false // primitives don't have own properties usually, but 'toFixed' is in proto\n },\n\n ownKeys(target) {\n const box = targetBoxMap.get(target)!\n const innerValue = box.get()\n\n if (innerValue === null || typeof innerValue !== 'object') {\n return Reflect.ownKeys(target)\n }\n\n // Arrays need special handling for iteration\n if (Array.isArray(innerValue)) {\n getDep(innerValue, 'length').get()\n getDep(innerValue, 'iterate').get()\n } else {\n // Objects \n getDep(innerValue, 'iterate').get()\n }\n\n return Reflect.ownKeys(innerValue)\n },\n\n getOwnPropertyDescriptor(target, prop) {\n const box = targetBoxMap.get(target)!\n if (prop === STATE_SIGNAL) {\n return { configurable: true, enumerable: false, value: box }\n }\n const innerValue = box.get()\n\n if (innerValue === null || typeof innerValue !== 'object') {\n return undefined\n }\n\n const desc = Reflect.getOwnPropertyDescriptor(innerValue, prop)\n if (desc) {\n desc.configurable = true\n }\n return desc\n }\n}\n\nconst nestedHandlers: ProxyHandler<object> = {\n get(target, prop, receiver) {\n if (prop === STATE_SIGNAL) return target\n const val = Reflect.get(target, prop, receiver)\n getDep(target, prop, val).get()\n if (val !== null && typeof val === 'object') {\n return createNestedProxy(val)\n }\n return val\n },\n set(target, prop, newValue, receiver) {\n const success = Reflect.set(target, prop, newValue, receiver)\n if (success) {\n getDep(target, prop).set(newValue)\n }\n return success\n },\n has(target, prop) {\n if (prop === STATE_SIGNAL) return true\n return Reflect.has(target, prop)\n }\n}\n\nconst nestedProxyCache = new WeakMap<object, any>()\n\nfunction createNestedProxy<T extends object>(target: T): T {\n let proxy = nestedProxyCache.get(target)\n if (!proxy) {\n proxy = new Proxy(target, nestedHandlers)\n nestedProxyCache.set(target, proxy)\n }\n return proxy\n}\n\n// Cache for Hybrid Proxies (keyed by Box/Signal)\nconst proxyCache = new WeakMap<object, any>()\n\nfunction createHybridProxy<T>(box: Box<T>): StateValue<T> {\n let proxy = proxyCache.get(box)\n if (proxy) return proxy\n\n // The target is a function so that the proxy is callable `state()`, returns value.\n const target = () => box.get()\n targetBoxMap.set(target, box)\n // Object.assign(target, box) // REMOVED: Do not copy properties, prevents stale values\n\n proxy = new Proxy(target as any, hybridHandlers) as StateValue<T>\n proxyCache.set(box, proxy)\n return proxy\n}\n\n/**\n * ------------------------------------------------------------------\n * Component Hook System\n * ------------------------------------------------------------------\n */\ninterface ComponentInstance {\n id: symbol\n hookIndex: number\n hooks: unknown[]\n}\n\nlet currentComponent: ComponentInstance | null = null\n\nexport function setCurrentComponent(instance: ComponentInstance | null): void {\n currentComponent = instance\n}\n\nexport function getCurrentComponent(): ComponentInstance | null {\n return currentComponent\n}\n\nexport function createComponentInstance(): ComponentInstance {\n return {\n id: Symbol('component'),\n hookIndex: 0,\n hooks: [],\n }\n}\n\nexport function resetHookIndex(instance: ComponentInstance): void {\n instance.hookIndex = 0\n}\n\n/**\n * ------------------------------------------------------------------\n * Global State Registry & Metadata\n * ------------------------------------------------------------------\n */\ninterface RegistryEntry {\n box: Box<any>\n proxy: StateValue<any>\n setter: StateAction<any> | undefined\n refetch?: () => void\n status?: StateValue<AsyncStatus>\n error?: StateValue<unknown>\n key?: string\n namespace?: string\n\n // Keep compatibility with old StateObject for metadata utils\n // We can just add metadata fields here or map them\n createdAt: number\n lastAccessed: number\n accessCount: number\n referenceCount: number\n}\n\nconst globalStateRegistry = new Map<string, RegistryEntry>()\nconst namespaceRegistry = new Map<string, Set<string>>()\n// We'll store metadata directly in RegistryEntry for simplicity in this refactor\n// OR keep existing `stateMetadata` map if we want to separate concerns.\n// Let's reuse `stateMetadata` approach for less friction with existing utils.\n\ninterface StateMetadata {\n key: string\n namespace?: string\n createdAt: number\n lastAccessed: number\n accessCount: number\n referenceCount: number\n signalRef?: WeakRef<any>\n}\nconst stateMetadata = new Map<string, StateMetadata>()\n\ninterface AutoCleanupConfig {\n enabled: boolean\n maxIdleTime: number\n checkInterval: number\n minAccessCount: number\n}\n\nlet autoCleanupConfig: AutoCleanupConfig = {\n enabled: true,\n maxIdleTime: 5 * 60 * 1000,\n checkInterval: 60 * 1000,\n minAccessCount: 0,\n}\n\nlet autoCleanupInterval: AnyInterval | null = null\ntype AnyInterval = ReturnType<typeof setInterval>\n\nif (typeof window !== 'undefined' || typeof globalThis !== 'undefined') {\n setTimeout(() => {\n if (autoCleanupConfig.enabled && !autoCleanupInterval) {\n autoCleanupInterval = setInterval(performAutoCleanup, autoCleanupConfig.checkInterval)\n // Allow process to exit in Node.js environment even if interval is running\n if (autoCleanupInterval && typeof autoCleanupInterval === 'object' && 'unref' in autoCleanupInterval && typeof autoCleanupInterval.unref === 'function') {\n (autoCleanupInterval as any).unref()\n }\n }\n }, 0)\n}\n\nconst DEV_WARNING_THRESHOLD = 10000\nlet hasWarnedAboutSize = false\n\n/**\n * ------------------------------------------------------------------\n * Helper Functions\n * ------------------------------------------------------------------\n */\nexport type StateKey = string | readonly (string | number | boolean | null | undefined | object)[]\nconst keyCache = new WeakMap<readonly unknown[], string>()\n\nfunction serializeKey(key: StateKey): string {\n if (typeof key === 'string') return key\n const cached = keyCache.get(key)\n if (cached !== undefined) return cached\n try {\n const serialized = JSON.stringify(key)\n keyCache.set(key, serialized)\n return serialized\n } catch (error) {\n const fallback = String(key)\n return fallback\n }\n}\n\nfunction registerStateInNamespace(key: string, namespace?: string): void {\n if (!namespace) return\n if (!namespaceRegistry.has(namespace)) namespaceRegistry.set(namespace, new Set())\n namespaceRegistry.get(namespace)!.add(key)\n}\n\nfunction unregisterStateFromNamespace(key: string, namespace?: string): void {\n if (!namespace) return\n const set = namespaceRegistry.get(namespace)\n if (set) {\n set.delete(key)\n if (set.size === 0) namespaceRegistry.delete(namespace)\n }\n}\n\nfunction updateStateMetadata(key: string, namespace?: string, signalRefTarget?: any): void {\n const now = Date.now()\n const existing = stateMetadata.get(key)\n\n if (existing) {\n existing.lastAccessed = now\n existing.accessCount++\n existing.referenceCount++\n if (namespace && existing.namespace !== namespace) {\n if (existing.namespace) unregisterStateFromNamespace(key, existing.namespace)\n existing.namespace = namespace\n registerStateInNamespace(key, namespace)\n }\n } else {\n stateMetadata.set(key, {\n key,\n namespace,\n createdAt: now,\n lastAccessed: now,\n accessCount: 1,\n referenceCount: 1,\n signalRef: signalRefTarget && typeof WeakRef !== 'undefined' ? new WeakRef(signalRefTarget) : undefined\n })\n registerStateInNamespace(key, namespace)\n }\n}\n\nfunction performAutoCleanup(): void {\n if (!autoCleanupConfig.enabled) return\n const now = Date.now()\n const keysToRemove: string[] = []\n\n for (const [key, metadata] of stateMetadata.entries()) {\n if (metadata.signalRef && typeof WeakRef !== 'undefined') {\n const sig = metadata.signalRef.deref()\n if (!sig) {\n keysToRemove.push(key)\n continue\n }\n }\n const idleTime = now - metadata.lastAccessed\n if (idleTime > autoCleanupConfig.maxIdleTime && metadata.referenceCount === 0 && metadata.accessCount >= autoCleanupConfig.minAccessCount) {\n keysToRemove.push(key)\n }\n }\n\n for (const key of keysToRemove) {\n state.delete(key)\n }\n\n if (keysToRemove.length > 0 && typeof process !== 'undefined' && process.env?.NODE_ENV !== 'production') {\n console.log(`[Flexium] Auto-cleaned ${keysToRemove.length} idle states`)\n }\n}\n\n/**\n * ------------------------------------------------------------------\n * Main State API\n * ------------------------------------------------------------------\n */\nexport type StateAction<T> = (newValue: T | ((prev: T) => T)) => void\nexport type StateValue<T> = T & (() => T) & { peek(): T }\nexport type AsyncStatus = 'idle' | 'loading' | 'success' | 'error'\nexport interface StateOptions<P = unknown> {\n key?: StateKey\n params?: P\n}\n\nexport function isStateValue(value: unknown): boolean {\n // Hybrid proxies are functions\n return (typeof value === 'object' || typeof value === 'function') && value !== null && STATE_SIGNAL in value\n}\n\n// Helper to get the underlying signal from a StateValue\nexport function getStateSignal(stateValue: unknown): SignalNode<unknown> | ComputedNode<unknown> | null {\n if (isStateValue(stateValue)) return (stateValue as any)[STATE_SIGNAL]\n return null\n}\n\nexport function equals<T>(stateValue: StateValue<T>, value: T): boolean {\n if (!isStateValue(stateValue)) return false\n return stateValue.peek() === value\n}\n\nexport function isTruthy<T>(stateValue: StateValue<T>): boolean {\n if (!isStateValue(stateValue)) return false\n return Boolean(stateValue.peek())\n}\n\nexport interface StateStats {\n total: number\n byNamespace: Record<string, number>\n topNamespaces: Array<{ namespace: string; count: number }>\n averageAccessCount: number\n}\n\nexport interface NamespaceStats {\n namespace: string\n count: number\n totalAccessCount: number\n averageAccessCount: number\n states: Array<{ key: string; accessCount: number; createdAt: number }>\n}\n\ninterface StateFunction {\n <T>(initialValue: T, options?: StateOptions): [StateValue<T>, StateAction<T>]\n <T, P>(computeFn: (params: P) => T, options: StateOptions<P> & { params: P }): [StateValue<T>]\n <T>(computeFn: () => T, options?: StateOptions): [StateValue<T>]\n <T, P>(fetcher: (params: P) => Promise<T>, options: StateOptions<P> & { params: P }): [StateValue<T | undefined>, () => void, StateValue<AsyncStatus>, StateValue<unknown>]\n <T>(fetcher: () => Promise<T>, options?: StateOptions): [StateValue<T | undefined>, () => void, StateValue<AsyncStatus>, StateValue<unknown>]\n\n delete: (key: StateKey) => boolean\n clear: () => void\n clearByPrefix: (prefix: StateKey) => number\n has: (key: StateKey) => boolean\n readonly size: number\n getStats: () => StateStats\n getNamespaceStats: (prefix: StateKey) => NamespaceStats\n enableAutoCleanup: (config?: Partial<AutoCleanupConfig>) => void\n disableAutoCleanup: () => void\n readonly isAutoCleanupEnabled: boolean\n}\n\nfunction stateImplementation<T, P = unknown>(\n initialValueOrFetcher: T | ((params?: P) => T) | ((params?: P) => Promise<T>),\n options?: StateOptions<P>\n): any {\n // Hook System\n if (currentComponent && !options?.key) {\n const comp = currentComponent\n const hookIndex = comp.hookIndex++\n if (hookIndex < comp.hooks.length) return comp.hooks[hookIndex]\n const saved = currentComponent\n currentComponent = null\n const res = state(initialValueOrFetcher as any, options as any)\n currentComponent = saved\n comp.hooks.push(res)\n return res\n }\n\n // Key Serializing\n const rawKey = options?.key\n const key = rawKey ? serializeKey(rawKey) : undefined\n const namespace = Array.isArray(rawKey) && rawKey.length > 0 ? String(rawKey[0]) : undefined\n const params = options?.params\n\n // Check Registry\n if (key && globalStateRegistry.has(key)) {\n const entry = globalStateRegistry.get(key)!\n updateStateMetadata(key, namespace, entry.box)\n\n const result = [entry.proxy]\n if (entry.setter) result.push(entry.setter)\n if (entry.refetch) result.push(entry.refetch)\n if (entry.status) result.push(entry.status)\n if (entry.error) result.push(entry.error)\n\n return result\n }\n\n // Logic\n let box: Box<T>\n let setter: StateAction<T> | undefined\n let refetch: (() => void) | undefined\n let statusProxy: StateValue<AsyncStatus> | undefined\n let errorProxy: StateValue<unknown> | undefined\n\n if (typeof initialValueOrFetcher === 'function') {\n const originalFn = initialValueOrFetcher as Function\n const fn = params !== undefined ? () => originalFn(params) : originalFn\n\n let testResult: any\n try { testResult = fn() } catch (e) { /* treat as computed */ }\n\n const isAsync = originalFn.constructor.name === 'AsyncFunction' || testResult instanceof Promise\n\n if (isAsync) {\n // Resource\n const [res, actions] = createResource(fn as any, async (v) => v)\n // Resources in flexium/signal are still using the wrapper API for now (unless refactored too).\n // Assuming createResource still returns { value: ... } style object which we can wrap or adapt.\n // Wait, createResource returns [Resource<T>, actions]. \n // Resource<T> extends Signal<T>. It has .value.\n // But our Box expects .get()/.peek().\n // Adapter Box:\n const resBox: Box<any> = {\n get: () => res.value,\n peek: () => res.peek(),\n // Resources are read-only-ish via this box for the user, actions used for mutations\n }\n box = resBox\n refetch = actions.refetch\n\n // Status Computed\n const statusComp = new ComputedNode(() => res.loading ? 'loading' : res.error ? 'error' : res.state === 'unresolved' ? 'idle' : 'success')\n statusProxy = createHybridProxy(statusComp as any) as any\n\n // Error Computed\n const errorComp = new ComputedNode(() => res.error)\n errorProxy = createHybridProxy(errorComp as any) as any\n } else {\n // Computed\n box = new ComputedNode(fn as any) as any\n }\n } else {\n // Signal\n const node = new SignalNode(initialValueOrFetcher)\n box = node as any\n setter = (newValue: any) => {\n if (typeof newValue === 'function') {\n node.set(newValue(node.peek()))\n } else {\n node.set(newValue)\n }\n }\n }\n\n const proxy = createHybridProxy(box)\n\n const result: any[] = [proxy]\n if (setter) result.push(setter)\n if (refetch) {\n result.splice(1, 0, refetch) // [proxy, refetch, status, error]\n if (statusProxy) result.push(statusProxy)\n if (errorProxy) result.push(errorProxy)\n }\n\n // Register\n if (key) {\n globalStateRegistry.set(key, {\n box, proxy, setter, refetch, status: statusProxy, error: errorProxy,\n createdAt: Date.now(), lastAccessed: Date.now(), accessCount: 1, referenceCount: 1,\n key, namespace\n })\n\n // Map box to key for access tracking\n boxToKeyMap.set(box, key)\n\n updateStateMetadata(key, namespace, box)\n\n const isDev = typeof process !== 'undefined' && process.env?.NODE_ENV !== 'production'\n if (isDev && !hasWarnedAboutSize && globalStateRegistry.size >= DEV_WARNING_THRESHOLD) {\n hasWarnedAboutSize = true\n console.warn(`[Flexium] Registry size warning: ${globalStateRegistry.size}`)\n }\n }\n\n return result\n}\n\nconst state = stateImplementation as StateFunction\n\n// Static Methods\nstate.delete = function (key: StateKey): boolean {\n const sKey = serializeKey(key)\n const meta = stateMetadata.get(sKey)\n if (meta?.namespace) unregisterStateFromNamespace(sKey, meta.namespace)\n stateMetadata.delete(sKey)\n return globalStateRegistry.delete(sKey)\n}\n\nstate.clear = function (): void {\n globalStateRegistry.clear()\n namespaceRegistry.clear()\n stateMetadata.clear()\n hasWarnedAboutSize = false\n}\n\nstate.has = function (key: StateKey): boolean {\n return globalStateRegistry.has(serializeKey(key))\n}\n\nstate.clearByPrefix = function (prefix: StateKey): number {\n const prefixStr = serializeKey(prefix)\n let cleared = 0\n const keysToDelete: string[] = []\n\n for (const [key] of stateMetadata.entries()) {\n if (key === prefixStr) { keysToDelete.push(key); continue }\n if (prefixStr.endsWith(']')) {\n const raw = prefixStr.slice(0, -1)\n if (key.startsWith(raw) && key.length > raw.length && key[raw.length] === ',') keysToDelete.push(key)\n } else {\n if (key.startsWith(prefixStr)) keysToDelete.push(key)\n }\n }\n\n for (const k of keysToDelete) {\n if (state.delete(k)) cleared++\n }\n return cleared\n}\n\nstate.getStats = function (): StateStats {\n const byNamespace: Record<string, number> = {}\n for (const [ns, keys] of namespaceRegistry.entries()) byNamespace[ns] = keys.size\n\n let totalAccess = 0\n for (const m of stateMetadata.values()) totalAccess += m.accessCount\n\n return {\n total: globalStateRegistry.size,\n byNamespace,\n topNamespaces: Object.entries(byNamespace).map(([n, c]) => ({ namespace: n, count: c })).sort((a, b) => b.count - a.count).slice(0, 10),\n averageAccessCount: stateMetadata.size ? totalAccess / stateMetadata.size : 0\n }\n}\n\nstate.getNamespaceStats = function (prefix: StateKey): NamespaceStats {\n const pStr = serializeKey(prefix)\n const ns = Array.isArray(prefix) && prefix.length > 0 ? String(prefix[0]) : pStr\n const states: any[] = []\n let totalAccess = 0\n\n for (const [key, m] of stateMetadata.entries()) {\n let matched = false\n\n if (key === pStr) {\n matched = true\n } else if (pStr.endsWith(']')) {\n const raw = pStr.slice(0, -1)\n if (key.startsWith(raw) && key.length > raw.length && key[raw.length] === ',') {\n matched = true\n }\n } else {\n if (key.startsWith(pStr)) matched = true\n }\n\n if (matched) {\n states.push({ key, accessCount: m.accessCount, createdAt: m.createdAt })\n totalAccess += m.accessCount\n }\n }\n return {\n namespace: ns, count: states.length, totalAccessCount: totalAccess,\n averageAccessCount: states.length ? totalAccess / states.length : 0,\n states\n }\n}\n\nObject.defineProperty(state, 'size', { get: () => globalStateRegistry.size, enumerable: true })\nstate.enableAutoCleanup = (c) => { Object.assign(autoCleanupConfig, c, { enabled: true }); if (autoCleanupInterval) clearInterval(autoCleanupInterval); autoCleanupInterval = setInterval(performAutoCleanup, autoCleanupConfig.checkInterval) }\nstate.disableAutoCleanup = () => { autoCleanupConfig.enabled = false; if (autoCleanupInterval) clearInterval(autoCleanupInterval) }\nObject.defineProperty(state, 'isAutoCleanupEnabled', { get: () => autoCleanupConfig.enabled, enumerable: true })\n\nexport { state }\n\nexport interface RefObject<T> { current: T | null }\nexport function ref<T>(initial: T | null): RefObject<T> { return { current: initial } }\n"]}
|
package/dist/chunk-AJT35P3Z.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
'use strict';var o={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 O(e){return typeof process<"u"&&process.env?.NODE_ENV!=="production"?{[o.EFFECT_EXECUTION_FAILED]:{message:"Effect execution failed",suggestion:"Check the effect callback for runtime errors. Consider wrapping async operations in try-catch."},[o.CLEANUP_OUTSIDE_EFFECT]:{message:"onCleanup must be called from within an effect",suggestion:"Move the onCleanup() call inside an effect() callback."},[o.SIGNAL_UPDATE_DURING_RENDER]:{message:"Signal was updated during render",suggestion:"Avoid updating signals inside render functions. Use effect() for side effects."},[o.CONTEXT_MISSING_PROVIDER]:{message:"Context used outside of Provider",suggestion:"Wrap your component tree with the appropriate Context.Provider."},[o.ROUTER_OUTSIDE_PROVIDER]:{message:"router() must be used within a <Router> component",suggestion:"Ensure your component is a descendant of <Router>."},[o.FORM_VALIDATION_FAILED]:{message:"Form field validation failed",suggestion:"Check the validation rules for the field and the input value."},[o.FORM_SUBMISSION_FAILED]:{message:"Form submission failed",suggestion:"Check the onSubmit handler and network connectivity."},[o.BUTTON_HANDLER_FAILED]:{message:"Button press handler failed",suggestion:"Check the onPress/onClick callback for errors."},[o.BUTTON_MISSING_ARIA_LABEL]:{message:"IconButton is missing an aria-label",suggestion:"Add an aria-label prop to IconButton for screen reader accessibility."},[o.HYDRATION_MISMATCH]:{message:"Hydration mismatch detected",suggestion:"Ensure server and client render the same content. Check for browser-only code."},[o.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."},[o.HYDRATION_TAG_MISMATCH]:{message:"Element tag mismatch during hydration",suggestion:"Server and client rendered different elements. Verify conditional rendering logic."},[o.DEVTOOLS_LISTENER_ERROR]:{message:"DevTools listener threw an error",suggestion:"Check your DevTools event listener callback."},[o.UNCAUGHT_RENDER_ERROR]:{message:"Uncaught error during render",suggestion:"Wrap components with <ErrorBoundary> to catch and handle errors gracefully."},[o.ERROR_BOUNDARY_CALLBACK_FAILED]:{message:"ErrorBoundary callback failed",suggestion:"Check your onError or onReset callback for errors."},[o.COMPUTED_EXECUTION_FAILED]:{message:"Computed value execution failed",suggestion:"Check the computed callback for runtime errors. Ensure all dependencies are valid."},[o.ASYNC_VALIDATION_FAILED]:{message:"Async form validation failed",suggestion:"Check the async validation function and ensure it handles errors properly."},[o.COMPONENT_RENDER_FAILED]:{message:"Component render failed",suggestion:"Check the component function for runtime errors. Consider wrapping with <ErrorBoundary>."},[o.HYDRATION_ATTRIBUTE_MISMATCH]:{message:"Attribute mismatch during hydration",suggestion:"Server and client rendered different attribute values. Check for dynamic attributes."},[o.DOM_CLEANUP_FAILED]:{message:"DOM cleanup operation failed",suggestion:"A node may have been removed from the DOM unexpectedly. Check for manual DOM manipulation."},[o.EVENT_HANDLER_FAILED]:{message:"Event handler threw an error",suggestion:"Check your event handler callback. Consider adding try-catch for async operations."},[o.KEYBOARD_HANDLER_FAILED]:{message:"Keyboard event handler failed",suggestion:"Check the onKeyDown/onKeyUp handler for errors."},[o.RESOURCE_FETCH_FAILED]:{message:"Resource fetch failed",suggestion:"Check the async function and network connectivity. The resource will show an error state."},[o.RESOURCE_TIMEOUT]:{message:"Resource fetch timed out",suggestion:"The async operation took too long. Consider adding a timeout handler or retry logic."}}[e]||{message:`Error ${e}`}:{message:`Minified Error ${e}`}}function I(e,n,i){let r=O(e);return {code:e,message:r.message,suggestion:r.suggestion,context:n,originalError:i}}function D(e){let n=`[Flexium ${e.code}] ${e.message}`;if(e.context&&Object.keys(e.context).length>0){let i=Object.entries(e.context).map(([r,t])=>`${r}: ${JSON.stringify(t)}`).join(", ");n+=` (${i})`;}return e.suggestion&&(n+=`
|
|
2
|
-
\u2192 ${e.suggestion}`),n}function _(e,n,i){let r=I(e,n,i),t=D(r);i?console.error(t,i):console.error(t);}function T(e,n){let i=I(e,n),r=D(i);console.warn(r);}var g;(t=>{let e=[],n=0;function i(s,c){if(n>0){let a=e[--n];return a.dep=s,a.sub=c,a.prevSub=void 0,a.nextSub=void 0,a.prevDep=void 0,a.nextDep=void 0,a}return {dep:s,sub:c,prevSub:void 0,nextSub:void 0,prevDep:void 0,nextDep:void 0}}t.alloc=i;function r(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,n<1e4&&(e[n++]=s);}t.free=r;})(g||(g={}));exports.d=void 0;(i=>{function e(r,t){let s=g.alloc(r,t),c=t.depsHead;s.nextDep=c,c&&(c.prevDep=s),t.depsHead=s;let a=r.subsHead;s.nextSub=a,a&&(a.prevSub=s),r.subsHead=s;}i.connect=e;function n(r){let t=r.depsHead;for(;t;){let s=t.dep,c=t.nextDep,a=t.prevSub,f=t.nextSub;a?a.nextSub=f:s.subsHead=f,f&&(f.prevSub=a),g.free(t),t=c;}r.depsHead=void 0;}i.disconnectDependencies=n;})(exports.d||(exports.d={}));var R;(r=>{function e(t,s){return (t.flags&s)!==0}r.has=e;function n(t,s){t.flags|=s;}r.add=n;function i(t,s){t.flags&=~s;}r.remove=i;})(R||(R={}));var d=null;function A(){return d}function p(e){d=e;}function C(e){let n=d;d=null;try{return e()}finally{d=n;}}var l=null;function E(){return l}function h(e){l=e;}function x(e){let n=l,i={cleanups:[],context:n?Object.create(n.context):null,owner:n};l=i;let r=()=>{if(i.cleanups.length!==0){for(let t of i.cleanups)t();i.cleanups=[];}};try{return e(r)}finally{l=n;}}var m=class{constructor(n,i){this.fn=n;this.onError=i;this.cleanups=[];this.flags=0;this.nodeType=3;this.owner=null;this.owner=E();}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 r=this.cleanups.length-1;r>=0;r--)this.cleanups[r]();this.cleanups=[];}exports.d.disconnectDependencies(this);let n=A(),i=E();p(this),h(this.owner);try{let r=this.fn();typeof r=="function"&&this.cleanups.push(r);}catch(r){this.onError?this.onError(r):_(o.EFFECT_EXECUTION_FAILED,void 0,r);}finally{p(n),h(i);}}dispose(){if(this.cleanups.length>0){for(let n=this.cleanups.length-1;n>=0;n--)this.cleanups[n]();this.cleanups=[];}exports.d.disconnectDependencies(this);}};function U(e,n){let i=new m(e,n?.onError);i.execute();let r=()=>i.dispose(),t=E();return t&&t.cleanups.push(r),r}exports.a=o;exports.b=_;exports.c=T;exports.e=A;exports.f=p;exports.g=C;exports.h=E;exports.i=x;exports.j=m;exports.k=U;//# sourceMappingURL=chunk-AJT35P3Z.js.map
|
|
3
|
-
//# sourceMappingURL=chunk-AJT35P3Z.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/errors.ts","../src/core/graph.ts","../src/core/owner.ts","../src/core/effect.ts"],"names":["ErrorCodes","getErrorDetails","code","createErrorInfo","context","originalError","details","formatErrorMessage","info","message","contextStr","key","value","logError","logWarning","LinkPool","pool","size","alloc","dep","sub","link","free","Graph","connect","depsHead","subsHead","disconnectDependencies","nextDep","prevSub","nextSub","Flags","has","obj","flag","add","remove","activeEffect","getActiveEffect","setActiveEffect","effect","untrack","fn","prev","owner","getOwner","setOwner","newOwner","root","prevOwner","dispose","cleanup","EffectNode","onError","i","prevEffect","result","error","options","node"],"mappings":"aAQO,IAAMA,CAAAA,CAAa,CAExB,uBAAA,CAAyB,QAAA,CACzB,uBAAwB,QAAA,CACxB,2BAAA,CAA6B,SAC7B,yBAAA,CAA2B,QAAA,CAG3B,yBAA0B,QAAA,CAC1B,uBAAA,CAAyB,SAGzB,sBAAA,CAAwB,QAAA,CACxB,uBAAwB,QAAA,CACxB,uBAAA,CAAyB,QAAA,CAGzB,qBAAA,CAAuB,QAAA,CACvB,yBAAA,CAA2B,SAC3B,uBAAA,CAAyB,QAAA,CAGzB,mBAAoB,QAAA,CACpB,uBAAA,CAAyB,SACzB,sBAAA,CAAwB,QAAA,CACxB,4BAAA,CAA8B,QAAA,CAG9B,uBAAA,CAAyB,QAAA,CAGzB,sBAAuB,QAAA,CACvB,8BAAA,CAAgC,SAChC,kBAAA,CAAoB,QAAA,CAGpB,qBAAsB,QAAA,CACtB,uBAAA,CAAyB,QAAA,CAGzB,qBAAA,CAAuB,QAAA,CACvB,gBAAA,CAAkB,QACpB,EAWA,SAASC,EAAgBC,CAAAA,CAGvB,CAEA,OADc,OAAO,OAAA,CAAY,KAAe,OAAA,CAAQ,GAAA,EAAK,WAAa,YAAA,CAEX,CAC3D,CAACF,CAAAA,CAAW,uBAAuB,EAAG,CACpC,OAAA,CAAS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,CAAK,QAAQA,CAAc,CAAA,CAE3B5C,CAAAA,CAASb,CAAAA,CAAW,wBAAyB,MAAA,CAAWyD,CAAK,EAErE,CAAA,OAAE,CACElB,CAAAA,CAAgBgB,CAAU,CAAA,CAC1BT,EAASG,CAAS,EACtB,CACJ,CAEA,SAAgB,CAGZ,GAAI,IAAA,CAAK,QAAA,CAAS,OAAS,CAAA,CAAG,CAC1B,IAAA,IAASK,CAAAA,CAAI,KAAK,QAAA,CAAS,MAAA,CAAS,CAAA,CAAGA,CAAAA,EAAK,EAAGA,CAAAA,EAAAA,CAC3C,IAAA,CAAK,QAAA,CAASA,CAAC,GAAE,CAErB,IAAA,CAAK,QAAA,CAAW,GACpB,CACA/B,SAAAA,CAAM,sBAAA,CAAuB,IAAI,EACrC,CACJ,EAoBO,SAASiB,EACZE,CAAAA,CACAgB,CAAAA,CACU,CAKV,IAAMC,EAAO,IAAIP,CAAAA,CAAWV,CAAAA,CAAIgB,CAAAA,EAAS,OAAO,CAAA,CAChDC,CAAAA,CAAK,OAAA,EAAQ,CACb,IAAMT,CAAAA,CAAU,IAAMS,CAAAA,CAAK,OAAA,GAErBf,CAAAA,CAAQC,CAAAA,EAAS,CACvB,OAAID,GACAA,CAAAA,CAAM,QAAA,CAAS,IAAA,CAAKM,CAAO,EAGxBA,CACX","file":"chunk-AJT35P3Z.js","sourcesContent":["/**\n * Flexium Error System\n *\n * Standardized error handling with error codes, contextual information,\n * and actionable suggestions for developers.\n */\n\n// Error codes for all Flexium errors\nexport const ErrorCodes = {\n // Signal/Effect errors (1xx)\n EFFECT_EXECUTION_FAILED: 'FLX101',\n CLEANUP_OUTSIDE_EFFECT: 'FLX102',\n SIGNAL_UPDATE_DURING_RENDER: 'FLX103',\n COMPUTED_EXECUTION_FAILED: 'FLX104',\n\n // Context errors (2xx)\n CONTEXT_MISSING_PROVIDER: 'FLX201',\n ROUTER_OUTSIDE_PROVIDER: 'FLX202',\n\n // Form errors (3xx)\n FORM_VALIDATION_FAILED: 'FLX301',\n FORM_SUBMISSION_FAILED: 'FLX302',\n ASYNC_VALIDATION_FAILED: 'FLX303',\n\n // Component errors (4xx)\n BUTTON_HANDLER_FAILED: 'FLX401',\n BUTTON_MISSING_ARIA_LABEL: 'FLX402',\n COMPONENT_RENDER_FAILED: 'FLX403',\n\n // Hydration errors (5xx)\n HYDRATION_MISMATCH: 'FLX501',\n HYDRATION_TEXT_MISMATCH: 'FLX502',\n HYDRATION_TAG_MISMATCH: 'FLX503',\n HYDRATION_ATTRIBUTE_MISMATCH: 'FLX504',\n\n // DevTools errors (6xx)\n DEVTOOLS_LISTENER_ERROR: 'FLX601',\n\n // Render errors (7xx)\n UNCAUGHT_RENDER_ERROR: 'FLX701',\n ERROR_BOUNDARY_CALLBACK_FAILED: 'FLX702',\n DOM_CLEANUP_FAILED: 'FLX703',\n\n // Event errors (8xx)\n EVENT_HANDLER_FAILED: 'FLX801',\n KEYBOARD_HANDLER_FAILED: 'FLX802',\n\n // Resource/Async errors (9xx)\n RESOURCE_FETCH_FAILED: 'FLX901',\n RESOURCE_TIMEOUT: 'FLX902',\n} as const\n\nexport type ErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes]\n\ninterface ErrorDefinition {\n message: string\n suggestion?: string\n}\n\n// Error message definitions with suggestions\n// Wrapped in a function to allow tree-shaking in production\nfunction getErrorDetails(code: ErrorCode): {\n message: string\n suggestion?: string\n} {\n const isDev = typeof process !== 'undefined' && process.env?.NODE_ENV !== 'production'\n if (isDev) {\n const errorDefinitions: Record<ErrorCode, ErrorDefinition> = {\n [ErrorCodes.EFFECT_EXECUTION_FAILED]: {\n message: 'Effect execution failed',\n suggestion:\n 'Check the effect callback for runtime errors. Consider wrapping async operations in try-catch.',\n },\n [ErrorCodes.CLEANUP_OUTSIDE_EFFECT]: {\n message: 'onCleanup must be called from within an effect',\n suggestion: 'Move the onCleanup() call inside an effect() callback.',\n },\n [ErrorCodes.SIGNAL_UPDATE_DURING_RENDER]: {\n message: 'Signal was updated during render',\n suggestion:\n 'Avoid updating signals inside render functions. Use effect() for side effects.',\n },\n [ErrorCodes.CONTEXT_MISSING_PROVIDER]: {\n message: 'Context used outside of Provider',\n suggestion:\n 'Wrap your component tree with the appropriate Context.Provider.',\n },\n [ErrorCodes.ROUTER_OUTSIDE_PROVIDER]: {\n message: 'router() must be used within a <Router> component',\n suggestion: 'Ensure your component is a descendant of <Router>.',\n },\n [ErrorCodes.FORM_VALIDATION_FAILED]: {\n message: 'Form field validation failed',\n suggestion:\n 'Check the validation rules for the field and the input value.',\n },\n [ErrorCodes.FORM_SUBMISSION_FAILED]: {\n message: 'Form submission failed',\n suggestion: 'Check the onSubmit handler and network connectivity.',\n },\n [ErrorCodes.BUTTON_HANDLER_FAILED]: {\n message: 'Button press handler failed',\n suggestion: 'Check the onPress/onClick callback for errors.',\n },\n [ErrorCodes.BUTTON_MISSING_ARIA_LABEL]: {\n message: 'IconButton is missing an aria-label',\n suggestion:\n 'Add an aria-label prop to IconButton for screen reader accessibility.',\n },\n [ErrorCodes.HYDRATION_MISMATCH]: {\n message: 'Hydration mismatch detected',\n suggestion:\n 'Ensure server and client render the same content. Check for browser-only code.',\n },\n [ErrorCodes.HYDRATION_TEXT_MISMATCH]: {\n message: 'Text content mismatch during hydration',\n suggestion:\n 'Server and client rendered different text. Check for Date.now(), Math.random(), or client-only data.',\n },\n [ErrorCodes.HYDRATION_TAG_MISMATCH]: {\n message: 'Element tag mismatch during hydration',\n suggestion:\n 'Server and client rendered different elements. Verify conditional rendering logic.',\n },\n [ErrorCodes.DEVTOOLS_LISTENER_ERROR]: {\n message: 'DevTools listener threw an error',\n suggestion: 'Check your DevTools event listener callback.',\n },\n [ErrorCodes.UNCAUGHT_RENDER_ERROR]: {\n message: 'Uncaught error during render',\n suggestion:\n 'Wrap components with <ErrorBoundary> to catch and handle errors gracefully.',\n },\n [ErrorCodes.ERROR_BOUNDARY_CALLBACK_FAILED]: {\n message: 'ErrorBoundary callback failed',\n suggestion: 'Check your onError or onReset callback for errors.',\n },\n [ErrorCodes.COMPUTED_EXECUTION_FAILED]: {\n message: 'Computed value execution failed',\n suggestion:\n 'Check the computed callback for runtime errors. Ensure all dependencies are valid.',\n },\n [ErrorCodes.ASYNC_VALIDATION_FAILED]: {\n message: 'Async form validation failed',\n suggestion:\n 'Check the async validation function and ensure it handles errors properly.',\n },\n [ErrorCodes.COMPONENT_RENDER_FAILED]: {\n message: 'Component render failed',\n suggestion:\n 'Check the component function for runtime errors. Consider wrapping with <ErrorBoundary>.',\n },\n [ErrorCodes.HYDRATION_ATTRIBUTE_MISMATCH]: {\n message: 'Attribute mismatch during hydration',\n suggestion:\n 'Server and client rendered different attribute values. Check for dynamic attributes.',\n },\n [ErrorCodes.DOM_CLEANUP_FAILED]: {\n message: 'DOM cleanup operation failed',\n suggestion:\n 'A node may have been removed from the DOM unexpectedly. Check for manual DOM manipulation.',\n },\n [ErrorCodes.EVENT_HANDLER_FAILED]: {\n message: 'Event handler threw an error',\n suggestion:\n 'Check your event handler callback. Consider adding try-catch for async operations.',\n },\n [ErrorCodes.KEYBOARD_HANDLER_FAILED]: {\n message: 'Keyboard event handler failed',\n suggestion: 'Check the onKeyDown/onKeyUp handler for errors.',\n },\n [ErrorCodes.RESOURCE_FETCH_FAILED]: {\n message: 'Resource fetch failed',\n suggestion:\n 'Check the async function and network connectivity. The resource will show an error state.',\n },\n [ErrorCodes.RESOURCE_TIMEOUT]: {\n message: 'Resource fetch timed out',\n suggestion:\n 'The async operation took too long. Consider adding a timeout handler or retry logic.',\n },\n }\n return errorDefinitions[code] || { message: `Error ${code}` }\n }\n return { message: `Minified Error ${code}` }\n}\n\nexport interface FlexiumErrorInfo {\n code: ErrorCode\n message: string\n suggestion?: string\n context?: Record<string, unknown>\n originalError?: unknown\n}\n\n/**\n * Create a standardized error info object\n */\nexport function createErrorInfo(\n code: ErrorCode,\n context?: Record<string, unknown>,\n originalError?: unknown\n): FlexiumErrorInfo {\n const details = getErrorDetails(code)\n return {\n code,\n message: details.message,\n suggestion: details.suggestion,\n context,\n originalError,\n }\n}\n\n/**\n * Format error message for console output\n */\nexport function formatErrorMessage(info: FlexiumErrorInfo): string {\n let message = `[Flexium ${info.code}] ${info.message}`\n\n if (info.context && Object.keys(info.context).length > 0) {\n const contextStr = Object.entries(info.context)\n .map(([key, value]) => `${key}: ${JSON.stringify(value)}`)\n .join(', ')\n message += ` (${contextStr})`\n }\n\n if (info.suggestion) {\n message += `\\n → ${info.suggestion}`\n }\n\n return message\n}\n\n/**\n * Log an error with standardized formatting\n */\nexport function logError(\n code: ErrorCode,\n context?: Record<string, unknown>,\n originalError?: unknown\n): void {\n const info = createErrorInfo(code, context, originalError)\n const message = formatErrorMessage(info)\n\n if (originalError) {\n console.error(message, originalError)\n } else {\n console.error(message)\n }\n}\n\n/**\n * Log a warning with standardized formatting\n */\nexport function logWarning(\n code: ErrorCode,\n context?: Record<string, unknown>\n): void {\n const info = createErrorInfo(code, context)\n const message = formatErrorMessage(info)\n console.warn(message)\n}\n\n/**\n * Create a FlexiumError with standardized information\n */\nexport class FlexiumError extends Error {\n code: ErrorCode\n suggestion?: string\n context?: Record<string, unknown>\n\n constructor(code: ErrorCode, context?: Record<string, unknown>) {\n const details = getErrorDetails(code)\n super(details.message)\n this.name = 'FlexiumError'\n this.code = code\n this.suggestion = details.suggestion\n this.context = context\n }\n\n toString(): string {\n return formatErrorMessage({\n code: this.code,\n message: this.message,\n suggestion: this.suggestion,\n context: this.context,\n })\n }\n}\n","/**\n * Graph.ts\n *\n * Core Graph Data Structures & Algorithms\n * Implements the \"Hardcore\" Doubly Linked List for dependency tracking.\n *\n * This module is purely internal and has NO dependencies on other core modules\n * to avoid circular references.\n */\n\n// ==================================================================================\n// 1. Data Structures\n// ==================================================================================\n\n/**\n * Flags for subscriber state (Optimization: Bitmasking)\n */\nexport const enum SubscriberFlags {\n Running = 1 << 0,\n Notified = 1 << 1,\n Dirty = 1 << 2,\n Stale = 1 << 3,\n Tracking = 1 << 4,\n}\n\n/**\n * Node type identifiers for fast type checking (Performance: Avoid instanceof)\n */\nexport const enum NodeType {\n Signal = 1,\n Computed = 2,\n Effect = 3,\n Resource = 4,\n}\n\n/**\n * Link node connecting a Subscriber (Effect/Computed) to a Dependency (Signal/Computed).\n *\n * ASCII Visualization of the Doubly Linked Graph:\n *\n * [Signal A] <==> [Link 1] <==> [Effect B]\n * ^\n * | (Prev/Next Sub on Signal A)\n * v\n * [Link 2] <==> [Effect C]\n *\n * Each Link serves as a node in TWO lists simultaneously:\n * 1. The Subscriber's list of dependencies (prevDep/nextDep)\n * 2. The Dependency's list of subscribers (prevSub/nextSub)\n */\nexport interface Link {\n dep: IObservable | undefined\n sub: ISubscriber | undefined\n\n // Pointers for Dependency's subscriber list\n prevSub: Link | undefined\n nextSub: Link | undefined\n\n // Pointers for Subscriber's dependency list\n prevDep: Link | undefined\n nextDep: Link | undefined\n}\n\n/**\n * Base interface for subscriber nodes (Effect, Computed)\n */\nexport interface ISubscriber {\n execute(): void\n depsHead: Link | undefined // Head of dependencies list\n flags: SubscriberFlags\n nodeType: NodeType // Fast type checking (Performance optimization)\n}\n\n/**\n * Base interface for observable nodes (Signal, Computed)\n */\nexport interface IObservable {\n subsHead: Link | undefined // Head of subscribers list\n version: number // For epoch-based check\n notify(): void\n nodeType: NodeType // Fast type checking (Performance optimization)\n}\n\n// ==================================================================================\n// 2. Object Pool (Memory Optimization)\n// ==================================================================================\n\n/**\n * Pool for Link objects to eliminate GC pressure.\n */\nexport namespace LinkPool {\n const pool: Link[] = []\n let size = 0\n\n export function alloc(dep: IObservable, sub: ISubscriber): Link {\n if (size > 0) {\n const link = pool[--size]\n link.dep = dep\n link.sub = sub\n link.prevSub = undefined\n link.nextSub = undefined\n link.prevDep = undefined\n link.nextDep = undefined\n return link\n }\n return {\n dep,\n sub,\n prevSub: undefined,\n nextSub: undefined,\n prevDep: undefined,\n nextDep: undefined,\n }\n }\n\n export function free(link: Link): void {\n link.dep = undefined\n link.sub = undefined\n // Clearing pointers is optional for safety but good for debugging leaks\n link.prevSub = undefined\n link.nextSub = undefined\n link.prevDep = undefined\n link.nextDep = undefined\n\n if (size < 10000) { // Safety cap\n pool[size++] = link\n }\n }\n}\n\n// ==================================================================================\n// 3. Graph Operations\n// ==================================================================================\n\n/**\n * Internal Graph operations to manage the \"Hardcore\" Linked List structure.\n * Encapsulates raw pointer arithmetic for readability.\n */\nexport namespace Graph {\n /**\n * Connects a dependency (Signal) to a subscriber (Effect/Computed).\n * Allocates a Link from the pool and stitches it into both lists.\n */\n export function connect(dep: IObservable, sub: ISubscriber): void {\n const link = LinkPool.alloc(dep, sub)\n\n // Add to Subscriber's dependency list (prepend)\n // Performance: Cache depsHead to avoid repeated property access\n const depsHead = sub.depsHead\n link.nextDep = depsHead\n if (depsHead) {\n depsHead.prevDep = link\n }\n sub.depsHead = link\n\n // Add to Dependency's subscriber list (prepend)\n // Performance: Cache subsHead to avoid repeated property access\n const subsHead = dep.subsHead\n link.nextSub = subsHead\n if (subsHead) {\n subsHead.prevSub = link\n }\n dep.subsHead = link\n }\n\n /**\n * Fully disconnects a subscriber from all its dependencies.\n * Walks the 'depsHead' list and unlinks each one.\n */\n export function disconnectDependencies(sub: ISubscriber): void {\n let link = sub.depsHead\n while (link) {\n const dep = link.dep!\n // Performance: Cache nextDep and pointers before modifying link\n const nextDep = link.nextDep\n const prevSub = link.prevSub\n const nextSub = link.nextSub\n\n // Remove link from dependency's subscriber list\n // This is a standard doubly-linked list removal\n // Performance: Branch prediction - middle nodes are more common\n if (prevSub) {\n prevSub.nextSub = nextSub\n } else {\n dep.subsHead = nextSub\n }\n if (nextSub) {\n nextSub.prevSub = prevSub\n }\n\n LinkPool.free(link)\n link = nextDep\n }\n sub.depsHead = undefined\n }\n}\n\n/**\n * Flag helpers for readability\n */\nexport namespace Flags {\n export function has(obj: { flags: number }, flag: SubscriberFlags): boolean {\n return (obj.flags & flag) !== 0\n }\n\n export function add(obj: { flags: number }, flag: SubscriberFlags): void {\n obj.flags |= flag\n }\n\n export function remove(obj: { flags: number }, flag: SubscriberFlags): void {\n obj.flags &= ~flag\n }\n}\n","/**\n * Owner.ts\n *\n * Managing reactive scopes and cleanup contexts.\n */\n\n// ==================================================================================\n// 1. Owner & Scope Management\n// ==================================================================================\n\nexport interface Owner {\n cleanups: (() => void)[]\n context: Record<symbol, unknown> | null\n owner: Owner | null // Parent owner\n}\n\nimport type { ISubscriber } from './graph'\n\n// Global context for dependency tracking\nlet activeEffect: ISubscriber | null = null\n\nexport function getActiveEffect(): ISubscriber | null {\n return activeEffect\n}\n\nexport function setActiveEffect(effect: ISubscriber | null): void {\n activeEffect = effect\n}\n\n/**\n * Execute a function without tracking signal dependencies.\n * Useful when you need to read signals inside an effect without creating dependencies.\n *\n * @param fn - Function to execute without tracking\n * @returns The return value of fn\n */\nexport function untrack<T>(fn: () => T): T {\n const prev = activeEffect\n activeEffect = null\n try {\n return fn()\n } finally {\n activeEffect = prev\n }\n}\n\nlet owner: Owner | null = null\n\n/**\n * Get the current owner (scope)\n * @internal\n */\nexport function getOwner(): Owner | null {\n return owner\n}\n\n/**\n * Set the current owner (scope)\n * @internal\n */\nexport function setOwner(newOwner: Owner | null): void {\n owner = newOwner\n}\n\n/**\n * Creates a disposal scope.\n * The return value of the function is returned, and a dispose function is returned.\n *\n * @param fn - Function to run within a new root scope\n * @returns [return value of fn, dispose function]\n *\n * @example\n * ```tsx\n * const [val, dispose] = root((dispose) => {\n * effect(() => console.log('Inside root'));\n * return 123;\n * });\n * dispose(); // Cleans up all effects created inside\n * ```\n */\nexport function root<T>(fn: (dispose: () => void) => T): T {\n const prevOwner = owner\n const newOwner: Owner = {\n cleanups: [],\n context: prevOwner ? Object.create(prevOwner.context) : null,\n owner: prevOwner,\n }\n\n owner = newOwner\n\n const dispose = () => {\n // Performance: Fast path when no cleanups\n if (newOwner.cleanups.length === 0) return\n \n for (const cleanup of newOwner.cleanups) {\n cleanup()\n }\n newOwner.cleanups = []\n }\n\n try {\n return fn(dispose)\n } finally {\n owner = prevOwner\n }\n}\n\n\n","import { ErrorCodes, logError } from './errors'\nimport {\n Graph,\n\n type Link,\n type ISubscriber,\n SubscriberFlags,\n NodeType\n} from './graph'\nimport {\n Owner,\n getOwner,\n setOwner,\n getActiveEffect,\n setActiveEffect\n} from './owner'\n\nexport class EffectNode implements ISubscriber {\n depsHead: Link | undefined\n cleanups: (() => void)[] = []\n flags = 0 // detached by default, will set flags during execution\n nodeType = NodeType.Effect\n\n private owner: Owner | null = null\n\n constructor(\n public fn: () => void | (() => void),\n public onError?: (error: Error) => void\n ) {\n this.owner = getOwner()\n }\n\n execute(): void {\n // Performance: Inline bit operations for better performance\n if ((this.flags & SubscriberFlags.Running) !== 0) {\n this.flags |= SubscriberFlags.Notified\n return\n }\n\n this.flags |= SubscriberFlags.Running\n\n try {\n this.run()\n } finally {\n // Performance: Inline bit operations\n this.flags &= ~SubscriberFlags.Running\n if ((this.flags & SubscriberFlags.Notified) !== 0) {\n this.flags &= ~SubscriberFlags.Notified\n // Schedule microtask to avoid stack overflow and infinite sync loops\n queueMicrotask(() => this.execute())\n }\n }\n }\n\n private run(): void {\n // Performance: Fast path when no cleanups\n if (this.cleanups.length > 0) {\n // Performance: Run cleanups in reverse order (most recent first)\n // This ensures proper dependency cleanup order and matches React's behavior\n for (let i = this.cleanups.length - 1; i >= 0; i--) {\n this.cleanups[i]()\n }\n this.cleanups = []\n }\n\n // Clean up previous dependencies via Graph helper\n Graph.disconnectDependencies(this)\n\n const prevEffect = getActiveEffect()\n const prevOwner = getOwner()\n setActiveEffect(this)\n setOwner(this.owner)\n\n try {\n const result = this.fn()\n if (typeof result === 'function') {\n this.cleanups.push(result)\n }\n } catch (error) {\n if (this.onError) {\n this.onError(error as Error)\n } else {\n logError(ErrorCodes.EFFECT_EXECUTION_FAILED, undefined, error)\n }\n } finally {\n setActiveEffect(prevEffect)\n setOwner(prevOwner)\n }\n }\n\n dispose(): void {\n // Performance: Run cleanups in reverse order (most recent first)\n // This ensures proper dependency cleanup order\n if (this.cleanups.length > 0) {\n for (let i = this.cleanups.length - 1; i >= 0; i--) {\n this.cleanups[i]()\n }\n this.cleanups = []\n }\n Graph.disconnectDependencies(this)\n }\n}\n\n/**\n * Creates a side effect that runs when dependencies change\n *\n * @param fn - Effect function, can return a cleanup function\n * @param options - Optional error handler\n * @returns Dispose function to stop the effect\n *\n * @example\n * ```ts\n * const [count, setCount] = state(0);\n * \n * effect(() => {\n * console.log(count());\n * });\n * \n * setCount(1); // logs: 1\n * ```\n */\nexport function effect(\n fn: () => void | (() => void),\n options?: { onError?: (error: Error) => void; name?: string }\n): () => void {\n // DevTools hooks integration would go here if needed\n // For now we rely on the devtools hooks in signal.ts or need to export them properly\n // This implementation is sufficient for core logic\n\n const node = new EffectNode(fn, options?.onError)\n node.execute()\n const dispose = () => node.dispose()\n\n const owner = getOwner()\n if (owner) {\n owner.cleanups.push(dispose)\n }\n\n return dispose\n}\n"]}
|
package/dist/chunk-AYQMU7XC.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkWXEHDEIH_js=require('./chunk-WXEHDEIH.js'),chunkQ7IWDVJ4_js=require('./chunk-Q7IWDVJ4.js'),chunk5236IK5I_js=require('./chunk-5236IK5I.js');function j(){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=new chunk5236IK5I_js.d(e()),n=s=>{if(!(typeof window>"u")){if(_(s)){console.error("[Flexium Router] Blocked navigation to unsafe path:",s);return}window.history.pushState({},"",s),r.set(e());}},a=()=>{try{r.set(e());}catch(s){console.error("[Flexium Router] Error handling popstate:",s);}};return typeof window<"u"&&window.addEventListener("popstate",a),[r,n,()=>{typeof window<"u"&&window.removeEventListener("popstate",a);}]}function _(t){let e=t.trim().toLowerCase();return ["javascript:","data:","vbscript:","file:"].some(n=>e.startsWith(n))}function L(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=L(a),s=L(n);i&&!O.has(i)&&(r[i]=s);}),r}function U(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 s={};return i.slice(1).forEach((l,h)=>{s[r[h]]=l;}),{matches:true,params:s}}function N(t){let e=[],r=Array.isArray(t)?t:[t];for(let n of r){if(!chunkQ7IWDVJ4_js.c(n))continue;let{path:a,index:i,component:s,beforeEnter:l}=n.props,h=n.children;if(!s&&!h){console.warn(`[Flexium Router] Route "${a||"(index)"}" has no component and no children. Skipping.`);continue}let R={path:a||"",index:!!i,component:s||(()=>null),children:h?N(h):[],beforeEnter:l};e.push(R);}return e}function F(t,e){for(let r of t){let n=D(r,e,"");if(n)return n}return null}function D(t,e,r){let n=r;t.path&&(n=r.replace(/\/$/,"")+"/"+t.path.replace(/^\//,""));let a=t.children.length===0,i=A(n,!a),s=e.match(i);if(s){let[l,...h]=s,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=D(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 b=chunkWXEHDEIH_js.a(null),y=chunkWXEHDEIH_js.a(0);function V(){let t=chunkWXEHDEIH_js.b(b);if(!t)throw new Error("router() must be called within a <Router> component");return t}function tt(t){let[e,r]=j(),n=Array.isArray(t.children)?t.children:[t.children],a=[],i=[];for(let o of n)chunkQ7IWDVJ4_js.c(o)&&typeof o.type=="function"&&o.type===z?i.push(o):a.push(o);let s=N(i),l=new chunk5236IK5I_js.e(()=>{let o=e.get();return F(s,o.pathname)||[]}),h=new chunk5236IK5I_js.e(()=>{let o=l.get();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,S=()=>p.get();return new Proxy(S,{apply(){return p.get()},get(C,c){if(c==="value")return p.get();if(c==="peek")return p.peek;if(c===Symbol.toPrimitive||c==="toString"||c==="valueOf")return ()=>p.get();let m=p[c];if(typeof m=="function")return m.bind(p);let g=p.get();if(g!==null&&typeof g=="object"){let v=g[c];return typeof v=="function"?v.bind(g):v}return m},has(C,c){if(c==="value"||c==="peek")return true;let m=p.get();return m!==null&&typeof m=="object"?c in m:c in p},ownKeys(C){let c=p.get();return c!==null&&typeof c=="object"?Reflect.ownKeys(c):[]},getOwnPropertyDescriptor(C,c){let m=p.get();if(m!==null&&typeof m=="object"){let g=Object.getOwnPropertyDescriptor(m,c);if(g)return {...g,configurable:true}}}})}return u}});return ()=>{let o=l.get(),f=null;if(o.length>0){let u=o[0];u.route.beforeEnter?u.route.beforeEnter(u.params)!==false&&(f=chunkQ7IWDVJ4_js.a(y.Provider,{value:1},[chunkQ7IWDVJ4_js.a("div",{key:u.route.path,style:{display:"contents"}},[chunkQ7IWDVJ4_js.a(u.route.component,{params:u.params})])])):f=chunkQ7IWDVJ4_js.a(y.Provider,{value:1},[chunkQ7IWDVJ4_js.a("div",{key:u.route.path,style:{display:"contents"}},[chunkQ7IWDVJ4_js.a(u.route.component,{params:u.params})])]);}return chunkQ7IWDVJ4_js.a(b.Provider,{value:R},[...a,chunkQ7IWDVJ4_js.a("main",{id:"main"},[f])])}}function z(t){return null}function et(){let t=chunkWXEHDEIH_js.b(b),e=chunkWXEHDEIH_js.b(y)||0;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 chunkQ7IWDVJ4_js.a(y.Provider,{value:e+1},[chunkQ7IWDVJ4_js.a(a,{params:n.params})])}:null}function nt(t){let e=V(),r=n=>{n.preventDefault(),e.navigate(t.to);};return chunkQ7IWDVJ4_js.a("a",{href:t.to,class:t.class,onclick:r},t.children)}
|
|
2
|
-
exports.a=j;exports.b=_;exports.c=L;exports.d=U;exports.e=N;exports.f=F;exports.g=V;exports.h=tt;exports.i=z;exports.j=et;exports.k=nt;//# sourceMappingURL=chunk-AYQMU7XC.js.map
|
|
3
|
-
//# sourceMappingURL=chunk-AYQMU7XC.js.map
|