@khanacademy/perseus-editor 2.15.3 → 2.15.5

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 (61) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/editor-page.d.ts +4 -10
  3. package/dist/editor.d.ts +2 -2
  4. package/dist/es/index.js +362 -360
  5. package/dist/es/index.js.map +1 -1
  6. package/dist/index.js +426 -425
  7. package/dist/index.js.map +1 -1
  8. package/dist/widgets/interaction-editor/function-editor.d.ts +26 -0
  9. package/dist/widgets/interaction-editor/index.d.ts +2 -0
  10. package/dist/widgets/interaction-editor/label-editor.d.ts +22 -0
  11. package/dist/widgets/interaction-editor/line-editor.d.ts +30 -0
  12. package/dist/widgets/interaction-editor/movable-line-editor.d.ts +32 -0
  13. package/dist/widgets/interaction-editor/movable-point-editor.d.ts +28 -0
  14. package/dist/widgets/interaction-editor/parametric-editor.d.ts +28 -0
  15. package/dist/widgets/interaction-editor/point-editor.d.ts +20 -0
  16. package/dist/widgets/interaction-editor/rectangle-editor.d.ts +24 -0
  17. package/dist/widgets/interactive-graph-editor.d.ts +92 -92
  18. package/package.json +2 -2
  19. package/src/__stories__/editor-page.stories.tsx +65 -0
  20. package/src/__stories__/editor.stories.tsx +2 -4
  21. package/src/editor-page.tsx +5 -11
  22. package/src/editor.tsx +2 -2
  23. package/src/widgets/__stories__/categorizer-editor.stories.tsx +24 -0
  24. package/src/widgets/__stories__/definition-editor.stories.tsx +18 -0
  25. package/src/widgets/__stories__/dropdown-editor.stories.tsx +18 -0
  26. package/src/widgets/__stories__/explanation-editor.stories.tsx +18 -0
  27. package/src/widgets/__stories__/input-number-editor.stories.tsx +18 -0
  28. package/src/widgets/__stories__/interaction-editor.stories.tsx +24 -0
  29. package/src/widgets/__stories__/matcher-editor.stories.tsx +18 -0
  30. package/src/widgets/__stories__/number-line-editor.stories.tsx +18 -0
  31. package/src/widgets/__stories__/numeric-input-editor.stories.tsx +18 -0
  32. package/src/widgets/__stories__/radio-editor.stories.tsx +3 -3
  33. package/src/widgets/__stories__/sorter-editor.stories.tsx +18 -0
  34. package/src/widgets/__tests__/categorizer-editor.test.tsx +51 -0
  35. package/src/widgets/__tests__/definition-editor.test.tsx +41 -0
  36. package/src/widgets/__tests__/dropdown-editor.test.tsx +57 -0
  37. package/src/widgets/__tests__/explanation-editor.test.tsx +59 -0
  38. package/src/widgets/__tests__/input-number-editor.test.tsx +128 -0
  39. package/src/widgets/__tests__/matcher-editor.test.tsx +47 -0
  40. package/src/widgets/__tests__/number-line-editor.test.tsx +144 -0
  41. package/src/widgets/__tests__/numeric-input-editor.test.tsx +177 -0
  42. package/src/widgets/__tests__/radio-editor.test.tsx +118 -0
  43. package/src/widgets/__tests__/sorter-editor.test.tsx +55 -0
  44. package/src/widgets/dropdown-editor.tsx +1 -0
  45. package/src/widgets/input-number-editor.tsx +2 -0
  46. package/src/widgets/interaction-editor/function-editor.tsx +111 -0
  47. package/src/widgets/interaction-editor/index.ts +3 -0
  48. package/src/widgets/{interaction-editor.tsx → interaction-editor/interaction-editor.tsx} +14 -768
  49. package/src/widgets/interaction-editor/label-editor.tsx +91 -0
  50. package/src/widgets/interaction-editor/line-editor.tsx +129 -0
  51. package/src/widgets/interaction-editor/movable-line-editor.tsx +125 -0
  52. package/src/widgets/interaction-editor/movable-point-editor.tsx +92 -0
  53. package/src/widgets/interaction-editor/parametric-editor.tsx +122 -0
  54. package/src/widgets/interaction-editor/point-editor.tsx +79 -0
  55. package/src/widgets/interaction-editor/rectangle-editor.tsx +105 -0
  56. package/src/widgets/number-line-editor.tsx +16 -5
  57. package/src/widgets/numeric-input-editor.tsx +2 -0
  58. package/tsconfig-build.tsbuildinfo +1 -1
  59. package/dist/widgets/{interaction → interaction-editor}/constraint-editor.d.ts +0 -0
  60. package/dist/widgets/{interaction-editor.d.ts → interaction-editor/interaction-editor.d.ts} +1 -1
  61. /package/src/widgets/{interaction → interaction-editor}/constraint-editor.tsx +0 -0
package/dist/index.js CHANGED
@@ -64,7 +64,7 @@ var i18n__namespace = /*#__PURE__*/_interopNamespace(i18n$1);
64
64
 
65
65
  // This file is processed by a Rollup plugin (replace) to inject the production
66
66
  const libName = "@khanacademy/perseus-editor";
67
- const libVersion = "2.15.3";
67
+ const libVersion = "2.15.5";
68
68
  perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
69
69
 
70
70
  function _extends() {
@@ -26336,7 +26336,8 @@ class DropdownEditor extends React__namespace.Component {
26336
26336
  value: choice.content
26337
26337
  }), /*#__PURE__*/React__namespace.createElement("a", {
26338
26338
  href: "#",
26339
- className: "simple-button orange"
26339
+ className: "simple-button orange",
26340
+ "aria-label": "Delete choice"
26340
26341
  // eslint-disable-next-line react/jsx-no-bind
26341
26342
  // @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
26342
26343
  ,
@@ -27436,7 +27437,7 @@ const {
27436
27437
  RangeInput: RangeInput$5
27437
27438
  } = perseus.components;
27438
27439
  const {
27439
- getDependencies: getDependencies$1
27440
+ getDependencies: getDependencies$9
27440
27441
  } = perseus.Dependencies;
27441
27442
  const defaultBackgroundImage$3 = {
27442
27443
  url: null,
@@ -27757,7 +27758,7 @@ const GraphSettings = createReactClass__default["default"]({
27757
27758
  const scale = [perseus.KhanMath.roundTo(2, perseus.Util.scaleFromExtent(this.props.range[0], this.props.box[0])), perseus.KhanMath.roundTo(2, perseus.Util.scaleFromExtent(this.props.range[1], this.props.box[1]))];
27758
27759
  const {
27759
27760
  TeX
27760
- } = getDependencies$1();
27761
+ } = getDependencies$9();
27761
27762
  return /*#__PURE__*/React__namespace.createElement("div", null, ___default["default"].contains(this.props.editableSettings, "canvas") && /*#__PURE__*/React__namespace.createElement("div", {
27762
27763
  className: "graph-settings"
27763
27764
  }, /*#__PURE__*/React__namespace.createElement("div", {
@@ -28600,6 +28601,7 @@ class InputNumberEditor extends React__namespace.Component {
28600
28601
  type: "text",
28601
28602
  disabled: !this.props.inexact,
28602
28603
  defaultValue: this.props.maxError,
28604
+ "aria-label": "Max error",
28603
28605
  onBlur: e => {
28604
28606
  const ans = "" + (perseus.Util.firstNumericalParse(e.target.value) || 0);
28605
28607
  e.target.value = ans;
@@ -28614,7 +28616,8 @@ class InputNumberEditor extends React__namespace.Component {
28614
28616
  this.props.onChange({
28615
28617
  answerType: e.target.value
28616
28618
  });
28617
- }
28619
+ },
28620
+ "aria-label": "Answer type"
28618
28621
  }, answerTypeOptions), /*#__PURE__*/React__namespace.createElement(InfoTip$f, null, /*#__PURE__*/React__namespace.createElement("p", null, "Use the default \"Numbers\" unless the answer must be in a specific form (e.g., question is about converting decimals to fractions)."))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", null, "Width", " ", /*#__PURE__*/React__namespace.createElement("select", {
28619
28622
  value: this.props.size,
28620
28623
  onChange: e => {
@@ -28654,148 +28657,140 @@ class InputNumberEditor extends React__namespace.Component {
28654
28657
  }
28655
28658
 
28656
28659
  const {
28657
- ButtonGroup: ButtonGroup$2,
28658
- MathInput: MathInput$1,
28659
- NumberInput: NumberInput$c
28660
+ MathInput: MathInput$8,
28661
+ NumberInput: NumberInput$g
28660
28662
  } = perseus.components;
28661
- class ConstraintEditor extends React__namespace.Component {
28663
+ const {
28664
+ getDependencies: getDependencies$8
28665
+ } = perseus.Dependencies;
28666
+ //
28667
+ // Editor for function plots
28668
+ //
28669
+ // TODO(eater): Factor this out
28670
+ //
28671
+ class FunctionEditor extends React__namespace.Component {
28672
+ static propTypes = {
28673
+ ...perseus.Changeable.propTypes,
28674
+ value: PropTypes__default["default"].string,
28675
+ rangeMin: PropTypes__default["default"].string,
28676
+ rangeMax: PropTypes__default["default"].string,
28677
+ color: PropTypes__default["default"].string,
28678
+ strokeDashArray: PropTypes__default["default"].string,
28679
+ strokeWidth: PropTypes__default["default"].number
28680
+ };
28662
28681
  static defaultProps = {
28663
- constraint: "none",
28664
- snap: 0.5,
28665
- constraintFn: "0",
28666
- constraintXMin: "-10",
28667
- constraintXMax: "10",
28668
- constraintYMin: "-10",
28669
- constraintYMax: "10"
28682
+ value: "x",
28683
+ rangeMin: "-10",
28684
+ rangeMax: "10",
28685
+ color: perseus.KhanColors.BLUE,
28686
+ strokeDasharray: "",
28687
+ strokeWidth: 2
28670
28688
  };
28671
- change = propName => {
28672
- return perseus.Changeable.change.call(this, propName);
28689
+ change = (() => {
28690
+ var _this = this;
28691
+ return function () {
28692
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
28693
+ args[_key] = arguments[_key];
28694
+ }
28695
+ return perseus.Changeable.change.apply(_this, args);
28696
+ };
28697
+ })();
28698
+ serialize = () => {
28699
+ return perseus.EditorJsonify.serialize.call(this);
28673
28700
  };
28674
28701
  render() {
28675
28702
  const {
28676
28703
  TeX
28677
- } = perseus.Dependencies.getDependencies();
28704
+ } = getDependencies$8();
28678
28705
  const analyticsStub = {
28679
28706
  onAnalyticsEvent: () => Promise.resolve()
28680
28707
  };
28681
- return /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("div", {
28682
- className: "perseus-widget-row"
28683
- }, "Constraint:", " ", /*#__PURE__*/React__namespace.createElement(ButtonGroup$2, {
28684
- value: this.props.constraint,
28685
- allowEmpty: false,
28686
- buttons: [{
28687
- value: "none",
28688
- content: "None"
28689
- }, {
28690
- value: "snap",
28691
- content: "Snap"
28692
- }, {
28693
- value: "x",
28694
- content: "x="
28695
- }, {
28696
- value: "y",
28697
- content: "y="
28698
- }],
28699
- onChange: this.change("constraint")
28700
- })), this.props.constraint === "snap" && /*#__PURE__*/React__namespace.createElement("div", {
28701
- className: "perseus-widget-row"
28702
- }, "Snap:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$c, {
28703
- value: this.props.snap,
28704
- placeholder: 0,
28705
- onChange: this.change("snap")
28706
- })), this.props.constraint === "x" && /*#__PURE__*/React__namespace.createElement("div", {
28707
- className: "graph-settings"
28708
- }, /*#__PURE__*/React__namespace.createElement("div", {
28709
- className: "perseus-widget-row"
28710
- }, /*#__PURE__*/React__namespace.createElement(TeX, null, "x="), " ", /*#__PURE__*/React__namespace.createElement(MathInput$1, {
28711
- buttonsVisible: "never",
28712
- value: this.props.constraintFn,
28713
- onChange: this.change("constraintFn"),
28714
- analytics: analyticsStub
28715
- }))), this.props.constraint === "y" && /*#__PURE__*/React__namespace.createElement("div", {
28708
+ return /*#__PURE__*/React__namespace.createElement("div", {
28716
28709
  className: "graph-settings"
28717
28710
  }, /*#__PURE__*/React__namespace.createElement("div", {
28718
28711
  className: "perseus-widget-row"
28719
- }, /*#__PURE__*/React__namespace.createElement(TeX, null, "y="), " ", /*#__PURE__*/React__namespace.createElement(MathInput$1, {
28712
+ }, /*#__PURE__*/React__namespace.createElement(TeX, null, this.props.funcName + "(x)="), " ", /*#__PURE__*/React__namespace.createElement(MathInput$8, {
28720
28713
  buttonsVisible: "never",
28721
- value: this.props.constraintFn,
28722
- onChange: this.change("constraintFn"),
28714
+ value: this.props.value,
28715
+ onChange: this.change("value"),
28723
28716
  analytics: analyticsStub
28724
- }))), "Ensure these are set so nothing can be dragged off the canvas:", /*#__PURE__*/React__namespace.createElement("div", {
28725
- className: "perseus-widget-row"
28726
- }, /*#__PURE__*/React__namespace.createElement("div", {
28717
+ })), /*#__PURE__*/React__namespace.createElement("div", {
28727
28718
  className: "perseus-widget-row"
28728
- }, /*#__PURE__*/React__namespace.createElement(TeX, null, "x \\in \\Large["), " ", /*#__PURE__*/React__namespace.createElement(MathInput$1, {
28719
+ }, "Range: ", /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large("), /*#__PURE__*/React__namespace.createElement(MathInput$8, {
28729
28720
  buttonsVisible: "never",
28730
- value: this.props.constraintXMin,
28731
- onChange: this.change("constraintXMin"),
28721
+ value: this.props.rangeMin,
28722
+ onChange: this.change("rangeMin"),
28732
28723
  analytics: analyticsStub
28733
- }), /*#__PURE__*/React__namespace.createElement(TeX, null, ", "), " ", /*#__PURE__*/React__namespace.createElement(MathInput$1, {
28724
+ }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput$8, {
28734
28725
  buttonsVisible: "never",
28735
- value: this.props.constraintXMax,
28736
- onChange: this.change("constraintXMax"),
28726
+ value: this.props.rangeMax,
28727
+ onChange: this.change("rangeMax"),
28737
28728
  analytics: analyticsStub
28738
- }), " ", /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large]"))), /*#__PURE__*/React__namespace.createElement("div", {
28729
+ }), /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React__namespace.createElement("div", {
28739
28730
  className: "perseus-widget-row"
28740
- }, /*#__PURE__*/React__namespace.createElement("div", {
28731
+ }, /*#__PURE__*/React__namespace.createElement(perseus.ColorPicker, {
28732
+ value: this.props.color,
28733
+ onChange: this.change("color")
28734
+ })), /*#__PURE__*/React__namespace.createElement("div", {
28741
28735
  className: "perseus-widget-row"
28742
- }, /*#__PURE__*/React__namespace.createElement(TeX, null, "y \\in \\Large["), " ", /*#__PURE__*/React__namespace.createElement(MathInput$1, {
28743
- buttonsVisible: "never",
28744
- value: this.props.constraintYMin,
28745
- onChange: this.change("constraintYMin"),
28746
- analytics: analyticsStub
28747
- }), /*#__PURE__*/React__namespace.createElement(TeX, null, ", "), " ", /*#__PURE__*/React__namespace.createElement(MathInput$1, {
28748
- buttonsVisible: "never",
28749
- value: this.props.constraintYMax,
28750
- onChange: this.change("constraintYMax"),
28751
- analytics: analyticsStub
28752
- }), " ", /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large]"))));
28736
+ }, /*#__PURE__*/React__namespace.createElement(perseus.DashPicker, {
28737
+ value: this.props.strokeDasharray,
28738
+ onChange: this.change("strokeDasharray")
28739
+ })), /*#__PURE__*/React__namespace.createElement("div", {
28740
+ className: "perseus-widget-row"
28741
+ }, /*#__PURE__*/React__namespace.createElement("div", {
28742
+ className: "perseus-widget-left-col"
28743
+ }, "Width:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$g, {
28744
+ value: this.props.strokeWidth,
28745
+ placeholder: 2,
28746
+ onChange: this.change("strokeWidth")
28747
+ }))));
28753
28748
  }
28754
28749
  }
28755
28750
 
28756
28751
  const {
28757
- MathInput,
28758
- NumberInput: NumberInput$b,
28752
+ MathInput: MathInput$7,
28759
28753
  TextInput: TextInput$5
28760
28754
  } = perseus.components;
28761
28755
  const {
28762
- getDependencies
28756
+ getDependencies: getDependencies$7
28763
28757
  } = perseus.Dependencies;
28764
- const {
28765
- unescapeMathMode
28766
- } = perseus.Util;
28767
- const defaultInteractionProps = {
28768
- graph: {
28769
- box: [400, 400],
28770
- labels: ["x", "y"],
28771
- range: [[-10, 10], [-10, 10]],
28772
- tickStep: [1, 1],
28773
- gridStep: [1, 1],
28774
- markings: "graph"
28775
- },
28776
- elements: []
28777
- };
28778
28758
  //
28779
- // Editor for non-interactive points
28759
+ // Editor for labels
28780
28760
  //
28781
- // TODO(eater): Factor this out
28761
+ // TODO(eater): Factor this out maybe?
28762
+ // TODO(eater): Add text direction
28782
28763
  //
28783
- class PointEditor extends React__namespace.Component {
28764
+ class LabelEditor extends React__namespace.Component {
28784
28765
  static propTypes = {
28785
28766
  ...perseus.Changeable.propTypes,
28767
+ color: PropTypes__default["default"].string,
28786
28768
  coordX: PropTypes__default["default"].string,
28787
28769
  coordY: PropTypes__default["default"].string,
28788
- color: PropTypes__default["default"].string
28770
+ label: PropTypes__default["default"].string
28789
28771
  };
28790
28772
  static defaultProps = {
28791
28773
  coordX: "0",
28792
28774
  coordY: "0",
28793
- color: perseus.KhanColors.BLACK
28775
+ color: perseus.KhanColors.BLACK,
28776
+ label: "\\phi"
28777
+ };
28778
+ change = (() => {
28779
+ var _this = this;
28780
+ return function () {
28781
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
28782
+ args[_key] = arguments[_key];
28783
+ }
28784
+ return perseus.Changeable.change.apply(_this, args);
28785
+ };
28786
+ })();
28787
+ serialize = () => {
28788
+ return perseus.EditorJsonify.serialize.call(this);
28794
28789
  };
28795
28790
  render() {
28796
28791
  const {
28797
28792
  TeX
28798
- } = getDependencies();
28793
+ } = getDependencies$7();
28799
28794
  const analyticsStub = {
28800
28795
  onAnalyticsEvent: () => Promise.resolve()
28801
28796
  };
@@ -28803,42 +28798,40 @@ class PointEditor extends React__namespace.Component {
28803
28798
  className: "graph-settings"
28804
28799
  }, /*#__PURE__*/React__namespace.createElement("div", {
28805
28800
  className: "perseus-widget-row"
28806
- }, "Coordinate: ", /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large("), /*#__PURE__*/React__namespace.createElement(MathInput, {
28801
+ }, /*#__PURE__*/React__namespace.createElement(TextInput$5, {
28802
+ value: this.props.label,
28803
+ onChange: this.change("label"),
28804
+ style: {
28805
+ width: "100%"
28806
+ }
28807
+ })), /*#__PURE__*/React__namespace.createElement("div", {
28808
+ className: "perseus-widget-row"
28809
+ }, "Location: ", /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large("), /*#__PURE__*/React__namespace.createElement(MathInput$7, {
28807
28810
  buttonsVisible: "never",
28808
- value: this.props.coordX
28809
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28810
- ,
28811
+ value: this.props.coordX,
28811
28812
  onChange: this.change("coordX"),
28812
28813
  analytics: analyticsStub
28813
- }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput, {
28814
+ }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput$7, {
28814
28815
  buttonsVisible: "never",
28815
- value: this.props.coordY
28816
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28817
- ,
28816
+ value: this.props.coordY,
28818
28817
  onChange: this.change("coordY"),
28819
28818
  analytics: analyticsStub
28820
28819
  }), /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React__namespace.createElement("div", {
28821
28820
  className: "perseus-widget-row"
28822
28821
  }, /*#__PURE__*/React__namespace.createElement(perseus.ColorPicker, {
28823
- value: this.props.color
28824
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28825
- ,
28822
+ value: this.props.color,
28826
28823
  onChange: this.change("color")
28827
28824
  })));
28828
28825
  }
28829
- change = (() => {
28830
- var _this = this;
28831
- return function () {
28832
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
28833
- args[_key] = arguments[_key];
28834
- }
28835
- return perseus.Changeable.change.apply(_this, args);
28836
- };
28837
- })();
28838
- serialize = () => {
28839
- return perseus.EditorJsonify.serialize.call(this);
28840
- };
28841
28826
  }
28827
+
28828
+ const {
28829
+ MathInput: MathInput$6,
28830
+ NumberInput: NumberInput$f
28831
+ } = perseus.components;
28832
+ const {
28833
+ getDependencies: getDependencies$6
28834
+ } = perseus.Dependencies;
28842
28835
  //
28843
28836
  // Editor for non-interactive line segments
28844
28837
  //
@@ -28866,10 +28859,22 @@ class LineEditor extends React__namespace.Component {
28866
28859
  arrows: "",
28867
28860
  strokeWidth: 2
28868
28861
  };
28862
+ change = (() => {
28863
+ var _this = this;
28864
+ return function () {
28865
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
28866
+ args[_key] = arguments[_key];
28867
+ }
28868
+ return perseus.Changeable.change.apply(_this, args);
28869
+ };
28870
+ })();
28871
+ serialize = () => {
28872
+ return perseus.EditorJsonify.serialize.call(this);
28873
+ };
28869
28874
  render() {
28870
28875
  const {
28871
28876
  TeX
28872
- } = getDependencies();
28877
+ } = getDependencies$6();
28873
28878
  const analyticsStub = {
28874
28879
  onAnalyticsEvent: () => Promise.resolve()
28875
28880
  };
@@ -28877,98 +28882,60 @@ class LineEditor extends React__namespace.Component {
28877
28882
  className: "graph-settings"
28878
28883
  }, /*#__PURE__*/React__namespace.createElement("div", {
28879
28884
  className: "perseus-widget-row"
28880
- }, "Start: ", /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large("), /*#__PURE__*/React__namespace.createElement(MathInput, {
28885
+ }, "Start: ", /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large("), /*#__PURE__*/React__namespace.createElement(MathInput$6, {
28881
28886
  buttonsVisible: "never",
28882
- value: this.props.startX
28883
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28884
- ,
28887
+ value: this.props.startX,
28885
28888
  onChange: this.change("startX"),
28886
28889
  analytics: analyticsStub
28887
- }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput, {
28890
+ }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput$6, {
28888
28891
  buttonsVisible: "never",
28889
- value: this.props.startY
28890
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28891
- ,
28892
+ value: this.props.startY,
28892
28893
  onChange: this.change("startY"),
28893
28894
  analytics: analyticsStub
28894
28895
  }), /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React__namespace.createElement("div", {
28895
28896
  className: "perseus-widget-row"
28896
- }, "End: ", /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large("), /*#__PURE__*/React__namespace.createElement(MathInput, {
28897
+ }, "End: ", /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large("), /*#__PURE__*/React__namespace.createElement(MathInput$6, {
28897
28898
  buttonsVisible: "never",
28898
- value: this.props.endX
28899
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28900
- ,
28899
+ value: this.props.endX,
28901
28900
  onChange: this.change("endX"),
28902
28901
  analytics: analyticsStub
28903
- }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput, {
28902
+ }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput$6, {
28904
28903
  buttonsVisible: "never",
28905
- value: this.props.endY
28906
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28907
- ,
28904
+ value: this.props.endY,
28908
28905
  onChange: this.change("endY"),
28909
28906
  analytics: analyticsStub
28910
28907
  }), /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React__namespace.createElement("div", {
28911
28908
  className: "perseus-widget-row"
28912
28909
  }, /*#__PURE__*/React__namespace.createElement(perseus.ColorPicker, {
28913
- value: this.props.color
28914
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28915
- ,
28910
+ value: this.props.color,
28916
28911
  onChange: this.change("color")
28917
28912
  })), /*#__PURE__*/React__namespace.createElement("div", {
28918
28913
  className: "perseus-widget-row"
28919
28914
  }, /*#__PURE__*/React__namespace.createElement(perseus.DashPicker, {
28920
- value: this.props.strokeDasharray
28921
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28922
- ,
28915
+ value: this.props.strokeDasharray,
28923
28916
  onChange: this.change("strokeDasharray")
28924
28917
  }), "\xA0 \xA0", /*#__PURE__*/React__namespace.createElement(perseus.ArrowPicker, {
28925
- value: this.props.arrows
28926
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28927
- ,
28918
+ value: this.props.arrows,
28928
28919
  onChange: this.change("arrows")
28929
28920
  })), /*#__PURE__*/React__namespace.createElement("div", {
28930
28921
  className: "perseus-widget-row"
28931
28922
  }, /*#__PURE__*/React__namespace.createElement("div", {
28932
28923
  className: "perseus-widget-left-col"
28933
- }, "Width:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$b, {
28924
+ }, "Width:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$f, {
28934
28925
  value: this.props.strokeWidth,
28935
- placeholder: 2
28936
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28937
- ,
28926
+ placeholder: 2,
28938
28927
  onChange: this.change("strokeWidth")
28939
28928
  }))));
28940
28929
  }
28941
- change = (() => {
28942
- var _this2 = this;
28943
- return function () {
28944
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
28945
- args[_key2] = arguments[_key2];
28946
- }
28947
- return perseus.Changeable.change.apply(_this2, args);
28948
- };
28949
- })();
28950
- serialize = () => {
28951
- return perseus.EditorJsonify.serialize.call(this);
28952
- };
28953
28930
  }
28954
- //
28955
- // Editor for interactive movable points
28956
- //
28957
- // TODO(eater): Factor this out
28958
- // TODO(eater): Rethink how constraints are represented
28959
- //
28960
- class MovablePointEditor extends React__namespace.Component {
28961
- static propTypes = {
28962
- ...perseus.Changeable.propTypes,
28963
- startX: PropTypes__default["default"].string,
28964
- startY: PropTypes__default["default"].string,
28965
- constraint: PropTypes__default["default"].string,
28966
- snap: PropTypes__default["default"].number,
28967
- constraintFn: PropTypes__default["default"].string
28968
- };
28931
+
28932
+ const {
28933
+ ButtonGroup: ButtonGroup$2,
28934
+ MathInput: MathInput$5,
28935
+ NumberInput: NumberInput$e
28936
+ } = perseus.components;
28937
+ class ConstraintEditor extends React__namespace.Component {
28969
28938
  static defaultProps = {
28970
- startX: "0",
28971
- startY: "0",
28972
28939
  constraint: "none",
28973
28940
  snap: 0.5,
28974
28941
  constraintFn: "0",
@@ -28977,48 +28944,98 @@ class MovablePointEditor extends React__namespace.Component {
28977
28944
  constraintYMin: "-10",
28978
28945
  constraintYMax: "10"
28979
28946
  };
28947
+ change = propName => {
28948
+ return perseus.Changeable.change.call(this, propName);
28949
+ };
28980
28950
  render() {
28981
28951
  const {
28982
28952
  TeX
28983
- } = getDependencies();
28953
+ } = perseus.Dependencies.getDependencies();
28984
28954
  const analyticsStub = {
28985
28955
  onAnalyticsEvent: () => Promise.resolve()
28986
28956
  };
28987
- return /*#__PURE__*/React__namespace.createElement("div", {
28957
+ return /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("div", {
28958
+ className: "perseus-widget-row"
28959
+ }, "Constraint:", " ", /*#__PURE__*/React__namespace.createElement(ButtonGroup$2, {
28960
+ value: this.props.constraint,
28961
+ allowEmpty: false,
28962
+ buttons: [{
28963
+ value: "none",
28964
+ content: "None"
28965
+ }, {
28966
+ value: "snap",
28967
+ content: "Snap"
28968
+ }, {
28969
+ value: "x",
28970
+ content: "x="
28971
+ }, {
28972
+ value: "y",
28973
+ content: "y="
28974
+ }],
28975
+ onChange: this.change("constraint")
28976
+ })), this.props.constraint === "snap" && /*#__PURE__*/React__namespace.createElement("div", {
28977
+ className: "perseus-widget-row"
28978
+ }, "Snap:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$e, {
28979
+ value: this.props.snap,
28980
+ placeholder: 0,
28981
+ onChange: this.change("snap")
28982
+ })), this.props.constraint === "x" && /*#__PURE__*/React__namespace.createElement("div", {
28988
28983
  className: "graph-settings"
28989
28984
  }, /*#__PURE__*/React__namespace.createElement("div", {
28990
28985
  className: "perseus-widget-row"
28991
- }, "Start: ", /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large("), /*#__PURE__*/React__namespace.createElement(MathInput, {
28986
+ }, /*#__PURE__*/React__namespace.createElement(TeX, null, "x="), " ", /*#__PURE__*/React__namespace.createElement(MathInput$5, {
28992
28987
  buttonsVisible: "never",
28993
- value: this.props.startX,
28994
- onChange: this.change("startX"),
28988
+ value: this.props.constraintFn,
28989
+ onChange: this.change("constraintFn"),
28995
28990
  analytics: analyticsStub
28996
- }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput, {
28991
+ }))), this.props.constraint === "y" && /*#__PURE__*/React__namespace.createElement("div", {
28992
+ className: "graph-settings"
28993
+ }, /*#__PURE__*/React__namespace.createElement("div", {
28994
+ className: "perseus-widget-row"
28995
+ }, /*#__PURE__*/React__namespace.createElement(TeX, null, "y="), " ", /*#__PURE__*/React__namespace.createElement(MathInput$5, {
28997
28996
  buttonsVisible: "never",
28998
- value: this.props.startY,
28999
- onChange: this.change("startY"),
28997
+ value: this.props.constraintFn,
28998
+ onChange: this.change("constraintFn"),
29000
28999
  analytics: analyticsStub
29001
- }), /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React__namespace.createElement("div", {
29000
+ }))), "Ensure these are set so nothing can be dragged off the canvas:", /*#__PURE__*/React__namespace.createElement("div", {
29002
29001
  className: "perseus-widget-row"
29003
- }, "Update ", /*#__PURE__*/React__namespace.createElement(TeX, null, "(x_n, y_n)"), " for ", /*#__PURE__*/React__namespace.createElement(TeX, null, "n ="), " ", /*#__PURE__*/React__namespace.createElement(NumberInput$b, {
29004
- value: this.props.varSubscript,
29005
- placeholder: 0,
29006
- onChange: this.change("varSubscript")
29007
- })), /*#__PURE__*/React__namespace.createElement(ConstraintEditor, this.props));
29002
+ }, /*#__PURE__*/React__namespace.createElement("div", {
29003
+ className: "perseus-widget-row"
29004
+ }, /*#__PURE__*/React__namespace.createElement(TeX, null, "x \\in \\Large["), " ", /*#__PURE__*/React__namespace.createElement(MathInput$5, {
29005
+ buttonsVisible: "never",
29006
+ value: this.props.constraintXMin,
29007
+ onChange: this.change("constraintXMin"),
29008
+ analytics: analyticsStub
29009
+ }), /*#__PURE__*/React__namespace.createElement(TeX, null, ", "), " ", /*#__PURE__*/React__namespace.createElement(MathInput$5, {
29010
+ buttonsVisible: "never",
29011
+ value: this.props.constraintXMax,
29012
+ onChange: this.change("constraintXMax"),
29013
+ analytics: analyticsStub
29014
+ }), " ", /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large]"))), /*#__PURE__*/React__namespace.createElement("div", {
29015
+ className: "perseus-widget-row"
29016
+ }, /*#__PURE__*/React__namespace.createElement("div", {
29017
+ className: "perseus-widget-row"
29018
+ }, /*#__PURE__*/React__namespace.createElement(TeX, null, "y \\in \\Large["), " ", /*#__PURE__*/React__namespace.createElement(MathInput$5, {
29019
+ buttonsVisible: "never",
29020
+ value: this.props.constraintYMin,
29021
+ onChange: this.change("constraintYMin"),
29022
+ analytics: analyticsStub
29023
+ }), /*#__PURE__*/React__namespace.createElement(TeX, null, ", "), " ", /*#__PURE__*/React__namespace.createElement(MathInput$5, {
29024
+ buttonsVisible: "never",
29025
+ value: this.props.constraintYMax,
29026
+ onChange: this.change("constraintYMax"),
29027
+ analytics: analyticsStub
29028
+ }), " ", /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large]"))));
29008
29029
  }
29009
- change = (() => {
29010
- var _this3 = this;
29011
- return function () {
29012
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
29013
- args[_key3] = arguments[_key3];
29014
- }
29015
- return perseus.Changeable.change.apply(_this3, args);
29016
- };
29017
- })();
29018
- serialize = () => {
29019
- return perseus.EditorJsonify.serialize.call(this);
29020
- };
29021
29030
  }
29031
+
29032
+ const {
29033
+ MathInput: MathInput$4,
29034
+ NumberInput: NumberInput$d
29035
+ } = perseus.components;
29036
+ const {
29037
+ getDependencies: getDependencies$5
29038
+ } = perseus.Dependencies;
29022
29039
  //
29023
29040
  // Editor for interactive movable line segments
29024
29041
  //
@@ -29049,10 +29066,22 @@ class MovableLineEditor extends React__namespace.Component {
29049
29066
  constraintYMin: "-10",
29050
29067
  constraintYMax: "10"
29051
29068
  };
29069
+ change = (() => {
29070
+ var _this = this;
29071
+ return function () {
29072
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
29073
+ args[_key] = arguments[_key];
29074
+ }
29075
+ return perseus.Changeable.change.apply(_this, args);
29076
+ };
29077
+ })();
29078
+ serialize = () => {
29079
+ return perseus.EditorJsonify.serialize.call(this);
29080
+ };
29052
29081
  render() {
29053
29082
  const {
29054
29083
  TeX
29055
- } = getDependencies();
29084
+ } = getDependencies$5();
29056
29085
  const analyticsStub = {
29057
29086
  onAnalyticsEvent: () => Promise.resolve()
29058
29087
  };
@@ -29060,37 +29089,37 @@ class MovableLineEditor extends React__namespace.Component {
29060
29089
  className: "graph-settings"
29061
29090
  }, "Initial position:", /*#__PURE__*/React__namespace.createElement("div", {
29062
29091
  className: "perseus-widget-row"
29063
- }, "Start: ", /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large("), /*#__PURE__*/React__namespace.createElement(MathInput, {
29092
+ }, "Start: ", /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large("), /*#__PURE__*/React__namespace.createElement(MathInput$4, {
29064
29093
  buttonsVisible: "never",
29065
29094
  value: this.props.startX,
29066
29095
  onChange: this.change("startX"),
29067
29096
  analytics: analyticsStub
29068
- }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput, {
29097
+ }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput$4, {
29069
29098
  buttonsVisible: "never",
29070
29099
  value: this.props.startY,
29071
29100
  onChange: this.change("startY"),
29072
29101
  analytics: analyticsStub
29073
29102
  }), /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React__namespace.createElement("div", {
29074
29103
  className: "perseus-widget-row"
29075
- }, "End: ", /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large("), /*#__PURE__*/React__namespace.createElement(MathInput, {
29104
+ }, "End: ", /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large("), /*#__PURE__*/React__namespace.createElement(MathInput$4, {
29076
29105
  buttonsVisible: "never",
29077
29106
  value: this.props.endX,
29078
29107
  onChange: this.change("endX"),
29079
29108
  analytics: analyticsStub
29080
- }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput, {
29109
+ }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput$4, {
29081
29110
  buttonsVisible: "never",
29082
29111
  value: this.props.endY,
29083
29112
  onChange: this.change("endY"),
29084
29113
  analytics: analyticsStub
29085
29114
  }), /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React__namespace.createElement("div", {
29086
29115
  className: "perseus-widget-row"
29087
- }, "Start updates ", /*#__PURE__*/React__namespace.createElement(TeX, null, "(x_n, y_n)"), " for ", /*#__PURE__*/React__namespace.createElement(TeX, null, "n ="), /*#__PURE__*/React__namespace.createElement(NumberInput$b, {
29116
+ }, "Start updates ", /*#__PURE__*/React__namespace.createElement(TeX, null, "(x_n, y_n)"), " for ", /*#__PURE__*/React__namespace.createElement(TeX, null, "n ="), /*#__PURE__*/React__namespace.createElement(NumberInput$d, {
29088
29117
  value: this.props.startSubscript,
29089
29118
  placeholder: 0,
29090
29119
  onChange: this.change("startSubscript")
29091
29120
  })), /*#__PURE__*/React__namespace.createElement("div", {
29092
29121
  className: "perseus-widget-row"
29093
- }, "End updates ", /*#__PURE__*/React__namespace.createElement(TeX, null, "(x_m, y_m)"), " for ", /*#__PURE__*/React__namespace.createElement(TeX, null, "m ="), /*#__PURE__*/React__namespace.createElement(NumberInput$b, {
29122
+ }, "End updates ", /*#__PURE__*/React__namespace.createElement(TeX, null, "(x_m, y_m)"), " for ", /*#__PURE__*/React__namespace.createElement(TeX, null, "m ="), /*#__PURE__*/React__namespace.createElement(NumberInput$d, {
29094
29123
  value: this.props.endSubscript,
29095
29124
  placeholder: 0,
29096
29125
  onChange: this.change("endSubscript")
@@ -29098,46 +29127,57 @@ class MovableLineEditor extends React__namespace.Component {
29098
29127
  className: "perseus-widget-row"
29099
29128
  }, "All constraints are applied to the start point."), /*#__PURE__*/React__namespace.createElement(ConstraintEditor, this.props));
29100
29129
  }
29101
- change = (() => {
29102
- var _this4 = this;
29103
- return function () {
29104
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
29105
- args[_key4] = arguments[_key4];
29106
- }
29107
- return perseus.Changeable.change.apply(_this4, args);
29108
- };
29109
- })();
29110
- serialize = () => {
29111
- return perseus.EditorJsonify.serialize.call(this);
29112
- };
29113
29130
  }
29131
+
29132
+ const {
29133
+ MathInput: MathInput$3,
29134
+ NumberInput: NumberInput$c
29135
+ } = perseus.components;
29136
+ const {
29137
+ getDependencies: getDependencies$4
29138
+ } = perseus.Dependencies;
29114
29139
  //
29115
- // Editor for function plots
29140
+ // Editor for interactive movable points
29116
29141
  //
29117
29142
  // TODO(eater): Factor this out
29143
+ // TODO(eater): Rethink how constraints are represented
29118
29144
  //
29119
- class FunctionEditor extends React__namespace.Component {
29145
+ class MovablePointEditor extends React__namespace.Component {
29120
29146
  static propTypes = {
29121
29147
  ...perseus.Changeable.propTypes,
29122
- value: PropTypes__default["default"].string,
29123
- rangeMin: PropTypes__default["default"].string,
29124
- rangeMax: PropTypes__default["default"].string,
29125
- color: PropTypes__default["default"].string,
29126
- strokeDashArray: PropTypes__default["default"].string,
29127
- strokeWidth: PropTypes__default["default"].number
29148
+ startX: PropTypes__default["default"].string,
29149
+ startY: PropTypes__default["default"].string,
29150
+ constraint: PropTypes__default["default"].string,
29151
+ snap: PropTypes__default["default"].number,
29152
+ constraintFn: PropTypes__default["default"].string
29128
29153
  };
29129
29154
  static defaultProps = {
29130
- value: "x",
29131
- rangeMin: "-10",
29132
- rangeMax: "10",
29133
- color: perseus.KhanColors.BLUE,
29134
- strokeDasharray: "",
29135
- strokeWidth: 2
29155
+ startX: "0",
29156
+ startY: "0",
29157
+ constraint: "none",
29158
+ snap: 0.5,
29159
+ constraintFn: "0",
29160
+ constraintXMin: "-10",
29161
+ constraintXMax: "10",
29162
+ constraintYMin: "-10",
29163
+ constraintYMax: "10"
29164
+ };
29165
+ change = (() => {
29166
+ var _this = this;
29167
+ return function () {
29168
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
29169
+ args[_key] = arguments[_key];
29170
+ }
29171
+ return perseus.Changeable.change.apply(_this, args);
29172
+ };
29173
+ })();
29174
+ serialize = () => {
29175
+ return perseus.EditorJsonify.serialize.call(this);
29136
29176
  };
29137
29177
  render() {
29138
29178
  const {
29139
29179
  TeX
29140
- } = getDependencies();
29180
+ } = getDependencies$4();
29141
29181
  const analyticsStub = {
29142
29182
  onAnalyticsEvent: () => Promise.resolve()
29143
29183
  };
@@ -29145,68 +29185,33 @@ class FunctionEditor extends React__namespace.Component {
29145
29185
  className: "graph-settings"
29146
29186
  }, /*#__PURE__*/React__namespace.createElement("div", {
29147
29187
  className: "perseus-widget-row"
29148
- }, /*#__PURE__*/React__namespace.createElement(TeX, null, this.props.funcName + "(x)="), " ", /*#__PURE__*/React__namespace.createElement(MathInput, {
29188
+ }, "Start: ", /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large("), /*#__PURE__*/React__namespace.createElement(MathInput$3, {
29149
29189
  buttonsVisible: "never",
29150
- value: this.props.value
29151
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29152
- ,
29153
- onChange: this.change("value"),
29154
- analytics: analyticsStub
29155
- })), /*#__PURE__*/React__namespace.createElement("div", {
29156
- className: "perseus-widget-row"
29157
- }, "Range: ", /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large("), /*#__PURE__*/React__namespace.createElement(MathInput, {
29158
- buttonsVisible: "never",
29159
- value: this.props.rangeMin
29160
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29161
- ,
29162
- onChange: this.change("rangeMin"),
29190
+ value: this.props.startX,
29191
+ onChange: this.change("startX"),
29163
29192
  analytics: analyticsStub
29164
- }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput, {
29193
+ }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput$3, {
29165
29194
  buttonsVisible: "never",
29166
- value: this.props.rangeMax
29167
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29168
- ,
29169
- onChange: this.change("rangeMax"),
29195
+ value: this.props.startY,
29196
+ onChange: this.change("startY"),
29170
29197
  analytics: analyticsStub
29171
29198
  }), /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React__namespace.createElement("div", {
29172
29199
  className: "perseus-widget-row"
29173
- }, /*#__PURE__*/React__namespace.createElement(perseus.ColorPicker, {
29174
- value: this.props.color
29175
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29176
- ,
29177
- onChange: this.change("color")
29178
- })), /*#__PURE__*/React__namespace.createElement("div", {
29179
- className: "perseus-widget-row"
29180
- }, /*#__PURE__*/React__namespace.createElement(perseus.DashPicker, {
29181
- value: this.props.strokeDasharray
29182
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29183
- ,
29184
- onChange: this.change("strokeDasharray")
29185
- })), /*#__PURE__*/React__namespace.createElement("div", {
29186
- className: "perseus-widget-row"
29187
- }, /*#__PURE__*/React__namespace.createElement("div", {
29188
- className: "perseus-widget-left-col"
29189
- }, "Width:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$b, {
29190
- value: this.props.strokeWidth,
29191
- placeholder: 2
29192
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29193
- ,
29194
- onChange: this.change("strokeWidth")
29195
- }))));
29200
+ }, "Update ", /*#__PURE__*/React__namespace.createElement(TeX, null, "(x_n, y_n)"), " for ", /*#__PURE__*/React__namespace.createElement(TeX, null, "n ="), " ", /*#__PURE__*/React__namespace.createElement(NumberInput$c, {
29201
+ value: this.props.varSubscript,
29202
+ placeholder: 0,
29203
+ onChange: this.change("varSubscript")
29204
+ })), /*#__PURE__*/React__namespace.createElement(ConstraintEditor, this.props));
29196
29205
  }
29197
- change = (() => {
29198
- var _this5 = this;
29199
- return function () {
29200
- for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
29201
- args[_key5] = arguments[_key5];
29202
- }
29203
- return perseus.Changeable.change.apply(_this5, args);
29204
- };
29205
- })();
29206
- serialize = () => {
29207
- return perseus.EditorJsonify.serialize.call(this);
29208
- };
29209
29206
  }
29207
+
29208
+ const {
29209
+ MathInput: MathInput$2,
29210
+ NumberInput: NumberInput$b
29211
+ } = perseus.components;
29212
+ const {
29213
+ getDependencies: getDependencies$3
29214
+ } = perseus.Dependencies;
29210
29215
  //
29211
29216
  // Editor for parametric plots
29212
29217
  //
@@ -29232,10 +29237,22 @@ class ParametricEditor extends React__namespace.Component {
29232
29237
  strokeDasharray: "",
29233
29238
  strokeWidth: 2
29234
29239
  };
29240
+ change = (() => {
29241
+ var _this = this;
29242
+ return function () {
29243
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
29244
+ args[_key] = arguments[_key];
29245
+ }
29246
+ return perseus.Changeable.change.apply(_this, args);
29247
+ };
29248
+ })();
29249
+ serialize = () => {
29250
+ return perseus.EditorJsonify.serialize.call(this);
29251
+ };
29235
29252
  render() {
29236
29253
  const {
29237
29254
  TeX
29238
- } = getDependencies();
29255
+ } = getDependencies$3();
29239
29256
  const analyticsStub = {
29240
29257
  onAnalyticsEvent: () => Promise.resolve()
29241
29258
  };
@@ -29243,51 +29260,39 @@ class ParametricEditor extends React__namespace.Component {
29243
29260
  className: "graph-settings"
29244
29261
  }, /*#__PURE__*/React__namespace.createElement("div", {
29245
29262
  className: "perseus-widget-row"
29246
- }, /*#__PURE__*/React__namespace.createElement(TeX, null, "X(t) ="), " ", /*#__PURE__*/React__namespace.createElement(MathInput, {
29263
+ }, /*#__PURE__*/React__namespace.createElement(TeX, null, "X(t) ="), " ", /*#__PURE__*/React__namespace.createElement(MathInput$2, {
29247
29264
  buttonsVisible: "never",
29248
- value: this.props.x
29249
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29250
- ,
29265
+ value: this.props.x,
29251
29266
  onChange: this.change("x"),
29252
29267
  analytics: analyticsStub
29253
29268
  })), /*#__PURE__*/React__namespace.createElement("div", {
29254
29269
  className: "perseus-widget-row"
29255
- }, /*#__PURE__*/React__namespace.createElement(TeX, null, "Y(t) ="), " ", /*#__PURE__*/React__namespace.createElement(MathInput, {
29270
+ }, /*#__PURE__*/React__namespace.createElement(TeX, null, "Y(t) ="), " ", /*#__PURE__*/React__namespace.createElement(MathInput$2, {
29256
29271
  buttonsVisible: "never",
29257
- value: this.props.y
29258
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29259
- ,
29272
+ value: this.props.y,
29260
29273
  onChange: this.change("y"),
29261
29274
  analytics: analyticsStub
29262
29275
  })), /*#__PURE__*/React__namespace.createElement("div", {
29263
29276
  className: "perseus-widget-row"
29264
- }, "Range: ", /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large("), /*#__PURE__*/React__namespace.createElement(MathInput, {
29277
+ }, "Range: ", /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large("), /*#__PURE__*/React__namespace.createElement(MathInput$2, {
29265
29278
  buttonsVisible: "never",
29266
- value: this.props.rangeMin
29267
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29268
- ,
29279
+ value: this.props.rangeMin,
29269
29280
  onChange: this.change("rangeMin"),
29270
29281
  analytics: analyticsStub
29271
- }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput, {
29282
+ }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput$2, {
29272
29283
  buttonsVisible: "never",
29273
- value: this.props.rangeMax
29274
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29275
- ,
29284
+ value: this.props.rangeMax,
29276
29285
  onChange: this.change("rangeMax"),
29277
29286
  analytics: analyticsStub
29278
29287
  }), /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React__namespace.createElement("div", {
29279
29288
  className: "perseus-widget-row"
29280
29289
  }, /*#__PURE__*/React__namespace.createElement(perseus.ColorPicker, {
29281
- value: this.props.color
29282
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29283
- ,
29290
+ value: this.props.color,
29284
29291
  onChange: this.change("color")
29285
29292
  })), /*#__PURE__*/React__namespace.createElement("div", {
29286
29293
  className: "perseus-widget-row"
29287
29294
  }, /*#__PURE__*/React__namespace.createElement(perseus.DashPicker, {
29288
- value: this.props.strokeDasharray
29289
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29290
- ,
29295
+ value: this.props.strokeDasharray,
29291
29296
  onChange: this.change("strokeDasharray")
29292
29297
  })), /*#__PURE__*/React__namespace.createElement("div", {
29293
29298
  className: "perseus-widget-row"
@@ -29295,49 +29300,51 @@ class ParametricEditor extends React__namespace.Component {
29295
29300
  className: "perseus-widget-left-col"
29296
29301
  }, "Width:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$b, {
29297
29302
  value: this.props.strokeWidth,
29298
- placeholder: 2
29299
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29300
- ,
29303
+ placeholder: 2,
29301
29304
  onChange: this.change("strokeWidth")
29302
29305
  }))));
29303
29306
  }
29304
- change = (() => {
29305
- var _this6 = this;
29306
- return function () {
29307
- for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
29308
- args[_key6] = arguments[_key6];
29309
- }
29310
- return perseus.Changeable.change.apply(_this6, args);
29311
- };
29312
- })();
29313
- serialize = () => {
29314
- return perseus.EditorJsonify.serialize.call(this);
29315
- };
29316
29307
  }
29308
+
29309
+ const {
29310
+ MathInput: MathInput$1
29311
+ } = perseus.components;
29312
+ const {
29313
+ getDependencies: getDependencies$2
29314
+ } = perseus.Dependencies;
29317
29315
  //
29318
- // Editor for labels
29316
+ // Editor for non-interactive points
29319
29317
  //
29320
- // TODO(eater): Factor this out maybe?
29321
- // TODO(eater): Add text direction
29318
+ // TODO(eater): Factor this out
29322
29319
  //
29323
- class LabelEditor extends React__namespace.Component {
29320
+ class PointEditor extends React__namespace.Component {
29324
29321
  static propTypes = {
29325
29322
  ...perseus.Changeable.propTypes,
29326
- color: PropTypes__default["default"].string,
29327
29323
  coordX: PropTypes__default["default"].string,
29328
29324
  coordY: PropTypes__default["default"].string,
29329
- label: PropTypes__default["default"].string
29325
+ color: PropTypes__default["default"].string
29330
29326
  };
29331
29327
  static defaultProps = {
29332
29328
  coordX: "0",
29333
29329
  coordY: "0",
29334
- color: perseus.KhanColors.BLACK,
29335
- label: "\\phi"
29330
+ color: perseus.KhanColors.BLACK
29331
+ };
29332
+ change = (() => {
29333
+ var _this = this;
29334
+ return function () {
29335
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
29336
+ args[_key] = arguments[_key];
29337
+ }
29338
+ return perseus.Changeable.change.apply(_this, args);
29339
+ };
29340
+ })();
29341
+ serialize = () => {
29342
+ return perseus.EditorJsonify.serialize.call(this);
29336
29343
  };
29337
29344
  render() {
29338
29345
  const {
29339
29346
  TeX
29340
- } = getDependencies();
29347
+ } = getDependencies$2();
29341
29348
  const analyticsStub = {
29342
29349
  onAnalyticsEvent: () => Promise.resolve()
29343
29350
  };
@@ -29345,52 +29352,31 @@ class LabelEditor extends React__namespace.Component {
29345
29352
  className: "graph-settings"
29346
29353
  }, /*#__PURE__*/React__namespace.createElement("div", {
29347
29354
  className: "perseus-widget-row"
29348
- }, /*#__PURE__*/React__namespace.createElement(TextInput$5, {
29349
- value: this.props.label
29350
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29351
- ,
29352
- onChange: this.change("label"),
29353
- style: {
29354
- width: "100%"
29355
- }
29356
- })), /*#__PURE__*/React__namespace.createElement("div", {
29357
- className: "perseus-widget-row"
29358
- }, "Location: ", /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large("), /*#__PURE__*/React__namespace.createElement(MathInput, {
29355
+ }, "Coordinate: ", /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large("), /*#__PURE__*/React__namespace.createElement(MathInput$1, {
29359
29356
  buttonsVisible: "never",
29360
- value: this.props.coordX
29361
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29362
- ,
29357
+ value: this.props.coordX,
29363
29358
  onChange: this.change("coordX"),
29364
29359
  analytics: analyticsStub
29365
- }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput, {
29360
+ }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput$1, {
29366
29361
  buttonsVisible: "never",
29367
- value: this.props.coordY
29368
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29369
- ,
29362
+ value: this.props.coordY,
29370
29363
  onChange: this.change("coordY"),
29371
29364
  analytics: analyticsStub
29372
29365
  }), /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React__namespace.createElement("div", {
29373
29366
  className: "perseus-widget-row"
29374
29367
  }, /*#__PURE__*/React__namespace.createElement(perseus.ColorPicker, {
29375
- value: this.props.color
29376
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29377
- ,
29368
+ value: this.props.color,
29378
29369
  onChange: this.change("color")
29379
29370
  })));
29380
29371
  }
29381
- change = (() => {
29382
- var _this7 = this;
29383
- return function () {
29384
- for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
29385
- args[_key7] = arguments[_key7];
29386
- }
29387
- return perseus.Changeable.change.apply(_this7, args);
29388
- };
29389
- })();
29390
- serialize = () => {
29391
- return perseus.EditorJsonify.serialize.call(this);
29392
- };
29393
29372
  }
29373
+
29374
+ const {
29375
+ MathInput
29376
+ } = perseus.components;
29377
+ const {
29378
+ getDependencies: getDependencies$1
29379
+ } = perseus.Dependencies;
29394
29380
  //
29395
29381
  // Editor for rectangles
29396
29382
  //
@@ -29412,10 +29398,22 @@ class RectangleEditor extends React__namespace.Component {
29412
29398
  height: "3",
29413
29399
  color: perseus.KhanColors.LIGHT_BLUE
29414
29400
  };
29401
+ change = (() => {
29402
+ var _this = this;
29403
+ return function () {
29404
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
29405
+ args[_key] = arguments[_key];
29406
+ }
29407
+ return perseus.Changeable.change.apply(_this, args);
29408
+ };
29409
+ })();
29410
+ serialize = () => {
29411
+ return perseus.EditorJsonify.serialize.call(this);
29412
+ };
29415
29413
  render() {
29416
29414
  const {
29417
29415
  TeX
29418
- } = getDependencies();
29416
+ } = getDependencies$1();
29419
29417
  const analyticsStub = {
29420
29418
  onAnalyticsEvent: () => Promise.resolve()
29421
29419
  };
@@ -29425,61 +29423,57 @@ class RectangleEditor extends React__namespace.Component {
29425
29423
  className: "perseus-widget-row"
29426
29424
  }, "Bottom left: ", /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large("), /*#__PURE__*/React__namespace.createElement(MathInput, {
29427
29425
  buttonsVisible: "never",
29428
- value: this.props.coordX
29429
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29430
- ,
29426
+ value: this.props.coordX,
29431
29427
  onChange: this.change("coordX"),
29432
29428
  analytics: analyticsStub
29433
29429
  }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput, {
29434
29430
  buttonsVisible: "never",
29435
- value: this.props.coordY
29436
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29437
- ,
29431
+ value: this.props.coordY,
29438
29432
  onChange: this.change("coordY"),
29439
29433
  analytics: analyticsStub
29440
29434
  }), /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React__namespace.createElement("div", {
29441
29435
  className: "perseus-widget-row"
29442
29436
  }, "Width:", " ", /*#__PURE__*/React__namespace.createElement(MathInput, {
29443
29437
  buttonsVisible: "never",
29444
- value: this.props.width
29445
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29446
- ,
29438
+ value: this.props.width,
29447
29439
  onChange: this.change("width"),
29448
29440
  analytics: analyticsStub
29449
29441
  })), /*#__PURE__*/React__namespace.createElement("div", {
29450
29442
  className: "perseus-widget-row"
29451
29443
  }, "Height:", " ", /*#__PURE__*/React__namespace.createElement(MathInput, {
29452
29444
  buttonsVisible: "never",
29453
- value: this.props.height
29454
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29455
- ,
29445
+ value: this.props.height,
29456
29446
  onChange: this.change("height"),
29457
29447
  analytics: analyticsStub
29458
29448
  })), /*#__PURE__*/React__namespace.createElement("div", {
29459
29449
  className: "perseus-widget-row"
29460
29450
  }, /*#__PURE__*/React__namespace.createElement(perseus.ColorPicker, {
29461
29451
  value: this.props.color,
29462
- lightColors: true
29463
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29464
- ,
29452
+ lightColors: true,
29465
29453
  onChange: this.change("color")
29466
29454
  })), /*#__PURE__*/React__namespace.createElement("div", {
29467
29455
  className: "perseus-widget-row"
29468
29456
  }, "You want a border? Sorry, draw your own."));
29469
29457
  }
29470
- change = (() => {
29471
- var _this8 = this;
29472
- return function () {
29473
- for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
29474
- args[_key8] = arguments[_key8];
29475
- }
29476
- return perseus.Changeable.change.apply(_this8, args);
29477
- };
29478
- })();
29479
- serialize = () => {
29480
- return perseus.EditorJsonify.serialize.call(this);
29481
- };
29482
29458
  }
29459
+
29460
+ const {
29461
+ getDependencies
29462
+ } = perseus.Dependencies;
29463
+ const {
29464
+ unescapeMathMode
29465
+ } = perseus.Util;
29466
+ const defaultInteractionProps = {
29467
+ graph: {
29468
+ box: [400, 400],
29469
+ labels: ["x", "y"],
29470
+ range: [[-10, 10], [-10, 10]],
29471
+ tickStep: [1, 1],
29472
+ gridStep: [1, 1],
29473
+ markings: "graph"
29474
+ },
29475
+ elements: []
29476
+ };
29483
29477
  class InteractionEditor extends React__namespace.Component {
29484
29478
  // TODO(eater): Make more better
29485
29479
  static propTypes = {
@@ -29586,14 +29580,17 @@ class InteractionEditor extends React__namespace.Component {
29586
29580
  });
29587
29581
  };
29588
29582
  change = (() => {
29589
- var _this9 = this;
29583
+ var _this = this;
29590
29584
  return function () {
29591
- for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
29592
- args[_key9] = arguments[_key9];
29585
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
29586
+ args[_key] = arguments[_key];
29593
29587
  }
29594
- return perseus.Changeable.change.apply(_this9, args);
29588
+ return perseus.Changeable.change.apply(_this, args);
29595
29589
  };
29596
29590
  })();
29591
+ serialize = () => {
29592
+ return perseus.EditorJsonify.serialize.call(this);
29593
+ };
29597
29594
  render() {
29598
29595
  const {
29599
29596
  TeX
@@ -29915,10 +29912,6 @@ class InteractionEditor extends React__namespace.Component {
29915
29912
  }, "\u2605 Movable line segment"))));
29916
29913
  /* eslint-enable max-len */
29917
29914
  }
29918
-
29919
- serialize = () => {
29920
- return perseus.EditorJsonify.serialize.call(this);
29921
- };
29922
29915
  }
29923
29916
 
29924
29917
  const UNLIMITED = "unlimited";
@@ -32625,18 +32618,24 @@ class NumberLineEditor extends React__namespace.Component {
32625
32618
  value: this.props.correctRel
32626
32619
  // @ts-expect-error - TS2322 - Type '(arg1: ChangeEvent<HTMLInputElement>) => void' is not assignable to type 'ChangeEventHandler<HTMLSelectElement>'.
32627
32620
  ,
32628
- onChange: this.onChangeRelation
32621
+ onChange: this.onChangeRelation,
32622
+ "aria-label": "Select relationship"
32629
32623
  }, /*#__PURE__*/React__namespace.createElement("option", {
32630
- value: "eq"
32631
- }, " = "), /*#__PURE__*/React__namespace.createElement("option", {
32632
- value: "lt"
32633
- }, " < "), /*#__PURE__*/React__namespace.createElement("option", {
32634
- value: "gt"
32635
- }, " > "), /*#__PURE__*/React__namespace.createElement("option", {
32636
- value: "le"
32637
- }, " \u2264 "), /*#__PURE__*/React__namespace.createElement("option", {
32638
- value: "ge"
32639
- }, " \u2265 ")), " ", /*#__PURE__*/React__namespace.createElement(NumberInput$7, {
32624
+ value: "eq",
32625
+ "aria-label": "Equal"
32626
+ }, "="), /*#__PURE__*/React__namespace.createElement("option", {
32627
+ value: "lt",
32628
+ "aria-label": "Less than"
32629
+ }, "<"), /*#__PURE__*/React__namespace.createElement("option", {
32630
+ value: "gt",
32631
+ "aria-label": "Greater than"
32632
+ }, ">"), /*#__PURE__*/React__namespace.createElement("option", {
32633
+ value: "le",
32634
+ "aria-label": "Less than or equal"
32635
+ }, "\u2264"), /*#__PURE__*/React__namespace.createElement("option", {
32636
+ value: "ge",
32637
+ "aria-label": "Greater than or equal"
32638
+ }, "\u2265")), " ", /*#__PURE__*/React__namespace.createElement(NumberInput$7, {
32640
32639
  value: this.props.correctX,
32641
32640
  format: this.props.labelStyle
32642
32641
  // eslint-disable-next-line react/jsx-no-bind
@@ -33000,11 +32999,13 @@ const NumericInputEditor = createReactClass__default["default"]({
33000
32999
  }, answer.status), /*#__PURE__*/React__namespace.createElement("a", {
33001
33000
  href: "javascript:void(0)",
33002
33001
  className: "answer-trash",
33002
+ "aria-label": "Delete answer",
33003
33003
  onClick: () => this.onTrashAnswer(i),
33004
33004
  onKeyDown: e => this.onSpace(e, this.onTrashAnswer, i)
33005
33005
  }, /*#__PURE__*/React__namespace.createElement(InlineIcon$3, iconTrash$2)), /*#__PURE__*/React__namespace.createElement("a", {
33006
33006
  href: "javascript:void(0)",
33007
33007
  className: "options-toggle",
33008
+ "aria-label": "Toggle options",
33008
33009
  onClick: () => this.onToggleOptions(i),
33009
33010
  onKeyDown: e => this.onSpace(e, this.onToggleOptions, i)
33010
33011
  }, /*#__PURE__*/React__namespace.createElement(InlineIcon$3, iconGear))), /*#__PURE__*/React__namespace.createElement("div", {