@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.
Files changed (53) hide show
  1. package/dist/es/index.js +52 -52
  2. package/dist/es/index.js.map +1 -1
  3. package/dist/hint-renderer.d.ts +6 -0
  4. package/dist/hints-renderer.d.ts +6 -0
  5. package/dist/index.d.ts +2 -2
  6. package/dist/index.js +51 -51
  7. package/dist/index.js.map +1 -1
  8. package/dist/mixins/changeable.d.ts +14 -0
  9. package/dist/mixins/widget-prop-denylist.d.ts +5 -0
  10. package/dist/renderer.d.ts +23 -11
  11. package/dist/server-item-renderer.d.ts +10 -0
  12. package/dist/types.d.ts +47 -13
  13. package/dist/widget-ai-utils/number-line/number-line-ai-utils.d.ts +1 -1
  14. package/dist/widget-type-utils.d.ts +1 -1
  15. package/dist/widgets/categorizer/categorizer.d.ts +28 -10
  16. package/dist/widgets/cs-program/cs-program.d.ts +9 -5
  17. package/dist/widgets/definition/definition.d.ts +0 -1
  18. package/dist/widgets/dropdown/dropdown.d.ts +22 -9
  19. package/dist/widgets/explanation/explanation.d.ts +0 -1
  20. package/dist/widgets/expression/expression.d.ts +107 -11
  21. package/dist/widgets/free-response/free-response.d.ts +9 -7
  22. package/dist/widgets/graded-group-set/graded-group-set.d.ts +1 -3
  23. package/dist/widgets/grapher/grapher.d.ts +139 -14
  24. package/dist/widgets/grapher/util.d.ts +2 -2
  25. package/dist/widgets/group/group.d.ts +6 -0
  26. package/dist/widgets/iframe/iframe.d.ts +10 -8
  27. package/dist/widgets/image/image.d.ts +1 -2
  28. package/dist/widgets/input-number/input-number.d.ts +17 -6
  29. package/dist/widgets/interaction/interaction.d.ts +0 -2
  30. package/dist/widgets/interactive-graph.d.ts +101 -4
  31. package/dist/widgets/interactive-graphs/stateful-mafs-graph.d.ts +1 -1
  32. package/dist/widgets/interactive-graphs/types.d.ts +2 -2
  33. package/dist/widgets/label-image/label-image.d.ts +28 -8
  34. package/dist/widgets/matcher/matcher.d.ts +19 -7
  35. package/dist/widgets/matrix/matrix.d.ts +30 -18
  36. package/dist/widgets/mock-widgets/mock-widget.d.ts +89 -8
  37. package/dist/widgets/number-line/number-line.d.ts +108 -13
  38. package/dist/widgets/numeric-input/numeric-input.class.d.ts +93 -4
  39. package/dist/widgets/numeric-input/numeric-input.d.ts +1 -2
  40. package/dist/widgets/orderer/orderer.d.ts +15 -8
  41. package/dist/widgets/passage-ref/passage-ref.d.ts +1 -2
  42. package/dist/widgets/passage-ref-target/passage-ref-target.d.ts +1 -3
  43. package/dist/widgets/phet-simulation/phet-simulation.d.ts +1 -2
  44. package/dist/widgets/plotter/plotter.d.ts +105 -6
  45. package/dist/widgets/radio/radio-component.d.ts +1 -1
  46. package/dist/widgets/radio/radio.class.new.d.ts +1 -1
  47. package/dist/widgets/radio/radio.d.ts +4 -0
  48. package/dist/widgets/radio/radio.ff.d.ts +2 -2
  49. package/dist/widgets/radio/radio.new.d.ts +2 -2
  50. package/dist/widgets/sorter/sorter.d.ts +26 -9
  51. package/dist/widgets/table/table.d.ts +88 -5
  52. package/dist/widgets/video/video.d.ts +0 -1
  53. package/package.json +7 -7
@@ -2,7 +2,7 @@ import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { FocusPath, Widget, WidgetProps, UniversalWidgetProps } from "../../types";
4
4
  import type { NumberLinePromptJSON } from "../../widget-ai-utils/number-line/number-line-ai-utils";
5
- import type { Relationship, PerseusNumberLineUserInput, PerseusNumberLineWidgetOptions, NumberLinePublicWidgetOptions } from "@khanacademy/perseus-core";
5
+ import type { PerseusNumberLineUserInput, PerseusNumberLineWidgetOptions, NumberLinePublicWidgetOptions } from "@khanacademy/perseus-core";
6
6
  import type { PropsFor } from "@khanacademy/wonder-blocks-core";
7
7
  /**
8
8
  * The type of `this.props` inside the NumberLine widget.
@@ -13,14 +13,14 @@ type Props = WidgetProps<{
13
13
  labelStyle: string;
14
14
  labelTicks: boolean;
15
15
  divisionRange: number[];
16
- numDivisions: number;
17
16
  snapDivisions: number;
18
17
  isTickCtrl: boolean;
19
18
  isInequality: boolean;
20
- numLinePosition: number;
21
- rel: Relationship;
22
19
  showTooltips?: boolean;
23
- }>;
20
+ }, PerseusNumberLineUserInput>;
21
+ type CalculatedProps = Props & {
22
+ tickStep: number;
23
+ };
24
24
  type DefaultProps = {
25
25
  range: Props["range"];
26
26
  labelStyle: Props["labelStyle"];
@@ -29,10 +29,8 @@ type DefaultProps = {
29
29
  labelTicks: Props["labelTicks"];
30
30
  isTickCtrl: Props["isTickCtrl"];
31
31
  isInequality: Props["isInequality"];
32
- numLinePosition: Props["numLinePosition"];
33
32
  snapDivisions: Props["snapDivisions"];
34
33
  showTooltips: Props["showTooltips"];
35
- rel: Props["rel"];
36
34
  apiOptions: Props["apiOptions"];
37
35
  };
38
36
  /**
@@ -47,7 +45,6 @@ declare class NumberLine extends React.Component<Props, State> implements Widget
47
45
  context: React.ContextType<typeof PerseusI18nContext>;
48
46
  static defaultProps: DefaultProps;
49
47
  state: any;
50
- change: (...args: ReadonlyArray<unknown>) => any;
51
48
  isValid: () => boolean;
52
49
  onNumDivisionsChange: (arg1: number, arg2: any) => void;
53
50
  _handleTickCtrlFocus: () => void;
@@ -61,23 +58,121 @@ declare class NumberLine extends React.Component<Props, State> implements Widget
61
58
  _renderGraphie: () => React.ReactElement;
62
59
  snapNumLinePosition: (arg1: any, arg2: number) => number;
63
60
  movePosition: (arg1: number) => void;
64
- _renderNumberLinePoint: (arg1: any) => React.ReactElement;
61
+ _renderNumberLinePoint: (arg1: CalculatedProps) => React.ReactElement;
65
62
  handleReverse: () => void;
66
63
  handleToggleStrict: () => void;
67
- _getInequalityEndpoint: (arg1: any) => [number, number];
68
- _renderInequality: (arg1: any) => React.ReactElement;
64
+ _getInequalityEndpoint(props: CalculatedProps): [number, number];
65
+ _renderInequality(props: CalculatedProps): React.ReactElement | null;
69
66
  _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
+ */
70
71
  getUserInput(): PerseusNumberLineUserInput;
71
72
  getPromptJSON(): NumberLinePromptJSON;
73
+ /**
74
+ * @deprecated and likely very broken API
75
+ * [LEMS-3185] do not trust serializedState/restoreSerializedState
76
+ */
77
+ getSerializedState(): {
78
+ numDivisions: number;
79
+ numLinePosition: number;
80
+ rel: string;
81
+ range: number[];
82
+ labelRange: Array<number | null>;
83
+ labelStyle: string;
84
+ labelTicks: boolean;
85
+ divisionRange: number[];
86
+ snapDivisions: number;
87
+ isTickCtrl: boolean;
88
+ isInequality: boolean;
89
+ showTooltips?: boolean;
90
+ reviewModeRubric?: Empty | null | undefined;
91
+ trackInteraction: (extraData?: Empty | undefined) => void;
92
+ widgetId: string;
93
+ alignment: string | null | undefined;
94
+ static: boolean | null | undefined;
95
+ problemNum: number | null | undefined;
96
+ apiOptions: Readonly<Readonly<{
97
+ isArticle?: boolean;
98
+ onFocusChange?: (newFocusPath: FocusPath, oldFocusPath: FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
99
+ GroupMetadataEditor?: React.ComponentType<any>;
100
+ showAlignmentOptions?: boolean;
101
+ readOnly?: boolean;
102
+ answerableCallback?: (arg1: boolean) => unknown;
103
+ getAnotherHint?: () => unknown;
104
+ interactionCallback?: (widgetData: {
105
+ [widgetId: string]: any;
106
+ }) => void;
107
+ groupAnnotator?: (groupNumber: number, widgetId: string) => React.ReactNode;
108
+ imagePlaceholder?: React.ReactNode;
109
+ widgetPlaceholder?: React.ReactNode;
110
+ baseElements?: {
111
+ Link: React.ComponentType<any>;
112
+ };
113
+ imagePreloader?: (dimensions: import("../../types").Dimensions) => React.ReactNode;
114
+ trackInteraction?: (args: {
115
+ type: string;
116
+ id: string;
117
+ correct?: boolean;
118
+ } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
119
+ visible: number;
120
+ }>) => void;
121
+ customKeypad?: boolean;
122
+ nativeKeypadProxy?: (blur: () => void) => import("@khanacademy/math-input").KeypadAPI;
123
+ isMobile?: boolean;
124
+ isMobileApp?: boolean;
125
+ setDrawingAreaAvailable?: (arg1: boolean) => unknown;
126
+ hintProgressColor?: string;
127
+ canScrollPage?: boolean;
128
+ editorChangeDelay?: number;
129
+ flags?: Record<"new-radio-widget", boolean>;
130
+ onWidgetStartProps?: (widgets: import("@khanacademy/perseus-core").PerseusWidgetsMap) => void;
131
+ }> & {
132
+ baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
133
+ canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
134
+ editorChangeDelay: NonNullable<import("../..").APIOptions["editorChangeDelay"]>;
135
+ groupAnnotator: NonNullable<import("../..").APIOptions["groupAnnotator"]>;
136
+ isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
137
+ isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
138
+ isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
139
+ onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
140
+ readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
141
+ setDrawingAreaAvailable: NonNullable<import("../..").APIOptions["setDrawingAreaAvailable"]>;
142
+ showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
143
+ }>;
144
+ keypadElement?: any;
145
+ questionCompleted?: boolean;
146
+ onFocus: (blurPath: FocusPath) => void;
147
+ onBlur: (blurPath: FocusPath) => void;
148
+ findWidgets: (criterion: import("../../types").FilterCriterion) => ReadonlyArray<Widget>;
149
+ reviewMode: boolean;
150
+ showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
151
+ onChange: import("../..").ChangeHandler;
152
+ handleUserInput: (newUserInput: PerseusNumberLineUserInput, cb?: () => void, silent?: boolean) => void;
153
+ isLastUsedWidget: boolean;
154
+ linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
155
+ containerSizeClass: import("../../util/sizing-utils").SizeClass;
156
+ };
72
157
  render(): React.ReactNode;
73
158
  }
74
- declare function numberLineTransform(editorProps: NumberLinePublicWidgetOptions): RenderProps;
159
+ declare function transform(editorProps: NumberLinePublicWidgetOptions): RenderProps;
75
160
  declare function staticTransform(editorProps: PerseusNumberLineWidgetOptions): RenderProps;
161
+ /**
162
+ * @deprecated and likely a very broken API
163
+ * [LEMS-3185] do not trust serializedState/restoreSerializedState
164
+ */
165
+ declare function getUserInputFromSerializedState(serializedState: any): PerseusNumberLineUserInput;
166
+ declare function getCorrectUserInput(options: PerseusNumberLineWidgetOptions): PerseusNumberLineUserInput;
167
+ declare function getStartUserInput(options: NumberLinePublicWidgetOptions): PerseusNumberLineUserInput;
76
168
  declare const _default: {
77
169
  name: string;
78
170
  displayName: string;
79
171
  widget: typeof NumberLine;
80
- transform: typeof numberLineTransform;
172
+ transform: typeof transform;
81
173
  staticTransform: typeof staticTransform;
174
+ getCorrectUserInput: typeof getCorrectUserInput;
175
+ getStartUserInput: typeof getStartUserInput;
176
+ getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
82
177
  };
83
178
  export default _default;
@@ -2,7 +2,7 @@ import * as React from "react";
2
2
  import type { FocusPath, 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
- type ExternalProps = WidgetProps<PerseusNumericInputWidgetOptions>;
5
+ type ExternalProps = WidgetProps<PerseusNumericInputWidgetOptions, PerseusNumericInputUserInput>;
6
6
  export type NumericInputProps = ExternalProps & {
7
7
  size: NonNullable<ExternalProps["size"]>;
8
8
  rightAlign: NonNullable<ExternalProps["rightAlign"]>;
@@ -11,9 +11,8 @@ export type NumericInputProps = ExternalProps & {
11
11
  answerForms: ReadonlyArray<PerseusNumericInputAnswerForm>;
12
12
  labelText: string;
13
13
  linterContext: NonNullable<ExternalProps["linterContext"]>;
14
- currentValue: string;
15
14
  };
16
- type DefaultProps = Pick<NumericInputProps, "currentValue" | "size" | "rightAlign" | "apiOptions" | "coefficient" | "answerForms" | "labelText" | "linterContext">;
15
+ type DefaultProps = Pick<NumericInputProps, "size" | "rightAlign" | "apiOptions" | "coefficient" | "answerForms" | "labelText" | "linterContext" | "userInput">;
17
16
  type RenderProps = {
18
17
  answerForms: ReadonlyArray<PerseusNumericInputAnswerForm>;
19
18
  labelText?: string;
@@ -33,17 +32,22 @@ type RenderProps = {
33
32
  export declare class NumericInput extends React.Component<NumericInputProps> implements Widget {
34
33
  inputRef: React.RefObject<Focusable>;
35
34
  static defaultProps: DefaultProps;
36
- static getUserInputFromProps(props: NumericInputProps): PerseusNumericInputUserInput;
37
35
  focus: () => boolean;
38
36
  focusInputPath: () => void;
39
37
  blurInputPath: () => void;
40
38
  getInputPaths: () => ReadonlyArray<ReadonlyArray<string>>;
41
39
  /**
42
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
43
44
  */
44
45
  setInputValue: (path: FocusPath, newValue: string, cb?: () => unknown | null | undefined) => void;
45
46
  /**
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
47
51
  */
48
52
  getUserInput(): PerseusNumericInputUserInput;
49
53
  /**
@@ -51,8 +55,92 @@ export declare class NumericInput extends React.Component<NumericInputProps> imp
51
55
  * This is used by the AI to determine the prompt for the widget.
52
56
  */
53
57
  getPromptJSON(): NumericInputPromptJSON;
58
+ /**
59
+ * @deprecated and likely very broken API
60
+ * [LEMS-3185] do not trust serializedState/restoreSerializedState
61
+ */
62
+ getSerializedState(): {
63
+ currentValue: string;
64
+ answers: import("@khanacademy/perseus-core").PerseusNumericInputAnswer[];
65
+ labelText: string;
66
+ size: string;
67
+ coefficient: boolean;
68
+ rightAlign: boolean;
69
+ static: boolean;
70
+ reviewModeRubric?: Empty | null | undefined;
71
+ trackInteraction: (extraData?: Empty | undefined) => void;
72
+ widgetId: string;
73
+ alignment: string | null | undefined;
74
+ problemNum: number | null | undefined;
75
+ apiOptions: Readonly<Readonly<{
76
+ isArticle?: boolean;
77
+ onFocusChange?: (newFocusPath: FocusPath, oldFocusPath: FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
78
+ GroupMetadataEditor?: React.ComponentType<any>;
79
+ showAlignmentOptions?: boolean;
80
+ readOnly?: boolean;
81
+ answerableCallback?: (arg1: boolean) => unknown;
82
+ getAnotherHint?: () => unknown;
83
+ interactionCallback?: (widgetData: {
84
+ [widgetId: string]: any;
85
+ }) => void;
86
+ groupAnnotator?: (groupNumber: number, widgetId: string) => React.ReactNode;
87
+ imagePlaceholder?: React.ReactNode;
88
+ widgetPlaceholder?: React.ReactNode;
89
+ baseElements?: {
90
+ Link: React.ComponentType<any>;
91
+ };
92
+ imagePreloader?: (dimensions: import("../../types").Dimensions) => React.ReactNode;
93
+ trackInteraction?: (args: {
94
+ type: string;
95
+ id: string;
96
+ correct?: boolean;
97
+ } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
98
+ visible: number;
99
+ }>) => void;
100
+ customKeypad?: boolean;
101
+ nativeKeypadProxy?: (blur: () => void) => import("@khanacademy/math-input").KeypadAPI;
102
+ isMobile?: boolean;
103
+ isMobileApp?: boolean;
104
+ setDrawingAreaAvailable?: (arg1: boolean) => unknown;
105
+ hintProgressColor?: string;
106
+ canScrollPage?: boolean;
107
+ editorChangeDelay?: number;
108
+ flags?: Record<"new-radio-widget", boolean>;
109
+ onWidgetStartProps?: (widgets: import("@khanacademy/perseus-core").PerseusWidgetsMap) => void;
110
+ }> & {
111
+ baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
112
+ canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
113
+ editorChangeDelay: NonNullable<import("../..").APIOptions["editorChangeDelay"]>;
114
+ groupAnnotator: NonNullable<import("../..").APIOptions["groupAnnotator"]>;
115
+ isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
116
+ isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
117
+ isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
118
+ onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
119
+ readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
120
+ setDrawingAreaAvailable: NonNullable<import("../..").APIOptions["setDrawingAreaAvailable"]>;
121
+ showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
122
+ }>;
123
+ keypadElement?: any;
124
+ questionCompleted?: boolean;
125
+ onFocus: (blurPath: FocusPath) => void;
126
+ onBlur: (blurPath: FocusPath) => void;
127
+ findWidgets: (criterion: import("../../types").FilterCriterion) => ReadonlyArray<Widget>;
128
+ reviewMode: boolean;
129
+ showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
130
+ onChange: import("../..").ChangeHandler;
131
+ handleUserInput: (newUserInput: PerseusNumericInputUserInput, cb?: () => void, silent?: boolean) => void;
132
+ isLastUsedWidget: boolean;
133
+ linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
134
+ containerSizeClass: import("../../util/sizing-utils").SizeClass;
135
+ answerForms: ReadonlyArray<PerseusNumericInputAnswerForm>;
136
+ };
54
137
  render(): React.ReactNode;
55
138
  }
139
+ /**
140
+ * @deprecated and likely a very broken API
141
+ * [LEMS-3185] do not trust serializedState/restoreSerializedState
142
+ */
143
+ declare function getUserInputFromSerializedState(serializedState: any): PerseusNumericInputUserInput;
56
144
  declare const _default: {
57
145
  name: string;
58
146
  displayName: string;
@@ -60,5 +148,6 @@ declare const _default: {
60
148
  transform: (widgetOptions: PerseusNumericInputWidgetOptions) => RenderProps;
61
149
  isLintable: true;
62
150
  getOneCorrectAnswerFromRubric(rubric: PerseusNumericInputRubric): string | null | undefined;
151
+ getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
63
152
  };
64
153
  export default _default;
@@ -5,7 +5,7 @@ import type { Focusable } from "../../types";
5
5
  * component. It is responsible for rendering the UI elements of the Numeric
6
6
  * Input widget.
7
7
  */
8
- export declare const NumericInputComponent: React.ForwardRefExoticComponent<import("@khanacademy/perseus-core").PerseusNumericInputWidgetOptions & import("../../types").UniversalWidgetProps<Empty, Empty> & {
8
+ export declare const NumericInputComponent: React.ForwardRefExoticComponent<import("@khanacademy/perseus-core").PerseusNumericInputWidgetOptions & import("../../types").UniversalWidgetProps<Empty, import("@khanacademy/perseus-core").PerseusNumericInputUserInput, Empty> & {
9
9
  size: NonNullable<string>;
10
10
  rightAlign: NonNullable<boolean | undefined>;
11
11
  apiOptions: NonNullable<Readonly<Readonly<{
@@ -60,5 +60,4 @@ export declare const NumericInputComponent: React.ForwardRefExoticComponent<impo
60
60
  answerForms: ReadonlyArray<import("@khanacademy/perseus-core").PerseusNumericInputAnswerForm>;
61
61
  labelText: string;
62
62
  linterContext: NonNullable<import("@khanacademy/perseus-linter").LinterContextProps>;
63
- currentValue: string;
64
63
  } & React.RefAttributes<Focusable>>;
@@ -7,13 +7,10 @@ type Position = {
7
7
  left: number;
8
8
  top: number;
9
9
  };
10
- type RenderProps = OrdererPublicWidgetOptions & {
11
- current: any;
12
- };
13
- type OrdererProps = WidgetProps<RenderProps>;
14
- type OrdererDefaultProps = Pick<OrdererProps, "current" | "options" | "height" | "layout" | "linterContext">;
10
+ type RenderProps = OrdererPublicWidgetOptions;
11
+ type OrdererProps = WidgetProps<RenderProps, PerseusOrdererUserInput>;
12
+ type OrdererDefaultProps = Pick<OrdererProps, "options" | "height" | "layout" | "linterContext" | "userInput">;
15
13
  type OrdererState = {
16
- current: ReadonlyArray<any>;
17
14
  dragging: boolean;
18
15
  placeholderIndex: number | null | undefined;
19
16
  dragKey: string | null | undefined;
@@ -30,22 +27,32 @@ type OrdererState = {
30
27
  declare class Orderer extends React.Component<OrdererProps, OrdererState> implements Widget {
31
28
  static defaultProps: OrdererDefaultProps;
32
29
  state: OrdererState;
33
- UNSAFE_componentWillReceiveProps(nextProps: OrdererProps): void;
34
30
  onClick: (arg1: string, arg2: number, arg3: any, arg4: Element) => void;
35
31
  onRelease: (arg1: any) => void;
36
32
  onMouseMove: (arg1: any) => void;
37
33
  findCorrectIndex: (arg1: any, arg2: any) => any;
38
34
  isCardInBank: (arg1: any) => boolean;
39
- setListValues: (arg1: ReadonlyArray<string>) => void;
35
+ setListValues: (values: string[]) => void;
40
36
  getUserInput(): PerseusOrdererUserInput;
41
37
  getPromptJSON(): OrdererPromptJSON;
38
+ /**
39
+ * @deprecated and likely very broken API
40
+ * [LEMS-3185] do not trust serializedState/restoreSerializedState
41
+ */
42
+ getSerializedState(): any;
42
43
  render(): React.ReactNode;
43
44
  }
45
+ /**
46
+ * @deprecated and likely a very broken API
47
+ * [LEMS-3185] do not trust serializedState/restoreSerializedState
48
+ */
49
+ declare function getUserInputFromSerializedState(serializedState: any): PerseusOrdererUserInput;
44
50
  declare const _default: {
45
51
  name: string;
46
52
  displayName: string;
47
53
  hidden: true;
48
54
  widget: typeof Orderer;
49
55
  isLintable: true;
56
+ getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
50
57
  };
51
58
  export default _default;
@@ -1,7 +1,7 @@
1
1
  import { type PerseusPassageRefWidgetOptions } from "@khanacademy/perseus-core";
2
2
  import * as React from "react";
3
3
  import { PerseusI18nContext } from "../../components/i18n-context";
4
- import type { ChangeFn, Widget, WidgetProps } from "../../types";
4
+ import type { Widget, WidgetProps } from "../../types";
5
5
  import type { PassageRefPromptJSON } from "../../widget-ai-utils/passage-ref/passage-ref-ai-utils";
6
6
  type RenderProps = {
7
7
  passageNumber: PerseusPassageRefWidgetOptions["passageNumber"];
@@ -31,7 +31,6 @@ declare class PassageRef extends React.Component<Props, State> implements Widget
31
31
  shouldComponentUpdate(nextProps: Props, nextState: State): boolean;
32
32
  componentDidUpdate(): void;
33
33
  componentWillUnmount(): void;
34
- change: ChangeFn;
35
34
  getPromptJSON(): PassageRefPromptJSON;
36
35
  _deferredUpdateRange: () => void;
37
36
  _updateRange: () => void;
@@ -1,10 +1,9 @@
1
1
  import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
- import * as Changeable from "../../mixins/changeable";
4
3
  import type { APIOptions, Widget } from "../../types";
5
4
  import type { PerseusPassageRefTargetWidgetOptions } from "@khanacademy/perseus-core";
6
5
  import type { LinterContextProps } from "@khanacademy/perseus-linter";
7
- type Props = Changeable.ChangeableProps & {
6
+ type Props = {
8
7
  apiOptions: APIOptions;
9
8
  content: PerseusPassageRefTargetWidgetOptions["content"];
10
9
  linterContext: LinterContextProps;
@@ -18,7 +17,6 @@ declare class PassageRefTarget extends React.Component<Props> implements Widget
18
17
  context: React.ContextType<typeof PerseusI18nContext>;
19
18
  static defaultProps: DefaultProps;
20
19
  isWidget: true;
21
- change: (arg1: any, arg2: any, arg3: any) => any;
22
20
  render(): React.ReactNode;
23
21
  }
24
22
  declare const _default: {
@@ -7,8 +7,7 @@ import { PerseusI18nContext } from "../../components/i18n-context";
7
7
  import type { WidgetProps, Widget } from "../../types";
8
8
  import type { UnsupportedWidgetPromptJSON } from "../../widget-ai-utils/unsupported-widget";
9
9
  import type { PerseusPhetSimulationWidgetOptions } from "@khanacademy/perseus-core";
10
- type RenderProps = PerseusPhetSimulationWidgetOptions;
11
- type Props = WidgetProps<RenderProps>;
10
+ type Props = WidgetProps<PerseusPhetSimulationWidgetOptions>;
12
11
  type State = {
13
12
  banner: {
14
13
  message: string;
@@ -4,8 +4,7 @@ import type { Widget, WidgetProps } from "../../types";
4
4
  import type { UnsupportedWidgetPromptJSON } from "../../widget-ai-utils/unsupported-widget";
5
5
  import type { PerseusPlotterWidgetOptions, PerseusPlotterUserInput } from "@khanacademy/perseus-core";
6
6
  import type { PlotterPublicWidgetOptions } from "@khanacademy/perseus-core/src/widgets/plotter/plotter-util";
7
- type RenderProps = PlotterPublicWidgetOptions;
8
- type Props = WidgetProps<RenderProps> & {
7
+ type Props = WidgetProps<PlotterPublicWidgetOptions, PerseusPlotterUserInput> & {
9
8
  labelInterval: NonNullable<PerseusPlotterWidgetOptions["labelInterval"]>;
10
9
  picSize: NonNullable<PerseusPlotterWidgetOptions["picSize"]>;
11
10
  };
@@ -23,7 +22,6 @@ type DefaultProps = {
23
22
  labelInterval: Props["labelInterval"];
24
23
  };
25
24
  type State = {
26
- values: number[];
27
25
  categoryHeights: Record<string, number>;
28
26
  };
29
27
  export declare class Plotter extends React.Component<Props, State> implements Widget {
@@ -44,7 +42,7 @@ export declare class Plotter extends React.Component<Props, State> implements Wi
44
42
  DOT_PLOT_POINT_SIZE: () => number;
45
43
  DOT_PLOT_POINT_PADDING: () => number;
46
44
  DOT_TICK_POINT_SIZE: () => number;
47
- setupGraphie: (arg1: any) => void;
45
+ setupGraphie(prevValues: number[]): void;
48
46
  showHairlines: (arg1: any) => void;
49
47
  hideHairlines: () => void;
50
48
  labelCategory: (arg1: any, arg2: any) => Promise<any>;
@@ -64,17 +62,118 @@ export declare class Plotter extends React.Component<Props, State> implements Wi
64
62
  setupPic: (arg1: any, arg2: any) => any;
65
63
  setupTiledPlot: (arg1: any, arg2: any, arg3: any, arg4: any) => any;
66
64
  setPicHeight: (arg1: number, arg2: number) => void;
67
- changeAndTrack: (arg1: any) => void;
68
- drawPicHeights: (arg1: any, arg2: any) => void;
65
+ changeAndTrack: (userInput: PerseusPlotterUserInput) => void;
66
+ /**
67
+ * Plotter uses Graphie and Graphie is inaccessible,
68
+ * this helps us populate user input in tests
69
+ * (not great, but not a lot of options)
70
+ *
71
+ * @internal
72
+ */
73
+ _testInsertUserInput(userInput: PerseusPlotterUserInput): void;
74
+ drawPicHeights(values: number[], prevValues: number[]): void;
69
75
  getUserInput(): PerseusPlotterUserInput;
70
76
  getPromptJSON(): UnsupportedWidgetPromptJSON;
77
+ /**
78
+ * @deprecated and likely very broken API
79
+ * [LEMS-3185] do not trust serializedState/restoreSerializedState
80
+ */
81
+ getSerializedState(): {
82
+ values: PerseusPlotterUserInput;
83
+ type: import("@khanacademy/perseus-core").PlotType;
84
+ labels: string[];
85
+ categories: string[];
86
+ maxY: number;
87
+ scaleY: number;
88
+ labelInterval: number;
89
+ snapsPerLine: number;
90
+ starting: number[];
91
+ picUrl?: string | null;
92
+ picSize: number;
93
+ picBoxHeight?: number | null;
94
+ plotDimensions: number[];
95
+ reviewModeRubric?: Empty | null | undefined;
96
+ trackInteraction: (extraData?: Empty | undefined) => void;
97
+ widgetId: string;
98
+ alignment: string | null | undefined;
99
+ static: boolean | null | undefined;
100
+ problemNum: number | null | undefined;
101
+ apiOptions: Readonly<Readonly<{
102
+ isArticle?: boolean;
103
+ onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
104
+ GroupMetadataEditor?: React.ComponentType<any>;
105
+ showAlignmentOptions?: boolean;
106
+ readOnly?: boolean;
107
+ answerableCallback?: (arg1: boolean) => unknown;
108
+ getAnotherHint?: () => unknown;
109
+ interactionCallback?: (widgetData: {
110
+ [widgetId: string]: any;
111
+ }) => void;
112
+ groupAnnotator?: (groupNumber: number, widgetId: string) => React.ReactNode;
113
+ imagePlaceholder?: React.ReactNode;
114
+ widgetPlaceholder?: React.ReactNode;
115
+ baseElements?: {
116
+ Link: React.ComponentType<any>;
117
+ };
118
+ imagePreloader?: (dimensions: import("../../types").Dimensions) => React.ReactNode;
119
+ trackInteraction?: (args: {
120
+ type: string;
121
+ id: string;
122
+ correct?: boolean;
123
+ } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
124
+ visible: number;
125
+ }>) => void;
126
+ customKeypad?: boolean;
127
+ nativeKeypadProxy?: (blur: () => void) => import("@khanacademy/math-input").KeypadAPI;
128
+ isMobile?: boolean;
129
+ isMobileApp?: boolean;
130
+ setDrawingAreaAvailable?: (arg1: boolean) => unknown;
131
+ hintProgressColor?: string;
132
+ canScrollPage?: boolean;
133
+ editorChangeDelay?: number;
134
+ flags?: Record<"new-radio-widget", boolean>;
135
+ onWidgetStartProps?: (widgets: import("@khanacademy/perseus-core").PerseusWidgetsMap) => void;
136
+ }> & {
137
+ baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
138
+ canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
139
+ editorChangeDelay: NonNullable<import("../..").APIOptions["editorChangeDelay"]>;
140
+ groupAnnotator: NonNullable<import("../..").APIOptions["groupAnnotator"]>;
141
+ isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
142
+ isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
143
+ isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
144
+ onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
145
+ readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
146
+ setDrawingAreaAvailable: NonNullable<import("../..").APIOptions["setDrawingAreaAvailable"]>;
147
+ showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
148
+ }>;
149
+ keypadElement?: any;
150
+ questionCompleted?: boolean;
151
+ onFocus: (blurPath: import("../..").FocusPath) => void;
152
+ onBlur: (blurPath: import("../..").FocusPath) => void;
153
+ findWidgets: (criterion: import("../../types").FilterCriterion) => ReadonlyArray<Widget>;
154
+ reviewMode: boolean;
155
+ showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
156
+ onChange: import("../..").ChangeHandler;
157
+ handleUserInput: (newUserInput: PerseusPlotterUserInput, cb?: () => void, silent?: boolean) => void;
158
+ isLastUsedWidget: boolean;
159
+ linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
160
+ containerSizeClass: import("../../util/sizing-utils").SizeClass;
161
+ };
71
162
  render(): React.ReactNode;
72
163
  }
164
+ declare function getStartUserInput(options: PlotterPublicWidgetOptions): PerseusPlotterUserInput;
165
+ /**
166
+ * @deprecated and likely a very broken API
167
+ * [LEMS-3185] do not trust serializedState/restoreSerializedState
168
+ */
169
+ declare function getUserInputFromSerializedState(serializedState: any): PerseusPlotterUserInput;
73
170
  declare const _default: {
74
171
  name: string;
75
172
  displayName: string;
76
173
  hidden: true;
77
174
  widget: typeof Plotter;
78
175
  staticTransform: <T>(value: T) => T;
176
+ getStartUserInput: typeof getStartUserInput;
177
+ getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
79
178
  };
80
179
  export default _default;
@@ -16,7 +16,7 @@ export type RenderProps = {
16
16
  choiceStates?: ChoiceState[];
17
17
  values?: boolean[];
18
18
  };
19
- type Props = WidgetProps<RenderProps, PerseusRadioRubric>;
19
+ type Props = WidgetProps<RenderProps, PerseusRadioUserInput, PerseusRadioRubric>;
20
20
  type DefaultProps = Required<Pick<Props, "choices" | "multipleSelect" | "countChoices" | "deselectEnabled" | "linterContext" | "showSolutions">>;
21
21
  export type RadioChoiceWithMetadata = PerseusRadioChoice & {
22
22
  originalIndex: number;
@@ -13,7 +13,7 @@ export type RenderProps = {
13
13
  choiceStates?: ReadonlyArray<ChoiceState>;
14
14
  values?: ReadonlyArray<boolean>;
15
15
  };
16
- type Props = WidgetProps<RenderProps, PerseusRadioRubric>;
16
+ type Props = WidgetProps<RenderProps, PerseusRadioUserInput, PerseusRadioRubric>;
17
17
  type DefaultProps = Required<Pick<Props, "choices" | "multipleSelect" | "countChoices" | "deselectEnabled" | "linterContext" | "showSolutions">>;
18
18
  export interface RadioChoiceWithMetadata extends PerseusRadioChoice {
19
19
  originalIndex: number;
@@ -10,5 +10,9 @@ declare const _default: {
10
10
  staticTransform: (widgetOptions: PerseusRadioWidgetOptions, strings: PerseusStrings, problemNum?: number | null) => RenderProps;
11
11
  version: import("@khanacademy/perseus-core").Version | undefined;
12
12
  isLintable: true;
13
+ /**
14
+ * @deprecated - do not use in new code.
15
+ */
16
+ getUserInputFromSerializedState: typeof import("./radio-component").default.getUserInputFromProps;
13
17
  };
14
18
  export default _default;
@@ -2,8 +2,8 @@ import * as React from "react";
2
2
  import RadioOld from "./radio-component";
3
3
  import type { RenderProps } from "./radio-component";
4
4
  import type { WidgetProps } from "../../types";
5
- import type { PerseusRadioRubric } from "@khanacademy/perseus-core";
6
- type Props = WidgetProps<RenderProps, PerseusRadioRubric>;
5
+ import type { PerseusRadioRubric, PerseusRadioUserInput } from "@khanacademy/perseus-core";
6
+ type Props = WidgetProps<RenderProps, PerseusRadioUserInput, PerseusRadioRubric>;
7
7
  /**
8
8
  * This is a wrapper around the old radio widget that allows us to
9
9
  * conditionally render the new radio widget when the feature flag is on.
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import type { WidgetProps, ChoiceState } from "../../types";
3
- import type { PerseusRadioChoice, ShowSolutions, PerseusRadioRubric } from "@khanacademy/perseus-core";
3
+ import type { PerseusRadioChoice, ShowSolutions, PerseusRadioRubric, PerseusRadioUserInput } from "@khanacademy/perseus-core";
4
4
  export interface RadioChoiceWithMetadata extends PerseusRadioChoice {
5
5
  originalIndex: number;
6
6
  correct?: boolean;
@@ -17,7 +17,7 @@ export interface RenderProps {
17
17
  choiceStates?: ReadonlyArray<ChoiceState>;
18
18
  values?: ReadonlyArray<boolean>;
19
19
  }
20
- type RadioComponentProps = WidgetProps<RenderProps, PerseusRadioRubric>;
20
+ type RadioComponentProps = WidgetProps<RenderProps, PerseusRadioUserInput, PerseusRadioRubric>;
21
21
  /**
22
22
  * This component is a duplicate of the Radio component in radio.tsx
23
23
  * for the Radio Revitalization Project. (LEMS-2933)