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