@khanacademy/perseus 36.1.2 → 37.0.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/all-widgets.d.ts +2 -0
- package/dist/basic-widgets.d.ts +2 -0
- package/dist/components/math-input.d.ts +1 -1
- package/dist/es/index.js +598 -766
- package/dist/es/index.js.map +1 -1
- package/dist/extra-widgets.d.ts +2 -0
- package/dist/index.js +463 -643
- package/dist/index.js.map +1 -1
- package/dist/perseus-api.d.ts +1 -0
- package/dist/renderer-util.d.ts +8 -0
- package/dist/renderer.d.ts +19 -20
- package/dist/server-item-renderer.d.ts +1 -0
- package/dist/types.d.ts +13 -4
- package/dist/util/extract-perseus-data.d.ts +1 -1
- package/dist/util.d.ts +4 -0
- package/dist/validation.types.d.ts +14 -6
- package/dist/widgets/categorizer/categorizer.d.ts +4 -5
- package/dist/widgets/cs-program/cs-program.d.ts +3 -3
- package/dist/widgets/definition/definition.d.ts +4 -4
- package/dist/widgets/deprecated-standin/deprecated-standin.d.ts +36 -0
- package/dist/widgets/deprecated-standin/index.d.ts +1 -37
- package/dist/widgets/dropdown/dropdown.d.ts +3 -3
- package/dist/widgets/explanation/explanation.d.ts +5 -5
- package/dist/widgets/expression/expression.d.ts +11 -9
- package/dist/widgets/graded-group/graded-group.d.ts +2 -0
- package/dist/widgets/graded-group-set/graded-group-set.d.ts +2 -0
- package/dist/widgets/grapher/grapher.d.ts +3 -3
- package/dist/widgets/group/group.d.ts +9 -5
- package/dist/widgets/iframe/iframe.d.ts +3 -3
- package/dist/widgets/image/image.d.ts +4 -4
- package/dist/widgets/input-number/input-number.d.ts +3 -6
- package/dist/widgets/interaction/interaction.d.ts +4 -4
- package/dist/widgets/interactive-graph.d.ts +3 -4
- package/dist/widgets/interactive-graphs/mafs-supported-graph-types.d.ts +1 -1
- package/dist/widgets/label-image/label-image.d.ts +6 -4
- package/dist/widgets/matcher/matcher.d.ts +3 -3
- package/dist/widgets/matrix/matrix.d.ts +4 -5
- package/dist/widgets/measurer/measurer.d.ts +3 -4
- package/dist/widgets/molecule/molecule.d.ts +3 -4
- package/dist/widgets/number-line/number-line.d.ts +4 -4
- package/dist/widgets/numeric-input/numeric-input.d.ts +3 -4
- package/dist/widgets/orderer/orderer.d.ts +3 -3
- package/dist/widgets/passage/passage.d.ts +4 -9
- package/dist/widgets/passage-ref/passage-ref.d.ts +4 -4
- package/dist/widgets/passage-ref-target/passage-ref-target.d.ts +3 -4
- package/dist/widgets/phet-simulation/phet-simulation.d.ts +3 -2
- package/dist/widgets/plotter/plotter.d.ts +3 -3
- package/dist/widgets/python-program/python-program.d.ts +2 -0
- package/dist/widgets/radio/radio-component.d.ts +2 -5
- package/dist/widgets/radio/radio.d.ts +2 -0
- package/dist/widgets/sorter/sorter.d.ts +3 -3
- package/dist/widgets/table/table.d.ts +4 -5
- package/dist/widgets/video/video.d.ts +3 -8
- package/dist/widgets.d.ts +3 -1
- package/package.json +2 -2
- package/dist/widgets/expression/expression.types.d.ts +0 -2
|
@@ -3,7 +3,6 @@ import { PerseusI18nContext } from "../../components/i18n-context";
|
|
|
3
3
|
import * as Changeable from "../../mixins/changeable";
|
|
4
4
|
import type { PerseusPassageRefTargetWidgetOptions } from "../../perseus-types";
|
|
5
5
|
import type { APIOptions, Widget } from "../../types";
|
|
6
|
-
import type { NullUserInput } from "../../validation.types";
|
|
7
6
|
import type { LinterContextProps } from "@khanacademy/perseus-linter";
|
|
8
7
|
type Props = Changeable.ChangeableProps & {
|
|
9
8
|
apiOptions: APIOptions;
|
|
@@ -21,10 +20,8 @@ declare class PassageRefTarget extends React.Component<Props> implements Widget
|
|
|
21
20
|
}>;
|
|
22
21
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
23
22
|
static defaultProps: DefaultProps;
|
|
24
|
-
|
|
25
|
-
getUserInput(): NullUserInput;
|
|
23
|
+
isWidget: true;
|
|
26
24
|
change: (arg1: any, arg2: any, arg3: any) => any;
|
|
27
|
-
simpleValidate(): import("../../types").PerseusScore;
|
|
28
25
|
render(): React.ReactNode;
|
|
29
26
|
}
|
|
30
27
|
declare const _default: Readonly<{
|
|
@@ -43,6 +40,8 @@ declare const _default: Readonly<{
|
|
|
43
40
|
traverseChildWidgets?: any;
|
|
44
41
|
transform?: import("../../types").WidgetTransform | undefined;
|
|
45
42
|
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
43
|
+
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
44
|
+
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
46
45
|
propUpgrades?: {
|
|
47
46
|
[key: string]: (arg1: any) => any;
|
|
48
47
|
} | undefined;
|
|
@@ -6,7 +6,6 @@ import * as React from "react";
|
|
|
6
6
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
7
7
|
import type { PerseusPhetSimulationWidgetOptions } from "../../perseus-types";
|
|
8
8
|
import type { WidgetProps, Widget } from "../../types";
|
|
9
|
-
import type { NullUserInput } from "../../validation.types";
|
|
10
9
|
type RenderProps = PerseusPhetSimulationWidgetOptions;
|
|
11
10
|
type Props = WidgetProps<RenderProps, PerseusPhetSimulationWidgetOptions>;
|
|
12
11
|
type State = {
|
|
@@ -24,11 +23,11 @@ export declare class PhetSimulation extends React.Component<Props, State> implem
|
|
|
24
23
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
25
24
|
private readonly iframeRef;
|
|
26
25
|
private readonly locale;
|
|
26
|
+
isWidget: true;
|
|
27
27
|
state: State;
|
|
28
28
|
constructor(props: any);
|
|
29
29
|
componentDidMount(): Promise<void>;
|
|
30
30
|
componentDidUpdate(prevProps: any): Promise<void>;
|
|
31
|
-
getUserInput(): NullUserInput;
|
|
32
31
|
getPhetCompatibleLocale: (arg1: string) => string;
|
|
33
32
|
displayLoadFailure: () => void;
|
|
34
33
|
updateSimState(urlString: string): Promise<void>;
|
|
@@ -52,6 +51,8 @@ declare const _default: Readonly<{
|
|
|
52
51
|
traverseChildWidgets?: any;
|
|
53
52
|
transform?: import("../../types").WidgetTransform | undefined;
|
|
54
53
|
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
54
|
+
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
55
|
+
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
55
56
|
propUpgrades?: {
|
|
56
57
|
[key: string]: (arg1: any) => any;
|
|
57
58
|
} | undefined;
|
|
@@ -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 {
|
|
4
|
+
import type { 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> & {
|
|
@@ -38,7 +38,6 @@ export declare class Plotter extends React.Component<Props, State> implements Wi
|
|
|
38
38
|
graphie: any;
|
|
39
39
|
static defaultProps: DefaultProps;
|
|
40
40
|
state: State;
|
|
41
|
-
static validate(userInput: PerseusPlotterUserInput, rubric: PerseusPlotterRubric): PerseusScore;
|
|
42
41
|
componentDidMount(): void;
|
|
43
42
|
UNSAFE_componentWillReceiveProps(nextProps: Props): void;
|
|
44
43
|
componentDidUpdate(prevProps: Props, prevState: State): void;
|
|
@@ -69,7 +68,6 @@ export declare class Plotter extends React.Component<Props, State> implements Wi
|
|
|
69
68
|
changeAndTrack: (arg1: any) => void;
|
|
70
69
|
drawPicHeights: (arg1: any, arg2: any) => void;
|
|
71
70
|
getUserInput(): PerseusPlotterUserInput;
|
|
72
|
-
simpleValidate(rubric: PerseusPlotterRubric): PerseusScore;
|
|
73
71
|
render(): React.ReactNode;
|
|
74
72
|
}
|
|
75
73
|
declare const _default: Readonly<{
|
|
@@ -88,6 +86,8 @@ declare const _default: Readonly<{
|
|
|
88
86
|
traverseChildWidgets?: any;
|
|
89
87
|
transform?: import("../../types").WidgetTransform | undefined;
|
|
90
88
|
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
89
|
+
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
90
|
+
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
91
91
|
propUpgrades?: {
|
|
92
92
|
[key: string]: (arg1: any) => any;
|
|
93
93
|
} | undefined;
|
|
@@ -31,6 +31,8 @@ declare const _default: Readonly<{
|
|
|
31
31
|
traverseChildWidgets?: any;
|
|
32
32
|
transform?: import("../../types").WidgetTransform | undefined;
|
|
33
33
|
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
34
|
+
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
35
|
+
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
34
36
|
propUpgrades?: {
|
|
35
37
|
[key: string]: (arg1: any) => any;
|
|
36
38
|
} | undefined;
|
|
@@ -2,8 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
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
|
-
import type {
|
|
6
|
-
import type { PerseusScore, WidgetProps, ChoiceState, Widget } from "../../types";
|
|
5
|
+
import type { WidgetProps, ChoiceState, Widget } from "../../types";
|
|
7
6
|
import type { PerseusRadioRubric, PerseusRadioUserInput } from "../../validation.types";
|
|
8
7
|
export type RenderProps = {
|
|
9
8
|
numCorrect: number;
|
|
@@ -25,13 +24,12 @@ export type RadioChoiceWithMetadata = PerseusRadioChoice & {
|
|
|
25
24
|
};
|
|
26
25
|
declare class Radio extends React.Component<Props> implements Widget {
|
|
27
26
|
static contextType: React.Context<{
|
|
28
|
-
strings: PerseusStrings;
|
|
27
|
+
strings: import("../../strings").PerseusStrings;
|
|
29
28
|
locale: string;
|
|
30
29
|
}>;
|
|
31
30
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
32
31
|
focusFunction: FocusFunction;
|
|
33
32
|
static defaultProps: DefaultProps;
|
|
34
|
-
static validate(userInput: PerseusRadioUserInput, rubric: PerseusRadioRubric, strings: PerseusStrings): PerseusScore;
|
|
35
33
|
static getUserInputFromProps(props: Props): PerseusRadioUserInput;
|
|
36
34
|
componentDidUpdate(prevProps: Props): void;
|
|
37
35
|
_renderRenderer: (content?: string) => React.ReactElement;
|
|
@@ -42,7 +40,6 @@ declare class Radio extends React.Component<Props> implements Widget {
|
|
|
42
40
|
crossedOut: ReadonlyArray<boolean>;
|
|
43
41
|
}>) => void;
|
|
44
42
|
getUserInput(): PerseusRadioUserInput;
|
|
45
|
-
simpleValidate(rubric: PerseusRadioRubric): PerseusScore;
|
|
46
43
|
/**
|
|
47
44
|
* Turn on rationale display for the currently selected choices. Note that
|
|
48
45
|
* this leaves rationales on for choices that are already showing
|
|
@@ -15,6 +15,8 @@ declare const _default: Readonly<{
|
|
|
15
15
|
traverseChildWidgets?: any;
|
|
16
16
|
transform?: import("../../types").WidgetTransform | undefined;
|
|
17
17
|
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
18
|
+
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
19
|
+
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
18
20
|
propUpgrades?: {
|
|
19
21
|
[key: string]: (arg1: any) => any;
|
|
20
22
|
} | undefined;
|
|
@@ -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 {
|
|
4
|
+
import type { 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>;
|
|
@@ -19,14 +19,12 @@ type State = {
|
|
|
19
19
|
declare class Sorter extends React.Component<Props, State> implements Widget {
|
|
20
20
|
_isMounted: boolean;
|
|
21
21
|
static defaultProps: DefaultProps;
|
|
22
|
-
static validate(userInput: PerseusSorterUserInput, rubric: PerseusSorterRubric): PerseusScore;
|
|
23
22
|
state: State;
|
|
24
23
|
componentDidMount(): void;
|
|
25
24
|
componentWillUnmount(): void;
|
|
26
25
|
handleChange: (arg1: React.ChangeEvent<HTMLInputElement>) => void;
|
|
27
26
|
getUserInput(): PerseusSorterUserInput;
|
|
28
27
|
moveOptionToIndex: (option: SortableOption, index: number) => void;
|
|
29
|
-
simpleValidate(rubric: PerseusSorterRubric): PerseusScore;
|
|
30
28
|
render(): React.ReactNode;
|
|
31
29
|
}
|
|
32
30
|
declare const _default: Readonly<{
|
|
@@ -45,6 +43,8 @@ declare const _default: Readonly<{
|
|
|
45
43
|
traverseChildWidgets?: any;
|
|
46
44
|
transform?: import("../../types").WidgetTransform | undefined;
|
|
47
45
|
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
46
|
+
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
47
|
+
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
48
48
|
propUpgrades?: {
|
|
49
49
|
[key: string]: (arg1: any) => any;
|
|
50
50
|
} | undefined;
|
|
@@ -2,8 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
3
|
import type { ChangeableProps } from "../../mixins/changeable";
|
|
4
4
|
import type { PerseusTableWidgetOptions } from "../../perseus-types";
|
|
5
|
-
import type {
|
|
6
|
-
import type { PerseusScore, Widget, WidgetProps } from "../../types";
|
|
5
|
+
import type { Widget, WidgetProps } from "../../types";
|
|
7
6
|
import type { PerseusTableRubric, PerseusTableUserInput } from "../../validation.types";
|
|
8
7
|
type RenderProps = PerseusTableWidgetOptions & {
|
|
9
8
|
editableHeaders: boolean;
|
|
@@ -21,18 +20,16 @@ type DefaultProps = {
|
|
|
21
20
|
};
|
|
22
21
|
declare class Table extends React.Component<Props> implements Widget {
|
|
23
22
|
static contextType: React.Context<{
|
|
24
|
-
strings: PerseusStrings;
|
|
23
|
+
strings: import("../../strings").PerseusStrings;
|
|
25
24
|
locale: string;
|
|
26
25
|
}>;
|
|
27
26
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
28
27
|
static defaultProps: DefaultProps;
|
|
29
|
-
static validate(state: PerseusTableUserInput, rubric: PerseusTableRubric, strings: PerseusStrings): PerseusScore;
|
|
30
28
|
_getRows: () => number;
|
|
31
29
|
_getColumns: () => number;
|
|
32
30
|
getUserInput(): PerseusTableUserInput;
|
|
33
31
|
onValueChange: (arg1: any, arg2: any, arg3: any) => void;
|
|
34
32
|
onHeaderChange: (arg1: number, arg2: any) => void;
|
|
35
|
-
simpleValidate(rubric: PerseusTableWidgetOptions): PerseusScore;
|
|
36
33
|
_handleFocus: (arg1: any) => void;
|
|
37
34
|
_handleBlur: (arg1: any) => void;
|
|
38
35
|
focus: () => boolean;
|
|
@@ -60,6 +57,8 @@ declare const _default: Readonly<{
|
|
|
60
57
|
traverseChildWidgets?: any;
|
|
61
58
|
transform?: import("../../types").WidgetTransform | undefined;
|
|
62
59
|
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
60
|
+
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
61
|
+
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
63
62
|
propUpgrades?: {
|
|
64
63
|
[key: string]: (arg1: any) => any;
|
|
65
64
|
} | undefined;
|
|
@@ -19,14 +19,7 @@ declare class Video extends React.Component<Props> implements Widget {
|
|
|
19
19
|
locale: string;
|
|
20
20
|
}>;
|
|
21
21
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
22
|
-
|
|
23
|
-
* This is the widget's grading function.
|
|
24
|
-
* Points for videos are tallied by the embedded video itself, in the case
|
|
25
|
-
* of Khan Academy videos.
|
|
26
|
-
*/
|
|
27
|
-
static validate(): import("../../types").PerseusScore;
|
|
28
|
-
getUserInput: () => undefined | null | undefined;
|
|
29
|
-
simpleValidate(): import("../../types").PerseusScore;
|
|
22
|
+
isWidget: true;
|
|
30
23
|
change: (...args: ReadonlyArray<unknown>) => any;
|
|
31
24
|
render(): React.ReactNode;
|
|
32
25
|
}
|
|
@@ -46,6 +39,8 @@ declare const _default: Readonly<{
|
|
|
46
39
|
traverseChildWidgets?: any;
|
|
47
40
|
transform?: import("../../types").WidgetTransform | undefined;
|
|
48
41
|
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
42
|
+
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
43
|
+
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
49
44
|
propUpgrades?: {
|
|
50
45
|
[key: string]: (arg1: any) => any;
|
|
51
46
|
} | undefined;
|
package/dist/widgets.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PerseusWidget } from "./perseus-types";
|
|
2
2
|
import type { PerseusStrings } from "./strings";
|
|
3
|
-
import type { Alignment, Tracking, Version, WidgetExports, WidgetTransform } from "./types";
|
|
3
|
+
import type { Alignment, Tracking, Version, WidgetExports, WidgetTransform, WidgetValidatorFunction } from "./types";
|
|
4
4
|
import type * as React from "react";
|
|
5
5
|
type Editor = any;
|
|
6
6
|
export declare const registerWidget: (name: string, widget: WidgetExports) => void;
|
|
@@ -27,6 +27,8 @@ export declare const registerEditors: (editorsToRegister: ReadonlyArray<Editor>)
|
|
|
27
27
|
export declare const replaceEditor: (name: string, replacementName: string) => void;
|
|
28
28
|
export declare const replaceDeprecatedEditors: () => void;
|
|
29
29
|
export declare const getWidget: (name: string) => React.ComponentType<any> | null | undefined;
|
|
30
|
+
export declare const getWidgetExport: (name: string) => WidgetExports | null;
|
|
31
|
+
export declare const getWidgetValidator: (name: string) => WidgetValidatorFunction | null;
|
|
30
32
|
export declare const getEditor: (name: string) => Editor | null | undefined;
|
|
31
33
|
export declare const getTransform: (name: string) => WidgetTransform | null | undefined;
|
|
32
34
|
export declare const getVersion: (name: string) => Version | undefined;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Core Perseus API (includes renderers and widgets)",
|
|
4
4
|
"author": "Khan Academy",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "
|
|
6
|
+
"version": "37.0.1",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@khanacademy/kas": "^0.3.14",
|
|
44
44
|
"@khanacademy/keypad-context": "^1.0.3",
|
|
45
45
|
"@khanacademy/kmath": "^0.1.15",
|
|
46
|
-
"@khanacademy/math-input": "^21.0
|
|
46
|
+
"@khanacademy/math-input": "^21.1.0",
|
|
47
47
|
"@khanacademy/perseus-core": "1.5.2",
|
|
48
48
|
"@khanacademy/perseus-linter": "^1.2.2",
|
|
49
49
|
"@khanacademy/pure-markdown": "^0.3.10",
|