@khanacademy/perseus 77.7.2 → 77.9.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.
Files changed (33) hide show
  1. package/dist/es/index.css +1 -1
  2. package/dist/es/index.css.map +1 -1
  3. package/dist/es/index.js +36 -34
  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 +1 -1
  8. package/dist/index.css.map +1 -1
  9. package/dist/index.js +35 -33
  10. package/dist/index.js.map +1 -1
  11. package/dist/server-item-renderer.d.ts +1 -1
  12. package/dist/strings.d.ts +6 -0
  13. package/dist/strings.js +1 -1
  14. package/dist/strings.js.map +1 -1
  15. package/dist/testing/feature-flags-util.d.ts +0 -2
  16. package/dist/testing/item-renderer-hooks.d.ts +1 -1
  17. package/dist/widgets/dropdown/dropdown.d.ts +1 -1
  18. package/dist/widgets/expression/expression.d.ts +2 -2
  19. package/dist/widgets/image/components/explore-image-modal-content.d.ts +3 -3
  20. package/dist/widgets/image/components/explore-image-modal.d.ts +2 -2
  21. package/dist/widgets/image/components/image-info-area.d.ts +1 -12
  22. package/dist/widgets/interactive-graphs/graphs/components/clip-to-graph-bounds.d.ts +4 -0
  23. package/dist/widgets/interactive-graphs/graphs/screenreader-text.d.ts +2 -0
  24. package/dist/widgets/interactive-graphs/interactive-graph.d.ts +1 -1
  25. package/dist/widgets/interactive-graphs/reducer/interactive-graph-action.d.ts +3 -3
  26. package/dist/widgets/interactive-graphs/types.d.ts +15 -1
  27. package/dist/widgets/interactive-graphs/utils.d.ts +2 -2
  28. package/dist/widgets/label-image/label-image.d.ts +1 -1
  29. package/dist/widgets/mock-widgets/mock-widget.d.ts +1 -1
  30. package/dist/widgets/numeric-input/numeric-input.class.d.ts +2 -1
  31. package/dist/widgets/numeric-input/numeric-input.d.ts +2 -2
  32. package/dist/widgets/table/table.d.ts +1 -1
  33. package/package.json +7 -7
@@ -42,7 +42,7 @@ export declare const Expression: React.ForwardRefExoticComponent<PerseusExpressi
42
42
  hintProgressColor?: string;
43
43
  canScrollPage?: boolean;
44
44
  editorChangeDelay?: number;
45
- flags?: Record<"image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "input-number-to-numeric-input" | "interactive-graph-vector" | "interactive-graph-not-scored", boolean>;
45
+ flags?: Record<"image-widget-upgrade-gif-controls" | "input-number-to-numeric-input", boolean>;
46
46
  }> & {
47
47
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
48
48
  canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
@@ -122,7 +122,7 @@ declare const _default: {
122
122
  hintProgressColor?: string;
123
123
  canScrollPage?: boolean;
124
124
  editorChangeDelay?: number;
125
- flags?: Record<"image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "input-number-to-numeric-input" | "interactive-graph-vector" | "interactive-graph-not-scored", boolean>;
125
+ flags?: Record<"image-widget-upgrade-gif-controls" | "input-number-to-numeric-input", boolean>;
126
126
  }> & {
127
127
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
128
128
  canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
@@ -1,8 +1,8 @@
1
1
  import * as React from "react";
2
- import type { CommonImageProps, ZoomProps, GifProps } from "./image-info-area";
3
- type Props = CommonImageProps & ZoomProps & GifProps & {
2
+ import type { CommonImageProps, GifProps } from "./image-info-area";
3
+ type Props = CommonImageProps & GifProps & {
4
4
  captionId: string;
5
5
  longDescId: string;
6
6
  };
7
- export default function ExploreImageModalContent({ backgroundImage, scale: contentScale, caption, alt, longDescription, linterContext, apiOptions, box, labels, range, zoomSize, captionId, longDescId, }: Props): React.JSX.Element | null;
7
+ export default function ExploreImageModalContent({ backgroundImage, scale: contentScale, caption, alt, longDescription, linterContext, apiOptions, box, labels, range, captionId, longDescId, }: Props): React.JSX.Element | null;
8
8
  export {};
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import type { CommonImageProps, ZoomProps, GifProps } from "./image-info-area";
3
- type Props = CommonImageProps & ZoomProps & GifProps;
2
+ import type { CommonImageProps, GifProps } from "./image-info-area";
3
+ type Props = CommonImageProps & GifProps;
4
4
  export declare const ExploreImageModal: (props: Props) => React.JSX.Element;
5
5
  export {};
@@ -2,17 +2,6 @@ import { type Interval, type PerseusImageBackground, type PerseusImageLabel, typ
2
2
  import * as React from "react";
3
3
  import type { APIOptions } from "../../../types";
4
4
  import type { LinterContextProps } from "@khanacademy/perseus-linter";
5
- export interface ZoomProps {
6
- /**
7
- * zoomSize represents the larger of the image’s natural size (calculated on load)
8
- * and the saved backgroundImage size (specified when the content is written). This
9
- * ensures that zooming is enabled only if the image is sufficiently large.
10
- * image (calculated on load) and the saved backgroundImage size (specified
11
- * when the content is written). This larger image size is used to
12
- * determine if the image is large enough to allow zooming.
13
- */
14
- zoomSize: Size;
15
- }
16
5
  export interface GifProps {
17
6
  isGifPlaying: boolean;
18
7
  setIsGifPlaying: (isPaused: boolean) => void;
@@ -30,7 +19,7 @@ export interface CommonImageProps {
30
19
  linterContext: LinterContextProps;
31
20
  apiOptions: APIOptions;
32
21
  }
33
- type Props = ZoomProps & GifProps & CommonImageProps;
22
+ type Props = GifProps & CommonImageProps;
34
23
  /**
35
24
  * The ImageInfoArea component includes the GIF controls, description modal
36
25
  * launcher, and caption for the image. This is displayed underneath the image
@@ -0,0 +1,4 @@
1
+ import * as React from "react";
2
+ export declare function ClipToGraphBounds({ children }: {
3
+ children: React.ReactNode;
4
+ }): React.JSX.Element;
@@ -1,5 +1,7 @@
1
1
  import type { InteractiveGraphStateAnnouncement } from "../types";
2
2
  import type { PerseusStrings } from "@khanacademy/perseus/strings";
3
3
  export declare function getAnnouncementText(state: InteractiveGraphStateAnnouncement, strings: PerseusStrings, locale: string): string;
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;
4
6
  export declare function srFormatNumber(a: number, locale: string, maximumFractionDigits?: number): string;
5
7
  export declare function getPiMultiple(a: number): string | null;
@@ -199,7 +199,7 @@ declare class InteractiveGraph extends React.Component<Props, State> {
199
199
  hintProgressColor?: string;
200
200
  canScrollPage?: boolean;
201
201
  editorChangeDelay?: number;
202
- flags?: Record<"image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "input-number-to-numeric-input" | "interactive-graph-vector" | "interactive-graph-not-scored", boolean>;
202
+ flags?: Record<"image-widget-upgrade-gif-controls" | "input-number-to-numeric-input", boolean>;
203
203
  }> & {
204
204
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
205
205
  canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
@@ -71,7 +71,7 @@ export declare const actions: {
71
71
  movePoint: typeof movePoint;
72
72
  };
73
73
  vector: {
74
- moveTip: (destination: vec.Vector2) => MovePoint;
74
+ moveTip: (destination: vec.Vector2) => MovePointInFigure;
75
75
  moveVector: (newStart: vec.Vector2) => MoveLine;
76
76
  };
77
77
  };
@@ -141,9 +141,9 @@ declare function openPolygon(): OpenPolygon;
141
141
  export declare const MOVE_ALL = "move-all";
142
142
  export interface MoveAll {
143
143
  type: typeof MOVE_ALL;
144
- delta: vec.Vector2;
144
+ newStart: vec.Vector2;
145
145
  }
146
- declare function moveAll(delta: vec.Vector2): MoveAll;
146
+ declare function moveAll(newStart: vec.Vector2): MoveAll;
147
147
  export declare const MOVE_POINT = "move-point";
148
148
  export interface MovePoint {
149
149
  type: typeof MOVE_POINT;
@@ -17,12 +17,25 @@ export type InteractiveGraphElementSuite = {
17
17
  };
18
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
- export type InteractiveGraphStateAnnouncement = {
20
+ type MovePointAnnouncement = {
21
21
  type: "move-point";
22
22
  pointIndex: number;
23
23
  x: number;
24
24
  y: number;
25
25
  };
26
+ type MoveRadiusPointAnnouncement = {
27
+ type: "move-radius-point";
28
+ x: number;
29
+ y: number;
30
+ centerX: number;
31
+ radius: number;
32
+ };
33
+ type MoveCenterAnnouncement = {
34
+ type: "move-center";
35
+ x: number;
36
+ y: number;
37
+ };
38
+ export type InteractiveGraphStateAnnouncement = MovePointAnnouncement | MoveRadiusPointAnnouncement | MoveCenterAnnouncement;
26
39
  export interface InteractiveGraphStateCommon {
27
40
  hasBeenInteractedWith: boolean;
28
41
  range: [xRange: Interval, yRange: Interval];
@@ -124,3 +137,4 @@ export type GraphDimensions = {
124
137
  };
125
138
  export type AriaLive = "off" | "assertive" | "polite" | undefined;
126
139
  export type SnapTo = "grid" | "angles" | "sides";
140
+ export {};
@@ -16,9 +16,9 @@ export declare function bound({ snapStep, range, point, }: {
16
16
  range: [Interval, Interval];
17
17
  point: vec.Vector2;
18
18
  }): vec.Vector2;
19
- export declare function boundToEdge({ range, point, }: {
19
+ export declare function boundToEdgeAndSnapToGrid(point: vec.Vector2, { snapStep, range }: {
20
+ snapStep: vec.Vector2;
20
21
  range: [Interval, Interval];
21
- point: vec.Vector2;
22
22
  }): vec.Vector2;
23
23
  export declare function isUnlimitedGraphState(state: InteractiveGraphState): state is UnlimitedGraphState;
24
24
  /**
@@ -151,7 +151,7 @@ declare const _default: {
151
151
  hintProgressColor?: string;
152
152
  canScrollPage?: boolean;
153
153
  editorChangeDelay?: number;
154
- flags?: Record<"image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "input-number-to-numeric-input" | "interactive-graph-vector" | "interactive-graph-not-scored", boolean>;
154
+ flags?: Record<"image-widget-upgrade-gif-controls" | "input-number-to-numeric-input", boolean>;
155
155
  }> & {
156
156
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
157
157
  canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
@@ -75,7 +75,7 @@ declare class MockWidgetComponent extends React.Component<Props> implements Widg
75
75
  hintProgressColor?: string;
76
76
  canScrollPage?: boolean;
77
77
  editorChangeDelay?: number;
78
- flags?: Record<"image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "input-number-to-numeric-input" | "interactive-graph-vector" | "interactive-graph-not-scored", boolean>;
78
+ flags?: Record<"image-widget-upgrade-gif-controls" | "input-number-to-numeric-input", boolean>;
79
79
  }> & {
80
80
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
81
81
  canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
@@ -25,6 +25,7 @@ export declare class NumericInput extends React.Component<NumericInputProps> imp
25
25
  inputRef: React.RefObject<Focusable>;
26
26
  static defaultProps: DefaultProps;
27
27
  focus: () => boolean;
28
+ blur: () => void;
28
29
  focusInputPath: () => void;
29
30
  blurInputPath: () => void;
30
31
  getInputPaths: () => ReadonlyArray<ReadonlyArray<string>>;
@@ -82,7 +83,7 @@ export declare class NumericInput extends React.Component<NumericInputProps> imp
82
83
  hintProgressColor?: string;
83
84
  canScrollPage?: boolean;
84
85
  editorChangeDelay?: number;
85
- flags?: Record<"image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "input-number-to-numeric-input" | "interactive-graph-vector" | "interactive-graph-not-scored", boolean>;
86
+ flags?: Record<"image-widget-upgrade-gif-controls" | "input-number-to-numeric-input", boolean>;
86
87
  }> & {
87
88
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
88
89
  canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
@@ -45,7 +45,7 @@ export declare const NumericInputComponent: React.ForwardRefExoticComponent<impo
45
45
  hintProgressColor?: string;
46
46
  canScrollPage?: boolean;
47
47
  editorChangeDelay?: number;
48
- flags?: Record<"image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "input-number-to-numeric-input" | "interactive-graph-vector" | "interactive-graph-not-scored", boolean>;
48
+ flags?: Record<"image-widget-upgrade-gif-controls" | "input-number-to-numeric-input", boolean>;
49
49
  }> & {
50
50
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
51
51
  canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
@@ -104,7 +104,7 @@ export declare const NumericInputComponent: React.ForwardRefExoticComponent<impo
104
104
  hintProgressColor?: string;
105
105
  canScrollPage?: boolean;
106
106
  editorChangeDelay?: number;
107
- flags?: Record<"image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "input-number-to-numeric-input" | "interactive-graph-vector" | "interactive-graph-not-scored", boolean>;
107
+ flags?: Record<"image-widget-upgrade-gif-controls" | "input-number-to-numeric-input", boolean>;
108
108
  }> & {
109
109
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
110
110
  canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
@@ -83,7 +83,7 @@ declare class Table extends React.Component<Props> implements Widget {
83
83
  hintProgressColor?: string;
84
84
  canScrollPage?: boolean;
85
85
  editorChangeDelay?: number;
86
- flags?: Record<"image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "input-number-to-numeric-input" | "interactive-graph-vector" | "interactive-graph-not-scored", boolean>;
86
+ flags?: Record<"image-widget-upgrade-gif-controls" | "input-number-to-numeric-input", boolean>;
87
87
  }> & {
88
88
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
89
89
  canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
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.7.2",
6
+ "version": "77.9.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.56",
47
- "@khanacademy/kmath": "2.4.14",
48
- "@khanacademy/math-input": "26.4.28",
49
- "@khanacademy/perseus-core": "27.0.2",
50
- "@khanacademy/perseus-linter": "5.0.11",
51
- "@khanacademy/perseus-score": "8.10.4",
46
+ "@khanacademy/keypad-context": "3.2.58",
47
+ "@khanacademy/kmath": "2.4.16",
48
+ "@khanacademy/math-input": "26.4.30",
49
+ "@khanacademy/perseus-core": "27.1.0",
50
+ "@khanacademy/perseus-linter": "5.0.13",
51
+ "@khanacademy/perseus-score": "8.11.0",
52
52
  "@khanacademy/perseus-utils": "2.1.5",
53
53
  "@khanacademy/pure-markdown": "2.2.8",
54
54
  "@khanacademy/simple-markdown": "2.2.3"