@khanacademy/perseus-editor 14.8.1 → 14.9.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.
package/dist/index.js CHANGED
@@ -98,7 +98,7 @@ var arrowCounterClockwise__default = /*#__PURE__*/_interopDefaultLegacy(arrowCou
98
98
 
99
99
  // This file is processed by a Rollup plugin (replace) to inject the production
100
100
  const libName = "@khanacademy/perseus-editor";
101
- const libVersion = "14.8.1";
101
+ const libVersion = "14.9.0";
102
102
  perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
103
103
 
104
104
  function _extends() {
@@ -24297,13 +24297,6 @@ class EditorPage extends React__namespace.Component {
24297
24297
  });
24298
24298
  this.props.onChange(newJson);
24299
24299
  };
24300
- scorePreview() {
24301
- // Do we actually ever set this.renderer anywhere in the codebase?
24302
- if (this.renderer) {
24303
- return this.renderer.scoreInput();
24304
- }
24305
- return null;
24306
- }
24307
24300
  render() {
24308
24301
  let className = "framework-perseus";
24309
24302
  const touch = this.props.previewDevice === "phone" || this.props.previewDevice === "tablet";
@@ -25617,10 +25610,6 @@ const StatefulEditorPage = createReactClass__default["default"]({
25617
25610
  this.setState(newState, cb);
25618
25611
  }
25619
25612
  },
25620
- scorePreview: function () {
25621
- // eslint-disable-next-line react/no-string-refs
25622
- return this.refs.editor.scorePreview();
25623
- },
25624
25613
  render: function () {
25625
25614
  const Component = this.props.componentClass;
25626
25615
  return /*#__PURE__*/React__namespace.createElement(Component, this.state);
@@ -31079,6 +31068,24 @@ function getDefaultFigureForType(type) {
31079
31068
  throw new wonderStuffCore.UnreachableCaseError(type);
31080
31069
  }
31081
31070
  }
31071
+ function generateLockedFigureAppearanceDescription(color) {
31072
+ let strokeStyle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "solid";
31073
+ let fill = arguments.length > 2 ? arguments[2] : undefined;
31074
+ const convertedColor = color === "grayH" ? "gray" : color;
31075
+ switch (fill) {
31076
+ case "none":
31077
+ return `. Appearance ${strokeStyle} ${convertedColor} border, with no fill.`;
31078
+ case "white":
31079
+ return `. Appearance ${strokeStyle} ${convertedColor} border, with a white fill.`;
31080
+ case "solid":
31081
+ case "translucent":
31082
+ return `. Appearance ${strokeStyle} ${convertedColor} border, with a ${fill} ${convertedColor} fill.`;
31083
+ case undefined:
31084
+ return `. Appearance ${strokeStyle} ${convertedColor}.`;
31085
+ default:
31086
+ throw new wonderStuffCore.UnreachableCaseError(fill);
31087
+ }
31088
+ }
31082
31089
 
31083
31090
  const {
31084
31091
  InfoTip: InfoTip$c
@@ -31103,7 +31110,7 @@ const LockedEllipseSettings = props => {
31103
31110
  function getPrepopulatedAriaLabel() {
31104
31111
  let visiblelabel = "";
31105
31112
  if (labels && labels.length > 0) {
31106
- visiblelabel += ` ${labels.map(l => l.text).join(" ")}`;
31113
+ visiblelabel += ` ${labels.map(l => l.text).join(", ")}`;
31107
31114
  }
31108
31115
  const isCircle = radius[0] === radius[1];
31109
31116
  let str = "";
@@ -31116,6 +31123,8 @@ const LockedEllipseSettings = props => {
31116
31123
  if (!isCircle && angle !== 0) {
31117
31124
  str += `, rotated by ${radianToDegree(angle)} degrees`;
31118
31125
  }
31126
+ const ellipseAppearance = generateLockedFigureAppearanceDescription(color, strokeStyle, fillStyle);
31127
+ str += ellipseAppearance;
31119
31128
  return str;
31120
31129
  }
31121
31130
  function handleCenterChange(newCoord) {
@@ -31376,6 +31385,8 @@ const LockedFunctionSettings = props => {
31376
31385
  if (domain && !(domain[0] === -Infinity && domain[1] === Infinity)) {
31377
31386
  str += `, domain from ${domain[0]} to ${domain[1]}`;
31378
31387
  }
31388
+ const functionAppearance = generateLockedFigureAppearanceDescription(lineColor, strokeStyle);
31389
+ str += functionAppearance;
31379
31390
  return str;
31380
31391
  }
31381
31392
 
@@ -31805,7 +31816,9 @@ const LockedPointSettings = props => {
31805
31816
  if (labels && labels.length > 0) {
31806
31817
  visiblelabel += ` ${labels.map(l => l.text).join(", ")}`;
31807
31818
  }
31808
- const str = `Point${visiblelabel} at (${coord[0]}, ${coord[1]})`;
31819
+ let str = `Point${visiblelabel} at (${coord[0]}, ${coord[1]})`;
31820
+ const pointAppearance = generateLockedFigureAppearanceDescription(pointColor);
31821
+ str += pointAppearance;
31809
31822
  return str;
31810
31823
  }
31811
31824
  function handleColorChange(newValue) {
@@ -32010,7 +32023,9 @@ const LockedLineSettings = props => {
32010
32023
  if (labels && labels.length > 0) {
32011
32024
  visiblelabel += ` ${labels.map(l => l.text).join(", ")}`;
32012
32025
  }
32013
- const str = `${capitalizeKind}${visiblelabel} from (${point1.coord[0]}, ${point1.coord[1]}) to (${point2.coord[0]}, ${point2.coord[1]})`;
32026
+ let str = `${capitalizeKind}${visiblelabel} from (${point1.coord[0]}, ${point1.coord[1]}) to (${point2.coord[0]}, ${point2.coord[1]})`;
32027
+ const lineAppearance = generateLockedFigureAppearanceDescription(lineColor, lineStyle);
32028
+ str += lineAppearance;
32014
32029
  return str;
32015
32030
  }
32016
32031
  function handleChangePoint(newPointProps, index) {
@@ -32289,6 +32304,8 @@ const LockedPolygonSettings = props => {
32289
32304
  let [x, y] = _ref;
32290
32305
  return `(${x}, ${y})`;
32291
32306
  }).join(", ");
32307
+ const polygonAppearance = generateLockedFigureAppearanceDescription(color, strokeStyle, fillStyle);
32308
+ str += polygonAppearance;
32292
32309
  return str;
32293
32310
  }
32294
32311
  function handleColorChange(newValue) {
@@ -32623,7 +32640,9 @@ const LockedVectorSettings = props => {
32623
32640
  if (labels && labels.length > 0) {
32624
32641
  visiblelabel += ` ${labels.map(l => l.text).join(", ")}`;
32625
32642
  }
32626
- const str = `Vector${visiblelabel} from (${tail[0]}, ${tail[1]}) to (${tip[0]}, ${tip[1]})`;
32643
+ let str = `Vector${visiblelabel} from (${tail[0]}, ${tail[1]}) to (${tip[0]}, ${tip[1]})`;
32644
+ const vectorAppearance = generateLockedFigureAppearanceDescription(lineColor);
32645
+ str += vectorAppearance;
32627
32646
  return str;
32628
32647
  }
32629
32648
  function handleChangePoint(newCoord, index) {
@@ -37735,6 +37754,7 @@ class RadioEditor extends React__namespace.Component {
37735
37754
  editMode: true,
37736
37755
  labelWrap: false,
37737
37756
  apiOptions: this.props.apiOptions,
37757
+ reviewMode: false,
37738
37758
  choices: this.props.choices.map((choice, i) => {
37739
37759
  return {
37740
37760
  content: /*#__PURE__*/React__namespace.createElement(ChoiceEditor, {