@ifreeovo/highlight-dom
Version:
实现类似dom-inspector的高亮效果
38 lines (37 loc) • 1.27 kB
TypeScript
import type { UserConfig, Mode } from './define-config';
import type { DOMElement } from './dom';
import type { Task } from './utils';
import type { Plugin } from './plugin';
import Overlay from './overlay';
import PluginManager from './plugin';
export { default as defineConfig } from './define-config';
export declare enum ModeEnum {
Single = "single",
Siblings = "siblings"
}
declare class HighlightDom {
overlay?: Overlay;
mode: Mode;
maxZIndex?: number;
portal?: DOMElement;
taskQueue: Task[];
cache: boolean;
hash: string;
/**
* @remark 批量挂载inspector的数量。高亮多个节点时可以优化性能
*/
batchMountNum: number;
pluginManager: PluginManager;
constructor({ mode, maxZIndex, portal, hash, batchMountNum, plugins, cache, }?: UserConfig);
registerPlugin(plugin: Plugin): void;
getHash(): string;
getZIndex(): number;
interruptTask(): void;
clearOverlay(): void;
highlightNode(target: DOMElement): void;
clearOverlayCache(): void;
reset(): void;
shouldHighlight(target: EventTarget): target is DOMElement;
highlight(target: EventTarget | null, options?: Pick<UserConfig, 'mode' | 'maxZIndex' | 'hash'>): void;
}
export default HighlightDom;