@perspective-dev/viewer 4.4.0 → 4.4.1

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.
Files changed (55) hide show
  1. package/dist/cdn/perspective-viewer.js +2 -2
  2. package/dist/cdn/perspective-viewer.js.map +4 -4
  3. package/dist/css/botanical.css +1 -1
  4. package/dist/css/dracula.css +1 -1
  5. package/dist/css/gruvbox-dark.css +1 -1
  6. package/dist/css/gruvbox.css +1 -1
  7. package/dist/css/icons.css +1 -1
  8. package/dist/css/monokai.css +1 -1
  9. package/dist/css/phosphor.css +1 -0
  10. package/dist/css/pro-dark.css +1 -1
  11. package/dist/css/pro.css +1 -1
  12. package/dist/css/solarized-dark.css +1 -1
  13. package/dist/css/solarized.css +1 -1
  14. package/dist/css/themes.css +1 -1
  15. package/dist/css/vaporwave.css +1 -1
  16. package/dist/esm/extensions.d.ts +4 -0
  17. package/dist/esm/perspective-viewer.d.ts +1 -0
  18. package/dist/esm/perspective-viewer.inline.js +2 -2
  19. package/dist/esm/perspective-viewer.inline.js.map +4 -4
  20. package/dist/esm/perspective-viewer.js +2 -2
  21. package/dist/esm/perspective-viewer.js.map +4 -4
  22. package/dist/esm/plugin.d.ts +9 -9
  23. package/dist/esm/ts-rs/NumberForegroundMode.d.ts +1 -1
  24. package/dist/esm/ts-rs/ViewerConfig.d.ts +36 -0
  25. package/dist/wasm/perspective-viewer.d.ts +24 -19
  26. package/dist/wasm/perspective-viewer.js +106 -86
  27. package/dist/wasm/perspective-viewer.wasm +0 -0
  28. package/dist/wasm/perspective-viewer.wasm.d.ts +15 -15
  29. package/package.json +1 -1
  30. package/src/css/column-settings-panel.css +1 -0
  31. package/src/css/status-bar.css +1 -1
  32. package/src/rust/components/number_column_style.rs +8 -0
  33. package/src/rust/components/viewer.rs +0 -1
  34. package/src/rust/config/number_column_style.rs +5 -1
  35. package/src/rust/config/viewer_config.rs +2 -2
  36. package/src/rust/custom_elements/debug_plugin.rs +4 -4
  37. package/src/rust/custom_elements/viewer.rs +15 -4
  38. package/src/rust/lib.rs +5 -0
  39. package/src/rust/renderer.rs +10 -5
  40. package/src/rust/tasks/restore_and_render.rs +4 -3
  41. package/src/svg/datagrid-select-row-tree.svg +13 -0
  42. package/src/themes/defaults.css +18 -0
  43. package/src/themes/icons.css +1 -18
  44. package/src/themes/phosphor.css +184 -0
  45. package/src/themes/themes.css +1 -0
  46. package/src/ts/extensions.ts +8 -1
  47. package/src/ts/perspective-viewer.ts +1 -0
  48. package/src/ts/plugin.ts +9 -9
  49. package/src/ts/ts-rs/NumberForegroundMode.ts +1 -1
  50. package/src/ts/ts-rs/ViewerConfig.ts +15 -0
  51. /package/dist/wasm/snippets/{perspective-viewer-68fef752754ffbc6 → perspective-viewer-d924246f0b4a3dce}/inline0.js +0 -0
  52. /package/dist/wasm/snippets/{perspective-viewer-68fef752754ffbc6 → perspective-viewer-d924246f0b4a3dce}/inline1.js +0 -0
  53. /package/dist/wasm/snippets/{perspective-viewer-68fef752754ffbc6 → perspective-viewer-d924246f0b4a3dce}/inline2.js +0 -0
  54. /package/dist/wasm/snippets/{perspective-viewer-68fef752754ffbc6 → perspective-viewer-d924246f0b4a3dce}/inline3.js +0 -0
  55. /package/dist/wasm/snippets/{perspective-viewer-68fef752754ffbc6 → perspective-viewer-d924246f0b4a3dce}/inline4.js +0 -0
@@ -97,12 +97,12 @@ impl PerspectiveDebugPluginElement {
97
97
  ApiFuture::default()
98
98
  }
99
99
 
100
- pub fn save(&self) -> ApiFuture<()> {
101
- ApiFuture::default()
100
+ pub fn save(&self) -> ApiResult<JsValue> {
101
+ Ok(JsValue::null())
102
102
  }
103
103
 
104
- pub fn restore(&self) -> ApiFuture<()> {
105
- ApiFuture::default()
104
+ pub fn restore(&self, _config: Option<JsValue>) -> ApiResult<()> {
105
+ Ok(())
106
106
  }
107
107
 
108
108
  pub fn delete(&self) -> ApiFuture<()> {
@@ -39,6 +39,15 @@ use crate::tasks::*;
39
39
  use crate::utils::*;
40
40
  use crate::*;
41
41
 
42
+ #[wasm_bindgen]
43
+ extern "C" {
44
+ #[wasm_bindgen(typescript_type = "Promise<ViewerConfig>")]
45
+ pub type JsViewerConfigPromise;
46
+
47
+ #[wasm_bindgen(typescript_type = "ViewerConfigUpdate")]
48
+ pub type JsViewerConfigUpdate;
49
+ }
50
+
42
51
  #[derive(serde::Deserialize, Default)]
43
52
  struct ResizeOptions {
44
53
  dimensions: Option<ResizeDimensions>,
@@ -563,7 +572,7 @@ impl PerspectiveViewerElement {
563
572
  /// ```javascript
564
573
  /// await viewer.restore({group_by: ["State"]});
565
574
  /// ```
566
- pub fn restore(&self, update: JsValue) -> ApiFuture<()> {
575
+ pub fn restore(&self, update: JsViewerConfigUpdate) -> ApiFuture<()> {
567
576
  let this = self.clone();
568
577
  ApiFuture::new_throttled(async move {
569
578
  let decoded_update = ViewerConfigUpdate::decode(&update)?;
@@ -646,9 +655,9 @@ impl PerspectiveViewerElement {
646
655
  /// await viewer.restore(token);
647
656
  /// });
648
657
  /// ```
649
- pub fn save(&self) -> ApiFuture<JsValue> {
658
+ pub fn save(&self) -> JsViewerConfigPromise {
650
659
  let this = self.clone();
651
- ApiFuture::new(async move {
660
+ let fut = ApiFuture::new(async move {
652
661
  let viewer_config = this
653
662
  .renderer
654
663
  .clone()
@@ -656,7 +665,9 @@ impl PerspectiveViewerElement {
656
665
  .await?;
657
666
 
658
667
  viewer_config.encode()
659
- })
668
+ });
669
+
670
+ js_sys::Promise::from(fut).unchecked_into()
660
671
  }
661
672
 
662
673
  /// Download this viewer's internal [`View`] data via a browser download
package/src/rust/lib.rs CHANGED
@@ -73,6 +73,11 @@ import type {
73
73
  ViewConfigUpdate,
74
74
  SystemInfo,
75
75
  } from "@perspective-dev/client";
76
+
77
+ export type * from "../../src/ts/ts-rs/ViewerConfig.d.ts";
78
+ export type * from "../../src/ts/ts-rs/ViewerConfigUpdate.d.ts";
79
+ import type {ViewerConfig} from "../../src/ts/ts-rs/ViewerConfig.d.ts";
80
+ import type {ViewerConfigUpdate} from "../../src/ts/ts-rs/ViewerConfigUpdate.d.ts";
76
81
  "#;
77
82
 
78
83
  /// Register a plugin globally.
@@ -35,7 +35,7 @@ use futures::future::{join_all, select_all};
35
35
  use perspective_client::utils::*;
36
36
  use perspective_client::{View, ViewWindow};
37
37
  use perspective_js::json;
38
- use perspective_js::utils::ApiResult;
38
+ use perspective_js::utils::{ApiResult, ResultTApiErrorExt};
39
39
  use wasm_bindgen::prelude::*;
40
40
  use web_sys::*;
41
41
  use yew::html::ImplicitClone;
@@ -246,7 +246,7 @@ impl Renderer {
246
246
  PluginUpdate::Update(plugin) => plugin,
247
247
  };
248
248
 
249
- let idx = self.find_plugin_idx(name).expect("f");
249
+ let idx = self.find_plugin_idx(name)?;
250
250
  let changed = !matches!(
251
251
  self.0.borrow().plugins_idx,
252
252
  Some(selected_idx) if selected_idx == idx
@@ -403,13 +403,18 @@ impl Renderer {
403
403
  if let Some(cb) = self.0.on_render_limits_changed.borrow().as_ref() {
404
404
  cb.emit(limits);
405
405
  }
406
+
406
407
  let viewer_elem = &self.0.borrow().viewer_elem.clone();
407
- if is_update {
408
+ let result = if is_update {
408
409
  let task = plugin.update(view.clone().into(), limits.max_cols, limits.max_rows, false);
409
- activate_plugin(viewer_elem, &plugin, task).await?;
410
+ activate_plugin(viewer_elem, &plugin, task).await
410
411
  } else {
411
412
  let task = plugin.draw(view.clone().into(), limits.max_cols, limits.max_rows, false);
412
- activate_plugin(viewer_elem, &plugin, task).await?;
413
+ activate_plugin(viewer_elem, &plugin, task).await
414
+ };
415
+
416
+ if let Err(error) = result.ignore_view_delete() {
417
+ tracing::warn!("{}", error);
413
418
  }
414
419
 
415
420
  remove_inactive_plugin(
@@ -104,11 +104,12 @@ pub trait RestoreAndRender: HasRenderer + HasSession + HasPresentation {
104
104
 
105
105
  // TODO this should be part of the API for `draw()` above, such that
106
106
  // the plugin need not render twice when a theme is provided.
107
- if needs_restyle && presentation.is_visible() {
108
- let view = session.get_view().into_apierror()?;
107
+ if needs_restyle
108
+ && presentation.is_visible()
109
+ && let Some(view) = session.get_view()
110
+ {
109
111
  renderer.restyle_all(&view).await?;
110
112
  }
111
- // }
112
113
 
113
114
  Ok(())
114
115
  })
@@ -0,0 +1,13 @@
1
+ <svg width="21" height="21" viewBox="0 0 21 21" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <defs></defs>
3
+ <rect x="3" y="4" width="15" height="1" style="fill: rgb(216, 216, 216); stroke: rgb(0, 0, 0); stroke-width: 0px;">
4
+ </rect>
5
+ <rect x="5" y="6.973" width="13" height="4"
6
+ style="fill: rgb(216, 216, 216); stroke: rgb(0, 0, 0); stroke-width: 0px;"></rect>
7
+ <rect x="7" y="10" width="11" height="1" style="fill: rgb(216, 216, 216); stroke: rgb(0, 0, 0); stroke-width: 0px;">
8
+ </rect>
9
+ <rect x="5" y="13" width="13" height="1" style="fill: rgb(216, 216, 216); stroke: rgb(0, 0, 0); stroke-width: 0px;">
10
+ </rect>
11
+ <rect x="3" y="16" width="15" height="1" style="fill: rgb(216, 216, 216); stroke: rgb(0, 0, 0); stroke-width: 0px;">
12
+ </rect>
13
+ </svg>
@@ -22,6 +22,24 @@ perspective-date-column-style,
22
22
  perspective-datetime-column-style,
23
23
  perspective-number-column-style,
24
24
  perspective-string-column-style {
25
+ /* Colors */
26
+ --psp--color: #161616;
27
+
28
+ color: var(--psp--color);
29
+ background-color: transparent;
30
+
31
+ --psp-inactive--color: #ababab;
32
+ --psp-inactive--border-color: #dadada;
33
+ --psp-active--color: #2670a9;
34
+ --psp-error--color: #ff471e;
35
+ --psp--background-color: #ffffff;
36
+ --psp-icon-overflow-hint--color: rgba(0, 0, 0, 0.2);
37
+ --psp-select--background-color: none;
38
+ --psp-warning--background: #042121;
39
+ --psp-warning--color: #fdfffd;
40
+
41
+ /* TODO deprecate me */
42
+ --psp-icon-overflow-hint--color: #fdfffd;
25
43
  /* Colors */
26
44
  --psp-placeholder--background: #8b868045;
27
45
 
@@ -90,24 +90,6 @@ perspective-string-column-style {
90
90
  --psp-plugin-selector--y-scatter--content: url(../svg/mega-menu-icons-y-scatter.svg);
91
91
  --psp-plugin-selector--datagrid--content: url(../svg/mega-menu-icons-datagrid.svg);
92
92
 
93
- /* Colors */
94
- color: #161616;
95
- background-color: transparent;
96
- --psp--color: #161616;
97
- --psp-inactive--color: #ababab;
98
- --psp-inactive--border-color: #dadada;
99
-
100
- --psp-active--color: #2670a9;
101
- --psp-error--color: #ff471e;
102
- --psp--background-color: #ffffff;
103
- --psp-icon-overflow-hint--color: rgba(0, 0, 0, 0.2);
104
- --psp-select--background-color: none;
105
- --psp-warning--background: #042121;
106
- --psp-warning--color: #fdfffd;
107
-
108
- /* TODO deprecate me */
109
- --psp-icon-overflow-hint--color: #fdfffd;
110
-
111
93
  /* Datagrid */
112
94
  /* `regular-table` icons */
113
95
  --psp-label--column-style-open-button--content: "style";
@@ -121,4 +103,5 @@ perspective-string-column-style {
121
103
  --psp-toolbar-edit-mode-select-row--content: url("../svg/datagrid-select-row.svg");
122
104
  --psp-toolbar-edit-mode-select-column--content: url("../svg/datagrid-select-column.svg");
123
105
  --psp-toolbar-edit-mode-select-region--content: url("../svg/datagrid-select-region.svg");
106
+ --psp-toolbar-edit-mode-select-row-tree--content: url("../svg/datagrid-select-row-tree.svg");
124
107
  }
@@ -0,0 +1,184 @@
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 "./defaults.css";
14
+
15
+ perspective-viewer,
16
+ perspective-viewer[theme="Phosphor"] {
17
+ --psp-theme-name: "Phosphor";
18
+ }
19
+
20
+ perspective-viewer[theme="Phosphor"] {
21
+ /* perspective-viewer-phosphor--colors */
22
+ --theme-bg0: #0a0a0a;
23
+ --theme-bg1: #0d0d0d;
24
+ --theme-bg2: #1a1a1a;
25
+
26
+ --theme-green-bright: #00ff41;
27
+ --theme-green-mid: #20cc20;
28
+ --theme-green-dim: #0d660d;
29
+ --theme-green-dark: #0a3a0a;
30
+ --theme-amber: #ffb000;
31
+ --theme-red: #ff3333;
32
+
33
+ color: var(--theme-green-mid);
34
+ background-color: var(--theme-bg0);
35
+ --psp--color: var(--theme-green-mid);
36
+ --psp-active--color: var(--theme-green-bright);
37
+ --psp-error--color: var(--theme-red);
38
+ --psp-inactive--color: var(--theme-green-dark);
39
+ --psp-inactive--border-color: var(--theme-green-dark);
40
+ --psp--background-color: var(--theme-bg1);
41
+ --psp-active--background: rgba(51, 255, 51, 0.3);
42
+ --psp-expression--operator--color: var(--theme-green-dim);
43
+ --psp-expression--function--color: var(--theme-green-bright);
44
+ --psp-expression--psp-error--color: var(--theme-red);
45
+ --psp-calendar--filter: invert(1) hue-rotate(70deg);
46
+ --psp-warning--color: var(--theme-bg0);
47
+ --psp-warning--background: var(--theme-amber);
48
+
49
+ --psp-icon--select-arrow--mask-image: var(
50
+ --psp-icon--select-arrow-light--mask-image
51
+ );
52
+
53
+ --psp-icon--select-arrow-hover--mask-image: var(
54
+ --psp-icon--select-arrow-dark--mask-image
55
+ );
56
+
57
+ /* Syntax */
58
+ --psp-code-editor--symbol--color: var(--theme-green-mid);
59
+ --psp-code-editor--literal--color: var(--theme-green-bright);
60
+ --psp-code-editor--operator--color: var(--theme-amber);
61
+ --psp-code-editor--comment--color: var(--theme-green-dark);
62
+ --psp-code-editor--column--color: var(--theme-green-bright);
63
+
64
+ --psp-status-icon--connected--color: var(--theme-green-bright);
65
+ --psp-status-icon--initializing--color: var(--theme-amber);
66
+ --psp-status-icon--psp-error--color: var(--theme-red);
67
+
68
+ /* perspective-viewer-phosphor--animation */
69
+ --psp-status-icon--updating-keyframes-start--filter: opacity(1);
70
+ --psp-status-icon--updating-keyframes-end--filter: opacity(0);
71
+ --psp-status-icon--updating-keyframes-start--transform: scale(1);
72
+ --psp-status-icon--updating-keyframes-end--transform: scale(0.8);
73
+ --psp-status-icon--keyframes-start--transform: scale(1.1);
74
+ --psp-status-icon--keyframes-end--transform: scale(1);
75
+
76
+ /* perspective-viewer-phosphor--datagrid */
77
+ --psp-datagrid--pos-cell--color: var(--theme-green-bright);
78
+ --psp-datagrid--neg-cell--color: var(--theme-red);
79
+
80
+ /* perspective-viewer-phosphor--d3fc */
81
+ --psp-d3fc--legend--color: var(--theme-green-mid);
82
+ --psp-d3fc--treemap--labels: var(--theme-green-mid);
83
+ --psp-d3fc--treemap--hover-highlight: #ff6600;
84
+ --psp-d3fc--tooltip--color: var(--theme-green-mid);
85
+ --psp-d3fc--axis-ticks--color: var(--theme-green-mid);
86
+ --psp-d3fc--axis-lines--color: var(--theme-green-dim);
87
+ --psp-d3fc--gridline--color: var(--theme-green-dark);
88
+ --psp-d3fc--tooltip--background: var(--theme-green-dark);
89
+ --psp-d3fc--tooltip--border-color: var(--theme-green-bright);
90
+ --psp-d3fc--legend--background: var(--psp--background-color);
91
+
92
+ --psp-d3fc--series--color: #00ff41;
93
+ --psp-d3fc--series-1--color: #00ff41;
94
+ --psp-d3fc--series-2--color: #00bfff;
95
+ --psp-d3fc--series-3--color: #ff0055;
96
+ --psp-d3fc--series-4--color: #ffd700;
97
+ --psp-d3fc--series-5--color: #7fffd4;
98
+
99
+ --psp-d3fc--full-gradient--background: linear-gradient(
100
+ #ff3333 0%,
101
+ #1a1a2e 50%,
102
+ #00cc66 100%
103
+ );
104
+
105
+ --psp-d3fc--pos-gradient--background: linear-gradient(
106
+ #1a1a2e 0%,
107
+ #00cc66 100%
108
+ );
109
+ --psp-d3fc--neg-gradient--background: linear-gradient(
110
+ #ff3333 0%,
111
+ #1a1a2e 100%
112
+ );
113
+
114
+ /* OpenLayers */
115
+ --psp-openlayers--tile-url: "http://{a-c}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png";
116
+ --psp-openlayers--attribution--filter: invert(1) hue-rotate(180deg);
117
+ --psp-openlayers--element--background: #1a1a2e;
118
+ --psp-openlayers--category-1--color: #ff6600;
119
+ --psp-openlayers--category-2--color: #33ccff;
120
+ --psp-openlayers--category-3--color: #00cc66;
121
+ --psp-openlayers--category-4--color: #ffcc00;
122
+ --psp-openlayers--category-5--color: #ff3333;
123
+ --psp-openlayers--category-6--color: #cc66ff;
124
+ --psp-openlayers--category-7--color: #ff9933;
125
+ --psp-openlayers--category-8--color: #66ffcc;
126
+ --psp-openlayers--category-9--color: #ff6699;
127
+ --psp-openlayers--category-10--color: #99ccff;
128
+ --psp-openlayers--gradient--background: linear-gradient(
129
+ #ff3333 0%,
130
+ #1a1a2e 50%,
131
+ #00cc66 100%
132
+ );
133
+ }
134
+
135
+ perspective-copy-menu[theme="Phosphor"],
136
+ perspective-export-menu[theme="Phosphor"],
137
+ perspective-dropdown[theme="Phosphor"],
138
+ perspective-date-column-style[theme="Phosphor"],
139
+ perspective-datetime-column-style[theme="Phosphor"],
140
+ perspective-number-column-style[theme="Phosphor"],
141
+ perspective-string-column-style[theme="Phosphor"] {
142
+ /* perspective-viewer-phosphor--colors */
143
+ --theme-bg0: #0a0a0a;
144
+ --theme-bg1: #0d0d0d;
145
+ --theme-bg2: #1a1a1a;
146
+ --theme-green-bright: #33ff33;
147
+ --theme-green-mid: #20cc20;
148
+ --theme-green-dim: #0d660d;
149
+ --theme-green-dark: #0a3a0a;
150
+ --theme-amber: #ffb000;
151
+ --theme-red: #ff3333;
152
+
153
+ color: var(--theme-green-mid);
154
+ --psp--color: var(--theme-green-mid);
155
+ --psp-active--color: var(--theme-green-bright);
156
+ --psp-error--color: var(--theme-red);
157
+ --psp-inactive--color: var(--theme-green-dark);
158
+ --psp-inactive--border-color: var(--theme-green-dark);
159
+ --psp--background-color: var(--theme-bg1);
160
+ --psp-active--background: rgba(51, 255, 51, 0.3);
161
+ --psp-expression--operator--color: var(--theme-green-dim);
162
+ --psp-expression--function--color: var(--theme-green-bright);
163
+ --psp-expression--psp-error--color: var(--theme-red);
164
+ --psp-calendar--filter: invert(1) hue-rotate(70deg);
165
+ --psp-warning--color: var(--theme-bg0);
166
+ --psp-warning--background: var(--theme-amber);
167
+ --psp-icon--select-arrow--mask-image: var(
168
+ --psp-icon--select-arrow-light--mask-image
169
+ );
170
+ --psp-icon--select-arrow-hover--mask-image: var(
171
+ --psp-icon--select-arrow-dark--mask-image
172
+ );
173
+ --psp-code-editor--symbol--color: var(--theme-green-mid);
174
+ --psp-code-editor--literal--color: var(--theme-green-bright);
175
+ --psp-code-editor--operator--color: var(--theme-amber);
176
+ --psp-code-editor--comment--color: var(--theme-green-dark);
177
+ --psp-code-editor--column--color: var(--theme-green-bright);
178
+ --psp-status-icon--connected--color: var(--theme-green-bright);
179
+ --psp-status-icon--initializing--color: var(--theme-amber);
180
+ --psp-status-icon--psp-error--color: var(--theme-red);
181
+
182
+ background-color: #0a0a0a;
183
+ border: 1px solid #1a3a1a;
184
+ }
@@ -20,3 +20,4 @@
20
20
  @import "./gruvbox-dark.css";
21
21
  @import "./dracula.css";
22
22
  @import "./botanical.css";
23
+ @import "./phosphor.css";
@@ -26,7 +26,6 @@ export class PerspectiveSelectDetail {
26
26
  column_names?: string[];
27
27
  removeConfigs: ViewConfigUpdate[];
28
28
  insertConfigs: ViewConfigUpdate[];
29
-
30
29
  constructor(
31
30
  selected: boolean,
32
31
  row: Record<string, unknown>,
@@ -49,6 +48,7 @@ export class PerspectiveSelectDetail {
49
48
  return this.insertConfigs.flatMap((x) => x.filter ?? []);
50
49
  }
51
50
  }
51
+
52
52
  import type {
53
53
  ExportDropDownMenuElement,
54
54
  CopyDropDownMenuElement,
@@ -190,6 +190,12 @@ export interface PerspectiveViewerElementExt {
190
190
  options?: { signal: AbortSignal },
191
191
  ): void;
192
192
 
193
+ addEventListener(
194
+ name: "perspective-global-filter",
195
+ cb: (e: CustomEvent<PerspectiveSelectEventDetail>) => void,
196
+ options?: { signal: AbortSignal },
197
+ ): void;
198
+
193
199
  addEventListener(
194
200
  name: "perspective-toggle-settings",
195
201
  cb: (e: CustomEvent) => void,
@@ -228,6 +234,7 @@ export interface PerspectiveViewerElementExt {
228
234
 
229
235
  removeEventListener(name: "perspective-click", cb: any): void;
230
236
  removeEventListener(name: "perspective-select", cb: any): void;
237
+ removeEventListener(name: "perspective-global-filter", cb: any): void;
231
238
  removeEventListener(name: "perspective-toggle-settings", cb: any): void;
232
239
  removeEventListener(
233
240
  name: "perspective-toggle-settings-before",
@@ -37,6 +37,7 @@ export { HTMLPerspectiveViewerPluginElement } from "./plugin";
37
37
  export type * from "./extensions.ts";
38
38
  export { PerspectiveSelectDetail } from "./extensions.ts";
39
39
  export type * from "./ts-rs/ViewerConfigUpdate.d.ts";
40
+ export type * from "./ts-rs/ViewerConfig.d.ts";
40
41
  export type * from "./ts-rs/ColumnConfigValues.d.ts";
41
42
  export type * from "./ts-rs/Filter.d.ts";
42
43
  export type * from "./ts-rs/FilterTerm.d.ts";
package/src/ts/plugin.ts CHANGED
@@ -157,13 +157,13 @@ export interface IPerspectiveViewerPlugin {
157
157
  * Like `update()`, but for when the dimensions of the plugin have changed
158
158
  * and the underlying data has not.
159
159
  */
160
- resize(): Promise<void>;
160
+ resize(view: View): Promise<void>;
161
161
 
162
162
  /**
163
163
  * Notify the plugin that the style environment has changed. Useful for
164
164
  * plugins which read CSS styles via `window.getComputedStyle()`.
165
165
  */
166
- restyle(): Promise<void>;
166
+ restyle(view: View): Promise<void>;
167
167
 
168
168
  /**
169
169
  * Save this plugin's state to a JSON-serializable value. While this value
@@ -176,17 +176,17 @@ export interface IPerspectiveViewerPlugin {
176
176
  * reload. For example, `@perspective-dev/viewer-d3fc` uses
177
177
  * `plugin_config` to remember the user-repositionable legend coordinates.
178
178
  */
179
- save(): Promise<any>;
179
+ save(): any;
180
180
 
181
181
  /**
182
182
  * Restore this plugin to a state previously returned by `save()`.
183
183
  */
184
- restore(config: any): Promise<void>;
184
+ restore(config: any): void;
185
185
 
186
186
  /**
187
187
  * Free any resources acquired by this plugin and prepare to be deleted.
188
188
  */
189
- delete(): Promise<void>;
189
+ delete(): void;
190
190
  }
191
191
 
192
192
  /**
@@ -257,19 +257,19 @@ export class HTMLPerspectiveViewerPluginElement
257
257
  this.innerHTML = "";
258
258
  }
259
259
 
260
- async resize(): Promise<void> {
260
+ async resize(view: View): Promise<void> {
261
261
  // Not Implemented
262
262
  }
263
263
 
264
- async restyle(): Promise<void> {
264
+ async restyle(view: View): Promise<void> {
265
265
  // Not Implemented
266
266
  }
267
267
 
268
- async save(): Promise<any> {
268
+ save(): any {
269
269
  // Not Implemented
270
270
  }
271
271
 
272
- async restore(): Promise<void> {
272
+ restore(): void {
273
273
  // Not Implemented
274
274
  }
275
275
 
@@ -1,3 +1,3 @@
1
1
  // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
2
 
3
- export type NumberForegroundMode = "disabled" | "color" | "bar";
3
+ export type NumberForegroundMode = "disabled" | "color" | "bar" | "label-bar";
@@ -0,0 +1,15 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+ import type { Aggregate } from "./Aggregate.js";
3
+ import type { ColumnConfigValues } from "./ColumnConfigValues.js";
4
+ import type { Expressions } from "./Expressions.js";
5
+ import type { Filter } from "./Filter.js";
6
+ import type { FilterReducer } from "./FilterReducer.js";
7
+ import type { GroupRollupMode } from "./GroupRollupMode.js";
8
+ import type { Sort } from "./Sort.js";
9
+ import type { JsonValue } from "./serde_json/JsonValue.js";
10
+
11
+ /**
12
+ * The state of an entire `custom_elements::PerspectiveViewerElement` component
13
+ * and its `Plugin`.
14
+ */
15
+ export type ViewerConfig<V = string> = { version: V, columns_config: { [key in string]?: ColumnConfigValues }, plugin: string, plugin_config: JsonValue, settings: boolean, table: string | null, theme: string | null, title: string | null, group_by: Array<string>, split_by: Array<string>, sort: Array<Sort>, filter: Array<Filter>, group_rollup_mode: GroupRollupMode, filter_op?: FilterReducer, expressions: Expressions, columns: Array<string | null>, aggregates: { [key in string]?: Aggregate }, group_by_depth?: number | null, };