flexium 0.13.0 → 0.13.1

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.
Files changed (78) hide show
  1. package/README.md +14 -8
  2. package/dist/canvas.js +1 -1
  3. package/dist/canvas.js.map +1 -1
  4. package/dist/canvas.mjs +1 -1
  5. package/dist/canvas.mjs.map +1 -1
  6. package/dist/chunk-3AKECLKA.mjs +2 -0
  7. package/dist/chunk-3AKECLKA.mjs.map +1 -0
  8. package/dist/chunk-ACYN2UKT.js +2 -0
  9. package/dist/chunk-ACYN2UKT.js.map +1 -0
  10. package/dist/chunk-E6Z7AI4J.js +2 -0
  11. package/dist/chunk-E6Z7AI4J.js.map +1 -0
  12. package/dist/chunk-MI76R42D.mjs +2 -0
  13. package/dist/chunk-MI76R42D.mjs.map +1 -0
  14. package/dist/chunk-PUXZJ7OV.js +2 -0
  15. package/dist/{chunk-X6HXRSMG.js.map → chunk-PUXZJ7OV.js.map} +1 -1
  16. package/dist/chunk-TP5HUAIN.mjs +2 -0
  17. package/dist/{chunk-JUP6RTZA.mjs.map → chunk-TP5HUAIN.mjs.map} +1 -1
  18. package/dist/core.d.cts +32 -2
  19. package/dist/core.d.ts +32 -2
  20. package/dist/core.js +1 -1
  21. package/dist/core.js.map +1 -1
  22. package/dist/core.mjs +1 -1
  23. package/dist/core.mjs.map +1 -1
  24. package/dist/dom.js +1 -1
  25. package/dist/dom.js.map +1 -1
  26. package/dist/dom.mjs +1 -1
  27. package/dist/dom.mjs.map +1 -1
  28. package/dist/index.d.cts +1 -1
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.js +1 -1
  31. package/dist/index.js.map +1 -1
  32. package/dist/index.mjs +1 -1
  33. package/dist/index.mjs.map +1 -1
  34. package/dist/interactive.d.cts +3 -3
  35. package/dist/interactive.d.ts +3 -3
  36. package/dist/interactive.js +1 -1
  37. package/dist/interactive.js.map +1 -1
  38. package/dist/interactive.mjs +1 -1
  39. package/dist/interactive.mjs.map +1 -1
  40. package/dist/metafile-cjs.json +1 -1
  41. package/dist/metafile-esm.json +1 -1
  42. package/dist/render-4HB53K66.mjs +2 -0
  43. package/dist/{render-L57MA662.mjs.map → render-4HB53K66.mjs.map} +1 -1
  44. package/dist/render-MJ2LCNSG.js +2 -0
  45. package/dist/{render-VERKNIPR.js.map → render-MJ2LCNSG.js.map} +1 -1
  46. package/dist/router.js +1 -1
  47. package/dist/router.js.map +1 -1
  48. package/dist/router.mjs +1 -1
  49. package/dist/router.mjs.map +1 -1
  50. package/dist/server.js +1 -1
  51. package/dist/server.js.map +1 -1
  52. package/dist/server.mjs +1 -1
  53. package/dist/server.mjs.map +1 -1
  54. package/package.json +1 -6
  55. package/dist/advanced.d.cts +0 -5
  56. package/dist/advanced.d.ts +0 -5
  57. package/dist/advanced.js +0 -2
  58. package/dist/advanced.js.map +0 -1
  59. package/dist/advanced.mjs +0 -2
  60. package/dist/advanced.mjs.map +0 -1
  61. package/dist/chunk-5PNH2ARD.mjs +0 -2
  62. package/dist/chunk-5PNH2ARD.mjs.map +0 -1
  63. package/dist/chunk-CGB4YXKS.js +0 -2
  64. package/dist/chunk-CGB4YXKS.js.map +0 -1
  65. package/dist/chunk-INJXOHFD.mjs +0 -2
  66. package/dist/chunk-INJXOHFD.mjs.map +0 -1
  67. package/dist/chunk-JUP6RTZA.mjs +0 -2
  68. package/dist/chunk-NDPEE2TQ.mjs +0 -2
  69. package/dist/chunk-NDPEE2TQ.mjs.map +0 -1
  70. package/dist/chunk-UWFVCKRU.js +0 -2
  71. package/dist/chunk-UWFVCKRU.js.map +0 -1
  72. package/dist/chunk-W2L7BLE7.js +0 -2
  73. package/dist/chunk-W2L7BLE7.js.map +0 -1
  74. package/dist/chunk-X6HXRSMG.js +0 -2
  75. package/dist/render-L57MA662.mjs +0 -2
  76. package/dist/render-VERKNIPR.js +0 -2
  77. package/dist/types--emg3Tgw.d.cts +0 -10
  78. package/dist/types--emg3Tgw.d.ts +0 -10
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/dom/render.ts"],"names":["instanceRegistry","currentRenderingInstance","removeComponentInstance","instance","child","node","renderComponent","fnode","parent","registryParent","effectiveRegistryParent","mergeProps","props","hasExplicitKey","parentRegistry","key","instanceCount","componentName","_","k","newProps","isFirstRender","renderFn","currentFnode","currentProps","pushContext","previousRenderingInstance","result","runWithComponent","newNodes","renderNode","nodeParent","marker","lastNode","tempContainer","newNodesArray","reconciledNodes","reconcile","unsafeEffect","oldKeysSet","nodes","newKeysSet","keysToRemove","dom","value","eventName","setAttribute","el","canReuse","oldNode","newNode","updateAttributes","oldEl","newEl","attr","oldHandlers","newHandlers","event","reconcileChildren","oldChildren","newChildren","maxLen","i","oldChild","newChild","patchNode","ownerInstance","idx","oldNodes","beforeMarker","resultNodes","render","app","container"],"mappings":"+GAiBA,IAAMA,CAAAA,CAAmB,IAAI,OAAA,CAGzBC,CAAAA,CAAwD,KAG5D,SAASC,CAAAA,CAAwBC,CAAAA,CAAsC,CACnEA,EAAS,QAAA,CAAS,OAAA,CAAQC,CAAAA,EAAS,CAC/BF,EAAwBE,CAAK,EACjC,CAAC,CAAA,CAEDD,CAAAA,CAAS,KAAA,CAAM,OAAA,CAAQE,CAAAA,EAAQ,CACvBA,CAAAA,CAAK,UAAA,EACLA,CAAAA,CAAK,UAAA,CAAW,YAAYA,CAAI,EAExC,CAAC,CAAA,CAEDF,EAAS,QAAA,CAAS,KAAA,EAAM,CAEpBA,CAAAA,CAAS,cAAA,EACTA,CAAAA,CAAS,cAAA,CAAe,QAAA,CAAS,OAAOA,CAAQ,EAExD,CAGA,SAASG,EAAgBC,CAAAA,CAAYC,CAAAA,CAAqBC,CAAAA,CAAsC,CAC5F,IAAMC,GAAAA,CAA0BD,CAAAA,EAAkBD,CAAAA,CAE5CG,CAAAA,CAAcN,GAAc,CAC9B,IAAMO,CAAAA,CAAQ,CAAE,GAAGP,CAAAA,CAAK,KAAM,CAAA,CAC9B,OAAIA,EAAK,QAAA,EAAYA,CA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,UAAY,EAAA,CAElB,OAAOD,CAAAA,EAAQ,UAAA,GACfA,EAAM,CAAE,IAAA,CAAMA,CAAAA,CAAK,KAAA,CAAO,EAAC,CAAG,QAAA,CAAU,EAAC,CAAG,IAAK,MAAU,CAAA,CAAA,CAG/D1C,CAAAA,CAAW0C,CAAAA,CAAKC,CAAS,EAC7B","file":"chunk-JUP6RTZA.mjs","sourcesContent":["import { pushContext } from '../core/context'\nimport { runWithComponent, type ComponentInstance } from '../core/hook'\nimport { unsafeEffect } from '../core/lifecycle'\n\n// Extended ComponentInstance for DOM tracking\ninterface DOMComponentInstance extends ComponentInstance {\n nodes: Node[]\n parent: HTMLElement\n fnode: any\n props: any\n key?: any\n renderFn?: () => void\n children: Set<DOMComponentInstance>\n parentInstance?: DOMComponentInstance\n}\n\n// Registry to store component instances by parent and key\nconst instanceRegistry = new WeakMap<HTMLElement, Map<any, DOMComponentInstance>>()\n\n// Current rendering component instance (for tracking parent-child relationships)\nlet currentRenderingInstance: DOMComponentInstance | null = null\n\n// Recursively remove component instance and all its children\nfunction removeComponentInstance(instance: DOMComponentInstance): void {\n instance.children.forEach(child => {\n removeComponentInstance(child)\n })\n\n instance.nodes.forEach(node => {\n if (node.parentNode) {\n node.parentNode.removeChild(node)\n }\n })\n\n instance.children.clear()\n\n if (instance.parentInstance) {\n instance.parentInstance.children.delete(instance)\n }\n}\n\n// Render a function component with reactive re-rendering\nfunction renderComponent(fnode: any, parent: HTMLElement, registryParent?: HTMLElement): Node[] {\n const effectiveRegistryParent = registryParent || parent\n\n const mergeProps = (node: any) => {\n const props = { ...node.props }\n if (node.children && node.children.length > 0) {\n props.children = node.children.length === 1\n ? node.children[0]\n : node.children\n }\n return props\n }\n\n const hasExplicitKey = fnode.key !== undefined\n\n if (!instanceRegistry.has(effectiveRegistryParent)) {\n instanceRegistry.set(effectiveRegistryParent, new Map())\n }\n const parentRegistry = instanceRegistry.get(effectiveRegistryParent)!\n\n let key: any\n if (hasExplicitKey) {\n key = fnode.key\n } else {\n let instanceCount = 0\n const componentName = fnode.type.name || 'anonymous'\n parentRegistry.forEach((_, k) => {\n if (typeof k === 'string' && k.startsWith(`__auto_${componentName}_`)) {\n instanceCount++\n }\n })\n key = `__auto_${componentName}_${instanceCount}`\n }\n\n if (parentRegistry.has(key)) {\n const instance = parentRegistry.get(key)!\n instance.fnode = fnode\n const newProps = mergeProps(fnode)\n instance.props = newProps\n instance.children.clear()\n\n if (instance.renderFn) {\n instance.renderFn()\n }\n\n return instance.nodes\n }\n\n const instance: DOMComponentInstance = {\n hooks: [],\n hookIndex: 0,\n nodes: [],\n parent,\n fnode: fnode,\n props: mergeProps(fnode),\n key,\n children: new Set(),\n parentInstance: currentRenderingInstance || undefined\n }\n\n if (currentRenderingInstance) {\n currentRenderingInstance.children.add(instance)\n }\n\n parentRegistry.set(key, instance)\n\n let isFirstRender = true\n\n const renderFn = () => {\n const currentFnode = instance.fnode\n const currentProps = instance.props\n\n const isProvider = (currentFnode.type as any)._contextId !== undefined\n if (isProvider) {\n pushContext((currentFnode.type as any)._contextId, currentProps.value)\n }\n\n const previousRenderingInstance = currentRenderingInstance\n currentRenderingInstance = instance\n\n const result = runWithComponent(instance, () => currentFnode.type(currentProps))\n\n if (isFirstRender) {\n const newNodes = renderNode(result, parent)\n instance.nodes = newNodes ? (Array.isArray(newNodes) ? newNodes : [newNodes]) : []\n instance.nodes.forEach(node => {\n if (!(node as any).__ownerInstance) {\n (node as any).__ownerInstance = instance\n }\n })\n isFirstRender = false\n } else {\n if (instance.nodes.length === 0) {\n const newNodes = renderNode(result, parent)\n instance.nodes = newNodes ? (Array.isArray(newNodes) ? newNodes : [newNodes]) : []\n currentRenderingInstance = previousRenderingInstance\n return\n }\n\n const firstNode = instance.nodes[0]\n const nodeParent = firstNode.parentNode as HTMLElement\n\n if (!nodeParent) {\n currentRenderingInstance = previousRenderingInstance\n return\n }\n\n const marker = document.createComment('flexium-marker')\n const lastNode = instance.nodes[instance.nodes.length - 1]\n if (lastNode.nextSibling) {\n nodeParent.insertBefore(marker, lastNode.nextSibling)\n } else {\n nodeParent.appendChild(marker)\n }\n\n instance.children.clear()\n\n const tempContainer = document.createElement('div')\n const newNodes = renderNode(result, tempContainer, nodeParent)\n const newNodesArray = newNodes ? (Array.isArray(newNodes) ? newNodes : [newNodes]) : []\n\n const reconciledNodes = reconcile(instance.nodes, newNodesArray, nodeParent, marker)\n\n nodeParent.removeChild(marker)\n\n instance.nodes = reconciledNodes\n }\n\n currentRenderingInstance = previousRenderingInstance\n }\n\n instance.renderFn = renderFn\n\n unsafeEffect(renderFn)\n\n return instance.nodes\n}\n\nfunction renderNode(fnode: any, parent: HTMLElement, registryParent?: HTMLElement): Node | Node[] | null {\n const effectiveRegistryParent = registryParent || parent\n\n if (fnode === null || fnode === undefined || typeof fnode === 'boolean') {\n const node = document.createTextNode('')\n parent.appendChild(node)\n return node\n }\n\n if (typeof fnode === 'string' || typeof fnode === 'number') {\n const node = document.createTextNode(String(fnode))\n parent.appendChild(node)\n return node\n }\n\n if (Array.isArray(fnode)) {\n const oldKeysSet = new Set<any>()\n if (instanceRegistry.has(effectiveRegistryParent)) {\n const parentRegistry = instanceRegistry.get(effectiveRegistryParent)!\n parentRegistry.forEach((_, key) => oldKeysSet.add(key))\n }\n\n const nodes: Node[] = []\n fnode.forEach((child) => {\n const result = renderNode(child, parent, registryParent)\n if (result) {\n if (Array.isArray(result)) {\n nodes.push(...result)\n } else {\n nodes.push(result)\n }\n }\n })\n\n const newKeysSet = new Set<any>()\n if (instanceRegistry.has(effectiveRegistryParent)) {\n const parentRegistry = instanceRegistry.get(effectiveRegistryParent)!\n parentRegistry.forEach((_, key) => newKeysSet.add(key))\n }\n\n if (instanceRegistry.has(effectiveRegistryParent)) {\n const parentRegistry = instanceRegistry.get(effectiveRegistryParent)!\n const keysToRemove: any[] = []\n\n oldKeysSet.forEach(key => {\n if (!newKeysSet.has(key)) {\n const instance = parentRegistry.get(key)\n if (instance) {\n removeComponentInstance(instance)\n keysToRemove.push(key)\n }\n }\n })\n\n keysToRemove.forEach(key => parentRegistry.delete(key))\n }\n\n return nodes\n }\n\n if (typeof fnode === 'object') {\n if (typeof fnode.type === 'string') {\n const dom = document.createElement(fnode.type)\n\n if (fnode.props) {\n Object.entries(fnode.props).forEach(([key, value]) => {\n if (key === 'ref') {\n // Handle both callback refs and RefObject\n if (typeof value === 'function') {\n value(dom)\n } else if (value && typeof value === 'object' && 'current' in value) {\n value.current = dom\n }\n } else if (key.startsWith('on') && typeof value === 'function') {\n const eventName = key.slice(2).toLowerCase()\n dom.addEventListener(eventName, value as EventListener)\n\n if (!(dom as any).__eventHandlers) {\n (dom as any).__eventHandlers = {}\n }\n (dom as any).__eventHandlers[eventName] = value\n } else if (key !== 'ref') {\n setAttribute(dom, key, value)\n }\n })\n }\n\n if (fnode.children && fnode.children.length > 0) {\n fnode.children.forEach((child: any) => {\n renderNode(child, dom)\n })\n }\n\n parent.appendChild(dom)\n return dom\n }\n\n if (typeof fnode.type === 'function') {\n return renderComponent(fnode, parent, registryParent)\n }\n }\n\n return null\n}\n\nfunction setAttribute(el: Element, key: string, value: any) {\n if (value === null || value === undefined) {\n el.removeAttribute(key)\n } else if (key === 'style' && typeof value === 'object') {\n Object.assign((el as HTMLElement).style, value)\n } else if (key === 'class') {\n el.className = String(value)\n } else if (key in el && typeof (el as any)[key] !== 'function') {\n (el as any)[key] = value\n } else {\n el.setAttribute(key, String(value))\n }\n}\n\n// Reconciliation helpers\nfunction canReuse(oldNode: Node, newNode: Node): boolean {\n if (oldNode.nodeType !== newNode.nodeType) return false\n if (oldNode.nodeType === Node.ELEMENT_NODE && newNode.nodeType === Node.ELEMENT_NODE) {\n return (oldNode as Element).tagName === (newNode as Element).tagName\n }\n return true\n}\n\nfunction updateAttributes(oldEl: Element, newEl: Element): void {\n const oldAttrs = Array.from(oldEl.attributes)\n oldAttrs.forEach(attr => {\n if (!newEl.hasAttribute(attr.name)) {\n oldEl.removeAttribute(attr.name)\n }\n })\n\n const newAttrs = Array.from(newEl.attributes)\n newAttrs.forEach(attr => {\n if (oldEl.getAttribute(attr.name) !== attr.value) {\n if (attr.name === 'value' && 'value' in oldEl) {\n (oldEl as HTMLInputElement).value = attr.value\n } else if (attr.name === 'checked' && 'checked' in oldEl) {\n (oldEl as HTMLInputElement).checked = attr.value === 'true' || attr.value === ''\n } else {\n oldEl.setAttribute(attr.name, attr.value)\n }\n }\n })\n\n const oldHandlers = (oldEl as any).__eventHandlers || {}\n const newHandlers = (newEl as any).__eventHandlers || {}\n\n Object.keys(oldHandlers).forEach(event => {\n if (!newHandlers[event]) {\n oldEl.removeEventListener(event, oldHandlers[event])\n }\n })\n\n Object.keys(newHandlers).forEach(event => {\n if (oldHandlers[event] !== newHandlers[event]) {\n if (oldHandlers[event]) {\n oldEl.removeEventListener(event, oldHandlers[event])\n }\n oldEl.addEventListener(event, newHandlers[event])\n }\n })\n\n if (Object.keys(newHandlers).length > 0) {\n (oldEl as any).__eventHandlers = newHandlers\n } else {\n delete (oldEl as any).__eventHandlers\n }\n\n if (oldEl instanceof HTMLInputElement && newEl instanceof HTMLInputElement) {\n if (oldEl.value !== newEl.value) {\n oldEl.value = newEl.value\n }\n if (oldEl.checked !== newEl.checked) {\n oldEl.checked = newEl.checked\n }\n }\n if (oldEl instanceof HTMLTextAreaElement && newEl instanceof HTMLTextAreaElement) {\n if (oldEl.value !== newEl.value) {\n oldEl.value = newEl.value\n }\n }\n if (oldEl instanceof HTMLSelectElement && newEl instanceof HTMLSelectElement) {\n if (oldEl.value !== newEl.value) {\n oldEl.value = newEl.value\n }\n }\n}\n\nfunction reconcileChildren(oldEl: Element, newEl: Element): void {\n const oldChildren = Array.from(oldEl.childNodes)\n const newChildren = Array.from(newEl.childNodes)\n const maxLen = Math.max(oldChildren.length, newChildren.length)\n\n for (let i = 0; i < maxLen; i++) {\n const oldChild = oldChildren[i]\n const newChild = newChildren[i]\n\n if (!oldChild && newChild) {\n oldEl.appendChild(newChild)\n } else if (oldChild && !newChild) {\n oldEl.removeChild(oldChild)\n } else if (oldChild && newChild) {\n patchNode(oldChild, newChild, oldEl)\n }\n }\n}\n\nfunction patchNode(oldNode: Node, newNode: Node, parent: Element): void {\n if (canReuse(oldNode, newNode)) {\n const ownerInstance = (newNode as any).__ownerInstance as DOMComponentInstance | undefined\n if (ownerInstance) {\n const idx = ownerInstance.nodes.indexOf(newNode)\n if (idx !== -1) {\n ownerInstance.nodes[idx] = oldNode\n }\n ;(oldNode as any).__ownerInstance = ownerInstance\n delete (newNode as any).__ownerInstance\n }\n\n if (oldNode.nodeType === Node.TEXT_NODE) {\n if (oldNode.nodeValue !== newNode.nodeValue) {\n oldNode.nodeValue = newNode.nodeValue\n }\n } else if (oldNode.nodeType === Node.ELEMENT_NODE) {\n updateAttributes(oldNode as Element, newNode as Element)\n reconcileChildren(oldNode as Element, newNode as Element)\n }\n } else {\n parent.replaceChild(newNode, oldNode)\n }\n}\n\nexport function reconcile(oldNodes: Node[], newNodes: Node[], parent: Node, beforeMarker: Node): Node[] {\n const maxLen = Math.max(oldNodes.length, newNodes.length)\n const resultNodes: Node[] = []\n\n for (let i = 0; i < maxLen; i++) {\n const oldNode = oldNodes[i]\n const newNode = newNodes[i]\n\n if (!oldNode && newNode) {\n parent.insertBefore(newNode, beforeMarker)\n resultNodes.push(newNode)\n } else if (oldNode && !newNode) {\n if (oldNode.parentNode) {\n parent.removeChild(oldNode)\n }\n } else if (oldNode && newNode) {\n patchNode(oldNode, newNode, parent as Element)\n resultNodes.push(oldNode)\n }\n }\n\n return resultNodes\n}\n\nexport function render(app: any, container: HTMLElement) {\n container.innerHTML = ''\n\n if (typeof app === 'function') {\n app = { type: app, props: {}, children: [], key: undefined }\n }\n\n renderNode(app, container)\n}\n"]}
1
+ {"version":3,"sources":["../src/dom/render.ts"],"names":["instanceRegistry","currentRenderingInstance","removeComponentInstance","instance","child","node","renderComponent","fnode","parent","registryParent","effectiveRegistryParent","mergeProps","props","hasExplicitKey","parentRegistry","key","instanceCount","componentName","_","k","newProps","isFirstRender","renderFn","currentFnode","currentProps","pushContext","previousRenderingInstance","result","runWithComponent","newNodes","renderNode","nodeParent","marker","lastNode","tempContainer","newNodesArray","reconciledNodes","reconcile","unsafeEffect","oldKeysSet","nodes","newKeysSet","keysToRemove","dom","value","eventName","setAttribute","el","canReuse","oldNode","newNode","updateAttributes","oldEl","newEl","attr","oldHandlers","newHandlers","event","reconcileChildren","oldChildren","newChildren","maxLen","i","oldChild","newChild","patchNode","ownerInstance","idx","oldNodes","beforeMarker","resultNodes","render","app","container"],"mappings":"4EAiBA,IAAMA,CAAAA,CAAmB,IAAI,OAAA,CAGzBC,CAAAA,CAAwD,KAG5D,SAASC,CAAAA,CAAwBC,CAAAA,CAAsC,CACnEA,EAAS,QAAA,CAAS,OAAA,CAAQC,CAAAA,EAAS,CAC/BF,EAAwBE,CAAK,EACjC,CAAC,CAAA,CAEDD,CAAAA,CAAS,KAAA,CAAM,OAAA,CAAQE,CAAAA,EAAQ,CACvBA,CAAAA,CAAK,UAAA,EACLA,CAAAA,CAAK,UAAA,CAAW,YAAYA,CAAI,EAExC,CAAC,CAAA,CAEDF,EAAS,QAAA,CAAS,KAAA,EAAM,CAEpBA,CAAAA,CAAS,cAAA,EACTA,CAAAA,CAAS,cAAA,CAAe,QAAA,CAAS,OAAOA,CAAQ,EAExD,CAGA,SAASG,EAAgBC,GAAAA,CAAYC,CAAAA,CAAqBC,CAAAA,CAAsC,CAC5F,IAAMC,CAAAA,CAA0BD,CAAAA,EAAkBD,CAAAA,CAE5CG,CAAAA,CAAcN,GAAc,CAC9B,IAAMO,CAAAA,CAAQ,CAAE,GAAGP,CAAAA,CAAK,KAAM,CAAA,CAC9B,OAAIA,EAAK,QAAA,EAAYA,CAAAA,CAAK,QAAA,CAAS,MAAA,CAAS,IACxCO,CAAAA,CAAM,QAAA,CAAWP,CAAAA,CAAK,QAAA,CAAS,MAAA,GAAW,CAAA,CACpCA,CAAAA,CAAK,QAAA,CAAS,CAAC,CAAA,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,CAAA,CAG/D1C,CAAAA,CAAW0C,CAAAA,CAAKC,CAAS,EAC7B","file":"chunk-TP5HUAIN.mjs","sourcesContent":["import { pushContext } from '../core/context'\nimport { runWithComponent, type ComponentInstance } from '../core/hook'\nimport { unsafeEffect } from '../core/lifecycle'\n\n// Extended ComponentInstance for DOM tracking\ninterface DOMComponentInstance extends ComponentInstance {\n nodes: Node[]\n parent: HTMLElement\n fnode: any\n props: any\n key?: any\n renderFn?: () => void\n children: Set<DOMComponentInstance>\n parentInstance?: DOMComponentInstance\n}\n\n// Registry to store component instances by parent and key\nconst instanceRegistry = new WeakMap<HTMLElement, Map<any, DOMComponentInstance>>()\n\n// Current rendering component instance (for tracking parent-child relationships)\nlet currentRenderingInstance: DOMComponentInstance | null = null\n\n// Recursively remove component instance and all its children\nfunction removeComponentInstance(instance: DOMComponentInstance): void {\n instance.children.forEach(child => {\n removeComponentInstance(child)\n })\n\n instance.nodes.forEach(node => {\n if (node.parentNode) {\n node.parentNode.removeChild(node)\n }\n })\n\n instance.children.clear()\n\n if (instance.parentInstance) {\n instance.parentInstance.children.delete(instance)\n }\n}\n\n// Render a function component with reactive re-rendering\nfunction renderComponent(fnode: any, parent: HTMLElement, registryParent?: HTMLElement): Node[] {\n const effectiveRegistryParent = registryParent || parent\n\n const mergeProps = (node: any) => {\n const props = { ...node.props }\n if (node.children && node.children.length > 0) {\n props.children = node.children.length === 1\n ? node.children[0]\n : node.children\n }\n return props\n }\n\n const hasExplicitKey = fnode.key !== undefined\n\n if (!instanceRegistry.has(effectiveRegistryParent)) {\n instanceRegistry.set(effectiveRegistryParent, new Map())\n }\n const parentRegistry = instanceRegistry.get(effectiveRegistryParent)!\n\n let key: any\n if (hasExplicitKey) {\n key = fnode.key\n } else {\n let instanceCount = 0\n const componentName = fnode.type.name || 'anonymous'\n parentRegistry.forEach((_, k) => {\n if (typeof k === 'string' && k.startsWith(`__auto_${componentName}_`)) {\n instanceCount++\n }\n })\n key = `__auto_${componentName}_${instanceCount}`\n }\n\n if (parentRegistry.has(key)) {\n const instance = parentRegistry.get(key)!\n instance.fnode = fnode\n const newProps = mergeProps(fnode)\n instance.props = newProps\n instance.children.clear()\n\n if (instance.renderFn) {\n instance.renderFn()\n }\n\n return instance.nodes\n }\n\n const instance: DOMComponentInstance = {\n hooks: [],\n hookIndex: 0,\n nodes: [],\n parent,\n fnode: fnode,\n props: mergeProps(fnode),\n key,\n children: new Set(),\n parentInstance: currentRenderingInstance || undefined\n }\n\n if (currentRenderingInstance) {\n currentRenderingInstance.children.add(instance)\n }\n\n parentRegistry.set(key, instance)\n\n let isFirstRender = true\n\n const renderFn = () => {\n const currentFnode = instance.fnode\n const currentProps = instance.props\n\n const isProvider = (currentFnode.type as any)._contextId !== undefined\n if (isProvider) {\n pushContext((currentFnode.type as any)._contextId, currentProps.value)\n }\n\n const previousRenderingInstance = currentRenderingInstance\n currentRenderingInstance = instance\n\n const result = runWithComponent(instance, () => currentFnode.type(currentProps))\n\n if (isFirstRender) {\n const newNodes = renderNode(result, parent)\n instance.nodes = newNodes ? (Array.isArray(newNodes) ? newNodes : [newNodes]) : []\n instance.nodes.forEach(node => {\n if (!(node as any).__ownerInstance) {\n (node as any).__ownerInstance = instance\n }\n })\n isFirstRender = false\n } else {\n if (instance.nodes.length === 0) {\n const newNodes = renderNode(result, parent)\n instance.nodes = newNodes ? (Array.isArray(newNodes) ? newNodes : [newNodes]) : []\n currentRenderingInstance = previousRenderingInstance\n return\n }\n\n const firstNode = instance.nodes[0]\n const nodeParent = firstNode.parentNode as HTMLElement\n\n if (!nodeParent) {\n currentRenderingInstance = previousRenderingInstance\n return\n }\n\n const marker = document.createComment('flexium-marker')\n const lastNode = instance.nodes[instance.nodes.length - 1]\n if (lastNode.nextSibling) {\n nodeParent.insertBefore(marker, lastNode.nextSibling)\n } else {\n nodeParent.appendChild(marker)\n }\n\n instance.children.clear()\n\n const tempContainer = document.createElement('div')\n const newNodes = renderNode(result, tempContainer, nodeParent)\n const newNodesArray = newNodes ? (Array.isArray(newNodes) ? newNodes : [newNodes]) : []\n\n const reconciledNodes = reconcile(instance.nodes, newNodesArray, nodeParent, marker)\n\n nodeParent.removeChild(marker)\n\n instance.nodes = reconciledNodes\n }\n\n currentRenderingInstance = previousRenderingInstance\n }\n\n instance.renderFn = renderFn\n\n unsafeEffect(renderFn)\n\n return instance.nodes\n}\n\nfunction renderNode(fnode: any, parent: HTMLElement, registryParent?: HTMLElement): Node | Node[] | null {\n const effectiveRegistryParent = registryParent || parent\n\n if (fnode === null || fnode === undefined || typeof fnode === 'boolean') {\n const node = document.createTextNode('')\n parent.appendChild(node)\n return node\n }\n\n if (typeof fnode === 'string' || typeof fnode === 'number') {\n const node = document.createTextNode(String(fnode))\n parent.appendChild(node)\n return node\n }\n\n if (Array.isArray(fnode)) {\n const oldKeysSet = new Set<any>()\n if (instanceRegistry.has(effectiveRegistryParent)) {\n const parentRegistry = instanceRegistry.get(effectiveRegistryParent)!\n parentRegistry.forEach((_, key) => oldKeysSet.add(key))\n }\n\n const nodes: Node[] = []\n fnode.forEach((child) => {\n const result = renderNode(child, parent, registryParent)\n if (result) {\n if (Array.isArray(result)) {\n nodes.push(...result)\n } else {\n nodes.push(result)\n }\n }\n })\n\n const newKeysSet = new Set<any>()\n if (instanceRegistry.has(effectiveRegistryParent)) {\n const parentRegistry = instanceRegistry.get(effectiveRegistryParent)!\n parentRegistry.forEach((_, key) => newKeysSet.add(key))\n }\n\n if (instanceRegistry.has(effectiveRegistryParent)) {\n const parentRegistry = instanceRegistry.get(effectiveRegistryParent)!\n const keysToRemove: any[] = []\n\n oldKeysSet.forEach(key => {\n if (!newKeysSet.has(key)) {\n const instance = parentRegistry.get(key)\n if (instance) {\n removeComponentInstance(instance)\n keysToRemove.push(key)\n }\n }\n })\n\n keysToRemove.forEach(key => parentRegistry.delete(key))\n }\n\n return nodes\n }\n\n if (typeof fnode === 'object') {\n if (typeof fnode.type === 'string') {\n const dom = document.createElement(fnode.type)\n\n if (fnode.props) {\n Object.entries(fnode.props).forEach(([key, value]) => {\n if (key === 'ref') {\n // Handle both callback refs and RefObject\n if (typeof value === 'function') {\n value(dom)\n } else if (value && typeof value === 'object' && 'current' in value) {\n value.current = dom\n }\n } else if (key.startsWith('on') && typeof value === 'function') {\n const eventName = key.slice(2).toLowerCase()\n dom.addEventListener(eventName, value as EventListener)\n\n if (!(dom as any).__eventHandlers) {\n (dom as any).__eventHandlers = {}\n }\n (dom as any).__eventHandlers[eventName] = value\n } else if (key !== 'ref') {\n setAttribute(dom, key, value)\n }\n })\n }\n\n if (fnode.children && fnode.children.length > 0) {\n fnode.children.forEach((child: any) => {\n renderNode(child, dom)\n })\n }\n\n parent.appendChild(dom)\n return dom\n }\n\n if (typeof fnode.type === 'function') {\n return renderComponent(fnode, parent, registryParent)\n }\n }\n\n return null\n}\n\nfunction setAttribute(el: Element, key: string, value: any) {\n if (value === null || value === undefined) {\n el.removeAttribute(key)\n } else if (key === 'style' && typeof value === 'object') {\n Object.assign((el as HTMLElement).style, value)\n } else if (key === 'class') {\n el.className = String(value)\n } else if (key in el && typeof (el as any)[key] !== 'function') {\n (el as any)[key] = value\n } else {\n el.setAttribute(key, String(value))\n }\n}\n\n// Reconciliation helpers\nfunction canReuse(oldNode: Node, newNode: Node): boolean {\n if (oldNode.nodeType !== newNode.nodeType) return false\n if (oldNode.nodeType === Node.ELEMENT_NODE && newNode.nodeType === Node.ELEMENT_NODE) {\n return (oldNode as Element).tagName === (newNode as Element).tagName\n }\n return true\n}\n\nfunction updateAttributes(oldEl: Element, newEl: Element): void {\n const oldAttrs = Array.from(oldEl.attributes)\n oldAttrs.forEach(attr => {\n if (!newEl.hasAttribute(attr.name)) {\n oldEl.removeAttribute(attr.name)\n }\n })\n\n const newAttrs = Array.from(newEl.attributes)\n newAttrs.forEach(attr => {\n if (oldEl.getAttribute(attr.name) !== attr.value) {\n if (attr.name === 'value' && 'value' in oldEl) {\n (oldEl as HTMLInputElement).value = attr.value\n } else if (attr.name === 'checked' && 'checked' in oldEl) {\n (oldEl as HTMLInputElement).checked = attr.value === 'true' || attr.value === ''\n } else {\n oldEl.setAttribute(attr.name, attr.value)\n }\n }\n })\n\n const oldHandlers = (oldEl as any).__eventHandlers || {}\n const newHandlers = (newEl as any).__eventHandlers || {}\n\n Object.keys(oldHandlers).forEach(event => {\n if (!newHandlers[event]) {\n oldEl.removeEventListener(event, oldHandlers[event])\n }\n })\n\n Object.keys(newHandlers).forEach(event => {\n if (oldHandlers[event] !== newHandlers[event]) {\n if (oldHandlers[event]) {\n oldEl.removeEventListener(event, oldHandlers[event])\n }\n oldEl.addEventListener(event, newHandlers[event])\n }\n })\n\n if (Object.keys(newHandlers).length > 0) {\n (oldEl as any).__eventHandlers = newHandlers\n } else {\n delete (oldEl as any).__eventHandlers\n }\n\n if (oldEl instanceof HTMLInputElement && newEl instanceof HTMLInputElement) {\n if (oldEl.value !== newEl.value) {\n oldEl.value = newEl.value\n }\n if (oldEl.checked !== newEl.checked) {\n oldEl.checked = newEl.checked\n }\n }\n if (oldEl instanceof HTMLTextAreaElement && newEl instanceof HTMLTextAreaElement) {\n if (oldEl.value !== newEl.value) {\n oldEl.value = newEl.value\n }\n }\n if (oldEl instanceof HTMLSelectElement && newEl instanceof HTMLSelectElement) {\n if (oldEl.value !== newEl.value) {\n oldEl.value = newEl.value\n }\n }\n}\n\nfunction reconcileChildren(oldEl: Element, newEl: Element): void {\n const oldChildren = Array.from(oldEl.childNodes)\n const newChildren = Array.from(newEl.childNodes)\n const maxLen = Math.max(oldChildren.length, newChildren.length)\n\n for (let i = 0; i < maxLen; i++) {\n const oldChild = oldChildren[i]\n const newChild = newChildren[i]\n\n if (!oldChild && newChild) {\n oldEl.appendChild(newChild)\n } else if (oldChild && !newChild) {\n oldEl.removeChild(oldChild)\n } else if (oldChild && newChild) {\n patchNode(oldChild, newChild, oldEl)\n }\n }\n}\n\nfunction patchNode(oldNode: Node, newNode: Node, parent: Element): void {\n if (canReuse(oldNode, newNode)) {\n const ownerInstance = (newNode as any).__ownerInstance as DOMComponentInstance | undefined\n if (ownerInstance) {\n const idx = ownerInstance.nodes.indexOf(newNode)\n if (idx !== -1) {\n ownerInstance.nodes[idx] = oldNode\n }\n ;(oldNode as any).__ownerInstance = ownerInstance\n delete (newNode as any).__ownerInstance\n }\n\n if (oldNode.nodeType === Node.TEXT_NODE) {\n if (oldNode.nodeValue !== newNode.nodeValue) {\n oldNode.nodeValue = newNode.nodeValue\n }\n } else if (oldNode.nodeType === Node.ELEMENT_NODE) {\n updateAttributes(oldNode as Element, newNode as Element)\n reconcileChildren(oldNode as Element, newNode as Element)\n }\n } else {\n parent.replaceChild(newNode, oldNode)\n }\n}\n\nexport function reconcile(oldNodes: Node[], newNodes: Node[], parent: Node, beforeMarker: Node): Node[] {\n const maxLen = Math.max(oldNodes.length, newNodes.length)\n const resultNodes: Node[] = []\n\n for (let i = 0; i < maxLen; i++) {\n const oldNode = oldNodes[i]\n const newNode = newNodes[i]\n\n if (!oldNode && newNode) {\n parent.insertBefore(newNode, beforeMarker)\n resultNodes.push(newNode)\n } else if (oldNode && !newNode) {\n if (oldNode.parentNode) {\n parent.removeChild(oldNode)\n }\n } else if (oldNode && newNode) {\n patchNode(oldNode, newNode, parent as Element)\n resultNodes.push(oldNode)\n }\n }\n\n return resultNodes\n}\n\nexport function render(app: any, container: HTMLElement) {\n container.innerHTML = ''\n\n if (typeof app === 'function') {\n app = { type: app, props: {}, children: [], key: undefined }\n }\n\n renderNode(app, container)\n}\n"]}
package/dist/core.d.cts CHANGED
@@ -1,4 +1,33 @@
1
- import { C as Context } from './types--emg3Tgw.cjs';
1
+ /**
2
+ * Context for passing data through the component tree
3
+ *
4
+ * @example
5
+ * ```tsx
6
+ * const ThemeContext = new Context('light')
7
+ *
8
+ * function App() {
9
+ * return (
10
+ * <ThemeContext.Provider value="dark">
11
+ * <Child />
12
+ * </ThemeContext.Provider>
13
+ * )
14
+ * }
15
+ *
16
+ * function Child() {
17
+ * const [theme] = use(ThemeContext)
18
+ * return <div>{theme}</div>
19
+ * }
20
+ * ```
21
+ */
22
+ declare class Context<T> {
23
+ readonly id: symbol;
24
+ readonly defaultValue: T;
25
+ readonly Provider: (props: {
26
+ value: T;
27
+ children: any;
28
+ }) => any;
29
+ constructor(defaultValue: T);
30
+ }
2
31
 
3
32
  type Setter<T> = (newValue: T | ((prev: T) => T)) => void;
4
33
  type ResourceControl<P = void> = {
@@ -25,6 +54,7 @@ interface RefObject<T> {
25
54
  }
26
55
  type RefCallback<T> = (instance: T | null) => void;
27
56
  type Ref<T> = RefObject<T> | RefCallback<T> | null;
57
+ type ForwardedRef<T> = RefCallback<T> | RefObject<T> | null;
28
58
 
29
59
  /**
30
60
  * Unified sync API
@@ -58,4 +88,4 @@ declare function useRef<T>(initialValue: T): RefObject<T>;
58
88
  declare function useRef<T>(initialValue: T | null): RefObject<T | null>;
59
89
  declare function useRef<T = undefined>(): RefObject<T | undefined>;
60
90
 
61
- export { type Ref, type RefCallback, type RefObject, type ResourceControl, type Setter, type UseContext, type UseOptions, sync, use, useRef };
91
+ export { Context, type ForwardedRef, type Ref, type RefCallback, type RefObject, type ResourceControl, type Setter, type UseContext, type UseOptions, sync, use, useRef };
package/dist/core.d.ts CHANGED
@@ -1,4 +1,33 @@
1
- import { C as Context } from './types--emg3Tgw.js';
1
+ /**
2
+ * Context for passing data through the component tree
3
+ *
4
+ * @example
5
+ * ```tsx
6
+ * const ThemeContext = new Context('light')
7
+ *
8
+ * function App() {
9
+ * return (
10
+ * <ThemeContext.Provider value="dark">
11
+ * <Child />
12
+ * </ThemeContext.Provider>
13
+ * )
14
+ * }
15
+ *
16
+ * function Child() {
17
+ * const [theme] = use(ThemeContext)
18
+ * return <div>{theme}</div>
19
+ * }
20
+ * ```
21
+ */
22
+ declare class Context<T> {
23
+ readonly id: symbol;
24
+ readonly defaultValue: T;
25
+ readonly Provider: (props: {
26
+ value: T;
27
+ children: any;
28
+ }) => any;
29
+ constructor(defaultValue: T);
30
+ }
2
31
 
3
32
  type Setter<T> = (newValue: T | ((prev: T) => T)) => void;
4
33
  type ResourceControl<P = void> = {
@@ -25,6 +54,7 @@ interface RefObject<T> {
25
54
  }
26
55
  type RefCallback<T> = (instance: T | null) => void;
27
56
  type Ref<T> = RefObject<T> | RefCallback<T> | null;
57
+ type ForwardedRef<T> = RefCallback<T> | RefObject<T> | null;
28
58
 
29
59
  /**
30
60
  * Unified sync API
@@ -58,4 +88,4 @@ declare function useRef<T>(initialValue: T): RefObject<T>;
58
88
  declare function useRef<T>(initialValue: T | null): RefObject<T | null>;
59
89
  declare function useRef<T = undefined>(): RefObject<T | undefined>;
60
90
 
61
- export { type Ref, type RefCallback, type RefObject, type ResourceControl, type Setter, type UseContext, type UseOptions, sync, use, useRef };
91
+ export { Context, type ForwardedRef, type Ref, type RefCallback, type RefObject, type ResourceControl, type Setter, type UseContext, type UseOptions, sync, use, useRef };
package/dist/core.js CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkW2L7BLE7_js=require('./chunk-W2L7BLE7.js'),chunk3CKIHQIE_js=require('./chunk-3CKIHQIE.js'),chunkUWFVCKRU_js=require('./chunk-UWFVCKRU.js');require('./chunk-CGB4YXKS.js');function t(f){return chunkUWFVCKRU_js.b(()=>({current:f}))}Object.defineProperty(exports,"use",{enumerable:true,get:function(){return chunkW2L7BLE7_js.c}});Object.defineProperty(exports,"sync",{enumerable:true,get:function(){return chunk3CKIHQIE_js.e}});exports.useRef=t;//# sourceMappingURL=core.js.map
1
+ 'use strict';var chunkACYN2UKT_js=require('./chunk-ACYN2UKT.js'),chunk3CKIHQIE_js=require('./chunk-3CKIHQIE.js'),chunkE6Z7AI4J_js=require('./chunk-E6Z7AI4J.js');function n(t){return chunkE6Z7AI4J_js.b(()=>({current:t}))}Object.defineProperty(exports,"use",{enumerable:true,get:function(){return chunkACYN2UKT_js.c}});Object.defineProperty(exports,"sync",{enumerable:true,get:function(){return chunk3CKIHQIE_js.e}});Object.defineProperty(exports,"Context",{enumerable:true,get:function(){return chunkE6Z7AI4J_js.c}});exports.useRef=n;//# sourceMappingURL=core.js.map
2
2
  //# sourceMappingURL=core.js.map
package/dist/core.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/ref/ref.ts"],"names":["useRef","initialValue","hook"],"mappings":"gMA2BO,SAASA,CAAAA,CAAUC,CAAAA,CAA4C,CACpE,OAAOC,kBAAAA,CAAK,KAAO,CACjB,OAAA,CAASD,CACX,CAAA,CAAE,CACJ","file":"core.js","sourcesContent":["import { hook } from '../core/hook'\nimport type { RefObject } from './types'\n\n/**\n * Creates a mutable ref object that persists across renders\n *\n * @example\n * ```tsx\n * function InputWithFocus() {\n * const inputRef = useRef<HTMLInputElement>()\n *\n * const focusInput = () => {\n * inputRef.current?.focus()\n * }\n *\n * return (\n * <div>\n * <input ref={inputRef} type=\"text\" />\n * <button onClick={focusInput}>Focus Input</button>\n * </div>\n * )\n * }\n * ```\n */\nexport function useRef<T>(initialValue: T): RefObject<T>\nexport function useRef<T>(initialValue: T | null): RefObject<T | null>\nexport function useRef<T = undefined>(): RefObject<T | undefined>\nexport function useRef<T>(initialValue?: T): RefObject<T | undefined> {\n return hook(() => ({\n current: initialValue\n }))\n}\n"]}
1
+ {"version":3,"sources":["../src/core/ref.ts"],"names":["useRef","initialValue","hook"],"mappings":"iKA2BO,SAASA,CAAAA,CAAUC,CAAAA,CAA4C,CACpE,OAAOC,kBAAAA,CAAK,KAAO,CACjB,OAAA,CAASD,CACX,CAAA,CAAE,CACJ","file":"core.js","sourcesContent":["import { hook } from './hook'\nimport type { RefObject } from './types'\n\n/**\n * Creates a mutable ref object that persists across renders\n *\n * @example\n * ```tsx\n * function InputWithFocus() {\n * const inputRef = useRef<HTMLInputElement>()\n *\n * const focusInput = () => {\n * inputRef.current?.focus()\n * }\n *\n * return (\n * <div>\n * <input ref={inputRef} type=\"text\" />\n * <button onClick={focusInput}>Focus Input</button>\n * </div>\n * )\n * }\n * ```\n */\nexport function useRef<T>(initialValue: T): RefObject<T>\nexport function useRef<T>(initialValue: T | null): RefObject<T | null>\nexport function useRef<T = undefined>(): RefObject<T | undefined>\nexport function useRef<T>(initialValue?: T): RefObject<T | undefined> {\n return hook(() => ({\n current: initialValue\n }))\n}\n"]}
package/dist/core.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export{c as use}from'./chunk-INJXOHFD.mjs';export{e as sync}from'./chunk-NRPWBHKP.mjs';import {b}from'./chunk-5PNH2ARD.mjs';import'./chunk-NDPEE2TQ.mjs';function t(f){return b(()=>({current:f}))}export{t as useRef};//# sourceMappingURL=core.mjs.map
1
+ export{c as use}from'./chunk-3AKECLKA.mjs';export{e as sync}from'./chunk-NRPWBHKP.mjs';import {b}from'./chunk-MI76R42D.mjs';export{c as Context}from'./chunk-MI76R42D.mjs';function n(t){return b(()=>({current:t}))}export{n as useRef};//# sourceMappingURL=core.mjs.map
2
2
  //# sourceMappingURL=core.mjs.map
package/dist/core.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/ref/ref.ts"],"names":["useRef","initialValue","hook"],"mappings":"yJA2BO,SAASA,CAAAA,CAAUC,CAAAA,CAA4C,CACpE,OAAOC,CAAAA,CAAK,KAAO,CACjB,OAAA,CAASD,CACX,CAAA,CAAE,CACJ","file":"core.mjs","sourcesContent":["import { hook } from '../core/hook'\nimport type { RefObject } from './types'\n\n/**\n * Creates a mutable ref object that persists across renders\n *\n * @example\n * ```tsx\n * function InputWithFocus() {\n * const inputRef = useRef<HTMLInputElement>()\n *\n * const focusInput = () => {\n * inputRef.current?.focus()\n * }\n *\n * return (\n * <div>\n * <input ref={inputRef} type=\"text\" />\n * <button onClick={focusInput}>Focus Input</button>\n * </div>\n * )\n * }\n * ```\n */\nexport function useRef<T>(initialValue: T): RefObject<T>\nexport function useRef<T>(initialValue: T | null): RefObject<T | null>\nexport function useRef<T = undefined>(): RefObject<T | undefined>\nexport function useRef<T>(initialValue?: T): RefObject<T | undefined> {\n return hook(() => ({\n current: initialValue\n }))\n}\n"]}
1
+ {"version":3,"sources":["../src/core/ref.ts"],"names":["useRef","initialValue","hook"],"mappings":"2KA2BO,SAASA,CAAAA,CAAUC,CAAAA,CAA4C,CACpE,OAAOC,CAAAA,CAAK,KAAO,CACjB,OAAA,CAASD,CACX,CAAA,CAAE,CACJ","file":"core.mjs","sourcesContent":["import { hook } from './hook'\nimport type { RefObject } from './types'\n\n/**\n * Creates a mutable ref object that persists across renders\n *\n * @example\n * ```tsx\n * function InputWithFocus() {\n * const inputRef = useRef<HTMLInputElement>()\n *\n * const focusInput = () => {\n * inputRef.current?.focus()\n * }\n *\n * return (\n * <div>\n * <input ref={inputRef} type=\"text\" />\n * <button onClick={focusInput}>Focus Input</button>\n * </div>\n * )\n * }\n * ```\n */\nexport function useRef<T>(initialValue: T): RefObject<T>\nexport function useRef<T>(initialValue: T | null): RefObject<T | null>\nexport function useRef<T = undefined>(): RefObject<T | undefined>\nexport function useRef<T>(initialValue?: T): RefObject<T | undefined> {\n return hook(() => ({\n current: initialValue\n }))\n}\n"]}
package/dist/dom.js CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkX6HXRSMG_js=require('./chunk-X6HXRSMG.js'),chunkW2L7BLE7_js=require('./chunk-W2L7BLE7.js'),chunk3CKIHQIE_js=require('./chunk-3CKIHQIE.js'),chunkUWFVCKRU_js=require('./chunk-UWFVCKRU.js'),chunkCGB4YXKS_js=require('./chunk-CGB4YXKS.js');function j(e,t,...o){return {type:e,props:t||{},children:o,key:t?.key}}var l=null,F=new WeakMap,h=null;function R(e,t,o={}){let{state:n,onHydrated:r,onMismatch:i}=o;l=t.firstChild;try{let s;typeof e=="function"&&!b(e)?s={type:e,props:{},children:[],key:void 0}:s=e,E(s,t),r?.();}catch(s){console.warn("[Flexium] Hydration mismatch, falling back to full render:",s),i?.(s),t.innerHTML="",import('./render-VERKNIPR.js').then(({render:p})=>{p(e,t);});}finally{l=null;}}function b(e){return e&&typeof e=="object"&&"type"in e&&"props"in e}function E(e,t){if(e==null||typeof e=="boolean")return v(),null;if(typeof e=="string"||typeof e=="number")return K(String(e));if(Array.isArray(e)){let o=[];for(let n of e){let r=E(n,t);r&&(Array.isArray(r)?o.push(...r):o.push(r));}return o}if(typeof e=="function")return _({type:e,props:{},children:[],key:void 0},t);if(typeof e=="object"&&b(e)){if(typeof e.type=="string")return X(e);if(typeof e.type=="function")return _(e,t)}return null}function v(){for(;l&&l.nodeType===Node.TEXT_NODE&&(!l.textContent||l.textContent.trim()==="");)l=l.nextSibling;}function K(e){v();let t=l;if(!t)return null;if(t.nodeType!==Node.TEXT_NODE){if(e.trim()==="")return null;throw new Error(`Hydration mismatch: expected text node "${e}", got ${t.nodeName}`)}return l=t.nextSibling,t}function X(e){v();let t=l,o=e.type;if(!t||t.nodeType!==Node.ELEMENT_NODE)throw new Error(`Hydration mismatch: expected element <${o}>, got ${t?.nodeName||"nothing"}`);if(t.tagName.toLowerCase()!==o.toLowerCase())throw new Error(`Hydration mismatch: expected <${o}>, got <${t.tagName.toLowerCase()}>`);if(e.props){for(let[n,r]of Object.entries(e.props))if(n==="ref")typeof r=="function"?r(t):r&&typeof r=="object"&&"current"in r&&(r.current=t);else if(n.startsWith("on")&&typeof r=="function"){let i=n.slice(2).toLowerCase();t.addEventListener(i,r),t.__eventHandlers||(t.__eventHandlers={}),t.__eventHandlers[i]=r;}}if(l=t.nextSibling,e.children&&e.children.length>0){let n=l;l=t.firstChild;for(let r of e.children)E(r,t);l=n;}return t}function _(e,t){let o=e.type,n={...e.props};e.children&&e.children.length>0&&(n.children=e.children.length===1?e.children[0]:e.children);let r=o._contextId,i=r!==void 0,s;i&&(s=chunkCGB4YXKS_js.c(r,n.value)),F.has(t)||F.set(t,new Map);let p=F.get(t),C=e.key!==void 0,u;if(C)u=e.key;else {let c=0,y=o.name||"anonymous";p.forEach((g,x)=>{typeof x=="string"&&x.startsWith(`__auto_${y}_`)&&c++;}),u=`__auto_${y}_${c}`;}let a={hooks:[],hookIndex:0,nodes:[],parent:t,fnode:e,props:n,key:u,children:new Set,parentInstance:h||void 0};h&&h.children.add(a),p.set(u,a);let d=h;h=a;try{let c=chunkUWFVCKRU_js.a(a,()=>o(n)),y=E(c,t);a.nodes=y?Array.isArray(y)?y:[y]:[];let g=!0,x=()=>{if(g){g=!1;return}let A=a.props;chunkUWFVCKRU_js.a(a,()=>o(A));};return a.renderFn=x,chunk3CKIHQIE_js.b(x),a.nodes}finally{h=d,i&&chunkCGB4YXKS_js.d(r,s);}}function z(e){let{target:t,children:o}=e,n=chunkUWFVCKRU_js.b(()=>({container:null,mounted:false}));return chunkW2L7BLE7_js.c(({onCleanup:r})=>{let i=null;if(typeof t=="string"?i=document.querySelector(t):t instanceof HTMLElement&&(i=t),!i){console.warn("[Flexium Portal] Target container not found:",t);return}let s=document.createElement("div");s.setAttribute("data-flexium-portal","true"),i.appendChild(s),n.container=s,n.mounted=true,chunkX6HXRSMG_js.b(o,s),r(()=>{s.parentNode&&s.parentNode.removeChild(s),n.container=null,n.mounted=false;});},[t,o]),null}var q={register:()=>{},hasBoundary:false},I=chunkCGB4YXKS_js.a(q);function N(){return chunkCGB4YXKS_js.b(I)}function O(e){let{fallback:t,children:o}=e,n=chunkUWFVCKRU_js.b(()=>new Set),[,r]=chunkW2L7BLE7_js.c(0),[i,s]=chunkW2L7BLE7_js.c(false),C={register:a=>{n.has(a)||(n.add(a),r(d=>d+1),s(true),a.finally(()=>{n.delete(a),r(d=>{let c=d-1;return c===0&&s(false),c});}));},hasBoundary:true},u=i?t:o;return {type:I.Provider,props:{value:C},children:[u],key:void 0}}function $(e){let{fallback:t,onError:o,children:n,resetKey:r}=e,[i,s]=chunkW2L7BLE7_js.c({error:null,info:null}),p=chunkUWFVCKRU_js.b(()=>({current:r}));r!==p.current&&(p.current=r,i.error!==null&&s({error:null,info:null}));if(i.error)return typeof t=="function"?t(i.error,i.info):t;try{return n}finally{}}function D(e){let t=null,o=null,n=null,r=i=>{if(t)return t(i);if(n)throw n;let s=N();return o||(o=e().then(p=>{t=p.default;}).catch(p=>{n=p instanceof Error?p:new Error(String(p));})),s.hasBoundary&&s.register(o),null};return r._lazy=true,r._loader=e,r}Object.defineProperty(exports,"reconcile",{enumerable:true,get:function(){return chunkX6HXRSMG_js.a}});Object.defineProperty(exports,"render",{enumerable:true,get:function(){return chunkX6HXRSMG_js.b}});exports.ErrorBoundary=$;exports.Portal=z;exports.Suspense=O;exports.f=j;exports.hydrate=R;exports.lazy=D;exports.suspenseContext=N;//# sourceMappingURL=dom.js.map
1
+ 'use strict';var chunkPUXZJ7OV_js=require('./chunk-PUXZJ7OV.js'),chunkACYN2UKT_js=require('./chunk-ACYN2UKT.js'),chunk3CKIHQIE_js=require('./chunk-3CKIHQIE.js'),chunkE6Z7AI4J_js=require('./chunk-E6Z7AI4J.js');function W(e,t,...o){return {type:e,props:t||{},children:o,key:t?.key}}var l=null,F=new WeakMap,h=null;function j(e,t,o={}){let{state:n,onHydrated:r,onMismatch:i}=o;l=t.firstChild;try{let s;typeof e=="function"&&!_(e)?s={type:e,props:{},children:[],key:void 0}:s=e,E(s,t),r?.();}catch(s){console.warn("[Flexium] Hydration mismatch, falling back to full render:",s),i?.(s),t.innerHTML="",import('./render-MJ2LCNSG.js').then(({render:p})=>{p(e,t);});}finally{l=null;}}function _(e){return e&&typeof e=="object"&&"type"in e&&"props"in e}function E(e,t){if(e==null||typeof e=="boolean")return v(),null;if(typeof e=="string"||typeof e=="number")return R(String(e));if(Array.isArray(e)){let o=[];for(let n of e){let r=E(n,t);r&&(Array.isArray(r)?o.push(...r):o.push(r));}return o}if(typeof e=="function")return T({type:e,props:{},children:[],key:void 0},t);if(typeof e=="object"&&_(e)){if(typeof e.type=="string")return K(e);if(typeof e.type=="function")return T(e,t)}return null}function v(){for(;l&&l.nodeType===Node.TEXT_NODE&&(!l.textContent||l.textContent.trim()==="");)l=l.nextSibling;}function R(e){v();let t=l;if(!t)return null;if(t.nodeType!==Node.TEXT_NODE){if(e.trim()==="")return null;throw new Error(`Hydration mismatch: expected text node "${e}", got ${t.nodeName}`)}return l=t.nextSibling,t}function K(e){v();let t=l,o=e.type;if(!t||t.nodeType!==Node.ELEMENT_NODE)throw new Error(`Hydration mismatch: expected element <${o}>, got ${t?.nodeName||"nothing"}`);if(t.tagName.toLowerCase()!==o.toLowerCase())throw new Error(`Hydration mismatch: expected <${o}>, got <${t.tagName.toLowerCase()}>`);if(e.props){for(let[n,r]of Object.entries(e.props))if(n==="ref")typeof r=="function"?r(t):r&&typeof r=="object"&&"current"in r&&(r.current=t);else if(n.startsWith("on")&&typeof r=="function"){let i=n.slice(2).toLowerCase();t.addEventListener(i,r),t.__eventHandlers||(t.__eventHandlers={}),t.__eventHandlers[i]=r;}}if(l=t.nextSibling,e.children&&e.children.length>0){let n=l;l=t.firstChild;for(let r of e.children)E(r,t);l=n;}return t}function T(e,t){let o=e.type,n={...e.props};e.children&&e.children.length>0&&(n.children=e.children.length===1?e.children[0]:e.children);let r=o._contextId,i=r!==void 0,s;i&&(s=chunkE6Z7AI4J_js.e(r,n.value)),F.has(t)||F.set(t,new Map);let p=F.get(t),C=e.key!==void 0,u;if(C)u=e.key;else {let y=0,f=o.name||"anonymous";p.forEach((g,x)=>{typeof x=="string"&&x.startsWith(`__auto_${f}_`)&&y++;}),u=`__auto_${f}_${y}`;}let a={hooks:[],hookIndex:0,nodes:[],parent:t,fnode:e,props:n,key:u,children:new Set,parentInstance:h||void 0};h&&h.children.add(a),p.set(u,a);let c=h;h=a;try{let y=chunkE6Z7AI4J_js.a(a,()=>o(n)),f=E(y,t);a.nodes=f?Array.isArray(f)?f:[f]:[];let g=!0,x=()=>{if(g){g=!1;return}let D=a.props;chunkE6Z7AI4J_js.a(a,()=>o(D));};return a.renderFn=x,chunk3CKIHQIE_js.b(x),a.nodes}finally{h=c,i&&chunkE6Z7AI4J_js.f(r,s);}}function b(e){let{target:t,children:o}=e,n=chunkE6Z7AI4J_js.b(()=>({container:null,mounted:false}));return chunkACYN2UKT_js.c(({onCleanup:r})=>{let i=null;if(typeof t=="string"?i=document.querySelector(t):t instanceof HTMLElement&&(i=t),!i){console.warn("[Flexium Portal] Target container not found:",t);return}let s=document.createElement("div");s.setAttribute("data-flexium-portal","true"),i.appendChild(s),n.container=s,n.mounted=true,chunkPUXZJ7OV_js.b(o,s),r(()=>{s.parentNode&&s.parentNode.removeChild(s),n.container=null,n.mounted=false;});},[t,o]),null}var X={register:()=>{},hasBoundary:false},I=new chunkE6Z7AI4J_js.c(X);function N(){let[e]=chunkACYN2UKT_js.c(I);return e}function z(e){let{fallback:t,children:o}=e,n=chunkE6Z7AI4J_js.b(()=>new Set),[,r]=chunkACYN2UKT_js.c(0),[i,s]=chunkACYN2UKT_js.c(false),C={register:a=>{n.has(a)||(n.add(a),r(c=>c+1),s(true),a.finally(()=>{n.delete(a),r(c=>{let y=c-1;return y===0&&s(false),y});}));},hasBoundary:true},u=i?t:o;return {type:I.Provider,props:{value:C},children:[u],key:void 0}}function V(e){let{fallback:t,onError:o,children:n,resetKey:r}=e,[i,s]=chunkACYN2UKT_js.c({error:null,info:null}),p=chunkE6Z7AI4J_js.b(()=>({current:r}));r!==p.current&&(p.current=r,i.error!==null&&s({error:null,info:null}));if(i.error)return typeof t=="function"?t(i.error,i.info):t;try{return n}finally{}}function $(e){let t=null,o=null,n=null,r=i=>{if(t)return t(i);if(n)throw n;let s=N();return o||(o=e().then(p=>{t=p.default;}).catch(p=>{n=p instanceof Error?p:new Error(String(p));})),s.hasBoundary&&s.register(o),null};return r._lazy=true,r._loader=e,r}Object.defineProperty(exports,"reconcile",{enumerable:true,get:function(){return chunkPUXZJ7OV_js.a}});Object.defineProperty(exports,"render",{enumerable:true,get:function(){return chunkPUXZJ7OV_js.b}});exports.ErrorBoundary=V;exports.Portal=b;exports.Suspense=z;exports.f=W;exports.hydrate=j;exports.lazy=$;exports.suspenseContext=N;//# sourceMappingURL=dom.js.map
2
2
  //# sourceMappingURL=dom.js.map
package/dist/dom.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/dom/f.ts","../src/dom/hydrate.ts","../src/dom/components/Portal.tsx","../src/dom/components/suspenseContext.ts","../src/dom/components/Suspense.tsx","../src/dom/components/ErrorBoundary.tsx","../src/dom/components/lazy.ts"],"names":["f","type","props","children","hydrationCursor","hydratedInstanceRegistry","currentHydratingInstance","hydrate","app","container","options","state","onHydrated","onMismatch","fnode","isFNode","hydrateNode","error","render","value","parent","skipEmptyTextNodes","hydrateTextNode","nodes","child","result","hydrateComponent","hydrateElement","text","current","tag","key","eventName","savedCursor","Component","contextId","isProvider","prevContextValue","pushContext","parentRegistry","hasExplicitKey","instanceCount","componentName","_","k","instance","previousHydratingInstance","runWithComponent","isFirstRender","renderFn","currentProps","unsafeEffect","popContext","Portal","target","portalState","hook","use","onCleanup","portalWrapper","defaultValue","SuspenseCtx","createContext","suspenseContext","useContext","Suspense","fallback","pendingSet","setPendingCount","showFallback","setShowFallback","contextValue","promise","c","newCount","content","ErrorBoundary","onError","resetKey","errorState","setErrorState","prevResetKeyRef","lazy","loader","resolved","LazyWrapper","suspense","module","err"],"mappings":"iQAKO,SAASA,CAAAA,CACZC,CAAAA,CACAC,CAAAA,CAAAA,GACGC,CAAAA,CACE,CACL,OAAO,CACH,IAAA,CAAAF,CAAAA,CACA,KAAA,CAAOC,CAAAA,EAAS,GAChB,QAAA,CAAAC,CAAAA,CACA,GAAA,CAAKD,CAAAA,EAAO,GAChB,CACJ,CCTA,IACIE,CAAAA,CAA+B,IAAA,CAkC7BC,EAA2B,IAAI,OAAA,CACjCC,CAAAA,CAAwD,KAarD,SAASC,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CAA0B,EAAC,CACrB,CACN,GAAM,CAAE,MAAAC,CAAAA,CAAO,UAAA,CAAAC,CAAAA,CAAY,UAAA,CAAAC,CAAW,CAAA,CAAIH,CAAAA,CAO1CN,CAAAA,CAAkBK,CAAAA,CAAU,WAE5B,GAAI,CAEF,IAAIK,CAAAA,CACA,OAAON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AAOb,CAAAA,EAAa,UAAA,CACfA,CAAAA,CAASa,CAAAA,CAAW,MAAOA,CAAAA,CAAW,IAAK,EAE7Cb,CAAAA,CAMT,GAAI,CAEF,OAAO/D,CACT,CAAA,OAAE,CAEF,CACF,CCtFO,SAAS+E,EACdC,CAAAA,CACkB,CAElB,IAAIC,CAAAA,CAA8C,IAAA,CAC9CZ,CAAAA,CAA+B,KAC/BvD,CAAAA,CAAsB,IAAA,CAGpBoE,EAAenF,CAAAA,EAAyB,CAE5C,GAAIkF,CAAAA,CACF,OAAOA,CAAAA,CAASlF,CAAK,CAAA,CAIvB,GAAIe,EACF,MAAMA,CAAAA,CAIR,IAAMqE,CAAAA,CAAWvB,CAAAA,GAGjB,OAAKS,CAAAA,GACHA,CAAAA,CAAUW,CAAAA,EAAO,CACd,IAAA,CAAKI,GAAU,CACdH,CAAAA,CAAWG,EAAO,QACpB,CAAC,EACA,KAAA,CAAMC,CAAAA,EAAO,CACZvE,CAAAA,CAAQuE,CAAAA,YAAe,KAAA,CAAQA,EAAM,IAAI,KAAA,CAAM,OAAOA,CAAG,CAAC,EAC5D,CAAC,CAAA,CAAA,CAIDF,CAAAA,CAAS,WAAA,EACXA,CAAAA,CAAS,QAAA,CAASd,CAAO,CAAA,CAIpB,IACT,EAGC,OAACa,CAAAA,CAAiC,MAAQ,IAAA,CACzCA,CAAAA,CAAiC,OAAA,CAAUF,CAAAA,CAEtCE,CACT","file":"dom.js","sourcesContent":["import type { FNode } from './types'\n\n/**\n * f() - Create FNodes without JSX\n */\nexport function f(\n type: string | Function,\n props?: any,\n ...children: any[]\n): FNode {\n return {\n type,\n props: props || {},\n children,\n key: props?.key\n }\n}\n","import type { FNode, FNodeChild } from './types'\nimport type { SerializedState } from '../server/types'\nimport { runWithComponent, type ComponentInstance } from '../core/hook'\nimport { pushContext, popContext } from '../core/context'\nimport { unsafeEffect } from '../core/lifecycle'\n\n// Hydration state\nlet isHydrating = false\nlet hydrationCursor: Node | null = null\nlet hydrationState: SerializedState | null = null\n\nexport interface HydrateOptions {\n /**\n * Serialized state from server\n * Typically embedded in HTML as JSON script tag\n */\n state?: SerializedState\n\n /**\n * Called when hydration completes successfully\n */\n onHydrated?: () => void\n\n /**\n * Called when hydration fails (falls back to full render)\n */\n onMismatch?: (error: Error) => void\n}\n\n// Extended ComponentInstance for DOM tracking (same as render.ts)\ninterface DOMComponentInstance extends ComponentInstance {\n nodes: Node[]\n parent: HTMLElement\n fnode: any\n props: any\n key?: any\n renderFn?: () => void\n children: Set<DOMComponentInstance>\n parentInstance?: DOMComponentInstance\n}\n\n// Registry for hydrated components\nconst hydratedInstanceRegistry = new WeakMap<HTMLElement, Map<any, DOMComponentInstance>>()\nlet currentHydratingInstance: DOMComponentInstance | null = null\n\nexport function getIsHydrating(): boolean {\n return isHydrating\n}\n\nexport function getHydrationState(): SerializedState | null {\n return hydrationState\n}\n\n/**\n * Hydrate server-rendered HTML with client-side interactivity\n */\nexport function hydrate(\n app: FNodeChild | (() => FNodeChild),\n container: HTMLElement,\n options: HydrateOptions = {}\n): void {\n const { state, onHydrated, onMismatch } = options\n\n // Store state for rehydration\n hydrationState = state || null\n\n // Initialize hydration mode\n isHydrating = true\n hydrationCursor = container.firstChild\n\n try {\n // Normalize input\n let fnode: FNodeChild\n if (typeof app === 'function' && !isFNode(app)) {\n fnode = { type: app, props: {}, children: [], key: undefined }\n } else {\n fnode = app\n }\n\n // Hydrate the tree\n hydrateNode(fnode, container)\n\n onHydrated?.()\n } catch (error) {\n // Hydration mismatch - fall back to full render\n console.warn('[Flexium] Hydration mismatch, falling back to full render:', error)\n onMismatch?.(error as Error)\n\n // Clear and re-render\n container.innerHTML = ''\n // Import dynamically to avoid circular deps\n import('./render').then(({ render }) => {\n render(app, container)\n })\n } finally {\n isHydrating = false\n hydrationCursor = null\n hydrationState = null\n }\n}\n\nfunction isFNode(value: any): value is FNode {\n return value && typeof value === 'object' && 'type' in value && 'props' in value\n}\n\nfunction hydrateNode(fnode: FNodeChild, parent: HTMLElement): Node | Node[] | null {\n // Null/undefined/boolean -> skip empty text nodes\n if (fnode === null || fnode === undefined || typeof fnode === 'boolean') {\n // Server might have rendered an empty text node\n skipEmptyTextNodes()\n return null\n }\n\n // String/number -> expect text node\n if (typeof fnode === 'string' || typeof fnode === 'number') {\n return hydrateTextNode(String(fnode))\n }\n\n // Array -> hydrate each child\n if (Array.isArray(fnode)) {\n const nodes: Node[] = []\n for (const child of fnode) {\n const result = hydrateNode(child, parent)\n if (result) {\n if (Array.isArray(result)) {\n nodes.push(...result)\n } else {\n nodes.push(result)\n }\n }\n }\n return nodes\n }\n\n // Function (standalone) -> wrap in FNode and hydrate\n if (typeof fnode === 'function') {\n const wrappedFnode: FNode = { type: fnode, props: {}, children: [], key: undefined }\n return hydrateComponent(wrappedFnode, parent)\n }\n\n // Object (FNode)\n if (typeof fnode === 'object' && isFNode(fnode)) {\n if (typeof fnode.type === 'string') {\n return hydrateElement(fnode)\n }\n\n if (typeof fnode.type === 'function') {\n return hydrateComponent(fnode, parent)\n }\n }\n\n return null\n}\n\nfunction skipEmptyTextNodes(): void {\n while (\n hydrationCursor &&\n hydrationCursor.nodeType === Node.TEXT_NODE &&\n (!hydrationCursor.textContent || hydrationCursor.textContent.trim() === '')\n ) {\n hydrationCursor = hydrationCursor.nextSibling\n }\n}\n\nfunction hydrateTextNode(text: string): Node | null {\n skipEmptyTextNodes()\n\n const current = hydrationCursor\n\n if (!current) {\n // No node to hydrate - this is okay for conditional rendering\n return null\n }\n\n if (current.nodeType !== Node.TEXT_NODE) {\n // Try to find a text node nearby (whitespace handling)\n if (text.trim() === '') {\n return null\n }\n throw new Error(`Hydration mismatch: expected text node \"${text}\", got ${current.nodeName}`)\n }\n\n // Update cursor\n hydrationCursor = current.nextSibling\n\n return current\n}\n\nfunction hydrateElement(fnode: FNode): Node {\n skipEmptyTextNodes()\n\n const current = hydrationCursor as Element\n const tag = fnode.type as string\n\n // Validate element type\n if (!current || current.nodeType !== Node.ELEMENT_NODE) {\n throw new Error(`Hydration mismatch: expected element <${tag}>, got ${current?.nodeName || 'nothing'}`)\n }\n\n if (current.tagName.toLowerCase() !== tag.toLowerCase()) {\n throw new Error(`Hydration mismatch: expected <${tag}>, got <${current.tagName.toLowerCase()}>`)\n }\n\n // Attach event handlers and refs (don't modify DOM structure)\n if (fnode.props) {\n for (const [key, value] of Object.entries(fnode.props)) {\n if (key === 'ref') {\n if (typeof value === 'function') {\n value(current)\n } else if (value && typeof value === 'object' && 'current' in value) {\n value.current = current\n }\n } else if (key.startsWith('on') && typeof value === 'function') {\n const eventName = key.slice(2).toLowerCase()\n current.addEventListener(eventName, value as EventListener)\n\n // Store for reconciliation\n if (!(current as any).__eventHandlers) {\n (current as any).__eventHandlers = {}\n }\n (current as any).__eventHandlers[eventName] = value\n }\n }\n }\n\n // Move cursor past this element\n hydrationCursor = current.nextSibling\n\n // Hydrate children\n if (fnode.children && fnode.children.length > 0) {\n const savedCursor = hydrationCursor\n\n hydrationCursor = current.firstChild\n\n for (const child of fnode.children) {\n hydrateNode(child, current as HTMLElement)\n }\n\n hydrationCursor = savedCursor\n }\n\n return current\n}\n\nfunction hydrateComponent(fnode: FNode, parent: HTMLElement): Node | Node[] | null {\n const Component = fnode.type as Function\n\n // Merge props\n const props = { ...fnode.props }\n if (fnode.children && fnode.children.length > 0) {\n props.children = fnode.children.length === 1\n ? fnode.children[0]\n : fnode.children\n }\n\n // Handle context providers\n const contextId = (Component as any)._contextId\n const isProvider = contextId !== undefined\n let prevContextValue: any\n\n if (isProvider) {\n prevContextValue = pushContext(contextId, props.value)\n }\n\n // Generate key (same logic as render.ts)\n if (!hydratedInstanceRegistry.has(parent)) {\n hydratedInstanceRegistry.set(parent, new Map())\n }\n const parentRegistry = hydratedInstanceRegistry.get(parent)!\n\n const hasExplicitKey = fnode.key !== undefined\n let key: any\n if (hasExplicitKey) {\n key = fnode.key\n } else {\n let instanceCount = 0\n const componentName = (Component as any).name || 'anonymous'\n parentRegistry.forEach((_, k) => {\n if (typeof k === 'string' && k.startsWith(`__auto_${componentName}_`)) {\n instanceCount++\n }\n })\n key = `__auto_${componentName}_${instanceCount}`\n }\n\n // Create component instance\n const instance: DOMComponentInstance = {\n hooks: [],\n hookIndex: 0,\n nodes: [],\n parent,\n fnode,\n props,\n key,\n children: new Set(),\n parentInstance: currentHydratingInstance || undefined\n }\n\n if (currentHydratingInstance) {\n currentHydratingInstance.children.add(instance)\n }\n\n parentRegistry.set(key, instance)\n\n const previousHydratingInstance = currentHydratingInstance\n currentHydratingInstance = instance\n\n try {\n // First render during hydration - just match DOM\n const result = runWithComponent(instance, () => Component(props))\n const nodes = hydrateNode(result, parent)\n instance.nodes = nodes ? (Array.isArray(nodes) ? nodes : [nodes]) : []\n\n // Set up reactive re-rendering for future updates\n let isFirstRender = true\n const renderFn = () => {\n if (isFirstRender) {\n isFirstRender = false\n return // Skip first render, already done during hydration\n }\n\n // Re-render logic (same as render.ts but simplified)\n const currentProps = instance.props\n runWithComponent(instance, () => Component(currentProps))\n\n // For subsequent renders, use full render path\n // This will be handled by the normal reconciliation\n }\n\n instance.renderFn = renderFn\n unsafeEffect(renderFn)\n\n return instance.nodes\n } finally {\n currentHydratingInstance = previousHydratingInstance\n\n if (isProvider) {\n popContext(contextId, prevContextValue)\n }\n }\n}\n","import { use } from '../../core/use'\nimport { hook } from '../../core/hook'\nimport { render } from '../render'\nimport type { PortalProps } from './types'\n\n/**\n * Portal component that renders children into a different DOM node\n *\n * @example\n * ```tsx\n * function Modal({ isOpen, onClose, children }) {\n * if (!isOpen) return null\n *\n * return (\n * <Portal target={document.body}>\n * <div class=\"modal-backdrop\" onClick={onClose}>\n * <div class=\"modal-content\" onClick={e => e.stopPropagation()}>\n * {children}\n * </div>\n * </div>\n * </Portal>\n * )\n * }\n * ```\n */\nexport function Portal(props: PortalProps): null {\n const { target, children } = props\n\n // Store rendered container for cleanup\n const portalState = hook(() => ({\n container: null as HTMLElement | null,\n mounted: false\n }))\n\n use(({ onCleanup }) => {\n // Resolve target container\n let container: HTMLElement | null = null\n\n if (typeof target === 'string') {\n container = document.querySelector(target)\n } else if (target instanceof HTMLElement) {\n container = target\n }\n\n if (!container) {\n console.warn('[Flexium Portal] Target container not found:', target)\n return\n }\n\n // Create a wrapper div to contain portal content\n const portalWrapper = document.createElement('div')\n portalWrapper.setAttribute('data-flexium-portal', 'true')\n container.appendChild(portalWrapper)\n\n portalState.container = portalWrapper\n portalState.mounted = true\n\n // Render children into the portal wrapper\n render(children, portalWrapper)\n\n // Cleanup function\n onCleanup(() => {\n if (portalWrapper.parentNode) {\n portalWrapper.parentNode.removeChild(portalWrapper)\n }\n portalState.container = null\n portalState.mounted = false\n })\n }, [target, children])\n\n // Portal renders nothing in its original location\n return null\n}\n","import { createContext, useContext } from '../../core/context'\nimport type { SuspenseContextValue } from './types'\n\nconst defaultValue: SuspenseContextValue = {\n register: () => {},\n hasBoundary: false\n}\n\nexport const SuspenseCtx = createContext<SuspenseContextValue>(defaultValue)\n\nexport function suspenseContext(): SuspenseContextValue {\n return useContext(SuspenseCtx)\n}\n","import { use } from '../../core/use'\nimport { hook } from '../../core/hook'\nimport { SuspenseCtx } from './suspenseContext'\nimport type { SuspenseProps, SuspenseContextValue } from './types'\nimport type { FNodeChild } from '../types'\n\n/**\n * Suspense component that shows fallback while children are loading\n *\n * @example\n * ```tsx\n * const Dashboard = lazy(() => import('./Dashboard'))\n *\n * function App() {\n * return (\n * <Suspense fallback={<div>Loading...</div>}>\n * <Dashboard />\n * </Suspense>\n * )\n * }\n * ```\n */\nexport function Suspense(props: SuspenseProps): FNodeChild {\n const { fallback, children } = props\n\n // Track pending promises using hook for mutable Set\n const pendingSet = hook(() => new Set<Promise<any>>())\n const [, setPendingCount] = use(0)\n const [showFallback, setShowFallback] = use(false)\n\n // Register function for lazy components\n const register = (promise: Promise<any>) => {\n if (!pendingSet.has(promise)) {\n // Add to pending set\n pendingSet.add(promise)\n setPendingCount(c => c + 1)\n setShowFallback(true)\n\n // Wait for resolution\n promise.finally(() => {\n pendingSet.delete(promise)\n setPendingCount(c => {\n const newCount = c - 1\n if (newCount === 0) {\n setShowFallback(false)\n }\n return newCount\n })\n })\n }\n }\n\n const contextValue: SuspenseContextValue = {\n register,\n hasBoundary: true\n }\n\n // Render fallback or children based on pending state\n const content = showFallback ? fallback : children\n\n // Wrap content with Suspense context provider\n return {\n type: SuspenseCtx.Provider,\n props: { value: contextValue },\n children: [content],\n key: undefined\n } as any\n}\n","import { use } from '../../core/use'\nimport { hook } from '../../core/hook'\nimport type { FNodeChild } from '../types'\nimport type { ErrorInfo, ErrorBoundaryProps } from './types'\n\n// Component name stack for error messages\nlet componentNameStack: string[] = []\n\nexport function pushComponentName(name: string): void {\n componentNameStack.push(name)\n}\n\nexport function popComponentName(): void {\n componentNameStack.pop()\n}\n\nexport function getComponentStack(): string {\n return componentNameStack\n .map(name => ` at ${name}`)\n .reverse()\n .join('\\n')\n}\n\n// Stack of error boundaries for nested error propagation\ninterface ErrorBoundaryInstance {\n handleError: (error: Error, phase: 'render' | 'effect' | 'event') => void\n}\n\nlet errorBoundaryStack: ErrorBoundaryInstance[] = []\n\nexport function pushErrorBoundary(instance: ErrorBoundaryInstance): void {\n errorBoundaryStack.push(instance)\n}\n\nexport function popErrorBoundary(): void {\n errorBoundaryStack.pop()\n}\n\nexport function getNearestErrorBoundary(): ErrorBoundaryInstance | null {\n return errorBoundaryStack[errorBoundaryStack.length - 1] || null\n}\n\n/**\n * ErrorBoundary component that catches errors in its children and displays fallback UI\n *\n * @example\n * ```tsx\n * <ErrorBoundary\n * fallback={(error, info) => <div>Error: {error.message}</div>}\n * onError={(error, info) => console.error(error)}\n * >\n * <App />\n * </ErrorBoundary>\n * ```\n */\nexport function ErrorBoundary(props: ErrorBoundaryProps): FNodeChild {\n const { fallback, onError, children, resetKey } = props\n\n // Error state\n const [errorState, setErrorState] = use<{\n error: Error | null\n info: ErrorInfo | null\n }>({ error: null, info: null })\n\n // Track reset key changes to clear error\n const prevResetKeyRef = hook(() => ({ current: resetKey }))\n\n if (resetKey !== prevResetKeyRef.current) {\n prevResetKeyRef.current = resetKey\n if (errorState.error !== null) {\n setErrorState({ error: null, info: null })\n }\n }\n\n // Error boundary instance\n const boundaryInstance: ErrorBoundaryInstance = {\n handleError: (error: Error, phase: 'render' | 'effect' | 'event') => {\n const info: ErrorInfo = {\n componentStack: getComponentStack(),\n phase\n }\n\n // Call error callback\n onError?.(error, info)\n\n // Update error state (triggers re-render with fallback)\n setErrorState({ error, info })\n }\n }\n\n // If we have an error, render fallback\n if (errorState.error) {\n if (typeof fallback === 'function') {\n return fallback(errorState.error, errorState.info!)\n }\n return fallback\n }\n\n // Push boundary onto stack for children to use\n pushErrorBoundary(boundaryInstance)\n\n try {\n // Return children - they will be rendered with this boundary active\n return children\n } finally {\n popErrorBoundary()\n }\n}\n","import { suspenseContext } from './suspenseContext'\nimport type { FNodeChild } from '../types'\nimport type { LazyComponent } from './types'\n\n/**\n * Creates a lazy-loaded component for code splitting\n *\n * @example\n * ```tsx\n * const Dashboard = lazy(() => import('./Dashboard'))\n * const Settings = lazy(() => import('./Settings'))\n *\n * function App() {\n * return (\n * <Suspense fallback={<div>Loading...</div>}>\n * <Dashboard />\n * </Suspense>\n * )\n * }\n * ```\n */\nexport function lazy<P = {}>(\n loader: () => Promise<{ default: (props: P) => FNodeChild }>\n): LazyComponent<P> {\n // Shared state across all instances\n let resolved: ((props: P) => FNodeChild) | null = null\n let promise: Promise<any> | null = null\n let error: Error | null = null\n\n // The wrapper component\n const LazyWrapper = (props: P): FNodeChild => {\n // If already resolved, render immediately\n if (resolved) {\n return resolved(props)\n }\n\n // If error occurred, throw it (will be caught by ErrorBoundary)\n if (error) {\n throw error\n }\n\n // Get suspense context\n const suspense = suspenseContext()\n\n // Start loading if not already\n if (!promise) {\n promise = loader()\n .then(module => {\n resolved = module.default\n })\n .catch(err => {\n error = err instanceof Error ? err : new Error(String(err))\n })\n }\n\n // Register with suspense boundary if available\n if (suspense.hasBoundary) {\n suspense.register(promise)\n }\n\n // Return null - Suspense will show fallback\n return null\n }\n\n // Mark as lazy component\n ;(LazyWrapper as LazyComponent<P>)._lazy = true\n ;(LazyWrapper as LazyComponent<P>)._loader = loader\n\n return LazyWrapper as LazyComponent<P>\n}\n"]}
1
+ {"version":3,"sources":["../src/dom/f.ts","../src/dom/hydrate.ts","../src/dom/components/Portal.tsx","../src/dom/components/suspenseContext.ts","../src/dom/components/Suspense.tsx","../src/dom/components/ErrorBoundary.tsx","../src/dom/components/lazy.ts"],"names":["f","type","props","children","hydrationCursor","hydratedInstanceRegistry","currentHydratingInstance","hydrate","app","container","options","state","onHydrated","onMismatch","fnode","isFNode","hydrateNode","error","render","value","parent","skipEmptyTextNodes","hydrateTextNode","nodes","child","result","hydrateComponent","hydrateElement","text","current","tag","key","eventName","savedCursor","Component","contextId","isProvider","prevContextValue","pushContext","parentRegistry","hasExplicitKey","instanceCount","componentName","_","k","instance","previousHydratingInstance","runWithComponent","isFirstRender","renderFn","currentProps","unsafeEffect","popContext","Portal","target","portalState","hook","use","onCleanup","portalWrapper","defaultValue","SuspenseCtx","Context","suspenseContext","Suspense","fallback","pendingSet","setPendingCount","showFallback","setShowFallback","contextValue","promise","newCount","content","ErrorBoundary","onError","resetKey","errorState","setErrorState","prevResetKeyRef","lazy","loader","resolved","LazyWrapper","suspense","module","err"],"mappings":"iNAKO,SAASA,CAAAA,CACZC,CAAAA,CACAC,CAAAA,CAAAA,GACGC,CAAAA,CACE,CACL,OAAO,CACH,IAAA,CAAAF,CAAAA,CACA,KAAA,CAAOC,CAAAA,EAAS,GAChB,QAAA,CAAAC,CAAAA,CACA,GAAA,CAAKD,CAAAA,EAAO,GAChB,CACJ,CCTA,IACIE,CAAAA,CAA+B,IAAA,CAkC7BC,EAA2B,IAAI,OAAA,CACjCC,CAAAA,CAAwD,KAarD,SAASC,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CAA0B,EAAC,CACrB,CACN,GAAM,CAAE,MAAAC,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A,GAC/BA,CAAAA,CAAgB,OAAA,CAAUH,EACtBC,CAAAA,CAAW,KAAA,GAAU,MACvBC,CAAAA,CAAc,CAAE,MAAO,IAAA,CAAM,IAAA,CAAM,IAAK,CAAC,CAAA,CAAA,CAqB7C,GAAID,CAAAA,CAAW,MACb,OAAI,OAAOZ,CAAAA,EAAa,UAAA,CACfA,CAAAA,CAASY,CAAAA,CAAW,MAAOA,CAAAA,CAAW,IAAK,EAE7CZ,CAAAA,CAMT,GAAI,CAEF,OAAO9D,CACT,CAAA,OAAE,CAEF,CACF,CCtFO,SAAS6E,EACdC,CAAAA,CACkB,CAElB,IAAIC,CAAAA,CAA8C,IAAA,CAC9CX,CAAAA,CAA+B,KAC/BtD,CAAAA,CAAsB,IAAA,CAGpBkE,EAAejF,CAAAA,EAAyB,CAE5C,GAAIgF,CAAAA,CACF,OAAOA,CAAAA,CAAShF,CAAK,CAAA,CAIvB,GAAIe,EACF,MAAMA,CAAAA,CAIR,IAAMmE,CAAAA,CAAWrB,CAAAA,GAGjB,OAAKQ,CAAAA,GACHA,CAAAA,CAAUU,CAAAA,EAAO,CACd,IAAA,CAAKI,GAAU,CACdH,CAAAA,CAAWG,EAAO,QACpB,CAAC,EACA,KAAA,CAAMC,CAAAA,EAAO,CACZrE,CAAAA,CAAQqE,CAAAA,YAAe,KAAA,CAAQA,EAAM,IAAI,KAAA,CAAM,OAAOA,CAAG,CAAC,EAC5D,CAAC,CAAA,CAAA,CAIDF,CAAAA,CAAS,WAAA,EACXA,CAAAA,CAAS,QAAA,CAASb,CAAO,CAAA,CAIpB,IACT,EAGC,OAACY,CAAAA,CAAiC,MAAQ,IAAA,CACzCA,CAAAA,CAAiC,OAAA,CAAUF,CAAAA,CAEtCE,CACT","file":"dom.js","sourcesContent":["import type { FNode } from './types'\n\n/**\n * f() - Create FNodes without JSX\n */\nexport function f(\n type: string | Function,\n props?: any,\n ...children: any[]\n): FNode {\n return {\n type,\n props: props || {},\n children,\n key: props?.key\n }\n}\n","import type { FNode, FNodeChild } from './types'\nimport type { SerializedState } from '../server/types'\nimport { runWithComponent, type ComponentInstance } from '../core/hook'\nimport { pushContext, popContext } from '../core/context'\nimport { unsafeEffect } from '../core/lifecycle'\n\n// Hydration state\nlet isHydrating = false\nlet hydrationCursor: Node | null = null\nlet hydrationState: SerializedState | null = null\n\nexport interface HydrateOptions {\n /**\n * Serialized state from server\n * Typically embedded in HTML as JSON script tag\n */\n state?: SerializedState\n\n /**\n * Called when hydration completes successfully\n */\n onHydrated?: () => void\n\n /**\n * Called when hydration fails (falls back to full render)\n */\n onMismatch?: (error: Error) => void\n}\n\n// Extended ComponentInstance for DOM tracking (same as render.ts)\ninterface DOMComponentInstance extends ComponentInstance {\n nodes: Node[]\n parent: HTMLElement\n fnode: any\n props: any\n key?: any\n renderFn?: () => void\n children: Set<DOMComponentInstance>\n parentInstance?: DOMComponentInstance\n}\n\n// Registry for hydrated components\nconst hydratedInstanceRegistry = new WeakMap<HTMLElement, Map<any, DOMComponentInstance>>()\nlet currentHydratingInstance: DOMComponentInstance | null = null\n\nexport function getIsHydrating(): boolean {\n return isHydrating\n}\n\nexport function getHydrationState(): SerializedState | null {\n return hydrationState\n}\n\n/**\n * Hydrate server-rendered HTML with client-side interactivity\n */\nexport function hydrate(\n app: FNodeChild | (() => FNodeChild),\n container: HTMLElement,\n options: HydrateOptions = {}\n): void {\n const { state, onHydrated, onMismatch } = options\n\n // Store state for rehydration\n hydrationState = state || null\n\n // Initialize hydration mode\n isHydrating = true\n hydrationCursor = container.firstChild\n\n try {\n // Normalize input\n let fnode: FNodeChild\n if (typeof app === 'function' && !isFNode(app)) {\n fnode = { type: app, props: {}, children: [], key: undefined }\n } else {\n fnode = app\n }\n\n // Hydrate the tree\n hydrateNode(fnode, container)\n\n onHydrated?.()\n } catch (error) {\n // Hydration mismatch - fall back to full render\n console.warn('[Flexium] Hydration mismatch, falling back to full render:', error)\n onMismatch?.(error as Error)\n\n // Clear and re-render\n container.innerHTML = ''\n // Import dynamically to avoid circular deps\n import('./render').then(({ render }) => {\n render(app, container)\n })\n } finally {\n isHydrating = false\n hydrationCursor = null\n hydrationState = null\n }\n}\n\nfunction isFNode(value: any): value is FNode {\n return value && typeof value === 'object' && 'type' in value && 'props' in value\n}\n\nfunction hydrateNode(fnode: FNodeChild, parent: HTMLElement): Node | Node[] | null {\n // Null/undefined/boolean -> skip empty text nodes\n if (fnode === null || fnode === undefined || typeof fnode === 'boolean') {\n // Server might have rendered an empty text node\n skipEmptyTextNodes()\n return null\n }\n\n // String/number -> expect text node\n if (typeof fnode === 'string' || typeof fnode === 'number') {\n return hydrateTextNode(String(fnode))\n }\n\n // Array -> hydrate each child\n if (Array.isArray(fnode)) {\n const nodes: Node[] = []\n for (const child of fnode) {\n const result = hydrateNode(child, parent)\n if (result) {\n if (Array.isArray(result)) {\n nodes.push(...result)\n } else {\n nodes.push(result)\n }\n }\n }\n return nodes\n }\n\n // Function (standalone) -> wrap in FNode and hydrate\n if (typeof fnode === 'function') {\n const wrappedFnode: FNode = { type: fnode, props: {}, children: [], key: undefined }\n return hydrateComponent(wrappedFnode, parent)\n }\n\n // Object (FNode)\n if (typeof fnode === 'object' && isFNode(fnode)) {\n if (typeof fnode.type === 'string') {\n return hydrateElement(fnode)\n }\n\n if (typeof fnode.type === 'function') {\n return hydrateComponent(fnode, parent)\n }\n }\n\n return null\n}\n\nfunction skipEmptyTextNodes(): void {\n while (\n hydrationCursor &&\n hydrationCursor.nodeType === Node.TEXT_NODE &&\n (!hydrationCursor.textContent || hydrationCursor.textContent.trim() === '')\n ) {\n hydrationCursor = hydrationCursor.nextSibling\n }\n}\n\nfunction hydrateTextNode(text: string): Node | null {\n skipEmptyTextNodes()\n\n const current = hydrationCursor\n\n if (!current) {\n // No node to hydrate - this is okay for conditional rendering\n return null\n }\n\n if (current.nodeType !== Node.TEXT_NODE) {\n // Try to find a text node nearby (whitespace handling)\n if (text.trim() === '') {\n return null\n }\n throw new Error(`Hydration mismatch: expected text node \"${text}\", got ${current.nodeName}`)\n }\n\n // Update cursor\n hydrationCursor = current.nextSibling\n\n return current\n}\n\nfunction hydrateElement(fnode: FNode): Node {\n skipEmptyTextNodes()\n\n const current = hydrationCursor as Element\n const tag = fnode.type as string\n\n // Validate element type\n if (!current || current.nodeType !== Node.ELEMENT_NODE) {\n throw new Error(`Hydration mismatch: expected element <${tag}>, got ${current?.nodeName || 'nothing'}`)\n }\n\n if (current.tagName.toLowerCase() !== tag.toLowerCase()) {\n throw new Error(`Hydration mismatch: expected <${tag}>, got <${current.tagName.toLowerCase()}>`)\n }\n\n // Attach event handlers and refs (don't modify DOM structure)\n if (fnode.props) {\n for (const [key, value] of Object.entries(fnode.props)) {\n if (key === 'ref') {\n if (typeof value === 'function') {\n value(current)\n } else if (value && typeof value === 'object' && 'current' in value) {\n value.current = current\n }\n } else if (key.startsWith('on') && typeof value === 'function') {\n const eventName = key.slice(2).toLowerCase()\n current.addEventListener(eventName, value as EventListener)\n\n // Store for reconciliation\n if (!(current as any).__eventHandlers) {\n (current as any).__eventHandlers = {}\n }\n (current as any).__eventHandlers[eventName] = value\n }\n }\n }\n\n // Move cursor past this element\n hydrationCursor = current.nextSibling\n\n // Hydrate children\n if (fnode.children && fnode.children.length > 0) {\n const savedCursor = hydrationCursor\n\n hydrationCursor = current.firstChild\n\n for (const child of fnode.children) {\n hydrateNode(child, current as HTMLElement)\n }\n\n hydrationCursor = savedCursor\n }\n\n return current\n}\n\nfunction hydrateComponent(fnode: FNode, parent: HTMLElement): Node | Node[] | null {\n const Component = fnode.type as Function\n\n // Merge props\n const props = { ...fnode.props }\n if (fnode.children && fnode.children.length > 0) {\n props.children = fnode.children.length === 1\n ? fnode.children[0]\n : fnode.children\n }\n\n // Handle context providers\n const contextId = (Component as any)._contextId\n const isProvider = contextId !== undefined\n let prevContextValue: any\n\n if (isProvider) {\n prevContextValue = pushContext(contextId, props.value)\n }\n\n // Generate key (same logic as render.ts)\n if (!hydratedInstanceRegistry.has(parent)) {\n hydratedInstanceRegistry.set(parent, new Map())\n }\n const parentRegistry = hydratedInstanceRegistry.get(parent)!\n\n const hasExplicitKey = fnode.key !== undefined\n let key: any\n if (hasExplicitKey) {\n key = fnode.key\n } else {\n let instanceCount = 0\n const componentName = (Component as any).name || 'anonymous'\n parentRegistry.forEach((_, k) => {\n if (typeof k === 'string' && k.startsWith(`__auto_${componentName}_`)) {\n instanceCount++\n }\n })\n key = `__auto_${componentName}_${instanceCount}`\n }\n\n // Create component instance\n const instance: DOMComponentInstance = {\n hooks: [],\n hookIndex: 0,\n nodes: [],\n parent,\n fnode,\n props,\n key,\n children: new Set(),\n parentInstance: currentHydratingInstance || undefined\n }\n\n if (currentHydratingInstance) {\n currentHydratingInstance.children.add(instance)\n }\n\n parentRegistry.set(key, instance)\n\n const previousHydratingInstance = currentHydratingInstance\n currentHydratingInstance = instance\n\n try {\n // First render during hydration - just match DOM\n const result = runWithComponent(instance, () => Component(props))\n const nodes = hydrateNode(result, parent)\n instance.nodes = nodes ? (Array.isArray(nodes) ? nodes : [nodes]) : []\n\n // Set up reactive re-rendering for future updates\n let isFirstRender = true\n const renderFn = () => {\n if (isFirstRender) {\n isFirstRender = false\n return // Skip first render, already done during hydration\n }\n\n // Re-render logic (same as render.ts but simplified)\n const currentProps = instance.props\n runWithComponent(instance, () => Component(currentProps))\n\n // For subsequent renders, use full render path\n // This will be handled by the normal reconciliation\n }\n\n instance.renderFn = renderFn\n unsafeEffect(renderFn)\n\n return instance.nodes\n } finally {\n currentHydratingInstance = previousHydratingInstance\n\n if (isProvider) {\n popContext(contextId, prevContextValue)\n }\n }\n}\n","import { use } from '../../core/use'\nimport { hook } from '../../core/hook'\nimport { render } from '../render'\nimport type { PortalProps } from './types'\n\n/**\n * Portal component that renders children into a different DOM node\n *\n * @example\n * ```tsx\n * function Modal({ isOpen, onClose, children }) {\n * if (!isOpen) return null\n *\n * return (\n * <Portal target={document.body}>\n * <div class=\"modal-backdrop\" onClick={onClose}>\n * <div class=\"modal-content\" onClick={e => e.stopPropagation()}>\n * {children}\n * </div>\n * </div>\n * </Portal>\n * )\n * }\n * ```\n */\nexport function Portal(props: PortalProps): null {\n const { target, children } = props\n\n // Store rendered container for cleanup\n const portalState = hook(() => ({\n container: null as HTMLElement | null,\n mounted: false\n }))\n\n use(({ onCleanup }) => {\n // Resolve target container\n let container: HTMLElement | null = null\n\n if (typeof target === 'string') {\n container = document.querySelector(target)\n } else if (target instanceof HTMLElement) {\n container = target\n }\n\n if (!container) {\n console.warn('[Flexium Portal] Target container not found:', target)\n return\n }\n\n // Create a wrapper div to contain portal content\n const portalWrapper = document.createElement('div')\n portalWrapper.setAttribute('data-flexium-portal', 'true')\n container.appendChild(portalWrapper)\n\n portalState.container = portalWrapper\n portalState.mounted = true\n\n // Render children into the portal wrapper\n render(children, portalWrapper)\n\n // Cleanup function\n onCleanup(() => {\n if (portalWrapper.parentNode) {\n portalWrapper.parentNode.removeChild(portalWrapper)\n }\n portalState.container = null\n portalState.mounted = false\n })\n }, [target, children])\n\n // Portal renders nothing in its original location\n return null\n}\n","import { Context } from '../../core/context'\nimport { use } from '../../core/use'\nimport type { SuspenseContextValue } from './types'\n\nconst defaultValue: SuspenseContextValue = {\n register: () => {},\n hasBoundary: false\n}\n\nexport const SuspenseCtx = new Context<SuspenseContextValue>(defaultValue)\n\nexport function suspenseContext(): SuspenseContextValue {\n const [value] = use(SuspenseCtx)\n return value\n}\n","import { use } from '../../core/use'\nimport { hook } from '../../core/hook'\nimport { SuspenseCtx } from './suspenseContext'\nimport type { SuspenseProps, SuspenseContextValue } from './types'\nimport type { FNodeChild } from '../types'\n\n/**\n * Suspense component that shows fallback while children are loading\n *\n * @example\n * ```tsx\n * const Dashboard = lazy(() => import('./Dashboard'))\n *\n * function App() {\n * return (\n * <Suspense fallback={<div>Loading...</div>}>\n * <Dashboard />\n * </Suspense>\n * )\n * }\n * ```\n */\nexport function Suspense(props: SuspenseProps): FNodeChild {\n const { fallback, children } = props\n\n // Track pending promises using hook for mutable Set\n const pendingSet = hook(() => new Set<Promise<any>>())\n const [, setPendingCount] = use(0)\n const [showFallback, setShowFallback] = use(false)\n\n // Register function for lazy components\n const register = (promise: Promise<any>) => {\n if (!pendingSet.has(promise)) {\n // Add to pending set\n pendingSet.add(promise)\n setPendingCount(c => c + 1)\n setShowFallback(true)\n\n // Wait for resolution\n promise.finally(() => {\n pendingSet.delete(promise)\n setPendingCount(c => {\n const newCount = c - 1\n if (newCount === 0) {\n setShowFallback(false)\n }\n return newCount\n })\n })\n }\n }\n\n const contextValue: SuspenseContextValue = {\n register,\n hasBoundary: true\n }\n\n // Render fallback or children based on pending state\n const content = showFallback ? fallback : children\n\n // Wrap content with Suspense context provider\n return {\n type: SuspenseCtx.Provider,\n props: { value: contextValue },\n children: [content],\n key: undefined\n } as any\n}\n","import { use } from '../../core/use'\nimport { hook } from '../../core/hook'\nimport type { FNodeChild } from '../types'\nimport type { ErrorInfo, ErrorBoundaryProps } from './types'\n\n// Component name stack for error messages\nlet componentNameStack: string[] = []\n\nexport function pushComponentName(name: string): void {\n componentNameStack.push(name)\n}\n\nexport function popComponentName(): void {\n componentNameStack.pop()\n}\n\nexport function getComponentStack(): string {\n return componentNameStack\n .map(name => ` at ${name}`)\n .reverse()\n .join('\\n')\n}\n\n// Stack of error boundaries for nested error propagation\ninterface ErrorBoundaryInstance {\n handleError: (error: Error, phase: 'render' | 'effect' | 'event') => void\n}\n\nlet errorBoundaryStack: ErrorBoundaryInstance[] = []\n\nexport function pushErrorBoundary(instance: ErrorBoundaryInstance): void {\n errorBoundaryStack.push(instance)\n}\n\nexport function popErrorBoundary(): void {\n errorBoundaryStack.pop()\n}\n\nexport function getNearestErrorBoundary(): ErrorBoundaryInstance | null {\n return errorBoundaryStack[errorBoundaryStack.length - 1] || null\n}\n\n/**\n * ErrorBoundary component that catches errors in its children and displays fallback UI\n *\n * @example\n * ```tsx\n * <ErrorBoundary\n * fallback={(error, info) => <div>Error: {error.message}</div>}\n * onError={(error, info) => console.error(error)}\n * >\n * <App />\n * </ErrorBoundary>\n * ```\n */\nexport function ErrorBoundary(props: ErrorBoundaryProps): FNodeChild {\n const { fallback, onError, children, resetKey } = props\n\n // Error state\n const [errorState, setErrorState] = use<{\n error: Error | null\n info: ErrorInfo | null\n }>({ error: null, info: null })\n\n // Track reset key changes to clear error\n const prevResetKeyRef = hook(() => ({ current: resetKey }))\n\n if (resetKey !== prevResetKeyRef.current) {\n prevResetKeyRef.current = resetKey\n if (errorState.error !== null) {\n setErrorState({ error: null, info: null })\n }\n }\n\n // Error boundary instance\n const boundaryInstance: ErrorBoundaryInstance = {\n handleError: (error: Error, phase: 'render' | 'effect' | 'event') => {\n const info: ErrorInfo = {\n componentStack: getComponentStack(),\n phase\n }\n\n // Call error callback\n onError?.(error, info)\n\n // Update error state (triggers re-render with fallback)\n setErrorState({ error, info })\n }\n }\n\n // If we have an error, render fallback\n if (errorState.error) {\n if (typeof fallback === 'function') {\n return fallback(errorState.error, errorState.info!)\n }\n return fallback\n }\n\n // Push boundary onto stack for children to use\n pushErrorBoundary(boundaryInstance)\n\n try {\n // Return children - they will be rendered with this boundary active\n return children\n } finally {\n popErrorBoundary()\n }\n}\n","import { suspenseContext } from './suspenseContext'\nimport type { FNodeChild } from '../types'\nimport type { LazyComponent } from './types'\n\n/**\n * Creates a lazy-loaded component for code splitting\n *\n * @example\n * ```tsx\n * const Dashboard = lazy(() => import('./Dashboard'))\n * const Settings = lazy(() => import('./Settings'))\n *\n * function App() {\n * return (\n * <Suspense fallback={<div>Loading...</div>}>\n * <Dashboard />\n * </Suspense>\n * )\n * }\n * ```\n */\nexport function lazy<P = {}>(\n loader: () => Promise<{ default: (props: P) => FNodeChild }>\n): LazyComponent<P> {\n // Shared state across all instances\n let resolved: ((props: P) => FNodeChild) | null = null\n let promise: Promise<any> | null = null\n let error: Error | null = null\n\n // The wrapper component\n const LazyWrapper = (props: P): FNodeChild => {\n // If already resolved, render immediately\n if (resolved) {\n return resolved(props)\n }\n\n // If error occurred, throw it (will be caught by ErrorBoundary)\n if (error) {\n throw error\n }\n\n // Get suspense context\n const suspense = suspenseContext()\n\n // Start loading if not already\n if (!promise) {\n promise = loader()\n .then(module => {\n resolved = module.default\n })\n .catch(err => {\n error = err instanceof Error ? err : new Error(String(err))\n })\n }\n\n // Register with suspense boundary if available\n if (suspense.hasBoundary) {\n suspense.register(promise)\n }\n\n // Return null - Suspense will show fallback\n return null\n }\n\n // Mark as lazy component\n ;(LazyWrapper as LazyComponent<P>)._lazy = true\n ;(LazyWrapper as LazyComponent<P>)._loader = loader\n\n return LazyWrapper as LazyComponent<P>\n}\n"]}
package/dist/dom.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import {b as b$3}from'./chunk-JUP6RTZA.mjs';export{a as reconcile,b as render}from'./chunk-JUP6RTZA.mjs';import {c as c$1}from'./chunk-INJXOHFD.mjs';import {b as b$1}from'./chunk-NRPWBHKP.mjs';import {a as a$1,b as b$2}from'./chunk-5PNH2ARD.mjs';import {a,c,d,b as b$4}from'./chunk-NDPEE2TQ.mjs';function j(e,t,...o){return {type:e,props:t||{},children:o,key:t?.key}}var l=null,F=new WeakMap,h=null;function R(e,t,o={}){let{state:n,onHydrated:r,onMismatch:i}=o;l=t.firstChild;try{let s;typeof e=="function"&&!b(e)?s={type:e,props:{},children:[],key:void 0}:s=e,E(s,t),r?.();}catch(s){console.warn("[Flexium] Hydration mismatch, falling back to full render:",s),i?.(s),t.innerHTML="",import('./render-L57MA662.mjs').then(({render:p})=>{p(e,t);});}finally{l=null;}}function b(e){return e&&typeof e=="object"&&"type"in e&&"props"in e}function E(e,t){if(e==null||typeof e=="boolean")return v(),null;if(typeof e=="string"||typeof e=="number")return K(String(e));if(Array.isArray(e)){let o=[];for(let n of e){let r=E(n,t);r&&(Array.isArray(r)?o.push(...r):o.push(r));}return o}if(typeof e=="function")return _({type:e,props:{},children:[],key:void 0},t);if(typeof e=="object"&&b(e)){if(typeof e.type=="string")return X(e);if(typeof e.type=="function")return _(e,t)}return null}function v(){for(;l&&l.nodeType===Node.TEXT_NODE&&(!l.textContent||l.textContent.trim()==="");)l=l.nextSibling;}function K(e){v();let t=l;if(!t)return null;if(t.nodeType!==Node.TEXT_NODE){if(e.trim()==="")return null;throw new Error(`Hydration mismatch: expected text node "${e}", got ${t.nodeName}`)}return l=t.nextSibling,t}function X(e){v();let t=l,o=e.type;if(!t||t.nodeType!==Node.ELEMENT_NODE)throw new Error(`Hydration mismatch: expected element <${o}>, got ${t?.nodeName||"nothing"}`);if(t.tagName.toLowerCase()!==o.toLowerCase())throw new Error(`Hydration mismatch: expected <${o}>, got <${t.tagName.toLowerCase()}>`);if(e.props){for(let[n,r]of Object.entries(e.props))if(n==="ref")typeof r=="function"?r(t):r&&typeof r=="object"&&"current"in r&&(r.current=t);else if(n.startsWith("on")&&typeof r=="function"){let i=n.slice(2).toLowerCase();t.addEventListener(i,r),t.__eventHandlers||(t.__eventHandlers={}),t.__eventHandlers[i]=r;}}if(l=t.nextSibling,e.children&&e.children.length>0){let n=l;l=t.firstChild;for(let r of e.children)E(r,t);l=n;}return t}function _(e,t){let o=e.type,n={...e.props};e.children&&e.children.length>0&&(n.children=e.children.length===1?e.children[0]:e.children);let r=o._contextId,i=r!==void 0,s;i&&(s=c(r,n.value)),F.has(t)||F.set(t,new Map);let p=F.get(t),C=e.key!==void 0,u;if(C)u=e.key;else {let c=0,y=o.name||"anonymous";p.forEach((g,x)=>{typeof x=="string"&&x.startsWith(`__auto_${y}_`)&&c++;}),u=`__auto_${y}_${c}`;}let a={hooks:[],hookIndex:0,nodes:[],parent:t,fnode:e,props:n,key:u,children:new Set,parentInstance:h||void 0};h&&h.children.add(a),p.set(u,a);let d$1=h;h=a;try{let c=a$1(a,()=>o(n)),y=E(c,t);a.nodes=y?Array.isArray(y)?y:[y]:[];let g=!0,x=()=>{if(g){g=!1;return}let A=a.props;a$1(a,()=>o(A));};return a.renderFn=x,b$1(x),a.nodes}finally{h=d$1,i&&d(r,s);}}function z(e){let{target:t,children:o}=e,n=b$2(()=>({container:null,mounted:false}));return c$1(({onCleanup:r})=>{let i=null;if(typeof t=="string"?i=document.querySelector(t):t instanceof HTMLElement&&(i=t),!i){console.warn("[Flexium Portal] Target container not found:",t);return}let s=document.createElement("div");s.setAttribute("data-flexium-portal","true"),i.appendChild(s),n.container=s,n.mounted=true,b$3(o,s),r(()=>{s.parentNode&&s.parentNode.removeChild(s),n.container=null,n.mounted=false;});},[t,o]),null}var q={register:()=>{},hasBoundary:false},I=a(q);function N(){return b$4(I)}function O(e){let{fallback:t,children:o}=e,n=b$2(()=>new Set),[,r]=c$1(0),[i,s]=c$1(false),C={register:a=>{n.has(a)||(n.add(a),r(d=>d+1),s(true),a.finally(()=>{n.delete(a),r(d=>{let c=d-1;return c===0&&s(false),c});}));},hasBoundary:true},u=i?t:o;return {type:I.Provider,props:{value:C},children:[u],key:void 0}}function $(e){let{fallback:t,onError:o,children:n,resetKey:r}=e,[i,s]=c$1({error:null,info:null}),p=b$2(()=>({current:r}));r!==p.current&&(p.current=r,i.error!==null&&s({error:null,info:null}));if(i.error)return typeof t=="function"?t(i.error,i.info):t;try{return n}finally{}}function D(e){let t=null,o=null,n=null,r=i=>{if(t)return t(i);if(n)throw n;let s=N();return o||(o=e().then(p=>{t=p.default;}).catch(p=>{n=p instanceof Error?p:new Error(String(p));})),s.hasBoundary&&s.register(o),null};return r._lazy=true,r._loader=e,r}export{$ as ErrorBoundary,z as Portal,O as Suspense,j as f,R as hydrate,D as lazy,N as suspenseContext};//# sourceMappingURL=dom.mjs.map
1
+ import {b as b$3}from'./chunk-TP5HUAIN.mjs';export{a as reconcile,b as render}from'./chunk-TP5HUAIN.mjs';import {c as c$1}from'./chunk-3AKECLKA.mjs';import {b as b$1}from'./chunk-NRPWBHKP.mjs';import {c,e,a,f,b as b$2}from'./chunk-MI76R42D.mjs';function W(e,t,...o){return {type:e,props:t||{},children:o,key:t?.key}}var l=null,F=new WeakMap,h=null;function j(e,t,o={}){let{state:n,onHydrated:r,onMismatch:i}=o;l=t.firstChild;try{let s;typeof e=="function"&&!_(e)?s={type:e,props:{},children:[],key:void 0}:s=e,E(s,t),r?.();}catch(s){console.warn("[Flexium] Hydration mismatch, falling back to full render:",s),i?.(s),t.innerHTML="",import('./render-4HB53K66.mjs').then(({render:p})=>{p(e,t);});}finally{l=null;}}function _(e){return e&&typeof e=="object"&&"type"in e&&"props"in e}function E(e,t){if(e==null||typeof e=="boolean")return v(),null;if(typeof e=="string"||typeof e=="number")return R(String(e));if(Array.isArray(e)){let o=[];for(let n of e){let r=E(n,t);r&&(Array.isArray(r)?o.push(...r):o.push(r));}return o}if(typeof e=="function")return T({type:e,props:{},children:[],key:void 0},t);if(typeof e=="object"&&_(e)){if(typeof e.type=="string")return K(e);if(typeof e.type=="function")return T(e,t)}return null}function v(){for(;l&&l.nodeType===Node.TEXT_NODE&&(!l.textContent||l.textContent.trim()==="");)l=l.nextSibling;}function R(e){v();let t=l;if(!t)return null;if(t.nodeType!==Node.TEXT_NODE){if(e.trim()==="")return null;throw new Error(`Hydration mismatch: expected text node "${e}", got ${t.nodeName}`)}return l=t.nextSibling,t}function K(e){v();let t=l,o=e.type;if(!t||t.nodeType!==Node.ELEMENT_NODE)throw new Error(`Hydration mismatch: expected element <${o}>, got ${t?.nodeName||"nothing"}`);if(t.tagName.toLowerCase()!==o.toLowerCase())throw new Error(`Hydration mismatch: expected <${o}>, got <${t.tagName.toLowerCase()}>`);if(e.props){for(let[n,r]of Object.entries(e.props))if(n==="ref")typeof r=="function"?r(t):r&&typeof r=="object"&&"current"in r&&(r.current=t);else if(n.startsWith("on")&&typeof r=="function"){let i=n.slice(2).toLowerCase();t.addEventListener(i,r),t.__eventHandlers||(t.__eventHandlers={}),t.__eventHandlers[i]=r;}}if(l=t.nextSibling,e.children&&e.children.length>0){let n=l;l=t.firstChild;for(let r of e.children)E(r,t);l=n;}return t}function T(e$1,t){let o=e$1.type,n={...e$1.props};e$1.children&&e$1.children.length>0&&(n.children=e$1.children.length===1?e$1.children[0]:e$1.children);let r=o._contextId,i=r!==void 0,s;i&&(s=e(r,n.value)),F.has(t)||F.set(t,new Map);let p=F.get(t),C=e$1.key!==void 0,u;if(C)u=e$1.key;else {let y=0,f=o.name||"anonymous";p.forEach((g,x)=>{typeof x=="string"&&x.startsWith(`__auto_${f}_`)&&y++;}),u=`__auto_${f}_${y}`;}let a$1={hooks:[],hookIndex:0,nodes:[],parent:t,fnode:e$1,props:n,key:u,children:new Set,parentInstance:h||void 0};h&&h.children.add(a$1),p.set(u,a$1);let c=h;h=a$1;try{let y=a(a$1,()=>o(n)),f=E(y,t);a$1.nodes=f?Array.isArray(f)?f:[f]:[];let g=!0,x=()=>{if(g){g=!1;return}let D=a$1.props;a(a$1,()=>o(D));};return a$1.renderFn=x,b$1(x),a$1.nodes}finally{h=c,i&&f(r,s);}}function b(e){let{target:t,children:o}=e,n=b$2(()=>({container:null,mounted:false}));return c$1(({onCleanup:r})=>{let i=null;if(typeof t=="string"?i=document.querySelector(t):t instanceof HTMLElement&&(i=t),!i){console.warn("[Flexium Portal] Target container not found:",t);return}let s=document.createElement("div");s.setAttribute("data-flexium-portal","true"),i.appendChild(s),n.container=s,n.mounted=true,b$3(o,s),r(()=>{s.parentNode&&s.parentNode.removeChild(s),n.container=null,n.mounted=false;});},[t,o]),null}var X={register:()=>{},hasBoundary:false},I=new c(X);function N(){let[e]=c$1(I);return e}function z(e){let{fallback:t,children:o}=e,n=b$2(()=>new Set),[,r]=c$1(0),[i,s]=c$1(false),C={register:a=>{n.has(a)||(n.add(a),r(c=>c+1),s(true),a.finally(()=>{n.delete(a),r(c=>{let y=c-1;return y===0&&s(false),y});}));},hasBoundary:true},u=i?t:o;return {type:I.Provider,props:{value:C},children:[u],key:void 0}}function V(e){let{fallback:t,onError:o,children:n,resetKey:r}=e,[i,s]=c$1({error:null,info:null}),p=b$2(()=>({current:r}));r!==p.current&&(p.current=r,i.error!==null&&s({error:null,info:null}));if(i.error)return typeof t=="function"?t(i.error,i.info):t;try{return n}finally{}}function $(e){let t=null,o=null,n=null,r=i=>{if(t)return t(i);if(n)throw n;let s=N();return o||(o=e().then(p=>{t=p.default;}).catch(p=>{n=p instanceof Error?p:new Error(String(p));})),s.hasBoundary&&s.register(o),null};return r._lazy=true,r._loader=e,r}export{V as ErrorBoundary,b as Portal,z as Suspense,W as f,j as hydrate,$ as lazy,N as suspenseContext};//# sourceMappingURL=dom.mjs.map
2
2
  //# sourceMappingURL=dom.mjs.map