@khanacademy/perseus 37.0.0 → 38.0.0
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-widgets.d.ts +1 -0
- package/dist/basic-widgets.d.ts +1 -0
- package/dist/es/index.js +134 -114
- package/dist/es/index.js.map +1 -1
- package/dist/extra-widgets.d.ts +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +131 -112
- package/dist/index.js.map +1 -1
- package/dist/multi-items/item-types.d.ts +4 -3
- package/dist/perseus-api.d.ts +7 -6
- package/dist/perseus-types.d.ts +31 -30
- package/dist/server-item-renderer.d.ts +8 -9
- package/dist/types.d.ts +3 -5
- package/dist/util/extract-perseus-data.d.ts +1 -1
- package/dist/validation.types.d.ts +4 -11
- package/dist/widgets/categorizer/categorizer.d.ts +1 -0
- package/dist/widgets/cs-program/cs-program.d.ts +1 -0
- package/dist/widgets/definition/definition.d.ts +1 -0
- package/dist/widgets/deprecated-standin/deprecated-standin.d.ts +1 -0
- package/dist/widgets/dropdown/dropdown.d.ts +1 -0
- package/dist/widgets/explanation/explanation.d.ts +1 -0
- package/dist/widgets/expression/expression.d.ts +43 -37
- package/dist/widgets/graded-group/graded-group.d.ts +1 -0
- package/dist/widgets/graded-group-set/graded-group-set.d.ts +1 -0
- package/dist/widgets/grapher/grapher-types.d.ts +58 -0
- package/dist/widgets/grapher/grapher-validator.d.ts +1 -1
- package/dist/widgets/grapher/grapher.d.ts +1 -0
- package/dist/widgets/grapher/util.d.ts +16 -3
- package/dist/widgets/group/group.d.ts +1 -0
- package/dist/widgets/iframe/iframe.d.ts +1 -0
- package/dist/widgets/image/image.d.ts +1 -0
- package/dist/widgets/input-number/input-number.d.ts +1 -1
- package/dist/widgets/interaction/interaction.d.ts +1 -0
- package/dist/widgets/interactive-graph.d.ts +1 -0
- package/dist/widgets/interactive-graphs/mafs-supported-graph-types.d.ts +1 -1
- package/dist/widgets/label-image/label-image.d.ts +15 -12
- package/dist/widgets/matcher/matcher.d.ts +1 -0
- package/dist/widgets/matrix/matrix.d.ts +1 -0
- package/dist/widgets/measurer/measurer.d.ts +1 -0
- package/dist/widgets/molecule/molecule.d.ts +1 -0
- package/dist/widgets/number-line/number-line.d.ts +1 -0
- package/dist/widgets/numeric-input/numeric-input.d.ts +1 -1
- package/dist/widgets/orderer/orderer.d.ts +1 -0
- package/dist/widgets/passage/passage.d.ts +1 -0
- package/dist/widgets/passage-ref/passage-ref.d.ts +1 -0
- package/dist/widgets/passage-ref-target/passage-ref-target.d.ts +1 -0
- package/dist/widgets/phet-simulation/phet-simulation.d.ts +1 -0
- package/dist/widgets/plotter/plotter.d.ts +1 -0
- package/dist/widgets/python-program/python-program.d.ts +1 -0
- package/dist/widgets/radio/radio.d.ts +1 -0
- package/dist/widgets/sorter/sorter.d.ts +1 -0
- package/dist/widgets/table/table.d.ts +1 -0
- package/dist/widgets/video/video.d.ts +1 -0
- package/dist/widgets.d.ts +1 -0
- package/package.json +1 -1
|
@@ -9,18 +9,19 @@
|
|
|
9
9
|
* - And the various types of nodes that compose a tree.
|
|
10
10
|
*/
|
|
11
11
|
import type { Tree, ArrayNode, ObjectNode } from "./tree-types";
|
|
12
|
-
import type {
|
|
12
|
+
import type { PerseusWidgetsMap } from "../perseus-types";
|
|
13
|
+
import type { ImageDict } from "../types";
|
|
13
14
|
export type ContentNode = {
|
|
14
15
|
__type: "content" | "item";
|
|
15
16
|
content?: string | null | undefined;
|
|
16
17
|
images?: ImageDict | null | undefined;
|
|
17
|
-
widgets?:
|
|
18
|
+
widgets?: PerseusWidgetsMap | null | undefined;
|
|
18
19
|
};
|
|
19
20
|
export type HintNode = {
|
|
20
21
|
__type: "hint";
|
|
21
22
|
content?: string | null | undefined;
|
|
22
23
|
images?: ImageDict | null | undefined;
|
|
23
|
-
widgets?:
|
|
24
|
+
widgets?: PerseusWidgetsMap | null | undefined;
|
|
24
25
|
replace?: boolean | null | undefined;
|
|
25
26
|
};
|
|
26
27
|
export type TagsNode = ReadonlyArray<string>;
|
package/dist/perseus-api.d.ts
CHANGED
|
@@ -89,17 +89,18 @@ export declare const ApiOptions: {
|
|
|
89
89
|
editorChangeDelay?: number | undefined;
|
|
90
90
|
flags?: {
|
|
91
91
|
mafs?: false | ({
|
|
92
|
-
circle?: boolean | undefined;
|
|
93
|
-
polygon?: boolean | undefined;
|
|
94
92
|
none?: boolean | undefined;
|
|
95
93
|
linear?: boolean | undefined;
|
|
96
|
-
|
|
97
|
-
|
|
94
|
+
circle?: boolean | undefined;
|
|
95
|
+
polygon?: boolean | undefined;
|
|
98
96
|
point?: boolean | undefined;
|
|
99
|
-
ray?: boolean | undefined;
|
|
100
|
-
segment?: boolean | undefined;
|
|
101
97
|
angle?: boolean | undefined;
|
|
98
|
+
segment?: boolean | undefined;
|
|
102
99
|
"linear-system"?: boolean | undefined;
|
|
100
|
+
ray?: boolean | undefined;
|
|
101
|
+
"unlimited-polygon"?: boolean | undefined;
|
|
102
|
+
quadratic?: boolean | undefined;
|
|
103
|
+
sinusoid?: boolean | undefined;
|
|
103
104
|
"unlimited-point"?: boolean | undefined;
|
|
104
105
|
} & {
|
|
105
106
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
package/dist/perseus-types.d.ts
CHANGED
|
@@ -248,38 +248,39 @@ export type GraphRange = [
|
|
|
248
248
|
x: [min: number, max: number],
|
|
249
249
|
y: [min: number, max: number]
|
|
250
250
|
];
|
|
251
|
+
export type GrapherAnswerTypes = {
|
|
252
|
+
type: "absolute_value";
|
|
253
|
+
coords: [
|
|
254
|
+
Coord,
|
|
255
|
+
Coord
|
|
256
|
+
];
|
|
257
|
+
} | {
|
|
258
|
+
type: "exponential";
|
|
259
|
+
asymptote: [Coord, Coord];
|
|
260
|
+
coords: [Coord, Coord];
|
|
261
|
+
} | {
|
|
262
|
+
type: "linear";
|
|
263
|
+
coords: [Coord, Coord];
|
|
264
|
+
} | {
|
|
265
|
+
type: "logarithm";
|
|
266
|
+
asymptote: [Coord, Coord];
|
|
267
|
+
coords: [Coord, Coord];
|
|
268
|
+
} | {
|
|
269
|
+
type: "quadratic";
|
|
270
|
+
coords: [
|
|
271
|
+
Coord,
|
|
272
|
+
Coord
|
|
273
|
+
];
|
|
274
|
+
} | {
|
|
275
|
+
type: "sinusoid";
|
|
276
|
+
coords: [Coord, Coord];
|
|
277
|
+
} | {
|
|
278
|
+
type: "tangent";
|
|
279
|
+
coords: [Coord, Coord];
|
|
280
|
+
};
|
|
251
281
|
export type PerseusGrapherWidgetOptions = {
|
|
252
282
|
availableTypes: ReadonlyArray<"absolute_value" | "exponential" | "linear" | "logarithm" | "quadratic" | "sinusoid" | "tangent">;
|
|
253
|
-
correct:
|
|
254
|
-
type: "absolute_value";
|
|
255
|
-
coords: [
|
|
256
|
-
Coord,
|
|
257
|
-
Coord
|
|
258
|
-
];
|
|
259
|
-
} | {
|
|
260
|
-
type: "exponential";
|
|
261
|
-
asymptote: [Coord, Coord];
|
|
262
|
-
coords: [Coord, Coord];
|
|
263
|
-
} | {
|
|
264
|
-
type: "linear";
|
|
265
|
-
coords: [Coord, Coord];
|
|
266
|
-
} | {
|
|
267
|
-
type: "logarithm";
|
|
268
|
-
asymptote: [Coord, Coord];
|
|
269
|
-
coords: [Coord, Coord];
|
|
270
|
-
} | {
|
|
271
|
-
type: "quadratic";
|
|
272
|
-
coords: [
|
|
273
|
-
Coord,
|
|
274
|
-
Coord
|
|
275
|
-
];
|
|
276
|
-
} | {
|
|
277
|
-
type: "sinusoid";
|
|
278
|
-
coords: [Coord, Coord];
|
|
279
|
-
} | {
|
|
280
|
-
type: "tangent";
|
|
281
|
-
coords: [Coord, Coord];
|
|
282
|
-
};
|
|
283
|
+
correct: GrapherAnswerTypes;
|
|
283
284
|
graph: {
|
|
284
285
|
backgroundImage: {
|
|
285
286
|
bottom?: number;
|
|
@@ -118,9 +118,7 @@ declare const ref: React.ForwardRefExoticComponent<Omit<Pick<SharedRendererProps
|
|
|
118
118
|
id: string;
|
|
119
119
|
correct?: boolean | undefined;
|
|
120
120
|
} & Partial<import("./types").TrackingGradedGroupExtraArguments> & Partial<import("./types").TrackingSequenceExtraArguments>) => void) | undefined;
|
|
121
|
-
customKeypad?: boolean | undefined;
|
|
122
|
-
* Get a representation of the current state of the item.
|
|
123
|
-
*/
|
|
121
|
+
customKeypad?: boolean | undefined;
|
|
124
122
|
nativeKeypadProxy?: ((blur: () => void) => KeypadAPI) | undefined;
|
|
125
123
|
isMobile?: boolean | undefined;
|
|
126
124
|
setDrawingAreaAvailable?: ((arg1: boolean) => unknown) | undefined;
|
|
@@ -130,17 +128,18 @@ declare const ref: React.ForwardRefExoticComponent<Omit<Pick<SharedRendererProps
|
|
|
130
128
|
editorChangeDelay?: number | undefined;
|
|
131
129
|
flags?: {
|
|
132
130
|
mafs?: false | ({
|
|
133
|
-
circle?: boolean | undefined;
|
|
134
|
-
polygon?: boolean | undefined;
|
|
135
131
|
none?: boolean | undefined;
|
|
136
132
|
linear?: boolean | undefined;
|
|
137
|
-
|
|
138
|
-
|
|
133
|
+
circle?: boolean | undefined;
|
|
134
|
+
polygon?: boolean | undefined;
|
|
139
135
|
point?: boolean | undefined;
|
|
140
|
-
ray?: boolean | undefined;
|
|
141
|
-
segment?: boolean | undefined;
|
|
142
136
|
angle?: boolean | undefined;
|
|
137
|
+
segment?: boolean | undefined;
|
|
143
138
|
"linear-system"?: boolean | undefined;
|
|
139
|
+
ray?: boolean | undefined;
|
|
140
|
+
"unlimited-polygon"?: boolean | undefined;
|
|
141
|
+
quadratic?: boolean | undefined;
|
|
142
|
+
sinusoid?: boolean | undefined;
|
|
144
143
|
"unlimited-point"?: boolean | undefined;
|
|
145
144
|
} & {
|
|
146
145
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
package/dist/types.d.ts
CHANGED
|
@@ -57,9 +57,6 @@ export interface Widget {
|
|
|
57
57
|
showRationalesForCurrentlySelectedChoices?: (options?: any) => void;
|
|
58
58
|
examples?: () => ReadonlyArray<string>;
|
|
59
59
|
}
|
|
60
|
-
export type WidgetDict = {
|
|
61
|
-
[name: string]: PerseusWidget;
|
|
62
|
-
};
|
|
63
60
|
export type ImageDict = {
|
|
64
61
|
[url: string]: Dimensions;
|
|
65
62
|
};
|
|
@@ -91,7 +88,7 @@ export type ChangeHandler = (arg1: {
|
|
|
91
88
|
hints?: ReadonlyArray<Hint>;
|
|
92
89
|
replace?: boolean;
|
|
93
90
|
content?: string;
|
|
94
|
-
widgets?:
|
|
91
|
+
widgets?: PerseusWidgetsMap;
|
|
95
92
|
images?: ImageDict;
|
|
96
93
|
question?: any;
|
|
97
94
|
answerArea?: PerseusAnswerArea | null;
|
|
@@ -115,7 +112,7 @@ type TrackInteractionArgs = {
|
|
|
115
112
|
id: string;
|
|
116
113
|
correct?: boolean;
|
|
117
114
|
} & Partial<TrackingGradedGroupExtraArguments> & Partial<TrackingSequenceExtraArguments>;
|
|
118
|
-
export declare const MafsGraphTypeFlags: readonly ["angle", "segment", "linear", "linear-system", "ray", "polygon", "circle", "quadratic", "sinusoid", "point", "unlimited-point", "none"];
|
|
115
|
+
export declare const MafsGraphTypeFlags: readonly ["angle", "segment", "linear", "linear-system", "ray", "polygon", "unlimited-polygon", "circle", "quadratic", "sinusoid", "point", "unlimited-point", "none"];
|
|
119
116
|
export declare const InteractiveGraphLockedFeaturesFlags: readonly ["interactive-graph-locked-features-labels", "locked-figures-aria", "locked-point-labels", "locked-line-labels", "locked-vector-labels", "locked-ellipse-labels", "locked-polygon-labels", "locked-function-labels"];
|
|
120
117
|
/**
|
|
121
118
|
* APIOptions provides different ways to customize the behaviour of Perseus.
|
|
@@ -387,6 +384,7 @@ export type WidgetExports<T extends React.ComponentType<any> & Widget = React.Co
|
|
|
387
384
|
static renders */
|
|
388
385
|
staticTransform?: WidgetTransform;
|
|
389
386
|
validator?: WidgetValidatorFunction;
|
|
387
|
+
getOneCorrectAnswerFromRubric?: (rubric: Rubric) => string | null | undefined;
|
|
390
388
|
/**
|
|
391
389
|
A map of major version numbers (as a string, eg "1") to a function that
|
|
392
390
|
migrates from the _previous_ major version.
|
|
@@ -36,7 +36,7 @@ declare function getImagesWithoutAltData(perseusRenderer: PerseusRenderer): stri
|
|
|
36
36
|
export declare const isWrongAnswerSupported: (widgetIds: Array<string>, widgetMap: PerseusWidgetsMap) => boolean;
|
|
37
37
|
export declare const shouldHaveIndividualAnswer: (widgetId: string, widgetMap: PerseusWidgetsMap) => boolean;
|
|
38
38
|
export declare const getAnswerFromUserInput: (widgetType: string, userInput: any) => any;
|
|
39
|
-
export declare const getCorrectAnswerForWidgetId: (widgetId: string, itemData: PerseusItem) => string | undefined;
|
|
39
|
+
export declare const getCorrectAnswerForWidgetId: (widgetId: string, itemData: PerseusItem) => string | null | undefined;
|
|
40
40
|
export declare const isWidgetIdInContent: (perseusItem: PerseusItem, widgetId: string) => boolean;
|
|
41
41
|
export declare const getValidWidgetIds: (perseusItem: PerseusItem) => Array<string>;
|
|
42
42
|
export { getAnswersFromWidgets, getImagesWithoutAltData, injectWidgets };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { PerseusDefinitionWidgetOptions, PerseusDropdownChoice, PerseusExplanationWidgetOptions, PerseusExpressionAnswerForm, PerseusGradedGroupSetWidgetOptions, PerseusGradedGroupWidgetOptions, PerseusGrapherWidgetOptions, PerseusGraphType, PerseusGroupWidgetOptions, PerseusIFrameWidgetOptions, PerseusImageWidgetOptions, PerseusInputNumberWidgetOptions, PerseusInteractionWidgetOptions, PerseusLabelImageWidgetOptions, PerseusMatcherWidgetOptions, PerseusMatrixWidgetOptions, PerseusNumberLineWidgetOptions, PerseusNumericInputWidgetOptions, PerseusOrdererWidgetOptions, PerseusPassageRefWidgetOptions, PerseusPassageWidgetOptions, PerseusPlotterWidgetOptions, PerseusRadioWidgetOptions, PerseusSorterWidgetOptions, PerseusTableWidgetOptions, PerseusVideoWidgetOptions } from "./perseus-types";
|
|
1
|
+
import type { GrapherAnswerTypes, PerseusDefinitionWidgetOptions, PerseusDropdownChoice, PerseusExplanationWidgetOptions, PerseusExpressionAnswerForm, PerseusGradedGroupSetWidgetOptions, PerseusGradedGroupWidgetOptions, PerseusGraphType, PerseusGroupWidgetOptions, PerseusIFrameWidgetOptions, PerseusImageWidgetOptions, PerseusInputNumberWidgetOptions, PerseusInteractionWidgetOptions, PerseusLabelImageWidgetOptions, PerseusMatcherWidgetOptions, PerseusMatrixWidgetOptions, PerseusNumberLineWidgetOptions, PerseusNumericInputWidgetOptions, PerseusOrdererWidgetOptions, PerseusPassageRefWidgetOptions, PerseusPassageWidgetOptions, PerseusPlotterWidgetOptions, PerseusRadioWidgetOptions, PerseusSorterWidgetOptions, PerseusTableWidgetOptions, PerseusVideoWidgetOptions } from "./perseus-types";
|
|
3
2
|
import type { InteractiveMarkerType } from "./widgets/label-image/types";
|
|
4
3
|
import type { Relationship } from "./widgets/number-line/number-line";
|
|
5
4
|
export type UserInputStatus = "correct" | "incorrect" | "incomplete";
|
|
@@ -30,16 +29,10 @@ export type PerseusExpressionUserInput = string;
|
|
|
30
29
|
export type PerseusGroupRubric = PerseusGroupWidgetOptions;
|
|
31
30
|
export type PerseusGradedGroupRubric = PerseusGradedGroupWidgetOptions;
|
|
32
31
|
export type PerseusGradedGroupSetRubric = PerseusGradedGroupSetWidgetOptions;
|
|
33
|
-
export type PerseusGrapherRubric =
|
|
34
|
-
|
|
35
|
-
* TODO: this is kind of just a guess right now
|
|
36
|
-
* based off of an old comment in grapher
|
|
37
|
-
*/
|
|
38
|
-
export type PerseusGrapherUserInput = {
|
|
39
|
-
type: string;
|
|
40
|
-
asymptote: ReadonlyArray<Coord>;
|
|
41
|
-
coords: ReadonlyArray<Coord>;
|
|
32
|
+
export type PerseusGrapherRubric = {
|
|
33
|
+
correct: GrapherAnswerTypes;
|
|
42
34
|
};
|
|
35
|
+
export type PerseusGrapherUserInput = PerseusGrapherRubric["correct"];
|
|
43
36
|
export type PerseusIFrameRubric = PerseusIFrameWidgetOptions;
|
|
44
37
|
export type PerseusIFrameUserInput = {
|
|
45
38
|
status: UserInputStatus;
|
|
@@ -52,6 +52,7 @@ declare const _default: Readonly<{
|
|
|
52
52
|
transform?: import("../../types").WidgetTransform | undefined;
|
|
53
53
|
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
54
54
|
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
55
|
+
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
55
56
|
propUpgrades?: {
|
|
56
57
|
[key: string]: (arg1: any) => any;
|
|
57
58
|
} | undefined;
|
|
@@ -39,6 +39,7 @@ declare const _default: Readonly<{
|
|
|
39
39
|
transform?: import("../../types").WidgetTransform | undefined;
|
|
40
40
|
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
41
41
|
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
42
|
+
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
42
43
|
propUpgrades?: {
|
|
43
44
|
[key: string]: (arg1: any) => any;
|
|
44
45
|
} | undefined;
|
|
@@ -38,6 +38,7 @@ declare const _default: Readonly<{
|
|
|
38
38
|
transform?: import("../../types").WidgetTransform | undefined;
|
|
39
39
|
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
40
40
|
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
41
|
+
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
41
42
|
propUpgrades?: {
|
|
42
43
|
[key: string]: (arg1: any) => any;
|
|
43
44
|
} | undefined;
|
|
@@ -28,6 +28,7 @@ declare const _default: Readonly<{
|
|
|
28
28
|
transform?: import("../../types").WidgetTransform | undefined;
|
|
29
29
|
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
30
30
|
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
31
|
+
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
31
32
|
propUpgrades?: {
|
|
32
33
|
[key: string]: (arg1: any) => any;
|
|
33
34
|
} | undefined;
|
|
@@ -39,6 +39,7 @@ declare const _default: Readonly<{
|
|
|
39
39
|
transform?: import("../../types").WidgetTransform | undefined;
|
|
40
40
|
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
41
41
|
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
42
|
+
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
42
43
|
propUpgrades?: {
|
|
43
44
|
[key: string]: (arg1: any) => any;
|
|
44
45
|
} | undefined;
|
|
@@ -48,6 +48,7 @@ declare const _default: Readonly<{
|
|
|
48
48
|
transform?: import("../../types").WidgetTransform | undefined;
|
|
49
49
|
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
50
50
|
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
51
|
+
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
51
52
|
propUpgrades?: {
|
|
52
53
|
[key: string]: (arg1: any) => any;
|
|
53
54
|
} | undefined;
|
|
@@ -52,7 +52,6 @@ export declare class Expression extends React.Component<Props, ExpressionState>
|
|
|
52
52
|
_textareaId: string;
|
|
53
53
|
_isMounted: boolean;
|
|
54
54
|
static getUserInputFromProps(props: Props): PerseusExpressionUserInput;
|
|
55
|
-
static getOneCorrectAnswerFromRubric(rubric: PerseusExpressionRubric): string | null | undefined;
|
|
56
55
|
static defaultProps: DefaultProps;
|
|
57
56
|
displayName: string;
|
|
58
57
|
state: ExpressionState;
|
|
@@ -128,17 +127,18 @@ declare const _default: Readonly<{
|
|
|
128
127
|
editorChangeDelay?: number | undefined;
|
|
129
128
|
flags?: {
|
|
130
129
|
mafs?: false | ({
|
|
131
|
-
circle?: boolean | undefined;
|
|
132
|
-
polygon?: boolean | undefined;
|
|
133
130
|
none?: boolean | undefined;
|
|
134
131
|
linear?: boolean | undefined;
|
|
135
|
-
|
|
136
|
-
|
|
132
|
+
circle?: boolean | undefined;
|
|
133
|
+
polygon?: boolean | undefined;
|
|
137
134
|
point?: boolean | undefined;
|
|
138
|
-
ray?: boolean | undefined;
|
|
139
|
-
segment?: boolean | undefined;
|
|
140
135
|
angle?: boolean | undefined;
|
|
136
|
+
segment?: boolean | undefined;
|
|
141
137
|
"linear-system"?: boolean | undefined;
|
|
138
|
+
ray?: boolean | undefined;
|
|
139
|
+
"unlimited-polygon"?: boolean | undefined;
|
|
140
|
+
quadratic?: boolean | undefined;
|
|
141
|
+
sinusoid?: boolean | undefined;
|
|
142
142
|
"unlimited-point"?: boolean | undefined;
|
|
143
143
|
} & {
|
|
144
144
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
|
@@ -213,17 +213,18 @@ declare const _default: Readonly<{
|
|
|
213
213
|
editorChangeDelay?: number | undefined;
|
|
214
214
|
flags?: {
|
|
215
215
|
mafs?: false | ({
|
|
216
|
-
circle?: boolean | undefined;
|
|
217
|
-
polygon?: boolean | undefined;
|
|
218
216
|
none?: boolean | undefined;
|
|
219
217
|
linear?: boolean | undefined;
|
|
220
|
-
|
|
221
|
-
|
|
218
|
+
circle?: boolean | undefined;
|
|
219
|
+
polygon?: boolean | undefined;
|
|
222
220
|
point?: boolean | undefined;
|
|
223
|
-
ray?: boolean | undefined;
|
|
224
|
-
segment?: boolean | undefined;
|
|
225
221
|
angle?: boolean | undefined;
|
|
222
|
+
segment?: boolean | undefined;
|
|
226
223
|
"linear-system"?: boolean | undefined;
|
|
224
|
+
ray?: boolean | undefined;
|
|
225
|
+
"unlimited-polygon"?: boolean | undefined;
|
|
226
|
+
quadratic?: boolean | undefined;
|
|
227
|
+
sinusoid?: boolean | undefined;
|
|
227
228
|
"unlimited-point"?: boolean | undefined;
|
|
228
229
|
} & {
|
|
229
230
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
|
@@ -299,17 +300,18 @@ declare const _default: Readonly<{
|
|
|
299
300
|
editorChangeDelay?: number | undefined;
|
|
300
301
|
flags?: {
|
|
301
302
|
mafs?: false | ({
|
|
302
|
-
circle?: boolean | undefined;
|
|
303
|
-
polygon?: boolean | undefined;
|
|
304
303
|
none?: boolean | undefined;
|
|
305
304
|
linear?: boolean | undefined;
|
|
306
|
-
|
|
307
|
-
|
|
305
|
+
circle?: boolean | undefined;
|
|
306
|
+
polygon?: boolean | undefined;
|
|
308
307
|
point?: boolean | undefined;
|
|
309
|
-
ray?: boolean | undefined;
|
|
310
|
-
segment?: boolean | undefined;
|
|
311
308
|
angle?: boolean | undefined;
|
|
309
|
+
segment?: boolean | undefined;
|
|
312
310
|
"linear-system"?: boolean | undefined;
|
|
311
|
+
ray?: boolean | undefined;
|
|
312
|
+
"unlimited-polygon"?: boolean | undefined;
|
|
313
|
+
quadratic?: boolean | undefined;
|
|
314
|
+
sinusoid?: boolean | undefined;
|
|
313
315
|
"unlimited-point"?: boolean | undefined;
|
|
314
316
|
} & {
|
|
315
317
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
|
@@ -382,17 +384,18 @@ declare const _default: Readonly<{
|
|
|
382
384
|
editorChangeDelay?: number | undefined;
|
|
383
385
|
flags?: {
|
|
384
386
|
mafs?: false | ({
|
|
385
|
-
circle?: boolean | undefined;
|
|
386
|
-
polygon?: boolean | undefined;
|
|
387
387
|
none?: boolean | undefined;
|
|
388
388
|
linear?: boolean | undefined;
|
|
389
|
-
|
|
390
|
-
|
|
389
|
+
circle?: boolean | undefined;
|
|
390
|
+
polygon?: boolean | undefined;
|
|
391
391
|
point?: boolean | undefined;
|
|
392
|
-
ray?: boolean | undefined;
|
|
393
|
-
segment?: boolean | undefined;
|
|
394
392
|
angle?: boolean | undefined;
|
|
393
|
+
segment?: boolean | undefined;
|
|
395
394
|
"linear-system"?: boolean | undefined;
|
|
395
|
+
ray?: boolean | undefined;
|
|
396
|
+
"unlimited-polygon"?: boolean | undefined;
|
|
397
|
+
quadratic?: boolean | undefined;
|
|
398
|
+
sinusoid?: boolean | undefined;
|
|
396
399
|
"unlimited-point"?: boolean | undefined;
|
|
397
400
|
} & {
|
|
398
401
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
|
@@ -467,17 +470,18 @@ declare const _default: Readonly<{
|
|
|
467
470
|
editorChangeDelay?: number | undefined;
|
|
468
471
|
flags?: {
|
|
469
472
|
mafs?: false | ({
|
|
470
|
-
circle?: boolean | undefined;
|
|
471
|
-
polygon?: boolean | undefined;
|
|
472
473
|
none?: boolean | undefined;
|
|
473
474
|
linear?: boolean | undefined;
|
|
474
|
-
|
|
475
|
-
|
|
475
|
+
circle?: boolean | undefined;
|
|
476
|
+
polygon?: boolean | undefined;
|
|
476
477
|
point?: boolean | undefined;
|
|
477
|
-
ray?: boolean | undefined;
|
|
478
|
-
segment?: boolean | undefined;
|
|
479
478
|
angle?: boolean | undefined;
|
|
479
|
+
segment?: boolean | undefined;
|
|
480
480
|
"linear-system"?: boolean | undefined;
|
|
481
|
+
ray?: boolean | undefined;
|
|
482
|
+
"unlimited-polygon"?: boolean | undefined;
|
|
483
|
+
quadratic?: boolean | undefined;
|
|
484
|
+
sinusoid?: boolean | undefined;
|
|
481
485
|
"unlimited-point"?: boolean | undefined;
|
|
482
486
|
} & {
|
|
483
487
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
|
@@ -553,17 +557,18 @@ declare const _default: Readonly<{
|
|
|
553
557
|
editorChangeDelay?: number | undefined;
|
|
554
558
|
flags?: {
|
|
555
559
|
mafs?: false | ({
|
|
556
|
-
circle?: boolean | undefined;
|
|
557
|
-
polygon?: boolean | undefined;
|
|
558
560
|
none?: boolean | undefined;
|
|
559
561
|
linear?: boolean | undefined;
|
|
560
|
-
|
|
561
|
-
|
|
562
|
+
circle?: boolean | undefined;
|
|
563
|
+
polygon?: boolean | undefined;
|
|
562
564
|
point?: boolean | undefined;
|
|
563
|
-
ray?: boolean | undefined;
|
|
564
|
-
segment?: boolean | undefined;
|
|
565
565
|
angle?: boolean | undefined;
|
|
566
|
+
segment?: boolean | undefined;
|
|
566
567
|
"linear-system"?: boolean | undefined;
|
|
568
|
+
ray?: boolean | undefined;
|
|
569
|
+
"unlimited-polygon"?: boolean | undefined;
|
|
570
|
+
quadratic?: boolean | undefined;
|
|
571
|
+
sinusoid?: boolean | undefined;
|
|
567
572
|
"unlimited-point"?: boolean | undefined;
|
|
568
573
|
} & {
|
|
569
574
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
|
@@ -610,6 +615,7 @@ declare const _default: Readonly<{
|
|
|
610
615
|
transform?: import("../../types").WidgetTransform | undefined;
|
|
611
616
|
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
612
617
|
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
618
|
+
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
613
619
|
propUpgrades?: {
|
|
614
620
|
[key: string]: (arg1: any) => any;
|
|
615
621
|
} | undefined;
|
|
@@ -66,6 +66,7 @@ declare const _default: Readonly<{
|
|
|
66
66
|
transform?: import("../../types").WidgetTransform | undefined;
|
|
67
67
|
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
68
68
|
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
69
|
+
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
69
70
|
propUpgrades?: {
|
|
70
71
|
[key: string]: (arg1: any) => any;
|
|
71
72
|
} | undefined;
|
|
@@ -46,6 +46,7 @@ declare const _default: Readonly<{
|
|
|
46
46
|
transform?: import("../../types").WidgetTransform | undefined;
|
|
47
47
|
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
48
48
|
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
49
|
+
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
49
50
|
propUpgrades?: {
|
|
50
51
|
[key: string]: (arg1: any) => any;
|
|
51
52
|
} | undefined;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { Coord } from "@khanacademy/perseus";
|
|
2
|
+
export type Coords = [Coord, Coord];
|
|
3
|
+
type SharedGrapherType = {
|
|
4
|
+
url: string;
|
|
5
|
+
defaultCoords: Coords;
|
|
6
|
+
getFunctionForCoeffs: (coeffs: ReadonlyArray<number>, x: number) => number;
|
|
7
|
+
getEquationString: (coords: Coords, asymptote?: Coords) => string | null;
|
|
8
|
+
areEqual: (coeffs1: ReadonlyArray<number>, coeffs2: ReadonlyArray<number>) => boolean;
|
|
9
|
+
Movable: any;
|
|
10
|
+
getCoefficients: (coords: Coords, asymptote?: Coords) => ReadonlyArray<number> | undefined;
|
|
11
|
+
};
|
|
12
|
+
type AsymptoticGraphsType = {
|
|
13
|
+
defaultAsymptote: Coords;
|
|
14
|
+
extraCoordConstraint: (newCoord: Coord, oldCoord: Coord, coords: Coords, asymptote: Coords, graph: any) => boolean | Coord;
|
|
15
|
+
extraAsymptoteConstraint: (newCoord: Coord, oldCoord: Coord, coords: Coords, asymptote: Coords, graph: any) => Coord;
|
|
16
|
+
allowReflectOverAsymptote: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type LinearType = SharedGrapherType & {
|
|
19
|
+
getPropsForCoeffs: (coeffs: ReadonlyArray<number>) => {
|
|
20
|
+
fn: any;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export type QuadraticType = SharedGrapherType & {
|
|
24
|
+
getPropsForCoeffs: (coeffs: ReadonlyArray<number>) => {
|
|
25
|
+
a: number;
|
|
26
|
+
b: number;
|
|
27
|
+
c: number;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export type SinusoidType = SharedGrapherType & {
|
|
31
|
+
getPropsForCoeffs: (coeffs: ReadonlyArray<number>) => {
|
|
32
|
+
a: number;
|
|
33
|
+
b: number;
|
|
34
|
+
c: number;
|
|
35
|
+
d: number;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export type TangentType = SharedGrapherType & {
|
|
39
|
+
getPropsForCoeffs: (coeffs: ReadonlyArray<number>) => {
|
|
40
|
+
fn: any;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export type ExponentialType = SharedGrapherType & AsymptoticGraphsType & {
|
|
44
|
+
getPropsForCoeffs: (coeffs: ReadonlyArray<number>) => {
|
|
45
|
+
fn: any;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export type LogarithmType = SharedGrapherType & AsymptoticGraphsType & {
|
|
49
|
+
getPropsForCoeffs: (coeffs: ReadonlyArray<number>) => {
|
|
50
|
+
fn: any;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export type AbsoluteValueType = SharedGrapherType & {
|
|
54
|
+
getPropsForCoeffs: (coeffs: ReadonlyArray<number>) => {
|
|
55
|
+
fn: any;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { PerseusScore } from "../../types";
|
|
2
2
|
import type { PerseusGrapherRubric, PerseusGrapherUserInput } from "../../validation.types";
|
|
3
|
-
declare function grapherValidator(
|
|
3
|
+
declare function grapherValidator(userInput: PerseusGrapherUserInput, rubric: PerseusGrapherRubric): PerseusScore;
|
|
4
4
|
export default grapherValidator;
|
|
@@ -54,6 +54,7 @@ declare const _default: Readonly<{
|
|
|
54
54
|
transform?: import("../../types").WidgetTransform | undefined;
|
|
55
55
|
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
56
56
|
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
57
|
+
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
57
58
|
propUpgrades?: {
|
|
58
59
|
[key: string]: (arg1: any) => any;
|
|
59
60
|
} | undefined;
|
|
@@ -1,17 +1,30 @@
|
|
|
1
|
+
import type { LinearType, QuadraticType, SinusoidType, TangentType, ExponentialType, LogarithmType, AbsoluteValueType } from "./grapher-types";
|
|
1
2
|
import type { Coord } from "../../interactive2/types";
|
|
2
3
|
export declare const DEFAULT_BACKGROUND_IMAGE: {
|
|
3
4
|
readonly url: null;
|
|
4
5
|
};
|
|
6
|
+
declare const functionTypeMapping: {
|
|
7
|
+
readonly linear: LinearType;
|
|
8
|
+
readonly quadratic: QuadraticType;
|
|
9
|
+
readonly sinusoid: SinusoidType;
|
|
10
|
+
readonly tangent: TangentType;
|
|
11
|
+
readonly exponential: ExponentialType;
|
|
12
|
+
readonly logarithm: LogarithmType;
|
|
13
|
+
readonly absolute_value: AbsoluteValueType;
|
|
14
|
+
};
|
|
5
15
|
export declare const allTypes: any;
|
|
6
|
-
|
|
16
|
+
type FunctionTypeMappingKeys = keyof typeof functionTypeMapping;
|
|
17
|
+
type ConditionalGraderType<T extends FunctionTypeMappingKeys> = T extends "linear" ? LinearType : T extends "quadratic" ? QuadraticType : T extends "sinusoid" ? SinusoidType : T extends "tangent" ? TangentType : T extends "exponential" ? ExponentialType : T extends "logarithm" ? LogarithmType : T extends "absolute_value" ? AbsoluteValueType : never;
|
|
18
|
+
export declare function functionForType<T extends FunctionTypeMappingKeys>(type: T): ConditionalGraderType<T>;
|
|
7
19
|
export declare const getEquationString: (props: any) => string;
|
|
8
20
|
export declare const pointsFromNormalized: (coordsList: ReadonlyArray<Coord>, range: [Coord, Coord], step: [number, number], snapStep: [number, number]) => ReadonlyArray<Coord>;
|
|
9
21
|
export declare const maybePointsFromNormalized: (coordsList: ReadonlyArray<Coord> | null | undefined, range: [Coord, Coord], step: [number, number], snapStep: [number, number]) => ReadonlyArray<Coord> | null | undefined;
|
|
10
|
-
export declare const defaultPlotProps: (type:
|
|
22
|
+
export declare const defaultPlotProps: (type: FunctionTypeMappingKeys, graph: any) => any;
|
|
11
23
|
export declare const chooseType: <T>(list: ReadonlyArray<T>) => T | undefined;
|
|
12
24
|
export declare const getGridAndSnapSteps: (options: any, boxSize: number) => {
|
|
13
25
|
gridStep: [number, number];
|
|
14
26
|
snapStep: [number, number];
|
|
15
27
|
};
|
|
16
28
|
export declare const DEFAULT_GRAPHER_PROPS: any;
|
|
17
|
-
export declare const typeToButton: (type:
|
|
29
|
+
export declare const typeToButton: (type: FunctionTypeMappingKeys) => any;
|
|
30
|
+
export {};
|
|
@@ -54,6 +54,7 @@ declare const _default: Readonly<{
|
|
|
54
54
|
transform?: import("../../types").WidgetTransform | undefined;
|
|
55
55
|
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
56
56
|
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
57
|
+
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
57
58
|
propUpgrades?: {
|
|
58
59
|
[key: string]: (arg1: any) => any;
|
|
59
60
|
} | undefined;
|
|
@@ -49,6 +49,7 @@ declare const _default: Readonly<{
|
|
|
49
49
|
transform?: import("../../types").WidgetTransform | undefined;
|
|
50
50
|
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
51
51
|
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
52
|
+
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
52
53
|
propUpgrades?: {
|
|
53
54
|
[key: string]: (arg1: any) => any;
|
|
54
55
|
} | undefined;
|
|
@@ -55,6 +55,7 @@ declare const _default: Readonly<{
|
|
|
55
55
|
transform?: import("../../types").WidgetTransform | undefined;
|
|
56
56
|
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
57
57
|
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
58
|
+
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
58
59
|
propUpgrades?: {
|
|
59
60
|
[key: string]: (arg1: any) => any;
|
|
60
61
|
} | undefined;
|
|
@@ -37,7 +37,6 @@ declare class InputNumber extends React.Component<Props> implements Widget {
|
|
|
37
37
|
static getUserInputFromProps(props: Props): {
|
|
38
38
|
currentValue: string;
|
|
39
39
|
};
|
|
40
|
-
static getOneCorrectAnswerFromRubric(rubric: any): string | null | undefined;
|
|
41
40
|
shouldShowExamples: () => boolean;
|
|
42
41
|
handleChange: (arg1: string, arg2: () => void) => void;
|
|
43
42
|
_handleFocus: () => void;
|
|
@@ -69,6 +68,7 @@ declare const _default: Readonly<{
|
|
|
69
68
|
transform?: import("../../types").WidgetTransform | undefined;
|
|
70
69
|
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
71
70
|
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
71
|
+
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
72
72
|
propUpgrades?: {
|
|
73
73
|
[key: string]: (arg1: any) => any;
|
|
74
74
|
} | undefined;
|
|
@@ -43,6 +43,7 @@ declare const _default: Readonly<{
|
|
|
43
43
|
transform?: import("../../types").WidgetTransform | undefined;
|
|
44
44
|
staticTransform?: import("../../types").WidgetTransform | undefined;
|
|
45
45
|
validator?: import("../../types").WidgetValidatorFunction | undefined;
|
|
46
|
+
getOneCorrectAnswerFromRubric?: ((rubric: import("../../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
46
47
|
propUpgrades?: {
|
|
47
48
|
[key: string]: (arg1: any) => any;
|
|
48
49
|
} | undefined;
|
|
@@ -178,6 +178,7 @@ declare const _default: Readonly<{
|
|
|
178
178
|
transform?: import("../types").WidgetTransform | undefined;
|
|
179
179
|
staticTransform?: import("../types").WidgetTransform | undefined;
|
|
180
180
|
validator?: import("../types").WidgetValidatorFunction | undefined;
|
|
181
|
+
getOneCorrectAnswerFromRubric?: ((rubric: import("../validation.types").Rubric) => string | null | undefined) | undefined;
|
|
181
182
|
propUpgrades?: {
|
|
182
183
|
[key: string]: (arg1: any) => any;
|
|
183
184
|
} | undefined;
|