@khanacademy/perseus-core 19.4.0 → 20.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.
- package/dist/error-codes.d.ts +18 -0
- package/dist/es/index.item-splitting.js +1 -1
- package/dist/es/index.item-splitting.js.map +1 -1
- package/dist/es/index.js +6 -4
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.item-splitting.js +1 -1
- package/dist/index.item-splitting.js.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/parse-perseus-json/perseus-parsers/radio-widget.mockData.d.ts +50 -0
- package/dist/parse-perseus-json/regression-tests/item-data/radio-choice-v2-with-rationale.d.ts +167 -0
- package/dist/validation.types.d.ts +2 -1
- package/package.json +1 -1
|
@@ -145,6 +145,56 @@ export declare const v2Widget: {
|
|
|
145
145
|
minor: number;
|
|
146
146
|
};
|
|
147
147
|
};
|
|
148
|
+
export declare const v2WidgetWithRationale: {
|
|
149
|
+
type: "radio";
|
|
150
|
+
graded: boolean;
|
|
151
|
+
options: {
|
|
152
|
+
choices: ({
|
|
153
|
+
content: string;
|
|
154
|
+
correct: boolean;
|
|
155
|
+
rationale: string;
|
|
156
|
+
isNoneOfTheAbove: boolean;
|
|
157
|
+
widgets: undefined;
|
|
158
|
+
} | {
|
|
159
|
+
content: string;
|
|
160
|
+
correct: boolean;
|
|
161
|
+
rationale: string;
|
|
162
|
+
widgets: undefined;
|
|
163
|
+
isNoneOfTheAbove?: undefined;
|
|
164
|
+
} | {
|
|
165
|
+
content: string;
|
|
166
|
+
correct: boolean;
|
|
167
|
+
isNoneOfTheAbove: boolean;
|
|
168
|
+
widgets: {};
|
|
169
|
+
rationale?: undefined;
|
|
170
|
+
} | {
|
|
171
|
+
content: string;
|
|
172
|
+
rationale: string;
|
|
173
|
+
isNoneOfTheAbove: boolean;
|
|
174
|
+
correct?: undefined;
|
|
175
|
+
widgets?: undefined;
|
|
176
|
+
} | {
|
|
177
|
+
content: string;
|
|
178
|
+
correct?: undefined;
|
|
179
|
+
rationale?: undefined;
|
|
180
|
+
isNoneOfTheAbove?: undefined;
|
|
181
|
+
widgets?: undefined;
|
|
182
|
+
})[];
|
|
183
|
+
numCorrect: number;
|
|
184
|
+
hasNoneOfTheAbove: boolean;
|
|
185
|
+
countChoices: boolean;
|
|
186
|
+
randomize: boolean;
|
|
187
|
+
multipleSelect: boolean;
|
|
188
|
+
deselectEnabled: boolean;
|
|
189
|
+
onePerLine: boolean;
|
|
190
|
+
displayCount: boolean;
|
|
191
|
+
noneOfTheAbove: undefined;
|
|
192
|
+
};
|
|
193
|
+
version: {
|
|
194
|
+
major: number;
|
|
195
|
+
minor: number;
|
|
196
|
+
};
|
|
197
|
+
};
|
|
148
198
|
export declare const v3Widget: {
|
|
149
199
|
type: "radio";
|
|
150
200
|
graded: boolean;
|
package/dist/parse-perseus-json/regression-tests/item-data/radio-choice-v2-with-rationale.d.ts
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
answerArea: {
|
|
3
|
+
calculator: boolean;
|
|
4
|
+
options: {
|
|
5
|
+
content: string;
|
|
6
|
+
images: {};
|
|
7
|
+
widgets: {};
|
|
8
|
+
};
|
|
9
|
+
type: string;
|
|
10
|
+
};
|
|
11
|
+
hints: never[];
|
|
12
|
+
itemDataVersion: {
|
|
13
|
+
major: number;
|
|
14
|
+
minor: number;
|
|
15
|
+
};
|
|
16
|
+
question: {
|
|
17
|
+
content: string;
|
|
18
|
+
images: {};
|
|
19
|
+
widgets: {
|
|
20
|
+
"group 1": {
|
|
21
|
+
graded: boolean;
|
|
22
|
+
options: {
|
|
23
|
+
content: string;
|
|
24
|
+
images: {};
|
|
25
|
+
widgets: {
|
|
26
|
+
"radio 1": {
|
|
27
|
+
graded: boolean;
|
|
28
|
+
options: {
|
|
29
|
+
choices: {
|
|
30
|
+
content: string;
|
|
31
|
+
rationale: string;
|
|
32
|
+
correct: boolean;
|
|
33
|
+
isNoneOfTheAbove: boolean;
|
|
34
|
+
}[];
|
|
35
|
+
deselectEnabled: boolean;
|
|
36
|
+
displayCount: null;
|
|
37
|
+
multipleSelect: boolean;
|
|
38
|
+
noneOfTheAbove: boolean;
|
|
39
|
+
onePerLine: boolean;
|
|
40
|
+
randomize: boolean;
|
|
41
|
+
};
|
|
42
|
+
type: string;
|
|
43
|
+
version: {
|
|
44
|
+
major: number;
|
|
45
|
+
minor: number;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
type: string;
|
|
51
|
+
version: {
|
|
52
|
+
major: number;
|
|
53
|
+
minor: number;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
"group 2": {
|
|
57
|
+
graded: boolean;
|
|
58
|
+
options: {
|
|
59
|
+
content: string;
|
|
60
|
+
images: {};
|
|
61
|
+
widgets: {
|
|
62
|
+
"radio 1": {
|
|
63
|
+
graded: boolean;
|
|
64
|
+
options: {
|
|
65
|
+
choices: {
|
|
66
|
+
content: string;
|
|
67
|
+
rationale: string;
|
|
68
|
+
correct: boolean;
|
|
69
|
+
isNoneOfTheAbove: boolean;
|
|
70
|
+
}[];
|
|
71
|
+
deselectEnabled: boolean;
|
|
72
|
+
displayCount: null;
|
|
73
|
+
multipleSelect: boolean;
|
|
74
|
+
noneOfTheAbove: boolean;
|
|
75
|
+
onePerLine: boolean;
|
|
76
|
+
randomize: boolean;
|
|
77
|
+
};
|
|
78
|
+
type: string;
|
|
79
|
+
version: {
|
|
80
|
+
major: number;
|
|
81
|
+
minor: number;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
type: string;
|
|
87
|
+
version: {
|
|
88
|
+
major: number;
|
|
89
|
+
minor: number;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
"group 3": {
|
|
93
|
+
graded: boolean;
|
|
94
|
+
options: {
|
|
95
|
+
content: string;
|
|
96
|
+
images: {};
|
|
97
|
+
widgets: {
|
|
98
|
+
"radio 1": {
|
|
99
|
+
graded: boolean;
|
|
100
|
+
options: {
|
|
101
|
+
choices: {
|
|
102
|
+
content: string;
|
|
103
|
+
rationale: string;
|
|
104
|
+
correct: boolean;
|
|
105
|
+
isNoneOfTheAbove: boolean;
|
|
106
|
+
}[];
|
|
107
|
+
deselectEnabled: boolean;
|
|
108
|
+
displayCount: null;
|
|
109
|
+
multipleSelect: boolean;
|
|
110
|
+
noneOfTheAbove: boolean;
|
|
111
|
+
onePerLine: boolean;
|
|
112
|
+
randomize: boolean;
|
|
113
|
+
};
|
|
114
|
+
type: string;
|
|
115
|
+
version: {
|
|
116
|
+
major: number;
|
|
117
|
+
minor: number;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
type: string;
|
|
123
|
+
version: {
|
|
124
|
+
major: number;
|
|
125
|
+
minor: number;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
"group 4": {
|
|
129
|
+
graded: boolean;
|
|
130
|
+
options: {
|
|
131
|
+
content: string;
|
|
132
|
+
images: {};
|
|
133
|
+
widgets: {
|
|
134
|
+
"radio 1": {
|
|
135
|
+
graded: boolean;
|
|
136
|
+
options: {
|
|
137
|
+
choices: {
|
|
138
|
+
content: string;
|
|
139
|
+
rationale: string;
|
|
140
|
+
correct: boolean;
|
|
141
|
+
isNoneOfTheAbove: boolean;
|
|
142
|
+
}[];
|
|
143
|
+
deselectEnabled: boolean;
|
|
144
|
+
displayCount: null;
|
|
145
|
+
multipleSelect: boolean;
|
|
146
|
+
noneOfTheAbove: boolean;
|
|
147
|
+
onePerLine: boolean;
|
|
148
|
+
randomize: boolean;
|
|
149
|
+
};
|
|
150
|
+
type: string;
|
|
151
|
+
version: {
|
|
152
|
+
major: number;
|
|
153
|
+
minor: number;
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
type: string;
|
|
159
|
+
version: {
|
|
160
|
+
major: number;
|
|
161
|
+
minor: number;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
export default _default;
|
|
@@ -29,12 +29,13 @@
|
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
31
|
import type { GrapherAnswerTypes, PerseusDropdownChoice, PerseusExpressionAnswerForm, PerseusGradedGroupSetWidgetOptions, PerseusGradedGroupWidgetOptions, PerseusGraphType, PerseusGroupWidgetOptions, PerseusMatrixWidgetAnswers, PerseusNumericInputAnswer, PerseusOrdererWidgetOptions, PerseusRadioChoice, PerseusGraphCorrectType, MakeWidgetMap, PerseusFreeResponseWidgetScoringCriterion } from "./data-schema";
|
|
32
|
+
import type { ErrorCode } from "./error-codes";
|
|
32
33
|
import type { Relationship } from "./types";
|
|
33
34
|
export type WidgetValidatorFunction = (userInput: UserInput | undefined, validationData: ValidationData, locale: string) => ValidationResult;
|
|
34
35
|
export type WidgetScorerFunction = (userInput: UserInput | undefined, rubric: Rubric, locale?: string) => PerseusScore;
|
|
35
36
|
export type PerseusScore = {
|
|
36
37
|
type: "invalid";
|
|
37
|
-
message?:
|
|
38
|
+
message?: ErrorCode | null;
|
|
38
39
|
suppressAlmostThere?: boolean | null | undefined;
|
|
39
40
|
} | {
|
|
40
41
|
type: "points";
|