create-nteract-app
Advanced tools
Comparing version 0.2.0 to 0.3.0
{ | ||
"name": "create-nteract-app", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "create an nteractive computing app!", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -5,2 +5,4 @@ const _ = require("lodash"); | ||
import CodeMirrorEditor from "@nteract/editor"; | ||
const transforms = require("@nteract/transforms"); | ||
@@ -7,0 +9,0 @@ const messaging = require("@nteract/messaging"); |
@@ -10,2 +10,5 @@ import * as React from "react"; | ||
const transforms = require("@nteract/transforms"); | ||
const messaging = require("@nteract/messaging"); | ||
import CodeMirrorEditor from "@nteract/editor"; | ||
@@ -18,8 +21,16 @@ | ||
this.submit = () => { | ||
console.log(this.state.source); | ||
console.log("Submitting", this.state.source); | ||
if (this.props.kernel && this.props.kernel.channels) { | ||
this.props.kernel.channels.next( | ||
messaging.executeRequest(this.state.source) | ||
); | ||
console.log("submitted!"); | ||
} else { | ||
console.warn("Could not submit, kernel not connected"); | ||
debugger; | ||
} | ||
}; | ||
this.state = { | ||
source: this.props.source, | ||
messageCollections: {}, | ||
source: this.props.children, | ||
codeMirrorOptions: { | ||
@@ -38,2 +49,32 @@ extraKeys: { | ||
render() { | ||
const outputs = _.map( | ||
this.props.messageCollections, | ||
(collection, parent_id) => { | ||
return _.map(collection, msg => { | ||
switch (msg.msg_type) { | ||
case "execute_result": | ||
case "display_data": | ||
if (msg.content.data) { | ||
const mimetype = transforms.richestMimetype(msg.content.data); | ||
if (!mimetype) { | ||
return null; | ||
} | ||
const Transform = transforms.transforms[mimetype]; | ||
return ( | ||
<Transform | ||
key={msg.header.msg_id} | ||
data={msg.content.data[mimetype]} | ||
/> | ||
); | ||
} | ||
case "stream": | ||
return <pre key={msg.header.msg_id}>{msg.content.text}</pre>; | ||
default: | ||
return null; | ||
} | ||
}).filter(x => x !== null); | ||
} | ||
); | ||
return ( | ||
@@ -56,2 +97,3 @@ <div className="omg"> | ||
</Input> | ||
{outputs && outputs.length > 0 ? <Outputs>{outputs}</Outputs> : null} | ||
</Cell> | ||
@@ -67,1 +109,5 @@ <style>{` | ||
} | ||
PresentationCell.defaultProps = { | ||
children: "" | ||
}; |
@@ -17,6 +17,2 @@ import Document, { Head, Main, NextScript } from "next/document"; | ||
/> | ||
<link | ||
rel="stylesheet" | ||
href="https://unpkg.com/awsm.css/dist/awsm.min.css" | ||
/> | ||
<style>{`body { margin: 0 } /* custom! */`}</style> | ||
@@ -23,0 +19,0 @@ </Head> |
@@ -13,3 +13,3 @@ import { Kernel } from "@mybinder/host-cache"; | ||
return ( | ||
<> | ||
<div className="app"> | ||
<center> | ||
@@ -34,3 +34,8 @@ <WideLogo height={80} theme="light" /> | ||
</Kernel> | ||
</> | ||
<style jsx>{` | ||
.app { | ||
padding: 30px; | ||
} | ||
`}</style> | ||
</div> | ||
); | ||
@@ -37,0 +42,0 @@ }; |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
207111
16
648
2