@khanacademy/perseus 33.2.1 → 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 +541 -585
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +540 -587
- package/dist/index.js.map +1 -1
- package/dist/perseus-api.d.ts +2 -0
- package/dist/perseus-types.d.ts +11 -6
- package/dist/server-item-renderer.d.ts +2 -0
- package/dist/types.d.ts +2 -2
- package/dist/util/answer-types.d.ts +1 -1
- package/dist/util.d.ts +2 -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 +13 -6
- package/dist/widgets/expression/expression.types.d.ts +3 -0
- package/dist/widgets/expression/get-decimal-separator.d.ts +5 -0
- package/dist/widgets/iframe/iframe.d.ts +24 -15
- package/dist/widgets/interactive-graph.d.ts +3 -0
- package/dist/widgets/interactive-graphs/graph-locked-labels-layer.d.ts +2 -0
- package/dist/widgets/interactive-graphs/graphs/components/movable-point-view.d.ts +1 -1
- package/dist/widgets/interactive-graphs/graphs/components/movable-point.d.ts +2 -1
- package/dist/widgets/interactive-graphs/interactive-graph-question-builder.d.ts +15 -4
- package/dist/widgets/interactive-graphs/mafs-graph.d.ts +3 -1
- package/dist/widgets/interactive-graphs/reducer/interactive-graph-action.d.ts +8 -1
- package/dist/widgets/interactive-graphs/stateful-mafs-graph.d.ts +2 -1
- package/dist/widgets/interactive-graphs/types.d.ts +5 -2
- package/dist/widgets/label-image/label-image.d.ts +4 -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 +2 -1
- package/dist/mixins/widget-jsonify-deprecated.d.ts +0 -5
|
@@ -133,6 +133,7 @@ declare const _default: Readonly<{
|
|
|
133
133
|
mafs?: false | ({
|
|
134
134
|
circle?: boolean | undefined;
|
|
135
135
|
polygon?: boolean | undefined;
|
|
136
|
+
none?: boolean | undefined;
|
|
136
137
|
linear?: boolean | undefined;
|
|
137
138
|
quadratic?: boolean | undefined;
|
|
138
139
|
sinusoid?: boolean | undefined;
|
|
@@ -144,6 +145,7 @@ declare const _default: Readonly<{
|
|
|
144
145
|
"unlimited-point"?: boolean | undefined;
|
|
145
146
|
} & {
|
|
146
147
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
|
148
|
+
"locked-point-labels"?: boolean | undefined;
|
|
147
149
|
}) | undefined;
|
|
148
150
|
} | undefined;
|
|
149
151
|
onWidgetStartProps?: ((widgets: import("../..").PerseusWidgetsMap) => void) | undefined;
|
|
@@ -196,6 +198,7 @@ declare const _default: Readonly<{
|
|
|
196
198
|
mafs?: false | ({
|
|
197
199
|
circle?: boolean | undefined;
|
|
198
200
|
polygon?: boolean | undefined;
|
|
201
|
+
none?: boolean | undefined;
|
|
199
202
|
linear?: boolean | undefined;
|
|
200
203
|
quadratic?: boolean | undefined;
|
|
201
204
|
sinusoid?: boolean | undefined;
|
|
@@ -207,6 +210,7 @@ declare const _default: Readonly<{
|
|
|
207
210
|
"unlimited-point"?: boolean | undefined;
|
|
208
211
|
} & {
|
|
209
212
|
"interactive-graph-locked-features-labels"?: boolean | undefined;
|
|
213
|
+
"locked-point-labels"?: boolean | undefined;
|
|
210
214
|
}) | undefined;
|
|
211
215
|
} | undefined;
|
|
212
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;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Core Perseus API (includes renderers and widgets)",
|
|
4
4
|
"author": "Khan Academy",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "
|
|
6
|
+
"version": "34.0.0",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"@khanacademy/perseus-linter": "^1.2.0",
|
|
49
49
|
"@khanacademy/pure-markdown": "^0.3.8",
|
|
50
50
|
"@khanacademy/simple-markdown": "^0.13.1",
|
|
51
|
+
"@types/classnames": "2.2.0",
|
|
51
52
|
"@use-gesture/react": "^10.2.27",
|
|
52
53
|
"mafs": "0.19.0",
|
|
53
54
|
"uuid": "^10.0.0"
|