@khanacademy/perseus 22.3.0 → 22.4.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/es/index.js +446 -280
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +466 -292
- package/dist/index.js.map +1 -1
- package/dist/perseus-api.d.ts +1 -0
- package/dist/perseus-types.d.ts +0 -1
- package/dist/server-item-renderer.d.ts +1 -0
- package/dist/types.d.ts +1 -1
- package/dist/widgets/expression.d.ts +6 -0
- package/dist/widgets/interactive-graphs/graphs/circle.d.ts +5 -0
- package/dist/widgets/interactive-graphs/graphs/index.d.ts +1 -0
- package/dist/widgets/interactive-graphs/graphs/utils.d.ts +1 -0
- package/dist/widgets/interactive-graphs/mafs-supported-graph-types.d.ts +1 -1
- package/dist/widgets/interactive-graphs/reducer/interactive-graph-action.d.ts +13 -1
- package/dist/widgets/interactive-graphs/reducer/interactive-graph-state.d.ts +8 -1
- package/dist/widgets/interactive-graphs/types.d.ts +2 -2
- package/dist/widgets/label-image.d.ts +2 -0
- package/package.json +1 -1
package/dist/perseus-api.d.ts
CHANGED
package/dist/perseus-types.d.ts
CHANGED
|
@@ -142,6 +142,7 @@ declare const ref: React.ForwardRefExoticComponent<Omit<Pick<OwnProps & HOCProps
|
|
|
142
142
|
editorChangeDelay?: number | undefined;
|
|
143
143
|
flags?: {
|
|
144
144
|
mafs?: false | ({
|
|
145
|
+
circle?: boolean | undefined;
|
|
145
146
|
polygon?: boolean | undefined;
|
|
146
147
|
linear?: boolean | undefined;
|
|
147
148
|
ray?: boolean | undefined;
|
package/dist/types.d.ts
CHANGED
|
@@ -78,7 +78,7 @@ type TrackInteractionArgs = {
|
|
|
78
78
|
id: string;
|
|
79
79
|
correct?: boolean;
|
|
80
80
|
} & Partial<TrackingGradedGroupExtraArguments> & Partial<TrackingSequenceExtraArguments>;
|
|
81
|
-
export declare const MafsGraphTypeFlags: readonly ["segment", "linear", "linear-system", "ray", "polygon"];
|
|
81
|
+
export declare const MafsGraphTypeFlags: readonly ["segment", "linear", "linear-system", "ray", "polygon", "circle"];
|
|
82
82
|
export declare const InteractiveGraphLockedFeaturesFlags: readonly ["interactive-graph-locked-features-m1"];
|
|
83
83
|
/**
|
|
84
84
|
* APIOptions provides different ways to customize the behaviour of Perseus.
|
|
@@ -136,6 +136,7 @@ declare const _default: Readonly<{
|
|
|
136
136
|
editorChangeDelay?: number | undefined;
|
|
137
137
|
flags?: {
|
|
138
138
|
mafs?: false | ({
|
|
139
|
+
circle?: boolean | undefined;
|
|
139
140
|
polygon?: boolean | undefined;
|
|
140
141
|
linear?: boolean | undefined;
|
|
141
142
|
ray?: boolean | undefined;
|
|
@@ -213,6 +214,7 @@ declare const _default: Readonly<{
|
|
|
213
214
|
editorChangeDelay?: number | undefined;
|
|
214
215
|
flags?: {
|
|
215
216
|
mafs?: false | ({
|
|
217
|
+
circle?: boolean | undefined;
|
|
216
218
|
polygon?: boolean | undefined;
|
|
217
219
|
linear?: boolean | undefined;
|
|
218
220
|
ray?: boolean | undefined;
|
|
@@ -290,6 +292,7 @@ declare const _default: Readonly<{
|
|
|
290
292
|
editorChangeDelay?: number | undefined;
|
|
291
293
|
flags?: {
|
|
292
294
|
mafs?: false | ({
|
|
295
|
+
circle?: boolean | undefined;
|
|
293
296
|
polygon?: boolean | undefined;
|
|
294
297
|
linear?: boolean | undefined;
|
|
295
298
|
ray?: boolean | undefined;
|
|
@@ -364,6 +367,7 @@ declare const _default: Readonly<{
|
|
|
364
367
|
editorChangeDelay?: number | undefined;
|
|
365
368
|
flags?: {
|
|
366
369
|
mafs?: false | ({
|
|
370
|
+
circle?: boolean | undefined;
|
|
367
371
|
polygon?: boolean | undefined;
|
|
368
372
|
linear?: boolean | undefined;
|
|
369
373
|
ray?: boolean | undefined;
|
|
@@ -441,6 +445,7 @@ declare const _default: Readonly<{
|
|
|
441
445
|
editorChangeDelay?: number | undefined;
|
|
442
446
|
flags?: {
|
|
443
447
|
mafs?: false | ({
|
|
448
|
+
circle?: boolean | undefined;
|
|
444
449
|
polygon?: boolean | undefined;
|
|
445
450
|
linear?: boolean | undefined;
|
|
446
451
|
ray?: boolean | undefined;
|
|
@@ -518,6 +523,7 @@ declare const _default: Readonly<{
|
|
|
518
523
|
editorChangeDelay?: number | undefined;
|
|
519
524
|
flags?: {
|
|
520
525
|
mafs?: false | ({
|
|
526
|
+
circle?: boolean | undefined;
|
|
521
527
|
polygon?: boolean | undefined;
|
|
522
528
|
linear?: boolean | undefined;
|
|
523
529
|
ray?: boolean | undefined;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CollinearTuple } from "../../../perseus-types";
|
|
2
2
|
import type { Interval, vec } from "mafs";
|
|
3
|
+
export declare function calculateAngleInDegrees([x, y]: vec.Vector2): number;
|
|
3
4
|
/**
|
|
4
5
|
* Given a ray and a rectangular box, find the point where the ray intersects
|
|
5
6
|
* the edge of the box. Assumes the `initialPoint` is inside the box.
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const mafsSupportedGraphTypes: readonly ["segment", "linear", "linear-system", "ray", "polygon", "point"];
|
|
1
|
+
export declare const mafsSupportedGraphTypes: readonly ["segment", "linear", "linear-system", "ray", "polygon", "point", "circle"];
|
|
2
2
|
export type MafsSupportedGraphType = (typeof mafsSupportedGraphTypes)[number];
|
|
3
3
|
export declare const trueForAllMafsSupportedGraphTypes: Record<MafsSupportedGraphType, true>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Props as MafsGraphProps } from "../mafs-graph";
|
|
2
2
|
import type { vec } from "mafs";
|
|
3
|
-
export type InteractiveGraphAction = MoveControlPoint | MoveLine | MoveAll | MovePoint | ChangeSnapStep | ChangeRange;
|
|
3
|
+
export type InteractiveGraphAction = MoveControlPoint | MoveLine | MoveAll | MovePoint | MoveCenter | MoveRadiusPoint | ChangeSnapStep | ChangeRange;
|
|
4
4
|
export declare const MOVE_CONTROL_POINT = "move-control-point";
|
|
5
5
|
export interface MoveControlPoint {
|
|
6
6
|
type: typeof MOVE_CONTROL_POINT;
|
|
@@ -32,6 +32,18 @@ export interface MovePoint {
|
|
|
32
32
|
destination: vec.Vector2;
|
|
33
33
|
}
|
|
34
34
|
export declare function movePoint(index: number, destination: vec.Vector2): MovePoint;
|
|
35
|
+
export declare const MOVE_CENTER = "move-center";
|
|
36
|
+
export interface MoveCenter {
|
|
37
|
+
type: typeof MOVE_CENTER;
|
|
38
|
+
destination: vec.Vector2;
|
|
39
|
+
}
|
|
40
|
+
export declare function moveCenter(destination: vec.Vector2): MoveCenter;
|
|
41
|
+
export declare const MOVE_RADIUS_POINT = "MOVE_RADIUS_POINT";
|
|
42
|
+
export interface MoveRadiusPoint {
|
|
43
|
+
type: typeof MOVE_RADIUS_POINT;
|
|
44
|
+
destination: vec.Vector2;
|
|
45
|
+
}
|
|
46
|
+
export declare function moveRadiusPoint(destination: vec.Vector2): MoveRadiusPoint;
|
|
35
47
|
export declare const CHANGE_SNAP_STEP = "change-snap-step";
|
|
36
48
|
export interface ChangeSnapStep {
|
|
37
49
|
type: typeof CHANGE_SNAP_STEP;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PerseusGraphType } from "../../../perseus-types";
|
|
2
|
-
import type { InteractiveGraphProps, InteractiveGraphState } from "../types";
|
|
2
|
+
import type { CircleGraphState, InteractiveGraphProps, InteractiveGraphState } from "../types";
|
|
3
3
|
export type InitializeGraphStateParam = {
|
|
4
4
|
range: InteractiveGraphProps["range"];
|
|
5
5
|
step: InteractiveGraphProps["step"];
|
|
@@ -9,3 +9,10 @@ export type InitializeGraphStateParam = {
|
|
|
9
9
|
};
|
|
10
10
|
export declare function initializeGraphState(params: InitializeGraphStateParam): InteractiveGraphState;
|
|
11
11
|
export declare function getGradableGraph(state: InteractiveGraphState, initialGraph: PerseusGraphType): PerseusGraphType;
|
|
12
|
+
/**
|
|
13
|
+
* determine radius of a circle graph
|
|
14
|
+
*
|
|
15
|
+
* @param graph - the graph object containing the circle
|
|
16
|
+
* @returns the radius of the circle
|
|
17
|
+
*/
|
|
18
|
+
export declare function getRadius(graph: CircleGraphState): number;
|
|
@@ -16,7 +16,7 @@ export interface InitializeGraphStateParams<T extends PerseusGraphType> {
|
|
|
16
16
|
export type InteractiveGraphState = SegmentGraphState | LinearGraphState | RayGraphState | PolygonGraphState | PointGraphState | CircleGraphState;
|
|
17
17
|
export interface InteractiveGraphStateCommon {
|
|
18
18
|
hasBeenInteractedWith: boolean;
|
|
19
|
-
range: [Interval, Interval];
|
|
19
|
+
range: [xRange: Interval, yRange: Interval];
|
|
20
20
|
snapStep: vec.Vector2;
|
|
21
21
|
markings: InteractiveGraphProps["markings"];
|
|
22
22
|
}
|
|
@@ -45,6 +45,6 @@ export interface PolygonGraphState extends InteractiveGraphStateCommon {
|
|
|
45
45
|
export interface CircleGraphState extends InteractiveGraphStateCommon {
|
|
46
46
|
type: "circle";
|
|
47
47
|
center: Coord;
|
|
48
|
-
|
|
48
|
+
radiusPoint: Coord;
|
|
49
49
|
}
|
|
50
50
|
export type PairOfPoints = [Coord, Coord];
|
|
@@ -130,6 +130,7 @@ declare const _default: Readonly<{
|
|
|
130
130
|
editorChangeDelay?: number | undefined;
|
|
131
131
|
flags?: {
|
|
132
132
|
mafs?: false | ({
|
|
133
|
+
circle?: boolean | undefined;
|
|
133
134
|
polygon?: boolean | undefined;
|
|
134
135
|
linear?: boolean | undefined;
|
|
135
136
|
ray?: boolean | undefined;
|
|
@@ -189,6 +190,7 @@ declare const _default: Readonly<{
|
|
|
189
190
|
editorChangeDelay?: number | undefined;
|
|
190
191
|
flags?: {
|
|
191
192
|
mafs?: false | ({
|
|
193
|
+
circle?: boolean | undefined;
|
|
192
194
|
polygon?: boolean | undefined;
|
|
193
195
|
linear?: boolean | undefined;
|
|
194
196
|
ray?: boolean | undefined;
|