@difizen/libro-terminal 0.1.1 → 0.1.3
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/connection.d.ts +3 -2
- package/es/connection.d.ts.map +1 -1
- package/es/connection.js +40 -40
- package/es/index.d.ts +9 -0
- package/es/index.d.ts.map +1 -1
- package/es/index.js +10 -1
- package/es/index.less +9 -0
- package/es/manager.d.ts +3 -2
- package/es/manager.d.ts.map +1 -1
- package/es/manager.js +7 -2
- package/es/module.d.ts +1 -0
- package/es/module.d.ts.map +1 -1
- package/es/module.js +10 -4
- package/es/protocol.d.ts +1 -1
- package/es/protocol.d.ts.map +1 -1
- package/es/restapi.d.ts.map +1 -1
- package/es/restapi.js +1 -1
- package/es/stateful-view.d.ts +9 -0
- package/es/stateful-view.d.ts.map +1 -0
- package/es/stateful-view.js +35 -0
- package/es/theme-service.d.ts +3 -0
- package/es/theme-service.d.ts.map +1 -1
- package/es/theme-service.js +37 -2
- package/es/view.d.ts +77 -25
- package/es/view.d.ts.map +1 -1
- package/es/view.js +417 -120
- package/package.json +12 -7
- package/src/connection.ts +9 -3
- package/src/index.less +9 -0
- package/src/index.spec.ts +2 -2
- package/src/index.ts +10 -0
- package/src/manager.ts +7 -3
- package/src/module.ts +22 -4
- package/src/protocol.ts +2 -1
- package/src/restapi.ts +2 -1
- package/src/stateful-view.ts +20 -0
- package/src/theme-service.ts +34 -2
- package/src/view.tsx +358 -82
package/es/connection.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
import type { ISettings } from '@difizen/libro-kernel';
|
|
3
|
+
import { ServerConnection } from '@difizen/libro-kernel';
|
|
3
4
|
import type { Disposable, Disposed, Event } from '@difizen/mana-app';
|
|
4
5
|
import { Emitter } from '@difizen/mana-app';
|
|
5
6
|
import { TerminalOption } from './protocol.js';
|
|
@@ -24,7 +25,7 @@ export declare class TerminalConnection implements Disposable, Disposed {
|
|
|
24
25
|
*/
|
|
25
26
|
constructor(options: TerminalOption & {
|
|
26
27
|
name: string;
|
|
27
|
-
});
|
|
28
|
+
}, serverConnection: ServerConnection);
|
|
28
29
|
/**
|
|
29
30
|
* A signal emitted when a message is received from the server.
|
|
30
31
|
*/
|
|
@@ -68,7 +69,7 @@ export declare class TerminalConnection implements Disposable, Disposed {
|
|
|
68
69
|
/**
|
|
69
70
|
* Reconnect to a terminal.
|
|
70
71
|
*/
|
|
71
|
-
reconnect()
|
|
72
|
+
reconnect: () => Promise<void>;
|
|
72
73
|
/**
|
|
73
74
|
* Attempt a connection if we have not exhausted connection attempts.
|
|
74
75
|
*/
|
package/es/connection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAGrE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACb,wBAAwB,EAEzB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,qBACa,kBAAmB,YAAW,UAAU,EAAE,QAAQ;IAC7D,SAAS,CAAC,WAAW,gBAAuB;IAC5C,SAAS,CAAC,gBAAgB,2BAAkC;IAC5D,SAAS,CAAC,iBAAiB,EAAE,wBAAwB,CAAgB;IACrE,SAAS,CAAC,wBAAwB,oCAA2C;IAC7E,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC,OAAO,CAAa;IACzD,SAAS,CAAC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D;IAED,IAAI,gBAAgB,IAAI,wBAAwB,CAE/C;CACF;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAItE"}
|
package/es/connection.js
CHANGED
|
@@ -18,6 +18,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
18
18
|
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
|
|
19
19
|
function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
|
|
20
20
|
import { URL } from '@difizen/libro-common';
|
|
21
|
+
import { ServerConnection } from '@difizen/libro-kernel';
|
|
21
22
|
import { transient } from '@difizen/mana-app';
|
|
22
23
|
import { Deferred } from '@difizen/mana-app';
|
|
23
24
|
import { Emitter } from '@difizen/mana-app';
|
|
@@ -28,7 +29,7 @@ export var TerminalConnection = (_dec = transient(), _dec2 = inject(TerminalRest
|
|
|
28
29
|
/**
|
|
29
30
|
* Construct a new terminal session.
|
|
30
31
|
*/
|
|
31
|
-
function TerminalConnection(options) {
|
|
32
|
+
function TerminalConnection(options, serverConnection) {
|
|
32
33
|
var _this = this;
|
|
33
34
|
_classCallCheck(this, TerminalConnection);
|
|
34
35
|
this._onDisposed = new Emitter();
|
|
@@ -45,6 +46,39 @@ export var TerminalConnection = (_dec = transient(), _dec2 = inject(TerminalRest
|
|
|
45
46
|
this._pendingMessages = [];
|
|
46
47
|
_initializerDefineProperty(this, "terminalRestAPI", _descriptor, this);
|
|
47
48
|
this.disposed = false;
|
|
49
|
+
/**
|
|
50
|
+
* Reconnect to a terminal.
|
|
51
|
+
*/
|
|
52
|
+
this.reconnect = function () {
|
|
53
|
+
_this._errorIfDisposed();
|
|
54
|
+
var result = new Deferred();
|
|
55
|
+
|
|
56
|
+
// Set up a listener for the connection status changing, which accepts or
|
|
57
|
+
// rejects after the retries are done.
|
|
58
|
+
var fulfill = function fulfill(status) {
|
|
59
|
+
if (status === 'connected') {
|
|
60
|
+
var _this$toDisposeOnReco;
|
|
61
|
+
result.resolve();
|
|
62
|
+
(_this$toDisposeOnReco = _this.toDisposeOnReconnect) === null || _this$toDisposeOnReco === void 0 || _this$toDisposeOnReco.dispose();
|
|
63
|
+
} else if (status === 'disconnected') {
|
|
64
|
+
var _this$toDisposeOnReco2;
|
|
65
|
+
result.reject(new Error('Terminal connection disconnected'));
|
|
66
|
+
(_this$toDisposeOnReco2 = _this.toDisposeOnReconnect) === null || _this$toDisposeOnReco2 === void 0 || _this$toDisposeOnReco2.dispose();
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
_this.toDisposeOnReconnect = _this.connectionStatusChanged(fulfill);
|
|
70
|
+
|
|
71
|
+
// Reset the reconnect limit so we start the connection attempts fresh
|
|
72
|
+
_this._reconnectAttempt = 0;
|
|
73
|
+
|
|
74
|
+
// Start the reconnection process, which will also clear any existing
|
|
75
|
+
// connection.
|
|
76
|
+
_this._reconnect();
|
|
77
|
+
|
|
78
|
+
// Return the promise that should resolve on connection or reject if the
|
|
79
|
+
// retries don't work.
|
|
80
|
+
return result.promise;
|
|
81
|
+
};
|
|
48
82
|
/**
|
|
49
83
|
* Create the terminal websocket connection and add socket status handlers.
|
|
50
84
|
*
|
|
@@ -101,6 +135,7 @@ export var TerminalConnection = (_dec = transient(), _dec2 = inject(TerminalRest
|
|
|
101
135
|
_this._reconnect();
|
|
102
136
|
}
|
|
103
137
|
};
|
|
138
|
+
this.serverSettings = serverConnection.settings;
|
|
104
139
|
this._name = options.name;
|
|
105
140
|
this._createSocket();
|
|
106
141
|
}
|
|
@@ -108,6 +143,7 @@ export var TerminalConnection = (_dec = transient(), _dec2 = inject(TerminalRest
|
|
|
108
143
|
/**
|
|
109
144
|
* A signal emitted when a message is received from the server.
|
|
110
145
|
*/
|
|
146
|
+
TerminalConnection = inject(ServerConnection)(TerminalConnection, undefined, 1) || TerminalConnection;
|
|
111
147
|
TerminalConnection = inject(TerminalOption)(TerminalConnection, undefined, 0) || TerminalConnection;
|
|
112
148
|
_createClass(TerminalConnection, [{
|
|
113
149
|
key: "messageReceived",
|
|
@@ -154,6 +190,7 @@ export var TerminalConnection = (_dec = transient(), _dec2 = inject(TerminalRest
|
|
|
154
190
|
return;
|
|
155
191
|
}
|
|
156
192
|
this.disposed = true;
|
|
193
|
+
this.shutdown().catch(console.error);
|
|
157
194
|
this._updateConnectionStatus('disconnected');
|
|
158
195
|
this._clearSocket();
|
|
159
196
|
}
|
|
@@ -211,49 +248,12 @@ export var TerminalConnection = (_dec = transient(), _dec2 = inject(TerminalRest
|
|
|
211
248
|
}
|
|
212
249
|
}
|
|
213
250
|
}, {
|
|
214
|
-
key: "
|
|
251
|
+
key: "_reconnect",
|
|
215
252
|
value:
|
|
216
|
-
/**
|
|
217
|
-
* Reconnect to a terminal.
|
|
218
|
-
*/
|
|
219
|
-
function reconnect() {
|
|
220
|
-
var _this2 = this;
|
|
221
|
-
this._errorIfDisposed();
|
|
222
|
-
var result = new Deferred();
|
|
223
|
-
|
|
224
|
-
// Set up a listener for the connection status changing, which accepts or
|
|
225
|
-
// rejects after the retries are done.
|
|
226
|
-
var fulfill = function fulfill(status) {
|
|
227
|
-
if (status === 'connected') {
|
|
228
|
-
var _this2$toDisposeOnRec;
|
|
229
|
-
result.resolve();
|
|
230
|
-
(_this2$toDisposeOnRec = _this2.toDisposeOnReconnect) === null || _this2$toDisposeOnRec === void 0 || _this2$toDisposeOnRec.dispose();
|
|
231
|
-
} else if (status === 'disconnected') {
|
|
232
|
-
var _this2$toDisposeOnRec2;
|
|
233
|
-
result.reject(new Error('Terminal connection disconnected'));
|
|
234
|
-
(_this2$toDisposeOnRec2 = _this2.toDisposeOnReconnect) === null || _this2$toDisposeOnRec2 === void 0 || _this2$toDisposeOnRec2.dispose();
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
this.toDisposeOnReconnect = this.connectionStatusChanged(fulfill);
|
|
238
|
-
|
|
239
|
-
// Reset the reconnect limit so we start the connection attempts fresh
|
|
240
|
-
this._reconnectAttempt = 0;
|
|
241
|
-
|
|
242
|
-
// Start the reconnection process, which will also clear any existing
|
|
243
|
-
// connection.
|
|
244
|
-
this._reconnect();
|
|
245
|
-
|
|
246
|
-
// Return the promise that should resolve on connection or reject if the
|
|
247
|
-
// retries don't work.
|
|
248
|
-
return result.promise;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
253
|
/**
|
|
252
254
|
* Attempt a connection if we have not exhausted connection attempts.
|
|
253
255
|
*/
|
|
254
|
-
|
|
255
|
-
key: "_reconnect",
|
|
256
|
-
value: function _reconnect() {
|
|
256
|
+
function _reconnect() {
|
|
257
257
|
this._errorIfDisposed();
|
|
258
258
|
|
|
259
259
|
// Clear any existing reconnection attempt
|
package/es/index.d.ts
CHANGED
|
@@ -1,2 +1,11 @@
|
|
|
1
|
+
export * from './manager.js';
|
|
2
|
+
export * from './view.js';
|
|
3
|
+
export * from './theme-service.js';
|
|
4
|
+
export * from './restapi.js';
|
|
5
|
+
export * from './configuration.js';
|
|
1
6
|
export * from './module.js';
|
|
7
|
+
export * from './view.js';
|
|
8
|
+
export * from './manager.js';
|
|
9
|
+
export * from './protocol.js';
|
|
10
|
+
export * from './configuration.js';
|
|
2
11
|
//# sourceMappingURL=index.d.ts.map
|
package/es/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AAEnC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC"}
|
package/es/index.js
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./manager.js";
|
|
2
|
+
export * from "./view.js";
|
|
3
|
+
export * from "./theme-service.js";
|
|
4
|
+
export * from "./restapi.js";
|
|
5
|
+
export * from "./configuration.js";
|
|
6
|
+
export * from "./module.js";
|
|
7
|
+
export * from "./view.js";
|
|
8
|
+
export * from "./manager.js";
|
|
9
|
+
export * from "./protocol.js";
|
|
10
|
+
export * from "./configuration.js";
|
package/es/index.less
ADDED
package/es/manager.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Poll } from '@difizen/libro-common';
|
|
2
2
|
import type { ISettings } from '@difizen/libro-kernel';
|
|
3
|
+
import { ServerConnection } from '@difizen/libro-kernel';
|
|
3
4
|
import type { Disposable, Disposed, Event } from '@difizen/mana-app';
|
|
4
5
|
import { Emitter } from '@difizen/mana-app';
|
|
5
6
|
import type { TerminalConnection } from './connection.js';
|
|
@@ -21,7 +22,7 @@ export declare class TerminalManager implements Disposable, Disposed {
|
|
|
21
22
|
/**
|
|
22
23
|
* Construct a new terminal manager.
|
|
23
24
|
*/
|
|
24
|
-
constructor();
|
|
25
|
+
constructor(serverConnection: ServerConnection);
|
|
25
26
|
/**
|
|
26
27
|
* The server settings of the manager.
|
|
27
28
|
*/
|
|
@@ -90,7 +91,7 @@ export declare class TerminalManager implements Disposable, Disposed {
|
|
|
90
91
|
/**
|
|
91
92
|
* Execute a request to the server to poll running terminals and update state.
|
|
92
93
|
*/
|
|
93
|
-
|
|
94
|
+
requestRunning(): Promise<void>;
|
|
94
95
|
/**
|
|
95
96
|
* Handle a session starting.
|
|
96
97
|
*/
|
package/es/manager.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../src/manager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../src/manager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAgB,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAErE,OAAO,EAAE,OAAO,EAAU,MAAM,mBAAmB,CAAC;AAEpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,qBACa,eAAgB,YAAW,UAAU,EAAE,QAAQ;IAC1D,QAAQ,UAAS;IACjB,SAAS,CAAC,QAAQ,UAAS;IAC3B,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC;IAC5B,SAAS,CAAC,oBAAoB,0BAAiC;IAC/D,SAAS,CAAC,MAAM,EAAE,OAAO,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G;IACH,SAAS,CAAC,WAAW,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,IAAI;IAQnE,WAAW,YAAmB,cAAc,iCAoB1C;CACH"}
|
package/es/manager.js
CHANGED
|
@@ -18,7 +18,7 @@ function _initializerWarningHelper(descriptor, context) { throw new Error('Decor
|
|
|
18
18
|
// Distributed under the terms of the Modified BSD License.
|
|
19
19
|
|
|
20
20
|
import { Poll } from '@difizen/libro-common';
|
|
21
|
-
import { NetworkError } from '@difizen/libro-kernel';
|
|
21
|
+
import { NetworkError, ServerConnection } from '@difizen/libro-kernel';
|
|
22
22
|
import { singleton } from '@difizen/mana-app';
|
|
23
23
|
import { Emitter, inject } from '@difizen/mana-app';
|
|
24
24
|
import { TerminalConnectionFactory } from "./protocol.js";
|
|
@@ -27,7 +27,7 @@ export var TerminalManager = (_dec = singleton(), _dec2 = inject(TerminalRestAPI
|
|
|
27
27
|
/**
|
|
28
28
|
* Construct a new terminal manager.
|
|
29
29
|
*/
|
|
30
|
-
function TerminalManager() {
|
|
30
|
+
function TerminalManager(serverConnection) {
|
|
31
31
|
var _this = this;
|
|
32
32
|
_classCallCheck(this, TerminalManager);
|
|
33
33
|
this.disposed = false;
|
|
@@ -38,6 +38,7 @@ export var TerminalManager = (_dec = singleton(), _dec2 = inject(TerminalRestAPI
|
|
|
38
38
|
// As an optimization, we unwrap the models to just store the names.
|
|
39
39
|
this._names = [];
|
|
40
40
|
_initializerDefineProperty(this, "terminalRestAPI", _descriptor, this);
|
|
41
|
+
// @inject(ServerConnection) serverConnection: ServerConnection;
|
|
41
42
|
_initializerDefineProperty(this, "terminalConnectionFactory", _descriptor2, this);
|
|
42
43
|
this.getOrCreate = /*#__PURE__*/function () {
|
|
43
44
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
|
|
@@ -97,6 +98,9 @@ export var TerminalManager = (_dec = singleton(), _dec2 = inject(TerminalRestAPI
|
|
|
97
98
|
return _ref.apply(this, arguments);
|
|
98
99
|
};
|
|
99
100
|
}();
|
|
101
|
+
this.serverSettings = serverConnection.settings;
|
|
102
|
+
|
|
103
|
+
//
|
|
100
104
|
// Start polling with exponential backoff.
|
|
101
105
|
this._pollModels = new Poll({
|
|
102
106
|
auto: false,
|
|
@@ -135,6 +139,7 @@ export var TerminalManager = (_dec = singleton(), _dec2 = inject(TerminalRestAPI
|
|
|
135
139
|
/**
|
|
136
140
|
* The server settings of the manager.
|
|
137
141
|
*/
|
|
142
|
+
TerminalManager = inject(ServerConnection)(TerminalManager, undefined, 0) || TerminalManager;
|
|
138
143
|
_createClass(TerminalManager, [{
|
|
139
144
|
key: "_models",
|
|
140
145
|
get: function get() {
|
package/es/module.d.ts
CHANGED
package/es/module.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI/C,OAAO,cAAc,CAAC;AAWtB,eAAO,MAAM,cAAc,YA0B1B,CAAC"}
|
package/es/module.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import { KernelSpecRestAPI, ServerConnection, ServerManager } from '@difizen/libro-kernel';
|
|
1
2
|
import { ManaModule } from '@difizen/mana-app';
|
|
2
3
|
import { TerminalConfiguration } from "./configuration.js";
|
|
3
4
|
import { TerminalConnection } from "./connection.js";
|
|
5
|
+
import "./index.less";
|
|
4
6
|
import { TerminalManager } from "./manager.js";
|
|
5
|
-
import { TerminalOption } from "./protocol.js";
|
|
6
|
-
import { TerminalConnectionFactory } from "./protocol.js";
|
|
7
|
+
import { TerminalConnectionFactory, TerminalOption, TerminalViewOption } from "./protocol.js";
|
|
7
8
|
import { TerminalRestAPI } from "./restapi.js";
|
|
8
9
|
import { TerminalThemeService } from "./theme-service.js";
|
|
9
10
|
import { LibroTerminalView } from "./view.js";
|
|
10
|
-
export var TerminalModule = ManaModule.create().register(TerminalConnection, TerminalManager, TerminalRestAPI, {
|
|
11
|
+
export var TerminalModule = ManaModule.create().register(TerminalConfiguration, TerminalConnection, TerminalManager, TerminalRestAPI, LibroTerminalView, ServerConnection, ServerManager, KernelSpecRestAPI, {
|
|
11
12
|
token: TerminalConnectionFactory,
|
|
12
13
|
useFactory: function useFactory(ctx) {
|
|
13
14
|
return function (options) {
|
|
@@ -19,4 +20,9 @@ export var TerminalModule = ManaModule.create().register(TerminalConnection, Ter
|
|
|
19
20
|
return child.get(TerminalConnection);
|
|
20
21
|
};
|
|
21
22
|
}
|
|
22
|
-
},
|
|
23
|
+
}, {
|
|
24
|
+
token: TerminalViewOption,
|
|
25
|
+
useValue: {
|
|
26
|
+
// initialCommand: '',
|
|
27
|
+
}
|
|
28
|
+
}, TerminalThemeService);
|
package/es/protocol.d.ts
CHANGED
|
@@ -70,8 +70,8 @@ export interface TerminalViewOption extends TerminalOption {
|
|
|
70
70
|
readonly useServerTitle?: boolean;
|
|
71
71
|
/**
|
|
72
72
|
* Whether it is a pseudo terminal where an extension controls its input and output.
|
|
73
|
+
* 在jupyter中默认用的pseudo terminal
|
|
73
74
|
*/
|
|
74
|
-
readonly isPseudoTerminal?: boolean;
|
|
75
75
|
/**
|
|
76
76
|
* Terminal attributes. Can be useful to apply some implementation specific information.
|
|
77
77
|
*/
|
package/es/protocol.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CA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AE,CAAC;IAEhD;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAElC;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAElC;;;OAGG;IAGH;;OAEG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAEvD;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACjC;AAED,eAAO,MAAM,kBAAkB,eAA+B,CAAC"}
|
package/es/restapi.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restapi.d.ts","sourceRoot":"","sources":["../src/restapi.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGzD,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEnE,eAAO,MAAM,oBAAoB,kBAAkB,CAAC;AAEpD,qBACa,eAAe;IACA,gBAAgB,EAAE,gBAAgB,CAAC;IAEvD,QAAQ,CACZ,OAAO,EAAE,cAAc,EACvB,cAAc,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,GAClC,OAAO,CAAC,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"restapi.d.ts","sourceRoot":"","sources":["../src/restapi.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGzD,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEnE,eAAO,MAAM,oBAAoB,kBAAkB,CAAC;AAEpD,qBACa,eAAe;IACA,gBAAgB,EAAE,gBAAgB,CAAC;IAEvD,QAAQ,CACZ,OAAO,EAAE,cAAc,EACvB,cAAc,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,GAClC,OAAO,CAAC,aAAa,CAAC;IAkBnB,WAAW,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAgB1E,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAwBjF"}
|
package/es/restapi.js
CHANGED
|
@@ -42,7 +42,7 @@ export var TerminalRestAPI = (_dec = singleton(), _dec2 = inject(ServerConnectio
|
|
|
42
42
|
return this.serverConnection.makeRequest(url, init, settings);
|
|
43
43
|
case 5:
|
|
44
44
|
response = _context.sent;
|
|
45
|
-
if (!(response.status !==
|
|
45
|
+
if (!(response.status !== 200)) {
|
|
46
46
|
_context.next = 11;
|
|
47
47
|
break;
|
|
48
48
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { StatefulView } from '@difizen/mana-app';
|
|
2
|
+
import { BaseView } from '@difizen/mana-app';
|
|
3
|
+
export declare abstract class BaseStatefulView extends BaseView implements StatefulView {
|
|
4
|
+
constructor();
|
|
5
|
+
abstract storeState(): Record<string, any>;
|
|
6
|
+
abstract restoreState(oldState: Record<string, any>): void;
|
|
7
|
+
afterRestore(): void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=stateful-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stateful-view.d.ts","sourceRoot":"","sources":["../src/stateful-view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,8BAAsB,gBAAiB,SAAQ,QAAS,YAAW,YAAY;;IAU7E,QAAQ,CAAC,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAC1C,QAAQ,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAE1D,YAAY;CAGb"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
|
+
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); } }
|
|
4
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
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); }
|
|
7
|
+
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); }
|
|
8
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
9
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
11
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
12
|
+
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; } }
|
|
13
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
14
|
+
import { BaseView } from '@difizen/mana-app';
|
|
15
|
+
export var BaseStatefulView = /*#__PURE__*/function (_BaseView) {
|
|
16
|
+
_inherits(BaseStatefulView, _BaseView);
|
|
17
|
+
var _super = _createSuper(BaseStatefulView);
|
|
18
|
+
function BaseStatefulView() {
|
|
19
|
+
var _this;
|
|
20
|
+
_classCallCheck(this, BaseStatefulView);
|
|
21
|
+
_this = _super.call(this);
|
|
22
|
+
// setImmediate(() => {});
|
|
23
|
+
Promise.resolve().then(function () {
|
|
24
|
+
return _this.afterRestore();
|
|
25
|
+
}).catch(console.error);
|
|
26
|
+
return _this;
|
|
27
|
+
}
|
|
28
|
+
_createClass(BaseStatefulView, [{
|
|
29
|
+
key: "afterRestore",
|
|
30
|
+
value: function afterRestore() {
|
|
31
|
+
// do nothing
|
|
32
|
+
}
|
|
33
|
+
}]);
|
|
34
|
+
return BaseStatefulView;
|
|
35
|
+
}(BaseView);
|
package/es/theme-service.d.ts
CHANGED
|
@@ -14,5 +14,8 @@ export declare class TerminalThemeService {
|
|
|
14
14
|
protected readonly colorRegistry: ColorRegistry;
|
|
15
15
|
readonly onDidChange: import("@difizen/mana-app").Event<import("@difizen/mana-app").ThemeChangeEvent>;
|
|
16
16
|
get theme(): ITheme;
|
|
17
|
+
getTheme(type?: 'light' | 'dark' | 'default'): ITheme;
|
|
18
|
+
lightTheme: ITheme;
|
|
19
|
+
darkTheme: ITheme;
|
|
17
20
|
}
|
|
18
21
|
//# sourceMappingURL=theme-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-service.d.ts","sourceRoot":"","sources":["../src/theme-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAgB,MAAM,mBAAmB,CAAC;AAEhE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE;IACjC,CAAC,GAAG,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,eAAe,CAAC,UAAU,CAAC,CAAA;KAAE,CAAC;CAkIzE,CAAC;AAEF,qBACa,oBAAoB;IAE/B,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IAEhD,QAAQ,CAAC,WAAW,kFAA4C;IAEhE,IAAI,KAAK,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"theme-service.d.ts","sourceRoot":"","sources":["../src/theme-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAgB,MAAM,mBAAmB,CAAC;AAEhE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE;IACjC,CAAC,GAAG,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,eAAe,CAAC,UAAU,CAAC,CAAA;KAAE,CAAC;CAkIzE,CAAC;AAEF,qBACa,oBAAoB;IAE/B,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IAEhD,QAAQ,CAAC,WAAW,kFAA4C;IAEhE,IAAI,KAAK,IAAI,MAAM,CA+BlB;IAED,QAAQ,CAAC,IAAI,GAAE,OAAO,GAAG,MAAM,GAAG,SAAmB,GAAG,MAAM;IAa9D,UAAU,EAAE,MAAM,CAOhB;IAEF,SAAS,EAAE,MAAM,CAOf;CACH"}
|
package/es/theme-service.js
CHANGED
|
@@ -148,6 +148,26 @@ export var TerminalThemeService = (_dec = singleton(), _dec2 = inject(ColorRegis
|
|
|
148
148
|
_classCallCheck(this, TerminalThemeService);
|
|
149
149
|
_initializerDefineProperty(this, "colorRegistry", _descriptor, this);
|
|
150
150
|
this.onDidChange = ThemeService.get().onDidColorThemeChange;
|
|
151
|
+
// jupyter terminal theme
|
|
152
|
+
this.lightTheme = {
|
|
153
|
+
foreground: '#000',
|
|
154
|
+
background: '#fff',
|
|
155
|
+
cursor: '#616161',
|
|
156
|
+
// md-grey-700
|
|
157
|
+
cursorAccent: '#F5F5F5',
|
|
158
|
+
// md-grey-100
|
|
159
|
+
selectionBackground: 'rgba(97, 97, 97, 0.3)',
|
|
160
|
+
// md-grey-700
|
|
161
|
+
selectionInactiveBackground: 'rgba(189, 189, 189, 0.3)' // md-grey-400
|
|
162
|
+
};
|
|
163
|
+
this.darkTheme = {
|
|
164
|
+
foreground: '#fff',
|
|
165
|
+
background: '#000',
|
|
166
|
+
cursor: '#fff',
|
|
167
|
+
cursorAccent: '#000',
|
|
168
|
+
selectionBackground: 'rgba(255, 255, 255, 0.3)',
|
|
169
|
+
selectionInactiveBackground: 'rgba(238, 238, 238, 0.3)' // md-grey-200
|
|
170
|
+
};
|
|
151
171
|
}
|
|
152
172
|
_createClass(TerminalThemeService, [{
|
|
153
173
|
key: "theme",
|
|
@@ -156,13 +176,14 @@ export var TerminalThemeService = (_dec = singleton(), _dec2 = inject(ColorRegis
|
|
|
156
176
|
var backgroundColor = this.colorRegistry.getCurrentColor('terminal.background') || this.colorRegistry.getCurrentColor('panel.background');
|
|
157
177
|
var cursorColor = this.colorRegistry.getCurrentColor('terminalCursor.foreground') || foregroundColor;
|
|
158
178
|
var cursorAccentColor = this.colorRegistry.getCurrentColor('terminalCursor.background') || backgroundColor;
|
|
159
|
-
var
|
|
179
|
+
var selectionBackground = this.colorRegistry.getCurrentColor('terminal.selectionBackground');
|
|
160
180
|
var theme = {
|
|
161
181
|
background: backgroundColor,
|
|
162
182
|
foreground: foregroundColor,
|
|
163
183
|
cursor: cursorColor,
|
|
164
184
|
cursorAccent: cursorAccentColor,
|
|
165
|
-
|
|
185
|
+
selectionBackground: selectionBackground
|
|
186
|
+
// selection: selectionColor,
|
|
166
187
|
};
|
|
167
188
|
// eslint-disable-next-line guard-for-in
|
|
168
189
|
for (var id in terminalAnsiColorMap) {
|
|
@@ -173,6 +194,20 @@ export var TerminalThemeService = (_dec = singleton(), _dec2 = inject(ColorRegis
|
|
|
173
194
|
}
|
|
174
195
|
return theme;
|
|
175
196
|
}
|
|
197
|
+
}, {
|
|
198
|
+
key: "getTheme",
|
|
199
|
+
value: function getTheme() {
|
|
200
|
+
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'light';
|
|
201
|
+
switch (type) {
|
|
202
|
+
case 'light':
|
|
203
|
+
return this.lightTheme;
|
|
204
|
+
case 'dark':
|
|
205
|
+
return this.darkTheme;
|
|
206
|
+
case 'default':
|
|
207
|
+
default:
|
|
208
|
+
return this.theme;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
176
211
|
}]);
|
|
177
212
|
return TerminalThemeService;
|
|
178
213
|
}(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "colorRegistry", [_dec2], {
|