ggaction 0.0.10 → 0.0.11

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 (217) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/README.md +4 -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 +8 -24
  43. package/src/actions/encodings/parallel.js +9 -10
  44. package/src/actions/encodings/pathOrder.js +6 -13
  45. package/src/actions/encodings/position/policies/index.js +4 -4
  46. package/src/actions/encodings/position/policies/line.js +47 -17
  47. package/src/actions/encodings/position/resolve.js +24 -5
  48. package/src/actions/encodings/ranged.js +18 -23
  49. package/src/actions/encodings/remove.js +15 -25
  50. package/src/actions/encodings/ruleAppearance.js +9 -24
  51. package/src/actions/encodings/shared.js +37 -0
  52. package/src/actions/encodings/strokeDash.js +8 -23
  53. package/src/actions/encodings/text.js +9 -10
  54. package/src/actions/errorBands/create.js +105 -39
  55. package/src/actions/errorBands/edit.js +89 -93
  56. package/src/actions/errorBands/index.js +1 -2
  57. package/src/actions/errorBars/create.js +78 -27
  58. package/src/actions/errorBars/edit.js +81 -48
  59. package/src/actions/errorBars/index.js +1 -2
  60. package/src/actions/facets/actions.js +45 -69
  61. package/src/actions/facets/derive.js +38 -53
  62. package/src/actions/facets/replay.js +0 -1
  63. package/src/actions/gradientPlots/components.js +59 -48
  64. package/src/actions/gradientPlots/edit.js +35 -216
  65. package/src/actions/gradientPlots/index.js +11 -10
  66. package/src/actions/gradientPlots/materialize.js +21 -35
  67. package/src/actions/gradientPlots/options.js +5 -7
  68. package/src/actions/gradientPlots/paint.js +9 -6
  69. package/src/actions/gradientPlots/resolve.js +1 -1
  70. package/src/actions/guides/axes/index.js +3 -3
  71. package/src/actions/guides/axes/labels.js +68 -26
  72. package/src/actions/guides/axes/lines.js +22 -2
  73. package/src/actions/guides/axes/policy.js +28 -8
  74. package/src/actions/guides/axes/ticks.js +27 -9
  75. package/src/actions/guides/axes/titles.js +113 -65
  76. package/src/actions/guides/grids/resolve.js +14 -0
  77. package/src/actions/guides/guides.js +2 -4
  78. package/src/actions/guides/index.js +2 -2
  79. package/src/actions/guides/legends/categorical/actions.js +44 -68
  80. package/src/actions/guides/legends/categorical/components.js +6 -1
  81. package/src/actions/guides/legends/categorical/index.js +2 -2
  82. package/src/actions/guides/legends/categorical/layout.js +148 -175
  83. package/src/actions/guides/legends/categorical/recipes.js +5 -0
  84. package/src/actions/guides/legends/categorical/resolve.js +8 -1
  85. package/src/actions/guides/legends/continuous/common.js +117 -66
  86. package/src/actions/guides/legends/continuous/gradient.js +38 -37
  87. package/src/actions/guides/legends/continuous/interval.js +97 -76
  88. package/src/actions/guides/legends/continuous/opacity.js +28 -38
  89. package/src/actions/guides/legends/edit.js +14 -1
  90. package/src/actions/guides/legends/index.js +1 -1
  91. package/src/actions/guides/legends/lane.js +2 -1
  92. package/src/actions/guides/legends/remove.js +8 -0
  93. package/src/actions/guides/legends/size.js +36 -43
  94. package/src/actions/guides/legends/strokeWidth.js +20 -26
  95. package/src/actions/guides/polar/axes/labels.js +17 -1
  96. package/src/actions/guides/polar/axes/shared.js +7 -1
  97. package/src/actions/guides/polar/axes/titles.js +19 -2
  98. package/src/actions/guides/polar/grids.js +4 -0
  99. package/src/actions/guides/polar/resolve.js +6 -0
  100. package/src/actions/index.js +13 -13
  101. package/src/actions/intervals/resolve.js +87 -117
  102. package/src/actions/marks/arc/actions.js +31 -36
  103. package/src/actions/marks/area/actions.js +23 -31
  104. package/src/actions/marks/index.js +6 -6
  105. package/src/actions/marks/line/actions.js +33 -52
  106. package/src/actions/marks/line/materialize.js +7 -5
  107. package/src/actions/marks/point/materialize.js +5 -3
  108. package/src/actions/marks/remove.js +21 -0
  109. package/src/actions/marks/rule/actions.js +53 -53
  110. package/src/actions/marks/shared.js +8 -4
  111. package/src/actions/marks/text/actions.js +14 -6
  112. package/src/actions/marks/text/layout.js +21 -45
  113. package/src/actions/marks/tick/actions.js +22 -21
  114. package/src/actions/primitives/createGraphics.js +4 -0
  115. package/src/actions/primitives/editGraphics.js +4 -0
  116. package/src/actions/primitives/index.js +3 -3
  117. package/src/actions/primitives/semantic.js +1 -1
  118. package/src/actions/primitives/semanticValidation/index.js +2 -2
  119. package/src/actions/primitives/semanticValidation/layer.js +1 -1
  120. package/src/actions/regression/edit.js +3 -43
  121. package/src/actions/scales/consumers/families.js +24 -4
  122. package/src/actions/scales/consumers/index.js +1 -1
  123. package/src/actions/scales/consumers/seriesLayout.js +17 -0
  124. package/src/actions/scales/definitions.js +100 -103
  125. package/src/actions/scales/materialize.js +5 -0
  126. package/src/actions/selection/actions.js +79 -121
  127. package/src/actions/titles/actions.js +48 -94
  128. package/src/actions/titles/resolve.js +14 -27
  129. package/src/actions/violinPlots/create.js +37 -44
  130. package/src/core/textMetrics.js +74 -37
  131. package/src/core/validation.js +18 -0
  132. package/src/grammar/aggregate.js +48 -28
  133. package/src/grammar/arcs.js +58 -11
  134. package/src/grammar/areaSeries.js +14 -16
  135. package/src/grammar/bin2d.js +37 -23
  136. package/src/grammar/boxPlot.js +14 -13
  137. package/src/grammar/categoricalDensity.js +14 -14
  138. package/src/grammar/categoryOrder.js +8 -14
  139. package/src/grammar/curveCommands.js +87 -20
  140. package/src/grammar/density.js +162 -141
  141. package/src/grammar/facets/index.js +14 -0
  142. package/src/grammar/facets/scales.js +7 -4
  143. package/src/grammar/gradientProfile.js +12 -15
  144. package/src/grammar/histogram.js +145 -83
  145. package/src/grammar/horizon.js +60 -23
  146. package/src/grammar/interval.js +14 -13
  147. package/src/grammar/lineSeries.js +91 -61
  148. package/src/grammar/numeric.js +290 -0
  149. package/src/grammar/paint.js +3 -4
  150. package/src/grammar/palettes.js +21 -32
  151. package/src/grammar/pathCommands.js +6 -0
  152. package/src/grammar/polarPaths.js +5 -5
  153. package/src/grammar/regression/derive.js +48 -9
  154. package/src/grammar/regression/models.js +248 -69
  155. package/src/grammar/regression/parameters.js +8 -0
  156. package/src/grammar/scales/color.js +35 -26
  157. package/src/grammar/scales/continuous.js +71 -24
  158. package/src/grammar/scales/definition.js +1 -1
  159. package/src/grammar/scales/discretized.js +42 -12
  160. package/src/grammar/scales/fields.js +21 -4
  161. package/src/grammar/scales/ordinal.js +117 -61
  162. package/src/grammar/scales/temporal.js +40 -11
  163. package/src/grammar/scales/transformed.js +199 -52
  164. package/src/grammar/schemas/graphicBounds.js +270 -79
  165. package/src/grammar/seriesLayout.js +50 -18
  166. package/src/grammar/ticks.js +123 -53
  167. package/src/grammar/timeUnit.js +18 -8
  168. package/src/grammar/transforms.js +4 -1
  169. package/src/grammar/window.js +70 -57
  170. package/src/index.js +1 -1
  171. package/src/layout/canvas.js +4 -8
  172. package/src/layout/composition.js +39 -40
  173. package/src/layout/facets.js +10 -14
  174. package/src/layout/labels.js +91 -15
  175. package/src/layout/legend.js +22 -20
  176. package/src/layout/legendLane.js +54 -40
  177. package/src/layout/title.js +7 -7
  178. package/src/materialization/bars/aggregate.js +14 -40
  179. package/src/materialization/bars/grouped.js +7 -18
  180. package/src/materialization/bars/histogram.js +2 -19
  181. package/src/materialization/bars/ranged.js +20 -15
  182. package/src/materialization/bars/resolve.js +21 -0
  183. package/src/materialization/facetGuides/legacyCategorical.js +2 -1
  184. package/src/materialization/facetGuides/placement.js +34 -19
  185. package/src/materialization/facetGuides/preparation.js +9 -5
  186. package/src/materialization/facets.js +39 -27
  187. package/src/materialization/guides/resources.js +2 -1
  188. package/src/materialization/marks/capabilities.js +5 -2
  189. package/src/materialization/marks/index.js +24 -4
  190. package/src/materialization/scales/policies/bar.js +61 -59
  191. package/src/materialization/scales/policies/binnedPosition.js +34 -0
  192. package/src/materialization/scales/policies/series.js +13 -7
  193. package/src/materialization/scales/resolve.js +4 -5
  194. package/src/materialization/selection/items/arc.js +16 -2
  195. package/src/materialization/selection/items/bar.js +4 -2
  196. package/src/materialization/selection/items/common.js +21 -1
  197. package/src/materialization/selection/items/path.js +19 -2
  198. package/src/materialization/selection/items/point.js +4 -16
  199. package/src/materialization/selection/items/tick.js +13 -21
  200. package/src/materialization/selection/point.js +11 -4
  201. package/src/materialization/selection/styles.js +19 -27
  202. package/src/materialization/text.js +4 -1
  203. package/src/mcp/adapter.js +8 -3
  204. package/src/renderers/canvas/fill.js +2 -2
  205. package/src/renderers/canvas/index.js +35 -2
  206. package/src/renderers/canvas/native.js +160 -0
  207. package/src/renderers/pdf.js +14 -0
  208. package/src/renderers/svg.js +37 -4
  209. package/types/index.d.ts +3 -0
  210. package/types/program.d.ts +505 -131
  211. package/types/svg.d.ts +1 -0
  212. package/src/actions/errorBands/components.js +0 -81
  213. package/src/actions/errorBands/options.js +0 -39
  214. package/src/actions/errorBands/resolve.js +0 -28
  215. package/src/actions/errorBars/components.js +0 -62
  216. package/src/actions/errorBars/options.js +0 -58
  217. 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,7 +1113,6 @@ 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 {
@@ -1011,15 +1137,46 @@ type RulePositionValue =
1011
1137
  | { field: string; datum?: never }
1012
1138
  | { field?: never; datum: unknown };
1013
1139
 
1014
- export type RulePositionEncodingOptions = RulePositionValue & {
1140
+ type RulePositionEncodingBase = RulePositionValue & {
1141
+ target?: string;
1142
+ coordinate?: string;
1143
+ };
1144
+
1145
+ type InferredRuleDatumPositionEncodingOptions = {
1146
+ field?: never;
1147
+ datum: unknown;
1015
1148
  target?: string;
1016
- fieldType: FieldType;
1017
- scale?: ScaleOptions;
1018
1149
  coordinate?: string;
1150
+ fieldType?: undefined;
1151
+ scale?:
1152
+ | NonPointQuantitativePositionScaleOptions
1153
+ | NonPointCategoricalPositionScaleOptions;
1154
+ };
1155
+
1156
+ export type RulePositionEncodingOptions =
1157
+ | InferredRuleDatumPositionEncodingOptions
1158
+ | RulePositionEncodingBase & (
1159
+ | {
1160
+ fieldType: "quantitative";
1161
+ scale?: NonPointQuantitativePositionScaleOptions;
1162
+ }
1163
+ | {
1164
+ fieldType: "temporal";
1165
+ scale?: NonPointTemporalPositionScaleOptions;
1166
+ }
1167
+ | {
1168
+ fieldType: "nominal" | "ordinal";
1169
+ scale?: NonPointCategoricalPositionScaleOptions;
1170
+ }
1171
+ );
1172
+
1173
+ type SecondaryRulePositionEncodingOptions = RulePositionEncodingBase & {
1174
+ fieldType: FieldType;
1175
+ scale?: { id?: string };
1019
1176
  };
1020
1177
 
1021
1178
  export type SecondaryPositionEncodingOptions =
1022
- | RulePositionEncodingOptions
1179
+ | SecondaryRulePositionEncodingOptions
1023
1180
  | {
1024
1181
  field: string;
1025
1182
  datum?: never;
@@ -1034,8 +1191,8 @@ export type HistogramEncodingOptions = {
1034
1191
  target?: string;
1035
1192
  coordinate?: string;
1036
1193
  stack?: StackMode;
1037
- xScale?: ScaleOptions;
1038
- yScale?: ScaleOptions;
1194
+ xScale?: NonPointQuantitativePositionScaleOptions;
1195
+ yScale?: NonPointZeroSupportingPositionScaleOptions;
1039
1196
  } & (
1040
1197
  | { maxBins?: number; binStep?: never; binBoundaries?: never }
1041
1198
  | { maxBins?: never; binStep: number; binBoundaries?: never }
@@ -1050,7 +1207,7 @@ export interface CategoricalEncodingOptions {
1050
1207
  field: string;
1051
1208
  target?: string;
1052
1209
  fieldType?: "nominal" | "ordinal";
1053
- scale?: ScaleOptions;
1210
+ scale?: CategoricalColorScaleOptions;
1054
1211
  palette?: Palette;
1055
1212
  layout?: ColorLayout;
1056
1213
  }
@@ -1072,13 +1229,13 @@ type DensityEncodingBase = Omit<DensityDataOptions, "id"> & {
1072
1229
  target?: string;
1073
1230
  densityChannel?: "x" | "y";
1074
1231
  coordinate?: string;
1075
- valueScale?: ScaleOptions;
1232
+ valueScale?: NonPointQuantitativePositionScaleOptions;
1076
1233
  };
1077
1234
 
1078
1235
  export type DensityEncodingOptions = DensityEncodingBase & (
1079
1236
  | {
1080
1237
  placement?: BaselineDensityPlacement;
1081
- densityScale?: ScaleOptions;
1238
+ densityScale?: NonPointZeroSupportingPositionScaleOptions;
1082
1239
  }
1083
1240
  | {
1084
1241
  placement: CategoryDensityPlacement;
@@ -1086,16 +1243,33 @@ export type DensityEncodingOptions = DensityEncodingBase & (
1086
1243
  }
1087
1244
  );
1088
1245
 
1089
- export interface HorizonXEncoding {
1090
- field: string;
1091
- fieldType?: "quantitative" | "temporal";
1092
- scale?: ScaleOptions;
1093
- }
1246
+ export type HorizonXEncoding = { field: string } & (
1247
+ | {
1248
+ fieldType: "quantitative";
1249
+ scale?: NonPointQuantitativePositionScaleOptions;
1250
+ }
1251
+ | {
1252
+ fieldType: "temporal";
1253
+ scale?: NonPointTemporalPositionScaleOptions;
1254
+ }
1255
+ | {
1256
+ fieldType?: undefined;
1257
+ scale?:
1258
+ | NonPointQuantitativePositionScaleOptions
1259
+ | NonPointTemporalPositionScaleOptions;
1260
+ }
1261
+ );
1262
+
1263
+ export type HorizonYScaleOptions = ScaleFields<"id" | "clamp" | "reverse"> & {
1264
+ type?: "linear";
1265
+ domain?: readonly [0, 1];
1266
+ range?: "auto" | readonly [number, number];
1267
+ };
1094
1268
 
1095
1269
  export interface HorizonYEncoding {
1096
1270
  field: string;
1097
1271
  fieldType?: "quantitative";
1098
- scale?: ScaleOptions;
1272
+ scale?: HorizonYScaleOptions;
1099
1273
  }
1100
1274
 
1101
1275
  export interface HorizonPaletteOptions {
@@ -1183,25 +1357,30 @@ export interface EditBin2DDataOptions {
1183
1357
  as?: DatasetBin2DOutputFields;
1184
1358
  }
1185
1359
 
1186
- export interface ErrorBarPositionChannel {
1187
- field?: string;
1188
- fieldType?: "nominal" | "ordinal" | "temporal";
1189
- scale?: ScaleOptions;
1190
- }
1360
+ export type ErrorBarPositionChannel = { field?: string } & (
1361
+ | {
1362
+ fieldType?: "nominal" | "ordinal";
1363
+ scale?: NonPointCategoricalPositionScaleOptions;
1364
+ }
1365
+ | {
1366
+ fieldType: "temporal";
1367
+ scale?: NonPointTemporalPositionScaleOptions;
1368
+ }
1369
+ );
1191
1370
 
1192
1371
  export interface ErrorBarStatisticalIntervalChannel {
1193
1372
  field?: string;
1194
1373
  center?: IntervalCenter;
1195
1374
  extent?: IntervalExtent;
1196
1375
  level?: number;
1197
- scale?: ScaleOptions;
1376
+ scale?: NonPointQuantitativePositionScaleOptions;
1198
1377
  }
1199
1378
 
1200
1379
  export interface ErrorBarExplicitIntervalChannel {
1201
1380
  center: string;
1202
1381
  lower: string;
1203
1382
  upper: string;
1204
- scale?: ScaleOptions;
1383
+ scale?: NonPointQuantitativePositionScaleOptions;
1205
1384
  }
1206
1385
 
1207
1386
  export type ErrorBarIntervalChannel =
@@ -1241,14 +1420,14 @@ export interface EditErrorBarOptions {
1241
1420
 
1242
1421
  export interface BoxPlotCategoryChannel {
1243
1422
  field: string;
1244
- fieldType: "nominal" | "ordinal" | "temporal";
1245
- scale?: ScaleOptions;
1423
+ fieldType: "nominal" | "ordinal";
1424
+ scale?: NonPointBandPositionScaleOptions;
1246
1425
  }
1247
1426
 
1248
1427
  export interface BoxPlotMeasureChannel {
1249
1428
  field: string;
1250
1429
  fieldType?: "quantitative";
1251
- scale?: ScaleOptions;
1430
+ scale?: NonPointQuantitativePositionScaleOptions;
1252
1431
  }
1253
1432
 
1254
1433
  export type BoxPlotPositionChannel =
@@ -1284,7 +1463,7 @@ export interface BoxPlotOptions {
1284
1463
  radius?: number;
1285
1464
  opacity?: number;
1286
1465
  };
1287
- guides?: false | CreateGuidesOptions;
1466
+ guides?: false | CartesianGuideOptions;
1288
1467
  }
1289
1468
 
1290
1469
  export interface EditBoxPlotOptions {
@@ -1344,12 +1523,28 @@ export interface GradientPlotOptions {
1344
1523
  width?: { band?: number };
1345
1524
  gradient?: GradientPlotAppearanceOptions;
1346
1525
  center?: false | GradientPlotCenterOptions;
1347
- guides?: false | CreateGuidesOptions;
1526
+ guides?: false | GradientPlotGuideOptions;
1348
1527
  }
1349
1528
 
1350
1529
  export type ViolinPlotPositionChannel =
1351
1530
  | string
1352
- | BoxPlotPositionChannel;
1531
+ | {
1532
+ field: string;
1533
+ fieldType: "nominal" | "ordinal";
1534
+ scale?: NonPointBandPositionScaleOptions;
1535
+ }
1536
+ | {
1537
+ field: string;
1538
+ fieldType: "quantitative";
1539
+ scale?: NonPointQuantitativePositionScaleOptions;
1540
+ }
1541
+ | {
1542
+ field: string;
1543
+ fieldType?: undefined;
1544
+ scale?:
1545
+ | NonPointBandPositionScaleOptions
1546
+ | NonPointQuantitativePositionScaleOptions;
1547
+ };
1353
1548
 
1354
1549
  export interface ViolinPlotDensityOptions
1355
1550
  extends GradientPlotDensityOptions {
@@ -1363,7 +1558,13 @@ export interface ViolinPlotSplitOptions {
1363
1558
 
1364
1559
  export type ViolinPlotColorOptions =
1365
1560
  | string
1366
- | Omit<CategoricalEncodingOptions, "target">;
1561
+ | {
1562
+ field: string;
1563
+ fieldType?: "nominal" | "ordinal";
1564
+ scale?: NonPointCategoricalColorScaleOptions;
1565
+ palette?: Palette;
1566
+ layout?: "overlay";
1567
+ };
1367
1568
 
1368
1569
  export interface ViolinPlotAreaOptions {
1369
1570
  fill?: string;
@@ -1383,7 +1584,7 @@ export interface ViolinPlotOptions {
1383
1584
  color?: ViolinPlotColorOptions;
1384
1585
  density?: ViolinPlotDensityOptions;
1385
1586
  area?: ViolinPlotAreaOptions;
1386
- guides?: false | CreateGuidesOptions;
1587
+ guides?: false | CartesianGuideOptions;
1387
1588
  }
1388
1589
 
1389
1590
  export interface EditGradientPlotOptions {
@@ -1397,23 +1598,169 @@ export interface EditGradientPlotOptions {
1397
1598
  center?: false | GradientPlotCenterOptions;
1398
1599
  }
1399
1600
 
1400
- type BasicPositionChannel =
1601
+ type FacadePositionChannel<Quantitative, Temporal, Categorical> =
1602
+ | string
1603
+ | (Omit<PositionEncodingBase, "target" | "coordinate"> &
1604
+ PositionScaleBranches<Quantitative, Temporal, Categorical>);
1605
+ type PointFacadePositionChannel =
1606
+ | string
1607
+ | ({ field: string } & (
1608
+ | {
1609
+ fieldType?: "quantitative";
1610
+ scale?: QuantitativePositionScaleOptions;
1611
+ }
1612
+ | {
1613
+ fieldType: "temporal";
1614
+ scale?: TemporalPositionScaleOptions;
1615
+ }
1616
+ | {
1617
+ fieldType: "nominal" | "ordinal";
1618
+ scale?: CategoricalPositionScaleOptions;
1619
+ }
1620
+ ));
1621
+ type LineXPositionChannel =
1622
+ | string
1623
+ | ({ field: string; bin?: PositionEncodingBase["bin"] } & (
1624
+ | {
1625
+ fieldType?: "quantitative";
1626
+ scale?: NonPointQuantitativePositionScaleOptions;
1627
+ }
1628
+ | {
1629
+ fieldType: "temporal";
1630
+ scale?: NonPointTemporalPositionScaleOptions;
1631
+ }
1632
+ ));
1633
+ type LineYPositionChannel =
1401
1634
  | string
1402
- | Omit<PositionEncodingOptions, "target" | "coordinate">;
1635
+ | ({ field: string } & (
1636
+ | {
1637
+ fieldType?: "quantitative";
1638
+ aggregate?: AggregateOperation;
1639
+ scale?: NonPointQuantitativePositionScaleOptions;
1640
+ }
1641
+ | {
1642
+ fieldType: "temporal";
1643
+ aggregate?: never;
1644
+ scale?: NonPointTemporalPositionScaleOptions;
1645
+ }
1646
+ ));
1647
+ type BandPositionChannel = FacadePositionChannel<
1648
+ NonPointZeroSupportingPositionScaleOptions,
1649
+ NonPointTemporalPositionScaleOptions,
1650
+ NonPointBandPositionScaleOptions
1651
+ >;
1652
+ type BarYPositionChannel =
1653
+ | string
1654
+ | ({ field: string; stack?: StackMode } & (
1655
+ | {
1656
+ fieldType?: "quantitative";
1657
+ aggregate?: never;
1658
+ scale?: NonPointZeroSupportingPositionScaleOptions;
1659
+ }
1660
+ | {
1661
+ fieldType: "nominal" | "ordinal";
1662
+ aggregate?: never;
1663
+ scale?: NonPointBandPositionScaleOptions;
1664
+ }
1665
+ | {
1666
+ fieldType?: "quantitative" | "nominal" | "ordinal";
1667
+ aggregate: AggregateOperation;
1668
+ scale?: NonPointZeroSupportingPositionScaleOptions;
1669
+ }
1670
+ ));
1403
1671
  type BasicColorChannel =
1404
1672
  | string
1405
- | (ColorEncodingOptions extends infer T
1406
- ? T extends unknown ? Omit<T, "target"> : never
1407
- : never);
1673
+ | {
1674
+ field: string;
1675
+ fieldType?: "nominal" | "ordinal";
1676
+ scale?: CategoricalColorScaleOptions;
1677
+ palette?: Palette;
1678
+ }
1679
+ | {
1680
+ field: string;
1681
+ fieldType: "quantitative";
1682
+ scale?: ContinuousColorScaleOptions | DiscretizedColorScaleOptions;
1683
+ palette?: Palette;
1684
+ }
1685
+ | {
1686
+ field: string;
1687
+ fieldType: "temporal";
1688
+ scale?: ContinuousColorScaleOptions;
1689
+ palette?: Palette;
1690
+ };
1691
+ type NonPointCategoricalColorChannel =
1692
+ | string
1693
+ | {
1694
+ field: string;
1695
+ fieldType?: "nominal" | "ordinal";
1696
+ scale?: NonPointCategoricalColorScaleOptions;
1697
+ palette?: Palette;
1698
+ layout?: ColorLayout;
1699
+ };
1700
+ type HistogramCategoricalColorChannel =
1701
+ | string
1702
+ | {
1703
+ field: string;
1704
+ fieldType?: "nominal" | "ordinal";
1705
+ scale?: NonPointCategoricalColorScaleOptions;
1706
+ palette?: Palette;
1707
+ layout?: Exclude<ColorLayout, "center">;
1708
+ };
1709
+ type LineCategoricalColorChannel =
1710
+ | string
1711
+ | {
1712
+ field: string;
1713
+ fieldType?: "nominal" | "ordinal";
1714
+ scale?: NonPointCategoricalColorScaleOptions;
1715
+ palette?: Palette;
1716
+ };
1717
+ type QuantitativeBarColorChannel = {
1718
+ field: string;
1719
+ fieldType: "quantitative";
1720
+ aggregate?: AggregateOperation;
1721
+ scale?:
1722
+ | NonPointContinuousColorScaleOptions
1723
+ | NonPointDiscretizedColorScaleOptions;
1724
+ palette?: Palette;
1725
+ layout?: never;
1726
+ };
1727
+ type BarCategoricalColorChannel =
1728
+ | string
1729
+ | {
1730
+ field: string;
1731
+ fieldType?: "nominal" | "ordinal";
1732
+ scale?: NonPointCategoricalColorScaleOptions;
1733
+ palette?: Palette;
1734
+ layout?: Exclude<ColorLayout, "center">;
1735
+ };
1736
+ type BarColorChannel =
1737
+ | BarCategoricalColorChannel
1738
+ | QuantitativeBarColorChannel;
1739
+ type RectColorChannel =
1740
+ | LineCategoricalColorChannel
1741
+ | {
1742
+ field: string;
1743
+ fieldType: "quantitative";
1744
+ scale?:
1745
+ | NonPointContinuousColorScaleOptions
1746
+ | NonPointDiscretizedColorScaleOptions;
1747
+ palette?: Palette;
1748
+ }
1749
+ | {
1750
+ field: string;
1751
+ fieldType: "temporal";
1752
+ scale?: NonPointContinuousColorScaleOptions;
1753
+ palette?: Palette;
1754
+ };
1408
1755
  export type BasicSizeChannel = string | {
1409
1756
  field: string;
1410
1757
  fieldType?: "quantitative";
1411
- scale?: ScaleOptions;
1758
+ scale?: SizeScaleOptions;
1412
1759
  };
1413
1760
  export type BasicShapeChannel = string | {
1414
1761
  field: string;
1415
1762
  fieldType?: "nominal";
1416
- scale?: ScaleOptions;
1763
+ scale?: ShapeScaleOptions;
1417
1764
  };
1418
1765
  export type BasicStrokeDashChannel =
1419
1766
  StrokeDashEncodingOptions extends infer T
@@ -1421,12 +1768,25 @@ export type BasicStrokeDashChannel =
1421
1768
  : never;
1422
1769
 
1423
1770
  export type ParallelMissingPolicy = "break" | "drop-row" | "error";
1424
- export type ParallelDimension = string | {
1771
+ export type ParallelDimension = string | ({
1425
1772
  field: string;
1426
- fieldType?: "quantitative" | "ordinal";
1427
1773
  title?: string;
1428
- scale?: Omit<ScaleOptions, "id">;
1429
- };
1774
+ } & (
1775
+ | {
1776
+ fieldType: "quantitative";
1777
+ scale?: WithoutScaleId<QuantitativePositionScaleOptions>;
1778
+ }
1779
+ | {
1780
+ fieldType: "ordinal";
1781
+ scale?: WithoutScaleId<CategoricalPositionScaleOptions>;
1782
+ }
1783
+ | {
1784
+ fieldType?: undefined;
1785
+ scale?: WithoutScaleId<
1786
+ QuantitativePositionScaleOptions | CategoricalPositionScaleOptions
1787
+ >;
1788
+ }
1789
+ ));
1430
1790
  export interface ParallelCoordinatesEncodingOptions {
1431
1791
  target?: string;
1432
1792
  coordinate?: string;
@@ -1441,7 +1801,7 @@ export interface CreateParallelCoordinatesOptions {
1441
1801
  dimensions: readonly [ParallelDimension, ParallelDimension, ...ParallelDimension[]];
1442
1802
  key?: string;
1443
1803
  missing?: ParallelMissingPolicy;
1444
- color?: BasicColorChannel;
1804
+ color?: LineCategoricalColorChannel;
1445
1805
  strokeDash?: BasicStrokeDashChannel;
1446
1806
  line?: {
1447
1807
  strokeWidth?: number;
@@ -1450,15 +1810,15 @@ export interface CreateParallelCoordinatesOptions {
1450
1810
  curve?: "linear";
1451
1811
  closed?: false;
1452
1812
  };
1453
- guides?: false | CreateGuidesOptions;
1813
+ guides?: false | ParallelGuideOptions;
1454
1814
  }
1455
1815
 
1456
1816
  export interface CreateScatterPlotOptions {
1457
1817
  id?: string;
1458
1818
  data?: string;
1459
1819
  coordinate?: string;
1460
- x: BasicPositionChannel;
1461
- y: BasicPositionChannel;
1820
+ x: PointFacadePositionChannel;
1821
+ y: PointFacadePositionChannel;
1462
1822
  color?: BasicColorChannel;
1463
1823
  size?: BasicSizeChannel;
1464
1824
  shape?: BasicShapeChannel;
@@ -1476,9 +1836,9 @@ export interface CreateLinePlotOptions {
1476
1836
  id?: string;
1477
1837
  data?: string;
1478
1838
  coordinate?: string;
1479
- x: BasicPositionChannel;
1480
- y: BasicPositionChannel;
1481
- color?: BasicColorChannel;
1839
+ x: LineXPositionChannel;
1840
+ y: LineYPositionChannel;
1841
+ color?: LineCategoricalColorChannel;
1482
1842
  groupBy?: string;
1483
1843
  strokeDash?: BasicStrokeDashChannel;
1484
1844
  line?: {
@@ -1486,23 +1846,27 @@ export interface CreateLinePlotOptions {
1486
1846
  curve?: CurveInterpolation;
1487
1847
  stroke?: string;
1488
1848
  opacity?: number;
1489
- closed?: boolean;
1849
+ closed?: false;
1490
1850
  };
1491
1851
  guides?: false | CreateGuidesOptions;
1492
1852
  }
1493
1853
 
1494
1854
  type BasicHistogramEncoding =
1495
1855
  HistogramEncodingOptions extends infer T
1496
- ? T extends unknown ? Omit<T, "field" | "target" | "coordinate"> : never
1856
+ ? T extends unknown
1857
+ ? Omit<T, "field" | "target" | "coordinate" | "stack"> & {
1858
+ stack?: Exclude<StackMode, "center">;
1859
+ }
1860
+ : never
1497
1861
  : never;
1498
1862
 
1499
1863
  export interface CreateBarPlotOptions {
1500
1864
  id?: string;
1501
1865
  data?: string;
1502
1866
  coordinate?: string;
1503
- x: BasicPositionChannel;
1504
- y: BasicPositionChannel;
1505
- color?: BasicColorChannel;
1867
+ x: BandPositionChannel;
1868
+ y: BarYPositionChannel;
1869
+ color?: BarColorChannel;
1506
1870
  width?: Omit<BarWidthOptions, "target">;
1507
1871
  bar?: {
1508
1872
  fill?: string;
@@ -1518,7 +1882,7 @@ export type CreateHistogramOptions = BasicHistogramEncoding & {
1518
1882
  data?: string;
1519
1883
  coordinate?: string;
1520
1884
  field: string;
1521
- color?: BasicColorChannel;
1885
+ color?: HistogramCategoricalColorChannel;
1522
1886
  bar?: {
1523
1887
  fill?: string;
1524
1888
  opacity?: number;
@@ -1537,24 +1901,34 @@ export interface HeatmapBaseOptions {
1537
1901
  stroke?: string | false;
1538
1902
  strokeWidth?: number;
1539
1903
  };
1540
- guides?: false | CreateGuidesOptions;
1904
+ guides?: false | CartesianGuideOptions;
1541
1905
  }
1542
1906
 
1907
+ export type HeatmapCategoryPositionChannel =
1908
+ | string
1909
+ | {
1910
+ field: string;
1911
+ fieldType?: "nominal" | "ordinal";
1912
+ scale?: NonPointBandPositionScaleOptions;
1913
+ };
1914
+
1543
1915
  export interface PreGriddedHeatmapOptions extends HeatmapBaseOptions {
1544
- x: BasicPositionChannel;
1545
- y: BasicPositionChannel;
1916
+ x: HeatmapCategoryPositionChannel;
1917
+ y: HeatmapCategoryPositionChannel;
1546
1918
  bin?: never;
1547
- color: BasicColorChannel;
1919
+ color: RectColorChannel;
1548
1920
  }
1549
1921
 
1550
1922
  export interface BinnedHeatmapPositionChannel {
1551
1923
  field: string;
1552
1924
  fieldType?: "quantitative";
1553
- scale?: ScaleOptions;
1925
+ scale?: NonPointQuantitativePositionScaleOptions;
1554
1926
  }
1555
1927
 
1556
1928
  export interface BinnedHeatmapColorOptions {
1557
- scale?: ContinuousColorScaleOptions | DiscretizedColorScaleOptions;
1929
+ scale?:
1930
+ | NonPointContinuousColorScaleOptions
1931
+ | NonPointDiscretizedColorScaleOptions;
1558
1932
  palette?: Palette;
1559
1933
  }
1560
1934
 
@@ -1575,25 +1949,30 @@ export type CreateHeatmapOptions =
1575
1949
  | PreGriddedHeatmapOptions
1576
1950
  | BinnedHeatmapOptions;
1577
1951
 
1578
- export interface ErrorBandPositionChannel {
1579
- field?: string;
1580
- fieldType?: "quantitative" | "temporal";
1581
- scale?: ScaleOptions;
1582
- }
1952
+ export type ErrorBandPositionChannel = { field?: string } & (
1953
+ | {
1954
+ fieldType?: "quantitative";
1955
+ scale?: NonPointQuantitativePositionScaleOptions;
1956
+ }
1957
+ | {
1958
+ fieldType: "temporal";
1959
+ scale?: NonPointTemporalPositionScaleOptions;
1960
+ }
1961
+ );
1583
1962
 
1584
1963
  export interface ErrorBandStatisticalIntervalChannel {
1585
1964
  field?: string;
1586
1965
  center?: IntervalCenter;
1587
1966
  extent?: IntervalExtent;
1588
1967
  level?: number;
1589
- scale?: ScaleOptions;
1968
+ scale?: NonPointQuantitativePositionScaleOptions;
1590
1969
  }
1591
1970
 
1592
1971
  export interface ErrorBandExplicitIntervalChannel {
1593
1972
  center: string;
1594
1973
  lower: string;
1595
1974
  upper: string;
1596
- scale?: ScaleOptions;
1975
+ scale?: NonPointQuantitativePositionScaleOptions;
1597
1976
  }
1598
1977
 
1599
1978
  export type ErrorBandIntervalChannel =
@@ -1775,8 +2154,9 @@ export type StrokeDashEncodingOptions =
1775
2154
  scale?: never;
1776
2155
  };
1777
2156
 
1778
- export interface ContinuousColorScaleOptions {
1779
- id?: string;
2157
+ export type NonPointContinuousColorScaleOptions = ScaleFields<
2158
+ "id" | "interpolate" | "clamp" | "reverse"
2159
+ > & {
1780
2160
  type?: "sequential";
1781
2161
  domain?: "auto" | readonly [unknown, unknown];
1782
2162
  range?: "auto" | readonly [string, string, ...string[]];
@@ -1784,37 +2164,45 @@ export interface ContinuousColorScaleOptions {
1784
2164
  name: PaletteName;
1785
2165
  extent?: readonly [number, number];
1786
2166
  };
1787
- interpolate?: ContinuousColorInterpolation;
1788
- clamp?: boolean;
1789
- reverse?: boolean;
1790
- }
2167
+ };
1791
2168
 
2169
+ export type ContinuousColorScaleOptions =
2170
+ NonPointContinuousColorScaleOptions & { unknown?: string };
2171
+
2172
+ export type NonPointQuantizeColorScaleOptions = ScaleFields<
2173
+ "id" | "clamp" | "reverse"
2174
+ > & {
2175
+ type: "quantize";
2176
+ domain?: "auto" | readonly [number, number];
2177
+ range?: "auto" | readonly [string, string, ...string[]];
2178
+ palette?: PaletteName | { name: PaletteName; count?: number };
2179
+ };
2180
+ export type NonPointQuantileColorScaleOptions = ScaleFields<"id" | "reverse"> & {
2181
+ type: "quantile";
2182
+ domain?: "auto" | readonly number[];
2183
+ range?: "auto" | readonly [string, string, ...string[]];
2184
+ palette?: PaletteName | { name: PaletteName; count?: number };
2185
+ };
2186
+ export type NonPointThresholdColorScaleOptions = ScaleFields<"id" | "reverse"> & {
2187
+ type: "threshold";
2188
+ domain: readonly number[];
2189
+ range?: "auto" | readonly [string, string, ...string[]];
2190
+ palette?: PaletteName | { name: PaletteName; count?: number };
2191
+ };
2192
+ export type NonPointDiscretizedColorScaleOptions =
2193
+ | NonPointQuantizeColorScaleOptions
2194
+ | NonPointQuantileColorScaleOptions
2195
+ | NonPointThresholdColorScaleOptions;
2196
+ export type QuantizeColorScaleOptions =
2197
+ NonPointQuantizeColorScaleOptions & { unknown?: string };
2198
+ export type QuantileColorScaleOptions =
2199
+ NonPointQuantileColorScaleOptions & { unknown?: string };
2200
+ export type ThresholdColorScaleOptions =
2201
+ NonPointThresholdColorScaleOptions & { unknown?: string };
1792
2202
  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
- };
2203
+ | QuantizeColorScaleOptions
2204
+ | QuantileColorScaleOptions
2205
+ | ThresholdColorScaleOptions;
1818
2206
 
1819
2207
  export type ColorEncodingOptions =
1820
2208
  | CategoricalEncodingOptions
@@ -1837,16 +2225,14 @@ export type ColorEncodingOptions =
1837
2225
  layout?: never;
1838
2226
  };
1839
2227
 
1840
- export interface OpacityScaleOptions {
1841
- id?: string;
2228
+ export type OpacityScaleOptions = ScaleFields<
2229
+ "id" | "nice" | "zero" | "clamp" | "reverse"
2230
+ > & {
1842
2231
  type?: "linear";
1843
2232
  domain?: "auto" | readonly [number, number];
1844
2233
  range?: "auto" | readonly [number, number];
1845
- nice?: boolean;
1846
- zero?: boolean;
1847
- clamp?: boolean;
1848
- reverse?: boolean;
1849
- }
2234
+ unknown?: number;
2235
+ };
1850
2236
 
1851
2237
  export type OpacityEncodingOptions =
1852
2238
  | { value: number; field?: never; target?: string }
@@ -1858,19 +2244,7 @@ export type OpacityEncodingOptions =
1858
2244
  scale?: OpacityScaleOptions;
1859
2245
  };
1860
2246
 
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
- }
2247
+ export type StrokeWidthScaleOptions = NonPointQuantitativePositionScaleOptions;
1874
2248
 
1875
2249
  export type StrokeWidthEncodingOptions =
1876
2250
  | {
@@ -2340,8 +2714,8 @@ export class ChartProgram {
2340
2714
  encodeX2(options: SecondaryPositionEncodingOptions): ChartProgram;
2341
2715
  encodeColor(options: ColorEncodingOptions): ChartProgram;
2342
2716
  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;
2717
+ encodeSize(options: { field: string; target?: string; fieldType?: "quantitative"; scale?: SizeScaleOptions }): ChartProgram;
2718
+ encodeShape(options: { field: string; target?: string; fieldType?: "nominal"; scale?: ShapeScaleOptions }): ChartProgram;
2345
2719
  encodeAngle(options:
2346
2720
  | { target?: string; value: number; field?: never; fieldType?: never }
2347
2721
  | { target?: string; field: string; fieldType?: "quantitative"; value?: never }
@@ -2359,7 +2733,7 @@ export class ChartProgram {
2359
2733
  target?: string;
2360
2734
  fieldType?: "quantitative";
2361
2735
  coordinate?: string;
2362
- scale?: ScaleOptions;
2736
+ scale?: NonPointQuantitativePositionScaleOptions;
2363
2737
  }): ChartProgram;
2364
2738
  encodeXRange(options: {
2365
2739
  lower: string;
@@ -2367,7 +2741,7 @@ export class ChartProgram {
2367
2741
  target?: string;
2368
2742
  fieldType?: "quantitative";
2369
2743
  coordinate?: string;
2370
- scale?: ScaleOptions;
2744
+ scale?: NonPointQuantitativePositionScaleOptions;
2371
2745
  }): ChartProgram;
2372
2746
  encodeGroup(options: { field: string; target?: string; fieldType?: "nominal" }): ChartProgram;
2373
2747
  encodePathOrder(options: PathOrderEncodingOptions): ChartProgram;