浏览代码

Merge pull request #1215 from blink1073/upgrade-phosphor

Upgrade to phosphor 0.7
Afshin Darian 8 年之前
父节点
当前提交
16f9146f9c

+ 1 - 1
examples/console/package.json

@@ -11,7 +11,7 @@
   "dependencies": {
     "@jupyterlab/services": "^0.25.0",
     "jupyterlab": "file:../..",
-    "phosphor": "^0.6.0"
+    "phosphor": "^0.7.0"
   },
   "devDependencies": {
     "concurrently": "^2.0.0",

+ 1 - 1
examples/filebrowser/package.json

@@ -11,7 +11,7 @@
   "dependencies": {
     "@jupyterlab/services": "^0.25.0",
     "jupyterlab": "file:../..",
-    "phosphor": "^0.6.0"
+    "phosphor": "^0.7.0"
   },
   "devDependencies": {
     "css-loader": "^0.23.1",

+ 1 - 1
examples/notebook/package.json

@@ -11,7 +11,7 @@
   "dependencies": {
     "@jupyterlab/services": "^0.25.0",
     "jupyterlab": "file:../..",
-    "phosphor": "^0.6.0"
+    "phosphor": "^0.7.0"
   },
   "devDependencies": {
     "concurrently": "^2.0.0",

+ 1 - 1
examples/terminal/package.json

@@ -11,7 +11,7 @@
   "dependencies": {
     "@jupyterlab/services": "^0.25.0",
     "jupyterlab": "file:../..",
-    "phosphor": "^0.6.0",
+    "phosphor": "^0.7.0",
     "xterm": "^1.1.3"
   },
   "devDependencies": {

+ 1 - 1
package.json

@@ -18,7 +18,7 @@
     "less": "^2.7.1",
     "marked": "^0.3.5",
     "moment": "^2.11.2",
-    "phosphor": "^0.6.1",
+    "phosphor": "^0.7.0",
     "sanitize-html": "^1.12.0",
     "semver": "^5.3.0",
     "simulate-event": "^1.2.0",

+ 1 - 1
src/application/dockpanel.css

@@ -13,7 +13,7 @@
 |----------------------------------------------------------------------------*/
 
 
-.p-DockPanel-tabPanel > .p-StackedPanel {
+.p-DockPanel-widget {
   background:var(--jp-layout-color1);
   border-left: var(--jp-border-width) solid var(--jp-border-color1);
   border-right: var(--jp-border-width) solid var(--jp-border-color1);

+ 3 - 3
src/application/shell.ts

@@ -2,7 +2,7 @@
 // Distributed under the terms of the Modified BSD License.
 
 import {
-  each
+  each, toArray
 } from 'phosphor/lib/algorithm/iteration';
 
 import {
@@ -256,7 +256,7 @@ class ApplicationShell extends Widget {
    */
   activateMain(id: string): void {
     let dock = this._dockPanel;
-    let widget = find(dock.widgets, value => value.id === id);
+    let widget = find(dock.widgets(), value => value.id === id);
     if (widget) {
       dock.activateWidget(widget);
     }
@@ -280,7 +280,7 @@ class ApplicationShell extends Widget {
    * Close all tracked widgets.
    */
   closeAll(): void {
-    each(this._dockPanel.widgets, widget => { widget.close(); });
+    each(toArray(this._dockPanel.widgets()), widget => { widget.close(); });
   }
 
   private _topPanel: Panel;

+ 1 - 1
src/application/tabs.css

@@ -253,7 +253,7 @@
 |----------------------------------------------------------------------------*/
 
 
-.p-DockPanel-tabPanel > .p-TabBar .p-TabBar-tab.jp-mod-current:before {
+.p-DockPanel-tabBar .p-TabBar-tab.jp-mod-current:before {
   position: absolute;
   top: calc(-1 * var(--jp-border-width));
   left: calc(-1 * var(--jp-border-width));

+ 2 - 2
src/docregistry/registry.ts

@@ -6,7 +6,7 @@ import {
 } from '@jupyterlab/services';
 
 import {
-  EmptyIterator, IIterator, each, map
+  IIterator, each, empty, map
 } from 'phosphor/lib/algorithm/iteration';
 
 import {
@@ -400,7 +400,7 @@ class DocumentRegistry {
   widgetExtensions(widgetName: string): IIterator<DocumentRegistry.IWidgetExtension<Widget, DocumentRegistry.IModel>> {
     widgetName = widgetName.toLowerCase();
     if (!(widgetName in this._extenders)) {
-      return EmptyIterator.instance;
+      return empty<DocumentRegistry.IWidgetExtension<Widget, DocumentRegistry.IModel>>();
     }
     return this._extenders[widgetName].iter();
   }

+ 2 - 5
src/toolbar/index.ts

@@ -121,13 +121,10 @@ class Toolbar<T extends Widget> extends Widget {
    * Remove an item in the toolbar by value.
    *
    *  @param name - The name of the widget to remove from the toolbar.
-   *
-   * @returns The index occupied by the item, or `-1` if the item
-   *   was not contained in the toolbar.
    */
-  removeItem(widget: T): number {
+  removeItem(widget: T): void {
     let layout = this.layout as PanelLayout;
-    return layout.removeWidget(widget);
+    layout.removeWidget(widget);
   }
 }
 

+ 3 - 3
test/src/toolbar/toolbar.spec.ts

@@ -128,13 +128,13 @@ describe('toolbar/toolbar', () => {
         widget.addItem('a', new Widget());
         let b = new Widget();
         widget.addItem('b', b);
-        expect(widget.removeItem(b)).to.be(1);
+        expect(widget.removeItem(b)).to.be(void 0);
       });
 
-      it('should return -1 if the widget is not in the toolbar', () => {
+      it('should be a no-op the widget is not in the toolbar', () => {
         let widget = new Toolbar();
         widget.addItem('a', new Widget());
-        expect(widget.removeItem(new Widget())).to.be(-1);
+        expect(widget.removeItem(new Widget())).to.be(void 0);
       });
 
     });