@khanacademy/perseus-editor 1.1.0 → 2.0.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.
Files changed (312) hide show
  1. package/.babelrc.js +1 -1
  2. package/.eslintrc.js +1 -0
  3. package/CHANGELOG.md +21 -0
  4. package/dist/all-editors.d.ts +2 -0
  5. package/dist/all-editors.js.flow +8 -0
  6. package/dist/all-widgets.d.ts +22 -0
  7. package/dist/all-widgets.js.flow +34 -0
  8. package/dist/article-editor.d.ts +59 -0
  9. package/dist/article-editor.js.flow +72 -0
  10. package/dist/components/blur-input.d.ts +19 -0
  11. package/dist/components/blur-input.js.flow +25 -0
  12. package/dist/components/checkbox.d.ts +20 -0
  13. package/dist/components/checkbox.js.flow +26 -0
  14. package/dist/components/device-framer.d.ts +15 -0
  15. package/dist/components/device-framer.js.flow +20 -0
  16. package/dist/components/drag-target.d.ts +2 -0
  17. package/dist/components/drag-target.js.flow +8 -0
  18. package/dist/components/dropdown-option.d.ts +35 -0
  19. package/dist/components/dropdown-option.js.flow +49 -0
  20. package/dist/components/form-wrapped-text-field.d.ts +48 -0
  21. package/dist/components/form-wrapped-text-field.js.flow +48 -0
  22. package/dist/components/graph-settings.d.ts +2 -0
  23. package/dist/components/graph-settings.js.flow +8 -0
  24. package/dist/components/hover-behavior.d.ts +85 -0
  25. package/dist/components/hover-behavior.js.flow +48 -0
  26. package/dist/components/json-editor.d.ts +2 -0
  27. package/dist/components/json-editor.js.flow +8 -0
  28. package/dist/components/link.d.ts +41 -0
  29. package/dist/components/link.js.flow +50 -0
  30. package/dist/components/simple-button.d.ts +16 -0
  31. package/dist/components/simple-button.js.flow +18 -0
  32. package/dist/components/sortable.d.ts +2 -0
  33. package/dist/components/sortable.js.flow +8 -0
  34. package/dist/components/util.d.ts +1 -0
  35. package/dist/components/util.js.flow +9 -0
  36. package/dist/components/viewport-resizer.d.ts +16 -0
  37. package/dist/components/viewport-resizer.js.flow +22 -0
  38. package/dist/diffs/__stories__/perseus-diff-wrapper.d.ts +5 -0
  39. package/dist/diffs/__stories__/perseus-diff-wrapper.js.flow +11 -0
  40. package/dist/diffs/article-diff.d.ts +50 -0
  41. package/dist/diffs/article-diff.js.flow +71 -0
  42. package/dist/diffs/item-diff.d.ts +23 -0
  43. package/dist/diffs/item-diff.js.flow +41 -0
  44. package/dist/diffs/renderer-diff.d.ts +22 -0
  45. package/dist/diffs/renderer-diff.js.flow +25 -0
  46. package/dist/diffs/split-diff.d.ts +2 -0
  47. package/dist/diffs/split-diff.js.flow +8 -0
  48. package/dist/diffs/string-array-diff.d.ts +2 -0
  49. package/dist/diffs/string-array-diff.js.flow +11 -0
  50. package/dist/diffs/structured-item-diff.d.ts +25 -0
  51. package/dist/diffs/structured-item-diff.js.flow +37 -0
  52. package/dist/diffs/tags-diff.d.ts +21 -0
  53. package/dist/diffs/tags-diff.js.flow +24 -0
  54. package/dist/diffs/text-diff.d.ts +15 -0
  55. package/dist/diffs/text-diff.js.flow +21 -0
  56. package/dist/diffs/widget-diff-performer.d.ts +2 -0
  57. package/dist/diffs/widget-diff-performer.js.flow +8 -0
  58. package/dist/diffs/widget-diff.d.ts +21 -0
  59. package/dist/diffs/widget-diff.js.flow +31 -0
  60. package/dist/editor-page.d.ts +57 -0
  61. package/dist/editor-page.js.flow +73 -0
  62. package/dist/editor.d.ts +82 -0
  63. package/dist/editor.js.flow +98 -0
  64. package/dist/es/index.js +1428 -2587
  65. package/dist/es/index.js.map +1 -1
  66. package/dist/hint-editor.d.ts +64 -0
  67. package/dist/hint-editor.js.flow +87 -0
  68. package/dist/i18n.d.ts +7 -0
  69. package/dist/i18n.js.flow +13 -0
  70. package/dist/iframe-content-renderer.d.ts +22 -0
  71. package/dist/iframe-content-renderer.js.flow +28 -0
  72. package/dist/index.d.ts +17 -2
  73. package/dist/index.js +1492 -2548
  74. package/dist/index.js.flow +23 -2
  75. package/dist/index.js.map +1 -1
  76. package/dist/item-editor.d.ts +36 -0
  77. package/dist/item-editor.js.flow +46 -0
  78. package/dist/item-extras-editor.d.ts +17 -0
  79. package/dist/item-extras-editor.js.flow +23 -0
  80. package/dist/katex-error-view.d.ts +16 -0
  81. package/dist/katex-error-view.js.flow +24 -0
  82. package/dist/multirenderer-editor.d.ts +32 -0
  83. package/dist/multirenderer-editor.js.flow +46 -0
  84. package/dist/section-control-button.d.ts +12 -0
  85. package/dist/section-control-button.js.flow +20 -0
  86. package/dist/stateful-article-editor.d.ts +10 -0
  87. package/dist/stateful-article-editor.js.flow +16 -0
  88. package/dist/stateful-editor-page.d.ts +2 -0
  89. package/dist/stateful-editor-page.js.flow +8 -0
  90. package/dist/testing-widgets.d.ts +22 -0
  91. package/dist/testing-widgets.js.flow +34 -0
  92. package/dist/util/register-all-widgets-and-editors-for-testing.d.ts +1 -0
  93. package/dist/util/register-all-widgets-and-editors-for-testing.js.flow +7 -0
  94. package/dist/widgets/categorizer-editor.d.ts +47 -0
  95. package/dist/widgets/categorizer-editor.js.flow +61 -0
  96. package/dist/widgets/cs-program-editor.d.ts +21 -0
  97. package/dist/widgets/cs-program-editor.js.flow +25 -0
  98. package/dist/widgets/definition-editor.d.ts +17 -0
  99. package/dist/widgets/definition-editor.js.flow +23 -0
  100. package/dist/widgets/dropdown-editor.d.ts +23 -0
  101. package/dist/widgets/dropdown-editor.js.flow +37 -0
  102. package/dist/widgets/example-graphie-widget-editor.d.ts +18 -0
  103. package/dist/widgets/example-graphie-widget-editor.js.flow +25 -0
  104. package/dist/widgets/example-graphie-widget.d.ts +87 -0
  105. package/dist/widgets/example-graphie-widget.js.flow +101 -0
  106. package/dist/widgets/example-widget-editor.d.ts +19 -0
  107. package/dist/widgets/example-widget-editor.js.flow +26 -0
  108. package/dist/widgets/example-widget.d.ts +71 -0
  109. package/dist/widgets/example-widget.js.flow +86 -0
  110. package/dist/widgets/explanation-editor.d.ts +21 -0
  111. package/dist/widgets/explanation-editor.js.flow +27 -0
  112. package/dist/widgets/expression-editor.d.ts +33 -0
  113. package/dist/widgets/expression-editor.js.flow +41 -0
  114. package/dist/widgets/graded-group-editor.d.ts +53 -0
  115. package/dist/widgets/graded-group-editor.js.flow +67 -0
  116. package/dist/widgets/graded-group-set-editor.d.ts +51 -0
  117. package/dist/widgets/graded-group-set-editor.js.flow +65 -0
  118. package/dist/widgets/grapher-editor.d.ts +14 -0
  119. package/dist/widgets/grapher-editor.js.flow +21 -0
  120. package/dist/widgets/group-editor.d.ts +49 -0
  121. package/dist/widgets/group-editor.js.flow +63 -0
  122. package/dist/widgets/iframe-editor.d.ts +18 -0
  123. package/dist/widgets/iframe-editor.js.flow +24 -0
  124. package/dist/widgets/image-editor.d.ts +2 -0
  125. package/dist/widgets/image-editor.js.flow +8 -0
  126. package/dist/widgets/input-number-editor.d.ts +47 -0
  127. package/dist/widgets/input-number-editor.js.flow +77 -0
  128. package/dist/widgets/interaction/constraint-editor.d.ts +26 -0
  129. package/dist/widgets/interaction/constraint-editor.js.flow +35 -0
  130. package/dist/widgets/interaction-editor.d.ts +28 -0
  131. package/dist/widgets/interaction-editor.js.flow +36 -0
  132. package/dist/widgets/interactive-graph-editor.d.ts +2 -0
  133. package/dist/widgets/interactive-graph-editor.js.flow +8 -0
  134. package/dist/widgets/label-image/answer-choices.d.ts +13 -0
  135. package/dist/widgets/label-image/answer-choices.js.flow +16 -0
  136. package/dist/widgets/label-image/behavior.d.ts +14 -0
  137. package/dist/widgets/label-image/behavior.js.flow +17 -0
  138. package/dist/widgets/label-image/marker.d.ts +30 -0
  139. package/dist/widgets/label-image/marker.js.flow +34 -0
  140. package/dist/widgets/label-image/question-markers.d.ts +22 -0
  141. package/dist/widgets/label-image/question-markers.js.flow +25 -0
  142. package/dist/widgets/label-image/select-image.d.ts +10 -0
  143. package/dist/widgets/label-image/select-image.js.flow +13 -0
  144. package/dist/widgets/label-image-editor.d.ts +45 -0
  145. package/dist/widgets/label-image-editor.js.flow +44 -0
  146. package/dist/widgets/lights-puzzle-editor.d.ts +24 -0
  147. package/dist/widgets/lights-puzzle-editor.js.flow +34 -0
  148. package/dist/widgets/matcher-editor.d.ts +19 -0
  149. package/dist/widgets/matcher-editor.js.flow +28 -0
  150. package/dist/widgets/matrix-editor.d.ts +20 -0
  151. package/dist/widgets/matrix-editor.js.flow +26 -0
  152. package/dist/widgets/measurer-editor.d.ts +32 -0
  153. package/dist/widgets/measurer-editor.js.flow +42 -0
  154. package/dist/widgets/molecule-editor.d.ts +17 -0
  155. package/dist/widgets/molecule-editor.js.flow +23 -0
  156. package/dist/widgets/number-line-editor.d.ts +36 -0
  157. package/dist/widgets/number-line-editor.js.flow +45 -0
  158. package/dist/widgets/numeric-input-editor.d.ts +2 -0
  159. package/dist/widgets/numeric-input-editor.js.flow +8 -0
  160. package/dist/widgets/orderer-editor.d.ts +20 -0
  161. package/dist/widgets/orderer-editor.js.flow +30 -0
  162. package/dist/widgets/passage-editor.d.ts +18 -0
  163. package/dist/widgets/passage-editor.js.flow +24 -0
  164. package/dist/widgets/passage-ref-editor.d.ts +11 -0
  165. package/dist/widgets/passage-ref-editor.js.flow +17 -0
  166. package/dist/widgets/passage-ref-target-editor.d.ts +16 -0
  167. package/dist/widgets/passage-ref-target-editor.js.flow +22 -0
  168. package/dist/widgets/plotter-editor.d.ts +45 -0
  169. package/dist/widgets/plotter-editor.js.flow +53 -0
  170. package/dist/widgets/radio/editor.d.ts +64 -0
  171. package/dist/widgets/radio/editor.js.flow +80 -0
  172. package/dist/widgets/reaction-diagram-editor.d.ts +20 -0
  173. package/dist/widgets/reaction-diagram-editor.js.flow +26 -0
  174. package/dist/widgets/sequence-editor.d.ts +56 -0
  175. package/dist/widgets/sequence-editor.js.flow +72 -0
  176. package/dist/widgets/simple-markdown-tester-editor.d.ts +14 -0
  177. package/dist/widgets/simple-markdown-tester-editor.js.flow +23 -0
  178. package/dist/widgets/simple-markdown-tester.d.ts +52 -0
  179. package/dist/widgets/simple-markdown-tester.js.flow +61 -0
  180. package/dist/widgets/simulator-editor.d.ts +20 -0
  181. package/dist/widgets/simulator-editor.js.flow +26 -0
  182. package/dist/widgets/sorter-editor.d.ts +16 -0
  183. package/dist/widgets/sorter-editor.js.flow +22 -0
  184. package/dist/widgets/table-editor.d.ts +18 -0
  185. package/dist/widgets/table-editor.js.flow +24 -0
  186. package/dist/widgets/transformer-editor.d.ts +11 -0
  187. package/dist/widgets/transformer-editor.js.flow +17 -0
  188. package/dist/widgets/unit-editor.d.ts +33 -0
  189. package/dist/widgets/unit-editor.js.flow +41 -0
  190. package/dist/widgets/video-editor.d.ts +19 -0
  191. package/dist/widgets/video-editor.js.flow +25 -0
  192. package/package.json +6 -5
  193. package/src/__stories__/{editor.stories.js → editor.stories.tsx} +4 -5
  194. package/src/__stories__/{section-control-button.stories.jsx → section-control-button.stories.tsx} +10 -11
  195. package/src/__testdata__/{input-number_testdata.js → input-number.testdata.ts} +2 -3
  196. package/src/__tests__/{editor_test.jsx → editor.test.tsx} +4 -7
  197. package/src/__tests__/{i18n_test.jsx → i18n.test.ts} +5 -5
  198. package/src/__tests__/{traversal_test.jsx → traversal.test.ts} +9 -10
  199. package/src/{all-editors_test.js → all-editors.test.ts} +1 -2
  200. package/src/all-editors.ts +83 -0
  201. package/src/all-widgets.ts +7 -0
  202. package/src/{article-editor.jsx → article-editor.tsx} +52 -42
  203. package/src/components/__stories__/{blur-input.stories.jsx → blur-input.stories.tsx} +2 -4
  204. package/src/components/{blur-input.jsx → blur-input.tsx} +12 -13
  205. package/src/components/{checkbox.jsx → checkbox.tsx} +18 -19
  206. package/src/components/{device-framer.jsx → device-framer.tsx} +4 -5
  207. package/src/components/{drag-target.jsx → drag-target.tsx} +0 -1
  208. package/src/components/{dropdown-option.jsx → dropdown-option.tsx} +40 -40
  209. package/src/components/{form-wrapped-text-field.jsx → form-wrapped-text-field.tsx} +47 -53
  210. package/src/components/{graph-settings.jsx → graph-settings.tsx} +4 -8
  211. package/src/components/{hover-behavior.jsx → hover-behavior.ts} +32 -33
  212. package/src/components/{json-editor.jsx → json-editor.tsx} +4 -3
  213. package/src/components/{link.jsx → link.ts} +33 -33
  214. package/src/components/{simple-button.jsx → simple-button.tsx} +3 -4
  215. package/src/components/{sortable.jsx → sortable.tsx} +3 -3
  216. package/src/components/{util.js → util.ts} +1 -2
  217. package/src/components/{viewport-resizer.jsx → viewport-resizer.tsx} +5 -6
  218. package/src/diffs/__stories__/{perseus-diff-wrapper.jsx → perseus-diff-wrapper.tsx} +3 -2
  219. package/src/diffs/__stories__/{structured-item-diff.stories.jsx → structured-item-diff.stories.tsx} +27 -22
  220. package/src/diffs/__stories__/{tags-diff.stories.jsx → tags-diff.stories.tsx} +12 -14
  221. package/src/diffs/__stories__/{text-diff.stories.jsx → text-diff.stories.tsx} +12 -14
  222. package/src/diffs/__tests__/{split-diff_test.js → split-diff.test.ts} +1 -2
  223. package/src/diffs/__tests__/{string-array-diff_test.js → string-array-diff.test.ts} +1 -2
  224. package/src/diffs/__tests__/{structured-item-diff_test.js → structured-item-diff.test.ts} +15 -14
  225. package/src/diffs/__tests__/{widget-diff-performer_test.js → widget-diff-performer.test.ts} +1 -2
  226. package/src/diffs/{article-diff.jsx → article-diff.tsx} +5 -6
  227. package/src/diffs/{item-diff.jsx → item-diff.tsx} +4 -5
  228. package/src/diffs/{renderer-diff.jsx → renderer-diff.tsx} +22 -28
  229. package/src/diffs/{split-diff.jsx → split-diff.ts} +4 -3
  230. package/src/diffs/{string-array-diff.jsx → string-array-diff.ts} +8 -9
  231. package/src/diffs/{structured-item-diff.jsx → structured-item-diff.tsx} +32 -27
  232. package/src/diffs/{tags-diff.jsx → tags-diff.tsx} +15 -16
  233. package/src/diffs/{text-diff.jsx → text-diff.tsx} +13 -13
  234. package/src/diffs/{widget-diff-performer.jsx → widget-diff-performer.ts} +3 -8
  235. package/src/diffs/{widget-diff.jsx → widget-diff.tsx} +15 -14
  236. package/src/{editor-page.jsx → editor-page.tsx} +52 -60
  237. package/src/{editor.jsx → editor.tsx} +315 -277
  238. package/src/{hint-editor.jsx → hint-editor.tsx} +105 -79
  239. package/src/{i18n.jsx → i18n.ts} +9 -6
  240. package/src/{iframe-content-renderer.jsx → iframe-content-renderer.tsx} +23 -17
  241. package/src/{index.js → index.ts} +15 -16
  242. package/src/{item-editor.jsx → item-editor.tsx} +35 -30
  243. package/src/{item-extras-editor.jsx → item-extras-editor.tsx} +3 -4
  244. package/src/{katex-error-view.jsx → katex-error-view.tsx} +4 -5
  245. package/src/{multirenderer-editor.jsx → multirenderer-editor.tsx} +132 -127
  246. package/src/{section-control-button.jsx → section-control-button.tsx} +10 -9
  247. package/src/{stateful-article-editor.jsx → stateful-article-editor.tsx} +2 -5
  248. package/src/{stateful-editor-page.jsx → stateful-editor-page.tsx} +1 -3
  249. package/src/{testing-widgets.js → testing-widgets.ts} +5 -6
  250. package/src/util/{register-all-widgets-and-editors-for-testing_test.js → register-all-widgets-and-editors-for-testing.test.ts} +1 -2
  251. package/src/util/{register-all-widgets-and-editors-for-testing.js → register-all-widgets-and-editors-for-testing.ts} +2 -3
  252. package/src/widgets/__stories__/{label-image-editor.stories.jsx → label-image-editor.stories.tsx} +22 -18
  253. package/src/widgets/__stories__/{radio-editor.stories.jsx → radio-editor.stories.tsx} +15 -10
  254. package/src/widgets/{categorizer-editor.jsx → categorizer-editor.tsx} +8 -6
  255. package/src/widgets/{cs-program-editor.jsx → cs-program-editor.tsx} +17 -17
  256. package/src/widgets/{definition-editor.jsx → definition-editor.tsx} +9 -8
  257. package/src/widgets/{dropdown-editor.jsx → dropdown-editor.tsx} +27 -19
  258. package/src/widgets/{example-graphie-widget-editor.jsx → example-graphie-widget-editor.tsx} +8 -8
  259. package/src/widgets/{example-graphie-widget.jsx → example-graphie-widget.tsx} +14 -17
  260. package/src/widgets/{example-widget-editor.jsx → example-widget-editor.tsx} +10 -7
  261. package/src/widgets/{example-widget.jsx → example-widget.tsx} +14 -12
  262. package/src/widgets/{explanation-editor.jsx → explanation-editor.tsx} +12 -10
  263. package/src/widgets/{expression-editor.jsx → expression-editor.tsx} +36 -26
  264. package/src/widgets/{graded-group-editor.jsx → graded-group-editor.tsx} +18 -10
  265. package/src/widgets/{graded-group-set-editor.jsx → graded-group-set-editor.tsx} +15 -12
  266. package/src/widgets/{grapher-editor.jsx → grapher-editor.tsx} +10 -9
  267. package/src/widgets/{group-editor.jsx → group-editor.tsx} +11 -9
  268. package/src/widgets/{iframe-editor.jsx → iframe-editor.tsx} +16 -13
  269. package/src/widgets/{image-editor.jsx → image-editor.tsx} +4 -7
  270. package/src/widgets/{input-number-editor.jsx → input-number-editor.tsx} +61 -47
  271. package/src/widgets/interaction/{constraint-editor.jsx → constraint-editor.tsx} +21 -24
  272. package/src/widgets/{interaction-editor.jsx → interaction-editor.tsx} +160 -61
  273. package/src/widgets/{interactive-graph-editor.jsx → interactive-graph-editor.tsx} +13 -10
  274. package/src/widgets/label-image/__stories__/{answer-choices.stories.jsx → answer-choices.stories.tsx} +22 -17
  275. package/src/widgets/label-image/__stories__/{behavior.stories.jsx → behavior.stories.tsx} +9 -10
  276. package/src/widgets/label-image/__stories__/{marker.stories.jsx → marker.stories.tsx} +11 -12
  277. package/src/widgets/label-image/__stories__/{question-markers.stories.jsx → question-markers.stories.tsx} +17 -16
  278. package/src/widgets/label-image/__stories__/{select-image.stories.jsx → select-image.stories.tsx} +12 -13
  279. package/src/widgets/label-image/{answer-choices.jsx → answer-choices.tsx} +18 -18
  280. package/src/widgets/label-image/{behavior.jsx → behavior.tsx} +9 -11
  281. package/src/widgets/label-image/{marker.jsx → marker.tsx} +17 -19
  282. package/src/widgets/label-image/{question-markers.jsx → question-markers.tsx} +16 -21
  283. package/src/widgets/label-image/{select-image.jsx → select-image.tsx} +5 -7
  284. package/src/widgets/{label-image-editor.jsx → label-image-editor.tsx} +38 -44
  285. package/src/widgets/{lights-puzzle-editor.jsx → lights-puzzle-editor.tsx} +34 -24
  286. package/src/widgets/{matcher-editor.jsx → matcher-editor.tsx} +9 -7
  287. package/src/widgets/{matrix-editor.jsx → matrix-editor.tsx} +10 -9
  288. package/src/widgets/{measurer-editor.jsx → measurer-editor.tsx} +21 -14
  289. package/src/widgets/{molecule-editor.jsx → molecule-editor.tsx} +9 -8
  290. package/src/widgets/{number-line-editor.jsx → number-line-editor.tsx} +19 -17
  291. package/src/widgets/{numeric-input-editor.jsx → numeric-input-editor.tsx} +10 -10
  292. package/src/widgets/{orderer-editor.jsx → orderer-editor.tsx} +17 -12
  293. package/src/widgets/{passage-editor.jsx → passage-editor.tsx} +9 -7
  294. package/src/widgets/{passage-ref-editor.jsx → passage-ref-editor.tsx} +8 -6
  295. package/src/widgets/{passage-ref-target-editor.jsx → passage-ref-target-editor.tsx} +9 -7
  296. package/src/widgets/{plotter-editor.jsx → plotter-editor.tsx} +34 -33
  297. package/src/widgets/radio/{editor.jsx → editor.tsx} +22 -21
  298. package/src/widgets/{reaction-diagram-editor.jsx → reaction-diagram-editor.tsx} +14 -10
  299. package/src/widgets/{sequence-editor.jsx → sequence-editor.tsx} +13 -13
  300. package/src/widgets/{simple-markdown-tester-editor.jsx → simple-markdown-tester-editor.tsx} +11 -9
  301. package/src/widgets/{simple-markdown-tester.jsx → simple-markdown-tester.tsx} +8 -7
  302. package/src/widgets/{simulator-editor.jsx → simulator-editor.tsx} +10 -8
  303. package/src/widgets/{sorter-editor.jsx → sorter-editor.tsx} +8 -6
  304. package/src/widgets/{table-editor.jsx → table-editor.tsx} +11 -10
  305. package/src/widgets/{transformer-editor.jsx → transformer-editor.tsx} +37 -35
  306. package/src/widgets/{unit-editor.jsx → unit-editor.tsx} +31 -25
  307. package/src/widgets/{video-editor.jsx → video-editor.tsx} +8 -9
  308. package/tsconfig.json +22 -0
  309. package/tsconfig.tsbuildinfo +1 -0
  310. package/src/all-editors.js +0 -85
  311. package/src/all-widgets.js +0 -10
  312. /package/dist/{strings.js → strings} +0 -0
@@ -1,5 +1,4 @@
1
1
  /* eslint-disable @babel/no-invalid-this, one-var, react/no-unsafe, react/sort-comp */
2
- // @flow
3
2
  import {number as knumber} from "@khanacademy/kmath";
4
3
  import {
5
4
  components,
@@ -12,7 +11,7 @@ import * as React from "react";
12
11
  import ReactDOM from "react-dom";
13
12
  import _ from "underscore";
14
13
 
15
- import BlurInput from "../components/blur-input.jsx";
14
+ import BlurInput from "../components/blur-input";
16
15
 
17
16
  const {InfoTip, NumberInput, RangeInput, TextListEditor} = components;
18
17
  const Plotter = PlotterWidget.widget;
@@ -24,7 +23,7 @@ const BAR = "bar",
24
23
  DOTPLOT = "dotplot";
25
24
 
26
25
  // Return a copy of array with length n, padded with given value
27
- function padArray(array, n, value) {
26
+ function padArray(array: any, n, value: any) {
28
27
  const copy = _.clone(array);
29
28
  copy.length = n;
30
29
  for (let i = array.length; i < n; i++) {
@@ -37,7 +36,7 @@ const editorDefaults = {
37
36
  scaleY: 1,
38
37
  maxY: 10,
39
38
  snapsPerLine: 2,
40
- };
39
+ } as const;
41
40
 
42
41
  const widgetPropTypes = {
43
42
  type: PropTypes.oneOf([BAR, LINE, PIC, HISTOGRAM, DOTPLOT]),
@@ -60,16 +59,16 @@ const widgetPropTypes = {
60
59
  correct: PropTypes.arrayOf(PropTypes.number),
61
60
  static: PropTypes.bool,
62
61
  onChange: PropTypes.func,
63
- };
62
+ } as const;
64
63
 
65
64
  const formatNumber = (num) => "$" + knumber.round(num, 2) + "$";
66
65
 
67
- type Props = $FlowFixMe;
68
- type State = $FlowFixMe;
66
+ type Props = any;
67
+ type State = any;
69
68
 
70
69
  class PlotterEditor extends React.Component<Props, State> {
71
70
  static propTypes = widgetPropTypes;
72
- static widgetName: string = "plotter";
71
+ static widgetName = "plotter" as const;
73
72
 
74
73
  static defaultProps: Props = {
75
74
  ...editorDefaults,
@@ -109,7 +108,7 @@ class PlotterEditor extends React.Component<Props, State> {
109
108
  this.fetchPic(this.props.picUrl);
110
109
  }
111
110
 
112
- UNSAFE_componentWillReceiveProps(nextProps: $FlowFixMe) {
111
+ UNSAFE_componentWillReceiveProps(nextProps: any) {
113
112
  this.fetchPic(nextProps.picUrl);
114
113
 
115
114
  if (nextProps.static) {
@@ -119,7 +118,7 @@ class PlotterEditor extends React.Component<Props, State> {
119
118
  }
120
119
  }
121
120
 
122
- fetchPic: (string) => $FlowFixMe = (url) => {
121
+ fetchPic: (arg1: string) => any = (url) => {
123
122
  if (this.state.loadedUrl !== url) {
124
123
  const pic = new Image();
125
124
  pic.src = url;
@@ -132,7 +131,7 @@ class PlotterEditor extends React.Component<Props, State> {
132
131
  }
133
132
  };
134
133
 
135
- render(): React.Node {
134
+ render(): React.ReactNode {
136
135
  const setFromScale = _.contains(
137
136
  [LINE, HISTOGRAM, DOTPLOT],
138
137
  this.props.type,
@@ -141,7 +140,7 @@ class PlotterEditor extends React.Component<Props, State> {
141
140
  const props = {
142
141
  trackInteraction: () => {},
143
142
  ...this.props,
144
- };
143
+ } as const;
145
144
 
146
145
  return (
147
146
  <div className="perseus-widget-plotter-editor">
@@ -155,8 +154,10 @@ class PlotterEditor extends React.Component<Props, State> {
155
154
  <input
156
155
  type="radio"
157
156
  name="chart-type"
157
+ // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
158
158
  checked={this.props.type === type}
159
159
  onChange={_.partial(
160
+ // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
160
161
  this.changeType,
161
162
  type,
162
163
  )}
@@ -179,9 +180,11 @@ class PlotterEditor extends React.Component<Props, State> {
179
180
  <input
180
181
  type="text"
181
182
  onChange={_.partial(
183
+ // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
182
184
  this.changeLabel,
183
185
  i,
184
186
  )}
187
+ // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
185
188
  defaultValue={this.props.labels[i]}
186
189
  />
187
190
  </label>
@@ -369,32 +372,32 @@ class PlotterEditor extends React.Component<Props, State> {
369
372
  );
370
373
  }
371
374
 
372
- handleChangeTickStep: (number) => void = (value) => {
375
+ handleChangeTickStep: (arg1: number) => void = (value) => {
373
376
  this.setState({
374
377
  tickStep: value,
375
378
  });
376
379
  };
377
380
 
378
- handleChangeRange: ([number, number]) => void = (newValue) => {
381
+ handleChangeRange: (arg1: [number, number]) => void = (newValue) => {
379
382
  this.setState({
380
383
  minX: newValue[0],
381
384
  maxX: newValue[1],
382
385
  });
383
386
  };
384
387
 
385
- changeLabelInterval: (number) => void = (value) => {
388
+ changeLabelInterval: (arg1: number) => void = (value) => {
386
389
  this.props.onChange({
387
390
  labelInterval: value,
388
391
  });
389
392
  };
390
393
 
391
- handlePlotterChange: ($FlowFixMe) => void = (newProps) => {
392
- const props = {};
394
+ handlePlotterChange: (arg1: any) => void = (newProps) => {
395
+ const props: Record<string, any> = {};
393
396
  props[this.state.editing] = newProps.values;
394
397
  this.props.onChange(props);
395
398
  };
396
399
 
397
- changeType: ($FlowFixMe) => void = (type) => {
400
+ changeType: (arg1: any) => void = (type) => {
398
401
  let categories;
399
402
  if (type === HISTOGRAM) {
400
403
  // Switching to histogram, add a label (0) to the left
@@ -411,19 +414,18 @@ class PlotterEditor extends React.Component<Props, State> {
411
414
  if (categories) {
412
415
  // eslint-disable-next-line react/no-string-refs
413
416
  const node = ReactDOM.findDOMNode(this.refs.categories);
414
- // $FlowFixMe[incompatible-use]
415
- // $FlowFixMe[prop-missing]
417
+ // @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'. | TS2339 - Property 'value' does not exist on type 'Element | Text'.
416
418
  node.value = categories.join(", ");
417
419
  }
418
420
  };
419
421
 
420
- changeLabel: (number, $FlowFixMe) => void = (i, e) => {
422
+ changeLabel: (arg1: number, arg2: any) => void = (i, e) => {
421
423
  const labels = _.clone(this.props.labels);
422
424
  labels[i] = e.target.value;
423
425
  this.props.onChange({labels: labels});
424
426
  };
425
427
 
426
- changePicUrl: (string) => void = (value) => {
428
+ changePicUrl: (arg1: string) => void = (value) => {
427
429
  // We don't need the labels and other data in the plotter, so just
428
430
  // extract the raw image and use that.
429
431
  // TODO(emily): Maybe indicate that such a change has happened?
@@ -432,7 +434,7 @@ class PlotterEditor extends React.Component<Props, State> {
432
434
  this.props.onChange({picUrl: url});
433
435
  };
434
436
 
435
- changeCategories: ($FlowFixMe) => void = (categories) => {
437
+ changeCategories: (arg1: any) => void = (categories) => {
436
438
  let n = categories.length;
437
439
  if (this.props.type === HISTOGRAM) {
438
440
  // Histograms with n labels/categories have n - 1 buckets
@@ -447,11 +449,11 @@ class PlotterEditor extends React.Component<Props, State> {
447
449
  });
448
450
  };
449
451
 
450
- changeScale: ($FlowFixMe) => void = (e) => {
452
+ changeScale: (arg1: any) => void = (e) => {
451
453
  const oldScale = this.props.scaleY;
452
454
  const newScale = +e.target.value || editorDefaults.scaleY;
453
455
 
454
- const scale = function (value) {
456
+ const scale = function (value: any) {
455
457
  return (value * newScale) / oldScale;
456
458
  };
457
459
 
@@ -464,24 +466,23 @@ class PlotterEditor extends React.Component<Props, State> {
464
466
  starting: _.map(this.props.starting, scale),
465
467
  });
466
468
 
467
- // $FlowFixMe[prop-missing]
468
- // $FlowFixMe[incompatible-use]
469
+ // @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'. | TS2339 - Property 'value' does not exist on type 'Element | Text'.
469
470
  ReactDOM.findDOMNode(this.refs.maxY).value = maxY; // eslint-disable-line react/no-string-refs
470
471
  };
471
472
 
472
- changeMax: ($FlowFixMe) => void = (e) => {
473
+ changeMax: (arg1: any) => void = (e) => {
473
474
  this.props.onChange({
474
475
  maxY: +e.target.value || editorDefaults.maxY,
475
476
  });
476
477
  };
477
478
 
478
- changeSnaps: ($FlowFixMe) => void = (e) => {
479
+ changeSnaps: (arg1: any) => void = (e) => {
479
480
  this.props.onChange({
480
481
  snapsPerLine: +e.target.value || editorDefaults.snapsPerLine,
481
482
  });
482
483
  };
483
484
 
484
- changeEditing: (string) => void = (editing) => {
485
+ changeEditing: (arg1: string) => void = (editing) => {
485
486
  this.setState({editing: editing});
486
487
  };
487
488
 
@@ -507,12 +508,11 @@ class PlotterEditor extends React.Component<Props, State> {
507
508
  // eslint-disable-next-line react/no-string-refs
508
509
  const node = ReactDOM.findDOMNode(this.refs.categories);
509
510
 
510
- // $FlowFixMe[incompatible-use]
511
- // $FlowFixMe[prop-missing]
511
+ // @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'. | TS2339 - Property 'value' does not exist on type 'Element | Text'.
512
512
  node.value = categories.join(", ");
513
513
  };
514
514
 
515
- serialize: () => $FlowFixMe = () => {
515
+ serialize: () => any = () => {
516
516
  const json = _.pick(
517
517
  this.props,
518
518
  "correct",
@@ -527,6 +527,7 @@ class PlotterEditor extends React.Component<Props, State> {
527
527
  );
528
528
 
529
529
  if (this.props.type === PIC) {
530
+ // @ts-expect-error [FEI-5003] - TS2339 - Property 'picUrl' does not exist on type 'Pick<Readonly<any> & Readonly<{ children?: ReactNode; }>, "type" | "correct" | "labels" | "categories" | "starting" | "scaleY" | "maxY" | "snapsPerLine" | "labelInterval">'.
530
531
  json.picUrl = this.props.picUrl;
531
532
  }
532
533
 
@@ -1,5 +1,4 @@
1
1
  /* eslint-disable jsx-a11y/anchor-is-valid, react/forbid-prop-types, react/sort-comp */
2
- // @flow
3
2
  import {
4
3
  components,
5
4
  icons,
@@ -12,12 +11,12 @@ import PropTypes from "prop-types";
12
11
  import * as React from "react";
13
12
  import _ from "underscore";
14
13
 
15
- import Editor from "../../editor.jsx";
14
+ import Editor from "../../editor";
16
15
 
17
16
  const {InlineIcon, PropCheckBox} = components;
18
17
  const {iconPlus, iconTrash} = icons;
19
18
 
20
- class ChoiceEditor extends React.Component<$FlowFixMe> {
19
+ class ChoiceEditor extends React.Component<any> {
21
20
  static propTypes = {
22
21
  apiOptions: ApiOptions.propTypes,
23
22
 
@@ -28,7 +27,7 @@ class ChoiceEditor extends React.Component<$FlowFixMe> {
28
27
  onDelete: PropTypes.func,
29
28
  };
30
29
 
31
- render(): React.Node {
30
+ render(): React.ReactNode {
32
31
  const checkedClass = this.props.choice.correct
33
32
  ? "correct"
34
33
  : "incorrect";
@@ -96,7 +95,7 @@ class ChoiceEditor extends React.Component<$FlowFixMe> {
96
95
  }
97
96
  }
98
97
 
99
- class RadioEditor extends React.Component<$FlowFixMe> {
98
+ class RadioEditor extends React.Component<any> {
100
99
  static propTypes = {
101
100
  ...Changeable.propTypes,
102
101
  apiOptions: ApiOptions.propTypes,
@@ -121,9 +120,9 @@ class RadioEditor extends React.Component<$FlowFixMe> {
121
120
  static: PropTypes.bool,
122
121
  };
123
122
 
124
- static widgetName: string = "radio";
123
+ static widgetName = "radio" as const;
125
124
 
126
- static defaultProps: $FlowFixMe = {
125
+ static defaultProps: any = {
127
126
  choices: [{}, {}],
128
127
  displayCount: null,
129
128
  randomize: false,
@@ -133,7 +132,7 @@ class RadioEditor extends React.Component<$FlowFixMe> {
133
132
  deselectEnabled: false,
134
133
  };
135
134
 
136
- render(): React.Node {
135
+ render(): React.ReactNode {
137
136
  const numCorrect = _.reduce(
138
137
  this.props.choices,
139
138
  function (memo, choice) {
@@ -248,12 +247,12 @@ class RadioEditor extends React.Component<$FlowFixMe> {
248
247
  );
249
248
  }
250
249
 
251
- change: (...args: $ReadOnlyArray<mixed>) => $FlowFixMe = (...args) => {
252
- // $FlowFixMe[incompatible-call]
250
+ change: (...args: ReadonlyArray<unknown>) => any = (...args) => {
251
+ // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'readonly unknown[]' is not assignable to parameter of type 'any[]'.
253
252
  return Changeable.change.apply(this, args);
254
253
  };
255
254
 
256
- onMultipleSelectChange: ($FlowFixMe) => $FlowFixMe = (allowMultiple) => {
255
+ onMultipleSelectChange: (arg1: any) => any = (allowMultiple) => {
257
256
  allowMultiple = allowMultiple.multipleSelect;
258
257
 
259
258
  const numCorrect = _.reduce(
@@ -284,12 +283,12 @@ class RadioEditor extends React.Component<$FlowFixMe> {
284
283
  }
285
284
  };
286
285
 
287
- onCountChoicesChange: ($FlowFixMe) => void = (count) => {
286
+ onCountChoicesChange: (arg1: any) => void = (count) => {
288
287
  count = count.countChoices;
289
288
  this.props.onChange({countChoices: count});
290
289
  };
291
290
 
292
- onChange: ($FlowFixMe) => void = ({checked}) => {
291
+ onChange: (arg1: any) => void = ({checked}) => {
293
292
  const choices = _.map(this.props.choices, (choice, i) => {
294
293
  return _.extend({}, choice, {
295
294
  correct: checked[i],
@@ -303,7 +302,7 @@ class RadioEditor extends React.Component<$FlowFixMe> {
303
302
  this.props.onChange({choices: choices});
304
303
  };
305
304
 
306
- onContentChange: ($FlowFixMe, $FlowFixMe) => void = (
305
+ onContentChange: (arg1: any, arg2: any) => void = (
307
306
  choiceIndex,
308
307
  newContent,
309
308
  ) => {
@@ -314,7 +313,7 @@ class RadioEditor extends React.Component<$FlowFixMe> {
314
313
  this.props.onChange({choices: choices});
315
314
  };
316
315
 
317
- onClueChange: ($FlowFixMe, $FlowFixMe) => void = (choiceIndex, newClue) => {
316
+ onClueChange: (arg1: any, arg2: any) => void = (choiceIndex, newClue) => {
318
317
  const choices = this.props.choices.slice();
319
318
  choices[choiceIndex] = _.extend({}, choices[choiceIndex], {
320
319
  clue: newClue,
@@ -325,7 +324,7 @@ class RadioEditor extends React.Component<$FlowFixMe> {
325
324
  this.props.onChange({choices: choices});
326
325
  };
327
326
 
328
- onDelete: (number) => void = (choiceIndex) => {
327
+ onDelete: (arg1: number) => void = (choiceIndex) => {
329
328
  const choices = this.props.choices.slice();
330
329
  const deleted = choices[choiceIndex];
331
330
 
@@ -338,11 +337,11 @@ class RadioEditor extends React.Component<$FlowFixMe> {
338
337
  });
339
338
  };
340
339
 
341
- addChoice: (boolean, $FlowFixMe) => void = (noneOfTheAbove, e) => {
340
+ addChoice: (arg1: boolean, arg2: any) => void = (noneOfTheAbove, e) => {
342
341
  e.preventDefault();
343
342
 
344
343
  const choices = this.props.choices.slice();
345
- const newChoice = {isNoneOfTheAbove: noneOfTheAbove};
344
+ const newChoice = {isNoneOfTheAbove: noneOfTheAbove} as const;
346
345
  const addIndex =
347
346
  choices.length - (this.props.hasNoneOfTheAbove ? 1 : 0);
348
347
 
@@ -356,6 +355,7 @@ class RadioEditor extends React.Component<$FlowFixMe> {
356
355
  },
357
356
  () => {
358
357
  // eslint-disable-next-line react/no-string-refs
358
+ // @ts-expect-error [FEI-5003] - TS2339 - Property 'refs' does not exist on type 'ReactInstance'.
359
359
  this.refs[`choice-editor${addIndex}`].refs[
360
360
  "content-editor"
361
361
  ].focus();
@@ -363,24 +363,25 @@ class RadioEditor extends React.Component<$FlowFixMe> {
363
363
  );
364
364
  };
365
365
 
366
- setDisplayCount: (number) => void = (num) => {
366
+ setDisplayCount: (arg1: number) => void = (num) => {
367
367
  this.props.onChange({displayCount: num});
368
368
  };
369
369
 
370
370
  focus: () => boolean = () => {
371
371
  // eslint-disable-next-line react/no-string-refs
372
+ // @ts-expect-error [FEI-5003] - TS2339 - Property 'refs' does not exist on type 'ReactInstance'.
372
373
  this.refs["choice-editor0"].refs["content-editor"].focus();
373
374
  return true;
374
375
  };
375
376
 
376
- getSaveWarnings: () => $ReadOnlyArray<string> = () => {
377
+ getSaveWarnings: () => ReadonlyArray<string> = () => {
377
378
  if (!_.some(_.pluck(this.props.choices, "correct"))) {
378
379
  return ["No choice is marked as correct."];
379
380
  }
380
381
  return [];
381
382
  };
382
383
 
383
- serialize: () => $FlowFixMe = () => {
384
+ serialize: () => any = () => {
384
385
  return _.pick(
385
386
  this.props,
386
387
  "choices",
@@ -1,11 +1,10 @@
1
- // @flow
2
1
  import {components, Changeable, EditorJsonify} from "@khanacademy/perseus";
3
2
  import PropTypes from "prop-types";
4
3
  import * as React from "react";
5
4
 
6
5
  const {NumberInput, TextInput} = components;
7
6
 
8
- type Props = $FlowFixMe;
7
+ type Props = any;
9
8
 
10
9
  class ReactionDiagramWidgetEditor extends React.Component<Props> {
11
10
  static propTypes = {
@@ -16,7 +15,7 @@ class ReactionDiagramWidgetEditor extends React.Component<Props> {
16
15
  smiles: PropTypes.arrayOf(PropTypes.string),
17
16
  };
18
17
 
19
- static widgetName: "reaction-diagram" = "reaction-diagram";
18
+ static widgetName = "reaction-diagram" as const;
20
19
 
21
20
  static defaultProps: Props = {
22
21
  smiles: ["", ""],
@@ -24,44 +23,49 @@ class ReactionDiagramWidgetEditor extends React.Component<Props> {
24
23
  separators: [{type: "right", topText: "", bottomText: ""}],
25
24
  };
26
25
 
27
- change: ($FlowFixMe, $FlowFixMe, $FlowFixMe) => $FlowFixMe = (...args) => {
26
+ change: (arg1: any, arg2: any, arg3: any) => any = (...args) => {
28
27
  return Changeable.change.apply(this, args);
29
28
  };
30
29
 
31
- updateMolecule: (number) => (string) => void = (idx) => {
30
+ updateMolecule: (arg1: number) => (arg1: string) => void = (idx) => {
32
31
  return function (newValue: string) {
32
+ // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
33
33
  const newSmiles = [...this.props.smiles];
34
34
  newSmiles[idx] = newValue;
35
+ // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
35
36
  this.change({smiles: newSmiles});
36
37
  }.bind(this);
37
38
  };
38
39
 
39
- updateRotation: (number) => ($FlowFixMe) => void = (idx) => {
40
+ updateRotation: (arg1: number) => (arg1: any) => void = (idx) => {
40
41
  return function (newValue) {
42
+ // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
41
43
  const newRot = [...this.props.rotationAngle];
42
44
  newRot[idx] = newValue;
45
+ // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
43
46
  this.change({rotationAngle: newRot});
44
47
  }.bind(this);
45
48
  };
46
49
 
47
- updateSeparators: (number, string) => (string) => void = (
50
+ updateSeparators: (arg1: number, arg2: string) => (arg1: string) => void = (
48
51
  idx,
49
52
  propName,
50
53
  ) => {
51
- return (newValue) => {
54
+ return (newValue: string) => {
52
55
  const newSep = this.props.separators.map((sep) => {
53
56
  return {...sep};
54
57
  });
55
58
  newSep[idx][propName] = newValue;
59
+ // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
56
60
  this.change({separators: newSep});
57
61
  };
58
62
  };
59
63
 
60
- serialize: () => $FlowFixMe = () => {
64
+ serialize: () => any = () => {
61
65
  return EditorJsonify.serialize.call(this);
62
66
  };
63
67
 
64
- render(): React.Node {
68
+ render(): React.ReactNode {
65
69
  // TODO(colin): use styling instead of &nbsp hacks.
66
70
  return (
67
71
  <div>
@@ -1,19 +1,18 @@
1
1
  /* eslint-disable jsx-a11y/anchor-is-valid, no-alert, react/sort-comp */
2
- // @flow
3
2
  import {components, icons, ApiOptions} from "@khanacademy/perseus";
4
3
  import PropTypes from "prop-types";
5
4
  import * as React from "react";
6
5
  import _ from "underscore";
7
6
 
8
- import Editor from "../editor.jsx";
7
+ import Editor from "../editor";
9
8
 
10
9
  const {InlineIcon} = components;
11
10
  const {iconCircleArrowDown, iconCircleArrowUp, iconPlus, iconTrash} = icons;
12
11
 
13
- type StepControlButtonProps = $FlowFixMe;
12
+ type StepControlButtonProps = any;
14
13
 
15
14
  class StepControlButton extends React.Component<StepControlButtonProps> {
16
- render(): React.Node {
15
+ render(): React.ReactNode {
17
16
  return (
18
17
  <a
19
18
  href="#"
@@ -34,7 +33,7 @@ class StepControlButton extends React.Component<StepControlButtonProps> {
34
33
  }
35
34
  }
36
35
 
37
- type SequenceEditorProps = $FlowFixMe;
36
+ type SequenceEditorProps = any;
38
37
 
39
38
  class SequenceEditor extends React.Component<SequenceEditorProps> {
40
39
  static propTypes = {
@@ -49,7 +48,7 @@ class SequenceEditor extends React.Component<SequenceEditorProps> {
49
48
  onChange: PropTypes.func.isRequired,
50
49
  };
51
50
 
52
- static widgetName: "sequence" = "sequence";
51
+ static widgetName = "sequence" as const;
53
52
 
54
53
  static defaultProps: SequenceEditorProps = {
55
54
  json: [
@@ -61,7 +60,7 @@ class SequenceEditor extends React.Component<SequenceEditorProps> {
61
60
  ],
62
61
  };
63
62
 
64
- render(): React.Node {
63
+ render(): React.ReactNode {
65
64
  return (
66
65
  <div className="perseus-sequence-editor">
67
66
  {_.map(this.props.json, (json, i) => {
@@ -130,22 +129,23 @@ class SequenceEditor extends React.Component<SequenceEditorProps> {
130
129
  );
131
130
  }
132
131
 
133
- _handleEditorChange: (number, $FlowFixMe) => void = (i, newProps) => {
132
+ _handleEditorChange: (arg1: number, arg2: any) => void = (i, newProps) => {
134
133
  const steps = _.clone(this.props.json);
135
134
  steps[i] = _.extend({}, steps[i], newProps);
136
135
  this.props.onChange({json: steps});
137
136
  };
138
137
 
139
- serialize: () => $FlowFixMe = () => {
138
+ serialize: () => any = () => {
140
139
  return {
141
140
  json: _.times(this.props.json.length, (i) => {
142
141
  // eslint-disable-next-line react/no-string-refs
142
+ // @ts-expect-error [FEI-5003] - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
143
143
  return this.refs["editor" + i].serialize();
144
144
  }),
145
145
  };
146
146
  };
147
147
 
148
- _handleMoveStepEarlier: (number) => void = (i) => {
148
+ _handleMoveStepEarlier: (arg1: number) => void = (i) => {
149
149
  if (i === 0) {
150
150
  return;
151
151
  }
@@ -158,7 +158,7 @@ class SequenceEditor extends React.Component<SequenceEditorProps> {
158
158
  });
159
159
  };
160
160
 
161
- _handleMoveStepLater: (number) => void = (i) => {
161
+ _handleMoveStepLater: (arg1: number) => void = (i) => {
162
162
  const steps = _.clone(this.props.json);
163
163
  if (i + 1 === steps.length) {
164
164
  return;
@@ -171,7 +171,7 @@ class SequenceEditor extends React.Component<SequenceEditorProps> {
171
171
  });
172
172
  };
173
173
 
174
- _handleAddStepAfter: (number) => void = (i) => {
174
+ _handleAddStepAfter: (arg1: number) => void = (i) => {
175
175
  // We do a full serialization here because we
176
176
  // might be copying widgets:
177
177
  const steps = _.clone(this.props.json);
@@ -193,7 +193,7 @@ class SequenceEditor extends React.Component<SequenceEditorProps> {
193
193
  });
194
194
  };
195
195
 
196
- _handleRemoveStep: (number) => void = (i) => {
196
+ _handleRemoveStep: (arg1: number) => void = (i) => {
197
197
  const steps = _.clone(this.props.json);
198
198
  steps.splice(i, 1);
199
199
  this.props.onChange({
@@ -1,5 +1,4 @@
1
1
  /* eslint-disable react/sort-comp */
2
- // @flow
3
2
  /**
4
3
  * This is the editor for the simple-markdown-tester widget. This is what shows
5
4
  * up on the left side of the screen in the demo. Only the question writer
@@ -8,10 +7,10 @@
8
7
  import {Changeable, EditorJsonify} from "@khanacademy/perseus";
9
8
  import * as React from "react";
10
9
 
11
- type TextAreaProps = $FlowFixMe;
10
+ type TextAreaProps = any;
12
11
 
13
12
  class TextArea extends React.Component<TextAreaProps> {
14
- render(): React.Node {
13
+ render(): React.ReactNode {
15
14
  return (
16
15
  <textarea
17
16
  // eslint-disable-next-line react/no-string-refs
@@ -24,31 +23,32 @@ class TextArea extends React.Component<TextAreaProps> {
24
23
 
25
24
  focus = () => {
26
25
  // eslint-disable-next-line react/no-string-refs
26
+ // @ts-expect-error [FEI-5003] - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
27
27
  this.refs.input.focus();
28
28
  return true;
29
29
  };
30
30
 
31
- changeValue = (e) => {
31
+ changeValue = (e: any) => {
32
32
  // Translating from the js event e to the value
33
33
  // of the textbox to send to onChange
34
34
  this.props.onChange(e.target.value);
35
35
  };
36
36
  }
37
37
 
38
- type SimpleMarkdownTesterEditorProps = $FlowFixMe;
38
+ type SimpleMarkdownTesterEditorProps = any;
39
39
 
40
40
  class SimpleMarkdownTesterEditor extends React.Component<SimpleMarkdownTesterEditorProps> {
41
41
  static propTypes = {
42
42
  ...Changeable.propTypes,
43
43
  };
44
44
 
45
- static widgetName: "simple-markdown-tester" = "simple-markdown-tester";
45
+ static widgetName = "simple-markdown-tester" as const;
46
46
 
47
47
  static defaultProps: SimpleMarkdownTesterEditorProps = {
48
48
  value: "",
49
49
  };
50
50
 
51
- render(): React.Node {
51
+ render(): React.ReactNode {
52
52
  return (
53
53
  <div>
54
54
  <label>
@@ -56,6 +56,7 @@ class SimpleMarkdownTesterEditor extends React.Component<SimpleMarkdownTesterEdi
56
56
  <div>
57
57
  <TextArea
58
58
  value={this.props.value}
59
+ // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
59
60
  onChange={this.change("value")}
60
61
  // eslint-disable-next-line react/no-string-refs
61
62
  ref="input"
@@ -66,17 +67,18 @@ class SimpleMarkdownTesterEditor extends React.Component<SimpleMarkdownTesterEdi
66
67
  );
67
68
  }
68
69
 
69
- change: ($FlowFixMe, $FlowFixMe, $FlowFixMe) => $FlowFixMe = (...args) => {
70
+ change: (arg1: any, arg2: any, arg3: any) => any = (...args) => {
70
71
  return Changeable.change.apply(this, args);
71
72
  };
72
73
 
73
74
  focus: () => boolean = () => {
74
75
  // eslint-disable-next-line react/no-string-refs
76
+ // @ts-expect-error [FEI-5003] - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
75
77
  this.refs.input.focus();
76
78
  return true;
77
79
  };
78
80
 
79
- serialize: () => $FlowFixMe = () => {
81
+ serialize: () => any = () => {
80
82
  return EditorJsonify.serialize.call(this);
81
83
  };
82
84
  }