@perspective-dev/viewer 5.1.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/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 +41 -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 +41 -1
- 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/WorkspaceConfigUpdate.d.ts +7 -6
- package/dist/wasm/perspective-viewer.d.ts +134 -25
- package/dist/wasm/perspective-viewer.js +367 -124
- 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 +8 -0
- package/src/css/config-selector.css +38 -3
- package/src/css/form/code-editor.css +2 -3
- 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 +1110 -0
- package/src/rust/components/chat_panel.rs +289 -0
- package/src/rust/components/column_selector/config_selector.rs +76 -7
- package/src/rust/components/column_selector.rs +7 -0
- package/src/rust/components/containers/dragdrop_list.rs +37 -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/mod.rs +2 -0
- package/src/rust/components/settings_panel.rs +80 -2
- package/src/rust/components/viewer/panels.rs +9 -14
- package/src/rust/components/viewer/render.rs +2 -0
- package/src/rust/components/window_editor.rs +75 -103
- 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 +13 -0
- package/src/rust/presentation.rs +8 -0
- package/src/rust/queries/get_viewer_config.rs +5 -1
- package/src/rust/session/column_defaults_update.rs +18 -0
- package/src/rust/session/metadata.rs +18 -20
- package/src/rust/session/replace_expression_update.rs +1 -0
- package/src/rust/tasks/create_panel.rs +18 -8
- package/src/rust/tasks/edit_window.rs +1 -1
- package/src/rust/tasks/restore_panel.rs +34 -17
- package/src/rust/tasks/sync_update_panels.rs +7 -23
- package/src/rust/workspace.rs +112 -20
- 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/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 +47 -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 +47 -1
- 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/WorkspaceConfigUpdate.ts +7 -6
- package/dist/esm/ts-rs/WindowAggregate.d.ts +0 -1
- package/src/ts/ts-rs/WindowAggregate.ts +0 -3
- /package/dist/wasm/snippets/{perspective-viewer-8a8c7d5d696b43ae → perspective-viewer-02e461f3d7062b26}/inline0.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-8a8c7d5d696b43ae → perspective-viewer-02e461f3d7062b26}/inline1.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-8a8c7d5d696b43ae → perspective-viewer-02e461f3d7062b26}/inline2.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-8a8c7d5d696b43ae → perspective-viewer-02e461f3d7062b26}/inline3.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-8a8c7d5d696b43ae → perspective-viewer-02e461f3d7062b26}/inline4.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-8a8c7d5d696b43ae → perspective-viewer-02e461f3d7062b26}/inline5.js +0 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LLM provider presets for `viewer.agentConfig()`. These are plain data —
|
|
3
|
+
* the agent core is provider-agnostic (one OpenAI-chat-completions protocol
|
|
4
|
+
* over primitive `url`/`headers`/`apiKey` connection fields), so a
|
|
5
|
+
* "provider" is just a spreadable collection of those fields:
|
|
6
|
+
*
|
|
7
|
+
* ```javascript
|
|
8
|
+
* import { providers } from "@perspective-dev/viewer";
|
|
9
|
+
* viewer.agentConfig({
|
|
10
|
+
* ...providers.anthropic,
|
|
11
|
+
* apiKey: "sk-ant-...",
|
|
12
|
+
* model: "claude-haiku-4-5", // spread order = override order
|
|
13
|
+
* });
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* Any OpenAI-compatible service works without a preset — pass its full
|
|
17
|
+
* chat-completions `url` (and `apiKey`/`headers` as needed) directly.
|
|
18
|
+
* Cloud presets call the provider from the browser tab; suitable for local
|
|
19
|
+
* development, or route `url` through your own proxy for production.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* A spreadable connection preset for `viewer.agentConfig()`.
|
|
23
|
+
*/
|
|
24
|
+
export interface AgentProviderPreset {
|
|
25
|
+
name: string;
|
|
26
|
+
url: string;
|
|
27
|
+
headers?: Record<string, string>;
|
|
28
|
+
model?: string;
|
|
29
|
+
}
|
|
30
|
+
export declare const providers: {
|
|
31
|
+
/**
|
|
32
|
+
* Anthropic's OpenAI-compatibility endpoint. `apiKey` required.
|
|
33
|
+
*/
|
|
34
|
+
readonly anthropic: {
|
|
35
|
+
readonly name: "anthropic";
|
|
36
|
+
readonly url: "https://api.anthropic.com/v1/chat/completions";
|
|
37
|
+
readonly headers: {
|
|
38
|
+
readonly "anthropic-dangerous-direct-browser-access": "true";
|
|
39
|
+
};
|
|
40
|
+
readonly model: "claude-opus-5";
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Google Gemini's OpenAI-compatibility endpoint. `apiKey` required.
|
|
44
|
+
*/
|
|
45
|
+
readonly gemini: {
|
|
46
|
+
readonly name: "gemini";
|
|
47
|
+
readonly url: "https://generativelanguage.googleapis.com/v1beta/openai/chat/completions";
|
|
48
|
+
readonly model: "gemini-2.5-flash";
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* LM Studio's local developer server (enable CORS in its settings).
|
|
52
|
+
*/
|
|
53
|
+
readonly lmstudio: {
|
|
54
|
+
readonly name: "lmstudio";
|
|
55
|
+
readonly url: "http://localhost:1234/v1/chat/completions";
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Local Ollama (set `OLLAMA_ORIGINS` for CORS).
|
|
59
|
+
*/
|
|
60
|
+
readonly ollama: {
|
|
61
|
+
readonly name: "ollama";
|
|
62
|
+
readonly url: "http://localhost:11434/v1/chat/completions";
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* OpenRouter. `apiKey` required.
|
|
66
|
+
*/
|
|
67
|
+
readonly openrouter: {
|
|
68
|
+
readonly name: "openrouter";
|
|
69
|
+
readonly url: "https://openrouter.ai/api/v1/chat/completions";
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* OpenAI. `apiKey` required.
|
|
73
|
+
*/
|
|
74
|
+
readonly openai: {
|
|
75
|
+
readonly name: "openai";
|
|
76
|
+
readonly url: "https://api.openai.com/v1/chat/completions";
|
|
77
|
+
readonly model: "gpt-5.2";
|
|
78
|
+
};
|
|
79
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type CurrencyCode = "AED" | "AFN" | "ALL" | "AMD" | "ANG" | "AOA" | "ARS" | "AUD" | "AWG" | "AZN" | "BAM" | "BBD" | "BDT" | "BGN" | "BHD" | "BIF" | "BMD" | "BND" | "BOB" | "BOV" | "BRL" | "BSD" | "BTN" | "BWP" | "BYR" | "BZD" | "CAD" | "CDF" | "CHE" | "CHF" | "CHW" | "CLF" | "CLP" | "CNY" | "COP" | "COU" | "CRC" | "CUC" | "CUP" | "CVE" | "CZK" | "DJF" | "DKK" | "DOP" | "DZD" | "EGP" | "ERN" | "ETB" | "EUR" | "FJD" | "FKP" | "GBP" | "GEL" | "GHS" | "GIP" | "GMD" | "GNF" | "GTQ" | "GYD" | "HKD" | "HNL" | "HRK" | "HTG" | "HUF" | "IDR" | "ILS" | "INR" | "IQD" | "IRR" | "ISK" | "JMD" | "JOD" | "JPY" | "KES" | "KGS" | "KHR" | "KMF" | "KPW" | "KRW" | "KWD" | "KYD" | "KZT" | "LAK" | "LBP" | "LKR" | "LRD" | "LSL" | "LTL" | "LVL" | "LYD" | "MAD" | "MDL" | "MGA" | "MKD" | "MMK" | "MNT" | "MOP" | "MRO" | "MUR" | "MVR" | "MWK" | "MXN" | "MXV" | "MYR" | "MZN" | "NAD" | "NGN" | "NIO" | "NOK" | "NPR" | "NZD" | "OMR" | "PAB" | "PEN" | "PGK" | "PHP" | "PKR" | "PLN" | "PYG" | "QAR" | "RON" | "RSD" | "RUB" | "RWF" | "SAR" | "SBD" | "SCR" | "SDG" | "SEK" | "SGD" | "SHP" | "SLL" | "SOS" | "SRD" | "SSP" | "STD" | "SYP" | "SZL" | "THB" | "TJS" | "TMT" | "TND" | "TOP" | "TRY" | "TTD" | "TWD" | "TZS" | "UAH" | "UGX" | "USD" | "USN" | "USS" | "UYI" | "UYU" | "UZS" | "VEF" | "VND" | "VUV" | "WST" | "XAF" | "XAG" | "XAU" | "XBA" | "XBB" | "XBC" | "XBD" | "XCD" | "XDR" | "XFU" | "XOF" | "XPD" | "XPF" | "XPT" | "XTS" | "XXX" | "YER" | "ZAR" | "ZMW";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type CurrencyDisplay = "code" | "symbol" | "narrowSymbol" | "name";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CurrencyCode } from "./CurrencyCode.js";
|
|
2
|
+
import type { CurrencyDisplay } from "./CurrencyDisplay.js";
|
|
3
|
+
import type { CurrencySign } from "./CurrencySign.js";
|
|
4
|
+
export type CurrencyNumberFormatStyle = {
|
|
5
|
+
currency: CurrencyCode;
|
|
6
|
+
currencyDisplay: CurrencyDisplay | null;
|
|
7
|
+
currencySign: CurrencySign | null;
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type CurrencySign = "standard" | "accounting";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type CustomDatetimeFormat = "long" | "short" | "narrow" | "numeric" | "2-digit" | "disabled";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { CustomDatetimeFormat } from "./CustomDatetimeFormat.js";
|
|
2
|
+
import type { FormatUnit } from "./FormatUnit.js";
|
|
3
|
+
/**
|
|
4
|
+
* A datetime column's `date_format` in its `Custom` form: per-part
|
|
5
|
+
* `Intl.DateTimeFormatOptions` overrides, discriminated from the `Simple`
|
|
6
|
+
* preset form by the required `format: "custom"` key. Each part is a
|
|
7
|
+
* [`CustomDatetimeFormat`] variant valid for that `Intl` option;
|
|
8
|
+
* `"disabled"` omits the part from the formatted output entirely.
|
|
9
|
+
*/
|
|
10
|
+
export type CustomDatetimeStyleConfig = {
|
|
11
|
+
format: FormatUnit;
|
|
12
|
+
/**
|
|
13
|
+
* An IANA time zone name (e.g. `"America/New_York"`); defaults to the
|
|
14
|
+
* browser's local time zone.
|
|
15
|
+
*/
|
|
16
|
+
timeZone?: string | null;
|
|
17
|
+
/**
|
|
18
|
+
* Sub-second digits to display, 0-3 (0 = none).
|
|
19
|
+
*/
|
|
20
|
+
fractionalSecondDigits?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Defaults to `"numeric"`.
|
|
23
|
+
*/
|
|
24
|
+
second?: CustomDatetimeFormat;
|
|
25
|
+
/**
|
|
26
|
+
* Defaults to `"numeric"`.
|
|
27
|
+
*/
|
|
28
|
+
minute?: CustomDatetimeFormat;
|
|
29
|
+
/**
|
|
30
|
+
* Defaults to `"numeric"`.
|
|
31
|
+
*/
|
|
32
|
+
hour?: CustomDatetimeFormat;
|
|
33
|
+
/**
|
|
34
|
+
* Defaults to `"numeric"`.
|
|
35
|
+
*/
|
|
36
|
+
day?: CustomDatetimeFormat;
|
|
37
|
+
/**
|
|
38
|
+
* A name form (`"long"`/`"short"`/`"narrow"`); defaults to
|
|
39
|
+
* `"disabled"` (weekday not shown).
|
|
40
|
+
*/
|
|
41
|
+
weekday?: CustomDatetimeFormat;
|
|
42
|
+
/**
|
|
43
|
+
* Numeric or name form; defaults to `"numeric"`.
|
|
44
|
+
*/
|
|
45
|
+
month?: CustomDatetimeFormat;
|
|
46
|
+
/**
|
|
47
|
+
* Defaults to `"2-digit"`.
|
|
48
|
+
*/
|
|
49
|
+
year?: CustomDatetimeFormat;
|
|
50
|
+
/**
|
|
51
|
+
* 12-hour clock; defaults to `true`.
|
|
52
|
+
*/
|
|
53
|
+
hour12?: boolean;
|
|
54
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { RoundingMode } from "./RoundingMode.js";
|
|
2
|
+
import type { RoundingPriority } from "./RoundingPriority.js";
|
|
3
|
+
import type { SignDisplay } from "./SignDisplay.js";
|
|
4
|
+
import type { TrailingZeroDisplay } from "./TrailingZeroDisplay.js";
|
|
5
|
+
import type { UseGrouping } from "./UseGrouping.js";
|
|
6
|
+
/**
|
|
7
|
+
* A numeric column's `number_format` (`columns_config` value) —
|
|
8
|
+
* `Intl.NumberFormat`-shaped options, written by the Style tab's number
|
|
9
|
+
* format editor and read by `createNumberFormatter`. The `style` and
|
|
10
|
+
* `notation` families ([`NumberFormatStyle`] / [`Notation`]) are serde-
|
|
11
|
+
* FLATTENED into this object but `#[ts(skip)]`'d (ts-rs cannot flatten
|
|
12
|
+
* `Option<enum>`) — the package's `NumberFormatConfig` re-composes the
|
|
13
|
+
* full wire type as `CustomNumberFormatConfig & Partial<NumberFormatStyle>
|
|
14
|
+
* & Partial<Notation>` (see `column-format.ts`).
|
|
15
|
+
*/
|
|
16
|
+
export type CustomNumberFormatConfig = {
|
|
17
|
+
minimumIntegerDigits?: number | null;
|
|
18
|
+
minimumFractionDigits?: number | null;
|
|
19
|
+
maximumFractionDigits?: number | null;
|
|
20
|
+
minimumSignificantDigits?: number | null;
|
|
21
|
+
maximumSignificantDigits?: number | null;
|
|
22
|
+
roundingPriority?: RoundingPriority | null;
|
|
23
|
+
roundingIncrement?: number | null;
|
|
24
|
+
roundingMode?: RoundingMode | null;
|
|
25
|
+
trailingZeroDisplay?: TrailingZeroDisplay | null;
|
|
26
|
+
/**
|
|
27
|
+
* NOTE (audit 2026-08-05): serialized values are the STRINGS
|
|
28
|
+
* `"always"`/`"auto"`/`"min2"` or the untagged BOOLEAN `false` —
|
|
29
|
+
* the former hand-written TS `useGrouping?: boolean` was wrong for
|
|
30
|
+
* the string cases.
|
|
31
|
+
*/
|
|
32
|
+
useGrouping?: UseGrouping | null;
|
|
33
|
+
signDisplay?: SignDisplay | null;
|
|
34
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type DatetimeColorMode = "none" | "foreground" | "background";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CustomDatetimeStyleConfig } from "./CustomDatetimeStyleConfig.js";
|
|
2
|
+
import type { SimpleDatetimeStyleConfig } from "./SimpleDatetimeStyleConfig.js";
|
|
3
|
+
/**
|
|
4
|
+
* `Simple` case has all default-able keys and must be last!
|
|
5
|
+
*/
|
|
6
|
+
export type DatetimeFormatType = CustomDatetimeStyleConfig | SimpleDatetimeStyleConfig;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type FormatMode = "none" | "link" | "bold" | "italics";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type FormatUnit = "custom";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CompactDisplay } from "./CompactDisplay.js";
|
|
2
|
+
/**
|
|
3
|
+
* The `notation` family of a numeric column's `number_format` —
|
|
4
|
+
* serialized FLATTENED into [`CustomNumberFormatConfig`]'s object,
|
|
5
|
+
* discriminated by the `notation` key (`"standard"` default,
|
|
6
|
+
* `"scientific"`, `"engineering"`, `"compact"` + `compactDisplay`),
|
|
7
|
+
* mirroring `Intl.NumberFormat` options.
|
|
8
|
+
*/
|
|
9
|
+
export type Notation = {
|
|
10
|
+
"notation": "standard";
|
|
11
|
+
} | {
|
|
12
|
+
"notation": "scientific";
|
|
13
|
+
} | {
|
|
14
|
+
"notation": "engineering";
|
|
15
|
+
} | {
|
|
16
|
+
"notation": "compact";
|
|
17
|
+
} & CompactDisplay;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CurrencyNumberFormatStyle } from "./CurrencyNumberFormatStyle.js";
|
|
2
|
+
import type { UnitNumberFormatStyle } from "./UnitNumberFormatStyle.js";
|
|
3
|
+
/**
|
|
4
|
+
* The `style` family of a numeric column's `number_format` — serialized
|
|
5
|
+
* FLATTENED into [`CustomNumberFormatConfig`]'s object, discriminated by
|
|
6
|
+
* the `style` key (`"decimal"` default, `"currency"` + `currency`/
|
|
7
|
+
* `currencyDisplay`/`currencySign`, `"percent"`, `"unit"` + `unit`/
|
|
8
|
+
* `unitDisplay`), mirroring `Intl.NumberFormat` options.
|
|
9
|
+
*/
|
|
10
|
+
export type NumberFormatStyle = {
|
|
11
|
+
"style": "decimal";
|
|
12
|
+
} | {
|
|
13
|
+
"style": "currency";
|
|
14
|
+
} & CurrencyNumberFormatStyle | {
|
|
15
|
+
"style": "percent";
|
|
16
|
+
} | {
|
|
17
|
+
"style": "unit";
|
|
18
|
+
} & UnitNumberFormatStyle;
|
|
@@ -4,6 +4,7 @@ import type { Filter } from "./Filter.js";
|
|
|
4
4
|
import type { FilterReducer } from "./FilterReducer.js";
|
|
5
5
|
import type { GroupRollupMode } from "./GroupRollupMode.js";
|
|
6
6
|
import type { Sort } from "./Sort.js";
|
|
7
|
+
import type { SplitRollupMode } from "./SplitRollupMode.js";
|
|
7
8
|
import type { Windows } from "./Windows.js";
|
|
8
9
|
import type { JsonValue } from "./serde_json/JsonValue.js";
|
|
9
10
|
/**
|
|
@@ -12,24 +13,63 @@ import type { JsonValue } from "./serde_json/JsonValue.js";
|
|
|
12
13
|
* whole-element config format.
|
|
13
14
|
*/
|
|
14
15
|
export type PanelViewerConfig<V = string> = {
|
|
16
|
+
/**
|
|
17
|
+
* The `@perspective-dev/viewer` version that wrote this config,
|
|
18
|
+
* stamped on save and used to migrate older tokens. Callers do not
|
|
19
|
+
* set it.
|
|
20
|
+
*/
|
|
15
21
|
version: V;
|
|
22
|
+
/**
|
|
23
|
+
* Per-column styling, keyed by column name. The viewer treats the
|
|
24
|
+
* values as opaque — their shape is defined by the ACTIVE plugin,
|
|
25
|
+
* so a config written for one plugin may carry keys another
|
|
26
|
+
* ignores. Query the live shape with the `get_style_schema` agent
|
|
27
|
+
* tool, or the plugin's `column_config_schema()`.
|
|
28
|
+
*/
|
|
16
29
|
columns_config: {
|
|
17
30
|
[key in string]?: {
|
|
18
31
|
[key in string]?: JsonValue;
|
|
19
32
|
};
|
|
20
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* Name of the visualization plugin, from the set registered on the
|
|
36
|
+
* page (the `list_plugins` agent tool, or the plugin picker). This
|
|
37
|
+
* also decides what the view fields MEAN visually: `columns` is
|
|
38
|
+
* positional and each plugin reads the positions differently, and
|
|
39
|
+
* `group_by`/`split_by` draw different things per plugin.
|
|
40
|
+
*/
|
|
21
41
|
plugin: string;
|
|
42
|
+
/**
|
|
43
|
+
* Plugin-wide settings (as opposed to the per-column
|
|
44
|
+
* [`Self::columns_config`]). Opaque to the viewer and defined by
|
|
45
|
+
* the active plugin; see `get_style_schema`.
|
|
46
|
+
*/
|
|
22
47
|
plugin_config: {
|
|
23
48
|
[key in string]?: JsonValue;
|
|
24
49
|
};
|
|
25
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Name of the `Table` this panel renders, as hosted on the panel's
|
|
52
|
+
* `Client`. Every placed panel has a table binding (creation
|
|
53
|
+
* requires one by type — [`ViewerConfigInitial`]), so the saved
|
|
54
|
+
* config carries it unconditionally.
|
|
55
|
+
*/
|
|
56
|
+
table: string;
|
|
57
|
+
/**
|
|
58
|
+
* Selected theme NAME (e.g. `"Pro Dark"`) — not a CSS value. Valid
|
|
59
|
+
* names are the Perspective themes loaded on the page, which
|
|
60
|
+
* `resetThemes()` re-scans. `None` selects the first available.
|
|
61
|
+
*/
|
|
26
62
|
theme: string | null;
|
|
63
|
+
/**
|
|
64
|
+
* Panel title, shown in its tab. `None` renders the default title.
|
|
65
|
+
*/
|
|
27
66
|
title: string | null;
|
|
28
67
|
group_by: Array<string>;
|
|
29
68
|
split_by: Array<string>;
|
|
30
69
|
sort: Array<Sort>;
|
|
31
70
|
filter: Array<Filter>;
|
|
32
71
|
group_rollup_mode: GroupRollupMode;
|
|
72
|
+
split_rollup_mode: SplitRollupMode;
|
|
33
73
|
filter_op?: FilterReducer;
|
|
34
74
|
expressions: Expressions;
|
|
35
75
|
windows?: Windows;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ColumnSelectMode } from "./ColumnSelectMode.js";
|
|
2
2
|
import type { GroupRollupMode } from "./GroupRollupMode.js";
|
|
3
|
+
import type { SplitRollupMode } from "./SplitRollupMode.js";
|
|
3
4
|
/**
|
|
4
5
|
* Static, immutable configuration for a plugin.
|
|
5
6
|
*
|
|
@@ -60,6 +61,11 @@ export type PluginStaticConfig = {
|
|
|
60
61
|
* The first entry that matches a feature flag becomes the default.
|
|
61
62
|
*/
|
|
62
63
|
group_rollup_modes?: Array<GroupRollupMode> | null;
|
|
64
|
+
/**
|
|
65
|
+
* Split-rollup modes the plugin accepts, in preference order.
|
|
66
|
+
* The first entry that matches a feature flag becomes the default.
|
|
67
|
+
*/
|
|
68
|
+
split_rollup_modes?: Array<SplitRollupMode> | null;
|
|
63
69
|
/**
|
|
64
70
|
* Plugin load priority. Higher numbers win; ties resolve in
|
|
65
71
|
* registration order. The highest-priority plugin is loaded by
|
|
@@ -74,4 +80,33 @@ export type PluginStaticConfig = {
|
|
|
74
80
|
* is shown.
|
|
75
81
|
*/
|
|
76
82
|
can_render_column_styles?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* What `group_by` MEANS visually for this plugin, e.g. `"X Axis"`
|
|
85
|
+
* for the Y-series charts or `"Hierarchy"` for treemap/sunburst.
|
|
86
|
+
* `None` where the field has no visual role of its own and is a
|
|
87
|
+
* plain aggregation key (the X/Y charts, whose axes both come from
|
|
88
|
+
* `columns`).
|
|
89
|
+
*
|
|
90
|
+
* This is the `group_by` counterpart of [`Self::config_column_names`]:
|
|
91
|
+
* the same declaration that names the positional `columns` slots
|
|
92
|
+
* should say what the other view fields draw, so that consumers —
|
|
93
|
+
* the settings UI's field labels, and the agent's `list_plugins`
|
|
94
|
+
* contract — read one source instead of restating the mapping.
|
|
95
|
+
*/
|
|
96
|
+
group_by_role?: string | null;
|
|
97
|
+
/**
|
|
98
|
+
* What `split_by` MEANS visually for this plugin, e.g. `"Series"`.
|
|
99
|
+
* See [`Self::group_by_role`].
|
|
100
|
+
*/
|
|
101
|
+
split_by_role?: string | null;
|
|
102
|
+
/**
|
|
103
|
+
* `true` when this plugin CONNECTS its points in row order, so the
|
|
104
|
+
* `View`'s row order is visible in the drawing: an unsorted config
|
|
105
|
+
* renders the table's natural order, which reads as a tangle unless
|
|
106
|
+
* the rows already arrive ordered along the axis. Declared rather
|
|
107
|
+
* than inferred, because "unsorted" is not itself a mistake — a
|
|
108
|
+
* pre-ordered table needs no `sort`, and the point plugins
|
|
109
|
+
* (scatter, density) do not care at all.
|
|
110
|
+
*/
|
|
111
|
+
connects_row_order?: boolean;
|
|
77
112
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for the `restore()` method.
|
|
3
|
+
*/
|
|
4
|
+
export type RestoreOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* The target panel; the active panel when omitted.
|
|
7
|
+
*/
|
|
8
|
+
panel?: string;
|
|
9
|
+
/**
|
|
10
|
+
* When `true`, a failed restore only REJECTS the returned `Promise` —
|
|
11
|
+
* the error is not committed to the viewer's visible error state, and
|
|
12
|
+
* the session remains usable for subsequent calls. For programmatic
|
|
13
|
+
* callers (e.g. the LLM agent's `set_view_config` tool) for whom a
|
|
14
|
+
* failed config patch is feedback rather than a user-facing fault.
|
|
15
|
+
* The config may be partially applied on failure; restore a
|
|
16
|
+
* known-good config to recover exactly.
|
|
17
|
+
*/
|
|
18
|
+
suppress_errors?: boolean;
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type RoundingMode = "ceil" | "floor" | "expand" | "trunc" | "halfCeil" | "halfFloor" | "halfExpand" | "halfTrunc" | "halfEven";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type RoundingPriority = "auto" | "morePrecision" | "lessPrecision";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type SignDisplay = "auto" | "always" | "exceptZero" | "negative" | "never";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type SimpleDatetimeFormat = "full" | "long" | "medium" | "short" | "disabled";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { SimpleDatetimeFormat } from "./SimpleDatetimeFormat.js";
|
|
2
|
+
/**
|
|
3
|
+
* A datetime column's `date_format` in its `Simple` preset form:
|
|
4
|
+
* `Intl.DateTimeFormatOptions`' `dateStyle`/`timeStyle` presets. This is
|
|
5
|
+
* the default form (no `format` key); setting `format: "custom"` selects
|
|
6
|
+
* the per-part `CustomDatetimeStyleConfig` instead.
|
|
7
|
+
*/
|
|
8
|
+
export type SimpleDatetimeStyleConfig = {
|
|
9
|
+
/**
|
|
10
|
+
* An IANA time zone name (e.g. `"America/New_York"`); defaults to the
|
|
11
|
+
* browser's local time zone.
|
|
12
|
+
*/
|
|
13
|
+
timeZone?: string | null;
|
|
14
|
+
/**
|
|
15
|
+
* Date preset breadth, or `"disabled"` to omit the date entirely;
|
|
16
|
+
* defaults to `"short"`.
|
|
17
|
+
*/
|
|
18
|
+
dateStyle?: SimpleDatetimeFormat;
|
|
19
|
+
/**
|
|
20
|
+
* Time preset breadth, or `"disabled"` to omit the time entirely;
|
|
21
|
+
* defaults to `"medium"`.
|
|
22
|
+
*/
|
|
23
|
+
timeStyle?: SimpleDatetimeFormat;
|
|
24
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `split_by` corollary to [`GroupRollupMode`]. `Flat` (the default,
|
|
3
|
+
* matching this crate's historical behavior) emits only full-depth split
|
|
4
|
+
* combinations as columns; `Rollup` additionally emits grand-total and
|
|
5
|
+
* subtotal column groups in "totals before" order. There is no `Total`
|
|
6
|
+
* variant - an empty `split_by` already expresses a single grand-total
|
|
7
|
+
* column group.
|
|
8
|
+
*/
|
|
9
|
+
export type SplitRollupMode = "flat" | "rollup";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type StringColorMode = "none" | "foreground" | "background" | "series";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type TrailingZeroDisplay = "auto" | "stripIfInteger";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Unit = "acre" | "bit" | "byte" | "celsius" | "centimeter" | "day" | "degree" | "fahrenheit" | "fluid-ounce" | "foot" | "gallob" | "gigabit" | "gigabyte" | "gram" | "hectare" | "hour" | "inch" | "kilobit" | "kilobyte" | "kilogram" | "kilometer" | "liter" | "megabit" | "megabyte" | "meter" | "microsecond" | "mile" | "mile-scandinavian" | "milliliter" | "millimeter" | "millisecond" | "minute" | "month" | "nanosecond" | "ounce" | "percent" | "petabyte" | "pound" | "second" | "stone" | "terabit" | "terabyte" | "week" | "yard" | "year";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type UnitDisplay = "short" | "narrow" | "long";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type UseGrouping = "always" | "auto" | "min2" | boolean;
|
|
@@ -4,6 +4,7 @@ import type { Filter } from "./Filter.js";
|
|
|
4
4
|
import type { FilterReducer } from "./FilterReducer.js";
|
|
5
5
|
import type { GroupRollupMode } from "./GroupRollupMode.js";
|
|
6
6
|
import type { Sort } from "./Sort.js";
|
|
7
|
+
import type { SplitRollupMode } from "./SplitRollupMode.js";
|
|
7
8
|
import type { Windows } from "./Windows.js";
|
|
8
9
|
import type { JsonValue } from "./serde_json/JsonValue.js";
|
|
9
10
|
/**
|
|
@@ -16,24 +17,63 @@ import type { JsonValue } from "./serde_json/JsonValue.js";
|
|
|
16
17
|
*/
|
|
17
18
|
export type ViewerConfig<V = string> = {
|
|
18
19
|
settings: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* The `@perspective-dev/viewer` version that wrote this config,
|
|
22
|
+
* stamped on save and used to migrate older tokens. Callers do not
|
|
23
|
+
* set it.
|
|
24
|
+
*/
|
|
19
25
|
version: V;
|
|
26
|
+
/**
|
|
27
|
+
* Per-column styling, keyed by column name. The viewer treats the
|
|
28
|
+
* values as opaque — their shape is defined by the ACTIVE plugin,
|
|
29
|
+
* so a config written for one plugin may carry keys another
|
|
30
|
+
* ignores. Query the live shape with the `get_style_schema` agent
|
|
31
|
+
* tool, or the plugin's `column_config_schema()`.
|
|
32
|
+
*/
|
|
20
33
|
columns_config: {
|
|
21
34
|
[key in string]?: {
|
|
22
35
|
[key in string]?: JsonValue;
|
|
23
36
|
};
|
|
24
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* Name of the visualization plugin, from the set registered on the
|
|
40
|
+
* page (the `list_plugins` agent tool, or the plugin picker). This
|
|
41
|
+
* also decides what the view fields MEAN visually: `columns` is
|
|
42
|
+
* positional and each plugin reads the positions differently, and
|
|
43
|
+
* `group_by`/`split_by` draw different things per plugin.
|
|
44
|
+
*/
|
|
25
45
|
plugin: string;
|
|
46
|
+
/**
|
|
47
|
+
* Plugin-wide settings (as opposed to the per-column
|
|
48
|
+
* [`Self::columns_config`]). Opaque to the viewer and defined by
|
|
49
|
+
* the active plugin; see `get_style_schema`.
|
|
50
|
+
*/
|
|
26
51
|
plugin_config: {
|
|
27
52
|
[key in string]?: JsonValue;
|
|
28
53
|
};
|
|
29
|
-
|
|
54
|
+
/**
|
|
55
|
+
* Name of the `Table` this panel renders, as hosted on the panel's
|
|
56
|
+
* `Client`. Every placed panel has a table binding (creation
|
|
57
|
+
* requires one by type — [`ViewerConfigInitial`]), so the saved
|
|
58
|
+
* config carries it unconditionally.
|
|
59
|
+
*/
|
|
60
|
+
table: string;
|
|
61
|
+
/**
|
|
62
|
+
* Selected theme NAME (e.g. `"Pro Dark"`) — not a CSS value. Valid
|
|
63
|
+
* names are the Perspective themes loaded on the page, which
|
|
64
|
+
* `resetThemes()` re-scans. `None` selects the first available.
|
|
65
|
+
*/
|
|
30
66
|
theme: string | null;
|
|
67
|
+
/**
|
|
68
|
+
* Panel title, shown in its tab. `None` renders the default title.
|
|
69
|
+
*/
|
|
31
70
|
title: string | null;
|
|
32
71
|
group_by: Array<string>;
|
|
33
72
|
split_by: Array<string>;
|
|
34
73
|
sort: Array<Sort>;
|
|
35
74
|
filter: Array<Filter>;
|
|
36
75
|
group_rollup_mode: GroupRollupMode;
|
|
76
|
+
split_rollup_mode: SplitRollupMode;
|
|
37
77
|
filter_op?: FilterReducer;
|
|
38
78
|
expressions: Expressions;
|
|
39
79
|
windows?: Windows;
|