@khanacademy/perseus-editor 2.15.4 → 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 (30) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/es/index.js +329 -338
  3. package/dist/es/index.js.map +1 -1
  4. package/dist/index.js +402 -412
  5. package/dist/index.js.map +1 -1
  6. package/dist/widgets/interaction-editor/function-editor.d.ts +26 -0
  7. package/dist/widgets/interaction-editor/index.d.ts +2 -0
  8. package/dist/widgets/interaction-editor/label-editor.d.ts +22 -0
  9. package/dist/widgets/interaction-editor/line-editor.d.ts +30 -0
  10. package/dist/widgets/interaction-editor/movable-line-editor.d.ts +32 -0
  11. package/dist/widgets/interaction-editor/movable-point-editor.d.ts +28 -0
  12. package/dist/widgets/interaction-editor/parametric-editor.d.ts +28 -0
  13. package/dist/widgets/interaction-editor/point-editor.d.ts +20 -0
  14. package/dist/widgets/interaction-editor/rectangle-editor.d.ts +24 -0
  15. package/package.json +2 -2
  16. package/src/widgets/__stories__/interaction-editor.stories.tsx +24 -0
  17. package/src/widgets/interaction-editor/function-editor.tsx +111 -0
  18. package/src/widgets/interaction-editor/index.ts +3 -0
  19. package/src/widgets/{interaction-editor.tsx → interaction-editor/interaction-editor.tsx} +14 -768
  20. package/src/widgets/interaction-editor/label-editor.tsx +91 -0
  21. package/src/widgets/interaction-editor/line-editor.tsx +129 -0
  22. package/src/widgets/interaction-editor/movable-line-editor.tsx +125 -0
  23. package/src/widgets/interaction-editor/movable-point-editor.tsx +92 -0
  24. package/src/widgets/interaction-editor/parametric-editor.tsx +122 -0
  25. package/src/widgets/interaction-editor/point-editor.tsx +79 -0
  26. package/src/widgets/interaction-editor/rectangle-editor.tsx +105 -0
  27. package/tsconfig-build.tsbuildinfo +1 -1
  28. package/dist/widgets/{interaction → interaction-editor}/constraint-editor.d.ts +0 -0
  29. package/dist/widgets/{interaction-editor.d.ts → interaction-editor/interaction-editor.d.ts} +1 -1
  30. /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.4";
67
+ const libVersion = "2.15.5";
68
68
  perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
69
69
 
70
70
  function _extends() {
@@ -27437,7 +27437,7 @@ const {
27437
27437
  RangeInput: RangeInput$5
27438
27438
  } = perseus.components;
27439
27439
  const {
27440
- getDependencies: getDependencies$1
27440
+ getDependencies: getDependencies$9
27441
27441
  } = perseus.Dependencies;
27442
27442
  const defaultBackgroundImage$3 = {
27443
27443
  url: null,
@@ -27758,7 +27758,7 @@ const GraphSettings = createReactClass__default["default"]({
27758
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]))];
27759
27759
  const {
27760
27760
  TeX
27761
- } = getDependencies$1();
27761
+ } = getDependencies$9();
27762
27762
  return /*#__PURE__*/React__namespace.createElement("div", null, ___default["default"].contains(this.props.editableSettings, "canvas") && /*#__PURE__*/React__namespace.createElement("div", {
27763
27763
  className: "graph-settings"
27764
27764
  }, /*#__PURE__*/React__namespace.createElement("div", {
@@ -28657,148 +28657,140 @@ class InputNumberEditor extends React__namespace.Component {
28657
28657
  }
28658
28658
 
28659
28659
  const {
28660
- ButtonGroup: ButtonGroup$2,
28661
- MathInput: MathInput$1,
28662
- NumberInput: NumberInput$c
28660
+ MathInput: MathInput$8,
28661
+ NumberInput: NumberInput$g
28663
28662
  } = perseus.components;
28664
- 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
+ };
28665
28681
  static defaultProps = {
28666
- constraint: "none",
28667
- snap: 0.5,
28668
- constraintFn: "0",
28669
- constraintXMin: "-10",
28670
- constraintXMax: "10",
28671
- constraintYMin: "-10",
28672
- constraintYMax: "10"
28682
+ value: "x",
28683
+ rangeMin: "-10",
28684
+ rangeMax: "10",
28685
+ color: perseus.KhanColors.BLUE,
28686
+ strokeDasharray: "",
28687
+ strokeWidth: 2
28673
28688
  };
28674
- change = propName => {
28675
- 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);
28676
28700
  };
28677
28701
  render() {
28678
28702
  const {
28679
28703
  TeX
28680
- } = perseus.Dependencies.getDependencies();
28704
+ } = getDependencies$8();
28681
28705
  const analyticsStub = {
28682
28706
  onAnalyticsEvent: () => Promise.resolve()
28683
28707
  };
28684
- return /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("div", {
28685
- className: "perseus-widget-row"
28686
- }, "Constraint:", " ", /*#__PURE__*/React__namespace.createElement(ButtonGroup$2, {
28687
- value: this.props.constraint,
28688
- allowEmpty: false,
28689
- buttons: [{
28690
- value: "none",
28691
- content: "None"
28692
- }, {
28693
- value: "snap",
28694
- content: "Snap"
28695
- }, {
28696
- value: "x",
28697
- content: "x="
28698
- }, {
28699
- value: "y",
28700
- content: "y="
28701
- }],
28702
- onChange: this.change("constraint")
28703
- })), this.props.constraint === "snap" && /*#__PURE__*/React__namespace.createElement("div", {
28704
- className: "perseus-widget-row"
28705
- }, "Snap:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$c, {
28706
- value: this.props.snap,
28707
- placeholder: 0,
28708
- onChange: this.change("snap")
28709
- })), this.props.constraint === "x" && /*#__PURE__*/React__namespace.createElement("div", {
28710
- className: "graph-settings"
28711
- }, /*#__PURE__*/React__namespace.createElement("div", {
28712
- className: "perseus-widget-row"
28713
- }, /*#__PURE__*/React__namespace.createElement(TeX, null, "x="), " ", /*#__PURE__*/React__namespace.createElement(MathInput$1, {
28714
- buttonsVisible: "never",
28715
- value: this.props.constraintFn,
28716
- onChange: this.change("constraintFn"),
28717
- analytics: analyticsStub
28718
- }))), this.props.constraint === "y" && /*#__PURE__*/React__namespace.createElement("div", {
28708
+ return /*#__PURE__*/React__namespace.createElement("div", {
28719
28709
  className: "graph-settings"
28720
28710
  }, /*#__PURE__*/React__namespace.createElement("div", {
28721
28711
  className: "perseus-widget-row"
28722
- }, /*#__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, {
28723
28713
  buttonsVisible: "never",
28724
- value: this.props.constraintFn,
28725
- onChange: this.change("constraintFn"),
28714
+ value: this.props.value,
28715
+ onChange: this.change("value"),
28726
28716
  analytics: analyticsStub
28727
- }))), "Ensure these are set so nothing can be dragged off the canvas:", /*#__PURE__*/React__namespace.createElement("div", {
28728
- className: "perseus-widget-row"
28729
- }, /*#__PURE__*/React__namespace.createElement("div", {
28717
+ })), /*#__PURE__*/React__namespace.createElement("div", {
28730
28718
  className: "perseus-widget-row"
28731
- }, /*#__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, {
28732
28720
  buttonsVisible: "never",
28733
- value: this.props.constraintXMin,
28734
- onChange: this.change("constraintXMin"),
28721
+ value: this.props.rangeMin,
28722
+ onChange: this.change("rangeMin"),
28735
28723
  analytics: analyticsStub
28736
- }), /*#__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, {
28737
28725
  buttonsVisible: "never",
28738
- value: this.props.constraintXMax,
28739
- onChange: this.change("constraintXMax"),
28726
+ value: this.props.rangeMax,
28727
+ onChange: this.change("rangeMax"),
28740
28728
  analytics: analyticsStub
28741
- }), " ", /*#__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", {
28742
28730
  className: "perseus-widget-row"
28743
- }, /*#__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", {
28744
28735
  className: "perseus-widget-row"
28745
- }, /*#__PURE__*/React__namespace.createElement(TeX, null, "y \\in \\Large["), " ", /*#__PURE__*/React__namespace.createElement(MathInput$1, {
28746
- buttonsVisible: "never",
28747
- value: this.props.constraintYMin,
28748
- onChange: this.change("constraintYMin"),
28749
- analytics: analyticsStub
28750
- }), /*#__PURE__*/React__namespace.createElement(TeX, null, ", "), " ", /*#__PURE__*/React__namespace.createElement(MathInput$1, {
28751
- buttonsVisible: "never",
28752
- value: this.props.constraintYMax,
28753
- onChange: this.change("constraintYMax"),
28754
- analytics: analyticsStub
28755
- }), " ", /*#__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
+ }))));
28756
28748
  }
28757
28749
  }
28758
28750
 
28759
28751
  const {
28760
- MathInput,
28761
- NumberInput: NumberInput$b,
28752
+ MathInput: MathInput$7,
28762
28753
  TextInput: TextInput$5
28763
28754
  } = perseus.components;
28764
28755
  const {
28765
- getDependencies
28756
+ getDependencies: getDependencies$7
28766
28757
  } = perseus.Dependencies;
28767
- const {
28768
- unescapeMathMode
28769
- } = perseus.Util;
28770
- const defaultInteractionProps = {
28771
- graph: {
28772
- box: [400, 400],
28773
- labels: ["x", "y"],
28774
- range: [[-10, 10], [-10, 10]],
28775
- tickStep: [1, 1],
28776
- gridStep: [1, 1],
28777
- markings: "graph"
28778
- },
28779
- elements: []
28780
- };
28781
28758
  //
28782
- // Editor for non-interactive points
28759
+ // Editor for labels
28783
28760
  //
28784
- // TODO(eater): Factor this out
28761
+ // TODO(eater): Factor this out maybe?
28762
+ // TODO(eater): Add text direction
28785
28763
  //
28786
- class PointEditor extends React__namespace.Component {
28764
+ class LabelEditor extends React__namespace.Component {
28787
28765
  static propTypes = {
28788
28766
  ...perseus.Changeable.propTypes,
28767
+ color: PropTypes__default["default"].string,
28789
28768
  coordX: PropTypes__default["default"].string,
28790
28769
  coordY: PropTypes__default["default"].string,
28791
- color: PropTypes__default["default"].string
28770
+ label: PropTypes__default["default"].string
28792
28771
  };
28793
28772
  static defaultProps = {
28794
28773
  coordX: "0",
28795
28774
  coordY: "0",
28796
- 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);
28797
28789
  };
28798
28790
  render() {
28799
28791
  const {
28800
28792
  TeX
28801
- } = getDependencies();
28793
+ } = getDependencies$7();
28802
28794
  const analyticsStub = {
28803
28795
  onAnalyticsEvent: () => Promise.resolve()
28804
28796
  };
@@ -28806,42 +28798,40 @@ class PointEditor extends React__namespace.Component {
28806
28798
  className: "graph-settings"
28807
28799
  }, /*#__PURE__*/React__namespace.createElement("div", {
28808
28800
  className: "perseus-widget-row"
28809
- }, "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, {
28810
28810
  buttonsVisible: "never",
28811
- value: this.props.coordX
28812
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28813
- ,
28811
+ value: this.props.coordX,
28814
28812
  onChange: this.change("coordX"),
28815
28813
  analytics: analyticsStub
28816
- }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput, {
28814
+ }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput$7, {
28817
28815
  buttonsVisible: "never",
28818
- value: this.props.coordY
28819
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28820
- ,
28816
+ value: this.props.coordY,
28821
28817
  onChange: this.change("coordY"),
28822
28818
  analytics: analyticsStub
28823
28819
  }), /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React__namespace.createElement("div", {
28824
28820
  className: "perseus-widget-row"
28825
28821
  }, /*#__PURE__*/React__namespace.createElement(perseus.ColorPicker, {
28826
- value: this.props.color
28827
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28828
- ,
28822
+ value: this.props.color,
28829
28823
  onChange: this.change("color")
28830
28824
  })));
28831
28825
  }
28832
- change = (() => {
28833
- var _this = this;
28834
- return function () {
28835
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
28836
- args[_key] = arguments[_key];
28837
- }
28838
- return perseus.Changeable.change.apply(_this, args);
28839
- };
28840
- })();
28841
- serialize = () => {
28842
- return perseus.EditorJsonify.serialize.call(this);
28843
- };
28844
28826
  }
28827
+
28828
+ const {
28829
+ MathInput: MathInput$6,
28830
+ NumberInput: NumberInput$f
28831
+ } = perseus.components;
28832
+ const {
28833
+ getDependencies: getDependencies$6
28834
+ } = perseus.Dependencies;
28845
28835
  //
28846
28836
  // Editor for non-interactive line segments
28847
28837
  //
@@ -28869,10 +28859,22 @@ class LineEditor extends React__namespace.Component {
28869
28859
  arrows: "",
28870
28860
  strokeWidth: 2
28871
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
+ };
28872
28874
  render() {
28873
28875
  const {
28874
28876
  TeX
28875
- } = getDependencies();
28877
+ } = getDependencies$6();
28876
28878
  const analyticsStub = {
28877
28879
  onAnalyticsEvent: () => Promise.resolve()
28878
28880
  };
@@ -28880,98 +28882,60 @@ class LineEditor extends React__namespace.Component {
28880
28882
  className: "graph-settings"
28881
28883
  }, /*#__PURE__*/React__namespace.createElement("div", {
28882
28884
  className: "perseus-widget-row"
28883
- }, "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, {
28884
28886
  buttonsVisible: "never",
28885
- value: this.props.startX
28886
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28887
- ,
28887
+ value: this.props.startX,
28888
28888
  onChange: this.change("startX"),
28889
28889
  analytics: analyticsStub
28890
- }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput, {
28890
+ }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput$6, {
28891
28891
  buttonsVisible: "never",
28892
- value: this.props.startY
28893
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28894
- ,
28892
+ value: this.props.startY,
28895
28893
  onChange: this.change("startY"),
28896
28894
  analytics: analyticsStub
28897
28895
  }), /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React__namespace.createElement("div", {
28898
28896
  className: "perseus-widget-row"
28899
- }, "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, {
28900
28898
  buttonsVisible: "never",
28901
- value: this.props.endX
28902
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28903
- ,
28899
+ value: this.props.endX,
28904
28900
  onChange: this.change("endX"),
28905
28901
  analytics: analyticsStub
28906
- }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput, {
28902
+ }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput$6, {
28907
28903
  buttonsVisible: "never",
28908
- value: this.props.endY
28909
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28910
- ,
28904
+ value: this.props.endY,
28911
28905
  onChange: this.change("endY"),
28912
28906
  analytics: analyticsStub
28913
28907
  }), /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React__namespace.createElement("div", {
28914
28908
  className: "perseus-widget-row"
28915
28909
  }, /*#__PURE__*/React__namespace.createElement(perseus.ColorPicker, {
28916
- value: this.props.color
28917
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28918
- ,
28910
+ value: this.props.color,
28919
28911
  onChange: this.change("color")
28920
28912
  })), /*#__PURE__*/React__namespace.createElement("div", {
28921
28913
  className: "perseus-widget-row"
28922
28914
  }, /*#__PURE__*/React__namespace.createElement(perseus.DashPicker, {
28923
- value: this.props.strokeDasharray
28924
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28925
- ,
28915
+ value: this.props.strokeDasharray,
28926
28916
  onChange: this.change("strokeDasharray")
28927
28917
  }), "\xA0 \xA0", /*#__PURE__*/React__namespace.createElement(perseus.ArrowPicker, {
28928
- value: this.props.arrows
28929
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28930
- ,
28918
+ value: this.props.arrows,
28931
28919
  onChange: this.change("arrows")
28932
28920
  })), /*#__PURE__*/React__namespace.createElement("div", {
28933
28921
  className: "perseus-widget-row"
28934
28922
  }, /*#__PURE__*/React__namespace.createElement("div", {
28935
28923
  className: "perseus-widget-left-col"
28936
- }, "Width:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$b, {
28924
+ }, "Width:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$f, {
28937
28925
  value: this.props.strokeWidth,
28938
- placeholder: 2
28939
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28940
- ,
28926
+ placeholder: 2,
28941
28927
  onChange: this.change("strokeWidth")
28942
28928
  }))));
28943
28929
  }
28944
- change = (() => {
28945
- var _this2 = this;
28946
- return function () {
28947
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
28948
- args[_key2] = arguments[_key2];
28949
- }
28950
- return perseus.Changeable.change.apply(_this2, args);
28951
- };
28952
- })();
28953
- serialize = () => {
28954
- return perseus.EditorJsonify.serialize.call(this);
28955
- };
28956
28930
  }
28957
- //
28958
- // Editor for interactive movable points
28959
- //
28960
- // TODO(eater): Factor this out
28961
- // TODO(eater): Rethink how constraints are represented
28962
- //
28963
- class MovablePointEditor extends React__namespace.Component {
28964
- static propTypes = {
28965
- ...perseus.Changeable.propTypes,
28966
- startX: PropTypes__default["default"].string,
28967
- startY: PropTypes__default["default"].string,
28968
- constraint: PropTypes__default["default"].string,
28969
- snap: PropTypes__default["default"].number,
28970
- constraintFn: PropTypes__default["default"].string
28971
- };
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 {
28972
28938
  static defaultProps = {
28973
- startX: "0",
28974
- startY: "0",
28975
28939
  constraint: "none",
28976
28940
  snap: 0.5,
28977
28941
  constraintFn: "0",
@@ -28980,48 +28944,98 @@ class MovablePointEditor extends React__namespace.Component {
28980
28944
  constraintYMin: "-10",
28981
28945
  constraintYMax: "10"
28982
28946
  };
28947
+ change = propName => {
28948
+ return perseus.Changeable.change.call(this, propName);
28949
+ };
28983
28950
  render() {
28984
28951
  const {
28985
28952
  TeX
28986
- } = getDependencies();
28953
+ } = perseus.Dependencies.getDependencies();
28987
28954
  const analyticsStub = {
28988
28955
  onAnalyticsEvent: () => Promise.resolve()
28989
28956
  };
28990
- 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", {
28991
28983
  className: "graph-settings"
28992
28984
  }, /*#__PURE__*/React__namespace.createElement("div", {
28993
28985
  className: "perseus-widget-row"
28994
- }, "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, {
28995
28987
  buttonsVisible: "never",
28996
- value: this.props.startX,
28997
- onChange: this.change("startX"),
28988
+ value: this.props.constraintFn,
28989
+ onChange: this.change("constraintFn"),
28998
28990
  analytics: analyticsStub
28999
- }), /*#__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, {
29000
28996
  buttonsVisible: "never",
29001
- value: this.props.startY,
29002
- onChange: this.change("startY"),
28997
+ value: this.props.constraintFn,
28998
+ onChange: this.change("constraintFn"),
29003
28999
  analytics: analyticsStub
29004
- }), /*#__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", {
29005
29001
  className: "perseus-widget-row"
29006
- }, "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, {
29007
- value: this.props.varSubscript,
29008
- placeholder: 0,
29009
- onChange: this.change("varSubscript")
29010
- })), /*#__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]"))));
29011
29029
  }
29012
- change = (() => {
29013
- var _this3 = this;
29014
- return function () {
29015
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
29016
- args[_key3] = arguments[_key3];
29017
- }
29018
- return perseus.Changeable.change.apply(_this3, args);
29019
- };
29020
- })();
29021
- serialize = () => {
29022
- return perseus.EditorJsonify.serialize.call(this);
29023
- };
29024
29030
  }
29031
+
29032
+ const {
29033
+ MathInput: MathInput$4,
29034
+ NumberInput: NumberInput$d
29035
+ } = perseus.components;
29036
+ const {
29037
+ getDependencies: getDependencies$5
29038
+ } = perseus.Dependencies;
29025
29039
  //
29026
29040
  // Editor for interactive movable line segments
29027
29041
  //
@@ -29052,10 +29066,22 @@ class MovableLineEditor extends React__namespace.Component {
29052
29066
  constraintYMin: "-10",
29053
29067
  constraintYMax: "10"
29054
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
+ };
29055
29081
  render() {
29056
29082
  const {
29057
29083
  TeX
29058
- } = getDependencies();
29084
+ } = getDependencies$5();
29059
29085
  const analyticsStub = {
29060
29086
  onAnalyticsEvent: () => Promise.resolve()
29061
29087
  };
@@ -29063,37 +29089,37 @@ class MovableLineEditor extends React__namespace.Component {
29063
29089
  className: "graph-settings"
29064
29090
  }, "Initial position:", /*#__PURE__*/React__namespace.createElement("div", {
29065
29091
  className: "perseus-widget-row"
29066
- }, "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, {
29067
29093
  buttonsVisible: "never",
29068
29094
  value: this.props.startX,
29069
29095
  onChange: this.change("startX"),
29070
29096
  analytics: analyticsStub
29071
- }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput, {
29097
+ }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput$4, {
29072
29098
  buttonsVisible: "never",
29073
29099
  value: this.props.startY,
29074
29100
  onChange: this.change("startY"),
29075
29101
  analytics: analyticsStub
29076
29102
  }), /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React__namespace.createElement("div", {
29077
29103
  className: "perseus-widget-row"
29078
- }, "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, {
29079
29105
  buttonsVisible: "never",
29080
29106
  value: this.props.endX,
29081
29107
  onChange: this.change("endX"),
29082
29108
  analytics: analyticsStub
29083
- }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput, {
29109
+ }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput$4, {
29084
29110
  buttonsVisible: "never",
29085
29111
  value: this.props.endY,
29086
29112
  onChange: this.change("endY"),
29087
29113
  analytics: analyticsStub
29088
29114
  }), /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React__namespace.createElement("div", {
29089
29115
  className: "perseus-widget-row"
29090
- }, "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, {
29091
29117
  value: this.props.startSubscript,
29092
29118
  placeholder: 0,
29093
29119
  onChange: this.change("startSubscript")
29094
29120
  })), /*#__PURE__*/React__namespace.createElement("div", {
29095
29121
  className: "perseus-widget-row"
29096
- }, "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, {
29097
29123
  value: this.props.endSubscript,
29098
29124
  placeholder: 0,
29099
29125
  onChange: this.change("endSubscript")
@@ -29101,46 +29127,57 @@ class MovableLineEditor extends React__namespace.Component {
29101
29127
  className: "perseus-widget-row"
29102
29128
  }, "All constraints are applied to the start point."), /*#__PURE__*/React__namespace.createElement(ConstraintEditor, this.props));
29103
29129
  }
29104
- change = (() => {
29105
- var _this4 = this;
29106
- return function () {
29107
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
29108
- args[_key4] = arguments[_key4];
29109
- }
29110
- return perseus.Changeable.change.apply(_this4, args);
29111
- };
29112
- })();
29113
- serialize = () => {
29114
- return perseus.EditorJsonify.serialize.call(this);
29115
- };
29116
29130
  }
29131
+
29132
+ const {
29133
+ MathInput: MathInput$3,
29134
+ NumberInput: NumberInput$c
29135
+ } = perseus.components;
29136
+ const {
29137
+ getDependencies: getDependencies$4
29138
+ } = perseus.Dependencies;
29117
29139
  //
29118
- // Editor for function plots
29140
+ // Editor for interactive movable points
29119
29141
  //
29120
29142
  // TODO(eater): Factor this out
29143
+ // TODO(eater): Rethink how constraints are represented
29121
29144
  //
29122
- class FunctionEditor extends React__namespace.Component {
29145
+ class MovablePointEditor extends React__namespace.Component {
29123
29146
  static propTypes = {
29124
29147
  ...perseus.Changeable.propTypes,
29125
- value: PropTypes__default["default"].string,
29126
- rangeMin: PropTypes__default["default"].string,
29127
- rangeMax: PropTypes__default["default"].string,
29128
- color: PropTypes__default["default"].string,
29129
- strokeDashArray: PropTypes__default["default"].string,
29130
- 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
29131
29153
  };
29132
29154
  static defaultProps = {
29133
- value: "x",
29134
- rangeMin: "-10",
29135
- rangeMax: "10",
29136
- color: perseus.KhanColors.BLUE,
29137
- strokeDasharray: "",
29138
- 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);
29139
29176
  };
29140
29177
  render() {
29141
29178
  const {
29142
29179
  TeX
29143
- } = getDependencies();
29180
+ } = getDependencies$4();
29144
29181
  const analyticsStub = {
29145
29182
  onAnalyticsEvent: () => Promise.resolve()
29146
29183
  };
@@ -29148,68 +29185,33 @@ class FunctionEditor extends React__namespace.Component {
29148
29185
  className: "graph-settings"
29149
29186
  }, /*#__PURE__*/React__namespace.createElement("div", {
29150
29187
  className: "perseus-widget-row"
29151
- }, /*#__PURE__*/React__namespace.createElement(TeX, null, this.props.funcName + "(x)="), " ", /*#__PURE__*/React__namespace.createElement(MathInput, {
29152
- buttonsVisible: "never",
29153
- value: this.props.value
29154
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29155
- ,
29156
- onChange: this.change("value"),
29157
- analytics: analyticsStub
29158
- })), /*#__PURE__*/React__namespace.createElement("div", {
29159
- className: "perseus-widget-row"
29160
- }, "Range: ", /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large("), /*#__PURE__*/React__namespace.createElement(MathInput, {
29188
+ }, "Start: ", /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large("), /*#__PURE__*/React__namespace.createElement(MathInput$3, {
29161
29189
  buttonsVisible: "never",
29162
- value: this.props.rangeMin
29163
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29164
- ,
29165
- onChange: this.change("rangeMin"),
29190
+ value: this.props.startX,
29191
+ onChange: this.change("startX"),
29166
29192
  analytics: analyticsStub
29167
- }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput, {
29193
+ }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput$3, {
29168
29194
  buttonsVisible: "never",
29169
- value: this.props.rangeMax
29170
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29171
- ,
29172
- onChange: this.change("rangeMax"),
29195
+ value: this.props.startY,
29196
+ onChange: this.change("startY"),
29173
29197
  analytics: analyticsStub
29174
29198
  }), /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React__namespace.createElement("div", {
29175
29199
  className: "perseus-widget-row"
29176
- }, /*#__PURE__*/React__namespace.createElement(perseus.ColorPicker, {
29177
- value: this.props.color
29178
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29179
- ,
29180
- onChange: this.change("color")
29181
- })), /*#__PURE__*/React__namespace.createElement("div", {
29182
- className: "perseus-widget-row"
29183
- }, /*#__PURE__*/React__namespace.createElement(perseus.DashPicker, {
29184
- value: this.props.strokeDasharray
29185
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29186
- ,
29187
- onChange: this.change("strokeDasharray")
29188
- })), /*#__PURE__*/React__namespace.createElement("div", {
29189
- className: "perseus-widget-row"
29190
- }, /*#__PURE__*/React__namespace.createElement("div", {
29191
- className: "perseus-widget-left-col"
29192
- }, "Width:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$b, {
29193
- value: this.props.strokeWidth,
29194
- placeholder: 2
29195
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29196
- ,
29197
- onChange: this.change("strokeWidth")
29198
- }))));
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));
29199
29205
  }
29200
- change = (() => {
29201
- var _this5 = this;
29202
- return function () {
29203
- for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
29204
- args[_key5] = arguments[_key5];
29205
- }
29206
- return perseus.Changeable.change.apply(_this5, args);
29207
- };
29208
- })();
29209
- serialize = () => {
29210
- return perseus.EditorJsonify.serialize.call(this);
29211
- };
29212
29206
  }
29207
+
29208
+ const {
29209
+ MathInput: MathInput$2,
29210
+ NumberInput: NumberInput$b
29211
+ } = perseus.components;
29212
+ const {
29213
+ getDependencies: getDependencies$3
29214
+ } = perseus.Dependencies;
29213
29215
  //
29214
29216
  // Editor for parametric plots
29215
29217
  //
@@ -29235,10 +29237,22 @@ class ParametricEditor extends React__namespace.Component {
29235
29237
  strokeDasharray: "",
29236
29238
  strokeWidth: 2
29237
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
+ };
29238
29252
  render() {
29239
29253
  const {
29240
29254
  TeX
29241
- } = getDependencies();
29255
+ } = getDependencies$3();
29242
29256
  const analyticsStub = {
29243
29257
  onAnalyticsEvent: () => Promise.resolve()
29244
29258
  };
@@ -29246,51 +29260,39 @@ class ParametricEditor extends React__namespace.Component {
29246
29260
  className: "graph-settings"
29247
29261
  }, /*#__PURE__*/React__namespace.createElement("div", {
29248
29262
  className: "perseus-widget-row"
29249
- }, /*#__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, {
29250
29264
  buttonsVisible: "never",
29251
- value: this.props.x
29252
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29253
- ,
29265
+ value: this.props.x,
29254
29266
  onChange: this.change("x"),
29255
29267
  analytics: analyticsStub
29256
29268
  })), /*#__PURE__*/React__namespace.createElement("div", {
29257
29269
  className: "perseus-widget-row"
29258
- }, /*#__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, {
29259
29271
  buttonsVisible: "never",
29260
- value: this.props.y
29261
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29262
- ,
29272
+ value: this.props.y,
29263
29273
  onChange: this.change("y"),
29264
29274
  analytics: analyticsStub
29265
29275
  })), /*#__PURE__*/React__namespace.createElement("div", {
29266
29276
  className: "perseus-widget-row"
29267
- }, "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, {
29268
29278
  buttonsVisible: "never",
29269
- value: this.props.rangeMin
29270
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29271
- ,
29279
+ value: this.props.rangeMin,
29272
29280
  onChange: this.change("rangeMin"),
29273
29281
  analytics: analyticsStub
29274
- }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput, {
29282
+ }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput$2, {
29275
29283
  buttonsVisible: "never",
29276
- value: this.props.rangeMax
29277
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29278
- ,
29284
+ value: this.props.rangeMax,
29279
29285
  onChange: this.change("rangeMax"),
29280
29286
  analytics: analyticsStub
29281
29287
  }), /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React__namespace.createElement("div", {
29282
29288
  className: "perseus-widget-row"
29283
29289
  }, /*#__PURE__*/React__namespace.createElement(perseus.ColorPicker, {
29284
- value: this.props.color
29285
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29286
- ,
29290
+ value: this.props.color,
29287
29291
  onChange: this.change("color")
29288
29292
  })), /*#__PURE__*/React__namespace.createElement("div", {
29289
29293
  className: "perseus-widget-row"
29290
29294
  }, /*#__PURE__*/React__namespace.createElement(perseus.DashPicker, {
29291
- value: this.props.strokeDasharray
29292
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29293
- ,
29295
+ value: this.props.strokeDasharray,
29294
29296
  onChange: this.change("strokeDasharray")
29295
29297
  })), /*#__PURE__*/React__namespace.createElement("div", {
29296
29298
  className: "perseus-widget-row"
@@ -29298,49 +29300,51 @@ class ParametricEditor extends React__namespace.Component {
29298
29300
  className: "perseus-widget-left-col"
29299
29301
  }, "Width:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$b, {
29300
29302
  value: this.props.strokeWidth,
29301
- placeholder: 2
29302
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29303
- ,
29303
+ placeholder: 2,
29304
29304
  onChange: this.change("strokeWidth")
29305
29305
  }))));
29306
29306
  }
29307
- change = (() => {
29308
- var _this6 = this;
29309
- return function () {
29310
- for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
29311
- args[_key6] = arguments[_key6];
29312
- }
29313
- return perseus.Changeable.change.apply(_this6, args);
29314
- };
29315
- })();
29316
- serialize = () => {
29317
- return perseus.EditorJsonify.serialize.call(this);
29318
- };
29319
29307
  }
29308
+
29309
+ const {
29310
+ MathInput: MathInput$1
29311
+ } = perseus.components;
29312
+ const {
29313
+ getDependencies: getDependencies$2
29314
+ } = perseus.Dependencies;
29320
29315
  //
29321
- // Editor for labels
29316
+ // Editor for non-interactive points
29322
29317
  //
29323
- // TODO(eater): Factor this out maybe?
29324
- // TODO(eater): Add text direction
29318
+ // TODO(eater): Factor this out
29325
29319
  //
29326
- class LabelEditor extends React__namespace.Component {
29320
+ class PointEditor extends React__namespace.Component {
29327
29321
  static propTypes = {
29328
29322
  ...perseus.Changeable.propTypes,
29329
- color: PropTypes__default["default"].string,
29330
29323
  coordX: PropTypes__default["default"].string,
29331
29324
  coordY: PropTypes__default["default"].string,
29332
- label: PropTypes__default["default"].string
29325
+ color: PropTypes__default["default"].string
29333
29326
  };
29334
29327
  static defaultProps = {
29335
29328
  coordX: "0",
29336
29329
  coordY: "0",
29337
- color: perseus.KhanColors.BLACK,
29338
- 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);
29339
29343
  };
29340
29344
  render() {
29341
29345
  const {
29342
29346
  TeX
29343
- } = getDependencies();
29347
+ } = getDependencies$2();
29344
29348
  const analyticsStub = {
29345
29349
  onAnalyticsEvent: () => Promise.resolve()
29346
29350
  };
@@ -29348,52 +29352,31 @@ class LabelEditor extends React__namespace.Component {
29348
29352
  className: "graph-settings"
29349
29353
  }, /*#__PURE__*/React__namespace.createElement("div", {
29350
29354
  className: "perseus-widget-row"
29351
- }, /*#__PURE__*/React__namespace.createElement(TextInput$5, {
29352
- value: this.props.label
29353
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29354
- ,
29355
- onChange: this.change("label"),
29356
- style: {
29357
- width: "100%"
29358
- }
29359
- })), /*#__PURE__*/React__namespace.createElement("div", {
29360
- className: "perseus-widget-row"
29361
- }, "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, {
29362
29356
  buttonsVisible: "never",
29363
- value: this.props.coordX
29364
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29365
- ,
29357
+ value: this.props.coordX,
29366
29358
  onChange: this.change("coordX"),
29367
29359
  analytics: analyticsStub
29368
- }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput, {
29360
+ }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput$1, {
29369
29361
  buttonsVisible: "never",
29370
- value: this.props.coordY
29371
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29372
- ,
29362
+ value: this.props.coordY,
29373
29363
  onChange: this.change("coordY"),
29374
29364
  analytics: analyticsStub
29375
29365
  }), /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React__namespace.createElement("div", {
29376
29366
  className: "perseus-widget-row"
29377
29367
  }, /*#__PURE__*/React__namespace.createElement(perseus.ColorPicker, {
29378
- value: this.props.color
29379
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29380
- ,
29368
+ value: this.props.color,
29381
29369
  onChange: this.change("color")
29382
29370
  })));
29383
29371
  }
29384
- change = (() => {
29385
- var _this7 = this;
29386
- return function () {
29387
- for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
29388
- args[_key7] = arguments[_key7];
29389
- }
29390
- return perseus.Changeable.change.apply(_this7, args);
29391
- };
29392
- })();
29393
- serialize = () => {
29394
- return perseus.EditorJsonify.serialize.call(this);
29395
- };
29396
29372
  }
29373
+
29374
+ const {
29375
+ MathInput
29376
+ } = perseus.components;
29377
+ const {
29378
+ getDependencies: getDependencies$1
29379
+ } = perseus.Dependencies;
29397
29380
  //
29398
29381
  // Editor for rectangles
29399
29382
  //
@@ -29415,10 +29398,22 @@ class RectangleEditor extends React__namespace.Component {
29415
29398
  height: "3",
29416
29399
  color: perseus.KhanColors.LIGHT_BLUE
29417
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
+ };
29418
29413
  render() {
29419
29414
  const {
29420
29415
  TeX
29421
- } = getDependencies();
29416
+ } = getDependencies$1();
29422
29417
  const analyticsStub = {
29423
29418
  onAnalyticsEvent: () => Promise.resolve()
29424
29419
  };
@@ -29428,61 +29423,57 @@ class RectangleEditor extends React__namespace.Component {
29428
29423
  className: "perseus-widget-row"
29429
29424
  }, "Bottom left: ", /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large("), /*#__PURE__*/React__namespace.createElement(MathInput, {
29430
29425
  buttonsVisible: "never",
29431
- value: this.props.coordX
29432
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29433
- ,
29426
+ value: this.props.coordX,
29434
29427
  onChange: this.change("coordX"),
29435
29428
  analytics: analyticsStub
29436
29429
  }), /*#__PURE__*/React__namespace.createElement(TeX, null, ","), " ", /*#__PURE__*/React__namespace.createElement(MathInput, {
29437
29430
  buttonsVisible: "never",
29438
- value: this.props.coordY
29439
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29440
- ,
29431
+ value: this.props.coordY,
29441
29432
  onChange: this.change("coordY"),
29442
29433
  analytics: analyticsStub
29443
29434
  }), /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React__namespace.createElement("div", {
29444
29435
  className: "perseus-widget-row"
29445
29436
  }, "Width:", " ", /*#__PURE__*/React__namespace.createElement(MathInput, {
29446
29437
  buttonsVisible: "never",
29447
- value: this.props.width
29448
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29449
- ,
29438
+ value: this.props.width,
29450
29439
  onChange: this.change("width"),
29451
29440
  analytics: analyticsStub
29452
29441
  })), /*#__PURE__*/React__namespace.createElement("div", {
29453
29442
  className: "perseus-widget-row"
29454
29443
  }, "Height:", " ", /*#__PURE__*/React__namespace.createElement(MathInput, {
29455
29444
  buttonsVisible: "never",
29456
- value: this.props.height
29457
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29458
- ,
29445
+ value: this.props.height,
29459
29446
  onChange: this.change("height"),
29460
29447
  analytics: analyticsStub
29461
29448
  })), /*#__PURE__*/React__namespace.createElement("div", {
29462
29449
  className: "perseus-widget-row"
29463
29450
  }, /*#__PURE__*/React__namespace.createElement(perseus.ColorPicker, {
29464
29451
  value: this.props.color,
29465
- lightColors: true
29466
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29467
- ,
29452
+ lightColors: true,
29468
29453
  onChange: this.change("color")
29469
29454
  })), /*#__PURE__*/React__namespace.createElement("div", {
29470
29455
  className: "perseus-widget-row"
29471
29456
  }, "You want a border? Sorry, draw your own."));
29472
29457
  }
29473
- change = (() => {
29474
- var _this8 = this;
29475
- return function () {
29476
- for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
29477
- args[_key8] = arguments[_key8];
29478
- }
29479
- return perseus.Changeable.change.apply(_this8, args);
29480
- };
29481
- })();
29482
- serialize = () => {
29483
- return perseus.EditorJsonify.serialize.call(this);
29484
- };
29485
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
+ };
29486
29477
  class InteractionEditor extends React__namespace.Component {
29487
29478
  // TODO(eater): Make more better
29488
29479
  static propTypes = {
@@ -29589,14 +29580,17 @@ class InteractionEditor extends React__namespace.Component {
29589
29580
  });
29590
29581
  };
29591
29582
  change = (() => {
29592
- var _this9 = this;
29583
+ var _this = this;
29593
29584
  return function () {
29594
- for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
29595
- args[_key9] = arguments[_key9];
29585
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
29586
+ args[_key] = arguments[_key];
29596
29587
  }
29597
- return perseus.Changeable.change.apply(_this9, args);
29588
+ return perseus.Changeable.change.apply(_this, args);
29598
29589
  };
29599
29590
  })();
29591
+ serialize = () => {
29592
+ return perseus.EditorJsonify.serialize.call(this);
29593
+ };
29600
29594
  render() {
29601
29595
  const {
29602
29596
  TeX
@@ -29918,10 +29912,6 @@ class InteractionEditor extends React__namespace.Component {
29918
29912
  }, "\u2605 Movable line segment"))));
29919
29913
  /* eslint-enable max-len */
29920
29914
  }
29921
-
29922
- serialize = () => {
29923
- return perseus.EditorJsonify.serialize.call(this);
29924
- };
29925
29915
  }
29926
29916
 
29927
29917
  const UNLIMITED = "unlimited";