@khanacademy/perseus 77.10.2 → 78.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.
Files changed (42) hide show
  1. package/dist/components/graphie.d.ts +0 -1
  2. package/dist/components/svg-image.d.ts +2 -3
  3. package/dist/es/index.css +1 -1
  4. package/dist/es/index.css.map +1 -1
  5. package/dist/es/index.js +39 -35
  6. package/dist/es/index.js.map +1 -1
  7. package/dist/index.css +1 -1
  8. package/dist/index.css.map +1 -1
  9. package/dist/index.js +39 -35
  10. package/dist/index.js.map +1 -1
  11. package/dist/renderer.d.ts +0 -1
  12. package/dist/server-item-renderer.d.ts +1 -7
  13. package/dist/testing/feature-flags-util.d.ts +0 -2
  14. package/dist/testing/item-flipbook/item-flipbook-model.d.ts +22 -0
  15. package/dist/testing/item-flipbook/item-flipbook-view-model.d.ts +57 -0
  16. package/dist/testing/item-flipbook/item-flipbook-view.d.ts +7 -0
  17. package/dist/testing/item-flipbook/item-flipbook.d.ts +2 -0
  18. package/dist/testing/item-flipbook/safe-parse-perseus-item.d.ts +2 -0
  19. package/dist/testing/item-renderer-hooks.d.ts +1 -6
  20. package/dist/types.d.ts +0 -48
  21. package/dist/util/graphie.d.ts +0 -1
  22. package/dist/widget-container.d.ts +0 -1
  23. package/dist/widgets/dropdown/dropdown.d.ts +1 -9
  24. package/dist/widgets/expression/expression.d.ts +2 -18
  25. package/dist/widgets/interactive-graphs/graphs/components/movable-line/index.d.ts +2 -0
  26. package/dist/widgets/interactive-graphs/graphs/components/movable-line/line.d.ts +14 -0
  27. package/dist/widgets/interactive-graphs/graphs/components/movable-line/movable-line.d.ts +18 -0
  28. package/dist/widgets/interactive-graphs/graphs/components/{movable-line.d.ts → movable-line/util.d.ts} +0 -20
  29. package/dist/widgets/interactive-graphs/graphs/components/movable-point.d.ts +0 -2
  30. package/dist/widgets/interactive-graphs/graphs/components/use-control-arrowhead.d.ts +0 -2
  31. package/dist/widgets/interactive-graphs/graphs/components/use-control-point.d.ts +0 -2
  32. package/dist/widgets/interactive-graphs/graphs/screenreader-text.d.ts +6 -0
  33. package/dist/widgets/interactive-graphs/graphs/utils.d.ts +8 -2
  34. package/dist/widgets/interactive-graphs/interactive-graph.d.ts +1 -9
  35. package/dist/widgets/interactive-graphs/point-labels.d.ts +2 -0
  36. package/dist/widgets/interactive-graphs/types.d.ts +46 -2
  37. package/dist/widgets/label-image/label-image.d.ts +1 -9
  38. package/dist/widgets/mock-widgets/mock-widget.d.ts +1 -9
  39. package/dist/widgets/numeric-input/numeric-input.class.d.ts +1 -9
  40. package/dist/widgets/numeric-input/numeric-input.d.ts +2 -18
  41. package/dist/widgets/table/table.d.ts +1 -9
  42. package/package.json +9 -9
@@ -34,7 +34,6 @@ type Props = Partial<React.ContextType<typeof DependenciesContext>> & {
34
34
  onRender: (node?: any) => void;
35
35
  problemNum?: number;
36
36
  reviewMode?: boolean | null | undefined;
37
- highlightEmptyWidgets?: boolean;
38
37
  /**
39
38
  * If set to "all", all rationales or solutions will be shown. If set to
40
39
  * "selected", soltions will only be shown for selected choices. If set to
@@ -19,7 +19,6 @@ type OwnProps = {
19
19
  item: PerseusItem;
20
20
  problemNum?: number;
21
21
  reviewMode?: boolean;
22
- highlightEmptyWidgets?: boolean;
23
22
  keypadElement?: KeypadAPI | null | undefined;
24
23
  dependencies: PerseusDependenciesV2;
25
24
  showSolutions?: ShowSolutions;
@@ -108,7 +107,6 @@ declare const _default: React.ForwardRefExoticComponent<Omit<Pick<SharedRenderer
108
107
  baseElements?: {
109
108
  Link: React.ComponentType<any>;
110
109
  };
111
- imagePreloader?: (dimensions: import("./types").Dimensions) => React.ReactNode;
112
110
  trackInteraction?: (args: {
113
111
  type: string;
114
112
  id: string;
@@ -117,14 +115,10 @@ declare const _default: React.ForwardRefExoticComponent<Omit<Pick<SharedRenderer
117
115
  visible: number;
118
116
  }>) => void;
119
117
  customKeypad?: boolean;
120
- nativeKeypadProxy?: (blur: () => void) => KeypadAPI;
121
118
  isMobile?: boolean;
122
119
  isMobileApp?: boolean;
123
- setDrawingAreaAvailable?: (arg1: boolean) => unknown;
124
120
  hintProgressColor?: string;
125
- canScrollPage?: boolean;
126
- editorChangeDelay?: number;
127
- flags?: Record<"image-widget-upgrade-gif-controls" | "input-number-to-numeric-input", boolean>;
121
+ flags?: Record<"input-number-to-numeric-input", boolean>;
128
122
  }> | undefined;
129
123
  linterContext?: PerseusLinter.LinterContextProps | undefined;
130
124
  onRendered?: ((isRendered: boolean) => void) | undefined;
@@ -1,7 +1,6 @@
1
1
  declare const DEFAULT_FEATURE_FLAGS: {
2
2
  "perseus-test-flag-1": boolean;
3
3
  "perseus-test-flag-2": boolean;
4
- "image-widget-upgrade-gif-controls": boolean;
5
4
  "interactive-graph-vector": boolean;
6
5
  "interactive-graph-not-scored": boolean;
7
6
  "input-number-to-numeric-input": boolean;
@@ -13,7 +12,6 @@ declare const DEFAULT_FEATURE_FLAGS: {
13
12
  export declare function getFeatureFlags(overrides?: Partial<typeof DEFAULT_FEATURE_FLAGS>): {
14
13
  "perseus-test-flag-1": boolean;
15
14
  "perseus-test-flag-2": boolean;
16
- "image-widget-upgrade-gif-controls": boolean;
17
15
  "interactive-graph-vector": boolean;
18
16
  "interactive-graph-not-scored": boolean;
19
17
  "input-number-to-numeric-input": boolean;
@@ -0,0 +1,22 @@
1
+ import type { ViewModel } from "./item-flipbook-view-model";
2
+ export declare function createItemFlipbookModel(observer: () => void): ItemFlipbookModel;
3
+ export declare class ItemFlipbookModel {
4
+ private observer;
5
+ private textareaValue;
6
+ private targetItemIndex;
7
+ constructor(observer: () => void);
8
+ present(): ViewModel;
9
+ setTextareaValue: (newValue: string) => void;
10
+ nextItem: () => void;
11
+ previousItem: () => void;
12
+ requestItemNumber: (requested: string) => void;
13
+ private getItemIndex;
14
+ private presentItemJsonInput;
15
+ private clampItemIndex;
16
+ private getNumberOfItems;
17
+ private getItemJsonDocuments;
18
+ private presentItemDisplay;
19
+ private presentSelectedItemNumber;
20
+ private presentSelectedItemNumberValue;
21
+ private presentTotalItems;
22
+ }
@@ -0,0 +1,57 @@
1
+ import type { PerseusItem } from "@khanacademy/perseus-core";
2
+ export type NoItem = {
3
+ status: "no-item";
4
+ };
5
+ export type ParseError = {
6
+ status: "parse-error";
7
+ message: string;
8
+ };
9
+ export type Item = {
10
+ status: "item";
11
+ item: PerseusItem;
12
+ key: string;
13
+ };
14
+ /**
15
+ * The information displayed in the item display section of the UI. One of:
16
+ * - no item (if no data has been entered)
17
+ * - a parse error from the currently selected item
18
+ * - a valid item
19
+ */
20
+ export type ItemDisplay = NoItem | ParseError | Item;
21
+ export declare function noItem(): NoItem;
22
+ export declare function parseError(message: string): ParseError;
23
+ export declare function item(item: PerseusItem, key: string): Item;
24
+ export declare function isItem(itemDisplay: ItemDisplay): itemDisplay is Item;
25
+ export interface InputFieldChangeEvent {
26
+ target: {
27
+ value: string;
28
+ };
29
+ }
30
+ export interface InputField {
31
+ value: string;
32
+ onChange: (event: InputFieldChangeEvent) => void;
33
+ }
34
+ /**
35
+ * An abstract representation of the view. The ViewModel contains exactly the
36
+ * values that will be rendered in React components, but it has no dependency
37
+ * on React. This makes it easy to write tests that assert on exactly what the
38
+ * user will see, yet don't need to render components.
39
+ */
40
+ export interface ViewModel {
41
+ /**
42
+ * Input where the user can type in newline-separated Perseus item JSON
43
+ * objects to render.
44
+ */
45
+ itemJsonInput: InputField;
46
+ /**
47
+ * Displays and controls which Perseus item from the `itemJsonInput` is
48
+ * currently selected for display.
49
+ */
50
+ selectedItemNumber: InputField;
51
+ /** The number of items, formatted for display. */
52
+ totalItems: string;
53
+ nextItem: () => void;
54
+ previousItem: () => void;
55
+ /** The data that should be rendered for the currently selected item. */
56
+ itemDisplay: ItemDisplay;
57
+ }
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ import type { ViewModel } from "./item-flipbook-view-model";
3
+ interface ViewProps {
4
+ viewModel: ViewModel;
5
+ }
6
+ export declare function ItemFlipbookView({ viewModel }: ViewProps): React.JSX.Element;
7
+ export {};
@@ -0,0 +1,2 @@
1
+ import * as React from "react";
2
+ export declare function ItemFlipbook(): React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { ParseFailureDetail, PerseusItem, Result } from "@khanacademy/perseus-core";
2
+ export declare function safeParsePerseusItem(data: unknown): Result<PerseusItem, ParseFailureDetail>;
@@ -25,7 +25,6 @@ export declare const useItemRenderer: (item: PerseusItem, apiOptions?: APIOption
25
25
  baseElements?: {
26
26
  Link: React.ComponentType<any>;
27
27
  };
28
- imagePreloader?: (dimensions: import("../types").Dimensions) => React.ReactNode;
29
28
  trackInteraction?: (args: {
30
29
  type: string;
31
30
  id: string;
@@ -33,13 +32,9 @@ export declare const useItemRenderer: (item: PerseusItem, apiOptions?: APIOption
33
32
  } & Partial<import("../types").TrackingGradedGroupExtraArguments> & Partial<{
34
33
  visible: number;
35
34
  }>) => void;
36
- nativeKeypadProxy?: (blur: () => void) => import("@khanacademy/math-input").KeypadAPI;
37
35
  isMobileApp?: boolean;
38
- setDrawingAreaAvailable?: (arg1: boolean) => unknown;
39
36
  hintProgressColor?: string;
40
- canScrollPage?: boolean;
41
- editorChangeDelay?: number;
42
- flags?: Record<"image-widget-upgrade-gif-controls" | "input-number-to-numeric-input", boolean>;
37
+ flags?: Record<"input-number-to-numeric-input", boolean>;
43
38
  };
44
39
  toggleMobile: (isMobile: boolean) => void;
45
40
  toggleRtl: (isRtl: boolean) => void;
package/dist/types.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import type { ILogger } from "./logging/log";
2
2
  import type { SizeClass } from "./util/sizing-utils";
3
3
  import type { WidgetPromptJSON } from "./widget-ai-utils/prompt-types";
4
- import type { KeypadAPI } from "@khanacademy/math-input";
5
4
  import type { Hint, PerseusAnswerArea, PerseusFeatureFlags, PerseusWidget, PerseusWidgetsMap, AnalyticsEventHandlerFn, Version, LabelImageMarkerPublicData, PerseusLabelImageMarker, ShowSolutions } from "@khanacademy/perseus-core";
6
5
  import type { LinterContextProps } from "@khanacademy/perseus-linter";
7
6
  import type { Result } from "@khanacademy/wonder-blocks-data";
@@ -144,11 +143,6 @@ export type APIOptions = Readonly<{
144
143
  */
145
144
  Link: React.ComponentType<any>;
146
145
  };
147
- /**
148
- * Function that takes dimensions and returns a React component
149
- * to display while an image is loading.
150
- */
151
- imagePreloader?: (dimensions: Dimensions) => React.ReactNode;
152
146
  /**
153
147
  * A function that is called when the user has interacted with a widget. It
154
148
  * also includes any extra parameters that the originating widget provided.
@@ -163,51 +157,12 @@ export type APIOptions = Readonly<{
163
157
  * input components.
164
158
  */
165
159
  customKeypad?: boolean;
166
- /**
167
- * If this is provided, it is called instead of appending an instance
168
- * of `math-input`'s keypad to the body. This is used by the native
169
- * apps so they can have the keypad be defined on the native side.
170
- * It is called with an function that, when called, blurs the input,
171
- * and is expected to return an object of the shape
172
- * keypadElementPropType from math-input/src/prop-types.js.
173
- */
174
- nativeKeypadProxy?: (blur: () => void) => KeypadAPI;
175
160
  /** Indicates whether or not to use mobile styling. */
176
161
  isMobile?: boolean;
177
162
  /** Indicates whether or not to use mobile app styling. */
178
163
  isMobileApp?: boolean;
179
- /** A function, called with a bool indicating whether use of the
180
- * drawing area (scratchpad) should be allowed/disallowed.
181
- *
182
- * Previously handled by `Khan.scratchpad.enable/disable`
183
- * @deprecated setDrawingAreaAvailable is not used in frontend code.
184
- */
185
- setDrawingAreaAvailable?: (arg1: boolean) => unknown;
186
164
  /** The color used for the hint progress indicator (eg. 1 / 3) */
187
165
  hintProgressColor?: string;
188
- /**
189
- * Whether this Renderer is allowed to auto-scroll the rest of the
190
- * page. For example, if this is enabled, the most recently used
191
- * radio widget will attempt to keep the "selected" answer in view
192
- * after entering review mode.
193
- *
194
- * Defaults to `false`.
195
- * @deprecated canScrollPage has no effect.
196
- */
197
- canScrollPage?: boolean;
198
- /**
199
- * The value in milliseconds by which the local state of content
200
- * in a editor is delayed before propagated to a prop. For example,
201
- * when text is typed in the text area of an Editor component,
202
- * there will be a delay equal to the value of `editorChangeDelay`
203
- * before the change is propagated. This is added for better
204
- * responsiveness of the editor when used in certain contexts such
205
- * as StructuredItem exercises where constant re-rendering for each
206
- * keystroke caused text typed in the text area to appear in it
207
- * only after a good few seconds.
208
- * @deprecated editorChangeDelay has no effect.
209
- */
210
- editorChangeDelay?: number;
211
166
  /**
212
167
  * Feature flags that can be passed from consuming application.
213
168
  * Define the feature flag name in packages/perseus-core/src/feature-flags.ts
@@ -323,15 +278,12 @@ export interface PerseusDependenciesV2 {
323
278
  */
324
279
  export type APIOptionsWithDefaults = Readonly<APIOptions & {
325
280
  baseElements: NonNullable<APIOptions["baseElements"]>;
326
- canScrollPage: NonNullable<APIOptions["canScrollPage"]>;
327
- editorChangeDelay: NonNullable<APIOptions["editorChangeDelay"]>;
328
281
  isArticle: NonNullable<APIOptions["isArticle"]>;
329
282
  isMobile: NonNullable<APIOptions["isMobile"]>;
330
283
  isMobileApp: NonNullable<APIOptions["isMobileApp"]>;
331
284
  editingDisabled: NonNullable<APIOptions["editingDisabled"]>;
332
285
  onFocusChange: NonNullable<APIOptions["onFocusChange"]>;
333
286
  readOnly: NonNullable<APIOptions["readOnly"]>;
334
- setDrawingAreaAvailable: NonNullable<APIOptions["setDrawingAreaAvailable"]>;
335
287
  showAlignmentOptions: NonNullable<APIOptions["showAlignmentOptions"]>;
336
288
  }>;
337
289
  export type Tracking = "" | "all";
@@ -116,7 +116,6 @@ export declare class Graphie {
116
116
  onMouseOut?: MouseHandler | null;
117
117
  onMouseUp?: MouseHandler | null;
118
118
  allowScratchpad?: boolean;
119
- setDrawingAreaAvailable?: (available: boolean) => void;
120
119
  }): void;
121
120
  addToMouseLayerWrapper(el: HTMLElement): void;
122
121
  addToVisibleLayerWrapper(el: HTMLElement): void;
@@ -3,7 +3,6 @@ import * as React from "react";
3
3
  import type { WidgetProps } from "./types";
4
4
  import type { LinterContextProps } from "@khanacademy/perseus-linter";
5
5
  type Props = {
6
- shouldHighlight: boolean;
7
6
  type: string;
8
7
  id: string;
9
8
  widgetProps: WidgetProps<any, PerseusWidgetOptions>;
@@ -36,7 +36,6 @@ declare const _default: {
36
36
  baseElements?: {
37
37
  Link: React.ComponentType<any>;
38
38
  };
39
- imagePreloader?: (dimensions: import("../../types").Dimensions) => React.ReactNode;
40
39
  trackInteraction?: (args: {
41
40
  type: string;
42
41
  id: string;
@@ -45,25 +44,18 @@ declare const _default: {
45
44
  visible: number;
46
45
  }>) => void;
47
46
  customKeypad?: boolean;
48
- nativeKeypadProxy?: (blur: () => void) => import("@khanacademy/math-input").KeypadAPI;
49
47
  isMobile?: boolean;
50
48
  isMobileApp?: boolean;
51
- setDrawingAreaAvailable?: (arg1: boolean) => unknown;
52
49
  hintProgressColor?: string;
53
- canScrollPage?: boolean;
54
- editorChangeDelay?: number;
55
- flags?: Record<"image-widget-upgrade-gif-controls" | "input-number-to-numeric-input", boolean>;
50
+ flags?: Record<"input-number-to-numeric-input", boolean>;
56
51
  }> & {
57
52
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
58
- canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
59
- editorChangeDelay: NonNullable<import("../..").APIOptions["editorChangeDelay"]>;
60
53
  isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
61
54
  isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
62
55
  isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
63
56
  editingDisabled: NonNullable<import("../..").APIOptions["editingDisabled"]>;
64
57
  onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
65
58
  readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
66
- setDrawingAreaAvailable: NonNullable<import("../..").APIOptions["setDrawingAreaAvailable"]>;
67
59
  showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
68
60
  }>;
69
61
  keypadElement?: any;
@@ -26,7 +26,6 @@ export declare const Expression: React.ForwardRefExoticComponent<PerseusExpressi
26
26
  baseElements?: {
27
27
  Link: React.ComponentType<any>;
28
28
  };
29
- imagePreloader?: (dimensions: import("../../types").Dimensions) => React.ReactNode;
30
29
  trackInteraction?: (args: {
31
30
  type: string;
32
31
  id: string;
@@ -35,25 +34,18 @@ export declare const Expression: React.ForwardRefExoticComponent<PerseusExpressi
35
34
  visible: number;
36
35
  }>) => void;
37
36
  customKeypad?: boolean;
38
- nativeKeypadProxy?: (blur: () => void) => import("@khanacademy/math-input").KeypadAPI;
39
37
  isMobile?: boolean;
40
38
  isMobileApp?: boolean;
41
- setDrawingAreaAvailable?: (arg1: boolean) => unknown;
42
39
  hintProgressColor?: string;
43
- canScrollPage?: boolean;
44
- editorChangeDelay?: number;
45
- flags?: Record<"image-widget-upgrade-gif-controls" | "input-number-to-numeric-input", boolean>;
40
+ flags?: Record<"input-number-to-numeric-input", boolean>;
46
41
  }> & {
47
42
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
48
- canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
49
- editorChangeDelay: NonNullable<import("../..").APIOptions["editorChangeDelay"]>;
50
43
  isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
51
44
  isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
52
45
  isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
53
46
  editingDisabled: NonNullable<import("../..").APIOptions["editingDisabled"]>;
54
47
  onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
55
48
  readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
56
- setDrawingAreaAvailable: NonNullable<import("../..").APIOptions["setDrawingAreaAvailable"]>;
57
49
  showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
58
50
  }>;
59
51
  keypadElement?: any;
@@ -106,7 +98,6 @@ declare const _default: {
106
98
  baseElements?: {
107
99
  Link: React.ComponentType<any>;
108
100
  };
109
- imagePreloader?: (dimensions: import("../../types").Dimensions) => React.ReactNode;
110
101
  trackInteraction?: (args: {
111
102
  type: string;
112
103
  id: string;
@@ -115,25 +106,18 @@ declare const _default: {
115
106
  visible: number;
116
107
  }>) => void;
117
108
  customKeypad?: boolean;
118
- nativeKeypadProxy?: (blur: () => void) => import("@khanacademy/math-input").KeypadAPI;
119
109
  isMobile?: boolean;
120
110
  isMobileApp?: boolean;
121
- setDrawingAreaAvailable?: (arg1: boolean) => unknown;
122
111
  hintProgressColor?: string;
123
- canScrollPage?: boolean;
124
- editorChangeDelay?: number;
125
- flags?: Record<"image-widget-upgrade-gif-controls" | "input-number-to-numeric-input", boolean>;
112
+ flags?: Record<"input-number-to-numeric-input", boolean>;
126
113
  }> & {
127
114
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
128
- canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
129
- editorChangeDelay: NonNullable<import("../..").APIOptions["editorChangeDelay"]>;
130
115
  isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
131
116
  isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
132
117
  isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
133
118
  editingDisabled: NonNullable<import("../..").APIOptions["editingDisabled"]>;
134
119
  onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
135
120
  readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
136
- setDrawingAreaAvailable: NonNullable<import("../..").APIOptions["setDrawingAreaAvailable"]>;
137
121
  showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
138
122
  }>;
139
123
  keypadElement?: any;
@@ -0,0 +1,2 @@
1
+ export { MovableLine } from "./movable-line";
2
+ export { getMovableLineKeyboardConstraint, insetTipAlongRay, trimRange, } from "./util";
@@ -0,0 +1,14 @@
1
+ import * as React from "react";
2
+ import type { vec } from "mafs";
3
+ export interface LineProps {
4
+ start: vec.Vector2;
5
+ end: vec.Vector2;
6
+ ariaLabel?: string;
7
+ ariaDescribedBy?: string;
8
+ extend?: undefined | {
9
+ start: boolean;
10
+ end: boolean;
11
+ };
12
+ onMove: (newStart: vec.Vector2) => unknown;
13
+ }
14
+ export declare const Line: (props: LineProps) => React.JSX.Element;
@@ -0,0 +1,18 @@
1
+ import * as React from "react";
2
+ import type { vec } from "mafs";
3
+ export interface MovableLineProps {
4
+ points: Readonly<[vec.Vector2, vec.Vector2]>;
5
+ ariaLabels?: {
6
+ point1AriaLabel?: string;
7
+ point2AriaLabel?: string;
8
+ grabHandleAriaLabel?: string;
9
+ };
10
+ ariaDescribedBy?: string;
11
+ extend?: {
12
+ start: boolean;
13
+ end: boolean;
14
+ };
15
+ onMovePoint?: (endpointIndex: number, destination: vec.Vector2) => unknown;
16
+ onMoveLine?: (newStart: vec.Vector2) => unknown;
17
+ }
18
+ export declare const MovableLine: (props: MovableLineProps) => React.JSX.Element;
@@ -1,24 +1,5 @@
1
1
  import { vec } from "mafs";
2
- import * as React from "react";
3
- import type { AriaLive } from "../../types";
4
2
  import type { Interval } from "mafs";
5
- type Props = {
6
- points: Readonly<[vec.Vector2, vec.Vector2]>;
7
- ariaLabels?: {
8
- point1AriaLabel?: string;
9
- point2AriaLabel?: string;
10
- grabHandleAriaLabel?: string;
11
- };
12
- ariaDescribedBy?: string;
13
- ariaLive?: AriaLive;
14
- extend?: {
15
- start: boolean;
16
- end: boolean;
17
- };
18
- onMovePoint?: (endpointIndex: number, destination: vec.Vector2) => unknown;
19
- onMoveLine?: (newStart: vec.Vector2) => unknown;
20
- };
21
- export declare const MovableLine: (props: Props) => React.JSX.Element;
22
3
  export declare const getMovableLineKeyboardConstraint: (line: [vec.Vector2, vec.Vector2], snapStep: vec.Vector2, pointIndex: number) => {
23
4
  up: vec.Vector2;
24
5
  down: vec.Vector2;
@@ -33,4 +14,3 @@ export declare function trimRange(range: [Interval, Interval], graphDimensionsIn
33
14
  * viewport edge.
34
15
  */
35
16
  export declare function insetTipAlongRay(tail: vec.Vector2, tip: vec.Vector2, range: [Interval, Interval], graphDimensionsInPixels: vec.Vector2): vec.Vector2;
36
- export {};
@@ -1,13 +1,11 @@
1
1
  import * as React from "react";
2
2
  import type { CSSCursor } from "./css-cursor";
3
- import type { AriaLive } from "../../types";
4
3
  import type { KeyboardMovementConstraint } from "../use-draggable";
5
4
  import type { vec } from "mafs";
6
5
  type Props = {
7
6
  point: vec.Vector2;
8
7
  ariaDescribedBy?: string;
9
8
  ariaLabel?: string;
10
- ariaLive?: AriaLive;
11
9
  color?: string;
12
10
  constrain?: KeyboardMovementConstraint;
13
11
  cursor?: CSSCursor | undefined;
@@ -1,5 +1,4 @@
1
1
  import * as React from "react";
2
- import type { AriaLive } from "../../types";
3
2
  import type { KeyboardMovementConstraint } from "../use-draggable";
4
3
  import type { vec } from "mafs";
5
4
  type Params = {
@@ -7,7 +6,6 @@ type Params = {
7
6
  angle: number;
8
7
  ariaDescribedBy?: string;
9
8
  ariaLabel?: string;
10
- ariaLive?: AriaLive;
11
9
  constrain?: KeyboardMovementConstraint;
12
10
  sequenceNumber?: number;
13
11
  onMove?: ((newPoint: vec.Vector2) => unknown) | undefined;
@@ -1,13 +1,11 @@
1
1
  import * as React from "react";
2
2
  import type { CSSCursor } from "./css-cursor";
3
- import type { AriaLive } from "../../types";
4
3
  import type { KeyboardMovementConstraint } from "../use-draggable";
5
4
  import type { vec } from "mafs";
6
5
  type Params = {
7
6
  point: vec.Vector2;
8
7
  ariaDescribedBy?: string;
9
8
  ariaLabel?: string;
10
- ariaLive?: AriaLive;
11
9
  color?: string | undefined;
12
10
  constrain?: KeyboardMovementConstraint;
13
11
  cursor?: CSSCursor | undefined;
@@ -1,7 +1,13 @@
1
1
  import type { InteractiveGraphStateAnnouncement } from "../types";
2
2
  import type { PerseusStrings } from "@khanacademy/perseus/strings";
3
+ import type { Coord } from "@khanacademy/perseus-core";
3
4
  export declare function getAnnouncementText(state: InteractiveGraphStateAnnouncement, strings: PerseusStrings, locale: string): string;
4
5
  export declare function srCircleRadiusPointLabel(x: number, y: number, centerX: number, strings: PerseusStrings, locale: string): string;
5
6
  export declare function srCircleCenterLabel(x: number, y: number, strings: PerseusStrings, locale: string): string;
7
+ type GraphLocations = "origin" | "x-axis" | "y-axis" | 1 | 2 | 3 | 4;
8
+ export declare function getCoordQuadrant(coord: Coord): GraphLocations;
9
+ export declare function getQuadraticVertexString(vertex: Coord, strings: PerseusStrings): string;
10
+ export declare function getQuadraticPointString(pointNumber: any, coord: Coord, strings: PerseusStrings, locale: string): string;
6
11
  export declare function srFormatNumber(a: number, locale: string, maximumFractionDigits?: number): string;
7
12
  export declare function getPiMultiple(a: number): string | null;
13
+ export {};
@@ -1,6 +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
5
  import type { Coord } from "@khanacademy/perseus-core";
5
6
  import type { Interval } from "mafs";
6
7
  /**
@@ -14,9 +15,14 @@ export declare const getIntersectionOfRayWithBox: (initialPoint: vec.Vector2, th
14
15
  export declare function getArrayWithoutDuplicates(array: Array<Coord>): Array<Coord>;
15
16
  export declare function getSlopeStringForLine(line: PairOfPoints, strings: PerseusStrings): string;
16
17
  export declare function getInterceptStringForLine(line: PairOfPoints, strings: PerseusStrings, locale: string): string;
17
- export declare function getQuadraticVertexString(vertex: Coord, strings: PerseusStrings): string;
18
- export declare function getQuadraticPointString(pointNumber: any, coord: Coord, strings: PerseusStrings, locale: string): string;
19
18
  export declare function getQuadraticXIntercepts(a: number, b: number, c: number): number[];
19
+ /**
20
+ * Calculate the vertex of a quadratic from its coefficients.
21
+ *
22
+ * When a === 0 the parabola degenerates to a line and has no vertex, so
23
+ * we return undefined; otherwise the vertex is (-b/2a, c - b²/4a).
24
+ */
25
+ export declare function getQuadraticVertex(coeffs: QuadraticCoefficient): Coord | undefined;
20
26
  /**
21
27
  * Given a list of points, return the angle made by the point at index i
22
28
  * with the points at indices i - 1 and i + 1.
@@ -183,7 +183,6 @@ declare class InteractiveGraph extends React.Component<Props, State> {
183
183
  baseElements?: {
184
184
  Link: React.ComponentType<any>;
185
185
  };
186
- imagePreloader?: (dimensions: import("../../types").Dimensions) => React.ReactNode;
187
186
  trackInteraction?: (args: {
188
187
  type: string;
189
188
  id: string;
@@ -192,25 +191,18 @@ declare class InteractiveGraph extends React.Component<Props, State> {
192
191
  visible: number;
193
192
  }>) => void;
194
193
  customKeypad?: boolean;
195
- nativeKeypadProxy?: (blur: () => void) => import("@khanacademy/math-input").KeypadAPI;
196
194
  isMobile?: boolean;
197
195
  isMobileApp?: boolean;
198
- setDrawingAreaAvailable?: (arg1: boolean) => unknown;
199
196
  hintProgressColor?: string;
200
- canScrollPage?: boolean;
201
- editorChangeDelay?: number;
202
- flags?: Record<"image-widget-upgrade-gif-controls" | "input-number-to-numeric-input", boolean>;
197
+ flags?: Record<"input-number-to-numeric-input", boolean>;
203
198
  }> & {
204
199
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
205
- canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
206
- editorChangeDelay: NonNullable<import("../..").APIOptions["editorChangeDelay"]>;
207
200
  isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
208
201
  isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
209
202
  isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
210
203
  editingDisabled: NonNullable<import("../..").APIOptions["editingDisabled"]>;
211
204
  onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
212
205
  readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
213
- setDrawingAreaAvailable: NonNullable<import("../..").APIOptions["setDrawingAreaAvailable"]>;
214
206
  showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
215
207
  }>;
216
208
  keypadElement?: any;
@@ -0,0 +1,2 @@
1
+ export declare function resolveVisibleLabel(pointLabels: string[] | undefined, index: number): string | undefined;
2
+ export declare function getEffectivePointLabels(showPointLabels: boolean | undefined, pointLabels: string[] | undefined, count: number): string[] | undefined;