JSPM

  • Created
  • Published
  • Downloads 6431
  • Score
    100M100P100Q136306F
  • License BSD-3-Clause

VDOM Transform for jupyter outputs

Package Exports

  • @nteract/transform-vdom

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@nteract/transform-vdom) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Transform VDOM

React Component for transforming application/vdom.v1+json data to React Elements.

Installation

npm install --save @nteract/transform-vdom

Note: This transform is included in @nteract/transforms so if you're using that you don't have to add this to your mimetype transforms.

Usage

import VDOMTransform from '@nteract/transform-vdom'

ReactDOM.render(
  <VDOMTransform
    // Data from display_data or execute_result mimebundle on the
    // mimetype key application/vdom.v1+json
    data={{ tagName: 'h1', children: 'Hey', attributes: {}}}
  >,
  rootEl)

Users of this mimetype are likely using a higher level library that lets them write declaratively in their language of choice. For Python, there's vdom which lets you write code like:

from IPython.display import display
from vdom.helpers import h1, p, img, div, b

display(
    div(
        h1('Our Incredibly Declarative Example'),
        p('Can you believe we wrote this ', b('in Python'), '?'),
        img(src="https://media.giphy.com/media/xUPGcguWZHRC2HyBRS/giphy.gif"),
        p('What will ', b('you'), ' create next?'),
    )
)