@perspective-dev/viewer 5.3.0 → 5.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/dist/cdn/perspective-viewer.js +8 -8
  2. package/dist/cdn/perspective-viewer.js.map +3 -3
  3. package/dist/css/blueprint.css +1 -0
  4. package/dist/css/botanical.css +1 -1
  5. package/dist/css/dracula.css +1 -1
  6. package/dist/css/eggplant.css +1 -0
  7. package/dist/css/gruvbox-dark.css +1 -1
  8. package/dist/css/gruvbox.css +1 -1
  9. package/dist/css/icons.css +1 -1
  10. package/dist/css/intl/de.css +1 -1
  11. package/dist/css/intl/es.css +1 -1
  12. package/dist/css/intl/fr.css +1 -1
  13. package/dist/css/intl/ja.css +1 -1
  14. package/dist/css/intl/pt.css +1 -1
  15. package/dist/css/intl/zh.css +1 -1
  16. package/dist/css/intl.css +1 -1
  17. package/dist/css/ledger.css +1 -0
  18. package/dist/css/monokai.css +1 -1
  19. package/dist/css/nord.css +1 -0
  20. package/dist/css/phosphor.css +1 -1
  21. package/dist/css/pro-dark.css +1 -1
  22. package/dist/css/pro.css +1 -1
  23. package/dist/css/solarized-dark.css +1 -1
  24. package/dist/css/solarized.css +1 -1
  25. package/dist/css/themes.css +1 -1
  26. package/dist/css/vaporwave.css +1 -1
  27. package/dist/css/velvet.css +1 -0
  28. package/dist/docs/perspective-docs.json +1 -1
  29. package/dist/esm/column-format.d.ts +16 -3
  30. package/dist/esm/perspective-viewer.inline.js +9 -9
  31. package/dist/esm/perspective-viewer.inline.js.map +3 -3
  32. package/dist/esm/perspective-viewer.js +8 -8
  33. package/dist/esm/perspective-viewer.js.map +3 -3
  34. package/dist/wasm/perspective-viewer.d.ts +16 -16
  35. package/dist/wasm/perspective-viewer.js +107 -103
  36. package/dist/wasm/perspective-viewer.wasm +0 -0
  37. package/dist/wasm/perspective-viewer.wasm.d.ts +16 -16
  38. package/package.json +1 -1
  39. package/src/css/column-settings-panel.css +19 -0
  40. package/src/css/column-style.css +82 -0
  41. package/src/css/containers/tabs.css +13 -3
  42. package/src/css/dom/select.css +19 -8
  43. package/src/css/plugin-selector.css +1 -0
  44. package/src/css/plugin-settings-panel.css +72 -0
  45. package/src/css/viewer.css +0 -5
  46. package/src/rust/agent/tools.rs +5 -2
  47. package/src/rust/components/column_settings_sidebar/style_tab.rs +296 -237
  48. package/src/rust/components/containers/control_group.rs +91 -0
  49. package/src/rust/components/containers/mod.rs +1 -0
  50. package/src/rust/components/containers/select.rs +8 -2
  51. package/src/rust/components/datetime_column_style/simple.rs +15 -4
  52. package/src/rust/components/datetime_column_style.rs +50 -10
  53. package/src/rust/components/plugin_tab.rs +125 -87
  54. package/src/rust/components/settings_panel.rs +1 -0
  55. package/src/rust/components/status_bar.rs +0 -1
  56. package/src/rust/components/style_controls/number_string_format/digits_section.rs +22 -10
  57. package/src/rust/components/style_controls/number_string_format/misc_section.rs +6 -2
  58. package/src/rust/components/style_controls/number_string_format/style_section.rs +1 -0
  59. package/src/rust/components/style_controls/number_string_format/types.rs +24 -0
  60. package/src/rust/components/style_controls/number_string_format.rs +37 -14
  61. package/src/rust/config/column_config_schema.rs +358 -27
  62. package/src/rust/config/datetime_column_style.rs +4 -21
  63. package/src/rust/config/number_string_format.rs +211 -18
  64. package/src/rust/presentation.rs +17 -0
  65. package/src/rust/queries/plugin_column_styles.rs +2 -2
  66. package/src/rust/renderer/dispatch.rs +34 -8
  67. package/src/rust/renderer/plugin_config.rs +55 -8
  68. package/src/themes/blueprint.css +190 -0
  69. package/src/themes/botanical.css +4 -17
  70. package/src/themes/defaults.css +2 -120
  71. package/src/themes/dracula.css +2 -14
  72. package/src/themes/eggplant.css +189 -0
  73. package/src/themes/gruvbox-dark.css +3 -15
  74. package/src/themes/gruvbox.css +1 -1
  75. package/src/themes/icons.css +1 -2
  76. package/src/themes/intl/de.css +23 -1
  77. package/src/themes/intl/es.css +23 -1
  78. package/src/themes/intl/fr.css +23 -1
  79. package/src/themes/intl/ja.css +23 -1
  80. package/src/themes/intl/pt.css +23 -1
  81. package/src/themes/intl/zh.css +23 -1
  82. package/src/themes/intl.css +26 -4
  83. package/src/themes/ledger.css +195 -0
  84. package/src/themes/monokai.css +2 -14
  85. package/src/themes/nord.css +186 -0
  86. package/src/themes/phosphor.css +2 -14
  87. package/src/themes/pro-dark.css +2 -16
  88. package/src/themes/pro.css +118 -0
  89. package/src/themes/solarized-dark.css +2 -16
  90. package/src/themes/themes.css +10 -5
  91. package/src/themes/vaporwave.css +2 -14
  92. package/src/themes/velvet.css +192 -0
  93. package/src/ts/column-format.ts +52 -2
  94. package/src/svg/dropdown-selector-light.svg +0 -3
  95. /package/dist/wasm/snippets/{perspective-viewer-39c3c3b28e3cbd48 → perspective-viewer-87bd21b215d0631a}/inline0.js +0 -0
  96. /package/dist/wasm/snippets/{perspective-viewer-39c3c3b28e3cbd48 → perspective-viewer-87bd21b215d0631a}/inline1.js +0 -0
  97. /package/dist/wasm/snippets/{perspective-viewer-39c3c3b28e3cbd48 → perspective-viewer-87bd21b215d0631a}/inline2.js +0 -0
  98. /package/dist/wasm/snippets/{perspective-viewer-39c3c3b28e3cbd48 → perspective-viewer-87bd21b215d0631a}/inline3.js +0 -0
  99. /package/dist/wasm/snippets/{perspective-viewer-39c3c3b28e3cbd48 → perspective-viewer-87bd21b215d0631a}/inline4.js +0 -0
  100. /package/dist/wasm/snippets/{perspective-viewer-39c3c3b28e3cbd48 → perspective-viewer-87bd21b215d0631a}/inline5.js +0 -0
@@ -0,0 +1,192 @@
1
+ /* ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2
+ * ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃
3
+ * ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃
4
+ * ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃
5
+ * ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃
6
+ * ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
7
+ * ┃ Copyright (c) 2017, the Perspective Authors. ┃
8
+ * ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃
9
+ * ┃ This file is part of the Perspective library, distributed under the terms ┃
10
+ * ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
11
+ * ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ */
12
+
13
+ @import "./defaults.css";
14
+
15
+ perspective-viewer,
16
+ perspective-viewer[theme="Velvet"],
17
+ perspective-viewer [theme="Velvet"] {
18
+ --psp-theme-name: "Velvet";
19
+ }
20
+
21
+ perspective-viewer[theme="Velvet"],
22
+ perspective-viewer [theme="Velvet"] {
23
+ --theme-bg0: #3a0d14;
24
+ --theme-bg1: #4a1119;
25
+ --theme-bg2: #5c1822;
26
+ --theme-bg3: #7a2431;
27
+ --theme-fg0: #fff5f7;
28
+ --theme-fg1: #f3c9d3;
29
+ --theme-fg2: #a8606f;
30
+ --theme-white: #ffffff;
31
+ --theme-pink: #ff8fb8;
32
+ --theme-pink-bright: #ffb3cf;
33
+ --theme-rose: #ff5c8d;
34
+ --theme-blush: #ffd6e2;
35
+ --theme-gold: #f2c078;
36
+ --theme-lilac: #d9b3ff;
37
+ --theme-peach: #ffcba4;
38
+ --theme-amber: #ffd166;
39
+ --theme-mint: #8fe3c8;
40
+ --theme-sky: #9ccfff;
41
+ --theme-periwinkle: #a3a8ff;
42
+ --theme-sage: #c5d99a;
43
+
44
+ background-color: var(--theme-bg0);
45
+ color: var(--theme-fg0);
46
+ color-scheme: dark;
47
+ --psp--color: var(--theme-fg1);
48
+ --psp-active--color: var(--theme-pink);
49
+ --psp-error--color: var(--theme-amber);
50
+ --psp-inactive--color: var(--theme-fg2);
51
+ --psp-inactive--border-color: var(--theme-bg3);
52
+ --psp--background-color: var(--theme-bg0);
53
+ --psp-active--background: rgba(255, 143, 184, 0.3);
54
+ --psp-expression--operator--color: var(--theme-pink-bright);
55
+ --psp-expression--function--color: var(--theme-pink);
56
+ --psp-expression--psp-error--color: var(--theme-amber);
57
+ --psp-calendar--filter: invert(1);
58
+ --psp-input--filter: invert(1);
59
+ --psp-warning--color: var(--theme-bg0);
60
+ --psp-warning--background: var(--theme-blush);
61
+
62
+ --psp-status-icon--connected--color: var(--theme-pink);
63
+ --psp-status-icon--initializing--color: var(--theme-blush);
64
+ --psp-status-icon--psp-error--color: var(--theme-amber);
65
+
66
+ --psp-code-editor--symbol--color: var(--theme-fg0);
67
+ --psp-code-editor--literal--color: var(--theme-pink-bright);
68
+ --psp-code-editor--operator--color: var(--theme-pink-bright);
69
+ --psp-code-editor--comment--color: var(--theme-fg2);
70
+ --psp-code-editor--column--color: var(--theme-lilac);
71
+
72
+ --psp-datagrid--pos-cell--color: var(--theme-white);
73
+ --psp-datagrid--neg-cell--color: var(--theme-rose);
74
+
75
+ --psp-charts--legend--color: var(--theme-fg1);
76
+ --psp-charts--treemap--labels: var(--theme-fg0);
77
+ --psp-charts--treemap--hover-highlight: var(--theme-fg0);
78
+ --psp-charts--tooltip--color: var(--theme-fg0);
79
+ --psp-charts--axis-ticks--color: var(--theme-fg1);
80
+ --psp-charts--axis-lines--color: var(--theme-bg3);
81
+ --psp-charts--gridline--color: var(--theme-bg2);
82
+ --psp-charts--tooltip--background: var(--theme-bg1);
83
+ --psp-charts--tooltip--border-color: var(--theme-bg3);
84
+ --psp-charts--legend--background: var(--psp--background-color);
85
+
86
+ --psp-charts--series--color: var(--theme-white);
87
+ --psp-charts--series-1--color: var(--theme-fg1);
88
+ --psp-charts--series-2--color: var(--theme-pink);
89
+ --psp-charts--series-3--color: var(--theme-gold);
90
+ --psp-charts--series-4--color: var(--theme-lilac);
91
+ --psp-charts--series-5--color: var(--theme-mint);
92
+ --psp-charts--series-6--color: var(--theme-rose);
93
+ --psp-charts--series-7--color: var(--theme-sky);
94
+ --psp-charts--series-8--color: var(--theme-peach);
95
+ --psp-charts--series-9--color: var(--theme-periwinkle);
96
+ --psp-charts--series-10--color: var(--theme-sage);
97
+ --psp-datagrid--series-1--color: var(--theme-fg1);
98
+ --psp-datagrid--series-2--color: var(--theme-pink);
99
+ --psp-datagrid--series-3--color: var(--theme-gold);
100
+ --psp-datagrid--series-4--color: var(--theme-lilac);
101
+ --psp-datagrid--series-5--color: var(--theme-mint);
102
+ --psp-datagrid--series-6--color: var(--theme-rose);
103
+ --psp-datagrid--series-7--color: var(--theme-sky);
104
+ --psp-datagrid--series-8--color: var(--theme-peach);
105
+ --psp-datagrid--series-9--color: var(--theme-periwinkle);
106
+ --psp-datagrid--series-10--color: var(--theme-sage);
107
+
108
+ --psp-charts--gradient--background: linear-gradient(
109
+ var(--theme-rose) 0%,
110
+ var(--theme-bg0) 50%,
111
+ var(--theme-white) 100%
112
+ );
113
+
114
+ --psp-openlayers--tile-url: "http://{a-c}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png";
115
+ --psp-openlayers--attribution--filter: invert(1) hue-rotate(180deg);
116
+ --psp-openlayers--element--background: var(--theme-bg1);
117
+ --psp-openlayers--category-1--color: var(--theme-fg1);
118
+ --psp-openlayers--category-2--color: var(--theme-pink);
119
+ --psp-openlayers--category-3--color: var(--theme-gold);
120
+ --psp-openlayers--category-4--color: var(--theme-lilac);
121
+ --psp-openlayers--category-5--color: var(--theme-mint);
122
+ --psp-openlayers--category-6--color: var(--theme-rose);
123
+ --psp-openlayers--category-7--color: var(--theme-sky);
124
+ --psp-openlayers--category-8--color: var(--theme-peach);
125
+ --psp-openlayers--category-9--color: var(--theme-periwinkle);
126
+ --psp-openlayers--category-10--color: var(--theme-sage);
127
+ --psp-openlayers--gradient--background: linear-gradient(
128
+ var(--theme-rose) 0%,
129
+ var(--theme-bg0) 50%,
130
+ var(--theme-white) 100%
131
+ );
132
+ }
133
+
134
+ perspective-context-menu[theme="Velvet"],
135
+ perspective-copy-menu[theme="Velvet"],
136
+ perspective-export-menu[theme="Velvet"],
137
+ perspective-dropdown[theme="Velvet"],
138
+ perspective-date-column-style[theme="Velvet"],
139
+ perspective-datetime-column-style[theme="Velvet"],
140
+ perspective-number-column-style[theme="Velvet"],
141
+ perspective-string-column-style[theme="Velvet"] {
142
+ --theme-bg0: #3a0d14;
143
+ --theme-bg1: #4a1119;
144
+ --theme-bg2: #5c1822;
145
+ --theme-bg3: #7a2431;
146
+ --theme-fg0: #fff5f7;
147
+ --theme-fg1: #f3c9d3;
148
+ --theme-fg2: #a8606f;
149
+ --theme-white: #ffffff;
150
+ --theme-pink: #ff8fb8;
151
+ --theme-pink-bright: #ffb3cf;
152
+ --theme-rose: #ff5c8d;
153
+ --theme-blush: #ffd6e2;
154
+ --theme-gold: #f2c078;
155
+ --theme-lilac: #d9b3ff;
156
+ --theme-peach: #ffcba4;
157
+ --theme-amber: #ffd166;
158
+ --theme-mint: #8fe3c8;
159
+ --theme-sky: #9ccfff;
160
+ --theme-periwinkle: #a3a8ff;
161
+ --theme-sage: #c5d99a;
162
+
163
+ background-color: var(--theme-bg0);
164
+ color: var(--theme-fg0);
165
+ color-scheme: dark;
166
+ --psp--color: var(--theme-fg1);
167
+ --psp-active--color: var(--theme-pink);
168
+ --psp-error--color: var(--theme-amber);
169
+ --psp-inactive--color: var(--theme-fg2);
170
+ --psp-inactive--border-color: var(--theme-bg3);
171
+ --psp--background-color: var(--theme-bg0);
172
+ --psp-active--background: rgba(255, 143, 184, 0.3);
173
+ --psp-expression--operator--color: var(--theme-pink-bright);
174
+ --psp-expression--function--color: var(--theme-pink);
175
+ --psp-expression--psp-error--color: var(--theme-amber);
176
+ --psp-calendar--filter: invert(1);
177
+ --psp-input--filter: invert(1);
178
+ --psp-warning--color: var(--theme-bg0);
179
+ --psp-warning--background: var(--theme-blush);
180
+
181
+ --psp-status-icon--connected--color: var(--theme-pink);
182
+ --psp-status-icon--initializing--color: var(--theme-blush);
183
+ --psp-status-icon--psp-error--color: var(--theme-amber);
184
+
185
+ --psp-code-editor--symbol--color: var(--theme-fg0);
186
+ --psp-code-editor--literal--color: var(--theme-pink-bright);
187
+ --psp-code-editor--operator--color: var(--theme-pink-bright);
188
+ --psp-code-editor--comment--color: var(--theme-fg2);
189
+ --psp-code-editor--column--color: var(--theme-lilac);
190
+
191
+ border: 1px solid #7a2431;
192
+ }
@@ -83,23 +83,67 @@ const DATE_LEGACY_DEFAULTS: Intl.DateTimeFormatOptions = {
83
83
  dateStyle: "short",
84
84
  };
85
85
 
86
+ function mergeNumberOptions(
87
+ base: Intl.NumberFormatOptions,
88
+ cfg?: NumberFormatConfig,
89
+ ): Intl.NumberFormatOptions {
90
+ const explicit: Record<string, unknown> = {};
91
+ for (const [k, v] of Object.entries(cfg ?? {})) {
92
+ if (v !== undefined && v !== null) {
93
+ explicit[k] = v;
94
+ }
95
+ }
96
+
97
+ const merged: Record<string, unknown> = { ...base };
98
+ if (
99
+ "minimumFractionDigits" in explicit ||
100
+ "maximumFractionDigits" in explicit
101
+ ) {
102
+ delete merged.minimumFractionDigits;
103
+ delete merged.maximumFractionDigits;
104
+ }
105
+
106
+ if (
107
+ "minimumSignificantDigits" in explicit ||
108
+ "maximumSignificantDigits" in explicit
109
+ ) {
110
+ delete merged.minimumSignificantDigits;
111
+ delete merged.maximumSignificantDigits;
112
+ }
113
+
114
+ return Object.assign(merged, explicit) as Intl.NumberFormatOptions;
115
+ }
116
+
117
+ /**
118
+ * `defaults` is the calling plugin's declared default format, filling in
119
+ * the fields `cfg` leaves unset.
120
+ */
86
121
  export function createNumberFormatter(
87
122
  type: string,
88
123
  cfg?: NumberFormatConfig,
124
+ defaults?: NumberFormatConfig,
89
125
  ): Intl.NumberFormat {
90
126
  // ts-rs renders serde-absent keys as `T | null`; the wire never
91
127
  // carries an explicit `null` (`skip_serializing_if`), and
92
128
  // `Intl.NumberFormat` treats both absent and `undefined` the same, so
93
129
  // the cast is presentation-only.
94
- const opts = (cfg ??
130
+ const base = ((defaults as Intl.NumberFormatOptions | undefined) ??
95
131
  NUMERIC_LEGACY_DEFAULTS[type] ??
96
132
  {}) as Intl.NumberFormatOptions;
133
+
134
+ const opts = cfg ? mergeNumberOptions(base, cfg) : base;
97
135
  return new Intl.NumberFormat(navigator.languages as string[], opts);
98
136
  }
99
137
 
138
+ /**
139
+ * `defaults` is the calling plugin's declared default `date_format`,
140
+ * applied only when `cfg` is wholly absent.
141
+ */
100
142
  export function createDatetimeFormatter(
101
143
  cfg?: DateFormatConfig,
144
+ defaults?: DateFormatConfig,
102
145
  ): Intl.DateTimeFormat {
146
+ cfg = cfg ?? defaults;
103
147
  if (!cfg || !("format" in cfg)) {
104
148
  const preset = simple_config(cfg);
105
149
  const opts: Intl.DateTimeFormatOptions = {
@@ -158,10 +202,16 @@ export function createDatetimeFormatter(
158
202
  return new Intl.DateTimeFormat(navigator.languages as string[], opts);
159
203
  }
160
204
 
205
+ /**
206
+ * `defaults` follows the same contract as
207
+ * [`createDatetimeFormatter`]: the plugin's declared default
208
+ * `date_format`, applied only when `cfg` is wholly absent.
209
+ */
161
210
  export function createDateFormatter(
162
211
  cfg?: DateFormatConfig,
212
+ defaults?: DateFormatConfig,
163
213
  ): Intl.DateTimeFormat {
164
- const preset = simple_config(cfg);
214
+ const preset = simple_config(cfg ?? defaults);
165
215
  const opts: Intl.DateTimeFormatOptions = {
166
216
  timeZone: "utc",
167
217
  dateStyle:
@@ -1,3 +0,0 @@
1
- <svg width="6" height="4" viewBox="0 0 6 4" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M1 1L3.17687 3.17687L5.35374 1" stroke="#ffffff" stroke-width="0.725624" stroke-linecap="round"/>
3
- </svg>