UNPKG

@turbox3d/renderer-core

Version:

Large-scale declarative graphic ui core renderer

39 lines (38 loc) 1.6 kB
import { IConstructorOf } from '@turbox3d/shared'; import { Component, ComponentProps } from './component'; import { NodeStatus, NodeTag } from './common'; export interface ElementSchema<P extends object = any> { type: IConstructorOf<Component<P>>; props?: ComponentProps<P>; } export type Element<P extends object = any> = ElementSchema<P> | undefined | boolean | null | number | string; export declare class VirtualNode<P extends object = any> { instance?: Component<P>; key?: string | number; child?: VirtualNode<P>; sibling?: VirtualNode<P>; parent?: VirtualNode<P>; status: NodeStatus; tag: NodeTag; props?: ComponentProps<P>; committing: boolean; static isBatchUpdate: boolean; static batchQueue: Array<() => VirtualNode>; static buildNode(el: ElementSchema): VirtualNode<any>; validate(): Map<Function, VirtualNode<any>[]>; link(elements: Element<any>[]): VirtualNode<P> | undefined; create(singleNode?: boolean): void; commitCreate(): this; getChildren(): VirtualNode<P>[]; remove(): void; commitDelete(): void; patch(): void; resetStatus(): void; diff(elements: Element<P>[] | null): void; update(isForce?: boolean): void; commitUpdate(prevProps: ComponentProps<P>): this; getParentPath(): VirtualNode<any>[]; } export declare function render(elements: Element<any>[]): void; export declare function g<P extends object>(type: IConstructorOf<Component<P>>, props?: ComponentProps<P>): ElementSchema<P>; export declare function batchUpdate(callback: () => void, finish?: () => void): void;