@khanacademy/perseus-editor 6.6.0 → 6.7.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.
@@ -8,6 +8,7 @@
8
8
  import type { Props as LockedLineProps } from "./locked-line-settings";
9
9
  import type { Props as LockedPointProps } from "./locked-point-settings";
10
10
  export type AccordionProps = {
11
+ showM2Features?: boolean;
11
12
  /**
12
13
  * Whether this accordion is expanded.
13
14
  */
@@ -2,6 +2,7 @@
2
2
  import type { Props as InteractiveGraphEditorProps } from "../widgets/interactive-graph-editor";
3
3
  import type { LockedFigure } from "@khanacademy/perseus";
4
4
  type Props = {
5
+ showM2Features?: boolean;
5
6
  figures?: Array<LockedFigure>;
6
7
  onChange: (props: Partial<InteractiveGraphEditorProps>) => void;
7
8
  };
package/dist/es/index.js CHANGED
@@ -29,7 +29,7 @@ import trashIcon from '@phosphor-icons/core/bold/trash-bold.svg';
29
29
 
30
30
  // This file is processed by a Rollup plugin (replace) to inject the production
31
31
  const libName = "@khanacademy/perseus-editor";
32
- const libVersion = "6.6.0";
32
+ const libVersion = "6.7.0";
33
33
  addLibraryVersionToPerseusDebug(libName, libVersion);
34
34
 
35
35
  function _extends() {
@@ -30918,6 +30918,15 @@ function getDefaultFigureForType(type) {
30918
30918
  showPoint1: false,
30919
30919
  showPoint2: false
30920
30920
  };
30921
+ case "circle":
30922
+ return {
30923
+ type: "circle",
30924
+ center: [0, 0],
30925
+ radius: 1,
30926
+ color: DEFAULT_COLOR,
30927
+ fillStyle: "none",
30928
+ strokeStyle: "solid"
30929
+ };
30921
30930
  default:
30922
30931
  throw new UnreachableCaseError(type);
30923
30932
  }
@@ -30972,18 +30981,27 @@ const LockedFiguresSection = props => {
30972
30981
  const allCollapsed = expandedStates.every(value => !value);
30973
30982
  const buttonLabel = allCollapsed ? "Expand all" : "Collapse all";
30974
30983
  const showExpandButton = !!(figures != null && figures.length);
30975
- return /*#__PURE__*/React.createElement(View, null, figures == null ? void 0 : figures.map((figure, index) => /*#__PURE__*/React.createElement(LockedFigureSettings, _extends({
30976
- expanded: expandedStates[index],
30977
- onToggle: newValue => {
30978
- const newExpanded = [...expandedStates];
30979
- newExpanded[index] = newValue;
30980
- setExpandedStates(newExpanded);
30981
- },
30982
- key: `${uniqueId}-locked-${figure}-${index}`
30983
- }, figure, {
30984
- onChangeProps: newProps => changeProps(index, newProps),
30985
- onRemove: () => removeLockedFigure(index)
30986
- }))), /*#__PURE__*/React.createElement(View, {
30984
+ return /*#__PURE__*/React.createElement(View, null, figures == null ? void 0 : figures.map((figure, index) => {
30985
+ if (figure.type === "circle") {
30986
+ // TODO(LEMS-1941): Implement circle locked figure settings.
30987
+ // Remove this block once circle locked figure settings are
30988
+ // implemented.
30989
+ return;
30990
+ }
30991
+ return /*#__PURE__*/React.createElement(LockedFigureSettings, _extends({
30992
+ showM2Features: props.showM2Features,
30993
+ expanded: expandedStates[index],
30994
+ onToggle: newValue => {
30995
+ const newExpanded = [...expandedStates];
30996
+ newExpanded[index] = newValue;
30997
+ setExpandedStates(newExpanded);
30998
+ },
30999
+ key: `${uniqueId}-locked-${figure}-${index}`
31000
+ }, figure, {
31001
+ onChangeProps: newProps => changeProps(index, newProps),
31002
+ onRemove: () => removeLockedFigure(index)
31003
+ }));
31004
+ }), /*#__PURE__*/React.createElement(View, {
30987
31005
  style: styles$c.buttonContainer
30988
31006
  }, /*#__PURE__*/React.createElement(LockedFigureSelect, {
30989
31007
  id: `${uniqueId}-select`,
@@ -31099,7 +31117,7 @@ class InteractiveGraphEditor extends React.Component {
31099
31117
  DeprecationMixin.UNSAFE_componentWillMount.call(this);
31100
31118
  }
31101
31119
  render() {
31102
- 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;
31120
+ 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;
31103
31121
  let graph;
31104
31122
  let equationString;
31105
31123
  const gridStep = this.props.gridStep || Util.getGridStep(this.props.range, this.props.step, interactiveSizes.defaultBoxSize);
@@ -31351,6 +31369,7 @@ class InteractiveGraphEditor extends React.Component {
31351
31369
  // Only show the "Add locked figure" dropdown if the graph
31352
31370
  // is using Mafs.
31353
31371
  this.props.graph && ((_this$props$apiOption = this.props.apiOptions) == null || (_this$props$apiOption = _this$props$apiOption.flags) == null || (_this$props$apiOption = _this$props$apiOption.mafs) == null ? void 0 : _this$props$apiOption["interactive-graph-locked-features-m1"]) && ((_this$props$apiOption2 = this.props.apiOptions) == null || (_this$props$apiOption2 = _this$props$apiOption2.flags) == null || (_this$props$apiOption2 = _this$props$apiOption2.mafs) == null ? void 0 : _this$props$apiOption2[this.props.graph.type]) && /*#__PURE__*/React.createElement(LockedFiguresSection, {
31372
+ showM2Features: (_this$props$apiOption3 = this.props.apiOptions) == null || (_this$props$apiOption3 = _this$props$apiOption3.flags) == null || (_this$props$apiOption3 = _this$props$apiOption3.mafs) == null ? void 0 : _this$props$apiOption3["interactive-graph-locked-features-m2"],
31354
31373
  figures: this.props.lockedFigures,
31355
31374
  onChange: this.props.onChange
31356
31375
  }));