@khanacademy/perseus 38.0.0 → 39.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 (50) hide show
  1. package/dist/components/math-input.d.ts +1 -1
  2. package/dist/components/sortable.d.ts +1 -1
  3. package/dist/definition-context.d.ts +1 -1
  4. package/dist/es/index.js +48 -112
  5. package/dist/es/index.js.map +1 -1
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.js +44 -111
  8. package/dist/index.js.map +1 -1
  9. package/dist/interactive2/movable-point.d.ts +1 -1
  10. package/dist/multi-items/prop-type-builders.d.ts +0 -6
  11. package/dist/perseus-api.d.ts +3 -1
  12. package/dist/perseus-types.d.ts +3 -42
  13. package/dist/renderer.d.ts +1 -2
  14. package/dist/server-item-renderer.d.ts +3 -2
  15. package/dist/sigfigs.d.ts +0 -16
  16. package/dist/styles/constants.d.ts +0 -18
  17. package/dist/types.d.ts +4 -6
  18. package/dist/util/math.d.ts +0 -1
  19. package/dist/util.d.ts +2 -1
  20. package/dist/validation.types.d.ts +10 -11
  21. package/dist/widgets/__shared__/noop-validator.d.ts +1 -1
  22. package/dist/widgets/definition/definition.d.ts +1 -2
  23. package/dist/widgets/explanation/explanation.d.ts +1 -2
  24. package/dist/widgets/expression/expression.d.ts +25 -12
  25. package/dist/widgets/image/image.d.ts +1 -2
  26. package/dist/widgets/input-number/input-number-validator.d.ts +2 -4
  27. package/dist/widgets/input-number/input-number.d.ts +0 -1
  28. package/dist/widgets/interaction/interaction.d.ts +1 -2
  29. package/dist/widgets/interactive-graphs/graphs/components/movable-line.d.ts +0 -11
  30. package/dist/widgets/interactive-graphs/graphs/point.d.ts +0 -2
  31. package/dist/widgets/interactive-graphs/graphs/use-transform.d.ts +0 -1
  32. package/dist/widgets/interactive-graphs/mafs-supported-graph-types.d.ts +2 -1
  33. package/dist/widgets/interactive-graphs/protractor.d.ts +0 -2
  34. package/dist/widgets/label-image/answer-choices.d.ts +1 -1
  35. package/dist/widgets/label-image/label-image-validator.d.ts +1 -1
  36. package/dist/widgets/label-image/label-image.d.ts +14 -30
  37. package/dist/widgets/matrix/matrix.d.ts +0 -1
  38. package/dist/widgets/measurer/measurer.d.ts +3 -15
  39. package/dist/widgets/molecule/molecule.d.ts +0 -21
  40. package/dist/widgets/number-line/number-line.d.ts +0 -1
  41. package/dist/widgets/numeric-input/numeric-input.d.ts +0 -1
  42. package/dist/widgets/orderer/orderer.d.ts +1 -1
  43. package/dist/widgets/passage/passage.d.ts +1 -2
  44. package/dist/widgets/passage-ref/passage-ref.d.ts +1 -2
  45. package/dist/widgets/radio/base-radio.d.ts +2 -1
  46. package/dist/widgets/table/table.d.ts +0 -1
  47. package/dist/widgets/video/video.d.ts +1 -2
  48. package/package.json +4 -4
  49. package/dist/util/fix-passage-refs.d.ts +0 -3
  50. package/dist/widgets/radio/choice.jsx.fixture.d.ts +0 -1
@@ -192,4 +192,4 @@ export declare class MovablePoint {
192
192
  standard: null;
193
193
  };
194
194
  }
195
- export default MovablePoint;
195
+ export {};
@@ -5,12 +5,6 @@
5
5
  * types instead.
6
6
  */
7
7
  import type { Shape } from "./shape-types";
8
- /**
9
- * A recursive PropType that accepts Shape objects, and rejects other objects.
10
- *
11
- * Usage: `propTypes: {shape: shapePropType}`.
12
- */
13
- export declare function shapePropType(...args: ReadonlyArray<any>): any;
14
8
  /**
15
9
  * Return a PropType that accepts Items of the given shape, and rejects other
16
10
  * objects.
@@ -78,7 +78,9 @@ export declare const ApiOptions: {
78
78
  type: string;
79
79
  id: string;
80
80
  correct?: boolean | undefined;
81
- } & Partial<import("./types").TrackingGradedGroupExtraArguments> & Partial<import("./types").TrackingSequenceExtraArguments>) => void) | undefined;
81
+ } & Partial<import("./types").TrackingGradedGroupExtraArguments> & Partial<{
82
+ visible: number;
83
+ }>) => void) | undefined;
82
84
  customKeypad?: boolean | undefined;
83
85
  nativeKeypadProxy?: ((blur: () => void) => import("@khanacademy/math-input").KeypadAPI) | undefined;
84
86
  isMobile?: boolean | undefined;
@@ -93,7 +93,6 @@ export type PerseusItem = {
93
93
  export type MultiItem = {
94
94
  _multi: any;
95
95
  };
96
- export type PerseusArticle = ReadonlyArray<PerseusRenderer>;
97
96
  export type Version = {
98
97
  major: number;
99
98
  minor: number;
@@ -440,7 +439,7 @@ export type LockedLabelType = {
440
439
  size: "small" | "medium" | "large";
441
440
  };
442
441
  export type PerseusGraphType = PerseusGraphTypeAngle | PerseusGraphTypeCircle | PerseusGraphTypeLinear | PerseusGraphTypeLinearSystem | PerseusGraphTypeNone | PerseusGraphTypePoint | PerseusGraphTypePolygon | PerseusGraphTypeQuadratic | PerseusGraphTypeRay | PerseusGraphTypeSegment | PerseusGraphTypeSinusoid;
443
- export type PerseusGraphTypeCommon = {
442
+ type PerseusGraphTypeCommon = {
444
443
  coord?: Coord;
445
444
  };
446
445
  export type PerseusGraphTypeAngle = {
@@ -553,7 +552,7 @@ export type PerseusMeasurerWidgetOptions = {
553
552
  rulerTicks: number;
554
553
  rulerPixels: number;
555
554
  rulerLength: number;
556
- box: ReadonlyArray<number>;
555
+ box: [number, number];
557
556
  static: boolean;
558
557
  };
559
558
  export type MathFormat = "integer" | "mixed" | "improper" | "proper" | "decimal" | "percent" | "pi";
@@ -649,16 +648,6 @@ export type PerseusRadioChoice = {
649
648
  isNoneOfTheAbove?: boolean;
650
649
  widgets?: PerseusWidgetsMap;
651
650
  };
652
- export type PerseusSequenceWidgetOptions = {
653
- json: ReadonlyArray<PerseusRenderer>;
654
- };
655
- export type PerseusSimulatorWidgetOptions = {
656
- xAxisLabel: string;
657
- yAxisLabel: string;
658
- proportionLabel: string;
659
- proportionOrPercentage: string;
660
- numTrials: number;
661
- };
662
651
  export type PerseusSorterWidgetOptions = {
663
652
  correct: ReadonlyArray<string>;
664
653
  padding: boolean;
@@ -670,34 +659,6 @@ export type PerseusTableWidgetOptions = {
670
659
  columns: number;
671
660
  answers: ReadonlyArray<ReadonlyArray<string>>;
672
661
  };
673
- export type DilationTransformation = {
674
- type: "dilation";
675
- center: Coord;
676
- scale: number;
677
- constraints: {
678
- fixed: boolean;
679
- };
680
- };
681
- export type ReflectionTransformation = {
682
- type: "reflection";
683
- line: [Coord, Coord];
684
- constraints?: {
685
- fixed: boolean;
686
- };
687
- };
688
- export type RotationTransformation = {
689
- type: "rotation";
690
- angleDeg: number;
691
- center: Coord;
692
- constraints: {
693
- fixed: boolean;
694
- };
695
- };
696
- export type TranslationTransformation = {
697
- type: "translation";
698
- vector: Coord;
699
- contraints: Empty;
700
- };
701
662
  export type PerseusInteractionWidgetOptions = {
702
663
  graph: PerseusInteractionGraph;
703
664
  elements: ReadonlyArray<PerseusInteractionElement>;
@@ -887,7 +848,7 @@ export type PerseusPassageRefTargetWidgetOptions = {
887
848
  export type PerseusSimpleMarkdownTesterWidgetOptions = {
888
849
  value: string;
889
850
  };
890
- export type PerseusUnitInputWidgetOptions = {
851
+ type PerseusUnitInputWidgetOptions = {
891
852
  value: string;
892
853
  };
893
854
  export type PerseusWidgetOptions = PerseusCategorizerWidgetOptions | PerseusCSProgramWidgetOptions | PerseusDefinitionWidgetOptions | PerseusDropdownWidgetOptions | PerseusExampleWidgetOptions | PerseusExplanationWidgetOptions | PerseusExpressionWidgetOptions | PerseusGradedGroupSetWidgetOptions | PerseusGradedGroupWidgetOptions | PerseusIFrameWidgetOptions | PerseusImageWidgetOptions | PerseusInputNumberWidgetOptions | PerseusInteractionWidgetOptions | PerseusInteractiveGraphWidgetOptions | PerseusLabelImageWidgetOptions | PerseusMatcherWidgetOptions | PerseusMatrixWidgetOptions | PerseusMeasurerWidgetOptions | PerseusMoleculeRendererWidgetOptions | PerseusNumberLineWidgetOptions | PerseusNumericInputWidgetOptions | PerseusOrdererWidgetOptions | PerseusPassageRefTargetWidgetOptions | PerseusPassageRefWidgetOptions | PerseusPassageWidgetOptions | PerseusPhetSimulationWidgetOptions | PerseusPlotterWidgetOptions | PerseusRadioWidgetOptions | PerseusSimpleMarkdownTesterWidgetOptions | PerseusSorterWidgetOptions | PerseusTableWidgetOptions | PerseusUnitInputWidgetOptions | PerseusVideoWidgetOptions;
@@ -187,7 +187,6 @@ declare class Renderer extends React.Component<Props, State> {
187
187
  _setCurrentFocus: (path: FocusPath) => void;
188
188
  focus: () => boolean | null | undefined;
189
189
  getDOMNodeForPath: (path: FocusPath) => Element | Text | null | undefined;
190
- getGrammarTypeForPath: (path: FocusPath) => string | undefined;
191
190
  getInputPaths: () => ReadonlyArray<FocusPath>;
192
191
  focusPath: (path: FocusPath) => void;
193
192
  blurPath: (path: FocusPath) => void;
@@ -224,7 +223,7 @@ declare class Renderer extends React.Component<Props, State> {
224
223
  * Grades the content.
225
224
  */
226
225
  score(): PerseusScore;
227
- guessAndScore: () => [any, PerseusScore];
226
+ guessAndScore(): [UserInputArray, PerseusScore];
228
227
  examples: () => ReadonlyArray<string> | null | undefined;
229
228
  handletranslationLintErrors: (lintErrors: ReadonlyArray<string>) => void;
230
229
  render(): React.ReactNode;
@@ -69,7 +69,6 @@ export declare class ServerItemRenderer extends React.Component<Props, State> im
69
69
  focusPath(path: FocusPath): void;
70
70
  blurPath(path: FocusPath): void;
71
71
  getDOMNodeForPath(path: FocusPath): Element | Text | null | undefined;
72
- getGrammarTypeForPath(path: FocusPath): string | null | undefined;
73
72
  getInputPaths(): ReadonlyArray<FocusPath>;
74
73
  handleInteractWithWidget: (widgetId: string) => void;
75
74
  focus(): boolean | null | undefined;
@@ -117,7 +116,9 @@ declare const ref: React.ForwardRefExoticComponent<Omit<Pick<SharedRendererProps
117
116
  type: string;
118
117
  id: string;
119
118
  correct?: boolean | undefined;
120
- } & Partial<import("./types").TrackingGradedGroupExtraArguments> & Partial<import("./types").TrackingSequenceExtraArguments>) => void) | undefined;
119
+ } & Partial<import("./types").TrackingGradedGroupExtraArguments> & Partial<{
120
+ visible: number;
121
+ }>) => void) | undefined;
121
122
  customKeypad?: boolean | undefined;
122
123
  nativeKeypadProxy?: ((blur: () => void) => KeypadAPI) | undefined;
123
124
  isMobile?: boolean | undefined;
package/dist/sigfigs.d.ts CHANGED
@@ -1,19 +1,3 @@
1
- /**
2
- * An object tho both scans floating points to
3
- * determine the number of significant figures.
4
- * and can display a floating point using any number
5
- * of significant figures.
6
- *
7
- * @param s A string representation of a floating point.
8
- */
9
- export declare class SignificantFigures {
10
- order: number;
11
- mantissa: string;
12
- positive: boolean;
13
- sigFigs: number;
14
- sigDecs: number;
15
- constructor(s: string);
16
- }
17
1
  /**
18
2
  * Format a floating point for display using the specified
19
3
  * number of significant figures and least significant decimal.
@@ -1,27 +1,12 @@
1
1
  export declare const baseFontFamily = "'Lato', sans-serif";
2
2
  export declare const boldFontFamily = "'Lato-Bold', 'Lato', sans-serif";
3
- export declare const green = "#76A005";
4
3
  export declare const kaGreen = "#71B307";
5
- export declare const blue = "#1C758A";
6
- export declare const gray = "#AAAAAA";
7
- export declare const red = "#FFBABA";
8
- export declare const grayLight = "#AAAAAA";
9
- export declare const grayLighter = "#DDDDDD";
10
- export declare const learnstormBlue = "#4898FC";
11
4
  export declare const white = "#FFFFFF";
12
- export declare const gray98 = "#FAFAFA";
13
5
  export declare const gray97 = "#F6F7F7";
14
- export declare const gray95 = "#F0F1F2";
15
- export declare const gray90 = "#E3E5E6";
16
6
  export declare const gray85 = "#D6D8DA";
17
7
  export declare const gray76 = "#BABEC2";
18
8
  export declare const gray68 = "#888D93";
19
- export declare const gray41 = "#626569";
20
- export declare const gray25 = "#3B3e40";
21
9
  export declare const gray17 = "#21242c";
22
- export declare const black = "#000000";
23
- export declare const warning1 = "#F86700";
24
- export declare const warning3 = "#C75300";
25
10
  export declare const pureSmMin = "568px";
26
11
  export declare const pureMdMin = "768px";
27
12
  export declare const pureLgMin = "1024px";
@@ -31,11 +16,8 @@ export declare const pureSmMax = "767px";
31
16
  export declare const pureMdMax = "1023px";
32
17
  export declare const pureLgMax = "1279px";
33
18
  export declare const tableBackgroundAccent = "#F9F9F9";
34
- export declare const zIndexScratchPad = 1;
35
19
  export declare const zIndexAboveScratchpad = 2;
36
20
  export declare const zIndexInteractiveComponent = 3;
37
- export declare const zIndexCurrentlyDragging = 4;
38
- export declare const zIndexCalculator = 5;
39
21
  export declare const phoneMargin = 16;
40
22
  export declare const negativePhoneMargin = -16;
41
23
  export declare const hintBorderWidth = 4;
package/dist/types.d.ts CHANGED
@@ -47,7 +47,6 @@ export interface Widget {
47
47
  deselectIncorrectSelectedChoices?: () => void;
48
48
  getSerializedState?: () => SerializedState;
49
49
  restoreSerializedState?: (props: any, callback: () => void) => any;
50
- getGrammarTypeForPath?: (path: FocusPath) => string | undefined;
51
50
  blurInputPath?: (path: FocusPath) => void;
52
51
  focusInputPath?: (path: FocusPath) => void;
53
52
  getInputPaths?: () => ReadonlyArray<FocusPath>;
@@ -104,7 +103,6 @@ export type ChangeHandler = (arg1: {
104
103
  graph?: PerseusGraphType;
105
104
  }, callback?: () => unknown | null | undefined, silent?: boolean) => unknown;
106
105
  export type ImageUploader = (file: File, callback: (url: string) => unknown) => unknown;
107
- export type WidgetSize = "normal" | "small" | "mini";
108
106
  export type Path = ReadonlyArray<string>;
109
107
  type StubTagEditorType = any;
110
108
  type TrackInteractionArgs = {
@@ -311,7 +309,6 @@ export type PerseusDependencies = {
311
309
  Log: ILogger;
312
310
  isDevServer: boolean;
313
311
  kaLocale: string;
314
- isMobile: boolean;
315
312
  };
316
313
  /**
317
314
  * The modern iteration of Perseus Depedndencies. These dependencies are
@@ -349,7 +346,7 @@ export type Tracking = "" | "all";
349
346
  export type TrackingGradedGroupExtraArguments = {
350
347
  status: "correct" | "incorrect" | "invalid";
351
348
  };
352
- export type TrackingSequenceExtraArguments = {
349
+ type TrackingSequenceExtraArguments = {
353
350
  visible: number;
354
351
  };
355
352
  export type Alignment = "default" | "block" | "inline-block" | "inline" | "float-left" | "float-right" | "full-width";
@@ -397,7 +394,7 @@ export type WidgetExports<T extends React.ComponentType<any> & Widget = React.Co
397
394
  };
398
395
  }>;
399
396
  export type FilterCriterion = string | ((id: string, widgetInfo: PerseusWidget, widget?: Widget | null | undefined) => boolean);
400
- export type WidgetProps<RenderProps, Rubric, TrackingExtraArgs = Empty> = RenderProps & {
397
+ export type WidgetProps<RenderProps, Rubric = Empty, TrackingExtraArgs = Empty> = RenderProps & {
401
398
  widgetId: string;
402
399
  alignment: string | null | undefined;
403
400
  static: boolean | null | undefined;
@@ -408,7 +405,8 @@ export type WidgetProps<RenderProps, Rubric, TrackingExtraArgs = Empty> = Render
408
405
  onFocus: (blurPath: FocusPath) => void;
409
406
  onBlur: (blurPath: FocusPath) => void;
410
407
  findWidgets: (criterion: FilterCriterion) => ReadonlyArray<Widget>;
411
- reviewModeRubric: Rubric;
408
+ reviewModeRubric?: Rubric | null | undefined;
409
+ reviewMode: boolean;
412
410
  onChange: ChangeHandler;
413
411
  trackInteraction: (extraData?: TrackingExtraArgs) => void;
414
412
  isLastUsedWidget: boolean;
@@ -26,5 +26,4 @@ declare const KhanMath: {
26
26
  readonly toNumericString: (number: number, format?: MathFormat) => string;
27
27
  };
28
28
  export declare function sum(array: number[]): number;
29
- export declare function add(a: number, b: number): number;
30
29
  export default KhanMath;
package/dist/util.d.ts CHANGED
@@ -2,6 +2,7 @@ import * as GraphieUtil from "./util.graphie";
2
2
  import type { Range } from "./perseus-types";
3
3
  import type { PerseusStrings } from "./strings";
4
4
  import type { PerseusScore } from "./types";
5
+ import type { UserInputArray } from "./validation.types";
5
6
  import type { KEScore } from "@khanacademy/perseus-core";
6
7
  import type * as React from "react";
7
8
  type WordPosition = {
@@ -51,7 +52,7 @@ declare function flattenScores(widgetScoreMap: {
51
52
  [widgetId: string]: PerseusScore;
52
53
  }): PerseusScore;
53
54
  export declare function isCorrect(score: PerseusScore): boolean;
54
- declare function keScoreFromPerseusScore(score: PerseusScore, guess: any, state: any): KEScore;
55
+ declare function keScoreFromPerseusScore(score: PerseusScore, guess: UserInputArray | [UserInputArray, []], state: any): KEScore;
55
56
  /**
56
57
  * Return the first valid interpretation of 'text' as a number, in the form
57
58
  * {value: 2.3, exact: true}.
@@ -1,4 +1,4 @@
1
- import type { GrapherAnswerTypes, PerseusDefinitionWidgetOptions, PerseusDropdownChoice, PerseusExplanationWidgetOptions, PerseusExpressionAnswerForm, PerseusGradedGroupSetWidgetOptions, PerseusGradedGroupWidgetOptions, PerseusGraphType, PerseusGroupWidgetOptions, PerseusIFrameWidgetOptions, PerseusImageWidgetOptions, PerseusInputNumberWidgetOptions, PerseusInteractionWidgetOptions, PerseusLabelImageWidgetOptions, PerseusMatcherWidgetOptions, PerseusMatrixWidgetOptions, PerseusNumberLineWidgetOptions, PerseusNumericInputWidgetOptions, PerseusOrdererWidgetOptions, PerseusPassageRefWidgetOptions, PerseusPassageWidgetOptions, PerseusPlotterWidgetOptions, PerseusRadioWidgetOptions, PerseusSorterWidgetOptions, PerseusTableWidgetOptions, PerseusVideoWidgetOptions } from "./perseus-types";
1
+ import type { GrapherAnswerTypes, PerseusDropdownChoice, PerseusExpressionAnswerForm, PerseusGradedGroupSetWidgetOptions, PerseusGradedGroupWidgetOptions, PerseusGraphType, PerseusGroupWidgetOptions, PerseusIFrameWidgetOptions, PerseusMatcherWidgetOptions, PerseusMatrixWidgetOptions, PerseusNumberLineWidgetOptions, PerseusNumericInputWidgetOptions, PerseusOrdererWidgetOptions, PerseusPlotterWidgetOptions, PerseusRadioWidgetOptions, PerseusSorterWidgetOptions, PerseusTableWidgetOptions } from "./perseus-types";
2
2
  import type { InteractiveMarkerType } from "./widgets/label-image/types";
3
3
  import type { Relationship } from "./widgets/number-line/number-line";
4
4
  export type UserInputStatus = "correct" | "incorrect" | "incomplete";
@@ -13,14 +13,12 @@ export type PerseusCSProgramUserInput = {
13
13
  status: UserInputStatus;
14
14
  message: string | null;
15
15
  };
16
- export type PerseusDefinitionRubric = PerseusDefinitionWidgetOptions;
17
16
  export type PerseusDropdownRubric = {
18
17
  choices: ReadonlyArray<PerseusDropdownChoice>;
19
18
  };
20
19
  export type PerseusDropdownUserInput = {
21
20
  value: number;
22
21
  };
23
- export type PerseusExplanationRubric = PerseusExplanationWidgetOptions;
24
22
  export type PerseusExpressionRubric = {
25
23
  answerForms: ReadonlyArray<PerseusExpressionAnswerForm>;
26
24
  functions: ReadonlyArray<string>;
@@ -38,18 +36,22 @@ export type PerseusIFrameUserInput = {
38
36
  status: UserInputStatus;
39
37
  message: string | null;
40
38
  };
41
- export type PerseusImageRubric = PerseusImageWidgetOptions;
42
- export type PerseusInputNumberRubric = PerseusInputNumberWidgetOptions;
39
+ export type PerseusInputNumberRubric = {
40
+ answerType?: "number" | "decimal" | "integer" | "rational" | "improper" | "mixed" | "percent" | "pi";
41
+ inexact?: boolean;
42
+ maxError?: number | string;
43
+ simplify: "required" | "optional" | "enforced";
44
+ value: string | number;
45
+ };
43
46
  export type PerseusInputNumberUserInput = {
44
47
  currentValue: string;
45
48
  };
46
- export type PerseusInteractionRubric = PerseusInteractionWidgetOptions;
47
49
  export type PerseusInteractiveGraphRubric = {
48
50
  correct: PerseusGraphType;
49
51
  graph: PerseusGraphType;
50
52
  };
51
53
  export type PerseusInteractiveGraphUserInput = PerseusGraphType;
52
- export type PerseusLabelImageRubric = PerseusLabelImageWidgetOptions;
54
+ export type PerseusLabelImageRubric = Empty;
53
55
  export type PerseusLabelImageUserInput = {
54
56
  markers: ReadonlyArray<InteractiveMarkerType>;
55
57
  };
@@ -80,8 +82,6 @@ export type PerseusOrdererRubric = PerseusOrdererWidgetOptions;
80
82
  export type PerseusOrdererUserInput = {
81
83
  current: ReadonlyArray<string>;
82
84
  };
83
- export type PerseusPassageRubric = PerseusPassageWidgetOptions;
84
- export type PerseusPassageRefRubric = PerseusPassageRefWidgetOptions;
85
85
  export type PerseusPlotterRubric = PerseusPlotterWidgetOptions;
86
86
  export type PerseusPlotterUserInput = ReadonlyArray<number>;
87
87
  export type PerseusRadioRubric = PerseusRadioWidgetOptions;
@@ -99,8 +99,7 @@ export type PerseusSorterUserInput = {
99
99
  };
100
100
  export type PerseusTableRubric = PerseusTableWidgetOptions;
101
101
  export type PerseusTableUserInput = ReadonlyArray<ReadonlyArray<string>>;
102
- export type PerseusVideoRubric = PerseusVideoWidgetOptions;
103
- 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;
102
+ export type Rubric = PerseusCategorizerRubric | PerseusCSProgramRubric | PerseusDropdownRubric | PerseusExpressionRubric | PerseusGroupRubric | PerseusGradedGroupRubric | PerseusGradedGroupSetRubric | PerseusGrapherRubric | PerseusIFrameRubric | PerseusInputNumberRubric | PerseusInteractiveGraphRubric | PerseusLabelImageRubric | PerseusMatcherRubric | PerseusMatrixRubric | PerseusNumberLineRubric | PerseusNumericInputRubric | PerseusOrdererRubric | PerseusPlotterRubric | PerseusRadioRubric | PerseusSorterRubric | PerseusTableRubric;
104
103
  export type UserInput = PerseusCategorizerUserInput | PerseusCSProgramUserInput | PerseusDropdownUserInput | PerseusExpressionUserInput | PerseusGrapherUserInput | PerseusIFrameUserInput | PerseusInputNumberUserInput | PerseusInteractiveGraphUserInput | PerseusLabelImageUserInput | PerseusMatcherUserInput | PerseusMatrixUserInput | PerseusNumberLineUserInput | PerseusNumericInputUserInput | PerseusOrdererUserInput | PerseusPlotterUserInput | PerseusRadioUserInput | PerseusSorterUserInput | PerseusTableUserInput;
105
104
  export type UserInputMap = {
106
105
  [widgetId: string]: UserInput | UserInputMap;
@@ -3,7 +3,7 @@ import type { PerseusScore } from "../../types";
3
3
  * Several widgets don't have "right"/"wrong" validation logic,
4
4
  * so this just says to move on past those widgets
5
5
  *
6
- * TODO(LEMS-2396) widgets that use this probably shouldn't have any
6
+ * TODO(LEMS-2543) widgets that use this probably shouldn't have any
7
7
  * validation logic and the thing validating an exercise
8
8
  * should just know to skip these
9
9
  */
@@ -2,9 +2,8 @@ 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 { PerseusDefinitionRubric } from "../../validation.types";
6
5
  type RenderProps = PerseusDefinitionWidgetOptions;
7
- type DefinitionProps = WidgetProps<RenderProps, PerseusDefinitionRubric> & {
6
+ type DefinitionProps = WidgetProps<RenderProps> & {
8
7
  widgets: PerseusRenderer["widgets"];
9
8
  };
10
9
  type DefaultProps = {
@@ -2,9 +2,8 @@ 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 { PerseusExplanationRubric } from "../../validation.types";
6
5
  type RenderProps = PerseusExplanationWidgetOptions;
7
- type Props = WidgetProps<RenderProps, PerseusExplanationRubric>;
6
+ type Props = WidgetProps<RenderProps>;
8
7
  type DefaultProps = {
9
8
  showPrompt: Props["showPrompt"];
10
9
  hidePrompt: Props["hidePrompt"];
@@ -70,7 +70,6 @@ export declare class Expression extends React.Component<Props, ExpressionState>
70
70
  blurInputPath(inputPath: InputPath): void;
71
71
  insert(keyPressed: Key): void;
72
72
  getInputPaths: () => ReadonlyArray<ReadonlyArray<any>>;
73
- getGrammarTypeForPath(inputPath: FocusPath): string;
74
73
  setInputValue(path: FocusPath, newValue: string, cb: () => void): void;
75
74
  render(): React.JSX.Element;
76
75
  }
@@ -85,7 +84,7 @@ export declare class Expression extends React.Component<Props, ExpressionState>
85
84
  * to be included as keys on the keypad. These are scraped from the answer
86
85
  * forms.
87
86
  */
88
- export declare const keypadConfigurationForProps: (widgetOptions: PerseusExpressionWidgetOptions) => KeypadConfiguration;
87
+ declare const keypadConfigurationForProps: (widgetOptions: PerseusExpressionWidgetOptions) => KeypadConfiguration;
89
88
  declare const _default: Readonly<{
90
89
  name: string;
91
90
  displayName: string;
@@ -116,7 +115,9 @@ declare const _default: Readonly<{
116
115
  type: string;
117
116
  id: string;
118
117
  correct?: boolean | undefined;
119
- } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<import("../../types").TrackingSequenceExtraArguments>) => void) | undefined;
118
+ } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
119
+ visible: number;
120
+ }>) => void) | undefined;
120
121
  customKeypad?: boolean | undefined;
121
122
  nativeKeypadProxy?: ((blur: () => void) => import("@khanacademy/math-input").KeypadAPI) | undefined;
122
123
  isMobile?: boolean | undefined;
@@ -173,7 +174,8 @@ declare const _default: Readonly<{
173
174
  onFocus: (blurPath: FocusPath) => void;
174
175
  onBlur: (blurPath: FocusPath) => void;
175
176
  findWidgets: (criterion: import("../../types").FilterCriterion) => readonly Widget[];
176
- reviewModeRubric: PerseusExpressionRubric;
177
+ reviewModeRubric?: PerseusExpressionRubric | null | undefined;
178
+ reviewMode: boolean;
177
179
  onChange: import("../../types").ChangeHandler;
178
180
  trackInteraction: (extraData?: Empty | undefined) => void;
179
181
  isLastUsedWidget: boolean;
@@ -202,7 +204,9 @@ declare const _default: Readonly<{
202
204
  type: string;
203
205
  id: string;
204
206
  correct?: boolean | undefined;
205
- } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<import("../../types").TrackingSequenceExtraArguments>) => void) | undefined;
207
+ } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
208
+ visible: number;
209
+ }>) => void) | undefined;
206
210
  customKeypad?: boolean | undefined;
207
211
  nativeKeypadProxy?: ((blur: () => void) => import("@khanacademy/math-input").KeypadAPI) | undefined;
208
212
  isMobile?: boolean | undefined;
@@ -263,7 +267,7 @@ declare const _default: Readonly<{
263
267
  visibleLabel: string | undefined;
264
268
  ariaLabel: string | undefined;
265
269
  value: string;
266
- }, "ariaLabel" | "static" | "onChange" | "keypadElement" | "containerSizeClass" | "widgetId" | "problemNum" | "questionCompleted" | "findWidgets" | "trackInteraction" | "analytics" | "alignment" | "buttonsVisible" | "visibleLabel" | "keypadConfiguration" | "reviewModeRubric" | "isLastUsedWidget"> & {
270
+ }, "ariaLabel" | "static" | "onChange" | "keypadElement" | "containerSizeClass" | "widgetId" | "problemNum" | "questionCompleted" | "findWidgets" | "trackInteraction" | "analytics" | "reviewMode" | "alignment" | "buttonsVisible" | "visibleLabel" | "keypadConfiguration" | "reviewModeRubric" | "isLastUsedWidget"> & {
267
271
  value?: string | undefined;
268
272
  onFocus?: ((blurPath: FocusPath) => void) | undefined;
269
273
  onBlur?: ((blurPath: FocusPath) => void) | undefined;
@@ -289,7 +293,9 @@ declare const _default: Readonly<{
289
293
  type: string;
290
294
  id: string;
291
295
  correct?: boolean | undefined;
292
- } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<import("../../types").TrackingSequenceExtraArguments>) => void) | undefined;
296
+ } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
297
+ visible: number;
298
+ }>) => void) | undefined;
293
299
  customKeypad?: boolean | undefined;
294
300
  nativeKeypadProxy?: ((blur: () => void) => import("@khanacademy/math-input").KeypadAPI) | undefined;
295
301
  isMobile?: boolean | undefined;
@@ -373,7 +379,9 @@ declare const _default: Readonly<{
373
379
  type: string;
374
380
  id: string;
375
381
  correct?: boolean | undefined;
376
- } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<import("../../types").TrackingSequenceExtraArguments>) => void) | undefined;
382
+ } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
383
+ visible: number;
384
+ }>) => void) | undefined;
377
385
  customKeypad?: boolean | undefined;
378
386
  nativeKeypadProxy?: ((blur: () => void) => import("@khanacademy/math-input").KeypadAPI) | undefined;
379
387
  isMobile?: boolean | undefined;
@@ -430,7 +438,8 @@ declare const _default: Readonly<{
430
438
  onFocus: (blurPath: FocusPath) => void;
431
439
  onBlur: (blurPath: FocusPath) => void;
432
440
  findWidgets: (criterion: import("../../types").FilterCriterion) => readonly Widget[];
433
- reviewModeRubric: PerseusExpressionRubric;
441
+ reviewModeRubric?: PerseusExpressionRubric | null | undefined;
442
+ reviewMode: boolean;
434
443
  onChange: import("../../types").ChangeHandler;
435
444
  trackInteraction: (extraData?: Empty | undefined) => void;
436
445
  isLastUsedWidget: boolean;
@@ -459,7 +468,9 @@ declare const _default: Readonly<{
459
468
  type: string;
460
469
  id: string;
461
470
  correct?: boolean | undefined;
462
- } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<import("../../types").TrackingSequenceExtraArguments>) => void) | undefined;
471
+ } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
472
+ visible: number;
473
+ }>) => void) | undefined;
463
474
  customKeypad?: boolean | undefined;
464
475
  nativeKeypadProxy?: ((blur: () => void) => import("@khanacademy/math-input").KeypadAPI) | undefined;
465
476
  isMobile?: boolean | undefined;
@@ -520,7 +531,7 @@ declare const _default: Readonly<{
520
531
  visibleLabel: string | undefined;
521
532
  ariaLabel: string | undefined;
522
533
  value: string;
523
- }, "ariaLabel" | "static" | "onChange" | "keypadElement" | "containerSizeClass" | "widgetId" | "problemNum" | "questionCompleted" | "findWidgets" | "trackInteraction" | "analytics" | "alignment" | "buttonsVisible" | "visibleLabel" | "keypadConfiguration" | "reviewModeRubric" | "isLastUsedWidget"> & {
534
+ }, "ariaLabel" | "static" | "onChange" | "keypadElement" | "containerSizeClass" | "widgetId" | "problemNum" | "questionCompleted" | "findWidgets" | "trackInteraction" | "analytics" | "reviewMode" | "alignment" | "buttonsVisible" | "visibleLabel" | "keypadConfiguration" | "reviewModeRubric" | "isLastUsedWidget"> & {
524
535
  value?: string | undefined;
525
536
  onFocus?: ((blurPath: FocusPath) => void) | undefined;
526
537
  onBlur?: ((blurPath: FocusPath) => void) | undefined;
@@ -546,7 +557,9 @@ declare const _default: Readonly<{
546
557
  type: string;
547
558
  id: string;
548
559
  correct?: boolean | undefined;
549
- } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<import("../../types").TrackingSequenceExtraArguments>) => void) | undefined;
560
+ } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
561
+ visible: number;
562
+ }>) => void) | undefined;
550
563
  customKeypad?: boolean | undefined;
551
564
  nativeKeypadProxy?: ((blur: () => void) => import("@khanacademy/math-input").KeypadAPI) | undefined;
552
565
  isMobile?: boolean | undefined;
@@ -2,9 +2,8 @@ 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 { PerseusImageRubric } from "../../validation.types";
6
5
  type RenderProps = PerseusImageWidgetOptions;
7
- type ExternalProps = WidgetProps<RenderProps, PerseusImageRubric>;
6
+ type ExternalProps = WidgetProps<RenderProps>;
8
7
  type Props = ExternalProps & {
9
8
  alignment: NonNullable<ExternalProps["alignment"]>;
10
9
  title: NonNullable<ExternalProps["title"]>;
@@ -1,5 +1,5 @@
1
1
  import type { PerseusStrings } from "../../strings";
2
- import type { PerseusInputNumberRubric } from "../../validation.types";
2
+ import type { PerseusInputNumberRubric, PerseusInputNumberUserInput } from "../../validation.types";
3
3
  import type { PerseusScore } from "@khanacademy/perseus";
4
4
  export declare const answerTypes: {
5
5
  readonly number: {
@@ -35,7 +35,5 @@ export declare const answerTypes: {
35
35
  readonly forms: "pi";
36
36
  };
37
37
  };
38
- declare function inputNumberValidator(state: {
39
- currentValue: string;
40
- }, rubric: PerseusInputNumberRubric, strings: PerseusStrings): PerseusScore;
38
+ declare function inputNumberValidator(userInput: PerseusInputNumberUserInput, rubric: PerseusInputNumberRubric, strings: PerseusStrings): PerseusScore;
41
39
  export default inputNumberValidator;
@@ -45,7 +45,6 @@ declare class InputNumber extends React.Component<Props> implements Widget {
45
45
  focusInputPath: (arg1: Path) => void;
46
46
  blurInputPath: (arg1: Path) => void;
47
47
  getInputPaths: () => ReadonlyArray<Path>;
48
- getGrammarTypeForPath: (arg1: Path) => string;
49
48
  setInputValue: (arg1: Path, arg2: string, arg3: () => void) => void;
50
49
  getUserInput(): PerseusInputNumberUserInput;
51
50
  examples: () => ReadonlyArray<string>;
@@ -2,9 +2,8 @@ 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 { PerseusInteractionRubric } from "../../validation.types";
6
5
  type RenderProps = PerseusInteractionWidgetOptions;
7
- type Props = WidgetProps<RenderProps, PerseusInteractionRubric>;
6
+ type Props = WidgetProps<RenderProps>;
8
7
  type DefaultProps = {
9
8
  graph: Props["graph"];
10
9
  elements: Props["elements"];
@@ -12,16 +12,5 @@ type Props = {
12
12
  };
13
13
  };
14
14
  export declare const MovableLine: (props: Props) => React.JSX.Element;
15
- type LineProps = {
16
- start: vec.Vector2;
17
- end: vec.Vector2;
18
- onMove: (delta: vec.Vector2) => unknown;
19
- stroke?: string | undefined;
20
- extend?: undefined | {
21
- start: boolean;
22
- end: boolean;
23
- };
24
- };
25
- export declare const Line: (props: LineProps) => React.JSX.Element;
26
15
  export declare function trimRange(range: [Interval, Interval], graphDimensionsInPixels: vec.Vector2): [Interval, Interval];
27
16
  export {};
@@ -1,7 +1,5 @@
1
1
  import * as React from "react";
2
2
  import type { PointGraphState, MafsGraphProps } from "../types";
3
3
  type PointGraphProps = MafsGraphProps<PointGraphState>;
4
- export declare function LimitedPointGraph(props: PointGraphProps): React.JSX.Element;
5
- export declare function UnlimitedPointGraph(props: PointGraphProps): React.JSX.Element;
6
4
  export declare function PointGraph(props: PointGraphProps): React.JSX.Element;
7
5
  export {};
@@ -6,4 +6,3 @@ export declare function pointToPixel(point: vec.Vector2, graphState: GraphDimens
6
6
  export declare const useTransformVectorsToPixels: (...vectors: vec.Vector2[]) => vec.Vector2[];
7
7
  export declare const useTransformDimensionsToPixels: (...dimens: vec.Vector2[]) => vec.Vector2[];
8
8
  export declare function pixelsToVectors(pixels: vec.Vector2[], graphState: GraphDimensions): vec.Vector2[];
9
- export declare const useTransformPixelsToVectors: (...pixels: vec.Vector2[]) => vec.Vector2[];
@@ -1,3 +1,4 @@
1
1
  export declare const mafsSupportedGraphTypes: readonly ["angle", "segment", "linear", "linear-system", "ray", "polygon", "point", "circle", "quadratic", "sinusoid", "unlimited-point", "unlimited-polygon"];
2
- export type MafsSupportedGraphType = (typeof mafsSupportedGraphTypes)[number];
2
+ type MafsSupportedGraphType = (typeof mafsSupportedGraphTypes)[number];
3
3
  export declare const trueForAllMafsSupportedGraphTypes: Record<MafsSupportedGraphType, true>;
4
+ export {};
@@ -1,5 +1,3 @@
1
- import { vec } from "mafs";
2
1
  import * as React from "react";
3
2
  import "./protractor.css";
4
- export declare const centerToRotationHandle: vec.Vector2;
5
3
  export declare function Protractor(): React.JSX.Element;
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { SingleSelect } from "@khanacademy/wonder-blocks-dropdown";
5
5
  import * as React from "react";
6
- export type AnswerType = {
6
+ type AnswerType = {
7
7
  content: string;
8
8
  checked: boolean;
9
9
  };
@@ -6,5 +6,5 @@ type InteractiveMarkerScore = {
6
6
  isCorrect: boolean;
7
7
  };
8
8
  export declare function scoreMarker(marker: InteractiveMarkerType): InteractiveMarkerScore;
9
- declare function labelImageValidator(state: PerseusLabelImageUserInput, rubric?: PerseusLabelImageRubric): PerseusScore;
9
+ declare function labelImageValidator(userInput: PerseusLabelImageUserInput, rubric?: PerseusLabelImageRubric): PerseusScore;
10
10
  export default labelImageValidator;