@perspective-dev/viewer 4.5.1 → 5.0.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 +20 -1
- package/dist/cdn/perspective-viewer.js.map +4 -4
- 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/gruvbox.css +1 -1
- package/dist/css/icons.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/pro.css +1 -1
- package/dist/css/solarized-dark.css +1 -1
- package/dist/css/solarized.css +1 -1
- package/dist/css/themes.css +1 -1
- package/dist/css/vaporwave.css +1 -1
- package/dist/esm/extensions.d.ts +22 -3
- package/dist/esm/perspective-viewer.cdn.d.ts +3 -0
- package/dist/esm/perspective-viewer.d.ts +9 -0
- package/dist/esm/perspective-viewer.inline.d.ts +3 -0
- package/dist/esm/perspective-viewer.inline.js +20 -1
- package/dist/esm/perspective-viewer.inline.js.map +4 -4
- package/dist/esm/perspective-viewer.js +20 -1
- package/dist/esm/perspective-viewer.js.map +4 -4
- package/dist/esm/plugin.d.ts +71 -5
- package/dist/esm/ts-rs/ClientOptions.d.ts +7 -0
- package/dist/esm/ts-rs/ExportMethod.d.ts +1 -0
- package/dist/esm/ts-rs/ExportOptions.d.ts +9 -0
- package/dist/esm/ts-rs/GetClientOptions.d.ts +8 -0
- package/dist/esm/ts-rs/GetTableOptions.d.ts +8 -0
- package/dist/esm/ts-rs/Layout.d.ts +11 -0
- package/dist/esm/ts-rs/OnUpdateData.d.ts +6 -0
- package/dist/esm/ts-rs/Orientation.d.ts +4 -0
- package/dist/esm/ts-rs/PanelOptions.d.ts +7 -0
- package/dist/esm/ts-rs/PanelViewerConfig.d.ts +39 -0
- package/dist/esm/ts-rs/SplitLayout.d.ts +7 -0
- package/dist/esm/ts-rs/TabLayout.d.ts +10 -0
- package/dist/esm/ts-rs/ViewOnUpdateResp.d.ts +4 -0
- package/dist/esm/ts-rs/ViewerConfig.d.ts +6 -2
- package/dist/esm/ts-rs/WorkspaceConfig.d.ts +40 -0
- package/dist/esm/ts-rs/WorkspaceConfigUpdate.d.ts +28 -0
- package/dist/wasm/perspective-viewer.d.ts +213 -79
- package/dist/wasm/perspective-viewer.js +537 -189
- package/dist/wasm/perspective-viewer.wasm +0 -0
- package/dist/wasm/perspective-viewer.wasm.d.ts +36 -28
- package/dist/wasm/snippets/perspective-viewer-daeef4ceb066e6c7/inline0.js +6 -0
- package/dist/wasm/snippets/{perspective-viewer-3cd58f0374935772/inline3.js → perspective-viewer-daeef4ceb066e6c7/inline4.js} +5 -0
- package/package.json +3 -2
- package/src/css/_column_dropdown.css +14 -0
- package/src/css/_context_menu.css +14 -0
- 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/column-settings-panel.css +1 -1
- package/src/css/containers/context-menu.css +101 -0
- package/src/css/panel-tab.css +193 -0
- package/src/css/plugin-selector.css +7 -10
- package/src/css/status-bar.css +75 -81
- package/src/css/viewer.css +181 -71
- package/src/rust/components/column_dropdown.rs +43 -33
- package/src/rust/components/column_selector/active_column.rs +7 -18
- package/src/rust/components/column_selector/aggregate_selector.rs +4 -10
- package/src/rust/components/column_selector/config_selector.rs +33 -84
- package/src/rust/components/column_selector/empty_column.rs +0 -3
- package/src/rust/components/column_selector/filter_column.rs +5 -18
- package/src/rust/components/column_selector/inactive_column.rs +3 -8
- package/src/rust/components/column_selector/invalid_column.rs +0 -4
- package/src/rust/components/column_selector/sort_column.rs +3 -6
- package/src/rust/components/column_selector.rs +5 -14
- 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 +175 -66
- package/src/rust/components/containers/tab_list.rs +0 -3
- package/src/rust/components/context_menu.rs +130 -0
- 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 +3 -4
- package/src/rust/components/function_dropdown.rs +3 -3
- package/src/rust/components/global_filter_bar.rs +76 -0
- package/src/rust/components/main_panel/frame_theme.rs +186 -0
- package/src/rust/components/main_panel/msg.rs +62 -0
- package/src/rust/components/main_panel/presize.rs +220 -0
- package/src/rust/components/main_panel/reconcile.rs +224 -0
- package/src/rust/components/main_panel/render.rs +385 -0
- package/src/rust/components/main_panel/update.rs +184 -0
- package/src/rust/components/main_panel.rs +311 -71
- package/src/rust/components/mod.rs +4 -0
- package/src/rust/components/number_series_style.rs +0 -3
- package/src/rust/components/panel_menu.rs +486 -0
- package/src/rust/components/panel_tab.rs +505 -0
- package/src/rust/components/plugin_selector.rs +0 -3
- package/src/rust/components/plugin_tab.rs +1 -6
- package/src/rust/components/portal.rs +5 -2
- package/src/rust/components/render_warning.rs +0 -3
- package/src/rust/components/settings_panel.rs +13 -5
- package/src/rust/components/status_bar.rs +113 -180
- package/src/rust/components/status_indicator.rs +6 -9
- package/src/rust/components/string_column_style.rs +0 -3
- package/src/rust/components/style/mod.rs +65 -27
- package/src/rust/components/style/style_provider.rs +51 -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/filters.rs +133 -0
- package/src/rust/components/viewer/msg.rs +180 -0
- package/src/rust/components/viewer/panels.rs +326 -0
- package/src/rust/components/viewer/render.rs +243 -0
- package/src/rust/components/viewer/settings.rs +402 -0
- package/src/rust/components/viewer/snapshots.rs +134 -0
- package/src/rust/components/viewer/wiring.rs +505 -0
- package/src/rust/components/viewer.rs +243 -758
- package/src/rust/config/export_method.rs +1 -1
- package/src/rust/config/mod.rs +4 -0
- package/src/rust/config/options.rs +71 -0
- package/src/rust/config/viewer_config.rs +24 -2
- package/src/rust/config/workspace_config.rs +92 -0
- package/src/rust/custom_elements/copy_dropdown.rs +9 -3
- package/src/rust/custom_elements/debug_plugin.rs +20 -1
- package/src/rust/custom_elements/export_dropdown.rs +9 -3
- package/src/rust/custom_elements/viewer.rs +1015 -286
- package/src/rust/custom_events.rs +212 -61
- package/src/rust/js/mod.rs +2 -0
- package/src/rust/js/plugin.rs +297 -10
- package/src/rust/js/regular_layout.rs +258 -0
- package/src/rust/lib.rs +20 -2
- package/src/rust/presentation.rs +66 -33
- package/src/rust/queries/get_viewer_config.rs +29 -11
- package/src/rust/queries/plugin_column_styles.rs +2 -2
- package/src/rust/renderer/activate.rs +41 -14
- package/src/rust/renderer/dispatch.rs +436 -0
- package/src/rust/renderer/plugin_config.rs +495 -0
- package/src/rust/renderer/registry.rs +18 -6
- package/src/rust/renderer/render_timer.rs +29 -10
- package/src/rust/renderer.rs +350 -827
- package/src/rust/session/column_defaults_update.rs +26 -8
- package/src/rust/session/metadata.rs +11 -1
- package/src/rust/session/view_subscription.rs +30 -15
- package/src/rust/session.rs +753 -251
- package/src/rust/tasks/apply_global_filters.rs +89 -0
- package/src/rust/tasks/auto_pause.rs +171 -0
- package/src/rust/tasks/copy_export.rs +29 -19
- package/src/rust/tasks/create_panel.rs +243 -0
- package/src/rust/tasks/dismiss_render_warning.rs +3 -1
- package/src/rust/tasks/edit_expression.rs +4 -4
- package/src/rust/tasks/eject.rs +64 -23
- package/src/rust/tasks/mod.rs +28 -4
- package/src/rust/tasks/pipeline.rs +411 -0
- package/src/rust/tasks/presize_panels.rs +324 -0
- package/src/rust/tasks/reset_all.rs +22 -12
- package/src/rust/tasks/resize_observer.rs +124 -87
- package/src/rust/tasks/restore_and_render.rs +80 -86
- package/src/rust/tasks/restore_panel.rs +145 -0
- package/src/rust/tasks/send_column_config.rs +5 -2
- package/src/rust/tasks/send_plugin_config.rs +5 -2
- package/src/rust/tasks/set_edit_mode.rs +59 -0
- package/src/rust/tasks/sync_update_panels.rs +152 -0
- package/src/rust/tasks/table_lifecycle.rs +158 -0
- package/src/rust/tasks/update_theme.rs +56 -12
- package/src/rust/utils/completion.rs +56 -0
- package/src/rust/utils/custom_element.rs +5 -0
- package/src/rust/utils/debounce.rs +130 -7
- package/src/rust/utils/mod.rs +6 -0
- package/src/rust/utils/pending_effects.rs +62 -0
- package/src/rust/{components/style/local_style.rs → utils/spawn.rs} +17 -19
- package/src/rust/utils/weak_scope.rs +0 -10
- package/src/rust/workspace.rs +846 -0
- package/src/svg/active-indicator.svg +3 -0
- package/src/themes/botanical.css +7 -2
- package/src/themes/defaults.css +54 -2
- package/src/themes/dracula.css +8 -3
- package/src/themes/gruvbox-dark.css +7 -2
- package/src/themes/gruvbox.css +5 -2
- package/src/themes/icons.css +4 -2
- package/src/themes/monokai.css +7 -2
- package/src/themes/phosphor.css +7 -2
- package/src/themes/pro-dark.css +7 -2
- package/src/themes/pro.css +2 -1
- package/src/themes/solarized-dark.css +5 -2
- package/src/themes/solarized.css +5 -2
- package/src/themes/vaporwave.css +7 -2
- package/src/ts/bootstrap.ts +8 -7
- package/src/ts/extensions.ts +30 -2
- package/src/ts/perspective-viewer.ts +10 -0
- package/src/ts/plugin.ts +72 -5
- package/src/ts/ts-rs/ClientOptions.ts +7 -0
- package/src/ts/ts-rs/ExportMethod.ts +3 -0
- package/src/ts/ts-rs/ExportOptions.ts +8 -0
- package/src/ts/ts-rs/GetClientOptions.ts +7 -0
- package/src/ts/ts-rs/GetTableOptions.ts +7 -0
- package/src/ts/ts-rs/Layout.ts +9 -0
- package/src/ts/ts-rs/Orientation.ts +6 -0
- package/src/ts/ts-rs/PanelOptions.ts +7 -0
- package/src/ts/ts-rs/PanelViewerConfig.ts +15 -0
- package/src/ts/ts-rs/SplitLayout.ts +5 -0
- package/src/ts/ts-rs/TabLayout.ts +11 -0
- package/src/ts/ts-rs/ViewerConfig.ts +6 -2
- package/src/ts/ts-rs/WorkspaceConfig.ts +36 -0
- package/src/ts/ts-rs/WorkspaceConfigUpdate.ts +24 -0
- package/tsconfig.json +1 -1
- package/src/rust/components/style/style_cache.rs +0 -136
- package/src/rust/tasks/intersection_observer.rs +0 -98
- package/src/rust/tasks/update_and_render.rs +0 -110
- /package/dist/wasm/snippets/{perspective-viewer-3cd58f0374935772/inline0.js → perspective-viewer-daeef4ceb066e6c7/inline1.js} +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-3cd58f0374935772/inline1.js → perspective-viewer-daeef4ceb066e6c7/inline2.js} +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-3cd58f0374935772/inline2.js → perspective-viewer-daeef4ceb066e6c7/inline3.js} +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-3cd58f0374935772/inline4.js → perspective-viewer-daeef4ceb066e6c7/inline5.js} +0 -0
|
@@ -20,16 +20,19 @@ use crate::config::PluginStaticConfig;
|
|
|
20
20
|
|
|
21
21
|
#[extend::ext]
|
|
22
22
|
pub impl ViewConfigUpdate {
|
|
23
|
-
///
|
|
24
|
-
/// `
|
|
25
|
-
/// `
|
|
26
|
-
///
|
|
27
|
-
///
|
|
28
|
-
///
|
|
29
|
-
|
|
23
|
+
/// Coerce this update's `group_rollup_mode` to one the plugin accepts
|
|
24
|
+
/// (`PluginStaticConfig::group_rollup_modes`, feature-filtered). An
|
|
25
|
+
/// absent mode counts as `Rollup` for the acceptance check, so a plugin
|
|
26
|
+
/// that only renders `flat` (Treemap / Sunburst) gets it stamped even
|
|
27
|
+
/// when the update never mentions rollup at all.
|
|
28
|
+
///
|
|
29
|
+
/// Split out of [`Self::set_update_column_defaults`] so same-plugin
|
|
30
|
+
/// restores can enforce the mode WITHOUT the column-defaulting below —
|
|
31
|
+
/// that path must not touch `columns` (it would drop non-numeric color
|
|
32
|
+
/// slots from a partial restore).
|
|
33
|
+
fn set_update_rollup_defaults(
|
|
30
34
|
&mut self,
|
|
31
35
|
metadata: &SessionMetadata,
|
|
32
|
-
columns: &[Option<String>],
|
|
33
36
|
config_static: &PluginStaticConfig,
|
|
34
37
|
) {
|
|
35
38
|
let rollup_features = metadata
|
|
@@ -49,6 +52,21 @@ pub impl ViewConfigUpdate {
|
|
|
49
52
|
self.group_rollup_mode
|
|
50
53
|
);
|
|
51
54
|
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/// Appends additional columns to the `columns` field of this
|
|
58
|
+
/// `ViewConfigUpdate` by picking appropriate new columns from the
|
|
59
|
+
/// `SessionMetadata`, given the necessary column requirements of the
|
|
60
|
+
/// plugin provided by a `PluginStaticConfig`. For example, an "X/Y
|
|
61
|
+
/// Scatter" chart needs a minimum of 2 numeric columns to be
|
|
62
|
+
/// drawable.
|
|
63
|
+
fn set_update_column_defaults(
|
|
64
|
+
&mut self,
|
|
65
|
+
metadata: &SessionMetadata,
|
|
66
|
+
columns: &[Option<String>],
|
|
67
|
+
config_static: &PluginStaticConfig,
|
|
68
|
+
) {
|
|
69
|
+
self.set_update_rollup_defaults(metadata, config_static);
|
|
52
70
|
|
|
53
71
|
if let (None, Some(min_cols)) = (&self.columns, config_static.min_config_columns) {
|
|
54
72
|
let names_len = config_static.config_column_names.len();
|
|
@@ -95,6 +95,16 @@ impl SessionMetadata {
|
|
|
95
95
|
Ok(())
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
/// Whether `view_schema` has been populated by a prior successful
|
|
99
|
+
/// `create_view`. Used by `Session::create_view` to force a full
|
|
100
|
+
/// build on first run even when `is_clean` happens to be true, so
|
|
101
|
+
/// that downstream consumers (`query_column_config_schema`,
|
|
102
|
+
/// strip-on-write in `update_columns_configs`) always see a real
|
|
103
|
+
/// view schema rather than `None`.
|
|
104
|
+
pub fn has_view_schema(&self) -> bool {
|
|
105
|
+
self.as_ref().and_then(|s| s.view_schema.as_ref()).is_some()
|
|
106
|
+
}
|
|
107
|
+
|
|
98
108
|
pub(super) fn update_expressions(
|
|
99
109
|
&mut self,
|
|
100
110
|
valid_recs: &perspective_client::ExprValidationResult,
|
|
@@ -302,7 +312,7 @@ impl SessionMetadata {
|
|
|
302
312
|
Some(
|
|
303
313
|
self.get_expression_columns()
|
|
304
314
|
.cloned()
|
|
305
|
-
.chain(self.get_table_columns()?.clone()
|
|
315
|
+
.chain(self.get_table_columns()?.clone())
|
|
306
316
|
.map(move |name| {
|
|
307
317
|
self.get_column_table_type(&name)
|
|
308
318
|
.map(|coltype| (name, coltype))
|
|
@@ -36,6 +36,7 @@ pub struct ViewStats {
|
|
|
36
36
|
struct ViewSubscriptionData {
|
|
37
37
|
view: View,
|
|
38
38
|
config: Rc<ViewConfig>,
|
|
39
|
+
build_config: Rc<ViewConfig>,
|
|
39
40
|
callback_id: Rc<Cell<u32>>,
|
|
40
41
|
on_stats: Callback<ViewStats>,
|
|
41
42
|
on_update: Option<Callback<()>>,
|
|
@@ -59,8 +60,6 @@ impl ViewSubscriptionData {
|
|
|
59
60
|
Ok(JsValue::UNDEFINED)
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
/// TODO Use serde to serialize the full view config, instead of calculating
|
|
63
|
-
/// `is_aggregated` here.
|
|
64
63
|
async fn update_view_stats(self) -> ApiResult<JsValue> {
|
|
65
64
|
let dimensions = self.view.dimensions().await?;
|
|
66
65
|
let num_rows = dimensions.num_table_rows as u32;
|
|
@@ -80,13 +79,16 @@ impl ViewSubscriptionData {
|
|
|
80
79
|
}
|
|
81
80
|
|
|
82
81
|
async fn internal_delete(&self) -> ApiResult<()> {
|
|
82
|
+
if self.is_deleted.replace(true) {
|
|
83
|
+
return Ok(());
|
|
84
|
+
}
|
|
85
|
+
|
|
83
86
|
let view = &self.view;
|
|
84
87
|
if self.on_update.is_some() {
|
|
85
88
|
view.remove_update(self.callback_id.get()).await?;
|
|
86
89
|
}
|
|
87
90
|
|
|
88
91
|
view.delete().await?;
|
|
89
|
-
self.is_deleted.set(true);
|
|
90
92
|
Ok(())
|
|
91
93
|
}
|
|
92
94
|
}
|
|
@@ -104,13 +106,15 @@ impl ViewSubscription {
|
|
|
104
106
|
/// `View.on_update()`.
|
|
105
107
|
pub async fn new(
|
|
106
108
|
view: perspective_client::View,
|
|
107
|
-
config: ViewConfig
|
|
109
|
+
config: Rc<ViewConfig>,
|
|
110
|
+
build_config: Rc<ViewConfig>,
|
|
108
111
|
on_stats: Callback<ViewStats>,
|
|
109
112
|
on_update: Option<Callback<()>>,
|
|
110
113
|
) -> Result<Self, ApiError> {
|
|
111
114
|
let data = ViewSubscriptionData {
|
|
112
115
|
view,
|
|
113
|
-
config
|
|
116
|
+
config,
|
|
117
|
+
build_config,
|
|
114
118
|
on_stats,
|
|
115
119
|
callback_id: Rc::default(),
|
|
116
120
|
on_update,
|
|
@@ -142,10 +146,13 @@ impl ViewSubscription {
|
|
|
142
146
|
}
|
|
143
147
|
|
|
144
148
|
/// It is possible to re-use a `ViewSubscription` without a costly
|
|
145
|
-
/// resubscribe
|
|
146
|
-
/// `
|
|
147
|
-
|
|
148
|
-
|
|
149
|
+
/// resubscribe when the new config is engine-equivalent to the one the
|
|
150
|
+
/// bound `View` was built from (placeholder-only differences); the
|
|
151
|
+
/// snapshots still need updating so reads stay consistent with the run
|
|
152
|
+
/// that adopted them.
|
|
153
|
+
pub fn set_configs(&mut self, config: Rc<ViewConfig>, build_config: Rc<ViewConfig>) {
|
|
154
|
+
self.data.config = config;
|
|
155
|
+
self.data.build_config = build_config;
|
|
149
156
|
}
|
|
150
157
|
|
|
151
158
|
/// Getter for the underlying `View()`.
|
|
@@ -153,16 +160,24 @@ impl ViewSubscription {
|
|
|
153
160
|
&self.data.view
|
|
154
161
|
}
|
|
155
162
|
|
|
156
|
-
///
|
|
157
|
-
/// from (
|
|
158
|
-
///
|
|
159
|
-
///
|
|
160
|
-
///
|
|
161
|
-
///
|
|
163
|
+
/// User-facing snapshot of the [`ViewConfig`] the bound `View` was
|
|
164
|
+
/// constructed from (the persisted config at build time — global-filter
|
|
165
|
+
/// overlay excluded). This is the [`ViewConfig`] consistent with the
|
|
166
|
+
/// data the active plugin is currently rendering — not the live session
|
|
167
|
+
/// config, which may have been mutated synchronously ahead of the next
|
|
168
|
+
/// queued run.
|
|
162
169
|
pub fn get_view_config(&self) -> Rc<ViewConfig> {
|
|
163
170
|
self.data.config.clone()
|
|
164
171
|
}
|
|
165
172
|
|
|
173
|
+
/// The EFFECTIVE [`ViewConfig`] the bound `View` was built from
|
|
174
|
+
/// (persisted config + global-filter overlay at build time). This is
|
|
175
|
+
/// the value `Session::bind_view` compares a run's snapshot against to
|
|
176
|
+
/// decide SKIP / REUSE / REBUILD.
|
|
177
|
+
pub fn build_config(&self) -> Rc<ViewConfig> {
|
|
178
|
+
self.data.build_config.clone()
|
|
179
|
+
}
|
|
180
|
+
|
|
166
181
|
/// Delete this `View`. Neglecting to call this method before a
|
|
167
182
|
/// `ViewSubscription` is dropped will result in a log warning, but the
|
|
168
183
|
/// `View` will not leak.
|