@khanacademy/perseus 23.3.0 → 23.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.css +8 -0
- package/dist/es/index.js +407 -300
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +8 -0
- package/dist/index.js +422 -319
- package/dist/index.js.map +1 -1
- package/dist/perseus-types.d.ts +1 -1
- package/dist/widgets/interactive-graphs/graphs/components/angle.d.ts +2 -1
- package/dist/widgets/interactive-graphs/graphs/components/movable-point.d.ts +1 -0
- package/dist/widgets/interactive-graphs/graphs/quadratic.d.ts +1 -2
- package/dist/widgets/interactive-graphs/interactive-graph-question-builder.d.ts +1 -0
- package/dist/widgets/interactive-graphs/reducer/initialize-graph-state.d.ts +9 -0
- package/dist/widgets/interactive-graphs/reducer/interactive-graph-state.d.ts +2 -9
- package/dist/widgets/interactive-graphs/types.d.ts +1 -0
- package/package.json +3 -3
package/dist/perseus-types.d.ts
CHANGED
|
@@ -418,7 +418,7 @@ export type PerseusGraphTypePolygon = {
|
|
|
418
418
|
numSides?: number | "unlimited";
|
|
419
419
|
showAngles?: boolean;
|
|
420
420
|
showSides?: boolean;
|
|
421
|
-
snapTo?:
|
|
421
|
+
snapTo?: "grid" | "angles" | "sides";
|
|
422
422
|
match?: "similar" | "congruent" | "approx";
|
|
423
423
|
coords?: ReadonlyArray<Coord>;
|
|
424
424
|
} & PerseusGraphTypeCommon;
|
|
@@ -9,8 +9,9 @@ interface Props {
|
|
|
9
9
|
active: boolean;
|
|
10
10
|
range: [Interval, Interval];
|
|
11
11
|
showAngles: boolean;
|
|
12
|
+
snapTo: "grid" | "angles" | "sides";
|
|
12
13
|
}
|
|
13
|
-
export declare const Angle: ({ centerPoint, endPoints, range, polygonLines, showAngles, }: Props) => JSX.Element | null;
|
|
14
|
+
export declare const Angle: ({ centerPoint, endPoints, range, polygonLines, showAngles, snapTo, }: Props) => JSX.Element | null;
|
|
14
15
|
/**
|
|
15
16
|
* Determines if an angle is an inside (false) or outside (true) angle.
|
|
16
17
|
* They way, we know to flip the `largeArc` and `sweepArc` flags.
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { QuadraticGraphState, MafsGraphProps } from "../types";
|
|
3
|
-
import type { vec } from "mafs";
|
|
4
3
|
type QuadraticGraphProps = MafsGraphProps<QuadraticGraphState>;
|
|
5
4
|
type QuadraticCoefficient = [number, number, number];
|
|
5
|
+
export type QuadraticCoords = QuadraticGraphState["coords"];
|
|
6
6
|
export declare function QuadraticGraph(props: QuadraticGraphProps): JSX.Element;
|
|
7
|
-
export declare const isValidDestination: (destination: vec.Vector2, elementId: number, coords: [import("../../..").Coord, import("../../..").Coord, import("../../..").Coord]) => boolean;
|
|
8
7
|
export declare const getQuadraticCoefficients: (coords: [import("../../..").Coord, import("../../..").Coord, import("../../..").Coord]) => QuadraticCoefficient | undefined;
|
|
9
8
|
export {};
|
|
@@ -21,6 +21,7 @@ declare class InteractiveGraphQuestionBuilder {
|
|
|
21
21
|
withTickStep(x: number, y: number): InteractiveGraphQuestionBuilder;
|
|
22
22
|
withSegments(numSegments: number): InteractiveGraphQuestionBuilder;
|
|
23
23
|
withCircle(): InteractiveGraphQuestionBuilder;
|
|
24
|
+
withPolygon(snapTo: "grid" | "angles" | "sides"): InteractiveGraphQuestionBuilder;
|
|
24
25
|
addLockedPointAt(x: number, y: number): InteractiveGraphQuestionBuilder;
|
|
25
26
|
addLockedLine(point1: vec.Vector2, point2: vec.Vector2): InteractiveGraphQuestionBuilder;
|
|
26
27
|
addLockedEllipse(center: vec.Vector2, radius: [x: number, y: number], options?: {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PerseusGraphType } from "../../../perseus-types";
|
|
2
|
+
import type { InteractiveGraphState } from "../types";
|
|
3
|
+
import type { Interval } from "mafs";
|
|
4
|
+
export declare function initializeGraphState(params: {
|
|
5
|
+
range: [x: Interval, y: Interval];
|
|
6
|
+
step: [x: number, y: number];
|
|
7
|
+
snapStep: [x: number, y: number];
|
|
8
|
+
graph: PerseusGraphType;
|
|
9
|
+
}): InteractiveGraphState;
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
export type InitializeGraphStateParam = {
|
|
4
|
-
range: InteractiveGraphProps["range"];
|
|
5
|
-
step: InteractiveGraphProps["step"];
|
|
6
|
-
snapStep: InteractiveGraphProps["snapStep"];
|
|
7
|
-
graph: PerseusGraphType;
|
|
8
|
-
};
|
|
9
|
-
export declare function initializeGraphState(params: InitializeGraphStateParam): InteractiveGraphState;
|
|
1
|
+
import type { CircleGraphState, InteractiveGraphState } from "../types";
|
|
2
|
+
import type { PerseusGraphType } from "@khanacademy/perseus";
|
|
10
3
|
export declare function getGradableGraph(state: InteractiveGraphState, initialGraph: PerseusGraphType): PerseusGraphType;
|
|
11
4
|
/**
|
|
12
5
|
* determine radius of a circle graph
|
|
@@ -38,6 +38,7 @@ export interface PolygonGraphState extends InteractiveGraphStateCommon {
|
|
|
38
38
|
type: "polygon";
|
|
39
39
|
showAngles: boolean;
|
|
40
40
|
showSides: boolean;
|
|
41
|
+
snapTo: "grid" | "angles" | "sides";
|
|
41
42
|
coords: Coord[];
|
|
42
43
|
}
|
|
43
44
|
export interface CircleGraphState extends InteractiveGraphStateCommon {
|
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": "23.
|
|
6
|
+
"version": "23.4.0",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@khanacademy/wonder-blocks-core": "6.4.0",
|
|
56
56
|
"@khanacademy/wonder-blocks-data": "13.0.7",
|
|
57
57
|
"@khanacademy/wonder-blocks-dropdown": "5.3.0",
|
|
58
|
-
"@khanacademy/wonder-blocks-form": "4.
|
|
58
|
+
"@khanacademy/wonder-blocks-form": "^4.7.1",
|
|
59
59
|
"@khanacademy/wonder-blocks-icon": "4.1.0",
|
|
60
60
|
"@khanacademy/wonder-blocks-layout": "2.0.32",
|
|
61
61
|
"@khanacademy/wonder-blocks-link": "6.1.1",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"@khanacademy/wonder-blocks-core": "6.4.0",
|
|
91
91
|
"@khanacademy/wonder-blocks-data": "13.0.7",
|
|
92
92
|
"@khanacademy/wonder-blocks-dropdown": "5.3.0",
|
|
93
|
-
"@khanacademy/wonder-blocks-form": "4.
|
|
93
|
+
"@khanacademy/wonder-blocks-form": "^4.7.1",
|
|
94
94
|
"@khanacademy/wonder-blocks-icon": "4.1.0",
|
|
95
95
|
"@khanacademy/wonder-blocks-layout": "2.0.32",
|
|
96
96
|
"@khanacademy/wonder-blocks-link": "6.1.1",
|