Skip to content

Commit

Permalink
Update to Vega 5 (#6133)
Browse files Browse the repository at this point in the history
* Update to Vega 5.

* Lint

* Update deps

* Update yarn

* Don't depend on stable stringify typings

* Integrity update

* Update readme

* Reset yarn changes

* Fix versions

* Clean up

* Revert some other changes

* Revert more
  • Loading branch information
domoritz authored and ian-r-rose committed Mar 25, 2019
1 parent f8d9758 commit cba7c89
Show file tree
Hide file tree
Showing 14 changed files with 422 additions and 300 deletions.
2 changes: 1 addition & 1 deletion buildutils/src/ensure-repo.ts
Expand Up @@ -27,7 +27,7 @@ let UNUSED: { [key: string]: string[] } = {
'@jupyterlab/services': ['node-fetch', 'ws'],
'@jupyterlab/testutils': ['node-fetch', 'identity-obj-proxy'],
'@jupyterlab/test-csvviewer': ['csv-spectrum'],
'@jupyterlab/vega4-extension': ['vega', 'vega-lite']
'@jupyterlab/vega5-extension': ['vega', 'vega-lite']
};

let pkgData: { [key: string]: any } = {};
Expand Down
6 changes: 3 additions & 3 deletions dev_mode/package.json
Expand Up @@ -82,7 +82,7 @@
"@jupyterlab/tooltip-extension": "^1.0.0-alpha.3",
"@jupyterlab/ui-components": "^1.0.0-alpha.3",
"@jupyterlab/vdom-extension": "^1.0.0-alpha.3",
"@jupyterlab/vega4-extension": "^1.0.0-alpha.3",
"@jupyterlab/vega5-extension": "^1.0.0-alpha.3",
"@phosphor/algorithm": "^1.1.2",
"@phosphor/application": "^1.6.0",
"@phosphor/commands": "^1.6.1",
Expand Down Expand Up @@ -179,7 +179,7 @@
"@jupyterlab/json-extension": "",
"@jupyterlab/pdf-extension": "",
"@jupyterlab/vdom-extension": "",
"@jupyterlab/vega4-extension": ""
"@jupyterlab/vega5-extension": ""
},
"name": "JupyterLab",
"buildDir": "./static",
Expand Down Expand Up @@ -305,7 +305,7 @@
"@jupyterlab/tooltip-extension": "../packages/tooltip-extension",
"@jupyterlab/ui-components": "../packages/ui-components",
"@jupyterlab/vdom-extension": "../packages/vdom-extension",
"@jupyterlab/vega4-extension": "../packages/vega4-extension"
"@jupyterlab/vega5-extension": "../packages/vega5-extension"
}
}
}
2 changes: 1 addition & 1 deletion packages/metapackage/package.json
Expand Up @@ -100,7 +100,7 @@
"@jupyterlab/tooltip-extension": "^1.0.0-alpha.3",
"@jupyterlab/ui-components": "^1.0.0-alpha.3",
"@jupyterlab/vdom-extension": "^1.0.0-alpha.3",
"@jupyterlab/vega4-extension": "^1.0.0-alpha.3"
"@jupyterlab/vega5-extension": "^1.0.0-alpha.3"
},
"devDependencies": {
"fs-extra": "~4.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/metapackage/src/index.ts
Expand Up @@ -66,4 +66,4 @@ import '@jupyterlab/tooltip';
import '@jupyterlab/tooltip-extension';
import '@jupyterlab/ui-components';
import '@jupyterlab/vdom-extension';
import '@jupyterlab/vega4-extension';
import '@jupyterlab/vega5-extension';
2 changes: 1 addition & 1 deletion packages/metapackage/tsconfig.json
Expand Up @@ -217,7 +217,7 @@
"path": "../vdom-extension"
},
{
"path": "../vega4-extension"
"path": "../vega5-extension"
}
]
}
2 changes: 1 addition & 1 deletion packages/rendermime-interfaces/README.md
Expand Up @@ -11,4 +11,4 @@ When using these interfaces, extensions only need to provide some metadata about
wht kind of mime bundle they are able to render, and a `Widget` with
a `renderModel` method that renders the mime bundle.

Examples can be found in [@jupyterlab/vega4-extension](../vega4-extension) and [@jupyterlab/pdf-extension](../pdf-extension).
Examples can be found in [@jupyterlab/vega5-extension](../vega5-extension) and [@jupyterlab/pdf-extension](../pdf-extension).
@@ -1,6 +1,6 @@
# vega4-extension
# vega5-extension

A JupyterLab extension for rendering [Vega](https://vega.github.io/vega) 4 and [Vega-Lite](https://vega.github.io/vega-lite) 2.
A JupyterLab extension for rendering [Vega](https://vega.github.io/vega) 5 and [Vega-Lite](https://vega.github.io/vega-lite) 3.

![demo](http://g.recordit.co/USoTkuCOfR.gif)

Expand All @@ -16,8 +16,8 @@ To render Vega-Lite output in IPython:
from IPython.display import display

display({
"application/vnd.vegalite.v2+json": {
"$schema": "https://vega.github.io/schema/vega-lite/v2.json",
"application/vnd.vegalite.v3+json": {
"$schema": "https://vega.github.io/schema/vega-lite/v3.json",
"description": "A simple bar chart with embedded data.",
"data": {
"values": [
Expand Down Expand Up @@ -57,8 +57,8 @@ Provide vega-embed options via metadata:
from IPython.display import display

display({
"application/vnd.vegalite.v2+json": {
"$schema": "https://vega.github.io/schema/vega-lite/v2.json",
"application/vnd.vegalite.v3+json": {
"$schema": "https://vega.github.io/schema/vega-lite/v3.json",
"description": "A simple bar chart with embedded data.",
"data": {
"values": [
Expand Down
@@ -1,7 +1,7 @@
{
"name": "@jupyterlab/vega4-extension",
"name": "@jupyterlab/vega5-extension",
"version": "1.0.0-alpha.3",
"description": "JupyterLab - Vega 4 and Vega-Lite 2 Mime Renderer Extension",
"description": "JupyterLab - Vega 5 and Vega-Lite 3 Mime Renderer Extension",
"homepage": "https://github.com/jupyterlab/jupyterlab",
"bugs": {
"url": "https://github.com/jupyterlab/jupyterlab/issues"
Expand Down Expand Up @@ -33,10 +33,11 @@
"@jupyterlab/rendermime-interfaces": "^1.3.0-alpha.3",
"@phosphor/coreutils": "^1.3.0",
"@phosphor/widgets": "^1.6.0",
"vega-embed": "3.18.2"
"vega": "^5.3.1",
"vega-embed": "^4.0.0",
"vega-lite": "^3.0.0"
},
"devDependencies": {
"@types/json-stable-stringify": "^1.0.32",
"@types/webpack-env": "~1.13.6",
"rimraf": "~2.6.2",
"typedoc": "^0.14.2",
Expand Down
Expand Up @@ -16,33 +16,33 @@ import '../style/index.css';
/**
* The CSS class to add to the Vega and Vega-Lite widget.
*/
const VEGA_COMMON_CLASS = 'jp-RenderedVegaCommon4';
const VEGA_COMMON_CLASS = 'jp-RenderedVegaCommon5';

/**
* The CSS class to add to the Vega.
*/
const VEGA_CLASS = 'jp-RenderedVega4';
const VEGA_CLASS = 'jp-RenderedVega5';

/**
* The CSS class to add to the Vega-Lite.
*/
const VEGALITE_CLASS = 'jp-RenderedVegaLite2';
const VEGALITE_CLASS = 'jp-RenderedVegaLite3';

/**
* The MIME type for Vega.
*
* #### Notes
* The version of this follows the major version of Vega.
*/
export const VEGA_MIME_TYPE = 'application/vnd.vega.v4+json';
export const VEGA_MIME_TYPE = 'application/vnd.vega.v5+json';

/**
* The MIME type for Vega-Lite.
*
* #### Notes
* The version of this follows the major version of Vega-Lite.
*/
export const VEGALITE_MIME_TYPE = 'application/vnd.vegalite.v2+json';
export const VEGALITE_MIME_TYPE = 'application/vnd.vegalite.v3+json';

/**
* A widget for rendering Vega or Vega-Lite data, for usage with rendermime.
Expand Down Expand Up @@ -132,32 +132,32 @@ export const rendererFactory: IRenderMime.IRendererFactory = {
const extension: IRenderMime.IExtension = {
id: '@jupyterlab/vega-extension:factory',
rendererFactory,
rank: 50, // prefer over vega 2 extension
rank: 50,
dataType: 'json',
documentWidgetFactoryOptions: [
{
name: 'Vega',
primaryFileType: 'vega4',
fileTypes: ['vega4', 'json'],
defaultFor: ['vega4']
primaryFileType: 'vega5',
fileTypes: ['vega5', 'json'],
defaultFor: ['vega5']
},
{
name: 'Vega-Lite',
primaryFileType: 'vega-lite2',
fileTypes: ['vega-lite2', 'json'],
defaultFor: ['vega-lite2']
primaryFileType: 'vega-lite3',
fileTypes: ['vega-lite3', 'json'],
defaultFor: ['vega-lite3']
}
],
fileTypes: [
{
mimeTypes: [VEGA_MIME_TYPE],
name: 'vega4',
name: 'vega5',
extensions: ['.vg', '.vg.json', '.vega'],
iconClass: 'jp-MaterialIcon jp-VegaIcon'
},
{
mimeTypes: [VEGALITE_MIME_TYPE],
name: 'vega-lite2',
name: 'vega-lite3',
extensions: ['.vl', '.vl.json', '.vegalite'],
iconClass: 'jp-MaterialIcon jp-VegaIcon'
}
Expand Down
File renamed without changes.
File renamed without changes.
Expand Up @@ -9,7 +9,7 @@
"lib.es2015.promise.d.ts",
"lib.dom.d.ts"
],
"out": "../../docs/api/vega4-extension",
"out": "../../docs/api/vega5-extension",
"baseUrl": ".",
"paths": {
"@jupyterlab/*": ["../packages/*"]
Expand Down
File renamed without changes.

0 comments on commit cba7c89

Please sign in to comment.