Update to the 3.1.0-alpha.x upstream packages (#127)

* Update packages

* Update Binder

* Add collaborative

* Update to alpha packages

* Integrity

* Add labextension to prettierignore

* Update jest config

* Move file browser lab plugins to a separate file

* Cleanup tree extension

* Fix file editor factory in the edit view

* Integrity

* Fix plugin name
This commit is contained in:
Jeremy Tuloup 2021-05-20 17:19:55 +02:00 committed by GitHub
parent 4d2e31493f
commit a47da616ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 1300 additions and 1778 deletions

View File

@ -3,4 +3,5 @@ node_modules
**/lib
**/package.json
**/static
**/labextension
build

View File

@ -134,6 +134,16 @@ async function main() {
switch (page) {
case 'tree': {
mods = mods.concat([
require('@jupyterlab/filebrowser-extension').default.filter(({ id }) =>
[
'@jupyterlab/filebrowser-extension:browser',
'@jupyterlab/filebrowser-extension:download',
'@jupyterlab/filebrowser-extension:factory',
'@jupyterlab/filebrowser-extension:file-upload-status',
'@jupyterlab/filebrowser-extension:open-with',
'@jupyterlab/filebrowser-extension:share-file'
].includes(id)
),
require('@retrolab/tree-extension'),
require('@jupyterlab/running-extension')
]);
@ -161,8 +171,11 @@ async function main() {
require('@jupyterlab/fileeditor-extension').default.filter(({ id }) =>
['@jupyterlab/fileeditor-extension:plugin'].includes(id)
),
require('@retrolab/tree-extension').default.filter(({ id }) =>
['@retrolab/tree-extension:factory'].includes(id)
require('@jupyterlab/filebrowser-extension').default.filter(({ id }) =>
[
'@jupyterlab/filebrowser-extension:browser',
'@jupyterlab/filebrowser-extension:factory'
].includes(id)
)
]);
break;

View File

@ -2,10 +2,14 @@ const path = require('path');
const func = require('@jupyterlab/testutils/lib/jest-config');
const upstream = func(__dirname);
const esModules = ['lib0', 'y-protocols'].join('|');
let local = {
globalSetup: path.resolve(__dirname, './jest-setup.js'),
preset: 'ts-jest/presets/js-with-babel',
transformIgnorePatterns: ['/node_modules/(?!(@jupyterlab/.*)/)'],
transformIgnorePatterns: [
`/node_modules/(?!${esModules}).+\\.js/(?!(@jupyterlab/.*)/)`
],
globals: {
'ts-jest': {
tsconfig: './tsconfig.test.json'

View File

@ -18,48 +18,49 @@
"watch": "webpack --config ./webpack.config.watch.js"
},
"resolutions": {
"@jupyterlab/application": "~3.0.10",
"@jupyterlab/apputils": "~3.0.8",
"@jupyterlab/apputils-extension": "~3.0.10",
"@jupyterlab/celltags": "~3.0.10",
"@jupyterlab/codeeditor": "~3.0.8",
"@jupyterlab/codemirror-extension": "~3.0.10",
"@jupyterlab/completer": "~3.0.8",
"@jupyterlab/completer-extension": "~3.0.10",
"@jupyterlab/console": "~3.0.9",
"@jupyterlab/coreutils": "~5.0.6",
"@jupyterlab/docmanager": "~3.0.10",
"@jupyterlab/docmanager-extension": "~3.0.10",
"@jupyterlab/filebrowser": "~3.0.10",
"@jupyterlab/fileeditor": "~3.0.10",
"@jupyterlab/fileeditor-extension": "~3.0.10",
"@jupyterlab/javascript-extension": "~3.0.9",
"@jupyterlab/json-extension": "~3.0.8",
"@jupyterlab/mainmenu": "~3.0.8",
"@jupyterlab/mainmenu-extension": "~3.0.10",
"@jupyterlab/mathjax2-extension": "~3.0.10",
"@jupyterlab/notebook": "~3.0.10",
"@jupyterlab/notebook-extension": "~3.0.10",
"@jupyterlab/observables": "~4.0.5",
"@jupyterlab/outputarea": "~3.0.9",
"@jupyterlab/pdf-extension": "~3.0.8",
"@jupyterlab/rendermime": "~3.0.9",
"@jupyterlab/rendermime-extension": "~3.0.10",
"@jupyterlab/rendermime-interfaces": "~3.0.8",
"@jupyterlab/running-extension": "~3.0.10",
"@jupyterlab/services": "~6.0.8",
"@jupyterlab/settingregistry": "~3.0.5",
"@jupyterlab/shortcuts-extension": "~3.0.10",
"@jupyterlab/statedb": "~3.0.5",
"@jupyterlab/statusbar": "~3.0.8",
"@jupyterlab/terminal": "~3.0.9",
"@jupyterlab/terminal-extension": "~3.0.11",
"@jupyterlab/theme-dark-extension": "~3.0.10",
"@jupyterlab/theme-light-extension": "~3.0.10",
"@jupyterlab/tooltip": "~3.0.9",
"@jupyterlab/tooltip-extension": "~3.0.10",
"@jupyterlab/ui-components": "~3.0.7",
"@jupyterlab/vega5-extension": "~3.0.8",
"@jupyterlab/application": "~3.1.0-alpha.8",
"@jupyterlab/apputils": "~3.1.0-alpha.8",
"@jupyterlab/apputils-extension": "~3.1.0-alpha.8",
"@jupyterlab/celltags": "~3.1.0-alpha.8",
"@jupyterlab/codeeditor": "~3.1.0-alpha.8",
"@jupyterlab/codemirror-extension": "~3.1.0-alpha.8",
"@jupyterlab/completer": "~3.1.0-alpha.8",
"@jupyterlab/completer-extension": "~3.1.0-alpha.8",
"@jupyterlab/console": "~3.1.0-alpha.8",
"@jupyterlab/coreutils": "~5.1.0-alpha.8",
"@jupyterlab/docmanager": "~3.1.0-alpha.8",
"@jupyterlab/docmanager-extension": "~3.1.0-alpha.8",
"@jupyterlab/filebrowser": "~3.1.0-alpha.8",
"@jupyterlab/filebrowser-extension": "~3.1.0-alpha.8",
"@jupyterlab/fileeditor": "~3.1.0-alpha.8",
"@jupyterlab/fileeditor-extension": "~3.1.0-alpha.8",
"@jupyterlab/javascript-extension": "~3.1.0-alpha.8",
"@jupyterlab/json-extension": "~3.1.0-alpha.8",
"@jupyterlab/mainmenu": "~3.1.0-alpha.8",
"@jupyterlab/mainmenu-extension": "~3.1.0-alpha.8",
"@jupyterlab/mathjax2-extension": "~3.1.0-alpha.8",
"@jupyterlab/notebook": "~3.1.0-alpha.8",
"@jupyterlab/notebook-extension": "~3.1.0-alpha.8",
"@jupyterlab/observables": "~4.1.0-alpha.8",
"@jupyterlab/outputarea": "~3.1.0-alpha.8",
"@jupyterlab/pdf-extension": "~3.1.0-alpha.8",
"@jupyterlab/rendermime": "~3.1.0-alpha.8",
"@jupyterlab/rendermime-extension": "~3.1.0-alpha.8",
"@jupyterlab/rendermime-interfaces": "~3.1.0-alpha.8",
"@jupyterlab/running-extension": "~3.1.0-alpha.8",
"@jupyterlab/services": "~6.1.0-alpha.8",
"@jupyterlab/settingregistry": "~3.1.0-alpha.8",
"@jupyterlab/shortcuts-extension": "~3.1.0-alpha.8",
"@jupyterlab/statedb": "~3.1.0-alpha.8",
"@jupyterlab/statusbar": "~3.1.0-alpha.8",
"@jupyterlab/terminal": "~3.1.0-alpha.8",
"@jupyterlab/terminal-extension": "~3.1.0-alpha.8",
"@jupyterlab/theme-dark-extension": "~3.1.0-alpha.8",
"@jupyterlab/theme-light-extension": "~3.1.0-alpha.8",
"@jupyterlab/tooltip": "~3.1.0-alpha.8",
"@jupyterlab/tooltip-extension": "~3.1.0-alpha.8",
"@jupyterlab/ui-components": "~3.1.0-alpha.8",
"@jupyterlab/vega5-extension": "~3.1.0-alpha.8",
"@lumino/algorithm": "~1.6.0",
"@lumino/application": "~1.20.0",
"@lumino/commands": "~1.15.0",
@ -84,27 +85,28 @@
"react-dom": "~17.0.2"
},
"dependencies": {
"@jupyterlab/apputils-extension": "^3.0.0",
"@jupyterlab/celltags": "^3.0.0",
"@jupyterlab/codemirror-extension": "^3.0.0",
"@jupyterlab/completer-extension": "^3.0.0",
"@jupyterlab/coreutils": "~5.0.0",
"@jupyterlab/docmanager-extension": "^3.0.0",
"@jupyterlab/fileeditor-extension": "^3.0.0",
"@jupyterlab/javascript-extension": "^3.0.0",
"@jupyterlab/json-extension": "^3.0.0",
"@jupyterlab/mainmenu-extension": "^3.0.0",
"@jupyterlab/mathjax2-extension": "^3.0.0",
"@jupyterlab/notebook-extension": "^3.0.0",
"@jupyterlab/pdf-extension": "^3.0.0",
"@jupyterlab/rendermime-extension": "^3.0.0",
"@jupyterlab/running-extension": "^3.0.0",
"@jupyterlab/shortcuts-extension": "^3.0.0",
"@jupyterlab/terminal-extension": "^3.0.0",
"@jupyterlab/theme-dark-extension": "^3.0.0",
"@jupyterlab/theme-light-extension": "^3.0.0",
"@jupyterlab/tooltip-extension": "^3.0.0",
"@jupyterlab/vega5-extension": "^3.0.0",
"@jupyterlab/apputils-extension": "^3.1.0-alpha.8",
"@jupyterlab/celltags": "^3.1.0-alpha.8",
"@jupyterlab/codemirror-extension": "^3.1.0-alpha.8",
"@jupyterlab/completer-extension": "^3.1.0-alpha.8",
"@jupyterlab/coreutils": "~5.1.0-alpha.8",
"@jupyterlab/docmanager-extension": "^3.1.0-alpha.8",
"@jupyterlab/filebrowser-extension": "^3.1.0-alpha.8",
"@jupyterlab/fileeditor-extension": "^3.1.0-alpha.8",
"@jupyterlab/javascript-extension": "^3.1.0-alpha.8",
"@jupyterlab/json-extension": "^3.1.0-alpha.8",
"@jupyterlab/mainmenu-extension": "^3.1.0-alpha.8",
"@jupyterlab/mathjax2-extension": "^3.1.0-alpha.8",
"@jupyterlab/notebook-extension": "^3.1.0-alpha.8",
"@jupyterlab/pdf-extension": "^3.1.0-alpha.8",
"@jupyterlab/rendermime-extension": "^3.1.0-alpha.8",
"@jupyterlab/running-extension": "^3.1.0-alpha.8",
"@jupyterlab/shortcuts-extension": "^3.1.0-alpha.8",
"@jupyterlab/terminal-extension": "^3.1.0-alpha.8",
"@jupyterlab/theme-dark-extension": "^3.1.0-alpha.8",
"@jupyterlab/theme-light-extension": "^3.1.0-alpha.8",
"@jupyterlab/tooltip-extension": "^3.1.0-alpha.8",
"@jupyterlab/vega5-extension": "^3.1.0-alpha.8",
"@retrolab/application": "^0.2.0",
"@retrolab/application-extension": "^0.2.0",
"@retrolab/docmanager-extension": "^0.2.0",
@ -117,9 +119,9 @@
"devDependencies": {
"@babel/core": "^7.11.6",
"@babel/preset-env": "^7.12.1",
"@jupyterlab/builder": "^3.0.0",
"@jupyterlab/buildutils": "^3.0.0",
"@jupyterlab/testutils": "^3.0.0",
"@jupyterlab/builder": "^3.1.0-alpha.8",
"@jupyterlab/buildutils": "^3.1.0-alpha.8",
"@jupyterlab/testutils": "^3.1.0-alpha.8",
"@types/jest": "^26.0.10",
"css-loader": "~5.0.1",
"file-loader": "~5.0.2",
@ -154,6 +156,7 @@
"@jupyterlab/codemirror-extension",
"@jupyterlab/completer-extension",
"@jupyterlab/docmanager-extension",
"@jupyterlab/filebrowser-extension",
"@jupyterlab/fileeditor-extension",
"@jupyterlab/mainmenu-extension",
"@jupyterlab/mathjax2-extension",

View File

@ -4,7 +4,7 @@ channels:
dependencies:
- ipywidgets=7.6
- jupyterlab=3
- jupyterlab-python-file
- jupyterlab-link-share>=0.2
- matplotlib
- numpy
- nodejs

View File

@ -30,7 +30,7 @@
"watch": "tsc -w --listEmittedFiles"
},
"dependencies": {
"@jupyterlab/buildutils": "^3.0.0",
"@jupyterlab/buildutils": "^3.1.0-alpha.8",
"commander": "^6.2.0",
"fs-extra": "^9.1.0",
"typescript": "~4.1.3"

4
jupyter_config.json Normal file
View File

@ -0,0 +1,4 @@
{
"RetroApp": { "collaborative": true },
"LabApp": { "collaborative": true, "expose_app_in_browser": true }
}

View File

@ -34,12 +34,12 @@
"release:patch": "node ./buildutils/lib/release-patch.js",
"start": "jupyter retro --config ./app/test/jupyter_server_config.py --no-browser",
"test": "lerna run test",
"test:e2e": "lerna run test:e2e --stream",
"test:ci": "(jlpm run start&) && jlpm run test:e2e",
"test:e2e": "lerna run test:e2e --stream",
"update:dependency": "node ./node_modules/@jupyterlab/buildutils/lib/update-dependency.js --lerna",
"watch": "run-p watch:lib watch:app",
"watch:lib": "lerna exec --stream --scope @retrolab/metapackage jlpm watch",
"watch:app": "lerna exec --stream --scope \"@retrolab/app\" jlpm watch"
"watch:app": "lerna exec --stream --scope \"@retrolab/app\" jlpm watch",
"watch:lib": "lerna exec --stream --scope @retrolab/metapackage jlpm watch"
},
"husky": {
"hooks": {
@ -47,7 +47,7 @@
}
},
"devDependencies": {
"@jupyterlab/buildutils": "^3.0.0",
"@jupyterlab/buildutils": "^3.1.0-alpha.8",
"@typescript-eslint/eslint-plugin": "^4.2.0",
"@typescript-eslint/parser": "^4.2.0",
"eslint": "^7.10.0",

View File

@ -19,7 +19,6 @@
"main": "lib/index.js",
"types": "lib/index.d.ts",
"style": "style/index.css",
"styleModule": "style/index.js",
"directories": {
"lib": "lib/"
},
@ -39,18 +38,18 @@
"watch": "tsc -b --watch"
},
"dependencies": {
"@jupyterlab/application": "^3.0.0",
"@jupyterlab/apputils": "^3.0.0",
"@jupyterlab/celltags": "^3.0.0",
"@jupyterlab/codeeditor": "^3.0.0",
"@jupyterlab/codemirror": "^3.0.0",
"@jupyterlab/coreutils": "^5.0.0",
"@jupyterlab/docmanager": "^3.0.0",
"@jupyterlab/docregistry": "^3.0.0",
"@jupyterlab/mainmenu": "^3.0.0",
"@jupyterlab/settingregistry": "^3.0.0",
"@jupyterlab/translation": "^3.0.0",
"@lumino/widgets": "^1.14.0",
"@jupyterlab/application": "^3.1.0-alpha.8",
"@jupyterlab/apputils": "^3.1.0-alpha.8",
"@jupyterlab/celltags": "^3.1.0-alpha.8",
"@jupyterlab/codeeditor": "^3.1.0-alpha.8",
"@jupyterlab/codemirror": "^3.1.0-alpha.8",
"@jupyterlab/coreutils": "^5.1.0-alpha.8",
"@jupyterlab/docmanager": "^3.1.0-alpha.8",
"@jupyterlab/docregistry": "^3.1.0-alpha.8",
"@jupyterlab/mainmenu": "^3.1.0-alpha.8",
"@jupyterlab/settingregistry": "^3.1.0-alpha.8",
"@jupyterlab/translation": "^3.1.0-alpha.8",
"@lumino/widgets": "^1.23.0",
"@retrolab/application": "^0.2.0",
"@retrolab/ui-components": "^0.2.0"
},
@ -63,5 +62,6 @@
},
"jupyterlab": {
"extension": true
}
},
"styleModule": "style/index.js"
}

View File

@ -1,9 +1,13 @@
const func = require('@jupyterlab/testutils/lib/jest-config');
const upstream = func(__dirname);
const esModules = ['lib0', 'y-protocols'].join('|');
let local = {
preset: 'ts-jest/presets/js-with-babel',
transformIgnorePatterns: ['/node_modules/(?!(@jupyterlab/.*)/)'],
transformIgnorePatterns: [
`/node_modules/(?!${esModules}).+\\.js/(?!(@jupyterlab/.*)/)`
],
globals: {
'ts-jest': {
tsconfig: './tsconfig.test.json'

View File

@ -19,7 +19,6 @@
"main": "lib/index.js",
"types": "lib/index.d.ts",
"style": "style/index.css",
"styleModule": "style/index.js",
"directories": {
"lib": "lib/"
},
@ -43,22 +42,22 @@
"watch": "tsc -b --watch"
},
"dependencies": {
"@jupyterlab/application": "^3.0.0",
"@jupyterlab/coreutils": "^5.0.0",
"@jupyterlab/docregistry": "^3.0.0",
"@jupyterlab/rendermime-interfaces": "^3.0.0",
"@jupyterlab/ui-components": "^3.0.0",
"@lumino/algorithm": "^1.3.3",
"@lumino/coreutils": "^1.5.3",
"@lumino/messaging": "^1.4.3",
"@lumino/polling": "^1.3.3",
"@lumino/signaling": "^1.4.3",
"@lumino/widgets": "^1.14.0"
"@jupyterlab/application": "^3.1.0-alpha.8",
"@jupyterlab/coreutils": "^5.1.0-alpha.8",
"@jupyterlab/docregistry": "^3.1.0-alpha.8",
"@jupyterlab/rendermime-interfaces": "^3.1.0-alpha.8",
"@jupyterlab/ui-components": "^3.1.0-alpha.8",
"@lumino/algorithm": "^1.6.0",
"@lumino/coreutils": "^1.8.0",
"@lumino/messaging": "^1.7.0",
"@lumino/polling": "^1.6.0",
"@lumino/signaling": "^1.7.0",
"@lumino/widgets": "^1.23.0"
},
"devDependencies": {
"@babel/core": "^7.11.6",
"@babel/preset-env": "^7.12.1",
"@jupyterlab/testutils": "^3.0.0",
"@jupyterlab/testutils": "^3.1.0-alpha.8",
"@types/jest": "^26.0.10",
"jest": "^26.4.2",
"rimraf": "~3.0.0",
@ -70,5 +69,6 @@
},
"jupyterlab": {
"coreDependency": true
}
},
"styleModule": "style/index.js"
}

View File

@ -19,7 +19,6 @@
"main": "lib/index.js",
"types": "lib/index.d.ts",
"style": "style/index.css",
"styleModule": "style/index.js",
"directories": {
"lib": "lib/"
},
@ -39,12 +38,12 @@
"watch": "tsc -b --watch"
},
"dependencies": {
"@jupyterlab/application": "^3.0.0",
"@jupyterlab/coreutils": "^5.0.0",
"@jupyterlab/docmanager": "^3.0.0",
"@jupyterlab/docregistry": "^3.0.0",
"@jupyterlab/services": "^6.0.0",
"@lumino/algorithm": "^1.3.3"
"@jupyterlab/application": "^3.1.0-alpha.8",
"@jupyterlab/coreutils": "^5.1.0-alpha.8",
"@jupyterlab/docmanager": "^3.1.0-alpha.8",
"@jupyterlab/docregistry": "^3.1.0-alpha.8",
"@jupyterlab/services": "^6.1.0-alpha.8",
"@lumino/algorithm": "^1.6.0"
},
"devDependencies": {
"rimraf": "~3.0.0",
@ -55,5 +54,6 @@
},
"jupyterlab": {
"extension": true
}
},
"styleModule": "style/index.js"
}

View File

@ -19,7 +19,6 @@
"main": "lib/index.js",
"types": "lib/index.d.ts",
"style": "style/index.css",
"styleModule": "style/index.js",
"directories": {
"lib": "lib/"
},
@ -39,9 +38,9 @@
"watch": "tsc -b --watch"
},
"dependencies": {
"@jupyterlab/application": "^3.0.0",
"@jupyterlab/apputils": "^3.0.0",
"@jupyterlab/mainmenu": "^3.0.0",
"@jupyterlab/application": "^3.1.0-alpha.8",
"@jupyterlab/apputils": "^3.1.0-alpha.8",
"@jupyterlab/mainmenu": "^3.1.0-alpha.8",
"@retrolab/ui-components": "^0.2.0"
},
"devDependencies": {
@ -53,5 +52,6 @@
},
"jupyterlab": {
"extension": true
}
},
"styleModule": "style/index.js"
}

View File

@ -19,7 +19,6 @@
"main": "lib/index.js",
"types": "lib/index.d.ts",
"style": "style/index.css",
"styleModule": "style/index.js",
"directories": {
"lib": "lib/"
},
@ -46,18 +45,18 @@
"watch:src": "tsc -w"
},
"dependencies": {
"@jupyterlab/application": "^3.0.0",
"@jupyterlab/apputils": "^3.0.0",
"@jupyterlab/coreutils": "^5.0.0",
"@jupyterlab/docregistry": "^3.0.0",
"@jupyterlab/mainmenu": "^3.0.0",
"@jupyterlab/notebook": "^3.0.0",
"@lumino/commands": "^1.11.4",
"@lumino/disposable": "^1.4.3",
"@jupyterlab/application": "^3.1.0-alpha.8",
"@jupyterlab/apputils": "^3.1.0-alpha.8",
"@jupyterlab/coreutils": "^5.1.0-alpha.8",
"@jupyterlab/docregistry": "^3.1.0-alpha.8",
"@jupyterlab/mainmenu": "^3.1.0-alpha.8",
"@jupyterlab/notebook": "^3.1.0-alpha.8",
"@lumino/commands": "^1.15.0",
"@lumino/disposable": "^1.7.0",
"@retrolab/ui-components": "^0.2.0"
},
"devDependencies": {
"@jupyterlab/builder": "^3.0.0",
"@jupyterlab/builder": "^3.1.0-alpha.8",
"rimraf": "~3.0.0",
"typescript": "~4.1.3"
},
@ -67,5 +66,6 @@
"jupyterlab": {
"extension": true,
"outputDir": "../../retrolab/labextension"
}
},
"styleModule": "style/index.js"
}

View File

@ -19,7 +19,6 @@
"main": "lib/index.js",
"types": "lib/index.d.ts",
"style": "style/index.css",
"styleModule": "style/index.js",
"directories": {
"lib": "lib/"
},
@ -39,12 +38,12 @@
"watch": "tsc -b --watch"
},
"dependencies": {
"@jupyterlab/application": "^3.0.0",
"@jupyterlab/apputils": "^3.0.0",
"@jupyterlab/docmanager": "^3.0.0",
"@jupyterlab/notebook": "^3.0.0",
"@lumino/polling": "^1.3.3",
"@lumino/widgets": "^1.14.0",
"@jupyterlab/application": "^3.1.0-alpha.8",
"@jupyterlab/apputils": "^3.1.0-alpha.8",
"@jupyterlab/docmanager": "^3.1.0-alpha.8",
"@jupyterlab/notebook": "^3.1.0-alpha.8",
"@lumino/polling": "^1.6.0",
"@lumino/widgets": "^1.23.0",
"@retrolab/application": "^0.2.0"
},
"devDependencies": {
@ -56,5 +55,6 @@
},
"jupyterlab": {
"extension": true
}
},
"styleModule": "style/index.js"
}

View File

@ -19,7 +19,6 @@
"main": "lib/index.js",
"types": "lib/index.d.ts",
"style": "style/index.css",
"styleModule": "style/index.js",
"directories": {
"lib": "lib/"
},
@ -39,10 +38,10 @@
"watch": "tsc -b --watch"
},
"dependencies": {
"@jupyterlab/application": "^3.0.0",
"@jupyterlab/coreutils": "^5.0.0",
"@jupyterlab/terminal": "^3.0.0",
"@lumino/algorithm": "^1.3.3"
"@jupyterlab/application": "^3.1.0-alpha.8",
"@jupyterlab/coreutils": "^5.1.0-alpha.8",
"@jupyterlab/terminal": "^3.1.0-alpha.8",
"@lumino/algorithm": "^1.6.0"
},
"devDependencies": {
"rimraf": "~3.0.0",
@ -53,5 +52,6 @@
},
"jupyterlab": {
"extension": true
}
},
"styleModule": "style/index.js"
}

View File

@ -19,7 +19,6 @@
"main": "lib/index.js",
"types": "lib/index.d.ts",
"style": "style/index.css",
"styleModule": "style/index.js",
"directories": {
"lib": "lib/"
},
@ -39,20 +38,20 @@
"watch": "tsc -b --watch"
},
"dependencies": {
"@jupyterlab/application": "^3.0.0",
"@jupyterlab/apputils": "^3.0.0",
"@jupyterlab/coreutils": "^5.0.0",
"@jupyterlab/docmanager": "^3.0.0",
"@jupyterlab/filebrowser": "^3.0.0",
"@jupyterlab/mainmenu": "^3.0.0",
"@jupyterlab/services": "^6.0.0",
"@jupyterlab/settingregistry": "^3.0.0",
"@jupyterlab/statedb": "^3.0.0",
"@jupyterlab/translation": "^3.0.0",
"@jupyterlab/ui-components": "^3.0.0",
"@lumino/algorithm": "^1.3.3",
"@lumino/commands": "^1.12.0",
"@lumino/widgets": "^1.16.1",
"@jupyterlab/application": "^3.1.0-alpha.8",
"@jupyterlab/apputils": "^3.1.0-alpha.8",
"@jupyterlab/coreutils": "^5.1.0-alpha.8",
"@jupyterlab/docmanager": "^3.1.0-alpha.8",
"@jupyterlab/filebrowser": "^3.1.0-alpha.8",
"@jupyterlab/mainmenu": "^3.1.0-alpha.8",
"@jupyterlab/services": "^6.1.0-alpha.8",
"@jupyterlab/settingregistry": "^3.1.0-alpha.8",
"@jupyterlab/statedb": "^3.1.0-alpha.8",
"@jupyterlab/translation": "^3.1.0-alpha.8",
"@jupyterlab/ui-components": "^3.1.0-alpha.8",
"@lumino/algorithm": "^1.6.0",
"@lumino/commands": "^1.15.0",
"@lumino/widgets": "^1.23.0",
"@retrolab/application": "^0.2.0"
},
"devDependencies": {
@ -64,5 +63,6 @@
},
"jupyterlab": {
"extension": true
}
},
"styleModule": "style/index.js"
}

View File

@ -1,125 +1,26 @@
// Vendored from https://github.com/jupyterlab/jupyterlab/blob/b9511a52557d6ae56e597d0f48392993bdc432ae/packages/filebrowser-extension/src/index.ts
// Because of ILabShell being a required dependency in some of the plugins
// TODO: remove this package when ILabShell is optional upstream
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
import {
ILayoutRestorer,
ITreePathUpdater,
IRouter,
JupyterFrontEnd,
JupyterFrontEndPlugin
} from '@jupyterlab/application';
import { CommandToolbarButton } from '@jupyterlab/apputils';
import {
Clipboard,
WidgetTracker,
ICommandPalette,
InputDialog,
showErrorMessage,
DOMUtils,
CommandToolbarButton
} from '@jupyterlab/apputils';
import { PathExt } from '@jupyterlab/coreutils';
import { IDocumentManager } from '@jupyterlab/docmanager';
import {
FilterFileBrowserModel,
FileBrowser,
IFileBrowserFactory
} from '@jupyterlab/filebrowser';
import { IMainMenu } from '@jupyterlab/mainmenu';
import { IFileBrowserFactory } from '@jupyterlab/filebrowser';
import { IRunningSessionManagers, RunningSessions } from '@jupyterlab/running';
import { Contents } from '@jupyterlab/services';
import { ISettingRegistry } from '@jupyterlab/settingregistry';
import { IStateDB } from '@jupyterlab/statedb';
import { ITranslator } from '@jupyterlab/translation';
import {
addIcon,
closeIcon,
copyIcon,
cutIcon,
downloadIcon,
editIcon,
fileIcon,
folderIcon,
markdownIcon,
newFolderIcon,
notebookIcon,
pasteIcon,
runningIcon,
stopIcon,
terminalIcon,
textEditorIcon
terminalIcon
} from '@jupyterlab/ui-components';
import { map, toArray } from '@lumino/algorithm';
import { CommandRegistry } from '@lumino/commands';
import { TabPanel } from '@lumino/widgets';
/**
* The command IDs used by the file browser plugin.
*/
namespace CommandIDs {
export const copy = 'filebrowser:copy';
export const copyDownloadLink = 'filebrowser:copy-download-link';
export const cut = 'filebrowser:cut';
export const del = 'filebrowser:delete';
export const download = 'filebrowser:download';
export const duplicate = 'filebrowser:duplicate';
export const goToPath = 'filebrowser:go-to-path';
export const openPath = 'filebrowser:open-path';
export const open = 'filebrowser:open';
export const openBrowserTab = 'filebrowser:open-browser-tab';
export const paste = 'filebrowser:paste';
export const createNewDirectory = 'filebrowser:create-new-directory';
export const createNewFile = 'filebrowser:create-new-file';
export const createNewMarkdownFile = 'filebrowser:create-new-markdown-file';
export const rename = 'filebrowser:rename';
// For main browser only.
export const share = 'filebrowser:share-main';
// For main browser only.
export const copyPath = 'filebrowser:copy-path';
export const shutdown = 'filebrowser:shutdown';
export const toggleNavigateToCurrentDirectory =
'filebrowser:toggle-navigate-to-current-directory';
export const toggleLastModified = 'filebrowser:toggle-last-modified';
export const search = 'filebrowser:search';
}
/**
* Plugin to add extra buttons to the file browser to create
* new notebooks, files and terminals.
@ -149,7 +50,7 @@ const newFiles: JupyterFrontEndPlugin<void> = {
const newFile = new CommandToolbarButton({
commands,
id: CommandIDs.createNewFile
id: 'filebrowser:create-new-file'
});
browser.toolbar.insertItem(0, 'new-notebook', newNotebook);
@ -185,803 +86,47 @@ const newTerminal: JupyterFrontEndPlugin<void> = {
browser.toolbar.insertItem(2, 'new-terminal', newTerminal);
}
};
/**
* The default file browser extension.
* A plugin to add the file browser widget to an ILabShell
*/
const browser: JupyterFrontEndPlugin<void> = {
activate: activateBrowser,
id: '@retrolab/tree-extension:browser',
requires: [
IFileBrowserFactory,
IDocumentManager,
ISettingRegistry,
ITranslator
],
optional: [
ICommandPalette,
IMainMenu,
ILayoutRestorer,
ITreePathUpdater,
IRunningSessionManagers
],
autoStart: true
};
/**
* The default file browser factory provider.
*
* TODO: remove and use upstream plugin
*/
const factory: JupyterFrontEndPlugin<IFileBrowserFactory> = {
activate: activateFactory,
id: '@retrolab/tree-extension:factory',
provides: IFileBrowserFactory,
requires: [IDocumentManager, ITranslator],
optional: [IStateDB, IRouter, JupyterFrontEnd.ITreeResolver]
};
/**
* The file browser namespace token.
*/
const namespace = 'filebrowser';
/**
* Activate the file browser factory provider.
*/
async function activateFactory(
app: JupyterFrontEnd,
docManager: IDocumentManager,
translator: ITranslator,
state: IStateDB | null,
router: IRouter | null,
tree: JupyterFrontEnd.ITreeResolver | null
): Promise<IFileBrowserFactory> {
const { commands } = app;
const tracker = new WidgetTracker<FileBrowser>({ namespace });
const createFileBrowser = (
id: string,
options: IFileBrowserFactory.IOptions = {}
) => {
const model = new FilterFileBrowserModel({
translator: translator,
auto: options.auto ?? true,
manager: docManager,
driveName: options.driveName || '',
refreshInterval: options.refreshInterval,
state:
options.state === null ? undefined : options.state || state || undefined
});
const restore = options.restore;
const widget = new FileBrowser({ id, model, restore, translator });
// Track the newly created file browser.
void tracker.add(widget);
return widget;
};
// Manually restore and load the default file browser.
const defaultBrowser = createFileBrowser('filebrowser', {
auto: false,
restore: false
});
void Private.restoreBrowser(defaultBrowser, commands, router, tree);
return { createFileBrowser, defaultBrowser, tracker };
}
/**
* Activate the default file browser in the sidebar.
*/
function activateBrowser(
app: JupyterFrontEnd,
factory: IFileBrowserFactory,
docManager: IDocumentManager,
settingRegistry: ISettingRegistry,
translator: ITranslator,
commandPalette: ICommandPalette | null,
mainMenu: IMainMenu | null,
restorer: ILayoutRestorer | null,
treePathUpdater: ITreePathUpdater | null,
manager: IRunningSessionManagers | null
): void {
const browser = factory.defaultBrowser;
// Let the application restorer track the primary file browser (that is
// automatically created) for restoration of application state (e.g. setting
// the file browser as the current side bar widget).
//
// All other file browsers created by using the factory function are
// responsible for their own restoration behavior, if any.
if (restorer) {
restorer.add(browser, namespace);
}
addCommands(
app,
factory,
settingRegistry,
translator,
commandPalette,
mainMenu
);
browser.title.icon = folderIcon;
const tabPanel = new TabPanel({ tabPlacement: 'top', tabsMovable: true });
tabPanel.addClass('jp-TreePanel');
browser.title.label = 'Files';
tabPanel.addWidget(browser);
tabPanel.tabBar.addTab(browser.title);
if (manager) {
const running = new RunningSessions(manager, translator);
running.id = 'jp-running-sessions';
running.title.label = 'Running';
running.title.icon = runningIcon;
tabPanel.addWidget(running);
tabPanel.tabBar.addTab(running.title);
}
app.shell.add(tabPanel, 'main', { rank: 100 });
void Promise.all([app.restored, browser.model.restored]).then(() => {
let navigateToCurrentDirectory = false;
let useFuzzyFilter = true;
void settingRegistry
.load('@jupyterlab/filebrowser-extension:browser')
.then(settings => {
settings.changed.connect(settings => {
navigateToCurrentDirectory = settings.get(
'navigateToCurrentDirectory'
).composite as boolean;
browser.navigateToCurrentDirectory = navigateToCurrentDirectory;
});
navigateToCurrentDirectory = settings.get('navigateToCurrentDirectory')
.composite as boolean;
browser.navigateToCurrentDirectory = navigateToCurrentDirectory;
settings.changed.connect(settings => {
useFuzzyFilter = settings.get('useFuzzyFilter').composite as boolean;
browser.useFuzzyFilter = useFuzzyFilter;
});
useFuzzyFilter = settings.get('useFuzzyFilter').composite as boolean;
browser.useFuzzyFilter = useFuzzyFilter;
});
if (treePathUpdater) {
browser.model.pathChanged.connect((sender, args) => {
treePathUpdater(args.newValue);
});
}
});
}
/**
* Add the main file browser commands to the application's command registry.
*/
function addCommands(
app: JupyterFrontEnd,
factory: IFileBrowserFactory,
settingRegistry: ISettingRegistry,
translator: ITranslator,
commandPalette: ICommandPalette | null,
mainMenu: IMainMenu | null
): void {
const trans = translator.load('jupyterlab');
const { docRegistry: registry, commands } = app;
const { defaultBrowser: browser, tracker } = factory;
commands.addCommand(CommandIDs.del, {
execute: () => {
const widget = tracker.currentWidget;
if (widget) {
return widget.delete();
}
},
icon: closeIcon.bindprops({ stylesheet: 'menuItem' }),
label: trans.__('Delete'),
mnemonic: 0
});
commands.addCommand(CommandIDs.copy, {
execute: () => {
const widget = tracker.currentWidget;
if (widget) {
return widget.copy();
}
},
icon: copyIcon.bindprops({ stylesheet: 'menuItem' }),
label: trans.__('Copy'),
mnemonic: 0
});
commands.addCommand(CommandIDs.cut, {
execute: () => {
const widget = tracker.currentWidget;
if (widget) {
return widget.cut();
}
},
icon: cutIcon.bindprops({ stylesheet: 'menuItem' }),
label: trans.__('Cut')
});
commands.addCommand(CommandIDs.download, {
execute: () => {
const widget = tracker.currentWidget;
if (widget) {
return widget.download();
}
},
icon: downloadIcon.bindprops({ stylesheet: 'menuItem' }),
label: trans.__('Download')
});
commands.addCommand(CommandIDs.duplicate, {
execute: () => {
const widget = tracker.currentWidget;
if (widget) {
return widget.duplicate();
}
},
icon: copyIcon.bindprops({ stylesheet: 'menuItem' }),
label: trans.__('Duplicate')
});
commands.addCommand(CommandIDs.goToPath, {
execute: async args => {
const path = (args.path as string) || '';
try {
const item = await Private.navigateToPath(path, factory, translator);
if (item.type !== 'directory') {
const browserForPath = Private.getBrowserForPath(path, factory);
if (browserForPath) {
browserForPath.clearSelectedItems();
const parts = path.split('/');
const name = parts[parts.length - 1];
if (name) {
await browserForPath.selectItemByName(name);
}
}
}
} catch (reason) {
console.warn(`${CommandIDs.goToPath} failed to go to: ${path}`, reason);
}
}
});
commands.addCommand(CommandIDs.openPath, {
label: args =>
args.path ? trans.__('Open %1', args.path) : trans.__('Open from Path…'),
caption: args =>
args.path ? trans.__('Open %1', args.path) : trans.__('Open from path'),
execute: async args => {
let path: string | undefined;
if (args?.path) {
path = args.path as string;
} else {
path =
(
await InputDialog.getText({
label: trans.__('Path'),
placeholder: '/path/relative/to/jlab/root',
title: trans.__('Open Path'),
okLabel: trans.__('Open')
})
).value ?? undefined;
}
if (!path) {
return;
}
try {
const trailingSlash = path !== '/' && path.endsWith('/');
if (trailingSlash) {
// The normal contents service errors on paths ending in slash
path = path.slice(0, path.length - 1);
}
const browserForPath = Private.getBrowserForPath(path, factory)!;
const { services } = browserForPath.model.manager;
const item = await services.contents.get(path, {
content: false
});
if (trailingSlash && item.type !== 'directory') {
throw new Error(`Path ${path}/ is not a directory`);
}
await commands.execute(CommandIDs.goToPath, {
path,
dontShowBrowser: args.dontShowBrowser
});
if (item.type === 'directory') {
return;
}
return commands.execute('docmanager:open', { path });
} catch (reason) {
if (reason.response && reason.response.status === 404) {
reason.message = trans.__('Could not find path: %1', path);
}
return showErrorMessage(trans.__('Cannot open'), reason);
}
}
});
// Add the openPath command to the command palette
if (commandPalette) {
commandPalette.addItem({
command: CommandIDs.openPath,
category: trans.__('File Operations')
});
}
commands.addCommand(CommandIDs.open, {
execute: args => {
const factory = (args['factory'] as string) || void 0;
const widget = tracker.currentWidget;
if (!widget) {
return;
}
const { contents } = widget.model.manager.services;
return Promise.all(
toArray(
map(widget.selectedItems(), item => {
if (item.type === 'directory') {
const localPath = contents.localPath(item.path);
return widget.model.cd(`/${localPath}`);
}
return commands.execute('docmanager:open', {
factory: factory,
path: item.path
});
})
)
);
},
icon: args => {
const factory = (args['factory'] as string) || void 0;
if (factory) {
// if an explicit factory is passed...
const ft = registry.getFileType(factory);
// ...set an icon if the factory name corresponds to a file type name...
// ...or leave the icon blank
return ft?.icon?.bindprops({ stylesheet: 'menuItem' });
} else {
return folderIcon.bindprops({ stylesheet: 'menuItem' });
}
},
// FIXME-TRANS: Is this localizable?
label: args =>
(args['label'] || args['factory'] || trans.__('Open')) as string,
mnemonic: 0
});
commands.addCommand(CommandIDs.openBrowserTab, {
execute: () => {
const widget = tracker.currentWidget;
if (!widget) {
return;
}
return Promise.all(
toArray(
map(widget.selectedItems(), item => {
return commands.execute('docmanager:open-browser-tab', {
path: item.path
});
})
)
);
},
icon: addIcon.bindprops({ stylesheet: 'menuItem' }),
label: trans.__('Open in New Browser Tab'),
mnemonic: 0
});
commands.addCommand(CommandIDs.copyDownloadLink, {
execute: () => {
const widget = tracker.currentWidget;
if (!widget) {
return;
}
return widget.model.manager.services.contents
.getDownloadUrl(widget.selectedItems().next()!.path)
.then(url => {
Clipboard.copyToSystem(url);
});
},
icon: copyIcon.bindprops({ stylesheet: 'menuItem' }),
label: trans.__('Copy Download Link'),
mnemonic: 0
});
commands.addCommand(CommandIDs.paste, {
execute: () => {
const widget = tracker.currentWidget;
if (widget) {
return widget.paste();
}
},
icon: pasteIcon.bindprops({ stylesheet: 'menuItem' }),
label: trans.__('Paste'),
mnemonic: 0
});
commands.addCommand(CommandIDs.createNewDirectory, {
execute: () => {
const widget = tracker.currentWidget;
if (widget) {
return widget.createNewDirectory();
}
},
icon: newFolderIcon.bindprops({ stylesheet: 'menuItem' }),
label: trans.__('New Folder')
});
commands.addCommand(CommandIDs.createNewFile, {
execute: () => {
const {
model: { path }
} = browser;
void commands.execute('docmanager:new-untitled', {
path,
type: 'file',
ext: 'txt'
});
},
icon: textEditorIcon.bindprops({ stylesheet: 'menuItem' }),
label: trans.__('New File')
});
commands.addCommand(CommandIDs.createNewMarkdownFile, {
execute: () => {
const {
model: { path }
} = browser;
void commands.execute('docmanager:new-untitled', {
path,
type: 'file',
ext: 'md'
});
},
icon: markdownIcon.bindprops({ stylesheet: 'menuItem' }),
label: trans.__('New Markdown File')
});
commands.addCommand(CommandIDs.rename, {
execute: args => {
const widget = tracker.currentWidget;
if (widget) {
return widget.rename();
}
},
icon: editIcon.bindprops({ stylesheet: 'menuItem' }),
label: trans.__('Rename'),
mnemonic: 0
});
commands.addCommand(CommandIDs.copyPath, {
execute: () => {
const widget = tracker.currentWidget;
if (!widget) {
return;
}
const item = widget.selectedItems().next();
if (!item) {
return;
}
Clipboard.copyToSystem(item.path);
},
isVisible: () =>
!!tracker.currentWidget &&
tracker.currentWidget.selectedItems().next !== undefined,
icon: fileIcon.bindprops({ stylesheet: 'menuItem' }),
label: trans.__('Copy Path')
});
commands.addCommand(CommandIDs.shutdown, {
execute: () => {
const widget = tracker.currentWidget;
if (widget) {
return widget.shutdownKernels();
}
},
icon: stopIcon.bindprops({ stylesheet: 'menuItem' }),
label: trans.__('Shut Down Kernel')
});
commands.addCommand(CommandIDs.toggleNavigateToCurrentDirectory, {
label: trans.__('Show Active File in File Browser'),
isToggled: () => browser.navigateToCurrentDirectory,
execute: () => {
const value = !browser.navigateToCurrentDirectory;
const key = 'navigateToCurrentDirectory';
return settingRegistry
.set('@jupyterlab/filebrowser-extension:browser', key, value)
.catch((reason: Error) => {
console.error('Failed to set navigateToCurrentDirectory setting');
});
}
});
commands.addCommand(CommandIDs.toggleLastModified, {
label: trans.__('Toggle Last Modified Column'),
execute: () => {
const header = DOMUtils.findElement(document.body, 'jp-id-modified');
const column = DOMUtils.findElements(
document.body,
'jp-DirListing-itemModified'
);
if (header.classList.contains('jp-LastModified-hidden')) {
header.classList.remove('jp-LastModified-hidden');
for (let i = 0; i < column.length; i++) {
column[i].classList.remove('jp-LastModified-hidden');
}
} else {
header.classList.add('jp-LastModified-hidden');
for (let i = 0; i < column.length; i++) {
column[i].classList.add('jp-LastModified-hidden');
}
}
}
});
commands.addCommand(CommandIDs.search, {
label: trans.__('Search on File Names'),
execute: () => alert('search')
});
if (mainMenu) {
mainMenu.settingsMenu.addGroup(
[{ command: CommandIDs.toggleNavigateToCurrentDirectory }],
5
);
}
if (commandPalette) {
commandPalette.addItem({
command: CommandIDs.toggleNavigateToCurrentDirectory,
category: trans.__('File Operations')
});
}
// matches anywhere on filebrowser
const selectorContent = '.jp-DirListing-content';
// matches all filebrowser items
const selectorItem = '.jp-DirListing-item[data-isdir]';
// matches only non-directory items
const selectorNotDir = '.jp-DirListing-item[data-isdir="false"]';
// If the user did not click on any file, we still want to show paste and new folder,
// so target the content rather than an item.
app.contextMenu.addItem({
command: CommandIDs.createNewDirectory,
selector: selectorContent,
rank: 1
});
app.contextMenu.addItem({
command: CommandIDs.createNewFile,
selector: selectorContent,
rank: 2
});
app.contextMenu.addItem({
command: CommandIDs.createNewMarkdownFile,
selector: selectorContent,
rank: 3
});
app.contextMenu.addItem({
command: CommandIDs.paste,
selector: selectorContent,
rank: 4
});
app.contextMenu.addItem({
command: CommandIDs.open,
selector: selectorItem,
rank: 1
});
app.contextMenu.addItem({
command: CommandIDs.openBrowserTab,
selector: selectorNotDir,
rank: 3
});
app.contextMenu.addItem({
command: CommandIDs.rename,
selector: selectorItem,
rank: 4
});
app.contextMenu.addItem({
command: CommandIDs.del,
selector: selectorItem,
rank: 5
});
app.contextMenu.addItem({
command: CommandIDs.cut,
selector: selectorItem,
rank: 6
});
app.contextMenu.addItem({
command: CommandIDs.copy,
selector: selectorNotDir,
rank: 7
});
app.contextMenu.addItem({
command: CommandIDs.duplicate,
selector: selectorNotDir,
rank: 8
});
app.contextMenu.addItem({
command: CommandIDs.download,
selector: selectorNotDir,
rank: 9
});
app.contextMenu.addItem({
command: CommandIDs.shutdown,
selector: selectorNotDir,
rank: 10
});
app.contextMenu.addItem({
command: CommandIDs.share,
selector: selectorItem,
rank: 11
});
app.contextMenu.addItem({
command: CommandIDs.copyPath,
selector: selectorItem,
rank: 12
});
app.contextMenu.addItem({
command: CommandIDs.copyDownloadLink,
selector: selectorNotDir,
rank: 13
});
app.contextMenu.addItem({
command: CommandIDs.toggleLastModified,
selector: '.jp-DirListing-header',
rank: 14
});
}
/**
* A namespace for private module data.
*/
namespace Private {
/**
* Get browser object given file path.
*/
export function getBrowserForPath(
path: string,
factory: IFileBrowserFactory
): FileBrowser | undefined {
const { defaultBrowser: browser, tracker } = factory;
const driveName = browser.model.manager.services.contents.driveName(path);
if (driveName) {
const browserForPath = tracker.find(
_path => _path.model.driveName === driveName
);
if (!browserForPath) {
// warn that no filebrowser could be found for this driveName
console.warn(
`${CommandIDs.goToPath} failed to find filebrowser for path: ${path}`
);
return;
}
return browserForPath;
}
// if driveName is empty, assume the main filebrowser
return browser;
}
/**
* Navigate to a path or the path containing a file.
*/
export async function navigateToPath(
path: string,
const browserWidget: JupyterFrontEndPlugin<void> = {
id: '@jupyterlab-classic/tree-extension:widget',
requires: [IFileBrowserFactory, ITranslator],
optional: [IRunningSessionManagers],
autoStart: true,
activate: (
app: JupyterFrontEnd,
factory: IFileBrowserFactory,
translator: ITranslator
): Promise<Contents.IModel> {
const trans = translator.load('jupyterlab');
const browserForPath = Private.getBrowserForPath(path, factory);
if (!browserForPath) {
throw new Error(trans.__('No browser for path'));
}
const { services } = browserForPath.model.manager;
const localPath = services.contents.localPath(path);
translator: ITranslator,
manager: IRunningSessionManagers | null
): void => {
const tabPanel = new TabPanel({ tabPlacement: 'top', tabsMovable: true });
tabPanel.addClass('jp-TreePanel');
await services.ready;
const item = await services.contents.get(path, { content: false });
const { model } = browserForPath;
await model.restored;
if (item.type === 'directory') {
await model.cd(`/${localPath}`);
} else {
await model.cd(`/${PathExt.dirname(localPath)}`);
const { defaultBrowser: browser } = factory;
browser.title.label = 'Files';
tabPanel.addWidget(browser);
tabPanel.tabBar.addTab(browser.title);
if (manager) {
const running = new RunningSessions(manager, translator);
running.id = 'jp-running-sessions';
running.title.label = 'Running';
running.title.icon = runningIcon;
tabPanel.addWidget(running);
tabPanel.tabBar.addTab(running.title);
}
return item;
app.shell.add(tabPanel, 'main', { rank: 100 });
}
/**
* Restores file browser state and overrides state if tree resolver resolves.
*/
export async function restoreBrowser(
browser: FileBrowser,
commands: CommandRegistry,
router: IRouter | null,
tree: JupyterFrontEnd.ITreeResolver | null
): Promise<void> {
const restoring = 'jp-mod-restoring';
browser.addClass(restoring);
if (!router) {
await browser.model.restore(browser.id);
await browser.model.refresh();
browser.removeClass(restoring);
return;
}
const listener = async () => {
router.routed.disconnect(listener);
const paths = await tree?.paths;
if (paths?.file || paths?.browser) {
// Restore the model without populating it.
await browser.model.restore(browser.id, false);
if (paths.file) {
await commands.execute(CommandIDs.openPath, {
path: paths.file,
dontShowBrowser: true
});
}
if (paths.browser) {
await commands.execute(CommandIDs.openPath, {
path: paths.browser,
dontShowBrowser: true
});
}
} else {
await browser.model.restore(browser.id);
await browser.model.refresh();
}
browser.removeClass(restoring);
};
router.routed.connect(listener);
}
}
};
/**
* Export the plugins as default.
*/
const plugins: JupyterFrontEndPlugin<any>[] = [
browser,
factory,
newFiles,
newTerminal
newTerminal,
browserWidget
];
export default plugins;

View File

@ -19,7 +19,6 @@
"main": "lib/index.js",
"types": "lib/index.d.ts",
"style": "style/index.css",
"styleModule": "style/index.js",
"directories": {
"lib": "lib/"
},
@ -43,14 +42,14 @@
"watch": "tsc -b --watch"
},
"dependencies": {
"@jupyterlab/ui-components": "^3.0.0",
"@jupyterlab/ui-components": "^3.1.0-alpha.8",
"react": "^17.0.1",
"react-dom": "^17.0.1"
},
"devDependencies": {
"@babel/core": "^7.10.2",
"@babel/preset-env": "^7.10.2",
"@jupyterlab/testutils": "^3.0.0",
"@jupyterlab/testutils": "^3.1.0-alpha.8",
"@types/jest": "^26.0.10",
"babel-loader": "^8.0.6",
"jest": "^26.4.2",
@ -63,5 +62,6 @@
},
"jupyterlab": {
"coreDependency": true
}
},
"styleModule": "style/index.js"
}

View File

@ -1,3 +1,3 @@
[build-system]
requires = ["jupyter_packaging~=0.7.9", "jupyterlab~=3.0", "setuptools>=40.8.0", "wheel"]
requires = ["jupyter_packaging~=0.7.9", "jupyterlab>=3.1.0a8,==3.*", "setuptools>=40.8.0", "wheel"]
build-backend = "setuptools.build_meta"

View File

@ -1,6 +1,7 @@
import os
from os.path import join as pjoin
from jupyter_core.application import base_aliases, base_flags
from jupyter_server.base.handlers import JupyterHandler
from jupyter_server.extension.handler import (
ExtensionHandlerMixin,
@ -13,6 +14,7 @@ from jupyterlab_server.config import get_page_config, recursive_update, LabConfi
from jupyterlab_server.handlers import is_url, _camelCase
from nbclassic.shim import NBClassicConfigShimMixin
from tornado import web
from traitlets import Bool
from ._version import __version__
@ -35,6 +37,7 @@ class RetroHandler(ExtensionHandlerJinjaMixin, ExtensionHandlerMixin, JupyterHan
"token": self.settings["token"],
"fullStaticUrl": ujoin(self.base_url, "static", self.name),
"frontendUrl": ujoin(self.base_url, "retro/"),
"collaborative": app.collaborative,
}
mathjax_config = self.settings.get("mathjax_config", "TeX-AMS_HTML-full,Safe")
@ -116,6 +119,16 @@ class RetroApp(NBClassicConfigShimMixin, LabServerApp):
user_settings_dir = get_user_settings_dir()
workspaces_dir = get_workspaces_dir()
subcommands = {}
collaborative = Bool(
False, config=True, help="Whether to enable collaborative mode."
)
aliases = dict(base_aliases)
flags = dict(base_flags)
flags["collaborative"] = (
{"RetroApp": {"collaborative": True}},
"Whether to enable collaborative mode.",
)
def initialize_handlers(self):
self.handlers.append(

View File

@ -84,7 +84,7 @@ setup_args = dict(
cmdclass=cmdclass,
packages=setuptools.find_packages(),
install_requires=[
"jupyterlab>=3.0.9,<4",
"jupyterlab>=3.1.0a8,<4",
"jupyterlab_server~=2.3",
"jupyter_server~=1.4",
"nbclassic~=0.2",

1785
yarn.lock

File diff suppressed because it is too large Load Diff