ggaction 0.0.9 → 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 (222) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/README.md +5 -4
  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/extension-authoring.md +248 -0
  7. package/knowledge/intent-taxonomy.json +1 -183
  8. package/knowledge/intent-taxonomy.schema.json +1 -0
  9. package/knowledge/mcp-resources.json +1 -95
  10. package/knowledge/mcp-resources.schema.json +1 -0
  11. package/knowledge/task-packet.schema.json +1 -159
  12. package/knowledge/task-resolver.js +1 -1230
  13. package/package.json +19 -2
  14. package/src/actions/boxPlots/edit.js +45 -298
  15. package/src/actions/boxPlots/options.js +46 -77
  16. package/src/actions/boxPlots/resolve.js +1 -1
  17. package/src/actions/charts/bar.js +3 -0
  18. package/src/actions/charts/heatmap.js +73 -83
  19. package/src/actions/charts/index.js +1 -1
  20. package/src/actions/charts/parallel.js +35 -1
  21. package/src/actions/charts/shared.js +20 -0
  22. package/src/actions/composition/actions.js +46 -49
  23. package/src/actions/data/bin2d.js +105 -2
  24. package/src/actions/data/box.js +17 -17
  25. package/src/actions/data/density.js +42 -78
  26. package/src/actions/data/gradientProfile.js +22 -52
  27. package/src/actions/data/horizon.js +16 -41
  28. package/src/actions/data/index.js +10 -10
  29. package/src/actions/data/interval.js +16 -38
  30. package/src/actions/data/intervalEdit.js +55 -0
  31. package/src/actions/data/regression.js +7 -17
  32. package/src/actions/data/shared.js +47 -0
  33. package/src/actions/data/timeUnit.js +14 -38
  34. package/src/actions/data/window.js +14 -38
  35. package/src/actions/distributions/revision.js +154 -34
  36. package/src/actions/encodings/angle.js +9 -10
  37. package/src/actions/encodings/appearance.js +17 -51
  38. package/src/actions/encodings/density/resolve.js +3 -1
  39. package/src/actions/encodings/density.js +1 -15
  40. package/src/actions/encodings/horizon/resolve.js +13 -3
  41. package/src/actions/encodings/horizon.js +8 -7
  42. package/src/actions/encodings/index.js +9 -9
  43. package/src/actions/encodings/offset.js +8 -24
  44. package/src/actions/encodings/parallel.js +9 -10
  45. package/src/actions/encodings/pathOrder.js +6 -13
  46. package/src/actions/encodings/position/policies/index.js +4 -4
  47. package/src/actions/encodings/position/policies/line.js +47 -17
  48. package/src/actions/encodings/position/resolve.js +24 -5
  49. package/src/actions/encodings/ranged.js +18 -23
  50. package/src/actions/encodings/remove.js +15 -25
  51. package/src/actions/encodings/ruleAppearance.js +9 -24
  52. package/src/actions/encodings/shared.js +37 -0
  53. package/src/actions/encodings/strokeDash.js +8 -23
  54. package/src/actions/encodings/text.js +9 -10
  55. package/src/actions/errorBands/create.js +105 -39
  56. package/src/actions/errorBands/edit.js +89 -93
  57. package/src/actions/errorBands/index.js +1 -2
  58. package/src/actions/errorBars/create.js +78 -27
  59. package/src/actions/errorBars/edit.js +81 -48
  60. package/src/actions/errorBars/index.js +1 -2
  61. package/src/actions/facets/actions.js +45 -69
  62. package/src/actions/facets/derive.js +38 -53
  63. package/src/actions/facets/replay.js +0 -1
  64. package/src/actions/gradientPlots/components.js +59 -48
  65. package/src/actions/gradientPlots/edit.js +35 -216
  66. package/src/actions/gradientPlots/index.js +11 -10
  67. package/src/actions/gradientPlots/materialize.js +21 -35
  68. package/src/actions/gradientPlots/options.js +5 -7
  69. package/src/actions/gradientPlots/paint.js +9 -6
  70. package/src/actions/gradientPlots/resolve.js +1 -1
  71. package/src/actions/guides/axes/index.js +3 -3
  72. package/src/actions/guides/axes/labels.js +68 -26
  73. package/src/actions/guides/axes/lines.js +22 -2
  74. package/src/actions/guides/axes/policy.js +28 -8
  75. package/src/actions/guides/axes/ticks.js +27 -9
  76. package/src/actions/guides/axes/titles.js +113 -65
  77. package/src/actions/guides/grids/resolve.js +14 -0
  78. package/src/actions/guides/guides.js +2 -4
  79. package/src/actions/guides/index.js +2 -2
  80. package/src/actions/guides/legends/categorical/actions.js +44 -68
  81. package/src/actions/guides/legends/categorical/components.js +6 -1
  82. package/src/actions/guides/legends/categorical/index.js +2 -2
  83. package/src/actions/guides/legends/categorical/layout.js +148 -175
  84. package/src/actions/guides/legends/categorical/recipes.js +5 -0
  85. package/src/actions/guides/legends/categorical/resolve.js +8 -1
  86. package/src/actions/guides/legends/continuous/common.js +117 -66
  87. package/src/actions/guides/legends/continuous/gradient.js +38 -37
  88. package/src/actions/guides/legends/continuous/interval.js +97 -76
  89. package/src/actions/guides/legends/continuous/opacity.js +28 -38
  90. package/src/actions/guides/legends/edit.js +14 -1
  91. package/src/actions/guides/legends/index.js +1 -1
  92. package/src/actions/guides/legends/lane.js +2 -1
  93. package/src/actions/guides/legends/remove.js +8 -0
  94. package/src/actions/guides/legends/size.js +36 -43
  95. package/src/actions/guides/legends/strokeWidth.js +20 -26
  96. package/src/actions/guides/polar/axes/labels.js +17 -1
  97. package/src/actions/guides/polar/axes/shared.js +7 -1
  98. package/src/actions/guides/polar/axes/titles.js +19 -2
  99. package/src/actions/guides/polar/grids.js +4 -0
  100. package/src/actions/guides/polar/resolve.js +6 -0
  101. package/src/actions/index.js +13 -13
  102. package/src/actions/intervals/resolve.js +87 -117
  103. package/src/actions/marks/arc/actions.js +31 -36
  104. package/src/actions/marks/area/actions.js +23 -31
  105. package/src/actions/marks/index.js +6 -6
  106. package/src/actions/marks/line/actions.js +33 -52
  107. package/src/actions/marks/line/materialize.js +7 -5
  108. package/src/actions/marks/point/materialize.js +5 -3
  109. package/src/actions/marks/remove.js +21 -0
  110. package/src/actions/marks/rule/actions.js +53 -53
  111. package/src/actions/marks/shared.js +8 -4
  112. package/src/actions/marks/text/actions.js +14 -6
  113. package/src/actions/marks/text/layout.js +21 -45
  114. package/src/actions/marks/tick/actions.js +22 -21
  115. package/src/actions/primitives/createGraphics.js +4 -0
  116. package/src/actions/primitives/editGraphics.js +4 -0
  117. package/src/actions/primitives/index.js +3 -3
  118. package/src/actions/primitives/semantic.js +1 -1
  119. package/src/actions/primitives/semanticValidation/index.js +2 -2
  120. package/src/actions/primitives/semanticValidation/layer.js +1 -1
  121. package/src/actions/regression/edit.js +3 -43
  122. package/src/actions/scales/consumers/families.js +24 -4
  123. package/src/actions/scales/consumers/index.js +1 -1
  124. package/src/actions/scales/consumers/seriesLayout.js +17 -0
  125. package/src/actions/scales/definitions.js +100 -103
  126. package/src/actions/scales/materialize.js +5 -0
  127. package/src/actions/selection/actions.js +79 -121
  128. package/src/actions/titles/actions.js +48 -94
  129. package/src/actions/titles/resolve.js +14 -27
  130. package/src/actions/violinPlots/create.js +37 -44
  131. package/src/core/action.js +20 -5
  132. package/src/core/extensionRegistry.js +104 -0
  133. package/src/core/textMetrics.js +74 -37
  134. package/src/core/validation.js +18 -0
  135. package/src/extension.js +8 -1
  136. package/src/grammar/aggregate.js +48 -28
  137. package/src/grammar/arcs.js +58 -11
  138. package/src/grammar/areaSeries.js +14 -16
  139. package/src/grammar/bin2d.js +37 -23
  140. package/src/grammar/boxPlot.js +14 -13
  141. package/src/grammar/categoricalDensity.js +14 -14
  142. package/src/grammar/categoryOrder.js +8 -14
  143. package/src/grammar/curveCommands.js +87 -20
  144. package/src/grammar/density.js +162 -141
  145. package/src/grammar/facets/index.js +14 -0
  146. package/src/grammar/facets/scales.js +7 -4
  147. package/src/grammar/gradientProfile.js +12 -15
  148. package/src/grammar/histogram.js +145 -83
  149. package/src/grammar/horizon.js +60 -23
  150. package/src/grammar/interval.js +14 -13
  151. package/src/grammar/lineSeries.js +91 -61
  152. package/src/grammar/numeric.js +290 -0
  153. package/src/grammar/paint.js +3 -4
  154. package/src/grammar/palettes.js +21 -32
  155. package/src/grammar/pathCommands.js +6 -0
  156. package/src/grammar/polarPaths.js +5 -5
  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/scales/color.js +35 -26
  161. package/src/grammar/scales/continuous.js +71 -24
  162. package/src/grammar/scales/definition.js +1 -1
  163. package/src/grammar/scales/discretized.js +42 -12
  164. package/src/grammar/scales/fields.js +21 -4
  165. package/src/grammar/scales/ordinal.js +117 -61
  166. package/src/grammar/scales/temporal.js +40 -11
  167. package/src/grammar/scales/transformed.js +199 -52
  168. package/src/grammar/schemas/graphicBounds.js +270 -79
  169. package/src/grammar/seriesLayout.js +50 -18
  170. package/src/grammar/ticks.js +123 -53
  171. package/src/grammar/timeUnit.js +18 -8
  172. package/src/grammar/transforms.js +4 -1
  173. package/src/grammar/window.js +70 -57
  174. package/src/index.js +1 -1
  175. package/src/layout/canvas.js +4 -8
  176. package/src/layout/composition.js +39 -40
  177. package/src/layout/facets.js +10 -14
  178. package/src/layout/labels.js +91 -15
  179. package/src/layout/legend.js +22 -20
  180. package/src/layout/legendLane.js +54 -40
  181. package/src/layout/title.js +7 -7
  182. package/src/materialization/bars/aggregate.js +14 -40
  183. package/src/materialization/bars/grouped.js +7 -18
  184. package/src/materialization/bars/histogram.js +2 -19
  185. package/src/materialization/bars/ranged.js +20 -15
  186. package/src/materialization/bars/resolve.js +21 -0
  187. package/src/materialization/facetGuides/legacyCategorical.js +2 -1
  188. package/src/materialization/facetGuides/placement.js +34 -19
  189. package/src/materialization/facetGuides/preparation.js +9 -5
  190. package/src/materialization/facets.js +39 -27
  191. package/src/materialization/guides/resources.js +2 -1
  192. package/src/materialization/marks/capabilities.js +5 -2
  193. package/src/materialization/marks/index.js +24 -4
  194. package/src/materialization/scales/policies/bar.js +61 -59
  195. package/src/materialization/scales/policies/binnedPosition.js +34 -0
  196. package/src/materialization/scales/policies/series.js +13 -7
  197. package/src/materialization/scales/resolve.js +4 -5
  198. package/src/materialization/selection/items/arc.js +16 -2
  199. package/src/materialization/selection/items/bar.js +4 -2
  200. package/src/materialization/selection/items/common.js +21 -1
  201. package/src/materialization/selection/items/path.js +19 -2
  202. package/src/materialization/selection/items/point.js +4 -16
  203. package/src/materialization/selection/items/tick.js +13 -21
  204. package/src/materialization/selection/point.js +11 -4
  205. package/src/materialization/selection/styles.js +19 -27
  206. package/src/materialization/text.js +4 -1
  207. package/src/mcp/adapter.js +8 -3
  208. package/src/renderers/canvas/fill.js +2 -2
  209. package/src/renderers/canvas/index.js +35 -2
  210. package/src/renderers/canvas/native.js +160 -0
  211. package/src/renderers/pdf.js +14 -0
  212. package/src/renderers/svg.js +37 -4
  213. package/types/extension.d.ts +19 -0
  214. package/types/index.d.ts +3 -0
  215. package/types/program.d.ts +509 -131
  216. package/types/svg.d.ts +1 -0
  217. package/src/actions/errorBands/components.js +0 -81
  218. package/src/actions/errorBands/options.js +0 -39
  219. package/src/actions/errorBands/resolve.js +0 -28
  220. package/src/actions/errorBars/components.js +0 -62
  221. package/src/actions/errorBars/options.js +0 -58
  222. package/src/actions/errorBars/resolve.js +0 -25
@@ -1,3 +1,5 @@
1
+ import type { RegisteredExtensionActions } from "./extension.js";
2
+
1
3
  export type FieldType = "quantitative" | "temporal" | "ordinal" | "nominal";
2
4
  export type GraphicType =
3
5
  | "canvas"
@@ -197,7 +199,7 @@ export interface CategoryDensityPlacement {
197
199
  side?: DensityPlacementSide;
198
200
  width?: DensityPlacementWidth;
199
201
  split?: DensityPlacementSplit;
200
- scale?: ScaleOptions;
202
+ scale?: NonPointBandPositionScaleOptions;
201
203
  }
202
204
  export type DensityPlacement =
203
205
  | BaselineDensityPlacement
@@ -705,10 +707,11 @@ export interface CanvasOptions {
705
707
 
706
708
  export type XAxisPosition = "bottom" | "top";
707
709
  export type YAxisPosition = "left" | "right";
710
+ type TimeAxisDirective = "Y" | "m" | "d" | "b";
708
711
  export type AxisFormatString =
709
712
  | ".0f" | ".1f" | ".2f"
710
713
  | ".0%" | ".1%" | ".2e"
711
- | "%Y" | "%Y-%m" | "%Y-%m-%d";
714
+ | `${string}%${TimeAxisDirective}${string}`;
712
715
  export type AxisFormat =
713
716
  | "auto"
714
717
  | AxisFormatString
@@ -885,6 +888,33 @@ export interface CreateGuidesOptions {
885
888
  legend?: false | LegendOptions;
886
889
  }
887
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
+
888
918
  export interface CreateCoordinateOptions {
889
919
  id?: string;
890
920
  type?: "cartesian" | "polar" | "parallel";
@@ -912,6 +942,79 @@ export interface ScaleOptions {
912
942
  unknown?: unknown;
913
943
  }
914
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
+
915
1018
  export type CreateScaleOptions = ScaleOptions & { id: string };
916
1019
 
917
1020
  export interface EditScaleOptions {
@@ -935,13 +1038,10 @@ export interface EditScaleOptions {
935
1038
  unknown?: unknown;
936
1039
  }
937
1040
 
938
- export interface PositionEncodingOptions {
1041
+ interface PositionEncodingBase {
939
1042
  field: string;
940
1043
  target?: string;
941
- fieldType?: FieldType;
942
- scale?: ScaleOptions;
943
1044
  coordinate?: string;
944
- aggregate?: AggregateOperation;
945
1045
  bin?:
946
1046
  | { maxBins?: number; step?: never; boundaries?: never }
947
1047
  | { maxBins?: never; step: number; boundaries?: never }
@@ -953,8 +1053,38 @@ export interface PositionEncodingOptions {
953
1053
  stack?: StackMode;
954
1054
  }
955
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
+
956
1084
  export type YPositionEncodingOptions =
957
- Omit<PositionEncodingOptions, "stack"> & { stack?: YStackMode };
1085
+ PositionEncodingOptions extends infer T
1086
+ ? T extends unknown ? Omit<T, "bin" | "stack"> & { stack?: YStackMode } : never
1087
+ : never;
958
1088
 
959
1089
  export interface ThetaScaleOptions {
960
1090
  id?: string;
@@ -969,7 +1099,6 @@ export interface ThetaScaleOptions {
969
1099
  paddingOuter?: number;
970
1100
  padding?: number;
971
1101
  align?: number;
972
- unknown?: unknown;
973
1102
  }
974
1103
 
975
1104
  export interface RadiusScaleOptions {
@@ -984,7 +1113,6 @@ export interface RadiusScaleOptions {
984
1113
  base?: number;
985
1114
  exponent?: number;
986
1115
  constant?: number;
987
- unknown?: unknown;
988
1116
  }
989
1117
 
990
1118
  export interface ThetaEncodingOptions {
@@ -1009,15 +1137,46 @@ type RulePositionValue =
1009
1137
  | { field: string; datum?: never }
1010
1138
  | { field?: never; datum: unknown };
1011
1139
 
1012
- 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;
1013
1148
  target?: string;
1014
- fieldType: FieldType;
1015
- scale?: ScaleOptions;
1016
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 };
1017
1176
  };
1018
1177
 
1019
1178
  export type SecondaryPositionEncodingOptions =
1020
- | RulePositionEncodingOptions
1179
+ | SecondaryRulePositionEncodingOptions
1021
1180
  | {
1022
1181
  field: string;
1023
1182
  datum?: never;
@@ -1032,8 +1191,8 @@ export type HistogramEncodingOptions = {
1032
1191
  target?: string;
1033
1192
  coordinate?: string;
1034
1193
  stack?: StackMode;
1035
- xScale?: ScaleOptions;
1036
- yScale?: ScaleOptions;
1194
+ xScale?: NonPointQuantitativePositionScaleOptions;
1195
+ yScale?: NonPointZeroSupportingPositionScaleOptions;
1037
1196
  } & (
1038
1197
  | { maxBins?: number; binStep?: never; binBoundaries?: never }
1039
1198
  | { maxBins?: never; binStep: number; binBoundaries?: never }
@@ -1048,7 +1207,7 @@ export interface CategoricalEncodingOptions {
1048
1207
  field: string;
1049
1208
  target?: string;
1050
1209
  fieldType?: "nominal" | "ordinal";
1051
- scale?: ScaleOptions;
1210
+ scale?: CategoricalColorScaleOptions;
1052
1211
  palette?: Palette;
1053
1212
  layout?: ColorLayout;
1054
1213
  }
@@ -1070,13 +1229,13 @@ type DensityEncodingBase = Omit<DensityDataOptions, "id"> & {
1070
1229
  target?: string;
1071
1230
  densityChannel?: "x" | "y";
1072
1231
  coordinate?: string;
1073
- valueScale?: ScaleOptions;
1232
+ valueScale?: NonPointQuantitativePositionScaleOptions;
1074
1233
  };
1075
1234
 
1076
1235
  export type DensityEncodingOptions = DensityEncodingBase & (
1077
1236
  | {
1078
1237
  placement?: BaselineDensityPlacement;
1079
- densityScale?: ScaleOptions;
1238
+ densityScale?: NonPointZeroSupportingPositionScaleOptions;
1080
1239
  }
1081
1240
  | {
1082
1241
  placement: CategoryDensityPlacement;
@@ -1084,16 +1243,33 @@ export type DensityEncodingOptions = DensityEncodingBase & (
1084
1243
  }
1085
1244
  );
1086
1245
 
1087
- export interface HorizonXEncoding {
1088
- field: string;
1089
- fieldType?: "quantitative" | "temporal";
1090
- scale?: ScaleOptions;
1091
- }
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
+ };
1092
1268
 
1093
1269
  export interface HorizonYEncoding {
1094
1270
  field: string;
1095
1271
  fieldType?: "quantitative";
1096
- scale?: ScaleOptions;
1272
+ scale?: HorizonYScaleOptions;
1097
1273
  }
1098
1274
 
1099
1275
  export interface HorizonPaletteOptions {
@@ -1181,25 +1357,30 @@ export interface EditBin2DDataOptions {
1181
1357
  as?: DatasetBin2DOutputFields;
1182
1358
  }
1183
1359
 
1184
- export interface ErrorBarPositionChannel {
1185
- field?: string;
1186
- fieldType?: "nominal" | "ordinal" | "temporal";
1187
- scale?: ScaleOptions;
1188
- }
1360
+ export type ErrorBarPositionChannel = { field?: string } & (
1361
+ | {
1362
+ fieldType?: "nominal" | "ordinal";
1363
+ scale?: NonPointCategoricalPositionScaleOptions;
1364
+ }
1365
+ | {
1366
+ fieldType: "temporal";
1367
+ scale?: NonPointTemporalPositionScaleOptions;
1368
+ }
1369
+ );
1189
1370
 
1190
1371
  export interface ErrorBarStatisticalIntervalChannel {
1191
1372
  field?: string;
1192
1373
  center?: IntervalCenter;
1193
1374
  extent?: IntervalExtent;
1194
1375
  level?: number;
1195
- scale?: ScaleOptions;
1376
+ scale?: NonPointQuantitativePositionScaleOptions;
1196
1377
  }
1197
1378
 
1198
1379
  export interface ErrorBarExplicitIntervalChannel {
1199
1380
  center: string;
1200
1381
  lower: string;
1201
1382
  upper: string;
1202
- scale?: ScaleOptions;
1383
+ scale?: NonPointQuantitativePositionScaleOptions;
1203
1384
  }
1204
1385
 
1205
1386
  export type ErrorBarIntervalChannel =
@@ -1239,14 +1420,14 @@ export interface EditErrorBarOptions {
1239
1420
 
1240
1421
  export interface BoxPlotCategoryChannel {
1241
1422
  field: string;
1242
- fieldType: "nominal" | "ordinal" | "temporal";
1243
- scale?: ScaleOptions;
1423
+ fieldType: "nominal" | "ordinal";
1424
+ scale?: NonPointBandPositionScaleOptions;
1244
1425
  }
1245
1426
 
1246
1427
  export interface BoxPlotMeasureChannel {
1247
1428
  field: string;
1248
1429
  fieldType?: "quantitative";
1249
- scale?: ScaleOptions;
1430
+ scale?: NonPointQuantitativePositionScaleOptions;
1250
1431
  }
1251
1432
 
1252
1433
  export type BoxPlotPositionChannel =
@@ -1282,7 +1463,7 @@ export interface BoxPlotOptions {
1282
1463
  radius?: number;
1283
1464
  opacity?: number;
1284
1465
  };
1285
- guides?: false | CreateGuidesOptions;
1466
+ guides?: false | CartesianGuideOptions;
1286
1467
  }
1287
1468
 
1288
1469
  export interface EditBoxPlotOptions {
@@ -1342,12 +1523,28 @@ export interface GradientPlotOptions {
1342
1523
  width?: { band?: number };
1343
1524
  gradient?: GradientPlotAppearanceOptions;
1344
1525
  center?: false | GradientPlotCenterOptions;
1345
- guides?: false | CreateGuidesOptions;
1526
+ guides?: false | GradientPlotGuideOptions;
1346
1527
  }
1347
1528
 
1348
1529
  export type ViolinPlotPositionChannel =
1349
1530
  | string
1350
- | 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
+ };
1351
1548
 
1352
1549
  export interface ViolinPlotDensityOptions
1353
1550
  extends GradientPlotDensityOptions {
@@ -1361,7 +1558,13 @@ export interface ViolinPlotSplitOptions {
1361
1558
 
1362
1559
  export type ViolinPlotColorOptions =
1363
1560
  | string
1364
- | Omit<CategoricalEncodingOptions, "target">;
1561
+ | {
1562
+ field: string;
1563
+ fieldType?: "nominal" | "ordinal";
1564
+ scale?: NonPointCategoricalColorScaleOptions;
1565
+ palette?: Palette;
1566
+ layout?: "overlay";
1567
+ };
1365
1568
 
1366
1569
  export interface ViolinPlotAreaOptions {
1367
1570
  fill?: string;
@@ -1381,7 +1584,7 @@ export interface ViolinPlotOptions {
1381
1584
  color?: ViolinPlotColorOptions;
1382
1585
  density?: ViolinPlotDensityOptions;
1383
1586
  area?: ViolinPlotAreaOptions;
1384
- guides?: false | CreateGuidesOptions;
1587
+ guides?: false | CartesianGuideOptions;
1385
1588
  }
1386
1589
 
1387
1590
  export interface EditGradientPlotOptions {
@@ -1395,23 +1598,169 @@ export interface EditGradientPlotOptions {
1395
1598
  center?: false | GradientPlotCenterOptions;
1396
1599
  }
1397
1600
 
1398
- 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 =
1399
1634
  | string
1400
- | 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
+ ));
1401
1671
  type BasicColorChannel =
1402
1672
  | string
1403
- | (ColorEncodingOptions extends infer T
1404
- ? T extends unknown ? Omit<T, "target"> : never
1405
- : 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
+ };
1406
1755
  export type BasicSizeChannel = string | {
1407
1756
  field: string;
1408
1757
  fieldType?: "quantitative";
1409
- scale?: ScaleOptions;
1758
+ scale?: SizeScaleOptions;
1410
1759
  };
1411
1760
  export type BasicShapeChannel = string | {
1412
1761
  field: string;
1413
1762
  fieldType?: "nominal";
1414
- scale?: ScaleOptions;
1763
+ scale?: ShapeScaleOptions;
1415
1764
  };
1416
1765
  export type BasicStrokeDashChannel =
1417
1766
  StrokeDashEncodingOptions extends infer T
@@ -1419,12 +1768,25 @@ export type BasicStrokeDashChannel =
1419
1768
  : never;
1420
1769
 
1421
1770
  export type ParallelMissingPolicy = "break" | "drop-row" | "error";
1422
- export type ParallelDimension = string | {
1771
+ export type ParallelDimension = string | ({
1423
1772
  field: string;
1424
- fieldType?: "quantitative" | "ordinal";
1425
1773
  title?: string;
1426
- scale?: Omit<ScaleOptions, "id">;
1427
- };
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
+ ));
1428
1790
  export interface ParallelCoordinatesEncodingOptions {
1429
1791
  target?: string;
1430
1792
  coordinate?: string;
@@ -1439,7 +1801,7 @@ export interface CreateParallelCoordinatesOptions {
1439
1801
  dimensions: readonly [ParallelDimension, ParallelDimension, ...ParallelDimension[]];
1440
1802
  key?: string;
1441
1803
  missing?: ParallelMissingPolicy;
1442
- color?: BasicColorChannel;
1804
+ color?: LineCategoricalColorChannel;
1443
1805
  strokeDash?: BasicStrokeDashChannel;
1444
1806
  line?: {
1445
1807
  strokeWidth?: number;
@@ -1448,15 +1810,15 @@ export interface CreateParallelCoordinatesOptions {
1448
1810
  curve?: "linear";
1449
1811
  closed?: false;
1450
1812
  };
1451
- guides?: false | CreateGuidesOptions;
1813
+ guides?: false | ParallelGuideOptions;
1452
1814
  }
1453
1815
 
1454
1816
  export interface CreateScatterPlotOptions {
1455
1817
  id?: string;
1456
1818
  data?: string;
1457
1819
  coordinate?: string;
1458
- x: BasicPositionChannel;
1459
- y: BasicPositionChannel;
1820
+ x: PointFacadePositionChannel;
1821
+ y: PointFacadePositionChannel;
1460
1822
  color?: BasicColorChannel;
1461
1823
  size?: BasicSizeChannel;
1462
1824
  shape?: BasicShapeChannel;
@@ -1474,9 +1836,9 @@ export interface CreateLinePlotOptions {
1474
1836
  id?: string;
1475
1837
  data?: string;
1476
1838
  coordinate?: string;
1477
- x: BasicPositionChannel;
1478
- y: BasicPositionChannel;
1479
- color?: BasicColorChannel;
1839
+ x: LineXPositionChannel;
1840
+ y: LineYPositionChannel;
1841
+ color?: LineCategoricalColorChannel;
1480
1842
  groupBy?: string;
1481
1843
  strokeDash?: BasicStrokeDashChannel;
1482
1844
  line?: {
@@ -1484,23 +1846,27 @@ export interface CreateLinePlotOptions {
1484
1846
  curve?: CurveInterpolation;
1485
1847
  stroke?: string;
1486
1848
  opacity?: number;
1487
- closed?: boolean;
1849
+ closed?: false;
1488
1850
  };
1489
1851
  guides?: false | CreateGuidesOptions;
1490
1852
  }
1491
1853
 
1492
1854
  type BasicHistogramEncoding =
1493
1855
  HistogramEncodingOptions extends infer T
1494
- ? 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
1495
1861
  : never;
1496
1862
 
1497
1863
  export interface CreateBarPlotOptions {
1498
1864
  id?: string;
1499
1865
  data?: string;
1500
1866
  coordinate?: string;
1501
- x: BasicPositionChannel;
1502
- y: BasicPositionChannel;
1503
- color?: BasicColorChannel;
1867
+ x: BandPositionChannel;
1868
+ y: BarYPositionChannel;
1869
+ color?: BarColorChannel;
1504
1870
  width?: Omit<BarWidthOptions, "target">;
1505
1871
  bar?: {
1506
1872
  fill?: string;
@@ -1516,7 +1882,7 @@ export type CreateHistogramOptions = BasicHistogramEncoding & {
1516
1882
  data?: string;
1517
1883
  coordinate?: string;
1518
1884
  field: string;
1519
- color?: BasicColorChannel;
1885
+ color?: HistogramCategoricalColorChannel;
1520
1886
  bar?: {
1521
1887
  fill?: string;
1522
1888
  opacity?: number;
@@ -1535,24 +1901,34 @@ export interface HeatmapBaseOptions {
1535
1901
  stroke?: string | false;
1536
1902
  strokeWidth?: number;
1537
1903
  };
1538
- guides?: false | CreateGuidesOptions;
1904
+ guides?: false | CartesianGuideOptions;
1539
1905
  }
1540
1906
 
1907
+ export type HeatmapCategoryPositionChannel =
1908
+ | string
1909
+ | {
1910
+ field: string;
1911
+ fieldType?: "nominal" | "ordinal";
1912
+ scale?: NonPointBandPositionScaleOptions;
1913
+ };
1914
+
1541
1915
  export interface PreGriddedHeatmapOptions extends HeatmapBaseOptions {
1542
- x: BasicPositionChannel;
1543
- y: BasicPositionChannel;
1916
+ x: HeatmapCategoryPositionChannel;
1917
+ y: HeatmapCategoryPositionChannel;
1544
1918
  bin?: never;
1545
- color: BasicColorChannel;
1919
+ color: RectColorChannel;
1546
1920
  }
1547
1921
 
1548
1922
  export interface BinnedHeatmapPositionChannel {
1549
1923
  field: string;
1550
1924
  fieldType?: "quantitative";
1551
- scale?: ScaleOptions;
1925
+ scale?: NonPointQuantitativePositionScaleOptions;
1552
1926
  }
1553
1927
 
1554
1928
  export interface BinnedHeatmapColorOptions {
1555
- scale?: ContinuousColorScaleOptions | DiscretizedColorScaleOptions;
1929
+ scale?:
1930
+ | NonPointContinuousColorScaleOptions
1931
+ | NonPointDiscretizedColorScaleOptions;
1556
1932
  palette?: Palette;
1557
1933
  }
1558
1934
 
@@ -1573,25 +1949,30 @@ export type CreateHeatmapOptions =
1573
1949
  | PreGriddedHeatmapOptions
1574
1950
  | BinnedHeatmapOptions;
1575
1951
 
1576
- export interface ErrorBandPositionChannel {
1577
- field?: string;
1578
- fieldType?: "quantitative" | "temporal";
1579
- scale?: ScaleOptions;
1580
- }
1952
+ export type ErrorBandPositionChannel = { field?: string } & (
1953
+ | {
1954
+ fieldType?: "quantitative";
1955
+ scale?: NonPointQuantitativePositionScaleOptions;
1956
+ }
1957
+ | {
1958
+ fieldType: "temporal";
1959
+ scale?: NonPointTemporalPositionScaleOptions;
1960
+ }
1961
+ );
1581
1962
 
1582
1963
  export interface ErrorBandStatisticalIntervalChannel {
1583
1964
  field?: string;
1584
1965
  center?: IntervalCenter;
1585
1966
  extent?: IntervalExtent;
1586
1967
  level?: number;
1587
- scale?: ScaleOptions;
1968
+ scale?: NonPointQuantitativePositionScaleOptions;
1588
1969
  }
1589
1970
 
1590
1971
  export interface ErrorBandExplicitIntervalChannel {
1591
1972
  center: string;
1592
1973
  lower: string;
1593
1974
  upper: string;
1594
- scale?: ScaleOptions;
1975
+ scale?: NonPointQuantitativePositionScaleOptions;
1595
1976
  }
1596
1977
 
1597
1978
  export type ErrorBandIntervalChannel =
@@ -1773,8 +2154,9 @@ export type StrokeDashEncodingOptions =
1773
2154
  scale?: never;
1774
2155
  };
1775
2156
 
1776
- export interface ContinuousColorScaleOptions {
1777
- id?: string;
2157
+ export type NonPointContinuousColorScaleOptions = ScaleFields<
2158
+ "id" | "interpolate" | "clamp" | "reverse"
2159
+ > & {
1778
2160
  type?: "sequential";
1779
2161
  domain?: "auto" | readonly [unknown, unknown];
1780
2162
  range?: "auto" | readonly [string, string, ...string[]];
@@ -1782,37 +2164,45 @@ export interface ContinuousColorScaleOptions {
1782
2164
  name: PaletteName;
1783
2165
  extent?: readonly [number, number];
1784
2166
  };
1785
- interpolate?: ContinuousColorInterpolation;
1786
- clamp?: boolean;
1787
- reverse?: boolean;
1788
- }
2167
+ };
2168
+
2169
+ export type ContinuousColorScaleOptions =
2170
+ NonPointContinuousColorScaleOptions & { unknown?: string };
1789
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 };
1790
2202
  export type DiscretizedColorScaleOptions =
1791
- | {
1792
- id?: string;
1793
- type: "quantize";
1794
- domain?: "auto" | readonly [number, number];
1795
- range?: "auto" | readonly [string, string, ...string[]];
1796
- palette?: PaletteName | { name: PaletteName; count?: number };
1797
- clamp?: boolean;
1798
- reverse?: boolean;
1799
- }
1800
- | {
1801
- id?: string;
1802
- type: "quantile";
1803
- domain?: "auto" | readonly number[];
1804
- range?: "auto" | readonly [string, string, ...string[]];
1805
- palette?: PaletteName | { name: PaletteName; count?: number };
1806
- reverse?: boolean;
1807
- }
1808
- | {
1809
- id?: string;
1810
- type: "threshold";
1811
- domain: readonly number[];
1812
- range?: "auto" | readonly [string, string, ...string[]];
1813
- palette?: PaletteName | { name: PaletteName; count?: number };
1814
- reverse?: boolean;
1815
- };
2203
+ | QuantizeColorScaleOptions
2204
+ | QuantileColorScaleOptions
2205
+ | ThresholdColorScaleOptions;
1816
2206
 
1817
2207
  export type ColorEncodingOptions =
1818
2208
  | CategoricalEncodingOptions
@@ -1835,16 +2225,14 @@ export type ColorEncodingOptions =
1835
2225
  layout?: never;
1836
2226
  };
1837
2227
 
1838
- export interface OpacityScaleOptions {
1839
- id?: string;
2228
+ export type OpacityScaleOptions = ScaleFields<
2229
+ "id" | "nice" | "zero" | "clamp" | "reverse"
2230
+ > & {
1840
2231
  type?: "linear";
1841
2232
  domain?: "auto" | readonly [number, number];
1842
2233
  range?: "auto" | readonly [number, number];
1843
- nice?: boolean;
1844
- zero?: boolean;
1845
- clamp?: boolean;
1846
- reverse?: boolean;
1847
- }
2234
+ unknown?: number;
2235
+ };
1848
2236
 
1849
2237
  export type OpacityEncodingOptions =
1850
2238
  | { value: number; field?: never; target?: string }
@@ -1856,19 +2244,7 @@ export type OpacityEncodingOptions =
1856
2244
  scale?: OpacityScaleOptions;
1857
2245
  };
1858
2246
 
1859
- export interface StrokeWidthScaleOptions {
1860
- id?: string;
1861
- type?: "linear" | "log" | "pow" | "sqrt" | "symlog";
1862
- domain?: "auto" | readonly [number, number];
1863
- range?: "auto" | readonly [number, number];
1864
- nice?: boolean;
1865
- zero?: boolean;
1866
- clamp?: boolean;
1867
- reverse?: boolean;
1868
- base?: number;
1869
- exponent?: number;
1870
- constant?: number;
1871
- }
2247
+ export type StrokeWidthScaleOptions = NonPointQuantitativePositionScaleOptions;
1872
2248
 
1873
2249
  export type StrokeWidthEncodingOptions =
1874
2250
  | {
@@ -2189,6 +2565,8 @@ export interface EditTitleOptions
2189
2565
  subtitle?: string | false;
2190
2566
  }
2191
2567
 
2568
+ export interface ChartProgram extends RegisteredExtensionActions {}
2569
+
2192
2570
  export class ChartProgram {
2193
2571
  constructor(state?: ActionOptions);
2194
2572
  readonly semanticSpec: SemanticSpec;
@@ -2336,8 +2714,8 @@ export class ChartProgram {
2336
2714
  encodeX2(options: SecondaryPositionEncodingOptions): ChartProgram;
2337
2715
  encodeColor(options: ColorEncodingOptions): ChartProgram;
2338
2716
  encodeStrokeDash(options: StrokeDashEncodingOptions): ChartProgram;
2339
- encodeSize(options: { field: string; target?: string; fieldType?: "quantitative"; scale?: ScaleOptions }): ChartProgram;
2340
- 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;
2341
2719
  encodeAngle(options:
2342
2720
  | { target?: string; value: number; field?: never; fieldType?: never }
2343
2721
  | { target?: string; field: string; fieldType?: "quantitative"; value?: never }
@@ -2355,7 +2733,7 @@ export class ChartProgram {
2355
2733
  target?: string;
2356
2734
  fieldType?: "quantitative";
2357
2735
  coordinate?: string;
2358
- scale?: ScaleOptions;
2736
+ scale?: NonPointQuantitativePositionScaleOptions;
2359
2737
  }): ChartProgram;
2360
2738
  encodeXRange(options: {
2361
2739
  lower: string;
@@ -2363,7 +2741,7 @@ export class ChartProgram {
2363
2741
  target?: string;
2364
2742
  fieldType?: "quantitative";
2365
2743
  coordinate?: string;
2366
- scale?: ScaleOptions;
2744
+ scale?: NonPointQuantitativePositionScaleOptions;
2367
2745
  }): ChartProgram;
2368
2746
  encodeGroup(options: { field: string; target?: string; fieldType?: "nominal" }): ChartProgram;
2369
2747
  encodePathOrder(options: PathOrderEncodingOptions): ChartProgram;