@perspective-dev/viewer 5.3.0 → 5.4.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 +8 -8
- package/dist/cdn/perspective-viewer.js.map +3 -3
- package/dist/css/blueprint.css +1 -0
- package/dist/css/botanical.css +1 -1
- package/dist/css/dracula.css +1 -1
- package/dist/css/eggplant.css +1 -0
- 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 -0
- package/dist/css/monokai.css +1 -1
- package/dist/css/nord.css +1 -0
- 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 -0
- package/dist/docs/perspective-docs.json +1 -1
- package/dist/esm/column-format.d.ts +16 -3
- package/dist/esm/extensions.d.ts +0 -5
- package/dist/esm/perspective-viewer.inline.js +7 -7
- package/dist/esm/perspective-viewer.inline.js.map +3 -3
- package/dist/esm/perspective-viewer.js +8 -8
- package/dist/esm/perspective-viewer.js.map +3 -3
- package/dist/esm/ts-rs/ViewOnUpdateResp.d.ts +1 -1
- package/dist/wasm/perspective-viewer.d.ts +62 -73
- package/dist/wasm/perspective-viewer.js +230 -238
- package/dist/wasm/perspective-viewer.wasm +0 -0
- package/dist/wasm/perspective-viewer.wasm.d.ts +18 -28
- 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 +8 -5
- package/src/css/column-settings-panel.css +0 -206
- package/src/css/column-style.css +95 -0
- package/src/css/config-selector.css +18 -10
- package/src/css/filter-dropdown.css +5 -5
- package/src/css/form/debug.css +28 -4
- package/src/css/function-dropdown.css +5 -5
- package/src/css/panel-tab.css +23 -0
- package/src/css/plugin-selector.css +6 -5
- package/src/css/render-warning.css +1 -1
- package/src/css/status-bar.css +52 -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 +13 -3
- package/src/css/{dom → ui/dom}/select.css +19 -8
- package/src/css/viewer.css +32 -31
- package/src/rust/agent/tools.rs +5 -2
- 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 +15 -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 +3 -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/primitive_field.rs +15 -17
- 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 +296 -238
- 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 +16 -6
- package/src/rust/components/datetime_column_style.rs +51 -12
- package/src/rust/components/{form/debug.rs → debug_panel.rs} +5 -5
- 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/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 +26 -2
- package/src/rust/components/mod.rs +5 -7
- 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 +125 -87
- 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 +3 -2
- package/src/rust/components/status_bar.rs +113 -20
- package/src/rust/components/status_indicator.rs +5 -14
- package/src/rust/components/string_column_style.rs +1 -2
- package/src/rust/components/{style/mod.rs → style.rs} +32 -15
- package/src/rust/components/style_controls/number_string_format/digits_section.rs +25 -15
- package/src/rust/components/style_controls/number_string_format/misc_section.rs +7 -3
- package/src/rust/components/style_controls/number_string_format/style_section.rs +2 -1
- package/src/rust/components/style_controls/number_string_format/types.rs +24 -0
- package/src/rust/components/style_controls/number_string_format.rs +37 -14
- package/src/rust/components/viewer/msg.rs +43 -30
- package/src/rust/components/viewer/panels.rs +50 -19
- package/src/rust/components/viewer/render.rs +15 -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 +1 -21
- 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 +358 -52
- package/src/rust/config/datetime_column_style.rs +4 -21
- package/src/rust/config/mod.rs +0 -2
- package/src/rust/config/number_string_format.rs +211 -18
- package/src/rust/config/workspace_config.rs +2 -1
- 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 +0 -18
- package/src/rust/js/plugin.rs +0 -86
- package/src/rust/lib.rs +12 -15
- package/src/rust/presentation/column_locator.rs +3 -7
- package/src/rust/presentation.rs +85 -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 +2 -2
- package/src/rust/renderer/activate.rs +1 -3
- package/src/rust/renderer/dispatch.rs +117 -30
- package/src/rust/renderer/limits.rs +24 -5
- package/src/rust/renderer/plugin_config.rs +56 -8
- package/src/rust/renderer/props.rs +2 -1
- package/src/rust/renderer.rs +14 -27
- package/src/rust/session/props.rs +4 -3
- package/src/rust/session/view_subscription.rs +19 -6
- package/src/rust/session.rs +38 -70
- package/src/rust/tasks/create_panel.rs +1 -1
- package/src/rust/tasks/dismiss_render_warning.rs +1 -1
- package/src/rust/tasks/eject.rs +1 -0
- package/src/rust/tasks/pipeline.rs +0 -60
- package/src/rust/tasks/presize_panels.rs +24 -1
- package/src/rust/tasks/restore_and_render.rs +0 -17
- package/src/rust/tasks/send_column_config.rs +1 -1
- package/src/rust/tasks/send_plugin_config.rs +1 -1
- package/src/rust/tasks/set_edit_mode.rs +1 -1
- package/src/rust/ui/containers/control_group.rs +113 -0
- package/src/rust/{components → ui}/containers/dropdown_menu.rs +5 -2
- package/src/rust/{components → ui}/containers/mod.rs +1 -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 +8 -8
- 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/ui/form/intl_label.rs +81 -0
- 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 +174 -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/mod.rs +2 -0
- package/src/rust/workspace.rs +35 -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/string-type.svg +4 -8
- package/src/svg/theme-icon.svg +5 -5
- package/src/themes/blueprint.css +133 -0
- package/src/themes/botanical.css +3 -52
- package/src/themes/defaults.css +3 -144
- package/src/themes/dracula.css +1 -71
- package/src/themes/eggplant.css +131 -0
- package/src/themes/gruvbox-dark.css +2 -79
- package/src/themes/gruvbox.css +2 -40
- package/src/themes/icons.css +2 -10
- package/src/themes/intl/ar.css +185 -0
- package/src/themes/intl/de.css +65 -33
- package/src/themes/intl/es.css +60 -28
- package/src/themes/intl/fr.css +60 -28
- package/src/themes/intl/ja.css +62 -30
- package/src/themes/intl/pt.css +58 -26
- package/src/themes/intl/zh.css +68 -36
- package/src/themes/intl.css +42 -7
- package/src/themes/ledger.css +137 -0
- package/src/themes/monokai.css +1 -64
- package/src/themes/nord.css +131 -0
- package/src/themes/phosphor.css +1 -61
- package/src/themes/pro-dark.css +1 -52
- package/src/themes/pro.css +98 -0
- package/src/themes/solarized-dark.css +1 -46
- package/src/themes/solarized.css +1 -24
- package/src/themes/themes.css +10 -5
- package/src/themes/vaporwave.css +1 -57
- package/src/themes/velvet.css +132 -0
- package/src/ts/column-format.ts +52 -2
- package/src/ts/extensions.ts +0 -13
- package/src/ts/ts-rs/ViewOnUpdateResp.ts +1 -1
- package/src/css/plugin-settings-panel.css +0 -99
- package/src/rust/components/modal.rs +0 -177
- 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/svg/dropdown-selector-light.svg +0 -3
- /package/dist/wasm/snippets/{perspective-viewer-39c3c3b28e3cbd48 → perspective-viewer-adc6f3f79141112b}/inline0.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-39c3c3b28e3cbd48 → perspective-viewer-adc6f3f79141112b}/inline1.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-39c3c3b28e3cbd48 → perspective-viewer-adc6f3f79141112b}/inline2.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-39c3c3b28e3cbd48 → perspective-viewer-adc6f3f79141112b}/inline3.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-39c3c3b28e3cbd48 → perspective-viewer-adc6f3f79141112b}/inline4.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-39c3c3b28e3cbd48 → perspective-viewer-adc6f3f79141112b}/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/{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/themes/solarized.css
CHANGED
|
@@ -21,6 +21,7 @@ perspective-viewer [theme="Solarized"] {
|
|
|
21
21
|
perspective-viewer[theme="Solarized"],
|
|
22
22
|
perspective-viewer [theme="Solarized"] {
|
|
23
23
|
/* perspective-viewer-solarized--colors */
|
|
24
|
+
color-scheme: light;
|
|
24
25
|
color: #586e75;
|
|
25
26
|
background-color: #eee8d5;
|
|
26
27
|
--psp--color: #586e75;
|
|
@@ -69,27 +70,3 @@ perspective-viewer [theme="Solarized"] {
|
|
|
69
70
|
x {
|
|
70
71
|
color: #cb4b16;
|
|
71
72
|
}
|
|
72
|
-
|
|
73
|
-
perspective-context-menu[theme="Solarized"],
|
|
74
|
-
perspective-copy-menu[theme="Solarized"],
|
|
75
|
-
perspective-export-menu[theme="Solarized"],
|
|
76
|
-
perspective-dropdown[theme="Solarized"],
|
|
77
|
-
perspective-date-column-style[theme="Solarized"],
|
|
78
|
-
perspective-datetime-column-style[theme="Solarized"],
|
|
79
|
-
perspective-number-column-style[theme="Solarized"],
|
|
80
|
-
perspective-string-column-style[theme="Solarized"] {
|
|
81
|
-
/* perspective-viewer-solarized--colors */
|
|
82
|
-
color: #586e75;
|
|
83
|
-
--psp--color: #586e75;
|
|
84
|
-
--psp-active--color: #268bd2;
|
|
85
|
-
--psp-error--color: #cb4b16;
|
|
86
|
-
--psp-inactive--color: #93a1a1;
|
|
87
|
-
--psp-inactive--border-color: var(--psp-inactive--color);
|
|
88
|
-
--psp--background-color: #fdf6e3;
|
|
89
|
-
--psp-column-type--float--color: #268bd2;
|
|
90
|
-
--psp-column-type--string--color: #cb4b16;
|
|
91
|
-
--psp-column-type--date--color: #2aa198;
|
|
92
|
-
--psp-column-type--boolean--color: #b58900;
|
|
93
|
-
|
|
94
|
-
background-color: #fdf6e3;
|
|
95
|
-
}
|
package/src/themes/themes.css
CHANGED
|
@@ -12,12 +12,17 @@
|
|
|
12
12
|
|
|
13
13
|
@import "./pro.css";
|
|
14
14
|
@import "./pro-dark.css";
|
|
15
|
+
@import "./blueprint.css";
|
|
16
|
+
@import "./botanical.css";
|
|
17
|
+
@import "./dracula.css";
|
|
18
|
+
@import "./eggplant.css";
|
|
19
|
+
@import "./gruvbox.css";
|
|
20
|
+
@import "./gruvbox-dark.css";
|
|
21
|
+
@import "./ledger.css";
|
|
15
22
|
@import "./monokai.css";
|
|
23
|
+
@import "./nord.css";
|
|
24
|
+
@import "./phosphor.css";
|
|
16
25
|
@import "./solarized.css";
|
|
17
26
|
@import "./solarized-dark.css";
|
|
18
27
|
@import "./vaporwave.css";
|
|
19
|
-
@import "./
|
|
20
|
-
@import "./gruvbox-dark.css";
|
|
21
|
-
@import "./dracula.css";
|
|
22
|
-
@import "./botanical.css";
|
|
23
|
-
@import "./phosphor.css";
|
|
28
|
+
@import "./velvet.css";
|
package/src/themes/vaporwave.css
CHANGED
|
@@ -23,6 +23,7 @@ perspective-viewer [theme="Vaporwave"] {
|
|
|
23
23
|
/* perspective-viewer-pro-dark--colors (overrides) */
|
|
24
24
|
background-color: #242526;
|
|
25
25
|
color: white;
|
|
26
|
+
color-scheme: dark;
|
|
26
27
|
--psp--color: white;
|
|
27
28
|
--psp-active--color: #2770a9;
|
|
28
29
|
--psp-error--color: #ff9485;
|
|
@@ -38,14 +39,6 @@ perspective-viewer [theme="Vaporwave"] {
|
|
|
38
39
|
--psp-warning--color: #242526;
|
|
39
40
|
--psp-warning--background: var(--psp--color);
|
|
40
41
|
|
|
41
|
-
--psp-icon--select-arrow--mask-image: var(
|
|
42
|
-
--psp-icon--select-arrow-light--mask-image
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
--psp-icon--select-arrow-hover--mask-image: var(
|
|
46
|
-
--psp-icon--select-arrow-dark--mask-image
|
|
47
|
-
);
|
|
48
|
-
|
|
49
42
|
--psp-code-editor--symbol--color: white;
|
|
50
43
|
--psp-code-editor--literal--color: #7dc3f0;
|
|
51
44
|
--psp-code-editor--operator--color: rgb(23, 166, 123);
|
|
@@ -196,52 +189,3 @@ perspective-viewer [theme="Vaporwave"] {
|
|
|
196
189
|
#61f4fb
|
|
197
190
|
) !important;
|
|
198
191
|
}
|
|
199
|
-
|
|
200
|
-
perspective-context-menu[theme="Vaporwave"],
|
|
201
|
-
perspective-copy-menu[theme="Vaporwave"],
|
|
202
|
-
perspective-export-menu[theme="Vaporwave"],
|
|
203
|
-
perspective-dropdown[theme="Vaporwave"],
|
|
204
|
-
perspective-date-column-style[theme="Vaporwave"],
|
|
205
|
-
perspective-datetime-column-style[theme="Vaporwave"],
|
|
206
|
-
perspective-number-column-style[theme="Vaporwave"],
|
|
207
|
-
perspective-string-column-style[theme="Vaporwave"] {
|
|
208
|
-
/* perspective-viewer-pro-dark--colors (overrides) */
|
|
209
|
-
background-color: #242526;
|
|
210
|
-
color: white;
|
|
211
|
-
--psp--color: white;
|
|
212
|
-
--psp-active--color: #2770a9;
|
|
213
|
-
--psp-error--color: #ff9485;
|
|
214
|
-
--psp-inactive--color: #61656e;
|
|
215
|
-
--psp-inactive--border-color: #4c505b;
|
|
216
|
-
--psp--background-color: #242526;
|
|
217
|
-
--psp-active--background: rgba(39, 113, 170, 0.5);
|
|
218
|
-
--psp-expression--operator--color: #c5c9d0;
|
|
219
|
-
--psp-expression--function--color: #22a0ce;
|
|
220
|
-
--psp-expression--psp-error--color: rgb(255, 136, 136);
|
|
221
|
-
--psp-calendar--filter: invert(1);
|
|
222
|
-
--psp-input--filter: invert(1);
|
|
223
|
-
--psp-warning--color: #242526;
|
|
224
|
-
--psp-warning--background: var(--psp--color);
|
|
225
|
-
--psp-icon--select-arrow--mask-image: var(
|
|
226
|
-
--psp-icon--select-arrow-light--mask-image
|
|
227
|
-
);
|
|
228
|
-
--psp-icon--select-arrow-hover--mask-image: var(
|
|
229
|
-
--psp-icon--select-arrow-dark--mask-image
|
|
230
|
-
);
|
|
231
|
-
--psp-code-editor--symbol--color: white;
|
|
232
|
-
--psp-code-editor--literal--color: #7dc3f0;
|
|
233
|
-
--psp-code-editor--operator--color: rgb(23, 166, 123);
|
|
234
|
-
--psp-code-editor--comment--color: rgb(204, 120, 48);
|
|
235
|
-
--psp-code-editor--column--color: #e18ee1;
|
|
236
|
-
|
|
237
|
-
border: 1px solid #4c505b;
|
|
238
|
-
|
|
239
|
-
/* perspective-viewer-vaporwave--colors */
|
|
240
|
-
color: #49acff;
|
|
241
|
-
--psp--color: #49acff;
|
|
242
|
-
--psp-inactive--color: rgb(19, 33, 50) !important;
|
|
243
|
-
--psp-inactive--border-color: var(--psp-inactive--color);
|
|
244
|
-
--psp--background-color: rgb(7, 8, 29) !important;
|
|
245
|
-
|
|
246
|
-
background-color: #07081d;
|
|
247
|
-
}
|
|
@@ -0,0 +1,132 @@
|
|
|
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
|
+
@import "./defaults.css";
|
|
14
|
+
|
|
15
|
+
perspective-viewer,
|
|
16
|
+
perspective-viewer[theme="Velvet"],
|
|
17
|
+
perspective-viewer [theme="Velvet"] {
|
|
18
|
+
--psp-theme-name: "Velvet";
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
perspective-viewer[theme="Velvet"],
|
|
22
|
+
perspective-viewer [theme="Velvet"] {
|
|
23
|
+
--theme-bg0: #3a0d14;
|
|
24
|
+
--theme-bg1: #4a1119;
|
|
25
|
+
--theme-bg2: #5c1822;
|
|
26
|
+
--theme-bg3: #7a2431;
|
|
27
|
+
--theme-fg0: #fff5f7;
|
|
28
|
+
--theme-fg1: #f3c9d3;
|
|
29
|
+
--theme-fg2: #a8606f;
|
|
30
|
+
--theme-white: #ffffff;
|
|
31
|
+
--theme-pink: #ff8fb8;
|
|
32
|
+
--theme-pink-bright: #ffb3cf;
|
|
33
|
+
--theme-rose: #ff5c8d;
|
|
34
|
+
--theme-blush: #ffd6e2;
|
|
35
|
+
--theme-gold: #f2c078;
|
|
36
|
+
--theme-lilac: #d9b3ff;
|
|
37
|
+
--theme-peach: #ffcba4;
|
|
38
|
+
--theme-amber: #ffd166;
|
|
39
|
+
--theme-mint: #8fe3c8;
|
|
40
|
+
--theme-sky: #9ccfff;
|
|
41
|
+
--theme-periwinkle: #a3a8ff;
|
|
42
|
+
--theme-sage: #c5d99a;
|
|
43
|
+
|
|
44
|
+
background-color: var(--theme-bg0);
|
|
45
|
+
color: var(--theme-fg0);
|
|
46
|
+
color-scheme: dark;
|
|
47
|
+
--psp--color: var(--theme-fg1);
|
|
48
|
+
--psp-active--color: var(--theme-pink);
|
|
49
|
+
--psp-error--color: var(--theme-amber);
|
|
50
|
+
--psp-inactive--color: var(--theme-fg2);
|
|
51
|
+
--psp-inactive--border-color: var(--theme-bg3);
|
|
52
|
+
--psp--background-color: var(--theme-bg0);
|
|
53
|
+
--psp-active--background: rgba(255, 143, 184, 0.3);
|
|
54
|
+
--psp-expression--operator--color: var(--theme-pink-bright);
|
|
55
|
+
--psp-expression--function--color: var(--theme-pink);
|
|
56
|
+
--psp-expression--psp-error--color: var(--theme-amber);
|
|
57
|
+
--psp-calendar--filter: invert(1);
|
|
58
|
+
--psp-input--filter: invert(1);
|
|
59
|
+
--psp-warning--color: var(--theme-bg0);
|
|
60
|
+
--psp-warning--background: var(--theme-blush);
|
|
61
|
+
|
|
62
|
+
--psp-status-icon--connected--color: var(--theme-pink);
|
|
63
|
+
--psp-status-icon--initializing--color: var(--theme-blush);
|
|
64
|
+
--psp-status-icon--psp-error--color: var(--theme-amber);
|
|
65
|
+
|
|
66
|
+
--psp-code-editor--symbol--color: var(--theme-fg0);
|
|
67
|
+
--psp-code-editor--literal--color: var(--theme-pink-bright);
|
|
68
|
+
--psp-code-editor--operator--color: var(--theme-pink-bright);
|
|
69
|
+
--psp-code-editor--comment--color: var(--theme-fg2);
|
|
70
|
+
--psp-code-editor--column--color: var(--theme-lilac);
|
|
71
|
+
|
|
72
|
+
--psp-datagrid--pos-cell--color: var(--theme-white);
|
|
73
|
+
--psp-datagrid--neg-cell--color: var(--theme-rose);
|
|
74
|
+
|
|
75
|
+
--psp-charts--legend--color: var(--theme-fg1);
|
|
76
|
+
--psp-charts--treemap--labels: var(--theme-fg0);
|
|
77
|
+
--psp-charts--treemap--hover-highlight: var(--theme-fg0);
|
|
78
|
+
--psp-charts--tooltip--color: var(--theme-fg0);
|
|
79
|
+
--psp-charts--axis-ticks--color: var(--theme-fg1);
|
|
80
|
+
--psp-charts--axis-lines--color: var(--theme-bg3);
|
|
81
|
+
--psp-charts--gridline--color: var(--theme-bg2);
|
|
82
|
+
--psp-charts--tooltip--background: var(--theme-bg1);
|
|
83
|
+
--psp-charts--tooltip--border-color: var(--theme-bg3);
|
|
84
|
+
--psp-charts--legend--background: var(--psp--background-color);
|
|
85
|
+
|
|
86
|
+
--psp-charts--series--color: var(--theme-white);
|
|
87
|
+
--psp-charts--series-1--color: var(--theme-fg1);
|
|
88
|
+
--psp-charts--series-2--color: var(--theme-pink);
|
|
89
|
+
--psp-charts--series-3--color: var(--theme-gold);
|
|
90
|
+
--psp-charts--series-4--color: var(--theme-lilac);
|
|
91
|
+
--psp-charts--series-5--color: var(--theme-mint);
|
|
92
|
+
--psp-charts--series-6--color: var(--theme-rose);
|
|
93
|
+
--psp-charts--series-7--color: var(--theme-sky);
|
|
94
|
+
--psp-charts--series-8--color: var(--theme-peach);
|
|
95
|
+
--psp-charts--series-9--color: var(--theme-periwinkle);
|
|
96
|
+
--psp-charts--series-10--color: var(--theme-sage);
|
|
97
|
+
--psp-datagrid--series-1--color: var(--theme-fg1);
|
|
98
|
+
--psp-datagrid--series-2--color: var(--theme-pink);
|
|
99
|
+
--psp-datagrid--series-3--color: var(--theme-gold);
|
|
100
|
+
--psp-datagrid--series-4--color: var(--theme-lilac);
|
|
101
|
+
--psp-datagrid--series-5--color: var(--theme-mint);
|
|
102
|
+
--psp-datagrid--series-6--color: var(--theme-rose);
|
|
103
|
+
--psp-datagrid--series-7--color: var(--theme-sky);
|
|
104
|
+
--psp-datagrid--series-8--color: var(--theme-peach);
|
|
105
|
+
--psp-datagrid--series-9--color: var(--theme-periwinkle);
|
|
106
|
+
--psp-datagrid--series-10--color: var(--theme-sage);
|
|
107
|
+
|
|
108
|
+
--psp-charts--gradient--background: linear-gradient(
|
|
109
|
+
var(--theme-rose) 0%,
|
|
110
|
+
var(--theme-bg0) 50%,
|
|
111
|
+
var(--theme-white) 100%
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
--psp-openlayers--tile-url: "http://{a-c}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png";
|
|
115
|
+
--psp-openlayers--attribution--filter: invert(1) hue-rotate(180deg);
|
|
116
|
+
--psp-openlayers--element--background: var(--theme-bg1);
|
|
117
|
+
--psp-openlayers--category-1--color: var(--theme-fg1);
|
|
118
|
+
--psp-openlayers--category-2--color: var(--theme-pink);
|
|
119
|
+
--psp-openlayers--category-3--color: var(--theme-gold);
|
|
120
|
+
--psp-openlayers--category-4--color: var(--theme-lilac);
|
|
121
|
+
--psp-openlayers--category-5--color: var(--theme-mint);
|
|
122
|
+
--psp-openlayers--category-6--color: var(--theme-rose);
|
|
123
|
+
--psp-openlayers--category-7--color: var(--theme-sky);
|
|
124
|
+
--psp-openlayers--category-8--color: var(--theme-peach);
|
|
125
|
+
--psp-openlayers--category-9--color: var(--theme-periwinkle);
|
|
126
|
+
--psp-openlayers--category-10--color: var(--theme-sage);
|
|
127
|
+
--psp-openlayers--gradient--background: linear-gradient(
|
|
128
|
+
var(--theme-rose) 0%,
|
|
129
|
+
var(--theme-bg0) 50%,
|
|
130
|
+
var(--theme-white) 100%
|
|
131
|
+
);
|
|
132
|
+
}
|
package/src/ts/column-format.ts
CHANGED
|
@@ -83,23 +83,67 @@ const DATE_LEGACY_DEFAULTS: Intl.DateTimeFormatOptions = {
|
|
|
83
83
|
dateStyle: "short",
|
|
84
84
|
};
|
|
85
85
|
|
|
86
|
+
function mergeNumberOptions(
|
|
87
|
+
base: Intl.NumberFormatOptions,
|
|
88
|
+
cfg?: NumberFormatConfig,
|
|
89
|
+
): Intl.NumberFormatOptions {
|
|
90
|
+
const explicit: Record<string, unknown> = {};
|
|
91
|
+
for (const [k, v] of Object.entries(cfg ?? {})) {
|
|
92
|
+
if (v !== undefined && v !== null) {
|
|
93
|
+
explicit[k] = v;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const merged: Record<string, unknown> = { ...base };
|
|
98
|
+
if (
|
|
99
|
+
"minimumFractionDigits" in explicit ||
|
|
100
|
+
"maximumFractionDigits" in explicit
|
|
101
|
+
) {
|
|
102
|
+
delete merged.minimumFractionDigits;
|
|
103
|
+
delete merged.maximumFractionDigits;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (
|
|
107
|
+
"minimumSignificantDigits" in explicit ||
|
|
108
|
+
"maximumSignificantDigits" in explicit
|
|
109
|
+
) {
|
|
110
|
+
delete merged.minimumSignificantDigits;
|
|
111
|
+
delete merged.maximumSignificantDigits;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return Object.assign(merged, explicit) as Intl.NumberFormatOptions;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* `defaults` is the calling plugin's declared default format, filling in
|
|
119
|
+
* the fields `cfg` leaves unset.
|
|
120
|
+
*/
|
|
86
121
|
export function createNumberFormatter(
|
|
87
122
|
type: string,
|
|
88
123
|
cfg?: NumberFormatConfig,
|
|
124
|
+
defaults?: NumberFormatConfig,
|
|
89
125
|
): Intl.NumberFormat {
|
|
90
126
|
// ts-rs renders serde-absent keys as `T | null`; the wire never
|
|
91
127
|
// carries an explicit `null` (`skip_serializing_if`), and
|
|
92
128
|
// `Intl.NumberFormat` treats both absent and `undefined` the same, so
|
|
93
129
|
// the cast is presentation-only.
|
|
94
|
-
const
|
|
130
|
+
const base = ((defaults as Intl.NumberFormatOptions | undefined) ??
|
|
95
131
|
NUMERIC_LEGACY_DEFAULTS[type] ??
|
|
96
132
|
{}) as Intl.NumberFormatOptions;
|
|
133
|
+
|
|
134
|
+
const opts = cfg ? mergeNumberOptions(base, cfg) : base;
|
|
97
135
|
return new Intl.NumberFormat(navigator.languages as string[], opts);
|
|
98
136
|
}
|
|
99
137
|
|
|
138
|
+
/**
|
|
139
|
+
* `defaults` is the calling plugin's declared default `date_format`,
|
|
140
|
+
* applied only when `cfg` is wholly absent.
|
|
141
|
+
*/
|
|
100
142
|
export function createDatetimeFormatter(
|
|
101
143
|
cfg?: DateFormatConfig,
|
|
144
|
+
defaults?: DateFormatConfig,
|
|
102
145
|
): Intl.DateTimeFormat {
|
|
146
|
+
cfg = cfg ?? defaults;
|
|
103
147
|
if (!cfg || !("format" in cfg)) {
|
|
104
148
|
const preset = simple_config(cfg);
|
|
105
149
|
const opts: Intl.DateTimeFormatOptions = {
|
|
@@ -158,10 +202,16 @@ export function createDatetimeFormatter(
|
|
|
158
202
|
return new Intl.DateTimeFormat(navigator.languages as string[], opts);
|
|
159
203
|
}
|
|
160
204
|
|
|
205
|
+
/**
|
|
206
|
+
* `defaults` follows the same contract as
|
|
207
|
+
* [`createDatetimeFormatter`]: the plugin's declared default
|
|
208
|
+
* `date_format`, applied only when `cfg` is wholly absent.
|
|
209
|
+
*/
|
|
161
210
|
export function createDateFormatter(
|
|
162
211
|
cfg?: DateFormatConfig,
|
|
212
|
+
defaults?: DateFormatConfig,
|
|
163
213
|
): Intl.DateTimeFormat {
|
|
164
|
-
const preset = simple_config(cfg);
|
|
214
|
+
const preset = simple_config(cfg ?? defaults);
|
|
165
215
|
const opts: Intl.DateTimeFormatOptions = {
|
|
166
216
|
timeZone: "utc",
|
|
167
217
|
dateStyle:
|
package/src/ts/extensions.ts
CHANGED
|
@@ -52,25 +52,12 @@ export class PerspectiveSelectDetail {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
import type {
|
|
56
|
-
ExportDropDownMenuElement,
|
|
57
|
-
CopyDropDownMenuElement,
|
|
58
|
-
} from "../../dist/wasm/perspective-viewer.d.ts";
|
|
59
|
-
|
|
60
55
|
// DOM extensions
|
|
61
56
|
|
|
62
57
|
export type HTMLPerspectiveViewerElement = PerspectiveViewerElement &
|
|
63
58
|
PerspectiveViewerElementExt &
|
|
64
59
|
HTMLElement;
|
|
65
60
|
|
|
66
|
-
export interface HTMLPerspectiveViewerExportMenuElement
|
|
67
|
-
extends HTMLElement,
|
|
68
|
-
ExportDropDownMenuElement {}
|
|
69
|
-
|
|
70
|
-
export interface HTMLPerspectiveViewerCopyMenuElement
|
|
71
|
-
extends HTMLElement,
|
|
72
|
-
CopyDropDownMenuElement {}
|
|
73
|
-
|
|
74
61
|
export type PerspectiveClickEventDetail = {
|
|
75
62
|
config: ViewerConfigUpdate;
|
|
76
63
|
row: Record<string, any>;
|
|
@@ -1,99 +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
|
-
|
|
14
|
-
:host {
|
|
15
|
-
label#edit_mode-label:before {
|
|
16
|
-
content: var(--psp-label--edit-mode--content);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
label#scroll_lock-label:before {
|
|
20
|
-
content: var(--psp-label--scroll-lock--content);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
label#chart_type-label:before {
|
|
24
|
-
content: var(--psp-label--chart-type--content);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/* viewer-charts plugin_config controls */
|
|
28
|
-
label#auto_alt_y_axis-label:before {
|
|
29
|
-
content: var(--psp-label--auto-alt-y-axis--content);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
label#facet_mode-label:before {
|
|
33
|
-
content: var(--psp-label--facet-mode--content);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
label#facet_zoom_mode-label:before {
|
|
37
|
-
content: var(--psp-label--facet-zoom-mode--content);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
label#series_zoom_mode-label:before {
|
|
41
|
-
content: var(--psp-label--series-zoom-mode--content);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
label#line_width_px-label:before {
|
|
45
|
-
content: var(--psp-label--line-width-px--content);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
label#point_size_px-label:before {
|
|
49
|
-
content: var(--psp-label--point-size-px--content);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
label#band_inner_frac-label:before {
|
|
53
|
-
content: var(--psp-label--band-inner-frac--content);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
label#bar_inner_pad-label:before {
|
|
57
|
-
content: var(--psp-label--bar-inner-pad--content);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
label#wick_width_px-label:before {
|
|
61
|
-
content: var(--psp-label--wick-width-px--content);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
label#ohlc_line_width_px-label:before {
|
|
65
|
-
content: var(--psp-label--ohlc-line-width-px--content);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
label#include_zero-label:before {
|
|
69
|
-
content: var(--psp-label--include-zero--content);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
label#domain_mode-label:before {
|
|
73
|
-
content: var(--psp-label--domain-mode--content);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
label#gradient_color_mode-label:before {
|
|
77
|
-
content: var(--psp-label--gradient-color-mode--content);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
label#gradient_radius_px-label:before {
|
|
81
|
-
content: var(--psp-label--gradient-radius-px--content);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
label#gradient_intensity-label:before {
|
|
85
|
-
content: var(--psp-label--gradient-intensity--content);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
label#gradient_heat_max-label:before {
|
|
89
|
-
content: var(--psp-label--gradient-heat-max--content);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
label#map_tile_provider-label:before {
|
|
93
|
-
content: var(--psp-label--map-tile-provider--content);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
label#map_tile_alpha-label:before {
|
|
97
|
-
content: var(--psp-label--map-tile-alpha--content);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
@@ -1,177 +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 std::cell::Cell;
|
|
14
|
-
use std::marker::PhantomData;
|
|
15
|
-
use std::rc::Rc;
|
|
16
|
-
|
|
17
|
-
use derivative::Derivative;
|
|
18
|
-
use yew::html::*;
|
|
19
|
-
use yew::prelude::*;
|
|
20
|
-
use yew::virtual_dom::VChild;
|
|
21
|
-
|
|
22
|
-
use crate::utils::WeakScope;
|
|
23
|
-
|
|
24
|
-
#[derive(Properties, Derivative)]
|
|
25
|
-
#[derivative(PartialEq(bound = ""))]
|
|
26
|
-
pub struct ModalProps<T>
|
|
27
|
-
where
|
|
28
|
-
T: Component,
|
|
29
|
-
T::Properties: ModalLink<T>,
|
|
30
|
-
{
|
|
31
|
-
pub child: Option<VChild<T>>,
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
#[derive(Debug)]
|
|
35
|
-
pub enum ModalMsg<T>
|
|
36
|
-
where
|
|
37
|
-
T: Component,
|
|
38
|
-
{
|
|
39
|
-
SetPos {
|
|
40
|
-
top: f64,
|
|
41
|
-
left: f64,
|
|
42
|
-
visible: bool,
|
|
43
|
-
rev_vert: bool,
|
|
44
|
-
},
|
|
45
|
-
SubMsg(T::Message),
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
#[derive(Default)]
|
|
49
|
-
pub struct Modal<T> {
|
|
50
|
-
css: String,
|
|
51
|
-
rev_vert: ModalOrientation,
|
|
52
|
-
_comp: PhantomData<T>,
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
impl<T> Component for Modal<T>
|
|
56
|
-
where
|
|
57
|
-
T: Component,
|
|
58
|
-
T::Properties: ModalLink<T>,
|
|
59
|
-
{
|
|
60
|
-
type Message = ModalMsg<T>;
|
|
61
|
-
type Properties = ModalProps<T>;
|
|
62
|
-
|
|
63
|
-
fn create(_ctx: &Context<Self>) -> Self {
|
|
64
|
-
Self {
|
|
65
|
-
css: ":host{{top:0px;left:0px;opacity:0}}".to_owned(),
|
|
66
|
-
rev_vert: Default::default(),
|
|
67
|
-
_comp: PhantomData,
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
fn update(&mut self, ctx: &Context<Self>, msg: ModalMsg<T>) -> bool {
|
|
72
|
-
match msg {
|
|
73
|
-
ModalMsg::SetPos {
|
|
74
|
-
top,
|
|
75
|
-
left,
|
|
76
|
-
visible,
|
|
77
|
-
rev_vert,
|
|
78
|
-
} => {
|
|
79
|
-
let opacity = if visible { "" } else { ";opacity:0" };
|
|
80
|
-
self.css = format!(":host{{top:{top}px;left:{left}px{opacity}}}");
|
|
81
|
-
self.rev_vert.set(rev_vert);
|
|
82
|
-
true
|
|
83
|
-
},
|
|
84
|
-
ModalMsg::SubMsg(msg) => {
|
|
85
|
-
if let Some(child) = &ctx.props().child
|
|
86
|
-
&& let Some(link) = child.props.weak_link().borrow().as_ref()
|
|
87
|
-
{
|
|
88
|
-
link.send_message(msg);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
false
|
|
92
|
-
},
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
fn view(&self, ctx: &Context<Self>) -> Html {
|
|
97
|
-
let child = ctx
|
|
98
|
-
.props()
|
|
99
|
-
.child
|
|
100
|
-
.clone()
|
|
101
|
-
.map(Html::from)
|
|
102
|
-
.unwrap_or_default();
|
|
103
|
-
|
|
104
|
-
html! {
|
|
105
|
-
<>
|
|
106
|
-
<style>{ self.css.to_owned() }</style>
|
|
107
|
-
<ContextProvider<ModalOrientation> context={&self.rev_vert}>
|
|
108
|
-
<NoRender>{ child }</NoRender>
|
|
109
|
-
</ContextProvider<ModalOrientation>>
|
|
110
|
-
</>
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
#[derive(Clone, Default, Eq, PartialEq)]
|
|
116
|
-
pub struct ModalOrientation(Rc<Cell<bool>>);
|
|
117
|
-
|
|
118
|
-
impl ImplicitClone for ModalOrientation {}
|
|
119
|
-
|
|
120
|
-
impl ModalOrientation {
|
|
121
|
-
pub fn set(&self, value: bool) {
|
|
122
|
-
self.0.set(value);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
impl From<ModalOrientation> for bool {
|
|
127
|
-
fn from(x: ModalOrientation) -> Self {
|
|
128
|
-
x.0.get()
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
pub trait ModalLink<T>
|
|
133
|
-
where
|
|
134
|
-
T: Component,
|
|
135
|
-
{
|
|
136
|
-
fn weak_link(&self) -> &'_ WeakScope<T>;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
pub trait SetModalLink {
|
|
140
|
-
fn set_modal_link(&self);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
impl<T> SetModalLink for &Context<T>
|
|
144
|
-
where
|
|
145
|
-
T: Component,
|
|
146
|
-
T::Properties: ModalLink<T>,
|
|
147
|
-
{
|
|
148
|
-
fn set_modal_link(&self) {
|
|
149
|
-
*self.props().weak_link().borrow_mut() = Some(self.link().clone());
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
#[derive(Properties, Clone)]
|
|
154
|
-
struct NoRenderProps {
|
|
155
|
-
pub children: Children,
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
impl PartialEq for NoRenderProps {
|
|
159
|
-
fn eq(&self, _other: &Self) -> bool {
|
|
160
|
-
true
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
struct NoRender {}
|
|
165
|
-
|
|
166
|
-
impl Component for NoRender {
|
|
167
|
-
type Message = ();
|
|
168
|
-
type Properties = NoRenderProps;
|
|
169
|
-
|
|
170
|
-
fn create(_ctx: &Context<Self>) -> Self {
|
|
171
|
-
Self {}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
fn view(&self, ctx: &Context<Self>) -> Html {
|
|
175
|
-
html! { { ctx.props().children.iter().collect::<Html>() } }
|
|
176
|
-
}
|
|
177
|
-
}
|