@perspective-dev/viewer 4.1.0 → 4.2.0
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 +2 -2
- package/dist/cdn/perspective-viewer.js.map +4 -4
- package/dist/css/dracula.css +1 -1
- package/dist/css/gruvbox-dark.css +1 -1
- package/dist/css/gruvbox.css +1 -1
- package/dist/css/solarized.css +1 -1
- package/dist/css/vaporwave.css +1 -1
- package/dist/esm/perspective-viewer.inline.js +2 -2
- package/dist/esm/perspective-viewer.inline.js.map +4 -4
- package/dist/esm/perspective-viewer.js +2 -2
- package/dist/esm/perspective-viewer.js.map +4 -4
- package/dist/wasm/perspective-viewer.d.ts +1403 -1319
- package/dist/wasm/perspective-viewer.js +3573 -3318
- package/dist/wasm/perspective-viewer.wasm +0 -0
- package/dist/wasm/perspective-viewer.wasm.d.ts +111 -99
- package/package.json +2 -2
- package/src/rust/components/column_dropdown.rs +8 -8
- package/src/rust/components/column_selector/filter_column.rs +12 -12
- package/src/rust/components/column_settings_sidebar/style_tab/symbol/row_selector.rs +5 -5
- package/src/rust/components/column_settings_sidebar.rs +2 -4
- package/src/rust/components/containers/dragdrop_list.rs +5 -4
- package/src/rust/components/containers/select.rs +6 -6
- package/src/rust/components/filter_dropdown.rs +8 -8
- package/src/rust/components/function_dropdown.rs +8 -8
- package/src/rust/components/modal.rs +4 -4
- package/src/rust/custom_elements/filter_dropdown.rs +4 -4
- package/src/rust/custom_elements/viewer.rs +21 -20
- package/src/rust/model/copy_export.rs +2 -1
- package/src/rust/presentation/sheets.rs +4 -1
- package/src/rust/presentation.rs +4 -4
- /package/dist/wasm/snippets/{perspective-viewer-0d326a25c1022412 → perspective-viewer-1586156e058be573}/inline0.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-0d326a25c1022412/inline2.js → perspective-viewer-1586156e058be573/inline1.js} +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-0d326a25c1022412/inline1.js → perspective-viewer-1586156e058be573/inline2.js} +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-0d326a25c1022412 → perspective-viewer-1586156e058be573}/inline3.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-0d326a25c1022412 → perspective-viewer-1586156e058be573}/inline4.js +0 -0
|
@@ -77,9 +77,6 @@ pub struct PerspectiveViewerElement {
|
|
|
77
77
|
_subscriptions: Rc<[Subscription; 2]>,
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
// derive_model!( Renderer, Root, Session, Presentation for
|
|
81
|
-
// PerspectiveViewerElement);
|
|
82
|
-
|
|
83
80
|
impl CustomElementMetadata for PerspectiveViewerElement {
|
|
84
81
|
const CUSTOM_ELEMENT_NAME: &'static str = "perspective-viewer";
|
|
85
82
|
const STATICS: &'static [&'static str] = ["registerPlugin", "getExprTKCommands"].as_slice();
|
|
@@ -124,7 +121,13 @@ impl PerspectiveViewerElement {
|
|
|
124
121
|
clone!(renderer, session);
|
|
125
122
|
move |_| {
|
|
126
123
|
clone!(renderer, session);
|
|
127
|
-
ApiFuture::spawn(async move {
|
|
124
|
+
ApiFuture::spawn(async move {
|
|
125
|
+
renderer
|
|
126
|
+
.update(session.get_view())
|
|
127
|
+
.await
|
|
128
|
+
.ignore_view_delete()
|
|
129
|
+
.map(|_| ())
|
|
130
|
+
})
|
|
128
131
|
}
|
|
129
132
|
});
|
|
130
133
|
|
|
@@ -256,7 +259,7 @@ impl PerspectiveViewerElement {
|
|
|
256
259
|
self.session.update_view_config(config)?;
|
|
257
260
|
|
|
258
261
|
clone!(self.renderer, self.session);
|
|
259
|
-
Ok(ApiFuture::
|
|
262
|
+
Ok(ApiFuture::new_throttled(async move {
|
|
260
263
|
let task = async {
|
|
261
264
|
// Ignore this error, which is blown away by the table anyway.
|
|
262
265
|
let _ = task.await;
|
|
@@ -340,9 +343,9 @@ impl PerspectiveViewerElement {
|
|
|
340
343
|
);
|
|
341
344
|
|
|
342
345
|
std::mem::swap(self, &mut state);
|
|
343
|
-
ApiFuture::
|
|
346
|
+
ApiFuture::new_throttled(state.delete())
|
|
344
347
|
} else {
|
|
345
|
-
ApiFuture::
|
|
348
|
+
ApiFuture::new_throttled(async move { Ok(()) })
|
|
346
349
|
}
|
|
347
350
|
}
|
|
348
351
|
|
|
@@ -481,7 +484,7 @@ impl PerspectiveViewerElement {
|
|
|
481
484
|
/// ```
|
|
482
485
|
pub fn flush(&self) -> ApiFuture<()> {
|
|
483
486
|
clone!(self.renderer);
|
|
484
|
-
ApiFuture::
|
|
487
|
+
ApiFuture::new_throttled(async move {
|
|
485
488
|
// We must let two AFs pass to guarantee listeners to the DOM state
|
|
486
489
|
// have themselves triggered, or else `request_animation_frame`
|
|
487
490
|
// may finish before a `ResizeObserver` triggered before is
|
|
@@ -527,7 +530,7 @@ impl PerspectiveViewerElement {
|
|
|
527
530
|
/// ```
|
|
528
531
|
pub fn restore(&self, update: JsValue) -> ApiFuture<()> {
|
|
529
532
|
let this = self.clone();
|
|
530
|
-
ApiFuture::
|
|
533
|
+
ApiFuture::new_throttled(async move {
|
|
531
534
|
let decoded_update = ViewerConfigUpdate::decode(&update)?;
|
|
532
535
|
tracing::info!("Restoring {}", decoded_update);
|
|
533
536
|
let root = this.root.clone();
|
|
@@ -568,7 +571,7 @@ impl PerspectiveViewerElement {
|
|
|
568
571
|
pub fn resetError(&self) -> ApiFuture<()> {
|
|
569
572
|
ApiFuture::spawn(self.session.reset(ResetOptions::default()));
|
|
570
573
|
let this = self.clone();
|
|
571
|
-
ApiFuture::
|
|
574
|
+
ApiFuture::new_throttled(async move {
|
|
572
575
|
this.update_and_render(ViewConfigUpdate::default())?.await?;
|
|
573
576
|
Ok(())
|
|
574
577
|
})
|
|
@@ -622,7 +625,7 @@ impl PerspectiveViewerElement {
|
|
|
622
625
|
/// ```
|
|
623
626
|
pub fn download(&self, method: Option<JsString>) -> ApiFuture<()> {
|
|
624
627
|
let this = self.clone();
|
|
625
|
-
ApiFuture::
|
|
628
|
+
ApiFuture::new_throttled(async move {
|
|
626
629
|
let method = if let Some(method) = method
|
|
627
630
|
.map(|x| x.unchecked_into())
|
|
628
631
|
.map(serde_wasm_bindgen::from_value)
|
|
@@ -692,7 +695,7 @@ impl PerspectiveViewerElement {
|
|
|
692
695
|
/// ```
|
|
693
696
|
pub fn copy(&self, method: Option<JsString>) -> ApiFuture<()> {
|
|
694
697
|
let this = self.clone();
|
|
695
|
-
ApiFuture::
|
|
698
|
+
ApiFuture::new_throttled(async move {
|
|
696
699
|
let method = if let Some(method) = method
|
|
697
700
|
.map(|x| x.unchecked_into())
|
|
698
701
|
.map(serde_wasm_bindgen::from_value)
|
|
@@ -723,7 +726,7 @@ impl PerspectiveViewerElement {
|
|
|
723
726
|
tracing::debug!("Resetting config");
|
|
724
727
|
let root = self.root.clone();
|
|
725
728
|
let all = reset_all.unwrap_or_default();
|
|
726
|
-
ApiFuture::
|
|
729
|
+
ApiFuture::new_throttled(async move {
|
|
727
730
|
let (sender, receiver) = channel::<()>();
|
|
728
731
|
root.borrow()
|
|
729
732
|
.as_ref()
|
|
@@ -763,7 +766,7 @@ impl PerspectiveViewerElement {
|
|
|
763
766
|
}
|
|
764
767
|
|
|
765
768
|
let state = self.clone_state();
|
|
766
|
-
ApiFuture::
|
|
769
|
+
ApiFuture::new_throttled(async move {
|
|
767
770
|
if !state.renderer().is_plugin_activated()? {
|
|
768
771
|
state
|
|
769
772
|
.update_and_render(ViewConfigUpdate::default())?
|
|
@@ -933,10 +936,8 @@ impl PerspectiveViewerElement {
|
|
|
933
936
|
.cloned();
|
|
934
937
|
|
|
935
938
|
changed = presentation.set_theme_name(reset_theme.as_deref()).await? || changed;
|
|
936
|
-
if changed {
|
|
937
|
-
|
|
938
|
-
return renderer.restyle_all(&view).await;
|
|
939
|
-
}
|
|
939
|
+
if changed && let Some(view) = session.get_view() {
|
|
940
|
+
return renderer.restyle_all(&view).await;
|
|
940
941
|
}
|
|
941
942
|
|
|
942
943
|
Ok(JsValue::UNDEFINED)
|
|
@@ -1031,7 +1032,7 @@ impl PerspectiveViewerElement {
|
|
|
1031
1032
|
#[wasm_bindgen]
|
|
1032
1033
|
pub fn toggleColumnSettings(&self, column_name: String) -> ApiFuture<()> {
|
|
1033
1034
|
clone!(self.session, self.root);
|
|
1034
|
-
ApiFuture::
|
|
1035
|
+
ApiFuture::new_throttled(async move {
|
|
1035
1036
|
let locator = session.get_column_locator(Some(column_name));
|
|
1036
1037
|
let (sender, receiver) = channel::<()>();
|
|
1037
1038
|
root.borrow().as_ref().into_apierror()?.send_message(
|
|
@@ -1056,7 +1057,7 @@ impl PerspectiveViewerElement {
|
|
|
1056
1057
|
) -> ApiFuture<()> {
|
|
1057
1058
|
let locator = self.get_column_locator(column_name);
|
|
1058
1059
|
clone!(self.root);
|
|
1059
|
-
ApiFuture::
|
|
1060
|
+
ApiFuture::new_throttled(async move {
|
|
1060
1061
|
let (sender, receiver) = channel::<()>();
|
|
1061
1062
|
root.borrow().as_ref().into_apierror()?.send_message(
|
|
1062
1063
|
PerspectiveViewerMsg::OpenColumnSettings {
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
use std::collections::HashSet;
|
|
14
14
|
|
|
15
|
+
use base64::prelude::*;
|
|
15
16
|
use futures::join;
|
|
16
17
|
use itertools::Itertools;
|
|
17
18
|
use perspective_client::ViewWindow;
|
|
@@ -59,7 +60,7 @@ pub trait CopyExportModel:
|
|
|
59
60
|
let mut config = config?;
|
|
60
61
|
config.settings = false;
|
|
61
62
|
let js_config = serde_json::to_string(&config)?;
|
|
62
|
-
let html = export_app::render(&
|
|
63
|
+
let html = export_app::render(&BASE64_STANDARD.encode(arrow), &js_config, &plugins);
|
|
63
64
|
Ok(js_sys::JsString::from(html.trim()).into())
|
|
64
65
|
}
|
|
65
66
|
|
|
@@ -46,7 +46,10 @@ fn fill_rule_theme_names(
|
|
|
46
46
|
if property == "--theme-name" {
|
|
47
47
|
let name = style.get_property_value("--theme-name")?;
|
|
48
48
|
let trimmed = name.trim();
|
|
49
|
-
|
|
49
|
+
let theme = &trimmed[1..trimmed.len() - 1];
|
|
50
|
+
if themes.iter().find(|x| x == &theme).is_none() {
|
|
51
|
+
themes.push(theme.to_owned());
|
|
52
|
+
}
|
|
50
53
|
}
|
|
51
54
|
}
|
|
52
55
|
}
|
package/src/rust/presentation.rs
CHANGED
|
@@ -243,10 +243,10 @@ impl Presentation {
|
|
|
243
243
|
/// A `bool` indicating whether the internal state changed.
|
|
244
244
|
pub async fn set_theme_name(&self, theme: Option<&str>) -> ApiResult<bool> {
|
|
245
245
|
let (themes, selected) = self.get_selected_theme_config().await?;
|
|
246
|
-
if let Some(x) = selected
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
246
|
+
if let Some(x) = selected
|
|
247
|
+
&& themes.get(x).map(|x| x.as_str()) == theme
|
|
248
|
+
{
|
|
249
|
+
return Ok(false);
|
|
250
250
|
}
|
|
251
251
|
|
|
252
252
|
let index = if let Some(theme) = theme {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|