@fails-components/jupyter-applet-view 0.0.1-alpha.12 → 0.0.1-alpha.8
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 +1 -8
- package/lib/splitviewnotebookpanel.js +3 -11
- package/package.json +3 -3
- package/src/avoutputarea.ts +1 -9
- package/src/splitviewnotebookpanel.ts +3 -11
- 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 = 'Applets Preview';
|
|
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,18 +721,11 @@ 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
|
-
}
|
|
728
724
|
handle.removeChild(editLabel);
|
|
729
725
|
handle.appendChild(staticLabel);
|
|
730
726
|
});
|
|
731
727
|
editLabel.addEventListener('keydown', (ev) => {
|
|
732
728
|
if (ev.key === 'Enter') {
|
|
733
|
-
if (editLabel.value !== title) {
|
|
734
|
-
editLabel.dispatchEvent(new Event('change', { bubbles: true }));
|
|
735
|
-
}
|
|
736
729
|
handle.removeChild(editLabel);
|
|
737
730
|
handle.appendChild(staticLabel);
|
|
738
731
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NotebookPanel, NotebookHistory, NotebookWidgetFactory } from '@jupyterlab/notebook';
|
|
2
|
-
import { BoxLayout,
|
|
2
|
+
import { BoxLayout, SplitPanel } from '@lumino/widgets';
|
|
3
3
|
import { AppletViewOutputArea } from './avoutputarea';
|
|
4
4
|
export class SplitViewNotebookPanel extends NotebookPanel {
|
|
5
5
|
constructor(options, failsLauncherInfo, failsInterceptor) {
|
|
@@ -11,10 +11,9 @@ 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 SplitPanel({
|
|
15
15
|
spacing: 1,
|
|
16
|
-
orientation: 'horizontal'
|
|
17
|
-
alignment: 'justify'
|
|
16
|
+
orientation: 'horizontal'
|
|
18
17
|
});
|
|
19
18
|
BoxLayout.setStretch(splitPanel, 1);
|
|
20
19
|
// 3. add content to the BoxLayout, as well as a applet view area
|
|
@@ -27,8 +26,6 @@ export class SplitViewNotebookPanel extends NotebookPanel {
|
|
|
27
26
|
}));
|
|
28
27
|
splitPanel.addWidget(widget);
|
|
29
28
|
layout.addWidget(splitPanel);
|
|
30
|
-
const splitLayout = splitPanel.layout;
|
|
31
|
-
splitLayout.titleSpace = 22;
|
|
32
29
|
// move to separate handler
|
|
33
30
|
if (failsLauncherInfo === null || failsLauncherInfo === void 0 ? void 0 : failsLauncherInfo.inLecture) {
|
|
34
31
|
this.toolbar.hide();
|
|
@@ -36,7 +33,6 @@ export class SplitViewNotebookPanel extends NotebookPanel {
|
|
|
36
33
|
this._appletviewWidget.inLecture = true;
|
|
37
34
|
content.hide();
|
|
38
35
|
splitPanel.setRelativeSizes([0, 1]); // change sizes
|
|
39
|
-
splitLayout.titleSpace = 0;
|
|
40
36
|
}
|
|
41
37
|
if (failsLauncherInfo) {
|
|
42
38
|
failsLauncherInfo.inLectureChanged.connect((sender, newInLecture) => {
|
|
@@ -45,8 +41,6 @@ export class SplitViewNotebookPanel extends NotebookPanel {
|
|
|
45
41
|
this.addClass('fl-jl-notebook-inlecture');
|
|
46
42
|
this._appletviewWidget.inLecture = true;
|
|
47
43
|
content.hide();
|
|
48
|
-
widget.show();
|
|
49
|
-
splitLayout.titleSpace = 0;
|
|
50
44
|
splitPanel.setRelativeSizes([0, 1]); // change sizes
|
|
51
45
|
}
|
|
52
46
|
else {
|
|
@@ -54,10 +48,8 @@ export class SplitViewNotebookPanel extends NotebookPanel {
|
|
|
54
48
|
this.removeClass('fl-jl-notebook-inlecture');
|
|
55
49
|
this._appletviewWidget.inLecture = false;
|
|
56
50
|
content.show();
|
|
57
|
-
splitLayout.titleSpace = 22;
|
|
58
51
|
splitPanel.setRelativeSizes([1, 1]); // change sizes
|
|
59
52
|
widget.unselectApplet();
|
|
60
|
-
setTimeout(() => splitPanel.setRelativeSizes([1, 1]), 1);
|
|
61
53
|
}
|
|
62
54
|
});
|
|
63
55
|
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.8",
|
|
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.8",
|
|
62
|
+
"@fails-components/jupyter-launcher": "^0.0.1-alpha.8",
|
|
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 = 'Applets Preview';
|
|
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,19 +935,11 @@ 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
|
-
|
|
943
938
|
handle.removeChild(editLabel);
|
|
944
939
|
handle.appendChild(staticLabel);
|
|
945
940
|
});
|
|
946
941
|
editLabel.addEventListener('keydown', (ev: KeyboardEvent) => {
|
|
947
942
|
if (ev.key === 'Enter') {
|
|
948
|
-
if (editLabel.value !== title) {
|
|
949
|
-
editLabel.dispatchEvent(new Event('change', { bubbles: true }));
|
|
950
|
-
}
|
|
951
943
|
handle.removeChild(editLabel);
|
|
952
944
|
handle.appendChild(staticLabel);
|
|
953
945
|
}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
NotebookWidgetFactory,
|
|
8
8
|
StaticNotebook
|
|
9
9
|
} from '@jupyterlab/notebook';
|
|
10
|
-
import { BoxLayout,
|
|
10
|
+
import { BoxLayout, SplitPanel } from '@lumino/widgets';
|
|
11
11
|
import { AppletViewOutputArea } from './avoutputarea';
|
|
12
12
|
import {
|
|
13
13
|
IFailsLauncherInfo,
|
|
@@ -39,10 +39,9 @@ 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 SplitPanel({
|
|
43
43
|
spacing: 1,
|
|
44
|
-
orientation: 'horizontal'
|
|
45
|
-
alignment: 'justify'
|
|
44
|
+
orientation: 'horizontal'
|
|
46
45
|
});
|
|
47
46
|
BoxLayout.setStretch(splitPanel, 1);
|
|
48
47
|
|
|
@@ -56,8 +55,6 @@ export class SplitViewNotebookPanel
|
|
|
56
55
|
}));
|
|
57
56
|
splitPanel.addWidget(widget);
|
|
58
57
|
layout.addWidget(splitPanel);
|
|
59
|
-
const splitLayout = splitPanel.layout as AccordionLayout;
|
|
60
|
-
splitLayout.titleSpace = 22;
|
|
61
58
|
// move to separate handler
|
|
62
59
|
if (failsLauncherInfo?.inLecture) {
|
|
63
60
|
this.toolbar.hide();
|
|
@@ -65,7 +62,6 @@ export class SplitViewNotebookPanel
|
|
|
65
62
|
this._appletviewWidget.inLecture = true;
|
|
66
63
|
content.hide();
|
|
67
64
|
splitPanel.setRelativeSizes([0, 1]); // change sizes
|
|
68
|
-
splitLayout.titleSpace = 0;
|
|
69
65
|
}
|
|
70
66
|
if (failsLauncherInfo) {
|
|
71
67
|
failsLauncherInfo.inLectureChanged.connect(
|
|
@@ -75,18 +71,14 @@ export class SplitViewNotebookPanel
|
|
|
75
71
|
this.addClass('fl-jl-notebook-inlecture');
|
|
76
72
|
this._appletviewWidget.inLecture = true;
|
|
77
73
|
content.hide();
|
|
78
|
-
widget.show();
|
|
79
|
-
splitLayout.titleSpace = 0;
|
|
80
74
|
splitPanel.setRelativeSizes([0, 1]); // change sizes
|
|
81
75
|
} else {
|
|
82
76
|
this.toolbar.show();
|
|
83
77
|
this.removeClass('fl-jl-notebook-inlecture');
|
|
84
78
|
this._appletviewWidget.inLecture = false;
|
|
85
79
|
content.show();
|
|
86
|
-
splitLayout.titleSpace = 22;
|
|
87
80
|
splitPanel.setRelativeSizes([1, 1]); // change sizes
|
|
88
81
|
widget.unselectApplet();
|
|
89
|
-
setTimeout(() => splitPanel.setRelativeSizes([1, 1]), 1);
|
|
90
82
|
}
|
|
91
83
|
}
|
|
92
84
|
);
|