@khanacademy/perseus 72.2.1 → 72.3.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.css +1 -1
- package/dist/es/index.css.map +1 -1
- package/dist/es/index.js +25 -25
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +25 -25
- package/dist/index.js.map +1 -1
- package/dist/widgets/graded-group/graded-group.d.ts +4 -2
- package/dist/widgets/graded-group-set/graded-group-set.d.ts +3 -24
- package/dist/widgets/grapher/grapher.d.ts +5 -118
- package/dist/widgets/interactive-graphs/mafs-graph.d.ts +1 -0
- package/dist/widgets/interactive-graphs/stateful-mafs-graph.d.ts +1 -0
- package/dist/widgets/matrix/matrix.d.ts +4 -40
- package/dist/widgets/orderer/orderer.d.ts +4 -39
- package/dist/widgets/passage/passage.d.ts +3 -2
- package/dist/widgets/plotter/plotter.d.ts +3 -152
- package/package.json +28 -28
|
@@ -2,7 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
3
|
import Renderer from "../../renderer";
|
|
4
4
|
import type { ANSWER_BAR_STATES } from "./graded-group-answer-bar";
|
|
5
|
-
import type { FocusPath, TrackingGradedGroupExtraArguments, Widget, WidgetProps } from "../../types";
|
|
5
|
+
import type { FocusPath, PerseusDependenciesV2, TrackingGradedGroupExtraArguments, Widget, WidgetProps } from "../../types";
|
|
6
6
|
import type { GradedGroupPromptJSON } from "../../widget-ai-utils/graded-group/graded-group-ai-utils";
|
|
7
7
|
import type { PerseusGradedGroupWidgetOptions, UserInputMap } from "@khanacademy/perseus-core";
|
|
8
8
|
declare const GRADING_STATUSES: {
|
|
@@ -14,6 +14,7 @@ declare const GRADING_STATUSES: {
|
|
|
14
14
|
type Props = WidgetProps<PerseusGradedGroupWidgetOptions, Empty, TrackingGradedGroupExtraArguments> & {
|
|
15
15
|
inGradedGroupSet?: boolean;
|
|
16
16
|
onNextQuestion?: () => unknown;
|
|
17
|
+
dependencies: PerseusDependenciesV2;
|
|
17
18
|
};
|
|
18
19
|
type DefaultProps = {
|
|
19
20
|
title: Props["title"];
|
|
@@ -37,6 +38,7 @@ export declare class GradedGroup extends React.Component<Props, State> implement
|
|
|
37
38
|
state: State;
|
|
38
39
|
rendererRef: React.RefObject<Renderer>;
|
|
39
40
|
hintRendererRef: React.RefObject<Renderer>;
|
|
41
|
+
componentDidMount(): void;
|
|
40
42
|
shouldComponentUpdate(nextProps: Props, nextState: State): boolean;
|
|
41
43
|
_handleUserInput(_userInput: UserInputMap, widgetsEmpty: boolean): void;
|
|
42
44
|
_checkAnswer: () => void;
|
|
@@ -50,7 +52,7 @@ export declare class GradedGroup extends React.Component<Props, State> implement
|
|
|
50
52
|
declare const _default: {
|
|
51
53
|
name: string;
|
|
52
54
|
displayName: string;
|
|
53
|
-
widget:
|
|
55
|
+
widget: React.ForwardRefExoticComponent<Omit<Props, "dependencies"> & React.RefAttributes<any>>;
|
|
54
56
|
hidden: false;
|
|
55
57
|
tracking: "all";
|
|
56
58
|
isLintable: true;
|
|
@@ -1,35 +1,14 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import type { FocusPath, Widget, WidgetProps } from "../../types";
|
|
4
|
-
import type { GradedGroupSetPromptJSON } from "../../widget-ai-utils/graded-group-set/graded-group-set-ai-utils";
|
|
2
|
+
import type { PerseusDependenciesV2, WidgetProps } from "../../types";
|
|
5
3
|
import type { PerseusGradedGroupSetWidgetOptions } from "@khanacademy/perseus-core";
|
|
6
4
|
type Props = WidgetProps<PerseusGradedGroupSetWidgetOptions> & {
|
|
7
5
|
trackInteraction: () => void;
|
|
6
|
+
dependencies: PerseusDependenciesV2;
|
|
8
7
|
};
|
|
9
|
-
type DefaultProps = {
|
|
10
|
-
gradedGroups: Props["gradedGroups"];
|
|
11
|
-
linterContext: Props["linterContext"];
|
|
12
|
-
};
|
|
13
|
-
type State = {
|
|
14
|
-
currentGroup: number;
|
|
15
|
-
};
|
|
16
|
-
declare class GradedGroupSet extends React.Component<Props, State> implements Widget {
|
|
17
|
-
_childGroup: GradedGroup;
|
|
18
|
-
static defaultProps: DefaultProps;
|
|
19
|
-
state: State;
|
|
20
|
-
shouldComponentUpdate(nextProps: Props, nextState: State): boolean;
|
|
21
|
-
getInputPaths: () => ReadonlyArray<FocusPath>;
|
|
22
|
-
getPromptJSON(): GradedGroupSetPromptJSON;
|
|
23
|
-
focus: () => boolean;
|
|
24
|
-
focusInputPath: (arg1: FocusPath) => void;
|
|
25
|
-
blurInputPath: (arg1: FocusPath) => void;
|
|
26
|
-
handleNextQuestion: () => void;
|
|
27
|
-
render(): React.ReactNode;
|
|
28
|
-
}
|
|
29
8
|
declare const _default: {
|
|
30
9
|
name: string;
|
|
31
10
|
displayName: string;
|
|
32
|
-
widget:
|
|
11
|
+
widget: React.ForwardRefExoticComponent<Omit<Props, "dependencies"> & React.RefAttributes<any>>;
|
|
33
12
|
hidden: false;
|
|
34
13
|
tracking: "all";
|
|
35
14
|
isLintable: true;
|
|
@@ -1,122 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
3
|
-
import type { Coord } from "../../interactive2/types";
|
|
4
|
-
import type { Widget, WidgetProps } from "../../types";
|
|
5
|
-
import type { GridDimensions } from "../../util";
|
|
6
|
-
import type { GrapherPromptJSON } from "../../widget-ai-utils/grapher/grapher-ai-utils";
|
|
2
|
+
import type { PerseusDependenciesV2, WidgetProps } from "../../types";
|
|
7
3
|
import type { PerseusGrapherWidgetOptions, PerseusGrapherUserInput, GrapherPublicWidgetOptions } from "@khanacademy/perseus-core";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
horizHairline: any;
|
|
12
|
-
vertHairline: any;
|
|
13
|
-
handlePlotChanges: (arg1: any) => any;
|
|
14
|
-
handleActiveTypeChange: (arg1: any) => any;
|
|
15
|
-
_getGridConfig(options: Props["graph"] & {
|
|
16
|
-
box: NonNullable<Props["graph"]["box"]>;
|
|
17
|
-
gridStep: NonNullable<Props["graph"]["gridStep"]>;
|
|
18
|
-
}): ReadonlyArray<GridDimensions>;
|
|
19
|
-
_calculateMobileTickStep(gridStep: NonNullable<PropsFor<typeof Graphie>["gridStep"]>, step: NonNullable<PropsFor<typeof Graphie>["step"]>, ranges: NonNullable<PropsFor<typeof Graphie>["ranges"]>): any;
|
|
20
|
-
_setupGraphie: (arg1: any, arg2: any) => void;
|
|
21
|
-
showHairlines: (arg1: Coord) => void;
|
|
22
|
-
hideHairlines: () => void;
|
|
23
|
-
getPromptJSON(): GrapherPromptJSON;
|
|
24
|
-
/**
|
|
25
|
-
* @deprecated and likely very broken API
|
|
26
|
-
* [LEMS-3185] do not trust serializedState
|
|
27
|
-
*/
|
|
28
|
-
getSerializedState(): {
|
|
29
|
-
plot: import("@khanacademy/perseus-core").GrapherAnswerTypes;
|
|
30
|
-
availableTypes: Array<"absolute_value" | "exponential" | "linear" | "logarithm" | "quadratic" | "sinusoid" | "tangent">;
|
|
31
|
-
graph: {
|
|
32
|
-
backgroundImage: {
|
|
33
|
-
bottom?: number;
|
|
34
|
-
height?: number;
|
|
35
|
-
left?: number;
|
|
36
|
-
scale?: number;
|
|
37
|
-
url?: string | null | undefined;
|
|
38
|
-
width?: number;
|
|
39
|
-
};
|
|
40
|
-
box?: [number, number];
|
|
41
|
-
editableSettings?: Array<"graph" | "snap" | "image" | "measure">;
|
|
42
|
-
gridStep?: [number, number];
|
|
43
|
-
labels: [string, string];
|
|
44
|
-
markings: import("@khanacademy/perseus-core").MarkingsType;
|
|
45
|
-
range: import("@khanacademy/perseus-core").GraphRange;
|
|
46
|
-
rulerLabel: "";
|
|
47
|
-
rulerTicks: number;
|
|
48
|
-
showProtractor?: boolean;
|
|
49
|
-
showRuler?: boolean;
|
|
50
|
-
showTooltips?: boolean;
|
|
51
|
-
snapStep?: [number, number];
|
|
52
|
-
step: [number, number];
|
|
53
|
-
valid?: boolean | string;
|
|
54
|
-
};
|
|
55
|
-
trackInteraction: (extraData?: Empty | undefined) => void;
|
|
56
|
-
widgetId: string;
|
|
57
|
-
widgetIndex: number;
|
|
58
|
-
alignment: string | null | undefined;
|
|
59
|
-
static: boolean | null | undefined;
|
|
60
|
-
problemNum: number | null | undefined;
|
|
61
|
-
apiOptions: Readonly<Readonly<{
|
|
62
|
-
isArticle?: boolean;
|
|
63
|
-
onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
|
|
64
|
-
showAlignmentOptions?: boolean;
|
|
65
|
-
readOnly?: boolean;
|
|
66
|
-
editingDisabled?: boolean;
|
|
67
|
-
answerableCallback?: (arg1: boolean) => unknown;
|
|
68
|
-
getAnotherHint?: () => unknown;
|
|
69
|
-
interactionCallback?: (widgetData: {
|
|
70
|
-
[widgetId: string]: any;
|
|
71
|
-
}) => void;
|
|
72
|
-
imagePlaceholder?: React.ReactNode;
|
|
73
|
-
widgetPlaceholder?: React.ReactNode;
|
|
74
|
-
baseElements?: {
|
|
75
|
-
Link: React.ComponentType<any>;
|
|
76
|
-
};
|
|
77
|
-
imagePreloader?: (dimensions: import("../../types").Dimensions) => React.ReactNode;
|
|
78
|
-
trackInteraction?: (args: {
|
|
79
|
-
type: string;
|
|
80
|
-
id: string;
|
|
81
|
-
correct?: boolean;
|
|
82
|
-
} & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
|
|
83
|
-
visible: number;
|
|
84
|
-
}>) => void;
|
|
85
|
-
customKeypad?: boolean;
|
|
86
|
-
nativeKeypadProxy?: (blur: () => void) => import("@khanacademy/math-input").KeypadAPI;
|
|
87
|
-
isMobile?: boolean;
|
|
88
|
-
isMobileApp?: boolean;
|
|
89
|
-
setDrawingAreaAvailable?: (arg1: boolean) => unknown;
|
|
90
|
-
hintProgressColor?: string;
|
|
91
|
-
canScrollPage?: boolean;
|
|
92
|
-
editorChangeDelay?: number;
|
|
93
|
-
flags?: Record<"new-radio-widget" | "image-widget-upgrade", boolean>;
|
|
94
|
-
}> & {
|
|
95
|
-
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
96
|
-
canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
|
|
97
|
-
editorChangeDelay: NonNullable<import("../..").APIOptions["editorChangeDelay"]>;
|
|
98
|
-
isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
|
|
99
|
-
isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
|
|
100
|
-
isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
|
|
101
|
-
editingDisabled: NonNullable<import("../..").APIOptions["editingDisabled"]>;
|
|
102
|
-
onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
|
|
103
|
-
readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
|
|
104
|
-
setDrawingAreaAvailable: NonNullable<import("../..").APIOptions["setDrawingAreaAvailable"]>;
|
|
105
|
-
showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
|
|
106
|
-
}>;
|
|
107
|
-
keypadElement?: any;
|
|
108
|
-
questionCompleted?: boolean;
|
|
109
|
-
onFocus: (blurPath: import("../..").FocusPath) => void;
|
|
110
|
-
onBlur: (blurPath: import("../..").FocusPath) => void;
|
|
111
|
-
findWidgets: (criterion: import("../../types").FilterCriterion) => ReadonlyArray<Widget>;
|
|
112
|
-
reviewMode: boolean;
|
|
113
|
-
showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
|
|
114
|
-
handleUserInput: (newUserInput: import("@khanacademy/perseus-core").GrapherAnswerTypes, cb?: () => void, silent?: boolean) => void;
|
|
115
|
-
linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
|
|
116
|
-
containerSizeClass: import("../../util/sizing-utils").SizeClass;
|
|
117
|
-
};
|
|
118
|
-
render(): React.ReactNode;
|
|
119
|
-
}
|
|
4
|
+
type Props = WidgetProps<PerseusGrapherWidgetOptions, PerseusGrapherUserInput> & {
|
|
5
|
+
dependencies: PerseusDependenciesV2;
|
|
6
|
+
};
|
|
120
7
|
/**
|
|
121
8
|
* @deprecated and likely a very broken API
|
|
122
9
|
* [LEMS-3185] do not trust serializedState
|
|
@@ -128,7 +15,7 @@ declare const _default: {
|
|
|
128
15
|
name: string;
|
|
129
16
|
displayName: string;
|
|
130
17
|
hidden: true;
|
|
131
|
-
widget:
|
|
18
|
+
widget: React.ForwardRefExoticComponent<Omit<Props, "dependencies"> & React.RefAttributes<any>>;
|
|
132
19
|
getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
|
|
133
20
|
getStartUserInput: typeof getStartUserInput;
|
|
134
21
|
getCorrectUserInput: typeof getCorrectUserInput;
|
|
@@ -26,6 +26,7 @@ export type StatefulMafsGraphProps = {
|
|
|
26
26
|
readOnly: boolean;
|
|
27
27
|
static: InteractiveGraphProps["static"];
|
|
28
28
|
showAxisArrows: InteractiveGraphProps["showAxisArrows"];
|
|
29
|
+
widgetId: string;
|
|
29
30
|
};
|
|
30
31
|
export type StatefulMafsGraphType = {
|
|
31
32
|
getUserInput: () => PerseusInteractiveGraphUserInput;
|
|
@@ -1,45 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import type { FocusPath, Widget, WidgetProps } from "../../types";
|
|
4
|
-
import type { MatrixPromptJSON } from "../../widget-ai-utils/matrix/matrix-ai-utils";
|
|
2
|
+
import type { PerseusDependenciesV2, WidgetProps } from "../../types";
|
|
5
3
|
import type { MatrixPublicWidgetOptions, PerseusMatrixUserInput, PerseusMatrixWidgetOptions } from "@khanacademy/perseus-core";
|
|
6
|
-
type Props = WidgetProps<MatrixPublicWidgetOptions, PerseusMatrixUserInput
|
|
7
|
-
|
|
8
|
-
matrixBoardSize: Props["matrixBoardSize"];
|
|
9
|
-
prefix: string;
|
|
10
|
-
suffix: string;
|
|
11
|
-
apiOptions: Props["apiOptions"];
|
|
12
|
-
linterContext: Props["linterContext"];
|
|
13
|
-
userInput: PerseusMatrixUserInput;
|
|
4
|
+
type Props = WidgetProps<MatrixPublicWidgetOptions, PerseusMatrixUserInput> & {
|
|
5
|
+
dependencies: PerseusDependenciesV2;
|
|
14
6
|
};
|
|
15
|
-
type State = {
|
|
16
|
-
cursorPosition: ReadonlyArray<number>;
|
|
17
|
-
enterTheMatrix: number;
|
|
18
|
-
};
|
|
19
|
-
declare class Matrix extends React.Component<Props, State> implements Widget {
|
|
20
|
-
static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
|
|
21
|
-
context: React.ContextType<typeof PerseusI18nContext>;
|
|
22
|
-
cursorPosition: [number, number];
|
|
23
|
-
static defaultProps: DefaultProps;
|
|
24
|
-
state: State;
|
|
25
|
-
componentDidMount(): void;
|
|
26
|
-
getInputPaths: () => ReadonlyArray<ReadonlyArray<string>>;
|
|
27
|
-
_handleFocus: (arg1: any, arg2: any) => void;
|
|
28
|
-
_handleBlur: (arg1: any, arg2: any) => void;
|
|
29
|
-
focus: () => boolean;
|
|
30
|
-
focusInputPath: (arg1: any) => void;
|
|
31
|
-
blurInputPath: (arg1: any) => void;
|
|
32
|
-
getDOMNodeForPath(path: FocusPath): Element | Text | null;
|
|
33
|
-
handleKeyDown: (arg1: any, arg2: any, arg3: any) => void;
|
|
34
|
-
onValueChange: (arg1: any, arg2: any, arg3: any, arg4: any) => void;
|
|
35
|
-
getPromptJSON(): MatrixPromptJSON;
|
|
36
|
-
/**
|
|
37
|
-
* @deprecated and likely very broken API
|
|
38
|
-
* [LEMS-3185] do not trust serializedState
|
|
39
|
-
*/
|
|
40
|
-
getSerializedState(): any;
|
|
41
|
-
render(): React.ReactNode;
|
|
42
|
-
}
|
|
43
7
|
declare function getStartUserInput(): PerseusMatrixUserInput;
|
|
44
8
|
declare function getCorrectUserInput(options: PerseusMatrixWidgetOptions): PerseusMatrixUserInput;
|
|
45
9
|
/**
|
|
@@ -51,7 +15,7 @@ declare const _default: {
|
|
|
51
15
|
name: string;
|
|
52
16
|
displayName: string;
|
|
53
17
|
hidden: true;
|
|
54
|
-
widget:
|
|
18
|
+
widget: React.ForwardRefExoticComponent<Omit<Props, "dependencies"> & React.RefAttributes<any>>;
|
|
55
19
|
isLintable: true;
|
|
56
20
|
getStartUserInput: typeof getStartUserInput;
|
|
57
21
|
getCorrectUserInput: typeof getCorrectUserInput;
|
|
@@ -1,44 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type {
|
|
3
|
-
import type { OrdererPromptJSON } from "../../widget-ai-utils/orderer/orderer-ai-utils";
|
|
2
|
+
import type { PerseusDependenciesV2, WidgetProps } from "../../types";
|
|
4
3
|
import type { PerseusOrdererUserInput, OrdererPublicWidgetOptions } from "@khanacademy/perseus-core";
|
|
5
|
-
type
|
|
6
|
-
|
|
7
|
-
top: number;
|
|
4
|
+
type OrdererProps = WidgetProps<OrdererPublicWidgetOptions, PerseusOrdererUserInput> & {
|
|
5
|
+
dependencies: PerseusDependenciesV2;
|
|
8
6
|
};
|
|
9
|
-
type OrdererProps = WidgetProps<OrdererPublicWidgetOptions, PerseusOrdererUserInput>;
|
|
10
|
-
type OrdererDefaultProps = Pick<OrdererProps, "options" | "height" | "layout" | "linterContext" | "userInput">;
|
|
11
|
-
type OrdererState = {
|
|
12
|
-
dragging: boolean;
|
|
13
|
-
placeholderIndex: number | null | undefined;
|
|
14
|
-
dragKey: string | null | undefined;
|
|
15
|
-
animating: boolean;
|
|
16
|
-
dragWidth: number | null | undefined;
|
|
17
|
-
dragHeight: number | null | undefined;
|
|
18
|
-
dragContent: any;
|
|
19
|
-
offsetPos: Position | null | undefined;
|
|
20
|
-
grabPos: any;
|
|
21
|
-
mousePos?: any;
|
|
22
|
-
animateTo: Position | null | undefined;
|
|
23
|
-
onAnimationEnd?: (arg1: any) => void;
|
|
24
|
-
};
|
|
25
|
-
declare class Orderer extends React.Component<OrdererProps, OrdererState> implements Widget {
|
|
26
|
-
static defaultProps: OrdererDefaultProps;
|
|
27
|
-
state: OrdererState;
|
|
28
|
-
onClick: (arg1: string, arg2: number, arg3: any, arg4: Element) => void;
|
|
29
|
-
onRelease: (arg1: any) => void;
|
|
30
|
-
onMouseMove: (arg1: any) => void;
|
|
31
|
-
findCorrectIndex: (arg1: any, arg2: any) => any;
|
|
32
|
-
isCardInBank: (arg1: any) => boolean;
|
|
33
|
-
setListValues: (values: string[]) => void;
|
|
34
|
-
getPromptJSON(): OrdererPromptJSON;
|
|
35
|
-
/**
|
|
36
|
-
* @deprecated and likely very broken API
|
|
37
|
-
* [LEMS-3185] do not trust serializedState
|
|
38
|
-
*/
|
|
39
|
-
getSerializedState(): any;
|
|
40
|
-
render(): React.ReactNode;
|
|
41
|
-
}
|
|
42
7
|
/**
|
|
43
8
|
* @deprecated and likely a very broken API
|
|
44
9
|
* [LEMS-3185] do not trust serializedState
|
|
@@ -49,7 +14,7 @@ declare const _default: {
|
|
|
49
14
|
name: string;
|
|
50
15
|
displayName: string;
|
|
51
16
|
hidden: true;
|
|
52
|
-
widget:
|
|
17
|
+
widget: React.ForwardRefExoticComponent<Omit<OrdererProps, "dependencies"> & React.RefAttributes<any>>;
|
|
53
18
|
isLintable: true;
|
|
54
19
|
getStartUserInput: typeof getStartUserInput;
|
|
55
20
|
getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
|
|
@@ -2,7 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
3
|
import type { ParseState } from "./passage-markdown";
|
|
4
4
|
import type { SerializedHighlightSet } from "../../components/highlighting/types";
|
|
5
|
-
import type { WidgetProps, Widget } from "../../types";
|
|
5
|
+
import type { WidgetProps, Widget, PerseusDependenciesV2 } from "../../types";
|
|
6
6
|
import type { PassagePromptJSON } from "../../widget-ai-utils/passage/passage-ai-utils";
|
|
7
7
|
import type { PerseusPassageWidgetOptions, PerseusWidget } from "@khanacademy/perseus-core";
|
|
8
8
|
import type { SingleASTNode } from "@khanacademy/simple-markdown";
|
|
@@ -14,6 +14,7 @@ export declare class LineHeightMeasurer extends React.Component<Record<any, any>
|
|
|
14
14
|
type FindWidgetsCallback = (id: string, widgetInfo: PerseusWidget) => boolean;
|
|
15
15
|
type PassageProps = WidgetProps<PerseusPassageWidgetOptions> & {
|
|
16
16
|
findWidgets: (arg1: FindWidgetsCallback) => ReadonlyArray<Passage>;
|
|
17
|
+
dependencies: PerseusDependenciesV2;
|
|
17
18
|
};
|
|
18
19
|
type DefaultPassageProps = {
|
|
19
20
|
passageTitle: PassageProps["passageTitle"];
|
|
@@ -94,7 +95,7 @@ declare const _default: {
|
|
|
94
95
|
name: string;
|
|
95
96
|
displayName: string;
|
|
96
97
|
hidden: true;
|
|
97
|
-
widget:
|
|
98
|
+
widget: React.ForwardRefExoticComponent<Omit<PassageProps, "dependencies"> & React.RefAttributes<any>>;
|
|
98
99
|
isLintable: true;
|
|
99
100
|
};
|
|
100
101
|
export default _default;
|
|
@@ -1,160 +1,11 @@
|
|
|
1
1
|
import { type PerseusPlotterUserInput, type PerseusPlotterWidgetOptions, type PlotterPublicWidgetOptions } from "@khanacademy/perseus-core";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import {
|
|
4
|
-
import type { Widget, WidgetProps } from "../../types";
|
|
5
|
-
import type { UnsupportedWidgetPromptJSON } from "../../widget-ai-utils/unsupported-widget";
|
|
3
|
+
import type { PerseusDependenciesV2, WidgetProps } from "../../types";
|
|
6
4
|
type Props = WidgetProps<PlotterPublicWidgetOptions, PerseusPlotterUserInput> & {
|
|
7
5
|
labelInterval: NonNullable<PerseusPlotterWidgetOptions["labelInterval"]>;
|
|
8
6
|
picSize: NonNullable<PerseusPlotterWidgetOptions["picSize"]>;
|
|
7
|
+
dependencies: PerseusDependenciesV2;
|
|
9
8
|
};
|
|
10
|
-
type DefaultProps = {
|
|
11
|
-
type: Props["type"];
|
|
12
|
-
labels: Props["labels"];
|
|
13
|
-
categories: Props["categories"];
|
|
14
|
-
scaleY: Props["scaleY"];
|
|
15
|
-
maxY: Props["maxY"];
|
|
16
|
-
snapsPerLine: Props["snapsPerLine"];
|
|
17
|
-
picSize: Props["picSize"];
|
|
18
|
-
picBoxHeight: Props["picBoxHeight"];
|
|
19
|
-
picUrl: Props["picUrl"];
|
|
20
|
-
plotDimensions: Props["plotDimensions"];
|
|
21
|
-
labelInterval: Props["labelInterval"];
|
|
22
|
-
};
|
|
23
|
-
type State = {
|
|
24
|
-
categoryHeights: Record<string, number>;
|
|
25
|
-
};
|
|
26
|
-
declare class Plotter extends React.Component<Props, State> implements Widget {
|
|
27
|
-
static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
|
|
28
|
-
context: React.ContextType<typeof PerseusI18nContext>;
|
|
29
|
-
_isMounted: boolean;
|
|
30
|
-
shouldSetupGraphie: boolean;
|
|
31
|
-
graphieDiv: React.RefObject<HTMLDivElement>;
|
|
32
|
-
graphie: any;
|
|
33
|
-
horizHairline: any;
|
|
34
|
-
hairlineRange: any;
|
|
35
|
-
static defaultProps: DefaultProps;
|
|
36
|
-
state: State;
|
|
37
|
-
componentDidMount(): void;
|
|
38
|
-
UNSAFE_componentWillReceiveProps(nextProps: Props): void;
|
|
39
|
-
componentDidUpdate(prevProps: Props, prevState: State): void;
|
|
40
|
-
componentWillUnmount(): void;
|
|
41
|
-
DOT_PLOT_POINT_SIZE: () => number;
|
|
42
|
-
DOT_PLOT_POINT_PADDING: () => number;
|
|
43
|
-
DOT_TICK_POINT_SIZE: () => number;
|
|
44
|
-
setupGraphie(prevValues: number[]): void;
|
|
45
|
-
showHairlines: (arg1: any) => void;
|
|
46
|
-
hideHairlines: () => void;
|
|
47
|
-
labelCategory: (arg1: any, arg2: any) => Promise<any>;
|
|
48
|
-
setupCategories: (arg1: any) => void;
|
|
49
|
-
_clampValue: (arg1: number, arg2: number, arg3: number) => number;
|
|
50
|
-
_maybeShowDragPrompt: () => void;
|
|
51
|
-
_maybeHideDragPrompt: () => void;
|
|
52
|
-
setupBar: (arg1: any) => number;
|
|
53
|
-
/**
|
|
54
|
-
* Renders a segment of an interactive line to the plotter graph
|
|
55
|
-
* @param i the index of the point to render
|
|
56
|
-
* @param startHeight the initial height of the given point
|
|
57
|
-
* @param config the graph setup, such as scale and dimensions
|
|
58
|
-
*/
|
|
59
|
-
setupLine: (arg1: number, arg2: number, arg3: any) => number;
|
|
60
|
-
setupDotplot: (arg1: any, arg2: any) => any;
|
|
61
|
-
setupPic: (arg1: any, arg2: any) => any;
|
|
62
|
-
setupTiledPlot: (arg1: any, arg2: any, arg3: any, arg4: any) => any;
|
|
63
|
-
setPicHeight: (arg1: number, arg2: number) => void;
|
|
64
|
-
changeAndTrack: (userInput: PerseusPlotterUserInput) => void;
|
|
65
|
-
/**
|
|
66
|
-
* Plotter uses Graphie and Graphie is inaccessible,
|
|
67
|
-
* this helps us populate user input in tests
|
|
68
|
-
* (not great, but not a lot of options)
|
|
69
|
-
*
|
|
70
|
-
* @internal
|
|
71
|
-
*/
|
|
72
|
-
_testInsertUserInput(userInput: PerseusPlotterUserInput): void;
|
|
73
|
-
drawPicHeights(values: number[], prevValues: number[]): void;
|
|
74
|
-
getPromptJSON(): UnsupportedWidgetPromptJSON;
|
|
75
|
-
/**
|
|
76
|
-
* @deprecated and likely very broken API
|
|
77
|
-
* [LEMS-3185] do not trust serializedState
|
|
78
|
-
*/
|
|
79
|
-
getSerializedState(): {
|
|
80
|
-
values: PerseusPlotterUserInput;
|
|
81
|
-
type: import("@khanacademy/perseus-core").PlotType;
|
|
82
|
-
labels: string[];
|
|
83
|
-
categories: string[];
|
|
84
|
-
maxY: number;
|
|
85
|
-
scaleY: number;
|
|
86
|
-
labelInterval: number;
|
|
87
|
-
snapsPerLine: number;
|
|
88
|
-
starting: number[];
|
|
89
|
-
picUrl?: string | null;
|
|
90
|
-
picSize: number;
|
|
91
|
-
picBoxHeight?: number | null;
|
|
92
|
-
plotDimensions: number[];
|
|
93
|
-
trackInteraction: (extraData?: Empty | undefined) => void;
|
|
94
|
-
widgetId: string;
|
|
95
|
-
widgetIndex: number;
|
|
96
|
-
alignment: string | null | undefined;
|
|
97
|
-
static: boolean | null | undefined;
|
|
98
|
-
problemNum: number | null | undefined;
|
|
99
|
-
apiOptions: Readonly<Readonly<{
|
|
100
|
-
isArticle?: boolean;
|
|
101
|
-
onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
|
|
102
|
-
showAlignmentOptions?: boolean;
|
|
103
|
-
readOnly?: boolean;
|
|
104
|
-
editingDisabled?: boolean;
|
|
105
|
-
answerableCallback?: (arg1: boolean) => unknown;
|
|
106
|
-
getAnotherHint?: () => unknown;
|
|
107
|
-
interactionCallback?: (widgetData: {
|
|
108
|
-
[widgetId: string]: any;
|
|
109
|
-
}) => void;
|
|
110
|
-
imagePlaceholder?: React.ReactNode;
|
|
111
|
-
widgetPlaceholder?: React.ReactNode;
|
|
112
|
-
baseElements?: {
|
|
113
|
-
Link: React.ComponentType<any>;
|
|
114
|
-
};
|
|
115
|
-
imagePreloader?: (dimensions: import("../../types").Dimensions) => React.ReactNode;
|
|
116
|
-
trackInteraction?: (args: {
|
|
117
|
-
type: string;
|
|
118
|
-
id: string;
|
|
119
|
-
correct?: boolean;
|
|
120
|
-
} & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
|
|
121
|
-
visible: number;
|
|
122
|
-
}>) => void;
|
|
123
|
-
customKeypad?: boolean;
|
|
124
|
-
nativeKeypadProxy?: (blur: () => void) => import("@khanacademy/math-input").KeypadAPI;
|
|
125
|
-
isMobile?: boolean;
|
|
126
|
-
isMobileApp?: boolean;
|
|
127
|
-
setDrawingAreaAvailable?: (arg1: boolean) => unknown;
|
|
128
|
-
hintProgressColor?: string;
|
|
129
|
-
canScrollPage?: boolean;
|
|
130
|
-
editorChangeDelay?: number;
|
|
131
|
-
flags?: Record<"new-radio-widget" | "image-widget-upgrade", boolean>;
|
|
132
|
-
}> & {
|
|
133
|
-
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
134
|
-
canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
|
|
135
|
-
editorChangeDelay: NonNullable<import("../..").APIOptions["editorChangeDelay"]>;
|
|
136
|
-
isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
|
|
137
|
-
isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
|
|
138
|
-
isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
|
|
139
|
-
editingDisabled: NonNullable<import("../..").APIOptions["editingDisabled"]>;
|
|
140
|
-
onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
|
|
141
|
-
readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
|
|
142
|
-
setDrawingAreaAvailable: NonNullable<import("../..").APIOptions["setDrawingAreaAvailable"]>;
|
|
143
|
-
showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
|
|
144
|
-
}>;
|
|
145
|
-
keypadElement?: any;
|
|
146
|
-
questionCompleted?: boolean;
|
|
147
|
-
onFocus: (blurPath: import("../..").FocusPath) => void;
|
|
148
|
-
onBlur: (blurPath: import("../..").FocusPath) => void;
|
|
149
|
-
findWidgets: (criterion: import("../../types").FilterCriterion) => ReadonlyArray<Widget>;
|
|
150
|
-
reviewMode: boolean;
|
|
151
|
-
showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
|
|
152
|
-
handleUserInput: (newUserInput: PerseusPlotterUserInput, cb?: () => void, silent?: boolean) => void;
|
|
153
|
-
linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
|
|
154
|
-
containerSizeClass: import("../../util/sizing-utils").SizeClass;
|
|
155
|
-
};
|
|
156
|
-
render(): React.ReactNode;
|
|
157
|
-
}
|
|
158
9
|
declare function getStartUserInput(options: PlotterPublicWidgetOptions): PerseusPlotterUserInput;
|
|
159
10
|
declare function getCorrectUserInput(options: PerseusPlotterWidgetOptions): PerseusPlotterUserInput;
|
|
160
11
|
/**
|
|
@@ -166,7 +17,7 @@ declare const _default: {
|
|
|
166
17
|
name: string;
|
|
167
18
|
displayName: string;
|
|
168
19
|
hidden: true;
|
|
169
|
-
widget:
|
|
20
|
+
widget: React.ForwardRefExoticComponent<Omit<Props, "dependencies"> & React.RefAttributes<any>>;
|
|
170
21
|
getCorrectUserInput: typeof getCorrectUserInput;
|
|
171
22
|
getStartUserInput: typeof getStartUserInput;
|
|
172
23
|
getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
|
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": "72.
|
|
6
|
+
"version": "72.3.0",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -41,41 +41,41 @@
|
|
|
41
41
|
"mafs": "0.19.0",
|
|
42
42
|
"tiny-invariant": "1.3.1",
|
|
43
43
|
"uuid": "^10.0.0",
|
|
44
|
-
"@khanacademy/kas": "2.1.
|
|
45
|
-
"@khanacademy/keypad-context": "3.2.
|
|
46
|
-
"@khanacademy/kmath": "2.2.
|
|
47
|
-
"@khanacademy/math-input": "26.2.
|
|
48
|
-
"@khanacademy/perseus-core": "20.
|
|
49
|
-
"@khanacademy/perseus-linter": "4.6.
|
|
50
|
-
"@khanacademy/perseus-score": "8.0.
|
|
51
|
-
"@khanacademy/perseus-utils": "2.1.
|
|
52
|
-
"@khanacademy/pure-markdown": "2.2.
|
|
53
|
-
"@khanacademy/simple-markdown": "2.1.
|
|
44
|
+
"@khanacademy/kas": "2.1.6",
|
|
45
|
+
"@khanacademy/keypad-context": "3.2.19",
|
|
46
|
+
"@khanacademy/kmath": "2.2.19",
|
|
47
|
+
"@khanacademy/math-input": "26.2.22",
|
|
48
|
+
"@khanacademy/perseus-core": "20.3.0",
|
|
49
|
+
"@khanacademy/perseus-linter": "4.6.1",
|
|
50
|
+
"@khanacademy/perseus-score": "8.0.8",
|
|
51
|
+
"@khanacademy/perseus-utils": "2.1.4",
|
|
52
|
+
"@khanacademy/pure-markdown": "2.2.4",
|
|
53
|
+
"@khanacademy/simple-markdown": "2.1.4"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@khanacademy/wonder-blocks-announcer": "1.0.5",
|
|
57
|
-
"@khanacademy/wonder-blocks-banner": "5.0.
|
|
58
|
-
"@khanacademy/wonder-blocks-button": "11.2.
|
|
57
|
+
"@khanacademy/wonder-blocks-banner": "5.0.5",
|
|
58
|
+
"@khanacademy/wonder-blocks-button": "11.2.9",
|
|
59
59
|
"@khanacademy/wonder-blocks-clickable": "8.0.4",
|
|
60
60
|
"@khanacademy/wonder-blocks-core": "12.4.2",
|
|
61
61
|
"@khanacademy/wonder-blocks-data": "14.1.8",
|
|
62
|
-
"@khanacademy/wonder-blocks-dropdown": "10.5.
|
|
62
|
+
"@khanacademy/wonder-blocks-dropdown": "10.5.5",
|
|
63
63
|
"@khanacademy/wonder-blocks-form": "7.4.5",
|
|
64
|
-
"@khanacademy/wonder-blocks-icon-button": "
|
|
64
|
+
"@khanacademy/wonder-blocks-icon-button": "11.0.0",
|
|
65
65
|
"@khanacademy/wonder-blocks-icon": "5.3.4",
|
|
66
66
|
"@khanacademy/wonder-blocks-labeled-field": "4.0.10",
|
|
67
67
|
"@khanacademy/wonder-blocks-layout": "3.1.41",
|
|
68
68
|
"@khanacademy/wonder-blocks-link": "10.0.5",
|
|
69
|
-
"@khanacademy/wonder-blocks-modal": "8.5.
|
|
69
|
+
"@khanacademy/wonder-blocks-modal": "8.5.8",
|
|
70
70
|
"@khanacademy/wonder-blocks-pill": "3.1.47",
|
|
71
|
-
"@khanacademy/wonder-blocks-popover": "6.1.
|
|
71
|
+
"@khanacademy/wonder-blocks-popover": "6.1.45",
|
|
72
72
|
"@khanacademy/wonder-blocks-progress-spinner": "3.1.41",
|
|
73
73
|
"@khanacademy/wonder-blocks-switch": "3.3.24",
|
|
74
74
|
"@khanacademy/wonder-blocks-timing": "7.0.4",
|
|
75
75
|
"@khanacademy/wonder-blocks-tokens": "14.1.2",
|
|
76
|
-
"@khanacademy/wonder-blocks-tooltip": "4.1.
|
|
76
|
+
"@khanacademy/wonder-blocks-tooltip": "4.1.59",
|
|
77
77
|
"@khanacademy/wonder-blocks-typography": "4.2.26",
|
|
78
|
-
"@khanacademy/wonder-stuff-core": "
|
|
78
|
+
"@khanacademy/wonder-stuff-core": "3.0.0",
|
|
79
79
|
"@phosphor-icons/core": "2.0.2",
|
|
80
80
|
"@popperjs/core": "2.10.2",
|
|
81
81
|
"aphrodite": "1.2.5",
|
|
@@ -93,28 +93,28 @@
|
|
|
93
93
|
},
|
|
94
94
|
"peerDependencies": {
|
|
95
95
|
"@khanacademy/wonder-blocks-announcer": "^1.0.5",
|
|
96
|
-
"@khanacademy/wonder-blocks-banner": "^5.0.
|
|
97
|
-
"@khanacademy/wonder-blocks-button": "^11.2.
|
|
96
|
+
"@khanacademy/wonder-blocks-banner": "^5.0.5",
|
|
97
|
+
"@khanacademy/wonder-blocks-button": "^11.2.9",
|
|
98
98
|
"@khanacademy/wonder-blocks-clickable": "^8.0.4",
|
|
99
99
|
"@khanacademy/wonder-blocks-core": "^12.4.2",
|
|
100
100
|
"@khanacademy/wonder-blocks-data": "^14.1.8",
|
|
101
|
-
"@khanacademy/wonder-blocks-dropdown": "^10.5.
|
|
101
|
+
"@khanacademy/wonder-blocks-dropdown": "^10.5.5",
|
|
102
102
|
"@khanacademy/wonder-blocks-form": "^7.4.5",
|
|
103
103
|
"@khanacademy/wonder-blocks-icon": "^5.3.4",
|
|
104
|
-
"@khanacademy/wonder-blocks-icon-button": "^
|
|
104
|
+
"@khanacademy/wonder-blocks-icon-button": "^11.0.0",
|
|
105
105
|
"@khanacademy/wonder-blocks-labeled-field": "^4.0.10",
|
|
106
106
|
"@khanacademy/wonder-blocks-layout": "^3.1.41",
|
|
107
107
|
"@khanacademy/wonder-blocks-link": "^10.0.5",
|
|
108
|
-
"@khanacademy/wonder-blocks-modal": "^8.5.
|
|
108
|
+
"@khanacademy/wonder-blocks-modal": "^8.5.8",
|
|
109
109
|
"@khanacademy/wonder-blocks-pill": "^3.1.47",
|
|
110
|
-
"@khanacademy/wonder-blocks-popover": "^6.1.
|
|
110
|
+
"@khanacademy/wonder-blocks-popover": "^6.1.45",
|
|
111
111
|
"@khanacademy/wonder-blocks-progress-spinner": "^3.1.41",
|
|
112
112
|
"@khanacademy/wonder-blocks-switch": "^3.3.24",
|
|
113
113
|
"@khanacademy/wonder-blocks-timing": "^7.0.4",
|
|
114
114
|
"@khanacademy/wonder-blocks-tokens": "^14.1.2",
|
|
115
|
-
"@khanacademy/wonder-blocks-tooltip": "^4.1.
|
|
115
|
+
"@khanacademy/wonder-blocks-tooltip": "^4.1.59",
|
|
116
116
|
"@khanacademy/wonder-blocks-typography": "^4.2.26",
|
|
117
|
-
"@khanacademy/wonder-stuff-core": "^
|
|
117
|
+
"@khanacademy/wonder-stuff-core": "^3.0.0",
|
|
118
118
|
"@phosphor-icons/core": "^2.0.2",
|
|
119
119
|
"@popperjs/core": "^2.10.2",
|
|
120
120
|
"aphrodite": "^1.2.5",
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
},
|
|
131
131
|
"keywords": [],
|
|
132
132
|
"khan": {
|
|
133
|
-
"catalogHash": "
|
|
133
|
+
"catalogHash": "b1559f7c28e226b4"
|
|
134
134
|
},
|
|
135
135
|
"scripts": {}
|
|
136
136
|
}
|