import type { Module } from "@term-ui/core"; import type { ReadStream } from "@term-ui/shared/types"; import { ByteArrayList } from "./ByteArrayList"; import type { Tree } from "./Tree"; export type KeyEvent = { kind: "key"; key?: KeyName; codepoint: number; baseCodepoint: number; action: "press" | "repeat" | "release"; rawAction: number; rawModifiers: number; source: Uint32Array; text: string; shift: boolean; ctrl: boolean; alt: boolean; super: boolean; hyper: boolean; meta: boolean; capsLock: boolean; numLock: boolean; }; export type NormalMouseAction = "left_press" | "middle_press" | "right_press" | "release" | "wheel_forward" | "wheel_back" | "wheel_tilt_left" | "wheel_tilt_right"; export type ExtendedMouseButton = "left" | "middle" | "right" | "wheel" | "button8" | "button9" | "button10" | "button11" | "none"; export type ExtendedMouseAction = "press" | "release" | "motion" | "wheel_up" | "wheel_down" | "wheel_left" | "wheel_right"; export type NormalMouseEvent = { kind: "mouse-legacy"; action: NormalMouseAction; x: number; y: number; rawModifiers: number; shift: boolean; ctrl: boolean; alt: boolean; super: boolean; hyper: boolean; meta: boolean; capsLock: boolean; numLock: boolean; }; export type ExtendedMouseEvent = { kind: "mouse"; button: ExtendedMouseButton; action: ExtendedMouseAction; x: number; y: number; rawModifiers: number; shift: boolean; ctrl: boolean; alt: boolean; super: boolean; hyper: boolean; meta: boolean; capsLock: boolean; numLock: boolean; }; export type MouseEvent = NormalMouseEvent | ExtendedMouseEvent; export type CursorReportEvent = { kind: "cursor_report"; row: number; col: number; }; declare const keyNameMap: { readonly 97: "a"; readonly 98: "b"; readonly 99: "c"; readonly 100: "d"; readonly 101: "e"; readonly 102: "f"; readonly 103: "g"; readonly 104: "h"; readonly 105: "i"; readonly 106: "j"; readonly 107: "k"; readonly 108: "l"; readonly 109: "m"; readonly 110: "n"; readonly 111: "o"; readonly 112: "p"; readonly 113: "q"; readonly 114: "r"; readonly 115: "s"; readonly 116: "t"; readonly 117: "u"; readonly 118: "v"; readonly 119: "w"; readonly 120: "x"; readonly 121: "y"; readonly 122: "z"; readonly 48: "0"; readonly 49: "1"; readonly 50: "2"; readonly 51: "3"; readonly 52: "4"; readonly 53: "5"; readonly 54: "6"; readonly 55: "7"; readonly 56: "8"; readonly 57: "9"; readonly 59: "semicolon"; readonly 44: "comma"; readonly 46: "period"; readonly 47: "slash"; readonly 45: "minus"; readonly 43: "plus"; readonly 61: "equal"; readonly 91: "left_bracket"; readonly 93: "right_bracket"; readonly 92: "backslash"; readonly 96: "grave_accent"; readonly 39: "apostrophe"; readonly 57344: "escape"; readonly 57345: "enter"; readonly 57346: "tab"; readonly 57347: "backspace"; readonly 57348: "insert"; readonly 57349: "delete"; readonly 57350: "left"; readonly 57351: "right"; readonly 57352: "up"; readonly 57353: "down"; readonly 57354: "page_up"; readonly 57355: "page_down"; readonly 57356: "home"; readonly 57357: "end"; readonly 57358: "caps_lock"; readonly 57359: "scroll_lock"; readonly 57360: "num_lock"; readonly 57361: "print_screen"; readonly 57362: "pause"; readonly 57364: "f1"; readonly 57365: "f2"; readonly 57366: "f3"; readonly 57367: "f4"; readonly 57368: "f5"; readonly 57369: "f6"; readonly 57370: "f7"; readonly 57371: "f8"; readonly 57372: "f9"; readonly 57373: "f10"; readonly 57374: "f11"; readonly 57375: "f12"; readonly 57376: "f13"; readonly 57377: "f14"; readonly 57378: "f15"; readonly 57379: "f16"; readonly 57380: "f17"; readonly 57381: "f18"; readonly 57382: "f19"; readonly 57383: "f20"; readonly 57384: "f21"; readonly 57385: "f22"; readonly 57386: "f23"; readonly 57387: "f24"; readonly 57388: "f25"; readonly 57399: "kp_0"; readonly 57400: "kp_1"; readonly 57401: "kp_2"; readonly 57402: "kp_3"; readonly 57403: "kp_4"; readonly 57404: "kp_5"; readonly 57405: "kp_6"; readonly 57406: "kp_7"; readonly 57407: "kp_8"; readonly 57408: "kp_9"; readonly 57409: "kp_decimal"; readonly 57410: "kp_divide"; readonly 57411: "kp_multiply"; readonly 57412: "kp_subtract"; readonly 57413: "kp_add"; readonly 57414: "kp_enter"; readonly 57415: "kp_equal"; readonly 57416: "kp_separator"; readonly 57417: "kp_left"; readonly 57418: "kp_right"; readonly 57419: "kp_up"; readonly 57420: "kp_down"; readonly 57421: "kp_page_up"; readonly 57422: "kp_page_down"; readonly 57423: "kp_home"; readonly 57424: "kp_end"; readonly 57425: "kp_insert"; readonly 57426: "kp_delete"; readonly 57427: "kp_begin"; readonly 57441: "left_shift"; readonly 57442: "left_control"; readonly 57443: "left_alt"; readonly 57444: "left_super"; readonly 57447: "right_shift"; readonly 57448: "right_control"; readonly 57449: "right_alt"; readonly 57450: "right_super"; readonly 57363: "space"; }; export type KeyName = typeof keyNameMap extends Record ? K : never; export type PasteEvent = { kind: "paste"; text: string; }; export type InputEvent = KeyEvent | PasteEvent | ExtendedMouseEvent | NormalMouseEvent | CursorReportEvent; export declare const isPrintable: (input: string) => boolean; export declare class InputManager { module: Module; stdin: ReadStream; tree: Tree; buffer: ByteArrayList; consumed: number; scheduled: NodeJS.Timeout | null; pasteBuffers: Uint8Array; listeners: Set<(event: InputEvent) => void>; isDisposed: boolean; private _unsubscribe; constructor(module: Module, stdin: ReadStream, tree: Tree); static init: (module: Module, stdin: ReadStream, tree: Tree) => InputManager; private onData; dispose(): void; [Symbol.dispose](): void; private emitEvent; private emitOrBufferPasteEvent; subscribe(cb: (event: InputEvent) => void): () => void; clearConsumed(): void; consumeEvents: (force?: boolean) => number; } export {}; //# sourceMappingURL=InputManager.d.ts.map