{"action":"created","comment":{"url":"https://api.github.com/repos/jupyter/jupyter-js-cells/pulls/comments/47360571","id":47360571,"diff_hunk":"@@ -0,0 +1,348 @@\n+// Copyright (c) Jupyter Development Team.\n+// Distributed under the terms of the Modified BSD License.\n+'use strict';\n+\n+\n+import {\n+  IInputAreaViewModel\n+} from 'jupyter-js-input-area';\n+import {\n+  IOutputAreaViewModel\n+} from 'jupyter-js-output-area';\n+\n+import {\n+  IObservableList\n+} from 'phosphor-observablelist';\n+\n+import {\n+  IChangedArgs, Property\n+} from 'phosphor-properties';\n+\n+import {\n+  ISignal, Signal\n+} from 'phosphor-signaling';\n+\n+import {\n+  Widget\n+} from 'phosphor-widget';\n+\n+import './index.css';\n+\n+\n+/**\n+ * An enum which describes the type of cell.\n+ */\n+export\n+enum CellType {\n+  /**\n+   * The cell contains code input.\n+   */\n+  Code,\n+\n+  /**\n+   * The cell contains markdown.\n+   */\n+  Markdown,\n+\n+  /**\n+   * The cell contains raw text.\n+   */\n+  Raw\n+}\n+\n+\n+/**\n+ * An object which is serializable.\n+ */\n+export\n+interface ISerializable {\n+  toJSON(): any;\n+  fromJSON(data: any): void;\n+}\n+\n+\n+/**\n+ * The definition of a model object for a base cell.\n+ */\n+export\n+interface IBaseCellViewModel {\n+\n+  /**\n+   * The type of cell.\n+   */\n+  type: CellType;\n+\n+  /**\n+   * Tags applied to the cell.\n+   */\n+  tags?: IObservableList<string>;\n+\n+  /**\n+   * A signal emitted when state of the cell changes.\n+   */\n+  stateChanged: ISignal<IBaseCellViewModel, IChangedArgs<any>>;\n+\n+  /**\n+   * Get namespaced metadata about the cell.\n+   */\n+  //getMetadata(namespace: string) : IObservableMap<string, ISerializable>;\n+\n+  /**\n+   * The input area of the cell.\n+   */\n+  input: IInputAreaViewModel;\n+\n+  /**\n+   * Whether a cell is deletable.\n+   */\n+  //deleteable: boolean;\n+\n+  /**\n+   * Whether a cell is mergable.\n+   */\n+  //mergeable: boolean;\n+\n+  /**\n+   * Whether a cell is splittable.\n+   */\n+  //splittable: boolean;\n+\n+  /**\n+   * Whether the cell is marked for applying commands\n+   */\n+  //marked: boolean;\n+\n+  /**\n+   * Run the cell.\n+   * \n+   * This basically means: do the right thing with the input.\n+   * Perhaps this should be in a subclass ExecutableCell.  Do we want to have a run() method on raw cells?\n+   */\n+  run(): void;\n+\n+\n+}\n+\n+\n+/**\n+ * The definition of a code cell.\n+ */\n+export\n+interface ICodeCellViewModel extends IBaseCellViewModel {\n+\n+  output: IOutputAreaViewModel;\n+}\n+\n+\n+/**\n+ * The definition of a raw cell.\n+ */\n+export\n+interface IRawCellViewModel extends IBaseCellViewModel {\n+\n+  /**\n+   * The raw cell format.\n+   */\n+  format?: string;\n+}\n+\n+\n+/**\n+ * The definition of a markdown cell.\n+ */\n+export\n+interface IMarkdownCellViewModel extends IBaseCellViewModel {\n+  /**\n+   * Whether a cell is rendered.\n+   */\n+  rendered: boolean;\n+}\n+\n+\n+\n+/**\n+ * A model consisting of any valid cell type.\n+ */\n+export\n+type ICellViewModel =  (\n+  IRawCellViewModel | IMarkdownCellViewModel | ICodeCellViewModel\n+);\n+\n+\n+/**\n+ * An implemention of the base cell viewmodel.\n+ */\n+export\n+class BaseCellViewModel implements IBaseCellViewModel {\n+\n+  /**\n+   * A signal emitted when the state of the model changes.\n+   *\n+   * **See also:** [[stateChanged]]\n+   */\n+  static stateChangedSignal = new Signal<IBaseCellViewModel, IChangedArgs<any>>();\n+\n+\n+  /**\n+   * A signal emitted when the state of the model changes.\n+   *\n+   * #### Notes\n+   * This is a pure delegate to the [[stateChangedSignal]].\n+   */\n+  get stateChanged(): ISignal<IBaseCellViewModel, IChangedArgs<any>> {\n+    return BaseCellViewModel.stateChangedSignal.bind(this);\n+  }\n+\n+  /**\n+   * A property descriptor for the input area view model.\n+   *\n+   * **See also:** [[input]]\n+   */\n+  static inputProperty = new Property<IBaseCellViewModel, IInputAreaViewModel>({\n+    name: 'input',\n+    notify: BaseCellViewModel.stateChangedSignal,\n+  });\n+\n+  /**\n+   * Get the input area view model.\n+   *\n+   * #### Notes\n+   * This is a pure delegate to the [[inputProperty]].\n+   */\n+  get input() {\n+    return BaseCellViewModel.inputProperty.get(this);\n+  }\n+  \n+  /**\n+   * Set the input area view model.\n+   *\n+   * #### Notes\n+   * This is a pure delegate to the [[inputProperty]].\n+   */\n+  set input(value: IInputAreaViewModel) {\n+    BaseCellViewModel.inputProperty.set(this, value);\n+  }\n+\n+  /**\n+   * Run the cell\n+   */\n+  run(): void {\n+  }\n+\n+  /**\n+   * The type of cell.\n+   */\n+  type: CellType;","path":"src/CellViewModel.ts","position":235,"original_position":235,"commit_id":"eac66ee81aae59267066278dd483c35bc1d99d88","original_commit_id":"eac66ee81aae59267066278dd483c35bc1d99d88","user":{"login":"blink1073","id":2096628,"avatar_url":"https://avatars.githubusercontent.com/u/2096628?v=3","gravatar_id":"","url":"https://api.github.com/users/blink1073","html_url":"https://github.com/blink1073","followers_url":"https://api.github.com/users/blink1073/followers","following_url":"https://api.github.com/users/blink1073/following{/other_user}","gists_url":"https://api.github.com/users/blink1073/gists{/gist_id}","starred_url":"https://api.github.com/users/blink1073/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blink1073/subscriptions","organizations_url":"https://api.github.com/users/blink1073/orgs","repos_url":"https://api.github.com/users/blink1073/repos","events_url":"https://api.github.com/users/blink1073/events{/privacy}","received_events_url":"https://api.github.com/users/blink1073/received_events","type":"User","site_admin":false},"body":"Why not a read-only getter?","created_at":"2015-12-11T14:36:57Z","updated_at":"2015-12-11T14:36:57Z","html_url":"https://github.com/jupyter/jupyter-js-cells/pull/3#discussion_r47360571","pull_request_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/jupyter/jupyter-js-cells/pulls/comments/47360571"},"html":{"href":"https://github.com/jupyter/jupyter-js-cells/pull/3#discussion_r47360571"},"pull_request":{"href":"https://api.github.com/repos/jupyter/jupyter-js-cells/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/jupyter/jupyter-js-cells/pulls/3","id":53347146,"html_url":"https://github.com/jupyter/jupyter-js-cells/pull/3","diff_url":"https://github.com/jupyter/jupyter-js-cells/pull/3.diff","patch_url":"https://github.com/jupyter/jupyter-js-cells/pull/3.patch","issue_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/issues/3","number":3,"state":"open","locked":false,"title":"An initial implementation of cells","user":{"login":"jasongrout","id":192614,"avatar_url":"https://avatars.githubusercontent.com/u/192614?v=3","gravatar_id":"","url":"https://api.github.com/users/jasongrout","html_url":"https://github.com/jasongrout","followers_url":"https://api.github.com/users/jasongrout/followers","following_url":"https://api.github.com/users/jasongrout/following{/other_user}","gists_url":"https://api.github.com/users/jasongrout/gists{/gist_id}","starred_url":"https://api.github.com/users/jasongrout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasongrout/subscriptions","organizations_url":"https://api.github.com/users/jasongrout/orgs","repos_url":"https://api.github.com/users/jasongrout/repos","events_url":"https://api.github.com/users/jasongrout/events{/privacy}","received_events_url":"https://api.github.com/users/jasongrout/received_events","type":"User","site_admin":false},"body":"This relies on https://github.com/jupyter/jupyter-js-output-area/pull/24","created_at":"2015-12-11T02:36:52Z","updated_at":"2015-12-11T14:36:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4ce6ae011e8fc38d23a268523441832744c104f5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/pulls/3/commits","review_comments_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/pulls/3/comments","review_comment_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/issues/3/comments","statuses_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/statuses/eac66ee81aae59267066278dd483c35bc1d99d88","head":{"label":"jupyter:cell","ref":"cell","sha":"eac66ee81aae59267066278dd483c35bc1d99d88","user":{"login":"jupyter","id":7388996,"avatar_url":"https://avatars.githubusercontent.com/u/7388996?v=3","gravatar_id":"","url":"https://api.github.com/users/jupyter","html_url":"https://github.com/jupyter","followers_url":"https://api.github.com/users/jupyter/followers","following_url":"https://api.github.com/users/jupyter/following{/other_user}","gists_url":"https://api.github.com/users/jupyter/gists{/gist_id}","starred_url":"https://api.github.com/users/jupyter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jupyter/subscriptions","organizations_url":"https://api.github.com/users/jupyter/orgs","repos_url":"https://api.github.com/users/jupyter/repos","events_url":"https://api.github.com/users/jupyter/events{/privacy}","received_events_url":"https://api.github.com/users/jupyter/received_events","type":"Organization","site_admin":false},"repo":{"id":39586588,"name":"jupyter-js-cells","full_name":"jupyter/jupyter-js-cells","owner":{"login":"jupyter","id":7388996,"avatar_url":"https://avatars.githubusercontent.com/u/7388996?v=3","gravatar_id":"","url":"https://api.github.com/users/jupyter","html_url":"https://github.com/jupyter","followers_url":"https://api.github.com/users/jupyter/followers","following_url":"https://api.github.com/users/jupyter/following{/other_user}","gists_url":"https://api.github.com/users/jupyter/gists{/gist_id}","starred_url":"https://api.github.com/users/jupyter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jupyter/subscriptions","organizations_url":"https://api.github.com/users/jupyter/orgs","repos_url":"https://api.github.com/users/jupyter/repos","events_url":"https://api.github.com/users/jupyter/events{/privacy}","received_events_url":"https://api.github.com/users/jupyter/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jupyter/jupyter-js-cells","description":"Javascript APIs for Jupyter cells","fork":false,"url":"https://api.github.com/repos/jupyter/jupyter-js-cells","forks_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/forks","keys_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/teams","hooks_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/hooks","issue_events_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/issues/events{/number}","events_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/events","assignees_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/assignees{/user}","branches_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/branches{/branch}","tags_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/tags","blobs_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/git/refs{/sha}","trees_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/statuses/{sha}","languages_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/languages","stargazers_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/stargazers","contributors_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/contributors","subscribers_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/subscribers","subscription_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/subscription","commits_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/commits{/sha}","git_commits_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/git/commits{/sha}","comments_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/comments{/number}","issue_comment_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/issues/comments{/number}","contents_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/contents/{+path}","compare_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/merges","archive_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/downloads","issues_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/issues{/number}","pulls_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/pulls{/number}","milestones_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/milestones{/number}","notifications_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/labels{/name}","releases_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/releases{/id}","created_at":"2015-07-23T19:07:09Z","updated_at":"2015-11-04T00:48:39Z","pushed_at":"2015-12-11T02:36:52Z","git_url":"git://github.com/jupyter/jupyter-js-cells.git","ssh_url":"git@github.com:jupyter/jupyter-js-cells.git","clone_url":"https://github.com/jupyter/jupyter-js-cells.git","svn_url":"https://github.com/jupyter/jupyter-js-cells","homepage":null,"size":34,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"jupyter:master","ref":"master","sha":"4625e3d2bc286db4eca831f074d1b68f3b3e119b","user":{"login":"jupyter","id":7388996,"avatar_url":"https://avatars.githubusercontent.com/u/7388996?v=3","gravatar_id":"","url":"https://api.github.com/users/jupyter","html_url":"https://github.com/jupyter","followers_url":"https://api.github.com/users/jupyter/followers","following_url":"https://api.github.com/users/jupyter/following{/other_user}","gists_url":"https://api.github.com/users/jupyter/gists{/gist_id}","starred_url":"https://api.github.com/users/jupyter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jupyter/subscriptions","organizations_url":"https://api.github.com/users/jupyter/orgs","repos_url":"https://api.github.com/users/jupyter/repos","events_url":"https://api.github.com/users/jupyter/events{/privacy}","received_events_url":"https://api.github.com/users/jupyter/received_events","type":"Organization","site_admin":false},"repo":{"id":39586588,"name":"jupyter-js-cells","full_name":"jupyter/jupyter-js-cells","owner":{"login":"jupyter","id":7388996,"avatar_url":"https://avatars.githubusercontent.com/u/7388996?v=3","gravatar_id":"","url":"https://api.github.com/users/jupyter","html_url":"https://github.com/jupyter","followers_url":"https://api.github.com/users/jupyter/followers","following_url":"https://api.github.com/users/jupyter/following{/other_user}","gists_url":"https://api.github.com/users/jupyter/gists{/gist_id}","starred_url":"https://api.github.com/users/jupyter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jupyter/subscriptions","organizations_url":"https://api.github.com/users/jupyter/orgs","repos_url":"https://api.github.com/users/jupyter/repos","events_url":"https://api.github.com/users/jupyter/events{/privacy}","received_events_url":"https://api.github.com/users/jupyter/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jupyter/jupyter-js-cells","description":"Javascript APIs for Jupyter cells","fork":false,"url":"https://api.github.com/repos/jupyter/jupyter-js-cells","forks_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/forks","keys_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/teams","hooks_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/hooks","issue_events_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/issues/events{/number}","events_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/events","assignees_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/assignees{/user}","branches_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/branches{/branch}","tags_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/tags","blobs_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/git/refs{/sha}","trees_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/statuses/{sha}","languages_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/languages","stargazers_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/stargazers","contributors_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/contributors","subscribers_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/subscribers","subscription_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/subscription","commits_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/commits{/sha}","git_commits_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/git/commits{/sha}","comments_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/comments{/number}","issue_comment_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/issues/comments{/number}","contents_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/contents/{+path}","compare_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/merges","archive_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/downloads","issues_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/issues{/number}","pulls_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/pulls{/number}","milestones_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/milestones{/number}","notifications_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/labels{/name}","releases_url":"https://api.github.com/repos/jupyter/jupyter-js-cells/releases{/id}","created_at":"2015-07-23T19:07:09Z","updated_at":"2015-11-04T00:48:39Z","pushed_at":"2015-12-11T02:36:52Z","git_url":"git://github.com/jupyter/jupyter-js-cells.git","ssh_url":"git@github.com:jupyter/jupyter-js-cells.git","clone_url":"https://github.com/jupyter/jupyter-js-cells.git","svn_url":"https://github.com/jupyter/jupyter-js-cells","homepage":null,"size":34,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jupyter/jupyter-js-cells/pulls/3"},"html":{"href":"https://github.com/jupyter/jupyter-js-cells/pull/3"},"issue":{"href":"https://api.github.com/repos/jupyter/jupyter-js-cells/issues/3"},"comments":{"href":"https://api.github.com/repos/jupyter/jupyter-js-cells/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/jupyter/jupyter-js-cells/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/jupyter/jupyter-js-cells/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jupyter/jupyter-js-cells/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/jupyter/jupyter-js-cells/statuses/eac66ee81aae59267066278dd483c35bc1d99d88"}}}}