@khanacademy/perseus 65.3.7 → 65.4.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 +52 -52
- package/dist/es/index.js.map +1 -1
- package/dist/hint-renderer.d.ts +6 -0
- package/dist/hints-renderer.d.ts +6 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +51 -51
- package/dist/index.js.map +1 -1
- package/dist/mixins/changeable.d.ts +14 -0
- package/dist/mixins/widget-prop-denylist.d.ts +5 -0
- package/dist/renderer.d.ts +23 -11
- package/dist/server-item-renderer.d.ts +10 -0
- package/dist/types.d.ts +47 -13
- package/dist/widget-ai-utils/number-line/number-line-ai-utils.d.ts +1 -1
- package/dist/widget-type-utils.d.ts +1 -1
- package/dist/widgets/categorizer/categorizer.d.ts +28 -10
- package/dist/widgets/cs-program/cs-program.d.ts +9 -5
- package/dist/widgets/definition/definition.d.ts +0 -1
- package/dist/widgets/dropdown/dropdown.d.ts +22 -9
- package/dist/widgets/explanation/explanation.d.ts +0 -1
- package/dist/widgets/expression/expression.d.ts +107 -11
- package/dist/widgets/free-response/free-response.d.ts +9 -7
- package/dist/widgets/graded-group-set/graded-group-set.d.ts +1 -3
- package/dist/widgets/grapher/grapher.d.ts +139 -14
- package/dist/widgets/grapher/util.d.ts +2 -2
- package/dist/widgets/group/group.d.ts +6 -0
- package/dist/widgets/iframe/iframe.d.ts +10 -8
- package/dist/widgets/image/image.d.ts +1 -2
- package/dist/widgets/input-number/input-number.d.ts +17 -6
- package/dist/widgets/interaction/interaction.d.ts +0 -2
- package/dist/widgets/interactive-graph.d.ts +101 -4
- package/dist/widgets/interactive-graphs/stateful-mafs-graph.d.ts +1 -1
- package/dist/widgets/interactive-graphs/types.d.ts +2 -2
- package/dist/widgets/label-image/label-image.d.ts +28 -8
- package/dist/widgets/matcher/matcher.d.ts +19 -7
- package/dist/widgets/matrix/matrix.d.ts +30 -18
- package/dist/widgets/mock-widgets/mock-widget.d.ts +89 -8
- package/dist/widgets/number-line/number-line.d.ts +108 -13
- package/dist/widgets/numeric-input/numeric-input.class.d.ts +93 -4
- package/dist/widgets/numeric-input/numeric-input.d.ts +1 -2
- package/dist/widgets/orderer/orderer.d.ts +15 -8
- package/dist/widgets/passage-ref/passage-ref.d.ts +1 -2
- package/dist/widgets/passage-ref-target/passage-ref-target.d.ts +1 -3
- package/dist/widgets/phet-simulation/phet-simulation.d.ts +1 -2
- package/dist/widgets/plotter/plotter.d.ts +105 -6
- package/dist/widgets/radio/radio-component.d.ts +1 -1
- package/dist/widgets/radio/radio.class.new.d.ts +1 -1
- package/dist/widgets/radio/radio.d.ts +4 -0
- package/dist/widgets/radio/radio.ff.d.ts +2 -2
- package/dist/widgets/radio/radio.new.d.ts +2 -2
- package/dist/widgets/sorter/sorter.d.ts +26 -9
- package/dist/widgets/table/table.d.ts +88 -5
- package/dist/widgets/video/video.d.ts +0 -1
- package/package.json +7 -7
|
@@ -2,36 +2,53 @@ import * as React from "react";
|
|
|
2
2
|
import type { SortableOption } from "../../components/sortable";
|
|
3
3
|
import type { Widget, WidgetProps } from "../../types";
|
|
4
4
|
import type { SorterPromptJSON } from "../../widget-ai-utils/sorter/sorter-ai-utils";
|
|
5
|
-
import type { PerseusSorterWidgetOptions, PerseusSorterUserInput } from "@khanacademy/perseus-core";
|
|
6
|
-
type
|
|
7
|
-
type Props = WidgetProps<RenderProps>;
|
|
5
|
+
import type { PerseusSorterWidgetOptions, PerseusSorterUserInput, SorterPublicWidgetOptions } from "@khanacademy/perseus-core";
|
|
6
|
+
type Props = WidgetProps<PerseusSorterWidgetOptions, PerseusSorterUserInput>;
|
|
8
7
|
type DefaultProps = {
|
|
9
8
|
correct: Props["correct"];
|
|
10
9
|
layout: Props["layout"];
|
|
11
10
|
padding: Props["padding"];
|
|
12
11
|
problemNum: Props["problemNum"];
|
|
13
|
-
onChange: Props["onChange"];
|
|
14
12
|
linterContext: Props["linterContext"];
|
|
15
13
|
};
|
|
16
|
-
|
|
17
|
-
changed: boolean;
|
|
18
|
-
};
|
|
19
|
-
declare class Sorter extends React.Component<Props, State> implements Widget {
|
|
14
|
+
declare class Sorter extends React.Component<Props> implements Widget {
|
|
20
15
|
_isMounted: boolean;
|
|
21
16
|
static defaultProps: DefaultProps;
|
|
22
|
-
state: State;
|
|
23
17
|
componentDidMount(): void;
|
|
24
18
|
componentWillUnmount(): void;
|
|
25
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
|
+
*/
|
|
26
24
|
getUserInput(): PerseusSorterUserInput;
|
|
25
|
+
/**
|
|
26
|
+
* This is kind of a problem. Sortable maintains an internal state
|
|
27
|
+
* but we also want the user input state to include the same state.
|
|
28
|
+
* This is to help keep the two in sync for now.
|
|
29
|
+
*/
|
|
30
|
+
_getOptionsFromSortable(): string[];
|
|
27
31
|
getPromptJSON(): SorterPromptJSON;
|
|
28
32
|
moveOptionToIndex: (option: SortableOption, index: number) => void;
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated and likely very broken API
|
|
35
|
+
* [LEMS-3185] do not trust serializedState/restoreSerializedState
|
|
36
|
+
*/
|
|
37
|
+
getSerializedState(): any;
|
|
29
38
|
render(): React.ReactNode;
|
|
30
39
|
}
|
|
40
|
+
declare function getStartUserInput(options: SorterPublicWidgetOptions, problemNum: number): PerseusSorterUserInput;
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated and likely a very broken API
|
|
43
|
+
* [LEMS-3185] do not trust serializedState/restoreSerializedState
|
|
44
|
+
*/
|
|
45
|
+
declare function getUserInputFromSerializedState(serializedState: any): PerseusSorterUserInput;
|
|
31
46
|
declare const _default: {
|
|
32
47
|
name: string;
|
|
33
48
|
displayName: string;
|
|
34
49
|
widget: typeof Sorter;
|
|
35
50
|
isLintable: true;
|
|
51
|
+
getStartUserInput: typeof getStartUserInput;
|
|
52
|
+
getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
|
|
36
53
|
};
|
|
37
54
|
export default _default;
|
|
@@ -8,15 +8,14 @@ type EditorProps = {
|
|
|
8
8
|
editableHeaders: boolean;
|
|
9
9
|
Editor: any;
|
|
10
10
|
};
|
|
11
|
-
type RenderProps = PerseusTableWidgetOptions
|
|
12
|
-
type Props = WidgetProps<
|
|
11
|
+
type RenderProps = Omit<PerseusTableWidgetOptions, "answers">;
|
|
12
|
+
type Props = WidgetProps<RenderProps, PerseusTableUserInput> & ChangeableProps & EditorProps;
|
|
13
13
|
type DefaultProps = {
|
|
14
14
|
apiOptions: Props["apiOptions"];
|
|
15
15
|
headers: Props["headers"];
|
|
16
16
|
editableHeaders: Props["editableHeaders"];
|
|
17
17
|
rows: Props["rows"];
|
|
18
18
|
columns: Props["columns"];
|
|
19
|
-
answers: Props["answers"];
|
|
20
19
|
linterContext: Props["linterContext"];
|
|
21
20
|
};
|
|
22
21
|
declare class Table extends React.Component<Props> implements Widget {
|
|
@@ -39,15 +38,99 @@ declare class Table extends React.Component<Props> implements Widget {
|
|
|
39
38
|
getDOMNodeForPath(path: FocusPath): ReturnType<typeof ReactDOM.findDOMNode>;
|
|
40
39
|
getInputPaths(): string[][];
|
|
41
40
|
setInputValue(path: FocusPath, newValue: string, cb: any): void;
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated and likely very broken API
|
|
43
|
+
* [LEMS-3185] do not trust serializedState/restoreSerializedState
|
|
44
|
+
*/
|
|
45
|
+
getSerializedState(): {
|
|
46
|
+
answers: PerseusTableUserInput;
|
|
47
|
+
columns: number;
|
|
48
|
+
rows: number;
|
|
49
|
+
headers: string[];
|
|
50
|
+
reviewModeRubric?: Empty | null | undefined;
|
|
51
|
+
trackInteraction: (extraData?: Empty | undefined) => void;
|
|
52
|
+
widgetId: string;
|
|
53
|
+
alignment: string | null | undefined;
|
|
54
|
+
static: boolean | null | undefined;
|
|
55
|
+
problemNum: number | null | undefined;
|
|
56
|
+
apiOptions: Readonly<Readonly<{
|
|
57
|
+
isArticle?: boolean;
|
|
58
|
+
onFocusChange?: (newFocusPath: FocusPath, oldFocusPath: FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
|
|
59
|
+
GroupMetadataEditor?: React.ComponentType<any>;
|
|
60
|
+
showAlignmentOptions?: boolean;
|
|
61
|
+
readOnly?: boolean;
|
|
62
|
+
answerableCallback?: (arg1: boolean) => unknown;
|
|
63
|
+
getAnotherHint?: () => unknown;
|
|
64
|
+
interactionCallback?: (widgetData: {
|
|
65
|
+
[widgetId: string]: any;
|
|
66
|
+
}) => void;
|
|
67
|
+
groupAnnotator?: (groupNumber: number, widgetId: string) => React.ReactNode;
|
|
68
|
+
imagePlaceholder?: React.ReactNode;
|
|
69
|
+
widgetPlaceholder?: React.ReactNode;
|
|
70
|
+
baseElements?: {
|
|
71
|
+
Link: React.ComponentType<any>;
|
|
72
|
+
};
|
|
73
|
+
imagePreloader?: (dimensions: import("../../types").Dimensions) => React.ReactNode;
|
|
74
|
+
trackInteraction?: (args: {
|
|
75
|
+
type: string;
|
|
76
|
+
id: string;
|
|
77
|
+
correct?: boolean;
|
|
78
|
+
} & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
|
|
79
|
+
visible: number;
|
|
80
|
+
}>) => void;
|
|
81
|
+
customKeypad?: boolean;
|
|
82
|
+
nativeKeypadProxy?: (blur: () => void) => import("@khanacademy/math-input").KeypadAPI;
|
|
83
|
+
isMobile?: boolean;
|
|
84
|
+
isMobileApp?: boolean;
|
|
85
|
+
setDrawingAreaAvailable?: (arg1: boolean) => unknown;
|
|
86
|
+
hintProgressColor?: string;
|
|
87
|
+
canScrollPage?: boolean;
|
|
88
|
+
editorChangeDelay?: number;
|
|
89
|
+
flags?: Record<"new-radio-widget", boolean>;
|
|
90
|
+
onWidgetStartProps?: (widgets: import("@khanacademy/perseus-core").PerseusWidgetsMap) => void;
|
|
91
|
+
}> & {
|
|
92
|
+
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
93
|
+
canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
|
|
94
|
+
editorChangeDelay: NonNullable<import("../..").APIOptions["editorChangeDelay"]>;
|
|
95
|
+
groupAnnotator: NonNullable<import("../..").APIOptions["groupAnnotator"]>;
|
|
96
|
+
isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
|
|
97
|
+
isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
|
|
98
|
+
isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
|
|
99
|
+
onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
|
|
100
|
+
readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
|
|
101
|
+
setDrawingAreaAvailable: NonNullable<import("../..").APIOptions["setDrawingAreaAvailable"]>;
|
|
102
|
+
showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
|
|
103
|
+
}>;
|
|
104
|
+
keypadElement?: any;
|
|
105
|
+
questionCompleted?: boolean;
|
|
106
|
+
onFocus: (blurPath: FocusPath) => void;
|
|
107
|
+
onBlur: (blurPath: FocusPath) => void;
|
|
108
|
+
findWidgets: (criterion: import("../../types").FilterCriterion) => ReadonlyArray<Widget>;
|
|
109
|
+
reviewMode: boolean;
|
|
110
|
+
showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
|
|
111
|
+
onChange: import("../..").ChangeHandler & ((values: {
|
|
112
|
+
[key: string]: any;
|
|
113
|
+
}, callback?: (() => unknown) | null | undefined, silent?: boolean) => unknown);
|
|
114
|
+
handleUserInput: (newUserInput: PerseusTableUserInput, cb?: () => void, silent?: boolean) => void;
|
|
115
|
+
isLastUsedWidget: boolean;
|
|
116
|
+
linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
|
|
117
|
+
containerSizeClass: import("../../util/sizing-utils").SizeClass;
|
|
118
|
+
Editor: any;
|
|
119
|
+
};
|
|
42
120
|
render(): React.ReactNode;
|
|
43
121
|
}
|
|
44
|
-
declare function
|
|
122
|
+
declare function getStartUserInput(options: PerseusTableWidgetOptions): PerseusTableUserInput;
|
|
123
|
+
/**
|
|
124
|
+
* @deprecated - do not use in new code.
|
|
125
|
+
*/
|
|
126
|
+
declare function getUserInputFromSerializedState(serializedState: any): PerseusTableUserInput;
|
|
45
127
|
declare const _default: {
|
|
46
128
|
name: string;
|
|
47
129
|
displayName: string;
|
|
48
130
|
widget: typeof Table;
|
|
49
|
-
transform: typeof propTransform;
|
|
50
131
|
hidden: true;
|
|
51
132
|
isLintable: true;
|
|
133
|
+
getStartUserInput: typeof getStartUserInput;
|
|
134
|
+
getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
|
|
52
135
|
};
|
|
53
136
|
export default _default;
|
|
@@ -17,7 +17,6 @@ declare class Video extends React.Component<Props> implements Widget {
|
|
|
17
17
|
static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
|
|
18
18
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
19
19
|
isWidget: true;
|
|
20
|
-
change: (...args: ReadonlyArray<unknown>) => any;
|
|
21
20
|
getPromptJSON(): UnsupportedWidgetPromptJSON;
|
|
22
21
|
render(): React.ReactNode;
|
|
23
22
|
}
|
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": "65.
|
|
6
|
+
"version": "65.4.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": "16.1.
|
|
49
|
-
"@khanacademy/perseus-linter": "4.0.
|
|
50
|
-
"@khanacademy/perseus-score": "7.1.
|
|
45
|
+
"@khanacademy/keypad-context": "3.0.23",
|
|
46
|
+
"@khanacademy/kmath": "2.0.23",
|
|
47
|
+
"@khanacademy/math-input": "26.0.12",
|
|
48
|
+
"@khanacademy/perseus-core": "16.1.1",
|
|
49
|
+
"@khanacademy/perseus-linter": "4.0.10",
|
|
50
|
+
"@khanacademy/perseus-score": "7.1.10",
|
|
51
51
|
"@khanacademy/perseus-utils": "2.0.5",
|
|
52
52
|
"@khanacademy/pure-markdown": "2.0.9",
|
|
53
53
|
"@khanacademy/simple-markdown": "2.0.9"
|