@perspective-dev/viewer 5.0.0 → 5.2.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 +2 -0
- package/dist/esm/perspective-viewer.inline.js +8 -8
- 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/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 +43 -1
- 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/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 +43 -1
- package/dist/esm/ts-rs/ViewerConfigInitial.d.ts +175 -0
- package/dist/esm/ts-rs/ViewerConfigUpdate.d.ts +72 -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 +47 -0
- package/dist/esm/ts-rs/Windows.d.ts +10 -0
- package/dist/esm/ts-rs/WorkspaceConfigUpdate.d.ts +7 -6
- package/dist/wasm/perspective-viewer.d.ts +222 -26
- package/dist/wasm/perspective-viewer.js +378 -125
- package/dist/wasm/perspective-viewer.wasm +0 -0
- package/dist/wasm/perspective-viewer.wasm.d.ts +18 -15
- package/package.json +2 -1
- package/src/css/_viewer_bundle.css +1 -0
- package/src/css/column-selector.css +9 -0
- package/src/css/column-settings-panel.css +67 -2
- package/src/css/column-style.css +4 -3
- package/src/css/config-selector.css +60 -4
- package/src/css/containers/context-menu.css +12 -6
- package/src/css/containers/tabs.css +2 -2
- package/src/css/form/code-editor.css +2 -3
- package/src/css/form/mirrored-textarea.css +81 -0
- package/src/css/viewer.css +336 -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 +1110 -0
- package/src/rust/components/chat_panel.rs +289 -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 +83 -8
- 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 +27 -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 +110 -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/form/code_editor.rs +14 -23
- package/src/rust/components/form/debug.rs +8 -5
- package/src/rust/components/form/mirrored_textarea.rs +165 -0
- package/src/rust/components/form/mod.rs +1 -0
- package/src/rust/components/main_panel.rs +5 -0
- package/src/rust/components/mod.rs +3 -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/settings_panel.rs +80 -2
- package/src/rust/components/viewer/msg.rs +2 -0
- package/src/rust/components/viewer/panels.rs +9 -14
- package/src/rust/components/viewer/render.rs +14 -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 +985 -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/number_string_format.rs +33 -0
- package/src/rust/config/options.rs +18 -0
- package/src/rust/config/plugin_static_config.rs +120 -5
- package/src/rust/config/viewer_config.rs +220 -1
- package/src/rust/config/workspace_config.rs +7 -6
- package/src/rust/custom_elements/viewer.rs +209 -18
- package/src/rust/custom_events.rs +29 -0
- package/src/rust/lib.rs +17 -1
- package/src/rust/presentation/column_locator.rs +16 -1
- package/src/rust/presentation.rs +8 -0
- package/src/rust/queries/columns_iter_set.rs +7 -1
- package/src/rust/queries/get_viewer_config.rs +5 -1
- package/src/rust/renderer/dispatch.rs +85 -58
- package/src/rust/renderer.rs +34 -1
- package/src/rust/session/column_defaults_update.rs +18 -0
- package/src/rust/session/drag_drop_update.rs +18 -0
- package/src/rust/session/metadata.rs +64 -9
- package/src/rust/session/replace_expression_update.rs +2 -0
- package/src/rust/session.rs +7 -5
- package/src/rust/tasks/create_panel.rs +18 -8
- package/src/rust/tasks/edit_window.rs +155 -0
- package/src/rust/tasks/mod.rs +2 -0
- package/src/rust/tasks/restore_panel.rs +34 -17
- package/src/rust/tasks/sync_update_panels.rs +7 -23
- 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/rust/workspace.rs +112 -20
- package/src/svg/pin-icon.svg +5 -0
- package/src/themes/icons.css +1 -0
- package/src/themes/intl/de.css +23 -0
- package/src/themes/intl/es.css +23 -0
- package/src/themes/intl/fr.css +23 -0
- package/src/themes/intl/ja.css +23 -0
- package/src/themes/intl/pt.css +23 -0
- package/src/themes/intl/zh.css +23 -0
- package/src/themes/intl.css +26 -1
- package/src/ts/column-format.ts +67 -46
- package/src/ts/perspective-viewer.ts +2 -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 -1
- 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/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 -1
- package/src/ts/ts-rs/ViewerConfigInitial.ts +164 -0
- package/src/ts/ts-rs/ViewerConfigUpdate.ts +81 -2
- 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 +47 -0
- package/src/ts/ts-rs/Windows.ts +10 -0
- package/src/ts/ts-rs/WorkspaceConfigUpdate.ts +7 -6
- /package/dist/wasm/snippets/{perspective-viewer-daeef4ceb066e6c7 → perspective-viewer-02e461f3d7062b26}/inline0.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-daeef4ceb066e6c7 → perspective-viewer-02e461f3d7062b26}/inline1.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-daeef4ceb066e6c7 → perspective-viewer-02e461f3d7062b26}/inline2.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-daeef4ceb066e6c7 → perspective-viewer-02e461f3d7062b26}/inline3.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-daeef4ceb066e6c7 → perspective-viewer-02e461f3d7062b26}/inline4.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-daeef4ceb066e6c7 → perspective-viewer-02e461f3d7062b26}/inline5.js +0 -0
|
@@ -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,28 +95,42 @@ 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";
|
|
19
106
|
export type * from "../../src/ts/ts-rs/ViewerConfigUpdate.d.ts";
|
|
107
|
+
export type * from "../../src/ts/ts-rs/ViewerConfigInitial.d.ts";
|
|
20
108
|
export type * from "../../src/ts/ts-rs/PluginStaticConfig.d.ts";
|
|
21
109
|
export type * from "../../src/ts/ts-rs/WorkspaceConfig.d.ts";
|
|
22
110
|
export type * from "../../src/ts/ts-rs/WorkspaceConfigUpdate.d.ts";
|
|
23
111
|
export type * from "../../src/ts/ts-rs/ExportMethod.d.ts";
|
|
24
112
|
export type * from "../../src/ts/ts-rs/PanelOptions.d.ts";
|
|
113
|
+
export type * from "../../src/ts/ts-rs/RestoreOptions.d.ts";
|
|
25
114
|
export type * from "../../src/ts/ts-rs/ClientOptions.d.ts";
|
|
26
115
|
export type * from "../../src/ts/ts-rs/ExportOptions.d.ts";
|
|
27
116
|
export type * from "../../src/ts/ts-rs/GetTableOptions.d.ts";
|
|
28
117
|
export type * from "../../src/ts/ts-rs/GetClientOptions.d.ts";
|
|
118
|
+
export type * from "../../src/ts/ts-rs/CustomNumberFormatConfig.d.ts";
|
|
119
|
+
export type * from "../../src/ts/ts-rs/NumberFormatStyle.d.ts";
|
|
120
|
+
export type * from "../../src/ts/ts-rs/Notation.d.ts";
|
|
121
|
+
export type * from "../../src/ts/ts-rs/DatetimeFormatType.d.ts";
|
|
122
|
+
export type * from "../../src/ts/ts-rs/StringColorMode.d.ts";
|
|
123
|
+
export type * from "../../src/ts/ts-rs/DatetimeColorMode.d.ts";
|
|
124
|
+
export type * from "../../src/ts/ts-rs/FormatMode.d.ts";
|
|
29
125
|
import type {GetTableOptions} from "../../src/ts/ts-rs/GetTableOptions.d.ts";
|
|
30
126
|
import type {PanelOptions} from "../../src/ts/ts-rs/PanelOptions.d.ts";
|
|
127
|
+
import type {RestoreOptions} from "../../src/ts/ts-rs/RestoreOptions.d.ts";
|
|
31
128
|
import type {ExportOptions} from "../../src/ts/ts-rs/ExportOptions.d.ts";
|
|
32
129
|
import type {GetClientOptions} from "../../src/ts/ts-rs/GetClientOptions.d.ts";
|
|
33
130
|
import type {ClientOptions} from "../../src/ts/ts-rs/ClientOptions.d.ts";
|
|
34
131
|
import type {ViewerConfig} from "../../src/ts/ts-rs/ViewerConfig.d.ts";
|
|
35
132
|
import type {ViewerConfigUpdate} from "../../src/ts/ts-rs/ViewerConfigUpdate.d.ts";
|
|
133
|
+
import type {ViewerConfigInitial} from "../../src/ts/ts-rs/ViewerConfigInitial.d.ts";
|
|
36
134
|
import type {WorkspaceConfig} from "../../src/ts/ts-rs/WorkspaceConfig.d.ts";
|
|
37
135
|
import type {WorkspaceConfigUpdate} from "../../src/ts/ts-rs/WorkspaceConfigUpdate.d.ts";
|
|
38
136
|
|
|
@@ -442,14 +540,98 @@ export class PerspectiveViewerElement {
|
|
|
442
540
|
__get_model(): PerspectiveViewerElement;
|
|
443
541
|
/**
|
|
444
542
|
* Add a new, independent panel to this viewer's layout, rendering the
|
|
445
|
-
* supplied [`
|
|
446
|
-
*
|
|
447
|
-
*
|
|
543
|
+
* supplied [`ViewerConfigInitial`] into it. Unlike [`Self::restore`]'s
|
|
544
|
+
* update-shaped argument, a new panel has no prior state, so `table`
|
|
545
|
+
* is REQUIRED — a table-less call rejects before the layout is
|
|
546
|
+
* touched. The panel uses the default [`perspective_client::Client`]
|
|
547
|
+
* (the first passed to [`Self::load`]) to resolve its `table`. Returns
|
|
548
|
+
* the generated panel id.
|
|
549
|
+
*
|
|
550
|
+
* The element-level `settings` field does not exist on the argument
|
|
551
|
+
* type (it is shared across the element, not per-panel).
|
|
552
|
+
*/
|
|
553
|
+
addPanel(config: ViewerConfigInitial): Promise<any>;
|
|
554
|
+
/**
|
|
555
|
+
* Configure the embedded LLM agent (see `prompt()`), replacing any prior
|
|
556
|
+
* configuration and conversation.
|
|
557
|
+
*
|
|
558
|
+
* The agent core is provider-agnostic: one OpenAI-chat-completions
|
|
559
|
+
* protocol over primitive connection fields. Exactly one of
|
|
560
|
+
* `config.url` or `config.engine` is required; the `providers` presets
|
|
561
|
+
* exported by this package are plain spreadable collections of these
|
|
562
|
+
* fields (`{...providers.anthropic, apiKey}`).
|
|
563
|
+
*
|
|
564
|
+
* - `config.url` - a full chat-completions endpoint URL (any
|
|
565
|
+
* OpenAI-compatible service: Anthropic/Gemini compatibility endpoints,
|
|
566
|
+
* LM Studio, Ollama, OpenRouter, a proxy...).
|
|
567
|
+
* - `config.engine` - an in-page engine object with an OpenAI-compatible
|
|
568
|
+
* `chat.completions.create(request)` method (e.g. WebLLM's `MLCEngine`);
|
|
569
|
+
* mutually exclusive with `url`.
|
|
570
|
+
* - `config.headers` - extra request headers, sent verbatim.
|
|
571
|
+
* - `config.apiKey` - sugar for the `Authorization: Bearer` header.
|
|
572
|
+
* - `config.model` - model id sent with each request; local servers and
|
|
573
|
+
* engines generally answer with whatever model is loaded.
|
|
574
|
+
* - `config.name` - cosmetic label for the chat badge (presets set this).
|
|
575
|
+
* - `config.systemPrompt` - extra system-prompt context appended to the
|
|
576
|
+
* agent's built-in instructions.
|
|
577
|
+
* - `config.maxTurns` - max model turns (tool-call rounds + the final
|
|
578
|
+
* answer) per `prompt()` call. Defaults to 16.
|
|
579
|
+
* - `config.docs` - the agent metadata bundle, which supplies the
|
|
580
|
+
* `search_docs` corpus and the rich tool parameter schemas: the packaged
|
|
581
|
+
* `dist/docs/perspective-docs.json` asset as a parsed object (`import
|
|
582
|
+
* docs from "…json" with { type: "json" }`), a `fetch()` `Response`, an
|
|
583
|
+
* `ArrayBuffer`, a JSON string, or a `Promise` of any of those — and/or
|
|
584
|
+
* an inline array of `{title?, text}` entries for host data definitions.
|
|
585
|
+
* Omitted, `search_docs` searches an empty corpus and the parameter
|
|
586
|
+
* schemas degrade to permissive objects.
|
|
587
|
+
* - `config.systemRole` - where the preamble (plus `systemPrompt`) is
|
|
588
|
+
* placed: `"system"` (default) or `"user"`. Some engines refuse a system
|
|
589
|
+
* message alongside `tools` because they substitute their own — WebLLM's
|
|
590
|
+
* Hermes function calling throws `CustomSystemPromptError` on ANY system
|
|
591
|
+
* message — and those need `"user"`, which folds the same text into the
|
|
592
|
+
* opening user turn.
|
|
593
|
+
* - `config.entitlements` - access grants limiting which tools the agent
|
|
594
|
+
* is offered (and may call): any of `"read_view"`, `"configure_view"`,
|
|
595
|
+
* `"manage_layout"`, `"read_docs"`, `"read_data"`. Omitted, all but
|
|
596
|
+
* `"read_data"` are granted; `["read_view", "read_docs"]` yields a
|
|
597
|
+
* read-only agent.
|
|
598
|
+
*
|
|
599
|
+
* # JavaScript Examples
|
|
448
600
|
*
|
|
449
|
-
*
|
|
450
|
-
*
|
|
601
|
+
* ```javascript
|
|
602
|
+
* import { providers } from "@perspective-dev/viewer";
|
|
603
|
+
*
|
|
604
|
+
* viewer.agentConfig({
|
|
605
|
+
* ...providers.anthropic,
|
|
606
|
+
* apiKey: "sk-ant-...",
|
|
607
|
+
* docs: fetch(
|
|
608
|
+
* "node_modules/@perspective-dev/viewer/dist/docs/perspective-docs.json",
|
|
609
|
+
* ),
|
|
610
|
+
* });
|
|
611
|
+
* ```
|
|
612
|
+
*/
|
|
613
|
+
agentConfig(config: any): void;
|
|
614
|
+
/**
|
|
615
|
+
* Run one conversational turn of the embedded LLM agent (configured via
|
|
616
|
+
* `agentConfig()`), resolving with the agent's final text response after
|
|
617
|
+
* any tool calls have been applied to this element. Turns share a
|
|
618
|
+
* conversation history (and the chat sidebar's transcript) until
|
|
619
|
+
* `agentReset()`; a call made while a turn is already running rejects.
|
|
620
|
+
* Tool activity is emitted as `perspective-agent-tool` CustomEvents on
|
|
621
|
+
* this element.
|
|
622
|
+
*
|
|
623
|
+
* # JavaScript Examples
|
|
624
|
+
*
|
|
625
|
+
* ```javascript
|
|
626
|
+
* await viewer.agentPrompt("Show me sales by region as a bar chart");
|
|
627
|
+
* ```
|
|
628
|
+
*/
|
|
629
|
+
agentPrompt(prompt: string): Promise<any>;
|
|
630
|
+
/**
|
|
631
|
+
* Clear the agent's conversation (history and chat transcript), keeping
|
|
632
|
+
* its configuration. Cancels any in-flight turn.
|
|
451
633
|
*/
|
|
452
|
-
|
|
634
|
+
agentReset(): Promise<any>;
|
|
453
635
|
connectedCallback(): void;
|
|
454
636
|
/**
|
|
455
637
|
* Copy this viewer's `View` or `Table` data as CSV to the system
|
|
@@ -848,9 +1030,12 @@ export class PerspectiveViewerElement {
|
|
|
848
1030
|
* optional `{panel}` selector.
|
|
849
1031
|
*
|
|
850
1032
|
* If `panel` names no existing panel, a NEW panel is created with that id
|
|
851
|
-
* and the config restored into it (an upsert)
|
|
852
|
-
* [`Self::addPanel`] but with a caller-chosen id. As with a created panel,
|
|
1033
|
+
* and the config restored into it (an upsert). As with a created panel,
|
|
853
1034
|
* the element-level `settings`/`theme` fields are ignored in that case.
|
|
1035
|
+
* Unlike [`Self::addPanel`], the argument is a PATCH, so a `table` is
|
|
1036
|
+
* optional: creating without one yields a DEFERRED panel that the next
|
|
1037
|
+
* [`Self::load`] binds. Such a panel renders but cannot be serialized —
|
|
1038
|
+
* [`Self::save`] rejects with "Panel has no `table`" until it is bound.
|
|
854
1039
|
*
|
|
855
1040
|
* On an empty element with a pending [`Self::load`] whose payload is not
|
|
856
1041
|
* yet classified, the active-target form (no `panel`) instead claims and
|
|
@@ -869,7 +1054,15 @@ export class PerspectiveViewerElement {
|
|
|
869
1054
|
*
|
|
870
1055
|
* - `update` - The config to restore to, as returned by [`Self::save`] in
|
|
871
1056
|
* either "json", "string" or "arraybuffer" format.
|
|
872
|
-
* - `
|
|
1057
|
+
* - `options.panel` - The panel to target, or the active panel when
|
|
1058
|
+
* omitted.
|
|
1059
|
+
* - `options.suppress_errors` - when `true`, a failed restore only rejects
|
|
1060
|
+
* the returned `Promise`; the error is NOT committed to the viewer's
|
|
1061
|
+
* visible error state and the session remains usable. The view config is
|
|
1062
|
+
* rolled back to its pre-call value, so a rejected patch cannot re-merge
|
|
1063
|
+
* into a later restore. Element-level state the call already applied
|
|
1064
|
+
* (theme, title, a plugin swap) is NOT undone — restore a known-good
|
|
1065
|
+
* config to recover those exactly.
|
|
873
1066
|
*
|
|
874
1067
|
* # JavaScript Examples
|
|
875
1068
|
*
|
|
@@ -887,7 +1080,7 @@ export class PerspectiveViewerElement {
|
|
|
887
1080
|
* await viewer.restore({group_by: ["State"]});
|
|
888
1081
|
* ```
|
|
889
1082
|
*/
|
|
890
|
-
restore(update: ViewerConfigUpdate, options?:
|
|
1083
|
+
restore(update: ViewerConfigUpdate, options?: RestoreOptions | null): Promise<void>;
|
|
891
1084
|
/**
|
|
892
1085
|
* Restore the ENTIRE element from a whole-element
|
|
893
1086
|
* [`WorkspaceConfigUpdate`] (`{version, active?, layout, panels, ...}`) —
|
|
@@ -1516,7 +1709,7 @@ export class VirtualServer {
|
|
|
1516
1709
|
free(): void;
|
|
1517
1710
|
[Symbol.dispose](): void;
|
|
1518
1711
|
handleRequest(bytes: Uint8Array): Promise<any>;
|
|
1519
|
-
constructor(handler:
|
|
1712
|
+
constructor(handler: VirtualServerHandler);
|
|
1520
1713
|
}
|
|
1521
1714
|
|
|
1522
1715
|
export function get_wasm_module(): WebAssembly.Module;
|
|
@@ -1568,6 +1761,9 @@ export interface InitOutput {
|
|
|
1568
1761
|
readonly perspectivedebugpluginelement_update: (a: number, b: number) => number;
|
|
1569
1762
|
readonly perspectiveviewerelement___get_model: (a: number) => number;
|
|
1570
1763
|
readonly perspectiveviewerelement_addPanel: (a: number, b: number) => number;
|
|
1764
|
+
readonly perspectiveviewerelement_agentConfig: (a: number, b: number, c: number) => void;
|
|
1765
|
+
readonly perspectiveviewerelement_agentPrompt: (a: number, b: number, c: number) => number;
|
|
1766
|
+
readonly perspectiveviewerelement_agentReset: (a: number) => number;
|
|
1571
1767
|
readonly perspectiveviewerelement_connectedCallback: (a: number, b: number) => void;
|
|
1572
1768
|
readonly perspectiveviewerelement_copy: (a: number, b: number) => number;
|
|
1573
1769
|
readonly perspectiveviewerelement_delete: (a: number) => number;
|
|
@@ -1704,21 +1900,21 @@ export interface InitOutput {
|
|
|
1704
1900
|
readonly virtualdataslice_setStringCol: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
1705
1901
|
readonly virtualserver_handleRequest: (a: number, b: number, c: number) => number;
|
|
1706
1902
|
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
|
|
1903
|
+
readonly __wasm_bindgen_func_elem_17003: (a: number, b: number) => void;
|
|
1904
|
+
readonly __wasm_bindgen_func_elem_17713: (a: number, b: number) => void;
|
|
1905
|
+
readonly __wasm_bindgen_func_elem_18571: (a: number, b: number) => void;
|
|
1906
|
+
readonly __wasm_bindgen_func_elem_3989: (a: number, b: number) => void;
|
|
1907
|
+
readonly __wasm_bindgen_func_elem_23208: (a: number, b: number) => void;
|
|
1908
|
+
readonly __wasm_bindgen_func_elem_31328: (a: number, b: number, c: number, d: number) => void;
|
|
1909
|
+
readonly __wasm_bindgen_func_elem_17122: (a: number, b: number, c: number) => void;
|
|
1910
|
+
readonly __wasm_bindgen_func_elem_17718: (a: number, b: number, c: number) => void;
|
|
1911
|
+
readonly __wasm_bindgen_func_elem_6981: (a: number, b: number, c: number) => void;
|
|
1912
|
+
readonly __wasm_bindgen_func_elem_6982: (a: number, b: number, c: number) => void;
|
|
1913
|
+
readonly __wasm_bindgen_func_elem_6983: (a: number, b: number, c: number) => void;
|
|
1914
|
+
readonly __wasm_bindgen_func_elem_6979: (a: number, b: number, c: number) => void;
|
|
1915
|
+
readonly __wasm_bindgen_func_elem_23225: (a: number, b: number, c: number) => void;
|
|
1916
|
+
readonly __wasm_bindgen_func_elem_19569: (a: number, b: number) => number;
|
|
1917
|
+
readonly __wasm_bindgen_func_elem_17717: (a: number, b: number) => void;
|
|
1722
1918
|
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
1723
1919
|
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
1724
1920
|
readonly __wbindgen_export3: (a: number) => void;
|