@perspective-dev/viewer 4.3.0 → 4.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.
Files changed (227) hide show
  1. package/dist/cdn/perspective-viewer.js +2 -2
  2. package/dist/cdn/perspective-viewer.js.map +4 -4
  3. package/dist/css/botanical.css +1 -1
  4. package/dist/css/dracula.css +1 -1
  5. package/dist/css/gruvbox-dark.css +1 -1
  6. package/dist/css/gruvbox.css +1 -1
  7. package/dist/css/icons.css +1 -1
  8. package/dist/css/intl/de.css +1 -1
  9. package/dist/css/intl/es.css +1 -1
  10. package/dist/css/intl/fr.css +1 -1
  11. package/dist/css/intl/ja.css +1 -1
  12. package/dist/css/intl/pt.css +1 -1
  13. package/dist/css/intl/zh.css +1 -1
  14. package/dist/css/intl.css +1 -1
  15. package/dist/css/monokai.css +1 -1
  16. package/dist/css/pro-dark.css +1 -1
  17. package/dist/css/pro.css +1 -1
  18. package/dist/css/solarized-dark.css +1 -1
  19. package/dist/css/solarized.css +1 -1
  20. package/dist/css/themes.css +1 -1
  21. package/dist/css/vaporwave.css +1 -1
  22. package/dist/esm/perspective-viewer.inline.js +2 -2
  23. package/dist/esm/perspective-viewer.inline.js.map +4 -4
  24. package/dist/esm/perspective-viewer.js +2 -2
  25. package/dist/esm/perspective-viewer.js.map +4 -4
  26. package/dist/wasm/perspective-viewer.d.ts +57 -53
  27. package/dist/wasm/perspective-viewer.js +190 -165
  28. package/dist/wasm/perspective-viewer.wasm +0 -0
  29. package/dist/wasm/perspective-viewer.wasm.d.ts +17 -18
  30. package/package.json +7 -5
  31. package/src/{less/aggregate-selector.less → css/aggregate-selector.css} +23 -20
  32. package/src/css/column-dropdown.css +109 -0
  33. package/src/{less/column-selector.less → css/column-selector.css} +160 -158
  34. package/src/{less/column-settings-panel.less → css/column-settings-panel.css} +69 -59
  35. package/src/{less/column-style.less → css/column-style.css} +52 -66
  36. package/src/{less/column-symbol-attributes.less → css/column-symbol-attributes.css} +15 -14
  37. package/src/{less/config-selector.less → css/config-selector.css} +151 -135
  38. package/src/{less/containers/dropdown-menu.less → css/containers/dropdown-menu.css} +20 -19
  39. package/src/{less/containers/pairs-list.less → css/containers/pairs-list.css} +13 -12
  40. package/src/{themes/variables.less → css/containers/scroll-panel.css} +25 -22
  41. package/src/{less/containers/split-panel.less → css/containers/split-panel.css} +15 -14
  42. package/src/{less/containers/tabs.less → css/containers/tabs.css} +17 -19
  43. package/src/css/dom/checkbox.css +102 -0
  44. package/src/css/dom/scrollbar.css +35 -0
  45. package/src/{less/dom/select.less → css/dom/select.css} +17 -18
  46. package/src/{less/empty-column.less → css/empty-column.css} +19 -18
  47. package/src/{less/expression-editor.less → css/expression-editor.css} +19 -18
  48. package/src/{less/filter-dropdown.less → css/filter-dropdown.css} +12 -11
  49. package/src/{less/filter-item.less → css/filter-item.css} +16 -15
  50. package/src/{less/form/code-editor.less → css/form/code-editor.css} +26 -30
  51. package/src/{less/form/debug.less → css/form/debug.css} +19 -18
  52. package/src/{less/function-dropdown.less → css/function-dropdown.css} +12 -11
  53. package/src/css/plugin-selector.css +261 -0
  54. package/src/{less/render-warning.less → css/render-warning.css} +18 -17
  55. package/src/{less/status-bar.less → css/status-bar.css} +156 -144
  56. package/src/css/type-icon.css +116 -0
  57. package/src/{less/viewer.less → css/viewer.css} +112 -146
  58. package/src/rust/components/column_dropdown.rs +229 -119
  59. package/src/rust/components/column_selector/active_column.rs +81 -62
  60. package/src/rust/components/column_selector/add_expression_button.rs +1 -0
  61. package/src/rust/components/column_selector/aggregate_selector.rs +25 -15
  62. package/src/rust/components/column_selector/config_selector.rs +315 -199
  63. package/src/rust/components/column_selector/empty_column.rs +2 -2
  64. package/src/rust/components/column_selector/expr_edit_button.rs +8 -2
  65. package/src/rust/components/column_selector/filter_column.rs +37 -26
  66. package/src/rust/components/column_selector/inactive_column.rs +41 -29
  67. package/src/rust/components/column_selector/invalid_column.rs +7 -18
  68. package/src/rust/components/column_selector/pivot_column.rs +11 -5
  69. package/src/rust/components/column_selector/sort_column.rs +23 -13
  70. package/src/rust/components/column_selector.rs +163 -84
  71. package/src/rust/components/column_settings_sidebar/style_tab/symbol/row_selector.rs +1 -1
  72. package/src/rust/components/column_settings_sidebar/style_tab/symbol/symbol_pairs.rs +3 -2
  73. package/src/rust/components/column_settings_sidebar/style_tab/symbol/symbol_pairs_item.rs +3 -2
  74. package/src/rust/components/column_settings_sidebar/style_tab/symbol/symbol_selector.rs +2 -3
  75. package/src/rust/components/column_settings_sidebar/style_tab/symbol.rs +7 -1
  76. package/src/rust/components/column_settings_sidebar/style_tab.rs +153 -112
  77. package/src/rust/components/column_settings_sidebar.rs +91 -53
  78. package/src/rust/components/containers/dragdrop_list.rs +2 -1
  79. package/src/rust/components/containers/sidebar_close_button.rs +1 -1
  80. package/src/rust/components/containers/split_panel.rs +1 -0
  81. package/src/rust/components/containers/tab_list.rs +1 -1
  82. package/src/rust/components/copy_dropdown.rs +7 -28
  83. package/src/rust/components/datetime_column_style/custom.rs +2 -2
  84. package/src/rust/components/datetime_column_style/simple.rs +2 -2
  85. package/src/rust/components/datetime_column_style.rs +4 -2
  86. package/src/rust/components/editable_header.rs +7 -4
  87. package/src/rust/components/empty_row.rs +1 -1
  88. package/src/rust/components/export_dropdown.rs +4 -30
  89. package/src/rust/components/expression_editor.rs +19 -10
  90. package/src/rust/components/filter_dropdown.rs +246 -102
  91. package/src/rust/components/font_loader.rs +11 -28
  92. package/src/rust/components/form/code_editor.rs +17 -2
  93. package/src/rust/components/form/color_range_selector.rs +19 -6
  94. package/src/rust/components/form/debug.rs +30 -13
  95. package/src/rust/components/function_dropdown.rs +186 -113
  96. package/src/rust/components/main_panel.rs +71 -89
  97. package/src/rust/components/mod.rs +1 -1
  98. package/src/rust/components/modal.rs +7 -1
  99. package/src/rust/components/number_column_style.rs +22 -7
  100. package/src/rust/components/plugin_selector.rs +34 -102
  101. package/src/rust/components/portal.rs +274 -0
  102. package/src/rust/components/render_warning.rs +72 -123
  103. package/src/rust/components/settings_panel.rs +115 -11
  104. package/src/rust/components/status_bar.rs +222 -98
  105. package/src/rust/components/status_bar_counter.rs +8 -20
  106. package/src/rust/components/status_indicator.rs +64 -114
  107. package/src/rust/components/string_column_style.rs +2 -2
  108. package/src/rust/components/style/style_cache.rs +5 -1
  109. package/src/rust/components/viewer.rs +391 -39
  110. package/src/rust/custom_elements/copy_dropdown.rs +102 -21
  111. package/src/rust/custom_elements/export_dropdown.rs +102 -20
  112. package/src/rust/custom_elements/mod.rs +0 -7
  113. package/src/rust/custom_elements/modal.rs +7 -103
  114. package/src/rust/custom_elements/viewer.rs +99 -35
  115. package/src/rust/custom_events.rs +23 -2
  116. package/src/rust/dragdrop.rs +149 -10
  117. package/src/{less/containers/scroll-panel.less → rust/engines.rs} +15 -13
  118. package/src/rust/js/plugin.rs +1 -1
  119. package/src/rust/lib.rs +5 -4
  120. package/src/rust/presentation/props.rs +39 -0
  121. package/src/rust/presentation/sheets.rs +3 -3
  122. package/src/rust/presentation.rs +44 -8
  123. package/src/rust/renderer/limits.rs +32 -3
  124. package/src/{less/dom/scrollbar.less → rust/renderer/props.rs} +18 -19
  125. package/src/rust/renderer.rs +83 -9
  126. package/src/rust/session/column_defaults_update.rs +1 -1
  127. package/src/rust/session/metadata.rs +23 -2
  128. package/src/rust/session/props.rs +178 -0
  129. package/src/rust/session.rs +124 -117
  130. package/src/rust/tasks/column_locator.rs +133 -0
  131. package/src/rust/{model → tasks}/columns_iter_set.rs +14 -23
  132. package/src/rust/{model → tasks}/edit_expression.rs +34 -10
  133. package/src/rust/{model → tasks}/eject.rs +2 -2
  134. package/src/rust/{model → tasks}/get_viewer_config.rs +0 -11
  135. package/src/rust/{model → tasks}/intersection_observer.rs +19 -3
  136. package/src/{less/containers/radio-list.less → rust/tasks/is_invalid_drop.rs} +21 -14
  137. package/src/rust/tasks/mod.rs +52 -0
  138. package/src/rust/{model → tasks}/plugin_column_styles.rs +69 -46
  139. package/src/rust/{model → tasks}/resize_observer.rs +39 -6
  140. package/src/rust/{model → tasks}/send_plugin_config.rs +1 -1
  141. package/src/rust/tasks/structural.rs +53 -0
  142. package/src/rust/utils/mod.rs +4 -0
  143. package/src/rust/utils/modal_position.rs +110 -0
  144. package/src/rust/utils/ptr_eq_rc.rs +74 -0
  145. package/src/rust/utils/pubsub.rs +11 -1
  146. package/src/svg/bg-pattern.png +0 -0
  147. package/src/svg/close-icon.svg +1 -1
  148. package/src/svg/expression.svg +1 -1
  149. package/src/svg/mega-menu-icons-candlestick.svg +1 -1
  150. package/src/svg/mega-menu-icons-datagrid.svg +1 -2
  151. package/src/svg/mega-menu-icons-heatmap.svg +1 -1
  152. package/src/svg/mega-menu-icons-map-scatter.svg +1 -1
  153. package/src/svg/mega-menu-icons-ohlc.svg +1 -1
  154. package/src/svg/mega-menu-icons-sunburst.svg +1 -1
  155. package/src/svg/mega-menu-icons-treemap.svg +1 -1
  156. package/src/svg/mega-menu-icons-x-bar.svg +1 -1
  157. package/src/svg/mega-menu-icons-x-y-line.svg +1 -1
  158. package/src/svg/mega-menu-icons-x-y-scatter.svg +1 -1
  159. package/src/svg/mega-menu-icons-y-area.svg +1 -1
  160. package/src/svg/mega-menu-icons-y-bar.svg +1 -1
  161. package/src/svg/mega-menu-icons-y-line.svg +1 -1
  162. package/src/svg/mega-menu-icons-y-scatter.svg +1 -1
  163. package/src/svg/radio-hover.svg +1 -1
  164. package/src/svg/radio-off.svg +1 -1
  165. package/src/svg/radio-on.svg +1 -1
  166. package/src/themes/botanical.css +157 -0
  167. package/src/themes/defaults.css +139 -0
  168. package/src/themes/dracula.css +233 -0
  169. package/src/themes/gruvbox-dark.css +255 -0
  170. package/src/themes/gruvbox.css +134 -0
  171. package/src/themes/icons.css +124 -0
  172. package/src/themes/intl/de.css +102 -0
  173. package/src/themes/intl/es.css +102 -0
  174. package/src/themes/intl/fr.css +102 -0
  175. package/src/themes/intl/ja.css +102 -0
  176. package/src/themes/intl/pt.css +102 -0
  177. package/src/themes/intl/zh.css +102 -0
  178. package/src/themes/intl.css +102 -0
  179. package/src/themes/monokai.css +233 -0
  180. package/src/themes/pro-dark.css +158 -0
  181. package/src/themes/{themes.less → pro.css} +17 -21
  182. package/src/themes/solarized-dark.css +135 -0
  183. package/src/themes/solarized.css +95 -0
  184. package/src/themes/themes.css +22 -0
  185. package/src/themes/vaporwave.css +256 -0
  186. package/dist/css/variables.css +0 -0
  187. package/src/less/column-dropdown.less +0 -95
  188. package/src/less/dom/checkbox.less +0 -100
  189. package/src/less/plugin-selector.less +0 -183
  190. package/src/less/type-icon.less +0 -68
  191. package/src/rust/components/error_message.rs +0 -56
  192. package/src/rust/custom_elements/column_dropdown.rs +0 -123
  193. package/src/rust/custom_elements/filter_dropdown.rs +0 -179
  194. package/src/rust/custom_elements/function_dropdown.rs +0 -115
  195. package/src/rust/model/column_locator.rs +0 -82
  196. package/src/rust/model/is_invalid_drop.rs +0 -36
  197. package/src/rust/model/mod.rs +0 -100
  198. package/src/rust/model/reset_all.rs +0 -38
  199. package/src/rust/model/structural.rs +0 -244
  200. package/src/themes/botanical.less +0 -142
  201. package/src/themes/dracula.less +0 -101
  202. package/src/themes/gruvbox-dark.less +0 -116
  203. package/src/themes/gruvbox.less +0 -152
  204. package/src/themes/icons.less +0 -130
  205. package/src/themes/intl/de.less +0 -102
  206. package/src/themes/intl/es.less +0 -102
  207. package/src/themes/intl/fr.less +0 -102
  208. package/src/themes/intl/ja.less +0 -102
  209. package/src/themes/intl/pt.less +0 -102
  210. package/src/themes/intl/zh.less +0 -102
  211. package/src/themes/intl.less +0 -102
  212. package/src/themes/monokai.less +0 -107
  213. package/src/themes/pro-dark.less +0 -147
  214. package/src/themes/pro.less +0 -186
  215. package/src/themes/solarized-dark.less +0 -78
  216. package/src/themes/solarized.less +0 -102
  217. package/src/themes/vaporwave.less +0 -145
  218. /package/dist/wasm/snippets/{perspective-viewer-d729f682ba5c19df → perspective-viewer-68fef752754ffbc6}/inline0.js +0 -0
  219. /package/dist/wasm/snippets/{perspective-viewer-d729f682ba5c19df → perspective-viewer-68fef752754ffbc6}/inline1.js +0 -0
  220. /package/dist/wasm/snippets/{perspective-viewer-d729f682ba5c19df → perspective-viewer-68fef752754ffbc6}/inline2.js +0 -0
  221. /package/dist/wasm/snippets/{perspective-viewer-d729f682ba5c19df → perspective-viewer-68fef752754ffbc6}/inline3.js +0 -0
  222. /package/dist/wasm/snippets/{perspective-viewer-d729f682ba5c19df → perspective-viewer-68fef752754ffbc6}/inline4.js +0 -0
  223. /package/src/rust/{model → tasks}/copy_export.rs +0 -0
  224. /package/src/rust/{model → tasks}/export_app.rs +0 -0
  225. /package/src/rust/{model → tasks}/export_method.rs +0 -0
  226. /package/src/rust/{model → tasks}/restore_and_render.rs +0 -0
  227. /package/src/rust/{model → tasks}/update_and_render.rs +0 -0
@@ -1,100 +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
- //! Here lies Perspective's attempt to avoid a monolithic Application State
14
- //! object. The major components which hold `PerspectiveViewer`-scoped state
15
- //! are broken up roughly by some single resource responsibility -
16
- //!
17
- //! - `Session` manages the `@perspective-dev/client` engine `Table` and `View`
18
- //! objects, plus caches some related metadata `Schema`.
19
- //! - `Renderer` manages the JavaScript Custom Element plugin.
20
- //! - .. etc.
21
- //!
22
- //! For complex tasks which involve overlapping state/coordination between >1 of
23
- //! these Application State objects, Perspective uses a set of respective `Has*`
24
- //! traits, (e.g. `HasSession`), to provide extra functions for object which
25
- //! implement more than one such trait. These can be conveniently derived by
26
- //! consistently naming the application state object clones when used as struct
27
- //! fields, then applying the `derive_model!()` macro for the state object you
28
- //! wish to expose.
29
- //!
30
- //! # Examples
31
- //!
32
- //! ```rust
33
- //! #[derive(PerspectiveProperties!)]
34
- //! struct A {
35
- //! session: Session,
36
- //! }
37
- //!
38
- //! #[derive(PerspectiveProperties!)]
39
- //! struct B {
40
- //! renderer: Renderer,
41
- //! }
42
- //!
43
- //! #[derive(PerspectiveProperties!)]
44
- //! struct C {
45
- //! session: Session,
46
- //! renderer: Renderer,
47
- //! }
48
- //!
49
- //! trait SessionRenderModel: HasSession + HasRenderer {
50
- //! fn render_session_now(&self) {
51
- //! // Do some thing that requires `.session()` and `.renderer()`
52
- //! }
53
- //! }
54
- //!
55
- //! impl<T: HasSession + HasRenderer> SessionRenderModel for T {}
56
- //!
57
- //! fn test(session: Session, renderer: Renderer) {
58
- //! // Type errors
59
- //! (A { session }).render_session_now();
60
- //! (B { renderer }).render_session_now();
61
- //!
62
- //! // The method exists only when both state object clones exist
63
- //! (C { session, renderer }).render_session_now();
64
- //! }
65
- //! ```
66
-
67
- mod column_locator;
68
- mod columns_iter_set;
69
- mod copy_export;
70
- mod edit_expression;
71
- mod eject;
72
- mod export_app;
73
- mod export_method;
74
- mod get_viewer_config;
75
- mod intersection_observer;
76
- mod is_invalid_drop;
77
- mod plugin_column_styles;
78
- mod reset_all;
79
- mod resize_observer;
80
- mod restore_and_render;
81
- mod send_plugin_config;
82
- mod structural;
83
- mod update_and_render;
84
-
85
- pub use self::column_locator::*;
86
- pub use self::columns_iter_set::*;
87
- pub use self::copy_export::*;
88
- pub use self::edit_expression::*;
89
- pub use self::eject::*;
90
- pub use self::export_method::*;
91
- pub use self::get_viewer_config::*;
92
- pub use self::intersection_observer::*;
93
- pub use self::is_invalid_drop::*;
94
- pub use self::plugin_column_styles::*;
95
- pub use self::reset_all::*;
96
- pub use self::resize_observer::*;
97
- pub use self::restore_and_render::*;
98
- pub use self::send_plugin_config::*;
99
- pub use self::structural::*;
100
- pub use self::update_and_render::*;
@@ -1,38 +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 super::structural::*;
14
- use crate::session::ResetOptions;
15
- use crate::utils::*;
16
- use crate::*;
17
-
18
- pub trait ResetAll: HasRenderer + HasSession + HasPresentation {
19
- /// Completely reset viewer state
20
- fn reset_all(&self) -> ApiFuture<()> {
21
- clone!(self.session(), self.renderer(), self.presentation());
22
- ApiFuture::new(async move {
23
- session
24
- .reset(ResetOptions {
25
- config: true,
26
- expressions: true,
27
- ..ResetOptions::default()
28
- })
29
- .await?;
30
- presentation.reset_columns_configs();
31
- renderer.reset(None).await?;
32
- presentation.reset_available_themes(None).await;
33
- Ok(())
34
- })
35
- }
36
- }
37
-
38
- impl<T: HasRenderer + HasSession + HasPresentation> ResetAll for T {}
@@ -1,244 +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
- //! A simple "structurally-typed" method extension implementation. This
14
- //! collection of `trait`s allows methods to be automatically defined for
15
- //! `struct`s only if the define accessors for the necessary applications state
16
- //! objects (which are conviently derivable with the `derive_model!` macro).
17
-
18
- use yew::Component;
19
-
20
- use crate::custom_events::*;
21
- use crate::dragdrop::*;
22
- use crate::presentation::*;
23
- use crate::renderer::*;
24
- use crate::root::*;
25
- use crate::session::*;
26
-
27
- pub trait HasCustomEvents {
28
- fn custom_events(&self) -> &'_ CustomEvents;
29
- }
30
-
31
- pub trait HasDragDrop {
32
- fn dragdrop(&self) -> &'_ DragDrop;
33
- }
34
-
35
- pub trait HasPresentation {
36
- fn presentation(&self) -> &'_ Presentation;
37
- }
38
-
39
- pub trait HasRoot {
40
- /// Use an assoociated type to prevent a (circular) dependency on
41
- /// [`crate::components`].
42
- type RootComponent: Component;
43
- fn root(&self) -> &'_ Root<Self::RootComponent>;
44
- }
45
-
46
- pub trait HasRenderer {
47
- fn renderer(&self) -> &'_ Renderer;
48
- }
49
-
50
- pub trait HasSession {
51
- fn session(&self) -> &'_ Session;
52
- }
53
-
54
- impl HasSession for Session {
55
- fn session(&self) -> &'_ Session {
56
- self
57
- }
58
- }
59
-
60
- #[macro_export]
61
- macro_rules! PerspectiveProperties {
62
- // (impl @tuple $name:ident CustomEvents $x:tt) => {
63
- // impl $crate::model::HasCustomEvents for $name {
64
- // fn custom_events(&self) -> &'_ CustomEvents {
65
- // &self.$x
66
- // }
67
- // }
68
- // };
69
-
70
- // (impl @tuple $name:ident DragDrop $x:tt) => {
71
- // impl $crate::model::HasDragDrop for $name {
72
- // fn dragdrop(&self) -> &'_ DragDrop {
73
- // &self.$x
74
- // }
75
- // }
76
- // };
77
-
78
- // (impl @tuple $name:ident Presentatio $x:tt) => {
79
- // impl $crate::model::HasPresentation for $name {
80
- // fn presentation(&self) -> &'_ Presentation {
81
- // &self.$x
82
- // }
83
- // }
84
- // };
85
-
86
- // (impl @tuple $name:ident Renderer $x:tt) => {
87
- // impl $crate::model::HasRenderer for $name {
88
- // fn renderer(&self) -> &'_ Renderer {
89
- // &self.$x
90
- // }
91
- // }
92
- // };
93
-
94
- // (impl @tuple $name:ident Root $x:tt) => {
95
- // impl $crate::model::HasRoot for $name {
96
- // type RootComponent = $crate::components::viewer::PerspectiveViewer;
97
- // fn root(&self) -> &'_ Root<Self::RootComponent> {
98
- // &self.$x
99
- // }
100
- // }
101
- // };
102
-
103
- // (impl @tuple $name:ident Session $x:tt) => {
104
- // impl $crate::model::HasSession for $name {
105
- // fn session(&self) -> &'_ Session {
106
- // &self.$x
107
- // }
108
- // }
109
- // };
110
-
111
- // (impl @tuple $name:ident *_x:tt $x:tt) => {};
112
-
113
- (impl @field $name:ident custom_events $value:ty) => {
114
- impl $crate::model::HasCustomEvents for $name {
115
- fn custom_events(&self) -> &'_ $value {
116
- &self.custom_events
117
- }
118
- }
119
- };
120
-
121
- (impl @field $name:ident dragdrop $value:ty) => {
122
- impl $crate::model::HasDragDrop for $name {
123
- fn dragdrop(&self) -> &'_ $value {
124
- &self.dragdrop
125
- }
126
- }
127
- };
128
-
129
- (impl @field $name:ident presentation $value:ty) => {
130
- impl $crate::model::HasPresentation for $name {
131
- fn presentation(&self) -> &'_ $value {
132
- &self.presentation
133
- }
134
- }
135
- };
136
-
137
- (impl @field $name:ident renderer $value:ty) => {
138
- impl $crate::model::HasRenderer for $name {
139
- fn renderer(&self) -> &'_ $value {
140
- &self.renderer
141
- }
142
- }
143
- };
144
-
145
- (impl @field $name:ident root $value:ty) => {
146
- impl $crate::model::HasRoot for $name {
147
- type RootComponent = $crate::components::viewer::PerspectiveViewer;
148
- fn root(&self) -> &'_ $value {
149
- &self.root
150
- }
151
- }
152
- };
153
-
154
- (impl @field $name:ident session $value:ty) => {
155
- impl $crate::model::HasSession for $name {
156
- fn session(&self) -> &'_ $value {
157
- &self.session
158
- }
159
- }
160
- };
161
-
162
- (impl @field $name:ident $x:ident $value:ty) => {};
163
-
164
- (impl @fields_provider $name:ident {$($x:tt : $y:ty,)*} custom_events, $($field:ident,)*) => {
165
- PerspectiveProperties!(impl @fields_provider $name { custom_events : CustomEvents, $($x : $y,)*} $($field,)*);
166
- };
167
-
168
- (impl @fields_provider $name:ident {$($x:tt : $y:ty,)*} dragdrop, $($field:ident,)*) => {
169
- PerspectiveProperties!(impl @fields_provider $name { dragdrop : DragDrop, $($x : $y,)*} $($field,)*);
170
- };
171
-
172
- (impl @fields_provider $name:ident {$($x:tt : $y:ty,)*} presentation, $($field:ident,)*) => {
173
- PerspectiveProperties!(impl @fields_provider $name { presentation : Presentation, $($x : $y,)*} $($field,)*);
174
- };
175
-
176
- (impl @fields_provider $name:ident {$($x:tt : $y:ty,)*} renderer, $($field:ident,)*) => {
177
- PerspectiveProperties!(impl @fields_provider $name { renderer : Renderer, $($x : $y,)*} $($field,)*);
178
- };
179
-
180
- (impl @fields_provider $name:ident {$($x:tt : $y:ty,)*} root, $($field:ident,)*) => {
181
- PerspectiveProperties!(impl @fields_provider $name { root : Root<$crate::components::viewer::PerspectiveViewer>, $($x : $y,)*} $($field,)*);
182
- };
183
-
184
- (impl @fields_provider $name:ident {$($x:tt : $y:ty,)*} session, $($field:ident,)*) => {
185
- PerspectiveProperties!(impl @fields_provider $name { session : Session, $($x : $y,)*} $($field,)*);
186
- };
187
-
188
- (impl @fields_provider $name:ident {$($x:tt : $y:ty,)*} $_x:ident, $($field:ident,)*) => {
189
- PerspectiveProperties!(impl @fields_provider $name {$($x : $y,)*} $($field,)*);
190
- };
191
-
192
- (impl @fields_provider $name:ident {}) => {};
193
-
194
- (impl @fields_provider $name:ident {$($x:tt : $y:ty,)*}) => {
195
- perspective_client::vendor::paste::paste! {
196
- #[derive(PartialEq, Clone)]
197
- pub struct [< $name State >] {
198
- $($x: $y,)*
199
- }
200
-
201
- impl $crate::model::StateProvider for $name {
202
- type State = [< $name State >];
203
- fn clone_state(&self) -> Self::State {
204
- Self::State {
205
- $($x : self.$x.clone(),)*
206
- }
207
- }
208
- }
209
-
210
- PerspectiveProperties!(impl @fields [< $name State >] $($x : $y,)*);
211
- }
212
- };
213
-
214
- (impl @fields $name:ident $field:ident : $value:ty, $($field_tail:ident : $value_tail:ty,)*) => {
215
- PerspectiveProperties!(impl @field $name $field $value);
216
- PerspectiveProperties!(impl @fields $name $($field_tail : $value_tail,)*);
217
- };
218
-
219
- (impl @fields $name:ident) => {};
220
-
221
- // (impl @tuples $name:ident $value:tt : $acc:tt, $($value_tail:tt : $acc_tail:tt,)*) => {
222
- // PerspectiveProperties!(impl @tuple $name $value $acc);
223
- // PerspectiveProperties!(impl @tuples $name $($value_tail : $acc_tail,)*);
224
- // };
225
-
226
- // (impl @tuples $name:ident) => {};
227
-
228
- ($(#[$m:meta])* $pub:vis struct $name:ident { $($(#[$_m:meta])* $_p:vis $field:ident : $value:ty),* $(,)? }) => {
229
- PerspectiveProperties!(impl @fields $name $($field : $value,)*);
230
- PerspectiveProperties!(impl @fields_provider $name {} $($field,)*);
231
- };
232
-
233
- // ($(#[$m:meta])* $pub:vis struct $name:ident ( $($(#[$_m:meta])* $value:tt $(< $_ttt:ty >)?),* $(,)? );) => {
234
- // PerspectiveProperties!(impl @tuples $name $($value : ${index()} ,)*);
235
- // };
236
- }
237
-
238
- pub trait StateProvider {
239
- type State: Clone + 'static;
240
-
241
- /// Clones _just_ the state objects fields into a new dedicated state
242
- /// struct (generated by [`PerspectiveProperties`]).
243
- fn clone_state(&self) -> Self::State;
244
- }
@@ -1,142 +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
- @import "icons.less";
14
- @import "intl.less";
15
-
16
- @import url("ref://pro.less");
17
-
18
- // Register theme for auto-detection
19
- perspective-viewer,
20
- perspective-viewer[theme="Botanical"] {
21
- --theme-name: "Botanical";
22
- }
23
-
24
- perspective-viewer[theme="Botanical"] {
25
- @include perspective-viewer-botanical;
26
- }
27
-
28
- perspective-copy-menu[theme="Botanical"],
29
- perspective-export-menu[theme="Botanical"],
30
- perspective-dropdown[theme="Botanical"],
31
- perspective-date-column-style[theme="Botanical"],
32
- perspective-datetime-column-style[theme="Botanical"],
33
- perspective-number-column-style[theme="Botanical"],
34
- perspective-string-column-style[theme="Botanical"] {
35
- @include perspective-modal-botanical;
36
- }
37
-
38
- @mixin perspective-viewer-botanical {
39
- @include perspective-viewer-pro;
40
- @include perspective-viewer-botanical--colors;
41
- @include perspective-viewer-botanical--datagrid;
42
- @include perspective-viewer-botanical--d3fc;
43
- @include perspective-viewer-botanical--openlayers;
44
- }
45
-
46
- @mixin perspective-modal-botanical {
47
- @include perspective-modal-pro;
48
- @include perspective-viewer-botanical--colors;
49
-
50
- background-color: #1a2e1a;
51
- border: 1px solid #3d5c3d;
52
- }
53
-
54
- @mixin perspective-viewer-botanical--colors {
55
- background-color: #1a2e1a;
56
- color: #e0ead8;
57
- --icon--color: #e0ead8;
58
- --active--color: #5a9e4b;
59
- --error--color: #e8836a;
60
- --inactive--color: #526b4a;
61
- --inactive--border-color: #3d5c3d;
62
- --plugin--background: #1a2e1a;
63
- --modal-target--background: rgba(224, 234, 216, 0.05);
64
- --active--background: rgba(90, 158, 75, 0.5);
65
- --expression--operator-color: #b8c9ad;
66
- --expression--function-color: #7bc96f;
67
- --expression--error-color: rgb(232, 131, 106);
68
- --calendar--filter: invert(1);
69
- --warning--color: #1a2e1a;
70
- --warning--background: var(--icon--color);
71
-
72
- --select-arrow--background-image: var(
73
- --select-arrow-light--background-image
74
- );
75
-
76
- --select-arrow--hover--background-image: var(
77
- --select-arrow-dark--background-image
78
- );
79
-
80
- // Syntax
81
- --code-editor-symbol--color: #e0ead8;
82
- --code-editor-literal--color: #a8d8a0;
83
- --code-editor-operator--color: rgb(206, 176, 104);
84
- --code-editor-comment--color: rgb(120, 160, 100);
85
- --code-editor-column--color: #c9a0d8;
86
- }
87
-
88
- @mixin perspective-viewer-botanical--openlayers {
89
- --map-tile-url: "http://{a-c}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png";
90
- --map-attribution--filter: invert(1) hue-rotate(180deg);
91
- --map-element-background: #1e3420;
92
- --map-category-1: rgb(90, 158, 75);
93
- --map-category-2: rgb(206, 176, 104);
94
- --map-category-3: rgb(160, 110, 180);
95
- --map-category-4: rgb(80, 170, 150);
96
- --map-category-5: rgb(140, 170, 90);
97
- --map-category-6: rgb(200, 120, 140);
98
- --map-category-7: rgb(100, 150, 190);
99
- --map-category-8: rgb(210, 140, 80);
100
- --map-category-9: rgb(130, 120, 190);
101
- --map-category-10: rgb(170, 200, 110);
102
- --map-gradient: linear-gradient(#e8836a 0%, #1a2e1a 50%, #5a9e4b 100%);
103
- }
104
-
105
- @mixin perspective-viewer-botanical--datagrid {
106
- --rt-pos-cell--color: #7bc96f;
107
- --rt-neg-cell--color: #ebac21;
108
- }
109
-
110
- @mixin perspective-viewer-botanical--d3fc {
111
- --d3fc-legend--text: #b8c9ad;
112
- --d3fc-treedata--labels: #e0ead8;
113
- --d3fc-treedata--hover-highlight: #e0ead8;
114
- --d3fc-tooltip--color: #e0ead8;
115
- --d3fc-axis-ticks--color: #b8c9ad;
116
- --d3fc-axis--lines: #526b4a;
117
- --d3fc-gridline--color: #2a4228;
118
- --d3fc-tooltip--background: rgba(30, 52, 32, 1);
119
- --d3fc-tooltip--border-color: #1a2e1a;
120
- --d3fc-legend--background: var(--plugin--background);
121
-
122
- --d3fc-series: rgb(90, 158, 75);
123
- --d3fc-series-1: rgb(90, 158, 75);
124
- --d3fc-series-2: rgb(206, 176, 104);
125
- --d3fc-series-3: rgb(160, 110, 180);
126
- --d3fc-series-4: rgb(80, 170, 150);
127
- --d3fc-series-5: rgb(140, 170, 90);
128
- --d3fc-series-6: rgb(200, 120, 140);
129
- --d3fc-series-7: rgb(100, 150, 190);
130
- --d3fc-series-8: rgb(210, 140, 80);
131
- --d3fc-series-9: rgb(130, 120, 190);
132
- --d3fc-series-10: rgb(170, 200, 110);
133
-
134
- --d3fc-full--gradient: linear-gradient(
135
- #e8836a 0%,
136
- #1a2e1a 50%,
137
- #5a9e4b 100%
138
- );
139
-
140
- --d3fc-positive--gradient: linear-gradient(#1a2e1a 0%, #5a9e4b 100%);
141
- --d3fc-negative--gradient: linear-gradient(#e8836a 0%, #1a2e1a 100%);
142
- }
@@ -1,101 +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
- @import "icons.less";
14
-
15
- @import url("ref://pro-dark.less");
16
-
17
- perspective-viewer,
18
- perspective-viewer[theme="Dracula"] {
19
- --theme-name: "Dracula";
20
- }
21
-
22
- perspective-viewer[theme="Dracula"] {
23
- @include perspective-viewer-pro-dark;
24
- @include perspective-viewer-dracula--colors;
25
- @include perspective-viewer-dracula--animation;
26
- @include perspective-viewer-dracula--fonts;
27
- @include perspective-viewer-dracula--datagrid;
28
- @include perspective-viewer-dracula--d3fc;
29
- }
30
-
31
- perspective-copy-menu[theme="Dracula"],
32
- perspective-export-menu[theme="Dracula"],
33
- perspective-dropdown[theme="Dracula"] {
34
- @include perspective-modal-pro-dark;
35
- @include perspective-viewer-dracula--colors;
36
- background-color: var(--theme-bg0);
37
- }
38
-
39
- @mixin perspective-viewer-dracula--colors {
40
- --theme-bg0: #191a22;
41
- --theme-bg1: #282a36;
42
- --theme-bg2: #44475a;
43
-
44
- --theme-gray: #928374;
45
-
46
- --theme-fg0: #f8f8f2;
47
- --theme-fg1: #6272a4;
48
- --theme-fg2: #44475a;
49
-
50
- --theme-red: #ff5555;
51
- --theme-green: #50fa7b;
52
- --theme-yellow: #f1fa8c;
53
- --theme-blue: #8be9fd;
54
- --theme-purple: #bd93f9;
55
- --theme-orange: #ffb86c;
56
- --theme-pink: #ff79c6;
57
-
58
- color: var(--theme-fg0);
59
- background-color: var(--theme-bg0);
60
- --icon--color: var(--theme-fg1);
61
- --inactive--color: var(--theme-fg2);
62
- --inactive--border-color: var(--theme-bg2);
63
- --plugin--background: var(--theme-bg1);
64
- --status-icon-connected--color: var(--theme-green);
65
- --status-icon-initializing--color: var(--theme-yellow);
66
- --status-icon-error--color: var(--theme-red);
67
- }
68
-
69
- @mixin perspective-viewer-dracula--datagrid {
70
- --rt-pos-cell--color: var(--theme-blue);
71
- --rt-neg-cell--color: var(--theme-red);
72
- }
73
-
74
- @mixin perspective-viewer-dracula--d3fc {
75
- --d3fc-axis-ticks--color: var(--theme-fg1);
76
- --d3fc-gridline--color: var(--theme-bg2);
77
- --d3fc-series: var(--theme-blue);
78
- --d3fc-series-1: var(--theme-blue);
79
- --d3fc-series-2: var(--theme-red);
80
- --d3fc-series-3: var(--theme-green);
81
- --d3fc-series-4: var(--theme-yellow);
82
- --d3fc-series-5: var(--theme-purple);
83
- --d3fc-series-6: var(--theme-pink);
84
- --d3fc-series-7: var(--theme-orange);
85
-
86
- --d3fc-negative--gradient: linear-gradient(
87
- var(--theme-bg0),
88
- var(--theme-red)
89
- ) !important;
90
-
91
- --d3fc-positive--gradient: linear-gradient(
92
- var(--theme-bg0),
93
- var(--theme-blue)
94
- ) !important;
95
-
96
- --d3fc-full--gradient: linear-gradient(
97
- var(--theme-red),
98
- var(--theme-bg0),
99
- var(--theme-blue)
100
- ) !important;
101
- }