@khanacademy/perseus 19.3.0 → 19.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import type { Coord } from "../interactive2/types";
3
- import type { PerseusImageBackground } from "../perseus-types";
3
+ import type { PerseusImageBackground, LockedFigure } from "../perseus-types";
4
4
  import type { GridDimensions } from "../util";
5
5
  type Props = {
6
6
  box: [number, number];
@@ -17,6 +17,7 @@ type Props = {
17
17
  rulerTicks: number;
18
18
  instructions?: string;
19
19
  isMobile: boolean;
20
+ lockedFigures?: ReadonlyArray<LockedFigure>;
20
21
  onGraphieUpdated?: (graphie: any) => void;
21
22
  onClick?: (Coord: any) => void;
22
23
  onMouseDown?: (Coord: any) => void;
package/dist/es/index.js CHANGED
@@ -28042,6 +28042,33 @@ class Graph extends React.Component {
28042
28042
  allowScratchpad: true,
28043
28043
  setDrawingAreaAvailable: this.props.setDrawingAreaAvailable
28044
28044
  });
28045
+
28046
+ // Maybe move this out later
28047
+ if (this.props.lockedFigures) {
28048
+ for (const lockedFigure of this.props.lockedFigures) {
28049
+ switch (lockedFigure.type) {
28050
+ case "point":
28051
+ graphie.circle(
28052
+ // center
28053
+ lockedFigure.coord,
28054
+ // radius
28055
+ 0.2,
28056
+ // style
28057
+ lockedFigure.style);
28058
+ break;
28059
+ default:
28060
+ /**
28061
+ * Devlopment-time future-proofing: This `never` should
28062
+ * fail during type-checking if we add a new locked
28063
+ * shape type and forget to handle it in any other
28064
+ * switch case here.
28065
+ */
28066
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
28067
+ lockedFigure.type;
28068
+ throw new Error(`Unknown locked shape type: ${lockedFigure.type}`);
28069
+ }
28070
+ }
28071
+ }
28045
28072
  this._updateProtractor();
28046
28073
  this._updateRuler();
28047
28074
 
@@ -29422,7 +29449,8 @@ class InteractiveGraph extends React.Component {
29422
29449
  onMouseDown: onMouseDown,
29423
29450
  onGraphieUpdated: this.setGraphie,
29424
29451
  setDrawingAreaAvailable: this.props.apiOptions.setDrawingAreaAvailable,
29425
- isMobile: isMobile
29452
+ isMobile: isMobile,
29453
+ lockedFigures: this.props.lockedFigures
29426
29454
  }));
29427
29455
  }
29428
29456
  static getQuadraticCoefficients(coords) {
@@ -41552,7 +41580,7 @@ const init = function init(options) {
41552
41580
 
41553
41581
  // This file is processed by a Rollup plugin (replace) to inject the production
41554
41582
  const libName = "@khanacademy/perseus";
41555
- const libVersion = "19.3.0";
41583
+ const libVersion = "19.3.1";
41556
41584
  addLibraryVersionToPerseusDebug(libName, libVersion);
41557
41585
 
41558
41586
  const apiVersion = {