@difizen/libro-terminal 0.1.10 → 0.1.11

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/view.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../src/view.tsx"],"names":[],"mappings":";AACA,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,OAAO,EAUR,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAI3C,OAAO,KAAK,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAEL,qBAAqB,EAEtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1D,eAAO,MAAM,iBAAiB,0FAc5B,CAAC;AAEH,qBAEa,iBAAkB,SAAQ,gBAAgB;IACrD,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC;IAChB,IAAI,2FAAqB;IAClC,SAAS,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACtC,SAAS,CAAC,UAAU,UAAS;IAC7B,SAAS,CAAC,WAAW,SAAM;IAC3B,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC7B,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,qB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gC;IAC1D,SAAgB,aAAa,4CAAmC;IAChE;;OAEG;IACH,IAAW,IAAI,WAEd;IAEM,OAAO,6CAA6B;IAE3C;;OAEG;IACI,YAAY,IAAI,OAAO;IAO9B;;OAEG;IACI,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAMhC;;OAEG;IACI,YAAY,IAAI,MAAM,GAAG,IAAI;IAO7B,YAAY,QAAO,IAAI,CAE5B;IAEK,cAAc,QAAO,IAAI,CAE9B;IAEK,WAAW,QAAO,IAAI,CAE3B;IAEK,cAAc,QAAO,IAAI,CAE9B;IAEK,YAAY,QAAO,IAAI,CAE5B;IAEK,cAAc,QAAO,IAAI,CAE9B;IAEK,aAAa,QAAO,IAAI,CAE7B;IAEK,SAAS,SAAU,MAAM,KAAG,IAAI,CAErC;IAEK,KAAK,SAAU,MAAM,GAAG,UAAU,KAAG,IAAI,CAE9C;CACH"}
package/es/view.js CHANGED
@@ -15,8 +15,8 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
15
15
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16
16
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
17
17
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
18
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
19
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
18
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
19
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
20
20
  function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
21
21
  function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
22
22
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
@@ -27,6 +27,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
27
27
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
28
28
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
29
29
  import { CodeOutlined } from '@ant-design/icons';
30
+ import { ConfigurationService } from '@difizen/mana-app';
30
31
  import { Disposable, DisposableCollection, Emitter, KeyCode, ViewInstance, ViewOption, inject, isFirefox, isOSX, transient, useInject, view } from '@difizen/mana-app';
31
32
  import { forwardRef } from 'react';
32
33
  import { Terminal } from 'xterm';
@@ -34,7 +35,18 @@ import { CanvasAddon } from 'xterm-addon-canvas';
34
35
  import { FitAddon } from 'xterm-addon-fit';
35
36
  import { WebLinksAddon } from 'xterm-addon-web-links';
36
37
  import { WebglAddon } from 'xterm-addon-webgl';
37
- import { DEFAULT_TERMINAL_RENDERER_TYPE, TerminalConfiguration, isTerminalRendererType } from "./configuration.js";
38
+ import { terminalIntegratedCursorStyle } from "./configuration.js";
39
+ import { terminalIntegratedCopyOnSelection } from "./configuration.js";
40
+ import { terminalEnablePaste } from "./configuration.js";
41
+ import { terminalEnableCopy } from "./configuration.js";
42
+ import { terminalIntegratedRendererType } from "./configuration.js";
43
+ import { terminalIntegratedFastScrollSensitivity } from "./configuration.js";
44
+ import { terminalIntegratedScrollback } from "./configuration.js";
45
+ import { terminalIntegratedLineHeight } from "./configuration.js";
46
+ import { terminalIntegratedLetterSpacing } from "./configuration.js";
47
+ import { terminalIntegratedDrawBoldTextInBrightColors } from "./configuration.js";
48
+ import { terminalIntegratedCursorBlinking, terminalIntegratedCursorWidth, terminalIntegratedFontFamily, terminalIntegratedFontSize, terminalIntegratedFontWeight, terminalIntegratedFontWeightBold } from "./configuration.js";
49
+ import { DEFAULT_TERMINAL_RENDERER_TYPE, isTerminalRendererType } from "./configuration.js";
38
50
  import { TerminalManager } from "./manager.js";
39
51
  import 'xterm/css/xterm.css';
40
52
  import { BaseStatefulView } from "./stateful-view.js";
@@ -116,19 +128,19 @@ export var LibroTerminalView = (_dec = transient(), _dec2 = view('libro-terminal
116
128
  };
117
129
  _this.createTerm = function () {
118
130
  var options = {
119
- cursorBlink: _this.config.get('terminal.integrated.cursorBlinking'),
131
+ cursorBlink: terminalIntegratedCursorBlinking.defaultValue,
120
132
  cursorStyle: _this.getCursorStyle(),
121
- cursorWidth: _this.config.get('terminal.integrated.cursorWidth'),
122
- fontFamily: _this.config.get('terminal.integrated.fontFamily'),
123
- fontSize: _this.config.get('terminal.integrated.fontSize'),
124
- fontWeight: _this.config.get('terminal.integrated.fontWeight'),
125
- fontWeightBold: _this.config.get('terminal.integrated.fontWeightBold'),
126
- drawBoldTextInBrightColors: _this.config.get('terminal.integrated.drawBoldTextInBrightColors'),
127
- letterSpacing: _this.config.get('terminal.integrated.letterSpacing'),
128
- lineHeight: _this.config.get('terminal.integrated.lineHeight'),
129
- scrollback: _this.config.get('terminal.integrated.scrollback'),
130
- fastScrollSensitivity: _this.config.get('terminal.integrated.fastScrollSensitivity'),
131
- rendererType: _this.getTerminalRendererType(_this.config.get('terminal.integrated.rendererType')),
133
+ cursorWidth: terminalIntegratedCursorWidth.defaultValue,
134
+ fontFamily: terminalIntegratedFontFamily.defaultValue,
135
+ fontSize: terminalIntegratedFontSize.defaultValue,
136
+ fontWeight: terminalIntegratedFontWeight.defaultValue,
137
+ fontWeightBold: terminalIntegratedFontWeightBold.defaultValue,
138
+ drawBoldTextInBrightColors: terminalIntegratedDrawBoldTextInBrightColors.defaultValue,
139
+ letterSpacing: terminalIntegratedLetterSpacing.defaultValue,
140
+ lineHeight: terminalIntegratedLineHeight.defaultValue,
141
+ scrollback: terminalIntegratedScrollback.defaultValue,
142
+ fastScrollSensitivity: terminalIntegratedFastScrollSensitivity.defaultValue,
143
+ rendererType: _this.getTerminalRendererType(terminalIntegratedRendererType.defaultValue),
132
144
  theme: _this.themeService.getTheme()
133
145
  };
134
146
  var _this$createTerminal = _this.createTerminal(options),
@@ -156,7 +168,7 @@ export var LibroTerminalView = (_dec = transient(), _dec2 = view('libro-terminal
156
168
  * @returns CursorStyle
157
169
  */
158
170
  _this.getCursorStyle = function () {
159
- var value = _this.config.get('terminal.integrated.cursorStyle');
171
+ var value = terminalIntegratedCursorStyle.defaultValue;
160
172
  return value === 'line' ? 'bar' : value;
161
173
  };
162
174
  /**
@@ -361,7 +373,7 @@ export var LibroTerminalView = (_dec = transient(), _dec2 = view('libro-terminal
361
373
  }
362
374
  LibroTerminalView = inject(TerminalManager)(LibroTerminalView, undefined, 3) || LibroTerminalView;
363
375
  LibroTerminalView = inject(TerminalThemeService)(LibroTerminalView, undefined, 2) || LibroTerminalView;
364
- LibroTerminalView = inject(TerminalConfiguration)(LibroTerminalView, undefined, 1) || LibroTerminalView;
376
+ LibroTerminalView = inject(ConfigurationService)(LibroTerminalView, undefined, 1) || LibroTerminalView;
365
377
  LibroTerminalView = inject(ViewOption)(LibroTerminalView, undefined, 0) || LibroTerminalView;
366
378
  _createClass(LibroTerminalView, [{
367
379
  key: "afterRestore",
@@ -477,17 +489,17 @@ export var LibroTerminalView = (_dec = transient(), _dec2 = view('libro-terminal
477
489
  }, {
478
490
  key: "enableCopy",
479
491
  get: function get() {
480
- return this.config.get('terminal.enableCopy');
492
+ return terminalEnableCopy.defaultValue;
481
493
  }
482
494
  }, {
483
495
  key: "enablePaste",
484
496
  get: function get() {
485
- return this.config.get('terminal.enablePaste');
497
+ return terminalEnablePaste.defaultValue;
486
498
  }
487
499
  }, {
488
500
  key: "copyOnSelection",
489
501
  get: function get() {
490
- return this.config.get('terminal.integrated.copyOnSelection');
502
+ return terminalIntegratedCopyOnSelection.defaultValue;
491
503
  }
492
504
  }, {
493
505
  key: "onViewMount",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@difizen/libro-terminal",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "libro"
@@ -31,26 +31,28 @@
31
31
  "src"
32
32
  ],
33
33
  "dependencies": {
34
- "@difizen/libro-core": "^0.1.10",
35
- "@difizen/libro-common": "^0.1.10",
36
- "@difizen/libro-kernel": "^0.1.10",
37
- "@difizen/mana-app": "latest",
34
+ "@difizen/libro-core": "^0.1.11",
35
+ "@difizen/libro-common": "^0.1.11",
36
+ "@difizen/libro-kernel": "^0.1.11",
38
37
  "@ant-design/icons": "^5.1.0",
38
+ "@difizen/mana-app": "latest",
39
+ "lodash.throttle": "^4.1.1",
40
+ "uuid": "^9.0.0",
39
41
  "xterm-addon-search": "^0.13.0",
40
42
  "xterm": "~5.1.0",
41
43
  "xterm-addon-canvas": "~0.3.0",
42
44
  "xterm-addon-fit": "~0.7.0",
43
45
  "xterm-addon-web-links": "~0.8.0",
44
- "xterm-addon-webgl": "~0.14.0",
45
- "@types/lodash.throttle": "^4.1.1",
46
- "lodash.throttle": "^4.1.1"
46
+ "xterm-addon-webgl": "~0.14.0"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "antd": "^5.8.6",
50
50
  "react": "^18.2.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@types/react": "^18.2.25"
53
+ "@types/lodash.throttle": "^4.1.1",
54
+ "@types/react": "^18.2.25",
55
+ "@types/uuid": "^9.0.2"
54
56
  },
55
57
  "scripts": {
56
58
  "setup": "father build",
package/src/command.ts ADDED
@@ -0,0 +1,60 @@
1
+ import type { Command, CommandRegistry, KeybindingRegistry } from '@difizen/mana-app';
2
+ import { ConfigurationService, KeybindingContribution } from '@difizen/mana-app';
3
+ import { SlotViewManager } from '@difizen/mana-app';
4
+ import { inject, ViewManager } from '@difizen/mana-app';
5
+ import { singleton } from '@difizen/mana-app';
6
+ import { CommandContribution } from '@difizen/mana-app';
7
+
8
+ import { terminalDefaultSlot } from './configuration.js';
9
+ import { TerminalManager } from './manager.js';
10
+ import { LibroTerminalView } from './view.js';
11
+
12
+ export const TerminalCommands: Record<string, Command & { keybind?: string }> = {
13
+ OpenTerminal: {
14
+ id: 'libro-terminal-open',
15
+ label: '新建终端',
16
+ keybind: 'ctrl+`',
17
+ },
18
+ };
19
+
20
+ @singleton({ contrib: [CommandContribution, KeybindingContribution] })
21
+ export class TerminalCommandContribution
22
+ implements CommandContribution, KeybindingContribution
23
+ {
24
+ @inject(ViewManager) viewManager: ViewManager;
25
+ @inject(SlotViewManager) protected slotManager: SlotViewManager;
26
+ @inject(ConfigurationService) protected config: ConfigurationService;
27
+ @inject(TerminalManager) manager: TerminalManager;
28
+ registerKeybindings(keybindings: KeybindingRegistry): void {
29
+ if (TerminalCommands['OpenTerminal'].keybind) {
30
+ keybindings.registerKeybinding({
31
+ keybinding: TerminalCommands['OpenTerminal'].keybind,
32
+ command: TerminalCommands['OpenTerminal'].id,
33
+ });
34
+ }
35
+ }
36
+
37
+ registerCommands(commands: CommandRegistry): void {
38
+ commands.registerCommand(TerminalCommands['OpenTerminal'], {
39
+ execute: async () => {
40
+ try {
41
+ const terminalView =
42
+ await this.viewManager.getOrCreateView<LibroTerminalView>(
43
+ LibroTerminalView,
44
+ {
45
+ id: this.manager.newTerminalName(),
46
+ },
47
+ );
48
+ const slot = await this.config.get(terminalDefaultSlot);
49
+ if (slot) {
50
+ this.slotManager.addView(terminalView, slot, {
51
+ reveal: true,
52
+ });
53
+ }
54
+ } catch (e) {
55
+ console.error(e);
56
+ }
57
+ },
58
+ });
59
+ }
60
+ }
@@ -1,5 +1,10 @@
1
1
  import type { ConfigurationNode } from '@difizen/mana-app';
2
- import { isOSX, isWindows, singleton } from '@difizen/mana-app';
2
+ import {
3
+ isOSX,
4
+ isWindows,
5
+ singleton,
6
+ ConfigurationContribution,
7
+ } from '@difizen/mana-app';
3
8
 
4
9
  export type TerminalRendererType = 'canvas' | 'dom';
5
10
  export const DEFAULT_TERMINAL_RENDERER_TYPE = 'canvas';
@@ -10,7 +15,16 @@ export function isTerminalRendererType(arg: any): arg is TerminalRendererType {
10
15
 
11
16
  export type CursorStyle = 'block' | 'underline' | 'bar';
12
17
 
13
- export const terminalEnableCopy: ConfigurationNode<any> = {
18
+ export const terminalDefaultSlot: ConfigurationNode<string | undefined> = {
19
+ id: 'terminal.default.slot',
20
+ schema: {
21
+ type: 'string',
22
+ },
23
+ description: 'The location where the terminal is opened by default.',
24
+ defaultValue: undefined,
25
+ };
26
+
27
+ export const terminalEnableCopy: ConfigurationNode<boolean> = {
14
28
  id: 'terminal.enableCopy',
15
29
  schema: {
16
30
  type: 'boolean',
@@ -19,7 +33,7 @@ export const terminalEnableCopy: ConfigurationNode<any> = {
19
33
  description: 'Enable ctrl-c (cmd-c on macOS) to copy selected text',
20
34
  defaultValue: true,
21
35
  };
22
- export const terminalEnablePaste: ConfigurationNode<any> = {
36
+ export const terminalEnablePaste: ConfigurationNode<boolean> = {
23
37
  id: 'terminal.enablePaste',
24
38
  schema: {
25
39
  type: 'boolean',
@@ -28,7 +42,7 @@ export const terminalEnablePaste: ConfigurationNode<any> = {
28
42
  description: 'Enable ctrl-v (cmd-v on macOS) to paste from clipboard',
29
43
  defaultValue: true,
30
44
  };
31
- export const terminalIntegratedFontFamily: ConfigurationNode<any> = {
45
+ export const terminalIntegratedFontFamily: ConfigurationNode<string> = {
32
46
  id: 'terminal.integrated.fontFamily',
33
47
  schema: {
34
48
  type: 'string',
@@ -42,7 +56,7 @@ export const terminalIntegratedFontFamily: ConfigurationNode<any> = {
42
56
  ? "Consolas, 'Courier New', monospace"
43
57
  : "'Droid Sans Mono', 'monospace', monospace",
44
58
  };
45
- export const terminalIntegratedFontSize: ConfigurationNode<any> = {
59
+ export const terminalIntegratedFontSize: ConfigurationNode<number> = {
46
60
  id: 'terminal.integrated.fontSize',
47
61
  schema: {
48
62
  type: 'number',
@@ -52,7 +66,7 @@ export const terminalIntegratedFontSize: ConfigurationNode<any> = {
52
66
  description: 'Controls the font size in pixels of the terminal.',
53
67
  defaultValue: 12,
54
68
  };
55
- export const terminalIntegratedFontWeight: ConfigurationNode<any> = {
69
+ export const terminalIntegratedFontWeight: ConfigurationNode<string> = {
56
70
  id: 'terminal.integrated.fontWeight',
57
71
  schema: {
58
72
  type: 'string',
@@ -63,7 +77,7 @@ export const terminalIntegratedFontWeight: ConfigurationNode<any> = {
63
77
  'The font weight to use within the terminal for non-bold text. Accepts "normal" and "bold" keywords or numbers between 1 and 1000.',
64
78
  defaultValue: 'normal',
65
79
  };
66
- export const terminalIntegratedFontWeightBold: ConfigurationNode<any> = {
80
+ export const terminalIntegratedFontWeightBold: ConfigurationNode<string> = {
67
81
  id: 'terminal.integrated.fontWeightBold',
68
82
  schema: {
69
83
  type: 'string',
@@ -74,17 +88,18 @@ export const terminalIntegratedFontWeightBold: ConfigurationNode<any> = {
74
88
  'The font weight to use within the terminal for bold text. Accepts "normal" and "bold" keywords or numbers between 1 and 1000.',
75
89
  defaultValue: 'bold',
76
90
  };
77
- export const terminalIntegratedDrawBoldTextInBrightColors: ConfigurationNode<any> = {
78
- id: 'terminal.integrated.drawBoldTextInBrightColors',
79
- description:
80
- 'Controls whether bold text in the terminal will always use the "bright" ANSI color variant.',
81
- schema: {
82
- type: 'boolean',
83
- },
91
+ export const terminalIntegratedDrawBoldTextInBrightColors: ConfigurationNode<boolean> =
92
+ {
93
+ id: 'terminal.integrated.drawBoldTextInBrightColors',
94
+ description:
95
+ 'Controls whether bold text in the terminal will always use the "bright" ANSI color variant.',
96
+ schema: {
97
+ type: 'boolean',
98
+ },
84
99
 
85
- defaultValue: true,
86
- };
87
- export const terminalIntegratedLetterSpacing: ConfigurationNode<any> = {
100
+ defaultValue: true,
101
+ };
102
+ export const terminalIntegratedLetterSpacing: ConfigurationNode<number> = {
88
103
  id: 'terminal.integrated.letterSpacing',
89
104
  description:
90
105
  'Controls the letter spacing of the terminal, this is an integer value which represents the amount of additional pixels to add between characters.',
@@ -94,7 +109,7 @@ export const terminalIntegratedLetterSpacing: ConfigurationNode<any> = {
94
109
 
95
110
  defaultValue: 1,
96
111
  };
97
- export const terminalIntegratedLineHeight: ConfigurationNode<any> = {
112
+ export const terminalIntegratedLineHeight: ConfigurationNode<number> = {
98
113
  id: 'terminal.integrated.lineHeight',
99
114
  description:
100
115
  'Controls the line height of the terminal, this number is multiplied by the terminal font size to get the actual line-height in pixels.',
@@ -105,7 +120,7 @@ export const terminalIntegratedLineHeight: ConfigurationNode<any> = {
105
120
 
106
121
  defaultValue: 1,
107
122
  };
108
- export const terminalIntegratedScrollback: ConfigurationNode<any> = {
123
+ export const terminalIntegratedScrollback: ConfigurationNode<number> = {
109
124
  id: 'terminal.integrated.scrollback',
110
125
  description: 'Controls the maximum amount of lines the terminal keeps in its buffer.',
111
126
  schema: {
@@ -114,7 +129,7 @@ export const terminalIntegratedScrollback: ConfigurationNode<any> = {
114
129
 
115
130
  defaultValue: 1000,
116
131
  };
117
- export const terminalIntegratedFastScrollSensitivity: ConfigurationNode<any> = {
132
+ export const terminalIntegratedFastScrollSensitivity: ConfigurationNode<number> = {
118
133
  id: 'terminal.integrated.fastScrollSensitivity',
119
134
  description: 'Scrolling speed multiplier when pressing `Alt`.',
120
135
  schema: {
@@ -123,7 +138,7 @@ export const terminalIntegratedFastScrollSensitivity: ConfigurationNode<any> = {
123
138
 
124
139
  defaultValue: 5,
125
140
  };
126
- export const terminalIntegratedRendererType: ConfigurationNode<any> = {
141
+ export const terminalIntegratedRendererType: ConfigurationNode<string> = {
127
142
  id: 'terminal.integrated.rendererType',
128
143
  description: 'Controls how the terminal is rendered.',
129
144
  schema: {
@@ -133,7 +148,7 @@ export const terminalIntegratedRendererType: ConfigurationNode<any> = {
133
148
  // enum: ['canvas', 'dom'],
134
149
  defaultValue: 'canvas',
135
150
  };
136
- export const terminalIntegratedCopyOnSelection: ConfigurationNode<any> = {
151
+ export const terminalIntegratedCopyOnSelection: ConfigurationNode<boolean> = {
137
152
  id: 'terminal.integrated.copyOnSelection',
138
153
  description:
139
154
  'Controls whether text selected in the terminal will be copied to the clipboard.',
@@ -143,7 +158,7 @@ export const terminalIntegratedCopyOnSelection: ConfigurationNode<any> = {
143
158
 
144
159
  defaultValue: false,
145
160
  };
146
- export const terminalIntegratedCursorBlinking: ConfigurationNode<any> = {
161
+ export const terminalIntegratedCursorBlinking: ConfigurationNode<boolean> = {
147
162
  id: 'terminal.integrated.cursorBlinking',
148
163
  description: 'Controls whether the terminal cursor blinks.',
149
164
  schema: {
@@ -152,7 +167,7 @@ export const terminalIntegratedCursorBlinking: ConfigurationNode<any> = {
152
167
 
153
168
  defaultValue: false,
154
169
  };
155
- export const terminalIntegratedCursorStyle: ConfigurationNode<any> = {
170
+ export const terminalIntegratedCursorStyle: ConfigurationNode<string> = {
156
171
  id: 'terminal.integrated.cursorStyle',
157
172
  description: 'Controls the style of terminal cursor.',
158
173
  // enum: ['block', 'underline', 'line'],
@@ -161,7 +176,7 @@ export const terminalIntegratedCursorStyle: ConfigurationNode<any> = {
161
176
  type: 'string',
162
177
  },
163
178
  };
164
- export const terminalIntegratedCursorWidth: ConfigurationNode<any> = {
179
+ export const terminalIntegratedCursorWidth: ConfigurationNode<number> = {
165
180
  id: 'terminal.integrated.cursorWidth',
166
181
  description:
167
182
  'Controls the width of the cursor when `#terminal.integrated.cursorStyle#` is set to `line`.',
@@ -171,7 +186,7 @@ export const terminalIntegratedCursorWidth: ConfigurationNode<any> = {
171
186
 
172
187
  defaultValue: 1,
173
188
  };
174
- export const terminalIntegratedShellWindows: ConfigurationNode<any> = {
189
+ export const terminalIntegratedShellWindows: ConfigurationNode<string | undefined> = {
175
190
  id: 'terminal.integrated.shell.windows',
176
191
  schema: {
177
192
  type: 'string',
@@ -181,7 +196,7 @@ export const terminalIntegratedShellWindows: ConfigurationNode<any> = {
181
196
  "The path of the shell that the terminal uses on Windows. (defaultValue: '{0}').",
182
197
  defaultValue: undefined,
183
198
  };
184
- export const terminalIntegratedShellOsx: ConfigurationNode<any> = {
199
+ export const terminalIntegratedShellOsx: ConfigurationNode<string | undefined> = {
185
200
  id: 'terminal.integrated.shell.osx',
186
201
  schema: {
187
202
  type: 'string',
@@ -190,7 +205,7 @@ export const terminalIntegratedShellOsx: ConfigurationNode<any> = {
190
205
  "The path of the shell that the terminal uses on macOS (defaultValue: '{0}'}).",
191
206
  defaultValue: undefined,
192
207
  };
193
- export const terminalIntegratedShellLinux: ConfigurationNode<any> = {
208
+ export const terminalIntegratedShellLinux: ConfigurationNode<string | undefined> = {
194
209
  id: 'terminal.integrated.shell.linux',
195
210
  schema: {
196
211
  type: 'string',
@@ -199,34 +214,37 @@ export const terminalIntegratedShellLinux: ConfigurationNode<any> = {
199
214
  "The path of the shell that the terminal uses on Linux (defaultValue: '{0}'}).",
200
215
  defaultValue: undefined,
201
216
  };
202
- export const terminalIntegratedShellArgsWindows: ConfigurationNode<any> = {
217
+ export const terminalIntegratedShellArgsWindows: ConfigurationNode<string[]> = {
203
218
  id: 'terminal.integrated.shellArgs.windows',
204
219
  schema: {
205
- type: 'string',
220
+ type: 'array',
221
+ items: { type: 'string' },
206
222
  },
207
223
 
208
224
  description: 'The command line arguments to use when on the Windows terminal.',
209
225
  defaultValue: [],
210
226
  };
211
- export const terminalIntegratedShellArgsOsx: ConfigurationNode<any> = {
227
+ export const terminalIntegratedShellArgsOsx: ConfigurationNode<string[]> = {
212
228
  id: 'terminal.integrated.shellArgs.osx',
213
229
  schema: {
214
- type: 'string',
230
+ type: 'array',
231
+ items: { type: 'string' },
215
232
  },
216
233
 
217
234
  description: 'The command line arguments to use when on the macOS terminal.',
218
235
  defaultValue: ['-l'],
219
236
  };
220
- export const terminalIntegratedShellArgsLinux: ConfigurationNode<any> = {
237
+ export const terminalIntegratedShellArgsLinux: ConfigurationNode<string[]> = {
221
238
  id: 'terminal.integrated.shellArgs.linux',
222
239
  schema: {
223
- type: 'string',
240
+ type: 'array',
241
+ items: { type: 'string' },
224
242
  },
225
243
 
226
244
  description: 'The command line arguments to use when on the Linux terminal.',
227
245
  defaultValue: [],
228
246
  };
229
- export const terminalIntegratedConfirmOnExit: ConfigurationNode<any> = {
247
+ export const terminalIntegratedConfirmOnExit: ConfigurationNode<string> = {
230
248
  id: 'terminal.integrated.confirmOnExit',
231
249
  schema: {
232
250
  type: 'string',
@@ -242,8 +260,8 @@ export const terminalIntegratedConfirmOnExit: ConfigurationNode<any> = {
242
260
  defaultValue: 'never',
243
261
  };
244
262
 
245
- @singleton()
246
- export class TerminalConfiguration {
263
+ @singleton({ contrib: ConfigurationContribution })
264
+ export class TerminalConfiguration implements ConfigurationContribution {
247
265
  configs = [
248
266
  terminalEnableCopy,
249
267
  terminalEnablePaste,
@@ -268,9 +286,10 @@ export class TerminalConfiguration {
268
286
  terminalIntegratedShellArgsOsx,
269
287
  terminalIntegratedShellArgsLinux,
270
288
  terminalIntegratedConfirmOnExit,
289
+ terminalDefaultSlot,
271
290
  ];
272
291
 
273
- get(key: string) {
274
- return this.configs.find((item) => item.id === key)?.defaultValue;
292
+ registerConfigurations() {
293
+ return this.configs;
275
294
  }
276
295
  }
package/src/index.ts CHANGED
@@ -8,4 +8,5 @@ export * from './module.js';
8
8
  export * from './view.js';
9
9
  export * from './manager.js';
10
10
  export * from './protocol.js';
11
+ export * from './command.js';
11
12
  export * from './configuration.js';
package/src/manager.ts CHANGED
@@ -6,6 +6,7 @@ import { NetworkError, ServerConnection } from '@difizen/libro-kernel';
6
6
  import type { Disposable, Disposed, Event } from '@difizen/mana-app';
7
7
  import { singleton } from '@difizen/mana-app';
8
8
  import { Emitter, inject } from '@difizen/mana-app';
9
+ import { v4 } from 'uuid';
9
10
 
10
11
  import type { TerminalConnection } from './connection.js';
11
12
  import type { TerminalModel, TerminalOption } from './protocol.js';
@@ -283,4 +284,7 @@ export class TerminalManager implements Disposable, Disposed {
283
284
  }
284
285
  return connection;
285
286
  };
287
+ newTerminalName = () => {
288
+ return v4();
289
+ };
286
290
  }
package/src/module.ts CHANGED
@@ -5,6 +5,7 @@ import {
5
5
  } from '@difizen/libro-kernel';
6
6
  import { ManaModule } from '@difizen/mana-app';
7
7
 
8
+ import { TerminalCommandContribution } from './command.js';
8
9
  import { TerminalConfiguration } from './configuration.js';
9
10
  import { TerminalConnection } from './connection.js';
10
11
  import './index.less';
@@ -19,6 +20,7 @@ import { TerminalThemeService } from './theme-service.js';
19
20
  import { LibroTerminalView } from './view.js';
20
21
 
21
22
  export const TerminalModule = ManaModule.create().register(
23
+ TerminalCommandContribution,
22
24
  TerminalConfiguration,
23
25
  TerminalConnection,
24
26
  TerminalManager,