@khanacademy/perseus-core 42.3.0 → 42.4.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 +25 -0
- package/dist/index.js +404 -395
- package/dist/index.js.map +1 -1
- package/dist/parse-perseus-json/general-purpose-parsers/object.d.ts +1 -16
- package/dist/parse-perseus-json/perseus-parsers/blank-user-input.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/fill-in-the-blank-user-input.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/sorter-widget.d.ts +9 -0
- package/dist/parse-perseus-json/regression-tests/item-data/sorter-with-legend-and-variant.d.ts +42 -0
- package/dist/parse-perseus-json/regression-tests/item-data/sorter-without-legend-and-variant.d.ts +33 -0
- package/dist/validation.types.d.ts +7 -0
- package/dist/widgets/sorter/sorter-util.d.ts +2 -0
- package/package.json +1 -1
|
@@ -6,24 +6,9 @@ type ObjectSchema = Record<keyof any, Parser<any>>;
|
|
|
6
6
|
* iff each sub-parser in the `schema` accepts the object's corresponding
|
|
7
7
|
* property value.
|
|
8
8
|
*
|
|
9
|
-
* The returned parser filters out properties not present in the schema.
|
|
10
|
-
* you don't want this behavior, try `looseObject`.
|
|
9
|
+
* The returned parser filters out properties not present in the schema.
|
|
11
10
|
*/
|
|
12
11
|
export declare function object<S extends ObjectSchema>(schema: S): Parser<OptionalizeProperties<{
|
|
13
12
|
[K in keyof S]: ParsedValue<S[K]>;
|
|
14
13
|
}>>;
|
|
15
|
-
/**
|
|
16
|
-
* Given a `schema`, returns an object parser. The parser accepts an object
|
|
17
|
-
* iff each sub-parser in the `schema` accepts the object's corresponding
|
|
18
|
-
* property value.
|
|
19
|
-
*
|
|
20
|
-
* The parser preserves any object properties not present in the schema. If
|
|
21
|
-
* you want unrecognized properties to be filtered out instead, try `object`.
|
|
22
|
-
*
|
|
23
|
-
* @internal
|
|
24
|
-
* Only used in tests.
|
|
25
|
-
*/
|
|
26
|
-
export declare function looseObject<S extends ObjectSchema>(schema: S): Parser<OptionalizeProperties<{
|
|
27
|
-
[K in keyof S]: ParsedValue<S[K]>;
|
|
28
|
-
}>>;
|
|
29
14
|
export {};
|
|
@@ -7,6 +7,15 @@ export declare const parseSorterWidget: import("../parser-types").Parser<import(
|
|
|
7
7
|
correct: string[];
|
|
8
8
|
padding: boolean;
|
|
9
9
|
layout: "horizontal" | "vertical";
|
|
10
|
+
variant: "scale" | "timeline";
|
|
11
|
+
legend: import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
|
12
|
+
startCap: "none" | "bar" | "arrow";
|
|
13
|
+
endCap: "none" | "bar" | "arrow";
|
|
14
|
+
startLabel: string;
|
|
15
|
+
endLabel: string;
|
|
16
|
+
ariaLabel: string;
|
|
17
|
+
position: "above" | "below";
|
|
18
|
+
}> | undefined;
|
|
10
19
|
}>;
|
|
11
20
|
key: number | null | undefined;
|
|
12
21
|
version: import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
package/dist/parse-perseus-json/regression-tests/item-data/sorter-with-legend-and-variant.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
question: {
|
|
3
|
+
content: string;
|
|
4
|
+
images: {};
|
|
5
|
+
widgets: {
|
|
6
|
+
"sorter 1": {
|
|
7
|
+
type: string;
|
|
8
|
+
alignment: string;
|
|
9
|
+
static: boolean;
|
|
10
|
+
graded: boolean;
|
|
11
|
+
options: {
|
|
12
|
+
correct: string[];
|
|
13
|
+
layout: string;
|
|
14
|
+
padding: boolean;
|
|
15
|
+
variant: string;
|
|
16
|
+
legend: {
|
|
17
|
+
startCap: string;
|
|
18
|
+
endCap: string;
|
|
19
|
+
startLabel: string;
|
|
20
|
+
endLabel: string;
|
|
21
|
+
ariaLabel: string;
|
|
22
|
+
position: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
version: {
|
|
26
|
+
major: number;
|
|
27
|
+
minor: number;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
answerArea: {
|
|
33
|
+
calculator: boolean;
|
|
34
|
+
financialCalculatorMonthlyPayment: boolean;
|
|
35
|
+
financialCalculatorTotalAmount: boolean;
|
|
36
|
+
financialCalculatorTimeToPayOff: boolean;
|
|
37
|
+
periodicTable: boolean;
|
|
38
|
+
periodicTableWithKey: boolean;
|
|
39
|
+
};
|
|
40
|
+
hints: never[];
|
|
41
|
+
};
|
|
42
|
+
export default _default;
|
package/dist/parse-perseus-json/regression-tests/item-data/sorter-without-legend-and-variant.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
question: {
|
|
3
|
+
content: string;
|
|
4
|
+
images: {};
|
|
5
|
+
widgets: {
|
|
6
|
+
"sorter 1": {
|
|
7
|
+
type: string;
|
|
8
|
+
alignment: string;
|
|
9
|
+
static: boolean;
|
|
10
|
+
graded: boolean;
|
|
11
|
+
options: {
|
|
12
|
+
correct: string[];
|
|
13
|
+
layout: string;
|
|
14
|
+
padding: boolean;
|
|
15
|
+
};
|
|
16
|
+
version: {
|
|
17
|
+
major: number;
|
|
18
|
+
minor: number;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
answerArea: {
|
|
24
|
+
calculator: boolean;
|
|
25
|
+
financialCalculatorMonthlyPayment: boolean;
|
|
26
|
+
financialCalculatorTotalAmount: boolean;
|
|
27
|
+
financialCalculatorTimeToPayOff: boolean;
|
|
28
|
+
periodicTable: boolean;
|
|
29
|
+
periodicTableWithKey: boolean;
|
|
30
|
+
};
|
|
31
|
+
hints: never[];
|
|
32
|
+
};
|
|
33
|
+
export default _default;
|
|
@@ -148,6 +148,11 @@ export type PerseusDropdownUserInput = {
|
|
|
148
148
|
* string the learner typed, parsed by @khanacademy/kas for scoring.
|
|
149
149
|
*/
|
|
150
150
|
export type PerseusExpressionUserInput = string;
|
|
151
|
+
/**
|
|
152
|
+
* User input for the Fill in the Blank widget: a map of blank widget IDs
|
|
153
|
+
* to each blank's user input.
|
|
154
|
+
*/
|
|
155
|
+
export type PerseusFillInTheBlankUserInput = Record<string, PerseusBlankUserInput>;
|
|
151
156
|
/**
|
|
152
157
|
* User input for the Group widget: a map of widget IDs to each widget's user
|
|
153
158
|
* input. Scored by recursively scoring all contained widgets.
|
|
@@ -294,10 +299,12 @@ export type PerseusTableUserInput = string[][];
|
|
|
294
299
|
* explanation.
|
|
295
300
|
*/
|
|
296
301
|
interface UserInputRegistry {
|
|
302
|
+
blank: PerseusBlankUserInput;
|
|
297
303
|
categorizer: PerseusCategorizerUserInput;
|
|
298
304
|
"cs-program": PerseusCSProgramUserInput;
|
|
299
305
|
dropdown: PerseusDropdownUserInput;
|
|
300
306
|
expression: PerseusExpressionUserInput;
|
|
307
|
+
"fill-in-the-blank": PerseusFillInTheBlankUserInput;
|
|
301
308
|
"free-response": PerseusFreeResponseUserInput;
|
|
302
309
|
grapher: PerseusGrapherUserInput;
|
|
303
310
|
group: PerseusGroupUserInput;
|
|
@@ -20,6 +20,8 @@ export type SorterPublicWidgetOptions = {
|
|
|
20
20
|
* TODO(LEMS-4535): rename this
|
|
21
21
|
*/
|
|
22
22
|
correct: PerseusSorterWidgetOptions["correct"];
|
|
23
|
+
variant: PerseusSorterWidgetOptions["variant"];
|
|
24
|
+
legend?: PerseusSorterWidgetOptions["legend"];
|
|
23
25
|
/**
|
|
24
26
|
* @deprecated
|
|
25
27
|
*
|