@khanacademy/perseus-editor 2.15.3 → 2.15.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/dist/editor-page.d.ts +4 -10
- package/dist/editor.d.ts +2 -2
- package/dist/es/index.js +362 -360
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +426 -425
- 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/dist/widgets/interactive-graph-editor.d.ts +92 -92
- package/package.json +2 -2
- package/src/__stories__/editor-page.stories.tsx +65 -0
- package/src/__stories__/editor.stories.tsx +2 -4
- package/src/editor-page.tsx +5 -11
- package/src/editor.tsx +2 -2
- package/src/widgets/__stories__/categorizer-editor.stories.tsx +24 -0
- package/src/widgets/__stories__/definition-editor.stories.tsx +18 -0
- package/src/widgets/__stories__/dropdown-editor.stories.tsx +18 -0
- package/src/widgets/__stories__/explanation-editor.stories.tsx +18 -0
- package/src/widgets/__stories__/input-number-editor.stories.tsx +18 -0
- package/src/widgets/__stories__/interaction-editor.stories.tsx +24 -0
- package/src/widgets/__stories__/matcher-editor.stories.tsx +18 -0
- package/src/widgets/__stories__/number-line-editor.stories.tsx +18 -0
- package/src/widgets/__stories__/numeric-input-editor.stories.tsx +18 -0
- package/src/widgets/__stories__/radio-editor.stories.tsx +3 -3
- package/src/widgets/__stories__/sorter-editor.stories.tsx +18 -0
- package/src/widgets/__tests__/categorizer-editor.test.tsx +51 -0
- package/src/widgets/__tests__/definition-editor.test.tsx +41 -0
- package/src/widgets/__tests__/dropdown-editor.test.tsx +57 -0
- package/src/widgets/__tests__/explanation-editor.test.tsx +59 -0
- package/src/widgets/__tests__/input-number-editor.test.tsx +128 -0
- package/src/widgets/__tests__/matcher-editor.test.tsx +47 -0
- package/src/widgets/__tests__/number-line-editor.test.tsx +144 -0
- package/src/widgets/__tests__/numeric-input-editor.test.tsx +177 -0
- package/src/widgets/__tests__/radio-editor.test.tsx +118 -0
- package/src/widgets/__tests__/sorter-editor.test.tsx +55 -0
- package/src/widgets/dropdown-editor.tsx +1 -0
- package/src/widgets/input-number-editor.tsx +2 -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/src/widgets/number-line-editor.tsx +16 -5
- package/src/widgets/numeric-input-editor.tsx +2 -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,26 @@
|
|
|
1
|
+
import PropTypes from "prop-types";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
type FunctionEditorProps = any;
|
|
4
|
+
declare class FunctionEditor extends React.Component<FunctionEditorProps> {
|
|
5
|
+
static propTypes: {
|
|
6
|
+
value: PropTypes.Requireable<string>;
|
|
7
|
+
rangeMin: PropTypes.Requireable<string>;
|
|
8
|
+
rangeMax: PropTypes.Requireable<string>;
|
|
9
|
+
color: PropTypes.Requireable<string>;
|
|
10
|
+
strokeDashArray: PropTypes.Requireable<string>;
|
|
11
|
+
strokeWidth: PropTypes.Requireable<number>;
|
|
12
|
+
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
13
|
+
};
|
|
14
|
+
static defaultProps: {
|
|
15
|
+
value: string;
|
|
16
|
+
rangeMin: string;
|
|
17
|
+
rangeMax: string;
|
|
18
|
+
color: "#6495ED";
|
|
19
|
+
strokeDasharray: string;
|
|
20
|
+
strokeWidth: number;
|
|
21
|
+
};
|
|
22
|
+
change: (arg1: any, arg2?: any, arg3?: any) => any;
|
|
23
|
+
serialize: () => any;
|
|
24
|
+
render(): React.ReactNode;
|
|
25
|
+
}
|
|
26
|
+
export default FunctionEditor;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import PropTypes from "prop-types";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
type LabelEditorProps = any;
|
|
4
|
+
declare class LabelEditor extends React.Component<LabelEditorProps> {
|
|
5
|
+
static propTypes: {
|
|
6
|
+
color: PropTypes.Requireable<string>;
|
|
7
|
+
coordX: PropTypes.Requireable<string>;
|
|
8
|
+
coordY: PropTypes.Requireable<string>;
|
|
9
|
+
label: PropTypes.Requireable<string>;
|
|
10
|
+
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
11
|
+
};
|
|
12
|
+
static defaultProps: {
|
|
13
|
+
coordX: string;
|
|
14
|
+
coordY: string;
|
|
15
|
+
color: "black";
|
|
16
|
+
label: string;
|
|
17
|
+
};
|
|
18
|
+
change: (arg1: any, arg2?: any, arg3?: any) => any;
|
|
19
|
+
serialize: () => any;
|
|
20
|
+
render(): React.ReactNode;
|
|
21
|
+
}
|
|
22
|
+
export default LabelEditor;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import PropTypes from "prop-types";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
type LineEditorProps = any;
|
|
4
|
+
declare class LineEditor extends React.Component<LineEditorProps> {
|
|
5
|
+
static propTypes: {
|
|
6
|
+
startX: PropTypes.Requireable<string>;
|
|
7
|
+
startY: PropTypes.Requireable<string>;
|
|
8
|
+
endX: PropTypes.Requireable<string>;
|
|
9
|
+
endY: PropTypes.Requireable<string>;
|
|
10
|
+
color: PropTypes.Requireable<string>;
|
|
11
|
+
strokeDasharray: PropTypes.Requireable<string>;
|
|
12
|
+
arrows: PropTypes.Requireable<string>;
|
|
13
|
+
strokeWidth: PropTypes.Requireable<number>;
|
|
14
|
+
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
15
|
+
};
|
|
16
|
+
static defaultProps: {
|
|
17
|
+
startX: string;
|
|
18
|
+
startY: string;
|
|
19
|
+
endX: string;
|
|
20
|
+
endY: string;
|
|
21
|
+
color: "black";
|
|
22
|
+
strokeDasharray: string;
|
|
23
|
+
arrows: string;
|
|
24
|
+
strokeWidth: number;
|
|
25
|
+
};
|
|
26
|
+
change: (arg1: any, arg2?: any, arg3?: any) => any;
|
|
27
|
+
serialize: () => any;
|
|
28
|
+
render(): React.ReactNode;
|
|
29
|
+
}
|
|
30
|
+
export default LineEditor;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import PropTypes from "prop-types";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
type MovableLineEditorProps = any;
|
|
4
|
+
declare class MovableLineEditor extends React.Component<MovableLineEditorProps> {
|
|
5
|
+
static propTypes: {
|
|
6
|
+
startX: PropTypes.Requireable<string>;
|
|
7
|
+
startY: PropTypes.Requireable<string>;
|
|
8
|
+
endX: PropTypes.Requireable<string>;
|
|
9
|
+
endY: PropTypes.Requireable<string>;
|
|
10
|
+
constraint: PropTypes.Requireable<string>;
|
|
11
|
+
snap: PropTypes.Requireable<number>;
|
|
12
|
+
constraintFn: PropTypes.Requireable<string>;
|
|
13
|
+
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
14
|
+
};
|
|
15
|
+
static defaultProps: {
|
|
16
|
+
startX: string;
|
|
17
|
+
startY: string;
|
|
18
|
+
endX: string;
|
|
19
|
+
endY: string;
|
|
20
|
+
constraint: string;
|
|
21
|
+
snap: number;
|
|
22
|
+
constraintFn: string;
|
|
23
|
+
constraintXMin: string;
|
|
24
|
+
constraintXMax: string;
|
|
25
|
+
constraintYMin: string;
|
|
26
|
+
constraintYMax: string;
|
|
27
|
+
};
|
|
28
|
+
change: (...args: any[]) => any;
|
|
29
|
+
serialize: () => any;
|
|
30
|
+
render(): React.ReactNode;
|
|
31
|
+
}
|
|
32
|
+
export default MovableLineEditor;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import PropTypes from "prop-types";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
type MovablePointEditorProps = any;
|
|
4
|
+
declare class MovablePointEditor extends React.Component<MovablePointEditorProps> {
|
|
5
|
+
static propTypes: {
|
|
6
|
+
startX: PropTypes.Requireable<string>;
|
|
7
|
+
startY: PropTypes.Requireable<string>;
|
|
8
|
+
constraint: PropTypes.Requireable<string>;
|
|
9
|
+
snap: PropTypes.Requireable<number>;
|
|
10
|
+
constraintFn: PropTypes.Requireable<string>;
|
|
11
|
+
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
12
|
+
};
|
|
13
|
+
static defaultProps: {
|
|
14
|
+
startX: string;
|
|
15
|
+
startY: string;
|
|
16
|
+
constraint: string;
|
|
17
|
+
snap: number;
|
|
18
|
+
constraintFn: string;
|
|
19
|
+
constraintXMin: string;
|
|
20
|
+
constraintXMax: string;
|
|
21
|
+
constraintYMin: string;
|
|
22
|
+
constraintYMax: string;
|
|
23
|
+
};
|
|
24
|
+
change: (...args: any[]) => any;
|
|
25
|
+
serialize: () => any;
|
|
26
|
+
render(): React.ReactNode;
|
|
27
|
+
}
|
|
28
|
+
export default MovablePointEditor;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import PropTypes from "prop-types";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
type ParametricEditorProps = any;
|
|
4
|
+
declare class ParametricEditor extends React.Component<ParametricEditorProps> {
|
|
5
|
+
static propTypes: {
|
|
6
|
+
x: PropTypes.Requireable<string>;
|
|
7
|
+
y: PropTypes.Requireable<string>;
|
|
8
|
+
rangeMin: PropTypes.Requireable<string>;
|
|
9
|
+
rangeMax: PropTypes.Requireable<string>;
|
|
10
|
+
color: PropTypes.Requireable<string>;
|
|
11
|
+
strokeDashArray: PropTypes.Requireable<string>;
|
|
12
|
+
strokeWidth: PropTypes.Requireable<number>;
|
|
13
|
+
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
14
|
+
};
|
|
15
|
+
static defaultProps: {
|
|
16
|
+
x: string;
|
|
17
|
+
y: string;
|
|
18
|
+
rangeMin: string;
|
|
19
|
+
rangeMax: string;
|
|
20
|
+
color: "#6495ED";
|
|
21
|
+
strokeDasharray: string;
|
|
22
|
+
strokeWidth: number;
|
|
23
|
+
};
|
|
24
|
+
change: (arg1: any, arg2?: any, arg3?: any) => any;
|
|
25
|
+
serialize: () => any;
|
|
26
|
+
render(): React.ReactNode;
|
|
27
|
+
}
|
|
28
|
+
export default ParametricEditor;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import PropTypes from "prop-types";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
type PointEditorProps = any;
|
|
4
|
+
declare class PointEditor extends React.Component<PointEditorProps> {
|
|
5
|
+
static propTypes: {
|
|
6
|
+
coordX: PropTypes.Requireable<string>;
|
|
7
|
+
coordY: PropTypes.Requireable<string>;
|
|
8
|
+
color: PropTypes.Requireable<string>;
|
|
9
|
+
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
10
|
+
};
|
|
11
|
+
static defaultProps: {
|
|
12
|
+
coordX: string;
|
|
13
|
+
coordY: string;
|
|
14
|
+
color: "black";
|
|
15
|
+
};
|
|
16
|
+
change: (arg1: any, arg2?: any, arg3?: any) => any;
|
|
17
|
+
serialize: () => any;
|
|
18
|
+
render(): React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
export default PointEditor;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import PropTypes from "prop-types";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
type RectangleEditorProps = any;
|
|
4
|
+
declare class RectangleEditor extends React.Component<RectangleEditorProps> {
|
|
5
|
+
static propTypes: {
|
|
6
|
+
color: PropTypes.Requireable<string>;
|
|
7
|
+
coordX: PropTypes.Requireable<string>;
|
|
8
|
+
coordY: PropTypes.Requireable<string>;
|
|
9
|
+
height: PropTypes.Requireable<string>;
|
|
10
|
+
width: PropTypes.Requireable<string>;
|
|
11
|
+
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
12
|
+
};
|
|
13
|
+
static defaultProps: {
|
|
14
|
+
coordX: string;
|
|
15
|
+
coordY: string;
|
|
16
|
+
width: string;
|
|
17
|
+
height: string;
|
|
18
|
+
color: "#9AB8ED";
|
|
19
|
+
};
|
|
20
|
+
change: (arg1: any, arg2?: any, arg3?: any) => any;
|
|
21
|
+
serialize: () => any;
|
|
22
|
+
render(): React.ReactNode;
|
|
23
|
+
}
|
|
24
|
+
export default RectangleEditor;
|