Skip to content

Commit

Permalink
Merge pull request #6569 from afshin/instance-tracker
Browse files Browse the repository at this point in the history
Separate instance tracking from widget tracking.
  • Loading branch information
ian-r-rose committed Jun 20, 2019
2 parents fd18d01 + 547dd1c commit da8e7bd
Show file tree
Hide file tree
Showing 140 changed files with 2,156 additions and 1,493 deletions.
2 changes: 1 addition & 1 deletion buildutils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"watch": "tsc -w --listEmittedFiles"
},
"dependencies": {
"@phosphor/coreutils": "^1.3.0",
"@phosphor/coreutils": "^1.3.1",
"@yarnpkg/lockfile": "^1.1.0",
"child_process": "~1.0.2",
"commander": "~2.20.0",
Expand Down
22 changes: 11 additions & 11 deletions dev_mode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"build": "webpack",
"build:prod": "webpack --config webpack.prod.config.js",
"build:prod": "node --max_old_space_size=4096 ./node_modules/webpack/bin/webpack.jswebpack --config webpack.prod.config.js",
"build:prod:stats": "webpack --profile --config webpack.prod.config.js --json > stats.json",
"build:stats": "webpack --profile --json > stats.json",
"clean": "rimraf build",
Expand Down Expand Up @@ -64,16 +64,16 @@
"@jupyterlab/tooltip-extension": "^1.0.0-alpha.11",
"@jupyterlab/vdom-extension": "^1.0.0-alpha.11",
"@jupyterlab/vega5-extension": "^1.0.0-alpha.11",
"@phosphor/algorithm": "^1.1.2",
"@phosphor/application": "^1.6.0",
"@phosphor/commands": "^1.6.1",
"@phosphor/coreutils": "^1.3.0",
"@phosphor/datagrid": "^0.1.8",
"@phosphor/disposable": "^1.1.2",
"@phosphor/messaging": "^1.2.2",
"@phosphor/properties": "^1.1.2",
"@phosphor/signaling": "^1.2.2",
"@phosphor/widgets": "^1.7.1",
"@phosphor/algorithm": "^1.1.3",
"@phosphor/application": "^1.6.3",
"@phosphor/commands": "^1.6.3",
"@phosphor/coreutils": "^1.3.1",
"@phosphor/datagrid": "^0.1.9",
"@phosphor/disposable": "^1.2.0",
"@phosphor/messaging": "^1.2.3",
"@phosphor/properties": "^1.1.3",
"@phosphor/signaling": "^1.2.3",
"@phosphor/widgets": "^1.8.0",
"ajv": "^6.5.5",
"codemirror": "~5.47.0",
"es6-promise": "~4.2.6",
Expand Down
14 changes: 7 additions & 7 deletions docs/source/developer/extension_dev.rst
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ might want to use them in your extensions.
- ``@jupyterlab/application:ILayoutRestorer``: An interface to the application layout
restoration functionality. Use this to have your activities restored across
page loads.
- ``@jupyterlab/application:IMimeDocumentTracker``: An instance tracker for documents
- ``@jupyterlab/application:IMimeDocumentTracker``: A widget tracker for documents
rendered using a mime renderer extension. Use this if you want to list and interact
with documents rendered by such extensions.
- ``@jupyterlab/application:IRouter``: The URL router used by the application.
Expand All @@ -340,7 +340,7 @@ might want to use them in your extensions.
UI elements.
- ``@jupyterlab/completer:ICompletionManager``: An interface to the completion manager
for the application. Use this to allow your extension to invoke a completer.
- ``@jupyterlab/console:IConsoleTracker``: An instance tracker for code consoles.
- ``@jupyterlab/console:IConsoleTracker``: A widget tracker for code consoles.
Use this if you want to be able to iterate over and interact with code consoles
created by the application.
- ``@jupyterlab/console:IContentFactory``: A factory object that creates new code
Expand All @@ -357,10 +357,10 @@ might want to use them in your extensions.
- ``@jupyterlab/filebrowser:IFileBrowserFactory``: A factory object that creates file browsers.
Use this if you want to create your own file browser (e.g., for a custom storage backend),
or to interact with other file browsers that have been created by extensions.
- ``@jupyterlab/fileeditor:IEditorTracker``: An instance tracker for file editors.
- ``@jupyterlab/fileeditor:IEditorTracker``: A widget tracker for file editors.
Use this if you want to be able to iterate over and interact with file editors
created by the application.
- ``@jupyterlab/imageviewer:IImageTracker``: An instance tracker for images.
- ``@jupyterlab/imageviewer:IImageTracker``: A widget tracker for images.
Use this if you want to be able to iterate over and interact with images
viewed by the application.
- ``@jupyterlab/inspector:IInspector``: An interface for adding variable inspectors to widgets.
Expand All @@ -373,7 +373,7 @@ might want to use them in your extensions.
application left area. Use this to add your own functionality to the panel.
- ``@jupyterlab/notebook:IContentFactory``: A factory object that creates new notebooks.
Use this if you want to create and host notebooks in your own UI elements.
- ``@jupyterlab/notebook:INotebookTracker``: An instance tracker for code consoles.
- ``@jupyterlab/notebook:INotebookTracker``: A widget tracker for code consoles.
Use this if you want to be able to iterate over and interact with notebooks
created by the application.
- ``@jupyterlab/rendermime:IRenderMimeRegistry``: An interface to the rendermime registry
Expand All @@ -382,10 +382,10 @@ might want to use them in your extensions.
`mime renderer extension <#mime-renderer-extensions>`__.
- ``@jupyterlab/rendermime:ILatexTypesetter``: An interface to the LaTeX typesetter for the
application. Use this if you want to typeset math in your extension.
- ``@jupyterlab/settingeditor:ISettingEditorTracker``: An instance tracker for setting editors.
- ``@jupyterlab/settingeditor:ISettingEditorTracker``: A widget tracker for setting editors.
Use this if you want to be able to iterate over and interact with setting editors
created by the application.
- ``@jupyterlab/terminal:ITerminalTracker``: An instance tracker for terminals.
- ``@jupyterlab/terminal:ITerminalTracker``: A widget tracker for terminals.
Use this if you want to be able to iterate over and interact with terminals
created by the application.
- ``@jupyterlab/tooltip:ITooltipManager``: An interface to the tooltip manager for the application.
Expand Down
14 changes: 5 additions & 9 deletions docs/source/developer/xkcd_extension_tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ entire list of import statements looks like the following:
} from '@jupyterlab/application';
import {
ICommandPalette, InstanceTracker // new
ICommandPalette, WidgetTracker // new
} from '@jupyterlab/apputils';
import {
Expand Down Expand Up @@ -707,7 +707,7 @@ Finally, rewrite the ``activate`` function so that it:
1. Declares a widget variable, but does not create an instance
immediately
2. Constructs an ``InstanceTracker`` and tells the ``ILayoutRestorer``
2. Constructs a ``WidgetTracker`` and tells the ``ILayoutRestorer``
to use it to save/restore panel state
3. Creates, tracks, shows, and refreshes the widget panel appropriately
Expand Down Expand Up @@ -748,13 +748,9 @@ Finally, rewrite the ``activate`` function so that it:
// Add the command to the palette.
palette.addItem({ command, category: 'Tutorial' });
// Track and restore the widget state
let tracker = new InstanceTracker<Widget>({ namespace: 'xkcd' });
restorer.restore(tracker, {
command,
args: () => JSONExt.emptyObject,
name: () => 'xkcd'
});
// Track and restore the widget state.
let tracker = new WidgetTracker({ namespace: 'xkcd' });
void restorer.restore(tracker, { command, name: () => 'xkcd' });
};
Rebuild your extension one last time and refresh your browser tab.
Expand Down
4 changes: 2 additions & 2 deletions examples/cell/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"@jupyterlab/rendermime": "^1.0.0-alpha.11",
"@jupyterlab/services": "^4.0.0-alpha.11",
"@jupyterlab/theme-light-extension": "^1.0.0-alpha.12",
"@phosphor/commands": "^1.6.1",
"@phosphor/widgets": "^1.7.1",
"@phosphor/commands": "^1.6.3",
"@phosphor/widgets": "^1.8.0",
"es6-promise": "~4.2.6"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions examples/console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"@jupyterlab/rendermime": "^1.0.0-alpha.11",
"@jupyterlab/services": "^4.0.0-alpha.11",
"@jupyterlab/theme-light-extension": "^1.0.0-alpha.12",
"@phosphor/commands": "^1.6.1",
"@phosphor/widgets": "^1.7.1",
"@phosphor/commands": "^1.6.3",
"@phosphor/widgets": "^1.8.0",
"es6-promise": "~4.2.6"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions examples/filebrowser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
"@jupyterlab/fileeditor": "^1.0.0-alpha.11",
"@jupyterlab/services": "^4.0.0-alpha.11",
"@jupyterlab/theme-light-extension": "^1.0.0-alpha.12",
"@phosphor/algorithm": "^1.1.2",
"@phosphor/commands": "^1.6.1",
"@phosphor/widgets": "^1.7.1",
"@phosphor/algorithm": "^1.1.3",
"@phosphor/commands": "^1.6.3",
"@phosphor/widgets": "^1.8.0",
"es6-promise": "~4.2.6"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions examples/notebook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"@jupyterlab/rendermime": "^1.0.0-alpha.11",
"@jupyterlab/services": "^4.0.0-alpha.11",
"@jupyterlab/theme-light-extension": "^1.0.0-alpha.12",
"@phosphor/commands": "^1.6.1",
"@phosphor/widgets": "^1.7.1",
"@phosphor/commands": "^1.6.3",
"@phosphor/widgets": "^1.8.0",
"es6-promise": "~4.2.6"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/terminal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"@jupyterlab/services": "^4.0.0-alpha.11",
"@jupyterlab/terminal": "^1.0.0-alpha.11",
"@jupyterlab/theme-light-extension": "^1.0.0-alpha.12",
"@phosphor/widgets": "^1.7.1",
"@phosphor/widgets": "^1.8.0",
"es6-promise": "~4.2.6"
},
"devDependencies": {
Expand Down
24 changes: 11 additions & 13 deletions jupyterlab/staging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"build": "webpack",
"build:prod": "webpack --config webpack.prod.config.js",
"build:prod": "node --max_old_space_size=4096 ./node_modules/webpack/bin/webpack.js --config webpack.prod.config.js",
"build:prod:stats": "webpack --profile --config webpack.prod.config.js --json > stats.json",
"build:stats": "webpack --profile --json > stats.json",
"clean": "rimraf build",
Expand All @@ -27,7 +27,6 @@
"@jupyterlab/documentsearch-extension": "^1.0.0-alpha.13",
"@jupyterlab/extensionmanager": "^1.0.0-alpha.11",
"@jupyterlab/extensionmanager-extension": "^1.0.0-alpha.11",
"@jupyterlab/faq-extension": "^1.0.0-alpha.11",
"@jupyterlab/filebrowser": "^1.0.0-alpha.11",
"@jupyterlab/filebrowser-extension": "^1.0.0-alpha.11",
"@jupyterlab/fileeditor": "^1.0.0-alpha.11",
Expand Down Expand Up @@ -65,16 +64,16 @@
"@jupyterlab/tooltip-extension": "^1.0.0-alpha.11",
"@jupyterlab/vdom-extension": "^1.0.0-alpha.11",
"@jupyterlab/vega5-extension": "^1.0.0-alpha.11",
"@phosphor/algorithm": "^1.1.2",
"@phosphor/application": "^1.6.0",
"@phosphor/commands": "^1.6.1",
"@phosphor/coreutils": "^1.3.0",
"@phosphor/datagrid": "^0.1.8",
"@phosphor/disposable": "^1.1.2",
"@phosphor/messaging": "^1.2.2",
"@phosphor/properties": "^1.1.2",
"@phosphor/signaling": "^1.2.2",
"@phosphor/widgets": "^1.7.1",
"@phosphor/algorithm": "^1.1.3",
"@phosphor/application": "^1.6.3",
"@phosphor/commands": "^1.6.3",
"@phosphor/coreutils": "^1.3.1",
"@phosphor/datagrid": "^0.1.9",
"@phosphor/disposable": "^1.2.0",
"@phosphor/messaging": "^1.2.3",
"@phosphor/properties": "^1.1.3",
"@phosphor/signaling": "^1.2.3",
"@phosphor/widgets": "^1.8.0",
"ajv": "^6.5.5",
"codemirror": "~5.47.0",
"es6-promise": "~4.2.6",
Expand Down Expand Up @@ -126,7 +125,6 @@
"@jupyterlab/docmanager-extension": "",
"@jupyterlab/documentsearch-extension": "",
"@jupyterlab/extensionmanager-extension": "",
"@jupyterlab/faq-extension": "",
"@jupyterlab/filebrowser-extension": "",
"@jupyterlab/fileeditor-extension": "",
"@jupyterlab/help-extension": "",
Expand Down
78 changes: 68 additions & 10 deletions jupyterlab/staging/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -445,16 +445,6 @@
react-paginate "^6.3.0"
semver "^6.1.0"

"@jupyterlab/faq-extension@^1.0.0-alpha.11":
version "1.0.0-alpha.11"
resolved "https://registry.yarnpkg.com/@jupyterlab/faq-extension/-/faq-extension-1.0.0-alpha.11.tgz#9087d0d8986e7777f60bd0d118da64338fe3fcbc"
integrity sha512-jt25pbDfqBpWYEajrMkBh7tUWQ5e0yCFCBpI6U7MEaB13uGvrlQ4VSUZAIJ7AA49gY3yt/A1ICV5HMsICmMa/w==
dependencies:
"@jupyterlab/application" "^1.0.0-alpha.11"
"@jupyterlab/apputils" "^1.0.0-alpha.11"
"@jupyterlab/rendermime" "^1.0.0-alpha.11"
"@phosphor/coreutils" "^1.3.0"

"@jupyterlab/filebrowser-extension@^1.0.0-alpha.11":
version "1.0.0-alpha.11"
resolved "https://registry.yarnpkg.com/@jupyterlab/filebrowser-extension/-/filebrowser-extension-1.0.0-alpha.11.tgz#530b6fb2c72ca718f4270f4e84f967e57f2bce12"
Expand Down Expand Up @@ -1131,6 +1121,15 @@
"@phosphor/coreutils" "^1.3.1"
"@phosphor/widgets" "^1.7.1"

"@phosphor/application@^1.6.3":
version "1.6.3"
resolved "https://registry.yarnpkg.com/@phosphor/application/-/application-1.6.3.tgz#69f5eab109b54ee06d39443fa2f0ded573c5a080"
integrity sha512-UaRR91MWBZwNBGt0ekLVaN98KSwffRE0nsu+UgAmd4s8J28vVCQAPqXx1SjNPnaYVILnXD5whmCA02Ca81bR/A==
dependencies:
"@phosphor/commands" "^1.6.3"
"@phosphor/coreutils" "^1.3.1"
"@phosphor/widgets" "^1.8.0"

"@phosphor/collections@^1.1.3":
version "1.1.3"
resolved "https://registry.yarnpkg.com/@phosphor/collections/-/collections-1.1.3.tgz#c938ee4138d97377bba1f0970102071ca3ac1420"
Expand All @@ -1150,6 +1149,18 @@
"@phosphor/keyboard" "^1.1.3"
"@phosphor/signaling" "^1.2.3"

"@phosphor/commands@^1.6.3":
version "1.6.3"
resolved "https://registry.yarnpkg.com/@phosphor/commands/-/commands-1.6.3.tgz#d5481cc35dab34d0e60b3e04a64df00e1bbaffbd"
integrity sha512-PYNHWv6tbXAfAtKiqXuT0OBJvwbJ+RRTV60MBykMF7Vqz9UaZ9n2e/eB2EAGEFccF0PnjTCvBEZgarwwMVi8Hg==
dependencies:
"@phosphor/algorithm" "^1.1.3"
"@phosphor/coreutils" "^1.3.1"
"@phosphor/disposable" "^1.2.0"
"@phosphor/domutils" "^1.1.3"
"@phosphor/keyboard" "^1.1.3"
"@phosphor/signaling" "^1.2.3"

"@phosphor/coreutils@^1.3.0", "@phosphor/coreutils@^1.3.1":
version "1.3.1"
resolved "https://registry.yarnpkg.com/@phosphor/coreutils/-/coreutils-1.3.1.tgz#441e34f42340f7faa742a88b2a181947a88d7226"
Expand All @@ -1169,13 +1180,35 @@
"@phosphor/signaling" "^1.2.3"
"@phosphor/widgets" "^1.7.1"

"@phosphor/datagrid@^0.1.9":
version "0.1.9"
resolved "https://registry.yarnpkg.com/@phosphor/datagrid/-/datagrid-0.1.9.tgz#7a20383f6dad254e10a226180f90de94fe08e612"
integrity sha512-8YV8u/o7jV9TJM/vh/jyqEg4xaDSce0D+iWs73ZQRjnGwbxHPsfA2bPpGli5Z28DLsPqKlsiXOxqzYXnTqaI4w==
dependencies:
"@phosphor/algorithm" "^1.1.3"
"@phosphor/coreutils" "^1.3.1"
"@phosphor/disposable" "^1.2.0"
"@phosphor/domutils" "^1.1.3"
"@phosphor/dragdrop" "^1.3.3"
"@phosphor/messaging" "^1.2.3"
"@phosphor/signaling" "^1.2.3"
"@phosphor/widgets" "^1.8.0"

"@phosphor/disposable@^1.1.2", "@phosphor/disposable@^1.1.3":
version "1.1.3"
resolved "https://registry.yarnpkg.com/@phosphor/disposable/-/disposable-1.1.3.tgz#912765c02e2f04b8d56efb26ecd7270207a40f41"
integrity sha512-yH5/HZzOyp37y+G/6X1hem3EfQCsUMtiStacG9W5F7mRsO4UuIXGxY3/XyJHAzy9UFrInOJD7alurQc/4wYhbQ==
dependencies:
"@phosphor/algorithm" "^1.1.3"

"@phosphor/disposable@^1.2.0":
version "1.2.0"
resolved "https://registry.yarnpkg.com/@phosphor/disposable/-/disposable-1.2.0.tgz#878b9b5863f2026bbf2935eb600c7fdc97d0d026"
integrity sha512-4PoWoffdrLyWOW5Qv7I8//owvZmv57YhaxetAMWeJl13ThXc901RprL0Gxhtue2ZxL2PtUjM1207HndKo2FVjA==
dependencies:
"@phosphor/algorithm" "^1.1.3"
"@phosphor/signaling" "^1.2.3"

"@phosphor/domutils@^1.1.2", "@phosphor/domutils@^1.1.3":
version "1.1.3"
resolved "https://registry.yarnpkg.com/@phosphor/domutils/-/domutils-1.1.3.tgz#5aeeaefb4bbfcc7c0942e5287a29d3c7f2b1a2bc"
Expand All @@ -1189,6 +1222,14 @@
"@phosphor/coreutils" "^1.3.1"
"@phosphor/disposable" "^1.1.3"

"@phosphor/dragdrop@^1.3.3":
version "1.3.3"
resolved "https://registry.yarnpkg.com/@phosphor/dragdrop/-/dragdrop-1.3.3.tgz#9487d27a6eb8cd54bfe6d91eaffc9d0852817b61"
integrity sha512-+SrlGsVQwY8OHCWxE/Zvihpk6Rc6bytJDqOUUTZqdL8hvM9QZeopAFioPDxuo1pTj87Um6cR4ekvbTU4KZ/90w==
dependencies:
"@phosphor/coreutils" "^1.3.1"
"@phosphor/disposable" "^1.2.0"

"@phosphor/keyboard@^1.1.3":
version "1.1.3"
resolved "https://registry.yarnpkg.com/@phosphor/keyboard/-/keyboard-1.1.3.tgz#e5fd13af0479034ef0b5fffcf43ef2d4a266b5b6"
Expand Down Expand Up @@ -1238,6 +1279,23 @@
"@phosphor/signaling" "^1.2.3"
"@phosphor/virtualdom" "^1.1.3"

"@phosphor/widgets@^1.8.0":
version "1.8.0"
resolved "https://registry.yarnpkg.com/@phosphor/widgets/-/widgets-1.8.0.tgz#879a28366bc53df9077662eb3178af86ffa3e95e"
integrity sha512-Tkjk1bJks9Dtm7lhxTcpA+cSGwdNvRWG5TrolS0waSUiEdgrStWc8QnkMga3zwUZ9Wrz3cLZWnqBfxMjDqwMnA==
dependencies:
"@phosphor/algorithm" "^1.1.3"
"@phosphor/commands" "^1.6.3"
"@phosphor/coreutils" "^1.3.1"
"@phosphor/disposable" "^1.2.0"
"@phosphor/domutils" "^1.1.3"
"@phosphor/dragdrop" "^1.3.3"
"@phosphor/keyboard" "^1.1.3"
"@phosphor/messaging" "^1.2.3"
"@phosphor/properties" "^1.1.3"
"@phosphor/signaling" "^1.2.3"
"@phosphor/virtualdom" "^1.1.3"

"@sindresorhus/is@^0.14.0":
version "0.14.0"
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea"
Expand Down
2 changes: 1 addition & 1 deletion jupyterlab/tests/mock_packages/mimeextension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.3.0",
"private": true,
"dependencies": {
"@phosphor/widgets": "^1.7.1"
"@phosphor/widgets": "^1.8.0"
},
"jupyterlab": {
"mimeExtension": true
Expand Down
4 changes: 2 additions & 2 deletions packages/application-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
"@jupyterlab/application": "^1.0.0-alpha.11",
"@jupyterlab/apputils": "^1.0.0-alpha.11",
"@jupyterlab/coreutils": "^3.0.0-alpha.11",
"@phosphor/algorithm": "^1.1.2",
"@phosphor/widgets": "^1.7.1",
"@phosphor/algorithm": "^1.1.3",
"@phosphor/widgets": "^1.8.0",
"react": "~16.8.4"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/application-extension/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ const layout: JupyterFrontEndPlugin<ILayoutRestorer> = {
activate: (app: JupyterFrontEnd, state: IStateDB, labShell: ILabShell) => {
const first = app.started;
const registry = app.commands;
const restorer = new LayoutRestorer({ first, registry, state });
const restorer = new LayoutRestorer({ connector: state, first, registry });

void restorer.fetch().then(saved => {
labShell.restoreLayout(saved);
Expand Down
Loading

0 comments on commit da8e7bd

Please sign in to comment.