@perspective-dev/viewer 4.5.1 → 4.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/perspective-viewer.js +1 -1
- package/dist/cdn/perspective-viewer.js.map +2 -2
- package/dist/css/botanical.css +1 -1
- package/dist/css/dracula.css +1 -1
- package/dist/css/gruvbox-dark.css +1 -1
- package/dist/css/monokai.css +1 -1
- package/dist/css/phosphor.css +1 -1
- package/dist/css/pro-dark.css +1 -1
- package/dist/css/themes.css +1 -1
- package/dist/css/vaporwave.css +1 -1
- package/dist/esm/perspective-viewer.cdn.d.ts +3 -0
- package/dist/esm/perspective-viewer.inline.d.ts +3 -0
- package/dist/esm/perspective-viewer.inline.js +1 -1
- package/dist/esm/perspective-viewer.inline.js.map +2 -2
- package/dist/esm/perspective-viewer.js +1 -1
- package/dist/esm/perspective-viewer.js.map +2 -2
- package/dist/esm/ts-rs/OnUpdateData.d.ts +6 -0
- package/dist/esm/ts-rs/ViewOnUpdateResp.d.ts +4 -0
- package/dist/wasm/perspective-viewer.d.ts +15 -15
- package/dist/wasm/perspective-viewer.js +69 -69
- package/dist/wasm/perspective-viewer.wasm +0 -0
- package/dist/wasm/perspective-viewer.wasm.d.ts +15 -15
- package/package.json +1 -1
- package/src/{rust/components/style/local_style.rs → css/_column_dropdown.css} +14 -35
- package/src/css/_dropdown_menu.css +14 -0
- package/src/css/_filter_dropdown.css +14 -0
- package/src/css/_function_dropdown.css +14 -0
- package/src/css/_viewer_bundle.css +41 -0
- package/src/css/viewer.css +2 -2
- package/src/rust/components/column_dropdown.rs +3 -3
- package/src/rust/components/column_selector/aggregate_selector.rs +0 -3
- package/src/rust/components/column_selector/config_selector.rs +0 -3
- package/src/rust/components/column_selector/empty_column.rs +0 -3
- package/src/rust/components/column_selector/filter_column.rs +0 -3
- package/src/rust/components/column_selector/invalid_column.rs +0 -4
- package/src/rust/components/column_selector.rs +0 -3
- package/src/rust/components/column_settings_sidebar/style_tab/symbol/symbol_pairs.rs +0 -3
- package/src/rust/components/column_settings_sidebar/style_tab/symbol.rs +0 -3
- package/src/rust/components/column_settings_sidebar.rs +0 -3
- package/src/rust/components/containers/dropdown_menu.rs +1 -3
- package/src/rust/components/containers/scroll_panel.rs +1 -3
- package/src/rust/components/containers/split_panel.rs +0 -4
- package/src/rust/components/containers/tab_list.rs +0 -3
- package/src/rust/components/datetime_column_style.rs +0 -3
- package/src/rust/components/empty_row.rs +0 -3
- package/src/rust/components/expression_editor.rs +2 -3
- package/src/rust/components/filter_dropdown.rs +3 -3
- package/src/rust/components/font_loader.rs +2 -2
- package/src/rust/components/form/code_editor.rs +0 -3
- package/src/rust/components/form/debug.rs +0 -4
- package/src/rust/components/function_dropdown.rs +3 -3
- package/src/rust/components/number_series_style.rs +0 -3
- package/src/rust/components/plugin_selector.rs +0 -3
- package/src/rust/components/plugin_tab.rs +0 -5
- package/src/rust/components/portal.rs +5 -2
- package/src/rust/components/render_warning.rs +0 -3
- package/src/rust/components/status_bar.rs +3 -2
- package/src/rust/components/string_column_style.rs +0 -3
- package/src/rust/components/style/mod.rs +60 -27
- package/src/rust/components/style/style_provider.rs +49 -16
- package/src/rust/components/style_controls/number_string_format.rs +1 -8
- package/src/rust/components/type_icon.rs +1 -4
- package/src/rust/components/viewer.rs +1 -3
- package/src/rust/custom_elements/copy_dropdown.rs +6 -2
- package/src/rust/custom_elements/export_dropdown.rs +6 -2
- package/src/rust/lib.rs +0 -1
- package/src/rust/renderer.rs +13 -3
- package/src/rust/session/metadata.rs +11 -1
- package/src/rust/session.rs +14 -1
- package/src/themes/botanical.css +2 -0
- package/src/themes/dracula.css +2 -0
- package/src/themes/gruvbox-dark.css +2 -0
- package/src/themes/monokai.css +2 -0
- package/src/themes/phosphor.css +2 -0
- package/src/themes/pro-dark.css +2 -0
- package/src/themes/vaporwave.css +2 -0
- package/tsconfig.json +1 -1
- package/src/rust/components/style/style_cache.rs +0 -136
- /package/dist/wasm/snippets/{perspective-viewer-3cd58f0374935772 → perspective-viewer-93064d0d79855d97}/inline0.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-3cd58f0374935772 → perspective-viewer-93064d0d79855d97}/inline1.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-3cd58f0374935772 → perspective-viewer-93064d0d79855d97}/inline2.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-3cd58f0374935772 → perspective-viewer-93064d0d79855d97}/inline3.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-3cd58f0374935772 → perspective-viewer-93064d0d79855d97}/inline4.js +0 -0
|
@@ -1,136 +0,0 @@
|
|
|
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
|
-
use std::cell::RefCell;
|
|
14
|
-
use std::collections::{BTreeMap, BTreeSet};
|
|
15
|
-
use std::ops::Deref;
|
|
16
|
-
use std::rc::Rc;
|
|
17
|
-
|
|
18
|
-
use wasm_bindgen::JsCast;
|
|
19
|
-
|
|
20
|
-
use crate::*;
|
|
21
|
-
|
|
22
|
-
type CSSResource = (&'static str, &'static str);
|
|
23
|
-
|
|
24
|
-
/// A dictionary of CSS fragments for native HTML elements which should always
|
|
25
|
-
/// be loaded (and perhaps lack yew components wrappers from which to have
|
|
26
|
-
/// their styles registered).
|
|
27
|
-
static DOM_STYLES: &[CSSResource] = &[
|
|
28
|
-
css!("dom/checkbox"),
|
|
29
|
-
css!("dom/scrollbar"),
|
|
30
|
-
css!("dom/select"),
|
|
31
|
-
];
|
|
32
|
-
|
|
33
|
-
thread_local! {
|
|
34
|
-
/// Cache of `CssStyleSheet` objects, which can safely be re-used across
|
|
35
|
-
/// `HTMLPerspectiveViewerElement` instances
|
|
36
|
-
static STYLE_SHEET_CACHE: RefCell<BTreeMap<&'static str, web_sys::CssStyleSheet>> = RefCell::new(
|
|
37
|
-
DOM_STYLES
|
|
38
|
-
.iter()
|
|
39
|
-
.map(|x| (x.0, StyleCache::into_style(x.1)))
|
|
40
|
-
.collect(),
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/// A state object for `<style>` snippets used by a yew `Component` with a
|
|
45
|
-
/// `<StyleProvider>` at the root.
|
|
46
|
-
#[derive(Clone)]
|
|
47
|
-
pub struct StyleCache(Rc<StyleCacheData>);
|
|
48
|
-
|
|
49
|
-
impl Deref for StyleCache {
|
|
50
|
-
type Target = StyleCacheData;
|
|
51
|
-
|
|
52
|
-
fn deref(&self) -> &Self::Target {
|
|
53
|
-
&self.0
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
impl PartialEq for StyleCache {
|
|
58
|
-
fn eq(&self, _other: &Self) -> bool {
|
|
59
|
-
true
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
impl StyleCache {
|
|
64
|
-
pub fn new(is_shadow: bool, elem: &web_sys::HtmlElement) -> StyleCache {
|
|
65
|
-
StyleCache(Rc::new(StyleCacheData::new(is_shadow, elem)))
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/// Insert a new stylesheet into this manager, _immediately_ inserting it
|
|
69
|
-
/// into the DOM as well if any other elements are already connected,
|
|
70
|
-
/// bypassing yew rendering; when the yew `Component::view` method is
|
|
71
|
-
/// later invoked, this element will get re-attached to the same parent
|
|
72
|
-
/// (though likely in a different order).
|
|
73
|
-
///
|
|
74
|
-
/// This is done synchronously because CSS registration occurs during
|
|
75
|
-
/// the `create` lifecycle phase, and we want these style elements to be
|
|
76
|
-
/// attached _before_ the style's target nodes are attached.
|
|
77
|
-
pub fn add_style(&self, name: &'static str, css: &'static str) {
|
|
78
|
-
let mut map = self.0.styles.borrow_mut();
|
|
79
|
-
STYLE_SHEET_CACHE.with_borrow_mut(|cache| {
|
|
80
|
-
if !map.contains(name) {
|
|
81
|
-
map.insert(name);
|
|
82
|
-
if !cache.contains_key(name) {
|
|
83
|
-
let style = Self::into_style(css);
|
|
84
|
-
cache.insert(name, style);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
self.adopted_style_sheets.splice(
|
|
88
|
-
map.iter().position(|x| x == &name).unwrap() as u32,
|
|
89
|
-
0,
|
|
90
|
-
cache.get(name).unwrap(),
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/// Concert a CSS string to an `HtmlStyleElement`, which are memoized due
|
|
97
|
-
/// to their size and DOM performance impact.
|
|
98
|
-
fn into_style(css: &str) -> web_sys::CssStyleSheet {
|
|
99
|
-
let sheet = web_sys::CssStyleSheet::new().unwrap();
|
|
100
|
-
sheet.replace_sync(css).unwrap();
|
|
101
|
-
sheet
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/// Using a `BTreeMap` so the resulting `<style>` elements have a stable order
|
|
106
|
-
/// when rendered to the DOM.
|
|
107
|
-
pub struct StyleCacheData {
|
|
108
|
-
styles: RefCell<BTreeSet<&'static str>>,
|
|
109
|
-
adopted_style_sheets: js_sys::Array,
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
impl StyleCacheData {
|
|
113
|
-
fn new(is_shadow: bool, elem: &web_sys::HtmlElement) -> Self {
|
|
114
|
-
let styles: RefCell<BTreeSet<&'static str>> =
|
|
115
|
-
RefCell::new(DOM_STYLES.iter().map(|x| x.0).collect());
|
|
116
|
-
|
|
117
|
-
let root: &JsValue = if is_shadow {
|
|
118
|
-
&elem.shadow_root().unwrap()
|
|
119
|
-
} else {
|
|
120
|
-
&web_sys::window().unwrap().document().unwrap()
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
let adopted_style_sheets = js_sys::Reflect::get(root, &"adoptedStyleSheets".into())
|
|
124
|
-
.unwrap()
|
|
125
|
-
.unchecked_into::<js_sys::Array>();
|
|
126
|
-
|
|
127
|
-
for name in styles.borrow().iter() {
|
|
128
|
-
STYLE_SHEET_CACHE.with_borrow(|x| adopted_style_sheets.push(x.get(name).unwrap()));
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
Self {
|
|
132
|
-
styles,
|
|
133
|
-
adopted_style_sheets,
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|