@khanacademy/perseus-editor 2.15.4 → 2.15.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/es/index.js +432 -580
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +500 -658
- package/dist/index.js.map +1 -1
- package/dist/widgets/interaction-editor/function-editor.d.ts +25 -0
- package/dist/widgets/interaction-editor/index.d.ts +2 -0
- package/dist/widgets/interaction-editor/interaction-editor.d.ts +37 -0
- package/dist/widgets/interaction-editor/label-editor.d.ts +21 -0
- package/dist/widgets/interaction-editor/line-editor.d.ts +29 -0
- package/dist/widgets/interaction-editor/mathquill-input.d.ts +12 -0
- package/dist/widgets/interaction-editor/movable-line-editor.d.ts +29 -0
- package/dist/widgets/interaction-editor/movable-point-editor.d.ts +24 -0
- package/dist/widgets/interaction-editor/parametric-editor.d.ts +27 -0
- package/dist/widgets/interaction-editor/point-editor.d.ts +19 -0
- package/dist/widgets/interaction-editor/rectangle-editor.d.ts +23 -0
- package/package.json +3 -2
- package/src/widgets/__stories__/interaction-editor.stories.tsx +37 -0
- package/src/widgets/{interaction → interaction-editor}/constraint-editor.tsx +9 -21
- package/src/widgets/interaction-editor/function-editor.tsx +108 -0
- package/src/widgets/interaction-editor/index.ts +3 -0
- package/src/widgets/{interaction-editor.tsx → interaction-editor/interaction-editor.tsx} +40 -787
- package/src/widgets/interaction-editor/label-editor.tsx +87 -0
- package/src/widgets/interaction-editor/line-editor.tsx +125 -0
- package/src/widgets/interaction-editor/mathquill-input.tsx +81 -0
- package/src/widgets/interaction-editor/movable-line-editor.tsx +121 -0
- package/src/widgets/interaction-editor/movable-point-editor.tsx +89 -0
- package/src/widgets/interaction-editor/parametric-editor.tsx +117 -0
- package/src/widgets/interaction-editor/point-editor.tsx +72 -0
- package/src/widgets/interaction-editor/rectangle-editor.tsx +96 -0
- package/tsconfig-build.tsbuildinfo +1 -1
- package/dist/widgets/interaction-editor.d.ts +0 -28
- /package/dist/widgets/{interaction → interaction-editor}/constraint-editor.d.ts +0 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Changeable,
|
|
3
|
+
Dependencies,
|
|
4
|
+
EditorJsonify,
|
|
5
|
+
KhanColors,
|
|
6
|
+
ColorPicker,
|
|
7
|
+
} from "@khanacademy/perseus";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import _ from "underscore";
|
|
10
|
+
|
|
11
|
+
import MathquillInput from "./mathquill-input";
|
|
12
|
+
|
|
13
|
+
const {getDependencies} = Dependencies;
|
|
14
|
+
|
|
15
|
+
type Props = Changeable.ChangeableProps & {
|
|
16
|
+
color: string;
|
|
17
|
+
coordX: string;
|
|
18
|
+
coordY: string;
|
|
19
|
+
height: string;
|
|
20
|
+
width: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
type DefaultProps = {
|
|
24
|
+
color: Props["color"];
|
|
25
|
+
coordX: Props["coordX"];
|
|
26
|
+
coordY: Props["coordY"];
|
|
27
|
+
height: Props["height"];
|
|
28
|
+
width: Props["width"];
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// Editor for rectangles
|
|
32
|
+
class RectangleEditor extends React.Component<Props> {
|
|
33
|
+
static defaultProps: 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
|
+
|
|
52
|
+
return (
|
|
53
|
+
<div className="graph-settings">
|
|
54
|
+
<div className="perseus-widget-row">
|
|
55
|
+
Bottom left: <TeX>\Large(</TeX>
|
|
56
|
+
<MathquillInput
|
|
57
|
+
value={this.props.coordX}
|
|
58
|
+
onChange={this.change("coordX")}
|
|
59
|
+
/>
|
|
60
|
+
<TeX>,</TeX>{" "}
|
|
61
|
+
<MathquillInput
|
|
62
|
+
value={this.props.coordY}
|
|
63
|
+
onChange={this.change("coordY")}
|
|
64
|
+
/>
|
|
65
|
+
<TeX>\Large)</TeX>
|
|
66
|
+
</div>
|
|
67
|
+
<div className="perseus-widget-row">
|
|
68
|
+
Width:{" "}
|
|
69
|
+
<MathquillInput
|
|
70
|
+
value={this.props.width}
|
|
71
|
+
onChange={this.change("width")}
|
|
72
|
+
/>
|
|
73
|
+
</div>
|
|
74
|
+
<div className="perseus-widget-row">
|
|
75
|
+
Height:{" "}
|
|
76
|
+
<MathquillInput
|
|
77
|
+
value={this.props.height}
|
|
78
|
+
onChange={this.change("height")}
|
|
79
|
+
/>
|
|
80
|
+
</div>
|
|
81
|
+
<div className="perseus-widget-row">
|
|
82
|
+
<ColorPicker
|
|
83
|
+
value={this.props.color}
|
|
84
|
+
lightColors={true}
|
|
85
|
+
onChange={this.change("color")}
|
|
86
|
+
/>
|
|
87
|
+
</div>
|
|
88
|
+
<div className="perseus-widget-row">
|
|
89
|
+
You want a border? Sorry, draw your own.
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export default RectangleEditor;
|