@khanacademy/perseus 84.0.1 → 84.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/drag-and-drop/choice-bank.d.ts +16 -0
- package/dist/components/zoomable.d.ts +34 -4
- package/dist/es/index.css +4 -4
- package/dist/es/index.css.map +1 -1
- package/dist/es/index.js +63 -63
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +4 -4
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +63 -63
- package/dist/index.js.map +1 -1
- package/dist/renderer.new.d.ts +2 -2
- package/dist/renderer.old.d.ts +2 -2
- package/dist/server-item-renderer.d.ts +21 -11
- package/dist/types.d.ts +7 -9
- package/dist/widget-ai-utils/matcher/matcher-ai-utils.d.ts +1 -1
- package/dist/widget-ai-utils/prompt-types.d.ts +1 -2
- package/dist/widget-container.new.d.ts +1 -8
- package/dist/widget-container.old.d.ts +1 -8
- package/dist/widgets/blank/blank.d.ts +3 -58
- package/dist/widgets/categorizer/categorizer.d.ts +4 -61
- package/dist/widgets/cs-program/cs-program.d.ts +3 -58
- package/dist/widgets/dropdown/dropdown.d.ts +2 -58
- package/dist/widgets/expression/expression.d.ts +4 -124
- package/dist/widgets/iframe/iframe.d.ts +0 -2
- package/dist/widgets/image/components/common-image-props.d.ts +11 -0
- package/dist/widgets/image/components/explore-image-modal-content.d.ts +4 -4
- package/dist/widgets/image/components/explore-image-modal.d.ts +2 -4
- package/dist/widgets/image/components/image-info-area.d.ts +3 -23
- package/dist/widgets/image/image.d.ts +3 -58
- package/dist/widgets/input-number/input-number.d.ts +3 -2
- package/dist/widgets/interaction/interaction.d.ts +0 -5
- package/dist/widgets/interactive-graphs/graphs/polygon.d.ts +3 -2
- package/dist/widgets/interactive-graphs/graphs/strings/polygon.d.ts +3 -2
- package/dist/widgets/interactive-graphs/interactive-graph.d.ts +20 -20
- package/dist/widgets/interactive-graphs/mafs-graph.d.ts +11 -10
- package/dist/widgets/interactive-graphs/stateful-mafs-graph.d.ts +12 -12
- package/dist/widgets/label-image/label-image.d.ts +2 -61
- package/dist/widgets/matcher/matcher.d.ts +2 -58
- package/dist/widgets/measurer/measurer.d.ts +1 -1
- package/dist/widgets/mock-widgets/mock-widget.d.ts +3 -3
- package/dist/widgets/number-line/number-line.d.ts +3 -59
- package/dist/widgets/numeric-input/numeric-input.d.ts +3 -119
- package/dist/widgets/phet-simulation/phet-simulation.d.ts +1 -1
- package/dist/widgets/python-program/python-program.d.ts +7 -8
- package/dist/widgets/table/table.d.ts +2 -58
- package/package.json +9 -9
- package/dist/widget-ai-utils/input-number/input-number-ai-utils.d.ts +0 -29
|
@@ -1,68 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type { Widget, WidgetProps
|
|
2
|
+
import type { Widget, WidgetProps } from "../../types";
|
|
3
3
|
import type { PerseusExpressionRubric, PerseusExpressionUserInput, PerseusExpressionWidgetOptions } from "@khanacademy/perseus-core";
|
|
4
|
-
type
|
|
5
|
-
export declare const Expression: React.ForwardRefExoticComponent<
|
|
6
|
-
trackInteraction: (extraData?: Empty | undefined) => void;
|
|
7
|
-
widgetId: string;
|
|
8
|
-
widgetIndex: number;
|
|
9
|
-
alignment: string | null | undefined;
|
|
10
|
-
static: boolean | null | undefined;
|
|
11
|
-
graded?: boolean | null;
|
|
12
|
-
problemNum: number | null | undefined;
|
|
13
|
-
apiOptions: Readonly<Readonly<{
|
|
14
|
-
isArticle?: boolean;
|
|
15
|
-
onFocusChange?: (newFocusPath: FocusPath, oldFocusPath: FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
|
|
16
|
-
showAlignmentOptions?: boolean;
|
|
17
|
-
readOnly?: boolean;
|
|
18
|
-
editingDisabled?: boolean;
|
|
19
|
-
answerableCallback?: (arg1: boolean) => unknown;
|
|
20
|
-
getAnotherHint?: () => unknown;
|
|
21
|
-
interactionCallback?: (widgetData: {
|
|
22
|
-
[widgetId: string]: any;
|
|
23
|
-
}) => void;
|
|
24
|
-
imagePlaceholder?: React.ReactNode;
|
|
25
|
-
widgetPlaceholder?: React.ReactNode;
|
|
26
|
-
baseElements?: {
|
|
27
|
-
Link: React.ComponentType<any>;
|
|
28
|
-
};
|
|
29
|
-
trackInteraction?: (args: {
|
|
30
|
-
type: string;
|
|
31
|
-
id: string;
|
|
32
|
-
correct?: boolean;
|
|
33
|
-
} & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
|
|
34
|
-
visible: number;
|
|
35
|
-
}>) => void;
|
|
36
|
-
customKeypad?: boolean;
|
|
37
|
-
isMobile?: boolean;
|
|
38
|
-
isMobileApp?: boolean;
|
|
39
|
-
hintProgressColor?: string;
|
|
40
|
-
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
|
|
41
|
-
}> & {
|
|
42
|
-
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
43
|
-
isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
|
|
44
|
-
isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
|
|
45
|
-
isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
|
|
46
|
-
editingDisabled: NonNullable<import("../..").APIOptions["editingDisabled"]>;
|
|
47
|
-
onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
|
|
48
|
-
readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
|
|
49
|
-
showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
|
|
50
|
-
}>;
|
|
51
|
-
keypadElement?: any;
|
|
52
|
-
onFocus: (blurPath: FocusPath) => void;
|
|
53
|
-
onBlur: (blurPath: FocusPath) => void;
|
|
54
|
-
findWidgets: import("../../types").FindWidgetsFunction;
|
|
55
|
-
reviewMode: boolean;
|
|
56
|
-
showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
|
|
57
|
-
handleUserInput: (newUserInput: string, cb?: () => void, silent?: boolean) => void;
|
|
58
|
-
userInput: string;
|
|
59
|
-
linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
|
|
60
|
-
containerSizeClass: import("../../util/sizing-utils").SizeClass;
|
|
61
|
-
} & {
|
|
62
|
-
buttonSets: NonNullable<ExternalProps["buttonSets"]>;
|
|
63
|
-
functions: NonNullable<ExternalProps["functions"]>;
|
|
64
|
-
times: NonNullable<ExternalProps["times"]>;
|
|
65
|
-
} & React.RefAttributes<Widget>>;
|
|
4
|
+
type Props = WidgetProps<PerseusExpressionWidgetOptions, PerseusExpressionUserInput>;
|
|
5
|
+
export declare const Expression: React.ForwardRefExoticComponent<Props & React.RefAttributes<Widget>>;
|
|
66
6
|
/**
|
|
67
7
|
* @deprecated and likely a very broken API
|
|
68
8
|
* [LEMS-3185] do not trust serializedState
|
|
@@ -74,67 +14,7 @@ declare function getCorrectUserInput(options: PerseusExpressionWidgetOptions): P
|
|
|
74
14
|
declare const _default: {
|
|
75
15
|
name: string;
|
|
76
16
|
displayName: string;
|
|
77
|
-
widget: React.ForwardRefExoticComponent<
|
|
78
|
-
trackInteraction: (extraData?: Empty | undefined) => void;
|
|
79
|
-
widgetId: string;
|
|
80
|
-
widgetIndex: number;
|
|
81
|
-
alignment: string | null | undefined;
|
|
82
|
-
static: boolean | null | undefined;
|
|
83
|
-
graded?: boolean | null;
|
|
84
|
-
problemNum: number | null | undefined;
|
|
85
|
-
apiOptions: Readonly<Readonly<{
|
|
86
|
-
isArticle?: boolean;
|
|
87
|
-
onFocusChange?: (newFocusPath: FocusPath, oldFocusPath: FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
|
|
88
|
-
showAlignmentOptions?: boolean;
|
|
89
|
-
readOnly?: boolean;
|
|
90
|
-
editingDisabled?: boolean;
|
|
91
|
-
answerableCallback?: (arg1: boolean) => unknown;
|
|
92
|
-
getAnotherHint?: () => unknown;
|
|
93
|
-
interactionCallback?: (widgetData: {
|
|
94
|
-
[widgetId: string]: any;
|
|
95
|
-
}) => void;
|
|
96
|
-
imagePlaceholder?: React.ReactNode;
|
|
97
|
-
widgetPlaceholder?: React.ReactNode;
|
|
98
|
-
baseElements?: {
|
|
99
|
-
Link: React.ComponentType<any>;
|
|
100
|
-
};
|
|
101
|
-
trackInteraction?: (args: {
|
|
102
|
-
type: string;
|
|
103
|
-
id: string;
|
|
104
|
-
correct?: boolean;
|
|
105
|
-
} & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
|
|
106
|
-
visible: number;
|
|
107
|
-
}>) => void;
|
|
108
|
-
customKeypad?: boolean;
|
|
109
|
-
isMobile?: boolean;
|
|
110
|
-
isMobileApp?: boolean;
|
|
111
|
-
hintProgressColor?: string;
|
|
112
|
-
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
|
|
113
|
-
}> & {
|
|
114
|
-
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
115
|
-
isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
|
|
116
|
-
isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
|
|
117
|
-
isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
|
|
118
|
-
editingDisabled: NonNullable<import("../..").APIOptions["editingDisabled"]>;
|
|
119
|
-
onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
|
|
120
|
-
readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
|
|
121
|
-
showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
|
|
122
|
-
}>;
|
|
123
|
-
keypadElement?: any;
|
|
124
|
-
onFocus: (blurPath: FocusPath) => void;
|
|
125
|
-
onBlur: (blurPath: FocusPath) => void;
|
|
126
|
-
findWidgets: import("../../types").FindWidgetsFunction;
|
|
127
|
-
reviewMode: boolean;
|
|
128
|
-
showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
|
|
129
|
-
handleUserInput: (newUserInput: string, cb?: () => void, silent?: boolean) => void;
|
|
130
|
-
userInput: string;
|
|
131
|
-
linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
|
|
132
|
-
containerSizeClass: import("../../util/sizing-utils").SizeClass;
|
|
133
|
-
} & {
|
|
134
|
-
buttonSets: NonNullable<ExternalProps["buttonSets"]>;
|
|
135
|
-
functions: NonNullable<ExternalProps["functions"]>;
|
|
136
|
-
times: NonNullable<ExternalProps["times"]>;
|
|
137
|
-
} & React.RefAttributes<Widget>>;
|
|
17
|
+
widget: React.ForwardRefExoticComponent<Props & React.RefAttributes<Widget>>;
|
|
138
18
|
isLintable: true;
|
|
139
19
|
getOneCorrectAnswerFromRubric: typeof getOneCorrectAnswerFromRubric;
|
|
140
20
|
getStartUserInput: typeof getStartUserInput;
|
|
@@ -13,8 +13,6 @@ import type { UnsupportedWidgetPromptJSON } from "../../widget-ai-utils/unsuppor
|
|
|
13
13
|
import type { PerseusIFrameUserInput, PerseusIFrameWidgetOptions } from "@khanacademy/perseus-core";
|
|
14
14
|
type Props = WidgetProps<PerseusIFrameWidgetOptions, PerseusIFrameUserInput>;
|
|
15
15
|
type DefaultProps = {
|
|
16
|
-
allowFullScreen: Props["allowFullScreen"];
|
|
17
|
-
allowTopNavigation: Props["allowTopNavigation"];
|
|
18
16
|
userInput: Props["userInput"];
|
|
19
17
|
};
|
|
20
18
|
declare class Iframe extends React.Component<Props> implements Widget {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { APIOptions } from "../../../types";
|
|
2
|
+
import type { PerseusImageWidgetOptions } from "@khanacademy/perseus-core";
|
|
3
|
+
import type { LinterContextProps } from "@khanacademy/perseus-linter";
|
|
4
|
+
export interface CommonImageProps {
|
|
5
|
+
options: PerseusImageWidgetOptions;
|
|
6
|
+
linterContext: LinterContextProps;
|
|
7
|
+
apiOptions: APIOptions;
|
|
8
|
+
widgetId: string;
|
|
9
|
+
isGifPlaying: boolean;
|
|
10
|
+
setIsGifPlaying: (isPlaying: boolean) => void;
|
|
11
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type { CommonImageProps
|
|
3
|
-
|
|
2
|
+
import type { CommonImageProps } from "./common-image-props";
|
|
3
|
+
interface Props extends CommonImageProps {
|
|
4
4
|
captionId: string;
|
|
5
5
|
longDescId: string;
|
|
6
|
-
}
|
|
7
|
-
export default function ExploreImageModalContent({
|
|
6
|
+
}
|
|
7
|
+
export default function ExploreImageModalContent({ options, linterContext, apiOptions, captionId, longDescId, }: Props): React.JSX.Element | null;
|
|
8
8
|
export {};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type { CommonImageProps
|
|
3
|
-
|
|
4
|
-
export declare const ExploreImageModal: (props: Props) => React.JSX.Element;
|
|
5
|
-
export {};
|
|
2
|
+
import type { CommonImageProps } from "./common-image-props";
|
|
3
|
+
export declare const ExploreImageModal: (props: CommonImageProps) => React.JSX.Element;
|
|
@@ -1,28 +1,8 @@
|
|
|
1
|
-
import { type Interval, type PerseusImageBackground, type PerseusImageLabel, type Size } from "@khanacademy/perseus-core";
|
|
2
1
|
import * as React from "react";
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
export interface GifProps {
|
|
6
|
-
isGifPlaying: boolean;
|
|
7
|
-
setIsGifPlaying: (isPaused: boolean) => void;
|
|
8
|
-
}
|
|
9
|
-
export interface CommonImageProps {
|
|
10
|
-
backgroundImage: PerseusImageBackground;
|
|
11
|
-
scale: number;
|
|
12
|
-
title: string;
|
|
13
|
-
caption: string;
|
|
14
|
-
alt: string;
|
|
15
|
-
longDescription: string;
|
|
16
|
-
box: Size;
|
|
17
|
-
labels: Array<PerseusImageLabel>;
|
|
18
|
-
range: [Interval, Interval];
|
|
19
|
-
linterContext: LinterContextProps;
|
|
20
|
-
apiOptions: APIOptions;
|
|
21
|
-
widgetId: string;
|
|
22
|
-
}
|
|
23
|
-
type Props = GifProps & CommonImageProps & {
|
|
2
|
+
import type { CommonImageProps } from "./common-image-props";
|
|
3
|
+
interface Props extends CommonImageProps {
|
|
24
4
|
isAnimatedGif: boolean;
|
|
25
|
-
}
|
|
5
|
+
}
|
|
26
6
|
/**
|
|
27
7
|
* The ImageInfoArea component includes the GIF controls, description modal
|
|
28
8
|
* launcher, and caption for the image. This is displayed underneath the image
|
|
@@ -1,66 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type { Widget } from "../../types";
|
|
2
|
+
import type { Widget, WidgetProps } from "../../types";
|
|
3
3
|
import type { PerseusImageWidgetOptions } from "@khanacademy/perseus-core";
|
|
4
|
+
type ImageWidgetProps = WidgetProps<PerseusImageWidgetOptions>;
|
|
4
5
|
declare const _default: {
|
|
5
6
|
name: string;
|
|
6
7
|
displayName: string;
|
|
7
|
-
widget: React.ForwardRefExoticComponent<
|
|
8
|
-
trackInteraction: (extraData?: Empty | undefined) => void;
|
|
9
|
-
widgetId: string;
|
|
10
|
-
widgetIndex: number;
|
|
11
|
-
alignment: string | null | undefined;
|
|
12
|
-
static: boolean | null | undefined;
|
|
13
|
-
graded?: boolean | null;
|
|
14
|
-
problemNum: number | null | undefined;
|
|
15
|
-
apiOptions: Readonly<Readonly<{
|
|
16
|
-
isArticle?: boolean;
|
|
17
|
-
onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
|
|
18
|
-
showAlignmentOptions?: boolean;
|
|
19
|
-
readOnly?: boolean;
|
|
20
|
-
editingDisabled?: boolean;
|
|
21
|
-
answerableCallback?: (arg1: boolean) => unknown;
|
|
22
|
-
getAnotherHint?: () => unknown;
|
|
23
|
-
interactionCallback?: (widgetData: {
|
|
24
|
-
[widgetId: string]: any;
|
|
25
|
-
}) => void;
|
|
26
|
-
imagePlaceholder?: React.ReactNode;
|
|
27
|
-
widgetPlaceholder?: React.ReactNode;
|
|
28
|
-
baseElements?: {
|
|
29
|
-
Link: React.ComponentType<any>;
|
|
30
|
-
};
|
|
31
|
-
trackInteraction?: (args: {
|
|
32
|
-
type: string;
|
|
33
|
-
id: string;
|
|
34
|
-
correct?: boolean;
|
|
35
|
-
} & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
|
|
36
|
-
visible: number;
|
|
37
|
-
}>) => void;
|
|
38
|
-
customKeypad?: boolean;
|
|
39
|
-
isMobile?: boolean;
|
|
40
|
-
isMobileApp?: boolean;
|
|
41
|
-
hintProgressColor?: string;
|
|
42
|
-
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
|
|
43
|
-
}> & {
|
|
44
|
-
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
45
|
-
isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
|
|
46
|
-
isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
|
|
47
|
-
isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
|
|
48
|
-
editingDisabled: NonNullable<import("../..").APIOptions["editingDisabled"]>;
|
|
49
|
-
onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
|
|
50
|
-
readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
|
|
51
|
-
showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
|
|
52
|
-
}>;
|
|
53
|
-
keypadElement?: any;
|
|
54
|
-
onFocus: (blurPath: import("../..").FocusPath) => void;
|
|
55
|
-
onBlur: (blurPath: import("../..").FocusPath) => void;
|
|
56
|
-
findWidgets: import("../../types").FindWidgetsFunction;
|
|
57
|
-
reviewMode: boolean;
|
|
58
|
-
showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
|
|
59
|
-
handleUserInput: (newUserInput: Empty, cb?: () => void, silent?: boolean) => void;
|
|
60
|
-
userInput: Empty;
|
|
61
|
-
linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
|
|
62
|
-
containerSizeClass: import("../../util/sizing-utils").SizeClass;
|
|
63
|
-
} & React.RefAttributes<Widget>>;
|
|
8
|
+
widget: React.ForwardRefExoticComponent<ImageWidgetProps & React.RefAttributes<Widget>>;
|
|
64
9
|
isLintable: true;
|
|
65
10
|
};
|
|
66
11
|
export default _default;
|
|
@@ -8,11 +8,12 @@ declare const _default: {
|
|
|
8
8
|
name: string;
|
|
9
9
|
displayName: string;
|
|
10
10
|
hidden: true;
|
|
11
|
-
widget: import("react").ForwardRefExoticComponent<
|
|
11
|
+
widget: import("react").ForwardRefExoticComponent<{
|
|
12
|
+
options: import("@khanacademy/perseus-core").PerseusNumericInputWidgetOptions;
|
|
12
13
|
trackInteraction: (extraData?: Empty | undefined) => void;
|
|
13
14
|
widgetId: string;
|
|
14
15
|
widgetIndex: number;
|
|
15
|
-
alignment:
|
|
16
|
+
alignment: import("@khanacademy/perseus-core").Alignment | null | undefined;
|
|
16
17
|
static: boolean | null | undefined;
|
|
17
18
|
graded?: boolean | null;
|
|
18
19
|
problemNum: number | null | undefined;
|
|
@@ -4,16 +4,11 @@ import type { Widget, WidgetProps } from "../../types";
|
|
|
4
4
|
import type { UnsupportedWidgetPromptJSON } from "../../widget-ai-utils/unsupported-widget";
|
|
5
5
|
import type { PerseusInteractionWidgetOptions } from "@khanacademy/perseus-core";
|
|
6
6
|
type Props = WidgetProps<PerseusInteractionWidgetOptions>;
|
|
7
|
-
type DefaultProps = {
|
|
8
|
-
graph: Props["graph"];
|
|
9
|
-
elements: Props["elements"];
|
|
10
|
-
};
|
|
11
7
|
type State = {
|
|
12
8
|
variables: any;
|
|
13
9
|
functions: any;
|
|
14
10
|
};
|
|
15
11
|
declare class Interaction extends React.Component<Props, State> implements Widget {
|
|
16
|
-
static defaultProps: DefaultProps;
|
|
17
12
|
isWidget: true;
|
|
18
13
|
state: State;
|
|
19
14
|
UNSAFE_componentWillReceiveProps(nextProps: Props): void;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { vec } from "mafs";
|
|
2
2
|
import { type I18nContextType } from "../../../components/i18n-context";
|
|
3
3
|
import type { Coord } from "../../../interactive2/types";
|
|
4
|
-
import type { Dispatch, InteractiveGraphElementSuite,
|
|
4
|
+
import type { Dispatch, InteractiveGraphElementSuite, PolygonGraphState } from "../types";
|
|
5
|
+
import type { PerseusInteractiveGraphWidgetOptions } from "@khanacademy/perseus-core";
|
|
5
6
|
import type { Interval } from "mafs";
|
|
6
|
-
export declare function renderPolygonGraph(state: PolygonGraphState, dispatch: Dispatch, i18n: I18nContextType, markings:
|
|
7
|
+
export declare function renderPolygonGraph(state: PolygonGraphState, dispatch: Dispatch, i18n: I18nContextType, markings: PerseusInteractiveGraphWidgetOptions["markings"]): InteractiveGraphElementSuite;
|
|
7
8
|
export declare const hasFocusVisible: (element: Element | null | undefined) => boolean;
|
|
8
9
|
export declare function getSideSnapConstraint(points: ReadonlyArray<Coord>, index: number, range: [Interval, Interval]): {
|
|
9
10
|
up: vec.Vector2;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { I18nContextType } from "../../../../components/i18n-context";
|
|
2
|
-
import type {
|
|
2
|
+
import type { PolygonGraphState } from "../../types";
|
|
3
3
|
import type { PerseusStrings } from "@khanacademy/perseus/strings";
|
|
4
|
+
import type { PerseusInteractiveGraphWidgetOptions } from "@khanacademy/perseus-core";
|
|
4
5
|
export declare function srPolygonLabel(coords: ReadonlyArray<readonly [number, number]>, pointLabels: ReadonlyArray<string> | undefined, strings: PerseusStrings, locale: string): string;
|
|
5
6
|
type PolygonGraphDescriptionStrings = {
|
|
6
7
|
srPolygonGraph: string;
|
|
@@ -9,5 +10,5 @@ type PolygonGraphDescriptionStrings = {
|
|
|
9
10
|
srPolygonElementsNum: string;
|
|
10
11
|
srPolygonInteractiveElements: string | null;
|
|
11
12
|
};
|
|
12
|
-
export declare function describePolygonGraph(state: PolygonGraphState, i18n: I18nContextType, markings:
|
|
13
|
+
export declare function describePolygonGraph(state: PolygonGraphState, i18n: I18nContextType, markings: PerseusInteractiveGraphWidgetOptions["markings"]): PolygonGraphDescriptionStrings;
|
|
13
14
|
export {};
|
|
@@ -19,29 +19,10 @@ declare class InteractiveGraph extends React.Component<Props> {
|
|
|
19
19
|
*/
|
|
20
20
|
getSerializedState(): {
|
|
21
21
|
graph: PerseusGraphType;
|
|
22
|
-
step: [number, number];
|
|
23
|
-
gridStep?: [x: number, y: number];
|
|
24
|
-
snapStep?: [x: number, y: number];
|
|
25
|
-
backgroundImage: import("@khanacademy/perseus-core").PerseusImageBackground;
|
|
26
|
-
markings: import("@khanacademy/perseus-core").MarkingsType;
|
|
27
|
-
labels: string[];
|
|
28
|
-
labelLocation: import("@khanacademy/perseus-core").AxisLabelLocation;
|
|
29
|
-
showAxisArrows: import("@khanacademy/perseus-core").ShowAxisArrows;
|
|
30
|
-
showAxisTicks: import("@khanacademy/perseus-core").ShowAxisTicks;
|
|
31
|
-
showProtractor: boolean;
|
|
32
|
-
showRuler?: boolean;
|
|
33
|
-
showTooltips: boolean;
|
|
34
|
-
rulerLabel?: string;
|
|
35
|
-
rulerTicks?: number;
|
|
36
|
-
range: import("@khanacademy/perseus-core").GraphRange;
|
|
37
|
-
correct: PerseusGraphType;
|
|
38
|
-
lockedFigures: import("@khanacademy/perseus-core").LockedFigure[];
|
|
39
|
-
fullGraphAriaLabel?: string;
|
|
40
|
-
fullGraphAriaDescription?: string;
|
|
41
22
|
trackInteraction: (extraData?: Empty | undefined) => void;
|
|
42
23
|
widgetId: string;
|
|
43
24
|
widgetIndex: number;
|
|
44
|
-
alignment:
|
|
25
|
+
alignment: import("@khanacademy/perseus-core").Alignment | null | undefined;
|
|
45
26
|
static: boolean | null | undefined;
|
|
46
27
|
graded?: boolean | null;
|
|
47
28
|
problemNum: number | null | undefined;
|
|
@@ -92,6 +73,25 @@ declare class InteractiveGraph extends React.Component<Props> {
|
|
|
92
73
|
handleUserInput: (newUserInput: PerseusGraphType, cb?: () => void, silent?: boolean) => void;
|
|
93
74
|
linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
|
|
94
75
|
containerSizeClass: import("../../util/sizing-utils").SizeClass;
|
|
76
|
+
step: [number, number];
|
|
77
|
+
gridStep?: [x: number, y: number];
|
|
78
|
+
snapStep?: [x: number, y: number];
|
|
79
|
+
backgroundImage: import("@khanacademy/perseus-core").PerseusImageBackground;
|
|
80
|
+
markings: import("@khanacademy/perseus-core").MarkingsType;
|
|
81
|
+
labels: string[];
|
|
82
|
+
labelLocation: import("@khanacademy/perseus-core").AxisLabelLocation;
|
|
83
|
+
showAxisArrows: import("@khanacademy/perseus-core").ShowAxisArrows;
|
|
84
|
+
showAxisTicks: import("@khanacademy/perseus-core").ShowAxisTicks;
|
|
85
|
+
showProtractor: boolean;
|
|
86
|
+
showRuler?: boolean;
|
|
87
|
+
showTooltips: boolean;
|
|
88
|
+
rulerLabel?: string;
|
|
89
|
+
rulerTicks?: number;
|
|
90
|
+
range: import("@khanacademy/perseus-core").GraphRange;
|
|
91
|
+
correct: PerseusGraphType;
|
|
92
|
+
lockedFigures: import("@khanacademy/perseus-core").LockedFigure[];
|
|
93
|
+
fullGraphAriaLabel?: string;
|
|
94
|
+
fullGraphAriaDescription?: string;
|
|
95
95
|
};
|
|
96
96
|
render(): React.JSX.Element;
|
|
97
97
|
}
|
|
@@ -1,24 +1,25 @@
|
|
|
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 { PerseusInteractiveGraphWidgetOptions } from "@khanacademy/perseus-core";
|
|
4
5
|
import "mafs/core.css";
|
|
5
6
|
import "./mafs-styles.css";
|
|
6
7
|
export type MafsGraphProps = {
|
|
7
8
|
box: [number, number];
|
|
8
|
-
backgroundImage?:
|
|
9
|
-
lockedFigures:
|
|
10
|
-
step:
|
|
9
|
+
backgroundImage?: PerseusInteractiveGraphWidgetOptions["backgroundImage"];
|
|
10
|
+
lockedFigures: PerseusInteractiveGraphWidgetOptions["lockedFigures"];
|
|
11
|
+
step: PerseusInteractiveGraphWidgetOptions["step"];
|
|
11
12
|
gridStep: [x: number, y: number];
|
|
12
13
|
containerSizeClass: InteractiveGraphProps["containerSizeClass"];
|
|
13
|
-
markings:
|
|
14
|
-
showTooltips: Required<
|
|
14
|
+
markings: PerseusInteractiveGraphWidgetOptions["markings"];
|
|
15
|
+
showTooltips: Required<PerseusInteractiveGraphWidgetOptions["showTooltips"]>;
|
|
15
16
|
showProtractor: boolean;
|
|
16
17
|
labels: ReadonlyArray<string>;
|
|
17
|
-
labelLocation?:
|
|
18
|
-
showAxisArrows:
|
|
19
|
-
showAxisTicks:
|
|
20
|
-
fullGraphAriaLabel?:
|
|
21
|
-
fullGraphAriaDescription?:
|
|
18
|
+
labelLocation?: PerseusInteractiveGraphWidgetOptions["labelLocation"];
|
|
19
|
+
showAxisArrows: PerseusInteractiveGraphWidgetOptions["showAxisArrows"];
|
|
20
|
+
showAxisTicks: PerseusInteractiveGraphWidgetOptions["showAxisTicks"];
|
|
21
|
+
fullGraphAriaLabel?: PerseusInteractiveGraphWidgetOptions["fullGraphAriaLabel"];
|
|
22
|
+
fullGraphAriaDescription?: PerseusInteractiveGraphWidgetOptions["fullGraphAriaDescription"];
|
|
22
23
|
state: InteractiveGraphState;
|
|
23
24
|
dispatch: React.Dispatch<InteractiveGraphAction>;
|
|
24
25
|
readOnly: boolean;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { InteractiveGraphProps } from "./types";
|
|
3
|
-
import type { PerseusGraphType, PerseusInteractiveGraphUserInput } from "@khanacademy/perseus-core";
|
|
3
|
+
import type { PerseusGraphType, PerseusInteractiveGraphUserInput, PerseusInteractiveGraphWidgetOptions } from "@khanacademy/perseus-core";
|
|
4
4
|
export type StatefulMafsGraphProps = {
|
|
5
5
|
box: [number, number];
|
|
6
|
-
backgroundImage?:
|
|
6
|
+
backgroundImage?: PerseusInteractiveGraphWidgetOptions["backgroundImage"];
|
|
7
7
|
graph: PerseusGraphType;
|
|
8
8
|
/**
|
|
9
9
|
* The correct answer for this widget.
|
|
10
10
|
*/
|
|
11
11
|
correct?: PerseusGraphType;
|
|
12
|
-
lockedFigures:
|
|
13
|
-
range:
|
|
12
|
+
lockedFigures: PerseusInteractiveGraphWidgetOptions["lockedFigures"];
|
|
13
|
+
range: PerseusInteractiveGraphWidgetOptions["range"];
|
|
14
14
|
snapStep: [x: number, y: number];
|
|
15
|
-
step:
|
|
15
|
+
step: PerseusInteractiveGraphWidgetOptions["step"];
|
|
16
16
|
gridStep: [x: number, y: number];
|
|
17
17
|
containerSizeClass: InteractiveGraphProps["containerSizeClass"];
|
|
18
|
-
markings:
|
|
18
|
+
markings: PerseusInteractiveGraphWidgetOptions["markings"];
|
|
19
19
|
onChange: (userInput: PerseusGraphType) => void;
|
|
20
|
-
showTooltips: Required<
|
|
20
|
+
showTooltips: Required<PerseusInteractiveGraphWidgetOptions["showTooltips"]>;
|
|
21
21
|
showProtractor: boolean;
|
|
22
22
|
labels: ReadonlyArray<string>;
|
|
23
|
-
labelLocation?:
|
|
24
|
-
fullGraphAriaLabel?:
|
|
25
|
-
fullGraphAriaDescription?:
|
|
23
|
+
labelLocation?: PerseusInteractiveGraphWidgetOptions["labelLocation"];
|
|
24
|
+
fullGraphAriaLabel?: PerseusInteractiveGraphWidgetOptions["fullGraphAriaLabel"];
|
|
25
|
+
fullGraphAriaDescription?: PerseusInteractiveGraphWidgetOptions["fullGraphAriaDescription"];
|
|
26
26
|
readOnly: boolean;
|
|
27
27
|
static: InteractiveGraphProps["static"];
|
|
28
|
-
showAxisArrows:
|
|
29
|
-
showAxisTicks:
|
|
28
|
+
showAxisArrows: PerseusInteractiveGraphWidgetOptions["showAxisArrows"];
|
|
29
|
+
showAxisTicks: PerseusInteractiveGraphWidgetOptions["showAxisTicks"];
|
|
30
30
|
widgetId: string;
|
|
31
31
|
graded?: boolean | null;
|
|
32
32
|
ungradedDescriptionId?: string;
|
|
@@ -36,10 +36,10 @@ export type OptionalAnswersMarkerType = Omit<InteractiveMarkerType, "answers"> &
|
|
|
36
36
|
};
|
|
37
37
|
type Options = Omit<PerseusLabelImageWidgetOptions, "markers"> & {
|
|
38
38
|
markers: ReadonlyArray<OptionalAnswersMarkerType>;
|
|
39
|
+
preferredPopoverDirection?: PreferredPopoverDirection;
|
|
39
40
|
};
|
|
40
41
|
type Props = WidgetProps<Options, PerseusLabelImageUserInput> & {
|
|
41
42
|
analytics: DependencyProps["analytics"];
|
|
42
|
-
preferredPopoverDirection?: PreferredPopoverDirection;
|
|
43
43
|
};
|
|
44
44
|
type LabelImageState = {
|
|
45
45
|
activeMarkerIndex: number;
|
|
@@ -109,67 +109,8 @@ declare function getCorrectUserInput(options: PerseusLabelImageWidgetOptions): P
|
|
|
109
109
|
declare const _default: {
|
|
110
110
|
name: string;
|
|
111
111
|
displayName: string;
|
|
112
|
-
widget: React.ForwardRefExoticComponent<Omit<
|
|
113
|
-
markers: ReadonlyArray<OptionalAnswersMarkerType>;
|
|
114
|
-
} & {
|
|
115
|
-
trackInteraction: (extraData?: Empty | undefined) => void;
|
|
116
|
-
widgetId: string;
|
|
117
|
-
widgetIndex: number;
|
|
118
|
-
alignment: string | null | undefined;
|
|
119
|
-
static: boolean | null | undefined;
|
|
120
|
-
graded?: boolean | null;
|
|
121
|
-
problemNum: number | null | undefined;
|
|
122
|
-
apiOptions: Readonly<Readonly<{
|
|
123
|
-
isArticle?: boolean;
|
|
124
|
-
onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
|
|
125
|
-
showAlignmentOptions?: boolean;
|
|
126
|
-
readOnly?: boolean;
|
|
127
|
-
editingDisabled?: boolean;
|
|
128
|
-
answerableCallback?: (arg1: boolean) => unknown;
|
|
129
|
-
getAnotherHint?: () => unknown;
|
|
130
|
-
interactionCallback?: (widgetData: {
|
|
131
|
-
[widgetId: string]: any;
|
|
132
|
-
}) => void;
|
|
133
|
-
imagePlaceholder?: React.ReactNode;
|
|
134
|
-
widgetPlaceholder?: React.ReactNode;
|
|
135
|
-
baseElements?: {
|
|
136
|
-
Link: React.ComponentType<any>;
|
|
137
|
-
};
|
|
138
|
-
trackInteraction?: (args: {
|
|
139
|
-
type: string;
|
|
140
|
-
id: string;
|
|
141
|
-
correct?: boolean;
|
|
142
|
-
} & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
|
|
143
|
-
visible: number;
|
|
144
|
-
}>) => void;
|
|
145
|
-
customKeypad?: boolean;
|
|
146
|
-
isMobile?: boolean;
|
|
147
|
-
isMobileApp?: boolean;
|
|
148
|
-
hintProgressColor?: string;
|
|
149
|
-
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
|
|
150
|
-
}> & {
|
|
151
|
-
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
152
|
-
isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
|
|
153
|
-
isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
|
|
154
|
-
isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
|
|
155
|
-
editingDisabled: NonNullable<import("../..").APIOptions["editingDisabled"]>;
|
|
156
|
-
onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
|
|
157
|
-
readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
|
|
158
|
-
showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
|
|
159
|
-
}>;
|
|
160
|
-
keypadElement?: any;
|
|
161
|
-
onFocus: (blurPath: import("../..").FocusPath) => void;
|
|
162
|
-
onBlur: (blurPath: import("../..").FocusPath) => void;
|
|
163
|
-
findWidgets: import("../../types").FindWidgetsFunction;
|
|
164
|
-
reviewMode: boolean;
|
|
165
|
-
showSolutions?: ShowSolutions;
|
|
166
|
-
handleUserInput: (newUserInput: PerseusLabelImageUserInput, cb?: () => void, silent?: boolean) => void;
|
|
167
|
-
userInput: PerseusLabelImageUserInput;
|
|
168
|
-
linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
|
|
169
|
-
containerSizeClass: import("../../util/sizing-utils").SizeClass;
|
|
170
|
-
} & {
|
|
112
|
+
widget: React.ForwardRefExoticComponent<Omit<WidgetProps<Options, PerseusLabelImageUserInput> & {
|
|
171
113
|
analytics: DependencyProps["analytics"];
|
|
172
|
-
preferredPopoverDirection?: PreferredPopoverDirection;
|
|
173
114
|
}, keyof import("../..").PerseusDependenciesV2> & React.RefAttributes<LabelImage>>;
|
|
174
115
|
isLintable: true;
|
|
175
116
|
getStartUserInput: typeof getStartUserInput;
|