@perspective-dev/viewer 5.2.0 → 5.3.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 (179) hide show
  1. package/dist/cdn/perspective-viewer.js +8 -8
  2. package/dist/cdn/perspective-viewer.js.map +3 -3
  3. package/dist/css/blueprint.css +1 -0
  4. package/dist/css/botanical.css +1 -1
  5. package/dist/css/dracula.css +1 -1
  6. package/dist/css/eggplant.css +1 -0
  7. package/dist/css/gruvbox-dark.css +1 -1
  8. package/dist/css/gruvbox.css +1 -1
  9. package/dist/css/icons.css +1 -1
  10. package/dist/css/intl/de.css +1 -1
  11. package/dist/css/intl/es.css +1 -1
  12. package/dist/css/intl/fr.css +1 -1
  13. package/dist/css/intl/ja.css +1 -1
  14. package/dist/css/intl/pt.css +1 -1
  15. package/dist/css/intl/zh.css +1 -1
  16. package/dist/css/intl.css +1 -1
  17. package/dist/css/ledger.css +1 -0
  18. package/dist/css/monokai.css +1 -1
  19. package/dist/css/nord.css +1 -0
  20. package/dist/css/phosphor.css +1 -1
  21. package/dist/css/pro-dark.css +1 -1
  22. package/dist/css/pro.css +1 -1
  23. package/dist/css/solarized-dark.css +1 -1
  24. package/dist/css/solarized.css +1 -1
  25. package/dist/css/themes.css +1 -1
  26. package/dist/css/vaporwave.css +1 -1
  27. package/dist/css/velvet.css +1 -0
  28. package/dist/docs/perspective-docs.json +1 -1
  29. package/dist/esm/column-format.d.ts +16 -3
  30. package/dist/esm/perspective-viewer.d.ts +1 -0
  31. package/dist/esm/perspective-viewer.inline.js +9 -9
  32. package/dist/esm/perspective-viewer.inline.js.map +3 -3
  33. package/dist/esm/perspective-viewer.js +8 -8
  34. package/dist/esm/perspective-viewer.js.map +3 -3
  35. package/dist/esm/plugin.d.ts +10 -0
  36. package/dist/esm/ts-rs/PanelViewerConfig.d.ts +1 -1
  37. package/dist/esm/ts-rs/SaveWorkspaceOptions.d.ts +10 -0
  38. package/dist/esm/ts-rs/ViewerConfig.d.ts +1 -1
  39. package/dist/esm/ts-rs/WorkspaceConfig.d.ts +9 -1
  40. package/dist/esm/ts-rs/WorkspaceConfigUpdate.d.ts +13 -3
  41. package/dist/wasm/perspective-viewer.d.ts +43 -36
  42. package/dist/wasm/perspective-viewer.js +198 -136
  43. package/dist/wasm/perspective-viewer.wasm +0 -0
  44. package/dist/wasm/perspective-viewer.wasm.d.ts +19 -17
  45. package/package.json +1 -1
  46. package/src/css/column-settings-panel.css +28 -5
  47. package/src/css/column-style.css +291 -31
  48. package/src/css/containers/tabs.css +13 -3
  49. package/src/css/dom/select.css +21 -9
  50. package/src/css/form/code-editor.css +4 -4
  51. package/src/css/plugin-selector.css +1 -0
  52. package/src/css/plugin-settings-panel.css +72 -0
  53. package/src/css/viewer.css +0 -5
  54. package/src/rust/agent/tools.rs +53 -19
  55. package/src/rust/components/column_selector/active_column.rs +2 -2
  56. package/src/rust/components/column_selector/add_expression_button.rs +3 -3
  57. package/src/rust/components/column_selector/aggregate_selector.rs +2 -3
  58. package/src/rust/components/column_selector/config_selector.rs +8 -0
  59. package/src/rust/components/column_selector/expr_edit_button.rs +4 -10
  60. package/src/rust/components/column_selector/inactive_column.rs +2 -2
  61. package/src/rust/components/column_selector.rs +48 -4
  62. package/src/rust/components/column_settings_sidebar/style_tab/primitive_field.rs +293 -126
  63. package/src/rust/components/column_settings_sidebar/style_tab.rs +330 -234
  64. package/src/rust/components/column_settings_sidebar.rs +88 -69
  65. package/src/rust/components/containers/control_group.rs +91 -0
  66. package/src/rust/components/containers/mod.rs +1 -0
  67. package/src/rust/components/containers/select.rs +8 -2
  68. package/src/rust/components/datetime_column_style/simple.rs +15 -4
  69. package/src/rust/components/datetime_column_style.rs +50 -10
  70. package/src/rust/components/editable_header.rs +85 -144
  71. package/src/rust/components/expression_editor.rs +9 -16
  72. package/src/rust/components/form/code_editor.rs +16 -6
  73. package/src/rust/components/form/debug.rs +1 -0
  74. package/src/rust/components/form/mod.rs +3 -1
  75. package/src/rust/components/form/multi_stop_gradient_selector.rs +476 -0
  76. package/src/rust/components/form/named_value_picker.rs +86 -0
  77. package/src/rust/components/form/palette_selector.rs +440 -0
  78. package/src/rust/components/main_panel/msg.rs +2 -2
  79. package/src/rust/components/main_panel/reconcile.rs +4 -4
  80. package/src/rust/components/plugin_tab.rs +126 -112
  81. package/src/rust/components/settings_panel.rs +26 -20
  82. package/src/rust/components/status_bar.rs +0 -1
  83. package/src/rust/components/style_controls/number_string_format/digits_section.rs +22 -10
  84. package/src/rust/components/style_controls/number_string_format/misc_section.rs +6 -2
  85. package/src/rust/components/style_controls/number_string_format/style_section.rs +1 -0
  86. package/src/rust/components/style_controls/number_string_format/types.rs +24 -0
  87. package/src/rust/components/style_controls/number_string_format.rs +37 -14
  88. package/src/rust/components/viewer/msg.rs +46 -7
  89. package/src/rust/components/viewer/panels.rs +11 -9
  90. package/src/rust/components/viewer/render.rs +8 -3
  91. package/src/rust/components/viewer/settings.rs +163 -23
  92. package/src/rust/components/viewer/snapshots.rs +46 -21
  93. package/src/rust/components/viewer/wiring.rs +14 -25
  94. package/src/rust/components/viewer.rs +12 -8
  95. package/src/rust/config/column_config_schema.rs +435 -45
  96. package/src/rust/config/css_scale.rs +882 -0
  97. package/src/rust/config/datetime_column_style.rs +4 -21
  98. package/src/rust/config/mod.rs +2 -0
  99. package/src/rust/config/number_string_format.rs +211 -18
  100. package/src/rust/config/options.rs +10 -0
  101. package/src/rust/config/viewer_config.rs +49 -55
  102. package/src/rust/config/workspace_config.rs +132 -5
  103. package/src/rust/custom_elements/viewer.rs +214 -155
  104. package/src/rust/custom_events.rs +14 -1
  105. package/src/rust/js/regular_layout.rs +3 -3
  106. package/src/rust/lib.rs +2 -0
  107. package/src/rust/presentation/column_locator.rs +19 -5
  108. package/src/rust/presentation.rs +209 -36
  109. package/src/rust/queries/column_locator.rs +74 -44
  110. package/src/rust/queries/get_viewer_config.rs +0 -3
  111. package/src/rust/queries/mod.rs +2 -0
  112. package/src/rust/queries/palette_set.rs +82 -0
  113. package/src/rust/queries/plugin_column_styles.rs +6 -2
  114. package/src/rust/renderer/dispatch.rs +50 -12
  115. package/src/rust/renderer/plugin_config.rs +362 -53
  116. package/src/rust/renderer.rs +15 -42
  117. package/src/rust/session/column_defaults_update.rs +15 -8
  118. package/src/rust/session/metadata.rs +5 -1
  119. package/src/rust/session/props.rs +1 -0
  120. package/src/rust/session.rs +9 -6
  121. package/src/rust/tasks/create_panel.rs +44 -57
  122. package/src/rust/tasks/edit_expression.rs +19 -23
  123. package/src/rust/tasks/edit_window.rs +8 -10
  124. package/src/rust/tasks/eject.rs +4 -1
  125. package/src/rust/tasks/pipeline.rs +2 -2
  126. package/src/rust/tasks/presize_panels.rs +44 -5
  127. package/src/rust/tasks/reset_all.rs +4 -4
  128. package/src/rust/tasks/restore_and_render.rs +17 -44
  129. package/src/rust/tasks/restore_panel.rs +11 -13
  130. package/src/rust/tasks/set_edit_mode.rs +3 -1
  131. package/src/rust/tasks/sync_update_panels.rs +11 -1
  132. package/src/rust/tasks/update_theme.rs +23 -18
  133. package/src/rust/utils/css_vars.rs +26 -0
  134. package/src/rust/utils/mod.rs +2 -0
  135. package/src/rust/utils/spawn.rs +1 -1
  136. package/src/rust/workspace.rs +435 -272
  137. package/src/svg/lock.svg +7 -0
  138. package/src/themes/blueprint.css +190 -0
  139. package/src/themes/botanical.css +14 -17
  140. package/src/themes/defaults.css +4 -110
  141. package/src/themes/dracula.css +19 -14
  142. package/src/themes/eggplant.css +189 -0
  143. package/src/themes/gruvbox-dark.css +23 -15
  144. package/src/themes/gruvbox.css +11 -1
  145. package/src/themes/icons.css +2 -2
  146. package/src/themes/intl/de.css +23 -1
  147. package/src/themes/intl/es.css +23 -1
  148. package/src/themes/intl/fr.css +23 -1
  149. package/src/themes/intl/ja.css +23 -1
  150. package/src/themes/intl/pt.css +23 -1
  151. package/src/themes/intl/zh.css +23 -1
  152. package/src/themes/intl.css +26 -4
  153. package/src/themes/ledger.css +195 -0
  154. package/src/themes/monokai.css +24 -14
  155. package/src/themes/nord.css +186 -0
  156. package/src/themes/phosphor.css +7 -14
  157. package/src/themes/pro-dark.css +12 -16
  158. package/src/themes/pro.css +118 -0
  159. package/src/themes/solarized-dark.css +9 -16
  160. package/src/themes/solarized.css +7 -0
  161. package/src/themes/themes.css +10 -5
  162. package/src/themes/vaporwave.css +22 -14
  163. package/src/themes/velvet.css +192 -0
  164. package/src/ts/column-format.ts +52 -2
  165. package/src/ts/perspective-viewer.ts +1 -0
  166. package/src/ts/plugin.ts +14 -0
  167. package/src/ts/ts-rs/PanelViewerConfig.ts +1 -1
  168. package/src/ts/ts-rs/SaveWorkspaceOptions.ts +11 -0
  169. package/src/ts/ts-rs/ViewerConfig.ts +1 -1
  170. package/src/ts/ts-rs/WorkspaceConfig.ts +8 -2
  171. package/src/ts/ts-rs/WorkspaceConfigUpdate.ts +11 -3
  172. package/src/rust/components/form/color_range_selector.rs +0 -137
  173. package/src/svg/dropdown-selector-light.svg +0 -3
  174. /package/dist/wasm/snippets/{perspective-viewer-02e461f3d7062b26 → perspective-viewer-87bd21b215d0631a}/inline0.js +0 -0
  175. /package/dist/wasm/snippets/{perspective-viewer-02e461f3d7062b26 → perspective-viewer-87bd21b215d0631a}/inline1.js +0 -0
  176. /package/dist/wasm/snippets/{perspective-viewer-02e461f3d7062b26 → perspective-viewer-87bd21b215d0631a}/inline2.js +0 -0
  177. /package/dist/wasm/snippets/{perspective-viewer-02e461f3d7062b26 → perspective-viewer-87bd21b215d0631a}/inline3.js +0 -0
  178. /package/dist/wasm/snippets/{perspective-viewer-02e461f3d7062b26 → perspective-viewer-87bd21b215d0631a}/inline4.js +0 -0
  179. /package/dist/wasm/snippets/{perspective-viewer-02e461f3d7062b26 → perspective-viewer-87bd21b215d0631a}/inline5.js +0 -0
@@ -4,7 +4,7 @@ import type { Layout } from "./Layout.js";
4
4
  import type { ViewerConfigInitial } from "./ViewerConfigInitial.js";
5
5
 
6
6
  /**
7
- * The parse target of a whole-element config in
7
+ * The parse target of a workspace config in
8
8
  * [`PerspectiveViewerElement::restoreWorkspace`]. Mirrors
9
9
  * [`WorkspaceConfig`], but `panels` entries are [`ViewerConfigInitial`]s —
10
10
  * every entry creates a NEW panel, so `table` is required by type (a
@@ -16,10 +16,18 @@ export type WorkspaceConfigUpdate = { active?: string, layout?: Layout, panels:
16
16
  * The element-level global (master/detail cross-) filters to re-apply as
17
17
  * a transient overlay on every DETAIL panel. Restored as one
18
18
  * unattributed bucket: the next selection on any master replaces it.
19
+ * `Option` so an explicit `undefined` property deserializes as
20
+ * `None` like an absent key (also `masters` / `palette` below).
19
21
  */
20
- global_filters?: Array<Filter>,
22
+ global_filters?: Array<Filter> | null,
21
23
  /**
22
24
  * The master (filter-source) panels, by saved `panels` key. An id not in
23
25
  * `panels` warns and is dropped.
24
26
  */
25
- masters?: Array<string>, };
27
+ masters?: Array<string> | null,
28
+ /**
29
+ * Named color-scale definitions to apply to the host (see
30
+ * [`WorkspaceConfig::palette`]), replacing any previously restored
31
+ * palette.
32
+ */
33
+ palette?: { [key in string]?: string } | null, };
@@ -1,137 +0,0 @@
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
- use wasm_bindgen::JsCast;
14
- use web_sys::*;
15
- use yew::prelude::*;
16
-
17
- #[derive(Properties, PartialEq, Clone)]
18
- pub struct ColorRangeProps {
19
- /// Extra class appended to the positive input's `class` attribute,
20
- /// so callers can target the pos / neg sides independently from CSS.
21
- /// Paired with `neg_class`; both default to empty.
22
- #[prop_or_default]
23
- pub pos_class: Classes,
24
- #[prop_or_default]
25
- pub neg_class: Classes,
26
- pub pos_color: String,
27
- pub neg_color: String,
28
- pub is_gradient: bool,
29
- pub on_pos_color: Callback<String>,
30
- pub on_neg_color: Callback<String>,
31
- pub on_reset: Callback<()>,
32
- pub is_modified: bool,
33
- }
34
-
35
- #[function_component(ColorRangeSelector)]
36
- pub fn color_chooser_component(props: &ColorRangeProps) -> Html {
37
- let on_pos_color = use_callback(
38
- props.on_pos_color.clone(),
39
- |event: InputEvent, on_pos_color| {
40
- let color = event
41
- .target()
42
- .unwrap()
43
- .unchecked_into::<HtmlInputElement>()
44
- .value();
45
- on_pos_color.emit(color);
46
- },
47
- );
48
-
49
- let on_neg_color = use_callback(
50
- props.on_neg_color.clone(),
51
- |event: InputEvent, on_neg_color| {
52
- let color = event
53
- .target()
54
- .unwrap()
55
- .unchecked_into::<HtmlInputElement>()
56
- .value();
57
- on_neg_color.emit(color);
58
- },
59
- );
60
-
61
- let fg_pos = infer_fg(&props.pos_color);
62
- let fg_neg = infer_fg(&props.neg_color);
63
- let style = if props.is_gradient {
64
- format!(
65
- "background:linear-gradient(to right, {} 0%, transparent 50%, {} 100%)",
66
- props.pos_color, props.neg_color
67
- )
68
- } else {
69
- format!(
70
- "background:linear-gradient(to right, {} 0%, {} 50%, {} 50%, {} 100%)",
71
- props.pos_color, props.pos_color, props.neg_color, props.neg_color
72
- )
73
- };
74
-
75
- let on_reset = use_callback(props.clone(), |_: MouseEvent, deps| deps.on_reset.emit(()));
76
-
77
- let pos_class = classes!("parameter", "pos-color-param", props.pos_class.clone());
78
- let neg_class = classes!("parameter", "neg-color-param", props.neg_class.clone());
79
-
80
- html! {
81
- <>
82
- <label id="color-range-label" />
83
- <div class="color-gradient-container">
84
- <div style={fg_pos} class="color-selector">
85
- <input
86
- class={pos_class}
87
- type="color"
88
- value={props.pos_color.to_owned()}
89
- data-value={props.pos_color.to_owned()}
90
- oninput={on_pos_color}
91
- />
92
- <label class="color-label">{ "+" }</label>
93
- </div>
94
- <div class="color-thermometer" {style} />
95
- <div style={fg_neg} class="color-selector">
96
- <input
97
- class={neg_class}
98
- type="color"
99
- value={props.neg_color.to_owned()}
100
- data-value={props.neg_color.to_owned()}
101
- oninput={on_neg_color}
102
- />
103
- <label class="color-label">{ "-" }</label>
104
- </div>
105
- if props.is_modified {
106
- <span class="reset-default-style" onclick={on_reset} />
107
- } else {
108
- <span class="reset-default-style-disabled" />
109
- }
110
- </div>
111
- </>
112
- }
113
- }
114
-
115
- fn infer_fg(color: &str) -> &'static str {
116
- if color.len() >= 7 {
117
- let r = i32::from_str_radix(&color[1..3], 16).unwrap_or(255) as f64;
118
- let g = i32::from_str_radix(&color[3..5], 16).unwrap_or(0) as f64;
119
- let b = i32::from_str_radix(&color[5..7], 16).unwrap_or(0) as f64;
120
- if (r * r * 0.299 + g * g * 0.587 + b * b * 0.114).sqrt() > 130.0 {
121
- "--sign--color:var(--psp--color)"
122
- } else {
123
- "--sign--color:var(--psp--background-color)"
124
- }
125
- } else if color.len() == 4 {
126
- let r = i32::from_str_radix(&color[1..2], 16).unwrap_or(15) as f64;
127
- let g = i32::from_str_radix(&color[2..3], 16).unwrap_or(0) as f64;
128
- let b = i32::from_str_radix(&color[3..4], 16).unwrap_or(0) as f64;
129
- if (r * r * 0.299 + g * g * 0.587 + b * b * 0.114).sqrt() > 8.0 {
130
- "--sign--color:var(--psp--color)"
131
- } else {
132
- "--sign--color:var(--psp--background-color)"
133
- }
134
- } else {
135
- "--sign--color:var(--psp--color)"
136
- }
137
- }
@@ -1,3 +0,0 @@
1
- <svg width="6" height="4" viewBox="0 0 6 4" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M1 1L3.17687 3.17687L5.35374 1" stroke="#ffffff" stroke-width="0.725624" stroke-linecap="round"/>
3
- </svg>