export declare type VNodeInput = string | number | VNode; /** * Virtual Node for storing `sgml` style documents **/ export declare abstract class VNode { /** * Convert a virtual dom node to sgml text * @param level current indentation level */ toString(level?: number): string; abstract get textContent(): string; abstract set textContent(v: string); } /** * Virtual Text Node for storing text leaf nodes **/ export declare class VNodeText extends VNode { text: string; constructor(text: string); toString(level?: number): string; get textContent(): string; set textContent(v: string); } /** * Virtual Element Node for storing tagged elements **/ export declare class VNodeElement extends VNode { tag: string; attrs: Record; children: VNode[]; constructor(tag: string, attrs: Record, children: VNode[]); get textContent(): string; set textContent(v: string); toString(level?: number): string; /** Iterate over sub elements with `tag` * @param tag */ tags(tag: string): Generator; /** * Find element matching the tags * @param tags hierarchy of tag names */ find(...rest: string[]): VNodeElement | null; /** Iterate over VNodeElement children */ elementChildren(): Generator; private toStringAttrs; private toStringChildren; } /** * Create a virtual dom node * * @example * ```typescript * V('div', {style: 'color:red'}, 'Hello World') * V('div', ['one', V('b', 'two')]) * V('p') * ``` * * @param tag DOM tag to use * @param attrs DOM attributes * @param children DOM children */ export declare function V(tag: string): VNodeElement; export declare function V(tag: string, children: VNodeInput[] | VNodeInput): VNodeElement; export declare function V(tag: string, attrs: Record, children?: VNodeInput[] | VNodeInput): VNodeElement; //# sourceMappingURL=vdom.d.ts.map