@khanacademy/perseus-core 36.1.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.
- package/dist/data-schema.d.ts +9 -29
- package/dist/es/index.item-splitting.js +14 -10
- package/dist/es/index.item-splitting.js.map +1 -1
- package/dist/es/index.js +26 -20
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +9 -61
- package/dist/index.item-splitting.js +14 -10
- package/dist/index.item-splitting.js.map +1 -1
- package/dist/index.js +30 -19
- package/dist/index.js.map +1 -1
- package/dist/parse-perseus-json/perseus-parsers/categorizer-widget.d.ts +0 -1
- package/dist/parse-perseus-json/perseus-parsers/definition-widget.d.ts +0 -1
- package/dist/parse-perseus-json/perseus-parsers/dropdown-widget.d.ts +0 -1
- package/dist/parse-perseus-json/perseus-parsers/explanation-widget.d.ts +0 -1
- package/dist/parse-perseus-json/perseus-parsers/graded-group-set-widget.d.ts +0 -3
- package/dist/parse-perseus-json/perseus-parsers/graded-group-widget.d.ts +0 -6
- package/dist/parse-perseus-json/perseus-parsers/iframe-widget.d.ts +0 -1
- package/dist/parse-perseus-json/perseus-parsers/interaction-widget.d.ts +0 -1
- package/dist/parse-perseus-json/perseus-parsers/label-image-widget.d.ts +0 -1
- package/dist/parse-perseus-json/perseus-parsers/number-line-widget.d.ts +0 -1
- package/dist/parse-perseus-json/perseus-parsers/video-widget.d.ts +0 -1
- package/dist/utils/generators/table-widget-generator.d.ts +10 -0
- package/dist/utils/widget-prop-denylist.d.ts +5 -0
- package/dist/validation.types.d.ts +8 -228
- package/dist/widgets/categorizer/categorizer-util.d.ts +0 -1
- package/dist/widgets/categorizer/index.d.ts +0 -1
- package/dist/widgets/cs-program/index.d.ts +0 -1
- package/dist/widgets/definition/index.d.ts +0 -2
- package/dist/widgets/dropdown/dropdown-util.d.ts +0 -1
- package/dist/widgets/dropdown/index.d.ts +0 -1
- package/dist/widgets/explanation/index.d.ts +0 -2
- package/dist/widgets/expression/index.d.ts +0 -1
- package/dist/widgets/free-response/index.d.ts +0 -1
- package/dist/widgets/graded-group/index.d.ts +0 -2
- package/dist/widgets/graded-group-set/index.d.ts +0 -2
- package/dist/widgets/grapher/index.d.ts +0 -1
- package/dist/widgets/group/index.d.ts +0 -1
- package/dist/widgets/iframe/index.d.ts +0 -1
- package/dist/widgets/image/index.d.ts +0 -1
- package/dist/widgets/input-number/index.d.ts +0 -1
- package/dist/widgets/interaction/index.d.ts +0 -2
- package/dist/widgets/interactive-graph/index.d.ts +0 -1
- package/dist/widgets/label-image/index.d.ts +0 -1
- package/dist/widgets/label-image/label-image-util.d.ts +0 -1
- package/dist/widgets/matcher/index.d.ts +0 -1
- package/dist/widgets/matrix/index.d.ts +0 -1
- package/dist/widgets/measurer/index.d.ts +0 -2
- package/dist/widgets/number-line/index.d.ts +0 -1
- package/dist/widgets/number-line/number-line-util.d.ts +1 -1
- package/dist/widgets/numeric-input/index.d.ts +0 -1
- package/dist/widgets/orderer/index.d.ts +0 -1
- package/dist/widgets/orderer/orderer-util.d.ts +11 -1
- package/dist/widgets/phet-simulation/index.d.ts +0 -2
- package/dist/widgets/plotter/index.d.ts +0 -1
- package/dist/widgets/python-program/index.d.ts +0 -2
- package/dist/widgets/radio/index.d.ts +0 -1
- package/dist/widgets/sorter/index.d.ts +0 -1
- package/dist/widgets/sorter/sorter-util.d.ts +12 -1
- package/dist/widgets/table/index.d.ts +0 -1
- package/dist/widgets/video/index.d.ts +0 -2
- package/package.json +1 -1
|
@@ -6,7 +6,6 @@ export declare const parseDefinitionWidget: import("../parser-types").Parser<imp
|
|
|
6
6
|
options: import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
|
7
7
|
togglePrompt: string;
|
|
8
8
|
definition: string;
|
|
9
|
-
static: boolean;
|
|
10
9
|
}>;
|
|
11
10
|
key: number | null | undefined;
|
|
12
11
|
version: import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
|
@@ -7,7 +7,6 @@ export declare const parseDropdownWidget: import("../parser-types").Parser<impor
|
|
|
7
7
|
placeholder: string;
|
|
8
8
|
ariaLabel: string | undefined;
|
|
9
9
|
visibleLabel: string | undefined;
|
|
10
|
-
static: boolean;
|
|
11
10
|
choices: import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
|
12
11
|
content: string;
|
|
13
12
|
correct: boolean;
|
|
@@ -8,7 +8,6 @@ export declare const parseExplanationWidget: import("../parser-types").Parser<im
|
|
|
8
8
|
hidePrompt: string;
|
|
9
9
|
explanation: string;
|
|
10
10
|
widgets: import("../..").MakeWidgetMap<import("../..").PerseusWidgetTypes>;
|
|
11
|
-
static: boolean;
|
|
12
11
|
}>;
|
|
13
12
|
key: number | null | undefined;
|
|
14
13
|
version: import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
|
@@ -6,12 +6,9 @@ export declare const parseGradedGroupSetWidget: import("../parser-types").Parser
|
|
|
6
6
|
options: import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
|
7
7
|
gradedGroups: import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
|
8
8
|
title: string;
|
|
9
|
-
hasHint: boolean | null | undefined;
|
|
10
9
|
hint: import("../..").PerseusRenderer | null | undefined;
|
|
11
10
|
content: string;
|
|
12
11
|
widgets: import("../..").MakeWidgetMap<import("../..").PerseusWidgetTypes>;
|
|
13
|
-
widgetEnabled: boolean | null | undefined;
|
|
14
|
-
immutableWidgets: boolean | null | undefined;
|
|
15
12
|
images: Record<string, import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
|
16
13
|
width: number;
|
|
17
14
|
height: number;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
export declare const parseGradedGroupWidgetOptions: import("../parser-types").Parser<import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
|
2
2
|
title: string;
|
|
3
|
-
hasHint: boolean | null | undefined;
|
|
4
3
|
hint: import("../..").PerseusRenderer | null | undefined;
|
|
5
4
|
content: string;
|
|
6
5
|
widgets: import("../..").MakeWidgetMap<import("../..").PerseusWidgetTypes>;
|
|
7
|
-
widgetEnabled: boolean | null | undefined;
|
|
8
|
-
immutableWidgets: boolean | null | undefined;
|
|
9
6
|
images: Record<string, import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
|
10
7
|
width: number;
|
|
11
8
|
height: number;
|
|
@@ -18,12 +15,9 @@ export declare const parseGradedGroupWidget: import("../parser-types").Parser<im
|
|
|
18
15
|
alignment: "default" | "block" | "inline-block" | "inline" | "wrap-left" | "wrap-right" | "full-width" | undefined;
|
|
19
16
|
options: import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
|
20
17
|
title: string;
|
|
21
|
-
hasHint: boolean | null | undefined;
|
|
22
18
|
hint: import("../..").PerseusRenderer | null | undefined;
|
|
23
19
|
content: string;
|
|
24
20
|
widgets: import("../..").MakeWidgetMap<import("../..").PerseusWidgetTypes>;
|
|
25
|
-
widgetEnabled: boolean | null | undefined;
|
|
26
|
-
immutableWidgets: boolean | null | undefined;
|
|
27
21
|
images: Record<string, import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
|
28
22
|
width: number;
|
|
29
23
|
height: number;
|
|
@@ -13,7 +13,6 @@ export declare const parseIframeWidget: import("../parser-types").Parser<import(
|
|
|
13
13
|
height: string | number;
|
|
14
14
|
allowFullScreen: boolean;
|
|
15
15
|
allowTopNavigation: boolean | undefined;
|
|
16
|
-
static: boolean;
|
|
17
16
|
}>;
|
|
18
17
|
key: number | null | undefined;
|
|
19
18
|
version: import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
|
@@ -4,7 +4,6 @@ export declare const parseInteractionWidget: import("../parser-types").Parser<im
|
|
|
4
4
|
graded: boolean | undefined;
|
|
5
5
|
alignment: "default" | "block" | "inline-block" | "inline" | "wrap-left" | "wrap-right" | "full-width" | undefined;
|
|
6
6
|
options: import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
|
7
|
-
static: boolean;
|
|
8
7
|
graph: import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
|
9
8
|
editableSettings: ("graph" | "canvas")[] | undefined;
|
|
10
9
|
box: [number, number];
|
|
@@ -17,7 +17,6 @@ export declare const parseLabelImageWidget: import("../parser-types").Parser<imp
|
|
|
17
17
|
}>[];
|
|
18
18
|
hideChoicesFromInstructions: boolean;
|
|
19
19
|
multipleAnswers: boolean;
|
|
20
|
-
static: boolean;
|
|
21
20
|
}>;
|
|
22
21
|
key: number | null | undefined;
|
|
23
22
|
version: import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
|
@@ -18,7 +18,6 @@ export declare const parseNumberLineWidget: import("../parser-types").Parser<imp
|
|
|
18
18
|
correctX: number | null;
|
|
19
19
|
initialX: number | null | undefined;
|
|
20
20
|
showTooltips: boolean | undefined;
|
|
21
|
-
static: boolean;
|
|
22
21
|
}>;
|
|
23
22
|
key: number | null | undefined;
|
|
24
23
|
version: import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
|
@@ -5,7 +5,6 @@ export declare const parseVideoWidget: import("../parser-types").Parser<import("
|
|
|
5
5
|
alignment: "default" | "block" | "inline-block" | "inline" | "wrap-left" | "wrap-right" | "full-width" | undefined;
|
|
6
6
|
options: import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
|
7
7
|
location: string;
|
|
8
|
-
static: boolean | undefined;
|
|
9
8
|
}>;
|
|
10
9
|
key: number | null | undefined;
|
|
11
10
|
version: import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PerseusTableWidgetOptions } from "../../data-schema";
|
|
2
|
+
/**
|
|
3
|
+
* `rows`, `columns` and `headers` all describe the shape of `answers`, so
|
|
4
|
+
* we derive them. That way a caller who overrides only `answers` still
|
|
5
|
+
* gets a coherent widget.
|
|
6
|
+
*
|
|
7
|
+
* Each of the three resolves in the same order: the caller's value, then the
|
|
8
|
+
* shape of `answers`, then the widget default.
|
|
9
|
+
*/
|
|
10
|
+
export declare function generateTableOptions(options?: Partial<PerseusTableWidgetOptions>): PerseusTableWidgetOptions;
|
|
@@ -28,9 +28,12 @@
|
|
|
28
28
|
* } & Perseus<Widget>ValidationData;
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
|
-
import type { GrapherAnswerTypes,
|
|
31
|
+
import type { GrapherAnswerTypes, MakeWidgetMap, PerseusGraphType, PerseusWidgetOptions } from "./data-schema";
|
|
32
32
|
import type { ErrorCode } from "./error-codes";
|
|
33
33
|
import type { Relationship } from "./types";
|
|
34
|
+
import type { CategorizerPublicWidgetOptions } from "./widgets/categorizer/categorizer-util";
|
|
35
|
+
import type { GroupPublicWidgetOptions } from "./widgets/group/group-util";
|
|
36
|
+
import type { PlotterPublicWidgetOptions } from "./widgets/plotter/plotter-util";
|
|
34
37
|
/**
|
|
35
38
|
* The signature of a widget's client-side validation function. This function
|
|
36
39
|
* runs before the learner submits their attempt, so it will be passed
|
|
@@ -60,7 +63,7 @@ export type WidgetScorerFunction = (
|
|
|
60
63
|
*/
|
|
61
64
|
userInput: UserInput | undefined,
|
|
62
65
|
/** The scoring criteria containing the correct answer. */
|
|
63
|
-
rubric:
|
|
66
|
+
rubric: PerseusWidgetOptions,
|
|
64
67
|
/**
|
|
65
68
|
* The locale for locale-sensitive scoring (eg. decimal separators).
|
|
66
69
|
*/
|
|
@@ -110,21 +113,6 @@ export type PerseusBlankUserInput = {
|
|
|
110
113
|
*/
|
|
111
114
|
selected: string | null;
|
|
112
115
|
};
|
|
113
|
-
export type PerseusBlankRubric = {
|
|
114
|
-
/**
|
|
115
|
-
* The ID of the correct answer tile
|
|
116
|
-
*/
|
|
117
|
-
correctId: string;
|
|
118
|
-
};
|
|
119
|
-
/** Scoring rubric for the Categorizer widget. */
|
|
120
|
-
export type PerseusCategorizerRubric = {
|
|
121
|
-
/**
|
|
122
|
-
* The correct category index for each item. The array index corresponds to
|
|
123
|
-
* the item; the value is the category index.
|
|
124
|
-
* e.g. [0, 1, 0, 1, 2]
|
|
125
|
-
*/
|
|
126
|
-
values: number[];
|
|
127
|
-
} & PerseusCategorizerValidationData;
|
|
128
116
|
/**
|
|
129
117
|
* User input for the Categorizer widget. Records which category
|
|
130
118
|
* the user assigned to each item.
|
|
@@ -137,14 +125,6 @@ export type PerseusCategorizerUserInput = {
|
|
|
137
125
|
*/
|
|
138
126
|
values: Array<number | null | undefined>;
|
|
139
127
|
};
|
|
140
|
-
/** Validation data for the Categorizer widget. */
|
|
141
|
-
export type PerseusCategorizerValidationData = {
|
|
142
|
-
/**
|
|
143
|
-
* Translatable text; items to categorize.
|
|
144
|
-
* e.g. ["banana", "yellow", "apple", "purple", "shirt"]
|
|
145
|
-
*/
|
|
146
|
-
items: string[];
|
|
147
|
-
};
|
|
148
128
|
/** User input for the CS Program widget. */
|
|
149
129
|
export type PerseusCSProgramUserInput = {
|
|
150
130
|
/**
|
|
@@ -155,11 +135,6 @@ export type PerseusCSProgramUserInput = {
|
|
|
155
135
|
/** An optional message from the program to display alongside the score. */
|
|
156
136
|
message: string | null;
|
|
157
137
|
};
|
|
158
|
-
/** Scoring rubric for the Dropdown widget. */
|
|
159
|
-
export type PerseusDropdownRubric = {
|
|
160
|
-
/** The list of choices; each has a `correct` flag used for scoring. */
|
|
161
|
-
choices: Array<PerseusDropdownChoice>;
|
|
162
|
-
};
|
|
163
138
|
/** User input for the Dropdown widget. */
|
|
164
139
|
export type PerseusDropdownUserInput = {
|
|
165
140
|
/**
|
|
@@ -168,49 +143,16 @@ export type PerseusDropdownUserInput = {
|
|
|
168
143
|
*/
|
|
169
144
|
value: number;
|
|
170
145
|
};
|
|
171
|
-
/** Scoring rubric for the Expression widget. */
|
|
172
|
-
export type PerseusExpressionRubric = {
|
|
173
|
-
/**
|
|
174
|
-
* Ordered list of answer forms matched top-to-bottom; the first
|
|
175
|
-
* match determines the score.
|
|
176
|
-
*/
|
|
177
|
-
answerForms: Array<PerseusExpressionAnswerForm>;
|
|
178
|
-
/**
|
|
179
|
-
* Variable names treated as functions (e.g. ["f", "g"]) during KAS
|
|
180
|
-
* parsing.
|
|
181
|
-
*/
|
|
182
|
-
functions: string[];
|
|
183
|
-
extraKeys?: ReadonlyArray<string>;
|
|
184
|
-
};
|
|
185
146
|
/**
|
|
186
147
|
* User input for the Expression widget: the raw math expression
|
|
187
148
|
* string the learner typed, parsed by @khanacademy/kas for scoring.
|
|
188
149
|
*/
|
|
189
150
|
export type PerseusExpressionUserInput = string;
|
|
190
|
-
/**
|
|
191
|
-
* Scoring rubric for the Group widget: the full widget options including all
|
|
192
|
-
* nested widgets and their rubrics.
|
|
193
|
-
*/
|
|
194
|
-
export type PerseusGroupRubric = PerseusGroupWidgetOptions;
|
|
195
|
-
/**
|
|
196
|
-
* Validation data for the Group widget: the full renderer content used to
|
|
197
|
-
* recursively validate nested widgets.
|
|
198
|
-
*/
|
|
199
|
-
export type PerseusGroupValidationData = PerseusRenderer;
|
|
200
151
|
/**
|
|
201
152
|
* User input for the Group widget: a map of widget IDs to each widget's user
|
|
202
153
|
* input. Scored by recursively scoring all contained widgets.
|
|
203
154
|
*/
|
|
204
155
|
export type PerseusGroupUserInput = UserInputMap;
|
|
205
|
-
/** Scoring rubric for the GradedGroup widget. */
|
|
206
|
-
export type PerseusGradedGroupRubric = PerseusGradedGroupWidgetOptions;
|
|
207
|
-
/** Scoring rubric for the GradedGroupSet widget. */
|
|
208
|
-
export type PerseusGradedGroupSetRubric = PerseusGradedGroupSetWidgetOptions;
|
|
209
|
-
/** Scoring rubric for the Grapher widget. */
|
|
210
|
-
export type PerseusGrapherRubric = {
|
|
211
|
-
/** The expected function type and coordinates for a correct answer. */
|
|
212
|
-
correct: GrapherAnswerTypes;
|
|
213
|
-
};
|
|
214
156
|
/**
|
|
215
157
|
* User input for the Grapher widget: the function type and
|
|
216
158
|
* coordinates the learner plotted.
|
|
@@ -234,36 +176,11 @@ export type PerseusInputNumberUserInput = {
|
|
|
234
176
|
*/
|
|
235
177
|
currentValue: string;
|
|
236
178
|
};
|
|
237
|
-
/** Scoring rubric for the InteractiveGraph widget. */
|
|
238
|
-
export type PerseusInteractiveGraphRubric = {
|
|
239
|
-
/**
|
|
240
|
-
* The expected graph state for a correct answer.
|
|
241
|
-
*/
|
|
242
|
-
correct: PerseusGraphCorrectType;
|
|
243
|
-
/**
|
|
244
|
-
* The initial graph state; used to detect an unanswered/empty widget
|
|
245
|
-
* (input equals this when nothing has moved).
|
|
246
|
-
*/
|
|
247
|
-
graph: PerseusGraphType;
|
|
248
|
-
};
|
|
249
179
|
/**
|
|
250
180
|
* User input for the InteractiveGraph widget: the graph type and coordinates
|
|
251
181
|
* the learner positioned.
|
|
252
182
|
*/
|
|
253
183
|
export type PerseusInteractiveGraphUserInput = PerseusGraphType;
|
|
254
|
-
/** Scoring rubric for the LabelImage widget. */
|
|
255
|
-
export type PerseusLabelImageRubric = {
|
|
256
|
-
/**
|
|
257
|
-
* The expected answers for each labeled region in the image, parallel to
|
|
258
|
-
* the user input's markers.
|
|
259
|
-
*/
|
|
260
|
-
markers: Array<{
|
|
261
|
-
/** The set of correct answer labels for this marker. */
|
|
262
|
-
answers: string[];
|
|
263
|
-
/** The label text identifying this marker in the image. */
|
|
264
|
-
label: string;
|
|
265
|
-
}>;
|
|
266
|
-
};
|
|
267
184
|
/** User input for a single image marker in the LabelImage widget. */
|
|
268
185
|
export type PerseusLabelImageUserInputMarker = {
|
|
269
186
|
/** The answer labels the user selected for this marker. */
|
|
@@ -279,22 +196,6 @@ export type PerseusLabelImageUserInput = {
|
|
|
279
196
|
*/
|
|
280
197
|
markers: PerseusLabelImageUserInputMarker[];
|
|
281
198
|
};
|
|
282
|
-
/** Scoring rubric for the Matcher widget. */
|
|
283
|
-
export type PerseusMatcherRubric = {
|
|
284
|
-
/**
|
|
285
|
-
* Static concepts for the left column. e.g. ["Fruit", "Color", "Clothes"]
|
|
286
|
-
*
|
|
287
|
-
* Translatable text.
|
|
288
|
-
*/
|
|
289
|
-
left: string[];
|
|
290
|
-
/**
|
|
291
|
-
* the correct right-column values, ordered to match the left. e.g.
|
|
292
|
-
* ["Banana", "Red", "Shirt"]
|
|
293
|
-
*
|
|
294
|
-
* Translatable markup.
|
|
295
|
-
*/
|
|
296
|
-
right: string[];
|
|
297
|
-
};
|
|
298
199
|
/** User input for the Matcher widget. */
|
|
299
200
|
export type PerseusMatcherUserInput = {
|
|
300
201
|
/** The left-column items in the learner's current arrangement. */
|
|
@@ -305,16 +206,6 @@ export type PerseusMatcherUserInput = {
|
|
|
305
206
|
*/
|
|
306
207
|
right: string[];
|
|
307
208
|
};
|
|
308
|
-
/** Scoring rubric for the Matrix widget. */
|
|
309
|
-
export type PerseusMatrixRubric = {
|
|
310
|
-
/** The correct 2D matrix of answers. */
|
|
311
|
-
answers: PerseusMatrixWidgetAnswers;
|
|
312
|
-
} & PerseusMatrixValidationData;
|
|
313
|
-
/**
|
|
314
|
-
* Validation data for the Matrix widget; currently empty — validation is
|
|
315
|
-
* performed from user input alone.
|
|
316
|
-
*/
|
|
317
|
-
export type PerseusMatrixValidationData = Empty;
|
|
318
209
|
/** User input for the Matrix widget. */
|
|
319
210
|
export type PerseusMatrixUserInput = {
|
|
320
211
|
/**
|
|
@@ -323,26 +214,6 @@ export type PerseusMatrixUserInput = {
|
|
|
323
214
|
*/
|
|
324
215
|
answers: string[][];
|
|
325
216
|
};
|
|
326
|
-
/** Scoring rubric for the NumberLine widget. */
|
|
327
|
-
export type PerseusNumberLineRubric = {
|
|
328
|
-
/**
|
|
329
|
-
* The correct inequality relation (e.g. "lt", "ge"), or null
|
|
330
|
-
* for an equality question.
|
|
331
|
-
*/
|
|
332
|
-
correctRel: string | null | undefined;
|
|
333
|
-
/** The correct numeric position on the number line. */
|
|
334
|
-
correctX: number;
|
|
335
|
-
/** The [min, max] extent of the number line. */
|
|
336
|
-
range: number[];
|
|
337
|
-
/** The starting position of the point. Defaults to range[0] if null. */
|
|
338
|
-
initialX: number | null | undefined;
|
|
339
|
-
/** When true, the widget shows a shaded region and a relation selector. */
|
|
340
|
-
isInequality: boolean;
|
|
341
|
-
/** When true, the learner can adjust the number of tick-mark divisions. */
|
|
342
|
-
isTickCtrl?: boolean;
|
|
343
|
-
/** The [min, max] allowed number of divisions when isTickCtrl is true. */
|
|
344
|
-
divisionRange: number[];
|
|
345
|
-
};
|
|
346
217
|
/** User input for the NumberLine widget. */
|
|
347
218
|
export type PerseusNumberLineUserInput = {
|
|
348
219
|
/**
|
|
@@ -363,25 +234,6 @@ export type PerseusNumberLineUserInput = {
|
|
|
363
234
|
*/
|
|
364
235
|
numDivisions: number;
|
|
365
236
|
};
|
|
366
|
-
/** Scoring rubric for the NumericInput widget. */
|
|
367
|
-
export type PerseusNumericInputRubric = {
|
|
368
|
-
/**
|
|
369
|
-
* A list of correct and incorrect answers. Each answer can have a
|
|
370
|
-
* message explaining why it is correct/incorrect. There may be
|
|
371
|
-
* multiple correct answers if multiple formats are accepted. For
|
|
372
|
-
* example, some questions might accept either a fraction or a
|
|
373
|
-
* decimal as correct.
|
|
374
|
-
*
|
|
375
|
-
* The first answer that matches (correct or incorrect) is the scoring
|
|
376
|
-
* result (so order of answers is very important).
|
|
377
|
-
*/
|
|
378
|
-
answers: PerseusNumericInputAnswer[];
|
|
379
|
-
/**
|
|
380
|
-
* When true, allows shorthand coefficient entry: `"-"` means `-1`
|
|
381
|
-
* and an empty string (`""`) means `1`.
|
|
382
|
-
*/
|
|
383
|
-
coefficient: boolean;
|
|
384
|
-
};
|
|
385
237
|
/** User input for the NumericInput widget. */
|
|
386
238
|
export type PerseusNumericInputUserInput = {
|
|
387
239
|
/**
|
|
@@ -395,18 +247,6 @@ export type PerseusFreeResponseUserInput = {
|
|
|
395
247
|
/** The free-text string entered by the learner. */
|
|
396
248
|
currentValue: string;
|
|
397
249
|
};
|
|
398
|
-
/** Scoring rubric for the FreeResponse widget. */
|
|
399
|
-
export type PerseusFreeResponseRubric = {
|
|
400
|
-
/** The question text shown to the learner. */
|
|
401
|
-
question: string;
|
|
402
|
-
/** The criteria used for AI-assisted scoring of the learner's response. */
|
|
403
|
-
scoringCriteria: ReadonlyArray<PerseusFreeResponseWidgetScoringCriterion>;
|
|
404
|
-
};
|
|
405
|
-
/**
|
|
406
|
-
* Scoring rubric for the Orderer widget: the full widget options
|
|
407
|
-
* including the correct ordering.
|
|
408
|
-
*/
|
|
409
|
-
export type PerseusOrdererRubric = PerseusOrdererWidgetOptions;
|
|
410
250
|
/** User input for the Orderer widget. */
|
|
411
251
|
export type PerseusOrdererUserInput = {
|
|
412
252
|
/**
|
|
@@ -415,32 +255,11 @@ export type PerseusOrdererUserInput = {
|
|
|
415
255
|
*/
|
|
416
256
|
current: string[];
|
|
417
257
|
};
|
|
418
|
-
/** Scoring rubric for the Plotter widget. */
|
|
419
|
-
export type PerseusPlotterRubric = {
|
|
420
|
-
/** The expected Y-axis values representing the correct answer. */
|
|
421
|
-
correct: number[];
|
|
422
|
-
} & PerseusPlotterValidationData;
|
|
423
|
-
/** Validation data for the Plotter widget. */
|
|
424
|
-
export type PerseusPlotterValidationData = {
|
|
425
|
-
/** The initial Y-axis values the chart is pre-populated with. */
|
|
426
|
-
starting: number[];
|
|
427
|
-
};
|
|
428
258
|
/**
|
|
429
259
|
* User input for the Plotter widget: an array of Y-axis values, one
|
|
430
260
|
* per bar or data point, as set by the learner.
|
|
431
261
|
*/
|
|
432
262
|
export type PerseusPlotterUserInput = number[];
|
|
433
|
-
/** Scoring rubric for the Radio widget. */
|
|
434
|
-
export type PerseusRadioRubric = {
|
|
435
|
-
/** The answer choices shown to the learner; each has a `correct` flag. */
|
|
436
|
-
choices: PerseusRadioChoice[];
|
|
437
|
-
/**
|
|
438
|
-
* When true, the learner must select exactly as many choices as there
|
|
439
|
-
* are correct answers before the answer is graded. Only has an effect
|
|
440
|
-
* when there are multiple correct answers.
|
|
441
|
-
*/
|
|
442
|
-
countChoices?: boolean;
|
|
443
|
-
};
|
|
444
263
|
/** User input for the Radio widget. */
|
|
445
264
|
export type PerseusRadioUserInput = {
|
|
446
265
|
/**
|
|
@@ -451,14 +270,6 @@ export type PerseusRadioUserInput = {
|
|
|
451
270
|
*/
|
|
452
271
|
selectedChoiceIds: string[];
|
|
453
272
|
};
|
|
454
|
-
/** Scoring rubric for the Sorter widget. */
|
|
455
|
-
export type PerseusSorterRubric = {
|
|
456
|
-
/**
|
|
457
|
-
* Translatable text; the correct ordering of the cards. The
|
|
458
|
-
* learner sees them in a randomized order.
|
|
459
|
-
*/
|
|
460
|
-
correct: string[];
|
|
461
|
-
};
|
|
462
273
|
/** User input for the Sorter widget. */
|
|
463
274
|
export type PerseusSorterUserInput = {
|
|
464
275
|
/**
|
|
@@ -472,42 +283,11 @@ export type PerseusSorterUserInput = {
|
|
|
472
283
|
*/
|
|
473
284
|
changed: boolean;
|
|
474
285
|
};
|
|
475
|
-
/** Scoring rubric for the Table widget. */
|
|
476
|
-
export type PerseusTableRubric = {
|
|
477
|
-
/** Translatable text; the correct 2D array of cell values. */
|
|
478
|
-
answers: string[][];
|
|
479
|
-
};
|
|
480
286
|
/**
|
|
481
287
|
* User input for the Table widget: a 2D array of cell values
|
|
482
288
|
* entered by the learner, scored against the rubric's answers.
|
|
483
289
|
*/
|
|
484
290
|
export type PerseusTableUserInput = string[][];
|
|
485
|
-
/**
|
|
486
|
-
* A registry mapping widget type names to their rubric types.
|
|
487
|
-
*/
|
|
488
|
-
export interface RubricRegistry {
|
|
489
|
-
categorizer: PerseusCategorizerRubric;
|
|
490
|
-
dropdown: PerseusDropdownRubric;
|
|
491
|
-
expression: PerseusExpressionRubric;
|
|
492
|
-
"graded-group-set": PerseusGradedGroupSetRubric;
|
|
493
|
-
"graded-group": PerseusGradedGroupRubric;
|
|
494
|
-
grapher: PerseusGrapherRubric;
|
|
495
|
-
group: PerseusGroupRubric;
|
|
496
|
-
"input-number": PerseusNumericInputRubric;
|
|
497
|
-
"interactive-graph": PerseusInteractiveGraphRubric;
|
|
498
|
-
"label-image": PerseusLabelImageRubric;
|
|
499
|
-
matcher: PerseusMatcherRubric;
|
|
500
|
-
matrix: PerseusMatrixRubric;
|
|
501
|
-
"number-line": PerseusNumberLineRubric;
|
|
502
|
-
"numeric-input": PerseusNumericInputRubric;
|
|
503
|
-
orderer: PerseusOrdererRubric;
|
|
504
|
-
plotter: PerseusPlotterRubric;
|
|
505
|
-
radio: PerseusRadioRubric;
|
|
506
|
-
sorter: PerseusSorterRubric;
|
|
507
|
-
table: PerseusTableRubric;
|
|
508
|
-
}
|
|
509
|
-
/** A union of all widget rubric types. */
|
|
510
|
-
export type Rubric = RubricRegistry[keyof RubricRegistry];
|
|
511
291
|
/**
|
|
512
292
|
* This is an interface so that it can be extended if a widget is created
|
|
513
293
|
* outside of this Perseus package. See `PerseusWidgetTypes` for a full
|
|
@@ -547,9 +327,9 @@ export type UserInputMap = MakeWidgetMap<UserInputRegistry>;
|
|
|
547
327
|
* validation data types.
|
|
548
328
|
*/
|
|
549
329
|
export interface ValidationDataTypes {
|
|
550
|
-
categorizer:
|
|
551
|
-
group:
|
|
552
|
-
plotter:
|
|
330
|
+
categorizer: CategorizerPublicWidgetOptions;
|
|
331
|
+
group: GroupPublicWidgetOptions;
|
|
332
|
+
plotter: PlotterPublicWidgetOptions;
|
|
553
333
|
}
|
|
554
334
|
/**
|
|
555
335
|
* A union type of all the different widget validation data types that exist.
|
|
@@ -7,7 +7,6 @@ export type CategorizerPublicWidgetOptions = {
|
|
|
7
7
|
items: PerseusCategorizerWidgetOptions["items"];
|
|
8
8
|
categories: PerseusCategorizerWidgetOptions["categories"];
|
|
9
9
|
randomizeItems: PerseusCategorizerWidgetOptions["randomizeItems"];
|
|
10
|
-
static: PerseusCategorizerWidgetOptions["static"];
|
|
11
10
|
};
|
|
12
11
|
/**
|
|
13
12
|
* Given a PerseusCategorizerWidgetOptions object, return a new object with only
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { CategorizerPublicWidgetOptions } from "./categorizer-util";
|
|
2
2
|
import type { PerseusCategorizerWidgetOptions } from "../../data-schema";
|
|
3
3
|
import type { WidgetLogic } from "../logic-export.types";
|
|
4
|
-
export type CategorizerDefaultWidgetOptions = Pick<PerseusCategorizerWidgetOptions, "items" | "categories" | "values" | "randomizeItems">;
|
|
5
4
|
declare const categorizerWidgetLogic: WidgetLogic<PerseusCategorizerWidgetOptions, CategorizerPublicWidgetOptions>;
|
|
6
5
|
export default categorizerWidgetLogic;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { PerseusCSProgramWidgetOptions } from "../../data-schema";
|
|
2
2
|
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
-
export type CSProgramDefaultWidgetOptions = Pick<PerseusCSProgramWidgetOptions, "programID" | "programType" | "settings" | "showEditor" | "showButtons" | "height">;
|
|
4
3
|
declare const csProgramWidgetLogic: WidgetLogic<PerseusCSProgramWidgetOptions, PerseusCSProgramWidgetOptions>;
|
|
5
4
|
export default csProgramWidgetLogic;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { PerseusDefinitionWidgetOptions } from "../../data-schema";
|
|
2
1
|
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
-
export type DefinitionDefaultWidgetOptions = Pick<PerseusDefinitionWidgetOptions, "togglePrompt" | "definition">;
|
|
4
2
|
declare const definitionWidgetLogic: WidgetLogic;
|
|
5
3
|
export default definitionWidgetLogic;
|
|
@@ -8,7 +8,6 @@ export type DropdownPublicWidgetOptions = {
|
|
|
8
8
|
content: string;
|
|
9
9
|
}>;
|
|
10
10
|
placeholder: PerseusDropdownWidgetOptions["placeholder"];
|
|
11
|
-
static: PerseusDropdownWidgetOptions["static"];
|
|
12
11
|
visibleLabel?: PerseusDropdownWidgetOptions["visibleLabel"];
|
|
13
12
|
ariaLabel?: PerseusDropdownWidgetOptions["ariaLabel"];
|
|
14
13
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { DropdownPublicWidgetOptions } from "./dropdown-util";
|
|
2
2
|
import type { PerseusDropdownWidgetOptions } from "../../data-schema";
|
|
3
3
|
import type { WidgetLogic } from "../logic-export.types";
|
|
4
|
-
export type DropdownDefaultWidgetOptions = Pick<PerseusDropdownWidgetOptions, "placeholder" | "choices">;
|
|
5
4
|
declare const dropdownWidgetLogic: WidgetLogic<PerseusDropdownWidgetOptions, DropdownPublicWidgetOptions>;
|
|
6
5
|
export default dropdownWidgetLogic;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { PerseusExplanationWidgetOptions } from "../../data-schema";
|
|
2
1
|
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
-
export type ExplanationDefaultWidgetOptions = Pick<PerseusExplanationWidgetOptions, "showPrompt" | "hidePrompt" | "explanation" | "widgets">;
|
|
4
2
|
declare const explanationWidgetLogic: WidgetLogic;
|
|
5
3
|
export default explanationWidgetLogic;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ExpressionPublicWidgetOptions } from "./expression-util";
|
|
2
2
|
import type { PerseusExpressionWidgetOptions } from "../../data-schema";
|
|
3
3
|
import type { WidgetLogic } from "../logic-export.types";
|
|
4
|
-
export type ExpressionDefaultWidgetOptions = Pick<PerseusExpressionWidgetOptions, "answerForms" | "times" | "buttonSets" | "functions">;
|
|
5
4
|
declare const expressionWidgetLogic: WidgetLogic<PerseusExpressionWidgetOptions, ExpressionPublicWidgetOptions>;
|
|
6
5
|
export default expressionWidgetLogic;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { FreeResponsePublicWidgetOptions } from "./free-response-util";
|
|
2
2
|
import type { PerseusFreeResponseWidgetOptions } from "../../data-schema";
|
|
3
3
|
import type { WidgetLogic } from "../logic-export.types";
|
|
4
|
-
export type FreeResponseDefaultWidgetOptions = Pick<PerseusFreeResponseWidgetOptions, "allowUnlimitedCharacters" | "characterLimit" | "placeholder" | "question" | "scoringCriteria">;
|
|
5
4
|
declare const freeResponseWidgetLogic: WidgetLogic<PerseusFreeResponseWidgetOptions, FreeResponsePublicWidgetOptions>;
|
|
6
5
|
export default freeResponseWidgetLogic;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { PerseusGradedGroupWidgetOptions } from "../../data-schema";
|
|
2
1
|
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
-
export type GradedGroupDefaultWidgetOptions = Pick<PerseusGradedGroupWidgetOptions, "title" | "content" | "widgets" | "images" | "hint">;
|
|
4
2
|
declare const gradedGroupWidgetLogic: WidgetLogic;
|
|
5
3
|
export default gradedGroupWidgetLogic;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { PerseusGradedGroupSetWidgetOptions } from "../../data-schema";
|
|
2
1
|
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
-
export type GradedGroupSetDefaultWidgetOptions = Pick<PerseusGradedGroupSetWidgetOptions, "gradedGroups">;
|
|
4
2
|
declare const gradedGroupSetWidgetLogic: WidgetLogic;
|
|
5
3
|
export default gradedGroupSetWidgetLogic;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { GrapherPublicWidgetOptions } from "./grapher-util";
|
|
2
2
|
import type { PerseusGrapherWidgetOptions } from "../../data-schema";
|
|
3
3
|
import type { WidgetLogic } from "../logic-export.types";
|
|
4
|
-
export type GrapherDefaultWidgetOptions = Pick<PerseusGrapherWidgetOptions, "graph" | "correct" | "availableTypes">;
|
|
5
4
|
declare const grapherWidgetLogic: WidgetLogic<PerseusGrapherWidgetOptions, GrapherPublicWidgetOptions>;
|
|
6
5
|
export default grapherWidgetLogic;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { GroupPublicWidgetOptions } from "./group-util";
|
|
2
2
|
import type { PerseusGroupWidgetOptions } from "../../data-schema";
|
|
3
3
|
import type { WidgetLogic } from "../logic-export.types";
|
|
4
|
-
export type GroupDefaultWidgetOptions = Pick<PerseusGroupWidgetOptions, "content" | "widgets" | "images">;
|
|
5
4
|
declare const groupWidgetLogic: WidgetLogic<PerseusGroupWidgetOptions, GroupPublicWidgetOptions>;
|
|
6
5
|
export default groupWidgetLogic;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { PerseusIFrameWidgetOptions } from "../../data-schema";
|
|
2
2
|
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
-
export type IFrameDefaultWidgetOptions = Pick<PerseusIFrameWidgetOptions, "url" | "settings" | "width" | "height" | "allowFullScreen" | "allowTopNavigation">;
|
|
4
3
|
declare const iframeWidgetLogic: WidgetLogic<PerseusIFrameWidgetOptions, PerseusIFrameWidgetOptions>;
|
|
5
4
|
export default iframeWidgetLogic;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { PerseusImageWidgetOptions } from "../../data-schema";
|
|
2
2
|
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
-
export type ImageDefaultWidgetOptions = Pick<PerseusImageWidgetOptions, "title" | "range" | "box" | "backgroundImage" | "scale" | "labels" | "alt" | "caption">;
|
|
4
3
|
declare const imageWidgetLogic: WidgetLogic<PerseusImageWidgetOptions>;
|
|
5
4
|
export default imageWidgetLogic;
|
|
@@ -1,6 +1,5 @@
|
|
|
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 = PerseusInputNumberWidgetOptions;
|
|
5
4
|
declare const inputNumberWidgetLogic: WidgetLogic<PerseusInputNumberWidgetOptions, InputNumberPublicWidgetOptions>;
|
|
6
5
|
export default inputNumberWidgetLogic;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { PerseusInteractionWidgetOptions } from "../../data-schema";
|
|
2
1
|
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
-
export type InteractionDefaultWidgetOptions = Pick<PerseusInteractionWidgetOptions, "graph" | "elements">;
|
|
4
2
|
declare const interactionWidgetLogic: WidgetLogic;
|
|
5
3
|
export default interactionWidgetLogic;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { InteractiveGraphPublicWidgetOptions } from "./interactive-graph-util";
|
|
2
2
|
import type { PerseusInteractiveGraphWidgetOptions } from "../../data-schema";
|
|
3
3
|
import type { WidgetLogic } from "../logic-export.types";
|
|
4
|
-
export type InteractiveGraphDefaultWidgetOptions = Pick<PerseusInteractiveGraphWidgetOptions, "labels" | "labelLocation" | "lockedFigures" | "range" | "step" | "backgroundImage" | "markings" | "showAxisArrows" | "showAxisTicks" | "showTooltips" | "showProtractor" | "graph" | "correct">;
|
|
5
4
|
declare const interactiveGraphWidgetLogic: WidgetLogic<PerseusInteractiveGraphWidgetOptions, InteractiveGraphPublicWidgetOptions>;
|
|
6
5
|
export default interactiveGraphWidgetLogic;
|