import type { DomMeta, HookMap, HighlighterOptions, FromRangeOptions, DiagnosticSnapshot, DiagnosticOptions } from './types'; import EventEmitter from './util/event.emitter'; import HighlightSource from './model/source'; import Cache from './data/cache'; import Painter from './painter'; import { EventType, CreateFrom } from './types'; interface EventHandlerMap { [key: string]: (...args: any[]) => void; [EventType.CLICK]: (data: { id: string; }, h: Highlighter, e: MouseEvent | TouchEvent) => void; [EventType.HOVER]: (data: { id: string; }, h: Highlighter, e: MouseEvent | TouchEvent) => void; [EventType.HOVER_OUT]: (data: { id: string; }, h: Highlighter, e: MouseEvent | TouchEvent) => void; [EventType.CREATE]: (data: { sources: HighlightSource[]; type: CreateFrom; }, h: Highlighter) => void; [EventType.REMOVE]: (data: { ids: string[]; }, h: Highlighter) => void; } export default class Highlighter extends EventEmitter { static event: typeof EventType; static isHighlightWrapNode: ($node: HTMLElement) => boolean; hooks: HookMap; painter: Painter; cache: Cache; private _hoverId; private _isRunning; private _isDisposed; private readonly _diagnosticErrors; private options; private readonly event; constructor(options?: HighlighterOptions); static isHighlightSource: (d: any) => boolean; run: () => void; stop: () => void; addClass: (className: string, id?: string) => void; removeClass: (className: string, id?: string) => void; getIdByDom: ($node: HTMLElement) => string; getExtraIdByDom: ($node: HTMLElement) => string[]; getDoms: (id?: string) => HTMLElement[]; getSourceByDom: ($node: HTMLElement) => HighlightSource; /** * Capture a reproducible runtime snapshot for a bug report. * Default mode is safe: it excludes root HTML and HighlightSource text. * Pass `{dom: 'redacted'}` for a text-free structure, or explicitly opt in * to `{dom: 'full', sources: 'full'}` only after reviewing sensitive data. */ getDiagnostics: (options?: DiagnosticOptions) => DiagnosticSnapshot; dispose: () => void; setOption: (options?: HighlighterOptions) => void; fromRange: (range: Range, options?: FromRangeOptions) => HighlightSource; fromStore: (start: DomMeta, end: DomMeta, text: string, id: string, extra?: unknown) => HighlightSource; remove(id: string): void; removeAll(): void; private readonly _redactHtml; private readonly _getHooks; private readonly _highlightFromHRange; private _highlightFromHSource; private readonly _handleSelection; private readonly _handleHighlightHover; private readonly _handleError; private readonly _handleHighlightClick; } export {};