@khanacademy/perseus 5.0.0 → 6.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 (113) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/dist/components/fixed-to-responsive.d.ts +27 -1
  3. package/dist/components/fixed-to-responsive.js.flow +27 -1
  4. package/dist/components/graph.d.ts +42 -26
  5. package/dist/components/graph.js.flow +42 -28
  6. package/dist/components/graphie.d.ts +34 -22
  7. package/dist/components/graphie.js.flow +37 -24
  8. package/dist/components/hud.d.ts +8 -14
  9. package/dist/components/hud.js.flow +7 -14
  10. package/dist/components/inline-icon.d.ts +9 -19
  11. package/dist/components/inline-icon.js.flow +26 -13
  12. package/dist/components/lint.d.ts +41 -13
  13. package/dist/components/lint.js.flow +42 -13
  14. package/dist/components/math-output.d.ts +15 -11
  15. package/dist/components/math-output.js.flow +15 -11
  16. package/dist/components/sortable.d.ts +17 -9
  17. package/dist/components/sortable.js.flow +22 -9
  18. package/dist/components/svg-image.d.ts +5 -3
  19. package/dist/components/svg-image.js.flow +5 -3
  20. package/dist/components/tooltip.d.ts +45 -4
  21. package/dist/components/tooltip.js.flow +44 -31
  22. package/dist/es/index.css +0 -3
  23. package/dist/es/index.js +477 -648
  24. package/dist/es/index.js.map +1 -1
  25. package/dist/index.css +0 -3
  26. package/dist/index.js +481 -645
  27. package/dist/index.js.map +1 -1
  28. package/dist/perseus-types.d.ts +11 -9
  29. package/dist/perseus-types.js.flow +11 -9
  30. package/dist/renderer.d.ts +2 -2
  31. package/dist/renderer.js.flow +1 -3
  32. package/dist/styles/shared.d.ts +0 -1
  33. package/dist/styles/shared.js.flow +0 -1
  34. package/dist/types.d.ts +0 -10
  35. package/dist/types.js.flow +0 -13
  36. package/dist/util/a11y.d.ts +0 -1
  37. package/dist/util/a11y.js.flow +0 -1
  38. package/dist/util/interactive.d.ts +2 -0
  39. package/dist/util/interactive.js.flow +2 -0
  40. package/dist/util.d.ts +3 -3
  41. package/dist/util.js.flow +4 -3
  42. package/dist/widgets/grapher.d.ts +1 -1
  43. package/dist/widgets/grapher.js.flow +12 -3
  44. package/dist/widgets/matcher.d.ts +7 -3
  45. package/dist/widgets/matcher.js.flow +7 -3
  46. package/dist/widgets/number-line.d.ts +1 -1
  47. package/dist/widgets/number-line.js.flow +1 -1
  48. package/package.json +2 -2
  49. package/src/__tests__/__snapshots__/item-renderer.test.tsx.snap +151 -159
  50. package/src/__tests__/__snapshots__/renderer.test.tsx.snap +358 -394
  51. package/src/__tests__/__snapshots__/server-item-renderer.test.tsx.snap +169 -189
  52. package/src/components/__stories__/lint.stories.tsx +56 -21
  53. package/src/components/__stories__/sortable.stories.tsx +5 -5
  54. package/src/components/__stories__/tooltip.stories.tsx +52 -0
  55. package/src/components/__tests__/__snapshots__/sortable.test.tsx.snap +114 -30
  56. package/src/components/__tests__/__snapshots__/sorter.test.tsx.snap +172 -204
  57. package/src/components/__tests__/sortable.test.tsx +54 -16
  58. package/src/components/__tests__/sorter.test.tsx +12 -9
  59. package/src/components/fixed-to-responsive.tsx +43 -38
  60. package/src/components/graph.tsx +95 -81
  61. package/src/components/graphie.tsx +62 -32
  62. package/src/components/hud.tsx +104 -115
  63. package/src/components/inline-icon.tsx +15 -32
  64. package/src/components/input-with-examples.tsx +4 -4
  65. package/src/components/lint.tsx +47 -41
  66. package/src/components/math-output.tsx +17 -11
  67. package/src/components/simple-keypad-input.tsx +2 -2
  68. package/src/components/sortable.tsx +134 -94
  69. package/src/components/svg-image.tsx +10 -11
  70. package/src/components/tooltip.tsx +189 -171
  71. package/src/interactive2/types.ts +2 -2
  72. package/src/multi-items/__tests__/__snapshots__/multi-renderer.test.tsx.snap +708 -764
  73. package/src/perseus-types.ts +13 -9
  74. package/src/renderer.tsx +11 -22
  75. package/src/types.ts +0 -18
  76. package/src/util/interactive.ts +18 -5
  77. package/src/util/tex.ts +13 -77
  78. package/src/util.ts +3 -4
  79. package/src/widgets/__tests__/__snapshots__/categorizer.test.ts.snap +717 -773
  80. package/src/widgets/__tests__/__snapshots__/cs-program.test.ts.snap +28 -36
  81. package/src/widgets/__tests__/__snapshots__/definition.test.ts.snap +52 -60
  82. package/src/widgets/__tests__/__snapshots__/dropdown.test.ts.snap +100 -108
  83. package/src/widgets/__tests__/__snapshots__/explanation.test.ts.snap +212 -260
  84. package/src/widgets/__tests__/__snapshots__/graded-group-set-jipt.test.ts.snap +613 -641
  85. package/src/widgets/__tests__/__snapshots__/graded-group-set.test.ts.snap +249 -261
  86. package/src/widgets/__tests__/__snapshots__/graded-group.test.ts.snap +671 -735
  87. package/src/widgets/__tests__/__snapshots__/grapher.test.ts.snap +2676 -2684
  88. package/src/widgets/__tests__/__snapshots__/group.test.tsx.snap +938 -1002
  89. package/src/widgets/__tests__/__snapshots__/iframe.test.ts.snap +28 -36
  90. package/src/widgets/__tests__/__snapshots__/image.test.ts.snap +227 -255
  91. package/src/widgets/__tests__/__snapshots__/input-number.test.ts.snap +353 -357
  92. package/src/widgets/__tests__/__snapshots__/interaction.test.ts.snap +255 -259
  93. package/src/widgets/__tests__/__snapshots__/interactive-graph.test.ts.snap +2401 -2433
  94. package/src/widgets/__tests__/__snapshots__/matcher.test.tsx.snap +600 -756
  95. package/src/widgets/__tests__/__snapshots__/matrix.test.ts.snap +420 -428
  96. package/src/widgets/__tests__/__snapshots__/number-line.test.ts.snap +762 -770
  97. package/src/widgets/__tests__/__snapshots__/numeric-input.test.ts.snap +373 -393
  98. package/src/widgets/__tests__/__snapshots__/orderer.test.ts.snap +116 -148
  99. package/src/widgets/__tests__/__snapshots__/passage-ref.test.ts.snap +289 -301
  100. package/src/widgets/__tests__/__snapshots__/passage.test.tsx.snap +1679 -1711
  101. package/src/widgets/__tests__/__snapshots__/radio.test.ts.snap +2692 -2960
  102. package/src/widgets/__tests__/__snapshots__/video.test.ts.snap +90 -98
  103. package/src/widgets/__tests__/matcher.test.tsx +33 -9
  104. package/src/widgets/expression.tsx +9 -6
  105. package/src/widgets/grapher.tsx +3 -3
  106. package/src/widgets/image.tsx +2 -2
  107. package/src/widgets/interactive-graph.tsx +5 -5
  108. package/src/widgets/matcher.tsx +43 -24
  109. package/src/widgets/number-line.tsx +1 -1
  110. package/src/widgets/simulator.tsx +4 -6
  111. package/{tsconfig.json → tsconfig-build.json} +6 -6
  112. package/tsconfig-build.tsbuildinfo +1 -0
  113. package/tsconfig.tsbuildinfo +0 -1
@@ -1,4 +1,6 @@
1
1
  import type { Coord } from "./interactive2/types";
2
+ export type Range = [number, number];
3
+ export type Size = [number, number];
2
4
  type Empty = Record<string, never>;
3
5
  export type PerseusItem = {
4
6
  question: PerseusRenderer;
@@ -87,8 +89,8 @@ export type VideoWidget = Widget<'video', PerseusVideoWidgetOptions>;
87
89
  export type PerseusWidget = CategorizerWidget | CSProgramWidget | DefinitionWidget | DropdownWidget | ExampleGraphieWidget | ExampleWidget | ExplanationWidget | ExpressionWidget | GradedGroupSetWidget | GradedGroupWidget | GrapherWidget | GroupWidget | IFrameWidget | ImageWidget | InputNumberWidget | InteractionWidget | InteractiveGraphWidget | LabelImageWidget | LightsPuzzleWidget | MatcherWidget | MatrixWidget | MeasurerWidget | MoleculeRendererWidget | NumberLineWidget | NumericInputWidget | OrdererWidget | PassageRefWidget | PassageWidget | PlotterWidget | RadioWidget | ReactionDiagramWidget | RefTargetWidget | SequenceWidget | SimpleMarkdownTesterWidget | SimulatorWidget | SorterWidget | TableWidget | TransformerWidget | UnitInputWidget | VideoWidget;
88
90
  export type PerseusImageBackground = {
89
91
  url: string | null | undefined;
90
- width: number;
91
- height: number;
92
+ width?: number;
93
+ height?: number;
92
94
  top?: number;
93
95
  left?: number;
94
96
  scale?: number | string;
@@ -227,8 +229,8 @@ export type PerseusImageWidgetOptions = {
227
229
  backgroundImage: PerseusImageBackground;
228
230
  static?: boolean;
229
231
  labels?: ReadonlyArray<PerseusImageLabel>;
230
- range?: ReadonlyArray<ReadonlyArray<number>>;
231
- box?: ReadonlyArray<number>;
232
+ range?: [Range, Range];
233
+ box?: Size;
232
234
  };
233
235
  export type PerseusImageLabel = {
234
236
  content: string;
@@ -606,19 +608,19 @@ export type PerseusInteractionWidgetOptions = {
606
608
  };
607
609
  export type PerseusInteractionGraph = {
608
610
  editableSettings?: ReadonlyArray<"canvas" | "graph">;
609
- box: ReadonlyArray<number>;
611
+ box: Size;
610
612
  labels: ReadonlyArray<string>;
611
- range: ReadonlyArray<ReadonlyArray<number>>;
612
- gridStep: ReadonlyArray<number>;
613
+ range: [Range, Range];
614
+ gridStep: Readonly<[number, number]>;
613
615
  markings: string;
614
- snapStep?: ReadonlyArray<number>;
616
+ snapStep?: Readonly<[number, number]>;
615
617
  valid?: boolean | string;
616
618
  backgroundImage?: PerseusImageBackground;
617
619
  showProtractor?: boolean;
618
620
  showRuler?: boolean;
619
621
  rulerLabel?: string;
620
622
  rulerTicks?: number;
621
- tickStep: ReadonlyArray<number>;
623
+ tickStep: Readonly<[number, number]>;
622
624
  };
623
625
  export type PerseusInteractionElement = {
624
626
  type: "function";
@@ -5,6 +5,8 @@
5
5
  * @flow
6
6
  */
7
7
  import type { Coord } from "./interactive2/types";
8
+ export type Range = [number, number];
9
+ export type Size = [number, number];
8
10
  declare type Empty = { [key: string]: empty };
9
11
  export type PerseusItem = {|
10
12
  question: PerseusRenderer,
@@ -205,8 +207,8 @@ export type PerseusWidget =
205
207
  | VideoWidget;
206
208
  export type PerseusImageBackground = {|
207
209
  url: string | null | void,
208
- width: number,
209
- height: number,
210
+ width?: number,
211
+ height?: number,
210
212
  top?: number,
211
213
  left?: number,
212
214
  scale?: number | string,
@@ -354,8 +356,8 @@ export type PerseusImageWidgetOptions = {|
354
356
  backgroundImage: PerseusImageBackground,
355
357
  static?: boolean,
356
358
  labels?: $ReadOnlyArray<PerseusImageLabel>,
357
- range?: $ReadOnlyArray<$ReadOnlyArray<number>>,
358
- box?: $ReadOnlyArray<number>,
359
+ range?: [Range, Range],
360
+ box?: Size,
359
361
  |};
360
362
  export type PerseusImageLabel = {|
361
363
  content: string,
@@ -809,19 +811,19 @@ export type PerseusInteractionWidgetOptions = {|
809
811
  |};
810
812
  export type PerseusInteractionGraph = {|
811
813
  editableSettings?: $ReadOnlyArray<"canvas" | "graph">,
812
- box: $ReadOnlyArray<number>,
814
+ box: Size,
813
815
  labels: $ReadOnlyArray<string>,
814
- range: $ReadOnlyArray<$ReadOnlyArray<number>>,
815
- gridStep: $ReadOnlyArray<number>,
816
+ range: [Range, Range],
817
+ gridStep: $ReadOnly<[number, number]>,
816
818
  markings: string,
817
- snapStep?: $ReadOnlyArray<number>,
819
+ snapStep?: $ReadOnly<[number, number]>,
818
820
  valid?: boolean | string,
819
821
  backgroundImage?: PerseusImageBackground,
820
822
  showProtractor?: boolean,
821
823
  showRuler?: boolean,
822
824
  rulerLabel?: string,
823
825
  rulerTicks?: number,
824
- tickStep: $ReadOnlyArray<number>,
826
+ tickStep: $ReadOnly<[number, number]>,
825
827
  |};
826
828
  export type PerseusInteractionElement =
827
829
  | {|
@@ -2,7 +2,7 @@ import * as React from "react";
2
2
  import InteractionTracker from "./interaction-tracker";
3
3
  import TranslationLinter from "./translation-linter";
4
4
  import type { PerseusRenderer, PerseusWidgetOptions } from "./perseus-types";
5
- import type { APIOptions, APIOptionsWithDefaults, FilterCriterion, FocusPath, LinterContextProps, PerseusDependencies, PerseusScore, WidgetInfo, WidgetProps } from "./types";
5
+ import type { APIOptions, APIOptionsWithDefaults, FilterCriterion, FocusPath, LinterContextProps, PerseusScore, WidgetInfo, WidgetProps } from "./types";
6
6
  import "./styles/perseus-renderer.less";
7
7
  type WidgetState = {
8
8
  isMobile?: boolean;
@@ -98,7 +98,7 @@ declare class Renderer extends React.Component<Props, State> {
98
98
  _isMounted: boolean;
99
99
  _isTwoColumn: boolean;
100
100
  _translationLinter: TranslationLinter;
101
- lastRenderedMarkdown: React.ReactElement<React.ComponentProps<PerseusDependencies["KatexProvider"]>>;
101
+ lastRenderedMarkdown: React.ReactNode;
102
102
  reuseMarkdown: boolean;
103
103
  translationIndex: number;
104
104
  widgetIds: Array<string>;
@@ -14,7 +14,6 @@ import type {
14
14
  FilterCriterion,
15
15
  FocusPath,
16
16
  LinterContextProps,
17
- PerseusDependencies,
18
17
  PerseusScore,
19
18
  WidgetInfo,
20
19
  WidgetProps,
@@ -135,8 +134,7 @@ declare class Renderer extends React.Component<Props, State> {
135
134
  _isMounted: boolean;
136
135
  _isTwoColumn: boolean;
137
136
  _translationLinter: TranslationLinter;
138
- lastRenderedMarkdown: React.Element<$PropertyType<PerseusDependencies, "KatexProvider">
139
- >;
137
+ lastRenderedMarkdown: React.Node;
140
138
  reuseMarkdown: boolean;
141
139
  translationIndex: number;
142
140
  widgetIds: Array<string>;
@@ -1,3 +1,2 @@
1
- import type { StyleDeclaration } from "aphrodite";
2
1
  declare const _default: StyleDeclaration;
3
2
  export default _default;
@@ -4,6 +4,5 @@
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
- import type { StyleDeclaration } from "aphrodite";
8
7
  declare var _default: StyleDeclaration;
9
8
  declare export default typeof _default;
package/dist/types.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- import katex from "katex";
2
- import katexA11y from "katex/dist/contrib/render-a11y-string";
3
1
  import * as React from "react";
4
2
  import type { SerializedHighlightSet } from "./components/highlighting/types";
5
3
  import type { ILogger } from "./logging/log";
@@ -170,14 +168,6 @@ export type PerseusDependencies = {
170
168
  graphieMovablesJiptLabels: JiptLabelStore;
171
169
  svgImageJiptLabels: JiptLabelStore;
172
170
  rendererTranslationComponents: JiptTranslationComponents;
173
- getKaTeX: () => Promise<katex>;
174
- getRenderA11yString: () => Promise<katexA11y>;
175
- loadMathjax: () => Promise<unknown>;
176
- logKaTeXError: (expression: string, error: Error) => Promise<Response | null | undefined>;
177
- KatexProvider: React.ComponentType<{
178
- children: React.ReactNode;
179
- }>;
180
- shouldUseFutureKaTeX: (flag: boolean) => void;
181
171
  TeX: React.ComponentType<TeXProps>;
182
172
  staticUrl: StaticUrlFn;
183
173
  InitialRequestUrl: InitialRequestUrlInterface;
@@ -4,8 +4,6 @@
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
- import katex from "katex";
8
- import katexA11y from "katex/dist/contrib/render-a11y-string";
9
7
  import * as React from "react";
10
8
  import type { SerializedHighlightSet } from "./components/highlighting/types";
11
9
  import type { ILogger } from "./logging/log";
@@ -200,17 +198,6 @@ export type PerseusDependencies = {|
200
198
  graphieMovablesJiptLabels: JiptLabelStore,
201
199
  svgImageJiptLabels: JiptLabelStore,
202
200
  rendererTranslationComponents: JiptTranslationComponents,
203
- getKaTeX: () => Promise<katex>,
204
- getRenderA11yString: () => Promise<katexA11y>,
205
- loadMathjax: () => Promise<mixed>,
206
- logKaTeXError: (
207
- expression: string,
208
- error: Error
209
- ) => Promise<Response | null | void>,
210
- KatexProvider: React.ComponentType<{|
211
- children: React.Node,
212
- |}>,
213
- shouldUseFutureKaTeX: (flag: boolean) => void,
214
201
  TeX: React.ComponentType<TeXProps>,
215
202
  staticUrl: StaticUrlFn,
216
203
  InitialRequestUrl: InitialRequestUrlInterface,
@@ -1,3 +1,2 @@
1
- import type { StyleDeclaration } from "aphrodite";
2
1
  declare const _default: StyleDeclaration;
3
2
  export default _default;
@@ -4,6 +4,5 @@
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
- import type { StyleDeclaration } from "aphrodite";
8
7
  declare var _default: StyleDeclaration;
9
8
  declare export default typeof _default;
@@ -5,5 +5,7 @@
5
5
  * `Graphie` prototype for dealing with interactive graphie elements.
6
6
  */
7
7
  import "../jquery.mobile.vmouse";
8
+ import type { Coord } from "../interactive2/types";
9
+ export type MouseHandler = (position: Coord) => void;
8
10
  declare const InteractiveUtils: any;
9
11
  export default InteractiveUtils;
@@ -5,5 +5,7 @@
5
5
  * @flow
6
6
  */
7
7
  import "../jquery.mobile.vmouse";
8
+ import type { Coord } from "../interactive2/types";
9
+ export type MouseHandler = (position: Coord) => void;
8
10
  declare var InteractiveUtils: any;
9
11
  declare export default typeof InteractiveUtils;
package/dist/util.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { Range } from "./perseus-types";
1
2
  import type { Widget, PerseusScore, KEScore } from "./types";
2
3
  type WordPosition = {
3
4
  start: number;
@@ -21,7 +22,7 @@ export type GridDimensions = {
21
22
  type QueryParams = {
22
23
  [param: string]: string;
23
24
  };
24
- type Position = {
25
+ export type Position = {
25
26
  top: number;
26
27
  left: number;
27
28
  };
@@ -107,13 +108,12 @@ declare function tickStepFromExtent(extent: Coordinates, dimensionConstraint: nu
107
108
  * tickStepFromNumTicks(50, 6) // returns 10
108
109
  */
109
110
  declare function tickStepFromNumTicks(span: number, numTicks: number): number;
110
- type Range = [number, number];
111
111
  /**
112
112
  * Constrain tick steps intended for desktop size graphs
113
113
  * to something more suitable for mobile size graphs.
114
114
  * Specifically, we aim for 10 or fewer ticks per graph axis.
115
115
  */
116
- declare function constrainedTickStepsFromTickSteps(tickSteps: Coordinates, ranges: [Range, Range]): Coordinates;
116
+ declare function constrainedTickStepsFromTickSteps(tickSteps: [number, number], ranges: [Range, Range]): Coordinates;
117
117
  /**
118
118
  * Approximate equality on numbers and primitives.
119
119
  */
package/dist/util.js.flow CHANGED
@@ -4,6 +4,7 @@
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
+ import type { Range } from "./perseus-types";
7
8
  import type { Widget, PerseusScore, KEScore } from "./types";
8
9
  declare type WordPosition = {|
9
10
  start: number,
@@ -27,7 +28,7 @@ export type GridDimensions = {|
27
28
  declare type QueryParams = {
28
29
  [param: string]: string,
29
30
  };
30
- declare type Position = {|
31
+ export type Position = {|
31
32
  top: number,
32
33
  left: number,
33
34
  |};
@@ -155,14 +156,14 @@ declare function tickStepFromExtent(
155
156
  * tickStepFromNumTicks(50, 6) // returns 10
156
157
  */
157
158
  declare function tickStepFromNumTicks(span: number, numTicks: number): number;
158
- declare type Range = [number, number];
159
+
159
160
  /**
160
161
  * Constrain tick steps intended for desktop size graphs
161
162
  * to something more suitable for mobile size graphs.
162
163
  * Specifically, we aim for 10 or fewer ticks per graph axis.
163
164
  */
164
165
  declare function constrainedTickStepsFromTickSteps(
165
- tickSteps: Coordinates,
166
+ tickSteps: [number, number],
166
167
  ranges: [Range, Range]
167
168
  ): Coordinates;
168
169
 
@@ -30,7 +30,7 @@ declare class Grapher extends React.Component<Props> {
30
30
  box: NonNullable<Props["graph"]["box"]>;
31
31
  gridStep: NonNullable<Props["graph"]["gridStep"]>;
32
32
  }): ReadonlyArray<GridDimensions>;
33
- _calculateMobileTickStep(gridStep: JSX.LibraryManagedAttributes<typeof Graphie, React.ComponentProps<typeof Graphie>>["gridStep"], step: JSX.LibraryManagedAttributes<typeof Graphie, React.ComponentProps<typeof Graphie>>["step"], ranges: JSX.LibraryManagedAttributes<typeof Graphie, React.ComponentProps<typeof Graphie>>["ranges"]): any;
33
+ _calculateMobileTickStep(gridStep: JSX.LibraryManagedAttributes<typeof Graphie, Required<React.ComponentProps<typeof Graphie>>>["gridStep"], step: JSX.LibraryManagedAttributes<typeof Graphie, Required<React.ComponentProps<typeof Graphie>>>["step"], ranges: JSX.LibraryManagedAttributes<typeof Graphie, Required<React.ComponentProps<typeof Graphie>>>["ranges"]): any;
34
34
  _setupGraphie: (arg1: any, arg2: any) => void;
35
35
  showHairlines: (arg1: Coord) => void;
36
36
  hideHairlines: () => void;
@@ -47,15 +47,24 @@ declare class Grapher extends React.Component<Props> {
47
47
  |}): $ReadOnlyArray<GridDimensions>;
48
48
  _calculateMobileTickStep(
49
49
  gridStep: $PropertyType<
50
- React.ElementConfig<typeof Graphie>,
50
+ JSX.LibraryManagedAttributes<
51
+ typeof Graphie,
52
+ Required<React.ElementProps<typeof Graphie>>
53
+ >,
51
54
  "gridStep"
52
55
  >,
53
56
  step: $PropertyType<
54
- React.ElementConfig<typeof Graphie>,
57
+ JSX.LibraryManagedAttributes<
58
+ typeof Graphie,
59
+ Required<React.ElementProps<typeof Graphie>>
60
+ >,
55
61
  "step"
56
62
  >,
57
63
  ranges: $PropertyType<
58
- React.ElementConfig<typeof Graphie>,
64
+ JSX.LibraryManagedAttributes<
65
+ typeof Graphie,
66
+ Required<React.ElementProps<typeof Graphie>>
67
+ >,
59
68
  "ranges"
60
69
  >
61
70
  ): any;
@@ -1,6 +1,11 @@
1
1
  import PropTypes from "prop-types";
2
2
  import * as React from "react";
3
3
  import type { SortableOption } from "../components/sortable";
4
+ type State = {
5
+ leftHeight: number;
6
+ rightHeight: number;
7
+ texRendererLoaded: boolean;
8
+ };
4
9
  declare class Matcher extends React.Component<any, any> {
5
10
  static propTypes: {
6
11
  apiOptions: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
@@ -48,9 +53,8 @@ declare class Matcher extends React.Component<any, any> {
48
53
  }>>;
49
54
  };
50
55
  static defaultProps: any;
51
- state: any;
52
- componentDidMount(): void;
53
- render(): React.ReactNode;
56
+ state: State;
57
+ render(): React.ReactElement;
54
58
  changeAndTrack: (arg1: any) => void;
55
59
  onMeasureLeft: (arg1: any) => void;
56
60
  onMeasureRight: (arg1: any) => void;
@@ -8,6 +8,11 @@ import * as $Flowgen$Import$_2e__2e__2f_types from "../types";
8
8
  import PropTypes from "prop-types";
9
9
  import * as React from "react";
10
10
  import type { SortableOption } from "../components/sortable";
11
+ declare type State = {|
12
+ leftHeight: number,
13
+ rightHeight: number,
14
+ texRendererLoaded: boolean,
15
+ |};
11
16
  declare class Matcher extends React.Component<any, any> {
12
17
  static propTypes: {|
13
18
  apiOptions: PropTypes.Validator<
@@ -65,9 +70,8 @@ declare class Matcher extends React.Component<any, any> {
65
70
  >,
66
71
  |};
67
72
  static defaultProps: any;
68
- state: any;
69
- componentDidMount(): void;
70
- render(): React.Node;
73
+ state: State;
74
+ render(): React.Element<any>;
71
75
  changeAndTrack: (arg1: any) => void;
72
76
  onMeasureLeft: (arg1: any) => void;
73
77
  onMeasureRight: (arg1: any) => void;
@@ -2,7 +2,7 @@ import * as React from "react";
2
2
  import type { ChangeableProps } from "../mixins/changeable";
3
3
  import type { APIOptions } from "../types";
4
4
  type Props = ChangeableProps & {
5
- range: ReadonlyArray<number>;
5
+ range: [number, number];
6
6
  labelRange: ReadonlyArray<number | null>;
7
7
  labelStyle: string;
8
8
  labelTicks: boolean;
@@ -11,7 +11,7 @@ import type { APIOptions } from "../types";
11
11
  declare type Props = {|
12
12
  ...ChangeableProps,
13
13
  ...{|
14
- range: $ReadOnlyArray<number>,
14
+ range: [number, number],
15
15
  labelRange: $ReadOnlyArray<number | null>,
16
16
  labelStyle: string,
17
17
  labelTicks: boolean,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Core Perseus API (includes renderers and widgets)",
4
4
  "author": "Khan Academy",
5
5
  "license": "MIT",
6
- "version": "5.0.0",
6
+ "version": "6.0.0",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -23,7 +23,7 @@
23
23
  "dependencies": {
24
24
  "@khanacademy/kas": "^0.3.1",
25
25
  "@khanacademy/kmath": "^0.1.1",
26
- "@khanacademy/math-input": "^1.0.0",
26
+ "@khanacademy/math-input": "^2.0.0",
27
27
  "@khanacademy/perseus-linter": "^0.3.1",
28
28
  "@khanacademy/pure-markdown": "^0.2.3",
29
29
  "@khanacademy/simple-markdown": "^0.9.3",