@khanacademy/perseus 79.1.2 → 80.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 -51
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +90 -50
- package/dist/index.js.map +1 -1
- package/dist/util/css-zoom-utils.d.ts +20 -0
- package/dist/widgets/image/components/image-info-area.d.ts +1 -0
- package/dist/widgets/interactive-graphs/backgrounds/graph-border.d.ts +17 -0
- package/dist/widgets/interactive-graphs/graphs/absolute-value.d.ts +0 -10
- package/dist/widgets/interactive-graphs/graphs/circle.d.ts +0 -1
- package/dist/widgets/interactive-graphs/graphs/linear-system.d.ts +0 -1
- package/dist/widgets/interactive-graphs/graphs/linear.d.ts +0 -1
- package/dist/widgets/interactive-graphs/graphs/point.d.ts +0 -5
- package/dist/widgets/interactive-graphs/graphs/quadratic.d.ts +0 -12
- package/dist/widgets/interactive-graphs/graphs/ray.d.ts +0 -1
- package/dist/widgets/interactive-graphs/graphs/segment.d.ts +0 -1
- package/dist/widgets/interactive-graphs/graphs/strings/absolute-value.d.ts +19 -0
- package/dist/widgets/interactive-graphs/graphs/strings/angle.d.ts +19 -0
- package/dist/widgets/interactive-graphs/graphs/strings/announcement.d.ts +3 -0
- package/dist/widgets/interactive-graphs/graphs/strings/circle.d.ts +15 -0
- package/dist/widgets/interactive-graphs/graphs/strings/coord-quadrant.d.ts +7 -0
- package/dist/widgets/interactive-graphs/graphs/strings/custom-point-label.d.ts +22 -0
- package/dist/widgets/interactive-graphs/graphs/strings/exponential.d.ts +20 -0
- package/dist/widgets/interactive-graphs/graphs/strings/format-number.d.ts +2 -0
- package/dist/widgets/interactive-graphs/graphs/strings/linear-system.d.ts +11 -0
- package/dist/widgets/interactive-graphs/graphs/strings/linear.d.ts +12 -0
- package/dist/widgets/interactive-graphs/graphs/strings/logarithm.d.ts +20 -0
- package/dist/widgets/interactive-graphs/graphs/strings/point.d.ts +6 -0
- package/dist/widgets/interactive-graphs/graphs/strings/polygon.d.ts +13 -0
- package/dist/widgets/interactive-graphs/graphs/strings/quadratic.d.ts +21 -0
- package/dist/widgets/interactive-graphs/graphs/strings/ray.d.ts +19 -0
- package/dist/widgets/interactive-graphs/graphs/strings/segment.d.ts +12 -0
- package/dist/widgets/interactive-graphs/graphs/strings/sinusoid.d.ts +19 -0
- package/dist/widgets/interactive-graphs/graphs/strings/tangent.d.ts +18 -0
- package/dist/widgets/interactive-graphs/graphs/strings/vector.d.ts +18 -0
- package/dist/widgets/interactive-graphs/graphs/utils.d.ts +13 -1
- package/dist/widgets/interactive-graphs/graphs/vector.d.ts +0 -1
- package/dist/widgets/interactive-graphs/utils.d.ts +0 -18
- package/package.json +44 -44
- package/dist/widgets/interactive-graphs/graphs/screenreader-text.d.ts +0 -13
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets the effective CSS zoom factor applied to an element or any of its ancestors.
|
|
3
|
+
* This is used to compensate for the mobile font scaling zoom applied to the body
|
|
4
|
+
* or exercise content via the fontScale query parameter.
|
|
5
|
+
*
|
|
6
|
+
* On mobile, the parent application may apply CSS zoom to accommodate device font
|
|
7
|
+
* size settings. This zoom affects coordinate calculations for click/touch events,
|
|
8
|
+
* as both clientX/clientY and getBoundingClientRect() return zoomed values, but
|
|
9
|
+
* the SVG coordinate system expects unzoomed pixel values. It also shrinks the
|
|
10
|
+
* widths reported by offsetWidth for viewport-constrained containers, which
|
|
11
|
+
* fit-to-width logic (e.g. Zoomable) must account for.
|
|
12
|
+
*
|
|
13
|
+
* Note: We calculate the cumulative zoom by traversing the DOM tree rather than
|
|
14
|
+
* targeting specific elements to avoid coupling Perseus to parent application
|
|
15
|
+
* implementation details (e.g., specific class names or DOM hierarchy).
|
|
16
|
+
*
|
|
17
|
+
* @param element - The DOM element to check for CSS zoom
|
|
18
|
+
* @returns The cumulative zoom factor (e.g., 1.5 for 150% zoom, 1.0 for no zoom)
|
|
19
|
+
*/
|
|
20
|
+
export declare function getCSSZoomFactor(element: Element): number;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { GraphRange, MarkingsType } from "@khanacademy/perseus-core";
|
|
3
|
+
interface Props {
|
|
4
|
+
range: GraphRange;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
markings: MarkingsType;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Draws a 1px border at the exact graph bounds to match the design.
|
|
11
|
+
*
|
|
12
|
+
* A dedicated rect is needed because the old frame (the outermost grid line)
|
|
13
|
+
* is clipped to the bounds, losing the outer half of its stroke (~0.5px). Kept
|
|
14
|
+
* on top of the grid so the full stroke renders crisply.
|
|
15
|
+
*/
|
|
16
|
+
export declare const GraphBorder: ({ range, width, height, markings }: Props) => React.JSX.Element | null;
|
|
17
|
+
export {};
|
|
@@ -3,16 +3,6 @@ import { type I18nContextType } from "../../../components/i18n-context";
|
|
|
3
3
|
import type { AbsoluteValueGraphState, Dispatch, InteractiveGraphElementSuite } from "../types";
|
|
4
4
|
import type { Coord } from "@khanacademy/perseus-core";
|
|
5
5
|
export declare function renderAbsoluteValueGraph(state: AbsoluteValueGraphState, dispatch: Dispatch, i18n: I18nContextType): InteractiveGraphElementSuite;
|
|
6
|
-
export type AbsoluteValueCoefficients = {
|
|
7
|
-
m: number;
|
|
8
|
-
h: number;
|
|
9
|
-
v: number;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Compute the coefficients [m, h, v] for f(x) = m * |x - h| + v from two
|
|
13
|
-
* control points: p1 (vertex) and p2 (a point on one arm).
|
|
14
|
-
*/
|
|
15
|
-
export declare function getAbsoluteValueCoefficients(coords: ReadonlyArray<Coord>): AbsoluteValueCoefficients;
|
|
16
6
|
/**
|
|
17
7
|
* Keyboard constraint for absolute value control points.
|
|
18
8
|
* Skips any horizontal position where both points would share the same x.
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import type { I18nContextType } from "../../../components/i18n-context";
|
|
2
2
|
import type { LinearSystemGraphState, Dispatch, InteractiveGraphElementSuite } from "../types";
|
|
3
3
|
export declare function renderLinearSystemGraph(state: LinearSystemGraphState, dispatch: Dispatch, i18n: I18nContextType): InteractiveGraphElementSuite;
|
|
4
|
-
export declare function getLinearSystemGraphDescription(state: LinearSystemGraphState, i18n: I18nContextType): string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import type { I18nContextType } from "../../../components/i18n-context";
|
|
2
2
|
import type { LinearGraphState, Dispatch, InteractiveGraphElementSuite } from "../types";
|
|
3
3
|
export declare function renderLinearGraph(state: LinearGraphState, dispatch: Dispatch, i18n: I18nContextType): InteractiveGraphElementSuite;
|
|
4
|
-
export declare function describeLinearGraph(state: LinearGraphState, i18n: I18nContextType): Record<string, string>;
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import type { I18nContextType } from "../../../components/i18n-context";
|
|
2
|
-
import type { PerseusStrings } from "../../../strings";
|
|
3
2
|
import type { PointGraphState, Dispatch, InteractiveGraphElementSuite } from "../types";
|
|
4
3
|
export declare function renderPointGraph(state: PointGraphState, dispatch: Dispatch, i18n: I18nContextType): InteractiveGraphElementSuite;
|
|
5
|
-
export declare function getPointGraphDescription(state: PointGraphState, i18n: {
|
|
6
|
-
strings: PerseusStrings;
|
|
7
|
-
locale: string;
|
|
8
|
-
}): string;
|
|
@@ -2,22 +2,10 @@ import { vec } from "mafs";
|
|
|
2
2
|
import type { I18nContextType } from "../../../components/i18n-context";
|
|
3
3
|
import type { Coord } from "../../../interactive2/types";
|
|
4
4
|
import type { QuadraticGraphState, Dispatch, InteractiveGraphElementSuite } from "../types";
|
|
5
|
-
import type { QuadraticCoefficient, QuadraticCoords } from "@khanacademy/kmath";
|
|
6
5
|
export declare function renderQuadraticGraph(state: QuadraticGraphState, dispatch: Dispatch, i18n: I18nContextType): InteractiveGraphElementSuite;
|
|
7
|
-
export declare const getQuadraticCoefficients: (coords: QuadraticCoords) => QuadraticCoefficient | undefined;
|
|
8
|
-
type QuadraticGraphDescriptionStrings = {
|
|
9
|
-
srQuadraticGraph: string;
|
|
10
|
-
srQuadraticDirection?: string;
|
|
11
|
-
srQuadraticVertex?: string;
|
|
12
|
-
srQuadraticXIntercepts?: string;
|
|
13
|
-
srQuadraticYIntercept: string;
|
|
14
|
-
srQuadraticInteractiveElements: string;
|
|
15
|
-
};
|
|
16
|
-
export declare function describeQuadraticGraph(state: QuadraticGraphState, i18n: I18nContextType): QuadraticGraphDescriptionStrings;
|
|
17
6
|
export declare const getQuadraticKeyboardConstraint: (coords: ReadonlyArray<Coord>, snapStep: vec.Vector2, pointMoved: number) => {
|
|
18
7
|
up: vec.Vector2;
|
|
19
8
|
down: vec.Vector2;
|
|
20
9
|
left: vec.Vector2;
|
|
21
10
|
right: vec.Vector2;
|
|
22
11
|
};
|
|
23
|
-
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import type { I18nContextType } from "../../../components/i18n-context";
|
|
2
2
|
import type { Dispatch, InteractiveGraphElementSuite, RayGraphState } from "../types";
|
|
3
3
|
export declare function renderRayGraph(state: RayGraphState, dispatch: Dispatch, i18n: I18nContextType): InteractiveGraphElementSuite;
|
|
4
|
-
export declare function describeRayGraph(state: RayGraphState, i18n: I18nContextType): Record<string, string>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import type { I18nContextType } from "../../../components/i18n-context";
|
|
2
2
|
import type { Dispatch, InteractiveGraphElementSuite, SegmentGraphState } from "../types";
|
|
3
3
|
export declare function renderSegmentGraph(state: SegmentGraphState, dispatch: Dispatch, i18n: I18nContextType): InteractiveGraphElementSuite;
|
|
4
|
-
export declare function getSegmentGraphDescription(state: SegmentGraphState, i18n: I18nContextType): string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { I18nContextType } from "../../../../components/i18n-context";
|
|
2
|
+
import type { AbsoluteValueGraphState } from "../../types";
|
|
3
|
+
import type { PerseusStrings } from "@khanacademy/perseus/strings";
|
|
4
|
+
export declare function srAbsoluteValuePointLabel(state: {
|
|
5
|
+
pointIndex: number;
|
|
6
|
+
pointLabel: string | number;
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
slope: number;
|
|
10
|
+
}, strings: PerseusStrings, locale: string): string;
|
|
11
|
+
type AbsoluteValueGraphDescriptionStrings = {
|
|
12
|
+
srAbsoluteValueGraph: string;
|
|
13
|
+
srAbsoluteValueVertexPoint: string;
|
|
14
|
+
srAbsoluteValueSecondPoint: string;
|
|
15
|
+
srAbsoluteValueDescription: string;
|
|
16
|
+
srAbsoluteValueSlope: string;
|
|
17
|
+
};
|
|
18
|
+
export declare function describeAbsoluteValueGraph(state: AbsoluteValueGraphState, i18n: I18nContextType): AbsoluteValueGraphDescriptionStrings;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { I18nContextType } from "../../../../components/i18n-context";
|
|
2
|
+
import type { AngleGraphState } from "../../types";
|
|
3
|
+
import type { PerseusStrings } from "@khanacademy/perseus/strings";
|
|
4
|
+
export declare function srAnglePointLabel(state: {
|
|
5
|
+
pointIndex: number;
|
|
6
|
+
pointLabel: string | number;
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
angleMeasure: number;
|
|
10
|
+
}, strings: PerseusStrings, locale: string): string;
|
|
11
|
+
type AngleGraphDescriptionStrings = {
|
|
12
|
+
srAngleGraphAriaLabel: string;
|
|
13
|
+
srAngleGraphAriaDescription: string;
|
|
14
|
+
srAngleStartingSide: string;
|
|
15
|
+
srAngleEndingSide: string;
|
|
16
|
+
srAngleVertex: string;
|
|
17
|
+
};
|
|
18
|
+
export declare function describeAngleGraph(state: AngleGraphState, i18n: I18nContextType): AngleGraphDescriptionStrings;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { InteractiveGraphStateAnnouncement } from "../../types";
|
|
2
|
+
import type { PerseusStrings } from "@khanacademy/perseus/strings";
|
|
3
|
+
export declare function getAnnouncementText(state: InteractiveGraphStateAnnouncement, strings: PerseusStrings, locale: string): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { I18nContextType } from "../../../../components/i18n-context";
|
|
2
|
+
import type { CircleGraphState } from "../../types";
|
|
3
|
+
import type { PerseusStrings } from "@khanacademy/perseus/strings";
|
|
4
|
+
export declare function srCircleRadiusPointLabel(x: number, y: number, centerX: number, strings: PerseusStrings, locale: string): string;
|
|
5
|
+
export declare function srCircleCenterLabel(x: number, y: number, strings: PerseusStrings, locale: string): string;
|
|
6
|
+
type CircleGraphDescriptionStrings = {
|
|
7
|
+
srCircleGraph: string;
|
|
8
|
+
srCircleShape: string;
|
|
9
|
+
srCircleRadiusPoint: string;
|
|
10
|
+
srCircleRadius: string;
|
|
11
|
+
srCircleOuterPoints: string;
|
|
12
|
+
srCircleInteractiveElement: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function describeCircleGraph(state: CircleGraphState, i18n: I18nContextType): CircleGraphDescriptionStrings;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PerseusStrings } from "@khanacademy/perseus/strings";
|
|
2
|
+
import type { Coord } from "@khanacademy/perseus-core";
|
|
3
|
+
type GraphLocations = "origin" | "x-axis" | "y-axis" | 1 | 2 | 3 | 4;
|
|
4
|
+
export declare function getCoordQuadrant(coord: Coord): GraphLocations;
|
|
5
|
+
export declare function getQuadraticVertexString(vertex: Coord, strings: PerseusStrings): string;
|
|
6
|
+
export declare function getQuadraticPointString(pointNumber: any, coord: Coord, strings: PerseusStrings, locale: string): string;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { I18nContextType } from "../../../../components/i18n-context";
|
|
2
|
+
import type { ExponentialGraphState } from "../../types";
|
|
3
|
+
import type { PerseusStrings } from "@khanacademy/perseus/strings";
|
|
4
|
+
export declare function srExponentialPointLabel(state: {
|
|
5
|
+
pointIndex: number;
|
|
6
|
+
pointLabel: string | number;
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
hasCurve: boolean;
|
|
10
|
+
}, strings: PerseusStrings, locale: string): string;
|
|
11
|
+
type ExponentialGraphDescriptionStrings = {
|
|
12
|
+
srExponentialGraph: string;
|
|
13
|
+
srExponentialDescription: string;
|
|
14
|
+
srExponentialAsymptote: string;
|
|
15
|
+
srExponentialPoint1: string;
|
|
16
|
+
srExponentialPoint2: string;
|
|
17
|
+
srExponentialInteractiveElements: string;
|
|
18
|
+
};
|
|
19
|
+
export declare function describeExponentialGraph(state: ExponentialGraphState, i18n: I18nContextType): ExponentialGraphDescriptionStrings;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { I18nContextType } from "../../../../components/i18n-context";
|
|
2
|
+
import type { LinearSystemGraphState } from "../../types";
|
|
3
|
+
import type { PerseusStrings } from "@khanacademy/perseus/strings";
|
|
4
|
+
export declare function srLinearSystemPointLabel(state: {
|
|
5
|
+
lineIndex: number;
|
|
6
|
+
pointIndex: number;
|
|
7
|
+
pointLabel: string | number;
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
}, strings: PerseusStrings, locale: string): string;
|
|
11
|
+
export declare function describeLinearSystemGraph(state: LinearSystemGraphState, i18n: I18nContextType): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { I18nContextType } from "../../../../components/i18n-context";
|
|
2
|
+
import type { LinearGraphState } from "../../types";
|
|
3
|
+
type LinearGraphDescriptionStrings = {
|
|
4
|
+
srLinearGraph: string;
|
|
5
|
+
srLinearGraphPoints: string;
|
|
6
|
+
srLinearGrabHandle: string;
|
|
7
|
+
slopeString: string;
|
|
8
|
+
interceptString: string;
|
|
9
|
+
srLinearInteractiveElement: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function describeLinearGraph(state: LinearGraphState, i18n: I18nContextType): LinearGraphDescriptionStrings;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { I18nContextType } from "../../../../components/i18n-context";
|
|
2
|
+
import type { LogarithmGraphState } from "../../types";
|
|
3
|
+
import type { PerseusStrings } from "@khanacademy/perseus/strings";
|
|
4
|
+
export declare function srLogarithmPointLabel(state: {
|
|
5
|
+
pointIndex: number;
|
|
6
|
+
pointLabel: string | number;
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
hasCurve: boolean;
|
|
10
|
+
}, strings: PerseusStrings, locale: string): string;
|
|
11
|
+
type LogarithmGraphDescriptionStrings = {
|
|
12
|
+
srLogarithmGraph: string;
|
|
13
|
+
srLogarithmDescription: string;
|
|
14
|
+
srLogarithmAsymptote: string;
|
|
15
|
+
srLogarithmPoint1: string;
|
|
16
|
+
srLogarithmPoint2: string;
|
|
17
|
+
srLogarithmInteractiveElements: string;
|
|
18
|
+
};
|
|
19
|
+
export declare function describeLogarithmGraph(state: LogarithmGraphState, i18n: I18nContextType): LogarithmGraphDescriptionStrings;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { I18nContextType } from "../../../../components/i18n-context";
|
|
2
|
+
import type { InteractiveGraphProps, PolygonGraphState } from "../../types";
|
|
3
|
+
import type { PerseusStrings } from "@khanacademy/perseus/strings";
|
|
4
|
+
export declare function srPolygonLabel(coords: ReadonlyArray<readonly [number, number]>, pointLabels: ReadonlyArray<string> | undefined, strings: PerseusStrings, locale: string): string;
|
|
5
|
+
type PolygonGraphDescriptionStrings = {
|
|
6
|
+
srPolygonGraph: string;
|
|
7
|
+
srPolygonGraphPointsNum: string;
|
|
8
|
+
srPolygonGraphPoints?: string;
|
|
9
|
+
srPolygonElementsNum: string;
|
|
10
|
+
srPolygonInteractiveElements: string | null;
|
|
11
|
+
};
|
|
12
|
+
export declare function describePolygonGraph(state: PolygonGraphState, i18n: I18nContextType, markings: InteractiveGraphProps["markings"]): PolygonGraphDescriptionStrings;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { I18nContextType } from "../../../../components/i18n-context";
|
|
2
|
+
import type { QuadraticGraphState } from "../../types";
|
|
3
|
+
import type { PerseusStrings } from "@khanacademy/perseus/strings";
|
|
4
|
+
import type { Coord } from "@khanacademy/perseus-core";
|
|
5
|
+
export declare function srQuadraticPointLabel(state: {
|
|
6
|
+
pointIndex: number;
|
|
7
|
+
pointLabel: string | number;
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
vertex?: Coord;
|
|
11
|
+
}, strings: PerseusStrings, locale: string): string;
|
|
12
|
+
type QuadraticGraphDescriptionStrings = {
|
|
13
|
+
srQuadraticGraph: string;
|
|
14
|
+
srQuadraticDirection?: string;
|
|
15
|
+
srQuadraticVertex?: string;
|
|
16
|
+
srQuadraticXIntercepts?: string;
|
|
17
|
+
srQuadraticYIntercept: string;
|
|
18
|
+
srQuadraticInteractiveElements: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function describeQuadraticGraph(state: QuadraticGraphState, i18n: I18nContextType): QuadraticGraphDescriptionStrings;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { I18nContextType } from "../../../../components/i18n-context";
|
|
2
|
+
import type { RayGraphState } from "../../types";
|
|
3
|
+
import type { PerseusStrings } from "@khanacademy/perseus/strings";
|
|
4
|
+
export declare function srRayPointLabel(state: {
|
|
5
|
+
pointIndex: number;
|
|
6
|
+
pointLabel: string | number;
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
}, strings: PerseusStrings, locale: string): string;
|
|
10
|
+
type RayGraphDescriptionStrings = {
|
|
11
|
+
srRayGraph: string;
|
|
12
|
+
srRayPoints: string;
|
|
13
|
+
srRayEndpoint: string;
|
|
14
|
+
srRayTerminalPoint: string;
|
|
15
|
+
srRayGrabHandle: string;
|
|
16
|
+
srRayInteractiveElement: string;
|
|
17
|
+
};
|
|
18
|
+
export declare function describeRayGraph(state: RayGraphState, i18n: I18nContextType): RayGraphDescriptionStrings;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { I18nContextType } from "../../../../components/i18n-context";
|
|
2
|
+
import type { SegmentGraphState } from "../../types";
|
|
3
|
+
import type { PerseusStrings } from "@khanacademy/perseus/strings";
|
|
4
|
+
export declare function srSegmentPointLabel(state: {
|
|
5
|
+
segmentIndex: number;
|
|
6
|
+
pointIndex: number;
|
|
7
|
+
pointLabel: string | number;
|
|
8
|
+
totalSegments: number;
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
}, strings: PerseusStrings, locale: string): string;
|
|
12
|
+
export declare function describeSegmentGraph(state: SegmentGraphState, i18n: I18nContextType): string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { I18nContextType } from "../../../../components/i18n-context";
|
|
2
|
+
import type { SinusoidGraphState } from "../../types";
|
|
3
|
+
import type { PerseusStrings } from "@khanacademy/perseus/strings";
|
|
4
|
+
export declare function srSinusoidPointLabel(state: {
|
|
5
|
+
pointIndex: number;
|
|
6
|
+
pointLabel: string | number;
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
otherY: number;
|
|
10
|
+
}, strings: PerseusStrings, locale: string): string;
|
|
11
|
+
type SinusoidGraphDescriptionStrings = {
|
|
12
|
+
srSinusoidGraph: string;
|
|
13
|
+
srSinusoidDescription: string;
|
|
14
|
+
srSinusoidRootPoint: string;
|
|
15
|
+
srSinusoidPeakPoint: string;
|
|
16
|
+
srSinusoidInteractiveElements: string;
|
|
17
|
+
};
|
|
18
|
+
export declare function describeSinusoidGraph(state: SinusoidGraphState, i18n: I18nContextType): SinusoidGraphDescriptionStrings;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { I18nContextType } from "../../../../components/i18n-context";
|
|
2
|
+
import type { TangentGraphState } from "../../types";
|
|
3
|
+
import type { PerseusStrings } from "@khanacademy/perseus/strings";
|
|
4
|
+
export declare function srTangentPointLabel(state: {
|
|
5
|
+
pointIndex: number;
|
|
6
|
+
pointLabel: string | number;
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
}, strings: PerseusStrings, locale: string): string;
|
|
10
|
+
type TangentGraphDescriptionStrings = {
|
|
11
|
+
srTangentGraph: string;
|
|
12
|
+
srTangentDescription: string;
|
|
13
|
+
srTangentInflectionPoint: string;
|
|
14
|
+
srTangentSecondPoint: string;
|
|
15
|
+
srTangentInteractiveElements: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function describeTangentGraph(state: TangentGraphState, i18n: I18nContextType): TangentGraphDescriptionStrings;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { I18nContextType } from "../../../../components/i18n-context";
|
|
2
|
+
import type { VectorGraphState } from "../../types";
|
|
3
|
+
import type { PerseusStrings } from "@khanacademy/perseus/strings";
|
|
4
|
+
export declare function srVectorPointLabel(state: {
|
|
5
|
+
pointIndex: number;
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
}, strings: PerseusStrings, locale: string): string;
|
|
9
|
+
type VectorGraphDescriptionStrings = {
|
|
10
|
+
srVectorGraph: string;
|
|
11
|
+
srVectorPoints: string;
|
|
12
|
+
srVectorDescription: string;
|
|
13
|
+
srVectorHeadPoint: string;
|
|
14
|
+
srVectorGrabHandle: string;
|
|
15
|
+
srVectorInteractiveElement: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function describeVectorGraph(state: VectorGraphState, i18n: I18nContextType): VectorGraphDescriptionStrings;
|
|
18
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { vec } from "mafs";
|
|
2
2
|
import type { PerseusStrings } from "../../../strings";
|
|
3
3
|
import type { PairOfPoints } from "../types";
|
|
4
|
-
import type { QuadraticCoefficient } from "@khanacademy/kmath";
|
|
4
|
+
import type { QuadraticCoefficient, QuadraticCoords } from "@khanacademy/kmath";
|
|
5
5
|
import type { Coord } from "@khanacademy/perseus-core";
|
|
6
6
|
import type { Interval } from "mafs";
|
|
7
7
|
/**
|
|
@@ -75,3 +75,15 @@ export declare function getAsymptoteHandleCoord(orientation: "horizontal" | "ver
|
|
|
75
75
|
* a valid position (up to 3 attempts).
|
|
76
76
|
*/
|
|
77
77
|
export declare function skipAsymptoteKeyboardOverPoint(proposed: vec.Vector2, currentAsymptote: number, coords: ReadonlyArray<Coord>, handleCoord: vec.Vector2, snapStep: vec.Vector2, orientation: "horizontal" | "vertical"): vec.Vector2;
|
|
78
|
+
export declare const getQuadraticCoefficients: (coords: QuadraticCoords) => QuadraticCoefficient | undefined;
|
|
79
|
+
export declare function getLengthOfSegment(segment: PairOfPoints): number;
|
|
80
|
+
export type AbsoluteValueCoefficients = {
|
|
81
|
+
m: number;
|
|
82
|
+
h: number;
|
|
83
|
+
v: number;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Compute the coefficients [m, h, v] for f(x) = m * |x - h| + v from two
|
|
87
|
+
* control points: p1 (vertex) and p2 (a point on one arm).
|
|
88
|
+
*/
|
|
89
|
+
export declare function getAbsoluteValueCoefficients(coords: ReadonlyArray<Coord>): AbsoluteValueCoefficients;
|
|
@@ -42,21 +42,3 @@ export declare const calculateNestedSVGCoords: (range: vec.Vector2[], width: num
|
|
|
42
42
|
viewboxX: number;
|
|
43
43
|
viewboxY: number;
|
|
44
44
|
};
|
|
45
|
-
/**
|
|
46
|
-
* Gets the effective CSS zoom factor applied to an element or any of its ancestors.
|
|
47
|
-
* This is used to compensate for the mobile font scaling zoom applied to the body
|
|
48
|
-
* or exercise content via the fontScale query parameter.
|
|
49
|
-
*
|
|
50
|
-
* On mobile, the parent application may apply CSS zoom to accommodate device font
|
|
51
|
-
* size settings. This zoom affects coordinate calculations for click/touch events,
|
|
52
|
-
* as both clientX/clientY and getBoundingClientRect() return zoomed values, but
|
|
53
|
-
* the SVG coordinate system expects unzoomed pixel values.
|
|
54
|
-
*
|
|
55
|
-
* Note: We calculate the cumulative zoom by traversing the DOM tree rather than
|
|
56
|
-
* targeting specific elements to avoid coupling Perseus to parent application
|
|
57
|
-
* implementation details (e.g., specific class names or DOM hierarchy).
|
|
58
|
-
*
|
|
59
|
-
* @param element - The DOM element to check for CSS zoom
|
|
60
|
-
* @returns The cumulative zoom factor (e.g., 1.5 for 150% zoom, 1.0 for no zoom)
|
|
61
|
-
*/
|
|
62
|
-
export declare function getCSSZoomFactor(element: Element): number;
|
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": "80.0.0",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -43,39 +43,39 @@
|
|
|
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.
|
|
49
|
-
"@khanacademy/perseus-core": "
|
|
50
|
-
"@khanacademy/perseus-linter": "5.1.
|
|
51
|
-
"@khanacademy/perseus-score": "8.12.
|
|
46
|
+
"@khanacademy/keypad-context": "3.2.73",
|
|
47
|
+
"@khanacademy/kmath": "2.4.32",
|
|
48
|
+
"@khanacademy/math-input": "26.6.0",
|
|
49
|
+
"@khanacademy/perseus-core": "31.0.0",
|
|
50
|
+
"@khanacademy/perseus-linter": "5.1.13",
|
|
51
|
+
"@khanacademy/perseus-score": "8.12.5",
|
|
52
52
|
"@khanacademy/perseus-utils": "2.1.5",
|
|
53
53
|
"@khanacademy/pure-markdown": "2.3.0",
|
|
54
54
|
"@khanacademy/simple-markdown": "2.2.3"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@khanacademy/wonder-blocks-announcer": "1.1.1",
|
|
58
|
-
"@khanacademy/wonder-blocks-banner": "5.1.
|
|
59
|
-
"@khanacademy/wonder-blocks-button": "11.7.
|
|
60
|
-
"@khanacademy/wonder-blocks-clickable": "8.2.
|
|
58
|
+
"@khanacademy/wonder-blocks-banner": "5.1.8",
|
|
59
|
+
"@khanacademy/wonder-blocks-button": "11.7.4",
|
|
60
|
+
"@khanacademy/wonder-blocks-clickable": "8.2.6",
|
|
61
61
|
"@khanacademy/wonder-blocks-core": "12.4.4",
|
|
62
62
|
"@khanacademy/wonder-blocks-data": "15.0.2",
|
|
63
|
-
"@khanacademy/wonder-blocks-dropdown": "10.11.
|
|
64
|
-
"@khanacademy/wonder-blocks-form": "7.6.
|
|
65
|
-
"@khanacademy/wonder-blocks-icon": "5.3.
|
|
66
|
-
"@khanacademy/wonder-blocks-icon-button": "11.
|
|
67
|
-
"@khanacademy/wonder-blocks-labeled-field": "4.1.
|
|
68
|
-
"@khanacademy/wonder-blocks-layout": "3.1.
|
|
69
|
-
"@khanacademy/wonder-blocks-link": "10.3.
|
|
70
|
-
"@khanacademy/wonder-blocks-modal": "8.7.
|
|
71
|
-
"@khanacademy/wonder-blocks-pill": "3.1.
|
|
72
|
-
"@khanacademy/wonder-blocks-popover": "6.3.
|
|
73
|
-
"@khanacademy/wonder-blocks-progress-spinner": "3.1.
|
|
74
|
-
"@khanacademy/wonder-blocks-switch": "3.4.
|
|
63
|
+
"@khanacademy/wonder-blocks-dropdown": "10.11.5",
|
|
64
|
+
"@khanacademy/wonder-blocks-form": "7.6.7",
|
|
65
|
+
"@khanacademy/wonder-blocks-icon": "5.3.20",
|
|
66
|
+
"@khanacademy/wonder-blocks-icon-button": "11.4.2",
|
|
67
|
+
"@khanacademy/wonder-blocks-labeled-field": "4.1.6",
|
|
68
|
+
"@khanacademy/wonder-blocks-layout": "3.1.57",
|
|
69
|
+
"@khanacademy/wonder-blocks-link": "10.3.6",
|
|
70
|
+
"@khanacademy/wonder-blocks-modal": "8.7.8",
|
|
71
|
+
"@khanacademy/wonder-blocks-pill": "3.1.70",
|
|
72
|
+
"@khanacademy/wonder-blocks-popover": "6.3.8",
|
|
73
|
+
"@khanacademy/wonder-blocks-progress-spinner": "3.1.57",
|
|
74
|
+
"@khanacademy/wonder-blocks-switch": "3.4.6",
|
|
75
75
|
"@khanacademy/wonder-blocks-timing": "7.1.0",
|
|
76
|
-
"@khanacademy/wonder-blocks-tokens": "
|
|
77
|
-
"@khanacademy/wonder-blocks-tooltip": "4.1.
|
|
78
|
-
"@khanacademy/wonder-blocks-typography": "
|
|
76
|
+
"@khanacademy/wonder-blocks-tokens": "17.0.0",
|
|
77
|
+
"@khanacademy/wonder-blocks-tooltip": "4.1.83",
|
|
78
|
+
"@khanacademy/wonder-blocks-typography": "5.0.0",
|
|
79
79
|
"@khanacademy/wonder-stuff-core": "3.0.0",
|
|
80
80
|
"@phosphor-icons/core": "2.0.2",
|
|
81
81
|
"@popperjs/core": "2.10.2",
|
|
@@ -92,27 +92,27 @@
|
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
|
94
94
|
"@khanacademy/wonder-blocks-announcer": "^1.1.1",
|
|
95
|
-
"@khanacademy/wonder-blocks-banner": "^5.1.
|
|
96
|
-
"@khanacademy/wonder-blocks-button": "^11.7.
|
|
97
|
-
"@khanacademy/wonder-blocks-clickable": "^8.2.
|
|
95
|
+
"@khanacademy/wonder-blocks-banner": "^5.1.8",
|
|
96
|
+
"@khanacademy/wonder-blocks-button": "^11.7.4",
|
|
97
|
+
"@khanacademy/wonder-blocks-clickable": "^8.2.6",
|
|
98
98
|
"@khanacademy/wonder-blocks-core": "^12.4.4",
|
|
99
99
|
"@khanacademy/wonder-blocks-data": "^15.0.2",
|
|
100
|
-
"@khanacademy/wonder-blocks-dropdown": "^10.11.
|
|
101
|
-
"@khanacademy/wonder-blocks-form": "^7.6.
|
|
102
|
-
"@khanacademy/wonder-blocks-icon": "^5.3.
|
|
103
|
-
"@khanacademy/wonder-blocks-icon-button": "^11.
|
|
104
|
-
"@khanacademy/wonder-blocks-labeled-field": "^4.1.
|
|
105
|
-
"@khanacademy/wonder-blocks-layout": "^3.1.
|
|
106
|
-
"@khanacademy/wonder-blocks-link": "^10.3.
|
|
107
|
-
"@khanacademy/wonder-blocks-modal": "^8.7.
|
|
108
|
-
"@khanacademy/wonder-blocks-pill": "^3.1.
|
|
109
|
-
"@khanacademy/wonder-blocks-popover": "^6.3.
|
|
110
|
-
"@khanacademy/wonder-blocks-progress-spinner": "^3.1.
|
|
111
|
-
"@khanacademy/wonder-blocks-switch": "^3.4.
|
|
100
|
+
"@khanacademy/wonder-blocks-dropdown": "^10.11.5",
|
|
101
|
+
"@khanacademy/wonder-blocks-form": "^7.6.7",
|
|
102
|
+
"@khanacademy/wonder-blocks-icon": "^5.3.20",
|
|
103
|
+
"@khanacademy/wonder-blocks-icon-button": "^11.4.2",
|
|
104
|
+
"@khanacademy/wonder-blocks-labeled-field": "^4.1.6",
|
|
105
|
+
"@khanacademy/wonder-blocks-layout": "^3.1.57",
|
|
106
|
+
"@khanacademy/wonder-blocks-link": "^10.3.6",
|
|
107
|
+
"@khanacademy/wonder-blocks-modal": "^8.7.8",
|
|
108
|
+
"@khanacademy/wonder-blocks-pill": "^3.1.70",
|
|
109
|
+
"@khanacademy/wonder-blocks-popover": "^6.3.8",
|
|
110
|
+
"@khanacademy/wonder-blocks-progress-spinner": "^3.1.57",
|
|
111
|
+
"@khanacademy/wonder-blocks-switch": "^3.4.6",
|
|
112
112
|
"@khanacademy/wonder-blocks-timing": "^7.1.0",
|
|
113
|
-
"@khanacademy/wonder-blocks-tokens": "^
|
|
114
|
-
"@khanacademy/wonder-blocks-tooltip": "^4.1.
|
|
115
|
-
"@khanacademy/wonder-blocks-typography": "^
|
|
113
|
+
"@khanacademy/wonder-blocks-tokens": "^17.0.0",
|
|
114
|
+
"@khanacademy/wonder-blocks-tooltip": "^4.1.83",
|
|
115
|
+
"@khanacademy/wonder-blocks-typography": "^5.0.0",
|
|
116
116
|
"@khanacademy/wonder-stuff-core": "^3.0.0",
|
|
117
117
|
"@phosphor-icons/core": "^2.0.2",
|
|
118
118
|
"@popperjs/core": "^2.10.2",
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
},
|
|
128
128
|
"keywords": [],
|
|
129
129
|
"khan": {
|
|
130
|
-
"catalogHash": "
|
|
130
|
+
"catalogHash": "793079df3e67e001"
|
|
131
131
|
},
|
|
132
132
|
"scripts": {}
|
|
133
133
|
}
|