-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split vdom-extension into separate packages
- Loading branch information
Showing
14 changed files
with
248 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -213,6 +213,9 @@ | |
{ | ||
"path": "../ui-components" | ||
}, | ||
{ | ||
"path": "../vdom" | ||
}, | ||
{ | ||
"path": "../vdom-extension" | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# vdom-extension | ||
|
||
A JupyterLab extension for rendering VirtualDOM using React | ||
|
||
![demo](http://g.recordit.co/EIwAIBsGBh.gif) | ||
|
||
## Prerequisites | ||
|
||
- JupyterLab ^0.27.0 | ||
|
||
## Usage | ||
|
||
To render VDOM output in IPython: | ||
|
||
```python | ||
from IPython.display import display | ||
|
||
def VDOM(data={}): | ||
bundle = {} | ||
bundle['application/vdom.v1+json'] = data | ||
display(bundle, raw=True) | ||
|
||
VDOM({ | ||
'tagName': 'div', | ||
'attributes': {}, | ||
'children': [{ | ||
'tagName': 'h1', | ||
'attributes': {}, | ||
'children': 'Our Incredibly Declarative Example', | ||
'key': 0 | ||
}, { | ||
'tagName': 'p', | ||
'attributes': {}, | ||
'children': ['Can you believe we wrote this ', { | ||
'tagName': 'b', | ||
'attributes': {}, | ||
'children': 'in Python', | ||
'key': 1 | ||
}, '?'], | ||
'key': 1 | ||
}, { | ||
'tagName': 'img', | ||
'attributes': { | ||
'src': 'https://media.giphy.com/media/xUPGcguWZHRC2HyBRS/giphy.gif' | ||
}, | ||
'key': 2 | ||
}, { | ||
'tagName': 'p', | ||
'attributes': {}, | ||
'children': ['What will ', { | ||
'tagName': 'b', | ||
'attributes': {}, | ||
'children': 'you', | ||
'key': 1 | ||
}, ' create next?'], | ||
'key': 3 | ||
}] | ||
}) | ||
``` | ||
|
||
Using the [vdom Python library](https://github.com/nteract/vdom): | ||
|
||
```python | ||
from vdom import h1, p, img, div, b | ||
|
||
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?'), | ||
) | ||
``` | ||
|
||
To render a `.vdom` or `.vdom.json` file, simply open it: | ||
|
||
## Development | ||
|
||
See the [JupyterLab Contributor Documentation](https://github.com/jupyterlab/jupyterlab/blob/master/CONTRIBUTING.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"name": "@jupyterlab/vdom", | ||
"version": "1.0.0-alpha.3", | ||
"description": "A viewer for VDOM documents.", | ||
"homepage": "https://github.com/jupyterlab/jupyterlab", | ||
"bugs": { | ||
"url": "https://github.com/jupyterlab/jupyterlab/issues" | ||
}, | ||
"license": "BSD-3-Clause", | ||
"author": "Project Jupyter", | ||
"files": [ | ||
"lib/*.d.ts", | ||
"lib/*.js", | ||
"style/*" | ||
], | ||
"main": "lib/index.js", | ||
"types": "lib/index.d.ts", | ||
"directories": { | ||
"lib": "lib/" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/jupyterlab/jupyterlab.git" | ||
}, | ||
"scripts": { | ||
"build": "tsc -b", | ||
"clean": "rimraf lib", | ||
"docs": "typedoc --options tdoptions.json --theme ../../typedoc-theme src", | ||
"prepublishOnly": "npm run build", | ||
"watch": "tsc -b --watch" | ||
}, | ||
"dependencies": { | ||
"@jupyterlab/apputils": "^1.0.0-alpha.3", | ||
"@jupyterlab/docregistry": "^1.0.0-alpha.3", | ||
"@jupyterlab/rendermime-interfaces": "^1.3.0-alpha.3", | ||
"@jupyterlab/services": "^4.0.0-alpha.3", | ||
"@nteract/transform-vdom": "^4.0.1", | ||
"@phosphor/messaging": "^1.2.2", | ||
"@phosphor/widgets": "^1.6.0", | ||
"react": "~16.4.2", | ||
"react-dom": "~16.4.2" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "~16.4.13", | ||
"@types/react-dom": "~16.0.7", | ||
"rimraf": "~2.6.2", | ||
"typedoc": "^0.14.2", | ||
"typescript": "~3.3.1" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"gitHead": "31f68f6d1717b58c344a5fb4f4baf3b123b7c75c" | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
Copyright (c) Jupyter Development Team. | ||
Distributed under the terms of the Modified BSD License. | ||
*/ | ||
|
||
/* Add CSS variables to :root */ | ||
:root { | ||
--jp-icon-vdom: url('./react.svg'); | ||
} | ||
|
||
/* Base styles */ | ||
.jp-RenderedVDOM { | ||
width: 100%; | ||
height: 100%; | ||
padding: 0; | ||
overflow: auto; | ||
} | ||
|
||
/* Document styles */ | ||
.jp-MimeDocument .jp-RenderedVDOM { | ||
padding: 5px; | ||
} | ||
|
||
/* Document icon */ | ||
.jp-VDOMIcon { | ||
background-image: var(--jp-icon-vdom); | ||
background-size: 24px; | ||
background-position: center !important; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"excludeNotExported": true, | ||
"mode": "file", | ||
"target": "es5", | ||
"module": "es5", | ||
"lib": [ | ||
"lib.es2015.d.ts", | ||
"lib.es2015.collection.d.ts", | ||
"lib.es2015.promise.d.ts", | ||
"lib.dom.d.ts" | ||
], | ||
"out": "../../docs/api/vdom", | ||
"baseUrl": ".", | ||
"paths": { | ||
"@jupyterlab/*": ["../packages/*"] | ||
}, | ||
"esModuleInterop": true, | ||
"jsx": "react", | ||
"types": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"extends": "../../tsconfigbase", | ||
"compilerOptions": { | ||
"outDir": "lib", | ||
"rootDir": "src" | ||
}, | ||
"include": ["src/*"], | ||
"references": [ | ||
{ | ||
"path": "../apputils" | ||
}, | ||
{ | ||
"path": "../docregistry" | ||
}, | ||
{ | ||
"path": "../rendermime-interfaces" | ||
}, | ||
{ | ||
"path": "../services" | ||
} | ||
] | ||
} |