@khanacademy/perseus 34.1.0 → 35.1.1

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 (84) hide show
  1. package/dist/es/index.js +1109 -974
  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 +1032 -905
  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 +5 -5
  10. package/dist/perseus-types.d.ts +13 -19
  11. package/dist/renderer.d.ts +4 -4
  12. package/dist/server-item-renderer.d.ts +5 -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 +3 -6
  17. package/dist/validation.types.d.ts +114 -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-validator.d.ts +3 -0
  21. package/dist/widgets/cs-program/cs-program.d.ts +5 -10
  22. package/dist/widgets/definition/definition.d.ts +3 -4
  23. package/dist/widgets/dropdown/dropdown-validator.d.ts +2 -2
  24. package/dist/widgets/dropdown/dropdown.d.ts +5 -5
  25. package/dist/widgets/explanation/explanation.d.ts +3 -2
  26. package/dist/widgets/expression/expression-validator.d.ts +2 -2
  27. package/dist/widgets/expression/expression.d.ts +46 -28
  28. package/dist/widgets/expression/expression.types.d.ts +0 -1
  29. package/dist/widgets/graded-group/graded-group.d.ts +2 -2
  30. package/dist/widgets/graded-group-set/graded-group-set.d.ts +2 -2
  31. package/dist/widgets/grapher/grapher-validator.d.ts +4 -0
  32. package/dist/widgets/grapher/grapher.d.ts +6 -7
  33. package/dist/widgets/grapher/util.d.ts +0 -2
  34. package/dist/widgets/group/group.d.ts +3 -2
  35. package/dist/widgets/iframe/iframe-validator.d.ts +3 -0
  36. package/dist/widgets/iframe/iframe.d.ts +7 -11
  37. package/dist/widgets/image/image.d.ts +3 -4
  38. package/dist/widgets/input-number/input-number-validator.d.ts +3 -3
  39. package/dist/widgets/input-number/input-number.d.ts +7 -10
  40. package/dist/widgets/interaction/interaction.d.ts +3 -3
  41. package/dist/widgets/interactive-graph.d.ts +11 -14
  42. package/dist/widgets/interactive-graphs/backgrounds/axis-ticks.d.ts +1 -1
  43. package/dist/widgets/interactive-graphs/graph-locked-layer.d.ts +2 -0
  44. package/dist/widgets/interactive-graphs/interactive-graph-question-builder.d.ts +15 -2
  45. package/dist/widgets/interactive-graphs/interactive-graph-validator.d.ts +4 -0
  46. package/dist/widgets/interactive-graphs/locked-figures/locked-ellipse.d.ts +5 -1
  47. package/dist/widgets/interactive-graphs/locked-figures/locked-function.d.ts +5 -1
  48. package/dist/widgets/interactive-graphs/locked-figures/locked-line.d.ts +2 -0
  49. package/dist/widgets/interactive-graphs/locked-figures/locked-point.d.ts +5 -1
  50. package/dist/widgets/interactive-graphs/locked-figures/locked-polygon.d.ts +5 -1
  51. package/dist/widgets/interactive-graphs/locked-figures/locked-vector.d.ts +5 -1
  52. package/dist/widgets/interactive-graphs/mafs-state-to-interactive-graph.d.ts +3 -0
  53. package/dist/widgets/interactive-graphs/stateful-mafs-graph.d.ts +5 -2
  54. package/dist/widgets/label-image/label-image-validator.d.ts +10 -0
  55. package/dist/widgets/label-image/label-image.d.ts +15 -10
  56. package/dist/widgets/label-image/types.d.ts +0 -4
  57. package/dist/widgets/matcher/matcher-validator.d.ts +4 -0
  58. package/dist/widgets/matcher/matcher.d.ts +6 -5
  59. package/dist/widgets/matrix/matrix-validator.d.ts +5 -0
  60. package/dist/widgets/matrix/matrix.d.ts +6 -5
  61. package/dist/widgets/molecule/molecule.d.ts +2 -1
  62. package/dist/widgets/number-line/number-line-validator.d.ts +4 -0
  63. package/dist/widgets/number-line/number-line.d.ts +7 -4
  64. package/dist/widgets/numeric-input/numeric-input-validator.d.ts +2 -2
  65. package/dist/widgets/numeric-input/numeric-input.d.ts +7 -7
  66. package/dist/widgets/orderer/orderer.d.ts +4 -4
  67. package/dist/widgets/passage/passage.d.ts +3 -4
  68. package/dist/widgets/passage-ref/passage-ref.d.ts +3 -11
  69. package/dist/widgets/passage-ref-target/passage-ref-target.d.ts +2 -1
  70. package/dist/widgets/phet-simulation/phet-simulation.d.ts +2 -2
  71. package/dist/widgets/plotter/plotter-validator.d.ts +4 -0
  72. package/dist/widgets/plotter/plotter.d.ts +6 -5
  73. package/dist/widgets/radio/radio-component.d.ts +6 -13
  74. package/dist/widgets/radio/radio-validator.d.ts +5 -0
  75. package/dist/widgets/sorter/sorter-validator.d.ts +4 -0
  76. package/dist/widgets/sorter/sorter.d.ts +7 -9
  77. package/dist/widgets/table/table-validator.d.ts +5 -0
  78. package/dist/widgets/table/table.d.ts +6 -5
  79. package/dist/widgets/video/video.d.ts +2 -2
  80. package/package.json +1 -1
  81. package/dist/widgets/categorizer/categorizer.types.d.ts +0 -5
  82. package/dist/widgets/dropdown/dropdown.types.d.ts +0 -5
  83. package/dist/widgets/input-number/input-number.types.d.ts +0 -2
  84. package/dist/widgets/numeric-input/numeric-input.types.d.ts +0 -5
@@ -1,10 +1,10 @@
1
1
  import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
- import type { Rubric, UserInput } from "./categorizer.types";
4
3
  import type { PerseusCategorizerWidgetOptions } from "../../perseus-types";
5
4
  import type { PerseusStrings } from "../../strings";
6
5
  import type { PerseusScore, WidgetProps } from "../../types";
7
- type Props = WidgetProps<RenderProps, Rubric> & {
6
+ import type { PerseusCategorizerRubric, PerseusCategorizerUserInput } from "../../validation.types";
7
+ type Props = WidgetProps<RenderProps, PerseusCategorizerRubric> & {
8
8
  values: ReadonlyArray<string>;
9
9
  };
10
10
  type DefaultProps = {
@@ -24,12 +24,12 @@ export declare class Categorizer extends React.Component<Props, State> {
24
24
  context: React.ContextType<typeof PerseusI18nContext>;
25
25
  static defaultProps: DefaultProps;
26
26
  state: State;
27
- static validate(userInput: UserInput, rubric: Rubric, strings: PerseusStrings): PerseusScore;
28
- static getUserInputFromProps(props: Props): UserInput;
27
+ static validate(userInput: PerseusCategorizerUserInput, rubric: PerseusCategorizerRubric, strings: PerseusStrings): PerseusScore;
28
+ static getUserInputFromProps(props: Props): PerseusCategorizerUserInput;
29
29
  change: (...args: ReadonlyArray<unknown>) => any;
30
- getUserInput: () => UserInput;
30
+ getUserInput(): PerseusCategorizerUserInput;
31
31
  onChange(itemNum: any, catNum: any): void;
32
- simpleValidate: (arg1: Rubric) => PerseusScore;
32
+ simpleValidate(rubric: PerseusCategorizerRubric): PerseusScore;
33
33
  render(): React.ReactNode;
34
34
  }
35
35
  type RenderProps = {
@@ -0,0 +1,3 @@
1
+ import type { PerseusScore } from "../../types";
2
+ import type { PerseusCSProgramUserInput } from "../../validation.types";
3
+ export declare function csProgramValidator(state: PerseusCSProgramUserInput): PerseusScore;
@@ -4,17 +4,12 @@
4
4
  import * as React from "react";
5
5
  import type { PerseusCSProgramWidgetOptions } from "../../perseus-types";
6
6
  import type { PerseusScore, WidgetProps } from "../../types";
7
- type Status = "correct" | "incorrect" | "incomplete";
8
- type UserInput = {
9
- status: Status;
10
- message: string | null;
11
- };
7
+ import type { PerseusCSProgramRubric, PerseusCSProgramUserInput, UserInputStatus } from "../../validation.types";
12
8
  type RenderProps = PerseusCSProgramWidgetOptions & {
13
- status: Status;
9
+ status: UserInputStatus;
14
10
  message: string | null;
15
11
  };
16
- export type Rubric = PerseusCSProgramWidgetOptions;
17
- type Props = WidgetProps<RenderProps, Rubric>;
12
+ type Props = WidgetProps<RenderProps, PerseusCSProgramRubric>;
18
13
  type DefaultProps = {
19
14
  showEditor: Props["showEditor"];
20
15
  showButtons: Props["showButtons"];
@@ -23,12 +18,12 @@ type DefaultProps = {
23
18
  };
24
19
  declare class CSProgram extends React.Component<Props> {
25
20
  static defaultProps: DefaultProps;
26
- static validate(state: UserInput, rubric: any): PerseusScore;
21
+ static validate(state: PerseusCSProgramUserInput): PerseusScore;
27
22
  componentDidMount(): void;
28
23
  componentWillUnmount(): void;
29
24
  handleMessageEvent: (arg1: any) => void;
30
25
  change: (...args: ReadonlyArray<unknown>) => any;
31
- simpleValidate(rubric: any): PerseusScore;
26
+ simpleValidate(): PerseusScore;
32
27
  render(): React.ReactNode;
33
28
  }
34
29
  declare const _default: Readonly<{
@@ -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;
@@ -148,8 +147,13 @@ declare const _default: Readonly<{
148
147
  "unlimited-point"?: boolean | undefined;
149
148
  } & {
150
149
  "interactive-graph-locked-features-labels"?: boolean | undefined;
150
+ "locked-figures-aria"?: boolean | undefined;
151
151
  "locked-point-labels"?: boolean | undefined;
152
152
  "locked-line-labels"?: boolean | undefined;
153
+ "locked-vector-labels"?: boolean | undefined;
154
+ "locked-ellipse-labels"?: boolean | undefined;
155
+ "locked-polygon-labels"?: boolean | undefined;
156
+ "locked-function-labels"?: boolean | undefined;
153
157
  }) | undefined;
154
158
  } | undefined;
155
159
  onWidgetStartProps?: ((widgets: import("../../perseus-types").PerseusWidgetsMap) => void) | undefined;
@@ -165,7 +169,6 @@ declare const _default: Readonly<{
165
169
  isArticle: NonNullable<boolean | undefined>;
166
170
  isMobile: NonNullable<boolean | undefined>;
167
171
  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
172
  readOnly: NonNullable<boolean | undefined>;
170
173
  setDrawingAreaAvailable: (arg1: boolean) => unknown;
171
174
  showAlignmentOptions: NonNullable<boolean | undefined>;
@@ -175,7 +178,7 @@ declare const _default: Readonly<{
175
178
  onFocus: (blurPath: import("../../types").FocusPath) => void;
176
179
  onBlur: (blurPath: import("../../types").FocusPath) => void;
177
180
  findWidgets: (arg1: import("../../types").FilterCriterion) => readonly any[];
178
- reviewModeRubric: PerseusExpressionWidgetOptions;
181
+ reviewModeRubric: PerseusExpressionRubric;
179
182
  onChange: import("../../types").ChangeHandler;
180
183
  trackInteraction: (extraData?: Empty | undefined) => void;
181
184
  isLastUsedWidget: boolean;
@@ -184,7 +187,6 @@ declare const _default: Readonly<{
184
187
  } & Partial<import("../../types").PerseusDependenciesV2> & {
185
188
  apiOptions: Readonly<Readonly<{
186
189
  isArticle?: boolean | undefined;
187
- onInputError?: ((widgetId: any, value: string, message?: string | null | undefined) => unknown) | undefined;
188
190
  onFocusChange?: ((newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
189
191
  GroupMetadataEditor?: React.ComponentType<any> | undefined;
190
192
  showAlignmentOptions?: boolean | undefined;
@@ -230,8 +232,13 @@ declare const _default: Readonly<{
230
232
  "unlimited-point"?: boolean | undefined;
231
233
  } & {
232
234
  "interactive-graph-locked-features-labels"?: boolean | undefined;
235
+ "locked-figures-aria"?: boolean | undefined;
233
236
  "locked-point-labels"?: boolean | undefined;
234
237
  "locked-line-labels"?: boolean | undefined;
238
+ "locked-vector-labels"?: boolean | undefined;
239
+ "locked-ellipse-labels"?: boolean | undefined;
240
+ "locked-polygon-labels"?: boolean | undefined;
241
+ "locked-function-labels"?: boolean | undefined;
235
242
  }) | undefined;
236
243
  } | undefined;
237
244
  onWidgetStartProps?: ((widgets: import("../../perseus-types").PerseusWidgetsMap) => void) | undefined;
@@ -247,7 +254,6 @@ declare const _default: Readonly<{
247
254
  isArticle: NonNullable<boolean | undefined>;
248
255
  isMobile: NonNullable<boolean | undefined>;
249
256
  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
257
  readOnly: NonNullable<boolean | undefined>;
252
258
  setDrawingAreaAvailable: (arg1: boolean) => unknown;
253
259
  showAlignmentOptions: NonNullable<boolean | undefined>;
@@ -261,12 +267,13 @@ declare const _default: Readonly<{
261
267
  visibleLabel: string | undefined;
262
268
  ariaLabel: string | undefined;
263
269
  value: string;
264
- }, "ariaLabel" | "trackInteraction" | "static" | "onChange" | "analytics" | "problemNum" | "questionCompleted" | "keypadElement" | "alignment" | "buttonsVisible" | "containerSizeClass" | "widgetId" | "findWidgets" | "visibleLabel" | "keypadConfiguration" | "reviewModeRubric" | "isLastUsedWidget"> & {
270
+ }, "ariaLabel" | "trackInteraction" | "static" | "onChange" | "analytics" | "keypadElement" | "containerSizeClass" | "widgetId" | "problemNum" | "questionCompleted" | "findWidgets" | "alignment" | "buttonsVisible" | "visibleLabel" | "keypadConfiguration" | "reviewModeRubric" | "isLastUsedWidget"> & {
265
271
  value?: string | undefined;
266
272
  linterContext?: import("@khanacademy/perseus-linter").LinterContextProps | undefined;
273
+ onFocus?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
274
+ onBlur?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
267
275
  apiOptions?: Readonly<Readonly<{
268
276
  isArticle?: boolean | undefined;
269
- onInputError?: ((widgetId: any, value: string, message?: string | null | undefined) => unknown) | undefined;
270
277
  onFocusChange?: ((newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
271
278
  GroupMetadataEditor?: React.ComponentType<any> | undefined;
272
279
  showAlignmentOptions?: boolean | undefined;
@@ -312,8 +319,13 @@ declare const _default: Readonly<{
312
319
  "unlimited-point"?: boolean | undefined;
313
320
  } & {
314
321
  "interactive-graph-locked-features-labels"?: boolean | undefined;
322
+ "locked-figures-aria"?: boolean | undefined;
315
323
  "locked-point-labels"?: boolean | undefined;
316
324
  "locked-line-labels"?: boolean | undefined;
325
+ "locked-vector-labels"?: boolean | undefined;
326
+ "locked-ellipse-labels"?: boolean | undefined;
327
+ "locked-polygon-labels"?: boolean | undefined;
328
+ "locked-function-labels"?: boolean | undefined;
317
329
  }) | undefined;
318
330
  } | undefined;
319
331
  onWidgetStartProps?: ((widgets: import("../../perseus-types").PerseusWidgetsMap) => void) | undefined;
@@ -329,14 +341,11 @@ declare const _default: Readonly<{
329
341
  isArticle: NonNullable<boolean | undefined>;
330
342
  isMobile: NonNullable<boolean | undefined>;
331
343
  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
344
  readOnly: NonNullable<boolean | undefined>;
334
345
  setDrawingAreaAvailable: (arg1: boolean) => unknown;
335
346
  showAlignmentOptions: NonNullable<boolean | undefined>;
336
347
  }> | undefined;
337
348
  buttonSets?: import("../../perseus-types").LegacyButtonSets | undefined;
338
- onFocus?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
339
- onBlur?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
340
349
  functions?: readonly string[] | undefined;
341
350
  times?: boolean | undefined;
342
351
  } & {}, "analytics"> & React.RefAttributes<Expression>>) | undefined;
@@ -347,7 +356,6 @@ declare const _default: Readonly<{
347
356
  problemNum: number | null | undefined;
348
357
  apiOptions: Readonly<Readonly<{
349
358
  isArticle?: boolean | undefined;
350
- onInputError?: ((widgetId: any, value: string, message?: string | null | undefined) => unknown) | undefined;
351
359
  onFocusChange?: ((newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
352
360
  GroupMetadataEditor?: React.ComponentType<any> | undefined;
353
361
  showAlignmentOptions?: boolean | undefined;
@@ -393,8 +401,13 @@ declare const _default: Readonly<{
393
401
  "unlimited-point"?: boolean | undefined;
394
402
  } & {
395
403
  "interactive-graph-locked-features-labels"?: boolean | undefined;
404
+ "locked-figures-aria"?: boolean | undefined;
396
405
  "locked-point-labels"?: boolean | undefined;
397
406
  "locked-line-labels"?: boolean | undefined;
407
+ "locked-vector-labels"?: boolean | undefined;
408
+ "locked-ellipse-labels"?: boolean | undefined;
409
+ "locked-polygon-labels"?: boolean | undefined;
410
+ "locked-function-labels"?: boolean | undefined;
398
411
  }) | undefined;
399
412
  } | undefined;
400
413
  onWidgetStartProps?: ((widgets: import("../../perseus-types").PerseusWidgetsMap) => void) | undefined;
@@ -410,7 +423,6 @@ declare const _default: Readonly<{
410
423
  isArticle: NonNullable<boolean | undefined>;
411
424
  isMobile: NonNullable<boolean | undefined>;
412
425
  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
426
  readOnly: NonNullable<boolean | undefined>;
415
427
  setDrawingAreaAvailable: (arg1: boolean) => unknown;
416
428
  showAlignmentOptions: NonNullable<boolean | undefined>;
@@ -420,7 +432,7 @@ declare const _default: Readonly<{
420
432
  onFocus: (blurPath: import("../../types").FocusPath) => void;
421
433
  onBlur: (blurPath: import("../../types").FocusPath) => void;
422
434
  findWidgets: (arg1: import("../../types").FilterCriterion) => readonly any[];
423
- reviewModeRubric: PerseusExpressionWidgetOptions;
435
+ reviewModeRubric: PerseusExpressionRubric;
424
436
  onChange: import("../../types").ChangeHandler;
425
437
  trackInteraction: (extraData?: Empty | undefined) => void;
426
438
  isLastUsedWidget: boolean;
@@ -429,7 +441,6 @@ declare const _default: Readonly<{
429
441
  } & Partial<import("../../types").PerseusDependenciesV2> & {
430
442
  apiOptions: Readonly<Readonly<{
431
443
  isArticle?: boolean | undefined;
432
- onInputError?: ((widgetId: any, value: string, message?: string | null | undefined) => unknown) | undefined;
433
444
  onFocusChange?: ((newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
434
445
  GroupMetadataEditor?: React.ComponentType<any> | undefined;
435
446
  showAlignmentOptions?: boolean | undefined;
@@ -475,8 +486,13 @@ declare const _default: Readonly<{
475
486
  "unlimited-point"?: boolean | undefined;
476
487
  } & {
477
488
  "interactive-graph-locked-features-labels"?: boolean | undefined;
489
+ "locked-figures-aria"?: boolean | undefined;
478
490
  "locked-point-labels"?: boolean | undefined;
479
491
  "locked-line-labels"?: boolean | undefined;
492
+ "locked-vector-labels"?: boolean | undefined;
493
+ "locked-ellipse-labels"?: boolean | undefined;
494
+ "locked-polygon-labels"?: boolean | undefined;
495
+ "locked-function-labels"?: boolean | undefined;
480
496
  }) | undefined;
481
497
  } | undefined;
482
498
  onWidgetStartProps?: ((widgets: import("../../perseus-types").PerseusWidgetsMap) => void) | undefined;
@@ -492,7 +508,6 @@ declare const _default: Readonly<{
492
508
  isArticle: NonNullable<boolean | undefined>;
493
509
  isMobile: NonNullable<boolean | undefined>;
494
510
  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
511
  readOnly: NonNullable<boolean | undefined>;
497
512
  setDrawingAreaAvailable: (arg1: boolean) => unknown;
498
513
  showAlignmentOptions: NonNullable<boolean | undefined>;
@@ -506,12 +521,13 @@ declare const _default: Readonly<{
506
521
  visibleLabel: string | undefined;
507
522
  ariaLabel: string | undefined;
508
523
  value: string;
509
- }, "ariaLabel" | "trackInteraction" | "static" | "onChange" | "analytics" | "problemNum" | "questionCompleted" | "keypadElement" | "alignment" | "buttonsVisible" | "containerSizeClass" | "widgetId" | "findWidgets" | "visibleLabel" | "keypadConfiguration" | "reviewModeRubric" | "isLastUsedWidget"> & {
524
+ }, "ariaLabel" | "trackInteraction" | "static" | "onChange" | "analytics" | "keypadElement" | "containerSizeClass" | "widgetId" | "problemNum" | "questionCompleted" | "findWidgets" | "alignment" | "buttonsVisible" | "visibleLabel" | "keypadConfiguration" | "reviewModeRubric" | "isLastUsedWidget"> & {
510
525
  value?: string | undefined;
511
526
  linterContext?: import("@khanacademy/perseus-linter").LinterContextProps | undefined;
527
+ onFocus?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
528
+ onBlur?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
512
529
  apiOptions?: Readonly<Readonly<{
513
530
  isArticle?: boolean | undefined;
514
- onInputError?: ((widgetId: any, value: string, message?: string | null | undefined) => unknown) | undefined;
515
531
  onFocusChange?: ((newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
516
532
  GroupMetadataEditor?: React.ComponentType<any> | undefined;
517
533
  showAlignmentOptions?: boolean | undefined;
@@ -557,8 +573,13 @@ declare const _default: Readonly<{
557
573
  "unlimited-point"?: boolean | undefined;
558
574
  } & {
559
575
  "interactive-graph-locked-features-labels"?: boolean | undefined;
576
+ "locked-figures-aria"?: boolean | undefined;
560
577
  "locked-point-labels"?: boolean | undefined;
561
578
  "locked-line-labels"?: boolean | undefined;
579
+ "locked-vector-labels"?: boolean | undefined;
580
+ "locked-ellipse-labels"?: boolean | undefined;
581
+ "locked-polygon-labels"?: boolean | undefined;
582
+ "locked-function-labels"?: boolean | undefined;
562
583
  }) | undefined;
563
584
  } | undefined;
564
585
  onWidgetStartProps?: ((widgets: import("../../perseus-types").PerseusWidgetsMap) => void) | undefined;
@@ -574,14 +595,11 @@ declare const _default: Readonly<{
574
595
  isArticle: NonNullable<boolean | undefined>;
575
596
  isMobile: NonNullable<boolean | undefined>;
576
597
  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
598
  readOnly: NonNullable<boolean | undefined>;
579
599
  setDrawingAreaAvailable: (arg1: boolean) => unknown;
580
600
  showAlignmentOptions: NonNullable<boolean | undefined>;
581
601
  }> | undefined;
582
602
  buttonSets?: import("../../perseus-types").LegacyButtonSets | undefined;
583
- onFocus?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
584
- onBlur?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
585
603
  functions?: readonly string[] | undefined;
586
604
  times?: boolean | undefined;
587
605
  } & {}, "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 = {
@@ -0,0 +1,4 @@
1
+ import type { PerseusScore } from "../../types";
2
+ import type { PerseusGrapherRubric, PerseusGrapherUserInput } from "../../validation.types";
3
+ declare function grapherValidator(state: PerseusGrapherUserInput, rubric: PerseusGrapherRubric): PerseusScore;
4
+ export default grapherValidator;
@@ -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
  }
@@ -1,11 +1,9 @@
1
1
  import type { Coord } from "../../interactive2/types";
2
- import type { PerseusScore } from "../../types";
3
2
  export declare const DEFAULT_BACKGROUND_IMAGE: {
4
3
  readonly url: null;
5
4
  };
6
5
  export declare const allTypes: any;
7
6
  export declare function functionForType(type: string): any;
8
- export declare const validate: (state: any, rubric: any) => PerseusScore;
9
7
  export declare const getEquationString: (props: any) => string;
10
8
  export declare const pointsFromNormalized: (coordsList: ReadonlyArray<Coord>, range: [Coord, Coord], step: [number, number], snapStep: [number, number]) => ReadonlyArray<Coord>;
11
9
  export declare const maybePointsFromNormalized: (coordsList: ReadonlyArray<Coord> | null | undefined, range: [Coord, Coord], step: [number, number], snapStep: [number, number]) => ReadonlyArray<Coord> | null | undefined;
@@ -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;
@@ -0,0 +1,3 @@
1
+ import type { PerseusScore } from "../../types";
2
+ import type { PerseusIFrameUserInput } from "../../validation.types";
3
+ export declare function iframeValidator(state: PerseusIFrameUserInput): PerseusScore;
@@ -8,20 +8,15 @@
8
8
  */
9
9
  import * as React from "react";
10
10
  import type { PerseusIFrameWidgetOptions } from "../../perseus-types";
11
- import type { WidgetProps } from "../../types";
12
- type Status = "correct" | "incorrect" | "incomplete";
13
- type UserInput = {
14
- status: Status;
15
- message: string | null;
16
- };
11
+ import type { PerseusScore, WidgetProps } from "../../types";
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"];
@@ -30,12 +25,13 @@ type DefaultProps = {
30
25
  };
31
26
  declare class Iframe extends React.Component<Props> {
32
27
  static defaultProps: DefaultProps;
28
+ static validate(state: PerseusIFrameUserInput): PerseusScore;
33
29
  componentDidMount(): void;
34
30
  componentWillUnmount(): void;
35
- getUserInput(): UserInput;
31
+ getUserInput(): PerseusIFrameUserInput;
36
32
  handleMessageEvent: (arg1: any) => void;
37
33
  change: (...args: ReadonlyArray<unknown>) => any;
38
- simpleValidate: (arg1: any) => any;
34
+ simpleValidate(): PerseusScore;
39
35
  render(): React.ReactNode;
40
36
  }
41
37
  declare const _default: Readonly<{
@@ -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;