/**
* @typedef VNode
* @property {string} id 가상 노드 아이디
* @property {Object} type 넥사크로 타입
* @property {Object} props
* @property {VNode} flatChildren 컴포넌트 속성
* @property {Object} base 가상 노드가 마운트된 객체
* @property {VNode} rootVNode 최상위 노드
* @property {Object} rootForm 그려진 최상위 컴포넌트
* @property {string} nativeId 실제 컴포넌트 아이디
*/
import { generateUUIDv4 } from "../crypto/generate-uuidv4";
/**
* 가상 노드를 만듭니다.
*
* @function v
* @param {string} type 넥사크로 타입
* @param {Object} props 속성
* @returns {VNode} 가상 노드
* @deprecated $react를 사용하세요.
* @memberof $v
* @example
* const { v } = $v;
* const vMyStatic = function (props) {
* return v("static", {
* left: 0,
* right: 0,
* height: 27,
* });
* };
*
*/
export function v(type, props) {
let children = props?.children;
if (children && !(children instanceof Array)) {
children = [children];
}
const flatChildren = children?.flat();
return {
id: generateUUIDv4(),
type,
props,
flatChildren,
};
}