UNPKG

donobu

Version:

Create browser automations with an LLM agent and replay them as Playwright scripts.

60 lines 2.65 kB
import type { Locator, Page } from 'playwright'; export declare class InteractionVisualizer { readonly defaultMessageDurationMillis: number; private static readonly RAW_MOUSE_D; private static readonly TIP_X; private static readonly TIP_Y; private static readonly SVG_MOUSE; private static readonly SVG_MOUSE_JSON; private static readonly CSS; private static readonly CONTAINER_ID; private cursorPos; constructor(defaultMessageDurationMillis: number); /** * Moves the virtual cursor to the center of the specified element and optionally displays a message. * * @param page - The Playwright page instance where the cursor will be displayed. * @param locator - Optional target element to point at. If omitted, cursor remains at current position. * @param message - Optional message to display near the cursor during the interaction. * @param duration - Duration in milliseconds for the cursor animation and message display. * Defaults to the instance's configured duration. If ≤ 0, no action is taken * * @returns Promise that resolves when the cursor movement and message display are complete * * @remarks * - The target element will be scrolled into view if necessary * - The cursor animates smoothly to the element's center point * - Messages are positioned automatically to avoid viewport edges * - The virtual cursor does not interfere with actual page interactions */ pointAt(page: Page, locator?: Pick<Locator, 'boundingBox'>, message?: string, duration?: number): Promise<void>; /** * Shows the virtual mouse cursor on the page. * * @param page - The Playwright page instance where the cursor will be displayed. * * @returns Promise that resolves when the cursor is shown. * * @remarks * - If the cursor doesn't exist yet, it will be created. * - The cursor will be made visible with a smooth opacity transition. */ showMouse(page: Page): Promise<void>; /** * Hides the virtual mouse cursor on the page. * * @param page - The Playwright page instance where the cursor is displayed. * * @returns Promise that resolves when the cursor is hidden * * @remarks * - The cursor will be hidden with a smooth opacity transition * - The cursor element remains in the DOM but becomes invisible */ hideMouse(page: Page): Promise<void>; private ensureContainer; private ensureCursor; private moveCursor; private showMessage; } //# sourceMappingURL=InteractionVisualizer.d.ts.map