@perspective-dev/viewer 5.5.1 → 5.6.1

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 (206) hide show
  1. package/README.md +82 -3
  2. package/dist/cdn/perspective-viewer.js +9 -9
  3. package/dist/cdn/perspective-viewer.js.map +4 -4
  4. package/dist/css/blueprint.css +1 -1
  5. package/dist/css/botanical.css +1 -1
  6. package/dist/css/dracula.css +1 -1
  7. package/dist/css/eggplant.css +1 -1
  8. package/dist/css/gruvbox-dark.css +1 -1
  9. package/dist/css/gruvbox.css +1 -1
  10. package/dist/css/icons.css +1 -1
  11. package/dist/css/intl/ar.css +1 -1
  12. package/dist/css/intl/de.css +1 -1
  13. package/dist/css/intl/es.css +1 -1
  14. package/dist/css/intl/fr.css +1 -1
  15. package/dist/css/intl/ja.css +1 -1
  16. package/dist/css/intl/pt.css +1 -1
  17. package/dist/css/intl/zh.css +1 -1
  18. package/dist/css/intl.css +1 -1
  19. package/dist/css/ledger.css +1 -1
  20. package/dist/css/monokai.css +1 -1
  21. package/dist/css/nord.css +1 -1
  22. package/dist/css/phosphor.css +1 -1
  23. package/dist/css/pro-dark.css +1 -1
  24. package/dist/css/pro.css +1 -1
  25. package/dist/css/solarized-dark.css +1 -1
  26. package/dist/css/solarized.css +1 -1
  27. package/dist/css/themes.css +1 -1
  28. package/dist/css/vaporwave.css +1 -1
  29. package/dist/css/velvet.css +1 -1
  30. package/dist/docs/perspective-docs.json +1 -1
  31. package/dist/esm/column-format.js +2 -0
  32. package/dist/esm/column-format.js.map +7 -0
  33. package/dist/esm/extensions.d.ts +3 -13
  34. package/dist/esm/perspective-viewer.d.ts +1 -1
  35. package/dist/esm/perspective-viewer.js +9 -9
  36. package/dist/esm/perspective-viewer.js.map +4 -4
  37. package/dist/esm/plugin.d.ts +4 -1
  38. package/dist/esm/select-detail.d.ts +15 -0
  39. package/dist/esm/select-detail.js +2 -0
  40. package/dist/esm/select-detail.js.map +7 -0
  41. package/dist/esm/ts-rs/DerivedTableConfig.d.ts +35 -0
  42. package/dist/esm/ts-rs/Layout.d.ts +2 -2
  43. package/dist/esm/ts-rs/Orientation.d.ts +2 -1
  44. package/dist/esm/ts-rs/PanelViewerConfig.d.ts +7 -6
  45. package/dist/esm/ts-rs/RestoreOptions.d.ts +3 -7
  46. package/dist/esm/ts-rs/SplitLayout.d.ts +13 -0
  47. package/dist/esm/ts-rs/TabLayout.d.ts +3 -0
  48. package/dist/esm/ts-rs/TableRef.d.ts +9 -0
  49. package/dist/esm/ts-rs/ViewerConfig.d.ts +7 -6
  50. package/dist/esm/ts-rs/ViewerConfigUpdate.d.ts +7 -5
  51. package/dist/esm/ts-rs/WorkspaceConfig.d.ts +9 -1
  52. package/dist/esm/ts-rs/WorkspaceConfigUpdate.d.ts +11 -1
  53. package/dist/wasm/perspective-viewer.d.ts +115 -35
  54. package/dist/wasm/perspective-viewer.js +312 -188
  55. package/dist/wasm/perspective-viewer.wasm +0 -0
  56. package/dist/wasm/perspective-viewer.wasm.d.ts +21 -17
  57. package/package.json +32 -19
  58. package/src/css/column-selector.css +205 -50
  59. package/src/css/ui/containers/context-menu.css +12 -1
  60. package/src/css/ui/containers/dropdown-menu-items.css +29 -0
  61. package/src/css/ui/containers/scroll-panel.css +4 -1
  62. package/src/rust/agent/client/protocol.rs +0 -89
  63. package/src/rust/agent/markdown/mod.rs +0 -238
  64. package/src/rust/agent/preamble.md +3 -0
  65. package/src/rust/agent/tools.rs +282 -17
  66. package/src/rust/components/column_selector/active_column.rs +15 -5
  67. package/src/rust/components/column_selector/add_expression_button.rs +9 -26
  68. package/src/rust/components/column_selector/config_selector.rs +35 -7
  69. package/src/rust/components/column_selector/derived_control.rs +229 -0
  70. package/src/rust/components/column_selector/expr_edit_button.rs +3 -2
  71. package/src/rust/components/column_selector/filter_column.rs +2 -4
  72. package/src/rust/components/column_selector/inactive_column.rs +4 -5
  73. package/src/rust/components/column_selector/pivot_column.rs +21 -1
  74. package/src/rust/components/column_selector/sort_column.rs +4 -3
  75. package/src/rust/components/column_selector.rs +21 -1
  76. package/src/rust/components/column_settings_sidebar/save_settings.rs +5 -3
  77. package/src/rust/components/column_settings_sidebar/style_tab/symbol/row_selector.rs +1 -1
  78. package/src/rust/components/column_settings_sidebar/style_tab.rs +1 -0
  79. package/src/rust/components/column_settings_sidebar.rs +25 -19
  80. package/src/rust/components/debug_panel.rs +38 -29
  81. package/src/rust/components/dragdrop_list.rs +8 -9
  82. package/src/rust/components/empty_row.rs +3 -3
  83. package/src/rust/components/filter_dropdown.rs +100 -101
  84. package/src/rust/components/main_panel/msg.rs +6 -4
  85. package/src/rust/components/main_panel/reconcile.rs +67 -25
  86. package/src/rust/components/main_panel/render.rs +70 -51
  87. package/src/rust/components/main_panel/update.rs +20 -21
  88. package/src/rust/components/main_panel.rs +87 -60
  89. package/src/rust/components/new_panel_menu.rs +69 -1
  90. package/src/rust/components/panel_menu.rs +63 -12
  91. package/src/rust/components/plugin_tab.rs +3 -2
  92. package/src/rust/components/render_warning.rs +2 -1
  93. package/src/rust/components/settings_panel.rs +4 -4
  94. package/src/rust/components/status_bar.rs +74 -24
  95. package/src/rust/components/status_indicator.rs +8 -1
  96. package/src/rust/components/viewer/filters.rs +13 -1
  97. package/src/rust/components/viewer/msg.rs +4 -0
  98. package/src/rust/components/viewer/panels.rs +41 -1
  99. package/src/rust/components/viewer/render.rs +1 -0
  100. package/src/rust/components/viewer/settings.rs +0 -22
  101. package/src/rust/components/viewer/snapshots.rs +2 -2
  102. package/src/rust/components/viewer/wiring.rs +14 -0
  103. package/src/rust/components/viewer.rs +45 -25
  104. package/src/rust/components/window_editor.rs +5 -4
  105. package/src/rust/config/column_config_schema.rs +38 -377
  106. package/src/rust/config/number_string_format.rs +0 -94
  107. package/src/rust/config/options.rs +3 -7
  108. package/src/rust/config/plugin_static_config.rs +0 -42
  109. package/src/rust/config/viewer_config.rs +47 -17
  110. package/src/rust/config/workspace_config.rs +160 -129
  111. package/src/rust/custom_elements/viewer.rs +187 -131
  112. package/src/rust/custom_events.rs +33 -18
  113. package/src/rust/derived.rs +266 -0
  114. package/src/rust/exprtk/tokenize.rs +0 -54
  115. package/src/rust/js/plugin.rs +1 -1
  116. package/src/rust/js/regular_layout.rs +225 -3
  117. package/src/rust/lib.rs +3 -0
  118. package/src/rust/presentation.rs +23 -4
  119. package/src/rust/queries/column_locator.rs +55 -48
  120. package/src/rust/queries/get_viewer_config.rs +1 -1
  121. package/src/rust/queries/plugin_column_styles.rs +22 -23
  122. package/src/rust/renderer/dispatch.rs +2 -0
  123. package/src/rust/renderer/plugin_config.rs +652 -487
  124. package/src/rust/renderer/props.rs +4 -0
  125. package/src/rust/renderer/registry.rs +2 -6
  126. package/src/rust/renderer/state.rs +205 -0
  127. package/src/rust/renderer.rs +201 -59
  128. package/src/rust/session/metadata.rs +30 -9
  129. package/src/rust/session/op_queue.rs +430 -0
  130. package/src/rust/session/panel_state.rs +327 -0
  131. package/src/rust/session/view_subscription.rs +42 -3
  132. package/src/rust/session.rs +900 -395
  133. package/src/rust/tasks/apply_global_filters.rs +49 -35
  134. package/src/rust/tasks/auto_pause.rs +22 -12
  135. package/src/rust/tasks/copy_export.rs +5 -0
  136. package/src/rust/tasks/create_panel.rs +34 -9
  137. package/src/rust/tasks/derive.rs +312 -0
  138. package/src/rust/tasks/mod.rs +6 -2
  139. package/src/rust/tasks/pipeline.rs +145 -89
  140. package/src/rust/tasks/reset_all.rs +31 -20
  141. package/src/rust/tasks/restore_derived.rs +200 -0
  142. package/src/rust/tasks/restore_panel.rs +153 -141
  143. package/src/rust/tasks/send_column_config.rs +56 -29
  144. package/src/rust/tasks/send_plugin_config.rs +52 -23
  145. package/src/rust/tasks/set_edit_mode.rs +33 -25
  146. package/src/rust/tasks/sync_update_panels.rs +30 -12
  147. package/src/rust/tasks/table_lifecycle.rs +70 -34
  148. package/src/rust/tasks/transactional_restore.rs +387 -0
  149. package/src/rust/tasks/update_theme.rs +45 -6
  150. package/src/rust/ui/containers/scroll_panel.rs +17 -10
  151. package/src/rust/ui/containers/split_panel.rs +0 -41
  152. package/src/rust/ui/context_menu.rs +157 -18
  153. package/src/rust/ui/font_loader.rs +23 -35
  154. package/src/rust/ui/form/mirrored_textarea.rs +0 -12
  155. package/src/rust/ui/form/multi_stop_gradient_selector.rs +0 -89
  156. package/src/rust/ui/form/palette_selector.rs +0 -51
  157. package/src/rust/ui/portal.rs +4 -10
  158. package/src/rust/utils/browser/mod.rs +2 -3
  159. package/src/{ts/perspective-viewer.inline.ts → rust/utils/browser/mouse.rs} +11 -10
  160. package/src/rust/utils/browser/request_animation_frame.rs +27 -8
  161. package/src/rust/utils/css.rs +0 -360
  162. package/src/rust/utils/local_fonts.rs +0 -36
  163. package/src/rust/utils/mod.rs +2 -3
  164. package/src/rust/utils/modal_position.rs +15 -21
  165. package/src/rust/utils/{browser/tests/mod.rs → plugin_host_state.rs} +31 -1
  166. package/src/rust/utils/pubsub.rs +0 -1
  167. package/src/rust/workspace.rs +187 -140
  168. package/src/svg/derived.svg +6 -0
  169. package/src/themes/icons.css +1 -0
  170. package/src/themes/intl/ar.css +11 -0
  171. package/src/themes/intl/de.css +11 -0
  172. package/src/themes/intl/es.css +11 -0
  173. package/src/themes/intl/fr.css +11 -0
  174. package/src/themes/intl/ja.css +11 -0
  175. package/src/themes/intl/pt.css +11 -0
  176. package/src/themes/intl/zh.css +11 -0
  177. package/src/themes/intl.css +11 -0
  178. package/src/ts/extensions.ts +3 -36
  179. package/src/ts/perspective-viewer.ts +1 -1
  180. package/src/ts/plugin.ts +4 -1
  181. package/src/{rust/utils/tests/request_animation_frame.rs → ts/select-detail.ts} +32 -26
  182. package/src/ts/ts-rs/DerivedTableConfig.ts +22 -0
  183. package/src/ts/ts-rs/Layout.ts +2 -2
  184. package/src/ts/ts-rs/Orientation.ts +2 -1
  185. package/src/ts/ts-rs/PanelViewerConfig.ts +7 -6
  186. package/src/ts/ts-rs/RestoreOptions.ts +3 -7
  187. package/src/ts/ts-rs/SplitLayout.ts +17 -1
  188. package/src/ts/ts-rs/TabLayout.ts +3 -0
  189. package/src/ts/ts-rs/TableRef.ts +9 -0
  190. package/src/ts/ts-rs/ViewerConfig.ts +7 -6
  191. package/src/ts/ts-rs/ViewerConfigUpdate.ts +7 -5
  192. package/src/ts/ts-rs/WorkspaceConfig.ts +7 -1
  193. package/src/ts/ts-rs/WorkspaceConfigUpdate.ts +9 -1
  194. package/dist/esm/perspective-viewer.inline.d.ts +0 -3
  195. package/dist/esm/perspective-viewer.inline.js +0 -21
  196. package/dist/esm/perspective-viewer.inline.js.map +0 -7
  197. package/src/rust/tasks/restore_and_render.rs +0 -107
  198. package/src/rust/utils/browser/tests/debounce.rs +0 -163
  199. package/src/rust/utils/tests/mod.rs +0 -14
  200. package/src/rust/utils/tests/pubsub.rs +0 -95
  201. /package/dist/wasm/snippets/{perspective-viewer-6813b568219c6763 → perspective-viewer-7fc45549159e01e4}/inline0.js +0 -0
  202. /package/dist/wasm/snippets/{perspective-viewer-6813b568219c6763 → perspective-viewer-7fc45549159e01e4}/inline1.js +0 -0
  203. /package/dist/wasm/snippets/{perspective-viewer-6813b568219c6763 → perspective-viewer-7fc45549159e01e4}/inline2.js +0 -0
  204. /package/dist/wasm/snippets/{perspective-viewer-6813b568219c6763 → perspective-viewer-7fc45549159e01e4}/inline3.js +0 -0
  205. /package/dist/wasm/snippets/{perspective-viewer-6813b568219c6763 → perspective-viewer-7fc45549159e01e4}/inline4.js +0 -0
  206. /package/dist/wasm/snippets/{perspective-viewer-6813b568219c6763 → perspective-viewer-7fc45549159e01e4}/inline5.js +0 -0
@@ -74,6 +74,8 @@ perspective-viewer {
74
74
 
75
75
  /* Column Settings */
76
76
  --psp-label--color--content: "颜色";
77
+ --psp-label--palette--content: "调色板";
78
+ --psp-label--gradient--content: "渐变";
77
79
  --psp-label--timezone--content: "时区";
78
80
  --psp-label--date-style--content: "日期样式";
79
81
  --psp-label--time-style--content: "时间风格";
@@ -171,6 +173,7 @@ perspective-viewer {
171
173
  --psp-label--point-size-px--content: "点大小";
172
174
  --psp-label--band-inner-frac--content: "带宽";
173
175
  --psp-label--bar-inner-pad--content: "条形间距";
176
+ --psp-label--group-pad--content: "分组间距";
174
177
  --psp-label--wick-width-px--content: "影线宽度";
175
178
  --psp-label--ohlc-line-width-px--content: "OHLC线宽";
176
179
  --psp-label--include-zero--content: "包含零";
@@ -204,4 +207,12 @@ perspective-viewer {
204
207
  --psp-label--group-column--content: "列";
205
208
  --psp-label--group-format--content: "格式";
206
209
  --psp-label--column-size-override--content: "列宽";
210
+
211
+ /* Derived tables */
212
+ --psp-label--derive-table--content: "派生表";
213
+ --psp-label--derive-table-title--content: "从此视图派生新表";
214
+ --psp-label--derived-snapshot--content: "快照";
215
+ --psp-label--derived-snapshot-title--content: "此数据源不支持流式更新 - 该表的数据固定在派生时的状态。";
216
+ --psp-label--derived-release-title--content: "返回父表";
217
+ --psp-label--derived-release-delete-title--content: "返回父表 - Shift+点击可将其删除";
207
218
  }
@@ -74,6 +74,8 @@ perspective-viewer {
74
74
 
75
75
  /* Column Settings */
76
76
  --psp-label--color--content: "Color";
77
+ --psp-label--palette--content: "Palette";
78
+ --psp-label--gradient--content: "Gradient";
77
79
  --psp-label--timezone--content: "Timezone";
78
80
  --psp-label--date-style--content: "Date Style";
79
81
  --psp-label--time-style--content: "Time Style";
@@ -184,6 +186,7 @@ perspective-viewer {
184
186
  --psp-label--point-size-px--content: "Point size";
185
187
  --psp-label--band-inner-frac--content: "Band width";
186
188
  --psp-label--bar-inner-pad--content: "Bar padding";
189
+ --psp-label--group-pad--content: "Group padding";
187
190
  --psp-label--wick-width-px--content: "Wick width";
188
191
  --psp-label--ohlc-line-width-px--content: "OHLC line width";
189
192
  --psp-label--include-zero--content: "Include zero";
@@ -206,4 +209,12 @@ perspective-viewer {
206
209
  --psp-label--legend-opacity--content: "Opacity";
207
210
  --psp-label--tooltip-max-column-px--content: "Max column width";
208
211
  --psp-label--tooltip-opacity--content: "Opacity";
212
+
213
+ /* Derived tables */
214
+ --psp-label--derive-table--content: "Derive table";
215
+ --psp-label--derive-table-title--content: "Derive a new table from this view";
216
+ --psp-label--derived-snapshot--content: "snapshot";
217
+ --psp-label--derived-snapshot-title--content: "This data source does not stream - this table's data is fixed at the point it was derived.";
218
+ --psp-label--derived-release-title--content: "Back to the parent table";
219
+ --psp-label--derived-release-delete-title--content: "Back to the parent table - shift-click to delete this one";
209
220
  }
@@ -14,43 +14,10 @@ import type { HTMLPerspectiveViewerPluginElement } from "./plugin";
14
14
  import type { PerspectiveViewerElement } from "../../dist/wasm/perspective-viewer.js";
15
15
  import type React from "react";
16
16
  import type { ViewerConfigUpdate } from "./ts-rs/ViewerConfigUpdate.js";
17
- import type {
18
- ViewWindow,
19
- ViewConfigUpdate,
20
- Filter,
21
- } from "@perspective-dev/client";
22
-
23
- export class PerspectiveSelectDetail {
24
- selected: boolean;
25
- row: Record<string, unknown>;
26
- column_names?: string[];
27
- removeConfigs: ViewConfigUpdate[];
28
- insertConfigs: ViewConfigUpdate[];
29
- panel?: string;
30
- constructor(
31
- selected: boolean,
32
- row: Record<string, unknown>,
33
- column_names: string[],
34
- removeConfigs: ViewConfigUpdate[],
35
- insertConfigs: ViewConfigUpdate[],
36
- panel?: string,
37
- ) {
38
- this.selected = selected;
39
- this.row = row;
40
- this.column_names = column_names;
41
- this.removeConfigs = removeConfigs;
42
- this.insertConfigs = insertConfigs;
43
- this.panel = panel;
44
- }
45
-
46
- get removeFilters(): Filter[] {
47
- return this.removeConfigs.flatMap((x) => x.filter ?? []);
48
- }
17
+ import type { ViewWindow, Filter } from "@perspective-dev/client";
18
+ import type { PerspectiveSelectDetail } from "./select-detail.ts";
49
19
 
50
- get insertFilters(): Filter[] {
51
- return this.insertConfigs.flatMap((x) => x.filter ?? []);
52
- }
53
- }
20
+ export { PerspectiveSelectDetail } from "./select-detail.ts";
54
21
 
55
22
  // DOM extensions
56
23
 
@@ -47,7 +47,7 @@ export {
47
47
  export type { NumberFormatConfig, DateFormatConfig } from "./column-format";
48
48
 
49
49
  export type * from "./extensions.ts";
50
- export { PerspectiveSelectDetail } from "./extensions.ts";
50
+ export { PerspectiveSelectDetail } from "./select-detail.ts";
51
51
  export type * from "./ts-rs/ViewerConfigUpdate.d.ts";
52
52
  export type * from "./ts-rs/ViewerConfig.d.ts";
53
53
  export type * from "./ts-rs/WorkspaceConfigUpdate.d.ts";
package/src/ts/plugin.ts CHANGED
@@ -97,6 +97,9 @@ export interface IPerspectiveViewerPlugin {
97
97
  * The per-column Style-tab schema: the controls the viewer renders
98
98
  * for one column, re-queried on every field edit so the field set
99
99
  * may depend on `current_value`.
100
+ *
101
+ * Must be a function of its arguments alone, never of what this element
102
+ * last drew or was last `restore`d with.
100
103
  */
101
104
  column_config_schema?(
102
105
  view_type: string,
@@ -104,7 +107,7 @@ export interface IPerspectiveViewerPlugin {
104
107
  column_name: string,
105
108
  current_value: Record<string, unknown> | null,
106
109
  viewer_config?: Record<string, unknown>,
107
- column_stats?: Record<string, unknown>,
110
+ plugin_config?: Record<string, unknown> | null,
108
111
  ): { fields: Array<Record<string, unknown> & { kind: string }> };
109
112
 
110
113
  /**
@@ -10,33 +10,39 @@
10
10
  // ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
11
11
  // ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
12
12
 
13
- use std::cell::*;
14
- use std::rc::*;
13
+ import type { ViewConfigUpdate, Filter } from "@perspective-dev/client";
15
14
 
16
- use wasm_bindgen_futures::spawn_local;
17
- use wasm_bindgen_test::*;
15
+ /**
16
+ * The `detail` of a `perspective-global-filter` event.
17
+ */
18
+ export class PerspectiveSelectDetail {
19
+ selected: boolean;
20
+ row: Record<string, unknown>;
21
+ column_names?: string[];
22
+ removeConfigs: ViewConfigUpdate[];
23
+ insertConfigs: ViewConfigUpdate[];
24
+ panel?: string;
25
+ constructor(
26
+ selected: boolean,
27
+ row: Record<string, unknown>,
28
+ column_names: string[],
29
+ removeConfigs: ViewConfigUpdate[],
30
+ insertConfigs: ViewConfigUpdate[],
31
+ panel?: string,
32
+ ) {
33
+ this.selected = selected;
34
+ this.row = row;
35
+ this.column_names = column_names;
36
+ this.removeConfigs = removeConfigs;
37
+ this.insertConfigs = insertConfigs;
38
+ this.panel = panel;
39
+ }
18
40
 
19
- use crate::utils::*;
41
+ get removeFilters(): Filter[] {
42
+ return this.removeConfigs.flatMap((x) => x.filter ?? []);
43
+ }
20
44
 
21
- #[wasm_bindgen_test]
22
- async fn test_request_animation_frame_async() {
23
- // Merely test that this Promise resolves at all ..
24
- request_animation_frame().await;
25
- }
26
-
27
- #[wasm_bindgen_test]
28
- async fn test_async_in_correct_order() {
29
- let cell = Rc::new(RefCell::new(vec![]));
30
- spawn_local({
31
- clone!(cell);
32
- async move {
33
- request_animation_frame().await;
34
- cell.borrow_mut().push("1");
35
- }
36
- });
37
-
38
- request_animation_frame().await;
39
- cell.borrow_mut().push("2");
40
- request_animation_frame().await;
41
- assert_eq!(vec!["2", "1"], *cell.borrow());
45
+ get insertFilters(): Filter[] {
46
+ return this.insertConfigs.flatMap((x) => x.filter ?? []);
47
+ }
42
48
  }
@@ -0,0 +1,22 @@
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 { SplitRollupMode } from "./SplitRollupMode.js";
9
+ import type { Windows } from "./Windows.js";
10
+
11
+ /**
12
+ * A derived `Table`'s definition: the `Table` its source `View` reads, and
13
+ * the config of that `View`; generic over the `table` slot, which is a name
14
+ * in the workspace `derived_tables` map and a recursive [`TableRef`] when
15
+ * inlined in a single-panel config.
16
+ */
17
+ export type DerivedTableConfig<T = string> = {
18
+ /**
19
+ * The `Table` this derivation reads, which may itself be another
20
+ * derived `Table`.
21
+ */
22
+ table: T, group_by: Array<string>, split_by: Array<string>, sort: Array<Sort>, filter: Array<Filter>, group_rollup_mode: GroupRollupMode, split_rollup_mode: SplitRollupMode, filter_op?: FilterReducer, expressions: Expressions, windows?: Windows, columns: Array<string | null>, aggregates: { [key in string]?: Aggregate }, group_by_depth?: number | null, };
@@ -3,7 +3,7 @@ import type { SplitLayout } from "./SplitLayout.js";
3
3
  import type { TabLayout } from "./TabLayout.js";
4
4
 
5
5
  /**
6
- * A serde mirror of `regular-layout`'s serialized layout tree, as returned by
7
- * [`RegularLayout::save`] and accepted by [`RegularLayout::restore`].
6
+ * A dashboard's panel arrangement: nested splits whose leaves are tab stacks
7
+ * of panel ids, naming every panel exactly once.
8
8
  */
9
9
  export type Layout = { "type": "split-layout" } & SplitLayout | { "type": "tab-layout" } & TabLayout;
@@ -1,6 +1,7 @@
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
3
  /**
4
- * The orientation of a [`SplitLayout`].
4
+ * The direction a [`SplitLayout`] divides its space in: `horizontal` places
5
+ * children side by side as columns, `vertical` stacks them as rows.
5
6
  */
6
7
  export type Orientation = "horizontal" | "vertical";
@@ -6,6 +6,7 @@ import type { FilterReducer } from "./FilterReducer.js";
6
6
  import type { GroupRollupMode } from "./GroupRollupMode.js";
7
7
  import type { Sort } from "./Sort.js";
8
8
  import type { SplitRollupMode } from "./SplitRollupMode.js";
9
+ import type { TableRef } from "./TableRef.js";
9
10
  import type { Windows } from "./Windows.js";
10
11
  import type { JsonValue } from "./serde_json/JsonValue.js";
11
12
 
@@ -14,7 +15,7 @@ import type { JsonValue } from "./serde_json/JsonValue.js";
14
15
  * element-level `settings` flag. This is the `panels` entry type of the
15
16
  * workspace config format.
16
17
  */
17
- export type PanelViewerConfig<V = string> = {
18
+ export type PanelViewerConfig<V = string, T = TableRef> = {
18
19
  /**
19
20
  * The `@perspective-dev/viewer` version that wrote this config,
20
21
  * stamped on save and used to migrate older tokens. Callers do not
@@ -44,12 +45,12 @@ plugin: string,
44
45
  */
45
46
  plugin_config: { [key in string]?: JsonValue },
46
47
  /**
47
- * Name of the `Table` this panel renders, as hosted on the panel's
48
- * `Client`. Every placed panel has a table binding (creation
49
- * requires one by type — [`ViewerConfigInitial`]), so the saved
50
- * config carries it unconditionally.
48
+ * The `Table` this panel renders: its hosted name in a
49
+ * [`WorkspaceConfig`] `panels` entry (`T = String`), and a
50
+ * [`TableRef`] — a name, or a recursively inlined derived-table
51
+ * definition — in the single-panel `save()` format.
51
52
  */
52
- table: string,
53
+ table: T,
53
54
  /**
54
55
  * Selected theme NAME (e.g. `"Pro Dark"`) — not a CSS value. Valid
55
56
  * names are the Perspective themes loaded on the page, which
@@ -9,13 +9,9 @@ export type RestoreOptions = {
9
9
  */
10
10
  panel?: string,
11
11
  /**
12
- * When `true`, a failed restore only REJECTS the returned `Promise` —
13
- * the error is not committed to the viewer's visible error state, and
14
- * the session remains usable for subsequent calls. For programmatic
15
- * callers (e.g. the LLM agent's `set_view_config` tool) for whom a
16
- * failed config patch is feedback rather than a user-facing fault.
17
- * The config may be partially applied on failure; restore a
18
- * known-good config to recover exactly.
12
+ * When `true`, a config that was applied and then failed to render only
13
+ * rejects the returned `Promise`, without raising the panel's visible
14
+ * error state.
19
15
  */
20
16
  suppress_errors?: boolean,
21
17
  /**
@@ -2,4 +2,20 @@
2
2
  import type { Layout } from "./Layout.js";
3
3
  import type { Orientation } from "./Orientation.js";
4
4
 
5
- export type SplitLayout = { children: Array<Layout>, sizes: Array<number>, orientation: Orientation, };
5
+ /**
6
+ * A row or column of child layouts, nested to form a grid.
7
+ */
8
+ export type SplitLayout = {
9
+ /**
10
+ * Child layouts, in left-to-right or top-to-bottom order.
11
+ */
12
+ children: Array<Layout>,
13
+ /**
14
+ * Each child's fraction of the split, one per child, summing to 1.
15
+ */
16
+ sizes: Array<number>,
17
+ /**
18
+ * Whether children sit side by side (`horizontal`) or stacked
19
+ * (`vertical`).
20
+ */
21
+ orientation: Orientation, };
@@ -1,5 +1,8 @@
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
+ /**
4
+ * A stack of panels shown as tabs, one visible at a time.
5
+ */
3
6
  export type TabLayout = {
4
7
  /**
5
8
  * Panel ids (slot names) in this stack.
@@ -0,0 +1,9 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+ import type { DerivedTableConfig } from "./DerivedTableConfig.js";
3
+
4
+ /**
5
+ * What may occupy a `table` position in a single-panel config: a hosted
6
+ * `Table`'s name, or an inline derived-table definition recursing through
7
+ * its own `table` field until a concrete name.
8
+ */
9
+ export type TableRef = string | (Omit<DerivedTableConfig, "table"> & { table: TableRef });
@@ -6,6 +6,7 @@ import type { FilterReducer } from "./FilterReducer.js";
6
6
  import type { GroupRollupMode } from "./GroupRollupMode.js";
7
7
  import type { Sort } from "./Sort.js";
8
8
  import type { SplitRollupMode } from "./SplitRollupMode.js";
9
+ import type { TableRef } from "./TableRef.js";
9
10
  import type { Windows } from "./Windows.js";
10
11
  import type { JsonValue } from "./serde_json/JsonValue.js";
11
12
 
@@ -17,7 +18,7 @@ import type { JsonValue } from "./serde_json/JsonValue.js";
17
18
  * state there, carried by the top-level `active` field instead), while the
18
19
  * single-panel format flattens back to the legacy shape.
19
20
  */
20
- export type ViewerConfig<V = string> = { settings: boolean,
21
+ export type ViewerConfig<V = string, T = TableRef> = { settings: boolean,
21
22
  /**
22
23
  * The `@perspective-dev/viewer` version that wrote this config,
23
24
  * stamped on save and used to migrate older tokens. Callers do not
@@ -47,12 +48,12 @@ plugin: string,
47
48
  */
48
49
  plugin_config: { [key in string]?: JsonValue },
49
50
  /**
50
- * Name of the `Table` this panel renders, as hosted on the panel's
51
- * `Client`. Every placed panel has a table binding (creation
52
- * requires one by type — [`ViewerConfigInitial`]), so the saved
53
- * config carries it unconditionally.
51
+ * The `Table` this panel renders: its hosted name in a
52
+ * [`WorkspaceConfig`] `panels` entry (`T = String`), and a
53
+ * [`TableRef`] — a name, or a recursively inlined derived-table
54
+ * definition — in the single-panel `save()` format.
54
55
  */
55
- table: string,
56
+ table: T,
56
57
  /**
57
58
  * Selected theme NAME (e.g. `"Pro Dark"`) — not a CSS value. Valid
58
59
  * names are the Perspective themes loaded on the page, which
@@ -7,6 +7,7 @@ import type { GroupRollupMode } from "./GroupRollupMode.js";
7
7
  import type { OptionalUpdate } from "./OptionalUpdate.js";
8
8
  import type { Sort } from "./Sort.js";
9
9
  import type { SplitRollupMode } from "./SplitRollupMode.js";
10
+ import type { TableRef } from "./TableRef.js";
10
11
  import type { Windows } from "./Windows.js";
11
12
  import type { JsonValue } from "./serde_json/JsonValue.js";
12
13
 
@@ -33,12 +34,13 @@ plugin?: OptionalUpdate<string>,
33
34
  */
34
35
  title?: OptionalUpdate<string>,
35
36
  /**
36
- * Name of the `Table` to render, as hosted on this panel's
37
- * `Client`. Rebinding an existing panel to another table keeps the
38
- * rest of the config, so column names that do not exist in the new
39
- * table will fail validation.
37
+ * The `Table` to render: a name as hosted on this panel's `Client`,
38
+ * or an inline derived-table definition to materialize (reusing a
39
+ * structurally identical derived `Table` when one exists). Rebinding
40
+ * an existing panel keeps the rest of the config, so column names
41
+ * that do not exist in the new table will fail validation.
40
42
  */
41
- table?: OptionalUpdate<string>,
43
+ table?: OptionalUpdate<TableRef>,
42
44
  /**
43
45
  * Theme NAME (e.g. `"Pro Dark"`) — not a CSS value. Valid names are
44
46
  * the Perspective themes loaded on the page, re-scanned by
@@ -1,4 +1,5 @@
1
1
  // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+ import type { DerivedTableConfig } from "./DerivedTableConfig.js";
2
3
  import type { Filter } from "./Filter.js";
3
4
  import type { Layout } from "./Layout.js";
4
5
  import type { PanelViewerConfig } from "./PanelViewerConfig.js";
@@ -20,7 +21,12 @@ export type WorkspaceConfig = { version: string, active?: string, layout: Layout
20
21
  * iterates in a per-instance random order, which made consecutive
21
22
  * `save()` outputs byte-unstable.
22
23
  */
23
- panels: { [key in string]?: PanelViewerConfig<string> },
24
+ panels: { [key in string]?: PanelViewerConfig<string, string> },
25
+ /**
26
+ * Named derived `Table`s, each a `View` of its `parent` promoted to a
27
+ * `Table`. A `BTreeMap` for the same determinism reason as `panels`.
28
+ */
29
+ derived_tables?: { [key in string]?: DerivedTableConfig<string> },
24
30
  /**
25
31
  * The element-level global (master/detail cross-) filters. A transient
26
32
  * overlay on every detail panel's view — persisted here, never in a
@@ -1,4 +1,5 @@
1
1
  // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+ import type { DerivedTableConfig } from "./DerivedTableConfig.js";
2
3
  import type { Filter } from "./Filter.js";
3
4
  import type { Layout } from "./Layout.js";
4
5
  import type { OptionalUpdate } from "./OptionalUpdate.js";
@@ -17,7 +18,8 @@ export type WorkspaceConfigUpdate = {
17
18
  */
18
19
  active?: OptionalUpdate<string>,
19
20
  /**
20
- * The layout tree to stage, naming `panels` keys or existing panel ids.
21
+ * The layout tree to stage, naming every `panels` key (or, without
22
+ * `panels`, every existing panel id) exactly once.
21
23
  */
22
24
  layout?: Layout,
23
25
  /**
@@ -26,6 +28,12 @@ layout?: Layout,
26
28
  * existing panels.
27
29
  */
28
30
  panels?: { [key in string]?: ViewerConfigInitial },
31
+ /**
32
+ * The complete replacement set of derived `Table`s, in any order (they
33
+ * are built parent-first); absent keeps the current ones, `{}` deletes
34
+ * them all.
35
+ */
36
+ derived_tables?: { [key in string]?: DerivedTableConfig<string> },
29
37
  /**
30
38
  * The element-level cross-filter set applied to every detail panel as
31
39
  * one unattributed bucket, replacing the current set; `null` clears it.
@@ -1,3 +0,0 @@
1
- import perspective_viewer from "./perspective-viewer.ts";
2
- export * from "./perspective-viewer.ts";
3
- export default perspective_viewer;