@perspective-dev/viewer 5.9.0 → 5.9.2

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 (55) hide show
  1. package/dist/cdn/perspective-viewer.js +9 -9
  2. package/dist/cdn/perspective-viewer.js.map +4 -4
  3. package/dist/css/blueprint.css +1 -1
  4. package/dist/css/botanical.css +1 -1
  5. package/dist/css/dracula.css +1 -1
  6. package/dist/css/eggplant.css +1 -1
  7. package/dist/css/gruvbox-dark.css +1 -1
  8. package/dist/css/gruvbox.css +1 -1
  9. package/dist/css/intl/ar.css +1 -1
  10. package/dist/css/intl/de.css +1 -1
  11. package/dist/css/intl/es.css +1 -1
  12. package/dist/css/intl/fr.css +1 -1
  13. package/dist/css/intl/ja.css +1 -1
  14. package/dist/css/intl/pt.css +1 -1
  15. package/dist/css/intl/zh.css +1 -1
  16. package/dist/css/intl.css +1 -1
  17. package/dist/css/ledger.css +1 -1
  18. package/dist/css/monokai.css +1 -1
  19. package/dist/css/nord.css +1 -1
  20. package/dist/css/phosphor.css +1 -1
  21. package/dist/css/pro-dark.css +1 -1
  22. package/dist/css/pro-light.css +1 -0
  23. package/dist/css/pro.css +1 -1
  24. package/dist/css/solarized-dark.css +1 -1
  25. package/dist/css/solarized.css +1 -1
  26. package/dist/css/themes.css +1 -1
  27. package/dist/css/vaporwave.css +1 -1
  28. package/dist/css/velvet.css +1 -1
  29. package/dist/custom-elements.json +381 -78
  30. package/dist/docs/perspective-docs.json +1 -1
  31. package/dist/esm/extensions.d.ts +11 -1
  32. package/dist/esm/perspective-viewer.d.ts +6 -0
  33. package/dist/esm/perspective-viewer.js +216 -201
  34. package/dist/esm/perspective-viewer.js.map +4 -4
  35. package/dist/esm/plugin.d.ts +7 -0
  36. package/dist/ts-rs/CommandLocation.d.ts +6 -0
  37. package/dist/ts-rs/CommandSchema.d.ts +7 -0
  38. package/dist/ts-rs/CommandSchemaOptions.d.ts +12 -0
  39. package/dist/ts-rs/CommandSpec.d.ts +10 -0
  40. package/dist/ts-rs/PerspectiveHit.d.ts +41 -0
  41. package/dist/ts-rs/PerspectiveHitKind.d.ts +6 -0
  42. package/dist/ts-rs/PerspectiveHitRef.d.ts +7 -0
  43. package/dist/ts-rs/ViewConfigUpdate.d.ts +111 -0
  44. package/dist/wasm/perspective-viewer.d.ts +242 -59
  45. package/dist/wasm/perspective-viewer.js +425 -186
  46. package/dist/wasm/perspective-viewer.wasm +0 -0
  47. package/dist/wasm/perspective-viewer.wasm.d.ts +20 -16
  48. package/dist/wasm/snippets/perspective-viewer-37c88b7aebc72452/inline3.js +8 -0
  49. package/package.json +8 -6
  50. package/dist/wasm/snippets/perspective-viewer-d50f032e5aa67e6f/inline1.js +0 -1
  51. /package/dist/wasm/snippets/{perspective-viewer-d50f032e5aa67e6f → perspective-viewer-37c88b7aebc72452}/inline0.js +0 -0
  52. /package/dist/wasm/snippets/{perspective-viewer-d50f032e5aa67e6f/inline2.js → perspective-viewer-37c88b7aebc72452/inline1.js} +0 -0
  53. /package/dist/wasm/snippets/{perspective-viewer-d50f032e5aa67e6f/inline3.js → perspective-viewer-37c88b7aebc72452/inline2.js} +0 -0
  54. /package/dist/wasm/snippets/{perspective-viewer-d50f032e5aa67e6f → perspective-viewer-37c88b7aebc72452}/inline4.js +0 -0
  55. /package/dist/wasm/snippets/{perspective-viewer-d50f032e5aa67e6f → perspective-viewer-37c88b7aebc72452}/inline5.js +0 -0
@@ -1,5 +1,6 @@
1
1
  import type { View } from "@perspective-dev/client";
2
2
  import type { PluginStaticConfig } from "../../dist/ts-rs/PluginStaticConfig.d.ts";
3
+ import type { PerspectiveHitTest } from "../../dist/wasm/perspective-viewer.js";
3
4
  /**
4
5
  * The `IPerspectiveViewerPlugin` interface defines the necessary API for a
5
6
  * `<perspective-viewer>` plugin, which also must be an `HTMLElement` via the
@@ -191,6 +192,12 @@ export interface IPerspectiveViewerPlugin {
191
192
  * selection UI may omit it.
192
193
  */
193
194
  deselect?(): Promise<void>;
195
+ /**
196
+ * OPTIONAL — the `{ frame, ref }` this plugin drew at the viewport point
197
+ * `(x, y)`, or `undefined` over nothing; the viewer resolves it to a
198
+ * `PerspectiveHit`.
199
+ */
200
+ hit_test?(x: number, y: number): Promise<PerspectiveHitTest | undefined>;
194
201
  /**
195
202
  * Free any resources acquired by this plugin and prepare to be deleted.
196
203
  */
@@ -0,0 +1,6 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+
3
+ /**
4
+ * A surface a command schema can be evaluated for.
5
+ */
6
+ export type CommandLocation = "context-menu" | "datagrid-row" | "datagrid-cell" | "chart-tooltip";
@@ -0,0 +1,7 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+ import type { CommandSpec } from "./CommandSpec.d.ts";
3
+
4
+ /**
5
+ * The commands a command schema offers for one context.
6
+ */
7
+ export type CommandSchema = { commands: Array<CommandSpec>, };
@@ -0,0 +1,12 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+ import type { CommandLocation } from "./CommandLocation.d.ts";
3
+
4
+ /**
5
+ * Options for the `setCommandSchema()` method.
6
+ */
7
+ export type CommandSchemaOptions = {
8
+ /**
9
+ * The surfaces the schema is evaluated for, `["context-menu"]` when
10
+ * omitted.
11
+ */
12
+ scopes?: Array<CommandLocation>, };
@@ -0,0 +1,10 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+
3
+ /**
4
+ * One row a command schema contributes to a menu.
5
+ */
6
+ export type CommandSpec = { "kind": "Command", key: string, label: string, disabled?: boolean, icon?: string,
7
+ /**
8
+ * Tooltip text where the command is a button, the `label` when absent.
9
+ */
10
+ title?: string, } | { "kind": "Group", key: string, label: string, commands: Array<CommandSpec>, };
@@ -0,0 +1,41 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+ import type { PerspectiveHitKind } from "./PerspectiveHitKind.d.ts";
3
+ import type { Scalar } from "./Scalar.d.ts";
4
+ import type { ViewConfigUpdate } from "./ViewConfigUpdate.d.ts";
5
+
6
+ /**
7
+ * What a plugin rendered at a location, resolved against its view frame.
8
+ */
9
+ export type PerspectiveHit = { kind: PerspectiveHitKind,
10
+ /**
11
+ * The view row index at draw time.
12
+ */
13
+ y?: number,
14
+ /**
15
+ * The view column index at draw time.
16
+ */
17
+ x?: number,
18
+ /**
19
+ * The row's `__ID__`: its index value(s), or its `group_by` path.
20
+ */
21
+ id?: Array<Scalar>,
22
+ /**
23
+ * The `group_by` values of the row, outermost first.
24
+ */
25
+ row_path: Array<Scalar>,
26
+ /**
27
+ * The `split_by` values of the column, outermost first.
28
+ */
29
+ column_path: Array<Scalar>,
30
+ /**
31
+ * The column targeted, as in `perspective-click`.
32
+ */
33
+ column_names: Array<string>,
34
+ /**
35
+ * The cell's value, for a `"cell"` hit.
36
+ */
37
+ value?: Scalar,
38
+ /**
39
+ * A `restore()` patch whose filters select the target.
40
+ */
41
+ config: ViewConfigUpdate, };
@@ -0,0 +1,6 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+
3
+ /**
4
+ * Which axes a `PerspectiveHit` addresses.
5
+ */
6
+ export type PerspectiveHitKind = "cell" | "row" | "column";
@@ -0,0 +1,7 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+
3
+ /**
4
+ * A location in a `PerspectiveViewFrame`'s coordinates: a view row and/or a
5
+ * view column index.
6
+ */
7
+ export type PerspectiveHitRef = { y?: number, x?: number, };
@@ -0,0 +1,111 @@
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.d.ts";
3
+ import type { Expressions } from "./Expressions.d.ts";
4
+ import type { Filter } from "./Filter.d.ts";
5
+ import type { FilterReducer } from "./FilterReducer.d.ts";
6
+ import type { GroupRollupMode } from "./GroupRollupMode.d.ts";
7
+ import type { Sort } from "./Sort.d.ts";
8
+ import type { SplitRollupMode } from "./SplitRollupMode.d.ts";
9
+ import type { Windows } from "./Windows.d.ts";
10
+
11
+ export type ViewConfigUpdate = {
12
+ /**
13
+ * A group by _groups_ the dataset by the unique values of each column used
14
+ * as a group by - a close analogue in SQL to the `GROUP BY` statement.
15
+ * The underlying dataset is aggregated to show the values belonging to
16
+ * each group, and a total row is calculated for each group, showing
17
+ * the currently selected aggregated value (e.g. `sum`) of the column.
18
+ * Group by are useful for hierarchies, categorizing data and
19
+ * attributing values, i.e. showing the number of units sold based on
20
+ * State and City. In Perspective, group by are represented as an array
21
+ * of string column names to pivot, are applied in the order provided;
22
+ * For example, a group by of `["State", "City", "Postal Code"]` shows
23
+ * the values for each Postal Code, which are grouped by City,
24
+ * which are in turn grouped by State.
25
+ */
26
+ group_by?: Array<string>,
27
+ /**
28
+ * A split by _splits_ the dataset by the unique values of each column used
29
+ * as a split by. The underlying dataset is not aggregated, and a new
30
+ * column is created for each unique value of the split by. Each newly
31
+ * created column contains the parts of the dataset that correspond to
32
+ * the column header, i.e. a `View` that has `["State"]` as its split
33
+ * by will have a new column for each state. In Perspective, Split By
34
+ * are represented as an array of string column names to pivot.
35
+ */
36
+ split_by?: Array<string>,
37
+ /**
38
+ * The `columns` property specifies which columns should be included in the
39
+ * [`crate::View`]'s output. This allows users to show or hide a specific
40
+ * subset of columns, as well as control the order in which columns
41
+ * appear to the user. This is represented in Perspective as an array
42
+ * of string column names.
43
+ */
44
+ columns?: Array<string | null>,
45
+ /**
46
+ * The `filter` property specifies columns on which the query can be
47
+ * filtered, returning rows that pass the specified filter condition.
48
+ * This is analogous to the `WHERE` clause in SQL. There is no limit on
49
+ * the number of columns where `filter` is applied, but the resulting
50
+ * dataset is one that passes all the filter conditions, i.e. the
51
+ * filters are joined with an `AND` condition.
52
+ *
53
+ * Perspective represents `filter` as an array of arrays, with the values
54
+ * of each inner array being a string column name, a string filter
55
+ * operator, and a filter operand in the type of the column.
56
+ */
57
+ filter?: Array<Filter>,
58
+ /**
59
+ * The `sort` property specifies columns on which the query should be
60
+ * sorted, analogous to `ORDER BY` in SQL. A column can be sorted
61
+ * regardless of its data type, and sorts can be applied in ascending
62
+ * or descending order. Perspective represents `sort` as an array of
63
+ * arrays, with the values of each inner array being a string column
64
+ * name and a string sort direction. When `column-pivots` are applied,
65
+ * the additional sort directions `"col asc"` and `"col desc"` will
66
+ * determine the order of pivot columns groups.
67
+ *
68
+ * `sort` is the ONLY thing that orders a `View`'s rows — without it
69
+ * they keep the `Table`'s natural (insertion) order, which any
70
+ * consumer reading rows sequentially will reflect. Not to be
71
+ * confused with a window column's `order_by`, which orders rows
72
+ * WITHIN a window frame and does not reorder the `View`.
73
+ */
74
+ sort?: Array<Sort>,
75
+ /**
76
+ * The `expressions` property specifies _new_ columns in Perspective that
77
+ * are created using existing column values or arbitary scalar values
78
+ * defined within the expression. In `<perspective-viewer>`,
79
+ * expressions are added using the "New Column" button in the side
80
+ * panel.
81
+ */
82
+ expressions?: Expressions,
83
+ /**
84
+ * The `windows` property declares ordered, partitioned rolling
85
+ * computations (moving aggregates, cumulative sums) as _new_ columns
86
+ * keyed by output alias (`{"name": {...spec}}`, symmetric with
87
+ * `expressions`), analogous to SQL window functions. See
88
+ * [`crate::config::WindowSpec`].
89
+ */
90
+ windows?: Windows,
91
+ /**
92
+ * Aggregates perform a calculation over an entire column, and are
93
+ * displayed when one or more [Group By](#group-by) are applied to the
94
+ * `View`. Aggregates can be specified by the user, or Perspective will
95
+ * use the following sensible default aggregates based on column type:
96
+ *
97
+ * - "sum" for `integer` and `float` columns
98
+ * - "count" for all other columns
99
+ *
100
+ * Perspective provides a selection of aggregate functions that can be
101
+ * applied to columns in the `View` constructor using a dictionary of
102
+ * column name to aggregate function name.
103
+ *
104
+ * An aggregate also determines the column's RESULT TYPE, which need
105
+ * not match the input: `"count"` yields an `integer` whatever it
106
+ * counts, so a `date` column left on the default `"count"` is an
107
+ * `integer` in the resulting `View` — no longer a date. Set an
108
+ * aggregate that preserves the type (e.g. `"any"`, `"last"`) when
109
+ * the original type matters, such as a date used as a chart axis.
110
+ */
111
+ aggregates?: { [key in string]?: Aggregate }, group_by_depth?: number, filter_op?: FilterReducer, group_rollup_mode?: GroupRollupMode, split_rollup_mode?: SplitRollupMode, };