jupyter-js-notebook
Advanced tools
Comparing version 0.7.2 to 0.8.0
@@ -7,18 +7,5 @@ import { IInputAreaModel } from '../input-area'; | ||
/** | ||
* An enum which describes the type of cell. | ||
* A type which describes the type of cell. | ||
*/ | ||
export declare enum CellType { | ||
/** | ||
* The cell contains code input. | ||
*/ | ||
Code = 0, | ||
/** | ||
* The cell contains markdown. | ||
*/ | ||
Markdown = 1, | ||
/** | ||
* The cell contains raw text. | ||
*/ | ||
Raw = 2, | ||
} | ||
export declare type CellType = "code" | "markdown" | "raw"; | ||
/** | ||
@@ -25,0 +12,0 @@ * An object which is serializable. |
@@ -12,20 +12,2 @@ // Copyright (c) Jupyter Development Team. | ||
/** | ||
* An enum which describes the type of cell. | ||
*/ | ||
(function (CellType) { | ||
/** | ||
* The cell contains code input. | ||
*/ | ||
CellType[CellType["Code"] = 0] = "Code"; | ||
/** | ||
* The cell contains markdown. | ||
*/ | ||
CellType[CellType["Markdown"] = 1] = "Markdown"; | ||
/** | ||
* The cell contains raw text. | ||
*/ | ||
CellType[CellType["Raw"] = 2] = "Raw"; | ||
})(exports.CellType || (exports.CellType = {})); | ||
var CellType = exports.CellType; | ||
/** | ||
* An implemention of the base cell Model. | ||
@@ -117,3 +99,3 @@ */ | ||
return BaseCellModel; | ||
})(); | ||
}()); | ||
exports.BaseCellModel = BaseCellModel; | ||
@@ -127,3 +109,3 @@ /** | ||
_super.apply(this, arguments); | ||
this.type = CellType.Code; | ||
this.type = "code"; | ||
} | ||
@@ -163,3 +145,3 @@ Object.defineProperty(CodeCellModel.prototype, "output", { | ||
return CodeCellModel; | ||
})(BaseCellModel); | ||
}(BaseCellModel)); | ||
exports.CodeCellModel = CodeCellModel; | ||
@@ -173,3 +155,3 @@ /** | ||
_super.apply(this, arguments); | ||
this.type = CellType.Markdown; | ||
this.type = "markdown"; | ||
} | ||
@@ -201,3 +183,3 @@ Object.defineProperty(MarkdownCellModel.prototype, "rendered", { | ||
return MarkdownCellModel; | ||
})(BaseCellModel); | ||
}(BaseCellModel)); | ||
exports.MarkdownCellModel = MarkdownCellModel; | ||
@@ -208,3 +190,3 @@ /** | ||
function isMarkdownCellModel(m) { | ||
return (m.type === CellType.Markdown); | ||
return (m.type === "markdown"); | ||
} | ||
@@ -216,3 +198,3 @@ exports.isMarkdownCellModel = isMarkdownCellModel; | ||
function isCodeCellModel(m) { | ||
return (m.type === CellType.Code); | ||
return (m.type === "code"); | ||
} | ||
@@ -224,3 +206,3 @@ exports.isCodeCellModel = isCodeCellModel; | ||
function isRawCellModel(m) { | ||
return (m.type === CellType.Raw); | ||
return (m.type === "raw"); | ||
} | ||
@@ -227,0 +209,0 @@ exports.isRawCellModel = isRawCellModel; |
@@ -27,3 +27,3 @@ // Copyright (c) Jupyter Development Team. | ||
return CellWidget; | ||
})(phosphor_widget_1.Widget); | ||
}(phosphor_widget_1.Widget)); | ||
exports.CellWidget = CellWidget; | ||
@@ -80,3 +80,3 @@ /** | ||
return CodeCellWidget; | ||
})(CellWidget); | ||
}(CellWidget)); | ||
exports.CodeCellWidget = CodeCellWidget; | ||
@@ -185,3 +185,3 @@ /** | ||
return MarkdownCellWidget; | ||
})(CellWidget); | ||
}(CellWidget)); | ||
exports.MarkdownCellWidget = MarkdownCellWidget; |
@@ -172,3 +172,3 @@ // Copyright (c) Jupyter Development Team. | ||
return EditorModel; | ||
})(); | ||
}()); | ||
exports.EditorModel = EditorModel; | ||
@@ -175,0 +175,0 @@ /** |
@@ -0,1 +1,3 @@ | ||
import 'codemirror/mode/meta'; | ||
import 'codemirror/lib/codemirror.css'; | ||
import { Message } from 'phosphor-messaging'; | ||
@@ -2,0 +4,0 @@ import { IChangedArgs } from 'phosphor-properties'; |
@@ -294,3 +294,3 @@ // Copyright (c) Jupyter Development Team. | ||
return CodeMirrorWidget; | ||
})(phosphor_widget_1.Widget); | ||
}(phosphor_widget_1.Widget)); | ||
exports.CodeMirrorWidget = CodeMirrorWidget; |
@@ -118,3 +118,3 @@ // Copyright (c) Jupyter Development Team. | ||
return InputAreaModel; | ||
})(); | ||
}()); | ||
exports.InputAreaModel = InputAreaModel; | ||
@@ -121,0 +121,0 @@ /** |
@@ -56,3 +56,3 @@ // Copyright (c) Jupyter Development Team. | ||
return InputAreaWidget; | ||
})(phosphor_widget_1.Widget); | ||
}(phosphor_widget_1.Widget)); | ||
exports.InputAreaWidget = InputAreaWidget; |
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
var phosphor_observablelist_1 = require('phosphor-observablelist'); | ||
@@ -265,3 +266,3 @@ var phosphor_properties_1 = require('phosphor-properties'); | ||
return NotebookModel; | ||
})(); | ||
}()); | ||
exports.NotebookModel = NotebookModel; | ||
@@ -268,0 +269,0 @@ /** |
@@ -1,2 +0,3 @@ | ||
import { MimeBundle } from '../output-area'; | ||
import { MimeBundle, OutputType } from '../output-area'; | ||
import { CellType } from '../cells'; | ||
export declare type multilineString = string; | ||
@@ -12,12 +13,12 @@ /** | ||
export interface BaseOutput { | ||
output_type: string; | ||
output_type: OutputType; | ||
} | ||
export interface ExecuteResult extends BaseOutput { | ||
output_type: string; | ||
execution_count: number; | ||
export interface DisplayData extends BaseOutput { | ||
output_type: "display_data"; | ||
data: MimeBundle; | ||
metadata: {}; | ||
} | ||
export interface DisplayData extends BaseOutput { | ||
output_type: string; | ||
export interface ExecuteResult extends BaseOutput { | ||
output_type: "execute_result"; | ||
execution_count: number; | ||
data: MimeBundle; | ||
@@ -27,3 +28,3 @@ metadata: {}; | ||
export interface Stream extends BaseOutput { | ||
output_type: string; | ||
output_type: "stream"; | ||
name: string; | ||
@@ -33,3 +34,3 @@ text: multilineString; | ||
export interface JupyterError extends BaseOutput { | ||
output_type: string; | ||
output_type: "error"; | ||
ename: string; | ||
@@ -46,3 +47,3 @@ evalue: string; | ||
export interface BaseCell { | ||
cell_type: string; | ||
cell_type: CellType; | ||
source: multilineString; | ||
@@ -55,3 +56,3 @@ metadata: { | ||
export interface RawCell extends BaseCell { | ||
cell_type: string; | ||
cell_type: "raw"; | ||
metadata: { | ||
@@ -62,6 +63,6 @@ format?: string; | ||
export interface MarkdownCell extends BaseCell { | ||
cell_type: string; | ||
cell_type: "markdown"; | ||
} | ||
export interface CodeCell extends BaseCell { | ||
cell_type: string; | ||
cell_type: "code"; | ||
metadata: { | ||
@@ -68,0 +69,0 @@ name?: string; |
// Notebook format interfaces | ||
// https://nbformat.readthedocs.org/en/latest/format_description.html | ||
// https://github.com/jupyter/nbformat/blob/master/nbformat/v4/nbformat.v4.schema.json | ||
"use strict"; | ||
/** | ||
@@ -5,0 +6,0 @@ * The major version of the notebook format. |
@@ -53,18 +53,9 @@ // Copyright (c) Jupyter Development Team. | ||
} | ||
else if (nbformat_1.isStream(out)) { | ||
if (nbformat_1.isStream(out)) { | ||
var outmodel = new output_area_1.StreamModel(); | ||
switch (out.name) { | ||
case 'stdout': | ||
outmodel.name = output_area_1.StreamName.StdOut; | ||
break; | ||
case 'stderr': | ||
outmodel.name = output_area_1.StreamName.StdErr; | ||
break; | ||
default: | ||
console.error('Unrecognized stream name: %s', out.name); | ||
} | ||
outmodel.name = out.name; | ||
outmodel.text = out.text; | ||
return outmodel; | ||
} | ||
else if (nbformat_1.isJupyterError(out)) { | ||
if (nbformat_1.isJupyterError(out)) { | ||
var outmodel = new output_area_1.ExecuteErrorModel(); | ||
@@ -76,3 +67,3 @@ outmodel.ename = out.ename; | ||
} | ||
else if (nbformat_1.isExecuteResult(out)) { | ||
if (nbformat_1.isExecuteResult(out)) { | ||
var outmodel = new output_area_1.ExecuteResultModel(); | ||
@@ -92,8 +83,2 @@ outmodel.data = out.data; | ||
var type = msg.header.msg_type; | ||
if (type === 'execute_result') { | ||
m.output_type = 'display_data'; | ||
} | ||
else { | ||
m.output_type = type; | ||
} | ||
return buildOutputModel(m); | ||
@@ -163,6 +148,5 @@ } | ||
else if (output instanceof output_area_1.StreamModel) { | ||
var name_1 = output.name === output_area_1.StreamName.StdOut ? 'stdout' : 'stderr'; | ||
outputs.push({ | ||
output_type: 'stream', | ||
name: name_1, | ||
name: output.name, | ||
text: output.text | ||
@@ -169,0 +153,0 @@ }); |
@@ -42,6 +42,6 @@ // Copyright (c) Jupyter Development Team. | ||
switch (c.type) { | ||
case cells_1.CellType.Code: | ||
case "code": | ||
w = new cells_1.CodeCellWidget(c); | ||
break; | ||
case cells_1.CellType.Markdown: | ||
case "markdown": | ||
w = new cells_1.MarkdownCellWidget(c); | ||
@@ -147,3 +147,3 @@ break; | ||
return NotebookWidget; | ||
})(phosphor_panel_1.Panel); | ||
}(phosphor_panel_1.Panel)); | ||
exports.NotebookWidget = NotebookWidget; | ||
@@ -150,0 +150,0 @@ /** |
@@ -11,31 +11,21 @@ import { IChangedArgs, Property } from 'phosphor-properties'; | ||
} | ||
export declare enum OutputType { | ||
/** | ||
* The "execute_result" message type from the message spec. | ||
*/ | ||
ExecuteResult = 0, | ||
/** | ||
* The "display_data" message type from the message spec. | ||
*/ | ||
DisplayData = 1, | ||
/** | ||
* The "stream" message type from the message spec. | ||
*/ | ||
Stream = 2, | ||
/** | ||
* The "error" message type from the message spec. | ||
*/ | ||
Error = 3, | ||
} | ||
/** | ||
* The base interface for an output model. | ||
*/ | ||
* The valid output type strings. | ||
*/ | ||
export declare type OutputType = "execute_result" | "display_data" | "stream" | "error"; | ||
/** | ||
* The valid stream type strings. | ||
*/ | ||
export declare type StreamType = "stdout" | "stderr"; | ||
/** | ||
* The base interface for an output model. | ||
*/ | ||
export declare class OutputBaseModel { | ||
/** | ||
* A signal emitted when state of the output changes. | ||
*/ | ||
* A signal emitted when state of the output changes. | ||
*/ | ||
stateChanged: ISignal<OutputBaseModel, IChangedArgs<any>>; | ||
/** | ||
* The output type. | ||
*/ | ||
* The output type. | ||
*/ | ||
outputType: OutputType; | ||
@@ -48,13 +38,13 @@ } | ||
/** | ||
* The raw data for the output. | ||
*/ | ||
* The output type. | ||
*/ | ||
outputType: OutputType; | ||
/** | ||
* The raw data for the output. | ||
*/ | ||
data: MimeBundle; | ||
/** | ||
* Metadata about the output. | ||
*/ | ||
* Metadata about the output. | ||
*/ | ||
metadata: any; | ||
/** | ||
* Output type | ||
*/ | ||
outputType: OutputType; | ||
} | ||
@@ -64,21 +54,19 @@ /** | ||
*/ | ||
export declare class ExecuteResultModel extends DisplayDataModel { | ||
export declare class ExecuteResultModel extends OutputBaseModel { | ||
/** | ||
* The current execution count. | ||
*/ | ||
executionCount: number; | ||
/** | ||
* Output type | ||
* The output type. | ||
*/ | ||
outputType: OutputType; | ||
} | ||
export declare enum StreamName { | ||
/** | ||
* The "stdout" stream name from the message spec. | ||
* The raw data for the output. | ||
*/ | ||
StdOut = 0, | ||
data: MimeBundle; | ||
/** | ||
* The "stderr" stream name from the message spec. | ||
* Metadata about the output. | ||
*/ | ||
StdErr = 1, | ||
metadata: any; | ||
/** | ||
* The current execution count. | ||
*/ | ||
executionCount: number; | ||
} | ||
@@ -90,5 +78,9 @@ /** | ||
/** | ||
* The output type. | ||
*/ | ||
outputType: OutputType; | ||
/** | ||
* The type of stream. | ||
*/ | ||
name: StreamName; | ||
name: StreamType; | ||
/** | ||
@@ -98,6 +90,2 @@ * The text from the stream. | ||
text: string; | ||
/** | ||
* Output type | ||
*/ | ||
outputType: OutputType; | ||
} | ||
@@ -109,2 +97,6 @@ /** | ||
/** | ||
* The output type. | ||
*/ | ||
outputType: OutputType; | ||
/** | ||
* The name of the error. | ||
@@ -124,6 +116,2 @@ */ | ||
traceback: string; | ||
/** | ||
* Output type | ||
*/ | ||
outputType: OutputType; | ||
} | ||
@@ -130,0 +118,0 @@ /** |
@@ -12,24 +12,5 @@ // Copyright (c) Jupyter Development Team. | ||
var phosphor_observablelist_1 = require('phosphor-observablelist'); | ||
(function (OutputType) { | ||
/** | ||
* The "execute_result" message type from the message spec. | ||
*/ | ||
OutputType[OutputType["ExecuteResult"] = 0] = "ExecuteResult"; | ||
/** | ||
* The "display_data" message type from the message spec. | ||
*/ | ||
OutputType[OutputType["DisplayData"] = 1] = "DisplayData"; | ||
/** | ||
* The "stream" message type from the message spec. | ||
*/ | ||
OutputType[OutputType["Stream"] = 2] = "Stream"; | ||
/** | ||
* The "error" message type from the message spec. | ||
*/ | ||
OutputType[OutputType["Error"] = 3] = "Error"; | ||
})(exports.OutputType || (exports.OutputType = {})); | ||
var OutputType = exports.OutputType; | ||
/** | ||
* The base interface for an output model. | ||
*/ | ||
* The base interface for an output model. | ||
*/ | ||
var OutputBaseModel = (function () { | ||
@@ -39,3 +20,3 @@ function OutputBaseModel() { | ||
return OutputBaseModel; | ||
})(); | ||
}()); | ||
exports.OutputBaseModel = OutputBaseModel; | ||
@@ -50,8 +31,8 @@ /** | ||
/** | ||
* Output type | ||
* The output type. | ||
*/ | ||
this.outputType = OutputType.DisplayData; | ||
this.outputType = "display_data"; | ||
} | ||
return DisplayDataModel; | ||
})(OutputBaseModel); | ||
}(OutputBaseModel)); | ||
exports.DisplayDataModel = DisplayDataModel; | ||
@@ -66,20 +47,9 @@ /** | ||
/** | ||
* Output type | ||
* The output type. | ||
*/ | ||
this.outputType = OutputType.ExecuteResult; | ||
this.outputType = "execute_result"; | ||
} | ||
return ExecuteResultModel; | ||
})(DisplayDataModel); | ||
}(OutputBaseModel)); | ||
exports.ExecuteResultModel = ExecuteResultModel; | ||
(function (StreamName) { | ||
/** | ||
* The "stdout" stream name from the message spec. | ||
*/ | ||
StreamName[StreamName["StdOut"] = 0] = "StdOut"; | ||
/** | ||
* The "stderr" stream name from the message spec. | ||
*/ | ||
StreamName[StreamName["StdErr"] = 1] = "StdErr"; | ||
})(exports.StreamName || (exports.StreamName = {})); | ||
var StreamName = exports.StreamName; | ||
/** | ||
@@ -93,11 +63,11 @@ * An output model for stream data. | ||
/** | ||
* Output type | ||
* The output type. | ||
*/ | ||
this.outputType = OutputType.Stream; | ||
this.outputType = "stream"; | ||
} | ||
return StreamModel; | ||
})(OutputBaseModel); | ||
}(OutputBaseModel)); | ||
exports.StreamModel = StreamModel; | ||
function isStreamModel(model) { | ||
return model.outputType === OutputType.Stream; | ||
return model.outputType === "stream"; | ||
} | ||
@@ -112,8 +82,8 @@ /** | ||
/** | ||
* Output type | ||
* The output type. | ||
*/ | ||
this.outputType = OutputType.Error; | ||
this.outputType = "error"; | ||
} | ||
return ExecuteErrorModel; | ||
})(OutputBaseModel); | ||
}(OutputBaseModel)); | ||
exports.ExecuteErrorModel = ExecuteErrorModel; | ||
@@ -290,3 +260,3 @@ /** | ||
return OutputAreaModel; | ||
})(); | ||
}()); | ||
exports.OutputAreaModel = OutputAreaModel; |
@@ -14,3 +14,2 @@ // Copyright (c) Jupyter Development Team. | ||
var transformime_jupyter_transformers_1 = require("transformime-jupyter-transformers"); | ||
var model_1 = require('./model'); | ||
var phosphor_disposable_1 = require('phosphor-disposable'); | ||
@@ -67,12 +66,12 @@ /** | ||
switch (output.outputType) { | ||
case model_1.OutputType.ExecuteResult: | ||
case "execute_result": | ||
bundle = output.data; | ||
break; | ||
case model_1.OutputType.DisplayData: | ||
case "display_data": | ||
bundle = output.data; | ||
break; | ||
case model_1.OutputType.Stream: | ||
case "stream": | ||
bundle = { 'jupyter/console-text': output.text }; | ||
break; | ||
case model_1.OutputType.Error: | ||
case "error": | ||
var out = output; | ||
@@ -109,3 +108,3 @@ bundle = { 'jupyter/console-text': out.traceback || out.ename + ": " + out.evalue }; | ||
return OutputAreaWidget; | ||
})(phosphor_panel_1.Panel); | ||
}(phosphor_panel_1.Panel)); | ||
exports.OutputAreaWidget = OutputAreaWidget; | ||
@@ -112,0 +111,0 @@ /** |
{ | ||
"name": "jupyter-js-notebook", | ||
"version": "0.7.2", | ||
"version": "0.8.0", | ||
"description": "Notebook widget for Jupyter", | ||
@@ -39,3 +39,3 @@ "main": "lib/index.js", | ||
"typedoc": "^0.3.11", | ||
"typescript": "~1.7.0", | ||
"typescript": "^1.8.0", | ||
"watch": "^0.17.1", | ||
@@ -42,0 +42,0 @@ "webpack": "^1.12.9" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
123031
3857