@khanacademy/perseus 71.6.0 → 72.1.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.
@@ -118,7 +118,6 @@ declare const _default: React.ForwardRefExoticComponent<Omit<Pick<SharedRenderer
118
118
  apiOptions?: Readonly<{
119
119
  isArticle?: boolean;
120
120
  onFocusChange?: (newFocusPath: FocusPath, oldFocusPath: FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
121
- GroupMetadataEditor?: React.ComponentType<any>;
122
121
  showAlignmentOptions?: boolean;
123
122
  readOnly?: boolean;
124
123
  editingDisabled?: boolean;
@@ -127,7 +126,6 @@ declare const _default: React.ForwardRefExoticComponent<Omit<Pick<SharedRenderer
127
126
  interactionCallback?: (widgetData: {
128
127
  [widgetId: string]: any;
129
128
  }) => void;
130
- groupAnnotator?: (groupNumber: number, widgetId: string) => React.ReactNode;
131
129
  imagePlaceholder?: React.ReactNode;
132
130
  widgetPlaceholder?: React.ReactNode;
133
131
  baseElements?: {
package/dist/types.d.ts CHANGED
@@ -90,7 +90,6 @@ export type ChangeHandler = (arg1: {
90
90
  }, callback?: () => void, silent?: boolean) => unknown;
91
91
  export type ImageUploader = (file: File, callback: (url: string) => unknown) => unknown;
92
92
  export type Path = ReadonlyArray<string>;
93
- type StubTagEditorType = any;
94
93
  type TrackInteractionArgs = {
95
94
  type: string;
96
95
  id: string;
@@ -109,10 +108,6 @@ export type GenerateUrlArgs = {
109
108
  export type APIOptions = Readonly<{
110
109
  isArticle?: boolean;
111
110
  onFocusChange?: (newFocusPath: FocusPath, oldFocusPath: FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
112
- /**
113
- * @deprecated - metadata is no longer used by the Group widget
114
- */
115
- GroupMetadataEditor?: React.ComponentType<StubTagEditorType>;
116
111
  showAlignmentOptions?: boolean;
117
112
  /**
118
113
  * A boolean that indicates whether the associated problem has been
@@ -129,14 +124,6 @@ export type APIOptions = Readonly<{
129
124
  interactionCallback?: (widgetData: {
130
125
  [widgetId: string]: any;
131
126
  }) => void;
132
- /**
133
- * A function that takes in the relative problem number (starts at
134
- * 0 and is incremented for each group widget), and the ID of the
135
- * group widget, then returns a react component that will be added
136
- * immediately above the renderer in the group widget. If the
137
- * function returns null, no annotation will be added.
138
- */
139
- groupAnnotator?: (groupNumber: number, widgetId: string) => React.ReactNode;
140
127
  /**
141
128
  * If imagePlaceholder is set, Perseus will render the placeholder instead
142
129
  * of the image node.
@@ -328,7 +315,6 @@ export type APIOptionsWithDefaults = Readonly<APIOptions & {
328
315
  baseElements: NonNullable<APIOptions["baseElements"]>;
329
316
  canScrollPage: NonNullable<APIOptions["canScrollPage"]>;
330
317
  editorChangeDelay: NonNullable<APIOptions["editorChangeDelay"]>;
331
- groupAnnotator: NonNullable<APIOptions["groupAnnotator"]>;
332
318
  isArticle: NonNullable<APIOptions["isArticle"]>;
333
319
  isMobile: NonNullable<APIOptions["isMobile"]>;
334
320
  isMobileApp: NonNullable<APIOptions["isMobileApp"]>;
package/dist/util.d.ts CHANGED
@@ -167,7 +167,6 @@ declare const Util: {
167
167
  readonly rTypeFromWidgetId: RegExp;
168
168
  readonly rWidgetParts: RegExp;
169
169
  readonly snowman: "☃";
170
- readonly split: (str: string, r: RegExp) => ReadonlyArray<string>;
171
170
  readonly firstNumericalParse: typeof firstNumericalParse;
172
171
  readonly stringArrayOfSize: typeof stringArrayOfSize;
173
172
  readonly stringArrayOfSize2D: typeof stringArrayOfSize2D;
@@ -1,11 +1,12 @@
1
1
  import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
- import type { Widget, WidgetProps } from "../../types";
3
+ import type { PerseusDependenciesV2, Widget, WidgetProps } from "../../types";
4
4
  import type { CategorizerPromptJSON } from "../../widget-ai-utils/categorizer/categorizer-ai-utils";
5
5
  import type { PerseusCategorizerWidgetOptions, PerseusCategorizerUserInput } from "@khanacademy/perseus-core";
6
6
  type ExternalProps = WidgetProps<PerseusCategorizerWidgetOptions, PerseusCategorizerUserInput>;
7
7
  type Props = ExternalProps & {
8
8
  linterContext: NonNullable<ExternalProps["linterContext"]>;
9
+ dependencies: PerseusDependenciesV2;
9
10
  };
10
11
  type DefaultProps = Pick<Props, "items" | "categories" | "linterContext" | "userInput">;
11
12
  type State = {
@@ -16,6 +17,7 @@ export declare class Categorizer extends React.Component<Props, State> implement
16
17
  context: React.ContextType<typeof PerseusI18nContext>;
17
18
  static defaultProps: DefaultProps;
18
19
  state: State;
20
+ componentDidMount(): void;
19
21
  /**
20
22
  * @deprecated and likely very broken API
21
23
  * [LEMS-3185] do not trust serializedState
@@ -40,7 +42,7 @@ declare const _default: {
40
42
  name: string;
41
43
  displayName: string;
42
44
  hidden: true;
43
- widget: typeof Categorizer;
45
+ widget: React.ForwardRefExoticComponent<Omit<Props, "dependencies"> & React.RefAttributes<any>>;
44
46
  getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
45
47
  getCorrectUserInput: typeof getCorrectUserInput;
46
48
  getStartUserInput: typeof getStartUserInput;
@@ -1,26 +1,13 @@
1
1
  import * as React from "react";
2
- import { PerseusI18nContext } from "../../components/i18n-context";
3
- import type { Widget, WidgetProps } from "../../types";
4
- import type { DefinitionPromptJSON } from "../../widget-ai-utils/definition/definition-ai-utils";
2
+ import type { PerseusDependenciesV2, WidgetProps } from "../../types";
5
3
  import type { PerseusDefinitionWidgetOptions, PerseusRenderer } from "@khanacademy/perseus-core";
6
4
  type DefinitionProps = WidgetProps<PerseusDefinitionWidgetOptions> & {
7
5
  widgets: PerseusRenderer["widgets"];
6
+ dependencies: PerseusDependenciesV2;
8
7
  };
9
- type DefaultProps = {
10
- togglePrompt: string;
11
- definition: string;
12
- };
13
- declare class Definition extends React.Component<DefinitionProps> implements Widget {
14
- static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
15
- context: React.ContextType<typeof PerseusI18nContext>;
16
- static defaultProps: DefaultProps;
17
- isWidget: true;
18
- getPromptJSON(): DefinitionPromptJSON;
19
- render(): React.ReactNode;
20
- }
21
8
  declare const _default: {
22
9
  name: string;
23
10
  displayName: string;
24
- widget: typeof Definition;
11
+ widget: React.ForwardRefExoticComponent<Omit<DefinitionProps, "dependencies"> & React.RefAttributes<any>>;
25
12
  };
26
13
  export default _default;
@@ -1,30 +1,9 @@
1
1
  import * as React from "react";
2
- import { PerseusI18nContext } from "../../components/i18n-context";
3
- import type { Widget, WidgetProps } from "../../types";
4
- import type { DropdownPromptJSON } from "../../widget-ai-utils/dropdown/dropdown-ai-utils";
2
+ import type { PerseusDependenciesV2, WidgetProps } from "../../types";
5
3
  import type { PerseusDropdownUserInput, PerseusDropdownWidgetOptions } from "@khanacademy/perseus-core";
6
- type Props = WidgetProps<PerseusDropdownWidgetOptions, PerseusDropdownUserInput>;
7
- type DefaultProps = {
8
- choices: Props["choices"];
9
- placeholder: Props["placeholder"];
10
- apiOptions: Props["apiOptions"];
11
- userInput: Props["userInput"];
4
+ type Props = WidgetProps<PerseusDropdownWidgetOptions, PerseusDropdownUserInput> & {
5
+ dependencies: PerseusDependenciesV2;
12
6
  };
13
- declare class Dropdown extends React.Component<Props> implements Widget {
14
- static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
15
- context: React.ContextType<typeof PerseusI18nContext>;
16
- static defaultProps: DefaultProps;
17
- focus: () => boolean;
18
- _handleChangeEvent: (arg1: React.ChangeEvent<HTMLInputElement>) => void;
19
- _handleChange: (arg1: number) => void;
20
- getPromptJSON(): DropdownPromptJSON;
21
- /**
22
- * @deprecated and likely very broken API
23
- * [LEMS-3185] do not trust serializedState
24
- */
25
- getSerializedState(): any;
26
- render(): React.ReactNode;
27
- }
28
7
  /**
29
8
  * @deprecated and likely a very broken API
30
9
  * [LEMS-3185] do not trust serializedState
@@ -35,7 +14,7 @@ declare function getCorrectUserInput(options: PerseusDropdownWidgetOptions): Per
35
14
  declare const _default: {
36
15
  name: string;
37
16
  displayName: string;
38
- widget: typeof Dropdown;
17
+ widget: React.ForwardRefExoticComponent<Omit<Props, "dependencies"> & React.RefAttributes<any>>;
39
18
  getStartUserInput: typeof getStartUserInput;
40
19
  getCorrectUserInput: typeof getCorrectUserInput;
41
20
  getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
@@ -1,36 +1,13 @@
1
1
  import * as React from "react";
2
- import { PerseusI18nContext } from "../../components/i18n-context";
3
- import type { Widget, WidgetProps } from "../../types";
4
- import type { ExplanationPromptJSON } from "../../widget-ai-utils/explanation/explanation-ai-utils";
2
+ import type { PerseusDependenciesV2, WidgetProps } from "../../types";
5
3
  import type { PerseusExplanationWidgetOptions } from "@khanacademy/perseus-core";
6
- type Props = WidgetProps<PerseusExplanationWidgetOptions>;
7
- type DefaultProps = {
8
- showPrompt: Props["showPrompt"];
9
- hidePrompt: Props["hidePrompt"];
10
- explanation: Props["explanation"];
11
- widgets: Props["widgets"];
12
- linterContext: Props["linterContext"];
4
+ type Props = WidgetProps<PerseusExplanationWidgetOptions> & {
5
+ dependencies: PerseusDependenciesV2;
13
6
  };
14
- type State = {
15
- expanded: boolean;
16
- };
17
- declare class Explanation extends React.Component<Props, State> implements Widget {
18
- static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
19
- context: React.ContextType<typeof PerseusI18nContext>;
20
- static defaultProps: DefaultProps;
21
- isWidget: true;
22
- state: State;
23
- _mounted: boolean;
24
- componentDidMount(): void;
25
- componentWillUnmount(): void;
26
- _onClick: () => void;
27
- getPromptJSON(): ExplanationPromptJSON;
28
- render(): React.ReactNode;
29
- }
30
7
  declare const _default: {
31
8
  name: string;
32
9
  displayName: string;
33
- widget: typeof Explanation;
10
+ widget: React.ForwardRefExoticComponent<Omit<Props, "dependencies"> & React.RefAttributes<any>>;
34
11
  isLintable: true;
35
12
  };
36
13
  export default _default;
@@ -70,7 +70,6 @@ export declare class Expression extends React.Component<Props> implements Widget
70
70
  apiOptions: Readonly<Readonly<{
71
71
  isArticle?: boolean;
72
72
  onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
73
- GroupMetadataEditor?: React.ComponentType<any>;
74
73
  showAlignmentOptions?: boolean;
75
74
  readOnly?: boolean;
76
75
  editingDisabled?: boolean;
@@ -79,7 +78,6 @@ export declare class Expression extends React.Component<Props> implements Widget
79
78
  interactionCallback?: (widgetData: {
80
79
  [widgetId: string]: any;
81
80
  }) => void;
82
- groupAnnotator?: (groupNumber: number, widgetId: string) => React.ReactNode;
83
81
  imagePlaceholder?: React.ReactNode;
84
82
  widgetPlaceholder?: React.ReactNode;
85
83
  baseElements?: {
@@ -106,7 +104,6 @@ export declare class Expression extends React.Component<Props> implements Widget
106
104
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
107
105
  canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
108
106
  editorChangeDelay: NonNullable<import("../..").APIOptions["editorChangeDelay"]>;
109
- groupAnnotator: NonNullable<import("../..").APIOptions["groupAnnotator"]>;
110
107
  isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
111
108
  isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
112
109
  isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
@@ -157,7 +154,6 @@ declare const _default: {
157
154
  apiOptions: Readonly<Readonly<{
158
155
  isArticle?: boolean;
159
156
  onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
160
- GroupMetadataEditor?: React.ComponentType<any>;
161
157
  showAlignmentOptions?: boolean;
162
158
  readOnly?: boolean;
163
159
  editingDisabled?: boolean;
@@ -166,7 +162,6 @@ declare const _default: {
166
162
  interactionCallback?: (widgetData: {
167
163
  [widgetId: string]: any;
168
164
  }) => void;
169
- groupAnnotator?: (groupNumber: number, widgetId: string) => React.ReactNode;
170
165
  imagePlaceholder?: React.ReactNode;
171
166
  widgetPlaceholder?: React.ReactNode;
172
167
  baseElements?: {
@@ -193,7 +188,6 @@ declare const _default: {
193
188
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
194
189
  canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
195
190
  editorChangeDelay: NonNullable<import("../..").APIOptions["editorChangeDelay"]>;
196
- groupAnnotator: NonNullable<import("../..").APIOptions["groupAnnotator"]>;
197
191
  isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
198
192
  isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
199
193
  isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
@@ -231,7 +225,6 @@ declare const _default: {
231
225
  apiOptions?: Readonly<Readonly<{
232
226
  isArticle?: boolean;
233
227
  onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
234
- GroupMetadataEditor?: React.ComponentType<any>;
235
228
  showAlignmentOptions?: boolean;
236
229
  readOnly?: boolean;
237
230
  editingDisabled?: boolean;
@@ -240,7 +233,6 @@ declare const _default: {
240
233
  interactionCallback?: (widgetData: {
241
234
  [widgetId: string]: any;
242
235
  }) => void;
243
- groupAnnotator?: (groupNumber: number, widgetId: string) => React.ReactNode;
244
236
  imagePlaceholder?: React.ReactNode;
245
237
  widgetPlaceholder?: React.ReactNode;
246
238
  baseElements?: {
@@ -267,7 +259,6 @@ declare const _default: {
267
259
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
268
260
  canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
269
261
  editorChangeDelay: NonNullable<import("../..").APIOptions["editorChangeDelay"]>;
270
- groupAnnotator: NonNullable<import("../..").APIOptions["groupAnnotator"]>;
271
262
  isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
272
263
  isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
273
264
  isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
@@ -61,7 +61,6 @@ declare class Grapher extends React.Component<Props> implements Widget {
61
61
  apiOptions: Readonly<Readonly<{
62
62
  isArticle?: boolean;
63
63
  onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
64
- GroupMetadataEditor?: React.ComponentType<any>;
65
64
  showAlignmentOptions?: boolean;
66
65
  readOnly?: boolean;
67
66
  editingDisabled?: boolean;
@@ -70,7 +69,6 @@ declare class Grapher extends React.Component<Props> implements Widget {
70
69
  interactionCallback?: (widgetData: {
71
70
  [widgetId: string]: any;
72
71
  }) => void;
73
- groupAnnotator?: (groupNumber: number, widgetId: string) => React.ReactNode;
74
72
  imagePlaceholder?: React.ReactNode;
75
73
  widgetPlaceholder?: React.ReactNode;
76
74
  baseElements?: {
@@ -97,7 +95,6 @@ declare class Grapher extends React.Component<Props> implements Widget {
97
95
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
98
96
  canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
99
97
  editorChangeDelay: NonNullable<import("../..").APIOptions["editorChangeDelay"]>;
100
- groupAnnotator: NonNullable<import("../..").APIOptions["groupAnnotator"]>;
101
98
  isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
102
99
  isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
103
100
  isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
@@ -1,7 +1,5 @@
1
1
  import * as React from "react";
2
- import { PerseusI18nContext } from "../../components/i18n-context";
3
- import type { Path, Widget, WidgetProps } from "../../types";
4
- import type { InputNumberPromptJSON } from "../../widget-ai-utils/input-number/input-number-ai-utils";
2
+ import type { PerseusDependenciesV2, WidgetProps } from "../../types";
5
3
  import type { PerseusInputNumberWidgetOptions, PerseusInputNumberUserInput } from "@khanacademy/perseus-core";
6
4
  type ExternalProps = WidgetProps<PerseusInputNumberWidgetOptions, PerseusInputNumberUserInput>;
7
5
  type Props = ExternalProps & {
@@ -10,29 +8,8 @@ type Props = ExternalProps & {
10
8
  rightAlign: NonNullable<ExternalProps["rightAlign"]>;
11
9
  size: NonNullable<ExternalProps["size"]>;
12
10
  answerType: NonNullable<ExternalProps["answerType"]>;
11
+ dependencies: PerseusDependenciesV2;
13
12
  };
14
- type DefaultProps = Pick<Props, "answerType" | "apiOptions" | "linterContext" | "rightAlign" | "size" | "userInput">;
15
- declare class InputNumber extends React.Component<Props> implements Widget {
16
- static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
17
- context: React.ContextType<typeof PerseusI18nContext>;
18
- static defaultProps: DefaultProps;
19
- shouldShowExamples: () => boolean;
20
- handleChange: (arg1: string, arg2: () => void) => void;
21
- _handleFocus: () => void;
22
- _handleBlur: () => void;
23
- focus: () => boolean;
24
- focusInputPath: (arg1: Path) => void;
25
- blurInputPath: (arg1: Path) => void;
26
- getInputPaths: () => ReadonlyArray<Path>;
27
- getPromptJSON(): InputNumberPromptJSON;
28
- examples(): ReadonlyArray<string>;
29
- /**
30
- * @deprecated and likely very broken API
31
- * [LEMS-3185] do not trust serializedState
32
- */
33
- getSerializedState(): any;
34
- render(): React.ReactNode;
35
- }
36
13
  declare function getOneCorrectAnswerFromRubric(rubric: any): string | undefined;
37
14
  /**
38
15
  * @deprecated and likely a very broken API
@@ -45,7 +22,7 @@ declare const _default: {
45
22
  name: string;
46
23
  displayName: string;
47
24
  hidden: true;
48
- widget: typeof InputNumber;
25
+ widget: React.ForwardRefExoticComponent<Omit<Props, "dependencies"> & React.RefAttributes<any>>;
49
26
  isLintable: true;
50
27
  getOneCorrectAnswerFromRubric: typeof getOneCorrectAnswerFromRubric;
51
28
  getStartUserInput: typeof getStartUserInput;
@@ -162,7 +162,6 @@ declare class InteractiveGraph extends React.Component<Props, State> {
162
162
  apiOptions: Readonly<Readonly<{
163
163
  isArticle?: boolean;
164
164
  onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
165
- GroupMetadataEditor?: React.ComponentType<any>;
166
165
  showAlignmentOptions?: boolean;
167
166
  readOnly?: boolean;
168
167
  editingDisabled?: boolean;
@@ -171,7 +170,6 @@ declare class InteractiveGraph extends React.Component<Props, State> {
171
170
  interactionCallback?: (widgetData: {
172
171
  [widgetId: string]: any;
173
172
  }) => void;
174
- groupAnnotator?: (groupNumber: number, widgetId: string) => React.ReactNode;
175
173
  imagePlaceholder?: React.ReactNode;
176
174
  widgetPlaceholder?: React.ReactNode;
177
175
  baseElements?: {
@@ -198,7 +196,6 @@ declare class InteractiveGraph extends React.Component<Props, State> {
198
196
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
199
197
  canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
200
198
  editorChangeDelay: NonNullable<import("../..").APIOptions["editorChangeDelay"]>;
201
- groupAnnotator: NonNullable<import("../..").APIOptions["groupAnnotator"]>;
202
199
  isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
203
200
  isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
204
201
  isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
@@ -121,7 +121,6 @@ declare const _default: {
121
121
  apiOptions: Readonly<Readonly<{
122
122
  isArticle?: boolean;
123
123
  onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
124
- GroupMetadataEditor?: React.ComponentType<any>;
125
124
  showAlignmentOptions?: boolean;
126
125
  readOnly?: boolean;
127
126
  editingDisabled?: boolean;
@@ -130,7 +129,6 @@ declare const _default: {
130
129
  interactionCallback?: (widgetData: {
131
130
  [widgetId: string]: any;
132
131
  }) => void;
133
- groupAnnotator?: (groupNumber: number, widgetId: string) => React.ReactNode;
134
132
  imagePlaceholder?: React.ReactNode;
135
133
  widgetPlaceholder?: React.ReactNode;
136
134
  baseElements?: {
@@ -157,7 +155,6 @@ declare const _default: {
157
155
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
158
156
  canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
159
157
  editorChangeDelay: NonNullable<import("../..").APIOptions["editorChangeDelay"]>;
160
- groupAnnotator: NonNullable<import("../..").APIOptions["groupAnnotator"]>;
161
158
  isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
162
159
  isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
163
160
  isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
@@ -1,10 +1,12 @@
1
1
  import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { SortableOption } from "../../components/sortable";
4
- import type { WidgetProps, Widget } from "../../types";
4
+ import type { WidgetProps, Widget, PerseusDependenciesV2 } from "../../types";
5
5
  import type { MatcherPromptJSON } from "../../widget-ai-utils/matcher/matcher-ai-utils";
6
6
  import type { PerseusMatcherWidgetOptions, PerseusMatcherUserInput, MatcherPublicWidgetOptions } from "@khanacademy/perseus-core";
7
- type Props = WidgetProps<PerseusMatcherWidgetOptions, PerseusMatcherUserInput>;
7
+ type Props = WidgetProps<PerseusMatcherWidgetOptions, PerseusMatcherUserInput> & {
8
+ dependencies: PerseusDependenciesV2;
9
+ };
8
10
  type DefaultProps = {
9
11
  labels: Props["labels"];
10
12
  orderMatters: Props["orderMatters"];
@@ -23,6 +25,7 @@ export declare class Matcher extends React.Component<Props, State> implements Wi
23
25
  context: React.ContextType<typeof PerseusI18nContext>;
24
26
  static defaultProps: DefaultProps;
25
27
  state: State;
28
+ componentDidMount(): void;
26
29
  changeAndTrack: () => void;
27
30
  onMeasureLeft: (arg1: any) => void;
28
31
  onMeasureRight: (arg1: any) => void;
@@ -41,7 +44,7 @@ declare function getUserInputFromSerializedState(serializedState: any): PerseusM
41
44
  declare const _default: {
42
45
  name: string;
43
46
  displayName: string;
44
- widget: typeof Matcher;
47
+ widget: React.ForwardRefExoticComponent<Omit<Props, "dependencies"> & React.RefAttributes<any>>;
45
48
  isLintable: true;
46
49
  getStartUserInput: typeof getStartUserInput;
47
50
  getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
@@ -45,7 +45,6 @@ declare class MockWidgetComponent extends React.Component<Props> implements Widg
45
45
  apiOptions: Readonly<Readonly<{
46
46
  isArticle?: boolean;
47
47
  onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
48
- GroupMetadataEditor?: React.ComponentType<any>;
49
48
  showAlignmentOptions?: boolean;
50
49
  readOnly?: boolean;
51
50
  editingDisabled?: boolean;
@@ -54,7 +53,6 @@ declare class MockWidgetComponent extends React.Component<Props> implements Widg
54
53
  interactionCallback?: (widgetData: {
55
54
  [widgetId: string]: any;
56
55
  }) => void;
57
- groupAnnotator?: (groupNumber: number, widgetId: string) => React.ReactNode;
58
56
  imagePlaceholder?: React.ReactNode;
59
57
  widgetPlaceholder?: React.ReactNode;
60
58
  baseElements?: {
@@ -81,7 +79,6 @@ declare class MockWidgetComponent extends React.Component<Props> implements Widg
81
79
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
82
80
  canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
83
81
  editorChangeDelay: NonNullable<import("../..").APIOptions["editorChangeDelay"]>;
84
- groupAnnotator: NonNullable<import("../..").APIOptions["groupAnnotator"]>;
85
82
  isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
86
83
  isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
87
84
  isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
@@ -1,88 +1,12 @@
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 { NumberLinePromptJSON } from "../../widget-ai-utils/number-line/number-line-ai-utils";
2
+ import type { WidgetProps, PerseusDependenciesV2 } from "../../types";
5
3
  import type { PerseusNumberLineUserInput, PerseusNumberLineWidgetOptions, NumberLinePublicWidgetOptions } from "@khanacademy/perseus-core";
6
4
  /**
7
5
  * The type of `this.props` inside the NumberLine widget.
8
6
  */
9
- type Props = WidgetProps<PerseusNumberLineWidgetOptions, PerseusNumberLineUserInput>;
10
- type CalculatedProps = Props & {
11
- tickStep: number;
7
+ type Props = WidgetProps<PerseusNumberLineWidgetOptions, PerseusNumberLineUserInput> & {
8
+ dependencies: PerseusDependenciesV2;
12
9
  };
13
- type DefaultProps = {
14
- range: Props["range"];
15
- labelStyle: Props["labelStyle"];
16
- labelRange: Props["labelRange"];
17
- divisionRange: Props["divisionRange"];
18
- labelTicks: Props["labelTicks"];
19
- isTickCtrl: Props["isTickCtrl"];
20
- isInequality: Props["isInequality"];
21
- snapDivisions: Props["snapDivisions"];
22
- showTooltips: Props["showTooltips"];
23
- apiOptions: Props["apiOptions"];
24
- };
25
- type State = {
26
- numDivisionsEmpty: boolean;
27
- };
28
- declare class NumberLine extends React.Component<Props, State> implements Widget {
29
- static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
30
- context: React.ContextType<typeof PerseusI18nContext>;
31
- static defaultProps: DefaultProps;
32
- state: any;
33
- /**
34
- * isTickCtrl seems like it can be null
35
- * but default props only work with undefined,
36
- * so this handles both null/undefined
37
- */
38
- getIsTickCtrl(): boolean;
39
- /**
40
- * snapDivisions seems like it can be null
41
- * but default props only work with undefined,
42
- * so this handles both null/undefined
43
- */
44
- getSnapDivisions(): number;
45
- isValid: () => boolean;
46
- onNumDivisionsChange: (arg1: number, arg2: any) => void;
47
- _handleTickCtrlFocus: () => void;
48
- _handleTickCtrlBlur: () => void;
49
- focus(): boolean;
50
- focusInputPath: (arg1: any) => void;
51
- blurInputPath: (arg1: any) => void;
52
- getInputPaths: () => ReadonlyArray<ReadonlyArray<string>>;
53
- getDOMNodeForPath(inputPath: FocusPath): Element | Text | null;
54
- _renderGraphie: () => React.ReactElement;
55
- snapNumLinePosition: (arg1: any, arg2: number) => number;
56
- movePosition: (arg1: number) => void;
57
- _renderNumberLinePoint: (arg1: CalculatedProps) => React.ReactElement;
58
- handleReverse: () => void;
59
- handleToggleStrict: () => void;
60
- _getInequalityEndpoint(props: CalculatedProps): [number, number];
61
- _renderInequality(props: CalculatedProps): React.ReactElement | null;
62
- _setupGraphie: (arg1: any, arg2: any) => void;
63
- getPromptJSON(): NumberLinePromptJSON;
64
- /**
65
- * @deprecated and likely very broken API
66
- * [LEMS-3185] do not trust serializedState
67
- */
68
- getSerializedState(): {
69
- alignment: string | null | undefined;
70
- static: boolean;
71
- range: number[];
72
- labelRange: (number | null)[];
73
- labelStyle: string;
74
- labelTicks: boolean;
75
- divisionRange: number[];
76
- snapDivisions: number;
77
- isInequality: boolean;
78
- showTooltips: boolean | undefined;
79
- isTickCtrl: boolean;
80
- numDivisions: number;
81
- numLinePosition: number;
82
- rel: string;
83
- };
84
- render(): React.ReactNode;
85
- }
86
10
  /**
87
11
  * @deprecated and likely a very broken API
88
12
  * [LEMS-3185] do not trust serializedState
@@ -93,7 +17,7 @@ declare function getStartUserInput(options: NumberLinePublicWidgetOptions): Pers
93
17
  declare const _default: {
94
18
  name: string;
95
19
  displayName: string;
96
- widget: typeof NumberLine;
20
+ widget: React.ForwardRefExoticComponent<Omit<Props, "dependencies"> & React.RefAttributes<any>>;
97
21
  getCorrectUserInput: typeof getCorrectUserInput;
98
22
  getStartUserInput: typeof getStartUserInput;
99
23
  getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
@@ -52,7 +52,6 @@ export declare class NumericInput extends React.Component<NumericInputProps> imp
52
52
  apiOptions: Readonly<Readonly<{
53
53
  isArticle?: boolean;
54
54
  onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
55
- GroupMetadataEditor?: React.ComponentType<any>;
56
55
  showAlignmentOptions?: boolean;
57
56
  readOnly?: boolean;
58
57
  editingDisabled?: boolean;
@@ -61,7 +60,6 @@ export declare class NumericInput extends React.Component<NumericInputProps> imp
61
60
  interactionCallback?: (widgetData: {
62
61
  [widgetId: string]: any;
63
62
  }) => void;
64
- groupAnnotator?: (groupNumber: number, widgetId: string) => React.ReactNode;
65
63
  imagePlaceholder?: React.ReactNode;
66
64
  widgetPlaceholder?: React.ReactNode;
67
65
  baseElements?: {
@@ -88,7 +86,6 @@ export declare class NumericInput extends React.Component<NumericInputProps> imp
88
86
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
89
87
  canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
90
88
  editorChangeDelay: NonNullable<import("../..").APIOptions["editorChangeDelay"]>;
91
- groupAnnotator: NonNullable<import("../..").APIOptions["groupAnnotator"]>;
92
89
  isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
93
90
  isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
94
91
  isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
@@ -15,7 +15,6 @@ export declare const NumericInputComponent: React.ForwardRefExoticComponent<impo
15
15
  apiOptions: Readonly<Readonly<{
16
16
  isArticle?: boolean;
17
17
  onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
18
- GroupMetadataEditor?: React.ComponentType<any>;
19
18
  showAlignmentOptions?: boolean;
20
19
  readOnly?: boolean;
21
20
  editingDisabled?: boolean;
@@ -24,7 +23,6 @@ export declare const NumericInputComponent: React.ForwardRefExoticComponent<impo
24
23
  interactionCallback?: (widgetData: {
25
24
  [widgetId: string]: any;
26
25
  }) => void;
27
- groupAnnotator?: (groupNumber: number, widgetId: string) => React.ReactNode;
28
26
  imagePlaceholder?: React.ReactNode;
29
27
  widgetPlaceholder?: React.ReactNode;
30
28
  baseElements?: {
@@ -51,7 +49,6 @@ export declare const NumericInputComponent: React.ForwardRefExoticComponent<impo
51
49
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
52
50
  canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
53
51
  editorChangeDelay: NonNullable<import("../..").APIOptions["editorChangeDelay"]>;
54
- groupAnnotator: NonNullable<import("../..").APIOptions["groupAnnotator"]>;
55
52
  isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
56
53
  isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
57
54
  isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
@@ -78,7 +75,6 @@ export declare const NumericInputComponent: React.ForwardRefExoticComponent<impo
78
75
  apiOptions: NonNullable<Readonly<Readonly<{
79
76
  isArticle?: boolean;
80
77
  onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
81
- GroupMetadataEditor?: React.ComponentType<any>;
82
78
  showAlignmentOptions?: boolean;
83
79
  readOnly?: boolean;
84
80
  editingDisabled?: boolean;
@@ -87,7 +83,6 @@ export declare const NumericInputComponent: React.ForwardRefExoticComponent<impo
87
83
  interactionCallback?: (widgetData: {
88
84
  [widgetId: string]: any;
89
85
  }) => void;
90
- groupAnnotator?: (groupNumber: number, widgetId: string) => React.ReactNode;
91
86
  imagePlaceholder?: React.ReactNode;
92
87
  widgetPlaceholder?: React.ReactNode;
93
88
  baseElements?: {
@@ -114,7 +109,6 @@ export declare const NumericInputComponent: React.ForwardRefExoticComponent<impo
114
109
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
115
110
  canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
116
111
  editorChangeDelay: NonNullable<import("../..").APIOptions["editorChangeDelay"]>;
117
- groupAnnotator: NonNullable<import("../..").APIOptions["groupAnnotator"]>;
118
112
  isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
119
113
  isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
120
114
  isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;