@khanacademy/perseus 41.2.0 → 41.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/all-widgets.d.ts +1 -1
- package/dist/article-renderer.d.ts +2 -2
- package/dist/basic-widgets.d.ts +1 -1
- package/dist/es/index.js +1643 -354
- package/dist/es/index.js.map +1 -1
- package/dist/extra-widgets.d.ts +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.js +1562 -272
- package/dist/index.js.map +1 -1
- package/dist/perseus-api.d.ts +3 -3
- package/dist/perseus-types.d.ts +7 -2
- package/dist/prompt-types.d.ts +33 -0
- package/dist/renderer.d.ts +8 -2
- package/dist/server-item-renderer.d.ts +6 -4
- package/dist/types.d.ts +4 -2
- package/dist/util/answer-types.d.ts +45 -2
- package/dist/util/parse-perseus-json/error-tracking-parse-context.d.ts +9 -0
- package/dist/util/parse-perseus-json/general-purpose-parsers/any.d.ts +2 -0
- package/dist/util/parse-perseus-json/general-purpose-parsers/array.d.ts +2 -0
- package/dist/util/parse-perseus-json/general-purpose-parsers/array.typetest.d.ts +1 -0
- package/dist/util/parse-perseus-json/general-purpose-parsers/boolean.d.ts +2 -0
- package/dist/util/parse-perseus-json/general-purpose-parsers/compose-parsers.d.ts +2 -0
- package/dist/util/parse-perseus-json/general-purpose-parsers/constant.d.ts +4 -0
- package/dist/util/parse-perseus-json/general-purpose-parsers/defaulted.d.ts +2 -0
- package/dist/util/parse-perseus-json/general-purpose-parsers/enumeration.d.ts +2 -0
- package/dist/util/parse-perseus-json/general-purpose-parsers/enumeration.typetest.d.ts +1 -0
- package/dist/util/parse-perseus-json/general-purpose-parsers/index.d.ts +15 -0
- package/dist/util/parse-perseus-json/general-purpose-parsers/is-object.d.ts +1 -0
- package/dist/util/parse-perseus-json/general-purpose-parsers/nullable.d.ts +2 -0
- package/dist/util/parse-perseus-json/general-purpose-parsers/number.d.ts +2 -0
- package/dist/util/parse-perseus-json/general-purpose-parsers/object.d.ts +6 -0
- package/dist/util/parse-perseus-json/general-purpose-parsers/optional.d.ts +2 -0
- package/dist/util/parse-perseus-json/general-purpose-parsers/pair.d.ts +2 -0
- package/dist/util/parse-perseus-json/general-purpose-parsers/record.d.ts +2 -0
- package/dist/util/parse-perseus-json/general-purpose-parsers/string.d.ts +2 -0
- package/dist/util/parse-perseus-json/general-purpose-parsers/test-helpers.d.ts +8 -0
- package/dist/util/parse-perseus-json/general-purpose-parsers/trio.d.ts +2 -0
- package/dist/util/parse-perseus-json/general-purpose-parsers/union.d.ts +7 -0
- package/dist/util/parse-perseus-json/general-purpose-parsers/union.typetest.d.ts +1 -0
- package/dist/util/{parse-perseus-json.d.ts → parse-perseus-json/index.d.ts} +7 -1
- package/dist/util/parse-perseus-json/object-path.d.ts +2 -0
- package/dist/util/parse-perseus-json/parse-failure-detail.d.ts +2 -0
- package/dist/util/parse-perseus-json/parse.d.ts +3 -0
- package/dist/util/parse-perseus-json/parser-types.d.ts +30 -0
- package/dist/util/parse-perseus-json/perseus-parsers/categorizer-widget.d.ts +3 -0
- package/dist/util/parse-perseus-json/perseus-parsers/cs-program-widget.d.ts +3 -0
- package/dist/util/parse-perseus-json/perseus-parsers/definition-widget.d.ts +3 -0
- package/dist/util/parse-perseus-json/perseus-parsers/dropdown-widget.d.ts +3 -0
- package/dist/util/parse-perseus-json/perseus-parsers/explanation-widget.d.ts +3 -0
- package/dist/util/parse-perseus-json/perseus-parsers/expression-widget.d.ts +3 -0
- package/dist/util/parse-perseus-json/perseus-parsers/hint.d.ts +3 -0
- package/dist/util/parse-perseus-json/perseus-parsers/interactive-graph-widget.d.ts +3 -0
- package/dist/util/parse-perseus-json/perseus-parsers/perseus-image-background.d.ts +3 -0
- package/dist/util/parse-perseus-json/perseus-parsers/perseus-item.d.ts +3 -0
- package/dist/util/parse-perseus-json/perseus-parsers/perseus-renderer.d.ts +3 -0
- package/dist/util/parse-perseus-json/perseus-parsers/widget.d.ts +3 -0
- package/dist/util/parse-perseus-json/perseus-parsers/widgets-map.d.ts +3 -0
- package/dist/util/parse-perseus-json/result.d.ts +16 -0
- package/dist/validation.types.d.ts +4 -5
- package/dist/widget-ai-utils/categorizer/prompt-utils.d.ts +14 -0
- package/dist/widget-ai-utils/cs-program/prompt-utils.d.ts +2 -0
- package/dist/widget-ai-utils/definition/prompt-utils.d.ts +8 -0
- package/dist/widget-ai-utils/dropdown/prompt-utils.d.ts +13 -0
- package/dist/widget-ai-utils/explanation/prompt-utils.d.ts +8 -0
- package/dist/widget-ai-utils/expression/prompt-utils.d.ts +11 -0
- package/dist/widget-ai-utils/graded-group/prompt-utils.d.ts +7 -0
- package/dist/widget-ai-utils/graded-group-set/prompt-utils.d.ts +11 -0
- package/dist/widget-ai-utils/grapher/prompt-utils.d.ts +18 -0
- package/dist/widget-ai-utils/group/prompt-utils.d.ts +5 -0
- package/dist/widget-ai-utils/iframe/prompt-utils.d.ts +2 -0
- package/dist/widget-ai-utils/image/prompt-utils.d.ts +12 -0
- package/dist/widget-ai-utils/input-number/prompt-utils.d.ts +14 -0
- package/dist/widget-ai-utils/interaction/prompt-utils.d.ts +2 -0
- package/dist/widget-ai-utils/interactive-graph/prompt-utils.d.ts +94 -0
- package/dist/widget-ai-utils/label-image/prompt-utils.d.ts +24 -0
- package/dist/widget-ai-utils/matcher/prompt-utils.d.ts +17 -0
- package/dist/widget-ai-utils/matrix/prompt-utils.d.ts +14 -0
- package/dist/widget-ai-utils/measurer/prompt-utils.d.ts +2 -0
- package/dist/widget-ai-utils/number-line/prompt-utils.d.ts +16 -0
- package/dist/widget-ai-utils/numeric-input/prompt-utils.d.ts +11 -0
- package/dist/widget-ai-utils/orderer/prompt-utils.d.ts +13 -0
- package/dist/widget-ai-utils/passage/prompt-utils.d.ts +11 -0
- package/dist/widget-ai-utils/passage-ref/prompt-utils.d.ts +11 -0
- package/dist/widget-ai-utils/phet-simulation/prompt-utils.d.ts +2 -0
- package/dist/widget-ai-utils/plotter/prompt-utils.d.ts +2 -0
- package/dist/widget-ai-utils/python-program/prompt-utils.d.ts +2 -0
- package/dist/widget-ai-utils/radio/prompt-utils.d.ts +15 -0
- package/dist/widget-ai-utils/sorter/prompt-utils.d.ts +9 -0
- package/dist/widget-ai-utils/unsupported-widget.d.ts +11 -0
- package/dist/widget-ai-utils/video/prompt-utils.d.ts +2 -0
- package/dist/widgets/__shared__/{noop-validator.d.ts → score-noop.d.ts} +4 -4
- package/dist/widgets/categorizer/categorizer.d.ts +10 -19
- package/dist/widgets/categorizer/{categorizer-validator.d.ts → score-categorizer.d.ts} +2 -2
- package/dist/widgets/cs-program/cs-program.d.ts +8 -19
- package/dist/widgets/cs-program/{cs-program-validator.d.ts → score-cs-program.d.ts} +2 -1
- package/dist/widgets/definition/definition.d.ts +8 -19
- package/dist/widgets/deprecated-standin/deprecated-standin.d.ts +4 -19
- package/dist/widgets/dropdown/dropdown.d.ts +10 -19
- package/dist/widgets/dropdown/score-dropdown.d.ts +4 -0
- package/dist/widgets/explanation/explanation.d.ts +9 -19
- package/dist/widgets/expression/expression.d.ts +26 -290
- package/dist/widgets/expression/{expression-validator.d.ts → score-expression.d.ts} +2 -2
- package/dist/widgets/graded-group/graded-group.d.ts +13 -21
- package/dist/widgets/graded-group-set/graded-group-set.d.ts +9 -20
- package/dist/widgets/grapher/grapher.d.ts +9 -19
- package/dist/widgets/grapher/score-grapher.d.ts +4 -0
- package/dist/widgets/group/group.d.ts +7 -19
- package/dist/widgets/iframe/iframe.d.ts +7 -19
- package/dist/widgets/iframe/{iframe-validator.d.ts → score-iframe.d.ts} +1 -1
- package/dist/widgets/image/image.d.ts +9 -19
- package/dist/widgets/input-number/input-number.d.ts +11 -19
- package/dist/widgets/input-number/{input-number-validator.d.ts → score-input-number.d.ts} +2 -2
- package/dist/widgets/interaction/interaction.d.ts +7 -19
- package/dist/widgets/interactive-graph.d.ts +8 -19
- package/dist/widgets/interactive-graphs/score-interactive-graph.d.ts +4 -0
- package/dist/widgets/interactive-graphs/utils.d.ts +1 -1
- package/dist/widgets/label-image/label-image.d.ts +10 -86
- package/dist/widgets/label-image/{label-image-validator.d.ts → score-label-image.d.ts} +2 -2
- package/dist/widgets/matcher/matcher.d.ts +7 -19
- package/dist/widgets/matcher/score-matcher.d.ts +4 -0
- package/dist/widgets/matrix/matrix.d.ts +10 -19
- package/dist/widgets/matrix/{matrix-validator.d.ts → score-matrix.d.ts} +2 -2
- package/dist/widgets/measurer/measurer.d.ts +13 -19
- package/dist/widgets/molecule/molecule.d.ts +4 -19
- package/dist/widgets/number-line/number-line.d.ts +8 -19
- package/dist/widgets/number-line/score-number-line.d.ts +4 -0
- package/dist/widgets/numeric-input/numeric-input.d.ts +22 -19
- package/dist/widgets/numeric-input/{numeric-input-validator.d.ts → score-numeric-input.d.ts} +2 -2
- package/dist/widgets/orderer/orderer.d.ts +8 -19
- package/dist/widgets/orderer/{orderer-validator.d.ts → score-orderer.d.ts} +1 -1
- package/dist/widgets/passage/passage.d.ts +8 -19
- package/dist/widgets/passage-ref/passage-ref.d.ts +12 -19
- package/dist/widgets/passage-ref-target/passage-ref-target.d.ts +11 -19
- package/dist/widgets/phet-simulation/phet-simulation.d.ts +5 -19
- package/dist/widgets/plotter/plotter.d.ts +8 -19
- package/dist/widgets/plotter/score-plotter.d.ts +4 -0
- package/dist/widgets/python-program/python-program.d.ts +4 -19
- package/dist/widgets/radio/radio-component.d.ts +3 -1
- package/dist/widgets/radio/radio.d.ts +18 -19
- package/dist/widgets/radio/{radio-validator.d.ts → score-radio.d.ts} +2 -2
- package/dist/widgets/sorter/score-sorter.d.ts +4 -0
- package/dist/widgets/sorter/sorter.d.ts +7 -19
- package/dist/widgets/table/{table-validator.d.ts → score-table.d.ts} +2 -2
- package/dist/widgets/table/table.d.ts +8 -19
- package/dist/widgets/table/utils.d.ts +7 -0
- package/dist/widgets/table/validate-table.d.ts +6 -0
- package/dist/widgets/video/video.d.ts +7 -19
- package/dist/widgets.d.ts +2 -2
- package/package.json +5 -5
- package/dist/widgets/dropdown/dropdown-validator.d.ts +0 -4
- package/dist/widgets/grapher/grapher-validator.d.ts +0 -4
- package/dist/widgets/interactive-graphs/interactive-graph-validator.d.ts +0 -4
- package/dist/widgets/matcher/matcher-validator.d.ts +0 -4
- package/dist/widgets/number-line/number-line-validator.d.ts +0 -4
- package/dist/widgets/plotter/plotter-validator.d.ts +0 -4
- package/dist/widgets/sorter/sorter-validator.d.ts +0 -4
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type explanation from "../../widgets/explanation/explanation";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
export type ExplanationPromptJSON = {
|
|
4
|
+
type: "explanation";
|
|
5
|
+
showPrompt: string;
|
|
6
|
+
explanation: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const getPromptJSON: (renderProps: React.ComponentProps<typeof explanation.widget>) => ExplanationPromptJSON;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PerseusExpressionUserInput } from "../../validation.types";
|
|
2
|
+
import type expression from "../../widgets/expression/expression";
|
|
3
|
+
import type React from "react";
|
|
4
|
+
export type ExpressionPromptJSON = {
|
|
5
|
+
type: "expression";
|
|
6
|
+
label?: string;
|
|
7
|
+
userInput: {
|
|
8
|
+
value: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare const getPromptJSON: (renderProps: React.ComponentProps<typeof expression.widget>, userInput: PerseusExpressionUserInput) => ExpressionPromptJSON;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { RendererPromptJSON } from "../../prompt-types";
|
|
2
|
+
export type GradedGroupPromptJSON = RendererPromptJSON & {
|
|
3
|
+
type: "graded-group";
|
|
4
|
+
title: string;
|
|
5
|
+
hint: RendererPromptJSON | string;
|
|
6
|
+
};
|
|
7
|
+
export declare const getPromptJSON: (title: string, rendererJSON: RendererPromptJSON | undefined, hintRendererJSON: RendererPromptJSON) => GradedGroupPromptJSON;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type gradedGroupSet from "../../widgets/graded-group-set";
|
|
2
|
+
import type { GradedGroupPromptJSON } from "../graded-group/prompt-utils";
|
|
3
|
+
import type React from "react";
|
|
4
|
+
export type GradedGroupSetPromptJSON = {
|
|
5
|
+
type: "graded-group-set";
|
|
6
|
+
options: {
|
|
7
|
+
groupCount: number;
|
|
8
|
+
currentGroup: GradedGroupPromptJSON;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare const getPromptJSON: (renderProps: React.ComponentProps<typeof gradedGroupSet.widget>, activeGroupJSON: GradedGroupPromptJSON) => GradedGroupSetPromptJSON;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { GrapherAnswerTypes } from "../../perseus-types";
|
|
2
|
+
import type { PerseusGrapherUserInput } from "../../validation.types";
|
|
3
|
+
import type grapher from "../../widgets/grapher/grapher";
|
|
4
|
+
import type React from "react";
|
|
5
|
+
export type GrapherPromptJSON = {
|
|
6
|
+
type: "grapher";
|
|
7
|
+
options: {
|
|
8
|
+
availableTypes: ReadonlyArray<string>;
|
|
9
|
+
range: [x: [min: number, max: number], y: [min: number, max: number]];
|
|
10
|
+
labels: ReadonlyArray<string>;
|
|
11
|
+
tickStep: [number, number];
|
|
12
|
+
gridStep?: [number, number];
|
|
13
|
+
snapStep?: [number, number];
|
|
14
|
+
backgroundImageUrl?: string | null;
|
|
15
|
+
};
|
|
16
|
+
userInput: GrapherAnswerTypes;
|
|
17
|
+
};
|
|
18
|
+
export declare const getPromptJSON: (renderProps: React.ComponentProps<typeof grapher.widget>, userInput: PerseusGrapherUserInput) => GrapherPromptJSON;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type image from "../../widgets/image/image";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
export type ImagePromptJSON = {
|
|
4
|
+
type: "image";
|
|
5
|
+
options: {
|
|
6
|
+
altText: string;
|
|
7
|
+
title: string;
|
|
8
|
+
caption: string;
|
|
9
|
+
imageUrl: string | null | undefined;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export declare const getPromptJSON: (renderProps: React.ComponentProps<typeof image.widget>) => ImagePromptJSON;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PerseusInputNumberUserInput } from "../../validation.types";
|
|
2
|
+
import type inputNumber from "../../widgets/input-number/input-number";
|
|
3
|
+
import type React from "react";
|
|
4
|
+
export type InputNumberPromptJSON = {
|
|
5
|
+
type: "input-number";
|
|
6
|
+
options: {
|
|
7
|
+
simplify: string;
|
|
8
|
+
answerType: string;
|
|
9
|
+
};
|
|
10
|
+
userInput: {
|
|
11
|
+
value: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export declare const getPromptJSON: (renderProps: React.ComponentProps<typeof inputNumber.widget>, userInput: PerseusInputNumberUserInput) => InputNumberPromptJSON;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { PerseusGraphType } from "../../perseus-types";
|
|
2
|
+
import type interactiveGraph from "../../widgets/interactive-graph";
|
|
3
|
+
import type { UnsupportedWidgetPromptJSON } from "../unsupported-widget";
|
|
4
|
+
import type React from "react";
|
|
5
|
+
type Coord = [x: number, y: number];
|
|
6
|
+
type CollinearTuple = readonly [Coord, Coord];
|
|
7
|
+
type BaseGraphOptions = {
|
|
8
|
+
type: string;
|
|
9
|
+
};
|
|
10
|
+
type AngleGraphOptions = BaseGraphOptions & {
|
|
11
|
+
angleOffsetDegrees: number;
|
|
12
|
+
startCoords?: readonly [Coord, Coord, Coord];
|
|
13
|
+
};
|
|
14
|
+
type CircleGraphOptions = BaseGraphOptions & {
|
|
15
|
+
startParams: {
|
|
16
|
+
center?: Coord;
|
|
17
|
+
radius?: number;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
type LinearGraphOptions = BaseGraphOptions & {
|
|
21
|
+
startCoords?: CollinearTuple;
|
|
22
|
+
};
|
|
23
|
+
type LinearSystemGraphOptions = BaseGraphOptions & {
|
|
24
|
+
startCoords?: readonly CollinearTuple[];
|
|
25
|
+
};
|
|
26
|
+
type PointGraphOptions = BaseGraphOptions & {
|
|
27
|
+
numPoints?: number | "unlimited";
|
|
28
|
+
startCoords?: readonly Coord[];
|
|
29
|
+
};
|
|
30
|
+
type PolygonGraphOptions = BaseGraphOptions & {
|
|
31
|
+
match?: string;
|
|
32
|
+
numSides?: number | "unlimited";
|
|
33
|
+
startCoords?: readonly Coord[];
|
|
34
|
+
};
|
|
35
|
+
type QuadraticGraphOptions = BaseGraphOptions & {
|
|
36
|
+
startCoords?: readonly [Coord, Coord, Coord];
|
|
37
|
+
};
|
|
38
|
+
type RayGraphOptions = BaseGraphOptions & {
|
|
39
|
+
startCoords?: CollinearTuple;
|
|
40
|
+
};
|
|
41
|
+
type SegmentGraphOptions = BaseGraphOptions & {
|
|
42
|
+
numSegments?: number;
|
|
43
|
+
startCoords?: CollinearTuple;
|
|
44
|
+
};
|
|
45
|
+
type SinusoidGraphOptions = BaseGraphOptions & {
|
|
46
|
+
startCoords?: readonly Coord[];
|
|
47
|
+
};
|
|
48
|
+
type NoneGraphOptions = Record<string, never>;
|
|
49
|
+
type GraphOptions = AngleGraphOptions | CircleGraphOptions | LinearGraphOptions | LinearSystemGraphOptions | NoneGraphOptions | PointGraphOptions | PolygonGraphOptions | QuadraticGraphOptions | RayGraphOptions | SegmentGraphOptions | SinusoidGraphOptions;
|
|
50
|
+
type AngleUserInput = {
|
|
51
|
+
coords?: readonly [Coord, Coord, Coord];
|
|
52
|
+
angleOffsetDegrees?: number;
|
|
53
|
+
};
|
|
54
|
+
type CircleUserInput = {
|
|
55
|
+
center?: Coord;
|
|
56
|
+
radius?: number;
|
|
57
|
+
};
|
|
58
|
+
type LinearUserInput = {
|
|
59
|
+
coords?: CollinearTuple;
|
|
60
|
+
};
|
|
61
|
+
type LinearSystemInput = {
|
|
62
|
+
coords?: readonly CollinearTuple[] | null;
|
|
63
|
+
};
|
|
64
|
+
type PointUserInput = {
|
|
65
|
+
coords?: readonly Coord[] | null;
|
|
66
|
+
};
|
|
67
|
+
type PolygonUserInput = {
|
|
68
|
+
coords?: readonly Coord[] | null;
|
|
69
|
+
};
|
|
70
|
+
type QuadraticUserInput = {
|
|
71
|
+
coords?: readonly [Coord, Coord, Coord] | null;
|
|
72
|
+
};
|
|
73
|
+
type RayUserInput = {
|
|
74
|
+
coords?: CollinearTuple | null;
|
|
75
|
+
};
|
|
76
|
+
type SegmentUserInput = {
|
|
77
|
+
coords?: readonly CollinearTuple[] | null;
|
|
78
|
+
};
|
|
79
|
+
type SinusoidUserInput = {
|
|
80
|
+
coords?: readonly Coord[] | null;
|
|
81
|
+
};
|
|
82
|
+
type UserInput = AngleUserInput | CircleUserInput | LinearUserInput | LinearSystemInput | PointUserInput | PolygonUserInput | QuadraticUserInput | RayUserInput | SegmentUserInput | SinusoidUserInput;
|
|
83
|
+
export type InteractiveGraphPromptJSON = {
|
|
84
|
+
type: "interactive-graph";
|
|
85
|
+
options: {
|
|
86
|
+
graph: GraphOptions;
|
|
87
|
+
backgroundImageUrl: string | null | undefined;
|
|
88
|
+
range: [min: number, max: number][];
|
|
89
|
+
labels: ReadonlyArray<string>;
|
|
90
|
+
};
|
|
91
|
+
userInput: UserInput;
|
|
92
|
+
};
|
|
93
|
+
export declare const getPromptJSON: (props: React.ComponentProps<typeof interactiveGraph.widget>, userInput: PerseusGraphType) => InteractiveGraphPromptJSON | UnsupportedWidgetPromptJSON;
|
|
94
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { PerseusLabelImageUserInput } from "../../validation.types";
|
|
2
|
+
import type labelImage from "../../widgets/label-image/label-image";
|
|
3
|
+
import type React from "react";
|
|
4
|
+
type BaseMarker = {
|
|
5
|
+
label: string;
|
|
6
|
+
};
|
|
7
|
+
type UserInputMarker = {
|
|
8
|
+
label: string;
|
|
9
|
+
selected?: ReadonlyArray<string>;
|
|
10
|
+
};
|
|
11
|
+
export type LabelImagePromptJSON = {
|
|
12
|
+
type: "label-image";
|
|
13
|
+
options: {
|
|
14
|
+
choices: ReadonlyArray<string>;
|
|
15
|
+
imageUrl: string;
|
|
16
|
+
imageAlt: string;
|
|
17
|
+
markers: BaseMarker[];
|
|
18
|
+
};
|
|
19
|
+
userInput: {
|
|
20
|
+
markers: UserInputMarker[];
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export declare const getPromptJSON: (renderProps: React.ComponentProps<typeof labelImage.widget>, userInput: PerseusLabelImageUserInput) => LabelImagePromptJSON;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PerseusMatcherUserInput } from "../../validation.types";
|
|
2
|
+
import type matcher from "../../widgets/matcher/matcher";
|
|
3
|
+
import type React from "react";
|
|
4
|
+
export type MatcherPromptJSON = {
|
|
5
|
+
type: "matcher";
|
|
6
|
+
options: {
|
|
7
|
+
labels: ReadonlyArray<string>;
|
|
8
|
+
left: ReadonlyArray<string>;
|
|
9
|
+
right: ReadonlyArray<string>;
|
|
10
|
+
orderMatters: boolean;
|
|
11
|
+
};
|
|
12
|
+
userInput: {
|
|
13
|
+
left: ReadonlyArray<string>;
|
|
14
|
+
right: ReadonlyArray<string>;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export declare const getPromptJSON: (renderProps: React.ComponentProps<typeof matcher.widget>, userInput: PerseusMatcherUserInput) => MatcherPromptJSON;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PerseusMatrixUserInput } from "../../validation.types";
|
|
2
|
+
import type matrix from "../../widgets/matrix/matrix";
|
|
3
|
+
import type React from "react";
|
|
4
|
+
export type MatrixPromptJSON = {
|
|
5
|
+
type: "matrix";
|
|
6
|
+
options: {
|
|
7
|
+
height: number;
|
|
8
|
+
width: number;
|
|
9
|
+
};
|
|
10
|
+
userInput: {
|
|
11
|
+
answerRows: ReadonlyArray<ReadonlyArray<number>>;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export declare const getPromptJSON: (renderProps: React.ComponentProps<typeof matrix.widget>, userInput: PerseusMatrixUserInput) => MatrixPromptJSON;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PerseusNumberLineUserInput } from "../../validation.types";
|
|
2
|
+
import type numberLine from "../../widgets/number-line/number-line";
|
|
3
|
+
import type React from "react";
|
|
4
|
+
export type NumberLinePromptJSON = {
|
|
5
|
+
type: "number-line";
|
|
6
|
+
options: {
|
|
7
|
+
range: ReadonlyArray<number>;
|
|
8
|
+
numDivisions: number;
|
|
9
|
+
snapDivisions: number;
|
|
10
|
+
};
|
|
11
|
+
userInput: {
|
|
12
|
+
numLinePosition: number;
|
|
13
|
+
numDivisions: number;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare const getPromptJSON: (renderProps: React.ComponentProps<typeof numberLine.widget>, userInput: PerseusNumberLineUserInput) => NumberLinePromptJSON;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PerseusNumericInputUserInput } from "../../validation.types";
|
|
2
|
+
import type numericInput from "../../widgets/numeric-input/numeric-input";
|
|
3
|
+
import type React from "react";
|
|
4
|
+
export type NumericInputPromptJSON = {
|
|
5
|
+
type: "numeric-input";
|
|
6
|
+
label: string;
|
|
7
|
+
userInput: {
|
|
8
|
+
value: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare const getPromptJSON: (renderProps: React.ComponentProps<typeof numericInput.widget>, userInput: PerseusNumericInputUserInput) => NumericInputPromptJSON;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PerseusOrdererUserInput } from "../../validation.types";
|
|
2
|
+
import type orderer from "../../widgets/orderer/orderer";
|
|
3
|
+
import type React from "react";
|
|
4
|
+
export type OrdererPromptJSON = {
|
|
5
|
+
type: "orderer";
|
|
6
|
+
options: {
|
|
7
|
+
options: ReadonlyArray<string>;
|
|
8
|
+
};
|
|
9
|
+
userInput: {
|
|
10
|
+
values: ReadonlyArray<string>;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare const getPromptJSON: (renderProps: React.ComponentProps<typeof orderer.widget>, userInput: PerseusOrdererUserInput) => OrdererPromptJSON;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type passage from "../../widgets/passage/passage";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
export type PassagePromptJSON = {
|
|
4
|
+
type: "passage";
|
|
5
|
+
options: {
|
|
6
|
+
passageTitle: string;
|
|
7
|
+
passageText: string;
|
|
8
|
+
footnotes: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare const getPromptJSON: (renderProps: React.ComponentProps<typeof passage.widget>) => PassagePromptJSON;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type passageRef from "../../widgets/passage-ref/passage-ref";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
export type PassageRefPromptJSON = {
|
|
4
|
+
type: "passage-ref";
|
|
5
|
+
options: {
|
|
6
|
+
passageNumber: number;
|
|
7
|
+
referenceNumber: number;
|
|
8
|
+
summaryText: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare const getPromptJSON: (renderProps: React.ComponentProps<typeof passageRef.widget>) => PassageRefPromptJSON;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PerseusRadioUserInput } from "../../validation.types";
|
|
2
|
+
import type radio from "../../widgets/radio/radio";
|
|
3
|
+
import type React from "react";
|
|
4
|
+
export type BasicOption = {
|
|
5
|
+
value: string;
|
|
6
|
+
};
|
|
7
|
+
export type RadioPromptJSON = {
|
|
8
|
+
type: "radio";
|
|
9
|
+
hasNoneOfTheAbove: boolean;
|
|
10
|
+
options: BasicOption[];
|
|
11
|
+
userInput: {
|
|
12
|
+
selectedOptions: ReadonlyArray<boolean>;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare const getPromptJSON: (renderProps: React.ComponentProps<typeof radio.widget>, userInput: PerseusRadioUserInput) => RadioPromptJSON;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PerseusSorterUserInput } from "../../validation.types";
|
|
2
|
+
export type SorterPromptJSON = {
|
|
3
|
+
type: "sorter";
|
|
4
|
+
userInput: {
|
|
5
|
+
values: ReadonlyArray<string>;
|
|
6
|
+
changed: boolean;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export declare const getPromptJSON: (userInput: PerseusSorterUserInput) => SorterPromptJSON;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { UnsupportedWidget } from "../prompt-types";
|
|
2
|
+
export type UnsupportedWidgetPromptJSON = {
|
|
3
|
+
type: UnsupportedWidget;
|
|
4
|
+
message?: string;
|
|
5
|
+
isSupported: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const getUnsupportedPromptJSON: (widgetType: UnsupportedWidget, message?: string) => {
|
|
8
|
+
type: UnsupportedWidget;
|
|
9
|
+
isSupported: boolean;
|
|
10
|
+
message: string;
|
|
11
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { PerseusScore } from "../../types";
|
|
2
2
|
/**
|
|
3
|
-
* Several widgets don't have "right"/"wrong"
|
|
3
|
+
* Several widgets don't have "right"/"wrong" scoring logic,
|
|
4
4
|
* so this just says to move on past those widgets
|
|
5
5
|
*
|
|
6
6
|
* TODO(LEMS-2543) widgets that use this probably shouldn't have any
|
|
7
|
-
*
|
|
7
|
+
* scoring logic and the thing scoring an exercise
|
|
8
8
|
* should just know to skip these
|
|
9
9
|
*/
|
|
10
|
-
declare function
|
|
11
|
-
export default
|
|
10
|
+
declare function scoreNoop(points?: number): PerseusScore;
|
|
11
|
+
export default scoreNoop;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
|
+
import scoreCategorizer from "./score-categorizer";
|
|
3
4
|
import type { PerseusCategorizerWidgetOptions } from "../../perseus-types";
|
|
4
5
|
import type { Widget, WidgetProps } from "../../types";
|
|
5
6
|
import type { PerseusCategorizerRubric, PerseusCategorizerUserInput } from "../../validation.types";
|
|
7
|
+
import type { CategorizerPromptJSON } from "../../widget-ai-utils/categorizer/prompt-utils";
|
|
6
8
|
type Props = WidgetProps<RenderProps, PerseusCategorizerRubric> & {
|
|
7
9
|
values: ReadonlyArray<string>;
|
|
8
10
|
};
|
|
@@ -26,6 +28,7 @@ export declare class Categorizer extends React.Component<Props, State> implement
|
|
|
26
28
|
static getUserInputFromProps(props: Props): PerseusCategorizerUserInput;
|
|
27
29
|
change: (...args: ReadonlyArray<unknown>) => any;
|
|
28
30
|
getUserInput(): PerseusCategorizerUserInput;
|
|
31
|
+
getPromptJSON(): CategorizerPromptJSON;
|
|
29
32
|
onChange(itemNum: any, catNum: any): void;
|
|
30
33
|
render(): React.ReactNode;
|
|
31
34
|
}
|
|
@@ -35,26 +38,14 @@ type RenderProps = {
|
|
|
35
38
|
randomizeItems: PerseusCategorizerWidgetOptions["randomizeItems"];
|
|
36
39
|
values?: PerseusCategorizerWidgetOptions["values"];
|
|
37
40
|
};
|
|
38
|
-
declare const _default:
|
|
41
|
+
declare const _default: {
|
|
39
42
|
name: string;
|
|
40
43
|
displayName: string;
|
|
41
|
-
|
|
44
|
+
hidden: true;
|
|
42
45
|
widget: typeof Categorizer;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
getDefaultAlignment?: (() => import("../../types").Alignment) | undefined;
|
|
49
|
-
isLintable?: boolean | undefined;
|
|
50
|
-
tracking?: import("../../types").Tracking | undefined;
|
|
51
|
-
traverseChildWidgets?: any;
|
|
52
|
-
transform?: import("../../types").WidgetTransform | undefined;
|
|
53
|
-
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
54
|
-
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
55
|
-
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
56
|
-
propUpgrades?: {
|
|
57
|
-
[key: string]: (arg1: any) => any;
|
|
58
|
-
} | undefined;
|
|
59
|
-
}>;
|
|
46
|
+
transform: (widgetOptions: PerseusCategorizerWidgetOptions) => RenderProps;
|
|
47
|
+
staticTransform: (editorProps: PerseusCategorizerWidgetOptions) => RenderProps;
|
|
48
|
+
isLintable: true;
|
|
49
|
+
scorer: typeof scoreCategorizer;
|
|
50
|
+
};
|
|
60
51
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PerseusStrings } from "../../strings";
|
|
2
2
|
import type { PerseusScore } from "../../types";
|
|
3
3
|
import type { PerseusCategorizerRubric, PerseusCategorizerUserInput } from "../../validation.types";
|
|
4
|
-
declare function
|
|
5
|
-
export default
|
|
4
|
+
declare function scoreCategorizer(userInput: PerseusCategorizerUserInput, rubric: PerseusCategorizerRubric, strings: PerseusStrings): PerseusScore;
|
|
5
|
+
export default scoreCategorizer;
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
* This widget is for embedding Khan Academy CS programs.
|
|
3
3
|
*/
|
|
4
4
|
import * as React from "react";
|
|
5
|
+
import scoreCSProgram from "./score-cs-program";
|
|
5
6
|
import type { PerseusCSProgramWidgetOptions } from "../../perseus-types";
|
|
6
7
|
import type { Widget, WidgetProps } from "../../types";
|
|
7
8
|
import type { PerseusCSProgramRubric, PerseusCSProgramUserInput } from "../../validation.types";
|
|
9
|
+
import type { UnsupportedWidgetPromptJSON } from "../../widget-ai-utils/unsupported-widget";
|
|
8
10
|
type RenderProps = PerseusCSProgramWidgetOptions & PerseusCSProgramUserInput;
|
|
9
11
|
type Props = WidgetProps<RenderProps, PerseusCSProgramRubric>;
|
|
10
12
|
type DefaultProps = {
|
|
@@ -20,28 +22,15 @@ declare class CSProgram extends React.Component<Props> implements Widget {
|
|
|
20
22
|
handleMessageEvent: (arg1: any) => void;
|
|
21
23
|
change: (...args: ReadonlyArray<unknown>) => any;
|
|
22
24
|
getUserInput(): PerseusCSProgramUserInput;
|
|
25
|
+
getPromptJSON(): UnsupportedWidgetPromptJSON;
|
|
23
26
|
render(): React.ReactNode;
|
|
24
27
|
}
|
|
25
|
-
declare const _default:
|
|
28
|
+
declare const _default: {
|
|
26
29
|
name: string;
|
|
27
30
|
displayName: string;
|
|
28
|
-
|
|
31
|
+
supportedAlignments: ("block" | "full-width")[];
|
|
29
32
|
widget: typeof CSProgram;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
supportedAlignments?: readonly import("../../types").Alignment[] | undefined;
|
|
34
|
-
defaultAlignment?: import("../../types").Alignment | undefined;
|
|
35
|
-
getDefaultAlignment?: (() => import("../../types").Alignment) | undefined;
|
|
36
|
-
isLintable?: boolean | undefined;
|
|
37
|
-
tracking?: import("../../types").Tracking | undefined;
|
|
38
|
-
traverseChildWidgets?: any;
|
|
39
|
-
transform?: import("../../types").WidgetTransform | undefined;
|
|
40
|
-
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
41
|
-
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
42
|
-
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
43
|
-
propUpgrades?: {
|
|
44
|
-
[key: string]: (arg1: any) => any;
|
|
45
|
-
} | undefined;
|
|
46
|
-
}>;
|
|
33
|
+
hidden: true;
|
|
34
|
+
scorer: typeof scoreCSProgram;
|
|
35
|
+
};
|
|
47
36
|
export default _default;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { PerseusScore } from "../../types";
|
|
2
2
|
import type { PerseusCSProgramUserInput } from "../../validation.types";
|
|
3
|
-
|
|
3
|
+
declare function scoreCSProgram(state: PerseusCSProgramUserInput): PerseusScore;
|
|
4
|
+
export default scoreCSProgram;
|
|
@@ -2,6 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
3
|
import type { PerseusRenderer, PerseusDefinitionWidgetOptions } from "../../perseus-types";
|
|
4
4
|
import type { Widget, WidgetProps } from "../../types";
|
|
5
|
+
import type { DefinitionPromptJSON } from "../../widget-ai-utils/definition/prompt-utils";
|
|
5
6
|
type RenderProps = PerseusDefinitionWidgetOptions;
|
|
6
7
|
type DefinitionProps = WidgetProps<RenderProps> & {
|
|
7
8
|
widgets: PerseusRenderer["widgets"];
|
|
@@ -18,28 +19,16 @@ declare class Definition extends React.Component<DefinitionProps> implements Wid
|
|
|
18
19
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
19
20
|
static defaultProps: DefaultProps;
|
|
20
21
|
isWidget: true;
|
|
22
|
+
getPromptJSON(): DefinitionPromptJSON;
|
|
21
23
|
render(): React.ReactNode;
|
|
22
24
|
}
|
|
23
|
-
declare const _default:
|
|
25
|
+
declare const _default: {
|
|
24
26
|
name: string;
|
|
25
27
|
displayName: string;
|
|
26
|
-
|
|
28
|
+
accessible: true;
|
|
29
|
+
defaultAlignment: "inline";
|
|
27
30
|
widget: typeof Definition;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
supportedAlignments?: readonly import("../../types").Alignment[] | undefined;
|
|
32
|
-
defaultAlignment?: import("../../types").Alignment | undefined;
|
|
33
|
-
getDefaultAlignment?: (() => import("../../types").Alignment) | undefined;
|
|
34
|
-
isLintable?: boolean | undefined;
|
|
35
|
-
tracking?: import("../../types").Tracking | undefined;
|
|
36
|
-
traverseChildWidgets?: any;
|
|
37
|
-
transform?: import("../../types").WidgetTransform | undefined;
|
|
38
|
-
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
39
|
-
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
40
|
-
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
41
|
-
propUpgrades?: {
|
|
42
|
-
[key: string]: (arg1: any) => any;
|
|
43
|
-
} | undefined;
|
|
44
|
-
}>;
|
|
31
|
+
transform: (x: any) => any;
|
|
32
|
+
scorer: () => import("../../types").PerseusScore;
|
|
33
|
+
};
|
|
45
34
|
export default _default;
|
|
@@ -11,26 +11,11 @@ declare class DeprecatedStandin extends React.Component<Props> implements Widget
|
|
|
11
11
|
isWidget: true;
|
|
12
12
|
render(): React.JSX.Element;
|
|
13
13
|
}
|
|
14
|
-
declare const _default:
|
|
14
|
+
declare const _default: {
|
|
15
15
|
name: string;
|
|
16
16
|
displayName: string;
|
|
17
|
-
getWidget?: (() => typeof DeprecatedStandin) | undefined;
|
|
18
17
|
widget: typeof DeprecatedStandin;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
supportedAlignments?: readonly import("../../types").Alignment[] | undefined;
|
|
23
|
-
defaultAlignment?: import("../../types").Alignment | undefined;
|
|
24
|
-
getDefaultAlignment?: (() => import("../../types").Alignment) | undefined;
|
|
25
|
-
isLintable?: boolean | undefined;
|
|
26
|
-
tracking?: import("../../types").Tracking | undefined;
|
|
27
|
-
traverseChildWidgets?: any;
|
|
28
|
-
transform?: import("../../types").WidgetTransform | undefined;
|
|
29
|
-
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
30
|
-
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
31
|
-
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
32
|
-
propUpgrades?: {
|
|
33
|
-
[key: string]: (arg1: any) => any;
|
|
34
|
-
} | undefined;
|
|
35
|
-
}>;
|
|
18
|
+
hidden: true;
|
|
19
|
+
scorer: () => import("../../types").PerseusScore;
|
|
20
|
+
};
|
|
36
21
|
export default _default;
|