Skip to content

Commit

Permalink
Implement JupyterLab Panel Preview (#79)
Browse files Browse the repository at this point in the history
* Implement JupyterLab Panel Preview

* Add support for py and yaml files

* Remove log statement

* Linting
  • Loading branch information
philippjfr authored Jul 1, 2021
1 parent ebac4b5 commit 64f3363
Show file tree
Hide file tree
Showing 10 changed files with 15,947 additions and 4,566 deletions.
19,800 changes: 15,249 additions & 4,551 deletions package-lock.json

Large diffs are not rendered by default.

19 changes: 16 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pyviz/jupyterlab_pyviz",
"version": "2.0.2",
"version": "2.1.0",
"description": "A JupyterLab extension for rendering HoloViz content.",
"keywords": [
"jupyter",
Expand All @@ -15,7 +15,8 @@
"author": "Philipp Rudiger",
"files": [
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
"style/**/*.{css,.js,eot,gif,html,jpg,json,png,svg,woff2,ttf}"
"style/**/*.{css,.js,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
"schema/*.json"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down Expand Up @@ -44,8 +45,18 @@
},
"dependencies": {
"@jupyterlab/application": "^3.0.0",
"@jupyterlab/apputils": "^3.0.0",
"@jupyterlab/coreutils": "^5.0.0",
"@jupyterlab/docregistry": "^3.0.0",
"@jupyterlab/notebook": "^3.0.0"
"@jupyterlab/fileeditor": "^3.0.0",
"@jupyterlab/mainmenu": "^3.0.0",
"@jupyterlab/notebook": "^3.0.0",
"@jupyterlab/settingregistry": "^3.0.0",
"@jupyterlab/ui-components": "^3.0.0",
"@lumino/coreutils": "^1.5.3",
"@lumino/signaling": "^1.4.3",
"react": "^17.0.1",
"react-dom": "^17.0.1"
},
"peerDependencies": {
"@jupyter-widgets/jupyterlab-manager": "^3.0.0"
Expand All @@ -55,6 +66,8 @@
"@jupyterlab/builder": "^3.0.0",
"@jupyterlab/testutils": "^3.0.0",
"@types/node": "^14.14.16",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@typescript-eslint/eslint-plugin": "^2.27.0",
"@typescript-eslint/parser": "^2.27.0",
"eslint": "^7.5.0",
Expand Down
16 changes: 16 additions & 0 deletions schema/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"jupyter.lab.setting-icon-class": "jp-PanelIcon",
"jupyter.lab.setting-icon-label": "Panel Preview",
"title": "Panel Preview",
"description": "Panel Preview Extension",
"properties": {
"renderOnSave": {
"title": "Render Preview on Save",
"description": "Render the Panel preview automatically after saving the notebook",
"default": false,
"type": "boolean"
}
},
"additionalProperties": false,
"type": "object"
}
8 changes: 8 additions & 0 deletions src/icons.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { LabIcon } from '@jupyterlab/ui-components';

import panelSvgStr from '../style/panel.svg';

export const panelIcon = new LabIcon({
name: '@pyviz/jupyterlab_pyviz:panel',
svgstr: panelSvgStr
});
3 changes: 3 additions & 0 deletions src/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ export class ContextManager implements IDisposable {
}

get comm(): any {
if (this._context.sessionContext == null) {
return null;
}
if (
this._comm === null &&
this._context.sessionContext.session?.kernel !== null
Expand Down
Loading

0 comments on commit 64f3363

Please sign in to comment.