@khanacademy/perseus 36.1.2 → 37.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/all-widgets.d.ts +2 -0
  2. package/dist/basic-widgets.d.ts +2 -0
  3. package/dist/components/math-input.d.ts +1 -1
  4. package/dist/es/index.js +598 -766
  5. package/dist/es/index.js.map +1 -1
  6. package/dist/extra-widgets.d.ts +2 -0
  7. package/dist/index.js +463 -643
  8. package/dist/index.js.map +1 -1
  9. package/dist/perseus-api.d.ts +1 -0
  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 +1 -0
  13. package/dist/types.d.ts +13 -4
  14. package/dist/util/extract-perseus-data.d.ts +1 -1
  15. package/dist/util.d.ts +4 -0
  16. package/dist/validation.types.d.ts +14 -6
  17. package/dist/widgets/categorizer/categorizer.d.ts +4 -5
  18. package/dist/widgets/cs-program/cs-program.d.ts +3 -3
  19. package/dist/widgets/definition/definition.d.ts +4 -4
  20. package/dist/widgets/deprecated-standin/deprecated-standin.d.ts +36 -0
  21. package/dist/widgets/deprecated-standin/index.d.ts +1 -37
  22. package/dist/widgets/dropdown/dropdown.d.ts +3 -3
  23. package/dist/widgets/explanation/explanation.d.ts +5 -5
  24. package/dist/widgets/expression/expression.d.ts +11 -9
  25. package/dist/widgets/graded-group/graded-group.d.ts +2 -0
  26. package/dist/widgets/graded-group-set/graded-group-set.d.ts +2 -0
  27. package/dist/widgets/grapher/grapher.d.ts +3 -3
  28. package/dist/widgets/group/group.d.ts +9 -5
  29. package/dist/widgets/iframe/iframe.d.ts +3 -3
  30. package/dist/widgets/image/image.d.ts +4 -4
  31. package/dist/widgets/input-number/input-number.d.ts +3 -6
  32. package/dist/widgets/interaction/interaction.d.ts +4 -4
  33. package/dist/widgets/interactive-graph.d.ts +3 -4
  34. package/dist/widgets/interactive-graphs/mafs-supported-graph-types.d.ts +1 -1
  35. package/dist/widgets/label-image/label-image.d.ts +6 -4
  36. package/dist/widgets/matcher/matcher.d.ts +3 -3
  37. package/dist/widgets/matrix/matrix.d.ts +4 -5
  38. package/dist/widgets/measurer/measurer.d.ts +3 -4
  39. package/dist/widgets/molecule/molecule.d.ts +3 -4
  40. package/dist/widgets/number-line/number-line.d.ts +4 -4
  41. package/dist/widgets/numeric-input/numeric-input.d.ts +3 -4
  42. package/dist/widgets/orderer/orderer.d.ts +3 -3
  43. package/dist/widgets/passage/passage.d.ts +4 -9
  44. package/dist/widgets/passage-ref/passage-ref.d.ts +4 -4
  45. package/dist/widgets/passage-ref-target/passage-ref-target.d.ts +3 -4
  46. package/dist/widgets/phet-simulation/phet-simulation.d.ts +3 -2
  47. package/dist/widgets/plotter/plotter.d.ts +3 -3
  48. package/dist/widgets/python-program/python-program.d.ts +2 -0
  49. package/dist/widgets/radio/radio-component.d.ts +2 -5
  50. package/dist/widgets/radio/radio.d.ts +2 -0
  51. package/dist/widgets/sorter/sorter.d.ts +3 -3
  52. package/dist/widgets/table/table.d.ts +4 -5
  53. package/dist/widgets/video/video.d.ts +3 -8
  54. package/dist/widgets.d.ts +3 -1
  55. package/package.json +2 -2
  56. package/dist/widgets/expression/expression.types.d.ts +0 -2
@@ -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, Widget, WidgetProps } from "../../types";
5
+ import type { 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";
@@ -23,7 +23,6 @@ declare class Grapher extends React.Component<Props> implements Widget {
23
23
  horizHairline: any;
24
24
  vertHairline: any;
25
25
  static defaultProps: DefaultProps;
26
- static validate(state: PerseusGrapherUserInput, rubric: PerseusGrapherRubric): PerseusScore;
27
26
  static getUserInputFromProps(props: Props): PerseusGrapherUserInput;
28
27
  handlePlotChanges: (arg1: any) => any;
29
28
  handleActiveTypeChange: (arg1: any) => any;
@@ -35,7 +34,6 @@ declare class Grapher extends React.Component<Props> implements Widget {
35
34
  _setupGraphie: (arg1: any, arg2: any) => void;
36
35
  showHairlines: (arg1: Coord) => void;
37
36
  hideHairlines: () => void;
38
- simpleValidate(rubric: PerseusGrapherRubric): PerseusScore;
39
37
  getUserInput(): PerseusGrapherUserInput;
40
38
  render(): React.ReactNode;
41
39
  }
@@ -55,6 +53,8 @@ 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;
57
+ getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
58
58
  propUpgrades?: {
59
59
  [key: string]: (arg1: any) => any;
60
60
  } | undefined;
@@ -3,10 +3,9 @@ import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import Renderer from "../../renderer";
4
4
  import type { PerseusGroupWidgetOptions } from "../../perseus-types";
5
5
  import type { ChangeFn, FocusPath, Widget, WidgetProps } from "../../types";
6
- import type { UserInput } from "../../validation.types";
7
- type Rubric = PerseusGroupWidgetOptions;
6
+ import type { PerseusGroupRubric, UserInputArray } from "../../validation.types";
8
7
  type RenderProps = PerseusGroupWidgetOptions;
9
- type Props = WidgetProps<RenderProps, Rubric>;
8
+ type Props = WidgetProps<RenderProps, PerseusGroupRubric>;
10
9
  type DefaultProps = {
11
10
  content: Props["content"];
12
11
  widgets: Props["widgets"];
@@ -23,10 +22,13 @@ declare class Group extends React.Component<Props> implements Widget {
23
22
  static defaultProps: DefaultProps;
24
23
  componentDidMount(): void;
25
24
  change: ChangeFn;
26
- getUserInput(): ReadonlyArray<UserInput | null | undefined> | undefined;
25
+ getUserInputMap(): import("../../validation.types").UserInputMap | undefined;
26
+ /**
27
+ * @deprecated getUserInputMap should be used for Groups
28
+ */
29
+ getUserInput(): UserInputArray | undefined;
27
30
  getSerializedState: () => any;
28
31
  restoreSerializedState: (arg1: any, arg2: any) => null;
29
- simpleValidate(): import("../../types").PerseusScore;
30
32
  getInputPaths(): readonly FocusPath[];
31
33
  setInputValue: (arg1: FocusPath, arg2: string, arg3: () => unknown) => void;
32
34
  focus(): boolean;
@@ -51,6 +53,8 @@ declare const _default: Readonly<{
51
53
  traverseChildWidgets?: any;
52
54
  transform?: import("../../types").WidgetTransform | undefined;
53
55
  staticTransform?: import("../../types").WidgetTransform | undefined;
56
+ validator?: import("../../types").WidgetValidatorFunction | undefined;
57
+ getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
54
58
  propUpgrades?: {
55
59
  [key: string]: (arg1: any) => any;
56
60
  } | undefined;
@@ -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,8 @@ 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;
52
+ getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
53
53
  propUpgrades?: {
54
54
  [key: string]: (arg1: any) => any;
55
55
  } | 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,8 @@ 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;
58
+ getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
59
59
  propUpgrades?: {
60
60
  [key: string]: (arg1: any) => any;
61
61
  } | 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,13 +34,9 @@ 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
  };
43
- static getOneCorrectAnswerFromRubric(rubric: any): string | null | undefined;
44
40
  shouldShowExamples: () => boolean;
45
41
  handleChange: (arg1: string, arg2: () => void) => void;
46
42
  _handleFocus: () => void;
@@ -52,7 +48,6 @@ declare class InputNumber extends React.Component<Props> implements Widget {
52
48
  getGrammarTypeForPath: (arg1: Path) => string;
53
49
  setInputValue: (arg1: Path, arg2: string, arg3: () => void) => void;
54
50
  getUserInput(): PerseusInputNumberUserInput;
55
- simpleValidate(rubric: PerseusInputNumberRubric): PerseusScore;
56
51
  examples: () => ReadonlyArray<string>;
57
52
  render(): React.ReactNode;
58
53
  }
@@ -72,6 +67,8 @@ declare const _default: Readonly<{
72
67
  traverseChildWidgets?: any;
73
68
  transform?: import("../../types").WidgetTransform | undefined;
74
69
  staticTransform?: import("../../types").WidgetTransform | undefined;
70
+ validator?: import("../../types").WidgetValidatorFunction | undefined;
71
+ getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | 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,8 @@ 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;
46
+ getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
47
47
  propUpgrades?: {
48
48
  [key: string]: (arg1: any) => any;
49
49
  } | 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, 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,7 +101,6 @@ 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
  }
@@ -110,7 +109,6 @@ declare class InteractiveGraph extends React.Component<Props, State> {
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> {
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,8 @@ 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;
181
+ getOneCorrectAnswerFromRubric?: ((rubric: import("../validation.types").Rubric) => string | null | undefined) | undefined;
183
182
  propUpgrades?: {
184
183
  [key: string]: (arg1: any) => any;
185
184
  } | undefined;
@@ -1,3 +1,3 @@
1
- export declare const mafsSupportedGraphTypes: readonly ["angle", "segment", "linear", "linear-system", "ray", "polygon", "point", "circle", "quadratic", "sinusoid", "unlimited-point"];
1
+ export declare const mafsSupportedGraphTypes: readonly ["angle", "segment", "linear", "linear-system", "ray", "polygon", "point", "circle", "quadratic", "sinusoid", "unlimited-point", "unlimited-polygon"];
2
2
  export type MafsSupportedGraphType = (typeof mafsSupportedGraphTypes)[number];
3
3
  export declare const trueForAllMafsSupportedGraphTypes: Record<MafsSupportedGraphType, true>;
@@ -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;
@@ -138,6 +136,7 @@ declare const _default: Readonly<{
138
136
  segment?: boolean | undefined;
139
137
  angle?: boolean | undefined;
140
138
  "linear-system"?: boolean | undefined;
139
+ "unlimited-polygon"?: boolean | undefined;
141
140
  "unlimited-point"?: boolean | undefined;
142
141
  } & {
143
142
  "interactive-graph-locked-features-labels"?: boolean | undefined;
@@ -208,6 +207,7 @@ declare const _default: Readonly<{
208
207
  segment?: boolean | undefined;
209
208
  angle?: boolean | undefined;
210
209
  "linear-system"?: boolean | undefined;
210
+ "unlimited-polygon"?: boolean | undefined;
211
211
  "unlimited-point"?: boolean | undefined;
212
212
  } & {
213
213
  "interactive-graph-locked-features-labels"?: boolean | undefined;
@@ -244,6 +244,8 @@ declare const _default: Readonly<{
244
244
  traverseChildWidgets?: any;
245
245
  transform?: import("../../types").WidgetTransform | undefined;
246
246
  staticTransform?: import("../../types").WidgetTransform | undefined;
247
+ validator?: import("../../types").WidgetValidatorFunction | undefined;
248
+ getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
247
249
  propUpgrades?: {
248
250
  [key: string]: (arg1: any) => any;
249
251
  } | 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,8 @@ 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;
57
+ getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
58
58
  propUpgrades?: {
59
59
  [key: string]: (arg1: any) => any;
60
60
  } | 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,8 @@ 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;
68
+ getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
70
69
  propUpgrades?: {
71
70
  [key: string]: (arg1: any) => any;
72
71
  } | 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,8 @@ 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;
60
+ getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
62
61
  propUpgrades?: {
63
62
  [key: string]: (arg1: any) => any;
64
63
  } | 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,8 @@ 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;
55
+ getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
57
56
  propUpgrades?: {
58
57
  [key: string]: (arg1: any) => any;
59
58
  } | 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,8 @@ 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;
94
+ getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
95
95
  propUpgrades?: {
96
96
  [key: string]: (arg1: any) => any;
97
97
  } | 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 & {
@@ -39,12 +39,9 @@ export declare class NumericInput extends React.Component<Props, State> implemen
39
39
  inputRef: SimpleKeypadInput | InputWithExamples | null | undefined;
40
40
  static defaultProps: DefaultProps;
41
41
  static getUserInputFromProps(props: Props): PerseusNumericInputUserInput;
42
- static getOneCorrectAnswerFromRubric(rubric: PerseusNumericInputRubric): string | null | undefined;
43
- static validate(userInput: PerseusNumericInputUserInput, rubric: PerseusNumericInputRubric, strings: PerseusStrings): PerseusScore;
44
42
  state: State;
45
43
  examples: () => ReadonlyArray<string>;
46
44
  shouldShowExamples: () => boolean;
47
- simpleValidate(rubric: PerseusNumericInputRubric): PerseusScore;
48
45
  focus: () => boolean;
49
46
  focusInputPath: () => void;
50
47
  blurInputPath: () => void;
@@ -74,6 +71,8 @@ declare const _default: Readonly<{
74
71
  traverseChildWidgets?: any;
75
72
  transform?: import("../../types").WidgetTransform | undefined;
76
73
  staticTransform?: import("../../types").WidgetTransform | undefined;
74
+ validator?: import("../../types").WidgetValidatorFunction | undefined;
75
+ getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | 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,8 @@ 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;
66
+ getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
67
67
  propUpgrades?: {
68
68
  [key: string]: (arg1: any) => any;
69
69
  } | 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,8 @@ 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;
120
+ getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
126
121
  propUpgrades?: {
127
122
  [key: string]: (arg1: any) => any;
128
123
  } | 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,8 @@ 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;
59
+ getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
60
60
  propUpgrades?: {
61
61
  [key: string]: (arg1: any) => any;
62
62
  } | undefined;