Browse Source

Remove exported constants

Steven Silvester 8 years ago
parent
commit
f197d227d9

+ 0 - 1
packages/csvviewer/src/table.ts

@@ -19,7 +19,6 @@ import {
 /**
  * The hard limit on the number of rows to display.
  */
-export
 const DISPLAY_LIMIT: number = 1000;
 
 /**

+ 0 - 2
packages/csvviewer/src/toolbar.ts

@@ -21,13 +21,11 @@ import {
 /**
  * The supported parsing delimiters.
  */
-export
 const DELIMITERS = [',', ';', '\t'];
 
 /**
  * The labels for each delimiter as they appear in the dropdown menu.
  */
-export
 const LABELS = [',', ';', '\\t'];
 
 /**

+ 21 - 11
packages/filebrowser/src/crumbs.ts

@@ -67,6 +67,16 @@ const BREADCRUMB_ITEM_CLASS = 'jp-BreadCrumbs-item';
  */
 const BREAD_CRUMB_PATHS = ['/', '../../', '../', ''];
 
+/**
+ * The mime type for a contents drag object.
+ */
+const CONTENTS_MIME = 'application/x-jupyter-icontents';
+
+/**
+ * The class name added to drop targets.
+ */
+const DROP_TARGET_CLASS = 'jp-mod-dropTarget';
+
 
 /**
  * A class which hosts folder breadcrumbs.
@@ -187,11 +197,11 @@ class BreadCrumbs extends Widget {
    * Handle the `'p-dragenter'` event for the widget.
    */
   private _evtDragEnter(event: IDragEvent): void {
-    if (event.mimeData.hasData(utils.CONTENTS_MIME)) {
+    if (event.mimeData.hasData(CONTENTS_MIME)) {
       let index = ArrayExt.findFirstIndex(this._crumbs, node => ElementExt.hitTest(node, event.clientX, event.clientY));
       if (index !== -1) {
         if (index !== Private.Crumb.Current) {
-          this._crumbs[index].classList.add(utils.DROP_TARGET_CLASS);
+          this._crumbs[index].classList.add(DROP_TARGET_CLASS);
           event.preventDefault();
           event.stopPropagation();
         }
@@ -205,9 +215,9 @@ class BreadCrumbs extends Widget {
   private _evtDragLeave(event: IDragEvent): void {
     event.preventDefault();
     event.stopPropagation();
-    let dropTarget = DOMUtils.findElement(this.node, utils.DROP_TARGET_CLASS);
+    let dropTarget = DOMUtils.findElement(this.node, DROP_TARGET_CLASS);
     if (dropTarget) {
-      dropTarget.classList.remove(utils.DROP_TARGET_CLASS);
+      dropTarget.classList.remove(DROP_TARGET_CLASS);
     }
   }
 
@@ -218,13 +228,13 @@ class BreadCrumbs extends Widget {
     event.preventDefault();
     event.stopPropagation();
     event.dropAction = event.proposedAction;
-    let dropTarget = DOMUtils.findElement(this.node, utils.DROP_TARGET_CLASS);
+    let dropTarget = DOMUtils.findElement(this.node, DROP_TARGET_CLASS);
     if (dropTarget) {
-      dropTarget.classList.remove(utils.DROP_TARGET_CLASS);
+      dropTarget.classList.remove(DROP_TARGET_CLASS);
     }
     let index = ArrayExt.findFirstIndex(this._crumbs, node => ElementExt.hitTest(node, event.clientX, event.clientY));
     if (index !== -1) {
-      this._crumbs[index].classList.add(utils.DROP_TARGET_CLASS);
+      this._crumbs[index].classList.add(DROP_TARGET_CLASS);
     }
   }
 
@@ -238,15 +248,15 @@ class BreadCrumbs extends Widget {
       event.dropAction = 'none';
       return;
     }
-    if (!event.mimeData.hasData(utils.CONTENTS_MIME)) {
+    if (!event.mimeData.hasData(CONTENTS_MIME)) {
       return;
     }
     event.dropAction = event.proposedAction;
 
     let target = event.target as HTMLElement;
     while (target && target.parentElement) {
-      if (target.classList.contains(utils.DROP_TARGET_CLASS)) {
-        target.classList.remove(utils.DROP_TARGET_CLASS);
+      if (target.classList.contains(DROP_TARGET_CLASS)) {
+        target.classList.remove(DROP_TARGET_CLASS);
         break;
       }
       target = target.parentElement;
@@ -263,7 +273,7 @@ class BreadCrumbs extends Widget {
 
     // Move all of the items.
     let promises: Promise<any>[] = [];
-    let names = event.mimeData.getData(utils.CONTENTS_MIME) as string[];
+    let names = event.mimeData.getData(CONTENTS_MIME) as string[];
     for (let name of names) {
       let newPath = path + name;
       promises.push(model.manager.rename(name, newPath).catch(error => {

+ 30 - 15
packages/filebrowser/src/listing.ts

@@ -49,7 +49,7 @@ import * as utils
   from './utils';
 
 import {
-  SELECTED_CLASS, showErrorMessage
+  showErrorMessage
 } from './utils';
 
 
@@ -123,6 +123,21 @@ const MODIFIED_ID_CLASS = 'jp-id-modified';
  */
 const FILE_TYPE_CLASS = 'jp-FileIcon';
 
+/**
+ * The mime type for a contents drag object.
+ */
+const CONTENTS_MIME = 'application/x-jupyter-icontents';
+
+/**
+ * The class name added to drop targets.
+ */
+const DROP_TARGET_CLASS = 'jp-mod-dropTarget';
+
+/**
+ * The class name added to selected rows.
+ */
+const SELECTED_CLASS = 'jp-mod-selected';
+
 /**
  * The class name added to a material icon content item.
  */
@@ -166,8 +181,8 @@ const DESCENDING_CLASS = 'jp-mod-descending';
 const RENAME_DURATION = 1000;
 
 /**
-  * The maximum duration between two key presses when selecting files by prefix.
-  */
+ * The maximum duration between two key presses when selecting files by prefix.
+ */
 const PREFIX_APPEND_DURATION = 1000;
 
 /**
@@ -941,7 +956,7 @@ class DirListing extends Widget {
    * Handle the `'p-dragenter'` event for the widget.
    */
   private _evtDragEnter(event: IDragEvent): void {
-    if (event.mimeData.hasData(utils.CONTENTS_MIME)) {
+    if (event.mimeData.hasData(CONTENTS_MIME)) {
       let index = Private.hitTestNodes(this._items, event.clientX, event.clientY);
       if (index === -1) {
         return;
@@ -951,7 +966,7 @@ class DirListing extends Widget {
         return;
       }
       let target = event.target as HTMLElement;
-      target.classList.add(utils.DROP_TARGET_CLASS);
+      target.classList.add(DROP_TARGET_CLASS);
       event.preventDefault();
       event.stopPropagation();
     }
@@ -963,9 +978,9 @@ class DirListing extends Widget {
   private _evtDragLeave(event: IDragEvent): void {
     event.preventDefault();
     event.stopPropagation();
-    let dropTarget = DOMUtils.findElement(this.node, utils.DROP_TARGET_CLASS);
+    let dropTarget = DOMUtils.findElement(this.node, DROP_TARGET_CLASS);
     if (dropTarget) {
-      dropTarget.classList.remove(utils.DROP_TARGET_CLASS);
+      dropTarget.classList.remove(DROP_TARGET_CLASS);
     }
   }
 
@@ -976,12 +991,12 @@ class DirListing extends Widget {
     event.preventDefault();
     event.stopPropagation();
     event.dropAction = event.proposedAction;
-    let dropTarget = DOMUtils.findElement(this.node, utils.DROP_TARGET_CLASS);
+    let dropTarget = DOMUtils.findElement(this.node, DROP_TARGET_CLASS);
     if (dropTarget) {
-      dropTarget.classList.remove(utils.DROP_TARGET_CLASS);
+      dropTarget.classList.remove(DROP_TARGET_CLASS);
     }
     let index = Private.hitTestNodes(this._items, event.clientX, event.clientY);
-    this._items[index].classList.add(utils.DROP_TARGET_CLASS);
+    this._items[index].classList.add(DROP_TARGET_CLASS);
   }
 
   /**
@@ -995,15 +1010,15 @@ class DirListing extends Widget {
       event.dropAction = 'none';
       return;
     }
-    if (!event.mimeData.hasData(utils.CONTENTS_MIME)) {
+    if (!event.mimeData.hasData(CONTENTS_MIME)) {
       return;
     }
     event.dropAction = event.proposedAction;
 
     let target = event.target as HTMLElement;
     while (target && target.parentElement) {
-      if (target.classList.contains(utils.DROP_TARGET_CLASS)) {
-        target.classList.remove(utils.DROP_TARGET_CLASS);
+      if (target.classList.contains(DROP_TARGET_CLASS)) {
+        target.classList.remove(DROP_TARGET_CLASS);
         break;
       }
       target = target.parentElement;
@@ -1017,7 +1032,7 @@ class DirListing extends Widget {
 
     // Move all of the items.
     const promises: Promise<Contents.IModel>[] = [];
-    const names = event.mimeData.getData(utils.CONTENTS_MIME) as string[];
+    const names = event.mimeData.getData(CONTENTS_MIME) as string[];
     for (let name of names) {
       let newPath = path + name;
       promises.push(renameFileDialog(manager, name, newPath, this._model.path));
@@ -1055,7 +1070,7 @@ class DirListing extends Widget {
       supportedActions: 'move',
       proposedAction: 'move'
     });
-    this._drag.mimeData.setData(utils.CONTENTS_MIME, selectedNames);
+    this._drag.mimeData.setData(CONTENTS_MIME, selectedNames);
     if (item && item.type !== 'directory') {
       this._drag.mimeData.setData(FACTORY_MIME, () => {
         let path = item.path;

+ 0 - 20
packages/filebrowser/src/utils.ts

@@ -5,26 +5,6 @@ import {
   Dialog, showDialog
 } from '@jupyterlab/apputils';
 
-
-/**
- * The class name added to drop targets.
- */
-export
-const DROP_TARGET_CLASS = 'jp-mod-dropTarget';
-
-/**
- * The class name added to selected rows.
- */
-export
-const SELECTED_CLASS = 'jp-mod-selected';
-
-/**
- * The mime type for a contents drag object.
- */
-export
-const CONTENTS_MIME = 'application/x-jupyter-icontents';
-
-
 /**
  * An error message dialog to show in the filebrowser widget.
  */

+ 7 - 1
packages/notebook/src/actions.ts

@@ -31,10 +31,16 @@ import {
 } from './model';
 
 import {
-  Notebook, JUPYTER_CELL_MIME
+  Notebook
 } from './widget';
 
 
+/**
+ * The mimetype used for Jupyter cell data.
+ */
+const JUPYTER_CELL_MIME = 'application/vnd.jupyter.cells';
+
+
 /**
  * A namespace for handling actions on a notebook.
  *

+ 1 - 2
packages/notebook/src/widget.ts

@@ -128,8 +128,7 @@ const FILLED_CIRCLE_CLASS = 'jp-filledCircle';
 /**
  * The mimetype used for Jupyter cell data.
  */
-export
-const JUPYTER_CELL_MIME: string = 'application/vnd.jupyter.cells';
+const JUPYTER_CELL_MIME = 'application/vnd.jupyter.cells';
 
 /**
  * The threshold in pixels to start a drag event.

+ 0 - 1
packages/rendermime/src/widgets.ts

@@ -32,7 +32,6 @@ import {
 /*
  * The class name added to common rendered HTML.
  */
-export
 const HTML_COMMON_CLASS = 'jp-RenderedHTMLCommon';
 
 /*