@khanacademy/perseus-editor 2.15.4 → 2.15.6

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 (33) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/es/index.js +432 -580
  3. package/dist/es/index.js.map +1 -1
  4. package/dist/index.js +500 -658
  5. package/dist/index.js.map +1 -1
  6. package/dist/widgets/interaction-editor/function-editor.d.ts +25 -0
  7. package/dist/widgets/interaction-editor/index.d.ts +2 -0
  8. package/dist/widgets/interaction-editor/interaction-editor.d.ts +37 -0
  9. package/dist/widgets/interaction-editor/label-editor.d.ts +21 -0
  10. package/dist/widgets/interaction-editor/line-editor.d.ts +29 -0
  11. package/dist/widgets/interaction-editor/mathquill-input.d.ts +12 -0
  12. package/dist/widgets/interaction-editor/movable-line-editor.d.ts +29 -0
  13. package/dist/widgets/interaction-editor/movable-point-editor.d.ts +24 -0
  14. package/dist/widgets/interaction-editor/parametric-editor.d.ts +27 -0
  15. package/dist/widgets/interaction-editor/point-editor.d.ts +19 -0
  16. package/dist/widgets/interaction-editor/rectangle-editor.d.ts +23 -0
  17. package/package.json +3 -2
  18. package/src/widgets/__stories__/interaction-editor.stories.tsx +37 -0
  19. package/src/widgets/{interaction → interaction-editor}/constraint-editor.tsx +9 -21
  20. package/src/widgets/interaction-editor/function-editor.tsx +108 -0
  21. package/src/widgets/interaction-editor/index.ts +3 -0
  22. package/src/widgets/{interaction-editor.tsx → interaction-editor/interaction-editor.tsx} +40 -787
  23. package/src/widgets/interaction-editor/label-editor.tsx +87 -0
  24. package/src/widgets/interaction-editor/line-editor.tsx +125 -0
  25. package/src/widgets/interaction-editor/mathquill-input.tsx +81 -0
  26. package/src/widgets/interaction-editor/movable-line-editor.tsx +121 -0
  27. package/src/widgets/interaction-editor/movable-point-editor.tsx +89 -0
  28. package/src/widgets/interaction-editor/parametric-editor.tsx +117 -0
  29. package/src/widgets/interaction-editor/point-editor.tsx +72 -0
  30. package/src/widgets/interaction-editor/rectangle-editor.tsx +96 -0
  31. package/tsconfig-build.tsbuildinfo +1 -1
  32. package/dist/widgets/interaction-editor.d.ts +0 -28
  33. /package/dist/widgets/{interaction → interaction-editor}/constraint-editor.d.ts +0 -0
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.4";
29
+ const libVersion = "2.15.6";
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"
@@ -27399,7 +27401,7 @@ const {
27399
27401
  RangeInput: RangeInput$5
27400
27402
  } = components;
27401
27403
  const {
27402
- getDependencies: getDependencies$1
27404
+ getDependencies: getDependencies$9
27403
27405
  } = Dependencies;
27404
27406
  const defaultBackgroundImage$3 = {
27405
27407
  url: null,
@@ -27716,7 +27718,7 @@ const GraphSettings = createReactClass({
27716
27718
  const scale = [KhanMath.roundTo(2, Util.scaleFromExtent(this.props.range[0], this.props.box[0])), KhanMath.roundTo(2, Util.scaleFromExtent(this.props.range[1], this.props.box[1]))];
27717
27719
  const {
27718
27720
  TeX
27719
- } = getDependencies$1();
27721
+ } = getDependencies$9();
27720
27722
  return /*#__PURE__*/React.createElement("div", null, _.contains(this.props.editableSettings, "canvas") && /*#__PURE__*/React.createElement("div", {
27721
27723
  className: "graph-settings"
27722
27724
  }, /*#__PURE__*/React.createElement("div", {
@@ -28588,137 +28590,139 @@ 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
- ButtonGroup: ButtonGroup$2,
28593
- MathInput: MathInput$1,
28594
- NumberInput: NumberInput$c
28652
+ NumberInput: NumberInput$g
28595
28653
  } = components;
28596
- class ConstraintEditor extends React.Component {
28597
- constructor(...args) {
28598
- super(...args);
28599
- this.change = propName => {
28600
- return Changeable.change.call(this, propName);
28654
+ const {
28655
+ getDependencies: getDependencies$8
28656
+ } = Dependencies;
28657
+ // Editor for function plots
28658
+ class FunctionEditor extends React.Component {
28659
+ constructor(..._args) {
28660
+ super(..._args);
28661
+ this.change = (...args) => {
28662
+ return Changeable.change.apply(this, args);
28663
+ };
28664
+ this.serialize = () => {
28665
+ return EditorJsonify.serialize.call(this);
28601
28666
  };
28602
28667
  }
28603
28668
  render() {
28604
28669
  const {
28605
28670
  TeX
28606
- } = Dependencies.getDependencies();
28607
- const analyticsStub = {
28608
- onAnalyticsEvent: () => Promise.resolve()
28609
- };
28610
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
28611
- className: "perseus-widget-row"
28612
- }, "Constraint:", " ", /*#__PURE__*/React.createElement(ButtonGroup$2, {
28613
- value: this.props.constraint,
28614
- allowEmpty: false,
28615
- buttons: [{
28616
- value: "none",
28617
- content: "None"
28618
- }, {
28619
- value: "snap",
28620
- content: "Snap"
28621
- }, {
28622
- value: "x",
28623
- content: "x="
28624
- }, {
28625
- value: "y",
28626
- content: "y="
28627
- }],
28628
- onChange: this.change("constraint")
28629
- })), this.props.constraint === "snap" && /*#__PURE__*/React.createElement("div", {
28630
- className: "perseus-widget-row"
28631
- }, "Snap:", " ", /*#__PURE__*/React.createElement(NumberInput$c, {
28632
- value: this.props.snap,
28633
- placeholder: 0,
28634
- onChange: this.change("snap")
28635
- })), this.props.constraint === "x" && /*#__PURE__*/React.createElement("div", {
28671
+ } = getDependencies$8();
28672
+ return /*#__PURE__*/React.createElement("div", {
28636
28673
  className: "graph-settings"
28637
28674
  }, /*#__PURE__*/React.createElement("div", {
28638
28675
  className: "perseus-widget-row"
28639
- }, /*#__PURE__*/React.createElement(TeX, null, "x="), " ", /*#__PURE__*/React.createElement(MathInput$1, {
28640
- buttonsVisible: "never",
28641
- value: this.props.constraintFn,
28642
- onChange: this.change("constraintFn"),
28643
- analytics: analyticsStub
28644
- }))), this.props.constraint === "y" && /*#__PURE__*/React.createElement("div", {
28645
- className: "graph-settings"
28646
- }, /*#__PURE__*/React.createElement("div", {
28676
+ }, /*#__PURE__*/React.createElement(TeX, null, this.props.funcName + "(x)="), " ", /*#__PURE__*/React.createElement(MathquillInput, {
28677
+ value: this.props.value,
28678
+ onChange: this.change("value")
28679
+ })), /*#__PURE__*/React.createElement("div", {
28647
28680
  className: "perseus-widget-row"
28648
- }, /*#__PURE__*/React.createElement(TeX, null, "y="), " ", /*#__PURE__*/React.createElement(MathInput$1, {
28649
- buttonsVisible: "never",
28650
- value: this.props.constraintFn,
28651
- onChange: this.change("constraintFn"),
28652
- analytics: analyticsStub
28653
- }))), "Ensure these are set so nothing can be dragged off the canvas:", /*#__PURE__*/React.createElement("div", {
28681
+ }, "Range: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathquillInput, {
28682
+ value: this.props.rangeMin,
28683
+ onChange: this.change("rangeMin")
28684
+ }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathquillInput, {
28685
+ value: this.props.rangeMax,
28686
+ onChange: this.change("rangeMax")
28687
+ }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
28654
28688
  className: "perseus-widget-row"
28655
- }, /*#__PURE__*/React.createElement("div", {
28689
+ }, /*#__PURE__*/React.createElement(ColorPicker, {
28690
+ value: this.props.color,
28691
+ onChange: this.change("color")
28692
+ })), /*#__PURE__*/React.createElement("div", {
28656
28693
  className: "perseus-widget-row"
28657
- }, /*#__PURE__*/React.createElement(TeX, null, "x \\in \\Large["), " ", /*#__PURE__*/React.createElement(MathInput$1, {
28658
- buttonsVisible: "never",
28659
- value: this.props.constraintXMin,
28660
- onChange: this.change("constraintXMin"),
28661
- analytics: analyticsStub
28662
- }), /*#__PURE__*/React.createElement(TeX, null, ", "), " ", /*#__PURE__*/React.createElement(MathInput$1, {
28663
- buttonsVisible: "never",
28664
- value: this.props.constraintXMax,
28665
- onChange: this.change("constraintXMax"),
28666
- analytics: analyticsStub
28667
- }), " ", /*#__PURE__*/React.createElement(TeX, null, "\\Large]"))), /*#__PURE__*/React.createElement("div", {
28694
+ }, /*#__PURE__*/React.createElement(DashPicker, {
28695
+ value: this.props.strokeDasharray,
28696
+ onChange: this.change("strokeDasharray")
28697
+ })), /*#__PURE__*/React.createElement("div", {
28668
28698
  className: "perseus-widget-row"
28669
28699
  }, /*#__PURE__*/React.createElement("div", {
28670
- className: "perseus-widget-row"
28671
- }, /*#__PURE__*/React.createElement(TeX, null, "y \\in \\Large["), " ", /*#__PURE__*/React.createElement(MathInput$1, {
28672
- buttonsVisible: "never",
28673
- value: this.props.constraintYMin,
28674
- onChange: this.change("constraintYMin"),
28675
- analytics: analyticsStub
28676
- }), /*#__PURE__*/React.createElement(TeX, null, ", "), " ", /*#__PURE__*/React.createElement(MathInput$1, {
28677
- buttonsVisible: "never",
28678
- value: this.props.constraintYMax,
28679
- onChange: this.change("constraintYMax"),
28680
- analytics: analyticsStub
28681
- }), " ", /*#__PURE__*/React.createElement(TeX, null, "\\Large]"))));
28700
+ className: "perseus-widget-left-col"
28701
+ }, "Width:", " ", /*#__PURE__*/React.createElement(NumberInput$g, {
28702
+ value: this.props.strokeWidth,
28703
+ placeholder: 2,
28704
+ onChange: this.change("strokeWidth")
28705
+ }))));
28682
28706
  }
28683
28707
  }
28684
- ConstraintEditor.defaultProps = {
28685
- constraint: "none",
28686
- snap: 0.5,
28687
- constraintFn: "0",
28688
- constraintXMin: "-10",
28689
- constraintXMax: "10",
28690
- constraintYMin: "-10",
28691
- constraintYMax: "10"
28708
+ FunctionEditor.defaultProps = {
28709
+ value: "x",
28710
+ rangeMin: "-10",
28711
+ rangeMax: "10",
28712
+ color: KhanColors.BLUE,
28713
+ strokeDasharray: "",
28714
+ strokeWidth: 2
28692
28715
  };
28693
28716
 
28694
28717
  const {
28695
- MathInput,
28696
- NumberInput: NumberInput$b,
28697
28718
  TextInput: TextInput$5
28698
28719
  } = components;
28699
28720
  const {
28700
- getDependencies
28721
+ getDependencies: getDependencies$7
28701
28722
  } = Dependencies;
28702
- const {
28703
- unescapeMathMode
28704
- } = Util;
28705
- const defaultInteractionProps = {
28706
- graph: {
28707
- box: [400, 400],
28708
- labels: ["x", "y"],
28709
- range: [[-10, 10], [-10, 10]],
28710
- tickStep: [1, 1],
28711
- gridStep: [1, 1],
28712
- markings: "graph"
28713
- },
28714
- elements: []
28715
- };
28716
- //
28717
- // Editor for non-interactive points
28718
- //
28719
- // TODO(eater): Factor this out
28720
- //
28721
- class PointEditor extends React.Component {
28723
+ // Editor for labels
28724
+ // TODO(eater): Add text direction
28725
+ class LabelEditor extends React.Component {
28722
28726
  constructor(..._args) {
28723
28727
  super(..._args);
28724
28728
  this.change = (...args) => {
@@ -28731,56 +28735,50 @@ class PointEditor extends React.Component {
28731
28735
  render() {
28732
28736
  const {
28733
28737
  TeX
28734
- } = getDependencies();
28735
- const analyticsStub = {
28736
- onAnalyticsEvent: () => Promise.resolve()
28737
- };
28738
+ } = getDependencies$7();
28738
28739
  return /*#__PURE__*/React.createElement("div", {
28739
28740
  className: "graph-settings"
28740
28741
  }, /*#__PURE__*/React.createElement("div", {
28741
28742
  className: "perseus-widget-row"
28742
- }, "Coordinate: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput, {
28743
- buttonsVisible: "never",
28744
- value: this.props.coordX
28745
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28746
- ,
28747
- onChange: this.change("coordX"),
28748
- analytics: analyticsStub
28749
- }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput, {
28750
- buttonsVisible: "never",
28751
- value: this.props.coordY
28752
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28753
- ,
28754
- onChange: this.change("coordY"),
28755
- analytics: analyticsStub
28743
+ }, /*#__PURE__*/React.createElement(TextInput$5, {
28744
+ value: this.props.label,
28745
+ onChange: this.change("label"),
28746
+ style: {
28747
+ width: "100%"
28748
+ }
28749
+ })), /*#__PURE__*/React.createElement("div", {
28750
+ className: "perseus-widget-row"
28751
+ }, "Location: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathquillInput, {
28752
+ value: this.props.coordX,
28753
+ onChange: this.change("coordX")
28754
+ }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathquillInput, {
28755
+ value: this.props.coordY,
28756
+ onChange: this.change("coordY")
28756
28757
  }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
28757
28758
  className: "perseus-widget-row"
28758
28759
  }, /*#__PURE__*/React.createElement(ColorPicker, {
28759
- value: this.props.color
28760
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28761
- ,
28760
+ value: this.props.color,
28762
28761
  onChange: this.change("color")
28763
28762
  })));
28764
28763
  }
28765
28764
  }
28766
- PointEditor.propTypes = _extends({}, Changeable.propTypes, {
28767
- coordX: PropTypes.string,
28768
- coordY: PropTypes.string,
28769
- color: PropTypes.string
28770
- });
28771
- PointEditor.defaultProps = {
28765
+ LabelEditor.defaultProps = {
28772
28766
  coordX: "0",
28773
28767
  coordY: "0",
28774
- color: KhanColors.BLACK
28768
+ color: KhanColors.BLACK,
28769
+ label: "\\phi"
28775
28770
  };
28776
- //
28771
+
28772
+ const {
28773
+ NumberInput: NumberInput$f
28774
+ } = components;
28775
+ const {
28776
+ getDependencies: getDependencies$6
28777
+ } = Dependencies;
28777
28778
  // Editor for non-interactive line segments
28778
- //
28779
- // TODO(eater): Factor this out
28780
- //
28781
28779
  class LineEditor extends React.Component {
28782
- constructor(..._args2) {
28783
- super(..._args2);
28780
+ constructor(..._args) {
28781
+ super(..._args);
28784
28782
  this.change = (...args) => {
28785
28783
  return Changeable.change.apply(this, args);
28786
28784
  };
@@ -28791,86 +28789,49 @@ class LineEditor extends React.Component {
28791
28789
  render() {
28792
28790
  const {
28793
28791
  TeX
28794
- } = getDependencies();
28795
- const analyticsStub = {
28796
- onAnalyticsEvent: () => Promise.resolve()
28797
- };
28792
+ } = getDependencies$6();
28798
28793
  return /*#__PURE__*/React.createElement("div", {
28799
28794
  className: "graph-settings"
28800
28795
  }, /*#__PURE__*/React.createElement("div", {
28801
28796
  className: "perseus-widget-row"
28802
- }, "Start: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput, {
28803
- buttonsVisible: "never",
28804
- value: this.props.startX
28805
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28806
- ,
28807
- onChange: this.change("startX"),
28808
- analytics: analyticsStub
28809
- }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput, {
28810
- buttonsVisible: "never",
28811
- value: this.props.startY
28812
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28813
- ,
28814
- onChange: this.change("startY"),
28815
- analytics: analyticsStub
28797
+ }, "Start: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathquillInput, {
28798
+ value: this.props.startX,
28799
+ onChange: this.change("startX")
28800
+ }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathquillInput, {
28801
+ value: this.props.startY,
28802
+ onChange: this.change("startY")
28816
28803
  }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
28817
28804
  className: "perseus-widget-row"
28818
- }, "End: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput, {
28819
- buttonsVisible: "never",
28820
- value: this.props.endX
28821
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28822
- ,
28823
- onChange: this.change("endX"),
28824
- analytics: analyticsStub
28825
- }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput, {
28826
- buttonsVisible: "never",
28827
- value: this.props.endY
28828
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28829
- ,
28830
- onChange: this.change("endY"),
28831
- analytics: analyticsStub
28805
+ }, "End: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathquillInput, {
28806
+ value: this.props.endX,
28807
+ onChange: this.change("endX")
28808
+ }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathquillInput, {
28809
+ value: this.props.endY,
28810
+ onChange: this.change("endY")
28832
28811
  }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
28833
28812
  className: "perseus-widget-row"
28834
28813
  }, /*#__PURE__*/React.createElement(ColorPicker, {
28835
- value: this.props.color
28836
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28837
- ,
28814
+ value: this.props.color,
28838
28815
  onChange: this.change("color")
28839
28816
  })), /*#__PURE__*/React.createElement("div", {
28840
28817
  className: "perseus-widget-row"
28841
28818
  }, /*#__PURE__*/React.createElement(DashPicker, {
28842
- value: this.props.strokeDasharray
28843
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28844
- ,
28819
+ value: this.props.strokeDasharray,
28845
28820
  onChange: this.change("strokeDasharray")
28846
28821
  }), "\xA0 \xA0", /*#__PURE__*/React.createElement(ArrowPicker, {
28847
- value: this.props.arrows
28848
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28849
- ,
28822
+ value: this.props.arrows,
28850
28823
  onChange: this.change("arrows")
28851
28824
  })), /*#__PURE__*/React.createElement("div", {
28852
28825
  className: "perseus-widget-row"
28853
28826
  }, /*#__PURE__*/React.createElement("div", {
28854
28827
  className: "perseus-widget-left-col"
28855
- }, "Width:", " ", /*#__PURE__*/React.createElement(NumberInput$b, {
28828
+ }, "Width:", " ", /*#__PURE__*/React.createElement(NumberInput$f, {
28856
28829
  value: this.props.strokeWidth,
28857
- placeholder: 2
28858
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28859
- ,
28830
+ placeholder: 2,
28860
28831
  onChange: this.change("strokeWidth")
28861
28832
  }))));
28862
28833
  }
28863
28834
  }
28864
- LineEditor.propTypes = _extends({}, Changeable.propTypes, {
28865
- startX: PropTypes.string,
28866
- startY: PropTypes.string,
28867
- endX: PropTypes.string,
28868
- endY: PropTypes.string,
28869
- color: PropTypes.string,
28870
- strokeDasharray: PropTypes.string,
28871
- arrows: PropTypes.string,
28872
- strokeWidth: PropTypes.number
28873
- });
28874
28835
  LineEditor.defaultProps = {
28875
28836
  startX: "-5",
28876
28837
  startY: "5",
@@ -28881,62 +28842,85 @@ LineEditor.defaultProps = {
28881
28842
  arrows: "",
28882
28843
  strokeWidth: 2
28883
28844
  };
28884
- //
28885
- // Editor for interactive movable points
28886
- //
28887
- // TODO(eater): Factor this out
28888
- // TODO(eater): Rethink how constraints are represented
28889
- //
28890
- class MovablePointEditor extends React.Component {
28891
- constructor(..._args3) {
28892
- super(..._args3);
28893
- this.change = (...args) => {
28894
- return Changeable.change.apply(this, args);
28895
- };
28896
- this.serialize = () => {
28897
- return EditorJsonify.serialize.call(this);
28845
+
28846
+ const {
28847
+ ButtonGroup: ButtonGroup$2,
28848
+ NumberInput: NumberInput$e
28849
+ } = components;
28850
+ class ConstraintEditor extends React.Component {
28851
+ constructor(...args) {
28852
+ super(...args);
28853
+ this.change = propName => {
28854
+ return Changeable.change.call(this, propName);
28898
28855
  };
28899
28856
  }
28900
28857
  render() {
28901
28858
  const {
28902
28859
  TeX
28903
- } = getDependencies();
28904
- const analyticsStub = {
28905
- onAnalyticsEvent: () => Promise.resolve()
28906
- };
28907
- return /*#__PURE__*/React.createElement("div", {
28860
+ } = Dependencies.getDependencies();
28861
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
28862
+ className: "perseus-widget-row"
28863
+ }, "Constraint:", " ", /*#__PURE__*/React.createElement(ButtonGroup$2, {
28864
+ value: this.props.constraint,
28865
+ allowEmpty: false,
28866
+ buttons: [{
28867
+ value: "none",
28868
+ content: "None"
28869
+ }, {
28870
+ value: "snap",
28871
+ content: "Snap"
28872
+ }, {
28873
+ value: "x",
28874
+ content: "x="
28875
+ }, {
28876
+ value: "y",
28877
+ content: "y="
28878
+ }],
28879
+ onChange: this.change("constraint")
28880
+ })), this.props.constraint === "snap" && /*#__PURE__*/React.createElement("div", {
28881
+ className: "perseus-widget-row"
28882
+ }, "Snap:", " ", /*#__PURE__*/React.createElement(NumberInput$e, {
28883
+ value: this.props.snap,
28884
+ placeholder: 0,
28885
+ onChange: this.change("snap")
28886
+ })), this.props.constraint === "x" && /*#__PURE__*/React.createElement("div", {
28908
28887
  className: "graph-settings"
28909
28888
  }, /*#__PURE__*/React.createElement("div", {
28910
28889
  className: "perseus-widget-row"
28911
- }, "Start: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput, {
28912
- buttonsVisible: "never",
28913
- value: this.props.startX,
28914
- onChange: this.change("startX"),
28915
- analytics: analyticsStub
28916
- }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput, {
28917
- buttonsVisible: "never",
28918
- value: this.props.startY,
28919
- onChange: this.change("startY"),
28920
- analytics: analyticsStub
28921
- }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
28890
+ }, /*#__PURE__*/React.createElement(TeX, null, "x="), " ", /*#__PURE__*/React.createElement(MathquillInput, {
28891
+ value: this.props.constraintFn,
28892
+ onChange: this.change("constraintFn")
28893
+ }))), this.props.constraint === "y" && /*#__PURE__*/React.createElement("div", {
28894
+ className: "graph-settings"
28895
+ }, /*#__PURE__*/React.createElement("div", {
28922
28896
  className: "perseus-widget-row"
28923
- }, "Update ", /*#__PURE__*/React.createElement(TeX, null, "(x_n, y_n)"), " for ", /*#__PURE__*/React.createElement(TeX, null, "n ="), " ", /*#__PURE__*/React.createElement(NumberInput$b, {
28924
- value: this.props.varSubscript,
28925
- placeholder: 0,
28926
- onChange: this.change("varSubscript")
28927
- })), /*#__PURE__*/React.createElement(ConstraintEditor, this.props));
28897
+ }, /*#__PURE__*/React.createElement(TeX, null, "y="), " ", /*#__PURE__*/React.createElement(MathquillInput, {
28898
+ value: this.props.constraintFn,
28899
+ onChange: this.change("constraintFn")
28900
+ }))), "Ensure these are set so nothing can be dragged off the canvas:", /*#__PURE__*/React.createElement("div", {
28901
+ className: "perseus-widget-row"
28902
+ }, /*#__PURE__*/React.createElement("div", {
28903
+ className: "perseus-widget-row"
28904
+ }, /*#__PURE__*/React.createElement(TeX, null, "x \\in \\Large["), " ", /*#__PURE__*/React.createElement(MathquillInput, {
28905
+ value: this.props.constraintXMin,
28906
+ onChange: this.change("constraintXMin")
28907
+ }), /*#__PURE__*/React.createElement(TeX, null, ", "), " ", /*#__PURE__*/React.createElement(MathquillInput, {
28908
+ value: this.props.constraintXMax,
28909
+ onChange: this.change("constraintXMax")
28910
+ }), " ", /*#__PURE__*/React.createElement(TeX, null, "\\Large]"))), /*#__PURE__*/React.createElement("div", {
28911
+ className: "perseus-widget-row"
28912
+ }, /*#__PURE__*/React.createElement("div", {
28913
+ className: "perseus-widget-row"
28914
+ }, /*#__PURE__*/React.createElement(TeX, null, "y \\in \\Large["), " ", /*#__PURE__*/React.createElement(MathquillInput, {
28915
+ value: this.props.constraintYMin,
28916
+ onChange: this.change("constraintYMin")
28917
+ }), /*#__PURE__*/React.createElement(TeX, null, ", "), " ", /*#__PURE__*/React.createElement(MathquillInput, {
28918
+ value: this.props.constraintYMax,
28919
+ onChange: this.change("constraintYMax")
28920
+ }), " ", /*#__PURE__*/React.createElement(TeX, null, "\\Large]"))));
28928
28921
  }
28929
28922
  }
28930
- MovablePointEditor.propTypes = _extends({}, Changeable.propTypes, {
28931
- startX: PropTypes.string,
28932
- startY: PropTypes.string,
28933
- constraint: PropTypes.string,
28934
- snap: PropTypes.number,
28935
- constraintFn: PropTypes.string
28936
- });
28937
- MovablePointEditor.defaultProps = {
28938
- startX: "0",
28939
- startY: "0",
28923
+ ConstraintEditor.defaultProps = {
28940
28924
  constraint: "none",
28941
28925
  snap: 0.5,
28942
28926
  constraintFn: "0",
@@ -28945,15 +28929,18 @@ MovablePointEditor.defaultProps = {
28945
28929
  constraintYMin: "-10",
28946
28930
  constraintYMax: "10"
28947
28931
  };
28948
- //
28932
+
28933
+ const {
28934
+ NumberInput: NumberInput$d
28935
+ } = components;
28936
+ const {
28937
+ getDependencies: getDependencies$5
28938
+ } = Dependencies;
28949
28939
  // Editor for interactive movable line segments
28950
- //
28951
- // TODO(eater): Factor this out
28952
28940
  // TODO(eater): Rethink how constraints are represented
28953
- //
28954
28941
  class MovableLineEditor extends React.Component {
28955
- constructor(..._args4) {
28956
- super(..._args4);
28942
+ constructor(..._args) {
28943
+ super(..._args);
28957
28944
  this.change = (...args) => {
28958
28945
  return Changeable.change.apply(this, args);
28959
28946
  };
@@ -28964,45 +28951,34 @@ class MovableLineEditor extends React.Component {
28964
28951
  render() {
28965
28952
  const {
28966
28953
  TeX
28967
- } = getDependencies();
28968
- const analyticsStub = {
28969
- onAnalyticsEvent: () => Promise.resolve()
28970
- };
28954
+ } = getDependencies$5();
28971
28955
  return /*#__PURE__*/React.createElement("div", {
28972
28956
  className: "graph-settings"
28973
28957
  }, "Initial position:", /*#__PURE__*/React.createElement("div", {
28974
28958
  className: "perseus-widget-row"
28975
- }, "Start: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput, {
28976
- buttonsVisible: "never",
28959
+ }, "Start: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathquillInput, {
28977
28960
  value: this.props.startX,
28978
- onChange: this.change("startX"),
28979
- analytics: analyticsStub
28980
- }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput, {
28981
- buttonsVisible: "never",
28961
+ onChange: this.change("startX")
28962
+ }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathquillInput, {
28982
28963
  value: this.props.startY,
28983
- onChange: this.change("startY"),
28984
- analytics: analyticsStub
28964
+ onChange: this.change("startY")
28985
28965
  }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
28986
28966
  className: "perseus-widget-row"
28987
- }, "End: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput, {
28988
- buttonsVisible: "never",
28967
+ }, "End: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathquillInput, {
28989
28968
  value: this.props.endX,
28990
- onChange: this.change("endX"),
28991
- analytics: analyticsStub
28992
- }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput, {
28993
- buttonsVisible: "never",
28969
+ onChange: this.change("endX")
28970
+ }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathquillInput, {
28994
28971
  value: this.props.endY,
28995
- onChange: this.change("endY"),
28996
- analytics: analyticsStub
28972
+ onChange: this.change("endY")
28997
28973
  }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
28998
28974
  className: "perseus-widget-row"
28999
- }, "Start updates ", /*#__PURE__*/React.createElement(TeX, null, "(x_n, y_n)"), " for ", /*#__PURE__*/React.createElement(TeX, null, "n ="), /*#__PURE__*/React.createElement(NumberInput$b, {
28975
+ }, "Start updates ", /*#__PURE__*/React.createElement(TeX, null, "(x_n, y_n)"), " for ", /*#__PURE__*/React.createElement(TeX, null, "n ="), /*#__PURE__*/React.createElement(NumberInput$d, {
29000
28976
  value: this.props.startSubscript,
29001
28977
  placeholder: 0,
29002
28978
  onChange: this.change("startSubscript")
29003
28979
  })), /*#__PURE__*/React.createElement("div", {
29004
28980
  className: "perseus-widget-row"
29005
- }, "End updates ", /*#__PURE__*/React.createElement(TeX, null, "(x_m, y_m)"), " for ", /*#__PURE__*/React.createElement(TeX, null, "m ="), /*#__PURE__*/React.createElement(NumberInput$b, {
28981
+ }, "End updates ", /*#__PURE__*/React.createElement(TeX, null, "(x_m, y_m)"), " for ", /*#__PURE__*/React.createElement(TeX, null, "m ="), /*#__PURE__*/React.createElement(NumberInput$d, {
29006
28982
  value: this.props.endSubscript,
29007
28983
  placeholder: 0,
29008
28984
  onChange: this.change("endSubscript")
@@ -29011,15 +28987,6 @@ class MovableLineEditor extends React.Component {
29011
28987
  }, "All constraints are applied to the start point."), /*#__PURE__*/React.createElement(ConstraintEditor, this.props));
29012
28988
  }
29013
28989
  }
29014
- MovableLineEditor.propTypes = _extends({}, Changeable.propTypes, {
29015
- startX: PropTypes.string,
29016
- startY: PropTypes.string,
29017
- endX: PropTypes.string,
29018
- endY: PropTypes.string,
29019
- constraint: PropTypes.string,
29020
- snap: PropTypes.number,
29021
- constraintFn: PropTypes.string
29022
- });
29023
28990
  MovableLineEditor.defaultProps = {
29024
28991
  startX: "-5",
29025
28992
  startY: "5",
@@ -29028,19 +28995,24 @@ MovableLineEditor.defaultProps = {
29028
28995
  constraint: "none",
29029
28996
  snap: 0.5,
29030
28997
  constraintFn: "0",
28998
+ // @ts-expect-error - TS2561
29031
28999
  constraintXMin: "-10",
29032
29000
  constraintXMax: "10",
29033
29001
  constraintYMin: "-10",
29034
29002
  constraintYMax: "10"
29035
29003
  };
29036
- //
29037
- // Editor for function plots
29038
- //
29039
- // TODO(eater): Factor this out
29040
- //
29041
- class FunctionEditor extends React.Component {
29042
- constructor(..._args5) {
29043
- super(..._args5);
29004
+
29005
+ const {
29006
+ NumberInput: NumberInput$c
29007
+ } = components;
29008
+ const {
29009
+ getDependencies: getDependencies$4
29010
+ } = Dependencies;
29011
+ // Editor for interactive movable points
29012
+ // TODO(eater): Rethink how constraints are represented
29013
+ class MovablePointEditor extends React.Component {
29014
+ constructor(..._args) {
29015
+ super(..._args);
29044
29016
  this.change = (...args) => {
29045
29017
  return Changeable.change.apply(this, args);
29046
29018
  };
@@ -29051,88 +29023,49 @@ class FunctionEditor extends React.Component {
29051
29023
  render() {
29052
29024
  const {
29053
29025
  TeX
29054
- } = getDependencies();
29055
- const analyticsStub = {
29056
- onAnalyticsEvent: () => Promise.resolve()
29057
- };
29026
+ } = getDependencies$4();
29058
29027
  return /*#__PURE__*/React.createElement("div", {
29059
29028
  className: "graph-settings"
29060
29029
  }, /*#__PURE__*/React.createElement("div", {
29061
29030
  className: "perseus-widget-row"
29062
- }, /*#__PURE__*/React.createElement(TeX, null, this.props.funcName + "(x)="), " ", /*#__PURE__*/React.createElement(MathInput, {
29063
- buttonsVisible: "never",
29064
- value: this.props.value
29065
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29066
- ,
29067
- onChange: this.change("value"),
29068
- analytics: analyticsStub
29069
- })), /*#__PURE__*/React.createElement("div", {
29070
- className: "perseus-widget-row"
29071
- }, "Range: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput, {
29072
- buttonsVisible: "never",
29073
- value: this.props.rangeMin
29074
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29075
- ,
29076
- onChange: this.change("rangeMin"),
29077
- analytics: analyticsStub
29078
- }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput, {
29079
- buttonsVisible: "never",
29080
- value: this.props.rangeMax
29081
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29082
- ,
29083
- onChange: this.change("rangeMax"),
29084
- analytics: analyticsStub
29031
+ }, "Start: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathquillInput, {
29032
+ value: this.props.startX,
29033
+ onChange: this.change("startX")
29034
+ }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathquillInput, {
29035
+ value: this.props.startY,
29036
+ onChange: this.change("startY")
29085
29037
  }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
29086
29038
  className: "perseus-widget-row"
29087
- }, /*#__PURE__*/React.createElement(ColorPicker, {
29088
- value: this.props.color
29089
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29090
- ,
29091
- onChange: this.change("color")
29092
- })), /*#__PURE__*/React.createElement("div", {
29093
- className: "perseus-widget-row"
29094
- }, /*#__PURE__*/React.createElement(DashPicker, {
29095
- value: this.props.strokeDasharray
29096
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29097
- ,
29098
- onChange: this.change("strokeDasharray")
29099
- })), /*#__PURE__*/React.createElement("div", {
29100
- className: "perseus-widget-row"
29101
- }, /*#__PURE__*/React.createElement("div", {
29102
- className: "perseus-widget-left-col"
29103
- }, "Width:", " ", /*#__PURE__*/React.createElement(NumberInput$b, {
29104
- value: this.props.strokeWidth,
29105
- placeholder: 2
29106
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29107
- ,
29108
- onChange: this.change("strokeWidth")
29109
- }))));
29039
+ }, "Update ", /*#__PURE__*/React.createElement(TeX, null, "(x_n, y_n)"), " for ", /*#__PURE__*/React.createElement(TeX, null, "n ="), " ", /*#__PURE__*/React.createElement(NumberInput$c, {
29040
+ value: this.props.varSubscript,
29041
+ placeholder: 0,
29042
+ onChange: this.change("varSubscript")
29043
+ })), /*#__PURE__*/React.createElement(ConstraintEditor, this.props));
29110
29044
  }
29111
29045
  }
29112
- FunctionEditor.propTypes = _extends({}, Changeable.propTypes, {
29113
- value: PropTypes.string,
29114
- rangeMin: PropTypes.string,
29115
- rangeMax: PropTypes.string,
29116
- color: PropTypes.string,
29117
- strokeDashArray: PropTypes.string,
29118
- strokeWidth: PropTypes.number
29119
- });
29120
- FunctionEditor.defaultProps = {
29121
- value: "x",
29122
- rangeMin: "-10",
29123
- rangeMax: "10",
29124
- color: KhanColors.BLUE,
29125
- strokeDasharray: "",
29126
- strokeWidth: 2
29046
+ MovablePointEditor.defaultProps = {
29047
+ startX: "0",
29048
+ startY: "0",
29049
+ constraint: "none",
29050
+ snap: 0.5,
29051
+ constraintFn: "0",
29052
+ // @ts-expect-error - TS2561
29053
+ constraintXMin: "-10",
29054
+ constraintXMax: "10",
29055
+ constraintYMin: "-10",
29056
+ constraintYMax: "10"
29127
29057
  };
29128
- //
29058
+
29059
+ const {
29060
+ NumberInput: NumberInput$b
29061
+ } = components;
29062
+ const {
29063
+ getDependencies: getDependencies$3
29064
+ } = Dependencies;
29129
29065
  // Editor for parametric plots
29130
- //
29131
- // TODO(eater): Factor this out
29132
- //
29133
29066
  class ParametricEditor extends React.Component {
29134
- constructor(..._args6) {
29135
- super(..._args6);
29067
+ constructor(..._args) {
29068
+ super(..._args);
29136
29069
  this.change = (...args) => {
29137
29070
  return Changeable.change.apply(this, args);
29138
29071
  };
@@ -29143,59 +29076,36 @@ class ParametricEditor extends React.Component {
29143
29076
  render() {
29144
29077
  const {
29145
29078
  TeX
29146
- } = getDependencies();
29147
- const analyticsStub = {
29148
- onAnalyticsEvent: () => Promise.resolve()
29149
- };
29079
+ } = getDependencies$3();
29150
29080
  return /*#__PURE__*/React.createElement("div", {
29151
29081
  className: "graph-settings"
29152
29082
  }, /*#__PURE__*/React.createElement("div", {
29153
29083
  className: "perseus-widget-row"
29154
- }, /*#__PURE__*/React.createElement(TeX, null, "X(t) ="), " ", /*#__PURE__*/React.createElement(MathInput, {
29155
- buttonsVisible: "never",
29156
- value: this.props.x
29157
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29158
- ,
29159
- onChange: this.change("x"),
29160
- analytics: analyticsStub
29084
+ }, /*#__PURE__*/React.createElement(TeX, null, "X(t) ="), " ", /*#__PURE__*/React.createElement(MathquillInput, {
29085
+ value: this.props.x,
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, {
29164
- buttonsVisible: "never",
29165
- value: this.props.y
29166
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29167
- ,
29168
- onChange: this.change("y"),
29169
- analytics: analyticsStub
29089
+ }, /*#__PURE__*/React.createElement(TeX, null, "Y(t) ="), " ", /*#__PURE__*/React.createElement(MathquillInput, {
29090
+ value: this.props.y,
29091
+ onChange: this.change("y")
29170
29092
  })), /*#__PURE__*/React.createElement("div", {
29171
29093
  className: "perseus-widget-row"
29172
- }, "Range: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput, {
29173
- buttonsVisible: "never",
29174
- value: this.props.rangeMin
29175
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29176
- ,
29177
- onChange: this.change("rangeMin"),
29178
- analytics: analyticsStub
29179
- }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput, {
29180
- buttonsVisible: "never",
29181
- value: this.props.rangeMax
29182
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29183
- ,
29184
- onChange: this.change("rangeMax"),
29185
- analytics: analyticsStub
29094
+ }, "Range: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathquillInput, {
29095
+ value: this.props.rangeMin,
29096
+ onChange: this.change("rangeMin")
29097
+ }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathquillInput, {
29098
+ value: this.props.rangeMax,
29099
+ onChange: this.change("rangeMax")
29186
29100
  }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
29187
29101
  className: "perseus-widget-row"
29188
29102
  }, /*#__PURE__*/React.createElement(ColorPicker, {
29189
- value: this.props.color
29190
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29191
- ,
29103
+ value: this.props.color,
29192
29104
  onChange: this.change("color")
29193
29105
  })), /*#__PURE__*/React.createElement("div", {
29194
29106
  className: "perseus-widget-row"
29195
29107
  }, /*#__PURE__*/React.createElement(DashPicker, {
29196
- value: this.props.strokeDasharray
29197
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29198
- ,
29108
+ value: this.props.strokeDasharray,
29199
29109
  onChange: this.change("strokeDasharray")
29200
29110
  })), /*#__PURE__*/React.createElement("div", {
29201
29111
  className: "perseus-widget-row"
@@ -29203,22 +29113,11 @@ class ParametricEditor extends React.Component {
29203
29113
  className: "perseus-widget-left-col"
29204
29114
  }, "Width:", " ", /*#__PURE__*/React.createElement(NumberInput$b, {
29205
29115
  value: this.props.strokeWidth,
29206
- placeholder: 2
29207
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29208
- ,
29116
+ placeholder: 2,
29209
29117
  onChange: this.change("strokeWidth")
29210
29118
  }))));
29211
29119
  }
29212
29120
  }
29213
- ParametricEditor.propTypes = _extends({}, Changeable.propTypes, {
29214
- x: PropTypes.string,
29215
- y: PropTypes.string,
29216
- rangeMin: PropTypes.string,
29217
- rangeMax: PropTypes.string,
29218
- color: PropTypes.string,
29219
- strokeDashArray: PropTypes.string,
29220
- strokeWidth: PropTypes.number
29221
- });
29222
29121
  ParametricEditor.defaultProps = {
29223
29122
  x: "cos(t)",
29224
29123
  y: "sin(t)",
@@ -29228,15 +29127,14 @@ ParametricEditor.defaultProps = {
29228
29127
  strokeDasharray: "",
29229
29128
  strokeWidth: 2
29230
29129
  };
29231
- //
29232
- // Editor for labels
29233
- //
29234
- // TODO(eater): Factor this out maybe?
29235
- // TODO(eater): Add text direction
29236
- //
29237
- class LabelEditor extends React.Component {
29238
- constructor(..._args7) {
29239
- super(..._args7);
29130
+
29131
+ const {
29132
+ getDependencies: getDependencies$2
29133
+ } = Dependencies;
29134
+ // Editor for non-interactive points
29135
+ class PointEditor extends React.Component {
29136
+ constructor(..._args) {
29137
+ super(..._args);
29240
29138
  this.change = (...args) => {
29241
29139
  return Changeable.change.apply(this, args);
29242
29140
  };
@@ -29247,68 +29145,38 @@ class LabelEditor extends React.Component {
29247
29145
  render() {
29248
29146
  const {
29249
29147
  TeX
29250
- } = getDependencies();
29251
- const analyticsStub = {
29252
- onAnalyticsEvent: () => Promise.resolve()
29253
- };
29148
+ } = getDependencies$2();
29254
29149
  return /*#__PURE__*/React.createElement("div", {
29255
29150
  className: "graph-settings"
29256
29151
  }, /*#__PURE__*/React.createElement("div", {
29257
29152
  className: "perseus-widget-row"
29258
- }, /*#__PURE__*/React.createElement(TextInput$5, {
29259
- value: this.props.label
29260
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29261
- ,
29262
- onChange: this.change("label"),
29263
- style: {
29264
- width: "100%"
29265
- }
29266
- })), /*#__PURE__*/React.createElement("div", {
29267
- className: "perseus-widget-row"
29268
- }, "Location: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput, {
29269
- buttonsVisible: "never",
29270
- value: this.props.coordX
29271
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29272
- ,
29273
- onChange: this.change("coordX"),
29274
- analytics: analyticsStub
29275
- }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput, {
29276
- buttonsVisible: "never",
29277
- value: this.props.coordY
29278
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29279
- ,
29280
- onChange: this.change("coordY"),
29281
- analytics: analyticsStub
29153
+ }, "Coordinate: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathquillInput, {
29154
+ value: this.props.coordX,
29155
+ onChange: this.change("coordX")
29156
+ }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathquillInput, {
29157
+ value: this.props.coordY,
29158
+ onChange: this.change("coordY")
29282
29159
  }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
29283
29160
  className: "perseus-widget-row"
29284
29161
  }, /*#__PURE__*/React.createElement(ColorPicker, {
29285
- value: this.props.color
29286
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29287
- ,
29162
+ value: this.props.color,
29288
29163
  onChange: this.change("color")
29289
29164
  })));
29290
29165
  }
29291
29166
  }
29292
- LabelEditor.propTypes = _extends({}, Changeable.propTypes, {
29293
- color: PropTypes.string,
29294
- coordX: PropTypes.string,
29295
- coordY: PropTypes.string,
29296
- label: PropTypes.string
29297
- });
29298
- LabelEditor.defaultProps = {
29167
+ PointEditor.defaultProps = {
29299
29168
  coordX: "0",
29300
29169
  coordY: "0",
29301
- color: KhanColors.BLACK,
29302
- label: "\\phi"
29170
+ color: KhanColors.BLACK
29303
29171
  };
29304
- //
29172
+
29173
+ const {
29174
+ getDependencies: getDependencies$1
29175
+ } = Dependencies;
29305
29176
  // Editor for rectangles
29306
- //
29307
- // TODO(eater): Factor this out maybe?
29308
- //
29309
29177
  class RectangleEditor extends React.Component {
29310
- constructor(..._args8) {
29311
- super(..._args8);
29178
+ constructor(..._args) {
29179
+ super(..._args);
29312
29180
  this.change = (...args) => {
29313
29181
  return Changeable.change.apply(this, args);
29314
29182
  };
@@ -29319,66 +29187,38 @@ class RectangleEditor extends React.Component {
29319
29187
  render() {
29320
29188
  const {
29321
29189
  TeX
29322
- } = getDependencies();
29323
- const analyticsStub = {
29324
- onAnalyticsEvent: () => Promise.resolve()
29325
- };
29190
+ } = getDependencies$1();
29326
29191
  return /*#__PURE__*/React.createElement("div", {
29327
29192
  className: "graph-settings"
29328
29193
  }, /*#__PURE__*/React.createElement("div", {
29329
29194
  className: "perseus-widget-row"
29330
- }, "Bottom left: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput, {
29331
- buttonsVisible: "never",
29332
- value: this.props.coordX
29333
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29334
- ,
29335
- onChange: this.change("coordX"),
29336
- analytics: analyticsStub
29337
- }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput, {
29338
- buttonsVisible: "never",
29339
- value: this.props.coordY
29340
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29341
- ,
29342
- onChange: this.change("coordY"),
29343
- analytics: analyticsStub
29195
+ }, "Bottom left: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathquillInput, {
29196
+ value: this.props.coordX,
29197
+ onChange: this.change("coordX")
29198
+ }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathquillInput, {
29199
+ value: this.props.coordY,
29200
+ onChange: this.change("coordY")
29344
29201
  }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
29345
29202
  className: "perseus-widget-row"
29346
- }, "Width:", " ", /*#__PURE__*/React.createElement(MathInput, {
29347
- buttonsVisible: "never",
29348
- value: this.props.width
29349
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29350
- ,
29351
- onChange: this.change("width"),
29352
- analytics: analyticsStub
29203
+ }, "Width:", " ", /*#__PURE__*/React.createElement(MathquillInput, {
29204
+ value: this.props.width,
29205
+ onChange: this.change("width")
29353
29206
  })), /*#__PURE__*/React.createElement("div", {
29354
29207
  className: "perseus-widget-row"
29355
- }, "Height:", " ", /*#__PURE__*/React.createElement(MathInput, {
29356
- buttonsVisible: "never",
29357
- value: this.props.height
29358
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29359
- ,
29360
- onChange: this.change("height"),
29361
- analytics: analyticsStub
29208
+ }, "Height:", " ", /*#__PURE__*/React.createElement(MathquillInput, {
29209
+ value: this.props.height,
29210
+ onChange: this.change("height")
29362
29211
  })), /*#__PURE__*/React.createElement("div", {
29363
29212
  className: "perseus-widget-row"
29364
29213
  }, /*#__PURE__*/React.createElement(ColorPicker, {
29365
29214
  value: this.props.color,
29366
- lightColors: true
29367
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29368
- ,
29215
+ lightColors: true,
29369
29216
  onChange: this.change("color")
29370
29217
  })), /*#__PURE__*/React.createElement("div", {
29371
29218
  className: "perseus-widget-row"
29372
29219
  }, "You want a border? Sorry, draw your own."));
29373
29220
  }
29374
29221
  }
29375
- RectangleEditor.propTypes = _extends({}, Changeable.propTypes, {
29376
- color: PropTypes.string,
29377
- coordX: PropTypes.string,
29378
- coordY: PropTypes.string,
29379
- height: PropTypes.string,
29380
- width: PropTypes.string
29381
- });
29382
29222
  RectangleEditor.defaultProps = {
29383
29223
  coordX: "-5",
29384
29224
  coordY: "5",
@@ -29386,9 +29226,27 @@ RectangleEditor.defaultProps = {
29386
29226
  height: "3",
29387
29227
  color: KhanColors.LIGHT_BLUE
29388
29228
  };
29229
+
29230
+ const {
29231
+ getDependencies
29232
+ } = Dependencies;
29233
+ const {
29234
+ unescapeMathMode
29235
+ } = Util;
29236
+ const defaultInteractionProps = {
29237
+ graph: {
29238
+ box: [400, 400],
29239
+ labels: ["x", "y"],
29240
+ range: [[-10, 10], [-10, 10]],
29241
+ tickStep: [1, 1],
29242
+ gridStep: [1, 1],
29243
+ markings: "graph"
29244
+ },
29245
+ elements: []
29246
+ };
29389
29247
  class InteractionEditor extends React.Component {
29390
- constructor(..._args9) {
29391
- super(..._args9);
29248
+ constructor(..._args) {
29249
+ super(..._args);
29392
29250
  this.state = {
29393
29251
  usedVarSubscripts: this._getAllVarSubscripts(this.props.elements),
29394
29252
  usedFunctionNames: this._getAllFunctionNames(this.props.elements)
@@ -29813,12 +29671,6 @@ class InteractionEditor extends React.Component {
29813
29671
  /* eslint-enable max-len */
29814
29672
  }
29815
29673
  }
29816
- // TODO(eater): Make more better
29817
- InteractionEditor.propTypes = _extends({}, Changeable.propTypes, {
29818
- // eslint-disable-next-line react/forbid-prop-types
29819
- elements: PropTypes.arrayOf(PropTypes.object),
29820
- graph: PropTypes.objectOf(PropTypes.any)
29821
- });
29822
29674
  InteractionEditor.widgetName = "interaction";
29823
29675
  InteractionEditor.defaultProps = defaultInteractionProps;
29824
29676