@khanacademy/perseus 81.0.2 → 82.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.css +1 -1
- package/dist/es/index.css.map +1 -1
- package/dist/es/index.js +91 -101
- package/dist/es/index.js.map +1 -1
- package/dist/es/strings.js +1 -1
- package/dist/es/strings.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +91 -101
- package/dist/index.js.map +1 -1
- package/dist/server-item-renderer.d.ts +1 -1
- package/dist/strings.d.ts +138 -41
- package/dist/strings.js +1 -1
- package/dist/strings.js.map +1 -1
- package/dist/testing/feature-flags-util.d.ts +0 -1
- package/dist/testing/item-renderer-hooks.d.ts +1 -1
- package/dist/widgets/dropdown/dropdown.d.ts +1 -1
- package/dist/widgets/expression/expression.d.ts +2 -2
- package/dist/widgets/free-response/free-response.d.ts +0 -2
- package/dist/widgets/image/image.d.ts +1 -1
- package/dist/widgets/interactive-graphs/graphs/components/build-point-aria-label.d.ts +7 -1
- package/dist/widgets/interactive-graphs/graphs/strings/absolute-value.d.ts +2 -2
- package/dist/widgets/interactive-graphs/graphs/strings/angle.d.ts +1 -1
- package/dist/widgets/interactive-graphs/graphs/strings/circle.d.ts +1 -1
- package/dist/widgets/interactive-graphs/graphs/strings/coord-quadrant.d.ts +1 -1
- package/dist/widgets/interactive-graphs/graphs/strings/exponential.d.ts +1 -1
- package/dist/widgets/interactive-graphs/graphs/strings/linear-system.d.ts +17 -2
- package/dist/widgets/interactive-graphs/graphs/strings/logarithm.d.ts +1 -1
- package/dist/widgets/interactive-graphs/graphs/strings/quadratic.d.ts +1 -1
- package/dist/widgets/interactive-graphs/graphs/strings/ray.d.ts +1 -1
- package/dist/widgets/interactive-graphs/graphs/strings/segment.d.ts +16 -2
- package/dist/widgets/interactive-graphs/graphs/strings/sinusoid.d.ts +1 -1
- package/dist/widgets/interactive-graphs/graphs/strings/tangent.d.ts +2 -2
- package/dist/widgets/interactive-graphs/interactive-graph.d.ts +1 -1
- package/dist/widgets/interactive-graphs/mafs-graph.d.ts +0 -2
- package/dist/widgets/interactive-graphs/stateful-mafs-graph.d.ts +0 -2
- package/dist/widgets/interactive-graphs/types.d.ts +11 -10
- package/dist/widgets/label-image/label-image.d.ts +1 -1
- package/dist/widgets/measurer/measurer.d.ts +0 -14
- package/dist/widgets/mock-widgets/mock-widget.d.ts +1 -1
- package/dist/widgets/numeric-input/numeric-input.class.d.ts +1 -1
- package/dist/widgets/numeric-input/numeric-input.d.ts +2 -2
- package/dist/widgets/plotter/plotter.d.ts +0 -2
- package/dist/widgets/table/table.d.ts +1 -1
- package/package.json +7 -7
- package/dist/widgets/interactive-graphs/graphs/strings/custom-point-label.d.ts +0 -22
- package/dist/widgets/molecule/index.d.ts +0 -1
- package/dist/widgets/molecule/molecule-drawing.d.ts +0 -5
- package/dist/widgets/molecule/molecule-layout.d.ts +0 -81
- package/dist/widgets/molecule/molecule.d.ts +0 -23
- package/dist/widgets/molecule/smiles-parser.d.ts +0 -19
|
@@ -7,7 +7,6 @@ declare const DEFAULT_FEATURE_FLAGS: Record<"perseus-test-flag-1" | "perseus-tes
|
|
|
7
7
|
export declare function getFeatureFlags(overrides?: Partial<typeof DEFAULT_FEATURE_FLAGS>): {
|
|
8
8
|
"perseus-renderer-upgrade": boolean;
|
|
9
9
|
"desmos-calculator": boolean;
|
|
10
|
-
"perseus-enable-point-label-field": boolean;
|
|
11
10
|
"perseus-test-flag-1": boolean;
|
|
12
11
|
"perseus-test-flag-2": boolean;
|
|
13
12
|
};
|
|
@@ -34,7 +34,7 @@ export declare const useItemRenderer: (item: PerseusItem, apiOptions?: APIOption
|
|
|
34
34
|
}>) => void;
|
|
35
35
|
isMobileApp?: boolean;
|
|
36
36
|
hintProgressColor?: string;
|
|
37
|
-
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator"
|
|
37
|
+
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
|
|
38
38
|
};
|
|
39
39
|
toggleMobile: (isMobile: boolean) => void;
|
|
40
40
|
toggleRtl: (isRtl: boolean) => void;
|
|
@@ -47,7 +47,7 @@ declare const _default: {
|
|
|
47
47
|
isMobile?: boolean;
|
|
48
48
|
isMobileApp?: boolean;
|
|
49
49
|
hintProgressColor?: string;
|
|
50
|
-
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator"
|
|
50
|
+
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
|
|
51
51
|
}> & {
|
|
52
52
|
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
53
53
|
isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
|
|
@@ -37,7 +37,7 @@ export declare const Expression: React.ForwardRefExoticComponent<PerseusExpressi
|
|
|
37
37
|
isMobile?: boolean;
|
|
38
38
|
isMobileApp?: boolean;
|
|
39
39
|
hintProgressColor?: string;
|
|
40
|
-
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator"
|
|
40
|
+
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
|
|
41
41
|
}> & {
|
|
42
42
|
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
43
43
|
isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
|
|
@@ -109,7 +109,7 @@ declare const _default: {
|
|
|
109
109
|
isMobile?: boolean;
|
|
110
110
|
isMobileApp?: boolean;
|
|
111
111
|
hintProgressColor?: string;
|
|
112
|
-
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator"
|
|
112
|
+
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
|
|
113
113
|
}> & {
|
|
114
114
|
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
115
115
|
isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
|
|
@@ -9,12 +9,10 @@ import { PerseusI18nContext } from "../../components/i18n-context";
|
|
|
9
9
|
import type { Widget, WidgetExports, WidgetProps } from "../../types";
|
|
10
10
|
import type { PerseusFreeResponseUserInput, PerseusFreeResponseWidgetOptions } from "@khanacademy/perseus-core";
|
|
11
11
|
type Props = WidgetProps<PerseusFreeResponseWidgetOptions, PerseusFreeResponseUserInput>;
|
|
12
|
-
type DefaultProps = Pick<Props, "userInput">;
|
|
13
12
|
export declare class FreeResponse extends React.Component<Props> implements Widget {
|
|
14
13
|
static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
|
|
15
14
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
16
15
|
isWidget: true;
|
|
17
|
-
static defaultProps: DefaultProps;
|
|
18
16
|
announceCharacterCount: (message: string, isOverLimit: boolean) => void;
|
|
19
17
|
characterCount: () => number;
|
|
20
18
|
_handleUserInput: (newValue: string) => void;
|
|
@@ -40,7 +40,7 @@ declare const _default: {
|
|
|
40
40
|
isMobile?: boolean;
|
|
41
41
|
isMobileApp?: boolean;
|
|
42
42
|
hintProgressColor?: string;
|
|
43
|
-
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator"
|
|
43
|
+
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
|
|
44
44
|
}> & {
|
|
45
45
|
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
46
46
|
isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { PerseusStrings } from "../../../../strings";
|
|
2
2
|
import type { vec } from "mafs";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Returns the author's custom label for a point, or `undefined` when the
|
|
5
|
+
* entry is missing, an empty string, or malformed (a non-string that slipped
|
|
6
|
+
* past the parser in hand-authored JSON).
|
|
7
|
+
*/
|
|
8
|
+
export declare function getCustomPointLabel(pointLabels: ReadonlyArray<string> | undefined, index: number): string | undefined;
|
|
9
|
+
export declare function resolvePointLabel(pointLabels: ReadonlyArray<string> | undefined, index: number): string;
|
|
4
10
|
/**
|
|
5
11
|
* Returns a screen-reader aria-label for an interactive point using a
|
|
6
12
|
* custom label (e.g. "T"). Returns `undefined` when no custom label
|
|
@@ -3,7 +3,7 @@ import type { AbsoluteValueGraphState } from "../../types";
|
|
|
3
3
|
import type { PerseusStrings } from "@khanacademy/perseus/strings";
|
|
4
4
|
export declare function srAbsoluteValuePointLabel(state: {
|
|
5
5
|
pointIndex: number;
|
|
6
|
-
pointLabel: string |
|
|
6
|
+
pointLabel: string | undefined;
|
|
7
7
|
x: number;
|
|
8
8
|
y: number;
|
|
9
9
|
slope: number;
|
|
@@ -11,7 +11,7 @@ export declare function srAbsoluteValuePointLabel(state: {
|
|
|
11
11
|
type AbsoluteValueGraphDescriptionStrings = {
|
|
12
12
|
srAbsoluteValueGraph: string;
|
|
13
13
|
srAbsoluteValueVertexPoint: string;
|
|
14
|
-
|
|
14
|
+
srAbsoluteValueArmPoint: string;
|
|
15
15
|
srAbsoluteValueDescription: string;
|
|
16
16
|
srAbsoluteValueSlope: string;
|
|
17
17
|
};
|
|
@@ -3,7 +3,7 @@ import type { AngleGraphState } from "../../types";
|
|
|
3
3
|
import type { PerseusStrings } from "@khanacademy/perseus/strings";
|
|
4
4
|
export declare function srAnglePointLabel(state: {
|
|
5
5
|
pointIndex: number;
|
|
6
|
-
pointLabel: string |
|
|
6
|
+
pointLabel: string | undefined;
|
|
7
7
|
x: number;
|
|
8
8
|
y: number;
|
|
9
9
|
angleMeasure: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { I18nContextType } from "../../../../components/i18n-context";
|
|
2
2
|
import type { CircleGraphState } from "../../types";
|
|
3
3
|
import type { PerseusStrings } from "@khanacademy/perseus/strings";
|
|
4
|
-
export declare function srCircleRadiusPointLabel(x: number, y: number, centerX: number, strings: PerseusStrings, locale: string): string;
|
|
4
|
+
export declare function srCircleRadiusPointLabel(x: number, y: number, centerX: number, strings: PerseusStrings, locale: string, pointLabel?: string): string;
|
|
5
5
|
export declare function srCircleCenterLabel(x: number, y: number, strings: PerseusStrings, locale: string): string;
|
|
6
6
|
type CircleGraphDescriptionStrings = {
|
|
7
7
|
srCircleGraph: string;
|
|
@@ -3,5 +3,5 @@ import type { Coord } from "@khanacademy/perseus-core";
|
|
|
3
3
|
type GraphLocations = "origin" | "x-axis" | "y-axis" | 1 | 2 | 3 | 4;
|
|
4
4
|
export declare function getCoordQuadrant(coord: Coord): GraphLocations;
|
|
5
5
|
export declare function getQuadraticVertexString(vertex: Coord, strings: PerseusStrings): string;
|
|
6
|
-
export declare function getQuadraticPointString(
|
|
6
|
+
export declare function getQuadraticPointString(pointLabel: string, coord: Coord, strings: PerseusStrings, locale: string): string;
|
|
7
7
|
export {};
|
|
@@ -3,7 +3,7 @@ import type { ExponentialGraphState } from "../../types";
|
|
|
3
3
|
import type { PerseusStrings } from "@khanacademy/perseus/strings";
|
|
4
4
|
export declare function srExponentialPointLabel(state: {
|
|
5
5
|
pointIndex: number;
|
|
6
|
-
pointLabel: string |
|
|
6
|
+
pointLabel: string | undefined;
|
|
7
7
|
x: number;
|
|
8
8
|
y: number;
|
|
9
9
|
hasCurve: boolean;
|
|
@@ -4,8 +4,23 @@ import type { PerseusStrings } from "@khanacademy/perseus/strings";
|
|
|
4
4
|
export declare function srLinearSystemPointLabel(state: {
|
|
5
5
|
lineIndex: number;
|
|
6
6
|
pointIndex: number;
|
|
7
|
-
pointLabel: string |
|
|
7
|
+
pointLabel: string | undefined;
|
|
8
8
|
x: number;
|
|
9
9
|
y: number;
|
|
10
10
|
}, strings: PerseusStrings, locale: string): string;
|
|
11
|
-
|
|
11
|
+
interface LinearSystemLineDescription {
|
|
12
|
+
point1AriaLabel: string;
|
|
13
|
+
point2AriaLabel: string;
|
|
14
|
+
grabHandleAriaLabel: string;
|
|
15
|
+
pointsDescription: string;
|
|
16
|
+
interceptDescription: string;
|
|
17
|
+
slopeDescription: string;
|
|
18
|
+
}
|
|
19
|
+
interface LinearSystemGraphDescriptionStrings {
|
|
20
|
+
srLinearSystemGraph: string;
|
|
21
|
+
srLinearSystemInteractiveElements: string;
|
|
22
|
+
srIntersectionDescription: string;
|
|
23
|
+
srLines: ReadonlyArray<LinearSystemLineDescription>;
|
|
24
|
+
}
|
|
25
|
+
export declare function describeLinearSystemGraph(state: LinearSystemGraphState, i18n: I18nContextType): LinearSystemGraphDescriptionStrings;
|
|
26
|
+
export {};
|
|
@@ -3,7 +3,7 @@ import type { LogarithmGraphState } from "../../types";
|
|
|
3
3
|
import type { PerseusStrings } from "@khanacademy/perseus/strings";
|
|
4
4
|
export declare function srLogarithmPointLabel(state: {
|
|
5
5
|
pointIndex: number;
|
|
6
|
-
pointLabel: string |
|
|
6
|
+
pointLabel: string | undefined;
|
|
7
7
|
x: number;
|
|
8
8
|
y: number;
|
|
9
9
|
hasCurve: boolean;
|
|
@@ -4,7 +4,7 @@ import type { PerseusStrings } from "@khanacademy/perseus/strings";
|
|
|
4
4
|
import type { Coord } from "@khanacademy/perseus-core";
|
|
5
5
|
export declare function srQuadraticPointLabel(state: {
|
|
6
6
|
pointIndex: number;
|
|
7
|
-
pointLabel: string |
|
|
7
|
+
pointLabel: string | undefined;
|
|
8
8
|
x: number;
|
|
9
9
|
y: number;
|
|
10
10
|
vertex?: Coord;
|
|
@@ -3,7 +3,7 @@ import type { RayGraphState } from "../../types";
|
|
|
3
3
|
import type { PerseusStrings } from "@khanacademy/perseus/strings";
|
|
4
4
|
export declare function srRayPointLabel(state: {
|
|
5
5
|
pointIndex: number;
|
|
6
|
-
pointLabel: string |
|
|
6
|
+
pointLabel: string | undefined;
|
|
7
7
|
x: number;
|
|
8
8
|
y: number;
|
|
9
9
|
}, strings: PerseusStrings, locale: string): string;
|
|
@@ -4,9 +4,23 @@ import type { PerseusStrings } from "@khanacademy/perseus/strings";
|
|
|
4
4
|
export declare function srSegmentPointLabel(state: {
|
|
5
5
|
segmentIndex: number;
|
|
6
6
|
pointIndex: number;
|
|
7
|
-
pointLabel: string |
|
|
7
|
+
pointLabel: string | undefined;
|
|
8
8
|
totalSegments: number;
|
|
9
9
|
x: number;
|
|
10
10
|
y: number;
|
|
11
11
|
}, strings: PerseusStrings, locale: string): string;
|
|
12
|
-
|
|
12
|
+
interface SegmentDescription {
|
|
13
|
+
point1AriaLabel: string;
|
|
14
|
+
point2AriaLabel: string;
|
|
15
|
+
grabHandleAriaLabel: string;
|
|
16
|
+
individualAriaLabel: string;
|
|
17
|
+
lengthDescription: string;
|
|
18
|
+
}
|
|
19
|
+
interface SegmentGraphDescriptionStrings {
|
|
20
|
+
srSegmentGraph: string;
|
|
21
|
+
srSegmentInteractiveElements: string;
|
|
22
|
+
srWholeGraphDescription: string;
|
|
23
|
+
srSegments: ReadonlyArray<SegmentDescription>;
|
|
24
|
+
}
|
|
25
|
+
export declare function describeSegmentGraph(state: SegmentGraphState, i18n: I18nContextType): SegmentGraphDescriptionStrings;
|
|
26
|
+
export {};
|
|
@@ -3,7 +3,7 @@ import type { SinusoidGraphState } from "../../types";
|
|
|
3
3
|
import type { PerseusStrings } from "@khanacademy/perseus/strings";
|
|
4
4
|
export declare function srSinusoidPointLabel(state: {
|
|
5
5
|
pointIndex: number;
|
|
6
|
-
pointLabel: string |
|
|
6
|
+
pointLabel: string | undefined;
|
|
7
7
|
x: number;
|
|
8
8
|
y: number;
|
|
9
9
|
otherY: number;
|
|
@@ -3,7 +3,7 @@ import type { TangentGraphState } from "../../types";
|
|
|
3
3
|
import type { PerseusStrings } from "@khanacademy/perseus/strings";
|
|
4
4
|
export declare function srTangentPointLabel(state: {
|
|
5
5
|
pointIndex: number;
|
|
6
|
-
pointLabel: string |
|
|
6
|
+
pointLabel: string | undefined;
|
|
7
7
|
x: number;
|
|
8
8
|
y: number;
|
|
9
9
|
}, strings: PerseusStrings, locale: string): string;
|
|
@@ -11,7 +11,7 @@ type TangentGraphDescriptionStrings = {
|
|
|
11
11
|
srTangentGraph: string;
|
|
12
12
|
srTangentDescription: string;
|
|
13
13
|
srTangentInflectionPoint: string;
|
|
14
|
-
|
|
14
|
+
srTangentControlPoint: string;
|
|
15
15
|
srTangentInteractiveElements: string;
|
|
16
16
|
};
|
|
17
17
|
export declare function describeTangentGraph(state: TangentGraphState, i18n: I18nContextType): TangentGraphDescriptionStrings;
|
|
@@ -194,7 +194,7 @@ declare class InteractiveGraph extends React.Component<Props, State> {
|
|
|
194
194
|
isMobile?: boolean;
|
|
195
195
|
isMobileApp?: boolean;
|
|
196
196
|
hintProgressColor?: string;
|
|
197
|
-
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator"
|
|
197
|
+
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
|
|
198
198
|
}> & {
|
|
199
199
|
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
200
200
|
isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
|
|
@@ -1,7 +1,6 @@
|
|
|
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 { APIOptionsWithDefaults } from "../../types";
|
|
5
4
|
import "mafs/core.css";
|
|
6
5
|
import "./mafs-styles.css";
|
|
7
6
|
export type MafsGraphProps = {
|
|
@@ -26,6 +25,5 @@ export type MafsGraphProps = {
|
|
|
26
25
|
static: boolean | null | undefined;
|
|
27
26
|
widgetId: string;
|
|
28
27
|
ungradedDescriptionId?: string;
|
|
29
|
-
apiOptions?: APIOptionsWithDefaults;
|
|
30
28
|
};
|
|
31
29
|
export declare const MafsGraph: (props: MafsGraphProps) => React.JSX.Element;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { InteractiveGraphProps } from "./types";
|
|
3
|
-
import type { APIOptionsWithDefaults } from "../../types";
|
|
4
3
|
import type { PerseusGraphType, PerseusInteractiveGraphUserInput } from "@khanacademy/perseus-core";
|
|
5
4
|
export type StatefulMafsGraphProps = {
|
|
6
5
|
box: [number, number];
|
|
@@ -31,7 +30,6 @@ export type StatefulMafsGraphProps = {
|
|
|
31
30
|
widgetId: string;
|
|
32
31
|
graded?: boolean | null;
|
|
33
32
|
ungradedDescriptionId?: string;
|
|
34
|
-
apiOptions?: APIOptionsWithDefaults;
|
|
35
33
|
};
|
|
36
34
|
export type StatefulMafsGraphType = {
|
|
37
35
|
getUserInput: () => PerseusInteractiveGraphUserInput;
|
|
@@ -29,6 +29,7 @@ type MoveRadiusPointAnnouncement = {
|
|
|
29
29
|
y: number;
|
|
30
30
|
centerX: number;
|
|
31
31
|
radius: number;
|
|
32
|
+
pointLabel: string | undefined;
|
|
32
33
|
};
|
|
33
34
|
type MoveCenterAnnouncement = {
|
|
34
35
|
type: "move-center";
|
|
@@ -38,7 +39,7 @@ type MoveCenterAnnouncement = {
|
|
|
38
39
|
type MoveQuadraticPointAnnouncement = {
|
|
39
40
|
type: "move-quadratic-point";
|
|
40
41
|
pointIndex: number;
|
|
41
|
-
pointLabel: string |
|
|
42
|
+
pointLabel: string | undefined;
|
|
42
43
|
x: number;
|
|
43
44
|
y: number;
|
|
44
45
|
vertex: Coord | undefined;
|
|
@@ -53,7 +54,7 @@ type MoveSegmentPointAnnouncement = {
|
|
|
53
54
|
type: "move-segment-point";
|
|
54
55
|
segmentIndex: number;
|
|
55
56
|
pointIndex: number;
|
|
56
|
-
pointLabel: string |
|
|
57
|
+
pointLabel: string | undefined;
|
|
57
58
|
x: number;
|
|
58
59
|
y: number;
|
|
59
60
|
totalSegments: number;
|
|
@@ -66,14 +67,14 @@ type MoveLinearSystemPointAnnouncement = {
|
|
|
66
67
|
type: "move-linear-system-point";
|
|
67
68
|
lineIndex: number;
|
|
68
69
|
pointIndex: number;
|
|
69
|
-
pointLabel: string |
|
|
70
|
+
pointLabel: string | undefined;
|
|
70
71
|
x: number;
|
|
71
72
|
y: number;
|
|
72
73
|
};
|
|
73
74
|
type MoveRayPointAnnouncement = {
|
|
74
75
|
type: "move-ray-point";
|
|
75
76
|
pointIndex: number;
|
|
76
|
-
pointLabel: string |
|
|
77
|
+
pointLabel: string | undefined;
|
|
77
78
|
x: number;
|
|
78
79
|
y: number;
|
|
79
80
|
};
|
|
@@ -97,7 +98,7 @@ type MoveLinearLineAnnouncement = {
|
|
|
97
98
|
type MoveSinusoidPointAnnouncement = {
|
|
98
99
|
type: "move-sinusoid-point";
|
|
99
100
|
pointIndex: number;
|
|
100
|
-
pointLabel: string |
|
|
101
|
+
pointLabel: string | undefined;
|
|
101
102
|
x: number;
|
|
102
103
|
y: number;
|
|
103
104
|
otherY: number;
|
|
@@ -105,7 +106,7 @@ type MoveSinusoidPointAnnouncement = {
|
|
|
105
106
|
type MoveExponentialPointAnnouncement = {
|
|
106
107
|
type: "move-exponential-point";
|
|
107
108
|
pointIndex: number;
|
|
108
|
-
pointLabel: string |
|
|
109
|
+
pointLabel: string | undefined;
|
|
109
110
|
x: number;
|
|
110
111
|
y: number;
|
|
111
112
|
hasCurve: boolean;
|
|
@@ -113,7 +114,7 @@ type MoveExponentialPointAnnouncement = {
|
|
|
113
114
|
type MoveLogarithmPointAnnouncement = {
|
|
114
115
|
type: "move-logarithm-point";
|
|
115
116
|
pointIndex: number;
|
|
116
|
-
pointLabel: string |
|
|
117
|
+
pointLabel: string | undefined;
|
|
117
118
|
x: number;
|
|
118
119
|
y: number;
|
|
119
120
|
hasCurve: boolean;
|
|
@@ -125,7 +126,7 @@ type MoveExponentialAsymptoteAnnouncement = {
|
|
|
125
126
|
type MoveTangentPointAnnouncement = {
|
|
126
127
|
type: "move-tangent-point";
|
|
127
128
|
pointIndex: number;
|
|
128
|
-
pointLabel: string |
|
|
129
|
+
pointLabel: string | undefined;
|
|
129
130
|
x: number;
|
|
130
131
|
y: number;
|
|
131
132
|
};
|
|
@@ -136,7 +137,7 @@ type MoveLogarithmAsymptoteAnnouncement = {
|
|
|
136
137
|
type MoveAbsoluteValuePointAnnouncement = {
|
|
137
138
|
type: "move-absolute-value-point";
|
|
138
139
|
pointIndex: number;
|
|
139
|
-
pointLabel: string |
|
|
140
|
+
pointLabel: string | undefined;
|
|
140
141
|
x: number;
|
|
141
142
|
y: number;
|
|
142
143
|
slope: number;
|
|
@@ -144,7 +145,7 @@ type MoveAbsoluteValuePointAnnouncement = {
|
|
|
144
145
|
type MoveAnglePointAnnouncement = {
|
|
145
146
|
type: "move-angle-point";
|
|
146
147
|
pointIndex: number;
|
|
147
|
-
pointLabel: string |
|
|
148
|
+
pointLabel: string | undefined;
|
|
148
149
|
x: number;
|
|
149
150
|
y: number;
|
|
150
151
|
angleMeasure: number;
|
|
@@ -146,7 +146,7 @@ declare const _default: {
|
|
|
146
146
|
isMobile?: boolean;
|
|
147
147
|
isMobileApp?: boolean;
|
|
148
148
|
hintProgressColor?: string;
|
|
149
|
-
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator"
|
|
149
|
+
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
|
|
150
150
|
}> & {
|
|
151
151
|
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
152
152
|
isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
|
|
@@ -6,22 +6,8 @@ type Props = WidgetProps<PerseusMeasurerWidgetOptions> & {
|
|
|
6
6
|
protractorX: number;
|
|
7
7
|
protractorY: number;
|
|
8
8
|
};
|
|
9
|
-
type DefaultProps = {
|
|
10
|
-
box: Props["box"];
|
|
11
|
-
image: Props["image"];
|
|
12
|
-
showProtractor: Props["showProtractor"];
|
|
13
|
-
protractorX: Props["protractorX"];
|
|
14
|
-
protractorY: Props["protractorY"];
|
|
15
|
-
showRuler: Props["showRuler"];
|
|
16
|
-
rulerLabel: Props["rulerLabel"];
|
|
17
|
-
rulerTicks: Props["rulerTicks"];
|
|
18
|
-
rulerPixels: Props["rulerPixels"];
|
|
19
|
-
rulerLength: Props["rulerLength"];
|
|
20
|
-
};
|
|
21
9
|
declare class Measurer extends React.Component<Props> implements Widget {
|
|
22
|
-
static defaultProps: DefaultProps;
|
|
23
10
|
isWidget: true;
|
|
24
|
-
state: {};
|
|
25
11
|
ruler: any;
|
|
26
12
|
protractor: any;
|
|
27
13
|
componentDidMount(): void;
|
|
@@ -70,7 +70,7 @@ declare class MockWidgetComponent extends React.Component<Props> implements Widg
|
|
|
70
70
|
isMobile?: boolean;
|
|
71
71
|
isMobileApp?: boolean;
|
|
72
72
|
hintProgressColor?: string;
|
|
73
|
-
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator"
|
|
73
|
+
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
|
|
74
74
|
}> & {
|
|
75
75
|
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
76
76
|
isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
|
|
@@ -78,7 +78,7 @@ export declare class NumericInput extends React.Component<NumericInputProps> imp
|
|
|
78
78
|
isMobile?: boolean;
|
|
79
79
|
isMobileApp?: boolean;
|
|
80
80
|
hintProgressColor?: string;
|
|
81
|
-
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator"
|
|
81
|
+
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
|
|
82
82
|
}> & {
|
|
83
83
|
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
84
84
|
isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
|
|
@@ -40,7 +40,7 @@ export declare const NumericInputComponent: React.ForwardRefExoticComponent<impo
|
|
|
40
40
|
isMobile?: boolean;
|
|
41
41
|
isMobileApp?: boolean;
|
|
42
42
|
hintProgressColor?: string;
|
|
43
|
-
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator"
|
|
43
|
+
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
|
|
44
44
|
}> & {
|
|
45
45
|
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
46
46
|
isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
|
|
@@ -91,7 +91,7 @@ export declare const NumericInputComponent: React.ForwardRefExoticComponent<impo
|
|
|
91
91
|
isMobile?: boolean;
|
|
92
92
|
isMobileApp?: boolean;
|
|
93
93
|
hintProgressColor?: string;
|
|
94
|
-
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator"
|
|
94
|
+
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
|
|
95
95
|
}> & {
|
|
96
96
|
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
97
97
|
isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
|
|
@@ -2,8 +2,6 @@ import { type PerseusPlotterUserInput, type PerseusPlotterWidgetOptions, type Pl
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import type { PerseusDependenciesV2, WidgetProps } from "../../types";
|
|
4
4
|
type Props = WidgetProps<PlotterPublicWidgetOptions, PerseusPlotterUserInput> & {
|
|
5
|
-
labelInterval: NonNullable<PerseusPlotterWidgetOptions["labelInterval"]>;
|
|
6
|
-
picSize: NonNullable<PerseusPlotterWidgetOptions["picSize"]>;
|
|
7
5
|
dependencies: PerseusDependenciesV2;
|
|
8
6
|
};
|
|
9
7
|
declare function getStartUserInput(options: PlotterPublicWidgetOptions): PerseusPlotterUserInput;
|
|
@@ -78,7 +78,7 @@ declare class Table extends React.Component<Props> implements Widget {
|
|
|
78
78
|
isMobile?: boolean;
|
|
79
79
|
isMobileApp?: boolean;
|
|
80
80
|
hintProgressColor?: string;
|
|
81
|
-
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator"
|
|
81
|
+
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
|
|
82
82
|
}> & {
|
|
83
83
|
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
84
84
|
isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
|
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": "82.0.0",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
"tiny-invariant": "1.3.1",
|
|
44
44
|
"uuid": "^10.0.0",
|
|
45
45
|
"@khanacademy/kas": "2.2.3",
|
|
46
|
-
"@khanacademy/keypad-context": "3.2.
|
|
47
|
-
"@khanacademy/kmath": "2.4.
|
|
48
|
-
"@khanacademy/math-input": "26.6.
|
|
49
|
-
"@khanacademy/perseus-core": "
|
|
50
|
-
"@khanacademy/perseus-linter": "5.1.
|
|
51
|
-
"@khanacademy/perseus-score": "8.12.
|
|
46
|
+
"@khanacademy/keypad-context": "3.2.76",
|
|
47
|
+
"@khanacademy/kmath": "2.4.35",
|
|
48
|
+
"@khanacademy/math-input": "26.6.5",
|
|
49
|
+
"@khanacademy/perseus-core": "33.0.0",
|
|
50
|
+
"@khanacademy/perseus-linter": "5.1.16",
|
|
51
|
+
"@khanacademy/perseus-score": "8.12.8",
|
|
52
52
|
"@khanacademy/perseus-utils": "2.1.5",
|
|
53
53
|
"@khanacademy/pure-markdown": "2.3.1",
|
|
54
54
|
"@khanacademy/simple-markdown": "3.0.0"
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { PerseusStrings } from "@khanacademy/perseus/strings";
|
|
2
|
-
/**
|
|
3
|
-
* Resolves the x/y formatting and the "custom author label overrides the
|
|
4
|
-
* semantic label" fallback shared by every live point builder and by
|
|
5
|
-
* build-point-aria-label.
|
|
6
|
-
*
|
|
7
|
-
* Returns the locale-formatted `x`/`y` strings, plus a `customLabel`: the
|
|
8
|
-
* `srPointAtCoordinates` string when the author set a custom (string) label,
|
|
9
|
-
* otherwise `undefined` so the caller applies its own semantic label.
|
|
10
|
-
*
|
|
11
|
-
* TODO(LEMS-4206): Once we update the translation keys to allow custom labels
|
|
12
|
-
* we can remove the customLabel fallback in favor of the per-graph logic.
|
|
13
|
-
*/
|
|
14
|
-
export declare function withCustomPointLabel(state: {
|
|
15
|
-
pointLabel: string | number;
|
|
16
|
-
x: number;
|
|
17
|
-
y: number;
|
|
18
|
-
}, strings: PerseusStrings, locale: string): {
|
|
19
|
-
x: string;
|
|
20
|
-
y: string;
|
|
21
|
-
customLabel: string | undefined;
|
|
22
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./molecule";
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A molecule layout engine.
|
|
3
|
-
*
|
|
4
|
-
* This module transforms the SMILES syntax tree into a set of rendering
|
|
5
|
-
* instructions. A rendering instruction is an object indicating what type of
|
|
6
|
-
* thing to render (e.g. text or line), where to render it, and any other style
|
|
7
|
-
* properties needed.
|
|
8
|
-
*
|
|
9
|
-
* For instance, an oxygen atom might be rendered as
|
|
10
|
-
* {type: "text", value: "O", pos: [0, 0], idx: "1,0"}
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* Compute the layout for a single atom.
|
|
14
|
-
*
|
|
15
|
-
* Args:
|
|
16
|
-
* atom: the atom node for which layout is being created, as returned from
|
|
17
|
-
* convertTree; the computed position of this atom is added to this
|
|
18
|
-
* object in place, in addition to being returned in the layout
|
|
19
|
-
* instruction.
|
|
20
|
-
* atoms: the list of all atoms, as returned from convertTree, used to
|
|
21
|
-
* position this atom appropriately relative to its neighbors
|
|
22
|
-
* bonds: the list of all bonds, as returned from convertTree, used to
|
|
23
|
-
* determine the geometry based on bond type
|
|
24
|
-
* rotationAngle: a constant rotation for the whole molecule (in degrees)
|
|
25
|
-
*
|
|
26
|
-
* Return:
|
|
27
|
-
* a rendering instruction for the atom, containing a type (text), the text
|
|
28
|
-
* to render, the position, and the atom index
|
|
29
|
-
*/
|
|
30
|
-
declare function atomLayout(atom: any, atoms: any, bonds: ReadonlyArray<any>, rotationAngle: number): any;
|
|
31
|
-
/**
|
|
32
|
-
* Compute the layout for a bond between two atoms.
|
|
33
|
-
*
|
|
34
|
-
* Args:
|
|
35
|
-
* bond: the bond node for which the layout is being computed, as returned
|
|
36
|
-
* by convertTree
|
|
37
|
-
* atoms: the list of all atoms returned by convertTree, which should
|
|
38
|
-
* already have been processed for layout and thus have positions set
|
|
39
|
-
*
|
|
40
|
-
* Return:
|
|
41
|
-
* a rendering instruction for the bond containing a type
|
|
42
|
-
* (line:{single,double,triple}) and the line's endpoints
|
|
43
|
-
*/
|
|
44
|
-
declare function bondLayout(bond: any, atoms: any): any;
|
|
45
|
-
/**
|
|
46
|
-
* Convert the parse tree output by the parser into an ordered list of atoms
|
|
47
|
-
* and bonds to render.
|
|
48
|
-
*
|
|
49
|
-
* Args:
|
|
50
|
-
* atoms: the output list of atoms that we're in the process of building.
|
|
51
|
-
* This should be the empty list if not being called recursively.
|
|
52
|
-
* bonds: the output list of bonds that we're in the process of building.
|
|
53
|
-
* This should be the empty list if not being called recursively.
|
|
54
|
-
* tree: the parse tree generated by the SMILES parser module.
|
|
55
|
-
*
|
|
56
|
-
* Return:
|
|
57
|
-
* the final value of atoms and bonds, which are lists of all the atom
|
|
58
|
-
* nodes and bond nodes, respectively, that need to be rendered.
|
|
59
|
-
*/
|
|
60
|
-
declare function convertTree(atoms: any, bonds: any, tree: any): [any, any];
|
|
61
|
-
/**
|
|
62
|
-
* Compute an array of rendering instructions from the parse tree of a molecule.
|
|
63
|
-
*
|
|
64
|
-
* Args:
|
|
65
|
-
* tree: the parse tree as returned by the SMILES parser module
|
|
66
|
-
* rotationAngle: a global rotation (in degrees) to be applied to the whole
|
|
67
|
-
* molecule; this is manually adjustable in the widget.
|
|
68
|
-
*
|
|
69
|
-
* Return:
|
|
70
|
-
* an array of rendering instructions for all the atoms and bonds in the
|
|
71
|
-
* molecule suitable for processing by the renderer
|
|
72
|
-
*/
|
|
73
|
-
declare function layout(tree: any, rotationAngle: any): any;
|
|
74
|
-
declare const _default: {
|
|
75
|
-
layout: typeof layout;
|
|
76
|
-
_atomLayout: typeof atomLayout;
|
|
77
|
-
_bondLayout: typeof bondLayout;
|
|
78
|
-
_bondLength: number;
|
|
79
|
-
_convertTree: typeof convertTree;
|
|
80
|
-
};
|
|
81
|
-
export default _default;
|