@khanacademy/perseus 53.0.0 → 54.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/highlighting/types.d.ts +2 -1
- package/dist/components.d.ts +0 -1
- package/dist/es/index.js +1101 -2034
- package/dist/es/index.js.map +1 -1
- package/dist/es/strings.js +101 -14
- package/dist/es/strings.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1180 -2058
- package/dist/index.js.map +1 -1
- package/dist/interactive2/movable.d.ts +2 -1
- package/dist/server-item-renderer.d.ts +0 -3
- package/dist/strings.d.ts +93 -6
- package/dist/strings.js +184 -58
- package/dist/strings.js.map +1 -1
- package/dist/types.d.ts +3 -24
- package/dist/util/graphie.d.ts +1 -1
- package/dist/widget-ai-utils/radio/radio-ai-utils.d.ts +2 -1
- package/dist/widget-type-utils.d.ts +1 -0
- package/dist/widgets/categorizer/categorizer.d.ts +1 -2
- package/dist/widgets/cs-program/cs-program.d.ts +0 -2
- package/dist/widgets/dropdown/dropdown.d.ts +0 -2
- package/dist/widgets/expression/expression.d.ts +3 -10
- package/dist/widgets/iframe/iframe.d.ts +1 -1
- package/dist/widgets/interactive-graph.d.ts +2 -86
- package/dist/widgets/interactive-graphs/backgrounds/axis-labels.d.ts +4 -1
- package/dist/widgets/interactive-graphs/graphs/angle.d.ts +2 -1
- package/dist/widgets/interactive-graphs/graphs/circle.d.ts +6 -2
- package/dist/widgets/interactive-graphs/graphs/components/hairlines.d.ts +7 -0
- package/dist/widgets/interactive-graphs/graphs/components/movable-point-view.d.ts +1 -0
- package/dist/widgets/interactive-graphs/graphs/components/svg-line.d.ts +2 -1
- package/dist/widgets/interactive-graphs/graphs/linear-system.d.ts +2 -2
- package/dist/widgets/interactive-graphs/graphs/linear.d.ts +1 -1
- package/dist/widgets/interactive-graphs/graphs/point.d.ts +3 -2
- package/dist/widgets/interactive-graphs/graphs/polygon.d.ts +3 -2
- package/dist/widgets/interactive-graphs/graphs/ray.d.ts +1 -1
- package/dist/widgets/interactive-graphs/graphs/screenreader-text.d.ts +2 -1
- package/dist/widgets/interactive-graphs/graphs/segment.d.ts +2 -2
- package/dist/widgets/interactive-graphs/graphs/sinusoid.d.ts +2 -1
- package/dist/widgets/interactive-graphs/graphs/utils.d.ts +16 -4
- package/dist/widgets/interactive-graphs/interactive-graph-question-builder.d.ts +1 -2
- package/dist/widgets/interactive-graphs/mafs-graph.d.ts +0 -2
- package/dist/widgets/interactive-graphs/reducer/interactive-graph-action.d.ts +3 -3
- package/dist/widgets/interactive-graphs/stateful-mafs-graph.d.ts +0 -2
- package/dist/widgets/label-image/label-image.d.ts +1 -3
- package/dist/widgets/number-line/number-line.d.ts +0 -2
- package/dist/widgets/numeric-input/numeric-input.d.ts +0 -2
- package/dist/widgets/orderer/orderer.d.ts +0 -2
- package/dist/widgets/sorter/sorter.d.ts +1 -2
- package/dist/widgets.d.ts +1 -2
- package/package.json +46 -46
- package/dist/components/graph.d.ts +0 -61
- package/dist/widgets/interactive-graphs/mafs-supported-graph-types.d.ts +0 -4
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { PerseusI18nContext } from "../components/i18n-context";
|
|
3
2
|
import type { StatefulMafsGraphType } from "./interactive-graphs/stateful-mafs-graph";
|
|
4
3
|
import type { QuadraticGraphState } from "./interactive-graphs/types";
|
|
5
4
|
import type { Coord } from "../interactive2/types";
|
|
6
|
-
import type {
|
|
5
|
+
import type { WidgetProps } from "../types";
|
|
7
6
|
import type { InteractiveGraphPromptJSON } from "../widget-ai-utils/interactive-graph/interactive-graph-ai-utils";
|
|
8
7
|
import type { UnsupportedWidgetPromptJSON } from "../widget-ai-utils/unsupported-widget";
|
|
9
8
|
import type { QuadraticCoefficient, SineCoefficient, Range } from "@khanacademy/kmath";
|
|
10
|
-
import type { PerseusGraphType, PerseusGraphTypeAngle, PerseusGraphTypePoint,
|
|
9
|
+
import type { PerseusGraphType, PerseusGraphTypeAngle, PerseusGraphTypePoint, PerseusGraphTypeSegment, GraphRange, LockedFigure, PerseusImageBackground, MarkingsType } from "@khanacademy/perseus-core";
|
|
11
10
|
import type { PerseusInteractiveGraphRubric, PerseusInteractiveGraphUserInput } from "@khanacademy/perseus-score";
|
|
12
11
|
type RenderProps = {
|
|
13
12
|
/**
|
|
@@ -116,89 +115,7 @@ type DefaultProps = {
|
|
|
116
115
|
showProtractor: Props["showProtractor"];
|
|
117
116
|
graph: Props["graph"];
|
|
118
117
|
};
|
|
119
|
-
export declare function getSinusoidCoefficients(coords: ReadonlyArray<Coord>): SineCoefficient;
|
|
120
|
-
export declare function getQuadraticCoefficients(coords: ReadonlyArray<Coord>): QuadraticCoefficient;
|
|
121
|
-
declare class LegacyInteractiveGraph extends React.Component<Props, State> {
|
|
122
|
-
static contextType: React.Context<import("../components/i18n-context").I18nContextType>;
|
|
123
|
-
context: React.ContextType<typeof PerseusI18nContext>;
|
|
124
|
-
angle: any | null | undefined;
|
|
125
|
-
circle: any | null | undefined;
|
|
126
|
-
graphie: any | null | undefined;
|
|
127
|
-
horizHairline: any | null | undefined;
|
|
128
|
-
line: any | null | undefined;
|
|
129
|
-
lines: ReadonlyArray<ReadonlyArray<Coord>> | null | undefined;
|
|
130
|
-
parabola: any | null | undefined;
|
|
131
|
-
pointA: any | null | undefined;
|
|
132
|
-
pointB: any | null | undefined;
|
|
133
|
-
pointC: any | null | undefined;
|
|
134
|
-
points: Array<any>;
|
|
135
|
-
polygon: any | null | undefined;
|
|
136
|
-
shouldResetGraphie: boolean;
|
|
137
|
-
sinusoid: any | null | undefined;
|
|
138
|
-
trashCan: any | null | undefined;
|
|
139
|
-
vertHairline: any | null | undefined;
|
|
140
|
-
static defaultProps: DefaultProps;
|
|
141
|
-
state: State;
|
|
142
|
-
componentDidMount(): void;
|
|
143
|
-
UNSAFE_componentWillReceiveProps(nextProps: Props): void;
|
|
144
|
-
componentDidUpdate(prevProps: Props, prevState: State): void;
|
|
145
|
-
_getShouldShowInstructions: (arg1?: Props | null | undefined) => boolean;
|
|
146
|
-
setGraphie: (arg1: any) => void;
|
|
147
|
-
handleAddPointsMouseDown: (arg1: Coord) => void;
|
|
148
|
-
resetGraphie: () => void;
|
|
149
|
-
setupGraphie: () => void;
|
|
150
|
-
showHairlines: (arg1: Coord) => void;
|
|
151
|
-
hideHairlines: () => void;
|
|
152
|
-
setTrashCanVisibility: (arg1: number) => void;
|
|
153
|
-
isClickToAddPoints: (arg1?: Props | null | undefined) => boolean;
|
|
154
|
-
areAngleGraphsEqual(prevGraph: PerseusGraphTypeAngle, currentGraph: PerseusGraphTypeAngle): boolean;
|
|
155
|
-
arePointGraphsEqual(prevGraph: PerseusGraphTypePoint, currentGraph: PerseusGraphTypePoint): boolean;
|
|
156
|
-
arePolygonGraphsEqual(prevGraph: PerseusGraphTypePolygon, currentGraph: PerseusGraphTypePolygon): boolean;
|
|
157
|
-
areSegmentGraphsEqual(prevGraph: PerseusGraphTypeSegment, currentGraph: PerseusGraphTypeSegment): boolean;
|
|
158
|
-
_lineStroke: () => {
|
|
159
|
-
["stroke-width"]?: number;
|
|
160
|
-
};
|
|
161
|
-
addLine: (arg1: string) => void;
|
|
162
|
-
removeLine: () => void;
|
|
163
|
-
addNoneControls: () => void;
|
|
164
|
-
removeNoneControls: () => void;
|
|
165
|
-
addLinearControls: () => void;
|
|
166
|
-
removeLinearControls: () => void;
|
|
167
|
-
addQuadraticControls: () => void;
|
|
168
|
-
updateQuadratic: () => void;
|
|
169
|
-
removeQuadraticControls: () => void;
|
|
170
|
-
addSinusoidControls: () => void;
|
|
171
|
-
updateSinusoid: () => void;
|
|
172
|
-
removeSinusoidControls: () => void;
|
|
173
|
-
addCircleControls: () => void;
|
|
174
|
-
removeCircleControls: () => void;
|
|
175
|
-
addLinearSystemControls: () => void;
|
|
176
|
-
removeLinearSystemControls: () => void;
|
|
177
|
-
isCoordInTrash: (arg1: Coord) => boolean;
|
|
178
|
-
createPointForPointsType: (arg1: Coord, arg2: number) => any;
|
|
179
|
-
removePoint: (arg1: Coord) => number | null | undefined;
|
|
180
|
-
createPointForPolygonType: (arg1: Coord, arg2: number) => any;
|
|
181
|
-
updateCoordsFromPoints: () => void;
|
|
182
|
-
clearCoords: () => void;
|
|
183
|
-
onChange: ChangeHandler;
|
|
184
|
-
addPointControls: () => void;
|
|
185
|
-
removePointControls: () => void;
|
|
186
|
-
addSegmentControls: () => void;
|
|
187
|
-
removeSegmentControls: () => void;
|
|
188
|
-
addRayControls: () => void;
|
|
189
|
-
removeRayControls: () => void;
|
|
190
|
-
addPolygonControls: () => void;
|
|
191
|
-
updatePolygon: () => void;
|
|
192
|
-
removePolygonControls: () => void;
|
|
193
|
-
addAngleControls: () => void;
|
|
194
|
-
removeAngleControls: () => void;
|
|
195
|
-
toggleShowSides: () => void;
|
|
196
|
-
getUserInput(): PerseusInteractiveGraphUserInput;
|
|
197
|
-
focus: () => void;
|
|
198
|
-
render(): React.ReactNode;
|
|
199
|
-
}
|
|
200
118
|
declare class InteractiveGraph extends React.Component<Props, State> {
|
|
201
|
-
legacyGraphRef: React.RefObject<LegacyInteractiveGraph>;
|
|
202
119
|
mafsRef: React.RefObject<StatefulMafsGraphType>;
|
|
203
120
|
static defaultProps: DefaultProps;
|
|
204
121
|
getUserInput(): PerseusInteractiveGraphUserInput;
|
|
@@ -254,7 +171,6 @@ declare class InteractiveGraph extends React.Component<Props, State> {
|
|
|
254
171
|
static getAngleEquationString(props: Props): string;
|
|
255
172
|
static getUserInputFromProps(props: Props): PerseusGraphType;
|
|
256
173
|
}
|
|
257
|
-
export declare function shouldUseMafs(mafsFlags: Record<string, boolean> | undefined | boolean, graph: PerseusGraphType): boolean;
|
|
258
174
|
declare const _default: {
|
|
259
175
|
name: string;
|
|
260
176
|
displayName: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { vec } from "mafs";
|
|
2
|
+
import type { I18nContextType } from "../../../components/i18n-context";
|
|
2
3
|
import type { AngleGraphState, Dispatch, InteractiveGraphElementSuite } from "../types";
|
|
3
|
-
export declare function renderAngleGraph(state: AngleGraphState, dispatch: Dispatch): InteractiveGraphElementSuite;
|
|
4
|
+
export declare function renderAngleGraph(state: AngleGraphState, dispatch: Dispatch, i18n: I18nContextType): InteractiveGraphElementSuite;
|
|
4
5
|
export declare function getAngleSideConstraint(sidePoint: [number, number], vertex: [number, number], snapDegrees: number): {
|
|
5
6
|
up: vec.Vector2;
|
|
6
7
|
down: vec.Vector2;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
1
2
|
import type { I18nContextType } from "../../../components/i18n-context";
|
|
2
|
-
import type { CircleGraphState, Dispatch, InteractiveGraphElementSuite } from "../types";
|
|
3
|
-
export declare function renderCircleGraph(state: CircleGraphState, dispatch: Dispatch): InteractiveGraphElementSuite;
|
|
3
|
+
import type { CircleGraphState, Dispatch, InteractiveGraphElementSuite, MafsGraphProps } from "../types";
|
|
4
|
+
export declare function renderCircleGraph(state: CircleGraphState, dispatch: Dispatch, i18n: I18nContextType): InteractiveGraphElementSuite;
|
|
5
|
+
type CircleGraphProps = MafsGraphProps<CircleGraphState>;
|
|
6
|
+
export declare function CircleGraph(props: CircleGraphProps): React.JSX.Element;
|
|
4
7
|
export declare function describeCircleGraph(state: CircleGraphState, i18n: I18nContextType): Record<string, string>;
|
|
8
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { vec } from "mafs";
|
|
3
3
|
import type { SVGProps } from "react";
|
|
4
|
-
|
|
4
|
+
type Props = {
|
|
5
5
|
start: vec.Vector2;
|
|
6
6
|
end: vec.Vector2;
|
|
7
7
|
style?: SVGProps<SVGLineElement>["style"];
|
|
@@ -9,3 +9,4 @@ export type Props = {
|
|
|
9
9
|
testId?: string;
|
|
10
10
|
};
|
|
11
11
|
export declare function SVGLine(props: Props): React.JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { I18nContextType } from "../../../components/i18n-context";
|
|
2
2
|
import type { LinearSystemGraphState, Dispatch, InteractiveGraphElementSuite } from "../types";
|
|
3
|
-
export declare function renderLinearSystemGraph(state: LinearSystemGraphState, dispatch: Dispatch): InteractiveGraphElementSuite;
|
|
4
|
-
export declare function
|
|
3
|
+
export declare function renderLinearSystemGraph(state: LinearSystemGraphState, dispatch: Dispatch, i18n: I18nContextType): InteractiveGraphElementSuite;
|
|
4
|
+
export declare function getLinearSystemGraphDescription(state: LinearSystemGraphState, i18n: I18nContextType): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { I18nContextType } from "../../../components/i18n-context";
|
|
2
2
|
import type { LinearGraphState, Dispatch, InteractiveGraphElementSuite } from "../types";
|
|
3
|
-
export declare function renderLinearGraph(state: LinearGraphState, dispatch: Dispatch): InteractiveGraphElementSuite;
|
|
3
|
+
export declare function renderLinearGraph(state: LinearGraphState, dispatch: Dispatch, i18n: I18nContextType): InteractiveGraphElementSuite;
|
|
4
4
|
export declare function describeLinearGraph(state: LinearGraphState, i18n: I18nContextType): Record<string, string>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { I18nContextType } from "../../../components/i18n-context";
|
|
1
2
|
import type { PerseusStrings } from "../../../strings";
|
|
2
3
|
import type { PointGraphState, Dispatch, InteractiveGraphElementSuite } from "../types";
|
|
3
|
-
export declare function renderPointGraph(state: PointGraphState, dispatch: Dispatch): InteractiveGraphElementSuite;
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function renderPointGraph(state: PointGraphState, dispatch: Dispatch, i18n: I18nContextType): InteractiveGraphElementSuite;
|
|
5
|
+
export declare function getPointGraphDescription(state: PointGraphState, i18n: {
|
|
5
6
|
strings: PerseusStrings;
|
|
6
7
|
locale: string;
|
|
7
8
|
}): string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { type I18nContextType } from "../../../components/i18n-context";
|
|
2
|
+
import type { Dispatch, InteractiveGraphElementSuite, InteractiveGraphProps, PolygonGraphState } from "../types";
|
|
3
|
+
export declare function renderPolygonGraph(state: PolygonGraphState, dispatch: Dispatch, i18n: I18nContextType, markings: InteractiveGraphProps["markings"]): InteractiveGraphElementSuite;
|
|
3
4
|
export declare const hasFocusVisible: (element: Element | null | undefined) => boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { I18nContextType } from "../../../components/i18n-context";
|
|
2
2
|
import type { Dispatch, InteractiveGraphElementSuite, RayGraphState } from "../types";
|
|
3
|
-
export declare function renderRayGraph(state: RayGraphState, dispatch: Dispatch): InteractiveGraphElementSuite;
|
|
3
|
+
export declare function renderRayGraph(state: RayGraphState, dispatch: Dispatch, i18n: I18nContextType): InteractiveGraphElementSuite;
|
|
4
4
|
export declare function describeRayGraph(state: RayGraphState, i18n: I18nContextType): Record<string, string>;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export declare function srFormatNumber(a: number, locale: string): string;
|
|
1
|
+
export declare function srFormatNumber(a: number, locale: string, maximumFractionDigits?: number): string;
|
|
2
|
+
export declare function getPiMultiple(a: number): string | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { I18nContextType } from "../../../components/i18n-context";
|
|
2
2
|
import type { Dispatch, InteractiveGraphElementSuite, SegmentGraphState } from "../types";
|
|
3
|
-
export declare function renderSegmentGraph(state: SegmentGraphState, dispatch: Dispatch): InteractiveGraphElementSuite;
|
|
4
|
-
export declare function
|
|
3
|
+
export declare function renderSegmentGraph(state: SegmentGraphState, dispatch: Dispatch, i18n: I18nContextType): InteractiveGraphElementSuite;
|
|
4
|
+
export declare function getSegmentGraphDescription(state: SegmentGraphState, i18n: I18nContextType): string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { type I18nContextType } from "../../../components/i18n-context";
|
|
1
2
|
import type { SinusoidGraphState, Dispatch, InteractiveGraphElementSuite } from "../types";
|
|
2
3
|
import type { NamedSineCoefficient } from "@khanacademy/kmath";
|
|
3
4
|
import type { Coord } from "@khanacademy/perseus-core";
|
|
4
|
-
export declare function renderSinusoidGraph(state: SinusoidGraphState, dispatch: Dispatch): InteractiveGraphElementSuite;
|
|
5
|
+
export declare function renderSinusoidGraph(state: SinusoidGraphState, dispatch: Dispatch, i18n: I18nContextType): InteractiveGraphElementSuite;
|
|
5
6
|
export declare const computeSine: (x: number, sinusoidCoefficients: NamedSineCoefficient) => number;
|
|
6
7
|
export declare const getSinusoidCoefficients: (coords: ReadonlyArray<Coord>) => NamedSineCoefficient | undefined;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { vec } from "mafs";
|
|
1
2
|
import type { PerseusStrings } from "../../../strings";
|
|
2
3
|
import type { PairOfPoints } from "../types";
|
|
3
4
|
import type { Coord } from "@khanacademy/perseus";
|
|
4
|
-
import type { Interval
|
|
5
|
+
import type { Interval } from "mafs";
|
|
5
6
|
/**
|
|
6
7
|
* Given a ray and a rectangular box, find the point where the ray intersects
|
|
7
8
|
* the edge of the box. Assumes the `initialPoint` is inside the box.
|
|
@@ -13,9 +14,20 @@ export declare const getIntersectionOfRayWithBox: (initialPoint: vec.Vector2, th
|
|
|
13
14
|
export declare function getArrayWithoutDuplicates(array: Array<Coord>): Array<Coord>;
|
|
14
15
|
export declare function getSlopeStringForLine(line: PairOfPoints, strings: PerseusStrings): string;
|
|
15
16
|
export declare function getInterceptStringForLine(line: PairOfPoints, strings: PerseusStrings, locale: string): string;
|
|
16
|
-
type GraphLocations = "origin" | "x-axis" | "y-axis" | 1 | 2 | 3 | 4;
|
|
17
|
-
export declare function getCoordQuadrant(coord: Coord): GraphLocations;
|
|
18
17
|
export declare function getQuadraticVertexString(vertex: Coord, strings: PerseusStrings): string;
|
|
19
18
|
export declare function getQuadraticPointString(pointNumber: any, coord: Coord, strings: PerseusStrings, locale: string): string;
|
|
20
19
|
export declare function getQuadraticXIntercepts(a: number, b: number, c: number): number[];
|
|
21
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Given a list of points, return the angle made by the point at index i
|
|
22
|
+
* with the points at indices i - 1 and i + 1.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getAngleFromPoints(points: Coord[], i: number): number | null;
|
|
25
|
+
export declare function getSideLengthsFromPoints(points: Coord[], i: number, isPolygonOpen?: boolean): Array<{
|
|
26
|
+
pointIndex: number;
|
|
27
|
+
sideLength: number;
|
|
28
|
+
}>;
|
|
29
|
+
/**
|
|
30
|
+
* Determine whether to determine the string with the
|
|
31
|
+
* exact side length or the approximate side length.
|
|
32
|
+
*/
|
|
33
|
+
export declare function getPolygonSideString(sideLength: number, pointIndex: number, strings: PerseusStrings, locale: string): string;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { vec } from "mafs";
|
|
2
2
|
import type { Coord } from "../../interactive2/types";
|
|
3
3
|
import type { CollinearTuple, LockedFigureColor, LockedFigureFillType, LockedLineStyle, MarkingsType, PerseusRenderer } from "@khanacademy/perseus-core";
|
|
4
|
-
import type { Interval } from "mafs";
|
|
5
4
|
export type LockedFunctionOptions = {
|
|
6
5
|
color?: LockedFigureColor;
|
|
7
6
|
strokeStyle?: LockedLineStyle;
|
|
8
7
|
directionalAxis?: "x" | "y";
|
|
9
|
-
domain?:
|
|
8
|
+
domain?: [min: number | null, max: number | null];
|
|
10
9
|
labels?: LockedFigureLabelOptions[];
|
|
11
10
|
ariaLabel?: string;
|
|
12
11
|
};
|
|
@@ -1,12 +1,10 @@
|
|
|
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 { APIOptions } from "../../types";
|
|
5
4
|
import type { vec } from "mafs";
|
|
6
5
|
import "mafs/core.css";
|
|
7
6
|
import "./mafs-styles.css";
|
|
8
7
|
export type MafsGraphProps = {
|
|
9
|
-
flags?: APIOptions["flags"];
|
|
10
8
|
box: [number, number];
|
|
11
9
|
backgroundImage?: InteractiveGraphProps["backgroundImage"];
|
|
12
10
|
lockedFigures?: InteractiveGraphProps["lockedFigures"];
|
|
@@ -111,12 +111,12 @@ export interface ChangeKeyboardInvitationVisibility {
|
|
|
111
111
|
}
|
|
112
112
|
declare function changeKeyboardInvitationVisibility(shouldShow: boolean): ChangeKeyboardInvitationVisibility;
|
|
113
113
|
export declare const CLOSE_POLYGON = "close-polygon";
|
|
114
|
-
|
|
114
|
+
interface ClosePolygon {
|
|
115
115
|
type: typeof CLOSE_POLYGON;
|
|
116
116
|
}
|
|
117
117
|
declare function closePolygon(): ClosePolygon;
|
|
118
118
|
export declare const OPEN_POLYGON = "open-polygon";
|
|
119
|
-
|
|
119
|
+
interface OpenPolygon {
|
|
120
120
|
type: typeof OPEN_POLYGON;
|
|
121
121
|
}
|
|
122
122
|
declare function openPolygon(): OpenPolygon;
|
|
@@ -166,7 +166,7 @@ export interface ChangeRange {
|
|
|
166
166
|
}
|
|
167
167
|
export declare function changeRange(range: [x: Interval, y: Interval]): ChangeRange;
|
|
168
168
|
export declare const REINITIALIZE = "reinitialize";
|
|
169
|
-
|
|
169
|
+
interface Reinitialize {
|
|
170
170
|
type: typeof REINITIALIZE;
|
|
171
171
|
params: InitializeGraphStateParams;
|
|
172
172
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { InteractiveGraphProps } from "./types";
|
|
3
|
-
import type { APIOptions } from "../../types";
|
|
4
3
|
import type { PerseusGraphType } from "@khanacademy/perseus-core";
|
|
5
4
|
import type { PerseusInteractiveGraphUserInput } from "@khanacademy/perseus-score";
|
|
6
5
|
export type StatefulMafsGraphProps = {
|
|
7
|
-
flags?: APIOptions["flags"];
|
|
8
6
|
box: [number, number];
|
|
9
7
|
backgroundImage?: InteractiveGraphProps["backgroundImage"];
|
|
10
8
|
graph: PerseusGraphType;
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* that involve the use of images, and enable learners to demonstrate their
|
|
6
6
|
* knowledge by directly interacting with the image.
|
|
7
7
|
*/
|
|
8
|
-
import { getLabelImagePublicWidgetOptions } from "@khanacademy/perseus-core";
|
|
9
8
|
import * as React from "react";
|
|
10
9
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
11
10
|
import Marker from "./marker";
|
|
@@ -15,7 +14,7 @@ import type { APIOptions, Widget } from "../../types";
|
|
|
15
14
|
import type { LabelImagePromptJSON } from "../../widget-ai-utils/label-image/label-image-ai-utils";
|
|
16
15
|
import type { InteractiveMarkerType, PerseusLabelImageWidgetOptions } from "@khanacademy/perseus-core";
|
|
17
16
|
import type { PerseusLabelImageUserInput } from "@khanacademy/perseus-score";
|
|
18
|
-
|
|
17
|
+
type PreferredPopoverDirection = "NONE" | "UP" | "DOWN" | "LEFT" | "RIGHT";
|
|
19
18
|
/**
|
|
20
19
|
* Represents a direction vector.
|
|
21
20
|
* No diagonals allowed.
|
|
@@ -92,6 +91,5 @@ declare const _default: {
|
|
|
92
91
|
}, keyof import("../..").PerseusDependenciesV2> & React.RefAttributes<LabelImage>>;
|
|
93
92
|
accessible: true;
|
|
94
93
|
isLintable: true;
|
|
95
|
-
getPublicWidgetOptions: typeof getLabelImagePublicWidgetOptions;
|
|
96
94
|
};
|
|
97
95
|
export default _default;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { getNumberLinePublicWidgetOptions } from "@khanacademy/perseus-core";
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
4
3
|
import type { ChangeableProps } from "../../mixins/changeable";
|
|
@@ -79,6 +78,5 @@ declare const _default: {
|
|
|
79
78
|
widget: typeof NumberLine;
|
|
80
79
|
transform: (arg1: any) => any;
|
|
81
80
|
staticTransform: (arg1: any) => any;
|
|
82
|
-
getPublicWidgetOptions: typeof getNumberLinePublicWidgetOptions;
|
|
83
81
|
};
|
|
84
82
|
export default _default;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { getNumericInputPublicWidgetOptions } from "@khanacademy/perseus-core";
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
4
3
|
import InputWithExamples from "../../components/input-with-examples";
|
|
@@ -76,7 +75,6 @@ declare const _default: {
|
|
|
76
75
|
widget: typeof NumericInput;
|
|
77
76
|
transform: (widgetOptions: PerseusNumericInputWidgetOptions) => RenderProps;
|
|
78
77
|
isLintable: true;
|
|
79
|
-
getPublicWidgetOptions: typeof getNumericInputPublicWidgetOptions;
|
|
80
78
|
getOneCorrectAnswerFromRubric(rubric: PerseusNumericInputRubric): string | null | undefined;
|
|
81
79
|
};
|
|
82
80
|
export default _default;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { getOrdererPublicWidgetOptions } from "@khanacademy/perseus-core";
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import type { Widget, WidgetProps } from "../../types";
|
|
4
3
|
import type { OrdererPromptJSON } from "../../widget-ai-utils/orderer/orderer-ai-utils";
|
|
@@ -55,6 +54,5 @@ declare const _default: {
|
|
|
55
54
|
hidden: true;
|
|
56
55
|
widget: typeof Orderer;
|
|
57
56
|
isLintable: true;
|
|
58
|
-
getPublicWidgetOptions: typeof getOrdererPublicWidgetOptions;
|
|
59
57
|
};
|
|
60
58
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type PerseusSorterWidgetOptions
|
|
1
|
+
import { type PerseusSorterWidgetOptions } from "@khanacademy/perseus-core";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import type { SortableOption } from "../../components/sortable";
|
|
4
4
|
import type { Widget, WidgetProps } from "../../types";
|
|
@@ -34,6 +34,5 @@ declare const _default: {
|
|
|
34
34
|
displayName: string;
|
|
35
35
|
widget: typeof Sorter;
|
|
36
36
|
isLintable: true;
|
|
37
|
-
getPublicWidgetOptions: typeof getSorterPublicWidgetOptions;
|
|
38
37
|
};
|
|
39
38
|
export default _default;
|
package/dist/widgets.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PerseusStrings } from "./strings";
|
|
2
|
-
import type { Tracking, WidgetExports, WidgetTransform
|
|
2
|
+
import type { Tracking, WidgetExports, WidgetTransform } from "./types";
|
|
3
3
|
import type { PerseusWidget, Version } from "@khanacademy/perseus-core";
|
|
4
4
|
import type * as React from "react";
|
|
5
5
|
type Editor = any;
|
|
@@ -28,7 +28,6 @@ export declare const replaceEditor: (name: string, replacementName: string) => v
|
|
|
28
28
|
export declare const replaceDeprecatedEditors: () => void;
|
|
29
29
|
export declare const getWidget: (name: string) => React.ComponentType<any> | null | undefined;
|
|
30
30
|
export declare const getWidgetExport: (name: string) => WidgetExports | null;
|
|
31
|
-
export declare const getPublicWidgetOptionsFunction: (name: string) => PublicWidgetOptionsFunction;
|
|
32
31
|
export declare const getEditor: (name: string) => Editor | null | undefined;
|
|
33
32
|
export declare const getTransform: (name: string) => WidgetTransform | null | undefined;
|
|
34
33
|
export declare const getVersion: (name: string) => Version | undefined;
|
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": "54.0.0",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -41,39 +41,39 @@
|
|
|
41
41
|
"test": "bash -c 'yarn --silent --cwd \"../..\" test ${@:0} $($([[ ${@: -1} = -* ]] || [[ ${@: -1} = bash ]]) && echo $PWD)'"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@khanacademy/kas": "^0.4.
|
|
45
|
-
"@khanacademy/keypad-context": "^1.0.
|
|
46
|
-
"@khanacademy/kmath": "^0.3.
|
|
47
|
-
"@khanacademy/math-input": "^22.2.
|
|
48
|
-
"@khanacademy/perseus-core": "3.
|
|
49
|
-
"@khanacademy/perseus-linter": "^1.2.
|
|
50
|
-
"@khanacademy/perseus-score": "^2.1
|
|
51
|
-
"@khanacademy/pure-markdown": "^0.3.
|
|
52
|
-
"@khanacademy/simple-markdown": "^0.13.
|
|
44
|
+
"@khanacademy/kas": "^0.4.15",
|
|
45
|
+
"@khanacademy/keypad-context": "^1.0.18",
|
|
46
|
+
"@khanacademy/kmath": "^0.3.4",
|
|
47
|
+
"@khanacademy/math-input": "^22.2.5",
|
|
48
|
+
"@khanacademy/perseus-core": "3.6.0",
|
|
49
|
+
"@khanacademy/perseus-linter": "^1.2.17",
|
|
50
|
+
"@khanacademy/perseus-score": "^2.2.1",
|
|
51
|
+
"@khanacademy/pure-markdown": "^0.3.26",
|
|
52
|
+
"@khanacademy/simple-markdown": "^0.13.19",
|
|
53
53
|
"@types/classnames": "2.2.0",
|
|
54
54
|
"@use-gesture/react": "^10.2.27",
|
|
55
55
|
"mafs": "0.19.0",
|
|
56
56
|
"uuid": "^10.0.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@khanacademy/wonder-blocks-banner": "4.
|
|
60
|
-
"@khanacademy/wonder-blocks-button": "7.
|
|
61
|
-
"@khanacademy/wonder-blocks-clickable": "
|
|
62
|
-
"@khanacademy/wonder-blocks-core": "
|
|
63
|
-
"@khanacademy/wonder-blocks-data": "14.
|
|
64
|
-
"@khanacademy/wonder-blocks-dropdown": "
|
|
65
|
-
"@khanacademy/wonder-blocks-form": "
|
|
66
|
-
"@khanacademy/wonder-blocks-icon": "5.
|
|
67
|
-
"@khanacademy/wonder-blocks-icon-button": "6.
|
|
68
|
-
"@khanacademy/wonder-blocks-layout": "3.
|
|
69
|
-
"@khanacademy/wonder-blocks-link": "7.
|
|
70
|
-
"@khanacademy/wonder-blocks-pill": "3.
|
|
71
|
-
"@khanacademy/wonder-blocks-popover": "5.
|
|
72
|
-
"@khanacademy/wonder-blocks-progress-spinner": "3.
|
|
73
|
-
"@khanacademy/wonder-blocks-switch": "3.
|
|
74
|
-
"@khanacademy/wonder-blocks-tokens": "
|
|
75
|
-
"@khanacademy/wonder-blocks-tooltip": "4.
|
|
76
|
-
"@khanacademy/wonder-blocks-typography": "3.
|
|
59
|
+
"@khanacademy/wonder-blocks-banner": "4.1.1",
|
|
60
|
+
"@khanacademy/wonder-blocks-button": "7.1.1",
|
|
61
|
+
"@khanacademy/wonder-blocks-clickable": "6.1.1",
|
|
62
|
+
"@khanacademy/wonder-blocks-core": "12.1.1",
|
|
63
|
+
"@khanacademy/wonder-blocks-data": "14.1.1",
|
|
64
|
+
"@khanacademy/wonder-blocks-dropdown": "9.1.1",
|
|
65
|
+
"@khanacademy/wonder-blocks-form": "7.1.1",
|
|
66
|
+
"@khanacademy/wonder-blocks-icon": "5.1.1",
|
|
67
|
+
"@khanacademy/wonder-blocks-icon-button": "6.1.1",
|
|
68
|
+
"@khanacademy/wonder-blocks-layout": "3.1.1",
|
|
69
|
+
"@khanacademy/wonder-blocks-link": "7.1.1",
|
|
70
|
+
"@khanacademy/wonder-blocks-pill": "3.1.1",
|
|
71
|
+
"@khanacademy/wonder-blocks-popover": "5.1.1",
|
|
72
|
+
"@khanacademy/wonder-blocks-progress-spinner": "3.1.1",
|
|
73
|
+
"@khanacademy/wonder-blocks-switch": "3.1.1",
|
|
74
|
+
"@khanacademy/wonder-blocks-tokens": "4.2.1",
|
|
75
|
+
"@khanacademy/wonder-blocks-tooltip": "4.1.1",
|
|
76
|
+
"@khanacademy/wonder-blocks-typography": "3.1.1",
|
|
77
77
|
"@khanacademy/wonder-stuff-core": "1.5.4",
|
|
78
78
|
"@phosphor-icons/core": "^2.0.2",
|
|
79
79
|
"@popperjs/core": "^2.10.2",
|
|
@@ -91,24 +91,24 @@
|
|
|
91
91
|
"underscore": "^1.4.4"
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
|
94
|
-
"@khanacademy/wonder-blocks-banner": "4.
|
|
95
|
-
"@khanacademy/wonder-blocks-button": "7.
|
|
96
|
-
"@khanacademy/wonder-blocks-clickable": "
|
|
97
|
-
"@khanacademy/wonder-blocks-core": "
|
|
98
|
-
"@khanacademy/wonder-blocks-data": "14.
|
|
99
|
-
"@khanacademy/wonder-blocks-dropdown": "
|
|
100
|
-
"@khanacademy/wonder-blocks-form": "
|
|
101
|
-
"@khanacademy/wonder-blocks-icon": "5.
|
|
102
|
-
"@khanacademy/wonder-blocks-icon-button": "6.
|
|
103
|
-
"@khanacademy/wonder-blocks-layout": "3.
|
|
104
|
-
"@khanacademy/wonder-blocks-link": "7.
|
|
105
|
-
"@khanacademy/wonder-blocks-pill": "3.
|
|
106
|
-
"@khanacademy/wonder-blocks-popover": "5.
|
|
107
|
-
"@khanacademy/wonder-blocks-progress-spinner": "3.
|
|
108
|
-
"@khanacademy/wonder-blocks-switch": "3.
|
|
109
|
-
"@khanacademy/wonder-blocks-tokens": "
|
|
110
|
-
"@khanacademy/wonder-blocks-tooltip": "4.
|
|
111
|
-
"@khanacademy/wonder-blocks-typography": "3.
|
|
94
|
+
"@khanacademy/wonder-blocks-banner": "4.1.1",
|
|
95
|
+
"@khanacademy/wonder-blocks-button": "7.1.1",
|
|
96
|
+
"@khanacademy/wonder-blocks-clickable": "6.1.1",
|
|
97
|
+
"@khanacademy/wonder-blocks-core": "12.1.1",
|
|
98
|
+
"@khanacademy/wonder-blocks-data": "14.1.1",
|
|
99
|
+
"@khanacademy/wonder-blocks-dropdown": "9.1.1",
|
|
100
|
+
"@khanacademy/wonder-blocks-form": "7.1.1",
|
|
101
|
+
"@khanacademy/wonder-blocks-icon": "5.1.1",
|
|
102
|
+
"@khanacademy/wonder-blocks-icon-button": "6.1.1",
|
|
103
|
+
"@khanacademy/wonder-blocks-layout": "3.1.1",
|
|
104
|
+
"@khanacademy/wonder-blocks-link": "7.1.1",
|
|
105
|
+
"@khanacademy/wonder-blocks-pill": "3.1.1",
|
|
106
|
+
"@khanacademy/wonder-blocks-popover": "5.1.1",
|
|
107
|
+
"@khanacademy/wonder-blocks-progress-spinner": "3.1.1",
|
|
108
|
+
"@khanacademy/wonder-blocks-switch": "3.1.1",
|
|
109
|
+
"@khanacademy/wonder-blocks-tokens": "4.2.1",
|
|
110
|
+
"@khanacademy/wonder-blocks-tooltip": "4.1.1",
|
|
111
|
+
"@khanacademy/wonder-blocks-typography": "3.1.1",
|
|
112
112
|
"@khanacademy/wonder-stuff-core": "1.5.4",
|
|
113
113
|
"@phosphor-icons/core": "^2.0.2",
|
|
114
114
|
"@popperjs/core": "^2.10.2",
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import type { Coord } from "../interactive2/types";
|
|
3
|
-
import type { GridDimensions } from "../util";
|
|
4
|
-
import type { PerseusImageBackground } from "@khanacademy/perseus-core";
|
|
5
|
-
type Props = {
|
|
6
|
-
box: [number, number];
|
|
7
|
-
labels: ReadonlyArray<string>;
|
|
8
|
-
range: [Coord, Coord];
|
|
9
|
-
step: [number, number];
|
|
10
|
-
gridStep: [number, number];
|
|
11
|
-
snapStep: [number, number];
|
|
12
|
-
markings: string;
|
|
13
|
-
backgroundImage: PerseusImageBackground;
|
|
14
|
-
showProtractor: boolean;
|
|
15
|
-
showRuler: boolean;
|
|
16
|
-
rulerLabel: string;
|
|
17
|
-
rulerTicks: number;
|
|
18
|
-
instructions?: string;
|
|
19
|
-
isMobile: boolean;
|
|
20
|
-
onGraphieUpdated?: (graphie: any) => void;
|
|
21
|
-
onClick?: (Coord: any) => void;
|
|
22
|
-
onMouseDown?: (Coord: any) => void;
|
|
23
|
-
onMouseMove?: (Coord: any) => void;
|
|
24
|
-
setDrawingAreaAvailable?: (boolean: any) => void;
|
|
25
|
-
};
|
|
26
|
-
type DefaultProps = {
|
|
27
|
-
labels: Props["labels"];
|
|
28
|
-
range: Props["range"];
|
|
29
|
-
step: Props["step"];
|
|
30
|
-
gridStep: Props["gridStep"];
|
|
31
|
-
snapStep: Props["snapStep"];
|
|
32
|
-
markings: Props["markings"];
|
|
33
|
-
backgroundImage: Props["backgroundImage"];
|
|
34
|
-
showProtractor: Props["showProtractor"];
|
|
35
|
-
showRuler: Props["showRuler"];
|
|
36
|
-
rulerLabel: Props["rulerLabel"];
|
|
37
|
-
rulerTicks: Props["rulerTicks"];
|
|
38
|
-
isMobile: Props["isMobile"];
|
|
39
|
-
};
|
|
40
|
-
declare class Graph extends React.Component<Props> {
|
|
41
|
-
graphieDivRef: React.RefObject<HTMLDivElement>;
|
|
42
|
-
protractor: any;
|
|
43
|
-
ruler: any;
|
|
44
|
-
_graphie: any;
|
|
45
|
-
_hasSetupGraphieThisUpdate: boolean;
|
|
46
|
-
_shouldSetupGraphie: boolean;
|
|
47
|
-
static defaultProps: DefaultProps;
|
|
48
|
-
componentDidMount(): void;
|
|
49
|
-
UNSAFE_componentWillReceiveProps(nextProps: any): void;
|
|
50
|
-
componentDidUpdate(): void;
|
|
51
|
-
reset: () => void;
|
|
52
|
-
graphie: () => any;
|
|
53
|
-
pointsFromNormalized: (arg1: any, arg2: any) => any;
|
|
54
|
-
_setupGraphie: (arg1: any) => void;
|
|
55
|
-
_getGridConfig: () => [GridDimensions, GridDimensions];
|
|
56
|
-
_updateProtractor: () => void;
|
|
57
|
-
_updateRuler: () => void;
|
|
58
|
-
toJSON: () => any;
|
|
59
|
-
render(): React.ReactNode;
|
|
60
|
-
}
|
|
61
|
-
export default Graph;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const mafsSupportedGraphTypes: readonly ["angle", "segment", "linear", "linear-system", "ray", "polygon", "point", "circle", "quadratic", "sinusoid", "unlimited-point", "unlimited-polygon"];
|
|
2
|
-
type MafsSupportedGraphType = (typeof mafsSupportedGraphTypes)[number];
|
|
3
|
-
export declare const trueForAllMafsSupportedGraphTypes: Record<MafsSupportedGraphType, true>;
|
|
4
|
-
export {};
|