@jupyterlab/terminal 4.0.0-alpha.2 → 4.0.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tokens.d.ts +18 -1
- package/lib/tokens.js +1 -2
- package/lib/tokens.js.map +1 -1
- package/lib/widget.d.ts +24 -6
- package/lib/widget.js +218 -65
- package/lib/widget.js.map +1 -1
- package/package.json +20 -18
- package/src/index.ts +9 -0
- package/src/tokens.ts +171 -0
- package/src/widget.ts +626 -0
package/src/tokens.ts
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
// Copyright (c) Jupyter Development Team.
|
|
2
|
+
// Distributed under the terms of the Modified BSD License.
|
|
3
|
+
|
|
4
|
+
import { IWidgetTracker, MainAreaWidget } from '@jupyterlab/apputils';
|
|
5
|
+
import { Terminal } from '@jupyterlab/services';
|
|
6
|
+
import { Token } from '@lumino/coreutils';
|
|
7
|
+
import { Widget } from '@lumino/widgets';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A class that tracks editor widgets.
|
|
11
|
+
*/
|
|
12
|
+
export interface ITerminalTracker
|
|
13
|
+
extends IWidgetTracker<MainAreaWidget<ITerminal.ITerminal>> {}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The editor tracker token.
|
|
17
|
+
*/
|
|
18
|
+
export const ITerminalTracker = new Token<ITerminalTracker>(
|
|
19
|
+
'@jupyterlab/terminal:ITerminalTracker'
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The namespace for terminals. Separated from the widget so it can be lazy
|
|
24
|
+
* loaded.
|
|
25
|
+
*/
|
|
26
|
+
export namespace ITerminal {
|
|
27
|
+
export interface ITerminal extends Widget {
|
|
28
|
+
/**
|
|
29
|
+
* The terminal session associated with the widget.
|
|
30
|
+
*/
|
|
31
|
+
session: Terminal.ITerminalConnection;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Get a config option for the terminal.
|
|
35
|
+
*/
|
|
36
|
+
getOption<K extends keyof IOptions>(option: K): IOptions[K];
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Set a config option for the terminal.
|
|
40
|
+
*/
|
|
41
|
+
setOption<K extends keyof IOptions>(option: K, value: IOptions[K]): void;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Refresh the terminal session.
|
|
45
|
+
*/
|
|
46
|
+
refresh(): Promise<void>;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Check if terminal has any text selected.
|
|
50
|
+
*/
|
|
51
|
+
hasSelection(): boolean;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Paste text into terminal.
|
|
55
|
+
*/
|
|
56
|
+
paste(data: string): void;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Get selected text from terminal.
|
|
60
|
+
*/
|
|
61
|
+
getSelection(): string | null;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Options for the terminal widget.
|
|
65
|
+
*/
|
|
66
|
+
export interface IOptions {
|
|
67
|
+
/**
|
|
68
|
+
* The font family used to render text.
|
|
69
|
+
*/
|
|
70
|
+
fontFamily?: string;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* The font size of the terminal in pixels.
|
|
74
|
+
*/
|
|
75
|
+
fontSize: number;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The line height used to render text.
|
|
79
|
+
*/
|
|
80
|
+
lineHeight?: number;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The theme of the terminal.
|
|
84
|
+
*/
|
|
85
|
+
theme: Theme;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The amount of buffer scrollback to be used
|
|
89
|
+
* with the terminal
|
|
90
|
+
*/
|
|
91
|
+
scrollback?: number;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Whether to shut down the session when closing a terminal or not.
|
|
95
|
+
*/
|
|
96
|
+
shutdownOnClose: boolean;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Whether to close the widget when exiting a terminal or not.
|
|
100
|
+
*/
|
|
101
|
+
closeOnExit: boolean;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Whether to blink the cursor. Can only be set at startup.
|
|
105
|
+
*/
|
|
106
|
+
cursorBlink: boolean;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* An optional command to run when the session starts.
|
|
110
|
+
*/
|
|
111
|
+
initialCommand: string;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Whether to enable screen reader support.
|
|
115
|
+
*/
|
|
116
|
+
screenReaderMode: boolean;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Whether to enable using Ctrl+V to paste.
|
|
120
|
+
*
|
|
121
|
+
* This setting has no effect on macOS, where Cmd+V is available.
|
|
122
|
+
*/
|
|
123
|
+
pasteWithCtrlV: boolean;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Whether to auto-fit the terminal to its host element size.
|
|
127
|
+
*/
|
|
128
|
+
autoFit?: boolean;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Treat option as meta key on macOS.
|
|
132
|
+
*/
|
|
133
|
+
macOptionIsMeta?: boolean;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* The default options used for creating terminals.
|
|
138
|
+
*/
|
|
139
|
+
export const defaultOptions: IOptions = {
|
|
140
|
+
theme: 'inherit',
|
|
141
|
+
fontFamily: 'Menlo, Consolas, "DejaVu Sans Mono", monospace',
|
|
142
|
+
fontSize: 13,
|
|
143
|
+
lineHeight: 1.0,
|
|
144
|
+
scrollback: 1000,
|
|
145
|
+
shutdownOnClose: false,
|
|
146
|
+
closeOnExit: true,
|
|
147
|
+
cursorBlink: true,
|
|
148
|
+
initialCommand: '',
|
|
149
|
+
screenReaderMode: false, // False by default, can cause scrollbar mouse interaction issues.
|
|
150
|
+
pasteWithCtrlV: true,
|
|
151
|
+
autoFit: true,
|
|
152
|
+
macOptionIsMeta: false
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* A type for the terminal theme.
|
|
157
|
+
*/
|
|
158
|
+
export type Theme = 'light' | 'dark' | 'inherit';
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* A type for the terminal theme.
|
|
162
|
+
*/
|
|
163
|
+
export interface IThemeObject {
|
|
164
|
+
foreground: string;
|
|
165
|
+
background: string;
|
|
166
|
+
cursor: string;
|
|
167
|
+
cursorAccent: string;
|
|
168
|
+
selectionBackground: string;
|
|
169
|
+
selectionInactiveBackground: string;
|
|
170
|
+
}
|
|
171
|
+
}
|