Browse Source

Document placeholders.

Brian E. Granger 8 years ago
parent
commit
dd22da82ff
2 changed files with 52 additions and 4 deletions
  1. 4 1
      packages/cells/src/collapser.tsx
  2. 48 3
      packages/cells/src/placeholder.tsx

+ 4 - 1
packages/cells/src/collapser.tsx

@@ -60,7 +60,10 @@ const MOD_COLLAPSED_CLASS = 'jp-mod-collapsed';
 /**
  * Abstract collapser base class.
  * 
- * 
+ * ### Notes
+ * A collapser is a visible div to the left of a cell's
+ * input/output that a user can click on to collapse the
+ * input/output.
  */
 export
 abstract class Collapser extends VDomRenderer<null> {

+ 48 - 3
packages/cells/src/placeholder.tsx

@@ -12,22 +12,50 @@ import {
   VDomRenderer
 } from '@jupyterlab/apputils';
 
-const PLACEHOLDER_CLASS = 'jp-Placeholder'
 
+/**
+ * The CSS class added to placehodlers.
+ */
+const PLACEHOLDER_CLASS = 'jp-Placeholder';
+
+/**
+ * The CSS classes added to input placeholder prompts.
+ */
 const INPUT_PROMPT_CLASS = 'jp-Placeholder-prompt jp-InputPrompt';
 
+/**
+ * The CSS classes added to output placeholder prompts.
+ */
 const OUTPUT_PROMPT_CLASS = 'jp-Placeholder-prompt jp-OutputPrompt';
 
+/**
+ * The CSS class added to placeholder content.
+ */
 const CONTENT_CLASS = 'jp-Placeholder-content';
 
+/**
+ * The CSS class added to input placeholders.
+ */
 const INPUT_PLACEHOLDER_CLASS = 'jp-InputPlaceholder';
 
+/**
+ * The CSS class added to output placeholders.
+ */
 const OUTPUT_PLACEHOLDER_CLASS = 'jp-OutputPlaceholder';
 
 
-
+/**
+ * An abstract base class for placeholders
+ * 
+ * ### Notes
+ * A placeholder is the element that is shown when input/output
+ * is hidden.
+ */
 export
 abstract class Placeholder extends VDomRenderer<null> {
+  /**
+   * Construct a new placeholder.
+   */
   constructor() {
     super();
     this.addClass(PLACEHOLDER_CLASS);
@@ -36,13 +64,22 @@ abstract class Placeholder extends VDomRenderer<null> {
 }
 
 
+/**
+ * The input placeholder class.
+ */
 export
 class InputPlaceholder extends Placeholder {
+  /**
+   * Construct a new input placeholder.
+   */
   constructor() {
     super();
     this.addClass(INPUT_PLACEHOLDER_CLASS);
   }
 
+  /**
+   * Render the input placeholder using the virtual DOM.
+   */
   protected render(): VirtualNode | ReadonlyArray<VirtualNode> {
     return [
         <div className={INPUT_PROMPT_CLASS}>
@@ -56,14 +93,22 @@ class InputPlaceholder extends Placeholder {
 }
 
 
+/**
+ * The output placeholder class.
+ */
 export
 class OutputPlaceholder extends Placeholder {
-
+  /**
+   * Construct a new output placeholder.
+   */
   constructor() {
     super();
     this.addClass(OUTPUT_PLACEHOLDER_CLASS);
   }
 
+  /**
+   * Render the output placeholder using the virtual DOM.
+   */
   protected render(): VirtualNode | ReadonlyArray<VirtualNode> {
     return [
         <div className={OUTPUT_PROMPT_CLASS}>