import { SchemaRecord } from "./schema.js"; import { JSXProps, Nullable, DOMInternalProperties } from "./dom.js"; export type VNodeProperties = Nullable; export type VNodeChildren = Children extends null ? any[] : Children extends any[] ? Children : Children[]; export type VNodeProps = Props extends null ? SchemaRecord : SchemaRecord & Props; export type VnodeKeyTypesRaw = Node | typeof Element | Element | typeof Node; export type VNodeKeyTypes = string | VnodeKeyTypesRaw | null; export type VNodeType = Type; export type VNodeRender = () => ( node: T, id?: symbol | string, hydrate?: boolean ) => T; export type H = ( type: Type, props?: Props, ...children: Childre[] ) => VNode; interface VNodeGenericSchema { [TYPE: symbol]: symbol; key?: any; shadow?: boolean | Partial; static?: boolean; is?: string; clone?: boolean; } interface VNodeSchema extends VNodeGenericSchema { type: Type; props: VNodeProperties; } export type VNode = Type extends string ? VNodeSchema> : Type extends HTMLElement ? VNodeSchema : Type extends typeof HTMLElement ? VNodeSchema : VNodeSchema; export type VNodeAny = VNode; export type VNodeGeneric = | VNode | VNode | VNode; export interface VNodeListener extends AddEventListenerOptions { (event: Event | CustomEvent): any; } export type VNodeStore = { vnode: any; cycle: number; fragment?: Fragment; handlers: any; }; export type RenderId = symbol | string; export type Keyes = Map; export type Handlers = { [event: string]: VNodeListener; }; export type Fragment = { markStart: ChildNode; markEnd: ChildNode; keyes?: Keyes; }; export type Render = ( vnode: VNodeAny, node: T, id?: RenderId ) => T; interface InternalElement extends Element { cloneNode(value: boolean): Element; }