@khanacademy/perseus 77.2.2 → 77.3.2

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.
Files changed (34) hide show
  1. package/dist/es/index.css +5 -1
  2. package/dist/es/index.css.map +1 -1
  3. package/dist/es/index.js +63 -57
  4. package/dist/es/index.js.map +1 -1
  5. package/dist/es/strings.js +1 -1
  6. package/dist/es/strings.js.map +1 -1
  7. package/dist/index.css +5 -1
  8. package/dist/index.css.map +1 -1
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.js +47 -40
  11. package/dist/index.js.map +1 -1
  12. package/dist/strings.d.ts +35 -0
  13. package/dist/strings.js +1 -1
  14. package/dist/strings.js.map +1 -1
  15. package/dist/widget-ai-utils/interactive-graph/interactive-graph-ai-utils.d.ts +9 -2
  16. package/dist/widgets/free-response/free-response.d.ts +1 -1
  17. package/dist/widgets/image/components/explore-image-modal-content.d.ts +5 -2
  18. package/dist/widgets/interactive-graphs/backgrounds/utils.d.ts +8 -0
  19. package/dist/widgets/interactive-graphs/graphs/components/movable-arrowhead-view.d.ts +14 -0
  20. package/dist/widgets/interactive-graphs/graphs/components/movable-asymptote.d.ts +6 -0
  21. package/dist/widgets/interactive-graphs/graphs/components/movable-line.d.ts +1 -1
  22. package/dist/widgets/interactive-graphs/graphs/components/movable-pill-handle.d.ts +22 -0
  23. package/dist/widgets/interactive-graphs/graphs/components/use-control-arrowhead.d.ts +23 -0
  24. package/dist/widgets/interactive-graphs/graphs/exponential.d.ts +0 -1
  25. package/dist/widgets/interactive-graphs/graphs/logarithm.d.ts +0 -1
  26. package/dist/widgets/interactive-graphs/graphs/utils.d.ts +15 -7
  27. package/dist/widgets/interactive-graphs/graphs/vector.d.ts +11 -0
  28. package/dist/widgets/interactive-graphs/interactive-graph.d.ts +1 -0
  29. package/dist/widgets/interactive-graphs/reducer/initialize-graph-state.d.ts +2 -1
  30. package/dist/widgets/interactive-graphs/reducer/interactive-graph-action.d.ts +8 -4
  31. package/dist/widgets/interactive-graphs/types.d.ts +5 -1
  32. package/package.json +45 -45
  33. package/dist/widgets/interactive-graphs/graphs/components/asymptote-drag-handle.d.ts +0 -15
  34. package/dist/widgets/interactive-graphs/interactive-graph-question-builder.d.ts +0 -192
@@ -10,6 +10,14 @@ export declare const getLabelTransform: (labelLocation: GraphConfig["labelLocati
10
10
  yLabelTransform: string;
11
11
  };
12
12
  export declare const getLabelPosition: (graphInfo: GraphDimensions, labelLocation: GraphConfig["labelLocation"], tickStep: GraphConfig["tickStep"]) => vec.Vector2[];
13
+ /**
14
+ * Calculate the bottom margin needed for the graph container to prevent the
15
+ * x-axis label from overlapping with content below the graph.
16
+ *
17
+ * When the y-range starts at or above 0, the x-axis label can extend below
18
+ * the graph content area. This function calculates the extra margin needed.
19
+ */
20
+ export declare const getGraphBottomMargin: (xAxisLabelLocationY: number, graphHeight: number, hasXAxisLabel: boolean, showsAxisLabels: boolean) => number;
13
21
  export declare const shouldShowLabel: (currentTick: number, range: [Interval, Interval], tickStep: number) => boolean;
14
22
  export declare function generateTickLocations(tickStep: number, min: number, max: number, otherAxisMin: number): number[];
15
23
  export declare const countSignificantDecimals: (number: number) => number;
@@ -0,0 +1,14 @@
1
+ import * as React from "react";
2
+ import type { CSSCursor } from "./css-cursor";
3
+ import type { vec } from "mafs";
4
+ type Props = {
5
+ point: vec.Vector2;
6
+ angle: number;
7
+ dragging: boolean;
8
+ focused: boolean;
9
+ showFocusRing: boolean;
10
+ cursor?: CSSCursor | undefined;
11
+ onClick?: () => unknown;
12
+ };
13
+ export declare const MovableArrowheadView: React.ForwardRefExoticComponent<Props & React.RefAttributes<SVGGElement>>;
14
+ export {};
@@ -21,6 +21,12 @@ type Props = {
21
21
  orientation: "horizontal" | "vertical";
22
22
  /** Accessible label for the asymptote drag target. */
23
23
  ariaLabel: string;
24
+ /**
25
+ * Content rendered between the asymptote lines and the drag handle.
26
+ * Use this to render the curve so it appears above the dashed line
27
+ * but below the drag handle in the SVG stacking order.
28
+ */
29
+ children?: React.ReactNode;
24
30
  };
25
31
  export declare function MovableAsymptote(props: Props): React.JSX.Element;
26
32
  export {};
@@ -14,7 +14,7 @@ type Props = {
14
14
  end: boolean;
15
15
  };
16
16
  onMovePoint?: (endpointIndex: number, destination: vec.Vector2) => unknown;
17
- onMoveLine?: (delta: vec.Vector2) => unknown;
17
+ onMoveLine?: (newStart: vec.Vector2) => unknown;
18
18
  };
19
19
  export declare const MovableLine: (props: Props) => React.JSX.Element;
20
20
  export declare const getMovableLineKeyboardConstraint: (line: [vec.Vector2, vec.Vector2], snapStep: vec.Vector2, pointIndex: number) => {
@@ -0,0 +1,22 @@
1
+ import * as React from "react";
2
+ import type { vec } from "mafs";
3
+ type Props = {
4
+ /** Pixel-space center of the handle (already transformed from graph coordinates). */
5
+ center: vec.Vector2;
6
+ /** Whether the handle is in active state (shows grip dots, uses larger dimensions). */
7
+ active: boolean;
8
+ /** Whether the handle has keyboard focus (shows focus ring). */
9
+ focused: boolean;
10
+ /**
11
+ * Rotation angle in degrees. 0 = horizontal pill, 90 = vertical pill.
12
+ * Arbitrary angles are supported (e.g. for vector alignment).
13
+ * @default 0
14
+ */
15
+ rotation?: number;
16
+ };
17
+ /**
18
+ * Shared pill-shaped drag handle used by vector and asymptote graph elements.
19
+ * Renders a rounded-rectangle pill with a halo, ring, focus ring, and grip dots.
20
+ */
21
+ export declare function MovablePillHandle(props: Props): React.JSX.Element;
22
+ export {};
@@ -0,0 +1,23 @@
1
+ import * as React from "react";
2
+ import type { AriaLive } from "../../types";
3
+ import type { KeyboardMovementConstraint } from "../use-draggable";
4
+ import type { vec } from "mafs";
5
+ type Params = {
6
+ point: vec.Vector2;
7
+ angle: number;
8
+ ariaDescribedBy?: string;
9
+ ariaLabel?: string;
10
+ ariaLive?: AriaLive;
11
+ constrain?: KeyboardMovementConstraint;
12
+ sequenceNumber?: number;
13
+ onMove?: ((newPoint: vec.Vector2) => unknown) | undefined;
14
+ onDragEnd?: (() => unknown) | undefined;
15
+ };
16
+ type Return = {
17
+ focusableHandle: React.ReactNode;
18
+ visibleArrowhead: React.ReactNode;
19
+ dragging: boolean;
20
+ focused: boolean;
21
+ };
22
+ export declare function useControlArrowhead(params: Params): Return;
23
+ export {};
@@ -3,7 +3,6 @@ import type { ExponentialGraphState, Dispatch, InteractiveGraphElementSuite } fr
3
3
  import type { Coord } from "@khanacademy/perseus-core";
4
4
  import type { Interval, vec } from "mafs";
5
5
  export declare function renderExponentialGraph(state: ExponentialGraphState, dispatch: Dispatch, i18n: I18nContextType): InteractiveGraphElementSuite;
6
- export declare const constrainAsymptoteKeyboard: (p: vec.Vector2, coords: ReadonlyArray<Coord>, snapStep: vec.Vector2) => vec.Vector2;
7
6
  export declare const getExponentialKeyboardConstraint: (coords: ReadonlyArray<Coord>, asymptote: number, snapStep: vec.Vector2, pointIndex: number, range: [Interval, Interval]) => {
8
7
  up: vec.Vector2;
9
8
  down: vec.Vector2;
@@ -3,7 +3,6 @@ import type { LogarithmGraphState, Dispatch, InteractiveGraphElementSuite } from
3
3
  import type { Coord } from "@khanacademy/perseus-core";
4
4
  import type { Interval, vec } from "mafs";
5
5
  export declare function renderLogarithmGraph(state: LogarithmGraphState, dispatch: Dispatch, i18n: I18nContextType): InteractiveGraphElementSuite;
6
- export declare const constrainAsymptoteKeyboard: (p: vec.Vector2, coords: ReadonlyArray<Coord>, snapStep: vec.Vector2) => vec.Vector2;
7
6
  export declare const getLogarithmKeyboardConstraint: (coords: ReadonlyArray<Coord>, asymptote: number, snapStep: vec.Vector2, pointIndex: number, range: [Interval, Interval]) => {
8
7
  up: vec.Vector2;
9
8
  down: vec.Vector2;
@@ -53,11 +53,19 @@ export declare function getAsymptoteGraphKeyboardConstraint(coords: ReadonlyArra
53
53
  right: vec.Vector2;
54
54
  };
55
55
  /**
56
- * Shared keyboard constraint for asymptote movement (exponential, logarithm).
57
- * When the next snapped position would land between or on the curve points,
58
- * snaps past all of them in the direction of travel using a midpoint heuristic.
59
- *
60
- * @param orientation - "horizontal" for exponential (asymptote moves on Y-axis),
61
- * "vertical" for logarithm (asymptote moves on X-axis).
56
+ * Position of the asymptote's drag handle in graph-space. For a horizontal
57
+ * asymptote (exponential), this sits at the midpoint of the x-range on
58
+ * the asymptote's y-value. For a vertical asymptote (logarithm), it sits
59
+ * on the asymptote's x-value at the midpoint of the y-range.
60
+ */
61
+ export declare function getAsymptoteHandleCoord(orientation: "horizontal" | "vertical", range: [Interval, Interval], asymptote: number): vec.Vector2;
62
+ /**
63
+ * Keyboard snap + skip for the asymptote drag handle. `useDraggable`'s
64
+ * function-form constraint expects the returned point to be snap-aligned;
65
+ * it searches along the direction of travel until the returned point is
66
+ * far enough from the current asymptote to register as a move. After
67
+ * snapping, if the proposed position would put the handle on one of the
68
+ * curve points, we step further in the direction of travel until we find
69
+ * a valid position (up to 3 attempts).
62
70
  */
63
- export declare function constrainAsymptoteKeyboardMovement(p: vec.Vector2, coords: ReadonlyArray<Coord>, snapStep: vec.Vector2, orientation: "horizontal" | "vertical"): vec.Vector2;
71
+ export declare function skipAsymptoteKeyboardOverPoint(proposed: vec.Vector2, currentAsymptote: number, coords: ReadonlyArray<Coord>, handleCoord: vec.Vector2, snapStep: vec.Vector2, orientation: "horizontal" | "vertical"): vec.Vector2;
@@ -0,0 +1,11 @@
1
+ import { vec } from "mafs";
2
+ import type { I18nContextType } from "../../../components/i18n-context";
3
+ import type { Dispatch, InteractiveGraphElementSuite, VectorGraphState } from "../types";
4
+ export declare function renderVectorGraph(state: VectorGraphState, dispatch: Dispatch, i18n: I18nContextType): InteractiveGraphElementSuite;
5
+ export declare const getVectorTipKeyboardConstraint: (tail: vec.Vector2, tip: vec.Vector2, snapStep: vec.Vector2) => {
6
+ up: vec.Vector2;
7
+ down: vec.Vector2;
8
+ left: vec.Vector2;
9
+ right: vec.Vector2;
10
+ };
11
+ export declare function describeVectorGraph(state: VectorGraphState, i18n: I18nContextType): Record<string, string>;
@@ -274,6 +274,7 @@ declare class InteractiveGraph extends React.Component<Props, State> {
274
274
  static getRayEquationString(props: Props): string;
275
275
  static getPolygonEquationString(props: Props): string;
276
276
  static getAngleEquationString(props: Props): string;
277
+ static getVectorEquationString(props: Props): string;
277
278
  }
278
279
  /**
279
280
  * @deprecated and likely a very broken API
@@ -1,6 +1,6 @@
1
1
  import type { Coord } from "../../../interactive2/types";
2
2
  import type { InteractiveGraphState, PairOfPoints } from "../types";
3
- import type { PerseusGraphType, PerseusGraphTypeAbsoluteValue, PerseusGraphTypeAngle, PerseusGraphTypeCircle, PerseusGraphTypeLinear, PerseusGraphTypeLinearSystem, PerseusGraphTypePoint, PerseusGraphTypePolygon, PerseusGraphTypeQuadratic, PerseusGraphTypeRay, PerseusGraphTypeSegment, PerseusGraphTypeSinusoid, PerseusGraphTypeExponential, PerseusGraphTypeTangent, PerseusGraphTypeLogarithm } from "@khanacademy/perseus-core";
3
+ import type { PerseusGraphType, PerseusGraphTypeAbsoluteValue, PerseusGraphTypeAngle, PerseusGraphTypeCircle, PerseusGraphTypeLinear, PerseusGraphTypeLinearSystem, PerseusGraphTypePoint, PerseusGraphTypePolygon, PerseusGraphTypeQuadratic, PerseusGraphTypeRay, PerseusGraphTypeSegment, PerseusGraphTypeSinusoid, PerseusGraphTypeExponential, PerseusGraphTypeTangent, PerseusGraphTypeLogarithm, PerseusGraphTypeVector } from "@khanacademy/perseus-core";
4
4
  import type { Interval } from "mafs";
5
5
  export type InitializeGraphStateParams = {
6
6
  range: [x: Interval, y: Interval];
@@ -12,6 +12,7 @@ export declare function initializeGraphState(params: InitializeGraphStateParams)
12
12
  export declare function getPointCoords(graph: PerseusGraphTypePoint, range: [x: Interval, y: Interval], step: [x: number, y: number]): Coord[];
13
13
  export declare function getSegmentCoords(graph: PerseusGraphTypeSegment, range: [x: Interval, y: Interval], step: [x: number, y: number]): PairOfPoints[];
14
14
  export declare function getLineCoords(graph: PerseusGraphTypeRay | PerseusGraphTypeLinear, range: [x: Interval, y: Interval], step: [x: number, y: number]): PairOfPoints;
15
+ export declare function getVectorCoords(graph: PerseusGraphTypeVector, range: [x: Interval, y: Interval], step: [x: number, y: number]): PairOfPoints;
15
16
  export declare function getLinearSystemCoords(graph: PerseusGraphTypeLinearSystem, range: [x: Interval, y: Interval], step: [x: number, y: number]): PairOfPoints[];
16
17
  export declare function getPolygonCoords(graph: PerseusGraphTypePolygon, range: [x: Interval, y: Interval], step: [x: number, y: number]): Coord[];
17
18
  export declare function getSinusoidCoords(graph: PerseusGraphTypeSinusoid, range: [x: Interval, y: Interval], step: [x: number, y: number]): [Coord, Coord];
@@ -16,7 +16,7 @@ export declare const actions: {
16
16
  moveRadiusPoint: typeof moveRadiusPoint;
17
17
  };
18
18
  linear: {
19
- moveLine: (delta: vec.Vector2) => MoveLine;
19
+ moveLine: (newStart: vec.Vector2) => MoveLine;
20
20
  movePoint: (pointIndex: any, destination: any) => MovePointInFigure;
21
21
  };
22
22
  linearSystem: {
@@ -46,7 +46,7 @@ export declare const actions: {
46
46
  movePoint: typeof movePoint;
47
47
  };
48
48
  ray: {
49
- moveRay: (delta: vec.Vector2) => MoveLine;
49
+ moveRay: (newStart: vec.Vector2) => MoveLine;
50
50
  movePoint: (pointIndex: any, destination: any) => MovePointInFigure;
51
51
  };
52
52
  segment: {
@@ -70,6 +70,10 @@ export declare const actions: {
70
70
  tangent: {
71
71
  movePoint: typeof movePoint;
72
72
  };
73
+ vector: {
74
+ moveTip: (destination: vec.Vector2) => MovePoint;
75
+ moveVector: (newStart: vec.Vector2) => MoveLine;
76
+ };
73
77
  };
74
78
  export declare const DELETE_INTENT = "delete-intent";
75
79
  export interface DeleteIntent {
@@ -80,9 +84,9 @@ export declare const MOVE_LINE = "move-line";
80
84
  export interface MoveLine {
81
85
  type: typeof MOVE_LINE;
82
86
  itemIndex: number;
83
- delta: vec.Vector2;
87
+ newStart: vec.Vector2;
84
88
  }
85
- declare function moveLine(itemIndex: number, delta: vec.Vector2): MoveLine;
89
+ declare function moveLine(itemIndex: number, newStart: vec.Vector2): MoveLine;
86
90
  export declare const ADD_POINT = "add-point";
87
91
  export interface AddPoint {
88
92
  type: typeof ADD_POINT;
@@ -15,7 +15,7 @@ export type InteractiveGraphElementSuite = {
15
15
  graph: ReactNode;
16
16
  interactiveElementsDescription: ReactNode;
17
17
  };
18
- export type InteractiveGraphState = AbsoluteValueGraphState | AngleGraphState | SegmentGraphState | LinearSystemGraphState | LinearGraphState | RayGraphState | NoneGraphState | PolygonGraphState | PointGraphState | CircleGraphState | QuadraticGraphState | SinusoidGraphState | ExponentialGraphState | TangentGraphState | LogarithmGraphState;
18
+ export type InteractiveGraphState = AbsoluteValueGraphState | AngleGraphState | SegmentGraphState | LinearSystemGraphState | LinearGraphState | RayGraphState | NoneGraphState | PolygonGraphState | PointGraphState | CircleGraphState | QuadraticGraphState | SinusoidGraphState | ExponentialGraphState | TangentGraphState | LogarithmGraphState | VectorGraphState;
19
19
  export type UnlimitedGraphState = PointGraphState | PolygonGraphState;
20
20
  export interface InteractiveGraphStateCommon {
21
21
  hasBeenInteractedWith: boolean;
@@ -51,6 +51,10 @@ export interface RayGraphState extends InteractiveGraphStateCommon {
51
51
  type: "ray";
52
52
  coords: PairOfPoints;
53
53
  }
54
+ export interface VectorGraphState extends InteractiveGraphStateCommon {
55
+ type: "vector";
56
+ coords: PairOfPoints;
57
+ }
54
58
  export interface PolygonGraphState extends InteractiveGraphStateCommon {
55
59
  type: "polygon";
56
60
  showAngles: boolean;
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": "77.2.2",
6
+ "version": "77.3.2",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -42,40 +42,40 @@
42
42
  "mafs": "0.19.0",
43
43
  "tiny-invariant": "1.3.1",
44
44
  "uuid": "^10.0.0",
45
- "@khanacademy/kas": "2.2.1",
46
- "@khanacademy/keypad-context": "3.2.43",
47
- "@khanacademy/kmath": "2.4.1",
48
- "@khanacademy/math-input": "26.4.14",
49
- "@khanacademy/perseus-core": "24.1.1",
50
- "@khanacademy/perseus-linter": "4.9.4",
51
- "@khanacademy/perseus-score": "8.6.1",
45
+ "@khanacademy/kas": "2.2.2",
46
+ "@khanacademy/keypad-context": "3.2.45",
47
+ "@khanacademy/kmath": "2.4.3",
48
+ "@khanacademy/math-input": "26.4.17",
49
+ "@khanacademy/perseus-core": "26.0.0",
50
+ "@khanacademy/perseus-linter": "5.0.0",
51
+ "@khanacademy/perseus-score": "8.7.1",
52
52
  "@khanacademy/perseus-utils": "2.1.5",
53
53
  "@khanacademy/pure-markdown": "2.2.7",
54
54
  "@khanacademy/simple-markdown": "2.2.2"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@khanacademy/wonder-blocks-announcer": "1.1.0",
58
- "@khanacademy/wonder-blocks-banner": "5.0.18",
59
- "@khanacademy/wonder-blocks-button": "11.4.2",
60
- "@khanacademy/wonder-blocks-clickable": "8.1.5",
58
+ "@khanacademy/wonder-blocks-banner": "5.0.20",
59
+ "@khanacademy/wonder-blocks-button": "11.5.1",
60
+ "@khanacademy/wonder-blocks-clickable": "8.1.6",
61
61
  "@khanacademy/wonder-blocks-core": "12.4.3",
62
62
  "@khanacademy/wonder-blocks-data": "15.0.1",
63
- "@khanacademy/wonder-blocks-dropdown": "10.8.3",
64
- "@khanacademy/wonder-blocks-form": "7.5.6",
65
- "@khanacademy/wonder-blocks-icon": "5.3.9",
66
- "@khanacademy/wonder-blocks-icon-button": "11.1.6",
67
- "@khanacademy/wonder-blocks-labeled-field": "4.0.16",
68
- "@khanacademy/wonder-blocks-layout": "3.1.46",
69
- "@khanacademy/wonder-blocks-link": "10.1.7",
70
- "@khanacademy/wonder-blocks-modal": "8.6.0",
71
- "@khanacademy/wonder-blocks-pill": "3.1.57",
72
- "@khanacademy/wonder-blocks-popover": "6.1.56",
73
- "@khanacademy/wonder-blocks-progress-spinner": "3.1.46",
74
- "@khanacademy/wonder-blocks-switch": "3.3.30",
63
+ "@khanacademy/wonder-blocks-dropdown": "10.8.5",
64
+ "@khanacademy/wonder-blocks-form": "7.5.7",
65
+ "@khanacademy/wonder-blocks-icon": "5.3.10",
66
+ "@khanacademy/wonder-blocks-icon-button": "11.2.1",
67
+ "@khanacademy/wonder-blocks-labeled-field": "4.0.17",
68
+ "@khanacademy/wonder-blocks-layout": "3.1.47",
69
+ "@khanacademy/wonder-blocks-link": "10.1.8",
70
+ "@khanacademy/wonder-blocks-modal": "8.6.2",
71
+ "@khanacademy/wonder-blocks-pill": "3.1.58",
72
+ "@khanacademy/wonder-blocks-popover": "6.2.1",
73
+ "@khanacademy/wonder-blocks-progress-spinner": "3.1.47",
74
+ "@khanacademy/wonder-blocks-switch": "3.3.31",
75
75
  "@khanacademy/wonder-blocks-timing": "7.0.4",
76
- "@khanacademy/wonder-blocks-tokens": "16.1.0",
77
- "@khanacademy/wonder-blocks-tooltip": "4.1.69",
78
- "@khanacademy/wonder-blocks-typography": "4.2.31",
76
+ "@khanacademy/wonder-blocks-tokens": "16.2.0",
77
+ "@khanacademy/wonder-blocks-tooltip": "4.1.71",
78
+ "@khanacademy/wonder-blocks-typography": "4.3.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.0",
95
- "@khanacademy/wonder-blocks-banner": "^5.0.18",
96
- "@khanacademy/wonder-blocks-button": "^11.4.2",
97
- "@khanacademy/wonder-blocks-clickable": "^8.1.5",
95
+ "@khanacademy/wonder-blocks-banner": "^5.0.20",
96
+ "@khanacademy/wonder-blocks-button": "^11.5.1",
97
+ "@khanacademy/wonder-blocks-clickable": "^8.1.6",
98
98
  "@khanacademy/wonder-blocks-core": "^12.4.3",
99
99
  "@khanacademy/wonder-blocks-data": "^15.0.1",
100
- "@khanacademy/wonder-blocks-dropdown": "^10.8.3",
101
- "@khanacademy/wonder-blocks-form": "^7.5.6",
102
- "@khanacademy/wonder-blocks-icon": "^5.3.9",
103
- "@khanacademy/wonder-blocks-icon-button": "^11.1.6",
104
- "@khanacademy/wonder-blocks-labeled-field": "^4.0.16",
105
- "@khanacademy/wonder-blocks-layout": "^3.1.46",
106
- "@khanacademy/wonder-blocks-link": "^10.1.7",
107
- "@khanacademy/wonder-blocks-modal": "^8.6.0",
108
- "@khanacademy/wonder-blocks-pill": "^3.1.57",
109
- "@khanacademy/wonder-blocks-popover": "^6.1.56",
110
- "@khanacademy/wonder-blocks-progress-spinner": "^3.1.46",
111
- "@khanacademy/wonder-blocks-switch": "^3.3.30",
100
+ "@khanacademy/wonder-blocks-dropdown": "^10.8.5",
101
+ "@khanacademy/wonder-blocks-form": "^7.5.7",
102
+ "@khanacademy/wonder-blocks-icon": "^5.3.10",
103
+ "@khanacademy/wonder-blocks-icon-button": "^11.2.1",
104
+ "@khanacademy/wonder-blocks-labeled-field": "^4.0.17",
105
+ "@khanacademy/wonder-blocks-layout": "^3.1.47",
106
+ "@khanacademy/wonder-blocks-link": "^10.1.8",
107
+ "@khanacademy/wonder-blocks-modal": "^8.6.2",
108
+ "@khanacademy/wonder-blocks-pill": "^3.1.58",
109
+ "@khanacademy/wonder-blocks-popover": "^6.2.1",
110
+ "@khanacademy/wonder-blocks-progress-spinner": "^3.1.47",
111
+ "@khanacademy/wonder-blocks-switch": "^3.3.31",
112
112
  "@khanacademy/wonder-blocks-timing": "^7.0.4",
113
- "@khanacademy/wonder-blocks-tokens": "^16.1.0",
114
- "@khanacademy/wonder-blocks-tooltip": "^4.1.69",
115
- "@khanacademy/wonder-blocks-typography": "^4.2.31",
113
+ "@khanacademy/wonder-blocks-tokens": "^16.2.0",
114
+ "@khanacademy/wonder-blocks-tooltip": "^4.1.71",
115
+ "@khanacademy/wonder-blocks-typography": "^4.3.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": "a1f429536c944326"
130
+ "catalogHash": "5f4444b00d857f2e"
131
131
  },
132
132
  "scripts": {}
133
133
  }
@@ -1,15 +0,0 @@
1
- import * as React from "react";
2
- import type { vec } from "mafs";
3
- type Props = {
4
- /** Pixel-space center of the handle (already transformed from graph coordinates). */
5
- center: vec.Vector2;
6
- active: boolean;
7
- focused: boolean;
8
- /**
9
- * "horizontal" — wide pill with a 3×2 grip dot grid (exponential asymptote)
10
- * "vertical" — tall pill with a 2×3 grip dot grid (logarithm asymptote)
11
- */
12
- orientation: "horizontal" | "vertical";
13
- };
14
- export declare function AsymptoteDragHandle(props: Props): React.JSX.Element;
15
- export {};
@@ -1,192 +0,0 @@
1
- import { vec } from "mafs";
2
- import type { SnapTo } from "./types";
3
- import type { Coord } from "../../interactive2/types";
4
- import type { AxisLabelLocation, CollinearTuple, LockedFigureColor, LockedFigureFillType, LockedLineStyle, MarkingsType, PerseusRenderer, StrokeWeight } from "@khanacademy/perseus-core";
5
- export type LockedFunctionOptions = {
6
- color?: LockedFigureColor;
7
- strokeStyle?: LockedLineStyle;
8
- weight?: StrokeWeight;
9
- directionalAxis?: "x" | "y";
10
- domain?: [min: number, max: number];
11
- labels?: LockedFigureLabelOptions[];
12
- ariaLabel?: string;
13
- };
14
- type LockedFigureLabelOptions = {
15
- text: string;
16
- coord?: Coord;
17
- size?: "small" | "medium" | "large";
18
- };
19
- export declare function interactiveGraphQuestionBuilder(): InteractiveGraphQuestionBuilder;
20
- declare class InteractiveGraphQuestionBuilder {
21
- private content;
22
- private fullGraphAriaLabel?;
23
- private fullGraphAriaDescription?;
24
- private backgroundImage?;
25
- private gridStep;
26
- private labels;
27
- private labelLocation;
28
- private markings;
29
- private xRange;
30
- private yRange;
31
- private showAxisArrows;
32
- private snapStep;
33
- private tickStep;
34
- private showProtractor;
35
- private showTooltips;
36
- private interactiveFigureConfig;
37
- private lockedFigures;
38
- private snapTo;
39
- private staticMode;
40
- build(): PerseusRenderer;
41
- withContent(content: string): InteractiveGraphQuestionBuilder;
42
- withFullGraphAriaLabel(label: string): InteractiveGraphQuestionBuilder;
43
- withFullGraphAriaDescription(description: string): InteractiveGraphQuestionBuilder;
44
- withTooltips(showTooltips: boolean): InteractiveGraphQuestionBuilder;
45
- withStaticMode(staticMode: boolean): InteractiveGraphQuestionBuilder;
46
- withBackgroundImage(url: string, height: number, width: number, options?: {
47
- scale?: number;
48
- bottom?: number;
49
- left?: number;
50
- right?: number;
51
- top?: number;
52
- }): InteractiveGraphQuestionBuilder;
53
- withGridStep(x: number, y: number): InteractiveGraphQuestionBuilder;
54
- withAxisLabels(x: string, y: string): InteractiveGraphQuestionBuilder;
55
- withLabelLocation(labelLocation: AxisLabelLocation): InteractiveGraphQuestionBuilder;
56
- withMarkings(markings: MarkingsType): InteractiveGraphQuestionBuilder;
57
- withXRange(min: number, max: number): InteractiveGraphQuestionBuilder;
58
- withYRange(min: number, max: number): InteractiveGraphQuestionBuilder;
59
- withShowAxisArrows({ xMin, xMax, yMin, yMax, }: {
60
- xMin?: boolean;
61
- xMax?: boolean;
62
- yMin?: boolean;
63
- yMax?: boolean;
64
- }): InteractiveGraphQuestionBuilder;
65
- withSnapStep(x: number, y: number): InteractiveGraphQuestionBuilder;
66
- withTickStep(x: number, y: number): InteractiveGraphQuestionBuilder;
67
- withProtractor(): InteractiveGraphQuestionBuilder;
68
- withSegments(options?: {
69
- numSegments?: number;
70
- startCoords?: CollinearTuple[];
71
- coords?: CollinearTuple[];
72
- }): InteractiveGraphQuestionBuilder;
73
- withNoInteractiveFigure(): this;
74
- withLinear(options?: {
75
- coords?: CollinearTuple;
76
- startCoords?: CollinearTuple;
77
- }): InteractiveGraphQuestionBuilder;
78
- withLinearSystem(options?: {
79
- coords?: CollinearTuple[];
80
- startCoords?: CollinearTuple[];
81
- }): InteractiveGraphQuestionBuilder;
82
- withRay(options?: {
83
- coords?: CollinearTuple;
84
- startCoords?: CollinearTuple;
85
- }): InteractiveGraphQuestionBuilder;
86
- withCircle(options?: {
87
- center?: Coord;
88
- radius?: number;
89
- startCoords?: {
90
- center: Coord;
91
- radius: number;
92
- };
93
- }): InteractiveGraphQuestionBuilder;
94
- withQuadratic(options?: {
95
- coords?: [Coord, Coord, Coord];
96
- startCoords?: [Coord, Coord, Coord];
97
- }): InteractiveGraphQuestionBuilder;
98
- withSinusoid(options?: {
99
- coords?: [Coord, Coord];
100
- startCoords?: [Coord, Coord];
101
- }): InteractiveGraphQuestionBuilder;
102
- withExponential(options?: {
103
- coords?: [Coord, Coord];
104
- asymptote?: number;
105
- startCoords?: [Coord, Coord];
106
- startAsymptote?: number;
107
- }): InteractiveGraphQuestionBuilder;
108
- withTangent(options?: {
109
- coords?: [Coord, Coord];
110
- startCoords?: [Coord, Coord];
111
- }): InteractiveGraphQuestionBuilder;
112
- withPolygon(snapTo?: SnapTo, options?: {
113
- match?: "similar" | "congruent" | "approx";
114
- numSides?: number | "unlimited";
115
- showAngles?: boolean;
116
- showSides?: boolean;
117
- coords?: Coord[];
118
- startCoords?: Coord[];
119
- }): InteractiveGraphQuestionBuilder;
120
- withPoints(numPoints: number | "unlimited", options?: {
121
- coords?: Coord[];
122
- startCoords?: Coord[];
123
- }): InteractiveGraphQuestionBuilder;
124
- withAngle(options?: {
125
- coords?: [Coord, Coord, Coord];
126
- startCoords?: [Coord, Coord, Coord];
127
- showAngles?: boolean;
128
- allowReflexAngles?: boolean;
129
- angleOffsetDeg?: number;
130
- snapDegrees?: number;
131
- match?: "congruent";
132
- }): InteractiveGraphQuestionBuilder;
133
- withLogarithm(options?: {
134
- coords?: [Coord, Coord];
135
- asymptote?: number;
136
- startCoords?: [Coord, Coord];
137
- startAsymptote?: number;
138
- }): InteractiveGraphQuestionBuilder;
139
- withAbsoluteValue(options?: {
140
- coords?: [Coord, Coord];
141
- startCoords?: [Coord, Coord];
142
- }): InteractiveGraphQuestionBuilder;
143
- addLockedPointAt(x: number, y: number, options?: {
144
- color?: LockedFigureColor;
145
- filled?: boolean;
146
- labels?: LockedFigureLabelOptions[];
147
- ariaLabel?: string;
148
- }): InteractiveGraphQuestionBuilder;
149
- addLockedLine(point1: vec.Vector2, point2: vec.Vector2, options?: {
150
- kind?: "line" | "ray" | "segment";
151
- lineStyle?: LockedLineStyle;
152
- color?: LockedFigureColor;
153
- filled?: [boolean, boolean];
154
- showPoint1?: boolean;
155
- showPoint2?: boolean;
156
- weight?: StrokeWeight;
157
- labels?: LockedFigureLabelOptions[];
158
- ariaLabel?: string;
159
- }): InteractiveGraphQuestionBuilder;
160
- addLockedVector(tail: vec.Vector2, tip: vec.Vector2, options?: {
161
- color?: LockedFigureColor;
162
- labels?: LockedFigureLabelOptions[];
163
- weight?: StrokeWeight;
164
- ariaLabel?: string;
165
- }): InteractiveGraphQuestionBuilder;
166
- addLockedEllipse(center: vec.Vector2, radius: [x: number, y: number], options?: {
167
- angle?: number;
168
- color?: LockedFigureColor;
169
- fillStyle?: LockedFigureFillType;
170
- strokeStyle?: "solid" | "dashed";
171
- weight?: StrokeWeight;
172
- labels?: LockedFigureLabelOptions[];
173
- ariaLabel?: string;
174
- }): InteractiveGraphQuestionBuilder;
175
- addLockedPolygon(points: vec.Vector2[], options?: {
176
- color?: LockedFigureColor;
177
- showVertices?: boolean;
178
- fillStyle?: LockedFigureFillType;
179
- strokeStyle?: LockedLineStyle;
180
- weight?: StrokeWeight;
181
- labels?: LockedFigureLabelOptions[];
182
- ariaLabel?: string;
183
- }): InteractiveGraphQuestionBuilder;
184
- addLockedFunction(equation: string, options?: LockedFunctionOptions): this;
185
- addLockedLabel(text: string, coord: Coord, options?: {
186
- color?: LockedFigureColor;
187
- size?: "small" | "medium" | "large";
188
- }): this;
189
- private createLockedPoint;
190
- private addLockedFigure;
191
- }
192
- export {};