@difizen/libro-terminal 0.1.10 → 0.1.12
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/es/command.d.ts +18 -0
- package/es/command.d.ts.map +1 -0
- package/es/command.js +117 -0
- package/es/configuration.d.ts +28 -26
- package/es/configuration.d.ts.map +1 -1
- package/es/configuration.js +30 -14
- package/es/connection.js +4 -4
- package/es/index.d.ts +1 -0
- package/es/index.d.ts.map +1 -1
- package/es/index.js +1 -0
- package/es/manager.d.ts +1 -0
- package/es/manager.d.ts.map +1 -1
- package/es/manager.js +16 -7
- package/es/module.d.ts.map +1 -1
- package/es/module.js +2 -1
- package/es/restapi.js +2 -2
- package/es/stateful-view.js +2 -2
- package/es/theme-service.js +2 -2
- package/es/view.d.ts +3 -3
- package/es/view.d.ts.map +1 -1
- package/es/view.js +32 -20
- package/package.json +11 -9
- package/src/command.ts +60 -0
- package/src/configuration.ts +58 -39
- package/src/index.ts +1 -0
- package/src/manager.ts +4 -0
- package/src/module.ts +2 -0
- package/src/view.tsx +39 -24
package/src/view.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CodeOutlined } from '@ant-design/icons';
|
|
2
|
+
import { ConfigurationService } from '@difizen/mana-app';
|
|
2
3
|
import {
|
|
3
4
|
Disposable,
|
|
4
5
|
DisposableCollection,
|
|
@@ -14,7 +15,7 @@ import {
|
|
|
14
15
|
view,
|
|
15
16
|
} from '@difizen/mana-app';
|
|
16
17
|
import { forwardRef } from 'react';
|
|
17
|
-
import type { ITerminalOptions } from 'xterm';
|
|
18
|
+
import type { FontWeight, ITerminalOptions } from 'xterm';
|
|
18
19
|
import { Terminal } from 'xterm';
|
|
19
20
|
import { CanvasAddon } from 'xterm-addon-canvas';
|
|
20
21
|
import { FitAddon } from 'xterm-addon-fit';
|
|
@@ -22,9 +23,26 @@ import { WebLinksAddon } from 'xterm-addon-web-links';
|
|
|
22
23
|
import { WebglAddon } from 'xterm-addon-webgl';
|
|
23
24
|
|
|
24
25
|
import type { CursorStyle, TerminalRendererType } from './configuration.js';
|
|
26
|
+
import { terminalIntegratedCursorStyle } from './configuration.js';
|
|
27
|
+
import { terminalIntegratedCopyOnSelection } from './configuration.js';
|
|
28
|
+
import { terminalEnablePaste } from './configuration.js';
|
|
29
|
+
import { terminalEnableCopy } from './configuration.js';
|
|
30
|
+
import { terminalIntegratedRendererType } from './configuration.js';
|
|
31
|
+
import { terminalIntegratedFastScrollSensitivity } from './configuration.js';
|
|
32
|
+
import { terminalIntegratedScrollback } from './configuration.js';
|
|
33
|
+
import { terminalIntegratedLineHeight } from './configuration.js';
|
|
34
|
+
import { terminalIntegratedLetterSpacing } from './configuration.js';
|
|
35
|
+
import { terminalIntegratedDrawBoldTextInBrightColors } from './configuration.js';
|
|
36
|
+
import {
|
|
37
|
+
terminalIntegratedCursorBlinking,
|
|
38
|
+
terminalIntegratedCursorWidth,
|
|
39
|
+
terminalIntegratedFontFamily,
|
|
40
|
+
terminalIntegratedFontSize,
|
|
41
|
+
terminalIntegratedFontWeight,
|
|
42
|
+
terminalIntegratedFontWeightBold,
|
|
43
|
+
} from './configuration.js';
|
|
25
44
|
import {
|
|
26
45
|
DEFAULT_TERMINAL_RENDERER_TYPE,
|
|
27
|
-
TerminalConfiguration,
|
|
28
46
|
isTerminalRendererType,
|
|
29
47
|
} from './configuration.js';
|
|
30
48
|
import type { TerminalConnection } from './connection.js';
|
|
@@ -59,7 +77,7 @@ export class LibroTerminalView extends BaseStatefulView {
|
|
|
59
77
|
protected termOpened = false;
|
|
60
78
|
protected initialData = '';
|
|
61
79
|
protected fitAddon: FitAddon;
|
|
62
|
-
protected readonly config:
|
|
80
|
+
protected readonly config: ConfigurationService;
|
|
63
81
|
protected readonly themeService: TerminalThemeService;
|
|
64
82
|
protected readonly terminalManager: TerminalManager;
|
|
65
83
|
|
|
@@ -96,7 +114,7 @@ export class LibroTerminalView extends BaseStatefulView {
|
|
|
96
114
|
|
|
97
115
|
constructor(
|
|
98
116
|
@inject(ViewOption) options: TerminalViewOption, // 这里是 server需要的配置
|
|
99
|
-
@inject(
|
|
117
|
+
@inject(ConfigurationService) config: ConfigurationService,
|
|
100
118
|
@inject(TerminalThemeService) themeService: TerminalThemeService,
|
|
101
119
|
@inject(TerminalManager) terminalManager: TerminalManager,
|
|
102
120
|
) {
|
|
@@ -312,24 +330,21 @@ export class LibroTerminalView extends BaseStatefulView {
|
|
|
312
330
|
|
|
313
331
|
protected createTerm = () => {
|
|
314
332
|
const options = {
|
|
315
|
-
cursorBlink:
|
|
333
|
+
cursorBlink: terminalIntegratedCursorBlinking.defaultValue,
|
|
316
334
|
cursorStyle: this.getCursorStyle(),
|
|
317
|
-
cursorWidth:
|
|
318
|
-
fontFamily:
|
|
319
|
-
fontSize:
|
|
320
|
-
fontWeight:
|
|
321
|
-
fontWeightBold:
|
|
322
|
-
drawBoldTextInBrightColors:
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
fastScrollSensitivity: this.config.get(
|
|
329
|
-
'terminal.integrated.fastScrollSensitivity',
|
|
330
|
-
),
|
|
335
|
+
cursorWidth: terminalIntegratedCursorWidth.defaultValue,
|
|
336
|
+
fontFamily: terminalIntegratedFontFamily.defaultValue,
|
|
337
|
+
fontSize: terminalIntegratedFontSize.defaultValue,
|
|
338
|
+
fontWeight: terminalIntegratedFontWeight.defaultValue as FontWeight,
|
|
339
|
+
fontWeightBold: terminalIntegratedFontWeightBold.defaultValue as FontWeight,
|
|
340
|
+
drawBoldTextInBrightColors:
|
|
341
|
+
terminalIntegratedDrawBoldTextInBrightColors.defaultValue,
|
|
342
|
+
letterSpacing: terminalIntegratedLetterSpacing.defaultValue,
|
|
343
|
+
lineHeight: terminalIntegratedLineHeight.defaultValue,
|
|
344
|
+
scrollback: terminalIntegratedScrollback.defaultValue,
|
|
345
|
+
fastScrollSensitivity: terminalIntegratedFastScrollSensitivity.defaultValue,
|
|
331
346
|
rendererType: this.getTerminalRendererType(
|
|
332
|
-
|
|
347
|
+
terminalIntegratedRendererType.defaultValue,
|
|
333
348
|
),
|
|
334
349
|
theme: this.themeService.getTheme(),
|
|
335
350
|
};
|
|
@@ -340,15 +355,15 @@ export class LibroTerminalView extends BaseStatefulView {
|
|
|
340
355
|
};
|
|
341
356
|
|
|
342
357
|
protected get enableCopy(): boolean {
|
|
343
|
-
return
|
|
358
|
+
return terminalEnableCopy.defaultValue;
|
|
344
359
|
}
|
|
345
360
|
|
|
346
361
|
protected get enablePaste(): boolean {
|
|
347
|
-
return
|
|
362
|
+
return terminalEnablePaste.defaultValue;
|
|
348
363
|
}
|
|
349
364
|
|
|
350
365
|
protected get copyOnSelection(): boolean {
|
|
351
|
-
return
|
|
366
|
+
return terminalIntegratedCopyOnSelection.defaultValue;
|
|
352
367
|
}
|
|
353
368
|
|
|
354
369
|
protected customKeyHandler = (event: KeyboardEvent): boolean => {
|
|
@@ -372,7 +387,7 @@ export class LibroTerminalView extends BaseStatefulView {
|
|
|
372
387
|
* @returns CursorStyle
|
|
373
388
|
*/
|
|
374
389
|
protected getCursorStyle = (): CursorStyle => {
|
|
375
|
-
const value =
|
|
390
|
+
const value = terminalIntegratedCursorStyle.defaultValue as CursorStyle | 'line';
|
|
376
391
|
return value === 'line' ? 'bar' : value;
|
|
377
392
|
};
|
|
378
393
|
/**
|