@perspective-dev/viewer 5.3.1 → 5.5.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 +6 -6
- 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 -0
- 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/extensions.d.ts +0 -5
- package/dist/esm/perspective-viewer.d.ts +2 -0
- package/dist/esm/perspective-viewer.inline.js +8 -8
- package/dist/esm/perspective-viewer.inline.js.map +2 -2
- package/dist/esm/perspective-viewer.js +5 -5
- 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/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/ViewOnUpdateResp.d.ts +1 -1
- package/dist/esm/ts-rs/WorkspaceConfigUpdate.d.ts +30 -22
- package/dist/wasm/perspective-viewer.d.ts +137 -104
- package/dist/wasm/perspective-viewer.js +337 -269
- package/dist/wasm/perspective-viewer.wasm +0 -0
- package/dist/wasm/perspective-viewer.wasm.d.ts +20 -30
- package/package.json +7 -7
- package/src/css/_context_menu.css +1 -1
- package/src/css/_dropdown_menu.css +1 -1
- package/src/css/_viewer_bundle.css +7 -8
- package/src/css/column-dropdown.css +0 -3
- package/src/css/column-selector.css +18 -7
- package/src/css/column-settings-panel.css +0 -225
- package/src/css/column-style.css +175 -0
- package/src/css/config-selector.css +19 -11
- package/src/css/filter-dropdown.css +5 -5
- package/src/css/form/debug.css +37 -4
- package/src/css/function-dropdown.css +5 -5
- package/src/css/panel-tab.css +23 -0
- package/src/css/plugin-selector.css +5 -5
- package/src/css/render-warning.css +1 -1
- package/src/css/status-bar.css +63 -21
- package/src/css/type-icon.css +1 -3
- package/src/css/{containers → ui/containers}/context-menu.css +22 -16
- package/src/css/ui/containers/dropdown-menu-items.css +66 -0
- package/src/css/{containers → ui/containers}/dropdown-menu.css +8 -53
- package/src/css/{containers → ui/containers}/tabs.css +2 -1
- package/src/css/viewer.css +32 -26
- package/src/rust/agent/tools.rs +80 -7
- package/src/rust/components/chat_panel.rs +1 -1
- package/src/rust/components/{form/code_editor.rs → code_editor.rs} +4 -2
- package/src/rust/components/column_dropdown.rs +2 -2
- package/src/rust/components/column_selector/active_column.rs +24 -9
- package/src/rust/components/column_selector/aggregate_selector.rs +1 -1
- package/src/rust/components/column_selector/config_selector.rs +2 -2
- package/src/rust/components/column_selector/filter_column.rs +8 -5
- package/src/rust/components/column_selector/inactive_column.rs +4 -2
- package/src/rust/components/column_selector/pivot_column.rs +4 -3
- package/src/rust/components/column_selector/sort_column.rs +7 -4
- package/src/rust/components/column_selector.rs +14 -3
- package/src/rust/components/column_settings_sidebar/style_tab/agg_depth_selector.rs +1 -1
- 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 +16 -18
- package/src/rust/components/column_settings_sidebar/style_tab/symbol/symbol_selector.rs +1 -1
- package/src/rust/components/column_settings_sidebar/style_tab.rs +70 -12
- package/src/rust/components/column_settings_sidebar.rs +3 -4
- package/src/rust/components/copy_dropdown.rs +1 -1
- package/src/rust/components/datetime_column_style/custom.rs +1 -3
- package/src/rust/components/datetime_column_style/simple.rs +1 -2
- package/src/rust/components/datetime_column_style.rs +1 -2
- package/src/rust/components/{form/debug.rs → debug_panel.rs} +112 -55
- package/src/rust/components/{containers/dragdrop_list.rs → dragdrop_list.rs} +2 -10
- package/src/rust/components/export_dropdown.rs +1 -1
- package/src/rust/components/expression_editor.rs +1 -1
- package/src/rust/components/filter_dropdown.rs +2 -2
- package/src/rust/components/function_dropdown.rs +2 -2
- package/src/rust/components/main_panel/frame_theme.rs +3 -59
- package/src/rust/components/main_panel/msg.rs +4 -0
- package/src/rust/components/main_panel/reconcile.rs +9 -4
- package/src/rust/components/main_panel/render.rs +62 -11
- package/src/rust/components/main_panel/update.rs +39 -10
- package/src/rust/components/main_panel.rs +40 -2
- package/src/rust/components/mod.rs +5 -8
- package/src/rust/components/new_panel_menu.rs +97 -0
- package/src/rust/components/number_series_style.rs +2 -3
- package/src/rust/components/panel_menu.rs +61 -87
- package/src/rust/components/panel_tab.rs +100 -43
- package/src/rust/components/plugin_tab.rs +58 -4
- package/src/rust/components/render_warning.rs +2 -2
- package/src/rust/components/{status_bar_counter.rs → rows_counter.rs} +10 -10
- package/src/rust/components/settings_panel.rs +8 -2
- package/src/rust/components/status_bar.rs +113 -19
- package/src/rust/components/status_indicator.rs +9 -14
- package/src/rust/components/{style/mod.rs → style.rs} +32 -15
- package/src/rust/components/style_controls/number_string_format/digits_section.rs +3 -5
- package/src/rust/components/style_controls/number_string_format/misc_section.rs +1 -1
- package/src/rust/components/style_controls/number_string_format/style_section.rs +1 -1
- package/src/rust/components/viewer/msg.rs +43 -30
- package/src/rust/components/viewer/panels.rs +53 -19
- package/src/rust/components/viewer/render.rs +16 -13
- package/src/rust/components/viewer/settings.rs +137 -68
- package/src/rust/components/viewer/snapshots.rs +5 -10
- package/src/rust/components/viewer/wiring.rs +11 -22
- package/src/rust/components/viewer.rs +15 -10
- package/src/rust/components/window_editor.rs +8 -9
- package/src/rust/config/column_config_schema.rs +312 -33
- package/src/rust/config/datetime_column_style.rs +0 -11
- package/src/rust/config/mod.rs +0 -4
- package/src/rust/config/options.rs +50 -0
- package/src/rust/config/workspace_config.rs +70 -24
- package/src/rust/custom_elements/debug_plugin.rs +1 -10
- package/src/rust/custom_elements/mod.rs +0 -3
- package/src/rust/custom_elements/viewer.rs +194 -115
- package/src/rust/js/plugin.rs +3 -87
- package/src/rust/lib.rs +19 -18
- package/src/rust/presentation/column_locator.rs +3 -7
- package/src/rust/presentation.rs +68 -38
- package/src/rust/queries/hosted_tables.rs +38 -0
- package/src/rust/queries/mod.rs +2 -0
- package/src/rust/queries/palette_set.rs +1 -1
- package/src/rust/queries/plugin_column_styles.rs +6 -5
- package/src/rust/renderer/activate.rs +1 -3
- package/src/rust/renderer/dispatch.rs +83 -22
- package/src/rust/renderer/limits.rs +24 -5
- package/src/rust/renderer/plugin_config.rs +201 -41
- package/src/rust/renderer/plugin_store.rs +2 -1
- package/src/rust/renderer/props.rs +7 -1
- package/src/rust/renderer.rs +23 -27
- package/src/rust/session/props.rs +8 -3
- package/src/rust/session/view_subscription.rs +19 -6
- package/src/rust/session.rs +189 -150
- package/src/rust/tasks/create_panel.rs +5 -2
- package/src/rust/tasks/dismiss_render_warning.rs +1 -1
- package/src/rust/tasks/eject.rs +1 -0
- package/src/rust/tasks/pipeline.rs +18 -67
- package/src/rust/tasks/presize_panels.rs +24 -1
- package/src/rust/tasks/restore_and_render.rs +0 -17
- package/src/rust/tasks/restore_panel.rs +129 -30
- package/src/rust/tasks/send_column_config.rs +4 -1
- package/src/rust/tasks/send_plugin_config.rs +1 -1
- package/src/rust/tasks/set_edit_mode.rs +1 -1
- package/src/rust/tasks/sync_update_panels.rs +147 -67
- package/src/rust/tasks/table_lifecycle.rs +7 -1
- package/src/rust/{components → ui}/containers/control_group.rs +25 -3
- package/src/rust/{components → ui}/containers/dropdown_menu.rs +5 -2
- package/src/rust/{components → ui}/containers/mod.rs +0 -4
- package/src/rust/{components → ui}/containers/scroll_panel.rs +0 -22
- package/src/rust/{components → ui}/containers/scroll_panel_item.rs +0 -13
- package/src/rust/{components → ui}/containers/select.rs +0 -6
- package/src/rust/{components → ui}/containers/sidebar.rs +5 -32
- package/src/rust/{components → ui}/containers/split_panel.rs +8 -80
- package/src/rust/{components → ui}/containers/tab_list.rs +15 -9
- package/src/rust/{components → ui}/context_menu.rs +8 -13
- package/src/rust/{presentation/drag_helpers.rs → ui/dragdrop.rs} +26 -31
- package/src/rust/{components → ui}/font_loader.rs +0 -26
- package/src/rust/{components → ui}/form/color_selector.rs +4 -2
- package/src/rust/{config/datetime_column_style/color_mode.rs → ui/form/intl_label.rs} +42 -42
- package/src/rust/{components → ui}/form/mirrored_textarea.rs +0 -53
- package/src/rust/{components → ui}/form/mod.rs +1 -10
- package/src/rust/{components → ui}/form/multi_stop_gradient_selector.rs +4 -5
- package/src/rust/{components → ui}/form/named_value_picker.rs +1 -6
- package/src/rust/{components → ui}/form/number_field.rs +1 -1
- package/src/rust/{components → ui}/form/number_range_field.rs +1 -1
- package/src/rust/{components → ui}/form/optional_field.rs +3 -1
- package/src/rust/{components → ui}/form/palette_selector.rs +4 -5
- package/src/rust/{components → ui}/form/select_enum_field.rs +2 -2
- package/src/rust/{components → ui}/form/select_value_field.rs +2 -2
- package/src/rust/ui/mod.rs +56 -0
- package/src/rust/ui/modal.rs +61 -0
- package/src/rust/{components → ui}/portal.rs +175 -79
- package/src/rust/{components/style/style_provider.rs → ui/style.rs} +4 -34
- package/src/rust/utils/completion.rs +0 -6
- package/src/rust/{config/css_scale.rs → utils/css.rs} +38 -35
- package/src/rust/utils/css_vars.rs +13 -0
- package/src/rust/utils/local_fonts.rs +395 -0
- package/src/rust/utils/mod.rs +4 -0
- package/src/rust/workspace.rs +47 -0
- package/src/svg/boolean-type.svg +3 -2
- package/src/svg/checkbox-checked-icon.svg +4 -7
- package/src/svg/checkbox-hover.svg +3 -3
- package/src/svg/checkbox-off.svg +2 -3
- package/src/svg/checkbox-on.svg +3 -3
- package/src/svg/checkbox-unchecked-icon.svg +3 -3
- package/src/svg/datagrid-select-column.svg +8 -15
- package/src/svg/datagrid-select-region.svg +8 -15
- package/src/svg/datagrid-select-row-tree.svg +7 -12
- package/src/svg/datagrid-select-row.svg +8 -13
- package/src/svg/date-type.svg +4 -23
- package/src/svg/drawer-tab-hover.svg +4 -6
- package/src/svg/drawer-tab-invert-hover.svg +5 -5
- package/src/svg/drawer-tab-invert.svg +3 -5
- package/src/svg/drawer-tab.svg +5 -5
- package/src/svg/mega-menu-icons-candlestick.svg +5 -37
- package/src/svg/mega-menu-icons-ohlc.svg +4 -39
- package/src/svg/mega-menu-icons-sunburst.svg +4 -38
- package/src/svg/mega-menu-icons-treemap.svg +3 -43
- package/src/svg/mega-menu-icons-y-scatter.svg +12 -72
- package/src/svg/new-panel-icon.svg +4 -0
- package/src/svg/number-type.svg +3 -3
- package/src/svg/radio-hover.svg +3 -3
- package/src/svg/radio-off.svg +3 -3
- package/src/svg/radio-on.svg +3 -3
- package/src/svg/status_ok.svg +3 -26
- package/src/svg/status_pending.svg +3 -0
- package/src/svg/string-type.svg +4 -8
- package/src/svg/theme-icon.svg +5 -5
- package/src/themes/blueprint.css +0 -57
- package/src/themes/botanical.css +0 -36
- package/src/themes/defaults.css +1 -24
- package/src/themes/dracula.css +0 -58
- package/src/themes/eggplant.css +0 -58
- package/src/themes/gruvbox-dark.css +0 -65
- package/src/themes/gruvbox.css +1 -39
- package/src/themes/icons.css +2 -8
- package/src/themes/intl/ar.css +198 -0
- package/src/themes/intl/de.css +63 -40
- package/src/themes/intl/es.css +58 -35
- package/src/themes/intl/fr.css +57 -34
- package/src/themes/intl/ja.css +59 -36
- package/src/themes/intl/pt.css +54 -31
- package/src/themes/intl/zh.css +65 -42
- package/src/themes/intl.css +34 -8
- package/src/themes/ledger.css +1 -59
- package/src/themes/monokai.css +0 -51
- package/src/themes/nord.css +0 -55
- package/src/themes/phosphor.css +0 -48
- package/src/themes/pro-dark.css +0 -37
- package/src/themes/pro.css +3 -23
- package/src/themes/solarized-dark.css +0 -31
- package/src/themes/solarized.css +1 -24
- package/src/themes/vaporwave.css +0 -44
- package/src/themes/velvet.css +0 -60
- package/src/ts/extensions.ts +0 -13
- 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/{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/ViewOnUpdateResp.ts +1 -1
- 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/css/plugin-settings-panel.css +0 -171
- package/src/rust/components/modal.rs +0 -177
- package/src/rust/components/string_column_style.rs +0 -121
- package/src/rust/config/string_column_style.rs +0 -135
- package/src/rust/custom_elements/copy_dropdown.rs +0 -219
- package/src/rust/custom_elements/export_dropdown.rs +0 -216
- package/src/rust/custom_elements/modal.rs +0 -299
- package/src/ts/ts-rs/FormatMode.ts +0 -3
- package/src/ts/ts-rs/StringColorMode.ts +0 -3
- /package/dist/wasm/snippets/{perspective-viewer-87bd21b215d0631a → perspective-viewer-ea71a3990cad35d7}/inline0.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-87bd21b215d0631a → perspective-viewer-ea71a3990cad35d7}/inline1.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-87bd21b215d0631a → perspective-viewer-ea71a3990cad35d7}/inline2.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-87bd21b215d0631a → perspective-viewer-ea71a3990cad35d7}/inline3.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-87bd21b215d0631a → perspective-viewer-ea71a3990cad35d7}/inline4.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-87bd21b215d0631a → perspective-viewer-ea71a3990cad35d7}/inline5.js +0 -0
- /package/src/css/{containers → ui/containers}/scroll-panel.css +0 -0
- /package/src/css/{containers → ui/containers}/split-panel.css +0 -0
- /package/src/css/{dom → ui/dom}/checkbox.css +0 -0
- /package/src/css/{dom → ui/dom}/scrollbar.css +0 -0
- /package/src/css/{dom → ui/dom}/select.css +0 -0
- /package/src/css/{form → ui/form}/mirrored-textarea.css +0 -0
- /package/src/rust/components/{form → code_editor}/highlight.rs +0 -0
- /package/src/rust/{components → ui}/containers/sidebar_close_button.rs +0 -0
- /package/src/rust/{components → ui}/form/number_input.rs +0 -0
package/src/rust/renderer.rs
CHANGED
|
@@ -112,6 +112,11 @@ pub struct RendererData {
|
|
|
112
112
|
/// plugin's bucket.
|
|
113
113
|
pub plugin_config_changed: PubSub<serde_json::Map<String, serde_json::Value>>,
|
|
114
114
|
|
|
115
|
+
/// Fires after the active plugin's per-column bucket changes by any path
|
|
116
|
+
/// (edit, restore or reset), unlike `column_style_changed` which covers
|
|
117
|
+
/// edits only.
|
|
118
|
+
pub columns_config_changed: PubSub<ColumnConfigMap>,
|
|
119
|
+
|
|
115
120
|
/// `true` while the active plugin's "rendering N of M" warning is
|
|
116
121
|
/// dismissable.
|
|
117
122
|
pub render_warning: Cell<bool>,
|
|
@@ -120,6 +125,10 @@ pub struct RendererData {
|
|
|
120
125
|
/// [`Renderer::presize_with_box`] presize calls.
|
|
121
126
|
presize_pending: Cell<u32>,
|
|
122
127
|
|
|
128
|
+
/// The `(width, height)` the plugin last painted at through a presize,
|
|
129
|
+
/// consumed by the post-commit reactive resize.
|
|
130
|
+
presized_box: Cell<Option<(f64, f64)>>,
|
|
131
|
+
|
|
123
132
|
/// Debounce slot for geometry tasks (`resize` / presize), separate from
|
|
124
133
|
/// the default slot data-update redraws coalesce on. Invariant: a
|
|
125
134
|
/// geometry request must never resolve via a parked DATA task — a
|
|
@@ -160,14 +169,7 @@ pub struct RendererData {
|
|
|
160
169
|
|
|
161
170
|
/// The effective theme stamped at the active plugin's last `--psp-*`
|
|
162
171
|
/// CSS CAPTURE — its first paint ([`Renderer::draw_view`]) or last
|
|
163
|
-
/// [`Renderer::restyle_all`].
|
|
164
|
-
/// state behind [`Renderer::needs_restyle`]: restyle necessity is a
|
|
165
|
-
/// comparison against what the plugin actually captured, never
|
|
166
|
-
/// inferred from which call site mutated a theme record (the
|
|
167
|
-
/// raycasting boot double render — see
|
|
168
|
-
/// `PLUGIN_DRAW_INVARIANT_PLAN.md`, captured-theme revision). Same
|
|
169
|
-
/// lifecycle as [`Self::has_drawn`]: cleared on plugin swap,
|
|
170
|
-
/// `dispose` and `delete`; written only inside locked dispatches.
|
|
172
|
+
/// [`Renderer::restyle_all`].
|
|
171
173
|
captured_theme: RefCell<Option<Option<String>>>,
|
|
172
174
|
|
|
173
175
|
/// The [`RenderContext`] of the currently-bound `View` (built at bind
|
|
@@ -266,8 +268,10 @@ impl Renderer {
|
|
|
266
268
|
selection_changed: Default::default(),
|
|
267
269
|
column_style_changed: Default::default(),
|
|
268
270
|
plugin_config_changed: Default::default(),
|
|
271
|
+
columns_config_changed: Default::default(),
|
|
269
272
|
render_warning: Cell::new(true),
|
|
270
273
|
presize_pending: Cell::new(0),
|
|
274
|
+
presized_box: Cell::new(None),
|
|
271
275
|
on_render_limits_changed: Default::default(),
|
|
272
276
|
slot_name: Default::default(),
|
|
273
277
|
theme: Default::default(),
|
|
@@ -315,14 +319,7 @@ impl Renderer {
|
|
|
315
319
|
|
|
316
320
|
/// Whether the active plugin's captured `--psp-*` CSS is STALE — the
|
|
317
321
|
/// effective theme differs from the one stamped at the plugin's last
|
|
318
|
-
/// CSS capture (first paint / last restyle).
|
|
319
|
-
/// every theme-driven `restyle_all` (the `has_drawn` analog for
|
|
320
|
-
/// `restyle` — `PLUGIN_DRAW_INVARIANT_PLAN.md`, captured-theme
|
|
321
|
-
/// revision): a caller that just mutated a theme RECORD may not need a
|
|
322
|
-
/// restyle at all if the plugin's capture already reflects the new
|
|
323
|
-
/// value (e.g. the same restore also performed the first paint,
|
|
324
|
-
/// post-stamp). `false` when no capture exists yet — the owed first
|
|
325
|
-
/// paint captures fresh by construction ("stamp before draw").
|
|
322
|
+
/// CSS capture (first paint / last restyle).
|
|
326
323
|
pub fn needs_restyle(&self) -> bool {
|
|
327
324
|
match &*self.0.captured_theme.borrow() {
|
|
328
325
|
Some(captured) => *captured != self.theme(),
|
|
@@ -336,17 +333,6 @@ impl Renderer {
|
|
|
336
333
|
/// [`Self::delete`], which clears the entire light DOM). Removes the
|
|
337
334
|
/// plugin (`slot=<id>`) and any panel-scoped aux element it mounted
|
|
338
335
|
/// (e.g. the datagrid toolbar, `slot=statusbar-extra-<id>`).
|
|
339
|
-
///
|
|
340
|
-
/// The teardown is DEFERRED through this renderer's draw lock: spawned
|
|
341
|
-
/// draws are uncancellable, so a synchronous `plugin.delete()` here could
|
|
342
|
-
/// land mid-`plugin.draw()`, which the serialized-call contract forbids
|
|
343
|
-
/// (see [`crate::js::plugin`]). Deferral is invisible — the caller
|
|
344
|
-
/// (`eject_panel`) has already removed the panel from the `Workspace`, so
|
|
345
|
-
/// the same commit unmounts its frame and the plugin element sits
|
|
346
|
-
/// unslotted (unrendered) until teardown lands; panel ids are never
|
|
347
|
-
/// reused, so it can't collide with a replacement panel's slot. Draws
|
|
348
|
-
/// still queued behind the lock no-op via the synchronous session reset
|
|
349
|
-
/// (`get_view()` → `None`).
|
|
350
336
|
pub fn dispose(&self) -> ApiFuture<()> {
|
|
351
337
|
self.0.has_drawn.set(false);
|
|
352
338
|
self.0.captured_theme.borrow_mut().take();
|
|
@@ -488,6 +474,12 @@ impl Renderer {
|
|
|
488
474
|
Ok(self.0.has_drawn.get())
|
|
489
475
|
}
|
|
490
476
|
|
|
477
|
+
/// Take the box the plugin last painted at through a presize (see
|
|
478
|
+
/// `RendererData::presized_box`).
|
|
479
|
+
pub fn take_presized_box(&self) -> Option<(f64, f64)> {
|
|
480
|
+
self.0.presized_box.take()
|
|
481
|
+
}
|
|
482
|
+
|
|
491
483
|
/// Mount the selected plugin element into the viewer's light DOM without
|
|
492
484
|
/// drawing it (see [`activate::mount_plugin`] — idempotent). Pure query:
|
|
493
485
|
/// a renderer with no selection is a no-op, deferring to the draw path's
|
|
@@ -695,6 +687,7 @@ impl Renderer {
|
|
|
695
687
|
/// suitable for passing as a Yew prop. Called by the root component
|
|
696
688
|
/// whenever a renderer-related PubSub event fires.
|
|
697
689
|
pub fn to_props(&self, render_limits: Option<RenderLimits>) -> RendererProps {
|
|
690
|
+
let render_limits = render_limits.filter(RenderLimits::is_capped);
|
|
698
691
|
let has_plugin = self.active_plugin().is_some();
|
|
699
692
|
if has_plugin {
|
|
700
693
|
let config = self.metadata();
|
|
@@ -708,6 +701,7 @@ impl Renderer {
|
|
|
708
701
|
.into();
|
|
709
702
|
|
|
710
703
|
let plugin_config = PtrEqRc::new(self.get_plugin_config());
|
|
704
|
+
let columns_config = PtrEqRc::new(self.all_columns_configs());
|
|
711
705
|
RendererProps {
|
|
712
706
|
plugin_name,
|
|
713
707
|
config,
|
|
@@ -715,6 +709,7 @@ impl Renderer {
|
|
|
715
709
|
available_plugins,
|
|
716
710
|
is_chart,
|
|
717
711
|
plugin_config,
|
|
712
|
+
columns_config,
|
|
718
713
|
}
|
|
719
714
|
} else {
|
|
720
715
|
RendererProps {
|
|
@@ -724,6 +719,7 @@ impl Renderer {
|
|
|
724
719
|
available_plugins: PtrEqRc::new(vec![]),
|
|
725
720
|
is_chart: false,
|
|
726
721
|
plugin_config: PtrEqRc::default(),
|
|
722
|
+
columns_config: PtrEqRc::default(),
|
|
727
723
|
}
|
|
728
724
|
}
|
|
729
725
|
}
|
|
@@ -19,14 +19,18 @@ use crate::session::column_defaults_update::ViewConfigUpdateExt;
|
|
|
19
19
|
use crate::session::drag_drop_update::ViewConfigExt as DragDropExt;
|
|
20
20
|
use crate::session::metadata::SessionMetadataRc;
|
|
21
21
|
use crate::session::replace_expression_update::ViewConfigExt as ReplaceExprExt;
|
|
22
|
-
use crate::session::{ColumnStats, TableErrorState
|
|
22
|
+
use crate::session::{ColumnStats, TableErrorState};
|
|
23
23
|
use crate::utils::*;
|
|
24
24
|
|
|
25
|
+
/// The panel's table binding as the status indicator and chrome see it:
|
|
26
|
+
/// bound, a `load()` in flight, or a named table awaiting its host (see
|
|
27
|
+
/// `Session::pending_table`).
|
|
25
28
|
#[derive(Clone, Debug, PartialEq, Default)]
|
|
26
29
|
pub enum TableLoadState {
|
|
27
30
|
#[default]
|
|
28
31
|
Loaded,
|
|
29
32
|
Loading,
|
|
33
|
+
Pending,
|
|
30
34
|
}
|
|
31
35
|
|
|
32
36
|
/// Value-semantic snapshot of the session state read by the root component.
|
|
@@ -39,8 +43,9 @@ pub struct SessionProps {
|
|
|
39
43
|
/// The current `ViewConfig` driving the active `View`.
|
|
40
44
|
pub config: PtrEqRc<ViewConfig>,
|
|
41
45
|
|
|
42
|
-
///
|
|
43
|
-
|
|
46
|
+
/// Whether the view stats carry table dimensions yet, the status
|
|
47
|
+
/// indicator's loaded/uninitialized split.
|
|
48
|
+
pub has_table_cells: bool,
|
|
44
49
|
|
|
45
50
|
/// `true` if a `Table` has been loaded into this session.
|
|
46
51
|
pub has_table: Option<TableLoadState>,
|
|
@@ -10,10 +10,11 @@
|
|
|
10
10
|
// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
|
|
11
11
|
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
|
12
12
|
|
|
13
|
-
use std::cell::Cell;
|
|
13
|
+
use std::cell::{Cell, RefCell};
|
|
14
14
|
use std::rc::Rc;
|
|
15
15
|
|
|
16
16
|
use perspective_client::config::*;
|
|
17
|
+
use perspective_client::proto::ViewDimensionsResp;
|
|
17
18
|
use perspective_client::{OnUpdateOptions, View};
|
|
18
19
|
use wasm_bindgen::prelude::*;
|
|
19
20
|
use yew::prelude::*;
|
|
@@ -41,6 +42,10 @@ struct ViewSubscriptionData {
|
|
|
41
42
|
on_stats: Callback<ViewStats>,
|
|
42
43
|
on_update: Option<Callback<()>>,
|
|
43
44
|
is_deleted: Rc<Cell<bool>>,
|
|
45
|
+
|
|
46
|
+
/// The bound `View`'s latest known dimensions, written before
|
|
47
|
+
/// `on_update`/`on_stats` fire.
|
|
48
|
+
dimensions: Rc<RefCell<Option<ViewDimensionsResp>>>,
|
|
44
49
|
}
|
|
45
50
|
|
|
46
51
|
/// A subscription to `on_update()` events from a Perspective `View()`, managing
|
|
@@ -52,20 +57,21 @@ pub struct ViewSubscription {
|
|
|
52
57
|
impl ViewSubscriptionData {
|
|
53
58
|
/// Main handler when underlying `View()` calls `on_update()`.
|
|
54
59
|
async fn on_view_update(self) -> ApiResult<JsValue> {
|
|
60
|
+
self.clone().update_view_stats().await?;
|
|
55
61
|
if let Some(on_update) = &self.on_update {
|
|
56
62
|
on_update.emit(());
|
|
57
63
|
};
|
|
58
64
|
|
|
59
|
-
self.clone().update_view_stats().await?;
|
|
60
65
|
Ok(JsValue::UNDEFINED)
|
|
61
66
|
}
|
|
62
67
|
|
|
63
68
|
async fn update_view_stats(self) -> ApiResult<JsValue> {
|
|
64
69
|
let dimensions = self.view.dimensions().await?;
|
|
65
|
-
let num_rows = dimensions.num_table_rows
|
|
66
|
-
let num_cols = dimensions.num_table_columns
|
|
67
|
-
let virtual_rows = dimensions.num_view_rows
|
|
68
|
-
let virtual_cols = dimensions.num_view_columns
|
|
70
|
+
let num_rows = dimensions.num_table_rows;
|
|
71
|
+
let num_cols = dimensions.num_table_columns;
|
|
72
|
+
let virtual_rows = dimensions.num_view_rows;
|
|
73
|
+
let virtual_cols = dimensions.num_view_columns;
|
|
74
|
+
*self.dimensions.borrow_mut() = Some(dimensions);
|
|
69
75
|
let stats = ViewStats {
|
|
70
76
|
num_table_cells: Some((num_rows, num_cols)),
|
|
71
77
|
num_view_cells: Some((virtual_rows, virtual_cols)),
|
|
@@ -119,6 +125,7 @@ impl ViewSubscription {
|
|
|
119
125
|
callback_id: Rc::default(),
|
|
120
126
|
on_update,
|
|
121
127
|
is_deleted: Rc::default(),
|
|
128
|
+
dimensions: Rc::default(),
|
|
122
129
|
};
|
|
123
130
|
|
|
124
131
|
if data.on_update.is_some() {
|
|
@@ -160,6 +167,12 @@ impl ViewSubscription {
|
|
|
160
167
|
&self.data.view
|
|
161
168
|
}
|
|
162
169
|
|
|
170
|
+
/// The bound `View`'s latest known dimensions (`None` until the first
|
|
171
|
+
/// fetch resolves).
|
|
172
|
+
pub fn dimensions(&self) -> Option<ViewDimensionsResp> {
|
|
173
|
+
self.data.dimensions.borrow().clone()
|
|
174
|
+
}
|
|
175
|
+
|
|
163
176
|
/// User-facing snapshot of the [`ViewConfig`] the bound `View` was
|
|
164
177
|
/// constructed from (the persisted config at build time — global-filter
|
|
165
178
|
/// overlay excluded). This is the [`ViewConfig`] consistent with the
|