@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
@@ -100,6 +100,7 @@ export declare const ApiOptions: {
100
100
  segment?: boolean | undefined;
101
101
  angle?: boolean | undefined;
102
102
  "linear-system"?: boolean | undefined;
103
+ "unlimited-polygon"?: boolean | undefined;
103
104
  "unlimited-point"?: boolean | undefined;
104
105
  } & {
105
106
  "interactive-graph-locked-features-labels"?: boolean | undefined;
@@ -0,0 +1,8 @@
1
+ import type { PerseusWidgetsMap } from "./perseus-types";
2
+ import type { PerseusStrings } from "./strings";
3
+ import type { PerseusScore } from "./types";
4
+ import type { UserInputMap } from "./validation.types";
5
+ export declare function emptyWidgetsFunctional(widgets: PerseusWidgetsMap, widgetIds: Array<string>, userInputMap: UserInputMap, strings: PerseusStrings, locale: string): ReadonlyArray<string>;
6
+ export declare function scoreWidgetsFunctional(widgets: PerseusWidgetsMap, widgetIds: Array<string>, userInputMap: UserInputMap, strings: PerseusStrings, locale: string): {
7
+ [widgetId: string]: PerseusScore;
8
+ };
@@ -1,4 +1,5 @@
1
1
  import * as React from "react";
2
+ import { PerseusI18nContext } from "./components/i18n-context";
2
3
  import InteractionTracker from "./interaction-tracker";
3
4
  import TranslationLinter from "./translation-linter";
4
5
  import WidgetContainer from "./widget-container";
@@ -6,7 +7,7 @@ import type { DependenciesContext } from "./dependencies";
6
7
  import type { PerseusRenderer, PerseusWidget, PerseusWidgetOptions, PerseusWidgetsMap, ShowSolutions } from "./perseus-types";
7
8
  import type { PerseusStrings } from "./strings";
8
9
  import type { APIOptions, APIOptionsWithDefaults, FilterCriterion, FocusPath, PerseusScore, SerializedState, Widget, WidgetProps } from "./types";
9
- import type { UserInput } from "./validation.types";
10
+ import type { UserInputArray, UserInputMap } from "./validation.types";
10
11
  import type { KeypadAPI } from "@khanacademy/math-input";
11
12
  import type { LinterContextProps } from "@khanacademy/perseus-linter";
12
13
  import "./styles/perseus-renderer.less";
@@ -61,9 +62,7 @@ type Props = Partial<React.ContextType<typeof DependenciesContext>> & {
61
62
  };
62
63
  type State = {
63
64
  translationLintErrors: ReadonlyArray<string>;
64
- widgetInfo: Readonly<{
65
- [id: string]: PerseusWidget | null | undefined;
66
- }>;
65
+ widgetInfo: Readonly<PerseusWidgetsMap>;
67
66
  widgetProps: Readonly<{
68
67
  [id: string]: any | null | undefined;
69
68
  }>;
@@ -72,6 +71,11 @@ type State = {
72
71
  };
73
72
  type DefaultProps = Required<Pick<Props, "alwaysUpdate" | "content" | "findExternalWidgets" | "highlightedWidgets" | "images" | "linterContext" | "onInteractWithWidget" | "onRender" | "onSerializedStateUpdated" | "questionCompleted" | "showSolutions" | "reviewMode" | "serializedState" | "widgets">>;
74
73
  declare class Renderer extends React.Component<Props, State> {
74
+ static contextType: React.Context<{
75
+ strings: PerseusStrings;
76
+ locale: string;
77
+ }>;
78
+ context: React.ContextType<typeof PerseusI18nContext>;
75
79
  _currentFocus: FocusPath | null | undefined;
76
80
  _foundTextNodes: boolean;
77
81
  _interactionTrackers: {
@@ -189,42 +193,37 @@ declare class Renderer extends React.Component<Props, State> {
189
193
  blurPath: (path: FocusPath) => void;
190
194
  blur: () => void;
191
195
  serialize: () => Record<any, any>;
192
- emptyWidgets: () => any;
196
+ emptyWidgets(): ReadonlyArray<string>;
193
197
  _setWidgetProps: SetWidgetPropsFn;
194
198
  setInputValue: (path: FocusPath, newValue: string, focus?: () => unknown) => void;
195
199
  /**
196
200
  * Returns an array of the widget `.getUserInput()` results
201
+ *
202
+ * TODO: can we remove this?
203
+ * @deprecated use getUserInputMap
204
+ */
205
+ getUserInput(): UserInputArray;
206
+ /**
207
+ * Returns an object of the widget `.getUserInput()` results
197
208
  */
198
- getUserInput: () => ReadonlyArray<UserInput | null | undefined>;
209
+ getUserInputMap(): UserInputMap;
199
210
  /**
200
211
  * Returns an array of all widget IDs in the order they occur in
201
212
  * the content.
202
213
  */
203
214
  getWidgetIds: () => ReadonlyArray<string>;
204
- /**
205
- * Returns the result of `.getUserInput()` for each widget, in
206
- * a map from widgetId to userInput.
207
- * NOTE(jeremy): This function is hauntingly similar to `getUserInput` with
208
- * the major difference being that this function returns a map of
209
- * `widgetID` => UserInput and `getUserInput` simply returns an array. It
210
- * would be trivial to map between the results of each of these functions,
211
- * so we should aim to remove one of these functions.
212
- */
213
- getUserInputForWidgets: () => {
214
- [widgetId: string]: UserInput | null | undefined;
215
- };
216
215
  /**
217
216
  * Returns an object mapping from widget ID to perseus-style score.
218
217
  * The keys of this object are the values of the array returned
219
218
  * from `getWidgetIds`.
220
219
  */
221
- scoreWidgets: () => {
220
+ scoreWidgets(): {
222
221
  [widgetId: string]: PerseusScore;
223
222
  };
224
223
  /**
225
224
  * Grades the content.
226
225
  */
227
- score: () => PerseusScore;
226
+ score(): PerseusScore;
228
227
  guessAndScore: () => [any, PerseusScore];
229
228
  examples: () => ReadonlyArray<string> | null | undefined;
230
229
  handletranslationLintErrors: (lintErrors: ReadonlyArray<string>) => void;
@@ -139,6 +139,7 @@ declare const ref: React.ForwardRefExoticComponent<Omit<Pick<SharedRendererProps
139
139
  segment?: boolean | undefined;
140
140
  angle?: boolean | undefined;
141
141
  "linear-system"?: boolean | undefined;
142
+ "unlimited-polygon"?: boolean | undefined;
142
143
  "unlimited-point"?: boolean | undefined;
143
144
  } & {
144
145
  "interactive-graph-locked-features-labels"?: boolean | undefined;
package/dist/types.d.ts CHANGED
@@ -3,7 +3,7 @@ import type { Item } from "./multi-items/item-types";
3
3
  import type { Hint, PerseusAnswerArea, PerseusGraphType, PerseusWidget, PerseusWidgetsMap } from "./perseus-types";
4
4
  import type { PerseusStrings } from "./strings";
5
5
  import type { SizeClass } from "./util/sizing-utils";
6
- import type { UserInput } from "./validation.types";
6
+ import type { Rubric, UserInput, UserInputArray, UserInputMap } from "./validation.types";
7
7
  import type { KeypadAPI } from "@khanacademy/math-input";
8
8
  import type { AnalyticsEventHandlerFn } from "@khanacademy/perseus-core";
9
9
  import type { LinterContextProps } from "@khanacademy/perseus-linter";
@@ -33,6 +33,12 @@ export type SerializedState = Record<string, any>;
33
33
  * scoring, state serialization/deserialization, and focus management.
34
34
  */
35
35
  export interface Widget {
36
+ /**
37
+ * don't use isWidget; it's just a dummy property to help TypeScript's weak
38
+ * typing to recognize non-interactive widgets as Widgets
39
+ * @deprecated
40
+ */
41
+ isWidget?: true;
36
42
  focus?: () => {
37
43
  id: string;
38
44
  path: FocusPath;
@@ -46,8 +52,8 @@ export interface Widget {
46
52
  focusInputPath?: (path: FocusPath) => void;
47
53
  getInputPaths?: () => ReadonlyArray<FocusPath>;
48
54
  setInputValue?: (path: FocusPath, newValue: string, focus?: () => unknown) => void;
49
- getUserInput?: () => UserInput | null | undefined;
50
- simpleValidate?: (options?: any, onOutputError?: (widgetId: any, value: string, message?: string | null | undefined) => unknown | null | undefined) => PerseusScore;
55
+ getUserInputMap?: () => UserInputMap | undefined;
56
+ getUserInput?: () => UserInputArray | UserInput | undefined;
51
57
  showRationalesForCurrentlySelectedChoices?: (options?: any) => void;
52
58
  examples?: () => ReadonlyArray<string>;
53
59
  }
@@ -109,7 +115,7 @@ type TrackInteractionArgs = {
109
115
  id: string;
110
116
  correct?: boolean;
111
117
  } & Partial<TrackingGradedGroupExtraArguments> & Partial<TrackingSequenceExtraArguments>;
112
- export declare const MafsGraphTypeFlags: readonly ["angle", "segment", "linear", "linear-system", "ray", "polygon", "circle", "quadratic", "sinusoid", "point", "unlimited-point", "none"];
118
+ export declare const MafsGraphTypeFlags: readonly ["angle", "segment", "linear", "linear-system", "ray", "polygon", "unlimited-polygon", "circle", "quadratic", "sinusoid", "point", "unlimited-point", "none"];
113
119
  export declare const InteractiveGraphLockedFeaturesFlags: readonly ["interactive-graph-locked-features-labels", "locked-figures-aria", "locked-point-labels", "locked-line-labels", "locked-vector-labels", "locked-ellipse-labels", "locked-polygon-labels", "locked-function-labels"];
114
120
  /**
115
121
  * APIOptions provides different ways to customize the behaviour of Perseus.
@@ -352,6 +358,7 @@ export type TrackingSequenceExtraArguments = {
352
358
  export type Alignment = "default" | "block" | "inline-block" | "inline" | "float-left" | "float-right" | "full-width";
353
359
  type WidgetOptions = any;
354
360
  export type WidgetTransform = (arg1: WidgetOptions, strings: PerseusStrings, problemNumber?: number) => any;
361
+ export type WidgetValidatorFunction = (userInput: UserInput, rubric: Rubric, string?: PerseusStrings, locale?: string) => PerseusScore;
355
362
  export type WidgetExports<T extends React.ComponentType<any> & Widget = React.ComponentType<any>> = Readonly<{
356
363
  name: string;
357
364
  displayName: string;
@@ -379,6 +386,8 @@ export type WidgetExports<T extends React.ComponentType<any> & Widget = React.Co
379
386
  /** transforms the widget options to the props used to render the widget for
380
387
  static renders */
381
388
  staticTransform?: WidgetTransform;
389
+ validator?: WidgetValidatorFunction;
390
+ getOneCorrectAnswerFromRubric?: (rubric: Rubric) => string | null | undefined;
382
391
  /**
383
392
  A map of major version numbers (as a string, eg "1") to a function that
384
393
  migrates from the _previous_ major version.
@@ -36,7 +36,7 @@ declare function getImagesWithoutAltData(perseusRenderer: PerseusRenderer): stri
36
36
  export declare const isWrongAnswerSupported: (widgetIds: Array<string>, widgetMap: PerseusWidgetsMap) => boolean;
37
37
  export declare const shouldHaveIndividualAnswer: (widgetId: string, widgetMap: PerseusWidgetsMap) => boolean;
38
38
  export declare const getAnswerFromUserInput: (widgetType: string, userInput: any) => any;
39
- export declare const getCorrectAnswerForWidgetId: (widgetId: string, itemData: PerseusItem) => string | undefined;
39
+ export declare const getCorrectAnswerForWidgetId: (widgetId: string, itemData: PerseusItem) => string | null | undefined;
40
40
  export declare const isWidgetIdInContent: (perseusItem: PerseusItem, widgetId: string) => boolean;
41
41
  export declare const getValidWidgetIds: (perseusItem: PerseusItem) => Array<string>;
42
42
  export { getAnswersFromWidgets, getImagesWithoutAltData, injectWidgets };
package/dist/util.d.ts CHANGED
@@ -47,6 +47,9 @@ declare function shuffle<T>(array: ReadonlyArray<T>, randomSeed: number | RNG, e
47
47
  * if one is wrong, the total score is wrong, etc.
48
48
  */
49
49
  declare function combineScores(scoreA: PerseusScore, scoreB: PerseusScore): PerseusScore;
50
+ declare function flattenScores(widgetScoreMap: {
51
+ [widgetId: string]: PerseusScore;
52
+ }): PerseusScore;
50
53
  export declare function isCorrect(score: PerseusScore): boolean;
51
54
  declare function keScoreFromPerseusScore(score: PerseusScore, guess: any, state: any): KEScore;
52
55
  /**
@@ -203,6 +206,7 @@ declare const Util: {
203
206
  readonly shuffle: typeof shuffle;
204
207
  readonly split: (str: string, r: RegExp) => ReadonlyArray<string>;
205
208
  readonly combineScores: typeof combineScores;
209
+ readonly flattenScores: typeof flattenScores;
206
210
  readonly keScoreFromPerseusScore: typeof keScoreFromPerseusScore;
207
211
  readonly firstNumericalParse: typeof firstNumericalParse;
208
212
  readonly stringArrayOfSize: typeof stringArrayOfSize;
@@ -1,10 +1,8 @@
1
1
  import type { Coord } from "./interactive2/types";
2
- import type { PerseusDefinitionWidgetOptions, PerseusDropdownWidgetOptions, PerseusExplanationWidgetOptions, PerseusExpressionAnswerForm, PerseusGradedGroupSetWidgetOptions, PerseusGradedGroupWidgetOptions, PerseusGrapherWidgetOptions, PerseusGraphType, PerseusIFrameWidgetOptions, PerseusImageWidgetOptions, PerseusInputNumberWidgetOptions, PerseusInteractionWidgetOptions, PerseusLabelImageWidgetOptions, PerseusMatcherWidgetOptions, PerseusMatrixWidgetOptions, PerseusNumberLineWidgetOptions, PerseusNumericInputWidgetOptions, PerseusOrdererWidgetOptions, PerseusPassageRefWidgetOptions, PerseusPassageWidgetOptions, PerseusPlotterWidgetOptions, PerseusRadioWidgetOptions, PerseusSorterWidgetOptions, PerseusTableWidgetOptions, PerseusVideoWidgetOptions } from "./perseus-types";
2
+ import type { PerseusDefinitionWidgetOptions, PerseusDropdownChoice, PerseusExplanationWidgetOptions, PerseusExpressionAnswerForm, PerseusGradedGroupSetWidgetOptions, PerseusGradedGroupWidgetOptions, PerseusGrapherWidgetOptions, PerseusGraphType, PerseusGroupWidgetOptions, PerseusIFrameWidgetOptions, PerseusImageWidgetOptions, PerseusInputNumberWidgetOptions, PerseusInteractionWidgetOptions, PerseusLabelImageWidgetOptions, PerseusMatcherWidgetOptions, PerseusMatrixWidgetOptions, PerseusNumberLineWidgetOptions, PerseusNumericInputWidgetOptions, PerseusOrdererWidgetOptions, PerseusPassageRefWidgetOptions, PerseusPassageWidgetOptions, PerseusPlotterWidgetOptions, PerseusRadioWidgetOptions, PerseusSorterWidgetOptions, PerseusTableWidgetOptions, PerseusVideoWidgetOptions } from "./perseus-types";
3
3
  import type { InteractiveMarkerType } from "./widgets/label-image/types";
4
4
  import type { Relationship } from "./widgets/number-line/number-line";
5
5
  export type UserInputStatus = "correct" | "incorrect" | "incomplete";
6
- export type EmptyUserInput = Empty;
7
- export type NullUserInput = null;
8
6
  export type PerseusCategorizerRubric = {
9
7
  values: ReadonlyArray<number>;
10
8
  };
@@ -17,7 +15,9 @@ export type PerseusCSProgramUserInput = {
17
15
  message: string | null;
18
16
  };
19
17
  export type PerseusDefinitionRubric = PerseusDefinitionWidgetOptions;
20
- export type PerseusDropdownRubric = PerseusDropdownWidgetOptions;
18
+ export type PerseusDropdownRubric = {
19
+ choices: ReadonlyArray<PerseusDropdownChoice>;
20
+ };
21
21
  export type PerseusDropdownUserInput = {
22
22
  value: number;
23
23
  };
@@ -27,6 +27,7 @@ export type PerseusExpressionRubric = {
27
27
  functions: ReadonlyArray<string>;
28
28
  };
29
29
  export type PerseusExpressionUserInput = string;
30
+ export type PerseusGroupRubric = PerseusGroupWidgetOptions;
30
31
  export type PerseusGradedGroupRubric = PerseusGradedGroupWidgetOptions;
31
32
  export type PerseusGradedGroupSetRubric = PerseusGradedGroupSetWidgetOptions;
32
33
  export type PerseusGrapherRubric = PerseusGrapherWidgetOptions;
@@ -68,7 +69,6 @@ export type PerseusMatrixRubric = PerseusMatrixWidgetOptions;
68
69
  export type PerseusMatrixUserInput = {
69
70
  answers: ReadonlyArray<ReadonlyArray<number>>;
70
71
  };
71
- export type PerseusMoleculeUserInput = ReadonlyArray<ReadonlyArray<string>>;
72
72
  export type PerseusNumberLineRubric = PerseusNumberLineWidgetOptions & {
73
73
  isInequality: boolean;
74
74
  };
@@ -107,4 +107,12 @@ export type PerseusSorterUserInput = {
107
107
  export type PerseusTableRubric = PerseusTableWidgetOptions;
108
108
  export type PerseusTableUserInput = ReadonlyArray<ReadonlyArray<string>>;
109
109
  export type PerseusVideoRubric = PerseusVideoWidgetOptions;
110
- export type UserInput = PerseusCategorizerUserInput | PerseusCSProgramUserInput | PerseusDropdownUserInput | PerseusExpressionUserInput | PerseusGrapherUserInput | PerseusIFrameUserInput | PerseusInputNumberUserInput | PerseusInteractiveGraphUserInput | PerseusLabelImageUserInput | PerseusMatcherUserInput | PerseusMatrixUserInput | PerseusMoleculeUserInput | PerseusNumberLineUserInput | PerseusNumericInputUserInput | PerseusOrdererUserInput | PerseusPlotterUserInput | PerseusRadioUserInput | PerseusSorterUserInput | PerseusTableUserInput | EmptyUserInput;
110
+ export type Rubric = PerseusCategorizerRubric | PerseusCSProgramRubric | PerseusDefinitionRubric | PerseusDropdownRubric | PerseusExplanationRubric | PerseusExpressionRubric | PerseusGroupRubric | PerseusGradedGroupRubric | PerseusGradedGroupSetRubric | PerseusGrapherRubric | PerseusIFrameRubric | PerseusImageRubric | PerseusInputNumberRubric | PerseusInteractionRubric | PerseusInteractiveGraphRubric | PerseusLabelImageRubric | PerseusMatcherRubric | PerseusMatrixRubric | PerseusNumberLineRubric | PerseusNumericInputRubric | PerseusOrdererRubric | PerseusPassageRubric | PerseusPassageRefRubric | PerseusPlotterRubric | PerseusRadioRubric | PerseusSorterRubric | PerseusTableRubric | PerseusVideoRubric;
111
+ export type UserInput = PerseusCategorizerUserInput | PerseusCSProgramUserInput | PerseusDropdownUserInput | PerseusExpressionUserInput | PerseusGrapherUserInput | PerseusIFrameUserInput | PerseusInputNumberUserInput | PerseusInteractiveGraphUserInput | PerseusLabelImageUserInput | PerseusMatcherUserInput | PerseusMatrixUserInput | PerseusNumberLineUserInput | PerseusNumericInputUserInput | PerseusOrdererUserInput | PerseusPlotterUserInput | PerseusRadioUserInput | PerseusSorterUserInput | PerseusTableUserInput;
112
+ export type UserInputMap = {
113
+ [widgetId: string]: UserInput | UserInputMap;
114
+ };
115
+ /**
116
+ * deprecated prefer using UserInputMap
117
+ */
118
+ export type UserInputArray = ReadonlyArray<UserInputArray | UserInput | null | undefined>;
@@ -1,8 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { PerseusCategorizerWidgetOptions } from "../../perseus-types";
4
- import type { PerseusStrings } from "../../strings";
5
- import type { PerseusScore, Widget, WidgetProps } from "../../types";
4
+ import type { Widget, WidgetProps } from "../../types";
6
5
  import type { PerseusCategorizerRubric, PerseusCategorizerUserInput } from "../../validation.types";
7
6
  type Props = WidgetProps<RenderProps, PerseusCategorizerRubric> & {
8
7
  values: ReadonlyArray<string>;
@@ -18,18 +17,16 @@ type State = {
18
17
  };
19
18
  export declare class Categorizer extends React.Component<Props, State> implements Widget {
20
19
  static contextType: React.Context<{
21
- strings: PerseusStrings;
20
+ strings: import("../../strings").PerseusStrings;
22
21
  locale: string;
23
22
  }>;
24
23
  context: React.ContextType<typeof PerseusI18nContext>;
25
24
  static defaultProps: DefaultProps;
26
25
  state: State;
27
- static validate(userInput: PerseusCategorizerUserInput, rubric: PerseusCategorizerRubric, strings: PerseusStrings): PerseusScore;
28
26
  static getUserInputFromProps(props: Props): PerseusCategorizerUserInput;
29
27
  change: (...args: ReadonlyArray<unknown>) => any;
30
28
  getUserInput(): PerseusCategorizerUserInput;
31
29
  onChange(itemNum: any, catNum: any): void;
32
- simpleValidate(rubric: PerseusCategorizerRubric): PerseusScore;
33
30
  render(): React.ReactNode;
34
31
  }
35
32
  type RenderProps = {
@@ -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;
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import * as React from "react";
5
5
  import type { PerseusCSProgramWidgetOptions } from "../../perseus-types";
6
- import type { PerseusScore, Widget, WidgetProps } from "../../types";
6
+ import type { Widget, WidgetProps } from "../../types";
7
7
  import type { PerseusCSProgramRubric, PerseusCSProgramUserInput } from "../../validation.types";
8
8
  type RenderProps = PerseusCSProgramWidgetOptions & PerseusCSProgramUserInput;
9
9
  type Props = WidgetProps<RenderProps, PerseusCSProgramRubric>;
@@ -15,13 +15,11 @@ type DefaultProps = {
15
15
  };
16
16
  declare class CSProgram extends React.Component<Props> implements Widget {
17
17
  static defaultProps: DefaultProps;
18
- static validate(state: PerseusCSProgramUserInput): PerseusScore;
19
18
  componentDidMount(): void;
20
19
  componentWillUnmount(): void;
21
20
  handleMessageEvent: (arg1: any) => void;
22
21
  change: (...args: ReadonlyArray<unknown>) => any;
23
22
  getUserInput(): PerseusCSProgramUserInput;
24
- simpleValidate(): PerseusScore;
25
23
  render(): React.ReactNode;
26
24
  }
27
25
  declare const _default: Readonly<{
@@ -40,6 +38,8 @@ declare const _default: Readonly<{
40
38
  traverseChildWidgets?: any;
41
39
  transform?: import("../../types").WidgetTransform | undefined;
42
40
  staticTransform?: import("../../types").WidgetTransform | undefined;
41
+ validator?: import("../../types").WidgetValidatorFunction | undefined;
42
+ getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
43
43
  propUpgrades?: {
44
44
  [key: string]: (arg1: any) => any;
45
45
  } | undefined;
@@ -2,7 +2,7 @@ import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { PerseusRenderer, PerseusDefinitionWidgetOptions } from "../../perseus-types";
4
4
  import type { Widget, WidgetProps } from "../../types";
5
- import type { EmptyUserInput, PerseusDefinitionRubric } from "../../validation.types";
5
+ import type { PerseusDefinitionRubric } from "../../validation.types";
6
6
  type RenderProps = PerseusDefinitionWidgetOptions;
7
7
  type DefinitionProps = WidgetProps<RenderProps, PerseusDefinitionRubric> & {
8
8
  widgets: PerseusRenderer["widgets"];
@@ -18,9 +18,7 @@ declare class Definition extends React.Component<DefinitionProps> implements Wid
18
18
  }>;
19
19
  context: React.ContextType<typeof PerseusI18nContext>;
20
20
  static defaultProps: DefaultProps;
21
- static validate(): import("../../types").PerseusScore;
22
- getUserInput(): EmptyUserInput;
23
- simpleValidate(): import("../../types").PerseusScore;
21
+ isWidget: true;
24
22
  render(): React.ReactNode;
25
23
  }
26
24
  declare const _default: Readonly<{
@@ -39,6 +37,8 @@ declare const _default: Readonly<{
39
37
  traverseChildWidgets?: any;
40
38
  transform?: import("../../types").WidgetTransform | undefined;
41
39
  staticTransform?: import("../../types").WidgetTransform | undefined;
40
+ validator?: import("../../types").WidgetValidatorFunction | undefined;
41
+ getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
42
42
  propUpgrades?: {
43
43
  [key: string]: (arg1: any) => any;
44
44
  } | undefined;
@@ -0,0 +1,36 @@
1
+ import React from "react";
2
+ import { PerseusI18nContext } from "../../components/i18n-context";
3
+ import type { Widget } from "../../types";
4
+ type Props = any;
5
+ declare class DeprecatedStandin extends React.Component<Props> implements Widget {
6
+ static contextType: React.Context<{
7
+ strings: import("../../strings").PerseusStrings;
8
+ locale: string;
9
+ }>;
10
+ context: React.ContextType<typeof PerseusI18nContext>;
11
+ isWidget: true;
12
+ render(): React.JSX.Element;
13
+ }
14
+ declare const _default: Readonly<{
15
+ name: string;
16
+ displayName: string;
17
+ getWidget?: (() => typeof DeprecatedStandin) | undefined;
18
+ widget: typeof DeprecatedStandin;
19
+ accessible?: boolean | ((props: any) => boolean) | undefined;
20
+ hidden?: boolean | undefined;
21
+ version?: import("../../types").Version | undefined;
22
+ supportedAlignments?: readonly import("../../types").Alignment[] | undefined;
23
+ defaultAlignment?: import("../../types").Alignment | undefined;
24
+ getDefaultAlignment?: (() => import("../../types").Alignment) | undefined;
25
+ isLintable?: boolean | undefined;
26
+ tracking?: import("../../types").Tracking | undefined;
27
+ traverseChildWidgets?: any;
28
+ transform?: import("../../types").WidgetTransform | undefined;
29
+ staticTransform?: import("../../types").WidgetTransform | undefined;
30
+ validator?: import("../../types").WidgetValidatorFunction | undefined;
31
+ getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
32
+ propUpgrades?: {
33
+ [key: string]: (arg1: any) => any;
34
+ } | undefined;
35
+ }>;
36
+ export default _default;
@@ -1,37 +1 @@
1
- import React from "react";
2
- import { PerseusI18nContext } from "../../components/i18n-context";
3
- import type { PerseusScore, Widget } from "../../types";
4
- import type { EmptyUserInput } from "../../validation.types";
5
- type Props = any;
6
- declare class DeprecatedStandin extends React.Component<Props> implements Widget {
7
- static contextType: React.Context<{
8
- strings: import("../../strings").PerseusStrings;
9
- locale: string;
10
- }>;
11
- context: React.ContextType<typeof PerseusI18nContext>;
12
- static validate(): PerseusScore;
13
- getUserInput(): EmptyUserInput;
14
- simpleValidate(): PerseusScore;
15
- render(): React.JSX.Element;
16
- }
17
- declare const _default: Readonly<{
18
- name: string;
19
- displayName: string;
20
- getWidget?: (() => typeof DeprecatedStandin) | undefined;
21
- widget: typeof DeprecatedStandin;
22
- accessible?: boolean | ((props: any) => boolean) | undefined;
23
- hidden?: boolean | undefined;
24
- version?: import("../../types").Version | undefined;
25
- supportedAlignments?: readonly import("../../types").Alignment[] | undefined;
26
- defaultAlignment?: import("../../types").Alignment | undefined;
27
- getDefaultAlignment?: (() => import("../../types").Alignment) | undefined;
28
- isLintable?: boolean | undefined;
29
- tracking?: import("../../types").Tracking | undefined;
30
- traverseChildWidgets?: any;
31
- transform?: import("../../types").WidgetTransform | undefined;
32
- staticTransform?: import("../../types").WidgetTransform | undefined;
33
- propUpgrades?: {
34
- [key: string]: (arg1: any) => any;
35
- } | undefined;
36
- }>;
37
- export default _default;
1
+ export { default } from "./deprecated-standin";
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import type { PerseusScore, Widget, WidgetProps } from "../../types";
2
+ import type { Widget, WidgetProps } from "../../types";
3
3
  import type { PerseusDropdownRubric, PerseusDropdownUserInput } from "../../validation.types";
4
4
  type Props = WidgetProps<RenderProps, PerseusDropdownRubric> & {
5
5
  selected: number;
@@ -12,12 +12,10 @@ type DefaultProps = {
12
12
  };
13
13
  declare class Dropdown extends React.Component<Props> implements Widget {
14
14
  static defaultProps: DefaultProps;
15
- static validate(userInput: PerseusDropdownUserInput, rubric: PerseusDropdownRubric): PerseusScore;
16
15
  focus: () => boolean;
17
16
  _handleChangeEvent: (arg1: React.ChangeEvent<HTMLInputElement>) => void;
18
17
  _handleChange: (arg1: number) => void;
19
18
  getUserInput(): PerseusDropdownUserInput;
20
- simpleValidate(rubric: PerseusDropdownRubric): PerseusScore;
21
19
  render(): React.ReactNode;
22
20
  }
23
21
  type RenderProps = {
@@ -40,6 +38,8 @@ declare const _default: Readonly<{
40
38
  traverseChildWidgets?: any;
41
39
  transform?: import("../../types").WidgetTransform | undefined;
42
40
  staticTransform?: import("../../types").WidgetTransform | undefined;
41
+ validator?: import("../../types").WidgetValidatorFunction | undefined;
42
+ getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
43
43
  propUpgrades?: {
44
44
  [key: string]: (arg1: any) => any;
45
45
  } | undefined;
@@ -2,7 +2,7 @@ import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { PerseusExplanationWidgetOptions } from "../../perseus-types";
4
4
  import type { Widget, WidgetProps } from "../../types";
5
- import type { EmptyUserInput, PerseusExplanationRubric } from "../../validation.types";
5
+ import type { PerseusExplanationRubric } from "../../validation.types";
6
6
  type RenderProps = PerseusExplanationWidgetOptions;
7
7
  type Props = WidgetProps<RenderProps, PerseusExplanationRubric>;
8
8
  type DefaultProps = {
@@ -21,16 +21,14 @@ declare class Explanation extends React.Component<Props, State> implements Widge
21
21
  locale: string;
22
22
  }>;
23
23
  context: React.ContextType<typeof PerseusI18nContext>;
24
+ static defaultProps: DefaultProps;
25
+ isWidget: true;
24
26
  state: State;
25
27
  _mounted: boolean;
26
- static defaultProps: DefaultProps;
27
- static validate(): import("../../types").PerseusScore;
28
28
  componentDidMount(): void;
29
29
  componentWillUnmount(): void;
30
30
  change: (arg1: any, arg2: any, arg3: any) => any;
31
31
  _onClick: () => void;
32
- getUserInput(): EmptyUserInput;
33
- simpleValidate(): import("../../types").PerseusScore;
34
32
  render(): React.ReactNode;
35
33
  }
36
34
  declare const _default: Readonly<{
@@ -49,6 +47,8 @@ declare const _default: Readonly<{
49
47
  traverseChildWidgets?: any;
50
48
  transform?: import("../../types").WidgetTransform | undefined;
51
49
  staticTransform?: import("../../types").WidgetTransform | undefined;
50
+ validator?: import("../../types").WidgetValidatorFunction | undefined;
51
+ getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
52
52
  propUpgrades?: {
53
53
  [key: string]: (arg1: any) => any;
54
54
  } | undefined;
@@ -2,8 +2,7 @@ import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { DependenciesContext } from "../../dependencies";
4
4
  import type { PerseusExpressionWidgetOptions } from "../../perseus-types";
5
- import type { PerseusStrings } from "../../strings";
6
- import type { FocusPath, PerseusScore, Widget, WidgetProps } from "../../types";
5
+ import type { FocusPath, Widget, WidgetProps } from "../../types";
7
6
  import type { PerseusExpressionRubric, PerseusExpressionUserInput } from "../../validation.types";
8
7
  import type { Keys as Key, KeypadConfiguration } from "@khanacademy/math-input";
9
8
  type InputPath = ReadonlyArray<string>;
@@ -46,15 +45,13 @@ type DefaultProps = {
46
45
  };
47
46
  export declare class Expression extends React.Component<Props, ExpressionState> implements Widget {
48
47
  static contextType: React.Context<{
49
- strings: PerseusStrings;
48
+ strings: import("../../strings").PerseusStrings;
50
49
  locale: string;
51
50
  }>;
52
51
  context: React.ContextType<typeof PerseusI18nContext>;
53
52
  _textareaId: string;
54
53
  _isMounted: boolean;
55
- static validate(userInput: PerseusExpressionUserInput, rubric: PerseusExpressionRubric, strings: PerseusStrings, locale: string): PerseusScore;
56
54
  static getUserInputFromProps(props: Props): PerseusExpressionUserInput;
57
- static getOneCorrectAnswerFromRubric(rubric: PerseusExpressionRubric): string | null | undefined;
58
55
  static defaultProps: DefaultProps;
59
56
  displayName: string;
60
57
  state: ExpressionState;
@@ -62,9 +59,6 @@ export declare class Expression extends React.Component<Props, ExpressionState>
62
59
  componentDidUpdate: (prevProps: Props) => void;
63
60
  componentWillUnmount: () => void;
64
61
  _handleMouseDown: () => void;
65
- simpleValidate: (rubric: PerseusExpressionRubric & {
66
- scoring?: boolean;
67
- }) => PerseusScore;
68
62
  getUserInput(): PerseusExpressionUserInput;
69
63
  change: (...args: any) => any | undefined;
70
64
  parse: (value: string, props: Props) => any;
@@ -91,7 +85,7 @@ export declare class Expression extends React.Component<Props, ExpressionState>
91
85
  * to be included as keys on the keypad. These are scraped from the answer
92
86
  * forms.
93
87
  */
94
- declare const keypadConfigurationForProps: (widgetOptions: PerseusExpressionWidgetOptions) => KeypadConfiguration;
88
+ export declare const keypadConfigurationForProps: (widgetOptions: PerseusExpressionWidgetOptions) => KeypadConfiguration;
95
89
  declare const _default: Readonly<{
96
90
  name: string;
97
91
  displayName: string;
@@ -144,6 +138,7 @@ declare const _default: Readonly<{
144
138
  segment?: boolean | undefined;
145
139
  angle?: boolean | undefined;
146
140
  "linear-system"?: boolean | undefined;
141
+ "unlimited-polygon"?: boolean | undefined;
147
142
  "unlimited-point"?: boolean | undefined;
148
143
  } & {
149
144
  "interactive-graph-locked-features-labels"?: boolean | undefined;
@@ -229,6 +224,7 @@ declare const _default: Readonly<{
229
224
  segment?: boolean | undefined;
230
225
  angle?: boolean | undefined;
231
226
  "linear-system"?: boolean | undefined;
227
+ "unlimited-polygon"?: boolean | undefined;
232
228
  "unlimited-point"?: boolean | undefined;
233
229
  } & {
234
230
  "interactive-graph-locked-features-labels"?: boolean | undefined;
@@ -315,6 +311,7 @@ declare const _default: Readonly<{
315
311
  segment?: boolean | undefined;
316
312
  angle?: boolean | undefined;
317
313
  "linear-system"?: boolean | undefined;
314
+ "unlimited-polygon"?: boolean | undefined;
318
315
  "unlimited-point"?: boolean | undefined;
319
316
  } & {
320
317
  "interactive-graph-locked-features-labels"?: boolean | undefined;
@@ -398,6 +395,7 @@ declare const _default: Readonly<{
398
395
  segment?: boolean | undefined;
399
396
  angle?: boolean | undefined;
400
397
  "linear-system"?: boolean | undefined;
398
+ "unlimited-polygon"?: boolean | undefined;
401
399
  "unlimited-point"?: boolean | undefined;
402
400
  } & {
403
401
  "interactive-graph-locked-features-labels"?: boolean | undefined;
@@ -483,6 +481,7 @@ declare const _default: Readonly<{
483
481
  segment?: boolean | undefined;
484
482
  angle?: boolean | undefined;
485
483
  "linear-system"?: boolean | undefined;
484
+ "unlimited-polygon"?: boolean | undefined;
486
485
  "unlimited-point"?: boolean | undefined;
487
486
  } & {
488
487
  "interactive-graph-locked-features-labels"?: boolean | undefined;
@@ -569,6 +568,7 @@ declare const _default: Readonly<{
569
568
  segment?: boolean | undefined;
570
569
  angle?: boolean | undefined;
571
570
  "linear-system"?: boolean | undefined;
571
+ "unlimited-polygon"?: boolean | undefined;
572
572
  "unlimited-point"?: boolean | undefined;
573
573
  } & {
574
574
  "interactive-graph-locked-features-labels"?: boolean | undefined;
@@ -614,6 +614,8 @@ declare const _default: Readonly<{
614
614
  traverseChildWidgets?: any;
615
615
  transform?: import("../../types").WidgetTransform | undefined;
616
616
  staticTransform?: import("../../types").WidgetTransform | undefined;
617
+ validator?: import("../../types").WidgetValidatorFunction | undefined;
618
+ getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
617
619
  propUpgrades?: {
618
620
  [key: string]: (arg1: any) => any;
619
621
  } | undefined;
@@ -65,6 +65,8 @@ declare const _default: Readonly<{
65
65
  traverseChildWidgets?: any;
66
66
  transform?: import("../../types").WidgetTransform | undefined;
67
67
  staticTransform?: import("../../types").WidgetTransform | undefined;
68
+ validator?: import("../../types").WidgetValidatorFunction | undefined;
69
+ getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
68
70
  propUpgrades?: {
69
71
  [key: string]: (arg1: any) => any;
70
72
  } | undefined;
@@ -45,6 +45,8 @@ declare const _default: Readonly<{
45
45
  traverseChildWidgets?: any;
46
46
  transform?: import("../../types").WidgetTransform | undefined;
47
47
  staticTransform?: import("../../types").WidgetTransform | undefined;
48
+ validator?: import("../../types").WidgetValidatorFunction | undefined;
49
+ getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
48
50
  propUpgrades?: {
49
51
  [key: string]: (arg1: any) => any;
50
52
  } | undefined;