@fails-components/jupyter-applet-view 0.0.1-alpha.10 → 0.0.1-alpha.12
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/avoutputarea.js +8 -1
- package/lib/splitviewnotebookpanel.js +11 -3
- package/package.json +3 -3
- package/src/avoutputarea.ts +9 -1
- package/src/splitviewnotebookpanel.ts +11 -3
- package/style/index.css +1 -1
package/lib/avoutputarea.js
CHANGED
|
@@ -48,7 +48,7 @@ export class AppletViewOutputArea extends AccordionPanel {
|
|
|
48
48
|
this.addApplet({ appid, appname: 'Applet 1' });
|
|
49
49
|
}
|
|
50
50
|
this.id = `AppletView-${UUID.uuid4()}`;
|
|
51
|
-
this.title.label = '
|
|
51
|
+
this.title.label = 'Applet area';
|
|
52
52
|
this.title.icon = notebookIcon;
|
|
53
53
|
this.title.caption = this._notebook.title.label
|
|
54
54
|
? trans.__('For Notebook: %1', this._notebook.title.label)
|
|
@@ -721,11 +721,18 @@ export class AppletViewRenderer extends AccordionPanel.Renderer {
|
|
|
721
721
|
handle.appendChild(editLabel);
|
|
722
722
|
});
|
|
723
723
|
editLabel.addEventListener('blur', (ev) => {
|
|
724
|
+
// Firefox and Safari needs this
|
|
725
|
+
if (editLabel.value !== title) {
|
|
726
|
+
editLabel.dispatchEvent(new Event('change', { bubbles: true }));
|
|
727
|
+
}
|
|
724
728
|
handle.removeChild(editLabel);
|
|
725
729
|
handle.appendChild(staticLabel);
|
|
726
730
|
});
|
|
727
731
|
editLabel.addEventListener('keydown', (ev) => {
|
|
728
732
|
if (ev.key === 'Enter') {
|
|
733
|
+
if (editLabel.value !== title) {
|
|
734
|
+
editLabel.dispatchEvent(new Event('change', { bubbles: true }));
|
|
735
|
+
}
|
|
729
736
|
handle.removeChild(editLabel);
|
|
730
737
|
handle.appendChild(staticLabel);
|
|
731
738
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NotebookPanel, NotebookHistory, NotebookWidgetFactory } from '@jupyterlab/notebook';
|
|
2
|
-
import { BoxLayout,
|
|
2
|
+
import { BoxLayout, AccordionPanel } from '@lumino/widgets';
|
|
3
3
|
import { AppletViewOutputArea } from './avoutputarea';
|
|
4
4
|
export class SplitViewNotebookPanel extends NotebookPanel {
|
|
5
5
|
constructor(options, failsLauncherInfo, failsInterceptor) {
|
|
@@ -11,9 +11,10 @@ export class SplitViewNotebookPanel extends NotebookPanel {
|
|
|
11
11
|
const layout = this.layout;
|
|
12
12
|
layout.removeWidget(content);
|
|
13
13
|
// 2. add a BoxLayout instead
|
|
14
|
-
const splitPanel = new
|
|
14
|
+
const splitPanel = new AccordionPanel({
|
|
15
15
|
spacing: 1,
|
|
16
|
-
orientation: 'horizontal'
|
|
16
|
+
orientation: 'horizontal',
|
|
17
|
+
alignment: 'justify'
|
|
17
18
|
});
|
|
18
19
|
BoxLayout.setStretch(splitPanel, 1);
|
|
19
20
|
// 3. add content to the BoxLayout, as well as a applet view area
|
|
@@ -26,6 +27,8 @@ export class SplitViewNotebookPanel extends NotebookPanel {
|
|
|
26
27
|
}));
|
|
27
28
|
splitPanel.addWidget(widget);
|
|
28
29
|
layout.addWidget(splitPanel);
|
|
30
|
+
const splitLayout = splitPanel.layout;
|
|
31
|
+
splitLayout.titleSpace = 22;
|
|
29
32
|
// move to separate handler
|
|
30
33
|
if (failsLauncherInfo === null || failsLauncherInfo === void 0 ? void 0 : failsLauncherInfo.inLecture) {
|
|
31
34
|
this.toolbar.hide();
|
|
@@ -33,6 +36,7 @@ export class SplitViewNotebookPanel extends NotebookPanel {
|
|
|
33
36
|
this._appletviewWidget.inLecture = true;
|
|
34
37
|
content.hide();
|
|
35
38
|
splitPanel.setRelativeSizes([0, 1]); // change sizes
|
|
39
|
+
splitLayout.titleSpace = 0;
|
|
36
40
|
}
|
|
37
41
|
if (failsLauncherInfo) {
|
|
38
42
|
failsLauncherInfo.inLectureChanged.connect((sender, newInLecture) => {
|
|
@@ -41,6 +45,8 @@ export class SplitViewNotebookPanel extends NotebookPanel {
|
|
|
41
45
|
this.addClass('fl-jl-notebook-inlecture');
|
|
42
46
|
this._appletviewWidget.inLecture = true;
|
|
43
47
|
content.hide();
|
|
48
|
+
widget.show();
|
|
49
|
+
splitLayout.titleSpace = 0;
|
|
44
50
|
splitPanel.setRelativeSizes([0, 1]); // change sizes
|
|
45
51
|
}
|
|
46
52
|
else {
|
|
@@ -48,8 +54,10 @@ export class SplitViewNotebookPanel extends NotebookPanel {
|
|
|
48
54
|
this.removeClass('fl-jl-notebook-inlecture');
|
|
49
55
|
this._appletviewWidget.inLecture = false;
|
|
50
56
|
content.show();
|
|
57
|
+
splitLayout.titleSpace = 22;
|
|
51
58
|
splitPanel.setRelativeSizes([1, 1]); // change sizes
|
|
52
59
|
widget.unselectApplet();
|
|
60
|
+
setTimeout(() => splitPanel.setRelativeSizes([1, 1]), 1);
|
|
53
61
|
}
|
|
54
62
|
});
|
|
55
63
|
if (failsLauncherInfo.inLecture &&
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fails-components/jupyter-applet-view",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.12",
|
|
4
4
|
"description": "A collection of extensions, that let's you select cell and switch to an applet mode, where only the selected cells are visible. This is used for fails-components to have jupyter applets in interactive teaching. ",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jupyter",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"watch:labextension": "jupyter labextension watch ."
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@fails-components/jupyter-interceptor": "^0.0.1-alpha.
|
|
62
|
-
"@fails-components/jupyter-launcher": "^0.0.1-alpha.
|
|
61
|
+
"@fails-components/jupyter-interceptor": "^0.0.1-alpha.12",
|
|
62
|
+
"@fails-components/jupyter-launcher": "^0.0.1-alpha.12",
|
|
63
63
|
"@jupyter-notebook/application": "^7.2.0",
|
|
64
64
|
"@jupyter-widgets/jupyterlab-manager": "^5.0.13",
|
|
65
65
|
"@jupyterlab/application": "^4.3.4",
|
package/src/avoutputarea.ts
CHANGED
|
@@ -72,7 +72,7 @@ export class AppletViewOutputArea extends AccordionPanel {
|
|
|
72
72
|
this.addApplet({ appid, appname: 'Applet 1' });
|
|
73
73
|
}
|
|
74
74
|
this.id = `AppletView-${UUID.uuid4()}`;
|
|
75
|
-
this.title.label = '
|
|
75
|
+
this.title.label = 'Applet area';
|
|
76
76
|
this.title.icon = notebookIcon;
|
|
77
77
|
this.title.caption = this._notebook.title.label
|
|
78
78
|
? trans.__('For Notebook: %1', this._notebook.title.label)
|
|
@@ -935,11 +935,19 @@ export class AppletViewRenderer extends AccordionPanel.Renderer {
|
|
|
935
935
|
handle.appendChild(editLabel);
|
|
936
936
|
});
|
|
937
937
|
editLabel.addEventListener('blur', (ev: FocusEvent) => {
|
|
938
|
+
// Firefox and Safari needs this
|
|
939
|
+
if (editLabel.value !== title) {
|
|
940
|
+
editLabel.dispatchEvent(new Event('change', { bubbles: true }));
|
|
941
|
+
}
|
|
942
|
+
|
|
938
943
|
handle.removeChild(editLabel);
|
|
939
944
|
handle.appendChild(staticLabel);
|
|
940
945
|
});
|
|
941
946
|
editLabel.addEventListener('keydown', (ev: KeyboardEvent) => {
|
|
942
947
|
if (ev.key === 'Enter') {
|
|
948
|
+
if (editLabel.value !== title) {
|
|
949
|
+
editLabel.dispatchEvent(new Event('change', { bubbles: true }));
|
|
950
|
+
}
|
|
943
951
|
handle.removeChild(editLabel);
|
|
944
952
|
handle.appendChild(staticLabel);
|
|
945
953
|
}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
NotebookWidgetFactory,
|
|
8
8
|
StaticNotebook
|
|
9
9
|
} from '@jupyterlab/notebook';
|
|
10
|
-
import { BoxLayout,
|
|
10
|
+
import { BoxLayout, AccordionPanel, AccordionLayout } from '@lumino/widgets';
|
|
11
11
|
import { AppletViewOutputArea } from './avoutputarea';
|
|
12
12
|
import {
|
|
13
13
|
IFailsLauncherInfo,
|
|
@@ -39,9 +39,10 @@ export class SplitViewNotebookPanel
|
|
|
39
39
|
const layout = this.layout as BoxLayout;
|
|
40
40
|
layout.removeWidget(content);
|
|
41
41
|
// 2. add a BoxLayout instead
|
|
42
|
-
const splitPanel = new
|
|
42
|
+
const splitPanel = new AccordionPanel({
|
|
43
43
|
spacing: 1,
|
|
44
|
-
orientation: 'horizontal'
|
|
44
|
+
orientation: 'horizontal',
|
|
45
|
+
alignment: 'justify'
|
|
45
46
|
});
|
|
46
47
|
BoxLayout.setStretch(splitPanel, 1);
|
|
47
48
|
|
|
@@ -55,6 +56,8 @@ export class SplitViewNotebookPanel
|
|
|
55
56
|
}));
|
|
56
57
|
splitPanel.addWidget(widget);
|
|
57
58
|
layout.addWidget(splitPanel);
|
|
59
|
+
const splitLayout = splitPanel.layout as AccordionLayout;
|
|
60
|
+
splitLayout.titleSpace = 22;
|
|
58
61
|
// move to separate handler
|
|
59
62
|
if (failsLauncherInfo?.inLecture) {
|
|
60
63
|
this.toolbar.hide();
|
|
@@ -62,6 +65,7 @@ export class SplitViewNotebookPanel
|
|
|
62
65
|
this._appletviewWidget.inLecture = true;
|
|
63
66
|
content.hide();
|
|
64
67
|
splitPanel.setRelativeSizes([0, 1]); // change sizes
|
|
68
|
+
splitLayout.titleSpace = 0;
|
|
65
69
|
}
|
|
66
70
|
if (failsLauncherInfo) {
|
|
67
71
|
failsLauncherInfo.inLectureChanged.connect(
|
|
@@ -71,14 +75,18 @@ export class SplitViewNotebookPanel
|
|
|
71
75
|
this.addClass('fl-jl-notebook-inlecture');
|
|
72
76
|
this._appletviewWidget.inLecture = true;
|
|
73
77
|
content.hide();
|
|
78
|
+
widget.show();
|
|
79
|
+
splitLayout.titleSpace = 0;
|
|
74
80
|
splitPanel.setRelativeSizes([0, 1]); // change sizes
|
|
75
81
|
} else {
|
|
76
82
|
this.toolbar.show();
|
|
77
83
|
this.removeClass('fl-jl-notebook-inlecture');
|
|
78
84
|
this._appletviewWidget.inLecture = false;
|
|
79
85
|
content.show();
|
|
86
|
+
splitLayout.titleSpace = 22;
|
|
80
87
|
splitPanel.setRelativeSizes([1, 1]); // change sizes
|
|
81
88
|
widget.unselectApplet();
|
|
89
|
+
setTimeout(() => splitPanel.setRelativeSizes([1, 1]), 1);
|
|
82
90
|
}
|
|
83
91
|
}
|
|
84
92
|
);
|