@khanacademy/perseus-core 18.4.0 → 18.6.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.
- package/dist/data-schema.d.ts +12 -0
- package/dist/es/index.item-splitting.js +3 -3
- package/dist/es/index.item-splitting.js.map +1 -1
- package/dist/es/index.js +7 -7
- package/dist/es/index.js.map +1 -1
- package/dist/index.item-splitting.js +3 -3
- package/dist/index.item-splitting.js.map +1 -1
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/parse-perseus-json/general-purpose-parsers/array.d.ts +5 -0
- package/dist/parse-perseus-json/perseus-parsers/categorizer-user-input.d.ts +1 -1
- package/dist/parse-perseus-json/perseus-parsers/interactive-graph-widget.d.ts +6 -0
- package/dist/parse-perseus-json/perseus-parsers/matrix-user-input.d.ts +1 -1
- package/dist/parse-perseus-json/perseus-parsers/radio-widget.d.ts +2 -0
- package/dist/parse-perseus-json/perseus-parsers/radio-widget.mockData.d.ts +10 -0
- package/dist/utils/get-matrix-size.d.ts +1 -1
- package/dist/validation.types.d.ts +4 -4
- package/dist/widgets/radio/derive-num-correct.d.ts +5 -2
- package/dist/widgets/radio/radio-util.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import type { Parser } from "../parser-types";
|
|
2
2
|
export declare function array<T>(elementParser: Parser<T>): Parser<T[]>;
|
|
3
|
+
/**
|
|
4
|
+
* Like the standard `array` parser, but passes the array index to a parser factory function.
|
|
5
|
+
* This allows element parsers to generate index-based default values.
|
|
6
|
+
*/
|
|
7
|
+
export declare function arrayWithIndex<T>(elementParserFactory: (index: number) => Parser<T>): Parser<T[]>;
|
|
@@ -82,6 +82,12 @@ export declare const parseInteractiveGraphWidget: import("../parser-types").Pars
|
|
|
82
82
|
rulerLabel: string | undefined;
|
|
83
83
|
rulerTicks: number | undefined;
|
|
84
84
|
range: [[number, number], [number, number]];
|
|
85
|
+
showAxisArrows: import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
|
86
|
+
xMin: boolean;
|
|
87
|
+
xMax: boolean;
|
|
88
|
+
yMin: boolean;
|
|
89
|
+
yMax: boolean;
|
|
90
|
+
}>;
|
|
85
91
|
graph: import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
|
86
92
|
type: "angle";
|
|
87
93
|
showAngles: boolean | undefined;
|
|
@@ -6,6 +6,7 @@ declare const parseRadioWidgetV3: import("../parser-types").Parser<import("../..
|
|
|
6
6
|
rationale: string | undefined;
|
|
7
7
|
correct: boolean | undefined;
|
|
8
8
|
isNoneOfTheAbove: boolean | undefined;
|
|
9
|
+
id: string;
|
|
9
10
|
}>[];
|
|
10
11
|
hasNoneOfTheAbove: boolean | undefined;
|
|
11
12
|
countChoices: boolean | undefined;
|
|
@@ -75,6 +76,7 @@ export declare const parseRadioWidget: import("../parser-types").Parser<import("
|
|
|
75
76
|
rationale: string | undefined;
|
|
76
77
|
correct: boolean | undefined;
|
|
77
78
|
isNoneOfTheAbove: boolean | undefined;
|
|
79
|
+
id: string;
|
|
78
80
|
}>[];
|
|
79
81
|
hasNoneOfTheAbove: boolean | undefined;
|
|
80
82
|
countChoices: boolean | undefined;
|
|
@@ -150,30 +150,40 @@ export declare const v3Widget: {
|
|
|
150
150
|
graded: boolean;
|
|
151
151
|
options: {
|
|
152
152
|
choices: ({
|
|
153
|
+
id: string;
|
|
153
154
|
content: string;
|
|
154
155
|
correct: boolean;
|
|
155
156
|
rationale: string;
|
|
156
157
|
isNoneOfTheAbove: boolean;
|
|
158
|
+
widgets?: undefined;
|
|
157
159
|
} | {
|
|
160
|
+
id: string;
|
|
158
161
|
content: string;
|
|
159
162
|
correct: boolean;
|
|
160
163
|
rationale: string;
|
|
164
|
+
widgets: undefined;
|
|
161
165
|
isNoneOfTheAbove?: undefined;
|
|
162
166
|
} | {
|
|
167
|
+
id: string;
|
|
163
168
|
content: string;
|
|
164
169
|
correct: boolean;
|
|
165
170
|
isNoneOfTheAbove: boolean;
|
|
166
171
|
rationale?: undefined;
|
|
172
|
+
widgets?: undefined;
|
|
167
173
|
} | {
|
|
174
|
+
id: string;
|
|
168
175
|
content: string;
|
|
169
176
|
rationale: string;
|
|
170
177
|
isNoneOfTheAbove: boolean;
|
|
171
178
|
correct?: undefined;
|
|
179
|
+
widgets?: undefined;
|
|
172
180
|
} | {
|
|
181
|
+
id: string;
|
|
173
182
|
content: string;
|
|
174
183
|
correct?: undefined;
|
|
175
184
|
rationale?: undefined;
|
|
176
185
|
isNoneOfTheAbove?: undefined;
|
|
186
|
+
widgets?: undefined;
|
|
177
187
|
})[];
|
|
178
188
|
numCorrect: number;
|
|
179
189
|
hasNoneOfTheAbove: boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function getMatrixSize(matrix: ReadonlyArray<ReadonlyArray<number>>): number[];
|
|
1
|
+
declare function getMatrixSize(matrix: ReadonlyArray<ReadonlyArray<number>> | ReadonlyArray<ReadonlyArray<string>>): number[];
|
|
2
2
|
export default getMatrixSize;
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
*/
|
|
31
31
|
import type { GrapherAnswerTypes, PerseusDropdownChoice, PerseusExpressionAnswerForm, PerseusGradedGroupSetWidgetOptions, PerseusGradedGroupWidgetOptions, PerseusGraphType, PerseusGroupWidgetOptions, PerseusMatrixWidgetAnswers, PerseusNumericInputAnswer, PerseusOrdererWidgetOptions, PerseusRadioChoice, PerseusGraphCorrectType, MakeWidgetMap, PerseusFreeResponseWidgetScoringCriterion } from "./data-schema";
|
|
32
32
|
import type { Relationship } from "./types";
|
|
33
|
-
export type WidgetValidatorFunction = (userInput: UserInput, validationData: ValidationData, locale: string) => ValidationResult;
|
|
34
|
-
export type WidgetScorerFunction = (userInput: UserInput, rubric: Rubric, locale?: string) => PerseusScore;
|
|
33
|
+
export type WidgetValidatorFunction = (userInput: UserInput | undefined, validationData: ValidationData, locale: string) => ValidationResult;
|
|
34
|
+
export type WidgetScorerFunction = (userInput: UserInput | undefined, rubric: Rubric, locale?: string) => PerseusScore;
|
|
35
35
|
export type PerseusScore = {
|
|
36
36
|
type: "invalid";
|
|
37
37
|
message?: string | null | undefined;
|
|
@@ -50,7 +50,7 @@ export type PerseusCategorizerRubric = {
|
|
|
50
50
|
values: number[];
|
|
51
51
|
} & PerseusCategorizerValidationData;
|
|
52
52
|
export type PerseusCategorizerUserInput = {
|
|
53
|
-
values:
|
|
53
|
+
values: Array<number | null | undefined>;
|
|
54
54
|
};
|
|
55
55
|
export type PerseusCategorizerValidationData = {
|
|
56
56
|
items: string[];
|
|
@@ -126,7 +126,7 @@ export type PerseusMatrixRubric = {
|
|
|
126
126
|
} & PerseusMatrixValidationData;
|
|
127
127
|
export type PerseusMatrixValidationData = Empty;
|
|
128
128
|
export type PerseusMatrixUserInput = {
|
|
129
|
-
answers:
|
|
129
|
+
answers: string[][];
|
|
130
130
|
};
|
|
131
131
|
export type PerseusNumberLineRubric = {
|
|
132
132
|
correctRel: string | null | undefined;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
interface Choice {
|
|
2
|
+
correct?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare function deriveNumCorrect(choices: Choice[]): number;
|
|
5
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PerseusRadioChoice, PerseusRadioWidgetOptions } from "../../data-schema";
|
|
2
2
|
/**
|
|
3
3
|
* For details on the individual options, see the
|
|
4
|
-
* PerseusRadioWidgetOptions type
|
|
4
|
+
* PerseusRadioWidgetOptions type.
|
|
5
5
|
*/
|
|
6
6
|
export type RadioPublicWidgetOptions = {
|
|
7
7
|
choices: ReadonlyArray<RadioChoicePublicData>;
|
|
@@ -15,7 +15,7 @@ export type RadioPublicWidgetOptions = {
|
|
|
15
15
|
/**
|
|
16
16
|
* Only the options from each Radio choice that should be exposed to the client.
|
|
17
17
|
*/
|
|
18
|
-
type RadioChoicePublicData = Pick<PerseusRadioChoice, "content" | "isNoneOfTheAbove">;
|
|
18
|
+
type RadioChoicePublicData = Pick<PerseusRadioChoice, "id" | "content" | "isNoneOfTheAbove">;
|
|
19
19
|
/**
|
|
20
20
|
* Shared functionality to determine if numCorrect is used, because:
|
|
21
21
|
*
|