/** * Classes and types are provided in this class that describe key presses that can be typed in * from a terminal. These are not tied to any specific implementation of Node.js readline for * eg, or Ink. And in the future w/ Rust implementations of native keypress listeners these can * be used and extended as well. * * Please note that it is unsafe to use mutable singleton constants. This is very easy to do with * constants pointing to object literals that are exported. This is why all the getters in this * class return a new object instance. Object literals are singletons that are public and all their * properties can be modified publicly. Constructors make unique instances. More info: * https://medium.com/@mandeepkaur1/object-literal-vs-constructor-in-javascript-df143296b816 */ export declare class ModifierKey { /** Ctrl key was pressed. */ ctrl: boolean; /** Shift key was pressed. */ shift: boolean; /** [Meta key](https://en.wikipedia.org/wiki/Meta_key) was pressed. */ meta: boolean; } export declare class SpecialKey { /** Up arrow key was pressed. */ upArrow: boolean; /** Down arrow key was pressed. */ downArrow: boolean; /** Left arrow key was pressed. */ leftArrow: boolean; /** Right arrow key was pressed. */ rightArrow: boolean; /** Page Down key was pressed. */ pageDown: boolean; /** Page Up key was pressed. */ pageUp: boolean; /** Return (Enter) key was pressed. */ return: boolean; /** Escape key was pressed. */ escape: boolean; /** Ctrl key was pressed. */ tab: boolean; /** Backspace key was pressed. */ backspace: boolean; /** Delete key was pressed. */ delete: boolean; /** Space key was pressed. */ space: boolean; /** Home key was pressed. */ home: boolean; /** End key was pressed. */ end: boolean; } /** * https://www.nadershamma.dev/blog/2019/how-to-access-object-properties-dynamically-using-bracket-notation-in-typescript/ * https://www.typescriptlang.org/docs/handbook/advanced-types.html#index-types */ export declare const specialKeysPropertyNames: Array; export declare const modifierKeysPropertyNames: Array; /** Data class that holds information about modifiery and special key. */ export declare class KeyData implements ModifierKey, SpecialKey { space: boolean; backspace: boolean; ctrl: boolean; delete: boolean; downArrow: boolean; escape: boolean; leftArrow: boolean; meta: boolean; pageDown: boolean; pageUp: boolean; return: boolean; rightArrow: boolean; shift: boolean; tab: boolean; upArrow: boolean; home: boolean; end: boolean; constructor(key?: SpecialKey & ModifierKey); } /** * All the getters return a new instance of SpecialKey & ModifierKey which is mutable, and meant * to be modified. */ export declare class KeyCreator { static get emptyKey(): SpecialKey & ModifierKey; static get homeKey(): SpecialKey & ModifierKey; static get endKey(): SpecialKey & ModifierKey; static get upKey(): SpecialKey & ModifierKey; static get downKey(): SpecialKey & ModifierKey; static get leftKey(): SpecialKey & ModifierKey; static get rightKey(): SpecialKey & ModifierKey; static get pageUpKey(): SpecialKey & ModifierKey; static get pageDownKey(): SpecialKey & ModifierKey; static get escapeKey(): SpecialKey & ModifierKey; static get returnKey(): SpecialKey & ModifierKey; static get tabKey(): SpecialKey & ModifierKey; static get backspaceKey(): SpecialKey & ModifierKey; static get spaceKey(): SpecialKey & ModifierKey; static get deleteKey(): SpecialKey & ModifierKey; static get ctrlKey(): SpecialKey & ModifierKey; static get metaKey(): SpecialKey & ModifierKey; static get shiftKey(): SpecialKey & ModifierKey; } export declare const isKeyType: (param: any) => param is SpecialKey & ModifierKey;