File
Blob: src/client/terminal/types.ts
| 1 | /** |
| 2 | * Terminal adapter interface. |
| 3 | * |
| 4 | * Abstracts the concrete terminal renderer (ghostty-web) so it can be |
| 5 | * swapped for another xterm.js-compatible library with minimal changes. |
| 6 | */ |
| 7 | export interface ITerminalAdapter { |
| 8 | /** Mount the terminal into a DOM container. */ |
| 9 | mount(container: HTMLElement): void; |
| 10 | |
| 11 | /** Write data (bytes or string) to the terminal display. */ |
| 12 | write(data: string | Uint8Array): void; |
| 13 | |
| 14 | /** Register a callback for user keyboard input. */ |
| 15 | onInput(callback: (data: string) => void): void; |
| 16 | |
| 17 | /** Register a callback for terminal resize events (triggered by fit). */ |
| 18 | onResize(callback: (cols: number, rows: number) => void): void; |
| 19 | |
| 20 | /** Recompute dimensions to fill the container. */ |
| 21 | fit(): void; |
| 22 | |
| 23 | /** Reset terminal state (screen, cursor, scrollback). */ |
| 24 | reset(): void; |
| 25 | |
| 26 | /** Focus the terminal element. */ |
| 27 | focus(): void; |
| 28 | |
| 29 | /** Current column count. */ |
| 30 | readonly cols: number; |
| 31 | |
| 32 | /** Current row count. */ |
| 33 | readonly rows: number; |
| 34 | |
| 35 | /** Tear down the terminal and release all resources. */ |
| 36 | dispose(): void; |
| 37 | } |