File tree Expand file tree Collapse file tree 5 files changed +42
-16
lines changed
packages/perspective-jupyterlab/src Expand file tree Collapse file tree 5 files changed +42
-16
lines changed Original file line number Diff line number Diff line change 1+ // ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2+ // ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃
3+ // ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃
4+ // ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃
5+ // ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃
6+ // ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
7+ // ┃ Copyright (c) 2017, the Perspective Authors. ┃
8+ // ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃
9+ // ┃ This file is part of the Perspective library, distributed under the terms ┃
10+ // ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
11+ // ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
12+
13+ import THEMES from "../../../dist/css/perspective-jupyterlab.css" ;
14+
15+ // Export the required load_ipython_extension
16+ exports . load_css = ( ) => {
17+ const style = document . createElement ( "style" ) ;
18+ style . textContent = THEMES ;
19+ document . head . appendChild ( style ) ;
20+ } ;
Original file line number Diff line number Diff line change 1111// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
1212
1313/* eslint-disable no-underscore-dangle */
14+ import { load_css } from "./css" ;
1415
1516// This file contains the javascript that is run when the notebook is loaded.
1617// It contains some requirejs configuration and the `load_ipython_extension`
1718// which is required for any notebook extension.
18- //
19- // Some static assets may be required by the custom widget javascript. The base
20- // url for the notebook is not known at build time and is therefore computed
21- // dynamically.
22-
23- import THEMES from "../../../dist/css/perspective-jupyterlab.css" ;
24-
2519if ( window . require ) {
2620 window . require . config ( {
2721 map : {
@@ -33,9 +27,6 @@ if (window.require) {
3327 } ) ;
3428}
3529
36- // Export the required load_ipython_extension
3730exports . load_ipython_extension = ( ) => {
38- const style = document . createElement ( "style" ) ;
39- style . textContent = THEMES ;
40- document . head . appendChild ( style ) ;
31+ load_css ( ) ;
4132} ;
Original file line number Diff line number Diff line change @@ -14,8 +14,14 @@ import "@finos/perspective-viewer-datagrid";
1414import "@finos/perspective-viewer-d3fc" ;
1515import "@finos/perspective-viewer-openlayers" ;
1616
17+ import { load_css } from "./css" ;
1718import { PerspectiveView } from "../view" ;
1819import { PerspectiveModel } from "../model" ;
1920
2021exports . PerspectiveModel = PerspectiveModel ;
2122exports . PerspectiveView = PerspectiveView ;
23+
24+ // Run if in vs-code
25+ if ( window . vscIPyWidgets ) {
26+ load_css ( ) ;
27+ }
Original file line number Diff line number Diff line change @@ -404,10 +404,16 @@ export class PerspectiveView extends DOMWidgetView {
404404 table . update ( updated . delta ) ;
405405 }
406406
407- this . _client_view . on_update (
408- ( updated ) => this . _client_view_update_callback ( updated ) ,
409- { mode : "row" }
410- ) ;
407+ if ( this . _client_view ) {
408+ // NOTE: if `plugin_config_changed` called before
409+ // `_handle_load_message`, this will be undefined
410+ // Ignore, as `_handle_load_message` is sure to
411+ // follow.
412+ this . _client_view . on_update (
413+ ( updated ) => this . _client_view_update_callback ( updated ) ,
414+ { mode : "row" }
415+ ) ;
416+ }
411417
412418 this . _kernel_view . on_update (
413419 ( updated ) => this . _kernel_view_update_callback ( updated ) ,
Original file line number Diff line number Diff line change @@ -36,8 +36,11 @@ div.PSPContainer {
3636}
3737
3838// Widget height for Voila
39- body [data- voila= " voila" ] .jp-OutputArea-output div .PSPContainer {
39+ // Widget height for VS Code
40+ body [data- voila= " voila" ] .jp-OutputArea-output div .PSPContainer ,
41+ body [data- vscode- theme- id] .cell-output-ipywidget-background div .PSPContainer {
4042 min-height : 520px ;
43+ height : 520px ;
4144}
4245
4346div .PSPContainer perspective- viewer[theme= " Pro Light" ] {
You can’t perform that action at this time.
0 commit comments