@khanacademy/perseus 35.0.0 → 36.0.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/es/index.js +19402 -19310
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +19493 -19400
- package/dist/index.js.map +1 -1
- package/dist/multi-items/multi-renderer.d.ts +1 -2
- package/dist/perseus-api.d.ts +2 -0
- package/dist/perseus-types.d.ts +42 -35
- package/dist/renderer.d.ts +2 -33
- package/dist/server-item-renderer.d.ts +3 -1
- package/dist/types.d.ts +43 -8
- package/dist/util.d.ts +1 -8
- package/dist/validation.types.d.ts +8 -11
- package/dist/widgets/categorizer/categorizer.d.ts +2 -2
- package/dist/widgets/cs-program/cs-program-validator.d.ts +3 -0
- package/dist/widgets/cs-program/cs-program.d.ts +5 -4
- package/dist/widgets/definition/definition.d.ts +4 -4
- package/dist/widgets/deprecated-standin/index.d.ts +6 -7
- package/dist/widgets/dropdown/dropdown.d.ts +2 -2
- package/dist/widgets/explanation/explanation.d.ts +4 -4
- package/dist/widgets/expression/expression.d.ts +50 -38
- package/dist/widgets/graded-group/graded-group.d.ts +2 -2
- package/dist/widgets/graded-group-set/graded-group-set.d.ts +2 -2
- package/dist/widgets/grapher/grapher-validator.d.ts +4 -0
- package/dist/widgets/grapher/grapher.d.ts +2 -3
- package/dist/widgets/grapher/util.d.ts +0 -2
- package/dist/widgets/group/group.d.ts +5 -5
- package/dist/widgets/iframe/iframe-validator.d.ts +3 -0
- package/dist/widgets/iframe/iframe.d.ts +4 -3
- package/dist/widgets/image/image.d.ts +4 -5
- package/dist/widgets/input-number/input-number.d.ts +2 -2
- package/dist/widgets/interaction/interaction.d.ts +4 -4
- package/dist/widgets/interactive-graph.d.ts +5 -5
- package/dist/widgets/interactive-graphs/backgrounds/axis-ticks.d.ts +1 -1
- package/dist/widgets/interactive-graphs/graph-locked-layer.d.ts +2 -0
- package/dist/widgets/interactive-graphs/interactive-graph-question-builder.d.ts +7 -0
- package/dist/widgets/interactive-graphs/interactive-graph-validator.d.ts +4 -0
- package/dist/widgets/interactive-graphs/locked-figures/locked-ellipse.d.ts +5 -1
- package/dist/widgets/interactive-graphs/locked-figures/locked-function.d.ts +5 -1
- package/dist/widgets/interactive-graphs/locked-figures/locked-line.d.ts +2 -0
- package/dist/widgets/interactive-graphs/locked-figures/locked-point.d.ts +5 -1
- package/dist/widgets/interactive-graphs/locked-figures/locked-polygon.d.ts +5 -1
- package/dist/widgets/interactive-graphs/locked-figures/locked-vector.d.ts +5 -1
- package/dist/widgets/interactive-graphs/mafs-state-to-interactive-graph.d.ts +3 -0
- package/dist/widgets/label-image/label-image.d.ts +6 -2
- package/dist/widgets/matcher/matcher-validator.d.ts +4 -0
- package/dist/widgets/matcher/matcher.d.ts +4 -3
- package/dist/widgets/matrix/matrix-validator.d.ts +5 -0
- package/dist/widgets/matrix/matrix.d.ts +4 -3
- package/dist/widgets/measurer/measurer.d.ts +47 -2
- package/dist/widgets/molecule/molecule.d.ts +2 -1
- package/dist/widgets/number-line/number-line-validator.d.ts +4 -0
- package/dist/widgets/number-line/number-line.d.ts +7 -6
- package/dist/widgets/numeric-input/numeric-input.d.ts +2 -2
- package/dist/widgets/orderer/orderer-validator.d.ts +3 -0
- package/dist/widgets/orderer/orderer.d.ts +4 -3
- package/dist/widgets/passage/passage.d.ts +4 -4
- package/dist/widgets/passage/utils.d.ts +12 -0
- package/dist/widgets/passage-ref/passage-ref.d.ts +4 -4
- package/dist/widgets/passage-ref-target/passage-ref-target.d.ts +4 -4
- package/dist/widgets/phet-simulation/phet-simulation.d.ts +4 -4
- package/dist/widgets/plotter/plotter-validator.d.ts +4 -0
- package/dist/widgets/plotter/plotter.d.ts +3 -2
- package/dist/widgets/python-program/python-program.d.ts +6 -1
- package/dist/widgets/radio/radio-component.d.ts +2 -2
- package/dist/widgets/sorter/sorter.d.ts +2 -2
- package/dist/widgets/table/table-validator.d.ts +5 -0
- package/dist/widgets/table/table.d.ts +4 -3
- package/dist/widgets/video/video.d.ts +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PerseusScore } from "../../types";
|
|
2
|
+
import type { PerseusInteractiveGraphRubric, PerseusInteractiveGraphUserInput } from "../../validation.types";
|
|
3
|
+
declare function interactiveGraphValidator(userInput: PerseusInteractiveGraphUserInput, rubric: PerseusInteractiveGraphRubric): PerseusScore;
|
|
4
|
+
export default interactiveGraphValidator;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type LockedEllipseType } from "../../../perseus-types";
|
|
3
|
-
|
|
3
|
+
import type { APIOptions } from "../../../types";
|
|
4
|
+
type Props = LockedEllipseType & {
|
|
5
|
+
flags?: APIOptions["flags"];
|
|
6
|
+
};
|
|
7
|
+
declare const LockedEllipse: (props: Props) => React.JSX.Element;
|
|
4
8
|
export default LockedEllipse;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { LockedFunctionType } from "../../../perseus-types";
|
|
3
|
-
|
|
3
|
+
import type { APIOptions } from "../../../types";
|
|
4
|
+
type Props = LockedFunctionType & {
|
|
5
|
+
flags?: APIOptions["flags"];
|
|
6
|
+
};
|
|
7
|
+
declare const LockedFunction: (props: Props) => React.JSX.Element | null;
|
|
4
8
|
export default LockedFunction;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { LockedLineType } from "../../../perseus-types";
|
|
3
|
+
import type { APIOptions } from "../../../types";
|
|
3
4
|
import type { Interval } from "mafs";
|
|
4
5
|
type Props = LockedLineType & {
|
|
6
|
+
flags?: APIOptions["flags"];
|
|
5
7
|
range: [Interval, Interval];
|
|
6
8
|
};
|
|
7
9
|
declare const LockedLine: (props: Props) => React.JSX.Element;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type LockedPointType } from "../../../perseus-types";
|
|
3
|
-
|
|
3
|
+
import type { APIOptions } from "../../../types";
|
|
4
|
+
type Props = LockedPointType & {
|
|
5
|
+
flags?: APIOptions["flags"];
|
|
6
|
+
};
|
|
7
|
+
declare const LockedPoint: (props: Props) => React.JSX.Element;
|
|
4
8
|
export default LockedPoint;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { LockedPolygonType } from "../../../perseus-types";
|
|
3
|
-
|
|
3
|
+
import type { APIOptions } from "../../../types";
|
|
4
|
+
type Props = LockedPolygonType & {
|
|
5
|
+
flags?: APIOptions["flags"];
|
|
6
|
+
};
|
|
7
|
+
declare const LockedPolygon: (props: Props) => React.JSX.Element;
|
|
4
8
|
export default LockedPolygon;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { LockedVectorType } from "../../../perseus-types";
|
|
3
|
-
|
|
3
|
+
import type { APIOptions } from "../../../types";
|
|
4
|
+
type Props = LockedVectorType & {
|
|
5
|
+
flags?: APIOptions["flags"];
|
|
6
|
+
};
|
|
7
|
+
declare const LockedVector: (props: Props) => React.JSX.Element;
|
|
4
8
|
export default LockedVector;
|
|
@@ -11,7 +11,7 @@ import Marker from "./marker";
|
|
|
11
11
|
import type { InteractiveMarkerType } from "./types";
|
|
12
12
|
import type { DependencyProps } from "../../dependencies";
|
|
13
13
|
import type { ChangeableProps } from "../../mixins/changeable";
|
|
14
|
-
import type { APIOptions, PerseusScore } from "../../types";
|
|
14
|
+
import type { APIOptions, PerseusScore, Widget } from "../../types";
|
|
15
15
|
import type { PerseusLabelImageRubric, PerseusLabelImageUserInput } from "../../validation.types";
|
|
16
16
|
export type PreferredPopoverDirection = "NONE" | "UP" | "DOWN" | "LEFT" | "RIGHT";
|
|
17
17
|
/**
|
|
@@ -50,7 +50,7 @@ type LabelImageState = {
|
|
|
50
50
|
markersInteracted: boolean;
|
|
51
51
|
hideAnswers: boolean;
|
|
52
52
|
};
|
|
53
|
-
export declare class LabelImage extends React.Component<LabelImageProps, LabelImageState> {
|
|
53
|
+
export declare class LabelImage extends React.Component<LabelImageProps, LabelImageState> implements Widget {
|
|
54
54
|
static contextType: React.Context<{
|
|
55
55
|
strings: import("../../strings").PerseusStrings;
|
|
56
56
|
locale: string;
|
|
@@ -141,10 +141,12 @@ declare const _default: Readonly<{
|
|
|
141
141
|
"unlimited-point"?: boolean | undefined;
|
|
142
142
|
} & {
|
|
143
143
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
|
144
|
+
"locked-figures-aria"?: boolean | undefined;
|
|
144
145
|
"locked-point-labels"?: boolean | undefined;
|
|
145
146
|
"locked-line-labels"?: boolean | undefined;
|
|
146
147
|
"locked-vector-labels"?: boolean | undefined;
|
|
147
148
|
"locked-ellipse-labels"?: boolean | undefined;
|
|
149
|
+
"locked-polygon-labels"?: boolean | undefined;
|
|
148
150
|
"locked-function-labels"?: boolean | undefined;
|
|
149
151
|
}) | undefined;
|
|
150
152
|
} | undefined;
|
|
@@ -209,10 +211,12 @@ declare const _default: Readonly<{
|
|
|
209
211
|
"unlimited-point"?: boolean | undefined;
|
|
210
212
|
} & {
|
|
211
213
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
|
214
|
+
"locked-figures-aria"?: boolean | undefined;
|
|
212
215
|
"locked-point-labels"?: boolean | undefined;
|
|
213
216
|
"locked-line-labels"?: boolean | undefined;
|
|
214
217
|
"locked-vector-labels"?: boolean | undefined;
|
|
215
218
|
"locked-ellipse-labels"?: boolean | undefined;
|
|
219
|
+
"locked-polygon-labels"?: boolean | undefined;
|
|
216
220
|
"locked-function-labels"?: boolean | undefined;
|
|
217
221
|
}) | undefined;
|
|
218
222
|
} | undefined;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PerseusScore } from "../../types";
|
|
2
|
+
import type { PerseusMatcherRubric, PerseusMatcherUserInput } from "../../validation.types";
|
|
3
|
+
declare function matcherValidator(state: PerseusMatcherUserInput, rubric: PerseusMatcherRubric): PerseusScore;
|
|
4
|
+
export default matcherValidator;
|
|
@@ -2,7 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
3
|
import type { SortableOption } from "../../components/sortable";
|
|
4
4
|
import type { PerseusMatcherWidgetOptions } from "../../perseus-types";
|
|
5
|
-
import type { WidgetProps } from "../../types";
|
|
5
|
+
import type { PerseusScore, WidgetProps, Widget } from "../../types";
|
|
6
6
|
import type { PerseusMatcherRubric, PerseusMatcherUserInput } from "../../validation.types";
|
|
7
7
|
type RenderProps = PerseusMatcherWidgetOptions;
|
|
8
8
|
type Props = WidgetProps<RenderProps, PerseusMatcherRubric>;
|
|
@@ -21,7 +21,7 @@ type State = {
|
|
|
21
21
|
rightHeight: number;
|
|
22
22
|
texRendererLoaded: boolean;
|
|
23
23
|
};
|
|
24
|
-
export declare class Matcher extends React.Component<Props, State> {
|
|
24
|
+
export declare class Matcher extends React.Component<Props, State> implements Widget {
|
|
25
25
|
static contextType: React.Context<{
|
|
26
26
|
strings: import("../../strings").PerseusStrings;
|
|
27
27
|
locale: string;
|
|
@@ -29,13 +29,14 @@ export declare class Matcher extends React.Component<Props, State> {
|
|
|
29
29
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
30
30
|
static defaultProps: DefaultProps;
|
|
31
31
|
state: State;
|
|
32
|
+
static validate(state: PerseusMatcherUserInput, rubric: PerseusMatcherRubric): PerseusScore;
|
|
32
33
|
changeAndTrack: (arg1: any) => void;
|
|
33
34
|
onMeasureLeft: (arg1: any) => void;
|
|
34
35
|
onMeasureRight: (arg1: any) => void;
|
|
35
36
|
getUserInput: () => PerseusMatcherUserInput;
|
|
36
37
|
moveLeftOptionToIndex: (option: SortableOption, index: number) => void;
|
|
37
38
|
moveRightOptionToIndex: (option: SortableOption, index: number) => void;
|
|
38
|
-
simpleValidate(rubric: PerseusMatcherRubric):
|
|
39
|
+
simpleValidate(rubric: PerseusMatcherRubric): PerseusScore;
|
|
39
40
|
render(): React.ReactElement;
|
|
40
41
|
}
|
|
41
42
|
declare const _default: Readonly<{
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusStrings } from "../../strings";
|
|
2
|
+
import type { PerseusScore } from "../../types";
|
|
3
|
+
import type { PerseusMatrixRubric, PerseusMatrixUserInput } from "../../validation.types";
|
|
4
|
+
declare function matrixValidator(state: PerseusMatrixUserInput, rubric: PerseusMatrixRubric, strings: PerseusStrings): PerseusScore;
|
|
5
|
+
export default matrixValidator;
|
|
@@ -2,8 +2,9 @@ import * as React from "react";
|
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
3
|
import type { PerseusMatrixWidgetOptions } from "../../perseus-types";
|
|
4
4
|
import type { PerseusStrings } from "../../strings";
|
|
5
|
-
import type { WidgetProps, PerseusScore } from "../../types";
|
|
5
|
+
import type { WidgetProps, PerseusScore, Widget, FocusPath } from "../../types";
|
|
6
6
|
import type { PerseusMatrixRubric, PerseusMatrixUserInput } from "../../validation.types";
|
|
7
|
+
export declare function getMatrixSize(matrix: ReadonlyArray<ReadonlyArray<number>>): number[];
|
|
7
8
|
type ExternalProps = WidgetProps<PerseusMatrixWidgetOptions, PerseusMatrixRubric>;
|
|
8
9
|
type Props = ExternalProps & {
|
|
9
10
|
onChange: (arg1: {
|
|
@@ -24,7 +25,7 @@ type DefaultProps = {
|
|
|
24
25
|
type State = {
|
|
25
26
|
enterTheMatrix: number;
|
|
26
27
|
};
|
|
27
|
-
declare class Matrix extends React.Component<Props, State> {
|
|
28
|
+
declare class Matrix extends React.Component<Props, State> implements Widget {
|
|
28
29
|
static contextType: React.Context<{
|
|
29
30
|
strings: PerseusStrings;
|
|
30
31
|
locale: string;
|
|
@@ -42,7 +43,7 @@ declare class Matrix extends React.Component<Props, State> {
|
|
|
42
43
|
focus: () => boolean;
|
|
43
44
|
focusInputPath: (arg1: any) => void;
|
|
44
45
|
blurInputPath: (arg1: any) => void;
|
|
45
|
-
getDOMNodeForPath
|
|
46
|
+
getDOMNodeForPath(path: FocusPath): Element | Text | null;
|
|
46
47
|
setInputValue: (arg1: any, arg2: any, arg3: any) => void;
|
|
47
48
|
handleKeyDown: (arg1: any, arg2: any, arg3: any) => void;
|
|
48
49
|
onValueChange: (arg1: any, arg2: any, arg3: any, arg4: any) => void;
|
|
@@ -1,8 +1,53 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import noopValidator from "../__shared__/noop-validator";
|
|
3
|
+
import type { APIOptions, Widget } from "../../types";
|
|
4
|
+
type Props = {
|
|
5
|
+
apiOptions: APIOptions;
|
|
6
|
+
box: [number, number];
|
|
7
|
+
image: {
|
|
8
|
+
url?: string;
|
|
9
|
+
top?: number;
|
|
10
|
+
left?: number;
|
|
11
|
+
};
|
|
12
|
+
showProtractor: boolean;
|
|
13
|
+
protractorX: number;
|
|
14
|
+
protractorY: number;
|
|
15
|
+
showRuler: boolean;
|
|
16
|
+
rulerLabel: string;
|
|
17
|
+
rulerTicks: number;
|
|
18
|
+
rulerPixels: number;
|
|
19
|
+
rulerLength: number;
|
|
20
|
+
};
|
|
21
|
+
type DefaultProps = {
|
|
22
|
+
box: Props["box"];
|
|
23
|
+
image: Props["image"];
|
|
24
|
+
showProtractor: Props["showProtractor"];
|
|
25
|
+
protractorX: Props["protractorX"];
|
|
26
|
+
protractorY: Props["protractorY"];
|
|
27
|
+
showRuler: Props["showRuler"];
|
|
28
|
+
rulerLabel: Props["rulerLabel"];
|
|
29
|
+
rulerTicks: Props["rulerTicks"];
|
|
30
|
+
rulerPixels: Props["rulerPixels"];
|
|
31
|
+
rulerLength: Props["rulerLength"];
|
|
32
|
+
};
|
|
33
|
+
declare class Measurer extends React.Component<Props> implements Widget {
|
|
34
|
+
static validate: typeof noopValidator;
|
|
35
|
+
static defaultProps: DefaultProps;
|
|
36
|
+
state: {};
|
|
37
|
+
ruler: any;
|
|
38
|
+
protractor: any;
|
|
39
|
+
componentDidMount(): void;
|
|
40
|
+
componentDidUpdate(prevProps: any): void;
|
|
41
|
+
setupGraphie(): void;
|
|
42
|
+
getUserInput(): {};
|
|
43
|
+
simpleValidate(): import("../../types").PerseusScore;
|
|
44
|
+
render(): React.JSX.Element;
|
|
45
|
+
}
|
|
1
46
|
declare const _default: Readonly<{
|
|
2
47
|
name: string;
|
|
3
48
|
displayName: string;
|
|
4
|
-
getWidget?: (() =>
|
|
5
|
-
widget:
|
|
49
|
+
getWidget?: (() => typeof Measurer) | undefined;
|
|
50
|
+
widget: typeof Measurer;
|
|
6
51
|
accessible?: boolean | ((props: any) => boolean) | undefined;
|
|
7
52
|
hidden?: boolean | undefined;
|
|
8
53
|
version?: import("../../types").Version | undefined;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
3
|
import type { PerseusMoleculeRendererWidgetOptions } from "../../perseus-types";
|
|
4
|
+
import type { Widget } from "../../types";
|
|
4
5
|
import type { PerseusMoleculeUserInput } from "../../validation.types";
|
|
5
6
|
type MoleculeState = {
|
|
6
7
|
parsedSmiles: any;
|
|
@@ -30,7 +31,7 @@ export declare class Molecule extends React.Component<Props, MoleculeState> {
|
|
|
30
31
|
type DefaultProps = {
|
|
31
32
|
rotationAngle: Props["rotationAngle"];
|
|
32
33
|
};
|
|
33
|
-
declare class MoleculeWidget extends React.Component<Props> {
|
|
34
|
+
declare class MoleculeWidget extends React.Component<Props> implements Widget {
|
|
34
35
|
static defaultProps: DefaultProps;
|
|
35
36
|
simpleValidate(): import("../../types").PerseusScore;
|
|
36
37
|
getUserInput(): PerseusMoleculeUserInput;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PerseusScore } from "../../types";
|
|
2
|
+
import type { PerseusNumberLineRubric, PerseusNumberLineUserInput } from "../../validation.types";
|
|
3
|
+
declare function numberLineValidator(state: PerseusNumberLineUserInput, rubric: PerseusNumberLineRubric): PerseusScore;
|
|
4
|
+
export default numberLineValidator;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
3
|
import type { ChangeableProps } from "../../mixins/changeable";
|
|
4
|
-
import type { APIOptions } from "../../types";
|
|
4
|
+
import type { APIOptions, PerseusScore, FocusPath, Widget } from "../../types";
|
|
5
5
|
import type { PerseusNumberLineRubric, PerseusNumberLineUserInput } from "../../validation.types";
|
|
6
6
|
export type Relationship = "lt" | "gt" | "le" | "ge";
|
|
7
7
|
type Props = ChangeableProps & {
|
|
@@ -42,7 +42,7 @@ type DefaultProps = {
|
|
|
42
42
|
type State = {
|
|
43
43
|
numDivisionsEmpty: boolean;
|
|
44
44
|
};
|
|
45
|
-
declare class NumberLine extends React.Component<Props, State> {
|
|
45
|
+
declare class NumberLine extends React.Component<Props, State> implements Widget {
|
|
46
46
|
static contextType: React.Context<{
|
|
47
47
|
strings: import("../../strings").PerseusStrings;
|
|
48
48
|
locale: string;
|
|
@@ -50,17 +50,18 @@ declare class NumberLine extends React.Component<Props, State> {
|
|
|
50
50
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
51
51
|
static defaultProps: DefaultProps;
|
|
52
52
|
state: any;
|
|
53
|
+
static validate(state: PerseusNumberLineUserInput, rubric: PerseusNumberLineRubric): PerseusScore;
|
|
53
54
|
change: (...args: ReadonlyArray<unknown>) => any;
|
|
54
55
|
isValid: () => boolean;
|
|
55
56
|
onNumDivisionsChange: (arg1: number, arg2: any) => void;
|
|
56
57
|
_handleTickCtrlFocus: () => void;
|
|
57
58
|
_handleTickCtrlBlur: () => void;
|
|
58
|
-
focus
|
|
59
|
+
focus(): boolean;
|
|
59
60
|
focusInputPath: (arg1: any) => void;
|
|
60
61
|
blurInputPath: (arg1: any) => void;
|
|
61
62
|
getInputPaths: () => ReadonlyArray<ReadonlyArray<string>>;
|
|
62
|
-
getDOMNodeForPath
|
|
63
|
-
getGrammarTypeForPath
|
|
63
|
+
getDOMNodeForPath(inputPath: FocusPath): Element | Text | null;
|
|
64
|
+
getGrammarTypeForPath(inputPath: FocusPath): "number" | undefined;
|
|
64
65
|
setInputValue: (arg1: any, arg2: any, arg3: any) => void;
|
|
65
66
|
_renderGraphie: () => React.ReactElement;
|
|
66
67
|
snapNumLinePosition: (arg1: any, arg2: number) => number;
|
|
@@ -72,7 +73,7 @@ declare class NumberLine extends React.Component<Props, State> {
|
|
|
72
73
|
_renderInequality: (arg1: any) => React.ReactElement;
|
|
73
74
|
_setupGraphie: (arg1: any, arg2: any) => void;
|
|
74
75
|
getUserInput(): PerseusNumberLineUserInput;
|
|
75
|
-
simpleValidate(rubric: PerseusNumberLineRubric):
|
|
76
|
+
simpleValidate(rubric: PerseusNumberLineRubric): PerseusScore;
|
|
76
77
|
render(): React.ReactNode;
|
|
77
78
|
}
|
|
78
79
|
declare const _default: Readonly<{
|
|
@@ -4,7 +4,7 @@ import InputWithExamples from "../../components/input-with-examples";
|
|
|
4
4
|
import SimpleKeypadInput from "../../components/simple-keypad-input";
|
|
5
5
|
import type { PerseusNumericInputWidgetOptions, PerseusNumericInputAnswerForm } from "../../perseus-types";
|
|
6
6
|
import type { PerseusStrings } from "../../strings";
|
|
7
|
-
import type { FocusPath, PerseusScore, WidgetProps } from "../../types";
|
|
7
|
+
import type { FocusPath, PerseusScore, Widget, WidgetProps } from "../../types";
|
|
8
8
|
import type { PerseusNumericInputRubric, PerseusNumericInputUserInput } from "../../validation.types";
|
|
9
9
|
type ExternalProps = WidgetProps<PerseusNumericInputWidgetOptions, PerseusNumericInputRubric>;
|
|
10
10
|
type Props = ExternalProps & {
|
|
@@ -30,7 +30,7 @@ type DefaultProps = {
|
|
|
30
30
|
type State = {
|
|
31
31
|
previousValues: ReadonlyArray<string>;
|
|
32
32
|
};
|
|
33
|
-
export declare class NumericInput extends React.Component<Props, State> {
|
|
33
|
+
export declare class NumericInput extends React.Component<Props, State> implements Widget {
|
|
34
34
|
static contextType: React.Context<{
|
|
35
35
|
strings: PerseusStrings;
|
|
36
36
|
locale: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { PerseusOrdererWidgetOptions } from "../../perseus-types";
|
|
3
|
-
import type { WidgetProps } from "../../types";
|
|
3
|
+
import type { PerseusScore, WidgetProps, Widget } from "../../types";
|
|
4
4
|
import type { PerseusOrdererRubric, PerseusOrdererUserInput } from "../../validation.types";
|
|
5
5
|
type Position = {
|
|
6
6
|
left: number;
|
|
@@ -33,9 +33,10 @@ type OrdererState = {
|
|
|
33
33
|
animateTo: Position | null | undefined;
|
|
34
34
|
onAnimationEnd?: (arg1: any) => void;
|
|
35
35
|
};
|
|
36
|
-
declare class Orderer extends React.Component<OrdererProps, OrdererState> {
|
|
36
|
+
declare class Orderer extends React.Component<OrdererProps, OrdererState> implements Widget {
|
|
37
37
|
static defaultProps: OrdererDefaultProps;
|
|
38
38
|
state: OrdererState;
|
|
39
|
+
static validate(userInput: PerseusOrdererUserInput, rubric: PerseusOrdererRubric): PerseusScore;
|
|
39
40
|
UNSAFE_componentWillReceiveProps(nextProps: OrdererProps): void;
|
|
40
41
|
onClick: (arg1: string, arg2: number, arg3: any, arg4: Element) => void;
|
|
41
42
|
onRelease: (arg1: any) => void;
|
|
@@ -44,7 +45,7 @@ declare class Orderer extends React.Component<OrdererProps, OrdererState> {
|
|
|
44
45
|
isCardInBank: (arg1: any) => boolean;
|
|
45
46
|
setListValues: (arg1: ReadonlyArray<string>) => void;
|
|
46
47
|
getUserInput(): PerseusOrdererUserInput;
|
|
47
|
-
simpleValidate(rubric: PerseusOrdererRubric):
|
|
48
|
+
simpleValidate(rubric: PerseusOrdererRubric): PerseusScore;
|
|
48
49
|
render(): React.ReactNode;
|
|
49
50
|
}
|
|
50
51
|
declare const _default: Readonly<{
|
|
@@ -4,8 +4,8 @@ import type { ParseState } from "./passage-markdown";
|
|
|
4
4
|
import type { SerializedHighlightSet } from "../../components/highlighting/types";
|
|
5
5
|
import type { ChangeableProps } from "../../mixins/changeable";
|
|
6
6
|
import type { PerseusPassageWidgetOptions, PerseusWidget } from "../../perseus-types";
|
|
7
|
-
import type { WidgetProps } from "../../types";
|
|
8
|
-
import type {
|
|
7
|
+
import type { WidgetProps, Widget } from "../../types";
|
|
8
|
+
import type { NullUserInput, PerseusPassageRubric } from "../../validation.types";
|
|
9
9
|
import type { SingleASTNode } from "@khanacademy/simple-markdown";
|
|
10
10
|
export declare class LineHeightMeasurer extends React.Component<Record<any, any>> {
|
|
11
11
|
_line: HTMLDivElement | null | undefined;
|
|
@@ -41,7 +41,7 @@ export type Reference = {
|
|
|
41
41
|
endLine: number;
|
|
42
42
|
content: string | null | undefined;
|
|
43
43
|
};
|
|
44
|
-
export declare class Passage extends React.Component<PassageProps, PassageState> {
|
|
44
|
+
export declare class Passage extends React.Component<PassageProps, PassageState> implements Widget {
|
|
45
45
|
static contextType: React.Context<{
|
|
46
46
|
strings: import("../../strings").PerseusStrings;
|
|
47
47
|
locale: string;
|
|
@@ -93,7 +93,7 @@ export declare class Passage extends React.Component<PassageProps, PassageState>
|
|
|
93
93
|
*
|
|
94
94
|
* These are misc widget functions used for the widget API
|
|
95
95
|
*/
|
|
96
|
-
getUserInput():
|
|
96
|
+
getUserInput(): NullUserInput;
|
|
97
97
|
simpleValidate(): import("../../types").PerseusScore;
|
|
98
98
|
/**
|
|
99
99
|
* Rendering
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Passage } from "./passage";
|
|
2
|
+
/**
|
|
3
|
+
* A function that detects if the given widget is a `Passage` widget. This is
|
|
4
|
+
* also a type guard so that after this function is called, the widget that was
|
|
5
|
+
* passed in is refined to be a `Passage` widget on success.
|
|
6
|
+
*
|
|
7
|
+
* This makes it a handy function to use with `.filter()` calls on arrays of
|
|
8
|
+
* widgets.
|
|
9
|
+
*
|
|
10
|
+
* Type guards: https://www.typescriptlang.org/docs/handbook/advanced-types.html#type-guards-and-differentiating-types
|
|
11
|
+
*/
|
|
12
|
+
export declare function isPassageWidget(widget: any): widget is Passage;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
3
|
import type { PerseusPassageRefWidgetOptions } from "../../perseus-types";
|
|
4
|
-
import type { ChangeFn, WidgetProps } from "../../types";
|
|
5
|
-
import type {
|
|
4
|
+
import type { ChangeFn, Widget, WidgetProps } from "../../types";
|
|
5
|
+
import type { NullUserInput, PerseusPassageRefRubric } from "../../validation.types";
|
|
6
6
|
type RenderProps = {
|
|
7
7
|
passageNumber: PerseusPassageRefWidgetOptions["passageNumber"];
|
|
8
8
|
referenceNumber: PerseusPassageRefWidgetOptions["referenceNumber"];
|
|
@@ -18,7 +18,7 @@ type State = {
|
|
|
18
18
|
lineRange: [number, number] | null | undefined;
|
|
19
19
|
content: string | null | undefined;
|
|
20
20
|
};
|
|
21
|
-
declare class PassageRef extends React.Component<Props, State> {
|
|
21
|
+
declare class PassageRef extends React.Component<Props, State> implements Widget {
|
|
22
22
|
static contextType: React.Context<{
|
|
23
23
|
strings: import("../../strings").PerseusStrings;
|
|
24
24
|
locale: string;
|
|
@@ -34,7 +34,7 @@ declare class PassageRef extends React.Component<Props, State> {
|
|
|
34
34
|
shouldComponentUpdate(nextProps: Props, nextState: State): boolean;
|
|
35
35
|
componentDidUpdate(): void;
|
|
36
36
|
componentWillUnmount(): void;
|
|
37
|
-
getUserInput():
|
|
37
|
+
getUserInput(): NullUserInput;
|
|
38
38
|
change: ChangeFn;
|
|
39
39
|
_deferredUpdateRange: () => void;
|
|
40
40
|
_updateRange: () => void;
|
|
@@ -2,8 +2,8 @@ import * as React from "react";
|
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
3
|
import * as Changeable from "../../mixins/changeable";
|
|
4
4
|
import type { PerseusPassageRefTargetWidgetOptions } from "../../perseus-types";
|
|
5
|
-
import type { APIOptions } from "../../types";
|
|
6
|
-
import type {
|
|
5
|
+
import type { APIOptions, Widget } from "../../types";
|
|
6
|
+
import type { NullUserInput } from "../../validation.types";
|
|
7
7
|
import type { LinterContextProps } from "@khanacademy/perseus-linter";
|
|
8
8
|
type Props = Changeable.ChangeableProps & {
|
|
9
9
|
apiOptions: APIOptions;
|
|
@@ -14,7 +14,7 @@ type DefaultProps = {
|
|
|
14
14
|
content: Props["content"];
|
|
15
15
|
linterContext: Props["linterContext"];
|
|
16
16
|
};
|
|
17
|
-
declare class PassageRefTarget extends React.Component<Props> {
|
|
17
|
+
declare class PassageRefTarget extends React.Component<Props> implements Widget {
|
|
18
18
|
static contextType: React.Context<{
|
|
19
19
|
strings: import("../../strings").PerseusStrings;
|
|
20
20
|
locale: string;
|
|
@@ -22,7 +22,7 @@ declare class PassageRefTarget extends React.Component<Props> {
|
|
|
22
22
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
23
23
|
static defaultProps: DefaultProps;
|
|
24
24
|
static validate(): import("../../types").PerseusScore;
|
|
25
|
-
getUserInput():
|
|
25
|
+
getUserInput(): NullUserInput;
|
|
26
26
|
change: (arg1: any, arg2: any, arg3: any) => any;
|
|
27
27
|
simpleValidate(): import("../../types").PerseusScore;
|
|
28
28
|
render(): React.ReactNode;
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
7
7
|
import type { PerseusPhetSimulationWidgetOptions } from "../../perseus-types";
|
|
8
|
-
import type { WidgetProps } from "../../types";
|
|
9
|
-
import type {
|
|
8
|
+
import type { WidgetProps, Widget } from "../../types";
|
|
9
|
+
import type { NullUserInput } from "../../validation.types";
|
|
10
10
|
type RenderProps = PerseusPhetSimulationWidgetOptions;
|
|
11
11
|
type Props = WidgetProps<RenderProps, PerseusPhetSimulationWidgetOptions>;
|
|
12
12
|
type State = {
|
|
@@ -16,7 +16,7 @@ type State = {
|
|
|
16
16
|
} | null;
|
|
17
17
|
url: URL | null;
|
|
18
18
|
};
|
|
19
|
-
export declare class PhetSimulation extends React.Component<Props, State> {
|
|
19
|
+
export declare class PhetSimulation extends React.Component<Props, State> implements Widget {
|
|
20
20
|
static contextType: React.Context<{
|
|
21
21
|
strings: import("../../strings").PerseusStrings;
|
|
22
22
|
locale: string;
|
|
@@ -28,7 +28,7 @@ export declare class PhetSimulation extends React.Component<Props, State> {
|
|
|
28
28
|
constructor(props: any);
|
|
29
29
|
componentDidMount(): Promise<void>;
|
|
30
30
|
componentDidUpdate(prevProps: any): Promise<void>;
|
|
31
|
-
getUserInput():
|
|
31
|
+
getUserInput(): NullUserInput;
|
|
32
32
|
getPhetCompatibleLocale: (arg1: string) => string;
|
|
33
33
|
displayLoadFailure: () => void;
|
|
34
34
|
updateSimState(urlString: string): Promise<void>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PerseusScore } from "../../types";
|
|
2
|
+
import type { PerseusPlotterRubric, PerseusPlotterUserInput } from "../../validation.types";
|
|
3
|
+
declare function plotterValidator(userInput: PerseusPlotterUserInput, rubric: PerseusPlotterRubric): PerseusScore;
|
|
4
|
+
export default plotterValidator;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
3
|
import type { PerseusPlotterWidgetOptions } from "../../perseus-types";
|
|
4
|
-
import type { PerseusScore, WidgetProps } from "../../types";
|
|
4
|
+
import type { PerseusScore, Widget, WidgetProps } from "../../types";
|
|
5
5
|
import type { PerseusPlotterRubric, PerseusPlotterUserInput } from "../../validation.types";
|
|
6
6
|
type RenderProps = PerseusPlotterWidgetOptions;
|
|
7
7
|
type Props = WidgetProps<RenderProps, PerseusPlotterRubric> & {
|
|
@@ -25,7 +25,7 @@ type State = {
|
|
|
25
25
|
values: ReadonlyArray<number>;
|
|
26
26
|
categoryHeights: Record<string, number>;
|
|
27
27
|
};
|
|
28
|
-
export declare class Plotter extends React.Component<Props, State> {
|
|
28
|
+
export declare class Plotter extends React.Component<Props, State> implements Widget {
|
|
29
29
|
static contextType: React.Context<{
|
|
30
30
|
strings: import("../../strings").PerseusStrings;
|
|
31
31
|
locale: string;
|
|
@@ -38,6 +38,7 @@ export declare class Plotter extends React.Component<Props, State> {
|
|
|
38
38
|
graphie: any;
|
|
39
39
|
static defaultProps: DefaultProps;
|
|
40
40
|
state: State;
|
|
41
|
+
static validate(userInput: PerseusPlotterUserInput, rubric: PerseusPlotterRubric): PerseusScore;
|
|
41
42
|
componentDidMount(): void;
|
|
42
43
|
UNSAFE_componentWillReceiveProps(nextProps: Props): void;
|
|
43
44
|
componentDidUpdate(prevProps: Props, prevState: State): void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import type { FocusPath, Widget } from "../../types";
|
|
2
3
|
type Props = {
|
|
3
4
|
programID: string;
|
|
4
5
|
height: number;
|
|
@@ -6,8 +7,12 @@ type Props = {
|
|
|
6
7
|
type DefaultProps = {
|
|
7
8
|
height: Props["height"];
|
|
8
9
|
};
|
|
9
|
-
|
|
10
|
+
/**
|
|
11
|
+
* This renders the program in an iframe.
|
|
12
|
+
*/
|
|
13
|
+
declare class PythonProgram extends React.Component<Props> implements Widget {
|
|
10
14
|
static defaultProps: DefaultProps;
|
|
15
|
+
getDOMNodeForPath(path: FocusPath): null;
|
|
11
16
|
render(): React.ReactNode;
|
|
12
17
|
}
|
|
13
18
|
declare const _default: Readonly<{
|
|
@@ -3,7 +3,7 @@ import { PerseusI18nContext } from "../../components/i18n-context";
|
|
|
3
3
|
import type { FocusFunction } from "./base-radio";
|
|
4
4
|
import type { PerseusRadioChoice, PerseusRadioWidgetOptions, ShowSolutions } from "../../perseus-types";
|
|
5
5
|
import type { PerseusStrings } from "../../strings";
|
|
6
|
-
import type { PerseusScore, WidgetProps, ChoiceState } from "../../types";
|
|
6
|
+
import type { PerseusScore, WidgetProps, ChoiceState, Widget } from "../../types";
|
|
7
7
|
import type { PerseusRadioRubric, PerseusRadioUserInput } from "../../validation.types";
|
|
8
8
|
export type RenderProps = {
|
|
9
9
|
numCorrect: number;
|
|
@@ -23,7 +23,7 @@ export type RadioChoiceWithMetadata = PerseusRadioChoice & {
|
|
|
23
23
|
originalIndex: number;
|
|
24
24
|
correct: boolean;
|
|
25
25
|
};
|
|
26
|
-
declare class Radio extends React.Component<Props> {
|
|
26
|
+
declare class Radio extends React.Component<Props> implements Widget {
|
|
27
27
|
static contextType: React.Context<{
|
|
28
28
|
strings: PerseusStrings;
|
|
29
29
|
locale: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { SortableOption } from "../../components/sortable";
|
|
3
3
|
import type { PerseusSorterWidgetOptions } from "../../perseus-types";
|
|
4
|
-
import type { PerseusScore, WidgetProps } from "../../types";
|
|
4
|
+
import type { PerseusScore, Widget, WidgetProps } from "../../types";
|
|
5
5
|
import type { PerseusSorterRubric, PerseusSorterUserInput } from "../../validation.types";
|
|
6
6
|
type RenderProps = PerseusSorterWidgetOptions;
|
|
7
7
|
type Props = WidgetProps<RenderProps, PerseusSorterRubric>;
|
|
@@ -16,7 +16,7 @@ type DefaultProps = {
|
|
|
16
16
|
type State = {
|
|
17
17
|
changed: boolean;
|
|
18
18
|
};
|
|
19
|
-
declare class Sorter extends React.Component<Props, State> {
|
|
19
|
+
declare class Sorter extends React.Component<Props, State> implements Widget {
|
|
20
20
|
_isMounted: boolean;
|
|
21
21
|
static defaultProps: DefaultProps;
|
|
22
22
|
static validate(userInput: PerseusSorterUserInput, rubric: PerseusSorterRubric): PerseusScore;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusStrings } from "../../strings";
|
|
2
|
+
import type { PerseusScore } from "../../types";
|
|
3
|
+
import type { PerseusTableRubric, PerseusTableUserInput } from "../../validation.types";
|
|
4
|
+
declare function tableValidator(state: PerseusTableUserInput, rubric: PerseusTableRubric, strings: PerseusStrings): PerseusScore;
|
|
5
|
+
export default tableValidator;
|