ggaction 0.0.13 → 0.0.16

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 (359) hide show
  1. package/CHANGELOG.md +146 -0
  2. package/README.md +41 -12
  3. package/knowledge/action-cards.json +1 -1
  4. package/knowledge/intent-taxonomy.json +1 -1
  5. package/knowledge/mcp-resources.json +1 -1
  6. package/knowledge/task-packet.schema.json +1 -1
  7. package/knowledge/task-resolver.js +1 -1
  8. package/package.json +39 -7
  9. package/src/BasicChartProgram.js +3 -1
  10. package/src/ChartProgram.js +2 -0
  11. package/src/accessibility.js +157 -0
  12. package/src/actions/basic.js +2 -2
  13. package/src/actions/boxPlots/components.js +20 -12
  14. package/src/actions/boxPlots/create.js +4 -5
  15. package/src/actions/boxPlots/edit.js +34 -9
  16. package/src/actions/boxPlots/materialize.js +12 -4
  17. package/src/actions/boxPlots/options.js +48 -16
  18. package/src/actions/canvas/actions.js +3 -3
  19. package/src/actions/canvas/fitting.js +1 -1
  20. package/src/actions/categoryOrder/index.js +21 -12
  21. package/src/actions/charts/area.js +6 -2
  22. package/src/actions/charts/bar.js +3 -2
  23. package/src/actions/charts/beeswarm.js +1 -1
  24. package/src/actions/charts/density.js +7 -3
  25. package/src/actions/charts/ecdf.js +6 -3
  26. package/src/actions/charts/endpoints.js +29 -7
  27. package/src/actions/charts/heatmap.js +3 -2
  28. package/src/actions/charts/histogram.js +5 -4
  29. package/src/actions/charts/horizon.js +4 -2
  30. package/src/actions/charts/interval-regression.js +7 -4
  31. package/src/actions/charts/line.js +4 -2
  32. package/src/actions/charts/parallel.js +9 -3
  33. package/src/actions/charts/pie.js +11 -3
  34. package/src/actions/charts/polar.js +17 -6
  35. package/src/actions/charts/radar.js +9 -3
  36. package/src/actions/charts/radial.js +12 -4
  37. package/src/actions/charts/raincloud.js +2 -2
  38. package/src/actions/charts/rug-strip.js +8 -4
  39. package/src/actions/charts/scatter.js +4 -2
  40. package/src/actions/composition/actions.js +29 -24
  41. package/src/actions/coordinates/actions.js +2 -2
  42. package/src/actions/coordinates/edit.js +76 -0
  43. package/src/actions/data/basicBin2d.js +4 -5
  44. package/src/actions/data/bin.js +3 -3
  45. package/src/actions/data/bin2d.js +63 -193
  46. package/src/actions/data/bin2dMaterialize.js +4 -5
  47. package/src/actions/data/box.js +4 -4
  48. package/src/actions/data/complete.js +26 -0
  49. package/src/actions/data/computed.js +4 -4
  50. package/src/actions/data/create.js +7 -14
  51. package/src/actions/data/density.js +15 -23
  52. package/src/actions/data/derived.js +57 -31
  53. package/src/actions/data/ecdf.js +2 -2
  54. package/src/actions/data/edit.js +551 -0
  55. package/src/actions/data/filter.js +28 -22
  56. package/src/actions/data/fold.js +2 -2
  57. package/src/actions/data/gradientProfile.js +2 -2
  58. package/src/actions/data/horizon.js +2 -2
  59. package/src/actions/data/impute.js +26 -0
  60. package/src/actions/data/index.js +62 -47
  61. package/src/actions/data/interval.js +2 -2
  62. package/src/actions/data/intervalEdit.js +26 -18
  63. package/src/actions/data/normalize.js +27 -0
  64. package/src/actions/data/regression.js +21 -27
  65. package/src/actions/data/revise.js +48 -0
  66. package/src/actions/data/revisionBindings.js +125 -0
  67. package/src/actions/data/shared.js +20 -4
  68. package/src/actions/data/stack.js +2 -2
  69. package/src/actions/data/summary.js +3 -3
  70. package/src/actions/data/timeUnit.js +6 -3
  71. package/src/actions/data/window.js +3 -3
  72. package/src/actions/encodings/angle.js +1 -1
  73. package/src/actions/encodings/appearance.js +4 -4
  74. package/src/actions/encodings/barWidth.js +1 -1
  75. package/src/actions/encodings/channels.js +415 -0
  76. package/src/actions/encodings/color/index.js +3 -2
  77. package/src/actions/encodings/density.js +7 -4
  78. package/src/actions/encodings/histogram.js +4 -3
  79. package/src/actions/encodings/horizon.js +6 -8
  80. package/src/actions/encodings/index.js +4 -0
  81. package/src/actions/encodings/offset.js +22 -15
  82. package/src/actions/encodings/parallel.js +4 -5
  83. package/src/actions/encodings/pathOrder.js +6 -11
  84. package/src/actions/encodings/position/apply.js +53 -7
  85. package/src/actions/encodings/position/index.js +14 -6
  86. package/src/actions/encodings/position/policies/bar.js +9 -0
  87. package/src/actions/encodings/position/resolve.js +24 -7
  88. package/src/actions/encodings/ranged.js +5 -5
  89. package/src/actions/encodings/remove.js +13 -9
  90. package/src/actions/encodings/ruleAppearance.js +2 -24
  91. package/src/actions/encodings/seriesLayout.js +2 -1
  92. package/src/actions/encodings/shared.js +82 -14
  93. package/src/actions/encodings/stroke.js +226 -0
  94. package/src/actions/encodings/strokeDash.js +2 -2
  95. package/src/actions/encodings/text.js +1 -1
  96. package/src/actions/errorBands/create.js +34 -20
  97. package/src/actions/errorBands/edit.js +34 -137
  98. package/src/actions/errorBars/create.js +43 -20
  99. package/src/actions/errorBars/edit.js +29 -125
  100. package/src/actions/facets/actions.js +267 -73
  101. package/src/actions/facets/derive.js +99 -28
  102. package/src/actions/facets/guides.js +4 -5
  103. package/src/actions/facets/replay.js +4 -5
  104. package/src/actions/gradientPlots/components.js +15 -8
  105. package/src/actions/gradientPlots/create.js +4 -5
  106. package/src/actions/gradientPlots/edit.js +18 -9
  107. package/src/actions/gradientPlots/materialize.js +5 -3
  108. package/src/actions/gradientPlots/options.js +10 -2
  109. package/src/actions/gradientPlots/rebind.js +4 -5
  110. package/src/actions/guides/applicability.js +8 -2
  111. package/src/actions/guides/axes/axes.js +23 -4
  112. package/src/actions/guides/axes/axis.js +2 -2
  113. package/src/actions/guides/axes/edit.js +2 -2
  114. package/src/actions/guides/axes/labels.js +67 -21
  115. package/src/actions/guides/axes/lines.js +15 -9
  116. package/src/actions/guides/axes/parallel/lifecycle.js +13 -13
  117. package/src/actions/guides/axes/parallel/resolve.js +6 -2
  118. package/src/actions/guides/axes/parallel.js +5 -5
  119. package/src/actions/guides/axes/remove.js +4 -4
  120. package/src/actions/guides/axes/tickGroups.js +6 -5
  121. package/src/actions/guides/axes/ticks.js +19 -6
  122. package/src/actions/guides/axes/titles.js +21 -13
  123. package/src/actions/guides/grids/grid.js +18 -29
  124. package/src/actions/guides/grids/resolve.js +7 -2
  125. package/src/actions/guides/guides.js +20 -4
  126. package/src/actions/guides/legends/blocks.js +426 -0
  127. package/src/actions/guides/legends/categorical/actions.js +138 -52
  128. package/src/actions/guides/legends/categorical/components.js +55 -45
  129. package/src/actions/guides/legends/categorical/index.js +37 -33
  130. package/src/actions/guides/legends/categorical/layout.js +98 -16
  131. package/src/actions/guides/legends/categorical/options.js +2 -2
  132. package/src/actions/guides/legends/categorical/recipes.js +111 -20
  133. package/src/actions/guides/legends/categorical/resolve.js +12 -8
  134. package/src/actions/guides/legends/categorical/symbols.js +104 -52
  135. package/src/actions/guides/legends/continuous/common.js +76 -20
  136. package/src/actions/guides/legends/continuous/gradient.js +95 -158
  137. package/src/actions/guides/legends/continuous/index.js +2 -0
  138. package/src/actions/guides/legends/continuous/interval.js +21 -16
  139. package/src/actions/guides/legends/continuous/opacity.js +37 -83
  140. package/src/actions/guides/legends/continuous/stroke.js +225 -0
  141. package/src/actions/guides/legends/creation.js +14 -1
  142. package/src/actions/guides/legends/edit.js +159 -60
  143. package/src/actions/guides/legends/focused.js +5 -5
  144. package/src/actions/guides/legends/index.js +2 -0
  145. package/src/actions/guides/legends/lane.js +59 -24
  146. package/src/actions/guides/legends/lifecycle.js +19 -8
  147. package/src/actions/guides/legends/remove.js +17 -8
  148. package/src/actions/guides/legends/sampling.js +140 -0
  149. package/src/actions/guides/legends/size.js +100 -108
  150. package/src/actions/guides/legends/strokeWidth.js +38 -92
  151. package/src/actions/guides/legends/target.js +112 -1
  152. package/src/actions/guides/legends/transition.js +165 -16
  153. package/src/actions/guides/polar/axes/facade.js +8 -8
  154. package/src/actions/guides/polar/axes/labels.js +29 -10
  155. package/src/actions/guides/polar/axes/lines.js +19 -19
  156. package/src/actions/guides/polar/axes/shared.js +16 -0
  157. package/src/actions/guides/polar/axes/ticks.js +10 -16
  158. package/src/actions/guides/polar/axes/titles.js +6 -6
  159. package/src/actions/guides/polar/grids.js +12 -14
  160. package/src/actions/guides/polar/resolve.js +12 -8
  161. package/src/actions/index.js +16 -3
  162. package/src/actions/intervals/revision.js +126 -0
  163. package/src/actions/marks/arc/actions.js +80 -22
  164. package/src/actions/marks/area/actions.js +38 -13
  165. package/src/actions/marks/area/materialize.js +17 -1
  166. package/src/actions/marks/bar/create.js +12 -3
  167. package/src/actions/marks/bar/edit.js +21 -4
  168. package/src/actions/marks/bar/materialize.js +34 -40
  169. package/src/actions/marks/index.js +10 -1
  170. package/src/actions/marks/line/actions.js +40 -17
  171. package/src/actions/marks/line/materialize.js +29 -10
  172. package/src/actions/marks/point/create.js +9 -3
  173. package/src/actions/marks/point/edit.js +19 -7
  174. package/src/actions/marks/point/jitter.js +6 -8
  175. package/src/actions/marks/point/materialize.js +48 -22
  176. package/src/actions/marks/point/packing.js +6 -8
  177. package/src/actions/marks/rect/actions.js +36 -15
  178. package/src/actions/marks/references.js +602 -33
  179. package/src/actions/marks/remove.js +67 -41
  180. package/src/actions/marks/rule/actions.js +51 -14
  181. package/src/actions/marks/shared.js +1 -1
  182. package/src/actions/marks/text/actions.js +79 -14
  183. package/src/actions/marks/text/index.js +4 -0
  184. package/src/actions/marks/text/layout.js +157 -17
  185. package/src/actions/marks/text/removal.js +173 -0
  186. package/src/actions/marks/text/selection.js +72 -0
  187. package/src/actions/marks/tick/actions.js +25 -8
  188. package/src/actions/primitives/createGraphics.js +5 -4
  189. package/src/actions/primitives/editGraphics.js +31 -4
  190. package/src/actions/primitives/graphicProperties.js +6 -0
  191. package/src/actions/primitives/semantic.js +11 -3
  192. package/src/actions/primitives/semanticAction.js +90 -14
  193. package/src/actions/primitives/semanticValidation/dataset.js +2 -4
  194. package/src/actions/primitives/semanticValidation/guide.js +1 -1
  195. package/src/actions/primitives/semanticValidation/index.js +9 -1
  196. package/src/actions/primitives/semanticValidation/layer.js +5 -0
  197. package/src/actions/primitives/semanticValidation/scale.js +28 -7
  198. package/src/actions/regression/components.js +36 -25
  199. package/src/actions/regression/create.js +13 -6
  200. package/src/actions/regression/edit.js +24 -11
  201. package/src/actions/resources/index.js +7 -0
  202. package/src/actions/resources/remove.js +173 -0
  203. package/src/actions/scales/channels.js +212 -0
  204. package/src/actions/scales/consumers/common.js +1 -1
  205. package/src/actions/scales/consumers/families.js +3 -2
  206. package/src/actions/scales/consumers/index.js +19 -2
  207. package/src/actions/scales/consumers/seriesLayout.js +28 -14
  208. package/src/actions/scales/create.js +55 -23
  209. package/src/actions/scales/definitions.js +94 -40
  210. package/src/actions/scales/edit.js +67 -12
  211. package/src/actions/scales/editPolicy.js +81 -11
  212. package/src/actions/scales/index.js +6 -0
  213. package/src/actions/scales/materialize.js +5 -4
  214. package/src/actions/scales/offset.js +48 -0
  215. package/src/actions/scales/parallel.js +71 -0
  216. package/src/actions/scales/preview.js +111 -10
  217. package/src/actions/scales/quantitativeColor.js +4 -5
  218. package/src/actions/selection/actions.js +179 -66
  219. package/src/actions/selection/index.js +3 -0
  220. package/src/actions/textMetrics/index.js +56 -0
  221. package/src/actions/theme/actions.js +70 -15
  222. package/src/actions/theme/composition.js +238 -0
  223. package/src/actions/theme/index.js +9 -2
  224. package/src/actions/theme/reconcile.js +313 -121
  225. package/src/actions/theme/state.js +160 -0
  226. package/src/actions/titles/actions.js +8 -8
  227. package/src/actions/titles/resolve.js +3 -3
  228. package/src/actions/violinPlots/create.js +6 -3
  229. package/src/actions/violinPlots/edit.js +2 -1
  230. package/src/core/action.js +117 -35
  231. package/src/core/compositionState.js +6 -1
  232. package/src/core/diagnostics.js +16 -0
  233. package/src/core/extensionRegistry.js +27 -0
  234. package/src/core/font.js +18 -0
  235. package/src/core/identifiers.js +5 -4
  236. package/src/core/immutable.js +10 -3
  237. package/src/core/optionRequirements.js +8 -0
  238. package/src/core/programState.js +21 -1
  239. package/src/core/resourceReferences.js +341 -0
  240. package/src/core/textMetricProfile.js +28 -0
  241. package/src/core/textMetrics.js +24 -3
  242. package/src/core/validation.js +22 -10
  243. package/src/core/vocabulary.js +16 -3
  244. package/src/diagnostics.js +1 -0
  245. package/src/grammar/bars/aggregate.js +4 -1
  246. package/src/grammar/bars/geometry.js +44 -0
  247. package/src/grammar/bin.js +54 -9
  248. package/src/grammar/complete.js +279 -0
  249. package/src/grammar/computed.js +265 -64
  250. package/src/grammar/coordinates.js +37 -0
  251. package/src/grammar/density.js +239 -37
  252. package/src/grammar/displayLabels.js +57 -0
  253. package/src/grammar/facets/dependencies.js +133 -1
  254. package/src/grammar/facets/guides.js +3 -0
  255. package/src/grammar/facets/index.js +7 -47
  256. package/src/grammar/facets/scales.js +15 -18
  257. package/src/grammar/impute.js +341 -0
  258. package/src/grammar/markLabelSelection.js +57 -0
  259. package/src/grammar/markLabels.js +18 -1
  260. package/src/grammar/normalize.js +366 -0
  261. package/src/grammar/pathSeries.js +26 -8
  262. package/src/grammar/pointShapes.js +13 -4
  263. package/src/grammar/polar.js +90 -8
  264. package/src/grammar/regression/index.js +1 -0
  265. package/src/grammar/regression/parameters.js +23 -0
  266. package/src/grammar/roundedRect.js +180 -0
  267. package/src/grammar/rules.js +1 -0
  268. package/src/grammar/scales/colorConsumers.js +20 -1
  269. package/src/grammar/scales/continuous.js +2 -2
  270. package/src/grammar/scales/definition.js +27 -4
  271. package/src/grammar/scales/index.js +1 -0
  272. package/src/grammar/scales/ordinal.js +12 -3
  273. package/src/grammar/scales/policies.js +2 -2
  274. package/src/grammar/scales/size.js +456 -0
  275. package/src/grammar/scales/types.js +8 -0
  276. package/src/grammar/schemas/concreteGraphic.js +14 -2
  277. package/src/grammar/schemas/graphic.js +15 -0
  278. package/src/grammar/schemas/graphicBounds.js +190 -41
  279. package/src/grammar/schemas/semanticPath.js +7 -2
  280. package/src/grammar/statisticalReference.js +103 -0
  281. package/src/grammar/strokeStyle.js +77 -0
  282. package/src/grammar/summary.js +78 -16
  283. package/src/grammar/timeUnit.js +216 -5
  284. package/src/grammar/transformTopology.js +4 -0
  285. package/src/grammar/transforms.js +394 -28
  286. package/src/grammar/weightedStatistics.js +374 -0
  287. package/src/grammar/window.js +221 -16
  288. package/src/layout/aspect.js +80 -0
  289. package/src/layout/facets.js +59 -5
  290. package/src/layout/labels.js +351 -7
  291. package/src/layout/legend.js +4 -4
  292. package/src/layout/legendItems.js +6 -6
  293. package/src/layout/text.js +10 -9
  294. package/src/layout/title.js +9 -9
  295. package/src/materialization/bars/aggregate.js +25 -2
  296. package/src/materialization/bars/histogram.js +84 -24
  297. package/src/materialization/bars/ranged.js +19 -3
  298. package/src/materialization/bars/resolve.js +7 -4
  299. package/src/materialization/composition.js +3 -1
  300. package/src/materialization/coordinateBounds.js +204 -0
  301. package/src/materialization/dependencies.js +36 -0
  302. package/src/materialization/facetGuides/legacyCategorical.js +3 -0
  303. package/src/materialization/facetGuides/placement.js +9 -3
  304. package/src/materialization/facetGuides/preparation.js +13 -8
  305. package/src/materialization/facetHeaders.js +347 -0
  306. package/src/materialization/facets.js +15 -65
  307. package/src/materialization/guides/layout.js +3 -3
  308. package/src/materialization/guides/resources.js +26 -0
  309. package/src/materialization/legends.js +1 -1
  310. package/src/materialization/marks/index.js +11 -5
  311. package/src/materialization/marks/policies.js +2 -1
  312. package/src/materialization/rect.js +25 -12
  313. package/src/materialization/rectConfig.js +5 -1
  314. package/src/materialization/scaleGuideDependencies.js +10 -0
  315. package/src/materialization/scales/map.js +5 -3
  316. package/src/materialization/scales/policies/binnedPosition.js +2 -2
  317. package/src/materialization/scales/policies/offset.js +50 -8
  318. package/src/materialization/scales/policies/series.js +4 -1
  319. package/src/materialization/scales/resolve.js +22 -6
  320. package/src/materialization/selection/items/arc.js +28 -4
  321. package/src/materialization/selection/items/bar.js +30 -3
  322. package/src/materialization/selection/items/common.js +20 -5
  323. package/src/materialization/selection/items/rect.js +28 -4
  324. package/src/materialization/selection/path.js +1 -1
  325. package/src/materialization/selection/point.js +3 -1
  326. package/src/materialization/text.js +265 -14
  327. package/src/materialization/typography.js +31 -0
  328. package/src/mcp/cli.js +5 -3
  329. package/src/persistence/codec.js +65 -0
  330. package/src/persistence/validation.js +185 -0
  331. package/src/persistence.js +74 -0
  332. package/src/renderers/canvas/circle.js +2 -3
  333. package/src/renderers/canvas/index.js +5 -4
  334. package/src/renderers/canvas/line.js +2 -3
  335. package/src/renderers/canvas/native.js +4 -4
  336. package/src/renderers/canvas/path.js +2 -3
  337. package/src/renderers/canvas/rect.js +2 -3
  338. package/src/renderers/canvas/stroke.js +11 -0
  339. package/src/renderers/nativeBackend.js +10 -0
  340. package/src/renderers/options.js +13 -0
  341. package/src/renderers/pdf.js +25 -54
  342. package/src/renderers/png.js +22 -17
  343. package/src/renderers/svg.js +29 -14
  344. package/src/renderers/text.js +1 -11
  345. package/src/selectors/coordinates.js +3 -1
  346. package/src/selectors/datasets.js +38 -5
  347. package/src/selectors/layers.js +10 -4
  348. package/src/selectors/markOwners.js +46 -0
  349. package/src/selectors/scales.js +6 -4
  350. package/src/theme/defaults.js +103 -1
  351. package/src/version.js +2 -0
  352. package/types/accessibility.d.ts +37 -0
  353. package/types/basic.d.ts +10 -2
  354. package/types/diagnostics.d.ts +15 -0
  355. package/types/index.d.ts +90 -0
  356. package/types/pdf.d.ts +9 -0
  357. package/types/persistence.d.ts +7 -0
  358. package/types/png.d.ts +9 -0
  359. package/types/program.d.ts +944 -118
@@ -1,9 +1,48 @@
1
1
  import type { RegisteredExtensionActions } from "./extension.js";
2
2
 
3
3
  export type TemporalInputUnit = "auto" | "year" | "timestamp";
4
+ export type TextMetricFontWeight = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
5
+ export interface TextMeasurement {
6
+ readonly text: string;
7
+ readonly fontFamily: string;
8
+ readonly fontSize: number;
9
+ readonly fontWeight: TextMetricFontWeight;
10
+ readonly width: number;
11
+ }
12
+ export interface TextMetricsProfile {
13
+ readonly schemaVersion: 1;
14
+ readonly id: string;
15
+ readonly measurements: readonly TextMeasurement[];
16
+ }
17
+ export interface ApplyTextMetricsOptions { profile: TextMetricsProfile; }
18
+
4
19
  export type ThemeName = "light" | "dark";
20
+ export interface ThemeTokens {
21
+ background: string;
22
+ mark: string;
23
+ text: string;
24
+ strongText: string;
25
+ mutedText: string;
26
+ axis: string;
27
+ axisTitle: string;
28
+ grid: string;
29
+ border: string;
30
+ sizeSymbol: string;
31
+ regressionBand: string;
32
+ boxLine: string;
33
+ boxMedian: string;
34
+ referenceLine: string;
35
+ referenceBand: string;
36
+ gradientCenter: string;
37
+ highlight: string;
38
+ fontFamily: string;
39
+ }
40
+ export type ThemeDefinition =
41
+ | ThemeName
42
+ | { base: ThemeName; tokens: Partial<ThemeTokens> };
5
43
  export interface ApplyThemeOptions {
6
- theme: ThemeName;
44
+ theme: ThemeDefinition;
45
+ scope?: "self" | "descendants";
7
46
  }
8
47
  export type FieldType = "quantitative" | "temporal" | "ordinal" | "nominal";
9
48
  export type GraphicType =
@@ -144,11 +183,15 @@ export interface FacetScaleResolutions {
144
183
  y?: FacetScaleResolution;
145
184
  xOffset?: FacetScaleResolution;
146
185
  yOffset?: FacetScaleResolution;
186
+ theta?: FacetScaleResolution;
187
+ r?: FacetScaleResolution;
147
188
  color?: FacetScaleResolution;
189
+ stroke?: FacetScaleResolution;
148
190
  size?: FacetScaleResolution;
149
191
  shape?: FacetScaleResolution;
150
192
  opacity?: FacetScaleResolution;
151
193
  strokeDash?: FacetScaleResolution;
194
+ parallelDimensions?: FacetScaleResolution;
152
195
  }
153
196
  export interface FacetGuideOptions {
154
197
  axes?: "each" | "outer";
@@ -185,7 +228,7 @@ export interface FacetGridOptions {
185
228
  export interface RepeatChartsOptions {
186
229
  id?: string;
187
230
  target?: string;
188
- channel: "x" | "y";
231
+ channel: "x" | "y" | "theta" | "r" | { parallelDimension: string };
189
232
  fields: readonly [string, ...string[]];
190
233
  columns?: number;
191
234
  gap?: number;
@@ -201,7 +244,14 @@ export interface EditFacetHeadersOptions {
201
244
  fontWeight?: string | number;
202
245
  color?: string;
203
246
  offset?: number;
204
- }
247
+ role?: FacetHeaderRole;
248
+ labelMap?: DisplayLabelMap | "auto";
249
+ side?: FacetHeaderSide;
250
+ align?: FacetHeaderAlign;
251
+ }
252
+ export type FacetHeaderRole = "all" | "row" | "column";
253
+ export type FacetHeaderSide = "top" | "bottom" | "left" | "right";
254
+ export type FacetHeaderAlign = "start" | "center" | "end";
205
255
  export interface ConcatCompositionSpec {
206
256
  readonly id: string;
207
257
  readonly direction: "horizontal" | "vertical";
@@ -237,7 +287,7 @@ export interface FacetCompositionSpec {
237
287
  };
238
288
  readonly repeat?: {
239
289
  readonly target: string;
240
- readonly channel: "x" | "y";
290
+ readonly channel: "x" | "y" | "theta" | "r" | { readonly parallelDimension: string };
241
291
  readonly fields: readonly string[];
242
292
  };
243
293
  readonly scales: Readonly<Required<FacetScaleResolutions>>;
@@ -254,6 +304,10 @@ export type DensityKernel =
254
304
  | "uniform"
255
305
  | "triangular";
256
306
  export type DensityNormalization = "unit" | "count";
307
+ export interface StatisticalWeight {
308
+ readonly field: string;
309
+ readonly kind: "frequency" | "reliability";
310
+ }
257
311
  export type DensityPlacementSide =
258
312
  | "both"
259
313
  | "left"
@@ -300,6 +354,13 @@ export type FilterDataOptions = {
300
354
  field: string;
301
355
  } & FilterModeOptions;
302
356
  export type DatasetScalar = string | number | boolean | null;
357
+ export type DisplayLabelMap = ReadonlyArray<Readonly<{
358
+ value: DatasetScalar;
359
+ label: string;
360
+ }>>;
361
+ export interface DisplayLabelOptions {
362
+ labelMap?: DisplayLabelMap | "auto";
363
+ }
303
364
  export type DatasetFilterTransform = {
304
365
  type: "filter";
305
366
  field: string;
@@ -351,6 +412,7 @@ export interface DatasetDensityTransform {
351
412
  steps: number;
352
413
  kernel?: DensityKernel;
353
414
  normalization?: DensityNormalization;
415
+ weight?: StatisticalWeight;
354
416
  as: readonly [string, string];
355
417
  resolve: "shared";
356
418
  placement?: {
@@ -368,10 +430,22 @@ export interface DatasetDensityTransform {
368
430
  };
369
431
  };
370
432
  resolved?: {
371
- readonly bandwidth: number;
372
433
  readonly extent: readonly [number, number];
373
434
  readonly splitDomain?: readonly [unknown, unknown];
374
- };
435
+ } & (
436
+ | {
437
+ readonly bandwidth: number;
438
+ readonly bandwidths?: never;
439
+ }
440
+ | {
441
+ readonly bandwidth?: never;
442
+ readonly bandwidths: readonly {
443
+ readonly group?: unknown;
444
+ readonly split?: unknown;
445
+ readonly bandwidth: number;
446
+ }[];
447
+ }
448
+ );
375
449
  }
376
450
  export type HorizonResolution = "shared" | "independent";
377
451
  export type HorizonMissingPolicy = "break" | "error";
@@ -451,6 +525,22 @@ export interface WindowSort {
451
525
  field: string;
452
526
  order?: WindowSortOrder;
453
527
  }
528
+ export type RowWindowFrame = {
529
+ preceding: number;
530
+ following?: number;
531
+ duration?: never;
532
+ };
533
+ export type DurationWindowUnit = "millisecond" | "second" | "minute" | "hour" | "day";
534
+ export type DurationWindowFrame = {
535
+ preceding?: never;
536
+ following?: never;
537
+ duration: {
538
+ preceding: number;
539
+ following?: number;
540
+ unit: DurationWindowUnit;
541
+ };
542
+ };
543
+ export type WindowFrame = RowWindowFrame | DurationWindowFrame;
454
544
  export type WindowOperation =
455
545
  | { op: "rowNumber" | "rank" | "denseRank"; as: string }
456
546
  | { op: "cumulativeSum"; field: string; as: string }
@@ -465,10 +555,9 @@ export type WindowOperation =
465
555
  op: "movingMean" | "movingSum";
466
556
  field: string;
467
557
  as: string;
468
- frame: {
469
- preceding: number;
470
- following?: number;
471
- };
558
+ frame: WindowFrame;
559
+ minPeriods?: number;
560
+ missing?: "error" | "skip";
472
561
  };
473
562
  export interface DatasetWindowSort {
474
563
  readonly field: string;
@@ -492,16 +581,27 @@ export type DatasetWindowOperation =
492
581
  readonly op: "movingMean" | "movingSum";
493
582
  readonly field: string;
494
583
  readonly as: string;
495
- readonly frame: {
496
- readonly preceding: number;
497
- readonly following: number;
498
- };
584
+ readonly frame:
585
+ | {
586
+ readonly preceding: number;
587
+ readonly following: number;
588
+ }
589
+ | {
590
+ readonly duration: {
591
+ readonly preceding: number;
592
+ readonly following: number;
593
+ readonly unit: DurationWindowUnit;
594
+ };
595
+ };
596
+ readonly minPeriods: number;
597
+ readonly missing: "error" | "skip";
499
598
  };
500
599
  export interface DatasetWindowTransform {
501
600
  readonly type: "window";
502
601
  readonly partitionBy: readonly string[];
503
602
  readonly sortBy: readonly DatasetWindowSort[];
504
603
  readonly operations: readonly DatasetWindowOperation[];
604
+ readonly temporalUnit?: TemporalInputUnit;
505
605
  }
506
606
  export interface ECDFOutputFields {
507
607
  value: string;
@@ -531,14 +631,28 @@ export type TimeUnit =
531
631
  | "day"
532
632
  | "hour"
533
633
  | "minute"
534
- | "second";
535
- export interface DatasetTimeUnitTransform {
634
+ | "second"
635
+ | "week"
636
+ | "weekday";
637
+ type DatasetTimeUnitTransformBase = {
536
638
  readonly type: "timeUnit";
537
639
  readonly field: string;
538
- readonly unit: TimeUnit;
539
640
  readonly temporalUnit?: TemporalInputUnit;
540
641
  readonly as: string;
541
- }
642
+ readonly timeZone?: string;
643
+ };
644
+ export type DatasetTimeUnitTransform = DatasetTimeUnitTransformBase & (
645
+ | {
646
+ readonly unit: Exclude<TimeUnit, "week">;
647
+ readonly weekStartsOn?: never;
648
+ readonly weekRule?: never;
649
+ }
650
+ | {
651
+ readonly unit: "week";
652
+ readonly weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6;
653
+ readonly weekRule: "calendar" | "iso";
654
+ }
655
+ );
542
656
  export interface Bin2DCounts {
543
657
  x: number;
544
658
  y: number;
@@ -600,6 +714,7 @@ export interface DatasetBinTransform {
600
714
  readonly zero: boolean;
601
715
  readonly includeEmpty: boolean;
602
716
  readonly members: boolean;
717
+ readonly weight?: StatisticalWeight;
603
718
  readonly as: {
604
719
  readonly lower: string;
605
720
  readonly upper: string;
@@ -622,21 +737,111 @@ export interface DatasetFoldTransform {
622
737
  }
623
738
  export type ComputedExpression =
624
739
  | { readonly field: string }
625
- | { readonly constant: number }
740
+ | { readonly constant: number | string | boolean | null }
626
741
  | {
627
- readonly op: "negate" | "absolute";
742
+ readonly op: "negate" | "absolute" | "log" | "sqrt" | "not" | "isNull";
628
743
  readonly operand: ComputedExpression;
629
744
  }
630
745
  | {
631
- readonly op: "add" | "subtract" | "multiply" | "divide";
746
+ readonly op: "add" | "subtract" | "multiply" | "divide" |
747
+ "eq" | "neq" | "lt" | "lte" | "gt" | "gte";
632
748
  readonly left: ComputedExpression;
633
749
  readonly right: ComputedExpression;
750
+ }
751
+ | {
752
+ readonly op: "and" | "or" | "coalesce";
753
+ readonly operands: readonly [ComputedExpression, ComputedExpression, ...ComputedExpression[]];
754
+ }
755
+ | {
756
+ readonly op: "concat";
757
+ readonly operands: readonly [ComputedExpression, ...ComputedExpression[]];
758
+ }
759
+ | {
760
+ readonly op: "if";
761
+ readonly condition: ComputedExpression;
762
+ readonly then: ComputedExpression;
763
+ readonly else: ComputedExpression;
634
764
  };
635
765
  export interface DatasetComputedTransform {
636
766
  readonly type: "computed";
637
767
  readonly as: string;
638
768
  readonly expression: ComputedExpression;
639
769
  }
770
+ export type NormalizeMethod =
771
+ | "share"
772
+ | "zscore"
773
+ | "minmax"
774
+ | "index"
775
+ | "change"
776
+ | "percentChange";
777
+ export type NormalizeZeroDenominator = "error" | "null" | "zero";
778
+ export type NormalizeBaseline =
779
+ | { readonly position: "first" | "last" }
780
+ | { readonly value: number };
781
+ type DatasetNormalizedBaseTransform = {
782
+ readonly type: "normalize";
783
+ readonly field: string;
784
+ readonly as: string;
785
+ readonly groupBy: readonly string[];
786
+ };
787
+ type DatasetNormalizeBaselineTransform = {
788
+ readonly baseline: NormalizeBaseline;
789
+ readonly sortBy: readonly WindowSort[];
790
+ };
791
+ export type DatasetNormalizedTransform = DatasetNormalizedBaseTransform & (
792
+ | {
793
+ readonly method: "share" | "minmax";
794
+ readonly zeroDenominator: NormalizeZeroDenominator;
795
+ }
796
+ | {
797
+ readonly method: "zscore";
798
+ readonly variance: "population" | "sample";
799
+ readonly zeroDenominator: NormalizeZeroDenominator;
800
+ }
801
+ | ({
802
+ readonly method: "index" | "percentChange";
803
+ readonly zeroDenominator: NormalizeZeroDenominator;
804
+ } & DatasetNormalizeBaselineTransform)
805
+ | ({ readonly method: "change" } & DatasetNormalizeBaselineTransform)
806
+ );
807
+ export type DatasetCompleteTransform = {
808
+ readonly type: "complete";
809
+ readonly key: string;
810
+ readonly groupBy: readonly string[];
811
+ readonly fill: Readonly<Record<string, DatasetScalar>>;
812
+ readonly members?: string;
813
+ } & (
814
+ | { readonly values: readonly DatasetScalar[]; readonly sequence?: never }
815
+ | {
816
+ readonly sequence: { readonly start: number; readonly end: number; readonly step: number };
817
+ readonly values?: never;
818
+ }
819
+ | { readonly values?: never; readonly sequence?: never }
820
+ );
821
+ type DatasetImputedBaseTransform = {
822
+ readonly type: "impute";
823
+ readonly fields: readonly string[];
824
+ readonly groupBy: readonly string[];
825
+ readonly edges: "keep" | "error";
826
+ readonly maxGap?: number;
827
+ };
828
+ export type DatasetImputedTransform = DatasetImputedBaseTransform & (
829
+ | {
830
+ readonly method: "constant";
831
+ readonly value: DatasetScalar;
832
+ readonly sortBy: readonly DatasetWindowSort[];
833
+ }
834
+ | {
835
+ readonly method: "forward" | "backward";
836
+ readonly value?: never;
837
+ readonly sortBy: readonly [DatasetWindowSort, ...DatasetWindowSort[]];
838
+ }
839
+ | {
840
+ readonly method: "linear";
841
+ readonly value?: never;
842
+ readonly sortBy: readonly [{ readonly field: string; readonly order: "ascending" }];
843
+ }
844
+ );
640
845
  export type StackDataMode = "stack" | "fill" | "center" | "diverging";
641
846
  export interface StackDataOutputFields {
642
847
  start?: string;
@@ -652,10 +857,17 @@ export interface DatasetStackTransform {
652
857
  readonly mode: StackDataMode;
653
858
  readonly as: Required<StackDataOutputFields>;
654
859
  }
860
+ interface DatasetStatisticalReferenceTransform {
861
+ readonly type: "statisticalReference";
862
+ readonly target: string;
863
+ }
655
864
  export type DatasetTransform =
656
865
  | DatasetBinTransform
657
866
  | DatasetBin2DTransform
867
+ | DatasetCompleteTransform
658
868
  | DatasetComputedTransform
869
+ | DatasetImputedTransform
870
+ | DatasetNormalizedTransform
659
871
  | DatasetFilterTransform
660
872
  | DatasetFoldTransform
661
873
  | DatasetRegressionTransform
@@ -665,8 +877,20 @@ export type DatasetTransform =
665
877
  | DatasetIntervalTransform
666
878
  | DatasetSummaryTransform
667
879
  | DatasetStackTransform
880
+ | DatasetStatisticalReferenceTransform
668
881
  | DatasetTimeUnitTransform
669
882
  | DatasetWindowTransform;
883
+ type RequestedTransform<T> = T extends unknown ? Omit<T, "resolved"> : never;
884
+ export type RequestedDatasetTransform = RequestedTransform<Exclude<
885
+ DatasetTransform,
886
+ DatasetHorizonTransform | DatasetStatisticalReferenceTransform
887
+ >>;
888
+ export type DerivedDataDependents = "reject" | "recompute";
889
+ export interface EditDerivedDataOptions {
890
+ target: string;
891
+ definition: RequestedDatasetTransform;
892
+ dependents?: DerivedDataDependents;
893
+ }
670
894
  export interface CreateDerivedDataOptions {
671
895
  id: string;
672
896
  source: string;
@@ -677,6 +901,7 @@ export interface DatasetSummaryTransform {
677
901
  groupBy: readonly string[];
678
902
  aggregates: readonly SummaryAggregateOptions[];
679
903
  members?: string;
904
+ weight?: StatisticalWeight;
680
905
  }
681
906
  export interface SummaryAggregateOptions {
682
907
  op: AggregateOperation;
@@ -689,11 +914,16 @@ export interface SummaryDataOptions {
689
914
  groupBy?: string | readonly string[];
690
915
  aggregates: readonly SummaryAggregateOptions[];
691
916
  members?: string;
917
+ weight?: StatisticalWeight;
692
918
  }
693
919
  export interface BindMarkDataOptions {
694
920
  target: string;
695
921
  data: string;
696
922
  }
923
+
924
+ export interface RemoveResourceOptions {
925
+ readonly id: string;
926
+ }
697
927
  export type MarkGraphicProperty =
698
928
  | "x" | "y" | "width" | "height" | "radius"
699
929
  | "x1" | "y1" | "x2" | "y2"
@@ -702,7 +932,7 @@ export type MarkSelector = {
702
932
  grain?: "item" | "stack";
703
933
  } & (
704
934
  | { field: string; channel?: never; property?: never }
705
- | { channel: "x" | "y" | "x2" | "y2" | "xOffset" | "yOffset" | "theta" | "radius" | "color" | "strokeDash" | "strokeWidth" | "size" | "shape" | "group" | "opacity"; field?: never; property?: never }
935
+ | { channel: "x" | "y" | "x2" | "y2" | "xOffset" | "yOffset" | "theta" | "radius" | "color" | "stroke" | "strokeDash" | "strokeWidth" | "size" | "shape" | "group" | "opacity"; field?: never; property?: never }
706
936
  | { property: MarkGraphicProperty; field?: never; channel?: never }
707
937
  ) & (
708
938
  | { op: "eq" | "neq" | "gt" | "gte" | "lt" | "lte"; value: unknown }
@@ -804,6 +1034,14 @@ export type PointShape =
804
1034
  | "star"
805
1035
  | "hexagon"
806
1036
  | "wye";
1037
+ export type StrokeStyleDetails = {
1038
+ lineCap?: "butt" | "round" | "square";
1039
+ lineJoin?: "miter" | "round" | "bevel";
1040
+ miterLimit?: number;
1041
+ };
1042
+ export type RectStyleDetails = StrokeStyleDetails & {
1043
+ cornerRadius?: number;
1044
+ };
807
1045
  export type PaletteName =
808
1046
  | "accent"
809
1047
  | "category10" | "category20" | "category20b" | "category20c"
@@ -834,6 +1072,11 @@ export type ScaleRange = "auto" | readonly unknown[] | {
834
1072
  readonly palette: Palette;
835
1073
  };
836
1074
  export type ActionOptions = Record<string, unknown>;
1075
+ /**
1076
+ * One semantic assignment or removal. Complete unreferenced source datasets and
1077
+ * coordinates can be removed; source values remain immutable. Domain removal
1078
+ * actions own full resource/configuration lifecycle checks and cleanup.
1079
+ */
837
1080
  export type EditSemanticOptions =
838
1081
  | { property: string; value: unknown; remove?: false }
839
1082
  | { property: string; remove: true; value?: never };
@@ -878,7 +1121,9 @@ export interface SemanticScale {
878
1121
 
879
1122
  export interface SemanticCoordinate {
880
1123
  readonly id: string;
881
- readonly type?: "cartesian" | "polar";
1124
+ readonly type?: "cartesian" | "polar" | "parallel";
1125
+ readonly aspect?: CoordinateAspect;
1126
+ readonly polarFrame?: Exclude<PolarFrameOptions, "auto">;
882
1127
  readonly layers?: readonly string[];
883
1128
  readonly [key: string]: unknown;
884
1129
  }
@@ -976,7 +1221,7 @@ export interface AxisTicksAndLabelsOptions<P extends string> {
976
1221
  count?: number;
977
1222
  values?: readonly AxisValue[];
978
1223
  ticks?: AxisTickStyleOptions;
979
- labels?: AxisLabelStyleOptions & AxisLabelLayoutOptions;
1224
+ labels?: AxisLabelStyleOptions & AxisLabelLayoutOptions & DisplayLabelOptions;
980
1225
  }
981
1226
  export interface AxisTitleOptions<P extends string> {
982
1227
  text?: string;
@@ -1016,7 +1261,7 @@ export interface AxisTickOptions<P extends string>
1016
1261
  values?: readonly AxisValue[];
1017
1262
  }
1018
1263
  export interface AxisLabelOptions<P extends string>
1019
- extends AxisLabelStyleOptions, AxisLabelLayoutOptions {
1264
+ extends AxisLabelStyleOptions, AxisLabelLayoutOptions, DisplayLabelOptions {
1020
1265
  scale?: string;
1021
1266
  position?: P;
1022
1267
  count?: number;
@@ -1072,6 +1317,11 @@ export interface PolarTicksAndLabelsOptions {
1072
1317
  ticks?: AxisTickStyleOptions;
1073
1318
  labels?: AxisLabelStyleOptions;
1074
1319
  }
1320
+ export type ThetaAxisLabelOptions = PolarLabelOptions & DisplayLabelOptions;
1321
+ export interface ThetaTicksAndLabelsOptions
1322
+ extends Omit<PolarTicksAndLabelsOptions, "labels"> {
1323
+ labels?: AxisLabelStyleOptions & DisplayLabelOptions;
1324
+ }
1075
1325
  export interface PolarTitleOptions {
1076
1326
  text?: string;
1077
1327
  offset?: number;
@@ -1094,7 +1344,8 @@ export type CreateThetaAxisTicksOptions = Omit<PolarTickOptions, "count" | "valu
1094
1344
  export type CreateRadialAxisTicksOptions = Omit<PolarTickOptions, "count" | "values"> &
1095
1345
  PolarAxisTickSelection & PolarGuideResourceOptions;
1096
1346
  export type CreateThetaAxisLabelsOptions = Omit<PolarLabelOptions, "count" | "values"> &
1097
- PolarAxisTickSelection & Omit<PolarGuideResourceOptions, "angle">;
1347
+ PolarAxisTickSelection & Omit<PolarGuideResourceOptions, "angle"> &
1348
+ DisplayLabelOptions;
1098
1349
  export type CreateRadialAxisLabelsOptions = Omit<PolarLabelOptions, "count" | "values"> &
1099
1350
  PolarAxisTickSelection & PolarGuideResourceOptions;
1100
1351
  export type CreateThetaAxisTitleOptions = PolarTitleOptions &
@@ -1105,6 +1356,10 @@ export interface CompletePolarAxisOptions extends Omit<PolarGuideResourceOptions
1105
1356
  ticksAndLabels?: false | PolarTicksAndLabelsOptions;
1106
1357
  title?: false | PolarTitleOptions;
1107
1358
  }
1359
+ export interface CompleteThetaAxisOptions
1360
+ extends Omit<CompletePolarAxisOptions, "ticksAndLabels"> {
1361
+ ticksAndLabels?: false | ThetaTicksAndLabelsOptions;
1362
+ }
1108
1363
  export interface CompleteRadialAxisOptions
1109
1364
  extends Omit<CompletePolarAxisOptions, "title"> {
1110
1365
  angle?: number;
@@ -1118,6 +1373,11 @@ export interface EditPolarAxisOptions {
1118
1373
  ticksAndLabels?: false | PolarTicksAndLabelsOptions;
1119
1374
  title?: false | PolarTitleOptions;
1120
1375
  }
1376
+ export interface EditThetaAxisOptions
1377
+ extends Omit<EditPolarAxisOptions, "angle" | "labels" | "ticksAndLabels"> {
1378
+ labels?: false | ThetaAxisLabelOptions;
1379
+ ticksAndLabels?: false | ThetaTicksAndLabelsOptions;
1380
+ }
1121
1381
  export interface EditRadialAxisOptions
1122
1382
  extends Omit<EditPolarAxisOptions, "title"> {
1123
1383
  title?: false | RadialTitleOptions;
@@ -1180,6 +1440,16 @@ type CartesianAxesOptions = Omit<
1180
1440
  > & {
1181
1441
  coordinate?: { id?: string; type?: "auto" | "cartesian" };
1182
1442
  };
1443
+ type CAxisTicks<P extends string> = Omit<AxisTicksAndLabelsOptions<P>, "labels"> & {
1444
+ labels?: AxisLabelStyleOptions & AxisLabelLayoutOptions;
1445
+ };
1446
+ type CAxis<P extends string> = Omit<CompleteAxisOptions<P>, "ticksAndLabels"> & {
1447
+ ticksAndLabels?: false | Omit<CAxisTicks<P>, "scale" | "position">;
1448
+ };
1449
+ type CAxes = Omit<CartesianAxesOptions, "x" | "y"> & {
1450
+ x?: false | CAxis<XAxisPosition>;
1451
+ y?: false | CAxis<YAxisPosition>;
1452
+ };
1183
1453
  type CartesianGridOptions = Pick<CreateGridOptions, "horizontal" | "vertical">;
1184
1454
  type FilledMarkLegendOptions = Omit<LegendOptions, "symbol"> & {
1185
1455
  symbol?: "auto"
@@ -1194,7 +1464,10 @@ type CategoricalLegendTextOptions = {
1194
1464
  fontWeight?: string | number;
1195
1465
  format?: "auto";
1196
1466
  };
1197
- type PathLegendOptions = Omit<LegendOptions, "symbol" | "gradient" | "count" | "labels"> & {
1467
+ type PathLegendOptions = Omit<
1468
+ LegendOptions,
1469
+ "symbol" | "gradient" | "count" | "values" | "labels"
1470
+ > & {
1198
1471
  symbol?: "auto" | { length?: number; lineWidth?: number }
1199
1472
  | { layers: readonly LegendSymbolLayer[] };
1200
1473
  labels?: CategoricalLegendTextOptions;
@@ -1210,12 +1483,23 @@ type CartesianPathGuideOptions = Omit<CartesianGuideOptions, "legend"> & {
1210
1483
  type CartesianCategoricalGuideOptions = Omit<CartesianGuideOptions, "legend"> & {
1211
1484
  legend?: false | (Omit<
1212
1485
  FilledMarkLegendOptions,
1213
- "count" | "gradient" | "labels" | "order"
1486
+ "count" | "values" | "gradient" | "labels" | "order"
1214
1487
  > & {
1215
1488
  labels?: CategoricalLegendTextOptions;
1216
1489
  order?: CartesianLegendOrder;
1217
1490
  });
1218
1491
  };
1492
+ type CPathGuides = Omit<CartesianPathGuideOptions, "axes"> & {
1493
+ axes?: false | CAxes;
1494
+ };
1495
+ type CCategoricalGuides = Omit<CartesianCategoricalGuideOptions, "axes"> & {
1496
+ axes?: false | CAxes;
1497
+ };
1498
+ type ColorGuides = Omit<CartesianGuideOptions, "legend"> & {
1499
+ legend?: false | (Omit<FilledMarkLegendOptions, "values" | "order"> & {
1500
+ order?: CartesianLegendOrder;
1501
+ });
1502
+ };
1219
1503
  type BoxPlotGuideOptions = Omit<CartesianGuideOptions, "legend"> & { legend?: false };
1220
1504
  type GradientPlotDensityLegendOptions = {
1221
1505
  title?: string;
@@ -1238,6 +1522,34 @@ export interface CreateCoordinateOptions {
1238
1522
  layers?: readonly string[];
1239
1523
  }
1240
1524
 
1525
+ export type CoordinateAspectAlign = "start" | "center" | "end";
1526
+ export type CoordinateAspect = "auto" | {
1527
+ mode: "frame" | "data";
1528
+ ratio: number;
1529
+ alignX?: CoordinateAspectAlign;
1530
+ alignY?: CoordinateAspectAlign;
1531
+ };
1532
+
1533
+ export type PolarFrameCenter = {
1534
+ x: number;
1535
+ y: number;
1536
+ };
1537
+ export type PolarFrameRadius =
1538
+ | { unit: "fraction"; value: number }
1539
+ | { unit: "px"; value: number };
1540
+ export type PolarFrameOptions = "auto" | {
1541
+ center?: PolarFrameCenter;
1542
+ radius?: PolarFrameRadius;
1543
+ };
1544
+
1545
+ type EditCoordinateTarget = {
1546
+ target: string;
1547
+ };
1548
+ export type EditCoordinateOptions = EditCoordinateTarget & (
1549
+ | { aspect: CoordinateAspect; polarFrame?: PolarFrameOptions }
1550
+ | { aspect?: CoordinateAspect; polarFrame: PolarFrameOptions }
1551
+ );
1552
+
1241
1553
  export type RadialMapping = "area" | "radius-length";
1242
1554
 
1243
1555
  export interface ScaleOptions {
@@ -1323,12 +1635,59 @@ export type NonPointCategoricalColorScaleOptions = ScaleFields<"id" | "palette">
1323
1635
  };
1324
1636
  export type CategoricalColorScaleOptions =
1325
1637
  NonPointCategoricalColorScaleOptions & { unknown?: string };
1326
- export type SizeScaleOptions = ScaleFields<"id"> & {
1327
- type?: "linear";
1328
- domain?: "auto" | readonly [number, number];
1329
- range?: "auto" | readonly [number, number];
1638
+ type SizeScaleCommonOptions = ScaleFields<"id" | "reverse"> & {
1330
1639
  unknown?: number;
1331
1640
  };
1641
+ type ContinuousSizeScaleOptions = SizeScaleCommonOptions &
1642
+ ScaleFields<"clamp"> & {
1643
+ domain?: "auto" | readonly [number, number];
1644
+ range?: "auto" | readonly [number, number];
1645
+ };
1646
+ export type SizeScaleOptions =
1647
+ | (ContinuousSizeScaleOptions & {
1648
+ type?: "linear";
1649
+ base?: never;
1650
+ exponent?: never;
1651
+ })
1652
+ | (ContinuousSizeScaleOptions & {
1653
+ type: "log";
1654
+ base?: number;
1655
+ exponent?: never;
1656
+ })
1657
+ | (ContinuousSizeScaleOptions & {
1658
+ type: "sqrt";
1659
+ base?: never;
1660
+ exponent?: never;
1661
+ })
1662
+ | (ContinuousSizeScaleOptions & {
1663
+ type: "pow";
1664
+ exponent: number;
1665
+ base?: never;
1666
+ })
1667
+ | (SizeScaleCommonOptions & {
1668
+ type: "quantize";
1669
+ domain?: "auto" | readonly [number, number];
1670
+ range: readonly [number, number, ...number[]];
1671
+ clamp?: never;
1672
+ base?: never;
1673
+ exponent?: never;
1674
+ })
1675
+ | (SizeScaleCommonOptions & {
1676
+ type: "quantile";
1677
+ domain?: "auto" | readonly [number, ...number[]];
1678
+ range: readonly [number, number, ...number[]];
1679
+ clamp?: never;
1680
+ base?: never;
1681
+ exponent?: never;
1682
+ })
1683
+ | (SizeScaleCommonOptions & {
1684
+ type: "threshold";
1685
+ domain: readonly [number, ...number[]];
1686
+ range: readonly [number, number, ...number[]];
1687
+ clamp?: never;
1688
+ base?: never;
1689
+ exponent?: never;
1690
+ });
1332
1691
  export type ShapeScaleOptions = ScaleFields<"id"> & {
1333
1692
  type?: "ordinal";
1334
1693
  domain?: "auto" | readonly unknown[];
@@ -1361,6 +1720,76 @@ export interface EditScaleOptions {
1361
1720
  unknown?: unknown;
1362
1721
  }
1363
1722
 
1723
+ type FocusedScaleSelection = { id?: string; target?: string };
1724
+ export type EditXScaleOptions = FocusedScaleSelection & WithoutScaleId<
1725
+ QuantitativePositionScaleOptions | TemporalPositionScaleOptions | CategoricalPositionScaleOptions
1726
+ >;
1727
+ export type EditYScaleOptions = EditXScaleOptions;
1728
+ export type OffsetScaleEditPatch = Pick<
1729
+ ScaleOptions,
1730
+ "domain" | "reverse" | "padding" | "paddingInner" | "paddingOuter" | "align"
1731
+ >;
1732
+ export type EditXOffsetScaleOptions = { target: string } & OffsetScaleEditPatch;
1733
+ export type EditYOffsetScaleOptions = EditXOffsetScaleOptions;
1734
+ export type EditParallelScaleOptions = {
1735
+ target: string;
1736
+ dimension: string;
1737
+ } & WithoutScaleId<
1738
+ QuantitativePositionScaleOptions | CategoricalPositionScaleOptions
1739
+ >;
1740
+ export type EditThetaScaleOptions = FocusedScaleSelection & WithoutScaleId<ThetaScaleOptions>;
1741
+ export type EditRScaleOptions = FocusedScaleSelection & WithoutScaleId<RadiusScaleOptions> & {
1742
+ radialMapping?: RadialMapping;
1743
+ };
1744
+ export type EditColorScaleOptions = FocusedScaleSelection & WithoutScaleId<
1745
+ CategoricalColorScaleOptions | ContinuousColorScaleOptions | DiscretizedColorScaleOptions
1746
+ >;
1747
+ export type EditStrokeScaleOptions = { target: string } & Omit<
1748
+ EditColorScaleOptions,
1749
+ "id" | "target"
1750
+ >;
1751
+ type ExistingSizeScaleEditPatch = {
1752
+ type?: never;
1753
+ domain?: "auto" | readonly [number, ...number[]];
1754
+ range?: "auto" | readonly [number, number, ...number[]];
1755
+ unknown?: number;
1756
+ clamp?: boolean;
1757
+ reverse?: boolean;
1758
+ base?: number;
1759
+ exponent?: number;
1760
+ };
1761
+ type SizeScaleTypeEditPatch =
1762
+ | (Omit<WithoutScaleId<SizeScaleOptions>, "type"> & { type?: "linear" })
1763
+ | (Omit<Extract<WithoutScaleId<SizeScaleOptions>, { type: "log" }>, "type"> & {
1764
+ type: "log";
1765
+ })
1766
+ | (Omit<Extract<WithoutScaleId<SizeScaleOptions>, { type: "sqrt" }>, "type"> & {
1767
+ type: "sqrt";
1768
+ })
1769
+ | (Omit<Extract<WithoutScaleId<SizeScaleOptions>, { type: "pow" }>, "type" | "exponent"> & {
1770
+ type: "pow";
1771
+ exponent?: number;
1772
+ })
1773
+ | (Omit<Extract<WithoutScaleId<SizeScaleOptions>, { type: "quantize" }>, "type" | "range"> & {
1774
+ type: "quantize";
1775
+ range?: readonly [number, number, ...number[]];
1776
+ })
1777
+ | (Omit<Extract<WithoutScaleId<SizeScaleOptions>, { type: "quantile" }>, "type" | "range"> & {
1778
+ type: "quantile";
1779
+ range?: readonly [number, number, ...number[]];
1780
+ })
1781
+ | (Omit<Extract<WithoutScaleId<SizeScaleOptions>, { type: "threshold" }>, "type" | "domain" | "range"> & {
1782
+ type: "threshold";
1783
+ domain?: readonly [number, ...number[]];
1784
+ range?: readonly [number, number, ...number[]];
1785
+ });
1786
+ export type EditSizeScaleOptions = FocusedScaleSelection &
1787
+ (ExistingSizeScaleEditPatch | SizeScaleTypeEditPatch);
1788
+ export type EditOpacityScaleOptions = FocusedScaleSelection & WithoutScaleId<OpacityScaleOptions>;
1789
+ export type EditShapeScaleOptions = FocusedScaleSelection & WithoutScaleId<ShapeScaleOptions>;
1790
+ export type EditStrokeWidthScaleOptions = FocusedScaleSelection & WithoutScaleId<StrokeWidthScaleOptions>;
1791
+ export type EditStrokeDashScaleOptions = FocusedScaleSelection & WithoutScaleId<DashScaleOptions>;
1792
+
1364
1793
  interface PositionEncodingBase {
1365
1794
  field: string;
1366
1795
  target?: string;
@@ -1467,7 +1896,7 @@ export type RadialEncodingOptions = {
1467
1896
  fieldType?: "quantitative";
1468
1897
  coordinate?: string;
1469
1898
  } & (
1470
- | { field: string; mapping?: never; aggregate?: never; scale?: RadiusScaleOptions }
1899
+ | { field: string; mapping?: false; aggregate?: never; scale?: RadiusScaleOptions }
1471
1900
  | { field: string; mapping?: RadialMapping; aggregate: "sum"; scale?: MeasuredRadiusScaleOptions }
1472
1901
  | { field?: never; mapping?: RadialMapping; aggregate: "count"; scale?: MeasuredRadiusScaleOptions }
1473
1902
  );
@@ -1557,6 +1986,7 @@ export type HistogramEncodingOptions = {
1557
1986
  stack?: StackMode;
1558
1987
  xScale?: NonPointQuantitativePositionScaleOptions;
1559
1988
  yScale?: NonPointZeroSupportingPositionScaleOptions;
1989
+ weight?: StatisticalWeight;
1560
1990
  } & (
1561
1991
  | { maxBins?: number; binStep?: never; binBoundaries?: never }
1562
1992
  | { maxBins?: never; binStep: number; binBoundaries?: never }
@@ -1586,6 +2016,7 @@ export interface DensityDataOptions {
1586
2016
  steps?: number;
1587
2017
  kernel?: DensityKernel;
1588
2018
  normalization?: DensityNormalization;
2019
+ weight?: StatisticalWeight;
1589
2020
  as?: readonly [string, string];
1590
2021
  }
1591
2022
 
@@ -1690,6 +2121,7 @@ export interface WindowDataOptions {
1690
2121
  partitionBy?: string | readonly string[];
1691
2122
  sortBy?: readonly WindowSort[];
1692
2123
  operations: readonly WindowOperation[];
2124
+ temporalUnit?: TemporalInputUnit;
1693
2125
  }
1694
2126
 
1695
2127
  export interface ECDFDataOptions {
@@ -1702,14 +2134,31 @@ export interface ECDFDataOptions {
1702
2134
  as?: ECDFOutputFields;
1703
2135
  }
1704
2136
 
1705
- export interface TimeUnitDataOptions {
2137
+ type TimeUnitDataBaseOptions = {
1706
2138
  id: string;
1707
2139
  source?: string;
1708
2140
  field: string;
1709
- unit: TimeUnit;
1710
2141
  temporalUnit?: TemporalInputUnit;
1711
2142
  as: string;
1712
- }
2143
+ timeZone?: string;
2144
+ };
2145
+ export type TimeUnitDataOptions = TimeUnitDataBaseOptions & (
2146
+ | {
2147
+ unit: Exclude<TimeUnit, "week">;
2148
+ weekStartsOn?: never;
2149
+ weekRule?: never;
2150
+ }
2151
+ | {
2152
+ unit: "week";
2153
+ weekRule?: "calendar";
2154
+ weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
2155
+ }
2156
+ | {
2157
+ unit: "week";
2158
+ weekRule: "iso";
2159
+ weekStartsOn?: 1;
2160
+ }
2161
+ );
1713
2162
 
1714
2163
  export interface BinDataOutputFields {
1715
2164
  lower?: string;
@@ -1734,6 +2183,7 @@ export type BinDataOptions = {
1734
2183
  zero?: boolean;
1735
2184
  includeEmpty?: boolean;
1736
2185
  members?: boolean;
2186
+ weight?: StatisticalWeight;
1737
2187
  as?: BinDataOutputFields;
1738
2188
  } & BinDataMode;
1739
2189
 
@@ -1753,6 +2203,79 @@ export interface ComputedDataOptions {
1753
2203
  as: string;
1754
2204
  expression: ComputedExpression;
1755
2205
  }
2206
+ type NormalizedDataBaseOptions = {
2207
+ id: string;
2208
+ source?: string;
2209
+ field: string;
2210
+ as: string;
2211
+ groupBy?: string | readonly string[];
2212
+ };
2213
+ type NormalizeBaselineOptions =
2214
+ | {
2215
+ baseline?: { position: "first" | "last" };
2216
+ sortBy: readonly [WindowSort, ...WindowSort[]];
2217
+ }
2218
+ | {
2219
+ baseline: { value: number };
2220
+ sortBy?: readonly WindowSort[];
2221
+ };
2222
+ export type NormalizedDataOptions = NormalizedDataBaseOptions & (
2223
+ | {
2224
+ method: "share" | "minmax";
2225
+ zeroDenominator?: NormalizeZeroDenominator;
2226
+ }
2227
+ | {
2228
+ method: "zscore";
2229
+ variance?: "population" | "sample";
2230
+ zeroDenominator?: NormalizeZeroDenominator;
2231
+ }
2232
+ | ({
2233
+ method: "index" | "percentChange";
2234
+ zeroDenominator?: NormalizeZeroDenominator;
2235
+ } & NormalizeBaselineOptions)
2236
+ | ({ method: "change" } & NormalizeBaselineOptions)
2237
+ );
2238
+ type CompleteDataBaseOptions = {
2239
+ id: string;
2240
+ source?: string;
2241
+ key: string;
2242
+ groupBy?: string | readonly string[];
2243
+ fill?: Readonly<Record<string, DatasetScalar>>;
2244
+ members?: string;
2245
+ };
2246
+ export type CompleteDataOptions = CompleteDataBaseOptions & (
2247
+ | { values: readonly [DatasetScalar, ...DatasetScalar[]]; sequence?: never }
2248
+ | {
2249
+ values?: never;
2250
+ sequence: { start: number; end: number; step: number };
2251
+ }
2252
+ | { values?: never; sequence?: never }
2253
+ );
2254
+ type ImputedDataBaseOptions = {
2255
+ id: string;
2256
+ source?: string;
2257
+ fields: string | readonly [string, ...string[]];
2258
+ groupBy?: string | readonly string[];
2259
+ edges?: "keep" | "error";
2260
+ maxGap?: number;
2261
+ };
2262
+ export type ImputedDataOptions = ImputedDataBaseOptions & (
2263
+ | {
2264
+ method: "constant";
2265
+ value: DatasetScalar;
2266
+ sortBy?: readonly WindowSort[];
2267
+ }
2268
+ | {
2269
+ method: "forward" | "backward";
2270
+ value?: never;
2271
+ sortBy: readonly [WindowSort, ...WindowSort[]];
2272
+ }
2273
+ | {
2274
+ method: "linear";
2275
+ value?: never;
2276
+ sortBy: readonly [{ field: string; order?: "ascending" }];
2277
+ }
2278
+ );
1756
2279
  export interface StackDataOptions {
1757
2280
  id: string;
1758
2281
  source?: string;
@@ -1785,8 +2308,51 @@ export interface EditBin2DDataOptions {
1785
2308
  includeEmpty?: boolean;
1786
2309
  members?: boolean;
1787
2310
  as?: DatasetBin2DOutputFields;
2311
+ dependents?: DerivedDataDependents;
1788
2312
  }
1789
2313
 
2314
+ type FocusedDerivedDataPatch<T> = T extends unknown
2315
+ ? Partial<Omit<T, "id" | "source">>
2316
+ : never;
2317
+ type FocusedDerivedDataEdit<T> = {
2318
+ target: string;
2319
+ dependents?: DerivedDataDependents;
2320
+ } & FocusedDerivedDataPatch<T>;
2321
+ type FocusedWeightedDerivedDataEdit<T, Weight> = {
2322
+ target: string;
2323
+ dependents?: DerivedDataDependents;
2324
+ } & (T extends unknown
2325
+ ? Omit<FocusedDerivedDataPatch<T>, "weight"> & { weight?: Weight | false }
2326
+ : never);
2327
+
2328
+ export type EditComputedDataOptions = FocusedDerivedDataEdit<ComputedDataOptions>;
2329
+ export type EditFilteredDataOptions = FocusedDerivedDataEdit<FilterDataOptions>;
2330
+ export type EditFoldDataOptions = FocusedDerivedDataEdit<FoldDataOptions>;
2331
+ export type EditSummaryDataOptions = FocusedWeightedDerivedDataEdit<
2332
+ SummaryDataOptions,
2333
+ StatisticalWeight
2334
+ >;
2335
+ export type EditBinDataOptions = FocusedWeightedDerivedDataEdit<
2336
+ BinDataOptions,
2337
+ StatisticalWeight
2338
+ >;
2339
+ export type EditTimeUnitDataOptions = FocusedDerivedDataEdit<TimeUnitDataOptions>;
2340
+ export type EditWindowDataOptions = FocusedDerivedDataEdit<WindowDataOptions>;
2341
+ export type EditDensityDataOptions = FocusedWeightedDerivedDataEdit<
2342
+ DensityDataOptions,
2343
+ StatisticalWeight
2344
+ >;
2345
+ export type EditStackDataOptions = FocusedDerivedDataEdit<StackDataOptions>;
2346
+ export type EditRegressionDataOptions = FocusedDerivedDataEdit<RegressionDataOptions>;
2347
+ export type EditIntervalDataOptions = FocusedDerivedDataEdit<IntervalDataOptions>;
2348
+ export type EditECDFDataOptions = FocusedWeightedDerivedDataEdit<
2349
+ ECDFDataOptions,
2350
+ string
2351
+ >;
2352
+ export type EditNormalizedDataOptions = FocusedDerivedDataEdit<NormalizedDataOptions>;
2353
+ export type EditCompleteDataOptions = FocusedDerivedDataEdit<CompleteDataOptions>;
2354
+ export type EditImputedDataOptions = FocusedDerivedDataEdit<ImputedDataOptions>;
2355
+
1790
2356
  export type ErrorBarPositionChannel = { field?: string } & (
1791
2357
  | {
1792
2358
  fieldType?: "nominal" | "ordinal";
@@ -1831,7 +2397,7 @@ export interface ErrorBarOffsetChannel {
1831
2397
  paddingOuter?: number;
1832
2398
  }
1833
2399
 
1834
- export interface ErrorBarOptions {
2400
+ export interface ErrorBarOptions extends StrokeStyleDetails {
1835
2401
  id?: string;
1836
2402
  target?: string;
1837
2403
  data?: string;
@@ -1849,7 +2415,7 @@ export interface ErrorBarOptions {
1849
2415
  opacity?: number;
1850
2416
  }
1851
2417
 
1852
- export interface EditErrorBarOptions {
2418
+ export interface EditErrorBarOptions extends StrokeStyleDetails {
1853
2419
  target?: string;
1854
2420
  data?: string;
1855
2421
  x?: ErrorBarPositionChannel | ErrorBarIntervalChannel;
@@ -1901,17 +2467,17 @@ export interface BoxPlotOptions {
1901
2467
  whisker?: BoxPlotWhisker;
1902
2468
  width?: { band?: number };
1903
2469
  outliers?: boolean;
1904
- box?: {
2470
+ box?: RectStyleDetails & {
1905
2471
  fill?: string;
1906
2472
  opacity?: number;
1907
2473
  stroke?: string;
1908
2474
  strokeWidth?: number;
1909
2475
  };
1910
- median?: {
2476
+ median?: StrokeStyleDetails & {
1911
2477
  stroke?: string;
1912
2478
  strokeWidth?: number;
1913
2479
  };
1914
- outlier?: {
2480
+ outlier?: StrokeStyleDetails & {
1915
2481
  shape?: PointShape;
1916
2482
  radius?: number;
1917
2483
  opacity?: number;
@@ -1927,17 +2493,17 @@ export interface EditBoxPlotOptions {
1927
2493
  whisker?: BoxPlotWhisker;
1928
2494
  width?: { band?: number };
1929
2495
  outliers?: boolean;
1930
- box?: {
2496
+ box?: RectStyleDetails & {
1931
2497
  fill?: string;
1932
2498
  opacity?: number;
1933
2499
  stroke?: string;
1934
2500
  strokeWidth?: number;
1935
2501
  };
1936
- median?: {
2502
+ median?: StrokeStyleDetails & {
1937
2503
  stroke?: string;
1938
2504
  strokeWidth?: number;
1939
2505
  };
1940
- outlier?: {
2506
+ outlier?: StrokeStyleDetails & {
1941
2507
  shape?: PointShape;
1942
2508
  radius?: number;
1943
2509
  opacity?: number;
@@ -1959,7 +2525,7 @@ export interface GradientPlotAppearanceOptions {
1959
2525
  opacity?: readonly [number, number];
1960
2526
  }
1961
2527
 
1962
- export interface GradientPlotCenterOptions {
2528
+ export interface GradientPlotCenterOptions extends StrokeStyleDetails {
1963
2529
  type?: "mean" | "median";
1964
2530
  stroke?: string;
1965
2531
  strokeWidth?: number;
@@ -2001,6 +2567,7 @@ export type ViolinPlotPositionChannel =
2001
2567
 
2002
2568
  export interface ViolinPlotDensityOptions
2003
2569
  extends GradientPlotDensityOptions {
2570
+ weight?: StatisticalWeight;
2004
2571
  width?: DensityPlacementWidth;
2005
2572
  side?: "both" | "left" | "right" | "top" | "bottom";
2006
2573
  }
@@ -2020,7 +2587,7 @@ export type ViolinPlotColorOptions =
2020
2587
  layout?: "overlay";
2021
2588
  };
2022
2589
 
2023
- export interface ViolinPlotAreaOptions {
2590
+ export interface ViolinPlotAreaOptions extends StrokeStyleDetails {
2024
2591
  fill?: string;
2025
2592
  opacity?: number;
2026
2593
  stroke?: string;
@@ -2047,7 +2614,9 @@ export interface EditViolinPlotOptions {
2047
2614
  x?: ViolinPlotPositionChannel;
2048
2615
  y?: ViolinPlotPositionChannel;
2049
2616
  split?: false | ViolinPlotSplitOptions;
2050
- density?: ViolinPlotDensityOptions;
2617
+ density?: Omit<ViolinPlotDensityOptions, "weight"> & {
2618
+ weight?: StatisticalWeight | false;
2619
+ };
2051
2620
  }
2052
2621
 
2053
2622
  export interface EditGradientPlotOptions {
@@ -2279,7 +2848,7 @@ export interface CreateParallelCoordinatesOptions {
2279
2848
  missing?: ParallelMissingPolicy;
2280
2849
  color?: LineCategoricalColorChannel;
2281
2850
  strokeDash?: BasicStrokeDashChannel;
2282
- line?: {
2851
+ line?: StrokeStyleDetails & {
2283
2852
  strokeWidth?: number;
2284
2853
  stroke?: string;
2285
2854
  opacity?: number;
@@ -2298,7 +2867,7 @@ export interface CreateScatterPlotOptions {
2298
2867
  color?: BasicColorChannel;
2299
2868
  size?: BasicSizeChannel;
2300
2869
  shape?: BasicShapeChannel;
2301
- point?: {
2870
+ point?: StrokeStyleDetails & {
2302
2871
  radius?: number;
2303
2872
  shape?: PointShape;
2304
2873
  fill?: string;
@@ -2309,7 +2878,7 @@ export interface CreateScatterPlotOptions {
2309
2878
  guides?: false | CartesianGuideOptions;
2310
2879
  }
2311
2880
 
2312
- export interface IntervalPlotErrorBarOptions {
2881
+ export interface IntervalPlotErrorBarOptions extends StrokeStyleDetails {
2313
2882
  caps?: boolean;
2314
2883
  capSize?: number;
2315
2884
  stroke?: string;
@@ -2431,7 +3000,7 @@ export interface CreateECDFPlotOptions {
2431
3000
  missing?: "drop" | "error";
2432
3001
  as?: ECDFOutputFields;
2433
3002
  color?: string | LineCategoricalColorChannel;
2434
- line?: { strokeWidth?: number; stroke?: string; opacity?: number };
3003
+ line?: StrokeStyleDetails & { strokeWidth?: number; stroke?: string; opacity?: number };
2435
3004
  labels?: false | EndpointLabelOptions;
2436
3005
  guides?: false | CartesianPathGuideOptions;
2437
3006
  }
@@ -2516,7 +3085,8 @@ type CategoricalThetaTicksAndLabelsOptions = Omit<
2516
3085
  "count" | "labels"
2517
3086
  > & {
2518
3087
  count?: never;
2519
- labels?: Omit<AxisLabelStyleOptions, "format"> & { format?: "auto" };
3088
+ labels?: Omit<AxisLabelStyleOptions, "format"> & DisplayLabelOptions &
3089
+ { format?: "auto" };
2520
3090
  };
2521
3091
  type CategoricalThetaAxisOptions = Omit<CompletePolarAxisOptions, "ticksAndLabels"> & {
2522
3092
  ticksAndLabels?: false | CategoricalThetaTicksAndLabelsOptions;
@@ -2582,13 +3152,14 @@ export type RugMeasureChannel = string | (
2582
3152
  scale?: NonPointTemporalPositionScaleOptions;
2583
3153
  }
2584
3154
  );
2585
- export interface RugTickOptions {
3155
+ export interface RugTickOptions extends StrokeStyleDetails {
2586
3156
  length?: number;
2587
3157
  stroke?: string;
2588
3158
  strokeWidth?: number;
2589
3159
  opacity?: number;
2590
3160
  }
2591
- export type RugGuideOptions = Omit<CartesianGuideOptions, "legend"> & {
3161
+ export type RugGuideOptions = Omit<CartesianGuideOptions, "axes" | "legend"> & {
3162
+ axes?: false | CAxes;
2592
3163
  legend?: false;
2593
3164
  };
2594
3165
  export type CreateRugPlotOptions = {
@@ -2624,7 +3195,7 @@ export type CreateStripPlotOptions = {
2624
3195
  color?: BasicColorChannel;
2625
3196
  size?: BasicSizeChannel;
2626
3197
  shape?: BasicShapeChannel;
2627
- point?: {
3198
+ point?: StrokeStyleDetails & {
2628
3199
  radius?: number;
2629
3200
  shape?: PointShape;
2630
3201
  fill?: string;
@@ -2651,7 +3222,7 @@ export type CreateBeeswarmPlotOptions = {
2651
3222
  color?: BasicColorChannel;
2652
3223
  size?: BasicSizeChannel;
2653
3224
  shape?: BasicShapeChannel;
2654
- point?: {
3225
+ point?: StrokeStyleDetails & {
2655
3226
  radius?: number;
2656
3227
  shape?: PointShape;
2657
3228
  fill?: string;
@@ -2765,7 +3336,7 @@ export type CreateAreaPlotOptions = {
2765
3336
  groupBy?: string | readonly [string, ...string[]];
2766
3337
  layout?: Exclude<ColorLayout, "group">; missing?: "error" | "break";
2767
3338
  color?: string | { field: string; fieldType?: "nominal" | "ordinal"; scale?: NonPointCategoricalColorScaleOptions; palette?: Palette };
2768
- area?: { fill?: string; opacity?: number; stroke?: string; strokeWidth?: number; curve?: CurveInterpolation };
3339
+ area?: StrokeStyleDetails & { fill?: string; opacity?: number; stroke?: string; strokeWidth?: number; curve?: CurveInterpolation };
2769
3340
  guides?: false | DensityPlotGuideOptions;
2770
3341
  } & (
2771
3342
  | { valueChannel?: "y"; x: AreaPlotIndependentChannel; y: Exclude<AreaPlotMeasureChannel, { lower: unknown }>; baseline?: number }
@@ -2783,14 +3354,14 @@ export interface CreateLinePlotOptions {
2783
3354
  color?: LineCategoricalColorChannel;
2784
3355
  groupBy?: string | readonly [string, ...string[]];
2785
3356
  strokeDash?: BasicStrokeDashChannel;
2786
- line?: {
3357
+ line?: StrokeStyleDetails & {
2787
3358
  strokeWidth?: number;
2788
3359
  curve?: CurveInterpolation;
2789
3360
  stroke?: string;
2790
3361
  opacity?: number;
2791
3362
  closed?: false;
2792
3363
  };
2793
- guides?: false | CartesianPathGuideOptions;
3364
+ guides?: false | CPathGuides;
2794
3365
  }
2795
3366
 
2796
3367
  type BasicHistogramEncoding =
@@ -2810,13 +3381,13 @@ export interface CreateBarPlotOptions {
2810
3381
  y: BarYPositionChannel;
2811
3382
  color?: BarColorChannel;
2812
3383
  width?: Omit<BarWidthOptions, "target">;
2813
- bar?: {
3384
+ bar?: RectStyleDetails & {
2814
3385
  fill?: string;
2815
3386
  opacity?: number;
2816
3387
  stroke?: FilledMarkStroke;
2817
3388
  strokeWidth?: number;
2818
3389
  };
2819
- guides?: false | CartesianGuideOptions;
3390
+ guides?: false | ColorGuides;
2820
3391
  }
2821
3392
 
2822
3393
  export type CreateHistogramOptions = BasicHistogramEncoding & {
@@ -2825,7 +3396,7 @@ export type CreateHistogramOptions = BasicHistogramEncoding & {
2825
3396
  coordinate?: string;
2826
3397
  field: string;
2827
3398
  color?: HistogramCategoricalColorChannel;
2828
- bar?: {
3399
+ bar?: RectStyleDetails & {
2829
3400
  fill?: string;
2830
3401
  opacity?: number;
2831
3402
  stroke?: FilledMarkStroke;
@@ -2835,7 +3406,7 @@ export type CreateHistogramOptions = BasicHistogramEncoding & {
2835
3406
  };
2836
3407
 
2837
3408
  export type HorizonPlotGuideOptions = {
2838
- axes?: false | (Omit<CartesianAxesOptions, "y"> & { y?: false });
3409
+ axes?: false | (Omit<CAxes, "y"> & { y?: false });
2839
3410
  grid?: false | (Pick<CartesianGridOptions, "vertical"> & { horizontal?: false });
2840
3411
  legend?: false;
2841
3412
  };
@@ -2853,12 +3424,12 @@ export interface CreateHorizonPlotOptions {
2853
3424
  missing?: HorizonMissingPolicy;
2854
3425
  overflow?: HorizonOverflowPolicy;
2855
3426
  palette?: HorizonPaletteOptions;
2856
- area?: { opacity?: number; stroke?: string; strokeWidth?: number; curve?: CurveInterpolation };
3427
+ area?: StrokeStyleDetails & { opacity?: number; stroke?: string; strokeWidth?: number; curve?: CurveInterpolation };
2857
3428
  guides?: false | HorizonPlotGuideOptions;
2858
3429
  }
2859
3430
 
2860
3431
  export type DensityPlotLegendOptions = Omit<PieLegendOptions, "order"> & { order?: LegendValueOrder };
2861
- export type DensityPlotGuideOptions = Omit<CartesianCategoricalGuideOptions, "legend"> & {
3432
+ export type DensityPlotGuideOptions = Omit<CCategoricalGuides, "legend"> & {
2862
3433
  legend?: false | DensityPlotLegendOptions;
2863
3434
  };
2864
3435
  export interface CreateDensityPlotOptions {
@@ -2872,6 +3443,7 @@ export interface CreateDensityPlotOptions {
2872
3443
  steps?: number;
2873
3444
  kernel?: DensityKernel;
2874
3445
  normalization?: DensityNormalization;
3446
+ weight?: StatisticalWeight;
2875
3447
  as?: readonly [string, string];
2876
3448
  densityChannel?: "x" | "y";
2877
3449
  valueScale?: NonPointQuantitativePositionScaleOptions;
@@ -2883,7 +3455,7 @@ export interface CreateDensityPlotOptions {
2883
3455
  palette?: Palette;
2884
3456
  layout?: "overlay";
2885
3457
  };
2886
- area?: { fill?: string; opacity?: number; stroke?: string; strokeWidth?: number; curve?: CurveInterpolation };
3458
+ area?: StrokeStyleDetails & { fill?: string; opacity?: number; stroke?: string; strokeWidth?: number; curve?: CurveInterpolation };
2887
3459
  guides?: false | DensityPlotGuideOptions;
2888
3460
  }
2889
3461
 
@@ -2900,7 +3472,7 @@ export type PieColor = string | {
2900
3472
  };
2901
3473
  export type PieLegendOptions = Omit<
2902
3474
  FilledMarkLegendOptions,
2903
- "count" | "gradient" | "channels" | "order" | "labels"
3475
+ "count" | "values" | "gradient" | "channels" | "order" | "labels"
2904
3476
  > & {
2905
3477
  channels?: readonly ["color"];
2906
3478
  order?: LegendValueOrder | { channel: "theta"; values?: never };
@@ -2912,7 +3484,7 @@ export type CreatePiePlotOptions = {
2912
3484
  coordinate?: string;
2913
3485
  category: PieCategory;
2914
3486
  color?: false | PieColor;
2915
- arc?: { innerRadius?: number; padAngle?: number; fill?: string; opacity?: number; stroke?: string; strokeWidth?: number };
3487
+ arc?: StrokeStyleDetails & { innerRadius?: number; padAngle?: number; fill?: string; opacity?: number; stroke?: string; strokeWidth?: number };
2916
3488
  guides?: false | { axes?: false; grid?: false; legend?: false | PieLegendOptions };
2917
3489
  } & ({ value?: never; aggregate?: "count" } | { value: string; aggregate: "sum" });
2918
3490
 
@@ -2923,7 +3495,7 @@ export type MeasuredRadialGuideOptions = {
2923
3495
  };
2924
3496
  export type CreateRosePlotOptions = Omit<CreatePiePlotOptions, "guides" | "arc" | "aggregate" | "value"> & {
2925
3497
  radiusScale?: MeasuredRadiusScaleOptions;
2926
- arc?: { innerRadius?: number; padAngle?: 0; fill?: string; opacity?: number; stroke?: string; strokeWidth?: number };
3498
+ arc?: StrokeStyleDetails & { innerRadius?: number; padAngle?: 0; fill?: string; opacity?: number; stroke?: string; strokeWidth?: number };
2927
3499
  guides?: false | MeasuredRadialGuideOptions;
2928
3500
  } & ({ value?: never; aggregate?: "count" } | { value: string; aggregate: "sum" });
2929
3501
  export type CreateRadialBarPlotOptions = CreateRosePlotOptions;
@@ -2932,7 +3504,7 @@ export interface HeatmapBaseOptions {
2932
3504
  id?: string;
2933
3505
  data?: string;
2934
3506
  coordinate?: string;
2935
- rect?: {
3507
+ rect?: RectStyleDetails & {
2936
3508
  opacity?: number;
2937
3509
  stroke?: string | false;
2938
3510
  strokeWidth?: number;
@@ -3017,7 +3589,7 @@ export type ErrorBandIntervalChannel =
3017
3589
  | ErrorBandStatisticalIntervalChannel
3018
3590
  | ErrorBandExplicitIntervalChannel;
3019
3591
 
3020
- export interface ErrorBandOptions {
3592
+ export interface ErrorBandOptions extends StrokeStyleDetails {
3021
3593
  id?: string;
3022
3594
  target?: string;
3023
3595
  data?: string;
@@ -3028,16 +3600,16 @@ export interface ErrorBandOptions {
3028
3600
  fill?: string;
3029
3601
  opacity?: number;
3030
3602
  curve?: CurveInterpolation;
3031
- boundaries?: false | {
3603
+ boundaries?: false | (StrokeStyleDetails & {
3032
3604
  stroke?: string;
3033
3605
  strokeWidth?: number;
3034
3606
  strokeDash?: DashStyle | DashPattern;
3035
3607
  opacity?: number;
3036
3608
  curve?: CurveInterpolation;
3037
- };
3609
+ });
3038
3610
  }
3039
3611
 
3040
- export interface EditErrorBandOptions {
3612
+ export interface EditErrorBandOptions extends StrokeStyleDetails {
3041
3613
  target?: string;
3042
3614
  data?: string;
3043
3615
  x?: ErrorBandPositionChannel | ErrorBandIntervalChannel;
@@ -3052,16 +3624,16 @@ export interface EditErrorBandOptions {
3052
3624
  method?: ConfidenceIntervalMethod;
3053
3625
  level?: number;
3054
3626
  };
3055
- boundaries?: false | {
3627
+ boundaries?: false | (StrokeStyleDetails & {
3056
3628
  stroke?: string;
3057
3629
  strokeWidth?: number;
3058
3630
  strokeDash?: DashStyle | DashPattern;
3059
3631
  opacity?: number;
3060
3632
  curve?: CurveInterpolation;
3061
- };
3633
+ });
3062
3634
  }
3063
3635
 
3064
- export interface EditErrorBandBoundaryOptions {
3636
+ export interface EditErrorBandBoundaryOptions extends StrokeStyleDetails {
3065
3637
  target?: string;
3066
3638
  boundary?: "both" | "lower" | "upper";
3067
3639
  stroke?: string;
@@ -3081,6 +3653,7 @@ export interface EditDensityOptions {
3081
3653
  steps?: number;
3082
3654
  kernel?: DensityKernel;
3083
3655
  normalization?: DensityNormalization;
3656
+ weight?: StatisticalWeight | false;
3084
3657
  densityChannel?: "x" | "y";
3085
3658
  valueScale?: NonPointQuantitativePositionScaleOptions;
3086
3659
  placement?: DensityPlacement;
@@ -3090,7 +3663,11 @@ export interface OffsetScaleOptions {
3090
3663
  id?: string;
3091
3664
  type?: "ordinal";
3092
3665
  domain?: "auto" | readonly unknown[];
3093
- range?: "auto" | readonly [number, number];
3666
+ reverse?: boolean;
3667
+ padding?: number;
3668
+ paddingInner?: number;
3669
+ paddingOuter?: number;
3670
+ align?: number;
3094
3671
  }
3095
3672
 
3096
3673
  export interface OffsetEncodingOptions {
@@ -3139,6 +3716,27 @@ export interface LabelLeaderOptions {
3139
3716
  opacity?: number;
3140
3717
  }
3141
3718
 
3719
+ export type MarkLabelAnchor =
3720
+ | "center"
3721
+ | "insideStart"
3722
+ | "insideEnd"
3723
+ | "outsideStart"
3724
+ | "outsideEnd";
3725
+
3726
+ export interface MarkLabelPlacementLeaderOptions {
3727
+ stroke?: string;
3728
+ strokeWidth?: number;
3729
+ }
3730
+
3731
+ export interface MarkLabelPlacement {
3732
+ anchor: MarkLabelAnchor;
3733
+ /** Pixel gap between the source boundary and the nearest text edge. Defaults to 4. */
3734
+ gap?: number;
3735
+ /** Inside-fit behavior. Defaults to hide. */
3736
+ overflow?: "hide" | "outside" | "allow";
3737
+ leader?: false | MarkLabelPlacementLeaderOptions;
3738
+ }
3739
+
3142
3740
  export interface LabelLayoutOptions {
3143
3741
  target?: string;
3144
3742
  axis?: LabelLayoutAxis;
@@ -3152,7 +3750,7 @@ export interface RemoveLabelLayoutOptions {
3152
3750
  target?: string;
3153
3751
  }
3154
3752
 
3155
- export interface RectMarkOptions {
3753
+ export interface RectMarkOptions extends RectStyleDetails {
3156
3754
  id?: string;
3157
3755
  data?: string;
3158
3756
  fill?: string;
@@ -3176,15 +3774,39 @@ export type TextEncodingOptions = {
3176
3774
  );
3177
3775
 
3178
3776
  /** Attached final-item labels; lower text actions own subsequent edits. */
3777
+ export type MarkLabelSelectionOptions =
3778
+ | { select?: never; selection?: never }
3779
+ | { select: MarkSelector; selection?: never }
3780
+ | { selection: string; select?: never };
3781
+
3179
3782
  export type CreateMarkLabelsOptions = Omit<TextMarkOptions, "data" | "text"> & {
3180
3783
  layout?: false | Omit<LabelLayoutOptions, "target">;
3784
+ placement?: MarkLabelPlacement;
3181
3785
  } & (
3182
3786
  | (TextEncodingOptions extends infer Options
3183
3787
  ? Options extends TextEncodingOptions ? Omit<Options, "target"> : never
3184
3788
  : never)
3185
3789
  | { field?: never; value?: never; content?: never; normalizeBy?: never; format?: TextFormat }
3790
+ ) & MarkLabelSelectionOptions;
3791
+
3792
+ /** Replace the requested final-item membership of one attached label layer. */
3793
+ export type EditMarkLabelSelectionOptions = { target: string } & (
3794
+ | { select: MarkSelector; selection?: never; all?: never }
3795
+ | { selection: string; select?: never; all?: never }
3796
+ | { all: true; select?: never; selection?: never }
3186
3797
  );
3187
3798
 
3799
+ /** Replace semantic placement or reset one attached label layer to its legacy anchor. */
3800
+ export interface EditMarkLabelPlacementOptions {
3801
+ target: string;
3802
+ placement: MarkLabelPlacement | "auto";
3803
+ }
3804
+
3805
+ /** Remove one attached label layer or every attached label owned by a source mark. */
3806
+ export type RemoveMarkLabelsOptions =
3807
+ | { target: string; source?: never }
3808
+ | { source: string; target?: never };
3809
+
3188
3810
  type AnnotationBaseOptions = Omit<TextMarkOptions, "id" | "data" | "source" | "text"> & {
3189
3811
  id?: string;
3190
3812
  text: unknown;
@@ -3320,6 +3942,42 @@ export type ColorEncodingOptions =
3320
3942
  layout?: never;
3321
3943
  };
3322
3944
 
3945
+ export type StrokeEncodingOptions =
3946
+ | {
3947
+ target?: string;
3948
+ value: string;
3949
+ field?: never;
3950
+ fieldType?: never;
3951
+ temporalUnit?: never;
3952
+ scale?: never;
3953
+ }
3954
+ | {
3955
+ target?: string;
3956
+ field: string;
3957
+ value?: never;
3958
+ fieldType?: "nominal" | "ordinal";
3959
+ temporalUnit?: never;
3960
+ scale?: CategoricalColorScaleOptions;
3961
+ }
3962
+ | {
3963
+ target?: string;
3964
+ field: string;
3965
+ value?: never;
3966
+ fieldType: "quantitative";
3967
+ temporalUnit?: never;
3968
+ scale?: ContinuousColorScaleOptions | DiscretizedColorScaleOptions;
3969
+ }
3970
+ | {
3971
+ target?: string;
3972
+ field: string;
3973
+ value?: never;
3974
+ fieldType: "temporal";
3975
+ temporalUnit?: TemporalInputUnit;
3976
+ scale?: Omit<ContinuousColorScaleOptions, "midpoint"> & {
3977
+ midpoint?: "auto";
3978
+ };
3979
+ };
3980
+
3323
3981
  export type OpacityScaleOptions = ScaleFields<
3324
3982
  "id" | "nice" | "zero" | "clamp" | "reverse"
3325
3983
  > & {
@@ -3341,7 +3999,7 @@ export type OpacityEncodingOptions =
3341
3999
 
3342
4000
  export type StrokeWidthScaleOptions = NonPointQuantitativePositionScaleOptions;
3343
4001
 
3344
- export interface RuleStyleOptions {
4002
+ export interface RuleStyleOptions extends StrokeStyleDetails {
3345
4003
  stroke?: string;
3346
4004
  strokeWidth?: number;
3347
4005
  strokeDash?: DashStyle | DashPattern;
@@ -3355,10 +4013,33 @@ type ReferenceBinding<DataValue, PlotValue> =
3355
4013
  | ({ space: "plot"; data?: string; coordinate?: string;
3356
4014
  source?: never; temporalUnit?: never } & ReferenceAxis<PlotValue>);
3357
4015
 
3358
- export type CreateReferenceLineOptions = { id?: string } & RuleStyleOptions &
3359
- ReferenceBinding<unknown, number>;
3360
- export type CreateReferenceBandOptions = Omit<RectMarkOptions, "data"> &
3361
- ReferenceBinding<readonly [unknown, unknown], readonly [number, number]>;
4016
+ export type ReferenceStatistic =
4017
+ | { readonly op: "mean" | "median" | "min" | "max"; readonly p?: never }
4018
+ | { readonly op: "quantile"; readonly p: number };
4019
+ type DynamicReferenceBinding = {
4020
+ readonly id?: string;
4021
+ readonly source: string;
4022
+ readonly axis: "x" | "y";
4023
+ readonly population?: "boundData" | "visibleItems";
4024
+ readonly field?: string;
4025
+ readonly x?: never;
4026
+ readonly y?: never;
4027
+ readonly space?: never;
4028
+ readonly data?: never;
4029
+ readonly coordinate?: never;
4030
+ readonly temporalUnit?: never;
4031
+ };
4032
+ export type CreateReferenceLineOptions =
4033
+ | ({ id?: string } & RuleStyleOptions & ReferenceBinding<unknown, number>)
4034
+ | (DynamicReferenceBinding & RuleStyleOptions & {
4035
+ readonly statistic: ReferenceStatistic;
4036
+ });
4037
+ export type CreateReferenceBandOptions =
4038
+ | (Omit<RectMarkOptions, "data"> &
4039
+ ReferenceBinding<readonly [unknown, unknown], readonly [number, number]>)
4040
+ | (DynamicReferenceBinding & Omit<RectMarkOptions, "id" | "data" | "source"> & {
4041
+ readonly statistics: readonly [ReferenceStatistic, ReferenceStatistic];
4042
+ });
3362
4043
 
3363
4044
  export type StrokeWidthEncodingOptions =
3364
4045
  | {
@@ -3376,10 +4057,63 @@ export type StrokeWidthEncodingOptions =
3376
4057
  scale?: StrokeWidthScaleOptions;
3377
4058
  };
3378
4059
 
4060
+ export type SizeEncodingOptions = {
4061
+ field: string;
4062
+ target?: string;
4063
+ fieldType?: "quantitative";
4064
+ scale?: SizeScaleOptions;
4065
+ };
4066
+
4067
+ export type ShapeEncodingOptions = {
4068
+ field: string;
4069
+ target?: string;
4070
+ fieldType?: "nominal";
4071
+ scale?: ShapeScaleOptions;
4072
+ };
4073
+
4074
+ export type AngleEncodingOptions =
4075
+ | { target?: string; value: number; field?: never; fieldType?: never }
4076
+ | { target?: string; field: string; fieldType?: "quantitative"; value?: never };
4077
+
4078
+ type WithoutEncodingTarget<T> = T extends unknown
4079
+ ? Omit<T, "target" | "coordinate">
4080
+ : never;
4081
+
4082
+ export interface EncodingChannelAssignments {
4083
+ x?: WithoutEncodingTarget<PositionEncodingOptions | DatumPositionEncodingOptions>;
4084
+ y?: WithoutEncodingTarget<YPositionEncodingOptions | DatumPositionEncodingOptions>;
4085
+ x2?: WithoutEncodingTarget<SecondaryPositionEncodingOptions>;
4086
+ y2?: WithoutEncodingTarget<SecondaryPositionEncodingOptions>;
4087
+ theta?: WithoutEncodingTarget<ThetaEncodingOptions>;
4088
+ r?: WithoutEncodingTarget<RadialEncodingOptions>;
4089
+ xOffset?: WithoutEncodingTarget<XOffsetEncodingOptions>;
4090
+ yOffset?: WithoutEncodingTarget<YOffsetEncodingOptions>;
4091
+ group?: WithoutEncodingTarget<GroupEncodingOptions>;
4092
+ pathOrder?: WithoutEncodingTarget<PathOrderEncodingOptions>;
4093
+ color?: WithoutEncodingTarget<ColorEncodingOptions>;
4094
+ stroke?: WithoutEncodingTarget<StrokeEncodingOptions>;
4095
+ size?: WithoutEncodingTarget<SizeEncodingOptions>;
4096
+ shape?: WithoutEncodingTarget<ShapeEncodingOptions>;
4097
+ opacity?: WithoutEncodingTarget<OpacityEncodingOptions>;
4098
+ strokeWidth?: WithoutEncodingTarget<StrokeWidthEncodingOptions>;
4099
+ strokeDash?: WithoutEncodingTarget<StrokeDashEncodingOptions>;
4100
+ angle?: WithoutEncodingTarget<AngleEncodingOptions>;
4101
+ text?: WithoutEncodingTarget<TextEncodingOptions>;
4102
+ }
4103
+
4104
+ type AtLeastOne<T> = {
4105
+ [K in keyof T]-?: Required<Pick<T, K>> & Partial<Omit<T, K>>
4106
+ }[keyof T];
4107
+
4108
+ export interface EncodeChannelsOptions {
4109
+ target: string;
4110
+ channels: AtLeastOne<EncodingChannelAssignments>;
4111
+ }
4112
+
3379
4113
  export type RegressionMethod = "linear" | "polynomial" | "loess";
3380
4114
  export type RegressionInterval = "mean" | "prediction";
3381
4115
 
3382
- export interface RegressionBandOptions {
4116
+ export interface RegressionBandOptions extends StrokeStyleDetails {
3383
4117
  color?: string;
3384
4118
  opacity?: number;
3385
4119
  stroke?: string;
@@ -3387,7 +4121,7 @@ export interface RegressionBandOptions {
3387
4121
  curve?: CurveInterpolation;
3388
4122
  }
3389
4123
 
3390
- export interface CreateRegressionBandOptions {
4124
+ export interface CreateRegressionBandOptions extends StrokeStyleDetails {
3391
4125
  id: string;
3392
4126
  data: string;
3393
4127
  x: string;
@@ -3404,7 +4138,7 @@ export interface CreateRegressionBandOptions {
3404
4138
  curve?: CurveInterpolation;
3405
4139
  }
3406
4140
 
3407
- export interface CreateRegressionLineOptions {
4141
+ export interface CreateRegressionLineOptions extends StrokeStyleDetails {
3408
4142
  id: string;
3409
4143
  data: string;
3410
4144
  x: string;
@@ -3460,7 +4194,7 @@ type RegressionCommonOptions = {
3460
4194
  x?: string;
3461
4195
  y?: string;
3462
4196
  groupBy?: string | false;
3463
- line?: { strokeWidth?: number; curve?: CurveInterpolation };
4197
+ line?: StrokeStyleDetails & { strokeWidth?: number; curve?: CurveInterpolation };
3464
4198
  };
3465
4199
 
3466
4200
  export type RegressionOptions = RegressionCommonOptions & (
@@ -3489,7 +4223,7 @@ export interface EditRegressionOptions {
3489
4223
  confidence?: number;
3490
4224
  interval?: RegressionInterval;
3491
4225
  band?: false | RegressionBandOptions;
3492
- line?: { strokeWidth?: number; curve?: CurveInterpolation };
4226
+ line?: StrokeStyleDetails & { strokeWidth?: number; curve?: CurveInterpolation };
3493
4227
  }
3494
4228
 
3495
4229
  export interface RemoveAxisOptions {
@@ -3507,7 +4241,7 @@ export interface RemoveGridOptions {
3507
4241
  export interface RemoveLegendOptions {
3508
4242
  target?: string;
3509
4243
  /** Remove selected content, including part of a combined categorical legend; omission removes every owned block. */
3510
- channels?: readonly ("color" | "strokeDash" | "strokeWidth" | "shape" | "size" | "opacity")[];
4244
+ channels?: readonly ("color" | "stroke" | "strokeDash" | "strokeWidth" | "shape" | "size" | "opacity")[];
3511
4245
  }
3512
4246
 
3513
4247
  export interface RemoveMarkOptions {
@@ -3580,7 +4314,7 @@ export interface LegendOptions {
3580
4314
  order?: LegendOrder;
3581
4315
  target?: string;
3582
4316
  /** Exact requested content; omission infers encoded point color/shape/size. Explicit subsets include size only when listed. */
3583
- channels?: readonly ("color" | "strokeDash" | "strokeWidth" | "shape" | "size" | "opacity")[];
4317
+ channels?: readonly ("color" | "stroke" | "strokeDash" | "strokeWidth" | "shape" | "size" | "opacity")[];
3584
4318
  position?: "right" | "left" | "bottom" | "top";
3585
4319
  /** Single top/bottom edge: align complete occupied bounds, including border strokes, to the plot. Side positions require center. */
3586
4320
  align?: "left" | "center" | "right";
@@ -3592,6 +4326,8 @@ export interface LegendOptions {
3592
4326
  offset?: number;
3593
4327
  titlePosition?: "top" | "left";
3594
4328
  title?: string;
4329
+ /** Exact ascending samples for continuous size, opacity, or stroke-width legends. Cannot be combined with count. */
4330
+ values?: readonly number[];
3595
4331
  count?: number;
3596
4332
  gradient?: { length?: number; thickness?: number };
3597
4333
  symbol?: LegendSymbolRecipe;
@@ -3602,11 +4338,44 @@ export interface LegendOptions {
3602
4338
  border?: boolean | LegendBorderOptions;
3603
4339
  }
3604
4340
 
4341
+ export type LegendChannel = NonNullable<LegendOptions["channels"]>[number];
4342
+
4343
+ export interface LegendBlockTextPatch {
4344
+ fontSize?: number;
4345
+ fontFamily?: string;
4346
+ fontWeight?: string | number;
4347
+ color?: string;
4348
+ }
4349
+
4350
+ export interface LegendBlockSymbolPatch {
4351
+ /** Point glyph area in square pixels. */
4352
+ size?: number;
4353
+ fill?: string;
4354
+ stroke?: string;
4355
+ strokeWidth?: number;
4356
+ opacity?: number;
4357
+ }
4358
+
4359
+ export interface EditLegendBlockOptions {
4360
+ target: string;
4361
+ channel: LegendChannel;
4362
+ title?: string;
4363
+ values?: readonly [number, ...number[]] | "auto";
4364
+ count?: number;
4365
+ order?: readonly CategoryValue[];
4366
+ gap?: number;
4367
+ text?: LegendBlockTextPatch;
4368
+ symbol?: LegendBlockSymbolPatch;
4369
+ labelMap?: DisplayLabelMap | "auto";
4370
+ }
4371
+
3605
4372
  export interface EditLegendOptions
3606
- extends Omit<LegendOptions, "title"> {
4373
+ extends Omit<LegendOptions, "title" | "values"> {
3607
4374
  /** Exact final content set for the whole target; omission preserves content. */
3608
4375
  channels?: LegendOptions["channels"];
3609
4376
  title?: string | "auto" | false;
4377
+ /** Replace exact samples, or reset them to the remembered automatic count. */
4378
+ values?: readonly number[] | "auto";
3610
4379
  }
3611
4380
 
3612
4381
  export interface EditLegendLayoutOptions {
@@ -3720,6 +4489,21 @@ export interface EditTitleOptions
3720
4489
 
3721
4490
  export interface ChartProgram extends RegisteredExtensionActions {}
3722
4491
 
4492
+ type StoredCell<T> = T extends (...args: never[]) => unknown ? never
4493
+ : T extends readonly (infer Value)[] ? readonly StoredCell<Value>[]
4494
+ : T extends object ? { readonly [Key in keyof T]: StoredCell<T[Key]> }
4495
+ : T;
4496
+
4497
+ export interface CreateDataOptions<Row extends object> {
4498
+ id?: string;
4499
+ values: readonly (Row extends readonly unknown[] ? never : Row & StoredCell<Row>)[];
4500
+ }
4501
+
4502
+ export interface ReviseDataOptions<Row extends object> extends CreateDataOptions<Row> {
4503
+ source: string;
4504
+ id: string;
4505
+ }
4506
+
3723
4507
  export class ChartProgram {
3724
4508
  constructor(state?: ActionOptions);
3725
4509
  readonly semanticSpec: SemanticSpec;
@@ -3735,9 +4519,15 @@ export class ChartProgram {
3735
4519
  createCanvas(options?: CanvasOptions): ChartProgram;
3736
4520
  editCanvas(options: CanvasOptions): ChartProgram;
3737
4521
  fitCanvas(options?: FitCanvasOptions): ChartProgram;
4522
+ applyTextMetrics(options: ApplyTextMetricsOptions): ChartProgram;
4523
+ removeTextMetrics(): ChartProgram;
3738
4524
  applyTheme(options: ApplyThemeOptions): ChartProgram;
3739
4525
  removeTheme(): ChartProgram;
3740
- createData(options: { id?: string; values: readonly unknown[] }): ChartProgram;
4526
+ createData<Row extends object>(options: CreateDataOptions<Row>): ChartProgram;
4527
+ reviseData<Row extends object>(options: ReviseDataOptions<Row>): ChartProgram;
4528
+ removeData(options: RemoveResourceOptions): ChartProgram;
4529
+ removeScale(options: RemoveResourceOptions): ChartProgram;
4530
+ removeCoordinate(options: RemoveResourceOptions): ChartProgram;
3741
4531
  bindMarkData(options: BindMarkDataOptions): ChartProgram;
3742
4532
  filterData(options: FilterDataOptions): ChartProgram;
3743
4533
  filterMarks(options: FilterMarksOptions): ChartProgram;
@@ -3752,6 +4542,9 @@ export class ChartProgram {
3752
4542
  createBinData(options: BinDataOptions): ChartProgram;
3753
4543
  createFoldData(options: FoldDataOptions): ChartProgram;
3754
4544
  createComputedData(options: ComputedDataOptions): ChartProgram;
4545
+ createNormalizedData(options: NormalizedDataOptions): ChartProgram;
4546
+ createCompleteData(options: CompleteDataOptions): ChartProgram;
4547
+ createImputedData(options: ImputedDataOptions): ChartProgram;
3755
4548
  createStackData(options: StackDataOptions): ChartProgram;
3756
4549
  createRegressionData(options: RegressionDataOptions): ChartProgram;
3757
4550
  createIntervalData(options: IntervalDataOptions): ChartProgram;
@@ -3759,9 +4552,25 @@ export class ChartProgram {
3759
4552
  createTimeUnitData(options: TimeUnitDataOptions): ChartProgram;
3760
4553
  createWindowData(options: WindowDataOptions): ChartProgram;
3761
4554
  createBin2DData(options: Bin2DDataOptions): ChartProgram;
4555
+ editDerivedData(options: EditDerivedDataOptions): ChartProgram;
4556
+ editComputedData(options: EditComputedDataOptions): ChartProgram;
4557
+ editFilteredData(options: EditFilteredDataOptions): ChartProgram;
4558
+ editFoldData(options: EditFoldDataOptions): ChartProgram;
4559
+ editSummaryData(options: EditSummaryDataOptions): ChartProgram;
4560
+ editBinData(options: EditBinDataOptions): ChartProgram;
4561
+ editTimeUnitData(options: EditTimeUnitDataOptions): ChartProgram;
4562
+ editWindowData(options: EditWindowDataOptions): ChartProgram;
4563
+ editDensityData(options: EditDensityDataOptions): ChartProgram;
4564
+ editStackData(options: EditStackDataOptions): ChartProgram;
4565
+ editRegressionData(options: EditRegressionDataOptions): ChartProgram;
4566
+ editIntervalData(options: EditIntervalDataOptions): ChartProgram;
4567
+ editECDFData(options: EditECDFDataOptions): ChartProgram;
4568
+ editNormalizedData(options: EditNormalizedDataOptions): ChartProgram;
4569
+ editCompleteData(options: EditCompleteDataOptions): ChartProgram;
4570
+ editImputedData(options: EditImputedDataOptions): ChartProgram;
3762
4571
  editBin2DData(options: EditBin2DDataOptions): ChartProgram;
3763
4572
 
3764
- createPointMark(options?: {
4573
+ createPointMark(options?: StrokeStyleDetails & {
3765
4574
  id?: string;
3766
4575
  data?: string;
3767
4576
  shape?: PointShape;
@@ -3770,7 +4579,7 @@ export class ChartProgram {
3770
4579
  stroke?: FilledMarkStroke;
3771
4580
  strokeWidth?: number;
3772
4581
  }): ChartProgram;
3773
- editPointMark(options: {
4582
+ editPointMark(options: StrokeStyleDetails & {
3774
4583
  target?: string;
3775
4584
  shape?: PointShape;
3776
4585
  fill?: string;
@@ -3778,7 +4587,7 @@ export class ChartProgram {
3778
4587
  stroke?: FilledMarkStroke;
3779
4588
  strokeWidth?: number;
3780
4589
  }): ChartProgram;
3781
- createTickMark(options?: {
4590
+ createTickMark(options?: StrokeStyleDetails & {
3782
4591
  id?: string;
3783
4592
  data?: string;
3784
4593
  length?: number;
@@ -3786,7 +4595,7 @@ export class ChartProgram {
3786
4595
  strokeWidth?: number;
3787
4596
  opacity?: number;
3788
4597
  }): ChartProgram;
3789
- editTickMark(options: {
4598
+ editTickMark(options: StrokeStyleDetails & {
3790
4599
  target?: string;
3791
4600
  length?: number;
3792
4601
  stroke?: string;
@@ -3797,7 +4606,7 @@ export class ChartProgram {
3797
4606
  removeJitter(options?: RemoveJitterOptions): ChartProgram;
3798
4607
  packPoints(options: PackPointsOptions): ChartProgram;
3799
4608
  removePointPacking(options?: RemovePointPackingOptions): ChartProgram;
3800
- createLineMark(options?: {
4609
+ createLineMark(options?: StrokeStyleDetails & {
3801
4610
  id?: string;
3802
4611
  data?: string;
3803
4612
  strokeWidth?: number;
@@ -3806,7 +4615,7 @@ export class ChartProgram {
3806
4615
  opacity?: number;
3807
4616
  closed?: boolean;
3808
4617
  }): ChartProgram;
3809
- editLineMark(options: {
4618
+ editLineMark(options: StrokeStyleDetails & {
3810
4619
  target?: string;
3811
4620
  strokeWidth?: number;
3812
4621
  curve?: CurveInterpolation;
@@ -3814,7 +4623,7 @@ export class ChartProgram {
3814
4623
  opacity?: number;
3815
4624
  closed?: boolean;
3816
4625
  }): ChartProgram;
3817
- createBarMark(options?: {
4626
+ createBarMark(options?: RectStyleDetails & {
3818
4627
  id?: string;
3819
4628
  data?: string;
3820
4629
  fill?: string;
@@ -3822,14 +4631,14 @@ export class ChartProgram {
3822
4631
  stroke?: FilledMarkStroke;
3823
4632
  strokeWidth?: number;
3824
4633
  }): ChartProgram;
3825
- editBarMark(options: {
4634
+ editBarMark(options: RectStyleDetails & {
3826
4635
  target?: string;
3827
4636
  fill?: string;
3828
4637
  opacity?: number;
3829
4638
  stroke?: FilledMarkStroke;
3830
4639
  strokeWidth?: number;
3831
4640
  }): ChartProgram;
3832
- createAreaMark(options?: {
4641
+ createAreaMark(options?: StrokeStyleDetails & {
3833
4642
  id?: string;
3834
4643
  data?: string;
3835
4644
  fill?: string;
@@ -3839,7 +4648,7 @@ export class ChartProgram {
3839
4648
  curve?: CurveInterpolation;
3840
4649
  missing?: "error" | "break";
3841
4650
  }): ChartProgram;
3842
- createArcMark(options?: {
4651
+ createArcMark(options?: StrokeStyleDetails & {
3843
4652
  id?: string;
3844
4653
  data?: string;
3845
4654
  innerRadius?: number;
@@ -3849,7 +4658,7 @@ export class ChartProgram {
3849
4658
  stroke?: string;
3850
4659
  strokeWidth?: number;
3851
4660
  }): ChartProgram;
3852
- editArcMark(options: {
4661
+ editArcMark(options: StrokeStyleDetails & {
3853
4662
  target?: string;
3854
4663
  innerRadius?: number;
3855
4664
  padAngle?: number;
@@ -3864,13 +4673,16 @@ export class ChartProgram {
3864
4673
  editRuleMark(options: { target?: string } & RuleStyleOptions): ChartProgram;
3865
4674
  createTextMark(options?: TextMarkOptions): ChartProgram;
3866
4675
  createMarkLabels(options?: CreateMarkLabelsOptions): ChartProgram;
4676
+ editMarkLabelSelection(options: EditMarkLabelSelectionOptions): ChartProgram;
4677
+ editMarkLabelPlacement(options: EditMarkLabelPlacementOptions): ChartProgram;
4678
+ removeMarkLabels(options: RemoveMarkLabelsOptions): ChartProgram;
3867
4679
  createAnnotation(options: CreateAnnotationOptions): ChartProgram;
3868
4680
  createReferenceLine(options: CreateReferenceLineOptions): ChartProgram;
3869
4681
  createReferenceBand(options: CreateReferenceBandOptions): ChartProgram;
3870
4682
  editTextMark(options: EditTextMarkOptions): ChartProgram;
3871
4683
  layoutLabels(options?: LabelLayoutOptions): ChartProgram;
3872
4684
  removeLabelLayout(options?: RemoveLabelLayoutOptions): ChartProgram;
3873
- editAreaMark(options: {
4685
+ editAreaMark(options: StrokeStyleDetails & {
3874
4686
  target?: string;
3875
4687
  fill?: string;
3876
4688
  opacity?: number;
@@ -3887,12 +4699,9 @@ export class ChartProgram {
3887
4699
  encodeX2(options: SecondaryPositionEncodingOptions): ChartProgram;
3888
4700
  encodeColor(options: ColorEncodingOptions): ChartProgram;
3889
4701
  encodeStrokeDash(options: StrokeDashEncodingOptions): ChartProgram;
3890
- encodeSize(options: { field: string; target?: string; fieldType?: "quantitative"; scale?: SizeScaleOptions }): ChartProgram;
3891
- encodeShape(options: { field: string; target?: string; fieldType?: "nominal"; scale?: ShapeScaleOptions }): ChartProgram;
3892
- encodeAngle(options:
3893
- | { target?: string; value: number; field?: never; fieldType?: never }
3894
- | { target?: string; field: string; fieldType?: "quantitative"; value?: never }
3895
- ): ChartProgram;
4702
+ encodeSize(options: SizeEncodingOptions): ChartProgram;
4703
+ encodeShape(options: ShapeEncodingOptions): ChartProgram;
4704
+ encodeAngle(options: AngleEncodingOptions): ChartProgram;
3896
4705
  encodeOpacity(options: OpacityEncodingOptions): ChartProgram;
3897
4706
  encodeRadius(options: { value: number; target?: string }): ChartProgram;
3898
4707
  encodePointRadius(options: { value: number; target?: string }): ChartProgram;
@@ -3913,7 +4722,7 @@ export class ChartProgram {
3913
4722
  target?: string;
3914
4723
  channel:
3915
4724
  | "x" | "y" | "x2" | "y2" | "xOffset" | "yOffset"
3916
- | "theta" | "radius" | "color" | "strokeDash" | "strokeWidth"
4725
+ | "theta" | "radius" | "color" | "stroke" | "strokeDash" | "strokeWidth"
3917
4726
  | "size" | "shape" | "angle" | "group" | "opacity" | "text";
3918
4727
  }): ChartProgram;
3919
4728
  encodeText(options: TextEncodingOptions): ChartProgram;
@@ -3923,8 +4732,9 @@ export class ChartProgram {
3923
4732
  encodeHorizon(options?: HorizonEncodingOptions): ChartProgram;
3924
4733
  editHorizon(options: EditHorizonOptions): ChartProgram;
3925
4734
  encodeBarWidth(options?: BarWidthOptions): ChartProgram;
3926
- encodeStroke(options: { target?: string; value: string }): ChartProgram;
4735
+ encodeStroke(options: StrokeEncodingOptions): ChartProgram;
3927
4736
  encodeStrokeWidth(options: StrokeWidthEncodingOptions): ChartProgram;
4737
+ encodeChannels(options: EncodeChannelsOptions): ChartProgram;
3928
4738
 
3929
4739
  createRegression(options?: RegressionOptions): ChartProgram;
3930
4740
  editRegression(options: EditRegressionOptions): ChartProgram;
@@ -3976,7 +4786,7 @@ export class ChartProgram {
3976
4786
  createAxes(options?: CreateAxesOptions): ChartProgram;
3977
4787
  createXAxis(options?: CompleteAxisOptions<XAxisPosition>): ChartProgram;
3978
4788
  createYAxis(options?: CompleteAxisOptions<YAxisPosition>): ChartProgram;
3979
- createThetaAxis(options?: CompletePolarAxisOptions): ChartProgram;
4789
+ createThetaAxis(options?: CompleteThetaAxisOptions): ChartProgram;
3980
4790
  createRadialAxis(options?: CompleteRadialAxisOptions): ChartProgram;
3981
4791
  createThetaAxisLine(options?: CreateThetaAxisLineOptions): ChartProgram;
3982
4792
  createRadialAxisLine(options?: CreateRadialAxisLineOptions): ChartProgram;
@@ -3990,7 +4800,7 @@ export class ChartProgram {
3990
4800
  editRadialAxisLine(options?: AxisLineStyleOptions): ChartProgram;
3991
4801
  editThetaAxisTicks(options?: PolarTickOptions): ChartProgram;
3992
4802
  editRadialAxisTicks(options?: PolarTickOptions): ChartProgram;
3993
- editThetaAxisLabels(options?: PolarLabelOptions): ChartProgram;
4803
+ editThetaAxisLabels(options?: ThetaAxisLabelOptions): ChartProgram;
3994
4804
  editRadialAxisLabels(options?: PolarLabelOptions): ChartProgram;
3995
4805
  editThetaAxisTitle(options?: PolarTitleOptions): ChartProgram;
3996
4806
  editRadialAxisTitle(options?: RadialTitleOptions): ChartProgram;
@@ -4016,7 +4826,7 @@ export class ChartProgram {
4016
4826
  editYAxisTitle(options?: Omit<AxisTitleOptions<YAxisPosition>, "scale">): ChartProgram;
4017
4827
  editXAxis(options: EditAxisOptions<XAxisPosition>): ChartProgram;
4018
4828
  editYAxis(options: EditAxisOptions<YAxisPosition>): ChartProgram;
4019
- editThetaAxis(options: Omit<EditPolarAxisOptions, "angle">): ChartProgram;
4829
+ editThetaAxis(options: EditThetaAxisOptions): ChartProgram;
4020
4830
  editRadialAxis(options: EditRadialAxisOptions): ChartProgram;
4021
4831
  removeXAxis(options?: RemoveAxisOptions): ChartProgram;
4022
4832
  removeYAxis(options?: RemoveAxisOptions): ChartProgram;
@@ -4036,6 +4846,7 @@ export class ChartProgram {
4036
4846
  /** Combined categorical and size legends support all four edges with layout "edge". */
4037
4847
  createLegend(options?: LegendOptions): ChartProgram;
4038
4848
  editLegend(options: EditLegendOptions): ChartProgram;
4849
+ editLegendBlock(options: EditLegendBlockOptions): ChartProgram;
4039
4850
  editLegendLayout(options: EditLegendLayoutOptions): ChartProgram;
4040
4851
  editLegendLabels(options: EditLegendLabelsOptions): ChartProgram;
4041
4852
  editLegendTitle(options: EditLegendTitleOptions): ChartProgram;
@@ -4048,11 +4859,26 @@ export class ChartProgram {
4048
4859
  removeTitle(): ChartProgram;
4049
4860
 
4050
4861
  createCoordinate(options?: CreateCoordinateOptions): ChartProgram;
4862
+ editCoordinate(options: EditCoordinateOptions): ChartProgram;
4051
4863
  createScale(options: CreateScaleOptions): ChartProgram;
4052
4864
  editScale(options: EditScaleOptions): ChartProgram;
4865
+ editXScale(options: EditXScaleOptions): ChartProgram;
4866
+ editYScale(options: EditYScaleOptions): ChartProgram;
4867
+ editXOffsetScale(options: EditXOffsetScaleOptions): ChartProgram;
4868
+ editYOffsetScale(options: EditYOffsetScaleOptions): ChartProgram;
4869
+ editParallelScale(options: EditParallelScaleOptions): ChartProgram;
4870
+ editThetaScale(options: EditThetaScaleOptions): ChartProgram;
4871
+ editRScale(options: EditRScaleOptions): ChartProgram;
4872
+ editColorScale(options: EditColorScaleOptions): ChartProgram;
4873
+ editStrokeScale(options: EditStrokeScaleOptions): ChartProgram;
4874
+ editSizeScale(options: EditSizeScaleOptions): ChartProgram;
4875
+ editOpacityScale(options: EditOpacityScaleOptions): ChartProgram;
4876
+ editShapeScale(options: EditShapeScaleOptions): ChartProgram;
4877
+ editStrokeWidthScale(options: EditStrokeWidthScaleOptions): ChartProgram;
4878
+ editStrokeDashScale(options: EditStrokeDashScaleOptions): ChartProgram;
4053
4879
  createDerivedData(options: CreateDerivedDataOptions): ChartProgram;
4054
4880
  createRegressionBand(options: CreateRegressionBandOptions): ChartProgram;
4055
- editRegressionBand(options: {
4881
+ editRegressionBand(options: StrokeStyleDetails & {
4056
4882
  target?: string;
4057
4883
  color?: string;
4058
4884
  opacity?: number;
@@ -4061,7 +4887,7 @@ export class ChartProgram {
4061
4887
  curve?: CurveInterpolation;
4062
4888
  }): ChartProgram;
4063
4889
  createRegressionLine(options: CreateRegressionLineOptions): ChartProgram;
4064
- editRegressionLine(options: {
4890
+ editRegressionLine(options: StrokeStyleDetails & {
4065
4891
  target?: string;
4066
4892
  strokeWidth?: number;
4067
4893
  curve?: CurveInterpolation;