@perspective-dev/viewer 4.4.0 → 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 -0
- 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 +6 -0
- package/dist/esm/perspective-viewer.d.ts +4 -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 +21 -77
- 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 +39 -0
- package/dist/esm/ts-rs/ViewerConfigUpdate.d.ts +7 -4
- package/dist/wasm/perspective-viewer.d.ts +88 -24
- package/dist/wasm/perspective-viewer.js +320 -151
- package/dist/wasm/perspective-viewer.wasm +0 -0
- package/dist/wasm/perspective-viewer.wasm.d.ts +22 -17
- package/package.json +24 -2
- package/src/css/column-selector.css +3 -2
- package/src/css/column-settings-panel.css +36 -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/status-bar.css +1 -1
- 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 -132
- 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 +7 -8
- package/src/rust/custom_elements/copy_dropdown.rs +30 -18
- package/src/rust/custom_elements/debug_plugin.rs +5 -7
- package/src/rust/custom_elements/export_dropdown.rs +26 -18
- package/src/rust/custom_elements/viewer.rs +77 -77
- package/src/rust/custom_events.rs +181 -224
- package/src/rust/js/plugin.rs +45 -117
- package/src/rust/lib.rs +39 -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 +649 -55
- 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 -89
- 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/datagrid-select-row-tree.svg +13 -0
- 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 +42 -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 +4 -18
- 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 +175 -0
- 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/themes.css +1 -0
- 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 +12 -1
- package/src/ts/perspective-viewer.ts +10 -1
- package/src/{rust/components/column_settings_sidebar/style_tab/stub.rs → ts/perspective-viewer.worker.ts} +2 -22
- package/src/ts/plugin.ts +29 -105
- 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 +14 -0
- 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 -483
- package/src/rust/config/number_column_style.rs +0 -132
- 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-68fef752754ffbc6 → perspective-viewer-39ab7da3ca157861}/inline0.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-68fef752754ffbc6 → perspective-viewer-39ab7da3ca157861}/inline1.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-68fef752754ffbc6 → perspective-viewer-39ab7da3ca157861}/inline2.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-68fef752754ffbc6 → perspective-viewer-39ab7da3ca157861}/inline3.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-68fef752754ffbc6 → 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/solarized.css
CHANGED
|
@@ -40,31 +40,21 @@ perspective-viewer[theme="Solarized"] {
|
|
|
40
40
|
--psp-datagrid--hover--border-color: #ccc;
|
|
41
41
|
--psp-datagrid--border-color: #93a1a1;
|
|
42
42
|
|
|
43
|
-
/* perspective-viewer-solarized--
|
|
44
|
-
--psp-
|
|
45
|
-
--psp-
|
|
43
|
+
/* perspective-viewer-solarized--webgl */
|
|
44
|
+
--psp-charts--treemap--labels: black;
|
|
45
|
+
--psp-charts--treemap--hover-highlight: black;
|
|
46
46
|
|
|
47
|
-
--psp-
|
|
48
|
-
--psp-
|
|
49
|
-
--psp-
|
|
50
|
-
--psp-
|
|
51
|
-
--psp-
|
|
52
|
-
--psp-
|
|
53
|
-
--psp-
|
|
54
|
-
--psp-
|
|
47
|
+
--psp-charts--axis-ticks--color: #586e75;
|
|
48
|
+
--psp-charts--gridline--color: #eee8d5;
|
|
49
|
+
--psp-charts--series--color: #268bd2;
|
|
50
|
+
--psp-charts--series-1--color: #268bd2;
|
|
51
|
+
--psp-charts--series-2--color: #cb4b16;
|
|
52
|
+
--psp-charts--series-3--color: #b58900;
|
|
53
|
+
--psp-charts--series-4--color: #859900;
|
|
54
|
+
--psp-charts--series-5--color: #2aa198;
|
|
55
55
|
|
|
56
|
-
--psp-
|
|
57
|
-
--psp-
|
|
58
|
-
|
|
59
|
-
--psp-d3fc--pos-gradient--background: linear-gradient(
|
|
60
|
-
#268bd2 0%,
|
|
61
|
-
#2aa198,
|
|
62
|
-
#859900,
|
|
63
|
-
#b58900,
|
|
64
|
-
#cb4b16,
|
|
65
|
-
#dc322f,
|
|
66
|
-
#d33682 100%
|
|
67
|
-
);
|
|
56
|
+
--psp-charts--series-6--color: #6c71c4;
|
|
57
|
+
--psp-charts--series-7--color: #d33682;
|
|
68
58
|
}
|
|
69
59
|
|
|
70
60
|
x {
|
package/src/themes/themes.css
CHANGED
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
|
@@ -26,7 +26,6 @@ export class PerspectiveSelectDetail {
|
|
|
26
26
|
column_names?: string[];
|
|
27
27
|
removeConfigs: ViewConfigUpdate[];
|
|
28
28
|
insertConfigs: ViewConfigUpdate[];
|
|
29
|
-
|
|
30
29
|
constructor(
|
|
31
30
|
selected: boolean,
|
|
32
31
|
row: Record<string, unknown>,
|
|
@@ -49,6 +48,7 @@ export class PerspectiveSelectDetail {
|
|
|
49
48
|
return this.insertConfigs.flatMap((x) => x.filter ?? []);
|
|
50
49
|
}
|
|
51
50
|
}
|
|
51
|
+
|
|
52
52
|
import type {
|
|
53
53
|
ExportDropDownMenuElement,
|
|
54
54
|
CopyDropDownMenuElement,
|
|
@@ -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,
|
|
@@ -190,6 +194,12 @@ export interface PerspectiveViewerElementExt {
|
|
|
190
194
|
options?: { signal: AbortSignal },
|
|
191
195
|
): void;
|
|
192
196
|
|
|
197
|
+
addEventListener(
|
|
198
|
+
name: "perspective-global-filter",
|
|
199
|
+
cb: (e: CustomEvent<PerspectiveSelectEventDetail>) => void,
|
|
200
|
+
options?: { signal: AbortSignal },
|
|
201
|
+
): void;
|
|
202
|
+
|
|
193
203
|
addEventListener(
|
|
194
204
|
name: "perspective-toggle-settings",
|
|
195
205
|
cb: (e: CustomEvent) => void,
|
|
@@ -228,6 +238,7 @@ export interface PerspectiveViewerElementExt {
|
|
|
228
238
|
|
|
229
239
|
removeEventListener(name: "perspective-click", cb: any): void;
|
|
230
240
|
removeEventListener(name: "perspective-select", cb: any): void;
|
|
241
|
+
removeEventListener(name: "perspective-global-filter", cb: any): void;
|
|
231
242
|
removeEventListener(name: "perspective-toggle-settings", cb: any): void;
|
|
232
243
|
removeEventListener(
|
|
233
244
|
name: "perspective-toggle-settings-before",
|
|
@@ -34,13 +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
|
-
export type * from "./ts-rs/
|
|
48
|
+
export type * from "./ts-rs/ViewerConfig.d.ts";
|
|
41
49
|
export type * from "./ts-rs/Filter.d.ts";
|
|
42
50
|
export type * from "./ts-rs/FilterTerm.d.ts";
|
|
43
51
|
export type * from "./ts-rs/FilterReducer.d.ts";
|
|
52
|
+
export type * from "./ts-rs/PluginStaticConfig.ts";
|
|
44
53
|
|
|
45
54
|
export { init_client } from "./bootstrap";
|
|
46
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";
|