@perspective-dev/viewer 5.1.0 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/perspective-viewer.js +9 -9
- package/dist/cdn/perspective-viewer.js.map +4 -4
- package/dist/css/botanical.css +1 -1
- package/dist/css/dracula.css +1 -1
- package/dist/css/gruvbox-dark.css +1 -1
- package/dist/css/gruvbox.css +1 -1
- package/dist/css/icons.css +1 -1
- package/dist/css/intl/de.css +1 -1
- package/dist/css/intl/es.css +1 -1
- package/dist/css/intl/fr.css +1 -1
- package/dist/css/intl/ja.css +1 -1
- package/dist/css/intl/pt.css +1 -1
- package/dist/css/intl/zh.css +1 -1
- package/dist/css/intl.css +1 -1
- package/dist/css/monokai.css +1 -1
- package/dist/css/phosphor.css +1 -1
- package/dist/css/pro-dark.css +1 -1
- package/dist/css/pro.css +1 -1
- package/dist/css/solarized-dark.css +1 -1
- package/dist/css/solarized.css +1 -1
- package/dist/css/themes.css +1 -1
- package/dist/css/vaporwave.css +1 -1
- package/dist/docs/perspective-docs.json +1 -0
- package/dist/esm/column-format.d.ts +19 -28
- package/dist/esm/perspective-viewer.d.ts +3 -0
- package/dist/esm/perspective-viewer.inline.js +9 -9
- package/dist/esm/perspective-viewer.inline.js.map +4 -4
- package/dist/esm/perspective-viewer.js +9 -9
- package/dist/esm/perspective-viewer.js.map +4 -4
- package/dist/esm/plugin.d.ts +10 -0
- package/dist/esm/providers.d.ts +79 -0
- package/dist/esm/ts-rs/CompactDisplay.d.ts +5 -0
- package/dist/esm/ts-rs/CurrencyCode.d.ts +1 -0
- package/dist/esm/ts-rs/CurrencyDisplay.d.ts +1 -0
- package/dist/esm/ts-rs/CurrencyNumberFormatStyle.d.ts +8 -0
- package/dist/esm/ts-rs/CurrencySign.d.ts +1 -0
- package/dist/esm/ts-rs/CustomDatetimeFormat.d.ts +1 -0
- package/dist/esm/ts-rs/CustomDatetimeStyleConfig.d.ts +54 -0
- package/dist/esm/ts-rs/CustomNumberFormatConfig.d.ts +34 -0
- package/dist/esm/ts-rs/DatetimeColorMode.d.ts +1 -0
- package/dist/esm/ts-rs/DatetimeFormatType.d.ts +6 -0
- package/dist/esm/ts-rs/FormatMode.d.ts +1 -0
- package/dist/esm/ts-rs/FormatUnit.d.ts +1 -0
- package/dist/esm/ts-rs/Notation.d.ts +17 -0
- package/dist/esm/ts-rs/NumberFormatStyle.d.ts +18 -0
- package/dist/esm/ts-rs/PanelViewerConfig.d.ts +42 -2
- package/dist/esm/ts-rs/PluginStaticConfig.d.ts +35 -0
- package/dist/esm/ts-rs/RestoreOptions.d.ts +19 -0
- package/dist/esm/ts-rs/RoundingMode.d.ts +1 -0
- package/dist/esm/ts-rs/RoundingPriority.d.ts +1 -0
- package/dist/esm/ts-rs/SaveWorkspaceOptions.d.ts +10 -0
- package/dist/esm/ts-rs/SignDisplay.d.ts +1 -0
- package/dist/esm/ts-rs/SimpleDatetimeFormat.d.ts +1 -0
- package/dist/esm/ts-rs/SimpleDatetimeStyleConfig.d.ts +24 -0
- package/dist/esm/ts-rs/SplitRollupMode.d.ts +9 -0
- package/dist/esm/ts-rs/StringColorMode.d.ts +1 -0
- package/dist/esm/ts-rs/TrailingZeroDisplay.d.ts +1 -0
- package/dist/esm/ts-rs/Unit.d.ts +1 -0
- package/dist/esm/ts-rs/UnitDisplay.d.ts +1 -0
- package/dist/esm/ts-rs/UnitNumberFormatStyle.d.ts +6 -0
- package/dist/esm/ts-rs/UseGrouping.d.ts +1 -0
- package/dist/esm/ts-rs/ViewerConfig.d.ts +42 -2
- package/dist/esm/ts-rs/ViewerConfigInitial.d.ts +175 -0
- package/dist/esm/ts-rs/ViewerConfigUpdate.d.ts +63 -0
- package/dist/esm/ts-rs/WindowSpec.d.ts +3 -2
- package/dist/esm/ts-rs/WorkspaceConfig.d.ts +9 -1
- package/dist/esm/ts-rs/WorkspaceConfigUpdate.d.ts +20 -9
- package/dist/wasm/perspective-viewer.d.ts +157 -41
- package/dist/wasm/perspective-viewer.js +452 -151
- package/dist/wasm/perspective-viewer.wasm +0 -0
- package/dist/wasm/perspective-viewer.wasm.d.ts +22 -17
- package/package.json +2 -1
- package/src/css/_viewer_bundle.css +1 -0
- package/src/css/column-selector.css +8 -0
- package/src/css/column-settings-panel.css +9 -5
- package/src/css/column-style.css +209 -31
- package/src/css/config-selector.css +38 -3
- package/src/css/dom/select.css +2 -1
- package/src/css/form/code-editor.css +6 -7
- package/src/css/form/mirrored-textarea.css +81 -0
- package/src/css/viewer.css +328 -0
- package/src/rust/agent/client/mod.rs +19 -0
- package/src/rust/agent/client/protocol.rs +320 -0
- package/src/rust/agent/client/transport.rs +287 -0
- package/src/rust/agent/client/turn.rs +174 -0
- package/src/rust/agent/config.rs +159 -0
- package/src/rust/agent/docs.rs +293 -0
- package/src/rust/agent/markdown/block.rs +509 -0
- package/src/rust/agent/markdown/entity.rs +52 -0
- package/src/rust/agent/markdown/events.rs +71 -0
- package/src/rust/agent/markdown/inline.rs +497 -0
- package/src/rust/agent/markdown/mod.rs +466 -0
- package/src/rust/agent/mod.rs +23 -0
- package/src/rust/agent/preamble.md +16 -0
- package/src/rust/agent/runtime.rs +201 -0
- package/src/rust/agent/slot.rs +236 -0
- package/src/rust/agent/tools.rs +1141 -0
- package/src/rust/components/chat_panel.rs +289 -0
- package/src/rust/components/column_selector/active_column.rs +2 -2
- package/src/rust/components/column_selector/add_expression_button.rs +3 -3
- package/src/rust/components/column_selector/aggregate_selector.rs +2 -3
- package/src/rust/components/column_selector/config_selector.rs +84 -7
- package/src/rust/components/column_selector/expr_edit_button.rs +4 -10
- package/src/rust/components/column_selector/inactive_column.rs +2 -2
- package/src/rust/components/column_selector.rs +55 -4
- package/src/rust/components/column_settings_sidebar/style_tab/primitive_field.rs +293 -126
- package/src/rust/components/column_settings_sidebar/style_tab.rs +262 -225
- package/src/rust/components/column_settings_sidebar.rs +88 -69
- package/src/rust/components/containers/dragdrop_list.rs +37 -0
- package/src/rust/components/editable_header.rs +85 -144
- package/src/rust/components/expression_editor.rs +9 -16
- package/src/rust/components/form/code_editor.rs +29 -28
- package/src/rust/components/form/debug.rs +9 -5
- package/src/rust/components/form/mirrored_textarea.rs +165 -0
- package/src/rust/components/form/mod.rs +4 -1
- package/src/rust/components/form/multi_stop_gradient_selector.rs +476 -0
- package/src/rust/components/form/named_value_picker.rs +86 -0
- package/src/rust/components/form/palette_selector.rs +440 -0
- package/src/rust/components/main_panel/msg.rs +2 -2
- package/src/rust/components/main_panel/reconcile.rs +4 -4
- package/src/rust/components/mod.rs +2 -0
- package/src/rust/components/plugin_tab.rs +4 -28
- package/src/rust/components/settings_panel.rs +105 -22
- package/src/rust/components/viewer/msg.rs +46 -7
- package/src/rust/components/viewer/panels.rs +17 -20
- package/src/rust/components/viewer/render.rs +10 -3
- package/src/rust/components/viewer/settings.rs +163 -23
- package/src/rust/components/viewer/snapshots.rs +46 -21
- package/src/rust/components/viewer/wiring.rs +14 -25
- package/src/rust/components/viewer.rs +12 -8
- package/src/rust/components/window_editor.rs +75 -103
- package/src/rust/config/column_config_schema.rs +100 -41
- package/src/rust/config/css_scale.rs +882 -0
- package/src/rust/config/datetime_column_style/custom.rs +17 -0
- package/src/rust/config/datetime_column_style/simple.rs +10 -0
- package/src/rust/config/mod.rs +2 -0
- package/src/rust/config/number_string_format.rs +33 -0
- package/src/rust/config/options.rs +28 -0
- package/src/rust/config/plugin_static_config.rs +120 -5
- package/src/rust/config/viewer_config.rs +216 -3
- package/src/rust/config/workspace_config.rs +138 -10
- package/src/rust/custom_elements/viewer.rs +369 -119
- package/src/rust/custom_events.rs +43 -1
- package/src/rust/js/regular_layout.rs +3 -3
- package/src/rust/lib.rs +15 -0
- package/src/rust/presentation/column_locator.rs +19 -5
- package/src/rust/presentation.rs +200 -36
- package/src/rust/queries/column_locator.rs +74 -44
- package/src/rust/queries/get_viewer_config.rs +2 -1
- package/src/rust/queries/mod.rs +2 -0
- package/src/rust/queries/palette_set.rs +82 -0
- package/src/rust/queries/plugin_column_styles.rs +6 -2
- package/src/rust/renderer/dispatch.rs +16 -4
- package/src/rust/renderer/plugin_config.rs +309 -47
- package/src/rust/renderer.rs +15 -42
- package/src/rust/session/column_defaults_update.rs +32 -7
- package/src/rust/session/metadata.rs +23 -21
- package/src/rust/session/props.rs +1 -0
- package/src/rust/session/replace_expression_update.rs +1 -0
- package/src/rust/session.rs +9 -6
- package/src/rust/tasks/create_panel.rs +46 -49
- package/src/rust/tasks/edit_expression.rs +19 -23
- package/src/rust/tasks/edit_window.rs +9 -11
- package/src/rust/tasks/eject.rs +4 -1
- package/src/rust/tasks/pipeline.rs +2 -2
- package/src/rust/tasks/presize_panels.rs +44 -5
- package/src/rust/tasks/reset_all.rs +4 -4
- package/src/rust/tasks/restore_and_render.rs +17 -44
- package/src/rust/tasks/restore_panel.rs +37 -22
- package/src/rust/tasks/set_edit_mode.rs +3 -1
- package/src/rust/tasks/sync_update_panels.rs +18 -24
- package/src/rust/tasks/update_theme.rs +23 -18
- package/src/rust/utils/css_vars.rs +26 -0
- package/src/rust/utils/mod.rs +2 -0
- package/src/rust/utils/spawn.rs +1 -1
- package/src/rust/workspace.rs +454 -199
- package/src/svg/lock.svg +7 -0
- package/src/themes/botanical.css +10 -0
- package/src/themes/defaults.css +12 -0
- package/src/themes/dracula.css +17 -0
- package/src/themes/gruvbox-dark.css +20 -0
- package/src/themes/gruvbox.css +10 -0
- package/src/themes/icons.css +1 -0
- package/src/themes/intl/de.css +16 -0
- package/src/themes/intl/es.css +16 -0
- package/src/themes/intl/fr.css +16 -0
- package/src/themes/intl/ja.css +16 -0
- package/src/themes/intl/pt.css +16 -0
- package/src/themes/intl/zh.css +16 -0
- package/src/themes/intl.css +16 -0
- package/src/themes/monokai.css +22 -0
- package/src/themes/phosphor.css +5 -0
- package/src/themes/pro-dark.css +10 -0
- package/src/themes/solarized-dark.css +7 -0
- package/src/themes/solarized.css +7 -0
- package/src/themes/vaporwave.css +20 -0
- package/src/ts/column-format.ts +67 -46
- package/src/ts/perspective-viewer.ts +3 -0
- package/src/ts/plugin.ts +14 -0
- package/src/ts/providers.ts +96 -0
- package/src/ts/ts-rs/CompactDisplay.ts +3 -0
- package/src/ts/ts-rs/CurrencyCode.ts +3 -0
- package/src/ts/ts-rs/CurrencyDisplay.ts +3 -0
- package/src/ts/ts-rs/CurrencyNumberFormatStyle.ts +6 -0
- package/src/ts/ts-rs/CurrencySign.ts +3 -0
- package/src/ts/ts-rs/CustomDatetimeFormat.ts +3 -0
- package/src/ts/ts-rs/CustomDatetimeStyleConfig.ts +54 -0
- package/src/ts/ts-rs/CustomNumberFormatConfig.ts +25 -0
- package/src/ts/ts-rs/DatetimeColorMode.ts +3 -0
- package/src/ts/ts-rs/DatetimeFormatType.ts +8 -0
- package/src/ts/ts-rs/FormatMode.ts +3 -0
- package/src/ts/ts-rs/FormatUnit.ts +3 -0
- package/src/ts/ts-rs/Notation.ts +11 -0
- package/src/ts/ts-rs/NumberFormatStyle.ts +12 -0
- package/src/ts/ts-rs/PanelViewerConfig.ts +48 -2
- package/src/ts/ts-rs/PluginStaticConfig.ts +36 -1
- package/src/ts/ts-rs/RestoreOptions.ts +20 -0
- package/src/ts/ts-rs/RoundingMode.ts +3 -0
- package/src/ts/ts-rs/RoundingPriority.ts +3 -0
- package/src/ts/ts-rs/SaveWorkspaceOptions.ts +11 -0
- package/src/ts/ts-rs/SignDisplay.ts +3 -0
- package/src/ts/ts-rs/SimpleDatetimeFormat.ts +3 -0
- package/src/ts/ts-rs/SimpleDatetimeStyleConfig.ts +25 -0
- package/src/ts/ts-rs/SplitRollupMode.ts +11 -0
- package/src/ts/ts-rs/StringColorMode.ts +3 -0
- package/src/ts/ts-rs/TrailingZeroDisplay.ts +3 -0
- package/src/ts/ts-rs/Unit.ts +3 -0
- package/src/ts/ts-rs/UnitDisplay.ts +3 -0
- package/src/ts/ts-rs/UnitNumberFormatStyle.ts +5 -0
- package/src/ts/ts-rs/UseGrouping.ts +3 -0
- package/src/ts/ts-rs/ViewerConfig.ts +48 -2
- package/src/ts/ts-rs/ViewerConfigInitial.ts +164 -0
- package/src/ts/ts-rs/ViewerConfigUpdate.ts +72 -2
- package/src/ts/ts-rs/WindowSpec.ts +3 -2
- package/src/ts/ts-rs/WorkspaceConfig.ts +8 -2
- package/src/ts/ts-rs/WorkspaceConfigUpdate.ts +18 -9
- package/dist/esm/ts-rs/WindowAggregate.d.ts +0 -1
- package/src/rust/components/form/color_range_selector.rs +0 -137
- package/src/ts/ts-rs/WindowAggregate.ts +0 -3
- /package/dist/wasm/snippets/{perspective-viewer-8a8c7d5d696b43ae → perspective-viewer-39c3c3b28e3cbd48}/inline0.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-8a8c7d5d696b43ae → perspective-viewer-39c3c3b28e3cbd48}/inline1.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-8a8c7d5d696b43ae → perspective-viewer-39c3c3b28e3cbd48}/inline2.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-8a8c7d5d696b43ae → perspective-viewer-39c3c3b28e3cbd48}/inline3.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-8a8c7d5d696b43ae → perspective-viewer-39c3c3b28e3cbd48}/inline4.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-8a8c7d5d696b43ae → perspective-viewer-39c3c3b28e3cbd48}/inline5.js +0 -0
|
@@ -104,22 +104,35 @@ import type {
|
|
|
104
104
|
|
|
105
105
|
export type * from "../../src/ts/ts-rs/ViewerConfig.d.ts";
|
|
106
106
|
export type * from "../../src/ts/ts-rs/ViewerConfigUpdate.d.ts";
|
|
107
|
+
export type * from "../../src/ts/ts-rs/ViewerConfigInitial.d.ts";
|
|
107
108
|
export type * from "../../src/ts/ts-rs/PluginStaticConfig.d.ts";
|
|
108
109
|
export type * from "../../src/ts/ts-rs/WorkspaceConfig.d.ts";
|
|
109
110
|
export type * from "../../src/ts/ts-rs/WorkspaceConfigUpdate.d.ts";
|
|
110
111
|
export type * from "../../src/ts/ts-rs/ExportMethod.d.ts";
|
|
111
112
|
export type * from "../../src/ts/ts-rs/PanelOptions.d.ts";
|
|
113
|
+
export type * from "../../src/ts/ts-rs/RestoreOptions.d.ts";
|
|
114
|
+
export type * from "../../src/ts/ts-rs/SaveWorkspaceOptions.d.ts";
|
|
112
115
|
export type * from "../../src/ts/ts-rs/ClientOptions.d.ts";
|
|
113
116
|
export type * from "../../src/ts/ts-rs/ExportOptions.d.ts";
|
|
114
117
|
export type * from "../../src/ts/ts-rs/GetTableOptions.d.ts";
|
|
115
118
|
export type * from "../../src/ts/ts-rs/GetClientOptions.d.ts";
|
|
119
|
+
export type * from "../../src/ts/ts-rs/CustomNumberFormatConfig.d.ts";
|
|
120
|
+
export type * from "../../src/ts/ts-rs/NumberFormatStyle.d.ts";
|
|
121
|
+
export type * from "../../src/ts/ts-rs/Notation.d.ts";
|
|
122
|
+
export type * from "../../src/ts/ts-rs/DatetimeFormatType.d.ts";
|
|
123
|
+
export type * from "../../src/ts/ts-rs/StringColorMode.d.ts";
|
|
124
|
+
export type * from "../../src/ts/ts-rs/DatetimeColorMode.d.ts";
|
|
125
|
+
export type * from "../../src/ts/ts-rs/FormatMode.d.ts";
|
|
116
126
|
import type {GetTableOptions} from "../../src/ts/ts-rs/GetTableOptions.d.ts";
|
|
117
127
|
import type {PanelOptions} from "../../src/ts/ts-rs/PanelOptions.d.ts";
|
|
128
|
+
import type {RestoreOptions} from "../../src/ts/ts-rs/RestoreOptions.d.ts";
|
|
129
|
+
import type {SaveWorkspaceOptions} from "../../src/ts/ts-rs/SaveWorkspaceOptions.d.ts";
|
|
118
130
|
import type {ExportOptions} from "../../src/ts/ts-rs/ExportOptions.d.ts";
|
|
119
131
|
import type {GetClientOptions} from "../../src/ts/ts-rs/GetClientOptions.d.ts";
|
|
120
132
|
import type {ClientOptions} from "../../src/ts/ts-rs/ClientOptions.d.ts";
|
|
121
133
|
import type {ViewerConfig} from "../../src/ts/ts-rs/ViewerConfig.d.ts";
|
|
122
134
|
import type {ViewerConfigUpdate} from "../../src/ts/ts-rs/ViewerConfigUpdate.d.ts";
|
|
135
|
+
import type {ViewerConfigInitial} from "../../src/ts/ts-rs/ViewerConfigInitial.d.ts";
|
|
123
136
|
import type {WorkspaceConfig} from "../../src/ts/ts-rs/WorkspaceConfig.d.ts";
|
|
124
137
|
import type {WorkspaceConfigUpdate} from "../../src/ts/ts-rs/WorkspaceConfigUpdate.d.ts";
|
|
125
138
|
|
|
@@ -400,7 +413,7 @@ export class GenericSQLVirtualServerModel {
|
|
|
400
413
|
* Returns the SQL query to create a view from a table with the given
|
|
401
414
|
* configuration.
|
|
402
415
|
*/
|
|
403
|
-
tableMakeView(table_id: string, view_id: string, config: any): string;
|
|
416
|
+
tableMakeView(table_id: string, view_id: string, config: any, schema: any): string;
|
|
404
417
|
/**
|
|
405
418
|
* Returns the SQL query to describe a table's schema.
|
|
406
419
|
*/
|
|
@@ -529,14 +542,98 @@ export class PerspectiveViewerElement {
|
|
|
529
542
|
__get_model(): PerspectiveViewerElement;
|
|
530
543
|
/**
|
|
531
544
|
* Add a new, independent panel to this viewer's layout, rendering the
|
|
532
|
-
* supplied [`
|
|
533
|
-
*
|
|
534
|
-
*
|
|
545
|
+
* supplied [`ViewerConfigInitial`] into it. Unlike [`Self::restore`]'s
|
|
546
|
+
* update-shaped argument, a new panel has no prior state, so `table`
|
|
547
|
+
* is REQUIRED — a table-less call rejects before the layout is
|
|
548
|
+
* touched. The panel uses the default [`perspective_client::Client`]
|
|
549
|
+
* (the first passed to [`Self::load`]) to resolve its `table`. Returns
|
|
550
|
+
* the generated panel id.
|
|
551
|
+
*
|
|
552
|
+
* The element-level `settings` field does not exist on the argument
|
|
553
|
+
* type (it is shared across the element, not per-panel).
|
|
554
|
+
*/
|
|
555
|
+
addPanel(config: ViewerConfigInitial): Promise<any>;
|
|
556
|
+
/**
|
|
557
|
+
* Configure the embedded LLM agent (see `prompt()`), replacing any prior
|
|
558
|
+
* configuration and conversation.
|
|
559
|
+
*
|
|
560
|
+
* The agent core is provider-agnostic: one OpenAI-chat-completions
|
|
561
|
+
* protocol over primitive connection fields. Exactly one of
|
|
562
|
+
* `config.url` or `config.engine` is required; the `providers` presets
|
|
563
|
+
* exported by this package are plain spreadable collections of these
|
|
564
|
+
* fields (`{...providers.anthropic, apiKey}`).
|
|
565
|
+
*
|
|
566
|
+
* - `config.url` - a full chat-completions endpoint URL (any
|
|
567
|
+
* OpenAI-compatible service: Anthropic/Gemini compatibility endpoints,
|
|
568
|
+
* LM Studio, Ollama, OpenRouter, a proxy...).
|
|
569
|
+
* - `config.engine` - an in-page engine object with an OpenAI-compatible
|
|
570
|
+
* `chat.completions.create(request)` method (e.g. WebLLM's `MLCEngine`);
|
|
571
|
+
* mutually exclusive with `url`.
|
|
572
|
+
* - `config.headers` - extra request headers, sent verbatim.
|
|
573
|
+
* - `config.apiKey` - sugar for the `Authorization: Bearer` header.
|
|
574
|
+
* - `config.model` - model id sent with each request; local servers and
|
|
575
|
+
* engines generally answer with whatever model is loaded.
|
|
576
|
+
* - `config.name` - cosmetic label for the chat badge (presets set this).
|
|
577
|
+
* - `config.systemPrompt` - extra system-prompt context appended to the
|
|
578
|
+
* agent's built-in instructions.
|
|
579
|
+
* - `config.maxTurns` - max model turns (tool-call rounds + the final
|
|
580
|
+
* answer) per `prompt()` call. Defaults to 16.
|
|
581
|
+
* - `config.docs` - the agent metadata bundle, which supplies the
|
|
582
|
+
* `search_docs` corpus and the rich tool parameter schemas: the packaged
|
|
583
|
+
* `dist/docs/perspective-docs.json` asset as a parsed object (`import
|
|
584
|
+
* docs from "…json" with { type: "json" }`), a `fetch()` `Response`, an
|
|
585
|
+
* `ArrayBuffer`, a JSON string, or a `Promise` of any of those — and/or
|
|
586
|
+
* an inline array of `{title?, text}` entries for host data definitions.
|
|
587
|
+
* Omitted, `search_docs` searches an empty corpus and the parameter
|
|
588
|
+
* schemas degrade to permissive objects.
|
|
589
|
+
* - `config.systemRole` - where the preamble (plus `systemPrompt`) is
|
|
590
|
+
* placed: `"system"` (default) or `"user"`. Some engines refuse a system
|
|
591
|
+
* message alongside `tools` because they substitute their own — WebLLM's
|
|
592
|
+
* Hermes function calling throws `CustomSystemPromptError` on ANY system
|
|
593
|
+
* message — and those need `"user"`, which folds the same text into the
|
|
594
|
+
* opening user turn.
|
|
595
|
+
* - `config.entitlements` - access grants limiting which tools the agent
|
|
596
|
+
* is offered (and may call): any of `"read_view"`, `"configure_view"`,
|
|
597
|
+
* `"manage_layout"`, `"read_docs"`, `"read_data"`. Omitted, all but
|
|
598
|
+
* `"read_data"` are granted; `["read_view", "read_docs"]` yields a
|
|
599
|
+
* read-only agent.
|
|
535
600
|
*
|
|
536
|
-
*
|
|
537
|
-
*
|
|
601
|
+
* # JavaScript Examples
|
|
602
|
+
*
|
|
603
|
+
* ```javascript
|
|
604
|
+
* import { providers } from "@perspective-dev/viewer";
|
|
605
|
+
*
|
|
606
|
+
* viewer.agentConfig({
|
|
607
|
+
* ...providers.anthropic,
|
|
608
|
+
* apiKey: "sk-ant-...",
|
|
609
|
+
* docs: fetch(
|
|
610
|
+
* "node_modules/@perspective-dev/viewer/dist/docs/perspective-docs.json",
|
|
611
|
+
* ),
|
|
612
|
+
* });
|
|
613
|
+
* ```
|
|
614
|
+
*/
|
|
615
|
+
agentConfig(config: any): void;
|
|
616
|
+
/**
|
|
617
|
+
* Run one conversational turn of the embedded LLM agent (configured via
|
|
618
|
+
* `agentConfig()`), resolving with the agent's final text response after
|
|
619
|
+
* any tool calls have been applied to this element. Turns share a
|
|
620
|
+
* conversation history (and the chat sidebar's transcript) until
|
|
621
|
+
* `agentReset()`; a call made while a turn is already running rejects.
|
|
622
|
+
* Tool activity is emitted as `perspective-agent-tool` CustomEvents on
|
|
623
|
+
* this element.
|
|
624
|
+
*
|
|
625
|
+
* # JavaScript Examples
|
|
626
|
+
*
|
|
627
|
+
* ```javascript
|
|
628
|
+
* await viewer.agentPrompt("Show me sales by region as a bar chart");
|
|
629
|
+
* ```
|
|
630
|
+
*/
|
|
631
|
+
agentPrompt(prompt: string): Promise<any>;
|
|
632
|
+
/**
|
|
633
|
+
* Clear the agent's conversation (history and chat transcript), keeping
|
|
634
|
+
* its configuration. Cancels any in-flight turn.
|
|
538
635
|
*/
|
|
539
|
-
|
|
636
|
+
agentReset(): Promise<any>;
|
|
540
637
|
connectedCallback(): void;
|
|
541
638
|
/**
|
|
542
639
|
* Copy this viewer's `View` or `Table` data as CSV to the system
|
|
@@ -741,6 +838,7 @@ export class PerspectiveViewerElement {
|
|
|
741
838
|
* ```
|
|
742
839
|
*/
|
|
743
840
|
getTable(options?: GetTableOptions | null): Promise<any>;
|
|
841
|
+
getThemes(): Promise<any>;
|
|
744
842
|
/**
|
|
745
843
|
* Get the underlying [`View`] for this viewer.
|
|
746
844
|
*
|
|
@@ -862,9 +960,10 @@ export class PerspectiveViewerElement {
|
|
|
862
960
|
* Reset a panel's `ViewerConfig` to its data-relative default.
|
|
863
961
|
*
|
|
864
962
|
* Without a `panel`, this is ELEMENT-LEVEL: EVERY panel is reset and the
|
|
865
|
-
* cross-filter overlay cleared (symmetric with
|
|
866
|
-
* [`Self::
|
|
867
|
-
* reset — the other panels and the overlay are left
|
|
963
|
+
* cross-filter overlay cleared (symmetric with
|
|
964
|
+
* [`Self::saveWorkspace`] / [`Self::restoreWorkspace`]). With `{panel}`,
|
|
965
|
+
* only that panel is reset — the other panels and the overlay are left
|
|
966
|
+
* untouched.
|
|
868
967
|
*
|
|
869
968
|
* # Arguments
|
|
870
969
|
*
|
|
@@ -935,15 +1034,18 @@ export class PerspectiveViewerElement {
|
|
|
935
1034
|
* optional `{panel}` selector.
|
|
936
1035
|
*
|
|
937
1036
|
* If `panel` names no existing panel, a NEW panel is created with that id
|
|
938
|
-
* and the config restored into it (an upsert)
|
|
939
|
-
* [`Self::addPanel`]
|
|
940
|
-
*
|
|
1037
|
+
* and the config restored into it (an upsert). Creation REQUIRES a
|
|
1038
|
+
* `table` — the same rule [`Self::addPanel`] enforces in its argument
|
|
1039
|
+
* type — and a would-create call without one REJECTS before any state
|
|
1040
|
+
* (including `settings`) is applied: with no panel to target and no
|
|
1041
|
+
* `table`, the patch has no data arrival path. In particular, on an
|
|
1042
|
+
* element with zero panels every `restore` must carry a `table`.
|
|
941
1043
|
*
|
|
942
1044
|
* On an empty element with a pending [`Self::load`] whose payload is not
|
|
943
1045
|
* yet classified, the active-target form (no `panel`) instead claims and
|
|
944
1046
|
* restores into that load's reserved first panel — see [`Self::load`].
|
|
945
1047
|
*
|
|
946
|
-
* This restores a SINGLE panel; a
|
|
1048
|
+
* This restores a SINGLE panel; a workspace config (with a `panels`
|
|
947
1049
|
* map) must be applied via [`Self::restoreWorkspace`] — its `panels` /
|
|
948
1050
|
* `layout` keys are ignored here.
|
|
949
1051
|
*
|
|
@@ -956,7 +1058,15 @@ export class PerspectiveViewerElement {
|
|
|
956
1058
|
*
|
|
957
1059
|
* - `update` - The config to restore to, as returned by [`Self::save`] in
|
|
958
1060
|
* either "json", "string" or "arraybuffer" format.
|
|
959
|
-
* - `
|
|
1061
|
+
* - `options.panel` - The panel to target, or the active panel when
|
|
1062
|
+
* omitted.
|
|
1063
|
+
* - `options.suppress_errors` - when `true`, a failed restore only rejects
|
|
1064
|
+
* the returned `Promise`; the error is NOT committed to the viewer's
|
|
1065
|
+
* visible error state and the session remains usable. The view config is
|
|
1066
|
+
* rolled back to its pre-call value, so a rejected patch cannot re-merge
|
|
1067
|
+
* into a later restore. Element-level state the call already applied
|
|
1068
|
+
* (theme, title, a plugin swap) is NOT undone — restore a known-good
|
|
1069
|
+
* config to recover those exactly.
|
|
960
1070
|
*
|
|
961
1071
|
* # JavaScript Examples
|
|
962
1072
|
*
|
|
@@ -974,10 +1084,10 @@ export class PerspectiveViewerElement {
|
|
|
974
1084
|
* await viewer.restore({group_by: ["State"]});
|
|
975
1085
|
* ```
|
|
976
1086
|
*/
|
|
977
|
-
restore(update: ViewerConfigUpdate, options?:
|
|
1087
|
+
restore(update: ViewerConfigUpdate, options?: RestoreOptions | null): Promise<void>;
|
|
978
1088
|
/**
|
|
979
|
-
* Restore the ENTIRE element from a
|
|
980
|
-
*
|
|
1089
|
+
* Restore the ENTIRE element from a [`WorkspaceConfigUpdate`]
|
|
1090
|
+
* (`{version, active?, layout, panels, ...}`) —
|
|
981
1091
|
* the multi-panel counterpart of [`Self::restore`]. Every existing panel
|
|
982
1092
|
* is replaced by the `panels` entries, and the layout tree + master/detail
|
|
983
1093
|
* cross-filter state re-applied. Unlike [`Self::restore`], this never
|
|
@@ -1041,11 +1151,12 @@ export class PerspectiveViewerElement {
|
|
|
1041
1151
|
*/
|
|
1042
1152
|
save(options?: PanelOptions | null): Promise<ViewerConfig>;
|
|
1043
1153
|
/**
|
|
1044
|
-
* Save the ENTIRE element to a
|
|
1045
|
-
* (`{version, active?, layout, panels, ...}`) — the
|
|
1046
|
-
* counterpart of [`Self::save`]. Unlike [`Self::save`]
|
|
1047
|
-
* single `ViewerConfig` for one panel), this ALWAYS
|
|
1048
|
-
*
|
|
1154
|
+
* Save the ENTIRE element to a [`WorkspaceConfig`]
|
|
1155
|
+
* (`{version, active?, layout, panels, palette?, ...}`) — the
|
|
1156
|
+
* multi-panel counterpart of [`Self::save`]. Unlike [`Self::save`]
|
|
1157
|
+
* (which emits a single `ViewerConfig` for one panel), this ALWAYS
|
|
1158
|
+
* emits the workspace format, restorable via
|
|
1159
|
+
* [`Self::restoreWorkspace`].
|
|
1049
1160
|
*
|
|
1050
1161
|
* # JavaScript Examples
|
|
1051
1162
|
*
|
|
@@ -1054,7 +1165,7 @@ export class PerspectiveViewerElement {
|
|
|
1054
1165
|
* await viewer.restoreWorkspace(token);
|
|
1055
1166
|
* ```
|
|
1056
1167
|
*/
|
|
1057
|
-
saveWorkspace(): Promise<WorkspaceConfig>;
|
|
1168
|
+
saveWorkspace(options?: SaveWorkspaceOptions | null): Promise<WorkspaceConfig>;
|
|
1058
1169
|
/**
|
|
1059
1170
|
* Make the panel with id `name` the active panel, re-targeting the
|
|
1060
1171
|
* settings panel and status-bar toolbar (and the root's
|
|
@@ -1655,6 +1766,9 @@ export interface InitOutput {
|
|
|
1655
1766
|
readonly perspectivedebugpluginelement_update: (a: number, b: number) => number;
|
|
1656
1767
|
readonly perspectiveviewerelement___get_model: (a: number) => number;
|
|
1657
1768
|
readonly perspectiveviewerelement_addPanel: (a: number, b: number) => number;
|
|
1769
|
+
readonly perspectiveviewerelement_agentConfig: (a: number, b: number, c: number) => void;
|
|
1770
|
+
readonly perspectiveviewerelement_agentPrompt: (a: number, b: number, c: number) => number;
|
|
1771
|
+
readonly perspectiveviewerelement_agentReset: (a: number) => number;
|
|
1658
1772
|
readonly perspectiveviewerelement_connectedCallback: (a: number, b: number) => void;
|
|
1659
1773
|
readonly perspectiveviewerelement_copy: (a: number, b: number) => number;
|
|
1660
1774
|
readonly perspectiveviewerelement_delete: (a: number) => number;
|
|
@@ -1671,6 +1785,7 @@ export interface InitOutput {
|
|
|
1671
1785
|
readonly perspectiveviewerelement_getRenderStats: (a: number, b: number, c: number) => void;
|
|
1672
1786
|
readonly perspectiveviewerelement_getSelection: (a: number, b: number, c: number) => void;
|
|
1673
1787
|
readonly perspectiveviewerelement_getTable: (a: number, b: number) => number;
|
|
1788
|
+
readonly perspectiveviewerelement_getThemes: (a: number) => number;
|
|
1674
1789
|
readonly perspectiveviewerelement_getView: (a: number, b: number) => number;
|
|
1675
1790
|
readonly perspectiveviewerelement_getViewConfig: (a: number, b: number) => number;
|
|
1676
1791
|
readonly perspectiveviewerelement_load: (a: number, b: number, c: number) => void;
|
|
@@ -1684,7 +1799,7 @@ export interface InitOutput {
|
|
|
1684
1799
|
readonly perspectiveviewerelement_restoreWorkspace: (a: number, b: number) => number;
|
|
1685
1800
|
readonly perspectiveviewerelement_restyleElement: (a: number) => number;
|
|
1686
1801
|
readonly perspectiveviewerelement_save: (a: number, b: number) => number;
|
|
1687
|
-
readonly perspectiveviewerelement_saveWorkspace: (a: number) => number;
|
|
1802
|
+
readonly perspectiveviewerelement_saveWorkspace: (a: number, b: number) => number;
|
|
1688
1803
|
readonly perspectiveviewerelement_setActivePanel: (a: number, b: number, c: number) => number;
|
|
1689
1804
|
readonly perspectiveviewerelement_setAutoPause: (a: number, b: number) => number;
|
|
1690
1805
|
readonly perspectiveviewerelement_setAutoSize: (a: number, b: number) => void;
|
|
@@ -1724,7 +1839,7 @@ export interface InitOutput {
|
|
|
1724
1839
|
readonly client_terminate: (a: number, b: number) => void;
|
|
1725
1840
|
readonly genericsqlvirtualservermodel_getHostedTables: (a: number, b: number) => void;
|
|
1726
1841
|
readonly genericsqlvirtualservermodel_new: (a: number, b: number) => void;
|
|
1727
|
-
readonly genericsqlvirtualservermodel_tableMakeView: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
1842
|
+
readonly genericsqlvirtualservermodel_tableMakeView: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
1728
1843
|
readonly genericsqlvirtualservermodel_tableSchema: (a: number, b: number, c: number, d: number) => void;
|
|
1729
1844
|
readonly genericsqlvirtualservermodel_tableSize: (a: number, b: number, c: number, d: number) => void;
|
|
1730
1845
|
readonly genericsqlvirtualservermodel_tableValidateExpression: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
@@ -1791,21 +1906,22 @@ export interface InitOutput {
|
|
|
1791
1906
|
readonly virtualdataslice_setStringCol: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
1792
1907
|
readonly virtualserver_handleRequest: (a: number, b: number, c: number) => number;
|
|
1793
1908
|
readonly virtualserver_new: (a: number, b: number) => void;
|
|
1794
|
-
readonly
|
|
1795
|
-
readonly
|
|
1796
|
-
readonly
|
|
1797
|
-
readonly
|
|
1798
|
-
readonly
|
|
1799
|
-
readonly
|
|
1800
|
-
readonly
|
|
1801
|
-
readonly
|
|
1802
|
-
readonly
|
|
1803
|
-
readonly
|
|
1804
|
-
readonly
|
|
1805
|
-
readonly
|
|
1806
|
-
readonly
|
|
1807
|
-
readonly
|
|
1808
|
-
readonly
|
|
1909
|
+
readonly __wasm_bindgen_func_elem_17916: (a: number, b: number) => void;
|
|
1910
|
+
readonly __wasm_bindgen_func_elem_18625: (a: number, b: number) => void;
|
|
1911
|
+
readonly __wasm_bindgen_func_elem_19491: (a: number, b: number) => void;
|
|
1912
|
+
readonly __wasm_bindgen_func_elem_4310: (a: number, b: number) => void;
|
|
1913
|
+
readonly __wasm_bindgen_func_elem_24164: (a: number, b: number) => void;
|
|
1914
|
+
readonly __wasm_bindgen_func_elem_32290: (a: number, b: number, c: number, d: number) => void;
|
|
1915
|
+
readonly __wasm_bindgen_func_elem_18035: (a: number, b: number, c: number) => void;
|
|
1916
|
+
readonly __wasm_bindgen_func_elem_18630: (a: number, b: number, c: number) => void;
|
|
1917
|
+
readonly __wasm_bindgen_func_elem_7520: (a: number, b: number, c: number) => void;
|
|
1918
|
+
readonly __wasm_bindgen_func_elem_7521: (a: number, b: number, c: number) => void;
|
|
1919
|
+
readonly __wasm_bindgen_func_elem_7522: (a: number, b: number, c: number) => void;
|
|
1920
|
+
readonly __wasm_bindgen_func_elem_7518: (a: number, b: number, c: number) => void;
|
|
1921
|
+
readonly __wasm_bindgen_func_elem_24181: (a: number, b: number, c: number) => void;
|
|
1922
|
+
readonly __wasm_bindgen_func_elem_20501: (a: number, b: number) => number;
|
|
1923
|
+
readonly __wasm_bindgen_func_elem_18629: (a: number, b: number) => void;
|
|
1924
|
+
readonly __wasm_bindgen_func_elem_20502: (a: number, b: number) => void;
|
|
1809
1925
|
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
1810
1926
|
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
1811
1927
|
readonly __wbindgen_export3: (a: number) => void;
|