@khanacademy/perseus-editor 5.0.1 → 5.0.3
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/dist/components/interactive-graph-settings.d.ts +61 -13
- package/dist/components/labeled-row.d.ts +10 -0
- package/dist/es/index.js +480 -331
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +478 -328
- package/dist/index.js.map +1 -1
- package/dist/widgets/interactive-graph-editor.d.ts +609 -238
- package/package.json +8 -2
|
@@ -1,34 +1,83 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { PerseusImageBackground } from "@khanacademy/perseus";
|
|
3
|
-
type
|
|
3
|
+
type Range = [min: number, max: number];
|
|
4
4
|
type Props = {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* The size of the graph area in pixels.
|
|
7
|
+
*/
|
|
8
|
+
box: [x: number, y: number];
|
|
9
|
+
/**
|
|
10
|
+
* The labels for the x and y axes.
|
|
11
|
+
*/
|
|
7
12
|
labels: ReadonlyArray<string>;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
/**
|
|
14
|
+
* The range of the graph.
|
|
15
|
+
*/
|
|
16
|
+
range: [x: Range, y: Range];
|
|
17
|
+
/**
|
|
18
|
+
* How far apart the tick marks on the axes are in the x and y
|
|
19
|
+
* directions.
|
|
20
|
+
*/
|
|
21
|
+
step: [x: number, y: number];
|
|
22
|
+
/**
|
|
23
|
+
* How far apart the grid lines are in the x and y directions.
|
|
24
|
+
*/
|
|
25
|
+
gridStep: [x: number, y: number];
|
|
26
|
+
/**
|
|
27
|
+
* How far apart the snap-to points are in the x and y directions.
|
|
28
|
+
*/
|
|
29
|
+
snapStep: [x: number, y: number];
|
|
30
|
+
/**
|
|
31
|
+
* An error message to display in the graph area, or true if the
|
|
32
|
+
* graph is valid.
|
|
33
|
+
*/
|
|
12
34
|
valid: boolean | string;
|
|
35
|
+
/**
|
|
36
|
+
* The background image to display in the graph area and its properties.
|
|
37
|
+
*/
|
|
13
38
|
backgroundImage: PerseusImageBackground;
|
|
39
|
+
/**
|
|
40
|
+
* The type of markings to display on the graph.
|
|
41
|
+
* - graph: shows the axes and the grid lines
|
|
42
|
+
* - grid: shows only the grid lines
|
|
43
|
+
* - none: shows no markings
|
|
44
|
+
*/
|
|
14
45
|
markings: "graph" | "grid" | "none";
|
|
46
|
+
/**
|
|
47
|
+
* Whether to show the protractor on the graph.
|
|
48
|
+
*/
|
|
15
49
|
showProtractor: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Whether to show the ruler on the graph.
|
|
52
|
+
*/
|
|
16
53
|
showRuler: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Whether to show tooltips on the graph.
|
|
56
|
+
*/
|
|
17
57
|
showTooltips: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* The label to display on the ruler, if any.
|
|
60
|
+
*/
|
|
18
61
|
rulerLabel: string;
|
|
62
|
+
/**
|
|
63
|
+
* The number of ticks to display on the ruler.
|
|
64
|
+
*/
|
|
19
65
|
rulerTicks: number;
|
|
20
66
|
onChange: (arg1: Partial<Props>) => void;
|
|
21
67
|
};
|
|
22
68
|
type State = {
|
|
23
69
|
labelsTextbox: ReadonlyArray<string>;
|
|
24
|
-
gridStepTextbox: [number, number];
|
|
25
|
-
snapStepTextbox: [number, number];
|
|
26
|
-
stepTextbox: [number, number];
|
|
27
|
-
rangeTextbox: [
|
|
70
|
+
gridStepTextbox: [x: number, y: number];
|
|
71
|
+
snapStepTextbox: [x: number, y: number];
|
|
72
|
+
stepTextbox: [x: number, y: number];
|
|
73
|
+
rangeTextbox: [x: Range, y: Range];
|
|
28
74
|
backgroundImage: PerseusImageBackground;
|
|
29
75
|
};
|
|
30
76
|
declare class InteractiveGraphSettings extends React.Component<Props, State> {
|
|
31
77
|
_isMounted: boolean;
|
|
78
|
+
bgUrlRef: React.RefObject<HTMLInputElement>;
|
|
79
|
+
labelXRef: React.RefObject<HTMLInputElement>;
|
|
80
|
+
labelYRef: React.RefObject<HTMLInputElement>;
|
|
32
81
|
static stateFromProps(props: any): {
|
|
33
82
|
labelsTextbox: any;
|
|
34
83
|
gridStepTextbox: any;
|
|
@@ -39,7 +88,6 @@ declare class InteractiveGraphSettings extends React.Component<Props, State> {
|
|
|
39
88
|
};
|
|
40
89
|
constructor(props: Props);
|
|
41
90
|
static defaultProps: {
|
|
42
|
-
editableSettings: string[];
|
|
43
91
|
box: 288[];
|
|
44
92
|
labels: string[];
|
|
45
93
|
range: number[][];
|
|
@@ -66,7 +114,7 @@ declare class InteractiveGraphSettings extends React.Component<Props, State> {
|
|
|
66
114
|
changeRulerLabel: (e: any) => void;
|
|
67
115
|
changeRulerTicks: (e: any) => void;
|
|
68
116
|
changeBackgroundUrl: (e: any) => void;
|
|
69
|
-
renderLabelChoices: (choices: any) =>
|
|
117
|
+
renderLabelChoices: (choices: any) => any;
|
|
70
118
|
validRange: (range: any) => true | "Range must be a valid number" | "Range must have a higher number on the right";
|
|
71
119
|
validateStepValue: (settings: any) => string | true;
|
|
72
120
|
validSnapStep: (step: any, range: any) => string | true;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
3
|
+
declare const LabeledRow: (props: {
|
|
4
|
+
id?: string;
|
|
5
|
+
label: string;
|
|
6
|
+
labelSide?: "start" | "end";
|
|
7
|
+
style?: StyleType;
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}) => JSX.Element;
|
|
10
|
+
export default LabeledRow;
|