This repository has been archived by the owner on Mar 24, 2022. It is now read-only.
forked from snowak-cb/react-console
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.d.ts
99 lines (99 loc) · 2.73 KB
/
main.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import * as React from 'react';
import './react-console.scss';
export interface LogMessage {
type?: string;
value: any[];
}
export interface LogEntry {
label: string;
command: string;
message: LogMessage[];
}
export interface ConsoleProps {
handler(command: string): any;
cancel?(): any;
complete?(words: string[], curr: number, promptText: string): string[];
continue?(promptText: string): boolean;
autofocus?: boolean;
promptLabel?: string | (() => string);
welcomeMessage?: string;
}
export declare enum ConsoleCommand {
Default = 0,
Kill = 1,
Yank = 2,
}
export interface ConsoleState {
focus?: boolean;
acceptInput?: boolean;
typer?: string;
column?: number;
currLabel?: string;
promptText?: string;
restoreText?: string;
log?: LogEntry[];
history?: string[];
historyn?: number;
kill?: string[];
killn?: number;
lastCommand?: ConsoleCommand;
}
export default class extends React.Component<ConsoleProps, ConsoleState> {
constructor(props: ConsoleProps);
static defaultProps: {
promptLabel: string;
continue: () => boolean;
cancel: () => void;
};
child: {
typer?: HTMLTextAreaElement;
container?: HTMLElement;
focus?: HTMLElement;
};
log: (...messages: any[]) => void;
logX: (type: string, ...messages: any[]) => void;
return: () => void;
componentDidMount(): void;
focus: () => void;
blur: () => void;
keyDown: (e: KeyboardEvent) => void;
change: () => void;
paste: (e: ClipboardEvent) => void;
beginningOfLine: () => void;
endOfLine: () => void;
forwardChar: () => void;
backwardChar: () => void;
forwardWord: () => void;
backwardWord: () => void;
acceptLine: () => void;
previousHistory: () => void;
nextHistory: () => void;
deleteChar: () => void;
backwardDeleteChar: () => void;
killLine: () => void;
backwardKillLine: () => void;
killWholeLine: () => void;
killWord: () => void;
backwardKillWord: () => void;
yank: () => void;
yankPop: () => void;
complete: () => void;
cancelCommand: () => void;
consoleInsert: (text: string, replace?: number) => {
column: number;
promptText: string;
restoreText: string;
lastCommand: ConsoleCommand;
};
moveColumn: (n: number, max?: number) => number;
nextWord(): number;
previousWord(): number;
rotateRing: (n: number, ringn: number, ring: number) => number;
rotateHistory: (n: number) => void;
scrollSemaphore: number;
scrollIfBottom: () => () => void;
scrollIfBottomTrue: () => void;
scrollToBottom: () => void;
nextLabel: () => string;
render(): JSX.Element;
}