@khanacademy/perseus 65.8.0 → 66.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/article-renderer.d.ts +2 -2
- package/dist/es/index.js +52 -50
- package/dist/es/index.js.map +1 -1
- package/dist/hint-renderer.d.ts +2 -0
- package/dist/index.js +51 -49
- package/dist/index.js.map +1 -1
- package/dist/renderer.d.ts +17 -6
- package/dist/server-item-renderer.d.ts +1 -1
- package/dist/types.d.ts +5 -20
- package/dist/user-input-manager.d.ts +45 -0
- package/dist/widget-ai-utils/categorizer/categorizer-ai-utils.d.ts +1 -2
- package/dist/widget-ai-utils/dropdown/dropdown-ai-utils.d.ts +1 -2
- package/dist/widget-ai-utils/grapher/grapher-ai-utils.d.ts +2 -2
- package/dist/widget-ai-utils/input-number/input-number-ai-utils.d.ts +1 -2
- package/dist/widget-ai-utils/label-image/label-image-ai-utils.d.ts +1 -2
- package/dist/widget-ai-utils/matcher/matcher-ai-utils.d.ts +2 -2
- package/dist/widget-ai-utils/matrix/matrix-ai-utils.d.ts +1 -2
- package/dist/widget-ai-utils/mock-widget/prompt-utils.d.ts +1 -2
- package/dist/widget-ai-utils/number-line/number-line-ai-utils.d.ts +1 -2
- package/dist/widget-ai-utils/numeric-input/prompt-utils.d.ts +1 -2
- package/dist/widget-ai-utils/orderer/orderer-ai-utils.d.ts +1 -2
- package/dist/widgets/categorizer/categorizer.d.ts +2 -5
- package/dist/widgets/cs-program/cs-program.d.ts +2 -1
- package/dist/widgets/dropdown/dropdown.d.ts +2 -5
- package/dist/widgets/expression/expression.d.ts +9 -16
- package/dist/widgets/free-response/free-response.d.ts +1 -5
- package/dist/widgets/graded-group/graded-group.d.ts +2 -3
- package/dist/widgets/graded-group-set/graded-group-set.d.ts +0 -1
- package/dist/widgets/grapher/grapher.d.ts +1 -2
- package/dist/widgets/group/group.d.ts +6 -8
- package/dist/widgets/iframe/iframe.d.ts +2 -1
- package/dist/widgets/input-number/input-number.d.ts +2 -6
- package/dist/widgets/interactive-graph.d.ts +3 -1
- package/dist/widgets/interactive-graphs/backgrounds/axis-labels.d.ts +3 -1
- package/dist/widgets/interactive-graphs/backgrounds/utils.d.ts +1 -0
- package/dist/widgets/interactive-graphs/utils.d.ts +4 -0
- package/dist/widgets/label-image/label-image.d.ts +0 -5
- package/dist/widgets/matcher/matcher.d.ts +1 -6
- package/dist/widgets/matrix/matrix.d.ts +2 -6
- package/dist/widgets/mock-widgets/mock-widget.d.ts +8 -10
- package/dist/widgets/number-line/number-line.d.ts +0 -6
- package/dist/widgets/numeric-input/numeric-input.class.d.ts +6 -18
- package/dist/widgets/orderer/orderer.d.ts +3 -3
- package/dist/widgets/plotter/plotter.d.ts +2 -1
- package/dist/widgets/radio/multiple-choice-widget.new.d.ts +0 -12
- package/dist/widgets/radio/radio-component.d.ts +0 -5
- package/dist/widgets/radio/radio.d.ts +3 -2
- package/dist/widgets/sorter/sorter.d.ts +0 -5
- package/dist/widgets/table/table.d.ts +0 -2
- package/package.json +7 -7
|
@@ -25,12 +25,6 @@ declare class InputNumber extends React.Component<Props> implements Widget {
|
|
|
25
25
|
focusInputPath: (arg1: Path) => void;
|
|
26
26
|
blurInputPath: (arg1: Path) => void;
|
|
27
27
|
getInputPaths: () => ReadonlyArray<Path>;
|
|
28
|
-
setInputValue: (arg1: Path, arg2: string, arg3: () => void) => void;
|
|
29
|
-
/**
|
|
30
|
-
* TODO: remove this when everything is pulling from Renderer state
|
|
31
|
-
* @deprecated get user input from Renderer state
|
|
32
|
-
*/
|
|
33
|
-
getUserInput(): PerseusInputNumberUserInput;
|
|
34
28
|
getPromptJSON(): InputNumberPromptJSON;
|
|
35
29
|
examples(): ReadonlyArray<string>;
|
|
36
30
|
/**
|
|
@@ -47,6 +41,7 @@ declare function getOneCorrectAnswerFromRubric(rubric: any): string | undefined;
|
|
|
47
41
|
* [LEMS-3185] do not trust serializedState/restoreSerializedState
|
|
48
42
|
*/
|
|
49
43
|
declare function getUserInputFromSerializedState(serializedState: any): PerseusInputNumberUserInput;
|
|
44
|
+
declare function getStartUserInput(): PerseusInputNumberUserInput;
|
|
50
45
|
declare const _default: {
|
|
51
46
|
name: string;
|
|
52
47
|
displayName: string;
|
|
@@ -55,6 +50,7 @@ declare const _default: {
|
|
|
55
50
|
isLintable: true;
|
|
56
51
|
transform: typeof transform;
|
|
57
52
|
getOneCorrectAnswerFromRubric: typeof getOneCorrectAnswerFromRubric;
|
|
53
|
+
getStartUserInput: typeof getStartUserInput;
|
|
58
54
|
getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
|
|
59
55
|
};
|
|
60
56
|
export default _default;
|
|
@@ -6,7 +6,7 @@ import type { WidgetProps } from "../types";
|
|
|
6
6
|
import type { InteractiveGraphPromptJSON } from "../widget-ai-utils/interactive-graph/interactive-graph-ai-utils";
|
|
7
7
|
import type { UnsupportedWidgetPromptJSON } from "../widget-ai-utils/unsupported-widget";
|
|
8
8
|
import type { QuadraticCoefficient, SineCoefficient, Range } from "@khanacademy/kmath";
|
|
9
|
-
import type { PerseusGraphType, PerseusGraphTypeAngle, PerseusGraphTypePoint, PerseusGraphTypeSegment, GraphRange, InteractiveGraphPublicWidgetOptions, LockedFigure, PerseusImageBackground, MarkingsType, PerseusInteractiveGraphUserInput, AxisLabelLocation } from "@khanacademy/perseus-core";
|
|
9
|
+
import type { PerseusGraphType, PerseusGraphTypeAngle, PerseusGraphTypePoint, PerseusGraphTypeSegment, PerseusInteractiveGraphWidgetOptions, GraphRange, InteractiveGraphPublicWidgetOptions, LockedFigure, PerseusImageBackground, MarkingsType, PerseusInteractiveGraphUserInput, AxisLabelLocation } from "@khanacademy/perseus-core";
|
|
10
10
|
type RenderProps = {
|
|
11
11
|
/**
|
|
12
12
|
* Where the little black axis lines & labels (ticks) should render.
|
|
@@ -270,12 +270,14 @@ declare class InteractiveGraph extends React.Component<Props, State> {
|
|
|
270
270
|
*/
|
|
271
271
|
declare function getUserInputFromSerializedState(serializedState: any): PerseusInteractiveGraphUserInput;
|
|
272
272
|
declare function getStartUserInput(options: InteractiveGraphPublicWidgetOptions): PerseusGraphType;
|
|
273
|
+
declare function getCorrectUserInput(options: PerseusInteractiveGraphWidgetOptions): PerseusInteractiveGraphUserInput;
|
|
273
274
|
declare const _default: {
|
|
274
275
|
name: string;
|
|
275
276
|
displayName: string;
|
|
276
277
|
widget: typeof InteractiveGraph;
|
|
277
278
|
staticTransform: <T>(value: T) => T;
|
|
278
279
|
getStartUserInput: typeof getStartUserInput;
|
|
280
|
+
getCorrectUserInput: typeof getCorrectUserInput;
|
|
279
281
|
getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
|
|
280
282
|
};
|
|
281
283
|
export default _default;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { I18nContextType } from "../../../components/i18n-context";
|
|
3
|
-
export default function AxisLabels({ i18n }: {
|
|
3
|
+
export default function AxisLabels({ i18n, xAxisLabelLocation, yAxisLabelLocation, }: {
|
|
4
4
|
i18n: I18nContextType;
|
|
5
|
+
xAxisLabelLocation: [number, number];
|
|
6
|
+
yAxisLabelLocation: [number, number];
|
|
5
7
|
}): React.JSX.Element;
|
|
@@ -3,6 +3,7 @@ import type { GraphConfig } from "../reducer/use-graph-config";
|
|
|
3
3
|
import type { GraphDimensions } from "../types";
|
|
4
4
|
import type { Interval } from "mafs";
|
|
5
5
|
export declare const fontSize = 14;
|
|
6
|
+
export declare const fontSizeYAxisLabelMultiplier = 1.25;
|
|
6
7
|
export declare const clampLabelPosition: (labelPosition: vec.Vector2, graphInfo: GraphDimensions) => vec.Vector2;
|
|
7
8
|
export declare const getLabelTransform: (labelLocation: GraphConfig["labelLocation"]) => {
|
|
8
9
|
xLabelTransform: string;
|
|
@@ -16,6 +16,10 @@ export declare function bound({ snapStep, range, point, }: {
|
|
|
16
16
|
range: [Interval, Interval];
|
|
17
17
|
point: vec.Vector2;
|
|
18
18
|
}): vec.Vector2;
|
|
19
|
+
export declare function boundToEdge({ range, point, }: {
|
|
20
|
+
range: [Interval, Interval];
|
|
21
|
+
point: vec.Vector2;
|
|
22
|
+
}): vec.Vector2;
|
|
19
23
|
export declare function isUnlimitedGraphState(state: InteractiveGraphState): state is UnlimitedGraphState;
|
|
20
24
|
/**
|
|
21
25
|
* Parse a string of text and math into a list of objects with type and content
|
|
@@ -85,11 +85,6 @@ export declare class LabelImage extends React.Component<Props, LabelImageState>
|
|
|
85
85
|
constructor(props: Props);
|
|
86
86
|
componentDidMount(): void;
|
|
87
87
|
componentWillUnmount(): void;
|
|
88
|
-
/**
|
|
89
|
-
* TODO: remove this when everything is pulling from Renderer state
|
|
90
|
-
* @deprecated get user input from Renderer state
|
|
91
|
-
*/
|
|
92
|
-
getUserInput(): PerseusLabelImageUserInput;
|
|
93
88
|
getPromptJSON(): LabelImagePromptJSON;
|
|
94
89
|
handleMarkerChange(index: number, marker: PerseusLabelImageUserInput["markers"][number]): void;
|
|
95
90
|
activateMarker(index: number, opened: boolean): void;
|
|
@@ -4,7 +4,7 @@ import type { SortableOption } from "../../components/sortable";
|
|
|
4
4
|
import type { WidgetProps, Widget } from "../../types";
|
|
5
5
|
import type { MatcherPromptJSON } from "../../widget-ai-utils/matcher/matcher-ai-utils";
|
|
6
6
|
import type { PerseusMatcherWidgetOptions, PerseusMatcherUserInput, MatcherPublicWidgetOptions } from "@khanacademy/perseus-core";
|
|
7
|
-
type RenderProps = Pick<PerseusMatcherWidgetOptions, "labels" | "orderMatters" | "padding">;
|
|
7
|
+
type RenderProps = Pick<PerseusMatcherWidgetOptions, "labels" | "orderMatters" | "padding" | "left" | "right">;
|
|
8
8
|
type Props = WidgetProps<RenderProps, PerseusMatcherUserInput>;
|
|
9
9
|
type DefaultProps = {
|
|
10
10
|
labels: Props["labels"];
|
|
@@ -29,11 +29,6 @@ export declare class Matcher extends React.Component<Props, State> implements Wi
|
|
|
29
29
|
onMeasureLeft: (arg1: any) => void;
|
|
30
30
|
onMeasureRight: (arg1: any) => void;
|
|
31
31
|
_getUserInputFromSortable: () => PerseusMatcherUserInput;
|
|
32
|
-
/**
|
|
33
|
-
* TODO: remove this when everything is pulling from Renderer state
|
|
34
|
-
* @deprecated get user input from Renderer state
|
|
35
|
-
*/
|
|
36
|
-
getUserInput(): PerseusMatcherUserInput;
|
|
37
32
|
getPromptJSON(): MatcherPromptJSON;
|
|
38
33
|
moveLeftOptionToIndex: (option: SortableOption, index: number) => void;
|
|
39
34
|
moveRightOptionToIndex: (option: SortableOption, index: number) => void;
|
|
@@ -36,14 +36,8 @@ declare class Matrix extends React.Component<Props, State> implements Widget {
|
|
|
36
36
|
focusInputPath: (arg1: any) => void;
|
|
37
37
|
blurInputPath: (arg1: any) => void;
|
|
38
38
|
getDOMNodeForPath(path: FocusPath): Element | Text | null;
|
|
39
|
-
setInputValue: (arg1: any, arg2: any, arg3: any) => void;
|
|
40
39
|
handleKeyDown: (arg1: any, arg2: any, arg3: any) => void;
|
|
41
40
|
onValueChange: (arg1: any, arg2: any, arg3: any, arg4: any) => void;
|
|
42
|
-
/**
|
|
43
|
-
* TODO: remove this when everything is pulling from Renderer state
|
|
44
|
-
* @deprecated get user input from Renderer state
|
|
45
|
-
*/
|
|
46
|
-
getUserInput(): PerseusMatrixUserInput;
|
|
47
41
|
getPromptJSON(): MatrixPromptJSON;
|
|
48
42
|
/**
|
|
49
43
|
* @deprecated and likely very broken API
|
|
@@ -59,6 +53,7 @@ declare class Matrix extends React.Component<Props, State> implements Widget {
|
|
|
59
53
|
* @deprecated [LEMS-3199]
|
|
60
54
|
*/
|
|
61
55
|
declare function transform(widgetOptions: MatrixPublicWidgetOptions): RenderProps;
|
|
56
|
+
declare function getStartUserInput(): PerseusMatrixUserInput;
|
|
62
57
|
declare function getCorrectUserInput(options: PerseusMatrixWidgetOptions): PerseusMatrixUserInput;
|
|
63
58
|
/**
|
|
64
59
|
* @deprecated and likely a very broken API
|
|
@@ -73,6 +68,7 @@ declare const _default: {
|
|
|
73
68
|
transform: typeof transform;
|
|
74
69
|
staticTransform: typeof transform;
|
|
75
70
|
isLintable: true;
|
|
71
|
+
getStartUserInput: typeof getStartUserInput;
|
|
76
72
|
getCorrectUserInput: typeof getCorrectUserInput;
|
|
77
73
|
getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
|
|
78
74
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { MockWidgetOptions } from "./mock-widget-types";
|
|
3
|
-
import type { WidgetProps, Widget
|
|
3
|
+
import type { WidgetProps, Widget } from "../../types";
|
|
4
4
|
import type { MockWidgetPromptJSON } from "../../widget-ai-utils/mock-widget/prompt-utils";
|
|
5
5
|
import type { PerseusMockWidgetUserInput } from "@khanacademy/perseus-score";
|
|
6
6
|
type ExternalProps = WidgetProps<MockWidgetOptions, PerseusMockWidgetUserInput>;
|
|
@@ -24,16 +24,10 @@ declare class MockWidgetComponent extends React.Component<Props> implements Widg
|
|
|
24
24
|
static defaultProps: DefaultProps;
|
|
25
25
|
inputRef: HTMLElement | null;
|
|
26
26
|
getPromptJSON(): MockWidgetPromptJSON;
|
|
27
|
-
setInputValue: (path: FocusPath, newValue: string, cb?: () => unknown | null | undefined) => void;
|
|
28
27
|
focus: () => boolean;
|
|
29
28
|
focusInputPath: () => void;
|
|
30
29
|
blurInputPath: () => void;
|
|
31
30
|
getInputPaths: () => ReadonlyArray<ReadonlyArray<string>>;
|
|
32
|
-
/**
|
|
33
|
-
* TODO: remove this when everything is pulling from Renderer state
|
|
34
|
-
* @deprecated get user input from Renderer state
|
|
35
|
-
*/
|
|
36
|
-
getUserInput(): PerseusMockWidgetUserInput;
|
|
37
31
|
handleChange: (newValue: string, cb?: () => unknown | null | undefined) => void;
|
|
38
32
|
/**
|
|
39
33
|
* @deprecated and likely very broken API
|
|
@@ -50,7 +44,7 @@ declare class MockWidgetComponent extends React.Component<Props> implements Widg
|
|
|
50
44
|
problemNum: number | null | undefined;
|
|
51
45
|
apiOptions: Readonly<Readonly<{
|
|
52
46
|
isArticle?: boolean;
|
|
53
|
-
onFocusChange?: (newFocusPath: FocusPath, oldFocusPath: FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
|
|
47
|
+
onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
|
|
54
48
|
GroupMetadataEditor?: React.ComponentType<any>;
|
|
55
49
|
showAlignmentOptions?: boolean;
|
|
56
50
|
readOnly?: boolean;
|
|
@@ -98,8 +92,8 @@ declare class MockWidgetComponent extends React.Component<Props> implements Widg
|
|
|
98
92
|
}>;
|
|
99
93
|
keypadElement?: any;
|
|
100
94
|
questionCompleted?: boolean;
|
|
101
|
-
onFocus: (blurPath: FocusPath) => void;
|
|
102
|
-
onBlur: (blurPath: FocusPath) => void;
|
|
95
|
+
onFocus: (blurPath: import("../..").FocusPath) => void;
|
|
96
|
+
onBlur: (blurPath: import("../..").FocusPath) => void;
|
|
103
97
|
findWidgets: (criterion: import("../../types").FilterCriterion) => ReadonlyArray<Widget>;
|
|
104
98
|
reviewMode: boolean;
|
|
105
99
|
showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
|
|
@@ -116,11 +110,15 @@ declare class MockWidgetComponent extends React.Component<Props> implements Widg
|
|
|
116
110
|
* [LEMS-3185] do not trust serializedState/restoreSerializedState
|
|
117
111
|
*/
|
|
118
112
|
declare function getUserInputFromSerializedState(serializedState: any): PerseusMockWidgetUserInput;
|
|
113
|
+
declare function getStartUserInput(options: PerseusMockWidgetUserInput): {
|
|
114
|
+
currentValue: string;
|
|
115
|
+
};
|
|
119
116
|
declare const _default: {
|
|
120
117
|
name: string;
|
|
121
118
|
displayName: string;
|
|
122
119
|
widget: typeof MockWidgetComponent;
|
|
123
120
|
isLintable: true;
|
|
121
|
+
getStartUserInput: typeof getStartUserInput;
|
|
124
122
|
getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
|
|
125
123
|
};
|
|
126
124
|
export default _default;
|
|
@@ -54,7 +54,6 @@ declare class NumberLine extends React.Component<Props, State> implements Widget
|
|
|
54
54
|
blurInputPath: (arg1: any) => void;
|
|
55
55
|
getInputPaths: () => ReadonlyArray<ReadonlyArray<string>>;
|
|
56
56
|
getDOMNodeForPath(inputPath: FocusPath): Element | Text | null;
|
|
57
|
-
setInputValue: (arg1: any, arg2: any, arg3: any) => void;
|
|
58
57
|
_renderGraphie: () => React.ReactElement;
|
|
59
58
|
snapNumLinePosition: (arg1: any, arg2: number) => number;
|
|
60
59
|
movePosition: (arg1: number) => void;
|
|
@@ -64,11 +63,6 @@ declare class NumberLine extends React.Component<Props, State> implements Widget
|
|
|
64
63
|
_getInequalityEndpoint(props: CalculatedProps): [number, number];
|
|
65
64
|
_renderInequality(props: CalculatedProps): React.ReactElement | null;
|
|
66
65
|
_setupGraphie: (arg1: any, arg2: any) => void;
|
|
67
|
-
/**
|
|
68
|
-
* TODO: remove this when everything is pulling from Renderer state
|
|
69
|
-
* @deprecated get user input from Renderer state
|
|
70
|
-
*/
|
|
71
|
-
getUserInput(): PerseusNumberLineUserInput;
|
|
72
66
|
getPromptJSON(): NumberLinePromptJSON;
|
|
73
67
|
/**
|
|
74
68
|
* @deprecated and likely very broken API
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { Focusable, Widget, WidgetProps } from "../../types";
|
|
3
3
|
import type { NumericInputPromptJSON } from "../../widget-ai-utils/numeric-input/prompt-utils";
|
|
4
4
|
import type { PerseusNumericInputWidgetOptions, PerseusNumericInputAnswerForm, PerseusNumericInputRubric, PerseusNumericInputUserInput } from "@khanacademy/perseus-core";
|
|
5
5
|
type ExternalProps = WidgetProps<PerseusNumericInputWidgetOptions, PerseusNumericInputUserInput>;
|
|
@@ -36,20 +36,6 @@ export declare class NumericInput extends React.Component<NumericInputProps> imp
|
|
|
36
36
|
focusInputPath: () => void;
|
|
37
37
|
blurInputPath: () => void;
|
|
38
38
|
getInputPaths: () => ReadonlyArray<ReadonlyArray<string>>;
|
|
39
|
-
/**
|
|
40
|
-
* Sets the value of the input at the given path.
|
|
41
|
-
*
|
|
42
|
-
* TODO: remove this when everything is pulling from Renderer state
|
|
43
|
-
* @deprecated set user input in Renderer state
|
|
44
|
-
*/
|
|
45
|
-
setInputValue: (path: FocusPath, newValue: string, cb?: () => unknown | null | undefined) => void;
|
|
46
|
-
/**
|
|
47
|
-
* Returns the value the user has currently input for this widget.
|
|
48
|
-
*
|
|
49
|
-
* TODO: remove this when everything is pulling from Renderer state
|
|
50
|
-
* @deprecated get user input from Renderer state
|
|
51
|
-
*/
|
|
52
|
-
getUserInput(): PerseusNumericInputUserInput;
|
|
53
39
|
/**
|
|
54
40
|
* Returns the JSON representation of the prompt for this widget.
|
|
55
41
|
* This is used by the AI to determine the prompt for the widget.
|
|
@@ -74,7 +60,7 @@ export declare class NumericInput extends React.Component<NumericInputProps> imp
|
|
|
74
60
|
problemNum: number | null | undefined;
|
|
75
61
|
apiOptions: Readonly<Readonly<{
|
|
76
62
|
isArticle?: boolean;
|
|
77
|
-
onFocusChange?: (newFocusPath: FocusPath, oldFocusPath: FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
|
|
63
|
+
onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
|
|
78
64
|
GroupMetadataEditor?: React.ComponentType<any>;
|
|
79
65
|
showAlignmentOptions?: boolean;
|
|
80
66
|
readOnly?: boolean;
|
|
@@ -122,8 +108,8 @@ export declare class NumericInput extends React.Component<NumericInputProps> imp
|
|
|
122
108
|
}>;
|
|
123
109
|
keypadElement?: any;
|
|
124
110
|
questionCompleted?: boolean;
|
|
125
|
-
onFocus: (blurPath: FocusPath) => void;
|
|
126
|
-
onBlur: (blurPath: FocusPath) => void;
|
|
111
|
+
onFocus: (blurPath: import("../..").FocusPath) => void;
|
|
112
|
+
onBlur: (blurPath: import("../..").FocusPath) => void;
|
|
127
113
|
findWidgets: (criterion: import("../../types").FilterCriterion) => ReadonlyArray<Widget>;
|
|
128
114
|
reviewMode: boolean;
|
|
129
115
|
showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
|
|
@@ -136,6 +122,7 @@ export declare class NumericInput extends React.Component<NumericInputProps> imp
|
|
|
136
122
|
};
|
|
137
123
|
render(): React.ReactNode;
|
|
138
124
|
}
|
|
125
|
+
declare function getStartUserInput(): PerseusNumericInputUserInput;
|
|
139
126
|
/**
|
|
140
127
|
* @deprecated and likely a very broken API
|
|
141
128
|
* [LEMS-3185] do not trust serializedState/restoreSerializedState
|
|
@@ -148,6 +135,7 @@ declare const _default: {
|
|
|
148
135
|
transform: (widgetOptions: PerseusNumericInputWidgetOptions) => RenderProps;
|
|
149
136
|
isLintable: true;
|
|
150
137
|
getOneCorrectAnswerFromRubric(rubric: PerseusNumericInputRubric): string | null | undefined;
|
|
138
|
+
getStartUserInput: typeof getStartUserInput;
|
|
151
139
|
getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
|
|
152
140
|
};
|
|
153
141
|
export default _default;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { Widget, WidgetProps } from "../../types";
|
|
3
3
|
import type { OrdererPromptJSON } from "../../widget-ai-utils/orderer/orderer-ai-utils";
|
|
4
|
-
import type { PerseusOrdererUserInput } from "@khanacademy/perseus-core";
|
|
5
|
-
import type { OrdererPublicWidgetOptions } from "@khanacademy/perseus-core/src/widgets/orderer/orderer-util";
|
|
4
|
+
import type { PerseusOrdererUserInput, OrdererPublicWidgetOptions } from "@khanacademy/perseus-core";
|
|
6
5
|
type Position = {
|
|
7
6
|
left: number;
|
|
8
7
|
top: number;
|
|
@@ -33,7 +32,6 @@ declare class Orderer extends React.Component<OrdererProps, OrdererState> implem
|
|
|
33
32
|
findCorrectIndex: (arg1: any, arg2: any) => any;
|
|
34
33
|
isCardInBank: (arg1: any) => boolean;
|
|
35
34
|
setListValues: (values: string[]) => void;
|
|
36
|
-
getUserInput(): PerseusOrdererUserInput;
|
|
37
35
|
getPromptJSON(): OrdererPromptJSON;
|
|
38
36
|
/**
|
|
39
37
|
* @deprecated and likely very broken API
|
|
@@ -47,12 +45,14 @@ declare class Orderer extends React.Component<OrdererProps, OrdererState> implem
|
|
|
47
45
|
* [LEMS-3185] do not trust serializedState/restoreSerializedState
|
|
48
46
|
*/
|
|
49
47
|
declare function getUserInputFromSerializedState(serializedState: any): PerseusOrdererUserInput;
|
|
48
|
+
declare function getStartUserInput(): PerseusOrdererUserInput;
|
|
50
49
|
declare const _default: {
|
|
51
50
|
name: string;
|
|
52
51
|
displayName: string;
|
|
53
52
|
hidden: true;
|
|
54
53
|
widget: typeof Orderer;
|
|
55
54
|
isLintable: true;
|
|
55
|
+
getStartUserInput: typeof getStartUserInput;
|
|
56
56
|
getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
|
|
57
57
|
};
|
|
58
58
|
export default _default;
|
|
@@ -72,7 +72,6 @@ export declare class Plotter extends React.Component<Props, State> implements Wi
|
|
|
72
72
|
*/
|
|
73
73
|
_testInsertUserInput(userInput: PerseusPlotterUserInput): void;
|
|
74
74
|
drawPicHeights(values: number[], prevValues: number[]): void;
|
|
75
|
-
getUserInput(): PerseusPlotterUserInput;
|
|
76
75
|
getPromptJSON(): UnsupportedWidgetPromptJSON;
|
|
77
76
|
/**
|
|
78
77
|
* @deprecated and likely very broken API
|
|
@@ -162,6 +161,7 @@ export declare class Plotter extends React.Component<Props, State> implements Wi
|
|
|
162
161
|
render(): React.ReactNode;
|
|
163
162
|
}
|
|
164
163
|
declare function getStartUserInput(options: PlotterPublicWidgetOptions): PerseusPlotterUserInput;
|
|
164
|
+
declare function getCorrectUserInput(options: PerseusPlotterWidgetOptions): PerseusPlotterUserInput;
|
|
165
165
|
/**
|
|
166
166
|
* @deprecated and likely a very broken API
|
|
167
167
|
* [LEMS-3185] do not trust serializedState/restoreSerializedState
|
|
@@ -172,6 +172,7 @@ declare const _default: {
|
|
|
172
172
|
displayName: string;
|
|
173
173
|
hidden: true;
|
|
174
174
|
widget: typeof Plotter;
|
|
175
|
+
getCorrectUserInput: typeof getCorrectUserInput;
|
|
175
176
|
staticTransform: <T>(value: T) => T;
|
|
176
177
|
getStartUserInput: typeof getStartUserInput;
|
|
177
178
|
getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
|
|
@@ -41,18 +41,6 @@ type DefaultProps = Required<Pick<Props, "choices" | "multipleSelect" | "countCh
|
|
|
41
41
|
*/
|
|
42
42
|
declare class MultipleChoiceWidget extends React.Component<Props> implements Widget {
|
|
43
43
|
static defaultProps: DefaultProps;
|
|
44
|
-
/**
|
|
45
|
-
* DEPRECATED: Gets the current user input from this widget.
|
|
46
|
-
*
|
|
47
|
-
* Implements the required Widget interface method that Perseus uses
|
|
48
|
-
* to retrieve the user's current selections.
|
|
49
|
-
*
|
|
50
|
-
* @returns The user's selections as {choicesSelected: [boolean]}
|
|
51
|
-
*
|
|
52
|
-
* TODO: remove this when everything is pulling from Renderer state
|
|
53
|
-
* @deprecated get user input from Renderer state
|
|
54
|
-
*/
|
|
55
|
-
getUserInput(): PerseusRadioUserInput;
|
|
56
44
|
/**
|
|
57
45
|
* Gets the JSON representation of the User Input for AI assistance.
|
|
58
46
|
*
|
|
@@ -33,11 +33,6 @@ declare class Radio extends React.Component<Props> implements Widget {
|
|
|
33
33
|
updateChoices: (newValueLists: Readonly<{
|
|
34
34
|
checked: ReadonlyArray<boolean>;
|
|
35
35
|
}>) => void;
|
|
36
|
-
/**
|
|
37
|
-
* TODO: remove this when everything is pulling from Renderer state
|
|
38
|
-
* @deprecated get user input from Renderer state
|
|
39
|
-
*/
|
|
40
|
-
getUserInput(): PerseusRadioUserInput;
|
|
41
36
|
getPromptJSON(): RadioPromptJSON;
|
|
42
37
|
render(): React.ReactNode;
|
|
43
38
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import Radio from "./radio.ff";
|
|
2
|
-
import { getUserInputFromSerializedState } from "./util";
|
|
3
2
|
import type { RenderProps } from "./radio-component";
|
|
4
3
|
import type { PerseusStrings } from "../../strings";
|
|
5
4
|
import type { PerseusRadioUserInput, PerseusRadioWidgetOptions, RadioPublicWidgetOptions } from "@khanacademy/perseus-core";
|
|
6
5
|
declare function getStartUserInput(options: RadioPublicWidgetOptions): PerseusRadioUserInput;
|
|
6
|
+
declare function getCorrectUserInput(options: PerseusRadioWidgetOptions): PerseusRadioUserInput;
|
|
7
7
|
declare const _default: {
|
|
8
8
|
name: string;
|
|
9
9
|
displayName: string;
|
|
@@ -11,11 +11,12 @@ declare const _default: {
|
|
|
11
11
|
transform: (widgetOptions: PerseusRadioWidgetOptions, strings: PerseusStrings, problemNum?: number | null) => RenderProps;
|
|
12
12
|
staticTransform: (widgetOptions: PerseusRadioWidgetOptions, strings: PerseusStrings, problemNum?: number | null) => RenderProps;
|
|
13
13
|
getStartUserInput: typeof getStartUserInput;
|
|
14
|
+
getCorrectUserInput: typeof getCorrectUserInput;
|
|
14
15
|
version: import("@khanacademy/perseus-core").Version | undefined;
|
|
15
16
|
isLintable: true;
|
|
16
17
|
/**
|
|
17
18
|
* @deprecated - do not use in new code.
|
|
18
19
|
*/
|
|
19
|
-
getUserInputFromSerializedState:
|
|
20
|
+
getUserInputFromSerializedState: (serializedState: any) => PerseusRadioUserInput;
|
|
20
21
|
};
|
|
21
22
|
export default _default;
|
|
@@ -17,11 +17,6 @@ declare class Sorter extends React.Component<Props> implements Widget {
|
|
|
17
17
|
componentDidMount(): void;
|
|
18
18
|
componentWillUnmount(): void;
|
|
19
19
|
handleChange: (arg1: React.ChangeEvent<HTMLInputElement>) => void;
|
|
20
|
-
/**
|
|
21
|
-
* TODO: remove this when everything is pulling from Renderer state
|
|
22
|
-
* @deprecated get user input from Renderer state
|
|
23
|
-
*/
|
|
24
|
-
getUserInput(): PerseusSorterUserInput;
|
|
25
20
|
/**
|
|
26
21
|
* This is kind of a problem. Sortable maintains an internal state
|
|
27
22
|
* but we also want the user input state to include the same state.
|
|
@@ -27,7 +27,6 @@ declare class Table extends React.Component<Props> implements Widget {
|
|
|
27
27
|
_getRows(): number;
|
|
28
28
|
_getColumns(): number;
|
|
29
29
|
_getAnswersClone(): PerseusTableUserInput;
|
|
30
|
-
getUserInput(): PerseusTableUserInput;
|
|
31
30
|
onValueChange(row: number, column: number, eventOrValue: any): void;
|
|
32
31
|
onHeaderChange(index: number, e: any): void;
|
|
33
32
|
_handleFocus(inputPath: any): void;
|
|
@@ -37,7 +36,6 @@ declare class Table extends React.Component<Props> implements Widget {
|
|
|
37
36
|
blurInputPath(path: FocusPath): void;
|
|
38
37
|
getDOMNodeForPath(path: FocusPath): ReturnType<typeof ReactDOM.findDOMNode>;
|
|
39
38
|
getInputPaths(): string[][];
|
|
40
|
-
setInputValue(path: FocusPath, newValue: string, cb: any): void;
|
|
41
39
|
/**
|
|
42
40
|
* @deprecated and likely very broken API
|
|
43
41
|
* [LEMS-3185] do not trust serializedState/restoreSerializedState
|
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": "66.0.0",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"tiny-invariant": "1.3.1",
|
|
43
43
|
"uuid": "^10.0.0",
|
|
44
44
|
"@khanacademy/kas": "2.0.9",
|
|
45
|
-
"@khanacademy/keypad-context": "3.0.
|
|
46
|
-
"@khanacademy/kmath": "2.0.
|
|
47
|
-
"@khanacademy/math-input": "26.0.
|
|
48
|
-
"@khanacademy/perseus-core": "18.2.
|
|
49
|
-
"@khanacademy/perseus-linter": "4.1.
|
|
50
|
-
"@khanacademy/perseus-score": "7.1.
|
|
45
|
+
"@khanacademy/keypad-context": "3.0.28",
|
|
46
|
+
"@khanacademy/kmath": "2.0.28",
|
|
47
|
+
"@khanacademy/math-input": "26.0.17",
|
|
48
|
+
"@khanacademy/perseus-core": "18.2.1",
|
|
49
|
+
"@khanacademy/perseus-linter": "4.1.1",
|
|
50
|
+
"@khanacademy/perseus-score": "7.1.15",
|
|
51
51
|
"@khanacademy/perseus-utils": "2.0.5",
|
|
52
52
|
"@khanacademy/pure-markdown": "2.1.0",
|
|
53
53
|
"@khanacademy/simple-markdown": "2.0.10"
|