@khanacademy/perseus 34.1.0 → 35.1.1
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 +1109 -974
- package/dist/es/index.js.map +1 -1
- package/dist/es/strings.js +8 -2
- package/dist/es/strings.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1032 -905
- package/dist/index.js.map +1 -1
- package/dist/mixins/widget-prop-denylist.d.ts +0 -1
- package/dist/perseus-api.d.ts +5 -5
- package/dist/perseus-types.d.ts +13 -19
- package/dist/renderer.d.ts +4 -4
- package/dist/server-item-renderer.d.ts +5 -9
- package/dist/strings.d.ts +3 -0
- package/dist/strings.js +8 -2
- package/dist/strings.js.map +1 -1
- package/dist/types.d.ts +3 -6
- package/dist/validation.types.d.ts +114 -0
- package/dist/widgets/categorizer/categorizer-validator.d.ts +2 -2
- package/dist/widgets/categorizer/categorizer.d.ts +6 -6
- package/dist/widgets/cs-program/cs-program-validator.d.ts +3 -0
- package/dist/widgets/cs-program/cs-program.d.ts +5 -10
- package/dist/widgets/definition/definition.d.ts +3 -4
- package/dist/widgets/dropdown/dropdown-validator.d.ts +2 -2
- package/dist/widgets/dropdown/dropdown.d.ts +5 -5
- package/dist/widgets/explanation/explanation.d.ts +3 -2
- package/dist/widgets/expression/expression-validator.d.ts +2 -2
- package/dist/widgets/expression/expression.d.ts +46 -28
- package/dist/widgets/expression/expression.types.d.ts +0 -1
- 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 +6 -7
- package/dist/widgets/grapher/util.d.ts +0 -2
- package/dist/widgets/group/group.d.ts +3 -2
- package/dist/widgets/iframe/iframe-validator.d.ts +3 -0
- package/dist/widgets/iframe/iframe.d.ts +7 -11
- package/dist/widgets/image/image.d.ts +3 -4
- package/dist/widgets/input-number/input-number-validator.d.ts +3 -3
- package/dist/widgets/input-number/input-number.d.ts +7 -10
- package/dist/widgets/interaction/interaction.d.ts +3 -3
- package/dist/widgets/interactive-graph.d.ts +11 -14
- 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 +15 -2
- 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/interactive-graphs/stateful-mafs-graph.d.ts +5 -2
- package/dist/widgets/label-image/label-image-validator.d.ts +10 -0
- package/dist/widgets/label-image/label-image.d.ts +15 -10
- package/dist/widgets/label-image/types.d.ts +0 -4
- package/dist/widgets/matcher/matcher-validator.d.ts +4 -0
- package/dist/widgets/matcher/matcher.d.ts +6 -5
- package/dist/widgets/matrix/matrix-validator.d.ts +5 -0
- package/dist/widgets/matrix/matrix.d.ts +6 -5
- 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 -4
- package/dist/widgets/numeric-input/numeric-input-validator.d.ts +2 -2
- package/dist/widgets/numeric-input/numeric-input.d.ts +7 -7
- package/dist/widgets/orderer/orderer.d.ts +4 -4
- package/dist/widgets/passage/passage.d.ts +3 -4
- package/dist/widgets/passage-ref/passage-ref.d.ts +3 -11
- package/dist/widgets/passage-ref-target/passage-ref-target.d.ts +2 -1
- package/dist/widgets/phet-simulation/phet-simulation.d.ts +2 -2
- package/dist/widgets/plotter/plotter-validator.d.ts +4 -0
- package/dist/widgets/plotter/plotter.d.ts +6 -5
- package/dist/widgets/radio/radio-component.d.ts +6 -13
- package/dist/widgets/radio/radio-validator.d.ts +5 -0
- package/dist/widgets/sorter/sorter-validator.d.ts +4 -0
- package/dist/widgets/sorter/sorter.d.ts +7 -9
- package/dist/widgets/table/table-validator.d.ts +5 -0
- package/dist/widgets/table/table.d.ts +6 -5
- package/dist/widgets/video/video.d.ts +2 -2
- package/package.json +1 -1
- package/dist/widgets/categorizer/categorizer.types.d.ts +0 -5
- package/dist/widgets/dropdown/dropdown.types.d.ts +0 -5
- package/dist/widgets/input-number/input-number.types.d.ts +0 -2
- package/dist/widgets/numeric-input/numeric-input.types.d.ts +0 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Rubric } from "./input-number.types";
|
|
2
1
|
import type { PerseusStrings } from "../../strings";
|
|
3
|
-
import type {
|
|
2
|
+
import type { PerseusInputNumberRubric } from "../../validation.types";
|
|
3
|
+
import type { PerseusScore } from "@khanacademy/perseus";
|
|
4
4
|
export declare const answerTypes: {
|
|
5
5
|
readonly number: {
|
|
6
6
|
readonly name: "Numbers";
|
|
@@ -37,5 +37,5 @@ export declare const answerTypes: {
|
|
|
37
37
|
};
|
|
38
38
|
declare function inputNumberValidator(state: {
|
|
39
39
|
currentValue: string;
|
|
40
|
-
}, rubric:
|
|
40
|
+
}, rubric: PerseusInputNumberRubric, strings: PerseusStrings): PerseusScore;
|
|
41
41
|
export default inputNumberValidator;
|
|
@@ -1,26 +1,23 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
|
-
import type { Rubric } from "./input-number.types";
|
|
4
3
|
import type { PerseusInputNumberWidgetOptions } from "../../perseus-types";
|
|
5
4
|
import type { PerseusStrings } from "../../strings";
|
|
6
|
-
import type {
|
|
7
|
-
type
|
|
8
|
-
currentValue: string;
|
|
9
|
-
};
|
|
5
|
+
import type { Path, PerseusScore, WidgetProps } from "../../types";
|
|
6
|
+
import type { PerseusInputNumberRubric, PerseusInputNumberUserInput } from "../../validation.types";
|
|
10
7
|
type RenderProps = {
|
|
11
8
|
simplify: PerseusInputNumberWidgetOptions["simplify"];
|
|
12
9
|
size: PerseusInputNumberWidgetOptions["size"];
|
|
13
10
|
answerType: PerseusInputNumberWidgetOptions["answerType"];
|
|
14
11
|
rightAlign: PerseusInputNumberWidgetOptions["rightAlign"];
|
|
15
12
|
};
|
|
16
|
-
type ExternalProps = WidgetProps<RenderProps,
|
|
13
|
+
type ExternalProps = WidgetProps<RenderProps, PerseusInputNumberRubric>;
|
|
17
14
|
type Props = ExternalProps & {
|
|
18
15
|
apiOptions: NonNullable<ExternalProps["apiOptions"]>;
|
|
19
16
|
linterContext: NonNullable<ExternalProps["linterContext"]>;
|
|
20
17
|
rightAlign: NonNullable<ExternalProps["rightAlign"]>;
|
|
21
18
|
size: NonNullable<ExternalProps["size"]>;
|
|
22
19
|
currentValue: string;
|
|
23
|
-
answerType: NonNullable<
|
|
20
|
+
answerType: NonNullable<PerseusInputNumberRubric["answerType"]>;
|
|
24
21
|
};
|
|
25
22
|
type DefaultProps = {
|
|
26
23
|
answerType: Props["answerType"];
|
|
@@ -39,7 +36,7 @@ declare class InputNumber extends React.Component<Props> {
|
|
|
39
36
|
static defaultProps: DefaultProps;
|
|
40
37
|
static validate(state: {
|
|
41
38
|
currentValue: string;
|
|
42
|
-
}, rubric:
|
|
39
|
+
}, rubric: PerseusInputNumberRubric, strings: PerseusStrings): PerseusScore;
|
|
43
40
|
static getUserInputFromProps(props: Props): {
|
|
44
41
|
currentValue: string;
|
|
45
42
|
};
|
|
@@ -54,8 +51,8 @@ declare class InputNumber extends React.Component<Props> {
|
|
|
54
51
|
getInputPaths: () => ReadonlyArray<Path>;
|
|
55
52
|
getGrammarTypeForPath: (arg1: Path) => string;
|
|
56
53
|
setInputValue: (arg1: Path, arg2: string, arg3: () => void) => void;
|
|
57
|
-
getUserInput
|
|
58
|
-
simpleValidate
|
|
54
|
+
getUserInput(): PerseusInputNumberUserInput;
|
|
55
|
+
simpleValidate(rubric: PerseusInputNumberRubric): PerseusScore;
|
|
59
56
|
examples: () => ReadonlyArray<string>;
|
|
60
57
|
render(): React.ReactNode;
|
|
61
58
|
}
|
|
@@ -2,9 +2,9 @@ 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 { WidgetProps } from "../../types";
|
|
5
|
+
import type { PerseusInteractionRubric, PerseusInteractionUserInput } from "../../validation.types";
|
|
5
6
|
type RenderProps = PerseusInteractionWidgetOptions;
|
|
6
|
-
type
|
|
7
|
-
type Props = WidgetProps<RenderProps, Rubric>;
|
|
7
|
+
type Props = WidgetProps<RenderProps, PerseusInteractionRubric>;
|
|
8
8
|
type DefaultProps = {
|
|
9
9
|
graph: Props["graph"];
|
|
10
10
|
elements: Props["elements"];
|
|
@@ -24,7 +24,7 @@ declare class Interaction extends React.Component<Props, State> {
|
|
|
24
24
|
_eval: (arg1: any, arg2: any) => number;
|
|
25
25
|
_extractVars: (arg1: any) => ReadonlyArray<any>;
|
|
26
26
|
change: (arg1: any, arg2: any, arg3: any) => any;
|
|
27
|
-
getUserInput
|
|
27
|
+
getUserInput(): PerseusInteractionUserInput;
|
|
28
28
|
simpleValidate(): import("../../types").PerseusScore;
|
|
29
29
|
render(): React.ReactNode;
|
|
30
30
|
}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { PerseusI18nContext } from "../components/i18n-context";
|
|
3
|
+
import type { StatefulMafsGraphType } from "./interactive-graphs/stateful-mafs-graph";
|
|
3
4
|
import type { QuadraticGraphState } from "./interactive-graphs/types";
|
|
4
5
|
import type { Coord } from "../interactive2/types";
|
|
5
6
|
import type { PerseusGraphType, PerseusGraphTypeAngle, PerseusGraphTypePoint, PerseusGraphTypePolygon, PerseusGraphTypeSegment, PerseusInteractiveGraphWidgetOptions } from "../perseus-types";
|
|
6
|
-
import type { Widget } from "../renderer";
|
|
7
7
|
import type { ChangeHandler, PerseusScore, WidgetProps } from "../types";
|
|
8
8
|
import type { QuadraticCoefficient, Range, SineCoefficient } from "../util/geometry";
|
|
9
|
+
import type { PerseusInteractiveGraphRubric, PerseusInteractiveGraphUserInput } from "../validation.types";
|
|
9
10
|
type RenderProps = PerseusInteractiveGraphWidgetOptions;
|
|
10
|
-
|
|
11
|
-
correct: PerseusGraphType;
|
|
12
|
-
graph: PerseusGraphType;
|
|
13
|
-
};
|
|
14
|
-
type Props = WidgetProps<RenderProps, Rubric>;
|
|
11
|
+
type Props = WidgetProps<RenderProps, PerseusInteractiveGraphRubric>;
|
|
15
12
|
type State = any;
|
|
16
13
|
type DefaultProps = {
|
|
17
14
|
labels: Props["labels"];
|
|
@@ -23,6 +20,8 @@ type DefaultProps = {
|
|
|
23
20
|
showProtractor: Props["showProtractor"];
|
|
24
21
|
graph: Props["graph"];
|
|
25
22
|
};
|
|
23
|
+
export declare function getSinusoidCoefficients(coords: ReadonlyArray<Coord>): SineCoefficient;
|
|
24
|
+
export declare function getQuadraticCoefficients(coords: ReadonlyArray<Coord>): QuadraticCoefficient;
|
|
26
25
|
declare class LegacyInteractiveGraph extends React.Component<Props, State> {
|
|
27
26
|
static contextType: React.Context<{
|
|
28
27
|
strings: import("../strings").PerseusStrings;
|
|
@@ -101,20 +100,18 @@ declare class LegacyInteractiveGraph extends React.Component<Props, State> {
|
|
|
101
100
|
addAngleControls: () => void;
|
|
102
101
|
removeAngleControls: () => void;
|
|
103
102
|
toggleShowSides: () => void;
|
|
104
|
-
getUserInput():
|
|
105
|
-
simpleValidate(rubric:
|
|
103
|
+
getUserInput(): PerseusInteractiveGraphUserInput;
|
|
104
|
+
simpleValidate(rubric: PerseusInteractiveGraphRubric): PerseusScore;
|
|
106
105
|
focus: () => void;
|
|
107
106
|
render(): React.ReactNode;
|
|
108
107
|
}
|
|
109
108
|
declare class InteractiveGraph extends React.Component<Props, State> {
|
|
110
109
|
legacyGraphRef: React.RefObject<LegacyInteractiveGraph>;
|
|
111
|
-
mafsRef: React.RefObject<
|
|
110
|
+
mafsRef: React.RefObject<StatefulMafsGraphType>;
|
|
112
111
|
static defaultProps: DefaultProps;
|
|
113
|
-
getUserInput:
|
|
114
|
-
simpleValidate(rubric:
|
|
112
|
+
getUserInput(): PerseusInteractiveGraphUserInput;
|
|
113
|
+
simpleValidate(rubric: PerseusInteractiveGraphRubric): PerseusScore;
|
|
115
114
|
render(): React.JSX.Element;
|
|
116
|
-
static getQuadraticCoefficients(coords: ReadonlyArray<Coord>): QuadraticCoefficient;
|
|
117
|
-
static getSinusoidCoefficients(coords: ReadonlyArray<Coord>): SineCoefficient;
|
|
118
115
|
/**
|
|
119
116
|
* @param {object} graph Like props.graph or props.correct
|
|
120
117
|
* @param {object} props of an InteractiveGraph instance
|
|
@@ -163,7 +160,7 @@ declare class InteractiveGraph extends React.Component<Props, State> {
|
|
|
163
160
|
static getRayEquationString(props: Props): string;
|
|
164
161
|
static getPolygonEquationString(props: Props): string;
|
|
165
162
|
static getAngleEquationString(props: Props): string;
|
|
166
|
-
static validate(userInput: PerseusGraphType, rubric:
|
|
163
|
+
static validate(userInput: PerseusGraphType, rubric: PerseusInteractiveGraphRubric): PerseusScore;
|
|
167
164
|
static getUserInputFromProps(props: Props): PerseusGraphType;
|
|
168
165
|
}
|
|
169
166
|
export declare function shouldUseMafs(mafsFlags: Record<string, boolean> | undefined | boolean, graph: PerseusGraphType): boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { Interval } from "mafs";
|
|
3
|
-
export declare const shouldShowLabel: (
|
|
3
|
+
export declare const shouldShowLabel: (currentTick: number, range: [Interval, Interval], tickStep: number) => boolean;
|
|
4
4
|
export declare function generateTickLocations(tickStep: number, min: number, max: number): number[];
|
|
5
5
|
export declare const AxisTicks: () => React.JSX.Element;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { LockedFigure } from "../../perseus-types";
|
|
3
|
+
import type { APIOptions } from "../../types";
|
|
3
4
|
import type { Interval } from "mafs";
|
|
4
5
|
type Props = {
|
|
6
|
+
flags?: APIOptions["flags"];
|
|
5
7
|
lockedFigures: ReadonlyArray<LockedFigure>;
|
|
6
8
|
range: [x: Interval, y: Interval];
|
|
7
9
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import { vec } from "mafs";
|
|
1
2
|
import type { Coord } from "../../interactive2/types";
|
|
2
3
|
import type { CollinearTuple, LockedFigureColor, LockedFigureFillType, LockedLineStyle, PerseusRenderer } from "../../perseus-types";
|
|
3
|
-
import type { Interval
|
|
4
|
+
import type { Interval } from "mafs";
|
|
4
5
|
export type LockedFunctionOptions = {
|
|
5
6
|
color?: LockedFigureColor;
|
|
6
7
|
strokeStyle?: LockedLineStyle;
|
|
7
8
|
directionalAxis?: "x" | "y";
|
|
8
9
|
domain?: Interval;
|
|
10
|
+
labels?: LockedFigureLabelOptions[];
|
|
11
|
+
ariaLabel?: string;
|
|
9
12
|
};
|
|
10
13
|
type LockedFigureLabelOptions = {
|
|
11
14
|
text: string;
|
|
@@ -109,6 +112,7 @@ declare class InteractiveGraphQuestionBuilder {
|
|
|
109
112
|
color?: LockedFigureColor;
|
|
110
113
|
filled?: boolean;
|
|
111
114
|
labels?: LockedFigureLabelOptions[];
|
|
115
|
+
ariaLabel?: string;
|
|
112
116
|
}): InteractiveGraphQuestionBuilder;
|
|
113
117
|
addLockedLine(point1: vec.Vector2, point2: vec.Vector2, options?: {
|
|
114
118
|
kind?: "line" | "ray" | "segment";
|
|
@@ -118,19 +122,28 @@ declare class InteractiveGraphQuestionBuilder {
|
|
|
118
122
|
showPoint1?: boolean;
|
|
119
123
|
showPoint2?: boolean;
|
|
120
124
|
labels?: LockedFigureLabelOptions[];
|
|
125
|
+
ariaLabel?: string;
|
|
126
|
+
}): InteractiveGraphQuestionBuilder;
|
|
127
|
+
addLockedVector(tail: vec.Vector2, tip: vec.Vector2, options?: {
|
|
128
|
+
color?: LockedFigureColor;
|
|
129
|
+
labels?: LockedFigureLabelOptions[];
|
|
130
|
+
ariaLabel?: string;
|
|
121
131
|
}): InteractiveGraphQuestionBuilder;
|
|
122
|
-
addLockedVector(tail: vec.Vector2, tip: vec.Vector2, color?: LockedFigureColor): InteractiveGraphQuestionBuilder;
|
|
123
132
|
addLockedEllipse(center: vec.Vector2, radius: [x: number, y: number], options?: {
|
|
124
133
|
angle?: number;
|
|
125
134
|
color?: LockedFigureColor;
|
|
126
135
|
fillStyle?: LockedFigureFillType;
|
|
127
136
|
strokeStyle?: "solid" | "dashed";
|
|
137
|
+
labels?: LockedFigureLabelOptions[];
|
|
138
|
+
ariaLabel?: string;
|
|
128
139
|
}): InteractiveGraphQuestionBuilder;
|
|
129
140
|
addLockedPolygon(points: vec.Vector2[], options?: {
|
|
130
141
|
color?: LockedFigureColor;
|
|
131
142
|
showVertices?: boolean;
|
|
132
143
|
fillStyle?: LockedFigureFillType;
|
|
133
144
|
strokeStyle?: "solid" | "dashed";
|
|
145
|
+
labels?: LockedFigureLabelOptions[];
|
|
146
|
+
ariaLabel?: string;
|
|
134
147
|
}): InteractiveGraphQuestionBuilder;
|
|
135
148
|
addLockedFunction(equation: string, options?: LockedFunctionOptions): this;
|
|
136
149
|
addLockedLabel(text: string, coord: Coord, options?: {
|
|
@@ -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;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { InteractiveGraphProps } from "./types";
|
|
3
3
|
import type { PerseusGraphType } from "../../perseus-types";
|
|
4
|
-
import type { Widget } from "../../renderer";
|
|
5
4
|
import type { APIOptions } from "../../types";
|
|
5
|
+
import type { PerseusInteractiveGraphUserInput } from "../../validation.types";
|
|
6
6
|
export type StatefulMafsGraphProps = {
|
|
7
7
|
flags?: APIOptions["flags"];
|
|
8
8
|
box: [number, number];
|
|
@@ -25,4 +25,7 @@ export type StatefulMafsGraphProps = {
|
|
|
25
25
|
readOnly: boolean;
|
|
26
26
|
static: InteractiveGraphProps["static"];
|
|
27
27
|
};
|
|
28
|
-
export
|
|
28
|
+
export type StatefulMafsGraphType = {
|
|
29
|
+
getUserInput: () => PerseusInteractiveGraphUserInput;
|
|
30
|
+
};
|
|
31
|
+
export declare const StatefulMafsGraph: React.ForwardRefExoticComponent<StatefulMafsGraphProps & React.RefAttributes<StatefulMafsGraphType>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { InteractiveMarkerType } from "./types";
|
|
2
|
+
import type { PerseusScore } from "../../types";
|
|
3
|
+
import type { PerseusLabelImageRubric, PerseusLabelImageUserInput } from "../../validation.types";
|
|
4
|
+
type InteractiveMarkerScore = {
|
|
5
|
+
hasAnswers: boolean;
|
|
6
|
+
isCorrect: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function scoreMarker(marker: InteractiveMarkerType): InteractiveMarkerScore;
|
|
9
|
+
declare function labelImageValidator(state: PerseusLabelImageUserInput, rubric?: PerseusLabelImageRubric): PerseusScore;
|
|
10
|
+
export default labelImageValidator;
|
|
@@ -8,14 +8,12 @@
|
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
10
10
|
import Marker from "./marker";
|
|
11
|
-
import type { InteractiveMarkerType
|
|
11
|
+
import type { InteractiveMarkerType } from "./types";
|
|
12
12
|
import type { DependencyProps } from "../../dependencies";
|
|
13
13
|
import type { ChangeableProps } from "../../mixins/changeable";
|
|
14
14
|
import type { APIOptions, PerseusScore } from "../../types";
|
|
15
|
+
import type { PerseusLabelImageRubric, PerseusLabelImageUserInput } from "../../validation.types";
|
|
15
16
|
export type PreferredPopoverDirection = "NONE" | "UP" | "DOWN" | "LEFT" | "RIGHT";
|
|
16
|
-
type MarkersState = {
|
|
17
|
-
markers: ReadonlyArray<InteractiveMarkerType>;
|
|
18
|
-
};
|
|
19
17
|
/**
|
|
20
18
|
* Represents a direction vector.
|
|
21
19
|
* No diagonals allowed.
|
|
@@ -60,8 +58,7 @@ export declare class LabelImage extends React.Component<LabelImageProps, LabelIm
|
|
|
60
58
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
61
59
|
_markers: Array<Marker | null | undefined>;
|
|
62
60
|
_mounted: boolean;
|
|
63
|
-
static
|
|
64
|
-
static validate(state: MarkersState, rubric?: LabelImageProps): PerseusScore;
|
|
61
|
+
static validate(state: PerseusLabelImageUserInput, rubric?: PerseusLabelImageRubric): PerseusScore;
|
|
65
62
|
/**
|
|
66
63
|
* Test whether point is contained within triangle.
|
|
67
64
|
*
|
|
@@ -82,8 +79,8 @@ export declare class LabelImage extends React.Component<LabelImageProps, LabelIm
|
|
|
82
79
|
constructor(props: LabelImageProps);
|
|
83
80
|
componentDidMount(): void;
|
|
84
81
|
componentWillUnmount(): void;
|
|
85
|
-
simpleValidate(rubric:
|
|
86
|
-
getUserInput():
|
|
82
|
+
simpleValidate(rubric: PerseusLabelImageRubric): PerseusScore;
|
|
83
|
+
getUserInput(): PerseusLabelImageUserInput;
|
|
87
84
|
showRationalesForCurrentlySelectedChoices(rubric: LabelImageProps): void;
|
|
88
85
|
handleMarkerChange(index: number, marker: InteractiveMarkerType): void;
|
|
89
86
|
activateMarker(index: number, opened: boolean): void;
|
|
@@ -99,7 +96,6 @@ declare const _default: Readonly<{
|
|
|
99
96
|
getWidget?: (() => React.ForwardRefExoticComponent<Omit<ChangeableProps & Partial<import("../../types").PerseusDependenciesV2> & {
|
|
100
97
|
apiOptions: Readonly<{
|
|
101
98
|
isArticle?: boolean | undefined;
|
|
102
|
-
onInputError?: ((widgetId: any, value: string, message?: string | null | undefined) => unknown) | undefined;
|
|
103
99
|
onFocusChange?: ((newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
|
|
104
100
|
GroupMetadataEditor?: React.ComponentType<any> | undefined;
|
|
105
101
|
showAlignmentOptions?: boolean | undefined;
|
|
@@ -145,8 +141,13 @@ declare const _default: Readonly<{
|
|
|
145
141
|
"unlimited-point"?: boolean | undefined;
|
|
146
142
|
} & {
|
|
147
143
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
|
144
|
+
"locked-figures-aria"?: boolean | undefined;
|
|
148
145
|
"locked-point-labels"?: boolean | undefined;
|
|
149
146
|
"locked-line-labels"?: boolean | undefined;
|
|
147
|
+
"locked-vector-labels"?: boolean | undefined;
|
|
148
|
+
"locked-ellipse-labels"?: boolean | undefined;
|
|
149
|
+
"locked-polygon-labels"?: boolean | undefined;
|
|
150
|
+
"locked-function-labels"?: boolean | undefined;
|
|
150
151
|
}) | undefined;
|
|
151
152
|
} | undefined;
|
|
152
153
|
onWidgetStartProps?: ((widgets: import("../..").PerseusWidgetsMap) => void) | undefined;
|
|
@@ -165,7 +166,6 @@ declare const _default: Readonly<{
|
|
|
165
166
|
widget: React.ForwardRefExoticComponent<Omit<ChangeableProps & Partial<import("../../types").PerseusDependenciesV2> & {
|
|
166
167
|
apiOptions: Readonly<{
|
|
167
168
|
isArticle?: boolean | undefined;
|
|
168
|
-
onInputError?: ((widgetId: any, value: string, message?: string | null | undefined) => unknown) | undefined;
|
|
169
169
|
onFocusChange?: ((newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
|
|
170
170
|
GroupMetadataEditor?: React.ComponentType<any> | undefined;
|
|
171
171
|
showAlignmentOptions?: boolean | undefined;
|
|
@@ -211,8 +211,13 @@ declare const _default: Readonly<{
|
|
|
211
211
|
"unlimited-point"?: boolean | undefined;
|
|
212
212
|
} & {
|
|
213
213
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
|
214
|
+
"locked-figures-aria"?: boolean | undefined;
|
|
214
215
|
"locked-point-labels"?: boolean | undefined;
|
|
215
216
|
"locked-line-labels"?: boolean | undefined;
|
|
217
|
+
"locked-vector-labels"?: boolean | undefined;
|
|
218
|
+
"locked-ellipse-labels"?: boolean | undefined;
|
|
219
|
+
"locked-polygon-labels"?: boolean | undefined;
|
|
220
|
+
"locked-function-labels"?: boolean | undefined;
|
|
216
221
|
}) | undefined;
|
|
217
222
|
} | undefined;
|
|
218
223
|
onWidgetStartProps?: ((widgets: import("../..").PerseusWidgetsMap) => void) | 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,10 +2,10 @@ 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 } from "../../types";
|
|
6
|
+
import type { PerseusMatcherRubric, PerseusMatcherUserInput } from "../../validation.types";
|
|
6
7
|
type RenderProps = PerseusMatcherWidgetOptions;
|
|
7
|
-
type
|
|
8
|
-
type Props = WidgetProps<RenderProps, Rubric>;
|
|
8
|
+
type Props = WidgetProps<RenderProps, PerseusMatcherRubric>;
|
|
9
9
|
type DefaultProps = {
|
|
10
10
|
left: Props["left"];
|
|
11
11
|
right: Props["right"];
|
|
@@ -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
|
-
getUserInput: () =>
|
|
36
|
+
getUserInput: () => PerseusMatcherUserInput;
|
|
36
37
|
moveLeftOptionToIndex: (option: SortableOption, index: number) => void;
|
|
37
38
|
moveRightOptionToIndex: (option: SortableOption, index: number) => void;
|
|
38
|
-
simpleValidate
|
|
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;
|
|
@@ -3,8 +3,9 @@ import { PerseusI18nContext } from "../../components/i18n-context";
|
|
|
3
3
|
import type { PerseusMatrixWidgetOptions } from "../../perseus-types";
|
|
4
4
|
import type { PerseusStrings } from "../../strings";
|
|
5
5
|
import type { WidgetProps, PerseusScore } from "../../types";
|
|
6
|
-
type
|
|
7
|
-
|
|
6
|
+
import type { PerseusMatrixRubric, PerseusMatrixUserInput } from "../../validation.types";
|
|
7
|
+
export declare function getMatrixSize(matrix: ReadonlyArray<ReadonlyArray<number>>): number[];
|
|
8
|
+
type ExternalProps = WidgetProps<PerseusMatrixWidgetOptions, PerseusMatrixRubric>;
|
|
8
9
|
type Props = ExternalProps & {
|
|
9
10
|
onChange: (arg1: {
|
|
10
11
|
cursorPosition?: ReadonlyArray<number>;
|
|
@@ -32,7 +33,7 @@ declare class Matrix extends React.Component<Props, State> {
|
|
|
32
33
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
33
34
|
cursorPosition: [number, number];
|
|
34
35
|
static defaultProps: DefaultProps;
|
|
35
|
-
static validate(state:
|
|
36
|
+
static validate(state: PerseusMatrixUserInput, rubric: PerseusMatrixRubric, strings: PerseusStrings): PerseusScore;
|
|
36
37
|
state: State;
|
|
37
38
|
componentDidMount(): void;
|
|
38
39
|
getInputPaths: () => ReadonlyArray<ReadonlyArray<string>>;
|
|
@@ -46,8 +47,8 @@ declare class Matrix extends React.Component<Props, State> {
|
|
|
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;
|
|
49
|
-
getUserInput
|
|
50
|
-
simpleValidate
|
|
50
|
+
getUserInput(): PerseusMatrixUserInput;
|
|
51
|
+
simpleValidate(rubric: PerseusMatrixRubric): PerseusScore;
|
|
51
52
|
render(): React.ReactNode;
|
|
52
53
|
}
|
|
53
54
|
declare const _default: Readonly<{
|
|
@@ -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 { PerseusMoleculeUserInput } from "../../validation.types";
|
|
4
5
|
type MoleculeState = {
|
|
5
6
|
parsedSmiles: any;
|
|
6
7
|
error: string | null;
|
|
@@ -32,7 +33,7 @@ type DefaultProps = {
|
|
|
32
33
|
declare class MoleculeWidget extends React.Component<Props> {
|
|
33
34
|
static defaultProps: DefaultProps;
|
|
34
35
|
simpleValidate(): import("../../types").PerseusScore;
|
|
35
|
-
getUserInput
|
|
36
|
+
getUserInput(): PerseusMoleculeUserInput;
|
|
36
37
|
validate(): import("../../types").PerseusScore;
|
|
37
38
|
render(): React.ReactNode;
|
|
38
39
|
}
|
|
@@ -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,9 @@
|
|
|
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 } from "../../types";
|
|
5
|
+
import type { PerseusNumberLineRubric, PerseusNumberLineUserInput } from "../../validation.types";
|
|
6
|
+
export type Relationship = "lt" | "gt" | "le" | "ge";
|
|
5
7
|
type Props = ChangeableProps & {
|
|
6
8
|
range: [number, number];
|
|
7
9
|
labelRange: ReadonlyArray<number | null>;
|
|
@@ -13,7 +15,7 @@ type Props = ChangeableProps & {
|
|
|
13
15
|
isTickCtrl: boolean;
|
|
14
16
|
isInequality: boolean;
|
|
15
17
|
numLinePosition: number;
|
|
16
|
-
rel:
|
|
18
|
+
rel: Relationship;
|
|
17
19
|
onFocus: (arg1: any) => void;
|
|
18
20
|
onBlur: (arg1: any) => void;
|
|
19
21
|
onChange: (arg1: any, arg2?: () => void | null | undefined) => void;
|
|
@@ -48,6 +50,7 @@ declare class NumberLine extends React.Component<Props, State> {
|
|
|
48
50
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
49
51
|
static defaultProps: DefaultProps;
|
|
50
52
|
state: any;
|
|
53
|
+
static validate(state: PerseusNumberLineUserInput, rubric: PerseusNumberLineRubric): PerseusScore;
|
|
51
54
|
change: (...args: ReadonlyArray<unknown>) => any;
|
|
52
55
|
isValid: () => boolean;
|
|
53
56
|
onNumDivisionsChange: (arg1: number, arg2: any) => void;
|
|
@@ -69,8 +72,8 @@ declare class NumberLine extends React.Component<Props, State> {
|
|
|
69
72
|
_getInequalityEndpoint: (arg1: any) => [number, number];
|
|
70
73
|
_renderInequality: (arg1: any) => React.ReactElement;
|
|
71
74
|
_setupGraphie: (arg1: any, arg2: any) => void;
|
|
72
|
-
getUserInput
|
|
73
|
-
simpleValidate
|
|
75
|
+
getUserInput(): PerseusNumberLineUserInput;
|
|
76
|
+
simpleValidate(rubric: PerseusNumberLineRubric): PerseusScore;
|
|
74
77
|
render(): React.ReactNode;
|
|
75
78
|
}
|
|
76
79
|
declare const _default: Readonly<{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Rubric, UserInput } from "./numeric-input.types";
|
|
2
1
|
import type { PerseusStrings } from "../../strings";
|
|
3
2
|
import type { PerseusScore } from "../../types";
|
|
3
|
+
import type { PerseusNumericInputRubric, PerseusNumericInputUserInput } from "../../validation.types";
|
|
4
4
|
export declare function maybeParsePercentInput(inputValue: string | number, normalizedAnswerExpected: boolean): string | number;
|
|
5
|
-
declare function numericInputValidator(userInput:
|
|
5
|
+
declare function numericInputValidator(userInput: PerseusNumericInputUserInput, rubric: PerseusNumericInputRubric, strings: PerseusStrings): PerseusScore;
|
|
6
6
|
export default numericInputValidator;
|
|
@@ -2,11 +2,11 @@ import * as React from "react";
|
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
3
|
import InputWithExamples from "../../components/input-with-examples";
|
|
4
4
|
import SimpleKeypadInput from "../../components/simple-keypad-input";
|
|
5
|
-
import type { Rubric, UserInput } from "./numeric-input.types";
|
|
6
5
|
import type { PerseusNumericInputWidgetOptions, PerseusNumericInputAnswerForm } from "../../perseus-types";
|
|
7
6
|
import type { PerseusStrings } from "../../strings";
|
|
8
7
|
import type { FocusPath, PerseusScore, WidgetProps } from "../../types";
|
|
9
|
-
type
|
|
8
|
+
import type { PerseusNumericInputRubric, PerseusNumericInputUserInput } from "../../validation.types";
|
|
9
|
+
type ExternalProps = WidgetProps<PerseusNumericInputWidgetOptions, PerseusNumericInputRubric>;
|
|
10
10
|
type Props = ExternalProps & {
|
|
11
11
|
size: NonNullable<ExternalProps["size"]>;
|
|
12
12
|
rightAlign: NonNullable<ExternalProps["rightAlign"]>;
|
|
@@ -38,20 +38,20 @@ export declare class NumericInput extends React.Component<Props, State> {
|
|
|
38
38
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
39
39
|
inputRef: SimpleKeypadInput | InputWithExamples | null | undefined;
|
|
40
40
|
static defaultProps: DefaultProps;
|
|
41
|
-
static getUserInputFromProps(props: Props):
|
|
42
|
-
static getOneCorrectAnswerFromRubric(rubric:
|
|
43
|
-
static validate(userInput:
|
|
41
|
+
static getUserInputFromProps(props: Props): PerseusNumericInputUserInput;
|
|
42
|
+
static getOneCorrectAnswerFromRubric(rubric: PerseusNumericInputRubric): string | null | undefined;
|
|
43
|
+
static validate(userInput: PerseusNumericInputUserInput, rubric: PerseusNumericInputRubric, strings: PerseusStrings): PerseusScore;
|
|
44
44
|
state: State;
|
|
45
45
|
examples: () => ReadonlyArray<string>;
|
|
46
46
|
shouldShowExamples: () => boolean;
|
|
47
|
-
simpleValidate
|
|
47
|
+
simpleValidate(rubric: PerseusNumericInputRubric): PerseusScore;
|
|
48
48
|
focus: () => boolean;
|
|
49
49
|
focusInputPath: () => void;
|
|
50
50
|
blurInputPath: () => void;
|
|
51
51
|
getInputPaths: () => ReadonlyArray<ReadonlyArray<string>>;
|
|
52
52
|
getGrammarTypeForPath: (arg1: FocusPath) => string;
|
|
53
53
|
setInputValue: (arg1: FocusPath, arg2: string, arg3?: () => unknown | null | undefined) => void;
|
|
54
|
-
getUserInput
|
|
54
|
+
getUserInput(): PerseusNumericInputUserInput;
|
|
55
55
|
handleChange: (arg1: string, arg2?: () => unknown | null | undefined) => void;
|
|
56
56
|
_handleFocus: () => void;
|
|
57
57
|
_handleBlur: () => void;
|