@khanacademy/perseus 35.1.1 → 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 (48) hide show
  1. package/dist/es/index.js +19336 -19385
  2. package/dist/es/index.js.map +1 -1
  3. package/dist/index.js +19275 -19325
  4. package/dist/index.js.map +1 -1
  5. package/dist/multi-items/multi-renderer.d.ts +1 -2
  6. package/dist/perseus-types.d.ts +35 -35
  7. package/dist/renderer.d.ts +2 -33
  8. package/dist/server-item-renderer.d.ts +1 -1
  9. package/dist/types.d.ts +40 -4
  10. package/dist/util.d.ts +1 -8
  11. package/dist/validation.types.d.ts +3 -9
  12. package/dist/widgets/categorizer/categorizer.d.ts +2 -2
  13. package/dist/widgets/cs-program/cs-program.d.ts +3 -2
  14. package/dist/widgets/definition/definition.d.ts +4 -4
  15. package/dist/widgets/deprecated-standin/index.d.ts +6 -7
  16. package/dist/widgets/dropdown/dropdown.d.ts +2 -2
  17. package/dist/widgets/explanation/explanation.d.ts +4 -4
  18. package/dist/widgets/expression/expression.d.ts +36 -36
  19. package/dist/widgets/graded-group/graded-group.d.ts +2 -2
  20. package/dist/widgets/graded-group-set/graded-group-set.d.ts +2 -2
  21. package/dist/widgets/grapher/grapher.d.ts +2 -3
  22. package/dist/widgets/group/group.d.ts +5 -5
  23. package/dist/widgets/iframe/iframe.d.ts +2 -2
  24. package/dist/widgets/image/image.d.ts +4 -5
  25. package/dist/widgets/input-number/input-number.d.ts +2 -2
  26. package/dist/widgets/interaction/interaction.d.ts +4 -4
  27. package/dist/widgets/interactive-graph.d.ts +2 -2
  28. package/dist/widgets/label-image/label-image.d.ts +2 -2
  29. package/dist/widgets/matcher/matcher.d.ts +2 -2
  30. package/dist/widgets/matrix/matrix.d.ts +3 -3
  31. package/dist/widgets/measurer/measurer.d.ts +47 -2
  32. package/dist/widgets/molecule/molecule.d.ts +2 -1
  33. package/dist/widgets/number-line/number-line.d.ts +5 -5
  34. package/dist/widgets/numeric-input/numeric-input.d.ts +2 -2
  35. package/dist/widgets/orderer/orderer-validator.d.ts +3 -0
  36. package/dist/widgets/orderer/orderer.d.ts +4 -3
  37. package/dist/widgets/passage/passage.d.ts +4 -4
  38. package/dist/widgets/passage/utils.d.ts +12 -0
  39. package/dist/widgets/passage-ref/passage-ref.d.ts +4 -4
  40. package/dist/widgets/passage-ref-target/passage-ref-target.d.ts +4 -4
  41. package/dist/widgets/phet-simulation/phet-simulation.d.ts +4 -4
  42. package/dist/widgets/plotter/plotter.d.ts +2 -2
  43. package/dist/widgets/python-program/python-program.d.ts +6 -1
  44. package/dist/widgets/radio/radio-component.d.ts +2 -2
  45. package/dist/widgets/sorter/sorter.d.ts +2 -2
  46. package/dist/widgets/table/table.d.ts +3 -3
  47. package/dist/widgets/video/video.d.ts +2 -2
  48. 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;
@@ -168,16 +168,16 @@ declare const _default: Readonly<{
168
168
  groupAnnotator: (groupNumber: number, widgetId: string) => React.ReactNode;
169
169
  isArticle: NonNullable<boolean | undefined>;
170
170
  isMobile: NonNullable<boolean | undefined>;
171
- 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;
172
172
  readOnly: NonNullable<boolean | undefined>;
173
173
  setDrawingAreaAvailable: (arg1: boolean) => unknown;
174
174
  showAlignmentOptions: NonNullable<boolean | undefined>;
175
175
  }>;
176
176
  keypadElement?: any;
177
177
  questionCompleted?: boolean | undefined;
178
- onFocus: (blurPath: import("../../types").FocusPath) => void;
179
- onBlur: (blurPath: import("../../types").FocusPath) => void;
180
- findWidgets: (arg1: import("../../types").FilterCriterion) => readonly any[];
178
+ onFocus: (blurPath: FocusPath) => void;
179
+ onBlur: (blurPath: FocusPath) => void;
180
+ findWidgets: (criterion: import("../../types").FilterCriterion) => readonly Widget[];
181
181
  reviewModeRubric: PerseusExpressionRubric;
182
182
  onChange: import("../../types").ChangeHandler;
183
183
  trackInteraction: (extraData?: Empty | undefined) => void;
@@ -187,7 +187,7 @@ declare const _default: Readonly<{
187
187
  } & Partial<import("../../types").PerseusDependenciesV2> & {
188
188
  apiOptions: Readonly<Readonly<{
189
189
  isArticle?: boolean | undefined;
190
- 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;
191
191
  GroupMetadataEditor?: React.ComponentType<any> | undefined;
192
192
  showAlignmentOptions?: boolean | undefined;
193
193
  readOnly?: boolean | undefined;
@@ -253,7 +253,7 @@ declare const _default: Readonly<{
253
253
  groupAnnotator: (groupNumber: number, widgetId: string) => React.ReactNode;
254
254
  isArticle: NonNullable<boolean | undefined>;
255
255
  isMobile: NonNullable<boolean | undefined>;
256
- 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;
257
257
  readOnly: NonNullable<boolean | undefined>;
258
258
  setDrawingAreaAvailable: (arg1: boolean) => unknown;
259
259
  showAlignmentOptions: NonNullable<boolean | undefined>;
@@ -261,20 +261,19 @@ declare const _default: Readonly<{
261
261
  buttonSets: import("../../perseus-types").LegacyButtonSets;
262
262
  functions: readonly string[];
263
263
  linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
264
- onBlur: (blurPath: import("../../types").FocusPath) => void;
265
- onFocus: (blurPath: import("../../types").FocusPath) => void;
264
+ onBlur: (blurPath: FocusPath) => void;
265
+ onFocus: (blurPath: FocusPath) => void;
266
266
  times: boolean;
267
267
  visibleLabel: string | undefined;
268
268
  ariaLabel: string | undefined;
269
269
  value: string;
270
- }, "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"> & {
271
271
  value?: string | undefined;
272
- linterContext?: import("@khanacademy/perseus-linter").LinterContextProps | undefined;
273
- onFocus?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
274
- onBlur?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
272
+ onFocus?: ((blurPath: FocusPath) => void) | undefined;
273
+ onBlur?: ((blurPath: FocusPath) => void) | undefined;
275
274
  apiOptions?: Readonly<Readonly<{
276
275
  isArticle?: boolean | undefined;
277
- 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;
278
277
  GroupMetadataEditor?: React.ComponentType<any> | undefined;
279
278
  showAlignmentOptions?: boolean | undefined;
280
279
  readOnly?: boolean | undefined;
@@ -340,11 +339,12 @@ declare const _default: Readonly<{
340
339
  groupAnnotator: (groupNumber: number, widgetId: string) => React.ReactNode;
341
340
  isArticle: NonNullable<boolean | undefined>;
342
341
  isMobile: NonNullable<boolean | undefined>;
343
- 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;
344
343
  readOnly: NonNullable<boolean | undefined>;
345
344
  setDrawingAreaAvailable: (arg1: boolean) => unknown;
346
345
  showAlignmentOptions: NonNullable<boolean | undefined>;
347
346
  }> | undefined;
347
+ linterContext?: import("@khanacademy/perseus-linter").LinterContextProps | undefined;
348
348
  buttonSets?: import("../../perseus-types").LegacyButtonSets | undefined;
349
349
  functions?: readonly string[] | undefined;
350
350
  times?: boolean | undefined;
@@ -356,7 +356,7 @@ declare const _default: Readonly<{
356
356
  problemNum: number | null | undefined;
357
357
  apiOptions: Readonly<Readonly<{
358
358
  isArticle?: boolean | undefined;
359
- 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;
360
360
  GroupMetadataEditor?: React.ComponentType<any> | undefined;
361
361
  showAlignmentOptions?: boolean | undefined;
362
362
  readOnly?: boolean | undefined;
@@ -422,16 +422,16 @@ declare const _default: Readonly<{
422
422
  groupAnnotator: (groupNumber: number, widgetId: string) => React.ReactNode;
423
423
  isArticle: NonNullable<boolean | undefined>;
424
424
  isMobile: NonNullable<boolean | undefined>;
425
- 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;
426
426
  readOnly: NonNullable<boolean | undefined>;
427
427
  setDrawingAreaAvailable: (arg1: boolean) => unknown;
428
428
  showAlignmentOptions: NonNullable<boolean | undefined>;
429
429
  }>;
430
430
  keypadElement?: any;
431
431
  questionCompleted?: boolean | undefined;
432
- onFocus: (blurPath: import("../../types").FocusPath) => void;
433
- onBlur: (blurPath: import("../../types").FocusPath) => void;
434
- findWidgets: (arg1: import("../../types").FilterCriterion) => readonly any[];
432
+ onFocus: (blurPath: FocusPath) => void;
433
+ onBlur: (blurPath: FocusPath) => void;
434
+ findWidgets: (criterion: import("../../types").FilterCriterion) => readonly Widget[];
435
435
  reviewModeRubric: PerseusExpressionRubric;
436
436
  onChange: import("../../types").ChangeHandler;
437
437
  trackInteraction: (extraData?: Empty | undefined) => void;
@@ -441,7 +441,7 @@ declare const _default: Readonly<{
441
441
  } & Partial<import("../../types").PerseusDependenciesV2> & {
442
442
  apiOptions: Readonly<Readonly<{
443
443
  isArticle?: boolean | undefined;
444
- 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;
445
445
  GroupMetadataEditor?: React.ComponentType<any> | undefined;
446
446
  showAlignmentOptions?: boolean | undefined;
447
447
  readOnly?: boolean | undefined;
@@ -507,7 +507,7 @@ declare const _default: Readonly<{
507
507
  groupAnnotator: (groupNumber: number, widgetId: string) => React.ReactNode;
508
508
  isArticle: NonNullable<boolean | undefined>;
509
509
  isMobile: NonNullable<boolean | undefined>;
510
- 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;
511
511
  readOnly: NonNullable<boolean | undefined>;
512
512
  setDrawingAreaAvailable: (arg1: boolean) => unknown;
513
513
  showAlignmentOptions: NonNullable<boolean | undefined>;
@@ -515,20 +515,19 @@ declare const _default: Readonly<{
515
515
  buttonSets: import("../../perseus-types").LegacyButtonSets;
516
516
  functions: readonly string[];
517
517
  linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
518
- onBlur: (blurPath: import("../../types").FocusPath) => void;
519
- onFocus: (blurPath: import("../../types").FocusPath) => void;
518
+ onBlur: (blurPath: FocusPath) => void;
519
+ onFocus: (blurPath: FocusPath) => void;
520
520
  times: boolean;
521
521
  visibleLabel: string | undefined;
522
522
  ariaLabel: string | undefined;
523
523
  value: string;
524
- }, "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"> & {
525
525
  value?: string | undefined;
526
- linterContext?: import("@khanacademy/perseus-linter").LinterContextProps | undefined;
527
- onFocus?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
528
- onBlur?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
526
+ onFocus?: ((blurPath: FocusPath) => void) | undefined;
527
+ onBlur?: ((blurPath: FocusPath) => void) | undefined;
529
528
  apiOptions?: Readonly<Readonly<{
530
529
  isArticle?: boolean | undefined;
531
- 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;
532
531
  GroupMetadataEditor?: React.ComponentType<any> | undefined;
533
532
  showAlignmentOptions?: boolean | undefined;
534
533
  readOnly?: boolean | undefined;
@@ -594,11 +593,12 @@ declare const _default: Readonly<{
594
593
  groupAnnotator: (groupNumber: number, widgetId: string) => React.ReactNode;
595
594
  isArticle: NonNullable<boolean | undefined>;
596
595
  isMobile: NonNullable<boolean | undefined>;
597
- 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;
598
597
  readOnly: NonNullable<boolean | undefined>;
599
598
  setDrawingAreaAvailable: (arg1: boolean) => unknown;
600
599
  showAlignmentOptions: NonNullable<boolean | undefined>;
601
600
  }> | undefined;
601
+ linterContext?: import("@khanacademy/perseus-linter").LinterContextProps | undefined;
602
602
  buttonSets?: import("../../perseus-types").LegacyButtonSets | undefined;
603
603
  functions?: readonly string[] | undefined;
604
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;
@@ -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<{
@@ -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;
@@ -8,7 +8,7 @@
8
8
  */
9
9
  import * as React from "react";
10
10
  import type { PerseusIFrameWidgetOptions } from "../../perseus-types";
11
- import type { PerseusScore, 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,7 +23,7 @@ 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
28
  static validate(state: PerseusIFrameUserInput): PerseusScore;
29
29
  componentDidMount(): void;
@@ -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;
@@ -105,7 +105,7 @@ declare class LegacyInteractiveGraph extends React.Component<Props, State> {
105
105
  focus: () => void;
106
106
  render(): React.ReactNode;
107
107
  }
108
- declare class InteractiveGraph extends React.Component<Props, State> {
108
+ declare class InteractiveGraph extends React.Component<Props, State> implements Widget {
109
109
  legacyGraphRef: React.RefObject<LegacyInteractiveGraph>;
110
110
  mafsRef: React.RefObject<StatefulMafsGraphType>;
111
111
  static defaultProps: DefaultProps;
@@ -11,7 +11,7 @@ import Marker from "./marker";
11
11
  import type { InteractiveMarkerType } from "./types";
12
12
  import type { DependencyProps } from "../../dependencies";
13
13
  import type { ChangeableProps } from "../../mixins/changeable";
14
- import type { APIOptions, PerseusScore } from "../../types";
14
+ import type { APIOptions, PerseusScore, Widget } from "../../types";
15
15
  import type { PerseusLabelImageRubric, PerseusLabelImageUserInput } from "../../validation.types";
16
16
  export type PreferredPopoverDirection = "NONE" | "UP" | "DOWN" | "LEFT" | "RIGHT";
17
17
  /**
@@ -50,7 +50,7 @@ type LabelImageState = {
50
50
  markersInteracted: boolean;
51
51
  hideAnswers: boolean;
52
52
  };
53
- export declare class LabelImage extends React.Component<LabelImageProps, LabelImageState> {
53
+ export declare class LabelImage extends React.Component<LabelImageProps, LabelImageState> implements Widget {
54
54
  static contextType: React.Context<{
55
55
  strings: import("../../strings").PerseusStrings;
56
56
  locale: string;
@@ -2,7 +2,7 @@ import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { SortableOption } from "../../components/sortable";
4
4
  import type { PerseusMatcherWidgetOptions } from "../../perseus-types";
5
- import type { PerseusScore, WidgetProps } from "../../types";
5
+ import type { PerseusScore, WidgetProps, Widget } from "../../types";
6
6
  import type { PerseusMatcherRubric, PerseusMatcherUserInput } from "../../validation.types";
7
7
  type RenderProps = PerseusMatcherWidgetOptions;
8
8
  type Props = WidgetProps<RenderProps, PerseusMatcherRubric>;
@@ -21,7 +21,7 @@ type State = {
21
21
  rightHeight: number;
22
22
  texRendererLoaded: boolean;
23
23
  };
24
- export declare class Matcher extends React.Component<Props, State> {
24
+ export declare class Matcher extends React.Component<Props, State> implements Widget {
25
25
  static contextType: React.Context<{
26
26
  strings: import("../../strings").PerseusStrings;
27
27
  locale: string;
@@ -2,7 +2,7 @@ import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { PerseusMatrixWidgetOptions } from "../../perseus-types";
4
4
  import type { PerseusStrings } from "../../strings";
5
- import type { WidgetProps, PerseusScore } from "../../types";
5
+ import type { WidgetProps, PerseusScore, Widget, FocusPath } from "../../types";
6
6
  import type { PerseusMatrixRubric, PerseusMatrixUserInput } from "../../validation.types";
7
7
  export declare function getMatrixSize(matrix: ReadonlyArray<ReadonlyArray<number>>): number[];
8
8
  type ExternalProps = WidgetProps<PerseusMatrixWidgetOptions, PerseusMatrixRubric>;
@@ -25,7 +25,7 @@ type DefaultProps = {
25
25
  type State = {
26
26
  enterTheMatrix: number;
27
27
  };
28
- declare class Matrix extends React.Component<Props, State> {
28
+ declare class Matrix extends React.Component<Props, State> implements Widget {
29
29
  static contextType: React.Context<{
30
30
  strings: PerseusStrings;
31
31
  locale: string;
@@ -43,7 +43,7 @@ declare class Matrix extends React.Component<Props, State> {
43
43
  focus: () => boolean;
44
44
  focusInputPath: (arg1: any) => void;
45
45
  blurInputPath: (arg1: any) => void;
46
- getDOMNodeForPath: (arg1: any) => Element | Text | null | undefined;
46
+ getDOMNodeForPath(path: FocusPath): Element | Text | null;
47
47
  setInputValue: (arg1: any, arg2: any, arg3: any) => void;
48
48
  handleKeyDown: (arg1: any, arg2: any, arg3: any) => void;
49
49
  onValueChange: (arg1: any, arg2: any, arg3: any, arg4: any) => void;
@@ -1,8 +1,53 @@
1
+ import * as React from "react";
2
+ import noopValidator from "../__shared__/noop-validator";
3
+ import type { APIOptions, Widget } from "../../types";
4
+ type Props = {
5
+ apiOptions: APIOptions;
6
+ box: [number, number];
7
+ image: {
8
+ url?: string;
9
+ top?: number;
10
+ left?: number;
11
+ };
12
+ showProtractor: boolean;
13
+ protractorX: number;
14
+ protractorY: number;
15
+ showRuler: boolean;
16
+ rulerLabel: string;
17
+ rulerTicks: number;
18
+ rulerPixels: number;
19
+ rulerLength: number;
20
+ };
21
+ type DefaultProps = {
22
+ box: Props["box"];
23
+ image: Props["image"];
24
+ showProtractor: Props["showProtractor"];
25
+ protractorX: Props["protractorX"];
26
+ protractorY: Props["protractorY"];
27
+ showRuler: Props["showRuler"];
28
+ rulerLabel: Props["rulerLabel"];
29
+ rulerTicks: Props["rulerTicks"];
30
+ rulerPixels: Props["rulerPixels"];
31
+ rulerLength: Props["rulerLength"];
32
+ };
33
+ declare class Measurer extends React.Component<Props> implements Widget {
34
+ static validate: typeof noopValidator;
35
+ static defaultProps: DefaultProps;
36
+ state: {};
37
+ ruler: any;
38
+ protractor: any;
39
+ componentDidMount(): void;
40
+ componentDidUpdate(prevProps: any): void;
41
+ setupGraphie(): void;
42
+ getUserInput(): {};
43
+ simpleValidate(): import("../../types").PerseusScore;
44
+ render(): React.JSX.Element;
45
+ }
1
46
  declare const _default: Readonly<{
2
47
  name: string;
3
48
  displayName: string;
4
- getWidget?: (() => any) | undefined;
5
- widget: any;
49
+ getWidget?: (() => typeof Measurer) | undefined;
50
+ widget: typeof Measurer;
6
51
  accessible?: boolean | ((props: any) => boolean) | undefined;
7
52
  hidden?: boolean | undefined;
8
53
  version?: import("../../types").Version | undefined;
@@ -1,6 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { PerseusMoleculeRendererWidgetOptions } from "../../perseus-types";
4
+ import type { Widget } from "../../types";
4
5
  import type { PerseusMoleculeUserInput } from "../../validation.types";
5
6
  type MoleculeState = {
6
7
  parsedSmiles: any;
@@ -30,7 +31,7 @@ export declare class Molecule extends React.Component<Props, MoleculeState> {
30
31
  type DefaultProps = {
31
32
  rotationAngle: Props["rotationAngle"];
32
33
  };
33
- declare class MoleculeWidget extends React.Component<Props> {
34
+ declare class MoleculeWidget extends React.Component<Props> implements Widget {
34
35
  static defaultProps: DefaultProps;
35
36
  simpleValidate(): import("../../types").PerseusScore;
36
37
  getUserInput(): PerseusMoleculeUserInput;
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { ChangeableProps } from "../../mixins/changeable";
4
- import type { APIOptions, PerseusScore } from "../../types";
4
+ import type { APIOptions, PerseusScore, FocusPath, Widget } from "../../types";
5
5
  import type { PerseusNumberLineRubric, PerseusNumberLineUserInput } from "../../validation.types";
6
6
  export type Relationship = "lt" | "gt" | "le" | "ge";
7
7
  type Props = ChangeableProps & {
@@ -42,7 +42,7 @@ type DefaultProps = {
42
42
  type State = {
43
43
  numDivisionsEmpty: boolean;
44
44
  };
45
- declare class NumberLine extends React.Component<Props, State> {
45
+ declare class NumberLine extends React.Component<Props, State> implements Widget {
46
46
  static contextType: React.Context<{
47
47
  strings: import("../../strings").PerseusStrings;
48
48
  locale: string;
@@ -56,12 +56,12 @@ declare class NumberLine extends React.Component<Props, State> {
56
56
  onNumDivisionsChange: (arg1: number, arg2: any) => void;
57
57
  _handleTickCtrlFocus: () => void;
58
58
  _handleTickCtrlBlur: () => void;
59
- focus: () => boolean | null | undefined;
59
+ focus(): boolean;
60
60
  focusInputPath: (arg1: any) => void;
61
61
  blurInputPath: (arg1: any) => void;
62
62
  getInputPaths: () => ReadonlyArray<ReadonlyArray<string>>;
63
- getDOMNodeForPath: (arg1: any) => Element | Text | null | undefined;
64
- getGrammarTypeForPath: (arg1: any) => string | null | undefined;
63
+ getDOMNodeForPath(inputPath: FocusPath): Element | Text | null;
64
+ getGrammarTypeForPath(inputPath: FocusPath): "number" | undefined;
65
65
  setInputValue: (arg1: any, arg2: any, arg3: any) => void;
66
66
  _renderGraphie: () => React.ReactElement;
67
67
  snapNumLinePosition: (arg1: any, arg2: number) => number;
@@ -4,7 +4,7 @@ import InputWithExamples from "../../components/input-with-examples";
4
4
  import SimpleKeypadInput from "../../components/simple-keypad-input";
5
5
  import type { PerseusNumericInputWidgetOptions, PerseusNumericInputAnswerForm } from "../../perseus-types";
6
6
  import type { PerseusStrings } from "../../strings";
7
- import type { FocusPath, PerseusScore, WidgetProps } from "../../types";
7
+ import type { FocusPath, PerseusScore, Widget, WidgetProps } from "../../types";
8
8
  import type { PerseusNumericInputRubric, PerseusNumericInputUserInput } from "../../validation.types";
9
9
  type ExternalProps = WidgetProps<PerseusNumericInputWidgetOptions, PerseusNumericInputRubric>;
10
10
  type Props = ExternalProps & {
@@ -30,7 +30,7 @@ type DefaultProps = {
30
30
  type State = {
31
31
  previousValues: ReadonlyArray<string>;
32
32
  };
33
- export declare class NumericInput extends React.Component<Props, State> {
33
+ export declare class NumericInput extends React.Component<Props, State> implements Widget {
34
34
  static contextType: React.Context<{
35
35
  strings: PerseusStrings;
36
36
  locale: string;
@@ -0,0 +1,3 @@
1
+ import type { PerseusScore } from "../../types";
2
+ import type { PerseusOrdererRubric, PerseusOrdererUserInput } from "../../validation.types";
3
+ export declare function ordererValidator(userInput: PerseusOrdererUserInput, rubric: PerseusOrdererRubric): PerseusScore;