luna-dom-highlighter
Version:
Highlighter for html elements
46 lines (45 loc) • 1.35 kB
TypeScript
import Component, { IComponentOptions } from '../share/Component';
import 'path2d-polyfill';
export interface IRgb {
r: number;
g: number;
b: number;
a?: number;
}
export interface IOptions extends IComponentOptions {
showRulers?: boolean;
showExtensionLines?: boolean;
showInfo?: boolean;
showStyles?: boolean;
showAccessibilityInfo?: boolean;
colorFormat?: 'rgb' | 'hsl' | 'hex';
contentColor?: string | IRgb;
paddingColor?: string | IRgb;
borderColor?: string | IRgb;
marginColor?: string | IRgb;
monitorResize?: boolean | IRgb;
}
export default class DomHighlighter extends Component<IOptions> {
private overlay;
private target;
private resizeSensor;
private redraw;
private interceptor;
constructor(container: HTMLElement, options?: IOptions);
highlight(target: HTMLElement | Text, options?: IOptions): void;
hide(): void;
intercept(interceptor: (...args: any[]) => any | null): void;
destroy(): void;
private draw;
private drawText;
private drawElement;
private getPaths;
private getElementInfo;
private getStyles;
private getAccessibilityInfo;
private isFocusable;
private getAccessibleNameAndRole;
private bindEvent;
private reset;
private rectToPath;
}