@perspective-dev/viewer 5.1.0 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/perspective-viewer.js +9 -9
- package/dist/cdn/perspective-viewer.js.map +4 -4
- package/dist/css/botanical.css +1 -1
- package/dist/css/dracula.css +1 -1
- package/dist/css/gruvbox-dark.css +1 -1
- package/dist/css/gruvbox.css +1 -1
- package/dist/css/icons.css +1 -1
- package/dist/css/intl/de.css +1 -1
- package/dist/css/intl/es.css +1 -1
- package/dist/css/intl/fr.css +1 -1
- package/dist/css/intl/ja.css +1 -1
- package/dist/css/intl/pt.css +1 -1
- package/dist/css/intl/zh.css +1 -1
- package/dist/css/intl.css +1 -1
- package/dist/css/monokai.css +1 -1
- package/dist/css/phosphor.css +1 -1
- package/dist/css/pro-dark.css +1 -1
- package/dist/css/pro.css +1 -1
- package/dist/css/solarized-dark.css +1 -1
- package/dist/css/solarized.css +1 -1
- package/dist/css/themes.css +1 -1
- package/dist/css/vaporwave.css +1 -1
- package/dist/docs/perspective-docs.json +1 -0
- package/dist/esm/column-format.d.ts +19 -28
- package/dist/esm/perspective-viewer.d.ts +3 -0
- package/dist/esm/perspective-viewer.inline.js +9 -9
- package/dist/esm/perspective-viewer.inline.js.map +4 -4
- package/dist/esm/perspective-viewer.js +9 -9
- package/dist/esm/perspective-viewer.js.map +4 -4
- package/dist/esm/plugin.d.ts +10 -0
- package/dist/esm/providers.d.ts +79 -0
- package/dist/esm/ts-rs/CompactDisplay.d.ts +5 -0
- package/dist/esm/ts-rs/CurrencyCode.d.ts +1 -0
- package/dist/esm/ts-rs/CurrencyDisplay.d.ts +1 -0
- package/dist/esm/ts-rs/CurrencyNumberFormatStyle.d.ts +8 -0
- package/dist/esm/ts-rs/CurrencySign.d.ts +1 -0
- package/dist/esm/ts-rs/CustomDatetimeFormat.d.ts +1 -0
- package/dist/esm/ts-rs/CustomDatetimeStyleConfig.d.ts +54 -0
- package/dist/esm/ts-rs/CustomNumberFormatConfig.d.ts +34 -0
- package/dist/esm/ts-rs/DatetimeColorMode.d.ts +1 -0
- package/dist/esm/ts-rs/DatetimeFormatType.d.ts +6 -0
- package/dist/esm/ts-rs/FormatMode.d.ts +1 -0
- package/dist/esm/ts-rs/FormatUnit.d.ts +1 -0
- package/dist/esm/ts-rs/Notation.d.ts +17 -0
- package/dist/esm/ts-rs/NumberFormatStyle.d.ts +18 -0
- package/dist/esm/ts-rs/PanelViewerConfig.d.ts +42 -2
- package/dist/esm/ts-rs/PluginStaticConfig.d.ts +35 -0
- package/dist/esm/ts-rs/RestoreOptions.d.ts +19 -0
- package/dist/esm/ts-rs/RoundingMode.d.ts +1 -0
- package/dist/esm/ts-rs/RoundingPriority.d.ts +1 -0
- package/dist/esm/ts-rs/SaveWorkspaceOptions.d.ts +10 -0
- package/dist/esm/ts-rs/SignDisplay.d.ts +1 -0
- package/dist/esm/ts-rs/SimpleDatetimeFormat.d.ts +1 -0
- package/dist/esm/ts-rs/SimpleDatetimeStyleConfig.d.ts +24 -0
- package/dist/esm/ts-rs/SplitRollupMode.d.ts +9 -0
- package/dist/esm/ts-rs/StringColorMode.d.ts +1 -0
- package/dist/esm/ts-rs/TrailingZeroDisplay.d.ts +1 -0
- package/dist/esm/ts-rs/Unit.d.ts +1 -0
- package/dist/esm/ts-rs/UnitDisplay.d.ts +1 -0
- package/dist/esm/ts-rs/UnitNumberFormatStyle.d.ts +6 -0
- package/dist/esm/ts-rs/UseGrouping.d.ts +1 -0
- package/dist/esm/ts-rs/ViewerConfig.d.ts +42 -2
- package/dist/esm/ts-rs/ViewerConfigInitial.d.ts +175 -0
- package/dist/esm/ts-rs/ViewerConfigUpdate.d.ts +63 -0
- package/dist/esm/ts-rs/WindowSpec.d.ts +3 -2
- package/dist/esm/ts-rs/WorkspaceConfig.d.ts +9 -1
- package/dist/esm/ts-rs/WorkspaceConfigUpdate.d.ts +20 -9
- package/dist/wasm/perspective-viewer.d.ts +157 -41
- package/dist/wasm/perspective-viewer.js +452 -151
- package/dist/wasm/perspective-viewer.wasm +0 -0
- package/dist/wasm/perspective-viewer.wasm.d.ts +22 -17
- package/package.json +2 -1
- package/src/css/_viewer_bundle.css +1 -0
- package/src/css/column-selector.css +8 -0
- package/src/css/column-settings-panel.css +9 -5
- package/src/css/column-style.css +209 -31
- package/src/css/config-selector.css +38 -3
- package/src/css/dom/select.css +2 -1
- package/src/css/form/code-editor.css +6 -7
- package/src/css/form/mirrored-textarea.css +81 -0
- package/src/css/viewer.css +328 -0
- package/src/rust/agent/client/mod.rs +19 -0
- package/src/rust/agent/client/protocol.rs +320 -0
- package/src/rust/agent/client/transport.rs +287 -0
- package/src/rust/agent/client/turn.rs +174 -0
- package/src/rust/agent/config.rs +159 -0
- package/src/rust/agent/docs.rs +293 -0
- package/src/rust/agent/markdown/block.rs +509 -0
- package/src/rust/agent/markdown/entity.rs +52 -0
- package/src/rust/agent/markdown/events.rs +71 -0
- package/src/rust/agent/markdown/inline.rs +497 -0
- package/src/rust/agent/markdown/mod.rs +466 -0
- package/src/rust/agent/mod.rs +23 -0
- package/src/rust/agent/preamble.md +16 -0
- package/src/rust/agent/runtime.rs +201 -0
- package/src/rust/agent/slot.rs +236 -0
- package/src/rust/agent/tools.rs +1141 -0
- package/src/rust/components/chat_panel.rs +289 -0
- package/src/rust/components/column_selector/active_column.rs +2 -2
- package/src/rust/components/column_selector/add_expression_button.rs +3 -3
- package/src/rust/components/column_selector/aggregate_selector.rs +2 -3
- package/src/rust/components/column_selector/config_selector.rs +84 -7
- package/src/rust/components/column_selector/expr_edit_button.rs +4 -10
- package/src/rust/components/column_selector/inactive_column.rs +2 -2
- package/src/rust/components/column_selector.rs +55 -4
- package/src/rust/components/column_settings_sidebar/style_tab/primitive_field.rs +293 -126
- package/src/rust/components/column_settings_sidebar/style_tab.rs +262 -225
- package/src/rust/components/column_settings_sidebar.rs +88 -69
- package/src/rust/components/containers/dragdrop_list.rs +37 -0
- package/src/rust/components/editable_header.rs +85 -144
- package/src/rust/components/expression_editor.rs +9 -16
- package/src/rust/components/form/code_editor.rs +29 -28
- package/src/rust/components/form/debug.rs +9 -5
- package/src/rust/components/form/mirrored_textarea.rs +165 -0
- package/src/rust/components/form/mod.rs +4 -1
- package/src/rust/components/form/multi_stop_gradient_selector.rs +476 -0
- package/src/rust/components/form/named_value_picker.rs +86 -0
- package/src/rust/components/form/palette_selector.rs +440 -0
- package/src/rust/components/main_panel/msg.rs +2 -2
- package/src/rust/components/main_panel/reconcile.rs +4 -4
- package/src/rust/components/mod.rs +2 -0
- package/src/rust/components/plugin_tab.rs +4 -28
- package/src/rust/components/settings_panel.rs +105 -22
- package/src/rust/components/viewer/msg.rs +46 -7
- package/src/rust/components/viewer/panels.rs +17 -20
- package/src/rust/components/viewer/render.rs +10 -3
- package/src/rust/components/viewer/settings.rs +163 -23
- package/src/rust/components/viewer/snapshots.rs +46 -21
- package/src/rust/components/viewer/wiring.rs +14 -25
- package/src/rust/components/viewer.rs +12 -8
- package/src/rust/components/window_editor.rs +75 -103
- package/src/rust/config/column_config_schema.rs +100 -41
- package/src/rust/config/css_scale.rs +882 -0
- package/src/rust/config/datetime_column_style/custom.rs +17 -0
- package/src/rust/config/datetime_column_style/simple.rs +10 -0
- package/src/rust/config/mod.rs +2 -0
- package/src/rust/config/number_string_format.rs +33 -0
- package/src/rust/config/options.rs +28 -0
- package/src/rust/config/plugin_static_config.rs +120 -5
- package/src/rust/config/viewer_config.rs +216 -3
- package/src/rust/config/workspace_config.rs +138 -10
- package/src/rust/custom_elements/viewer.rs +369 -119
- package/src/rust/custom_events.rs +43 -1
- package/src/rust/js/regular_layout.rs +3 -3
- package/src/rust/lib.rs +15 -0
- package/src/rust/presentation/column_locator.rs +19 -5
- package/src/rust/presentation.rs +200 -36
- package/src/rust/queries/column_locator.rs +74 -44
- package/src/rust/queries/get_viewer_config.rs +2 -1
- package/src/rust/queries/mod.rs +2 -0
- package/src/rust/queries/palette_set.rs +82 -0
- package/src/rust/queries/plugin_column_styles.rs +6 -2
- package/src/rust/renderer/dispatch.rs +16 -4
- package/src/rust/renderer/plugin_config.rs +309 -47
- package/src/rust/renderer.rs +15 -42
- package/src/rust/session/column_defaults_update.rs +32 -7
- package/src/rust/session/metadata.rs +23 -21
- package/src/rust/session/props.rs +1 -0
- package/src/rust/session/replace_expression_update.rs +1 -0
- package/src/rust/session.rs +9 -6
- package/src/rust/tasks/create_panel.rs +46 -49
- package/src/rust/tasks/edit_expression.rs +19 -23
- package/src/rust/tasks/edit_window.rs +9 -11
- package/src/rust/tasks/eject.rs +4 -1
- package/src/rust/tasks/pipeline.rs +2 -2
- package/src/rust/tasks/presize_panels.rs +44 -5
- package/src/rust/tasks/reset_all.rs +4 -4
- package/src/rust/tasks/restore_and_render.rs +17 -44
- package/src/rust/tasks/restore_panel.rs +37 -22
- package/src/rust/tasks/set_edit_mode.rs +3 -1
- package/src/rust/tasks/sync_update_panels.rs +18 -24
- package/src/rust/tasks/update_theme.rs +23 -18
- package/src/rust/utils/css_vars.rs +26 -0
- package/src/rust/utils/mod.rs +2 -0
- package/src/rust/utils/spawn.rs +1 -1
- package/src/rust/workspace.rs +454 -199
- package/src/svg/lock.svg +7 -0
- package/src/themes/botanical.css +10 -0
- package/src/themes/defaults.css +12 -0
- package/src/themes/dracula.css +17 -0
- package/src/themes/gruvbox-dark.css +20 -0
- package/src/themes/gruvbox.css +10 -0
- package/src/themes/icons.css +1 -0
- package/src/themes/intl/de.css +16 -0
- package/src/themes/intl/es.css +16 -0
- package/src/themes/intl/fr.css +16 -0
- package/src/themes/intl/ja.css +16 -0
- package/src/themes/intl/pt.css +16 -0
- package/src/themes/intl/zh.css +16 -0
- package/src/themes/intl.css +16 -0
- package/src/themes/monokai.css +22 -0
- package/src/themes/phosphor.css +5 -0
- package/src/themes/pro-dark.css +10 -0
- package/src/themes/solarized-dark.css +7 -0
- package/src/themes/solarized.css +7 -0
- package/src/themes/vaporwave.css +20 -0
- package/src/ts/column-format.ts +67 -46
- package/src/ts/perspective-viewer.ts +3 -0
- package/src/ts/plugin.ts +14 -0
- package/src/ts/providers.ts +96 -0
- package/src/ts/ts-rs/CompactDisplay.ts +3 -0
- package/src/ts/ts-rs/CurrencyCode.ts +3 -0
- package/src/ts/ts-rs/CurrencyDisplay.ts +3 -0
- package/src/ts/ts-rs/CurrencyNumberFormatStyle.ts +6 -0
- package/src/ts/ts-rs/CurrencySign.ts +3 -0
- package/src/ts/ts-rs/CustomDatetimeFormat.ts +3 -0
- package/src/ts/ts-rs/CustomDatetimeStyleConfig.ts +54 -0
- package/src/ts/ts-rs/CustomNumberFormatConfig.ts +25 -0
- package/src/ts/ts-rs/DatetimeColorMode.ts +3 -0
- package/src/ts/ts-rs/DatetimeFormatType.ts +8 -0
- package/src/ts/ts-rs/FormatMode.ts +3 -0
- package/src/ts/ts-rs/FormatUnit.ts +3 -0
- package/src/ts/ts-rs/Notation.ts +11 -0
- package/src/ts/ts-rs/NumberFormatStyle.ts +12 -0
- package/src/ts/ts-rs/PanelViewerConfig.ts +48 -2
- package/src/ts/ts-rs/PluginStaticConfig.ts +36 -1
- package/src/ts/ts-rs/RestoreOptions.ts +20 -0
- package/src/ts/ts-rs/RoundingMode.ts +3 -0
- package/src/ts/ts-rs/RoundingPriority.ts +3 -0
- package/src/ts/ts-rs/SaveWorkspaceOptions.ts +11 -0
- package/src/ts/ts-rs/SignDisplay.ts +3 -0
- package/src/ts/ts-rs/SimpleDatetimeFormat.ts +3 -0
- package/src/ts/ts-rs/SimpleDatetimeStyleConfig.ts +25 -0
- package/src/ts/ts-rs/SplitRollupMode.ts +11 -0
- package/src/ts/ts-rs/StringColorMode.ts +3 -0
- package/src/ts/ts-rs/TrailingZeroDisplay.ts +3 -0
- package/src/ts/ts-rs/Unit.ts +3 -0
- package/src/ts/ts-rs/UnitDisplay.ts +3 -0
- package/src/ts/ts-rs/UnitNumberFormatStyle.ts +5 -0
- package/src/ts/ts-rs/UseGrouping.ts +3 -0
- package/src/ts/ts-rs/ViewerConfig.ts +48 -2
- package/src/ts/ts-rs/ViewerConfigInitial.ts +164 -0
- package/src/ts/ts-rs/ViewerConfigUpdate.ts +72 -2
- package/src/ts/ts-rs/WindowSpec.ts +3 -2
- package/src/ts/ts-rs/WorkspaceConfig.ts +8 -2
- package/src/ts/ts-rs/WorkspaceConfigUpdate.ts +18 -9
- package/dist/esm/ts-rs/WindowAggregate.d.ts +0 -1
- package/src/rust/components/form/color_range_selector.rs +0 -137
- package/src/ts/ts-rs/WindowAggregate.ts +0 -3
- /package/dist/wasm/snippets/{perspective-viewer-8a8c7d5d696b43ae → perspective-viewer-39c3c3b28e3cbd48}/inline0.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-8a8c7d5d696b43ae → perspective-viewer-39c3c3b28e3cbd48}/inline1.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-8a8c7d5d696b43ae → perspective-viewer-39c3c3b28e3cbd48}/inline2.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-8a8c7d5d696b43ae → perspective-viewer-39c3c3b28e3cbd48}/inline3.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-8a8c7d5d696b43ae → perspective-viewer-39c3c3b28e3cbd48}/inline4.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-8a8c7d5d696b43ae → perspective-viewer-39c3c3b28e3cbd48}/inline5.js +0 -0
|
@@ -0,0 +1,164 @@
|
|
|
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
|
+
import type { JsonValue } from "./serde_json/JsonValue.js";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The initial configuration of a NEW panel (`addPanel`, `restore`'s
|
|
14
|
+
* panel-creating upsert, `restoreWorkspace` `panels` entries). Unlike
|
|
15
|
+
* [`ViewerConfigUpdate`] — a patch against existing state — creation has
|
|
16
|
+
* no prior state: `table` is REQUIRED (a placed panel without a table
|
|
17
|
+
* binding would be permanently blank), absent fields mean "default"
|
|
18
|
+
* rather than "leave unchanged" (so no [`OptionalUpdate`] tri-state), and
|
|
19
|
+
* there is no `settings` field (element-level, not per-panel).
|
|
20
|
+
*/
|
|
21
|
+
export type ViewerConfigInitial = {
|
|
22
|
+
/**
|
|
23
|
+
* Name of the `Table` the new panel renders, as hosted on the
|
|
24
|
+
* `Client`. REQUIRED: a placed panel with no table binding would be
|
|
25
|
+
* permanently blank.
|
|
26
|
+
*/
|
|
27
|
+
table: string,
|
|
28
|
+
/**
|
|
29
|
+
* The `@perspective-dev/viewer` version a saved config was written
|
|
30
|
+
* by. Omit it when creating a panel.
|
|
31
|
+
*/
|
|
32
|
+
version?: string,
|
|
33
|
+
/**
|
|
34
|
+
* Name of the visualization plugin, from the set registered on the
|
|
35
|
+
* page (the `list_plugins` agent tool, or the plugin picker).
|
|
36
|
+
* Decides what the view fields MEAN: `columns` is positional and
|
|
37
|
+
* every plugin reads the positions differently, and
|
|
38
|
+
* `group_by`/`split_by` draw different things per plugin. Absent
|
|
39
|
+
* uses the default plugin.
|
|
40
|
+
*/
|
|
41
|
+
plugin?: string,
|
|
42
|
+
/**
|
|
43
|
+
* Panel title, shown in its tab. Absent renders the default title.
|
|
44
|
+
*/
|
|
45
|
+
title?: string,
|
|
46
|
+
/**
|
|
47
|
+
* Theme NAME (e.g. `"Pro Dark"`) — not a CSS value. Valid names are
|
|
48
|
+
* the Perspective themes loaded on the page. Absent uses the
|
|
49
|
+
* default.
|
|
50
|
+
*/
|
|
51
|
+
theme?: string,
|
|
52
|
+
/**
|
|
53
|
+
* Plugin-wide settings (as opposed to the per-column
|
|
54
|
+
* [`Self::columns_config`]). Opaque to the viewer and defined by
|
|
55
|
+
* the ACTIVE plugin; query the valid keys with `get_style_schema`
|
|
56
|
+
* rather than guessing.
|
|
57
|
+
*/
|
|
58
|
+
plugin_config?: { [key in string]?: JsonValue },
|
|
59
|
+
/**
|
|
60
|
+
* Per-column styling — formatting, colors, and other per-column
|
|
61
|
+
* controls — keyed by column name. Plugin-defined like
|
|
62
|
+
* [`Self::plugin_config`]; see `get_style_schema`.
|
|
63
|
+
*/
|
|
64
|
+
columns_config?: { [key in string]?: { [key in string]?: JsonValue } },
|
|
65
|
+
/**
|
|
66
|
+
* A group by _groups_ the dataset by the unique values of each column used
|
|
67
|
+
* as a group by - a close analogue in SQL to the `GROUP BY` statement.
|
|
68
|
+
* The underlying dataset is aggregated to show the values belonging to
|
|
69
|
+
* each group, and a total row is calculated for each group, showing
|
|
70
|
+
* the currently selected aggregated value (e.g. `sum`) of the column.
|
|
71
|
+
* Group by are useful for hierarchies, categorizing data and
|
|
72
|
+
* attributing values, i.e. showing the number of units sold based on
|
|
73
|
+
* State and City. In Perspective, group by are represented as an array
|
|
74
|
+
* of string column names to pivot, are applied in the order provided;
|
|
75
|
+
* For example, a group by of `["State", "City", "Postal Code"]` shows
|
|
76
|
+
* the values for each Postal Code, which are grouped by City,
|
|
77
|
+
* which are in turn grouped by State.
|
|
78
|
+
*/
|
|
79
|
+
group_by?: Array<string>,
|
|
80
|
+
/**
|
|
81
|
+
* A split by _splits_ the dataset by the unique values of each column used
|
|
82
|
+
* as a split by. The underlying dataset is not aggregated, and a new
|
|
83
|
+
* column is created for each unique value of the split by. Each newly
|
|
84
|
+
* created column contains the parts of the dataset that correspond to
|
|
85
|
+
* the column header, i.e. a `View` that has `["State"]` as its split
|
|
86
|
+
* by will have a new column for each state. In Perspective, Split By
|
|
87
|
+
* are represented as an array of string column names to pivot.
|
|
88
|
+
*/
|
|
89
|
+
split_by?: Array<string>,
|
|
90
|
+
/**
|
|
91
|
+
* The `columns` property specifies which columns should be included in the
|
|
92
|
+
* [`crate::View`]'s output. This allows users to show or hide a specific
|
|
93
|
+
* subset of columns, as well as control the order in which columns
|
|
94
|
+
* appear to the user. This is represented in Perspective as an array
|
|
95
|
+
* of string column names.
|
|
96
|
+
*/
|
|
97
|
+
columns?: Array<string | null>,
|
|
98
|
+
/**
|
|
99
|
+
* The `filter` property specifies columns on which the query can be
|
|
100
|
+
* filtered, returning rows that pass the specified filter condition.
|
|
101
|
+
* This is analogous to the `WHERE` clause in SQL. There is no limit on
|
|
102
|
+
* the number of columns where `filter` is applied, but the resulting
|
|
103
|
+
* dataset is one that passes all the filter conditions, i.e. the
|
|
104
|
+
* filters are joined with an `AND` condition.
|
|
105
|
+
*
|
|
106
|
+
* Perspective represents `filter` as an array of arrays, with the values
|
|
107
|
+
* of each inner array being a string column name, a string filter
|
|
108
|
+
* operator, and a filter operand in the type of the column.
|
|
109
|
+
*/
|
|
110
|
+
filter?: Array<Filter>,
|
|
111
|
+
/**
|
|
112
|
+
* The `sort` property specifies columns on which the query should be
|
|
113
|
+
* sorted, analogous to `ORDER BY` in SQL. A column can be sorted
|
|
114
|
+
* regardless of its data type, and sorts can be applied in ascending
|
|
115
|
+
* or descending order. Perspective represents `sort` as an array of
|
|
116
|
+
* arrays, with the values of each inner array being a string column
|
|
117
|
+
* name and a string sort direction. When `column-pivots` are applied,
|
|
118
|
+
* the additional sort directions `"col asc"` and `"col desc"` will
|
|
119
|
+
* determine the order of pivot columns groups.
|
|
120
|
+
*
|
|
121
|
+
* `sort` is the ONLY thing that orders a `View`'s rows — without it
|
|
122
|
+
* they keep the `Table`'s natural (insertion) order, which any
|
|
123
|
+
* consumer reading rows sequentially will reflect. Not to be
|
|
124
|
+
* confused with a window column's `order_by`, which orders rows
|
|
125
|
+
* WITHIN a window frame and does not reorder the `View`.
|
|
126
|
+
*/
|
|
127
|
+
sort?: Array<Sort>,
|
|
128
|
+
/**
|
|
129
|
+
* The `expressions` property specifies _new_ columns in Perspective that
|
|
130
|
+
* are created using existing column values or arbitary scalar values
|
|
131
|
+
* defined within the expression. In `<perspective-viewer>`,
|
|
132
|
+
* expressions are added using the "New Column" button in the side
|
|
133
|
+
* panel.
|
|
134
|
+
*/
|
|
135
|
+
expressions?: Expressions,
|
|
136
|
+
/**
|
|
137
|
+
* The `windows` property declares ordered, partitioned rolling
|
|
138
|
+
* computations (moving aggregates, cumulative sums) as _new_ columns
|
|
139
|
+
* keyed by output alias (`{"name": {...spec}}`, symmetric with
|
|
140
|
+
* `expressions`), analogous to SQL window functions. See
|
|
141
|
+
* [`crate::config::WindowSpec`].
|
|
142
|
+
*/
|
|
143
|
+
windows?: Windows,
|
|
144
|
+
/**
|
|
145
|
+
* Aggregates perform a calculation over an entire column, and are
|
|
146
|
+
* displayed when one or more [Group By](#group-by) are applied to the
|
|
147
|
+
* `View`. Aggregates can be specified by the user, or Perspective will
|
|
148
|
+
* use the following sensible default aggregates based on column type:
|
|
149
|
+
*
|
|
150
|
+
* - "sum" for `integer` and `float` columns
|
|
151
|
+
* - "count" for all other columns
|
|
152
|
+
*
|
|
153
|
+
* Perspective provides a selection of aggregate functions that can be
|
|
154
|
+
* applied to columns in the `View` constructor using a dictionary of
|
|
155
|
+
* column name to aggregate function name.
|
|
156
|
+
*
|
|
157
|
+
* An aggregate also determines the column's RESULT TYPE, which need
|
|
158
|
+
* not match the input: `"count"` yields an `integer` whatever it
|
|
159
|
+
* counts, so a `date` column left on the default `"count"` is an
|
|
160
|
+
* `integer` in the resulting `View` — no longer a date. Set an
|
|
161
|
+
* aggregate that preserves the type (e.g. `"any"`, `"last"`) when
|
|
162
|
+
* the original type matters, such as a date used as a chart axis.
|
|
163
|
+
*/
|
|
164
|
+
aggregates?: { [key in string]?: Aggregate }, group_by_depth?: number, filter_op?: FilterReducer, group_rollup_mode?: GroupRollupMode, split_rollup_mode?: SplitRollupMode, };
|
|
@@ -6,10 +6,67 @@ import type { FilterReducer } from "./FilterReducer.js";
|
|
|
6
6
|
import type { GroupRollupMode } from "./GroupRollupMode.js";
|
|
7
7
|
import type { OptionalUpdate } from "./OptionalUpdate.js";
|
|
8
8
|
import type { Sort } from "./Sort.js";
|
|
9
|
+
import type { SplitRollupMode } from "./SplitRollupMode.js";
|
|
9
10
|
import type { Windows } from "./Windows.js";
|
|
10
11
|
import type { JsonValue } from "./serde_json/JsonValue.js";
|
|
11
12
|
|
|
12
|
-
export type ViewerConfigUpdate = {
|
|
13
|
+
export type ViewerConfigUpdate = {
|
|
14
|
+
/**
|
|
15
|
+
* The `@perspective-dev/viewer` version a saved config was written
|
|
16
|
+
* by, used to migrate older tokens. Omit it — the viewer stamps
|
|
17
|
+
* the current version on save.
|
|
18
|
+
*/
|
|
19
|
+
version?: OptionalUpdate<string>,
|
|
20
|
+
/**
|
|
21
|
+
* Name of the visualization plugin to switch to, from the set
|
|
22
|
+
* registered on the page (the `list_plugins` agent tool, or the
|
|
23
|
+
* plugin picker). Changing it changes what the view fields MEAN:
|
|
24
|
+
* `columns` is positional and every plugin reads the positions
|
|
25
|
+
* differently, and `group_by`/`split_by` draw different things per
|
|
26
|
+
* plugin — so read the new plugin's roles before writing `columns`
|
|
27
|
+
* for it.
|
|
28
|
+
*/
|
|
29
|
+
plugin?: OptionalUpdate<string>,
|
|
30
|
+
/**
|
|
31
|
+
* Panel title, shown in its tab. `null` restores the default
|
|
32
|
+
* title; omitting the field leaves the current one.
|
|
33
|
+
*/
|
|
34
|
+
title?: OptionalUpdate<string>,
|
|
35
|
+
/**
|
|
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.
|
|
40
|
+
*/
|
|
41
|
+
table?: OptionalUpdate<string>,
|
|
42
|
+
/**
|
|
43
|
+
* Theme NAME (e.g. `"Pro Dark"`) — not a CSS value. Valid names are
|
|
44
|
+
* the Perspective themes loaded on the page, re-scanned by
|
|
45
|
+
* `resetThemes()`. `null` selects the default.
|
|
46
|
+
*/
|
|
47
|
+
theme?: OptionalUpdate<string>,
|
|
48
|
+
/**
|
|
49
|
+
* Whether the settings sidebar is OPEN. Purely cosmetic chrome —
|
|
50
|
+
* it does not affect what the viewer renders, and it is
|
|
51
|
+
* element-level rather than per-panel.
|
|
52
|
+
*/
|
|
53
|
+
settings?: OptionalUpdate<boolean>,
|
|
54
|
+
/**
|
|
55
|
+
* Plugin-wide settings (as opposed to the per-column
|
|
56
|
+
* [`Self::columns_config`]). The viewer passes these through
|
|
57
|
+
* opaquely — their valid keys are defined by the ACTIVE plugin and
|
|
58
|
+
* vary by plugin and by state, so query them with the
|
|
59
|
+
* `get_style_schema` agent tool rather than guessing.
|
|
60
|
+
*/
|
|
61
|
+
plugin_config?: OptionalUpdate<{ [key in string]?: JsonValue }>,
|
|
62
|
+
/**
|
|
63
|
+
* Per-column styling — formatting, colors, and other per-column
|
|
64
|
+
* controls — keyed by column name. Opaque to the viewer and
|
|
65
|
+
* plugin-defined like [`Self::plugin_config`]; `get_style_schema`
|
|
66
|
+
* reports the valid keys for a given column under the active
|
|
67
|
+
* plugin.
|
|
68
|
+
*/
|
|
69
|
+
columns_config?: OptionalUpdate<{ [key in string]?: { [key in string]?: JsonValue } }>,
|
|
13
70
|
/**
|
|
14
71
|
* A group by _groups_ the dataset by the unique values of each column used
|
|
15
72
|
* as a group by - a close analogue in SQL to the `GROUP BY` statement.
|
|
@@ -65,6 +122,12 @@ filter?: Array<Filter>,
|
|
|
65
122
|
* name and a string sort direction. When `column-pivots` are applied,
|
|
66
123
|
* the additional sort directions `"col asc"` and `"col desc"` will
|
|
67
124
|
* determine the order of pivot columns groups.
|
|
125
|
+
*
|
|
126
|
+
* `sort` is the ONLY thing that orders a `View`'s rows — without it
|
|
127
|
+
* they keep the `Table`'s natural (insertion) order, which any
|
|
128
|
+
* consumer reading rows sequentially will reflect. Not to be
|
|
129
|
+
* confused with a window column's `order_by`, which orders rows
|
|
130
|
+
* WITHIN a window frame and does not reorder the `View`.
|
|
68
131
|
*/
|
|
69
132
|
sort?: Array<Sort>,
|
|
70
133
|
/**
|
|
@@ -95,5 +158,12 @@ windows?: Windows,
|
|
|
95
158
|
* Perspective provides a selection of aggregate functions that can be
|
|
96
159
|
* applied to columns in the `View` constructor using a dictionary of
|
|
97
160
|
* column name to aggregate function name.
|
|
161
|
+
*
|
|
162
|
+
* An aggregate also determines the column's RESULT TYPE, which need
|
|
163
|
+
* not match the input: `"count"` yields an `integer` whatever it
|
|
164
|
+
* counts, so a `date` column left on the default `"count"` is an
|
|
165
|
+
* `integer` in the resulting `View` — no longer a date. Set an
|
|
166
|
+
* aggregate that preserves the type (e.g. `"any"`, `"last"`) when
|
|
167
|
+
* the original type matters, such as a date used as a chart axis.
|
|
98
168
|
*/
|
|
99
|
-
aggregates?: { [key in string]?: Aggregate }, group_by_depth?: number, filter_op?: FilterReducer, group_rollup_mode?: GroupRollupMode, };
|
|
169
|
+
aggregates?: { [key in string]?: Aggregate }, group_by_depth?: number, filter_op?: FilterReducer, group_rollup_mode?: GroupRollupMode, split_rollup_mode?: SplitRollupMode, };
|
|
@@ -1,5 +1,4 @@
|
|
|
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 { WindowAggregate } from "./WindowAggregate.js";
|
|
3
2
|
import type { WindowSort } from "./WindowSort.js";
|
|
4
3
|
|
|
5
4
|
/**
|
|
@@ -10,7 +9,7 @@ export type WindowSpec = {
|
|
|
10
9
|
* The input column - either a real `Table` column or an expression
|
|
11
10
|
* alias from the same `ViewConfig`.
|
|
12
11
|
*/
|
|
13
|
-
column: string, aggregate:
|
|
12
|
+
column: string, aggregate: string,
|
|
14
13
|
/**
|
|
15
14
|
* Columns whose distinct value tuples partition the rows; empty
|
|
16
15
|
* partitions the whole `Table` as one group.
|
|
@@ -18,6 +17,8 @@ column: string, aggregate: WindowAggregate,
|
|
|
18
17
|
partition_by?: Array<string>,
|
|
19
18
|
/**
|
|
20
19
|
* The `Table` column which orders each partition, and the direction.
|
|
20
|
+
* This orders rows WITHIN the window frame only — it does not
|
|
21
|
+
* reorder the `View`, which is what the view-level `sort` does.
|
|
21
22
|
*/
|
|
22
23
|
order_by?: WindowSort | null,
|
|
23
24
|
/**
|
|
@@ -4,7 +4,7 @@ import type { Layout } from "./Layout.js";
|
|
|
4
4
|
import type { PanelViewerConfig } from "./PanelViewerConfig.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* The
|
|
7
|
+
* The workspace config format (`{version, active?, layout, panels}`) —
|
|
8
8
|
* the multi-panel counterpart of the single-panel [`ViewerConfig`] — as
|
|
9
9
|
* emitted by [`PerspectiveViewerElement::save`].
|
|
10
10
|
*
|
|
@@ -33,4 +33,10 @@ global_filters?: Array<Filter>,
|
|
|
33
33
|
* which master contributed which clause does not — restored
|
|
34
34
|
* `global_filters` are one unattributed bucket. Omitted when empty.
|
|
35
35
|
*/
|
|
36
|
-
masters?: Array<string>,
|
|
36
|
+
masters?: Array<string>,
|
|
37
|
+
/**
|
|
38
|
+
* Named color-scale definitions shared by every panel: CSS custom
|
|
39
|
+
* property name (`--psp-user--<kind>-<name>`) → canonical CSS
|
|
40
|
+
* value.
|
|
41
|
+
*/
|
|
42
|
+
palette?: { [key in string]?: string }, };
|
|
@@ -1,24 +1,33 @@
|
|
|
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 { Filter } from "./Filter.js";
|
|
3
3
|
import type { Layout } from "./Layout.js";
|
|
4
|
-
import type {
|
|
4
|
+
import type { ViewerConfigInitial } from "./ViewerConfigInitial.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* The parse target of a
|
|
8
|
-
* [`PerspectiveViewerElement::
|
|
9
|
-
* but `panels` entries are
|
|
10
|
-
*
|
|
11
|
-
* it
|
|
7
|
+
* The parse target of a workspace config in
|
|
8
|
+
* [`PerspectiveViewerElement::restoreWorkspace`]. Mirrors
|
|
9
|
+
* [`WorkspaceConfig`], but `panels` entries are [`ViewerConfigInitial`]s —
|
|
10
|
+
* every entry creates a NEW panel, so `table` is required by type (a
|
|
11
|
+
* stray per-panel `settings` key is ignored; it is element-level state,
|
|
12
|
+
* carried by the top-level `active` field).
|
|
12
13
|
*/
|
|
13
|
-
export type WorkspaceConfigUpdate = { active?: string, layout?: Layout, panels: { [key in string]?:
|
|
14
|
+
export type WorkspaceConfigUpdate = { active?: string, layout?: Layout, panels: { [key in string]?: ViewerConfigInitial },
|
|
14
15
|
/**
|
|
15
16
|
* The element-level global (master/detail cross-) filters to re-apply as
|
|
16
17
|
* a transient overlay on every DETAIL panel. Restored as one
|
|
17
18
|
* unattributed bucket: the next selection on any master replaces it.
|
|
19
|
+
* `Option` so an explicit `undefined` property deserializes as
|
|
20
|
+
* `None` like an absent key (also `masters` / `palette` below).
|
|
18
21
|
*/
|
|
19
|
-
global_filters?: Array<Filter
|
|
22
|
+
global_filters?: Array<Filter> | null,
|
|
20
23
|
/**
|
|
21
24
|
* The master (filter-source) panels, by saved `panels` key. An id not in
|
|
22
25
|
* `panels` warns and is dropped.
|
|
23
26
|
*/
|
|
24
|
-
masters?: Array<string
|
|
27
|
+
masters?: Array<string> | null,
|
|
28
|
+
/**
|
|
29
|
+
* Named color-scale definitions to apply to the host (see
|
|
30
|
+
* [`WorkspaceConfig::palette`]), replacing any previously restored
|
|
31
|
+
* palette.
|
|
32
|
+
*/
|
|
33
|
+
palette?: { [key in string]?: string } | null, };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type WindowAggregate = "sum" | "avg" | "count" | "min" | "max" | "stddev" | "var" | "first" | "last" | "lag" | "lead" | "diff" | "rate" | "ema";
|
|
@@ -1,137 +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 wasm_bindgen::JsCast;
|
|
14
|
-
use web_sys::*;
|
|
15
|
-
use yew::prelude::*;
|
|
16
|
-
|
|
17
|
-
#[derive(Properties, PartialEq, Clone)]
|
|
18
|
-
pub struct ColorRangeProps {
|
|
19
|
-
/// Extra class appended to the positive input's `class` attribute,
|
|
20
|
-
/// so callers can target the pos / neg sides independently from CSS.
|
|
21
|
-
/// Paired with `neg_class`; both default to empty.
|
|
22
|
-
#[prop_or_default]
|
|
23
|
-
pub pos_class: Classes,
|
|
24
|
-
#[prop_or_default]
|
|
25
|
-
pub neg_class: Classes,
|
|
26
|
-
pub pos_color: String,
|
|
27
|
-
pub neg_color: String,
|
|
28
|
-
pub is_gradient: bool,
|
|
29
|
-
pub on_pos_color: Callback<String>,
|
|
30
|
-
pub on_neg_color: Callback<String>,
|
|
31
|
-
pub on_reset: Callback<()>,
|
|
32
|
-
pub is_modified: bool,
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
#[function_component(ColorRangeSelector)]
|
|
36
|
-
pub fn color_chooser_component(props: &ColorRangeProps) -> Html {
|
|
37
|
-
let on_pos_color = use_callback(
|
|
38
|
-
props.on_pos_color.clone(),
|
|
39
|
-
|event: InputEvent, on_pos_color| {
|
|
40
|
-
let color = event
|
|
41
|
-
.target()
|
|
42
|
-
.unwrap()
|
|
43
|
-
.unchecked_into::<HtmlInputElement>()
|
|
44
|
-
.value();
|
|
45
|
-
on_pos_color.emit(color);
|
|
46
|
-
},
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
let on_neg_color = use_callback(
|
|
50
|
-
props.on_neg_color.clone(),
|
|
51
|
-
|event: InputEvent, on_neg_color| {
|
|
52
|
-
let color = event
|
|
53
|
-
.target()
|
|
54
|
-
.unwrap()
|
|
55
|
-
.unchecked_into::<HtmlInputElement>()
|
|
56
|
-
.value();
|
|
57
|
-
on_neg_color.emit(color);
|
|
58
|
-
},
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
let fg_pos = infer_fg(&props.pos_color);
|
|
62
|
-
let fg_neg = infer_fg(&props.neg_color);
|
|
63
|
-
let style = if props.is_gradient {
|
|
64
|
-
format!(
|
|
65
|
-
"background:linear-gradient(to right, {} 0%, transparent 50%, {} 100%)",
|
|
66
|
-
props.pos_color, props.neg_color
|
|
67
|
-
)
|
|
68
|
-
} else {
|
|
69
|
-
format!(
|
|
70
|
-
"background:linear-gradient(to right, {} 0%, {} 50%, {} 50%, {} 100%)",
|
|
71
|
-
props.pos_color, props.pos_color, props.neg_color, props.neg_color
|
|
72
|
-
)
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
let on_reset = use_callback(props.clone(), |_: MouseEvent, deps| deps.on_reset.emit(()));
|
|
76
|
-
|
|
77
|
-
let pos_class = classes!("parameter", "pos-color-param", props.pos_class.clone());
|
|
78
|
-
let neg_class = classes!("parameter", "neg-color-param", props.neg_class.clone());
|
|
79
|
-
|
|
80
|
-
html! {
|
|
81
|
-
<>
|
|
82
|
-
<label id="color-range-label" />
|
|
83
|
-
<div class="color-gradient-container">
|
|
84
|
-
<div style={fg_pos} class="color-selector">
|
|
85
|
-
<input
|
|
86
|
-
class={pos_class}
|
|
87
|
-
type="color"
|
|
88
|
-
value={props.pos_color.to_owned()}
|
|
89
|
-
data-value={props.pos_color.to_owned()}
|
|
90
|
-
oninput={on_pos_color}
|
|
91
|
-
/>
|
|
92
|
-
<label class="color-label">{ "+" }</label>
|
|
93
|
-
</div>
|
|
94
|
-
<div class="color-thermometer" {style} />
|
|
95
|
-
<div style={fg_neg} class="color-selector">
|
|
96
|
-
<input
|
|
97
|
-
class={neg_class}
|
|
98
|
-
type="color"
|
|
99
|
-
value={props.neg_color.to_owned()}
|
|
100
|
-
data-value={props.neg_color.to_owned()}
|
|
101
|
-
oninput={on_neg_color}
|
|
102
|
-
/>
|
|
103
|
-
<label class="color-label">{ "-" }</label>
|
|
104
|
-
</div>
|
|
105
|
-
if props.is_modified {
|
|
106
|
-
<span class="reset-default-style" onclick={on_reset} />
|
|
107
|
-
} else {
|
|
108
|
-
<span class="reset-default-style-disabled" />
|
|
109
|
-
}
|
|
110
|
-
</div>
|
|
111
|
-
</>
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
fn infer_fg(color: &str) -> &'static str {
|
|
116
|
-
if color.len() >= 7 {
|
|
117
|
-
let r = i32::from_str_radix(&color[1..3], 16).unwrap_or(255) as f64;
|
|
118
|
-
let g = i32::from_str_radix(&color[3..5], 16).unwrap_or(0) as f64;
|
|
119
|
-
let b = i32::from_str_radix(&color[5..7], 16).unwrap_or(0) as f64;
|
|
120
|
-
if (r * r * 0.299 + g * g * 0.587 + b * b * 0.114).sqrt() > 130.0 {
|
|
121
|
-
"--sign--color:var(--psp--color)"
|
|
122
|
-
} else {
|
|
123
|
-
"--sign--color:var(--psp--background-color)"
|
|
124
|
-
}
|
|
125
|
-
} else if color.len() == 4 {
|
|
126
|
-
let r = i32::from_str_radix(&color[1..2], 16).unwrap_or(15) as f64;
|
|
127
|
-
let g = i32::from_str_radix(&color[2..3], 16).unwrap_or(0) as f64;
|
|
128
|
-
let b = i32::from_str_radix(&color[3..4], 16).unwrap_or(0) as f64;
|
|
129
|
-
if (r * r * 0.299 + g * g * 0.587 + b * b * 0.114).sqrt() > 8.0 {
|
|
130
|
-
"--sign--color:var(--psp--color)"
|
|
131
|
-
} else {
|
|
132
|
-
"--sign--color:var(--psp--background-color)"
|
|
133
|
-
}
|
|
134
|
-
} else {
|
|
135
|
-
"--sign--color:var(--psp--color)"
|
|
136
|
-
}
|
|
137
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|