浏览代码

wip phosphor update

Steven Silvester 8 年之前
父节点
当前提交
55142087e0

+ 3 - 0
package.json

@@ -8,7 +8,10 @@
   "typings": "lib/index.d.ts",
   "dependencies": {
     "@jupyterlab/services": "^0.38.0",
+    "@phosphor/algorithm": "^0.1.0",
     "@phosphor/application": "^0.1.2",
+    "@phosphor/commands": "^0.1.2",
+    "@phosphor/coreutils": "^0.1.1",
     "@phosphor/widgets": "^0.1.3",
     "ansi_up": "^1.3.0",
     "backbone": "^1.2.0",

+ 2 - 2
src/about/index.ts

@@ -6,7 +6,7 @@ import {
 } from '@phosphor/messaging';
 
 import {
-  h, VNode
+  h, VirtualNode
 } from '@phosphor/virtualdom';
 
 import {
@@ -327,7 +327,7 @@ class AboutWidget extends VDomWidget<AboutModel> {
   /**
    * Render the about plugin to virtual DOM nodes.
    */
-  protected render(): VNode {
+  protected render(): VirtualNode {
     let title = this.model.title;
     let version = `v${this.model.version}`;
     let headerText = this.model.headerText;

+ 6 - 8
src/codeeditor/editor.ts

@@ -6,7 +6,7 @@ import {
 } from '@phosphor/disposable';
 
 import {
-  ISignal, Signal.clearData, defineSignal
+  ISignal, Signal
 } from '@phosphor/signaling';
 
 import {
@@ -209,7 +209,9 @@ namespace CodeEditor {
     /**
      * A signal emitted when a mimetype changes.
      */
-    readonly mimeTypeChanged: ISignal<this, IChangedArgs<string>>;
+    get mimeTypeChanged(): ISignal<this, IChangedArgs<string>> {
+      return this._mimeTypeChanged;
+    }
 
     /**
      * Get the value of the model.
@@ -237,7 +239,7 @@ namespace CodeEditor {
         return;
       }
       this._mimetype = newValue;
-      this.mimeTypeChanged.emit({
+      this._mimeTypeChanged.emit({
         name: 'mimeType',
         oldValue,
         newValue
@@ -268,13 +270,9 @@ namespace CodeEditor {
     private _selections = new ObservableMap<ITextSelection[]>();
     private _mimetype: string;
     private _isDisposed = false;
+    private _mimeTypeChanged = new Signal<this, IChangedArgs<string>>(this);
   }
 
-  /**
-   * The signals for the `Model` class.
-   */
-  defineSignal(Model.prototype, 'mimeTypeChanged');
-
   /**
    * A selection owner.
    */

+ 2 - 2
src/codeeditor/widget.ts

@@ -6,7 +6,7 @@ import {
 } from '@phosphor/messaging';
 
 import {
-  ResizeMessage, Widget
+  Widget
 } from '@phosphor/widgets';
 
 import {
@@ -102,7 +102,7 @@ class CodeEditorWidget extends Widget {
   /**
    * A message handler invoked on an `'resize'` message.
    */
-  protected onResize(msg: ResizeMessage): void {
+  protected onResize(msg: Widget.ResizeMessage): void {
     if (msg.width < 0 || msg.height < 0) {
       if (this._resizing === -1) {
         this._editor.setSize(null);

+ 4 - 4
src/commandlinker/commandlinker.ts

@@ -81,7 +81,7 @@ interface ICommandLinker extends IDisposable {
    * that were never connected.
    *
    * This method can be called on rendered virtual DOM nodes that were populated
-   * using the `populateVNodeAttributes` method in order to disconnect them from
+   * using the `populateVirtualNodeAttributes` method in order to disconnect them from
    * executing their command/argument pair.
    */
   disconnectNode(node: HTMLElement): HTMLElement;
@@ -104,7 +104,7 @@ interface ICommandLinker extends IDisposable {
    * The attributes instance that is returned is identical to the attributes
    * instance that was passed in, i.e., this method mutates the original.
    */
-  populateVNodeAttrs(attrs: IElementAttrs, command: string, args: JSONObject): IElementAttrs;
+  populateVirtualNodeAttrs(attrs: IElementAttrs, command: string, args: JSONObject): IElementAttrs;
 }
 
 
@@ -179,7 +179,7 @@ class CommandLinker implements ICommandLinker {
    * that were never connected.
    *
    * This method can be called on rendered virtual DOM nodes that were populated
-   * using the `populateVNodeAttributes` method in order to disconnect them from
+   * using the `populateVirtualNodeAttributes` method in order to disconnect them from
    * executing their command/argument pair.
    */
   disconnectNode(node: HTMLElement): HTMLElement {
@@ -226,7 +226,7 @@ class CommandLinker implements ICommandLinker {
    * The attributes instance that is returned is identical to the attributes
    * instance that was passed in, i.e., this method mutates the original.
    */
-  populateVNodeAttrs(attrs: IElementAttrs, command: string, args: JSONObject): IElementAttrs {
+  populateVirtualNodeAttrs(attrs: IElementAttrs, command: string, args: JSONObject): IElementAttrs {
     let argsValue = JSON.stringify(args);
     attrs.dataset = attrs.dataset || {};
     attrs.dataset[COMMAND_ATTR] = command;

+ 6 - 7
src/common/activitymonitor.ts

@@ -6,7 +6,7 @@ import {
 } from '@phosphor/disposable';
 
 import {
-  Signal.clearData, defineSignal, ISignal
+  ISignal, Signal
 } from '@phosphor/signaling';
 
 
@@ -26,7 +26,9 @@ class ActivityMonitor<Sender, Args> implements IDisposable {
   /**
    * A signal emitted when activity has ceased.
    */
-  readonly activityStopped: ISignal<this, ActivityMonitor.IArguments<Sender, Args>>;
+  get activityStopped(): ISignal<this, ActivityMonitor.IArguments<Sender, Args>> {
+    return this._activityStopped;
+  }
 
   /**
    * The timeout associated with the monitor, in milliseconds.
@@ -67,7 +69,7 @@ class ActivityMonitor<Sender, Args> implements IDisposable {
     this._sender = sender;
     this._args = args;
     this._timer = window.setTimeout(() => {
-      this.activityStopped.emit({
+      this._activityStopped.emit({
         sender: this._sender,
         args: this._args
       });
@@ -81,13 +83,10 @@ class ActivityMonitor<Sender, Args> implements IDisposable {
   private _sender: Sender = null;
   private _args: Args = null;
   private _isDisposed = false;
+  private _activityStopped = new Signal<this, ActivityMonitor.IArguments<Sender, Args>>(this);
 }
 
 
-// Define the signals for the `ActivityMonitor` class.
-defineSignal(ActivityMonitor.prototype, 'activityStopped');
-
-
 /**
  * The namespace for `ActivityMonitor` statics.
  */

+ 1 - 1
src/common/dialog.ts

@@ -396,7 +396,7 @@ class Dialog extends Panel {
     for (let buttonNode of this._buttonNodes) {
       if (buttonNode.contains(event.target as HTMLElement)) {
         this.close();
-        let button = this._buttons[this._buttonNodes.ArrayExt.firstIndexOf(buttonNode)];
+        let button = this._buttons[this._buttonNodes.indexOf(buttonNode)];
         this.resolve(button);
       }
     }

+ 32 - 27
src/common/instancetracker.ts

@@ -18,12 +18,12 @@ import {
 } from '@phosphor/properties';
 
 import {
-  Signal.clearData, defineSignal, ISignal
+  ISignal, Signal
 } from '@phosphor/signaling';
 
 import {
   CommandRegistry
-} from '@phosphor/widgets';
+} from '@phosphor/commands';
 
 import {
   FocusTracker
@@ -55,6 +55,15 @@ interface IInstanceTracker<T extends Widget> extends IDisposable {
    */
   readonly currentChanged: ISignal<this, T>;
 
+  /**
+   * A signal emitted when a widget is added.
+   *
+   * #### Notes
+   * This signal will only fire when a widget is added to the tracker. It will
+   * not fire if a widget is injected into the tracker.
+   */
+  readonly widgetAdded: ISignal<this, T>;
+
   /**
    * The current widget is the most recently focused widget.
    */
@@ -65,15 +74,6 @@ interface IInstanceTracker<T extends Widget> extends IDisposable {
    */
   readonly size: number;
 
-  /**
-   * A signal emitted when a widget is added.
-   *
-   * #### Notes
-   * This signal will only fire when a widget is added to the tracker. It will
-   * not fire if a widget is injected into the tracker.
-   */
-  readonly widgetAdded: ISignal<this, T>;
-
   /**
    * Iterate through each widget in the tracker.
    *
@@ -129,15 +129,12 @@ class InstanceTracker<T extends Widget> implements IInstanceTracker<T>, IDisposa
     this._tracker.currentChanged.connect(this._onCurrentChanged, this);
   }
 
-  /**
-   * A namespace for all tracked widgets, (e.g., `notebook`).
-   */
-  readonly namespace: string;
-
   /**
    * A signal emitted when the current widget changes.
    */
-  readonly currentChanged: ISignal<this, T>;
+  get currentChanged(): ISignal<this, T> {
+    return this._currentChanged;
+  }
 
   /**
    * A signal emitted when a widget is added.
@@ -146,7 +143,14 @@ class InstanceTracker<T extends Widget> implements IInstanceTracker<T>, IDisposa
    * This signal will only fire when a widget is added to the tracker. It will
    * not fire if a widget is injected into the tracker.
    */
-  readonly widgetAdded: ISignal<this, T>;
+  get widgetAdded(): ISignal<this, T> {
+    return this._widgetAdded;
+  }
+
+  /**
+   * A namespace for all tracked widgets, (e.g., `notebook`).
+   */
+  readonly namespace: string;
 
   /**
    * The current widget is the most recently focused widget.
@@ -202,7 +206,7 @@ class InstanceTracker<T extends Widget> implements IInstanceTracker<T>, IDisposa
     }
 
     // Emit the widget added signal.
-    this.widgetAdded.emit(widget);
+    this._widgetAdded.emit(widget);
 
     return promise;
   }
@@ -354,9 +358,9 @@ class InstanceTracker<T extends Widget> implements IInstanceTracker<T>, IDisposa
   /**
    * Handle the current change signal from the internal focus tracker.
    */
-  private _onCurrentChanged(sender: any, args: FocusTracker.ICurrentChangedArgs<T>): void {
+  private _onCurrentChanged(sender: any, args: FocusTracker.IChangedArgs<T>): void {
     this.onCurrentChanged();
-    this.currentChanged.emit(args.newValue);
+    this._currentChanged.emit(args.newValue);
   }
 
   /**
@@ -378,13 +382,11 @@ class InstanceTracker<T extends Widget> implements IInstanceTracker<T>, IDisposa
 
   private _restore: InstanceTracker.IRestoreOptions<T> = null;
   private _tracker = new FocusTracker<T>();
+  private _currentChanged = new Signal<this, T>(this);
+  private _widgetAdded = new Signal<this, T>(this);
 }
 
 
-// Define the signals for the `InstanceTracker` class.
-defineSignal(InstanceTracker.prototype, 'currentChanged');
-defineSignal(InstanceTracker.prototype, 'widgetAdded');
-
 
 /**
  * A namespace for `InstanceTracker` statics.
@@ -435,12 +437,15 @@ namespace Private {
   export
   const injectedProperty = new AttachedProperty<Widget, boolean>({
     name: 'injected',
-    value: false
+    create: () => false
   });
 
   /**
    * An attached property for a widget's ID in the state database.
    */
   export
-  const nameProperty = new AttachedProperty<Widget, string>({ name: 'name' });
+  const nameProperty = new AttachedProperty<Widget, string>({
+    name: 'name',
+    create: () => ''
+  });
 }

+ 3 - 3
src/common/observablejson.ts

@@ -2,7 +2,7 @@
 // Distributed under the terms of the Modified BSD License.
 
 import {
-  JSONExt.deepEqual, JSONExt.isPrimitive, JSONObject, JSONValue
+  JSONExt, JSONObject, JSONValue
 } from '@phosphor/coreutils';
 
 import {
@@ -14,7 +14,7 @@ import {
 } from '@phosphor/widgets';
 
 import {
-  h, realize
+  h, VirtualDOM
 } from '@phosphor/virtualdom';
 
 import {
@@ -440,7 +440,7 @@ namespace Private {
   function createEditorNode(): HTMLElement {
     let cancelTitle = 'Revert changes to data';
     let confirmTitle = 'Commit changes to data';
-    return realize(
+    return VirtualDOM.realize(
       h.div({ className: METADATA_CLASS },
         h.div({ className: BUTTON_AREA_CLASS },
           h.span({ className: REVERT_CLASS, title: cancelTitle }),

+ 8 - 9
src/common/observablemap.ts

@@ -6,7 +6,7 @@ import {
 } from '@phosphor/disposable';
 
 import {
-  Signal.clearData, defineSignal, ISignal
+  ISignal, Signal
 } from '@phosphor/signaling';
 
 
@@ -18,7 +18,7 @@ interface IObservableMap<T> extends IDisposable {
   /**
    * A signal emitted when the map has changed.
    */
-  changed: ISignal<IObservableMap<T>, ObservableMap.IChangedArgs<T>>;
+  readonly changed: ISignal<this, ObservableMap.IChangedArgs<T>>;
 
   /**
    * The number of key-value pairs in the map.
@@ -111,7 +111,9 @@ class ObservableMap<T> implements IObservableMap<T> {
   /**
    * A signal emitted when the map has changed.
    */
-  changed: ISignal<IObservableMap<T>, ObservableMap.IChangedArgs<T>>;
+  get changed(): ISignal<this, ObservableMap.IChangedArgs<T>> {
+    return this._changed;
+  }
 
   /**
    * Whether this map has been disposed.
@@ -148,7 +150,7 @@ class ObservableMap<T> implements IObservableMap<T> {
       return;
     }
     this._map.set(key, value);
-    this.changed.emit({
+    this._changed.emit({
       type: oldVal ? 'change' : 'add',
       key: key,
       oldValue: oldVal,
@@ -217,7 +219,7 @@ class ObservableMap<T> implements IObservableMap<T> {
   delete(key: string): T {
     let oldVal = this._map.get(key);
     this._map.delete(key);
-    this.changed.emit({
+    this._changed.emit({
       type: 'remove',
       key: key,
       oldValue: oldVal,
@@ -251,6 +253,7 @@ class ObservableMap<T> implements IObservableMap<T> {
 
   private _map: Map<string, T> = new Map<string, T>();
   private _itemCmp: (first: T, second: T) => boolean;
+  private _changed = new Signal<this, ObservableMap.IChangedArgs<T>>(this);
 }
 
 
@@ -325,10 +328,6 @@ namespace ObservableMap {
 }
 
 
-// Define the signals for the `ObservableMap` class.
-defineSignal(ObservableMap.prototype, 'changed');
-
-
 /**
  * The namespace for module private data.
  */

+ 10 - 9
src/common/observablestring.ts

@@ -6,7 +6,7 @@ import {
 } from '@phosphor/disposable';
 
 import {
-  Signal.clearData, defineSignal, ISignal
+  ISignal, Signal
 } from '@phosphor/signaling';
 
 
@@ -18,7 +18,7 @@ interface IObservableString extends IDisposable {
   /**
    * A signal emitted when the string has changed.
    */
-  changed: ISignal<IObservableString, ObservableString.IChangedArgs>;
+  readonly changed: ISignal<this, ObservableString.IChangedArgs>;
 
   /**
    * The value of the string.
@@ -70,7 +70,9 @@ class ObservableString implements IObservableString {
   /**
    * A signal emitted when the string has changed.
    */
-  readonly changed: ISignal<IObservableString, ObservableString.IChangedArgs>;
+  get changed(): ISignal<this, ObservableString.IChangedArgs> {
+    return this._changed;
+  }
 
   /**
    * Set the value of the string.
@@ -80,7 +82,7 @@ class ObservableString implements IObservableString {
       return;
     }
     this._text = value;
-    this.changed.emit({
+    this._changed.emit({
       type: 'set',
       start: 0,
       end: value.length,
@@ -106,7 +108,7 @@ class ObservableString implements IObservableString {
     this._text = this._text.slice(0, index) +
                  text +
                  this._text.slice(index);
-    this.changed.emit({
+    this._changed.emit({
       type: 'insert',
       start: index,
       end: index + text.length,
@@ -125,7 +127,7 @@ class ObservableString implements IObservableString {
     let oldValue: string = this._text.slice(start, end);
     this._text = this._text.slice(0, start) +
                  this._text.slice(end);
-    this.changed.emit({
+    this._changed.emit({
       type: 'remove',
       start: start,
       end: end,
@@ -161,8 +163,10 @@ class ObservableString implements IObservableString {
 
   private _text = '';
   private _isDisposed : boolean = false;
+  private _changed = new Signal<this, ObservableString.IChangedArgs>(this);
 }
 
+
 /**
  * The namespace for `ObservableVector` class statics.
  */
@@ -224,6 +228,3 @@ namespace ObservableString {
     value: string;
   }
 }
-
-// Define the signals for the `ObservableString` class.
-defineSignal(ObservableString.prototype, 'changed');

+ 17 - 17
src/common/observablevector.ts

@@ -17,6 +17,7 @@ import {
   Vector
 } from './vector';
 
+
 /**
  * A vector which can be observed for changes.
  */
@@ -25,7 +26,7 @@ interface IObservableVector<T> extends IDisposable {
   /**
    * A signal emitted when the vector has changed.
    */
-  changed: ISignal<IObservableVector<T>, ObservableVector.IChangedArgs<T>>;
+  readonly changed: ISignal<this, ObservableVector.IChangedArgs<T>>;
 
   /**
    * Test whether the vector is empty.
@@ -279,7 +280,9 @@ class ObservableVector<T> extends Vector<T> implements IObservableVector<T> {
   /**
    * A signal emitted when the vector has changed.
    */
-  changed: ISignal<ObservableVector<T>, ObservableVector.IChangedArgs<T>>;
+  get changed(): ISignal<this, ObservableVector.IChangedArgs<T>> {
+    return this._changed;
+  }
 
   /**
    * Test whether the vector has been disposed.
@@ -324,7 +327,7 @@ class ObservableVector<T> extends Vector<T> implements IObservableVector<T> {
       return;
     }
     super.set(index, value);
-    this.changed.emit({
+    this._changed.emit({
       type: 'set',
       oldIndex: index,
       newIndex: index,
@@ -348,7 +351,7 @@ class ObservableVector<T> extends Vector<T> implements IObservableVector<T> {
    */
   pushBack(value: T): number {
     let num = super.pushBack(value);
-    this.changed.emit({
+    this._changed.emit({
       type: 'add',
       oldIndex: -1,
       newIndex: this.length - 1,
@@ -372,7 +375,7 @@ class ObservableVector<T> extends Vector<T> implements IObservableVector<T> {
    */
   popBack(): T {
     let value = super.popBack();
-    this.changed.emit({
+    this._changed.emit({
       type: 'remove',
       oldIndex: this.length,
       newIndex: -1,
@@ -405,7 +408,7 @@ class ObservableVector<T> extends Vector<T> implements IObservableVector<T> {
    */
   insert(index: number, value: T): number {
     let num = super.insert(index, value);
-    this.changed.emit({
+    this._changed.emit({
       type: 'add',
       oldIndex: -1,
       newIndex: index,
@@ -431,7 +434,7 @@ class ObservableVector<T> extends Vector<T> implements IObservableVector<T> {
    */
   remove(value: T): number {
     let itemCmp = this._itemCmp;
-    let index = ArrayExt.findFirstIndex(this, item => itemCmp(item, value));
+    let index = ArrayExt.findFirstIndex(toArray(this), item => itemCmp(item, value));
     this.removeAt(index);
     return index;
   }
@@ -455,7 +458,7 @@ class ObservableVector<T> extends Vector<T> implements IObservableVector<T> {
    */
   removeAt(index: number): T {
     let value = super.removeAt(index);
-    this.changed.emit({
+    this._changed.emit({
       type: 'remove',
       oldIndex: index,
       newIndex: -1,
@@ -477,7 +480,7 @@ class ObservableVector<T> extends Vector<T> implements IObservableVector<T> {
   clear(): void {
     let oldValues = toArray(this);
     super.clear();
-    this.changed.emit({
+    this._changed.emit({
       type: 'remove',
       oldIndex: 0,
       newIndex: 0,
@@ -512,7 +515,7 @@ class ObservableVector<T> extends Vector<T> implements IObservableVector<T> {
       super.insert(toIndex, value);
     }
     let arr = [value];
-    this.changed.emit({
+    this._changed.emit({
       type: 'move',
       oldIndex: fromIndex,
       newIndex: toIndex,
@@ -538,7 +541,7 @@ class ObservableVector<T> extends Vector<T> implements IObservableVector<T> {
     let newIndex = this.length;
     let newValues = toArray(values);
     each(newValues, value => { super.pushBack(value); });
-    this.changed.emit({
+    this._changed.emit({
       type: 'add',
       oldIndex: -1,
       newIndex,
@@ -573,7 +576,7 @@ class ObservableVector<T> extends Vector<T> implements IObservableVector<T> {
     let newIndex = index;
     let newValues = toArray(values);
     each(newValues, value => { super.insert(index++, value); });
-    this.changed.emit({
+    this._changed.emit({
       type: 'add',
       oldIndex: -1,
       newIndex,
@@ -606,7 +609,7 @@ class ObservableVector<T> extends Vector<T> implements IObservableVector<T> {
     for (let i = startIndex; i < endIndex; i++) {
       oldValues.push(super.removeAt(startIndex));
     }
-    this.changed.emit({
+    this._changed.emit({
       type: 'remove',
       oldIndex: startIndex,
       newIndex: -1,
@@ -618,6 +621,7 @@ class ObservableVector<T> extends Vector<T> implements IObservableVector<T> {
 
   private _isDisposed = false;
   private _itemCmp: (first: T, second: T) => boolean;
+  private _changed = new Signal<this, ObservableVector.IChangedArgs<T>>(this);
 }
 
 
@@ -708,10 +712,6 @@ namespace ObservableVector {
 }
 
 
-// Define the signals for the `ObservableVector` class.
-defineSignal(ObservableVector.prototype, 'changed');
-
-
 /**
  * The namespace for module private data.
  */

+ 21 - 16
src/common/vdom.ts

@@ -10,7 +10,7 @@ import {
 } from '@phosphor/messaging';
 
 import {
-  Signal.clearData, defineSignal, ISignal
+  ISignal, Signal
 } from '@phosphor/signaling';
 
 import {
@@ -18,7 +18,7 @@ import {
 } from '@phosphor/widgets';
 
 import {
-  render, VNode
+  VirtualDOM, VirtualNode
 } from '@phosphor/virtualdom';
 
 
@@ -42,7 +42,9 @@ class VDomModel implements IVDomModel {
   /**
    * A signal emitted when any model state changes.
    */
-  readonly stateChanged: ISignal<this, void>;
+  get stateChanged(): ISignal<this, void> {
+    return this._stateChanged;
+  }
 
   /**
    * Test whether the model is disposed.
@@ -62,14 +64,18 @@ class VDomModel implements IVDomModel {
     Signal.clearData(this);
   }
 
+  /**
+   * Trigger a change signal.
+   */
+  protected triggerChange(): void {
+    this._stateChanged.emit(void 0);
+  }
+
   private _isDisposed = false;
+  private _stateChanged = new Signal<this, void>(this);
 }
 
 
-// Define the signals for the VDomModel class.
-defineSignal(VDomModel.prototype, 'stateChanged');
-
-
 /**
  * Phosphor widget that encodes best practices for VDOM based rendering.
  */
@@ -78,7 +84,9 @@ abstract class VDomWidget<T extends IVDomModel> extends Widget {
   /**
    * A signal emited when the model changes.
    */
-  modelChanged: ISignal<this, void>;
+  get modelChanged(): ISignal<this, void> {
+    return this._modelChanged;
+  }
 
   /**
    * Set the model and fire changed signals.
@@ -95,7 +103,7 @@ abstract class VDomWidget<T extends IVDomModel> extends Widget {
     this._model = newValue;
     this._model.stateChanged.connect(this.update, this);
     this.update();
-    this.modelChanged.emit(void 0);
+    this._modelChanged.emit(void 0);
   }
 
   /**
@@ -121,7 +129,7 @@ abstract class VDomWidget<T extends IVDomModel> extends Widget {
    */
   protected onUpdateRequest(msg: Message): void {
     let vnode = this.render();
-    render(vnode, this.node);
+    VirtualDOM.render(vnode, this.node);
   }
 
   /**
@@ -131,14 +139,11 @@ abstract class VDomWidget<T extends IVDomModel> extends Widget {
    * which includes layout triggered rendering and all model changes.
    *
    * Subclasses should define this method and use the current model state
-   * in this.model and return a phosphor VNode or VNode[] using the phosphor
+   * in this.model and return a phosphor VirtualNode or VirtualNode[] using the phosphor
    * VDOM API.
    */
-  protected abstract render(): VNode | VNode[];
+  protected abstract render(): VirtualNode | VirtualNode[];
 
   private _model: T;
+  private _modelChanged = new Signal<this, void>(this);
 }
-
-
-// Define the signal for the VDomWidget class.
-defineSignal(VDomWidget.prototype, 'modelChanged');

+ 1 - 1
src/common/vector.ts

@@ -115,7 +115,7 @@ class Vector<T> {
    * No changes.
    */
   iter(): IIterator<T> {
-    return new ArrayIterator<T>(this._array, 0);
+    return new ArrayIterator<T>(this._array);
   }
 
   /**

+ 2 - 2
src/csvwidget/table.ts

@@ -8,7 +8,7 @@ import {
 } from '@phosphor/signaling';
 
 import {
-  h, VNode
+  h, VirtualNode
 } from '@phosphor/virtualdom';
 
 import {
@@ -166,7 +166,7 @@ class CSVTable extends VDomWidget<CSVModel> {
   /**
    * Render the content as virtual DOM nodes.
    */
-  protected render(): VNode | VNode[] {
+  protected render(): VirtualNode | VirtualNode[] {
     if (!this.model) {
       return h.table([h.thead(), h.tbody()]);
     }

+ 3 - 3
src/faq/widget.ts

@@ -6,7 +6,7 @@ import {
 } from '@phosphor/messaging';
 
 import {
-  h, VNode
+  h, VirtualNode
 } from '@phosphor/virtualdom';
 
 import {
@@ -173,7 +173,7 @@ class FaqWidget extends VDomWidget<FaqModel> {
   /**
    * Render the faq plugin to virtual DOM nodes.
    */
-  protected render(): VNode[] {
+  protected render(): VirtualNode[] {
     let subheadings = this.model.subheadings;
     let basicsQuestions = this.model.basicsQuestions;
     let featuresQuestions = this.model.featuresQuestions;
@@ -265,7 +265,7 @@ class FaqWidget extends VDomWidget<FaqModel> {
         h.li({ className: QUESTION_CLASS, id: 'basicsQ4' }, basicsQuestions[3]),
         h.li({ className: ANSWER_CLASS },
           'Check out the JupyterLab tour ',
-          h.a(this._linker.populateVNodeAttrs({
+          h.a(this._linker.populateVirtualNodeAttrs({
             className: ANCHOR_CLASS
           }, AboutCommandIDs.open, null), 'here')
         )

+ 5 - 2
src/instancerestorer/instancerestorer.ts

@@ -17,7 +17,7 @@ import {
 
 import {
   CommandRegistry
-} from '@phosphor/widgets';
+} from '@phosphor/commands';
 
 import {
   Widget
@@ -520,5 +520,8 @@ namespace Private {
    * An attached property for a widget's ID in the state database.
    */
   export
-  const nameProperty = new AttachedProperty<Widget, string>({ name: 'name' });
+  const nameProperty = new AttachedProperty<Widget, string>({
+    name: 'name',
+    create: owner => ''
+  });
 }

+ 3 - 3
src/landing/widget.ts

@@ -6,7 +6,7 @@ import {
 } from '@phosphor/messaging';
 
 import {
-  h, VNode
+  h, VirtualNode
 } from '@phosphor/virtualdom';
 
 import {
@@ -214,8 +214,8 @@ class LandingWidget extends VDomWidget<LandingModel> {
   /**
    * Render the landing plugin to virtual DOM nodes.
    */
-  protected render(): VNode {
-    let activitiesList: VNode[] = [];
+  protected render(): VirtualNode {
+    let activitiesList: VirtualNode[] = [];
     let activites = this.model.activities;
     for (let activityName of activites) {
       let imgName = activityName[0].replace(' ', '');

+ 3 - 3
src/launcher/index.ts

@@ -22,7 +22,7 @@ import {
 } from '@phosphor/application';
 
 import {
-  h, VNode
+  h, VirtualNode
 } from '@phosphor/virtualdom';
 
 import {
@@ -238,12 +238,12 @@ class LauncherWidget extends VDomWidget<LauncherModel> {
   /**
    * Render the launcher to virtual DOM nodes.
    */
-  protected render(): VNode | VNode[] {
+  protected render(): VirtualNode | VirtualNode[] {
     // Create an iterator that yields rendered item nodes.
     let children = map(this.model.items(), item => {
       let img = h.span({className: item.imgClassName + ' ' + IMAGE_CLASS});
       let text = h.span({className: TEXT_CLASS }, item.name);
-      let attrs = this._linker.populateVNodeAttrs({
+      let attrs = this._linker.populateVirtualNodeAttrs({
         className: ITEM_CLASS
       }, item.command, item.args);
       return h.div(attrs, [img, text]);

+ 2 - 2
src/notebook/celltools.ts

@@ -38,7 +38,7 @@ import {
 } from '@phosphor/widgets';
 
 import {
-  h, realize, VNode
+  h, realize, VirtualNode
 } from '@phosphor/virtualdom';
 
 import {
@@ -779,7 +779,7 @@ namespace Private {
     let title = (
       options.title || name[0].toLocaleUpperCase() + name.slice(1)
     );
-    let optionNodes: VNode[] = [];
+    let optionNodes: VirtualNode[] = [];
     for (let label in options.optionsMap) {
       let value = JSON.stringify(options.optionsMap[label]);
       optionNodes.push(h.option({ label, value }));

+ 2 - 2
src/statedb/statedb.ts

@@ -47,7 +47,7 @@ class StateDB implements IStateDB {
     let i = window.localStorage.length;
     while (i) {
       let key = window.localStorage.key(--i);
-      if (key.ArrayExt.firstIndexOf(prefix) === 0) {
+      if (key.indexOf(prefix) === 0) {
         window.localStorage.removeItem(key);
       }
     }
@@ -103,7 +103,7 @@ class StateDB implements IStateDB {
     let i = window.localStorage.length;
     while (i) {
       let key = window.localStorage.key(--i);
-      if (key.ArrayExt.firstIndexOf(prefix) === 0) {
+      if (key.indexOf(prefix) === 0) {
         try {
           items.push({
             id: key.replace(regex, ''),

+ 1 - 0
src/tsconfig.json

@@ -11,5 +11,6 @@
     "outDir": "../lib",
     "sourceMap": true
   },
+  "include": ["common/*"],
   "exclude": ["typedoc.d.ts"]
 }

+ 4 - 4
test/src/commandlinker/commandlinker.spec.ts

@@ -8,7 +8,7 @@ import {
 } from '@phosphor/widgets';
 
 import {
-  h, IElementAttrs, VNode, realize
+  h, IElementAttrs, VirtualNode, realize
 } from '@phosphor/virtualdom';
 
 import {
@@ -118,7 +118,7 @@ describe('commandlinker/commandlinker', () => {
 
     });
 
-    describe('#populateVNodeAttributes()', () => {
+    describe('#populateVirtualNodeAttributes()', () => {
 
       it('should connect a node to a command', () => {
         let called = false;
@@ -126,13 +126,13 @@ describe('commandlinker/commandlinker', () => {
         let commands =new CommandRegistry();
         let linker = new CommandLinker({ commands });
         let node: HTMLElement;
-        let vnode: VNode;
+        let vnode: VirtualNode;
         let disposable = commands.addCommand(command, {
           execute: () => { called = true; }
         });
         let attrs: IElementAttrs = {};
 
-        vnode = h.div(linker.populateVNodeAttrs(attrs, command, null));
+        vnode = h.div(linker.populateVirtualNodeAttrs(attrs, command, null));
         node = realize(vnode);
         document.body.appendChild(node);
 

+ 2 - 2
test/src/common/vdom.spec.ts

@@ -4,7 +4,7 @@
 import expect = require('expect.js');
 
 import {
-  h, VNode
+  h, VirtualNode
 } from '@phosphor/virtualdom';
 
 import {
@@ -26,7 +26,7 @@ class TestModel extends VDomModel {
 }
 
 class TestWidget extends VDomWidget<TestModel> {
-  protected render(): VNode | VNode[] {
+  protected render(): VirtualNode | VirtualNode[] {
     return h.span(this.model.value);
   }
 }

+ 3 - 3
test/src/csvwidget/table.spec.ts

@@ -4,7 +4,7 @@
 import expect = require('expect.js');
 
 import {
-  realize, VNode
+  realize, VirtualNode
 } from '@phosphor/virtualdom';
 
 import {
@@ -17,7 +17,7 @@ import {
 
 
 class TestTable extends CSVTable {
-  render(): VNode | VNode[] {
+  render(): VirtualNode | VirtualNode[] {
     return super.render();
   }
 }
@@ -152,7 +152,7 @@ describe('csvwidget/table', () => {
         let table = new TestTable();
         table.model = model;
 
-        let rendered = realize(table.render() as VNode);
+        let rendered = realize(table.render() as VirtualNode);
         let rows = rendered.getElementsByTagName('tr');
         let cols = rendered.getElementsByTagName('th');
         expect(rows).to.have.length(DISPLAY_LIMIT);