@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.
Files changed (228) hide show
  1. package/dist/cdn/perspective-viewer.js +1 -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/phosphor.css +1 -0
  17. package/dist/css/pro-dark.css +1 -1
  18. package/dist/css/pro.css +1 -1
  19. package/dist/css/solarized-dark.css +1 -1
  20. package/dist/css/solarized.css +1 -1
  21. package/dist/css/themes.css +1 -1
  22. package/dist/css/vaporwave.css +1 -1
  23. package/dist/esm/bootstrap.d.ts +2 -1
  24. package/dist/esm/column-format.d.ts +51 -0
  25. package/dist/esm/extensions.d.ts +6 -0
  26. package/dist/esm/perspective-viewer.d.ts +4 -1
  27. package/dist/esm/perspective-viewer.inline.js +1 -2
  28. package/dist/esm/perspective-viewer.inline.js.map +4 -4
  29. package/dist/esm/perspective-viewer.js +1 -2
  30. package/dist/esm/perspective-viewer.js.map +4 -4
  31. package/dist/esm/perspective-viewer.worker.d.ts +2 -0
  32. package/dist/esm/plugin.d.ts +21 -77
  33. package/dist/esm/ts-rs/ColumnSelectMode.d.ts +1 -0
  34. package/dist/esm/ts-rs/PluginStaticConfig.d.ts +77 -0
  35. package/dist/esm/ts-rs/ViewerConfig.d.ts +39 -0
  36. package/dist/esm/ts-rs/ViewerConfigUpdate.d.ts +7 -4
  37. package/dist/wasm/perspective-viewer.d.ts +88 -24
  38. package/dist/wasm/perspective-viewer.js +320 -151
  39. package/dist/wasm/perspective-viewer.wasm +0 -0
  40. package/dist/wasm/perspective-viewer.wasm.d.ts +22 -17
  41. package/package.json +24 -2
  42. package/src/css/column-selector.css +3 -2
  43. package/src/css/column-settings-panel.css +36 -6
  44. package/src/css/column-style.css +27 -2
  45. package/src/css/containers/scroll-panel.css +2 -1
  46. package/src/css/containers/tabs.css +8 -52
  47. package/src/css/dom/checkbox.css +0 -4
  48. package/src/css/form/code-editor.css +1 -0
  49. package/src/css/form/debug.css +3 -10
  50. package/src/css/plugin-selector.css +33 -0
  51. package/src/css/plugin-settings-panel.css +99 -0
  52. package/src/css/status-bar.css +1 -1
  53. package/src/css/viewer.css +65 -3
  54. package/src/rust/components/column_dropdown.rs +3 -1
  55. package/src/rust/components/column_selector/active_column.rs +13 -19
  56. package/src/rust/components/column_selector/config_selector.rs +20 -20
  57. package/src/rust/components/column_selector/filter_column.rs +14 -14
  58. package/src/rust/components/column_selector/inactive_column.rs +9 -15
  59. package/src/rust/components/column_selector/pivot_column.rs +7 -7
  60. package/src/rust/components/column_selector/sort_column.rs +7 -7
  61. package/src/rust/components/column_selector.rs +55 -37
  62. package/src/rust/components/column_settings_sidebar/style_tab/agg_depth_selector.rs +15 -7
  63. package/src/rust/components/column_settings_sidebar/style_tab/primitive_field.rs +394 -0
  64. package/src/rust/components/column_settings_sidebar/style_tab/symbol.rs +15 -6
  65. package/src/rust/components/column_settings_sidebar/style_tab.rs +267 -136
  66. package/src/rust/components/column_settings_sidebar.rs +43 -49
  67. package/src/rust/components/containers/dragdrop_list.rs +5 -5
  68. package/src/rust/components/containers/mod.rs +0 -1
  69. package/src/rust/components/containers/scroll_panel.rs +21 -7
  70. package/src/rust/components/containers/sidebar.rs +8 -6
  71. package/src/rust/components/containers/split_panel.rs +3 -3
  72. package/src/rust/components/containers/tab_list.rs +3 -9
  73. package/src/rust/components/copy_dropdown.rs +2 -3
  74. package/src/rust/components/datetime_column_style.rs +19 -81
  75. package/src/rust/components/editable_header.rs +2 -3
  76. package/src/rust/components/export_dropdown.rs +2 -3
  77. package/src/rust/components/expression_editor.rs +29 -17
  78. package/src/rust/components/filter_dropdown.rs +2 -1
  79. package/src/rust/components/form/color_range_selector.rs +14 -7
  80. package/src/rust/components/form/debug.rs +47 -37
  81. package/src/rust/components/main_panel.rs +24 -65
  82. package/src/rust/components/mod.rs +2 -1
  83. package/src/rust/components/number_series_style.rs +161 -0
  84. package/src/rust/components/plugin_tab.rs +221 -0
  85. package/src/rust/components/settings_panel.rs +181 -59
  86. package/src/rust/components/status_bar.rs +140 -173
  87. package/src/rust/components/status_indicator.rs +15 -22
  88. package/src/rust/components/string_column_style.rs +20 -82
  89. package/src/rust/components/style_controls/number_string_format.rs +14 -30
  90. package/src/rust/components/viewer.rs +92 -132
  91. package/src/rust/config/column_config_schema.rs +195 -0
  92. package/src/rust/config/columns_config.rs +4 -97
  93. package/src/rust/config/datetime_column_style.rs +0 -5
  94. package/src/rust/config/mod.rs +8 -2
  95. package/src/rust/config/number_series_style.rs +79 -0
  96. package/src/rust/config/plugin_static_config.rs +144 -0
  97. package/src/rust/config/string_column_style.rs +0 -5
  98. package/src/rust/config/viewer_config.rs +7 -8
  99. package/src/rust/custom_elements/copy_dropdown.rs +30 -18
  100. package/src/rust/custom_elements/debug_plugin.rs +5 -7
  101. package/src/rust/custom_elements/export_dropdown.rs +26 -18
  102. package/src/rust/custom_elements/viewer.rs +77 -77
  103. package/src/rust/custom_events.rs +181 -224
  104. package/src/rust/js/plugin.rs +45 -117
  105. package/src/rust/lib.rs +39 -5
  106. package/src/rust/presentation/drag_helpers.rs +206 -0
  107. package/src/rust/presentation/props.rs +8 -0
  108. package/src/rust/presentation.rs +256 -41
  109. package/src/rust/{tasks → queries}/column_locator.rs +17 -73
  110. package/src/rust/queries/column_values.rs +59 -0
  111. package/src/rust/{tasks → queries}/columns_iter_set.rs +11 -18
  112. package/src/rust/queries/exports.rs +96 -0
  113. package/src/rust/queries/fetch_column_stats.rs +94 -0
  114. package/src/rust/queries/get_viewer_config.rs +54 -0
  115. package/src/rust/queries/mod.rs +44 -0
  116. package/src/rust/queries/plugin_column_styles.rs +101 -0
  117. package/src/rust/{engines.rs → queries/validate_expression.rs} +26 -15
  118. package/src/rust/renderer/activate.rs +1 -0
  119. package/src/rust/renderer/limits.rs +9 -4
  120. package/src/rust/renderer/plugin_store.rs +12 -0
  121. package/src/rust/renderer/props.rs +28 -3
  122. package/src/rust/renderer/registry.rs +40 -15
  123. package/src/rust/renderer.rs +649 -55
  124. package/src/rust/session/column_defaults_update.rs +20 -28
  125. package/src/rust/session/drag_drop_update.rs +10 -10
  126. package/src/rust/session/metadata.rs +31 -16
  127. package/src/rust/session/props.rs +15 -6
  128. package/src/rust/session/view_subscription.rs +10 -0
  129. package/src/rust/session.rs +109 -147
  130. package/src/rust/tasks/copy_export.rs +178 -158
  131. package/src/rust/tasks/{structural.rs → dismiss_render_warning.rs} +20 -40
  132. package/src/rust/tasks/edit_expression.rs +68 -88
  133. package/src/rust/tasks/eject.rs +25 -22
  134. package/src/rust/tasks/intersection_observer.rs +8 -21
  135. package/src/rust/tasks/mod.rs +19 -21
  136. package/src/rust/tasks/reset_all.rs +78 -0
  137. package/src/rust/tasks/resize_observer.rs +11 -33
  138. package/src/rust/tasks/restore_and_render.rs +117 -89
  139. package/src/rust/tasks/{get_viewer_config.rs → send_column_config.rs} +38 -35
  140. package/src/rust/tasks/send_plugin_config.rs +32 -33
  141. package/src/rust/tasks/update_and_render.rs +66 -47
  142. package/src/rust/{components/containers/trap_door_panel.rs → tasks/update_theme.rs} +34 -33
  143. package/src/rust/tasks/validate_expression.rs +61 -0
  144. package/src/rust/utils/browser/selection.rs +4 -4
  145. package/src/rust/utils/mod.rs +0 -63
  146. package/src/svg/datagrid-select-row-tree.svg +13 -0
  147. package/src/svg/mega-menu-icons-density.svg +23 -0
  148. package/src/svg/mega-menu-icons-map-density.svg +24 -0
  149. package/src/svg/mega-menu-icons-map-line.svg +19 -0
  150. package/src/themes/botanical.css +27 -53
  151. package/src/themes/defaults.css +42 -36
  152. package/src/themes/dracula.css +36 -54
  153. package/src/themes/gruvbox-dark.css +39 -59
  154. package/src/themes/gruvbox.css +16 -28
  155. package/src/themes/icons.css +4 -18
  156. package/src/themes/intl/de.css +42 -6
  157. package/src/themes/intl/es.css +42 -6
  158. package/src/themes/intl/fr.css +42 -6
  159. package/src/themes/intl/ja.css +42 -6
  160. package/src/themes/intl/pt.css +42 -6
  161. package/src/themes/intl/zh.css +42 -6
  162. package/src/themes/intl.css +37 -4
  163. package/src/themes/monokai.css +45 -61
  164. package/src/themes/phosphor.css +175 -0
  165. package/src/themes/pro-dark.css +25 -34
  166. package/src/themes/solarized-dark.css +21 -36
  167. package/src/themes/solarized.css +13 -23
  168. package/src/themes/themes.css +1 -0
  169. package/src/themes/vaporwave.css +40 -74
  170. package/src/ts/bootstrap.ts +14 -3
  171. package/src/ts/column-format.ts +162 -0
  172. package/src/ts/extensions.ts +12 -1
  173. package/src/ts/perspective-viewer.ts +10 -1
  174. package/src/{rust/components/column_settings_sidebar/style_tab/stub.rs → ts/perspective-viewer.worker.ts} +2 -22
  175. package/src/ts/plugin.ts +29 -105
  176. package/src/ts/ts-rs/{FormatUnit.ts → ColumnSelectMode.ts} +1 -1
  177. package/src/ts/ts-rs/PluginStaticConfig.ts +78 -0
  178. package/src/ts/ts-rs/ViewerConfig.ts +14 -0
  179. package/src/ts/ts-rs/ViewerConfigUpdate.ts +2 -3
  180. package/dist/esm/ts-rs/ColumnConfigValues.d.ts +0 -31
  181. package/dist/esm/ts-rs/CustomDatetimeFormat.d.ts +0 -1
  182. package/dist/esm/ts-rs/CustomDatetimeStyleConfig.d.ts +0 -15
  183. package/dist/esm/ts-rs/CustomNumberFormatConfig.d.ts +0 -18
  184. package/dist/esm/ts-rs/DatetimeColorMode.d.ts +0 -1
  185. package/dist/esm/ts-rs/DatetimeFormatType.d.ts +0 -6
  186. package/dist/esm/ts-rs/FormatMode.d.ts +0 -1
  187. package/dist/esm/ts-rs/FormatUnit.d.ts +0 -1
  188. package/dist/esm/ts-rs/NumberBackgroundMode.d.ts +0 -1
  189. package/dist/esm/ts-rs/NumberForegroundMode.d.ts +0 -1
  190. package/dist/esm/ts-rs/PluginConfig.d.ts +0 -2
  191. package/dist/esm/ts-rs/RoundingMode.d.ts +0 -1
  192. package/dist/esm/ts-rs/RoundingPriority.d.ts +0 -1
  193. package/dist/esm/ts-rs/SignDisplay.d.ts +0 -1
  194. package/dist/esm/ts-rs/SimpleDatetimeFormat.d.ts +0 -1
  195. package/dist/esm/ts-rs/SimpleDatetimeStyleConfig.d.ts +0 -6
  196. package/dist/esm/ts-rs/StringColorMode.d.ts +0 -1
  197. package/dist/esm/ts-rs/TrailingZeroDisplay.d.ts +0 -1
  198. package/dist/esm/ts-rs/UseGrouping.d.ts +0 -1
  199. package/src/rust/components/number_column_style.rs +0 -483
  200. package/src/rust/config/number_column_style.rs +0 -132
  201. package/src/rust/dragdrop.rs +0 -481
  202. package/src/rust/tasks/plugin_column_styles.rs +0 -98
  203. package/src/ts/ts-rs/ColumnConfigValues.ts +0 -14
  204. package/src/ts/ts-rs/CustomDatetimeFormat.ts +0 -3
  205. package/src/ts/ts-rs/CustomDatetimeStyleConfig.ts +0 -5
  206. package/src/ts/ts-rs/CustomNumberFormatConfig.ts +0 -8
  207. package/src/ts/ts-rs/DatetimeColorMode.ts +0 -3
  208. package/src/ts/ts-rs/DatetimeFormatType.ts +0 -8
  209. package/src/ts/ts-rs/FormatMode.ts +0 -3
  210. package/src/ts/ts-rs/NumberBackgroundMode.ts +0 -3
  211. package/src/ts/ts-rs/NumberForegroundMode.ts +0 -3
  212. package/src/ts/ts-rs/PluginConfig.ts +0 -4
  213. package/src/ts/ts-rs/RoundingMode.ts +0 -3
  214. package/src/ts/ts-rs/RoundingPriority.ts +0 -3
  215. package/src/ts/ts-rs/SignDisplay.ts +0 -3
  216. package/src/ts/ts-rs/SimpleDatetimeFormat.ts +0 -3
  217. package/src/ts/ts-rs/SimpleDatetimeStyleConfig.ts +0 -4
  218. package/src/ts/ts-rs/StringColorMode.ts +0 -3
  219. package/src/ts/ts-rs/TrailingZeroDisplay.ts +0 -3
  220. package/src/ts/ts-rs/UseGrouping.ts +0 -3
  221. /package/dist/wasm/snippets/{perspective-viewer-68fef752754ffbc6 → perspective-viewer-39ab7da3ca157861}/inline0.js +0 -0
  222. /package/dist/wasm/snippets/{perspective-viewer-68fef752754ffbc6 → perspective-viewer-39ab7da3ca157861}/inline1.js +0 -0
  223. /package/dist/wasm/snippets/{perspective-viewer-68fef752754ffbc6 → perspective-viewer-39ab7da3ca157861}/inline2.js +0 -0
  224. /package/dist/wasm/snippets/{perspective-viewer-68fef752754ffbc6 → perspective-viewer-39ab7da3ca157861}/inline3.js +0 -0
  225. /package/dist/wasm/snippets/{perspective-viewer-68fef752754ffbc6 → perspective-viewer-39ab7da3ca157861}/inline4.js +0 -0
  226. /package/src/rust/{tasks → config}/export_method.rs +0 -0
  227. /package/src/rust/{tasks → queries}/export_app.rs +0 -0
  228. /package/src/rust/{tasks → queries}/is_invalid_drop.rs +0 -0
package/src/ts/plugin.ts CHANGED
@@ -11,8 +11,7 @@
11
11
  // ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
12
12
 
13
13
  import type { View } from "@perspective-dev/client";
14
-
15
- // import type * as perspective from "@perspective-dev/client";
14
+ import { PluginStaticConfig } from "./ts-rs/PluginStaticConfig.js";
16
15
 
17
16
  /**
18
17
  * The `IPerspectiveViewerPlugin` interface defines the necessary API for a
@@ -21,7 +20,8 @@ import type { View } from "@perspective-dev/client";
21
20
  * scratch however, the simplest way is to inherit from
22
21
  * `<perspective-viewer-plugin>`, which implements `IPerspectiveViewerPlugin`
23
22
  * with non-offensive default implementations, where only the `draw()` and
24
- * `name()` methods need be overridden to get started with a simple plugin.
23
+ * `get_static_config()` methods need be overridden to get started with a
24
+ * simple plugin.
25
25
  *
26
26
  * Note that plugins are frozen once a `<perspective-viewer>` has been
27
27
  * instantiated, so generally new plugin code must be executed at the module
@@ -32,8 +32,8 @@ import type { View } from "@perspective-dev/client";
32
32
  * ```javascript
33
33
  * const BasePlugin = customElements.get("perspective-viewer-plugin");
34
34
  * class MyPlugin extends BasePlugin {
35
- * get name() {
36
- * return "My Plugin";
35
+ * get_static_config() {
36
+ * return { name: "My Plugin", config_column_names: [] };
37
37
  * }
38
38
  * async draw(view) {
39
39
  * const count = await view.num_rows();
@@ -49,63 +49,17 @@ import type { View } from "@perspective-dev/client";
49
49
  */
50
50
  export interface IPerspectiveViewerPlugin {
51
51
  /**
52
- * The name for this plugin, which is used as both it's unique key for use
53
- * as a parameter for the `plugin` field of a `ViewerConfig`, and as the
54
- * display name for this plugin in the `<perspective-viewer>` UI.
55
- */
56
- get name(): string;
57
-
58
- /**
59
- * Select mode determines how column add/remove buttons behave for this
60
- * plugin. `"select"` mode exclusively selects the added column, removing
61
- * other columns. `"toggle"` mode toggles the column on or off (dependent
62
- * on column state), leaving existing columns alone.
63
- */
64
- get select_mode(): string | undefined;
65
-
66
- /**
67
- * The minimum number of columns required for this plugin to operate.
68
- * This mostly affects drag/drop and column remove button behavior,
69
- * preventing the use from applying configs which violate this min.
70
- *
71
- * While this option can technically be `undefined` (as in the case of
72
- * `@perspective-dev/viewer-datagrid`), doing so currently has nearly
73
- * identical behavior to 1.
74
- */
75
- get min_config_columns(): number | undefined;
76
-
77
- /**
78
- * The named column labels, if desired. Named columns behave differently
79
- * in drag/drop mode than unnamed columns, having replace/swap behavior
80
- * rather than insert. If provided, the length of `config_column_names`
81
- * _must_ be `>= min_config_columns`, as this is assumed by the drag/drop
82
- * logic.
83
- */
84
- get config_column_names(): string[] | undefined;
85
-
86
- /**
87
- * The load priority of the plugin. If the plugin shares priority with another,
88
- * the first to load has a higher priority.
89
- *
90
- * A larger number has a higher priority.
91
- *
92
- * The plugin with the highest priority will be loaded by default by the Perspective viewer.
93
- * If you would like to instead begin with a lower priority plugin, choose it explicitly with
94
- * a `HTMLPerspectiveViewerPluginElement.restore` call.
95
- */
96
- get priority(): number | undefined;
97
-
98
- /**
99
- * Given a column's grouping (determined by indexing it in `plugin.config_column_names`)
100
- * and its view type, determines whether or not to render column styles in the settings sidebar.
101
- * Implementing this function and `column_style_config` allows the plugin to interface with the viewer's column configuration API.
52
+ * Static plugin configuration. Called exactly once per plugin at
53
+ * registration time and cached; the result must be stable for the
54
+ * lifetime of the application.
102
55
  */
103
- can_render_column_styles?: (view_type: string, group: string) => boolean;
56
+ get_static_config(): PluginStaticConfig;
104
57
 
105
58
  /**
106
59
  * Determines which column configuration controls are populated in the viewer.
107
- * Corresponds to the data the plugin will recieve on save.
108
- * Implementing this function and `can_render_column_styles` allows the plugin to interface with the viewer's column configuration API.
60
+ * Corresponds to the data the plugin will recieve on save. Only
61
+ * invoked when `can_render_column_styles` is `true` in the static
62
+ * config.
109
63
  */
110
64
  column_style_config?: (view_type: string, group: string) => any;
111
65
 
@@ -157,36 +111,23 @@ export interface IPerspectiveViewerPlugin {
157
111
  * Like `update()`, but for when the dimensions of the plugin have changed
158
112
  * and the underlying data has not.
159
113
  */
160
- resize(): Promise<void>;
114
+ resize(view: View): Promise<void>;
161
115
 
162
116
  /**
163
117
  * Notify the plugin that the style environment has changed. Useful for
164
118
  * plugins which read CSS styles via `window.getComputedStyle()`.
165
119
  */
166
- restyle(): Promise<void>;
167
-
168
- /**
169
- * Save this plugin's state to a JSON-serializable value. While this value
170
- * can be anything, it should work reciprocally with `restore()` to return
171
- * this plugin's renderer to the same state, though potentially with a
172
- * different `View`.
173
- *
174
- * `save()` should be used for user-persistent settings that are
175
- * data-agnostic, so the user can have persistent view during refresh or
176
- * reload. For example, `@perspective-dev/viewer-d3fc` uses
177
- * `plugin_config` to remember the user-repositionable legend coordinates.
178
- */
179
- save(): Promise<any>;
120
+ restyle(): void;
180
121
 
181
122
  /**
182
123
  * Restore this plugin to a state previously returned by `save()`.
183
124
  */
184
- restore(config: any): Promise<void>;
125
+ restore(config: any): void;
185
126
 
186
127
  /**
187
128
  * Free any resources acquired by this plugin and prepare to be deleted.
188
129
  */
189
- delete(): Promise<void>;
130
+ delete(): void;
190
131
  }
191
132
 
192
133
  /**
@@ -213,33 +154,16 @@ export class HTMLPerspectiveViewerPluginElement
213
154
  super();
214
155
  }
215
156
 
216
- get name(): string {
217
- return "Debug";
218
- }
219
-
220
- get select_mode(): "select" | "toggle" {
221
- return "select";
222
- }
223
-
224
- get min_config_columns(): number | undefined {
225
- return undefined;
226
- }
227
-
228
- get config_column_names(): string[] | undefined {
229
- return undefined;
230
- }
231
-
232
- get priority(): number {
233
- return 0;
234
- }
235
-
236
- can_render_column_styles(): boolean {
237
- return false;
157
+ get_static_config(): PluginStaticConfig {
158
+ return {
159
+ name: "Debug",
160
+ select_mode: "select",
161
+ config_column_names: [],
162
+ };
238
163
  }
239
164
 
240
165
  column_style_config(): any {
241
- {
242
- }
166
+ return {};
243
167
  }
244
168
 
245
169
  async update(view: View): Promise<void> {
@@ -257,23 +181,23 @@ export class HTMLPerspectiveViewerPluginElement
257
181
  this.innerHTML = "";
258
182
  }
259
183
 
260
- async resize(): Promise<void> {
184
+ async resize(view: View): Promise<void> {
261
185
  // Not Implemented
262
186
  }
263
187
 
264
- async restyle(): Promise<void> {
188
+ restyle() {
265
189
  // Not Implemented
266
190
  }
267
191
 
268
- async save(): Promise<any> {
192
+ restore(): void {
269
193
  // Not Implemented
270
194
  }
271
195
 
272
- async restore(): Promise<void> {
196
+ async delete(): Promise<void> {
273
197
  // Not Implemented
274
198
  }
275
199
 
276
- async delete(): Promise<void> {
277
- // Not Implemented
200
+ get supports_streaming(): boolean {
201
+ return false;
278
202
  }
279
203
  }
@@ -1,3 +1,3 @@
1
1
  // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
2
 
3
- export type FormatUnit = "custom";
3
+ export type ColumnSelectMode = "toggle" | "select";
@@ -0,0 +1,78 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+ import type { ColumnSelectMode } from "./ColumnSelectMode.js";
3
+ import type { GroupRollupMode } from "./GroupRollupMode.js";
4
+
5
+ /**
6
+ * Static, immutable configuration for a plugin.
7
+ *
8
+ * Returned once per plugin from `get_static_config()` at registration
9
+ * time and cached in [`crate::renderer::PluginRecord`]. Consumers
10
+ * (renderer, session, queries, components) read these fields off the
11
+ * renderer's active-plugin metadata rather than calling back into JS.
12
+ *
13
+ * `<perspective-viewer>` reads this exactly once per plugin (at
14
+ * `registerPlugin` time) and caches it for the lifetime of the
15
+ * application. The result must be stable; do not mutate any field
16
+ * after registration.
17
+ */
18
+ export type PluginStaticConfig = {
19
+ /**
20
+ * The unique key for this plugin. Used as the `plugin` field in a
21
+ * `ViewerConfig` and as the display name key in the
22
+ * `<perspective-viewer>` UI.
23
+ */
24
+ name: string,
25
+ /**
26
+ * Category in the plugin picker menu.
27
+ */
28
+ category?: string | null,
29
+ /**
30
+ * Soft limit on the number of columns the plugin will render.
31
+ * Triggers the "Rendering N of M" warning when the view exceeds
32
+ * this value (until dismissed).
33
+ */
34
+ max_columns?: number | null,
35
+ /**
36
+ * Soft limit on the number of cells (rows × columns) the plugin
37
+ * will render. Triggers the "Rendering N of M" warning when the view
38
+ * exceeds this value (until dismissed).
39
+ */
40
+ max_cells?: number | null,
41
+ /**
42
+ * Column add/remove behavior. `"select"` exclusively selects the
43
+ * added column, removing other columns. `"toggle"` toggles the
44
+ * column on or off based on its current state, leaving other
45
+ * columns alone.
46
+ */
47
+ select_mode?: ColumnSelectMode,
48
+ /**
49
+ * Minimum number of columns the plugin requires to render. Mostly
50
+ * affects drag/drop and column-remove button behavior. `undefined`
51
+ * is treated identically to `1`.
52
+ */
53
+ min_config_columns?: number | null,
54
+ /**
55
+ * Named column slots. Named columns have replace/swap behavior in
56
+ * drag/drop rather than insert. The length must be at least
57
+ * `min_config_columns`.
58
+ */
59
+ config_column_names?: Array<string>,
60
+ /**
61
+ * Group-rollup modes the plugin accepts, in preference order.
62
+ * The first entry that matches a feature flag becomes the default.
63
+ */
64
+ group_rollup_modes?: Array<GroupRollupMode> | null,
65
+ /**
66
+ * Plugin load priority. Higher numbers win; ties resolve in
67
+ * registration order. The highest-priority plugin is loaded by
68
+ * default unless `restore({ plugin })` overrides it.
69
+ */
70
+ priority?: number | null,
71
+ /**
72
+ * Whether this plugin opts into per-column style controls in the
73
+ * settings sidebar. When `true`, the StyleTab is shown for active
74
+ * columns and the plugin's `column_config_schema` is queried for
75
+ * the per-column field set. When `false` or omitted, no StyleTab
76
+ * is shown.
77
+ */
78
+ can_render_column_styles?: boolean, };
@@ -0,0 +1,14 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+ import type { Aggregate } from "./Aggregate.js";
3
+ import type { Expressions } from "./Expressions.js";
4
+ import type { Filter } from "./Filter.js";
5
+ import type { FilterReducer } from "./FilterReducer.js";
6
+ import type { GroupRollupMode } from "./GroupRollupMode.js";
7
+ import type { Sort } from "./Sort.js";
8
+ import type { JsonValue } from "./serde_json/JsonValue.js";
9
+
10
+ /**
11
+ * The state of an entire `custom_elements::PerspectiveViewerElement` component
12
+ * and its `Plugin`.
13
+ */
14
+ export type ViewerConfig<V = string> = { version: V, columns_config: { [key in string]?: { [key in string]?: JsonValue } }, plugin: string, plugin_config: { [key in string]?: JsonValue }, settings: boolean, table: string | null, theme: string | null, title: string | null, group_by: Array<string>, split_by: Array<string>, sort: Array<Sort>, filter: Array<Filter>, group_rollup_mode: GroupRollupMode, filter_op?: FilterReducer, expressions: Expressions, columns: Array<string | null>, aggregates: { [key in string]?: Aggregate }, group_by_depth?: number | null, };
@@ -1,15 +1,14 @@
1
1
  // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
2
  import type { Aggregate } from "./Aggregate.js";
3
- import type { ColumnConfigValues } from "./ColumnConfigValues.js";
4
3
  import type { Expressions } from "./Expressions.js";
5
4
  import type { Filter } from "./Filter.js";
6
5
  import type { FilterReducer } from "./FilterReducer.js";
7
6
  import type { GroupRollupMode } from "./GroupRollupMode.js";
8
7
  import type { OptionalUpdate } from "./OptionalUpdate.js";
9
- import type { PluginConfig } from "./PluginConfig.js";
10
8
  import type { Sort } from "./Sort.js";
9
+ import type { JsonValue } from "./serde_json/JsonValue.js";
11
10
 
12
- export type ViewerConfigUpdate = { version?: OptionalUpdate<string>, plugin?: OptionalUpdate<string>, title?: OptionalUpdate<string>, table?: OptionalUpdate<string>, theme?: OptionalUpdate<string>, settings?: OptionalUpdate<boolean>, plugin_config?: PluginConfig | null, columns_config?: OptionalUpdate<{ [key in string]?: ColumnConfigValues }>,
11
+ export type ViewerConfigUpdate = { version?: OptionalUpdate<string>, plugin?: OptionalUpdate<string>, title?: OptionalUpdate<string>, table?: OptionalUpdate<string>, theme?: OptionalUpdate<string>, settings?: OptionalUpdate<boolean>, plugin_config?: OptionalUpdate<{ [key in string]?: JsonValue }>, columns_config?: OptionalUpdate<{ [key in string]?: { [key in string]?: JsonValue } }>,
13
12
  /**
14
13
  * A group by _groups_ the dataset by the unique values of each column used
15
14
  * as a group by - a close analogue in SQL to the `GROUP BY` statement.
@@ -1,31 +0,0 @@
1
- import type { CustomNumberFormatConfig } from "./CustomNumberFormatConfig.js";
2
- import type { DatetimeColorMode } from "./DatetimeColorMode.js";
3
- import type { DatetimeFormatType } from "./DatetimeFormatType.js";
4
- import type { FormatMode } from "./FormatMode.js";
5
- import type { NumberBackgroundMode } from "./NumberBackgroundMode.js";
6
- import type { NumberForegroundMode } from "./NumberForegroundMode.js";
7
- import type { StringColorMode } from "./StringColorMode.js";
8
- /**
9
- * The value de/serialized and stored in the viewer config.
10
- * Also passed to the plugin via `plugin.save()`.
11
- */
12
- export type ColumnConfigValues = {
13
- symbols?: {
14
- [key in string]?: string;
15
- };
16
- number_format?: CustomNumberFormatConfig | null;
17
- aggregate_depth?: number;
18
- number_fg_mode?: NumberForegroundMode;
19
- number_bg_mode?: NumberBackgroundMode;
20
- pos_fg_color: string | null;
21
- neg_fg_color: string | null;
22
- pos_bg_color: string | null;
23
- neg_bg_color: string | null;
24
- fg_gradient: number | null;
25
- bg_gradient: number | null;
26
- format?: FormatMode;
27
- string_color_mode?: StringColorMode;
28
- color?: string | null;
29
- date_format?: DatetimeFormatType;
30
- datetime_color_mode?: DatetimeColorMode;
31
- };
@@ -1 +0,0 @@
1
- export type CustomDatetimeFormat = "long" | "short" | "narrow" | "numeric" | "2-digit" | "disabled";
@@ -1,15 +0,0 @@
1
- import type { CustomDatetimeFormat } from "./CustomDatetimeFormat.js";
2
- import type { FormatUnit } from "./FormatUnit.js";
3
- export type CustomDatetimeStyleConfig = {
4
- format: FormatUnit;
5
- timeZone?: string | null;
6
- fractionalSecondDigits?: number;
7
- second?: CustomDatetimeFormat;
8
- minute?: CustomDatetimeFormat;
9
- hour?: CustomDatetimeFormat;
10
- day?: CustomDatetimeFormat;
11
- weekday?: CustomDatetimeFormat;
12
- month?: CustomDatetimeFormat;
13
- year?: CustomDatetimeFormat;
14
- hour12?: boolean;
15
- };
@@ -1,18 +0,0 @@
1
- import type { RoundingMode } from "./RoundingMode.js";
2
- import type { RoundingPriority } from "./RoundingPriority.js";
3
- import type { SignDisplay } from "./SignDisplay.js";
4
- import type { TrailingZeroDisplay } from "./TrailingZeroDisplay.js";
5
- import type { UseGrouping } from "./UseGrouping.js";
6
- export type CustomNumberFormatConfig = {
7
- minimumIntegerDigits: number | null;
8
- minimumFractionDigits: number | null;
9
- maximumFractionDigits: number | null;
10
- minimumSignificantDigits: number | null;
11
- maximumSignificantDigits: number | null;
12
- roundingPriority: RoundingPriority | null;
13
- roundingIncrement: number | null;
14
- roundingMode: RoundingMode | null;
15
- trailingZeroDisplay: TrailingZeroDisplay | null;
16
- useGrouping: UseGrouping | null;
17
- signDisplay: SignDisplay | null;
18
- };
@@ -1 +0,0 @@
1
- export type DatetimeColorMode = "none" | "foreground" | "background";
@@ -1,6 +0,0 @@
1
- import type { CustomDatetimeStyleConfig } from "./CustomDatetimeStyleConfig.js";
2
- import type { SimpleDatetimeStyleConfig } from "./SimpleDatetimeStyleConfig.js";
3
- /**
4
- * `Simple` case has all default-able keys and must be last!
5
- */
6
- export type DatetimeFormatType = CustomDatetimeStyleConfig | SimpleDatetimeStyleConfig;
@@ -1 +0,0 @@
1
- export type FormatMode = "none" | "link" | "bold" | "italics";
@@ -1 +0,0 @@
1
- export type FormatUnit = "custom";
@@ -1 +0,0 @@
1
- export type NumberBackgroundMode = "disabled" | "color" | "gradient" | "pulse";
@@ -1 +0,0 @@
1
- export type NumberForegroundMode = "disabled" | "color" | "bar";
@@ -1,2 +0,0 @@
1
- import type { JsonValue } from "./serde_json/JsonValue.js";
2
- export type PluginConfig = JsonValue;
@@ -1 +0,0 @@
1
- export type RoundingMode = "ceil" | "floor" | "expand" | "trunc" | "halfCeil" | "halfFloor" | "halfExpand" | "halfTrunc" | "halfEven";
@@ -1 +0,0 @@
1
- export type RoundingPriority = "auto" | "morePrecision" | "lessPrecision";
@@ -1 +0,0 @@
1
- export type SignDisplay = "auto" | "always" | "exceptZero" | "negative" | "never";
@@ -1 +0,0 @@
1
- export type SimpleDatetimeFormat = "full" | "long" | "medium" | "short" | "disabled";
@@ -1,6 +0,0 @@
1
- import type { SimpleDatetimeFormat } from "./SimpleDatetimeFormat.js";
2
- export type SimpleDatetimeStyleConfig = {
3
- timeZone?: string | null;
4
- dateStyle?: SimpleDatetimeFormat;
5
- timeStyle?: SimpleDatetimeFormat;
6
- };
@@ -1 +0,0 @@
1
- export type StringColorMode = "none" | "foreground" | "background" | "series";
@@ -1 +0,0 @@
1
- export type TrailingZeroDisplay = "auto" | "stripIfInteger";
@@ -1 +0,0 @@
1
- export type UseGrouping = "always" | "auto" | "min2" | boolean;