@khanacademy/perseus-core 28.3.0 → 30.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.
@@ -1,8 +1,8 @@
1
1
  export declare const parseExpressionWidget: import("../parser-types").Parser<import("../..").WidgetOptions<"expression", import("../general-purpose-parsers/object-types").OptionalizeProperties<{
2
2
  answerForms: {
3
3
  value: string;
4
- simplify: boolean;
5
4
  form: boolean;
5
+ simplify: boolean;
6
6
  considered: "correct" | "wrong" | "ungraded";
7
7
  key?: string | undefined;
8
8
  }[];
@@ -1,5 +1,6 @@
1
- import type { Parser } from "../parser-types";
2
- export declare const parseInputNumberWidget: Parser<import("../..").WidgetOptions<"input-number", import("../general-purpose-parsers/object-types").OptionalizeProperties<{
1
+ import type { ParsedValue, Parser } from "../parser-types";
2
+ export type PerseusInputNumberWidgetOptionsV0 = ParsedValue<typeof parseInputNumberWidgetV0>["options"];
3
+ declare const parseInputNumberWidgetV0: Parser<import("../..").WidgetOptions<"input-number", import("../general-purpose-parsers/object-types").OptionalizeProperties<{
3
4
  answerType: "number" | "integer" | "mixed" | "improper" | "decimal" | "percent" | "pi" | "rational" | undefined;
4
5
  inexact: boolean | undefined;
5
6
  maxError: string | number | undefined;
@@ -8,3 +9,19 @@ export declare const parseInputNumberWidget: Parser<import("../..").WidgetOption
8
9
  size: "small" | "normal";
9
10
  value: string | number;
10
11
  }>>>;
12
+ export declare const parseInputNumberWidget: Parser<import("../..").WidgetOptions<"input-number", import("../general-purpose-parsers/object-types").OptionalizeProperties<{
13
+ size: string;
14
+ coefficient: boolean;
15
+ labelText: string | undefined;
16
+ textAlign: "left" | "right" | "center";
17
+ answers: import("../general-purpose-parsers/object-types").OptionalizeProperties<{
18
+ value: number | null | undefined;
19
+ status: string;
20
+ message: string;
21
+ answerForms: ("integer" | "mixed" | "improper" | "proper" | "decimal" | "percent" | "pi")[] | undefined;
22
+ strict: boolean;
23
+ maxError: number | null | undefined;
24
+ simplify: "required" | "enforced" | "optional";
25
+ }>[];
26
+ }>>>;
27
+ export {};
@@ -12,5 +12,5 @@ export declare const parseNumericInputWidget: import("../parser-types").Parser<i
12
12
  labelText: string | undefined;
13
13
  size: string;
14
14
  coefficient: boolean;
15
- rightAlign: boolean | undefined;
15
+ textAlign: "left" | "right" | "center";
16
16
  }>>>;
@@ -0,0 +1,41 @@
1
+ declare const _default: {
2
+ answerArea: {
3
+ calculator: boolean;
4
+ };
5
+ hints: {
6
+ content: string;
7
+ }[];
8
+ itemDataVersion: {
9
+ major: number;
10
+ minor: number;
11
+ };
12
+ question: {
13
+ content: string;
14
+ widgets: {
15
+ "numeric-input 1": {
16
+ alignment: string;
17
+ graded: boolean;
18
+ options: {
19
+ answers: {
20
+ maxError: number;
21
+ message: string;
22
+ simplify: boolean;
23
+ status: string;
24
+ strict: boolean;
25
+ value: number;
26
+ }[];
27
+ coefficient: boolean;
28
+ labelText: string;
29
+ size: string;
30
+ textAlign: string;
31
+ };
32
+ type: string;
33
+ version: {
34
+ major: number;
35
+ minor: number;
36
+ };
37
+ };
38
+ };
39
+ };
40
+ };
41
+ export default _default;
@@ -0,0 +1,41 @@
1
+ declare const _default: {
2
+ answerArea: {
3
+ calculator: boolean;
4
+ };
5
+ hints: {
6
+ content: string;
7
+ }[];
8
+ itemDataVersion: {
9
+ major: number;
10
+ minor: number;
11
+ };
12
+ question: {
13
+ content: string;
14
+ widgets: {
15
+ "numeric-input 1": {
16
+ alignment: string;
17
+ graded: boolean;
18
+ options: {
19
+ answers: {
20
+ maxError: number;
21
+ message: string;
22
+ simplify: boolean;
23
+ status: string;
24
+ strict: boolean;
25
+ value: number;
26
+ }[];
27
+ coefficient: boolean;
28
+ labelText: string;
29
+ size: string;
30
+ rightAlign: boolean;
31
+ };
32
+ type: string;
33
+ version: {
34
+ major: number;
35
+ minor: number;
36
+ };
37
+ };
38
+ };
39
+ };
40
+ };
41
+ export default _default;
@@ -1,3 +1,4 @@
1
- import type { InputNumberWidget, PerseusInputNumberWidgetOptions } from "../../data-schema";
2
- export declare function generateInputNumberWidget(inputNumberWidgetProperties?: Partial<Omit<InputNumberWidget, "type">>): InputNumberWidget;
1
+ import type { InputNumberWidget, PerseusInputNumberWidgetOptions, PerseusInputNumberAnswer } from "../../data-schema";
2
+ export declare function generateInputNumberWidget(inputNumberWidgetProperties?: Partial<Omit<InputNumberWidget, "type" | "version">>): InputNumberWidget;
3
3
  export declare function generateInputNumberOptions(options?: Partial<PerseusInputNumberWidgetOptions>): PerseusInputNumberWidgetOptions;
4
+ export declare function generateInputNumberAnswer(params?: Partial<PerseusInputNumberAnswer>): PerseusInputNumberAnswer;
@@ -28,7 +28,7 @@
28
28
  * } & Perseus<Widget>ValidationData;
29
29
  * ```
30
30
  */
31
- import type { GrapherAnswerTypes, PerseusDropdownChoice, PerseusExpressionAnswerForm, PerseusGradedGroupSetWidgetOptions, PerseusGradedGroupWidgetOptions, PerseusGraphType, PerseusGroupWidgetOptions, PerseusMatrixWidgetAnswers, PerseusNumericInputAnswer, PerseusOrdererWidgetOptions, PerseusRadioChoice, PerseusGraphCorrectType, MakeWidgetMap, PerseusFreeResponseWidgetScoringCriterion, PerseusRenderer, PerseusInputNumberWidgetOptions } from "./data-schema";
31
+ import type { GrapherAnswerTypes, PerseusDropdownChoice, PerseusExpressionAnswerForm, PerseusGradedGroupSetWidgetOptions, PerseusGradedGroupWidgetOptions, PerseusGraphType, PerseusGroupWidgetOptions, PerseusMatrixWidgetAnswers, PerseusNumericInputAnswer, PerseusOrdererWidgetOptions, PerseusRadioChoice, PerseusGraphCorrectType, MakeWidgetMap, PerseusFreeResponseWidgetScoringCriterion, PerseusRenderer } from "./data-schema";
32
32
  import type { ErrorCode } from "./error-codes";
33
33
  import type { Relationship } from "./types";
34
34
  /**
@@ -480,7 +480,7 @@ export interface RubricRegistry {
480
480
  "graded-group": PerseusGradedGroupRubric;
481
481
  grapher: PerseusGrapherRubric;
482
482
  group: PerseusGroupRubric;
483
- "input-number": PerseusInputNumberWidgetOptions;
483
+ "input-number": PerseusNumericInputRubric;
484
484
  "interactive-graph": PerseusInteractiveGraphRubric;
485
485
  "label-image": PerseusLabelImageRubric;
486
486
  matcher: PerseusMatcherRubric;
@@ -1,6 +1,6 @@
1
1
  import type { InputNumberPublicWidgetOptions } from "./input-number-util";
2
2
  import type { PerseusInputNumberWidgetOptions } from "../../data-schema";
3
3
  import type { WidgetLogic } from "../logic-export.types";
4
- export type InputNumberDefaultWidgetOptions = Pick<PerseusInputNumberWidgetOptions, "value" | "simplify" | "size" | "inexact" | "maxError" | "answerType" | "rightAlign">;
4
+ export type InputNumberDefaultWidgetOptions = PerseusInputNumberWidgetOptions;
5
5
  declare const inputNumberWidgetLogic: WidgetLogic<PerseusInputNumberWidgetOptions, InputNumberPublicWidgetOptions>;
6
6
  export default inputNumberWidgetLogic;
@@ -1,11 +1,12 @@
1
- import type { PerseusInputNumberWidgetOptions } from "../../data-schema";
1
+ import { getNumericInputPublicWidgetOptions } from "../numeric-input/numeric-input-util";
2
+ import type { NumericInputPublicWidgetOptions } from "../numeric-input/numeric-input-util";
2
3
  /**
3
4
  * For details on the individual options, see the
4
5
  * PerseusInputNumberWidgetOptions type
5
6
  */
6
- export type InputNumberPublicWidgetOptions = Pick<PerseusInputNumberWidgetOptions, "answerType" | "inexact" | "maxError" | "rightAlign" | "simplify" | "size">;
7
+ export type InputNumberPublicWidgetOptions = NumericInputPublicWidgetOptions;
7
8
  /**
8
9
  * Given a PerseusInputNumberWidgetOptions object, return a new object with only
9
10
  * the public options that should be exposed to the client.
10
11
  */
11
- export declare function getInputNumberPublicWidgetOptions(options: PerseusInputNumberWidgetOptions): InputNumberPublicWidgetOptions;
12
+ export declare const getInputNumberPublicWidgetOptions: typeof getNumericInputPublicWidgetOptions;
@@ -1,6 +1,6 @@
1
1
  import type { NumericInputPublicWidgetOptions } from "./numeric-input-util";
2
2
  import type { PerseusNumericInputWidgetOptions } from "../../data-schema";
3
3
  import type { WidgetLogic } from "../logic-export.types";
4
- export type NumericInputDefaultWidgetOptions = Pick<PerseusNumericInputWidgetOptions, "answers" | "size" | "coefficient" | "labelText" | "rightAlign">;
4
+ export type NumericInputDefaultWidgetOptions = Pick<PerseusNumericInputWidgetOptions, "answers" | "size" | "coefficient" | "labelText" | "textAlign">;
5
5
  declare const numericInputWidgetLogic: WidgetLogic<PerseusNumericInputWidgetOptions, NumericInputPublicWidgetOptions>;
6
6
  export default numericInputWidgetLogic;
@@ -1,19 +1,11 @@
1
- import type { PerseusNumericInputAnswer, PerseusNumericInputWidgetOptions } from "../../data-schema";
2
- type NumericInputAnswerPublicData = Pick<PerseusNumericInputAnswer, "answerForms" | "simplify" | "status">;
1
+ import type { PerseusNumericInputWidgetOptions } from "../../data-schema";
3
2
  /**
4
3
  * For details on the individual options, see the
5
4
  * PerseusNumericInputWidgetOptions type
6
5
  */
7
- export type NumericInputPublicWidgetOptions = {
8
- labelText?: PerseusNumericInputWidgetOptions["labelText"];
9
- size: PerseusNumericInputWidgetOptions["size"];
10
- coefficient: PerseusNumericInputWidgetOptions["coefficient"];
11
- rightAlign?: PerseusNumericInputWidgetOptions["rightAlign"];
12
- answers: ReadonlyArray<NumericInputAnswerPublicData>;
13
- };
6
+ export type NumericInputPublicWidgetOptions = PerseusNumericInputWidgetOptions;
14
7
  /**
15
8
  * Given a PerseusNumericInputWidgetOptions object, return a new object with only
16
9
  * the public options that should be exposed to the client.
17
10
  */
18
11
  export declare function getNumericInputPublicWidgetOptions(options: PerseusNumericInputWidgetOptions): NumericInputPublicWidgetOptions;
19
- export {};
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Shared Perseus infrastructure",
4
4
  "author": "Khan Academy",
5
5
  "license": "MIT",
6
- "version": "28.3.0",
6
+ "version": "30.0.0",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -38,8 +38,8 @@
38
38
  "dependencies": {
39
39
  "tiny-invariant": "1.3.1",
40
40
  "@khanacademy/kas": "2.2.3",
41
- "@khanacademy/pure-markdown": "2.3.0",
42
- "@khanacademy/perseus-utils": "2.1.5"
41
+ "@khanacademy/perseus-utils": "2.1.5",
42
+ "@khanacademy/pure-markdown": "2.3.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@khanacademy/wonder-stuff-core": "3.0.0",
@@ -1,2 +0,0 @@
1
- import type { PerseusInputNumberWidgetOptions, PerseusNumericInputWidgetOptions } from "../../data-schema";
2
- export declare function convertInputNumberOptionsToNumericInput(inputNumberOptions: PerseusInputNumberWidgetOptions): PerseusNumericInputWidgetOptions;