@perspective-dev/viewer 4.4.1 → 4.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 +1 -2
- 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/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/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/bootstrap.d.ts +2 -1
- package/dist/esm/column-format.d.ts +51 -0
- package/dist/esm/extensions.d.ts +2 -0
- package/dist/esm/perspective-viewer.d.ts +3 -1
- package/dist/esm/perspective-viewer.inline.js +1 -2
- package/dist/esm/perspective-viewer.inline.js.map +4 -4
- package/dist/esm/perspective-viewer.js +1 -2
- package/dist/esm/perspective-viewer.js.map +4 -4
- package/dist/esm/perspective-viewer.worker.d.ts +2 -0
- package/dist/esm/plugin.d.ts +16 -72
- package/dist/esm/ts-rs/ColumnSelectMode.d.ts +1 -0
- package/dist/esm/ts-rs/PluginStaticConfig.d.ts +77 -0
- package/dist/esm/ts-rs/ViewerConfig.d.ts +6 -3
- package/dist/esm/ts-rs/ViewerConfigUpdate.d.ts +7 -4
- package/dist/wasm/perspective-viewer.d.ts +77 -18
- package/dist/wasm/perspective-viewer.js +293 -144
- package/dist/wasm/perspective-viewer.wasm +0 -0
- package/dist/wasm/perspective-viewer.wasm.d.ts +20 -15
- package/package.json +24 -2
- package/src/css/column-selector.css +3 -2
- package/src/css/column-settings-panel.css +35 -6
- package/src/css/column-style.css +27 -2
- package/src/css/containers/scroll-panel.css +2 -1
- package/src/css/containers/tabs.css +8 -52
- package/src/css/dom/checkbox.css +0 -4
- package/src/css/form/code-editor.css +1 -0
- package/src/css/form/debug.css +3 -10
- package/src/css/plugin-selector.css +33 -0
- package/src/css/plugin-settings-panel.css +99 -0
- package/src/css/viewer.css +65 -3
- package/src/rust/components/column_dropdown.rs +3 -1
- package/src/rust/components/column_selector/active_column.rs +13 -19
- package/src/rust/components/column_selector/config_selector.rs +20 -20
- package/src/rust/components/column_selector/filter_column.rs +14 -14
- package/src/rust/components/column_selector/inactive_column.rs +9 -15
- package/src/rust/components/column_selector/pivot_column.rs +7 -7
- package/src/rust/components/column_selector/sort_column.rs +7 -7
- package/src/rust/components/column_selector.rs +55 -37
- package/src/rust/components/column_settings_sidebar/style_tab/agg_depth_selector.rs +15 -7
- package/src/rust/components/column_settings_sidebar/style_tab/primitive_field.rs +394 -0
- package/src/rust/components/column_settings_sidebar/style_tab/symbol.rs +15 -6
- package/src/rust/components/column_settings_sidebar/style_tab.rs +267 -136
- package/src/rust/components/column_settings_sidebar.rs +43 -49
- package/src/rust/components/containers/dragdrop_list.rs +5 -5
- package/src/rust/components/containers/mod.rs +0 -1
- package/src/rust/components/containers/scroll_panel.rs +21 -7
- package/src/rust/components/containers/sidebar.rs +8 -6
- package/src/rust/components/containers/split_panel.rs +3 -3
- package/src/rust/components/containers/tab_list.rs +3 -9
- package/src/rust/components/copy_dropdown.rs +2 -3
- package/src/rust/components/datetime_column_style.rs +19 -81
- package/src/rust/components/editable_header.rs +2 -3
- package/src/rust/components/export_dropdown.rs +2 -3
- package/src/rust/components/expression_editor.rs +29 -17
- package/src/rust/components/filter_dropdown.rs +2 -1
- package/src/rust/components/form/color_range_selector.rs +14 -7
- package/src/rust/components/form/debug.rs +47 -37
- package/src/rust/components/main_panel.rs +24 -65
- package/src/rust/components/mod.rs +2 -1
- package/src/rust/components/number_series_style.rs +161 -0
- package/src/rust/components/plugin_tab.rs +221 -0
- package/src/rust/components/settings_panel.rs +181 -59
- package/src/rust/components/status_bar.rs +140 -173
- package/src/rust/components/status_indicator.rs +15 -22
- package/src/rust/components/string_column_style.rs +20 -82
- package/src/rust/components/style_controls/number_string_format.rs +14 -30
- package/src/rust/components/viewer.rs +92 -131
- package/src/rust/config/column_config_schema.rs +195 -0
- package/src/rust/config/columns_config.rs +4 -97
- package/src/rust/config/datetime_column_style.rs +0 -5
- package/src/rust/config/mod.rs +8 -2
- package/src/rust/config/number_series_style.rs +79 -0
- package/src/rust/config/plugin_static_config.rs +144 -0
- package/src/rust/config/string_column_style.rs +0 -5
- package/src/rust/config/viewer_config.rs +5 -6
- package/src/rust/custom_elements/copy_dropdown.rs +30 -18
- package/src/rust/custom_elements/debug_plugin.rs +1 -3
- package/src/rust/custom_elements/export_dropdown.rs +26 -18
- package/src/rust/custom_elements/viewer.rs +62 -73
- package/src/rust/custom_events.rs +181 -224
- package/src/rust/js/plugin.rs +45 -117
- package/src/rust/lib.rs +34 -5
- package/src/rust/presentation/drag_helpers.rs +206 -0
- package/src/rust/presentation/props.rs +8 -0
- package/src/rust/presentation.rs +256 -41
- package/src/rust/{tasks → queries}/column_locator.rs +17 -73
- package/src/rust/queries/column_values.rs +59 -0
- package/src/rust/{tasks → queries}/columns_iter_set.rs +11 -18
- package/src/rust/queries/exports.rs +96 -0
- package/src/rust/queries/fetch_column_stats.rs +94 -0
- package/src/rust/queries/get_viewer_config.rs +54 -0
- package/src/rust/queries/mod.rs +44 -0
- package/src/rust/queries/plugin_column_styles.rs +101 -0
- package/src/rust/{engines.rs → queries/validate_expression.rs} +26 -15
- package/src/rust/renderer/activate.rs +1 -0
- package/src/rust/renderer/limits.rs +9 -4
- package/src/rust/renderer/plugin_store.rs +12 -0
- package/src/rust/renderer/props.rs +28 -3
- package/src/rust/renderer/registry.rs +40 -15
- package/src/rust/renderer.rs +640 -51
- package/src/rust/session/column_defaults_update.rs +20 -28
- package/src/rust/session/drag_drop_update.rs +10 -10
- package/src/rust/session/metadata.rs +31 -16
- package/src/rust/session/props.rs +15 -6
- package/src/rust/session/view_subscription.rs +10 -0
- package/src/rust/session.rs +109 -147
- package/src/rust/tasks/copy_export.rs +178 -158
- package/src/rust/tasks/{structural.rs → dismiss_render_warning.rs} +20 -40
- package/src/rust/tasks/edit_expression.rs +68 -88
- package/src/rust/tasks/eject.rs +25 -22
- package/src/rust/tasks/intersection_observer.rs +8 -21
- package/src/rust/tasks/mod.rs +19 -21
- package/src/rust/tasks/reset_all.rs +78 -0
- package/src/rust/tasks/resize_observer.rs +11 -33
- package/src/rust/tasks/restore_and_render.rs +117 -90
- package/src/rust/tasks/{get_viewer_config.rs → send_column_config.rs} +38 -35
- package/src/rust/tasks/send_plugin_config.rs +32 -33
- package/src/rust/tasks/update_and_render.rs +66 -47
- package/src/rust/{components/containers/trap_door_panel.rs → tasks/update_theme.rs} +34 -33
- package/src/rust/tasks/validate_expression.rs +61 -0
- package/src/rust/utils/browser/selection.rs +4 -4
- package/src/rust/utils/mod.rs +0 -63
- package/src/svg/mega-menu-icons-density.svg +23 -0
- package/src/svg/mega-menu-icons-map-density.svg +24 -0
- package/src/svg/mega-menu-icons-map-line.svg +19 -0
- package/src/themes/botanical.css +27 -53
- package/src/themes/defaults.css +24 -36
- package/src/themes/dracula.css +36 -54
- package/src/themes/gruvbox-dark.css +39 -59
- package/src/themes/gruvbox.css +16 -28
- package/src/themes/icons.css +3 -0
- package/src/themes/intl/de.css +42 -6
- package/src/themes/intl/es.css +42 -6
- package/src/themes/intl/fr.css +42 -6
- package/src/themes/intl/ja.css +42 -6
- package/src/themes/intl/pt.css +42 -6
- package/src/themes/intl/zh.css +42 -6
- package/src/themes/intl.css +37 -4
- package/src/themes/monokai.css +45 -61
- package/src/themes/phosphor.css +20 -29
- package/src/themes/pro-dark.css +25 -34
- package/src/themes/solarized-dark.css +21 -36
- package/src/themes/solarized.css +13 -23
- package/src/themes/vaporwave.css +40 -74
- package/src/ts/bootstrap.ts +14 -3
- package/src/ts/column-format.ts +162 -0
- package/src/ts/extensions.ts +4 -0
- package/src/ts/perspective-viewer.ts +9 -1
- package/src/{rust/components/column_settings_sidebar/style_tab/stub.rs → ts/perspective-viewer.worker.ts} +2 -22
- package/src/ts/plugin.ts +25 -101
- package/src/ts/ts-rs/{FormatUnit.ts → ColumnSelectMode.ts} +1 -1
- package/src/ts/ts-rs/PluginStaticConfig.ts +78 -0
- package/src/ts/ts-rs/ViewerConfig.ts +1 -2
- package/src/ts/ts-rs/ViewerConfigUpdate.ts +2 -3
- package/dist/esm/ts-rs/ColumnConfigValues.d.ts +0 -31
- package/dist/esm/ts-rs/CustomDatetimeFormat.d.ts +0 -1
- package/dist/esm/ts-rs/CustomDatetimeStyleConfig.d.ts +0 -15
- package/dist/esm/ts-rs/CustomNumberFormatConfig.d.ts +0 -18
- package/dist/esm/ts-rs/DatetimeColorMode.d.ts +0 -1
- package/dist/esm/ts-rs/DatetimeFormatType.d.ts +0 -6
- package/dist/esm/ts-rs/FormatMode.d.ts +0 -1
- package/dist/esm/ts-rs/FormatUnit.d.ts +0 -1
- package/dist/esm/ts-rs/NumberBackgroundMode.d.ts +0 -1
- package/dist/esm/ts-rs/NumberForegroundMode.d.ts +0 -1
- package/dist/esm/ts-rs/PluginConfig.d.ts +0 -2
- package/dist/esm/ts-rs/RoundingMode.d.ts +0 -1
- package/dist/esm/ts-rs/RoundingPriority.d.ts +0 -1
- package/dist/esm/ts-rs/SignDisplay.d.ts +0 -1
- package/dist/esm/ts-rs/SimpleDatetimeFormat.d.ts +0 -1
- package/dist/esm/ts-rs/SimpleDatetimeStyleConfig.d.ts +0 -6
- package/dist/esm/ts-rs/StringColorMode.d.ts +0 -1
- package/dist/esm/ts-rs/TrailingZeroDisplay.d.ts +0 -1
- package/dist/esm/ts-rs/UseGrouping.d.ts +0 -1
- package/src/rust/components/number_column_style.rs +0 -491
- package/src/rust/config/number_column_style.rs +0 -136
- package/src/rust/dragdrop.rs +0 -481
- package/src/rust/tasks/plugin_column_styles.rs +0 -98
- package/src/ts/ts-rs/ColumnConfigValues.ts +0 -14
- package/src/ts/ts-rs/CustomDatetimeFormat.ts +0 -3
- package/src/ts/ts-rs/CustomDatetimeStyleConfig.ts +0 -5
- package/src/ts/ts-rs/CustomNumberFormatConfig.ts +0 -8
- package/src/ts/ts-rs/DatetimeColorMode.ts +0 -3
- package/src/ts/ts-rs/DatetimeFormatType.ts +0 -8
- package/src/ts/ts-rs/FormatMode.ts +0 -3
- package/src/ts/ts-rs/NumberBackgroundMode.ts +0 -3
- package/src/ts/ts-rs/NumberForegroundMode.ts +0 -3
- package/src/ts/ts-rs/PluginConfig.ts +0 -4
- package/src/ts/ts-rs/RoundingMode.ts +0 -3
- package/src/ts/ts-rs/RoundingPriority.ts +0 -3
- package/src/ts/ts-rs/SignDisplay.ts +0 -3
- package/src/ts/ts-rs/SimpleDatetimeFormat.ts +0 -3
- package/src/ts/ts-rs/SimpleDatetimeStyleConfig.ts +0 -4
- package/src/ts/ts-rs/StringColorMode.ts +0 -3
- package/src/ts/ts-rs/TrailingZeroDisplay.ts +0 -3
- package/src/ts/ts-rs/UseGrouping.ts +0 -3
- /package/dist/wasm/snippets/{perspective-viewer-d924246f0b4a3dce → perspective-viewer-39ab7da3ca157861}/inline0.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-d924246f0b4a3dce → perspective-viewer-39ab7da3ca157861}/inline1.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-d924246f0b4a3dce → perspective-viewer-39ab7da3ca157861}/inline2.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-d924246f0b4a3dce → perspective-viewer-39ab7da3ca157861}/inline3.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-d924246f0b4a3dce → perspective-viewer-39ab7da3ca157861}/inline4.js +0 -0
- /package/src/rust/{tasks → config}/export_method.rs +0 -0
- /package/src/rust/{tasks → queries}/export_app.rs +0 -0
- /package/src/rust/{tasks → queries}/is_invalid_drop.rs +0 -0
package/src/themes/vaporwave.css
CHANGED
|
@@ -53,41 +53,33 @@ perspective-viewer[theme="Vaporwave"] {
|
|
|
53
53
|
--psp-datagrid--pos-cell--color: #7dc3f0;
|
|
54
54
|
--psp-datagrid--neg-cell--color: #ff9485;
|
|
55
55
|
|
|
56
|
-
/* perspective-viewer-pro-dark--
|
|
57
|
-
--psp-
|
|
58
|
-
--psp-
|
|
59
|
-
--psp-
|
|
60
|
-
--psp-
|
|
61
|
-
--psp-
|
|
62
|
-
--psp-
|
|
63
|
-
--psp-
|
|
64
|
-
--psp-
|
|
65
|
-
--psp-
|
|
66
|
-
--psp-
|
|
67
|
-
--psp-
|
|
68
|
-
--psp-
|
|
69
|
-
--psp-
|
|
70
|
-
--psp-
|
|
71
|
-
--psp-
|
|
72
|
-
--psp-
|
|
73
|
-
--psp-
|
|
74
|
-
--psp-
|
|
75
|
-
--psp-
|
|
76
|
-
--psp-
|
|
77
|
-
--psp-
|
|
78
|
-
--psp-
|
|
56
|
+
/* perspective-viewer-pro-dark--webgl (overrides) */
|
|
57
|
+
--psp-charts--legend--color: #c5c9d0;
|
|
58
|
+
--psp-charts--treemap--labels: white;
|
|
59
|
+
--psp-charts--treemap--hover-highlight: white;
|
|
60
|
+
--psp-charts--tooltip--color: white;
|
|
61
|
+
--psp-charts--axis-ticks--color: #c5c9d0;
|
|
62
|
+
--psp-charts--axis-lines--color: #61656e;
|
|
63
|
+
--psp-charts--gridline--color: #3b3f46;
|
|
64
|
+
--psp-charts--tooltip--background: rgba(42, 44, 47, 1);
|
|
65
|
+
--psp-charts--tooltip--border-color: #242526;
|
|
66
|
+
--psp-charts--legend--background: var(--psp--background-color);
|
|
67
|
+
--psp-charts--series--color: rgb(71, 120, 194);
|
|
68
|
+
--psp-charts--series-1--color: rgb(71, 120, 194);
|
|
69
|
+
--psp-charts--series-2--color: rgb(204, 120, 48);
|
|
70
|
+
--psp-charts--series-3--color: rgb(158, 84, 192);
|
|
71
|
+
--psp-charts--series-4--color: rgb(51, 150, 153);
|
|
72
|
+
--psp-charts--series-5--color: rgb(102, 114, 143);
|
|
73
|
+
--psp-charts--series-6--color: rgb(211, 103, 189);
|
|
74
|
+
--psp-charts--series-7--color: rgb(109, 124, 77);
|
|
75
|
+
--psp-charts--series-8--color: rgb(221, 99, 103);
|
|
76
|
+
--psp-charts--series-9--color: rgb(120, 104, 206);
|
|
77
|
+
--psp-charts--series-10--color: rgb(23, 166, 123);
|
|
78
|
+
--psp-charts--gradient--background: linear-gradient(
|
|
79
79
|
#dd6367 0%,
|
|
80
80
|
#242526 50%,
|
|
81
81
|
#3289c8 100%
|
|
82
82
|
);
|
|
83
|
-
--psp-d3fc--pos-gradient--background: linear-gradient(
|
|
84
|
-
#242526 0%,
|
|
85
|
-
#3289c8 100%
|
|
86
|
-
);
|
|
87
|
-
--psp-d3fc--neg-gradient--background: linear-gradient(
|
|
88
|
-
#dd6367 0%,
|
|
89
|
-
#242526 100%
|
|
90
|
-
);
|
|
91
83
|
|
|
92
84
|
/* perspective-viewer-pro-dark--openlayers (overrides) */
|
|
93
85
|
--psp-openlayers--tile-url: "http://{a-c}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png";
|
|
@@ -143,49 +135,23 @@ perspective-viewer[theme="Vaporwave"] {
|
|
|
143
135
|
background-position: 0px -10px;
|
|
144
136
|
}
|
|
145
137
|
|
|
146
|
-
/* perspective-viewer-vaporwave--
|
|
147
|
-
--psp-
|
|
148
|
-
--psp-
|
|
149
|
-
--psp-
|
|
150
|
-
--psp-
|
|
151
|
-
--psp-
|
|
152
|
-
--psp-
|
|
153
|
-
--psp-
|
|
154
|
-
--psp-
|
|
155
|
-
|
|
156
|
-
--psp-
|
|
157
|
-
--psp-
|
|
158
|
-
--psp-
|
|
159
|
-
--psp-
|
|
160
|
-
--psp-
|
|
161
|
-
|
|
162
|
-
--psp-
|
|
163
|
-
#f3d431,
|
|
164
|
-
#efb92d,
|
|
165
|
-
#ed9c25,
|
|
166
|
-
#eb7e20,
|
|
167
|
-
#e75d1e,
|
|
168
|
-
#d14632,
|
|
169
|
-
#b03e38,
|
|
170
|
-
#8c3a36,
|
|
171
|
-
#643633,
|
|
172
|
-
#07081d
|
|
173
|
-
) !important;
|
|
174
|
-
|
|
175
|
-
--psp-d3fc--pos-gradient--background: linear-gradient(
|
|
176
|
-
#07081d,
|
|
177
|
-
#2e4463,
|
|
178
|
-
#1e588a,
|
|
179
|
-
#086da7,
|
|
180
|
-
#0082b9,
|
|
181
|
-
#039ac7,
|
|
182
|
-
#12b1d4,
|
|
183
|
-
#2bc8e2,
|
|
184
|
-
#3ddff0,
|
|
185
|
-
#61f4fb
|
|
186
|
-
) !important;
|
|
187
|
-
|
|
188
|
-
--psp-d3fc--full-gradient--background: linear-gradient(
|
|
138
|
+
/* perspective-viewer-vaporwave--webgl */
|
|
139
|
+
--psp-charts--axis-ticks--color: #49acff;
|
|
140
|
+
--psp-charts--gridline--color: rgb(19, 33, 50);
|
|
141
|
+
--psp-charts--series--color: #01cdfe;
|
|
142
|
+
--psp-charts--series-1--color: #01cdfe;
|
|
143
|
+
--psp-charts--series-2--color: #ff71ce;
|
|
144
|
+
--psp-charts--series-3--color: #05ffa1;
|
|
145
|
+
--psp-charts--series-4--color: #b967ff;
|
|
146
|
+
--psp-charts--series-5--color: #fffb96;
|
|
147
|
+
|
|
148
|
+
--psp-charts--series-6--color: hsl(192, 99%, 25%);
|
|
149
|
+
--psp-charts--series-7--color: hsl(321, 100%, 36%);
|
|
150
|
+
--psp-charts--series-8--color: hsl(192, 99%, 25%);
|
|
151
|
+
--psp-charts--series-9--color: hsl(157, 100%, 25%);
|
|
152
|
+
--psp-charts--series-10--color: hsl(272, 100%, 35%);
|
|
153
|
+
|
|
154
|
+
--psp-charts--gradient--background: linear-gradient(
|
|
189
155
|
#f3d431,
|
|
190
156
|
#efb92d,
|
|
191
157
|
#ed9c25,
|
package/src/ts/bootstrap.ts
CHANGED
|
@@ -10,17 +10,28 @@
|
|
|
10
10
|
// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
|
|
11
11
|
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
|
12
12
|
|
|
13
|
-
import * as
|
|
13
|
+
import type * as wasm_module_type from "../../dist/wasm/perspective-viewer.js";
|
|
14
14
|
import { load_wasm_stage_0 } from "@perspective-dev/client/src/ts/wasm/decompress.ts";
|
|
15
15
|
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
import * as worker_url from "./perspective-viewer.worker";
|
|
18
|
+
|
|
16
19
|
export async function init_client(
|
|
17
20
|
wasm_binary:
|
|
18
21
|
| Promise<Response | ArrayBuffer | Uint8Array>
|
|
19
22
|
| Response
|
|
20
23
|
| ArrayBuffer
|
|
21
24
|
| Uint8Array,
|
|
25
|
+
wasm_module?: typeof wasm_module_type,
|
|
22
26
|
) {
|
|
23
|
-
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
const url = await worker_url.getWorkerURL();
|
|
29
|
+
if (wasm_module === undefined) {
|
|
30
|
+
wasm_module = (await import(url)) as typeof wasm_module_type;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const unzipped = await load_wasm_stage_0(wasm_binary);
|
|
34
|
+
const module_or_path = await WebAssembly.compile(unzipped as BufferSource);
|
|
24
35
|
await wasm_module.default({ module_or_path });
|
|
25
|
-
await wasm_module.init();
|
|
36
|
+
await wasm_module.init(module_or_path, url);
|
|
26
37
|
}
|
|
@@ -0,0 +1,162 @@
|
|
|
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
|
+
/**
|
|
14
|
+
* Cross-package helpers for per-column value formatting. Used by both
|
|
15
|
+
* `viewer-datagrid` (cell formatting) and `viewer-charts` (axis ticks,
|
|
16
|
+
* tooltips, legends) so a column's `number_format` / `date_format`
|
|
17
|
+
* configuration produces identical output across plugins.
|
|
18
|
+
*
|
|
19
|
+
* The format configs mirror the `Intl.NumberFormatOptions` /
|
|
20
|
+
* `Intl.DateTimeFormatOptions` shapes one-for-one — they're written
|
|
21
|
+
* straight into the respective constructors. The `date_format.format`
|
|
22
|
+
* discriminator ("simple" | "custom") selects between two derivation
|
|
23
|
+
* paths: simple uses `dateStyle` / `timeStyle`, custom uses the
|
|
24
|
+
* per-field overrides (year / month / day / ...).
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
export interface NumberFormatConfig {
|
|
28
|
+
style?: "decimal" | "currency" | "percent" | "unit";
|
|
29
|
+
minimumFractionDigits?: number;
|
|
30
|
+
maximumFractionDigits?: number;
|
|
31
|
+
minimumIntegerDigits?: number;
|
|
32
|
+
minimumSignificantDigits?: number;
|
|
33
|
+
maximumSignificantDigits?: number;
|
|
34
|
+
currency?: string;
|
|
35
|
+
currencyDisplay?: "code" | "symbol" | "narrowSymbol" | "name";
|
|
36
|
+
notation?: "standard" | "scientific" | "engineering" | "compact";
|
|
37
|
+
compactDisplay?: "short" | "long";
|
|
38
|
+
useGrouping?: boolean;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface DateFormatConfig {
|
|
42
|
+
format?: "custom" | string;
|
|
43
|
+
timeZone?: string;
|
|
44
|
+
dateStyle?: "short" | "medium" | "long" | "full" | "disabled";
|
|
45
|
+
timeStyle?: "short" | "medium" | "long" | "full" | "disabled";
|
|
46
|
+
second?: "numeric" | "2-digit" | "disabled";
|
|
47
|
+
minute?: "numeric" | "2-digit" | "disabled";
|
|
48
|
+
hour?: "numeric" | "2-digit" | "disabled";
|
|
49
|
+
day?: "numeric" | "2-digit" | "disabled";
|
|
50
|
+
weekday?: "narrow" | "short" | "long" | "disabled";
|
|
51
|
+
month?: "numeric" | "2-digit" | "narrow" | "short" | "long" | "disabled";
|
|
52
|
+
year?: "numeric" | "2-digit" | "disabled";
|
|
53
|
+
hour12?: boolean;
|
|
54
|
+
fractionalSecondDigits?: 1 | 2 | 3;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Default `Intl.NumberFormatOptions` applied when a numeric column has no
|
|
59
|
+
* `number_format` configured. Float columns get two fractional digits to
|
|
60
|
+
* match the legacy datagrid behavior; integer columns get an empty
|
|
61
|
+
* options bag (locale-default integer rendering).
|
|
62
|
+
*/
|
|
63
|
+
const NUMERIC_LEGACY_DEFAULTS: Record<string, Intl.NumberFormatOptions> = {
|
|
64
|
+
float: {
|
|
65
|
+
style: "decimal",
|
|
66
|
+
minimumFractionDigits: 2,
|
|
67
|
+
maximumFractionDigits: 2,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Default `Intl.DateTimeFormatOptions` applied when a datetime column has
|
|
73
|
+
* no `date_format` configured.
|
|
74
|
+
*/
|
|
75
|
+
const DATETIME_LEGACY_DEFAULTS: Intl.DateTimeFormatOptions = {
|
|
76
|
+
dateStyle: "short",
|
|
77
|
+
timeStyle: "medium",
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const DATE_LEGACY_DEFAULTS: Intl.DateTimeFormatOptions = {
|
|
81
|
+
dateStyle: "short",
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export function createNumberFormatter(
|
|
85
|
+
type: string,
|
|
86
|
+
cfg?: NumberFormatConfig,
|
|
87
|
+
): Intl.NumberFormat {
|
|
88
|
+
const opts: Intl.NumberFormatOptions =
|
|
89
|
+
cfg ?? NUMERIC_LEGACY_DEFAULTS[type] ?? {};
|
|
90
|
+
return new Intl.NumberFormat(navigator.languages as string[], opts);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function createDatetimeFormatter(
|
|
94
|
+
cfg?: DateFormatConfig,
|
|
95
|
+
): Intl.DateTimeFormat {
|
|
96
|
+
if (!cfg || cfg.format !== "custom") {
|
|
97
|
+
const opts: Intl.DateTimeFormatOptions = {
|
|
98
|
+
timeZone: cfg?.timeZone,
|
|
99
|
+
dateStyle:
|
|
100
|
+
cfg?.dateStyle === "disabled"
|
|
101
|
+
? undefined
|
|
102
|
+
: (cfg?.dateStyle ?? DATETIME_LEGACY_DEFAULTS.dateStyle),
|
|
103
|
+
timeStyle:
|
|
104
|
+
cfg?.timeStyle === "disabled"
|
|
105
|
+
? undefined
|
|
106
|
+
: (cfg?.timeStyle ?? DATETIME_LEGACY_DEFAULTS.timeStyle),
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
return new Intl.DateTimeFormat(navigator.languages as string[], opts);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const opts: Intl.DateTimeFormatOptions = {
|
|
113
|
+
timeZone: cfg.timeZone,
|
|
114
|
+
hour12: cfg.hour12 ?? true,
|
|
115
|
+
fractionalSecondDigits: cfg.fractionalSecondDigits,
|
|
116
|
+
};
|
|
117
|
+
if (cfg.year !== "disabled") {
|
|
118
|
+
opts.year = cfg.year ?? "2-digit";
|
|
119
|
+
}
|
|
120
|
+
if (cfg.month !== "disabled") {
|
|
121
|
+
opts.month = cfg.month ?? "numeric";
|
|
122
|
+
}
|
|
123
|
+
if (cfg.day !== "disabled") {
|
|
124
|
+
opts.day = cfg.day ?? "numeric";
|
|
125
|
+
}
|
|
126
|
+
if (cfg.weekday && cfg.weekday !== "disabled") {
|
|
127
|
+
opts.weekday = cfg.weekday;
|
|
128
|
+
}
|
|
129
|
+
if (cfg.hour !== "disabled") {
|
|
130
|
+
opts.hour = cfg.hour ?? "numeric";
|
|
131
|
+
}
|
|
132
|
+
if (cfg.minute !== "disabled") {
|
|
133
|
+
opts.minute = cfg.minute ?? "numeric";
|
|
134
|
+
}
|
|
135
|
+
if (cfg.second !== "disabled") {
|
|
136
|
+
opts.second = cfg.second ?? "numeric";
|
|
137
|
+
}
|
|
138
|
+
return new Intl.DateTimeFormat(navigator.languages as string[], opts);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export function createDateFormatter(
|
|
142
|
+
cfg?: DateFormatConfig,
|
|
143
|
+
): Intl.DateTimeFormat {
|
|
144
|
+
const opts: Intl.DateTimeFormatOptions = {
|
|
145
|
+
timeZone: "utc",
|
|
146
|
+
dateStyle:
|
|
147
|
+
cfg?.dateStyle === "disabled"
|
|
148
|
+
? undefined
|
|
149
|
+
: (cfg?.dateStyle ?? DATE_LEGACY_DEFAULTS.dateStyle),
|
|
150
|
+
};
|
|
151
|
+
return new Intl.DateTimeFormat(navigator.languages as string[], opts);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Recover the source column name from a synthetic split-by path. Split
|
|
156
|
+
* pivoting produces paths of the form `<split_val_1>|...|<source_col>`;
|
|
157
|
+
* per-column config (formatters, aggregate styling, …) is always keyed
|
|
158
|
+
* on the trailing source column.
|
|
159
|
+
*/
|
|
160
|
+
export function sourceColumn(path: string): string {
|
|
161
|
+
return path.split("|").at(-1) ?? path;
|
|
162
|
+
}
|
package/src/ts/extensions.ts
CHANGED
|
@@ -178,6 +178,10 @@ export interface PerspectiveViewerElementExt {
|
|
|
178
178
|
*/
|
|
179
179
|
registerPlugin(name: string): Promise<void>;
|
|
180
180
|
|
|
181
|
+
get_wasm_module(): WebAssembly.Module;
|
|
182
|
+
|
|
183
|
+
get_worker_url(): URL;
|
|
184
|
+
|
|
181
185
|
addEventListener(
|
|
182
186
|
name: "perspective-click",
|
|
183
187
|
cb: (e: CustomEvent) => void,
|
|
@@ -34,14 +34,22 @@
|
|
|
34
34
|
export { IPerspectiveViewerPlugin } from "./plugin";
|
|
35
35
|
export { HTMLPerspectiveViewerPluginElement } from "./plugin";
|
|
36
36
|
|
|
37
|
+
export {
|
|
38
|
+
createNumberFormatter,
|
|
39
|
+
createDatetimeFormatter,
|
|
40
|
+
createDateFormatter,
|
|
41
|
+
sourceColumn,
|
|
42
|
+
} from "./column-format";
|
|
43
|
+
export type { NumberFormatConfig, DateFormatConfig } from "./column-format";
|
|
44
|
+
|
|
37
45
|
export type * from "./extensions.ts";
|
|
38
46
|
export { PerspectiveSelectDetail } from "./extensions.ts";
|
|
39
47
|
export type * from "./ts-rs/ViewerConfigUpdate.d.ts";
|
|
40
48
|
export type * from "./ts-rs/ViewerConfig.d.ts";
|
|
41
|
-
export type * from "./ts-rs/ColumnConfigValues.d.ts";
|
|
42
49
|
export type * from "./ts-rs/Filter.d.ts";
|
|
43
50
|
export type * from "./ts-rs/FilterTerm.d.ts";
|
|
44
51
|
export type * from "./ts-rs/FilterReducer.d.ts";
|
|
52
|
+
export type * from "./ts-rs/PluginStaticConfig.ts";
|
|
45
53
|
|
|
46
54
|
export { init_client } from "./bootstrap";
|
|
47
55
|
import { init_client } from "./bootstrap";
|
|
@@ -10,25 +10,5 @@
|
|
|
10
10
|
// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
|
|
11
11
|
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
#[derive(Properties, PartialEq)]
|
|
16
|
-
pub struct StubProps {
|
|
17
|
-
pub error: Option<String>,
|
|
18
|
-
pub message: String,
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
#[function_component(Stub)]
|
|
22
|
-
pub fn stub(p: &StubProps) -> Html {
|
|
23
|
-
if let Some(error) = p.error.clone() {
|
|
24
|
-
tracing::error!("Rendered stub: {error}");
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
html! {
|
|
28
|
-
<div class="style_contents">
|
|
29
|
-
<div id="column-style-container" class="no-style">
|
|
30
|
-
<div class="style-contents">{ p.message.clone() }</div>
|
|
31
|
-
</div>
|
|
32
|
-
</div>
|
|
33
|
-
}
|
|
34
|
-
}
|
|
13
|
+
export * from "../../dist/wasm/perspective-viewer.js";
|
|
14
|
+
export { default } from "../../dist/wasm/perspective-viewer.js";
|
package/src/ts/plugin.ts
CHANGED
|
@@ -11,8 +11,7 @@
|
|
|
11
11
|
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
|
12
12
|
|
|
13
13
|
import type { View } from "@perspective-dev/client";
|
|
14
|
-
|
|
15
|
-
// import type * as perspective from "@perspective-dev/client";
|
|
14
|
+
import { PluginStaticConfig } from "./ts-rs/PluginStaticConfig.js";
|
|
16
15
|
|
|
17
16
|
/**
|
|
18
17
|
* The `IPerspectiveViewerPlugin` interface defines the necessary API for a
|
|
@@ -21,7 +20,8 @@ import type { View } from "@perspective-dev/client";
|
|
|
21
20
|
* scratch however, the simplest way is to inherit from
|
|
22
21
|
* `<perspective-viewer-plugin>`, which implements `IPerspectiveViewerPlugin`
|
|
23
22
|
* with non-offensive default implementations, where only the `draw()` and
|
|
24
|
-
* `
|
|
23
|
+
* `get_static_config()` methods need be overridden to get started with a
|
|
24
|
+
* simple plugin.
|
|
25
25
|
*
|
|
26
26
|
* Note that plugins are frozen once a `<perspective-viewer>` has been
|
|
27
27
|
* instantiated, so generally new plugin code must be executed at the module
|
|
@@ -32,8 +32,8 @@ import type { View } from "@perspective-dev/client";
|
|
|
32
32
|
* ```javascript
|
|
33
33
|
* const BasePlugin = customElements.get("perspective-viewer-plugin");
|
|
34
34
|
* class MyPlugin extends BasePlugin {
|
|
35
|
-
*
|
|
36
|
-
* return "My Plugin";
|
|
35
|
+
* get_static_config() {
|
|
36
|
+
* return { name: "My Plugin", config_column_names: [] };
|
|
37
37
|
* }
|
|
38
38
|
* async draw(view) {
|
|
39
39
|
* const count = await view.num_rows();
|
|
@@ -49,63 +49,17 @@ import type { View } from "@perspective-dev/client";
|
|
|
49
49
|
*/
|
|
50
50
|
export interface IPerspectiveViewerPlugin {
|
|
51
51
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*/
|
|
56
|
-
get name(): string;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Select mode determines how column add/remove buttons behave for this
|
|
60
|
-
* plugin. `"select"` mode exclusively selects the added column, removing
|
|
61
|
-
* other columns. `"toggle"` mode toggles the column on or off (dependent
|
|
62
|
-
* on column state), leaving existing columns alone.
|
|
63
|
-
*/
|
|
64
|
-
get select_mode(): string | undefined;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* The minimum number of columns required for this plugin to operate.
|
|
68
|
-
* This mostly affects drag/drop and column remove button behavior,
|
|
69
|
-
* preventing the use from applying configs which violate this min.
|
|
70
|
-
*
|
|
71
|
-
* While this option can technically be `undefined` (as in the case of
|
|
72
|
-
* `@perspective-dev/viewer-datagrid`), doing so currently has nearly
|
|
73
|
-
* identical behavior to 1.
|
|
74
|
-
*/
|
|
75
|
-
get min_config_columns(): number | undefined;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* The named column labels, if desired. Named columns behave differently
|
|
79
|
-
* in drag/drop mode than unnamed columns, having replace/swap behavior
|
|
80
|
-
* rather than insert. If provided, the length of `config_column_names`
|
|
81
|
-
* _must_ be `>= min_config_columns`, as this is assumed by the drag/drop
|
|
82
|
-
* logic.
|
|
83
|
-
*/
|
|
84
|
-
get config_column_names(): string[] | undefined;
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* The load priority of the plugin. If the plugin shares priority with another,
|
|
88
|
-
* the first to load has a higher priority.
|
|
89
|
-
*
|
|
90
|
-
* A larger number has a higher priority.
|
|
91
|
-
*
|
|
92
|
-
* The plugin with the highest priority will be loaded by default by the Perspective viewer.
|
|
93
|
-
* If you would like to instead begin with a lower priority plugin, choose it explicitly with
|
|
94
|
-
* a `HTMLPerspectiveViewerPluginElement.restore` call.
|
|
95
|
-
*/
|
|
96
|
-
get priority(): number | undefined;
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Given a column's grouping (determined by indexing it in `plugin.config_column_names`)
|
|
100
|
-
* and its view type, determines whether or not to render column styles in the settings sidebar.
|
|
101
|
-
* Implementing this function and `column_style_config` allows the plugin to interface with the viewer's column configuration API.
|
|
52
|
+
* Static plugin configuration. Called exactly once per plugin at
|
|
53
|
+
* registration time and cached; the result must be stable for the
|
|
54
|
+
* lifetime of the application.
|
|
102
55
|
*/
|
|
103
|
-
|
|
56
|
+
get_static_config(): PluginStaticConfig;
|
|
104
57
|
|
|
105
58
|
/**
|
|
106
59
|
* Determines which column configuration controls are populated in the viewer.
|
|
107
|
-
* Corresponds to the data the plugin will recieve on save.
|
|
108
|
-
*
|
|
60
|
+
* Corresponds to the data the plugin will recieve on save. Only
|
|
61
|
+
* invoked when `can_render_column_styles` is `true` in the static
|
|
62
|
+
* config.
|
|
109
63
|
*/
|
|
110
64
|
column_style_config?: (view_type: string, group: string) => any;
|
|
111
65
|
|
|
@@ -163,20 +117,7 @@ export interface IPerspectiveViewerPlugin {
|
|
|
163
117
|
* Notify the plugin that the style environment has changed. Useful for
|
|
164
118
|
* plugins which read CSS styles via `window.getComputedStyle()`.
|
|
165
119
|
*/
|
|
166
|
-
restyle(
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Save this plugin's state to a JSON-serializable value. While this value
|
|
170
|
-
* can be anything, it should work reciprocally with `restore()` to return
|
|
171
|
-
* this plugin's renderer to the same state, though potentially with a
|
|
172
|
-
* different `View`.
|
|
173
|
-
*
|
|
174
|
-
* `save()` should be used for user-persistent settings that are
|
|
175
|
-
* data-agnostic, so the user can have persistent view during refresh or
|
|
176
|
-
* reload. For example, `@perspective-dev/viewer-d3fc` uses
|
|
177
|
-
* `plugin_config` to remember the user-repositionable legend coordinates.
|
|
178
|
-
*/
|
|
179
|
-
save(): any;
|
|
120
|
+
restyle(): void;
|
|
180
121
|
|
|
181
122
|
/**
|
|
182
123
|
* Restore this plugin to a state previously returned by `save()`.
|
|
@@ -213,33 +154,16 @@ export class HTMLPerspectiveViewerPluginElement
|
|
|
213
154
|
super();
|
|
214
155
|
}
|
|
215
156
|
|
|
216
|
-
|
|
217
|
-
return
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
get min_config_columns(): number | undefined {
|
|
225
|
-
return undefined;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
get config_column_names(): string[] | undefined {
|
|
229
|
-
return undefined;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
get priority(): number {
|
|
233
|
-
return 0;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
can_render_column_styles(): boolean {
|
|
237
|
-
return false;
|
|
157
|
+
get_static_config(): PluginStaticConfig {
|
|
158
|
+
return {
|
|
159
|
+
name: "Debug",
|
|
160
|
+
select_mode: "select",
|
|
161
|
+
config_column_names: [],
|
|
162
|
+
};
|
|
238
163
|
}
|
|
239
164
|
|
|
240
165
|
column_style_config(): any {
|
|
241
|
-
{
|
|
242
|
-
}
|
|
166
|
+
return {};
|
|
243
167
|
}
|
|
244
168
|
|
|
245
169
|
async update(view: View): Promise<void> {
|
|
@@ -261,11 +185,7 @@ export class HTMLPerspectiveViewerPluginElement
|
|
|
261
185
|
// Not Implemented
|
|
262
186
|
}
|
|
263
187
|
|
|
264
|
-
|
|
265
|
-
// Not Implemented
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
save(): any {
|
|
188
|
+
restyle() {
|
|
269
189
|
// Not Implemented
|
|
270
190
|
}
|
|
271
191
|
|
|
@@ -276,4 +196,8 @@ export class HTMLPerspectiveViewerPluginElement
|
|
|
276
196
|
async delete(): Promise<void> {
|
|
277
197
|
// Not Implemented
|
|
278
198
|
}
|
|
199
|
+
|
|
200
|
+
get supports_streaming(): boolean {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
279
203
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
2
|
+
import type { ColumnSelectMode } from "./ColumnSelectMode.js";
|
|
3
|
+
import type { GroupRollupMode } from "./GroupRollupMode.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Static, immutable configuration for a plugin.
|
|
7
|
+
*
|
|
8
|
+
* Returned once per plugin from `get_static_config()` at registration
|
|
9
|
+
* time and cached in [`crate::renderer::PluginRecord`]. Consumers
|
|
10
|
+
* (renderer, session, queries, components) read these fields off the
|
|
11
|
+
* renderer's active-plugin metadata rather than calling back into JS.
|
|
12
|
+
*
|
|
13
|
+
* `<perspective-viewer>` reads this exactly once per plugin (at
|
|
14
|
+
* `registerPlugin` time) and caches it for the lifetime of the
|
|
15
|
+
* application. The result must be stable; do not mutate any field
|
|
16
|
+
* after registration.
|
|
17
|
+
*/
|
|
18
|
+
export type PluginStaticConfig = {
|
|
19
|
+
/**
|
|
20
|
+
* The unique key for this plugin. Used as the `plugin` field in a
|
|
21
|
+
* `ViewerConfig` and as the display name key in the
|
|
22
|
+
* `<perspective-viewer>` UI.
|
|
23
|
+
*/
|
|
24
|
+
name: string,
|
|
25
|
+
/**
|
|
26
|
+
* Category in the plugin picker menu.
|
|
27
|
+
*/
|
|
28
|
+
category?: string | null,
|
|
29
|
+
/**
|
|
30
|
+
* Soft limit on the number of columns the plugin will render.
|
|
31
|
+
* Triggers the "Rendering N of M" warning when the view exceeds
|
|
32
|
+
* this value (until dismissed).
|
|
33
|
+
*/
|
|
34
|
+
max_columns?: number | null,
|
|
35
|
+
/**
|
|
36
|
+
* Soft limit on the number of cells (rows × columns) the plugin
|
|
37
|
+
* will render. Triggers the "Rendering N of M" warning when the view
|
|
38
|
+
* exceeds this value (until dismissed).
|
|
39
|
+
*/
|
|
40
|
+
max_cells?: number | null,
|
|
41
|
+
/**
|
|
42
|
+
* Column add/remove behavior. `"select"` exclusively selects the
|
|
43
|
+
* added column, removing other columns. `"toggle"` toggles the
|
|
44
|
+
* column on or off based on its current state, leaving other
|
|
45
|
+
* columns alone.
|
|
46
|
+
*/
|
|
47
|
+
select_mode?: ColumnSelectMode,
|
|
48
|
+
/**
|
|
49
|
+
* Minimum number of columns the plugin requires to render. Mostly
|
|
50
|
+
* affects drag/drop and column-remove button behavior. `undefined`
|
|
51
|
+
* is treated identically to `1`.
|
|
52
|
+
*/
|
|
53
|
+
min_config_columns?: number | null,
|
|
54
|
+
/**
|
|
55
|
+
* Named column slots. Named columns have replace/swap behavior in
|
|
56
|
+
* drag/drop rather than insert. The length must be at least
|
|
57
|
+
* `min_config_columns`.
|
|
58
|
+
*/
|
|
59
|
+
config_column_names?: Array<string>,
|
|
60
|
+
/**
|
|
61
|
+
* Group-rollup modes the plugin accepts, in preference order.
|
|
62
|
+
* The first entry that matches a feature flag becomes the default.
|
|
63
|
+
*/
|
|
64
|
+
group_rollup_modes?: Array<GroupRollupMode> | null,
|
|
65
|
+
/**
|
|
66
|
+
* Plugin load priority. Higher numbers win; ties resolve in
|
|
67
|
+
* registration order. The highest-priority plugin is loaded by
|
|
68
|
+
* default unless `restore({ plugin })` overrides it.
|
|
69
|
+
*/
|
|
70
|
+
priority?: number | null,
|
|
71
|
+
/**
|
|
72
|
+
* Whether this plugin opts into per-column style controls in the
|
|
73
|
+
* settings sidebar. When `true`, the StyleTab is shown for active
|
|
74
|
+
* columns and the plugin's `column_config_schema` is queried for
|
|
75
|
+
* the per-column field set. When `false` or omitted, no StyleTab
|
|
76
|
+
* is shown.
|
|
77
|
+
*/
|
|
78
|
+
can_render_column_styles?: boolean, };
|