@jupyter-notebook/console-extension 7.0.0-alpha.1

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/index.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { JupyterFrontEndPlugin } from '@jupyterlab/application';
2
+ /**
3
+ * Export the plugins as default.
4
+ */
5
+ declare const plugins: JupyterFrontEndPlugin<any>[];
6
+ export default plugins;
package/lib/index.js ADDED
@@ -0,0 +1,63 @@
1
+ // Copyright (c) Jupyter Development Team.
2
+ // Distributed under the terms of the Modified BSD License.
3
+ import { IRouter } from '@jupyterlab/application';
4
+ import { IConsoleTracker } from '@jupyterlab/console';
5
+ import { PageConfig } from '@jupyterlab/coreutils';
6
+ import { find } from '@lumino/algorithm';
7
+ /**
8
+ * A plugin to open consoles in a new tab
9
+ */
10
+ const opener = {
11
+ id: '@jupyter-notebook/console-extension:opener',
12
+ requires: [IRouter],
13
+ autoStart: true,
14
+ activate: (app, router) => {
15
+ const { commands } = app;
16
+ const consolePattern = new RegExp('/consoles/(.*)');
17
+ const command = 'router:console';
18
+ commands.addCommand(command, {
19
+ execute: (args) => {
20
+ const parsed = args;
21
+ const matches = parsed.path.match(consolePattern);
22
+ if (!matches) {
23
+ return;
24
+ }
25
+ const [, match] = matches;
26
+ if (!match) {
27
+ return;
28
+ }
29
+ const path = decodeURIComponent(match);
30
+ commands.execute('console:create', { path });
31
+ }
32
+ });
33
+ router.register({ command, pattern: consolePattern });
34
+ }
35
+ };
36
+ /**
37
+ * Open consoles in a new tab.
38
+ */
39
+ const redirect = {
40
+ id: '@jupyter-notebook/console-extension:redirect',
41
+ requires: [IConsoleTracker],
42
+ autoStart: true,
43
+ activate: (app, tracker) => {
44
+ const baseUrl = PageConfig.getBaseUrl();
45
+ tracker.widgetAdded.connect(async (send, console) => {
46
+ const { sessionContext } = console;
47
+ await sessionContext.ready;
48
+ const widget = find(app.shell.widgets('main'), w => w.id === console.id);
49
+ if (widget) {
50
+ // bail if the console is already added to the main area
51
+ return;
52
+ }
53
+ window.open(`${baseUrl}consoles/${sessionContext.path}`, '_blank');
54
+ // the widget is not needed anymore
55
+ console.dispose();
56
+ });
57
+ }
58
+ };
59
+ /**
60
+ * Export the plugins as default.
61
+ */
62
+ const plugins = [opener, redirect];
63
+ export default plugins;
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@jupyter-notebook/console-extension",
3
+ "version": "7.0.0-alpha.1",
4
+ "description": "Jupyter Notebook - Console Extension",
5
+ "homepage": "https://github.com/jupyter/notebook",
6
+ "bugs": {
7
+ "url": "https://github.com/jupyter/notebook/issues"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/jupyter/notebook.git"
12
+ },
13
+ "license": "BSD-3-Clause",
14
+ "author": "Project Jupyter",
15
+ "sideEffects": [
16
+ "style/**/*.css",
17
+ "style/index.js"
18
+ ],
19
+ "main": "lib/index.js",
20
+ "types": "lib/index.d.ts",
21
+ "style": "style/index.css",
22
+ "directories": {
23
+ "lib": "lib/"
24
+ },
25
+ "files": [
26
+ "lib/*.d.ts",
27
+ "lib/*.js.map",
28
+ "lib/*.js",
29
+ "schema/*.json",
30
+ "style/**/*.css",
31
+ "style/index.js"
32
+ ],
33
+ "scripts": {
34
+ "build": "tsc -b",
35
+ "build:prod": "tsc -b",
36
+ "clean": "rimraf lib && rimraf tsconfig.tsbuildinfo",
37
+ "docs": "typedoc src",
38
+ "prepublishOnly": "npm run build",
39
+ "watch": "tsc -b --watch"
40
+ },
41
+ "dependencies": {
42
+ "@jupyterlab/application": "^4.0.0-alpha.5",
43
+ "@jupyterlab/console": "^4.0.0-alpha.5",
44
+ "@jupyterlab/coreutils": "^6.0.0-alpha.5",
45
+ "@lumino/algorithm": "^1.9.1"
46
+ },
47
+ "devDependencies": {
48
+ "rimraf": "~3.0.0",
49
+ "typescript": "~4.1.3"
50
+ },
51
+ "publishConfig": {
52
+ "access": "public"
53
+ },
54
+ "jupyterlab": {
55
+ "extension": true
56
+ },
57
+ "styleModule": "style/index.js"
58
+ }
package/style/base.css ADDED
File without changes
@@ -0,0 +1 @@
1
+ @import url('./base.css');
package/style/index.js ADDED
@@ -0,0 +1 @@
1
+ import './base.css';