@khanacademy/perseus-editor 2.6.0 → 2.6.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.
Files changed (180) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/article-editor.d.ts +1 -2
  3. package/dist/components/form-wrapped-text-field.d.ts +1 -10
  4. package/dist/components/graph-points-count-selector.d.ts +1 -1
  5. package/dist/es/index.js +414 -436
  6. package/dist/es/index.js.map +1 -1
  7. package/dist/index.js +411 -435
  8. package/dist/index.js.map +1 -1
  9. package/dist/widgets/input-number-editor.d.ts +1 -2
  10. package/dist/widgets/interactive-graph-editor.d.ts +48 -47
  11. package/dist/widgets/plotter-editor.d.ts +47 -23
  12. package/package.json +12 -12
  13. package/src/__stories__/editor.stories.tsx +3 -1
  14. package/src/__tests__/i18n.test.ts +1 -1
  15. package/src/article-editor.tsx +13 -14
  16. package/src/components/checkbox.tsx +2 -1
  17. package/src/components/dropdown-option.tsx +13 -12
  18. package/src/components/form-wrapped-text-field.tsx +5 -2
  19. package/src/components/graph-points-count-selector.tsx +3 -1
  20. package/src/components/graph-settings.tsx +1 -1
  21. package/src/components/hover-behavior.ts +2 -2
  22. package/src/components/json-editor.tsx +2 -2
  23. package/src/components/sortable.tsx +1 -1
  24. package/src/components/util.ts +1 -1
  25. package/src/components/widget-editor.tsx +8 -7
  26. package/src/diffs/__tests__/structured-item-diff.test.ts +8 -8
  27. package/src/diffs/renderer-diff.tsx +3 -3
  28. package/src/diffs/split-diff.ts +2 -2
  29. package/src/diffs/structured-item-diff.tsx +11 -10
  30. package/src/diffs/text-diff.tsx +1 -1
  31. package/src/diffs/widget-diff.tsx +2 -2
  32. package/src/editor-page.tsx +8 -8
  33. package/src/editor.tsx +37 -36
  34. package/src/hint-editor.tsx +28 -27
  35. package/src/i18n.ts +4 -4
  36. package/src/iframe-content-renderer.tsx +10 -10
  37. package/src/item-editor.tsx +4 -4
  38. package/src/katex-mhchem/parser.js +24 -24
  39. package/src/multirenderer-editor.tsx +11 -11
  40. package/src/widgets/__stories__/label-image-editor.stories.tsx +1 -0
  41. package/src/widgets/__stories__/radio-editor.stories.tsx +1 -0
  42. package/src/widgets/categorizer-editor.tsx +3 -3
  43. package/src/widgets/cs-program-editor.tsx +2 -2
  44. package/src/widgets/definition-editor.tsx +3 -2
  45. package/src/widgets/dropdown-editor.tsx +9 -8
  46. package/src/widgets/example-graphie-widget-editor.tsx +1 -1
  47. package/src/widgets/example-graphie-widget.tsx +2 -2
  48. package/src/widgets/example-widget-editor.tsx +2 -2
  49. package/src/widgets/example-widget.tsx +4 -3
  50. package/src/widgets/explanation-editor.tsx +4 -3
  51. package/src/widgets/expression-editor.tsx +9 -9
  52. package/src/widgets/graded-group-editor.tsx +7 -6
  53. package/src/widgets/graded-group-set-editor.tsx +3 -3
  54. package/src/widgets/grapher-editor.tsx +3 -2
  55. package/src/widgets/group-editor.tsx +4 -3
  56. package/src/widgets/iframe-editor.tsx +5 -4
  57. package/src/widgets/input-number-editor.tsx +6 -6
  58. package/src/widgets/interaction-editor.tsx +103 -102
  59. package/src/widgets/interactive-graph-editor.tsx +12 -8
  60. package/src/widgets/label-image/marker.tsx +2 -1
  61. package/src/widgets/label-image/question-markers.tsx +1 -1
  62. package/src/widgets/lights-puzzle-editor.tsx +5 -4
  63. package/src/widgets/matrix-editor.tsx +2 -2
  64. package/src/widgets/measurer-editor.tsx +7 -6
  65. package/src/widgets/molecule-editor.tsx +2 -2
  66. package/src/widgets/number-line-editor.tsx +2 -1
  67. package/src/widgets/numeric-input-editor.tsx +2 -2
  68. package/src/widgets/orderer-editor.tsx +3 -2
  69. package/src/widgets/passage-editor.tsx +3 -3
  70. package/src/widgets/passage-ref-editor.tsx +4 -3
  71. package/src/widgets/passage-ref-target-editor.tsx +1 -1
  72. package/src/widgets/plotter-editor.tsx +253 -243
  73. package/src/widgets/radio/editor.tsx +3 -3
  74. package/src/widgets/reaction-diagram-editor.tsx +5 -5
  75. package/src/widgets/sequence-editor.tsx +1 -1
  76. package/src/widgets/simple-markdown-tester-editor.tsx +4 -3
  77. package/src/widgets/simple-markdown-tester.tsx +2 -2
  78. package/src/widgets/simulator-editor.tsx +1 -1
  79. package/src/widgets/sorter-editor.tsx +2 -1
  80. package/src/widgets/table-editor.tsx +1 -1
  81. package/src/widgets/transformer-editor.tsx +10 -10
  82. package/src/widgets/unit-editor.tsx +5 -5
  83. package/tsconfig-build.tsbuildinfo +1 -1
  84. package/dist/all-editors.js.flow +0 -8
  85. package/dist/all-widgets.js.flow +0 -34
  86. package/dist/article-editor.js.flow +0 -72
  87. package/dist/components/blur-input.js.flow +0 -25
  88. package/dist/components/checkbox.js.flow +0 -26
  89. package/dist/components/device-framer.js.flow +0 -20
  90. package/dist/components/drag-target.js.flow +0 -8
  91. package/dist/components/dropdown-option.js.flow +0 -49
  92. package/dist/components/form-wrapped-text-field.js.flow +0 -45
  93. package/dist/components/graph-points-count-selector.js.flow +0 -12
  94. package/dist/components/graph-settings.js.flow +0 -8
  95. package/dist/components/graph-type-selector.js.flow +0 -12
  96. package/dist/components/hover-behavior.js.flow +0 -48
  97. package/dist/components/json-editor.js.flow +0 -8
  98. package/dist/components/link.js.flow +0 -50
  99. package/dist/components/section-control-button.js.flow +0 -25
  100. package/dist/components/segment-count-selector.js.flow +0 -11
  101. package/dist/components/simple-button.js.flow +0 -18
  102. package/dist/components/sortable.js.flow +0 -8
  103. package/dist/components/util.js.flow +0 -9
  104. package/dist/components/viewport-resizer.js.flow +0 -22
  105. package/dist/components/widget-editor.js.flow +0 -91
  106. package/dist/components/widget-select.js.flow +0 -16
  107. package/dist/diffs/article-diff.js.flow +0 -71
  108. package/dist/diffs/item-diff.js.flow +0 -41
  109. package/dist/diffs/renderer-diff.js.flow +0 -25
  110. package/dist/diffs/split-diff.js.flow +0 -8
  111. package/dist/diffs/string-array-diff.js.flow +0 -11
  112. package/dist/diffs/structured-item-diff.js.flow +0 -37
  113. package/dist/diffs/tags-diff.js.flow +0 -24
  114. package/dist/diffs/text-diff.js.flow +0 -21
  115. package/dist/diffs/widget-diff-performer.js.flow +0 -8
  116. package/dist/diffs/widget-diff.js.flow +0 -31
  117. package/dist/editor-page.js.flow +0 -72
  118. package/dist/editor.js.flow +0 -96
  119. package/dist/hint-editor.js.flow +0 -87
  120. package/dist/i18n.js.flow +0 -13
  121. package/dist/iframe-content-renderer.js.flow +0 -28
  122. package/dist/index.js.flow +0 -23
  123. package/dist/item-editor.js.flow +0 -46
  124. package/dist/item-extras-editor.js.flow +0 -23
  125. package/dist/katex-error-view.js.flow +0 -24
  126. package/dist/multirenderer-editor.js.flow +0 -46
  127. package/dist/stateful-article-editor.js.flow +0 -16
  128. package/dist/stateful-editor-page.js.flow +0 -8
  129. package/dist/testing-widgets.js.flow +0 -34
  130. package/dist/util/points.js.flow +0 -9
  131. package/dist/util/register-all-widgets-and-editors-for-testing.js.flow +0 -7
  132. package/dist/widgets/categorizer-editor.js.flow +0 -62
  133. package/dist/widgets/cs-program-editor.js.flow +0 -25
  134. package/dist/widgets/definition-editor.js.flow +0 -23
  135. package/dist/widgets/dropdown-editor.js.flow +0 -37
  136. package/dist/widgets/example-graphie-widget-editor.js.flow +0 -25
  137. package/dist/widgets/example-graphie-widget.js.flow +0 -102
  138. package/dist/widgets/example-widget-editor.js.flow +0 -26
  139. package/dist/widgets/example-widget.js.flow +0 -86
  140. package/dist/widgets/explanation-editor.js.flow +0 -27
  141. package/dist/widgets/expression-editor.js.flow +0 -43
  142. package/dist/widgets/graded-group-editor.js.flow +0 -68
  143. package/dist/widgets/graded-group-set-editor.js.flow +0 -66
  144. package/dist/widgets/grapher-editor.js.flow +0 -21
  145. package/dist/widgets/group-editor.js.flow +0 -64
  146. package/dist/widgets/iframe-editor.js.flow +0 -24
  147. package/dist/widgets/image-editor.js.flow +0 -8
  148. package/dist/widgets/input-number-editor.js.flow +0 -77
  149. package/dist/widgets/interaction/constraint-editor.js.flow +0 -35
  150. package/dist/widgets/interaction-editor.js.flow +0 -36
  151. package/dist/widgets/interactive-graph-editor.js.flow +0 -5803
  152. package/dist/widgets/label-image/answer-choices.js.flow +0 -16
  153. package/dist/widgets/label-image/behavior.js.flow +0 -17
  154. package/dist/widgets/label-image/marker.js.flow +0 -32
  155. package/dist/widgets/label-image/question-markers.js.flow +0 -23
  156. package/dist/widgets/label-image/select-image.js.flow +0 -13
  157. package/dist/widgets/label-image-editor.js.flow +0 -44
  158. package/dist/widgets/lights-puzzle-editor.js.flow +0 -34
  159. package/dist/widgets/matcher-editor.js.flow +0 -28
  160. package/dist/widgets/matrix-editor.js.flow +0 -26
  161. package/dist/widgets/measurer-editor.js.flow +0 -42
  162. package/dist/widgets/molecule-editor.js.flow +0 -23
  163. package/dist/widgets/number-line-editor.js.flow +0 -45
  164. package/dist/widgets/numeric-input-editor.js.flow +0 -8
  165. package/dist/widgets/orderer-editor.js.flow +0 -30
  166. package/dist/widgets/passage-editor.js.flow +0 -24
  167. package/dist/widgets/passage-ref-editor.js.flow +0 -17
  168. package/dist/widgets/passage-ref-target-editor.js.flow +0 -22
  169. package/dist/widgets/plotter-editor.js.flow +0 -53
  170. package/dist/widgets/radio/editor.js.flow +0 -81
  171. package/dist/widgets/reaction-diagram-editor.js.flow +0 -26
  172. package/dist/widgets/sequence-editor.js.flow +0 -73
  173. package/dist/widgets/simple-markdown-tester-editor.js.flow +0 -23
  174. package/dist/widgets/simple-markdown-tester.js.flow +0 -61
  175. package/dist/widgets/simulator-editor.js.flow +0 -26
  176. package/dist/widgets/sorter-editor.js.flow +0 -22
  177. package/dist/widgets/table-editor.js.flow +0 -24
  178. package/dist/widgets/transformer-editor.js.flow +0 -17
  179. package/dist/widgets/unit-editor.js.flow +0 -41
  180. package/dist/widgets/video-editor.js.flow +0 -25
@@ -946,7 +946,7 @@ mhchemParser.stateMachines = {
946
946
  },
947
947
  },
948
948
  oxidation$: {
949
- "0": {action_: "oxidation-output"},
949
+ 0: {action_: "oxidation-output"},
950
950
  },
951
951
  CMT: {
952
952
  r: {action_: "rdt=", nextState: "rt"},
@@ -975,7 +975,7 @@ mhchemParser.stateMachines = {
975
975
  q: {action_: "d=", nextState: "qd"},
976
976
  "qd|qD": {action_: "d=", nextState: "qd"},
977
977
  dq: {action_: ["output", "d="], nextState: "d"},
978
- "3": {
978
+ 3: {
979
979
  action_: ["sb=false", "output", "operator"],
980
980
  nextState: "0",
981
981
  },
@@ -1038,7 +1038,7 @@ mhchemParser.stateMachines = {
1038
1038
  ],
1039
1039
  nextState: "3",
1040
1040
  },
1041
- "3": {action_: {type_: "bond", option: "-"}},
1041
+ 3: {action_: {type_: "bond", option: "-"}},
1042
1042
  a: {
1043
1043
  action_: ["output", {type_: "insert", option: "hyphen"}],
1044
1044
  nextState: "2",
@@ -1087,7 +1087,7 @@ mhchemParser.stateMachines = {
1087
1087
  },
1088
1088
  space: {
1089
1089
  a: {nextState: "as"},
1090
- "0": {action_: "sb=false"},
1090
+ 0: {action_: "sb=false"},
1091
1091
  "1|2": {action_: "sb=true"},
1092
1092
  "r|rt|rd|rdt|rdq": {action_: "output", nextState: "0"},
1093
1093
  "*": {action_: ["output", "sb=true"], nextState: "1"},
@@ -1605,10 +1605,10 @@ mhchemParser.stateMachines = {
1605
1605
  "*": {},
1606
1606
  },
1607
1607
  "1/2$": {
1608
- "0": {action_: "1/2"},
1608
+ 0: {action_: "1/2"},
1609
1609
  },
1610
1610
  else: {
1611
- "0": {nextState: "1", revisit: true},
1611
+ 0: {nextState: "1", revisit: true},
1612
1612
  },
1613
1613
  "$(...)$": {
1614
1614
  "*": {action_: "tex-math tight", nextState: "1"},
@@ -1628,10 +1628,10 @@ mhchemParser.stateMachines = {
1628
1628
  "*": {},
1629
1629
  },
1630
1630
  "1/2$": {
1631
- "0": {action_: "1/2"},
1631
+ 0: {action_: "1/2"},
1632
1632
  },
1633
1633
  else: {
1634
- "0": {nextState: "1", revisit: true},
1634
+ 0: {nextState: "1", revisit: true},
1635
1635
  },
1636
1636
  letters: {
1637
1637
  "*": {action_: "rm"},
@@ -1697,19 +1697,19 @@ mhchemParser.stateMachines = {
1697
1697
  "*": {action_: "state of aggregation"},
1698
1698
  },
1699
1699
  i$: {
1700
- "0": {nextState: "!f", revisit: true},
1700
+ 0: {nextState: "!f", revisit: true},
1701
1701
  },
1702
1702
  "(KV letters),": {
1703
- "0": {action_: "rm", nextState: "0"},
1703
+ 0: {action_: "rm", nextState: "0"},
1704
1704
  },
1705
1705
  formula$: {
1706
- "0": {nextState: "f", revisit: true},
1706
+ 0: {nextState: "f", revisit: true},
1707
1707
  },
1708
1708
  "1/2$": {
1709
- "0": {action_: "1/2"},
1709
+ 0: {action_: "1/2"},
1710
1710
  },
1711
1711
  else: {
1712
- "0": {nextState: "!f", revisit: true},
1712
+ 0: {nextState: "!f", revisit: true},
1713
1713
  },
1714
1714
  "${(...)}$|$(...)$": {
1715
1715
  "*": {action_: "tex-math"},
@@ -1772,13 +1772,13 @@ mhchemParser.stateMachines = {
1772
1772
  "*": {},
1773
1773
  },
1774
1774
  x$: {
1775
- "0": {nextState: "!f", revisit: true},
1775
+ 0: {nextState: "!f", revisit: true},
1776
1776
  },
1777
1777
  formula$: {
1778
- "0": {nextState: "f", revisit: true},
1778
+ 0: {nextState: "f", revisit: true},
1779
1779
  },
1780
1780
  else: {
1781
- "0": {nextState: "!f", revisit: true},
1781
+ 0: {nextState: "!f", revisit: true},
1782
1782
  },
1783
1783
  "-9.,9 no missing 0": {
1784
1784
  "*": {action_: "9,9"},
@@ -1948,10 +1948,10 @@ mhchemParser.stateMachines = {
1948
1948
  "0|a": {action_: "copy"},
1949
1949
  },
1950
1950
  "(-)(9)^(-9)": {
1951
- "0": {action_: "number^", nextState: "a"},
1951
+ 0: {action_: "number^", nextState: "a"},
1952
1952
  },
1953
1953
  "(-)(9.,9)(e)(99)": {
1954
- "0": {action_: "enumber", nextState: "a"},
1954
+ 0: {action_: "enumber", nextState: "a"},
1955
1955
  },
1956
1956
  space: {
1957
1957
  "0|a": {},
@@ -2112,11 +2112,11 @@ mhchemParser.stateMachines = {
2112
2112
  "*": {action_: ["output", "space"], nextState: "0"},
2113
2113
  },
2114
2114
  "^{(...)}|^(-1)": {
2115
- "1": {action_: "^(-1)"},
2115
+ 1: {action_: "^(-1)"},
2116
2116
  },
2117
2117
  "-9.,9": {
2118
- "0": {action_: "rm=", nextState: "0"},
2119
- "1": {action_: "^(-1)", nextState: "0"},
2118
+ 0: {action_: "rm=", nextState: "0"},
2119
+ 1: {action_: "^(-1)", nextState: "0"},
2120
2120
  },
2121
2121
  "{...}|else": {
2122
2122
  "*": {action_: "rm=", nextState: "1"},
@@ -2156,14 +2156,14 @@ mhchemParser.stateMachines = {
2156
2156
  "pu-9,9": {
2157
2157
  transitions: mhchemParser.createTransitions({
2158
2158
  empty: {
2159
- "0": {action_: "output-0"},
2159
+ 0: {action_: "output-0"},
2160
2160
  o: {action_: "output-o"},
2161
2161
  },
2162
2162
  ",": {
2163
- "0": {action_: ["output-0", "comma"], nextState: "o"},
2163
+ 0: {action_: ["output-0", "comma"], nextState: "o"},
2164
2164
  },
2165
2165
  ".": {
2166
- "0": {action_: ["output-0", "copy"], nextState: "o"},
2166
+ 0: {action_: ["output-0", "copy"], nextState: "o"},
2167
2167
  },
2168
2168
  else: {
2169
2169
  "*": {action_: "text="},
@@ -274,7 +274,7 @@ const LeafContainer = ({
274
274
  const hasPreviewHeading = shape.type === "content" || shape.type === "hint";
275
275
  const previewHeading = hasPreviewHeading && (
276
276
  <div className={css(styles.containerHeader)}>
277
- {/* @ts-expect-error [FEI-5003] - TS2322 - Type '{ children: string; depth: number; className: string; }' is not assignable to type 'IntrinsicAttributes & HeaderProps & { children?: ReactNode; }'. */}
277
+ {/* @ts-expect-error - TS2322 - Type '{ children: string; depth: number; className: string; }' is not assignable to type 'IntrinsicAttributes & HeaderProps & { children?: ReactNode; }'. */}
278
278
  <Header depth={path.length} className={css(styles.containerTitle)}>
279
279
  {capitalize(name)}
280
280
  </Header>
@@ -349,7 +349,7 @@ const ObjectContainer = ({
349
349
  }: ObjectContainerProps): React.ReactElement => {
350
350
  const headingEditor = (
351
351
  <div className={css(styles.containerHeader)}>
352
- {/* @ts-expect-error [FEI-5003] - TS2322 - Type '{ children: string; depth: number; className: string; }' is not assignable to type 'IntrinsicAttributes & HeaderProps & { children?: ReactNode; }'. */}
352
+ {/* @ts-expect-error - TS2322 - Type '{ children: string; depth: number; className: string; }' is not assignable to type 'IntrinsicAttributes & HeaderProps & { children?: ReactNode; }'. */}
353
353
  <Header depth={path.length} className={css(styles.containerTitle)}>
354
354
  {capitalize(name)}
355
355
  </Header>
@@ -363,7 +363,7 @@ const ObjectContainer = ({
363
363
  styles.previewCollectionHeader,
364
364
  )}
365
365
  >
366
- {/* @ts-expect-error [FEI-5003] - TS2322 - Type '{ children: string; depth: number; className: string; }' is not assignable to type 'IntrinsicAttributes & HeaderProps & { children?: ReactNode; }'. */}
366
+ {/* @ts-expect-error - TS2322 - Type '{ children: string; depth: number; className: string; }' is not assignable to type 'IntrinsicAttributes & HeaderProps & { children?: ReactNode; }'. */}
367
367
  <Header depth={path.length} className={css(styles.containerTitle)}>
368
368
  {capitalize(name)}
369
369
  </Header>
@@ -478,7 +478,7 @@ const withStickiness = <
478
478
  sticky: boolean;
479
479
  };
480
480
  return class StickyComponent extends React.Component<Config, State> {
481
- // @ts-expect-error [FEI-5003] - TS2564 - Property 'stickynessTimer' has no initializer and is not definitely assigned in the constructor.
481
+ // @ts-expect-error - TS2564 - Property 'stickynessTimer' has no initializer and is not definitely assigned in the constructor.
482
482
  stickynessTimer: number;
483
483
 
484
484
  state = {
@@ -488,7 +488,7 @@ const withStickiness = <
488
488
  componentDidMount() {
489
489
  // TODO(jeff, CP-3128): Use Wonder Blocks Timing API.
490
490
  // eslint-disable-next-line no-restricted-syntax
491
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'Timer' is not assignable to type 'number'.
491
+ // @ts-expect-error - TS2322 - Type 'Timer' is not assignable to type 'number'.
492
492
  this.stickynessTimer = setInterval(this.updateStickiness, 1000);
493
493
  this.updateStickiness();
494
494
  }
@@ -501,7 +501,7 @@ const withStickiness = <
501
501
 
502
502
  updateStickiness = () => {
503
503
  const domNode = ReactDOM.findDOMNode(this);
504
- // @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'. | TS2339 - Property 'offsetHeight' does not exist on type 'Element | Text'.
504
+ // @ts-expect-error - TS2531 - Object is possibly 'null'. | TS2339 - Property 'offsetHeight' does not exist on type 'Element | Text'.
505
505
  const height = domNode.offsetHeight;
506
506
  const windowHeight = window.innerHeight;
507
507
  const sticky = height > windowHeight;
@@ -514,7 +514,7 @@ const withStickiness = <
514
514
 
515
515
  render(): React.ReactNode {
516
516
  return (
517
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'Readonly<Config> & { sticky: boolean; children?: ReactNode; }' is not assignable to type 'IntrinsicAttributes & LibraryManagedAttributes<Component, PropsWithChildren<WithStickiness<Config>>>'.
517
+ // @ts-expect-error - TS2322 - Type 'Readonly<Config> & { sticky: boolean; children?: ReactNode; }' is not assignable to type 'IntrinsicAttributes & LibraryManagedAttributes<Component, PropsWithChildren<WithStickiness<Config>>>'.
518
518
  <WrappedComponent {...this.props} sticky={this.state.sticky} />
519
519
  );
520
520
  }
@@ -536,7 +536,7 @@ const ItemNodeContent = withStickiness(
536
536
  <div className={css(sticky && styles.sticky)}>
537
537
  {/* TODO(CP-4852): only pass the props to Editor that it uses. */}
538
538
  {
539
- // @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
539
+ // @ts-expect-error - TS2769 - No overload matches this call.
540
540
  <Editor
541
541
  {...data}
542
542
  onChange={(newVal) =>
@@ -885,21 +885,21 @@ class MultiRendererEditor extends React.Component<MultiRendererEditorProps> {
885
885
 
886
886
  score: () => any | undefined = () => {
887
887
  if (this.layout) {
888
- // @ts-expect-error [FEI-5003] - TS2571 - Object is of type 'unknown'.
888
+ // @ts-expect-error - TS2571 - Object is of type 'unknown'.
889
889
  return this.layout.score();
890
890
  }
891
891
  };
892
892
 
893
893
  getSerializedState: () => any | undefined = () => {
894
894
  if (this.layout) {
895
- // @ts-expect-error [FEI-5003] - TS2571 - Object is of type 'unknown'.
895
+ // @ts-expect-error - TS2571 - Object is of type 'unknown'.
896
896
  return this.layout.getSerializedState();
897
897
  }
898
898
  };
899
899
 
900
900
  restoreSerializedState: (state?: any) => void = (state: any) => {
901
901
  if (this.layout) {
902
- // @ts-expect-error [FEI-5003] - TS2571 - Object is of type 'unknown'.
902
+ // @ts-expect-error - TS2571 - Object is of type 'unknown'.
903
903
  this.layout.restoreSerializedState(state);
904
904
  }
905
905
  };
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @khanacademy/ts-no-error-suppressions */
1
2
  import {StyleSheet, css} from "aphrodite";
2
3
  import * as React from "react";
3
4
 
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @khanacademy/ts-no-error-suppressions */
1
2
  import {StyleSheet, css} from "aphrodite";
2
3
  import * as React from "react";
3
4
 
@@ -56,7 +56,7 @@ class CategorizerEditor extends React.Component<Props> {
56
56
  <TextListEditor
57
57
  options={this.props.categories}
58
58
  onChange={(cat) => {
59
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 2.
59
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 2.
60
60
  this.change("categories", cat);
61
61
  }}
62
62
  layout="horizontal"
@@ -65,7 +65,7 @@ class CategorizerEditor extends React.Component<Props> {
65
65
  <TextListEditor
66
66
  options={this.props.items}
67
67
  onChange={(items) => {
68
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
68
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
69
69
  this.change({
70
70
  items: items,
71
71
  // TODO(eater): This truncates props.values so there
@@ -84,7 +84,7 @@ class CategorizerEditor extends React.Component<Props> {
84
84
  {/* There are a bunch of props that renderer.jsx passes to each widget
85
85
  via widget-container.jsx that we aren't passing to Categorizer here.
86
86
  See perseus-all-package/types.js#WidgetProps for details. */}
87
- {/* @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call. */}
87
+ {/* @ts-expect-error - TS2769 - No overload matches this call. */}
88
88
  <Categorizer
89
89
  apiOptions={this.props.apiOptions}
90
90
  items={this.props.items}
@@ -156,7 +156,7 @@ class CSProgramEditor extends React.Component<any> {
156
156
  };
157
157
 
158
158
  change: (...args: ReadonlyArray<unknown>) => any = (...args) => {
159
- // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'readonly unknown[]' is not assignable to parameter of type 'any[]'.
159
+ // @ts-expect-error - TS2345 - Argument of type 'readonly unknown[]' is not assignable to parameter of type 'any[]'.
160
160
  return Changeable.change.apply(this, args);
161
161
  };
162
162
 
@@ -188,7 +188,7 @@ class CSProgramEditor extends React.Component<any> {
188
188
  "Error retrieving scratchpad info for program ID ",
189
189
  Errors.TransientService,
190
190
  {
191
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'string' is not assignable to type 'Error | null | undefined'.
191
+ // @ts-expect-error - TS2322 - Type 'string' is not assignable to type 'Error | null | undefined'.
192
192
  cause: error,
193
193
  loggedMetadata: {
194
194
  textStatus,
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @khanacademy/ts-no-error-suppressions */
1
2
  import {components, Changeable, EditorJsonify} from "@khanacademy/perseus";
2
3
  import PropTypes from "prop-types";
3
4
  import * as React from "react";
@@ -46,7 +47,7 @@ class DefinitionEditor extends React.Component<Props> {
46
47
  Word to be defined:{" "}
47
48
  <TextInput
48
49
  value={this.props.togglePrompt}
49
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
50
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
50
51
  onChange={this.change("togglePrompt")}
51
52
  placeholder="define me"
52
53
  />
@@ -63,7 +64,7 @@ class DefinitionEditor extends React.Component<Props> {
63
64
  if (_.has(props, "content")) {
64
65
  newProps.definition = props.content;
65
66
  }
66
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
67
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
67
68
  this.change(newProps);
68
69
  }}
69
70
  />
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @khanacademy/ts-no-error-suppressions */
1
2
  import {components, icons, EditorJsonify} from "@khanacademy/perseus";
2
3
  import PropTypes from "prop-types";
3
4
  import * as React from "react";
@@ -88,7 +89,7 @@ class DropdownEditor extends React.Component<Props> {
88
89
  };
89
90
 
90
91
  focus: (arg1: number) => boolean = (i) => {
91
- // @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'. | TS2339 - Property 'focus' does not exist on type 'Element | Text'.
92
+ // @ts-expect-error - TS2531 - Object is possibly 'null'. | TS2339 - Property 'focus' does not exist on type 'Element | Text'.
92
93
  ReactDOM.findDOMNode(this.refs["editor" + i]).focus(); // eslint-disable-line react/no-string-refs
93
94
  return true;
94
95
  };
@@ -143,14 +144,14 @@ class DropdownEditor extends React.Component<Props> {
143
144
  ref={"radio" + i}
144
145
  type="radio"
145
146
  name={dropdownGroupName}
146
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'string' is not assignable to type 'boolean | undefined'.
147
+ // @ts-expect-error - TS2322 - Type 'string' is not assignable to type 'boolean | undefined'.
147
148
  checked={
148
149
  choice.correct ? "checked" : ""
149
150
  }
150
151
  // eslint-disable-next-line react/jsx-no-bind
151
- // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
152
+ // @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
152
153
  onChange={this.onCorrectChange.bind(
153
- // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
154
+ // @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
154
155
  this,
155
156
  i,
156
157
  )}
@@ -160,9 +161,9 @@ class DropdownEditor extends React.Component<Props> {
160
161
  type="text"
161
162
  ref={"editor" + i}
162
163
  // eslint-disable-next-line react/jsx-no-bind
163
- // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
164
+ // @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
164
165
  onChange={this.onContentChange.bind(
165
- // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
166
+ // @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
166
167
  this,
167
168
  i,
168
169
  )}
@@ -174,9 +175,9 @@ class DropdownEditor extends React.Component<Props> {
174
175
  href="#"
175
176
  className="simple-button orange"
176
177
  // eslint-disable-next-line react/jsx-no-bind
177
- // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
178
+ // @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
178
179
  onClick={this.removeChoice.bind(
179
- // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
180
+ // @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
180
181
  this,
181
182
  i,
182
183
  )}
@@ -42,7 +42,7 @@ class ExampleGraphieWidgetEditor extends React.Component<Props> {
42
42
 
43
43
  handleChange: (arg1: any) => void = (newProps) => {
44
44
  if (newProps.coord) {
45
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
45
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
46
46
  this.change({
47
47
  correct: newProps.coord,
48
48
  });
@@ -21,7 +21,7 @@ import type {Coord, WidgetExports} from "@khanacademy/perseus";
21
21
 
22
22
  const {Graphie} = components;
23
23
 
24
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'MovablePoint' does not exist on type 'typeof Graphie'.
24
+ // @ts-expect-error - TS2339 - Property 'MovablePoint' does not exist on type 'typeof Graphie'.
25
25
  const MovablePoint = Graphie.MovablePoint;
26
26
 
27
27
  type Props = any;
@@ -121,7 +121,7 @@ class ExampleGraphieWidget extends React.Component<Props> {
121
121
  };
122
122
 
123
123
  movePoint: (arg1: Coord) => void = (newCoord) => {
124
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
124
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
125
125
  this.change({
126
126
  coord: newCoord,
127
127
  });
@@ -22,7 +22,7 @@ class ExampleWidgetEditor extends React.Component<Props> {
22
22
  handleAnswerChange: (arg1: React.ChangeEvent<HTMLInputElement>) => void = (
23
23
  event,
24
24
  ) => {
25
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
25
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
26
26
  this.change({
27
27
  correct: event.target.value,
28
28
  });
@@ -50,7 +50,7 @@ class ExampleWidgetEditor extends React.Component<Props> {
50
50
 
51
51
  focus: () => boolean = () => {
52
52
  // eslint-disable-next-line react/no-string-refs
53
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
53
+ // @ts-expect-error - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
54
54
  this.refs.input.focus();
55
55
  return true;
56
56
  };
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @khanacademy/ts-no-error-suppressions */
1
2
  /* eslint-disable react/sort-comp */
2
3
  /**
3
4
  * This is a simple number-entry widget
@@ -28,7 +29,7 @@ class TextInput extends React.Component<any> {
28
29
 
29
30
  focus = () => {
30
31
  // eslint-disable-next-line react/no-string-refs
31
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
32
+ // @ts-expect-error - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
32
33
  this.refs.input.focus();
33
34
  return true;
34
35
  };
@@ -100,7 +101,7 @@ class ExampleWidget extends React.Component<any> {
100
101
  // eslint-disable-next-line react/no-string-refs
101
102
  ref="input"
102
103
  value={this.props.value}
103
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
104
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
104
105
  onChange={this.change("value")}
105
106
  />
106
107
  );
@@ -117,7 +118,7 @@ class ExampleWidget extends React.Component<any> {
117
118
  */
118
119
  focus: () => boolean = () => {
119
120
  // eslint-disable-next-line react/no-string-refs
120
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
121
+ // @ts-expect-error - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
121
122
  this.refs.input.focus();
122
123
  return true;
123
124
  };
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @khanacademy/ts-no-error-suppressions */
1
2
  /* eslint-disable react/forbid-prop-types */
2
3
  import {components, Changeable, EditorJsonify} from "@khanacademy/perseus";
3
4
  import PropTypes from "prop-types";
@@ -48,7 +49,7 @@ class ExplanationEditor extends React.Component<Props, State> {
48
49
  Prompt to show explanation:{" "}
49
50
  <TextInput
50
51
  value={this.props.showPrompt}
51
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
52
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
52
53
  onChange={this.change("showPrompt")}
53
54
  />
54
55
  </label>
@@ -58,7 +59,7 @@ class ExplanationEditor extends React.Component<Props, State> {
58
59
  Prompt to hide explanation:{" "}
59
60
  <TextInput
60
61
  value={this.props.hidePrompt}
61
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
62
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
62
63
  onChange={this.change("hidePrompt")}
63
64
  />
64
65
  </label>
@@ -78,7 +79,7 @@ class ExplanationEditor extends React.Component<Props, State> {
78
79
  if (_.has(props, "widgets")) {
79
80
  newProps.widgets = props.widgets;
80
81
  }
81
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
82
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
82
83
  this.change(newProps);
83
84
  }}
84
85
  />
@@ -337,14 +337,14 @@ class ExpressionEditor extends React.Component<any, any> {
337
337
  newAnswer: () => void = () => {
338
338
  const answerForms = this.props.answerForms.slice();
339
339
  answerForms.push(this._newEmptyAnswerForm());
340
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
340
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
341
341
  this.change({answerForms});
342
342
  };
343
343
 
344
344
  handleRemoveForm: (arg1: number) => void = (i) => {
345
345
  const answerForms = this.props.answerForms.slice();
346
346
  answerForms.splice(i, 1);
347
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
347
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
348
348
  this.change({answerForms});
349
349
  };
350
350
 
@@ -355,7 +355,7 @@ class ExpressionEditor extends React.Component<any, any> {
355
355
  .merge([i], props)
356
356
  .freeze();
357
357
 
358
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
358
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
359
359
  this.change({answerForms});
360
360
  };
361
361
 
@@ -367,12 +367,12 @@ class ExpressionEditor extends React.Component<any, any> {
367
367
  "simplify",
368
368
  "value",
369
369
  );
370
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'key' does not exist on type 'Pick<any, "form" | "value" | "simplify" | "considered">'.
370
+ // @ts-expect-error - TS2339 - Property 'key' does not exist on type 'Pick<any, "form" | "value" | "simplify" | "considered">'.
371
371
  form.key = component.key;
372
372
  return form;
373
373
  });
374
374
 
375
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
375
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
376
376
  this.change({answerForms});
377
377
  };
378
378
 
@@ -410,14 +410,14 @@ class ExpressionEditor extends React.Component<any, any> {
410
410
  .reject((set) => set === remove)
411
411
  .concat(keep);
412
412
 
413
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 2.
413
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 2.
414
414
  this.change("buttonSets", buttonSets);
415
415
  };
416
416
 
417
417
  // called when the correct answer changes
418
418
  handleTexInsert: (arg1: string) => void = (str) => {
419
419
  // eslint-disable-next-line react/no-string-refs
420
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'insert' does not exist on type 'ReactInstance'.
420
+ // @ts-expect-error - TS2339 - Property 'insert' does not exist on type 'ReactInstance'.
421
421
  this.refs.expression.insert(str);
422
422
  };
423
423
 
@@ -468,7 +468,7 @@ class AnswerOption extends React.Component<any, any> {
468
468
  render(): React.ReactNode {
469
469
  let removeButton = null;
470
470
  if (this.state.deleteFocused) {
471
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'Element' is not assignable to type 'null'.
471
+ // @ts-expect-error - TS2322 - Type 'Element' is not assignable to type 'null'.
472
472
  removeButton = (
473
473
  <button
474
474
  type="button"
@@ -480,7 +480,7 @@ class AnswerOption extends React.Component<any, any> {
480
480
  </button>
481
481
  );
482
482
  } else {
483
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'Element' is not assignable to type 'null'.
483
+ // @ts-expect-error - TS2322 - Type 'Element' is not assignable to type 'null'.
484
484
  removeButton = (
485
485
  <button
486
486
  type="button"
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @khanacademy/ts-no-error-suppressions */
1
2
  /* eslint-disable react/forbid-prop-types, react/sort-comp */
2
3
  import {components, icons, ApiOptions, Changeable} from "@khanacademy/perseus";
3
4
  import {StyleSheet, css} from "aphrodite";
@@ -40,7 +41,7 @@ class GradedGroupEditor extends React.Component<Props> {
40
41
  const hint = {content: ""} as const;
41
42
  this.props.onChange({hint}, () => {
42
43
  // eslint-disable-next-line react/no-string-refs
43
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
44
+ // @ts-expect-error - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
44
45
  this.refs["hint-editor"].focus();
45
46
  });
46
47
  };
@@ -58,7 +59,7 @@ class GradedGroupEditor extends React.Component<Props> {
58
59
  <TextInput
59
60
  value={this.props.title}
60
61
  className={css(styles.input)}
61
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
62
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
62
63
  onChange={this.change("title")}
63
64
  />
64
65
  </label>
@@ -105,7 +106,7 @@ class GradedGroupEditor extends React.Component<Props> {
105
106
  onChange={(props) => {
106
107
  // Copy all props over from the existing hint
107
108
  // and then add new props.
108
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 2.
109
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 2.
109
110
  this.change(
110
111
  "hint",
111
112
  Object.assign({}, this.props.hint, props),
@@ -127,7 +128,7 @@ class GradedGroupEditor extends React.Component<Props> {
127
128
 
128
129
  getSaveWarnings: () => any = () => {
129
130
  // eslint-disable-next-line react/no-string-refs
130
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
131
+ // @ts-expect-error - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
131
132
  return this.refs.editor.getSaveWarnings();
132
133
  };
133
134
 
@@ -138,13 +139,13 @@ class GradedGroupEditor extends React.Component<Props> {
138
139
  return {
139
140
  title: this.props.title,
140
141
  // eslint-disable-next-line react/no-string-refs
141
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
142
+ // @ts-expect-error - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
142
143
  ...this.refs.editor.serialize(),
143
144
  hint:
144
145
  // eslint-disable-next-line react/no-string-refs
145
146
  this.refs["hint-editor"] &&
146
147
  // eslint-disable-next-line react/no-string-refs
147
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
148
+ // @ts-expect-error - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
148
149
  this.refs["hint-editor"].serialize(),
149
150
  };
150
151
  };