@khanacademy/perseus 72.2.1 → 72.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.
@@ -1,28 +1,4 @@
1
1
  import type { PerseusItem, PerseusWidgetsMap, PerseusRenderer } from "@khanacademy/perseus-core";
2
- /**
3
- * This function extracts the answers from the widgets.
4
- *
5
- * For each widget type, we first check to make sure the path to the answer exists,
6
- * then we extract the answer and add it to the list of answers.
7
- *
8
- * A list is returned because some widgets, like multi-select radio widgets and groups
9
- * can have multiple answers.
10
- *
11
- * @param {PerseusRenderer["widgets"]} widgets
12
- * @returns a list of strings that are the answers to the widgets
13
- */
14
- declare function getAnswersFromWidgets(widgets: PerseusRenderer["widgets"]): ReadonlyArray<string>;
15
- /**
16
- * Inject a string equivalent of the widgets into the content.
17
- *
18
- * Content may contain Perseus widgets, that looks like this: '[[☃ Radio 1]]'.
19
- * This function replaces those widgets with its equivalent string.
20
- *
21
- * @param {string} content
22
- * @param {PerseusRenderer["widgets"]} widgets
23
- * @returns
24
- */
25
- declare function injectWidgets(content: string, widgets: PerseusRenderer["widgets"], widgetProps?: PerseusWidgetsMap): string;
26
2
  /**
27
3
  * Looks through widgets to identify images that do not have alt text.
28
4
  *
@@ -39,4 +15,4 @@ export declare const getAnswerFromUserInput: (widgetType: string, userInput: any
39
15
  export declare const getCorrectAnswerForWidgetId: (widgetId: string, itemData: PerseusItem) => string | null | undefined;
40
16
  export declare const isWidgetIdInContent: (perseusItem: PerseusItem, widgetId: string) => boolean;
41
17
  export declare const getValidWidgetIds: (perseusItem: PerseusItem) => Array<string>;
42
- export { getAnswersFromWidgets, getImagesWithoutAltData, injectWidgets };
18
+ export { getImagesWithoutAltData };
@@ -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: typeof GradedGroup;
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 { GradedGroup } from "../graded-group/graded-group";
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: typeof GradedGroupSet;
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 Graphie from "../../components/graphie";
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
- import type { PropsFor } from "@khanacademy/wonder-blocks-core";
9
- type Props = WidgetProps<PerseusGrapherWidgetOptions, PerseusGrapherUserInput>;
10
- declare class Grapher extends React.Component<Props> implements Widget {
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: typeof Grapher;
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;
@@ -22,5 +22,6 @@ export type MafsGraphProps = {
22
22
  dispatch: React.Dispatch<InteractiveGraphAction>;
23
23
  readOnly: boolean;
24
24
  static: boolean | null | undefined;
25
+ widgetId: string;
25
26
  };
26
27
  export declare const MafsGraph: (props: MafsGraphProps) => React.JSX.Element;
@@ -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 { PerseusI18nContext } from "../../components/i18n-context";
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
- type DefaultProps = {
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: typeof Matrix;
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 { Widget, WidgetProps } from "../../types";
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 Position = {
6
- left: number;
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: typeof Orderer;
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: typeof Passage;
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 { PerseusI18nContext } from "../../components/i18n-context";
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: typeof Plotter;
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;