@khanacademy/perseus-editor 2.0.1 → 2.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @khanacademy/perseus-editor
2
2
 
3
+ ## 2.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [90c1833e]
8
+ - @khanacademy/perseus@4.0.2
9
+
3
10
  ## 2.0.1
4
11
 
5
12
  ### Patch Changes
package/dist/es/index.js CHANGED
@@ -1002,7 +1002,6 @@ class Editor extends React.Component {
1002
1002
  }, function () {
1003
1003
  Util.textarea.moveCursor(
1004
1004
  // findDOMNode can return Text but we know this is Element
1005
- // $FlowFixMe[incompatible-call]
1006
1005
  // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'Element | Text | null' is not assignable to parameter of type 'HTMLTextAreaElement'.
1007
1006
  textarea,
1008
1007
  // We want to put the cursor after the widget
@@ -1856,7 +1855,6 @@ class ArticleEditor extends React.Component {
1856
1855
  }
1857
1856
  ArticleEditor.defaultProps = {
1858
1857
  contentPaths: [],
1859
- // $FlowFixMe[incompatible-exact]
1860
1858
  json: [{}],
1861
1859
  mode: "edit",
1862
1860
  screen: "desktop",
@@ -4601,7 +4599,7 @@ class ModeDropdown extends React.Component {
4601
4599
  this._handleSelectMode = event => {
4602
4600
  if (this.props.onChange) {
4603
4601
  // event.target.value corresponds to the options' values below which
4604
- // are limited to EditorMode, but flow doesn't know that so we have
4602
+ // are limited to EditorMode, but TypeScript doesn't know that so we have
4605
4603
  // to cast through any here.
4606
4604
  const value = event.target.value;
4607
4605
  this.props.onChange(value);
@@ -4835,7 +4833,7 @@ const NodeContent = props => {
4835
4833
 
4836
4834
  // All uses of `data` have been cast through any which isn't safe. This was
4837
4835
  // done to avoid introducing new logic which may have resulted in a change
4838
- // of behavior. Also, there doesn't appear to be a way to tell flow the
4836
+ // of behavior. Also, there doesn't appear to be a way to tell TypeScript the
4839
4837
  // difference between and `TagsNode` and `ItemArrayNode`, see
4840
4838
  // perseus-all-package/multi-items/item-types.js.
4841
4839
  if (shape.type === "content") {
@@ -4914,12 +4912,6 @@ const withStickiness = WrappedComponent => {
4914
4912
  render() {
4915
4913
  return (
4916
4914
  /*#__PURE__*/
4917
- /**
4918
- * $FlowFixMe[incompatible-exact]
4919
- * TODO(somewhatabstract, JIRA-XXXX):
4920
- * Cannot create WrappedComponent element because inexact props
4921
- * [1] is incompatible with exact WithStickiness [2].
4922
- */
4923
4915
  // @ts-expect-error [FEI-5003] - TS2322 - Type 'Readonly<Config> & { sticky: boolean; children?: ReactNode; }' is not assignable to type 'IntrinsicAttributes & LibraryManagedAttributes<Component, PropsWithChildren<WithStickiness<Config>>>'.
4924
4916
  React.createElement(WrappedComponent, _extends({}, this.props, {
4925
4917
  sticky: this.state.sticky
@@ -4948,9 +4940,6 @@ const ItemNodeContent = withStickiness(props => {
4948
4940
  className: css(sticky && styles$c.sticky)
4949
4941
  },
4950
4942
  /*#__PURE__*/
4951
- // $FlowFixMe[incompatible-exact]: {...data} pass too many props
4952
- // $FlowFixMe[incompatible-type]
4953
- // $FlowFixMe[prop-missing]
4954
4943
  // @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
4955
4944
  React.createElement(Editor, _extends({}, data, {
4956
4945
  onChange: newVal => actions.mergeValueAtPath(path, newVal),
@@ -5054,10 +5043,7 @@ const ArrayNodeContent = props => {
5054
5043
  onClick: () => actions.moveArrayElementUp(subpath)
5055
5044
  }, /*#__PURE__*/React.createElement("div", {
5056
5045
  className: css(styles$c.verticalFlip)
5057
- }, /*#__PURE__*/React.createElement(InlineIcon$7, iconChevronDown)))),
5058
- // $FlowFixMe[unsafe-addition]
5059
- // $FlowFixMe[prop-missing]
5060
- i < data.length - 1 && /*#__PURE__*/React.createElement("div", {
5046
+ }, /*#__PURE__*/React.createElement(InlineIcon$7, iconChevronDown)))), i < data.length - 1 && /*#__PURE__*/React.createElement("div", {
5061
5047
  key: "moveArrayElementDown",
5062
5048
  className: css(styles$c.control)
5063
5049
  }, /*#__PURE__*/React.createElement(SimpleButton, {
@@ -5677,14 +5663,10 @@ class PairEditor$1 extends React.Component {
5677
5663
  return /*#__PURE__*/React.createElement("fieldset", {
5678
5664
  className: "pair-editor"
5679
5665
  }, /*#__PURE__*/React.createElement("label", null, "Name:", " ", /*#__PURE__*/React.createElement(BlurInput, {
5680
- value: this.props.name
5681
- // $FlowFixMe[incompatible-type] single-param call returns a callback
5682
- ,
5666
+ value: this.props.name,
5683
5667
  onChange: this.change("name")
5684
5668
  })), /*#__PURE__*/React.createElement("label", null, " ", "Value:", " ", /*#__PURE__*/React.createElement(BlurInput, {
5685
- value: this.props.value
5686
- // $FlowFixMe[incompatible-type] single-param call returns a callback
5687
- ,
5669
+ value: this.props.value,
5688
5670
  onChange: this.change("value")
5689
5671
  })));
5690
5672
  }
@@ -6790,10 +6772,7 @@ class ExpressionEditor extends React.Component {
6790
6772
  })), /*#__PURE__*/React.createElement(InfoTip$j, null, /*#__PURE__*/React.createElement("p", null, "Single-letter variables listed here will be interpreted as functions. This let us know that f(x) means \"f of x\" and not \"f times x\"."))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, "Button sets:"), buttonSetChoices), this.state.isTex && /*#__PURE__*/React.createElement(TexButtons, {
6791
6773
  className: "math-input-buttons",
6792
6774
  sets: this.props.buttonSets,
6793
- convertDotToTimes: this.props.times
6794
- // onInsert is typed as `(string | ((input: $FlowFixMe) => void)) => void`
6795
- // $FlowFixMe[incompatible-type]
6796
- ,
6775
+ convertDotToTimes: this.props.times,
6797
6776
  onInsert: this.handleTexInsert
6798
6777
  }), /*#__PURE__*/React.createElement("h3", {
6799
6778
  className: "expression-editor-h3"
@@ -7662,7 +7641,6 @@ class GrapherEditor extends React.Component {
7662
7641
  // NOTE(jeremy): This editor doesn't pass in a bunch of
7663
7642
  // standard props that the Renderer provides normally (eg.
7664
7643
  // alignment, findWidgets, etc).
7665
- // $FlowFixMe[prop-missing]
7666
7644
  // @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
7667
7645
  React.createElement(Grapher, _extends({}, graphProps, {
7668
7646
  apiOptions: this.props.apiOptions,
@@ -7789,14 +7767,10 @@ class PairEditor extends React.Component {
7789
7767
  }
7790
7768
  render() {
7791
7769
  return /*#__PURE__*/React.createElement("fieldset", null, /*#__PURE__*/React.createElement("label", null, "Name:", /*#__PURE__*/React.createElement(BlurInput, {
7792
- value: this.props.name
7793
- // $FlowFixMe[incompatible-type] single-param call returns a callback
7794
- ,
7770
+ value: this.props.name,
7795
7771
  onChange: this.change("name")
7796
7772
  })), /*#__PURE__*/React.createElement("label", null, "Value:", /*#__PURE__*/React.createElement(BlurInput, {
7797
- value: this.props.value
7798
- // $FlowFixMe[incompatible-type] single-param call returns a callback
7799
- ,
7773
+ value: this.props.value,
7800
7774
  onChange: this.change("value")
7801
7775
  })));
7802
7776
  }
@@ -8264,9 +8238,7 @@ class InputNumberEditor extends React.Component {
8264
8238
  disabled: !this.props.inexact,
8265
8239
  defaultValue: this.props.maxError,
8266
8240
  onBlur: e => {
8267
- const ans = "" + (
8268
- // $FlowFixMe[incompatible-type]
8269
- Util.firstNumericalParse(e.target.value) || 0);
8241
+ const ans = "" + (Util.firstNumericalParse(e.target.value) || 0);
8270
8242
  e.target.value = ans;
8271
8243
  this.props.onChange({
8272
8244
  maxError: ans
@@ -9613,7 +9585,6 @@ const InteractiveGraphEditor = createReactClass({
9613
9585
  // There are a bunch of props that renderer.jsx passes to widgets via
9614
9586
  // getWidgetProps() and widget-container.jsx that the editors don't
9615
9587
  // bother passing.
9616
- // $FlowFixMe[prop-missing]
9617
9588
  // @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
9618
9589
  React.createElement(InteractiveGraph, _extends({}, graphProps, {
9619
9590
  containerSizeClass: sizeClass,
@@ -10497,9 +10468,6 @@ class Option extends React.Component {
10497
10468
  ariaLabel
10498
10469
  } = this.props;
10499
10470
  return /*#__PURE__*/React.createElement("button", {
10500
- // TODO(mdr): We found a new Flow error when upgrading:
10501
- // "node (null) This type is incompatible with this.node (HTMLDivElement)"
10502
- // $FlowFixMe[incompatible-type](0.52.0->0.53.0)
10503
10471
  // @ts-expect-error [FEI-5003] - TS2322 - Type 'HTMLButtonElement | null' is not assignable to type 'HTMLDivElement'.
10504
10472
  ref: node => this.node = node,
10505
10473
  value: value,
@@ -10510,11 +10478,6 @@ class Option extends React.Component {
10510
10478
  ,
10511
10479
  onClick: value => {
10512
10480
  if (!disabled && onClick) {
10513
- // TODO(mdr): We found a new Flow error here when upgrading
10514
- // from 0.35.0 to 0.52.0: "value (unused function
10515
- // argument)". This comment was automatically added to
10516
- // this file, to suppress the error for now. Please
10517
- // consider fixing!
10518
10481
  // @ts-expect-error [FEI-5003] - TS2554 - Expected 0 arguments, but got 1.
10519
10482
  onClick(value);
10520
10483
  }
@@ -10771,7 +10734,6 @@ class Marker extends React.Component {
10771
10734
  }), /*#__PURE__*/React.createElement(OptionGroup, {
10772
10735
  onSelected: this.handleSelectAnswer
10773
10736
  // TODO(WB-1096): make selectedValues immutable in wonder-blocks
10774
- // $FlowFixMe[incompatible-type]
10775
10737
  // @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
10776
10738
  ,
10777
10739
  selectedValues: answers
@@ -14520,7 +14482,6 @@ class TransformationsShapeEditor extends React.Component {
14520
14482
  };
14521
14483
  this.updateCoords = () => {
14522
14484
  this.props.onChange({
14523
- // $FlowFixMe[prop-missing]
14524
14485
  // @ts-expect-error [FEI-5003] - TS2339 - Property 'shape' does not exist on type 'TransformationsShapeEditor'.
14525
14486
  shape: this.shape.toJSON()
14526
14487
  });