@khanacademy/perseus 4.0.2 → 6.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 (249) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/dist/components/fixed-to-responsive.d.ts +27 -1
  3. package/dist/components/fixed-to-responsive.js.flow +27 -1
  4. package/dist/components/graph.d.ts +42 -26
  5. package/dist/components/graph.js.flow +42 -28
  6. package/dist/components/graphie.d.ts +34 -22
  7. package/dist/components/graphie.js.flow +37 -24
  8. package/dist/components/highlighting/highlightable-content.d.ts +4 -4
  9. package/dist/components/highlighting/highlightable-content.js.flow +4 -7
  10. package/dist/components/highlighting/ui/highlight-renderer.d.ts +6 -6
  11. package/dist/components/highlighting/ui/highlight-renderer.js.flow +6 -8
  12. package/dist/components/highlighting/ui/highlight-set-renderer.d.ts +5 -5
  13. package/dist/components/highlighting/ui/highlight-set-renderer.js.flow +5 -8
  14. package/dist/components/highlighting/ui/highlight-tooltip.d.ts +2 -2
  15. package/dist/components/highlighting/ui/highlight-tooltip.js.flow +2 -4
  16. package/dist/components/highlighting/ui/highlighting-ui.d.ts +2 -2
  17. package/dist/components/highlighting/ui/highlighting-ui.js.flow +2 -2
  18. package/dist/components/highlighting/ui/selection-tracker.d.ts +5 -5
  19. package/dist/components/highlighting/ui/selection-tracker.js.flow +5 -7
  20. package/dist/components/highlighting/word-indexer.d.ts +2 -2
  21. package/dist/components/highlighting/word-indexer.js.flow +2 -2
  22. package/dist/components/hud.d.ts +8 -14
  23. package/dist/components/hud.js.flow +7 -14
  24. package/dist/components/inline-icon.d.ts +27 -3
  25. package/dist/components/inline-icon.js.flow +26 -3
  26. package/dist/components/lint.d.ts +41 -13
  27. package/dist/components/lint.js.flow +42 -13
  28. package/dist/components/math-output.d.ts +15 -11
  29. package/dist/components/math-output.js.flow +15 -11
  30. package/dist/components/simple-keypad-input.d.ts +1 -1
  31. package/dist/components/simple-keypad-input.js.flow +1 -1
  32. package/dist/components/sortable.d.ts +17 -9
  33. package/dist/components/sortable.js.flow +22 -9
  34. package/dist/components/svg-image.d.ts +5 -3
  35. package/dist/components/svg-image.js.flow +5 -3
  36. package/dist/components/tex-buttons.d.ts +2 -2
  37. package/dist/components/tex-buttons.js.flow +2 -2
  38. package/dist/components/tooltip.d.ts +45 -4
  39. package/dist/components/tooltip.js.flow +44 -31
  40. package/dist/error-boundary.d.ts +4 -4
  41. package/dist/error-boundary.js.flow +4 -6
  42. package/dist/es/index.css +0 -3
  43. package/dist/es/index.js +484 -658
  44. package/dist/es/index.js.map +1 -1
  45. package/dist/index.css +0 -3
  46. package/dist/index.js +488 -655
  47. package/dist/index.js.map +1 -1
  48. package/dist/perseus-types.d.ts +11 -10
  49. package/dist/perseus-types.js.flow +11 -10
  50. package/dist/renderer.d.ts +2 -2
  51. package/dist/renderer.js.flow +1 -3
  52. package/dist/styles/shared.d.ts +0 -1
  53. package/dist/styles/shared.js.flow +0 -1
  54. package/dist/types.d.ts +0 -10
  55. package/dist/types.js.flow +0 -13
  56. package/dist/util/a11y.d.ts +0 -1
  57. package/dist/util/a11y.js.flow +0 -1
  58. package/dist/util/interactive.d.ts +2 -0
  59. package/dist/util/interactive.js.flow +2 -0
  60. package/dist/util.d.ts +3 -3
  61. package/dist/util.js.flow +4 -3
  62. package/dist/widgets/__stories__/test-keypad-context-wrapper.d.ts +2 -2
  63. package/dist/widgets/__stories__/test-keypad-context-wrapper.js.flow +2 -4
  64. package/dist/widgets/expression.d.ts +2 -2
  65. package/dist/widgets/expression.js.flow +2 -2
  66. package/dist/widgets/grapher.d.ts +1 -1
  67. package/dist/widgets/grapher.js.flow +12 -3
  68. package/dist/widgets/interaction/element-container.d.ts +5 -4
  69. package/dist/widgets/interaction/element-container.js.flow +6 -11
  70. package/dist/widgets/label-image/marker.d.ts +4 -4
  71. package/dist/widgets/label-image/marker.js.flow +4 -6
  72. package/dist/widgets/matcher.d.ts +7 -3
  73. package/dist/widgets/matcher.js.flow +7 -3
  74. package/dist/widgets/number-line.d.ts +1 -1
  75. package/dist/widgets/number-line.js.flow +1 -1
  76. package/dist/widgets/numeric-input.d.ts +0 -2
  77. package/dist/widgets/numeric-input.js.flow +0 -4
  78. package/dist/widgets/radio/base-radio.d.ts +7 -1
  79. package/dist/widgets/radio/base-radio.js.flow +7 -1
  80. package/dist/widgets/radio/choice-icon/choice-icon.d.ts +1 -1
  81. package/dist/widgets/radio/choice-icon/choice-icon.js.flow +1 -1
  82. package/dist/widgets/radio/choice-icon/cross-out-line.d.ts +2 -2
  83. package/dist/widgets/radio/choice-icon/cross-out-line.js.flow +2 -2
  84. package/dist/widgets/radio/focus-ring.d.ts +8 -1
  85. package/dist/widgets/radio/focus-ring.js.flow +8 -1
  86. package/dist/widgets/radio/option-status.d.ts +2 -2
  87. package/dist/widgets/radio/option-status.js.flow +2 -2
  88. package/dist/widgets/video-transcript-link.d.ts +1 -1
  89. package/dist/widgets/video-transcript-link.js.flow +1 -1
  90. package/package.json +4 -4
  91. package/src/__stories__/item-renderer.stories.tsx +2 -6
  92. package/src/__stories__/server-item-renderer.stories.tsx +2 -6
  93. package/src/__tests__/__snapshots__/item-renderer.test.tsx.snap +151 -159
  94. package/src/__tests__/__snapshots__/renderer.test.tsx.snap +358 -394
  95. package/src/__tests__/__snapshots__/server-item-renderer.test.tsx.snap +169 -189
  96. package/src/components/__stories__/button-group.stories.tsx +2 -6
  97. package/src/components/__stories__/fixed-to-responsive.stories.tsx +14 -16
  98. package/src/components/__stories__/graph.stories.tsx +3 -5
  99. package/src/components/__stories__/graphie.stories.tsx +3 -5
  100. package/src/components/__stories__/hud.stories.tsx +2 -6
  101. package/src/components/__stories__/icon.stories.tsx +1 -1
  102. package/src/components/__stories__/image-loader.stories.tsx +4 -4
  103. package/src/components/__stories__/info-tip.stories.tsx +2 -6
  104. package/src/components/__stories__/inline-icon.stories.tsx +4 -8
  105. package/src/components/__stories__/input-with-examples.stories.tsx +6 -10
  106. package/src/components/__stories__/lint.stories.tsx +62 -27
  107. package/src/components/__stories__/math-input.stories.tsx +4 -8
  108. package/src/components/__stories__/math-output.stories.tsx +3 -5
  109. package/src/components/__stories__/multi-button-group.stories.tsx +2 -6
  110. package/src/components/__stories__/number-input.stories.tsx +6 -8
  111. package/src/components/__stories__/prop-check-box.stories.tsx +9 -9
  112. package/src/components/__stories__/range-input.stories.tsx +4 -6
  113. package/src/components/__stories__/simple-keypad-input.stories.tsx +2 -4
  114. package/src/components/__stories__/sortable.stories.tsx +20 -20
  115. package/src/components/__stories__/stub-tag-editor.stories.tsx +5 -9
  116. package/src/components/__stories__/svg-image.stories.tsx +10 -18
  117. package/src/components/__stories__/tex.stories.tsx +1 -3
  118. package/src/components/__stories__/text-buttons.stories.tsx +10 -22
  119. package/src/components/__stories__/text-input.stories.tsx +4 -10
  120. package/src/components/__stories__/text-list-editor.stories.tsx +1 -3
  121. package/src/components/__stories__/tooltip.stories.tsx +52 -0
  122. package/src/components/__stories__/zoomable-tex.stories.tsx +6 -4
  123. package/src/components/__stories__/zoomable.stories.tsx +1 -3
  124. package/src/components/__tests__/__snapshots__/sortable.test.tsx.snap +114 -30
  125. package/src/components/__tests__/__snapshots__/sorter.test.tsx.snap +172 -204
  126. package/src/components/__tests__/sortable.test.tsx +54 -16
  127. package/src/components/__tests__/sorter.test.tsx +12 -9
  128. package/src/components/fixed-to-responsive.tsx +43 -38
  129. package/src/components/graph.tsx +95 -81
  130. package/src/components/graphie.tsx +62 -32
  131. package/src/components/highlighting/highlightable-content.tsx +4 -7
  132. package/src/components/highlighting/ui/highlight-renderer.tsx +6 -9
  133. package/src/components/highlighting/ui/highlight-set-renderer.tsx +5 -8
  134. package/src/components/highlighting/ui/highlight-tooltip.tsx +2 -2
  135. package/src/components/highlighting/ui/highlighting-ui.tsx +2 -2
  136. package/src/components/highlighting/ui/selection-tracker.tsx +5 -8
  137. package/src/components/highlighting/word-indexer.tsx +2 -2
  138. package/src/components/hud.tsx +104 -115
  139. package/src/components/inline-icon.tsx +17 -34
  140. package/src/components/input-with-examples.tsx +4 -4
  141. package/src/components/lint.tsx +47 -41
  142. package/src/components/math-output.tsx +17 -11
  143. package/src/components/simple-keypad-input.tsx +4 -4
  144. package/src/components/sortable.tsx +134 -94
  145. package/src/components/svg-image.tsx +10 -11
  146. package/src/components/tex-buttons.tsx +2 -2
  147. package/src/components/tooltip.tsx +189 -171
  148. package/src/components/visibility-observer/__stories__/visibility-observer.stories.tsx +1 -3
  149. package/src/error-boundary.tsx +4 -7
  150. package/src/interactive2/types.ts +2 -2
  151. package/src/multi-items/__stories__/multi-renderer.stories.tsx +1 -1
  152. package/src/multi-items/__tests__/__snapshots__/multi-renderer.test.tsx.snap +708 -764
  153. package/src/multi-items/__tests__/multi-renderer.test.tsx +2 -3
  154. package/src/perseus-types.ts +13 -12
  155. package/src/renderer.tsx +11 -22
  156. package/src/types.ts +0 -18
  157. package/src/util/graphie.ts +3 -3
  158. package/src/util/interactive.ts +18 -5
  159. package/src/util/tex.ts +13 -77
  160. package/src/util.ts +3 -4
  161. package/src/widgets/__stories__/categorizer.stories.tsx +1 -1
  162. package/src/widgets/__stories__/cs-program.stories.tsx +1 -1
  163. package/src/widgets/__stories__/definition.stories.tsx +3 -7
  164. package/src/widgets/__stories__/dropdown.stories.tsx +1 -1
  165. package/src/widgets/__stories__/explanation.stories.tsx +2 -2
  166. package/src/widgets/__stories__/expression.stories.tsx +5 -11
  167. package/src/widgets/__stories__/graded-group-set.stories.tsx +1 -1
  168. package/src/widgets/__stories__/graded-group.stories.tsx +1 -1
  169. package/src/widgets/__stories__/grapher.stories.tsx +7 -21
  170. package/src/widgets/__stories__/group.stories.tsx +1 -1
  171. package/src/widgets/__stories__/iframe.stories.tsx +1 -1
  172. package/src/widgets/__stories__/image.stories.tsx +1 -1
  173. package/src/widgets/__stories__/input-number.stories.tsx +3 -12
  174. package/src/widgets/__stories__/interaction.stories.tsx +1 -1
  175. package/src/widgets/__stories__/interactive-graph.stories.tsx +9 -9
  176. package/src/widgets/__stories__/matcher.stories.tsx +1 -1
  177. package/src/widgets/__stories__/matrix.stories.tsx +1 -1
  178. package/src/widgets/__stories__/number-line.stories.tsx +1 -1
  179. package/src/widgets/__stories__/numeric-input.stories.tsx +3 -5
  180. package/src/widgets/__stories__/orderer.stories.tsx +1 -1
  181. package/src/widgets/__stories__/passage-ref.stories.tsx +2 -2
  182. package/src/widgets/__stories__/passage.stories.tsx +3 -9
  183. package/src/widgets/__stories__/radio.stories.tsx +3 -5
  184. package/src/widgets/__stories__/sorter.stories.tsx +1 -1
  185. package/src/widgets/__stories__/test-keypad-context-wrapper.tsx +2 -4
  186. package/src/widgets/__stories__/transformer.stories.tsx +1 -1
  187. package/src/widgets/__stories__/unit.stories.tsx +1 -3
  188. package/src/widgets/__stories__/video-transcript-link.stories.tsx +2 -6
  189. package/src/widgets/__stories__/video.stories.tsx +1 -1
  190. package/src/widgets/__testdata__/group.testdata.ts +0 -2
  191. package/src/widgets/__tests__/__snapshots__/categorizer.test.ts.snap +717 -773
  192. package/src/widgets/__tests__/__snapshots__/cs-program.test.ts.snap +28 -36
  193. package/src/widgets/__tests__/__snapshots__/definition.test.ts.snap +52 -60
  194. package/src/widgets/__tests__/__snapshots__/dropdown.test.ts.snap +100 -108
  195. package/src/widgets/__tests__/__snapshots__/explanation.test.ts.snap +212 -260
  196. package/src/widgets/__tests__/__snapshots__/graded-group-set-jipt.test.ts.snap +613 -641
  197. package/src/widgets/__tests__/__snapshots__/graded-group-set.test.ts.snap +249 -261
  198. package/src/widgets/__tests__/__snapshots__/graded-group.test.ts.snap +671 -735
  199. package/src/widgets/__tests__/__snapshots__/grapher.test.ts.snap +2676 -2684
  200. package/src/widgets/__tests__/__snapshots__/group.test.tsx.snap +938 -1002
  201. package/src/widgets/__tests__/__snapshots__/iframe.test.ts.snap +28 -36
  202. package/src/widgets/__tests__/__snapshots__/image.test.ts.snap +227 -255
  203. package/src/widgets/__tests__/__snapshots__/input-number.test.ts.snap +353 -357
  204. package/src/widgets/__tests__/__snapshots__/interaction.test.ts.snap +255 -259
  205. package/src/widgets/__tests__/__snapshots__/interactive-graph.test.ts.snap +2401 -2433
  206. package/src/widgets/__tests__/__snapshots__/matcher.test.tsx.snap +600 -756
  207. package/src/widgets/__tests__/__snapshots__/matrix.test.ts.snap +420 -428
  208. package/src/widgets/__tests__/__snapshots__/number-line.test.ts.snap +762 -770
  209. package/src/widgets/__tests__/__snapshots__/numeric-input.test.ts.snap +373 -393
  210. package/src/widgets/__tests__/__snapshots__/orderer.test.ts.snap +116 -148
  211. package/src/widgets/__tests__/__snapshots__/passage-ref.test.ts.snap +289 -301
  212. package/src/widgets/__tests__/__snapshots__/passage.test.tsx.snap +1679 -1711
  213. package/src/widgets/__tests__/__snapshots__/radio.test.ts.snap +2692 -2960
  214. package/src/widgets/__tests__/__snapshots__/video.test.ts.snap +90 -98
  215. package/src/widgets/__tests__/group.test.tsx +0 -2
  216. package/src/widgets/__tests__/matcher.test.tsx +33 -9
  217. package/src/widgets/__tests__/radio/focus-ring.test.tsx +0 -1
  218. package/src/widgets/expression.tsx +12 -9
  219. package/src/widgets/grapher.tsx +3 -3
  220. package/src/widgets/image.tsx +2 -2
  221. package/src/widgets/interaction/element-container.tsx +7 -8
  222. package/src/widgets/interactive-graph.tsx +5 -5
  223. package/src/widgets/label-image/__stories__/answer-choices.stories.tsx +2 -4
  224. package/src/widgets/label-image/__stories__/marker.stories.tsx +9 -19
  225. package/src/widgets/label-image/marker.tsx +4 -4
  226. package/src/widgets/matcher.tsx +43 -24
  227. package/src/widgets/number-line.tsx +1 -1
  228. package/src/widgets/numeric-input.tsx +0 -3
  229. package/src/widgets/passage/passage-markdown.tsx +2 -2
  230. package/src/widgets/radio/__stories__/base-radio.stories.tsx +11 -19
  231. package/src/widgets/radio/__stories__/choice-icon.stories.tsx +9 -11
  232. package/src/widgets/radio/__stories__/choice-none-above.stories.tsx +1 -1
  233. package/src/widgets/radio/__stories__/choice.stories.tsx +4 -4
  234. package/src/widgets/radio/__stories__/focus-ring.stories.tsx +1 -1
  235. package/src/widgets/radio/__stories__/option-status.stories.tsx +2 -4
  236. package/src/widgets/radio/base-radio.tsx +1 -1
  237. package/src/widgets/radio/choice-icon/choice-icon.tsx +5 -5
  238. package/src/widgets/radio/choice-icon/cross-out-line.tsx +1 -3
  239. package/src/widgets/radio/choice-none-above.tsx +2 -2
  240. package/src/widgets/radio/choice.tsx +1 -3
  241. package/src/widgets/radio/focus-ring.tsx +1 -1
  242. package/src/widgets/radio/option-status.tsx +2 -4
  243. package/src/widgets/radio/widget.tsx +0 -1
  244. package/src/widgets/reaction-diagram.tsx +2 -2
  245. package/src/widgets/simulator.tsx +4 -6
  246. package/src/widgets/video-transcript-link.tsx +1 -1
  247. package/{tsconfig.json → tsconfig-build.json} +6 -6
  248. package/tsconfig-build.tsbuildinfo +1 -0
  249. package/tsconfig.tsbuildinfo +0 -1
package/dist/index.js CHANGED
@@ -9,11 +9,10 @@ var i18n = require('@khanacademy/wonder-blocks-i18n');
9
9
  var classNames = require('classnames');
10
10
  var React = require('react');
11
11
  var _ = require('underscore');
12
- var PropTypes = require('prop-types');
13
12
  var $ = require('jquery');
14
13
  var MathQuill = require('mathquill');
15
14
  var ReactDOM = require('react-dom');
16
- var createReactClass = require('create-react-class');
15
+ var PropTypes = require('prop-types');
17
16
  var kmath = require('@khanacademy/kmath');
18
17
  var Spacing = require('@khanacademy/wonder-blocks-spacing');
19
18
  var aphrodite = require('aphrodite');
@@ -29,6 +28,7 @@ var wonderBlocksLayout = require('@khanacademy/wonder-blocks-layout');
29
28
  var wonderBlocksPopover = require('@khanacademy/wonder-blocks-popover');
30
29
  var wonderBlocksDropdown = require('@khanacademy/wonder-blocks-dropdown');
31
30
  var debounce = require('lodash.debounce');
31
+ var createReactClass = require('create-react-class');
32
32
  var Tooltip$1 = require('@khanacademy/wonder-blocks-tooltip');
33
33
  var Link = require('@khanacademy/wonder-blocks-link');
34
34
 
@@ -58,18 +58,18 @@ var i18n__namespace = /*#__PURE__*/_interopNamespace(i18n);
58
58
  var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
59
59
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
60
60
  var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
61
- var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
62
61
  var $__default = /*#__PURE__*/_interopDefaultLegacy($);
63
62
  var MathQuill__default = /*#__PURE__*/_interopDefaultLegacy(MathQuill);
64
63
  var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
65
64
  var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
66
- var createReactClass__default = /*#__PURE__*/_interopDefaultLegacy(createReactClass);
65
+ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
67
66
  var Spacing__default = /*#__PURE__*/_interopDefaultLegacy(Spacing);
68
67
  var SimpleMarkdown__default = /*#__PURE__*/_interopDefaultLegacy(SimpleMarkdown);
69
68
  var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
70
69
  var Clickable__default = /*#__PURE__*/_interopDefaultLegacy(Clickable);
71
70
  var Color__default = /*#__PURE__*/_interopDefaultLegacy(Color);
72
71
  var debounce__default = /*#__PURE__*/_interopDefaultLegacy(debounce);
72
+ var createReactClass__default = /*#__PURE__*/_interopDefaultLegacy(createReactClass);
73
73
  var Tooltip__default = /*#__PURE__*/_interopDefaultLegacy(Tooltip$1);
74
74
  var Link__default = /*#__PURE__*/_interopDefaultLegacy(Link);
75
75
 
@@ -127,7 +127,30 @@ function _toPropertyKey(arg) {
127
127
  return typeof key === "symbol" ? key : String(key);
128
128
  }
129
129
 
130
- /* eslint-disable react/forbid-prop-types */
130
+ /**
131
+ * A stripped version of Icon.jsx from webapp. Takes an SVG icon and renders it
132
+ * inline like Font Awesome did.
133
+ *
134
+ * If you are looking for an icon that we've used before you should look in
135
+ * webapp's `icon-paths.js` which is a reference file for all the SVG paths
136
+ * that we've used. You'll need to copy the object from that file into
137
+ * whichever file you're using the icon and explicitly pass it in to the
138
+ * <InlineIcon/> React component.
139
+ *
140
+ * We assume that the viewBox is cropped and aligned to (0, 0), but icons can
141
+ * be defined differently. At some point we might want to add these attributes
142
+ * to `icon-paths.js`, but for now this is a fairly safe assumption.
143
+ *
144
+ * Sample usage:
145
+ *
146
+ * const editIcon = {
147
+ * path: "M41.209 53.753l5.39 0l0 5.39l3.136 0l6.468-6.517-8.477-8.526-6.517 6.517l0 3.136zm33.173-34.937q-.882-.882-1.862.049l-19.6 19.6q-.931.98-.049 1.862t1.862-.049l19.6-19.6q.931-.98.049-1.862zm-38.563 45.668l0-16.121l37.632-37.632 16.17 16.121-37.632 37.632l-16.17 0zm43.022-12.397l0 10.633q-.049 6.713-4.753 11.417t-11.368 4.704l-46.599 0q-6.713 0-11.417-4.753t-4.704-11.368l0-46.599q0-6.664 4.753-11.417t11.368-4.704l46.599 0q3.528 0 6.566 1.372.833.392.98 1.323t-.49 1.617l-2.744 2.744q-.784.784-1.96.441t-2.352-.343l-46.599 0q-3.675 0-6.321 2.646t-2.646 6.321l0 46.599q0 3.675 2.646 6.321t6.321 2.646l46.599 0q3.675 0 6.321-2.646t2.646-6.321l0-7.056q0-.735.49-1.225l3.577-3.577q.833-.833 1.96-.392t1.127 1.617zm7.203-51.646q2.254 0 3.773 1.568l8.526 8.526q1.568 1.568 1.568 3.822t-1.568 3.773l-5.145 5.145-16.121-16.121 5.145-5.145q1.568-1.568 3.822-1.568z",
148
+ * width: 100,
149
+ * height: 78.912,
150
+ * };
151
+ * <InlineIcon {...editIcon} />
152
+ *
153
+ */
131
154
  const InlineIcon = _ref => {
132
155
  let {
133
156
  path,
@@ -151,18 +174,6 @@ const InlineIcon = _ref => {
151
174
  fill: "currentColor"
152
175
  }));
153
176
  };
154
- InlineIcon.propTypes = {
155
- // An SVG path to render.
156
- path: PropTypes__default["default"].string.isRequired,
157
- // The path's viewBox dimensions.
158
- // We set the viewport height to 1em and scale the width accordingly.
159
- height: PropTypes__default["default"].number.isRequired,
160
- width: PropTypes__default["default"].number.isRequired,
161
- style: PropTypes__default["default"].object,
162
- // A11y description for this icon. If absent, icon is marked
163
- // aria-hidden=true
164
- title: PropTypes__default["default"].string
165
- };
166
177
 
167
178
  let _dependencies = null;
168
179
  const setDependencies = dependencies => {
@@ -695,145 +706,95 @@ _defineProperty(MathInput, "defaultProps", {
695
706
  buttonsVisible: "focused"
696
707
  });
697
708
 
698
- /**
699
- * A generic tooltip library for React.js
700
- *
701
- * This should eventually end up in react-components
702
- *
703
- * Interface: ({a, b} means one of a or b)
704
- * import Tooltip from "./tooltip";
705
- * <Tooltip
706
- * className="class-for-tooltip-contents"
707
- * horizontalPosition="left" // one of "left", "right"
708
- * horizontalAlign="left" // one of "left", "right"
709
- * verticalPosition="bottom" // one of "top", "bottom"
710
- * arrowSize={10} // arrow size in pixels
711
- * borderColor="#ccc" // color of the border for the tooltip
712
- * show={true} // whether the tooltip should currently be visible
713
- * targetContainerStyle={targetContainerStyle}
714
- * >
715
- * <TargetElementOfTheTooltip />
716
- * <TooltipContents1 />
717
- * <TooltipContents2 />
718
- * </Tooltip>
719
- *
720
- * To show/hide the tooltip, the parent component should call the
721
- * .show() and .hide() methods of the tooltip when appropriate.
722
- * (These are usually set up as handlers of events on the target element.)
723
- *
724
- * Notes:
725
- * className should not specify a border; that is handled by borderColor
726
- * so that the arrow and tooltip match
727
- */
728
709
  const zIndex = 10;
729
- const Triangle = createReactClass__default["default"]({
730
- displayName: "Triangle",
731
- propTypes: {
732
- color: PropTypes__default["default"].string.isRequired,
733
- left: PropTypes__default["default"].number.isRequired,
734
- top: PropTypes__default["default"].number.isRequired,
735
- width: PropTypes__default["default"].number.isRequired,
736
- height: PropTypes__default["default"].number.isRequired,
737
- horizontalDirection: PropTypes__default["default"].oneOf(["left", "right"]).isRequired,
738
- verticalDirection: PropTypes__default["default"].oneOf(["top", "bottom"]).isRequired
739
- },
740
- render: function () {
741
- let borderLeft;
742
- let borderRight;
743
- let borderTop;
744
- let borderBottom;
745
- const hBorder = "".concat(this.props.width, "px solid transparent");
746
- if (this.props.horizontalDirection === "right") {
747
- borderLeft = hBorder;
748
- } else {
749
- borderRight = hBorder;
750
- }
751
- const vBorder = "".concat(this.props.height, "px solid ").concat(this.props.color);
752
- if (this.props.verticalDirection === "top") {
753
- borderTop = vBorder;
754
- } else {
755
- borderBottom = vBorder;
756
- }
757
- return /*#__PURE__*/React__namespace.createElement("div", {
758
- style: {
759
- display: "block",
760
- height: 0,
761
- width: 0,
762
- position: "absolute",
763
- left: this.props.left,
764
- top: this.props["top"],
765
- borderLeft: borderLeft,
766
- borderRight: borderRight,
767
- borderTop: borderTop,
768
- borderBottom: borderBottom
769
- }
770
- });
710
+ let HorizontalDirection = /*#__PURE__*/function (HorizontalDirection) {
711
+ HorizontalDirection["Left"] = "left";
712
+ HorizontalDirection["Right"] = "right";
713
+ return HorizontalDirection;
714
+ }({});
715
+ let VerticalDirection = /*#__PURE__*/function (VerticalDirection) {
716
+ VerticalDirection["Top"] = "top";
717
+ VerticalDirection["Bottom"] = "bottom";
718
+ return VerticalDirection;
719
+ }({});
720
+ const Triangle = props => {
721
+ let borderLeft;
722
+ let borderRight;
723
+ let borderTop;
724
+ let borderBottom;
725
+ const hBorder = "".concat(props.width, "px solid transparent");
726
+ if (props.horizontalDirection === "right") {
727
+ borderLeft = hBorder;
728
+ } else {
729
+ borderRight = hBorder;
771
730
  }
772
- });
773
- const TooltipArrow = createReactClass__default["default"]({
774
- displayName: "TooltipArrow",
775
- propTypes: {
776
- position: PropTypes__default["default"].string,
777
- visibility: PropTypes__default["default"].string,
778
- left: PropTypes__default["default"].number,
779
- top: PropTypes__default["default"].number,
780
- color: PropTypes__default["default"].string.isRequired,
781
- // a css color
782
- border: PropTypes__default["default"].string.isRequired,
783
- // a css color
784
- width: PropTypes__default["default"].number.isRequired,
785
- height: PropTypes__default["default"].number.isRequired,
786
- horizontalDirection: PropTypes__default["default"].oneOf(["left", "right"]).isRequired,
787
- verticalDirection: PropTypes__default["default"].oneOf(["top", "bottom"]).isRequired
788
- },
789
- getDefaultProps: function () {
790
- return {
791
- position: "relative",
792
- visibility: "visible",
793
- left: 0,
794
- top: 0
795
- };
796
- },
731
+ const vBorder = "".concat(props.height, "px solid ").concat(props.color);
732
+ if (props.verticalDirection === "top") {
733
+ borderTop = vBorder;
734
+ } else {
735
+ borderBottom = vBorder;
736
+ }
737
+ return /*#__PURE__*/React__namespace.createElement("div", {
738
+ style: {
739
+ display: "block",
740
+ height: 0,
741
+ width: 0,
742
+ position: "absolute",
743
+ left: props.left,
744
+ top: props["top"],
745
+ borderLeft: borderLeft,
746
+ borderRight: borderRight,
747
+ borderTop: borderTop,
748
+ borderBottom: borderBottom
749
+ }
750
+ });
751
+ };
752
+ const TooltipArrow = props => {
797
753
  // TODO(aria): Think about adding a box-shadow to the triangle here
798
754
  // See http://css-tricks.com/triangle-with-shadow/
799
- render: function () {
800
- //const isRight = (this.props.horizontalDirection === "right");
801
- const isTop = this.props.verticalDirection === "top";
802
- const frontTopOffset = isTop ? 0 : 1;
803
- const borderTopOffset = isTop ? 0 : -1;
804
- return /*#__PURE__*/React__namespace.createElement("div", {
805
- style: {
806
- display: "block",
807
- position: this.props.position,
808
- visibility: this.props.visibility,
809
- left: this.props.left,
810
- top: this.props["top"],
811
- width: this.props.width + 2,
812
- height: this.props.height + 1,
813
- marginTop: -1,
814
- marginBottom: -2,
815
- zIndex: zIndex
816
- }
817
- }, /*#__PURE__*/React__namespace.createElement(Triangle, {
818
- horizontalDirection: this.props.horizontalDirection,
819
- verticalDirection: this.props.verticalDirection,
820
- color: this.props.border,
821
- left: 0,
822
- top: borderTopOffset,
823
- width: this.props.width + 2 // one extra for the diagonal
824
- ,
825
- height: this.props.height + 2
826
- }), /*#__PURE__*/React__namespace.createElement(Triangle, {
827
- horizontalDirection: this.props.horizontalDirection,
828
- verticalDirection: this.props.verticalDirection,
829
- color: this.props.color,
830
- left: 1,
831
- top: frontTopOffset,
832
- width: this.props.width,
833
- height: this.props.height
834
- }));
835
- }
836
- });
755
+
756
+ //const isRight = (this.props.horizontalDirection === "right");
757
+ const isTop = props.verticalDirection === "top";
758
+ const frontTopOffset = isTop ? 0 : 1;
759
+ const borderTopOffset = isTop ? 0 : -1;
760
+ return /*#__PURE__*/React__namespace.createElement("div", {
761
+ style: {
762
+ display: "block",
763
+ position: props.position,
764
+ visibility: props.visibility,
765
+ left: props.left,
766
+ top: props["top"],
767
+ width: props.width + 2,
768
+ height: props.height + 1,
769
+ marginTop: -1,
770
+ marginBottom: -2,
771
+ zIndex: zIndex
772
+ }
773
+ }, /*#__PURE__*/React__namespace.createElement(Triangle, {
774
+ horizontalDirection: props.horizontalDirection,
775
+ verticalDirection: props.verticalDirection,
776
+ color: props.border,
777
+ left: 0,
778
+ top: borderTopOffset,
779
+ width: props.width + 2 // one extra for the diagonal
780
+ ,
781
+ height: props.height + 2
782
+ }), /*#__PURE__*/React__namespace.createElement(Triangle, {
783
+ horizontalDirection: props.horizontalDirection,
784
+ verticalDirection: props.verticalDirection,
785
+ color: props.color,
786
+ left: 1,
787
+ top: frontTopOffset,
788
+ width: props.width,
789
+ height: props.height
790
+ }));
791
+ };
792
+ TooltipArrow.defaultProps = {
793
+ position: "relative",
794
+ visibility: "visible",
795
+ left: 0,
796
+ top: 0
797
+ };
837
798
  const VERTICAL_CORNERS = {
838
799
  top: {
839
800
  top: "-100%"
@@ -860,59 +821,34 @@ const HORIZONTAL_ALIGNMNENTS = {
860
821
  arrowLeft: arrowSize => -arrowSize - 2
861
822
  }
862
823
  };
863
-
864
- // eslint-disable-next-line react/no-unsafe
865
- const Tooltip = createReactClass__default["default"]({
866
- displayName: "Tooltip",
867
- propTypes: {
868
- show: PropTypes__default["default"].bool.isRequired,
869
- className: PropTypes__default["default"].string,
870
- arrowSize: PropTypes__default["default"].number,
871
- borderColor: PropTypes__default["default"].string,
872
- verticalPosition: PropTypes__default["default"].oneOf(Object.keys(VERTICAL_CORNERS)),
873
- horizontalPosition: PropTypes__default["default"].oneOf(Object.keys(HORIZONTAL_CORNERS)),
874
- horizontalAlign: PropTypes__default["default"].oneOf(Object.keys(HORIZONTAL_ALIGNMNENTS)),
875
- children: PropTypes__default["default"].arrayOf(PropTypes__default["default"].element).isRequired,
876
- targetContainerStyle: PropTypes__default["default"].any // style object
877
- },
878
-
879
- getDefaultProps: function () {
880
- return {
881
- className: "",
882
- arrowSize: 10,
883
- borderColor: "#ccc",
884
- verticalPosition: "bottom",
885
- horizontalPosition: "left",
886
- horizontalAlign: "left",
887
- targetContainerStyle: {}
888
- };
889
- },
890
- getInitialState: function () {
891
- return {
824
+ class Tooltip extends React__namespace.Component {
825
+ constructor() {
826
+ super(...arguments);
827
+ _defineProperty(this, "state", {
892
828
  height: null // used for offsetting "top" positioned tooltips
893
- };
894
- },
829
+ });
830
+ }
895
831
 
896
- componentDidMount: function () {
832
+ componentDidMount() {
897
833
  this._updateHeight();
898
- },
899
- UNSAFE_componentWillReceiveProps: function () {
834
+ }
835
+ UNSAFE_componentWillReceiveProps() {
900
836
  // If the contents have changed, reset our measure of the height
901
837
  this.setState({
902
838
  height: null
903
839
  });
904
- },
905
- componentDidUpdate: function () {
840
+ }
841
+ componentDidUpdate() {
906
842
  this._updateHeight();
907
- },
908
- _renderToolTipDiv: function (isTooltipAbove) {
843
+ }
844
+ _renderToolTipDiv(isTooltipAbove) {
909
845
  const settings = Object.assign({}, HORIZONTAL_CORNERS[this.props.horizontalPosition], HORIZONTAL_ALIGNMNENTS[this.props.horizontalAlign], VERTICAL_CORNERS[this.props.verticalPosition]);
910
846
  let arrowAbove;
911
847
  let arrowBelow;
912
848
  if (isTooltipAbove) {
913
849
  // We put an absolutely positioned arrow in the correct place
914
850
  arrowAbove = /*#__PURE__*/React__namespace.createElement(TooltipArrow, {
915
- verticalDirection: "top",
851
+ verticalDirection: VerticalDirection.Top,
916
852
  horizontalDirection: this.props.horizontalAlign,
917
853
  position: "absolute",
918
854
  color: "white",
@@ -927,7 +863,7 @@ const Tooltip = createReactClass__default["default"]({
927
863
  // And we use a visibility: hidden arrow below to shift up the
928
864
  // content by the correct amount
929
865
  arrowBelow = /*#__PURE__*/React__namespace.createElement(TooltipArrow, {
930
- verticalDirection: "top",
866
+ verticalDirection: VerticalDirection.Top,
931
867
  horizontalDirection: this.props.horizontalAlign,
932
868
  visibility: "hidden",
933
869
  color: "white",
@@ -940,7 +876,7 @@ const Tooltip = createReactClass__default["default"]({
940
876
  });
941
877
  } else {
942
878
  arrowAbove = /*#__PURE__*/React__namespace.createElement(TooltipArrow, {
943
- verticalDirection: "bottom",
879
+ verticalDirection: VerticalDirection.Bottom,
944
880
  horizontalDirection: this.props.horizontalAlign,
945
881
  color: "white",
946
882
  border: this.props.borderColor,
@@ -988,8 +924,8 @@ const Tooltip = createReactClass__default["default"]({
988
924
  zIndex: zIndex - 1
989
925
  }
990
926
  }, this.props.children.slice(1)), arrowBelow));
991
- },
992
- _updateHeight: function () {
927
+ }
928
+ _updateHeight() {
993
929
  const tooltipContainer = ReactDOM__default["default"].findDOMNode(
994
930
  // eslint-disable-next-line react/no-string-refs
995
931
  this.refs.tooltipContainer);
@@ -999,8 +935,8 @@ const Tooltip = createReactClass__default["default"]({
999
935
  height
1000
936
  });
1001
937
  }
1002
- },
1003
- render: function () {
938
+ }
939
+ render() {
1004
940
  const isTooltipAbove = this.props.verticalPosition === "top";
1005
941
 
1006
942
  /* We wrap the entire output in a span so that it displays inline */
@@ -1008,6 +944,17 @@ const Tooltip = createReactClass__default["default"]({
1008
944
  style: this.props.targetContainerStyle
1009
945
  }, this.props.children[0]), !isTooltipAbove && this._renderToolTipDiv());
1010
946
  }
947
+ }
948
+
949
+ // Sorry. // Apology-Oriented-Programming
950
+ _defineProperty(Tooltip, "defaultProps", {
951
+ className: "",
952
+ arrowSize: 10,
953
+ borderColor: "#ccc",
954
+ verticalPosition: VerticalDirection.Bottom,
955
+ horizontalPosition: HorizontalDirection.Left,
956
+ horizontalAlign: HorizontalDirection.Left,
957
+ targetContainerStyle: {}
1011
958
  });
1012
959
 
1013
960
  /**
@@ -2603,6 +2550,8 @@ class Expression extends React__namespace.Component {
2603
2550
  var _this;
2604
2551
  super(...arguments);
2605
2552
  _this = this;
2553
+ _defineProperty(this, "_isMounted", false);
2554
+ _defineProperty(this, "errorTimeout", null);
2606
2555
  _defineProperty(this, "displayName", "Expression");
2607
2556
  _defineProperty(this, "state", {
2608
2557
  showErrorTooltip: false,
@@ -2649,8 +2598,6 @@ class Expression extends React__namespace.Component {
2649
2598
  clearTimeout(this.errorTimeout);
2650
2599
  this._isMounted = false;
2651
2600
  });
2652
- _defineProperty(this, "_isMounted", false);
2653
- _defineProperty(this, "errorTimeout", null);
2654
2601
  _defineProperty(this, "simpleValidate", (rubric, onInputError) => {
2655
2602
  onInputError = onInputError || function () {};
2656
2603
  return Expression.validate(this.getUserInput(), rubric, onInputError);
@@ -2909,9 +2856,9 @@ class Expression extends React__namespace.Component {
2909
2856
  role: "tooltip"
2910
2857
  }, /*#__PURE__*/React__namespace.createElement(Tooltip, {
2911
2858
  className: "error-text-container",
2912
- horizontalPosition: "right",
2913
- horizontalAlign: "left",
2914
- verticalPosition: "top",
2859
+ horizontalPosition: HorizontalDirection.Right,
2860
+ horizontalAlign: HorizontalDirection.Left,
2861
+ verticalPosition: VerticalDirection.Top,
2915
2862
  arrowSize: 10,
2916
2863
  borderColor: "#fcc335",
2917
2864
  show: this.state.showErrorText
@@ -2983,7 +2930,7 @@ _defineProperty(Expression, "defaultProps", {
2983
2930
  const keypadConfigurationForProps = widgetOptions => {
2984
2931
  // Always use the Expression keypad, regardless of the button sets that have
2985
2932
  // been enabled.
2986
- const keypadType = mathInput.KeypadTypes.EXPRESSION;
2933
+ const keypadType = mathInput.KeypadType.EXPRESSION;
2987
2934
 
2988
2935
  // Extract any and all variables and constants from the answer forms.
2989
2936
  const uniqueExtraVariables = {};
@@ -3445,8 +3392,6 @@ function tickStepFromNumTicks(span, numTicks) {
3445
3392
  // Round start and stop values to step interval.
3446
3393
  return step;
3447
3394
  }
3448
- // [min, max]
3449
-
3450
3395
  const constrainTickStep = (step, range) => {
3451
3396
  const span = range[1] - range[0];
3452
3397
  const numTicks = span / step;
@@ -4483,31 +4428,25 @@ var constants$1 = /*#__PURE__*/Object.freeze({
4483
4428
  articleMaxWidthTableInPx: articleMaxWidthTableInPx
4484
4429
  });
4485
4430
 
4486
- /* eslint-disable react/prop-types */
4487
4431
  const MIN_VIEWPORT_HEIGHT = 480;
4488
- const FixedToResponsive = createReactClass__default["default"]({
4489
- displayName: "FixedToResponsive",
4490
- propTypes: {
4491
- width: PropTypes__default["default"].number.isRequired,
4492
- height: PropTypes__default["default"].number.isRequired,
4493
- className: PropTypes__default["default"].string,
4494
- constrainHeight: PropTypes__default["default"].bool,
4495
- allowFullBleed: PropTypes__default["default"].bool
4496
- },
4497
- getDefaultProps: function () {
4498
- return {
4499
- className: "",
4500
- constrainHeight: false,
4501
- allowFullBleed: false
4502
- };
4503
- },
4504
- getInitialState: function () {
4505
- return {
4432
+ class FixedToResponsive extends React__namespace.Component {
4433
+ constructor() {
4434
+ super(...arguments);
4435
+ _defineProperty(this, "_isMounted", false);
4436
+ _defineProperty(this, "state", {
4506
4437
  viewportHeight: null,
4507
4438
  viewportWidth: null
4508
- };
4509
- },
4510
- componentDidMount: function () {
4439
+ });
4440
+ _defineProperty(this, "_cacheViewportSize", () => {
4441
+ if (this._isMounted) {
4442
+ this.setState({
4443
+ viewportHeight: Math.max(MIN_VIEWPORT_HEIGHT, window.innerHeight),
4444
+ viewportWidth: window.innerWidth
4445
+ });
4446
+ }
4447
+ });
4448
+ }
4449
+ componentDidMount() {
4511
4450
  // TODO(scottgrant): This is a hack to remove the deprecated call to
4512
4451
  // this.isMounted() but is still considered an anti-pattern.
4513
4452
  this._isMounted = true;
@@ -4528,19 +4467,11 @@ const FixedToResponsive = createReactClass__default["default"]({
4528
4467
  } else {
4529
4468
  this._cacheViewportSize();
4530
4469
  }
4531
- },
4532
- componentWillUnmount: function () {
4470
+ }
4471
+ componentWillUnmount() {
4533
4472
  this._isMounted = false;
4534
- },
4535
- _cacheViewportSize: function () {
4536
- if (this._isMounted) {
4537
- this.setState({
4538
- viewportHeight: Math.max(MIN_VIEWPORT_HEIGHT, window.innerHeight),
4539
- viewportWidth: window.innerWidth
4540
- });
4541
- }
4542
- },
4543
- render: function () {
4473
+ }
4474
+ render() {
4544
4475
  // The ideal behavior for responsified, fixed size child components is
4545
4476
  // that they shrink when they need to (while preserving aspect ratio)
4546
4477
  // but never grow larger than their original dimensions. We accomplish
@@ -4596,6 +4527,11 @@ const FixedToResponsive = createReactClass__default["default"]({
4596
4527
  }
4597
4528
  return container;
4598
4529
  }
4530
+ }
4531
+ _defineProperty(FixedToResponsive, "defaultProps", {
4532
+ className: "",
4533
+ constrainHeight: false,
4534
+ allowFullBleed: false
4599
4535
  });
4600
4536
 
4601
4537
  /* eslint-disable @babel/no-invalid-this */
@@ -9125,6 +9061,26 @@ const KhanColors = {
9125
9061
  DYNAMIC: "#6495ED" // BLUE
9126
9062
  };
9127
9063
 
9064
+ function render(element, container, callback) {
9065
+ // TODO(LP-11406): Replace this, or callers, with React Portal
9066
+ // @ts-expect-error [FEI-5003] - TS2322 - Type 'void' is not assignable to type 'ElementRef<ElementType>'.
9067
+ // eslint-disable-next-line no-restricted-syntax
9068
+ return ReactDOM__default["default"].render(
9069
+ /*#__PURE__*/
9070
+ /**
9071
+ * `RenderStateRoot` is responsible for tracking whether it's
9072
+ * the initial render or subsequent renders. It's used by
9073
+ * `useUniqueId` and will be used by `UniqueIDProvider` and
9074
+ * `WithSSRPlaceholder` in the future. We're placing it as
9075
+ * high up in the render tree as possible to ensure that any
9076
+ * components using that hook or those components will function
9077
+ * correctly.
9078
+ */
9079
+ React__namespace.createElement(wonderBlocksCore.RenderStateRoot, {
9080
+ throwIfNested: false
9081
+ }, element), container, callback);
9082
+ }
9083
+
9128
9084
  function findChildOrAdd(elem, className) {
9129
9085
  const $child = $__default["default"](elem).find("." + className);
9130
9086
  if ($child.length === 0) {
@@ -9199,74 +9155,18 @@ var Tex$1 = {
9199
9155
 
9200
9156
  // Store the formula that we're using
9201
9157
  $elem.attr("data-math-formula", text);
9202
- const katex = await getDependencies().getKaTeX();
9203
- // Try to process the nodes with KaTeX first
9204
- try {
9205
- // Don't use the `trust: true` setting with KaTeX. There is a
9206
- // security issue with it as outlined in https://hackerone.com/reports/844216.
9207
- // See https://khanacademy.atlassian.net/browse/FEI-2225 for
9208
- // additional context.
9209
- katex.render(text, $katexHolder[0], {
9210
- colorIsTextColor: true
9211
- });
9212
- // If that worked, and we previously formatted with
9213
- // mathjax, do some mathjax cleanup
9214
- if ($elem.attr("data-math-type") === "mathjax") {
9215
- // Remove the old mathjax stuff
9216
- if (typeof MathJax !== "undefined") {
9217
- const jax = MathJax.Hub.getJaxFor(script);
9218
- if (jax) {
9219
- const e = jax.SourceElement();
9220
- if (e.previousSibling && e.previousSibling.className) {
9221
- jax.Remove();
9222
- }
9223
- }
9224
- }
9225
- }
9226
- $elem.attr("data-math-type", "katex");
9227
- // Call the callback
9158
+ const {
9159
+ TeX
9160
+ } = await getDependencies();
9161
+ // We use createElement instead of JSX here because we can't name this file tex.tsx;
9162
+ // that name is already taken.
9163
+ render( /*#__PURE__*/React__namespace.createElement(TeX, {
9164
+ children: text
9165
+ }), $katexHolder[0], () => {
9228
9166
  if (callback) {
9229
9167
  doCallback(elem, callback);
9230
9168
  }
9231
- return;
9232
- } catch (err) {
9233
- getDependencies().logKaTeXError(text, err);
9234
- if (err instanceof katex.ParseError) {
9235
- throw err;
9236
- }
9237
- }
9238
-
9239
- // Otherwise, fallback to MathJax
9240
-
9241
- // (Note: we don't need to do any katex cleanup here, because
9242
- // KaTeX is smart and cleans itself up)
9243
- $elem.attr("data-math-type", "mathjax");
9244
- // Update the script tag, or add one if necessary
9245
- if (!script) {
9246
- $mathjaxHolder.append("<script type='math/tex'>" + text.replace(/<\//g, "< /") + "</script>");
9247
- } else {
9248
- if ("text" in script) {
9249
- // IE8, etc
9250
- script.text = text;
9251
- } else {
9252
- script.textContent = text;
9253
- }
9254
- }
9255
- if (typeof MathJax !== "undefined") {
9256
- // Put the process, a debug log, and the callback into the
9257
- // MathJax queue
9258
- MathJax.Hub.Queue(["Reprocess", MathJax.Hub, $mathjaxHolder[0]]);
9259
- if (callback) {
9260
- MathJax.Hub.Queue(function () {
9261
- const cb = MathJax.Callback(function () {});
9262
- doCallback(elem, function () {
9263
- callback();
9264
- cb();
9265
- });
9266
- return cb;
9267
- });
9268
- }
9269
- }
9169
+ });
9270
9170
  }
9271
9171
  },
9272
9172
  // Function to restore a node to a non-math-processed state
@@ -10056,7 +9956,7 @@ GraphUtils.createGraphie = function (el) {
10056
9956
  * the function at i
10057
9957
  * @param {[]} rangeArray array of ranges over which the
10058
9958
  * corresponding functions are defined
10059
- * @return {Raphael set}
9959
+ * @return {Set<any>} set of paths
10060
9960
  */
10061
9961
  plotPiecewise: function (fnArray, rangeArray) {
10062
9962
  const paths = raphael$1.set();
@@ -10078,8 +9978,8 @@ GraphUtils.createGraphie = function (el) {
10078
9978
  * return a Raphael set of Raphael circle objects at those
10079
9979
  * coordinates
10080
9980
  *
10081
- * @param {Array of arrays} endpointArray
10082
- * @return {Raphael set}
9981
+ * @param {Array<[number, number]>} endpointArray
9982
+ * @return {Set<any>} set of circles
10083
9983
  */
10084
9984
  plotEndpointCircles: function (endpointArray) {
10085
9985
  const circles = raphael$1.set();
@@ -11240,10 +11140,11 @@ ___default["default"].extend(GraphUtils.Graphie.prototype, {
11240
11140
  }
11241
11141
  isClickingCanvas = true;
11242
11142
  if (options.onMouseMove) {
11143
+ const handler = options.onMouseMove;
11243
11144
  $__default["default"](document).bind("vmousemove.mouseLayer", function (e) {
11244
11145
  if (isClickingCanvas) {
11245
11146
  e.preventDefault();
11246
- options.onMouseMove(graph.getMouseCoord(e));
11147
+ handler(graph.getMouseCoord(e));
11247
11148
  }
11248
11149
  });
11249
11150
  }
@@ -11260,18 +11161,21 @@ ___default["default"].extend(GraphUtils.Graphie.prototype, {
11260
11161
  }
11261
11162
  });
11262
11163
  if (options.onMouseOver) {
11164
+ const handler = options.onMouseOver;
11263
11165
  $__default["default"](graph.mouselayer.canvas).on("vmouseover", function (e) {
11264
- options.onMouseOver(graph.getMouseCoord(e));
11166
+ handler(graph.getMouseCoord(e));
11265
11167
  });
11266
11168
  }
11267
11169
  if (options.onMouseOut) {
11170
+ const handler = options.onMouseOut;
11268
11171
  $__default["default"](graph.mouselayer.canvas).on("vmouseout", function (e) {
11269
- options.onMouseOut(graph.getMouseCoord(e));
11172
+ handler(graph.getMouseCoord(e));
11270
11173
  });
11271
11174
  }
11272
11175
  }
11273
11176
  if (!options.allowScratchpad) {
11274
- options.setDrawingAreaAvailable(false);
11177
+ var _options$setDrawingAr, _options;
11178
+ (_options$setDrawingAr = (_options = options).setDrawingAreaAvailable) === null || _options$setDrawingAr === void 0 ? void 0 : _options$setDrawingAr.call(_options, false);
11275
11179
  }
11276
11180
 
11277
11181
  // Add mouse and visible wrapper layers for DOM-node-wrapped movables
@@ -15075,26 +14979,6 @@ ___default["default"].extend(MovableLine$4.prototype, {
15075
14979
  }
15076
14980
  });
15077
14981
 
15078
- function render(element, container, callback) {
15079
- // TODO(LP-11406): Replace this, or callers, with React Portal
15080
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'void' is not assignable to type 'ElementRef<ElementType>'.
15081
- // eslint-disable-next-line no-restricted-syntax
15082
- return ReactDOM__default["default"].render(
15083
- /*#__PURE__*/
15084
- /**
15085
- * `RenderStateRoot` is responsible for tracking whether it's
15086
- * the initial render or subsequent renders. It's used by
15087
- * `useUniqueId` and will be used by `UniqueIDProvider` and
15088
- * `WithSSRPlaceholder` in the future. We're placing it as
15089
- * high up in the render tree as possible to ensure that any
15090
- * components using that hook or those components will function
15091
- * correctly.
15092
- */
15093
- React__namespace.createElement(wonderBlocksCore.RenderStateRoot, {
15094
- throwIfNested: false
15095
- }, element), container, callback);
15096
- }
15097
-
15098
14982
  /* eslint-disable @babel/no-invalid-this */
15099
14983
  const add$1 = {
15100
14984
  constrain: function () {
@@ -16576,24 +16460,27 @@ const {
16576
16460
  class Graphie extends React__namespace.Component {
16577
16461
  constructor() {
16578
16462
  super(...arguments);
16463
+ _defineProperty(this, "graphieDivRef", /*#__PURE__*/React__namespace.createRef());
16579
16464
  _defineProperty(this, "getGraphie", () => {
16580
16465
  // @ts-expect-error [FEI-5003] - TS2339 - Property '_graphie' does not exist on type 'Graphie'.
16581
16466
  return this._graphie;
16582
16467
  });
16583
16468
  _defineProperty(this, "_range", () => {
16584
- return ___default["default"].map(this.props.range, dimRange => {
16585
- if (dimRange[0] >= dimRange[1]) {
16469
+ const boundsCheckRange = range => {
16470
+ if (range[0] >= range[1]) {
16586
16471
  return [-10, 10];
16587
16472
  }
16588
- return dimRange;
16589
- });
16473
+ return range;
16474
+ };
16475
+ return [boundsCheckRange(this.props.range[0]), boundsCheckRange(this.props.range[1])];
16590
16476
  });
16591
16477
  _defineProperty(this, "_box", () => {
16592
- return ___default["default"].map(this.props.box, pixelDim => {
16478
+ const ensureMinSize = pixelDim => {
16593
16479
  // 340 = default size in the editor. exact value
16594
16480
  // is arbitrary; this is just a safety check.
16595
16481
  return pixelDim > 0 ? pixelDim : 340;
16596
- });
16482
+ };
16483
+ return [ensureMinSize(this.props.box[0]), ensureMinSize(this.props.box[1])];
16597
16484
  });
16598
16485
  _defineProperty(this, "_scale", () => {
16599
16486
  const box = this._box();
@@ -16605,9 +16492,7 @@ class Graphie extends React__namespace.Component {
16605
16492
  });
16606
16493
  _defineProperty(this, "_setupGraphie", () => {
16607
16494
  this._removeMovables();
16608
-
16609
- // eslint-disable-next-line react/no-string-refs
16610
- const graphieDiv = ReactDOM__default["default"].findDOMNode(this.refs.graphieDiv);
16495
+ const graphieDiv = ReactDOM__default["default"].findDOMNode(this.graphieDivRef.current);
16611
16496
  // @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call. | TS2339 - Property 'empty' does not exist on type 'JQueryStatic'.
16612
16497
  $__default["default"](graphieDiv).empty();
16613
16498
  // @ts-expect-error [FEI-5003] - TS2339 - Property '_graphie' does not exist on type 'Graphie'.
@@ -16821,29 +16706,12 @@ class Graphie extends React__namespace.Component {
16821
16706
  className: "graphie-container"
16822
16707
  }, /*#__PURE__*/React__namespace.createElement("div", {
16823
16708
  className: "graphie",
16824
- ref: "graphieDiv"
16709
+ ref: this.graphieDivRef
16825
16710
  }));
16826
16711
  }
16827
16712
  }
16828
16713
 
16829
16714
  // Attach Graphie.createClass and Graphie.createSimpleClass
16830
- _defineProperty(Graphie, "propTypes", {
16831
- addMouseLayer: PropTypes__default["default"].bool,
16832
- box: PropTypes__default["default"].arrayOf(PropTypes__default["default"].number).isRequired,
16833
- children: PropTypes__default["default"].node,
16834
- isMobile: PropTypes__default["default"].bool,
16835
- onClick: PropTypes__default["default"].func,
16836
- onMouseDown: PropTypes__default["default"].func,
16837
- onMouseMove: PropTypes__default["default"].func,
16838
- onMouseUp: PropTypes__default["default"].func,
16839
- options: PropTypes__default["default"].shape({
16840
- snapStep: PropTypes__default["default"].arrayOf(PropTypes__default["default"].number)
16841
- }),
16842
- range: PropTypes__default["default"].arrayOf(PropTypes__default["default"].arrayOf(PropTypes__default["default"].number)),
16843
- responsive: PropTypes__default["default"].bool,
16844
- setDrawingAreaAvailable: PropTypes__default["default"].func,
16845
- setup: PropTypes__default["default"].func.isRequired
16846
- });
16847
16715
  _defineProperty(Graphie, "defaultProps", {
16848
16716
  range: [[-10, 10], [-10, 10]],
16849
16717
  options: {},
@@ -17479,13 +17347,15 @@ class SvgImage extends React__namespace.Component {
17479
17347
  }
17480
17348
  });
17481
17349
  }
17482
- const scale = [40 * this.props.scale, 40 * this.props.scale];
17350
+
17351
+ // TODO: the "40" scale factor was introduced in D14974 but is not
17352
+ // documented where it came from.
17483
17353
  graphie = /*#__PURE__*/React__namespace.createElement(Graphie
17484
17354
  // eslint-disable-next-line react/no-string-refs
17485
17355
  , {
17486
17356
  ref: "graphie",
17487
17357
  box: box,
17488
- scale: scale,
17358
+ scale: [40 * this.props.scale, 40 * this.props.scale],
17489
17359
  range: this.state.range,
17490
17360
  options: ___default["default"].pick(this.state, "labels"),
17491
17361
  responsive: responsive,
@@ -18012,6 +17882,35 @@ const exclamationIcon = {
18012
17882
  height: 12,
18013
17883
  width: 12
18014
17884
  };
17885
+ var Severity = /*#__PURE__*/function (Severity) {
17886
+ Severity[Severity["Error"] = 1] = "Error";
17887
+ Severity[Severity["Warning"] = 2] = "Warning";
17888
+ Severity[Severity["Recommendation"] = 3] = "Recommendation";
17889
+ Severity[Severity["OfflineReportingOnly"] = 4] = "OfflineReportingOnly";
17890
+ return Severity;
17891
+ }(Severity || {});
17892
+ /**
17893
+ * This component renders "lint" nodes in a markdown parse tree. Lint nodes
17894
+ * are inserted into the tree by the Perseus linter (see
17895
+ * perseus-linter/src/index).
17896
+ *
17897
+ * This component serves multiple purposes
17898
+ *
17899
+ * 1) It renders a small circle in the right margin to indicate that there
17900
+ * is lint on (or near) that line.
17901
+ *
17902
+ * 2) The area around the circle is hoverable: when the mouse moves over it
17903
+ * the linty content is highlighted and a tooltip is displayed that explains
17904
+ * what the problem is.
17905
+ *
17906
+ * 3) The hoverable area is also an HTML <a> tag. Clicking on it opens
17907
+ * a new tab and links to additional details about the specific lint rule.
17908
+ *
17909
+ * The CSS required to position the circles in the right margin is tricky
17910
+ * and it does not always work perfectly. When lint occurs on a block element
17911
+ * that has a right margin (like anything blockquoted) the circle will appear
17912
+ * to the left of where it belongs. And if there is more
17913
+ **/
18015
17914
  class Lint extends React__namespace.Component {
18016
17915
  constructor() {
18017
17916
  super(...arguments);
@@ -18034,11 +17933,11 @@ class Lint extends React__namespace.Component {
18034
17933
  let severityStyle;
18035
17934
  let warningText;
18036
17935
  let warningTextStyle;
18037
- if (this.props.severity === 1) {
17936
+ if (this.props.severity === Severity.Error) {
18038
17937
  severityStyle = styles$A.indicatorError;
18039
17938
  warningText = "Error";
18040
17939
  warningTextStyle = styles$A.publishBlockingError;
18041
- } else if (this.props.severity === 2) {
17940
+ } else if (this.props.severity === Severity.Warning) {
18042
17941
  severityStyle = styles$A.indicatorWarning;
18043
17942
  warningText = "Warning";
18044
17943
  warningTextStyle = styles$A.warning;
@@ -18073,7 +17972,6 @@ class Lint extends React__namespace.Component {
18073
17972
  componentWillUnmount() {
18074
17973
  // TODO(somewhatabstract): Use WB timing
18075
17974
  // eslint-disable-next-line no-restricted-syntax
18076
- // @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
18077
17975
  window.clearTimeout(this._positionTimeout);
18078
17976
  }
18079
17977
 
@@ -18119,24 +18017,6 @@ class Lint extends React__namespace.Component {
18119
18017
  }, this.renderLink(styles$A.hoverTarget), /*#__PURE__*/React__namespace.createElement("div", null, children));
18120
18018
  }
18121
18019
  }
18122
- _defineProperty(Lint, "propTypes", {
18123
- // The children are the linty content we're highlighting
18124
- children: PropTypes__default["default"].node,
18125
- // Inline lint is highlighted differently than block lint.
18126
- inline: PropTypes__default["default"].bool,
18127
- // This is the text that appears in the tooltip
18128
- message: PropTypes__default["default"].string.isRequired,
18129
- // This is used as the fragment id (hash) in the URL of the link
18130
- ruleName: PropTypes__default["default"].string.isRequired,
18131
- // Lint warnings inside tables are handled specially
18132
- insideTable: PropTypes__default["default"].bool.isRequired,
18133
- // Should lint highlighting be rendered as a block to the left of
18134
- // the lint instead of on the right gutter?
18135
- blockHighlight: PropTypes__default["default"].bool,
18136
- // How important this lint message is for the editor. Severity goes
18137
- // from 1 (indicating an error) to 4 (offline reporting only)
18138
- severity: PropTypes__default["default"].number
18139
- });
18140
18020
  const styles$A = aphrodite.StyleSheet.create({
18141
18021
  // This is the class of the outermost element.
18142
18022
  // We use relative positioning so that the lint indicator can be
@@ -19403,8 +19283,6 @@ class Renderer extends React__namespace.Component {
19403
19283
 
19404
19284
  // The i18n linter.
19405
19285
 
19406
- // @ts-expect-error [FEI-5003] - TS2564 - Property 'lastRenderedMarkdown' has no initializer and is not definitely assigned in the constructor.
19407
-
19408
19286
  // @ts-expect-error [FEI-5003] - TS2564 - Property 'reuseMarkdown' has no initializer and is not definitely assigned in the constructor.
19409
19287
 
19410
19288
  // @ts-expect-error [FEI-5003] - TS2564 - Property 'translationIndex' has no initializer and is not definitely assigned in the constructor.
@@ -20567,9 +20445,6 @@ class Renderer extends React__namespace.Component {
20567
20445
  }
20568
20446
  render() {
20569
20447
  const apiOptions = this.getApiOptions();
20570
- const {
20571
- KatexProvider
20572
- } = getDependencies();
20573
20448
  if (this.reuseMarkdown) {
20574
20449
  return this.lastRenderedMarkdown;
20575
20450
  }
@@ -20610,9 +20485,9 @@ class Renderer extends React__namespace.Component {
20610
20485
  // Persues.TranslationComponent registry so that when jipt
20611
20486
  // calls its before_dom_insert we can lookup this component by
20612
20487
  // this attribute and render the text with markdown.
20613
- return /*#__PURE__*/React__namespace.createElement(KatexProvider, null, /*#__PURE__*/React__namespace.createElement(DefinitionProvider, null, /*#__PURE__*/React__namespace.createElement("div", {
20488
+ return /*#__PURE__*/React__namespace.createElement(DefinitionProvider, null, /*#__PURE__*/React__namespace.createElement("div", {
20614
20489
  "data-perseus-component-index": this.translationIndex
20615
- }, content)));
20490
+ }, content));
20616
20491
  }
20617
20492
  }
20618
20493
 
@@ -20661,9 +20536,9 @@ class Renderer extends React__namespace.Component {
20661
20536
  [ClassNames.RESPONSIVE_RENDERER]: true,
20662
20537
  [ClassNames.TWO_COLUMN_RENDERER]: this._isTwoColumn
20663
20538
  });
20664
- this.lastRenderedMarkdown = /*#__PURE__*/React__namespace.createElement(KatexProvider, null, /*#__PURE__*/React__namespace.createElement(DefinitionProvider, null, /*#__PURE__*/React__namespace.createElement("div", {
20539
+ this.lastRenderedMarkdown = /*#__PURE__*/React__namespace.createElement(DefinitionProvider, null, /*#__PURE__*/React__namespace.createElement("div", {
20665
20540
  className: className
20666
- }, markdownContents)));
20541
+ }, markdownContents));
20667
20542
  return this.lastRenderedMarkdown;
20668
20543
  }
20669
20544
  }
@@ -20939,13 +20814,6 @@ class MathOutput extends React__namespace.Component {
20939
20814
  this._unbindBlurHandler();
20940
20815
  }
20941
20816
  }
20942
- _defineProperty(MathOutput, "propTypes", {
20943
- value: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].number]),
20944
- className: PropTypes__default["default"].string,
20945
- labelText: PropTypes__default["default"].string,
20946
- onFocus: PropTypes__default["default"].func,
20947
- onBlur: PropTypes__default["default"].func
20948
- });
20949
20817
  _defineProperty(MathOutput, "defaultProps", {
20950
20818
  value: "",
20951
20819
  onFocus: function () {},
@@ -21186,9 +21054,9 @@ class InputWithExamples extends React__namespace.Component {
21186
21054
  , {
21187
21055
  ref: "tooltip",
21188
21056
  className: "perseus-formats-tooltip preview-measure",
21189
- horizontalPosition: "left",
21190
- horizontalAlign: "left",
21191
- verticalPosition: "bottom",
21057
+ horizontalPosition: HorizontalDirection.Left,
21058
+ horizontalAlign: HorizontalDirection.Left,
21059
+ verticalPosition: VerticalDirection.Bottom,
21192
21060
  arrowSize: 10,
21193
21061
  borderColor: "#ccc",
21194
21062
  show: showExamples
@@ -21259,7 +21127,7 @@ class SimpleKeypadInput extends React__namespace.Component {
21259
21127
  onFocus: () => {
21260
21128
  if (keypadElement) {
21261
21129
  keypadElement.configure({
21262
- keypadType: mathInput.KeypadTypes.FRACTION
21130
+ keypadType: mathInput.KeypadType.FRACTION
21263
21131
  }, () => {
21264
21132
  if (_this._isMounted) {
21265
21133
  onFocus && onFocus();
@@ -21890,8 +21758,7 @@ _defineProperty(NumericInput, "defaultProps", {
21890
21758
  coefficient: false,
21891
21759
  answerForms: [],
21892
21760
  labelText: "",
21893
- linterContext: PerseusLinter.linterContextDefault,
21894
- multipleNumberInput: false
21761
+ linterContext: PerseusLinter.linterContextDefault
21895
21762
  });
21896
21763
  const unionAnswerForms = function (answerFormsList) {
21897
21764
  // Takes a list of lists of answer forms, and returns a list of the forms
@@ -23839,9 +23706,7 @@ class Radio$1 extends React__namespace.Component {
23839
23706
  };
23840
23707
  });
23841
23708
  return /*#__PURE__*/React__namespace.createElement(BaseRadio, {
23842
- labelWrap: true
23843
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'boolean | undefined' is not assignable to type 'boolean'.
23844
- ,
23709
+ labelWrap: true,
23845
23710
  multipleSelect: this.props.multipleSelect,
23846
23711
  countChoices: this.props.countChoices,
23847
23712
  numCorrect: this.props.numCorrect,
@@ -27905,6 +27770,34 @@ class Graph extends React__namespace.Component {
27905
27770
  return ___default["default"].pick(this.props, "range", "step", "markings", "labels", "backgroundImage", "showProtractor", "showRuler", "rulerLabel", "rulerTicks", "gridStep", "snapStep");
27906
27771
  });
27907
27772
  }
27773
+ componentDidMount() {
27774
+ this._setupGraphie(true);
27775
+ }
27776
+ UNSAFE_componentWillReceiveProps(nextProps) {
27777
+ const potentialChanges = ["labels", "range", "step", "markings", "showProtractor", "showRuler", "rulerLabel", "rulerTicks", "gridStep", "snapStep"];
27778
+ const self = this;
27779
+ ___default["default"].each(potentialChanges, function (prop) {
27780
+ if (!___default["default"].isEqual(self.props[prop], nextProps[prop])) {
27781
+ self._shouldSetupGraphie = true;
27782
+ }
27783
+ });
27784
+ }
27785
+ componentDidUpdate() {
27786
+ // Only setupGraphie once per componentDidUpdate().
27787
+ // See explanation in setupGraphie().
27788
+ this._hasSetupGraphieThisUpdate = false;
27789
+ if (this._shouldSetupGraphie) {
27790
+ this._setupGraphie(false);
27791
+ this._shouldSetupGraphie = false;
27792
+ }
27793
+ }
27794
+
27795
+ /* Reset the graphie canvas to its initial state
27796
+ *
27797
+ * Use when re-rendering the parent component and you need a blank
27798
+ * graphie.
27799
+ */
27800
+
27908
27801
  render() {
27909
27802
  let image;
27910
27803
  const imageData = this.props.backgroundImage;
@@ -27943,55 +27836,7 @@ class Graph extends React__namespace.Component {
27943
27836
  ref: "graphieDiv"
27944
27837
  }));
27945
27838
  }
27946
- componentDidMount() {
27947
- this._setupGraphie(true);
27948
- }
27949
- componentDidUpdate() {
27950
- // Only setupGraphie once per componentDidUpdate().
27951
- // See explanation in setupGraphie().
27952
- this._hasSetupGraphieThisUpdate = false;
27953
- if (this._shouldSetupGraphie) {
27954
- this._setupGraphie(false);
27955
- this._shouldSetupGraphie = false;
27956
- }
27957
- }
27958
- UNSAFE_componentWillReceiveProps(nextProps) {
27959
- const potentialChanges = ["labels", "range", "step", "markings", "showProtractor", "showRuler", "rulerLabel", "rulerTicks", "gridStep", "snapStep"];
27960
- const self = this;
27961
- ___default["default"].each(potentialChanges, function (prop) {
27962
- if (!___default["default"].isEqual(self.props[prop], nextProps[prop])) {
27963
- self._shouldSetupGraphie = true;
27964
- }
27965
- });
27966
- }
27967
-
27968
- /* Reset the graphie canvas to its initial state
27969
- *
27970
- * Use when re-rendering the parent component and you need a blank
27971
- * graphie.
27972
- */
27973
27839
  }
27974
- _defineProperty(Graph, "propTypes", {
27975
- box: PropTypes__default["default"].array.isRequired,
27976
- labels: PropTypes__default["default"].arrayOf(PropTypes__default["default"].string),
27977
- range: PropTypes__default["default"].arrayOf(PropTypes__default["default"].arrayOf(PropTypes__default["default"].number)),
27978
- step: PropTypes__default["default"].arrayOf(PropTypes__default["default"].number),
27979
- gridStep: PropTypes__default["default"].arrayOf(PropTypes__default["default"].number),
27980
- snapStep: PropTypes__default["default"].arrayOf(PropTypes__default["default"].number),
27981
- markings: PropTypes__default["default"].string,
27982
- backgroundImage: PropTypes__default["default"].shape({
27983
- url: PropTypes__default["default"].string
27984
- }),
27985
- showProtractor: PropTypes__default["default"].bool,
27986
- showRuler: PropTypes__default["default"].bool,
27987
- rulerLabel: PropTypes__default["default"].string,
27988
- rulerTicks: PropTypes__default["default"].number,
27989
- onGraphieUpdated: PropTypes__default["default"].func,
27990
- instructions: PropTypes__default["default"].string,
27991
- onClick: PropTypes__default["default"].func,
27992
- setDrawingAreaAvailable: PropTypes__default["default"].func,
27993
- isMobile: PropTypes__default["default"].bool
27994
- });
27995
27840
  _defineProperty(Graph, "defaultProps", {
27996
27841
  labels: ["x", "y"],
27997
27842
  range: [[-10, 10], [-10, 10]],
@@ -28004,10 +27849,6 @@ _defineProperty(Graph, "defaultProps", {
28004
27849
  showRuler: false,
28005
27850
  rulerLabel: "",
28006
27851
  rulerTicks: 10,
28007
- instructions: null,
28008
- onGraphieUpdated: null,
28009
- onClick: null,
28010
- onMouseDown: null,
28011
27852
  isMobile: false
28012
27853
  });
28013
27854
 
@@ -29487,7 +29328,10 @@ class InteractiveGraph extends React__namespace.Component {
29487
29328
  } else {
29488
29329
  instructions = undefined;
29489
29330
  }
29490
- const onMouseDown = this.isClickToAddPoints() ? this.handleAddPointsMouseDown : null;
29331
+ let onMouseDown;
29332
+ if (this.isClickToAddPoints()) {
29333
+ onMouseDown = this.handleAddPointsMouseDown;
29334
+ }
29491
29335
  const gridStep = this.props.gridStep || Util.getGridStep(this.props.range, this.props.step, box[0]);
29492
29336
  const snapStep = this.props.snapStep || Util.snapStepFromGridStep(gridStep);
29493
29337
  const isMobile = this.props.apiOptions.isMobile;
@@ -30070,7 +29914,6 @@ _defineProperty(InteractiveGraph, "defaultProps", {
30070
29914
  labels: ["x", "y"],
30071
29915
  range: [[-10, 10], [-10, 10]],
30072
29916
  step: [1, 1],
30073
- // @ts-expect-error [FEI-5003] - TS2739 - Type '{ readonly url: null; }' is missing the following properties from type 'PerseusImageBackground': width, height
30074
29917
  backgroundImage: defaultBackgroundImage$1,
30075
29918
  markings: "graph",
30076
29919
  showTooltips: false,
@@ -32433,14 +32276,18 @@ var LightsPuzzle$1 = {
32433
32276
  transform: transformProps
32434
32277
  };
32435
32278
 
32436
- const HORIZONTAL$2 = "horizontal";
32437
- const VERTICAL$1 = "vertical";
32438
- const STATIC = "static";
32439
- const DRAGGING = "dragging";
32440
- const ANIMATING = "animating";
32441
- const DISABLED = "disabled";
32442
-
32443
- // Augment the given position with the scroll position of the offset parent.
32279
+ let Layout = /*#__PURE__*/function (Layout) {
32280
+ Layout["HORIZONTAL"] = "horizontal";
32281
+ Layout["VERTICAL"] = "vertical";
32282
+ return Layout;
32283
+ }({});
32284
+ var ItemState = /*#__PURE__*/function (ItemState) {
32285
+ ItemState["STATIC"] = "static";
32286
+ ItemState["DRAGGING"] = "dragging";
32287
+ ItemState["ANIMATING"] = "animating";
32288
+ ItemState["DISABLED"] = "disabled";
32289
+ return ItemState;
32290
+ }(ItemState || {}); // Augment the given position with the scroll position of the offset parent.
32444
32291
  const addOffsetParentScroll = ($el, position) => {
32445
32292
  // NOTE(slim): $(el).offsetParent() is NOT equivalent to $el[0].offsetParent.
32446
32293
  // Specifically, when `el` is not positioned, then the native HTMLElement.offsetParent
@@ -32454,14 +32301,13 @@ const addOffsetParentScroll = ($el, position) => {
32454
32301
  left: position.left + $offsetParent.scrollLeft()
32455
32302
  };
32456
32303
  };
32457
-
32458
32304
  // A placeholder that appears in the sortable whenever an item is dragged.
32459
32305
  class Placeholder extends React__namespace.Component {
32460
32306
  render() {
32461
32307
  const {
32462
32308
  layout
32463
32309
  } = this.props;
32464
- const className = aphrodite.css(styles$e.card, styles$e.placeholder, layout === HORIZONTAL$2 && styles$e.horizontalCard);
32310
+ const className = aphrodite.css(styles$e.card, styles$e.placeholder, layout === Layout.HORIZONTAL && styles$e.horizontalCard);
32465
32311
  const style = {
32466
32312
  width: this.props.width,
32467
32313
  height: this.props.height
@@ -32475,11 +32321,6 @@ class Placeholder extends React__namespace.Component {
32475
32321
  });
32476
32322
  }
32477
32323
  }
32478
- _defineProperty(Placeholder, "propTypes", {
32479
- layout: PropTypes__default["default"].oneOf([HORIZONTAL$2, VERTICAL$1]),
32480
- width: PropTypes__default["default"].number.isRequired,
32481
- height: PropTypes__default["default"].number.isRequired
32482
- });
32483
32324
  // A draggable item in the sortable. Can be in one of four states:
32484
32325
  // Static: The item is not being interacted with.
32485
32326
  // Dragging: The item is being dragged.
@@ -32506,7 +32347,8 @@ class Draggable extends React__namespace.Component {
32506
32347
  mouse: {
32507
32348
  left: 0,
32508
32349
  top: 0
32509
- }
32350
+ },
32351
+ dragging: false
32510
32352
  });
32511
32353
  _defineProperty(this, "getCurrentPosition", () => {
32512
32354
  return {
@@ -32525,7 +32367,7 @@ class Draggable extends React__namespace.Component {
32525
32367
  $__default["default"](document).off("mouseup", this.onMouseUp);
32526
32368
  });
32527
32369
  _defineProperty(this, "onMouseDown", event => {
32528
- if (this.props.type !== STATIC) {
32370
+ if (this.props.state !== ItemState.STATIC) {
32529
32371
  return;
32530
32372
  }
32531
32373
  if (!(event.button === 0 || event.touches != null && event.touches.length === 1)) {
@@ -32567,7 +32409,7 @@ class Draggable extends React__namespace.Component {
32567
32409
  });
32568
32410
  });
32569
32411
  _defineProperty(this, "onMouseMove", event => {
32570
- const notDragging = this.props.type !== DRAGGING || !this.state.dragging;
32412
+ const notDragging = this.props.state !== ItemState.DRAGGING || !this.state.dragging;
32571
32413
  if (notDragging) {
32572
32414
  return;
32573
32415
  }
@@ -32585,7 +32427,7 @@ class Draggable extends React__namespace.Component {
32585
32427
  }
32586
32428
  });
32587
32429
  _defineProperty(this, "onMouseUp", event => {
32588
- const notDragging = this.props.type !== DRAGGING || !this.state.dragging;
32430
+ const notDragging = this.props.state !== ItemState.DRAGGING || !this.state.dragging;
32589
32431
  if (notDragging) {
32590
32432
  return;
32591
32433
  }
@@ -32639,20 +32481,20 @@ class Draggable extends React__namespace.Component {
32639
32481
  const {
32640
32482
  includePadding,
32641
32483
  layout,
32642
- type
32484
+ state: type
32643
32485
  } = this.props;
32644
32486
 
32645
32487
  // We need to keep backwards compatbility with rules specified directly
32646
32488
  // in CSS. Hence the hacky tacking on of manual classNames.
32647
32489
  // See sortable.less for details.
32648
- let className = aphrodite.css(styles$e.card, styles$e.draggable, layout === HORIZONTAL$2 && styles$e.horizontalCard, layout === VERTICAL$1 && styles$e.verticalCard, type === DRAGGING && styles$e.dragging, type === DISABLED && styles$e.disabled, !includePadding && styles$e.unpaddedCard) + " " + ClassNames.INTERACTIVE + " perseus-sortable-draggable";
32490
+ let className = aphrodite.css(styles$e.card, styles$e.draggable, layout === Layout.HORIZONTAL && styles$e.horizontalCard, layout === Layout.VERTICAL && styles$e.verticalCard, type === ItemState.DRAGGING && styles$e.dragging, type === ItemState.DISABLED && styles$e.disabled, !includePadding && styles$e.unpaddedCard) + " " + ClassNames.INTERACTIVE + " perseus-sortable-draggable";
32649
32491
  if (!includePadding) {
32650
32492
  className += " perseus-sortable-draggable-unpadded";
32651
32493
  }
32652
32494
  const style = {
32653
32495
  position: "static"
32654
32496
  };
32655
- if (this.props.type === DRAGGING || this.props.type === ANIMATING) {
32497
+ if (this.props.state === ItemState.DRAGGING || this.props.state === ItemState.ANIMATING) {
32656
32498
  ___default["default"].extend(style, {
32657
32499
  position: "absolute"
32658
32500
  }, this.getCurrentPosition());
@@ -32682,10 +32524,10 @@ class Draggable extends React__namespace.Component {
32682
32524
  }));
32683
32525
  }
32684
32526
  componentDidUpdate(prevProps) {
32685
- if (this.props.type === prevProps.type) {
32527
+ if (this.props.state === prevProps.state) {
32686
32528
  return;
32687
32529
  }
32688
- if (this.props.type === ANIMATING) {
32530
+ if (this.props.state === ItemState.ANIMATING) {
32689
32531
  // Start animating
32690
32532
  const current = this.getCurrentPosition();
32691
32533
  const duration = 15 * Math.sqrt(Math.sqrt(Math.pow(this.props.endPosition.left - current.left, 2) + Math.pow(this.props.endPosition.top - current.top, 2)));
@@ -32696,29 +32538,16 @@ class Draggable extends React__namespace.Component {
32696
32538
  // Animating -> Static
32697
32539
  complete: this.props.onAnimationEnd
32698
32540
  });
32699
- } else if (this.props.type === STATIC) {
32541
+ } else if (this.props.state === ItemState.STATIC) {
32700
32542
  // Ensure that any animations are done
32701
32543
  // @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call. | TS2339 - Property 'finish' does not exist on type 'JQueryStatic'.
32702
32544
  $__default["default"](ReactDOM__default["default"].findDOMNode(this)).finish();
32703
32545
  }
32704
32546
  }
32705
32547
  }
32706
- _defineProperty(Draggable, "propTypes", {
32707
- content: PropTypes__default["default"].string.isRequired,
32708
- endPosition: PropTypes__default["default"].object.isRequired,
32709
- includePadding: PropTypes__default["default"].bool,
32710
- layout: PropTypes__default["default"].oneOf([HORIZONTAL$2, VERTICAL$1]),
32711
- onAnimationEnd: PropTypes__default["default"].func.isRequired,
32712
- onMouseDown: PropTypes__default["default"].func.isRequired,
32713
- onMouseMove: PropTypes__default["default"].func.isRequired,
32714
- onMouseUp: PropTypes__default["default"].func.isRequired,
32715
- onRender: PropTypes__default["default"].func.isRequired,
32716
- type: PropTypes__default["default"].oneOf([STATIC, DRAGGING, ANIMATING, DISABLED]),
32717
- linterContext: PerseusLinter__namespace.linterContextProps
32718
- });
32719
32548
  _defineProperty(Draggable, "defaultProps", {
32720
32549
  includePadding: true,
32721
- type: STATIC,
32550
+ type: ItemState.STATIC,
32722
32551
  linterContext: PerseusLinter__namespace.linterContextDefault
32723
32552
  });
32724
32553
  class Sortable extends React__namespace.Component {
@@ -32733,7 +32562,7 @@ class Sortable extends React__namespace.Component {
32733
32562
  }, 20));
32734
32563
  this.state = {
32735
32564
  items: Sortable.itemsFromProps(this.props),
32736
- katex: null
32565
+ texRendererLoaded: false
32737
32566
  };
32738
32567
  }
32739
32568
  UNSAFE_componentWillReceiveProps(nextProps) {
@@ -32761,20 +32590,13 @@ class Sortable extends React__namespace.Component {
32761
32590
  }, 0);
32762
32591
  }
32763
32592
  }
32764
- componentDidMount() {
32765
- getDependencies().getKaTeX().then(katex => {
32766
- this.setState({
32767
- katex
32768
- });
32769
- });
32770
- }
32771
32593
  static itemsFromProps(props) {
32772
- const type = props.disabled ? DISABLED : STATIC;
32594
+ const state = props.disabled ? ItemState.DISABLED : ItemState.STATIC;
32773
32595
  return props.options.map((option, i) => {
32774
32596
  return {
32775
32597
  option: option,
32776
32598
  key: i,
32777
- type: type,
32599
+ state,
32778
32600
  endPosition: {},
32779
32601
  width: 0,
32780
32602
  height: 0
@@ -32797,8 +32619,7 @@ class Sortable extends React__namespace.Component {
32797
32619
  // explictly set on Draggables - this prevents them from changing size
32798
32620
  // or shape while being dragged.
32799
32621
 
32800
- // @ts-expect-error [FEI-5003] - TS2740 - Type 'readonly SortableItem[]' is missing the following properties from type 'SortableItem': option, key, type, endPosition, and 2 more.
32801
- let items = ___default["default"].clone(this.state.items);
32622
+ let items = [...this.state.items];
32802
32623
 
32803
32624
  // Fetches a jQuery list of elements for each item
32804
32625
  const $items = ___default["default"].map(items, function (item) {
@@ -32816,7 +32637,7 @@ class Sortable extends React__namespace.Component {
32816
32637
  if (constraints !== null && constraints !== void 0 && constraints.width) {
32817
32638
  // Items must be at least as wide as the specified constraint
32818
32639
  syncWidth = ___default["default"].max(widths.concat(constraints.width));
32819
- } else if (layout === VERTICAL$1) {
32640
+ } else if (layout === Layout.VERTICAL) {
32820
32641
  // Sync widths to get a clean column
32821
32642
  syncWidth = ___default["default"].max(widths);
32822
32643
  }
@@ -32824,21 +32645,17 @@ class Sortable extends React__namespace.Component {
32824
32645
  if (constraints !== null && constraints !== void 0 && constraints.height) {
32825
32646
  // Items must be at least as high as the specified constraint
32826
32647
  syncHeight = ___default["default"].max(heights.concat(constraints.height));
32827
- } else if (layout === HORIZONTAL$2) {
32648
+ } else if (layout === Layout.HORIZONTAL) {
32828
32649
  // Sync widths to get a clean row
32829
32650
  syncHeight = ___default["default"].max(heights);
32830
32651
  }
32831
-
32832
- // @ts-expect-error [FEI-5003] - TS2740 - Type 'any[]' is missing the following properties from type 'SortableItem': option, key, type, endPosition, and 2 more.
32833
32652
  items = ___default["default"].map(items, function (item, i) {
32834
32653
  item.width = syncWidth || widths[i];
32835
32654
  item.height = syncHeight || heights[i];
32836
32655
  return item;
32837
32656
  });
32838
-
32839
- // @ts-expect-error [FEI-5003] - TS2740 - Type 'SortableItem' is missing the following properties from type 'readonly SortableItem[]': length, concat, join, slice, and 18 more.
32840
32657
  this.setState({
32841
- items: items
32658
+ items
32842
32659
  }, () => {
32843
32660
  this.props.onMeasure && this.props.onMeasure({
32844
32661
  widths: widths,
@@ -32848,14 +32665,30 @@ class Sortable extends React__namespace.Component {
32848
32665
  }
32849
32666
  render() {
32850
32667
  var _this$props$constrain, _this$props$constrain2;
32851
- // We don't render the sortable until KaTeX has fully loaded, in case
32852
- // the draggables are rendering KaTeX content. This is un-optimal as
32853
- // we end up loading KaTeX even when we may not need it, however it
32854
- // helps to ensure that the dimensions of the draggables (and thus the
32855
- // sortable) will be correct when they render, if their contents are
32856
- // KaTeX-derived.
32857
- if (this.props.waitForKatexLoad && !this.state.katex) {
32858
- return /*#__PURE__*/React__namespace.createElement(wonderBlocksProgressSpinner.CircularSpinner, null);
32668
+ // To minimize layout shift, we display a spinner until our math
32669
+ // renderer is ready to render the math inside the sortable. To
32670
+ // do this, we:
32671
+ // - render a dummy TeX component to force the math renderer to load
32672
+ // - display a spinner until the TeX component calls its onRender
32673
+ // callback, signifying that the math is rendered (from which we can
32674
+ // infer that the math renderer has loaded)
32675
+ //
32676
+ // If we didn't do this, the user might see a sortable with empty
32677
+ // cells on first render, and then the math would pop in a few moments
32678
+ // later once the rendering library loaded.
32679
+ if (this.props.waitForTexRendererToLoad && !this.state.texRendererLoaded) {
32680
+ const {
32681
+ TeX
32682
+ } = getDependencies();
32683
+ return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(wonderBlocksProgressSpinner.CircularSpinner, null), /*#__PURE__*/React__namespace.createElement("div", {
32684
+ style: {
32685
+ display: "none"
32686
+ }
32687
+ }, /*#__PURE__*/React__namespace.createElement(TeX, {
32688
+ onRender: () => this.setState({
32689
+ texRendererLoaded: true
32690
+ })
32691
+ }, "1")));
32859
32692
  }
32860
32693
  const cards = [];
32861
32694
  const {
@@ -32864,19 +32697,19 @@ class Sortable extends React__namespace.Component {
32864
32697
  // We need to keep backwards compatbility with rules specified directly
32865
32698
  // in CSS. See sortable.less for details.
32866
32699
  const className = aphrodite.css(styles$e.sortable) + " perseus-sortable";
32867
- const syncWidth = ((_this$props$constrain = this.props.constraints) === null || _this$props$constrain === void 0 ? void 0 : _this$props$constrain.width) || layout === VERTICAL$1;
32868
- const syncHeight = ((_this$props$constrain2 = this.props.constraints) === null || _this$props$constrain2 === void 0 ? void 0 : _this$props$constrain2.height) || layout === HORIZONTAL$2;
32700
+ const syncWidth = ((_this$props$constrain = this.props.constraints) === null || _this$props$constrain === void 0 ? void 0 : _this$props$constrain.width) || layout === Layout.VERTICAL;
32701
+ const syncHeight = ((_this$props$constrain2 = this.props.constraints) === null || _this$props$constrain2 === void 0 ? void 0 : _this$props$constrain2.height) || layout === Layout.HORIZONTAL;
32869
32702
  ___default["default"].each(this.state.items, function (item, i, items) {
32870
32703
  const isLast = i === items.length - 1;
32871
- const isStatic = item.type === STATIC || item.type === DISABLED;
32704
+ const isStatic = item.state === ItemState.STATIC || item.state === ItemState.DISABLED;
32872
32705
  let margin;
32873
32706
 
32874
32707
  // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
32875
- if (this.props.layout === HORIZONTAL$2) {
32708
+ if (this.props.layout === Layout.HORIZONTAL) {
32876
32709
  // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
32877
32710
  margin = "0 " + this.props.margin + "px 0 0"; // right
32878
32711
  // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
32879
- } else if (this.props.layout === VERTICAL$1) {
32712
+ } else if (this.props.layout === Layout.VERTICAL) {
32880
32713
  // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
32881
32714
  margin = "0 0 " + this.props.margin + "px 0"; // bottom
32882
32715
  }
@@ -32884,7 +32717,7 @@ class Sortable extends React__namespace.Component {
32884
32717
  cards.push( /*#__PURE__*/React__namespace.createElement(Draggable, {
32885
32718
  content: item.option,
32886
32719
  key: item.key,
32887
- type: item.type
32720
+ state: item.state
32888
32721
  // @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
32889
32722
  ,
32890
32723
  ref: item.key,
@@ -32933,7 +32766,7 @@ class Sortable extends React__namespace.Component {
32933
32766
  // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
32934
32767
  this, item.key)
32935
32768
  }));
32936
- if (item.type === DRAGGING || item.type === ANIMATING) {
32769
+ if (item.state === ItemState.DRAGGING || item.state === ItemState.ANIMATING) {
32937
32770
  cards.push( /*#__PURE__*/React__namespace.createElement(Placeholder, {
32938
32771
  key: "placeholder_" + item.key,
32939
32772
  ref: "placeholder_" + item.key,
@@ -32952,7 +32785,7 @@ class Sortable extends React__namespace.Component {
32952
32785
  // Static -> Dragging
32953
32786
  const items = ___default["default"].map(this.state.items, function (item) {
32954
32787
  if (item.key === key) {
32955
- item.type = DRAGGING;
32788
+ item.state = ItemState.DRAGGING;
32956
32789
  }
32957
32790
  return item;
32958
32791
  });
@@ -33012,7 +32845,7 @@ class Sortable extends React__namespace.Component {
33012
32845
 
33013
32846
  // @ts-expect-error [FEI-5003] - TS2551 - Property 'splice' does not exist on type 'readonly SortableItem[]'. Did you mean 'slice'?
33014
32847
  items.splice(currentIndex, 1);
33015
- if (this.props.layout === HORIZONTAL$2) {
32848
+ if (this.props.layout === Layout.HORIZONTAL) {
33016
32849
  // @ts-expect-error [FEI-5003] - TS2339 - Property 'offset' does not exist on type 'JQueryStatic'. | TS2339 - Property 'offset' does not exist on type 'JQueryStatic'.
33017
32850
  const midWidth = $draggable.offset().left - $sortable.offset().left;
33018
32851
  let sumWidth = 0;
@@ -33052,7 +32885,7 @@ class Sortable extends React__namespace.Component {
33052
32885
  const nextAnimationFrame = requestAnimationFrame(() => {
33053
32886
  const items = ___default["default"].map(this.state.items, function (item) {
33054
32887
  if (item.key === key) {
33055
- item.type = ANIMATING;
32888
+ item.state = ItemState.ANIMATING;
33056
32889
  const $placeholder = $__default["default"](
33057
32890
  // @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
33058
32891
  ReactDOM__default["default"].findDOMNode(
@@ -33082,7 +32915,7 @@ class Sortable extends React__namespace.Component {
33082
32915
  // Animating -> Static
33083
32916
  const items = ___default["default"].map(this.state.items, function (item) {
33084
32917
  if (item.key === key) {
33085
- item.type = STATIC;
32918
+ item.state = ItemState.STATIC;
33086
32919
  }
33087
32920
  return item;
33088
32921
  });
@@ -33095,7 +32928,7 @@ class Sortable extends React__namespace.Component {
33095
32928
  }
33096
32929
  }
33097
32930
  _defineProperty(Sortable, "defaultProps", {
33098
- layout: HORIZONTAL$2,
32931
+ layout: Layout.HORIZONTAL,
33099
32932
  padding: true,
33100
32933
  disabled: false,
33101
32934
  constraints: {},
@@ -33103,7 +32936,7 @@ _defineProperty(Sortable, "defaultProps", {
33103
32936
  margin: 5,
33104
32937
  onChange: function () {},
33105
32938
  linterContext: PerseusLinter__namespace.linterContextDefault,
33106
- waitForKatexLoad: true
32939
+ waitForTexRendererToLoad: true
33107
32940
  });
33108
32941
  const styles$e = aphrodite.StyleSheet.create({
33109
32942
  sortable: {
@@ -33165,7 +32998,7 @@ class Matcher extends React__namespace.Component {
33165
32998
  _defineProperty(this, "state", {
33166
32999
  leftHeight: 0,
33167
33000
  rightHeight: 0,
33168
- katex: null
33001
+ texRendererLoaded: false
33169
33002
  });
33170
33003
  _defineProperty(this, "changeAndTrack", e => {
33171
33004
  this.props.onChange(e);
@@ -33184,10 +33017,10 @@ class Matcher extends React__namespace.Component {
33184
33017
  });
33185
33018
  });
33186
33019
  _defineProperty(this, "getUserInput", () => {
33187
- // If KaTeX hasn't loaded then we won't be able to get the contents
33188
- // of the sortables on the left and right, so we just return empty
33189
- // arrays until we render for the first time.
33190
- if (!this.state.katex) {
33020
+ // If the math renderer hasn't loaded then we won't be able to get the
33021
+ // contents of the sortables on the left and right, so we just return
33022
+ // empty arrays until we render for the first time.
33023
+ if (!this.state.texRendererLoaded) {
33191
33024
  return {
33192
33025
  left: [],
33193
33026
  right: []
@@ -33217,20 +33050,33 @@ class Matcher extends React__namespace.Component {
33217
33050
  return Matcher.validate(this.getUserInput(), rubric);
33218
33051
  });
33219
33052
  }
33220
- componentDidMount() {
33221
- getDependencies().getKaTeX().then(katex => this.setState({
33222
- katex
33223
- }));
33224
- }
33225
33053
  render() {
33226
- // We don't render the Matcher until KaTeX has fully loaded, in case
33227
- // the sortables are rendering KaTeX content. This is un-optimal as
33228
- // we end up loading KaTeX even when we may not need it, however it
33229
- // helps to ensure that the dimensions of the sortables (and thus the
33230
- // Matcher) will be correct when they render, if their contents are
33231
- // KaTeX-derived.
33232
- if (!this.state.katex) {
33233
- return /*#__PURE__*/React__namespace.createElement(wonderBlocksProgressSpinner.CircularSpinner, null);
33054
+ // To minimize layout shift, we display a spinner until our math
33055
+ // renderer is ready to render the math inside the matcher. To
33056
+ // do this, we:
33057
+ // - render a dummy TeX component to force the math renderer to load
33058
+ // - display a spinner until the TeX component calls its onRender
33059
+ // callback, signifying that the math is rendered (from which we can
33060
+ // infer that the math renderer has loaded)
33061
+ //
33062
+ // If we didn't do this, the user might see a matcher with empty
33063
+ // columns on first render, and then the math would pop in a few
33064
+ // moments later once the rendering library loaded.
33065
+ if (!this.state.texRendererLoaded) {
33066
+ const {
33067
+ TeX
33068
+ } = getDependencies();
33069
+ return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(wonderBlocksProgressSpinner.CircularSpinner, null), /*#__PURE__*/React__namespace.createElement("div", {
33070
+ style: {
33071
+ display: "none"
33072
+ }
33073
+ }, /*#__PURE__*/React__namespace.createElement(TeX, {
33074
+ onRender: () => {
33075
+ this.setState({
33076
+ texRendererLoaded: true
33077
+ });
33078
+ }
33079
+ }, "1")));
33234
33080
  }
33235
33081
 
33236
33082
  // Use the same random() function to shuffle both columns sequentially
@@ -33268,7 +33114,7 @@ class Matcher extends React__namespace.Component {
33268
33114
  className: aphrodite.css(styles$d.column)
33269
33115
  }, /*#__PURE__*/React__namespace.createElement(Sortable, {
33270
33116
  options: left,
33271
- layout: "vertical",
33117
+ layout: Layout.VERTICAL,
33272
33118
  padding: this.props.padding,
33273
33119
  disabled: !this.props.orderMatters,
33274
33120
  constraints: constraints,
@@ -33285,7 +33131,7 @@ class Matcher extends React__namespace.Component {
33285
33131
  // @ts-expect-error [FEI-5003] - TS2322 - Type 'readonly unknown[]' is not assignable to type 'readonly string[]'.
33286
33132
  , {
33287
33133
  options: right,
33288
- layout: "vertical",
33134
+ layout: Layout.VERTICAL,
33289
33135
  padding: this.props.padding,
33290
33136
  constraints: constraints,
33291
33137
  onMeasure: this.onMeasureRight,
@@ -39938,11 +39784,7 @@ class Histogram extends React__namespace.Component {
39938
39784
  box: this.props.box,
39939
39785
  range: range,
39940
39786
  data: data,
39941
- scale: [
39942
- // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'any[]' is not assignable to parameter of type 'Coordinates'.
39943
- Util.scaleFromExtent(range[0], this.props.box[0]),
39944
- // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'any[]' is not assignable to parameter of type 'Coordinates'.
39945
- Util.scaleFromExtent(range[1], this.props.box[1])]
39787
+ scale: [Util.scaleFromExtent(range[0], this.props.box[0]), Util.scaleFromExtent(range[1], this.props.box[1])]
39946
39788
  };
39947
39789
  const axisStyle = {
39948
39790
  stroke: "#000",
@@ -45778,99 +45620,90 @@ _defineProperty(ElementContainer, "defaultProps", {
45778
45620
  title: "More"
45779
45621
  });
45780
45622
 
45781
- class HUD extends React__namespace.Component {
45782
- constructor() {
45783
- super(...arguments);
45784
- _defineProperty(this, "renderVisibleIcon", () => {
45785
- return /*#__PURE__*/React__namespace.createElement("svg", {
45786
- width: "24",
45787
- height: "24",
45788
- viewBox: "0 0 24 24",
45789
- className: aphrodite.css(styles$2.icon)
45790
- }, /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("path", {
45791
- id: "a",
45792
- d: "M7.401 10.035c-1.424.748-2.599 1.905-3.544 " + "3.48a1 1 0 0 1-1.714-1.03C4.325 8.849 7.652 7 " + "12 7c4.348 0 7.675 1.848 9.857 5.486a1 1 0 0 " + "1-1.714 1.028c-.945-1.574-2.12-2.73-3.544-" + "3.48a5 5 0 1 1-9.198 0zM12 15a3 3 0 1 0 0-6 3 3 " + "0 0 0 0 6z"
45793
- })), /*#__PURE__*/React__namespace.createElement("g", {
45794
- fill: "none",
45795
- fillRule: "evenodd"
45796
- }, /*#__PURE__*/React__namespace.createElement("path", {
45797
- fill: "none",
45798
- d: "M0 0h24v24H0z"
45799
- }), /*#__PURE__*/React__namespace.createElement("mask", {
45800
- id: "b",
45801
- fill: "#fff"
45802
- }, /*#__PURE__*/React__namespace.createElement("use", {
45803
- href: "#a"
45804
- })), /*#__PURE__*/React__namespace.createElement("use", {
45805
- fill: "#fff",
45806
- fillRule: "nonzero",
45807
- href: "#a"
45808
- }), /*#__PURE__*/React__namespace.createElement("g", {
45809
- fill: "#fff",
45810
- mask: "url(#b)"
45811
- }, /*#__PURE__*/React__namespace.createElement("path", {
45812
- d: "M0 0h24v24H0z"
45813
- }))));
45814
- });
45815
- _defineProperty(this, "renderHiddenIcon", () => {
45816
- return /*#__PURE__*/React__namespace.createElement("svg", {
45817
- width: "24",
45818
- height: "24",
45819
- viewBox: "0 0 24 24",
45820
- className: aphrodite.css(styles$2.icon)
45821
- }, /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("path", {
45822
- id: "a",
45823
- d: "M8.794 7.38C9.791 7.127 10.86 7 12 7c4.348 0 " + "7.675 1.848 9.857 5.486a1 1 0 0 1-1.714 " + "1.028c-.945-1.574-2.12-2.73-3.544-3.48.258." + "604.401 1.268.401 1.966 0 1.02-.305 " + "1.967-.828 2.757l2.535 2.536a1 1 0 0 " + "1-1.414 1.414l-12-12a1 1 0 0 1 " + "1.414-1.414L8.794 7.38zm5.914 5.913a3 3 0 0 " + "0-4.001-4.001l4 4.001zM6.072 8.486l2.976 " + "2.976a3 3 0 0 0 3.49 3.49l1.579 1.58A5 5 0 " + "0 1 7.4 10.035c-1.424.747-2.599 1.904-3.544 " + "3.478a1 1 0 0 1-1.714-1.028c1.049-1.75 " + "2.363-3.085 3.929-4z"
45824
- })), /*#__PURE__*/React__namespace.createElement("g", {
45825
- fill: "none",
45826
- fillRule: "evenodd"
45827
- }, /*#__PURE__*/React__namespace.createElement("path", {
45828
- fill: "none",
45829
- d: "M0 0h24v24H0z"
45830
- }), /*#__PURE__*/React__namespace.createElement("mask", {
45831
- id: "b",
45832
- fill: "#fff"
45833
- }, /*#__PURE__*/React__namespace.createElement("use", {
45834
- href: "#a"
45835
- })), /*#__PURE__*/React__namespace.createElement("use", {
45836
- fill: "#fff",
45837
- fillRule: "nonzero",
45838
- href: "#a"
45839
- }), /*#__PURE__*/React__namespace.createElement("g", {
45840
- fill: "#fff",
45841
- mask: "url(#b)"
45842
- }, /*#__PURE__*/React__namespace.createElement("path", {
45843
- d: "M0 0h24v24H0z"
45844
- }))));
45845
- });
45623
+ // Displays a stylized open eye: lint warnings are visible
45624
+ const VisibleIcon = () => /*#__PURE__*/React__namespace.createElement("svg", {
45625
+ width: "24",
45626
+ height: "24",
45627
+ viewBox: "0 0 24 24",
45628
+ className: aphrodite.css(styles$2.icon)
45629
+ }, /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("path", {
45630
+ id: "a",
45631
+ d: "M7.401 10.035c-1.424.748-2.599 1.905-3.544 " + "3.48a1 1 0 0 1-1.714-1.03C4.325 8.849 7.652 7 " + "12 7c4.348 0 7.675 1.848 9.857 5.486a1 1 0 0 " + "1-1.714 1.028c-.945-1.574-2.12-2.73-3.544-" + "3.48a5 5 0 1 1-9.198 0zM12 15a3 3 0 1 0 0-6 3 3 " + "0 0 0 0 6z"
45632
+ })), /*#__PURE__*/React__namespace.createElement("g", {
45633
+ fill: "none",
45634
+ fillRule: "evenodd"
45635
+ }, /*#__PURE__*/React__namespace.createElement("path", {
45636
+ fill: "none",
45637
+ d: "M0 0h24v24H0z"
45638
+ }), /*#__PURE__*/React__namespace.createElement("mask", {
45639
+ id: "b",
45640
+ fill: "#fff"
45641
+ }, /*#__PURE__*/React__namespace.createElement("use", {
45642
+ href: "#a"
45643
+ })), /*#__PURE__*/React__namespace.createElement("use", {
45644
+ fill: "#fff",
45645
+ fillRule: "nonzero",
45646
+ href: "#a"
45647
+ }), /*#__PURE__*/React__namespace.createElement("g", {
45648
+ fill: "#fff",
45649
+ mask: "url(#b)"
45650
+ }, /*#__PURE__*/React__namespace.createElement("path", {
45651
+ d: "M0 0h24v24H0z"
45652
+ }))));
45653
+
45654
+ // Displays a stylized eye with a line through it: I don't want to see lint
45655
+ const HiddenIcon = () => /*#__PURE__*/React__namespace.createElement("svg", {
45656
+ width: "24",
45657
+ height: "24",
45658
+ viewBox: "0 0 24 24",
45659
+ className: aphrodite.css(styles$2.icon)
45660
+ }, /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("path", {
45661
+ id: "a",
45662
+ d: "M8.794 7.38C9.791 7.127 10.86 7 12 7c4.348 0 " + "7.675 1.848 9.857 5.486a1 1 0 0 1-1.714 " + "1.028c-.945-1.574-2.12-2.73-3.544-3.48.258." + "604.401 1.268.401 1.966 0 1.02-.305 " + "1.967-.828 2.757l2.535 2.536a1 1 0 0 " + "1-1.414 1.414l-12-12a1 1 0 0 1 " + "1.414-1.414L8.794 7.38zm5.914 5.913a3 3 0 0 " + "0-4.001-4.001l4 4.001zM6.072 8.486l2.976 " + "2.976a3 3 0 0 0 3.49 3.49l1.579 1.58A5 5 0 " + "0 1 7.4 10.035c-1.424.747-2.599 1.904-3.544 " + "3.478a1 1 0 0 1-1.714-1.028c1.049-1.75 " + "2.363-3.085 3.929-4z"
45663
+ })), /*#__PURE__*/React__namespace.createElement("g", {
45664
+ fill: "none",
45665
+ fillRule: "evenodd"
45666
+ }, /*#__PURE__*/React__namespace.createElement("path", {
45667
+ fill: "none",
45668
+ d: "M0 0h24v24H0z"
45669
+ }), /*#__PURE__*/React__namespace.createElement("mask", {
45670
+ id: "b",
45671
+ fill: "#fff"
45672
+ }, /*#__PURE__*/React__namespace.createElement("use", {
45673
+ href: "#a"
45674
+ })), /*#__PURE__*/React__namespace.createElement("use", {
45675
+ fill: "#fff",
45676
+ fillRule: "nonzero",
45677
+ href: "#a"
45678
+ }), /*#__PURE__*/React__namespace.createElement("g", {
45679
+ fill: "#fff",
45680
+ mask: "url(#b)"
45681
+ }, /*#__PURE__*/React__namespace.createElement("path", {
45682
+ d: "M0 0h24v24H0z"
45683
+ }))));
45684
+ const HUD = _ref => {
45685
+ let {
45686
+ message,
45687
+ enabled,
45688
+ onClick,
45689
+ fixedPosition = true
45690
+ } = _ref;
45691
+ let state;
45692
+ let icon;
45693
+ if (enabled) {
45694
+ state = styles$2.enabled;
45695
+ icon = /*#__PURE__*/React__namespace.createElement(VisibleIcon, null);
45696
+ } else {
45697
+ state = styles$2.disabled;
45698
+ icon = /*#__PURE__*/React__namespace.createElement(HiddenIcon, null);
45846
45699
  }
45847
- render() {
45848
- let state;
45849
- let icon;
45850
- if (this.props.enabled) {
45851
- state = styles$2.enabled;
45852
- icon = this.renderVisibleIcon();
45853
- } else {
45854
- state = styles$2.disabled;
45855
- icon = this.renderHiddenIcon();
45700
+ return /*#__PURE__*/React__namespace.createElement("button", {
45701
+ className: aphrodite.css(styles$2.hud, fixedPosition && styles$2.hudFixedPosition, state),
45702
+ onClick: e => {
45703
+ onClick();
45856
45704
  }
45857
- return /*#__PURE__*/React__namespace.createElement("button", {
45858
- className: aphrodite.css(styles$2.hud, this.props.fixedPosition && styles$2.hudFixedPosition, state),
45859
- onClick: e => {
45860
- this.props.onClick();
45861
- }
45862
- }, icon, this.props.message);
45863
- }
45864
- }
45865
- _defineProperty(HUD, "propTypes", {
45866
- message: PropTypes__default["default"].string.isRequired,
45867
- enabled: PropTypes__default["default"].bool.isRequired,
45868
- onClick: PropTypes__default["default"].func.isRequired,
45869
- fixedPosition: PropTypes__default["default"].bool
45870
- });
45871
- _defineProperty(HUD, "defaultProps", {
45872
- fixedPosition: true
45873
- });
45705
+ }, icon, message);
45706
+ };
45874
45707
  const styles$2 = aphrodite.StyleSheet.create({
45875
45708
  hud: {
45876
45709
  boxSizing: "border-box",