@khanacademy/perseus 34.1.0 → 35.0.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 (65) hide show
  1. package/dist/es/index.js +374 -380
  2. package/dist/es/index.js.map +1 -1
  3. package/dist/es/strings.js +8 -2
  4. package/dist/es/strings.js.map +1 -1
  5. package/dist/index.d.ts +1 -1
  6. package/dist/index.js +286 -302
  7. package/dist/index.js.map +1 -1
  8. package/dist/mixins/widget-prop-denylist.d.ts +0 -1
  9. package/dist/perseus-api.d.ts +3 -5
  10. package/dist/perseus-types.d.ts +6 -19
  11. package/dist/renderer.d.ts +4 -4
  12. package/dist/server-item-renderer.d.ts +3 -9
  13. package/dist/strings.d.ts +3 -0
  14. package/dist/strings.js +8 -2
  15. package/dist/strings.js.map +1 -1
  16. package/dist/types.d.ts +1 -3
  17. package/dist/validation.types.d.ts +111 -0
  18. package/dist/widgets/categorizer/categorizer-validator.d.ts +2 -2
  19. package/dist/widgets/categorizer/categorizer.d.ts +6 -6
  20. package/dist/widgets/cs-program/cs-program.d.ts +4 -9
  21. package/dist/widgets/definition/definition.d.ts +3 -4
  22. package/dist/widgets/dropdown/dropdown-validator.d.ts +2 -2
  23. package/dist/widgets/dropdown/dropdown.d.ts +5 -5
  24. package/dist/widgets/explanation/explanation.d.ts +3 -2
  25. package/dist/widgets/expression/expression-validator.d.ts +2 -2
  26. package/dist/widgets/expression/expression.d.ts +32 -26
  27. package/dist/widgets/expression/expression.types.d.ts +0 -1
  28. package/dist/widgets/graded-group/graded-group.d.ts +2 -2
  29. package/dist/widgets/graded-group-set/graded-group-set.d.ts +2 -2
  30. package/dist/widgets/grapher/grapher.d.ts +6 -7
  31. package/dist/widgets/group/group.d.ts +3 -2
  32. package/dist/widgets/iframe/iframe.d.ts +4 -9
  33. package/dist/widgets/image/image.d.ts +3 -4
  34. package/dist/widgets/input-number/input-number-validator.d.ts +3 -3
  35. package/dist/widgets/input-number/input-number.d.ts +7 -10
  36. package/dist/widgets/interaction/interaction.d.ts +3 -3
  37. package/dist/widgets/interactive-graph.d.ts +9 -12
  38. package/dist/widgets/interactive-graphs/interactive-graph-question-builder.d.ts +8 -2
  39. package/dist/widgets/interactive-graphs/stateful-mafs-graph.d.ts +5 -2
  40. package/dist/widgets/label-image/label-image-validator.d.ts +10 -0
  41. package/dist/widgets/label-image/label-image.d.ts +11 -10
  42. package/dist/widgets/label-image/types.d.ts +0 -4
  43. package/dist/widgets/matcher/matcher.d.ts +4 -4
  44. package/dist/widgets/matrix/matrix.d.ts +5 -5
  45. package/dist/widgets/molecule/molecule.d.ts +2 -1
  46. package/dist/widgets/number-line/number-line.d.ts +5 -3
  47. package/dist/widgets/numeric-input/numeric-input-validator.d.ts +2 -2
  48. package/dist/widgets/numeric-input/numeric-input.d.ts +7 -7
  49. package/dist/widgets/orderer/orderer.d.ts +4 -4
  50. package/dist/widgets/passage/passage.d.ts +3 -4
  51. package/dist/widgets/passage-ref/passage-ref.d.ts +3 -11
  52. package/dist/widgets/passage-ref-target/passage-ref-target.d.ts +2 -1
  53. package/dist/widgets/phet-simulation/phet-simulation.d.ts +2 -2
  54. package/dist/widgets/plotter/plotter.d.ts +5 -5
  55. package/dist/widgets/radio/radio-component.d.ts +6 -13
  56. package/dist/widgets/radio/radio-validator.d.ts +5 -0
  57. package/dist/widgets/sorter/sorter-validator.d.ts +4 -0
  58. package/dist/widgets/sorter/sorter.d.ts +7 -9
  59. package/dist/widgets/table/table.d.ts +5 -5
  60. package/dist/widgets/video/video.d.ts +2 -2
  61. package/package.json +1 -1
  62. package/dist/widgets/categorizer/categorizer.types.d.ts +0 -5
  63. package/dist/widgets/dropdown/dropdown.types.d.ts +0 -5
  64. package/dist/widgets/input-number/input-number.types.d.ts +0 -2
  65. package/dist/widgets/numeric-input/numeric-input.types.d.ts +0 -5
@@ -2,10 +2,9 @@ import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { PerseusRenderer, PerseusDefinitionWidgetOptions } from "../../perseus-types";
4
4
  import type { WidgetProps } from "../../types";
5
+ import type { PerseusDefinitionRubric, PerseusDefinitionUserInput } from "../../validation.types";
5
6
  type RenderProps = PerseusDefinitionWidgetOptions;
6
- type Rubric = PerseusDefinitionWidgetOptions;
7
- type UserInput = Empty;
8
- type DefinitionProps = WidgetProps<RenderProps, Rubric> & {
7
+ type DefinitionProps = WidgetProps<RenderProps, PerseusDefinitionRubric> & {
9
8
  widgets: PerseusRenderer["widgets"];
10
9
  };
11
10
  type DefaultProps = {
@@ -20,7 +19,7 @@ declare class Definition extends React.Component<DefinitionProps> {
20
19
  context: React.ContextType<typeof PerseusI18nContext>;
21
20
  static defaultProps: DefaultProps;
22
21
  static validate(): import("../../types").PerseusScore;
23
- getUserInput: () => UserInput;
22
+ getUserInput(): PerseusDefinitionUserInput;
24
23
  simpleValidate(): import("../../types").PerseusScore;
25
24
  render(): React.ReactNode;
26
25
  }
@@ -1,4 +1,4 @@
1
- import type { Rubric, UserInput } from "./dropdown.types";
2
1
  import type { PerseusScore } from "../../types";
3
- declare function dropdownValidator(userInput: UserInput, rubric: Rubric): PerseusScore;
2
+ import type { PerseusDropdownRubric, PerseusDropdownUserInput } from "../../validation.types";
3
+ declare function dropdownValidator(userInput: PerseusDropdownUserInput, rubric: PerseusDropdownRubric): PerseusScore;
4
4
  export default dropdownValidator;
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
- import type { Rubric, UserInput } from "./dropdown.types";
3
2
  import type { PerseusScore, WidgetProps } from "../../types";
4
- type Props = WidgetProps<RenderProps, Rubric> & {
3
+ import type { PerseusDropdownRubric, PerseusDropdownUserInput } from "../../validation.types";
4
+ type Props = WidgetProps<RenderProps, PerseusDropdownRubric> & {
5
5
  selected: number;
6
6
  };
7
7
  type DefaultProps = {
@@ -12,12 +12,12 @@ type DefaultProps = {
12
12
  };
13
13
  declare class Dropdown extends React.Component<Props> {
14
14
  static defaultProps: DefaultProps;
15
- static validate(userInput: UserInput, rubric: Rubric): PerseusScore;
15
+ static validate(userInput: PerseusDropdownUserInput, rubric: PerseusDropdownRubric): PerseusScore;
16
16
  focus: () => boolean;
17
17
  _handleChangeEvent: (arg1: React.ChangeEvent<HTMLInputElement>) => void;
18
18
  _handleChange: (arg1: number) => void;
19
- getUserInput: () => UserInput;
20
- simpleValidate: (arg1: Rubric) => PerseusScore;
19
+ getUserInput(): PerseusDropdownUserInput;
20
+ simpleValidate(rubric: PerseusDropdownRubric): PerseusScore;
21
21
  render(): React.ReactNode;
22
22
  }
23
23
  type RenderProps = {
@@ -2,8 +2,9 @@ import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { PerseusExplanationWidgetOptions } from "../../perseus-types";
4
4
  import type { WidgetProps } from "../../types";
5
+ import type { PerseusExplanationRubric, PerseusExplanationUserInput } from "../../validation.types";
5
6
  type RenderProps = PerseusExplanationWidgetOptions;
6
- type Props = WidgetProps<RenderProps, PerseusExplanationWidgetOptions>;
7
+ type Props = WidgetProps<RenderProps, PerseusExplanationRubric>;
7
8
  type DefaultProps = {
8
9
  showPrompt: Props["showPrompt"];
9
10
  hidePrompt: Props["hidePrompt"];
@@ -28,7 +29,7 @@ declare class Explanation extends React.Component<Props, State> {
28
29
  componentWillUnmount(): void;
29
30
  change: (arg1: any, arg2: any, arg3: any) => any;
30
31
  _onClick: () => void;
31
- getUserInput: () => Empty;
32
+ getUserInput(): PerseusExplanationUserInput;
32
33
  simpleValidate(): import("../../types").PerseusScore;
33
34
  render(): React.ReactNode;
34
35
  }
@@ -1,5 +1,5 @@
1
- import type { Rubric, OnInputErrorFunctionType } from "./expression.types";
2
1
  import type { PerseusStrings } from "../../strings";
3
2
  import type { PerseusScore } from "../../types";
4
- declare function expressionValidator(userInput: string, rubric: Rubric, onInputError: OnInputErrorFunctionType | undefined, strings: PerseusStrings, locale: string): PerseusScore;
3
+ import type { PerseusExpressionRubric, PerseusExpressionUserInput } from "../../validation.types";
4
+ declare function expressionValidator(userInput: PerseusExpressionUserInput, rubric: PerseusExpressionRubric, strings: PerseusStrings, locale: string): PerseusScore;
5
5
  export default expressionValidator;
@@ -1,10 +1,10 @@
1
1
  import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
- import type { Rubric, OnInputErrorFunctionType } from "./expression.types";
4
3
  import type { DependenciesContext } from "../../dependencies";
5
4
  import type { PerseusExpressionWidgetOptions } from "../../perseus-types";
6
5
  import type { PerseusStrings } from "../../strings";
7
6
  import type { PerseusScore, WidgetProps } from "../../types";
7
+ import type { PerseusExpressionRubric, PerseusExpressionUserInput } from "../../validation.types";
8
8
  import type { Keys as Key, KeypadConfiguration } from "@khanacademy/math-input";
9
9
  type InputPath = ReadonlyArray<string>;
10
10
  type RenderProps = {
@@ -16,7 +16,7 @@ type RenderProps = {
16
16
  ariaLabel: PerseusExpressionWidgetOptions["ariaLabel"];
17
17
  keypadConfiguration: ReturnType<typeof keypadConfigurationForProps>;
18
18
  };
19
- type ExternalProps = WidgetProps<RenderProps, Rubric>;
19
+ type ExternalProps = WidgetProps<RenderProps, PerseusExpressionRubric>;
20
20
  export type Props = ExternalProps & Partial<React.ContextType<typeof DependenciesContext>> & {
21
21
  apiOptions: NonNullable<ExternalProps["apiOptions"]>;
22
22
  buttonSets: NonNullable<ExternalProps["buttonSets"]>;
@@ -52,9 +52,9 @@ export declare class Expression extends React.Component<Props, ExpressionState>
52
52
  context: React.ContextType<typeof PerseusI18nContext>;
53
53
  _textareaId: string;
54
54
  _isMounted: boolean;
55
- static validate(userInput: string, rubric: Rubric, onInputError: OnInputErrorFunctionType | undefined, strings: PerseusStrings, locale: string): PerseusScore;
56
- static getUserInputFromProps(props: Props): string;
57
- static getOneCorrectAnswerFromRubric(rubric: Rubric): string | null | undefined;
55
+ static validate(userInput: PerseusExpressionUserInput, rubric: PerseusExpressionRubric, strings: PerseusStrings, locale: string): PerseusScore;
56
+ static getUserInputFromProps(props: Props): PerseusExpressionUserInput;
57
+ static getOneCorrectAnswerFromRubric(rubric: PerseusExpressionRubric): string | null | undefined;
58
58
  static defaultProps: DefaultProps;
59
59
  displayName: string;
60
60
  state: ExpressionState;
@@ -62,10 +62,10 @@ export declare class Expression extends React.Component<Props, ExpressionState>
62
62
  componentDidUpdate: (prevProps: Props) => void;
63
63
  componentWillUnmount: () => void;
64
64
  _handleMouseDown: () => void;
65
- simpleValidate: (rubric: Rubric & {
65
+ simpleValidate: (rubric: PerseusExpressionRubric & {
66
66
  scoring?: boolean;
67
- }, onInputError: OnInputErrorFunctionType) => PerseusScore;
68
- getUserInput: () => string;
67
+ }) => PerseusScore;
68
+ getUserInput(): PerseusExpressionUserInput;
69
69
  change: (...args: any) => any | undefined;
70
70
  parse: (value: string, props: Props) => any;
71
71
  changeAndTrack: (e: any, cb: () => void) => void;
@@ -102,7 +102,6 @@ declare const _default: Readonly<{
102
102
  problemNum: number | null | undefined;
103
103
  apiOptions: Readonly<Readonly<{
104
104
  isArticle?: boolean | undefined;
105
- onInputError?: ((widgetId: any, value: string, message?: string | null | undefined) => unknown) | undefined;
106
105
  onFocusChange?: ((newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
107
106
  GroupMetadataEditor?: React.ComponentType<any> | undefined;
108
107
  showAlignmentOptions?: boolean | undefined;
@@ -150,6 +149,9 @@ declare const _default: Readonly<{
150
149
  "interactive-graph-locked-features-labels"?: boolean | undefined;
151
150
  "locked-point-labels"?: boolean | undefined;
152
151
  "locked-line-labels"?: boolean | undefined;
152
+ "locked-vector-labels"?: boolean | undefined;
153
+ "locked-ellipse-labels"?: boolean | undefined;
154
+ "locked-function-labels"?: boolean | undefined;
153
155
  }) | undefined;
154
156
  } | undefined;
155
157
  onWidgetStartProps?: ((widgets: import("../../perseus-types").PerseusWidgetsMap) => void) | undefined;
@@ -165,7 +167,6 @@ declare const _default: Readonly<{
165
167
  isArticle: NonNullable<boolean | undefined>;
166
168
  isMobile: NonNullable<boolean | undefined>;
167
169
  onFocusChange: (newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown;
168
- onInputError: (widgetId: any, value: string, message?: string | null | undefined) => unknown;
169
170
  readOnly: NonNullable<boolean | undefined>;
170
171
  setDrawingAreaAvailable: (arg1: boolean) => unknown;
171
172
  showAlignmentOptions: NonNullable<boolean | undefined>;
@@ -184,7 +185,6 @@ declare const _default: Readonly<{
184
185
  } & Partial<import("../../types").PerseusDependenciesV2> & {
185
186
  apiOptions: Readonly<Readonly<{
186
187
  isArticle?: boolean | undefined;
187
- onInputError?: ((widgetId: any, value: string, message?: string | null | undefined) => unknown) | undefined;
188
188
  onFocusChange?: ((newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
189
189
  GroupMetadataEditor?: React.ComponentType<any> | undefined;
190
190
  showAlignmentOptions?: boolean | undefined;
@@ -232,6 +232,9 @@ declare const _default: Readonly<{
232
232
  "interactive-graph-locked-features-labels"?: boolean | undefined;
233
233
  "locked-point-labels"?: boolean | undefined;
234
234
  "locked-line-labels"?: boolean | undefined;
235
+ "locked-vector-labels"?: boolean | undefined;
236
+ "locked-ellipse-labels"?: boolean | undefined;
237
+ "locked-function-labels"?: boolean | undefined;
235
238
  }) | undefined;
236
239
  } | undefined;
237
240
  onWidgetStartProps?: ((widgets: import("../../perseus-types").PerseusWidgetsMap) => void) | undefined;
@@ -247,7 +250,6 @@ declare const _default: Readonly<{
247
250
  isArticle: NonNullable<boolean | undefined>;
248
251
  isMobile: NonNullable<boolean | undefined>;
249
252
  onFocusChange: (newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown;
250
- onInputError: (widgetId: any, value: string, message?: string | null | undefined) => unknown;
251
253
  readOnly: NonNullable<boolean | undefined>;
252
254
  setDrawingAreaAvailable: (arg1: boolean) => unknown;
253
255
  showAlignmentOptions: NonNullable<boolean | undefined>;
@@ -261,12 +263,13 @@ declare const _default: Readonly<{
261
263
  visibleLabel: string | undefined;
262
264
  ariaLabel: string | undefined;
263
265
  value: string;
264
- }, "ariaLabel" | "trackInteraction" | "static" | "onChange" | "analytics" | "problemNum" | "questionCompleted" | "keypadElement" | "alignment" | "buttonsVisible" | "containerSizeClass" | "widgetId" | "findWidgets" | "visibleLabel" | "keypadConfiguration" | "reviewModeRubric" | "isLastUsedWidget"> & {
266
+ }, "ariaLabel" | "trackInteraction" | "static" | "onChange" | "analytics" | "keypadElement" | "containerSizeClass" | "widgetId" | "problemNum" | "questionCompleted" | "findWidgets" | "alignment" | "buttonsVisible" | "visibleLabel" | "keypadConfiguration" | "reviewModeRubric" | "isLastUsedWidget"> & {
265
267
  value?: string | undefined;
266
268
  linterContext?: import("@khanacademy/perseus-linter").LinterContextProps | undefined;
269
+ onFocus?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
270
+ onBlur?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
267
271
  apiOptions?: Readonly<Readonly<{
268
272
  isArticle?: boolean | undefined;
269
- onInputError?: ((widgetId: any, value: string, message?: string | null | undefined) => unknown) | undefined;
270
273
  onFocusChange?: ((newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
271
274
  GroupMetadataEditor?: React.ComponentType<any> | undefined;
272
275
  showAlignmentOptions?: boolean | undefined;
@@ -314,6 +317,9 @@ declare const _default: Readonly<{
314
317
  "interactive-graph-locked-features-labels"?: boolean | undefined;
315
318
  "locked-point-labels"?: boolean | undefined;
316
319
  "locked-line-labels"?: boolean | undefined;
320
+ "locked-vector-labels"?: boolean | undefined;
321
+ "locked-ellipse-labels"?: boolean | undefined;
322
+ "locked-function-labels"?: boolean | undefined;
317
323
  }) | undefined;
318
324
  } | undefined;
319
325
  onWidgetStartProps?: ((widgets: import("../../perseus-types").PerseusWidgetsMap) => void) | undefined;
@@ -329,14 +335,11 @@ declare const _default: Readonly<{
329
335
  isArticle: NonNullable<boolean | undefined>;
330
336
  isMobile: NonNullable<boolean | undefined>;
331
337
  onFocusChange: (newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown;
332
- onInputError: (widgetId: any, value: string, message?: string | null | undefined) => unknown;
333
338
  readOnly: NonNullable<boolean | undefined>;
334
339
  setDrawingAreaAvailable: (arg1: boolean) => unknown;
335
340
  showAlignmentOptions: NonNullable<boolean | undefined>;
336
341
  }> | undefined;
337
342
  buttonSets?: import("../../perseus-types").LegacyButtonSets | undefined;
338
- onFocus?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
339
- onBlur?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
340
343
  functions?: readonly string[] | undefined;
341
344
  times?: boolean | undefined;
342
345
  } & {}, "analytics"> & React.RefAttributes<Expression>>) | undefined;
@@ -347,7 +350,6 @@ declare const _default: Readonly<{
347
350
  problemNum: number | null | undefined;
348
351
  apiOptions: Readonly<Readonly<{
349
352
  isArticle?: boolean | undefined;
350
- onInputError?: ((widgetId: any, value: string, message?: string | null | undefined) => unknown) | undefined;
351
353
  onFocusChange?: ((newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
352
354
  GroupMetadataEditor?: React.ComponentType<any> | undefined;
353
355
  showAlignmentOptions?: boolean | undefined;
@@ -395,6 +397,9 @@ declare const _default: Readonly<{
395
397
  "interactive-graph-locked-features-labels"?: boolean | undefined;
396
398
  "locked-point-labels"?: boolean | undefined;
397
399
  "locked-line-labels"?: boolean | undefined;
400
+ "locked-vector-labels"?: boolean | undefined;
401
+ "locked-ellipse-labels"?: boolean | undefined;
402
+ "locked-function-labels"?: boolean | undefined;
398
403
  }) | undefined;
399
404
  } | undefined;
400
405
  onWidgetStartProps?: ((widgets: import("../../perseus-types").PerseusWidgetsMap) => void) | undefined;
@@ -410,7 +415,6 @@ declare const _default: Readonly<{
410
415
  isArticle: NonNullable<boolean | undefined>;
411
416
  isMobile: NonNullable<boolean | undefined>;
412
417
  onFocusChange: (newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown;
413
- onInputError: (widgetId: any, value: string, message?: string | null | undefined) => unknown;
414
418
  readOnly: NonNullable<boolean | undefined>;
415
419
  setDrawingAreaAvailable: (arg1: boolean) => unknown;
416
420
  showAlignmentOptions: NonNullable<boolean | undefined>;
@@ -429,7 +433,6 @@ declare const _default: Readonly<{
429
433
  } & Partial<import("../../types").PerseusDependenciesV2> & {
430
434
  apiOptions: Readonly<Readonly<{
431
435
  isArticle?: boolean | undefined;
432
- onInputError?: ((widgetId: any, value: string, message?: string | null | undefined) => unknown) | undefined;
433
436
  onFocusChange?: ((newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
434
437
  GroupMetadataEditor?: React.ComponentType<any> | undefined;
435
438
  showAlignmentOptions?: boolean | undefined;
@@ -477,6 +480,9 @@ declare const _default: Readonly<{
477
480
  "interactive-graph-locked-features-labels"?: boolean | undefined;
478
481
  "locked-point-labels"?: boolean | undefined;
479
482
  "locked-line-labels"?: boolean | undefined;
483
+ "locked-vector-labels"?: boolean | undefined;
484
+ "locked-ellipse-labels"?: boolean | undefined;
485
+ "locked-function-labels"?: boolean | undefined;
480
486
  }) | undefined;
481
487
  } | undefined;
482
488
  onWidgetStartProps?: ((widgets: import("../../perseus-types").PerseusWidgetsMap) => void) | undefined;
@@ -492,7 +498,6 @@ declare const _default: Readonly<{
492
498
  isArticle: NonNullable<boolean | undefined>;
493
499
  isMobile: NonNullable<boolean | undefined>;
494
500
  onFocusChange: (newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown;
495
- onInputError: (widgetId: any, value: string, message?: string | null | undefined) => unknown;
496
501
  readOnly: NonNullable<boolean | undefined>;
497
502
  setDrawingAreaAvailable: (arg1: boolean) => unknown;
498
503
  showAlignmentOptions: NonNullable<boolean | undefined>;
@@ -506,12 +511,13 @@ declare const _default: Readonly<{
506
511
  visibleLabel: string | undefined;
507
512
  ariaLabel: string | undefined;
508
513
  value: string;
509
- }, "ariaLabel" | "trackInteraction" | "static" | "onChange" | "analytics" | "problemNum" | "questionCompleted" | "keypadElement" | "alignment" | "buttonsVisible" | "containerSizeClass" | "widgetId" | "findWidgets" | "visibleLabel" | "keypadConfiguration" | "reviewModeRubric" | "isLastUsedWidget"> & {
514
+ }, "ariaLabel" | "trackInteraction" | "static" | "onChange" | "analytics" | "keypadElement" | "containerSizeClass" | "widgetId" | "problemNum" | "questionCompleted" | "findWidgets" | "alignment" | "buttonsVisible" | "visibleLabel" | "keypadConfiguration" | "reviewModeRubric" | "isLastUsedWidget"> & {
510
515
  value?: string | undefined;
511
516
  linterContext?: import("@khanacademy/perseus-linter").LinterContextProps | undefined;
517
+ onFocus?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
518
+ onBlur?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
512
519
  apiOptions?: Readonly<Readonly<{
513
520
  isArticle?: boolean | undefined;
514
- onInputError?: ((widgetId: any, value: string, message?: string | null | undefined) => unknown) | undefined;
515
521
  onFocusChange?: ((newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
516
522
  GroupMetadataEditor?: React.ComponentType<any> | undefined;
517
523
  showAlignmentOptions?: boolean | undefined;
@@ -559,6 +565,9 @@ declare const _default: Readonly<{
559
565
  "interactive-graph-locked-features-labels"?: boolean | undefined;
560
566
  "locked-point-labels"?: boolean | undefined;
561
567
  "locked-line-labels"?: boolean | undefined;
568
+ "locked-vector-labels"?: boolean | undefined;
569
+ "locked-ellipse-labels"?: boolean | undefined;
570
+ "locked-function-labels"?: boolean | undefined;
562
571
  }) | undefined;
563
572
  } | undefined;
564
573
  onWidgetStartProps?: ((widgets: import("../../perseus-types").PerseusWidgetsMap) => void) | undefined;
@@ -574,14 +583,11 @@ declare const _default: Readonly<{
574
583
  isArticle: NonNullable<boolean | undefined>;
575
584
  isMobile: NonNullable<boolean | undefined>;
576
585
  onFocusChange: (newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown;
577
- onInputError: (widgetId: any, value: string, message?: string | null | undefined) => unknown;
578
586
  readOnly: NonNullable<boolean | undefined>;
579
587
  setDrawingAreaAvailable: (arg1: boolean) => unknown;
580
588
  showAlignmentOptions: NonNullable<boolean | undefined>;
581
589
  }> | undefined;
582
590
  buttonSets?: import("../../perseus-types").LegacyButtonSets | undefined;
583
- onFocus?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
584
- onBlur?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
585
591
  functions?: readonly string[] | undefined;
586
592
  times?: boolean | undefined;
587
593
  } & {}, "analytics"> & React.RefAttributes<Expression>>;
@@ -1,3 +1,2 @@
1
1
  import type { PerseusExpressionWidgetOptions } from "../../perseus-types";
2
2
  export type Rubric = PerseusExpressionWidgetOptions;
3
- export type OnInputErrorFunctionType = (arg1?: any, arg2?: any, arg3?: any) => boolean | null | undefined;
@@ -3,15 +3,15 @@ import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { ANSWER_BAR_STATES } from "./graded-group-answer-bar";
4
4
  import type { PerseusGradedGroupWidgetOptions } from "../../perseus-types";
5
5
  import type { TrackingGradedGroupExtraArguments, WidgetProps } from "../../types";
6
+ import type { PerseusGradedGroupRubric } from "../../validation.types";
6
7
  declare const GRADING_STATUSES: {
7
8
  readonly ungraded: "ungraded";
8
9
  readonly correct: "correct";
9
10
  readonly incorrect: "incorrect";
10
11
  readonly invalid: "invalid";
11
12
  };
12
- type Rubric = PerseusGradedGroupWidgetOptions;
13
13
  type RenderProps = PerseusGradedGroupWidgetOptions;
14
- type Props = WidgetProps<RenderProps, Rubric, TrackingGradedGroupExtraArguments> & {
14
+ type Props = WidgetProps<RenderProps, PerseusGradedGroupRubric, TrackingGradedGroupExtraArguments> & {
15
15
  inGradedGroupSet?: boolean;
16
16
  onNextQuestion?: () => unknown;
17
17
  };
@@ -3,9 +3,9 @@ import * as Changeable from "../../mixins/changeable";
3
3
  import { GradedGroup } from "../graded-group/graded-group";
4
4
  import type { PerseusGradedGroupSetWidgetOptions } from "../../perseus-types";
5
5
  import type { FocusPath, WidgetProps } from "../../types";
6
+ import type { PerseusGradedGroupSetRubric } from "../../validation.types";
6
7
  type RenderProps = PerseusGradedGroupSetWidgetOptions;
7
- type Rubric = PerseusGradedGroupSetWidgetOptions;
8
- type Props = Changeable.ChangeableProps & WidgetProps<RenderProps, Rubric> & {
8
+ type Props = Changeable.ChangeableProps & WidgetProps<RenderProps, PerseusGradedGroupSetRubric> & {
9
9
  trackInteraction: () => void;
10
10
  };
11
11
  type DefaultProps = {
@@ -4,15 +4,14 @@ import type { Coord } from "../../interactive2/types";
4
4
  import type { PerseusGrapherWidgetOptions } from "../../perseus-types";
5
5
  import type { PerseusScore, WidgetProps } from "../../types";
6
6
  import type { GridDimensions } from "../../util";
7
+ import type { PerseusGrapherRubric, PerseusGrapherUserInput } from "../../validation.types";
7
8
  import type { PropsFor } from "@khanacademy/wonder-blocks-core";
8
- type UserInput = any;
9
9
  type RenderProps = {
10
10
  availableTypes: PerseusGrapherWidgetOptions["availableTypes"];
11
11
  graph: PerseusGrapherWidgetOptions["graph"];
12
12
  plot?: any;
13
13
  };
14
- type Rubric = PerseusGrapherWidgetOptions;
15
- type ExternalProps = WidgetProps<RenderProps, Rubric>;
14
+ type ExternalProps = WidgetProps<RenderProps, PerseusGrapherRubric>;
16
15
  type Props = ExternalProps & {
17
16
  plot: NonNullable<RenderProps["plot"]>;
18
17
  markings: "graph" | "grid" | "none";
@@ -24,8 +23,8 @@ declare class Grapher extends React.Component<Props> {
24
23
  horizHairline: any;
25
24
  vertHairline: any;
26
25
  static defaultProps: DefaultProps;
27
- static validate(state: UserInput, rubric: Rubric): PerseusScore;
28
- static getUserInputFromProps(props: Props): UserInput;
26
+ static validate(state: PerseusGrapherUserInput, rubric: PerseusGrapherRubric): PerseusScore;
27
+ static getUserInputFromProps(props: Props): PerseusGrapherUserInput;
29
28
  handlePlotChanges: (arg1: any) => any;
30
29
  handleActiveTypeChange: (arg1: any) => any;
31
30
  _getGridConfig(options: Props["graph"] & {
@@ -36,8 +35,8 @@ declare class Grapher extends React.Component<Props> {
36
35
  _setupGraphie: (arg1: any, arg2: any) => void;
37
36
  showHairlines: (arg1: Coord) => void;
38
37
  hideHairlines: () => void;
39
- simpleValidate(rubric: Rubric): PerseusScore;
40
- getUserInput(): UserInput;
38
+ simpleValidate(rubric: PerseusGrapherRubric): PerseusScore;
39
+ getUserInput(): PerseusGrapherUserInput;
41
40
  focus(): void;
42
41
  render(): React.ReactNode;
43
42
  }
@@ -3,6 +3,7 @@ import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import Renderer from "../../renderer";
4
4
  import type { PerseusGroupWidgetOptions } from "../../perseus-types";
5
5
  import type { ChangeFn, FocusPath, PerseusScore, WidgetProps } from "../../types";
6
+ import type { UserInput } from "../../validation.types";
6
7
  type Rubric = PerseusGroupWidgetOptions;
7
8
  type RenderProps = PerseusGroupWidgetOptions;
8
9
  type Props = WidgetProps<RenderProps, Rubric>;
@@ -22,10 +23,10 @@ declare class Group extends React.Component<Props> {
22
23
  static defaultProps: DefaultProps;
23
24
  componentDidMount(): void;
24
25
  change: ChangeFn;
25
- getUserInput: () => any;
26
+ getUserInput(): ReadonlyArray<UserInput | null | undefined> | undefined;
26
27
  getSerializedState: () => any;
27
28
  restoreSerializedState: (arg1: any, arg2: any) => null;
28
- simpleValidate: (arg1: Rubric) => PerseusScore | null | undefined;
29
+ simpleValidate(): PerseusScore | null | undefined;
29
30
  getInputPaths: () => ReadonlyArray<FocusPath> | null | undefined;
30
31
  setInputValue: (arg1: FocusPath, arg2: string, arg3: () => unknown) => void;
31
32
  focus: () => boolean | null | undefined;
@@ -9,19 +9,14 @@
9
9
  import * as React from "react";
10
10
  import type { PerseusIFrameWidgetOptions } from "../../perseus-types";
11
11
  import type { WidgetProps } from "../../types";
12
- type Status = "correct" | "incorrect" | "incomplete";
13
- type UserInput = {
14
- status: Status;
15
- message: string | null;
16
- };
12
+ import type { PerseusIFrameRubric, PerseusIFrameUserInput, UserInputStatus } from "../../validation.types";
17
13
  type RenderProps = PerseusIFrameWidgetOptions & {
18
- status: Status;
14
+ status: UserInputStatus;
19
15
  message: string | null;
20
16
  width: string;
21
17
  height: string;
22
18
  };
23
- export type Rubric = PerseusIFrameWidgetOptions;
24
- type Props = WidgetProps<RenderProps, Rubric>;
19
+ type Props = WidgetProps<RenderProps, PerseusIFrameRubric>;
25
20
  type DefaultProps = {
26
21
  status: Props["status"];
27
22
  message: Props["message"];
@@ -32,7 +27,7 @@ declare class Iframe extends React.Component<Props> {
32
27
  static defaultProps: DefaultProps;
33
28
  componentDidMount(): void;
34
29
  componentWillUnmount(): void;
35
- getUserInput(): UserInput;
30
+ getUserInput(): PerseusIFrameUserInput;
36
31
  handleMessageEvent: (arg1: any) => void;
37
32
  change: (...args: ReadonlyArray<unknown>) => any;
38
33
  simpleValidate: (arg1: any) => any;
@@ -2,10 +2,9 @@ import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { PerseusImageWidgetOptions } from "../../perseus-types";
4
4
  import type { ChangeFn, WidgetProps } from "../../types";
5
+ import type { PerseusImageRubric, PerseusImageUserInput } from "../../validation.types";
5
6
  type RenderProps = PerseusImageWidgetOptions;
6
- type Rubric = PerseusImageWidgetOptions;
7
- type UserInput = null;
8
- type ExternalProps = WidgetProps<RenderProps, Rubric>;
7
+ type ExternalProps = WidgetProps<RenderProps, PerseusImageRubric>;
9
8
  type Props = ExternalProps & {
10
9
  alignment: NonNullable<ExternalProps["alignment"]>;
11
10
  title: NonNullable<ExternalProps["title"]>;
@@ -37,7 +36,7 @@ declare class ImageWidget extends React.Component<Props> {
37
36
  static defaultProps: DefaultProps;
38
37
  static validate(): import("../../types").PerseusScore;
39
38
  change: ChangeFn;
40
- getUserInput: () => UserInput;
39
+ getUserInput(): PerseusImageUserInput;
41
40
  simpleValidate(): import("../../types").PerseusScore;
42
41
  focus: () => void;
43
42
  render(): React.ReactNode;
@@ -1,6 +1,6 @@
1
- import type { Rubric } from "./input-number.types";
2
1
  import type { PerseusStrings } from "../../strings";
3
- import type { APIOptions, PerseusScore } from "@khanacademy/perseus";
2
+ import type { PerseusInputNumberRubric } from "../../validation.types";
3
+ import type { PerseusScore } from "@khanacademy/perseus";
4
4
  export declare const answerTypes: {
5
5
  readonly number: {
6
6
  readonly name: "Numbers";
@@ -37,5 +37,5 @@ export declare const answerTypes: {
37
37
  };
38
38
  declare function inputNumberValidator(state: {
39
39
  currentValue: string;
40
- }, rubric: Rubric, strings: PerseusStrings, onInputError?: APIOptions["onInputError"]): PerseusScore;
40
+ }, rubric: PerseusInputNumberRubric, strings: PerseusStrings): PerseusScore;
41
41
  export default inputNumberValidator;
@@ -1,26 +1,23 @@
1
1
  import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
- import type { Rubric } from "./input-number.types";
4
3
  import type { PerseusInputNumberWidgetOptions } from "../../perseus-types";
5
4
  import type { PerseusStrings } from "../../strings";
6
- import type { APIOptions, Path, PerseusScore, WidgetProps } from "../../types";
7
- type UserInput = {
8
- currentValue: string;
9
- };
5
+ import type { Path, PerseusScore, WidgetProps } from "../../types";
6
+ import type { PerseusInputNumberRubric, PerseusInputNumberUserInput } from "../../validation.types";
10
7
  type RenderProps = {
11
8
  simplify: PerseusInputNumberWidgetOptions["simplify"];
12
9
  size: PerseusInputNumberWidgetOptions["size"];
13
10
  answerType: PerseusInputNumberWidgetOptions["answerType"];
14
11
  rightAlign: PerseusInputNumberWidgetOptions["rightAlign"];
15
12
  };
16
- type ExternalProps = WidgetProps<RenderProps, Rubric>;
13
+ type ExternalProps = WidgetProps<RenderProps, PerseusInputNumberRubric>;
17
14
  type Props = ExternalProps & {
18
15
  apiOptions: NonNullable<ExternalProps["apiOptions"]>;
19
16
  linterContext: NonNullable<ExternalProps["linterContext"]>;
20
17
  rightAlign: NonNullable<ExternalProps["rightAlign"]>;
21
18
  size: NonNullable<ExternalProps["size"]>;
22
19
  currentValue: string;
23
- answerType: NonNullable<Rubric["answerType"]>;
20
+ answerType: NonNullable<PerseusInputNumberRubric["answerType"]>;
24
21
  };
25
22
  type DefaultProps = {
26
23
  answerType: Props["answerType"];
@@ -39,7 +36,7 @@ declare class InputNumber extends React.Component<Props> {
39
36
  static defaultProps: DefaultProps;
40
37
  static validate(state: {
41
38
  currentValue: string;
42
- }, rubric: Rubric, strings: PerseusStrings, onInputError?: APIOptions["onInputError"]): PerseusScore;
39
+ }, rubric: PerseusInputNumberRubric, strings: PerseusStrings): PerseusScore;
43
40
  static getUserInputFromProps(props: Props): {
44
41
  currentValue: string;
45
42
  };
@@ -54,8 +51,8 @@ declare class InputNumber extends React.Component<Props> {
54
51
  getInputPaths: () => ReadonlyArray<Path>;
55
52
  getGrammarTypeForPath: (arg1: Path) => string;
56
53
  setInputValue: (arg1: Path, arg2: string, arg3: () => void) => void;
57
- getUserInput: () => UserInput;
58
- simpleValidate: (rubric: Rubric, onInputError?: APIOptions["onInputError"]) => PerseusScore;
54
+ getUserInput(): PerseusInputNumberUserInput;
55
+ simpleValidate(rubric: PerseusInputNumberRubric): PerseusScore;
59
56
  examples: () => ReadonlyArray<string>;
60
57
  render(): React.ReactNode;
61
58
  }
@@ -2,9 +2,9 @@ import * as React from "react";
2
2
  import type { Coord } from "../../interactive2/types";
3
3
  import type { PerseusInteractionWidgetOptions } from "../../perseus-types";
4
4
  import type { WidgetProps } from "../../types";
5
+ import type { PerseusInteractionRubric, PerseusInteractionUserInput } from "../../validation.types";
5
6
  type RenderProps = PerseusInteractionWidgetOptions;
6
- type Rubric = PerseusInteractionWidgetOptions;
7
- type Props = WidgetProps<RenderProps, Rubric>;
7
+ type Props = WidgetProps<RenderProps, PerseusInteractionRubric>;
8
8
  type DefaultProps = {
9
9
  graph: Props["graph"];
10
10
  elements: Props["elements"];
@@ -24,7 +24,7 @@ declare class Interaction extends React.Component<Props, State> {
24
24
  _eval: (arg1: any, arg2: any) => number;
25
25
  _extractVars: (arg1: any) => ReadonlyArray<any>;
26
26
  change: (arg1: any, arg2: any, arg3: any) => any;
27
- getUserInput: () => any;
27
+ getUserInput(): PerseusInteractionUserInput;
28
28
  simpleValidate(): import("../../types").PerseusScore;
29
29
  render(): React.ReactNode;
30
30
  }
@@ -1,17 +1,14 @@
1
1
  import * as React from "react";
2
2
  import { PerseusI18nContext } from "../components/i18n-context";
3
+ import type { StatefulMafsGraphType } from "./interactive-graphs/stateful-mafs-graph";
3
4
  import type { QuadraticGraphState } from "./interactive-graphs/types";
4
5
  import type { Coord } from "../interactive2/types";
5
6
  import type { PerseusGraphType, PerseusGraphTypeAngle, PerseusGraphTypePoint, PerseusGraphTypePolygon, PerseusGraphTypeSegment, PerseusInteractiveGraphWidgetOptions } from "../perseus-types";
6
- import type { Widget } from "../renderer";
7
7
  import type { ChangeHandler, PerseusScore, WidgetProps } from "../types";
8
8
  import type { QuadraticCoefficient, Range, SineCoefficient } from "../util/geometry";
9
+ import type { PerseusInteractiveGraphRubric, PerseusInteractiveGraphUserInput } from "../validation.types";
9
10
  type RenderProps = PerseusInteractiveGraphWidgetOptions;
10
- export type Rubric = {
11
- correct: PerseusGraphType;
12
- graph: PerseusGraphType;
13
- };
14
- type Props = WidgetProps<RenderProps, Rubric>;
11
+ type Props = WidgetProps<RenderProps, PerseusInteractiveGraphRubric>;
15
12
  type State = any;
16
13
  type DefaultProps = {
17
14
  labels: Props["labels"];
@@ -101,17 +98,17 @@ declare class LegacyInteractiveGraph extends React.Component<Props, State> {
101
98
  addAngleControls: () => void;
102
99
  removeAngleControls: () => void;
103
100
  toggleShowSides: () => void;
104
- getUserInput(): PerseusGraphType;
105
- simpleValidate(rubric: Rubric): PerseusScore;
101
+ getUserInput(): PerseusInteractiveGraphUserInput;
102
+ simpleValidate(rubric: PerseusInteractiveGraphRubric): PerseusScore;
106
103
  focus: () => void;
107
104
  render(): React.ReactNode;
108
105
  }
109
106
  declare class InteractiveGraph extends React.Component<Props, State> {
110
107
  legacyGraphRef: React.RefObject<LegacyInteractiveGraph>;
111
- mafsRef: React.RefObject<Widget>;
108
+ mafsRef: React.RefObject<StatefulMafsGraphType>;
112
109
  static defaultProps: DefaultProps;
113
- getUserInput: Widget["getUserInput"];
114
- simpleValidate(rubric: Rubric): PerseusScore;
110
+ getUserInput(): PerseusInteractiveGraphUserInput;
111
+ simpleValidate(rubric: PerseusInteractiveGraphRubric): PerseusScore;
115
112
  render(): React.JSX.Element;
116
113
  static getQuadraticCoefficients(coords: ReadonlyArray<Coord>): QuadraticCoefficient;
117
114
  static getSinusoidCoefficients(coords: ReadonlyArray<Coord>): SineCoefficient;
@@ -163,7 +160,7 @@ declare class InteractiveGraph extends React.Component<Props, State> {
163
160
  static getRayEquationString(props: Props): string;
164
161
  static getPolygonEquationString(props: Props): string;
165
162
  static getAngleEquationString(props: Props): string;
166
- static validate(userInput: PerseusGraphType, rubric: Rubric, component: any): PerseusScore;
163
+ static validate(userInput: PerseusGraphType, rubric: PerseusInteractiveGraphRubric, component: any): PerseusScore;
167
164
  static getUserInputFromProps(props: Props): PerseusGraphType;
168
165
  }
169
166
  export declare function shouldUseMafs(mafsFlags: Record<string, boolean> | undefined | boolean, graph: PerseusGraphType): boolean;