@khanacademy/perseus 35.0.0 → 36.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 (69) hide show
  1. package/dist/es/index.js +19402 -19310
  2. package/dist/es/index.js.map +1 -1
  3. package/dist/index.js +19493 -19400
  4. package/dist/index.js.map +1 -1
  5. package/dist/multi-items/multi-renderer.d.ts +1 -2
  6. package/dist/perseus-api.d.ts +2 -0
  7. package/dist/perseus-types.d.ts +42 -35
  8. package/dist/renderer.d.ts +2 -33
  9. package/dist/server-item-renderer.d.ts +3 -1
  10. package/dist/types.d.ts +43 -8
  11. package/dist/util.d.ts +1 -8
  12. package/dist/validation.types.d.ts +8 -11
  13. package/dist/widgets/categorizer/categorizer.d.ts +2 -2
  14. package/dist/widgets/cs-program/cs-program-validator.d.ts +3 -0
  15. package/dist/widgets/cs-program/cs-program.d.ts +5 -4
  16. package/dist/widgets/definition/definition.d.ts +4 -4
  17. package/dist/widgets/deprecated-standin/index.d.ts +6 -7
  18. package/dist/widgets/dropdown/dropdown.d.ts +2 -2
  19. package/dist/widgets/explanation/explanation.d.ts +4 -4
  20. package/dist/widgets/expression/expression.d.ts +50 -38
  21. package/dist/widgets/graded-group/graded-group.d.ts +2 -2
  22. package/dist/widgets/graded-group-set/graded-group-set.d.ts +2 -2
  23. package/dist/widgets/grapher/grapher-validator.d.ts +4 -0
  24. package/dist/widgets/grapher/grapher.d.ts +2 -3
  25. package/dist/widgets/grapher/util.d.ts +0 -2
  26. package/dist/widgets/group/group.d.ts +5 -5
  27. package/dist/widgets/iframe/iframe-validator.d.ts +3 -0
  28. package/dist/widgets/iframe/iframe.d.ts +4 -3
  29. package/dist/widgets/image/image.d.ts +4 -5
  30. package/dist/widgets/input-number/input-number.d.ts +2 -2
  31. package/dist/widgets/interaction/interaction.d.ts +4 -4
  32. package/dist/widgets/interactive-graph.d.ts +5 -5
  33. package/dist/widgets/interactive-graphs/backgrounds/axis-ticks.d.ts +1 -1
  34. package/dist/widgets/interactive-graphs/graph-locked-layer.d.ts +2 -0
  35. package/dist/widgets/interactive-graphs/interactive-graph-question-builder.d.ts +7 -0
  36. package/dist/widgets/interactive-graphs/interactive-graph-validator.d.ts +4 -0
  37. package/dist/widgets/interactive-graphs/locked-figures/locked-ellipse.d.ts +5 -1
  38. package/dist/widgets/interactive-graphs/locked-figures/locked-function.d.ts +5 -1
  39. package/dist/widgets/interactive-graphs/locked-figures/locked-line.d.ts +2 -0
  40. package/dist/widgets/interactive-graphs/locked-figures/locked-point.d.ts +5 -1
  41. package/dist/widgets/interactive-graphs/locked-figures/locked-polygon.d.ts +5 -1
  42. package/dist/widgets/interactive-graphs/locked-figures/locked-vector.d.ts +5 -1
  43. package/dist/widgets/interactive-graphs/mafs-state-to-interactive-graph.d.ts +3 -0
  44. package/dist/widgets/label-image/label-image.d.ts +6 -2
  45. package/dist/widgets/matcher/matcher-validator.d.ts +4 -0
  46. package/dist/widgets/matcher/matcher.d.ts +4 -3
  47. package/dist/widgets/matrix/matrix-validator.d.ts +5 -0
  48. package/dist/widgets/matrix/matrix.d.ts +4 -3
  49. package/dist/widgets/measurer/measurer.d.ts +47 -2
  50. package/dist/widgets/molecule/molecule.d.ts +2 -1
  51. package/dist/widgets/number-line/number-line-validator.d.ts +4 -0
  52. package/dist/widgets/number-line/number-line.d.ts +7 -6
  53. package/dist/widgets/numeric-input/numeric-input.d.ts +2 -2
  54. package/dist/widgets/orderer/orderer-validator.d.ts +3 -0
  55. package/dist/widgets/orderer/orderer.d.ts +4 -3
  56. package/dist/widgets/passage/passage.d.ts +4 -4
  57. package/dist/widgets/passage/utils.d.ts +12 -0
  58. package/dist/widgets/passage-ref/passage-ref.d.ts +4 -4
  59. package/dist/widgets/passage-ref-target/passage-ref-target.d.ts +4 -4
  60. package/dist/widgets/phet-simulation/phet-simulation.d.ts +4 -4
  61. package/dist/widgets/plotter/plotter-validator.d.ts +4 -0
  62. package/dist/widgets/plotter/plotter.d.ts +3 -2
  63. package/dist/widgets/python-program/python-program.d.ts +6 -1
  64. package/dist/widgets/radio/radio-component.d.ts +2 -2
  65. package/dist/widgets/sorter/sorter.d.ts +2 -2
  66. package/dist/widgets/table/table-validator.d.ts +5 -0
  67. package/dist/widgets/table/table.d.ts +4 -3
  68. package/dist/widgets/video/video.d.ts +2 -2
  69. package/package.json +1 -1
@@ -3,7 +3,7 @@ import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { DependenciesContext } from "../../dependencies";
4
4
  import type { PerseusExpressionWidgetOptions } from "../../perseus-types";
5
5
  import type { PerseusStrings } from "../../strings";
6
- import type { PerseusScore, WidgetProps } from "../../types";
6
+ import type { FocusPath, PerseusScore, Widget, WidgetProps } from "../../types";
7
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>;
@@ -44,7 +44,7 @@ type DefaultProps = {
44
44
  times: Props["times"];
45
45
  value: Props["value"];
46
46
  };
47
- export declare class Expression extends React.Component<Props, ExpressionState> {
47
+ export declare class Expression extends React.Component<Props, ExpressionState> implements Widget {
48
48
  static contextType: React.Context<{
49
49
  strings: PerseusStrings;
50
50
  locale: string;
@@ -72,12 +72,12 @@ export declare class Expression extends React.Component<Props, ExpressionState>
72
72
  _handleFocus: () => void;
73
73
  _handleBlur: () => void;
74
74
  focus: () => boolean;
75
- focusInputPath: (inputPath: InputPath) => void;
76
- blurInputPath: (inputPath: InputPath) => void;
75
+ focusInputPath(inputPath: InputPath): void;
76
+ blurInputPath(inputPath: InputPath): void;
77
77
  insert(keyPressed: Key): void;
78
78
  getInputPaths: () => ReadonlyArray<ReadonlyArray<any>>;
79
- getGrammarTypeForPath: (inputPath: string) => string;
80
- setInputValue: (path: string, newValue: string, cb: () => void) => void;
79
+ getGrammarTypeForPath(inputPath: FocusPath): string;
80
+ setInputValue(path: FocusPath, newValue: string, cb: () => void): void;
81
81
  render(): React.JSX.Element;
82
82
  }
83
83
  /**
@@ -102,7 +102,7 @@ declare const _default: Readonly<{
102
102
  problemNum: number | null | undefined;
103
103
  apiOptions: Readonly<Readonly<{
104
104
  isArticle?: boolean | undefined;
105
- onFocusChange?: ((newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
105
+ onFocusChange?: ((newFocusPath: FocusPath, oldFocusPath: FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
106
106
  GroupMetadataEditor?: React.ComponentType<any> | undefined;
107
107
  showAlignmentOptions?: boolean | undefined;
108
108
  readOnly?: boolean | undefined;
@@ -147,10 +147,12 @@ declare const _default: Readonly<{
147
147
  "unlimited-point"?: boolean | undefined;
148
148
  } & {
149
149
  "interactive-graph-locked-features-labels"?: boolean | undefined;
150
+ "locked-figures-aria"?: boolean | undefined;
150
151
  "locked-point-labels"?: boolean | undefined;
151
152
  "locked-line-labels"?: boolean | undefined;
152
153
  "locked-vector-labels"?: boolean | undefined;
153
154
  "locked-ellipse-labels"?: boolean | undefined;
155
+ "locked-polygon-labels"?: boolean | undefined;
154
156
  "locked-function-labels"?: boolean | undefined;
155
157
  }) | undefined;
156
158
  } | undefined;
@@ -166,17 +168,17 @@ declare const _default: Readonly<{
166
168
  groupAnnotator: (groupNumber: number, widgetId: string) => React.ReactNode;
167
169
  isArticle: NonNullable<boolean | undefined>;
168
170
  isMobile: NonNullable<boolean | undefined>;
169
- onFocusChange: (newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown;
171
+ onFocusChange: (newFocusPath: FocusPath, oldFocusPath: FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown;
170
172
  readOnly: NonNullable<boolean | undefined>;
171
173
  setDrawingAreaAvailable: (arg1: boolean) => unknown;
172
174
  showAlignmentOptions: NonNullable<boolean | undefined>;
173
175
  }>;
174
176
  keypadElement?: any;
175
177
  questionCompleted?: boolean | undefined;
176
- onFocus: (blurPath: import("../../types").FocusPath) => void;
177
- onBlur: (blurPath: import("../../types").FocusPath) => void;
178
- findWidgets: (arg1: import("../../types").FilterCriterion) => readonly any[];
179
- reviewModeRubric: PerseusExpressionWidgetOptions;
178
+ onFocus: (blurPath: FocusPath) => void;
179
+ onBlur: (blurPath: FocusPath) => void;
180
+ findWidgets: (criterion: import("../../types").FilterCriterion) => readonly Widget[];
181
+ reviewModeRubric: PerseusExpressionRubric;
180
182
  onChange: import("../../types").ChangeHandler;
181
183
  trackInteraction: (extraData?: Empty | undefined) => void;
182
184
  isLastUsedWidget: boolean;
@@ -185,7 +187,7 @@ declare const _default: Readonly<{
185
187
  } & Partial<import("../../types").PerseusDependenciesV2> & {
186
188
  apiOptions: Readonly<Readonly<{
187
189
  isArticle?: boolean | undefined;
188
- onFocusChange?: ((newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
190
+ onFocusChange?: ((newFocusPath: FocusPath, oldFocusPath: FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
189
191
  GroupMetadataEditor?: React.ComponentType<any> | undefined;
190
192
  showAlignmentOptions?: boolean | undefined;
191
193
  readOnly?: boolean | undefined;
@@ -230,10 +232,12 @@ 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;
235
238
  "locked-vector-labels"?: boolean | undefined;
236
239
  "locked-ellipse-labels"?: boolean | undefined;
240
+ "locked-polygon-labels"?: boolean | undefined;
237
241
  "locked-function-labels"?: boolean | undefined;
238
242
  }) | undefined;
239
243
  } | undefined;
@@ -249,7 +253,7 @@ declare const _default: Readonly<{
249
253
  groupAnnotator: (groupNumber: number, widgetId: string) => React.ReactNode;
250
254
  isArticle: NonNullable<boolean | undefined>;
251
255
  isMobile: NonNullable<boolean | undefined>;
252
- onFocusChange: (newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown;
256
+ onFocusChange: (newFocusPath: FocusPath, oldFocusPath: FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown;
253
257
  readOnly: NonNullable<boolean | undefined>;
254
258
  setDrawingAreaAvailable: (arg1: boolean) => unknown;
255
259
  showAlignmentOptions: NonNullable<boolean | undefined>;
@@ -257,20 +261,19 @@ declare const _default: Readonly<{
257
261
  buttonSets: import("../../perseus-types").LegacyButtonSets;
258
262
  functions: readonly string[];
259
263
  linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
260
- onBlur: (blurPath: import("../../types").FocusPath) => void;
261
- onFocus: (blurPath: import("../../types").FocusPath) => void;
264
+ onBlur: (blurPath: FocusPath) => void;
265
+ onFocus: (blurPath: FocusPath) => void;
262
266
  times: boolean;
263
267
  visibleLabel: string | undefined;
264
268
  ariaLabel: string | undefined;
265
269
  value: string;
266
- }, "ariaLabel" | "trackInteraction" | "static" | "onChange" | "analytics" | "keypadElement" | "containerSizeClass" | "widgetId" | "problemNum" | "questionCompleted" | "findWidgets" | "alignment" | "buttonsVisible" | "visibleLabel" | "keypadConfiguration" | "reviewModeRubric" | "isLastUsedWidget"> & {
270
+ }, "ariaLabel" | "static" | "onChange" | "keypadElement" | "containerSizeClass" | "widgetId" | "problemNum" | "questionCompleted" | "findWidgets" | "trackInteraction" | "analytics" | "alignment" | "buttonsVisible" | "visibleLabel" | "keypadConfiguration" | "reviewModeRubric" | "isLastUsedWidget"> & {
267
271
  value?: string | undefined;
268
- linterContext?: import("@khanacademy/perseus-linter").LinterContextProps | undefined;
269
- onFocus?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
270
- onBlur?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
272
+ onFocus?: ((blurPath: FocusPath) => void) | undefined;
273
+ onBlur?: ((blurPath: FocusPath) => void) | undefined;
271
274
  apiOptions?: Readonly<Readonly<{
272
275
  isArticle?: boolean | undefined;
273
- onFocusChange?: ((newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
276
+ onFocusChange?: ((newFocusPath: FocusPath, oldFocusPath: FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
274
277
  GroupMetadataEditor?: React.ComponentType<any> | undefined;
275
278
  showAlignmentOptions?: boolean | undefined;
276
279
  readOnly?: boolean | undefined;
@@ -315,10 +318,12 @@ declare const _default: Readonly<{
315
318
  "unlimited-point"?: boolean | undefined;
316
319
  } & {
317
320
  "interactive-graph-locked-features-labels"?: boolean | undefined;
321
+ "locked-figures-aria"?: boolean | undefined;
318
322
  "locked-point-labels"?: boolean | undefined;
319
323
  "locked-line-labels"?: boolean | undefined;
320
324
  "locked-vector-labels"?: boolean | undefined;
321
325
  "locked-ellipse-labels"?: boolean | undefined;
326
+ "locked-polygon-labels"?: boolean | undefined;
322
327
  "locked-function-labels"?: boolean | undefined;
323
328
  }) | undefined;
324
329
  } | undefined;
@@ -334,11 +339,12 @@ declare const _default: Readonly<{
334
339
  groupAnnotator: (groupNumber: number, widgetId: string) => React.ReactNode;
335
340
  isArticle: NonNullable<boolean | undefined>;
336
341
  isMobile: NonNullable<boolean | undefined>;
337
- onFocusChange: (newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown;
342
+ onFocusChange: (newFocusPath: FocusPath, oldFocusPath: FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown;
338
343
  readOnly: NonNullable<boolean | undefined>;
339
344
  setDrawingAreaAvailable: (arg1: boolean) => unknown;
340
345
  showAlignmentOptions: NonNullable<boolean | undefined>;
341
346
  }> | undefined;
347
+ linterContext?: import("@khanacademy/perseus-linter").LinterContextProps | undefined;
342
348
  buttonSets?: import("../../perseus-types").LegacyButtonSets | undefined;
343
349
  functions?: readonly string[] | undefined;
344
350
  times?: boolean | undefined;
@@ -350,7 +356,7 @@ declare const _default: Readonly<{
350
356
  problemNum: number | null | undefined;
351
357
  apiOptions: Readonly<Readonly<{
352
358
  isArticle?: boolean | undefined;
353
- onFocusChange?: ((newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
359
+ onFocusChange?: ((newFocusPath: FocusPath, oldFocusPath: FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
354
360
  GroupMetadataEditor?: React.ComponentType<any> | undefined;
355
361
  showAlignmentOptions?: boolean | undefined;
356
362
  readOnly?: boolean | undefined;
@@ -395,10 +401,12 @@ declare const _default: Readonly<{
395
401
  "unlimited-point"?: boolean | undefined;
396
402
  } & {
397
403
  "interactive-graph-locked-features-labels"?: boolean | undefined;
404
+ "locked-figures-aria"?: boolean | undefined;
398
405
  "locked-point-labels"?: boolean | undefined;
399
406
  "locked-line-labels"?: boolean | undefined;
400
407
  "locked-vector-labels"?: boolean | undefined;
401
408
  "locked-ellipse-labels"?: boolean | undefined;
409
+ "locked-polygon-labels"?: boolean | undefined;
402
410
  "locked-function-labels"?: boolean | undefined;
403
411
  }) | undefined;
404
412
  } | undefined;
@@ -414,17 +422,17 @@ declare const _default: Readonly<{
414
422
  groupAnnotator: (groupNumber: number, widgetId: string) => React.ReactNode;
415
423
  isArticle: NonNullable<boolean | undefined>;
416
424
  isMobile: NonNullable<boolean | undefined>;
417
- onFocusChange: (newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown;
425
+ onFocusChange: (newFocusPath: FocusPath, oldFocusPath: FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown;
418
426
  readOnly: NonNullable<boolean | undefined>;
419
427
  setDrawingAreaAvailable: (arg1: boolean) => unknown;
420
428
  showAlignmentOptions: NonNullable<boolean | undefined>;
421
429
  }>;
422
430
  keypadElement?: any;
423
431
  questionCompleted?: boolean | undefined;
424
- onFocus: (blurPath: import("../../types").FocusPath) => void;
425
- onBlur: (blurPath: import("../../types").FocusPath) => void;
426
- findWidgets: (arg1: import("../../types").FilterCriterion) => readonly any[];
427
- reviewModeRubric: PerseusExpressionWidgetOptions;
432
+ onFocus: (blurPath: FocusPath) => void;
433
+ onBlur: (blurPath: FocusPath) => void;
434
+ findWidgets: (criterion: import("../../types").FilterCriterion) => readonly Widget[];
435
+ reviewModeRubric: PerseusExpressionRubric;
428
436
  onChange: import("../../types").ChangeHandler;
429
437
  trackInteraction: (extraData?: Empty | undefined) => void;
430
438
  isLastUsedWidget: boolean;
@@ -433,7 +441,7 @@ declare const _default: Readonly<{
433
441
  } & Partial<import("../../types").PerseusDependenciesV2> & {
434
442
  apiOptions: Readonly<Readonly<{
435
443
  isArticle?: boolean | undefined;
436
- onFocusChange?: ((newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
444
+ onFocusChange?: ((newFocusPath: FocusPath, oldFocusPath: FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
437
445
  GroupMetadataEditor?: React.ComponentType<any> | undefined;
438
446
  showAlignmentOptions?: boolean | undefined;
439
447
  readOnly?: boolean | undefined;
@@ -478,10 +486,12 @@ declare const _default: Readonly<{
478
486
  "unlimited-point"?: boolean | undefined;
479
487
  } & {
480
488
  "interactive-graph-locked-features-labels"?: boolean | undefined;
489
+ "locked-figures-aria"?: boolean | undefined;
481
490
  "locked-point-labels"?: boolean | undefined;
482
491
  "locked-line-labels"?: boolean | undefined;
483
492
  "locked-vector-labels"?: boolean | undefined;
484
493
  "locked-ellipse-labels"?: boolean | undefined;
494
+ "locked-polygon-labels"?: boolean | undefined;
485
495
  "locked-function-labels"?: boolean | undefined;
486
496
  }) | undefined;
487
497
  } | undefined;
@@ -497,7 +507,7 @@ declare const _default: Readonly<{
497
507
  groupAnnotator: (groupNumber: number, widgetId: string) => React.ReactNode;
498
508
  isArticle: NonNullable<boolean | undefined>;
499
509
  isMobile: NonNullable<boolean | undefined>;
500
- onFocusChange: (newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown;
510
+ onFocusChange: (newFocusPath: FocusPath, oldFocusPath: FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown;
501
511
  readOnly: NonNullable<boolean | undefined>;
502
512
  setDrawingAreaAvailable: (arg1: boolean) => unknown;
503
513
  showAlignmentOptions: NonNullable<boolean | undefined>;
@@ -505,20 +515,19 @@ declare const _default: Readonly<{
505
515
  buttonSets: import("../../perseus-types").LegacyButtonSets;
506
516
  functions: readonly string[];
507
517
  linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
508
- onBlur: (blurPath: import("../../types").FocusPath) => void;
509
- onFocus: (blurPath: import("../../types").FocusPath) => void;
518
+ onBlur: (blurPath: FocusPath) => void;
519
+ onFocus: (blurPath: FocusPath) => void;
510
520
  times: boolean;
511
521
  visibleLabel: string | undefined;
512
522
  ariaLabel: string | undefined;
513
523
  value: string;
514
- }, "ariaLabel" | "trackInteraction" | "static" | "onChange" | "analytics" | "keypadElement" | "containerSizeClass" | "widgetId" | "problemNum" | "questionCompleted" | "findWidgets" | "alignment" | "buttonsVisible" | "visibleLabel" | "keypadConfiguration" | "reviewModeRubric" | "isLastUsedWidget"> & {
524
+ }, "ariaLabel" | "static" | "onChange" | "keypadElement" | "containerSizeClass" | "widgetId" | "problemNum" | "questionCompleted" | "findWidgets" | "trackInteraction" | "analytics" | "alignment" | "buttonsVisible" | "visibleLabel" | "keypadConfiguration" | "reviewModeRubric" | "isLastUsedWidget"> & {
515
525
  value?: string | undefined;
516
- linterContext?: import("@khanacademy/perseus-linter").LinterContextProps | undefined;
517
- onFocus?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
518
- onBlur?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
526
+ onFocus?: ((blurPath: FocusPath) => void) | undefined;
527
+ onBlur?: ((blurPath: FocusPath) => void) | undefined;
519
528
  apiOptions?: Readonly<Readonly<{
520
529
  isArticle?: boolean | undefined;
521
- onFocusChange?: ((newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
530
+ onFocusChange?: ((newFocusPath: FocusPath, oldFocusPath: FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
522
531
  GroupMetadataEditor?: React.ComponentType<any> | undefined;
523
532
  showAlignmentOptions?: boolean | undefined;
524
533
  readOnly?: boolean | undefined;
@@ -563,10 +572,12 @@ declare const _default: Readonly<{
563
572
  "unlimited-point"?: boolean | undefined;
564
573
  } & {
565
574
  "interactive-graph-locked-features-labels"?: boolean | undefined;
575
+ "locked-figures-aria"?: boolean | undefined;
566
576
  "locked-point-labels"?: boolean | undefined;
567
577
  "locked-line-labels"?: boolean | undefined;
568
578
  "locked-vector-labels"?: boolean | undefined;
569
579
  "locked-ellipse-labels"?: boolean | undefined;
580
+ "locked-polygon-labels"?: boolean | undefined;
570
581
  "locked-function-labels"?: boolean | undefined;
571
582
  }) | undefined;
572
583
  } | undefined;
@@ -582,11 +593,12 @@ declare const _default: Readonly<{
582
593
  groupAnnotator: (groupNumber: number, widgetId: string) => React.ReactNode;
583
594
  isArticle: NonNullable<boolean | undefined>;
584
595
  isMobile: NonNullable<boolean | undefined>;
585
- onFocusChange: (newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown;
596
+ onFocusChange: (newFocusPath: FocusPath, oldFocusPath: FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown;
586
597
  readOnly: NonNullable<boolean | undefined>;
587
598
  setDrawingAreaAvailable: (arg1: boolean) => unknown;
588
599
  showAlignmentOptions: NonNullable<boolean | undefined>;
589
600
  }> | undefined;
601
+ linterContext?: import("@khanacademy/perseus-linter").LinterContextProps | undefined;
590
602
  buttonSets?: import("../../perseus-types").LegacyButtonSets | undefined;
591
603
  functions?: readonly string[] | undefined;
592
604
  times?: boolean | undefined;
@@ -2,7 +2,7 @@ import * as React from "react";
2
2
  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
- import type { TrackingGradedGroupExtraArguments, WidgetProps } from "../../types";
5
+ import type { TrackingGradedGroupExtraArguments, Widget, WidgetProps } from "../../types";
6
6
  import type { PerseusGradedGroupRubric } from "../../validation.types";
7
7
  declare const GRADING_STATUSES: {
8
8
  readonly ungraded: "ungraded";
@@ -30,7 +30,7 @@ type State = {
30
30
  message: string;
31
31
  answerBarState: ANSWER_BAR_STATES;
32
32
  };
33
- export declare class GradedGroup extends React.Component<Props, State> {
33
+ export declare class GradedGroup extends React.Component<Props, State> implements Widget {
34
34
  static contextType: React.Context<{
35
35
  strings: import("../../strings").PerseusStrings;
36
36
  locale: string;
@@ -2,7 +2,7 @@ import * as React from "react";
2
2
  import * as Changeable from "../../mixins/changeable";
3
3
  import { GradedGroup } from "../graded-group/graded-group";
4
4
  import type { PerseusGradedGroupSetWidgetOptions } from "../../perseus-types";
5
- import type { FocusPath, WidgetProps } from "../../types";
5
+ import type { FocusPath, Widget, WidgetProps } from "../../types";
6
6
  import type { PerseusGradedGroupSetRubric } from "../../validation.types";
7
7
  type RenderProps = PerseusGradedGroupSetWidgetOptions;
8
8
  type Props = Changeable.ChangeableProps & WidgetProps<RenderProps, PerseusGradedGroupSetRubric> & {
@@ -15,7 +15,7 @@ type DefaultProps = {
15
15
  type State = {
16
16
  currentGroup: number;
17
17
  };
18
- declare class GradedGroupSet extends React.Component<Props, State> {
18
+ declare class GradedGroupSet extends React.Component<Props, State> implements Widget {
19
19
  _childGroup: GradedGroup;
20
20
  static defaultProps: DefaultProps;
21
21
  state: State;
@@ -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;
@@ -2,7 +2,7 @@ import * as React from "react";
2
2
  import Graphie from "../../components/graphie";
3
3
  import type { Coord } from "../../interactive2/types";
4
4
  import type { PerseusGrapherWidgetOptions } from "../../perseus-types";
5
- import type { PerseusScore, WidgetProps } from "../../types";
5
+ import type { PerseusScore, Widget, WidgetProps } from "../../types";
6
6
  import type { GridDimensions } from "../../util";
7
7
  import type { PerseusGrapherRubric, PerseusGrapherUserInput } from "../../validation.types";
8
8
  import type { PropsFor } from "@khanacademy/wonder-blocks-core";
@@ -19,7 +19,7 @@ type Props = ExternalProps & {
19
19
  type DefaultProps = {
20
20
  plot: RenderProps["plot"];
21
21
  };
22
- declare class Grapher extends React.Component<Props> {
22
+ declare class Grapher extends React.Component<Props> implements Widget {
23
23
  horizHairline: any;
24
24
  vertHairline: any;
25
25
  static defaultProps: DefaultProps;
@@ -37,7 +37,6 @@ declare class Grapher extends React.Component<Props> {
37
37
  hideHairlines: () => void;
38
38
  simpleValidate(rubric: PerseusGrapherRubric): PerseusScore;
39
39
  getUserInput(): PerseusGrapherUserInput;
40
- focus(): void;
41
40
  render(): React.ReactNode;
42
41
  }
43
42
  declare const _default: Readonly<{
@@ -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;
@@ -2,7 +2,7 @@ import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import Renderer from "../../renderer";
4
4
  import type { PerseusGroupWidgetOptions } from "../../perseus-types";
5
- import type { ChangeFn, FocusPath, PerseusScore, WidgetProps } from "../../types";
5
+ import type { ChangeFn, FocusPath, Widget, WidgetProps } from "../../types";
6
6
  import type { UserInput } from "../../validation.types";
7
7
  type Rubric = PerseusGroupWidgetOptions;
8
8
  type RenderProps = PerseusGroupWidgetOptions;
@@ -13,7 +13,7 @@ type DefaultProps = {
13
13
  images: Props["images"];
14
14
  linterContext: Props["linterContext"];
15
15
  };
16
- declare class Group extends React.Component<Props> {
16
+ declare class Group extends React.Component<Props> implements Widget {
17
17
  static contextType: React.Context<{
18
18
  strings: import("../../strings").PerseusStrings;
19
19
  locale: string;
@@ -26,10 +26,10 @@ declare class Group extends React.Component<Props> {
26
26
  getUserInput(): ReadonlyArray<UserInput | null | undefined> | undefined;
27
27
  getSerializedState: () => any;
28
28
  restoreSerializedState: (arg1: any, arg2: any) => null;
29
- simpleValidate(): PerseusScore | null | undefined;
30
- getInputPaths: () => ReadonlyArray<FocusPath> | null | undefined;
29
+ simpleValidate(): import("../../types").PerseusScore;
30
+ getInputPaths(): readonly FocusPath[];
31
31
  setInputValue: (arg1: FocusPath, arg2: string, arg3: () => unknown) => void;
32
- focus: () => boolean | null | undefined;
32
+ focus(): boolean;
33
33
  focusInputPath: (arg1: FocusPath) => void;
34
34
  blurInputPath: (arg1: FocusPath) => void;
35
35
  showRationalesForCurrentlySelectedChoices: () => void;
@@ -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,7 +8,7 @@
8
8
  */
9
9
  import * as React from "react";
10
10
  import type { PerseusIFrameWidgetOptions } from "../../perseus-types";
11
- import type { WidgetProps } from "../../types";
11
+ import type { PerseusScore, WidgetProps, Widget } from "../../types";
12
12
  import type { PerseusIFrameRubric, PerseusIFrameUserInput, UserInputStatus } from "../../validation.types";
13
13
  type RenderProps = PerseusIFrameWidgetOptions & {
14
14
  status: UserInputStatus;
@@ -23,14 +23,15 @@ type DefaultProps = {
23
23
  allowFullScreen: Props["allowFullScreen"];
24
24
  allowTopNavigation: Props["allowTopNavigation"];
25
25
  };
26
- declare class Iframe extends React.Component<Props> {
26
+ declare class Iframe extends React.Component<Props> implements Widget {
27
27
  static defaultProps: DefaultProps;
28
+ static validate(state: PerseusIFrameUserInput): PerseusScore;
28
29
  componentDidMount(): void;
29
30
  componentWillUnmount(): void;
30
31
  getUserInput(): PerseusIFrameUserInput;
31
32
  handleMessageEvent: (arg1: any) => void;
32
33
  change: (...args: ReadonlyArray<unknown>) => any;
33
- simpleValidate: (arg1: any) => any;
34
+ simpleValidate(): PerseusScore;
34
35
  render(): React.ReactNode;
35
36
  }
36
37
  declare const _default: Readonly<{
@@ -1,8 +1,8 @@
1
1
  import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { PerseusImageWidgetOptions } from "../../perseus-types";
4
- import type { ChangeFn, WidgetProps } from "../../types";
5
- import type { PerseusImageRubric, PerseusImageUserInput } from "../../validation.types";
4
+ import type { ChangeFn, WidgetProps, Widget } from "../../types";
5
+ import type { NullUserInput, PerseusImageRubric } from "../../validation.types";
6
6
  type RenderProps = PerseusImageWidgetOptions;
7
7
  type ExternalProps = WidgetProps<RenderProps, PerseusImageRubric>;
8
8
  type Props = ExternalProps & {
@@ -27,7 +27,7 @@ type DefaultProps = {
27
27
  caption: Props["caption"];
28
28
  linterContext: Props["linterContext"];
29
29
  };
30
- declare class ImageWidget extends React.Component<Props> {
30
+ declare class ImageWidget extends React.Component<Props> implements Widget {
31
31
  static contextType: React.Context<{
32
32
  strings: import("../../strings").PerseusStrings;
33
33
  locale: string;
@@ -36,9 +36,8 @@ declare class ImageWidget extends React.Component<Props> {
36
36
  static defaultProps: DefaultProps;
37
37
  static validate(): import("../../types").PerseusScore;
38
38
  change: ChangeFn;
39
- getUserInput(): PerseusImageUserInput;
39
+ getUserInput(): NullUserInput;
40
40
  simpleValidate(): import("../../types").PerseusScore;
41
- focus: () => void;
42
41
  render(): React.ReactNode;
43
42
  }
44
43
  declare const _default: Readonly<{
@@ -2,7 +2,7 @@ import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { PerseusInputNumberWidgetOptions } from "../../perseus-types";
4
4
  import type { PerseusStrings } from "../../strings";
5
- import type { Path, PerseusScore, WidgetProps } from "../../types";
5
+ import type { Path, PerseusScore, Widget, WidgetProps } from "../../types";
6
6
  import type { PerseusInputNumberRubric, PerseusInputNumberUserInput } from "../../validation.types";
7
7
  type RenderProps = {
8
8
  simplify: PerseusInputNumberWidgetOptions["simplify"];
@@ -27,7 +27,7 @@ type DefaultProps = {
27
27
  rightAlign: Props["rightAlign"];
28
28
  size: Props["size"];
29
29
  };
30
- declare class InputNumber extends React.Component<Props> {
30
+ declare class InputNumber extends React.Component<Props> implements Widget {
31
31
  static contextType: React.Context<{
32
32
  strings: PerseusStrings;
33
33
  locale: string;
@@ -1,8 +1,8 @@
1
1
  import * as React from "react";
2
2
  import type { Coord } from "../../interactive2/types";
3
3
  import type { PerseusInteractionWidgetOptions } from "../../perseus-types";
4
- import type { WidgetProps } from "../../types";
5
- import type { PerseusInteractionRubric, PerseusInteractionUserInput } from "../../validation.types";
4
+ import type { Widget, WidgetProps } from "../../types";
5
+ import type { EmptyUserInput, PerseusInteractionRubric } from "../../validation.types";
6
6
  type RenderProps = PerseusInteractionWidgetOptions;
7
7
  type Props = WidgetProps<RenderProps, PerseusInteractionRubric>;
8
8
  type DefaultProps = {
@@ -13,7 +13,7 @@ type State = {
13
13
  variables: any;
14
14
  functions: any;
15
15
  };
16
- declare class Interaction extends React.Component<Props, State> {
16
+ declare class Interaction extends React.Component<Props, State> implements Widget {
17
17
  static defaultProps: DefaultProps;
18
18
  static validate(): import("../../types").PerseusScore;
19
19
  state: State;
@@ -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(): PerseusInteractionUserInput;
27
+ getUserInput(): EmptyUserInput;
28
28
  simpleValidate(): import("../../types").PerseusScore;
29
29
  render(): React.ReactNode;
30
30
  }
@@ -4,7 +4,7 @@ import type { StatefulMafsGraphType } from "./interactive-graphs/stateful-mafs-g
4
4
  import type { QuadraticGraphState } from "./interactive-graphs/types";
5
5
  import type { Coord } from "../interactive2/types";
6
6
  import type { PerseusGraphType, PerseusGraphTypeAngle, PerseusGraphTypePoint, PerseusGraphTypePolygon, PerseusGraphTypeSegment, PerseusInteractiveGraphWidgetOptions } from "../perseus-types";
7
- import type { ChangeHandler, PerseusScore, WidgetProps } from "../types";
7
+ import type { ChangeHandler, PerseusScore, Widget, WidgetProps } from "../types";
8
8
  import type { QuadraticCoefficient, Range, SineCoefficient } from "../util/geometry";
9
9
  import type { PerseusInteractiveGraphRubric, PerseusInteractiveGraphUserInput } from "../validation.types";
10
10
  type RenderProps = PerseusInteractiveGraphWidgetOptions;
@@ -20,6 +20,8 @@ type DefaultProps = {
20
20
  showProtractor: Props["showProtractor"];
21
21
  graph: Props["graph"];
22
22
  };
23
+ export declare function getSinusoidCoefficients(coords: ReadonlyArray<Coord>): SineCoefficient;
24
+ export declare function getQuadraticCoefficients(coords: ReadonlyArray<Coord>): QuadraticCoefficient;
23
25
  declare class LegacyInteractiveGraph extends React.Component<Props, State> {
24
26
  static contextType: React.Context<{
25
27
  strings: import("../strings").PerseusStrings;
@@ -103,15 +105,13 @@ declare class LegacyInteractiveGraph extends React.Component<Props, State> {
103
105
  focus: () => void;
104
106
  render(): React.ReactNode;
105
107
  }
106
- declare class InteractiveGraph extends React.Component<Props, State> {
108
+ declare class InteractiveGraph extends React.Component<Props, State> implements Widget {
107
109
  legacyGraphRef: React.RefObject<LegacyInteractiveGraph>;
108
110
  mafsRef: React.RefObject<StatefulMafsGraphType>;
109
111
  static defaultProps: DefaultProps;
110
112
  getUserInput(): PerseusInteractiveGraphUserInput;
111
113
  simpleValidate(rubric: PerseusInteractiveGraphRubric): PerseusScore;
112
114
  render(): React.JSX.Element;
113
- static getQuadraticCoefficients(coords: ReadonlyArray<Coord>): QuadraticCoefficient;
114
- static getSinusoidCoefficients(coords: ReadonlyArray<Coord>): SineCoefficient;
115
115
  /**
116
116
  * @param {object} graph Like props.graph or props.correct
117
117
  * @param {object} props of an InteractiveGraph instance
@@ -160,7 +160,7 @@ declare class InteractiveGraph extends React.Component<Props, State> {
160
160
  static getRayEquationString(props: Props): string;
161
161
  static getPolygonEquationString(props: Props): string;
162
162
  static getAngleEquationString(props: Props): string;
163
- static validate(userInput: PerseusGraphType, rubric: PerseusInteractiveGraphRubric, component: any): PerseusScore;
163
+ static validate(userInput: PerseusGraphType, rubric: PerseusInteractiveGraphRubric): PerseusScore;
164
164
  static getUserInputFromProps(props: Props): PerseusGraphType;
165
165
  }
166
166
  export declare function shouldUseMafs(mafsFlags: Record<string, boolean> | undefined | boolean, graph: PerseusGraphType): boolean;
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
2
  import type { Interval } from "mafs";
3
- export declare const shouldShowLabel: (number: number, range: [Interval, Interval]) => boolean;
3
+ export declare const shouldShowLabel: (currentTick: number, range: [Interval, Interval], tickStep: number) => boolean;
4
4
  export declare function generateTickLocations(tickStep: number, min: number, max: number): number[];
5
5
  export declare const AxisTicks: () => React.JSX.Element;
@@ -1,7 +1,9 @@
1
1
  import * as React from "react";
2
2
  import type { LockedFigure } from "../../perseus-types";
3
+ import type { APIOptions } from "../../types";
3
4
  import type { Interval } from "mafs";
4
5
  type Props = {
6
+ flags?: APIOptions["flags"];
5
7
  lockedFigures: ReadonlyArray<LockedFigure>;
6
8
  range: [x: Interval, y: Interval];
7
9
  };
@@ -8,6 +8,7 @@ export type LockedFunctionOptions = {
8
8
  directionalAxis?: "x" | "y";
9
9
  domain?: Interval;
10
10
  labels?: LockedFigureLabelOptions[];
11
+ ariaLabel?: string;
11
12
  };
12
13
  type LockedFigureLabelOptions = {
13
14
  text: string;
@@ -111,6 +112,7 @@ declare class InteractiveGraphQuestionBuilder {
111
112
  color?: LockedFigureColor;
112
113
  filled?: boolean;
113
114
  labels?: LockedFigureLabelOptions[];
115
+ ariaLabel?: string;
114
116
  }): InteractiveGraphQuestionBuilder;
115
117
  addLockedLine(point1: vec.Vector2, point2: vec.Vector2, options?: {
116
118
  kind?: "line" | "ray" | "segment";
@@ -120,10 +122,12 @@ declare class InteractiveGraphQuestionBuilder {
120
122
  showPoint1?: boolean;
121
123
  showPoint2?: boolean;
122
124
  labels?: LockedFigureLabelOptions[];
125
+ ariaLabel?: string;
123
126
  }): InteractiveGraphQuestionBuilder;
124
127
  addLockedVector(tail: vec.Vector2, tip: vec.Vector2, options?: {
125
128
  color?: LockedFigureColor;
126
129
  labels?: LockedFigureLabelOptions[];
130
+ ariaLabel?: string;
127
131
  }): InteractiveGraphQuestionBuilder;
128
132
  addLockedEllipse(center: vec.Vector2, radius: [x: number, y: number], options?: {
129
133
  angle?: number;
@@ -131,12 +135,15 @@ declare class InteractiveGraphQuestionBuilder {
131
135
  fillStyle?: LockedFigureFillType;
132
136
  strokeStyle?: "solid" | "dashed";
133
137
  labels?: LockedFigureLabelOptions[];
138
+ ariaLabel?: string;
134
139
  }): InteractiveGraphQuestionBuilder;
135
140
  addLockedPolygon(points: vec.Vector2[], options?: {
136
141
  color?: LockedFigureColor;
137
142
  showVertices?: boolean;
138
143
  fillStyle?: LockedFigureFillType;
139
144
  strokeStyle?: "solid" | "dashed";
145
+ labels?: LockedFigureLabelOptions[];
146
+ ariaLabel?: string;
140
147
  }): InteractiveGraphQuestionBuilder;
141
148
  addLockedFunction(equation: string, options?: LockedFunctionOptions): this;
142
149
  addLockedLabel(text: string, coord: Coord, options?: {