@khanacademy/perseus 77.1.0 → 77.2.1
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/gif-image.d.ts +38 -0
- package/dist/components/svg-image.d.ts +12 -0
- package/dist/es/index.css +2 -2
- package/dist/es/index.css.map +1 -1
- package/dist/es/index.js +24 -19
- package/dist/es/index.js.map +1 -1
- package/dist/es/strings.js +1 -1
- package/dist/es/strings.js.map +1 -1
- package/dist/hint-renderer.d.ts +15 -2
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +100 -7
- package/dist/index.js +24 -18
- package/dist/index.js.map +1 -1
- package/dist/renderer.d.ts +3 -3
- package/dist/strings.d.ts +50 -0
- package/dist/strings.js +1 -1
- package/dist/strings.js.map +1 -1
- package/dist/testing/test-dependencies.d.ts +0 -1
- package/dist/types.d.ts +2 -1
- package/dist/widget-ai-utils/categorizer/categorizer-ai-utils.d.ts +29 -0
- package/dist/widget-ai-utils/definition/definition-ai-utils.d.ts +8 -0
- package/dist/widget-ai-utils/dropdown/dropdown-ai-utils.d.ts +12 -0
- package/dist/widget-ai-utils/explanation/explanation-ai-utils.d.ts +12 -0
- package/dist/widget-ai-utils/expression/expression-ai-utils.d.ts +11 -0
- package/dist/widget-ai-utils/graded-group/graded-group-ai-utils.d.ts +15 -3
- package/dist/widget-ai-utils/graded-group-set/graded-group-set-ai-utils.d.ts +10 -0
- package/dist/widget-ai-utils/grapher/grapher-ai-utils.d.ts +35 -0
- package/dist/widget-ai-utils/group/group-ai-utils.d.ts +6 -0
- package/dist/widget-ai-utils/image/image-ai-utils.d.ts +16 -0
- package/dist/widget-ai-utils/input-number/input-number-ai-utils.d.ts +22 -0
- package/dist/widget-ai-utils/interactive-graph/interactive-graph-ai-utils.d.ts +61 -22
- package/dist/widget-ai-utils/label-image/label-image-ai-utils.d.ts +63 -0
- package/dist/widget-ai-utils/matcher/matcher-ai-utils.d.ts +40 -0
- package/dist/widget-ai-utils/matrix/matrix-ai-utils.d.ts +23 -0
- package/dist/widget-ai-utils/number-line/number-line-ai-utils.d.ts +52 -0
- package/dist/widget-ai-utils/numeric-input/prompt-utils.d.ts +17 -0
- package/dist/widget-ai-utils/orderer/orderer-ai-utils.d.ts +23 -0
- package/dist/widget-ai-utils/prompt-types.d.ts +16 -2
- package/dist/widget-ai-utils/radio/radio-ai-utils.d.ts +38 -0
- package/dist/widget-ai-utils/sorter/sorter-ai-utils.d.ts +19 -0
- package/dist/widget-ai-utils/unsupported-widget.d.ts +6 -5
- package/dist/widgets/dropdown/dropdown.d.ts +1 -1
- package/dist/widgets/expression/expression.d.ts +2 -2
- package/dist/widgets/image/components/explore-image-modal-content.d.ts +1 -1
- package/dist/widgets/image/utils.d.ts +6 -0
- package/dist/widgets/interactive-graphs/graphs/exponential.d.ts +2 -2
- package/dist/widgets/interactive-graphs/graphs/logarithm.d.ts +12 -0
- package/dist/widgets/interactive-graphs/graphs/utils.d.ts +25 -0
- package/dist/widgets/interactive-graphs/interactive-graph-question-builder.d.ts +6 -0
- package/dist/widgets/interactive-graphs/interactive-graph.d.ts +5 -3
- package/dist/widgets/interactive-graphs/reducer/initialize-graph-state.d.ts +5 -1
- package/dist/widgets/interactive-graphs/reducer/interactive-graph-action.d.ts +4 -0
- package/dist/widgets/interactive-graphs/types.d.ts +7 -1
- package/dist/widgets/label-image/label-image.d.ts +1 -1
- package/dist/widgets/mock-widgets/mock-widget.d.ts +1 -1
- package/dist/widgets/numeric-input/numeric-input.class.d.ts +1 -1
- package/dist/widgets/numeric-input/numeric-input.d.ts +1 -1
- package/dist/widgets/table/table.d.ts +1 -1
- package/package.json +10 -9
|
@@ -1,11 +1,34 @@
|
|
|
1
1
|
import type orderer from "../../widgets/orderer/orderer";
|
|
2
2
|
import type React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* JSON describing an orderer widget. Intended for consumption by AI tools.
|
|
5
|
+
* An orderer presents a set of cards that the learner must arrange into the
|
|
6
|
+
* correct sequence. Cards can be dragged and dropped to reorder them. The
|
|
7
|
+
* same card may appear multiple times in the correct answer but is displayed
|
|
8
|
+
* only once in the card bank.
|
|
9
|
+
*/
|
|
3
10
|
export type OrdererPromptJSON = {
|
|
4
11
|
type: "orderer";
|
|
12
|
+
/**
|
|
13
|
+
* The configuration of the widget, set by the content creator.
|
|
14
|
+
*/
|
|
5
15
|
options: {
|
|
16
|
+
/**
|
|
17
|
+
* All of the cards available to the learner. Each string is the
|
|
18
|
+
* rendered content of one card (may include TeX or Markdown).
|
|
19
|
+
*/
|
|
6
20
|
options: ReadonlyArray<string>;
|
|
7
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* The current state of the widget user interface. Usually represents a
|
|
24
|
+
* learner's attempt to answer a question.
|
|
25
|
+
*/
|
|
8
26
|
userInput: {
|
|
27
|
+
/**
|
|
28
|
+
* The cards in their current order as arranged by the learner. Each
|
|
29
|
+
* string is the content of a card. An empty array means the learner
|
|
30
|
+
* has not yet placed any cards.
|
|
31
|
+
*/
|
|
9
32
|
values: ReadonlyArray<string>;
|
|
10
33
|
};
|
|
11
34
|
};
|
|
@@ -21,12 +21,26 @@ import type { SorterPromptJSON } from "./sorter/sorter-ai-utils";
|
|
|
21
21
|
import type { UnsupportedWidgetPromptJSON } from "./unsupported-widget";
|
|
22
22
|
export type UnsupportedWidget = "cs-program" | "iframe" | "interaction" | "interactive-graph-unsupported" | "measurer" | "phet-simulation" | "plotter" | "python-program" | "video";
|
|
23
23
|
export type WidgetPromptJSON = CategorizerPromptJSON | DefinitionPromptJSON | DropdownPromptJSON | ExplanationPromptJSON | ExpressionPromptJSON | GradedGroupPromptJSON | GradedGroupSetPromptJSON | GrapherPromptJSON | GroupPromptJSON | ImagePromptJSON | InputNumberPromptJSON | LabelImagePromptJSON | MatcherPromptJSON | MatrixPromptJSON | MockWidgetPromptJSON | NumberLinePromptJSON | NumericInputPromptJSON | OrdererPromptJSON | RadioPromptJSON | SorterPromptJSON | UnsupportedWidgetPromptJSON;
|
|
24
|
-
|
|
24
|
+
/**
|
|
25
|
+
* JSON describing a Perseus renderer. Intended for consumption by AI tools.
|
|
26
|
+
* A "renderer" is essentially a Markdown document with embedded interactive
|
|
27
|
+
* widgets.
|
|
28
|
+
*/
|
|
29
|
+
export interface RendererPromptJSON {
|
|
30
|
+
/**
|
|
31
|
+
* Markdown content of the document. Widgets are represented by
|
|
32
|
+
* placeholders containing a Unicode snowman symbol, e.g.
|
|
33
|
+
* `[[☃ radio 1]]`. May contain TeX delimited by dollar signs, e.g.
|
|
34
|
+
* `$\dfrac{1}{2}$`. Literal dollar signs are escaped by backslashes.
|
|
35
|
+
*/
|
|
25
36
|
content: string;
|
|
37
|
+
/**
|
|
38
|
+
* Information about the configuration and UI state of each widget.
|
|
39
|
+
*/
|
|
26
40
|
widgets: {
|
|
27
41
|
[widgetId: string]: WidgetPromptJSON;
|
|
28
42
|
};
|
|
29
|
-
}
|
|
43
|
+
}
|
|
30
44
|
export interface GetPromptJSONInterface {
|
|
31
45
|
getPromptJSON(): RendererPromptJSON;
|
|
32
46
|
}
|
|
@@ -1,16 +1,54 @@
|
|
|
1
1
|
import type radio from "../../widgets/radio";
|
|
2
2
|
import type { PerseusRadioUserInput, RecursiveReadonly } from "@khanacademy/perseus-core";
|
|
3
3
|
import type React from "react";
|
|
4
|
+
/**
|
|
5
|
+
* A single answer choice in a radio widget.
|
|
6
|
+
*/
|
|
4
7
|
type BasicOption = {
|
|
8
|
+
/**
|
|
9
|
+
* The label displayed for this choice.
|
|
10
|
+
*/
|
|
5
11
|
value: string;
|
|
12
|
+
/**
|
|
13
|
+
* An opaque string that uniquely identifies this choice within the radio
|
|
14
|
+
* widget. The format is subject to change.
|
|
15
|
+
*/
|
|
6
16
|
id: string;
|
|
17
|
+
/**
|
|
18
|
+
* Rationale for why this answer is correct or incorrect. Shown to the
|
|
19
|
+
* learner when they select an incorrect answer. Only present when the
|
|
20
|
+
* content creator supplied one.
|
|
21
|
+
*/
|
|
7
22
|
rationale?: string;
|
|
8
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* JSON describing a radio (multiple-choice) widget. Intended for consumption
|
|
26
|
+
* by AI tools. A radio widget presents a list of answer choices and asks the
|
|
27
|
+
* learner to select one (or, when multiple-select is enabled, one or more).
|
|
28
|
+
*/
|
|
9
29
|
export type RadioPromptJSON = {
|
|
10
30
|
type: "radio";
|
|
31
|
+
/**
|
|
32
|
+
* Whether the widget includes a "None of the above" option. When true,
|
|
33
|
+
* the last entry in `options` represents that special choice.
|
|
34
|
+
*/
|
|
11
35
|
hasNoneOfTheAbove: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* The answer choices presented to the learner, in the order they appear
|
|
38
|
+
* on screen. The first choice is labeled "A", the second is "B", and so
|
|
39
|
+
* on.
|
|
40
|
+
*/
|
|
12
41
|
options: BasicOption[];
|
|
42
|
+
/**
|
|
43
|
+
* The current state of the widget user interface. Usually represents a
|
|
44
|
+
* learner's attempt to answer a question.
|
|
45
|
+
*/
|
|
13
46
|
userInput: {
|
|
47
|
+
/**
|
|
48
|
+
* The IDs of the choices the learner has selected. Each entry
|
|
49
|
+
* corresponds to a choice's `id` field in `options`. Order is
|
|
50
|
+
* insignificant — scoring uses set membership, not position.
|
|
51
|
+
*/
|
|
14
52
|
selectedOptions: ReadonlyArray<string>;
|
|
15
53
|
};
|
|
16
54
|
};
|
|
@@ -1,8 +1,27 @@
|
|
|
1
1
|
import type { PerseusSorterUserInput } from "@khanacademy/perseus-core";
|
|
2
|
+
/**
|
|
3
|
+
* JSON describing a sorter widget. Intended for consumption by AI tools.
|
|
4
|
+
* A sorter presents a list of cards that the learner must arrange into the
|
|
5
|
+
* correct order by dragging them. The cards are initially displayed in a
|
|
6
|
+
* randomized order.
|
|
7
|
+
*/
|
|
2
8
|
export type SorterPromptJSON = {
|
|
3
9
|
type: "sorter";
|
|
10
|
+
/**
|
|
11
|
+
* The current state of the widget user interface. Usually represents a
|
|
12
|
+
* learner's attempt to answer a question.
|
|
13
|
+
*/
|
|
4
14
|
userInput: {
|
|
15
|
+
/**
|
|
16
|
+
* The content strings of the sortable cards in the learner's current
|
|
17
|
+
* order.
|
|
18
|
+
*/
|
|
5
19
|
values: ReadonlyArray<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the learner has moved any cards from their initial
|
|
22
|
+
* randomized order. The widget is considered empty (invalid) until
|
|
23
|
+
* this is true.
|
|
24
|
+
*/
|
|
6
25
|
changed: boolean;
|
|
7
26
|
};
|
|
8
27
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { UnsupportedWidget } from "./prompt-types";
|
|
2
|
+
/**
|
|
3
|
+
* A placeholder in prompt JSON for a widget that doesn't support AI tooling.
|
|
4
|
+
*/
|
|
2
5
|
export type UnsupportedWidgetPromptJSON = {
|
|
3
6
|
type: UnsupportedWidget;
|
|
7
|
+
/** Always empty; not used. */
|
|
4
8
|
message?: string;
|
|
9
|
+
/** Always false. */
|
|
5
10
|
isSupported: boolean;
|
|
6
11
|
};
|
|
7
|
-
export declare const getUnsupportedPromptJSON: (widgetType: UnsupportedWidget, message?: string) =>
|
|
8
|
-
type: UnsupportedWidget;
|
|
9
|
-
isSupported: boolean;
|
|
10
|
-
message: string;
|
|
11
|
-
};
|
|
12
|
+
export declare const getUnsupportedPromptJSON: (widgetType: UnsupportedWidget, message?: string) => UnsupportedWidgetPromptJSON;
|
|
@@ -68,7 +68,7 @@ declare const _default: {
|
|
|
68
68
|
keypadElement?: any;
|
|
69
69
|
onFocus: (blurPath: import("../..").FocusPath) => void;
|
|
70
70
|
onBlur: (blurPath: import("../..").FocusPath) => void;
|
|
71
|
-
findWidgets:
|
|
71
|
+
findWidgets: import("../../types").FindWidgetsFunction;
|
|
72
72
|
reviewMode: boolean;
|
|
73
73
|
showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
|
|
74
74
|
handleUserInput: (newUserInput: PerseusDropdownUserInput, cb?: () => void, silent?: boolean) => void;
|
|
@@ -58,7 +58,7 @@ export declare const Expression: React.ForwardRefExoticComponent<PerseusExpressi
|
|
|
58
58
|
keypadElement?: any;
|
|
59
59
|
onFocus: (blurPath: FocusPath) => void;
|
|
60
60
|
onBlur: (blurPath: FocusPath) => void;
|
|
61
|
-
findWidgets:
|
|
61
|
+
findWidgets: import("../../types").FindWidgetsFunction;
|
|
62
62
|
reviewMode: boolean;
|
|
63
63
|
showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
|
|
64
64
|
handleUserInput: (newUserInput: string, cb?: () => void, silent?: boolean) => void;
|
|
@@ -137,7 +137,7 @@ declare const _default: {
|
|
|
137
137
|
keypadElement?: any;
|
|
138
138
|
onFocus: (blurPath: FocusPath) => void;
|
|
139
139
|
onBlur: (blurPath: FocusPath) => void;
|
|
140
|
-
findWidgets:
|
|
140
|
+
findWidgets: import("../../types").FindWidgetsFunction;
|
|
141
141
|
reviewMode: boolean;
|
|
142
142
|
showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
|
|
143
143
|
handleUserInput: (newUserInput: string, cb?: () => void, silent?: boolean) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { CommonImageProps, ZoomProps, GifProps } from "./image-info-area";
|
|
3
3
|
type Props = CommonImageProps & ZoomProps & GifProps;
|
|
4
|
-
export default function ExploreImageModalContent({ backgroundImage, scale: contentScale, caption, alt, longDescription, linterContext, apiOptions, box, labels, range, zoomSize,
|
|
4
|
+
export default function ExploreImageModalContent({ backgroundImage, scale: contentScale, caption, alt, longDescription, linterContext, apiOptions, box, labels, range, zoomSize, }: Props): React.JSX.Element | null;
|
|
5
5
|
export {};
|
|
@@ -30,7 +30,13 @@ export declare const graphieImage: {
|
|
|
30
30
|
width: number;
|
|
31
31
|
height: number;
|
|
32
32
|
};
|
|
33
|
+
export declare const graphieImage2: {
|
|
34
|
+
url: string;
|
|
35
|
+
width: number;
|
|
36
|
+
height: number;
|
|
37
|
+
};
|
|
33
38
|
export declare const graphieImageAlt = "An array of isosceles triangles. A triangle has height A. Two smaller triangle, one with height B and one with height C, have approximately the same combined height as A.";
|
|
39
|
+
export declare const graphieImage2Alt = "A picture graph shows the horizontal axis labeled Number of insects and the vertical axis labeled Types of insects. Each type of insect is listed along the vertical axis from bottom to top as follows: Beetle, Cricket, Ant, Mosquito, and Bee. The number of insects for each type of insect is represented by the number of pictures of ladybugs plotted on the graph. Beetle is represented by 5 pictures of ladybugs, Cricket is represented by 4 pictures of ladybugs, Ant is represented by 3 pictures of ladybugs, Mosquito is represented by 6 pictures of ladybugs, and Bee is represented by 3 pictures of ladybugs.";
|
|
34
40
|
export declare const gifImage: {
|
|
35
41
|
url: string;
|
|
36
42
|
width: number;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { vec } from "mafs";
|
|
2
1
|
import { type I18nContextType } from "../../../components/i18n-context";
|
|
3
2
|
import type { ExponentialGraphState, Dispatch, InteractiveGraphElementSuite } from "../types";
|
|
4
3
|
import type { Coord } from "@khanacademy/perseus-core";
|
|
4
|
+
import type { Interval, vec } from "mafs";
|
|
5
5
|
export declare function renderExponentialGraph(state: ExponentialGraphState, dispatch: Dispatch, i18n: I18nContextType): InteractiveGraphElementSuite;
|
|
6
6
|
export declare const constrainAsymptoteKeyboard: (p: vec.Vector2, coords: ReadonlyArray<Coord>, snapStep: vec.Vector2) => vec.Vector2;
|
|
7
|
-
export declare const getExponentialKeyboardConstraint: (coords: ReadonlyArray<Coord>, asymptote: number, snapStep: vec.Vector2, pointIndex: number) => {
|
|
7
|
+
export declare const getExponentialKeyboardConstraint: (coords: ReadonlyArray<Coord>, asymptote: number, snapStep: vec.Vector2, pointIndex: number, range: [Interval, Interval]) => {
|
|
8
8
|
up: vec.Vector2;
|
|
9
9
|
down: vec.Vector2;
|
|
10
10
|
left: vec.Vector2;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type I18nContextType } from "../../../components/i18n-context";
|
|
2
|
+
import type { LogarithmGraphState, Dispatch, InteractiveGraphElementSuite } from "../types";
|
|
3
|
+
import type { Coord } from "@khanacademy/perseus-core";
|
|
4
|
+
import type { Interval, vec } from "mafs";
|
|
5
|
+
export declare function renderLogarithmGraph(state: LogarithmGraphState, dispatch: Dispatch, i18n: I18nContextType): InteractiveGraphElementSuite;
|
|
6
|
+
export declare const constrainAsymptoteKeyboard: (p: vec.Vector2, coords: ReadonlyArray<Coord>, snapStep: vec.Vector2) => vec.Vector2;
|
|
7
|
+
export declare const getLogarithmKeyboardConstraint: (coords: ReadonlyArray<Coord>, asymptote: number, snapStep: vec.Vector2, pointIndex: number, range: [Interval, Interval]) => {
|
|
8
|
+
up: vec.Vector2;
|
|
9
|
+
down: vec.Vector2;
|
|
10
|
+
left: vec.Vector2;
|
|
11
|
+
right: vec.Vector2;
|
|
12
|
+
};
|
|
@@ -36,3 +36,28 @@ export declare function getPolygonSideString(sideLength: number, pointIndex: num
|
|
|
36
36
|
* The radius scales with the range so it's visible at all graph sizes.
|
|
37
37
|
*/
|
|
38
38
|
export declare function calculateScaledRadius(range: [Interval, Interval]): number;
|
|
39
|
+
/**
|
|
40
|
+
* Shared keyboard constraint logic for asymptote-based graph points
|
|
41
|
+
* (exponential, logarithm). Computes the next valid position for each
|
|
42
|
+
* arrow-key direction, skipping up to 3 snap steps to avoid positions
|
|
43
|
+
* rejected by the caller's `isValidPosition` predicate.
|
|
44
|
+
*
|
|
45
|
+
* The per-graph validity rules differ (exponential checks Y vs asymptote and
|
|
46
|
+
* X vs other point; logarithm checks X vs asymptote and Y vs other point),
|
|
47
|
+
* so they are injected via the callback.
|
|
48
|
+
*/
|
|
49
|
+
export declare function getAsymptoteGraphKeyboardConstraint(coords: ReadonlyArray<Coord>, snapStep: vec.Vector2, pointIndex: number, isValidPosition: (coord: vec.Vector2) => boolean): {
|
|
50
|
+
up: vec.Vector2;
|
|
51
|
+
down: vec.Vector2;
|
|
52
|
+
left: vec.Vector2;
|
|
53
|
+
right: vec.Vector2;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Shared keyboard constraint for asymptote movement (exponential, logarithm).
|
|
57
|
+
* When the next snapped position would land between or on the curve points,
|
|
58
|
+
* snaps past all of them in the direction of travel using a midpoint heuristic.
|
|
59
|
+
*
|
|
60
|
+
* @param orientation - "horizontal" for exponential (asymptote moves on Y-axis),
|
|
61
|
+
* "vertical" for logarithm (asymptote moves on X-axis).
|
|
62
|
+
*/
|
|
63
|
+
export declare function constrainAsymptoteKeyboardMovement(p: vec.Vector2, coords: ReadonlyArray<Coord>, snapStep: vec.Vector2, orientation: "horizontal" | "vertical"): vec.Vector2;
|
|
@@ -130,6 +130,12 @@ declare class InteractiveGraphQuestionBuilder {
|
|
|
130
130
|
snapDegrees?: number;
|
|
131
131
|
match?: "congruent";
|
|
132
132
|
}): InteractiveGraphQuestionBuilder;
|
|
133
|
+
withLogarithm(options?: {
|
|
134
|
+
coords?: [Coord, Coord];
|
|
135
|
+
asymptote?: number;
|
|
136
|
+
startCoords?: [Coord, Coord];
|
|
137
|
+
startAsymptote?: number;
|
|
138
|
+
}): InteractiveGraphQuestionBuilder;
|
|
133
139
|
withAbsoluteValue(options?: {
|
|
134
140
|
coords?: [Coord, Coord];
|
|
135
141
|
startCoords?: [Coord, Coord];
|
|
@@ -161,9 +161,9 @@ declare class InteractiveGraph extends React.Component<Props, State> {
|
|
|
161
161
|
problemNum: number | null | undefined;
|
|
162
162
|
apiOptions: Readonly<Readonly<{
|
|
163
163
|
isArticle?: boolean;
|
|
164
|
-
onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight? /**
|
|
164
|
+
onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement? /**
|
|
165
165
|
* Whether to show the arrows on the axis.
|
|
166
|
-
*/:
|
|
166
|
+
*/: HTMLElement) => unknown;
|
|
167
167
|
showAlignmentOptions?: boolean;
|
|
168
168
|
readOnly?: boolean;
|
|
169
169
|
editingDisabled?: boolean;
|
|
@@ -210,7 +210,7 @@ declare class InteractiveGraph extends React.Component<Props, State> {
|
|
|
210
210
|
keypadElement?: any;
|
|
211
211
|
onFocus: (blurPath: import("../..").FocusPath) => void;
|
|
212
212
|
onBlur: (blurPath: import("../..").FocusPath) => void;
|
|
213
|
-
findWidgets:
|
|
213
|
+
findWidgets: import("../../types").FindWidgetsFunction;
|
|
214
214
|
reviewMode: boolean;
|
|
215
215
|
showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
|
|
216
216
|
handleUserInput: (newUserInput: PerseusGraphType, cb?: () => void, silent?: boolean) => void;
|
|
@@ -261,6 +261,8 @@ declare class InteractiveGraph extends React.Component<Props, State> {
|
|
|
261
261
|
static getSinusoidEquationString(props: Props): string;
|
|
262
262
|
static defaultExponentialCoords(props: Props): Coord[];
|
|
263
263
|
static getExponentialEquationString(props: Props): string;
|
|
264
|
+
static defaultLogarithmCoords(props: Props): Coord[];
|
|
265
|
+
static getLogarithmEquationString(props: Props): string;
|
|
264
266
|
static getAbsoluteValueEquationString(props: Props): string;
|
|
265
267
|
static getCurrentTangentCoefficients(props: Props): TangentCoefficient;
|
|
266
268
|
static defaultTangentCoords(props: Props): Coord[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Coord } from "../../../interactive2/types";
|
|
2
2
|
import type { InteractiveGraphState, PairOfPoints } from "../types";
|
|
3
|
-
import type { PerseusGraphType, PerseusGraphTypeAbsoluteValue, PerseusGraphTypeAngle, PerseusGraphTypeCircle, PerseusGraphTypeLinear, PerseusGraphTypeLinearSystem, PerseusGraphTypePoint, PerseusGraphTypePolygon, PerseusGraphTypeQuadratic, PerseusGraphTypeRay, PerseusGraphTypeSegment, PerseusGraphTypeSinusoid, PerseusGraphTypeExponential, PerseusGraphTypeTangent } from "@khanacademy/perseus-core";
|
|
3
|
+
import type { PerseusGraphType, PerseusGraphTypeAbsoluteValue, PerseusGraphTypeAngle, PerseusGraphTypeCircle, PerseusGraphTypeLinear, PerseusGraphTypeLinearSystem, PerseusGraphTypePoint, PerseusGraphTypePolygon, PerseusGraphTypeQuadratic, PerseusGraphTypeRay, PerseusGraphTypeSegment, PerseusGraphTypeSinusoid, PerseusGraphTypeExponential, PerseusGraphTypeTangent, PerseusGraphTypeLogarithm } from "@khanacademy/perseus-core";
|
|
4
4
|
import type { Interval } from "mafs";
|
|
5
5
|
export type InitializeGraphStateParams = {
|
|
6
6
|
range: [x: Interval, y: Interval];
|
|
@@ -26,6 +26,10 @@ export declare function getExponentialCoords(graph: PerseusGraphTypeExponential,
|
|
|
26
26
|
coords: [Coord, Coord];
|
|
27
27
|
asymptote: number;
|
|
28
28
|
};
|
|
29
|
+
export declare function getLogarithmCoords(graph: PerseusGraphTypeLogarithm, range: [x: Interval, y: Interval], step: [x: number, y: number]): {
|
|
30
|
+
coords: [Coord, Coord];
|
|
31
|
+
asymptote: number;
|
|
32
|
+
};
|
|
29
33
|
export declare const getAngleCoords: (params: {
|
|
30
34
|
graph: PerseusGraphTypeAngle;
|
|
31
35
|
range: [x: Interval, y: Interval];
|
|
@@ -15,7 +15,7 @@ export type InteractiveGraphElementSuite = {
|
|
|
15
15
|
graph: ReactNode;
|
|
16
16
|
interactiveElementsDescription: ReactNode;
|
|
17
17
|
};
|
|
18
|
-
export type InteractiveGraphState = AbsoluteValueGraphState | AngleGraphState | SegmentGraphState | LinearSystemGraphState | LinearGraphState | RayGraphState | NoneGraphState | PolygonGraphState | PointGraphState | CircleGraphState | QuadraticGraphState | SinusoidGraphState | ExponentialGraphState | TangentGraphState;
|
|
18
|
+
export type InteractiveGraphState = AbsoluteValueGraphState | AngleGraphState | SegmentGraphState | LinearSystemGraphState | LinearGraphState | RayGraphState | NoneGraphState | PolygonGraphState | PointGraphState | CircleGraphState | QuadraticGraphState | SinusoidGraphState | ExponentialGraphState | TangentGraphState | LogarithmGraphState;
|
|
19
19
|
export type UnlimitedGraphState = PointGraphState | PolygonGraphState;
|
|
20
20
|
export interface InteractiveGraphStateCommon {
|
|
21
21
|
hasBeenInteractedWith: boolean;
|
|
@@ -91,6 +91,12 @@ export interface TangentGraphState extends InteractiveGraphStateCommon {
|
|
|
91
91
|
type: "tangent";
|
|
92
92
|
coords: [vec.Vector2, vec.Vector2];
|
|
93
93
|
}
|
|
94
|
+
export interface LogarithmGraphState extends InteractiveGraphStateCommon {
|
|
95
|
+
type: "logarithm";
|
|
96
|
+
coords: [vec.Vector2, vec.Vector2];
|
|
97
|
+
/** The x-value of the vertical asymptote (x = asymptote). */
|
|
98
|
+
asymptote: number;
|
|
99
|
+
}
|
|
94
100
|
export interface AngleGraphState extends InteractiveGraphStateCommon {
|
|
95
101
|
type: "angle";
|
|
96
102
|
showAngles?: boolean;
|
|
@@ -167,7 +167,7 @@ declare const _default: {
|
|
|
167
167
|
keypadElement?: any;
|
|
168
168
|
onFocus: (blurPath: import("../..").FocusPath) => void;
|
|
169
169
|
onBlur: (blurPath: import("../..").FocusPath) => void;
|
|
170
|
-
findWidgets:
|
|
170
|
+
findWidgets: import("../../types").FindWidgetsFunction;
|
|
171
171
|
reviewMode: boolean;
|
|
172
172
|
showSolutions?: ShowSolutions;
|
|
173
173
|
handleUserInput: (newUserInput: PerseusLabelImageUserInput, cb?: () => void, silent?: boolean) => void;
|
|
@@ -91,7 +91,7 @@ declare class MockWidgetComponent extends React.Component<Props> implements Widg
|
|
|
91
91
|
keypadElement?: any;
|
|
92
92
|
onFocus: (blurPath: import("../..").FocusPath) => void;
|
|
93
93
|
onBlur: (blurPath: import("../..").FocusPath) => void;
|
|
94
|
-
findWidgets:
|
|
94
|
+
findWidgets: import("../../types").FindWidgetsFunction;
|
|
95
95
|
reviewMode: boolean;
|
|
96
96
|
showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
|
|
97
97
|
handleUserInput: (newUserInput: PerseusMockWidgetUserInput, cb?: () => void, silent?: boolean) => void;
|
|
@@ -98,7 +98,7 @@ export declare class NumericInput extends React.Component<NumericInputProps> imp
|
|
|
98
98
|
keypadElement?: any;
|
|
99
99
|
onFocus: (blurPath: import("../..").FocusPath) => void;
|
|
100
100
|
onBlur: (blurPath: import("../..").FocusPath) => void;
|
|
101
|
-
findWidgets:
|
|
101
|
+
findWidgets: import("../../types").FindWidgetsFunction;
|
|
102
102
|
reviewMode: boolean;
|
|
103
103
|
showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
|
|
104
104
|
handleUserInput: (newUserInput: PerseusNumericInputUserInput, cb?: () => void, silent?: boolean) => void;
|
|
@@ -61,7 +61,7 @@ export declare const NumericInputComponent: React.ForwardRefExoticComponent<impo
|
|
|
61
61
|
keypadElement?: any;
|
|
62
62
|
onFocus: (blurPath: import("../..").FocusPath) => void;
|
|
63
63
|
onBlur: (blurPath: import("../..").FocusPath) => void;
|
|
64
|
-
findWidgets:
|
|
64
|
+
findWidgets: import("../../types").FindWidgetsFunction;
|
|
65
65
|
reviewMode: boolean;
|
|
66
66
|
showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
|
|
67
67
|
handleUserInput: (newUserInput: import("@khanacademy/perseus-core").PerseusNumericInputUserInput, cb?: () => void, silent?: boolean) => void;
|
|
@@ -99,7 +99,7 @@ declare class Table extends React.Component<Props> implements Widget {
|
|
|
99
99
|
keypadElement?: any;
|
|
100
100
|
onFocus: (blurPath: FocusPath) => void;
|
|
101
101
|
onBlur: (blurPath: FocusPath) => void;
|
|
102
|
-
findWidgets:
|
|
102
|
+
findWidgets: import("../../types").FindWidgetsFunction;
|
|
103
103
|
reviewMode: boolean;
|
|
104
104
|
showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
|
|
105
105
|
handleUserInput: (newUserInput: PerseusTableUserInput, cb?: () => void, silent?: boolean) => void;
|
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": "77.1
|
|
6
|
+
"version": "77.2.1",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -38,19 +38,20 @@
|
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@use-gesture/react": "^10.2.27",
|
|
41
|
+
"gifuct-js": "^2.1.2",
|
|
41
42
|
"mafs": "0.19.0",
|
|
42
43
|
"tiny-invariant": "1.3.1",
|
|
43
44
|
"uuid": "^10.0.0",
|
|
44
45
|
"@khanacademy/kas": "2.2.1",
|
|
45
|
-
"@khanacademy/keypad-context": "3.2.
|
|
46
|
-
"@khanacademy/
|
|
47
|
-
"@khanacademy/
|
|
48
|
-
"@khanacademy/perseus-core": "24.
|
|
49
|
-
"@khanacademy/perseus-
|
|
46
|
+
"@khanacademy/keypad-context": "3.2.42",
|
|
47
|
+
"@khanacademy/math-input": "26.4.13",
|
|
48
|
+
"@khanacademy/kmath": "2.4.0",
|
|
49
|
+
"@khanacademy/perseus-core": "24.1.0",
|
|
50
|
+
"@khanacademy/perseus-linter": "4.9.3",
|
|
51
|
+
"@khanacademy/perseus-score": "8.6.0",
|
|
50
52
|
"@khanacademy/perseus-utils": "2.1.5",
|
|
51
53
|
"@khanacademy/pure-markdown": "2.2.7",
|
|
52
|
-
"@khanacademy/simple-markdown": "2.2.2"
|
|
53
|
-
"@khanacademy/perseus-linter": "4.9.1"
|
|
54
|
+
"@khanacademy/simple-markdown": "2.2.2"
|
|
54
55
|
},
|
|
55
56
|
"devDependencies": {
|
|
56
57
|
"@khanacademy/wonder-blocks-announcer": "1.1.0",
|
|
@@ -61,8 +62,8 @@
|
|
|
61
62
|
"@khanacademy/wonder-blocks-data": "15.0.1",
|
|
62
63
|
"@khanacademy/wonder-blocks-dropdown": "10.8.3",
|
|
63
64
|
"@khanacademy/wonder-blocks-form": "7.5.6",
|
|
64
|
-
"@khanacademy/wonder-blocks-icon-button": "11.1.6",
|
|
65
65
|
"@khanacademy/wonder-blocks-icon": "5.3.9",
|
|
66
|
+
"@khanacademy/wonder-blocks-icon-button": "11.1.6",
|
|
66
67
|
"@khanacademy/wonder-blocks-labeled-field": "4.0.16",
|
|
67
68
|
"@khanacademy/wonder-blocks-layout": "3.1.46",
|
|
68
69
|
"@khanacademy/wonder-blocks-link": "10.1.7",
|