@khanacademy/perseus-editor 17.1.0 → 17.1.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.
package/dist/es/index.js CHANGED
@@ -45,7 +45,7 @@ import arrowCounterClockwise from '@phosphor-icons/core/bold/arrow-counter-clock
45
45
 
46
46
  // This file is processed by a Rollup plugin (replace) to inject the production
47
47
  const libName = "@khanacademy/perseus-editor";
48
- const libVersion = "17.1.0";
48
+ const libVersion = "17.1.1";
49
49
  addLibraryVersionToPerseusDebug(libName, libVersion);
50
50
 
51
51
  function _extends() {
@@ -29038,7 +29038,7 @@ const LockedFigureSelect = props => {
29038
29038
  id,
29039
29039
  onChange
29040
29040
  } = props;
29041
- const figureTypes = ["point", "line", "vector", "ellipse", "polygon", "function", ...(props.showLabelsFlag ? ["label"] : [])];
29041
+ const figureTypes = ["point", "line", "vector", "ellipse", "polygon", "function", "label"];
29042
29042
  return /*#__PURE__*/React.createElement(View, {
29043
29043
  style: styles$C.container
29044
29044
  }, /*#__PURE__*/React.createElement(ActionMenu, {
@@ -94289,9 +94289,7 @@ const {
94289
94289
  InfoTip: InfoTip$c
94290
94290
  } = components;
94291
94291
  const LockedEllipseSettings = props => {
94292
- var _flags$mafs, _flags$mafs2;
94293
94292
  const {
94294
- flags,
94295
94293
  center,
94296
94294
  radius,
94297
94295
  angle,
@@ -94439,7 +94437,7 @@ const LockedEllipseSettings = props => {
94439
94437
  onChange: value => onChangeProps({
94440
94438
  strokeStyle: value
94441
94439
  })
94442
- }), (flags == null || (_flags$mafs = flags["mafs"]) == null ? void 0 : _flags$mafs["locked-figures-aria"]) && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Strut, {
94440
+ }), /*#__PURE__*/React.createElement(Strut, {
94443
94441
  size: spacing.small_12
94444
94442
  }), /*#__PURE__*/React.createElement(View, {
94445
94443
  style: styles$r.horizontalRule
@@ -94449,7 +94447,7 @@ const LockedEllipseSettings = props => {
94449
94447
  onChangeProps: newProps => {
94450
94448
  onChangeProps(newProps);
94451
94449
  }
94452
- })), (flags == null || (_flags$mafs2 = flags["mafs"]) == null ? void 0 : _flags$mafs2["locked-ellipse-labels"]) && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Strut, {
94450
+ }), /*#__PURE__*/React.createElement(Strut, {
94453
94451
  size: spacing.xxxSmall_4
94454
94452
  }), /*#__PURE__*/React.createElement(View, {
94455
94453
  style: styles$r.horizontalRule
@@ -94483,7 +94481,7 @@ const LockedEllipseSettings = props => {
94483
94481
  });
94484
94482
  },
94485
94483
  style: styles$r.addButton
94486
- }, "Add visible label")), /*#__PURE__*/React.createElement(LockedFigureSettingsActions, {
94484
+ }, "Add visible label"), /*#__PURE__*/React.createElement(LockedFigureSettingsActions, {
94487
94485
  figureType: props.type,
94488
94486
  onMove: onMove,
94489
94487
  onRemove: onRemove
@@ -94547,9 +94545,7 @@ const examples = {
94547
94545
  };
94548
94546
 
94549
94547
  const LockedFunctionSettings = props => {
94550
- var _flags$mafs, _flags$mafs2;
94551
94548
  const {
94552
- flags,
94553
94549
  color: lineColor,
94554
94550
  strokeStyle,
94555
94551
  equation,
@@ -94764,7 +94760,7 @@ const LockedFunctionSettings = props => {
94764
94760
  example: example,
94765
94761
  index: index,
94766
94762
  pasteEquationFn: handlePropChange
94767
- })))), (flags == null || (_flags$mafs = flags["mafs"]) == null ? void 0 : _flags$mafs["locked-figures-aria"]) && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Strut, {
94763
+ })))), /*#__PURE__*/React.createElement(Strut, {
94768
94764
  size: spacing.small_12
94769
94765
  }), /*#__PURE__*/React.createElement(View, {
94770
94766
  style: styles$p.horizontalRule
@@ -94774,7 +94770,7 @@ const LockedFunctionSettings = props => {
94774
94770
  onChangeProps: newProps => {
94775
94771
  onChangeProps(newProps);
94776
94772
  }
94777
- })), (flags == null || (_flags$mafs2 = flags["mafs"]) == null ? void 0 : _flags$mafs2["locked-function-labels"]) && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Strut, {
94773
+ }), /*#__PURE__*/React.createElement(Strut, {
94778
94774
  size: spacing.xxxSmall_4
94779
94775
  }), /*#__PURE__*/React.createElement(View, {
94780
94776
  style: styles$p.horizontalRule
@@ -94808,7 +94804,7 @@ const LockedFunctionSettings = props => {
94808
94804
  });
94809
94805
  },
94810
94806
  style: styles$p.addButton
94811
- }, "Add visible label")), /*#__PURE__*/React.createElement(LockedFigureSettingsActions, {
94807
+ }, "Add visible label"), /*#__PURE__*/React.createElement(LockedFigureSettingsActions, {
94812
94808
  figureType: props.type,
94813
94809
  onMove: onMove,
94814
94810
  onRemove: onRemove
@@ -94980,9 +94976,7 @@ const styles$o = StyleSheet.create({
94980
94976
  });
94981
94977
 
94982
94978
  const LockedPointSettings = props => {
94983
- var _flags$mafs, _flags$mafs2, _flags$mafs3;
94984
94979
  const {
94985
- flags,
94986
94980
  headerLabel,
94987
94981
  coord,
94988
94982
  color: pointColor,
@@ -95103,7 +95097,7 @@ const LockedPointSettings = props => {
95103
95097
  filled: !newValue
95104
95098
  });
95105
95099
  }
95106
- })), !isDefiningPoint && (flags == null || (_flags$mafs = flags["mafs"]) == null ? void 0 : _flags$mafs["locked-figures-aria"]) && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Strut, {
95100
+ })), !isDefiningPoint && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Strut, {
95107
95101
  size: spacing.small_12
95108
95102
  }), /*#__PURE__*/React.createElement(View, {
95109
95103
  style: styles$n.horizontalRule
@@ -95113,7 +95107,7 @@ const LockedPointSettings = props => {
95113
95107
  onChangeProps: newProps => {
95114
95108
  onChangeProps(newProps);
95115
95109
  }
95116
- })), (!isDefiningPoint && (flags == null || (_flags$mafs2 = flags["mafs"]) == null ? void 0 : _flags$mafs2["locked-point-labels"]) || isDefiningPoint && (flags == null || (_flags$mafs3 = flags["mafs"]) == null ? void 0 : _flags$mafs3["locked-line-labels"])) && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Strut, {
95110
+ })), /*#__PURE__*/React.createElement(Strut, {
95117
95111
  size: spacing.xxxSmall_4
95118
95112
  }), /*#__PURE__*/React.createElement(View, {
95119
95113
  style: styles$n.horizontalRule
@@ -95150,7 +95144,7 @@ const LockedPointSettings = props => {
95150
95144
  });
95151
95145
  },
95152
95146
  style: styles$n.addButton
95153
- }, "Add visible label")), onRemove && /*#__PURE__*/React.createElement(LockedFigureSettingsActions, {
95147
+ }, "Add visible label"), onRemove && /*#__PURE__*/React.createElement(LockedFigureSettingsActions, {
95154
95148
  figureType: props.type,
95155
95149
  onMove: onMove,
95156
95150
  onRemove: onRemove
@@ -95191,9 +95185,7 @@ const styles$n = StyleSheet.create({
95191
95185
 
95192
95186
  const lengthZeroStr = "The line cannot have length 0.";
95193
95187
  const LockedLineSettings = props => {
95194
- var _flags$mafs, _flags$mafs2;
95195
95188
  const {
95196
- flags,
95197
95189
  kind,
95198
95190
  points,
95199
95191
  color: lineColor,
@@ -95335,7 +95327,6 @@ const LockedLineSettings = props => {
95335
95327
  })), isInvalid && /*#__PURE__*/React.createElement(LabelMedium, {
95336
95328
  style: styles$m.errorText
95337
95329
  }, lengthZeroStr), /*#__PURE__*/React.createElement(LockedPointSettings, _extends({
95338
- flags: flags,
95339
95330
  headerLabel: "Point 1",
95340
95331
  expanded: true,
95341
95332
  showPoint: showPoint1,
@@ -95346,7 +95337,6 @@ const LockedLineSettings = props => {
95346
95337
  }),
95347
95338
  onChangeProps: newProps => handleChangePoint(newProps, 0)
95348
95339
  })), /*#__PURE__*/React.createElement(LockedPointSettings, _extends({
95349
- flags: flags,
95350
95340
  headerLabel: "Point 2",
95351
95341
  expanded: true,
95352
95342
  showPoint: showPoint2,
@@ -95356,7 +95346,7 @@ const LockedLineSettings = props => {
95356
95346
  showPoint2: newValue
95357
95347
  }),
95358
95348
  onChangeProps: newProps => handleChangePoint(newProps, 1)
95359
- })), (flags == null || (_flags$mafs = flags["mafs"]) == null ? void 0 : _flags$mafs["locked-figures-aria"]) && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Strut, {
95349
+ })), /*#__PURE__*/React.createElement(Strut, {
95360
95350
  size: spacing.small_12
95361
95351
  }), /*#__PURE__*/React.createElement(View, {
95362
95352
  style: styles$m.horizontalRule
@@ -95366,7 +95356,7 @@ const LockedLineSettings = props => {
95366
95356
  onChangeProps: newProps => {
95367
95357
  onChangeProps(newProps);
95368
95358
  }
95369
- })), (flags == null || (_flags$mafs2 = flags["mafs"]) == null ? void 0 : _flags$mafs2["locked-line-labels"]) && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Strut, {
95359
+ }), /*#__PURE__*/React.createElement(Strut, {
95370
95360
  size: spacing.xxxSmall_4
95371
95361
  }), /*#__PURE__*/React.createElement(View, {
95372
95362
  style: styles$m.horizontalRule
@@ -95401,7 +95391,7 @@ const LockedLineSettings = props => {
95401
95391
  });
95402
95392
  },
95403
95393
  style: styles$m.addButton
95404
- }, "Add visible label")), /*#__PURE__*/React.createElement(LockedFigureSettingsActions, {
95394
+ }, "Add visible label"), /*#__PURE__*/React.createElement(LockedFigureSettingsActions, {
95405
95395
  figureType: props.type,
95406
95396
  onMove: onMove,
95407
95397
  onRemove: onRemove
@@ -95467,9 +95457,7 @@ const styles$l = StyleSheet.create({
95467
95457
  });
95468
95458
 
95469
95459
  const LockedPolygonSettings = props => {
95470
- var _flags$mafs, _flags$mafs2;
95471
95460
  const {
95472
- flags,
95473
95461
  points,
95474
95462
  color,
95475
95463
  showVertices,
@@ -95694,7 +95682,7 @@ const LockedPolygonSettings = props => {
95694
95682
  size: "small",
95695
95683
  icon: arrowFatRight,
95696
95684
  onClick: () => handlePolygonMove("right")
95697
- }))))), (flags == null || (_flags$mafs = flags["mafs"]) == null ? void 0 : _flags$mafs["locked-figures-aria"]) && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Strut, {
95685
+ }))))), /*#__PURE__*/React.createElement(Strut, {
95698
95686
  size: spacing.small_12
95699
95687
  }), /*#__PURE__*/React.createElement(View, {
95700
95688
  style: styles$k.horizontalRule
@@ -95704,7 +95692,7 @@ const LockedPolygonSettings = props => {
95704
95692
  onChangeProps: newProps => {
95705
95693
  onChangeProps(newProps);
95706
95694
  }
95707
- })), (flags == null || (_flags$mafs2 = flags["mafs"]) == null ? void 0 : _flags$mafs2["locked-polygon-labels"]) && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Strut, {
95695
+ }), /*#__PURE__*/React.createElement(Strut, {
95708
95696
  size: spacing.xxxSmall_4
95709
95697
  }), /*#__PURE__*/React.createElement(View, {
95710
95698
  style: styles$k.horizontalRule
@@ -95738,7 +95726,7 @@ const LockedPolygonSettings = props => {
95738
95726
  });
95739
95727
  },
95740
95728
  style: styles$k.addButton
95741
- }, "Add visible label")), /*#__PURE__*/React.createElement(LockedFigureSettingsActions, {
95729
+ }, "Add visible label"), /*#__PURE__*/React.createElement(LockedFigureSettingsActions, {
95742
95730
  figureType: props.type,
95743
95731
  onMove: onMove,
95744
95732
  onRemove: onRemove
@@ -95793,9 +95781,7 @@ const styles$k = StyleSheet.create({
95793
95781
 
95794
95782
  const lengthErrorMessage = "The vector cannot have length 0.";
95795
95783
  const LockedVectorSettings = props => {
95796
- var _flags$mafs, _flags$mafs2;
95797
95784
  const {
95798
- flags,
95799
95785
  points,
95800
95786
  color: lineColor,
95801
95787
  labels,
@@ -95915,7 +95901,7 @@ const LockedVectorSettings = props => {
95915
95901
  onChange: newProps => {
95916
95902
  handleChangePoint(newProps, 1);
95917
95903
  }
95918
- })), (flags == null || (_flags$mafs = flags["mafs"]) == null ? void 0 : _flags$mafs["locked-figures-aria"]) && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Strut, {
95904
+ })), /*#__PURE__*/React.createElement(Strut, {
95919
95905
  size: spacing.small_12
95920
95906
  }), /*#__PURE__*/React.createElement(View, {
95921
95907
  style: styles$j.horizontalRule
@@ -95925,7 +95911,7 @@ const LockedVectorSettings = props => {
95925
95911
  onChangeProps: newProps => {
95926
95912
  onChangeProps(newProps);
95927
95913
  }
95928
- })), (flags == null || (_flags$mafs2 = flags["mafs"]) == null ? void 0 : _flags$mafs2["locked-vector-labels"]) && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Strut, {
95914
+ }), /*#__PURE__*/React.createElement(Strut, {
95929
95915
  size: spacing.xxxSmall_4
95930
95916
  }), /*#__PURE__*/React.createElement(View, {
95931
95917
  style: styles$j.horizontalRule
@@ -95960,7 +95946,7 @@ const LockedVectorSettings = props => {
95960
95946
  });
95961
95947
  },
95962
95948
  style: styles$j.addButton
95963
- }, "Add visible label")), /*#__PURE__*/React.createElement(LockedFigureSettingsActions, {
95949
+ }, "Add visible label"), /*#__PURE__*/React.createElement(LockedFigureSettingsActions, {
95964
95950
  figureType: props.type,
95965
95951
  onMove: onMove,
95966
95952
  onRemove: onRemove
@@ -96021,12 +96007,10 @@ const LockedFigureSettings = props => {
96021
96007
  case "function":
96022
96008
  return /*#__PURE__*/React.createElement(LockedFunctionSettings, props);
96023
96009
  case "label":
96024
- if (props.showLabelsFlag) {
96025
- return /*#__PURE__*/React.createElement(LockedLabelSettings, props);
96026
- }
96027
- break;
96010
+ return /*#__PURE__*/React.createElement(LockedLabelSettings, props);
96011
+ default:
96012
+ throw new UnreachableCaseError(props);
96028
96013
  }
96029
- return null;
96030
96014
  };
96031
96015
 
96032
96016
  const LockedFiguresSection = props => {
@@ -96130,8 +96114,6 @@ const LockedFiguresSection = props => {
96130
96114
  }), isExpanded && /*#__PURE__*/React.createElement(View, null, figures == null ? void 0 : figures.map((figure, index) => {
96131
96115
  return /*#__PURE__*/React.createElement(LockedFigureSettings, _extends({
96132
96116
  key: `${uniqueId}-locked-${figure}-${index}`,
96133
- flags: props.flags,
96134
- showLabelsFlag: props.showLabelsFlag,
96135
96117
  expanded: expandedStates[index],
96136
96118
  onToggle: newValue => {
96137
96119
  const newExpanded = [...expandedStates];
@@ -96146,7 +96128,6 @@ const LockedFiguresSection = props => {
96146
96128
  }), /*#__PURE__*/React.createElement(View, {
96147
96129
  style: styles$i.buttonContainer
96148
96130
  }, /*#__PURE__*/React.createElement(LockedFigureSelect, {
96149
- showLabelsFlag: props.showLabelsFlag,
96150
96131
  id: `${uniqueId}-select`,
96151
96132
  onChange: addLockedFigure
96152
96133
  }), /*#__PURE__*/React.createElement(Strut, {
@@ -96821,7 +96802,7 @@ class InteractiveGraphEditor extends React.Component {
96821
96802
  return json;
96822
96803
  }
96823
96804
  render() {
96824
- var _this$props$graph$typ, _this$props$graph3, _this$props$apiOption, _this$props$apiOption2, _this$props$fullGraph, _this$props$fullGraph2, _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$correct12, _this$props$correct13, _this$props$correct14, _this$props$graph12, _this$props$apiOption3, _this$props$apiOption4;
96805
+ var _this$props$graph$typ, _this$props$graph3, _this$props$apiOption, _this$props$apiOption2, _this$props$fullGraph, _this$props$fullGraph2, _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$correct12, _this$props$correct13, _this$props$correct14, _this$props$graph12, _this$props$apiOption3;
96825
96806
  let graph;
96826
96807
  let equationString;
96827
96808
  const gridStep = this.props.gridStep || Util.getGridStep(this.props.range, this.props.step, interactiveSizes.defaultBoxSize);
@@ -97165,8 +97146,6 @@ class InteractiveGraphEditor extends React.Component {
97165
97146
  // Only show the "Add locked figure" dropdown if the graph
97166
97147
  // is using Mafs.
97167
97148
  this.props.graph && ((_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[this.props.graph.type]) && /*#__PURE__*/React.createElement(LockedFiguresSection, {
97168
- flags: this.props.apiOptions.flags,
97169
- showLabelsFlag: (_this$props$apiOption4 = this.props.apiOptions) == null || (_this$props$apiOption4 = _this$props$apiOption4.flags) == null || (_this$props$apiOption4 = _this$props$apiOption4.mafs) == null ? void 0 : _this$props$apiOption4["interactive-graph-locked-features-labels"],
97170
97149
  figures: this.props.lockedFigures,
97171
97150
  onChange: this.props.onChange
97172
97151
  }));