@khanacademy/perseus 49.2.2 → 50.1.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/article-renderer.d.ts +2 -6
- package/dist/components/graph.d.ts +1 -1
- package/dist/components/graphie.d.ts +1 -1
- package/dist/components/highlighting/ui/highlight-set-renderer.d.ts +1 -4
- package/dist/components/highlighting/ui/highlighting-ui.d.ts +1 -4
- package/dist/components/i18n-context.d.ts +1 -1
- package/dist/components/input-with-examples.d.ts +1 -4
- package/dist/components/math-input.d.ts +2 -6
- package/dist/components/number-input.d.ts +2 -5
- package/dist/components/svg-image.d.ts +1 -1
- package/dist/es/index.js +573 -1354
- package/dist/es/index.js.map +1 -1
- package/dist/es/strings.js +19 -1
- package/dist/es/strings.js.map +1 -1
- package/dist/hint-renderer.d.ts +1 -4
- package/dist/hints-renderer.d.ts +2 -5
- package/dist/index.d.ts +5 -7
- package/dist/index.js +631 -1415
- package/dist/index.js.map +1 -1
- package/dist/renderer-util.d.ts +1 -1
- package/dist/renderer.d.ts +2 -5
- package/dist/server-item-renderer.d.ts +3 -7
- package/dist/strings.d.ts +8 -0
- package/dist/strings.js +19 -0
- package/dist/strings.js.map +1 -1
- package/dist/types.d.ts +11 -2
- package/dist/util/extract-perseus-data.d.ts +1 -1
- package/dist/util/parse-perseus-json/index.d.ts +33 -4
- package/dist/util/parse-perseus-json/perseus-parsers/categorizer-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/cs-program-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/definition-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/dropdown-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/explanation-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/expression-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/graded-group-set-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/graded-group-widget.d.ts +3 -3
- package/dist/util/parse-perseus-json/perseus-parsers/grapher-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/group-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/hint.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/iframe-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/image-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/images-map.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/input-number-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/interaction-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/interactive-graph-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/label-image-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/matcher-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/matrix-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/measurer-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/molecule-renderer-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/number-line-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/numeric-input-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/orderer-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/passage-ref-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/passage-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/perseus-article.d.ts +3 -0
- package/dist/util/parse-perseus-json/perseus-parsers/perseus-image-background.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/perseus-item.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/perseus-renderer.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/phet-simulation-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/plotter-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/python-program-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/radio-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/sorter-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/table-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/versioned-widget-options.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/video-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/widgets-map.d.ts +1 -1
- package/dist/util/test-utils.d.ts +1 -1
- package/dist/util.d.ts +1 -1
- package/dist/validation.types.d.ts +9 -3
- package/dist/widget-ai-utils/grapher/grapher-ai-utils.d.ts +1 -1
- package/dist/widget-ai-utils/interactive-graph/interactive-graph-ai-utils.d.ts +1 -1
- package/dist/widget-ai-utils/mock-widget/prompt-utils.d.ts +13 -0
- package/dist/widget-ai-utils/prompt-types.d.ts +2 -1
- package/dist/widget-container.d.ts +1 -1
- package/dist/widget-type-utils.d.ts +1 -1
- package/dist/widgets/categorizer/categorizer.d.ts +4 -5
- package/dist/widgets/categorizer/categorizer.util.d.ts +17 -0
- package/dist/widgets/cs-program/cs-program.d.ts +1 -1
- package/dist/widgets/definition/definition.d.ts +2 -5
- package/dist/widgets/deprecated-standin/deprecated-standin.d.ts +1 -4
- package/dist/widgets/dropdown/dropdown.d.ts +2 -5
- package/dist/widgets/explanation/explanation.d.ts +2 -5
- package/dist/widgets/expression/expression.d.ts +5 -8
- package/dist/widgets/graded-group/graded-group-answer-bar.d.ts +1 -4
- package/dist/widgets/graded-group/graded-group.d.ts +2 -5
- package/dist/widgets/graded-group-set/graded-group-set.d.ts +1 -1
- package/dist/widgets/grapher/grapher.d.ts +2 -2
- package/dist/widgets/group/group.d.ts +2 -5
- package/dist/widgets/iframe/iframe.d.ts +1 -1
- package/dist/widgets/image/image.d.ts +2 -5
- package/dist/widgets/input-number/input-number.d.ts +2 -6
- package/dist/widgets/interaction/interaction.d.ts +1 -1
- package/dist/widgets/interactive-graph.d.ts +4 -6
- package/dist/widgets/interactive-graphs/backgrounds/grid.d.ts +2 -2
- package/dist/widgets/interactive-graphs/backgrounds/legacy-grid.d.ts +1 -1
- package/dist/widgets/interactive-graphs/graph-locked-labels-layer.d.ts +1 -1
- package/dist/widgets/interactive-graphs/graph-locked-layer.d.ts +1 -1
- package/dist/widgets/interactive-graphs/graphs/circle.d.ts +2 -0
- package/dist/widgets/interactive-graphs/graphs/components/angle-indicators.d.ts +1 -1
- package/dist/widgets/interactive-graphs/interactive-graph-question-builder.d.ts +2 -2
- package/dist/widgets/interactive-graphs/locked-figures/locked-ellipse.d.ts +1 -1
- package/dist/widgets/interactive-graphs/locked-figures/locked-function.d.ts +1 -1
- package/dist/widgets/interactive-graphs/locked-figures/locked-label.d.ts +1 -1
- package/dist/widgets/interactive-graphs/locked-figures/locked-line.d.ts +1 -1
- package/dist/widgets/interactive-graphs/locked-figures/locked-point.d.ts +1 -1
- package/dist/widgets/interactive-graphs/locked-figures/locked-polygon.d.ts +1 -1
- package/dist/widgets/interactive-graphs/locked-figures/locked-vector.d.ts +1 -1
- package/dist/widgets/interactive-graphs/mafs-state-to-interactive-graph.d.ts +1 -1
- package/dist/widgets/interactive-graphs/reducer/initialize-graph-state.d.ts +1 -1
- package/dist/widgets/interactive-graphs/reducer/interactive-graph-state.d.ts +1 -1
- package/dist/widgets/interactive-graphs/reducer/use-graph-config.d.ts +2 -1
- package/dist/widgets/interactive-graphs/stateful-mafs-graph.d.ts +1 -1
- package/dist/widgets/interactive-graphs/types.d.ts +1 -1
- package/dist/widgets/interactive-graphs/utils.d.ts +1 -1
- package/dist/widgets/label-image/label-image.d.ts +2 -5
- package/dist/widgets/label-image/marker.d.ts +1 -4
- package/dist/widgets/matcher/matcher.d.ts +2 -5
- package/dist/widgets/matrix/matrix.d.ts +2 -5
- package/dist/widgets/measurer/measurer.d.ts +1 -1
- package/dist/widgets/mock-widgets/index.d.ts +2 -0
- package/dist/widgets/mock-widgets/mock-asset-loading-widget.d.ts +17 -0
- package/dist/widgets/mock-widgets/mock-widget.d.ts +47 -0
- package/dist/widgets/mock-widgets/score-mock-widget.d.ts +5 -0
- package/dist/widgets/molecule/molecule.d.ts +1 -1
- package/dist/widgets/number-line/number-line.d.ts +1 -4
- package/dist/widgets/numeric-input/numeric-input.d.ts +2 -6
- package/dist/widgets/orderer/orderer.d.ts +1 -1
- package/dist/widgets/passage/passage.d.ts +2 -5
- package/dist/widgets/passage-ref/passage-ref.d.ts +2 -5
- package/dist/widgets/passage-ref-target/passage-ref-target.d.ts +2 -5
- package/dist/widgets/phet-simulation/phet-simulation.d.ts +2 -5
- package/dist/widgets/plotter/plotter.d.ts +2 -5
- package/dist/widgets/radio/base-radio.d.ts +1 -1
- package/dist/widgets/radio/radio-component.d.ts +2 -5
- package/dist/widgets/radio/radio.d.ts +1 -1
- package/dist/widgets/sorter/sorter.d.ts +1 -1
- package/dist/widgets/table/table.d.ts +2 -5
- package/dist/widgets/video/video.d.ts +2 -5
- package/dist/widgets.d.ts +3 -2
- package/package.json +47 -46
- package/dist/interactive2/objective_.d.ts +0 -34
- package/dist/perseus-types.d.ts +0 -980
- package/dist/util/answer-types.d.ts +0 -69
- package/dist/util/math.d.ts +0 -29
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { MoleculeRendererWidget } from "../../../perseus-types";
|
|
2
1
|
import type { Parser } from "../parser-types";
|
|
2
|
+
import type { MoleculeRendererWidget } from "@khanacademy/perseus-core";
|
|
3
3
|
export declare const parseMoleculeRendererWidget: Parser<MoleculeRendererWidget>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Parser } from "../parser-types";
|
|
2
|
-
import type { PerseusImageBackground } from "@khanacademy/perseus";
|
|
2
|
+
import type { PerseusImageBackground } from "@khanacademy/perseus-core";
|
|
3
3
|
export declare const parsePerseusImageBackground: Parser<PerseusImageBackground>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { WidgetOptions } from "../../../perseus-types";
|
|
2
1
|
import type { Parser } from "../parser-types";
|
|
2
|
+
import type { WidgetOptions } from "@khanacademy/perseus-core";
|
|
3
3
|
export declare function parseWidget<Type extends string, Options>(parseType: Parser<Type>, parseOptions: Parser<Options>): Parser<WidgetOptions<Type, Options>>;
|
|
4
4
|
export declare function parseWidgetWithVersion<Version extends {
|
|
5
5
|
major: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { CategorizerWidget, ExpressionWidget, InteractiveGraphWidget, NumericInputWidget, PerseusItem, PerseusRenderer, RadioWidget } from "../perseus-types";
|
|
2
1
|
import type { PerseusScore } from "../types";
|
|
3
2
|
import type { UserInputMap } from "../validation.types";
|
|
3
|
+
import type { CategorizerWidget, ExpressionWidget, InteractiveGraphWidget, NumericInputWidget, PerseusItem, PerseusRenderer, RadioWidget } from "@khanacademy/perseus-core";
|
|
4
4
|
export declare const genericPerseusItemData: PerseusItem;
|
|
5
5
|
/**
|
|
6
6
|
* Thin wrapper around scorePerseusItem for internal testing
|
package/dist/util.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as GraphieUtil from "./util.graphie";
|
|
2
|
-
import type { Range } from "./perseus-types";
|
|
3
2
|
import type { PerseusStrings } from "./strings";
|
|
3
|
+
import type { Range } from "@khanacademy/perseus-core";
|
|
4
4
|
import type * as React from "react";
|
|
5
5
|
type WordPosition = {
|
|
6
6
|
start: number;
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
* } & Perseus<Widget>ValidationData;
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
|
-
import type { GrapherAnswerTypes, PerseusDropdownChoice, PerseusExpressionAnswerForm, PerseusGradedGroupSetWidgetOptions, PerseusGradedGroupWidgetOptions, PerseusGraphType, PerseusGroupWidgetOptions, PerseusMatcherWidgetOptions, PerseusMatrixWidgetAnswers, PerseusNumericInputAnswer, PerseusOrdererWidgetOptions, PerseusRadioChoice, PerseusGraphCorrectType } from "./perseus-types";
|
|
31
30
|
import type { InteractiveMarkerType } from "./widgets/label-image/types";
|
|
32
31
|
import type { Relationship } from "./widgets/number-line/number-line";
|
|
32
|
+
import type { GrapherAnswerTypes, PerseusDropdownChoice, PerseusExpressionAnswerForm, PerseusGradedGroupSetWidgetOptions, PerseusGradedGroupWidgetOptions, PerseusGraphType, PerseusGroupWidgetOptions, PerseusMatcherWidgetOptions, PerseusMatrixWidgetAnswers, PerseusNumericInputAnswer, PerseusOrdererWidgetOptions, PerseusRadioChoice, PerseusGraphCorrectType } from "@khanacademy/perseus-core";
|
|
33
33
|
export type UserInputStatus = "correct" | "incorrect" | "incomplete";
|
|
34
34
|
export type PerseusCategorizerScoringData = {
|
|
35
35
|
values: ReadonlyArray<number>;
|
|
@@ -100,6 +100,12 @@ export type PerseusMatrixValidationData = Empty;
|
|
|
100
100
|
export type PerseusMatrixUserInput = {
|
|
101
101
|
answers: PerseusMatrixRubric["answers"];
|
|
102
102
|
};
|
|
103
|
+
export type PerseusMockWidgetRubric = {
|
|
104
|
+
value: string;
|
|
105
|
+
};
|
|
106
|
+
export type PerseusMockWidgetUserInput = {
|
|
107
|
+
currentValue: string;
|
|
108
|
+
};
|
|
103
109
|
export type PerseusNumberLineScoringData = {
|
|
104
110
|
correctRel: string | null | undefined;
|
|
105
111
|
correctX: number;
|
|
@@ -149,8 +155,8 @@ export type PerseusTableRubric = {
|
|
|
149
155
|
answers: ReadonlyArray<ReadonlyArray<string>>;
|
|
150
156
|
};
|
|
151
157
|
export type PerseusTableUserInput = ReadonlyArray<ReadonlyArray<string>>;
|
|
152
|
-
export type Rubric = PerseusCategorizerScoringData | PerseusCSProgramRubric | PerseusDropdownRubric | PerseusExpressionRubric | PerseusGroupRubric | PerseusGradedGroupRubric | PerseusGradedGroupSetRubric | PerseusGrapherRubric | PerseusIFrameRubric | PerseusInputNumberRubric | PerseusInteractiveGraphRubric | PerseusLabelImageRubric | PerseusMatcherRubric | PerseusMatrixRubric | PerseusNumberLineScoringData | PerseusNumericInputRubric | PerseusOrdererRubric | PerseusPlotterScoringData | PerseusRadioRubric | PerseusSorterRubric | PerseusTableRubric;
|
|
153
|
-
export type UserInput = PerseusCategorizerUserInput | PerseusCSProgramUserInput | PerseusDropdownUserInput | PerseusExpressionUserInput | PerseusGrapherUserInput | PerseusIFrameUserInput | PerseusInputNumberUserInput | PerseusInteractiveGraphUserInput | PerseusLabelImageUserInput | PerseusMatcherUserInput | PerseusMatrixUserInput | PerseusNumberLineUserInput | PerseusNumericInputUserInput | PerseusOrdererUserInput | PerseusPlotterUserInput | PerseusRadioUserInput | PerseusSorterUserInput | PerseusTableUserInput;
|
|
158
|
+
export type Rubric = PerseusCategorizerScoringData | PerseusCSProgramRubric | PerseusDropdownRubric | PerseusExpressionRubric | PerseusGroupRubric | PerseusGradedGroupRubric | PerseusGradedGroupSetRubric | PerseusGrapherRubric | PerseusIFrameRubric | PerseusInputNumberRubric | PerseusInteractiveGraphRubric | PerseusLabelImageRubric | PerseusMatcherRubric | PerseusMatrixRubric | PerseusMockWidgetRubric | PerseusNumberLineScoringData | PerseusNumericInputRubric | PerseusOrdererRubric | PerseusPlotterScoringData | PerseusRadioRubric | PerseusSorterRubric | PerseusTableRubric;
|
|
159
|
+
export type UserInput = PerseusCategorizerUserInput | PerseusCSProgramUserInput | PerseusDropdownUserInput | PerseusExpressionUserInput | PerseusGrapherUserInput | PerseusIFrameUserInput | PerseusInputNumberUserInput | PerseusInteractiveGraphUserInput | PerseusLabelImageUserInput | PerseusMatcherUserInput | PerseusMatrixUserInput | PerseusMockWidgetUserInput | PerseusNumberLineUserInput | PerseusNumericInputUserInput | PerseusOrdererUserInput | PerseusPlotterUserInput | PerseusRadioUserInput | PerseusSorterUserInput | PerseusTableUserInput;
|
|
154
160
|
export type UserInputMap = {
|
|
155
161
|
[widgetId: string]: UserInput | UserInputMap;
|
|
156
162
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { GrapherAnswerTypes } from "../../perseus-types";
|
|
2
1
|
import type { PerseusGrapherUserInput } from "../../validation.types";
|
|
3
2
|
import type grapher from "../../widgets/grapher/grapher";
|
|
3
|
+
import type { GrapherAnswerTypes } from "@khanacademy/perseus-core";
|
|
4
4
|
import type React from "react";
|
|
5
5
|
export type GrapherPromptJSON = {
|
|
6
6
|
type: "grapher";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { PerseusGraphType } from "../../perseus-types";
|
|
2
1
|
import type interactiveGraph from "../../widgets/interactive-graph";
|
|
3
2
|
import type { UnsupportedWidgetPromptJSON } from "../unsupported-widget";
|
|
3
|
+
import type { PerseusGraphType } from "@khanacademy/perseus-core";
|
|
4
4
|
import type React from "react";
|
|
5
5
|
type Coord = [x: number, y: number];
|
|
6
6
|
type CollinearTuple = readonly [Coord, Coord];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PerseusMockWidgetUserInput } from "../../validation.types";
|
|
2
|
+
import type mockWidget from "../../widgets/mock-widgets/mock-widget";
|
|
3
|
+
import type React from "react";
|
|
4
|
+
export type MockWidgetPromptJSON = {
|
|
5
|
+
type: "mock-widget";
|
|
6
|
+
options: {
|
|
7
|
+
value: string;
|
|
8
|
+
};
|
|
9
|
+
userInput: {
|
|
10
|
+
value: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare const getPromptJSON: (renderProps: React.ComponentProps<typeof mockWidget.widget>, userInput: PerseusMockWidgetUserInput) => MockWidgetPromptJSON;
|
|
@@ -12,6 +12,7 @@ import type { InputNumberPromptJSON } from "./input-number/input-number-ai-utils
|
|
|
12
12
|
import type { LabelImagePromptJSON } from "./label-image/label-image-ai-utils";
|
|
13
13
|
import type { MatcherPromptJSON } from "./matcher/matcher-ai-utils";
|
|
14
14
|
import type { MatrixPromptJSON } from "./matrix/matrix-ai-utils";
|
|
15
|
+
import type { MockWidgetPromptJSON } from "./mock-widget/prompt-utils";
|
|
15
16
|
import type { NumberLinePromptJSON } from "./number-line/number-line-ai-utils";
|
|
16
17
|
import type { NumericInputPromptJSON } from "./numeric-input/prompt-utils";
|
|
17
18
|
import type { OrdererPromptJSON } from "./orderer/orderer-ai-utils";
|
|
@@ -21,7 +22,7 @@ import type { RadioPromptJSON } from "./radio/radio-ai-utils";
|
|
|
21
22
|
import type { SorterPromptJSON } from "./sorter/sorter-ai-utils";
|
|
22
23
|
import type { UnsupportedWidgetPromptJSON } from "./unsupported-widget";
|
|
23
24
|
export type UnsupportedWidget = "cs-program" | "iframe" | "interaction" | "interactive-graph-unsupported" | "measurer" | "phet-simulation" | "plotter" | "python-program" | "video";
|
|
24
|
-
export type WidgetPromptJSON = CategorizerPromptJSON | DefinitionPromptJSON | DropdownPromptJSON | ExplanationPromptJSON | ExpressionPromptJSON | GradedGroupPromptJSON | GradedGroupSetPromptJSON | GrapherPromptJSON | GroupPromptJSON | ImagePromptJSON | InputNumberPromptJSON | LabelImagePromptJSON | MatcherPromptJSON | MatrixPromptJSON | NumberLinePromptJSON | NumericInputPromptJSON | OrdererPromptJSON | PassagePromptJSON | PassageRefPromptJSON | RadioPromptJSON | SorterPromptJSON | UnsupportedWidgetPromptJSON;
|
|
25
|
+
export type WidgetPromptJSON = CategorizerPromptJSON | DefinitionPromptJSON | DropdownPromptJSON | ExplanationPromptJSON | ExpressionPromptJSON | GradedGroupPromptJSON | GradedGroupSetPromptJSON | GrapherPromptJSON | GroupPromptJSON | ImagePromptJSON | InputNumberPromptJSON | LabelImagePromptJSON | MatcherPromptJSON | MatrixPromptJSON | MockWidgetPromptJSON | NumberLinePromptJSON | NumericInputPromptJSON | OrdererPromptJSON | PassagePromptJSON | PassageRefPromptJSON | RadioPromptJSON | SorterPromptJSON | UnsupportedWidgetPromptJSON;
|
|
25
26
|
export type RendererPromptJSON = {
|
|
26
27
|
content: string;
|
|
27
28
|
widgets: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type { PerseusWidgetOptions } from "./perseus-types";
|
|
3
2
|
import type { WidgetProps } from "./types";
|
|
3
|
+
import type { PerseusWidgetOptions } from "@khanacademy/perseus-core";
|
|
4
4
|
import type { LinterContextProps } from "@khanacademy/perseus-linter";
|
|
5
5
|
type Props = {
|
|
6
6
|
shouldHighlight: boolean;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
|
+
import getCategorizerPublicWidgetOptions from "./categorizer.util";
|
|
3
4
|
import scoreCategorizer from "./score-categorizer";
|
|
4
|
-
import type { PerseusCategorizerWidgetOptions } from "../../perseus-types";
|
|
5
5
|
import type { Widget, WidgetProps } from "../../types";
|
|
6
6
|
import type { PerseusCategorizerScoringData, PerseusCategorizerUserInput } from "../../validation.types";
|
|
7
7
|
import type { CategorizerPromptJSON } from "../../widget-ai-utils/categorizer/categorizer-ai-utils";
|
|
8
|
+
import type { PerseusCategorizerWidgetOptions } from "@khanacademy/perseus-core";
|
|
8
9
|
type Props = WidgetProps<RenderProps, PerseusCategorizerScoringData> & {
|
|
9
10
|
values: ReadonlyArray<string>;
|
|
10
11
|
};
|
|
@@ -18,10 +19,7 @@ type State = {
|
|
|
18
19
|
uniqueId: string;
|
|
19
20
|
};
|
|
20
21
|
export declare class Categorizer extends React.Component<Props, State> implements Widget {
|
|
21
|
-
static contextType: React.Context<
|
|
22
|
-
strings: import("../../strings").PerseusStrings;
|
|
23
|
-
locale: string;
|
|
24
|
-
}>;
|
|
22
|
+
static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
|
|
25
23
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
26
24
|
static defaultProps: DefaultProps;
|
|
27
25
|
state: State;
|
|
@@ -47,5 +45,6 @@ declare const _default: {
|
|
|
47
45
|
staticTransform: (editorProps: PerseusCategorizerWidgetOptions) => RenderProps;
|
|
48
46
|
isLintable: true;
|
|
49
47
|
scorer: typeof scoreCategorizer;
|
|
48
|
+
getPublicWidgetOptions: typeof getCategorizerPublicWidgetOptions;
|
|
50
49
|
};
|
|
51
50
|
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PerseusCategorizerWidgetOptions } from "@khanacademy/perseus-core";
|
|
2
|
+
/**
|
|
3
|
+
* For details on the individual options, see the
|
|
4
|
+
* PerseusCategorizerWidgetOptions type
|
|
5
|
+
*/
|
|
6
|
+
type CategorizerPublicWidgetOptions = {
|
|
7
|
+
items: PerseusCategorizerWidgetOptions["items"];
|
|
8
|
+
categories: PerseusCategorizerWidgetOptions["categories"];
|
|
9
|
+
randomizeItems: PerseusCategorizerWidgetOptions["randomizeItems"];
|
|
10
|
+
static: PerseusCategorizerWidgetOptions["static"];
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Given a PerseusCategorizerWidgetOptions object, return a new object with only
|
|
14
|
+
* the public options that should be exposed to the client.
|
|
15
|
+
*/
|
|
16
|
+
declare function getCategorizerPublicWidgetOptions(options: PerseusCategorizerWidgetOptions): CategorizerPublicWidgetOptions;
|
|
17
|
+
export default getCategorizerPublicWidgetOptions;
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import scoreCSProgram from "./score-cs-program";
|
|
6
|
-
import type { PerseusCSProgramWidgetOptions } from "../../perseus-types";
|
|
7
6
|
import type { Widget, WidgetProps } from "../../types";
|
|
8
7
|
import type { PerseusCSProgramRubric, PerseusCSProgramUserInput } from "../../validation.types";
|
|
9
8
|
import type { UnsupportedWidgetPromptJSON } from "../../widget-ai-utils/unsupported-widget";
|
|
9
|
+
import type { PerseusCSProgramWidgetOptions } from "@khanacademy/perseus-core";
|
|
10
10
|
type RenderProps = PerseusCSProgramWidgetOptions & PerseusCSProgramUserInput;
|
|
11
11
|
type Props = WidgetProps<RenderProps, PerseusCSProgramRubric>;
|
|
12
12
|
type DefaultProps = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
|
-
import type { PerseusRenderer, PerseusDefinitionWidgetOptions } from "../../perseus-types";
|
|
4
3
|
import type { Widget, WidgetProps } from "../../types";
|
|
5
4
|
import type { DefinitionPromptJSON } from "../../widget-ai-utils/definition/definition-ai-utils";
|
|
5
|
+
import type { PerseusRenderer, PerseusDefinitionWidgetOptions } from "@khanacademy/perseus-core";
|
|
6
6
|
type RenderProps = PerseusDefinitionWidgetOptions;
|
|
7
7
|
type DefinitionProps = WidgetProps<RenderProps> & {
|
|
8
8
|
widgets: PerseusRenderer["widgets"];
|
|
@@ -12,10 +12,7 @@ type DefaultProps = {
|
|
|
12
12
|
definition: string;
|
|
13
13
|
};
|
|
14
14
|
declare class Definition extends React.Component<DefinitionProps> implements Widget {
|
|
15
|
-
static contextType: React.Context<
|
|
16
|
-
strings: import("../../strings").PerseusStrings;
|
|
17
|
-
locale: string;
|
|
18
|
-
}>;
|
|
15
|
+
static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
|
|
19
16
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
20
17
|
static defaultProps: DefaultProps;
|
|
21
18
|
isWidget: true;
|
|
@@ -3,10 +3,7 @@ import { PerseusI18nContext } from "../../components/i18n-context";
|
|
|
3
3
|
import type { Widget } from "../../types";
|
|
4
4
|
type Props = object;
|
|
5
5
|
declare class DeprecatedStandin extends React.Component<Props> implements Widget {
|
|
6
|
-
static contextType: React.Context<
|
|
7
|
-
strings: import("../../strings").PerseusStrings;
|
|
8
|
-
locale: string;
|
|
9
|
-
}>;
|
|
6
|
+
static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
|
|
10
7
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
11
8
|
isWidget: true;
|
|
12
9
|
render(): React.JSX.Element;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
3
|
import scoreDropdown from "./score-dropdown";
|
|
4
|
-
import type { PerseusDropdownWidgetOptions } from "../../perseus-types";
|
|
5
4
|
import type { Widget, WidgetProps } from "../../types";
|
|
6
5
|
import type { PerseusDropdownRubric, PerseusDropdownUserInput } from "../../validation.types";
|
|
7
6
|
import type { DropdownPromptJSON } from "../../widget-ai-utils/dropdown/dropdown-ai-utils";
|
|
7
|
+
import type { PerseusDropdownWidgetOptions } from "@khanacademy/perseus-core";
|
|
8
8
|
type Props = WidgetProps<RenderProps, PerseusDropdownRubric> & {
|
|
9
9
|
selected: number;
|
|
10
10
|
};
|
|
@@ -15,10 +15,7 @@ type DefaultProps = {
|
|
|
15
15
|
apiOptions: Props["apiOptions"];
|
|
16
16
|
};
|
|
17
17
|
declare class Dropdown extends React.Component<Props> implements Widget {
|
|
18
|
-
static contextType: React.Context<
|
|
19
|
-
strings: import("../../strings").PerseusStrings;
|
|
20
|
-
locale: string;
|
|
21
|
-
}>;
|
|
18
|
+
static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
|
|
22
19
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
23
20
|
static defaultProps: DefaultProps;
|
|
24
21
|
focus: () => boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
|
-
import type { PerseusExplanationWidgetOptions } from "../../perseus-types";
|
|
4
3
|
import type { Widget, WidgetProps } from "../../types";
|
|
5
4
|
import type { ExplanationPromptJSON } from "../../widget-ai-utils/explanation/explanation-ai-utils";
|
|
5
|
+
import type { PerseusExplanationWidgetOptions } from "@khanacademy/perseus-core";
|
|
6
6
|
type RenderProps = PerseusExplanationWidgetOptions;
|
|
7
7
|
type Props = WidgetProps<RenderProps>;
|
|
8
8
|
type DefaultProps = {
|
|
@@ -16,10 +16,7 @@ type State = {
|
|
|
16
16
|
expanded: boolean;
|
|
17
17
|
};
|
|
18
18
|
declare class Explanation extends React.Component<Props, State> implements Widget {
|
|
19
|
-
static contextType: React.Context<
|
|
20
|
-
strings: import("../../strings").PerseusStrings;
|
|
21
|
-
locale: string;
|
|
22
|
-
}>;
|
|
19
|
+
static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
|
|
23
20
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
24
21
|
static defaultProps: DefaultProps;
|
|
25
22
|
isWidget: true;
|
|
@@ -2,11 +2,11 @@ import * as React from "react";
|
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
3
|
import scoreExpression from "./score-expression";
|
|
4
4
|
import type { DependenciesContext } from "../../dependencies";
|
|
5
|
-
import type { PerseusExpressionWidgetOptions } from "../../perseus-types";
|
|
6
5
|
import type { FocusPath, Widget, WidgetProps } from "../../types";
|
|
7
6
|
import type { PerseusExpressionRubric, PerseusExpressionUserInput } from "../../validation.types";
|
|
8
7
|
import type { ExpressionPromptJSON } from "../../widget-ai-utils/expression/expression-ai-utils";
|
|
9
8
|
import type { Keys as Key, KeypadConfiguration } from "@khanacademy/math-input";
|
|
9
|
+
import type { PerseusExpressionWidgetOptions } from "@khanacademy/perseus-core";
|
|
10
10
|
type InputPath = ReadonlyArray<string>;
|
|
11
11
|
type RenderProps = {
|
|
12
12
|
buttonSets: PerseusExpressionWidgetOptions["buttonSets"];
|
|
@@ -46,10 +46,7 @@ type DefaultProps = {
|
|
|
46
46
|
value: Props["value"];
|
|
47
47
|
};
|
|
48
48
|
export declare class Expression extends React.Component<Props, ExpressionState> implements Widget {
|
|
49
|
-
static contextType: React.Context<
|
|
50
|
-
strings: import("../../strings").PerseusStrings;
|
|
51
|
-
locale: string;
|
|
52
|
-
}>;
|
|
49
|
+
static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
|
|
53
50
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
54
51
|
_textareaId: string;
|
|
55
52
|
_isMounted: boolean;
|
|
@@ -134,7 +131,7 @@ declare const _default: {
|
|
|
134
131
|
flags?: {
|
|
135
132
|
mafs?: false | { [Key in typeof import("../../types").MafsGraphTypeFlags[number]]?: boolean; };
|
|
136
133
|
};
|
|
137
|
-
onWidgetStartProps?: (widgets: import("
|
|
134
|
+
onWidgetStartProps?: (widgets: import("@khanacademy/perseus-core").PerseusWidgetsMap) => void;
|
|
138
135
|
}> & {
|
|
139
136
|
GroupMetadataEditor: NonNullable<import("../..").APIOptions["GroupMetadataEditor"]>;
|
|
140
137
|
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
@@ -212,7 +209,7 @@ declare const _default: {
|
|
|
212
209
|
flags?: {
|
|
213
210
|
mafs?: false | { [Key in typeof import("../../types").MafsGraphTypeFlags[number]]?: boolean; };
|
|
214
211
|
};
|
|
215
|
-
onWidgetStartProps?: (widgets: import("
|
|
212
|
+
onWidgetStartProps?: (widgets: import("@khanacademy/perseus-core").PerseusWidgetsMap) => void;
|
|
216
213
|
}> & {
|
|
217
214
|
GroupMetadataEditor: NonNullable<import("../..").APIOptions["GroupMetadataEditor"]>;
|
|
218
215
|
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
@@ -228,7 +225,7 @@ declare const _default: {
|
|
|
228
225
|
showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
|
|
229
226
|
}> | undefined;
|
|
230
227
|
linterContext?: import("@khanacademy/perseus-linter").LinterContextProps | undefined;
|
|
231
|
-
buttonSets?: import("
|
|
228
|
+
buttonSets?: import("@khanacademy/perseus-core").LegacyButtonSets | undefined;
|
|
232
229
|
functions?: readonly string[] | undefined;
|
|
233
230
|
times?: boolean | undefined;
|
|
234
231
|
} & {}, keyof import("../..").PerseusDependenciesV2> & React.RefAttributes<Expression>>;
|
|
@@ -9,10 +9,7 @@ type Props = {
|
|
|
9
9
|
onNextQuestion?: () => unknown;
|
|
10
10
|
};
|
|
11
11
|
declare class GradedGroupAnswerBar extends React.Component<Props> {
|
|
12
|
-
static contextType: React.Context<
|
|
13
|
-
strings: import("../../strings").PerseusStrings;
|
|
14
|
-
locale: string;
|
|
15
|
-
}>;
|
|
12
|
+
static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
|
|
16
13
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
17
14
|
render(): React.ReactNode;
|
|
18
15
|
}
|
|
@@ -2,10 +2,10 @@ import * as React from "react";
|
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
3
|
import Renderer from "../../renderer";
|
|
4
4
|
import type { ANSWER_BAR_STATES } from "./graded-group-answer-bar";
|
|
5
|
-
import type { PerseusGradedGroupWidgetOptions } from "../../perseus-types";
|
|
6
5
|
import type { FocusPath, TrackingGradedGroupExtraArguments, Widget, WidgetProps } from "../../types";
|
|
7
6
|
import type { PerseusGradedGroupRubric } from "../../validation.types";
|
|
8
7
|
import type { GradedGroupPromptJSON } from "../../widget-ai-utils/graded-group/graded-group-ai-utils";
|
|
8
|
+
import type { PerseusGradedGroupWidgetOptions } from "@khanacademy/perseus-core";
|
|
9
9
|
declare const GRADING_STATUSES: {
|
|
10
10
|
readonly ungraded: "ungraded";
|
|
11
11
|
readonly correct: "correct";
|
|
@@ -33,10 +33,7 @@ type State = {
|
|
|
33
33
|
answerBarState: ANSWER_BAR_STATES;
|
|
34
34
|
};
|
|
35
35
|
export declare class GradedGroup extends React.Component<Props, State> implements Widget {
|
|
36
|
-
static contextType: React.Context<
|
|
37
|
-
strings: import("../../strings").PerseusStrings;
|
|
38
|
-
locale: string;
|
|
39
|
-
}>;
|
|
36
|
+
static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
|
|
40
37
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
41
38
|
static defaultProps: DefaultProps;
|
|
42
39
|
state: State;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as Changeable from "../../mixins/changeable";
|
|
3
3
|
import { GradedGroup } from "../graded-group/graded-group";
|
|
4
|
-
import type { PerseusGradedGroupSetWidgetOptions } from "../../perseus-types";
|
|
5
4
|
import type { FocusPath, Widget, WidgetProps } from "../../types";
|
|
6
5
|
import type { PerseusGradedGroupSetRubric } from "../../validation.types";
|
|
7
6
|
import type { GradedGroupSetPromptJSON } from "../../widget-ai-utils/graded-group-set/graded-group-set-ai-utils";
|
|
7
|
+
import type { PerseusGradedGroupSetWidgetOptions } from "@khanacademy/perseus-core";
|
|
8
8
|
type RenderProps = PerseusGradedGroupSetWidgetOptions;
|
|
9
9
|
type Props = Changeable.ChangeableProps & WidgetProps<RenderProps, PerseusGradedGroupSetRubric> & {
|
|
10
10
|
trackInteraction: () => void;
|
|
@@ -2,11 +2,11 @@ import * as React from "react";
|
|
|
2
2
|
import Graphie from "../../components/graphie";
|
|
3
3
|
import scoreGrapher from "./score-grapher";
|
|
4
4
|
import type { Coord } from "../../interactive2/types";
|
|
5
|
-
import type { PerseusGrapherWidgetOptions } from "../../perseus-types";
|
|
6
5
|
import type { Widget, WidgetProps } from "../../types";
|
|
7
6
|
import type { GridDimensions } from "../../util";
|
|
8
7
|
import type { PerseusGrapherRubric, PerseusGrapherUserInput } from "../../validation.types";
|
|
9
8
|
import type { GrapherPromptJSON } from "../../widget-ai-utils/grapher/grapher-ai-utils";
|
|
9
|
+
import type { MarkingsType, PerseusGrapherWidgetOptions } from "@khanacademy/perseus-core";
|
|
10
10
|
import type { PropsFor } from "@khanacademy/wonder-blocks-core";
|
|
11
11
|
type RenderProps = {
|
|
12
12
|
availableTypes: PerseusGrapherWidgetOptions["availableTypes"];
|
|
@@ -16,7 +16,7 @@ type RenderProps = {
|
|
|
16
16
|
type ExternalProps = WidgetProps<RenderProps, PerseusGrapherRubric>;
|
|
17
17
|
type Props = ExternalProps & {
|
|
18
18
|
plot: NonNullable<RenderProps["plot"]>;
|
|
19
|
-
markings:
|
|
19
|
+
markings: MarkingsType;
|
|
20
20
|
};
|
|
21
21
|
type DefaultProps = {
|
|
22
22
|
plot: RenderProps["plot"];
|
|
@@ -2,10 +2,10 @@ import * as React from "react";
|
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
3
|
import Renderer from "../../renderer";
|
|
4
4
|
import scoreGroup from "./score-group";
|
|
5
|
-
import type { PerseusGroupWidgetOptions } from "../../perseus-types";
|
|
6
5
|
import type { ChangeFn, FocusPath, Widget, WidgetProps } from "../../types";
|
|
7
6
|
import type { PerseusGroupRubric, UserInputArray } from "../../validation.types";
|
|
8
7
|
import type { GroupPromptJSON } from "../../widget-ai-utils/group/group-ai-utils";
|
|
8
|
+
import type { PerseusGroupWidgetOptions } from "@khanacademy/perseus-core";
|
|
9
9
|
type RenderProps = PerseusGroupWidgetOptions;
|
|
10
10
|
type Props = WidgetProps<RenderProps, PerseusGroupRubric>;
|
|
11
11
|
type DefaultProps = {
|
|
@@ -15,10 +15,7 @@ type DefaultProps = {
|
|
|
15
15
|
linterContext: Props["linterContext"];
|
|
16
16
|
};
|
|
17
17
|
declare class Group extends React.Component<Props> implements Widget {
|
|
18
|
-
static contextType: React.Context<
|
|
19
|
-
strings: import("../../strings").PerseusStrings;
|
|
20
|
-
locale: string;
|
|
21
|
-
}>;
|
|
18
|
+
static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
|
|
22
19
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
23
20
|
rendererRef: Renderer | null | undefined;
|
|
24
21
|
static defaultProps: DefaultProps;
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import * as React from "react";
|
|
10
10
|
import { scoreIframe } from "./score-iframe";
|
|
11
|
-
import type { PerseusIFrameWidgetOptions } from "../../perseus-types";
|
|
12
11
|
import type { WidgetProps, Widget } from "../../types";
|
|
13
12
|
import type { PerseusIFrameRubric, PerseusIFrameUserInput, UserInputStatus } from "../../validation.types";
|
|
14
13
|
import type { UnsupportedWidgetPromptJSON } from "../../widget-ai-utils/unsupported-widget";
|
|
14
|
+
import type { PerseusIFrameWidgetOptions } from "@khanacademy/perseus-core";
|
|
15
15
|
type RenderProps = PerseusIFrameWidgetOptions & {
|
|
16
16
|
status: UserInputStatus;
|
|
17
17
|
message: string | null;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
|
-
import type { PerseusImageWidgetOptions } from "../../perseus-types";
|
|
4
3
|
import type { ChangeFn, WidgetProps, Widget } from "../../types";
|
|
5
4
|
import type { ImagePromptJSON } from "../../widget-ai-utils/image/image-ai-utils";
|
|
5
|
+
import type { PerseusImageWidgetOptions } from "@khanacademy/perseus-core";
|
|
6
6
|
type RenderProps = PerseusImageWidgetOptions;
|
|
7
7
|
type ExternalProps = WidgetProps<RenderProps>;
|
|
8
8
|
type Props = ExternalProps & {
|
|
@@ -28,10 +28,7 @@ type DefaultProps = {
|
|
|
28
28
|
linterContext: Props["linterContext"];
|
|
29
29
|
};
|
|
30
30
|
declare class ImageWidget extends React.Component<Props> implements Widget {
|
|
31
|
-
static contextType: React.Context<
|
|
32
|
-
strings: import("../../strings").PerseusStrings;
|
|
33
|
-
locale: string;
|
|
34
|
-
}>;
|
|
31
|
+
static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
|
|
35
32
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
36
33
|
static defaultProps: DefaultProps;
|
|
37
34
|
isWidget: true;
|