import type { BrowserUserContext } from './browser.js'; import type { BrowsingContextBrowsingContext } from './browsing_context.js'; import type { EmptyResult, JsInt, JsUint } from './common.js'; import type { ScriptSharedReference } from './script.js'; export type InputCommand = InputPerformActions | InputReleaseActions | InputSetFiles; export type InputResult = InputPerformActionsResult | InputReleaseActionsResult | InputSetFilesResult; export type InputEvent = InputFileDialogOpened; export interface InputElementOrigin { type: "element"; element: ScriptSharedReference; } export interface InputPerformActions { method: "input.performActions"; params: InputPerformActionsParameters; } export interface InputPerformActionsParameters { context: BrowsingContextBrowsingContext; actions: InputSourceActions[]; } export type InputSourceActions = InputNoneSourceActions | InputKeySourceActions | InputPointerSourceActions | InputWheelSourceActions; export interface InputNoneSourceActions { type: "none"; id: string; actions: InputNoneSourceAction[]; } export type InputNoneSourceAction = InputPauseAction; export interface InputKeySourceActions { type: "key"; id: string; actions: InputKeySourceAction[]; } export type InputKeySourceAction = InputPauseAction | InputKeyDownAction | InputKeyUpAction; export interface InputPointerSourceActions { type: "pointer"; id: string; parameters?: InputPointerParameters; actions: InputPointerSourceAction[]; } export type InputPointerType = "mouse" | "pen" | "touch"; export interface InputPointerParameters { /** * @default 'mouse' */ pointerType?: InputPointerType; } export type InputPointerSourceAction = InputPauseAction | InputPointerDownAction | InputPointerUpAction | InputPointerMoveAction; export interface InputWheelSourceActions { type: "wheel"; id: string; actions: InputWheelSourceAction[]; } export type InputWheelSourceAction = InputPauseAction | InputWheelScrollAction; export interface InputPauseAction { type: "pause"; duration?: JsUint; } export interface InputKeyDownAction { type: "keyDown"; value: string; } export interface InputKeyUpAction { type: "keyUp"; value: string; } export interface InputPointerUpAction { type: "pointerUp"; button: JsUint; } export type InputPointerDownAction = InputPointerCommonProperties & { type: "pointerDown"; button: JsUint; }; export type InputPointerMoveAction = InputPointerCommonProperties & { type: "pointerMove"; x: number; y: number; duration?: JsUint; origin?: InputOrigin; }; export interface InputWheelScrollAction { type: "scroll"; x: JsInt; y: JsInt; deltaX: JsInt; deltaY: JsInt; duration?: JsUint; /** * @default 'viewport' */ origin?: InputOrigin; } export interface InputPointerCommonProperties { width?: JsUint; height?: JsUint; pressure?: number; tangentialPressure?: number; /** * 0 .. Math.PI / 2 */ twist?: number; /** * 0 .. 2 * Math.PI */ altitudeAngle?: number; azimuthAngle?: number; } export type InputOrigin = "viewport" | "pointer" | InputElementOrigin; export type InputPerformActionsResult = EmptyResult; export interface InputReleaseActions { method: "input.releaseActions"; params: InputReleaseActionsParameters; } export interface InputReleaseActionsParameters { context: BrowsingContextBrowsingContext; } export type InputReleaseActionsResult = EmptyResult; export interface InputSetFiles { method: "input.setFiles"; params: InputSetFilesParameters; } export interface InputSetFilesParameters { context: BrowsingContextBrowsingContext; element: ScriptSharedReference; files: string[]; } export type InputSetFilesResult = EmptyResult; export interface InputFileDialogOpened { method: "input.fileDialogOpened"; params: InputFileDialogInfo; } export interface InputFileDialogInfo { context: BrowsingContextBrowsingContext; userContext?: BrowserUserContext; element?: ScriptSharedReference; multiple: boolean; } /** @deprecated Use {@link Input.create} instead — will be removed in a future major version. */ export declare function getInputInstance(driver: unknown): Promise; export declare class Input { private readonly bidi; private constructor(); static create(driver: unknown): Promise; performActions(params: InputPerformActionsParameters): Promise; releaseActions(params: InputReleaseActionsParameters): Promise; setFiles(params: InputSetFilesParameters): Promise; onFileDialogOpened(callback: (params: InputFileDialogInfo) => void): Promise; /** @deprecated Use {@link performActions} instead — will be removed in a future major version. */ perform(browsingContextId: string, actions: InputSourceActions[]): Promise; /** @deprecated Use {@link releaseActions} instead — will be removed in a future major version. */ release(browsingContextId: string): Promise; }