@khanacademy/perseus 21.5.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.css +3 -0
- package/dist/es/index.js +953 -530
- 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.css +3 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1175 -565
- package/dist/index.js.map +1 -1
- package/dist/multi-items/multi-renderer.d.ts +6 -0
- package/dist/perseus-api.d.ts +5 -3
- package/dist/perseus-types.d.ts +18 -8
- package/dist/renderer.d.ts +2 -0
- package/dist/server-item-renderer.d.ts +11 -3
- 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 +10 -6
- 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 +42 -19
- 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-line.d.ts +4 -0
- package/dist/widgets/interactive-graphs/locked-point.d.ts +4 -0
- 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 +16 -6
- 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 +50 -39
- package/dist/widgets/label-image/strings.d.ts +0 -3
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ILogger } from "./logging/log";
|
|
2
2
|
import type { Item } from "./multi-items/item-types";
|
|
3
3
|
import type { PerseusAnswerArea, PerseusRenderer, PerseusWidget, PerseusWidgetsMap } from "./perseus-types";
|
|
4
|
+
import type { PerseusStrings } from "./strings";
|
|
4
5
|
import type { SizeClass } from "./util/sizing-utils";
|
|
5
6
|
import type { InteractiveGraphState } from "./widgets/interactive-graphs/types";
|
|
6
7
|
import type { KeypadAPI } from "@khanacademy/math-input";
|
|
@@ -77,7 +78,8 @@ type TrackInteractionArgs = {
|
|
|
77
78
|
id: string;
|
|
78
79
|
correct?: boolean;
|
|
79
80
|
} & Partial<TrackingGradedGroupExtraArguments> & Partial<TrackingSequenceExtraArguments>;
|
|
80
|
-
export declare const
|
|
81
|
+
export declare const MafsGraphTypeFlags: readonly ["segment", "linear", "linear-system", "ray", "polygon"];
|
|
82
|
+
export declare const InteractiveGraphLockedFeaturesFlags: readonly ["interactive-graph-locked-features-m1"];
|
|
81
83
|
/**
|
|
82
84
|
* APIOptions provides different ways to customize the behaviour of Perseus.
|
|
83
85
|
*
|
|
@@ -203,11 +205,13 @@ export type APIOptions = Readonly<{
|
|
|
203
205
|
/**
|
|
204
206
|
* Flags related to the interactive-graph Mafs migration.
|
|
205
207
|
*
|
|
206
|
-
* Add values to the
|
|
208
|
+
* Add values to the relevant array to create new flags.
|
|
207
209
|
*/
|
|
208
|
-
mafs?: false | {
|
|
209
|
-
[Key in (typeof
|
|
210
|
-
}
|
|
210
|
+
mafs?: false | ({
|
|
211
|
+
[Key in (typeof MafsGraphTypeFlags)[number]]?: boolean;
|
|
212
|
+
} & {
|
|
213
|
+
[Key in (typeof InteractiveGraphLockedFeaturesFlags)[number]]?: boolean;
|
|
214
|
+
});
|
|
211
215
|
};
|
|
212
216
|
/**
|
|
213
217
|
* This is a callback function that returns all of the Widget props
|
|
@@ -321,7 +325,7 @@ export type TrackingSequenceExtraArguments = {
|
|
|
321
325
|
};
|
|
322
326
|
export type Alignment = "default" | "block" | "inline-block" | "inline" | "float-left" | "float-right" | "full-width";
|
|
323
327
|
type WidgetOptions = any;
|
|
324
|
-
export type WidgetTransform = (arg1: WidgetOptions, problemNumber?: number) => any;
|
|
328
|
+
export type WidgetTransform = (arg1: WidgetOptions, strings: PerseusStrings, problemNumber?: number) => any;
|
|
325
329
|
export type WidgetExports<T extends React.ComponentType<any> = React.ComponentType<any>> = Readonly<{
|
|
326
330
|
name: string;
|
|
327
331
|
displayName: string;
|
|
@@ -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;
|
|
@@ -124,13 +135,15 @@ declare const _default: Readonly<{
|
|
|
124
135
|
crossOutEnabled?: boolean | undefined;
|
|
125
136
|
editorChangeDelay?: number | undefined;
|
|
126
137
|
flags?: {
|
|
127
|
-
mafs?: false | {
|
|
138
|
+
mafs?: false | ({
|
|
128
139
|
polygon?: boolean | undefined;
|
|
129
140
|
linear?: boolean | undefined;
|
|
141
|
+
ray?: boolean | undefined;
|
|
130
142
|
segment?: boolean | undefined;
|
|
131
143
|
"linear-system"?: boolean | undefined;
|
|
132
|
-
|
|
133
|
-
|
|
144
|
+
} & {
|
|
145
|
+
"interactive-graph-locked-features-m1"?: boolean | undefined;
|
|
146
|
+
}) | undefined;
|
|
134
147
|
} | undefined;
|
|
135
148
|
onWidgetStartProps?: ((widgets: import("../perseus-types").PerseusWidgetsMap) => void) | undefined;
|
|
136
149
|
}> & {
|
|
@@ -199,13 +212,15 @@ declare const _default: Readonly<{
|
|
|
199
212
|
crossOutEnabled?: boolean | undefined;
|
|
200
213
|
editorChangeDelay?: number | undefined;
|
|
201
214
|
flags?: {
|
|
202
|
-
mafs?: false | {
|
|
215
|
+
mafs?: false | ({
|
|
203
216
|
polygon?: boolean | undefined;
|
|
204
217
|
linear?: boolean | undefined;
|
|
218
|
+
ray?: boolean | undefined;
|
|
205
219
|
segment?: boolean | undefined;
|
|
206
220
|
"linear-system"?: boolean | undefined;
|
|
207
|
-
|
|
208
|
-
|
|
221
|
+
} & {
|
|
222
|
+
"interactive-graph-locked-features-m1"?: boolean | undefined;
|
|
223
|
+
}) | undefined;
|
|
209
224
|
} | undefined;
|
|
210
225
|
onWidgetStartProps?: ((widgets: import("../perseus-types").PerseusWidgetsMap) => void) | undefined;
|
|
211
226
|
}> & {
|
|
@@ -274,13 +289,15 @@ declare const _default: Readonly<{
|
|
|
274
289
|
crossOutEnabled?: boolean | undefined;
|
|
275
290
|
editorChangeDelay?: number | undefined;
|
|
276
291
|
flags?: {
|
|
277
|
-
mafs?: false | {
|
|
292
|
+
mafs?: false | ({
|
|
278
293
|
polygon?: boolean | undefined;
|
|
279
294
|
linear?: boolean | undefined;
|
|
295
|
+
ray?: boolean | undefined;
|
|
280
296
|
segment?: boolean | undefined;
|
|
281
297
|
"linear-system"?: boolean | undefined;
|
|
282
|
-
|
|
283
|
-
|
|
298
|
+
} & {
|
|
299
|
+
"interactive-graph-locked-features-m1"?: boolean | undefined;
|
|
300
|
+
}) | undefined;
|
|
284
301
|
} | undefined;
|
|
285
302
|
onWidgetStartProps?: ((widgets: import("../perseus-types").PerseusWidgetsMap) => void) | undefined;
|
|
286
303
|
}> & {
|
|
@@ -346,13 +363,15 @@ declare const _default: Readonly<{
|
|
|
346
363
|
crossOutEnabled?: boolean | undefined;
|
|
347
364
|
editorChangeDelay?: number | undefined;
|
|
348
365
|
flags?: {
|
|
349
|
-
mafs?: false | {
|
|
366
|
+
mafs?: false | ({
|
|
350
367
|
polygon?: boolean | undefined;
|
|
351
368
|
linear?: boolean | undefined;
|
|
369
|
+
ray?: boolean | undefined;
|
|
352
370
|
segment?: boolean | undefined;
|
|
353
371
|
"linear-system"?: boolean | undefined;
|
|
354
|
-
|
|
355
|
-
|
|
372
|
+
} & {
|
|
373
|
+
"interactive-graph-locked-features-m1"?: boolean | undefined;
|
|
374
|
+
}) | undefined;
|
|
356
375
|
} | undefined;
|
|
357
376
|
onWidgetStartProps?: ((widgets: import("../perseus-types").PerseusWidgetsMap) => void) | undefined;
|
|
358
377
|
}> & {
|
|
@@ -421,13 +440,15 @@ declare const _default: Readonly<{
|
|
|
421
440
|
crossOutEnabled?: boolean | undefined;
|
|
422
441
|
editorChangeDelay?: number | undefined;
|
|
423
442
|
flags?: {
|
|
424
|
-
mafs?: false | {
|
|
443
|
+
mafs?: false | ({
|
|
425
444
|
polygon?: boolean | undefined;
|
|
426
445
|
linear?: boolean | undefined;
|
|
446
|
+
ray?: boolean | undefined;
|
|
427
447
|
segment?: boolean | undefined;
|
|
428
448
|
"linear-system"?: boolean | undefined;
|
|
429
|
-
|
|
430
|
-
|
|
449
|
+
} & {
|
|
450
|
+
"interactive-graph-locked-features-m1"?: boolean | undefined;
|
|
451
|
+
}) | undefined;
|
|
431
452
|
} | undefined;
|
|
432
453
|
onWidgetStartProps?: ((widgets: import("../perseus-types").PerseusWidgetsMap) => void) | undefined;
|
|
433
454
|
}> & {
|
|
@@ -496,13 +517,15 @@ declare const _default: Readonly<{
|
|
|
496
517
|
crossOutEnabled?: boolean | undefined;
|
|
497
518
|
editorChangeDelay?: number | undefined;
|
|
498
519
|
flags?: {
|
|
499
|
-
mafs?: false | {
|
|
520
|
+
mafs?: false | ({
|
|
500
521
|
polygon?: boolean | undefined;
|
|
501
522
|
linear?: boolean | undefined;
|
|
523
|
+
ray?: boolean | undefined;
|
|
502
524
|
segment?: boolean | undefined;
|
|
503
525
|
"linear-system"?: boolean | undefined;
|
|
504
|
-
|
|
505
|
-
|
|
526
|
+
} & {
|
|
527
|
+
"interactive-graph-locked-features-m1"?: boolean | undefined;
|
|
528
|
+
}) | undefined;
|
|
506
529
|
} | undefined;
|
|
507
530
|
onWidgetStartProps?: ((widgets: import("../perseus-types").PerseusWidgetsMap) => void) | undefined;
|
|
508
531
|
}> & {
|
|
@@ -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;
|
|
@@ -123,13 +129,15 @@ declare const _default: Readonly<{
|
|
|
123
129
|
crossOutEnabled?: boolean | undefined;
|
|
124
130
|
editorChangeDelay?: number | undefined;
|
|
125
131
|
flags?: {
|
|
126
|
-
mafs?: false | {
|
|
132
|
+
mafs?: false | ({
|
|
127
133
|
polygon?: boolean | undefined;
|
|
128
134
|
linear?: boolean | undefined;
|
|
135
|
+
ray?: boolean | undefined;
|
|
129
136
|
segment?: boolean | undefined;
|
|
130
137
|
"linear-system"?: boolean | undefined;
|
|
131
|
-
|
|
132
|
-
|
|
138
|
+
} & {
|
|
139
|
+
"interactive-graph-locked-features-m1"?: boolean | undefined;
|
|
140
|
+
}) | undefined;
|
|
133
141
|
} | undefined;
|
|
134
142
|
onWidgetStartProps?: ((widgets: import("..").PerseusWidgetsMap) => void) | undefined;
|
|
135
143
|
}>;
|
|
@@ -180,13 +188,15 @@ declare const _default: Readonly<{
|
|
|
180
188
|
crossOutEnabled?: boolean | undefined;
|
|
181
189
|
editorChangeDelay?: number | undefined;
|
|
182
190
|
flags?: {
|
|
183
|
-
mafs?: false | {
|
|
191
|
+
mafs?: false | ({
|
|
184
192
|
polygon?: boolean | undefined;
|
|
185
193
|
linear?: boolean | undefined;
|
|
194
|
+
ray?: boolean | undefined;
|
|
186
195
|
segment?: boolean | undefined;
|
|
187
196
|
"linear-system"?: boolean | undefined;
|
|
188
|
-
|
|
189
|
-
|
|
197
|
+
} & {
|
|
198
|
+
"interactive-graph-locked-features-m1"?: boolean | undefined;
|
|
199
|
+
}) | undefined;
|
|
190
200
|
} | undefined;
|
|
191
201
|
onWidgetStartProps?: ((widgets: import("..").PerseusWidgetsMap) => void) | undefined;
|
|
192
202
|
}>;
|
|
@@ -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;
|