ggaction 0.0.15 → 0.0.17

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 (270) hide show
  1. package/CHANGELOG.md +88 -0
  2. package/README.md +23 -2
  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 +40 -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/boxPlots/components.js +6 -8
  13. package/src/actions/boxPlots/create.js +4 -5
  14. package/src/actions/boxPlots/edit.js +3 -4
  15. package/src/actions/boxPlots/materialize.js +1 -1
  16. package/src/actions/canvas/actions.js +3 -3
  17. package/src/actions/canvas/fitting.js +1 -1
  18. package/src/actions/categoryOrder/index.js +6 -8
  19. package/src/actions/charts/area.js +1 -1
  20. package/src/actions/charts/bar.js +1 -1
  21. package/src/actions/charts/beeswarm.js +1 -1
  22. package/src/actions/charts/density.js +1 -1
  23. package/src/actions/charts/ecdf.js +2 -2
  24. package/src/actions/charts/endpoints.js +4 -4
  25. package/src/actions/charts/heatmap.js +1 -1
  26. package/src/actions/charts/histogram.js +1 -1
  27. package/src/actions/charts/horizon.js +1 -1
  28. package/src/actions/charts/interval-regression.js +2 -2
  29. package/src/actions/charts/line.js +1 -1
  30. package/src/actions/charts/parallel.js +1 -1
  31. package/src/actions/charts/pie.js +1 -1
  32. package/src/actions/charts/polar.js +2 -2
  33. package/src/actions/charts/radar.js +1 -1
  34. package/src/actions/charts/radial.js +2 -2
  35. package/src/actions/charts/raincloud.js +2 -2
  36. package/src/actions/charts/rug-strip.js +2 -2
  37. package/src/actions/charts/scatter.js +1 -1
  38. package/src/actions/composition/actions.js +20 -24
  39. package/src/actions/coordinates/actions.js +1 -1
  40. package/src/actions/coordinates/edit.js +1 -1
  41. package/src/actions/data/basicBin2d.js +4 -5
  42. package/src/actions/data/bin.js +3 -3
  43. package/src/actions/data/bin2d.js +6 -8
  44. package/src/actions/data/bin2dMaterialize.js +4 -5
  45. package/src/actions/data/box.js +4 -4
  46. package/src/actions/data/complete.js +2 -2
  47. package/src/actions/data/computed.js +2 -2
  48. package/src/actions/data/create.js +23 -17
  49. package/src/actions/data/density.js +4 -4
  50. package/src/actions/data/derived.js +25 -15
  51. package/src/actions/data/ecdf.js +2 -2
  52. package/src/actions/data/edit.js +54 -29
  53. package/src/actions/data/filter.js +29 -24
  54. package/src/actions/data/fold.js +2 -2
  55. package/src/actions/data/gradientProfile.js +2 -2
  56. package/src/actions/data/horizon.js +2 -2
  57. package/src/actions/data/impute.js +2 -2
  58. package/src/actions/data/index.js +58 -54
  59. package/src/actions/data/interval.js +4 -2
  60. package/src/actions/data/intervalEdit.js +26 -18
  61. package/src/actions/data/normalize.js +2 -2
  62. package/src/actions/data/regression.js +9 -7
  63. package/src/actions/data/revise.js +80 -0
  64. package/src/actions/data/revisionBindings.js +13 -33
  65. package/src/actions/data/shared.js +30 -2
  66. package/src/actions/data/sort.js +21 -0
  67. package/src/actions/data/stack.js +2 -2
  68. package/src/actions/data/summary.js +3 -3
  69. package/src/actions/data/timeUnit.js +2 -2
  70. package/src/actions/data/window.js +2 -2
  71. package/src/actions/encodings/angle.js +5 -2
  72. package/src/actions/encodings/appearance.js +10 -6
  73. package/src/actions/encodings/barWidth.js +1 -1
  74. package/src/actions/encodings/channels.js +2 -2
  75. package/src/actions/encodings/color/continuous.js +4 -1
  76. package/src/actions/encodings/color/index.js +5 -2
  77. package/src/actions/encodings/density.js +2 -2
  78. package/src/actions/encodings/histogram.js +1 -1
  79. package/src/actions/encodings/horizon.js +6 -8
  80. package/src/actions/encodings/offset.js +6 -3
  81. package/src/actions/encodings/parallel.js +4 -5
  82. package/src/actions/encodings/pathOrder.js +6 -11
  83. package/src/actions/encodings/position/index.js +4 -4
  84. package/src/actions/encodings/position/resolve.js +6 -1
  85. package/src/actions/encodings/ranged.js +11 -6
  86. package/src/actions/encodings/remove.js +4 -5
  87. package/src/actions/encodings/ruleAppearance.js +5 -2
  88. package/src/actions/encodings/seriesLayout.js +1 -1
  89. package/src/actions/encodings/stroke.js +5 -2
  90. package/src/actions/encodings/strokeDash.js +8 -3
  91. package/src/actions/encodings/text.js +7 -2
  92. package/src/actions/errorBands/create.js +11 -17
  93. package/src/actions/errorBands/edit.js +13 -131
  94. package/src/actions/errorBars/create.js +8 -13
  95. package/src/actions/errorBars/edit.js +10 -121
  96. package/src/actions/facets/actions.js +30 -16
  97. package/src/actions/facets/derive.js +8 -2
  98. package/src/actions/facets/guides.js +4 -5
  99. package/src/actions/facets/replay.js +4 -5
  100. package/src/actions/gradientPlots/components.js +5 -6
  101. package/src/actions/gradientPlots/create.js +4 -5
  102. package/src/actions/gradientPlots/edit.js +4 -5
  103. package/src/actions/gradientPlots/materialize.js +2 -2
  104. package/src/actions/gradientPlots/rebind.js +4 -5
  105. package/src/actions/guides/axes/axes.js +23 -4
  106. package/src/actions/guides/axes/axis.js +2 -2
  107. package/src/actions/guides/axes/edit.js +2 -2
  108. package/src/actions/guides/axes/labels.js +9 -9
  109. package/src/actions/guides/axes/lines.js +9 -7
  110. package/src/actions/guides/axes/parallel/lifecycle.js +13 -13
  111. package/src/actions/guides/axes/parallel.js +5 -5
  112. package/src/actions/guides/axes/remove.js +4 -4
  113. package/src/actions/guides/axes/tickGroups.js +4 -4
  114. package/src/actions/guides/axes/ticks.js +13 -4
  115. package/src/actions/guides/axes/titles.js +10 -10
  116. package/src/actions/guides/grids/grid.js +18 -29
  117. package/src/actions/guides/guides.js +1 -1
  118. package/src/actions/guides/legends/blocks.js +1 -1
  119. package/src/actions/guides/legends/categorical/actions.js +4 -4
  120. package/src/actions/guides/legends/categorical/components.js +38 -33
  121. package/src/actions/guides/legends/categorical/layout.js +1 -1
  122. package/src/actions/guides/legends/categorical/symbols.js +27 -30
  123. package/src/actions/guides/legends/continuous/common.js +46 -8
  124. package/src/actions/guides/legends/continuous/gradient.js +89 -155
  125. package/src/actions/guides/legends/continuous/interval.js +13 -13
  126. package/src/actions/guides/legends/continuous/opacity.js +30 -79
  127. package/src/actions/guides/legends/continuous/stroke.js +22 -322
  128. package/src/actions/guides/legends/edit.js +1 -1
  129. package/src/actions/guides/legends/focused.js +5 -5
  130. package/src/actions/guides/legends/lane.js +6 -6
  131. package/src/actions/guides/legends/remove.js +4 -5
  132. package/src/actions/guides/legends/size.js +21 -82
  133. package/src/actions/guides/legends/strokeWidth.js +17 -77
  134. package/src/actions/guides/polar/axes/facade.js +4 -4
  135. package/src/actions/guides/polar/axes/labels.js +5 -5
  136. package/src/actions/guides/polar/axes/lines.js +9 -15
  137. package/src/actions/guides/polar/axes/ticks.js +9 -15
  138. package/src/actions/guides/polar/axes/titles.js +5 -5
  139. package/src/actions/guides/polar/grids.js +11 -13
  140. package/src/actions/index.js +2 -0
  141. package/src/actions/intervals/revision.js +126 -0
  142. package/src/actions/marks/arc/actions.js +3 -3
  143. package/src/actions/marks/area/actions.js +4 -4
  144. package/src/actions/marks/bar/create.js +9 -2
  145. package/src/actions/marks/bar/edit.js +13 -6
  146. package/src/actions/marks/bar/materialize.js +12 -38
  147. package/src/actions/marks/line/actions.js +3 -3
  148. package/src/actions/marks/point/create.js +9 -2
  149. package/src/actions/marks/point/edit.js +13 -6
  150. package/src/actions/marks/point/jitter.js +6 -8
  151. package/src/actions/marks/point/materialize.js +20 -26
  152. package/src/actions/marks/point/packing.js +6 -8
  153. package/src/actions/marks/rect/actions.js +26 -11
  154. package/src/actions/marks/references.js +8 -10
  155. package/src/actions/marks/remove.js +5 -49
  156. package/src/actions/marks/rule/actions.js +28 -12
  157. package/src/actions/marks/text/actions.js +30 -11
  158. package/src/actions/marks/text/layout.js +12 -20
  159. package/src/actions/marks/text/removal.js +1 -1
  160. package/src/actions/marks/text/selection.js +4 -5
  161. package/src/actions/marks/tick/actions.js +26 -11
  162. package/src/actions/primitives/createGraphics.js +5 -4
  163. package/src/actions/primitives/editGraphics.js +5 -4
  164. package/src/actions/primitives/graphicProperties.js +6 -0
  165. package/src/actions/primitives/semantic.js +10 -3
  166. package/src/actions/primitives/semanticAction.js +44 -7
  167. package/src/actions/primitives/semanticValidation/dataset.js +14 -4
  168. package/src/actions/primitives/semanticValidation/layer.js +22 -2
  169. package/src/actions/primitives/semanticValidation/scale.js +6 -0
  170. package/src/actions/regression/components.js +10 -14
  171. package/src/actions/regression/create.js +28 -8
  172. package/src/actions/regression/edit.js +50 -16
  173. package/src/actions/regression/follow.js +22 -0
  174. package/src/actions/resources/remove.js +12 -11
  175. package/src/actions/scales/channels.js +11 -11
  176. package/src/actions/scales/consumers/common.js +2 -1
  177. package/src/actions/scales/create.js +3 -2
  178. package/src/actions/scales/definitions.js +1 -1
  179. package/src/actions/scales/edit.js +2 -2
  180. package/src/actions/scales/materialize.js +1 -1
  181. package/src/actions/scales/offset.js +2 -2
  182. package/src/actions/scales/parallel.js +2 -2
  183. package/src/actions/scales/patch.js +1 -1
  184. package/src/actions/scales/preview.js +28 -1
  185. package/src/actions/scales/quantitativeColor.js +4 -5
  186. package/src/actions/selection/actions.js +25 -36
  187. package/src/actions/textMetrics/index.js +56 -0
  188. package/src/actions/theme/actions.js +2 -2
  189. package/src/actions/theme/reconcile.js +67 -121
  190. package/src/actions/titles/actions.js +8 -8
  191. package/src/actions/titles/resolve.js +3 -3
  192. package/src/actions/violinPlots/create.js +1 -1
  193. package/src/actions/violinPlots/edit.js +1 -1
  194. package/src/core/action.js +109 -36
  195. package/src/core/diagnostics.js +16 -0
  196. package/src/core/extensionRegistry.js +27 -0
  197. package/src/core/font.js +18 -0
  198. package/src/core/identifiers.js +5 -4
  199. package/src/core/immutable.js +10 -3
  200. package/src/core/optionRequirements.js +8 -0
  201. package/src/core/programState.js +6 -2
  202. package/src/core/resourceReferences.js +15 -6
  203. package/src/core/textMetricProfile.js +28 -0
  204. package/src/core/textMetrics.js +24 -3
  205. package/src/core/validation.js +22 -10
  206. package/src/diagnostics.js +1 -0
  207. package/src/grammar/bin.js +39 -10
  208. package/src/grammar/datasetSchema.js +386 -0
  209. package/src/grammar/density.js +53 -5
  210. package/src/grammar/filter.js +133 -39
  211. package/src/grammar/impute.js +3 -2
  212. package/src/grammar/interval.js +32 -1
  213. package/src/grammar/itemMissing.js +59 -0
  214. package/src/grammar/regression/derive.js +57 -16
  215. package/src/grammar/regression/index.js +1 -0
  216. package/src/grammar/regression/models.js +51 -22
  217. package/src/grammar/regression/parameters.js +56 -4
  218. package/src/grammar/scales/definition.js +7 -0
  219. package/src/grammar/scales/types.js +8 -0
  220. package/src/grammar/schemas/graphicBounds.js +11 -11
  221. package/src/grammar/schemas/semanticPath.js +3 -2
  222. package/src/grammar/sort.js +88 -0
  223. package/src/grammar/summary.js +117 -19
  224. package/src/grammar/transformTopology.js +1 -0
  225. package/src/grammar/transforms.js +21 -11
  226. package/src/inspection.js +495 -0
  227. package/src/inspectionDescriptors.js +3 -0
  228. package/src/layout/labels.js +11 -10
  229. package/src/layout/legend.js +4 -4
  230. package/src/layout/legendItems.js +6 -6
  231. package/src/layout/text.js +10 -9
  232. package/src/layout/title.js +9 -9
  233. package/src/materialization/bars/resolve.js +4 -2
  234. package/src/materialization/facetGuides/placement.js +1 -1
  235. package/src/materialization/facetGuides/preparation.js +1 -1
  236. package/src/materialization/facetHeaders.js +11 -10
  237. package/src/materialization/guides/layout.js +3 -3
  238. package/src/materialization/revisionIdentity.js +19 -0
  239. package/src/materialization/scaleGuideDependencies.js +10 -0
  240. package/src/materialization/scales/resolve.js +67 -4
  241. package/src/materialization/selection/items/common.js +1 -1
  242. package/src/materialization/text.js +6 -4
  243. package/src/materialization/typography.js +31 -0
  244. package/src/mcp/cli.js +5 -3
  245. package/src/persistence/codec.js +65 -0
  246. package/src/persistence/validation.js +185 -0
  247. package/src/persistence.js +147 -0
  248. package/src/renderers/canvas/index.js +5 -4
  249. package/src/renderers/nativeBackend.js +10 -0
  250. package/src/renderers/options.js +13 -0
  251. package/src/renderers/pdf.js +25 -54
  252. package/src/renderers/png.js +22 -17
  253. package/src/renderers/svg.js +10 -14
  254. package/src/renderers/text.js +1 -11
  255. package/src/selectors/coordinates.js +3 -1
  256. package/src/selectors/datasets.js +8 -6
  257. package/src/selectors/layers.js +6 -4
  258. package/src/selectors/markOwners.js +46 -0
  259. package/src/selectors/scales.js +6 -4
  260. package/src/theme/defaults.js +2 -1
  261. package/src/version.js +2 -0
  262. package/types/accessibility.d.ts +37 -0
  263. package/types/basic.d.ts +4 -2
  264. package/types/diagnostics.d.ts +15 -0
  265. package/types/index.d.ts +5 -0
  266. package/types/inspection.d.ts +17 -0
  267. package/types/pdf.d.ts +9 -0
  268. package/types/persistence.d.ts +7 -0
  269. package/types/png.d.ts +9 -0
  270. package/types/program.d.ts +181 -28
@@ -1,6 +1,21 @@
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";
5
20
  export interface ThemeTokens {
6
21
  background: string;
@@ -324,21 +339,29 @@ export type DensityPlacement =
324
339
  export type FilterComparison =
325
340
  | { op: "eq" | "neq"; value: unknown }
326
341
  | { op: "lt" | "lte" | "gt" | "gte"; value: number | string };
327
- export type FilterRange = {
328
- min: number | string;
329
- max: number | string;
330
- inclusive?: boolean;
331
- };
342
+ type FilterBound = number | string;
343
+ type FilterRangeBounds =
344
+ | { min: FilterBound; max?: FilterBound }
345
+ | { min?: FilterBound; max: FilterBound };
346
+ type FilterRangeClosure =
347
+ | { inclusive?: boolean; minInclusive?: never; maxInclusive?: never }
348
+ | { inclusive?: never; minInclusive?: boolean; maxInclusive?: boolean };
349
+ export type FilterRange = FilterRangeBounds & FilterRangeClosure;
332
350
  export type FilterModeOptions =
333
- | { oneOf: readonly unknown[]; predicate?: never; range?: never }
334
- | { oneOf?: never; predicate: FilterComparison; range?: never }
335
- | { oneOf?: never; predicate?: never; range: FilterRange };
351
+ | { oneOf: readonly [DatasetScalar, ...DatasetScalar[]]; noneOf?: never; predicate?: never; range?: never }
352
+ | { oneOf?: never; noneOf: readonly [DatasetScalar, ...DatasetScalar[]]; predicate?: never; range?: never }
353
+ | { oneOf?: never; noneOf?: never; predicate: FilterComparison; range?: never }
354
+ | { oneOf?: never; noneOf?: never; predicate?: never; range: FilterRange };
336
355
  export type FilterDataOptions = {
337
356
  id: string;
338
357
  source?: string;
339
358
  field: string;
359
+ nulls?: "include" | "exclude";
340
360
  } & FilterModeOptions;
341
361
  export type DatasetScalar = string | number | boolean | null;
362
+ export type RegressionPredictOptions =
363
+ | { values: readonly [number, ...number[]]; domain?: never; steps?: never }
364
+ | { values?: never; domain: readonly [number, number]; steps: number };
342
365
  export type DisplayLabelMap = ReadonlyArray<Readonly<{
343
366
  value: DatasetScalar;
344
367
  label: string;
@@ -349,10 +372,12 @@ export interface DisplayLabelOptions {
349
372
  export type DatasetFilterTransform = {
350
373
  type: "filter";
351
374
  field: string;
375
+ nulls?: "include" | "exclude";
352
376
  } & (
353
- | { oneOf: readonly DatasetScalar[]; predicate?: never; range?: never }
354
- | { oneOf?: never; predicate: FilterComparison; range?: never }
355
- | { oneOf?: never; predicate?: never; range: FilterRange }
377
+ | { oneOf: readonly DatasetScalar[]; noneOf?: never; predicate?: never; range?: never }
378
+ | { oneOf?: never; noneOf: readonly DatasetScalar[]; predicate?: never; range?: never }
379
+ | { oneOf?: never; noneOf?: never; predicate: FilterComparison; range?: never }
380
+ | { oneOf?: never; noneOf?: never; predicate?: never; range: FilterRange }
356
381
  );
357
382
  export type DatasetRegressionTransform = {
358
383
  type: "regression";
@@ -360,24 +385,22 @@ export type DatasetRegressionTransform = {
360
385
  y: string;
361
386
  groupBy?: string;
362
387
  } & (
363
- | {
388
+ | ({
364
389
  method: "linear";
365
- interval: "mean" | "prediction";
366
390
  degree?: never;
367
391
  span?: never;
368
- } & (
392
+ } & ({ interval: false; confidenceMethod?: never; level?: never; confidence?: never } | ({ interval: "mean" | "prediction" } & (
369
393
  | { confidenceMethod: ConfidenceIntervalMethod; level: number; confidence?: never }
370
394
  | { confidence: number; confidenceMethod?: never; level?: never }
371
- )
372
- | {
395
+ ))))
396
+ | ({
373
397
  method: "polynomial";
374
398
  degree: number;
375
- interval: "mean" | "prediction";
376
399
  span?: never;
377
- } & (
400
+ } & ({ interval: false; confidenceMethod?: never; level?: never; confidence?: never } | ({ interval: "mean" | "prediction" } & (
378
401
  | { confidenceMethod: ConfidenceIntervalMethod; level: number; confidence?: never }
379
402
  | { confidence: number; confidenceMethod?: never; level?: never }
380
- )
403
+ ))))
381
404
  | {
382
405
  method: "loess";
383
406
  span: number;
@@ -387,7 +410,7 @@ export type DatasetRegressionTransform = {
387
410
  confidence?: never;
388
411
  interval?: never;
389
412
  }
390
- );
413
+ ) & { readonly predict?: RegressionPredictOptions; readonly missing?: "error" | "drop" };
391
414
  export interface DatasetDensityTransform {
392
415
  type: "density";
393
416
  field: string;
@@ -398,6 +421,7 @@ export interface DatasetDensityTransform {
398
421
  kernel?: DensityKernel;
399
422
  normalization?: DensityNormalization;
400
423
  weight?: StatisticalWeight;
424
+ missing?: "error" | "drop";
401
425
  as: readonly [string, string];
402
426
  resolve: "shared";
403
427
  placement?: {
@@ -485,6 +509,7 @@ export type DatasetIntervalTransform = {
485
509
  field: string;
486
510
  groupBy: readonly string[];
487
511
  as: DatasetIntervalOutputFields;
512
+ missing?: "error" | "drop";
488
513
  } & (
489
514
  | {
490
515
  center: "mean";
@@ -588,6 +613,21 @@ export interface DatasetWindowTransform {
588
613
  readonly operations: readonly DatasetWindowOperation[];
589
614
  readonly temporalUnit?: TemporalInputUnit;
590
615
  }
616
+ export interface SortKey {
617
+ field: string;
618
+ order?: "ascending" | "descending";
619
+ nulls?: "first" | "last";
620
+ temporalUnit?: "year" | "timestamp";
621
+ }
622
+ export interface DatasetSortTransform {
623
+ readonly type: "sort";
624
+ readonly sortBy: readonly {
625
+ readonly field: string;
626
+ readonly order: "ascending" | "descending";
627
+ readonly nulls: "first" | "last";
628
+ readonly temporalUnit?: "year" | "timestamp";
629
+ }[];
630
+ }
591
631
  export interface ECDFOutputFields {
592
632
  value: string;
593
633
  cumulative: string;
@@ -700,6 +740,7 @@ export interface DatasetBinTransform {
700
740
  readonly includeEmpty: boolean;
701
741
  readonly members: boolean;
702
742
  readonly weight?: StatisticalWeight;
743
+ readonly missing?: "error" | "drop";
703
744
  readonly as: {
704
745
  readonly lower: string;
705
746
  readonly upper: string;
@@ -856,6 +897,7 @@ export type DatasetTransform =
856
897
  | DatasetFilterTransform
857
898
  | DatasetFoldTransform
858
899
  | DatasetRegressionTransform
900
+ | DatasetSortTransform
859
901
  | DatasetDensityTransform
860
902
  | DatasetECDFTransform
861
903
  | DatasetHorizonTransform
@@ -887,6 +929,8 @@ export interface DatasetSummaryTransform {
887
929
  aggregates: readonly SummaryAggregateOptions[];
888
930
  members?: string;
889
931
  weight?: StatisticalWeight;
932
+ missing?: "error" | "drop";
933
+ empty?: "null" | "identity";
890
934
  }
891
935
  export interface SummaryAggregateOptions {
892
936
  op: AggregateOperation;
@@ -900,6 +944,18 @@ export interface SummaryDataOptions {
900
944
  aggregates: readonly SummaryAggregateOptions[];
901
945
  members?: string;
902
946
  weight?: StatisticalWeight;
947
+ missing?: "error" | "drop";
948
+ empty?: "null" | "identity";
949
+ }
950
+ export interface SortedDataOptions {
951
+ id: string;
952
+ source?: string;
953
+ sortBy: readonly [SortKey, ...SortKey[]];
954
+ }
955
+ export interface EditSortedDataOptions {
956
+ target: string;
957
+ sortBy: readonly [SortKey, ...SortKey[]];
958
+ dependents?: DerivedDataDependents;
903
959
  }
904
960
  export interface BindMarkDataOptions {
905
961
  target: string;
@@ -1079,19 +1135,57 @@ export interface TraceNode {
1079
1135
 
1080
1136
  export interface SemanticDataset {
1081
1137
  readonly id: string;
1138
+ readonly schema: DatasetSchema;
1082
1139
  readonly values?: readonly Readonly<Record<string, unknown>>[];
1083
1140
  readonly source?: string;
1084
1141
  readonly transform?: readonly Readonly<Record<string, unknown>>[];
1085
1142
  readonly [key: string]: unknown;
1086
1143
  }
1087
1144
 
1145
+ export type DatasetStorageType =
1146
+ | "number"
1147
+ | "string"
1148
+ | "boolean"
1149
+ | "array"
1150
+ | "object"
1151
+ | "unknown"
1152
+ | "mixed";
1153
+ export interface DatasetFieldLineage {
1154
+ readonly inputs: readonly Readonly<{ data: string; field: string }>[];
1155
+ readonly owner: string;
1156
+ readonly role: string;
1157
+ }
1158
+ export interface DatasetSchemaField {
1159
+ readonly name: string;
1160
+ readonly storageType: DatasetStorageType;
1161
+ readonly nullable: boolean;
1162
+ readonly optional: boolean;
1163
+ readonly lineage?: DatasetFieldLineage;
1164
+ }
1165
+ export interface DatasetSchema {
1166
+ readonly version: 1;
1167
+ readonly completeness: "known" | "unknown";
1168
+ readonly origin: "declared" | "inferred" | "derived";
1169
+ readonly fields: readonly DatasetSchemaField[];
1170
+ }
1171
+ export interface SourceSchemaField {
1172
+ name: string;
1173
+ storageType: Exclude<DatasetStorageType, "unknown" | "mixed">;
1174
+ nullable?: boolean;
1175
+ optional?: boolean;
1176
+ }
1177
+ export interface SourceSchemaInput {
1178
+ fields: readonly SourceSchemaField[];
1179
+ }
1180
+
1088
1181
  export interface SemanticLayer {
1089
1182
  readonly id: string;
1090
1183
  readonly data?: string;
1091
1184
  readonly source?: string;
1092
1185
  readonly coordinate?: string;
1093
- readonly mark?: Readonly<{ type?: string; missing?: "error" | "break"; [key: string]: unknown }>;
1186
+ readonly mark?: Readonly<{ type?: string; missing?: "error" | "break" | "skip"; [key: string]: unknown }>;
1094
1187
  readonly layout?: Readonly<{ mode?: ColorLayout }>;
1188
+ readonly derivedBindings?: Readonly<{ regression?: Readonly<{ mode: "follow"; roles: readonly ["data", "x", "y"] }> }>;
1095
1189
  readonly encoding?: Readonly<Record<string, Readonly<Record<string, unknown>>>>;
1096
1190
  readonly [key: string]: unknown;
1097
1191
  }
@@ -1100,6 +1194,7 @@ export interface SemanticScale {
1100
1194
  readonly id: string;
1101
1195
  readonly type?: ScaleType;
1102
1196
  readonly domain?: "auto" | readonly unknown[];
1197
+ readonly emptyDomain?: "preserve" | "require-explicit";
1103
1198
  readonly range?: ScaleRange;
1104
1199
  readonly [key: string]: unknown;
1105
1200
  }
@@ -1542,6 +1637,7 @@ export interface ScaleOptions {
1542
1637
  id?: string;
1543
1638
  type?: ScaleType;
1544
1639
  domain?: "auto" | readonly unknown[];
1640
+ emptyDomain?: "preserve" | "require-explicit";
1545
1641
  range?: ScaleRange;
1546
1642
  nice?: boolean;
1547
1643
  zero?: boolean;
@@ -1687,6 +1783,7 @@ export interface EditScaleOptions {
1687
1783
  id?: string;
1688
1784
  type?: ScaleType;
1689
1785
  domain?: "auto" | readonly unknown[];
1786
+ emptyDomain?: "preserve" | "require-explicit";
1690
1787
  range?: ScaleRange;
1691
1788
  nice?: boolean;
1692
1789
  zero?: boolean;
@@ -2002,6 +2099,7 @@ export interface DensityDataOptions {
2002
2099
  kernel?: DensityKernel;
2003
2100
  normalization?: DensityNormalization;
2004
2101
  weight?: StatisticalWeight;
2102
+ missing?: "error" | "drop";
2005
2103
  as?: readonly [string, string];
2006
2104
  }
2007
2105
 
@@ -2097,6 +2195,7 @@ export interface IntervalDataOptions {
2097
2195
  extent?: IntervalExtent;
2098
2196
  method?: ConfidenceIntervalMethod;
2099
2197
  level?: number;
2198
+ missing?: "error" | "drop";
2100
2199
  as?: IntervalOutputFields;
2101
2200
  }
2102
2201
 
@@ -2169,6 +2268,7 @@ export type BinDataOptions = {
2169
2268
  includeEmpty?: boolean;
2170
2269
  members?: boolean;
2171
2270
  weight?: StatisticalWeight;
2271
+ missing?: "error" | "drop";
2172
2272
  as?: BinDataOutputFields;
2173
2273
  } & BinDataMode;
2174
2274
 
@@ -2311,7 +2411,22 @@ type FocusedWeightedDerivedDataEdit<T, Weight> = {
2311
2411
  : never);
2312
2412
 
2313
2413
  export type EditComputedDataOptions = FocusedDerivedDataEdit<ComputedDataOptions>;
2314
- export type EditFilteredDataOptions = FocusedDerivedDataEdit<FilterDataOptions>;
2414
+ export type FilterRangePatch = FilterRangeClosure & {
2415
+ min?: FilterBound | false;
2416
+ max?: FilterBound | false;
2417
+ };
2418
+ type FilterModePatch =
2419
+ | { oneOf: readonly [DatasetScalar, ...DatasetScalar[]]; noneOf?: never; predicate?: never; range?: never }
2420
+ | { oneOf?: never; noneOf: readonly [DatasetScalar, ...DatasetScalar[]]; predicate?: never; range?: never }
2421
+ | { oneOf?: never; noneOf?: never; predicate: FilterComparison; range?: never }
2422
+ | { oneOf?: never; noneOf?: never; predicate?: never; range: FilterRangePatch }
2423
+ | { oneOf?: never; noneOf?: never; predicate?: never; range?: never };
2424
+ export type EditFilteredDataOptions = FilterModePatch & {
2425
+ target: string;
2426
+ field?: string;
2427
+ nulls?: "include" | "exclude" | false;
2428
+ dependents?: DerivedDataDependents;
2429
+ };
2315
2430
  export type EditFoldDataOptions = FocusedDerivedDataEdit<FoldDataOptions>;
2316
2431
  export type EditSummaryDataOptions = FocusedWeightedDerivedDataEdit<
2317
2432
  SummaryDataOptions,
@@ -3675,6 +3790,7 @@ export interface TextMarkOptions {
3675
3790
  /** Explicit source mark. Mutually exclusive with data; may be incomplete. */
3676
3791
  source?: string;
3677
3792
  text?: unknown;
3793
+ missing?: "error" | "skip";
3678
3794
  fill?: string;
3679
3795
  opacity?: number;
3680
3796
  fontSize?: number;
@@ -3738,6 +3854,7 @@ export interface RemoveLabelLayoutOptions {
3738
3854
  export interface RectMarkOptions extends RectStyleDetails {
3739
3855
  id?: string;
3740
3856
  data?: string;
3857
+ missing?: "error" | "skip";
3741
3858
  fill?: string;
3742
3859
  opacity?: number;
3743
3860
  stroke?: string | false;
@@ -4145,7 +4262,8 @@ type RegressionParameterOptions =
4145
4262
  confidenceMethod?: ConfidenceIntervalMethod;
4146
4263
  level?: number;
4147
4264
  confidence?: number;
4148
- interval?: RegressionInterval;
4265
+ interval?: RegressionInterval | false;
4266
+ predict?: RegressionPredictOptions;
4149
4267
  }
4150
4268
  | {
4151
4269
  method: "polynomial";
@@ -4154,7 +4272,8 @@ type RegressionParameterOptions =
4154
4272
  confidenceMethod?: ConfidenceIntervalMethod;
4155
4273
  level?: number;
4156
4274
  confidence?: number;
4157
- interval?: RegressionInterval;
4275
+ interval?: RegressionInterval | false;
4276
+ predict?: RegressionPredictOptions;
4158
4277
  }
4159
4278
  | {
4160
4279
  method: "loess";
@@ -4164,6 +4283,7 @@ type RegressionParameterOptions =
4164
4283
  level?: never;
4165
4284
  confidence?: never;
4166
4285
  interval?: never;
4286
+ predict?: RegressionPredictOptions;
4167
4287
  };
4168
4288
 
4169
4289
  export type RegressionDataOptions = {
@@ -4172,6 +4292,7 @@ export type RegressionDataOptions = {
4172
4292
  x: string;
4173
4293
  y: string;
4174
4294
  groupBy?: string;
4295
+ missing?: "error" | "drop";
4175
4296
  } & RegressionParameterOptions;
4176
4297
 
4177
4298
  type RegressionCommonOptions = {
@@ -4180,6 +4301,8 @@ type RegressionCommonOptions = {
4180
4301
  y?: string;
4181
4302
  groupBy?: string | false;
4182
4303
  line?: StrokeStyleDetails & { strokeWidth?: number; curve?: CurveInterpolation };
4304
+ sourceBinding?: "fixed" | "follow";
4305
+ missing?: "error" | "drop";
4183
4306
  };
4184
4307
 
4185
4308
  export type RegressionOptions = RegressionCommonOptions & (
@@ -4206,9 +4329,12 @@ export interface EditRegressionOptions {
4206
4329
  confidenceMethod?: ConfidenceIntervalMethod;
4207
4330
  level?: number;
4208
4331
  confidence?: number;
4209
- interval?: RegressionInterval;
4332
+ interval?: RegressionInterval | false;
4333
+ missing?: "error" | "drop";
4334
+ predict?: RegressionPredictOptions | false;
4210
4335
  band?: false | RegressionBandOptions;
4211
4336
  line?: StrokeStyleDetails & { strokeWidth?: number; curve?: CurveInterpolation };
4337
+ sourceBinding?: "fixed" | "follow";
4212
4338
  }
4213
4339
 
4214
4340
  export interface RemoveAxisOptions {
@@ -4474,6 +4600,22 @@ export interface EditTitleOptions
4474
4600
 
4475
4601
  export interface ChartProgram extends RegisteredExtensionActions {}
4476
4602
 
4603
+ type StoredCell<T> = T extends (...args: never[]) => unknown ? never
4604
+ : T extends readonly (infer Value)[] ? readonly StoredCell<Value>[]
4605
+ : T extends object ? { readonly [Key in keyof T]: StoredCell<T[Key]> }
4606
+ : T;
4607
+
4608
+ export interface CreateDataOptions<Row extends object> {
4609
+ id?: string;
4610
+ values: readonly (Row extends readonly unknown[] ? never : Row & StoredCell<Row>)[];
4611
+ schema?: SourceSchemaInput;
4612
+ }
4613
+
4614
+ export interface ReviseDataOptions<Row extends object> extends CreateDataOptions<Row> {
4615
+ source: string;
4616
+ id: string;
4617
+ }
4618
+
4477
4619
  export class ChartProgram {
4478
4620
  constructor(state?: ActionOptions);
4479
4621
  readonly semanticSpec: SemanticSpec;
@@ -4489,9 +4631,12 @@ export class ChartProgram {
4489
4631
  createCanvas(options?: CanvasOptions): ChartProgram;
4490
4632
  editCanvas(options: CanvasOptions): ChartProgram;
4491
4633
  fitCanvas(options?: FitCanvasOptions): ChartProgram;
4634
+ applyTextMetrics(options: ApplyTextMetricsOptions): ChartProgram;
4635
+ removeTextMetrics(): ChartProgram;
4492
4636
  applyTheme(options: ApplyThemeOptions): ChartProgram;
4493
4637
  removeTheme(): ChartProgram;
4494
- createData(options: { id?: string; values: readonly unknown[] }): ChartProgram;
4638
+ createData<Row extends object>(options: CreateDataOptions<Row>): ChartProgram;
4639
+ reviseData<Row extends object>(options: ReviseDataOptions<Row>): ChartProgram;
4495
4640
  removeData(options: RemoveResourceOptions): ChartProgram;
4496
4641
  removeScale(options: RemoveResourceOptions): ChartProgram;
4497
4642
  removeCoordinate(options: RemoveResourceOptions): ChartProgram;
@@ -4519,6 +4664,7 @@ export class ChartProgram {
4519
4664
  createTimeUnitData(options: TimeUnitDataOptions): ChartProgram;
4520
4665
  createWindowData(options: WindowDataOptions): ChartProgram;
4521
4666
  createBin2DData(options: Bin2DDataOptions): ChartProgram;
4667
+ createSortedData(options: SortedDataOptions): ChartProgram;
4522
4668
  editDerivedData(options: EditDerivedDataOptions): ChartProgram;
4523
4669
  editComputedData(options: EditComputedDataOptions): ChartProgram;
4524
4670
  editFilteredData(options: EditFilteredDataOptions): ChartProgram;
@@ -4530,6 +4676,7 @@ export class ChartProgram {
4530
4676
  editDensityData(options: EditDensityDataOptions): ChartProgram;
4531
4677
  editStackData(options: EditStackDataOptions): ChartProgram;
4532
4678
  editRegressionData(options: EditRegressionDataOptions): ChartProgram;
4679
+ editSortedData(options: EditSortedDataOptions): ChartProgram;
4533
4680
  editIntervalData(options: EditIntervalDataOptions): ChartProgram;
4534
4681
  editECDFData(options: EditECDFDataOptions): ChartProgram;
4535
4682
  editNormalizedData(options: EditNormalizedDataOptions): ChartProgram;
@@ -4540,6 +4687,7 @@ export class ChartProgram {
4540
4687
  createPointMark(options?: StrokeStyleDetails & {
4541
4688
  id?: string;
4542
4689
  data?: string;
4690
+ missing?: "error" | "skip";
4543
4691
  shape?: PointShape;
4544
4692
  fill?: string;
4545
4693
  opacity?: number;
@@ -4548,6 +4696,7 @@ export class ChartProgram {
4548
4696
  }): ChartProgram;
4549
4697
  editPointMark(options: StrokeStyleDetails & {
4550
4698
  target?: string;
4699
+ missing?: "error" | "skip";
4551
4700
  shape?: PointShape;
4552
4701
  fill?: string;
4553
4702
  opacity?: number;
@@ -4557,6 +4706,7 @@ export class ChartProgram {
4557
4706
  createTickMark(options?: StrokeStyleDetails & {
4558
4707
  id?: string;
4559
4708
  data?: string;
4709
+ missing?: "error" | "skip";
4560
4710
  length?: number;
4561
4711
  stroke?: string;
4562
4712
  strokeWidth?: number;
@@ -4564,6 +4714,7 @@ export class ChartProgram {
4564
4714
  }): ChartProgram;
4565
4715
  editTickMark(options: StrokeStyleDetails & {
4566
4716
  target?: string;
4717
+ missing?: "error" | "skip";
4567
4718
  length?: number;
4568
4719
  stroke?: string;
4569
4720
  strokeWidth?: number;
@@ -4593,6 +4744,7 @@ export class ChartProgram {
4593
4744
  createBarMark(options?: RectStyleDetails & {
4594
4745
  id?: string;
4595
4746
  data?: string;
4747
+ missing?: "error" | "skip";
4596
4748
  fill?: string;
4597
4749
  opacity?: number;
4598
4750
  stroke?: FilledMarkStroke;
@@ -4600,6 +4752,7 @@ export class ChartProgram {
4600
4752
  }): ChartProgram;
4601
4753
  editBarMark(options: RectStyleDetails & {
4602
4754
  target?: string;
4755
+ missing?: "error" | "skip";
4603
4756
  fill?: string;
4604
4757
  opacity?: number;
4605
4758
  stroke?: FilledMarkStroke;
@@ -4636,8 +4789,8 @@ export class ChartProgram {
4636
4789
  }): ChartProgram;
4637
4790
  createRectMark(options?: RectMarkOptions): ChartProgram;
4638
4791
  editRectMark(options: EditRectMarkOptions): ChartProgram;
4639
- createRuleMark(options?: { id?: string; data?: string } & RuleStyleOptions): ChartProgram;
4640
- editRuleMark(options: { target?: string } & RuleStyleOptions): ChartProgram;
4792
+ createRuleMark(options?: { id?: string; data?: string; missing?: "error" | "skip" } & RuleStyleOptions): ChartProgram;
4793
+ editRuleMark(options: { target?: string; missing?: "error" | "skip" } & RuleStyleOptions): ChartProgram;
4641
4794
  createTextMark(options?: TextMarkOptions): ChartProgram;
4642
4795
  createMarkLabels(options?: CreateMarkLabelsOptions): ChartProgram;
4643
4796
  editMarkLabelSelection(options: EditMarkLabelSelectionOptions): ChartProgram;