Files
terminal-lab/xterminal/source/input/interface.ts
douboer@gmail.com 3b7c1d558a first commit
2026-03-03 13:23:14 +08:00

48 lines
906 B
TypeScript

import type { IDisposable, IKeyPress } from "../types";
import type { IOutputInterface } from "../output/interface";
/**
* Interface: Input Component
*/
export interface IInputInterface extends IDisposable {
/**
* Blur the input element
*/
blur(): void;
/**
* Focus the input element
*/
focus(): void;
/**
* Deactivate the component
*/
pause(): void;
/**
* Activate the component
*/
resume(): void;
/**
* Callback function invoked on every key press
*/
onkeypress?: (ev: IKeyPress) => void;
/**
* Bridge the input to the output component: cursor & input
*/
pipe(output: IOutputInterface): void;
/**
* Set the value of the input element, updates the cursor
*/
setValue(str: string): void;
/**
* Clears the value of the input element
*/
clear(): void;
}