@khanacademy/perseus-editor 13.1.0 → 14.0.1
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/all-editors.d.ts +1 -4
- package/dist/components/hover-behavior.d.ts +2 -2
- package/dist/components/widget-editor.d.ts +1 -1
- package/dist/es/index.js +187 -624
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +745 -1210
- package/dist/index.js.map +1 -1
- package/dist/widgets/expression-editor.d.ts +1 -1
- package/dist/widgets/graded-group-editor.d.ts +1 -1
- package/dist/widgets/grapher-editor.d.ts +1 -1
- package/dist/widgets/group-editor.d.ts +1 -1
- package/dist/widgets/iframe-editor.d.ts +1 -1
- package/dist/widgets/image-editor.d.ts +2 -2
- package/dist/widgets/input-number-editor.d.ts +1 -1
- package/dist/widgets/interactive-graph-editor.d.ts +30 -38
- package/dist/widgets/matcher-editor.d.ts +1 -1
- package/dist/widgets/matrix-editor.d.ts +1 -1
- package/dist/widgets/measurer-editor.d.ts +1 -1
- package/dist/widgets/numeric-input-editor.d.ts +1 -1
- package/dist/widgets/orderer-editor.d.ts +1 -1
- package/dist/widgets/phet-simulation-editor.d.ts +2 -1
- package/dist/widgets/radio/editor.d.ts +1 -1
- package/dist/widgets/table-editor.d.ts +1 -1
- package/package.json +2 -2
- package/dist/all-widgets.d.ts +0 -22
- package/dist/testing-widgets.d.ts +0 -22
- package/dist/widgets/example-graphie-widget-editor.d.ts +0 -18
- package/dist/widgets/example-graphie-widget.d.ts +0 -61
- package/dist/widgets/example-widget-editor.d.ts +0 -20
- package/dist/widgets/example-widget.d.ts +0 -89
- package/dist/widgets/simple-markdown-tester-editor.d.ts +0 -21
- package/dist/widgets/simple-markdown-tester.d.ts +0 -54
|
@@ -19,7 +19,6 @@ declare class ExpressionEditor extends React.Component<Props, State> {
|
|
|
19
19
|
static defaultProps: DefaultProps;
|
|
20
20
|
constructor(props: any);
|
|
21
21
|
change(...args: any[]): any;
|
|
22
|
-
render(): React.ReactNode;
|
|
23
22
|
serialize: () => any;
|
|
24
23
|
getSaveWarnings: () => any;
|
|
25
24
|
_newEmptyAnswerForm: () => any;
|
|
@@ -31,5 +30,6 @@ declare class ExpressionEditor extends React.Component<Props, State> {
|
|
|
31
30
|
handleToggleDiv: () => void;
|
|
32
31
|
handleTexInsert: (arg1: string) => void;
|
|
33
32
|
handleFunctions: (value: string) => void;
|
|
33
|
+
render(): React.ReactNode;
|
|
34
34
|
}
|
|
35
35
|
export default ExpressionEditor;
|
|
@@ -44,11 +44,11 @@ declare class GradedGroupEditor extends React.Component<Props> {
|
|
|
44
44
|
change: (arg1: any, arg2: any, arg3: any) => any;
|
|
45
45
|
handleAddHint: () => void;
|
|
46
46
|
handleRemoveHint: (arg1: React.MouseEvent) => void;
|
|
47
|
-
render(): React.ReactNode;
|
|
48
47
|
getSaveWarnings: () => any;
|
|
49
48
|
serialize: () => {
|
|
50
49
|
title: string;
|
|
51
50
|
hint: any | null | undefined;
|
|
52
51
|
};
|
|
52
|
+
render(): React.ReactNode;
|
|
53
53
|
}
|
|
54
54
|
export default GradedGroupEditor;
|
|
@@ -7,8 +7,8 @@ declare class GrapherEditor extends React.Component<Props> {
|
|
|
7
7
|
static widgetName: "grapher";
|
|
8
8
|
static defaultProps: Props;
|
|
9
9
|
change: (arg1: any, arg2: any, arg3: any) => any;
|
|
10
|
-
render(): React.ReactNode;
|
|
11
10
|
handleAvailableTypesChange: (newAvailableTypes: Array<any>) => void;
|
|
12
11
|
serialize: () => any;
|
|
12
|
+
render(): React.ReactNode;
|
|
13
13
|
}
|
|
14
14
|
export default GrapherEditor;
|
|
@@ -40,10 +40,10 @@ declare class GroupEditor extends React.Component<Props> {
|
|
|
40
40
|
static widgetName: "group";
|
|
41
41
|
static defaultProps: Props;
|
|
42
42
|
editor: React.RefObject<Editor>;
|
|
43
|
-
render(): React.ReactNode;
|
|
44
43
|
_renderMetadataEditor: () => React.ReactElement;
|
|
45
44
|
change: (arg1: any, arg2: any, arg3: any) => any;
|
|
46
45
|
getSaveWarnings: () => ReadonlyArray<any>;
|
|
47
46
|
serialize: () => any;
|
|
47
|
+
render(): React.ReactNode;
|
|
48
48
|
}
|
|
49
49
|
export default GroupEditor;
|
|
@@ -11,8 +11,8 @@ declare class IframeEditor extends React.Component<IframeEditorProps> {
|
|
|
11
11
|
static widgetName: "iframe";
|
|
12
12
|
static defaultProps: IframeEditorProps;
|
|
13
13
|
change: (arg1: any, arg2: any, arg3: any) => any;
|
|
14
|
-
render(): React.ReactNode;
|
|
15
14
|
handleSettingsChange: (arg1: any) => void;
|
|
16
15
|
serialize: () => any;
|
|
16
|
+
render(): React.ReactNode;
|
|
17
17
|
}
|
|
18
18
|
export default IframeEditor;
|
|
@@ -24,14 +24,13 @@ type State = {
|
|
|
24
24
|
backgroundImageError?: string;
|
|
25
25
|
};
|
|
26
26
|
declare class ImageEditor extends React.Component<Props> {
|
|
27
|
-
_isMounted: boolean;
|
|
28
27
|
static displayName: string;
|
|
29
28
|
static widgetName: string;
|
|
29
|
+
_isMounted: boolean;
|
|
30
30
|
static defaultProps: DefaultProps;
|
|
31
31
|
state: State;
|
|
32
32
|
componentDidMount(): void;
|
|
33
33
|
componentWillUnmount(): void;
|
|
34
|
-
render(): React.JSX.Element;
|
|
35
34
|
_renderRowForLabel(label: any, i: any): React.JSX.Element;
|
|
36
35
|
change(...args: any[]): any;
|
|
37
36
|
removeLabel(labelIndex: any, e: any): void;
|
|
@@ -42,5 +41,6 @@ declare class ImageEditor extends React.Component<Props> {
|
|
|
42
41
|
onUrlChange(url: string | undefined | null, silent: boolean): Promise<void>;
|
|
43
42
|
onRangeChange(type: any, newRange: any): void;
|
|
44
43
|
serialize(): any;
|
|
44
|
+
render(): React.JSX.Element;
|
|
45
45
|
}
|
|
46
46
|
export default ImageEditor;
|
|
@@ -40,7 +40,6 @@ declare class InputNumberEditor extends React.Component<Props> {
|
|
|
40
40
|
static defaultProps: DefaultProps;
|
|
41
41
|
input: React.RefObject<BlurInput>;
|
|
42
42
|
handleAnswerChange: (arg1: string) => void;
|
|
43
|
-
render(): React.ReactNode;
|
|
44
43
|
focus: () => boolean;
|
|
45
44
|
serialize: () => {
|
|
46
45
|
value: Props["value"];
|
|
@@ -51,5 +50,6 @@ declare class InputNumberEditor extends React.Component<Props> {
|
|
|
51
50
|
answerType: Props["answerType"];
|
|
52
51
|
rightAlign: Props["rightAlign"];
|
|
53
52
|
};
|
|
53
|
+
render(): React.ReactNode;
|
|
54
54
|
}
|
|
55
55
|
export default InputNumberEditor;
|
|
@@ -116,7 +116,6 @@ declare const InteractiveGraph: {
|
|
|
116
116
|
trashCan: any;
|
|
117
117
|
vertHairline: any;
|
|
118
118
|
state: any;
|
|
119
|
-
UNSAFE_componentWillMount(): void;
|
|
120
119
|
componentDidMount(): void;
|
|
121
120
|
UNSAFE_componentWillReceiveProps(nextProps: PerseusInteractiveGraphWidgetOptions & {
|
|
122
121
|
widgetId: string;
|
|
@@ -390,8 +389,9 @@ declare const InteractiveGraph: {
|
|
|
390
389
|
isLastUsedWidget: boolean;
|
|
391
390
|
linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
|
|
392
391
|
containerSizeClass: SizingUtils.SizeClass;
|
|
393
|
-
}) | null | undefined) => boolean;
|
|
394
|
-
|
|
392
|
+
}) | null | undefined) => boolean; /**
|
|
393
|
+
* The range of the graph in the x and y directions.
|
|
394
|
+
*/
|
|
395
395
|
setGraphie: (arg1: any) => void;
|
|
396
396
|
handleAddPointsMouseDown: (arg1: import("@khanacademy/perseus").Coord) => void;
|
|
397
397
|
resetGraphie: () => void;
|
|
@@ -493,10 +493,7 @@ declare const InteractiveGraph: {
|
|
|
493
493
|
areAngleGraphsEqual(prevGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypeAngle, currentGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypeAngle): boolean;
|
|
494
494
|
arePointGraphsEqual(prevGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypePoint, currentGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypePoint): boolean;
|
|
495
495
|
arePolygonGraphsEqual(prevGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypePolygon, currentGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypePolygon): boolean;
|
|
496
|
-
areSegmentGraphsEqual(prevGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypeSegment, currentGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypeSegment): boolean;
|
|
497
|
-
* An error message to display in the graph area, or true if the
|
|
498
|
-
* graph is valid.
|
|
499
|
-
*/
|
|
496
|
+
areSegmentGraphsEqual(prevGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypeSegment, currentGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypeSegment): boolean;
|
|
500
497
|
_lineStroke: () => {
|
|
501
498
|
"stroke-width"?: number | undefined;
|
|
502
499
|
};
|
|
@@ -505,12 +502,7 @@ declare const InteractiveGraph: {
|
|
|
505
502
|
addLinearControls: () => void;
|
|
506
503
|
removeLinearControls: () => void;
|
|
507
504
|
addQuadraticControls: () => void;
|
|
508
|
-
updateQuadratic: () => void;
|
|
509
|
-
* The type of markings to display on the graph.
|
|
510
|
-
* - graph: shows the axes and the grid lines
|
|
511
|
-
* - grid: shows only the grid lines
|
|
512
|
-
* - none: shows no markings
|
|
513
|
-
*/
|
|
505
|
+
updateQuadratic: () => void;
|
|
514
506
|
removeQuadraticControls: () => void;
|
|
515
507
|
addSinusoidControls: () => void;
|
|
516
508
|
updateSinusoid: () => void;
|
|
@@ -526,14 +518,20 @@ declare const InteractiveGraph: {
|
|
|
526
518
|
updateCoordsFromPoints: () => void;
|
|
527
519
|
clearCoords: () => void;
|
|
528
520
|
onChange: import("@khanacademy/perseus").ChangeHandler;
|
|
529
|
-
addPointControls: () => void;
|
|
521
|
+
addPointControls: () => void; /**
|
|
522
|
+
* The locked figures to display in the graph area.
|
|
523
|
+
* Locked figures are graph elements (points, lines, line segmeents,
|
|
524
|
+
* etc.) that are locked in place and not interactive.
|
|
525
|
+
*/
|
|
530
526
|
removePointControls: () => void;
|
|
531
527
|
addSegmentControls: () => void;
|
|
532
528
|
removeSegmentControls: () => void;
|
|
533
529
|
addRayControls: () => void;
|
|
534
530
|
removeRayControls: () => void;
|
|
535
531
|
addPolygonControls: () => void;
|
|
536
|
-
updatePolygon: () => void;
|
|
532
|
+
updatePolygon: () => void; /**
|
|
533
|
+
* The graph to display in the graph area.
|
|
534
|
+
*/
|
|
537
535
|
removePolygonControls: () => void;
|
|
538
536
|
addAngleControls: () => void;
|
|
539
537
|
removeAngleControls: () => void;
|
|
@@ -823,6 +821,7 @@ declare const InteractiveGraph: {
|
|
|
823
821
|
containerSizeClass: SizingUtils.SizeClass;
|
|
824
822
|
}>, prevState: Readonly<any>): any;
|
|
825
823
|
componentWillMount?(): void;
|
|
824
|
+
UNSAFE_componentWillMount?(): void;
|
|
826
825
|
componentWillReceiveProps?(nextProps: Readonly<PerseusInteractiveGraphWidgetOptions & {
|
|
827
826
|
widgetId: string;
|
|
828
827
|
alignment: string | null | undefined;
|
|
@@ -1955,7 +1954,6 @@ declare const InteractiveGraph: {
|
|
|
1955
1954
|
trashCan: any;
|
|
1956
1955
|
vertHairline: any;
|
|
1957
1956
|
state: any;
|
|
1958
|
-
UNSAFE_componentWillMount(): void;
|
|
1959
1957
|
componentDidMount(): void;
|
|
1960
1958
|
UNSAFE_componentWillReceiveProps(nextProps: PerseusInteractiveGraphWidgetOptions & {
|
|
1961
1959
|
widgetId: string;
|
|
@@ -2229,8 +2227,9 @@ declare const InteractiveGraph: {
|
|
|
2229
2227
|
isLastUsedWidget: boolean;
|
|
2230
2228
|
linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
|
|
2231
2229
|
containerSizeClass: SizingUtils.SizeClass;
|
|
2232
|
-
}) | null | undefined) => boolean;
|
|
2233
|
-
|
|
2230
|
+
}) | null | undefined) => boolean; /**
|
|
2231
|
+
* The range of the graph in the x and y directions.
|
|
2232
|
+
*/
|
|
2234
2233
|
setGraphie: (arg1: any) => void;
|
|
2235
2234
|
handleAddPointsMouseDown: (arg1: import("@khanacademy/perseus").Coord) => void;
|
|
2236
2235
|
resetGraphie: () => void;
|
|
@@ -2332,10 +2331,7 @@ declare const InteractiveGraph: {
|
|
|
2332
2331
|
areAngleGraphsEqual(prevGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypeAngle, currentGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypeAngle): boolean;
|
|
2333
2332
|
arePointGraphsEqual(prevGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypePoint, currentGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypePoint): boolean;
|
|
2334
2333
|
arePolygonGraphsEqual(prevGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypePolygon, currentGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypePolygon): boolean;
|
|
2335
|
-
areSegmentGraphsEqual(prevGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypeSegment, currentGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypeSegment): boolean;
|
|
2336
|
-
* An error message to display in the graph area, or true if the
|
|
2337
|
-
* graph is valid.
|
|
2338
|
-
*/
|
|
2334
|
+
areSegmentGraphsEqual(prevGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypeSegment, currentGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypeSegment): boolean;
|
|
2339
2335
|
_lineStroke: () => {
|
|
2340
2336
|
"stroke-width"?: number | undefined;
|
|
2341
2337
|
};
|
|
@@ -2344,12 +2340,7 @@ declare const InteractiveGraph: {
|
|
|
2344
2340
|
addLinearControls: () => void;
|
|
2345
2341
|
removeLinearControls: () => void;
|
|
2346
2342
|
addQuadraticControls: () => void;
|
|
2347
|
-
updateQuadratic: () => void;
|
|
2348
|
-
* The type of markings to display on the graph.
|
|
2349
|
-
* - graph: shows the axes and the grid lines
|
|
2350
|
-
* - grid: shows only the grid lines
|
|
2351
|
-
* - none: shows no markings
|
|
2352
|
-
*/
|
|
2343
|
+
updateQuadratic: () => void;
|
|
2353
2344
|
removeQuadraticControls: () => void;
|
|
2354
2345
|
addSinusoidControls: () => void;
|
|
2355
2346
|
updateSinusoid: () => void;
|
|
@@ -2365,14 +2356,20 @@ declare const InteractiveGraph: {
|
|
|
2365
2356
|
updateCoordsFromPoints: () => void;
|
|
2366
2357
|
clearCoords: () => void;
|
|
2367
2358
|
onChange: import("@khanacademy/perseus").ChangeHandler;
|
|
2368
|
-
addPointControls: () => void;
|
|
2359
|
+
addPointControls: () => void; /**
|
|
2360
|
+
* The locked figures to display in the graph area.
|
|
2361
|
+
* Locked figures are graph elements (points, lines, line segmeents,
|
|
2362
|
+
* etc.) that are locked in place and not interactive.
|
|
2363
|
+
*/
|
|
2369
2364
|
removePointControls: () => void;
|
|
2370
2365
|
addSegmentControls: () => void;
|
|
2371
2366
|
removeSegmentControls: () => void;
|
|
2372
2367
|
addRayControls: () => void;
|
|
2373
2368
|
removeRayControls: () => void;
|
|
2374
2369
|
addPolygonControls: () => void;
|
|
2375
|
-
updatePolygon: () => void;
|
|
2370
|
+
updatePolygon: () => void; /**
|
|
2371
|
+
* The graph to display in the graph area.
|
|
2372
|
+
*/
|
|
2376
2373
|
removePolygonControls: () => void;
|
|
2377
2374
|
addAngleControls: () => void;
|
|
2378
2375
|
removeAngleControls: () => void;
|
|
@@ -2662,6 +2659,7 @@ declare const InteractiveGraph: {
|
|
|
2662
2659
|
containerSizeClass: SizingUtils.SizeClass;
|
|
2663
2660
|
}>, prevState: Readonly<any>): any;
|
|
2664
2661
|
componentWillMount?(): void;
|
|
2662
|
+
UNSAFE_componentWillMount?(): void;
|
|
2665
2663
|
componentWillReceiveProps?(nextProps: Readonly<PerseusInteractiveGraphWidgetOptions & {
|
|
2666
2664
|
widgetId: string;
|
|
2667
2665
|
alignment: string | null | undefined;
|
|
@@ -5884,20 +5882,14 @@ type DefaultProps = {
|
|
|
5884
5882
|
* Used in the exercise editor.
|
|
5885
5883
|
*/
|
|
5886
5884
|
declare class InteractiveGraphEditor extends React.Component<Props> {
|
|
5885
|
+
static widgetName: string;
|
|
5887
5886
|
displayName: string;
|
|
5888
5887
|
className: string;
|
|
5889
|
-
static widgetName: string;
|
|
5890
5888
|
static defaultProps: DefaultProps;
|
|
5891
|
-
deprecatedProps: {
|
|
5892
|
-
readonly showGraph: (props: any) => {
|
|
5893
|
-
markings: string;
|
|
5894
|
-
};
|
|
5895
|
-
};
|
|
5896
|
-
UNSAFE_componentWillMount(): void;
|
|
5897
|
-
render(): React.JSX.Element;
|
|
5898
5889
|
changeMatchType: (newValue: any) => void;
|
|
5899
5890
|
changeStartCoords: (coords: any) => void;
|
|
5900
5891
|
serialize(): PerseusInteractiveGraphWidgetOptions;
|
|
5901
5892
|
getSaveWarnings: () => any[];
|
|
5893
|
+
render(): React.JSX.Element;
|
|
5902
5894
|
}
|
|
5903
5895
|
export default InteractiveGraphEditor;
|
|
@@ -11,9 +11,9 @@ declare class MatcherEditor extends React.Component<Props> {
|
|
|
11
11
|
};
|
|
12
12
|
static widgetName: "matcher";
|
|
13
13
|
static defaultProps: Props;
|
|
14
|
-
render(): React.ReactNode;
|
|
15
14
|
onLabelChange: (arg1: number, arg2: React.ChangeEvent<HTMLInputElement>) => void;
|
|
16
15
|
getSaveWarnings: () => ReadonlyArray<string>;
|
|
17
16
|
serialize: any;
|
|
17
|
+
render(): React.ReactNode;
|
|
18
18
|
}
|
|
19
19
|
export default MatcherEditor;
|
|
@@ -12,9 +12,9 @@ declare class MatrixEditor extends React.Component<Props> {
|
|
|
12
12
|
};
|
|
13
13
|
static widgetName: "matrix";
|
|
14
14
|
static defaultProps: Props;
|
|
15
|
-
render(): React.ReactNode;
|
|
16
15
|
change: (arg1: any, arg2: any, arg3: any) => any;
|
|
17
16
|
onMatrixBoardSizeChange: (arg1: [number, number]) => void;
|
|
18
17
|
serialize: () => any;
|
|
18
|
+
render(): React.ReactNode;
|
|
19
19
|
}
|
|
20
20
|
export default MatrixEditor;
|
|
@@ -20,7 +20,6 @@ declare class MeasurerEditor extends React.Component<Props> {
|
|
|
20
20
|
};
|
|
21
21
|
static defaultProps: Props;
|
|
22
22
|
className: string;
|
|
23
|
-
render(): React.ReactNode;
|
|
24
23
|
change: (arg1: any, arg2: any, arg3: any) => any;
|
|
25
24
|
_changeUrl: (arg1: React.ChangeEvent<HTMLInputElement>) => void;
|
|
26
25
|
_changeTop: (arg1: any) => void;
|
|
@@ -28,5 +27,6 @@ declare class MeasurerEditor extends React.Component<Props> {
|
|
|
28
27
|
_changeImage: (arg1: string, arg2: any) => void;
|
|
29
28
|
renderLabelChoices: (arg1: ReadonlyArray<[string, string]>) => ReadonlyArray<React.ReactElement<React.ComponentProps<"option">>>;
|
|
30
29
|
serialize: () => any;
|
|
30
|
+
render(): React.ReactNode;
|
|
31
31
|
}
|
|
32
32
|
export default MeasurerEditor;
|
|
@@ -56,7 +56,6 @@ declare class NumericInputEditor extends React.Component<Props, State> {
|
|
|
56
56
|
rightAlign: boolean;
|
|
57
57
|
};
|
|
58
58
|
constructor(props: Props);
|
|
59
|
-
render(): React.JSX.Element;
|
|
60
59
|
change: (...args: any[]) => any;
|
|
61
60
|
onToggleOptions: (choiceIndex: any) => void;
|
|
62
61
|
onTrashAnswer: (choiceIndex: any) => void;
|
|
@@ -66,5 +65,6 @@ declare class NumericInputEditor extends React.Component<Props, State> {
|
|
|
66
65
|
addAnswer: () => void;
|
|
67
66
|
getSaveWarnings: () => never[];
|
|
68
67
|
serialize: () => any;
|
|
68
|
+
render(): React.JSX.Element;
|
|
69
69
|
}
|
|
70
70
|
export default NumericInputEditor;
|
|
@@ -11,10 +11,10 @@ declare class OrdererEditor extends React.Component<Props> {
|
|
|
11
11
|
};
|
|
12
12
|
static widgetName: "orderer";
|
|
13
13
|
static defaultProps: Props;
|
|
14
|
-
render(): React.ReactNode;
|
|
15
14
|
onOptionsChange: (arg1: "correctOptions" | "otherOptions", arg2: any, arg3: any) => any;
|
|
16
15
|
onLayoutChange: (arg1: React.ChangeEvent<HTMLInputElement>) => void;
|
|
17
16
|
onHeightChange: (arg1: React.ChangeEvent<HTMLInputElement>) => void;
|
|
18
17
|
serialize: () => any;
|
|
18
|
+
render(): React.ReactNode;
|
|
19
19
|
}
|
|
20
20
|
export default OrdererEditor;
|
|
@@ -13,7 +13,8 @@ type Props = DefaultProps & {
|
|
|
13
13
|
declare class PhetSimulationEditor extends React.Component<Props> {
|
|
14
14
|
static defaultProps: DefaultProps;
|
|
15
15
|
static widgetName: "phet-simulation";
|
|
16
|
-
render(): React.ReactNode;
|
|
17
16
|
serialize(): PerseusPhetSimulationWidgetOptions;
|
|
17
|
+
getSaveWarnings: () => ReadonlyArray<string>;
|
|
18
|
+
render(): React.ReactNode;
|
|
18
19
|
}
|
|
19
20
|
export default PhetSimulationEditor;
|
|
@@ -45,7 +45,6 @@ declare class RadioEditor extends React.Component<any> {
|
|
|
45
45
|
};
|
|
46
46
|
static widgetName: "radio";
|
|
47
47
|
static defaultProps: any;
|
|
48
|
-
render(): React.ReactNode;
|
|
49
48
|
change: (...args: ReadonlyArray<unknown>) => any;
|
|
50
49
|
onMultipleSelectChange: (arg1: any) => any;
|
|
51
50
|
onCountChoicesChange: (arg1: any) => void;
|
|
@@ -58,5 +57,6 @@ declare class RadioEditor extends React.Component<any> {
|
|
|
58
57
|
focus: () => boolean;
|
|
59
58
|
getSaveWarnings: () => ReadonlyArray<string>;
|
|
60
59
|
serialize: () => any;
|
|
60
|
+
render(): React.ReactNode;
|
|
61
61
|
}
|
|
62
62
|
export default RadioEditor;
|
|
@@ -13,8 +13,8 @@ declare class TableEditor extends React.Component<Props> {
|
|
|
13
13
|
static defaultProps: Props;
|
|
14
14
|
numberOfColumns: React.RefObject<components.NumberInput>;
|
|
15
15
|
focus: () => void;
|
|
16
|
-
render(): React.ReactNode;
|
|
17
16
|
onSizeInput: (arg1: number, arg2: number) => void;
|
|
18
17
|
serialize: () => any;
|
|
18
|
+
render(): React.ReactNode;
|
|
19
19
|
}
|
|
20
20
|
export default TableEditor;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Perseus editors",
|
|
4
4
|
"author": "Khan Academy",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "
|
|
6
|
+
"version": "14.0.1",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@khanacademy/keypad-context": "^1.0.1",
|
|
39
39
|
"@khanacademy/kmath": "^0.1.13",
|
|
40
40
|
"@khanacademy/math-input": "^21.0.2",
|
|
41
|
-
"@khanacademy/perseus": "^
|
|
41
|
+
"@khanacademy/perseus": "^32.0.1",
|
|
42
42
|
"@khanacademy/perseus-core": "1.5.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
package/dist/all-widgets.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
declare const _default: readonly Readonly<{
|
|
3
|
-
name: string;
|
|
4
|
-
displayName: string;
|
|
5
|
-
getWidget?: (() => import("react").ComponentType<any>) | undefined;
|
|
6
|
-
widget: import("react").ComponentType<any>;
|
|
7
|
-
accessible?: boolean | ((props: any) => boolean) | undefined;
|
|
8
|
-
hidden?: boolean | undefined;
|
|
9
|
-
version?: import("@khanacademy/perseus").Version | undefined;
|
|
10
|
-
supportedAlignments?: readonly import("@khanacademy/perseus").Alignment[] | undefined;
|
|
11
|
-
defaultAlignment?: import("@khanacademy/perseus").Alignment | undefined;
|
|
12
|
-
getDefaultAlignment?: (() => import("@khanacademy/perseus").Alignment) | undefined;
|
|
13
|
-
isLintable?: boolean | undefined;
|
|
14
|
-
tracking?: import("../../perseus/src/types").Tracking | undefined;
|
|
15
|
-
traverseChildWidgets?: any;
|
|
16
|
-
transform?: import("../../perseus/src/types").WidgetTransform | undefined;
|
|
17
|
-
staticTransform?: import("../../perseus/src/types").WidgetTransform | undefined;
|
|
18
|
-
propUpgrades?: {
|
|
19
|
-
[key: string]: (arg1: any) => any;
|
|
20
|
-
} | undefined;
|
|
21
|
-
}>[];
|
|
22
|
-
export default _default;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
declare const _default: readonly Readonly<{
|
|
3
|
-
name: string;
|
|
4
|
-
displayName: string;
|
|
5
|
-
getWidget?: (() => import("react").ComponentType<any>) | undefined;
|
|
6
|
-
widget: import("react").ComponentType<any>;
|
|
7
|
-
accessible?: boolean | ((props: any) => boolean) | undefined;
|
|
8
|
-
hidden?: boolean | undefined;
|
|
9
|
-
version?: import("@khanacademy/perseus").Version | undefined;
|
|
10
|
-
supportedAlignments?: readonly import("@khanacademy/perseus").Alignment[] | undefined;
|
|
11
|
-
defaultAlignment?: import("@khanacademy/perseus").Alignment | undefined;
|
|
12
|
-
getDefaultAlignment?: (() => import("@khanacademy/perseus").Alignment) | undefined;
|
|
13
|
-
isLintable?: boolean | undefined;
|
|
14
|
-
tracking?: import("../../perseus/src/types").Tracking | undefined;
|
|
15
|
-
traverseChildWidgets?: any;
|
|
16
|
-
transform?: import("../../perseus/src/types").WidgetTransform | undefined;
|
|
17
|
-
staticTransform?: import("../../perseus/src/types").WidgetTransform | undefined;
|
|
18
|
-
propUpgrades?: {
|
|
19
|
-
[key: string]: (arg1: any) => any;
|
|
20
|
-
} | undefined;
|
|
21
|
-
}>[];
|
|
22
|
-
export default _default;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
type Props = any;
|
|
3
|
-
/**
|
|
4
|
-
* This is the widget's editor. This is what shows up on the left side
|
|
5
|
-
* of the screen in the demo page. Only the question writer sees this.
|
|
6
|
-
*/
|
|
7
|
-
declare class ExampleGraphieWidgetEditor extends React.Component<Props> {
|
|
8
|
-
static propTypes: {
|
|
9
|
-
onChange: import("prop-types").Validator<(...args: any[]) => any>;
|
|
10
|
-
};
|
|
11
|
-
static widgetName: "example-graphie-widget";
|
|
12
|
-
static defaultProps: Props;
|
|
13
|
-
change: (arg1: any, arg2: any, arg3: any) => any;
|
|
14
|
-
handleChange: (arg1: any) => void;
|
|
15
|
-
serialize: () => any;
|
|
16
|
-
render(): React.ReactNode;
|
|
17
|
-
}
|
|
18
|
-
export default ExampleGraphieWidgetEditor;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is an example graphie-using widget
|
|
3
|
-
*
|
|
4
|
-
* TODO(jack): Add more comments
|
|
5
|
-
*/
|
|
6
|
-
import { Changeable } from "@khanacademy/perseus";
|
|
7
|
-
import * as React from "react";
|
|
8
|
-
import type { Coord, PerseusExampleGraphieWidgetOptions, APIOptionsWithDefaults } from "@khanacademy/perseus";
|
|
9
|
-
type Props = Changeable.ChangeableProps & {
|
|
10
|
-
apiOptions: APIOptionsWithDefaults;
|
|
11
|
-
graph: PerseusExampleGraphieWidgetOptions["graph"];
|
|
12
|
-
coord: PerseusExampleGraphieWidgetOptions["coord"];
|
|
13
|
-
};
|
|
14
|
-
type DefaultProps = {
|
|
15
|
-
graph: Props["graph"];
|
|
16
|
-
coord: Props["coord"];
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* This is the widget's renderer. It shows up in the right column
|
|
20
|
-
* in the demo, and is what is visible to users, and where
|
|
21
|
-
* users enter their answers.
|
|
22
|
-
*/
|
|
23
|
-
declare class ExampleGraphieWidget extends React.Component<Props> {
|
|
24
|
-
static defaultProps: DefaultProps;
|
|
25
|
-
/**
|
|
26
|
-
* This is the widget's grading function
|
|
27
|
-
*/
|
|
28
|
-
static validate(state: any, rubric: any): any;
|
|
29
|
-
getUserInput: () => any;
|
|
30
|
-
render(): React.ReactNode;
|
|
31
|
-
change: (arg1: any, arg2: any, arg3: any) => any;
|
|
32
|
-
movePoint: (arg1: Coord) => void;
|
|
33
|
-
_getGridConfig: (arg1: any) => any;
|
|
34
|
-
setupGraphie: (arg1: any, arg2: any) => any;
|
|
35
|
-
simpleValidate: (arg1: any) => any;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* For this widget to work, we must export it.
|
|
39
|
-
* We also must import this file in src/all-widgets.js
|
|
40
|
-
*/
|
|
41
|
-
declare const _default: Readonly<{
|
|
42
|
-
name: string;
|
|
43
|
-
displayName: string;
|
|
44
|
-
getWidget?: (() => typeof ExampleGraphieWidget) | undefined;
|
|
45
|
-
widget: typeof ExampleGraphieWidget;
|
|
46
|
-
accessible?: boolean | ((props: any) => boolean) | undefined;
|
|
47
|
-
hidden?: boolean | undefined;
|
|
48
|
-
version?: import("@khanacademy/perseus").Version | undefined;
|
|
49
|
-
supportedAlignments?: readonly import("@khanacademy/perseus").Alignment[] | undefined;
|
|
50
|
-
defaultAlignment?: import("@khanacademy/perseus").Alignment | undefined;
|
|
51
|
-
getDefaultAlignment?: (() => import("@khanacademy/perseus").Alignment) | undefined;
|
|
52
|
-
isLintable?: boolean | undefined;
|
|
53
|
-
tracking?: import("../../../perseus/src/types").Tracking | undefined;
|
|
54
|
-
traverseChildWidgets?: any;
|
|
55
|
-
transform?: import("../../../perseus/src/types").WidgetTransform | undefined;
|
|
56
|
-
staticTransform?: import("../../../perseus/src/types").WidgetTransform | undefined;
|
|
57
|
-
propUpgrades?: {
|
|
58
|
-
[key: string]: (arg1: any) => any;
|
|
59
|
-
} | undefined;
|
|
60
|
-
}>;
|
|
61
|
-
export default _default;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
type Props = any;
|
|
3
|
-
/**
|
|
4
|
-
* This is the widget's editor. This is what shows up on the left side
|
|
5
|
-
* of the screen in the demo. Only the question writer sees this.
|
|
6
|
-
*/
|
|
7
|
-
declare class ExampleWidgetEditor extends React.Component<Props> {
|
|
8
|
-
static propTypes: {
|
|
9
|
-
onChange: import("prop-types").Validator<(...args: any[]) => any>;
|
|
10
|
-
};
|
|
11
|
-
static widgetName: "example-widget";
|
|
12
|
-
static defaultProps: Props;
|
|
13
|
-
input: React.RefObject<HTMLInputElement>;
|
|
14
|
-
handleAnswerChange: (arg1: React.ChangeEvent<HTMLInputElement>) => void;
|
|
15
|
-
render(): React.ReactNode;
|
|
16
|
-
change: (arg1: any, arg2: any, arg3: any) => any;
|
|
17
|
-
focus: () => boolean;
|
|
18
|
-
serialize: () => any;
|
|
19
|
-
}
|
|
20
|
-
export default ExampleWidgetEditor;
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is a simple number-entry widget
|
|
3
|
-
* It is not as powerful as number-input, but has a simpler, more
|
|
4
|
-
* representative structure as an example widget, and is easier to
|
|
5
|
-
* test new ideas on.
|
|
6
|
-
*
|
|
7
|
-
* TODO(jack): Add more comments
|
|
8
|
-
*/
|
|
9
|
-
import { Changeable } from "@khanacademy/perseus";
|
|
10
|
-
import * as React from "react";
|
|
11
|
-
import type { PerseusExampleWidgetOptions } from "@khanacademy/perseus";
|
|
12
|
-
type Props = Changeable.ChangeableProps & {
|
|
13
|
-
value: PerseusExampleWidgetOptions["value"];
|
|
14
|
-
};
|
|
15
|
-
declare class TextInput extends React.Component<Props> {
|
|
16
|
-
input: React.RefObject<HTMLInputElement>;
|
|
17
|
-
render(): React.ReactNode;
|
|
18
|
-
focus: () => boolean;
|
|
19
|
-
changeValue: (e: any) => void;
|
|
20
|
-
}
|
|
21
|
-
type DefaultProps = {
|
|
22
|
-
value: Props["value"];
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* This is the widget's renderer. It shows up in the right column
|
|
26
|
-
* in the demo, and is what is visible to users, and where
|
|
27
|
-
* users enter their answers.
|
|
28
|
-
*/
|
|
29
|
-
declare class ExampleWidget extends React.Component<Props> {
|
|
30
|
-
static defaultProps: DefaultProps;
|
|
31
|
-
input: React.RefObject<TextInput>;
|
|
32
|
-
/**
|
|
33
|
-
* This is the widget's grading function. simpleValidate generally
|
|
34
|
-
* defers to this function.
|
|
35
|
-
*
|
|
36
|
-
* value is usually the result of getUserInput on the widget
|
|
37
|
-
* rubric is the result of calling serialize() on the editor
|
|
38
|
-
*/
|
|
39
|
-
static validate(value: string, rubric: any): any;
|
|
40
|
-
/**
|
|
41
|
-
* Tell our parent to update our props.
|
|
42
|
-
*/
|
|
43
|
-
change: (arg1: any, arg2: any, arg3: any) => any;
|
|
44
|
-
render(): React.ReactNode;
|
|
45
|
-
getUserInput: () => string;
|
|
46
|
-
/**
|
|
47
|
-
* Widgets that are focusable should add a focus method that returns
|
|
48
|
-
* true if focusing succeeded. The first such widget found will be
|
|
49
|
-
* focused on page load.
|
|
50
|
-
*/
|
|
51
|
-
focus: () => boolean;
|
|
52
|
-
/**
|
|
53
|
-
* simpleValidate is called for grading. Rubric is the result of calling
|
|
54
|
-
* getUserInput() on the editor that created this widget.
|
|
55
|
-
*
|
|
56
|
-
* Should return an object representing the grading result, such as
|
|
57
|
-
* {
|
|
58
|
-
* type: "points",
|
|
59
|
-
* earned: 1,
|
|
60
|
-
* total: 1,
|
|
61
|
-
* message: null
|
|
62
|
-
* }
|
|
63
|
-
*/
|
|
64
|
-
simpleValidate: (arg1: any) => any;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* For this widget to work, we must import this file in src/all-widgets.js
|
|
68
|
-
*/
|
|
69
|
-
declare const _default: Readonly<{
|
|
70
|
-
name: string;
|
|
71
|
-
displayName: string;
|
|
72
|
-
getWidget?: (() => typeof ExampleWidget) | undefined;
|
|
73
|
-
widget: typeof ExampleWidget;
|
|
74
|
-
accessible?: boolean | ((props: any) => boolean) | undefined;
|
|
75
|
-
hidden?: boolean | undefined;
|
|
76
|
-
version?: import("@khanacademy/perseus").Version | undefined;
|
|
77
|
-
supportedAlignments?: readonly import("@khanacademy/perseus").Alignment[] | undefined;
|
|
78
|
-
defaultAlignment?: import("@khanacademy/perseus").Alignment | undefined;
|
|
79
|
-
getDefaultAlignment?: (() => import("@khanacademy/perseus").Alignment) | undefined;
|
|
80
|
-
isLintable?: boolean | undefined;
|
|
81
|
-
tracking?: import("../../../perseus/src/types").Tracking | undefined;
|
|
82
|
-
traverseChildWidgets?: any;
|
|
83
|
-
transform?: import("../../../perseus/src/types").WidgetTransform | undefined;
|
|
84
|
-
staticTransform?: import("../../../perseus/src/types").WidgetTransform | undefined;
|
|
85
|
-
propUpgrades?: {
|
|
86
|
-
[key: string]: (arg1: any) => any;
|
|
87
|
-
} | undefined;
|
|
88
|
-
}>;
|
|
89
|
-
export default _default;
|