@khanacademy/perseus-editor 14.1.0 → 14.1.2

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/index.js CHANGED
@@ -95,7 +95,7 @@ var arrowCounterClockwise__default = /*#__PURE__*/_interopDefaultLegacy(arrowCou
95
95
 
96
96
  // This file is processed by a Rollup plugin (replace) to inject the production
97
97
  const libName = "@khanacademy/perseus-editor";
98
- const libVersion = "14.1.0";
98
+ const libVersion = "14.1.2";
99
99
  perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
100
100
 
101
101
  function _extends() {
@@ -29880,34 +29880,20 @@ const getAngleEquation = startCoords => {
29880
29880
  const roundedAngle = angle.toFixed(0);
29881
29881
  return `${roundedAngle}\u00B0 angle at (${vertex[0]}, ${vertex[1]})`;
29882
29882
  };
29883
- const shouldShowStartCoordsUI = (flags, graph) => {
29884
- // TODO(LEMS-2228): Remove flags once this is fully released
29885
- const startCoordsUiPhase1Types = ["linear", "linear-system", "ray", "segment", "circle"];
29886
- const startCoordsUiPhase2Types = ["sinusoid", "quadratic"];
29887
- const startCoordsPhase1 = flags?.mafs?.["start-coords-ui-phase-1"];
29888
- const startCoordsPhase2 = flags?.mafs?.["start-coords-ui-phase-2"];
29889
- const startCoordsPoint = flags?.mafs?.["start-coords-ui-point"];
29890
- const startCoordsPolygon = flags?.mafs?.["start-coords-ui-polygon"];
29891
- const startCoordsAngle = flags?.mafs?.["start-coords-ui-angle"];
29892
- if (startCoordsPhase1 && startCoordsUiPhase1Types.includes(graph.type)) {
29893
- return true;
29894
- }
29895
- if (startCoordsPhase2 && startCoordsUiPhase2Types.includes(graph.type)) {
29896
- return true;
29897
- }
29898
- if (startCoordsAngle && graph.type === "angle") {
29899
- return true;
29883
+ const shouldShowStartCoordsUI = (graph, isStatic) => {
29884
+ // We don't show the start coords UI for static graphs, since
29885
+ // the coords shown for this are determined by the coords on the
29886
+ // "correct" graph. The start coords would not be used here.
29887
+ if (isStatic) {
29888
+ return false;
29900
29889
  }
29901
- if (startCoordsPoint && graph.type === "point" && graph.numPoints !== "unlimited") {
29902
- return true;
29890
+ if (graph.type === "point" && graph.numPoints === "unlimited") {
29891
+ return false;
29903
29892
  }
29904
- if (startCoordsPolygon && graph.type === "polygon" && graph.numSides !== "unlimited" && (
29905
- // Pre-initialized graph with undefined snapTo value
29906
- // initializes to snapTo="grid"
29907
- graph.snapTo === "grid" || graph.snapTo === undefined)) {
29908
- return true;
29893
+ if (graph.type === "polygon" && (graph.numSides === "unlimited" || graph.snapTo === "angles" || graph.snapTo === "sides")) {
29894
+ return false;
29909
29895
  }
29910
- return false;
29896
+ return true;
29911
29897
  };
29912
29898
 
29913
29899
  /**
@@ -29922,10 +29908,7 @@ const LockedFigureSelect = props => {
29922
29908
  id,
29923
29909
  onChange
29924
29910
  } = props;
29925
- const figureTypes = ["point", "line", "vector", "ellipse", "polygon"];
29926
- if (props.showM2bFeatures) {
29927
- figureTypes.push("function");
29928
- }
29911
+ const figureTypes = ["point", "line", "vector", "ellipse", "polygon", "function"];
29929
29912
  if (props.showLabelsFlag) {
29930
29913
  figureTypes.push("label");
29931
29914
  }
@@ -31626,10 +31609,7 @@ const LockedFigureSettings = props => {
31626
31609
  case "polygon":
31627
31610
  return /*#__PURE__*/React__namespace.createElement(LockedPolygonSettings, props);
31628
31611
  case "function":
31629
- if (props.showM2bFeatures) {
31630
- return /*#__PURE__*/React__namespace.createElement(LockedFunctionSettings, props);
31631
- }
31632
- break;
31612
+ return /*#__PURE__*/React__namespace.createElement(LockedFunctionSettings, props);
31633
31613
  case "label":
31634
31614
  if (props.showLabelsFlag) {
31635
31615
  return /*#__PURE__*/React__namespace.createElement(LockedLabelSettings, props);
@@ -31742,7 +31722,6 @@ const LockedFiguresSection = props => {
31742
31722
  }), isExpanded && /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, figures?.map((figure, index) => {
31743
31723
  return /*#__PURE__*/React__namespace.createElement(LockedFigureSettings, _extends({
31744
31724
  key: `${uniqueId}-locked-${figure}-${index}`,
31745
- showM2bFeatures: props.showM2bFeatures,
31746
31725
  showLabelsFlag: props.showLabelsFlag,
31747
31726
  expanded: expandedStates[index],
31748
31727
  onToggle: newValue => {
@@ -31758,7 +31737,6 @@ const LockedFiguresSection = props => {
31758
31737
  }), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
31759
31738
  style: styles$n.buttonContainer
31760
31739
  }, /*#__PURE__*/React__namespace.createElement(LockedFigureSelect, {
31761
- showM2bFeatures: props.showM2bFeatures,
31762
31740
  showLabelsFlag: props.showLabelsFlag,
31763
31741
  id: `${uniqueId}-select`,
31764
31742
  onChange: addLockedFigure
@@ -31914,24 +31892,20 @@ function InteractiveGraphDescription(props) {
31914
31892
  value: ariaLabelValue,
31915
31893
  onChange: newValue => onChange({
31916
31894
  fullGraphAriaLabel: newValue
31917
- })
31895
+ }),
31896
+ style: styles$k.spaceAbove
31918
31897
  })), /*#__PURE__*/React__namespace.createElement(Strut, {
31919
- size: wonderBlocksTokens.spacing.xSmall_8
31898
+ size: wonderBlocksTokens.spacing.small_12
31920
31899
  }), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, {
31921
31900
  tag: "label"
31922
- // TODO(LEMS-2332): Remove this style prop after
31923
- // switching to WB TextArea
31924
- ,
31925
- style: {
31926
- display: "flex",
31927
- flexDirection: "column"
31928
- }
31929
- }, "Description", /*#__PURE__*/React__namespace.createElement("textarea", {
31901
+ }, "Description", /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextArea, {
31930
31902
  rows: 8,
31903
+ resizeType: "vertical",
31931
31904
  value: ariaDescriptionValue,
31932
- onChange: e => onChange({
31933
- fullGraphAriaDescription: e.target.value
31934
- })
31905
+ onChange: newValue => onChange({
31906
+ fullGraphAriaDescription: newValue
31907
+ }),
31908
+ style: styles$k.spaceAbove
31935
31909
  }))));
31936
31910
  }
31937
31911
  const styles$k = aphrodite.StyleSheet.create({
@@ -31939,6 +31913,9 @@ const styles$k = aphrodite.StyleSheet.create({
31939
31913
  color: wonderBlocksTokens.color.offBlack64,
31940
31914
  paddingTop: wonderBlocksTokens.spacing.xxSmall_6,
31941
31915
  paddingBottom: wonderBlocksTokens.spacing.xxSmall_6
31916
+ },
31917
+ spaceAbove: {
31918
+ marginTop: wonderBlocksTokens.spacing.xxxSmall_4
31942
31919
  }
31943
31920
  });
31944
31921
 
@@ -33202,9 +33179,7 @@ class InteractiveGraphEditor extends React__namespace.Component {
33202
33179
  }
33203
33180
  });
33204
33181
  }
33205
- })), this.props.graph?.type &&
33206
- // TODO(LEMS-2228): Remove flags once this is fully released
33207
- shouldShowStartCoordsUI(this.props.apiOptions.flags, this.props.graph) && /*#__PURE__*/React__namespace.createElement(StartCoordsSettings, _extends({}, this.props.graph, {
33182
+ })), this.props.graph?.type && shouldShowStartCoordsUI(this.props.graph, this.props.static) && /*#__PURE__*/React__namespace.createElement(StartCoordsSettings, _extends({}, this.props.graph, {
33208
33183
  range: this.props.range,
33209
33184
  step: this.props.step,
33210
33185
  onChange: this.changeStartCoords
@@ -33291,7 +33266,6 @@ class InteractiveGraphEditor extends React__namespace.Component {
33291
33266
  // Only show the "Add locked figure" dropdown if the graph
33292
33267
  // is using Mafs.
33293
33268
  this.props.graph && this.props.apiOptions?.flags?.mafs?.[this.props.graph.type] && /*#__PURE__*/React__namespace.createElement(LockedFiguresSection, {
33294
- showM2bFeatures: this.props.apiOptions?.flags?.mafs?.["interactive-graph-locked-features-m2b"],
33295
33269
  showLabelsFlag: this.props.apiOptions?.flags?.mafs?.["interactive-graph-locked-features-labels"],
33296
33270
  figures: this.props.lockedFigures,
33297
33271
  onChange: this.props.onChange