UNPKG

flexium

Version:

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

1 lines 1.07 kB
{"version":3,"sources":["../src/core/vnode.ts"],"names":["createVNode","type","props","children","key"],"mappings":"AAWO,SAASA,EACdC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACO,CAGP,OAAO,CACL,IAAA,CAAAH,CAAAA,CACA,MAAAC,CAAAA,CACA,QAAA,CAAAC,EACA,GAAA,CAAKC,CAAAA,EAAO,MACd,CACF","file":"chunk-C5SJBRY2.mjs","sourcesContent":["import type { VNode } from './renderer';\n\n/**\n * Creates a VNode ensuring consistent object shape (Monomorphism).\n * This is crucial for JS engine optimization (Hidden Classes).\n * \n * @param type - Element type\n * @param props - Element properties\n * @param children - Element children\n * @param key - Optional key for reconciliation\n */\nexport function createVNode(\n type: string | Function,\n props: Record<string, any>,\n children: any[],\n key?: string | number | null\n): VNode {\n // Always create the object with the exact same properties in the exact same order.\n // `key` is included even if undefined/null to maintain shape.\n return {\n type,\n props,\n children,\n key: key ?? undefined\n };\n}\n"]}