@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.
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- export type CheckboxProps = {
2
+ type CheckboxProps = {
3
3
  checked: boolean;
4
4
  disabled?: boolean;
5
5
  appearDisabled?: boolean;
@@ -18,3 +18,4 @@ export default class Checkbox extends React.Component<CheckboxProps> {
18
18
  };
19
19
  render(): React.ReactNode;
20
20
  }
21
+ export {};
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- export type OptionRenderer = (children: React.ReactElement<any> | null | undefined, value: string, selected: boolean, disabled?: boolean) => React.ReactElement<any>;
2
+ type OptionRenderer = (children: React.ReactElement<any> | null | undefined, value: string, selected: boolean, disabled?: boolean) => React.ReactElement<any>;
3
3
  type Props = {
4
4
  value: string;
5
5
  children?: React.ReactNode;
@@ -12,7 +12,6 @@ type Props = {
12
12
  testId?: string;
13
13
  ariaLabel?: string;
14
14
  };
15
- export declare const optionHeight = 30;
16
15
  declare class Option extends React.Component<Props> {
17
16
  node: HTMLDivElement;
18
17
  handleKeyDown(event: any): void;
@@ -2,7 +2,6 @@ import * as React from "react";
2
2
  import CombinedHintsEditor from "./hint-editor";
3
3
  import ItemEditor from "./item-editor";
4
4
  import type { APIOptions, APIOptionsWithDefaults, ChangeHandler, DeviceType, Hint, ImageUploader, Version, PerseusItem } from "@khanacademy/perseus";
5
- import type { KEScore } from "@khanacademy/perseus-core";
6
5
  type Props = {
7
6
  apiOptions?: APIOptions;
8
7
  answerArea?: any;
@@ -51,7 +50,6 @@ declare class EditorPage extends React.Component<Props, State> {
51
50
  }): any | PerseusItem;
52
51
  handleChange: ChangeHandler;
53
52
  changeJSON: (newJson: PerseusItem) => void;
54
- scorePreview(): KEScore | null | undefined;
55
53
  render(): React.ReactNode;
56
54
  }
57
55
  export default EditorPage;
package/dist/es/index.js CHANGED
@@ -46,7 +46,7 @@ import arrowCounterClockwise from '@phosphor-icons/core/bold/arrow-counter-clock
46
46
 
47
47
  // This file is processed by a Rollup plugin (replace) to inject the production
48
48
  const libName = "@khanacademy/perseus-editor";
49
- const libVersion = "14.8.1";
49
+ const libVersion = "14.9.0";
50
50
  addLibraryVersionToPerseusDebug(libName, libVersion);
51
51
 
52
52
  function _extends() {
@@ -24285,13 +24285,6 @@ class EditorPage extends React.Component {
24285
24285
  hints: (_this$hintsEditor$cur2 = this.hintsEditor.current) == null ? void 0 : _this$hintsEditor$cur2.serialize(options)
24286
24286
  });
24287
24287
  }
24288
- scorePreview() {
24289
- // Do we actually ever set this.renderer anywhere in the codebase?
24290
- if (this.renderer) {
24291
- return this.renderer.scoreInput();
24292
- }
24293
- return null;
24294
- }
24295
24288
  render() {
24296
24289
  let className = "framework-perseus";
24297
24290
  const touch = this.props.previewDevice === "phone" || this.props.previewDevice === "tablet";
@@ -25617,10 +25610,6 @@ const StatefulEditorPage = createReactClass({
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.createElement(Component, this.state);
@@ -30969,6 +30958,22 @@ function getDefaultFigureForType(type) {
30969
30958
  throw new UnreachableCaseError(type);
30970
30959
  }
30971
30960
  }
30961
+ function generateLockedFigureAppearanceDescription(color, strokeStyle = "solid", fill) {
30962
+ const convertedColor = color === "grayH" ? "gray" : color;
30963
+ switch (fill) {
30964
+ case "none":
30965
+ return `. Appearance ${strokeStyle} ${convertedColor} border, with no fill.`;
30966
+ case "white":
30967
+ return `. Appearance ${strokeStyle} ${convertedColor} border, with a white fill.`;
30968
+ case "solid":
30969
+ case "translucent":
30970
+ return `. Appearance ${strokeStyle} ${convertedColor} border, with a ${fill} ${convertedColor} fill.`;
30971
+ case undefined:
30972
+ return `. Appearance ${strokeStyle} ${convertedColor}.`;
30973
+ default:
30974
+ throw new UnreachableCaseError(fill);
30975
+ }
30976
+ }
30972
30977
 
30973
30978
  const {
30974
30979
  InfoTip: InfoTip$c
@@ -30994,7 +30999,7 @@ const LockedEllipseSettings = props => {
30994
30999
  function getPrepopulatedAriaLabel() {
30995
31000
  let visiblelabel = "";
30996
31001
  if (labels && labels.length > 0) {
30997
- visiblelabel += ` ${labels.map(l => l.text).join(" ")}`;
31002
+ visiblelabel += ` ${labels.map(l => l.text).join(", ")}`;
30998
31003
  }
30999
31004
  const isCircle = radius[0] === radius[1];
31000
31005
  let str = "";
@@ -31007,6 +31012,8 @@ const LockedEllipseSettings = props => {
31007
31012
  if (!isCircle && angle !== 0) {
31008
31013
  str += `, rotated by ${radianToDegree(angle)} degrees`;
31009
31014
  }
31015
+ const ellipseAppearance = generateLockedFigureAppearanceDescription(color, strokeStyle, fillStyle);
31016
+ str += ellipseAppearance;
31010
31017
  return str;
31011
31018
  }
31012
31019
  function handleCenterChange(newCoord) {
@@ -31263,6 +31270,8 @@ const LockedFunctionSettings = props => {
31263
31270
  if (domain && !(domain[0] === -Infinity && domain[1] === Infinity)) {
31264
31271
  str += `, domain from ${domain[0]} to ${domain[1]}`;
31265
31272
  }
31273
+ const functionAppearance = generateLockedFigureAppearanceDescription(lineColor, strokeStyle);
31274
+ str += functionAppearance;
31266
31275
  return str;
31267
31276
  }
31268
31277
 
@@ -31689,7 +31698,9 @@ const LockedPointSettings = props => {
31689
31698
  if (labels && labels.length > 0) {
31690
31699
  visiblelabel += ` ${labels.map(l => l.text).join(", ")}`;
31691
31700
  }
31692
- const str = `Point${visiblelabel} at (${coord[0]}, ${coord[1]})`;
31701
+ let str = `Point${visiblelabel} at (${coord[0]}, ${coord[1]})`;
31702
+ const pointAppearance = generateLockedFigureAppearanceDescription(pointColor);
31703
+ str += pointAppearance;
31693
31704
  return str;
31694
31705
  }
31695
31706
  function handleColorChange(newValue) {
@@ -31890,7 +31901,9 @@ const LockedLineSettings = props => {
31890
31901
  if (labels && labels.length > 0) {
31891
31902
  visiblelabel += ` ${labels.map(l => l.text).join(", ")}`;
31892
31903
  }
31893
- const str = `${capitalizeKind}${visiblelabel} from (${point1.coord[0]}, ${point1.coord[1]}) to (${point2.coord[0]}, ${point2.coord[1]})`;
31904
+ let str = `${capitalizeKind}${visiblelabel} from (${point1.coord[0]}, ${point1.coord[1]}) to (${point2.coord[0]}, ${point2.coord[1]})`;
31905
+ const lineAppearance = generateLockedFigureAppearanceDescription(lineColor, lineStyle);
31906
+ str += lineAppearance;
31894
31907
  return str;
31895
31908
  }
31896
31909
  function handleChangePoint(newPointProps, index) {
@@ -32156,6 +32169,8 @@ const LockedPolygonSettings = props => {
32156
32169
 
32157
32170
  // Add the coordinates of each point to the aria label
32158
32171
  str += points.map(([x, y]) => `(${x}, ${y})`).join(", ");
32172
+ const polygonAppearance = generateLockedFigureAppearanceDescription(color, strokeStyle, fillStyle);
32173
+ str += polygonAppearance;
32159
32174
  return str;
32160
32175
  }
32161
32176
  function handleColorChange(newValue) {
@@ -32471,7 +32486,9 @@ const LockedVectorSettings = props => {
32471
32486
  if (labels && labels.length > 0) {
32472
32487
  visiblelabel += ` ${labels.map(l => l.text).join(", ")}`;
32473
32488
  }
32474
- const str = `Vector${visiblelabel} from (${tail[0]}, ${tail[1]}) to (${tip[0]}, ${tip[1]})`;
32489
+ let str = `Vector${visiblelabel} from (${tail[0]}, ${tail[1]}) to (${tip[0]}, ${tip[1]})`;
32490
+ const vectorAppearance = generateLockedFigureAppearanceDescription(lineColor);
32491
+ str += vectorAppearance;
32475
32492
  return str;
32476
32493
  }
32477
32494
  function handleChangePoint(newCoord, index) {
@@ -37423,6 +37440,7 @@ class RadioEditor extends React.Component {
37423
37440
  editMode: true,
37424
37441
  labelWrap: false,
37425
37442
  apiOptions: this.props.apiOptions,
37443
+ reviewMode: false,
37426
37444
  choices: this.props.choices.map((choice, i) => {
37427
37445
  return {
37428
37446
  content: /*#__PURE__*/React.createElement(ChoiceEditor, {