flexium 0.8.15 → 0.9.0
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/dist/{DrawText-CeXBL8Ev.d.ts → DrawText-Bvzl40Vi.d.ts} +1 -1
- package/dist/{DrawText-JB58mpQT.d.cts → DrawText-CJikXQjL.d.cts} +1 -1
- package/dist/advanced.d.cts +3 -1
- package/dist/advanced.d.ts +3 -1
- package/dist/advanced.js +1 -1
- package/dist/advanced.mjs +1 -1
- package/dist/advanced.mjs.map +1 -1
- package/dist/canvas.d.cts +5 -3
- package/dist/canvas.d.ts +5 -3
- package/dist/canvas.js +1 -1
- package/dist/canvas.mjs +1 -1
- package/dist/chunk-6RV7ARJT.mjs +3 -0
- package/dist/chunk-6RV7ARJT.mjs.map +1 -0
- package/dist/{chunk-CNY6FPKJ.js → chunk-CBO2X74Q.js} +2 -2
- package/dist/{chunk-CZYIK6FD.mjs.map → chunk-CBO2X74Q.js.map} +1 -1
- package/dist/chunk-GFL4VRAO.mjs +3 -0
- package/dist/chunk-GFL4VRAO.mjs.map +1 -0
- package/dist/{chunk-MLZTCKTH.mjs → chunk-GQKN4NPW.mjs} +2 -2
- package/dist/{chunk-MLZTCKTH.mjs.map → chunk-GQKN4NPW.mjs.map} +1 -1
- package/dist/{chunk-CZYIK6FD.mjs → chunk-JDTJFAXO.mjs} +2 -2
- package/dist/chunk-JDTJFAXO.mjs.map +1 -0
- package/dist/{chunk-ZNPYN2TZ.mjs → chunk-LXXN76HJ.mjs} +2 -2
- package/dist/{chunk-ZNPYN2TZ.mjs.map → chunk-LXXN76HJ.mjs.map} +1 -1
- package/dist/chunk-MKE3KA43.js +3 -0
- package/dist/chunk-MKE3KA43.js.map +1 -0
- package/dist/{chunk-DOGIWSDA.js → chunk-PDOEMOWN.js} +2 -2
- package/dist/{chunk-DOGIWSDA.js.map → chunk-PDOEMOWN.js.map} +1 -1
- package/dist/{chunk-GDBJ322I.js → chunk-RIVNKTUR.js} +2 -2
- package/dist/{chunk-GDBJ322I.js.map → chunk-RIVNKTUR.js.map} +1 -1
- package/dist/chunk-TQLZ7UZX.js +2 -0
- package/dist/chunk-TQLZ7UZX.js.map +1 -0
- package/dist/chunk-WEYAKKNF.js +3 -0
- package/dist/chunk-WEYAKKNF.js.map +1 -0
- package/dist/chunk-WO6NQ3KR.mjs +3 -0
- package/dist/chunk-WO6NQ3KR.mjs.map +1 -0
- package/dist/chunk-Y4DUMNIW.mjs +2 -0
- package/dist/chunk-Y4DUMNIW.mjs.map +1 -0
- package/dist/chunk-ZG3LULLU.js +3 -0
- package/dist/chunk-ZG3LULLU.js.map +1 -0
- package/dist/components-D4WeooPi.d.ts +126 -0
- package/dist/components-DZy2r6m5.d.cts +126 -0
- package/dist/core.d.cts +159 -15
- package/dist/core.d.ts +159 -15
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/dom.d.cts +2 -3
- package/dist/dom.d.ts +2 -3
- package/dist/dom.js +1 -1
- package/dist/dom.js.map +1 -1
- package/dist/dom.mjs +1 -1
- package/dist/dom.mjs.map +1 -1
- package/dist/effect-BlnnM1t5.d.cts +20 -0
- package/dist/effect-BlnnM1t5.d.ts +20 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- 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 +1 -1
- package/dist/interactive.d.ts +1 -1
- package/dist/interactive.js +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/owner-Ce7KCWzi.d.cts +34 -0
- package/dist/owner-Ce7KCWzi.d.ts +34 -0
- package/dist/{portal-DBwz7gD0.d.ts → portal-C3ESJhlv.d.ts} +1 -1
- package/dist/{portal-BpcIlK9y.d.cts → portal-CAEbiMUZ.d.cts} +1 -1
- package/dist/primitives/motion.js +1 -1
- package/dist/primitives/motion.mjs +1 -1
- package/dist/primitives/ui.d.cts +1 -1
- package/dist/primitives/ui.d.ts +1 -1
- package/dist/primitives/ui.js +1 -1
- package/dist/primitives/ui.mjs +1 -1
- package/dist/primitives/ui.mjs.map +1 -1
- package/dist/primitives.d.cts +6 -4
- package/dist/primitives.d.ts +6 -4
- package/dist/primitives.js +1 -1
- package/dist/primitives.mjs +1 -1
- package/dist/router.d.cts +11 -120
- package/dist/router.d.ts +11 -120
- package/dist/router.js +1 -1
- package/dist/router.mjs +1 -1
- package/dist/scheduler-Z4QqUDjF.d.cts +25 -0
- package/dist/scheduler-Z4QqUDjF.d.ts +25 -0
- package/dist/server.js +1 -1
- package/dist/server.mjs +1 -1
- package/dist/signal-AXKUQJVA.js +2 -0
- package/dist/{signal-XZXQ4VYQ.js.map → signal-AXKUQJVA.js.map} +1 -1
- package/dist/signal-Dxh9PsKr.d.cts +69 -0
- package/dist/signal-Dxh9PsKr.d.ts +69 -0
- package/dist/signal-HM2LG5YL.mjs +2 -0
- package/dist/{signal-PWBIM6JV.mjs.map → signal-HM2LG5YL.mjs.map} +1 -1
- package/dist/test-exports.d.cts +29 -8
- package/dist/test-exports.d.ts +29 -8
- package/dist/test-exports.js +1 -1
- package/dist/test-exports.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-2MVKTSFR.mjs +0 -3
- package/dist/chunk-2MVKTSFR.mjs.map +0 -1
- package/dist/chunk-2U4DW375.mjs +0 -2
- package/dist/chunk-2U4DW375.mjs.map +0 -1
- package/dist/chunk-5S3ZQ2LB.mjs +0 -3
- package/dist/chunk-5S3ZQ2LB.mjs.map +0 -1
- package/dist/chunk-CNY6FPKJ.js.map +0 -1
- package/dist/chunk-EX2GURH5.mjs +0 -3
- package/dist/chunk-EX2GURH5.mjs.map +0 -1
- package/dist/chunk-I7UCVARB.js +0 -2
- package/dist/chunk-I7UCVARB.js.map +0 -1
- package/dist/chunk-REETNY2Z.js +0 -3
- package/dist/chunk-REETNY2Z.js.map +0 -1
- package/dist/chunk-ROYFUJN5.js +0 -3
- package/dist/chunk-ROYFUJN5.js.map +0 -1
- package/dist/chunk-V4K6WOXN.js +0 -3
- package/dist/chunk-V4K6WOXN.js.map +0 -1
- package/dist/signal-PWBIM6JV.mjs +0 -2
- package/dist/signal-XZXQ4VYQ.js +0 -2
- package/dist/signal-mNtlF8-v.d.cts +0 -158
- package/dist/signal-mNtlF8-v.d.ts +0 -158
- package/dist/state-kK9sQh9s.d.cts +0 -73
- package/dist/state-kK9sQh9s.d.ts +0 -73
|
@@ -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","propName","config","cssProp","oldValue","newValue","transformedValue","normalizeClass","i","item","normalized","k","DOMRenderer","props","tagName","className","keys","strKey","newVal","oldVal","attrName","parent","child","beforeChild","text","domEvent","_handler","domRenderer","LIST_MARKER","isListComponent","getItemHeight","_index","calculateVisibleRangeFixed","scrollTop","viewportHeight","itemHeight","totalItems","overscan","totalHeight","start","visibleCount","end","mountListComponent","comp","mountFn","cleanupFn","mountVirtualList","mountSimpleList","each","renderItem","getKey","container","cache","getItemKey","index","disposeEffect","effect","list","currentKeys","indexSig","signal","vnode","entry","height","width","itemSize","onScroll","onVisibleRangeChange","innerContainer","scrollTopSig","prevStartIndex","prevEndIndex","handleScroll","currentScrollTop","startIndex","endIndex","visibleKeys","fnodeToNode","getNode","fnode","setNode","reconcileArrays","oldFNodes","newFNodes","nextSibling","hasOld","hasNew","cleanupReactive","fragment","newFNode","mountReactive","keyToOldFNode","seen","currentChild","oldFNode","refNode","patchNode","oldChildren","newChildren","newText","REACTIVE_BINDINGS","registerReactiveBinding","dispose","bindings","listDispose","childNode","marker","isStateValue","sig","getStateSignal","startNode","currentNode","currentContainer","newNode","e","isSignal","currentNodes","currentFNode","currentFNodeList","c","childFNode","textNode","isFNode","component","componentInstance","createComponentInstance","resetHookIndex","root","disposeRoot","onCleanup","contextId","pushProvider","setCurrentComponent","fn","n","currentParent","domNode","disposeProps","setupReactiveProps","UNINITIALIZED","disposers","prevValue","children","createReactiveRoot","rootDispose","currentRootNode","render","createRoot","Portal","placeholder","portalContent"],"mappings":"iNAIA,IAAMA,EAAAA,CAAkB,IAAI,GAAA,CAGtBC,EAAAA,CAAsB,IAAI,IAAI,CAClC,OAAA,CACA,MAAA,CACA,YAAA,CACA,YAAA,CACA,MAAA,CACA,SACA,QACF,CAAC,CAAA,CAIKC,CAAAA,CAAe,IAAI,OAAA,CAKzB,SAASC,EAAAA,CAAcC,CAAAA,CAAc,CACtBA,CAAAA,CAAM,WACbC,CAAAA,CAAYD,CAAAA,CAAM,IAAA,CAAK,WAAA,EAAY,CACnCE,CAAAA,CAAU,CAACL,EAAAA,CAAoB,GAAA,CAAII,CAAS,CAAA,CAI5CE,CAAAA,CAAOH,CAAAA,CAAM,gBAAe,EAAK,EAAC,CACpCI,CAAAA,CAAuBJ,CAAAA,CAAM,OAEjC,GAAIG,CAAAA,CAAK,MAAA,GAAW,CAAA,EAAKC,CAAAA,CAEvB,KAAOA,CAAAA,EACLD,CAAAA,CAAK,KAAKC,CAAO,CAAA,CACjBA,CAAAA,CAAUA,CAAAA,CAAQ,UAAA,CAItB,IAAA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AA,EAAY,CACZA,CAAAA,CAAc,IAAA,CAAA,CAGhBA,EAAcxF,kBAAAA,CAAO,IAAM,CACzBL,CAAAA,CAAU,SAAA,CAAY,EAAA,CACtB8F,CAAAA,CAAkBvD,CAAAA,CAAchI,CAAAA,CAAMyF,CAAS,EACjD,CAAC,EACH,CAAA,CACA,SAAU,CACJ6F,CAAAA,GACFA,CAAAA,EAAY,CACZA,CAAAA,CAAc,IAAA,CAAA,CAEhBzD,EAAgBpC,CAAS,CAAA,CACzBA,CAAAA,CAAU,SAAA,CAAY,GACxB,CACF,CACF,CClhBO,SAAS+F,EAAAA,CACdxL,CAAAA,CACAyF,CAAAA,CACa,CAEb,OAAAA,CAAAA,CAAU,SAAA,CAAY,EAAA,CACfuC,CAAAA,CAAchI,CAAAA,CAAMyF,CAAS,CACtC,CA4LO,SAASgG,EAAAA,CAAWhG,CAAAA,CAAwB,CAEjD,OAAO4F,EAAAA,CAAmB5F,CAAS,CACrC,CClOO,SAASiG,EAAAA,CAAOvI,CAAAA,CAAoB,CAEzC,GAAI,OAAO,QAAA,CAAa,GAAA,CACtB,OAAO,IAAA,CAGT,IAAMsC,CAAAA,CAAYtC,CAAAA,CAAM,KAAA,EAAS,QAAA,CAAS,IAAA,CAGpCwI,CAAAA,CAAc,QAAA,CAAS,aAAA,CAAc,QAAQ,CAAA,CAG/CC,CAAAA,CAA6B,IAAA,CAIjC,OAAAA,CAAAA,CAAgB5D,CAAAA,CAAc7E,EAAM,QAAA,CAAUsC,CAAS,CAAA,CAGvD8E,kBAAAA,CAAU,IAAM,CACVqB,IACF/D,CAAAA,CAAgB+D,CAAa,CAAA,CACzBA,CAAAA,CAAc,UAAA,GAAenG,CAAAA,EAC/BA,CAAAA,CAAU,WAAA,CAAYmG,CAAa,CAAA,EAGzC,CAAC,CAAA,CAEMD,CACT","file":"chunk-REETNY2Z.js","sourcesContent":["import type { EventHandler } from '../../core/renderer'\nimport { logError, ErrorCodes } from '../../core/errors'\n\n// Map of event names to global listener status\nconst globalListeners = new Set<string>()\n\n// Events that do not bubble and must be captured\nconst NON_BUBBLING_EVENTS = new Set([\n 'focus',\n 'blur',\n 'mouseenter',\n 'mouseleave',\n 'load',\n 'unload',\n 'scroll',\n])\n\n// WeakMap to store event handlers for each node\n// Key: DOM Node, Value: Map<EventName, Handler>\nconst nodeHandlers = new WeakMap<Node, Map<string, EventHandler>>()\n\n/**\n * Global event dispatcher that handles delegation\n */\nfunction dispatchEvent(event: Event) {\n let target = event.target as Node | null\n const eventType = event.type.toLowerCase()\n const bubbles = !NON_BUBBLING_EVENTS.has(eventType)\n\n // Use composedPath if available (handles Shadow DOM and is faster)\n // Fallback to parentNode traversal for older browsers\n const path = event.composedPath?.() || []\n let current: Node | null = event.target as Node\n\n if (path.length === 0 && current) {\n // Build path manually if composedPath not available\n while (current) {\n path.push(current)\n current = current.parentNode\n }\n }\n\n for (const node of path) {\n const targetNode = node as Node\n // Stop at document or if we hit the end\n if (targetNode === document || !targetNode) break\n\n const handlers = nodeHandlers.get(targetNode)\n if (handlers?.has(eventType)) {\n const handler = handlers.get(eventType)\n if (handler) {\n try {\n handler(event)\n } catch (error) {\n logError(ErrorCodes.EVENT_HANDLER_FAILED, { eventType }, error)\n }\n if (event.cancelBubble) return\n }\n }\n\n if (!bubbles) break\n }\n}\n\n/**\n * Register a global event listener for delegation\n */\nfunction ensureGlobalListener(eventName: string) {\n // SSR guard\n if (typeof document === 'undefined') return\n\n if (!globalListeners.has(eventName)) {\n const capture = NON_BUBBLING_EVENTS.has(eventName)\n document.addEventListener(eventName, dispatchEvent, { capture })\n globalListeners.add(eventName)\n }\n}\n\n/**\n * Clear all global event listeners (useful for SSR cleanup and testing)\n */\nexport function clearGlobalListeners(): void {\n // SSR guard\n if (typeof document === 'undefined') return\n\n for (const eventName of globalListeners) {\n const capture = NON_BUBBLING_EVENTS.has(eventName)\n document.removeEventListener(eventName, dispatchEvent, { capture })\n }\n globalListeners.clear()\n}\n\n/**\n * Event Delegation System\n */\nexport const eventDelegator = {\n /**\n * Attach an event handler to a node (virtual attachment)\n */\n on(node: Node, eventName: string, handler: EventHandler) {\n // normalize event name (e.g., 'click' -> 'click')\n const lowerEvent = eventName.toLowerCase()\n\n let handlers = nodeHandlers.get(node)\n if (!handlers) {\n handlers = new Map()\n nodeHandlers.set(node, handlers)\n }\n\n handlers.set(lowerEvent, handler)\n ensureGlobalListener(lowerEvent)\n },\n\n /**\n * Detach an event handler from a node\n */\n off(node: Node, eventName: string) {\n const lowerEvent = eventName.toLowerCase()\n const handlers = nodeHandlers.get(node)\n if (handlers) {\n handlers.delete(lowerEvent)\n }\n },\n}\n","import type { Renderer, EventHandler } from '../../core/renderer'\nimport { eventDelegator } from './events'\n\n/**\n * Style property configuration for data-driven updates\n */\ninterface StylePropConfig {\n /** CSS property name to set */\n cssProp: string\n /** Transform function (e.g., px for pixel values) */\n transform?: 'px' | 'string' | 'none'\n /** Additional side effect when setting this property */\n sideEffect?: (style: CSSStyleDeclaration, value: string | undefined) => void\n}\n\n/**\n * Data-driven style property mappings\n * Maps Flexium props to CSS properties with optional transformations\n */\nconst STYLE_PROPS_CONFIG: Record<string, StylePropConfig> = {\n // Layout\n width: { cssProp: 'width', transform: 'px' },\n height: { cssProp: 'height', transform: 'px' },\n\n // Flex properties\n flexDirection: { cssProp: 'flexDirection', transform: 'none' },\n justifyContent: { cssProp: 'justifyContent', transform: 'none' },\n alignItems: { cssProp: 'alignItems', transform: 'none' },\n alignSelf: { cssProp: 'alignSelf', transform: 'none' },\n flexWrap: { cssProp: 'flexWrap', transform: 'none' },\n flex: { cssProp: 'flex', transform: 'string' },\n gap: { cssProp: 'gap', transform: 'px' },\n\n // Shorthands\n justify: { cssProp: 'justifyContent', transform: 'none' },\n align: { cssProp: 'alignItems', transform: 'none' },\n\n // Visual\n bg: { cssProp: 'backgroundColor', transform: 'none' },\n color: { cssProp: 'color', transform: 'none' },\n borderRadius: { cssProp: 'borderRadius', transform: 'px' },\n borderWidth: {\n cssProp: 'borderWidth',\n transform: 'px',\n sideEffect: (style, value) => {\n if (value !== undefined && style.borderStyle !== 'solid') {\n style.borderStyle = 'solid'\n }\n },\n },\n borderColor: { cssProp: 'borderColor', transform: 'none' },\n opacity: { cssProp: 'opacity', transform: 'string' },\n\n // Typography\n fontSize: { cssProp: 'fontSize', transform: 'px' },\n fontWeight: { cssProp: 'fontWeight', transform: 'string' },\n fontFamily: { cssProp: 'fontFamily', transform: 'none' },\n lineHeight: { cssProp: 'lineHeight', transform: 'string' },\n textAlign: { cssProp: 'textAlign', transform: 'none' },\n\n // Padding\n padding: { cssProp: 'padding', transform: 'px' },\n paddingTop: { cssProp: 'paddingTop', transform: 'px' },\n paddingRight: { cssProp: 'paddingRight', transform: 'px' },\n paddingBottom: { cssProp: 'paddingBottom', transform: 'px' },\n paddingLeft: { cssProp: 'paddingLeft', transform: 'px' },\n\n // Margin\n margin: { cssProp: 'margin', transform: 'px' },\n marginTop: { cssProp: 'marginTop', transform: 'px' },\n marginRight: { cssProp: 'marginRight', transform: 'px' },\n marginBottom: { cssProp: 'marginBottom', transform: 'px' },\n marginLeft: { cssProp: 'marginLeft', transform: 'px' },\n}\n\n/**\n * Component type to HTML element mapping\n */\nconst ELEMENT_MAPPING: Record<string, string> = {\n Row: 'div',\n Column: 'div',\n Stack: 'div',\n Text: 'span',\n Button: 'button',\n Input: 'input',\n Container: 'div',\n}\n\n/**\n * Event name mapping (platform-agnostic to DOM)\n */\nconst EVENT_MAPPING: Record<string, string> = {\n onPress: 'click',\n onHover: 'mouseenter',\n onChange: 'input',\n onFocus: 'focus',\n onBlur: 'blur',\n}\n\n/**\n * Props that should not be set as DOM attributes\n */\nconst SKIP_PROPS = new Set([\n 'children',\n 'key',\n 'ref',\n 'className',\n 'style',\n // Layout props (handled via style)\n 'width',\n 'height',\n 'padding',\n 'paddingTop',\n 'paddingRight',\n 'paddingBottom',\n 'paddingLeft',\n 'margin',\n 'marginTop',\n 'marginRight',\n 'marginBottom',\n 'marginLeft',\n 'gap',\n 'flex',\n 'flexDirection',\n 'flexWrap',\n 'justifyContent',\n 'alignItems',\n 'alignSelf',\n // Shorthand flexbox props\n 'align',\n 'justify',\n // Visual props (handled via style)\n 'bg',\n 'color',\n 'borderRadius',\n 'borderWidth',\n 'borderColor',\n 'opacity',\n // Typography props\n 'fontSize',\n 'fontWeight',\n 'fontFamily',\n 'lineHeight',\n 'textAlign',\n])\n\n/**\n * SVG Namespace URI\n */\nconst SVG_NAMESPACE = 'http://www.w3.org/2000/svg'\n\n/**\n * Common SVG tags that require namespace\n */\nconst SVG_TAGS = new Set([\n 'svg',\n 'path',\n 'circle',\n 'rect',\n 'line',\n 'polyline',\n 'polygon',\n 'ellipse',\n 'g',\n 'text',\n 'tspan',\n 'defs',\n 'use',\n 'symbol',\n 'marker',\n 'linearGradient',\n 'radialGradient',\n 'stop',\n 'clipPath',\n 'pattern',\n 'mask',\n 'filter',\n])\n\n/**\n * SVG Attribute Case Mapping\n * React-like camelCase to SVG case-sensitive attributes\n */\nconst SVG_ATTR_MAP: Record<string, string> = {\n viewBox: 'viewBox',\n preserveAspectRatio: 'preserveAspectRatio',\n strokeWidth: 'stroke-width',\n strokeLinecap: 'stroke-linecap',\n strokeLinejoin: 'stroke-linejoin',\n strokeDasharray: 'stroke-dasharray',\n strokeDashoffset: 'stroke-dashoffset',\n fillOpacity: 'fill-opacity',\n strokeOpacity: 'stroke-opacity',\n stopColor: 'stop-color',\n stopOpacity: 'stop-opacity',\n clipPath: 'clip-path',\n markerEnd: 'marker-end',\n markerStart: 'marker-start',\n markerMid: 'marker-mid',\n}\n\n/**\n * Convert pixel value to CSS string\n */\nfunction px(value: number | string): string {\n return typeof value === 'number' ? `${value}px` : value\n}\n\n/**\n * Cache for camelCase to kebab-case conversions\n * Avoids repeated regex operations for common CSS properties\n */\nconst kebabCache = new Map<string, string>()\n\n/**\n * Convert camelCase to kebab-case for CSS property names\n * Uses memoization for performance\n */\nfunction toKebabCase(str: string): string {\n let result = kebabCache.get(str)\n if (result === undefined) {\n result = str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)\n kebabCache.set(str, result)\n }\n return result\n}\n\n/**\n * Escape special characters in HTML attribute values to prevent XSS\n * @param value - Attribute value to escape\n * @returns Escaped value safe for HTML attributes\n */\nexport function escapeAttrValue(value: string): string {\n return value\n .replace(/&/g, '&')\n .replace(/\"/g, '"')\n .replace(/'/g, ''')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n}\n\n/**\n * Transform a value based on the config type\n */\nfunction transformValue(\n value: unknown,\n transform: StylePropConfig['transform']\n): string | undefined {\n if (value === undefined || value === null) return undefined\n switch (transform) {\n case 'px':\n return px(value as number | string)\n case 'string':\n return String(value)\n case 'none':\n default:\n return value as string\n }\n}\n\n/**\n * Apply style props to DOM element efficiently\n */\nfunction updateStyles(\n element: HTMLElement | SVGElement,\n oldProps: Record<string, unknown>,\n newProps: Record<string, unknown>\n): void {\n const style = element.style\n\n // 1. Handle 'style' object prop\n const oldStyle = oldProps.style as Record<string, string> | undefined\n const newStyle = newProps.style as Record<string, string> | undefined\n\n if (oldStyle !== newStyle) {\n if (oldStyle && typeof oldStyle === 'object') {\n for (const key in oldStyle) {\n if (!newStyle || !(key in newStyle)) {\n // Convert camelCase to kebab-case for CSS property names\n style.setProperty(toKebabCase(key), '')\n }\n }\n }\n if (newStyle && typeof newStyle === 'object') {\n for (const key in newStyle) {\n const val = newStyle[key]\n if (!oldStyle || oldStyle[key] !== val) {\n // Convert camelCase to kebab-case for CSS property names\n style.setProperty(toKebabCase(key), val)\n }\n }\n }\n }\n\n // 2. Flexbox setup (display: flex)\n const type = element.getAttribute('data-flexium-type')\n const needsFlex =\n newProps.flexDirection ||\n newProps.justifyContent ||\n newProps.alignItems ||\n newProps.flexWrap ||\n newProps.gap !== undefined ||\n newProps.justify ||\n newProps.align ||\n type === 'Row' ||\n type === 'Column' ||\n type === 'Stack'\n\n if (needsFlex) {\n if (style.display !== 'flex') style.display = 'flex'\n if (type === 'Row' && style.flexDirection !== 'row')\n style.flexDirection = 'row'\n if (type === 'Column' && style.flexDirection !== 'column')\n style.flexDirection = 'column'\n }\n\n // 3. Handle Flexium specific style props - only check props that exist\n // Optimized: iterate directly without creating intermediate Set\n\n // Check oldProps for removed style props\n for (const propName in oldProps) {\n if (propName in STYLE_PROPS_CONFIG && !(propName in newProps)) {\n const config = STYLE_PROPS_CONFIG[propName]\n const cssProp = config.cssProp as keyof CSSStyleDeclaration\n\n if (style[cssProp] !== '') {\n ; (style as unknown as Record<string, string>)[cssProp as string] = ''\n }\n\n // Apply any side effects\n if (config.sideEffect) {\n config.sideEffect(style, undefined)\n }\n }\n }\n\n // Check newProps for added/updated style props\n for (const propName in newProps) {\n if (propName in STYLE_PROPS_CONFIG) {\n const oldValue = oldProps[propName]\n const newValue = newProps[propName]\n\n if (oldValue === newValue) continue\n\n const config = STYLE_PROPS_CONFIG[propName]\n const transformedValue = transformValue(newValue, config.transform)\n const cssProp = config.cssProp as keyof CSSStyleDeclaration\n\n // Update the style property\n if (transformedValue === undefined) {\n if (style[cssProp] !== '') {\n ; (style as unknown as Record<string, string>)[cssProp as string] = ''\n }\n } else {\n if (style[cssProp] !== transformedValue) {\n ; (style as unknown as Record<string, string>)[cssProp as string] =\n transformedValue\n }\n }\n\n // Apply any side effects\n if (config.sideEffect) {\n config.sideEffect(style, transformedValue)\n }\n }\n }\n}\n\n/**\n * Normalize className prop (supports string, array, object)\n * Optimized single-pass implementation without recursion overhead\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction normalizeClass(value: any): string {\n if (typeof value === 'string') return value\n if (Array.isArray(value)) {\n // Single-pass iteration without intermediate arrays\n let result = ''\n for (let i = 0; i < value.length; i++) {\n const item = value[i]\n if (!item) continue\n const normalized = typeof item === 'string' ? item : normalizeClass(item)\n if (normalized) {\n result = result ? `${result} ${normalized}` : normalized\n }\n }\n return result\n }\n if (typeof value === 'object' && value !== null) {\n // Single-pass iteration without intermediate arrays\n let result = ''\n for (const k in value) {\n if (value[k]) {\n result = result ? `${result} ${k}` : k\n }\n }\n return result\n }\n return ''\n}\n\n/**\n * DOM Renderer implementation\n */\nexport class DOMRenderer implements Renderer {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n createNode(type: string, props: Record<string, any>): HTMLElement | SVGElement {\n // Map component type to HTML element\n const tagName = ELEMENT_MAPPING[type] ?? type\n\n let element: HTMLElement | SVGElement\n\n if (SVG_TAGS.has(tagName)) {\n element = document.createElementNS(SVG_NAMESPACE, tagName) as SVGElement\n } else {\n element = document.createElement(tagName)\n }\n\n // Store original type for reference\n if (ELEMENT_MAPPING[type]) {\n element.setAttribute('data-flexium-type', type)\n }\n\n // Apply all props (treat oldProps as empty)\n this.updateNode(element, {}, props)\n\n return element\n }\n\n updateNode(\n node: HTMLElement | SVGElement,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n oldProps: Record<string, any>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n newProps: Record<string, any>\n ): void {\n // 1. Handle className\n if (newProps.className !== oldProps.className) {\n const className = normalizeClass(newProps.className)\n if (node instanceof SVGElement) {\n node.setAttribute('class', className)\n } else {\n node.className = className\n }\n }\n\n // 2. Update Styles (Efficiently)\n updateStyles(node, oldProps, newProps)\n\n // 3. Handle Events & Attributes\n // We iterate over merged keys to handle additions, updates, and removals in one pass if possible\n // But separating old and new is easier for now.\n\n // Remove deleted props\n for (const key in oldProps) {\n if (!(key in newProps)) {\n // Ignore Symbols\n if (typeof key === 'symbol') continue\n\n if (key.startsWith('on')) {\n const eventName = EVENT_MAPPING[key] || key.slice(2).toLowerCase()\n this.removeEventListener(node, eventName, oldProps[key])\n } else if (!SKIP_PROPS.has(key)) {\n node.removeAttribute(key)\n }\n }\n }\n\n // Add/Update new props\n const keys = Reflect.ownKeys(newProps) // Get string and symbol keys\n for (const key of keys) {\n // Ignore Symbols (Synapse keys)\n if (typeof key === 'symbol') continue\n\n // Cast key to string for accessing record\n const strKey = key\n const newVal = newProps[strKey]\n const oldVal = oldProps[strKey]\n\n if (newVal === oldVal) continue\n\n if (strKey.startsWith('on')) {\n const eventName = EVENT_MAPPING[strKey] || strKey.slice(2).toLowerCase()\n if (oldVal) this.removeEventListener(node, eventName, oldVal)\n if (newVal) this.addEventListener(node, eventName, newVal)\n } else if (!SKIP_PROPS.has(strKey)) {\n if (newVal === null || newVal === undefined || newVal === false) {\n node.removeAttribute(strKey)\n } else if (newVal === true) {\n node.setAttribute(strKey, '')\n } else {\n // Handle SVG attributes\n const attrName = SVG_ATTR_MAP[strKey] || strKey\n\n // Escape attribute value to prevent XSS attacks\n node.setAttribute(attrName, escapeAttrValue(String(newVal)))\n }\n }\n }\n }\n\n appendChild(parent: Node, child: Node): void {\n parent.appendChild(child)\n }\n\n insertBefore(parent: Node, child: Node, beforeChild: Node | null): void {\n parent.insertBefore(child, beforeChild)\n }\n\n nextSibling(node: Node): Node | null {\n return node.nextSibling\n }\n\n removeChild(parent: Node, child: Node): void {\n // No need to manually cleanup listeners if using WeakMap in delegator\n // The nodeHandlers WeakMap will automatically release entries when node is garbage collected\n parent.removeChild(child)\n }\n\n createTextNode(text: string): Text {\n return document.createTextNode(text)\n }\n\n updateTextNode(node: Text, text: string): void {\n node.textContent = text\n }\n\n addEventListener(node: Node, event: string, handler: EventHandler): void {\n // Use Event Delegation\n // Map to DOM event name\n const domEvent = EVENT_MAPPING[event] || event\n eventDelegator.on(node, domEvent, handler)\n }\n\n removeEventListener(node: Node, event: string, _handler: EventHandler): void {\n // Use Event Delegation\n // Map to DOM event name\n const domEvent = EVENT_MAPPING[event] || event\n eventDelegator.off(node, domEvent)\n }\n}\n\n/**\n * Default DOM renderer instance\n */\nexport const domRenderer = new DOMRenderer()\n","import { signal, effect } from '../../core/signal'\nimport type { FNode } from '../../core/renderer'\nimport type {\n ListProps,\n ListComponent,\n ListCacheEntry,\n SizeConfig,\n} from './types'\n\n/** Marker symbol for List components */\nexport const LIST_MARKER = Symbol('flexium.list')\n\n/**\n * Check if a value is a ListComponent\n */\nexport function isListComponent<T>(\n value: unknown\n): value is ListComponent<T> {\n return (\n value !== null &&\n typeof value === 'object' &&\n LIST_MARKER in value &&\n (value as Record<symbol, unknown>)[LIST_MARKER] === true\n )\n}\n\n\n/**\n * List - Render lists with optional virtualization\n *\n * By default, renders all items. Set `virtual` to true for large lists\n * to only render visible items.\n *\n * @example\n * ```tsx\n * // Simple list (renders all items)\n * <List each={items}>\n * {(item, index) => <div>{item.name}</div>}\n * </List>\n *\n * // Virtual list (for large datasets)\n * <List\n * each={items}\n * virtual\n * height={400}\n * itemSize={50}\n * >\n * {(item, index) => <div>{index()}: {item.name}</div>}\n * </List>\n * ```\n */\nexport function List<T>(props: ListProps<T>): ListComponent<T> {\n const {\n each,\n children,\n virtual = false,\n height,\n width,\n itemSize,\n overscan = 3,\n getKey,\n onScroll,\n onVisibleRangeChange,\n class: className,\n style,\n } = props\n\n const component: ListComponent<T> = {\n [LIST_MARKER]: true,\n each,\n renderItem: children,\n virtual,\n height,\n width,\n itemSize,\n overscan,\n getKey,\n onScroll,\n onVisibleRangeChange,\n class: className,\n style,\n }\n\n return component\n}\n\n/**\n * Get item height based on configuration\n */\nfunction getItemHeight(config: number | SizeConfig, _index: number): number {\n if (typeof config === 'number') {\n return config\n }\n if (config.mode === 'fixed') {\n return config.itemHeight\n }\n // Variable mode - use estimated height\n return config.estimatedItemHeight\n}\n\n/**\n * Calculate visible range for fixed-height items\n */\nfunction calculateVisibleRangeFixed(\n scrollTop: number,\n viewportHeight: number,\n itemHeight: number,\n totalItems: number,\n overscan: number\n): { startIndex: number; endIndex: number; totalHeight: number } {\n const totalHeight = totalItems * itemHeight\n\n if (totalItems === 0) {\n return { startIndex: 0, endIndex: -1, totalHeight: 0 }\n }\n\n const start = Math.floor(scrollTop / itemHeight)\n const visibleCount = Math.ceil(viewportHeight / itemHeight)\n const end = start + visibleCount\n\n return {\n startIndex: Math.max(0, start - overscan),\n endIndex: Math.min(totalItems - 1, end + overscan),\n totalHeight,\n }\n}\n\n/**\n * Mount a List component to the DOM with efficient rendering.\n *\n * Handles both simple and virtual lists:\n * - Simple lists render all items immediately with key-based caching\n * - Virtual lists only render visible items for optimal performance with large datasets\n *\n * @internal Used by the reactive renderer\n * @param comp - The ListComponent to mount\n * @param parent - Parent DOM node to mount into\n * @param mountFn - Function to mount an FNode to the DOM\n * @param cleanupFn - Function to cleanup a DOM node and its bindings\n * @returns Dispose function to cleanup all list items and effects\n *\n * @example\n * ```tsx\n * // This is called automatically by mountReactive when it encounters a List:\n * <List each={items} virtual height={400} itemSize={50}>\n * {(item, index) => <Row>{index()}: {item.name}</Row>}\n * </List>\n * ```\n */\nexport function mountListComponent<T>(\n comp: ListComponent<T>,\n parent: Node,\n mountFn: (vnode: FNode) => Node | null,\n cleanupFn: (node: Node) => void\n): () => void {\n if (comp.virtual) {\n return mountVirtualList(comp, parent, mountFn, cleanupFn)\n } else {\n return mountSimpleList(comp, parent, mountFn, cleanupFn)\n }\n}\n\n/**\n * Mount a simple (non-virtual) list\n */\nfunction mountSimpleList<T>(\n comp: ListComponent<T>,\n parent: Node,\n mountFn: (vnode: FNode) => Node | null,\n cleanupFn: (node: Node) => void\n): () => void {\n const { each, renderItem, getKey, class: className, style } = comp\n\n // Create container\n const container = document.createElement('div')\n container.setAttribute('role', 'list')\n if (className) container.className = className\n if (style) {\n Object.entries(style).forEach(([key, value]) => {\n ; (container.style as unknown as Record<string, string>)[key] =\n typeof value === 'number' ? `${value}px` : value\n })\n }\n\n parent.appendChild(container)\n\n // Cache for rendered items\n const cache = new Map<string | number, { node: Node; dispose: () => void }>()\n\n // Get key for item\n const getItemKey = (item: T, index: number): string | number => {\n if (getKey) {\n return getKey(item, index)\n }\n return index\n }\n\n // Render effect\n const disposeEffect = effect(() => {\n const list = each() || []\n const currentKeys = new Set<string | number>()\n\n // Render items\n list.forEach((item, index) => {\n const key = getItemKey(item, index)\n currentKeys.add(key)\n\n if (!cache.has(key)) {\n const indexSig = signal(index)\n const vnode = renderItem(item, () => indexSig())\n const node = mountFn(vnode)\n\n if (node && node instanceof HTMLElement) {\n node.setAttribute('role', 'listitem')\n container.appendChild(node)\n\n cache.set(key, {\n node,\n dispose: () => {\n try {\n cleanupFn(node)\n } catch {\n // Ignore cleanup errors\n }\n },\n })\n }\n }\n })\n\n // Remove items no longer in list\n for (const [key, entry] of cache) {\n if (!currentKeys.has(key)) {\n entry.dispose()\n if (entry.node.parentNode === container) {\n container.removeChild(entry.node)\n }\n cache.delete(key)\n }\n }\n })\n\n // Cleanup\n return () => {\n disposeEffect()\n for (const entry of cache.values()) {\n entry.dispose()\n }\n cache.clear()\n if (container.parentNode === parent) {\n parent.removeChild(container)\n }\n }\n}\n\n/**\n * Mount a virtual (windowed) list\n */\nfunction mountVirtualList<T>(\n comp: ListComponent<T>,\n parent: Node,\n mountFn: (node: FNode) => Node | null,\n cleanupFn: (node: Node) => void\n): () => void {\n const {\n each,\n renderItem,\n height,\n width,\n itemSize,\n overscan,\n getKey,\n onScroll,\n onVisibleRangeChange,\n } = comp\n\n if (!height || !itemSize) {\n console.warn('List: height and itemSize are required when virtual is true')\n return () => { }\n }\n\n // Create container structure\n const container = document.createElement('div')\n container.style.height = typeof height === 'number' ? `${height}px` : height\n container.style.width = width\n ? typeof width === 'number'\n ? `${width}px`\n : width\n : '100%'\n container.style.overflow = 'auto'\n container.style.position = 'relative'\n\n // Accessibility attributes\n container.setAttribute('role', 'list')\n container.setAttribute('tabindex', '0')\n\n const innerContainer = document.createElement('div')\n innerContainer.style.position = 'relative'\n innerContainer.style.width = '100%'\n innerContainer.style.willChange = 'transform'\n\n container.appendChild(innerContainer)\n parent.appendChild(container)\n\n // Reactive state\n const scrollTopSig = signal(0)\n const cache = new Map<string | number, ListCacheEntry<T>>()\n\n // Track previous visible range\n let prevStartIndex = -1\n let prevEndIndex = -1\n\n // Scroll handler\n const handleScroll = () => {\n scrollTopSig.set(container.scrollTop)\n onScroll?.(container.scrollTop)\n }\n\n container.addEventListener('scroll', handleScroll, { passive: true })\n\n // Get key for item\n const getItemKey = (item: T, index: number): string | number => {\n if (getKey) {\n return getKey(item, index)\n }\n return index\n }\n\n // Main render effect\n const disposeEffect = effect(() => {\n const list = each() || []\n const currentScrollTop = scrollTopSig()\n const viewportHeight = container.clientHeight || parseFloat(String(height))\n const itemHeight = getItemHeight(itemSize, 0)\n\n // Calculate visible range\n const { startIndex, endIndex, totalHeight } = calculateVisibleRangeFixed(\n currentScrollTop,\n viewportHeight,\n itemHeight,\n list.length,\n overscan\n )\n\n // Update spacer height\n innerContainer.style.height = `${totalHeight}px`\n\n // Update ARIA attributes\n container.setAttribute('aria-rowcount', String(list.length))\n\n // Notify visible range change\n if (startIndex !== prevStartIndex || endIndex !== prevEndIndex) {\n onVisibleRangeChange?.(startIndex, endIndex)\n prevStartIndex = startIndex\n prevEndIndex = endIndex\n }\n\n // Track which keys are currently visible\n const visibleKeys = new Set<string | number>()\n\n // Render visible items\n for (let i = startIndex; i <= endIndex && i < list.length; i++) {\n const item = list[i]\n const key = getItemKey(item, i)\n visibleKeys.add(key)\n\n let entry = cache.get(key)\n\n if (!entry) {\n // Create new item\n const indexSig = signal(i)\n const vnode = renderItem(item, () => indexSig())\n const node = mountFn(vnode)\n\n if (node && node instanceof HTMLElement) {\n // Position the item\n node.style.position = 'absolute'\n node.style.top = '0'\n node.style.left = '0'\n node.style.right = '0'\n node.style.transform = `translateY(${i * itemHeight}px)`\n node.style.height = `${itemHeight}px`\n node.style.boxSizing = 'border-box'\n node.setAttribute('role', 'listitem')\n node.setAttribute('aria-rowindex', String(i + 1))\n\n innerContainer.appendChild(node)\n\n entry = {\n item,\n key,\n node,\n indexSig,\n dispose: () => {\n try {\n cleanupFn(node)\n } catch {\n // Ignore cleanup errors\n }\n },\n }\n cache.set(key, entry)\n }\n } else {\n // Update existing item position\n if (entry.indexSig.peek() !== i) {\n entry.indexSig.set(i)\n }\n const node = entry.node as HTMLElement\n node.style.transform = `translateY(${i * itemHeight}px)`\n node.setAttribute('aria-rowindex', String(i + 1))\n }\n }\n\n // Remove items no longer visible\n for (const [key, entry] of cache) {\n if (!visibleKeys.has(key)) {\n entry.dispose()\n if (entry.node.parentNode === innerContainer) {\n innerContainer.removeChild(entry.node)\n }\n cache.delete(key)\n }\n }\n })\n\n // Cleanup function\n return () => {\n disposeEffect()\n container.removeEventListener('scroll', handleScroll)\n\n for (const entry of cache.values()) {\n entry.dispose()\n }\n cache.clear()\n\n if (container.parentNode === parent) {\n parent.removeChild(container)\n }\n }\n}\n\nexport default List\n","/**\n * FNode to DOM Node mapping using WeakMap\n *\n * This replaces the _node property on FNode with a clean separation.\n * WeakMap ensures nodes are garbage collected when FNodes are no longer referenced.\n */\n\nimport type { FNode } from '../../core/renderer'\n\nconst fnodeToNode = new WeakMap<FNode, Node>()\n\n/**\n * Get the DOM node associated with an FNode\n */\nexport function getNode(fnode: FNode): Node | undefined {\n return fnodeToNode.get(fnode)\n}\n\n/**\n * Set the DOM node associated with an FNode\n */\nexport function setNode(fnode: FNode, node: Node): void {\n fnodeToNode.set(fnode, node)\n}\n\n/**\n * Check if an FNode has an associated DOM node\n */\nexport function hasNode(fnode: FNode): boolean {\n return fnodeToNode.has(fnode)\n}\n\n/**\n * Remove the DOM node association from an FNode\n */\nexport function deleteNode(fnode: FNode): boolean {\n return fnodeToNode.delete(fnode)\n}\n","import { FNode } from '../../core/renderer'\nimport { domRenderer } from './index'\nimport { mountReactive, cleanupReactive } from './reactive'\nimport { getNode, setNode } from './node-map'\n\n/**\n * Reconcile two arrays of FNodes using hybrid key-based approach.\n * Simple Map lookup + position check for optimal DOM operations.\n *\n * @param parent The parent DOM node\n * @param oldFNodes The array of old FNodes (with attached DOM nodes)\n * @param newFNodes The array of new FNodes\n * @param nextSibling The node to insert before (for the end of the list)\n */\nexport function reconcileArrays(\n parent: Node,\n oldFNodes: FNode[],\n newFNodes: FNode[],\n nextSibling: Node | null\n): void {\n const hasOld = oldFNodes && oldFNodes.length > 0\n const hasNew = newFNodes && newFNodes.length > 0\n\n // Fast path: both empty\n if (!hasOld && !hasNew) return\n\n // Fast path: remove all\n if (!hasNew) {\n for (const fnode of oldFNodes) {\n const node = fnode && getNode(fnode)\n if (node) {\n cleanupReactive(node)\n domRenderer.removeChild(parent, node)\n }\n }\n return\n }\n\n // Fast path: add all\n if (!hasOld) {\n const fragment = document.createDocumentFragment()\n for (const newFNode of newFNodes) {\n const node = mountReactive(newFNode, undefined)\n if (node) {\n setNode(newFNode, node)\n fragment.appendChild(node)\n }\n }\n if (nextSibling) {\n parent.insertBefore(fragment, nextSibling)\n } else {\n parent.appendChild(fragment)\n }\n return\n }\n\n // Build key → FNode map from old nodes\n const keyToOldFNode = new Map<string | number | undefined, FNode>()\n for (let i = 0; i < oldFNodes.length; i++) {\n const fnode = oldFNodes[i]\n // Use key if available, otherwise use index with type prefix for uniqueness\n const key = fnode.key ?? `__idx_${i}_${fnode.type}`\n keyToOldFNode.set(key, fnode)\n }\n\n const seen = new Set<string | number | undefined>()\n\n // Forward pass: process new nodes\n let currentChild = parent.firstChild\n\n for (let i = 0; i < newFNodes.length; i++) {\n const newFNode = newFNodes[i]\n const key = newFNode.key ?? `__idx_${i}_${newFNode.type}`\n seen.add(key)\n\n const oldFNode = keyToOldFNode.get(key)\n\n // Determine the reference node for insertion\n // If currentChild is valid, insert before it. Otherwise append (refNode is null).\n const refNode = currentChild\n\n if (!oldFNode || oldFNode.type !== newFNode.type) {\n // New node or type changed: create and insert\n const node = mountReactive(newFNode, undefined)\n if (node) {\n setNode(newFNode, node)\n parent.insertBefore(node, refNode)\n // We inserted a new node before currentChild, so currentChild is still the next one to process\n }\n // If type changed, old node will be removed in cleanup pass\n } else {\n // Existing node: patch and maybe move\n patchNode(oldFNode, newFNode)\n\n const node = getNode(newFNode)\n if (node) {\n if (currentChild !== node) {\n // Position wrong: move to correct position (before currentChild)\n parent.insertBefore(node, refNode)\n // We moved the node here. currentChild is still the next one to process.\n } else {\n // Position correct: match!\n // Advance pointer since we consumed this node\n currentChild = currentChild?.nextSibling || null\n }\n }\n }\n }\n\n // Cleanup pass: remove nodes not in new list\n for (const [key, fnode] of keyToOldFNode) {\n const node = getNode(fnode)\n if (!seen.has(key) && node) {\n cleanupReactive(node)\n // Check if node is still attached before removing\n if (node.parentNode === parent) {\n domRenderer.removeChild(parent, node)\n }\n }\n }\n}\n\n/**\n * Patch an existing FNode with new props and children\n */\nfunction patchNode(oldFNode: FNode, newFNode: FNode) {\n const node = getNode(oldFNode) as HTMLElement\n if (!node) return\n\n // Transfer DOM reference\n setNode(newFNode, node)\n\n // Only patch element nodes (not components)\n if (typeof newFNode.type !== 'string') return\n\n // Update props\n domRenderer.updateNode(node, oldFNode.props, newFNode.props)\n\n // Update children\n const oldChildren = oldFNode.children || []\n const newChildren = newFNode.children || []\n\n if (oldChildren.length === 0 && newChildren.length === 0) return\n\n // Fast path: single text/number child\n if (\n newChildren.length === 1 &&\n (typeof newChildren[0] === 'string' || typeof newChildren[0] === 'number') &&\n node.firstChild?.nodeType === Node.TEXT_NODE &&\n node.childNodes.length === 1\n ) {\n const newText = String(newChildren[0])\n const oldText = String(oldChildren[0])\n if (oldText !== newText) {\n domRenderer.updateTextNode(node.firstChild as Text, newText)\n }\n return\n }\n\n // Recursive reconciliation for nested children\n reconcileArrays(\n node,\n oldChildren as FNode[],\n newChildren as FNode[],\n null\n )\n}\n","/**\n * Reactive DOM Rendering\n *\n * Integrates the signal system with the DOM renderer to enable fine-grained\n * reactive updates. Only the specific DOM nodes that depend on changed signals\n * will be updated, without re-rendering the entire component tree.\n */\n\nimport type { FNode } from '../../core/renderer'\nimport { effect, isSignal, onCleanup, root } from '../../core/signal'\nimport type { Signal, Computed } from '../../core/signal'\nimport { domRenderer } from './index'\nimport { isFNode } from './f'\nimport {\n pushProvider,\n} from '../../core/context'\nimport { reconcileArrays } from './reconcile'\nimport {\n isStateValue,\n getStateSignal,\n setCurrentComponent,\n createComponentInstance,\n resetHookIndex,\n} from '../../core/state'\nimport {\n isListComponent,\n mountListComponent,\n ListComponent,\n} from '../../primitives/List'\nimport { logError, ErrorCodes } from '../../core/errors'\nimport { setNode, getNode } from './node-map'\n\nconst REACTIVE_BINDINGS = new WeakMap<Node, Set<() => void>>()\n\n/**\n * Register a dispose function for a node's reactive bindings.\n * Ensures the bindings set exists and adds the dispose function to it.\n */\nfunction registerReactiveBinding(node: Node, dispose: () => void): void {\n let bindings = REACTIVE_BINDINGS.get(node)\n if (!bindings) {\n bindings = new Set()\n REACTIVE_BINDINGS.set(node, bindings)\n }\n bindings.add(dispose)\n}\n\n/**\n * Mount a virtual node reactively to the DOM.\n *\n * This is the core rendering function that handles all node types:\n * - FNodes (both built-in elements and function components)\n * - Strings and numbers (text nodes)\n * - Signals and computed values (reactive children)\n * - StateValues from the state() API\n * - ListComponents\n * - Arrays and fragments\n *\n * Reactive values are automatically tracked and DOM updates occur\n * only when the specific values change (fine-grained reactivity).\n *\n * @param vnode - The virtual node to mount\n * @param container - Optional parent node to append to\n * @returns The created DOM node, or null for empty/boolean values\n *\n * @example\n * ```tsx\n * // Mount a simple element\n * const node = mountReactive(<div>Hello</div>, document.body)\n *\n * // Mount a reactive signal\n * const count = signal(0)\n * mountReactive(() => <span>{count.value}</span>, container)\n * ```\n */\nexport function mountReactive(\n node:\n | FNode\n | string\n | number\n | boolean\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | Signal<any>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | Computed<any>\n | null\n | undefined\n | Function\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | any[]\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | ListComponent<any>,\n container?: Node\n): Node | null {\n // Handle null/undefined/boolean (falsy JSX values)\n if (node === null || node === undefined || typeof node === 'boolean') {\n return null\n }\n\n // Handle List component\n if (isListComponent(node)) {\n const parent = container || document.createDocumentFragment()\n\n const listDispose = mountListComponent(\n node,\n parent,\n (childNode) => mountReactive(childNode),\n cleanupReactive\n )\n\n // Create a marker for cleanup tracking\n const marker = document.createTextNode('')\n registerReactiveBinding(marker, listDispose)\n\n return container ? parent.firstChild : parent\n }\n\n // Handle StateValue (from state() API)\n if (isStateValue(node)) {\n const sig = getStateSignal(node)\n if (sig) {\n const startNode = document.createTextNode('')\n const parent = container || document.createDocumentFragment()\n domRenderer.appendChild(parent, startNode)\n\n let currentNode: Node | null = startNode\n\n const dispose = effect(() => {\n const value = sig.value\n const currentContainer = startNode.parentNode\n if (!currentContainer) return\n\n if (\n (typeof value === 'string' || typeof value === 'number') &&\n currentNode &&\n currentNode.nodeType === Node.TEXT_NODE &&\n currentNode !== startNode\n ) {\n domRenderer.updateTextNode(currentNode as Text, String(value))\n } else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const newNode = mountReactive(value as any)\n if (newNode) {\n if (currentNode && currentNode !== startNode) {\n if (currentNode.parentNode === currentContainer) {\n // Optimize: if both old and new are text nodes, just update content\n if (\n currentNode.nodeType === Node.TEXT_NODE &&\n newNode.nodeType === Node.TEXT_NODE\n ) {\n domRenderer.updateTextNode(\n currentNode as Text,\n newNode.textContent || ''\n )\n // Don't update currentNode reference since we reused it\n } else {\n currentContainer.replaceChild(newNode, currentNode)\n currentNode = newNode\n }\n } else {\n currentContainer.insertBefore(newNode, startNode.nextSibling)\n currentNode = newNode\n }\n } else {\n currentContainer.insertBefore(newNode, startNode.nextSibling)\n currentNode = newNode\n }\n } else {\n if (\n currentNode &&\n currentNode !== startNode &&\n currentNode.parentNode === currentContainer\n ) {\n try {\n currentContainer.removeChild(currentNode)\n } catch (e) {\n logError(ErrorCodes.DOM_CLEANUP_FAILED, { operation: 'removeChild' }, e)\n }\n }\n currentNode = startNode\n }\n }\n })\n\n registerReactiveBinding(startNode, dispose)\n\n return container ? startNode : parent\n }\n }\n\n // Handle signals and functions (reactive children)\n if (isSignal(node) || typeof node === 'function') {\n const startNode = document.createTextNode('')\n const parent = container || document.createDocumentFragment()\n domRenderer.appendChild(parent, startNode)\n\n let currentNodes: Node[] = []\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let currentFNode: any = null\n let currentFNodeList: FNode[] = []\n\n const dispose = effect(() => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const value = isSignal(node) ? (node as Signal<any>).value : (node as () => unknown)()\n const currentContainer = startNode.parentNode\n\n // Safety check: if node is detached, we can't update siblings\n if (!currentContainer) return\n\n if (Array.isArray(value)) {\n const newFNodes = value.filter((c) => c != null)\n if (currentFNodeList.length > 0) {\n const nextSibling = startNode.nextSibling\n // Note: reconcileArrays expects parent, oldFNodes, newFNodes, nextSibling\n reconcileArrays(\n currentContainer,\n currentFNodeList,\n newFNodes,\n nextSibling\n )\n } else {\n // Clean up old nodes first\n for (const childNode of currentNodes) {\n cleanupReactive(childNode)\n if (childNode.parentNode === currentContainer) {\n try {\n currentContainer.removeChild(childNode)\n } catch (e) {\n logError(ErrorCodes.DOM_CLEANUP_FAILED, { operation: 'removeChild' }, e)\n }\n }\n }\n currentNodes = []\n\n const fragment = document.createDocumentFragment()\n for (const child of newFNodes) {\n const childNode = mountReactive(child, fragment)\n if (childNode && typeof child === 'object') {\n setNode(child, childNode)\n }\n }\n currentNodes = Array.from(fragment.childNodes)\n currentContainer.insertBefore(fragment, startNode.nextSibling)\n }\n currentFNodeList = newFNodes\n currentFNode = value\n return\n }\n\n if (currentFNodeList.length > 0) {\n for (const childFNode of currentFNodeList) {\n const childNode = getNode(childFNode)\n if (childNode && childNode.parentNode === currentContainer) {\n cleanupReactive(childNode)\n try {\n currentContainer.removeChild(childNode)\n } catch (e) {\n logError(ErrorCodes.DOM_CLEANUP_FAILED, { operation: 'removeChild' }, e)\n }\n }\n }\n currentFNodeList = []\n }\n\n if (value !== currentFNode) {\n // Clean up old nodes first\n for (const childNode of currentNodes) {\n cleanupReactive(childNode)\n if (childNode.parentNode === currentContainer) {\n try {\n currentContainer.removeChild(childNode)\n } catch (e) {\n logError(ErrorCodes.DOM_CLEANUP_FAILED, { operation: 'removeChild' }, e)\n }\n }\n }\n currentNodes = []\n\n if (\n (typeof value === 'string' || typeof value === 'number')\n ) {\n const textNode = domRenderer.createTextNode(String(value))\n currentContainer.insertBefore(textNode, startNode.nextSibling)\n currentNodes = [textNode]\n } else {\n const newNode = mountReactive(value)\n if (newNode) {\n // If newNode is a fragment, track all children\n if (newNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n currentNodes = Array.from(newNode.childNodes)\n currentContainer.insertBefore(newNode, startNode.nextSibling)\n } else {\n currentContainer.insertBefore(newNode, startNode.nextSibling)\n currentNodes = [newNode]\n }\n }\n }\n currentFNode = value\n }\n })\n\n registerReactiveBinding(startNode, dispose)\n\n return container ? startNode : parent\n }\n\n if (Array.isArray(node)) {\n const fragment = document.createDocumentFragment()\n for (const child of node) {\n mountReactive(child, fragment)\n }\n if (container) {\n domRenderer.appendChild(container, fragment)\n }\n return fragment\n }\n\n // Handle text nodes\n if (typeof node === 'string' || typeof node === 'number') {\n const textNode = domRenderer.createTextNode(String(node))\n if (container) domRenderer.appendChild(container, textNode)\n return textNode\n }\n\n // Handle FNodes\n if (isFNode(node)) {\n // Handle function components\n if (typeof node.type === 'function') {\n const component = node.type\n const startNode = document.createTextNode('')\n const parent = container || document.createDocumentFragment()\n domRenderer.appendChild(parent, startNode)\n\n let currentNodes: Node[] = []\n let currentFNodeList: FNode[] = []\n\n // Create component instance for hook tracking\n const componentInstance = createComponentInstance()\n\n const dispose = effect(() => {\n try {\n // Reset hook index for each render\n resetHookIndex(componentInstance)\n\n // Use root() to track any effects created inside the component\n // These will be automatically cleaned up when disposeRoot is called\n // Use root() to track any effects created inside the component\n // These will be automatically cleaned up when disposeRoot is called\n root((disposeRoot) => {\n // Register disposeRoot to cleanup component's internal effects\n onCleanup(disposeRoot)\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const contextId = (component as any)._contextId\n if (contextId) {\n pushProvider(contextId, node.props.value)\n }\n\n let result\n try {\n // Set current component for hook tracking\n setCurrentComponent(componentInstance)\n result = component({ ...node.props, children: node.children })\n } finally {\n // Clear current component\n setCurrentComponent(null)\n }\n\n // Attempt Reconciliation for Arrays (e.g. items.map)\n // This enables efficient list updates without full re-render\n const isArray = Array.isArray(result)\n // Check if it's a list of FNodes (elements) that we can reconcile\n // We skip reconciliation for primitives or fragments to be safe for now\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const canReconcile = isArray && (result as unknown as any[]).every(item =>\n isFNode(item) && item.type !== 'fragment'\n )\n\n if (canReconcile) {\n const parent = startNode.parentNode\n if (parent) {\n // Normalize result to FNode[] (already checked, but for type safety)\n const newFNodes = result as unknown as FNode[]\n\n // Use reconcileArrays to diff/patch the DOM\n reconcileArrays(\n parent,\n currentFNodeList,\n newFNodes,\n startNode.nextSibling\n )\n\n // Update state for next render\n currentFNodeList = newFNodes\n // Update currentNodes so we know what to remove if we switch to fallback\n currentNodes = newFNodes.map(fn => getNode(fn)).filter(n => n != null) as Node[]\n return\n }\n }\n\n // Fallback: Standard Mount (Destroy & Recreate)\n // Clean up old nodes first\n const currentParent = startNode.parentNode\n if (currentParent) {\n // If we were using reconciliation, currentFNodeList handles the nodes\n // If not, currentNodes handles them.\n // We iterate currentNodes to be safe.\n for (const childNode of currentNodes) {\n cleanupReactive(childNode)\n // Only remove if still attached (reconcileArrays might have moved them)\n if (childNode.parentNode === currentParent) {\n try {\n currentParent.removeChild(childNode)\n } catch (e) {\n logError(ErrorCodes.DOM_CLEANUP_FAILED, { operation: 'removeChild' }, e)\n }\n }\n }\n }\n currentNodes = []\n currentFNodeList = []\n\n const fragment = document.createDocumentFragment()\n mountReactive(result, fragment)\n\n if (currentParent) {\n currentNodes = Array.from(fragment.childNodes)\n currentParent.insertBefore(fragment, startNode.nextSibling)\n }\n })\n } finally {\n // No popProvider needed with Owner-based context\n }\n })\n\n registerReactiveBinding(startNode, dispose)\n\n return container ? startNode : parent\n }\n\n // Handle fragments\n if (node.type === 'fragment') {\n const fragment = document.createDocumentFragment()\n for (const child of node.children) {\n mountReactive(child, fragment)\n }\n if (container) {\n domRenderer.appendChild(container, fragment)\n }\n return fragment\n }\n\n // Handle built-in elements\n const domNode = domRenderer.createNode(node.type, node.props)\n const disposeProps = setupReactiveProps(domNode, node.props)\n if (disposeProps.length > 0) {\n REACTIVE_BINDINGS.set(domNode, new Set(disposeProps))\n }\n\n for (const child of node.children) {\n mountReactive(child, domNode)\n }\n\n if (container) {\n domRenderer.appendChild(container, domNode)\n }\n\n return domNode\n }\n\n return null\n}\n\n// Sentinel value to detect first run\nconst UNINITIALIZED = Symbol('uninitialized')\n\nfunction setupReactiveProps(\n node: HTMLElement | SVGElement,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n props: Record<string, any>\n): (() => void)[] {\n const disposers: (() => void)[] = []\n for (const key in props) {\n const value = props[key]\n if (key.startsWith('on')) continue\n\n if (isSignal(value)) {\n // Track previous value to avoid unnecessary DOM updates\n // Use sentinel for first run to ensure initial value is set\n let prevValue: unknown = UNINITIALIZED\n const dispose = effect(() => {\n const newValue = value.value\n // Only update DOM if value actually changed (always update on first run)\n if (newValue !== prevValue) {\n domRenderer.updateNode(\n node,\n { [key]: prevValue === UNINITIALIZED ? undefined : prevValue },\n { [key]: newValue }\n )\n prevValue = newValue\n }\n })\n disposers.push(dispose)\n continue\n }\n\n if (typeof value === 'function') {\n // Track previous value to avoid unnecessary DOM updates\n // Use sentinel for first run to ensure initial value is set\n let prevValue: unknown = UNINITIALIZED\n const dispose = effect(() => {\n try {\n const newValue = value()\n // Only update DOM if value actually changed (always update on first run)\n if (newValue !== prevValue) {\n domRenderer.updateNode(\n node,\n { [key]: prevValue === UNINITIALIZED ? undefined : prevValue },\n { [key]: newValue }\n )\n prevValue = newValue\n }\n } catch (e) {\n logError(ErrorCodes.DOM_CLEANUP_FAILED, { operation: 'updateNode', prop: key }, e)\n }\n })\n disposers.push(dispose)\n }\n }\n return disposers\n}\n\nexport function cleanupReactive(node: Node): void {\n const bindings = REACTIVE_BINDINGS.get(node)\n if (bindings) {\n bindings.forEach((dispose) => dispose())\n REACTIVE_BINDINGS.delete(node)\n }\n if (node.childNodes && node.childNodes.length > 0) {\n const children = Array.from(node.childNodes)\n for (const child of children) {\n cleanupReactive(child)\n }\n }\n}\n\nexport function createReactiveRoot(container: HTMLElement) {\n let rootDispose: (() => void) | null = null\n let currentRootNode: Node | null = null\n\n return {\n render(node: FNode) {\n if (currentRootNode) {\n cleanupReactive(currentRootNode)\n container.innerHTML = ''\n currentRootNode = null\n }\n if (rootDispose) {\n rootDispose()\n rootDispose = null\n }\n\n rootDispose = effect(() => {\n container.innerHTML = ''\n currentRootNode = mountReactive(node, container)\n })\n },\n unmount() {\n if (rootDispose) {\n rootDispose()\n rootDispose = null\n }\n cleanupReactive(container)\n container.innerHTML = ''\n },\n }\n}\n\n/**\n * Create a reactive text node that updates when the getter returns a new value\n */\nexport function reactiveText(getText: () => string): Text {\n const textNode = document.createTextNode('')\n const dispose = effect(() => {\n const text = getText()\n domRenderer.updateTextNode(textNode, text)\n })\n registerReactiveBinding(textNode, dispose)\n return textNode\n}\n","/**\n * DOM Render Function\n *\n * This module provides the main render function for mounting components to the DOM.\n * It includes simple reconciliation logic for mounting and unmounting components.\n *\n * Note: This module uses reactive rendering internally via mountReactive.\n * For root-level rendering with cleanup support, use createReactiveRoot.\n */\n\nimport type { FNode, FNodeChild } from '../../core/renderer'\nimport { domRenderer } from './index'\nimport { isFNode } from './f'\nimport { mountReactive, createReactiveRoot } from './reactive'\n\n/**\n * Internal node data stored on DOM nodes\n */\ninterface NodeData {\n vnode: FNode | null\n props: Record<string, unknown>\n}\n\nconst NODE_DATA = new WeakMap<Node, NodeData>()\n\n/**\n * Render a component to a DOM container with automatic reactivity\n *\n * This function uses reactive rendering by default, which means:\n * - Signals passed as children automatically update the DOM\n * - Signals in props automatically update element properties\n * - Component functions automatically re-render when signals change\n *\n * @param vnode - Flexium node to render\n * @returns The rendered DOM node\n *\n * @example\n * const count = signal(0);\n * render(f('div', {}, [count]), document.body);\n * // The div will automatically update when count changes\n */\n/**\n * Mounts a Flexium node to a container\n * @param node - Flexium node to render\n * @param container - DOM element to mount to\n */\nexport function render(\n node: FNode | string | number | null | undefined | Function,\n container: HTMLElement\n): Node | null {\n // Clear container\n container.innerHTML = ''\n return mountReactive(node, container)\n}\n\n/**\n * Internal function to mount a node\n */\nfunction mountNode(node: FNodeChild | Function): Node | null {\n // Handle primitives\n if (node === null || node === undefined || typeof node === 'boolean') {\n return null\n }\n\n // Handle arrays (fragments)\n if (Array.isArray(node)) {\n const fragment = document.createDocumentFragment()\n for (const child of node) {\n const childNode = mountNode(child)\n if (childNode) {\n domRenderer.appendChild(fragment, childNode)\n }\n }\n return fragment\n }\n\n // Handle functions (signals or components returning functions)\n if (typeof node === 'function') {\n return mountNode(node())\n }\n\n // Handle strings/numbers\n if (typeof node === 'string' || typeof node === 'number') {\n return domRenderer.createTextNode(String(node))\n }\n\n // Handle FNodes\n if (isFNode(node)) {\n // Handle function components\n if (typeof node.type === 'function') {\n const component = node.type\n const result = component({ ...node.props, children: node.children })\n return mountNode(result)\n }\n\n // Handle fragments\n if (node.type === 'fragment') {\n const fragment = document.createDocumentFragment()\n for (const child of node.children) {\n const childNode = mountNode(child)\n if (childNode) {\n domRenderer.appendChild(fragment, childNode)\n }\n }\n return fragment\n }\n\n // Handle DOM elements\n const domNode = domRenderer.createNode(node.type, node.props)\n\n // Handle children\n for (const child of node.children) {\n const childNode = mountNode(child)\n if (childNode) {\n domRenderer.appendChild(domNode, childNode)\n }\n }\n\n return domNode\n }\n\n return null\n}\n\n/**\n * Unmount a DOM node and clean up\n */\nfunction unmount(node: Node): void {\n // Clean up children first\n const childNodes = Array.from(node.childNodes)\n for (const child of childNodes) {\n unmount(child)\n }\n\n // Remove from parent\n if (node.parentNode) {\n node.parentNode.removeChild(node)\n }\n\n // Clean up stored data\n NODE_DATA.delete(node)\n}\n\n/**\n * Update an existing DOM node with a new flexium node\n * (Simple implementation - will be enhanced with proper reconciliation later)\n */\nexport function update(\n node: HTMLElement,\n oldVNode: FNode,\n newVNode: FNode\n): void {\n // If types don't match, replace the node\n if (oldVNode.type !== newVNode.type) {\n const newNode = mountNode(newVNode)\n if (newNode && node.parentNode) {\n node.parentNode.replaceChild(newNode, node)\n }\n unmount(node)\n return\n }\n\n // Update props\n domRenderer.updateNode(node, oldVNode.props, newVNode.props)\n\n // Update stored data\n NODE_DATA.set(node, {\n vnode: newVNode,\n props: newVNode.props,\n })\n\n // Update children (simple approach for now)\n const oldChildren = oldVNode.children\n const newChildren = newVNode.children\n\n // Simple reconciliation: update/add/remove based on index\n const maxLength = Math.max(oldChildren.length, newChildren.length)\n\n for (let i = 0; i < maxLength; i++) {\n const oldChild = oldChildren[i]\n const newChild = newChildren[i]\n const childNode = node.childNodes[i]\n\n if (!newChild) {\n // Remove old child\n if (childNode) {\n unmount(childNode)\n }\n } else if (!oldChild) {\n // Add new child\n const newChildNode = mountNode(newChild)\n if (newChildNode) {\n domRenderer.appendChild(node, newChildNode)\n }\n } else if (typeof oldChild === 'string' || typeof oldChild === 'number') {\n // Update text node\n if (typeof newChild === 'string' || typeof newChild === 'number') {\n if (oldChild !== newChild && childNode) {\n domRenderer.updateTextNode(childNode as Text, String(newChild))\n }\n } else {\n // Replace text with element\n const newChildNode = mountNode(newChild)\n if (newChildNode && childNode) {\n node.replaceChild(newChildNode, childNode)\n unmount(childNode)\n }\n }\n } else if (isFNode(oldChild)) {\n if (typeof newChild === 'string' || typeof newChild === 'number') {\n // Replace element with text\n const newChildNode = mountNode(newChild)\n if (newChildNode && childNode) {\n node.replaceChild(newChildNode, childNode)\n unmount(childNode)\n }\n } else if (isFNode(newChild)) {\n // Update element\n if (childNode instanceof HTMLElement) {\n update(childNode, oldChild, newChild)\n }\n }\n }\n }\n}\n\n/**\n * Create a root for rendering with automatic reactivity\n *\n * This creates a root that supports fine-grained reactive updates.\n * Signals are automatically tracked and only the affected DOM nodes are updated.\n *\n * @param container - DOM element to render into\n * @returns Root object with render and unmount methods\n *\n * @example\n * const root = createRoot(document.body);\n * const count = signal(0);\n * root.render(f('div', {}, [count]));\n * // Later: count.value++ will automatically update the DOM\n */\nexport function createRoot(container: HTMLElement) {\n // Use reactive root for automatic signal tracking\n return createReactiveRoot(container)\n}\n\n","import { mountReactive, cleanupReactive } from './reactive'\nimport { onCleanup } from '../../core/signal'\n\ninterface PortalProps {\n mount?: HTMLElement\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n children: any\n}\n\n/**\n * <Portal> component renders its children into a different part of the DOM.\n * Useful for modals, tooltips, etc.\n *\n * @example\n * <Portal mount={document.body}>\n * <div class=\"modal\">...</div>\n * </Portal>\n */\nexport function Portal(props: PortalProps) {\n // SSR guard: return null placeholder on server\n if (typeof document === 'undefined') {\n return null\n }\n\n const container = props.mount || document.body\n\n // Placeholder to keep position in the VDOM tree\n const placeholder = document.createComment('portal')\n\n // We use a fragment to hold portal content references\n let portalContent: Node | null = null\n\n // Mount children to the target container\n // This runs synchronously when Portal component is executed (inside effect)\n portalContent = mountReactive(props.children, container)\n\n // Cleanup when Portal is unmounted\n onCleanup(() => {\n if (portalContent) {\n cleanupReactive(portalContent)\n if (portalContent.parentNode === container) {\n container.removeChild(portalContent)\n }\n }\n })\n\n return placeholder\n}\n"]}
|
package/dist/chunk-ROYFUJN5.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
'use strict';var s={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 S(r){return process.env.NODE_ENV!=="production"?{[s.EFFECT_EXECUTION_FAILED]:{message:"Effect execution failed",suggestion:"Check the effect callback for runtime errors. Consider wrapping async operations in try-catch."},[s.CLEANUP_OUTSIDE_EFFECT]:{message:"onCleanup must be called from within an effect",suggestion:"Move the onCleanup() call inside an effect() callback."},[s.SIGNAL_UPDATE_DURING_RENDER]:{message:"Signal was updated during render",suggestion:"Avoid updating signals inside render functions. Use effect() for side effects."},[s.CONTEXT_MISSING_PROVIDER]:{message:"Context used outside of Provider",suggestion:"Wrap your component tree with the appropriate Context.Provider."},[s.ROUTER_OUTSIDE_PROVIDER]:{message:"router() must be used within a <Router> component",suggestion:"Ensure your component is a descendant of <Router>."},[s.FORM_VALIDATION_FAILED]:{message:"Form field validation failed",suggestion:"Check the validation rules for the field and the input value."},[s.FORM_SUBMISSION_FAILED]:{message:"Form submission failed",suggestion:"Check the onSubmit handler and network connectivity."},[s.BUTTON_HANDLER_FAILED]:{message:"Button press handler failed",suggestion:"Check the onPress/onClick callback for errors."},[s.BUTTON_MISSING_ARIA_LABEL]:{message:"IconButton is missing an aria-label",suggestion:"Add an aria-label prop to IconButton for screen reader accessibility."},[s.HYDRATION_MISMATCH]:{message:"Hydration mismatch detected",suggestion:"Ensure server and client render the same content. Check for browser-only code."},[s.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."},[s.HYDRATION_TAG_MISMATCH]:{message:"Element tag mismatch during hydration",suggestion:"Server and client rendered different elements. Verify conditional rendering logic."},[s.DEVTOOLS_LISTENER_ERROR]:{message:"DevTools listener threw an error",suggestion:"Check your DevTools event listener callback."},[s.UNCAUGHT_RENDER_ERROR]:{message:"Uncaught error during render",suggestion:"Wrap components with <ErrorBoundary> to catch and handle errors gracefully."},[s.ERROR_BOUNDARY_CALLBACK_FAILED]:{message:"ErrorBoundary callback failed",suggestion:"Check your onError or onReset callback for errors."},[s.COMPUTED_EXECUTION_FAILED]:{message:"Computed value execution failed",suggestion:"Check the computed callback for runtime errors. Ensure all dependencies are valid."},[s.ASYNC_VALIDATION_FAILED]:{message:"Async form validation failed",suggestion:"Check the async validation function and ensure it handles errors properly."},[s.COMPONENT_RENDER_FAILED]:{message:"Component render failed",suggestion:"Check the component function for runtime errors. Consider wrapping with <ErrorBoundary>."},[s.HYDRATION_ATTRIBUTE_MISMATCH]:{message:"Attribute mismatch during hydration",suggestion:"Server and client rendered different attribute values. Check for dynamic attributes."},[s.DOM_CLEANUP_FAILED]:{message:"DOM cleanup operation failed",suggestion:"A node may have been removed from the DOM unexpectedly. Check for manual DOM manipulation."},[s.EVENT_HANDLER_FAILED]:{message:"Event handler threw an error",suggestion:"Check your event handler callback. Consider adding try-catch for async operations."},[s.KEYBOARD_HANDLER_FAILED]:{message:"Keyboard event handler failed",suggestion:"Check the onKeyDown/onKeyUp handler for errors."},[s.RESOURCE_FETCH_FAILED]:{message:"Resource fetch failed",suggestion:"Check the async function and network connectivity. The resource will show an error state."},[s.RESOURCE_TIMEOUT]:{message:"Resource fetch timed out",suggestion:"The async operation took too long. Consider adding a timeout handler or retry logic."}}[r]||{message:`Error ${r}`}:{message:`Minified Error ${r}`}}function y(r,e,n){let t=S(r);return {code:r,message:t.message,suggestion:t.suggestion,context:e,originalError:n}}function C(r){let e=`[Flexium ${r.code}] ${r.message}`;if(r.context&&Object.keys(r.context).length>0){let n=Object.entries(r.context).map(([t,o])=>`${t}: ${JSON.stringify(o)}`).join(", ");e+=` (${n})`;}return r.suggestion&&(e+=`
|
|
2
|
-
\u2192 ${r.suggestion}`),e}function A(r,e,n){let t=y(r,e,n),o=C(t);n?console.error(o,n):console.error(o);}function D(r,e){let n=y(r,e),t=C(n);console.warn(t);}var a=null;function w(r){a=r;}var i=null,u=null;function U(){return u}function M(r){u=r;}var f=0,p=new Set;function X(r){queueMicrotask(()=>{let e=r();e&&typeof e=="function"&&u&&u.cleanups.push(e);});}var h=class{constructor(e,n){this.fn=e;this.onError=n;this.dependencies=new Set;this.cleanups=[];this.isExecuting=false;this.isQueued=false;this.owner=null;this.owner=u;}execute(){if(this.isExecuting){this.isQueued=true;return}this.isExecuting=true;try{this.run();}finally{this.isExecuting=false,this.isQueued&&(this.isQueued=false,queueMicrotask(()=>this.execute()));}}run(){for(let t of this.cleanups)t();this.cleanups=[];for(let t of this.dependencies)t.subscribers.delete(this);this.dependencies.clear();let e=i,n=u;i=this,u=this.owner;try{let t=this.fn();typeof t=="function"&&this.cleanups.push(t);}catch(t){this.onError?this.onError(t):A(s.EFFECT_EXECUTION_FAILED,void 0,t);}finally{i=e,u=n;}}dispose(){for(let e of this.cleanups)e();this.cleanups=[];for(let e of this.dependencies)e.subscribers.delete(this);this.dependencies.clear();}},_=class{constructor(e){this._value=e;this.subscribers=new Set;}get(){return i&&(this.subscribers.add(i),i.dependencies.add(this)),this._value}set(e){this._value!==e&&(this._value=e,this.notify());}peek(){return this._value}notify(){if(f>0)this.subscribers.forEach(e=>p.add(e));else {let e=[...this.subscribers];for(let n=0;n<e.length;n++)e[n].execute();}}},I=class{constructor(e){this.computeFn=e;this.subscribers=new Set;this.dependencies=new Set;this._dirty=true;}execute(){this._dirty=true,this.notify();}get(){if(i&&i!==this&&(this.subscribers.add(i),i.dependencies.add(this)),this._dirty){this._dirty=false;for(let n of this.dependencies)n.subscribers.delete(this);this.dependencies.clear();let e=i;i=this;try{this._value=this.computeFn();}finally{i=e;}}return this._value}peek(){if(this._dirty){this._dirty=false;for(let n of this.dependencies)n.subscribers.delete(this);this.dependencies.clear();let e=i;i=this;try{this._value=this.computeFn();}finally{i=e;}}return this._value}notify(){if(f>0)this.subscribers.forEach(e=>p.add(e));else {let e=[...this.subscribers];for(let n=0;n<e.length;n++)e[n].execute();}}};function E(r){let e=new _(r),n=-1,t=function(){return e.get()};return Object.defineProperty(t,"value",{get(){return e.get()},set(o){e.set(o),n>=0&&a?.onSignalUpdate&&a.onSignalUpdate(n,o);},enumerable:true,configurable:true}),t.set=o=>{e.set(o),n>=0&&a?.onSignalUpdate&&a.onSignalUpdate(n,o);},t.peek=()=>e.peek(),t[T]=true,a?.onSignalCreate&&(n=a.onSignalCreate(t)),t}function H(r){let e=new I(r),n=function(){return e.get()};return Object.defineProperty(n,"value",{get(){return e.get()},enumerable:true,configurable:true}),n.peek=()=>e.peek(),n[T]=true,n}function L(r,e){let n=-1;a?.onEffectCreate&&(n=a.onEffectCreate(e?.name));let t=n>=0?()=>{a?.onEffectRun&&a.onEffectRun(n,"running");try{let l=r();return a?.onEffectRun&&a.onEffectRun(n,"idle"),l}catch(l){throw a?.onEffectRun&&a.onEffectRun(n,"error",l),l}}:r,o=new h(t,e?.onError);o.execute();let c=()=>o.dispose();return u&&u.cleanups.push(c),c}function P(r){let e=i;i=null;try{return r()}finally{i=e;}}function B(r){f++;try{return r()}finally{if(f--,f===0){let e=new Set(p);p.clear(),e.forEach(n=>n.execute());}}}function Y(r){let e=u,n={cleanups:[],context:e?Object.create(e.context):null};u=n;let t=()=>{for(let o of n.cleanups)o();n.cleanups=[];};try{return r(t)}finally{u=e;}}var T=Symbol("flexium.signal");function F(r){return r!==null&&typeof r=="function"&&T in r}function G(r){i instanceof h?i.cleanups.push(r):D(s.CLEANUP_OUTSIDE_EFFECT);}function V(r,e){let n=E(void 0),t=E(void 0),o=E(false),c=E("unresolved"),l=null,R=async(d,O=false)=>{O?(c.value="refreshing",o.value=true):(c.value="pending",o.value=true),t.value=void 0;let g=e(d,{value:n.peek(),refetching:O});l=g;try{let m=await g;l===g&&(n.value=m,c.value="ready",o.value=!1);}catch(m){l===g&&(t.value=m,c.value="errored",o.value=false);}},b=()=>typeof r=="function"?F(r)?r.value:r():r;L(()=>{let d=b();R(d,!1);});let v=function(){return n()};return Object.defineProperties(v,{value:{get:()=>n.value},loading:{get:()=>o.value},error:{get:()=>t.value},state:{get:()=>c.value},latest:{get:()=>n.peek()},peek:{value:()=>n.peek()},set:{value:d=>n.set(d)},read:{value:()=>{if(c.value==="pending"||c.value==="refreshing")throw l;if(c.value==="errored")throw t.value;return n.value}}}),v[T]=true,[v,{mutate:d=>n.set(d),refetch:()=>R(b(),true)}]}exports.a=s;exports.b=A;exports.c=D;exports.d=w;exports.e=U;exports.f=M;exports.g=X;exports.h=E;exports.i=H;exports.j=L;exports.k=P;exports.l=B;exports.m=Y;exports.n=F;exports.o=G;exports.p=V;//# sourceMappingURL=chunk-ROYFUJN5.js.map
|
|
3
|
-
//# sourceMappingURL=chunk-ROYFUJN5.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/errors.ts","../src/core/signal.ts"],"names":["ErrorCodes","getErrorDetails","code","createErrorInfo","context","originalError","details","formatErrorMessage","info","message","contextStr","key","value","logError","logWarning","devToolsHooks","setDevToolsHooks","hooks","activeEffect","owner","getOwner","setOwner","newOwner","batchDepth","batchQueue","onMount","fn","cleanup","EffectNode","onError","dep","prevEffect","prevOwner","result","error","SignalNode","_value","newValue","sub","subscribersToNotify","i","ComputedNode","computeFn","signal","initialValue","node","devToolsId","sig","SIGNAL_MARKER","computed","comp","effect","options","wrappedFn","dispose","untrack","prev","batch","queue","root","isSignal","onCleanup","createResource","source","fetcher","loading","state","lastPromise","load","currentSource","refetching","promise","err","getSource","resource","v"],"mappings":"aAQO,IAAMA,CAAAA,CAAa,CAExB,uBAAA,CAAyB,QAAA,CACzB,uBAAwB,QAAA,CACxB,2BAAA,CAA6B,SAC7B,yBAA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AAC,CAAE,CAAA,CACrC,IAAA,CAAM,CACJ,KAAA,CAAO,IAAM,CACX,GAAIT,CAAAA,CAAM,KAAA,GAAU,SAAA,EAAaA,CAAAA,CAAM,KAAA,GAAU,YAAA,CAC/C,MAAMC,CAAAA,CAER,GAAID,CAAAA,CAAM,KAAA,GAAU,SAAA,CAClB,MAAMhC,CAAAA,CAAM,KAAA,CAEd,OAAOtB,CAAAA,CAAM,KACf,CACF,CACF,CAAC,CAAA,CAEI8D,CAAAA,CAAiB1B,CAAa,EAAI,IAAA,CAOhC,CAAC0B,CAAAA,CALQ,CACd,MAAA,CAASC,CAAAA,EAAqB/D,CAAAA,CAAM,GAAA,CAAI+D,CAAC,CAAA,CACzC,OAAA,CAAS,IAAMP,CAAAA,CAAKK,CAAAA,EAAU,CAAG,IAAI,CACvC,CAEyB,CAC3B","file":"chunk-ROYFUJN5.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 if (process.env.NODE_ENV !== 'production') {\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 * Signal System - Fine-grained reactivity without VDOM\n *\n * Architecture:\n * - Signals are reactive primitives that notify subscribers on change\n * - Computed signals automatically track dependencies and memoize results\n * - Effects run side effects and auto-track dependencies\n * - Batching prevents cascading updates for performance\n */\n\nimport { ErrorCodes, logError, logWarning } from './errors'\n\n/**\n * DevTools hooks interface - set by devtools module to avoid circular imports\n * @internal\n */\nexport interface DevToolsHooks {\n onSignalCreate?: (signal: Signal<unknown>, name?: string) => number\n onSignalUpdate?: (id: number, value: unknown) => void\n onEffectCreate?: (name?: string) => number\n onEffectRun?: (\n id: number,\n status: 'idle' | 'running' | 'error',\n error?: Error\n ) => void\n}\n\n// Global hooks registry - set by devtools when enabled\nlet devToolsHooks: DevToolsHooks | null = null\n\n/**\n * Register devtools hooks (called by devtools module)\n * @internal\n */\nexport function setDevToolsHooks(hooks: DevToolsHooks | null): void {\n devToolsHooks = hooks\n}\n\n/**\n * Base interface for subscriber nodes\n */\ninterface ISubscriber {\n execute(): void\n dependencies: Set<IObservable>\n}\n\n/**\n * Base interface for observable nodes\n */\ninterface IObservable {\n subscribers: Set<ISubscriber>\n notify(): void\n}\n\n// Global context for dependency tracking\n// Global context for dependency tracking\nlet activeEffect: ISubscriber | null = null\n\nexport interface Owner {\n cleanups: (() => void)[]\n context: Record<symbol, unknown> | null\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// Batching state\nlet batchDepth = 0\nconst batchQueue = new Set<ISubscriber>()\n\n/**\n * Runs a function once when the component mounts.\n * Unlike effect(), onMount does not track dependencies - it runs exactly once.\n *\n * @param fn - Function to run on mount. Can return a cleanup function.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * onMount(() => {\n * console.log('Mounted!');\n * return () => console.log('Unmounted!');\n * });\n * return <div>Hello</div>;\n * }\n * ```\n */\nexport function onMount(fn: () => void | (() => void)): void {\n // Schedule the mount callback to run after the current execution\n // This ensures the component is fully rendered before mount runs\n queueMicrotask(() => {\n const cleanup = fn()\n\n // Register cleanup with owner if available\n if (cleanup && typeof cleanup === 'function' && owner) {\n owner.cleanups.push(cleanup)\n }\n })\n}\n\n/**\n * Base interface for reactive signals\n * @internal\n */\nexport interface Signal<T> {\n value: T;\n (): T\n set(value: T): void\n peek(): T\n}\n\n/**\n * Computed signal interface (read-only)\n * @internal\n */\nexport interface Computed<T> {\n readonly value: T;\n (): T\n peek(): T\n}\n\n/**\n * Internal effect node for dependency tracking\n */\nclass EffectNode implements ISubscriber {\n dependencies = new Set<IObservable>()\n cleanups: (() => void)[] = []\n private isExecuting = false\n private isQueued = false\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 = owner\n }\n\n execute(): void {\n if (this.isExecuting) {\n this.isQueued = true\n return\n }\n\n this.isExecuting = true\n\n try {\n this.run()\n } finally {\n this.isExecuting = false\n if (this.isQueued) {\n this.isQueued = false\n // Schedule microtask to avoid stack overflow and infinite sync loops\n queueMicrotask(() => this.execute())\n }\n }\n }\n\n private run(): void {\n for (const cleanup of this.cleanups) {\n cleanup()\n }\n this.cleanups = []\n\n // Clear previous dependencies\n for (const dep of this.dependencies) {\n dep.subscribers.delete(this)\n }\n this.dependencies.clear()\n\n const prevEffect = activeEffect\n const prevOwner = owner\n activeEffect = this\n owner = 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 activeEffect = prevEffect\n owner = prevOwner\n }\n }\n\n dispose(): void {\n for (const cleanup of this.cleanups) {\n cleanup()\n }\n this.cleanups = []\n for (const dep of this.dependencies) {\n dep.subscribers.delete(this)\n }\n this.dependencies.clear()\n }\n}\n\n/**\n * Internal signal node for writable signals\n */\nclass SignalNode<T> implements IObservable {\n subscribers = new Set<ISubscriber>()\n\n constructor(private _value: T) { }\n\n get(): T {\n // Track dependency if inside an effect or computed\n if (activeEffect) {\n this.subscribers.add(activeEffect)\n activeEffect.dependencies.add(this)\n }\n return this._value\n }\n\n set(newValue: T): void {\n if (this._value !== newValue) {\n this._value = newValue\n this.notify()\n }\n }\n\n peek(): T {\n return this._value\n }\n\n notify(): void {\n if (batchDepth > 0) {\n // Queue subscribers for batched execution\n this.subscribers.forEach((sub) => batchQueue.add(sub))\n } else {\n // Use array spread instead of new Set() for better performance\n // This still creates a snapshot to avoid issues when effects unsubscribe/resubscribe\n const subscribersToNotify = [...this.subscribers]\n for (let i = 0; i < subscribersToNotify.length; i++) {\n subscribersToNotify[i].execute()\n }\n }\n }\n}\n\n/**\n * Internal computed node for derived values\n */\nclass ComputedNode<T> implements ISubscriber, IObservable {\n subscribers = new Set<ISubscriber>()\n dependencies = new Set<IObservable>()\n private _value!: T\n private _dirty = true\n\n constructor(private computeFn: () => T) { }\n\n execute(): void {\n // When a dependency changes, mark as dirty and notify subscribers\n this._dirty = true\n this.notify()\n }\n\n get(): T {\n // Track dependency if inside an effect or computed\n if (activeEffect && activeEffect !== this) {\n this.subscribers.add(activeEffect)\n activeEffect.dependencies.add(this)\n }\n\n if (this._dirty) {\n this._dirty = false\n\n // Clear previous dependencies\n for (const dep of this.dependencies) {\n dep.subscribers.delete(this)\n }\n this.dependencies.clear()\n\n const prevEffect = activeEffect\n activeEffect = this\n\n try {\n this._value = this.computeFn()\n } finally {\n activeEffect = prevEffect\n }\n }\n\n return this._value\n }\n\n peek(): T {\n if (this._dirty) {\n this._dirty = false\n\n // Clear previous dependencies\n for (const dep of this.dependencies) {\n dep.subscribers.delete(this)\n }\n this.dependencies.clear()\n\n const prevEffect = activeEffect\n activeEffect = this\n\n try {\n this._value = this.computeFn()\n } finally {\n activeEffect = prevEffect\n }\n }\n return this._value\n }\n\n notify(): void {\n if (batchDepth > 0) {\n // Queue subscribers for batched execution\n this.subscribers.forEach((sub) => batchQueue.add(sub))\n } else {\n // Use array spread instead of new Set() for better performance\n // This still creates a snapshot to avoid issues when effects unsubscribe/resubscribe\n const subscribersToNotify = [...this.subscribers]\n for (let i = 0; i < subscribersToNotify.length; i++) {\n subscribersToNotify[i].execute()\n }\n }\n }\n}\n\n/**\n * Creates a reactive signal\n *\n * @param initialValue - The initial value of the signal\n * @returns A signal object with value getter/setter\n *\n * @example\n * const count = signal(0);\n * count.value++; // triggers subscribers\n * console.log(count()); // alternative getter syntax\n */\nexport function signal<T>(initialValue: T): Signal<T> {\n const node = new SignalNode(initialValue)\n let devToolsId = -1\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const sig = function (this: any) {\n return node.get()\n } as Signal<T>\n\n Object.defineProperty(sig, 'value', {\n get() {\n return node.get()\n },\n set(newValue: T) {\n node.set(newValue)\n // Notify devtools of update\n if (devToolsId >= 0 && devToolsHooks?.onSignalUpdate) {\n devToolsHooks.onSignalUpdate(devToolsId, newValue)\n }\n },\n enumerable: true,\n configurable: true,\n })\n\n sig.set = (newValue: T) => {\n node.set(newValue)\n // Notify devtools of update\n if (devToolsId >= 0 && devToolsHooks?.onSignalUpdate) {\n devToolsHooks.onSignalUpdate(devToolsId, newValue)\n }\n }\n sig.peek = () => node.peek()\n\n // Mark as signal for detection\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ; (sig as any)[SIGNAL_MARKER] = true\n\n // Register with devtools if enabled\n if (devToolsHooks?.onSignalCreate) {\n devToolsId = devToolsHooks.onSignalCreate(sig as Signal<unknown>)\n }\n\n return sig\n}\n\n/**\n * Creates a computed signal (derived value)\n * @internal Use `state(() => ...)` instead\n */\nexport function computed<T>(fn: () => T): Computed<T> {\n const node = new ComputedNode(fn)\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const comp = function (this: any) {\n return node.get()\n } as Computed<T>\n\n Object.defineProperty(comp, 'value', {\n get() {\n return node.get()\n },\n enumerable: true,\n configurable: true,\n })\n\n comp.peek = () => node.peek()\n\n // Mark as signal for detection\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ; (comp as any)[SIGNAL_MARKER] = true\n\n return comp\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 * const count = signal(0);\n * const dispose = effect(() => {\n * console.log('Count:', count.value);\n * return () => console.log('Cleanup');\n * });\n */\nexport function effect(\n fn: () => void | (() => void),\n options?: { onError?: (error: Error) => void; name?: string }\n): () => void {\n // Register with devtools before execution\n let devToolsId = -1\n if (devToolsHooks?.onEffectCreate) {\n devToolsId = devToolsHooks.onEffectCreate(options?.name)\n }\n\n // Wrap fn to track execution in devtools\n const wrappedFn =\n devToolsId >= 0\n ? () => {\n if (devToolsHooks?.onEffectRun) {\n devToolsHooks.onEffectRun(devToolsId, 'running')\n }\n try {\n const result = fn()\n if (devToolsHooks?.onEffectRun) {\n devToolsHooks.onEffectRun(devToolsId, 'idle')\n }\n return result\n } catch (error) {\n if (devToolsHooks?.onEffectRun) {\n devToolsHooks.onEffectRun(devToolsId, 'error', error as Error)\n }\n throw error\n }\n }\n : fn\n\n const node = new EffectNode(wrappedFn, options?.onError)\n node.execute()\n const dispose = () => node.dispose()\n\n if (owner) {\n owner.cleanups.push(dispose)\n }\n\n return dispose\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 *\n * @example\n * ```tsx\n * const count = signal(0);\n * const name = signal('Alice');\n *\n * effect(() => {\n * // Only re-runs when count changes, not name\n * console.log(count(), untrack(() => name()));\n * });\n * ```\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\n/**\n * Batches multiple signal updates together.\n * Effects will only run once after all updates complete.\n *\n * @param fn - Function containing signal updates to batch\n * @returns The return value of fn\n *\n * @example\n * ```tsx\n * const count = signal(0);\n * const name = signal('Alice');\n *\n * effect(() => console.log(count(), name())); // runs once\n *\n * batch(() => {\n * count.value = 1;\n * name.value = 'Bob';\n * }); // effect runs only once after batch completes\n * ```\n */\nexport function batch<T>(fn: () => T): T {\n batchDepth++\n try {\n return fn()\n } finally {\n batchDepth--\n if (batchDepth === 0) {\n // Execute all queued subscribers\n const queue = new Set(batchQueue)\n batchQueue.clear()\n queue.forEach((sub) => sub.execute())\n }\n }\n}\n\n/**\n * Creates a root scope for effects\n * All effects created within the scope can be disposed together\n *\n * @param fn - Function that creates effects\n * @returns Dispose function for all effects in the scope\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 }\n owner = newOwner\n\n const dispose = () => {\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 * Symbol to mark signals for detection\n * @internal\n */\nconst SIGNAL_MARKER = Symbol('flexium.signal')\n\n/**\n * Check if a value is a signal\n * @internal Use state() which handles all reactive patterns\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function isSignal(value: unknown): value is Signal<any> | Computed<any> {\n return value !== null && typeof value === 'function' && SIGNAL_MARKER in value\n}\n\n/**\n * Registers a cleanup function that runs before the current effect re-runs or is disposed\n *\n * @param fn - Cleanup function\n */\nexport function onCleanup(fn: () => void): void {\n if (activeEffect instanceof EffectNode) {\n activeEffect.cleanups.push(fn)\n } else {\n logWarning(ErrorCodes.CLEANUP_OUTSIDE_EFFECT)\n }\n}\n\n/**\n * Resource interface for async data\n */\nexport interface Resource<T> extends Signal<T | undefined> {\n loading: boolean\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n error: any\n state: 'unresolved' | 'pending' | 'ready' | 'refreshing' | 'errored'\n latest: T | undefined\n /**\n * Read value, throwing Promise if pending or Error if failed.\n * Used by Suspense.\n */\n read: () => T | undefined\n}\n\n/**\n * Creates a resource for handling async data\n * @internal Use state(async () => ...) instead which returns [data, refetch, status, error]\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function createResource<T, S = any>(\n source: S | Signal<S> | (() => S),\n fetcher: (\n source: S,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n { value, refetching }: { value: T | undefined; refetching: any }\n ) => Promise<T>\n): [Resource<T>, { mutate: (v: T | undefined) => void; refetch: () => void }] {\n const value = signal<T | undefined>(undefined)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const error = signal<any>(undefined)\n const loading = signal<boolean>(false)\n const state = signal<\n 'unresolved' | 'pending' | 'ready' | 'refreshing' | 'errored'\n >('unresolved')\n\n let lastPromise: Promise<T> | null = null\n\n const load = async (currentSource: S, refetching = false) => {\n if (refetching) {\n state.value = 'refreshing'\n loading.value = true\n } else {\n state.value = 'pending'\n loading.value = true\n }\n error.value = undefined\n\n const promise = fetcher(currentSource, { value: value.peek(), refetching })\n lastPromise = promise\n\n try {\n const result = await promise\n if (lastPromise === promise) {\n value.value = result\n state.value = 'ready'\n loading.value = false\n }\n } catch (err) {\n if (lastPromise === promise) {\n error.value = err\n state.value = 'errored'\n loading.value = false\n }\n }\n }\n\n const getSource = () => {\n if (typeof source === 'function') {\n if (isSignal(source)) {\n return source.value\n }\n return (source as () => S)()\n }\n return source\n }\n\n // Track source changes\n effect(() => {\n const currentSource = getSource()\n load(currentSource, false)\n })\n\n const resource = function () {\n return value()\n } as Resource<T>\n\n Object.defineProperties(resource, {\n value: { get: () => value.value },\n loading: { get: () => loading.value },\n error: { get: () => error.value },\n state: { get: () => state.value },\n latest: { get: () => value.peek() },\n peek: { value: () => value.peek() },\n set: { value: (v: T) => value.set(v) },\n read: {\n value: () => {\n if (state.value === 'pending' || state.value === 'refreshing') {\n throw lastPromise\n }\n if (state.value === 'errored') {\n throw error.value\n }\n return value.value\n },\n },\n })\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ; (resource as any)[SIGNAL_MARKER] = true\n\n const actions = {\n mutate: (v: T | undefined) => value.set(v),\n refetch: () => load(getSource(), true),\n }\n\n return [resource, actions]\n}\n"]}
|
package/dist/chunk-V4K6WOXN.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkCNY6FPKJ_js=require('./chunk-CNY6FPKJ.js'),chunkQ7IWDVJ4_js=require('./chunk-Q7IWDVJ4.js'),chunkROYFUJN5_js=require('./chunk-ROYFUJN5.js');function P(){let t=()=>({pathname:"/",search:"",hash:"",query:{}}),e=()=>typeof window>"u"?t():{pathname:window.location.pathname,search:window.location.search,hash:window.location.hash,query:D(window.location.search)},n=chunkROYFUJN5_js.h(e()),r=i=>{if(!(typeof window>"u")){if(L(i)){console.error("[Flexium Router] Blocked navigation to unsafe path:",i);return}window.history.pushState({},"",i),n.value=e();}},a=()=>{try{n.value=e();}catch(i){console.error("[Flexium Router] Error handling popstate:",i);}};return typeof window<"u"&&window.addEventListener("popstate",a),[n,r,()=>{typeof window<"u"&&window.removeEventListener("popstate",a);}]}function L(t){let e=t.trim().toLowerCase();return ["javascript:","data:","vbscript:","file:"].some(r=>e.startsWith(r))}function v(t){return t.replace(/<[^>]*>/g,"").replace(/javascript:/gi,"").replace(/on\w+\s*=/gi,"")}var F=new Set(["__proto__","constructor","prototype"]);function D(t){let e=new URLSearchParams(t),n=Object.create(null);return e.forEach((r,a)=>{let s=v(a),i=v(r);s&&!F.has(s)&&(n[s]=i);}),n}function j(t,e){let n=[],r=e.replace(/:([^/]+)/g,(u,p)=>(n.push(p),"([^/]+)")),a=new RegExp(`^${r}$`),s=t.match(a);if(!s)return {matches:false,params:{}};let i={};return s.slice(1).forEach((u,p)=>{i[n[p]]=u;}),{matches:true,params:i}}function y(t){let e=[],n=Array.isArray(t)?t:[t];for(let r of n){if(!chunkQ7IWDVJ4_js.c(r))continue;let{path:a,index:s,component:i,beforeEnter:u}=r.props,p=r.children;if(!i&&!p){console.warn(`[Flexium Router] Route "${a||"(index)"}" has no component and no children. Skipping.`);continue}let m={path:a||"",index:!!s,component:i||(()=>null),children:p?y(p):[],beforeEnter:u};e.push(m);}return e}function E(t,e){for(let n of t){let r=b(n,e,"");if(r)return r}return null}function b(t,e,n){let r=n;t.path&&(r=n.replace(/\/$/,"")+"/"+t.path.replace(/^\//,""));let a=t.children.length===0,s=N(r,!a),i=e.match(s);if(i){let[u,...p]=i,m=k(r,p),o={route:t,params:m,pathname:u};if(a)return u===e?[o]:null;for(let h of t.children){let c=b(h,e,r);if(c)return [o,...c]}if(u===e){let h=t.children.find(c=>c.index);return h?[o,{route:h,params:{},pathname:u}]:[o]}}return null}function N(t,e){let n=t.replace(/:([^/]+)/g,()=>"([^/]+)");return n==="/"&&e?new RegExp("^"):new RegExp(`^${n}${e?"(?:/|$)":"$"}`)}function k(t,e){let n={},r=0;return t.replace(/:([^/]+)/g,(a,s)=>(n[s]=e[r++],"")),n}var R=chunkCNY6FPKJ_js.a(null),f=chunkCNY6FPKJ_js.a(0);function S(){let t=chunkCNY6FPKJ_js.b(R);if(!t)throw new Error("router() must be called within a <Router> component");return t}function H(t){let[e,n]=P(),r=Array.isArray(t.children)?t.children:[t.children],a=[],s=[];for(let o of r)chunkQ7IWDVJ4_js.c(o)&&typeof o.type=="function"&&o.type===_?s.push(o):a.push(o);let i=y(s),u=chunkROYFUJN5_js.i(()=>{let o=e();return E(i,o.pathname)||[]}),p=chunkROYFUJN5_js.i(()=>{let o=u();return o.length>0?o[o.length-1].params:{}}),m={location:e,params:p,navigate:n,matches:u};return ()=>{let o=u(),h=null;if(o.length>0){let c=o[0];c.route.beforeEnter?c.route.beforeEnter(c.params)!==false&&(h=chunkQ7IWDVJ4_js.a(f.Provider,{value:1},[chunkQ7IWDVJ4_js.a("div",{key:c.route.path,style:{display:"contents"}},[chunkQ7IWDVJ4_js.a(c.route.component,{params:c.params})])])):h=chunkQ7IWDVJ4_js.a(f.Provider,{value:1},[chunkQ7IWDVJ4_js.a("div",{key:c.route.path,style:{display:"contents"}},[chunkQ7IWDVJ4_js.a(c.route.component,{params:c.params})])]);}return chunkQ7IWDVJ4_js.a(R.Provider,{value:m},[...a,chunkQ7IWDVJ4_js.a("main",{id:"main"},[h])])}}function _(t){return null}function I(){let t=chunkCNY6FPKJ_js.b(R),e=chunkCNY6FPKJ_js.b(f);return t?()=>{let n=t.matches();if(e>=n.length)return null;let r=n[e];if(r.route.beforeEnter&&r.route.beforeEnter(r.params)===false)return null;let a=r.route.component;return chunkQ7IWDVJ4_js.a(f.Provider,{value:e+1},[chunkQ7IWDVJ4_js.a(a,{params:r.params})])}:null}function J(t){let e=S(),n=r=>{r.preventDefault(),e.navigate(t.to);};return chunkQ7IWDVJ4_js.a("a",{href:t.to,class:t.class,onclick:n},t.children)}
|
|
2
|
-
exports.a=P;exports.b=L;exports.c=v;exports.d=j;exports.e=S;exports.f=H;exports.g=_;exports.h=I;exports.i=J;//# sourceMappingURL=chunk-V4K6WOXN.js.map
|
|
3
|
-
//# sourceMappingURL=chunk-V4K6WOXN.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/router/core.ts","../src/router/utils.ts","../src/router/context.ts","../src/router/components.ts"],"names":["createLocation","getDefaultLoc","getLoc","parseQuery","loc","signal","navigate","path","isUnsafePath","handlePopState","error","normalizedPath","protocol","sanitizeQueryValue","value","DANGEROUS_KEYS","search","params","query","key","sanitizedKey","sanitizedValue","matchPath","pathname","routePath","paramNames","regexPath","_","paramName","regex","match","index","createRoutesFromChildren","children","routes","childArray","child","isFNode","component","beforeEnter","nestedChildren","route","matchRoutes","location","result","matchRouteBranch","parentPath","fullPath","isLeaf","matcher","compilePath","matchedPath","paramValues","paramsObj","extractParams","currentMatch","childMatches","indexRoute","prefix","values","i","RouterCtx","createContext","RouteDepthCtx","router","ctx","context","Router","props","nonRouteChildren","routeChildren","Route","matches","computed","m","routerContext","ms","matchedContent","rootMatch","f","_props","Outlet","depth","Component","Link","r","handleClick","e"],"mappings":"iKA8BO,SAASA,CAAAA,EAAyE,CAEvF,IAAMC,CAAAA,CAAgB,KAAiB,CACrC,QAAA,CAAU,GAAA,CACV,MAAA,CAAQ,EAAA,CACR,IAAA,CAAM,EAAA,CACN,KAAA,CAAO,EACT,CAAA,CAAA,CAEMC,CAAAA,CAAS,IACT,OAAO,MAAA,CAAW,GAAA,CACbD,CAAAA,EAAc,CAEhB,CACL,QAAA,CAAU,MAAA,CAAO,QAAA,CAAS,QAAA,CAC1B,OAAQ,MAAA,CAAO,QAAA,CAAS,MAAA,CACxB,IAAA,CAAM,MAAA,CAAO,QAAA,CAAS,IAAA,CACtB,KAAA,CAAOE,CAAAA,CAAW,MAAA,CAAO,QAAA,CAAS,MAAM,CAC1C,CAAA,CAGIC,CAAAA,CAAMC,kBAAAA,CAAOH,CAAAA,EAAQ,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QhB,kBAAAA,CAAQH,CAAa,CAAA,CAGnC,OAAKC,CAAAA,CAEE,IAAM,CACX,IAAMY,EAAKZ,CAAAA,CAAO,OAAA,EAAQ,CAG1B,GAAIkB,CAAAA,EAASN,CAAAA,CAAG,MAAA,CAAQ,OAAO,IAAA,CAE/B,IAAM9C,CAAAA,CAAQ8C,CAAAA,CAAGM,CAAK,CAAA,CAGtB,GAAIpD,CAAAA,CAAM,KAAA,CAAM,WAAA,EACCA,CAAAA,CAAM,KAAA,CAAM,WAAA,CAAYA,CAAAA,CAAM,MAAM,CAAA,GACpC,KAAA,CAAO,OAAO,IAAA,CAG/B,IAAMqD,CAAAA,CAAYrD,CAAAA,CAAM,MAAM,SAAA,CAG9B,OAAOiD,kBAAAA,CAAEhB,CAAAA,CAAc,QAAA,CAAU,CAAE,KAAA,CAAOmB,CAAAA,CAAQ,CAAE,CAAA,CAAG,CACrDH,kBAAAA,CAAEI,CAAAA,CAAW,CAAE,MAAA,CAAQrD,CAAAA,CAAM,MAAO,CAAC,CACvC,CAAC,CACH,CAAA,CAtBoB,IAuBtB,CAEO,SAASsD,CAAAA,CAAKhB,CAAAA,CAAkB,CACrC,IAAMiB,CAAAA,CAAIrB,GAAO,CAEXsB,CAAAA,CAAeC,CAAAA,EAAa,CAChCA,CAAAA,CAAE,cAAA,EAAe,CACjBF,CAAAA,CAAE,QAAA,CAASjB,CAAAA,CAAM,EAAE,EACrB,CAAA,CAEA,OAAOW,kBAAAA,CACL,GAAA,CACA,CACE,IAAA,CAAMX,CAAAA,CAAM,EAAA,CACZ,KAAA,CAAOA,CAAAA,CAAM,KAAA,CACb,OAAA,CAASkB,CACX,CAAA,CACAlB,CAAAA,CAAM,QACR,CACF","file":"chunk-V4K6WOXN.js","sourcesContent":["/**\n * Router Core Module\n *\n * Provides core routing functionality including location management,\n * path matching, and navigation.\n */\n\nimport { signal, Signal } from '../core/signal'\nimport { Location } from './types'\n\n/**\n * Creates a reactive location signal and navigate function.\n *\n * The location signal automatically updates when:\n * - navigate() is called\n * - Browser back/forward buttons are used (popstate event)\n *\n * @returns Tuple of [location signal, navigate function, cleanup function]\n *\n * @example\n * ```tsx\n * const [location, navigate, cleanup] = createLocation();\n * // Access current path\n * console.log(location().pathname);\n * // Navigate to new path\n * navigate('/users/123');\n * // Cleanup when done (removes popstate listener)\n * cleanup();\n * ```\n */\nexport function createLocation(): [Signal<Location>, (path: string) => void, () => void] {\n // SSR guard: return safe defaults on server\n const getDefaultLoc = (): Location => ({\n pathname: '/',\n search: '',\n hash: '',\n query: {},\n })\n\n const getLoc = (): Location => {\n if (typeof window === 'undefined') {\n return getDefaultLoc()\n }\n return {\n pathname: window.location.pathname,\n search: window.location.search,\n hash: window.location.hash,\n query: parseQuery(window.location.search),\n }\n }\n\n const loc = signal(getLoc())\n\n const navigate = (path: string) => {\n // SSR guard\n if (typeof window === 'undefined') return\n\n // Security: Validate path to prevent javascript: and other dangerous protocols\n if (isUnsafePath(path)) {\n console.error('[Flexium Router] Blocked navigation to unsafe path:', path)\n return\n }\n window.history.pushState({}, '', path)\n loc.value = getLoc()\n }\n\n // SSR guard for popstate listener\n const handlePopState = () => {\n try {\n loc.value = getLoc()\n } catch (error) {\n console.error('[Flexium Router] Error handling popstate:', error)\n }\n }\n\n if (typeof window !== 'undefined') {\n window.addEventListener('popstate', handlePopState)\n }\n\n // Cleanup function to remove listener\n const cleanup = () => {\n if (typeof window !== 'undefined') {\n window.removeEventListener('popstate', handlePopState)\n }\n }\n\n return [loc, navigate, cleanup]\n}\n\n/**\n * Check if a path contains unsafe protocols (XSS prevention)\n * @param path - Path to validate\n * @returns true if path is unsafe\n */\nexport function isUnsafePath(path: string): boolean {\n const normalizedPath = path.trim().toLowerCase()\n const unsafeProtocols = ['javascript:', 'data:', 'vbscript:', 'file:']\n return unsafeProtocols.some(protocol => normalizedPath.startsWith(protocol))\n}\n\n/**\n * Sanitize query parameter value to prevent XSS\n * @param value - Query parameter value\n * @returns Sanitized value\n */\nexport function sanitizeQueryValue(value: string): string {\n // Remove potential script tags and event handlers\n return value\n .replace(/<[^>]*>/g, '') // Remove HTML tags\n .replace(/javascript:/gi, '') // Remove javascript: protocol\n .replace(/on\\w+\\s*=/gi, '') // Remove event handlers like onclick=\n}\n\n/**\n * Parses URL search string into key-value object\n * @param search - URL search string (e.g., \"?foo=bar&baz=qux\")\n * @returns Object with query parameters\n */\n// Dangerous keys that could lead to prototype pollution\nconst DANGEROUS_KEYS = new Set(['__proto__', 'constructor', 'prototype'])\n\nfunction parseQuery(search: string): Record<string, string> {\n const params = new URLSearchParams(search)\n // Use Object.create(null) to prevent prototype pollution\n const query: Record<string, string> = Object.create(null)\n params.forEach((value, key) => {\n // Sanitize both key and value to prevent XSS\n const sanitizedKey = sanitizeQueryValue(key)\n const sanitizedValue = sanitizeQueryValue(value)\n // Block dangerous keys to prevent prototype pollution\n if (sanitizedKey && !DANGEROUS_KEYS.has(sanitizedKey)) {\n query[sanitizedKey] = sanitizedValue\n }\n })\n return query\n}\n\n/**\n * Matches a pathname against a route pattern.\n *\n * Supports dynamic segments with `:param` syntax.\n *\n * @param pathname - Current URL pathname (e.g., \"/users/123\")\n * @param routePath - Route pattern (e.g., \"/users/:id\")\n * @returns Object with `matches` boolean and extracted `params`\n *\n * @example\n * ```tsx\n * const result = matchPath('/users/123', '/users/:id');\n * // { matches: true, params: { id: '123' } }\n * ```\n */\nexport function matchPath(\n pathname: string,\n routePath: string\n): { matches: boolean; params: Record<string, string> } {\n const paramNames: string[] = []\n const regexPath = routePath.replace(/:([^/]+)/g, (_, paramName) => {\n paramNames.push(paramName)\n return '([^/]+)'\n })\n\n const regex = new RegExp(`^${regexPath}$`)\n const match = pathname.match(regex)\n\n if (!match) {\n return { matches: false, params: {} }\n }\n\n const params: Record<string, string> = {}\n match.slice(1).forEach((value, index) => {\n params[paramNames[index]] = value\n })\n\n return { matches: true, params }\n}\n","import { RouteDef, RouteMatch } from './types'\nimport type { FNodeChild } from '../core/renderer'\nimport { isFNode } from '../renderers/dom/f'\n\n/**\n * Flatten the children of <Router> or <Route> into a route configuration tree.\n * Note: This assumes `children` are FNodes representing <Route> components.\n */\nexport function createRoutesFromChildren(children: FNodeChild): RouteDef[] {\n const routes: RouteDef[] = []\n\n const childArray = Array.isArray(children) ? children : [children]\n\n for (const child of childArray) {\n if (!isFNode(child)) {\n continue\n }\n\n const { path, index, component, beforeEnter } = child.props as {\n path?: string\n index?: boolean\n component?: Function\n beforeEnter?: (\n params: Record<string, string>\n ) => boolean | Promise<boolean>\n }\n const nestedChildren = child.children\n\n // Skip routes without a component (unless they have children as layout routes)\n if (!component && !nestedChildren) {\n console.warn(\n `[Flexium Router] Route \"${path || '(index)'}\" has no component and no children. Skipping.`\n )\n continue\n }\n\n const route: RouteDef = {\n path: path || '',\n index: !!index,\n component: component || (() => null),\n children: nestedChildren ? createRoutesFromChildren(nestedChildren) : [],\n beforeEnter,\n }\n\n routes.push(route)\n }\n\n return routes\n}\n\n/**\n * Match a URL against a route tree.\n * Returns an array of matches (from root to leaf).\n */\nexport function matchRoutes(\n routes: RouteDef[],\n location: string\n): RouteMatch[] | null {\n for (const route of routes) {\n const result = matchRouteBranch(route, location, '')\n if (result) return result\n }\n return null\n}\n\nfunction matchRouteBranch(\n route: RouteDef,\n location: string,\n parentPath: string\n): RouteMatch[] | null {\n let fullPath = parentPath\n if (route.path) {\n fullPath =\n parentPath.replace(/\\/$/, '') + '/' + route.path.replace(/^\\//, '')\n }\n\n const isLeaf = route.children.length === 0\n const matcher = compilePath(fullPath, !isLeaf)\n const match = location.match(matcher)\n\n if (match) {\n const [matchedPath, ...paramValues] = match\n const paramsObj = extractParams(fullPath, paramValues)\n\n const currentMatch: RouteMatch = {\n route,\n params: paramsObj,\n pathname: matchedPath,\n }\n\n if (isLeaf) {\n // Exact match required for leaf\n if (matchedPath === location) return [currentMatch]\n return null\n }\n\n // Has children: try to match one of them\n // If no children match, and this route is an index route?\n // Or if this route matches partially, maybe an index child matches the rest?\n\n for (const child of route.children) {\n const childMatches = matchRouteBranch(child, location, fullPath)\n if (childMatches) {\n return [currentMatch, ...childMatches]\n }\n }\n\n // If no children matched, but we matched exactly this layout route?\n // E.g. /users matches /users layout, and maybe it renders index?\n if (matchedPath === location) {\n // Check for index route\n const indexRoute = route.children.find((c) => c.index)\n if (indexRoute) {\n return [\n currentMatch,\n { route: indexRoute, params: {}, pathname: matchedPath },\n ]\n }\n // Just the layout? Maybe.\n return [currentMatch]\n }\n }\n\n return null\n}\n\nfunction compilePath(path: string, prefix: boolean): RegExp {\n const regexPath = path.replace(/:([^/]+)/g, () => '([^/]+)')\n\n // If path is exactly \"/\", and we want prefix matching, it should match everything\n if (regexPath === '/' && prefix) {\n return new RegExp('^')\n }\n\n // If prefix matching allowed, ensure we match segment boundary\n return new RegExp(`^${regexPath}${prefix ? '(?:/|$)' : '$'}`)\n}\n\nfunction extractParams(path: string, values: string[]): Record<string, string> {\n const params: Record<string, string> = {}\n let i = 0\n // Re-parse to find param names... inefficient but works\n path.replace(/:([^/]+)/g, (_, paramName) => {\n params[paramName] = values[i++]\n return ''\n })\n return params\n}\n","import { createContext } from '../core/context'\nimport { RouterContext } from './types'\n\n// Global Router Context\nexport const RouterCtx = createContext<RouterContext | null>(null)\n\n// Current Route Depth Context (for Outlet)\n// Stores the index of the current match in the `matches` array\nexport const RouteDepthCtx = createContext<number>(0)\n","import { computed } from '../core/signal'\nimport { createLocation } from './core'\nimport { createRoutesFromChildren, matchRoutes } from './utils'\nimport { LinkProps, RouteProps, RouterContext } from './types'\nimport { f, isFNode } from '../renderers/dom/f'\nimport { RouterCtx, RouteDepthCtx } from './context'\nimport { context } from '../core/context'\nimport type { FNodeChild } from '../core/renderer'\n\n/**\n * Get the current router context.\n * Must be called within a <Router> component.\n *\n * @example\n * ```tsx\n * const r = router()\n * r.navigate('/dashboard')\n * ```\n */\nexport function router(): RouterContext {\n const ctx = context(RouterCtx)\n if (!ctx) {\n throw new Error('router() must be called within a <Router> component')\n }\n return ctx\n}\n\nexport function Router(props: { children: FNodeChild }) {\n const [location, navigate] = createLocation()\n\n // Separate Route children from non-Route children (like Nav, etc.)\n const childArray = Array.isArray(props.children) ? props.children : [props.children]\n const nonRouteChildren: FNodeChild[] = []\n const routeChildren: FNodeChild[] = []\n\n for (const child of childArray) {\n if (isFNode(child) && typeof child.type === 'function' && child.type === Route) {\n routeChildren.push(child)\n } else {\n nonRouteChildren.push(child)\n }\n }\n\n // Parse route configuration from Route children only\n const routes = createRoutesFromChildren(routeChildren)\n\n // Compute matches\n const matches = computed(() => {\n const loc = location()\n return matchRoutes(routes, loc.pathname) || []\n })\n\n const params = computed(() => {\n const m = matches()\n if (m.length > 0) {\n return m[m.length - 1].params\n }\n return {}\n })\n\n const routerContext: RouterContext = {\n location,\n params,\n navigate,\n matches,\n }\n\n return () => {\n const ms = matches()\n\n // Matched route component (or null if no match)\n let matchedContent: FNodeChild = null\n if (ms.length > 0) {\n const rootMatch = ms[0]\n\n // Check beforeEnter guard\n if (rootMatch.route.beforeEnter) {\n const result = rootMatch.route.beforeEnter(rootMatch.params)\n if (result !== false) {\n matchedContent = f(RouteDepthCtx.Provider, { value: 1 }, [\n f('div', { key: rootMatch.route.path, style: { display: 'contents' } }, [\n f(rootMatch.route.component, { params: rootMatch.params }),\n ]),\n ])\n }\n } else {\n matchedContent = f(RouteDepthCtx.Provider, { value: 1 }, [\n f('div', { key: rootMatch.route.path, style: { display: 'contents' } }, [\n f(rootMatch.route.component, { params: rootMatch.params }),\n ]),\n ])\n }\n }\n\n // Render non-Route children (like Nav) and the matched route wrapped in main\n return f(RouterCtx.Provider, { value: routerContext }, [\n ...nonRouteChildren,\n f('main', { id: 'main' }, [matchedContent]),\n ])\n }\n}\n\n/**\n * Route configuration component.\n * Doesn't render anything directly; used by Router to build the route tree.\n */\nexport function Route(_props: RouteProps) {\n return null\n}\n\n/**\n * Renders the child route content.\n */\nexport function Outlet() {\n const router = context(RouterCtx)\n const depth = context(RouteDepthCtx) // Default 0\n\n // Safety check\n if (!router) return null\n\n return () => {\n const ms = router.matches()\n\n // Check if we have a match at this depth\n if (depth >= ms.length) return null\n\n const match = ms[depth]\n\n // Check beforeEnter guard\n if (match.route.beforeEnter) {\n const result = match.route.beforeEnter(match.params)\n if (result === false) return null\n }\n\n const Component = match.route.component\n\n // Render component and provide next depth\n return f(RouteDepthCtx.Provider, { value: depth + 1 }, [\n f(Component, { params: match.params }),\n ])\n }\n}\n\nexport function Link(props: LinkProps) {\n const r = router()\n\n const handleClick = (e: Event) => {\n e.preventDefault()\n r.navigate(props.to)\n }\n\n return f(\n 'a',\n {\n href: props.to,\n class: props.class,\n onclick: handleClick,\n },\n props.children\n )\n}\n"]}
|
package/dist/signal-PWBIM6JV.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export{l as batch,i as computed,p as createResource,j as effect,e as getOwner,n as isSignal,o as onCleanup,g as onMount,m as root,d as setDevToolsHooks,f as setOwner,h as signal,k as untrack}from'./chunk-5S3ZQ2LB.mjs';//# sourceMappingURL=signal-PWBIM6JV.mjs.map
|
|
2
|
-
//# sourceMappingURL=signal-PWBIM6JV.mjs.map
|
package/dist/signal-XZXQ4VYQ.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkROYFUJN5_js=require('./chunk-ROYFUJN5.js');Object.defineProperty(exports,"batch",{enumerable:true,get:function(){return chunkROYFUJN5_js.l}});Object.defineProperty(exports,"computed",{enumerable:true,get:function(){return chunkROYFUJN5_js.i}});Object.defineProperty(exports,"createResource",{enumerable:true,get:function(){return chunkROYFUJN5_js.p}});Object.defineProperty(exports,"effect",{enumerable:true,get:function(){return chunkROYFUJN5_js.j}});Object.defineProperty(exports,"getOwner",{enumerable:true,get:function(){return chunkROYFUJN5_js.e}});Object.defineProperty(exports,"isSignal",{enumerable:true,get:function(){return chunkROYFUJN5_js.n}});Object.defineProperty(exports,"onCleanup",{enumerable:true,get:function(){return chunkROYFUJN5_js.o}});Object.defineProperty(exports,"onMount",{enumerable:true,get:function(){return chunkROYFUJN5_js.g}});Object.defineProperty(exports,"root",{enumerable:true,get:function(){return chunkROYFUJN5_js.m}});Object.defineProperty(exports,"setDevToolsHooks",{enumerable:true,get:function(){return chunkROYFUJN5_js.d}});Object.defineProperty(exports,"setOwner",{enumerable:true,get:function(){return chunkROYFUJN5_js.f}});Object.defineProperty(exports,"signal",{enumerable:true,get:function(){return chunkROYFUJN5_js.h}});Object.defineProperty(exports,"untrack",{enumerable:true,get:function(){return chunkROYFUJN5_js.k}});//# sourceMappingURL=signal-XZXQ4VYQ.js.map
|
|
2
|
-
//# sourceMappingURL=signal-XZXQ4VYQ.js.map
|