diff --git a/app/package.json b/app/package.json index 46c7bd354f..e27b1a4f8a 100644 --- a/app/package.json +++ b/app/package.json @@ -19,6 +19,7 @@ "@jupyter-notebook/help-extension": "~7.0.0-alpha.5", "@jupyter-notebook/notebook-extension": "~7.0.0-alpha.5", "@jupyter-notebook/terminal-extension": "~7.0.0-alpha.5", + "@jupyter-notebook/tree": "~7.0.0-alpha.5", "@jupyter-notebook/tree-extension": "~7.0.0-alpha.5", "@jupyter-notebook/ui-components": "~7.0.0-alpha.5", "@jupyterlab/application": "~4.0.0-alpha.10", @@ -104,6 +105,7 @@ "@jupyter-notebook/help-extension": "^7.0.0-alpha.5", "@jupyter-notebook/notebook-extension": "^7.0.0-alpha.5", "@jupyter-notebook/terminal-extension": "^7.0.0-alpha.5", + "@jupyter-notebook/tree": "^7.0.0-alpha.5", "@jupyter-notebook/tree-extension": "^7.0.0-alpha.5", "@jupyter-notebook/ui-components": "^7.0.0-alpha.5", "@jupyterlab/application-extension": "^4.0.0-alpha.10", @@ -194,6 +196,7 @@ "@jupyterlab/user-extension" ], "singletonPackages": [ + "@jupyter-notebook/tree", "@jupyterlab/application", "@jupyterlab/apputils", "@jupyterlab/cell-toolbar", diff --git a/packages/_metapackage/package.json b/packages/_metapackage/package.json index 02693ac6f1..205c89adb2 100644 --- a/packages/_metapackage/package.json +++ b/packages/_metapackage/package.json @@ -29,6 +29,7 @@ "@jupyter-notebook/lab-extension": "file:../lab-extension", "@jupyter-notebook/notebook-extension": "file:../notebook-extension", "@jupyter-notebook/terminal-extension": "file:../terminal-extension", + "@jupyter-notebook/tree": "file:../tree", "@jupyter-notebook/tree-extension": "file:../tree-extension", "@jupyter-notebook/ui-components": "file:../ui-components" }, diff --git a/packages/_metapackage/src/index.ts b/packages/_metapackage/src/index.ts index e0ba7372bc..c41bc6c855 100644 --- a/packages/_metapackage/src/index.ts +++ b/packages/_metapackage/src/index.ts @@ -7,5 +7,6 @@ import '@jupyter-notebook/help-extension'; import '@jupyter-notebook/lab-extension'; import '@jupyter-notebook/notebook-extension'; import '@jupyter-notebook/terminal-extension'; +import '@jupyter-notebook/tree'; import '@jupyter-notebook/tree-extension'; import '@jupyter-notebook/ui-components'; diff --git a/packages/tree-extension/package.json b/packages/tree-extension/package.json index 2187b0e209..fec081e678 100644 --- a/packages/tree-extension/package.json +++ b/packages/tree-extension/package.json @@ -40,6 +40,7 @@ }, "dependencies": { "@jupyter-notebook/application": "^7.0.0-alpha.5", + "@jupyter-notebook/tree": "^7.0.0-alpha.5", "@jupyterlab/application": "^4.0.0-alpha.10", "@jupyterlab/apputils": "^4.0.0-alpha.10", "@jupyterlab/coreutils": "^6.0.0-alpha.10", diff --git a/packages/tree-extension/src/index.ts b/packages/tree-extension/src/index.ts index d9b842f7ac..3c3aafd5ff 100644 --- a/packages/tree-extension/src/index.ts +++ b/packages/tree-extension/src/index.ts @@ -27,11 +27,12 @@ import { ITranslator } from '@jupyterlab/translation'; import { caretDownIcon, folderIcon, - runningIcon, - TabBarSvg + runningIcon } from '@jupyterlab/ui-components'; -import { Menu, MenuBar, TabPanel } from '@lumino/widgets'; +import { Menu, MenuBar } from '@lumino/widgets'; + +import { NotebookTreeWidget, INotebookTree } from '@jupyter-notebook/tree'; /** * The file browser factory. @@ -94,9 +95,9 @@ const createNew: JupyterFrontEndPlugin = { }; /** - * A plugin to add the file browser widget to an ILabShell + * A plugin to add the file browser widget to an INotebookShell */ -const browserWidget: JupyterFrontEndPlugin = { +const notebookTreeWidget: JupyterFrontEndPlugin = { id: '@jupyter-notebook/tree-extension:widget', requires: [ IFileBrowserFactory, @@ -106,6 +107,7 @@ const browserWidget: JupyterFrontEndPlugin = { ], optional: [IRunningSessionManagers], autoStart: true, + provides: INotebookTree, activate: ( app: JupyterFrontEnd, factory: IFileBrowserFactory, @@ -113,13 +115,8 @@ const browserWidget: JupyterFrontEndPlugin = { settingRegistry: ISettingRegistry, toolbarRegistry: IToolbarWidgetRegistry, manager: IRunningSessionManagers | null - ): void => { - const tabPanel = new TabPanel({ - tabPlacement: 'top', - tabsMovable: true, - renderer: TabBarSvg.defaultRenderer - }); - tabPanel.addClass('jp-TreePanel'); + ): INotebookTree => { + const nbTreeWidget = new NotebookTreeWidget(); const trans = translator.load('notebook'); @@ -129,8 +126,8 @@ const browserWidget: JupyterFrontEndPlugin = { browser.node.setAttribute('aria-label', trans.__('File Browser Section')); browser.title.icon = folderIcon; - tabPanel.addWidget(browser); - tabPanel.tabBar.addTab(browser.title); + nbTreeWidget.addWidget(browser); + nbTreeWidget.tabBar.addTab(browser.title); // Toolbar toolbarRegistry.addFactory( @@ -150,7 +147,7 @@ const browserWidget: JupyterFrontEndPlugin = { toolbarRegistry, settingRegistry, FILE_BROWSER_FACTORY, - browserWidget.id, + notebookTreeWidget.id, translator ) ); @@ -160,8 +157,8 @@ const browserWidget: JupyterFrontEndPlugin = { running.id = 'jp-running-sessions'; running.title.label = trans.__('Running'); running.title.icon = runningIcon; - tabPanel.addWidget(running); - tabPanel.tabBar.addTab(running.title); + nbTreeWidget.addWidget(running); + nbTreeWidget.tabBar.addTab(running.title); } // show checkboxes by default if there is no user setting override @@ -177,12 +174,14 @@ const browserWidget: JupyterFrontEndPlugin = { console.error(reason.message); }); - app.shell.add(tabPanel, 'main', { rank: 100 }); + app.shell.add(nbTreeWidget, 'main', { rank: 100 }); + + return nbTreeWidget; } }; /** * Export the plugins as default. */ -const plugins: JupyterFrontEndPlugin[] = [createNew, browserWidget]; +const plugins: JupyterFrontEndPlugin[] = [createNew, notebookTreeWidget]; export default plugins; diff --git a/packages/tree-extension/style/index.css b/packages/tree-extension/style/index.css index c6a335ca57..078667ad6e 100644 --- a/packages/tree-extension/style/index.css +++ b/packages/tree-extension/style/index.css @@ -1,3 +1,3 @@ @import url('~@jupyterlab/filebrowser/style/index.css'); -@import url('./base.css'); +@import url('~@jupyter-notebook/tree/style/index.css'); diff --git a/packages/tree-extension/style/index.js b/packages/tree-extension/style/index.js index 334392b2dc..406d1565af 100644 --- a/packages/tree-extension/style/index.js +++ b/packages/tree-extension/style/index.js @@ -1,3 +1,3 @@ import '@jupyterlab/filebrowser/style/index.js'; -import './base.css'; +import '@jupyter-notebook/tree/style/index.js'; diff --git a/packages/tree/package.json b/packages/tree/package.json new file mode 100644 index 0000000000..06419fb253 --- /dev/null +++ b/packages/tree/package.json @@ -0,0 +1,66 @@ +{ + "name": "@jupyter-notebook/tree", + "version": "7.0.0-alpha.5", + "description": "Jupyter Notebook - Tree", + "homepage": "https://github.com/jupyter/notebook", + "bugs": { + "url": "https://github.com/jupyter/notebook/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/jupyter/notebook.git" + }, + "license": "BSD-3-Clause", + "author": "Project Jupyter", + "sideEffects": [ + "style/**/*.css", + "style/index.js" + ], + "main": "lib/index.js", + "types": "lib/index.d.ts", + "style": "style/index.css", + "directories": { + "lib": "lib/" + }, + "files": [ + "lib/*.d.ts", + "lib/*.js.map", + "lib/*.js", + "schema/*.json", + "style/**/*.css", + "style/index.js" + ], + "scripts": { + "build": "tsc -b", + "build:prod": "tsc -b", + "clean": "rimraf lib && rimraf tsconfig.tsbuildinfo", + "docs": "typedoc src", + "prepublishOnly": "npm run build", + "watch": "tsc -b --watch" + }, + "dependencies": { + "@jupyter-notebook/application": "^7.0.0-alpha.5", + "@jupyterlab/application": "^4.0.0-alpha.10", + "@jupyterlab/apputils": "^4.0.0-alpha.10", + "@jupyterlab/coreutils": "^6.0.0-alpha.10", + "@jupyterlab/docmanager": "^4.0.0-alpha.10", + "@jupyterlab/filebrowser": "^4.0.0-alpha.10", + "@jupyterlab/mainmenu": "^4.0.0-alpha.10", + "@jupyterlab/services": "^7.0.0-alpha.10", + "@jupyterlab/settingregistry": "^4.0.0-alpha.10", + "@jupyterlab/statedb": "^4.0.0-alpha.10", + "@jupyterlab/translation": "^4.0.0-alpha.10", + "@jupyterlab/ui-components": "^4.0.0-alpha.25", + "@lumino/algorithm": "^1.9.1", + "@lumino/commands": "^1.20.0", + "@lumino/widgets": "^1.32.0" + }, + "devDependencies": { + "rimraf": "~3.0.0", + "typescript": "~4.6.3" + }, + "publishConfig": { + "access": "public" + }, + "styleModule": "style/index.js" +} diff --git a/packages/tree/src/index.ts b/packages/tree/src/index.ts new file mode 100644 index 0000000000..dd239a6187 --- /dev/null +++ b/packages/tree/src/index.ts @@ -0,0 +1,2 @@ +export * from './notebook-tree'; +export * from './token'; diff --git a/packages/tree/src/notebook-tree.ts b/packages/tree/src/notebook-tree.ts new file mode 100644 index 0000000000..28dad32c55 --- /dev/null +++ b/packages/tree/src/notebook-tree.ts @@ -0,0 +1,22 @@ +import { TabBarSvg } from '@jupyterlab/ui-components'; + +import { TabPanel } from '@lumino/widgets'; + +import { INotebookTree } from './token'; + +/** + * The widget added in main area of the tree view. + */ +export class NotebookTreeWidget extends TabPanel implements INotebookTree { + /** + * Constructor of the NotebookTreeWidget. + */ + constructor() { + super({ + tabPlacement: 'top', + tabsMovable: true, + renderer: TabBarSvg.defaultRenderer + }); + this.addClass('jp-TreePanel'); + } +} diff --git a/packages/tree/src/token.ts b/packages/tree/src/token.ts new file mode 100644 index 0000000000..70342c9e7d --- /dev/null +++ b/packages/tree/src/token.ts @@ -0,0 +1,14 @@ +import { Token } from '@lumino/coreutils'; +import { TabPanel } from '@lumino/widgets'; + +/** + * The INotebookTree interface. + */ +export interface INotebookTree extends TabPanel {} + +/** + * The INotebookTree token. + */ +export const INotebookTree = new Token( + '@jupyter-notebook/tree:INotebookTree' +); diff --git a/packages/tree-extension/style/base.css b/packages/tree/style/base.css similarity index 100% rename from packages/tree-extension/style/base.css rename to packages/tree/style/base.css diff --git a/packages/tree/style/index.css b/packages/tree/style/index.css new file mode 100644 index 0000000000..c6a335ca57 --- /dev/null +++ b/packages/tree/style/index.css @@ -0,0 +1,3 @@ +@import url('~@jupyterlab/filebrowser/style/index.css'); + +@import url('./base.css'); diff --git a/packages/tree/style/index.js b/packages/tree/style/index.js new file mode 100644 index 0000000000..334392b2dc --- /dev/null +++ b/packages/tree/style/index.js @@ -0,0 +1,3 @@ +import '@jupyterlab/filebrowser/style/index.js'; + +import './base.css'; diff --git a/packages/tree/tsconfig.json b/packages/tree/tsconfig.json new file mode 100644 index 0000000000..b223e1a1b8 --- /dev/null +++ b/packages/tree/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfigbase", + "compilerOptions": { + "outDir": "lib", + "rootDir": "src" + }, + "include": ["src/**/*"], + "references": [ + { + "path": "../application" + } + ] +} diff --git a/yarn.lock b/yarn.lock index 9e13785786..5a5af46fa9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1388,6 +1388,26 @@ "@lumino/algorithm" "^1.9.1" "@jupyter-notebook/tree-extension@file:packages/tree-extension": + version "7.0.0-alpha.5" + dependencies: + "@jupyter-notebook/application" "^7.0.0-alpha.5" + "@jupyter-notebook/tree" "^7.0.0-alpha.5" + "@jupyterlab/application" "^4.0.0-alpha.10" + "@jupyterlab/apputils" "^4.0.0-alpha.10" + "@jupyterlab/coreutils" "^6.0.0-alpha.10" + "@jupyterlab/docmanager" "^4.0.0-alpha.10" + "@jupyterlab/filebrowser" "^4.0.0-alpha.10" + "@jupyterlab/mainmenu" "^4.0.0-alpha.10" + "@jupyterlab/services" "^7.0.0-alpha.10" + "@jupyterlab/settingregistry" "^4.0.0-alpha.10" + "@jupyterlab/statedb" "^4.0.0-alpha.10" + "@jupyterlab/translation" "^4.0.0-alpha.10" + "@jupyterlab/ui-components" "^4.0.0-alpha.25" + "@lumino/algorithm" "^1.9.1" + "@lumino/commands" "^1.20.0" + "@lumino/widgets" "^1.32.0" + +"@jupyter-notebook/tree@file:packages/tree": version "7.0.0-alpha.5" dependencies: "@jupyter-notebook/application" "^7.0.0-alpha.5"