@khanacademy/perseus 36.1.1 → 37.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 (57) hide show
  1. package/dist/all-widgets.d.ts +1 -0
  2. package/dist/basic-widgets.d.ts +1 -0
  3. package/dist/components/math-input.d.ts +1 -1
  4. package/dist/es/index.js +523 -660
  5. package/dist/es/index.js.map +1 -1
  6. package/dist/extra-widgets.d.ts +1 -0
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.js +489 -635
  9. package/dist/index.js.map +1 -1
  10. package/dist/renderer-util.d.ts +8 -0
  11. package/dist/renderer.d.ts +19 -20
  12. package/dist/server-item-renderer.d.ts +3 -1
  13. package/dist/types.d.ts +11 -3
  14. package/dist/util/graphie.d.ts +1 -1
  15. package/dist/util.d.ts +4 -0
  16. package/dist/validation.types.d.ts +19 -9
  17. package/dist/widgets/categorizer/categorizer.d.ts +3 -5
  18. package/dist/widgets/cs-program/cs-program.d.ts +4 -8
  19. package/dist/widgets/definition/definition.d.ts +3 -4
  20. package/dist/widgets/deprecated-standin/deprecated-standin.d.ts +35 -0
  21. package/dist/widgets/deprecated-standin/index.d.ts +1 -37
  22. package/dist/widgets/dropdown/dropdown.d.ts +2 -3
  23. package/dist/widgets/explanation/explanation.d.ts +4 -5
  24. package/dist/widgets/expression/expression.d.ts +4 -8
  25. package/dist/widgets/graded-group/graded-group.d.ts +1 -0
  26. package/dist/widgets/graded-group-set/graded-group-set.d.ts +1 -0
  27. package/dist/widgets/grapher/grapher.d.ts +2 -3
  28. package/dist/widgets/group/group.d.ts +8 -5
  29. package/dist/widgets/iframe/iframe.d.ts +2 -3
  30. package/dist/widgets/image/image.d.ts +3 -4
  31. package/dist/widgets/input-number/input-number.d.ts +2 -5
  32. package/dist/widgets/interaction/interaction.d.ts +3 -4
  33. package/dist/widgets/interactive-graph.d.ts +3 -5
  34. package/dist/widgets/interactive-graphs/math/angles.d.ts +3 -1
  35. package/dist/widgets/interactive-graphs/math/index.d.ts +1 -1
  36. package/dist/widgets/label-image/label-image.d.ts +3 -4
  37. package/dist/widgets/matcher/matcher.d.ts +2 -3
  38. package/dist/widgets/matrix/matrix.d.ts +3 -5
  39. package/dist/widgets/measurer/measurer.d.ts +2 -4
  40. package/dist/widgets/molecule/molecule.d.ts +2 -4
  41. package/dist/widgets/number-line/number-line.d.ts +3 -4
  42. package/dist/widgets/numeric-input/numeric-input.d.ts +2 -3
  43. package/dist/widgets/orderer/orderer.d.ts +2 -3
  44. package/dist/widgets/passage/passage.d.ts +3 -9
  45. package/dist/widgets/passage-ref/passage-ref.d.ts +3 -4
  46. package/dist/widgets/passage-ref-target/passage-ref-target.d.ts +2 -4
  47. package/dist/widgets/phet-simulation/phet-simulation.d.ts +2 -2
  48. package/dist/widgets/plotter/plotter.d.ts +2 -3
  49. package/dist/widgets/python-program/python-program.d.ts +1 -0
  50. package/dist/widgets/radio/radio-component.d.ts +2 -5
  51. package/dist/widgets/radio/radio.d.ts +1 -0
  52. package/dist/widgets/sorter/sorter.d.ts +2 -3
  53. package/dist/widgets/table/table.d.ts +3 -5
  54. package/dist/widgets/video/video.d.ts +2 -8
  55. package/dist/widgets.d.ts +2 -1
  56. package/package.json +9 -9
  57. package/dist/widgets/expression/expression.types.d.ts +0 -2
@@ -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, Widget } from "../../types";
11
+ import type { WidgetProps, Widget } from "../../types";
12
12
  import type { PerseusIFrameRubric, PerseusIFrameUserInput, UserInputStatus } from "../../validation.types";
13
13
  type RenderProps = PerseusIFrameWidgetOptions & {
14
14
  status: UserInputStatus;
@@ -25,13 +25,11 @@ type DefaultProps = {
25
25
  };
26
26
  declare class Iframe extends React.Component<Props> implements Widget {
27
27
  static defaultProps: DefaultProps;
28
- static validate(state: PerseusIFrameUserInput): PerseusScore;
29
28
  componentDidMount(): void;
30
29
  componentWillUnmount(): void;
31
30
  getUserInput(): PerseusIFrameUserInput;
32
31
  handleMessageEvent: (arg1: any) => void;
33
32
  change: (...args: ReadonlyArray<unknown>) => any;
34
- simpleValidate(): PerseusScore;
35
33
  render(): React.ReactNode;
36
34
  }
37
35
  declare const _default: Readonly<{
@@ -50,6 +48,7 @@ declare const _default: Readonly<{
50
48
  traverseChildWidgets?: any;
51
49
  transform?: import("../../types").WidgetTransform | undefined;
52
50
  staticTransform?: import("../../types").WidgetTransform | undefined;
51
+ validator?: import("../../types").WidgetValidatorFunction | undefined;
53
52
  propUpgrades?: {
54
53
  [key: string]: (arg1: any) => any;
55
54
  } | undefined;
@@ -2,7 +2,7 @@ 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, Widget } from "../../types";
5
- import type { NullUserInput, PerseusImageRubric } from "../../validation.types";
5
+ import type { PerseusImageRubric } from "../../validation.types";
6
6
  type RenderProps = PerseusImageWidgetOptions;
7
7
  type ExternalProps = WidgetProps<RenderProps, PerseusImageRubric>;
8
8
  type Props = ExternalProps & {
@@ -34,10 +34,8 @@ declare class ImageWidget extends React.Component<Props> implements Widget {
34
34
  }>;
35
35
  context: React.ContextType<typeof PerseusI18nContext>;
36
36
  static defaultProps: DefaultProps;
37
- static validate(): import("../../types").PerseusScore;
37
+ isWidget: true;
38
38
  change: ChangeFn;
39
- getUserInput(): NullUserInput;
40
- simpleValidate(): import("../../types").PerseusScore;
41
39
  render(): React.ReactNode;
42
40
  }
43
41
  declare const _default: Readonly<{
@@ -56,6 +54,7 @@ declare const _default: Readonly<{
56
54
  traverseChildWidgets?: any;
57
55
  transform?: import("../../types").WidgetTransform | undefined;
58
56
  staticTransform?: import("../../types").WidgetTransform | undefined;
57
+ validator?: import("../../types").WidgetValidatorFunction | undefined;
59
58
  propUpgrades?: {
60
59
  [key: string]: (arg1: any) => any;
61
60
  } | undefined;
@@ -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, Widget, WidgetProps } from "../../types";
5
+ import type { Path, Widget, WidgetProps } from "../../types";
6
6
  import type { PerseusInputNumberRubric, PerseusInputNumberUserInput } from "../../validation.types";
7
7
  type RenderProps = {
8
8
  simplify: PerseusInputNumberWidgetOptions["simplify"];
@@ -34,9 +34,6 @@ declare class InputNumber extends React.Component<Props> implements Widget {
34
34
  }>;
35
35
  context: React.ContextType<typeof PerseusI18nContext>;
36
36
  static defaultProps: DefaultProps;
37
- static validate(state: {
38
- currentValue: string;
39
- }, rubric: PerseusInputNumberRubric, strings: PerseusStrings): PerseusScore;
40
37
  static getUserInputFromProps(props: Props): {
41
38
  currentValue: string;
42
39
  };
@@ -52,7 +49,6 @@ declare class InputNumber extends React.Component<Props> implements Widget {
52
49
  getGrammarTypeForPath: (arg1: Path) => string;
53
50
  setInputValue: (arg1: Path, arg2: string, arg3: () => void) => void;
54
51
  getUserInput(): PerseusInputNumberUserInput;
55
- simpleValidate(rubric: PerseusInputNumberRubric): PerseusScore;
56
52
  examples: () => ReadonlyArray<string>;
57
53
  render(): React.ReactNode;
58
54
  }
@@ -72,6 +68,7 @@ declare const _default: Readonly<{
72
68
  traverseChildWidgets?: any;
73
69
  transform?: import("../../types").WidgetTransform | undefined;
74
70
  staticTransform?: import("../../types").WidgetTransform | undefined;
71
+ validator?: import("../../types").WidgetValidatorFunction | undefined;
75
72
  propUpgrades?: {
76
73
  [key: string]: (arg1: any) => any;
77
74
  } | undefined;
@@ -2,7 +2,7 @@ import * as React from "react";
2
2
  import type { Coord } from "../../interactive2/types";
3
3
  import type { PerseusInteractionWidgetOptions } from "../../perseus-types";
4
4
  import type { Widget, WidgetProps } from "../../types";
5
- import type { EmptyUserInput, PerseusInteractionRubric } from "../../validation.types";
5
+ import type { PerseusInteractionRubric } from "../../validation.types";
6
6
  type RenderProps = PerseusInteractionWidgetOptions;
7
7
  type Props = WidgetProps<RenderProps, PerseusInteractionRubric>;
8
8
  type DefaultProps = {
@@ -15,7 +15,7 @@ type State = {
15
15
  };
16
16
  declare class Interaction extends React.Component<Props, State> implements Widget {
17
17
  static defaultProps: DefaultProps;
18
- static validate(): import("../../types").PerseusScore;
18
+ isWidget: true;
19
19
  state: State;
20
20
  UNSAFE_componentWillReceiveProps(nextProps: Props): void;
21
21
  _setupGraphie: (arg1: any, arg2: any) => void;
@@ -24,8 +24,6 @@ declare class Interaction extends React.Component<Props, State> implements Widge
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(): EmptyUserInput;
28
- simpleValidate(): import("../../types").PerseusScore;
29
27
  render(): React.ReactNode;
30
28
  }
31
29
  declare const _default: Readonly<{
@@ -44,6 +42,7 @@ declare const _default: Readonly<{
44
42
  traverseChildWidgets?: any;
45
43
  transform?: import("../../types").WidgetTransform | undefined;
46
44
  staticTransform?: import("../../types").WidgetTransform | undefined;
45
+ validator?: import("../../types").WidgetValidatorFunction | undefined;
47
46
  propUpgrades?: {
48
47
  [key: string]: (arg1: any) => any;
49
48
  } | undefined;
@@ -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, Widget, WidgetProps } from "../types";
7
+ import type { ChangeHandler, 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;
@@ -101,16 +101,14 @@ declare class LegacyInteractiveGraph extends React.Component<Props, State> {
101
101
  removeAngleControls: () => void;
102
102
  toggleShowSides: () => void;
103
103
  getUserInput(): PerseusInteractiveGraphUserInput;
104
- simpleValidate(rubric: PerseusInteractiveGraphRubric): PerseusScore;
105
104
  focus: () => void;
106
105
  render(): React.ReactNode;
107
106
  }
108
- declare class InteractiveGraph extends React.Component<Props, State> implements Widget {
107
+ declare class InteractiveGraph extends React.Component<Props, State> {
109
108
  legacyGraphRef: React.RefObject<LegacyInteractiveGraph>;
110
109
  mafsRef: React.RefObject<StatefulMafsGraphType>;
111
110
  static defaultProps: DefaultProps;
112
111
  getUserInput(): PerseusInteractiveGraphUserInput;
113
- simpleValidate(rubric: PerseusInteractiveGraphRubric): PerseusScore;
114
112
  render(): React.JSX.Element;
115
113
  /**
116
114
  * @param {object} graph Like props.graph or props.correct
@@ -160,7 +158,6 @@ declare class InteractiveGraph extends React.Component<Props, State> implements
160
158
  static getRayEquationString(props: Props): string;
161
159
  static getPolygonEquationString(props: Props): string;
162
160
  static getAngleEquationString(props: Props): string;
163
- static validate(userInput: PerseusGraphType, rubric: PerseusInteractiveGraphRubric): PerseusScore;
164
161
  static getUserInputFromProps(props: Props): PerseusGraphType;
165
162
  }
166
163
  export declare function shouldUseMafs(mafsFlags: Record<string, boolean> | undefined | boolean, graph: PerseusGraphType): boolean;
@@ -180,6 +177,7 @@ declare const _default: Readonly<{
180
177
  traverseChildWidgets?: any;
181
178
  transform?: import("../types").WidgetTransform | undefined;
182
179
  staticTransform?: import("../types").WidgetTransform | undefined;
180
+ validator?: import("../types").WidgetValidatorFunction | undefined;
183
181
  propUpgrades?: {
184
182
  [key: string]: (arg1: any) => any;
185
183
  } | undefined;
@@ -1,5 +1,7 @@
1
+ import type { Coord } from "@khanacademy/perseus";
1
2
  import type { vec } from "mafs";
2
3
  export declare function convertDegreesToRadians(degrees: number): number;
3
4
  export declare function calculateAngleInDegrees([x, y]: vec.Vector2): number;
4
5
  export declare function polar(r: number | vec.Vector2, th: number): vec.Vector2;
5
- export declare const findAngle: (point1: vec.Vector2, point2: vec.Vector2, vertex?: vec.Vector2) => number;
6
+ export declare const getAngleFromVertex: (point: vec.Vector2, vertex: vec.Vector2) => number;
7
+ export declare const getClockwiseAngle: (coords: [Coord, Coord, Coord], allowReflexAngles?: boolean) => number;
@@ -5,4 +5,4 @@ export { X, Y } from "./coordinates";
5
5
  export { MIN, MAX, size } from "./interval";
6
6
  export { lerp } from "./interpolation";
7
7
  export { segmentsIntersect } from "./geometry";
8
- export { calculateAngleInDegrees, convertDegreesToRadians, findAngle, polar, } from "./angles";
8
+ export { calculateAngleInDegrees, convertDegreesToRadians, getClockwiseAngle, getAngleFromVertex, polar, } from "./angles";
@@ -11,8 +11,8 @@ 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, Widget } from "../../types";
15
- import type { PerseusLabelImageRubric, PerseusLabelImageUserInput } from "../../validation.types";
14
+ import type { APIOptions, Widget } from "../../types";
15
+ import type { PerseusLabelImageUserInput } from "../../validation.types";
16
16
  export type PreferredPopoverDirection = "NONE" | "UP" | "DOWN" | "LEFT" | "RIGHT";
17
17
  /**
18
18
  * Represents a direction vector.
@@ -58,7 +58,6 @@ export declare class LabelImage extends React.Component<LabelImageProps, LabelIm
58
58
  context: React.ContextType<typeof PerseusI18nContext>;
59
59
  _markers: Array<Marker | null | undefined>;
60
60
  _mounted: boolean;
61
- static validate(state: PerseusLabelImageUserInput, rubric?: PerseusLabelImageRubric): PerseusScore;
62
61
  /**
63
62
  * Test whether point is contained within triangle.
64
63
  *
@@ -79,7 +78,6 @@ export declare class LabelImage extends React.Component<LabelImageProps, LabelIm
79
78
  constructor(props: LabelImageProps);
80
79
  componentDidMount(): void;
81
80
  componentWillUnmount(): void;
82
- simpleValidate(rubric: PerseusLabelImageRubric): PerseusScore;
83
81
  getUserInput(): PerseusLabelImageUserInput;
84
82
  showRationalesForCurrentlySelectedChoices(rubric: LabelImageProps): void;
85
83
  handleMarkerChange(index: number, marker: InteractiveMarkerType): void;
@@ -244,6 +242,7 @@ declare const _default: Readonly<{
244
242
  traverseChildWidgets?: any;
245
243
  transform?: import("../../types").WidgetTransform | undefined;
246
244
  staticTransform?: import("../../types").WidgetTransform | undefined;
245
+ validator?: import("../../types").WidgetValidatorFunction | undefined;
247
246
  propUpgrades?: {
248
247
  [key: string]: (arg1: any) => any;
249
248
  } | undefined;
@@ -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, Widget } from "../../types";
5
+ import type { 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>;
@@ -29,14 +29,12 @@ export declare class Matcher extends React.Component<Props, State> implements Wi
29
29
  context: React.ContextType<typeof PerseusI18nContext>;
30
30
  static defaultProps: DefaultProps;
31
31
  state: State;
32
- static validate(state: PerseusMatcherUserInput, rubric: PerseusMatcherRubric): PerseusScore;
33
32
  changeAndTrack: (arg1: any) => void;
34
33
  onMeasureLeft: (arg1: any) => void;
35
34
  onMeasureRight: (arg1: any) => void;
36
35
  getUserInput: () => PerseusMatcherUserInput;
37
36
  moveLeftOptionToIndex: (option: SortableOption, index: number) => void;
38
37
  moveRightOptionToIndex: (option: SortableOption, index: number) => void;
39
- simpleValidate(rubric: PerseusMatcherRubric): PerseusScore;
40
38
  render(): React.ReactElement;
41
39
  }
42
40
  declare const _default: Readonly<{
@@ -55,6 +53,7 @@ declare const _default: Readonly<{
55
53
  traverseChildWidgets?: any;
56
54
  transform?: import("../../types").WidgetTransform | undefined;
57
55
  staticTransform?: import("../../types").WidgetTransform | undefined;
56
+ validator?: import("../../types").WidgetValidatorFunction | undefined;
58
57
  propUpgrades?: {
59
58
  [key: string]: (arg1: any) => any;
60
59
  } | undefined;
@@ -1,8 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { PerseusMatrixWidgetOptions } from "../../perseus-types";
4
- import type { PerseusStrings } from "../../strings";
5
- import type { WidgetProps, PerseusScore, Widget, FocusPath } from "../../types";
4
+ import type { WidgetProps, Widget, FocusPath } from "../../types";
6
5
  import type { PerseusMatrixRubric, PerseusMatrixUserInput } from "../../validation.types";
7
6
  export declare function getMatrixSize(matrix: ReadonlyArray<ReadonlyArray<number>>): number[];
8
7
  type ExternalProps = WidgetProps<PerseusMatrixWidgetOptions, PerseusMatrixRubric>;
@@ -27,13 +26,12 @@ type State = {
27
26
  };
28
27
  declare class Matrix extends React.Component<Props, State> implements Widget {
29
28
  static contextType: React.Context<{
30
- strings: PerseusStrings;
29
+ strings: import("../../strings").PerseusStrings;
31
30
  locale: string;
32
31
  }>;
33
32
  context: React.ContextType<typeof PerseusI18nContext>;
34
33
  cursorPosition: [number, number];
35
34
  static defaultProps: DefaultProps;
36
- static validate(state: PerseusMatrixUserInput, rubric: PerseusMatrixRubric, strings: PerseusStrings): PerseusScore;
37
35
  state: State;
38
36
  componentDidMount(): void;
39
37
  getInputPaths: () => ReadonlyArray<ReadonlyArray<string>>;
@@ -48,7 +46,6 @@ declare class Matrix extends React.Component<Props, State> implements Widget {
48
46
  handleKeyDown: (arg1: any, arg2: any, arg3: any) => void;
49
47
  onValueChange: (arg1: any, arg2: any, arg3: any, arg4: any) => void;
50
48
  getUserInput(): PerseusMatrixUserInput;
51
- simpleValidate(rubric: PerseusMatrixRubric): PerseusScore;
52
49
  render(): React.ReactNode;
53
50
  }
54
51
  declare const _default: Readonly<{
@@ -67,6 +64,7 @@ declare const _default: Readonly<{
67
64
  traverseChildWidgets?: any;
68
65
  transform?: import("../../types").WidgetTransform | undefined;
69
66
  staticTransform?: import("../../types").WidgetTransform | undefined;
67
+ validator?: import("../../types").WidgetValidatorFunction | undefined;
70
68
  propUpgrades?: {
71
69
  [key: string]: (arg1: any) => any;
72
70
  } | undefined;
@@ -1,5 +1,4 @@
1
1
  import * as React from "react";
2
- import noopValidator from "../__shared__/noop-validator";
3
2
  import type { APIOptions, Widget } from "../../types";
4
3
  type Props = {
5
4
  apiOptions: APIOptions;
@@ -31,16 +30,14 @@ type DefaultProps = {
31
30
  rulerLength: Props["rulerLength"];
32
31
  };
33
32
  declare class Measurer extends React.Component<Props> implements Widget {
34
- static validate: typeof noopValidator;
35
33
  static defaultProps: DefaultProps;
34
+ isWidget: true;
36
35
  state: {};
37
36
  ruler: any;
38
37
  protractor: any;
39
38
  componentDidMount(): void;
40
39
  componentDidUpdate(prevProps: any): void;
41
40
  setupGraphie(): void;
42
- getUserInput(): {};
43
- simpleValidate(): import("../../types").PerseusScore;
44
41
  render(): React.JSX.Element;
45
42
  }
46
43
  declare const _default: Readonly<{
@@ -59,6 +56,7 @@ declare const _default: Readonly<{
59
56
  traverseChildWidgets?: any;
60
57
  transform?: import("../../types").WidgetTransform | undefined;
61
58
  staticTransform?: import("../../types").WidgetTransform | undefined;
59
+ validator?: import("../../types").WidgetValidatorFunction | undefined;
62
60
  propUpgrades?: {
63
61
  [key: string]: (arg1: any) => any;
64
62
  } | undefined;
@@ -2,7 +2,6 @@ import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { PerseusMoleculeRendererWidgetOptions } from "../../perseus-types";
4
4
  import type { Widget } from "../../types";
5
- import type { PerseusMoleculeUserInput } from "../../validation.types";
6
5
  type MoleculeState = {
7
6
  parsedSmiles: any;
8
7
  error: string | null;
@@ -33,9 +32,7 @@ type DefaultProps = {
33
32
  };
34
33
  declare class MoleculeWidget extends React.Component<Props> implements Widget {
35
34
  static defaultProps: DefaultProps;
36
- simpleValidate(): import("../../types").PerseusScore;
37
- getUserInput(): PerseusMoleculeUserInput;
38
- validate(): import("../../types").PerseusScore;
35
+ isWidget: true;
39
36
  render(): React.ReactNode;
40
37
  }
41
38
  declare const _default: Readonly<{
@@ -54,6 +51,7 @@ declare const _default: Readonly<{
54
51
  traverseChildWidgets?: any;
55
52
  transform?: import("../../types").WidgetTransform | undefined;
56
53
  staticTransform?: import("../../types").WidgetTransform | undefined;
54
+ validator?: import("../../types").WidgetValidatorFunction | undefined;
57
55
  propUpgrades?: {
58
56
  [key: string]: (arg1: any) => any;
59
57
  } | undefined;
@@ -1,8 +1,8 @@
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, FocusPath, Widget } from "../../types";
5
- import type { PerseusNumberLineRubric, PerseusNumberLineUserInput } from "../../validation.types";
4
+ import type { APIOptions, FocusPath, Widget } from "../../types";
5
+ import type { PerseusNumberLineUserInput } from "../../validation.types";
6
6
  export type Relationship = "lt" | "gt" | "le" | "ge";
7
7
  type Props = ChangeableProps & {
8
8
  range: [number, number];
@@ -50,7 +50,6 @@ declare class NumberLine extends React.Component<Props, State> implements Widget
50
50
  context: React.ContextType<typeof PerseusI18nContext>;
51
51
  static defaultProps: DefaultProps;
52
52
  state: any;
53
- static validate(state: PerseusNumberLineUserInput, rubric: PerseusNumberLineRubric): PerseusScore;
54
53
  change: (...args: ReadonlyArray<unknown>) => any;
55
54
  isValid: () => boolean;
56
55
  onNumDivisionsChange: (arg1: number, arg2: any) => void;
@@ -73,7 +72,6 @@ declare class NumberLine extends React.Component<Props, State> implements Widget
73
72
  _renderInequality: (arg1: any) => React.ReactElement;
74
73
  _setupGraphie: (arg1: any, arg2: any) => void;
75
74
  getUserInput(): PerseusNumberLineUserInput;
76
- simpleValidate(rubric: PerseusNumberLineRubric): PerseusScore;
77
75
  render(): React.ReactNode;
78
76
  }
79
77
  declare const _default: Readonly<{
@@ -92,6 +90,7 @@ declare const _default: Readonly<{
92
90
  traverseChildWidgets?: any;
93
91
  transform?: import("../../types").WidgetTransform | undefined;
94
92
  staticTransform?: import("../../types").WidgetTransform | undefined;
93
+ validator?: import("../../types").WidgetValidatorFunction | undefined;
95
94
  propUpgrades?: {
96
95
  [key: string]: (arg1: any) => any;
97
96
  } | undefined;
@@ -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, Widget, WidgetProps } from "../../types";
7
+ import type { FocusPath, 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 & {
@@ -40,11 +40,9 @@ export declare class NumericInput extends React.Component<Props, State> implemen
40
40
  static defaultProps: DefaultProps;
41
41
  static getUserInputFromProps(props: Props): PerseusNumericInputUserInput;
42
42
  static getOneCorrectAnswerFromRubric(rubric: PerseusNumericInputRubric): string | null | undefined;
43
- static validate(userInput: PerseusNumericInputUserInput, rubric: PerseusNumericInputRubric, strings: PerseusStrings): PerseusScore;
44
43
  state: State;
45
44
  examples: () => ReadonlyArray<string>;
46
45
  shouldShowExamples: () => boolean;
47
- simpleValidate(rubric: PerseusNumericInputRubric): PerseusScore;
48
46
  focus: () => boolean;
49
47
  focusInputPath: () => void;
50
48
  blurInputPath: () => void;
@@ -74,6 +72,7 @@ declare const _default: Readonly<{
74
72
  traverseChildWidgets?: any;
75
73
  transform?: import("../../types").WidgetTransform | undefined;
76
74
  staticTransform?: import("../../types").WidgetTransform | undefined;
75
+ validator?: import("../../types").WidgetValidatorFunction | undefined;
77
76
  propUpgrades?: {
78
77
  [key: string]: (arg1: any) => any;
79
78
  } | undefined;
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import type { PerseusOrdererWidgetOptions } from "../../perseus-types";
3
- import type { PerseusScore, WidgetProps, Widget } from "../../types";
3
+ import type { WidgetProps, Widget } from "../../types";
4
4
  import type { PerseusOrdererRubric, PerseusOrdererUserInput } from "../../validation.types";
5
5
  type Position = {
6
6
  left: number;
@@ -36,7 +36,6 @@ type OrdererState = {
36
36
  declare class Orderer extends React.Component<OrdererProps, OrdererState> implements Widget {
37
37
  static defaultProps: OrdererDefaultProps;
38
38
  state: OrdererState;
39
- static validate(userInput: PerseusOrdererUserInput, rubric: PerseusOrdererRubric): PerseusScore;
40
39
  UNSAFE_componentWillReceiveProps(nextProps: OrdererProps): void;
41
40
  onClick: (arg1: string, arg2: number, arg3: any, arg4: Element) => void;
42
41
  onRelease: (arg1: any) => void;
@@ -45,7 +44,6 @@ declare class Orderer extends React.Component<OrdererProps, OrdererState> implem
45
44
  isCardInBank: (arg1: any) => boolean;
46
45
  setListValues: (arg1: ReadonlyArray<string>) => void;
47
46
  getUserInput(): PerseusOrdererUserInput;
48
- simpleValidate(rubric: PerseusOrdererRubric): PerseusScore;
49
47
  render(): React.ReactNode;
50
48
  }
51
49
  declare const _default: Readonly<{
@@ -64,6 +62,7 @@ declare const _default: Readonly<{
64
62
  traverseChildWidgets?: any;
65
63
  transform?: import("../../types").WidgetTransform | undefined;
66
64
  staticTransform?: import("../../types").WidgetTransform | undefined;
65
+ validator?: import("../../types").WidgetValidatorFunction | undefined;
67
66
  propUpgrades?: {
68
67
  [key: string]: (arg1: any) => any;
69
68
  } | undefined;
@@ -5,7 +5,7 @@ import type { SerializedHighlightSet } from "../../components/highlighting/types
5
5
  import type { ChangeableProps } from "../../mixins/changeable";
6
6
  import type { PerseusPassageWidgetOptions, PerseusWidget } from "../../perseus-types";
7
7
  import type { WidgetProps, Widget } from "../../types";
8
- import type { NullUserInput, PerseusPassageRubric } from "../../validation.types";
8
+ import type { PerseusPassageRubric } from "../../validation.types";
9
9
  import type { SingleASTNode } from "@khanacademy/simple-markdown";
10
10
  export declare class LineHeightMeasurer extends React.Component<Record<any, any>> {
11
11
  _line: HTMLDivElement | null | undefined;
@@ -52,8 +52,8 @@ export declare class Passage extends React.Component<PassageProps, PassageState>
52
52
  _onResize: () => Record<any, any>;
53
53
  _stylesAppiedTimer: number;
54
54
  static defaultProps: DefaultPassageProps;
55
+ isWidget: true;
55
56
  state: PassageState;
56
- static validate(): import("../../types").PerseusScore;
57
57
  componentDidMount(): void;
58
58
  shouldComponentUpdate(nextProps: PassageProps, nextState: PassageState): any | boolean;
59
59
  componentDidUpdate(): void;
@@ -88,13 +88,6 @@ export declare class Passage extends React.Component<PassageProps, PassageState>
88
88
  _convertPosToLineNumber(absoluteVPos: number): number;
89
89
  _getRefContent(referenceNumber: number): string | null | undefined;
90
90
  getReference(referenceNumber: number): Reference | null | undefined;
91
- /**
92
- * Misc functions
93
- *
94
- * These are misc widget functions used for the widget API
95
- */
96
- getUserInput(): NullUserInput;
97
- simpleValidate(): import("../../types").PerseusScore;
98
91
  /**
99
92
  * Rendering
100
93
  *
@@ -123,6 +116,7 @@ declare const _default: Readonly<{
123
116
  traverseChildWidgets?: any;
124
117
  transform?: import("../../types").WidgetTransform | undefined;
125
118
  staticTransform?: import("../../types").WidgetTransform | undefined;
119
+ validator?: import("../../types").WidgetValidatorFunction | undefined;
126
120
  propUpgrades?: {
127
121
  [key: string]: (arg1: any) => any;
128
122
  } | undefined;
@@ -2,7 +2,7 @@ import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { PerseusPassageRefWidgetOptions } from "../../perseus-types";
4
4
  import type { ChangeFn, Widget, WidgetProps } from "../../types";
5
- import type { NullUserInput, PerseusPassageRefRubric } from "../../validation.types";
5
+ import type { PerseusPassageRefRubric } from "../../validation.types";
6
6
  type RenderProps = {
7
7
  passageNumber: PerseusPassageRefWidgetOptions["passageNumber"];
8
8
  referenceNumber: PerseusPassageRefWidgetOptions["referenceNumber"];
@@ -28,17 +28,15 @@ declare class PassageRef extends React.Component<Props, State> implements Widget
28
28
  _isMounted: boolean;
29
29
  _throttledUpdateRange: () => void;
30
30
  static defaultProps: DefaultProps;
31
+ isWidget: true;
31
32
  state: State;
32
- static validate(): import("../../types").PerseusScore;
33
33
  componentDidMount(): void;
34
34
  shouldComponentUpdate(nextProps: Props, nextState: State): boolean;
35
35
  componentDidUpdate(): void;
36
36
  componentWillUnmount(): void;
37
- getUserInput(): NullUserInput;
38
37
  change: ChangeFn;
39
38
  _deferredUpdateRange: () => void;
40
39
  _updateRange: () => void;
41
- simpleValidate(): import("../../types").PerseusScore;
42
40
  render(): React.ReactNode;
43
41
  }
44
42
  declare const _default: Readonly<{
@@ -57,6 +55,7 @@ declare const _default: Readonly<{
57
55
  traverseChildWidgets?: any;
58
56
  transform?: import("../../types").WidgetTransform | undefined;
59
57
  staticTransform?: import("../../types").WidgetTransform | undefined;
58
+ validator?: import("../../types").WidgetValidatorFunction | undefined;
60
59
  propUpgrades?: {
61
60
  [key: string]: (arg1: any) => any;
62
61
  } | undefined;
@@ -3,7 +3,6 @@ import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import * as Changeable from "../../mixins/changeable";
4
4
  import type { PerseusPassageRefTargetWidgetOptions } from "../../perseus-types";
5
5
  import type { APIOptions, Widget } from "../../types";
6
- import type { NullUserInput } from "../../validation.types";
7
6
  import type { LinterContextProps } from "@khanacademy/perseus-linter";
8
7
  type Props = Changeable.ChangeableProps & {
9
8
  apiOptions: APIOptions;
@@ -21,10 +20,8 @@ declare class PassageRefTarget extends React.Component<Props> implements Widget
21
20
  }>;
22
21
  context: React.ContextType<typeof PerseusI18nContext>;
23
22
  static defaultProps: DefaultProps;
24
- static validate(): import("../../types").PerseusScore;
25
- getUserInput(): NullUserInput;
23
+ isWidget: true;
26
24
  change: (arg1: any, arg2: any, arg3: any) => any;
27
- simpleValidate(): import("../../types").PerseusScore;
28
25
  render(): React.ReactNode;
29
26
  }
30
27
  declare const _default: Readonly<{
@@ -43,6 +40,7 @@ declare const _default: Readonly<{
43
40
  traverseChildWidgets?: any;
44
41
  transform?: import("../../types").WidgetTransform | undefined;
45
42
  staticTransform?: import("../../types").WidgetTransform | undefined;
43
+ validator?: import("../../types").WidgetValidatorFunction | undefined;
46
44
  propUpgrades?: {
47
45
  [key: string]: (arg1: any) => any;
48
46
  } | undefined;
@@ -6,7 +6,6 @@ import * as React from "react";
6
6
  import { PerseusI18nContext } from "../../components/i18n-context";
7
7
  import type { PerseusPhetSimulationWidgetOptions } from "../../perseus-types";
8
8
  import type { WidgetProps, Widget } from "../../types";
9
- import type { NullUserInput } from "../../validation.types";
10
9
  type RenderProps = PerseusPhetSimulationWidgetOptions;
11
10
  type Props = WidgetProps<RenderProps, PerseusPhetSimulationWidgetOptions>;
12
11
  type State = {
@@ -24,11 +23,11 @@ export declare class PhetSimulation extends React.Component<Props, State> implem
24
23
  context: React.ContextType<typeof PerseusI18nContext>;
25
24
  private readonly iframeRef;
26
25
  private readonly locale;
26
+ isWidget: true;
27
27
  state: State;
28
28
  constructor(props: any);
29
29
  componentDidMount(): Promise<void>;
30
30
  componentDidUpdate(prevProps: any): Promise<void>;
31
- getUserInput(): NullUserInput;
32
31
  getPhetCompatibleLocale: (arg1: string) => string;
33
32
  displayLoadFailure: () => void;
34
33
  updateSimState(urlString: string): Promise<void>;
@@ -52,6 +51,7 @@ declare const _default: Readonly<{
52
51
  traverseChildWidgets?: any;
53
52
  transform?: import("../../types").WidgetTransform | undefined;
54
53
  staticTransform?: import("../../types").WidgetTransform | undefined;
54
+ validator?: import("../../types").WidgetValidatorFunction | undefined;
55
55
  propUpgrades?: {
56
56
  [key: string]: (arg1: any) => any;
57
57
  } | undefined;
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { PerseusPlotterWidgetOptions } from "../../perseus-types";
4
- import type { PerseusScore, Widget, WidgetProps } from "../../types";
4
+ import type { Widget, WidgetProps } from "../../types";
5
5
  import type { PerseusPlotterRubric, PerseusPlotterUserInput } from "../../validation.types";
6
6
  type RenderProps = PerseusPlotterWidgetOptions;
7
7
  type Props = WidgetProps<RenderProps, PerseusPlotterRubric> & {
@@ -38,7 +38,6 @@ export declare class Plotter extends React.Component<Props, State> implements Wi
38
38
  graphie: any;
39
39
  static defaultProps: DefaultProps;
40
40
  state: State;
41
- static validate(userInput: PerseusPlotterUserInput, rubric: PerseusPlotterRubric): PerseusScore;
42
41
  componentDidMount(): void;
43
42
  UNSAFE_componentWillReceiveProps(nextProps: Props): void;
44
43
  componentDidUpdate(prevProps: Props, prevState: State): void;
@@ -69,7 +68,6 @@ export declare class Plotter extends React.Component<Props, State> implements Wi
69
68
  changeAndTrack: (arg1: any) => void;
70
69
  drawPicHeights: (arg1: any, arg2: any) => void;
71
70
  getUserInput(): PerseusPlotterUserInput;
72
- simpleValidate(rubric: PerseusPlotterRubric): PerseusScore;
73
71
  render(): React.ReactNode;
74
72
  }
75
73
  declare const _default: Readonly<{
@@ -88,6 +86,7 @@ declare const _default: Readonly<{
88
86
  traverseChildWidgets?: any;
89
87
  transform?: import("../../types").WidgetTransform | undefined;
90
88
  staticTransform?: import("../../types").WidgetTransform | undefined;
89
+ validator?: import("../../types").WidgetValidatorFunction | undefined;
91
90
  propUpgrades?: {
92
91
  [key: string]: (arg1: any) => any;
93
92
  } | undefined;
@@ -31,6 +31,7 @@ declare const _default: Readonly<{
31
31
  traverseChildWidgets?: any;
32
32
  transform?: import("../../types").WidgetTransform | undefined;
33
33
  staticTransform?: import("../../types").WidgetTransform | undefined;
34
+ validator?: import("../../types").WidgetValidatorFunction | undefined;
34
35
  propUpgrades?: {
35
36
  [key: string]: (arg1: any) => any;
36
37
  } | undefined;