Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,6 @@ docs/i18n/en.json
docs/modules.rst
docs/perspective.*.rst
docs/python
docs/static/img/**/*
!docs/static/img/logo/
!docs/static/img/logo/**
docs/static/css/material-dark.css
docs/i18n/en.json
docs/.docusaurus
Expand Down
Binary file added docs/static/img/jupyterlab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/static/img/mtg_preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/static/img/mtg_thumbnail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions packages/perspective-webpack-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
"author": "",
"license": "Apache-2.0",
"dependencies": {
"@finos/perspective": "^2.1.1",
"@finos/perspective-viewer": "^2.1.1",
"arraybuffer-loader": "^1.0.2",
"css-loader": "^6.7.3",
"exports-loader": "^3.1.0",
"string-replace-loader": "^3.0.1",
"worker-loader": "^3.0.7"
},
"peerDependencies": {
"@finos/perspective": "^2.1.1",
"@finos/perspective-viewer": "^2.1.1",
"webpack": "^5.60.0"
}
}
8 changes: 8 additions & 0 deletions rust/perspective-viewer/src/less/containers/split-panel.less
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
*/

:host {
.split-panel.orient-reverse > .split-panel-child:not(:last-child):not(.is-width-override) {
max-width: 300px;
}

.split-panel {
display: flex;
height: 100%;
Expand All @@ -26,6 +30,10 @@
}
}

&.orient-reverse {
flex-direction: row-reverse;
}

&.orient-vertical.orient-reverse {
flex-direction: column-reverse;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
use web_sys::*;
use yew::prelude::*;

use super::column_selector::InPlaceColumn;
use super::modal::*;
use super::InPlaceColumn;
use crate::utils::WeakScope;
use crate::*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::collections::HashSet;
use web_sys::*;
use yew::prelude::*;

use crate::components::LocalStyle;
use crate::components::style::LocalStyle;
use crate::css;
use crate::custom_elements::ColumnDropDownElement;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ use wasm_bindgen::JsCast;
use web_sys::*;
use yew::prelude::*;

use super::super::LocalStyle;
use crate::components::form::highlight::highlight;
use crate::components::style::LocalStyle;
use crate::custom_elements::FunctionDropDownElement;
use crate::exprtk::{tokenize, Cursor};
use crate::js::PerspectiveValidationError;
Expand Down
35 changes: 18 additions & 17 deletions rust/perspective-viewer/src/rust/components/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,32 @@
//! these 4.

pub mod column_dropdown;
mod column_selector;
mod containers;
mod copy_dropdown;
pub mod column_selector;
pub mod containers;
pub mod copy_dropdown;
pub mod datetime_column_style;
pub mod export_dropdown;
pub mod expression_editor;
pub mod filter_dropdown;
mod font_loader;
mod form;
pub mod font_loader;
pub mod form;
pub mod function_dropdown;
mod modal;
pub mod modal;
pub mod number_column_style;
mod plugin_selector;
mod render_warning;
mod status_bar;
mod status_bar_counter;
pub mod plugin_selector;
pub mod render_warning;
pub mod status_bar;
pub mod status_bar_counter;
pub mod string_column_style;
mod style;
mod viewer;
pub mod style;
pub mod viewer;

#[cfg(test)]
mod tests;

pub use self::column_selector::InPlaceColumn;
pub use self::copy_dropdown::*;
pub use self::modal::*;
pub use self::style::*;
pub use self::viewer::*;
// pub use self::column_selector::InPlaceColumn;
// pub use self::containers::*;
// pub use self::copy_dropdown::*;
// pub use self::modal::*;
// pub use self::style::*;
// pub use self::viewer::*;
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use yew::prelude::*;

use super::containers::select::*;
use super::LocalStyle;
use super::style::LocalStyle;
use crate::config::*;
use crate::js::*;
use crate::model::*;
Expand Down
26 changes: 19 additions & 7 deletions rust/perspective-viewer/src/rust/components/style/style_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ static DOM_STYLES: &[CSSResource] = &[css!("dom/checkbox"), css!("dom/select")];

/// A state object for `<style>` snippets used by a yew `Component` with a
/// `<StyleProvider>` at the root.
#[derive(Clone, Default)]
#[derive(Clone)]
pub struct StyleCache(Rc<StyleCacheData>);

impl Deref for StyleCache {
Expand All @@ -43,6 +43,10 @@ impl PartialEq for StyleCache {
}

impl StyleCache {
pub fn new(is_shadow: bool) -> StyleCache {
StyleCache(Rc::new(StyleCacheData::new(is_shadow)))
}

/// Insert a new stylesheet into this manager, _immediately_ inserting it
/// into the DOM as well if any other elements are already connected,
/// bypassing yew rendering; when the yew `Component::view` method is
Expand All @@ -55,7 +59,7 @@ impl StyleCache {
pub fn add_style(&self, name: &'static str, css: &'static str) {
let mut map = self.0.styles.borrow_mut();
if !map.contains_key(name) {
let style = Self::into_style(name, css);
let style = Self::into_style(name, css, self.0.is_shadow);
let first = map.values().next().cloned();
map.insert(name, style.clone());
if let Some(x) = first {
Expand All @@ -69,9 +73,15 @@ impl StyleCache {

/// Concert a CSS string to an `HtmlStyleElement`, which are memoized due
/// to their size and DOM performance impact.
fn into_style(name: &str, css: &str) -> web_sys::HtmlStyleElement {
fn into_style(name: &str, css: &str, is_shadow: bool) -> web_sys::HtmlStyleElement {
let elem = global::document().create_element("style").unwrap();
elem.set_text_content(Some(css));
if is_shadow {
elem.set_text_content(Some(css));
} else {
let new_css = css.replace(":host", ":root");
elem.set_text_content(Some(&new_css));
}

elem.set_attribute("name", name).unwrap();
elem.unchecked_into()
}
Expand All @@ -85,16 +95,18 @@ impl StyleCache {
/// when rendered to the DOM.
pub struct StyleCacheData {
styles: RefCell<BTreeMap<&'static str, web_sys::HtmlStyleElement>>,
is_shadow: bool,
}

impl Default for StyleCacheData {
fn default() -> Self {
impl StyleCacheData {
fn new(is_shadow: bool) -> Self {
let styles = DOM_STYLES
.iter()
.map(|x| (x.0, StyleCache::into_style(x.0, x.1)));
.map(|x| (x.0, StyleCache::into_style(x.0, x.1, is_shadow)));

Self {
styles: RefCell::new(styles.collect()),
is_shadow,
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ use crate::*;

#[derive(Properties, PartialEq)]
pub struct StyleProviderProps {
#[prop_or(true)]
pub is_shadow: bool,
pub children: Children,
}

Expand All @@ -30,8 +32,8 @@ impl Component for StyleProvider {
type Message = ();
type Properties = StyleProviderProps;

fn create(_ctx: &Context<Self>) -> Self {
let cache = StyleCache::default();
fn create(ctx: &Context<Self>) -> Self {
let cache = StyleCache::new(ctx.props().is_shadow);
Self { cache }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use yew::html::ImplicitClone;
use yew::{props, Callback};

use crate::components::column_dropdown::*;
use crate::components::InPlaceColumn;
use crate::components::column_selector::InPlaceColumn;
use crate::custom_elements::modal::*;
use crate::session::Session;
use crate::utils::ApiFuture;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use yew::*;

use super::modal::*;
use super::viewer::PerspectiveViewerElement;
use crate::components::{CopyDropDownMenu, CopyDropDownMenuProps};
use crate::components::copy_dropdown::{CopyDropDownMenu, CopyDropDownMenuProps};
use crate::js::*;
use crate::model::*;
use crate::utils::*;
Expand Down
2 changes: 1 addition & 1 deletion rust/perspective-viewer/src/rust/custom_elements/modal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use web_sys::*;
use yew::html::SendAsMessage;
use yew::prelude::*;

use crate::components::*;
use crate::components::modal::*;
use crate::utils::*;

type BlurHandlerType = Rc<RefCell<Option<Closure<dyn FnMut(FocusEvent)>>>>;
Expand Down
2 changes: 1 addition & 1 deletion rust/perspective-viewer/src/rust/custom_elements/viewer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use wasm_bindgen_futures::JsFuture;
use web_sys::*;
use yew::prelude::*;

use crate::components::{Msg, PerspectiveViewer, PerspectiveViewerProps};
use crate::components::viewer::{Msg, PerspectiveViewer, PerspectiveViewerProps};
use crate::config::*;
use crate::custom_events::*;
use crate::dragdrop::*;
Expand Down
4 changes: 1 addition & 3 deletions rust/perspective-viewer/src/rust/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
clippy::await_holding_refcell_ref
)]

mod components;
pub mod components;
pub mod config;
pub mod custom_elements;
mod custom_events;
Expand All @@ -32,8 +32,6 @@ mod renderer;
mod session;
pub mod utils;

#[cfg(feature = "define_custom_elements_async")]
pub use components::{LocalStyle, StyleProvider};
use utils::JsValueSerdeExt;
use wasm_bindgen::prelude::*;

Expand Down
Binary file modified tools/perspective-test/results.tar.gz
Binary file not shown.