@perspective-dev/viewer 5.4.0 → 5.5.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.
- package/dist/cdn/perspective-viewer.js +4 -4
- package/dist/cdn/perspective-viewer.js.map +2 -2
- package/dist/css/blueprint.css +1 -1
- package/dist/css/botanical.css +1 -1
- package/dist/css/dracula.css +1 -1
- package/dist/css/eggplant.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/intl/ar.css +1 -1
- package/dist/css/intl/de.css +1 -1
- package/dist/css/intl/es.css +1 -1
- package/dist/css/intl/fr.css +1 -1
- package/dist/css/intl/ja.css +1 -1
- package/dist/css/intl/pt.css +1 -1
- package/dist/css/intl/zh.css +1 -1
- package/dist/css/intl.css +1 -1
- package/dist/css/ledger.css +1 -1
- package/dist/css/monokai.css +1 -1
- package/dist/css/nord.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/css/velvet.css +1 -1
- package/dist/docs/perspective-docs.json +1 -1
- package/dist/esm/perspective-viewer.d.ts +2 -0
- package/dist/esm/perspective-viewer.inline.js +9 -9
- package/dist/esm/perspective-viewer.inline.js.map +3 -3
- package/dist/esm/perspective-viewer.js +4 -4
- package/dist/esm/perspective-viewer.js.map +2 -2
- package/dist/esm/plugin.d.ts +9 -0
- package/dist/esm/ts-rs/AddPanelOptions.d.ts +9 -0
- package/dist/esm/ts-rs/ExportMethod.d.ts +1 -1
- package/dist/esm/ts-rs/GetViewMode.d.ts +4 -0
- package/dist/esm/ts-rs/GetViewOptions.d.ts +8 -0
- package/dist/esm/ts-rs/RestoreOptions.d.ts +6 -0
- package/dist/esm/ts-rs/RestoreWorkspaceOptions.d.ts +9 -0
- package/dist/esm/ts-rs/WorkspaceConfigUpdate.d.ts +30 -22
- package/dist/wasm/perspective-viewer.d.ts +102 -47
- package/dist/wasm/perspective-viewer.js +233 -142
- package/dist/wasm/perspective-viewer.wasm +0 -0
- package/dist/wasm/perspective-viewer.wasm.d.ts +18 -18
- package/package.json +7 -7
- package/src/css/column-selector.css +11 -3
- package/src/css/column-style.css +162 -0
- package/src/css/config-selector.css +1 -1
- package/src/css/form/debug.css +9 -0
- package/src/css/status-bar.css +11 -0
- package/src/css/ui/containers/tabs.css +2 -1
- package/src/rust/agent/tools.rs +80 -7
- package/src/rust/components/column_selector/active_column.rs +9 -0
- package/src/rust/components/column_selector.rs +11 -0
- package/src/rust/components/column_settings_sidebar/style_tab/alignment_field.rs +90 -0
- package/src/rust/components/column_settings_sidebar/style_tab/font_field.rs +267 -0
- package/src/rust/components/column_settings_sidebar/style_tab/primitive_field.rs +1 -1
- package/src/rust/components/column_settings_sidebar/style_tab.rs +68 -9
- package/src/rust/components/debug_panel.rs +107 -50
- package/src/rust/components/export_dropdown.rs +6 -0
- package/src/rust/components/main_panel/msg.rs +4 -0
- package/src/rust/components/main_panel.rs +14 -0
- package/src/rust/components/mod.rs +0 -1
- package/src/rust/components/plugin_tab.rs +57 -3
- package/src/rust/components/settings_panel.rs +6 -0
- package/src/rust/components/status_bar.rs +12 -3
- package/src/rust/components/status_indicator.rs +4 -0
- package/src/rust/components/viewer/filters.rs +2 -2
- package/src/rust/components/viewer/msg.rs +4 -0
- package/src/rust/components/viewer/panels.rs +6 -3
- package/src/rust/components/viewer/render.rs +1 -0
- package/src/rust/components/viewer/wiring.rs +14 -2
- package/src/rust/components/viewer.rs +2 -2
- package/src/rust/config/column_config_schema.rs +312 -8
- package/src/rust/config/datetime_column_style.rs +0 -11
- package/src/rust/config/export_method.rs +24 -0
- package/src/rust/config/mod.rs +0 -2
- package/src/rust/config/options.rs +50 -0
- package/src/rust/config/workspace_config.rs +69 -24
- package/src/rust/custom_elements/viewer.rs +214 -113
- package/src/rust/js/plugin.rs +3 -1
- package/src/rust/lib.rs +7 -3
- package/src/rust/queries/plugin_column_styles.rs +6 -5
- package/src/rust/renderer/plugin_config.rs +200 -41
- package/src/rust/renderer/plugin_store.rs +2 -1
- package/src/rust/renderer/props.rs +5 -0
- package/src/rust/renderer.rs +9 -0
- package/src/rust/session/metadata.rs +5 -10
- package/src/rust/session/props.rs +4 -0
- package/src/rust/session.rs +273 -195
- package/src/rust/tasks/copy_export.rs +67 -0
- package/src/rust/tasks/create_panel.rs +16 -13
- package/src/rust/tasks/pipeline.rs +26 -8
- package/src/rust/tasks/restore_panel.rs +129 -30
- package/src/rust/tasks/send_column_config.rs +3 -0
- package/src/rust/tasks/sync_update_panels.rs +148 -68
- package/src/rust/tasks/table_lifecycle.rs +7 -1
- package/src/rust/ui/containers/tab_list.rs +1 -1
- package/src/rust/ui/form/intl_label.rs +4 -23
- package/src/rust/ui/portal.rs +1 -0
- package/src/rust/utils/css_vars.rs +13 -0
- package/src/rust/{config/datetime_column_style/color_mode.rs → utils/in_flight.rs} +47 -35
- package/src/rust/utils/local_fonts.rs +395 -0
- package/src/rust/utils/mod.rs +4 -0
- package/src/rust/utils/pending_effects.rs +6 -30
- package/src/rust/workspace.rs +12 -0
- package/src/svg/status_pending.svg +3 -0
- package/src/themes/icons.css +1 -0
- package/src/themes/intl/ar.css +20 -7
- package/src/themes/intl/de.css +20 -7
- package/src/themes/intl/es.css +20 -7
- package/src/themes/intl/fr.css +20 -7
- package/src/themes/intl/ja.css +20 -7
- package/src/themes/intl/pt.css +20 -7
- package/src/themes/intl/zh.css +20 -7
- package/src/themes/intl.css +20 -7
- package/src/themes/monokai.css +1 -1
- package/src/themes/vaporwave.css +1 -1
- package/src/ts/perspective-viewer.ts +2 -0
- package/src/ts/plugin.ts +9 -0
- package/src/ts/ts-rs/AddPanelOptions.ts +10 -0
- package/src/ts/ts-rs/ExportMethod.ts +1 -1
- package/src/ts/ts-rs/{DatetimeColorMode.ts → GetViewMode.ts} +4 -1
- package/src/ts/ts-rs/GetViewOptions.ts +7 -0
- package/src/ts/ts-rs/RestoreOptions.ts +7 -1
- package/src/ts/ts-rs/RestoreWorkspaceOptions.ts +10 -0
- package/src/ts/ts-rs/WorkspaceConfigUpdate.ts +31 -20
- package/dist/esm/ts-rs/DatetimeColorMode.d.ts +0 -1
- package/dist/esm/ts-rs/FormatMode.d.ts +0 -1
- package/dist/esm/ts-rs/StringColorMode.d.ts +0 -1
- package/src/rust/components/string_column_style.rs +0 -120
- package/src/rust/config/string_column_style.rs +0 -135
- package/src/ts/ts-rs/FormatMode.ts +0 -3
- package/src/ts/ts-rs/StringColorMode.ts +0 -3
- /package/dist/wasm/snippets/{perspective-viewer-adc6f3f79141112b → perspective-viewer-6813b568219c6763}/inline0.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-adc6f3f79141112b → perspective-viewer-6813b568219c6763}/inline1.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-adc6f3f79141112b → perspective-viewer-6813b568219c6763}/inline2.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-adc6f3f79141112b → perspective-viewer-6813b568219c6763}/inline3.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-adc6f3f79141112b → perspective-viewer-6813b568219c6763}/inline4.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-adc6f3f79141112b → perspective-viewer-6813b568219c6763}/inline5.js +0 -0
|
@@ -14,7 +14,7 @@ use std::collections::BTreeMap;
|
|
|
14
14
|
|
|
15
15
|
use perspective_client::config::Filter;
|
|
16
16
|
|
|
17
|
-
use crate::config::{PanelViewerConfig, ViewerConfigInitial};
|
|
17
|
+
use crate::config::{OptionalUpdate, PanelViewerConfig, ViewerConfigInitial};
|
|
18
18
|
use crate::utils::CssKind;
|
|
19
19
|
|
|
20
20
|
/// The workspace config format (`{version, active?, layout, panels}`) —
|
|
@@ -67,48 +67,52 @@ pub struct WorkspaceConfig {
|
|
|
67
67
|
pub palette: BTreeMap<String, String>,
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
/// The
|
|
71
|
-
/// [`
|
|
72
|
-
///
|
|
73
|
-
///
|
|
74
|
-
/// stray per-panel `settings` key is ignored; it is element-level state,
|
|
75
|
-
/// carried by the top-level `active` field).
|
|
70
|
+
/// The [`PerspectiveViewerElement::restoreWorkspace`] argument: a field-wise
|
|
71
|
+
/// update of the element's workspace state, like [`ViewerConfigUpdate`] for a
|
|
72
|
+
/// panel, where an absent key is unchanged, `null` resets and a value
|
|
73
|
+
/// replaces.
|
|
76
74
|
#[derive(serde::Deserialize, ts_rs::TS)]
|
|
77
75
|
pub struct WorkspaceConfigUpdate {
|
|
76
|
+
/// The panel to activate with the settings sidebar open, by `panels` key
|
|
77
|
+
/// or existing panel id; `null` closes the sidebar.
|
|
78
78
|
#[serde(default)]
|
|
79
|
+
#[ts(as = "Option<_>")]
|
|
79
80
|
#[ts(optional)]
|
|
80
|
-
pub active:
|
|
81
|
+
pub active: OptionalUpdate<String>,
|
|
81
82
|
|
|
83
|
+
/// The layout tree to stage, naming `panels` keys or existing panel ids.
|
|
82
84
|
#[serde(default)]
|
|
83
85
|
#[ts(optional)]
|
|
84
86
|
pub layout: Option<crate::js::Layout>,
|
|
85
87
|
|
|
86
|
-
|
|
88
|
+
/// The complete replacement panel set, each [`ViewerConfigInitial`] entry
|
|
89
|
+
/// creating a new panel (`{}` empties the element); absent keeps the
|
|
90
|
+
/// existing panels.
|
|
91
|
+
#[serde(default)]
|
|
92
|
+
#[ts(optional)]
|
|
93
|
+
pub panels: Option<BTreeMap<String, ViewerConfigInitial>>,
|
|
87
94
|
|
|
88
|
-
/// The element-level
|
|
89
|
-
///
|
|
90
|
-
/// unattributed bucket: the next selection on any master replaces it.
|
|
91
|
-
/// `Option` so an explicit `undefined` property deserializes as
|
|
92
|
-
/// `None` like an absent key (also `masters` / `palette` below).
|
|
95
|
+
/// The element-level cross-filter set applied to every detail panel as
|
|
96
|
+
/// one unattributed bucket, replacing the current set; `null` clears it.
|
|
93
97
|
#[serde(default)]
|
|
94
98
|
#[ts(as = "Option<_>")]
|
|
95
99
|
#[ts(optional)]
|
|
96
|
-
pub global_filters:
|
|
100
|
+
pub global_filters: OptionalUpdate<Vec<Filter>>,
|
|
97
101
|
|
|
98
|
-
/// The master (filter-source) panels
|
|
99
|
-
/// `
|
|
102
|
+
/// The master (filter-source) panels by `panels` key or existing panel
|
|
103
|
+
/// id, unknown ids dropped with a warning; `null` demotes every panel.
|
|
100
104
|
#[serde(default)]
|
|
101
105
|
#[ts(as = "Option<_>")]
|
|
102
106
|
#[ts(optional)]
|
|
103
|
-
pub masters:
|
|
107
|
+
pub masters: OptionalUpdate<Vec<String>>,
|
|
104
108
|
|
|
105
|
-
/// Named color-scale definitions
|
|
106
|
-
/// [`WorkspaceConfig::palette`]), replacing
|
|
107
|
-
///
|
|
109
|
+
/// Named color-scale definitions applied to the host (see
|
|
110
|
+
/// [`WorkspaceConfig::palette`]), replacing the previous palette; `null`
|
|
111
|
+
/// clears it.
|
|
108
112
|
#[serde(default)]
|
|
109
113
|
#[ts(as = "Option<_>")]
|
|
110
114
|
#[ts(optional)]
|
|
111
|
-
pub palette:
|
|
115
|
+
pub palette: OptionalUpdate<BTreeMap<String, String>>,
|
|
112
116
|
}
|
|
113
117
|
|
|
114
118
|
/// Validate a restored palette map: each key's `--psp-user--<kind>-`
|
|
@@ -173,11 +177,48 @@ mod tests {
|
|
|
173
177
|
);
|
|
174
178
|
}
|
|
175
179
|
|
|
180
|
+
#[test]
|
|
181
|
+
fn update_absent_fields_are_missing_and_null_resets() {
|
|
182
|
+
let update: WorkspaceConfigUpdate = serde_json::from_value(json!({})).unwrap();
|
|
183
|
+
assert!(update.panels.is_none());
|
|
184
|
+
assert!(update.layout.is_none());
|
|
185
|
+
assert_eq!(update.active, OptionalUpdate::Missing);
|
|
186
|
+
assert_eq!(update.global_filters, OptionalUpdate::Missing);
|
|
187
|
+
assert_eq!(update.masters, OptionalUpdate::Missing);
|
|
188
|
+
assert_eq!(update.palette, OptionalUpdate::Missing);
|
|
189
|
+
|
|
190
|
+
let update: WorkspaceConfigUpdate = serde_json::from_value(json!({
|
|
191
|
+
"panels": null,
|
|
192
|
+
"active": null,
|
|
193
|
+
"global_filters": null,
|
|
194
|
+
"masters": null,
|
|
195
|
+
"palette": null,
|
|
196
|
+
}))
|
|
197
|
+
.unwrap();
|
|
198
|
+
|
|
199
|
+
assert!(update.panels.is_none());
|
|
200
|
+
assert_eq!(update.active, OptionalUpdate::SetDefault);
|
|
201
|
+
assert_eq!(update.global_filters, OptionalUpdate::SetDefault);
|
|
202
|
+
assert_eq!(update.masters, OptionalUpdate::SetDefault);
|
|
203
|
+
assert_eq!(update.palette, OptionalUpdate::SetDefault);
|
|
204
|
+
|
|
205
|
+
let update: WorkspaceConfigUpdate = serde_json::from_value(json!({
|
|
206
|
+
"panels": {},
|
|
207
|
+
"global_filters": [["Region", "==", "West"]],
|
|
208
|
+
"masters": ["a"],
|
|
209
|
+
}))
|
|
210
|
+
.unwrap();
|
|
211
|
+
|
|
212
|
+
assert_eq!(update.panels.map(|p| p.len()), Some(0));
|
|
213
|
+
assert_eq!(update.masters, OptionalUpdate::Update(vec!["a".to_owned()]));
|
|
214
|
+
assert!(matches!(update.global_filters, OptionalUpdate::Update(ref f) if f.len() == 1));
|
|
215
|
+
}
|
|
216
|
+
|
|
176
217
|
#[test]
|
|
177
218
|
fn update_palette_defaults_empty_and_validates_by_prefix() {
|
|
178
219
|
let update: WorkspaceConfigUpdate =
|
|
179
220
|
serde_json::from_value(json!({ "panels": {} })).unwrap();
|
|
180
|
-
|
|
221
|
+
assert_eq!(update.palette, OptionalUpdate::Missing);
|
|
181
222
|
|
|
182
223
|
let update: WorkspaceConfigUpdate = serde_json::from_value(json!({
|
|
183
224
|
"panels": {},
|
|
@@ -189,7 +230,11 @@ mod tests {
|
|
|
189
230
|
}))
|
|
190
231
|
.unwrap();
|
|
191
232
|
|
|
192
|
-
let
|
|
233
|
+
let OptionalUpdate::Update(palette) = update.palette else {
|
|
234
|
+
panic!("palette missing");
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
let valid = validate_palette(palette).unwrap();
|
|
193
238
|
assert_eq!(
|
|
194
239
|
valid.get("--psp-user--gradient-1").unwrap(),
|
|
195
240
|
"linear-gradient(to right, #000000 0%, #ffffff 100%)"
|