@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
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import Graphie from "../../components/graphie";
|
|
3
|
+
import scoreGrapher from "./score-grapher";
|
|
3
4
|
import type { Coord } from "../../interactive2/types";
|
|
4
5
|
import type { PerseusGrapherWidgetOptions } from "../../perseus-types";
|
|
5
6
|
import type { Widget, WidgetProps } from "../../types";
|
|
6
7
|
import type { GridDimensions } from "../../util";
|
|
7
8
|
import type { PerseusGrapherRubric, PerseusGrapherUserInput } from "../../validation.types";
|
|
9
|
+
import type { GrapherPromptJSON } from "../../widget-ai-utils/grapher/prompt-utils";
|
|
8
10
|
import type { PropsFor } from "@khanacademy/wonder-blocks-core";
|
|
9
11
|
type RenderProps = {
|
|
10
12
|
availableTypes: PerseusGrapherWidgetOptions["availableTypes"];
|
|
@@ -35,28 +37,16 @@ declare class Grapher extends React.Component<Props> implements Widget {
|
|
|
35
37
|
showHairlines: (arg1: Coord) => void;
|
|
36
38
|
hideHairlines: () => void;
|
|
37
39
|
getUserInput(): PerseusGrapherUserInput;
|
|
40
|
+
getPromptJSON(): GrapherPromptJSON;
|
|
38
41
|
render(): React.ReactNode;
|
|
39
42
|
}
|
|
40
|
-
declare const _default:
|
|
43
|
+
declare const _default: {
|
|
41
44
|
name: string;
|
|
42
45
|
displayName: string;
|
|
43
|
-
|
|
46
|
+
hidden: true;
|
|
44
47
|
widget: typeof Grapher;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
defaultAlignment?: import("../../types").Alignment | undefined;
|
|
50
|
-
getDefaultAlignment?: (() => import("../../types").Alignment) | undefined;
|
|
51
|
-
isLintable?: boolean | undefined;
|
|
52
|
-
tracking?: import("../../types").Tracking | undefined;
|
|
53
|
-
traverseChildWidgets?: any;
|
|
54
|
-
transform?: import("../../types").WidgetTransform | undefined;
|
|
55
|
-
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
56
|
-
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
57
|
-
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
58
|
-
propUpgrades?: {
|
|
59
|
-
[key: string]: (arg1: any) => any;
|
|
60
|
-
} | undefined;
|
|
61
|
-
}>;
|
|
48
|
+
transform: (arg1: PerseusGrapherWidgetOptions) => RenderProps;
|
|
49
|
+
staticTransform: (arg1: PerseusGrapherWidgetOptions) => RenderProps;
|
|
50
|
+
scorer: typeof scoreGrapher;
|
|
51
|
+
};
|
|
62
52
|
export default _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PerseusScore } from "../../types";
|
|
2
|
+
import type { PerseusGrapherRubric, PerseusGrapherUserInput } from "../../validation.types";
|
|
3
|
+
declare function scoreGrapher(userInput: PerseusGrapherUserInput, rubric: PerseusGrapherRubric): PerseusScore;
|
|
4
|
+
export default scoreGrapher;
|
|
@@ -4,6 +4,7 @@ import Renderer from "../../renderer";
|
|
|
4
4
|
import type { PerseusGroupWidgetOptions } from "../../perseus-types";
|
|
5
5
|
import type { ChangeFn, FocusPath, Widget, WidgetProps } from "../../types";
|
|
6
6
|
import type { PerseusGroupRubric, UserInputArray } from "../../validation.types";
|
|
7
|
+
import type { GroupPromptJSON } from "../../widget-ai-utils/group/prompt-utils";
|
|
7
8
|
type RenderProps = PerseusGroupWidgetOptions;
|
|
8
9
|
type Props = WidgetProps<RenderProps, PerseusGroupRubric>;
|
|
9
10
|
type DefaultProps = {
|
|
@@ -27,6 +28,7 @@ declare class Group extends React.Component<Props> implements Widget {
|
|
|
27
28
|
* @deprecated getUserInputMap should be used for Groups
|
|
28
29
|
*/
|
|
29
30
|
getUserInput(): UserInputArray | undefined;
|
|
31
|
+
getPromptJSON(): GroupPromptJSON;
|
|
30
32
|
getSerializedState: () => any;
|
|
31
33
|
restoreSerializedState: (arg1: any, arg2: any) => null;
|
|
32
34
|
getInputPaths(): readonly FocusPath[];
|
|
@@ -37,26 +39,12 @@ declare class Group extends React.Component<Props> implements Widget {
|
|
|
37
39
|
showRationalesForCurrentlySelectedChoices: () => void;
|
|
38
40
|
render(): React.ReactNode;
|
|
39
41
|
}
|
|
40
|
-
declare const _default:
|
|
42
|
+
declare const _default: {
|
|
41
43
|
name: string;
|
|
42
44
|
displayName: string;
|
|
43
|
-
getWidget?: (() => typeof Group) | undefined;
|
|
44
45
|
widget: typeof Group;
|
|
45
|
-
|
|
46
|
-
hidden
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
defaultAlignment?: import("../../types").Alignment | undefined;
|
|
50
|
-
getDefaultAlignment?: (() => import("../../types").Alignment) | undefined;
|
|
51
|
-
isLintable?: boolean | undefined;
|
|
52
|
-
tracking?: import("../../types").Tracking | undefined;
|
|
53
|
-
traverseChildWidgets?: any;
|
|
54
|
-
transform?: import("../../types").WidgetTransform | undefined;
|
|
55
|
-
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
56
|
-
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
57
|
-
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
58
|
-
propUpgrades?: {
|
|
59
|
-
[key: string]: (arg1: any) => any;
|
|
60
|
-
} | undefined;
|
|
61
|
-
}>;
|
|
46
|
+
traverseChildWidgets: (props: any, traverseRenderer: any) => any;
|
|
47
|
+
hidden: true;
|
|
48
|
+
isLintable: true;
|
|
49
|
+
};
|
|
62
50
|
export default _default;
|
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
* but could also be used for embedding viz's hosted elsewhere.
|
|
8
8
|
*/
|
|
9
9
|
import * as React from "react";
|
|
10
|
+
import { scoreIframe } from "./score-iframe";
|
|
10
11
|
import type { PerseusIFrameWidgetOptions } from "../../perseus-types";
|
|
11
12
|
import type { WidgetProps, Widget } from "../../types";
|
|
12
13
|
import type { PerseusIFrameRubric, PerseusIFrameUserInput, UserInputStatus } from "../../validation.types";
|
|
14
|
+
import type { UnsupportedWidgetPromptJSON } from "../../widget-ai-utils/unsupported-widget";
|
|
13
15
|
type RenderProps = PerseusIFrameWidgetOptions & {
|
|
14
16
|
status: UserInputStatus;
|
|
15
17
|
message: string | null;
|
|
@@ -28,30 +30,16 @@ declare class Iframe extends React.Component<Props> implements Widget {
|
|
|
28
30
|
componentDidMount(): void;
|
|
29
31
|
componentWillUnmount(): void;
|
|
30
32
|
getUserInput(): PerseusIFrameUserInput;
|
|
33
|
+
getPromptJSON(): UnsupportedWidgetPromptJSON;
|
|
31
34
|
handleMessageEvent: (arg1: any) => void;
|
|
32
35
|
change: (...args: ReadonlyArray<unknown>) => any;
|
|
33
36
|
render(): React.ReactNode;
|
|
34
37
|
}
|
|
35
|
-
declare const _default:
|
|
38
|
+
declare const _default: {
|
|
36
39
|
name: string;
|
|
37
40
|
displayName: string;
|
|
38
|
-
getWidget?: (() => typeof Iframe) | undefined;
|
|
39
41
|
widget: typeof Iframe;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
supportedAlignments?: readonly import("../../types").Alignment[] | undefined;
|
|
44
|
-
defaultAlignment?: import("../../types").Alignment | undefined;
|
|
45
|
-
getDefaultAlignment?: (() => import("../../types").Alignment) | undefined;
|
|
46
|
-
isLintable?: boolean | undefined;
|
|
47
|
-
tracking?: import("../../types").Tracking | undefined;
|
|
48
|
-
traverseChildWidgets?: any;
|
|
49
|
-
transform?: import("../../types").WidgetTransform | undefined;
|
|
50
|
-
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
51
|
-
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
52
|
-
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
53
|
-
propUpgrades?: {
|
|
54
|
-
[key: string]: (arg1: any) => any;
|
|
55
|
-
} | undefined;
|
|
56
|
-
}>;
|
|
42
|
+
hidden: true;
|
|
43
|
+
scorer: typeof scoreIframe;
|
|
44
|
+
};
|
|
57
45
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { PerseusScore } from "../../types";
|
|
2
2
|
import type { PerseusIFrameUserInput } from "../../validation.types";
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function scoreIframe(userInput: PerseusIFrameUserInput): PerseusScore;
|
|
@@ -2,6 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
3
|
import type { PerseusImageWidgetOptions } from "../../perseus-types";
|
|
4
4
|
import type { ChangeFn, WidgetProps, Widget } from "../../types";
|
|
5
|
+
import type { ImagePromptJSON } from "../../widget-ai-utils/image/prompt-utils";
|
|
5
6
|
type RenderProps = PerseusImageWidgetOptions;
|
|
6
7
|
type ExternalProps = WidgetProps<RenderProps>;
|
|
7
8
|
type Props = ExternalProps & {
|
|
@@ -35,28 +36,17 @@ declare class ImageWidget extends React.Component<Props> implements Widget {
|
|
|
35
36
|
static defaultProps: DefaultProps;
|
|
36
37
|
isWidget: true;
|
|
37
38
|
change: ChangeFn;
|
|
39
|
+
getPromptJSON(): ImagePromptJSON;
|
|
38
40
|
render(): React.ReactNode;
|
|
39
41
|
}
|
|
40
|
-
declare const _default:
|
|
42
|
+
declare const _default: {
|
|
41
43
|
name: string;
|
|
44
|
+
accessible: (widgetOptions: PerseusImageWidgetOptions) => boolean;
|
|
45
|
+
defaultAlignment: "block";
|
|
46
|
+
supportedAlignments: readonly ["block", "full-width"];
|
|
42
47
|
displayName: string;
|
|
43
|
-
getWidget?: (() => typeof ImageWidget) | undefined;
|
|
44
48
|
widget: typeof ImageWidget;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
supportedAlignments?: readonly import("../../types").Alignment[] | undefined;
|
|
49
|
-
defaultAlignment?: import("../../types").Alignment | undefined;
|
|
50
|
-
getDefaultAlignment?: (() => import("../../types").Alignment) | undefined;
|
|
51
|
-
isLintable?: boolean | undefined;
|
|
52
|
-
tracking?: import("../../types").Tracking | undefined;
|
|
53
|
-
traverseChildWidgets?: any;
|
|
54
|
-
transform?: import("../../types").WidgetTransform | undefined;
|
|
55
|
-
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
56
|
-
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
57
|
-
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
58
|
-
propUpgrades?: {
|
|
59
|
-
[key: string]: (arg1: any) => any;
|
|
60
|
-
} | undefined;
|
|
61
|
-
}>;
|
|
49
|
+
isLintable: true;
|
|
50
|
+
scorer: () => import("../../types").PerseusScore;
|
|
51
|
+
};
|
|
62
52
|
export default _default;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
|
+
import scoreInputNumber from "./score-input-number";
|
|
3
4
|
import type { PerseusInputNumberWidgetOptions } from "../../perseus-types";
|
|
4
5
|
import type { PerseusStrings } from "../../strings";
|
|
5
6
|
import type { Path, Widget, WidgetProps } from "../../types";
|
|
6
7
|
import type { PerseusInputNumberRubric, PerseusInputNumberUserInput } from "../../validation.types";
|
|
8
|
+
import type { InputNumberPromptJSON } from "../../widget-ai-utils/input-number/prompt-utils";
|
|
7
9
|
type RenderProps = {
|
|
8
10
|
simplify: PerseusInputNumberWidgetOptions["simplify"];
|
|
9
11
|
size: PerseusInputNumberWidgetOptions["size"];
|
|
@@ -47,29 +49,19 @@ declare class InputNumber extends React.Component<Props> implements Widget {
|
|
|
47
49
|
getInputPaths: () => ReadonlyArray<Path>;
|
|
48
50
|
setInputValue: (arg1: Path, arg2: string, arg3: () => void) => void;
|
|
49
51
|
getUserInput(): PerseusInputNumberUserInput;
|
|
52
|
+
getPromptJSON(): InputNumberPromptJSON;
|
|
50
53
|
examples: () => ReadonlyArray<string>;
|
|
51
54
|
render(): React.ReactNode;
|
|
52
55
|
}
|
|
53
|
-
declare const _default:
|
|
56
|
+
declare const _default: {
|
|
54
57
|
name: string;
|
|
55
58
|
displayName: string;
|
|
56
|
-
|
|
59
|
+
defaultAlignment: "inline-block";
|
|
60
|
+
hidden: true;
|
|
57
61
|
widget: typeof InputNumber;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
getDefaultAlignment?: (() => import("../../types").Alignment) | undefined;
|
|
64
|
-
isLintable?: boolean | undefined;
|
|
65
|
-
tracking?: import("../../types").Tracking | undefined;
|
|
66
|
-
traverseChildWidgets?: any;
|
|
67
|
-
transform?: import("../../types").WidgetTransform | undefined;
|
|
68
|
-
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
69
|
-
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
70
|
-
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
71
|
-
propUpgrades?: {
|
|
72
|
-
[key: string]: (arg1: any) => any;
|
|
73
|
-
} | undefined;
|
|
74
|
-
}>;
|
|
62
|
+
transform: (widgetOptions: PerseusInputNumberWidgetOptions) => RenderProps;
|
|
63
|
+
isLintable: true;
|
|
64
|
+
scorer: typeof scoreInputNumber;
|
|
65
|
+
getOneCorrectAnswerFromRubric(rubric: any): string | null | undefined;
|
|
66
|
+
};
|
|
75
67
|
export default _default;
|
|
@@ -35,5 +35,5 @@ export declare const answerTypes: {
|
|
|
35
35
|
readonly forms: "pi";
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
|
-
declare function
|
|
39
|
-
export default
|
|
38
|
+
declare function scoreInputNumber(userInput: PerseusInputNumberUserInput, rubric: PerseusInputNumberRubric, strings: PerseusStrings): PerseusScore;
|
|
39
|
+
export default scoreInputNumber;
|
|
@@ -2,6 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import type { Coord } from "../../interactive2/types";
|
|
3
3
|
import type { PerseusInteractionWidgetOptions } from "../../perseus-types";
|
|
4
4
|
import type { Widget, WidgetProps } from "../../types";
|
|
5
|
+
import type { UnsupportedWidgetPromptJSON } from "../../widget-ai-utils/unsupported-widget";
|
|
5
6
|
type RenderProps = PerseusInteractionWidgetOptions;
|
|
6
7
|
type Props = WidgetProps<RenderProps>;
|
|
7
8
|
type DefaultProps = {
|
|
@@ -23,28 +24,15 @@ declare class Interaction extends React.Component<Props, State> implements Widge
|
|
|
23
24
|
_eval: (arg1: any, arg2: any) => number;
|
|
24
25
|
_extractVars: (arg1: any) => ReadonlyArray<any>;
|
|
25
26
|
change: (arg1: any, arg2: any, arg3: any) => any;
|
|
27
|
+
getPromptJSON(): UnsupportedWidgetPromptJSON;
|
|
26
28
|
render(): React.ReactNode;
|
|
27
29
|
}
|
|
28
|
-
declare const _default:
|
|
30
|
+
declare const _default: {
|
|
29
31
|
name: string;
|
|
30
32
|
displayName: string;
|
|
31
|
-
getWidget?: (() => typeof Interaction) | undefined;
|
|
32
33
|
widget: typeof Interaction;
|
|
33
|
-
|
|
34
|
-
hidden
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
defaultAlignment?: import("../../types").Alignment | undefined;
|
|
38
|
-
getDefaultAlignment?: (() => import("../../types").Alignment) | undefined;
|
|
39
|
-
isLintable?: boolean | undefined;
|
|
40
|
-
tracking?: import("../../types").Tracking | undefined;
|
|
41
|
-
traverseChildWidgets?: any;
|
|
42
|
-
transform?: import("../../types").WidgetTransform | undefined;
|
|
43
|
-
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
44
|
-
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
45
|
-
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
46
|
-
propUpgrades?: {
|
|
47
|
-
[key: string]: (arg1: any) => any;
|
|
48
|
-
} | undefined;
|
|
49
|
-
}>;
|
|
34
|
+
transform: <T>(value: T) => T;
|
|
35
|
+
hidden: true;
|
|
36
|
+
scorer: () => import("../../types").PerseusScore;
|
|
37
|
+
};
|
|
50
38
|
export default _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { PerseusI18nContext } from "../components/i18n-context";
|
|
3
|
+
import scoreInteractiveGraph from "./interactive-graphs/score-interactive-graph";
|
|
3
4
|
import type { StatefulMafsGraphType } from "./interactive-graphs/stateful-mafs-graph";
|
|
4
5
|
import type { QuadraticGraphState } from "./interactive-graphs/types";
|
|
5
6
|
import type { Coord } from "../interactive2/types";
|
|
@@ -7,6 +8,8 @@ import type { PerseusGraphType, PerseusGraphTypeAngle, PerseusGraphTypePoint, Pe
|
|
|
7
8
|
import type { ChangeHandler, WidgetProps } from "../types";
|
|
8
9
|
import type { QuadraticCoefficient, Range, SineCoefficient } from "../util/geometry";
|
|
9
10
|
import type { PerseusInteractiveGraphRubric, PerseusInteractiveGraphUserInput } from "../validation.types";
|
|
11
|
+
import type { InteractiveGraphPromptJSON } from "../widget-ai-utils/interactive-graph/prompt-utils";
|
|
12
|
+
import type { UnsupportedWidgetPromptJSON } from "../widget-ai-utils/unsupported-widget";
|
|
10
13
|
type RenderProps = PerseusInteractiveGraphWidgetOptions;
|
|
11
14
|
type Props = WidgetProps<RenderProps, PerseusInteractiveGraphRubric>;
|
|
12
15
|
type State = any;
|
|
@@ -109,6 +112,7 @@ declare class InteractiveGraph extends React.Component<Props, State> {
|
|
|
109
112
|
mafsRef: React.RefObject<StatefulMafsGraphType>;
|
|
110
113
|
static defaultProps: DefaultProps;
|
|
111
114
|
getUserInput(): PerseusInteractiveGraphUserInput;
|
|
115
|
+
getPromptJSON(): InteractiveGraphPromptJSON | UnsupportedWidgetPromptJSON;
|
|
112
116
|
render(): React.JSX.Element;
|
|
113
117
|
/**
|
|
114
118
|
* @param {object} graph Like props.graph or props.correct
|
|
@@ -161,26 +165,11 @@ declare class InteractiveGraph extends React.Component<Props, State> {
|
|
|
161
165
|
static getUserInputFromProps(props: Props): PerseusGraphType;
|
|
162
166
|
}
|
|
163
167
|
export declare function shouldUseMafs(mafsFlags: Record<string, boolean> | undefined | boolean, graph: PerseusGraphType): boolean;
|
|
164
|
-
declare const _default:
|
|
168
|
+
declare const _default: {
|
|
165
169
|
name: string;
|
|
166
170
|
displayName: string;
|
|
167
|
-
getWidget?: (() => typeof InteractiveGraph) | undefined;
|
|
168
171
|
widget: typeof InteractiveGraph;
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
supportedAlignments?: readonly import("../types").Alignment[] | undefined;
|
|
173
|
-
defaultAlignment?: import("../types").Alignment | undefined;
|
|
174
|
-
getDefaultAlignment?: (() => import("../types").Alignment) | undefined;
|
|
175
|
-
isLintable?: boolean | undefined;
|
|
176
|
-
tracking?: import("../types").Tracking | undefined;
|
|
177
|
-
traverseChildWidgets?: any;
|
|
178
|
-
transform?: import("../types").WidgetTransform | undefined;
|
|
179
|
-
staticTransform?: import("../types").WidgetTransform | undefined;
|
|
180
|
-
validator?: import("../types").WidgetValidatorFunction | undefined;
|
|
181
|
-
getOneCorrectAnswerFromRubric?: ((rubric: import("../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
182
|
-
propUpgrades?: {
|
|
183
|
-
[key: string]: (arg1: any) => any;
|
|
184
|
-
} | undefined;
|
|
185
|
-
}>;
|
|
172
|
+
staticTransform: <T>(value: T) => T;
|
|
173
|
+
scorer: typeof scoreInteractiveGraph;
|
|
174
|
+
};
|
|
186
175
|
export default _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PerseusScore } from "../../types";
|
|
2
|
+
import type { PerseusInteractiveGraphRubric, PerseusInteractiveGraphUserInput } from "../../validation.types";
|
|
3
|
+
declare function scoreInteractiveGraph(userInput: PerseusInteractiveGraphUserInput, rubric: PerseusInteractiveGraphRubric): PerseusScore;
|
|
4
|
+
export default scoreInteractiveGraph;
|
|
@@ -21,4 +21,4 @@ export declare function isUnlimitedGraphState(state: InteractiveGraphState): sta
|
|
|
21
21
|
* This way, the entire resulting string can be rendered within <TeX>
|
|
22
22
|
* and the text outside of the $ blocks will be non-TeX text.
|
|
23
23
|
*/
|
|
24
|
-
export declare function replaceOutsideTeX(mathString: string):
|
|
24
|
+
export declare function replaceOutsideTeX(mathString: string): any;
|
|
@@ -8,12 +8,14 @@
|
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
10
10
|
import Marker from "./marker";
|
|
11
|
+
import scoreLabelImage from "./score-label-image";
|
|
11
12
|
import type { InteractiveMarkerType } from "./types";
|
|
12
13
|
import type { DependencyProps } from "../../dependencies";
|
|
13
14
|
import type { ChangeableProps } from "../../mixins/changeable";
|
|
14
15
|
import type { PerseusLabelImageWidgetOptions } from "../../perseus-types";
|
|
15
16
|
import type { APIOptions, Widget } from "../../types";
|
|
16
17
|
import type { PerseusLabelImageRubric, PerseusLabelImageUserInput } from "../../validation.types";
|
|
18
|
+
import type { LabelImagePromptJSON } from "../../widget-ai-utils/label-image/prompt-utils";
|
|
17
19
|
export type PreferredPopoverDirection = "NONE" | "UP" | "DOWN" | "LEFT" | "RIGHT";
|
|
18
20
|
/**
|
|
19
21
|
* Represents a direction vector.
|
|
@@ -73,6 +75,7 @@ export declare class LabelImage extends React.Component<LabelImageProps, LabelIm
|
|
|
73
75
|
componentDidMount(): void;
|
|
74
76
|
componentWillUnmount(): void;
|
|
75
77
|
getUserInput(): PerseusLabelImageUserInput;
|
|
78
|
+
getPromptJSON(): LabelImagePromptJSON;
|
|
76
79
|
showRationalesForCurrentlySelectedChoices(rubric: PerseusLabelImageRubric): void;
|
|
77
80
|
handleMarkerChange(index: number, marker: InteractiveMarkerType): void;
|
|
78
81
|
activateMarker(index: number, opened: boolean): void;
|
|
@@ -82,10 +85,10 @@ export declare class LabelImage extends React.Component<LabelImageProps, LabelIm
|
|
|
82
85
|
renderInstructions(): React.ReactNode;
|
|
83
86
|
render(): React.ReactNode;
|
|
84
87
|
}
|
|
85
|
-
declare const _default:
|
|
88
|
+
declare const _default: {
|
|
86
89
|
name: string;
|
|
87
90
|
displayName: string;
|
|
88
|
-
|
|
91
|
+
widget: React.ForwardRefExoticComponent<Omit<ChangeableProps & Partial<import("../../types").PerseusDependenciesV2> & Omit<PerseusLabelImageWidgetOptions, "markers"> & {
|
|
89
92
|
apiOptions: Readonly<{
|
|
90
93
|
isArticle?: boolean | undefined;
|
|
91
94
|
onFocusChange?: ((newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
|
|
@@ -126,79 +129,13 @@ declare const _default: Readonly<{
|
|
|
126
129
|
circle?: boolean | undefined;
|
|
127
130
|
polygon?: boolean | undefined;
|
|
128
131
|
point?: boolean | undefined;
|
|
129
|
-
angle?: boolean | undefined;
|
|
130
|
-
segment?: boolean | undefined;
|
|
131
|
-
"linear-system"?: boolean | undefined;
|
|
132
|
-
ray?: boolean | undefined;
|
|
133
|
-
"unlimited-polygon"?: boolean | undefined;
|
|
134
132
|
quadratic?: boolean | undefined;
|
|
135
133
|
sinusoid?: boolean | undefined;
|
|
136
|
-
"unlimited-point"?: boolean | undefined;
|
|
137
|
-
} & {
|
|
138
|
-
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
|
139
|
-
"locked-figures-aria"?: boolean | undefined;
|
|
140
|
-
"locked-point-labels"?: boolean | undefined;
|
|
141
|
-
"locked-line-labels"?: boolean | undefined;
|
|
142
|
-
"locked-vector-labels"?: boolean | undefined;
|
|
143
|
-
"locked-ellipse-labels"?: boolean | undefined;
|
|
144
|
-
"locked-polygon-labels"?: boolean | undefined;
|
|
145
|
-
"locked-function-labels"?: boolean | undefined;
|
|
146
|
-
}) | undefined;
|
|
147
|
-
} | undefined;
|
|
148
|
-
onWidgetStartProps?: ((widgets: import("../../perseus-types").PerseusWidgetsMap) => void) | undefined;
|
|
149
|
-
}>;
|
|
150
|
-
markers: readonly InteractiveMarkerType[];
|
|
151
|
-
questionCompleted: boolean;
|
|
152
|
-
preferredPopoverDirection?: PreferredPopoverDirection | undefined;
|
|
153
|
-
}, keyof import("../../types").PerseusDependenciesV2> & React.RefAttributes<LabelImage>>) | undefined;
|
|
154
|
-
widget: React.ForwardRefExoticComponent<Omit<ChangeableProps & Partial<import("../../types").PerseusDependenciesV2> & Omit<PerseusLabelImageWidgetOptions, "markers"> & {
|
|
155
|
-
apiOptions: Readonly<{
|
|
156
|
-
isArticle?: boolean | undefined;
|
|
157
|
-
onFocusChange?: ((newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
|
|
158
|
-
GroupMetadataEditor?: React.ComponentType<any> | undefined;
|
|
159
|
-
showAlignmentOptions?: boolean | undefined;
|
|
160
|
-
readOnly?: boolean | undefined;
|
|
161
|
-
answerableCallback?: ((arg1: boolean) => unknown) | undefined;
|
|
162
|
-
getAnotherHint?: (() => unknown) | undefined;
|
|
163
|
-
interactionCallback?: ((widgetData: {
|
|
164
|
-
[widgetId: string]: any;
|
|
165
|
-
}) => void) | undefined;
|
|
166
|
-
groupAnnotator?: ((groupNumber: number, widgetId: string) => React.ReactNode) | undefined;
|
|
167
|
-
imagePlaceholder?: React.ReactNode;
|
|
168
|
-
widgetPlaceholder?: React.ReactNode;
|
|
169
|
-
baseElements?: {
|
|
170
|
-
Link: React.ComponentType<any>;
|
|
171
|
-
} | undefined;
|
|
172
|
-
imagePreloader?: ((dimensions: import("../../types").Dimensions) => React.ReactNode) | undefined;
|
|
173
|
-
trackInteraction?: ((args: {
|
|
174
|
-
type: string;
|
|
175
|
-
id: string;
|
|
176
|
-
correct?: boolean | undefined;
|
|
177
|
-
} & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
|
|
178
|
-
visible: number;
|
|
179
|
-
}>) => void) | undefined;
|
|
180
|
-
customKeypad?: boolean | undefined;
|
|
181
|
-
nativeKeypadProxy?: ((blur: () => void) => import("@khanacademy/math-input").KeypadAPI) | undefined;
|
|
182
|
-
isMobile?: boolean | undefined;
|
|
183
|
-
setDrawingAreaAvailable?: ((arg1: boolean) => unknown) | undefined;
|
|
184
|
-
hintProgressColor?: string | undefined;
|
|
185
|
-
canScrollPage?: boolean | undefined;
|
|
186
|
-
crossOutEnabled?: boolean | undefined;
|
|
187
|
-
editorChangeDelay?: number | undefined;
|
|
188
|
-
flags?: {
|
|
189
|
-
mafs?: false | ({
|
|
190
|
-
none?: boolean | undefined;
|
|
191
|
-
linear?: boolean | undefined;
|
|
192
|
-
circle?: boolean | undefined;
|
|
193
|
-
polygon?: boolean | undefined;
|
|
194
|
-
point?: boolean | undefined;
|
|
195
134
|
angle?: boolean | undefined;
|
|
196
|
-
segment?: boolean | undefined;
|
|
197
135
|
"linear-system"?: boolean | undefined;
|
|
198
136
|
ray?: boolean | undefined;
|
|
137
|
+
segment?: boolean | undefined;
|
|
199
138
|
"unlimited-polygon"?: boolean | undefined;
|
|
200
|
-
quadratic?: boolean | undefined;
|
|
201
|
-
sinusoid?: boolean | undefined;
|
|
202
139
|
"unlimited-point"?: boolean | undefined;
|
|
203
140
|
} & {
|
|
204
141
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
|
@@ -217,21 +154,8 @@ declare const _default: Readonly<{
|
|
|
217
154
|
questionCompleted: boolean;
|
|
218
155
|
preferredPopoverDirection?: PreferredPopoverDirection | undefined;
|
|
219
156
|
}, keyof import("../../types").PerseusDependenciesV2> & React.RefAttributes<LabelImage>>;
|
|
220
|
-
accessible
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
defaultAlignment?: import("../../types").Alignment | undefined;
|
|
225
|
-
getDefaultAlignment?: (() => import("../../types").Alignment) | undefined;
|
|
226
|
-
isLintable?: boolean | undefined;
|
|
227
|
-
tracking?: import("../../types").Tracking | undefined;
|
|
228
|
-
traverseChildWidgets?: any;
|
|
229
|
-
transform?: import("../../types").WidgetTransform | undefined;
|
|
230
|
-
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
231
|
-
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
232
|
-
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
233
|
-
propUpgrades?: {
|
|
234
|
-
[key: string]: (arg1: any) => any;
|
|
235
|
-
} | undefined;
|
|
236
|
-
}>;
|
|
157
|
+
accessible: true;
|
|
158
|
+
isLintable: true;
|
|
159
|
+
scorer: typeof scoreLabelImage;
|
|
160
|
+
};
|
|
237
161
|
export default _default;
|
|
@@ -6,5 +6,5 @@ type InteractiveMarkerScore = {
|
|
|
6
6
|
isCorrect: boolean;
|
|
7
7
|
};
|
|
8
8
|
export declare function scoreMarker(marker: InteractiveMarkerType): InteractiveMarkerScore;
|
|
9
|
-
declare function
|
|
10
|
-
export default
|
|
9
|
+
declare function scoreLabelImage(userInput: PerseusLabelImageUserInput, rubric?: PerseusLabelImageRubric): PerseusScore;
|
|
10
|
+
export default scoreLabelImage;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
|
+
import scoreMatcher from "./score-matcher";
|
|
3
4
|
import type { SortableOption } from "../../components/sortable";
|
|
4
5
|
import type { PerseusMatcherWidgetOptions } from "../../perseus-types";
|
|
5
6
|
import type { WidgetProps, Widget } from "../../types";
|
|
6
7
|
import type { PerseusMatcherRubric, PerseusMatcherUserInput } from "../../validation.types";
|
|
8
|
+
import type { MatcherPromptJSON } from "../../widget-ai-utils/matcher/prompt-utils";
|
|
7
9
|
type RenderProps = PerseusMatcherWidgetOptions;
|
|
8
10
|
type Props = WidgetProps<RenderProps, PerseusMatcherRubric>;
|
|
9
11
|
type DefaultProps = {
|
|
@@ -33,30 +35,16 @@ export declare class Matcher extends React.Component<Props, State> implements Wi
|
|
|
33
35
|
onMeasureLeft: (arg1: any) => void;
|
|
34
36
|
onMeasureRight: (arg1: any) => void;
|
|
35
37
|
getUserInput: () => PerseusMatcherUserInput;
|
|
38
|
+
getPromptJSON(): MatcherPromptJSON;
|
|
36
39
|
moveLeftOptionToIndex: (option: SortableOption, index: number) => void;
|
|
37
40
|
moveRightOptionToIndex: (option: SortableOption, index: number) => void;
|
|
38
41
|
render(): React.ReactElement;
|
|
39
42
|
}
|
|
40
|
-
declare const _default:
|
|
43
|
+
declare const _default: {
|
|
41
44
|
name: string;
|
|
42
45
|
displayName: string;
|
|
43
|
-
getWidget?: (() => typeof Matcher) | undefined;
|
|
44
46
|
widget: typeof Matcher;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
supportedAlignments?: readonly import("../../types").Alignment[] | undefined;
|
|
49
|
-
defaultAlignment?: import("../../types").Alignment | undefined;
|
|
50
|
-
getDefaultAlignment?: (() => import("../../types").Alignment) | undefined;
|
|
51
|
-
isLintable?: boolean | undefined;
|
|
52
|
-
tracking?: import("../../types").Tracking | undefined;
|
|
53
|
-
traverseChildWidgets?: any;
|
|
54
|
-
transform?: import("../../types").WidgetTransform | undefined;
|
|
55
|
-
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
56
|
-
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
57
|
-
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
58
|
-
propUpgrades?: {
|
|
59
|
-
[key: string]: (arg1: any) => any;
|
|
60
|
-
} | undefined;
|
|
61
|
-
}>;
|
|
47
|
+
isLintable: true;
|
|
48
|
+
scorer: typeof scoreMatcher;
|
|
49
|
+
};
|
|
62
50
|
export default _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PerseusScore } from "../../types";
|
|
2
|
+
import type { PerseusMatcherRubric, PerseusMatcherUserInput } from "../../validation.types";
|
|
3
|
+
declare function scoreMatcher(state: PerseusMatcherUserInput, rubric: PerseusMatcherRubric): PerseusScore;
|
|
4
|
+
export default scoreMatcher;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
|
+
import scoreMatrix from "./score-matrix";
|
|
3
4
|
import type { PerseusMatrixWidgetOptions } from "../../perseus-types";
|
|
4
5
|
import type { WidgetProps, Widget, FocusPath } from "../../types";
|
|
5
6
|
import type { PerseusMatrixRubric, PerseusMatrixUserInput } from "../../validation.types";
|
|
7
|
+
import type { MatrixPromptJSON } from "../../widget-ai-utils/matrix/prompt-utils";
|
|
6
8
|
export declare function getMatrixSize(matrix: ReadonlyArray<ReadonlyArray<number>>): number[];
|
|
7
9
|
type ExternalProps = WidgetProps<PerseusMatrixWidgetOptions, PerseusMatrixRubric>;
|
|
8
10
|
type Props = ExternalProps & {
|
|
@@ -45,28 +47,17 @@ declare class Matrix extends React.Component<Props, State> implements Widget {
|
|
|
45
47
|
handleKeyDown: (arg1: any, arg2: any, arg3: any) => void;
|
|
46
48
|
onValueChange: (arg1: any, arg2: any, arg3: any, arg4: any) => void;
|
|
47
49
|
getUserInput(): PerseusMatrixUserInput;
|
|
50
|
+
getPromptJSON(): MatrixPromptJSON;
|
|
48
51
|
render(): React.ReactNode;
|
|
49
52
|
}
|
|
50
|
-
declare const _default:
|
|
53
|
+
declare const _default: {
|
|
51
54
|
name: string;
|
|
52
55
|
displayName: string;
|
|
53
|
-
|
|
56
|
+
hidden: true;
|
|
54
57
|
widget: typeof Matrix;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
getDefaultAlignment?: (() => import("../../types").Alignment) | undefined;
|
|
61
|
-
isLintable?: boolean | undefined;
|
|
62
|
-
tracking?: import("../../types").Tracking | undefined;
|
|
63
|
-
traverseChildWidgets?: any;
|
|
64
|
-
transform?: import("../../types").WidgetTransform | undefined;
|
|
65
|
-
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
66
|
-
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
67
|
-
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
68
|
-
propUpgrades?: {
|
|
69
|
-
[key: string]: (arg1: any) => any;
|
|
70
|
-
} | undefined;
|
|
71
|
-
}>;
|
|
58
|
+
transform: (arg1: any) => any;
|
|
59
|
+
staticTransform: (arg1: any) => any;
|
|
60
|
+
isLintable: true;
|
|
61
|
+
scorer: typeof scoreMatrix;
|
|
62
|
+
};
|
|
72
63
|
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 { PerseusMatrixRubric, PerseusMatrixUserInput } from "../../validation.types";
|
|
4
|
-
declare function
|
|
5
|
-
export default
|
|
4
|
+
declare function scoreMatrix(userInput: PerseusMatrixUserInput, rubric: PerseusMatrixRubric, strings: PerseusStrings): PerseusScore;
|
|
5
|
+
export default scoreMatrix;
|