jupyter-specta 0.2.1 → 0.3.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/lib/create_notebook_panel.js +1 -1
- package/lib/document/plugin.d.ts +2 -2
- package/lib/document/plugin.js +64 -29
- package/lib/extension_plugins.d.ts +1 -1
- package/lib/sharedscope.d.ts +1 -1
- package/lib/sharedscope.js +1 -1
- package/lib/specta_widget.js +2 -1
- package/lib/token.d.ts +1 -0
- package/lib/tool.js +9 -1
- package/package.json +42 -44
package/lib/document/plugin.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { JupyterFrontEndPlugin } from '@jupyterlab/application';
|
|
1
|
+
import { ILabShell, JupyterFrontEndPlugin } from '@jupyterlab/application';
|
|
2
2
|
import { IWidgetTracker } from '@jupyterlab/apputils';
|
|
3
3
|
import { ISpectaShell } from '../token';
|
|
4
4
|
export declare const spectaDocument: JupyterFrontEndPlugin<IWidgetTracker, ISpectaShell>;
|
|
5
|
-
export declare const spectaOpener: JupyterFrontEndPlugin<void>;
|
|
5
|
+
export declare const spectaOpener: JupyterFrontEndPlugin<void, ILabShell>;
|
package/lib/document/plugin.js
CHANGED
|
@@ -49,47 +49,82 @@ export const spectaOpener = {
|
|
|
49
49
|
IKernelSpecManager
|
|
50
50
|
],
|
|
51
51
|
activate: async (app, docManager, defaultBrowser) => {
|
|
52
|
-
if (!isSpectaApp()) {
|
|
53
|
-
// Not a specta app, return
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
52
|
const urlParams = new URLSearchParams(window.location.search);
|
|
57
53
|
const path = urlParams.get('path');
|
|
58
|
-
if (!
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
if (!isSpectaApp()) {
|
|
55
|
+
if (!path) {
|
|
56
|
+
app.restored.then(async () => {
|
|
57
|
+
await app.commands.execute('application:reset-layout');
|
|
58
|
+
});
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
app.restored.then(async () => {
|
|
62
|
+
const labShell = app.shell;
|
|
63
|
+
if (PathExt.extname(path) === '.ipynb') {
|
|
64
|
+
await app.commands.execute('application:set-mode', {
|
|
65
|
+
mode: 'single-document'
|
|
66
|
+
});
|
|
67
|
+
labShell.collapseLeft();
|
|
68
|
+
labShell.collapseRight();
|
|
69
|
+
if (labShell.isSideTabBarVisible('right')) {
|
|
70
|
+
labShell.toggleSideTabBarVisibility('right');
|
|
71
|
+
}
|
|
72
|
+
if (labShell.isSideTabBarVisible('left')) {
|
|
73
|
+
labShell.toggleSideTabBarVisibility('left');
|
|
74
|
+
}
|
|
75
|
+
if (labShell.isTopInSimpleModeVisible()) {
|
|
76
|
+
await app.commands.execute('application:toggle-header');
|
|
77
|
+
}
|
|
78
|
+
const statusBar = document.getElementById('jp-bottom-panel');
|
|
79
|
+
if (statusBar && statusBar.clientHeight !== 0) {
|
|
80
|
+
await app.commands.execute('statusbar:toggle');
|
|
81
|
+
}
|
|
82
|
+
const widget = docManager.openOrReveal(path, 'specta');
|
|
83
|
+
if (widget) {
|
|
84
|
+
app.shell.add(widget, 'main');
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
// Not a specta app
|
|
89
|
+
return;
|
|
62
90
|
}
|
|
63
91
|
else {
|
|
64
|
-
if (
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
app.shell.add(widget, 'main');
|
|
69
|
-
}
|
|
92
|
+
if (!path) {
|
|
93
|
+
const browser = createFileBrowser({ defaultBrowser });
|
|
94
|
+
app.shell.add(browser, 'main', { rank: 100 });
|
|
95
|
+
hideAppLoadingIndicator();
|
|
70
96
|
}
|
|
71
97
|
else {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const widget = docManager.openOrReveal(path, '
|
|
98
|
+
if (PathExt.extname(path) === '.ipynb') {
|
|
99
|
+
app.shell.addClass('specta-document-viewer');
|
|
100
|
+
const widget = docManager.openOrReveal(path, 'specta');
|
|
75
101
|
if (widget) {
|
|
76
102
|
app.shell.add(widget, 'main');
|
|
77
|
-
hideAppLoadingIndicator();
|
|
78
103
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
let count = 0;
|
|
107
|
+
const tryOpen = () => {
|
|
108
|
+
const widget = docManager.openOrReveal(path, 'default');
|
|
109
|
+
if (widget) {
|
|
85
110
|
app.shell.add(widget, 'main');
|
|
86
111
|
hideAppLoadingIndicator();
|
|
87
|
-
return;
|
|
88
112
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
113
|
+
else {
|
|
114
|
+
count++;
|
|
115
|
+
if (count > 10) {
|
|
116
|
+
console.error('Failed to open file', path);
|
|
117
|
+
const widget = new Widget();
|
|
118
|
+
widget.node.innerHTML = `<h2 style="text-align: center; margin-top: 200px;">Failed to open file ${path}</h2>`;
|
|
119
|
+
app.shell.add(widget, 'main');
|
|
120
|
+
hideAppLoadingIndicator();
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
setTimeout(tryOpen, 100);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
tryOpen();
|
|
127
|
+
}
|
|
93
128
|
}
|
|
94
129
|
}
|
|
95
130
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from './tool';
|
|
2
2
|
export * from './token';
|
|
3
|
-
declare const _default: (import("@jupyterlab/application").JupyterFrontEndPlugin<import("@jupyterlab/apputils").IWidgetTracker<import("@lumino/widgets").Widget>, import("./token").ISpectaShell> | import("@jupyterlab/application").JupyterFrontEndPlugin<import("./token").ISpectaLayoutRegistry> | import("@jupyterlab/application").JupyterFrontEndPlugin<void, import("./token").ISpectaShell>)[];
|
|
3
|
+
declare const _default: (import("@jupyterlab/application").JupyterFrontEndPlugin<import("@jupyterlab/apputils").IWidgetTracker<import("@lumino/widgets").Widget>, import("./token").ISpectaShell> | import("@jupyterlab/application").JupyterFrontEndPlugin<void, import("@jupyterlab/application").ILabShell> | import("@jupyterlab/application").JupyterFrontEndPlugin<import("./token").ISpectaLayoutRegistry> | import("@jupyterlab/application").JupyterFrontEndPlugin<void, import("./token").ISpectaShell>)[];
|
|
4
4
|
export default _default;
|
package/lib/sharedscope.d.ts
CHANGED
package/lib/sharedscope.js
CHANGED
package/lib/specta_widget.js
CHANGED
|
@@ -35,6 +35,7 @@ export class AppWidget extends Panel {
|
|
|
35
35
|
return this._model;
|
|
36
36
|
}
|
|
37
37
|
addSpinner() {
|
|
38
|
+
var _a;
|
|
38
39
|
const loaderHost = (this._loaderHost = new Widget());
|
|
39
40
|
loaderHost.addClass('specta-loader-host');
|
|
40
41
|
const spinner = document.createElement('div');
|
|
@@ -42,7 +43,7 @@ export class AppWidget extends Panel {
|
|
|
42
43
|
loaderHost.node.appendChild(spinner);
|
|
43
44
|
const text = document.createElement('div');
|
|
44
45
|
text.className = 'specta-loading-indicator-text';
|
|
45
|
-
text.textContent = 'Loading Specta';
|
|
46
|
+
text.textContent = (_a = this._spectaAppConfig.loadingName) !== null && _a !== void 0 ? _a : 'Loading Specta';
|
|
46
47
|
loaderHost.node.appendChild(text);
|
|
47
48
|
this.addWidget(loaderHost);
|
|
48
49
|
}
|
package/lib/token.d.ts
CHANGED
package/lib/tool.js
CHANGED
|
@@ -122,13 +122,21 @@ export function readSpectaConfig({ nbMetadata, nbPath }) {
|
|
|
122
122
|
if (perFileConfig && pathWithoutDrive && perFileConfig[pathWithoutDrive]) {
|
|
123
123
|
spectaConfig = Object.assign(Object.assign({}, spectaConfig), perFileConfig[pathWithoutDrive]);
|
|
124
124
|
}
|
|
125
|
-
const spectaMetadata = ((_a = nbMetadata === null || nbMetadata === void 0 ? void 0 : nbMetadata.specta) !== null && _a !== void 0 ? _a : {});
|
|
125
|
+
const spectaMetadata = JSON.parse(JSON.stringify((_a = nbMetadata === null || nbMetadata === void 0 ? void 0 : nbMetadata.specta) !== null && _a !== void 0 ? _a : {}));
|
|
126
126
|
if (spectaMetadata.hideTopbar === 'Yes') {
|
|
127
127
|
spectaMetadata.hideTopbar = true;
|
|
128
128
|
}
|
|
129
129
|
else if (spectaMetadata.hideTopbar === 'No') {
|
|
130
130
|
spectaMetadata.hideTopbar = false;
|
|
131
131
|
}
|
|
132
|
+
else {
|
|
133
|
+
if (spectaConfig.hideTopbar === null ||
|
|
134
|
+
spectaConfig.hideTopbar === undefined) {
|
|
135
|
+
// Hide topbar by default if not specified in the global config
|
|
136
|
+
// and notebook metadata
|
|
137
|
+
spectaMetadata.hideTopbar = true;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
132
140
|
return mergeObjects(spectaConfig, spectaMetadata);
|
|
133
141
|
}
|
|
134
142
|
export function readCellConfig(cell) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jupyter-specta",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"homepage": "https://github.com/trungleduc/specta",
|
|
@@ -50,51 +50,49 @@
|
|
|
50
50
|
"@microsoft/fast-foundation": "~2.49.5"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@jupyter-notebook/tree": "^7.
|
|
53
|
+
"@jupyter-notebook/tree": "^7.5.0",
|
|
54
54
|
"@jupyter-widgets/base": "^6.0.6",
|
|
55
|
-
"@jupyterlab/application": "^4.
|
|
56
|
-
"@jupyterlab/application-extension": "^4.
|
|
57
|
-
"@jupyterlab/apputils": "^4.
|
|
58
|
-
"@jupyterlab/apputils-extension": "^4.
|
|
59
|
-
"@jupyterlab/console": "^4.
|
|
60
|
-
"@jupyterlab/console-extension": "^4.
|
|
55
|
+
"@jupyterlab/application": "^4.5.0",
|
|
56
|
+
"@jupyterlab/application-extension": "^4.5.0",
|
|
57
|
+
"@jupyterlab/apputils": "^4.5.0",
|
|
58
|
+
"@jupyterlab/apputils-extension": "^4.5.0",
|
|
59
|
+
"@jupyterlab/console": "^4.5.0",
|
|
60
|
+
"@jupyterlab/console-extension": "^4.5.0",
|
|
61
61
|
"@jupyterlab/coreutils": "^6.4.2",
|
|
62
|
-
"@jupyterlab/docmanager": "^4.
|
|
63
|
-
"@jupyterlab/docmanager-extension": "^4.
|
|
64
|
-
"@jupyterlab/docregistry": "^4.
|
|
65
|
-
"@jupyterlab/filebrowser": "^4.
|
|
66
|
-
"@jupyterlab/filebrowser-extension": "^4.
|
|
67
|
-
"@jupyterlab/imageviewer": "^4.
|
|
68
|
-
"@jupyterlab/imageviewer-extension": "^4.
|
|
69
|
-
"@jupyterlab/json-extension": "^4.
|
|
70
|
-
"@jupyterlab/logconsole": "^4.
|
|
71
|
-
"@jupyterlab/mainmenu": "^4.
|
|
72
|
-
"@jupyterlab/markdownviewer-extension": "^4.
|
|
73
|
-
"@jupyterlab/mathjax-extension": "^4.
|
|
74
|
-
"@jupyterlab/nbconvert-css": "^4.
|
|
75
|
-
"@jupyterlab/nbformat": "^4.
|
|
76
|
-
"@jupyterlab/notebook": "^4.
|
|
77
|
-
"@jupyterlab/notebook-extension": "^4.
|
|
78
|
-
"@jupyterlab/outputarea": "^4.
|
|
79
|
-
"@jupyterlab/rendermime": "^4.
|
|
80
|
-
"@jupyterlab/rendermime-extension": "^4.
|
|
62
|
+
"@jupyterlab/docmanager": "^4.5.0",
|
|
63
|
+
"@jupyterlab/docmanager-extension": "^4.5.0",
|
|
64
|
+
"@jupyterlab/docregistry": "^4.5.0",
|
|
65
|
+
"@jupyterlab/filebrowser": "^4.5.0",
|
|
66
|
+
"@jupyterlab/filebrowser-extension": "^4.5.0",
|
|
67
|
+
"@jupyterlab/imageviewer": "^4.5.0",
|
|
68
|
+
"@jupyterlab/imageviewer-extension": "^4.5.0",
|
|
69
|
+
"@jupyterlab/json-extension": "^4.5.0",
|
|
70
|
+
"@jupyterlab/logconsole": "^4.5.0",
|
|
71
|
+
"@jupyterlab/mainmenu": "^4.5.0",
|
|
72
|
+
"@jupyterlab/markdownviewer-extension": "^4.5.0",
|
|
73
|
+
"@jupyterlab/mathjax-extension": "^4.5.0",
|
|
74
|
+
"@jupyterlab/nbconvert-css": "^4.5.0",
|
|
75
|
+
"@jupyterlab/nbformat": "^4.5.0",
|
|
76
|
+
"@jupyterlab/notebook": "^4.5.0",
|
|
77
|
+
"@jupyterlab/notebook-extension": "^4.5.0",
|
|
78
|
+
"@jupyterlab/outputarea": "^4.5.0",
|
|
79
|
+
"@jupyterlab/rendermime": "^4.5.0",
|
|
80
|
+
"@jupyterlab/rendermime-extension": "^4.5.0",
|
|
81
81
|
"@jupyterlab/services": "^7.2.4",
|
|
82
|
-
"@jupyterlab/services-extension": "^4.
|
|
83
|
-
"@jupyterlab/settingeditor-extension": "^4.
|
|
84
|
-
"@jupyterlab/settingregistry": "^4.
|
|
85
|
-
"@jupyterlab/theme-dark-extension": "^4.
|
|
86
|
-
"@jupyterlab/theme-light-extension": "^4.
|
|
87
|
-
"@jupyterlab/translation": "^4.
|
|
88
|
-
"@jupyterlab/translation-extension": "^4.
|
|
89
|
-
"@jupyterlab/ui-components": "^4.
|
|
90
|
-
"@jupyterlab/ui-components-extension": "
|
|
91
|
-
"@jupyterlite/application": "^0.
|
|
92
|
-
"@jupyterlite/application-extension": "^0.
|
|
93
|
-
"@jupyterlite/
|
|
94
|
-
"@jupyterlite/iframe-extension": "^0.
|
|
95
|
-
"@jupyterlite/
|
|
96
|
-
"@jupyterlite/server": "^0.6.2",
|
|
97
|
-
"@jupyterlite/services-extension": "^0.6.2",
|
|
82
|
+
"@jupyterlab/services-extension": "^4.5.0",
|
|
83
|
+
"@jupyterlab/settingeditor-extension": "^4.5.0",
|
|
84
|
+
"@jupyterlab/settingregistry": "^4.5.0",
|
|
85
|
+
"@jupyterlab/theme-dark-extension": "^4.5.0",
|
|
86
|
+
"@jupyterlab/theme-light-extension": "^4.5.0",
|
|
87
|
+
"@jupyterlab/translation": "^4.5.0",
|
|
88
|
+
"@jupyterlab/translation-extension": "^4.5.0",
|
|
89
|
+
"@jupyterlab/ui-components": "^4.5.0",
|
|
90
|
+
"@jupyterlab/ui-components-extension": "^4.5.0",
|
|
91
|
+
"@jupyterlite/application": "^0.7.0",
|
|
92
|
+
"@jupyterlite/application-extension": "^0.7.0",
|
|
93
|
+
"@jupyterlite/apputils": "^0.7.0",
|
|
94
|
+
"@jupyterlite/iframe-extension": "^0.7.0",
|
|
95
|
+
"@jupyterlite/services-extension": "^0.7.0",
|
|
98
96
|
"@lumino/algorithm": "^2.0.0",
|
|
99
97
|
"@lumino/application": "^2.0.0",
|
|
100
98
|
"@lumino/commands": "^2.0.0",
|
|
@@ -117,7 +115,7 @@
|
|
|
117
115
|
"reveal.js": "^5.2.1"
|
|
118
116
|
},
|
|
119
117
|
"devDependencies": {
|
|
120
|
-
"@jupyterlab/builder": "~4.
|
|
118
|
+
"@jupyterlab/builder": "~4.5.0",
|
|
121
119
|
"@types/react": "^18.0.26",
|
|
122
120
|
"@typescript-eslint/eslint-plugin": "^6.1.0",
|
|
123
121
|
"@typescript-eslint/parser": "^6.1.0",
|