ggaction 0.0.10 → 0.0.12

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 (224) hide show
  1. package/CHANGELOG.md +97 -0
  2. package/README.md +5 -3
  3. package/knowledge/action-card.schema.json +1 -0
  4. package/knowledge/action-cards.json +1 -10941
  5. package/knowledge/action-cards.schema.json +1 -0
  6. package/knowledge/intent-taxonomy.json +1 -183
  7. package/knowledge/intent-taxonomy.schema.json +1 -0
  8. package/knowledge/mcp-resources.json +1 -95
  9. package/knowledge/mcp-resources.schema.json +1 -0
  10. package/knowledge/task-packet.schema.json +1 -159
  11. package/knowledge/task-resolver.js +1 -1230
  12. package/package.json +18 -2
  13. package/src/actions/boxPlots/edit.js +45 -298
  14. package/src/actions/boxPlots/options.js +46 -77
  15. package/src/actions/boxPlots/resolve.js +1 -1
  16. package/src/actions/charts/bar.js +3 -0
  17. package/src/actions/charts/heatmap.js +73 -83
  18. package/src/actions/charts/index.js +1 -1
  19. package/src/actions/charts/parallel.js +35 -1
  20. package/src/actions/charts/shared.js +20 -0
  21. package/src/actions/composition/actions.js +46 -49
  22. package/src/actions/data/bin2d.js +105 -2
  23. package/src/actions/data/box.js +17 -17
  24. package/src/actions/data/density.js +42 -78
  25. package/src/actions/data/gradientProfile.js +22 -52
  26. package/src/actions/data/horizon.js +16 -41
  27. package/src/actions/data/index.js +10 -10
  28. package/src/actions/data/interval.js +16 -38
  29. package/src/actions/data/intervalEdit.js +55 -0
  30. package/src/actions/data/regression.js +7 -17
  31. package/src/actions/data/shared.js +47 -0
  32. package/src/actions/data/timeUnit.js +14 -38
  33. package/src/actions/data/window.js +14 -38
  34. package/src/actions/distributions/revision.js +154 -34
  35. package/src/actions/encodings/angle.js +9 -10
  36. package/src/actions/encodings/appearance.js +17 -51
  37. package/src/actions/encodings/density/resolve.js +3 -1
  38. package/src/actions/encodings/density.js +1 -15
  39. package/src/actions/encodings/horizon/resolve.js +13 -3
  40. package/src/actions/encodings/horizon.js +8 -7
  41. package/src/actions/encodings/index.js +9 -9
  42. package/src/actions/encodings/offset.js +41 -45
  43. package/src/actions/encodings/parallel.js +9 -10
  44. package/src/actions/encodings/pathOrder.js +6 -13
  45. package/src/actions/encodings/position/apply.js +30 -0
  46. package/src/actions/encodings/position/policies/arc.js +23 -2
  47. package/src/actions/encodings/position/policies/index.js +4 -4
  48. package/src/actions/encodings/position/policies/line.js +47 -17
  49. package/src/actions/encodings/position/resolve.js +36 -7
  50. package/src/actions/encodings/ranged.js +18 -23
  51. package/src/actions/encodings/remove.js +15 -25
  52. package/src/actions/encodings/ruleAppearance.js +9 -24
  53. package/src/actions/encodings/shared.js +37 -0
  54. package/src/actions/encodings/strokeDash.js +8 -23
  55. package/src/actions/encodings/text.js +9 -10
  56. package/src/actions/errorBands/create.js +105 -39
  57. package/src/actions/errorBands/edit.js +89 -93
  58. package/src/actions/errorBands/index.js +1 -2
  59. package/src/actions/errorBars/create.js +212 -30
  60. package/src/actions/errorBars/edit.js +91 -48
  61. package/src/actions/errorBars/index.js +1 -2
  62. package/src/actions/facets/actions.js +45 -69
  63. package/src/actions/facets/derive.js +38 -53
  64. package/src/actions/facets/replay.js +0 -1
  65. package/src/actions/gradientPlots/components.js +59 -48
  66. package/src/actions/gradientPlots/edit.js +35 -216
  67. package/src/actions/gradientPlots/index.js +11 -10
  68. package/src/actions/gradientPlots/materialize.js +21 -35
  69. package/src/actions/gradientPlots/options.js +5 -7
  70. package/src/actions/gradientPlots/paint.js +9 -6
  71. package/src/actions/gradientPlots/resolve.js +1 -1
  72. package/src/actions/guides/axes/index.js +3 -3
  73. package/src/actions/guides/axes/labels.js +68 -26
  74. package/src/actions/guides/axes/lines.js +22 -2
  75. package/src/actions/guides/axes/policy.js +28 -8
  76. package/src/actions/guides/axes/ticks.js +27 -9
  77. package/src/actions/guides/axes/titles.js +113 -65
  78. package/src/actions/guides/grids/resolve.js +14 -0
  79. package/src/actions/guides/guides.js +2 -4
  80. package/src/actions/guides/index.js +2 -2
  81. package/src/actions/guides/legends/categorical/actions.js +44 -68
  82. package/src/actions/guides/legends/categorical/components.js +6 -1
  83. package/src/actions/guides/legends/categorical/index.js +2 -2
  84. package/src/actions/guides/legends/categorical/layout.js +148 -175
  85. package/src/actions/guides/legends/categorical/recipes.js +5 -0
  86. package/src/actions/guides/legends/categorical/resolve.js +8 -1
  87. package/src/actions/guides/legends/continuous/common.js +117 -66
  88. package/src/actions/guides/legends/continuous/gradient.js +38 -37
  89. package/src/actions/guides/legends/continuous/interval.js +97 -76
  90. package/src/actions/guides/legends/continuous/opacity.js +28 -38
  91. package/src/actions/guides/legends/edit.js +14 -1
  92. package/src/actions/guides/legends/index.js +1 -1
  93. package/src/actions/guides/legends/lane.js +2 -1
  94. package/src/actions/guides/legends/remove.js +8 -0
  95. package/src/actions/guides/legends/size.js +36 -43
  96. package/src/actions/guides/legends/strokeWidth.js +20 -26
  97. package/src/actions/guides/polar/axes/labels.js +17 -1
  98. package/src/actions/guides/polar/axes/shared.js +7 -1
  99. package/src/actions/guides/polar/axes/titles.js +19 -2
  100. package/src/actions/guides/polar/grids.js +4 -0
  101. package/src/actions/guides/polar/resolve.js +6 -0
  102. package/src/actions/index.js +13 -13
  103. package/src/actions/intervals/resolve.js +87 -117
  104. package/src/actions/marks/arc/actions.js +31 -36
  105. package/src/actions/marks/area/actions.js +23 -31
  106. package/src/actions/marks/index.js +6 -6
  107. package/src/actions/marks/line/actions.js +33 -52
  108. package/src/actions/marks/line/materialize.js +7 -5
  109. package/src/actions/marks/point/materialize.js +38 -16
  110. package/src/actions/marks/remove.js +21 -0
  111. package/src/actions/marks/rule/actions.js +79 -54
  112. package/src/actions/marks/shared.js +8 -4
  113. package/src/actions/marks/text/actions.js +14 -6
  114. package/src/actions/marks/text/layout.js +21 -45
  115. package/src/actions/marks/tick/actions.js +22 -21
  116. package/src/actions/primitives/createGraphics.js +4 -0
  117. package/src/actions/primitives/editGraphics.js +4 -0
  118. package/src/actions/primitives/index.js +3 -3
  119. package/src/actions/primitives/semantic.js +1 -1
  120. package/src/actions/primitives/semanticValidation/index.js +2 -2
  121. package/src/actions/primitives/semanticValidation/layer.js +1 -1
  122. package/src/actions/regression/edit.js +3 -43
  123. package/src/actions/scales/consumers/families.js +24 -4
  124. package/src/actions/scales/consumers/index.js +1 -1
  125. package/src/actions/scales/consumers/seriesLayout.js +17 -0
  126. package/src/actions/scales/definitions.js +100 -103
  127. package/src/actions/scales/materialize.js +5 -0
  128. package/src/actions/selection/actions.js +79 -121
  129. package/src/actions/titles/actions.js +48 -94
  130. package/src/actions/titles/resolve.js +14 -27
  131. package/src/actions/violinPlots/create.js +37 -44
  132. package/src/core/textMetrics.js +74 -37
  133. package/src/core/validation.js +18 -0
  134. package/src/core/vocabulary.js +2 -2
  135. package/src/grammar/aggregate.js +48 -28
  136. package/src/grammar/arcs.js +170 -32
  137. package/src/grammar/areaSeries.js +14 -16
  138. package/src/grammar/bin2d.js +37 -23
  139. package/src/grammar/boxPlot.js +14 -13
  140. package/src/grammar/categoricalDensity.js +14 -14
  141. package/src/grammar/categoryOrder.js +8 -14
  142. package/src/grammar/curveCommands.js +87 -20
  143. package/src/grammar/density.js +162 -141
  144. package/src/grammar/facets/index.js +14 -0
  145. package/src/grammar/facets/scales.js +7 -4
  146. package/src/grammar/gradientProfile.js +12 -15
  147. package/src/grammar/histogram.js +145 -83
  148. package/src/grammar/horizon.js +60 -23
  149. package/src/grammar/interval.js +14 -13
  150. package/src/grammar/lineSeries.js +91 -61
  151. package/src/grammar/numeric.js +290 -0
  152. package/src/grammar/paint.js +3 -4
  153. package/src/grammar/palettes.js +21 -32
  154. package/src/grammar/pathCommands.js +6 -0
  155. package/src/grammar/polarPaths.js +5 -5
  156. package/src/grammar/positionCompatibility.js +1 -1
  157. package/src/grammar/regression/derive.js +48 -9
  158. package/src/grammar/regression/models.js +248 -69
  159. package/src/grammar/regression/parameters.js +8 -0
  160. package/src/grammar/rules.js +2 -0
  161. package/src/grammar/scales/color.js +35 -26
  162. package/src/grammar/scales/continuous.js +71 -24
  163. package/src/grammar/scales/definition.js +1 -1
  164. package/src/grammar/scales/discretized.js +42 -12
  165. package/src/grammar/scales/fields.js +21 -4
  166. package/src/grammar/scales/ordinal.js +139 -60
  167. package/src/grammar/scales/temporal.js +40 -11
  168. package/src/grammar/scales/transformed.js +199 -52
  169. package/src/grammar/schemas/graphicBounds.js +270 -79
  170. package/src/grammar/seriesLayout.js +50 -18
  171. package/src/grammar/ticks.js +123 -53
  172. package/src/grammar/timeUnit.js +18 -8
  173. package/src/grammar/transforms.js +4 -1
  174. package/src/grammar/window.js +70 -57
  175. package/src/index.js +1 -1
  176. package/src/layout/canvas.js +4 -8
  177. package/src/layout/composition.js +39 -40
  178. package/src/layout/facets.js +55 -30
  179. package/src/layout/labels.js +91 -15
  180. package/src/layout/legend.js +22 -20
  181. package/src/layout/legendLane.js +54 -40
  182. package/src/layout/title.js +7 -7
  183. package/src/materialization/bars/aggregate.js +14 -40
  184. package/src/materialization/bars/grouped.js +7 -18
  185. package/src/materialization/bars/histogram.js +2 -19
  186. package/src/materialization/bars/ranged.js +20 -15
  187. package/src/materialization/bars/resolve.js +21 -0
  188. package/src/materialization/facetGuides/legacyCategorical.js +9 -2
  189. package/src/materialization/facetGuides/placement.js +49 -19
  190. package/src/materialization/facetGuides/preparation.js +35 -6
  191. package/src/materialization/facets.js +42 -28
  192. package/src/materialization/guides/resources.js +2 -1
  193. package/src/materialization/marks/capabilities.js +15 -4
  194. package/src/materialization/marks/index.js +29 -6
  195. package/src/materialization/rowEncoding.js +57 -1
  196. package/src/materialization/scales/policies/bar.js +61 -102
  197. package/src/materialization/scales/policies/binnedPosition.js +34 -0
  198. package/src/materialization/scales/policies/offset.js +54 -0
  199. package/src/materialization/scales/policies/series.js +13 -7
  200. package/src/materialization/scales/resolve.js +6 -9
  201. package/src/materialization/selection/items/arc.js +16 -2
  202. package/src/materialization/selection/items/bar.js +4 -2
  203. package/src/materialization/selection/items/common.js +21 -1
  204. package/src/materialization/selection/items/path.js +19 -2
  205. package/src/materialization/selection/items/point.js +4 -16
  206. package/src/materialization/selection/items/tick.js +13 -21
  207. package/src/materialization/selection/point.js +11 -4
  208. package/src/materialization/selection/styles.js +19 -27
  209. package/src/materialization/text.js +4 -1
  210. package/src/mcp/adapter.js +8 -3
  211. package/src/renderers/canvas/fill.js +2 -2
  212. package/src/renderers/canvas/index.js +35 -2
  213. package/src/renderers/canvas/native.js +160 -0
  214. package/src/renderers/pdf.js +14 -0
  215. package/src/renderers/svg.js +37 -4
  216. package/types/index.d.ts +3 -0
  217. package/types/program.d.ts +523 -131
  218. package/types/svg.d.ts +1 -0
  219. package/src/actions/errorBands/components.js +0 -81
  220. package/src/actions/errorBands/options.js +0 -39
  221. package/src/actions/errorBands/resolve.js +0 -28
  222. package/src/actions/errorBars/components.js +0 -62
  223. package/src/actions/errorBars/options.js +0 -58
  224. package/src/actions/errorBars/resolve.js +0 -25
@@ -199,7 +199,7 @@ export interface CategoryDensityPlacement {
199
199
  side?: DensityPlacementSide;
200
200
  width?: DensityPlacementWidth;
201
201
  split?: DensityPlacementSplit;
202
- scale?: ScaleOptions;
202
+ scale?: NonPointBandPositionScaleOptions;
203
203
  }
204
204
  export type DensityPlacement =
205
205
  | BaselineDensityPlacement
@@ -707,10 +707,11 @@ export interface CanvasOptions {
707
707
 
708
708
  export type XAxisPosition = "bottom" | "top";
709
709
  export type YAxisPosition = "left" | "right";
710
+ type TimeAxisDirective = "Y" | "m" | "d" | "b";
710
711
  export type AxisFormatString =
711
712
  | ".0f" | ".1f" | ".2f"
712
713
  | ".0%" | ".1%" | ".2e"
713
- | "%Y" | "%Y-%m" | "%Y-%m-%d";
714
+ | `${string}%${TimeAxisDirective}${string}`;
714
715
  export type AxisFormat =
715
716
  | "auto"
716
717
  | AxisFormatString
@@ -887,6 +888,33 @@ export interface CreateGuidesOptions {
887
888
  legend?: false | LegendOptions;
888
889
  }
889
890
 
891
+ type CartesianAxesOptions = Omit<
892
+ CreateAxesOptions,
893
+ "coordinate" | "theta" | "radius"
894
+ > & {
895
+ coordinate?: { id?: string; type?: "auto" | "cartesian" };
896
+ };
897
+ type CartesianGridOptions = Pick<CreateGridOptions, "horizontal" | "vertical">;
898
+ type CartesianGuideOptions = {
899
+ axes?: false | CartesianAxesOptions;
900
+ grid?: false | CartesianGridOptions;
901
+ legend?: false | LegendOptions;
902
+ };
903
+ type GradientPlotDensityLegendOptions = {
904
+ title?: string;
905
+ position?: "right";
906
+ };
907
+ type GradientPlotGuideOptions = Omit<CartesianGuideOptions, "legend"> & {
908
+ legend?: false | GradientPlotDensityLegendOptions;
909
+ };
910
+ type ParallelGuideOptions = {
911
+ axes?: false | {
912
+ coordinate?: { id?: string; type?: "auto" | "parallel" };
913
+ };
914
+ grid?: false;
915
+ legend?: false | LegendOptions;
916
+ };
917
+
890
918
  export interface CreateCoordinateOptions {
891
919
  id?: string;
892
920
  type?: "cartesian" | "polar" | "parallel";
@@ -914,6 +942,79 @@ export interface ScaleOptions {
914
942
  unknown?: unknown;
915
943
  }
916
944
 
945
+ export type QuantitativePositionScaleType =
946
+ | "linear" | "log" | "pow" | "sqrt" | "symlog";
947
+ type ScaleFields<Keys extends keyof ScaleOptions> = Pick<ScaleOptions, Keys>;
948
+ export type NonPointQuantitativePositionScaleOptions = ScaleFields<
949
+ "id" | "nice" | "zero" | "clamp" | "reverse" |
950
+ "base" | "exponent" | "constant"
951
+ > & {
952
+ type?: QuantitativePositionScaleType;
953
+ domain?: "auto" | readonly [number, number];
954
+ range?: "auto" | readonly [number, number];
955
+ };
956
+ export type QuantitativePositionScaleOptions =
957
+ NonPointQuantitativePositionScaleOptions & { unknown?: number };
958
+ export type ZeroSupportingPositionScaleType =
959
+ | "linear" | "pow" | "sqrt" | "symlog";
960
+ export type NonPointZeroSupportingPositionScaleOptions = Omit<
961
+ NonPointQuantitativePositionScaleOptions,
962
+ "base" | "type"
963
+ > & { type?: ZeroSupportingPositionScaleType };
964
+ export type NonPointTemporalPositionScaleOptions = ScaleFields<
965
+ "id" | "nice" | "clamp" | "reverse"
966
+ > & {
967
+ type?: "time";
968
+ domain?: "auto" | readonly [number, number];
969
+ range?: "auto" | readonly [number, number];
970
+ };
971
+ export type TemporalPositionScaleOptions =
972
+ NonPointTemporalPositionScaleOptions & { unknown?: number };
973
+ export type NonPointBandPositionScaleOptions = ScaleFields<
974
+ "id" | "reverse" | "paddingInner" | "paddingOuter" | "align"
975
+ > & {
976
+ type?: "band";
977
+ domain?: "auto" | readonly unknown[];
978
+ range?: "auto" | readonly [number, number];
979
+ };
980
+ export type BandPositionScaleOptions =
981
+ NonPointBandPositionScaleOptions & { unknown?: number };
982
+ export type NonPointPointPositionScaleOptions = ScaleFields<
983
+ "id" | "reverse" | "padding" | "align"
984
+ > & {
985
+ type?: "point";
986
+ domain?: "auto" | readonly unknown[];
987
+ range?: "auto" | readonly [number, number];
988
+ };
989
+ export type PointPositionScaleOptions =
990
+ NonPointPointPositionScaleOptions & { unknown?: number };
991
+ export type CategoricalPositionScaleOptions =
992
+ | BandPositionScaleOptions
993
+ | PointPositionScaleOptions;
994
+ export type NonPointCategoricalPositionScaleOptions =
995
+ | NonPointBandPositionScaleOptions
996
+ | NonPointPointPositionScaleOptions;
997
+ type WithoutScaleId<T> = T extends unknown ? Omit<T, "id"> : never;
998
+ export type NonPointCategoricalColorScaleOptions = ScaleFields<"id" | "palette"> & {
999
+ type?: "ordinal";
1000
+ domain?: "auto" | readonly unknown[];
1001
+ range?: "auto" | readonly string[] | { readonly palette: Palette };
1002
+ };
1003
+ export type CategoricalColorScaleOptions =
1004
+ NonPointCategoricalColorScaleOptions & { unknown?: string };
1005
+ export type SizeScaleOptions = ScaleFields<"id"> & {
1006
+ type?: "linear";
1007
+ domain?: "auto" | readonly [number, number];
1008
+ range?: "auto" | readonly [number, number];
1009
+ unknown?: number;
1010
+ };
1011
+ export type ShapeScaleOptions = ScaleFields<"id"> & {
1012
+ type?: "ordinal";
1013
+ domain?: "auto" | readonly unknown[];
1014
+ range?: "auto" | readonly PointShape[];
1015
+ unknown?: PointShape;
1016
+ };
1017
+
917
1018
  export type CreateScaleOptions = ScaleOptions & { id: string };
918
1019
 
919
1020
  export interface EditScaleOptions {
@@ -937,13 +1038,10 @@ export interface EditScaleOptions {
937
1038
  unknown?: unknown;
938
1039
  }
939
1040
 
940
- export interface PositionEncodingOptions {
1041
+ interface PositionEncodingBase {
941
1042
  field: string;
942
1043
  target?: string;
943
- fieldType?: FieldType;
944
- scale?: ScaleOptions;
945
1044
  coordinate?: string;
946
- aggregate?: AggregateOperation;
947
1045
  bin?:
948
1046
  | { maxBins?: number; step?: never; boundaries?: never }
949
1047
  | { maxBins?: never; step: number; boundaries?: never }
@@ -955,8 +1053,38 @@ export interface PositionEncodingOptions {
955
1053
  stack?: StackMode;
956
1054
  }
957
1055
 
1056
+ type PositionScaleBranches<Quantitative, Temporal, Categorical> =
1057
+ | {
1058
+ fieldType?: "quantitative";
1059
+ aggregate?: never;
1060
+ scale?: Quantitative;
1061
+ }
1062
+ | {
1063
+ fieldType: "temporal";
1064
+ aggregate?: never;
1065
+ scale?: Temporal;
1066
+ }
1067
+ | {
1068
+ fieldType: "nominal" | "ordinal";
1069
+ aggregate?: never;
1070
+ scale?: Categorical;
1071
+ }
1072
+ | {
1073
+ fieldType?: FieldType;
1074
+ aggregate: AggregateOperation;
1075
+ scale?: Quantitative;
1076
+ };
1077
+
1078
+ export type PositionEncodingOptions = PositionEncodingBase & PositionScaleBranches<
1079
+ QuantitativePositionScaleOptions,
1080
+ TemporalPositionScaleOptions,
1081
+ CategoricalPositionScaleOptions
1082
+ >;
1083
+
958
1084
  export type YPositionEncodingOptions =
959
- Omit<PositionEncodingOptions, "stack"> & { stack?: YStackMode };
1085
+ PositionEncodingOptions extends infer T
1086
+ ? T extends unknown ? Omit<T, "bin" | "stack"> & { stack?: YStackMode } : never
1087
+ : never;
960
1088
 
961
1089
  export interface ThetaScaleOptions {
962
1090
  id?: string;
@@ -971,7 +1099,6 @@ export interface ThetaScaleOptions {
971
1099
  paddingOuter?: number;
972
1100
  padding?: number;
973
1101
  align?: number;
974
- unknown?: unknown;
975
1102
  }
976
1103
 
977
1104
  export interface RadiusScaleOptions {
@@ -986,10 +1113,13 @@ export interface RadiusScaleOptions {
986
1113
  base?: number;
987
1114
  exponent?: number;
988
1115
  constant?: number;
989
- unknown?: unknown;
990
1116
  }
991
1117
 
992
1118
  export interface ThetaEncodingOptions {
1119
+ /**
1120
+ * Arc marks interpret an aggregate-free quantitative field as per-row sector
1121
+ * weights. Categorical arc theta retains the count and weighted-sum modes.
1122
+ */
993
1123
  field: string;
994
1124
  target?: string;
995
1125
  fieldType?: FieldType;
@@ -1011,15 +1141,46 @@ type RulePositionValue =
1011
1141
  | { field: string; datum?: never }
1012
1142
  | { field?: never; datum: unknown };
1013
1143
 
1014
- export type RulePositionEncodingOptions = RulePositionValue & {
1144
+ type RulePositionEncodingBase = RulePositionValue & {
1015
1145
  target?: string;
1016
- fieldType: FieldType;
1017
- scale?: ScaleOptions;
1018
1146
  coordinate?: string;
1019
1147
  };
1020
1148
 
1149
+ type InferredRuleDatumPositionEncodingOptions = {
1150
+ field?: never;
1151
+ datum: unknown;
1152
+ target?: string;
1153
+ coordinate?: string;
1154
+ fieldType?: undefined;
1155
+ scale?:
1156
+ | NonPointQuantitativePositionScaleOptions
1157
+ | NonPointCategoricalPositionScaleOptions;
1158
+ };
1159
+
1160
+ export type RulePositionEncodingOptions =
1161
+ | InferredRuleDatumPositionEncodingOptions
1162
+ | RulePositionEncodingBase & (
1163
+ | {
1164
+ fieldType: "quantitative";
1165
+ scale?: NonPointQuantitativePositionScaleOptions;
1166
+ }
1167
+ | {
1168
+ fieldType: "temporal";
1169
+ scale?: NonPointTemporalPositionScaleOptions;
1170
+ }
1171
+ | {
1172
+ fieldType: "nominal" | "ordinal";
1173
+ scale?: NonPointCategoricalPositionScaleOptions;
1174
+ }
1175
+ );
1176
+
1177
+ type SecondaryRulePositionEncodingOptions = RulePositionEncodingBase & {
1178
+ fieldType: FieldType;
1179
+ scale?: { id?: string };
1180
+ };
1181
+
1021
1182
  export type SecondaryPositionEncodingOptions =
1022
- | RulePositionEncodingOptions
1183
+ | SecondaryRulePositionEncodingOptions
1023
1184
  | {
1024
1185
  field: string;
1025
1186
  datum?: never;
@@ -1034,8 +1195,8 @@ export type HistogramEncodingOptions = {
1034
1195
  target?: string;
1035
1196
  coordinate?: string;
1036
1197
  stack?: StackMode;
1037
- xScale?: ScaleOptions;
1038
- yScale?: ScaleOptions;
1198
+ xScale?: NonPointQuantitativePositionScaleOptions;
1199
+ yScale?: NonPointZeroSupportingPositionScaleOptions;
1039
1200
  } & (
1040
1201
  | { maxBins?: number; binStep?: never; binBoundaries?: never }
1041
1202
  | { maxBins?: never; binStep: number; binBoundaries?: never }
@@ -1050,7 +1211,7 @@ export interface CategoricalEncodingOptions {
1050
1211
  field: string;
1051
1212
  target?: string;
1052
1213
  fieldType?: "nominal" | "ordinal";
1053
- scale?: ScaleOptions;
1214
+ scale?: CategoricalColorScaleOptions;
1054
1215
  palette?: Palette;
1055
1216
  layout?: ColorLayout;
1056
1217
  }
@@ -1072,13 +1233,13 @@ type DensityEncodingBase = Omit<DensityDataOptions, "id"> & {
1072
1233
  target?: string;
1073
1234
  densityChannel?: "x" | "y";
1074
1235
  coordinate?: string;
1075
- valueScale?: ScaleOptions;
1236
+ valueScale?: NonPointQuantitativePositionScaleOptions;
1076
1237
  };
1077
1238
 
1078
1239
  export type DensityEncodingOptions = DensityEncodingBase & (
1079
1240
  | {
1080
1241
  placement?: BaselineDensityPlacement;
1081
- densityScale?: ScaleOptions;
1242
+ densityScale?: NonPointZeroSupportingPositionScaleOptions;
1082
1243
  }
1083
1244
  | {
1084
1245
  placement: CategoryDensityPlacement;
@@ -1086,16 +1247,33 @@ export type DensityEncodingOptions = DensityEncodingBase & (
1086
1247
  }
1087
1248
  );
1088
1249
 
1089
- export interface HorizonXEncoding {
1090
- field: string;
1091
- fieldType?: "quantitative" | "temporal";
1092
- scale?: ScaleOptions;
1093
- }
1250
+ export type HorizonXEncoding = { field: string } & (
1251
+ | {
1252
+ fieldType: "quantitative";
1253
+ scale?: NonPointQuantitativePositionScaleOptions;
1254
+ }
1255
+ | {
1256
+ fieldType: "temporal";
1257
+ scale?: NonPointTemporalPositionScaleOptions;
1258
+ }
1259
+ | {
1260
+ fieldType?: undefined;
1261
+ scale?:
1262
+ | NonPointQuantitativePositionScaleOptions
1263
+ | NonPointTemporalPositionScaleOptions;
1264
+ }
1265
+ );
1266
+
1267
+ export type HorizonYScaleOptions = ScaleFields<"id" | "clamp" | "reverse"> & {
1268
+ type?: "linear";
1269
+ domain?: readonly [0, 1];
1270
+ range?: "auto" | readonly [number, number];
1271
+ };
1094
1272
 
1095
1273
  export interface HorizonYEncoding {
1096
1274
  field: string;
1097
1275
  fieldType?: "quantitative";
1098
- scale?: ScaleOptions;
1276
+ scale?: HorizonYScaleOptions;
1099
1277
  }
1100
1278
 
1101
1279
  export interface HorizonPaletteOptions {
@@ -1183,37 +1361,56 @@ export interface EditBin2DDataOptions {
1183
1361
  as?: DatasetBin2DOutputFields;
1184
1362
  }
1185
1363
 
1186
- export interface ErrorBarPositionChannel {
1187
- field?: string;
1188
- fieldType?: "nominal" | "ordinal" | "temporal";
1189
- scale?: ScaleOptions;
1190
- }
1364
+ export type ErrorBarPositionChannel = { field?: string } & (
1365
+ | {
1366
+ fieldType?: "nominal" | "ordinal";
1367
+ scale?: NonPointCategoricalPositionScaleOptions;
1368
+ }
1369
+ | {
1370
+ fieldType: "temporal";
1371
+ scale?: NonPointTemporalPositionScaleOptions;
1372
+ }
1373
+ | {
1374
+ fieldType: "quantitative";
1375
+ scale?: NonPointQuantitativePositionScaleOptions;
1376
+ }
1377
+ );
1191
1378
 
1192
1379
  export interface ErrorBarStatisticalIntervalChannel {
1193
1380
  field?: string;
1194
1381
  center?: IntervalCenter;
1195
1382
  extent?: IntervalExtent;
1196
1383
  level?: number;
1197
- scale?: ScaleOptions;
1384
+ scale?: NonPointQuantitativePositionScaleOptions;
1198
1385
  }
1199
1386
 
1200
1387
  export interface ErrorBarExplicitIntervalChannel {
1201
1388
  center: string;
1202
1389
  lower: string;
1203
1390
  upper: string;
1204
- scale?: ScaleOptions;
1391
+ scale?: NonPointQuantitativePositionScaleOptions;
1205
1392
  }
1206
1393
 
1207
1394
  export type ErrorBarIntervalChannel =
1208
1395
  | ErrorBarStatisticalIntervalChannel
1209
1396
  | ErrorBarExplicitIntervalChannel;
1210
1397
 
1398
+ export interface ErrorBarOffsetChannel {
1399
+ field?: string;
1400
+ fieldType?: "nominal" | "ordinal";
1401
+ scale?: OffsetScaleOptions;
1402
+ paddingInner?: number;
1403
+ paddingOuter?: number;
1404
+ }
1405
+
1211
1406
  export interface ErrorBarOptions {
1212
1407
  id?: string;
1213
1408
  target?: string;
1214
1409
  data?: string;
1215
1410
  x?: ErrorBarPositionChannel | ErrorBarIntervalChannel;
1216
1411
  y?: ErrorBarPositionChannel | ErrorBarIntervalChannel;
1412
+ xOffset?: ErrorBarOffsetChannel;
1413
+ yOffset?: ErrorBarOffsetChannel;
1217
1414
  groupBy?: string;
1218
1415
  coordinate?: string;
1219
1416
  caps?: boolean;
@@ -1241,14 +1438,14 @@ export interface EditErrorBarOptions {
1241
1438
 
1242
1439
  export interface BoxPlotCategoryChannel {
1243
1440
  field: string;
1244
- fieldType: "nominal" | "ordinal" | "temporal";
1245
- scale?: ScaleOptions;
1441
+ fieldType: "nominal" | "ordinal";
1442
+ scale?: NonPointBandPositionScaleOptions;
1246
1443
  }
1247
1444
 
1248
1445
  export interface BoxPlotMeasureChannel {
1249
1446
  field: string;
1250
1447
  fieldType?: "quantitative";
1251
- scale?: ScaleOptions;
1448
+ scale?: NonPointQuantitativePositionScaleOptions;
1252
1449
  }
1253
1450
 
1254
1451
  export type BoxPlotPositionChannel =
@@ -1284,7 +1481,7 @@ export interface BoxPlotOptions {
1284
1481
  radius?: number;
1285
1482
  opacity?: number;
1286
1483
  };
1287
- guides?: false | CreateGuidesOptions;
1484
+ guides?: false | CartesianGuideOptions;
1288
1485
  }
1289
1486
 
1290
1487
  export interface EditBoxPlotOptions {
@@ -1344,12 +1541,28 @@ export interface GradientPlotOptions {
1344
1541
  width?: { band?: number };
1345
1542
  gradient?: GradientPlotAppearanceOptions;
1346
1543
  center?: false | GradientPlotCenterOptions;
1347
- guides?: false | CreateGuidesOptions;
1544
+ guides?: false | GradientPlotGuideOptions;
1348
1545
  }
1349
1546
 
1350
1547
  export type ViolinPlotPositionChannel =
1351
1548
  | string
1352
- | BoxPlotPositionChannel;
1549
+ | {
1550
+ field: string;
1551
+ fieldType: "nominal" | "ordinal";
1552
+ scale?: NonPointBandPositionScaleOptions;
1553
+ }
1554
+ | {
1555
+ field: string;
1556
+ fieldType: "quantitative";
1557
+ scale?: NonPointQuantitativePositionScaleOptions;
1558
+ }
1559
+ | {
1560
+ field: string;
1561
+ fieldType?: undefined;
1562
+ scale?:
1563
+ | NonPointBandPositionScaleOptions
1564
+ | NonPointQuantitativePositionScaleOptions;
1565
+ };
1353
1566
 
1354
1567
  export interface ViolinPlotDensityOptions
1355
1568
  extends GradientPlotDensityOptions {
@@ -1363,7 +1576,13 @@ export interface ViolinPlotSplitOptions {
1363
1576
 
1364
1577
  export type ViolinPlotColorOptions =
1365
1578
  | string
1366
- | Omit<CategoricalEncodingOptions, "target">;
1579
+ | {
1580
+ field: string;
1581
+ fieldType?: "nominal" | "ordinal";
1582
+ scale?: NonPointCategoricalColorScaleOptions;
1583
+ palette?: Palette;
1584
+ layout?: "overlay";
1585
+ };
1367
1586
 
1368
1587
  export interface ViolinPlotAreaOptions {
1369
1588
  fill?: string;
@@ -1383,7 +1602,7 @@ export interface ViolinPlotOptions {
1383
1602
  color?: ViolinPlotColorOptions;
1384
1603
  density?: ViolinPlotDensityOptions;
1385
1604
  area?: ViolinPlotAreaOptions;
1386
- guides?: false | CreateGuidesOptions;
1605
+ guides?: false | CartesianGuideOptions;
1387
1606
  }
1388
1607
 
1389
1608
  export interface EditGradientPlotOptions {
@@ -1397,23 +1616,169 @@ export interface EditGradientPlotOptions {
1397
1616
  center?: false | GradientPlotCenterOptions;
1398
1617
  }
1399
1618
 
1400
- type BasicPositionChannel =
1619
+ type FacadePositionChannel<Quantitative, Temporal, Categorical> =
1620
+ | string
1621
+ | (Omit<PositionEncodingBase, "target" | "coordinate"> &
1622
+ PositionScaleBranches<Quantitative, Temporal, Categorical>);
1623
+ type PointFacadePositionChannel =
1624
+ | string
1625
+ | ({ field: string } & (
1626
+ | {
1627
+ fieldType?: "quantitative";
1628
+ scale?: QuantitativePositionScaleOptions;
1629
+ }
1630
+ | {
1631
+ fieldType: "temporal";
1632
+ scale?: TemporalPositionScaleOptions;
1633
+ }
1634
+ | {
1635
+ fieldType: "nominal" | "ordinal";
1636
+ scale?: CategoricalPositionScaleOptions;
1637
+ }
1638
+ ));
1639
+ type LineXPositionChannel =
1401
1640
  | string
1402
- | Omit<PositionEncodingOptions, "target" | "coordinate">;
1641
+ | ({ field: string; bin?: PositionEncodingBase["bin"] } & (
1642
+ | {
1643
+ fieldType?: "quantitative";
1644
+ scale?: NonPointQuantitativePositionScaleOptions;
1645
+ }
1646
+ | {
1647
+ fieldType: "temporal";
1648
+ scale?: NonPointTemporalPositionScaleOptions;
1649
+ }
1650
+ ));
1651
+ type LineYPositionChannel =
1652
+ | string
1653
+ | ({ field: string } & (
1654
+ | {
1655
+ fieldType?: "quantitative";
1656
+ aggregate?: AggregateOperation;
1657
+ scale?: NonPointQuantitativePositionScaleOptions;
1658
+ }
1659
+ | {
1660
+ fieldType: "temporal";
1661
+ aggregate?: never;
1662
+ scale?: NonPointTemporalPositionScaleOptions;
1663
+ }
1664
+ ));
1665
+ type BandPositionChannel = FacadePositionChannel<
1666
+ NonPointZeroSupportingPositionScaleOptions,
1667
+ NonPointTemporalPositionScaleOptions,
1668
+ NonPointBandPositionScaleOptions
1669
+ >;
1670
+ type BarYPositionChannel =
1671
+ | string
1672
+ | ({ field: string; stack?: StackMode } & (
1673
+ | {
1674
+ fieldType?: "quantitative";
1675
+ aggregate?: never;
1676
+ scale?: NonPointZeroSupportingPositionScaleOptions;
1677
+ }
1678
+ | {
1679
+ fieldType: "nominal" | "ordinal";
1680
+ aggregate?: never;
1681
+ scale?: NonPointBandPositionScaleOptions;
1682
+ }
1683
+ | {
1684
+ fieldType?: "quantitative" | "nominal" | "ordinal";
1685
+ aggregate: AggregateOperation;
1686
+ scale?: NonPointZeroSupportingPositionScaleOptions;
1687
+ }
1688
+ ));
1403
1689
  type BasicColorChannel =
1404
1690
  | string
1405
- | (ColorEncodingOptions extends infer T
1406
- ? T extends unknown ? Omit<T, "target"> : never
1407
- : never);
1691
+ | {
1692
+ field: string;
1693
+ fieldType?: "nominal" | "ordinal";
1694
+ scale?: CategoricalColorScaleOptions;
1695
+ palette?: Palette;
1696
+ }
1697
+ | {
1698
+ field: string;
1699
+ fieldType: "quantitative";
1700
+ scale?: ContinuousColorScaleOptions | DiscretizedColorScaleOptions;
1701
+ palette?: Palette;
1702
+ }
1703
+ | {
1704
+ field: string;
1705
+ fieldType: "temporal";
1706
+ scale?: ContinuousColorScaleOptions;
1707
+ palette?: Palette;
1708
+ };
1709
+ type NonPointCategoricalColorChannel =
1710
+ | string
1711
+ | {
1712
+ field: string;
1713
+ fieldType?: "nominal" | "ordinal";
1714
+ scale?: NonPointCategoricalColorScaleOptions;
1715
+ palette?: Palette;
1716
+ layout?: ColorLayout;
1717
+ };
1718
+ type HistogramCategoricalColorChannel =
1719
+ | string
1720
+ | {
1721
+ field: string;
1722
+ fieldType?: "nominal" | "ordinal";
1723
+ scale?: NonPointCategoricalColorScaleOptions;
1724
+ palette?: Palette;
1725
+ layout?: Exclude<ColorLayout, "center">;
1726
+ };
1727
+ type LineCategoricalColorChannel =
1728
+ | string
1729
+ | {
1730
+ field: string;
1731
+ fieldType?: "nominal" | "ordinal";
1732
+ scale?: NonPointCategoricalColorScaleOptions;
1733
+ palette?: Palette;
1734
+ };
1735
+ type QuantitativeBarColorChannel = {
1736
+ field: string;
1737
+ fieldType: "quantitative";
1738
+ aggregate?: AggregateOperation;
1739
+ scale?:
1740
+ | NonPointContinuousColorScaleOptions
1741
+ | NonPointDiscretizedColorScaleOptions;
1742
+ palette?: Palette;
1743
+ layout?: never;
1744
+ };
1745
+ type BarCategoricalColorChannel =
1746
+ | string
1747
+ | {
1748
+ field: string;
1749
+ fieldType?: "nominal" | "ordinal";
1750
+ scale?: NonPointCategoricalColorScaleOptions;
1751
+ palette?: Palette;
1752
+ layout?: Exclude<ColorLayout, "center">;
1753
+ };
1754
+ type BarColorChannel =
1755
+ | BarCategoricalColorChannel
1756
+ | QuantitativeBarColorChannel;
1757
+ type RectColorChannel =
1758
+ | LineCategoricalColorChannel
1759
+ | {
1760
+ field: string;
1761
+ fieldType: "quantitative";
1762
+ scale?:
1763
+ | NonPointContinuousColorScaleOptions
1764
+ | NonPointDiscretizedColorScaleOptions;
1765
+ palette?: Palette;
1766
+ }
1767
+ | {
1768
+ field: string;
1769
+ fieldType: "temporal";
1770
+ scale?: NonPointContinuousColorScaleOptions;
1771
+ palette?: Palette;
1772
+ };
1408
1773
  export type BasicSizeChannel = string | {
1409
1774
  field: string;
1410
1775
  fieldType?: "quantitative";
1411
- scale?: ScaleOptions;
1776
+ scale?: SizeScaleOptions;
1412
1777
  };
1413
1778
  export type BasicShapeChannel = string | {
1414
1779
  field: string;
1415
1780
  fieldType?: "nominal";
1416
- scale?: ScaleOptions;
1781
+ scale?: ShapeScaleOptions;
1417
1782
  };
1418
1783
  export type BasicStrokeDashChannel =
1419
1784
  StrokeDashEncodingOptions extends infer T
@@ -1421,12 +1786,25 @@ export type BasicStrokeDashChannel =
1421
1786
  : never;
1422
1787
 
1423
1788
  export type ParallelMissingPolicy = "break" | "drop-row" | "error";
1424
- export type ParallelDimension = string | {
1789
+ export type ParallelDimension = string | ({
1425
1790
  field: string;
1426
- fieldType?: "quantitative" | "ordinal";
1427
1791
  title?: string;
1428
- scale?: Omit<ScaleOptions, "id">;
1429
- };
1792
+ } & (
1793
+ | {
1794
+ fieldType: "quantitative";
1795
+ scale?: WithoutScaleId<QuantitativePositionScaleOptions>;
1796
+ }
1797
+ | {
1798
+ fieldType: "ordinal";
1799
+ scale?: WithoutScaleId<CategoricalPositionScaleOptions>;
1800
+ }
1801
+ | {
1802
+ fieldType?: undefined;
1803
+ scale?: WithoutScaleId<
1804
+ QuantitativePositionScaleOptions | CategoricalPositionScaleOptions
1805
+ >;
1806
+ }
1807
+ ));
1430
1808
  export interface ParallelCoordinatesEncodingOptions {
1431
1809
  target?: string;
1432
1810
  coordinate?: string;
@@ -1441,7 +1819,7 @@ export interface CreateParallelCoordinatesOptions {
1441
1819
  dimensions: readonly [ParallelDimension, ParallelDimension, ...ParallelDimension[]];
1442
1820
  key?: string;
1443
1821
  missing?: ParallelMissingPolicy;
1444
- color?: BasicColorChannel;
1822
+ color?: LineCategoricalColorChannel;
1445
1823
  strokeDash?: BasicStrokeDashChannel;
1446
1824
  line?: {
1447
1825
  strokeWidth?: number;
@@ -1450,15 +1828,15 @@ export interface CreateParallelCoordinatesOptions {
1450
1828
  curve?: "linear";
1451
1829
  closed?: false;
1452
1830
  };
1453
- guides?: false | CreateGuidesOptions;
1831
+ guides?: false | ParallelGuideOptions;
1454
1832
  }
1455
1833
 
1456
1834
  export interface CreateScatterPlotOptions {
1457
1835
  id?: string;
1458
1836
  data?: string;
1459
1837
  coordinate?: string;
1460
- x: BasicPositionChannel;
1461
- y: BasicPositionChannel;
1838
+ x: PointFacadePositionChannel;
1839
+ y: PointFacadePositionChannel;
1462
1840
  color?: BasicColorChannel;
1463
1841
  size?: BasicSizeChannel;
1464
1842
  shape?: BasicShapeChannel;
@@ -1476,9 +1854,9 @@ export interface CreateLinePlotOptions {
1476
1854
  id?: string;
1477
1855
  data?: string;
1478
1856
  coordinate?: string;
1479
- x: BasicPositionChannel;
1480
- y: BasicPositionChannel;
1481
- color?: BasicColorChannel;
1857
+ x: LineXPositionChannel;
1858
+ y: LineYPositionChannel;
1859
+ color?: LineCategoricalColorChannel;
1482
1860
  groupBy?: string;
1483
1861
  strokeDash?: BasicStrokeDashChannel;
1484
1862
  line?: {
@@ -1486,23 +1864,27 @@ export interface CreateLinePlotOptions {
1486
1864
  curve?: CurveInterpolation;
1487
1865
  stroke?: string;
1488
1866
  opacity?: number;
1489
- closed?: boolean;
1867
+ closed?: false;
1490
1868
  };
1491
1869
  guides?: false | CreateGuidesOptions;
1492
1870
  }
1493
1871
 
1494
1872
  type BasicHistogramEncoding =
1495
1873
  HistogramEncodingOptions extends infer T
1496
- ? T extends unknown ? Omit<T, "field" | "target" | "coordinate"> : never
1874
+ ? T extends unknown
1875
+ ? Omit<T, "field" | "target" | "coordinate" | "stack"> & {
1876
+ stack?: Exclude<StackMode, "center">;
1877
+ }
1878
+ : never
1497
1879
  : never;
1498
1880
 
1499
1881
  export interface CreateBarPlotOptions {
1500
1882
  id?: string;
1501
1883
  data?: string;
1502
1884
  coordinate?: string;
1503
- x: BasicPositionChannel;
1504
- y: BasicPositionChannel;
1505
- color?: BasicColorChannel;
1885
+ x: BandPositionChannel;
1886
+ y: BarYPositionChannel;
1887
+ color?: BarColorChannel;
1506
1888
  width?: Omit<BarWidthOptions, "target">;
1507
1889
  bar?: {
1508
1890
  fill?: string;
@@ -1518,7 +1900,7 @@ export type CreateHistogramOptions = BasicHistogramEncoding & {
1518
1900
  data?: string;
1519
1901
  coordinate?: string;
1520
1902
  field: string;
1521
- color?: BasicColorChannel;
1903
+ color?: HistogramCategoricalColorChannel;
1522
1904
  bar?: {
1523
1905
  fill?: string;
1524
1906
  opacity?: number;
@@ -1537,24 +1919,34 @@ export interface HeatmapBaseOptions {
1537
1919
  stroke?: string | false;
1538
1920
  strokeWidth?: number;
1539
1921
  };
1540
- guides?: false | CreateGuidesOptions;
1922
+ guides?: false | CartesianGuideOptions;
1541
1923
  }
1542
1924
 
1925
+ export type HeatmapCategoryPositionChannel =
1926
+ | string
1927
+ | {
1928
+ field: string;
1929
+ fieldType?: "nominal" | "ordinal";
1930
+ scale?: NonPointBandPositionScaleOptions;
1931
+ };
1932
+
1543
1933
  export interface PreGriddedHeatmapOptions extends HeatmapBaseOptions {
1544
- x: BasicPositionChannel;
1545
- y: BasicPositionChannel;
1934
+ x: HeatmapCategoryPositionChannel;
1935
+ y: HeatmapCategoryPositionChannel;
1546
1936
  bin?: never;
1547
- color: BasicColorChannel;
1937
+ color: RectColorChannel;
1548
1938
  }
1549
1939
 
1550
1940
  export interface BinnedHeatmapPositionChannel {
1551
1941
  field: string;
1552
1942
  fieldType?: "quantitative";
1553
- scale?: ScaleOptions;
1943
+ scale?: NonPointQuantitativePositionScaleOptions;
1554
1944
  }
1555
1945
 
1556
1946
  export interface BinnedHeatmapColorOptions {
1557
- scale?: ContinuousColorScaleOptions | DiscretizedColorScaleOptions;
1947
+ scale?:
1948
+ | NonPointContinuousColorScaleOptions
1949
+ | NonPointDiscretizedColorScaleOptions;
1558
1950
  palette?: Palette;
1559
1951
  }
1560
1952
 
@@ -1575,25 +1967,30 @@ export type CreateHeatmapOptions =
1575
1967
  | PreGriddedHeatmapOptions
1576
1968
  | BinnedHeatmapOptions;
1577
1969
 
1578
- export interface ErrorBandPositionChannel {
1579
- field?: string;
1580
- fieldType?: "quantitative" | "temporal";
1581
- scale?: ScaleOptions;
1582
- }
1970
+ export type ErrorBandPositionChannel = { field?: string } & (
1971
+ | {
1972
+ fieldType?: "quantitative";
1973
+ scale?: NonPointQuantitativePositionScaleOptions;
1974
+ }
1975
+ | {
1976
+ fieldType: "temporal";
1977
+ scale?: NonPointTemporalPositionScaleOptions;
1978
+ }
1979
+ );
1583
1980
 
1584
1981
  export interface ErrorBandStatisticalIntervalChannel {
1585
1982
  field?: string;
1586
1983
  center?: IntervalCenter;
1587
1984
  extent?: IntervalExtent;
1588
1985
  level?: number;
1589
- scale?: ScaleOptions;
1986
+ scale?: NonPointQuantitativePositionScaleOptions;
1590
1987
  }
1591
1988
 
1592
1989
  export interface ErrorBandExplicitIntervalChannel {
1593
1990
  center: string;
1594
1991
  lower: string;
1595
1992
  upper: string;
1596
- scale?: ScaleOptions;
1993
+ scale?: NonPointQuantitativePositionScaleOptions;
1597
1994
  }
1598
1995
 
1599
1996
  export type ErrorBandIntervalChannel =
@@ -1775,8 +2172,9 @@ export type StrokeDashEncodingOptions =
1775
2172
  scale?: never;
1776
2173
  };
1777
2174
 
1778
- export interface ContinuousColorScaleOptions {
1779
- id?: string;
2175
+ export type NonPointContinuousColorScaleOptions = ScaleFields<
2176
+ "id" | "interpolate" | "clamp" | "reverse"
2177
+ > & {
1780
2178
  type?: "sequential";
1781
2179
  domain?: "auto" | readonly [unknown, unknown];
1782
2180
  range?: "auto" | readonly [string, string, ...string[]];
@@ -1784,37 +2182,45 @@ export interface ContinuousColorScaleOptions {
1784
2182
  name: PaletteName;
1785
2183
  extent?: readonly [number, number];
1786
2184
  };
1787
- interpolate?: ContinuousColorInterpolation;
1788
- clamp?: boolean;
1789
- reverse?: boolean;
1790
- }
2185
+ };
2186
+
2187
+ export type ContinuousColorScaleOptions =
2188
+ NonPointContinuousColorScaleOptions & { unknown?: string };
1791
2189
 
2190
+ export type NonPointQuantizeColorScaleOptions = ScaleFields<
2191
+ "id" | "clamp" | "reverse"
2192
+ > & {
2193
+ type: "quantize";
2194
+ domain?: "auto" | readonly [number, number];
2195
+ range?: "auto" | readonly [string, string, ...string[]];
2196
+ palette?: PaletteName | { name: PaletteName; count?: number };
2197
+ };
2198
+ export type NonPointQuantileColorScaleOptions = ScaleFields<"id" | "reverse"> & {
2199
+ type: "quantile";
2200
+ domain?: "auto" | readonly number[];
2201
+ range?: "auto" | readonly [string, string, ...string[]];
2202
+ palette?: PaletteName | { name: PaletteName; count?: number };
2203
+ };
2204
+ export type NonPointThresholdColorScaleOptions = ScaleFields<"id" | "reverse"> & {
2205
+ type: "threshold";
2206
+ domain: readonly number[];
2207
+ range?: "auto" | readonly [string, string, ...string[]];
2208
+ palette?: PaletteName | { name: PaletteName; count?: number };
2209
+ };
2210
+ export type NonPointDiscretizedColorScaleOptions =
2211
+ | NonPointQuantizeColorScaleOptions
2212
+ | NonPointQuantileColorScaleOptions
2213
+ | NonPointThresholdColorScaleOptions;
2214
+ export type QuantizeColorScaleOptions =
2215
+ NonPointQuantizeColorScaleOptions & { unknown?: string };
2216
+ export type QuantileColorScaleOptions =
2217
+ NonPointQuantileColorScaleOptions & { unknown?: string };
2218
+ export type ThresholdColorScaleOptions =
2219
+ NonPointThresholdColorScaleOptions & { unknown?: string };
1792
2220
  export type DiscretizedColorScaleOptions =
1793
- | {
1794
- id?: string;
1795
- type: "quantize";
1796
- domain?: "auto" | readonly [number, number];
1797
- range?: "auto" | readonly [string, string, ...string[]];
1798
- palette?: PaletteName | { name: PaletteName; count?: number };
1799
- clamp?: boolean;
1800
- reverse?: boolean;
1801
- }
1802
- | {
1803
- id?: string;
1804
- type: "quantile";
1805
- domain?: "auto" | readonly number[];
1806
- range?: "auto" | readonly [string, string, ...string[]];
1807
- palette?: PaletteName | { name: PaletteName; count?: number };
1808
- reverse?: boolean;
1809
- }
1810
- | {
1811
- id?: string;
1812
- type: "threshold";
1813
- domain: readonly number[];
1814
- range?: "auto" | readonly [string, string, ...string[]];
1815
- palette?: PaletteName | { name: PaletteName; count?: number };
1816
- reverse?: boolean;
1817
- };
2221
+ | QuantizeColorScaleOptions
2222
+ | QuantileColorScaleOptions
2223
+ | ThresholdColorScaleOptions;
1818
2224
 
1819
2225
  export type ColorEncodingOptions =
1820
2226
  | CategoricalEncodingOptions
@@ -1837,16 +2243,14 @@ export type ColorEncodingOptions =
1837
2243
  layout?: never;
1838
2244
  };
1839
2245
 
1840
- export interface OpacityScaleOptions {
1841
- id?: string;
2246
+ export type OpacityScaleOptions = ScaleFields<
2247
+ "id" | "nice" | "zero" | "clamp" | "reverse"
2248
+ > & {
1842
2249
  type?: "linear";
1843
2250
  domain?: "auto" | readonly [number, number];
1844
2251
  range?: "auto" | readonly [number, number];
1845
- nice?: boolean;
1846
- zero?: boolean;
1847
- clamp?: boolean;
1848
- reverse?: boolean;
1849
- }
2252
+ unknown?: number;
2253
+ };
1850
2254
 
1851
2255
  export type OpacityEncodingOptions =
1852
2256
  | { value: number; field?: never; target?: string }
@@ -1858,19 +2262,7 @@ export type OpacityEncodingOptions =
1858
2262
  scale?: OpacityScaleOptions;
1859
2263
  };
1860
2264
 
1861
- export interface StrokeWidthScaleOptions {
1862
- id?: string;
1863
- type?: "linear" | "log" | "pow" | "sqrt" | "symlog";
1864
- domain?: "auto" | readonly [number, number];
1865
- range?: "auto" | readonly [number, number];
1866
- nice?: boolean;
1867
- zero?: boolean;
1868
- clamp?: boolean;
1869
- reverse?: boolean;
1870
- base?: number;
1871
- exponent?: number;
1872
- constant?: number;
1873
- }
2265
+ export type StrokeWidthScaleOptions = NonPointQuantitativePositionScaleOptions;
1874
2266
 
1875
2267
  export type StrokeWidthEncodingOptions =
1876
2268
  | {
@@ -2340,8 +2732,8 @@ export class ChartProgram {
2340
2732
  encodeX2(options: SecondaryPositionEncodingOptions): ChartProgram;
2341
2733
  encodeColor(options: ColorEncodingOptions): ChartProgram;
2342
2734
  encodeStrokeDash(options: StrokeDashEncodingOptions): ChartProgram;
2343
- encodeSize(options: { field: string; target?: string; fieldType?: "quantitative"; scale?: ScaleOptions }): ChartProgram;
2344
- encodeShape(options: { field: string; target?: string; fieldType?: "nominal"; scale?: ScaleOptions }): ChartProgram;
2735
+ encodeSize(options: { field: string; target?: string; fieldType?: "quantitative"; scale?: SizeScaleOptions }): ChartProgram;
2736
+ encodeShape(options: { field: string; target?: string; fieldType?: "nominal"; scale?: ShapeScaleOptions }): ChartProgram;
2345
2737
  encodeAngle(options:
2346
2738
  | { target?: string; value: number; field?: never; fieldType?: never }
2347
2739
  | { target?: string; field: string; fieldType?: "quantitative"; value?: never }
@@ -2359,7 +2751,7 @@ export class ChartProgram {
2359
2751
  target?: string;
2360
2752
  fieldType?: "quantitative";
2361
2753
  coordinate?: string;
2362
- scale?: ScaleOptions;
2754
+ scale?: NonPointQuantitativePositionScaleOptions;
2363
2755
  }): ChartProgram;
2364
2756
  encodeXRange(options: {
2365
2757
  lower: string;
@@ -2367,7 +2759,7 @@ export class ChartProgram {
2367
2759
  target?: string;
2368
2760
  fieldType?: "quantitative";
2369
2761
  coordinate?: string;
2370
- scale?: ScaleOptions;
2762
+ scale?: NonPointQuantitativePositionScaleOptions;
2371
2763
  }): ChartProgram;
2372
2764
  encodeGroup(options: { field: string; target?: string; fieldType?: "nominal" }): ChartProgram;
2373
2765
  encodePathOrder(options: PathOrderEncodingOptions): ChartProgram;