@khanacademy/perseus-editor 2.15.5 → 2.15.7

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 (29) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/es/index.js +190 -329
  3. package/dist/es/index.js.map +1 -1
  4. package/dist/index.js +190 -338
  5. package/dist/index.js.map +1 -1
  6. package/dist/widgets/interaction-editor/function-editor.d.ts +19 -20
  7. package/dist/widgets/interaction-editor/interaction-editor.d.ts +23 -14
  8. package/dist/widgets/interaction-editor/label-editor.d.ts +15 -16
  9. package/dist/widgets/interaction-editor/line-editor.d.ts +23 -24
  10. package/dist/widgets/interaction-editor/mathquill-input.d.ts +12 -0
  11. package/dist/widgets/interaction-editor/movable-line-editor.d.ts +23 -26
  12. package/dist/widgets/interaction-editor/movable-point-editor.d.ts +18 -22
  13. package/dist/widgets/interaction-editor/parametric-editor.d.ts +21 -22
  14. package/dist/widgets/interaction-editor/point-editor.d.ts +13 -14
  15. package/dist/widgets/interaction-editor/rectangle-editor.d.ts +17 -18
  16. package/package.json +3 -2
  17. package/src/widgets/__stories__/interaction-editor.stories.tsx +17 -4
  18. package/src/widgets/interaction-editor/constraint-editor.tsx +9 -21
  19. package/src/widgets/interaction-editor/function-editor.tsx +26 -29
  20. package/src/widgets/interaction-editor/interaction-editor.tsx +24 -17
  21. package/src/widgets/interaction-editor/label-editor.tsx +20 -24
  22. package/src/widgets/interaction-editor/line-editor.tsx +30 -34
  23. package/src/widgets/interaction-editor/mathquill-input.tsx +81 -0
  24. package/src/widgets/interaction-editor/movable-line-editor.tsx +30 -34
  25. package/src/widgets/interaction-editor/movable-point-editor.tsx +23 -26
  26. package/src/widgets/interaction-editor/parametric-editor.tsx +28 -33
  27. package/src/widgets/interaction-editor/point-editor.tsx +17 -24
  28. package/src/widgets/interaction-editor/rectangle-editor.tsx +23 -32
  29. package/tsconfig-build.tsbuildinfo +1 -1
package/dist/es/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { addLibraryVersionToPerseusDebug } from '@khanacademy/perseus-core';
2
2
  import { constants, components, Widgets, icons, WIDGET_PROP_DENYLIST, Util, Log, PerseusError, Errors, PerseusMarkdown, preprocessTex, ApiOptions, buildMapper, itemToTree, buildEmptyItemTreeForShape, shapes, ItemExtras, itemDataVersion, ClassNames, MultiItems, traverse, Categorizer as Categorizer$1, Changeable, EditorJsonify, Dependencies, WidgetJsonifyDeprecated, PerseusExpressionAnswerFormConsidered, Expression, interactiveSizes, KhanMath, GrapherWidget, GrapherUtil, SizingUtils, KhanColors, ColorPicker, DashPicker, ArrowPicker, ElementContainer, InteractiveGraphWidget, globalStyles, globalConstants, MatrixWidget, PlotterWidget, plotterPlotTypes, BaseRadio, TableWidget, TransformerWidget, displaySigFigs, widgets } from '@khanacademy/perseus';
3
3
  import * as React from 'react';
4
+ import { useRef, useEffect } from 'react';
4
5
  import _ from 'underscore';
5
6
  import PropTypes from 'prop-types';
6
7
  import createReactClass from 'create-react-class';
@@ -17,6 +18,7 @@ import classNames from 'classnames';
17
18
  import { point, number, line, ray, vector } from '@khanacademy/kmath';
18
19
  import * as KAS from '@khanacademy/kas';
19
20
  import { isTruthy } from '@khanacademy/wonder-stuff-core';
21
+ import { createMathField } from '@khanacademy/math-input';
20
22
  import Spacing from '@khanacademy/wonder-blocks-spacing';
21
23
  import * as Typography from '@khanacademy/wonder-blocks-typography';
22
24
  import Button from '@khanacademy/wonder-blocks-button';
@@ -24,7 +26,7 @@ import * as i18n$1 from '@khanacademy/wonder-blocks-i18n';
24
26
 
25
27
  // This file is processed by a Rollup plugin (replace) to inject the production
26
28
  const libName = "@khanacademy/perseus-editor";
27
- const libVersion = "2.15.5";
29
+ const libVersion = "2.15.7";
28
30
  addLibraryVersionToPerseusDebug(libName, libVersion);
29
31
 
30
32
  function _extends() {
@@ -218,7 +220,7 @@ class SectionControlButton extends React.Component {
218
220
  role: "button",
219
221
  hideDefaultFocusRing: true,
220
222
  "aria-label": title,
221
- style: styles$f.button
223
+ style: styles$g.button
222
224
  }, ({
223
225
  hovered,
224
226
  focused,
@@ -226,7 +228,7 @@ class SectionControlButton extends React.Component {
226
228
  }) => /*#__PURE__*/React.createElement(InlineIcon$c, icon));
227
229
  }
228
230
  }
229
- const styles$f = StyleSheet.create({
231
+ const styles$g = StyleSheet.create({
230
232
  button: {
231
233
  backgroundColor: Color.gold,
232
234
  margin: 2,
@@ -20755,19 +20757,19 @@ class TexErrorView extends React.Component {
20755
20757
  const {
20756
20758
  showErrors
20757
20759
  } = this.state;
20758
- const iconStyle = showErrors ? styles$e.iconExpanded : styles$e.iconCollapsed;
20760
+ const iconStyle = showErrors ? styles$f.iconExpanded : styles$f.iconCollapsed;
20759
20761
  return /*#__PURE__*/React.createElement(View, {
20760
- style: styles$e.errorContainer
20762
+ style: styles$f.errorContainer
20761
20763
  }, /*#__PURE__*/React.createElement(View, {
20762
- style: styles$e.title,
20764
+ style: styles$f.title,
20763
20765
  onClick: this.handleToggleTexErrors
20764
20766
  }, /*#__PURE__*/React.createElement(PhosphorIcon, {
20765
20767
  icon: caretRight,
20766
20768
  style: iconStyle
20767
20769
  }), "\xA0 TeX Errors (", errorList.length, ")"), showErrors && /*#__PURE__*/React.createElement(View, {
20768
- style: styles$e.errorExplanation
20770
+ style: styles$f.errorExplanation
20769
20771
  }, "If your math doesn't display correctly, these errors might help you troubleshoot. Message #content-kitchen for help."), showErrors && errorList.map((e, index) => /*#__PURE__*/React.createElement(View, {
20770
- style: styles$e.error,
20772
+ style: styles$f.error,
20771
20773
  key: index
20772
20774
  }, /*#__PURE__*/React.createElement(View, {
20773
20775
  style: {
@@ -20776,7 +20778,7 @@ class TexErrorView extends React.Component {
20776
20778
  }, e.math), /*#__PURE__*/React.createElement(View, null, e.message))));
20777
20779
  }
20778
20780
  }
20779
- const styles$e = StyleSheet.create({
20781
+ const styles$f = StyleSheet.create({
20780
20782
  title: {
20781
20783
  backgroundColor: "#eee",
20782
20784
  fontSize: "1.25em",
@@ -24828,7 +24830,7 @@ class SimpleButton extends React.Component {
24828
24830
  } = _this$props,
24829
24831
  otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded$3);
24830
24832
  return /*#__PURE__*/React.createElement("div", _extends({
24831
- className: css(styles$d.baseButton, color === "green" && styles$d.green, color === "orange" && styles$d.orange),
24833
+ className: css(styles$e.baseButton, color === "green" && styles$e.green, color === "orange" && styles$e.orange),
24832
24834
  onClick: onClick
24833
24835
  }, otherProps), children);
24834
24836
  }
@@ -24843,7 +24845,7 @@ SimpleButton.defaultProps = {
24843
24845
  color: "green",
24844
24846
  onClick: () => {}
24845
24847
  };
24846
- const styles$d = StyleSheet.create({
24848
+ const styles$e = StyleSheet.create({
24847
24849
  baseButton: {
24848
24850
  top: "0",
24849
24851
  fontSize: "11px",
@@ -25063,23 +25065,23 @@ const LeafContainer = ({
25063
25065
  }) => {
25064
25066
  const hasPreviewHeading = shape.type === "content" || shape.type === "hint";
25065
25067
  const previewHeading = hasPreviewHeading && /*#__PURE__*/React.createElement("div", {
25066
- className: css(styles$c.containerHeader)
25068
+ className: css(styles$d.containerHeader)
25067
25069
  }, /*#__PURE__*/React.createElement(Header, {
25068
25070
  depth: path.length,
25069
- className: css(styles$c.containerTitle)
25071
+ className: css(styles$d.containerTitle)
25070
25072
  }, capitalize(name)));
25071
25073
  return /*#__PURE__*/React.createElement("div", {
25072
- className: css(styles$c.container)
25074
+ className: css(styles$d.container)
25073
25075
  }, /*#__PURE__*/React.createElement("span", {
25074
- className: css(styles$c.row, styles$c.rowHeading)
25076
+ className: css(styles$d.row, styles$d.rowHeading)
25075
25077
  }, /*#__PURE__*/React.createElement("div", {
25076
- className: css(styles$c.columnLeft)
25078
+ className: css(styles$d.columnLeft)
25077
25079
  }, /*#__PURE__*/React.createElement("div", {
25078
- className: "pod-title " + css(styles$c.containerHeader)
25080
+ className: "pod-title " + css(styles$d.containerHeader)
25079
25081
  }, /*#__PURE__*/React.createElement("div", {
25080
- className: css(styles$c.containerTitle)
25082
+ className: css(styles$d.containerTitle)
25081
25083
  }, capitalize(name)), controls)), /*#__PURE__*/React.createElement("div", {
25082
- className: css(styles$c.columnRight)
25084
+ className: css(styles$d.columnRight)
25083
25085
  }, previewHeading)), children);
25084
25086
  };
25085
25087
  const ArrayContainer = props => {
@@ -25092,11 +25094,11 @@ const ArrayContainer = props => {
25092
25094
  actions
25093
25095
  } = props;
25094
25096
  return /*#__PURE__*/React.createElement("div", {
25095
- className: css(styles$c.container)
25097
+ className: css(styles$d.container)
25096
25098
  }, controls && /*#__PURE__*/React.createElement("div", {
25097
- className: css(styles$c.columnLeft, styles$c.containerHeader)
25099
+ className: css(styles$d.columnLeft, styles$d.containerHeader)
25098
25100
  }, controls), /*#__PURE__*/React.createElement("div", null, children), /*#__PURE__*/React.createElement("div", {
25099
- className: css(styles$c.columnLeft)
25101
+ className: css(styles$d.columnLeft)
25100
25102
  }, /*#__PURE__*/React.createElement("a", {
25101
25103
  href: "javascript:void 0",
25102
25104
  onClick: () => actions.addArrayElement(path, shape.elementShape)
@@ -25109,28 +25111,28 @@ const ObjectContainer = ({
25109
25111
  path
25110
25112
  }) => {
25111
25113
  const headingEditor = /*#__PURE__*/React.createElement("div", {
25112
- className: css(styles$c.containerHeader)
25114
+ className: css(styles$d.containerHeader)
25113
25115
  }, /*#__PURE__*/React.createElement(Header, {
25114
25116
  depth: path.length,
25115
- className: css(styles$c.containerTitle)
25117
+ className: css(styles$d.containerTitle)
25116
25118
  }, capitalize(name)), controls);
25117
25119
  const headingPreview = (name || controls) && /*#__PURE__*/React.createElement("div", {
25118
- className: css(styles$c.containerHeader, styles$c.previewCollectionHeader)
25120
+ className: css(styles$d.containerHeader, styles$d.previewCollectionHeader)
25119
25121
  }, /*#__PURE__*/React.createElement(Header, {
25120
25122
  depth: path.length,
25121
- className: css(styles$c.containerTitle)
25123
+ className: css(styles$d.containerTitle)
25122
25124
  }, capitalize(name)));
25123
25125
  const hasBothHeadings = headingEditor && headingPreview;
25124
25126
  return /*#__PURE__*/React.createElement("div", {
25125
- className: css(styles$c.container)
25127
+ className: css(styles$d.container)
25126
25128
  }, hasBothHeadings && /*#__PURE__*/React.createElement("span", {
25127
- className: css(styles$c.row)
25129
+ className: css(styles$d.row)
25128
25130
  }, /*#__PURE__*/React.createElement("div", {
25129
- className: css(styles$c.columnLeft)
25131
+ className: css(styles$d.columnLeft)
25130
25132
  }, headingEditor), /*#__PURE__*/React.createElement("div", {
25131
- className: css(styles$c.columnRight)
25133
+ className: css(styles$d.columnRight)
25132
25134
  }, headingPreview)), /*#__PURE__*/React.createElement("div", {
25133
- className: css(path.length > 0 && styles$c.contentIndent)
25135
+ className: css(path.length > 0 && styles$d.contentIndent)
25134
25136
  }, children));
25135
25137
  };
25136
25138
 
@@ -25253,11 +25255,11 @@ const ItemNodeContent = withStickiness(props => {
25253
25255
  className: "framework-perseus"
25254
25256
  }, lens(renderers).get(path));
25255
25257
  return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("div", {
25256
- className: css(styles$c.row)
25258
+ className: css(styles$d.row)
25257
25259
  }, /*#__PURE__*/React.createElement("div", {
25258
- className: css(styles$c.columnLeft)
25260
+ className: css(styles$d.columnLeft)
25259
25261
  }, /*#__PURE__*/React.createElement("div", {
25260
- className: css(sticky && styles$c.sticky)
25262
+ className: css(sticky && styles$d.sticky)
25261
25263
  },
25262
25264
  /*#__PURE__*/
25263
25265
  // @ts-expect-error - TS2769 - No overload matches this call.
@@ -25265,9 +25267,9 @@ const ItemNodeContent = withStickiness(props => {
25265
25267
  onChange: newVal => actions.mergeValueAtPath(path, newVal),
25266
25268
  apiOptions: apiOptions
25267
25269
  })))), /*#__PURE__*/React.createElement("div", {
25268
- className: css(styles$c.columnRight)
25270
+ className: css(styles$d.columnRight)
25269
25271
  }, /*#__PURE__*/React.createElement("div", {
25270
- className: css(sticky && styles$c.sticky)
25272
+ className: css(sticky && styles$d.sticky)
25271
25273
  }, preview))));
25272
25274
  });
25273
25275
  const HintNodeContent = withStickiness(props => {
@@ -25283,13 +25285,13 @@ const HintNodeContent = withStickiness(props => {
25283
25285
  className: "framework-perseus"
25284
25286
  }, lens(renderers).get(path));
25285
25287
  return /*#__PURE__*/React.createElement("div", {
25286
- className: css(styles$c.row)
25288
+ className: css(styles$d.row)
25287
25289
  }, /*#__PURE__*/React.createElement("div", {
25288
- className: css(styles$c.columnLeft)
25290
+ className: css(styles$d.columnLeft)
25289
25291
  }, /*#__PURE__*/React.createElement("div", {
25290
- className: css(sticky && styles$c.sticky)
25292
+ className: css(sticky && styles$d.sticky)
25291
25293
  }, /*#__PURE__*/React.createElement(HintEditor, _extends({}, data, {
25292
- className: css(styles$c.hintEditor),
25294
+ className: css(styles$d.hintEditor),
25293
25295
  onChange: newVal => actions.mergeValueAtPath(path, newVal),
25294
25296
  apiOptions: apiOptions,
25295
25297
  showTitle: false,
@@ -25304,9 +25306,9 @@ const HintNodeContent = withStickiness(props => {
25304
25306
  isFirst: true,
25305
25307
  isLast: true
25306
25308
  })))), /*#__PURE__*/React.createElement("div", {
25307
- className: css(styles$c.columnRight)
25309
+ className: css(styles$d.columnRight)
25308
25310
  }, /*#__PURE__*/React.createElement("div", {
25309
- className: css(sticky && styles$c.sticky)
25311
+ className: css(sticky && styles$d.sticky)
25310
25312
  }, preview)));
25311
25313
  });
25312
25314
  const TagsNodeContent = props => {
@@ -25323,9 +25325,9 @@ const TagsNodeContent = props => {
25323
25325
  return null;
25324
25326
  }
25325
25327
  return /*#__PURE__*/React.createElement("div", {
25326
- className: css(styles$c.columnLeft)
25328
+ className: css(styles$d.columnLeft)
25327
25329
  }, /*#__PURE__*/React.createElement("div", {
25328
- className: css(styles$c.tagsEditor)
25330
+ className: css(styles$d.tagsEditor)
25329
25331
  }, /*#__PURE__*/React.createElement(GroupMetadataEditor, {
25330
25332
  value: data,
25331
25333
  onChange: newVal => actions.setValueAtPath(path, newVal),
@@ -25356,23 +25358,23 @@ const ArrayNodeContent = props => {
25356
25358
  const subpath = path.concat(i);
25357
25359
  const controls = [i > 0 && /*#__PURE__*/React.createElement("div", {
25358
25360
  key: "moveArrayElementUp",
25359
- className: css(styles$c.control)
25361
+ className: css(styles$d.control)
25360
25362
  }, /*#__PURE__*/React.createElement(SimpleButton, {
25361
25363
  color: "orange",
25362
25364
  title: "Move up",
25363
25365
  onClick: () => actions.moveArrayElementUp(subpath)
25364
25366
  }, /*#__PURE__*/React.createElement("div", {
25365
- className: css(styles$c.verticalFlip)
25367
+ className: css(styles$d.verticalFlip)
25366
25368
  }, /*#__PURE__*/React.createElement(InlineIcon$7, iconChevronDown)))), i < data.length - 1 && /*#__PURE__*/React.createElement("div", {
25367
25369
  key: "moveArrayElementDown",
25368
- className: css(styles$c.control)
25370
+ className: css(styles$d.control)
25369
25371
  }, /*#__PURE__*/React.createElement(SimpleButton, {
25370
25372
  color: "orange",
25371
25373
  title: "Move down",
25372
25374
  onClick: () => actions.moveArrayElementDown(subpath)
25373
25375
  }, /*#__PURE__*/React.createElement(InlineIcon$7, iconChevronDown))), /*#__PURE__*/React.createElement("div", {
25374
25376
  key: "removeArrayElement",
25375
- className: css(styles$c.control)
25377
+ className: css(styles$d.control)
25376
25378
  }, /*#__PURE__*/React.createElement(SimpleButton, {
25377
25379
  color: "orange",
25378
25380
  title: "Delete",
@@ -25380,7 +25382,7 @@ const ArrayNodeContent = props => {
25380
25382
  }, /*#__PURE__*/React.createElement(InlineIcon$7, iconTrash$5)))];
25381
25383
  return /*#__PURE__*/React.createElement("div", {
25382
25384
  key: i,
25383
- className: css(styles$c.arrayElement, !elementIsLeaf && styles$c.arrayElementAndNotLeaf)
25385
+ className: css(styles$d.arrayElement, !elementIsLeaf && styles$d.arrayElementAndNotLeaf)
25384
25386
  }, /*#__PURE__*/React.createElement(NodeContainer, _extends({}, otherProps, {
25385
25387
  key: i,
25386
25388
  shape: shape.elementShape,
@@ -25406,7 +25408,7 @@ const ObjectNodeContent = props => {
25406
25408
  // made sense to the shape's author is the order in which we'll iterate :)
25407
25409
  const children = Object.keys(shape.shape).map(subkey => /*#__PURE__*/React.createElement("div", {
25408
25410
  key: subkey,
25409
- className: css(styles$c.objectElement)
25411
+ className: css(styles$d.objectElement)
25410
25412
  }, /*#__PURE__*/React.createElement(NodeContainer, _extends({}, otherProps, {
25411
25413
  shape: shape.shape[subkey],
25412
25414
  data: data[subkey],
@@ -25573,7 +25575,7 @@ class MultiRendererEditor extends React.Component {
25573
25575
  }, this._renderContent());
25574
25576
  }
25575
25577
  }
25576
- const styles$c = StyleSheet.create({
25578
+ const styles$d = StyleSheet.create({
25577
25579
  // This is used in a number of places throughout this file.
25578
25580
  container: {},
25579
25581
  // eslint-disable-next-line react-native/no-unused-styles
@@ -25725,47 +25727,47 @@ const StatefulArticleEditor = createReactClass({
25725
25727
  screen
25726
25728
  } = this.state;
25727
25729
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
25728
- style: styles$b.controlBar
25730
+ style: styles$c.controlBar
25729
25731
  }, /*#__PURE__*/React.createElement("span", {
25730
- style: styles$b.controls
25732
+ style: styles$c.controls
25731
25733
  }, "Mode:", " ", /*#__PURE__*/React.createElement("span", {
25732
25734
  onClick: () => this.setState({
25733
25735
  mode: "edit"
25734
25736
  }),
25735
- style: mode === "edit" ? styles$b.controlSelected : styles$b.control
25737
+ style: mode === "edit" ? styles$c.controlSelected : styles$c.control
25736
25738
  }, "EDIT"), " | ", /*#__PURE__*/React.createElement("span", {
25737
25739
  onClick: () => this.setState({
25738
25740
  mode: "preview"
25739
25741
  }),
25740
- style: mode === "preview" ? styles$b.controlSelected : styles$b.control
25742
+ style: mode === "preview" ? styles$c.controlSelected : styles$c.control
25741
25743
  }, "PREVIEW"), " | ", /*#__PURE__*/React.createElement("span", {
25742
25744
  onClick: () => this.setState({
25743
25745
  mode: "json"
25744
25746
  }),
25745
- style: mode === "json" ? styles$b.controlSelected : styles$b.control
25747
+ style: mode === "json" ? styles$c.controlSelected : styles$c.control
25746
25748
  }, "JSON")), /*#__PURE__*/React.createElement("span", {
25747
- style: styles$b.controls
25749
+ style: styles$c.controls
25748
25750
  }, "Screen:", " ", /*#__PURE__*/React.createElement("span", {
25749
25751
  onClick: () => this.setState({
25750
25752
  screen: "phone"
25751
25753
  }),
25752
- style: screen === "phone" ? styles$b.controlSelected : styles$b.control
25754
+ style: screen === "phone" ? styles$c.controlSelected : styles$c.control
25753
25755
  }, "PHONE"), " | ", /*#__PURE__*/React.createElement("span", {
25754
25756
  onClick: () => this.setState({
25755
25757
  screen: "tablet"
25756
25758
  }),
25757
- style: screen === "tablet" ? styles$b.controlSelected : styles$b.control
25759
+ style: screen === "tablet" ? styles$c.controlSelected : styles$c.control
25758
25760
  }, "TABLET"), " | ", /*#__PURE__*/React.createElement("span", {
25759
25761
  onClick: () => this.setState({
25760
25762
  screen: "desktop"
25761
25763
  }),
25762
- style: screen === "desktop" ? styles$b.controlSelected : styles$b.control
25764
+ style: screen === "desktop" ? styles$c.controlSelected : styles$c.control
25763
25765
  }, "DESKTOP"))), /*#__PURE__*/React.createElement("div", {
25764
- style: styles$b.editor
25766
+ style: styles$c.editor
25765
25767
  }, /*#__PURE__*/React.createElement(ArticleEditor, this.state)));
25766
25768
  }
25767
25769
  });
25768
- const styles$b = {
25770
+ const styles$c = {
25769
25771
  controlBar: {
25770
25772
  marginBottom: 25,
25771
25773
  marginTop: 5
@@ -27247,10 +27249,10 @@ class GradedGroupEditor extends React.Component {
27247
27249
  }, /*#__PURE__*/React.createElement("div", {
27248
27250
  className: "perseus-widget-row"
27249
27251
  }, /*#__PURE__*/React.createElement("label", {
27250
- className: css(styles$a.title)
27252
+ className: css(styles$b.title)
27251
27253
  }, "Title:", " ", /*#__PURE__*/React.createElement(TextInput$6, {
27252
27254
  value: this.props.title,
27253
- className: css(styles$a.input)
27255
+ className: css(styles$b.input)
27254
27256
  // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
27255
27257
  ,
27256
27258
  onChange: this.change("title")
@@ -27277,7 +27279,7 @@ class GradedGroupEditor extends React.Component {
27277
27279
  }, /*#__PURE__*/React.createElement(InlineIcon$5, iconPlus$2), " Add a hint"), this.props.hint && /*#__PURE__*/React.createElement("div", {
27278
27280
  className: "perseus-hint-editor"
27279
27281
  }, /*#__PURE__*/React.createElement("div", {
27280
- className: css(styles$a.hintsTitle)
27282
+ className: css(styles$b.hintsTitle)
27281
27283
  }, "Hint"), /*#__PURE__*/React.createElement(Editor
27282
27284
  // eslint-disable-next-line react/no-string-refs
27283
27285
  , {
@@ -27316,7 +27318,7 @@ GradedGroupEditor.defaultProps = {
27316
27318
  images: {},
27317
27319
  hint: null
27318
27320
  };
27319
- const styles$a = StyleSheet.create({
27321
+ const styles$b = StyleSheet.create({
27320
27322
  title: {
27321
27323
  fontSize: 18,
27322
27324
  fontWeight: "bold"
@@ -28588,18 +28590,71 @@ InputNumberEditor.defaultProps = {
28588
28590
  rightAlign: false
28589
28591
  };
28590
28592
 
28593
+ /**
28594
+ * A simple Mathquill MathField input for the InteractionEditor.
28595
+ * Unlike our other uses of Mathquill, we're not using a keypad here;
28596
+ * it's just the input itself for use writing TeX.
28597
+ */
28598
+ function MathquillInput(props) {
28599
+ const mathFieldWrapperRef = useRef(null);
28600
+ const mathFieldInstance = useRef();
28601
+ useEffect(() => {
28602
+ // If we have the mount for the input, but not the input
28603
+ // make a new Mathquill input
28604
+ if (mathFieldWrapperRef.current && !mathFieldInstance.current) {
28605
+ // Initialize MathQuill.MathField instance
28606
+ mathFieldInstance.current = createMathField(mathFieldWrapperRef.current, baseConfig => _extends({}, baseConfig, {
28607
+ handlers: {
28608
+ edit: mathField => {
28609
+ // This handler is guaranteed to be called on change, but
28610
+ // unlike React it sometimes generates false positives.
28611
+ // One of these is on initialization (with an empty string
28612
+ // value), so we have to guard against that below.
28613
+ let value = mathField.latex();
28614
+
28615
+ // Provide a MathQuill-compatible way to generate the
28616
+ // not-equals sign without pasting unicode or typing TeX
28617
+ value = value.replace(/<>/g, "\\ne");
28618
+ if (props.value !== value) {
28619
+ props.onChange(value);
28620
+ }
28621
+ },
28622
+ upOutOf: mathField => {
28623
+ // This handler is called when the user presses the up
28624
+ // arrow key, but there is nowhere in the expression to go
28625
+ // up to (no numerator or exponent). For ease of use,
28626
+ // interpret this as an attempt to create an exponent.
28627
+ mathField.typedText("^");
28628
+ }
28629
+ }
28630
+ }));
28631
+ }
28632
+ });
28633
+ return /*#__PURE__*/React.createElement(View, {
28634
+ style: styles$a.outerWrapper
28635
+ }, /*#__PURE__*/React.createElement("span", {
28636
+ ref: mathFieldWrapperRef,
28637
+ className: "perseus-math-input mq-editable-field mq-math-mode"
28638
+ }));
28639
+ }
28640
+ const styles$a = StyleSheet.create({
28641
+ outerWrapper: {
28642
+ display: "inline-block",
28643
+ borderStyle: "solid",
28644
+ borderWidth: 1,
28645
+ borderColor: Color.offBlack50,
28646
+ borderRadius: 3,
28647
+ background: Color.white
28648
+ }
28649
+ });
28650
+
28591
28651
  const {
28592
- MathInput: MathInput$8,
28593
28652
  NumberInput: NumberInput$g
28594
28653
  } = components;
28595
28654
  const {
28596
28655
  getDependencies: getDependencies$8
28597
28656
  } = Dependencies;
28598
- //
28599
28657
  // Editor for function plots
28600
- //
28601
- // TODO(eater): Factor this out
28602
- //
28603
28658
  class FunctionEditor extends React.Component {
28604
28659
  constructor(..._args) {
28605
28660
  super(..._args);
@@ -28614,30 +28669,21 @@ class FunctionEditor extends React.Component {
28614
28669
  const {
28615
28670
  TeX
28616
28671
  } = getDependencies$8();
28617
- const analyticsStub = {
28618
- onAnalyticsEvent: () => Promise.resolve()
28619
- };
28620
28672
  return /*#__PURE__*/React.createElement("div", {
28621
28673
  className: "graph-settings"
28622
28674
  }, /*#__PURE__*/React.createElement("div", {
28623
28675
  className: "perseus-widget-row"
28624
- }, /*#__PURE__*/React.createElement(TeX, null, this.props.funcName + "(x)="), " ", /*#__PURE__*/React.createElement(MathInput$8, {
28625
- buttonsVisible: "never",
28676
+ }, /*#__PURE__*/React.createElement(TeX, null, this.props.funcName + "(x)="), " ", /*#__PURE__*/React.createElement(MathquillInput, {
28626
28677
  value: this.props.value,
28627
- onChange: this.change("value"),
28628
- analytics: analyticsStub
28678
+ onChange: this.change("value")
28629
28679
  })), /*#__PURE__*/React.createElement("div", {
28630
28680
  className: "perseus-widget-row"
28631
- }, "Range: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput$8, {
28632
- buttonsVisible: "never",
28681
+ }, "Range: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathquillInput, {
28633
28682
  value: this.props.rangeMin,
28634
- onChange: this.change("rangeMin"),
28635
- analytics: analyticsStub
28636
- }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput$8, {
28637
- buttonsVisible: "never",
28683
+ onChange: this.change("rangeMin")
28684
+ }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathquillInput, {
28638
28685
  value: this.props.rangeMax,
28639
- onChange: this.change("rangeMax"),
28640
- analytics: analyticsStub
28686
+ onChange: this.change("rangeMax")
28641
28687
  }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
28642
28688
  className: "perseus-widget-row"
28643
28689
  }, /*#__PURE__*/React.createElement(ColorPicker, {
@@ -28659,14 +28705,6 @@ class FunctionEditor extends React.Component {
28659
28705
  }))));
28660
28706
  }
28661
28707
  }
28662
- FunctionEditor.propTypes = _extends({}, Changeable.propTypes, {
28663
- value: PropTypes.string,
28664
- rangeMin: PropTypes.string,
28665
- rangeMax: PropTypes.string,
28666
- color: PropTypes.string,
28667
- strokeDashArray: PropTypes.string,
28668
- strokeWidth: PropTypes.number
28669
- });
28670
28708
  FunctionEditor.defaultProps = {
28671
28709
  value: "x",
28672
28710
  rangeMin: "-10",
@@ -28677,18 +28715,13 @@ FunctionEditor.defaultProps = {
28677
28715
  };
28678
28716
 
28679
28717
  const {
28680
- MathInput: MathInput$7,
28681
28718
  TextInput: TextInput$5
28682
28719
  } = components;
28683
28720
  const {
28684
28721
  getDependencies: getDependencies$7
28685
28722
  } = Dependencies;
28686
- //
28687
28723
  // Editor for labels
28688
- //
28689
- // TODO(eater): Factor this out maybe?
28690
28724
  // TODO(eater): Add text direction
28691
- //
28692
28725
  class LabelEditor extends React.Component {
28693
28726
  constructor(..._args) {
28694
28727
  super(..._args);
@@ -28703,9 +28736,6 @@ class LabelEditor extends React.Component {
28703
28736
  const {
28704
28737
  TeX
28705
28738
  } = getDependencies$7();
28706
- const analyticsStub = {
28707
- onAnalyticsEvent: () => Promise.resolve()
28708
- };
28709
28739
  return /*#__PURE__*/React.createElement("div", {
28710
28740
  className: "graph-settings"
28711
28741
  }, /*#__PURE__*/React.createElement("div", {
@@ -28718,16 +28748,12 @@ class LabelEditor extends React.Component {
28718
28748
  }
28719
28749
  })), /*#__PURE__*/React.createElement("div", {
28720
28750
  className: "perseus-widget-row"
28721
- }, "Location: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput$7, {
28722
- buttonsVisible: "never",
28751
+ }, "Location: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathquillInput, {
28723
28752
  value: this.props.coordX,
28724
- onChange: this.change("coordX"),
28725
- analytics: analyticsStub
28726
- }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput$7, {
28727
- buttonsVisible: "never",
28753
+ onChange: this.change("coordX")
28754
+ }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathquillInput, {
28728
28755
  value: this.props.coordY,
28729
- onChange: this.change("coordY"),
28730
- analytics: analyticsStub
28756
+ onChange: this.change("coordY")
28731
28757
  }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
28732
28758
  className: "perseus-widget-row"
28733
28759
  }, /*#__PURE__*/React.createElement(ColorPicker, {
@@ -28736,12 +28762,6 @@ class LabelEditor extends React.Component {
28736
28762
  })));
28737
28763
  }
28738
28764
  }
28739
- LabelEditor.propTypes = _extends({}, Changeable.propTypes, {
28740
- color: PropTypes.string,
28741
- coordX: PropTypes.string,
28742
- coordY: PropTypes.string,
28743
- label: PropTypes.string
28744
- });
28745
28765
  LabelEditor.defaultProps = {
28746
28766
  coordX: "0",
28747
28767
  coordY: "0",
@@ -28750,17 +28770,12 @@ LabelEditor.defaultProps = {
28750
28770
  };
28751
28771
 
28752
28772
  const {
28753
- MathInput: MathInput$6,
28754
28773
  NumberInput: NumberInput$f
28755
28774
  } = components;
28756
28775
  const {
28757
28776
  getDependencies: getDependencies$6
28758
28777
  } = Dependencies;
28759
- //
28760
28778
  // Editor for non-interactive line segments
28761
- //
28762
- // TODO(eater): Factor this out
28763
- //
28764
28779
  class LineEditor extends React.Component {
28765
28780
  constructor(..._args) {
28766
28781
  super(..._args);
@@ -28775,35 +28790,24 @@ class LineEditor extends React.Component {
28775
28790
  const {
28776
28791
  TeX
28777
28792
  } = getDependencies$6();
28778
- const analyticsStub = {
28779
- onAnalyticsEvent: () => Promise.resolve()
28780
- };
28781
28793
  return /*#__PURE__*/React.createElement("div", {
28782
28794
  className: "graph-settings"
28783
28795
  }, /*#__PURE__*/React.createElement("div", {
28784
28796
  className: "perseus-widget-row"
28785
- }, "Start: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput$6, {
28786
- buttonsVisible: "never",
28797
+ }, "Start: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathquillInput, {
28787
28798
  value: this.props.startX,
28788
- onChange: this.change("startX"),
28789
- analytics: analyticsStub
28790
- }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput$6, {
28791
- buttonsVisible: "never",
28799
+ onChange: this.change("startX")
28800
+ }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathquillInput, {
28792
28801
  value: this.props.startY,
28793
- onChange: this.change("startY"),
28794
- analytics: analyticsStub
28802
+ onChange: this.change("startY")
28795
28803
  }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
28796
28804
  className: "perseus-widget-row"
28797
- }, "End: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput$6, {
28798
- buttonsVisible: "never",
28805
+ }, "End: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathquillInput, {
28799
28806
  value: this.props.endX,
28800
- onChange: this.change("endX"),
28801
- analytics: analyticsStub
28802
- }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput$6, {
28803
- buttonsVisible: "never",
28807
+ onChange: this.change("endX")
28808
+ }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathquillInput, {
28804
28809
  value: this.props.endY,
28805
- onChange: this.change("endY"),
28806
- analytics: analyticsStub
28810
+ onChange: this.change("endY")
28807
28811
  }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
28808
28812
  className: "perseus-widget-row"
28809
28813
  }, /*#__PURE__*/React.createElement(ColorPicker, {
@@ -28828,16 +28832,6 @@ class LineEditor extends React.Component {
28828
28832
  }))));
28829
28833
  }
28830
28834
  }
28831
- LineEditor.propTypes = _extends({}, Changeable.propTypes, {
28832
- startX: PropTypes.string,
28833
- startY: PropTypes.string,
28834
- endX: PropTypes.string,
28835
- endY: PropTypes.string,
28836
- color: PropTypes.string,
28837
- strokeDasharray: PropTypes.string,
28838
- arrows: PropTypes.string,
28839
- strokeWidth: PropTypes.number
28840
- });
28841
28835
  LineEditor.defaultProps = {
28842
28836
  startX: "-5",
28843
28837
  startY: "5",
@@ -28851,7 +28845,6 @@ LineEditor.defaultProps = {
28851
28845
 
28852
28846
  const {
28853
28847
  ButtonGroup: ButtonGroup$2,
28854
- MathInput: MathInput$5,
28855
28848
  NumberInput: NumberInput$e
28856
28849
  } = components;
28857
28850
  class ConstraintEditor extends React.Component {
@@ -28865,9 +28858,6 @@ class ConstraintEditor extends React.Component {
28865
28858
  const {
28866
28859
  TeX
28867
28860
  } = Dependencies.getDependencies();
28868
- const analyticsStub = {
28869
- onAnalyticsEvent: () => Promise.resolve()
28870
- };
28871
28861
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
28872
28862
  className: "perseus-widget-row"
28873
28863
  }, "Constraint:", " ", /*#__PURE__*/React.createElement(ButtonGroup$2, {
@@ -28897,48 +28887,36 @@ class ConstraintEditor extends React.Component {
28897
28887
  className: "graph-settings"
28898
28888
  }, /*#__PURE__*/React.createElement("div", {
28899
28889
  className: "perseus-widget-row"
28900
- }, /*#__PURE__*/React.createElement(TeX, null, "x="), " ", /*#__PURE__*/React.createElement(MathInput$5, {
28901
- buttonsVisible: "never",
28890
+ }, /*#__PURE__*/React.createElement(TeX, null, "x="), " ", /*#__PURE__*/React.createElement(MathquillInput, {
28902
28891
  value: this.props.constraintFn,
28903
- onChange: this.change("constraintFn"),
28904
- analytics: analyticsStub
28892
+ onChange: this.change("constraintFn")
28905
28893
  }))), this.props.constraint === "y" && /*#__PURE__*/React.createElement("div", {
28906
28894
  className: "graph-settings"
28907
28895
  }, /*#__PURE__*/React.createElement("div", {
28908
28896
  className: "perseus-widget-row"
28909
- }, /*#__PURE__*/React.createElement(TeX, null, "y="), " ", /*#__PURE__*/React.createElement(MathInput$5, {
28910
- buttonsVisible: "never",
28897
+ }, /*#__PURE__*/React.createElement(TeX, null, "y="), " ", /*#__PURE__*/React.createElement(MathquillInput, {
28911
28898
  value: this.props.constraintFn,
28912
- onChange: this.change("constraintFn"),
28913
- analytics: analyticsStub
28899
+ onChange: this.change("constraintFn")
28914
28900
  }))), "Ensure these are set so nothing can be dragged off the canvas:", /*#__PURE__*/React.createElement("div", {
28915
28901
  className: "perseus-widget-row"
28916
28902
  }, /*#__PURE__*/React.createElement("div", {
28917
28903
  className: "perseus-widget-row"
28918
- }, /*#__PURE__*/React.createElement(TeX, null, "x \\in \\Large["), " ", /*#__PURE__*/React.createElement(MathInput$5, {
28919
- buttonsVisible: "never",
28904
+ }, /*#__PURE__*/React.createElement(TeX, null, "x \\in \\Large["), " ", /*#__PURE__*/React.createElement(MathquillInput, {
28920
28905
  value: this.props.constraintXMin,
28921
- onChange: this.change("constraintXMin"),
28922
- analytics: analyticsStub
28923
- }), /*#__PURE__*/React.createElement(TeX, null, ", "), " ", /*#__PURE__*/React.createElement(MathInput$5, {
28924
- buttonsVisible: "never",
28906
+ onChange: this.change("constraintXMin")
28907
+ }), /*#__PURE__*/React.createElement(TeX, null, ", "), " ", /*#__PURE__*/React.createElement(MathquillInput, {
28925
28908
  value: this.props.constraintXMax,
28926
- onChange: this.change("constraintXMax"),
28927
- analytics: analyticsStub
28909
+ onChange: this.change("constraintXMax")
28928
28910
  }), " ", /*#__PURE__*/React.createElement(TeX, null, "\\Large]"))), /*#__PURE__*/React.createElement("div", {
28929
28911
  className: "perseus-widget-row"
28930
28912
  }, /*#__PURE__*/React.createElement("div", {
28931
28913
  className: "perseus-widget-row"
28932
- }, /*#__PURE__*/React.createElement(TeX, null, "y \\in \\Large["), " ", /*#__PURE__*/React.createElement(MathInput$5, {
28933
- buttonsVisible: "never",
28914
+ }, /*#__PURE__*/React.createElement(TeX, null, "y \\in \\Large["), " ", /*#__PURE__*/React.createElement(MathquillInput, {
28934
28915
  value: this.props.constraintYMin,
28935
- onChange: this.change("constraintYMin"),
28936
- analytics: analyticsStub
28937
- }), /*#__PURE__*/React.createElement(TeX, null, ", "), " ", /*#__PURE__*/React.createElement(MathInput$5, {
28938
- buttonsVisible: "never",
28916
+ onChange: this.change("constraintYMin")
28917
+ }), /*#__PURE__*/React.createElement(TeX, null, ", "), " ", /*#__PURE__*/React.createElement(MathquillInput, {
28939
28918
  value: this.props.constraintYMax,
28940
- onChange: this.change("constraintYMax"),
28941
- analytics: analyticsStub
28919
+ onChange: this.change("constraintYMax")
28942
28920
  }), " ", /*#__PURE__*/React.createElement(TeX, null, "\\Large]"))));
28943
28921
  }
28944
28922
  }
@@ -28953,18 +28931,13 @@ ConstraintEditor.defaultProps = {
28953
28931
  };
28954
28932
 
28955
28933
  const {
28956
- MathInput: MathInput$4,
28957
28934
  NumberInput: NumberInput$d
28958
28935
  } = components;
28959
28936
  const {
28960
28937
  getDependencies: getDependencies$5
28961
28938
  } = Dependencies;
28962
- //
28963
28939
  // Editor for interactive movable line segments
28964
- //
28965
- // TODO(eater): Factor this out
28966
28940
  // TODO(eater): Rethink how constraints are represented
28967
- //
28968
28941
  class MovableLineEditor extends React.Component {
28969
28942
  constructor(..._args) {
28970
28943
  super(..._args);
@@ -28979,35 +28952,24 @@ class MovableLineEditor extends React.Component {
28979
28952
  const {
28980
28953
  TeX
28981
28954
  } = getDependencies$5();
28982
- const analyticsStub = {
28983
- onAnalyticsEvent: () => Promise.resolve()
28984
- };
28985
28955
  return /*#__PURE__*/React.createElement("div", {
28986
28956
  className: "graph-settings"
28987
28957
  }, "Initial position:", /*#__PURE__*/React.createElement("div", {
28988
28958
  className: "perseus-widget-row"
28989
- }, "Start: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput$4, {
28990
- buttonsVisible: "never",
28959
+ }, "Start: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathquillInput, {
28991
28960
  value: this.props.startX,
28992
- onChange: this.change("startX"),
28993
- analytics: analyticsStub
28994
- }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput$4, {
28995
- buttonsVisible: "never",
28961
+ onChange: this.change("startX")
28962
+ }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathquillInput, {
28996
28963
  value: this.props.startY,
28997
- onChange: this.change("startY"),
28998
- analytics: analyticsStub
28964
+ onChange: this.change("startY")
28999
28965
  }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
29000
28966
  className: "perseus-widget-row"
29001
- }, "End: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput$4, {
29002
- buttonsVisible: "never",
28967
+ }, "End: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathquillInput, {
29003
28968
  value: this.props.endX,
29004
- onChange: this.change("endX"),
29005
- analytics: analyticsStub
29006
- }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput$4, {
29007
- buttonsVisible: "never",
28969
+ onChange: this.change("endX")
28970
+ }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathquillInput, {
29008
28971
  value: this.props.endY,
29009
- onChange: this.change("endY"),
29010
- analytics: analyticsStub
28972
+ onChange: this.change("endY")
29011
28973
  }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
29012
28974
  className: "perseus-widget-row"
29013
28975
  }, "Start updates ", /*#__PURE__*/React.createElement(TeX, null, "(x_n, y_n)"), " for ", /*#__PURE__*/React.createElement(TeX, null, "n ="), /*#__PURE__*/React.createElement(NumberInput$d, {
@@ -29025,15 +28987,6 @@ class MovableLineEditor extends React.Component {
29025
28987
  }, "All constraints are applied to the start point."), /*#__PURE__*/React.createElement(ConstraintEditor, this.props));
29026
28988
  }
29027
28989
  }
29028
- MovableLineEditor.propTypes = _extends({}, Changeable.propTypes, {
29029
- startX: PropTypes.string,
29030
- startY: PropTypes.string,
29031
- endX: PropTypes.string,
29032
- endY: PropTypes.string,
29033
- constraint: PropTypes.string,
29034
- snap: PropTypes.number,
29035
- constraintFn: PropTypes.string
29036
- });
29037
28990
  MovableLineEditor.defaultProps = {
29038
28991
  startX: "-5",
29039
28992
  startY: "5",
@@ -29042,6 +28995,7 @@ MovableLineEditor.defaultProps = {
29042
28995
  constraint: "none",
29043
28996
  snap: 0.5,
29044
28997
  constraintFn: "0",
28998
+ // @ts-expect-error - TS2561
29045
28999
  constraintXMin: "-10",
29046
29000
  constraintXMax: "10",
29047
29001
  constraintYMin: "-10",
@@ -29049,18 +29003,13 @@ MovableLineEditor.defaultProps = {
29049
29003
  };
29050
29004
 
29051
29005
  const {
29052
- MathInput: MathInput$3,
29053
29006
  NumberInput: NumberInput$c
29054
29007
  } = components;
29055
29008
  const {
29056
29009
  getDependencies: getDependencies$4
29057
29010
  } = Dependencies;
29058
- //
29059
29011
  // Editor for interactive movable points
29060
- //
29061
- // TODO(eater): Factor this out
29062
29012
  // TODO(eater): Rethink how constraints are represented
29063
- //
29064
29013
  class MovablePointEditor extends React.Component {
29065
29014
  constructor(..._args) {
29066
29015
  super(..._args);
@@ -29075,23 +29024,16 @@ class MovablePointEditor extends React.Component {
29075
29024
  const {
29076
29025
  TeX
29077
29026
  } = getDependencies$4();
29078
- const analyticsStub = {
29079
- onAnalyticsEvent: () => Promise.resolve()
29080
- };
29081
29027
  return /*#__PURE__*/React.createElement("div", {
29082
29028
  className: "graph-settings"
29083
29029
  }, /*#__PURE__*/React.createElement("div", {
29084
29030
  className: "perseus-widget-row"
29085
- }, "Start: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput$3, {
29086
- buttonsVisible: "never",
29031
+ }, "Start: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathquillInput, {
29087
29032
  value: this.props.startX,
29088
- onChange: this.change("startX"),
29089
- analytics: analyticsStub
29090
- }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput$3, {
29091
- buttonsVisible: "never",
29033
+ onChange: this.change("startX")
29034
+ }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathquillInput, {
29092
29035
  value: this.props.startY,
29093
- onChange: this.change("startY"),
29094
- analytics: analyticsStub
29036
+ onChange: this.change("startY")
29095
29037
  }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
29096
29038
  className: "perseus-widget-row"
29097
29039
  }, "Update ", /*#__PURE__*/React.createElement(TeX, null, "(x_n, y_n)"), " for ", /*#__PURE__*/React.createElement(TeX, null, "n ="), " ", /*#__PURE__*/React.createElement(NumberInput$c, {
@@ -29101,19 +29043,13 @@ class MovablePointEditor extends React.Component {
29101
29043
  })), /*#__PURE__*/React.createElement(ConstraintEditor, this.props));
29102
29044
  }
29103
29045
  }
29104
- MovablePointEditor.propTypes = _extends({}, Changeable.propTypes, {
29105
- startX: PropTypes.string,
29106
- startY: PropTypes.string,
29107
- constraint: PropTypes.string,
29108
- snap: PropTypes.number,
29109
- constraintFn: PropTypes.string
29110
- });
29111
29046
  MovablePointEditor.defaultProps = {
29112
29047
  startX: "0",
29113
29048
  startY: "0",
29114
29049
  constraint: "none",
29115
29050
  snap: 0.5,
29116
29051
  constraintFn: "0",
29052
+ // @ts-expect-error - TS2561
29117
29053
  constraintXMin: "-10",
29118
29054
  constraintXMax: "10",
29119
29055
  constraintYMin: "-10",
@@ -29121,17 +29057,12 @@ MovablePointEditor.defaultProps = {
29121
29057
  };
29122
29058
 
29123
29059
  const {
29124
- MathInput: MathInput$2,
29125
29060
  NumberInput: NumberInput$b
29126
29061
  } = components;
29127
29062
  const {
29128
29063
  getDependencies: getDependencies$3
29129
29064
  } = Dependencies;
29130
- //
29131
29065
  // Editor for parametric plots
29132
- //
29133
- // TODO(eater): Factor this out
29134
- //
29135
29066
  class ParametricEditor extends React.Component {
29136
29067
  constructor(..._args) {
29137
29068
  super(..._args);
@@ -29146,37 +29077,26 @@ class ParametricEditor extends React.Component {
29146
29077
  const {
29147
29078
  TeX
29148
29079
  } = getDependencies$3();
29149
- const analyticsStub = {
29150
- onAnalyticsEvent: () => Promise.resolve()
29151
- };
29152
29080
  return /*#__PURE__*/React.createElement("div", {
29153
29081
  className: "graph-settings"
29154
29082
  }, /*#__PURE__*/React.createElement("div", {
29155
29083
  className: "perseus-widget-row"
29156
- }, /*#__PURE__*/React.createElement(TeX, null, "X(t) ="), " ", /*#__PURE__*/React.createElement(MathInput$2, {
29157
- buttonsVisible: "never",
29084
+ }, /*#__PURE__*/React.createElement(TeX, null, "X(t) ="), " ", /*#__PURE__*/React.createElement(MathquillInput, {
29158
29085
  value: this.props.x,
29159
- onChange: this.change("x"),
29160
- analytics: analyticsStub
29086
+ onChange: this.change("x")
29161
29087
  })), /*#__PURE__*/React.createElement("div", {
29162
29088
  className: "perseus-widget-row"
29163
- }, /*#__PURE__*/React.createElement(TeX, null, "Y(t) ="), " ", /*#__PURE__*/React.createElement(MathInput$2, {
29164
- buttonsVisible: "never",
29089
+ }, /*#__PURE__*/React.createElement(TeX, null, "Y(t) ="), " ", /*#__PURE__*/React.createElement(MathquillInput, {
29165
29090
  value: this.props.y,
29166
- onChange: this.change("y"),
29167
- analytics: analyticsStub
29091
+ onChange: this.change("y")
29168
29092
  })), /*#__PURE__*/React.createElement("div", {
29169
29093
  className: "perseus-widget-row"
29170
- }, "Range: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput$2, {
29171
- buttonsVisible: "never",
29094
+ }, "Range: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathquillInput, {
29172
29095
  value: this.props.rangeMin,
29173
- onChange: this.change("rangeMin"),
29174
- analytics: analyticsStub
29175
- }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput$2, {
29176
- buttonsVisible: "never",
29096
+ onChange: this.change("rangeMin")
29097
+ }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathquillInput, {
29177
29098
  value: this.props.rangeMax,
29178
- onChange: this.change("rangeMax"),
29179
- analytics: analyticsStub
29099
+ onChange: this.change("rangeMax")
29180
29100
  }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
29181
29101
  className: "perseus-widget-row"
29182
29102
  }, /*#__PURE__*/React.createElement(ColorPicker, {
@@ -29198,15 +29118,6 @@ class ParametricEditor extends React.Component {
29198
29118
  }))));
29199
29119
  }
29200
29120
  }
29201
- ParametricEditor.propTypes = _extends({}, Changeable.propTypes, {
29202
- x: PropTypes.string,
29203
- y: PropTypes.string,
29204
- rangeMin: PropTypes.string,
29205
- rangeMax: PropTypes.string,
29206
- color: PropTypes.string,
29207
- strokeDashArray: PropTypes.string,
29208
- strokeWidth: PropTypes.number
29209
- });
29210
29121
  ParametricEditor.defaultProps = {
29211
29122
  x: "cos(t)",
29212
29123
  y: "sin(t)",
@@ -29217,17 +29128,10 @@ ParametricEditor.defaultProps = {
29217
29128
  strokeWidth: 2
29218
29129
  };
29219
29130
 
29220
- const {
29221
- MathInput: MathInput$1
29222
- } = components;
29223
29131
  const {
29224
29132
  getDependencies: getDependencies$2
29225
29133
  } = Dependencies;
29226
- //
29227
29134
  // Editor for non-interactive points
29228
- //
29229
- // TODO(eater): Factor this out
29230
- //
29231
29135
  class PointEditor extends React.Component {
29232
29136
  constructor(..._args) {
29233
29137
  super(..._args);
@@ -29242,23 +29146,16 @@ class PointEditor extends React.Component {
29242
29146
  const {
29243
29147
  TeX
29244
29148
  } = getDependencies$2();
29245
- const analyticsStub = {
29246
- onAnalyticsEvent: () => Promise.resolve()
29247
- };
29248
29149
  return /*#__PURE__*/React.createElement("div", {
29249
29150
  className: "graph-settings"
29250
29151
  }, /*#__PURE__*/React.createElement("div", {
29251
29152
  className: "perseus-widget-row"
29252
- }, "Coordinate: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput$1, {
29253
- buttonsVisible: "never",
29153
+ }, "Coordinate: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathquillInput, {
29254
29154
  value: this.props.coordX,
29255
- onChange: this.change("coordX"),
29256
- analytics: analyticsStub
29257
- }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput$1, {
29258
- buttonsVisible: "never",
29155
+ onChange: this.change("coordX")
29156
+ }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathquillInput, {
29259
29157
  value: this.props.coordY,
29260
- onChange: this.change("coordY"),
29261
- analytics: analyticsStub
29158
+ onChange: this.change("coordY")
29262
29159
  }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
29263
29160
  className: "perseus-widget-row"
29264
29161
  }, /*#__PURE__*/React.createElement(ColorPicker, {
@@ -29267,28 +29164,16 @@ class PointEditor extends React.Component {
29267
29164
  })));
29268
29165
  }
29269
29166
  }
29270
- PointEditor.propTypes = _extends({}, Changeable.propTypes, {
29271
- coordX: PropTypes.string,
29272
- coordY: PropTypes.string,
29273
- color: PropTypes.string
29274
- });
29275
29167
  PointEditor.defaultProps = {
29276
29168
  coordX: "0",
29277
29169
  coordY: "0",
29278
29170
  color: KhanColors.BLACK
29279
29171
  };
29280
29172
 
29281
- const {
29282
- MathInput
29283
- } = components;
29284
29173
  const {
29285
29174
  getDependencies: getDependencies$1
29286
29175
  } = Dependencies;
29287
- //
29288
29176
  // Editor for rectangles
29289
- //
29290
- // TODO(eater): Factor this out maybe?
29291
- //
29292
29177
  class RectangleEditor extends React.Component {
29293
29178
  constructor(..._args) {
29294
29179
  super(..._args);
@@ -29303,37 +29188,26 @@ class RectangleEditor extends React.Component {
29303
29188
  const {
29304
29189
  TeX
29305
29190
  } = getDependencies$1();
29306
- const analyticsStub = {
29307
- onAnalyticsEvent: () => Promise.resolve()
29308
- };
29309
29191
  return /*#__PURE__*/React.createElement("div", {
29310
29192
  className: "graph-settings"
29311
29193
  }, /*#__PURE__*/React.createElement("div", {
29312
29194
  className: "perseus-widget-row"
29313
- }, "Bottom left: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput, {
29314
- buttonsVisible: "never",
29195
+ }, "Bottom left: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathquillInput, {
29315
29196
  value: this.props.coordX,
29316
- onChange: this.change("coordX"),
29317
- analytics: analyticsStub
29318
- }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput, {
29319
- buttonsVisible: "never",
29197
+ onChange: this.change("coordX")
29198
+ }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathquillInput, {
29320
29199
  value: this.props.coordY,
29321
- onChange: this.change("coordY"),
29322
- analytics: analyticsStub
29200
+ onChange: this.change("coordY")
29323
29201
  }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
29324
29202
  className: "perseus-widget-row"
29325
- }, "Width:", " ", /*#__PURE__*/React.createElement(MathInput, {
29326
- buttonsVisible: "never",
29203
+ }, "Width:", " ", /*#__PURE__*/React.createElement(MathquillInput, {
29327
29204
  value: this.props.width,
29328
- onChange: this.change("width"),
29329
- analytics: analyticsStub
29205
+ onChange: this.change("width")
29330
29206
  })), /*#__PURE__*/React.createElement("div", {
29331
29207
  className: "perseus-widget-row"
29332
- }, "Height:", " ", /*#__PURE__*/React.createElement(MathInput, {
29333
- buttonsVisible: "never",
29208
+ }, "Height:", " ", /*#__PURE__*/React.createElement(MathquillInput, {
29334
29209
  value: this.props.height,
29335
- onChange: this.change("height"),
29336
- analytics: analyticsStub
29210
+ onChange: this.change("height")
29337
29211
  })), /*#__PURE__*/React.createElement("div", {
29338
29212
  className: "perseus-widget-row"
29339
29213
  }, /*#__PURE__*/React.createElement(ColorPicker, {
@@ -29345,13 +29219,6 @@ class RectangleEditor extends React.Component {
29345
29219
  }, "You want a border? Sorry, draw your own."));
29346
29220
  }
29347
29221
  }
29348
- RectangleEditor.propTypes = _extends({}, Changeable.propTypes, {
29349
- color: PropTypes.string,
29350
- coordX: PropTypes.string,
29351
- coordY: PropTypes.string,
29352
- height: PropTypes.string,
29353
- width: PropTypes.string
29354
- });
29355
29222
  RectangleEditor.defaultProps = {
29356
29223
  coordX: "-5",
29357
29224
  coordY: "5",
@@ -29804,12 +29671,6 @@ class InteractionEditor extends React.Component {
29804
29671
  /* eslint-enable max-len */
29805
29672
  }
29806
29673
  }
29807
- // TODO(eater): Make more better
29808
- InteractionEditor.propTypes = _extends({}, Changeable.propTypes, {
29809
- // eslint-disable-next-line react/forbid-prop-types
29810
- elements: PropTypes.arrayOf(PropTypes.object),
29811
- graph: PropTypes.objectOf(PropTypes.any)
29812
- });
29813
29674
  InteractionEditor.widgetName = "interaction";
29814
29675
  InteractionEditor.defaultProps = defaultInteractionProps;
29815
29676