@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
@@ -191,6 +191,19 @@ export type * from "../ts-rs/Notation.d.ts";
191
191
  export type * from "../ts-rs/DatetimeFormat.d.ts";
192
192
  export type * from "../ts-rs/ConfigDefaultsOptions.d.ts";
193
193
  export type * from "../ts-rs/ColumnConfigDefaultsOptions.d.ts";
194
+ export type * from "../ts-rs/CommandSchema.d.ts";
195
+ export type * from "../ts-rs/CommandSpec.d.ts";
196
+ export type * from "../ts-rs/CommandLocation.d.ts";
197
+ export type * from "../ts-rs/CommandSchemaOptions.d.ts";
198
+ export type * from "../ts-rs/PerspectiveHit.d.ts";
199
+ export type * from "../ts-rs/PerspectiveHitRef.d.ts";
200
+
201
+ export type ExportData =
202
+ | string
203
+ | ArrayBuffer
204
+ | Blob
205
+ | Record<string, unknown[]>
206
+ | ViewerConfig;
194
207
 
195
208
  import type {GetTableOptions} from "../ts-rs/GetTableOptions.d.ts";
196
209
  import type {PanelOptions} from "../ts-rs/PanelOptions.d.ts";
@@ -209,6 +222,82 @@ import type {ViewerConfigUpdate} from "../ts-rs/ViewerConfigUpdate.d.ts";
209
222
  import type {ViewerConfigInitial} from "../ts-rs/ViewerConfigInitial.d.ts";
210
223
  import type {WorkspaceConfig} from "../ts-rs/WorkspaceConfig.d.ts";
211
224
  import type {WorkspaceConfigUpdate} from "../ts-rs/WorkspaceConfigUpdate.d.ts";
225
+ import type {CommandSchema} from "../ts-rs/CommandSchema.d.ts";
226
+ import type {CommandSpec} from "../ts-rs/CommandSpec.d.ts";
227
+ import type {CommandLocation} from "../ts-rs/CommandLocation.d.ts";
228
+ import type {CommandSchemaOptions} from "../ts-rs/CommandSchemaOptions.d.ts";
229
+ import type {PerspectiveHit} from "../ts-rs/PerspectiveHit.d.ts";
230
+ import type {PerspectiveHitRef} from "../ts-rs/PerspectiveHitRef.d.ts";
231
+
232
+ /** A surface a command schema is evaluated for. */
233
+ export type PerspectiveCommandLocation = CommandLocation;
234
+
235
+ /**
236
+ * A window of a plugin's viewport, in the shape of the parsed
237
+ * `to_columns_string({ id: true })` result and the `column_paths()` area.
238
+ */
239
+ export interface PerspectiveViewFrame {
240
+ /** The view row index of `data`'s first entry. */
241
+ start_row: number;
242
+
243
+ /** The view column index of `paths[0]`. */
244
+ start_col: number;
245
+
246
+ /** The `data` key of each column from `start_col`. */
247
+ paths: string[];
248
+
249
+ /** One level per `split_by` plus the column name, each over `paths`. */
250
+ column_paths: Scalar[][];
251
+
252
+ /** Columns keyed by path, with `__ROW_PATH__` and `__ID__` when present. */
253
+ data: Record<string, unknown[]>;
254
+ }
255
+
256
+ /** What a plugin rendered at a viewport point, before the viewer resolves it. */
257
+ export interface PerspectiveHitTest {
258
+ frame: PerspectiveViewFrame;
259
+ ref: PerspectiveHitRef;
260
+ }
261
+
262
+ /** One `queryCommands()` result: the context the schema saw and what it returned. */
263
+ export interface PerspectiveCommands {
264
+ context: PerspectiveCommandContext;
265
+ commands: CommandSpec[];
266
+ }
267
+
268
+ /** What a command schema is evaluated against. */
269
+ export interface PerspectiveCommandContext {
270
+ location: PerspectiveCommandLocation;
271
+
272
+ /** The targeted panel, absent only at zero panels. */
273
+ panel?: string;
274
+
275
+ /** The name of the panel's `Table`. */
276
+ table?: string;
277
+
278
+ /** The name of the panel's plugin. */
279
+ plugin?: string;
280
+
281
+ /** The panel's view config, as `getViewConfig()` reports it. */
282
+ view_config?: ViewConfig;
283
+
284
+ /** Viewport coordinates of the pointer that initiated the command, for the context menu. */
285
+ point?: { x: number; y: number };
286
+
287
+ /** What the plugin rendered at the location, absent over tabs and chrome. */
288
+ hit?: PerspectiveHit;
289
+ }
290
+
291
+ /** A synchronous, effect-free function declaring the commands for a context. */
292
+ export type PerspectiveCommandSchema = (
293
+ context: PerspectiveCommandContext,
294
+ ) => CommandSchema;
295
+
296
+ /** The `detail` of a `perspective-command` event. */
297
+ export interface PerspectiveCommandEventDetail {
298
+ key: string;
299
+ context: PerspectiveCommandContext;
300
+ }
212
301
 
213
302
 
214
303
 
@@ -574,9 +663,9 @@ export class GenericSQLVirtualServerModel {
574
663
  export class PerspectiveDebugPluginElement {
575
664
  free(): void;
576
665
  [Symbol.dispose](): void;
577
- clear(): Promise<any>;
666
+ clear(): Promise<void>;
578
667
  connectedCallback(): void;
579
- delete(): Promise<any>;
668
+ delete(): Promise<void>;
580
669
  /**
581
670
  * # Notes
582
671
  *
@@ -584,9 +673,9 @@ export class PerspectiveDebugPluginElement {
584
673
  * move. Ergo, if you replace the `&` in the `view` argument, the JS copy
585
674
  * of the `View` will be invalid
586
675
  */
587
- draw(view: View): Promise<any>;
676
+ draw(view: View): Promise<void>;
588
677
  constructor(elem: HTMLElement);
589
- resize(): Promise<any>;
678
+ resize(): Promise<void>;
590
679
  restore(_config?: any | null): void;
591
680
  restyle(): void;
592
681
  save(): any;
@@ -594,7 +683,7 @@ export class PerspectiveDebugPluginElement {
594
683
  * Delegates to `draw()` VIRTUALLY — through the JS element's `draw`
595
684
  * property, never `self.draw(view)` (Rust static dispatch).
596
685
  */
597
- update(view: View): Promise<any>;
686
+ update(view: View): Promise<void>;
598
687
  readonly config_column_names: any;
599
688
  readonly min_config_columns: any;
600
689
  readonly name: string;
@@ -653,7 +742,7 @@ export class PerspectiveViewerElement {
653
742
  * hosts yet creates the panel empty and pending until the table is
654
743
  * created, instead of the default rejection.
655
744
  */
656
- addPanel(config: ViewerConfigInitial, options?: AddPanelOptions | null): Promise<any>;
745
+ addPanel(config: ViewerConfigInitial, options?: AddPanelOptions | null): Promise<string>;
657
746
  /**
658
747
  * Configure the embedded LLM agent (see `prompt()`), replacing any prior
659
748
  * configuration and conversation.
@@ -695,9 +784,10 @@ export class PerspectiveViewerElement {
695
784
  * opening user turn.
696
785
  * - `config.entitlements` - access grants limiting which tools the agent
697
786
  * is offered (and may call): any of `"read_view"`, `"configure_view"`,
698
- * `"manage_layout"`, `"read_docs"`, `"read_data"`. Omitted, all but
699
- * `"read_data"` are granted; `["read_view", "read_docs"]` yields a
700
- * read-only agent.
787
+ * `"manage_layout"`, `"read_docs"`, `"execute_code"`, `"read_data"`.
788
+ * Omitted, all but `"execute_code"` and `"read_data"` are granted;
789
+ * `["read_view", "read_docs"]` yields a read-only agent. Users may
790
+ * switch granted entitlements off from the chat panel, never on.
701
791
  *
702
792
  * # JavaScript Examples
703
793
  *
@@ -721,7 +811,8 @@ export class PerspectiveViewerElement {
721
811
  * conversation history (and the chat sidebar's transcript) until
722
812
  * `agentReset()`; a call made while a turn is already running rejects.
723
813
  * Tool activity is emitted as `perspective-agent-tool` CustomEvents on
724
- * this element.
814
+ * this element. A failed turn rejects with an `Error` whose `retry()`
815
+ * method retries it, returning a `Promise` that settles like this one.
725
816
  *
726
817
  * # JavaScript Examples
727
818
  *
@@ -737,8 +828,8 @@ export class PerspectiveViewerElement {
737
828
  agentReset(): Promise<any>;
738
829
  connectedCallback(): void;
739
830
  /**
740
- * Copy this viewer's `View` or `Table` data as CSV to the system
741
- * clipboard.
831
+ * Copy this viewer's `View` or `Table` data to the system clipboard from
832
+ * within a user gesture, rejecting if nothing could be written.
742
833
  *
743
834
  * # Arguments
744
835
  *
@@ -753,7 +844,7 @@ export class PerspectiveViewerElement {
753
844
  * })
754
845
  * ```
755
846
  */
756
- copy(options?: ExportOptions | null): Promise<any>;
847
+ copy(options?: ExportOptions | null): Promise<void>;
757
848
  /**
758
849
  * Delete all internal [`View`]s and all associated state, rendering this
759
850
  * `<perspective-viewer>` unusable and freeing all associated resources.
@@ -777,7 +868,7 @@ export class PerspectiveViewerElement {
777
868
  * await viewer.delete();
778
869
  * ```
779
870
  */
780
- delete(): Promise<any>;
871
+ delete(): Promise<void>;
781
872
  /**
782
873
  * Download this viewer's internal [`View`] data via a browser download
783
874
  * event.
@@ -794,7 +885,7 @@ export class PerspectiveViewerElement {
794
885
  * })
795
886
  * ```
796
887
  */
797
- download(options?: ExportOptions | null): Promise<any>;
888
+ download(options?: ExportOptions | null): Promise<void>;
798
889
  /**
799
890
  * Remove a [`Client`] from this `<perspective-viewer>` and dispose every
800
891
  * panel bound to it (each panel's `View` is deleted and its `Table`
@@ -812,7 +903,7 @@ export class PerspectiveViewerElement {
812
903
  * await viewer.eject({client: "remote"});
813
904
  * ```
814
905
  */
815
- eject(options?: ClientOptions | null): Promise<any>;
906
+ eject(options?: ClientOptions | null): Promise<void>;
816
907
  /**
817
908
  * Exports this viewer's internal [`View`] as a JavaSript data, the
818
909
  * exact type of which depends on the `method` but defaults to `String`
@@ -833,7 +924,7 @@ export class PerspectiveViewerElement {
833
924
  * const data = await viewer.export("plugin");
834
925
  * ```
835
926
  */
836
- export(options?: ExportOptions | null): Promise<any>;
927
+ export(options?: ExportOptions | null): Promise<ExportData>;
837
928
  /**
838
929
  * Flush any pending modifications to this `<perspective-viewer>`. Since
839
930
  * `<perspective-viewer>`'s API is almost entirely `async`, it may take
@@ -854,7 +945,7 @@ export class PerspectiveViewerElement {
854
945
  * await viewer.flush();
855
946
  * ```
856
947
  */
857
- flush(): Promise<any>;
948
+ flush(): Promise<void>;
858
949
  /**
859
950
  * The id of the active panel — the one the settings panel and status-bar
860
951
  * toolbar target — or `null` when the element has zero panels.
@@ -883,7 +974,7 @@ export class PerspectiveViewerElement {
883
974
  * const client = await viewer.getClient();
884
975
  * ```
885
976
  */
886
- getClient(options?: GetClientOptions | null): Promise<any>;
977
+ getClient(options?: GetClientOptions | null): Promise<Client>;
887
978
  /**
888
979
  * Get this viewer's edit port for the named panel's [`Table`] (see
889
980
  * [`Table::update`] for details on ports), or the active panel when
@@ -938,8 +1029,8 @@ export class PerspectiveViewerElement {
938
1029
  * const table = await viewer.getTable();
939
1030
  * ```
940
1031
  */
941
- getTable(options?: GetTableOptions | null): Promise<any>;
942
- getThemes(): Promise<any>;
1032
+ getTable(options?: GetTableOptions | null): Promise<Table>;
1033
+ getThemes(): Promise<string[]>;
943
1034
  /**
944
1035
  * Get a [`View`] for a panel of this viewer, as currently configured by
945
1036
  * the user.
@@ -980,7 +1071,7 @@ export class PerspectiveViewerElement {
980
1071
  * }
981
1072
  * ```
982
1073
  */
983
- getView(options?: GetViewOptions | null): Promise<any>;
1074
+ getView(options?: GetViewOptions | null): Promise<View>;
984
1075
  /**
985
1076
  * Get a copy of the [`ViewConfig`] for the current [`View`]. This is
986
1077
  * non-blocking as it does not need to access the plugin (unlike
@@ -988,7 +1079,37 @@ export class PerspectiveViewerElement {
988
1079
  * server (unlike [`PerspectiveViewerElement::getView`] followed by
989
1080
  * [`View::get_config`])
990
1081
  */
991
- getViewConfig(options?: PanelOptions | null): Promise<any>;
1082
+ getViewConfig(options?: PanelOptions | null): Promise<ViewConfig>;
1083
+ /**
1084
+ * Redraw each panel's plugin from its current `View` without re-creating
1085
+ * the view, such as after a command changed state its buttons read; calls
1086
+ * within one task run as one.
1087
+ *
1088
+ * # Arguments
1089
+ *
1090
+ * - `options.panel` - Limits the redraw to one panel.
1091
+ *
1092
+ * # JavaScript Examples
1093
+ *
1094
+ * ```javascript
1095
+ * viewer.addEventListener("perspective-command", (e) => {
1096
+ * flagged.add(e.detail.context.hit.id);
1097
+ * viewer.invalidate({ panel: e.detail.context.panel });
1098
+ * });
1099
+ * ```
1100
+ */
1101
+ invalidate(options?: PanelOptions | null): Promise<void>;
1102
+ /**
1103
+ * Dispatch `perspective-command` for the app command `key` picked against
1104
+ * `context`, as the context menu does.
1105
+ *
1106
+ * # JavaScript Examples
1107
+ *
1108
+ * ```javascript
1109
+ * viewer.invokeCommand("ticket", result.context);
1110
+ * ```
1111
+ */
1112
+ invokeCommand(key: string, context: PerspectiveCommandContext): void;
992
1113
  /**
993
1114
  * Loads a [`Client`], or optionally [`Table`], or optionally a Javascript
994
1115
  * `Promise` which returns a [`Client`] or [`Table`], in this viewer.
@@ -1065,8 +1186,29 @@ export class PerspectiveViewerElement {
1065
1186
  * await viewer.load(table);
1066
1187
  * ```
1067
1188
  */
1068
- load(client: Client | Table | Promise<Client | Table>): Promise<any>;
1189
+ load(client: Client | Table | Promise<Client | Table>): Promise<void>;
1069
1190
  constructor(elem: HTMLElement);
1191
+ /**
1192
+ * Evaluate the app's command schema at `location` for each of `refs`,
1193
+ * resolved against `frame`, the viewport read of the panel plugin
1194
+ * `plugin`; `undefined` when `location` is outside the schema's scopes
1195
+ * or no schema is set.
1196
+ *
1197
+ * # Arguments
1198
+ *
1199
+ * - `plugin` - The calling plugin element, which identifies its panel.
1200
+ * - `location` - The surface being rendered.
1201
+ * - `frame` - The plugin's viewport read, as `to_columns_string({ id: true
1202
+ * })` and `column_paths()` returned it.
1203
+ * - `refs` - One view row and/or column index per button.
1204
+ *
1205
+ * # JavaScript Examples
1206
+ *
1207
+ * ```javascript
1208
+ * const results = viewer.queryCommands(this, "datagrid-row", frame, [{ y: 12 }]);
1209
+ * ```
1210
+ */
1211
+ queryCommands(plugin: HTMLElement, location: PerspectiveCommandLocation, frame: PerspectiveViewFrame, refs: PerspectiveHitRef[]): PerspectiveCommands[] | undefined;
1070
1212
  /**
1071
1213
  * Remove the panel with id `name` from the layout, disposing its engines
1072
1214
  * (its `View` is deleted and its `Table` reference released). The last
@@ -1075,7 +1217,7 @@ export class PerspectiveViewerElement {
1075
1217
  * error — previously fire-and-forget and silently dropped (invariant
1076
1218
  * I6). See also [`Self::addPanel`].
1077
1219
  */
1078
- removePanel(name: string): Promise<any>;
1220
+ removePanel(name: string): Promise<void>;
1079
1221
  /**
1080
1222
  * Reset a panel's `ViewerConfig` to its data-relative default.
1081
1223
  *
@@ -1101,13 +1243,13 @@ export class PerspectiveViewerElement {
1101
1243
  * await viewer.reset(true, {panel: "p1"}); // just "p1", + expressions
1102
1244
  * ```
1103
1245
  */
1104
- reset(reset_all?: boolean | null, options?: PanelOptions | null): Promise<any>;
1246
+ reset(reset_all?: boolean | null, options?: PanelOptions | null): Promise<void>;
1105
1247
  /**
1106
1248
  * If this element is in an _errored_ state, this method will clear it and
1107
1249
  * re-render. Calling this method is equivalent to clicking the error reset
1108
1250
  * button in the UI.
1109
1251
  */
1110
- resetError(): Promise<any>;
1252
+ resetError(): Promise<void>;
1111
1253
  /**
1112
1254
  * Set the available theme names available in the status bar UI.
1113
1255
  *
@@ -1124,7 +1266,7 @@ export class PerspectiveViewerElement {
1124
1266
  * viewer.resetThemes(["Pro Light", "Pro Dark"])
1125
1267
  * ```
1126
1268
  */
1127
- resetThemes(themes?: any[] | null): Promise<any>;
1269
+ resetThemes(themes?: any[] | null): Promise<void>;
1128
1270
  /**
1129
1271
  * Recalculate the viewer's dimensions and redraw.
1130
1272
  *
@@ -1148,7 +1290,7 @@ export class PerspectiveViewerElement {
1148
1290
  * await viewer.resize({dimensions: {width: 800, height: 600}})
1149
1291
  * ```
1150
1292
  */
1151
- resize(options?: any | null): Promise<any>;
1293
+ resize(options?: any | null): Promise<void>;
1152
1294
  /**
1153
1295
  * Restore a single panel from a full/partial
1154
1296
  * [`perspective_js::JsViewConfig`] (its user-configurable state, including
@@ -1242,7 +1384,8 @@ export class PerspectiveViewerElement {
1242
1384
  *
1243
1385
  * [`Self::restyleElement`] _must_ be called for many runtime changes to
1244
1386
  * CSS properties to be reflected in an already-rendered
1245
- * `<perspective-viewer>`.
1387
+ * `<perspective-viewer>`, including a `prefers-color-scheme` change
1388
+ * under a preference-aware theme such as `"Pro"`.
1246
1389
  *
1247
1390
  * </div>
1248
1391
  *
@@ -1253,7 +1396,7 @@ export class PerspectiveViewerElement {
1253
1396
  * await viewer.restyleElement();
1254
1397
  * ```
1255
1398
  */
1256
- restyleElement(): Promise<any>;
1399
+ restyleElement(): Promise<void>;
1257
1400
  /**
1258
1401
  * Save a single panel's user-configurable state as a [`ViewerConfig`], one
1259
1402
  * which can be restored via [`Self::restore`] — the active panel, or a
@@ -1308,7 +1451,7 @@ export class PerspectiveViewerElement {
1308
1451
  * activation-chrome redraws on both sides of the switch have completed
1309
1452
  * (invariant I6).
1310
1453
  */
1311
- setActivePanel(name: string): Promise<any>;
1454
+ setActivePanel(name: string): Promise<void>;
1312
1455
  /**
1313
1456
  * Sets the auto-pause behavior of this component.
1314
1457
  *
@@ -1330,7 +1473,7 @@ export class PerspectiveViewerElement {
1330
1473
  * viewer.setAutoPause(false);
1331
1474
  * ```
1332
1475
  */
1333
- setAutoPause(autopause: boolean): Promise<any>;
1476
+ setAutoPause(autopause: boolean): Promise<void>;
1334
1477
  /**
1335
1478
  * Sets the auto-size behavior of this component.
1336
1479
  *
@@ -1354,6 +1497,30 @@ export class PerspectiveViewerElement {
1354
1497
  * ```
1355
1498
  */
1356
1499
  setAutoSize(autosize: boolean): void;
1500
+ /**
1501
+ * Set the function that declares this viewer's custom commands, replacing
1502
+ * any previously set, and re-query every plugin's command buttons when it
1503
+ * or its scopes changed.
1504
+ *
1505
+ * # Arguments
1506
+ *
1507
+ * - `schema` - A synchronous function from a command context to a `{
1508
+ * commands }` list, or `null` to remove the current one.
1509
+ * - `options.scopes` - The surfaces the schema is evaluated for,
1510
+ * `["context-menu"]` when omitted.
1511
+ *
1512
+ * # JavaScript Examples
1513
+ *
1514
+ * ```javascript
1515
+ * await viewer.setCommandSchema(
1516
+ * (ctx) => ({
1517
+ * commands: [{ kind: "Command", key: "hello", label: "Hello" }],
1518
+ * }),
1519
+ * { scopes: ["context-menu", "datagrid-row"] },
1520
+ * );
1521
+ * ```
1522
+ */
1523
+ setCommandSchema(schema?: PerspectiveCommandSchema | null, options?: CommandSchemaOptions | null): Promise<void>;
1357
1524
  /**
1358
1525
  * Set the selection [`perspective_js::JsViewWindow`] for the named panel,
1359
1526
  * or the active panel when `panel` is omitted.
@@ -1379,6 +1546,18 @@ export class PerspectiveViewerElement {
1379
1546
  * ```
1380
1547
  */
1381
1548
  setThrottle(val?: number | null): void;
1549
+ /**
1550
+ * Open a menu of `commands` at viewport `point`, dispatching
1551
+ * `perspective-command` with `context` for a pick; resolves when the menu
1552
+ * closes.
1553
+ *
1554
+ * # JavaScript Examples
1555
+ *
1556
+ * ```javascript
1557
+ * await viewer.showCommandMenu(result.context, group.commands, { x: e.clientX, y: e.clientY });
1558
+ * ```
1559
+ */
1560
+ showCommandMenu(context: PerspectiveCommandContext, commands: CommandSpec[], point: { x: number; y: number }): Promise<void>;
1382
1561
  /**
1383
1562
  * Asynchronously opens the column settings for a specific column.
1384
1563
  * When finished, the `<perspective-viewer>` element will emit a
@@ -1387,7 +1566,7 @@ export class PerspectiveViewerElement {
1387
1566
  * string}`. The CustomEvent is also fired whenever the user toggles the
1388
1567
  * sidebar manually.
1389
1568
  */
1390
- toggleColumnSettings(column_name: string, options?: PanelOptions | null): Promise<any>;
1569
+ toggleColumnSettings(column_name: string, options?: PanelOptions | null): Promise<void>;
1391
1570
  /**
1392
1571
  * Toggle (or force) the config panel open/closed.
1393
1572
  *
@@ -1402,7 +1581,7 @@ export class PerspectiveViewerElement {
1402
1581
  * await viewer.toggleConfig();
1403
1582
  * ```
1404
1583
  */
1405
- toggleConfig(force?: boolean | null): Promise<any>;
1584
+ toggleConfig(force?: boolean | null): Promise<void>;
1406
1585
  }
1407
1586
 
1408
1587
  export class ProxySession {
@@ -1529,7 +1708,7 @@ export class Table {
1529
1708
  * [`Table::on_delete`] resolves when the subscription message is sent, not
1530
1709
  * when the _delete_ event occurs.
1531
1710
  */
1532
- on_delete(on_delete: Function): Promise<any>;
1711
+ on_delete(on_delete: Function): Promise<number>;
1533
1712
  /**
1534
1713
  * Removes rows from this [`Table`] with the `index` column values
1535
1714
  * supplied.
@@ -1552,7 +1731,7 @@ export class Table {
1552
1731
  * Removes a listener with a given ID, as returned by a previous call to
1553
1732
  * [`Table::on_delete`].
1554
1733
  */
1555
- remove_delete(callback_id: number): Promise<any>;
1734
+ remove_delete(callback_id: number): Promise<void>;
1556
1735
  /**
1557
1736
  * Replace all rows in this [`Table`] with the input data, coerced to this
1558
1737
  * [`Table`]'s existing [`perspective_client::Schema`], notifying any
@@ -1620,7 +1799,7 @@ export class Table {
1620
1799
  * await table.update("x,y\n1,2");
1621
1800
  * ```
1622
1801
  */
1623
- update(input: string | ArrayBuffer | Record<string, unknown[]> | Record<string, unknown>[] | Record<string, ColumnType>, options?: UpdateOptions | null): Promise<any>;
1802
+ update(input: string | ArrayBuffer | Record<string, unknown[]> | Record<string, unknown>[] | Record<string, ColumnType>, options?: UpdateOptions | null): Promise<void>;
1624
1803
  /**
1625
1804
  * Validates the given expressions.
1626
1805
  */
@@ -1758,7 +1937,7 @@ export class View {
1758
1937
  * Register a callback with this [`View`]. Whenever the [`View`] is
1759
1938
  * deleted, this callback will be invoked.
1760
1939
  */
1761
- on_delete(on_delete: Function): Promise<any>;
1940
+ on_delete(on_delete: Function): Promise<number>;
1762
1941
  /**
1763
1942
  * Register a callback which is invoked whenever rows leave this
1764
1943
  * [`View`], with an object containing `port_id`, `indices` (their keys
@@ -1782,7 +1961,7 @@ export class View {
1782
1961
  * });
1783
1962
  * ```
1784
1963
  */
1785
- on_remove(on_remove_js: (data: OnRemoveData) => void): Promise<any>;
1964
+ on_remove(on_remove_js: (data: OnRemoveData) => void): Promise<number>;
1786
1965
  /**
1787
1966
  * Register a callback with this [`View`]. Whenever the view's underlying
1788
1967
  * table emits an update, this callback will be invoked with an object
@@ -1809,11 +1988,11 @@ export class View {
1809
1988
  * view.on_update((updated) => console.log(updated.delta), { mode: "row" });
1810
1989
  * ```
1811
1990
  */
1812
- on_update(on_update_js: (data: OnUpdateData) => void, options?: OnUpdateOptions | null): Promise<any>;
1991
+ on_update(on_update_js: (data: OnUpdateData) => void, options?: OnUpdateOptions | null): Promise<number>;
1813
1992
  /**
1814
1993
  * Unregister a previously registered [`View::on_delete`] callback.
1815
1994
  */
1816
- remove_delete(callback_id: number): Promise<any>;
1995
+ remove_delete(callback_id: number): Promise<void>;
1817
1996
  /**
1818
1997
  * Unregister a previously registered [`View::on_remove`] callback.
1819
1998
  *
@@ -1925,7 +2104,7 @@ export class VirtualDataSlice {
1925
2104
  export class VirtualServer {
1926
2105
  free(): void;
1927
2106
  [Symbol.dispose](): void;
1928
- handleRequest(bytes: Uint8Array): Promise<any>;
2107
+ handleRequest(bytes: Uint8Array): Promise<Uint8Array>;
1929
2108
  constructor(handler: VirtualServerHandler);
1930
2109
  }
1931
2110
 
@@ -2044,8 +2223,11 @@ export interface InitOutput {
2044
2223
  readonly perspectiveviewerelement_getThemes: (a: number) => number;
2045
2224
  readonly perspectiveviewerelement_getView: (a: number, b: number) => number;
2046
2225
  readonly perspectiveviewerelement_getViewConfig: (a: number, b: number) => number;
2226
+ readonly perspectiveviewerelement_invalidate: (a: number, b: number, c: number) => void;
2227
+ readonly perspectiveviewerelement_invokeCommand: (a: number, b: number, c: number, d: number, e: number) => void;
2047
2228
  readonly perspectiveviewerelement_load: (a: number, b: number, c: number) => void;
2048
2229
  readonly perspectiveviewerelement_new: (a: number) => number;
2230
+ readonly perspectiveviewerelement_queryCommands: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
2049
2231
  readonly perspectiveviewerelement_removePanel: (a: number, b: number, c: number) => number;
2050
2232
  readonly perspectiveviewerelement_reset: (a: number, b: number, c: number) => number;
2051
2233
  readonly perspectiveviewerelement_resetError: (a: number) => number;
@@ -2059,8 +2241,10 @@ export interface InitOutput {
2059
2241
  readonly perspectiveviewerelement_setActivePanel: (a: number, b: number, c: number) => number;
2060
2242
  readonly perspectiveviewerelement_setAutoPause: (a: number, b: number) => number;
2061
2243
  readonly perspectiveviewerelement_setAutoSize: (a: number, b: number) => void;
2244
+ readonly perspectiveviewerelement_setCommandSchema: (a: number, b: number, c: number, d: number) => void;
2062
2245
  readonly perspectiveviewerelement_setSelection: (a: number, b: number, c: number, d: number) => void;
2063
2246
  readonly perspectiveviewerelement_setThrottle: (a: number, b: number, c: number) => void;
2247
+ readonly perspectiveviewerelement_showCommandMenu: (a: number, b: number, c: number, d: number) => number;
2064
2248
  readonly perspectiveviewerelement_toggleColumnSettings: (a: number, b: number, c: number, d: number) => number;
2065
2249
  readonly perspectiveviewerelement_toggleConfig: (a: number, b: number) => number;
2066
2250
  readonly registerPlugin: (a: number, b: number) => void;
@@ -2173,22 +2357,21 @@ export interface InitOutput {
2173
2357
  readonly virtualdataslice_setStringCol: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
2174
2358
  readonly virtualserver_handleRequest: (a: number, b: number, c: number) => number;
2175
2359
  readonly virtualserver_new: (a: number, b: number) => void;
2176
- readonly __wasm_bindgen_func_elem_20596: (a: number, b: number) => void;
2177
- readonly __wasm_bindgen_func_elem_7550: (a: number, b: number) => void;
2178
- readonly __wasm_bindgen_func_elem_21211: (a: number, b: number) => void;
2179
- readonly __wasm_bindgen_func_elem_22623: (a: number, b: number) => void;
2180
- readonly __wasm_bindgen_func_elem_27298: (a: number, b: number) => void;
2181
- readonly __wasm_bindgen_func_elem_36104: (a: number, b: number, c: number, d: number) => void;
2182
- readonly __wasm_bindgen_func_elem_20619: (a: number, b: number, c: number) => void;
2183
- readonly __wasm_bindgen_func_elem_8627: (a: number, b: number, c: number) => void;
2184
- readonly __wasm_bindgen_func_elem_8628: (a: number, b: number, c: number) => void;
2185
- readonly __wasm_bindgen_func_elem_8629: (a: number, b: number, c: number) => void;
2186
- readonly __wasm_bindgen_func_elem_8625: (a: number, b: number, c: number) => void;
2187
- readonly __wasm_bindgen_func_elem_21215: (a: number, b: number, c: number) => void;
2188
- readonly __wasm_bindgen_func_elem_27300: (a: number, b: number, c: number) => void;
2189
- readonly __wasm_bindgen_func_elem_23270: (a: number, b: number) => number;
2190
- readonly __wasm_bindgen_func_elem_21214: (a: number, b: number) => void;
2191
- readonly __wasm_bindgen_func_elem_23271: (a: number, b: number) => void;
2360
+ readonly __wasm_bindgen_func_elem_7842: (a: number, b: number) => void;
2361
+ readonly __wasm_bindgen_func_elem_21462: (a: number, b: number) => void;
2362
+ readonly __wasm_bindgen_func_elem_22081: (a: number, b: number) => void;
2363
+ readonly __wasm_bindgen_func_elem_23473: (a: number, b: number) => void;
2364
+ readonly __wasm_bindgen_func_elem_28172: (a: number, b: number) => void;
2365
+ readonly __wasm_bindgen_func_elem_36995: (a: number, b: number, c: number, d: number) => void;
2366
+ readonly __wasm_bindgen_func_elem_8959: (a: number, b: number, c: number) => void;
2367
+ readonly __wasm_bindgen_func_elem_8960: (a: number, b: number, c: number) => void;
2368
+ readonly __wasm_bindgen_func_elem_8961: (a: number, b: number, c: number) => void;
2369
+ readonly __wasm_bindgen_func_elem_21486: (a: number, b: number, c: number) => void;
2370
+ readonly __wasm_bindgen_func_elem_22086: (a: number, b: number, c: number) => void;
2371
+ readonly __wasm_bindgen_func_elem_28174: (a: number, b: number, c: number) => void;
2372
+ readonly __wasm_bindgen_func_elem_24096: (a: number, b: number) => number;
2373
+ readonly __wasm_bindgen_func_elem_22085: (a: number, b: number) => void;
2374
+ readonly __wasm_bindgen_func_elem_24097: (a: number, b: number) => void;
2192
2375
  readonly __wbindgen_export: (a: number, b: number) => number;
2193
2376
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
2194
2377
  readonly __wbindgen_export3: (a: number) => void;