@khanacademy/perseus 25.1.1 → 26.1.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 (58) hide show
  1. package/dist/components/fixed-to-responsive.d.ts +1 -1
  2. package/dist/components/hud.d.ts +2 -2
  3. package/dist/components/i18n-context.d.ts +1 -1
  4. package/dist/components/info-tip/info-tip.d.ts +1 -1
  5. package/dist/components/math-input.d.ts +1 -1
  6. package/dist/components/tooltip.d.ts +2 -2
  7. package/dist/es/index.css +2 -2
  8. package/dist/es/index.js +55 -14
  9. package/dist/es/index.js.map +1 -1
  10. package/dist/index.css +2 -2
  11. package/dist/index.js +55 -14
  12. package/dist/index.js.map +1 -1
  13. package/dist/renderer.d.ts +8 -1
  14. package/dist/types.d.ts +1 -0
  15. package/dist/util/react-render.d.ts +9 -1
  16. package/dist/widget-container.d.ts +1 -1
  17. package/dist/widgets/deprecated-standin/index.d.ts +1 -1
  18. package/dist/widgets/expression.d.ts +6 -4
  19. package/dist/widgets/interactive-graph.d.ts +1 -1
  20. package/dist/widgets/interactive-graphs/backgrounds/axis-arrows.d.ts +2 -2
  21. package/dist/widgets/interactive-graphs/backgrounds/axis-labels.d.ts +2 -2
  22. package/dist/widgets/interactive-graphs/backgrounds/axis-tick-labels.d.ts +2 -2
  23. package/dist/widgets/interactive-graphs/backgrounds/axis-ticks.d.ts +2 -2
  24. package/dist/widgets/interactive-graphs/backgrounds/grid.d.ts +2 -2
  25. package/dist/widgets/interactive-graphs/backgrounds/legacy-grid.d.ts +2 -2
  26. package/dist/widgets/interactive-graphs/graph-locked-layer.d.ts +2 -2
  27. package/dist/widgets/interactive-graphs/graphs/angle.d.ts +2 -2
  28. package/dist/widgets/interactive-graphs/graphs/circle.d.ts +2 -2
  29. package/dist/widgets/interactive-graphs/graphs/components/angle-indicators.d.ts +3 -3
  30. package/dist/widgets/interactive-graphs/graphs/components/arrowhead.d.ts +2 -2
  31. package/dist/widgets/interactive-graphs/graphs/components/css-transform-wrapper.d.ts +1 -1
  32. package/dist/widgets/interactive-graphs/graphs/components/movable-line.d.ts +3 -3
  33. package/dist/widgets/interactive-graphs/graphs/components/movable-point.d.ts +2 -2
  34. package/dist/widgets/interactive-graphs/graphs/components/svg-line.d.ts +2 -1
  35. package/dist/widgets/interactive-graphs/graphs/components/text-label.d.ts +3 -2
  36. package/dist/widgets/interactive-graphs/graphs/components/vector.d.ts +1 -1
  37. package/dist/widgets/interactive-graphs/graphs/linear-system.d.ts +2 -2
  38. package/dist/widgets/interactive-graphs/graphs/linear.d.ts +2 -2
  39. package/dist/widgets/interactive-graphs/graphs/point.d.ts +2 -2
  40. package/dist/widgets/interactive-graphs/graphs/polygon.d.ts +2 -2
  41. package/dist/widgets/interactive-graphs/graphs/quadratic.d.ts +2 -2
  42. package/dist/widgets/interactive-graphs/graphs/ray.d.ts +2 -2
  43. package/dist/widgets/interactive-graphs/graphs/segment.d.ts +2 -2
  44. package/dist/widgets/interactive-graphs/graphs/sinusoid.d.ts +2 -2
  45. package/dist/widgets/interactive-graphs/locked-figures/locked-ellipse.d.ts +2 -2
  46. package/dist/widgets/interactive-graphs/locked-figures/locked-function.d.ts +2 -2
  47. package/dist/widgets/interactive-graphs/locked-figures/locked-line.d.ts +2 -2
  48. package/dist/widgets/interactive-graphs/locked-figures/locked-point.d.ts +2 -2
  49. package/dist/widgets/interactive-graphs/locked-figures/locked-polygon.d.ts +2 -2
  50. package/dist/widgets/interactive-graphs/locked-figures/locked-vector.d.ts +2 -2
  51. package/dist/widgets/interactive-graphs/mafs-graph.d.ts +2 -1
  52. package/dist/widgets/interactive-graphs/protractor.d.ts +2 -2
  53. package/dist/widgets/interactive-graphs/stateful-mafs-graph.d.ts +1 -0
  54. package/dist/widgets/label-image/answer-choices.d.ts +2 -2
  55. package/dist/widgets/label-image/answer-pill.d.ts +2 -2
  56. package/dist/widgets/label-image/hide-answers-toggle.d.ts +1 -1
  57. package/dist/widgets/label-image/marker.d.ts +1 -1
  58. package/package.json +10 -10
@@ -61,6 +61,13 @@ type Props = Partial<React.ContextType<typeof DependenciesContext>> & {
61
61
  problemNum?: number;
62
62
  questionCompleted?: boolean;
63
63
  reviewMode?: boolean | null | undefined;
64
+ /**
65
+ * Some widgets (e.g. InteractiveGraph) support "hint mode", a state where
66
+ * the widget is non-editable, may have a partial solution filled in,
67
+ * and may have special styling. Setting hintMode to true will turn on hint
68
+ * mode for all rendered widgets.
69
+ */
70
+ hintMode?: boolean;
64
71
  /**
65
72
  * If set to "all", all rationales or solutions will be shown. If set to
66
73
  * "selected", soltions will only be shown for selected choices. If set to
@@ -100,7 +107,7 @@ type State = {
100
107
  jiptContent: any;
101
108
  lastUsedWidgetId: string | null | undefined;
102
109
  };
103
- type DefaultProps = Required<Pick<Props, "alwaysUpdate" | "content" | "findExternalWidgets" | "highlightedWidgets" | "images" | "linterContext" | "onInteractWithWidget" | "onRender" | "onSerializedStateUpdated" | "questionCompleted" | "showSolutions" | "reviewMode" | "serializedState" | "widgets">>;
110
+ type DefaultProps = Required<Pick<Props, "alwaysUpdate" | "content" | "findExternalWidgets" | "highlightedWidgets" | "images" | "linterContext" | "onInteractWithWidget" | "onRender" | "onSerializedStateUpdated" | "questionCompleted" | "showSolutions" | "reviewMode" | "hintMode" | "serializedState" | "widgets">>;
104
111
  declare class Renderer extends React.Component<Props, State> {
105
112
  _currentFocus: FocusPath | null | undefined;
106
113
  _foundTextNodes: boolean;
package/dist/types.d.ts CHANGED
@@ -373,6 +373,7 @@ export type WidgetProps<RenderProps, Rubric, TrackingExtraArgs = Empty> = Render
373
373
  onBlur: (blurPath: FocusPath) => void;
374
374
  findWidgets: (arg1: FilterCriterion) => ReadonlyArray<Widget>;
375
375
  reviewModeRubric: Rubric;
376
+ hintMode: boolean;
376
377
  onChange: ChangeHandler;
377
378
  trackInteraction: (extraData?: TrackingExtraArgs) => void;
378
379
  isLastUsedWidget: boolean;
@@ -1,2 +1,10 @@
1
1
  import * as React from "react";
2
- export default function render<ElementType extends React.ElementType>(element: React.ReactNode, container: HTMLElement, callback?: () => void): React.ElementRef<ElementType>;
2
+ /**
3
+ * Renders the given ReactNode inside the given container.
4
+ * @param element The JSX to render
5
+ * @param container The HTML elemetn to render into
6
+ *
7
+ * @deprecated this function is legacy and exists to support ancient code
8
+ * paths. Do not use in new code.
9
+ */
10
+ export default function render(element: React.ReactNode, container: HTMLElement): void;
@@ -19,7 +19,7 @@ type State = {
19
19
  declare class WidgetContainer extends React.Component<Props, State> {
20
20
  widgetRef: React.RefObject<React.ComponentType<any>>;
21
21
  static defaultProps: DefaultProps;
22
- state: any;
22
+ state: State;
23
23
  componentDidMount(): void;
24
24
  render(): React.ReactNode;
25
25
  UNSAFE_componentWillReceiveProps(nextProps: Props): void;
@@ -13,7 +13,7 @@ declare class DeprecatedStandin extends React.Component<Props> {
13
13
  static validate(userInput: UserInput, rubric: Rubric): PerseusScore;
14
14
  getUserInput: () => UserInput;
15
15
  simpleValidate: (arg1: Rubric) => PerseusScore;
16
- render(): JSX.Element;
16
+ render(): React.JSX.Element;
17
17
  }
18
18
  declare const _default: Readonly<{
19
19
  name: string;
@@ -175,6 +175,7 @@ declare const _default: Readonly<{
175
175
  onBlur: (blurPath: import("../types").FocusPath) => void;
176
176
  findWidgets: (arg1: import("../types").FilterCriterion) => readonly any[];
177
177
  reviewModeRubric: PerseusExpressionWidgetOptions;
178
+ hintMode: boolean;
178
179
  onChange: import("../types").ChangeHandler;
179
180
  trackInteraction: (extraData?: Empty | undefined) => void;
180
181
  isLastUsedWidget: boolean;
@@ -257,11 +258,11 @@ declare const _default: Readonly<{
257
258
  onFocus: (blurPath: import("../types").FocusPath) => void;
258
259
  times: boolean;
259
260
  value: string;
260
- }, "onChange" | "analytics" | "buttonsVisible" | "static" | "containerSizeClass" | "widgetId" | "problemNum" | "questionCompleted" | "findWidgets" | "trackInteraction" | "keypadElement" | "keypadConfiguration" | "alignment" | "reviewModeRubric" | "isLastUsedWidget"> & {
261
+ }, "analytics" | "onChange" | "buttonsVisible" | "static" | "containerSizeClass" | "widgetId" | "problemNum" | "questionCompleted" | "findWidgets" | "hintMode" | "trackInteraction" | "keypadElement" | "keypadConfiguration" | "alignment" | "reviewModeRubric" | "isLastUsedWidget"> & {
261
262
  value?: string | undefined;
263
+ buttonSets?: import("../perseus-types").LegacyButtonSets | undefined;
262
264
  onFocus?: ((blurPath: import("../types").FocusPath) => void) | undefined;
263
265
  onBlur?: ((blurPath: import("../types").FocusPath) => void) | undefined;
264
- buttonSets?: import("../perseus-types").LegacyButtonSets | undefined;
265
266
  apiOptions?: Readonly<Readonly<{
266
267
  isArticle?: boolean | undefined;
267
268
  onInputError?: ((widgetId: any, value: string, message?: string | null | undefined) => unknown) | undefined;
@@ -415,6 +416,7 @@ declare const _default: Readonly<{
415
416
  onBlur: (blurPath: import("../types").FocusPath) => void;
416
417
  findWidgets: (arg1: import("../types").FilterCriterion) => readonly any[];
417
418
  reviewModeRubric: PerseusExpressionWidgetOptions;
419
+ hintMode: boolean;
418
420
  onChange: import("../types").ChangeHandler;
419
421
  trackInteraction: (extraData?: Empty | undefined) => void;
420
422
  isLastUsedWidget: boolean;
@@ -497,11 +499,11 @@ declare const _default: Readonly<{
497
499
  onFocus: (blurPath: import("../types").FocusPath) => void;
498
500
  times: boolean;
499
501
  value: string;
500
- }, "onChange" | "analytics" | "buttonsVisible" | "static" | "containerSizeClass" | "widgetId" | "problemNum" | "questionCompleted" | "findWidgets" | "trackInteraction" | "keypadElement" | "keypadConfiguration" | "alignment" | "reviewModeRubric" | "isLastUsedWidget"> & {
502
+ }, "analytics" | "onChange" | "buttonsVisible" | "static" | "containerSizeClass" | "widgetId" | "problemNum" | "questionCompleted" | "findWidgets" | "hintMode" | "trackInteraction" | "keypadElement" | "keypadConfiguration" | "alignment" | "reviewModeRubric" | "isLastUsedWidget"> & {
501
503
  value?: string | undefined;
504
+ buttonSets?: import("../perseus-types").LegacyButtonSets | undefined;
502
505
  onFocus?: ((blurPath: import("../types").FocusPath) => void) | undefined;
503
506
  onBlur?: ((blurPath: import("../types").FocusPath) => void) | undefined;
504
- buttonSets?: import("../perseus-types").LegacyButtonSets | undefined;
505
507
  apiOptions?: Readonly<Readonly<{
506
508
  isArticle?: boolean | undefined;
507
509
  onInputError?: ((widgetId: any, value: string, message?: string | null | undefined) => unknown) | undefined;
@@ -115,7 +115,7 @@ declare class InteractiveGraph extends React.Component<Props, State> {
115
115
  static defaultProps: DefaultProps;
116
116
  getUserInput: Widget["getUserInput"];
117
117
  simpleValidate(rubric: Rubric): PerseusScore;
118
- render(): JSX.Element;
118
+ render(): React.JSX.Element;
119
119
  static getQuadraticCoefficients(coords: ReadonlyArray<Coord>): QuadraticCoefficient;
120
120
  static getSinusoidCoefficients(coords: ReadonlyArray<Coord>): SineCoefficient;
121
121
  /**
@@ -1,2 +1,2 @@
1
- /// <reference types="react" />
2
- export default function AxisArrows(): JSX.Element;
1
+ import React from "react";
2
+ export default function AxisArrows(): React.JSX.Element;
@@ -1,2 +1,2 @@
1
- /// <reference types="react" />
2
- export default function AxisLabels(): JSX.Element;
1
+ import React from "react";
2
+ export default function AxisLabels(): React.JSX.Element;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import * as React from "react";
2
2
  type ShowTickLabelProps = {
3
3
  gridStep: number;
4
4
  tickStep: number;
@@ -7,7 +7,7 @@ type ShowTickLabelProps = {
7
7
  position: number;
8
8
  axisOutOfBounds: boolean;
9
9
  };
10
- export declare const AxisTickLabels: () => JSX.Element;
10
+ export declare const AxisTickLabels: () => React.JSX.Element;
11
11
  export declare const showTickLabel: ({ gridStep, tickStep, label, graphEdge, position, axisOutOfBounds, }: ShowTickLabelProps) => boolean;
12
12
  export declare function generateTickLocations(tickStep: number, min: number, max: number): number[];
13
13
  export {};
@@ -1,3 +1,3 @@
1
- /// <reference types="react" />
1
+ import * as React from "react";
2
2
  export declare function generateTickLocations(tickStep: number, min: number, max: number): number[];
3
- export declare const AxisTicks: () => JSX.Element;
3
+ export declare const AxisTicks: () => React.JSX.Element;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import * as React from "react";
2
2
  import type { GraphRange } from "../../../perseus-types";
3
3
  import type { SizeClass } from "../../../util/sizing-utils";
4
4
  import type { vec } from "mafs";
@@ -18,5 +18,5 @@ interface GridProps {
18
18
  * @param {vec.Vector2} range the min/max range on the axis
19
19
  */
20
20
  export declare const lineLabelText: (n: number, tickStep: number, range: vec.Vector2) => string;
21
- export declare const Grid: (props: GridProps) => JSX.Element | null;
21
+ export declare const Grid: (props: GridProps) => React.JSX.Element | null;
22
22
  export {};
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import * as React from "react";
2
2
  import type { PerseusImageBackground } from "../../../perseus-types";
3
3
  interface Props {
4
4
  box: [number, number];
@@ -8,5 +8,5 @@ interface Props {
8
8
  * If a graphie URL is provided in `backgroundImage`, will return the rendered graphie background.
9
9
  * Otherwise, returns `null`.
10
10
  */
11
- export declare const LegacyGrid: ({ box, backgroundImage }: Props) => JSX.Element | null;
11
+ export declare const LegacyGrid: ({ box, backgroundImage }: Props) => React.JSX.Element | null;
12
12
  export {};
@@ -1,9 +1,9 @@
1
- /// <reference types="react" />
1
+ import * as React from "react";
2
2
  import type { LockedFigure } from "../../perseus-types";
3
3
  import type { Interval } from "mafs";
4
4
  type Props = {
5
5
  lockedFigures: ReadonlyArray<LockedFigure>;
6
6
  range: [x: Interval, y: Interval];
7
7
  };
8
- declare const GraphLockedLayer: (props: Props) => JSX.Element;
8
+ declare const GraphLockedLayer: (props: Props) => React.JSX.Element;
9
9
  export default GraphLockedLayer;
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
1
+ import * as React from "react";
2
2
  import type { AngleGraphState, MafsGraphProps } from "../types";
3
3
  type AngleGraphProps = MafsGraphProps<AngleGraphState>;
4
- export declare function AngleGraph(props: AngleGraphProps): JSX.Element;
4
+ export declare function AngleGraph(props: AngleGraphProps): React.JSX.Element;
5
5
  export {};
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
1
+ import * as React from "react";
2
2
  import type { CircleGraphState, MafsGraphProps } from "../types";
3
3
  type CircleGraphProps = MafsGraphProps<CircleGraphState>;
4
- export declare function CircleGraph(props: CircleGraphProps): JSX.Element;
4
+ export declare function CircleGraph(props: CircleGraphProps): React.JSX.Element;
5
5
  export {};
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { vec } from "mafs";
2
+ import * as React from "react";
3
3
  import type { CollinearTuple } from "../../../../perseus-types";
4
4
  import type { Interval } from "mafs";
5
5
  interface PolygonAngleProps {
@@ -11,7 +11,7 @@ interface PolygonAngleProps {
11
11
  showAngles: boolean;
12
12
  snapTo: "grid" | "angles" | "sides";
13
13
  }
14
- export declare const PolygonAngle: ({ centerPoint, endPoints, range, polygonLines, showAngles, snapTo, }: PolygonAngleProps) => JSX.Element | null;
14
+ export declare const PolygonAngle: ({ centerPoint, endPoints, range, polygonLines, showAngles, snapTo, }: PolygonAngleProps) => React.JSX.Element | null;
15
15
  interface AngleProps {
16
16
  vertex: vec.Vector2;
17
17
  coords: [vec.Vector2, vec.Vector2];
@@ -21,7 +21,7 @@ interface AngleProps {
21
21
  snapDegrees: number;
22
22
  range: [Interval, Interval];
23
23
  }
24
- export declare const Angle: ({ vertex, coords, showAngles, allowReflexAngles, range, }: AngleProps) => JSX.Element;
24
+ export declare const Angle: ({ vertex, coords, showAngles, allowReflexAngles, range, }: AngleProps) => React.JSX.Element;
25
25
  /**
26
26
  * Determines if an angle is an inside (false) or outside (true) angle.
27
27
  * They way, we know to flip the `largeArc` and `sweepArc` flags.
@@ -1,9 +1,9 @@
1
- /// <reference types="react" />
2
1
  import { type vec } from "mafs";
2
+ import * as React from "react";
3
3
  type Props = {
4
4
  tip: vec.Vector2;
5
5
  angle: number;
6
6
  color?: string;
7
7
  };
8
- export declare function Arrowhead(props: Props): JSX.Element;
8
+ export declare function Arrowhead(props: Props): React.JSX.Element;
9
9
  export {};
@@ -4,4 +4,4 @@ import * as React from "react";
4
4
  * Scales and translates the SVG element to match the Mafs view.
5
5
  * Use if you do not need/want to use the hook in `use-transform.ts`.
6
6
  */
7
- export declare const MafsCssTransformWrapper: ({ children, }: React.PropsWithChildren<unknown>) => JSX.Element;
7
+ export declare const MafsCssTransformWrapper: ({ children, }: React.PropsWithChildren<unknown>) => React.JSX.Element;
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { vec } from "mafs";
2
+ import * as React from "react";
3
3
  import type { Interval } from "mafs";
4
4
  type Props = {
5
5
  points: Readonly<[vec.Vector2, vec.Vector2]>;
@@ -11,7 +11,7 @@ type Props = {
11
11
  end: boolean;
12
12
  };
13
13
  };
14
- export declare const MovableLine: (props: Props) => JSX.Element;
14
+ export declare const MovableLine: (props: Props) => React.JSX.Element;
15
15
  type LineProps = {
16
16
  start: vec.Vector2;
17
17
  end: vec.Vector2;
@@ -22,6 +22,6 @@ type LineProps = {
22
22
  end: boolean;
23
23
  };
24
24
  };
25
- export declare const Line: (props: LineProps) => JSX.Element;
25
+ export declare const Line: (props: LineProps) => React.JSX.Element;
26
26
  export declare function trimRange(range: [Interval, Interval], graphDimensionsInPixels: vec.Vector2): [Interval, Interval];
27
27
  export {};
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import * as React from "react";
2
2
  import type { CSSCursor } from "./css-cursor";
3
3
  import type { vec } from "mafs";
4
4
  type Props = {
@@ -8,5 +8,5 @@ type Props = {
8
8
  cursor?: CSSCursor | undefined;
9
9
  snapTo?: "grid" | "angles" | "sides";
10
10
  };
11
- export declare const StyledMovablePoint: (props: Props) => JSX.Element;
11
+ export declare const StyledMovablePoint: (props: Props) => React.JSX.Element;
12
12
  export {};
@@ -1,3 +1,4 @@
1
+ import * as React from "react";
1
2
  import type { vec } from "mafs";
2
3
  import type { SVGProps } from "react";
3
4
  export type Props = {
@@ -7,4 +8,4 @@ export type Props = {
7
8
  className?: string;
8
9
  testId?: string;
9
10
  };
10
- export declare function SVGLine(props: Props): JSX.Element;
11
+ export declare function SVGLine(props: Props): React.JSX.Element;
@@ -1,6 +1,7 @@
1
+ import React from "react";
1
2
  import type { TextProps } from "mafs";
2
3
  import type { PropsWithChildren } from "react";
3
4
  type Props = PropsWithChildren<Pick<TextProps, "x" | "y" | "attach" | "attachDistance" | "color">>;
4
- export declare const TextLabel: ({ children, ...rest }: Props) => JSX.Element;
5
- export declare const SvgDefs: () => JSX.Element;
5
+ export declare const TextLabel: ({ children, ...rest }: Props) => React.JSX.Element;
6
+ export declare const SvgDefs: () => React.JSX.Element;
6
7
  export {};
@@ -6,5 +6,5 @@ type Props = {
6
6
  color: string;
7
7
  style?: React.SVGProps<SVGLineElement>["style"];
8
8
  };
9
- export declare function Vector(props: Props): JSX.Element;
9
+ export declare function Vector(props: Props): React.JSX.Element;
10
10
  export {};
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
1
+ import * as React from "react";
2
2
  import type { MafsGraphProps, LinearSystemGraphState } from "../types";
3
3
  type LinearSystemGraphProps = MafsGraphProps<LinearSystemGraphState>;
4
- export declare const LinearSystemGraph: (props: LinearSystemGraphProps) => JSX.Element;
4
+ export declare const LinearSystemGraph: (props: LinearSystemGraphProps) => React.JSX.Element;
5
5
  export {};
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
1
+ import * as React from "react";
2
2
  import type { MafsGraphProps, LinearGraphState } from "../types";
3
3
  type LinearGraphProps = MafsGraphProps<LinearGraphState>;
4
- export declare const LinearGraph: (props: LinearGraphProps, key: number) => JSX.Element;
4
+ export declare const LinearGraph: (props: LinearGraphProps, key: number) => React.JSX.Element;
5
5
  export {};
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
1
+ import * as React from "react";
2
2
  import type { PointGraphState, MafsGraphProps } from "../types";
3
3
  type PointGraphProps = MafsGraphProps<PointGraphState>;
4
- export declare function PointGraph(props: PointGraphProps): JSX.Element;
4
+ export declare function PointGraph(props: PointGraphProps): React.JSX.Element;
5
5
  export {};
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
1
+ import * as React from "react";
2
2
  import type { MafsGraphProps, PolygonGraphState } from "../types";
3
3
  type Props = MafsGraphProps<PolygonGraphState>;
4
- export declare const PolygonGraph: (props: Props) => JSX.Element;
4
+ export declare const PolygonGraph: (props: Props) => React.JSX.Element;
5
5
  export {};
@@ -1,8 +1,8 @@
1
- /// <reference types="react" />
1
+ import * as React from "react";
2
2
  import type { QuadraticGraphState, MafsGraphProps } from "../types";
3
3
  type QuadraticGraphProps = MafsGraphProps<QuadraticGraphState>;
4
4
  type QuadraticCoefficient = [number, number, number];
5
5
  export type QuadraticCoords = QuadraticGraphState["coords"];
6
- export declare function QuadraticGraph(props: QuadraticGraphProps): JSX.Element;
6
+ export declare function QuadraticGraph(props: QuadraticGraphProps): React.JSX.Element;
7
7
  export declare const getQuadraticCoefficients: (coords: [import("../../..").Coord, import("../../..").Coord, import("../../..").Coord]) => QuadraticCoefficient | undefined;
8
8
  export {};
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
1
+ import * as React from "react";
2
2
  import type { MafsGraphProps, RayGraphState } from "../types";
3
3
  type Props = MafsGraphProps<RayGraphState>;
4
- export declare const RayGraph: (props: Props) => JSX.Element;
4
+ export declare const RayGraph: (props: Props) => React.JSX.Element;
5
5
  export {};
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
1
+ import * as React from "react";
2
2
  import type { MafsGraphProps, SegmentGraphState } from "../types";
3
3
  type SegmentProps = MafsGraphProps<SegmentGraphState>;
4
- export declare const SegmentGraph: (props: SegmentProps) => JSX.Element;
4
+ export declare const SegmentGraph: (props: SegmentProps) => React.JSX.Element;
5
5
  export {};
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import * as React from "react";
2
2
  import type { Coord } from "../../../interactive2/types";
3
3
  import type { SinusoidGraphState, MafsGraphProps } from "../types";
4
4
  type SinusoidGraphProps = MafsGraphProps<SinusoidGraphState>;
@@ -8,7 +8,7 @@ export type SineCoefficient = {
8
8
  phase: number;
9
9
  verticalOffset: number;
10
10
  };
11
- export declare function SinusoidGraph(props: SinusoidGraphProps): JSX.Element;
11
+ export declare function SinusoidGraph(props: SinusoidGraphProps): React.JSX.Element;
12
12
  export declare const computeSine: (x: number, sinusoidCoefficients: SineCoefficient) => number;
13
13
  export declare const getSinusoidCoefficients: (coords: ReadonlyArray<Coord>) => SineCoefficient | undefined;
14
14
  export {};
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import * as React from "react";
2
2
  import { type LockedEllipseType } from "../../../perseus-types";
3
- declare const LockedEllipse: (props: LockedEllipseType) => JSX.Element;
3
+ declare const LockedEllipse: (props: LockedEllipseType) => React.JSX.Element;
4
4
  export default LockedEllipse;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import * as React from "react";
2
2
  import type { LockedFunctionType } from "../../../perseus-types";
3
- declare const LockedFunction: (props: LockedFunctionType) => JSX.Element;
3
+ declare const LockedFunction: (props: LockedFunctionType) => React.JSX.Element;
4
4
  export default LockedFunction;
@@ -1,8 +1,8 @@
1
- /// <reference types="react" />
1
+ import * as React from "react";
2
2
  import type { LockedLineType } from "../../../perseus-types";
3
3
  import type { Interval } from "mafs";
4
4
  type Props = LockedLineType & {
5
5
  range: [Interval, Interval];
6
6
  };
7
- declare const LockedLine: (props: Props) => JSX.Element;
7
+ declare const LockedLine: (props: Props) => React.JSX.Element;
8
8
  export default LockedLine;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import * as React from "react";
2
2
  import { type LockedPointType } from "../../../perseus-types";
3
- declare const LockedPoint: (props: LockedPointType) => JSX.Element;
3
+ declare const LockedPoint: (props: LockedPointType) => React.JSX.Element;
4
4
  export default LockedPoint;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import * as React from "react";
2
2
  import type { LockedPolygonType } from "../../../perseus-types";
3
- declare const LockedPolygon: (props: LockedPolygonType) => JSX.Element;
3
+ declare const LockedPolygon: (props: LockedPolygonType) => React.JSX.Element;
4
4
  export default LockedPolygon;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import * as React from "react";
2
2
  import type { LockedVectorType } from "../../../perseus-types";
3
- declare const LockedVector: (props: LockedVectorType) => JSX.Element;
3
+ declare const LockedVector: (props: LockedVectorType) => React.JSX.Element;
4
4
  export default LockedVector;
@@ -16,5 +16,6 @@ export type MafsGraphProps = {
16
16
  labels: InteractiveGraphProps["labels"];
17
17
  state: InteractiveGraphState;
18
18
  dispatch: React.Dispatch<InteractiveGraphAction>;
19
+ hintMode: boolean;
19
20
  };
20
- export declare const MafsGraph: (props: MafsGraphProps) => JSX.Element;
21
+ export declare const MafsGraph: (props: MafsGraphProps) => React.JSX.Element;
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { vec } from "mafs";
2
+ import * as React from "react";
3
3
  import "./protractor.css";
4
4
  export declare const centerToRotationHandle: vec.Vector2;
5
- export declare function Protractor(): JSX.Element;
5
+ export declare function Protractor(): React.JSX.Element;
@@ -17,5 +17,6 @@ export type StatefulMafsGraphProps = {
17
17
  showTooltips: Required<InteractiveGraphProps["showTooltips"]>;
18
18
  showProtractor: boolean;
19
19
  labels: InteractiveGraphProps["labels"];
20
+ hintMode: boolean;
20
21
  };
21
22
  export declare const StatefulMafsGraph: React.ForwardRefExoticComponent<StatefulMafsGraphProps & React.RefAttributes<Partial<Widget>>>;
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Enables single or multiple answers selection using WonderBlocks dropdowns.
3
3
  */
4
- /// <reference types="react" />
5
4
  import { SingleSelect } from "@khanacademy/wonder-blocks-dropdown";
5
+ import * as React from "react";
6
6
  export type AnswerType = {
7
7
  content: string;
8
8
  checked: boolean;
@@ -15,5 +15,5 @@ type AnswerChoicesProps = {
15
15
  onToggle: (opened: boolean) => unknown;
16
16
  disabled: boolean;
17
17
  };
18
- declare const AnswerChoices: (props: AnswerChoicesProps) => JSX.Element;
18
+ declare const AnswerChoices: (props: AnswerChoicesProps) => React.JSX.Element;
19
19
  export default AnswerChoices;
@@ -1,6 +1,6 @@
1
1
  /// <reference path="../../../types/aphrodite.d.ts" />
2
- /// <reference types="react" />
3
2
  import { type CSSProperties } from "aphrodite";
3
+ import * as React from "react";
4
4
  export declare const AnswerPill: (props: {
5
5
  selectedAnswers: readonly string[];
6
6
  showCorrectness?: "correct" | "incorrect";
@@ -10,4 +10,4 @@ export declare const AnswerPill: (props: {
10
10
  hovered?: boolean;
11
11
  focused?: boolean;
12
12
  onClick?: () => void;
13
- }) => JSX.Element;
13
+ }) => React.JSX.Element;
@@ -3,4 +3,4 @@ import * as React from "react";
3
3
  export declare const HideAnswersToggle: (props: {
4
4
  areAnswersHidden: boolean;
5
5
  onChange: React.ComponentPropsWithoutRef<typeof Switch>["onChange"];
6
- }) => JSX.Element;
6
+ }) => React.JSX.Element;
@@ -31,7 +31,7 @@ export default class Marker extends React.Component<Props> {
31
31
  static defaultProps: {
32
32
  selected: ReadonlyArray<any>;
33
33
  };
34
- renderIcon(): JSX.Element;
34
+ renderIcon(): React.JSX.Element;
35
35
  render(): React.ReactNode;
36
36
  }
37
37
  export {};
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": "25.1.1",
6
+ "version": "26.1.0",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -41,11 +41,11 @@
41
41
  "dependencies": {
42
42
  "@khanacademy/kas": "^0.3.10",
43
43
  "@khanacademy/kmath": "^0.1.13",
44
- "@khanacademy/math-input": "^19.2.1",
44
+ "@khanacademy/math-input": "^20.0.1",
45
45
  "@khanacademy/perseus-core": "1.5.0",
46
46
  "@khanacademy/perseus-linter": "^1.0.0",
47
- "@khanacademy/pure-markdown": "^0.3.6",
48
- "@khanacademy/simple-markdown": "^0.12.1",
47
+ "@khanacademy/pure-markdown": "^0.3.7",
48
+ "@khanacademy/simple-markdown": "^0.13.0",
49
49
  "@use-gesture/react": "^10.2.27",
50
50
  "mafs": "0.18.7"
51
51
  },
@@ -61,7 +61,7 @@
61
61
  "@khanacademy/wonder-blocks-layout": "2.0.32",
62
62
  "@khanacademy/wonder-blocks-link": "6.1.1",
63
63
  "@khanacademy/wonder-blocks-pill": "2.2.1",
64
- "@khanacademy/wonder-blocks-popover": "3.2.2",
64
+ "@khanacademy/wonder-blocks-popover": "3.2.9",
65
65
  "@khanacademy/wonder-blocks-progress-spinner": "2.1.1",
66
66
  "@khanacademy/wonder-blocks-switch": "1.1.16",
67
67
  "@khanacademy/wonder-blocks-tokens": "1.3.0",
@@ -79,8 +79,8 @@
79
79
  "lodash.debounce": "^4.0.8",
80
80
  "perseus-build-settings": "^0.4.1",
81
81
  "prop-types": "15.6.1",
82
- "react": "16.14.0",
83
- "react-dom": "16.14.0",
82
+ "react": ">= 18",
83
+ "react-dom": ">= 18",
84
84
  "react-popper": "^2.2.5",
85
85
  "underscore": "^1.4.4"
86
86
  },
@@ -96,7 +96,7 @@
96
96
  "@khanacademy/wonder-blocks-layout": "2.0.32",
97
97
  "@khanacademy/wonder-blocks-link": "6.1.1",
98
98
  "@khanacademy/wonder-blocks-pill": "2.2.1",
99
- "@khanacademy/wonder-blocks-popover": "3.2.2",
99
+ "@khanacademy/wonder-blocks-popover": "3.2.9",
100
100
  "@khanacademy/wonder-blocks-progress-spinner": "2.1.1",
101
101
  "@khanacademy/wonder-blocks-switch": "1.1.16",
102
102
  "@khanacademy/wonder-blocks-tokens": "1.3.0",
@@ -112,8 +112,8 @@
112
112
  "jquery": "^2.1.1",
113
113
  "lodash.debounce": "^4.0.8",
114
114
  "prop-types": "15.6.1",
115
- "react": "16.14.0",
116
- "react-dom": "16.14.0",
115
+ "react": ">= 18",
116
+ "react-dom": ">= 18",
117
117
  "react-popper": "^2.2.5",
118
118
  "underscore": "^1.4.4"
119
119
  },