flexium 0.12.11 → 0.12.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dom.js +1 -1
- package/dist/dom.js.map +1 -1
- package/dist/dom.mjs +1 -1
- package/dist/dom.mjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/package.json +1 -1
package/dist/dom.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var chunkLUW7DIEW_js=require('./chunk-LUW7DIEW.js'),chunkENWGYQNU_js=require('./chunk-ENWGYQNU.js');var
|
|
1
|
+
'use strict';var chunkLUW7DIEW_js=require('./chunk-LUW7DIEW.js'),chunkENWGYQNU_js=require('./chunk-ENWGYQNU.js');var m=new WeakMap,l=null;function H(e){e.children.forEach(n=>{H(n);}),e.nodes.forEach(n=>{n.parentNode&&n.parentNode.removeChild(n);}),e.children.clear(),e.parentInstance&&e.parentInstance.children.delete(e);}function E(e,n,a){let c=a||n,r=f=>{let u={...f.props};return f.children&&f.children.length>0&&(u.children=f.children.length===1?f.children[0]:f.children),u},o=e.key!==void 0;m.has(c)||m.set(c,new Map);let t=m.get(c),i;if(o)i=e.key;else {let f=0,u=e.type.name||"anonymous";t.forEach((b,h)=>{typeof h=="string"&&h.startsWith(`__auto_${u}_`)&&f++;}),i=`__auto_${u}_${f}`;}if(t.has(i)){let f=t.get(i);f.fnode=e;let u=r(e);return f.props=u,f.children.clear(),f.renderFn&&f.renderFn(),f.nodes}let s={hooks:[],hookIndex:0,nodes:[],parent:n,fnode:e,props:r(e),key:i,children:new Set,parentInstance:l||void 0};l&&l.children.add(s),t.set(i,s);let d=true,g=()=>{let f=s.fnode,u=s.props;f.type._contextId!==void 0&&chunkLUW7DIEW_js.c(f.type._contextId,u.value);let h=l;l=s;let M=chunkENWGYQNU_js.g(s,()=>f.type(u));if(d){let _=y(M,n);s.nodes=_?Array.isArray(_)?_:[_]:[],s.nodes.forEach(p=>{p.__ownerInstance||(p.__ownerInstance=s);}),d=false;}else {if(s.nodes.length===0){let N=y(M,n);s.nodes=N?Array.isArray(N)?N:[N]:[],l=h;return}let p=s.nodes[0].parentNode;if(!p){l=h;return}let v=document.createComment("flexium-marker"),T=s.nodes[s.nodes.length-1];T.nextSibling?p.insertBefore(v,T.nextSibling):p.appendChild(v),s.children.clear();let O=document.createElement("div"),C=y(M,O,p),F=C?Array.isArray(C)?C:[C]:[],R=P(s.nodes,F,p,v);p.removeChild(v),s.nodes=R;}l=h;};return s.renderFn=g,chunkENWGYQNU_js.b(g),s.nodes}function y(e,n,a){let c=a||n;if(e==null||typeof e=="boolean"){let r=document.createTextNode("");return n.appendChild(r),r}if(typeof e=="string"||typeof e=="number"){let r=document.createTextNode(String(e));return n.appendChild(r),r}if(Array.isArray(e)){let r=new Set;m.has(c)&&m.get(c).forEach((s,d)=>r.add(d));let o=[];e.forEach(i=>{let s=y(i,n,a);s&&(Array.isArray(s)?o.push(...s):o.push(s));});let t=new Set;if(m.has(c)&&m.get(c).forEach((s,d)=>t.add(d)),m.has(c)){let i=m.get(c),s=[];r.forEach(d=>{if(!t.has(d)){let g=i.get(d);g&&(H(g),s.push(d));}}),s.forEach(d=>i.delete(d));}return o}if(typeof e=="object"){if(typeof e.type=="string"){let r=document.createElement(e.type);return e.props&&Object.entries(e.props).forEach(([o,t])=>{if(o==="ref"&&typeof t=="function")t(r);else if(o.startsWith("on")&&typeof t=="function"){let i=o.slice(2).toLowerCase();r.addEventListener(i,t),r.__eventHandlers||(r.__eventHandlers={}),r.__eventHandlers[i]=t;}else o!=="ref"&&S(r,o,t);}),e.children&&e.children.length>0&&e.children.forEach(o=>{y(o,r);}),n.appendChild(r),r}if(typeof e.type=="function")return e.type._contextId!==void 0,E(e,n,a)}return null}function $(e,n){n.innerHTML="",typeof e=="function"&&(e={type:e,props:{},children:[],key:void 0}),y(e,n);}function B(e,n,...a){return {type:e,props:n||{},children:a,key:n?.key}}function S(e,n,a){a==null?e.removeAttribute(n):n==="style"&&typeof a=="object"?Object.assign(e.style,a):n==="class"?e.className=String(a):n in e&&typeof e[n]!="function"?e[n]=a:e.setAttribute(n,String(a));}function D(e,n){return e.nodeType!==n.nodeType?false:e.nodeType===Node.ELEMENT_NODE&&n.nodeType===Node.ELEMENT_NODE?e.tagName===n.tagName:true}function k(e,n){Array.from(e.attributes).forEach(t=>{n.hasAttribute(t.name)||e.removeAttribute(t.name);}),Array.from(n.attributes).forEach(t=>{e.getAttribute(t.name)!==t.value&&(t.name==="value"&&"value"in e?e.value=t.value:t.name==="checked"&&"checked"in e?e.checked=t.value==="true"||t.value==="":e.setAttribute(t.name,t.value));});let r=e.__eventHandlers||{},o=n.__eventHandlers||{};Object.keys(r).forEach(t=>{o[t]||e.removeEventListener(t,r[t]);}),Object.keys(o).forEach(t=>{r[t]!==o[t]&&(r[t]&&e.removeEventListener(t,r[t]),e.addEventListener(t,o[t]));}),Object.keys(o).length>0?e.__eventHandlers=o:delete e.__eventHandlers,e instanceof HTMLInputElement&&n instanceof HTMLInputElement&&(e.value!==n.value&&(e.value=n.value),e.checked!==n.checked&&(e.checked=n.checked)),e instanceof HTMLTextAreaElement&&n instanceof HTMLTextAreaElement&&e.value!==n.value&&(e.value=n.value),e instanceof HTMLSelectElement&&n instanceof HTMLSelectElement&&e.value!==n.value&&(e.value=n.value);}function j(e,n){let a=Array.from(e.childNodes),c=Array.from(n.childNodes),r=Math.max(a.length,c.length);for(let o=0;o<r;o++){let t=a[o],i=c[o];!t&&i?e.appendChild(i):t&&!i?e.removeChild(t):t&&i&&x(t,i,e);}}function x(e,n,a){if(D(e,n)){let c=n.__ownerInstance;if(c){let r=c.nodes.indexOf(n);r!==-1&&(c.nodes[r]=e),e.__ownerInstance=c,delete n.__ownerInstance;}e.nodeType===Node.TEXT_NODE?e.nodeValue!==n.nodeValue&&(e.nodeValue=n.nodeValue):e.nodeType===Node.ELEMENT_NODE&&(k(e,n),j(e,n));}else a.replaceChild(n,e);}function P(e,n,a,c){let r=Math.max(e.length,n.length),o=[];for(let t=0;t<r;t++){let i=e[t],s=n[t];!i&&s?(a.insertBefore(s,c),o.push(s)):i&&!s?i.parentNode&&a.removeChild(i):i&&s&&(x(i,s,a),o.push(i));}return o}exports.f=B;exports.reconcile=P;exports.render=$;//# sourceMappingURL=dom.js.map
|
|
2
2
|
//# sourceMappingURL=dom.js.map
|
package/dist/dom.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/dom/index.ts"],"names":["instanceRegistry","currentRenderingInstance","removeComponentInstance","instance","child","node","renderComponent","fnode","parent","registryParent","effectiveRegistryParent","mergeProps","props","hasExplicitKey","parentRegistry","key","instanceCount","componentName","_","k","newProps","isFirstRender","renderFn","currentVnode","currentProps","pushContext","previousRenderingInstance","result","runWithComponent","newNodes","renderNode","nodeParent","marker","lastNode","tempContainer","newNodesArray","reconciledNodes","reconcile","unsafeEffect","oldKeysSet","nodes","newKeysSet","keysToRemove","dom","value","eventName","setAttribute","render","app","container","f","type","children","el","canReuse","oldNode","newNode","updateAttributes","oldEl","newEl","attr","oldHandlers","newHandlers","event","reconcileChildren","oldChildren","newChildren","maxLen","i","oldChild","newChild","patchNode","ownerInstance","idx","oldNodes","beforeMarker","resultNodes"],"mappings":"iHA4BA,IAAMA,CAAAA,CAAmB,IAAI,OAAA,CAGzBC,CAAAA,CAAwD,KAG5D,SAASC,CAAAA,CAAwBC,CAAAA,CAAsC,CAEnEA,EAAS,QAAA,CAAS,OAAA,CAAQC,CAAAA,EAAS,CAC/BF,EAAwBE,CAAK,EACjC,CAAC,CAAA,CAGDD,EAAS,KAAA,CAAM,OAAA,CAAQE,CAAAA,EAAQ,CACvBA,EAAK,UAAA,EACLA,CAAAA,CAAK,UAAA,CA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kBrB,CAAAA,CAAcmE,CAAAA,CAA4B,CACpG,IAAMR,EAAS,IAAA,CAAK,GAAA,CAAIO,CAAAA,CAAS,MAAA,CAAQ7C,EAAS,MAAM,CAAA,CAClD+C,CAAAA,CAAsB,GAE5B,IAAA,IAASR,CAAAA,CAAI,CAAA,CAAGA,CAAAA,CAAID,EAAQC,CAAAA,EAAAA,CAAK,CAC7B,IAAMb,CAAAA,CAAUmB,EAASN,CAAC,CAAA,CACpBZ,CAAAA,CAAU3B,CAAAA,CAASuC,CAAC,CAAA,CAEtB,CAACb,CAAAA,EAAWC,CAAAA,EAEZhD,EAAO,YAAA,CAAagD,CAAAA,CAASmB,CAAY,CAAA,CACzCC,EAAY,IAAA,CAAKpB,CAAO,CAAA,EACjBD,CAAAA,EAAW,CAACC,CAAAA,CAEfD,CAAAA,CAAQ,UAAA,EACR/C,CAAAA,CAAO,YAAY+C,CAAO,CAAA,CAEvBA,CAAAA,EAAWC,CAAAA,GAElBe,EAAUhB,CAAAA,CAASC,CAAAA,CAAShD,CAAiB,CAAA,CAC7CoE,EAAY,IAAA,CAAKrB,CAAO,CAAA,EAEhC,CAEA,OAAOqB,CACX","file":"dom.js","sourcesContent":["\nimport { pushContext } from '../core/context'\nimport { runWithComponent, type ComponentInstance } from '../core/hook'\nimport { unsafeEffect } from '../core/effect'\n\n// Types\nexport type FNodeChild = FNode | string | number | boolean | null | undefined | FNodeChild[] | (() => FNode)\n\nexport interface FNode {\n type: string | Function\n props: Record<string, any>\n children: FNodeChild[]\n key?: any\n}\n\n// Extended ComponentInstance for DOM tracking\ninterface DOMComponentInstance extends ComponentInstance {\n nodes: Node[]\n parent: HTMLElement\n vnode: any\n props: any\n key?: any\n renderFn?: () => void // Store render function for manual updates\n children: Set<DOMComponentInstance> // Track child component instances\n parentInstance?: DOMComponentInstance // Track parent component instance\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 // First, recursively remove all child instances\n instance.children.forEach(child => {\n removeComponentInstance(child)\n })\n\n // Remove DOM nodes created by this instance\n instance.nodes.forEach(node => {\n if (node.parentNode) {\n node.parentNode.removeChild(node)\n }\n })\n\n // Clear the children set\n instance.children.clear()\n\n // Remove from parent's children set\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 // Merge props with children\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 // Generate key for this component\n // Use explicit key if provided, otherwise generate auto-key based on render order\n const hasExplicitKey = fnode.key !== undefined\n\n // Get or create registry for this parent\n // Always use the effectiveRegistryParent for registry, not a temp container\n if (!instanceRegistry.has(effectiveRegistryParent)) {\n instanceRegistry.set(effectiveRegistryParent, new Map())\n }\n const parentRegistry = instanceRegistry.get(effectiveRegistryParent)!\n\n // Generate key: explicit key, or auto-increment based on component type\n let key: any\n if (hasExplicitKey) {\n key = fnode.key\n } else {\n // Auto-generate unique key: componentType + instance number\n // Count how many instances of this type already exist\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 // Try to reuse existing instance with same key\n if (parentRegistry.has(key)) {\n const instance = parentRegistry.get(key)!\n\n // Update vnode\n instance.vnode = fnode\n\n // Update props (non-reactive) - we'll trigger re-render manually\n const newProps = mergeProps(fnode)\n\n // Always update props (including children)\n instance.props = newProps\n\n // Always clear old children before re-rendering (they will be re-added during render)\n // This must be done BEFORE renderFn is called\n instance.children.clear()\n\n // Manually trigger re-render by calling renderFn\n if (instance.renderFn) {\n instance.renderFn()\n }\n\n return instance.nodes\n }\n\n // Create component instance with regular props (not reactive)\n const instance: DOMComponentInstance = {\n hooks: [],\n hookIndex: 0,\n nodes: [],\n parent,\n vnode: fnode,\n props: mergeProps(fnode), // Regular props, we handle updates manually\n key,\n children: new Set(),\n parentInstance: currentRenderingInstance || undefined\n }\n\n // Register this instance as a child of the current rendering instance\n if (currentRenderingInstance) {\n currentRenderingInstance.children.add(instance)\n }\n\n // Store instance in registry\n parentRegistry.set(key, instance)\n\n // Track if this is the first render\n let isFirstRender = true\n\n // Function to render the component\n const renderFn = () => {\n const currentVnode = instance.vnode\n const currentProps = instance.props\n\n // Check if this is a Context Provider\n const isProvider = (currentVnode.type as any)._contextId !== undefined\n if (isProvider) {\n // Set context value before rendering\n pushContext((currentVnode.type as any)._contextId, currentProps.value)\n }\n\n // Set this instance as the current rendering instance\n const previousRenderingInstance = currentRenderingInstance\n currentRenderingInstance = instance\n\n // Render component with hook context\n const result = runWithComponent(instance, () => currentVnode.type(currentProps))\n\n // DON'T restore currentRenderingInstance yet - we need it for renderNode calls below\n // It will be restored at the end of this function\n\n if (isFirstRender) {\n // First render: create new DOM nodes\n const newNodes = renderNode(result, parent)\n instance.nodes = newNodes ? (Array.isArray(newNodes) ? newNodes : [newNodes]) : []\n // Mark nodes as owned by this instance (for reconciliation)\n // Only set ownership if not already owned (child components set ownership first)\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 // Re-render: reconcile with existing DOM\n // Don't early return if nodes is empty - component might render other components\n if (instance.nodes.length === 0) {\n // Component has no DOM nodes yet, might be rendering other components\n // Just re-render without reconciliation\n const newNodes = renderNode(result, parent)\n instance.nodes = newNodes ? (Array.isArray(newNodes) ? newNodes : [newNodes]) : []\n // Restore previous rendering instance before returning\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 // Restore previous rendering instance before returning\n currentRenderingInstance = previousRenderingInstance\n return\n }\n\n // Create marker to know where to insert new nodes\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 // Clear children references - actual cleanup happens via key-based registry\n // Don't call removeComponentInstance here as it removes DOM nodes that reconcile needs\n instance.children.clear()\n\n // Create temporary container for collecting new nodes\n const tempContainer = document.createElement('div')\n\n // Render into temp container, but use actual parent for registry\n const newNodes = renderNode(result, tempContainer, nodeParent)\n const newNodesArray = newNodes ? (Array.isArray(newNodes) ? newNodes : [newNodes]) : []\n\n // Use reconcile to patch existing nodes instead of replacing\n const reconciledNodes = reconcile(instance.nodes, newNodesArray, nodeParent, marker)\n\n // Remove marker\n nodeParent.removeChild(marker)\n\n instance.nodes = reconciledNodes\n }\n\n // Restore previous rendering instance after all renderNode calls are done\n currentRenderingInstance = previousRenderingInstance\n }\n\n // Store renderFn for manual updates\n instance.renderFn = renderFn\n\n // Wrap in effect for reactive re-rendering\n unsafeEffect(renderFn)\n\n return instance.nodes\n}\n\nfunction renderNode(fnode: any, parent: HTMLElement, registryParent?: HTMLElement): Node | Node[] | null {\n // Use registryParent for instance lookups if provided, otherwise use parent\n const effectiveRegistryParent = registryParent || parent\n // 1. null/undefined/boolean -> empty text\n if (fnode === null || fnode === undefined || typeof fnode === 'boolean') {\n const node = document.createTextNode('');\n parent.appendChild(node);\n return node;\n }\n\n // 2. Primitive (string/number) -> Text\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 // 3. Array -> render each item with key-based reconciliation\n if (Array.isArray(fnode)) {\n // Store old registry keys before rendering\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 // Render all children\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 // After rendering, check which keys are still in the registry (= were reused or created)\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 // Remove instances that existed before but don't exist now\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 // Recursively remove component instance and all its children\n removeComponentInstance(instance)\n keysToRemove.push(key)\n }\n }\n })\n\n // Clean up registry\n keysToRemove.forEach(key => parentRegistry.delete(key))\n }\n\n return nodes;\n }\n\n // 4. Object (VNode)\n if (typeof fnode === 'object') {\n // 4a. HTML Element (intrinsic)\n if (typeof fnode.type === 'string') {\n const dom = document.createElement(fnode.type);\n\n // Set props/attributes\n if (fnode.props) {\n Object.entries(fnode.props).forEach(([key, value]) => {\n if (key.startsWith('on') && typeof value === 'function') {\n // Event handler: onClick -> click\n const eventName = key.slice(2).toLowerCase();\n dom.addEventListener(eventName, value as EventListener);\n\n // Store handlers for cleanup/reconciliation\n if (!(dom as any).__eventHandlers) {\n (dom as any).__eventHandlers = {};\n }\n (dom as any).__eventHandlers[eventName] = value;\n } else {\n // Regular attribute\n setAttribute(dom, key, value);\n }\n });\n }\n\n // Render children\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 // 4b. Function Component\n if (typeof fnode.type === 'function') {\n // Check if this is a Context Provider\n const isProvider = (fnode.type as any)._contextId !== undefined;\n\n if (isProvider) {\n // Context Provider: treat like regular component for reactivity\n // This ensures providers re-render when their children change\n return renderComponent(fnode, parent, registryParent);\n } else {\n // Regular component: use reactive rendering\n return renderComponent(fnode, parent, registryParent);\n }\n }\n }\n\n // Fallback: unknown type\n return null;\n}\n\nexport function render(app: any, container: HTMLElement) {\n container.innerHTML = ''\n\n // Handle raw function components by wrapping them in an FNode\n if (typeof app === 'function') {\n app = { type: app, props: {}, children: [], key: undefined }\n }\n\n renderNode(app, container);\n}\n\n// f() - Create FNodes without JSX\nexport function f(\n type: string | Function,\n props?: any,\n ...children: any[]\n): any {\n return {\n type,\n props: props || {},\n children,\n key: props?.key\n }\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 // Handle style object\n Object.assign((el as HTMLElement).style, value)\n } else if (key === 'class') {\n // Handle class specially (className property)\n el.className = String(value)\n } else if (key in el && typeof (el as any)[key] !== 'function') {\n // Property-first approach: use DOM property if available\n // This automatically handles: disabled, checked, value, readonly, etc.\n (el as any)[key] = value\n } else {\n // Fallback to setAttribute for custom/data attributes\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 // Remove old attributes\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 // Set/update new attributes\n const newAttrs = Array.from(newEl.attributes)\n newAttrs.forEach(attr => {\n if (oldEl.getAttribute(attr.name) !== attr.value) {\n // Use DOM property for value/checked to preserve focus\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 // Update event handlers\n const oldHandlers = (oldEl as any).__eventHandlers || {}\n const newHandlers = (newEl as any).__eventHandlers || {}\n\n // Remove old handlers\n Object.keys(oldHandlers).forEach(event => {\n if (!newHandlers[event]) {\n oldEl.removeEventListener(event, oldHandlers[event])\n }\n })\n\n // Add/update new handlers\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 // Update stored handlers\n if (Object.keys(newHandlers).length > 0) {\n (oldEl as any).__eventHandlers = newHandlers\n } else {\n delete (oldEl as any).__eventHandlers\n }\n\n // Special handling for form input values\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 // Add new child\n oldEl.appendChild(newChild)\n } else if (oldChild && !newChild) {\n // Remove old child\n oldEl.removeChild(oldChild)\n } else if (oldChild && newChild) {\n // Patch child\n patchNode(oldChild, newChild, oldEl)\n }\n }\n}\n\nfunction patchNode(oldNode: Node, newNode: Node, parent: Element): void {\n if (canReuse(oldNode, newNode)) {\n // Transfer component instance ownership from newNode to oldNode\n // This ensures component instances reference actual DOM nodes after reconciliation\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 // Reuse node\n if (oldNode.nodeType === Node.TEXT_NODE) {\n // Update text content\n if (oldNode.nodeValue !== newNode.nodeValue) {\n oldNode.nodeValue = newNode.nodeValue\n }\n } else if (oldNode.nodeType === Node.ELEMENT_NODE) {\n // Update element\n updateAttributes(oldNode as Element, newNode as Element)\n reconcileChildren(oldNode as Element, newNode as Element)\n }\n } else {\n // Different type, replace\n parent.replaceChild(newNode, oldNode)\n }\n}\n\n// Exported for future use (Phase 2: Reactive rendering)\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 // Add new node\n parent.insertBefore(newNode, beforeMarker)\n resultNodes.push(newNode)\n } else if (oldNode && !newNode) {\n // Remove old node\n if (oldNode.parentNode) {\n parent.removeChild(oldNode)\n }\n } else if (oldNode && newNode) {\n // Patch node\n patchNode(oldNode, newNode, parent as Element)\n resultNodes.push(oldNode)\n }\n }\n\n return resultNodes\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/dom/index.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","render","app","container","f","type","children","el","canReuse","oldNode","newNode","updateAttributes","oldEl","newEl","attr","oldHandlers","newHandlers","event","reconcileChildren","oldChildren","newChildren","maxLen","i","oldChild","newChild","patchNode","ownerInstance","idx","oldNodes","beforeMarker","resultNodes"],"mappings":"iHA4BA,IAAMA,CAAAA,CAAmB,IAAI,OAAA,CAGzBC,CAAAA,CAAwD,KAG5D,SAASC,CAAAA,CAAwBC,CAAAA,CAAsC,CAEnEA,EAAS,QAAA,CAAS,OAAA,CAAQC,CAAAA,EAAS,CAC/BF,EAAwBE,CAAK,EACjC,CAAC,CAAA,CAGDD,EAAS,KAAA,CAAM,OAAA,CAAQE,CAAAA,EAAQ,CACvBA,EAAK,UAAA,EACLA,CAAAA,CAAK,UAAA,CAAW,WAAA,CAAYA,CAAI,EAExC,CAAC,CAAA,CAGDF,CAAAA,CAAS,SAAS,KAAA,EAAM,CAGpBA,CAAAA,CAAS,cAAA,EACTA,CAAAA,CAAS,cAAA,CAAe,QAAA,CAAS,MAAA,CAAOA,CAAQ,EAExD,CAGA,SAASG,CAAAA,CAAgBC,EAAYC,CAAAA,CAAqBC,CAAAA,CAAsC,CAC5F,IAAMC,EAA0BD,CAAAA,EAAkBD,CAAAA,CAE5CG,CAAAA,CAAcN,CAAAA,EAAc,CAC9B,IAAMO,CAAAA,CAAQ,CAAE,GAAGP,EAAK,KAAM,CAAA,CAC9B,OAAIA,CAAAA,CAAK,UAAYA,CAAAA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D,CAAAA,CAASmB,CAAY,CAAA,CACzCC,EAAY,IAAA,CAAKpB,CAAO,CAAA,EACjBD,CAAAA,EAAW,CAACC,CAAAA,CAEfD,CAAAA,CAAQ,UAAA,EACR/C,CAAAA,CAAO,YAAY+C,CAAO,CAAA,CAEvBA,CAAAA,EAAWC,CAAAA,GAElBe,EAAUhB,CAAAA,CAASC,CAAAA,CAAShD,CAAiB,CAAA,CAC7CoE,EAAY,IAAA,CAAKrB,CAAO,CAAA,EAEhC,CAEA,OAAOqB,CACX","file":"dom.js","sourcesContent":["\nimport { pushContext } from '../core/context'\nimport { runWithComponent, type ComponentInstance } from '../core/hook'\nimport { unsafeEffect } from '../core/effect'\n\n// Types\nexport type FNodeChild = FNode | string | number | boolean | null | undefined | FNodeChild[] | (() => FNode)\n\nexport interface FNode {\n type: string | Function\n props: Record<string, any>\n children: FNodeChild[]\n key?: any\n}\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 // Store render function for manual updates\n children: Set<DOMComponentInstance> // Track child component instances\n parentInstance?: DOMComponentInstance // Track parent component instance\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 // First, recursively remove all child instances\n instance.children.forEach(child => {\n removeComponentInstance(child)\n })\n\n // Remove DOM nodes created by this instance\n instance.nodes.forEach(node => {\n if (node.parentNode) {\n node.parentNode.removeChild(node)\n }\n })\n\n // Clear the children set\n instance.children.clear()\n\n // Remove from parent's children set\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 // Merge props with children\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 // Generate key for this component\n // Use explicit key if provided, otherwise generate auto-key based on render order\n const hasExplicitKey = fnode.key !== undefined\n\n // Get or create registry for this parent\n // Always use the effectiveRegistryParent for registry, not a temp container\n if (!instanceRegistry.has(effectiveRegistryParent)) {\n instanceRegistry.set(effectiveRegistryParent, new Map())\n }\n const parentRegistry = instanceRegistry.get(effectiveRegistryParent)!\n\n // Generate key: explicit key, or auto-increment based on component type\n let key: any\n if (hasExplicitKey) {\n key = fnode.key\n } else {\n // Auto-generate unique key: componentType + instance number\n // Count how many instances of this type already exist\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 // Try to reuse existing instance with same key\n if (parentRegistry.has(key)) {\n const instance = parentRegistry.get(key)!\n\n // Update fnode\n instance.fnode = fnode\n\n // Update props (non-reactive) - we'll trigger re-render manually\n const newProps = mergeProps(fnode)\n\n // Always update props (including children)\n instance.props = newProps\n\n // Always clear old children before re-rendering (they will be re-added during render)\n // This must be done BEFORE renderFn is called\n instance.children.clear()\n\n // Manually trigger re-render by calling renderFn\n if (instance.renderFn) {\n instance.renderFn()\n }\n\n return instance.nodes\n }\n\n // Create component instance with regular props (not reactive)\n const instance: DOMComponentInstance = {\n hooks: [],\n hookIndex: 0,\n nodes: [],\n parent,\n fnode: fnode,\n props: mergeProps(fnode), // Regular props, we handle updates manually\n key,\n children: new Set(),\n parentInstance: currentRenderingInstance || undefined\n }\n\n // Register this instance as a child of the current rendering instance\n if (currentRenderingInstance) {\n currentRenderingInstance.children.add(instance)\n }\n\n // Store instance in registry\n parentRegistry.set(key, instance)\n\n // Track if this is the first render\n let isFirstRender = true\n\n // Function to render the component\n const renderFn = () => {\n const currentFnode = instance.fnode\n const currentProps = instance.props\n\n // Check if this is a Context Provider\n const isProvider = (currentFnode.type as any)._contextId !== undefined\n if (isProvider) {\n // Set context value before rendering\n pushContext((currentFnode.type as any)._contextId, currentProps.value)\n }\n\n // Set this instance as the current rendering instance\n const previousRenderingInstance = currentRenderingInstance\n currentRenderingInstance = instance\n\n // Render component with hook context\n const result = runWithComponent(instance, () => currentFnode.type(currentProps))\n\n // DON'T restore currentRenderingInstance yet - we need it for renderNode calls below\n // It will be restored at the end of this function\n\n if (isFirstRender) {\n // First render: create new DOM nodes\n const newNodes = renderNode(result, parent)\n instance.nodes = newNodes ? (Array.isArray(newNodes) ? newNodes : [newNodes]) : []\n // Mark nodes as owned by this instance (for reconciliation)\n // Only set ownership if not already owned (child components set ownership first)\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 // Re-render: reconcile with existing DOM\n // Don't early return if nodes is empty - component might render other components\n if (instance.nodes.length === 0) {\n // Component has no DOM nodes yet, might be rendering other components\n // Just re-render without reconciliation\n const newNodes = renderNode(result, parent)\n instance.nodes = newNodes ? (Array.isArray(newNodes) ? newNodes : [newNodes]) : []\n // Restore previous rendering instance before returning\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 // Restore previous rendering instance before returning\n currentRenderingInstance = previousRenderingInstance\n return\n }\n\n // Create marker to know where to insert new nodes\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 // Clear children references - actual cleanup happens via key-based registry\n // Don't call removeComponentInstance here as it removes DOM nodes that reconcile needs\n instance.children.clear()\n\n // Create temporary container for collecting new nodes\n const tempContainer = document.createElement('div')\n\n // Render into temp container, but use actual parent for registry\n const newNodes = renderNode(result, tempContainer, nodeParent)\n const newNodesArray = newNodes ? (Array.isArray(newNodes) ? newNodes : [newNodes]) : []\n\n // Use reconcile to patch existing nodes instead of replacing\n const reconciledNodes = reconcile(instance.nodes, newNodesArray, nodeParent, marker)\n\n // Remove marker\n nodeParent.removeChild(marker)\n\n instance.nodes = reconciledNodes\n }\n\n // Restore previous rendering instance after all renderNode calls are done\n currentRenderingInstance = previousRenderingInstance\n }\n\n // Store renderFn for manual updates\n instance.renderFn = renderFn\n\n // Wrap in effect for reactive re-rendering\n unsafeEffect(renderFn)\n\n return instance.nodes\n}\n\nfunction renderNode(fnode: any, parent: HTMLElement, registryParent?: HTMLElement): Node | Node[] | null {\n // Use registryParent for instance lookups if provided, otherwise use parent\n const effectiveRegistryParent = registryParent || parent\n // 1. null/undefined/boolean -> empty text\n if (fnode === null || fnode === undefined || typeof fnode === 'boolean') {\n const node = document.createTextNode('');\n parent.appendChild(node);\n return node;\n }\n\n // 2. Primitive (string/number) -> Text\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 // 3. Array -> render each item with key-based reconciliation\n if (Array.isArray(fnode)) {\n // Store old registry keys before rendering\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 // Render all children\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 // After rendering, check which keys are still in the registry (= were reused or created)\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 // Remove instances that existed before but don't exist now\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 // Recursively remove component instance and all its children\n removeComponentInstance(instance)\n keysToRemove.push(key)\n }\n }\n })\n\n // Clean up registry\n keysToRemove.forEach(key => parentRegistry.delete(key))\n }\n\n return nodes;\n }\n\n // 4. Object (FNode)\n if (typeof fnode === 'object') {\n // 4a. HTML Element (intrinsic)\n if (typeof fnode.type === 'string') {\n const dom = document.createElement(fnode.type);\n\n // Set props/attributes\n if (fnode.props) {\n Object.entries(fnode.props).forEach(([key, value]) => {\n if (key === 'ref' && typeof value === 'function') {\n // ref callback - call with the DOM element\n value(dom);\n } else if (key.startsWith('on') && typeof value === 'function') {\n // Event handler: onClick -> click\n const eventName = key.slice(2).toLowerCase();\n dom.addEventListener(eventName, value as EventListener);\n\n // Store handlers for cleanup/reconciliation\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 // Regular attribute (skip ref if not a function)\n setAttribute(dom, key, value);\n }\n });\n }\n\n // Render children\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 // 4b. Function Component\n if (typeof fnode.type === 'function') {\n // Check if this is a Context Provider\n const isProvider = (fnode.type as any)._contextId !== undefined;\n\n if (isProvider) {\n // Context Provider: treat like regular component for reactivity\n // This ensures providers re-render when their children change\n return renderComponent(fnode, parent, registryParent);\n } else {\n // Regular component: use reactive rendering\n return renderComponent(fnode, parent, registryParent);\n }\n }\n }\n\n // Fallback: unknown type\n return null;\n}\n\nexport function render(app: any, container: HTMLElement) {\n container.innerHTML = ''\n\n // Handle raw function components by wrapping them in an FNode\n if (typeof app === 'function') {\n app = { type: app, props: {}, children: [], key: undefined }\n }\n\n renderNode(app, container);\n}\n\n// f() - Create FNodes without JSX\nexport function f(\n type: string | Function,\n props?: any,\n ...children: any[]\n): any {\n return {\n type,\n props: props || {},\n children,\n key: props?.key\n }\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 // Handle style object\n Object.assign((el as HTMLElement).style, value)\n } else if (key === 'class') {\n // Handle class specially (className property)\n el.className = String(value)\n } else if (key in el && typeof (el as any)[key] !== 'function') {\n // Property-first approach: use DOM property if available\n // This automatically handles: disabled, checked, value, readonly, etc.\n (el as any)[key] = value\n } else {\n // Fallback to setAttribute for custom/data attributes\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 // Remove old attributes\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 // Set/update new attributes\n const newAttrs = Array.from(newEl.attributes)\n newAttrs.forEach(attr => {\n if (oldEl.getAttribute(attr.name) !== attr.value) {\n // Use DOM property for value/checked to preserve focus\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 // Update event handlers\n const oldHandlers = (oldEl as any).__eventHandlers || {}\n const newHandlers = (newEl as any).__eventHandlers || {}\n\n // Remove old handlers\n Object.keys(oldHandlers).forEach(event => {\n if (!newHandlers[event]) {\n oldEl.removeEventListener(event, oldHandlers[event])\n }\n })\n\n // Add/update new handlers\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 // Update stored handlers\n if (Object.keys(newHandlers).length > 0) {\n (oldEl as any).__eventHandlers = newHandlers\n } else {\n delete (oldEl as any).__eventHandlers\n }\n\n // Special handling for form input values\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 // Add new child\n oldEl.appendChild(newChild)\n } else if (oldChild && !newChild) {\n // Remove old child\n oldEl.removeChild(oldChild)\n } else if (oldChild && newChild) {\n // Patch child\n patchNode(oldChild, newChild, oldEl)\n }\n }\n}\n\nfunction patchNode(oldNode: Node, newNode: Node, parent: Element): void {\n if (canReuse(oldNode, newNode)) {\n // Transfer component instance ownership from newNode to oldNode\n // This ensures component instances reference actual DOM nodes after reconciliation\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 // Reuse node\n if (oldNode.nodeType === Node.TEXT_NODE) {\n // Update text content\n if (oldNode.nodeValue !== newNode.nodeValue) {\n oldNode.nodeValue = newNode.nodeValue\n }\n } else if (oldNode.nodeType === Node.ELEMENT_NODE) {\n // Update element\n updateAttributes(oldNode as Element, newNode as Element)\n reconcileChildren(oldNode as Element, newNode as Element)\n }\n } else {\n // Different type, replace\n parent.replaceChild(newNode, oldNode)\n }\n}\n\n// Exported for future use (Phase 2: Reactive rendering)\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 // Add new node\n parent.insertBefore(newNode, beforeMarker)\n resultNodes.push(newNode)\n } else if (oldNode && !newNode) {\n // Remove old node\n if (oldNode.parentNode) {\n parent.removeChild(oldNode)\n }\n } else if (oldNode && newNode) {\n // Patch node\n patchNode(oldNode, newNode, parent as Element)\n resultNodes.push(oldNode)\n }\n }\n\n return resultNodes\n}\n"]}
|
package/dist/dom.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {c}from'./chunk-LUREDEUB.mjs';import {b,g}from'./chunk-44RZHCII.mjs';var
|
|
1
|
+
import {c}from'./chunk-LUREDEUB.mjs';import {b,g}from'./chunk-44RZHCII.mjs';var m=new WeakMap,l=null;function H(e){e.children.forEach(n=>{H(n);}),e.nodes.forEach(n=>{n.parentNode&&n.parentNode.removeChild(n);}),e.children.clear(),e.parentInstance&&e.parentInstance.children.delete(e);}function E(e,n,a){let c$1=a||n,r=f=>{let u={...f.props};return f.children&&f.children.length>0&&(u.children=f.children.length===1?f.children[0]:f.children),u},o=e.key!==void 0;m.has(c$1)||m.set(c$1,new Map);let t=m.get(c$1),i;if(o)i=e.key;else {let f=0,u=e.type.name||"anonymous";t.forEach((b,h)=>{typeof h=="string"&&h.startsWith(`__auto_${u}_`)&&f++;}),i=`__auto_${u}_${f}`;}if(t.has(i)){let f=t.get(i);f.fnode=e;let u=r(e);return f.props=u,f.children.clear(),f.renderFn&&f.renderFn(),f.nodes}let s={hooks:[],hookIndex:0,nodes:[],parent:n,fnode:e,props:r(e),key:i,children:new Set,parentInstance:l||void 0};l&&l.children.add(s),t.set(i,s);let d=true,g$1=()=>{let f=s.fnode,u=s.props;f.type._contextId!==void 0&&c(f.type._contextId,u.value);let h=l;l=s;let M=g(s,()=>f.type(u));if(d){let _=y(M,n);s.nodes=_?Array.isArray(_)?_:[_]:[],s.nodes.forEach(p=>{p.__ownerInstance||(p.__ownerInstance=s);}),d=false;}else {if(s.nodes.length===0){let N=y(M,n);s.nodes=N?Array.isArray(N)?N:[N]:[],l=h;return}let p=s.nodes[0].parentNode;if(!p){l=h;return}let v=document.createComment("flexium-marker"),T=s.nodes[s.nodes.length-1];T.nextSibling?p.insertBefore(v,T.nextSibling):p.appendChild(v),s.children.clear();let O=document.createElement("div"),C=y(M,O,p),F=C?Array.isArray(C)?C:[C]:[],R=P(s.nodes,F,p,v);p.removeChild(v),s.nodes=R;}l=h;};return s.renderFn=g$1,b(g$1),s.nodes}function y(e,n,a){let c=a||n;if(e==null||typeof e=="boolean"){let r=document.createTextNode("");return n.appendChild(r),r}if(typeof e=="string"||typeof e=="number"){let r=document.createTextNode(String(e));return n.appendChild(r),r}if(Array.isArray(e)){let r=new Set;m.has(c)&&m.get(c).forEach((s,d)=>r.add(d));let o=[];e.forEach(i=>{let s=y(i,n,a);s&&(Array.isArray(s)?o.push(...s):o.push(s));});let t=new Set;if(m.has(c)&&m.get(c).forEach((s,d)=>t.add(d)),m.has(c)){let i=m.get(c),s=[];r.forEach(d=>{if(!t.has(d)){let g=i.get(d);g&&(H(g),s.push(d));}}),s.forEach(d=>i.delete(d));}return o}if(typeof e=="object"){if(typeof e.type=="string"){let r=document.createElement(e.type);return e.props&&Object.entries(e.props).forEach(([o,t])=>{if(o==="ref"&&typeof t=="function")t(r);else if(o.startsWith("on")&&typeof t=="function"){let i=o.slice(2).toLowerCase();r.addEventListener(i,t),r.__eventHandlers||(r.__eventHandlers={}),r.__eventHandlers[i]=t;}else o!=="ref"&&S(r,o,t);}),e.children&&e.children.length>0&&e.children.forEach(o=>{y(o,r);}),n.appendChild(r),r}if(typeof e.type=="function")return e.type._contextId!==void 0,E(e,n,a)}return null}function $(e,n){n.innerHTML="",typeof e=="function"&&(e={type:e,props:{},children:[],key:void 0}),y(e,n);}function B(e,n,...a){return {type:e,props:n||{},children:a,key:n?.key}}function S(e,n,a){a==null?e.removeAttribute(n):n==="style"&&typeof a=="object"?Object.assign(e.style,a):n==="class"?e.className=String(a):n in e&&typeof e[n]!="function"?e[n]=a:e.setAttribute(n,String(a));}function D(e,n){return e.nodeType!==n.nodeType?false:e.nodeType===Node.ELEMENT_NODE&&n.nodeType===Node.ELEMENT_NODE?e.tagName===n.tagName:true}function k(e,n){Array.from(e.attributes).forEach(t=>{n.hasAttribute(t.name)||e.removeAttribute(t.name);}),Array.from(n.attributes).forEach(t=>{e.getAttribute(t.name)!==t.value&&(t.name==="value"&&"value"in e?e.value=t.value:t.name==="checked"&&"checked"in e?e.checked=t.value==="true"||t.value==="":e.setAttribute(t.name,t.value));});let r=e.__eventHandlers||{},o=n.__eventHandlers||{};Object.keys(r).forEach(t=>{o[t]||e.removeEventListener(t,r[t]);}),Object.keys(o).forEach(t=>{r[t]!==o[t]&&(r[t]&&e.removeEventListener(t,r[t]),e.addEventListener(t,o[t]));}),Object.keys(o).length>0?e.__eventHandlers=o:delete e.__eventHandlers,e instanceof HTMLInputElement&&n instanceof HTMLInputElement&&(e.value!==n.value&&(e.value=n.value),e.checked!==n.checked&&(e.checked=n.checked)),e instanceof HTMLTextAreaElement&&n instanceof HTMLTextAreaElement&&e.value!==n.value&&(e.value=n.value),e instanceof HTMLSelectElement&&n instanceof HTMLSelectElement&&e.value!==n.value&&(e.value=n.value);}function j(e,n){let a=Array.from(e.childNodes),c=Array.from(n.childNodes),r=Math.max(a.length,c.length);for(let o=0;o<r;o++){let t=a[o],i=c[o];!t&&i?e.appendChild(i):t&&!i?e.removeChild(t):t&&i&&x(t,i,e);}}function x(e,n,a){if(D(e,n)){let c=n.__ownerInstance;if(c){let r=c.nodes.indexOf(n);r!==-1&&(c.nodes[r]=e),e.__ownerInstance=c,delete n.__ownerInstance;}e.nodeType===Node.TEXT_NODE?e.nodeValue!==n.nodeValue&&(e.nodeValue=n.nodeValue):e.nodeType===Node.ELEMENT_NODE&&(k(e,n),j(e,n));}else a.replaceChild(n,e);}function P(e,n,a,c){let r=Math.max(e.length,n.length),o=[];for(let t=0;t<r;t++){let i=e[t],s=n[t];!i&&s?(a.insertBefore(s,c),o.push(s)):i&&!s?i.parentNode&&a.removeChild(i):i&&s&&(x(i,s,a),o.push(i));}return o}export{B as f,P as reconcile,$ as render};//# sourceMappingURL=dom.mjs.map
|
|
2
2
|
//# sourceMappingURL=dom.mjs.map
|
package/dist/dom.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/dom/index.ts"],"names":["instanceRegistry","currentRenderingInstance","removeComponentInstance","instance","child","node","renderComponent","fnode","parent","registryParent","effectiveRegistryParent","mergeProps","props","hasExplicitKey","parentRegistry","key","instanceCount","componentName","_","k","newProps","isFirstRender","renderFn","currentVnode","currentProps","pushContext","previousRenderingInstance","result","runWithComponent","newNodes","renderNode","nodeParent","marker","lastNode","tempContainer","newNodesArray","reconciledNodes","reconcile","unsafeEffect","oldKeysSet","nodes","newKeysSet","keysToRemove","dom","value","eventName","setAttribute","render","app","container","f","type","children","el","canReuse","oldNode","newNode","updateAttributes","oldEl","newEl","attr","oldHandlers","newHandlers","event","reconcileChildren","oldChildren","newChildren","maxLen","i","oldChild","newChild","patchNode","ownerInstance","idx","oldNodes","beforeMarker","resultNodes"],"mappings":"4EA4BA,IAAMA,CAAAA,CAAmB,IAAI,OAAA,CAGzBC,CAAAA,CAAwD,KAG5D,SAASC,CAAAA,CAAwBC,CAAAA,CAAsC,CAEnEA,EAAS,QAAA,CAAS,OAAA,CAAQC,CAAAA,EAAS,CAC/BF,EAAwBE,CAAK,EACjC,CAAC,CAAA,CAGDD,EAAS,KAAA,CAAM,OAAA,CAAQE,CAAAA,EAAQ,CACvBA,EAAK,UAAA,EACLA,CAAAA,CAAK,UAAA,CAAW,WAAA,CAAYA,CAAI,EAExC,CAAC,CAAA,CAGDF,CAAAA,CAAS,SAAS,KAAA,EAAM,CAGpBA,CAAAA,CAAS,cAAA,EACTA,CAAAA,CAAS,cAAA,CAAe,QAAA,CAAS,MAAA,CAAOA,CAAQ,EAExD,CAGA,SAASG,CAAAA,CAAgBC,EAAYC,CAAAA,CAAqBC,CAAAA,CAAsC,CAC5F,IAAMC,IAA0BD,CAAAA,EAAkBD,CAAAA,CAE5CG,CAAAA,CAAcN,CAAAA,EAAc,CAC9B,IAAMO,CAAAA,CAAQ,CAAE,GAAGP,EAAK,KAAM,CAAA,CAC9B,OAAIA,CAAAA,CAAK,UAAYA,CAAAA,CAAK,QAAA,CAAS,MAAA,CAAS,CAAA,GACxCO,EAAM,QAAA,CAAWP,CAAAA,CAAK,QAAA,CAAS,MAAA,GAAW,CAAA,CACpCA,CAAAA,CAAK,QAAA,CAAS,CAAC,EACfA,CAAAA,CAAK,QAAA,CAAA,CAERO,CACX,CAAA,CAIMC,EAAiBN,CAAAA,CAAM,GAAA,GAAQ,MAAA,CAIhCP,CAAAA,CAAiB,IAAIU,GAAuB,CAAA,EAC7CV,CAAAA,CAAiB,GAAA,CAAIU,IAAyB,IAAI,GAAK,CAAA,CAE3D,IAAMI,EA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../core/hook'\nimport { unsafeEffect } from '../core/effect'\n\n// Types\nexport type FNodeChild = FNode | string | number | boolean | null | undefined | FNodeChild[] | (() => FNode)\n\nexport interface FNode {\n type: string | Function\n props: Record<string, any>\n children: FNodeChild[]\n key?: any\n}\n\n// Extended ComponentInstance for DOM tracking\ninterface DOMComponentInstance extends ComponentInstance {\n nodes: Node[]\n parent: HTMLElement\n vnode: any\n props: any\n key?: any\n renderFn?: () => void // Store render function for manual updates\n children: Set<DOMComponentInstance> // Track child component instances\n parentInstance?: DOMComponentInstance // Track parent component instance\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 // First, recursively remove all child instances\n instance.children.forEach(child => {\n removeComponentInstance(child)\n })\n\n // Remove DOM nodes created by this instance\n instance.nodes.forEach(node => {\n if (node.parentNode) {\n node.parentNode.removeChild(node)\n }\n })\n\n // Clear the children set\n instance.children.clear()\n\n // Remove from parent's children set\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 // Merge props with children\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 // Generate key for this component\n // Use explicit key if provided, otherwise generate auto-key based on render order\n const hasExplicitKey = fnode.key !== undefined\n\n // Get or create registry for this parent\n // Always use the effectiveRegistryParent for registry, not a temp container\n if (!instanceRegistry.has(effectiveRegistryParent)) {\n instanceRegistry.set(effectiveRegistryParent, new Map())\n }\n const parentRegistry = instanceRegistry.get(effectiveRegistryParent)!\n\n // Generate key: explicit key, or auto-increment based on component type\n let key: any\n if (hasExplicitKey) {\n key = fnode.key\n } else {\n // Auto-generate unique key: componentType + instance number\n // Count how many instances of this type already exist\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 // Try to reuse existing instance with same key\n if (parentRegistry.has(key)) {\n const instance = parentRegistry.get(key)!\n\n // Update vnode\n instance.vnode = fnode\n\n // Update props (non-reactive) - we'll trigger re-render manually\n const newProps = mergeProps(fnode)\n\n // Always update props (including children)\n instance.props = newProps\n\n // Always clear old children before re-rendering (they will be re-added during render)\n // This must be done BEFORE renderFn is called\n instance.children.clear()\n\n // Manually trigger re-render by calling renderFn\n if (instance.renderFn) {\n instance.renderFn()\n }\n\n return instance.nodes\n }\n\n // Create component instance with regular props (not reactive)\n const instance: DOMComponentInstance = {\n hooks: [],\n hookIndex: 0,\n nodes: [],\n parent,\n vnode: fnode,\n props: mergeProps(fnode), // Regular props, we handle updates manually\n key,\n children: new Set(),\n parentInstance: currentRenderingInstance || undefined\n }\n\n // Register this instance as a child of the current rendering instance\n if (currentRenderingInstance) {\n currentRenderingInstance.children.add(instance)\n }\n\n // Store instance in registry\n parentRegistry.set(key, instance)\n\n // Track if this is the first render\n let isFirstRender = true\n\n // Function to render the component\n const renderFn = () => {\n const currentVnode = instance.vnode\n const currentProps = instance.props\n\n // Check if this is a Context Provider\n const isProvider = (currentVnode.type as any)._contextId !== undefined\n if (isProvider) {\n // Set context value before rendering\n pushContext((currentVnode.type as any)._contextId, currentProps.value)\n }\n\n // Set this instance as the current rendering instance\n const previousRenderingInstance = currentRenderingInstance\n currentRenderingInstance = instance\n\n // Render component with hook context\n const result = runWithComponent(instance, () => currentVnode.type(currentProps))\n\n // DON'T restore currentRenderingInstance yet - we need it for renderNode calls below\n // It will be restored at the end of this function\n\n if (isFirstRender) {\n // First render: create new DOM nodes\n const newNodes = renderNode(result, parent)\n instance.nodes = newNodes ? (Array.isArray(newNodes) ? newNodes : [newNodes]) : []\n // Mark nodes as owned by this instance (for reconciliation)\n // Only set ownership if not already owned (child components set ownership first)\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 // Re-render: reconcile with existing DOM\n // Don't early return if nodes is empty - component might render other components\n if (instance.nodes.length === 0) {\n // Component has no DOM nodes yet, might be rendering other components\n // Just re-render without reconciliation\n const newNodes = renderNode(result, parent)\n instance.nodes = newNodes ? (Array.isArray(newNodes) ? newNodes : [newNodes]) : []\n // Restore previous rendering instance before returning\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 // Restore previous rendering instance before returning\n currentRenderingInstance = previousRenderingInstance\n return\n }\n\n // Create marker to know where to insert new nodes\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 // Clear children references - actual cleanup happens via key-based registry\n // Don't call removeComponentInstance here as it removes DOM nodes that reconcile needs\n instance.children.clear()\n\n // Create temporary container for collecting new nodes\n const tempContainer = document.createElement('div')\n\n // Render into temp container, but use actual parent for registry\n const newNodes = renderNode(result, tempContainer, nodeParent)\n const newNodesArray = newNodes ? (Array.isArray(newNodes) ? newNodes : [newNodes]) : []\n\n // Use reconcile to patch existing nodes instead of replacing\n const reconciledNodes = reconcile(instance.nodes, newNodesArray, nodeParent, marker)\n\n // Remove marker\n nodeParent.removeChild(marker)\n\n instance.nodes = reconciledNodes\n }\n\n // Restore previous rendering instance after all renderNode calls are done\n currentRenderingInstance = previousRenderingInstance\n }\n\n // Store renderFn for manual updates\n instance.renderFn = renderFn\n\n // Wrap in effect for reactive re-rendering\n unsafeEffect(renderFn)\n\n return instance.nodes\n}\n\nfunction renderNode(fnode: any, parent: HTMLElement, registryParent?: HTMLElement): Node | Node[] | null {\n // Use registryParent for instance lookups if provided, otherwise use parent\n const effectiveRegistryParent = registryParent || parent\n // 1. null/undefined/boolean -> empty text\n if (fnode === null || fnode === undefined || typeof fnode === 'boolean') {\n const node = document.createTextNode('');\n parent.appendChild(node);\n return node;\n }\n\n // 2. Primitive (string/number) -> Text\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 // 3. Array -> render each item with key-based reconciliation\n if (Array.isArray(fnode)) {\n // Store old registry keys before rendering\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 // Render all children\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 // After rendering, check which keys are still in the registry (= were reused or created)\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 // Remove instances that existed before but don't exist now\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 // Recursively remove component instance and all its children\n removeComponentInstance(instance)\n keysToRemove.push(key)\n }\n }\n })\n\n // Clean up registry\n keysToRemove.forEach(key => parentRegistry.delete(key))\n }\n\n return nodes;\n }\n\n // 4. Object (VNode)\n if (typeof fnode === 'object') {\n // 4a. HTML Element (intrinsic)\n if (typeof fnode.type === 'string') {\n const dom = document.createElement(fnode.type);\n\n // Set props/attributes\n if (fnode.props) {\n Object.entries(fnode.props).forEach(([key, value]) => {\n if (key.startsWith('on') && typeof value === 'function') {\n // Event handler: onClick -> click\n const eventName = key.slice(2).toLowerCase();\n dom.addEventListener(eventName, value as EventListener);\n\n // Store handlers for cleanup/reconciliation\n if (!(dom as any).__eventHandlers) {\n (dom as any).__eventHandlers = {};\n }\n (dom as any).__eventHandlers[eventName] = value;\n } else {\n // Regular attribute\n setAttribute(dom, key, value);\n }\n });\n }\n\n // Render children\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 // 4b. Function Component\n if (typeof fnode.type === 'function') {\n // Check if this is a Context Provider\n const isProvider = (fnode.type as any)._contextId !== undefined;\n\n if (isProvider) {\n // Context Provider: treat like regular component for reactivity\n // This ensures providers re-render when their children change\n return renderComponent(fnode, parent, registryParent);\n } else {\n // Regular component: use reactive rendering\n return renderComponent(fnode, parent, registryParent);\n }\n }\n }\n\n // Fallback: unknown type\n return null;\n}\n\nexport function render(app: any, container: HTMLElement) {\n container.innerHTML = ''\n\n // Handle raw function components by wrapping them in an FNode\n if (typeof app === 'function') {\n app = { type: app, props: {}, children: [], key: undefined }\n }\n\n renderNode(app, container);\n}\n\n// f() - Create FNodes without JSX\nexport function f(\n type: string | Function,\n props?: any,\n ...children: any[]\n): any {\n return {\n type,\n props: props || {},\n children,\n key: props?.key\n }\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 // Handle style object\n Object.assign((el as HTMLElement).style, value)\n } else if (key === 'class') {\n // Handle class specially (className property)\n el.className = String(value)\n } else if (key in el && typeof (el as any)[key] !== 'function') {\n // Property-first approach: use DOM property if available\n // This automatically handles: disabled, checked, value, readonly, etc.\n (el as any)[key] = value\n } else {\n // Fallback to setAttribute for custom/data attributes\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 // Remove old attributes\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 // Set/update new attributes\n const newAttrs = Array.from(newEl.attributes)\n newAttrs.forEach(attr => {\n if (oldEl.getAttribute(attr.name) !== attr.value) {\n // Use DOM property for value/checked to preserve focus\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 // Update event handlers\n const oldHandlers = (oldEl as any).__eventHandlers || {}\n const newHandlers = (newEl as any).__eventHandlers || {}\n\n // Remove old handlers\n Object.keys(oldHandlers).forEach(event => {\n if (!newHandlers[event]) {\n oldEl.removeEventListener(event, oldHandlers[event])\n }\n })\n\n // Add/update new handlers\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 // Update stored handlers\n if (Object.keys(newHandlers).length > 0) {\n (oldEl as any).__eventHandlers = newHandlers\n } else {\n delete (oldEl as any).__eventHandlers\n }\n\n // Special handling for form input values\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 // Add new child\n oldEl.appendChild(newChild)\n } else if (oldChild && !newChild) {\n // Remove old child\n oldEl.removeChild(oldChild)\n } else if (oldChild && newChild) {\n // Patch child\n patchNode(oldChild, newChild, oldEl)\n }\n }\n}\n\nfunction patchNode(oldNode: Node, newNode: Node, parent: Element): void {\n if (canReuse(oldNode, newNode)) {\n // Transfer component instance ownership from newNode to oldNode\n // This ensures component instances reference actual DOM nodes after reconciliation\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 // Reuse node\n if (oldNode.nodeType === Node.TEXT_NODE) {\n // Update text content\n if (oldNode.nodeValue !== newNode.nodeValue) {\n oldNode.nodeValue = newNode.nodeValue\n }\n } else if (oldNode.nodeType === Node.ELEMENT_NODE) {\n // Update element\n updateAttributes(oldNode as Element, newNode as Element)\n reconcileChildren(oldNode as Element, newNode as Element)\n }\n } else {\n // Different type, replace\n parent.replaceChild(newNode, oldNode)\n }\n}\n\n// Exported for future use (Phase 2: Reactive rendering)\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 // Add new node\n parent.insertBefore(newNode, beforeMarker)\n resultNodes.push(newNode)\n } else if (oldNode && !newNode) {\n // Remove old node\n if (oldNode.parentNode) {\n parent.removeChild(oldNode)\n }\n } else if (oldNode && newNode) {\n // Patch node\n patchNode(oldNode, newNode, parent as Element)\n resultNodes.push(oldNode)\n }\n }\n\n return resultNodes\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/dom/index.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","render","app","container","f","type","children","el","canReuse","oldNode","newNode","updateAttributes","oldEl","newEl","attr","oldHandlers","newHandlers","event","reconcileChildren","oldChildren","newChildren","maxLen","i","oldChild","newChild","patchNode","ownerInstance","idx","oldNodes","beforeMarker","resultNodes"],"mappings":"4EA4BA,IAAMA,CAAAA,CAAmB,IAAI,OAAA,CAGzBC,CAAAA,CAAwD,KAG5D,SAASC,CAAAA,CAAwBC,CAAAA,CAAsC,CAEnEA,EAAS,QAAA,CAAS,OAAA,CAAQC,CAAAA,EAAS,CAC/BF,EAAwBE,CAAK,EACjC,CAAC,CAAA,CAGDD,EAAS,KAAA,CAAM,OAAA,CAAQE,CAAAA,EAAQ,CACvBA,EAAK,UAAA,EACLA,CAA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SAASlB,CAAAA,CAAUqC,CAAAA,CAAkB7C,EAAkBrB,CAAAA,CAAcmE,CAAAA,CAA4B,CACpG,IAAMR,EAAS,IAAA,CAAK,GAAA,CAAIO,CAAAA,CAAS,MAAA,CAAQ7C,EAAS,MAAM,CAAA,CAClD+C,CAAAA,CAAsB,GAE5B,IAAA,IAASR,CAAAA,CAAI,CAAA,CAAGA,CAAAA,CAAID,EAAQC,CAAAA,EAAAA,CAAK,CAC7B,IAAMb,CAAAA,CAAUmB,EAASN,CAAC,CAAA,CACpBZ,CAAAA,CAAU3B,CAAAA,CAASuC,CAAC,CAAA,CAEtB,CAACb,CAAAA,EAAWC,CAAAA,EAEZhD,EAAO,YAAA,CAAagD,CAAAA,CAASmB,CAAY,CAAA,CACzCC,EAAY,IAAA,CAAKpB,CAAO,CAAA,EACjBD,CAAAA,EAAW,CAACC,CAAAA,CAEfD,CAAAA,CAAQ,UAAA,EACR/C,CAAAA,CAAO,YAAY+C,CAAO,CAAA,CAEvBA,CAAAA,EAAWC,CAAAA,GAElBe,EAAUhB,CAAAA,CAASC,CAAAA,CAAShD,CAAiB,CAAA,CAC7CoE,EAAY,IAAA,CAAKrB,CAAO,CAAA,EAEhC,CAEA,OAAOqB,CACX","file":"dom.mjs","sourcesContent":["\nimport { pushContext } from '../core/context'\nimport { runWithComponent, type ComponentInstance } from '../core/hook'\nimport { unsafeEffect } from '../core/effect'\n\n// Types\nexport type FNodeChild = FNode | string | number | boolean | null | undefined | FNodeChild[] | (() => FNode)\n\nexport interface FNode {\n type: string | Function\n props: Record<string, any>\n children: FNodeChild[]\n key?: any\n}\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 // Store render function for manual updates\n children: Set<DOMComponentInstance> // Track child component instances\n parentInstance?: DOMComponentInstance // Track parent component instance\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 // First, recursively remove all child instances\n instance.children.forEach(child => {\n removeComponentInstance(child)\n })\n\n // Remove DOM nodes created by this instance\n instance.nodes.forEach(node => {\n if (node.parentNode) {\n node.parentNode.removeChild(node)\n }\n })\n\n // Clear the children set\n instance.children.clear()\n\n // Remove from parent's children set\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 // Merge props with children\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 // Generate key for this component\n // Use explicit key if provided, otherwise generate auto-key based on render order\n const hasExplicitKey = fnode.key !== undefined\n\n // Get or create registry for this parent\n // Always use the effectiveRegistryParent for registry, not a temp container\n if (!instanceRegistry.has(effectiveRegistryParent)) {\n instanceRegistry.set(effectiveRegistryParent, new Map())\n }\n const parentRegistry = instanceRegistry.get(effectiveRegistryParent)!\n\n // Generate key: explicit key, or auto-increment based on component type\n let key: any\n if (hasExplicitKey) {\n key = fnode.key\n } else {\n // Auto-generate unique key: componentType + instance number\n // Count how many instances of this type already exist\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 // Try to reuse existing instance with same key\n if (parentRegistry.has(key)) {\n const instance = parentRegistry.get(key)!\n\n // Update fnode\n instance.fnode = fnode\n\n // Update props (non-reactive) - we'll trigger re-render manually\n const newProps = mergeProps(fnode)\n\n // Always update props (including children)\n instance.props = newProps\n\n // Always clear old children before re-rendering (they will be re-added during render)\n // This must be done BEFORE renderFn is called\n instance.children.clear()\n\n // Manually trigger re-render by calling renderFn\n if (instance.renderFn) {\n instance.renderFn()\n }\n\n return instance.nodes\n }\n\n // Create component instance with regular props (not reactive)\n const instance: DOMComponentInstance = {\n hooks: [],\n hookIndex: 0,\n nodes: [],\n parent,\n fnode: fnode,\n props: mergeProps(fnode), // Regular props, we handle updates manually\n key,\n children: new Set(),\n parentInstance: currentRenderingInstance || undefined\n }\n\n // Register this instance as a child of the current rendering instance\n if (currentRenderingInstance) {\n currentRenderingInstance.children.add(instance)\n }\n\n // Store instance in registry\n parentRegistry.set(key, instance)\n\n // Track if this is the first render\n let isFirstRender = true\n\n // Function to render the component\n const renderFn = () => {\n const currentFnode = instance.fnode\n const currentProps = instance.props\n\n // Check if this is a Context Provider\n const isProvider = (currentFnode.type as any)._contextId !== undefined\n if (isProvider) {\n // Set context value before rendering\n pushContext((currentFnode.type as any)._contextId, currentProps.value)\n }\n\n // Set this instance as the current rendering instance\n const previousRenderingInstance = currentRenderingInstance\n currentRenderingInstance = instance\n\n // Render component with hook context\n const result = runWithComponent(instance, () => currentFnode.type(currentProps))\n\n // DON'T restore currentRenderingInstance yet - we need it for renderNode calls below\n // It will be restored at the end of this function\n\n if (isFirstRender) {\n // First render: create new DOM nodes\n const newNodes = renderNode(result, parent)\n instance.nodes = newNodes ? (Array.isArray(newNodes) ? newNodes : [newNodes]) : []\n // Mark nodes as owned by this instance (for reconciliation)\n // Only set ownership if not already owned (child components set ownership first)\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 // Re-render: reconcile with existing DOM\n // Don't early return if nodes is empty - component might render other components\n if (instance.nodes.length === 0) {\n // Component has no DOM nodes yet, might be rendering other components\n // Just re-render without reconciliation\n const newNodes = renderNode(result, parent)\n instance.nodes = newNodes ? (Array.isArray(newNodes) ? newNodes : [newNodes]) : []\n // Restore previous rendering instance before returning\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 // Restore previous rendering instance before returning\n currentRenderingInstance = previousRenderingInstance\n return\n }\n\n // Create marker to know where to insert new nodes\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 // Clear children references - actual cleanup happens via key-based registry\n // Don't call removeComponentInstance here as it removes DOM nodes that reconcile needs\n instance.children.clear()\n\n // Create temporary container for collecting new nodes\n const tempContainer = document.createElement('div')\n\n // Render into temp container, but use actual parent for registry\n const newNodes = renderNode(result, tempContainer, nodeParent)\n const newNodesArray = newNodes ? (Array.isArray(newNodes) ? newNodes : [newNodes]) : []\n\n // Use reconcile to patch existing nodes instead of replacing\n const reconciledNodes = reconcile(instance.nodes, newNodesArray, nodeParent, marker)\n\n // Remove marker\n nodeParent.removeChild(marker)\n\n instance.nodes = reconciledNodes\n }\n\n // Restore previous rendering instance after all renderNode calls are done\n currentRenderingInstance = previousRenderingInstance\n }\n\n // Store renderFn for manual updates\n instance.renderFn = renderFn\n\n // Wrap in effect for reactive re-rendering\n unsafeEffect(renderFn)\n\n return instance.nodes\n}\n\nfunction renderNode(fnode: any, parent: HTMLElement, registryParent?: HTMLElement): Node | Node[] | null {\n // Use registryParent for instance lookups if provided, otherwise use parent\n const effectiveRegistryParent = registryParent || parent\n // 1. null/undefined/boolean -> empty text\n if (fnode === null || fnode === undefined || typeof fnode === 'boolean') {\n const node = document.createTextNode('');\n parent.appendChild(node);\n return node;\n }\n\n // 2. Primitive (string/number) -> Text\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 // 3. Array -> render each item with key-based reconciliation\n if (Array.isArray(fnode)) {\n // Store old registry keys before rendering\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 // Render all children\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 // After rendering, check which keys are still in the registry (= were reused or created)\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 // Remove instances that existed before but don't exist now\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 // Recursively remove component instance and all its children\n removeComponentInstance(instance)\n keysToRemove.push(key)\n }\n }\n })\n\n // Clean up registry\n keysToRemove.forEach(key => parentRegistry.delete(key))\n }\n\n return nodes;\n }\n\n // 4. Object (FNode)\n if (typeof fnode === 'object') {\n // 4a. HTML Element (intrinsic)\n if (typeof fnode.type === 'string') {\n const dom = document.createElement(fnode.type);\n\n // Set props/attributes\n if (fnode.props) {\n Object.entries(fnode.props).forEach(([key, value]) => {\n if (key === 'ref' && typeof value === 'function') {\n // ref callback - call with the DOM element\n value(dom);\n } else if (key.startsWith('on') && typeof value === 'function') {\n // Event handler: onClick -> click\n const eventName = key.slice(2).toLowerCase();\n dom.addEventListener(eventName, value as EventListener);\n\n // Store handlers for cleanup/reconciliation\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 // Regular attribute (skip ref if not a function)\n setAttribute(dom, key, value);\n }\n });\n }\n\n // Render children\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 // 4b. Function Component\n if (typeof fnode.type === 'function') {\n // Check if this is a Context Provider\n const isProvider = (fnode.type as any)._contextId !== undefined;\n\n if (isProvider) {\n // Context Provider: treat like regular component for reactivity\n // This ensures providers re-render when their children change\n return renderComponent(fnode, parent, registryParent);\n } else {\n // Regular component: use reactive rendering\n return renderComponent(fnode, parent, registryParent);\n }\n }\n }\n\n // Fallback: unknown type\n return null;\n}\n\nexport function render(app: any, container: HTMLElement) {\n container.innerHTML = ''\n\n // Handle raw function components by wrapping them in an FNode\n if (typeof app === 'function') {\n app = { type: app, props: {}, children: [], key: undefined }\n }\n\n renderNode(app, container);\n}\n\n// f() - Create FNodes without JSX\nexport function f(\n type: string | Function,\n props?: any,\n ...children: any[]\n): any {\n return {\n type,\n props: props || {},\n children,\n key: props?.key\n }\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 // Handle style object\n Object.assign((el as HTMLElement).style, value)\n } else if (key === 'class') {\n // Handle class specially (className property)\n el.className = String(value)\n } else if (key in el && typeof (el as any)[key] !== 'function') {\n // Property-first approach: use DOM property if available\n // This automatically handles: disabled, checked, value, readonly, etc.\n (el as any)[key] = value\n } else {\n // Fallback to setAttribute for custom/data attributes\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 // Remove old attributes\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 // Set/update new attributes\n const newAttrs = Array.from(newEl.attributes)\n newAttrs.forEach(attr => {\n if (oldEl.getAttribute(attr.name) !== attr.value) {\n // Use DOM property for value/checked to preserve focus\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 // Update event handlers\n const oldHandlers = (oldEl as any).__eventHandlers || {}\n const newHandlers = (newEl as any).__eventHandlers || {}\n\n // Remove old handlers\n Object.keys(oldHandlers).forEach(event => {\n if (!newHandlers[event]) {\n oldEl.removeEventListener(event, oldHandlers[event])\n }\n })\n\n // Add/update new handlers\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 // Update stored handlers\n if (Object.keys(newHandlers).length > 0) {\n (oldEl as any).__eventHandlers = newHandlers\n } else {\n delete (oldEl as any).__eventHandlers\n }\n\n // Special handling for form input values\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 // Add new child\n oldEl.appendChild(newChild)\n } else if (oldChild && !newChild) {\n // Remove old child\n oldEl.removeChild(oldChild)\n } else if (oldChild && newChild) {\n // Patch child\n patchNode(oldChild, newChild, oldEl)\n }\n }\n}\n\nfunction patchNode(oldNode: Node, newNode: Node, parent: Element): void {\n if (canReuse(oldNode, newNode)) {\n // Transfer component instance ownership from newNode to oldNode\n // This ensures component instances reference actual DOM nodes after reconciliation\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 // Reuse node\n if (oldNode.nodeType === Node.TEXT_NODE) {\n // Update text content\n if (oldNode.nodeValue !== newNode.nodeValue) {\n oldNode.nodeValue = newNode.nodeValue\n }\n } else if (oldNode.nodeType === Node.ELEMENT_NODE) {\n // Update element\n updateAttributes(oldNode as Element, newNode as Element)\n reconcileChildren(oldNode as Element, newNode as Element)\n }\n } else {\n // Different type, replace\n parent.replaceChild(newNode, oldNode)\n }\n}\n\n// Exported for future use (Phase 2: Reactive rendering)\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 // Add new node\n parent.insertBefore(newNode, beforeMarker)\n resultNodes.push(newNode)\n } else if (oldNode && !newNode) {\n // Remove old node\n if (oldNode.parentNode) {\n parent.removeChild(oldNode)\n }\n } else if (oldNode && newNode) {\n // Patch node\n patchNode(oldNode, newNode, parent as Element)\n resultNodes.push(oldNode)\n }\n }\n\n return resultNodes\n}\n"]}
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var o="0.12.
|
|
1
|
+
'use strict';var o="0.12.13";exports.VERSION=o;//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":["VERSION"],"mappings":"aAAO,IAAMA,CAAAA,CAAU","file":"index.js","sourcesContent":["export const VERSION = '0.12.
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["VERSION"],"mappings":"aAAO,IAAMA,CAAAA,CAAU","file":"index.js","sourcesContent":["export const VERSION = '0.12.13' // Bump version to signify rebuild\n"]}
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var o="0.12.
|
|
1
|
+
var o="0.12.13";export{o as VERSION};//# sourceMappingURL=index.mjs.map
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":["VERSION"],"mappings":"AAAO,IAAMA,CAAAA,CAAU","file":"index.mjs","sourcesContent":["export const VERSION = '0.12.
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["VERSION"],"mappings":"AAAO,IAAMA,CAAAA,CAAU","file":"index.mjs","sourcesContent":["export const VERSION = '0.12.13' // Bump version to signify rebuild\n"]}
|
package/dist/metafile-cjs.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/index.ts":{"bytes":68,"imports":[],"format":"esm"},"src/core/effect.ts":{"bytes":2302,"imports":[],"format":"esm"},"src/core/reactive.ts":{"bytes":2077,"imports":[{"path":"src/core/effect.ts","kind":"import-statement","original":"./effect"}],"format":"esm"},"src/core/hook.ts":{"bytes":986,"imports":[],"format":"esm"},"src/core/state.ts":{"bytes":5773,"imports":[{"path":"src/core/reactive.ts","kind":"import-statement","original":"./reactive"},{"path":"src/core/effect.ts","kind":"import-statement","original":"./effect"},{"path":"src/core/hook.ts","kind":"import-statement","original":"./hook"}],"format":"esm"},"src/core/lifecycle.ts":{"bytes":1649,"imports":[{"path":"src/core/hook.ts","kind":"import-statement","original":"./hook"},{"path":"src/core/effect.ts","kind":"import-statement","original":"./effect"}],"format":"esm"},"src/core/context.ts":{"bytes":1461,"imports":[],"format":"esm"},"src/core/index.ts":{"bytes":166,"imports":[{"path":"src/core/state.ts","kind":"import-statement","original":"./state"},{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"./lifecycle"},{"path":"src/core/context.ts","kind":"import-statement","original":"./context"}],"format":"esm"},"src/dom/index.ts":{"bytes":21057,"imports":[{"path":"src/core/context.ts","kind":"import-statement","original":"../core/context"},{"path":"src/core/hook.ts","kind":"import-statement","original":"../core/hook"},{"path":"src/core/effect.ts","kind":"import-statement","original":"../core/effect"}],"format":"esm"},"src/router/types.ts":{"bytes":807,"imports":[],"format":"esm"},"src/router/utils.ts":{"bytes":3745,"imports":[{"path":"./types","kind":"import-statement","external":true}],"format":"esm"},"src/router/router.ts":{"bytes":2599,"imports":[{"path":"src/core/reactive.ts","kind":"import-statement","original":"../core/reactive"},{"path":"src/core/context.ts","kind":"import-statement","original":"../core/context"},{"path":"src/router/utils.ts","kind":"import-statement","original":"./utils"}],"format":"esm"},"src/jsx-runtime.ts":{"bytes":727,"imports":[],"format":"esm"},"src/router/dom/Route.tsx":{"bytes":106,"imports":[],"format":"esm"},"src/router/dom/Routes.tsx":{"bytes":2578,"imports":[{"path":"src/jsx-runtime.ts","kind":"import-statement","original":"../../jsx-runtime"},{"path":"src/router/router.ts","kind":"import-statement","original":"../router"},{"path":"src/router/utils.ts","kind":"import-statement","original":"../utils"},{"path":"src/router/dom/Route.tsx","kind":"import-statement","original":"./Route"}],"format":"esm"},"src/router/dom/Outlet.tsx":{"bytes":769,"imports":[{"path":"src/core/state.ts","kind":"import-statement","original":"../../core/state"},{"path":"src/core/context.ts","kind":"import-statement","original":"../../core/context"},{"path":"src/jsx-runtime.ts","kind":"import-statement","original":"../../jsx-runtime"},{"path":"src/router/router.ts","kind":"import-statement","original":"../router"}],"format":"esm"},"src/router/dom/Link.tsx":{"bytes":441,"imports":[{"path":"src/jsx-runtime.ts","kind":"import-statement","original":"../../jsx-runtime"},{"path":"src/router/router.ts","kind":"import-statement","original":"../router"}],"format":"esm"},"src/router/index.ts":{"bytes":259,"imports":[{"path":"src/router/types.ts","kind":"import-statement","original":"./types"},{"path":"src/router/router.ts","kind":"import-statement","original":"./router"},{"path":"src/router/dom/Routes.tsx","kind":"import-statement","original":"./dom/Routes"},{"path":"src/router/dom/Route.tsx","kind":"import-statement","original":"./dom/Route"},{"path":"src/router/dom/Outlet.tsx","kind":"import-statement","original":"./dom/Outlet"},{"path":"src/router/dom/Link.tsx","kind":"import-statement","original":"./dom/Link"}],"format":"esm"},"src/canvas/Canvas.tsx":{"bytes":5692,"imports":[{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"../core/lifecycle"},{"path":"src/core/reactive.ts","kind":"import-statement","original":"../core/reactive"},{"path":"src/jsx-runtime.ts","kind":"import-statement","original":"flexium/jsx-runtime"}],"format":"esm"},"src/canvas/dom/DrawRect.tsx":{"bytes":533,"imports":[{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"../../core/lifecycle"},{"path":"src/canvas/Canvas.tsx","kind":"import-statement","original":"../Canvas"}],"format":"esm"},"src/canvas/dom/DrawCircle.tsx":{"bytes":508,"imports":[{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"../../core/lifecycle"},{"path":"src/canvas/Canvas.tsx","kind":"import-statement","original":"../Canvas"}],"format":"esm"},"src/canvas/dom/DrawArc.tsx":{"bytes":599,"imports":[{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"../../core/lifecycle"},{"path":"src/canvas/Canvas.tsx","kind":"import-statement","original":"../Canvas"}],"format":"esm"},"src/canvas/dom/DrawLine.tsx":{"bytes":495,"imports":[{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"../../core/lifecycle"},{"path":"src/canvas/Canvas.tsx","kind":"import-statement","original":"../Canvas"}],"format":"esm"},"src/canvas/dom/DrawText.tsx":{"bytes":580,"imports":[{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"../../core/lifecycle"},{"path":"src/canvas/Canvas.tsx","kind":"import-statement","original":"../Canvas"}],"format":"esm"},"src/canvas/dom/DrawPath.tsx":{"bytes":437,"imports":[{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"../../core/lifecycle"},{"path":"src/canvas/Canvas.tsx","kind":"import-statement","original":"../Canvas"}],"format":"esm"},"src/canvas/index.ts":{"bytes":427,"imports":[{"path":"src/canvas/Canvas.tsx","kind":"import-statement","original":"./Canvas"},{"path":"src/canvas/dom/DrawRect.tsx","kind":"import-statement","original":"./dom/DrawRect"},{"path":"src/canvas/dom/DrawCircle.tsx","kind":"import-statement","original":"./dom/DrawCircle"},{"path":"src/canvas/dom/DrawArc.tsx","kind":"import-statement","original":"./dom/DrawArc"},{"path":"src/canvas/dom/DrawLine.tsx","kind":"import-statement","original":"./dom/DrawLine"},{"path":"src/canvas/dom/DrawText.tsx","kind":"import-statement","original":"./dom/DrawText"},{"path":"src/canvas/dom/DrawPath.tsx","kind":"import-statement","original":"./dom/DrawPath"}],"format":"esm"},"src/interactive/loop.ts":{"bytes":1888,"imports":[],"format":"esm"},"src/interactive/keyboard.ts":{"bytes":3391,"imports":[{"path":"src/core/state.ts","kind":"import-statement","original":"../core/state"}],"format":"esm"},"src/interactive/mouse.ts":{"bytes":3563,"imports":[{"path":"src/core/state.ts","kind":"import-statement","original":"../core/state"}],"format":"esm"},"src/interactive/index.ts":{"bytes":206,"imports":[{"path":"src/interactive/loop.ts","kind":"import-statement","original":"./loop"},{"path":"src/interactive/keyboard.ts","kind":"import-statement","original":"./keyboard"},{"path":"src/interactive/mouse.ts","kind":"import-statement","original":"./mouse"}],"format":"esm"},"src/jsx-dev-runtime.ts":{"bytes":211,"imports":[{"path":"src/jsx-runtime.ts","kind":"import-statement","original":"./jsx-runtime"}],"format":"esm"}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":205},"dist/index.js":{"imports":[],"exports":["VERSION"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":16}},"bytes":38},"dist/core.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/core.js":{"imports":[{"path":"dist/chunk-LUW7DIEW.js","kind":"import-statement"},{"path":"dist/chunk-IA4FEBFE.js","kind":"import-statement"},{"path":"dist/chunk-APAMPY43.js","kind":"import-statement"},{"path":"dist/chunk-7BXR4ZFD.js","kind":"import-statement"},{"path":"dist/chunk-ENWGYQNU.js","kind":"import-statement"}],"exports":["batch","context","createContext","effect","popContext","pushContext","runWithContext","snapshotContext","state","sync"],"entryPoint":"src/core/index.ts","inputs":{"src/core/index.ts":{"bytesInOutput":0}},"bytes":384},"dist/dom.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":30059},"dist/dom.js":{"imports":[{"path":"dist/chunk-LUW7DIEW.js","kind":"import-statement"},{"path":"dist/chunk-ENWGYQNU.js","kind":"import-statement"}],"exports":["f","reconcile","render"],"entryPoint":"src/dom/index.ts","inputs":{"src/dom/index.ts":{"bytesInOutput":4843}},"bytes":4973},"dist/router.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":16422},"dist/router.js":{"imports":[{"path":"dist/chunk-LUW7DIEW.js","kind":"import-statement"},{"path":"dist/chunk-APAMPY43.js","kind":"import-statement"},{"path":"dist/chunk-7BXR4ZFD.js","kind":"import-statement"},{"path":"dist/chunk-ENWGYQNU.js","kind":"import-statement"},{"path":"dist/chunk-EXLNKYSH.js","kind":"import-statement"}],"exports":["Link","Outlet","Route","Routes","router"],"entryPoint":"src/router/index.ts","inputs":{"src/router/index.ts":{"bytesInOutput":0},"src/router/utils.ts":{"bytesInOutput":1073},"src/router/router.ts":{"bytesInOutput":743},"src/router/dom/Route.tsx":{"bytesInOutput":26},"src/router/dom/Routes.tsx":{"bytesInOutput":638},"src/router/dom/Outlet.tsx":{"bytesInOutput":238},"src/router/dom/Link.tsx":{"bytesInOutput":133}},"bytes":3107},"dist/chunk-LUW7DIEW.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":2664},"dist/chunk-LUW7DIEW.js":{"imports":[],"exports":["a","b","c","d","e","f"],"inputs":{"src/core/context.ts":{"bytesInOutput":450}},"bytes":501},"dist/canvas.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":14321},"dist/canvas.js":{"imports":[{"path":"dist/chunk-IA4FEBFE.js","kind":"import-statement"},{"path":"dist/chunk-7BXR4ZFD.js","kind":"import-statement"},{"path":"dist/chunk-ENWGYQNU.js","kind":"import-statement"},{"path":"dist/chunk-EXLNKYSH.js","kind":"import-statement"}],"exports":["Canvas","DrawArc","DrawCircle","DrawLine","DrawPath","DrawRect","DrawText"],"entryPoint":"src/canvas/index.ts","inputs":{"src/canvas/Canvas.tsx":{"bytesInOutput":1875},"src/canvas/index.ts":{"bytesInOutput":0},"src/canvas/dom/DrawRect.tsx":{"bytesInOutput":60},"src/canvas/dom/DrawCircle.tsx":{"bytesInOutput":62},"src/canvas/dom/DrawArc.tsx":{"bytesInOutput":59},"src/canvas/dom/DrawLine.tsx":{"bytesInOutput":60},"src/canvas/dom/DrawText.tsx":{"bytesInOutput":60},"src/canvas/dom/DrawPath.tsx":{"bytesInOutput":60}},"bytes":2490},"dist/chunk-IA4FEBFE.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":2516},"dist/chunk-IA4FEBFE.js":{"imports":[{"path":"dist/chunk-ENWGYQNU.js","kind":"import-statement"}],"exports":["a","b","c"],"inputs":{"src/core/lifecycle.ts":{"bytesInOutput":340}},"bytes":424},"dist/interactive.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":14770},"dist/interactive.js":{"imports":[{"path":"dist/chunk-APAMPY43.js","kind":"import-statement"},{"path":"dist/chunk-7BXR4ZFD.js","kind":"import-statement"},{"path":"dist/chunk-ENWGYQNU.js","kind":"import-statement"}],"exports":["Keys","MouseButton","keyboard","loop","mouse"],"entryPoint":"src/interactive/index.ts","inputs":{"src/interactive/loop.ts":{"bytesInOutput":459},"src/interactive/index.ts":{"bytesInOutput":0},"src/interactive/keyboard.ts":{"bytesInOutput":1309},"src/interactive/mouse.ts":{"bytesInOutput":1235}},"bytes":3170},"dist/chunk-APAMPY43.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":8537},"dist/chunk-APAMPY43.js":{"imports":[{"path":"dist/chunk-7BXR4ZFD.js","kind":"import-statement"},{"path":"dist/chunk-ENWGYQNU.js","kind":"import-statement"}],"exports":["a"],"inputs":{"src/core/state.ts":{"bytesInOutput":1555}},"bytes":1658},"dist/chunk-7BXR4ZFD.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":3712},"dist/chunk-7BXR4ZFD.js":{"imports":[{"path":"dist/chunk-ENWGYQNU.js","kind":"import-statement"}],"exports":["a","b"],"inputs":{"src/core/reactive.ts":{"bytesInOutput":590}},"bytes":667},"dist/chunk-ENWGYQNU.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":5647},"dist/chunk-ENWGYQNU.js":{"imports":[],"exports":["a","b","c","d","e","f","g","h"],"inputs":{"src/core/effect.ts":{"bytesInOutput":751},"src/core/hook.ts":{"bytesInOutput":227}},"bytes":1038},"dist/jsx-runtime.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/jsx-runtime.js":{"imports":[{"path":"dist/chunk-EXLNKYSH.js","kind":"import-statement"}],"exports":["Fragment","jsx","jsxs"],"entryPoint":"src/jsx-runtime.ts","inputs":{},"bytes":81},"dist/jsx-dev-runtime.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":510},"dist/jsx-dev-runtime.js":{"imports":[{"path":"dist/chunk-EXLNKYSH.js","kind":"import-statement"}],"exports":["Fragment","jsxDEV"],"entryPoint":"src/jsx-dev-runtime.ts","inputs":{"src/jsx-dev-runtime.ts":{"bytesInOutput":40}},"bytes":122},"dist/chunk-EXLNKYSH.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":1278},"dist/chunk-EXLNKYSH.js":{"imports":[],"exports":["a","b","c"],"inputs":{"src/jsx-runtime.ts":{"bytesInOutput":177}},"bytes":207}}}
|
|
1
|
+
{"inputs":{"src/index.ts":{"bytes":68,"imports":[],"format":"esm"},"src/core/effect.ts":{"bytes":2302,"imports":[],"format":"esm"},"src/core/reactive.ts":{"bytes":2077,"imports":[{"path":"src/core/effect.ts","kind":"import-statement","original":"./effect"}],"format":"esm"},"src/core/hook.ts":{"bytes":986,"imports":[],"format":"esm"},"src/core/state.ts":{"bytes":5773,"imports":[{"path":"src/core/reactive.ts","kind":"import-statement","original":"./reactive"},{"path":"src/core/effect.ts","kind":"import-statement","original":"./effect"},{"path":"src/core/hook.ts","kind":"import-statement","original":"./hook"}],"format":"esm"},"src/core/lifecycle.ts":{"bytes":1649,"imports":[{"path":"src/core/hook.ts","kind":"import-statement","original":"./hook"},{"path":"src/core/effect.ts","kind":"import-statement","original":"./effect"}],"format":"esm"},"src/core/context.ts":{"bytes":1461,"imports":[],"format":"esm"},"src/core/index.ts":{"bytes":166,"imports":[{"path":"src/core/state.ts","kind":"import-statement","original":"./state"},{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"./lifecycle"},{"path":"src/core/context.ts","kind":"import-statement","original":"./context"}],"format":"esm"},"src/dom/index.ts":{"bytes":21288,"imports":[{"path":"src/core/context.ts","kind":"import-statement","original":"../core/context"},{"path":"src/core/hook.ts","kind":"import-statement","original":"../core/hook"},{"path":"src/core/effect.ts","kind":"import-statement","original":"../core/effect"}],"format":"esm"},"src/router/types.ts":{"bytes":807,"imports":[],"format":"esm"},"src/router/utils.ts":{"bytes":3745,"imports":[{"path":"./types","kind":"import-statement","external":true}],"format":"esm"},"src/router/router.ts":{"bytes":2599,"imports":[{"path":"src/core/reactive.ts","kind":"import-statement","original":"../core/reactive"},{"path":"src/core/context.ts","kind":"import-statement","original":"../core/context"},{"path":"src/router/utils.ts","kind":"import-statement","original":"./utils"}],"format":"esm"},"src/jsx-runtime.ts":{"bytes":727,"imports":[],"format":"esm"},"src/router/dom/Route.tsx":{"bytes":106,"imports":[],"format":"esm"},"src/router/dom/Routes.tsx":{"bytes":2578,"imports":[{"path":"src/jsx-runtime.ts","kind":"import-statement","original":"../../jsx-runtime"},{"path":"src/router/router.ts","kind":"import-statement","original":"../router"},{"path":"src/router/utils.ts","kind":"import-statement","original":"../utils"},{"path":"src/router/dom/Route.tsx","kind":"import-statement","original":"./Route"}],"format":"esm"},"src/router/dom/Outlet.tsx":{"bytes":769,"imports":[{"path":"src/core/state.ts","kind":"import-statement","original":"../../core/state"},{"path":"src/core/context.ts","kind":"import-statement","original":"../../core/context"},{"path":"src/jsx-runtime.ts","kind":"import-statement","original":"../../jsx-runtime"},{"path":"src/router/router.ts","kind":"import-statement","original":"../router"}],"format":"esm"},"src/router/dom/Link.tsx":{"bytes":441,"imports":[{"path":"src/jsx-runtime.ts","kind":"import-statement","original":"../../jsx-runtime"},{"path":"src/router/router.ts","kind":"import-statement","original":"../router"}],"format":"esm"},"src/router/index.ts":{"bytes":259,"imports":[{"path":"src/router/types.ts","kind":"import-statement","original":"./types"},{"path":"src/router/router.ts","kind":"import-statement","original":"./router"},{"path":"src/router/dom/Routes.tsx","kind":"import-statement","original":"./dom/Routes"},{"path":"src/router/dom/Route.tsx","kind":"import-statement","original":"./dom/Route"},{"path":"src/router/dom/Outlet.tsx","kind":"import-statement","original":"./dom/Outlet"},{"path":"src/router/dom/Link.tsx","kind":"import-statement","original":"./dom/Link"}],"format":"esm"},"src/canvas/Canvas.tsx":{"bytes":5692,"imports":[{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"../core/lifecycle"},{"path":"src/core/reactive.ts","kind":"import-statement","original":"../core/reactive"},{"path":"src/jsx-runtime.ts","kind":"import-statement","original":"flexium/jsx-runtime"}],"format":"esm"},"src/canvas/dom/DrawRect.tsx":{"bytes":533,"imports":[{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"../../core/lifecycle"},{"path":"src/canvas/Canvas.tsx","kind":"import-statement","original":"../Canvas"}],"format":"esm"},"src/canvas/dom/DrawCircle.tsx":{"bytes":508,"imports":[{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"../../core/lifecycle"},{"path":"src/canvas/Canvas.tsx","kind":"import-statement","original":"../Canvas"}],"format":"esm"},"src/canvas/dom/DrawArc.tsx":{"bytes":599,"imports":[{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"../../core/lifecycle"},{"path":"src/canvas/Canvas.tsx","kind":"import-statement","original":"../Canvas"}],"format":"esm"},"src/canvas/dom/DrawLine.tsx":{"bytes":495,"imports":[{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"../../core/lifecycle"},{"path":"src/canvas/Canvas.tsx","kind":"import-statement","original":"../Canvas"}],"format":"esm"},"src/canvas/dom/DrawText.tsx":{"bytes":580,"imports":[{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"../../core/lifecycle"},{"path":"src/canvas/Canvas.tsx","kind":"import-statement","original":"../Canvas"}],"format":"esm"},"src/canvas/dom/DrawPath.tsx":{"bytes":437,"imports":[{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"../../core/lifecycle"},{"path":"src/canvas/Canvas.tsx","kind":"import-statement","original":"../Canvas"}],"format":"esm"},"src/canvas/index.ts":{"bytes":427,"imports":[{"path":"src/canvas/Canvas.tsx","kind":"import-statement","original":"./Canvas"},{"path":"src/canvas/dom/DrawRect.tsx","kind":"import-statement","original":"./dom/DrawRect"},{"path":"src/canvas/dom/DrawCircle.tsx","kind":"import-statement","original":"./dom/DrawCircle"},{"path":"src/canvas/dom/DrawArc.tsx","kind":"import-statement","original":"./dom/DrawArc"},{"path":"src/canvas/dom/DrawLine.tsx","kind":"import-statement","original":"./dom/DrawLine"},{"path":"src/canvas/dom/DrawText.tsx","kind":"import-statement","original":"./dom/DrawText"},{"path":"src/canvas/dom/DrawPath.tsx","kind":"import-statement","original":"./dom/DrawPath"}],"format":"esm"},"src/interactive/loop.ts":{"bytes":1888,"imports":[],"format":"esm"},"src/interactive/keyboard.ts":{"bytes":3391,"imports":[{"path":"src/core/state.ts","kind":"import-statement","original":"../core/state"}],"format":"esm"},"src/interactive/mouse.ts":{"bytes":3563,"imports":[{"path":"src/core/state.ts","kind":"import-statement","original":"../core/state"}],"format":"esm"},"src/interactive/index.ts":{"bytes":206,"imports":[{"path":"src/interactive/loop.ts","kind":"import-statement","original":"./loop"},{"path":"src/interactive/keyboard.ts","kind":"import-statement","original":"./keyboard"},{"path":"src/interactive/mouse.ts","kind":"import-statement","original":"./mouse"}],"format":"esm"},"src/jsx-dev-runtime.ts":{"bytes":211,"imports":[{"path":"src/jsx-runtime.ts","kind":"import-statement","original":"./jsx-runtime"}],"format":"esm"}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":205},"dist/index.js":{"imports":[],"exports":["VERSION"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":16}},"bytes":38},"dist/core.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/core.js":{"imports":[{"path":"dist/chunk-LUW7DIEW.js","kind":"import-statement"},{"path":"dist/chunk-IA4FEBFE.js","kind":"import-statement"},{"path":"dist/chunk-APAMPY43.js","kind":"import-statement"},{"path":"dist/chunk-7BXR4ZFD.js","kind":"import-statement"},{"path":"dist/chunk-ENWGYQNU.js","kind":"import-statement"}],"exports":["batch","context","createContext","effect","popContext","pushContext","runWithContext","snapshotContext","state","sync"],"entryPoint":"src/core/index.ts","inputs":{"src/core/index.ts":{"bytesInOutput":0}},"bytes":384},"dist/dom.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":30353},"dist/dom.js":{"imports":[{"path":"dist/chunk-LUW7DIEW.js","kind":"import-statement"},{"path":"dist/chunk-ENWGYQNU.js","kind":"import-statement"}],"exports":["f","reconcile","render"],"entryPoint":"src/dom/index.ts","inputs":{"src/dom/index.ts":{"bytesInOutput":4899}},"bytes":5029},"dist/router.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":16422},"dist/router.js":{"imports":[{"path":"dist/chunk-LUW7DIEW.js","kind":"import-statement"},{"path":"dist/chunk-APAMPY43.js","kind":"import-statement"},{"path":"dist/chunk-7BXR4ZFD.js","kind":"import-statement"},{"path":"dist/chunk-ENWGYQNU.js","kind":"import-statement"},{"path":"dist/chunk-EXLNKYSH.js","kind":"import-statement"}],"exports":["Link","Outlet","Route","Routes","router"],"entryPoint":"src/router/index.ts","inputs":{"src/router/index.ts":{"bytesInOutput":0},"src/router/utils.ts":{"bytesInOutput":1073},"src/router/router.ts":{"bytesInOutput":743},"src/router/dom/Route.tsx":{"bytesInOutput":26},"src/router/dom/Routes.tsx":{"bytesInOutput":638},"src/router/dom/Outlet.tsx":{"bytesInOutput":238},"src/router/dom/Link.tsx":{"bytesInOutput":133}},"bytes":3107},"dist/chunk-LUW7DIEW.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":2664},"dist/chunk-LUW7DIEW.js":{"imports":[],"exports":["a","b","c","d","e","f"],"inputs":{"src/core/context.ts":{"bytesInOutput":450}},"bytes":501},"dist/canvas.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":14321},"dist/canvas.js":{"imports":[{"path":"dist/chunk-IA4FEBFE.js","kind":"import-statement"},{"path":"dist/chunk-7BXR4ZFD.js","kind":"import-statement"},{"path":"dist/chunk-ENWGYQNU.js","kind":"import-statement"},{"path":"dist/chunk-EXLNKYSH.js","kind":"import-statement"}],"exports":["Canvas","DrawArc","DrawCircle","DrawLine","DrawPath","DrawRect","DrawText"],"entryPoint":"src/canvas/index.ts","inputs":{"src/canvas/Canvas.tsx":{"bytesInOutput":1875},"src/canvas/index.ts":{"bytesInOutput":0},"src/canvas/dom/DrawRect.tsx":{"bytesInOutput":60},"src/canvas/dom/DrawCircle.tsx":{"bytesInOutput":62},"src/canvas/dom/DrawArc.tsx":{"bytesInOutput":59},"src/canvas/dom/DrawLine.tsx":{"bytesInOutput":60},"src/canvas/dom/DrawText.tsx":{"bytesInOutput":60},"src/canvas/dom/DrawPath.tsx":{"bytesInOutput":60}},"bytes":2490},"dist/chunk-IA4FEBFE.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":2516},"dist/chunk-IA4FEBFE.js":{"imports":[{"path":"dist/chunk-ENWGYQNU.js","kind":"import-statement"}],"exports":["a","b","c"],"inputs":{"src/core/lifecycle.ts":{"bytesInOutput":340}},"bytes":424},"dist/interactive.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":14770},"dist/interactive.js":{"imports":[{"path":"dist/chunk-APAMPY43.js","kind":"import-statement"},{"path":"dist/chunk-7BXR4ZFD.js","kind":"import-statement"},{"path":"dist/chunk-ENWGYQNU.js","kind":"import-statement"}],"exports":["Keys","MouseButton","keyboard","loop","mouse"],"entryPoint":"src/interactive/index.ts","inputs":{"src/interactive/loop.ts":{"bytesInOutput":459},"src/interactive/index.ts":{"bytesInOutput":0},"src/interactive/keyboard.ts":{"bytesInOutput":1309},"src/interactive/mouse.ts":{"bytesInOutput":1235}},"bytes":3170},"dist/chunk-APAMPY43.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":8537},"dist/chunk-APAMPY43.js":{"imports":[{"path":"dist/chunk-7BXR4ZFD.js","kind":"import-statement"},{"path":"dist/chunk-ENWGYQNU.js","kind":"import-statement"}],"exports":["a"],"inputs":{"src/core/state.ts":{"bytesInOutput":1555}},"bytes":1658},"dist/chunk-7BXR4ZFD.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":3712},"dist/chunk-7BXR4ZFD.js":{"imports":[{"path":"dist/chunk-ENWGYQNU.js","kind":"import-statement"}],"exports":["a","b"],"inputs":{"src/core/reactive.ts":{"bytesInOutput":590}},"bytes":667},"dist/chunk-ENWGYQNU.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":5647},"dist/chunk-ENWGYQNU.js":{"imports":[],"exports":["a","b","c","d","e","f","g","h"],"inputs":{"src/core/effect.ts":{"bytesInOutput":751},"src/core/hook.ts":{"bytesInOutput":227}},"bytes":1038},"dist/jsx-runtime.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/jsx-runtime.js":{"imports":[{"path":"dist/chunk-EXLNKYSH.js","kind":"import-statement"}],"exports":["Fragment","jsx","jsxs"],"entryPoint":"src/jsx-runtime.ts","inputs":{},"bytes":81},"dist/jsx-dev-runtime.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":510},"dist/jsx-dev-runtime.js":{"imports":[{"path":"dist/chunk-EXLNKYSH.js","kind":"import-statement"}],"exports":["Fragment","jsxDEV"],"entryPoint":"src/jsx-dev-runtime.ts","inputs":{"src/jsx-dev-runtime.ts":{"bytesInOutput":40}},"bytes":122},"dist/chunk-EXLNKYSH.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":1278},"dist/chunk-EXLNKYSH.js":{"imports":[],"exports":["a","b","c"],"inputs":{"src/jsx-runtime.ts":{"bytesInOutput":177}},"bytes":207}}}
|
package/dist/metafile-esm.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/index.ts":{"bytes":68,"imports":[],"format":"esm"},"src/core/effect.ts":{"bytes":2302,"imports":[],"format":"esm"},"src/core/reactive.ts":{"bytes":2077,"imports":[{"path":"src/core/effect.ts","kind":"import-statement","original":"./effect"}],"format":"esm"},"src/core/hook.ts":{"bytes":986,"imports":[],"format":"esm"},"src/core/state.ts":{"bytes":5773,"imports":[{"path":"src/core/reactive.ts","kind":"import-statement","original":"./reactive"},{"path":"src/core/effect.ts","kind":"import-statement","original":"./effect"},{"path":"src/core/hook.ts","kind":"import-statement","original":"./hook"}],"format":"esm"},"src/core/lifecycle.ts":{"bytes":1649,"imports":[{"path":"src/core/hook.ts","kind":"import-statement","original":"./hook"},{"path":"src/core/effect.ts","kind":"import-statement","original":"./effect"}],"format":"esm"},"src/core/context.ts":{"bytes":1461,"imports":[],"format":"esm"},"src/core/index.ts":{"bytes":166,"imports":[{"path":"src/core/state.ts","kind":"import-statement","original":"./state"},{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"./lifecycle"},{"path":"src/core/context.ts","kind":"import-statement","original":"./context"}],"format":"esm"},"src/dom/index.ts":{"bytes":21057,"imports":[{"path":"src/core/context.ts","kind":"import-statement","original":"../core/context"},{"path":"src/core/hook.ts","kind":"import-statement","original":"../core/hook"},{"path":"src/core/effect.ts","kind":"import-statement","original":"../core/effect"}],"format":"esm"},"src/router/types.ts":{"bytes":807,"imports":[],"format":"esm"},"src/router/utils.ts":{"bytes":3745,"imports":[{"path":"./types","kind":"import-statement","external":true}],"format":"esm"},"src/router/router.ts":{"bytes":2599,"imports":[{"path":"src/core/reactive.ts","kind":"import-statement","original":"../core/reactive"},{"path":"src/core/context.ts","kind":"import-statement","original":"../core/context"},{"path":"src/router/utils.ts","kind":"import-statement","original":"./utils"}],"format":"esm"},"src/jsx-runtime.ts":{"bytes":727,"imports":[],"format":"esm"},"src/router/dom/Route.tsx":{"bytes":106,"imports":[],"format":"esm"},"src/router/dom/Routes.tsx":{"bytes":2578,"imports":[{"path":"src/jsx-runtime.ts","kind":"import-statement","original":"../../jsx-runtime"},{"path":"src/router/router.ts","kind":"import-statement","original":"../router"},{"path":"src/router/utils.ts","kind":"import-statement","original":"../utils"},{"path":"src/router/dom/Route.tsx","kind":"import-statement","original":"./Route"}],"format":"esm"},"src/router/dom/Outlet.tsx":{"bytes":769,"imports":[{"path":"src/core/state.ts","kind":"import-statement","original":"../../core/state"},{"path":"src/core/context.ts","kind":"import-statement","original":"../../core/context"},{"path":"src/jsx-runtime.ts","kind":"import-statement","original":"../../jsx-runtime"},{"path":"src/router/router.ts","kind":"import-statement","original":"../router"}],"format":"esm"},"src/router/dom/Link.tsx":{"bytes":441,"imports":[{"path":"src/jsx-runtime.ts","kind":"import-statement","original":"../../jsx-runtime"},{"path":"src/router/router.ts","kind":"import-statement","original":"../router"}],"format":"esm"},"src/router/index.ts":{"bytes":259,"imports":[{"path":"src/router/types.ts","kind":"import-statement","original":"./types"},{"path":"src/router/router.ts","kind":"import-statement","original":"./router"},{"path":"src/router/dom/Routes.tsx","kind":"import-statement","original":"./dom/Routes"},{"path":"src/router/dom/Route.tsx","kind":"import-statement","original":"./dom/Route"},{"path":"src/router/dom/Outlet.tsx","kind":"import-statement","original":"./dom/Outlet"},{"path":"src/router/dom/Link.tsx","kind":"import-statement","original":"./dom/Link"}],"format":"esm"},"src/canvas/Canvas.tsx":{"bytes":5692,"imports":[{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"../core/lifecycle"},{"path":"src/core/reactive.ts","kind":"import-statement","original":"../core/reactive"},{"path":"src/jsx-runtime.ts","kind":"import-statement","original":"flexium/jsx-runtime"}],"format":"esm"},"src/canvas/dom/DrawRect.tsx":{"bytes":533,"imports":[{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"../../core/lifecycle"},{"path":"src/canvas/Canvas.tsx","kind":"import-statement","original":"../Canvas"}],"format":"esm"},"src/canvas/dom/DrawCircle.tsx":{"bytes":508,"imports":[{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"../../core/lifecycle"},{"path":"src/canvas/Canvas.tsx","kind":"import-statement","original":"../Canvas"}],"format":"esm"},"src/canvas/dom/DrawArc.tsx":{"bytes":599,"imports":[{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"../../core/lifecycle"},{"path":"src/canvas/Canvas.tsx","kind":"import-statement","original":"../Canvas"}],"format":"esm"},"src/canvas/dom/DrawLine.tsx":{"bytes":495,"imports":[{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"../../core/lifecycle"},{"path":"src/canvas/Canvas.tsx","kind":"import-statement","original":"../Canvas"}],"format":"esm"},"src/canvas/dom/DrawText.tsx":{"bytes":580,"imports":[{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"../../core/lifecycle"},{"path":"src/canvas/Canvas.tsx","kind":"import-statement","original":"../Canvas"}],"format":"esm"},"src/canvas/dom/DrawPath.tsx":{"bytes":437,"imports":[{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"../../core/lifecycle"},{"path":"src/canvas/Canvas.tsx","kind":"import-statement","original":"../Canvas"}],"format":"esm"},"src/canvas/index.ts":{"bytes":427,"imports":[{"path":"src/canvas/Canvas.tsx","kind":"import-statement","original":"./Canvas"},{"path":"src/canvas/dom/DrawRect.tsx","kind":"import-statement","original":"./dom/DrawRect"},{"path":"src/canvas/dom/DrawCircle.tsx","kind":"import-statement","original":"./dom/DrawCircle"},{"path":"src/canvas/dom/DrawArc.tsx","kind":"import-statement","original":"./dom/DrawArc"},{"path":"src/canvas/dom/DrawLine.tsx","kind":"import-statement","original":"./dom/DrawLine"},{"path":"src/canvas/dom/DrawText.tsx","kind":"import-statement","original":"./dom/DrawText"},{"path":"src/canvas/dom/DrawPath.tsx","kind":"import-statement","original":"./dom/DrawPath"}],"format":"esm"},"src/interactive/loop.ts":{"bytes":1888,"imports":[],"format":"esm"},"src/interactive/keyboard.ts":{"bytes":3391,"imports":[{"path":"src/core/state.ts","kind":"import-statement","original":"../core/state"}],"format":"esm"},"src/interactive/mouse.ts":{"bytes":3563,"imports":[{"path":"src/core/state.ts","kind":"import-statement","original":"../core/state"}],"format":"esm"},"src/interactive/index.ts":{"bytes":206,"imports":[{"path":"src/interactive/loop.ts","kind":"import-statement","original":"./loop"},{"path":"src/interactive/keyboard.ts","kind":"import-statement","original":"./keyboard"},{"path":"src/interactive/mouse.ts","kind":"import-statement","original":"./mouse"}],"format":"esm"},"src/jsx-dev-runtime.ts":{"bytes":211,"imports":[{"path":"src/jsx-runtime.ts","kind":"import-statement","original":"./jsx-runtime"}],"format":"esm"}},"outputs":{"dist/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":205},"dist/index.mjs":{"imports":[],"exports":["VERSION"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":16}},"bytes":38},"dist/core.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/core.mjs":{"imports":[{"path":"dist/chunk-LUREDEUB.mjs","kind":"import-statement"},{"path":"dist/chunk-S6WF3XNF.mjs","kind":"import-statement"},{"path":"dist/chunk-ECB5HZOQ.mjs","kind":"import-statement"},{"path":"dist/chunk-CPJRQL2C.mjs","kind":"import-statement"},{"path":"dist/chunk-44RZHCII.mjs","kind":"import-statement"}],"exports":["batch","context","createContext","effect","popContext","pushContext","runWithContext","snapshotContext","state","sync"],"entryPoint":"src/core/index.ts","inputs":{"src/core/index.ts":{"bytesInOutput":0}},"bytes":389},"dist/dom.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":30059},"dist/dom.mjs":{"imports":[{"path":"dist/chunk-LUREDEUB.mjs","kind":"import-statement"},{"path":"dist/chunk-44RZHCII.mjs","kind":"import-statement"}],"exports":["f","reconcile","render"],"entryPoint":"src/dom/index.ts","inputs":{"src/dom/index.ts":{"bytesInOutput":4843}},"bytes":4975},"dist/router.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":16422},"dist/router.mjs":{"imports":[{"path":"dist/chunk-LUREDEUB.mjs","kind":"import-statement"},{"path":"dist/chunk-ECB5HZOQ.mjs","kind":"import-statement"},{"path":"dist/chunk-CPJRQL2C.mjs","kind":"import-statement"},{"path":"dist/chunk-44RZHCII.mjs","kind":"import-statement"},{"path":"dist/chunk-ZCO4NIGC.mjs","kind":"import-statement"}],"exports":["Link","Outlet","Route","Routes","router"],"entryPoint":"src/router/index.ts","inputs":{"src/router/index.ts":{"bytesInOutput":0},"src/router/utils.ts":{"bytesInOutput":1073},"src/router/router.ts":{"bytesInOutput":743},"src/router/dom/Route.tsx":{"bytesInOutput":26},"src/router/dom/Routes.tsx":{"bytesInOutput":638},"src/router/dom/Outlet.tsx":{"bytesInOutput":238},"src/router/dom/Link.tsx":{"bytesInOutput":133}},"bytes":3112},"dist/chunk-LUREDEUB.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2664},"dist/chunk-LUREDEUB.mjs":{"imports":[],"exports":["a","b","c","d","e","f"],"inputs":{"src/core/context.ts":{"bytesInOutput":450}},"bytes":501},"dist/canvas.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":14321},"dist/canvas.mjs":{"imports":[{"path":"dist/chunk-S6WF3XNF.mjs","kind":"import-statement"},{"path":"dist/chunk-CPJRQL2C.mjs","kind":"import-statement"},{"path":"dist/chunk-44RZHCII.mjs","kind":"import-statement"},{"path":"dist/chunk-ZCO4NIGC.mjs","kind":"import-statement"}],"exports":["Canvas","DrawArc","DrawCircle","DrawLine","DrawPath","DrawRect","DrawText"],"entryPoint":"src/canvas/index.ts","inputs":{"src/canvas/Canvas.tsx":{"bytesInOutput":1875},"src/canvas/index.ts":{"bytesInOutput":0},"src/canvas/dom/DrawRect.tsx":{"bytesInOutput":60},"src/canvas/dom/DrawCircle.tsx":{"bytesInOutput":62},"src/canvas/dom/DrawArc.tsx":{"bytesInOutput":59},"src/canvas/dom/DrawLine.tsx":{"bytesInOutput":60},"src/canvas/dom/DrawText.tsx":{"bytesInOutput":60},"src/canvas/dom/DrawPath.tsx":{"bytesInOutput":60}},"bytes":2494},"dist/chunk-S6WF3XNF.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2516},"dist/chunk-S6WF3XNF.mjs":{"imports":[{"path":"dist/chunk-44RZHCII.mjs","kind":"import-statement"}],"exports":["a","b","c"],"inputs":{"src/core/lifecycle.ts":{"bytesInOutput":340}},"bytes":425},"dist/interactive.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":14770},"dist/interactive.mjs":{"imports":[{"path":"dist/chunk-ECB5HZOQ.mjs","kind":"import-statement"},{"path":"dist/chunk-CPJRQL2C.mjs","kind":"import-statement"},{"path":"dist/chunk-44RZHCII.mjs","kind":"import-statement"}],"exports":["Keys","MouseButton","keyboard","loop","mouse"],"entryPoint":"src/interactive/index.ts","inputs":{"src/interactive/loop.ts":{"bytesInOutput":459},"src/interactive/index.ts":{"bytesInOutput":0},"src/interactive/keyboard.ts":{"bytesInOutput":1309},"src/interactive/mouse.ts":{"bytesInOutput":1235}},"bytes":3173},"dist/chunk-ECB5HZOQ.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":8537},"dist/chunk-ECB5HZOQ.mjs":{"imports":[{"path":"dist/chunk-CPJRQL2C.mjs","kind":"import-statement"},{"path":"dist/chunk-44RZHCII.mjs","kind":"import-statement"}],"exports":["a"],"inputs":{"src/core/state.ts":{"bytesInOutput":1555}},"bytes":1660},"dist/chunk-CPJRQL2C.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3712},"dist/chunk-CPJRQL2C.mjs":{"imports":[{"path":"dist/chunk-44RZHCII.mjs","kind":"import-statement"}],"exports":["a","b"],"inputs":{"src/core/reactive.ts":{"bytesInOutput":590}},"bytes":668},"dist/chunk-44RZHCII.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5647},"dist/chunk-44RZHCII.mjs":{"imports":[],"exports":["a","b","c","d","e","f","g","h"],"inputs":{"src/core/effect.ts":{"bytesInOutput":751},"src/core/hook.ts":{"bytesInOutput":227}},"bytes":1038},"dist/jsx-runtime.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/jsx-runtime.mjs":{"imports":[{"path":"dist/chunk-ZCO4NIGC.mjs","kind":"import-statement"}],"exports":["Fragment","jsx","jsxs"],"entryPoint":"src/jsx-runtime.ts","inputs":{},"bytes":82},"dist/jsx-dev-runtime.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":510},"dist/jsx-dev-runtime.mjs":{"imports":[{"path":"dist/chunk-ZCO4NIGC.mjs","kind":"import-statement"}],"exports":["Fragment","jsxDEV"],"entryPoint":"src/jsx-dev-runtime.ts","inputs":{"src/jsx-dev-runtime.ts":{"bytesInOutput":40}},"bytes":123},"dist/chunk-ZCO4NIGC.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1278},"dist/chunk-ZCO4NIGC.mjs":{"imports":[],"exports":["a","b","c"],"inputs":{"src/jsx-runtime.ts":{"bytesInOutput":177}},"bytes":207}}}
|
|
1
|
+
{"inputs":{"src/index.ts":{"bytes":68,"imports":[],"format":"esm"},"src/core/effect.ts":{"bytes":2302,"imports":[],"format":"esm"},"src/core/reactive.ts":{"bytes":2077,"imports":[{"path":"src/core/effect.ts","kind":"import-statement","original":"./effect"}],"format":"esm"},"src/core/hook.ts":{"bytes":986,"imports":[],"format":"esm"},"src/core/state.ts":{"bytes":5773,"imports":[{"path":"src/core/reactive.ts","kind":"import-statement","original":"./reactive"},{"path":"src/core/effect.ts","kind":"import-statement","original":"./effect"},{"path":"src/core/hook.ts","kind":"import-statement","original":"./hook"}],"format":"esm"},"src/core/lifecycle.ts":{"bytes":1649,"imports":[{"path":"src/core/hook.ts","kind":"import-statement","original":"./hook"},{"path":"src/core/effect.ts","kind":"import-statement","original":"./effect"}],"format":"esm"},"src/core/context.ts":{"bytes":1461,"imports":[],"format":"esm"},"src/core/index.ts":{"bytes":166,"imports":[{"path":"src/core/state.ts","kind":"import-statement","original":"./state"},{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"./lifecycle"},{"path":"src/core/context.ts","kind":"import-statement","original":"./context"}],"format":"esm"},"src/dom/index.ts":{"bytes":21288,"imports":[{"path":"src/core/context.ts","kind":"import-statement","original":"../core/context"},{"path":"src/core/hook.ts","kind":"import-statement","original":"../core/hook"},{"path":"src/core/effect.ts","kind":"import-statement","original":"../core/effect"}],"format":"esm"},"src/router/types.ts":{"bytes":807,"imports":[],"format":"esm"},"src/router/utils.ts":{"bytes":3745,"imports":[{"path":"./types","kind":"import-statement","external":true}],"format":"esm"},"src/router/router.ts":{"bytes":2599,"imports":[{"path":"src/core/reactive.ts","kind":"import-statement","original":"../core/reactive"},{"path":"src/core/context.ts","kind":"import-statement","original":"../core/context"},{"path":"src/router/utils.ts","kind":"import-statement","original":"./utils"}],"format":"esm"},"src/jsx-runtime.ts":{"bytes":727,"imports":[],"format":"esm"},"src/router/dom/Route.tsx":{"bytes":106,"imports":[],"format":"esm"},"src/router/dom/Routes.tsx":{"bytes":2578,"imports":[{"path":"src/jsx-runtime.ts","kind":"import-statement","original":"../../jsx-runtime"},{"path":"src/router/router.ts","kind":"import-statement","original":"../router"},{"path":"src/router/utils.ts","kind":"import-statement","original":"../utils"},{"path":"src/router/dom/Route.tsx","kind":"import-statement","original":"./Route"}],"format":"esm"},"src/router/dom/Outlet.tsx":{"bytes":769,"imports":[{"path":"src/core/state.ts","kind":"import-statement","original":"../../core/state"},{"path":"src/core/context.ts","kind":"import-statement","original":"../../core/context"},{"path":"src/jsx-runtime.ts","kind":"import-statement","original":"../../jsx-runtime"},{"path":"src/router/router.ts","kind":"import-statement","original":"../router"}],"format":"esm"},"src/router/dom/Link.tsx":{"bytes":441,"imports":[{"path":"src/jsx-runtime.ts","kind":"import-statement","original":"../../jsx-runtime"},{"path":"src/router/router.ts","kind":"import-statement","original":"../router"}],"format":"esm"},"src/router/index.ts":{"bytes":259,"imports":[{"path":"src/router/types.ts","kind":"import-statement","original":"./types"},{"path":"src/router/router.ts","kind":"import-statement","original":"./router"},{"path":"src/router/dom/Routes.tsx","kind":"import-statement","original":"./dom/Routes"},{"path":"src/router/dom/Route.tsx","kind":"import-statement","original":"./dom/Route"},{"path":"src/router/dom/Outlet.tsx","kind":"import-statement","original":"./dom/Outlet"},{"path":"src/router/dom/Link.tsx","kind":"import-statement","original":"./dom/Link"}],"format":"esm"},"src/canvas/Canvas.tsx":{"bytes":5692,"imports":[{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"../core/lifecycle"},{"path":"src/core/reactive.ts","kind":"import-statement","original":"../core/reactive"},{"path":"src/jsx-runtime.ts","kind":"import-statement","original":"flexium/jsx-runtime"}],"format":"esm"},"src/canvas/dom/DrawRect.tsx":{"bytes":533,"imports":[{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"../../core/lifecycle"},{"path":"src/canvas/Canvas.tsx","kind":"import-statement","original":"../Canvas"}],"format":"esm"},"src/canvas/dom/DrawCircle.tsx":{"bytes":508,"imports":[{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"../../core/lifecycle"},{"path":"src/canvas/Canvas.tsx","kind":"import-statement","original":"../Canvas"}],"format":"esm"},"src/canvas/dom/DrawArc.tsx":{"bytes":599,"imports":[{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"../../core/lifecycle"},{"path":"src/canvas/Canvas.tsx","kind":"import-statement","original":"../Canvas"}],"format":"esm"},"src/canvas/dom/DrawLine.tsx":{"bytes":495,"imports":[{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"../../core/lifecycle"},{"path":"src/canvas/Canvas.tsx","kind":"import-statement","original":"../Canvas"}],"format":"esm"},"src/canvas/dom/DrawText.tsx":{"bytes":580,"imports":[{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"../../core/lifecycle"},{"path":"src/canvas/Canvas.tsx","kind":"import-statement","original":"../Canvas"}],"format":"esm"},"src/canvas/dom/DrawPath.tsx":{"bytes":437,"imports":[{"path":"src/core/lifecycle.ts","kind":"import-statement","original":"../../core/lifecycle"},{"path":"src/canvas/Canvas.tsx","kind":"import-statement","original":"../Canvas"}],"format":"esm"},"src/canvas/index.ts":{"bytes":427,"imports":[{"path":"src/canvas/Canvas.tsx","kind":"import-statement","original":"./Canvas"},{"path":"src/canvas/dom/DrawRect.tsx","kind":"import-statement","original":"./dom/DrawRect"},{"path":"src/canvas/dom/DrawCircle.tsx","kind":"import-statement","original":"./dom/DrawCircle"},{"path":"src/canvas/dom/DrawArc.tsx","kind":"import-statement","original":"./dom/DrawArc"},{"path":"src/canvas/dom/DrawLine.tsx","kind":"import-statement","original":"./dom/DrawLine"},{"path":"src/canvas/dom/DrawText.tsx","kind":"import-statement","original":"./dom/DrawText"},{"path":"src/canvas/dom/DrawPath.tsx","kind":"import-statement","original":"./dom/DrawPath"}],"format":"esm"},"src/interactive/loop.ts":{"bytes":1888,"imports":[],"format":"esm"},"src/interactive/keyboard.ts":{"bytes":3391,"imports":[{"path":"src/core/state.ts","kind":"import-statement","original":"../core/state"}],"format":"esm"},"src/interactive/mouse.ts":{"bytes":3563,"imports":[{"path":"src/core/state.ts","kind":"import-statement","original":"../core/state"}],"format":"esm"},"src/interactive/index.ts":{"bytes":206,"imports":[{"path":"src/interactive/loop.ts","kind":"import-statement","original":"./loop"},{"path":"src/interactive/keyboard.ts","kind":"import-statement","original":"./keyboard"},{"path":"src/interactive/mouse.ts","kind":"import-statement","original":"./mouse"}],"format":"esm"},"src/jsx-dev-runtime.ts":{"bytes":211,"imports":[{"path":"src/jsx-runtime.ts","kind":"import-statement","original":"./jsx-runtime"}],"format":"esm"}},"outputs":{"dist/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":205},"dist/index.mjs":{"imports":[],"exports":["VERSION"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":16}},"bytes":38},"dist/core.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/core.mjs":{"imports":[{"path":"dist/chunk-LUREDEUB.mjs","kind":"import-statement"},{"path":"dist/chunk-S6WF3XNF.mjs","kind":"import-statement"},{"path":"dist/chunk-ECB5HZOQ.mjs","kind":"import-statement"},{"path":"dist/chunk-CPJRQL2C.mjs","kind":"import-statement"},{"path":"dist/chunk-44RZHCII.mjs","kind":"import-statement"}],"exports":["batch","context","createContext","effect","popContext","pushContext","runWithContext","snapshotContext","state","sync"],"entryPoint":"src/core/index.ts","inputs":{"src/core/index.ts":{"bytesInOutput":0}},"bytes":389},"dist/dom.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":30353},"dist/dom.mjs":{"imports":[{"path":"dist/chunk-LUREDEUB.mjs","kind":"import-statement"},{"path":"dist/chunk-44RZHCII.mjs","kind":"import-statement"}],"exports":["f","reconcile","render"],"entryPoint":"src/dom/index.ts","inputs":{"src/dom/index.ts":{"bytesInOutput":4899}},"bytes":5031},"dist/router.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":16422},"dist/router.mjs":{"imports":[{"path":"dist/chunk-LUREDEUB.mjs","kind":"import-statement"},{"path":"dist/chunk-ECB5HZOQ.mjs","kind":"import-statement"},{"path":"dist/chunk-CPJRQL2C.mjs","kind":"import-statement"},{"path":"dist/chunk-44RZHCII.mjs","kind":"import-statement"},{"path":"dist/chunk-ZCO4NIGC.mjs","kind":"import-statement"}],"exports":["Link","Outlet","Route","Routes","router"],"entryPoint":"src/router/index.ts","inputs":{"src/router/index.ts":{"bytesInOutput":0},"src/router/utils.ts":{"bytesInOutput":1073},"src/router/router.ts":{"bytesInOutput":743},"src/router/dom/Route.tsx":{"bytesInOutput":26},"src/router/dom/Routes.tsx":{"bytesInOutput":638},"src/router/dom/Outlet.tsx":{"bytesInOutput":238},"src/router/dom/Link.tsx":{"bytesInOutput":133}},"bytes":3112},"dist/chunk-LUREDEUB.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2664},"dist/chunk-LUREDEUB.mjs":{"imports":[],"exports":["a","b","c","d","e","f"],"inputs":{"src/core/context.ts":{"bytesInOutput":450}},"bytes":501},"dist/canvas.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":14321},"dist/canvas.mjs":{"imports":[{"path":"dist/chunk-S6WF3XNF.mjs","kind":"import-statement"},{"path":"dist/chunk-CPJRQL2C.mjs","kind":"import-statement"},{"path":"dist/chunk-44RZHCII.mjs","kind":"import-statement"},{"path":"dist/chunk-ZCO4NIGC.mjs","kind":"import-statement"}],"exports":["Canvas","DrawArc","DrawCircle","DrawLine","DrawPath","DrawRect","DrawText"],"entryPoint":"src/canvas/index.ts","inputs":{"src/canvas/Canvas.tsx":{"bytesInOutput":1875},"src/canvas/index.ts":{"bytesInOutput":0},"src/canvas/dom/DrawRect.tsx":{"bytesInOutput":60},"src/canvas/dom/DrawCircle.tsx":{"bytesInOutput":62},"src/canvas/dom/DrawArc.tsx":{"bytesInOutput":59},"src/canvas/dom/DrawLine.tsx":{"bytesInOutput":60},"src/canvas/dom/DrawText.tsx":{"bytesInOutput":60},"src/canvas/dom/DrawPath.tsx":{"bytesInOutput":60}},"bytes":2494},"dist/chunk-S6WF3XNF.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2516},"dist/chunk-S6WF3XNF.mjs":{"imports":[{"path":"dist/chunk-44RZHCII.mjs","kind":"import-statement"}],"exports":["a","b","c"],"inputs":{"src/core/lifecycle.ts":{"bytesInOutput":340}},"bytes":425},"dist/interactive.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":14770},"dist/interactive.mjs":{"imports":[{"path":"dist/chunk-ECB5HZOQ.mjs","kind":"import-statement"},{"path":"dist/chunk-CPJRQL2C.mjs","kind":"import-statement"},{"path":"dist/chunk-44RZHCII.mjs","kind":"import-statement"}],"exports":["Keys","MouseButton","keyboard","loop","mouse"],"entryPoint":"src/interactive/index.ts","inputs":{"src/interactive/loop.ts":{"bytesInOutput":459},"src/interactive/index.ts":{"bytesInOutput":0},"src/interactive/keyboard.ts":{"bytesInOutput":1309},"src/interactive/mouse.ts":{"bytesInOutput":1235}},"bytes":3173},"dist/chunk-ECB5HZOQ.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":8537},"dist/chunk-ECB5HZOQ.mjs":{"imports":[{"path":"dist/chunk-CPJRQL2C.mjs","kind":"import-statement"},{"path":"dist/chunk-44RZHCII.mjs","kind":"import-statement"}],"exports":["a"],"inputs":{"src/core/state.ts":{"bytesInOutput":1555}},"bytes":1660},"dist/chunk-CPJRQL2C.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3712},"dist/chunk-CPJRQL2C.mjs":{"imports":[{"path":"dist/chunk-44RZHCII.mjs","kind":"import-statement"}],"exports":["a","b"],"inputs":{"src/core/reactive.ts":{"bytesInOutput":590}},"bytes":668},"dist/chunk-44RZHCII.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5647},"dist/chunk-44RZHCII.mjs":{"imports":[],"exports":["a","b","c","d","e","f","g","h"],"inputs":{"src/core/effect.ts":{"bytesInOutput":751},"src/core/hook.ts":{"bytesInOutput":227}},"bytes":1038},"dist/jsx-runtime.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/jsx-runtime.mjs":{"imports":[{"path":"dist/chunk-ZCO4NIGC.mjs","kind":"import-statement"}],"exports":["Fragment","jsx","jsxs"],"entryPoint":"src/jsx-runtime.ts","inputs":{},"bytes":82},"dist/jsx-dev-runtime.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":510},"dist/jsx-dev-runtime.mjs":{"imports":[{"path":"dist/chunk-ZCO4NIGC.mjs","kind":"import-statement"}],"exports":["Fragment","jsxDEV"],"entryPoint":"src/jsx-dev-runtime.ts","inputs":{"src/jsx-dev-runtime.ts":{"bytesInOutput":40}},"bytes":123},"dist/chunk-ZCO4NIGC.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1278},"dist/chunk-ZCO4NIGC.mjs":{"imports":[],"exports":["a","b","c"],"inputs":{"src/jsx-runtime.ts":{"bytesInOutput":177}},"bytes":207}}}
|