declare type CloneBaseID = string; declare type IsDefineBase = boolean; export interface ITreeDescriptionArray extends Array { } export declare type TreeDescription = [string, { [key: string]: string | number; } | undefined, ITreeDescriptionArray | undefined | string, CloneBaseID?, // cloneBaseID 克隆的性能比新建好很多 IsDefineBase?]; export declare class DOMTurbo { baseCloneMap: Map; /** * 创建DOM树通过树描述 * 比如 * turbo.createDOMTree(["div", undefined, [ * ["h3", {class: 1}, "xxxx"], * ["div", {class: 1}, [ * ["h5", undefined, "im title 5"] * ]], * ]]) * * @param {*} treeDesc * @memberof DOMTurbo */ createDOMTree(treeDesc: TreeDescription, parent?: Node | undefined): Node; /** * 创建元素并设置属性内容 * * @param {(string | Element)} from * @param {({[key: string]: string} | null)} attrs * @param {(string | Element[])} [children] * @returns * @memberof DOMTurbo */ createElement(from: string | Element, attrs: { [key: string]: string | number; } | null | undefined, children?: (Element | string)[] | string): Element; /** * 批量创建元素 * * @param {(string | Element)} from * @param {(Array<{attrs: {[key: string]: string} | null, children?: string | Element[]}>)} list * @returns {Element[]} * @memberof DOMTurbo */ createElements(from: string | Element, list: { attrs: { [key: string]: string; } | null | undefined; children?: (Element | string)[] | string; }[], retFragment?: boolean): Element[] | DocumentFragment; /** * 批量设置属性和内容 * * @param {Element} element * @param {{[key: string]: string}} attrs * @param {(Element[] | string)} children * @memberof DOMTurbo */ setAttributes(element: Element, attrs: { [key: string]: string | number; } | null | undefined, children?: (Element | string)[] | string): void; /** * 批量append子节点 TODO: 由于序列化的问题, 暂不能工作 * * @param {Element} parent * @param {(Array | string | DocumentFragment)} children * @memberof DOMTurbo */ appendChildren(parent: Element, children: (Element | string)[] | string | DocumentFragment): void; appendChild(parent: Element, ...args: (Element | string)[]): void; } export default class DOMTurboPlugin { install(): void; } export {};