@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.
@@ -97,6 +97,7 @@ export declare const ApiOptions: {
97
97
  editorChangeDelay?: number | undefined;
98
98
  flags?: {
99
99
  mafs?: false | ({
100
+ circle?: boolean | undefined;
100
101
  polygon?: boolean | undefined;
101
102
  linear?: boolean | undefined;
102
103
  ray?: boolean | undefined;
@@ -364,7 +364,6 @@ export type LockedLineType = {
364
364
  points: [startPoint: LockedPointType, endPoint: LockedPointType];
365
365
  color: LockedFigureColor;
366
366
  lineStyle: "solid" | "dashed";
367
- showArrows: boolean;
368
367
  showStartPoint: boolean;
369
368
  showEndPoint: boolean;
370
369
  };
@@ -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;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import type { CircleGraphState, MafsGraphProps } from "../types";
3
+ type CircleGraphProps = MafsGraphProps<CircleGraphState>;
4
+ export declare function CircleGraph(props: CircleGraphProps): JSX.Element;
5
+ export {};
@@ -2,3 +2,4 @@ export { SegmentGraph } from "./segment";
2
2
  export { LinearGraph } from "./linear";
3
3
  export { RayGraph } from "./ray";
4
4
  export { PolygonGraph } from "./polygon";
5
+ export { CircleGraph } from "./circle";
@@ -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
- radius: number;
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;
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": "22.3.0",
6
+ "version": "22.4.0",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },