@perspective-dev/viewer 5.0.0 → 5.1.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 +6 -6
- package/dist/cdn/perspective-viewer.js.map +2 -2
- 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/esm/perspective-viewer.inline.js +9 -9
- package/dist/esm/perspective-viewer.inline.js.map +2 -2
- package/dist/esm/perspective-viewer.js +1 -1
- package/dist/esm/perspective-viewer.js.map +2 -2
- package/dist/esm/ts-rs/PanelViewerConfig.d.ts +2 -0
- package/dist/esm/ts-rs/ViewerConfig.d.ts +2 -0
- package/dist/esm/ts-rs/ViewerConfigUpdate.d.ts +9 -0
- package/dist/esm/ts-rs/WindowAggregate.d.ts +1 -0
- package/dist/esm/ts-rs/WindowSort.d.ts +7 -0
- package/dist/esm/ts-rs/WindowSortDir.d.ts +6 -0
- package/dist/esm/ts-rs/WindowSpec.d.ts +46 -0
- package/dist/esm/ts-rs/Windows.d.ts +10 -0
- package/dist/wasm/perspective-viewer.d.ts +103 -16
- package/dist/wasm/perspective-viewer.js +118 -108
- package/dist/wasm/perspective-viewer.wasm +0 -0
- package/dist/wasm/perspective-viewer.wasm.d.ts +15 -15
- package/package.json +1 -1
- package/src/css/column-selector.css +1 -0
- package/src/css/column-settings-panel.css +67 -2
- package/src/css/column-style.css +4 -3
- package/src/css/config-selector.css +22 -1
- package/src/css/containers/context-menu.css +12 -6
- package/src/css/containers/tabs.css +2 -2
- package/src/css/viewer.css +8 -0
- package/src/rust/components/column_selector/active_column.rs +21 -27
- package/src/rust/components/column_selector/column_selector_column_row.rs +73 -0
- package/src/rust/components/column_selector/config_selector.rs +7 -1
- package/src/rust/components/column_selector/expr_edit_button.rs +7 -1
- package/src/rust/components/column_selector/inactive_column.rs +8 -1
- package/src/rust/components/column_selector.rs +20 -3
- package/src/rust/components/column_settings_sidebar/style_tab.rs +2 -1
- package/src/rust/components/column_settings_sidebar/window_tab.rs +34 -0
- package/src/rust/components/column_settings_sidebar.rs +163 -16
- package/src/rust/components/containers/dragdrop_list.rs +73 -3
- package/src/rust/components/containers/sidebar.rs +99 -22
- package/src/rust/components/containers/split_panel.rs +6 -0
- package/src/rust/components/editable_header.rs +2 -0
- package/src/rust/components/main_panel.rs +5 -0
- package/src/rust/components/mod.rs +1 -0
- package/src/rust/components/panel_menu.rs +7 -0
- package/src/rust/components/panel_tab.rs +5 -0
- package/src/rust/components/portal.rs +7 -0
- package/src/rust/components/viewer/msg.rs +2 -0
- package/src/rust/components/viewer/render.rs +12 -0
- package/src/rust/components/viewer/settings.rs +33 -1
- package/src/rust/components/viewer.rs +2 -0
- package/src/rust/components/window_editor.rs +1013 -0
- package/src/rust/lib.rs +4 -1
- package/src/rust/presentation/column_locator.rs +16 -1
- package/src/rust/queries/columns_iter_set.rs +7 -1
- package/src/rust/renderer/dispatch.rs +85 -58
- package/src/rust/renderer.rs +34 -1
- package/src/rust/session/drag_drop_update.rs +18 -0
- package/src/rust/session/metadata.rs +66 -9
- package/src/rust/session/replace_expression_update.rs +1 -0
- package/src/rust/session.rs +7 -5
- package/src/rust/tasks/edit_window.rs +155 -0
- package/src/rust/tasks/mod.rs +2 -0
- package/src/rust/utils/browser/dragdrop.rs +12 -0
- package/src/rust/utils/browser/tests/debounce.rs +49 -0
- package/src/rust/utils/debounce.rs +76 -27
- package/src/svg/pin-icon.svg +5 -0
- package/src/themes/icons.css +1 -0
- package/src/themes/intl/de.css +7 -0
- package/src/themes/intl/es.css +7 -0
- package/src/themes/intl/fr.css +7 -0
- package/src/themes/intl/ja.css +7 -0
- package/src/themes/intl/pt.css +7 -0
- package/src/themes/intl/zh.css +7 -0
- package/src/themes/intl.css +10 -1
- package/src/ts/ts-rs/PanelViewerConfig.ts +2 -1
- package/src/ts/ts-rs/ViewerConfig.ts +2 -1
- package/src/ts/ts-rs/ViewerConfigUpdate.ts +9 -0
- package/src/ts/ts-rs/WindowAggregate.ts +3 -0
- package/src/ts/ts-rs/WindowSort.ts +9 -0
- package/src/ts/ts-rs/WindowSortDir.ts +8 -0
- package/src/ts/ts-rs/WindowSpec.ts +46 -0
- package/src/ts/ts-rs/Windows.ts +10 -0
- /package/dist/wasm/snippets/{perspective-viewer-daeef4ceb066e6c7 → perspective-viewer-8a8c7d5d696b43ae}/inline0.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-daeef4ceb066e6c7 → perspective-viewer-8a8c7d5d696b43ae}/inline1.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-daeef4ceb066e6c7 → perspective-viewer-8a8c7d5d696b43ae}/inline2.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-daeef4ceb066e6c7 → perspective-viewer-8a8c7d5d696b43ae}/inline3.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-daeef4ceb066e6c7 → perspective-viewer-8a8c7d5d696b43ae}/inline4.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-daeef4ceb066e6c7 → perspective-viewer-8a8c7d5d696b43ae}/inline5.js +0 -0
|
@@ -4,6 +4,7 @@ import type { Filter } from "./Filter.js";
|
|
|
4
4
|
import type { FilterReducer } from "./FilterReducer.js";
|
|
5
5
|
import type { GroupRollupMode } from "./GroupRollupMode.js";
|
|
6
6
|
import type { Sort } from "./Sort.js";
|
|
7
|
+
import type { Windows } from "./Windows.js";
|
|
7
8
|
import type { JsonValue } from "./serde_json/JsonValue.js";
|
|
8
9
|
/**
|
|
9
10
|
* The per-panel state of a [`ViewerConfig`] — everything except the
|
|
@@ -31,6 +32,7 @@ export type PanelViewerConfig<V = string> = {
|
|
|
31
32
|
group_rollup_mode: GroupRollupMode;
|
|
32
33
|
filter_op?: FilterReducer;
|
|
33
34
|
expressions: Expressions;
|
|
35
|
+
windows?: Windows;
|
|
34
36
|
columns: Array<string | null>;
|
|
35
37
|
aggregates: {
|
|
36
38
|
[key in string]?: Aggregate;
|
|
@@ -4,6 +4,7 @@ import type { Filter } from "./Filter.js";
|
|
|
4
4
|
import type { FilterReducer } from "./FilterReducer.js";
|
|
5
5
|
import type { GroupRollupMode } from "./GroupRollupMode.js";
|
|
6
6
|
import type { Sort } from "./Sort.js";
|
|
7
|
+
import type { Windows } from "./Windows.js";
|
|
7
8
|
import type { JsonValue } from "./serde_json/JsonValue.js";
|
|
8
9
|
/**
|
|
9
10
|
* The state of an entire `custom_elements::PerspectiveViewerElement` component
|
|
@@ -35,6 +36,7 @@ export type ViewerConfig<V = string> = {
|
|
|
35
36
|
group_rollup_mode: GroupRollupMode;
|
|
36
37
|
filter_op?: FilterReducer;
|
|
37
38
|
expressions: Expressions;
|
|
39
|
+
windows?: Windows;
|
|
38
40
|
columns: Array<string | null>;
|
|
39
41
|
aggregates: {
|
|
40
42
|
[key in string]?: Aggregate;
|
|
@@ -5,6 +5,7 @@ import type { FilterReducer } from "./FilterReducer.js";
|
|
|
5
5
|
import type { GroupRollupMode } from "./GroupRollupMode.js";
|
|
6
6
|
import type { OptionalUpdate } from "./OptionalUpdate.js";
|
|
7
7
|
import type { Sort } from "./Sort.js";
|
|
8
|
+
import type { Windows } from "./Windows.js";
|
|
8
9
|
import type { JsonValue } from "./serde_json/JsonValue.js";
|
|
9
10
|
export type ViewerConfigUpdate = {
|
|
10
11
|
version?: OptionalUpdate<string>;
|
|
@@ -86,6 +87,14 @@ export type ViewerConfigUpdate = {
|
|
|
86
87
|
* panel.
|
|
87
88
|
*/
|
|
88
89
|
expressions?: Expressions;
|
|
90
|
+
/**
|
|
91
|
+
* The `windows` property declares ordered, partitioned rolling
|
|
92
|
+
* computations (moving aggregates, cumulative sums) as _new_ columns
|
|
93
|
+
* keyed by output alias (`{"name": {...spec}}`, symmetric with
|
|
94
|
+
* `expressions`), analogous to SQL window functions. See
|
|
95
|
+
* [`crate::config::WindowSpec`].
|
|
96
|
+
*/
|
|
97
|
+
windows?: Windows;
|
|
89
98
|
/**
|
|
90
99
|
* Aggregates perform a calculation over an entire column, and are
|
|
91
100
|
* displayed when one or more [Group By](#group-by) are applied to the
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type WindowAggregate = "sum" | "avg" | "count" | "min" | "max" | "stddev" | "var" | "first" | "last" | "lag" | "lead" | "diff" | "rate" | "ema";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { WindowSortDir } from "./WindowSortDir.js";
|
|
2
|
+
/**
|
|
3
|
+
* The `Table` column which orders each partition, with its direction -
|
|
4
|
+
* serialized as a two-element array (`["ts", "desc"]`), symmetric with the
|
|
5
|
+
* `ViewConfig`'s `sort` field.
|
|
6
|
+
*/
|
|
7
|
+
export type WindowSort = [string, WindowSortDir];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A window's order direction. A dedicated two-variant enum rather than
|
|
3
|
+
* [`crate::config::SortDir`] - the column-sort extras (`col asc`, `abs`,
|
|
4
|
+
* `none`) are meaningless inside a window frame and unrepresentable here.
|
|
5
|
+
*/
|
|
6
|
+
export type WindowSortDir = "asc" | "desc";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { WindowAggregate } from "./WindowAggregate.js";
|
|
2
|
+
import type { WindowSort } from "./WindowSort.js";
|
|
3
|
+
/**
|
|
4
|
+
* The serialized form of [`WindowSpec`].
|
|
5
|
+
*/
|
|
6
|
+
export type WindowSpec = {
|
|
7
|
+
/**
|
|
8
|
+
* The input column - either a real `Table` column or an expression
|
|
9
|
+
* alias from the same `ViewConfig`.
|
|
10
|
+
*/
|
|
11
|
+
column: string;
|
|
12
|
+
aggregate: WindowAggregate;
|
|
13
|
+
/**
|
|
14
|
+
* Columns whose distinct value tuples partition the rows; empty
|
|
15
|
+
* partitions the whole `Table` as one group.
|
|
16
|
+
*/
|
|
17
|
+
partition_by?: Array<string>;
|
|
18
|
+
/**
|
|
19
|
+
* The `Table` column which orders each partition, and the direction.
|
|
20
|
+
*/
|
|
21
|
+
order_by?: WindowSort | null;
|
|
22
|
+
/**
|
|
23
|
+
* A frame of the `rows` preceding each row, plus the row itself.
|
|
24
|
+
* Mutually exclusive with `range` and `cumulative`.
|
|
25
|
+
*/
|
|
26
|
+
rows?: number | null;
|
|
27
|
+
/**
|
|
28
|
+
* A frame of the rows whose `order_by` value lies within `range` of
|
|
29
|
+
* each row's, requiring a numeric or temporal `order_by`. Mutually
|
|
30
|
+
* exclusive with `rows` and `cumulative`.
|
|
31
|
+
*/
|
|
32
|
+
range?: number | null;
|
|
33
|
+
/**
|
|
34
|
+
* `true` frames all rows from the partition start through each row.
|
|
35
|
+
* Default can be omitted.
|
|
36
|
+
*/
|
|
37
|
+
cumulative?: boolean | null;
|
|
38
|
+
/**
|
|
39
|
+
* Row offset for `lag`/`lead` (default 1).
|
|
40
|
+
*/
|
|
41
|
+
offset?: number | null;
|
|
42
|
+
/**
|
|
43
|
+
* Smoothing factor in `(0, 1]` for `ema`.
|
|
44
|
+
*/
|
|
45
|
+
alpha?: number | null;
|
|
46
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { WindowSpec } from "./WindowSpec.js";
|
|
2
|
+
/**
|
|
3
|
+
* The window columns of a `ViewConfig`, keyed by output column alias -
|
|
4
|
+
* symmetric with `expressions` (`{"name": {...spec}}`). An alias must not
|
|
5
|
+
* collide with a `Table` column, expression alias, or another window's
|
|
6
|
+
* key.
|
|
7
|
+
*/
|
|
8
|
+
export type Windows = {
|
|
9
|
+
[key in string]?: WindowSpec;
|
|
10
|
+
};
|
|
@@ -1,6 +1,90 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* A table hosted by a `VirtualServerHandler`, as returned by
|
|
6
|
+
* `getHostedTables()`. A plain `string` is shorthand for `{ name }`.
|
|
7
|
+
*/
|
|
8
|
+
export interface VirtualHostedTable {
|
|
9
|
+
name: string;
|
|
10
|
+
index?: string;
|
|
11
|
+
limit?: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Handler interface that you implement to provide custom data sources.
|
|
16
|
+
*
|
|
17
|
+
* All methods will be called by the `VirtualServer` when handling protocol
|
|
18
|
+
* messages from Perspective clients. Methods can return values directly or
|
|
19
|
+
* return Promises for asynchronous operations (e.g., database queries).
|
|
20
|
+
* Optional methods fall back to defaults documented per-method.
|
|
21
|
+
*/
|
|
22
|
+
export interface VirtualServerHandler {
|
|
23
|
+
getHostedTables():
|
|
24
|
+
| (string | VirtualHostedTable)[]
|
|
25
|
+
| Promise<(string | VirtualHostedTable)[]>;
|
|
26
|
+
tableSchema(
|
|
27
|
+
tableId: string,
|
|
28
|
+
): Record<string, ColumnType> | Promise<Record<string, ColumnType>>;
|
|
29
|
+
tableSize(tableId: string): number | Promise<number>;
|
|
30
|
+
tableMakeView(
|
|
31
|
+
tableId: string,
|
|
32
|
+
viewId: string,
|
|
33
|
+
config: ViewConfigUpdate,
|
|
34
|
+
): void | Promise<void>;
|
|
35
|
+
viewDelete(viewId: string): void | Promise<void>;
|
|
36
|
+
viewGetData(
|
|
37
|
+
viewId: string,
|
|
38
|
+
config: ViewConfig,
|
|
39
|
+
schema: Record<string, ColumnType>,
|
|
40
|
+
viewport: ViewWindow,
|
|
41
|
+
dataSlice: VirtualDataSlice,
|
|
42
|
+
): void | Promise<void>;
|
|
43
|
+
|
|
44
|
+
/** Defaults to `tableSchema(viewId)`. */
|
|
45
|
+
viewSchema?(
|
|
46
|
+
viewId: string,
|
|
47
|
+
config: ViewConfig,
|
|
48
|
+
): Record<string, ColumnType> | Promise<Record<string, ColumnType>>;
|
|
49
|
+
|
|
50
|
+
/** Defaults to `tableSize(viewId)`. */
|
|
51
|
+
viewSize?(viewId: string): number | Promise<number>;
|
|
52
|
+
|
|
53
|
+
/** Defaults to the length of `tableSchema(tableId)`. */
|
|
54
|
+
tableColumnsSize?(tableId: string): number | Promise<number>;
|
|
55
|
+
|
|
56
|
+
/** Defaults to the length of `viewSchema(viewId, config)`. */
|
|
57
|
+
viewColumnSize?(
|
|
58
|
+
viewId: string,
|
|
59
|
+
config: ViewConfig,
|
|
60
|
+
): number | Promise<number>;
|
|
61
|
+
|
|
62
|
+
/** Required when `getFeatures()` reports `expressions: true`. */
|
|
63
|
+
tableValidateExpression?(
|
|
64
|
+
tableId: string,
|
|
65
|
+
expression: string,
|
|
66
|
+
): ColumnType | Promise<ColumnType>;
|
|
67
|
+
|
|
68
|
+
viewGetMinMax?(
|
|
69
|
+
viewId: string,
|
|
70
|
+
columnName: string,
|
|
71
|
+
config: ViewConfig,
|
|
72
|
+
): { min: Scalar; max: Scalar } | Promise<{ min: Scalar; max: Scalar }>;
|
|
73
|
+
|
|
74
|
+
/** Defaults to no optional features. */
|
|
75
|
+
getFeatures?(): Features | Promise<Features>;
|
|
76
|
+
|
|
77
|
+
/** Defaults to port `0`. */
|
|
78
|
+
tableMakePort?(): number | Promise<number>;
|
|
79
|
+
|
|
80
|
+
makeTable?(
|
|
81
|
+
tableId: string,
|
|
82
|
+
data: string | Uint8Array,
|
|
83
|
+
): void | Promise<void>;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
4
88
|
import type {
|
|
5
89
|
ColumnType,
|
|
6
90
|
TableInitOptions,
|
|
@@ -11,8 +95,11 @@ import type {
|
|
|
11
95
|
JoinOptions,
|
|
12
96
|
UpdateOptions,
|
|
13
97
|
DeleteOptions,
|
|
98
|
+
ViewConfig,
|
|
14
99
|
ViewConfigUpdate,
|
|
15
100
|
SystemInfo,
|
|
101
|
+
Scalar,
|
|
102
|
+
Features,
|
|
16
103
|
} from "@perspective-dev/client";
|
|
17
104
|
|
|
18
105
|
export type * from "../../src/ts/ts-rs/ViewerConfig.d.ts";
|
|
@@ -1516,7 +1603,7 @@ export class VirtualServer {
|
|
|
1516
1603
|
free(): void;
|
|
1517
1604
|
[Symbol.dispose](): void;
|
|
1518
1605
|
handleRequest(bytes: Uint8Array): Promise<any>;
|
|
1519
|
-
constructor(handler:
|
|
1606
|
+
constructor(handler: VirtualServerHandler);
|
|
1520
1607
|
}
|
|
1521
1608
|
|
|
1522
1609
|
export function get_wasm_module(): WebAssembly.Module;
|
|
@@ -1704,21 +1791,21 @@ export interface InitOutput {
|
|
|
1704
1791
|
readonly virtualdataslice_setStringCol: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
1705
1792
|
readonly virtualserver_handleRequest: (a: number, b: number, c: number) => number;
|
|
1706
1793
|
readonly virtualserver_new: (a: number, b: number) => void;
|
|
1707
|
-
readonly
|
|
1708
|
-
readonly
|
|
1709
|
-
readonly
|
|
1710
|
-
readonly
|
|
1711
|
-
readonly
|
|
1712
|
-
readonly
|
|
1713
|
-
readonly
|
|
1714
|
-
readonly
|
|
1715
|
-
readonly
|
|
1716
|
-
readonly
|
|
1717
|
-
readonly
|
|
1718
|
-
readonly
|
|
1719
|
-
readonly
|
|
1720
|
-
readonly
|
|
1721
|
-
readonly
|
|
1794
|
+
readonly __wasm_bindgen_func_elem_3667: (a: number, b: number) => void;
|
|
1795
|
+
readonly __wasm_bindgen_func_elem_16364: (a: number, b: number) => void;
|
|
1796
|
+
readonly __wasm_bindgen_func_elem_19409: (a: number, b: number) => void;
|
|
1797
|
+
readonly __wasm_bindgen_func_elem_20067: (a: number, b: number) => void;
|
|
1798
|
+
readonly __wasm_bindgen_func_elem_20096: (a: number, b: number) => void;
|
|
1799
|
+
readonly __wasm_bindgen_func_elem_27549: (a: number, b: number, c: number, d: number) => void;
|
|
1800
|
+
readonly __wasm_bindgen_func_elem_6430: (a: number, b: number, c: number) => void;
|
|
1801
|
+
readonly __wasm_bindgen_func_elem_6431: (a: number, b: number, c: number) => void;
|
|
1802
|
+
readonly __wasm_bindgen_func_elem_6432: (a: number, b: number, c: number) => void;
|
|
1803
|
+
readonly __wasm_bindgen_func_elem_6428: (a: number, b: number, c: number) => void;
|
|
1804
|
+
readonly __wasm_bindgen_func_elem_19529: (a: number, b: number, c: number) => void;
|
|
1805
|
+
readonly __wasm_bindgen_func_elem_20072: (a: number, b: number, c: number) => void;
|
|
1806
|
+
readonly __wasm_bindgen_func_elem_20113: (a: number, b: number, c: number) => void;
|
|
1807
|
+
readonly __wasm_bindgen_func_elem_17084: (a: number, b: number) => number;
|
|
1808
|
+
readonly __wasm_bindgen_func_elem_20071: (a: number, b: number) => void;
|
|
1722
1809
|
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
1723
1810
|
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
1724
1811
|
readonly __wbindgen_export3: (a: number) => void;
|