@khanacademy/perseus 34.0.0 → 35.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 +641 -525
- 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 +573 -447
- package/dist/index.js.map +1 -1
- package/dist/mixins/widget-prop-denylist.d.ts +0 -1
- package/dist/perseus-api.d.ts +4 -5
- package/dist/perseus-types.d.ts +6 -18
- package/dist/renderer.d.ts +4 -4
- package/dist/server-item-renderer.d.ts +4 -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 +1 -3
- package/dist/validation.types.d.ts +111 -0
- package/dist/widgets/__shared__/noop-validator.d.ts +2 -2
- package/dist/widgets/categorizer/categorizer-validator.d.ts +5 -0
- package/dist/widgets/categorizer/categorizer.d.ts +6 -9
- package/dist/widgets/cs-program/cs-program.d.ts +4 -9
- package/dist/widgets/definition/definition.d.ts +6 -7
- 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 +6 -7
- package/dist/widgets/expression/expression-validator.d.ts +2 -2
- package/dist/widgets/expression/expression.d.ts +38 -26
- 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.d.ts +6 -7
- package/dist/widgets/group/group.d.ts +3 -2
- package/dist/widgets/iframe/iframe.d.ts +4 -9
- package/dist/widgets/image/image.d.ts +6 -7
- package/dist/widgets/input-number/input-number-validator.d.ts +41 -0
- package/dist/widgets/input-number/input-number.d.ts +7 -10
- package/dist/widgets/interaction/interaction.d.ts +6 -6
- package/dist/widgets/interactive-graph.d.ts +9 -12
- package/dist/widgets/interactive-graphs/interactive-graph-question-builder.d.ts +15 -7
- package/dist/widgets/interactive-graphs/reducer/interactive-graph-action.d.ts +16 -1
- package/dist/widgets/interactive-graphs/stateful-mafs-graph.d.ts +5 -2
- package/dist/widgets/interactive-graphs/types.d.ts +3 -0
- package/dist/widgets/label-image/label-image-validator.d.ts +10 -0
- package/dist/widgets/label-image/label-image.d.ts +13 -10
- package/dist/widgets/label-image/types.d.ts +0 -4
- package/dist/widgets/matcher/matcher.d.ts +4 -4
- package/dist/widgets/matrix/matrix.d.ts +5 -5
- package/dist/widgets/molecule/molecule.d.ts +4 -3
- package/dist/widgets/number-line/number-line.d.ts +5 -3
- 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 +6 -7
- package/dist/widgets/passage-ref/passage-ref.d.ts +6 -14
- package/dist/widgets/passage-ref-target/passage-ref-target.d.ts +4 -3
- package/dist/widgets/phet-simulation/phet-simulation.d.ts +2 -2
- package/dist/widgets/plotter/plotter.d.ts +5 -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.d.ts +5 -5
- package/dist/widgets/video/video.d.ts +5 -6
- package/package.json +1 -1
- package/dist/widgets/dropdown/dropdown.types.d.ts +0 -5
- package/dist/widgets/numeric-input/numeric-input.types.d.ts +0 -5
|
@@ -1,10 +1,10 @@
|
|
|
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 { WidgetProps } from "../../types";
|
|
5
|
-
type
|
|
4
|
+
import type { PerseusScore, WidgetProps } from "../../types";
|
|
5
|
+
import type { PerseusPlotterRubric, PerseusPlotterUserInput } from "../../validation.types";
|
|
6
6
|
type RenderProps = PerseusPlotterWidgetOptions;
|
|
7
|
-
type Props = WidgetProps<RenderProps,
|
|
7
|
+
type Props = WidgetProps<RenderProps, PerseusPlotterRubric> & {
|
|
8
8
|
labelInterval: NonNullable<PerseusPlotterWidgetOptions["labelInterval"]>;
|
|
9
9
|
picSize: NonNullable<PerseusPlotterWidgetOptions["picSize"]>;
|
|
10
10
|
};
|
|
@@ -67,8 +67,8 @@ export declare class Plotter extends React.Component<Props, State> {
|
|
|
67
67
|
setPicHeight: (arg1: number, arg2: number) => void;
|
|
68
68
|
changeAndTrack: (arg1: any) => void;
|
|
69
69
|
drawPicHeights: (arg1: any, arg2: any) => void;
|
|
70
|
-
getUserInput
|
|
71
|
-
simpleValidate
|
|
70
|
+
getUserInput(): PerseusPlotterUserInput;
|
|
71
|
+
simpleValidate(rubric: PerseusPlotterRubric): PerseusScore;
|
|
72
72
|
render(): React.ReactNode;
|
|
73
73
|
}
|
|
74
74
|
declare const _default: Readonly<{
|
|
@@ -4,6 +4,7 @@ import type { FocusFunction } from "./base-radio";
|
|
|
4
4
|
import type { PerseusRadioChoice, PerseusRadioWidgetOptions, ShowSolutions } from "../../perseus-types";
|
|
5
5
|
import type { PerseusStrings } from "../../strings";
|
|
6
6
|
import type { PerseusScore, WidgetProps, ChoiceState } from "../../types";
|
|
7
|
+
import type { PerseusRadioRubric, PerseusRadioUserInput } from "../../validation.types";
|
|
7
8
|
export type RenderProps = {
|
|
8
9
|
numCorrect: number;
|
|
9
10
|
hasNoneOfTheAbove?: boolean;
|
|
@@ -16,15 +17,7 @@ export type RenderProps = {
|
|
|
16
17
|
choiceStates?: ReadonlyArray<ChoiceState>;
|
|
17
18
|
values?: ReadonlyArray<boolean>;
|
|
18
19
|
};
|
|
19
|
-
type
|
|
20
|
-
countChoices?: boolean;
|
|
21
|
-
choicesSelected: ReadonlyArray<boolean>;
|
|
22
|
-
numCorrect?: number;
|
|
23
|
-
noneOfTheAboveIndex?: number | null | undefined;
|
|
24
|
-
noneOfTheAboveSelected?: boolean;
|
|
25
|
-
};
|
|
26
|
-
type Rubric = PerseusRadioWidgetOptions;
|
|
27
|
-
type Props = WidgetProps<RenderProps, Rubric>;
|
|
20
|
+
type Props = WidgetProps<RenderProps, PerseusRadioRubric>;
|
|
28
21
|
type DefaultProps = Required<Pick<Props, "choices" | "multipleSelect" | "countChoices" | "deselectEnabled" | "linterContext" | "showSolutions">>;
|
|
29
22
|
export type RadioChoiceWithMetadata = PerseusRadioChoice & {
|
|
30
23
|
originalIndex: number;
|
|
@@ -38,8 +31,8 @@ declare class Radio extends React.Component<Props> {
|
|
|
38
31
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
39
32
|
focusFunction: FocusFunction;
|
|
40
33
|
static defaultProps: DefaultProps;
|
|
41
|
-
static validate(userInput:
|
|
42
|
-
static getUserInputFromProps(props: Props):
|
|
34
|
+
static validate(userInput: PerseusRadioUserInput, rubric: PerseusRadioRubric, strings: PerseusStrings): PerseusScore;
|
|
35
|
+
static getUserInputFromProps(props: Props): PerseusRadioUserInput;
|
|
43
36
|
componentDidUpdate(prevProps: Props): void;
|
|
44
37
|
_renderRenderer: (content?: string) => React.ReactElement;
|
|
45
38
|
focus(choiceIndex?: number | null): boolean;
|
|
@@ -48,8 +41,8 @@ declare class Radio extends React.Component<Props> {
|
|
|
48
41
|
checked: ReadonlyArray<boolean>;
|
|
49
42
|
crossedOut: ReadonlyArray<boolean>;
|
|
50
43
|
}>) => void;
|
|
51
|
-
getUserInput
|
|
52
|
-
simpleValidate
|
|
44
|
+
getUserInput(): PerseusRadioUserInput;
|
|
45
|
+
simpleValidate(rubric: PerseusRadioRubric): PerseusScore;
|
|
53
46
|
/**
|
|
54
47
|
* Turn on rationale display for the currently selected choices. Note that
|
|
55
48
|
* this leaves rationales on for choices that are already showing
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusStrings } from "../../strings";
|
|
2
|
+
import type { PerseusScore } from "../../types";
|
|
3
|
+
import type { PerseusRadioRubric, PerseusRadioUserInput } from "../../validation.types";
|
|
4
|
+
declare function radioValidator(userInput: PerseusRadioUserInput, rubric: PerseusRadioRubric, strings: PerseusStrings): PerseusScore;
|
|
5
|
+
export default radioValidator;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PerseusScore } from "../../types";
|
|
2
|
+
import type { PerseusSorterRubric, PerseusSorterUserInput } from "../../validation.types";
|
|
3
|
+
declare function sorterValidator(userInput: PerseusSorterUserInput, rubric: PerseusSorterRubric): PerseusScore;
|
|
4
|
+
export default sorterValidator;
|
|
@@ -1,10 +1,10 @@
|
|
|
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 { WidgetProps } from "../../types";
|
|
4
|
+
import type { PerseusScore, WidgetProps } from "../../types";
|
|
5
|
+
import type { PerseusSorterRubric, PerseusSorterUserInput } from "../../validation.types";
|
|
5
6
|
type RenderProps = PerseusSorterWidgetOptions;
|
|
6
|
-
type
|
|
7
|
-
type Props = WidgetProps<RenderProps, Rubric>;
|
|
7
|
+
type Props = WidgetProps<RenderProps, PerseusSorterRubric>;
|
|
8
8
|
type DefaultProps = {
|
|
9
9
|
correct: Props["correct"];
|
|
10
10
|
layout: Props["layout"];
|
|
@@ -19,16 +19,14 @@ type State = {
|
|
|
19
19
|
declare class Sorter extends React.Component<Props, State> {
|
|
20
20
|
_isMounted: boolean;
|
|
21
21
|
static defaultProps: DefaultProps;
|
|
22
|
-
static validate(
|
|
23
|
-
state:
|
|
22
|
+
static validate(userInput: PerseusSorterUserInput, rubric: PerseusSorterRubric): PerseusScore;
|
|
23
|
+
state: State;
|
|
24
24
|
componentDidMount(): void;
|
|
25
25
|
componentWillUnmount(): void;
|
|
26
26
|
handleChange: (arg1: React.ChangeEvent<HTMLInputElement>) => void;
|
|
27
|
-
getUserInput
|
|
28
|
-
options: any;
|
|
29
|
-
};
|
|
27
|
+
getUserInput(): PerseusSorterUserInput;
|
|
30
28
|
moveOptionToIndex: (option: SortableOption, index: number) => void;
|
|
31
|
-
simpleValidate
|
|
29
|
+
simpleValidate(rubric: PerseusSorterRubric): PerseusScore;
|
|
32
30
|
render(): React.ReactNode;
|
|
33
31
|
}
|
|
34
32
|
declare const _default: Readonly<{
|
|
@@ -3,13 +3,13 @@ import { PerseusI18nContext } from "../../components/i18n-context";
|
|
|
3
3
|
import type { ChangeableProps } from "../../mixins/changeable";
|
|
4
4
|
import type { PerseusTableWidgetOptions } from "../../perseus-types";
|
|
5
5
|
import type { PerseusStrings } from "../../strings";
|
|
6
|
-
import type { WidgetProps } from "../../types";
|
|
6
|
+
import type { PerseusScore, WidgetProps } from "../../types";
|
|
7
|
+
import type { PerseusTableRubric, PerseusTableUserInput } from "../../validation.types";
|
|
7
8
|
type RenderProps = PerseusTableWidgetOptions & {
|
|
8
9
|
editableHeaders: boolean;
|
|
9
10
|
Editor: any;
|
|
10
11
|
};
|
|
11
|
-
type
|
|
12
|
-
type Props = ChangeableProps & WidgetProps<RenderProps, Rubric>;
|
|
12
|
+
type Props = ChangeableProps & WidgetProps<RenderProps, PerseusTableRubric>;
|
|
13
13
|
type DefaultProps = {
|
|
14
14
|
apiOptions: Props["apiOptions"];
|
|
15
15
|
headers: Props["headers"];
|
|
@@ -28,10 +28,10 @@ declare class Table extends React.Component<Props> {
|
|
|
28
28
|
static defaultProps: DefaultProps;
|
|
29
29
|
_getRows: () => number;
|
|
30
30
|
_getColumns: () => number;
|
|
31
|
-
getUserInput
|
|
31
|
+
getUserInput(): PerseusTableUserInput;
|
|
32
32
|
onValueChange: (arg1: any, arg2: any, arg3: any) => void;
|
|
33
33
|
onHeaderChange: (arg1: number, arg2: any) => void;
|
|
34
|
-
simpleValidate
|
|
34
|
+
simpleValidate(rubric: PerseusTableWidgetOptions): PerseusScore;
|
|
35
35
|
_handleFocus: (arg1: any) => void;
|
|
36
36
|
_handleBlur: (arg1: any) => void;
|
|
37
37
|
focus: () => boolean;
|
|
@@ -4,11 +4,10 @@
|
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
6
6
|
import type { PerseusVideoWidgetOptions } from "../../perseus-types";
|
|
7
|
-
import type {
|
|
8
|
-
type
|
|
9
|
-
type Rubric = PerseusVideoWidgetOptions;
|
|
7
|
+
import type { WidgetProps } from "../../types";
|
|
8
|
+
import type { PerseusVideoRubric } from "../../validation.types";
|
|
10
9
|
type RenderProps = PerseusVideoWidgetOptions;
|
|
11
|
-
type Props = WidgetProps<RenderProps,
|
|
10
|
+
type Props = WidgetProps<RenderProps, PerseusVideoRubric> & {
|
|
12
11
|
alignment: string;
|
|
13
12
|
};
|
|
14
13
|
/**
|
|
@@ -25,9 +24,9 @@ declare class Video extends React.Component<Props> {
|
|
|
25
24
|
* Points for videos are tallied by the embedded video itself, in the case
|
|
26
25
|
* of Khan Academy videos.
|
|
27
26
|
*/
|
|
28
|
-
static validate(
|
|
27
|
+
static validate(): import("../../types").PerseusScore;
|
|
29
28
|
getUserInput: () => undefined | null | undefined;
|
|
30
|
-
simpleValidate: (
|
|
29
|
+
simpleValidate(): import("../../types").PerseusScore;
|
|
31
30
|
change: (...args: ReadonlyArray<unknown>) => any;
|
|
32
31
|
render(): React.ReactNode;
|
|
33
32
|
}
|
package/package.json
CHANGED