diff --git a/packages/navigator/package.json b/packages/navigator/package.json index 9f7e51c5..09898bf2 100644 --- a/packages/navigator/package.json +++ b/packages/navigator/package.json @@ -30,11 +30,11 @@ "watch": "npm-run-all --parallel watch:ts watch:webpack" }, "dependencies": { - "@jupyterlab/application": "^2.0.0", "@jupyterlab/apputils": "^2.0.0", "@jupyterlab/mainmenu": "^2.0.0", "@jupyterlab/theme-light-extension": "^2.0.0", "@jupyterlab/ui-components": "^2.0.0", + "@lumino/application": "^1.11.0", "@lumino/widgets": "^1.13.2", "@mamba-org/common": "^1.0.0", "es6-promise": "~4.2.8", @@ -43,6 +43,7 @@ "react-dom": "~16.9.0" }, "devDependencies": { + "@jupyterlab/buildutils": "^2.0.0", "@typescript-eslint/eslint-plugin": "^2.25.0", "@typescript-eslint/parser": "^2.25.0", "css-loader": "~3.2.0", diff --git a/packages/navigator/src/app/app.ts b/packages/navigator/src/app/app.ts index f6158a67..873e74e1 100644 --- a/packages/navigator/src/app/app.ts +++ b/packages/navigator/src/app/app.ts @@ -1,22 +1,26 @@ -import { - JupyterFrontEnd, - JupyterFrontEndPlugin -} from '@jupyterlab/application'; - -import { PageConfig } from '@jupyterlab/coreutils'; +import { Application, IPlugin } from '@lumino/application'; import { IGatorShell, GatorShell } from './shell'; +/** + * The type for all JupyterFrontEnd application plugins. + * + * @typeparam T - The type that the plugin `provides` upon being activated. + */ +export type GatorFrontEndPlugin = IPlugin; + /** * Gator is the main application class. It is instantiated once and shared. */ -export class Gator extends JupyterFrontEnd { +export class Gator extends Application { /** * Construct a new App object. * * @param options The instantiation options for an Gator application. */ - constructor(options: Gator.IOptions = { shell: new GatorShell() }) { + constructor( + options: Application.IOptions = { shell: new GatorShell() } + ) { super({ shell: options.shell }); @@ -37,38 +41,6 @@ export class Gator extends JupyterFrontEnd { */ readonly version = 'unknown'; - /** - * The JupyterLab application paths dictionary. - */ - get paths(): JupyterFrontEnd.IPaths { - return { - urls: { - base: PageConfig.getOption('baseUrl'), - notFound: PageConfig.getOption('notFoundUrl'), - app: PageConfig.getOption('appUrl'), - static: PageConfig.getOption('staticUrl'), - settings: PageConfig.getOption('settingsUrl'), - themes: PageConfig.getOption('themesUrl'), - tree: PageConfig.getOption('treeUrl'), - workspaces: PageConfig.getOption('workspacesUrl'), - hubHost: PageConfig.getOption('hubHost') || undefined, - hubPrefix: PageConfig.getOption('hubPrefix') || undefined, - hubUser: PageConfig.getOption('hubUser') || undefined, - hubServerName: PageConfig.getOption('hubServerName') || undefined - }, - directories: { - appSettings: PageConfig.getOption('appSettingsDir'), - schemas: PageConfig.getOption('schemasDir'), - static: PageConfig.getOption('staticDir'), - templates: PageConfig.getOption('templatesDir'), - themes: PageConfig.getOption('themesDir'), - userSettings: PageConfig.getOption('userSettingsDir'), - serverRoot: PageConfig.getOption('serverRoot'), - workspaces: PageConfig.getOption('workspacesDir') - } - }; - } - /** * Register plugins from a plugin module. * @@ -108,11 +80,6 @@ export class Gator extends JupyterFrontEnd { * A namespace for Gator statics. */ export namespace Gator { - /** - * The instantiation options for an Gator application. - */ - export type IOptions = JupyterFrontEnd.IOptions; - /** * The interface for a module that exports a plugin or plugins as * the default value. @@ -121,6 +88,6 @@ export namespace Gator { /** * The default export. */ - default: JupyterFrontEndPlugin | JupyterFrontEndPlugin[]; + default: IPlugin | IPlugin[]; } } diff --git a/packages/navigator/src/app/shell.ts b/packages/navigator/src/app/shell.ts index 85640866..a4f284cc 100644 --- a/packages/navigator/src/app/shell.ts +++ b/packages/navigator/src/app/shell.ts @@ -1,5 +1,3 @@ -import { JupyterFrontEnd } from '@jupyterlab/application'; - import { classes, DockPanelSvg, LabIcon } from '@jupyterlab/ui-components'; import { IIterator, iter, toArray } from '@lumino/algorithm'; @@ -21,7 +19,7 @@ export namespace IGatorShell { /** * The application shell. */ -export class GatorShell extends Widget implements JupyterFrontEnd.IShell { +export class GatorShell extends Widget { constructor() { super(); this.id = 'main'; diff --git a/packages/navigator/src/index.ts b/packages/navigator/src/index.ts index 5f710378..0ebfc249 100644 --- a/packages/navigator/src/index.ts +++ b/packages/navigator/src/index.ts @@ -13,11 +13,7 @@ import '../style/index.css'; */ async function main(): Promise { const app = new Gator(); - const mods = [ - require('./plugins/paths'), - require('./plugins/navigator'), - require('./plugins/top') - ]; + const mods = [require('./plugins/navigator'), require('./plugins/top')]; app.registerPluginModules(mods); diff --git a/packages/navigator/src/plugins/navigator/index.ts b/packages/navigator/src/plugins/navigator/index.ts index 94e8850e..b0c3c2a0 100644 --- a/packages/navigator/src/plugins/navigator/index.ts +++ b/packages/navigator/src/plugins/navigator/index.ts @@ -1,7 +1,3 @@ -import { - JupyterFrontEnd, - JupyterFrontEndPlugin -} from '@jupyterlab/application'; import { DOMUtils, MainAreaWidget } from '@jupyterlab/apputils'; import { CondaEnvironments, @@ -10,21 +6,15 @@ import { CONDA_WIDGET_CLASS } from '@mamba-org/common'; import { INotification } from 'jupyterlab_toastify'; - -/** - * The command ids used by the main navigator plugin. - */ -export namespace CommandIDs { - export const open = '@mamba-org/navigator:open'; -} +import { Gator, GatorFrontEndPlugin } from '../../app/app'; /** * The main navigator plugin. */ -const plugin: JupyterFrontEndPlugin = { +const plugin: GatorFrontEndPlugin = { id: '@mamba-org/navigator:main', autoStart: true, - activate: (app: JupyterFrontEnd): void => { + activate: (app: Gator): void => { const model = new CondaEnvironments(); // Request listing available package as quickly as possible diff --git a/packages/navigator/src/plugins/paths/index.ts b/packages/navigator/src/plugins/paths/index.ts deleted file mode 100644 index c0f22409..00000000 --- a/packages/navigator/src/plugins/paths/index.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { - JupyterFrontEnd, - JupyterFrontEndPlugin -} from '@jupyterlab/application'; - -import { Gator } from '../../app/app'; - -/** - * The default paths. - */ -const paths: JupyterFrontEndPlugin = { - id: '@mamba-org/navigator:paths', - activate: ( - app: JupyterFrontEnd - ): JupyterFrontEnd.IPaths => { - return (app as Gator).paths; - }, - autoStart: true, - provides: JupyterFrontEnd.IPaths -}; - -export default paths; diff --git a/packages/navigator/src/plugins/top/index.tsx b/packages/navigator/src/plugins/top/index.tsx index 20e2364e..d628216f 100644 --- a/packages/navigator/src/plugins/top/index.tsx +++ b/packages/navigator/src/plugins/top/index.tsx @@ -1,20 +1,11 @@ -import { - JupyterFrontEnd, - JupyterFrontEndPlugin -} from '@jupyterlab/application'; - -import { showDialog, Dialog } from '@jupyterlab/apputils'; - +import { Dialog, showDialog } from '@jupyterlab/apputils'; import { Widget } from '@lumino/widgets'; - +import * as React from 'react'; +import { Gator, GatorFrontEndPlugin } from '../../app/app'; +import { mambaIcon } from '../../icons'; import { MainMenu } from './menu'; - import { IMainMenu } from './tokens'; -import { mambaIcon } from '../../icons'; - -import * as React from 'react'; - /** * The command IDs used by the top plugin. */ @@ -25,11 +16,11 @@ namespace CommandIDs { /** * The main menu plugin. */ -const plugin: JupyterFrontEndPlugin = { +const plugin: GatorFrontEndPlugin = { id: '@mamba-org/navigator:menu', autoStart: true, provides: IMainMenu, - activate: (app: JupyterFrontEnd): IMainMenu => { + activate: (app: Gator): IMainMenu => { const logo = new Widget(); mambaIcon.element({ container: logo.node, diff --git a/yarn.lock b/yarn.lock index 99b60a09..c7ee22e7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2315,7 +2315,7 @@ resolved "https://registry.yarnpkg.com/@lumino/algorithm/-/algorithm-1.3.3.tgz#fdf4daa407a1ce6f233e173add6a2dda0c99eef4" integrity sha512-I2BkssbOSLq3rDjgAC3fzf/zAIwkRUnAh60MO0lYcaFdSGyI15w4K3gwZHGIO0p9cKEiNHLXKEODGmOjMLOQ3g== -"@lumino/application@^1.8.4": +"@lumino/application@^1.11.0", "@lumino/application@^1.8.4": version "1.11.0" resolved "https://registry.yarnpkg.com/@lumino/application/-/application-1.11.0.tgz#25b859cf7910b0021c9396dffee523df99025647" integrity sha512-kHizRpmzEyCWKIyX1th4S4bCyKJKdauBCLRmftHudNV5+l8g48bCB8xTHI+ILQ4WNziaYEwFFioLSxRr4/ih8w==