@khanacademy/perseus 77.3.1 → 77.4.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 +20 -19
  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 +20 -19
  10. package/dist/index.js.map +1 -1
  11. package/dist/server-item-renderer.d.ts +1 -1
  12. package/dist/strings.d.ts +2 -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 +2 -0
  16. package/dist/testing/item-renderer-hooks.d.ts +1 -1
  17. package/dist/types.d.ts +3 -0
  18. package/dist/widgets/dropdown/dropdown.d.ts +2 -1
  19. package/dist/widgets/expression/expression.d.ts +4 -2
  20. package/dist/widgets/interactive-graphs/backgrounds/utils.d.ts +8 -0
  21. package/dist/widgets/interactive-graphs/graphs/exponential.d.ts +0 -1
  22. package/dist/widgets/interactive-graphs/graphs/logarithm.d.ts +0 -1
  23. package/dist/widgets/interactive-graphs/graphs/utils.d.ts +15 -7
  24. package/dist/widgets/interactive-graphs/interactive-graph.d.ts +7 -4
  25. package/dist/widgets/interactive-graphs/stateful-mafs-graph.d.ts +1 -0
  26. package/dist/widgets/label-image/label-image.d.ts +2 -1
  27. package/dist/widgets/mock-widgets/mock-widget.d.ts +2 -1
  28. package/dist/widgets/numeric-input/numeric-input.class.d.ts +2 -1
  29. package/dist/widgets/numeric-input/numeric-input.d.ts +3 -2
  30. package/dist/widgets/table/table.d.ts +2 -1
  31. package/dist/widgets.d.ts +5 -0
  32. package/package.json +7 -7
  33. package/dist/widgets/interactive-graphs/interactive-graph-question-builder.d.ts +0 -196
@@ -18,6 +18,7 @@ declare const _default: {
18
18
  widgetIndex: number;
19
19
  alignment: string | null | undefined;
20
20
  static: boolean | null | undefined;
21
+ graded?: boolean | null;
21
22
  problemNum: number | null | undefined;
22
23
  apiOptions: Readonly<Readonly<{
23
24
  isArticle?: boolean;
@@ -51,7 +52,7 @@ declare const _default: {
51
52
  hintProgressColor?: string;
52
53
  canScrollPage?: boolean;
53
54
  editorChangeDelay?: number;
54
- flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-absolute-value" | "interactive-graph-tangent" | "interactive-graph-logarithm" | "interactive-graph-exponent" | "interactive-graph-vector", boolean>;
55
+ flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-absolute-value" | "interactive-graph-tangent" | "interactive-graph-logarithm" | "interactive-graph-exponent" | "interactive-graph-vector" | "interactive-graph-not-scored", boolean>;
55
56
  }> & {
56
57
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
57
58
  canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
@@ -8,6 +8,7 @@ export declare const Expression: React.ForwardRefExoticComponent<PerseusExpressi
8
8
  widgetIndex: number;
9
9
  alignment: string | null | undefined;
10
10
  static: boolean | null | undefined;
11
+ graded?: boolean | null;
11
12
  problemNum: number | null | undefined;
12
13
  apiOptions: Readonly<Readonly<{
13
14
  isArticle?: boolean;
@@ -41,7 +42,7 @@ export declare const Expression: React.ForwardRefExoticComponent<PerseusExpressi
41
42
  hintProgressColor?: string;
42
43
  canScrollPage?: boolean;
43
44
  editorChangeDelay?: number;
44
- flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-absolute-value" | "interactive-graph-tangent" | "interactive-graph-logarithm" | "interactive-graph-exponent" | "interactive-graph-vector", boolean>;
45
+ flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-absolute-value" | "interactive-graph-tangent" | "interactive-graph-logarithm" | "interactive-graph-exponent" | "interactive-graph-vector" | "interactive-graph-not-scored", boolean>;
45
46
  }> & {
46
47
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
47
48
  canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
@@ -87,6 +88,7 @@ declare const _default: {
87
88
  widgetIndex: number;
88
89
  alignment: string | null | undefined;
89
90
  static: boolean | null | undefined;
91
+ graded?: boolean | null;
90
92
  problemNum: number | null | undefined;
91
93
  apiOptions: Readonly<Readonly<{
92
94
  isArticle?: boolean;
@@ -120,7 +122,7 @@ declare const _default: {
120
122
  hintProgressColor?: string;
121
123
  canScrollPage?: boolean;
122
124
  editorChangeDelay?: number;
123
- flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-absolute-value" | "interactive-graph-tangent" | "interactive-graph-logarithm" | "interactive-graph-exponent" | "interactive-graph-vector", boolean>;
125
+ flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-absolute-value" | "interactive-graph-tangent" | "interactive-graph-logarithm" | "interactive-graph-exponent" | "interactive-graph-vector" | "interactive-graph-not-scored", boolean>;
124
126
  }> & {
125
127
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
126
128
  canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
@@ -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;
@@ -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;
@@ -1,4 +1,5 @@
1
1
  import * as React from "react";
2
+ import { PerseusI18nContext } from "../../components/i18n-context";
2
3
  import type { StatefulMafsGraphType } from "./stateful-mafs-graph";
3
4
  import type { QuadraticGraphState } from "./types";
4
5
  import type { Coord } from "../../interactive2/types";
@@ -125,6 +126,8 @@ type DefaultProps = {
125
126
  };
126
127
  type State = any;
127
128
  declare class InteractiveGraph extends React.Component<Props, State> {
129
+ static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
130
+ context: React.ContextType<typeof PerseusI18nContext>;
128
131
  mafsRef: React.RefObject<StatefulMafsGraphType>;
129
132
  static defaultProps: DefaultProps;
130
133
  getUserInput(): PerseusInteractiveGraphUserInput;
@@ -158,12 +161,11 @@ declare class InteractiveGraph extends React.Component<Props, State> {
158
161
  widgetIndex: number;
159
162
  alignment: string | null | undefined;
160
163
  static: boolean | null | undefined;
164
+ graded?: boolean | null;
161
165
  problemNum: number | null | undefined;
162
166
  apiOptions: Readonly<Readonly<{
163
167
  isArticle?: boolean;
164
- onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement? /**
165
- * Whether to show the arrows on the axis.
166
- */: HTMLElement) => unknown;
168
+ onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
167
169
  showAlignmentOptions?: boolean;
168
170
  readOnly?: boolean;
169
171
  editingDisabled?: boolean;
@@ -193,7 +195,7 @@ declare class InteractiveGraph extends React.Component<Props, State> {
193
195
  hintProgressColor?: string;
194
196
  canScrollPage?: boolean;
195
197
  editorChangeDelay?: number;
196
- flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-absolute-value" | "interactive-graph-tangent" | "interactive-graph-logarithm" | "interactive-graph-exponent" | "interactive-graph-vector", boolean>;
198
+ flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-absolute-value" | "interactive-graph-tangent" | "interactive-graph-logarithm" | "interactive-graph-exponent" | "interactive-graph-vector" | "interactive-graph-not-scored", boolean>;
197
199
  }> & {
198
200
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
199
201
  canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
@@ -290,5 +292,6 @@ declare const _default: {
290
292
  getStartUserInput: typeof getStartUserInput;
291
293
  getCorrectUserInput: typeof getCorrectUserInput;
292
294
  getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
295
+ supportsUngraded: true;
293
296
  };
294
297
  export default _default;
@@ -27,6 +27,7 @@ export type StatefulMafsGraphProps = {
27
27
  static: InteractiveGraphProps["static"];
28
28
  showAxisArrows: InteractiveGraphProps["showAxisArrows"];
29
29
  widgetId: string;
30
+ graded?: boolean | null;
30
31
  };
31
32
  export type StatefulMafsGraphType = {
32
33
  getUserInput: () => PerseusInteractiveGraphUserInput;
@@ -117,6 +117,7 @@ declare const _default: {
117
117
  widgetIndex: number;
118
118
  alignment: string | null | undefined;
119
119
  static: boolean | null | undefined;
120
+ graded?: boolean | null;
120
121
  problemNum: number | null | undefined;
121
122
  apiOptions: Readonly<Readonly<{
122
123
  isArticle?: boolean;
@@ -150,7 +151,7 @@ declare const _default: {
150
151
  hintProgressColor?: string;
151
152
  canScrollPage?: boolean;
152
153
  editorChangeDelay?: number;
153
- flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-absolute-value" | "interactive-graph-tangent" | "interactive-graph-logarithm" | "interactive-graph-exponent" | "interactive-graph-vector", boolean>;
154
+ flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-absolute-value" | "interactive-graph-tangent" | "interactive-graph-logarithm" | "interactive-graph-exponent" | "interactive-graph-vector" | "interactive-graph-not-scored", boolean>;
154
155
  }> & {
155
156
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
156
157
  canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
@@ -41,6 +41,7 @@ declare class MockWidgetComponent extends React.Component<Props> implements Widg
41
41
  widgetId: string;
42
42
  widgetIndex: number;
43
43
  alignment: string | null | undefined;
44
+ graded?: boolean | null;
44
45
  problemNum: number | null | undefined;
45
46
  apiOptions: Readonly<Readonly<{
46
47
  isArticle?: boolean;
@@ -74,7 +75,7 @@ declare class MockWidgetComponent extends React.Component<Props> implements Widg
74
75
  hintProgressColor?: string;
75
76
  canScrollPage?: boolean;
76
77
  editorChangeDelay?: number;
77
- flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-absolute-value" | "interactive-graph-tangent" | "interactive-graph-logarithm" | "interactive-graph-exponent" | "interactive-graph-vector", boolean>;
78
+ flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-absolute-value" | "interactive-graph-tangent" | "interactive-graph-logarithm" | "interactive-graph-exponent" | "interactive-graph-vector" | "interactive-graph-not-scored", boolean>;
78
79
  }> & {
79
80
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
80
81
  canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
@@ -48,6 +48,7 @@ export declare class NumericInput extends React.Component<NumericInputProps> imp
48
48
  widgetId: string;
49
49
  widgetIndex: number;
50
50
  alignment: string | null | undefined;
51
+ graded?: boolean | null;
51
52
  problemNum: number | null | undefined;
52
53
  apiOptions: Readonly<Readonly<{
53
54
  isArticle?: boolean;
@@ -81,7 +82,7 @@ export declare class NumericInput extends React.Component<NumericInputProps> imp
81
82
  hintProgressColor?: string;
82
83
  canScrollPage?: boolean;
83
84
  editorChangeDelay?: number;
84
- flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-absolute-value" | "interactive-graph-tangent" | "interactive-graph-logarithm" | "interactive-graph-exponent" | "interactive-graph-vector", boolean>;
85
+ flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-absolute-value" | "interactive-graph-tangent" | "interactive-graph-logarithm" | "interactive-graph-exponent" | "interactive-graph-vector" | "interactive-graph-not-scored", boolean>;
85
86
  }> & {
86
87
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
87
88
  canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
@@ -11,6 +11,7 @@ export declare const NumericInputComponent: React.ForwardRefExoticComponent<impo
11
11
  widgetIndex: number;
12
12
  alignment: string | null | undefined;
13
13
  static: boolean | null | undefined;
14
+ graded?: boolean | null;
14
15
  problemNum: number | null | undefined;
15
16
  apiOptions: Readonly<Readonly<{
16
17
  isArticle?: boolean;
@@ -44,7 +45,7 @@ export declare const NumericInputComponent: React.ForwardRefExoticComponent<impo
44
45
  hintProgressColor?: string;
45
46
  canScrollPage?: boolean;
46
47
  editorChangeDelay?: number;
47
- flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-absolute-value" | "interactive-graph-tangent" | "interactive-graph-logarithm" | "interactive-graph-exponent" | "interactive-graph-vector", boolean>;
48
+ flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-absolute-value" | "interactive-graph-tangent" | "interactive-graph-logarithm" | "interactive-graph-exponent" | "interactive-graph-vector" | "interactive-graph-not-scored", boolean>;
48
49
  }> & {
49
50
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
50
51
  canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
@@ -103,7 +104,7 @@ export declare const NumericInputComponent: React.ForwardRefExoticComponent<impo
103
104
  hintProgressColor?: string;
104
105
  canScrollPage?: boolean;
105
106
  editorChangeDelay?: number;
106
- flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-absolute-value" | "interactive-graph-tangent" | "interactive-graph-logarithm" | "interactive-graph-exponent" | "interactive-graph-vector", boolean>;
107
+ flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-absolute-value" | "interactive-graph-tangent" | "interactive-graph-logarithm" | "interactive-graph-exponent" | "interactive-graph-vector" | "interactive-graph-not-scored", boolean>;
107
108
  }> & {
108
109
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
109
110
  canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
@@ -49,6 +49,7 @@ declare class Table extends React.Component<Props> implements Widget {
49
49
  widgetIndex: number;
50
50
  alignment: string | null | undefined;
51
51
  static: boolean | null | undefined;
52
+ graded?: boolean | null;
52
53
  problemNum: number | null | undefined;
53
54
  apiOptions: Readonly<Readonly<{
54
55
  isArticle?: boolean;
@@ -82,7 +83,7 @@ declare class Table extends React.Component<Props> implements Widget {
82
83
  hintProgressColor?: string;
83
84
  canScrollPage?: boolean;
84
85
  editorChangeDelay?: number;
85
- flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-absolute-value" | "interactive-graph-tangent" | "interactive-graph-logarithm" | "interactive-graph-exponent" | "interactive-graph-vector", boolean>;
86
+ flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-absolute-value" | "interactive-graph-tangent" | "interactive-graph-logarithm" | "interactive-graph-exponent" | "interactive-graph-vector" | "interactive-graph-not-scored", boolean>;
86
87
  }> & {
87
88
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
88
89
  canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
package/dist/widgets.d.ts CHANGED
@@ -43,6 +43,11 @@ export declare const getAllWidgetTypes: () => ReadonlyArray<string>;
43
43
  * getCorrectUserInput function.
44
44
  */
45
45
  export declare const supportsStaticMode: (type: string) => boolean | undefined;
46
+ /**
47
+ * Returns true if the widget supports the "Graded" toggle in the editor.
48
+ * A widget opts in by setting supportsUngraded: true in its export object.
49
+ */
50
+ export declare const supportsUngraded: (type: string) => boolean;
46
51
  /**
47
52
  * Returns the tracking option for the widget. The default is "",
48
53
  * which means simply to track interactions once. The other available
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.3.1",
6
+ "version": "77.4.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.2",
46
- "@khanacademy/keypad-context": "3.2.44",
47
- "@khanacademy/kmath": "2.4.2",
48
- "@khanacademy/math-input": "26.4.16",
49
- "@khanacademy/perseus-core": "25.0.0",
50
- "@khanacademy/perseus-linter": "4.9.5",
51
- "@khanacademy/perseus-score": "8.7.0",
46
+ "@khanacademy/keypad-context": "3.2.46",
47
+ "@khanacademy/kmath": "2.4.4",
48
+ "@khanacademy/math-input": "26.4.18",
49
+ "@khanacademy/perseus-core": "26.0.1",
50
+ "@khanacademy/perseus-linter": "5.0.1",
51
+ "@khanacademy/perseus-score": "8.8.0",
52
52
  "@khanacademy/perseus-utils": "2.1.5",
53
53
  "@khanacademy/pure-markdown": "2.2.7",
54
54
  "@khanacademy/simple-markdown": "2.2.2"
@@ -1,196 +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
- withVector(options?: {
87
- coords?: CollinearTuple;
88
- startCoords?: CollinearTuple;
89
- }): InteractiveGraphQuestionBuilder;
90
- withCircle(options?: {
91
- center?: Coord;
92
- radius?: number;
93
- startCoords?: {
94
- center: Coord;
95
- radius: number;
96
- };
97
- }): InteractiveGraphQuestionBuilder;
98
- withQuadratic(options?: {
99
- coords?: [Coord, Coord, Coord];
100
- startCoords?: [Coord, Coord, Coord];
101
- }): InteractiveGraphQuestionBuilder;
102
- withSinusoid(options?: {
103
- coords?: [Coord, Coord];
104
- startCoords?: [Coord, Coord];
105
- }): InteractiveGraphQuestionBuilder;
106
- withExponential(options?: {
107
- coords?: [Coord, Coord];
108
- asymptote?: number;
109
- startCoords?: [Coord, Coord];
110
- startAsymptote?: number;
111
- }): InteractiveGraphQuestionBuilder;
112
- withTangent(options?: {
113
- coords?: [Coord, Coord];
114
- startCoords?: [Coord, Coord];
115
- }): InteractiveGraphQuestionBuilder;
116
- withPolygon(snapTo?: SnapTo, options?: {
117
- match?: "similar" | "congruent" | "approx";
118
- numSides?: number | "unlimited";
119
- showAngles?: boolean;
120
- showSides?: boolean;
121
- coords?: Coord[];
122
- startCoords?: Coord[];
123
- }): InteractiveGraphQuestionBuilder;
124
- withPoints(numPoints: number | "unlimited", options?: {
125
- coords?: Coord[];
126
- startCoords?: Coord[];
127
- }): InteractiveGraphQuestionBuilder;
128
- withAngle(options?: {
129
- coords?: [Coord, Coord, Coord];
130
- startCoords?: [Coord, Coord, Coord];
131
- showAngles?: boolean;
132
- allowReflexAngles?: boolean;
133
- angleOffsetDeg?: number;
134
- snapDegrees?: number;
135
- match?: "congruent";
136
- }): InteractiveGraphQuestionBuilder;
137
- withLogarithm(options?: {
138
- coords?: [Coord, Coord];
139
- asymptote?: number;
140
- startCoords?: [Coord, Coord];
141
- startAsymptote?: number;
142
- }): InteractiveGraphQuestionBuilder;
143
- withAbsoluteValue(options?: {
144
- coords?: [Coord, Coord];
145
- startCoords?: [Coord, Coord];
146
- }): InteractiveGraphQuestionBuilder;
147
- addLockedPointAt(x: number, y: number, options?: {
148
- color?: LockedFigureColor;
149
- filled?: boolean;
150
- labels?: LockedFigureLabelOptions[];
151
- ariaLabel?: string;
152
- }): InteractiveGraphQuestionBuilder;
153
- addLockedLine(point1: vec.Vector2, point2: vec.Vector2, options?: {
154
- kind?: "line" | "ray" | "segment";
155
- lineStyle?: LockedLineStyle;
156
- color?: LockedFigureColor;
157
- filled?: [boolean, boolean];
158
- showPoint1?: boolean;
159
- showPoint2?: boolean;
160
- weight?: StrokeWeight;
161
- labels?: LockedFigureLabelOptions[];
162
- ariaLabel?: string;
163
- }): InteractiveGraphQuestionBuilder;
164
- addLockedVector(tail: vec.Vector2, tip: vec.Vector2, options?: {
165
- color?: LockedFigureColor;
166
- labels?: LockedFigureLabelOptions[];
167
- weight?: StrokeWeight;
168
- ariaLabel?: string;
169
- }): InteractiveGraphQuestionBuilder;
170
- addLockedEllipse(center: vec.Vector2, radius: [x: number, y: number], options?: {
171
- angle?: number;
172
- color?: LockedFigureColor;
173
- fillStyle?: LockedFigureFillType;
174
- strokeStyle?: "solid" | "dashed";
175
- weight?: StrokeWeight;
176
- labels?: LockedFigureLabelOptions[];
177
- ariaLabel?: string;
178
- }): InteractiveGraphQuestionBuilder;
179
- addLockedPolygon(points: vec.Vector2[], options?: {
180
- color?: LockedFigureColor;
181
- showVertices?: boolean;
182
- fillStyle?: LockedFigureFillType;
183
- strokeStyle?: LockedLineStyle;
184
- weight?: StrokeWeight;
185
- labels?: LockedFigureLabelOptions[];
186
- ariaLabel?: string;
187
- }): InteractiveGraphQuestionBuilder;
188
- addLockedFunction(equation: string, options?: LockedFunctionOptions): this;
189
- addLockedLabel(text: string, coord: Coord, options?: {
190
- color?: LockedFigureColor;
191
- size?: "small" | "medium" | "large";
192
- }): this;
193
- private createLockedPoint;
194
- private addLockedFigure;
195
- }
196
- export {};