@jupyter-notebook/notebook-extension 7.0.0-alpha.3 → 7.0.0-alpha.4
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.js +25 -20
- package/package.json +10 -10
- package/schema/checkpoints.json +10 -0
- package/schema/kernel-logo.json +10 -0
- package/style/base.css +13 -0
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright (c) Jupyter Development Team.
|
|
2
2
|
// Distributed under the terms of the Modified BSD License.
|
|
3
|
-
import { DOMUtils } from '@jupyterlab/apputils';
|
|
3
|
+
import { DOMUtils, IToolbarWidgetRegistry } from '@jupyterlab/apputils';
|
|
4
4
|
import { Text, Time } from '@jupyterlab/coreutils';
|
|
5
5
|
import { IDocumentManager } from '@jupyterlab/docmanager';
|
|
6
6
|
import { NotebookPanel, INotebookTracker } from '@jupyterlab/notebook';
|
|
@@ -36,14 +36,19 @@ const checkpoints = {
|
|
|
36
36
|
id: '@jupyter-notebook/notebook-extension:checkpoints',
|
|
37
37
|
autoStart: true,
|
|
38
38
|
requires: [IDocumentManager, ITranslator],
|
|
39
|
-
optional: [INotebookShell],
|
|
40
|
-
activate: (app, docManager, translator, notebookShell) => {
|
|
39
|
+
optional: [INotebookShell, IToolbarWidgetRegistry],
|
|
40
|
+
activate: (app, docManager, translator, notebookShell, toolbarRegistry) => {
|
|
41
41
|
const { shell } = app;
|
|
42
42
|
const trans = translator.load('notebook');
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
const node = document.createElement('div');
|
|
44
|
+
if (toolbarRegistry) {
|
|
45
|
+
toolbarRegistry.addFactory('TopBar', 'checkpoint', toolbar => {
|
|
46
|
+
const widget = new Widget({ node });
|
|
47
|
+
widget.id = DOMUtils.createDomID();
|
|
48
|
+
widget.addClass('jp-NotebookCheckpoint');
|
|
49
|
+
return widget;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
47
52
|
const onChange = async () => {
|
|
48
53
|
const current = shell.currentWidget;
|
|
49
54
|
if (!current) {
|
|
@@ -57,7 +62,7 @@ const checkpoints = {
|
|
|
57
62
|
return;
|
|
58
63
|
}
|
|
59
64
|
const checkpoint = checkpoints[checkpoints.length - 1];
|
|
60
|
-
|
|
65
|
+
node.textContent = trans.__('Last Checkpoint: %1', Time.formatHuman(new Date(checkpoint.last_modified)));
|
|
61
66
|
};
|
|
62
67
|
if (notebookShell) {
|
|
63
68
|
notebookShell.currentChanged.connect(onChange);
|
|
@@ -80,15 +85,14 @@ const kernelLogo = {
|
|
|
80
85
|
id: '@jupyter-notebook/notebook-extension:kernel-logo',
|
|
81
86
|
autoStart: true,
|
|
82
87
|
requires: [INotebookShell],
|
|
83
|
-
|
|
88
|
+
optional: [IToolbarWidgetRegistry],
|
|
89
|
+
activate: (app, shell, toolbarRegistry) => {
|
|
84
90
|
const { serviceManager } = app;
|
|
85
|
-
|
|
91
|
+
const node = document.createElement('div');
|
|
92
|
+
const img = document.createElement('img');
|
|
93
|
+
node.appendChild(img);
|
|
86
94
|
const onChange = async () => {
|
|
87
95
|
var _a, _b, _c, _d, _e;
|
|
88
|
-
if (widget) {
|
|
89
|
-
widget.dispose();
|
|
90
|
-
widget.parent = null;
|
|
91
|
-
}
|
|
92
96
|
const current = shell.currentWidget;
|
|
93
97
|
if (!(current instanceof NotebookPanel)) {
|
|
94
98
|
return;
|
|
@@ -105,15 +109,16 @@ const kernelLogo = {
|
|
|
105
109
|
if (!kernelIconUrl) {
|
|
106
110
|
return;
|
|
107
111
|
}
|
|
108
|
-
const node = document.createElement('div');
|
|
109
|
-
const img = document.createElement('img');
|
|
110
112
|
img.src = kernelIconUrl;
|
|
111
113
|
img.title = spec.display_name;
|
|
112
|
-
node.appendChild(img);
|
|
113
|
-
widget = new Widget({ node });
|
|
114
|
-
widget.addClass('jp-NotebookKernelLogo');
|
|
115
|
-
app.shell.add(widget, 'top', { rank: 10010 });
|
|
116
114
|
};
|
|
115
|
+
if (toolbarRegistry) {
|
|
116
|
+
toolbarRegistry.addFactory('TopBar', 'kernelLogo', toolbar => {
|
|
117
|
+
const widget = new Widget({ node });
|
|
118
|
+
widget.addClass('jp-NotebookKernelLogo');
|
|
119
|
+
return widget;
|
|
120
|
+
});
|
|
121
|
+
}
|
|
117
122
|
app.started.then(() => {
|
|
118
123
|
shell.currentChanged.connect(onChange);
|
|
119
124
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyter-notebook/notebook-extension",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.4",
|
|
4
4
|
"description": "Jupyter Notebook - Notebook Extension",
|
|
5
5
|
"homepage": "https://github.com/jupyter/notebook",
|
|
6
6
|
"bugs": {
|
|
@@ -39,16 +39,16 @@
|
|
|
39
39
|
"watch": "tsc -b --watch"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@jupyter-notebook/application": "^7.0.0-alpha.
|
|
43
|
-
"@jupyterlab/application": "^4.0.0-alpha.
|
|
44
|
-
"@jupyterlab/apputils": "^4.0.0-alpha.
|
|
45
|
-
"@jupyterlab/cells": "^4.0.0-alpha.
|
|
46
|
-
"@jupyterlab/docmanager": "^4.0.0-alpha.
|
|
47
|
-
"@jupyterlab/notebook": "^4.0.0-alpha.
|
|
48
|
-
"@jupyterlab/settingregistry": "^4.0.0-alpha.
|
|
49
|
-
"@jupyterlab/translation": "^4.0.0-alpha.
|
|
42
|
+
"@jupyter-notebook/application": "^7.0.0-alpha.4",
|
|
43
|
+
"@jupyterlab/application": "^4.0.0-alpha.10",
|
|
44
|
+
"@jupyterlab/apputils": "^4.0.0-alpha.10",
|
|
45
|
+
"@jupyterlab/cells": "^4.0.0-alpha.10",
|
|
46
|
+
"@jupyterlab/docmanager": "^4.0.0-alpha.10",
|
|
47
|
+
"@jupyterlab/notebook": "^4.0.0-alpha.10",
|
|
48
|
+
"@jupyterlab/settingregistry": "^4.0.0-alpha.10",
|
|
49
|
+
"@jupyterlab/translation": "^4.0.0-alpha.10",
|
|
50
50
|
"@lumino/polling": "^1.10.0",
|
|
51
|
-
"@lumino/widgets": "^1.
|
|
51
|
+
"@lumino/widgets": "^1.32.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"rimraf": "~3.0.0",
|
package/style/base.css
CHANGED
|
@@ -46,6 +46,19 @@ body[data-notebook='notebooks'] .jp-Notebook.jp-mod-scrollPastEnd::after {
|
|
|
46
46
|
min-height: var(--jp-notebook-padding);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
/* Cell toolbar adjustements */
|
|
50
|
+
|
|
51
|
+
body[data-notebook='notebooks'] .jp-cell-toolbar {
|
|
52
|
+
background: unset;
|
|
53
|
+
top: unset;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@media only screen and (max-width: 760px) {
|
|
57
|
+
body[data-notebook='notebooks'] .jp-cell-toolbar {
|
|
58
|
+
top: 5px;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
49
62
|
/* ---- */
|
|
50
63
|
|
|
51
64
|
.jp-NotebookKernelLogo {
|