@khanacademy/perseus-core 26.3.1 → 27.0.0

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 (41) hide show
  1. package/dist/data-schema.d.ts +30 -2
  2. package/dist/es/index.item-splitting.js +2 -2
  3. package/dist/es/index.item-splitting.js.map +1 -1
  4. package/dist/es/index.js +6 -6
  5. package/dist/es/index.js.map +1 -1
  6. package/dist/index.item-splitting.js +2 -2
  7. package/dist/index.item-splitting.js.map +1 -1
  8. package/dist/index.js +6 -6
  9. package/dist/index.js.map +1 -1
  10. package/dist/parse-perseus-json/perseus-parsers/interactive-graph-user-input.d.ts +15 -0
  11. package/dist/parse-perseus-json/perseus-parsers/interactive-graph-widget.d.ts +45 -0
  12. package/dist/parse-perseus-json/perseus-parsers/numeric-input-widget.d.ts +0 -1
  13. package/dist/widgets/categorizer/index.d.ts +2 -1
  14. package/dist/widgets/core-widget-registry.d.ts +1 -1
  15. package/dist/widgets/cs-program/index.d.ts +1 -1
  16. package/dist/widgets/dropdown/index.d.ts +2 -1
  17. package/dist/widgets/expression/index.d.ts +2 -1
  18. package/dist/widgets/free-response/free-response-util.d.ts +1 -2
  19. package/dist/widgets/free-response/index.d.ts +2 -1
  20. package/dist/widgets/grapher/index.d.ts +2 -1
  21. package/dist/widgets/group/group-util.d.ts +1 -2
  22. package/dist/widgets/group/index.d.ts +2 -1
  23. package/dist/widgets/iframe/index.d.ts +1 -1
  24. package/dist/widgets/image/index.d.ts +1 -1
  25. package/dist/widgets/input-number/index.d.ts +2 -1
  26. package/dist/widgets/input-number/input-number-util.d.ts +1 -2
  27. package/dist/widgets/interactive-graph/index.d.ts +2 -1
  28. package/dist/widgets/label-image/index.d.ts +2 -1
  29. package/dist/widgets/logic-export.types.d.ts +4 -4
  30. package/dist/widgets/matcher/index.d.ts +2 -1
  31. package/dist/widgets/matrix/index.d.ts +2 -1
  32. package/dist/widgets/number-line/index.d.ts +2 -1
  33. package/dist/widgets/numeric-input/index.d.ts +2 -1
  34. package/dist/widgets/numeric-input/numeric-input-util.d.ts +1 -2
  35. package/dist/widgets/orderer/index.d.ts +2 -1
  36. package/dist/widgets/plotter/index.d.ts +2 -1
  37. package/dist/widgets/radio/index.d.ts +2 -1
  38. package/dist/widgets/sorter/index.d.ts +2 -1
  39. package/dist/widgets/table/index.d.ts +2 -1
  40. package/dist/widgets/table/table-util.d.ts +1 -2
  41. package/package.json +3 -3
@@ -944,6 +944,8 @@ export type PerseusGraphTypeAngle = {
944
944
  * the vertex, while rays BA and BC form the angle.
945
945
  */
946
946
  startCoords?: [Coord, Coord, Coord];
947
+ /** Custom label for each interactive point that will help with the screen reader. */
948
+ pointLabels?: [string, string, string];
947
949
  };
948
950
  export type PerseusGraphTypeCircle = {
949
951
  type: "circle";
@@ -954,6 +956,8 @@ export type PerseusGraphTypeCircle = {
954
956
  center: Coord;
955
957
  radius: number;
956
958
  };
959
+ /** Custom label for each interactive point that will help with the screen reader. */
960
+ pointLabels?: string[];
957
961
  };
958
962
  export type PerseusGraphTypeLinear = {
959
963
  type: "linear";
@@ -961,6 +965,8 @@ export type PerseusGraphTypeLinear = {
961
965
  coords?: CollinearTuple | null;
962
966
  /** The initial coordinates the graph renders with. */
963
967
  startCoords?: CollinearTuple;
968
+ /** Custom label for each interactive point that will help with the screen reader. */
969
+ pointLabels?: [string, string];
964
970
  };
965
971
  export type PerseusGraphTypeLinearSystem = {
966
972
  type: "linear-system";
@@ -968,6 +974,8 @@ export type PerseusGraphTypeLinearSystem = {
968
974
  coords?: CollinearTuple[] | null;
969
975
  /** The initial coordinates the graph renders with. */
970
976
  startCoords?: CollinearTuple[];
977
+ /** Custom label for each interactive point that will help with the screen reader. */
978
+ pointLabels?: string[];
971
979
  };
972
980
  export type PerseusGraphTypeNone = {
973
981
  type: "none";
@@ -984,6 +992,8 @@ export type PerseusGraphTypePoint = {
984
992
  startCoords?: Coord[];
985
993
  /** Used instead of `coords` in some old graphs that have only one point. */
986
994
  coord?: Coord;
995
+ /** Custom label for each interactive point that will help with the screen reader. */
996
+ pointLabels?: string[];
987
997
  };
988
998
  export type PerseusGraphTypePolygon = {
989
999
  type: "polygon";
@@ -1000,6 +1010,8 @@ export type PerseusGraphTypePolygon = {
1000
1010
  coords?: Coord[] | null;
1001
1011
  /** The initial coordinates the graph renders with. */
1002
1012
  startCoords?: Coord[];
1013
+ /** Custom label for each interactive point that will help with the screen reader. */
1014
+ pointLabels?: string[];
1003
1015
  };
1004
1016
  export type PerseusGraphTypeQuadratic = {
1005
1017
  type: "quadratic";
@@ -1007,6 +1019,8 @@ export type PerseusGraphTypeQuadratic = {
1007
1019
  coords?: [Coord, Coord, Coord] | null;
1008
1020
  /** The initial coordinates the graph renders with. */
1009
1021
  startCoords?: [Coord, Coord, Coord];
1022
+ /** Custom label for each interactive point that will help with the screen reader. */
1023
+ pointLabels?: [string, string, string];
1010
1024
  };
1011
1025
  export type PerseusGraphTypeSegment = {
1012
1026
  type: "segment";
@@ -1019,6 +1033,8 @@ export type PerseusGraphTypeSegment = {
1019
1033
  coords?: CollinearTuple[] | null;
1020
1034
  /** The initial coordinates the graph renders with. */
1021
1035
  startCoords?: CollinearTuple[];
1036
+ /** Custom label for each interactive point that will help with the screen reader. */
1037
+ pointLabels?: string[];
1022
1038
  };
1023
1039
  export type PerseusGraphTypeSinusoid = {
1024
1040
  type: "sinusoid";
@@ -1026,11 +1042,15 @@ export type PerseusGraphTypeSinusoid = {
1026
1042
  coords?: Coord[] | null;
1027
1043
  /** The initial coordinates the graph renders with. */
1028
1044
  startCoords?: Coord[];
1045
+ /** Custom label for each interactive point that will help with the screen reader. */
1046
+ pointLabels?: string[];
1029
1047
  };
1030
1048
  export type PerseusGraphTypeTangent = {
1031
1049
  type: "tangent";
1032
1050
  coords?: Coord[] | null;
1033
1051
  startCoords?: Coord[];
1052
+ /** Custom label for each interactive point that will help with the screen reader. */
1053
+ pointLabels?: string[];
1034
1054
  };
1035
1055
  export type PerseusGraphTypeExponential = {
1036
1056
  type: "exponential";
@@ -1046,6 +1066,8 @@ export type PerseusGraphTypeExponential = {
1046
1066
  coords: [Coord, Coord];
1047
1067
  asymptote: number;
1048
1068
  };
1069
+ /** Custom label for each interactive point that will help with the screen reader. */
1070
+ pointLabels?: string[];
1049
1071
  };
1050
1072
  export type PerseusGraphTypeLogarithm = {
1051
1073
  type: "logarithm";
@@ -1061,11 +1083,15 @@ export type PerseusGraphTypeLogarithm = {
1061
1083
  coords: [Coord, Coord];
1062
1084
  asymptote: number;
1063
1085
  };
1086
+ /** Custom label for each interactive point that will help with the screen reader. */
1087
+ pointLabels?: string[];
1064
1088
  };
1065
1089
  export type PerseusGraphTypeAbsoluteValue = {
1066
1090
  type: "absolute-value";
1067
1091
  coords?: [Coord, Coord] | null;
1068
1092
  startCoords?: [Coord, Coord];
1093
+ /** Custom label for each interactive point that will help with the screen reader. */
1094
+ pointLabels?: [string, string];
1069
1095
  };
1070
1096
  export type PerseusGraphTypeRay = {
1071
1097
  type: "ray";
@@ -1073,6 +1099,8 @@ export type PerseusGraphTypeRay = {
1073
1099
  coords?: CollinearTuple | null;
1074
1100
  /** The initial coordinates the graph renders with. */
1075
1101
  startCoords?: CollinearTuple;
1102
+ /** Custom label for each interactive point that will help with the screen reader. */
1103
+ pointLabels?: [string, string];
1076
1104
  };
1077
1105
  export type PerseusGraphTypeVector = {
1078
1106
  type: "vector";
@@ -1084,6 +1112,8 @@ export type PerseusGraphTypeVector = {
1084
1112
  * "exact" (default) — both tail and tip must match exactly.
1085
1113
  * "congruent" — same direction and magnitude, any position. */
1086
1114
  match?: "exact" | "congruent";
1115
+ /** Custom label for each interactive point that will help with the screen reader. */
1116
+ pointLabels?: [string, string];
1087
1117
  };
1088
1118
  type AbsoluteValueGraphCorrect = {
1089
1119
  type: "absolute-value";
@@ -1317,8 +1347,6 @@ export type PerseusNumericInputWidgetOptions = {
1317
1347
  coefficient: boolean;
1318
1348
  /** Whether to right-align the text or not */
1319
1349
  rightAlign?: boolean;
1320
- /** Always false. Not used for this widget */
1321
- static: boolean;
1322
1350
  };
1323
1351
  export type PerseusNumericInputAnswer = {
1324
1352
  /**
@@ -100,7 +100,7 @@ const pairOfNumbers$1=pair(number,number);const stringOrEmpty=defaulted(string,(
100
100
 
101
101
  const lockedFigureColorNames=["blue","gold","green","grayH","purple","pink","red"];const plotterPlotTypes=["bar","line","pic","histogram","dotplot"];
102
102
 
103
- const pairOfNumbers=pair(number,number);const parsePerseusGraphTypeAngle=object({type:constant("angle"),showAngles:optional(boolean),allowReflexAngles:optional(boolean),angleOffsetDeg:optional(nullable(number)),snapDegrees:optional(number),match:optional(constant("congruent")),coords:optional(trio(pairOfNumbers,pairOfNumbers,pairOfNumbers)),startCoords:optional(trio(pairOfNumbers,pairOfNumbers,pairOfNumbers))});const parsePerseusGraphTypeCircle=object({type:constant("circle"),center:optional(pairOfNumbers),radius:optional(number),startCoords:optional(object({center:pairOfNumbers,radius:number}))});const parsePerseusGraphTypeLinear=object({type:constant("linear"),coords:optional(nullable(pair(pairOfNumbers,pairOfNumbers))),startCoords:optional(pair(pairOfNumbers,pairOfNumbers))});const parsePerseusGraphTypeLinearSystem=object({type:constant("linear-system"),coords:optional(nullable(array(pair(pairOfNumbers,pairOfNumbers)))),startCoords:optional(array(pair(pairOfNumbers,pairOfNumbers)))});const parsePerseusGraphTypeNone=object({type:constant("none")});const parsePerseusGraphTypePoint=object({type:constant("point"),numPoints:optional(union(number).or(constant("unlimited")).parser),coords:optional(nullable(array(pairOfNumbers))),startCoords:optional(array(pairOfNumbers)),coord:optional(pairOfNumbers)});const parsePerseusGraphTypePolygon=object({type:constant("polygon"),numSides:optional(union(number).or(constant("unlimited")).parser),showAngles:optional(boolean),showSides:optional(boolean),snapTo:optional(enumeration("grid","angles","sides")),match:optional(enumeration("similar","congruent","approx","exact")),startCoords:optional(array(pairOfNumbers)),coords:optional(nullable(array(pairOfNumbers)))});const parsePerseusGraphTypeQuadratic=object({type:constant("quadratic"),coords:optional(nullable(trio(pairOfNumbers,pairOfNumbers,pairOfNumbers))),startCoords:optional(trio(pairOfNumbers,pairOfNumbers,pairOfNumbers))});const parsePerseusGraphTypeRay=object({type:constant("ray"),coords:optional(nullable(pair(pairOfNumbers,pairOfNumbers))),startCoords:optional(pair(pairOfNumbers,pairOfNumbers))});const parsePerseusGraphTypeSegment=object({type:constant("segment"),numSegments:optional(number),coords:optional(nullable(array(pair(pairOfNumbers,pairOfNumbers)))),startCoords:optional(array(pair(pairOfNumbers,pairOfNumbers)))});const parsePerseusGraphTypeSinusoid=object({type:constant("sinusoid"),coords:optional(nullable(array(pairOfNumbers))),startCoords:optional(array(pairOfNumbers))});const parsePerseusGraphTypeExponential=object({type:constant("exponential"),coords:optional(nullable(array(pairOfNumbers))),asymptote:optional(nullable(number)),startCoords:optional(object({coords:pair(pairOfNumbers,pairOfNumbers),asymptote:number}))});const parsePerseusGraphTypeAbsoluteValue=object({type:constant("absolute-value"),coords:optional(nullable(pair(pairOfNumbers,pairOfNumbers))),startCoords:optional(pair(pairOfNumbers,pairOfNumbers))});const parsePerseusGraphTypeTangent=object({type:constant("tangent"),coords:optional(nullable(array(pairOfNumbers))),startCoords:optional(array(pairOfNumbers))});const parsePerseusGraphTypeLogarithm=object({type:constant("logarithm"),coords:optional(nullable(array(pairOfNumbers))),asymptote:optional(nullable(number)),startCoords:optional(object({coords:pair(pairOfNumbers,pairOfNumbers),asymptote:number}))});const parsePerseusGraphTypeVector=object({type:constant("vector"),coords:optional(nullable(pair(pairOfNumbers,pairOfNumbers))),startCoords:optional(pair(pairOfNumbers,pairOfNumbers)),match:optional(enumeration("exact","congruent"))});const parsePerseusGraphType=discriminatedUnionOn("type").withBranch("absolute-value",parsePerseusGraphTypeAbsoluteValue).withBranch("angle",parsePerseusGraphTypeAngle).withBranch("circle",parsePerseusGraphTypeCircle).withBranch("exponential",parsePerseusGraphTypeExponential).withBranch("linear",parsePerseusGraphTypeLinear).withBranch("linear-system",parsePerseusGraphTypeLinearSystem).withBranch("none",parsePerseusGraphTypeNone).withBranch("point",parsePerseusGraphTypePoint).withBranch("polygon",parsePerseusGraphTypePolygon).withBranch("quadratic",parsePerseusGraphTypeQuadratic).withBranch("ray",parsePerseusGraphTypeRay).withBranch("segment",parsePerseusGraphTypeSegment).withBranch("sinusoid",parsePerseusGraphTypeSinusoid).withBranch("tangent",parsePerseusGraphTypeTangent).withBranch("logarithm",parsePerseusGraphTypeLogarithm).withBranch("vector",parsePerseusGraphTypeVector).parser;const parseLockedFigureColor=enumeration(...lockedFigureColorNames);const parseLockedFigureFillType=enumeration("none","white","translucent","solid");const parseLockedLineStyle=enumeration("solid","dashed");const parseStrokeWeight=defaulted(enumeration("medium","thin","thick"),()=>"medium");const parseLockedLabelType=object({type:constant("label"),coord:pairOfNumbers,text:string,color:parseLockedFigureColor,size:enumeration("small","medium","large")});const parseLockedPointType=object({type:constant("point"),coord:pairOfNumbers,color:parseLockedFigureColor,filled:boolean,labels:defaulted(array(parseLockedLabelType),()=>[]),ariaLabel:optional(string)});const parseLockedLineType=object({type:constant("line"),kind:enumeration("line","ray","segment"),points:pair(parseLockedPointType,parseLockedPointType),color:parseLockedFigureColor,lineStyle:parseLockedLineStyle,showPoint1:defaulted(boolean,()=>false),showPoint2:defaulted(boolean,()=>false),weight:parseStrokeWeight,labels:defaulted(array(parseLockedLabelType),()=>[]),ariaLabel:optional(string)});const parseLockedVectorType=object({type:constant("vector"),points:pair(pairOfNumbers,pairOfNumbers),color:parseLockedFigureColor,weight:parseStrokeWeight,labels:defaulted(array(parseLockedLabelType),()=>[]),ariaLabel:optional(string)});const parseLockedEllipseType=object({type:constant("ellipse"),center:pairOfNumbers,radius:pairOfNumbers,angle:number,color:parseLockedFigureColor,fillStyle:parseLockedFigureFillType,strokeStyle:parseLockedLineStyle,weight:parseStrokeWeight,labels:defaulted(array(parseLockedLabelType),()=>[]),ariaLabel:optional(string)});const parseLockedPolygonType=object({type:constant("polygon"),points:array(pairOfNumbers),color:parseLockedFigureColor,showVertices:boolean,fillStyle:parseLockedFigureFillType,strokeStyle:parseLockedLineStyle,weight:parseStrokeWeight,labels:defaulted(array(parseLockedLabelType),()=>[]),ariaLabel:optional(string)});const numberOrNegativeInfinity=union(number).or(constant(-Infinity)).parser;const numberOrPositiveInfinity=union(number).or(constant(Infinity)).parser;const parseLockedFunctionDomain=defaulted(pair(defaulted(numberOrNegativeInfinity,()=>-Infinity),defaulted(numberOrPositiveInfinity,()=>Infinity)),()=>[-Infinity,Infinity]);const parseLockedFunctionType=object({type:constant("function"),color:parseLockedFigureColor,strokeStyle:parseLockedLineStyle,weight:parseStrokeWeight,equation:string,directionalAxis:enumeration("x","y"),domain:parseLockedFunctionDomain,labels:defaulted(array(parseLockedLabelType),()=>[]),ariaLabel:optional(string)});const parseLockedFigure=discriminatedUnionOn("type").withBranch("point",parseLockedPointType).withBranch("line",parseLockedLineType).withBranch("vector",parseLockedVectorType).withBranch("ellipse",parseLockedEllipseType).withBranch("polygon",parseLockedPolygonType).withBranch("function",parseLockedFunctionType).withBranch("label",parseLockedLabelType).parser;const parseLabelLocation=union(enumeration("onAxis","alongEdge")).or(pipeParsers(constant("")).then(convert(()=>"onAxis")).parser).parser;const parseInteractiveGraphWidget=parseWidget(constant("interactive-graph"),object({step:pairOfNumbers,gridStep:optional(pairOfNumbers),snapStep:optional(pairOfNumbers),backgroundImage:optional(parsePerseusImageBackground),markings:enumeration("graph","grid","none","axes"),labels:optional(array(string)),labelLocation:optional(parseLabelLocation),showProtractor:boolean,showRuler:optional(boolean),showTooltips:optional(boolean),rulerLabel:optional(string),rulerTicks:optional(number),range:pair(pairOfNumbers,pairOfNumbers),showAxisArrows:defaulted(object({xMin:boolean,xMax:boolean,yMin:boolean,yMax:boolean}),()=>({xMin:true,xMax:true,yMin:true,yMax:true})),showAxisTicks:defaulted(object({x:boolean,y:boolean}),()=>({x:true,y:true})),graph:defaulted(parsePerseusGraphType,()=>({type:"linear"})),correct:defaulted(parsePerseusGraphType,()=>({type:"linear"})),lockedFigures:defaulted(array(parseLockedFigure),()=>[]),fullGraphAriaLabel:optional(string),fullGraphAriaDescription:optional(string)}));
103
+ const pairOfNumbers=pair(number,number);const parsePerseusGraphTypeAngle=object({type:constant("angle"),showAngles:optional(boolean),allowReflexAngles:optional(boolean),angleOffsetDeg:optional(nullable(number)),snapDegrees:optional(number),match:optional(constant("congruent")),coords:optional(trio(pairOfNumbers,pairOfNumbers,pairOfNumbers)),startCoords:optional(trio(pairOfNumbers,pairOfNumbers,pairOfNumbers)),pointLabels:optional(trio(string,string,string))});const parsePerseusGraphTypeCircle=object({type:constant("circle"),center:optional(pairOfNumbers),radius:optional(number),startCoords:optional(object({center:pairOfNumbers,radius:number})),pointLabels:optional(array(string))});const parsePerseusGraphTypeLinear=object({type:constant("linear"),coords:optional(nullable(pair(pairOfNumbers,pairOfNumbers))),startCoords:optional(pair(pairOfNumbers,pairOfNumbers)),pointLabels:optional(pair(string,string))});const parsePerseusGraphTypeLinearSystem=object({type:constant("linear-system"),coords:optional(nullable(array(pair(pairOfNumbers,pairOfNumbers)))),startCoords:optional(array(pair(pairOfNumbers,pairOfNumbers))),pointLabels:optional(array(string))});const parsePerseusGraphTypeNone=object({type:constant("none")});const parsePerseusGraphTypePoint=object({type:constant("point"),numPoints:optional(union(number).or(constant("unlimited")).parser),coords:optional(nullable(array(pairOfNumbers))),startCoords:optional(array(pairOfNumbers)),coord:optional(pairOfNumbers),pointLabels:optional(array(string))});const parsePerseusGraphTypePolygon=object({type:constant("polygon"),numSides:optional(union(number).or(constant("unlimited")).parser),showAngles:optional(boolean),showSides:optional(boolean),snapTo:optional(enumeration("grid","angles","sides")),match:optional(enumeration("similar","congruent","approx","exact")),startCoords:optional(array(pairOfNumbers)),coords:optional(nullable(array(pairOfNumbers))),pointLabels:optional(array(string))});const parsePerseusGraphTypeQuadratic=object({type:constant("quadratic"),coords:optional(nullable(trio(pairOfNumbers,pairOfNumbers,pairOfNumbers))),startCoords:optional(trio(pairOfNumbers,pairOfNumbers,pairOfNumbers)),pointLabels:optional(trio(string,string,string))});const parsePerseusGraphTypeRay=object({type:constant("ray"),coords:optional(nullable(pair(pairOfNumbers,pairOfNumbers))),startCoords:optional(pair(pairOfNumbers,pairOfNumbers)),pointLabels:optional(pair(string,string))});const parsePerseusGraphTypeSegment=object({type:constant("segment"),numSegments:optional(number),coords:optional(nullable(array(pair(pairOfNumbers,pairOfNumbers)))),startCoords:optional(array(pair(pairOfNumbers,pairOfNumbers))),pointLabels:optional(array(string))});const parsePerseusGraphTypeSinusoid=object({type:constant("sinusoid"),coords:optional(nullable(array(pairOfNumbers))),startCoords:optional(array(pairOfNumbers)),pointLabels:optional(array(string))});const parsePerseusGraphTypeExponential=object({type:constant("exponential"),coords:optional(nullable(array(pairOfNumbers))),asymptote:optional(nullable(number)),startCoords:optional(object({coords:pair(pairOfNumbers,pairOfNumbers),asymptote:number})),pointLabels:optional(array(string))});const parsePerseusGraphTypeAbsoluteValue=object({type:constant("absolute-value"),coords:optional(nullable(pair(pairOfNumbers,pairOfNumbers))),startCoords:optional(pair(pairOfNumbers,pairOfNumbers)),pointLabels:optional(pair(string,string))});const parsePerseusGraphTypeTangent=object({type:constant("tangent"),coords:optional(nullable(array(pairOfNumbers))),startCoords:optional(array(pairOfNumbers)),pointLabels:optional(array(string))});const parsePerseusGraphTypeLogarithm=object({type:constant("logarithm"),coords:optional(nullable(array(pairOfNumbers))),asymptote:optional(nullable(number)),startCoords:optional(object({coords:pair(pairOfNumbers,pairOfNumbers),asymptote:number})),pointLabels:optional(array(string))});const parsePerseusGraphTypeVector=object({type:constant("vector"),coords:optional(nullable(pair(pairOfNumbers,pairOfNumbers))),startCoords:optional(pair(pairOfNumbers,pairOfNumbers)),match:optional(enumeration("exact","congruent")),pointLabels:optional(pair(string,string))});const parsePerseusGraphType=discriminatedUnionOn("type").withBranch("absolute-value",parsePerseusGraphTypeAbsoluteValue).withBranch("angle",parsePerseusGraphTypeAngle).withBranch("circle",parsePerseusGraphTypeCircle).withBranch("exponential",parsePerseusGraphTypeExponential).withBranch("linear",parsePerseusGraphTypeLinear).withBranch("linear-system",parsePerseusGraphTypeLinearSystem).withBranch("none",parsePerseusGraphTypeNone).withBranch("point",parsePerseusGraphTypePoint).withBranch("polygon",parsePerseusGraphTypePolygon).withBranch("quadratic",parsePerseusGraphTypeQuadratic).withBranch("ray",parsePerseusGraphTypeRay).withBranch("segment",parsePerseusGraphTypeSegment).withBranch("sinusoid",parsePerseusGraphTypeSinusoid).withBranch("tangent",parsePerseusGraphTypeTangent).withBranch("logarithm",parsePerseusGraphTypeLogarithm).withBranch("vector",parsePerseusGraphTypeVector).parser;const parseLockedFigureColor=enumeration(...lockedFigureColorNames);const parseLockedFigureFillType=enumeration("none","white","translucent","solid");const parseLockedLineStyle=enumeration("solid","dashed");const parseStrokeWeight=defaulted(enumeration("medium","thin","thick"),()=>"medium");const parseLockedLabelType=object({type:constant("label"),coord:pairOfNumbers,text:string,color:parseLockedFigureColor,size:enumeration("small","medium","large")});const parseLockedPointType=object({type:constant("point"),coord:pairOfNumbers,color:parseLockedFigureColor,filled:boolean,labels:defaulted(array(parseLockedLabelType),()=>[]),ariaLabel:optional(string)});const parseLockedLineType=object({type:constant("line"),kind:enumeration("line","ray","segment"),points:pair(parseLockedPointType,parseLockedPointType),color:parseLockedFigureColor,lineStyle:parseLockedLineStyle,showPoint1:defaulted(boolean,()=>false),showPoint2:defaulted(boolean,()=>false),weight:parseStrokeWeight,labels:defaulted(array(parseLockedLabelType),()=>[]),ariaLabel:optional(string)});const parseLockedVectorType=object({type:constant("vector"),points:pair(pairOfNumbers,pairOfNumbers),color:parseLockedFigureColor,weight:parseStrokeWeight,labels:defaulted(array(parseLockedLabelType),()=>[]),ariaLabel:optional(string)});const parseLockedEllipseType=object({type:constant("ellipse"),center:pairOfNumbers,radius:pairOfNumbers,angle:number,color:parseLockedFigureColor,fillStyle:parseLockedFigureFillType,strokeStyle:parseLockedLineStyle,weight:parseStrokeWeight,labels:defaulted(array(parseLockedLabelType),()=>[]),ariaLabel:optional(string)});const parseLockedPolygonType=object({type:constant("polygon"),points:array(pairOfNumbers),color:parseLockedFigureColor,showVertices:boolean,fillStyle:parseLockedFigureFillType,strokeStyle:parseLockedLineStyle,weight:parseStrokeWeight,labels:defaulted(array(parseLockedLabelType),()=>[]),ariaLabel:optional(string)});const numberOrNegativeInfinity=union(number).or(constant(-Infinity)).parser;const numberOrPositiveInfinity=union(number).or(constant(Infinity)).parser;const parseLockedFunctionDomain=defaulted(pair(defaulted(numberOrNegativeInfinity,()=>-Infinity),defaulted(numberOrPositiveInfinity,()=>Infinity)),()=>[-Infinity,Infinity]);const parseLockedFunctionType=object({type:constant("function"),color:parseLockedFigureColor,strokeStyle:parseLockedLineStyle,weight:parseStrokeWeight,equation:string,directionalAxis:enumeration("x","y"),domain:parseLockedFunctionDomain,labels:defaulted(array(parseLockedLabelType),()=>[]),ariaLabel:optional(string)});const parseLockedFigure=discriminatedUnionOn("type").withBranch("point",parseLockedPointType).withBranch("line",parseLockedLineType).withBranch("vector",parseLockedVectorType).withBranch("ellipse",parseLockedEllipseType).withBranch("polygon",parseLockedPolygonType).withBranch("function",parseLockedFunctionType).withBranch("label",parseLockedLabelType).parser;const parseLabelLocation=union(enumeration("onAxis","alongEdge")).or(pipeParsers(constant("")).then(convert(()=>"onAxis")).parser).parser;const parseInteractiveGraphWidget=parseWidget(constant("interactive-graph"),object({step:pairOfNumbers,gridStep:optional(pairOfNumbers),snapStep:optional(pairOfNumbers),backgroundImage:optional(parsePerseusImageBackground),markings:enumeration("graph","grid","none","axes"),labels:optional(array(string)),labelLocation:optional(parseLabelLocation),showProtractor:boolean,showRuler:optional(boolean),showTooltips:optional(boolean),rulerLabel:optional(string),rulerTicks:optional(number),range:pair(pairOfNumbers,pairOfNumbers),showAxisArrows:defaulted(object({xMin:boolean,xMax:boolean,yMin:boolean,yMax:boolean}),()=>({xMin:true,xMax:true,yMin:true,yMax:true})),showAxisTicks:defaulted(object({x:boolean,y:boolean}),()=>({x:true,y:true})),graph:defaulted(parsePerseusGraphType,()=>({type:"linear"})),correct:defaulted(parsePerseusGraphType,()=>({type:"linear"})),lockedFigures:defaulted(array(parseLockedFigure),()=>[]),fullGraphAriaLabel:optional(string),fullGraphAriaDescription:optional(string)}));
104
104
 
105
105
  const parseLabelImageWidget=parseWidget(constant("label-image"),object({choices:array(string),imageUrl:string,imageAlt:string,imageHeight:number,imageWidth:number,markers:array(object({answers:defaulted(array(string),()=>[]),label:string,x:number,y:number})),hideChoicesFromInstructions:boolean,multipleAnswers:boolean,static:defaulted(boolean,()=>false)}));
106
106
 
@@ -114,7 +114,7 @@ const parseMoleculeRendererWidget=parseWidget(constant("molecule-renderer"),obje
114
114
 
115
115
  const emptyStringToNull=pipeParsers(constant("")).then(convert(()=>null)).parser;const parseNumberLineWidget=parseWidget(constant("number-line"),object({range:array(number),labelRange:array(nullable(union(number).or(emptyStringToNull).parser)),labelStyle:string,labelTicks:boolean,isTickCtrl:defaulted(boolean,()=>false),isInequality:defaulted(boolean,()=>false),divisionRange:array(number),numDivisions:optional(nullable(number)),snapDivisions:defaulted(number,()=>2),tickStep:optional(nullable(number)),correctRel:defaulted(optional(enumeration("eq","lt","gt","le","ge")),()=>undefined),correctX:defaulted(nullable(number),()=>null),initialX:optional(nullable(number)),showTooltips:optional(boolean),static:defaulted(boolean,()=>false)}));
116
116
 
117
- const parseMathFormat=enumeration("integer","mixed","improper","proper","decimal","percent","pi");const parseSimplify=pipeParsers(union(constant(null)).or(constant(undefined)).or(boolean).or(constant("true")).or(constant("required")).or(constant("correct")).or(constant("enforced")).or(constant("optional")).or(constant("accepted")).parser).then(convert(deprecatedSimplifyValuesToRequired)).parser;function deprecatedSimplifyValuesToRequired(simplify){switch(simplify){case "enforced":case "required":case "optional":return simplify;default:return "required"}}const parseNumericInputWidget=parseWidget(constant("numeric-input"),object({answers:array(object({message:defaulted(string,()=>""),value:optional(nullable(number)),status:string,answerForms:defaulted(optional(array(parseMathFormat)),()=>undefined),strict:defaulted(boolean,()=>false),maxError:optional(nullable(number)),simplify:parseSimplify})),labelText:optional(string),size:string,coefficient:defaulted(boolean,()=>false),rightAlign:optional(boolean),static:defaulted(boolean,()=>false)}));
117
+ const parseMathFormat=enumeration("integer","mixed","improper","proper","decimal","percent","pi");const parseSimplify=pipeParsers(union(constant(null)).or(constant(undefined)).or(boolean).or(constant("true")).or(constant("required")).or(constant("correct")).or(constant("enforced")).or(constant("optional")).or(constant("accepted")).parser).then(convert(deprecatedSimplifyValuesToRequired)).parser;function deprecatedSimplifyValuesToRequired(simplify){switch(simplify){case "enforced":case "required":case "optional":return simplify;default:return "required"}}const parseNumericInputWidget=parseWidget(constant("numeric-input"),object({answers:array(object({message:defaulted(string,()=>""),value:optional(nullable(number)),status:string,answerForms:defaulted(optional(array(parseMathFormat)),()=>undefined),strict:defaulted(boolean,()=>false),maxError:optional(nullable(number)),simplify:parseSimplify})),labelText:optional(string),size:string,coefficient:defaulted(boolean,()=>false),rightAlign:optional(boolean)}));
118
118
 
119
119
  function parseRenderer(rawValue,ctx){return parsePerseusRenderer(rawValue,ctx)}const largeToAuto=(height,ctx)=>{if(height==="large"){return ctx.success("auto")}return ctx.success(height)};const parseOrdererWidget=parseWidget(constant("orderer"),object({options:defaulted(array(parseRenderer),()=>[]),correctOptions:defaulted(array(parseRenderer),()=>[]),otherOptions:defaulted(array(parseRenderer),()=>[]),height:pipeParsers(enumeration("normal","auto","large")).then(largeToAuto).parser,layout:defaulted(enumeration("horizontal","vertical"),()=>"horizontal")}));
120
120