Minor cleanup

This commit is contained in:
Jeremy Tuloup 2020-12-12 12:27:50 +01:00
parent b61870072d
commit 01a6bc835c
10 changed files with 28 additions and 25 deletions

View File

@ -1,6 +1,8 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
// Inspired by: https://github.com/jupyterlab/jupyterlab/blob/master/dev_mode/index.js
import { PageConfig, URLExt } from '@jupyterlab/coreutils';
// Promise.allSettled polyfill, until our supported browsers implement it
@ -108,6 +110,8 @@ async function main() {
require('@jupyterlab/theme-dark-extension')
];
// The motivation here is to only load a specific set of plugins dependending on
// the current page
const page = PageConfig.getOption('classicPage');
if (page === 'tree') {
mods = mods.concat([
@ -184,6 +188,7 @@ async function main() {
});
// Add the federated extensions.
// TODO: Add support for disabled extensions
const federatedExtensions = await Promise.allSettled(
federatedExtensionPromises
);

View File

@ -161,9 +161,6 @@
"jupyterlab": {
"name": "JupyterLab Classic",
"version": "0.1.0",
"extensions": {
"@jupyterlab-classic/application-extension": ""
},
"buildDir": "./static",
"outputDir": ".",
"singletonPackages": [
@ -212,10 +209,6 @@
"@lumino/widgets",
"react",
"react-dom"
],
"linkedPackages": {
"@jupyterlab-classic/application": "../packages/application",
"@jupyterlab-classic/application-extension": "../packages/application-extension"
}
]
}
}

View File

@ -1,4 +1,5 @@
from jupyterlab_classic.app import main
import sys
from jupyterlab_classic.app import main
sys.exit(main())

View File

@ -96,7 +96,7 @@ const logo: JupyterFrontEndPlugin<void> = {
};
/**
* A plugin to open document in the main area.
* A plugin to open documents in the main area.
*/
const opener: JupyterFrontEndPlugin<void> = {
id: '@jupyterlab-classic/application-extension:opener',
@ -204,14 +204,14 @@ const pages: JupyterFrontEndPlugin<void> = {
*/
const paths: JupyterFrontEndPlugin<JupyterFrontEnd.IPaths> = {
id: '@jupyterlab-classic/application-extension:paths',
autoStart: true,
provides: JupyterFrontEnd.IPaths,
activate: (app: JupyterFrontEnd): JupyterFrontEnd.IPaths => {
if (!(app instanceof App)) {
throw new Error(`${paths.id} must be activated in JupyterLab Classic.`);
}
return app.paths;
},
autoStart: true,
provides: JupyterFrontEnd.IPaths
}
};
/**
@ -219,6 +219,8 @@ const paths: JupyterFrontEndPlugin<JupyterFrontEnd.IPaths> = {
*/
const router: JupyterFrontEndPlugin<IRouter> = {
id: '@jupyterlab-classic/application-extension:router',
autoStart: true,
provides: IRouter,
requires: [JupyterFrontEnd.IPaths],
activate: (app: JupyterFrontEnd, paths: JupyterFrontEnd.IPaths) => {
const { commands } = app;
@ -234,16 +236,14 @@ const router: JupyterFrontEndPlugin<IRouter> = {
});
});
return router;
},
autoStart: true,
provides: IRouter
}
};
/**
* The default session dialogs plugin
*/
const sessionDialogs: JupyterFrontEndPlugin<ISessionContextDialogs> = {
id: '@jupyterlab-classic/application-extension:sessionDialogs',
id: '@jupyterlab-classic/application-extension:session-dialogs',
provides: ISessionContextDialogs,
autoStart: true,
activate: () => sessionContextDialogs
@ -356,14 +356,17 @@ const topVisibility: JupyterFrontEndPlugin<void> = {
menu.viewMenu.addGroup([{ command: CommandIDs.toggleTop }], 2);
}
// listen on format change (mobile and desktop) to make the view more compact
app.formatChanged.connect(() => {
const onChanged = (): void => {
if (app.format === 'desktop') {
classicShell.expandTop();
} else {
classicShell.collapseTop();
}
});
};
// listen on format change (mobile and desktop) to make the view more compact
app.formatChanged.connect(onChanged);
onChanged();
},
autoStart: true
};

View File

@ -25,6 +25,7 @@ export class App extends JupyterFrontEnd<IClassicShell> {
super({
shell: options.shell
});
void this._formatter.invoke();
}
/**

View File

@ -12,7 +12,7 @@
.jp-AboutClassic-body {
display: flex;
font-size: var(--jp-ui-font-size3);
font-size: var(--jp-ui-font-size2);
padding: var(--jp-flat-button-padding);
color: var(--jp-ui-font-color1);
text-align: left;

View File

@ -49,6 +49,7 @@
"@jupyterlab-classic/ui-components": "^0.1.0",
"@jupyterlab/application": "^3.0.0-rc.13",
"@jupyterlab/apputils": "^3.0.0-rc.13",
"@jupyterlab/coreutils": "^5.0.0-rc.13",
"@jupyterlab/docregistry": "^3.0.0-rc.13",
"@jupyterlab/mainmenu": "^3.0.0-rc.13",
"@jupyterlab/notebook": "^3.0.0-rc.13",

View File

@ -14,7 +14,7 @@ import { ITerminalTracker } from '@jupyterlab/terminal';
import { find } from '@lumino/algorithm';
/**
* A plugin to terminals in a new tab
* A plugin to open terminals in a new tab
*/
const opener: JupyterFrontEndPlugin<void> = {
id: '@jupyterlab-classic/terminal-extension:opener',
@ -63,7 +63,7 @@ const redirect: JupyterFrontEndPlugin<void> = {
const name = terminal.content.session.name;
window.open(`${baseUrl}classic/terminals/${name}`, '_blank');
// dispose the widget since it is not used
// dispose the widget since it is not used on this page
terminal.dispose();
});
}

View File

@ -36,7 +36,6 @@
"docs": "typedoc src",
"docs:init": "bash docs/build.sh",
"prepublishOnly": "npm run build",
"storybook": "start-storybook -p 9001 -c .storybook",
"test": "jest",
"test:cov": "jest --collect-coverage",
"test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand",

View File

@ -1,3 +1,3 @@
[build-system]
requires = ["jupyter_packaging~=0.7.0", "jupyterlab>=3.0.0rc10,==3.*", "setuptools>=40.8.0", "wheel"]
requires = ["jupyter_packaging~=0.7.0", "jupyterlab>=3.0.0rc13,==3.*", "setuptools>=40.8.0", "wheel"]
build-backend = "setuptools.build_meta"