@khanacademy/perseus 38.0.0 → 38.0.1

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.
@@ -1,4 +1,4 @@
1
- import type { GrapherAnswerTypes, PerseusDefinitionWidgetOptions, PerseusDropdownChoice, PerseusExplanationWidgetOptions, PerseusExpressionAnswerForm, PerseusGradedGroupSetWidgetOptions, PerseusGradedGroupWidgetOptions, PerseusGraphType, PerseusGroupWidgetOptions, PerseusIFrameWidgetOptions, PerseusImageWidgetOptions, PerseusInputNumberWidgetOptions, PerseusInteractionWidgetOptions, PerseusLabelImageWidgetOptions, PerseusMatcherWidgetOptions, PerseusMatrixWidgetOptions, PerseusNumberLineWidgetOptions, PerseusNumericInputWidgetOptions, PerseusOrdererWidgetOptions, PerseusPassageRefWidgetOptions, PerseusPassageWidgetOptions, PerseusPlotterWidgetOptions, PerseusRadioWidgetOptions, PerseusSorterWidgetOptions, PerseusTableWidgetOptions, PerseusVideoWidgetOptions } from "./perseus-types";
1
+ import type { GrapherAnswerTypes, PerseusDefinitionWidgetOptions, PerseusDropdownChoice, PerseusExplanationWidgetOptions, PerseusExpressionAnswerForm, PerseusGradedGroupSetWidgetOptions, PerseusGradedGroupWidgetOptions, PerseusGraphType, PerseusGroupWidgetOptions, PerseusIFrameWidgetOptions, PerseusImageWidgetOptions, PerseusInteractionWidgetOptions, PerseusMatcherWidgetOptions, PerseusMatrixWidgetOptions, PerseusNumberLineWidgetOptions, PerseusNumericInputWidgetOptions, PerseusOrdererWidgetOptions, PerseusPassageRefWidgetOptions, PerseusPassageWidgetOptions, PerseusPlotterWidgetOptions, PerseusRadioWidgetOptions, PerseusSorterWidgetOptions, PerseusTableWidgetOptions, PerseusVideoWidgetOptions } from "./perseus-types";
2
2
  import type { InteractiveMarkerType } from "./widgets/label-image/types";
3
3
  import type { Relationship } from "./widgets/number-line/number-line";
4
4
  export type UserInputStatus = "correct" | "incorrect" | "incomplete";
@@ -39,7 +39,13 @@ export type PerseusIFrameUserInput = {
39
39
  message: string | null;
40
40
  };
41
41
  export type PerseusImageRubric = PerseusImageWidgetOptions;
42
- export type PerseusInputNumberRubric = PerseusInputNumberWidgetOptions;
42
+ export type PerseusInputNumberRubric = {
43
+ answerType?: "number" | "decimal" | "integer" | "rational" | "improper" | "mixed" | "percent" | "pi";
44
+ inexact?: boolean;
45
+ maxError?: number | string;
46
+ simplify: "required" | "optional" | "enforced";
47
+ value: string | number;
48
+ };
43
49
  export type PerseusInputNumberUserInput = {
44
50
  currentValue: string;
45
51
  };
@@ -49,7 +55,7 @@ export type PerseusInteractiveGraphRubric = {
49
55
  graph: PerseusGraphType;
50
56
  };
51
57
  export type PerseusInteractiveGraphUserInput = PerseusGraphType;
52
- export type PerseusLabelImageRubric = PerseusLabelImageWidgetOptions;
58
+ export type PerseusLabelImageRubric = Empty;
53
59
  export type PerseusLabelImageUserInput = {
54
60
  markers: ReadonlyArray<InteractiveMarkerType>;
55
61
  };
@@ -1,5 +1,5 @@
1
1
  import type { PerseusStrings } from "../../strings";
2
- import type { PerseusInputNumberRubric } from "../../validation.types";
2
+ import type { PerseusInputNumberRubric, PerseusInputNumberUserInput } from "../../validation.types";
3
3
  import type { PerseusScore } from "@khanacademy/perseus";
4
4
  export declare const answerTypes: {
5
5
  readonly number: {
@@ -35,7 +35,5 @@ export declare const answerTypes: {
35
35
  readonly forms: "pi";
36
36
  };
37
37
  };
38
- declare function inputNumberValidator(state: {
39
- currentValue: string;
40
- }, rubric: PerseusInputNumberRubric, strings: PerseusStrings): PerseusScore;
38
+ declare function inputNumberValidator(userInput: PerseusInputNumberUserInput, rubric: PerseusInputNumberRubric, strings: PerseusStrings): PerseusScore;
41
39
  export default inputNumberValidator;
@@ -6,5 +6,5 @@ type InteractiveMarkerScore = {
6
6
  isCorrect: boolean;
7
7
  };
8
8
  export declare function scoreMarker(marker: InteractiveMarkerType): InteractiveMarkerScore;
9
- declare function labelImageValidator(state: PerseusLabelImageUserInput, rubric?: PerseusLabelImageRubric): PerseusScore;
9
+ declare function labelImageValidator(userInput: PerseusLabelImageUserInput, rubric?: PerseusLabelImageRubric): PerseusScore;
10
10
  export default labelImageValidator;
@@ -12,7 +12,7 @@ import type { InteractiveMarkerType } from "./types";
12
12
  import type { DependencyProps } from "../../dependencies";
13
13
  import type { ChangeableProps } from "../../mixins/changeable";
14
14
  import type { APIOptions, Widget } from "../../types";
15
- import type { PerseusLabelImageUserInput } from "../../validation.types";
15
+ import type { PerseusLabelImageRubric, PerseusLabelImageUserInput } from "../../validation.types";
16
16
  export type PreferredPopoverDirection = "NONE" | "UP" | "DOWN" | "LEFT" | "RIGHT";
17
17
  /**
18
18
  * Represents a direction vector.
@@ -79,7 +79,7 @@ export declare class LabelImage extends React.Component<LabelImageProps, LabelIm
79
79
  componentDidMount(): void;
80
80
  componentWillUnmount(): void;
81
81
  getUserInput(): PerseusLabelImageUserInput;
82
- showRationalesForCurrentlySelectedChoices(rubric: LabelImageProps): void;
82
+ showRationalesForCurrentlySelectedChoices(rubric: PerseusLabelImageRubric): void;
83
83
  handleMarkerChange(index: number, marker: InteractiveMarkerType): void;
84
84
  activateMarker(index: number, opened: boolean): void;
85
85
  handleMarkerKeyDown(index: number, e: React.KeyboardEvent): void;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Core Perseus API (includes renderers and widgets)",
4
4
  "author": "Khan Academy",
5
5
  "license": "MIT",
6
- "version": "38.0.0",
6
+ "version": "38.0.1",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -40,7 +40,7 @@
40
40
  "test": "bash -c 'yarn --silent --cwd \"../..\" test ${@:0} $($([[ ${@: -1} = -* ]] || [[ ${@: -1} = bash ]]) && echo $PWD)'"
41
41
  },
42
42
  "dependencies": {
43
- "@khanacademy/kas": "^0.3.14",
43
+ "@khanacademy/kas": "^0.3.15",
44
44
  "@khanacademy/keypad-context": "^1.0.3",
45
45
  "@khanacademy/kmath": "^0.1.15",
46
46
  "@khanacademy/math-input": "^21.1.0",