UNPKG

@visactor/vrender-core

Version:
78 lines (77 loc) 3.99 kB
import type { Dict, LooseFunction } from '@visactor/vutils'; import { EventEmitter } from '@visactor/vutils'; import type { INode } from '../interface'; export declare class Node extends EventEmitter<any, any> implements INode { parent: any; name: string; id: string | number; _uid: number; _prev?: INode; _next?: INode; protected _firstChild: INode | null; protected _lastChild: INode | null; protected _idMap?: Map<number, INode>; protected _count: number; protected _structEdit?: boolean; protected _nodeList?: INode[]; _ignoreWarn?: boolean; get previousSibling(): INode | null; get nextSibling(): INode | null; get children(): INode[]; get firstChild(): INode | null; get lastChild(): INode | null; get count(): number; get childrenCount(): number; constructor(); forEachChildren<T extends INode = INode>(cb: (item: T, index: number) => void | boolean, reverse?: boolean): void; forEachChildrenAsync<T extends INode = INode>(cb: (item: T, index: number) => Promise<void | boolean> | void | boolean, reverse?: boolean): Promise<void>; forEach<T extends INode = INode>(cb: (item: T, index: number) => void): void; appendChild(node: INode, highPerformance?: boolean): INode | null; appendChildArrHighPerformance(nodes: INode[], replace?: boolean): INode[] | null; insertBefore(newNode: INode, referenceNode: INode | undefined): INode | null; insertAfter(newNode: INode, referenceNode: INode | undefined): INode | null; insertInto(newNode: INode, idx: number): INode | null; insertIntoKeepIdx(newNode: INode, idx: number): INode | null; removeChild(child: INode): INode | null; delete(): void; removeAllChild(deep?: boolean): void; replaceChild(newChild: INode, oldChild: INode): INode | null; find<T extends INode = INode>(callback: (node: T, index: number) => boolean, deep?: boolean): T | null; findAll<T extends INode = INode>(callback: (node: T, index: number) => boolean, deep?: boolean): T[]; getElementById(id: string | number): INode | null; findChildById(id: string | number): INode | null; findChildByUid(uid: number): INode | null; getElementsByName(name: string): INode[]; findChildrenByName(name: string): INode[]; getElementsByType(type: string): INode[]; getChildByName(name: string, deep?: boolean): INode; getChildAt(idx: number): INode | null; at(idx: number): INode | null; containNode(node: INode): boolean; getRootNode(): INode; hasChildNodes(): boolean; addChild(node: INode): INode | null; add(node: INode): INode | null; getChildren(): INode[]; isChildOf(node: INode): boolean; isParentOf(node: INode): boolean; isDescendantsOf(node: INode): boolean; isAncestorsOf(node: INode): boolean; getAncestor(idx: number): INode; setAllDescendantsProps(propsName: string, propsValue: any): void; private setCount; clone(): INode; cloneTo(node: INode): void; getParent(): INode | null; del(child: INode): INode | null; addEventListener(type: string, listener: EventListenerOrEventListenerObject | LooseFunction, options?: AddEventListenerOptions | boolean): this; on(type: string, listener: EventListenerOrEventListenerObject | LooseFunction, options?: AddEventListenerOptions | boolean): this; removeEventListener(type: string, listener: EventListenerOrEventListenerObject | LooseFunction, options?: AddEventListenerOptions | boolean): this; off(type: string, listener: EventListenerOrEventListenerObject | LooseFunction, options?: AddEventListenerOptions | boolean): this; once(type: string, listener: EventListenerOrEventListenerObject | LooseFunction, options?: AddEventListenerOptions | boolean): this; removeAllEventListeners(): this; removeAllListeners(): this; dispatchEvent(event: any, ...args: any): boolean; emit(event: any, data?: Dict<any>): boolean; release(): void; }