@khanacademy/perseus 21.6.0 → 22.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/article-renderer.d.ts +6 -0
- package/dist/components/highlighting/ui/highlight-set-renderer.d.ts +14 -0
- package/dist/components/highlighting/ui/highlighting-ui.d.ts +17 -0
- package/dist/components/i18n-context.d.ts +16 -0
- package/dist/components/input-with-examples.d.ts +6 -0
- package/dist/components/math-input.d.ts +22 -2
- package/dist/components/number-input.d.ts +6 -0
- package/dist/es/index.js +863 -485
- package/dist/es/index.js.map +1 -1
- package/dist/es/strings.js +312 -0
- package/dist/es/strings.js.map +1 -0
- package/dist/hint-renderer.d.ts +6 -0
- package/dist/hints-renderer.d.ts +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1083 -523
- package/dist/index.js.map +1 -1
- package/dist/multi-items/multi-renderer.d.ts +6 -0
- package/dist/perseus-types.d.ts +3 -2
- package/dist/renderer.d.ts +2 -0
- package/dist/server-item-renderer.d.ts +6 -0
- package/dist/strings.d.ts +190 -0
- package/dist/strings.js +395 -119
- package/dist/strings.js.map +1 -0
- package/dist/types.d.ts +2 -1
- package/dist/util/answer-types.d.ts +4 -12
- package/dist/util.d.ts +2 -1
- package/dist/widgets/categorizer.d.ts +8 -1
- package/dist/widgets/definition.d.ts +6 -0
- package/dist/widgets/deprecated-standin/index.d.ts +6 -0
- package/dist/widgets/explanation.d.ts +6 -0
- package/dist/widgets/expression.d.ts +12 -1
- package/dist/widgets/graded-group-answer-bar.d.ts +6 -0
- package/dist/widgets/graded-group.d.ts +6 -0
- package/dist/widgets/group.d.ts +6 -0
- package/dist/widgets/image.d.ts +6 -0
- package/dist/widgets/input-number.d.ts +8 -1
- package/dist/widgets/interactive-graph.d.ts +6 -0
- package/dist/widgets/interactive-graphs/interactive-graph-question-builder.d.ts +21 -0
- package/dist/widgets/interactive-graphs/locked-point.d.ts +1 -1
- package/dist/widgets/interactive-graphs/mafs-graph.d.ts +1 -0
- package/dist/widgets/interactive-graphs/reducer/use-graph-config.d.ts +1 -0
- package/dist/widgets/label-image/marker.d.ts +6 -0
- package/dist/widgets/label-image.d.ts +6 -0
- package/dist/widgets/matcher.d.ts +6 -0
- package/dist/widgets/matrix.d.ts +9 -1
- package/dist/widgets/molecule.d.ts +6 -0
- package/dist/widgets/number-line.d.ts +6 -0
- package/dist/widgets/numeric-input.d.ts +8 -1
- package/dist/widgets/passage-ref-target.d.ts +6 -0
- package/dist/widgets/passage-ref.d.ts +6 -0
- package/dist/widgets/passage.d.ts +6 -0
- package/dist/widgets/plotter.d.ts +6 -0
- package/dist/widgets/radio/choice-a11y-text.d.ts +2 -1
- package/dist/widgets/radio/radio.d.ts +8 -1
- package/dist/widgets/radio/util.d.ts +2 -1
- package/dist/widgets/table.d.ts +7 -0
- package/dist/widgets/unit.d.ts +8 -1
- package/dist/widgets/video.d.ts +6 -0
- package/dist/widgets.d.ts +2 -1
- package/package.json +18 -6
- package/dist/widgets/label-image/strings.d.ts +0 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PerseusStrings } from "../strings";
|
|
1
2
|
type Guess = any;
|
|
2
3
|
type Predicate = any;
|
|
3
4
|
type Score = {
|
|
@@ -8,27 +9,18 @@ type Score = {
|
|
|
8
9
|
guess: Guess;
|
|
9
10
|
ungraded?: boolean;
|
|
10
11
|
};
|
|
11
|
-
export declare const errors: {
|
|
12
|
-
readonly APPROXIMATED_PI_ERROR: string;
|
|
13
|
-
readonly EXTRA_SYMBOLS_ERROR: string;
|
|
14
|
-
readonly NEEDS_TO_BE_SIMPLFIED_ERROR: string;
|
|
15
|
-
readonly MISSING_PERCENT_ERROR: string;
|
|
16
|
-
readonly MULTIPLICATION_SIGN_ERROR: string;
|
|
17
|
-
readonly WRONG_CASE_ERROR: string;
|
|
18
|
-
readonly WRONG_LETTER_ERROR: string;
|
|
19
|
-
};
|
|
20
12
|
declare const KhanAnswerTypes: {
|
|
21
13
|
readonly predicate: {
|
|
22
14
|
readonly defaultForms: "integer, proper, improper, mixed, decimal";
|
|
23
|
-
readonly createValidatorFunctional: (predicate: Predicate, options: any) => (arg1: Guess) => Score;
|
|
15
|
+
readonly createValidatorFunctional: (predicate: Predicate, options: any, strings: PerseusStrings) => (arg1: Guess) => Score;
|
|
24
16
|
};
|
|
25
17
|
readonly number: {
|
|
26
18
|
readonly convertToPredicate: (correctAnswer: string, options: any) => Predicate;
|
|
27
|
-
readonly createValidatorFunctional: (correctAnswer: string, options: any) => (arg1: Guess) => Score;
|
|
19
|
+
readonly createValidatorFunctional: (correctAnswer: string, options: any, strings: PerseusStrings) => (arg1: Guess) => Score;
|
|
28
20
|
};
|
|
29
21
|
readonly expression: {
|
|
30
22
|
readonly parseSolution: (solutionString: string, options: any) => any;
|
|
31
|
-
readonly createValidatorFunctional: (solution: any, options: any) => (arg1: Guess) => Score;
|
|
23
|
+
readonly createValidatorFunctional: (solution: any, options: any, strings: PerseusStrings) => (arg1: Guess) => Score;
|
|
32
24
|
};
|
|
33
25
|
};
|
|
34
26
|
export default KhanAnswerTypes;
|
package/dist/util.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as GraphieUtil from "./util.graphie";
|
|
2
2
|
import type { Range } from "./perseus-types";
|
|
3
|
+
import type { PerseusStrings } from "./strings";
|
|
3
4
|
import type { Widget, PerseusScore } from "./types";
|
|
4
5
|
import type { KEScore } from "@khanacademy/perseus-core";
|
|
5
6
|
type WordPosition = {
|
|
@@ -51,7 +52,7 @@ declare function keScoreFromPerseusScore(score: PerseusScore, guess: any, state:
|
|
|
51
52
|
* Return the first valid interpretation of 'text' as a number, in the form
|
|
52
53
|
* {value: 2.3, exact: true}.
|
|
53
54
|
*/
|
|
54
|
-
declare function firstNumericalParse(text: string): ParsedValue | null | undefined;
|
|
55
|
+
declare function firstNumericalParse(text: string, strings: PerseusStrings): ParsedValue | null | undefined;
|
|
55
56
|
declare function stringArrayOfSize(size: number): ReadonlyArray<string>;
|
|
56
57
|
/**
|
|
57
58
|
* For a graph's x or y dimension, given the tick step,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { PerseusI18nContext } from "../components/i18n-context";
|
|
2
3
|
import type { PerseusCategorizerWidgetOptions } from "../perseus-types";
|
|
4
|
+
import type { PerseusStrings } from "../strings";
|
|
3
5
|
import type { PerseusScore, WidgetProps } from "../types";
|
|
4
6
|
type UserInput = any;
|
|
5
7
|
export type Rubric = PerseusCategorizerWidgetOptions;
|
|
@@ -16,6 +18,11 @@ type State = {
|
|
|
16
18
|
uniqueId: string;
|
|
17
19
|
};
|
|
18
20
|
export declare class Categorizer extends React.Component<Props, State> {
|
|
21
|
+
static contextType: React.Context<{
|
|
22
|
+
strings: PerseusStrings;
|
|
23
|
+
locale: string;
|
|
24
|
+
}>;
|
|
25
|
+
context: React.ContextType<typeof PerseusI18nContext>;
|
|
19
26
|
static defaultProps: DefaultProps;
|
|
20
27
|
state: State;
|
|
21
28
|
change: (...args: ReadonlyArray<unknown>) => any;
|
|
@@ -23,7 +30,7 @@ export declare class Categorizer extends React.Component<Props, State> {
|
|
|
23
30
|
render(): React.ReactNode;
|
|
24
31
|
onChange(itemNum: any, catNum: any): void;
|
|
25
32
|
simpleValidate: (arg1: Rubric) => PerseusScore;
|
|
26
|
-
static validate(userInput: UserInput, rubric: Rubric): PerseusScore;
|
|
33
|
+
static validate(userInput: UserInput, rubric: Rubric, strings: PerseusStrings): PerseusScore;
|
|
27
34
|
static getUserInputFromProps(props: Props): UserInput;
|
|
28
35
|
}
|
|
29
36
|
type RenderProps = {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { PerseusI18nContext } from "../components/i18n-context";
|
|
2
3
|
import type { PerseusRenderer, PerseusDefinitionWidgetOptions } from "../perseus-types";
|
|
3
4
|
import type { PerseusScore, WidgetProps } from "../types";
|
|
4
5
|
type Empty = Record<never, never>;
|
|
@@ -13,6 +14,11 @@ type DefaultProps = {
|
|
|
13
14
|
definition: string;
|
|
14
15
|
};
|
|
15
16
|
declare class Definition extends React.Component<DefinitionProps> {
|
|
17
|
+
static contextType: React.Context<{
|
|
18
|
+
strings: import("../strings").PerseusStrings;
|
|
19
|
+
locale: string;
|
|
20
|
+
}>;
|
|
21
|
+
context: React.ContextType<typeof PerseusI18nContext>;
|
|
16
22
|
static defaultProps: DefaultProps;
|
|
17
23
|
static validate(userInput: UserInput, rubric: Rubric): PerseusScore;
|
|
18
24
|
getUserInput: () => UserInput;
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
2
3
|
import type { PerseusScore } from "../../types";
|
|
3
4
|
type Props = any;
|
|
4
5
|
type Rubric = any;
|
|
5
6
|
type UserInput = Empty;
|
|
6
7
|
declare class DeprecatedStandin extends React.Component<Props> {
|
|
8
|
+
static contextType: React.Context<{
|
|
9
|
+
strings: import("../../strings").PerseusStrings;
|
|
10
|
+
locale: string;
|
|
11
|
+
}>;
|
|
12
|
+
context: React.ContextType<typeof PerseusI18nContext>;
|
|
7
13
|
static validate(userInput: UserInput, rubric: Rubric): PerseusScore;
|
|
8
14
|
getUserInput: () => UserInput;
|
|
9
15
|
simpleValidate: (arg1: Rubric) => PerseusScore;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { PerseusI18nContext } from "../components/i18n-context";
|
|
2
3
|
import type { PerseusExplanationWidgetOptions } from "../perseus-types";
|
|
3
4
|
import type { PerseusScore, WidgetProps } from "../types";
|
|
4
5
|
type Empty = Record<never, never>;
|
|
@@ -17,6 +18,11 @@ type State = {
|
|
|
17
18
|
expanded: boolean;
|
|
18
19
|
};
|
|
19
20
|
declare class Explanation extends React.Component<Props, State> {
|
|
21
|
+
static contextType: React.Context<{
|
|
22
|
+
strings: import("../strings").PerseusStrings;
|
|
23
|
+
locale: string;
|
|
24
|
+
}>;
|
|
25
|
+
context: React.ContextType<typeof PerseusI18nContext>;
|
|
20
26
|
static defaultProps: DefaultProps;
|
|
21
27
|
static validate(userInput: UserInput, rubric: Rubric): PerseusScore;
|
|
22
28
|
state: State;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { PerseusI18nContext } from "../components/i18n-context";
|
|
2
3
|
import type { DependenciesContext } from "../dependencies";
|
|
3
4
|
import type { PerseusExpressionWidgetOptions } from "../perseus-types";
|
|
5
|
+
import type { PerseusStrings } from "../strings";
|
|
4
6
|
import type { PerseusScore, WidgetProps } from "../types";
|
|
5
7
|
import type { Keys as Key, KeypadConfiguration } from "@khanacademy/math-input";
|
|
6
8
|
type InputPath = ReadonlyArray<string>;
|
|
@@ -39,9 +41,18 @@ type DefaultProps = {
|
|
|
39
41
|
value: Props["value"];
|
|
40
42
|
};
|
|
41
43
|
type OnInputErrorFunctionType = (arg1?: any, arg2?: any, arg3?: any) => boolean | null | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Get the character used for separating decimals.
|
|
46
|
+
*/
|
|
47
|
+
export declare const getDecimalSeparator: (locale: string) => string;
|
|
42
48
|
export declare class Expression extends React.Component<Props, ExpressionState> {
|
|
49
|
+
static contextType: React.Context<{
|
|
50
|
+
strings: PerseusStrings;
|
|
51
|
+
locale: string;
|
|
52
|
+
}>;
|
|
53
|
+
context: React.ContextType<typeof PerseusI18nContext>;
|
|
43
54
|
_isMounted: boolean;
|
|
44
|
-
static validate(userInput: string, rubric: Rubric, onInputError
|
|
55
|
+
static validate(userInput: string, rubric: Rubric, onInputError: OnInputErrorFunctionType | undefined, strings: PerseusStrings, locale: string): PerseusScore;
|
|
45
56
|
static getUserInputFromProps(props: Props): string;
|
|
46
57
|
static getOneCorrectAnswerFromRubric(rubric: Rubric): string | null | undefined;
|
|
47
58
|
static defaultProps: DefaultProps;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { PerseusI18nContext } from "../components/i18n-context";
|
|
2
3
|
import type { APIOptions } from "../types";
|
|
3
4
|
export type ANSWER_BAR_STATES = "HIDDEN" | "ACTIVE" | "INACTIVE" | "INCORRECT" | "CORRECT";
|
|
4
5
|
type Props = {
|
|
@@ -8,6 +9,11 @@ type Props = {
|
|
|
8
9
|
onNextQuestion?: () => unknown;
|
|
9
10
|
};
|
|
10
11
|
declare class GradedGroupAnswerBar extends React.Component<Props> {
|
|
12
|
+
static contextType: React.Context<{
|
|
13
|
+
strings: import("../strings").PerseusStrings;
|
|
14
|
+
locale: string;
|
|
15
|
+
}>;
|
|
16
|
+
context: React.ContextType<typeof PerseusI18nContext>;
|
|
11
17
|
render(): React.ReactNode;
|
|
12
18
|
}
|
|
13
19
|
export default GradedGroupAnswerBar;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { PerseusI18nContext } from "../components/i18n-context";
|
|
2
3
|
import type { ANSWER_BAR_STATES } from "./graded-group-answer-bar";
|
|
3
4
|
import type { PerseusGradedGroupWidgetOptions } from "../perseus-types";
|
|
4
5
|
import type { TrackingGradedGroupExtraArguments, WidgetProps } from "../types";
|
|
@@ -30,6 +31,11 @@ type State = {
|
|
|
30
31
|
answerBarState: ANSWER_BAR_STATES;
|
|
31
32
|
};
|
|
32
33
|
export declare class GradedGroup extends React.Component<Props, State> {
|
|
34
|
+
static contextType: React.Context<{
|
|
35
|
+
strings: import("../strings").PerseusStrings;
|
|
36
|
+
locale: string;
|
|
37
|
+
}>;
|
|
38
|
+
context: React.ContextType<typeof PerseusI18nContext>;
|
|
33
39
|
static defaultProps: DefaultProps;
|
|
34
40
|
state: State;
|
|
35
41
|
shouldComponentUpdate(nextProps: Props, nextState: State): boolean;
|
package/dist/widgets/group.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { PerseusI18nContext } from "../components/i18n-context";
|
|
2
3
|
import Renderer from "../renderer";
|
|
3
4
|
import type { PerseusGroupWidgetOptions } from "../perseus-types";
|
|
4
5
|
import type { ChangeFn, FocusPath, PerseusScore, WidgetProps } from "../types";
|
|
@@ -12,6 +13,11 @@ type DefaultProps = {
|
|
|
12
13
|
linterContext: Props["linterContext"];
|
|
13
14
|
};
|
|
14
15
|
declare class Group extends React.Component<Props> {
|
|
16
|
+
static contextType: React.Context<{
|
|
17
|
+
strings: import("../strings").PerseusStrings;
|
|
18
|
+
locale: string;
|
|
19
|
+
}>;
|
|
20
|
+
context: React.ContextType<typeof PerseusI18nContext>;
|
|
15
21
|
rendererRef: Renderer | null | undefined;
|
|
16
22
|
static defaultProps: DefaultProps;
|
|
17
23
|
componentDidMount(): void;
|
package/dist/widgets/image.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { PerseusI18nContext } from "../components/i18n-context";
|
|
2
3
|
import type { PerseusImageWidgetOptions } from "../perseus-types";
|
|
3
4
|
import type { ChangeFn, PerseusScore, WidgetProps } from "../types";
|
|
4
5
|
type RenderProps = PerseusImageWidgetOptions;
|
|
@@ -28,6 +29,11 @@ type DefaultProps = {
|
|
|
28
29
|
linterContext: Props["linterContext"];
|
|
29
30
|
};
|
|
30
31
|
declare class ImageWidget extends React.Component<Props> {
|
|
32
|
+
static contextType: React.Context<{
|
|
33
|
+
strings: import("../strings").PerseusStrings;
|
|
34
|
+
locale: string;
|
|
35
|
+
}>;
|
|
36
|
+
context: React.ContextType<typeof PerseusI18nContext>;
|
|
31
37
|
static defaultProps: DefaultProps;
|
|
32
38
|
change: ChangeFn;
|
|
33
39
|
getUserInput: () => UserInput;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { PerseusI18nContext } from "../components/i18n-context";
|
|
2
3
|
import type { PerseusInputNumberWidgetOptions } from "../perseus-types";
|
|
4
|
+
import type { PerseusStrings } from "../strings";
|
|
3
5
|
import type { APIOptions, Path, PerseusScore, WidgetProps } from "../types";
|
|
4
6
|
type UserInput = {
|
|
5
7
|
currentValue: string;
|
|
@@ -29,6 +31,11 @@ type DefaultProps = {
|
|
|
29
31
|
size: Props["size"];
|
|
30
32
|
};
|
|
31
33
|
declare class InputNumber extends React.Component<Props> {
|
|
34
|
+
static contextType: React.Context<{
|
|
35
|
+
strings: PerseusStrings;
|
|
36
|
+
locale: string;
|
|
37
|
+
}>;
|
|
38
|
+
context: React.ContextType<typeof PerseusI18nContext>;
|
|
32
39
|
static defaultProps: DefaultProps;
|
|
33
40
|
shouldShowExamples: () => boolean;
|
|
34
41
|
render(): React.ReactNode;
|
|
@@ -46,7 +53,7 @@ declare class InputNumber extends React.Component<Props> {
|
|
|
46
53
|
examples: () => ReadonlyArray<string>;
|
|
47
54
|
static validate(state: {
|
|
48
55
|
currentValue: string;
|
|
49
|
-
}, rubric: Rubric, onInputError?: APIOptions["onInputError"]): PerseusScore;
|
|
56
|
+
}, rubric: Rubric, strings: PerseusStrings, onInputError?: APIOptions["onInputError"]): PerseusScore;
|
|
50
57
|
static getUserInputFromProps(props: Props): {
|
|
51
58
|
currentValue: string;
|
|
52
59
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { PerseusI18nContext } from "../components/i18n-context";
|
|
2
3
|
import type { Coord } from "../interactive2/types";
|
|
3
4
|
import type { PerseusGraphType, PerseusGraphTypeAngle, PerseusGraphTypePoint, PerseusGraphTypePolygon, PerseusGraphTypeSegment, PerseusInteractiveGraphWidgetOptions } from "../perseus-types";
|
|
4
5
|
import type { Widget } from "../renderer";
|
|
@@ -25,6 +26,11 @@ type DefaultProps = {
|
|
|
25
26
|
graph: Props["graph"];
|
|
26
27
|
};
|
|
27
28
|
declare class LegacyInteractiveGraph extends React.Component<Props, State> {
|
|
29
|
+
static contextType: React.Context<{
|
|
30
|
+
strings: import("../strings").PerseusStrings;
|
|
31
|
+
locale: string;
|
|
32
|
+
}>;
|
|
33
|
+
context: React.ContextType<typeof PerseusI18nContext>;
|
|
28
34
|
angle: any | null | undefined;
|
|
29
35
|
circle: any | null | undefined;
|
|
30
36
|
graphie: any | null | undefined;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PerseusRenderer } from "../../perseus-types";
|
|
2
|
+
import type { Interval, vec } from "mafs";
|
|
3
|
+
export declare function interactiveGraphQuestionBuilder(): InteractiveGraphQuestionBuilder;
|
|
4
|
+
declare class InteractiveGraphQuestionBuilder {
|
|
5
|
+
gridStep: vec.Vector2;
|
|
6
|
+
labels: [string, string];
|
|
7
|
+
markings: "graph" | "grid" | "none";
|
|
8
|
+
xRange: Interval;
|
|
9
|
+
yRange: Interval;
|
|
10
|
+
snapStep: vec.Vector2;
|
|
11
|
+
tickStep: vec.Vector2;
|
|
12
|
+
build(): PerseusRenderer;
|
|
13
|
+
withGridStep(x: number, y: number): InteractiveGraphQuestionBuilder;
|
|
14
|
+
withAxisLabels(x: string, y: string): InteractiveGraphQuestionBuilder;
|
|
15
|
+
withMarkings(markings: "graph" | "grid" | "none"): InteractiveGraphQuestionBuilder;
|
|
16
|
+
withXRange(min: number, max: number): InteractiveGraphQuestionBuilder;
|
|
17
|
+
withYRange(min: number, max: number): InteractiveGraphQuestionBuilder;
|
|
18
|
+
withSnapStep(x: number, y: number): InteractiveGraphQuestionBuilder;
|
|
19
|
+
withTickStep(x: number, y: number): InteractiveGraphQuestionBuilder;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -16,6 +16,7 @@ export type Props = {
|
|
|
16
16
|
containerSizeClass: InteractiveGraphProps["containerSizeClass"];
|
|
17
17
|
markings: InteractiveGraphProps["markings"];
|
|
18
18
|
onChange: InteractiveGraphProps["onChange"];
|
|
19
|
+
showTooltips: Required<InteractiveGraphProps["showTooltips"]>;
|
|
19
20
|
};
|
|
20
21
|
export declare const StatefulMafsGraph: React.ForwardRefExoticComponent<Props & React.RefAttributes<Partial<Widget>>>;
|
|
21
22
|
type MafsGraphProps = Props & {
|
|
@@ -4,6 +4,7 @@ type GraphConfig = {
|
|
|
4
4
|
range: [Interval, Interval];
|
|
5
5
|
snapStep: vec.Vector2;
|
|
6
6
|
markings: "graph" | "grid" | "none";
|
|
7
|
+
showTooltips: boolean;
|
|
7
8
|
};
|
|
8
9
|
export declare const GraphConfigContext: React.Context<GraphConfig>;
|
|
9
10
|
export default function useGraphConfig(): GraphConfig;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
/// <reference path="../../../types/aphrodite.d.ts" />
|
|
7
7
|
import * as React from "react";
|
|
8
|
+
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
8
9
|
import type { InteractiveMarkerType } from "./types";
|
|
9
10
|
import type { AnalyticsEventHandlerFn } from "@khanacademy/perseus-core";
|
|
10
11
|
import type { CSSProperties } from "aphrodite";
|
|
@@ -21,6 +22,11 @@ type Props = InteractiveMarkerType & {
|
|
|
21
22
|
hovered: boolean;
|
|
22
23
|
};
|
|
23
24
|
export default class Marker extends React.Component<Props> {
|
|
25
|
+
static contextType: React.Context<{
|
|
26
|
+
strings: import("../../strings").PerseusStrings;
|
|
27
|
+
locale: string;
|
|
28
|
+
}>;
|
|
29
|
+
context: React.ContextType<typeof PerseusI18nContext>;
|
|
24
30
|
_icon: HTMLElement | null | undefined;
|
|
25
31
|
static defaultProps: {
|
|
26
32
|
selected: ReadonlyArray<any>;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* knowledge by directly interacting with the image.
|
|
7
7
|
*/
|
|
8
8
|
import * as React from "react";
|
|
9
|
+
import { PerseusI18nContext } from "../components/i18n-context";
|
|
9
10
|
import Marker from "./label-image/marker";
|
|
10
11
|
import type { InteractiveMarkerType, InteractiveMarkerScore } from "./label-image/types";
|
|
11
12
|
import type { DependencyProps } from "../dependencies";
|
|
@@ -52,6 +53,11 @@ type LabelImageState = {
|
|
|
52
53
|
hideAnswers: boolean;
|
|
53
54
|
};
|
|
54
55
|
export declare class LabelImage extends React.Component<LabelImageProps, LabelImageState> {
|
|
56
|
+
static contextType: React.Context<{
|
|
57
|
+
strings: import("../strings").PerseusStrings;
|
|
58
|
+
locale: string;
|
|
59
|
+
}>;
|
|
60
|
+
context: React.ContextType<typeof PerseusI18nContext>;
|
|
55
61
|
_markers: Array<Marker | null | undefined>;
|
|
56
62
|
static gradeMarker(marker: InteractiveMarkerType): InteractiveMarkerScore;
|
|
57
63
|
static validate(state: MarkersState, rubric?: LabelImageProps): PerseusScore;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import PropTypes from "prop-types";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { PerseusI18nContext } from "../components/i18n-context";
|
|
3
4
|
import type { SortableOption } from "../components/sortable";
|
|
4
5
|
type State = {
|
|
5
6
|
leftHeight: number;
|
|
@@ -7,6 +8,11 @@ type State = {
|
|
|
7
8
|
texRendererLoaded: boolean;
|
|
8
9
|
};
|
|
9
10
|
export declare class Matcher extends React.Component<any, any> {
|
|
11
|
+
static contextType: React.Context<{
|
|
12
|
+
strings: import("../strings").PerseusStrings;
|
|
13
|
+
locale: string;
|
|
14
|
+
}>;
|
|
15
|
+
context: React.ContextType<typeof PerseusI18nContext>;
|
|
10
16
|
static propTypes: {
|
|
11
17
|
apiOptions: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
12
18
|
isArticle: PropTypes.Validator<boolean>;
|
package/dist/widgets/matrix.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { PerseusI18nContext } from "../components/i18n-context";
|
|
2
3
|
import type { PerseusMatrixWidgetOptions } from "../perseus-types";
|
|
3
|
-
import type {
|
|
4
|
+
import type { PerseusStrings } from "../strings";
|
|
5
|
+
import type { WidgetProps, PerseusScore } from "../types";
|
|
4
6
|
type Rubric = PerseusMatrixWidgetOptions;
|
|
5
7
|
type ExternalProps = WidgetProps<PerseusMatrixWidgetOptions, Rubric>;
|
|
6
8
|
type Props = ExternalProps & {
|
|
@@ -23,8 +25,14 @@ type State = {
|
|
|
23
25
|
enterTheMatrix: number;
|
|
24
26
|
};
|
|
25
27
|
declare class Matrix extends React.Component<Props, State> {
|
|
28
|
+
static contextType: React.Context<{
|
|
29
|
+
strings: PerseusStrings;
|
|
30
|
+
locale: string;
|
|
31
|
+
}>;
|
|
32
|
+
context: React.ContextType<typeof PerseusI18nContext>;
|
|
26
33
|
cursorPosition: [number, number];
|
|
27
34
|
static defaultProps: DefaultProps;
|
|
35
|
+
static validate(state: any, rubric: any, strings: PerseusStrings): PerseusScore;
|
|
28
36
|
state: State;
|
|
29
37
|
componentDidMount(): void;
|
|
30
38
|
render(): React.ReactNode;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { PerseusI18nContext } from "../components/i18n-context";
|
|
2
3
|
import type { PerseusMoleculeRendererWidgetOptions } from "../perseus-types";
|
|
3
4
|
type MoleculeState = {
|
|
4
5
|
parsedSmiles: any;
|
|
@@ -10,6 +11,11 @@ type Props = {
|
|
|
10
11
|
rotationAngle: PerseusMoleculeRendererWidgetOptions["rotationAngle"];
|
|
11
12
|
};
|
|
12
13
|
export declare class Molecule extends React.Component<Props, MoleculeState> {
|
|
14
|
+
static contextType: React.Context<{
|
|
15
|
+
strings: import("../strings").PerseusStrings;
|
|
16
|
+
locale: string;
|
|
17
|
+
}>;
|
|
18
|
+
context: React.ContextType<typeof PerseusI18nContext>;
|
|
13
19
|
state: MoleculeState;
|
|
14
20
|
UNSAFE_componentWillMount(): void;
|
|
15
21
|
componentDidMount(): void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { PerseusI18nContext } from "../components/i18n-context";
|
|
2
3
|
import type { ChangeableProps } from "../mixins/changeable";
|
|
3
4
|
import type { APIOptions } from "../types";
|
|
4
5
|
type Props = ChangeableProps & {
|
|
@@ -40,6 +41,11 @@ type State = {
|
|
|
40
41
|
numDivisionsEmpty: boolean;
|
|
41
42
|
};
|
|
42
43
|
declare class NumberLine extends React.Component<Props, State> {
|
|
44
|
+
static contextType: React.Context<{
|
|
45
|
+
strings: import("../strings").PerseusStrings;
|
|
46
|
+
locale: string;
|
|
47
|
+
}>;
|
|
48
|
+
context: React.ContextType<typeof PerseusI18nContext>;
|
|
43
49
|
static defaultProps: DefaultProps;
|
|
44
50
|
state: any;
|
|
45
51
|
change: (...args: ReadonlyArray<unknown>) => any;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { PerseusI18nContext } from "../components/i18n-context";
|
|
2
3
|
import InputWithExamples from "../components/input-with-examples";
|
|
3
4
|
import SimpleKeypadInput from "../components/simple-keypad-input";
|
|
4
5
|
import type { PerseusNumericInputWidgetOptions, PerseusNumericInputAnswerForm } from "../perseus-types";
|
|
6
|
+
import type { PerseusStrings } from "../strings";
|
|
5
7
|
import type { FocusPath, PerseusScore, WidgetProps } from "../types";
|
|
6
8
|
type UserInput = {
|
|
7
9
|
currentValue: string;
|
|
@@ -32,11 +34,16 @@ type State = {
|
|
|
32
34
|
previousValues: ReadonlyArray<string>;
|
|
33
35
|
};
|
|
34
36
|
export declare class NumericInput extends React.Component<Props, State> {
|
|
37
|
+
static contextType: React.Context<{
|
|
38
|
+
strings: PerseusStrings;
|
|
39
|
+
locale: string;
|
|
40
|
+
}>;
|
|
41
|
+
context: React.ContextType<typeof PerseusI18nContext>;
|
|
35
42
|
inputRef: SimpleKeypadInput | InputWithExamples | null | undefined;
|
|
36
43
|
static defaultProps: DefaultProps;
|
|
37
44
|
static getUserInputFromProps(props: Props): UserInput;
|
|
38
45
|
static getOneCorrectAnswerFromRubric(rubric: Rubric): string | null | undefined;
|
|
39
|
-
static validate(userInput: UserInput, rubric: Rubric): PerseusScore;
|
|
46
|
+
static validate(userInput: UserInput, rubric: Rubric, strings: PerseusStrings): PerseusScore;
|
|
40
47
|
state: State;
|
|
41
48
|
examples: () => ReadonlyArray<string>;
|
|
42
49
|
shouldShowExamples: () => boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { PerseusI18nContext } from "../components/i18n-context";
|
|
2
3
|
import * as Changeable from "../mixins/changeable";
|
|
3
4
|
import type { PerseusPassageRefTargetWidgetOptions } from "../perseus-types";
|
|
4
5
|
import type { APIOptions } from "../types";
|
|
@@ -13,6 +14,11 @@ type DefaultProps = {
|
|
|
13
14
|
linterContext: Props["linterContext"];
|
|
14
15
|
};
|
|
15
16
|
declare class PassageRefTarget extends React.Component<Props> {
|
|
17
|
+
static contextType: React.Context<{
|
|
18
|
+
strings: import("../strings").PerseusStrings;
|
|
19
|
+
locale: string;
|
|
20
|
+
}>;
|
|
21
|
+
context: React.ContextType<typeof PerseusI18nContext>;
|
|
16
22
|
static defaultProps: DefaultProps;
|
|
17
23
|
static validate(state: any, rubric: any): any;
|
|
18
24
|
getUserInput: () => any;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { PerseusI18nContext } from "../components/i18n-context";
|
|
2
3
|
import type { PerseusPassageRefWidgetOptions } from "../perseus-types";
|
|
3
4
|
import type { ChangeFn, PerseusScore, WidgetProps } from "../types";
|
|
4
5
|
import type { LinterContextProps } from "@khanacademy/perseus-linter";
|
|
@@ -26,6 +27,11 @@ type State = {
|
|
|
26
27
|
content: string | null | undefined;
|
|
27
28
|
};
|
|
28
29
|
declare class PassageRef extends React.Component<Props, State> {
|
|
30
|
+
static contextType: React.Context<{
|
|
31
|
+
strings: import("../strings").PerseusStrings;
|
|
32
|
+
locale: string;
|
|
33
|
+
}>;
|
|
34
|
+
context: React.ContextType<typeof PerseusI18nContext>;
|
|
29
35
|
displayName: string;
|
|
30
36
|
_isMounted: boolean;
|
|
31
37
|
_throttledUpdateRange: () => void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { PerseusI18nContext } from "../components/i18n-context";
|
|
2
3
|
import type { ParseState } from "./passage/passage-markdown";
|
|
3
4
|
import type { SerializedHighlightSet } from "../components/highlighting/types";
|
|
4
5
|
import type { ChangeableProps } from "../mixins/changeable";
|
|
@@ -42,6 +43,11 @@ export type Reference = {
|
|
|
42
43
|
content: string | null | undefined;
|
|
43
44
|
};
|
|
44
45
|
export declare class Passage extends React.Component<PassageProps, PassageState> {
|
|
46
|
+
static contextType: React.Context<{
|
|
47
|
+
strings: import("../strings").PerseusStrings;
|
|
48
|
+
locale: string;
|
|
49
|
+
}>;
|
|
50
|
+
context: React.ContextType<typeof PerseusI18nContext>;
|
|
45
51
|
_contentRef: HTMLDivElement | null | undefined;
|
|
46
52
|
_lineHeightMeasurerRef: LineHeightMeasurer | null | undefined;
|
|
47
53
|
_onResize: () => Record<any, any>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { PerseusI18nContext } from "../components/i18n-context";
|
|
2
3
|
import type { PerseusPlotterWidgetOptions } from "../perseus-types";
|
|
3
4
|
import type { WidgetProps } from "../types";
|
|
4
5
|
type Rubric = PerseusPlotterWidgetOptions;
|
|
@@ -25,6 +26,11 @@ type State = {
|
|
|
25
26
|
categoryHeights: Record<string, number>;
|
|
26
27
|
};
|
|
27
28
|
export declare class Plotter extends React.Component<Props, State> {
|
|
29
|
+
static contextType: React.Context<{
|
|
30
|
+
strings: import("../strings").PerseusStrings;
|
|
31
|
+
locale: string;
|
|
32
|
+
}>;
|
|
33
|
+
context: React.ContextType<typeof PerseusI18nContext>;
|
|
28
34
|
shouldSetupGraphie: boolean;
|
|
29
35
|
_isMounted: boolean;
|
|
30
36
|
horizHairline: any;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import type { PerseusStrings } from "../../strings";
|
|
2
|
+
declare function getA11yText(letter: string, checked: boolean, correct: boolean, crossedOut: boolean, showCorrectness: boolean, strings: PerseusStrings): string;
|
|
2
3
|
export default getA11yText;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
2
3
|
import type { FocusFunction } from "./base-radio";
|
|
3
4
|
import type { PerseusRadioChoice, PerseusRadioWidgetOptions, ShowSolutions } from "../../perseus-types";
|
|
5
|
+
import type { PerseusStrings } from "../../strings";
|
|
4
6
|
import type { PerseusScore, WidgetProps, ChoiceState } from "../../types";
|
|
5
7
|
export type RenderProps = {
|
|
6
8
|
numCorrect: number;
|
|
@@ -29,9 +31,14 @@ export type RadioChoiceWithMetadata = PerseusRadioChoice & {
|
|
|
29
31
|
correct: boolean;
|
|
30
32
|
};
|
|
31
33
|
declare class Radio extends React.Component<Props> {
|
|
34
|
+
static contextType: React.Context<{
|
|
35
|
+
strings: PerseusStrings;
|
|
36
|
+
locale: string;
|
|
37
|
+
}>;
|
|
38
|
+
context: React.ContextType<typeof PerseusI18nContext>;
|
|
32
39
|
focusFunction: FocusFunction;
|
|
33
40
|
static defaultProps: DefaultProps;
|
|
34
|
-
static validate(userInput: UserInput, rubric: Rubric): PerseusScore;
|
|
41
|
+
static validate(userInput: UserInput, rubric: Rubric, strings: PerseusStrings): PerseusScore;
|
|
35
42
|
static getUserInputFromProps(props: Props): UserInput;
|
|
36
43
|
componentDidUpdate(prevProps: Props): void;
|
|
37
44
|
_renderRenderer: (content?: string) => React.ReactElement;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { PerseusStrings } from "../../strings";
|
|
1
2
|
/**
|
|
2
3
|
* Given a choice's position in the radio widget, return the corresponding
|
|
3
4
|
* "choice letter". (For example, in English, `getChoiceLetter(0)` is "A",
|
|
4
5
|
* `getChoiceLetter(1)` is "B", etc.)
|
|
5
6
|
*/
|
|
6
|
-
export declare function getChoiceLetter(pos: number): string;
|
|
7
|
+
export declare function getChoiceLetter(pos: number, strings: PerseusStrings): string;
|
package/dist/widgets/table.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import PropTypes from "prop-types";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { PerseusI18nContext } from "../components/i18n-context";
|
|
4
|
+
import type { PerseusStrings } from "../strings";
|
|
3
5
|
declare class Table extends React.Component<any> {
|
|
6
|
+
static contextType: React.Context<{
|
|
7
|
+
strings: PerseusStrings;
|
|
8
|
+
locale: string;
|
|
9
|
+
}>;
|
|
10
|
+
context: React.ContextType<typeof PerseusI18nContext>;
|
|
4
11
|
static propTypes: {
|
|
5
12
|
answers: PropTypes.Requireable<((string | null | undefined)[] | null | undefined)[]>;
|
|
6
13
|
editableHeaders: PropTypes.Requireable<boolean>;
|
package/dist/widgets/unit.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { PerseusI18nContext } from "../components/i18n-context";
|
|
2
3
|
import type { PerseusUnitInputWidgetOptions } from "../perseus-types";
|
|
4
|
+
import type { PerseusStrings } from "../strings";
|
|
3
5
|
import type { APIOptions, ChangeHandler, FocusPath } from "../types";
|
|
4
6
|
export declare const countSigfigs: (value: string) => number;
|
|
5
7
|
export declare const sigfigPrint: (num: number, sigfigs: number) => string;
|
|
@@ -34,9 +36,14 @@ type DefaultProps = {
|
|
|
34
36
|
value: Props["value"];
|
|
35
37
|
};
|
|
36
38
|
export declare class OldUnitInput extends React.Component<Props> {
|
|
39
|
+
static contextType: React.Context<{
|
|
40
|
+
strings: PerseusStrings;
|
|
41
|
+
locale: string;
|
|
42
|
+
}>;
|
|
43
|
+
context: React.ContextType<typeof PerseusI18nContext>;
|
|
37
44
|
_errorTimeout: number | null | undefined;
|
|
38
45
|
static defaultProps: DefaultProps;
|
|
39
|
-
static validate(userInput: string, rubric: Rubric): ValidationResult;
|
|
46
|
+
static validate(userInput: string, rubric: Rubric, strings: PerseusStrings): ValidationResult;
|
|
40
47
|
componentDidUpdate(): void;
|
|
41
48
|
componentWillUnmount(): void;
|
|
42
49
|
_showError: () => void;
|