@jupyterlite/terminal 1.0.1 → 1.1.0

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/README.md CHANGED
@@ -1,7 +1,7 @@
1
- # jupyterlite-terminal
1
+ # JupyterLite Terminal
2
2
 
3
3
  [![Github Actions Status](https://github.com/jupyterlite/terminal/workflows/Build/badge.svg)](https://github.com/jupyterlite/terminal/actions/workflows/build.yml)
4
- [![lite-badge](https://jupyterlite.rtfd.io/en/latest/_static/badge.svg)](https://jupyterlite-terminal.vercel.app/)
4
+ [![lite-badge](https://jupyterlite.rtfd.io/en/latest/_static/badge.svg)](https://jupyterlite.github.io/terminal/)
5
5
 
6
6
  A terminal for JupyterLite.
7
7
 
@@ -11,7 +11,7 @@ A terminal for JupyterLite.
11
11
 
12
12
  ## Requirements
13
13
 
14
- - JupyterLite >= 0.6.0
14
+ - JupyterLite >= 0.6.0, < 0.8.0
15
15
 
16
16
  ## Install
17
17
 
@@ -54,6 +54,7 @@ include imports from both `jupyterlite-terminal` and `cockle`, such as if you ar
54
54
 
55
55
  | `jupyterlite-terminal` | `cockle` | `jupyterlite-core` |
56
56
  | ---------------------- | -------- | ------------------ |
57
+ | 1.0.1 | 1.0.0 | >= 0.6, < 0.8 |
57
58
  | 1.0.0 | 1.0.0 | >= 0.6, < 0.7 |
58
59
  | 0.2.2 | 0.1.3 | >= 0.6, < 0.7 |
59
60
 
@@ -118,6 +119,25 @@ or:
118
119
  jupyter lite serve --LiteBuildConfig.extra_http_headers=Cross-Origin-Embedder-Policy=require-corp --LiteBuildConfig.extra_http_headers=Cross-Origin-Opener-Policy=same-origin
119
120
  ```
120
121
 
122
+ ### Building the documentation
123
+
124
+ The project documentation includes a demo deployment, and is built on every PR so that the changes can be checked manually before merging. To build the documentation and demo locally use:
125
+
126
+ ```bash
127
+ micromamba create -f docs/environment-docs.yml
128
+ micromamba activate terminal-docs
129
+ pip install -v .
130
+ cd docs
131
+ make html
132
+ ```
133
+
134
+ To serve this locally use:
135
+
136
+ ```bash
137
+ cd _build/html
138
+ python -m http.server
139
+ ```
140
+
121
141
  ### Packaging the extension
122
142
 
123
143
  See [RELEASE](RELEASE.md)
package/lib/client.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { ServerConnection, Terminal } from '@jupyterlab/services';
2
2
  import { IExternalCommand, IStdinReply, IStdinRequest } from '@jupyterlite/cockle';
3
+ import { ISignal } from '@lumino/signaling';
3
4
  import { ILiteTerminalAPIClient } from './tokens';
4
5
  export declare class LiteTerminalAPIClient implements ILiteTerminalAPIClient {
5
6
  constructor(options?: {
@@ -21,6 +22,7 @@ export declare class LiteTerminalAPIClient implements ILiteTerminalAPIClient {
21
22
  registerEnvironmentVariable(key: string, value: string | undefined): void;
22
23
  registerExternalCommand(options: IExternalCommand.IOptions): void;
23
24
  shutdown(name: string): Promise<void>;
25
+ get terminalDisposed(): ISignal<this, string>;
24
26
  themeChange(isDarkMode?: boolean): void;
25
27
  private get _models();
26
28
  private _nextAvailableName;
@@ -30,4 +32,5 @@ export declare class LiteTerminalAPIClient implements ILiteTerminalAPIClient {
30
32
  private _externalCommands;
31
33
  private _shellManager;
32
34
  private _shells;
35
+ private _terminalDisposed;
33
36
  }
package/lib/client.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { PageConfig, URLExt } from '@jupyterlab/coreutils';
2
2
  import { ServerConnection } from '@jupyterlab/services';
3
3
  import { ShellManager } from '@jupyterlite/cockle';
4
+ import { Signal } from '@lumino/signaling';
4
5
  import { Server as WebSocketServer } from 'mock-socket';
5
6
  import { Shell } from './shell';
6
7
  export class LiteTerminalAPIClient {
@@ -8,6 +9,7 @@ export class LiteTerminalAPIClient {
8
9
  var _a;
9
10
  this._externalCommands = [];
10
11
  this._shells = new Map();
12
+ this._terminalDisposed = new Signal(this);
11
13
  this.serverSettings =
12
14
  (_a = options.serverSettings) !== null && _a !== void 0 ? _a : ServerConnection.makeSettings();
13
15
  this._shellManager = new ShellManager();
@@ -83,6 +85,7 @@ export class LiteTerminalAPIClient {
83
85
  shell.disposed.connect(() => {
84
86
  this.shutdown(name);
85
87
  wsServer.close();
88
+ this._terminalDisposed.emit(shell.shellId);
86
89
  });
87
90
  return { name };
88
91
  }
@@ -114,11 +117,12 @@ export class LiteTerminalAPIClient {
114
117
  shell.dispose();
115
118
  }
116
119
  }
120
+ get terminalDisposed() {
121
+ return this._terminalDisposed;
122
+ }
117
123
  themeChange(isDarkMode) {
118
124
  for (const shell of this._shells.values()) {
119
- // Can pass isDarkMode when cockle is released with PR #232.
120
- //shell.themeChange(isDarkMode);
121
- shell.themeChange();
125
+ shell.themeChange(isDarkMode);
122
126
  }
123
127
  }
124
128
  get _models() {
package/lib/tokens.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Terminal } from '@jupyterlab/services';
2
2
  import { IExternalCommand, IStdinReply, IStdinRequest } from '@jupyterlite/cockle';
3
3
  import { Token } from '@lumino/coreutils';
4
+ import { ISignal } from '@lumino/signaling';
4
5
  export declare const ILiteTerminalAPIClient: Token<ILiteTerminalAPIClient>;
5
6
  export interface ILiteTerminalAPIClient extends Terminal.ITerminalAPIClient {
6
7
  /**
@@ -26,6 +27,11 @@ export interface ILiteTerminalAPIClient extends Terminal.ITerminalAPIClient {
26
27
  * Register an external command that will be available in all terminals.
27
28
  */
28
29
  registerExternalCommand(options: IExternalCommand.IOptions): void;
30
+ /**
31
+ * Signal emitted when a terminal is disposed.
32
+ * The string argument is the terminal `name` which is the same as the Shell's `shellId`.
33
+ */
34
+ terminalDisposed: ISignal<this, string>;
29
35
  /**
30
36
  * Inform all terminals that the theme has changed so that they can react to it if they wish.
31
37
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyterlite/terminal",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "A terminal for JupyterLite",
5
5
  "keywords": [
6
6
  "jupyter",
@@ -63,10 +63,11 @@
63
63
  "@jupyterlab/coreutils": "^6.4.3",
64
64
  "@jupyterlab/services": "^7.4.3",
65
65
  "@jupyterlab/settingregistry": "^4.4.3",
66
- "@jupyterlite/cockle": "^1.0.0",
66
+ "@jupyterlite/cockle": "^1.2.0",
67
67
  "@jupyterlite/contents": "^0.6.0",
68
68
  "@jupyterlite/server": "^0.6.0",
69
- "@lumino/coreutils": "^2.2.0",
69
+ "@lumino/coreutils": "^2.2.1",
70
+ "@lumino/signaling": "^2.1.4",
70
71
  "mock-socket": "^9.3.1"
71
72
  },
72
73
  "devDependencies": {
package/src/client.ts CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  ShellManager
9
9
  } from '@jupyterlite/cockle';
10
10
  import { JSONPrimitive } from '@lumino/coreutils';
11
+ import { ISignal, Signal } from '@lumino/signaling';
11
12
 
12
13
  import {
13
14
  Server as WebSocketServer,
@@ -111,6 +112,7 @@ export class LiteTerminalAPIClient implements ILiteTerminalAPIClient {
111
112
  shell.disposed.connect(() => {
112
113
  this.shutdown(name);
113
114
  wsServer.close();
115
+ this._terminalDisposed.emit(shell.shellId);
114
116
  });
115
117
 
116
118
  return { name };
@@ -148,12 +150,13 @@ export class LiteTerminalAPIClient implements ILiteTerminalAPIClient {
148
150
  }
149
151
  }
150
152
 
153
+ get terminalDisposed(): ISignal<this, string> {
154
+ return this._terminalDisposed;
155
+ }
156
+
151
157
  themeChange(isDarkMode?: boolean): void {
152
158
  for (const shell of this._shells.values()) {
153
- // Can pass isDarkMode when cockle is released with PR #232.
154
- //shell.themeChange(isDarkMode);
155
-
156
- shell.themeChange();
159
+ shell.themeChange(isDarkMode);
157
160
  }
158
161
  }
159
162
 
@@ -178,4 +181,5 @@ export class LiteTerminalAPIClient implements ILiteTerminalAPIClient {
178
181
  private _externalCommands: IExternalCommand.IOptions[] = [];
179
182
  private _shellManager: IShellManager;
180
183
  private _shells = new Map<string, Shell>();
184
+ private _terminalDisposed = new Signal<this, string>(this);
181
185
  }
package/src/tokens.ts CHANGED
@@ -5,6 +5,7 @@ import {
5
5
  IStdinRequest
6
6
  } from '@jupyterlite/cockle';
7
7
  import { Token } from '@lumino/coreutils';
8
+ import { ISignal } from '@lumino/signaling';
8
9
 
9
10
  export const ILiteTerminalAPIClient = new Token<ILiteTerminalAPIClient>(
10
11
  '@jupyterlite/terminal:client'
@@ -39,6 +40,12 @@ export interface ILiteTerminalAPIClient extends Terminal.ITerminalAPIClient {
39
40
  */
40
41
  registerExternalCommand(options: IExternalCommand.IOptions): void;
41
42
 
43
+ /**
44
+ * Signal emitted when a terminal is disposed.
45
+ * The string argument is the terminal `name` which is the same as the Shell's `shellId`.
46
+ */
47
+ terminalDisposed: ISignal<this, string>;
48
+
42
49
  /**
43
50
  * Inform all terminals that the theme has changed so that they can react to it if they wish.
44
51
  */