@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.
- package/CHANGELOG.md +9 -0
- package/dist/es/index.js +329 -338
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +402 -412
- package/dist/index.js.map +1 -1
- package/dist/widgets/interaction-editor/function-editor.d.ts +26 -0
- package/dist/widgets/interaction-editor/index.d.ts +2 -0
- package/dist/widgets/interaction-editor/label-editor.d.ts +22 -0
- package/dist/widgets/interaction-editor/line-editor.d.ts +30 -0
- package/dist/widgets/interaction-editor/movable-line-editor.d.ts +32 -0
- package/dist/widgets/interaction-editor/movable-point-editor.d.ts +28 -0
- package/dist/widgets/interaction-editor/parametric-editor.d.ts +28 -0
- package/dist/widgets/interaction-editor/point-editor.d.ts +20 -0
- package/dist/widgets/interaction-editor/rectangle-editor.d.ts +24 -0
- package/package.json +2 -2
- package/src/widgets/__stories__/interaction-editor.stories.tsx +24 -0
- package/src/widgets/interaction-editor/function-editor.tsx +111 -0
- package/src/widgets/interaction-editor/index.ts +3 -0
- package/src/widgets/{interaction-editor.tsx → interaction-editor/interaction-editor.tsx} +14 -768
- package/src/widgets/interaction-editor/label-editor.tsx +91 -0
- package/src/widgets/interaction-editor/line-editor.tsx +129 -0
- package/src/widgets/interaction-editor/movable-line-editor.tsx +125 -0
- package/src/widgets/interaction-editor/movable-point-editor.tsx +92 -0
- package/src/widgets/interaction-editor/parametric-editor.tsx +122 -0
- package/src/widgets/interaction-editor/point-editor.tsx +79 -0
- package/src/widgets/interaction-editor/rectangle-editor.tsx +105 -0
- package/tsconfig-build.tsbuildinfo +1 -1
- package/dist/widgets/{interaction → interaction-editor}/constraint-editor.d.ts +0 -0
- package/dist/widgets/{interaction-editor.d.ts → interaction-editor/interaction-editor.d.ts} +1 -1
- /package/src/widgets/{interaction → interaction-editor}/constraint-editor.tsx +0 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import {
|
|
2
|
+
components,
|
|
3
|
+
Changeable,
|
|
4
|
+
Dependencies,
|
|
5
|
+
EditorJsonify,
|
|
6
|
+
KhanColors,
|
|
7
|
+
ColorPicker,
|
|
8
|
+
} from "@khanacademy/perseus";
|
|
9
|
+
import PropTypes from "prop-types";
|
|
10
|
+
import * as React from "react";
|
|
11
|
+
import _ from "underscore";
|
|
12
|
+
|
|
13
|
+
const {MathInput} = components;
|
|
14
|
+
const {getDependencies} = Dependencies;
|
|
15
|
+
|
|
16
|
+
type RectangleEditorProps = any;
|
|
17
|
+
|
|
18
|
+
//
|
|
19
|
+
// Editor for rectangles
|
|
20
|
+
//
|
|
21
|
+
// TODO(eater): Factor this out maybe?
|
|
22
|
+
//
|
|
23
|
+
class RectangleEditor extends React.Component<RectangleEditorProps> {
|
|
24
|
+
static propTypes = {
|
|
25
|
+
...Changeable.propTypes,
|
|
26
|
+
color: PropTypes.string,
|
|
27
|
+
coordX: PropTypes.string,
|
|
28
|
+
coordY: PropTypes.string,
|
|
29
|
+
height: PropTypes.string,
|
|
30
|
+
width: PropTypes.string,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
static defaultProps = {
|
|
34
|
+
coordX: "-5",
|
|
35
|
+
coordY: "5",
|
|
36
|
+
width: "2",
|
|
37
|
+
height: "3",
|
|
38
|
+
color: KhanColors.LIGHT_BLUE,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
change: (arg1: any, arg2?: any, arg3?: any) => any = (...args) => {
|
|
42
|
+
return Changeable.change.apply(this, args);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
serialize = () => {
|
|
46
|
+
return EditorJsonify.serialize.call(this);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
render(): React.ReactNode {
|
|
50
|
+
const {TeX} = getDependencies();
|
|
51
|
+
const analyticsStub = {onAnalyticsEvent: () => Promise.resolve()};
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<div className="graph-settings">
|
|
55
|
+
<div className="perseus-widget-row">
|
|
56
|
+
Bottom left: <TeX>\Large(</TeX>
|
|
57
|
+
<MathInput
|
|
58
|
+
buttonsVisible="never"
|
|
59
|
+
value={this.props.coordX}
|
|
60
|
+
onChange={this.change("coordX")}
|
|
61
|
+
analytics={analyticsStub}
|
|
62
|
+
/>
|
|
63
|
+
<TeX>,</TeX>{" "}
|
|
64
|
+
<MathInput
|
|
65
|
+
buttonsVisible="never"
|
|
66
|
+
value={this.props.coordY}
|
|
67
|
+
onChange={this.change("coordY")}
|
|
68
|
+
analytics={analyticsStub}
|
|
69
|
+
/>
|
|
70
|
+
<TeX>\Large)</TeX>
|
|
71
|
+
</div>
|
|
72
|
+
<div className="perseus-widget-row">
|
|
73
|
+
Width:{" "}
|
|
74
|
+
<MathInput
|
|
75
|
+
buttonsVisible="never"
|
|
76
|
+
value={this.props.width}
|
|
77
|
+
onChange={this.change("width")}
|
|
78
|
+
analytics={analyticsStub}
|
|
79
|
+
/>
|
|
80
|
+
</div>
|
|
81
|
+
<div className="perseus-widget-row">
|
|
82
|
+
Height:{" "}
|
|
83
|
+
<MathInput
|
|
84
|
+
buttonsVisible="never"
|
|
85
|
+
value={this.props.height}
|
|
86
|
+
onChange={this.change("height")}
|
|
87
|
+
analytics={analyticsStub}
|
|
88
|
+
/>
|
|
89
|
+
</div>
|
|
90
|
+
<div className="perseus-widget-row">
|
|
91
|
+
<ColorPicker
|
|
92
|
+
value={this.props.color}
|
|
93
|
+
lightColors={true}
|
|
94
|
+
onChange={this.change("color")}
|
|
95
|
+
/>
|
|
96
|
+
</div>
|
|
97
|
+
<div className="perseus-widget-row">
|
|
98
|
+
You want a border? Sorry, draw your own.
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export default RectangleEditor;
|