@khanacademy/perseus 33.3.0 → 34.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/components/sortable.d.ts +1 -4
- package/dist/es/index.js +448 -540
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +444 -542
- package/dist/index.js.map +1 -1
- package/dist/perseus-api.d.ts +1 -0
- package/dist/perseus-types.d.ts +2 -1
- package/dist/server-item-renderer.d.ts +1 -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.d.ts +3 -1
- package/dist/widgets/cs-program/cs-program.d.ts +23 -17
- 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/expression/expression-validator.d.ts +5 -0
- package/dist/widgets/expression/expression.d.ts +7 -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/interactive-graphs/graph-locked-labels-layer.d.ts +2 -0
- package/dist/widgets/interactive-graphs/interactive-graph-question-builder.d.ts +5 -0
- package/dist/widgets/interactive-graphs/mafs-graph.d.ts +2 -1
- package/dist/widgets/interactive-graphs/stateful-mafs-graph.d.ts +2 -1
- package/dist/widgets/label-image/label-image.d.ts +2 -0
- package/dist/widgets/matcher/matcher.d.ts +17 -46
- 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/sorter/sorter.d.ts +18 -44
- package/dist/widgets/table/table.d.ts +20 -24
- 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,7 @@ 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;
|
|
110
111
|
}) | undefined;
|
|
111
112
|
} | undefined;
|
|
112
113
|
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";
|
|
@@ -665,7 +666,7 @@ export type PerseusSimulatorWidgetOptions = {
|
|
|
665
666
|
export type PerseusSorterWidgetOptions = {
|
|
666
667
|
correct: ReadonlyArray<string>;
|
|
667
668
|
padding: boolean;
|
|
668
|
-
layout:
|
|
669
|
+
layout: "horizontal" | "vertical";
|
|
669
670
|
};
|
|
670
671
|
export type PerseusTableWidgetOptions = {
|
|
671
672
|
headers: ReadonlyArray<string>;
|
|
@@ -152,6 +152,7 @@ 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;
|
|
155
156
|
}) | undefined;
|
|
156
157
|
} | undefined;
|
|
157
158
|
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"];
|
|
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: 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(): PerseusScore;
|
|
11
|
+
export default noopValidator;
|
|
@@ -3,7 +3,9 @@ import { PerseusI18nContext } from "../../components/i18n-context";
|
|
|
3
3
|
import type { PerseusCategorizerWidgetOptions } from "../../perseus-types";
|
|
4
4
|
import type { PerseusStrings } from "../../strings";
|
|
5
5
|
import type { PerseusScore, WidgetProps } from "../../types";
|
|
6
|
-
type UserInput =
|
|
6
|
+
type UserInput = {
|
|
7
|
+
values: ReadonlyArray<number>;
|
|
8
|
+
};
|
|
7
9
|
export type Rubric = PerseusCategorizerWidgetOptions;
|
|
8
10
|
type Props = WidgetProps<RenderProps, Rubric> & {
|
|
9
11
|
values: ReadonlyArray<string>;
|
|
@@ -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,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
|
};
|
|
@@ -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,7 @@ 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;
|
|
156
152
|
}) | undefined;
|
|
157
153
|
} | undefined;
|
|
158
154
|
onWidgetStartProps?: ((widgets: import("../../perseus-types").PerseusWidgetsMap) => void) | undefined;
|
|
@@ -233,6 +229,7 @@ declare const _default: Readonly<{
|
|
|
233
229
|
"unlimited-point"?: boolean | undefined;
|
|
234
230
|
} & {
|
|
235
231
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
|
232
|
+
"locked-point-labels"?: boolean | undefined;
|
|
236
233
|
}) | undefined;
|
|
237
234
|
} | undefined;
|
|
238
235
|
onWidgetStartProps?: ((widgets: import("../../perseus-types").PerseusWidgetsMap) => void) | undefined;
|
|
@@ -313,6 +310,7 @@ declare const _default: Readonly<{
|
|
|
313
310
|
"unlimited-point"?: boolean | undefined;
|
|
314
311
|
} & {
|
|
315
312
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
|
313
|
+
"locked-point-labels"?: boolean | undefined;
|
|
316
314
|
}) | undefined;
|
|
317
315
|
} | undefined;
|
|
318
316
|
onWidgetStartProps?: ((widgets: import("../../perseus-types").PerseusWidgetsMap) => void) | undefined;
|
|
@@ -392,6 +390,7 @@ declare const _default: Readonly<{
|
|
|
392
390
|
"unlimited-point"?: boolean | undefined;
|
|
393
391
|
} & {
|
|
394
392
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
|
393
|
+
"locked-point-labels"?: boolean | undefined;
|
|
395
394
|
}) | undefined;
|
|
396
395
|
} | undefined;
|
|
397
396
|
onWidgetStartProps?: ((widgets: import("../../perseus-types").PerseusWidgetsMap) => void) | undefined;
|
|
@@ -472,6 +471,7 @@ declare const _default: Readonly<{
|
|
|
472
471
|
"unlimited-point"?: boolean | undefined;
|
|
473
472
|
} & {
|
|
474
473
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
|
474
|
+
"locked-point-labels"?: boolean | undefined;
|
|
475
475
|
}) | undefined;
|
|
476
476
|
} | undefined;
|
|
477
477
|
onWidgetStartProps?: ((widgets: import("../../perseus-types").PerseusWidgetsMap) => void) | undefined;
|
|
@@ -552,6 +552,7 @@ declare const _default: Readonly<{
|
|
|
552
552
|
"unlimited-point"?: boolean | undefined;
|
|
553
553
|
} & {
|
|
554
554
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
|
555
|
+
"locked-point-labels"?: boolean | undefined;
|
|
555
556
|
}) | undefined;
|
|
556
557
|
} | undefined;
|
|
557
558
|
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,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)[];
|
|
@@ -103,6 +103,11 @@ declare class InteractiveGraphQuestionBuilder {
|
|
|
103
103
|
addLockedPointAt(x: number, y: number, options?: {
|
|
104
104
|
color?: LockedFigureColor;
|
|
105
105
|
filled?: boolean;
|
|
106
|
+
labels?: {
|
|
107
|
+
text: string;
|
|
108
|
+
coord?: Coord;
|
|
109
|
+
size?: "small" | "medium" | "large";
|
|
110
|
+
}[];
|
|
106
111
|
}): InteractiveGraphQuestionBuilder;
|
|
107
112
|
addLockedLine(point1: vec.Vector2, point2: vec.Vector2, options?: {
|
|
108
113
|
kind?: "line" | "ray" | "segment";
|
|
@@ -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"];
|
|
@@ -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;
|
|
@@ -145,6 +145,7 @@ 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;
|
|
148
149
|
}) | undefined;
|
|
149
150
|
} | undefined;
|
|
150
151
|
onWidgetStartProps?: ((widgets: import("../..").PerseusWidgetsMap) => void) | undefined;
|
|
@@ -209,6 +210,7 @@ declare const _default: Readonly<{
|
|
|
209
210
|
"unlimited-point"?: boolean | undefined;
|
|
210
211
|
} & {
|
|
211
212
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
|
213
|
+
"locked-point-labels"?: boolean | undefined;
|
|
212
214
|
}) | undefined;
|
|
213
215
|
} | undefined;
|
|
214
216
|
onWidgetStartProps?: ((widgets: import("../..").PerseusWidgetsMap) => void) | undefined;
|
|
@@ -1,62 +1,33 @@
|
|
|
1
|
-
import PropTypes from "prop-types";
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
4
3
|
import type { SortableOption } from "../../components/sortable";
|
|
4
|
+
import type { PerseusMatcherWidgetOptions } from "../../perseus-types";
|
|
5
|
+
import type { WidgetProps } from "../../types";
|
|
6
|
+
type RenderProps = PerseusMatcherWidgetOptions;
|
|
7
|
+
type Rubric = PerseusMatcherWidgetOptions;
|
|
8
|
+
type Props = WidgetProps<RenderProps, Rubric>;
|
|
9
|
+
type DefaultProps = {
|
|
10
|
+
left: Props["left"];
|
|
11
|
+
right: Props["right"];
|
|
12
|
+
labels: Props["labels"];
|
|
13
|
+
orderMatters: Props["orderMatters"];
|
|
14
|
+
padding: Props["padding"];
|
|
15
|
+
problemNum: Props["problemNum"];
|
|
16
|
+
onChange: Props["onChange"];
|
|
17
|
+
linterContext: Props["linterContext"];
|
|
18
|
+
};
|
|
5
19
|
type State = {
|
|
6
20
|
leftHeight: number;
|
|
7
21
|
rightHeight: number;
|
|
8
22
|
texRendererLoaded: boolean;
|
|
9
23
|
};
|
|
10
|
-
export declare class Matcher extends React.Component<
|
|
24
|
+
export declare class Matcher extends React.Component<Props, State> {
|
|
11
25
|
static contextType: React.Context<{
|
|
12
26
|
strings: import("../../strings").PerseusStrings;
|
|
13
27
|
locale: string;
|
|
14
28
|
}>;
|
|
15
29
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
16
|
-
static
|
|
17
|
-
apiOptions: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
18
|
-
isArticle: PropTypes.Validator<boolean>;
|
|
19
|
-
onInputError: PropTypes.Validator<(...args: any[]) => any>;
|
|
20
|
-
onFocusChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
21
|
-
GroupMetadataEditor: PropTypes.Validator<(...args: any[]) => any>;
|
|
22
|
-
showAlignmentOptions: PropTypes.Validator<boolean>;
|
|
23
|
-
readOnly: PropTypes.Validator<boolean>;
|
|
24
|
-
answerableCallback: PropTypes.Requireable<(...args: any[]) => any>;
|
|
25
|
-
getAnotherHint: PropTypes.Requireable<(...args: any[]) => any>;
|
|
26
|
-
interactionCallback: PropTypes.Requireable<(...args: any[]) => any>;
|
|
27
|
-
groupAnnotator: PropTypes.Validator<(...args: any[]) => any>;
|
|
28
|
-
imagePlaceholder: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
29
|
-
widgetPlaceholder: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
30
|
-
baseElements: PropTypes.Requireable<PropTypes.InferProps<{
|
|
31
|
-
Link: PropTypes.Requireable<(...args: any[]) => any>;
|
|
32
|
-
}>>;
|
|
33
|
-
imagePreloader: PropTypes.Requireable<(...args: any[]) => any>;
|
|
34
|
-
trackInteraction: PropTypes.Requireable<(...args: any[]) => any>;
|
|
35
|
-
customKeypad: PropTypes.Requireable<boolean>;
|
|
36
|
-
nativeKeypadProxy: PropTypes.Requireable<(...args: any[]) => any>;
|
|
37
|
-
isMobile: PropTypes.Requireable<boolean>;
|
|
38
|
-
setDrawingAreaAvailable: PropTypes.Requireable<(...args: any[]) => any>;
|
|
39
|
-
hintProgressColor: PropTypes.Requireable<string>;
|
|
40
|
-
canScrollPage: PropTypes.Requireable<boolean>;
|
|
41
|
-
crossOutEnabled: PropTypes.Requireable<boolean>;
|
|
42
|
-
editorChangeDelay: PropTypes.Requireable<number>;
|
|
43
|
-
}>>>;
|
|
44
|
-
labels: PropTypes.Requireable<any[]>;
|
|
45
|
-
left: PropTypes.Requireable<any[]>;
|
|
46
|
-
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
47
|
-
orderMatters: PropTypes.Requireable<boolean>;
|
|
48
|
-
padding: PropTypes.Requireable<boolean>;
|
|
49
|
-
problemNum: PropTypes.Requireable<number>;
|
|
50
|
-
right: PropTypes.Requireable<any[]>;
|
|
51
|
-
trackInteraction: PropTypes.Validator<(...args: any[]) => any>;
|
|
52
|
-
linterContext: PropTypes.Requireable<PropTypes.InferProps<{
|
|
53
|
-
contentType: PropTypes.Requireable<string>;
|
|
54
|
-
highlightLint: PropTypes.Requireable<boolean>;
|
|
55
|
-
paths: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
56
|
-
stack: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
57
|
-
}>>;
|
|
58
|
-
};
|
|
59
|
-
static defaultProps: any;
|
|
30
|
+
static defaultProps: DefaultProps;
|
|
60
31
|
state: State;
|
|
61
32
|
changeAndTrack: (arg1: any) => void;
|
|
62
33
|
onMeasureLeft: (arg1: any) => void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Rubric, UserInput } from "./numeric-input.types";
|
|
2
|
+
import type { PerseusStrings } from "../../strings";
|
|
3
|
+
import type { PerseusScore } from "../../types";
|
|
4
|
+
export declare function maybeParsePercentInput(inputValue: string | number, normalizedAnswerExpected: boolean): string | number;
|
|
5
|
+
declare function numericInputValidator(userInput: UserInput, rubric: Rubric, strings: PerseusStrings): PerseusScore;
|
|
6
|
+
export default numericInputValidator;
|
|
@@ -2,13 +2,10 @@ import * as React from "react";
|
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
3
|
import InputWithExamples from "../../components/input-with-examples";
|
|
4
4
|
import SimpleKeypadInput from "../../components/simple-keypad-input";
|
|
5
|
+
import type { Rubric, UserInput } from "./numeric-input.types";
|
|
5
6
|
import type { PerseusNumericInputWidgetOptions, PerseusNumericInputAnswerForm } from "../../perseus-types";
|
|
6
7
|
import type { PerseusStrings } from "../../strings";
|
|
7
8
|
import type { FocusPath, PerseusScore, WidgetProps } from "../../types";
|
|
8
|
-
type UserInput = {
|
|
9
|
-
currentValue: string;
|
|
10
|
-
};
|
|
11
|
-
export type Rubric = PerseusNumericInputWidgetOptions;
|
|
12
9
|
type ExternalProps = WidgetProps<PerseusNumericInputWidgetOptions, Rubric>;
|
|
13
10
|
type Props = ExternalProps & {
|
|
14
11
|
size: NonNullable<ExternalProps["size"]>;
|
|
@@ -61,7 +58,6 @@ export declare class NumericInput extends React.Component<Props, State> {
|
|
|
61
58
|
render(): React.ReactNode;
|
|
62
59
|
}
|
|
63
60
|
export declare const unionAnswerForms: (arg1: ReadonlyArray<ReadonlyArray<PerseusNumericInputAnswerForm>>) => ReadonlyArray<PerseusNumericInputAnswerForm>;
|
|
64
|
-
export declare function maybeParsePercentInput(inputValue: string | number, normalizedAnswerExpected: boolean): string | number;
|
|
65
61
|
declare const _default: Readonly<{
|
|
66
62
|
name: string;
|
|
67
63
|
displayName: string;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { PerseusOrdererWidgetOptions } from "../../perseus-types";
|
|
3
3
|
import type { WidgetProps } from "../../types";
|
|
4
|
+
type Position = {
|
|
5
|
+
left: number;
|
|
6
|
+
top: number;
|
|
7
|
+
};
|
|
4
8
|
type Rubric = PerseusOrdererWidgetOptions;
|
|
5
9
|
type RenderProps = PerseusOrdererWidgetOptions & {
|
|
6
10
|
current: any;
|
|
@@ -23,13 +27,10 @@ type OrdererState = {
|
|
|
23
27
|
dragWidth: number | null | undefined;
|
|
24
28
|
dragHeight: number | null | undefined;
|
|
25
29
|
dragContent: any;
|
|
26
|
-
offsetPos:
|
|
30
|
+
offsetPos: Position | null | undefined;
|
|
27
31
|
grabPos: any;
|
|
28
32
|
mousePos?: any;
|
|
29
|
-
animateTo:
|
|
30
|
-
top: number;
|
|
31
|
-
left: number;
|
|
32
|
-
} | null | undefined;
|
|
33
|
+
animateTo: Position | null | undefined;
|
|
33
34
|
onAnimationEnd?: (arg1: any) => void;
|
|
34
35
|
};
|
|
35
36
|
declare class Orderer extends React.Component<OrdererProps, OrdererState> {
|
|
@@ -1,50 +1,24 @@
|
|
|
1
|
-
import PropTypes from "prop-types";
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import type { SortableOption } from "../../components/sortable";
|
|
4
|
-
|
|
3
|
+
import type { PerseusSorterWidgetOptions } from "../../perseus-types";
|
|
4
|
+
import type { WidgetProps } from "../../types";
|
|
5
|
+
type RenderProps = PerseusSorterWidgetOptions;
|
|
6
|
+
type Rubric = PerseusSorterWidgetOptions;
|
|
7
|
+
type Props = WidgetProps<RenderProps, Rubric>;
|
|
8
|
+
type DefaultProps = {
|
|
9
|
+
correct: Props["correct"];
|
|
10
|
+
layout: Props["layout"];
|
|
11
|
+
padding: Props["padding"];
|
|
12
|
+
problemNum: Props["problemNum"];
|
|
13
|
+
onChange: Props["onChange"];
|
|
14
|
+
linterContext: Props["linterContext"];
|
|
15
|
+
};
|
|
16
|
+
type State = {
|
|
17
|
+
changed: boolean;
|
|
18
|
+
};
|
|
19
|
+
declare class Sorter extends React.Component<Props, State> {
|
|
5
20
|
_isMounted: boolean;
|
|
6
|
-
static
|
|
7
|
-
apiOptions: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
8
|
-
isArticle: PropTypes.Validator<boolean>;
|
|
9
|
-
onInputError: PropTypes.Validator<(...args: any[]) => any>;
|
|
10
|
-
onFocusChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
11
|
-
GroupMetadataEditor: PropTypes.Validator<(...args: any[]) => any>;
|
|
12
|
-
showAlignmentOptions: PropTypes.Validator<boolean>;
|
|
13
|
-
readOnly: PropTypes.Validator<boolean>;
|
|
14
|
-
answerableCallback: PropTypes.Requireable<(...args: any[]) => any>;
|
|
15
|
-
getAnotherHint: PropTypes.Requireable<(...args: any[]) => any>;
|
|
16
|
-
interactionCallback: PropTypes.Requireable<(...args: any[]) => any>;
|
|
17
|
-
groupAnnotator: PropTypes.Validator<(...args: any[]) => any>;
|
|
18
|
-
imagePlaceholder: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
19
|
-
widgetPlaceholder: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
20
|
-
baseElements: PropTypes.Requireable<PropTypes.InferProps<{
|
|
21
|
-
Link: PropTypes.Requireable<(...args: any[]) => any>;
|
|
22
|
-
}>>;
|
|
23
|
-
imagePreloader: PropTypes.Requireable<(...args: any[]) => any>;
|
|
24
|
-
trackInteraction: PropTypes.Requireable<(...args: any[]) => any>;
|
|
25
|
-
customKeypad: PropTypes.Requireable<boolean>;
|
|
26
|
-
nativeKeypadProxy: PropTypes.Requireable<(...args: any[]) => any>;
|
|
27
|
-
isMobile: PropTypes.Requireable<boolean>;
|
|
28
|
-
setDrawingAreaAvailable: PropTypes.Requireable<(...args: any[]) => any>;
|
|
29
|
-
hintProgressColor: PropTypes.Requireable<string>;
|
|
30
|
-
canScrollPage: PropTypes.Requireable<boolean>;
|
|
31
|
-
crossOutEnabled: PropTypes.Requireable<boolean>;
|
|
32
|
-
editorChangeDelay: PropTypes.Requireable<number>;
|
|
33
|
-
}>>>;
|
|
34
|
-
correct: PropTypes.Requireable<any[]>;
|
|
35
|
-
layout: PropTypes.Requireable<string>;
|
|
36
|
-
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
37
|
-
padding: PropTypes.Requireable<boolean>;
|
|
38
|
-
problemNum: PropTypes.Requireable<number>;
|
|
39
|
-
trackInteraction: PropTypes.Validator<(...args: any[]) => any>;
|
|
40
|
-
linterContext: PropTypes.Requireable<PropTypes.InferProps<{
|
|
41
|
-
contentType: PropTypes.Requireable<string>;
|
|
42
|
-
highlightLint: PropTypes.Requireable<boolean>;
|
|
43
|
-
paths: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
44
|
-
stack: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
45
|
-
}>>;
|
|
46
|
-
};
|
|
47
|
-
static defaultProps: any;
|
|
21
|
+
static defaultProps: DefaultProps;
|
|
48
22
|
static validate(state: any, rubric: any): any;
|
|
49
23
|
state: any;
|
|
50
24
|
componentDidMount(): void;
|
|
@@ -1,35 +1,31 @@
|
|
|
1
|
-
import PropTypes from "prop-types";
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
|
+
import type { ChangeableProps } from "../../mixins/changeable";
|
|
4
|
+
import type { PerseusTableWidgetOptions } from "../../perseus-types";
|
|
4
5
|
import type { PerseusStrings } from "../../strings";
|
|
5
|
-
|
|
6
|
+
import type { WidgetProps } from "../../types";
|
|
7
|
+
type RenderProps = PerseusTableWidgetOptions & {
|
|
8
|
+
editableHeaders: boolean;
|
|
9
|
+
Editor: any;
|
|
10
|
+
};
|
|
11
|
+
type Rubric = PerseusTableWidgetOptions;
|
|
12
|
+
type Props = ChangeableProps & WidgetProps<RenderProps, Rubric>;
|
|
13
|
+
type DefaultProps = {
|
|
14
|
+
apiOptions: Props["apiOptions"];
|
|
15
|
+
headers: Props["headers"];
|
|
16
|
+
editableHeaders: Props["editableHeaders"];
|
|
17
|
+
rows: Props["rows"];
|
|
18
|
+
columns: Props["columns"];
|
|
19
|
+
answers: Props["answers"];
|
|
20
|
+
linterContext: Props["linterContext"];
|
|
21
|
+
};
|
|
22
|
+
declare class Table extends React.Component<Props> {
|
|
6
23
|
static contextType: React.Context<{
|
|
7
24
|
strings: PerseusStrings;
|
|
8
25
|
locale: string;
|
|
9
26
|
}>;
|
|
10
27
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
11
|
-
static
|
|
12
|
-
answers: PropTypes.Requireable<((string | null | undefined)[] | null | undefined)[]>;
|
|
13
|
-
editableHeaders: PropTypes.Requireable<boolean>;
|
|
14
|
-
Editor: PropTypes.Requireable<(...args: any[]) => any>;
|
|
15
|
-
headers: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
16
|
-
keypadElement: PropTypes.Requireable<PropTypes.InferProps<{
|
|
17
|
-
activate: PropTypes.Validator<(...args: any[]) => any>;
|
|
18
|
-
dismiss: PropTypes.Validator<(...args: any[]) => any>;
|
|
19
|
-
configure: PropTypes.Validator<(...args: any[]) => any>;
|
|
20
|
-
setCursor: PropTypes.Validator<(...args: any[]) => any>;
|
|
21
|
-
setKeyHandler: PropTypes.Validator<(...args: any[]) => any>;
|
|
22
|
-
getDOMNode: PropTypes.Validator<(...args: any[]) => any>;
|
|
23
|
-
}>>;
|
|
24
|
-
trackInteraction: PropTypes.Validator<(...args: any[]) => any>;
|
|
25
|
-
linterContext: PropTypes.Requireable<PropTypes.InferProps<{
|
|
26
|
-
contentType: PropTypes.Requireable<string>;
|
|
27
|
-
highlightLint: PropTypes.Requireable<boolean>;
|
|
28
|
-
paths: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
29
|
-
stack: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
30
|
-
}>>;
|
|
31
|
-
};
|
|
32
|
-
static defaultProps: any;
|
|
28
|
+
static defaultProps: DefaultProps;
|
|
33
29
|
_getRows: () => number;
|
|
34
30
|
_getColumns: () => number;
|
|
35
31
|
getUserInput: () => any;
|