@khanacademy/perseus 33.3.0 → 34.1.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/components/sortable.d.ts +1 -4
- package/dist/es/index.js +721 -691
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +736 -692
- package/dist/index.js.map +1 -1
- package/dist/perseus-api.d.ts +2 -0
- package/dist/perseus-types.d.ts +3 -1
- package/dist/server-item-renderer.d.ts +2 -0
- package/dist/types.d.ts +1 -1
- package/dist/util/answer-types.d.ts +1 -1
- package/dist/widgets/__shared__/noop-validator.d.ts +11 -0
- package/dist/widgets/categorizer/categorizer-validator.d.ts +5 -0
- package/dist/widgets/categorizer/categorizer.d.ts +1 -2
- package/dist/widgets/categorizer/categorizer.types.d.ts +5 -0
- package/dist/widgets/cs-program/cs-program.d.ts +23 -17
- package/dist/widgets/definition/definition.d.ts +3 -3
- package/dist/widgets/dropdown/dropdown-validator.d.ts +4 -0
- package/dist/widgets/dropdown/dropdown.d.ts +1 -5
- package/dist/widgets/dropdown/dropdown.types.d.ts +5 -0
- package/dist/widgets/explanation/explanation.d.ts +3 -5
- package/dist/widgets/expression/expression-validator.d.ts +5 -0
- package/dist/widgets/expression/expression.d.ts +13 -6
- package/dist/widgets/expression/expression.types.d.ts +3 -0
- package/dist/widgets/expression/get-decimal-separator.d.ts +5 -0
- package/dist/widgets/iframe/iframe.d.ts +24 -15
- package/dist/widgets/image/image.d.ts +3 -3
- package/dist/widgets/input-number/input-number-validator.d.ts +41 -0
- package/dist/widgets/input-number/input-number.d.ts +1 -1
- package/dist/widgets/input-number/input-number.types.d.ts +2 -0
- package/dist/widgets/interaction/interaction.d.ts +3 -3
- package/dist/widgets/interactive-graphs/graph-locked-labels-layer.d.ts +2 -0
- package/dist/widgets/interactive-graphs/interactive-graph-question-builder.d.ts +7 -0
- package/dist/widgets/interactive-graphs/mafs-graph.d.ts +2 -1
- package/dist/widgets/interactive-graphs/reducer/interactive-graph-action.d.ts +16 -1
- package/dist/widgets/interactive-graphs/stateful-mafs-graph.d.ts +2 -1
- package/dist/widgets/interactive-graphs/types.d.ts +3 -0
- package/dist/widgets/label-image/label-image.d.ts +4 -0
- package/dist/widgets/matcher/matcher.d.ts +17 -46
- package/dist/widgets/molecule/molecule.d.ts +2 -2
- package/dist/widgets/numeric-input/numeric-input-validator.d.ts +6 -0
- package/dist/widgets/numeric-input/numeric-input.d.ts +1 -5
- package/dist/widgets/numeric-input/numeric-input.types.d.ts +5 -0
- package/dist/widgets/orderer/orderer.d.ts +6 -5
- package/dist/widgets/passage/passage.d.ts +3 -3
- package/dist/widgets/passage-ref/passage-ref.d.ts +3 -3
- package/dist/widgets/passage-ref-target/passage-ref-target.d.ts +2 -2
- package/dist/widgets/sorter/sorter.d.ts +18 -44
- package/dist/widgets/table/table.d.ts +20 -24
- package/dist/widgets/video/video.d.ts +3 -4
- package/package.json +1 -1
- package/dist/mixins/widget-jsonify-deprecated.d.ts +0 -5
package/dist/perseus-api.d.ts
CHANGED
|
@@ -107,6 +107,8 @@ export declare const ApiOptions: {
|
|
|
107
107
|
"unlimited-point"?: boolean | undefined;
|
|
108
108
|
} & {
|
|
109
109
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
|
110
|
+
"locked-point-labels"?: boolean | undefined;
|
|
111
|
+
"locked-line-labels"?: boolean | undefined;
|
|
110
112
|
}) | undefined;
|
|
111
113
|
} | undefined;
|
|
112
114
|
onWidgetStartProps?: ((widgets: import("./perseus-types").PerseusWidgetsMap) => void) | undefined;
|
package/dist/perseus-types.d.ts
CHANGED
|
@@ -393,6 +393,7 @@ export type LockedPointType = {
|
|
|
393
393
|
coord: Coord;
|
|
394
394
|
color: LockedFigureColor;
|
|
395
395
|
filled: boolean;
|
|
396
|
+
labels: LockedLabelType[];
|
|
396
397
|
};
|
|
397
398
|
export type LockedLineType = {
|
|
398
399
|
type: "line";
|
|
@@ -402,6 +403,7 @@ export type LockedLineType = {
|
|
|
402
403
|
lineStyle: LockedLineStyle;
|
|
403
404
|
showPoint1: boolean;
|
|
404
405
|
showPoint2: boolean;
|
|
406
|
+
labels: LockedLabelType[];
|
|
405
407
|
};
|
|
406
408
|
export type LockedVectorType = {
|
|
407
409
|
type: "vector";
|
|
@@ -665,7 +667,7 @@ export type PerseusSimulatorWidgetOptions = {
|
|
|
665
667
|
export type PerseusSorterWidgetOptions = {
|
|
666
668
|
correct: ReadonlyArray<string>;
|
|
667
669
|
padding: boolean;
|
|
668
|
-
layout:
|
|
670
|
+
layout: "horizontal" | "vertical";
|
|
669
671
|
};
|
|
670
672
|
export type PerseusTableWidgetOptions = {
|
|
671
673
|
headers: ReadonlyArray<string>;
|
|
@@ -152,6 +152,8 @@ declare const ref: React.ForwardRefExoticComponent<Omit<Pick<SharedRendererProps
|
|
|
152
152
|
"unlimited-point"?: boolean | undefined;
|
|
153
153
|
} & {
|
|
154
154
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
|
155
|
+
"locked-point-labels"?: boolean | undefined;
|
|
156
|
+
"locked-line-labels"?: boolean | undefined;
|
|
155
157
|
}) | undefined;
|
|
156
158
|
} | undefined;
|
|
157
159
|
onWidgetStartProps?: ((widgets: import("./perseus-types").PerseusWidgetsMap) => void) | undefined;
|
package/dist/types.d.ts
CHANGED
|
@@ -75,7 +75,7 @@ type TrackInteractionArgs = {
|
|
|
75
75
|
correct?: boolean;
|
|
76
76
|
} & Partial<TrackingGradedGroupExtraArguments> & Partial<TrackingSequenceExtraArguments>;
|
|
77
77
|
export declare const MafsGraphTypeFlags: readonly ["angle", "segment", "linear", "linear-system", "ray", "polygon", "circle", "quadratic", "sinusoid", "point", "unlimited-point", "none"];
|
|
78
|
-
export declare const InteractiveGraphLockedFeaturesFlags: readonly ["interactive-graph-locked-features-labels"];
|
|
78
|
+
export declare const InteractiveGraphLockedFeaturesFlags: readonly ["interactive-graph-locked-features-labels", "locked-point-labels", "locked-line-labels"];
|
|
79
79
|
/**
|
|
80
80
|
* APIOptions provides different ways to customize the behaviour of Perseus.
|
|
81
81
|
*
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PerseusScore } from "../../types";
|
|
2
|
+
/**
|
|
3
|
+
* Several widgets don't have "right"/"wrong" validation logic,
|
|
4
|
+
* so this just says to move on past those widgets
|
|
5
|
+
*
|
|
6
|
+
* TODO(LEMS-2396) widgets that use this probably shouldn't have any
|
|
7
|
+
* validation logic and the thing validating an exercise
|
|
8
|
+
* should just know to skip these
|
|
9
|
+
*/
|
|
10
|
+
declare function noopValidator(points?: number): PerseusScore;
|
|
11
|
+
export default noopValidator;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Rubric, UserInput } from "./categorizer.types";
|
|
2
|
+
import type { PerseusStrings } from "../../strings";
|
|
3
|
+
import type { PerseusScore } from "../../types";
|
|
4
|
+
declare function categorizerValidator(userInput: UserInput, rubric: Rubric, strings: PerseusStrings): PerseusScore;
|
|
5
|
+
export default categorizerValidator;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
|
+
import type { Rubric, UserInput } from "./categorizer.types";
|
|
3
4
|
import type { PerseusCategorizerWidgetOptions } from "../../perseus-types";
|
|
4
5
|
import type { PerseusStrings } from "../../strings";
|
|
5
6
|
import type { PerseusScore, WidgetProps } from "../../types";
|
|
6
|
-
type UserInput = any;
|
|
7
|
-
export type Rubric = PerseusCategorizerWidgetOptions;
|
|
8
7
|
type Props = WidgetProps<RenderProps, Rubric> & {
|
|
9
8
|
values: ReadonlyArray<string>;
|
|
10
9
|
};
|
|
@@ -1,28 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This widget is for embedding Khan Academy CS programs.
|
|
3
3
|
*/
|
|
4
|
-
import PropTypes from "prop-types";
|
|
5
4
|
import * as React from "react";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
import type { PerseusCSProgramWidgetOptions } from "../../perseus-types";
|
|
6
|
+
import type { PerseusScore, WidgetProps } from "../../types";
|
|
7
|
+
type Status = "correct" | "incorrect" | "incomplete";
|
|
8
|
+
type UserInput = {
|
|
9
|
+
status: Status;
|
|
10
|
+
message: string | null;
|
|
11
|
+
};
|
|
12
|
+
type RenderProps = PerseusCSProgramWidgetOptions & {
|
|
13
|
+
status: Status;
|
|
14
|
+
message: string | null;
|
|
15
|
+
};
|
|
16
|
+
export type Rubric = PerseusCSProgramWidgetOptions;
|
|
17
|
+
type Props = WidgetProps<RenderProps, Rubric>;
|
|
18
|
+
type DefaultProps = {
|
|
19
|
+
showEditor: Props["showEditor"];
|
|
20
|
+
showButtons: Props["showButtons"];
|
|
21
|
+
status: Props["status"];
|
|
22
|
+
message: Props["message"];
|
|
23
|
+
};
|
|
24
|
+
declare class CSProgram extends React.Component<Props> {
|
|
25
|
+
static defaultProps: DefaultProps;
|
|
26
|
+
static validate(state: UserInput, rubric: any): PerseusScore;
|
|
21
27
|
componentDidMount(): void;
|
|
22
28
|
componentWillUnmount(): void;
|
|
23
29
|
handleMessageEvent: (arg1: any) => void;
|
|
24
30
|
change: (...args: ReadonlyArray<unknown>) => any;
|
|
25
|
-
simpleValidate
|
|
31
|
+
simpleValidate(rubric: any): PerseusScore;
|
|
26
32
|
render(): React.ReactNode;
|
|
27
33
|
}
|
|
28
34
|
declare const _default: Readonly<{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
3
|
import type { PerseusRenderer, PerseusDefinitionWidgetOptions } from "../../perseus-types";
|
|
4
|
-
import type {
|
|
4
|
+
import type { WidgetProps } from "../../types";
|
|
5
5
|
type RenderProps = PerseusDefinitionWidgetOptions;
|
|
6
6
|
type Rubric = PerseusDefinitionWidgetOptions;
|
|
7
7
|
type UserInput = Empty;
|
|
@@ -19,9 +19,9 @@ declare class Definition extends React.Component<DefinitionProps> {
|
|
|
19
19
|
}>;
|
|
20
20
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
21
21
|
static defaultProps: DefaultProps;
|
|
22
|
-
static validate(
|
|
22
|
+
static validate(): import("../../types").PerseusScore;
|
|
23
23
|
getUserInput: () => UserInput;
|
|
24
|
-
simpleValidate: (
|
|
24
|
+
simpleValidate(): import("../../types").PerseusScore;
|
|
25
25
|
render(): React.ReactNode;
|
|
26
26
|
}
|
|
27
27
|
declare const _default: Readonly<{
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { Rubric, UserInput } from "./dropdown.types";
|
|
3
3
|
import type { PerseusScore, WidgetProps } from "../../types";
|
|
4
|
-
type Rubric = PerseusDropdownWidgetOptions;
|
|
5
|
-
type UserInput = {
|
|
6
|
-
value: number;
|
|
7
|
-
};
|
|
8
4
|
type Props = WidgetProps<RenderProps, Rubric> & {
|
|
9
5
|
selected: number;
|
|
10
6
|
};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
3
|
import type { PerseusExplanationWidgetOptions } from "../../perseus-types";
|
|
4
|
-
import type {
|
|
4
|
+
import type { WidgetProps } from "../../types";
|
|
5
5
|
type RenderProps = PerseusExplanationWidgetOptions;
|
|
6
|
-
type Rubric = PerseusExplanationWidgetOptions;
|
|
7
|
-
type UserInput = Empty;
|
|
8
6
|
type Props = WidgetProps<RenderProps, PerseusExplanationWidgetOptions>;
|
|
9
7
|
type DefaultProps = {
|
|
10
8
|
showPrompt: Props["showPrompt"];
|
|
@@ -25,13 +23,13 @@ declare class Explanation extends React.Component<Props, State> {
|
|
|
25
23
|
state: State;
|
|
26
24
|
_mounted: boolean;
|
|
27
25
|
static defaultProps: DefaultProps;
|
|
28
|
-
static validate(
|
|
26
|
+
static validate(): import("../../types").PerseusScore;
|
|
29
27
|
componentDidMount(): void;
|
|
30
28
|
componentWillUnmount(): void;
|
|
31
29
|
change: (arg1: any, arg2: any, arg3: any) => any;
|
|
32
30
|
_onClick: () => void;
|
|
33
31
|
getUserInput: () => Empty;
|
|
34
|
-
simpleValidate: (
|
|
32
|
+
simpleValidate(): import("../../types").PerseusScore;
|
|
35
33
|
render(): React.ReactNode;
|
|
36
34
|
}
|
|
37
35
|
declare const _default: Readonly<{
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Rubric, OnInputErrorFunctionType } from "./expression.types";
|
|
2
|
+
import type { PerseusStrings } from "../../strings";
|
|
3
|
+
import type { PerseusScore } from "../../types";
|
|
4
|
+
declare function expressionValidator(userInput: string, rubric: Rubric, onInputError: OnInputErrorFunctionType | undefined, strings: PerseusStrings, locale: string): PerseusScore;
|
|
5
|
+
export default expressionValidator;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
|
+
import type { Rubric, OnInputErrorFunctionType } from "./expression.types";
|
|
3
4
|
import type { DependenciesContext } from "../../dependencies";
|
|
4
5
|
import type { PerseusExpressionWidgetOptions } from "../../perseus-types";
|
|
5
6
|
import type { PerseusStrings } from "../../strings";
|
|
6
7
|
import type { PerseusScore, WidgetProps } from "../../types";
|
|
7
8
|
import type { Keys as Key, KeypadConfiguration } from "@khanacademy/math-input";
|
|
8
9
|
type InputPath = ReadonlyArray<string>;
|
|
9
|
-
type Rubric = PerseusExpressionWidgetOptions;
|
|
10
10
|
type RenderProps = {
|
|
11
11
|
buttonSets: PerseusExpressionWidgetOptions["buttonSets"];
|
|
12
12
|
buttonsVisible?: PerseusExpressionWidgetOptions["buttonsVisible"];
|
|
@@ -44,11 +44,6 @@ type DefaultProps = {
|
|
|
44
44
|
times: Props["times"];
|
|
45
45
|
value: Props["value"];
|
|
46
46
|
};
|
|
47
|
-
type OnInputErrorFunctionType = (arg1?: any, arg2?: any, arg3?: any) => boolean | null | undefined;
|
|
48
|
-
/**
|
|
49
|
-
* Get the character used for separating decimals.
|
|
50
|
-
*/
|
|
51
|
-
export declare const getDecimalSeparator: (locale: string) => string;
|
|
52
47
|
export declare class Expression extends React.Component<Props, ExpressionState> {
|
|
53
48
|
static contextType: React.Context<{
|
|
54
49
|
strings: PerseusStrings;
|
|
@@ -153,6 +148,8 @@ declare const _default: Readonly<{
|
|
|
153
148
|
"unlimited-point"?: boolean | undefined;
|
|
154
149
|
} & {
|
|
155
150
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
|
151
|
+
"locked-point-labels"?: boolean | undefined;
|
|
152
|
+
"locked-line-labels"?: boolean | undefined;
|
|
156
153
|
}) | undefined;
|
|
157
154
|
} | undefined;
|
|
158
155
|
onWidgetStartProps?: ((widgets: import("../../perseus-types").PerseusWidgetsMap) => void) | undefined;
|
|
@@ -233,6 +230,8 @@ declare const _default: Readonly<{
|
|
|
233
230
|
"unlimited-point"?: boolean | undefined;
|
|
234
231
|
} & {
|
|
235
232
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
|
233
|
+
"locked-point-labels"?: boolean | undefined;
|
|
234
|
+
"locked-line-labels"?: boolean | undefined;
|
|
236
235
|
}) | undefined;
|
|
237
236
|
} | undefined;
|
|
238
237
|
onWidgetStartProps?: ((widgets: import("../../perseus-types").PerseusWidgetsMap) => void) | undefined;
|
|
@@ -313,6 +312,8 @@ declare const _default: Readonly<{
|
|
|
313
312
|
"unlimited-point"?: boolean | undefined;
|
|
314
313
|
} & {
|
|
315
314
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
|
315
|
+
"locked-point-labels"?: boolean | undefined;
|
|
316
|
+
"locked-line-labels"?: boolean | undefined;
|
|
316
317
|
}) | undefined;
|
|
317
318
|
} | undefined;
|
|
318
319
|
onWidgetStartProps?: ((widgets: import("../../perseus-types").PerseusWidgetsMap) => void) | undefined;
|
|
@@ -392,6 +393,8 @@ declare const _default: Readonly<{
|
|
|
392
393
|
"unlimited-point"?: boolean | undefined;
|
|
393
394
|
} & {
|
|
394
395
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
|
396
|
+
"locked-point-labels"?: boolean | undefined;
|
|
397
|
+
"locked-line-labels"?: boolean | undefined;
|
|
395
398
|
}) | undefined;
|
|
396
399
|
} | undefined;
|
|
397
400
|
onWidgetStartProps?: ((widgets: import("../../perseus-types").PerseusWidgetsMap) => void) | undefined;
|
|
@@ -472,6 +475,8 @@ declare const _default: Readonly<{
|
|
|
472
475
|
"unlimited-point"?: boolean | undefined;
|
|
473
476
|
} & {
|
|
474
477
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
|
478
|
+
"locked-point-labels"?: boolean | undefined;
|
|
479
|
+
"locked-line-labels"?: boolean | undefined;
|
|
475
480
|
}) | undefined;
|
|
476
481
|
} | undefined;
|
|
477
482
|
onWidgetStartProps?: ((widgets: import("../../perseus-types").PerseusWidgetsMap) => void) | undefined;
|
|
@@ -552,6 +557,8 @@ declare const _default: Readonly<{
|
|
|
552
557
|
"unlimited-point"?: boolean | undefined;
|
|
553
558
|
} & {
|
|
554
559
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
|
560
|
+
"locked-point-labels"?: boolean | undefined;
|
|
561
|
+
"locked-line-labels"?: boolean | undefined;
|
|
555
562
|
}) | undefined;
|
|
556
563
|
} | undefined;
|
|
557
564
|
onWidgetStartProps?: ((widgets: import("../../perseus-types").PerseusWidgetsMap) => void) | undefined;
|
|
@@ -6,24 +6,33 @@
|
|
|
6
6
|
* It's particularly well suited for embedding our ProcessingJS programs,
|
|
7
7
|
* but could also be used for embedding viz's hosted elsewhere.
|
|
8
8
|
*/
|
|
9
|
-
import PropTypes from "prop-types";
|
|
10
9
|
import * as React from "react";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
import type { PerseusIFrameWidgetOptions } from "../../perseus-types";
|
|
11
|
+
import type { WidgetProps } from "../../types";
|
|
12
|
+
type Status = "correct" | "incorrect" | "incomplete";
|
|
13
|
+
type UserInput = {
|
|
14
|
+
status: Status;
|
|
15
|
+
message: string | null;
|
|
16
|
+
};
|
|
17
|
+
type RenderProps = PerseusIFrameWidgetOptions & {
|
|
18
|
+
status: Status;
|
|
19
|
+
message: string | null;
|
|
20
|
+
width: string;
|
|
21
|
+
height: string;
|
|
22
|
+
};
|
|
23
|
+
export type Rubric = PerseusIFrameWidgetOptions;
|
|
24
|
+
type Props = WidgetProps<RenderProps, Rubric>;
|
|
25
|
+
type DefaultProps = {
|
|
26
|
+
status: Props["status"];
|
|
27
|
+
message: Props["message"];
|
|
28
|
+
allowFullScreen: Props["allowFullScreen"];
|
|
29
|
+
allowTopNavigation: Props["allowTopNavigation"];
|
|
30
|
+
};
|
|
31
|
+
declare class Iframe extends React.Component<Props> {
|
|
32
|
+
static defaultProps: DefaultProps;
|
|
24
33
|
componentDidMount(): void;
|
|
25
34
|
componentWillUnmount(): void;
|
|
26
|
-
getUserInput
|
|
35
|
+
getUserInput(): UserInput;
|
|
27
36
|
handleMessageEvent: (arg1: any) => void;
|
|
28
37
|
change: (...args: ReadonlyArray<unknown>) => any;
|
|
29
38
|
simpleValidate: (arg1: any) => any;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
3
|
import type { PerseusImageWidgetOptions } from "../../perseus-types";
|
|
4
|
-
import type { ChangeFn,
|
|
4
|
+
import type { ChangeFn, WidgetProps } from "../../types";
|
|
5
5
|
type RenderProps = PerseusImageWidgetOptions;
|
|
6
6
|
type Rubric = PerseusImageWidgetOptions;
|
|
7
7
|
type UserInput = null;
|
|
@@ -35,10 +35,10 @@ declare class ImageWidget extends React.Component<Props> {
|
|
|
35
35
|
}>;
|
|
36
36
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
37
37
|
static defaultProps: DefaultProps;
|
|
38
|
-
static validate(
|
|
38
|
+
static validate(): import("../../types").PerseusScore;
|
|
39
39
|
change: ChangeFn;
|
|
40
40
|
getUserInput: () => UserInput;
|
|
41
|
-
simpleValidate: (
|
|
41
|
+
simpleValidate(): import("../../types").PerseusScore;
|
|
42
42
|
focus: () => void;
|
|
43
43
|
render(): React.ReactNode;
|
|
44
44
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Rubric } from "./input-number.types";
|
|
2
|
+
import type { PerseusStrings } from "../../strings";
|
|
3
|
+
import type { APIOptions, PerseusScore } from "@khanacademy/perseus";
|
|
4
|
+
export declare const answerTypes: {
|
|
5
|
+
readonly number: {
|
|
6
|
+
readonly name: "Numbers";
|
|
7
|
+
readonly forms: "integer, decimal, proper, improper, mixed";
|
|
8
|
+
};
|
|
9
|
+
readonly decimal: {
|
|
10
|
+
readonly name: "Decimals";
|
|
11
|
+
readonly forms: "decimal";
|
|
12
|
+
};
|
|
13
|
+
readonly integer: {
|
|
14
|
+
readonly name: "Integers";
|
|
15
|
+
readonly forms: "integer";
|
|
16
|
+
};
|
|
17
|
+
readonly rational: {
|
|
18
|
+
readonly name: "Fractions and mixed numbers";
|
|
19
|
+
readonly forms: "integer, proper, improper, mixed";
|
|
20
|
+
};
|
|
21
|
+
readonly improper: {
|
|
22
|
+
readonly name: "Improper numbers (no mixed)";
|
|
23
|
+
readonly forms: "integer, proper, improper";
|
|
24
|
+
};
|
|
25
|
+
readonly mixed: {
|
|
26
|
+
readonly name: "Mixed numbers (no improper)";
|
|
27
|
+
readonly forms: "integer, proper, mixed";
|
|
28
|
+
};
|
|
29
|
+
readonly percent: {
|
|
30
|
+
readonly name: "Numbers or percents";
|
|
31
|
+
readonly forms: "integer, decimal, proper, improper, mixed, percent";
|
|
32
|
+
};
|
|
33
|
+
readonly pi: {
|
|
34
|
+
readonly name: "Numbers with pi";
|
|
35
|
+
readonly forms: "pi";
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
declare function inputNumberValidator(state: {
|
|
39
|
+
currentValue: string;
|
|
40
|
+
}, rubric: Rubric, strings: PerseusStrings, onInputError?: APIOptions["onInputError"]): PerseusScore;
|
|
41
|
+
export default inputNumberValidator;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
|
+
import type { Rubric } from "./input-number.types";
|
|
3
4
|
import type { PerseusInputNumberWidgetOptions } from "../../perseus-types";
|
|
4
5
|
import type { PerseusStrings } from "../../strings";
|
|
5
6
|
import type { APIOptions, Path, PerseusScore, WidgetProps } from "../../types";
|
|
@@ -12,7 +13,6 @@ type RenderProps = {
|
|
|
12
13
|
answerType: PerseusInputNumberWidgetOptions["answerType"];
|
|
13
14
|
rightAlign: PerseusInputNumberWidgetOptions["rightAlign"];
|
|
14
15
|
};
|
|
15
|
-
type Rubric = PerseusInputNumberWidgetOptions;
|
|
16
16
|
type ExternalProps = WidgetProps<RenderProps, Rubric>;
|
|
17
17
|
type Props = ExternalProps & {
|
|
18
18
|
apiOptions: NonNullable<ExternalProps["apiOptions"]>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { Coord } from "../../interactive2/types";
|
|
3
3
|
import type { PerseusInteractionWidgetOptions } from "../../perseus-types";
|
|
4
|
-
import type {
|
|
4
|
+
import type { WidgetProps } from "../../types";
|
|
5
5
|
type RenderProps = PerseusInteractionWidgetOptions;
|
|
6
6
|
type Rubric = PerseusInteractionWidgetOptions;
|
|
7
7
|
type Props = WidgetProps<RenderProps, Rubric>;
|
|
@@ -15,7 +15,7 @@ type State = {
|
|
|
15
15
|
};
|
|
16
16
|
declare class Interaction extends React.Component<Props, State> {
|
|
17
17
|
static defaultProps: DefaultProps;
|
|
18
|
-
static validate(
|
|
18
|
+
static validate(): import("../../types").PerseusScore;
|
|
19
19
|
state: State;
|
|
20
20
|
UNSAFE_componentWillReceiveProps(nextProps: Props): void;
|
|
21
21
|
_setupGraphie: (arg1: any, arg2: any) => void;
|
|
@@ -25,7 +25,7 @@ declare class Interaction extends React.Component<Props, State> {
|
|
|
25
25
|
_extractVars: (arg1: any) => ReadonlyArray<any>;
|
|
26
26
|
change: (arg1: any, arg2: any, arg3: any) => any;
|
|
27
27
|
getUserInput: () => any;
|
|
28
|
-
simpleValidate: (
|
|
28
|
+
simpleValidate(): import("../../types").PerseusScore;
|
|
29
29
|
render(): React.ReactNode;
|
|
30
30
|
}
|
|
31
31
|
declare const _default: Readonly<{
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { LockedFigure } from "../../perseus-types";
|
|
3
|
+
import type { APIOptions } from "../../types";
|
|
3
4
|
type Props = {
|
|
5
|
+
flags?: APIOptions["flags"];
|
|
4
6
|
lockedFigures: ReadonlyArray<LockedFigure>;
|
|
5
7
|
};
|
|
6
8
|
export default function GraphLockedLabelsLayer(props: Props): (React.JSX.Element | null)[];
|
|
@@ -7,6 +7,11 @@ export type LockedFunctionOptions = {
|
|
|
7
7
|
directionalAxis?: "x" | "y";
|
|
8
8
|
domain?: Interval;
|
|
9
9
|
};
|
|
10
|
+
type LockedFigureLabelOptions = {
|
|
11
|
+
text: string;
|
|
12
|
+
coord?: Coord;
|
|
13
|
+
size?: "small" | "medium" | "large";
|
|
14
|
+
};
|
|
10
15
|
export declare function interactiveGraphQuestionBuilder(): InteractiveGraphQuestionBuilder;
|
|
11
16
|
declare class InteractiveGraphQuestionBuilder {
|
|
12
17
|
private content;
|
|
@@ -103,6 +108,7 @@ declare class InteractiveGraphQuestionBuilder {
|
|
|
103
108
|
addLockedPointAt(x: number, y: number, options?: {
|
|
104
109
|
color?: LockedFigureColor;
|
|
105
110
|
filled?: boolean;
|
|
111
|
+
labels?: LockedFigureLabelOptions[];
|
|
106
112
|
}): InteractiveGraphQuestionBuilder;
|
|
107
113
|
addLockedLine(point1: vec.Vector2, point2: vec.Vector2, options?: {
|
|
108
114
|
kind?: "line" | "ray" | "segment";
|
|
@@ -111,6 +117,7 @@ declare class InteractiveGraphQuestionBuilder {
|
|
|
111
117
|
filled?: [boolean, boolean];
|
|
112
118
|
showPoint1?: boolean;
|
|
113
119
|
showPoint2?: boolean;
|
|
120
|
+
labels?: LockedFigureLabelOptions[];
|
|
114
121
|
}): InteractiveGraphQuestionBuilder;
|
|
115
122
|
addLockedVector(tail: vec.Vector2, tip: vec.Vector2, color?: LockedFigureColor): InteractiveGraphQuestionBuilder;
|
|
116
123
|
addLockedEllipse(center: vec.Vector2, radius: [x: number, y: number], options?: {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type InteractiveGraphAction } from "./reducer/interactive-graph-action";
|
|
3
3
|
import type { InteractiveGraphState, InteractiveGraphProps } from "./types";
|
|
4
|
+
import type { APIOptions } from "../../types";
|
|
4
5
|
import type { vec } from "mafs";
|
|
5
6
|
import "mafs/core.css";
|
|
6
7
|
import "./mafs-styles.css";
|
|
7
8
|
export type MafsGraphProps = {
|
|
8
|
-
|
|
9
|
+
flags?: APIOptions["flags"];
|
|
9
10
|
box: [number, number];
|
|
10
11
|
backgroundImage?: InteractiveGraphProps["backgroundImage"];
|
|
11
12
|
lockedFigures?: InteractiveGraphProps["lockedFigures"];
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { InitializeGraphStateParams } from "./initialize-graph-state";
|
|
2
|
+
import type { InteractionMode } from "../types";
|
|
2
3
|
import type { Interval, vec } from "mafs";
|
|
3
|
-
export type InteractiveGraphAction = Reinitialize | MovePointInFigure | MoveLine | MoveAll | MovePoint | MoveCenter | MoveRadiusPoint | ChangeSnapStep | ChangeRange | AddPoint | RemovePoint | FocusPoint | BlurPoint | DeleteIntent | ClickPoint;
|
|
4
|
+
export type InteractiveGraphAction = Reinitialize | MovePointInFigure | MoveLine | MoveAll | MovePoint | MoveCenter | MoveRadiusPoint | ChangeSnapStep | ChangeRange | AddPoint | RemovePoint | FocusPoint | BlurPoint | DeleteIntent | ClickPoint | ChangeInteractionMode | ChangeKeyboardInvitationVisibility;
|
|
4
5
|
export declare const actions: {
|
|
5
6
|
global: {
|
|
6
7
|
deleteIntent: typeof deleteIntent;
|
|
8
|
+
changeInteractionMode: typeof changeInteractionMode;
|
|
9
|
+
changeKeyboardInvitationVisibility: typeof changeKeyboardInvitationVisibility;
|
|
7
10
|
};
|
|
8
11
|
angle: {
|
|
9
12
|
movePoint: typeof movePoint;
|
|
@@ -88,6 +91,18 @@ export interface ClickPoint {
|
|
|
88
91
|
index: number;
|
|
89
92
|
}
|
|
90
93
|
declare function clickPoint(index: number): ClickPoint;
|
|
94
|
+
export declare const CHANGE_INTERACTION_MODE = "point-change-interaction-mode";
|
|
95
|
+
export interface ChangeInteractionMode {
|
|
96
|
+
type: typeof CHANGE_INTERACTION_MODE;
|
|
97
|
+
mode: InteractionMode;
|
|
98
|
+
}
|
|
99
|
+
declare function changeInteractionMode(mode: InteractionMode): ChangeInteractionMode;
|
|
100
|
+
export declare const CHANGE_KEYBOARD_INVITATION_VISIBILITY = "change-keyboard-interaction-invitation-visibility";
|
|
101
|
+
export interface ChangeKeyboardInvitationVisibility {
|
|
102
|
+
type: typeof CHANGE_KEYBOARD_INVITATION_VISIBILITY;
|
|
103
|
+
shouldShow: boolean;
|
|
104
|
+
}
|
|
105
|
+
declare function changeKeyboardInvitationVisibility(shouldShow: boolean): ChangeKeyboardInvitationVisibility;
|
|
91
106
|
export declare const MOVE_ALL = "move-all";
|
|
92
107
|
export interface MoveAll {
|
|
93
108
|
type: typeof MOVE_ALL;
|
|
@@ -2,8 +2,9 @@ import * as React from "react";
|
|
|
2
2
|
import type { InteractiveGraphProps } from "./types";
|
|
3
3
|
import type { PerseusGraphType } from "../../perseus-types";
|
|
4
4
|
import type { Widget } from "../../renderer";
|
|
5
|
+
import type { APIOptions } from "../../types";
|
|
5
6
|
export type StatefulMafsGraphProps = {
|
|
6
|
-
|
|
7
|
+
flags?: APIOptions["flags"];
|
|
7
8
|
box: [number, number];
|
|
8
9
|
backgroundImage?: InteractiveGraphProps["backgroundImage"];
|
|
9
10
|
graph: PerseusGraphType;
|
|
@@ -26,6 +26,7 @@ export interface LinearSystemGraphState extends InteractiveGraphStateCommon {
|
|
|
26
26
|
type: "linear-system";
|
|
27
27
|
coords: PairOfPoints[];
|
|
28
28
|
}
|
|
29
|
+
export type InteractionMode = "mouse" | "keyboard";
|
|
29
30
|
export interface NoneGraphState extends InteractiveGraphStateCommon {
|
|
30
31
|
type: "none";
|
|
31
32
|
}
|
|
@@ -35,6 +36,8 @@ export interface PointGraphState extends InteractiveGraphStateCommon {
|
|
|
35
36
|
numPoints?: number | "unlimited";
|
|
36
37
|
focusedPointIndex: number | null;
|
|
37
38
|
showRemovePointButton: boolean;
|
|
39
|
+
interactionMode: InteractionMode;
|
|
40
|
+
showKeyboardInteractionInvitation: boolean;
|
|
38
41
|
}
|
|
39
42
|
export interface RayGraphState extends InteractiveGraphStateCommon {
|
|
40
43
|
type: "ray";
|
|
@@ -145,6 +145,8 @@ declare const _default: Readonly<{
|
|
|
145
145
|
"unlimited-point"?: boolean | undefined;
|
|
146
146
|
} & {
|
|
147
147
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
|
148
|
+
"locked-point-labels"?: boolean | undefined;
|
|
149
|
+
"locked-line-labels"?: boolean | undefined;
|
|
148
150
|
}) | undefined;
|
|
149
151
|
} | undefined;
|
|
150
152
|
onWidgetStartProps?: ((widgets: import("../..").PerseusWidgetsMap) => void) | undefined;
|
|
@@ -209,6 +211,8 @@ declare const _default: Readonly<{
|
|
|
209
211
|
"unlimited-point"?: boolean | undefined;
|
|
210
212
|
} & {
|
|
211
213
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
|
214
|
+
"locked-point-labels"?: boolean | undefined;
|
|
215
|
+
"locked-line-labels"?: boolean | undefined;
|
|
212
216
|
}) | undefined;
|
|
213
217
|
} | undefined;
|
|
214
218
|
onWidgetStartProps?: ((widgets: import("../..").PerseusWidgetsMap) => void) | undefined;
|