@khanacademy/perseus-editor 7.0.1 → 7.0.3

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,10 +1,11 @@
1
- import type { LockedFigure, LockedFigureType, LockedPointType, LockedLineType, LockedEllipseType, LockedVectorType, LockedPolygonType } from "@khanacademy/perseus";
1
+ import type { LockedFigure, LockedFigureType, LockedPointType, LockedLineType, LockedEllipseType, LockedVectorType, LockedPolygonType, LockedFunctionType } from "@khanacademy/perseus";
2
2
  export declare function focusWithChromeStickyFocusBugWorkaround(element: Element): void;
3
3
  export declare function getDefaultFigureForType(type: "point"): LockedPointType;
4
4
  export declare function getDefaultFigureForType(type: "line"): LockedLineType;
5
5
  export declare function getDefaultFigureForType(type: "vector"): LockedVectorType;
6
6
  export declare function getDefaultFigureForType(type: "ellipse"): LockedEllipseType;
7
7
  export declare function getDefaultFigureForType(type: "polygon"): LockedPolygonType;
8
+ export declare function getDefaultFigureForType(type: "function"): LockedFunctionType;
8
9
  export declare function getDefaultFigureForType(type: LockedFigureType): LockedFigure;
9
10
  export declare function degreeToRadian(degrees: number): number;
10
11
  export declare function radianToDegree(radians: number): number;
package/dist/es/index.js CHANGED
@@ -36,7 +36,7 @@ import Banner from '@khanacademy/wonder-blocks-banner';
36
36
 
37
37
  // This file is processed by a Rollup plugin (replace) to inject the production
38
38
  const libName = "@khanacademy/perseus-editor";
39
- const libVersion = "7.0.1";
39
+ const libVersion = "7.0.3";
40
40
  addLibraryVersionToPerseusDebug(libName, libVersion);
41
41
 
42
42
  function _extends() {
@@ -29679,6 +29679,14 @@ function getDefaultFigureForType(type) {
29679
29679
  fillStyle: "none",
29680
29680
  strokeStyle: "solid"
29681
29681
  };
29682
+ case "function":
29683
+ return {
29684
+ type: "function",
29685
+ color: DEFAULT_COLOR,
29686
+ strokeStyle: "solid",
29687
+ equation: "x^2",
29688
+ directionalAxis: "x"
29689
+ };
29682
29690
  default:
29683
29691
  throw new UnreachableCaseError(type);
29684
29692
  }
@@ -30957,6 +30965,12 @@ const LockedFiguresSection = props => {
30957
30965
  const buttonLabel = allCollapsed ? "Expand all" : "Collapse all";
30958
30966
  const showExpandButton = !!(figures != null && figures.length);
30959
30967
  return /*#__PURE__*/React.createElement(View, null, figures == null ? void 0 : figures.map((figure, index) => {
30968
+ if (figure.type === "function") {
30969
+ // TODO(LEMS-1947): Add locked function settings.
30970
+ // Remove this block once function locked figure settings are
30971
+ // implemented.
30972
+ return;
30973
+ }
30960
30974
  return /*#__PURE__*/React.createElement(LockedFigureSettings, _extends({
30961
30975
  key: `${uniqueId}-locked-${figure}-${index}`,
30962
30976
  showM2Features: props.showM2Features,
@@ -31732,15 +31746,6 @@ class InteractiveGraphEditor extends React.Component {
31732
31746
  UNSAFE_componentWillMount() {
31733
31747
  DeprecationMixin.UNSAFE_componentWillMount.call(this);
31734
31748
  }
31735
- static buildGraphKey(correct) {
31736
- const testGraphKey = [];
31737
- for (const key in correct) {
31738
- if (correct[key]) {
31739
- typeof correct[key] === "number" || typeof correct[key] === "string" || typeof correct[key] === "boolean" ? testGraphKey.push(correct[key]) : testGraphKey.push(0);
31740
- }
31741
- }
31742
- return testGraphKey.join(":");
31743
- }
31744
31749
  render() {
31745
31750
  var _this$props$graph$typ, _this$props$graph, _this$props$correct, _this$props$correct2, _this$props$correct3, _this$props$correct4, _this$props$correct5, _this$props$correct6, _this$props$correct7, _this$props$correct8, _this$props$correct9, _this$props$correct10, _this$props$correct11, _this$props$apiOption, _this$props$apiOption2, _this$props$apiOption3;
31746
31751
  let graph;
@@ -31784,9 +31789,6 @@ class InteractiveGraphEditor extends React.Component {
31784
31789
  });
31785
31790
  }
31786
31791
  };
31787
- // This is used to force a remount of the graph component
31788
- // when there's a significant change
31789
- const graphKey = InteractiveGraphEditor.buildGraphKey(correct);
31790
31792
  graph =
31791
31793
  /*#__PURE__*/
31792
31794
  // There are a bunch of props that renderer.jsx passes to widgets via
@@ -31794,7 +31796,6 @@ class InteractiveGraphEditor extends React.Component {
31794
31796
  // bother passing.
31795
31797
  // @ts-expect-error - TS2769 - No overload matches this call.
31796
31798
  React.createElement(InteractiveGraph, _extends({}, graphProps, {
31797
- key: graphKey,
31798
31799
  containerSizeClass: sizeClass,
31799
31800
  apiOptions: _extends({}, this.props.apiOptions, {
31800
31801
  isMobile: false