UNPKG

916 BTypeScriptView Raw
1declare type Context = 'pointer' | 'keyboard';
2/**
3 * Read the next key definition from user input
4 *
5 * Describe key per `{descriptor}` or `[descriptor]`.
6 * Everything else will be interpreted as a single character as descriptor - e.g. `a`.
7 * Brackets `{` and `[` can be escaped by doubling - e.g. `foo[[bar` translates to `foo[bar`.
8 * A previously pressed key can be released per `{/descriptor}`.
9 * Keeping the key pressed can be written as `{descriptor>}`.
10 * When keeping the key pressed you can choose how long the key is pressed `{descriptor>3}`.
11 * You can then release the key per `{descriptor>3/}` or keep it pressed and continue with the next key.
12 */
13export declare function readNextDescriptor(text: string, context: Context): {
14 consumedLength: number;
15 descriptor: string;
16 releasePrevious: boolean;
17 repeat: number;
18 releaseSelf: boolean | undefined;
19 type: string;
20};
21export {};