@khanacademy/perseus 24.3.0 → 25.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/es/index.js +217 -273
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.js +279 -337
- package/dist/index.js.map +1 -1
- package/dist/logging/log.d.ts +1 -41
- package/dist/server-item-renderer.d.ts +1 -1
- package/dist/widgets/expression.d.ts +2 -2
- package/dist/widgets/interactive-graphs/graphs/utils.d.ts +0 -3
- package/dist/widgets/interactive-graphs/index.d.ts +1 -1
- package/dist/widgets/interactive-graphs/mafs-graph.d.ts +0 -19
- package/dist/widgets/interactive-graphs/math/angles.d.ts +2 -0
- package/dist/widgets/interactive-graphs/math/geometry.d.ts +3 -0
- package/dist/widgets/interactive-graphs/math/index.d.ts +3 -1
- package/dist/widgets/interactive-graphs/math/interpolation.d.ts +1 -0
- package/dist/widgets/interactive-graphs/stateful-mafs-graph.d.ts +21 -0
- package/package.json +8 -8
- package/dist/perseus-error.d.ts +0 -11
package/dist/logging/log.d.ts
CHANGED
|
@@ -1,45 +1,5 @@
|
|
|
1
|
+
import type { ErrorKind } from "@khanacademy/perseus-core";
|
|
1
2
|
import type { Metadata } from "@khanacademy/wonder-stuff-core";
|
|
2
|
-
/**
|
|
3
|
-
* @typedef {Object} Errors utility for referencing the Perseus error taxonomy.
|
|
4
|
-
*/
|
|
5
|
-
export declare const Errors: Readonly<{
|
|
6
|
-
/**
|
|
7
|
-
* @property {ErrorKind} Unknown The kind of error is not known.
|
|
8
|
-
*/
|
|
9
|
-
Unknown: "Unknown";
|
|
10
|
-
/**
|
|
11
|
-
* @property {ErrorKind} Internal The error is internal to the executing code.
|
|
12
|
-
*/
|
|
13
|
-
Internal: "Internal";
|
|
14
|
-
/**
|
|
15
|
-
* @property {ErrorKind} InvalidInput There was a problem with the provided
|
|
16
|
-
* input, such as the wrong format or a null value.
|
|
17
|
-
*/
|
|
18
|
-
InvalidInput: "InvalidInput";
|
|
19
|
-
/**
|
|
20
|
-
* @property {ErrorKind} NotAllowed There was a problem due to the state of
|
|
21
|
-
* the system not matching the requested operation or input. For example,
|
|
22
|
-
* trying to create a username that is valid, but is already taken by
|
|
23
|
-
* another user. Use {@link InvalidInput} instead when the input isn't
|
|
24
|
-
* valid regardless of the state of the system. Use {@link NotFound} when
|
|
25
|
-
* the failure is due to not being able to find a resource.
|
|
26
|
-
*/
|
|
27
|
-
NotAllowed: "NotAllowed";
|
|
28
|
-
/**
|
|
29
|
-
* @property {ErrorKind} TransientService There was a problem when making a
|
|
30
|
-
* request to a service.
|
|
31
|
-
*/
|
|
32
|
-
TransientService: "TransientService";
|
|
33
|
-
/**
|
|
34
|
-
* @property {ErrorKind} Service There was a non-transient problem when
|
|
35
|
-
* making a request to service.
|
|
36
|
-
*/
|
|
37
|
-
Service: "Service";
|
|
38
|
-
}>;
|
|
39
|
-
/**
|
|
40
|
-
* @type {ErrorKind} The kind of error being reported
|
|
41
|
-
*/
|
|
42
|
-
export type ErrorKind = (typeof Errors)[keyof typeof Errors];
|
|
43
3
|
export type LogErrorOptions = {
|
|
44
4
|
cause?: Error | null | undefined;
|
|
45
5
|
loggedMetadata?: Metadata | null | undefined;
|
|
@@ -105,7 +105,7 @@ export declare class ServerItemRenderer extends React.Component<Props, State> im
|
|
|
105
105
|
setAssetStatus: (assetKey: string, status: boolean) => void;
|
|
106
106
|
render(): React.ReactNode;
|
|
107
107
|
}
|
|
108
|
-
declare const ref: React.ForwardRefExoticComponent<Omit<Pick<OwnProps & HOCProps, "
|
|
108
|
+
declare const ref: React.ForwardRefExoticComponent<Omit<Pick<OwnProps & HOCProps, "problemNum" | "keypadElement" | "showSolutions" | "reviewMode" | "item" | "dependencies" | "hintsVisible"> & {
|
|
109
109
|
apiOptions?: Readonly<{
|
|
110
110
|
isArticle?: boolean | undefined;
|
|
111
111
|
onInputError?: ((widgetId: any, value: string, message?: string | null | undefined) => unknown) | undefined;
|
|
@@ -254,9 +254,9 @@ declare const _default: Readonly<{
|
|
|
254
254
|
times: boolean;
|
|
255
255
|
value: string;
|
|
256
256
|
}, "onChange" | "analytics" | "buttonsVisible" | "static" | "containerSizeClass" | "widgetId" | "problemNum" | "questionCompleted" | "findWidgets" | "trackInteraction" | "keypadElement" | "keypadConfiguration" | "alignment" | "reviewModeRubric" | "isLastUsedWidget"> & {
|
|
257
|
+
value?: string | undefined;
|
|
257
258
|
onFocus?: ((blurPath: import("../types").FocusPath) => void) | undefined;
|
|
258
259
|
onBlur?: ((blurPath: import("../types").FocusPath) => void) | undefined;
|
|
259
|
-
value?: string | undefined;
|
|
260
260
|
buttonSets?: import("../perseus-types").LegacyButtonSets | undefined;
|
|
261
261
|
apiOptions?: Readonly<Readonly<{
|
|
262
262
|
isArticle?: boolean | undefined;
|
|
@@ -488,9 +488,9 @@ declare const _default: Readonly<{
|
|
|
488
488
|
times: boolean;
|
|
489
489
|
value: string;
|
|
490
490
|
}, "onChange" | "analytics" | "buttonsVisible" | "static" | "containerSizeClass" | "widgetId" | "problemNum" | "questionCompleted" | "findWidgets" | "trackInteraction" | "keypadElement" | "keypadConfiguration" | "alignment" | "reviewModeRubric" | "isLastUsedWidget"> & {
|
|
491
|
+
value?: string | undefined;
|
|
491
492
|
onFocus?: ((blurPath: import("../types").FocusPath) => void) | undefined;
|
|
492
493
|
onBlur?: ((blurPath: import("../types").FocusPath) => void) | undefined;
|
|
493
|
-
value?: string | undefined;
|
|
494
494
|
buttonSets?: import("../perseus-types").LegacyButtonSets | undefined;
|
|
495
495
|
apiOptions?: Readonly<Readonly<{
|
|
496
496
|
isArticle?: boolean | undefined;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type { CollinearTuple } from "../../../perseus-types";
|
|
2
1
|
import type { Interval, vec } from "mafs";
|
|
3
|
-
export declare function calculateAngleInDegrees([x, y]: vec.Vector2): number;
|
|
4
2
|
/**
|
|
5
3
|
* Given a ray and a rectangular box, find the point where the ray intersects
|
|
6
4
|
* the edge of the box. Assumes the `initialPoint` is inside the box.
|
|
@@ -9,4 +7,3 @@ export declare function calculateAngleInDegrees([x, y]: vec.Vector2): number;
|
|
|
9
7
|
* @param box - The box with which to intersect the ray, in the form [[xMin, xMax], [yMin, yMax]]
|
|
10
8
|
*/
|
|
11
9
|
export declare const getIntersectionOfRayWithBox: (initialPoint: vec.Vector2, throughPoint: vec.Vector2, box: [x: Interval, y: Interval]) => [number, number];
|
|
12
|
-
export declare const getLines: (points: readonly vec.Vector2[]) => CollinearTuple[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { StatefulMafsGraph } from "./mafs-graph";
|
|
1
|
+
export { StatefulMafsGraph } from "./stateful-mafs-graph";
|
|
@@ -1,27 +1,8 @@
|
|
|
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 { PerseusGraphType } from "../../perseus-types";
|
|
5
|
-
import type { Widget } from "../../renderer";
|
|
6
4
|
import "mafs/core.css";
|
|
7
5
|
import "./mafs-styles.css";
|
|
8
|
-
export type StatefulMafsGraphProps = {
|
|
9
|
-
box: [number, number];
|
|
10
|
-
backgroundImage?: InteractiveGraphProps["backgroundImage"];
|
|
11
|
-
graph: PerseusGraphType;
|
|
12
|
-
lockedFigures?: InteractiveGraphProps["lockedFigures"];
|
|
13
|
-
range: InteractiveGraphProps["range"];
|
|
14
|
-
snapStep: InteractiveGraphProps["snapStep"];
|
|
15
|
-
step: InteractiveGraphProps["step"];
|
|
16
|
-
gridStep: InteractiveGraphProps["gridStep"];
|
|
17
|
-
containerSizeClass: InteractiveGraphProps["containerSizeClass"];
|
|
18
|
-
markings: InteractiveGraphProps["markings"];
|
|
19
|
-
onChange: InteractiveGraphProps["onChange"];
|
|
20
|
-
showTooltips: Required<InteractiveGraphProps["showTooltips"]>;
|
|
21
|
-
showProtractor: boolean;
|
|
22
|
-
labels: InteractiveGraphProps["labels"];
|
|
23
|
-
};
|
|
24
|
-
export declare const StatefulMafsGraph: React.ForwardRefExoticComponent<StatefulMafsGraphProps & React.RefAttributes<Partial<Widget>>>;
|
|
25
6
|
export type MafsGraphProps = {
|
|
26
7
|
box: [number, number];
|
|
27
8
|
backgroundImage?: InteractiveGraphProps["backgroundImage"];
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { vec } from "mafs";
|
|
2
|
+
export declare function convertDegreesToRadians(degrees: number): number;
|
|
3
|
+
export declare function calculateAngleInDegrees([x, y]: vec.Vector2): number;
|
|
2
4
|
export declare function polar(r: number | vec.Vector2, th: number): vec.Vector2;
|
|
3
5
|
export declare const findAngle: (point1: vec.Vector2, point2: vec.Vector2, vertex?: vec.Vector2) => number;
|
|
@@ -3,4 +3,6 @@ export { snap } from "./snap";
|
|
|
3
3
|
export { inset, clampToBox } from "./box";
|
|
4
4
|
export { X, Y } from "./coordinates";
|
|
5
5
|
export { MIN, MAX, size } from "./interval";
|
|
6
|
-
export {
|
|
6
|
+
export { lerp } from "./interpolation";
|
|
7
|
+
export { segmentsIntersect } from "./geometry";
|
|
8
|
+
export { calculateAngleInDegrees, convertDegreesToRadians, findAngle, polar, } from "./angles";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function lerp(a: number, b: number, fraction: number): number;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { InteractiveGraphProps } from "./types";
|
|
3
|
+
import type { Widget } from "../../renderer";
|
|
4
|
+
import type { PerseusGraphType } from "@khanacademy/perseus";
|
|
5
|
+
export type StatefulMafsGraphProps = {
|
|
6
|
+
box: [number, number];
|
|
7
|
+
backgroundImage?: InteractiveGraphProps["backgroundImage"];
|
|
8
|
+
graph: PerseusGraphType;
|
|
9
|
+
lockedFigures?: InteractiveGraphProps["lockedFigures"];
|
|
10
|
+
range: InteractiveGraphProps["range"];
|
|
11
|
+
snapStep: InteractiveGraphProps["snapStep"];
|
|
12
|
+
step: InteractiveGraphProps["step"];
|
|
13
|
+
gridStep: InteractiveGraphProps["gridStep"];
|
|
14
|
+
containerSizeClass: InteractiveGraphProps["containerSizeClass"];
|
|
15
|
+
markings: InteractiveGraphProps["markings"];
|
|
16
|
+
onChange: InteractiveGraphProps["onChange"];
|
|
17
|
+
showTooltips: Required<InteractiveGraphProps["showTooltips"]>;
|
|
18
|
+
showProtractor: boolean;
|
|
19
|
+
labels: InteractiveGraphProps["labels"];
|
|
20
|
+
};
|
|
21
|
+
export declare const StatefulMafsGraph: React.ForwardRefExoticComponent<StatefulMafsGraphProps & React.RefAttributes<Partial<Widget>>>;
|
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": "25.0.0",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
"test": "bash -c 'yarn --silent --cwd \"../..\" test ${@:0} $($([[ ${@: -1} = -* ]] || [[ ${@: -1} = bash ]]) && echo $PWD)'"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@khanacademy/kas": "^0.3.
|
|
43
|
-
"@khanacademy/kmath": "^0.1.
|
|
44
|
-
"@khanacademy/math-input": "^19.2.
|
|
45
|
-
"@khanacademy/perseus-core": "1.
|
|
46
|
-
"@khanacademy/perseus-linter": "^0.
|
|
47
|
-
"@khanacademy/pure-markdown": "^0.3.
|
|
48
|
-
"@khanacademy/simple-markdown": "^0.12.
|
|
42
|
+
"@khanacademy/kas": "^0.3.10",
|
|
43
|
+
"@khanacademy/kmath": "^0.1.13",
|
|
44
|
+
"@khanacademy/math-input": "^19.2.1",
|
|
45
|
+
"@khanacademy/perseus-core": "1.5.0",
|
|
46
|
+
"@khanacademy/perseus-linter": "^1.0.0",
|
|
47
|
+
"@khanacademy/pure-markdown": "^0.3.6",
|
|
48
|
+
"@khanacademy/simple-markdown": "^0.12.1",
|
|
49
49
|
"@use-gesture/react": "^10.2.27",
|
|
50
50
|
"mafs": "0.18.7"
|
|
51
51
|
},
|
package/dist/perseus-error.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { ErrorKind } from "./logging/log";
|
|
2
|
-
import type { Metadata } from "@khanacademy/wonder-stuff-core";
|
|
3
|
-
type Options = {
|
|
4
|
-
metadata?: Metadata | null | undefined;
|
|
5
|
-
};
|
|
6
|
-
export declare class PerseusError extends Error {
|
|
7
|
-
kind: ErrorKind;
|
|
8
|
-
metadata: Metadata | null | undefined;
|
|
9
|
-
constructor(message: string, kind: ErrorKind, options?: Options);
|
|
10
|
-
}
|
|
11
|
-
export {};
|