@khanacademy/perseus 23.5.0 → 24.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.
@@ -103,6 +103,7 @@ export declare const ApiOptions: {
103
103
  segment?: boolean | undefined;
104
104
  } & {
105
105
  "interactive-graph-locked-features-m2"?: boolean | undefined;
106
+ "interactive-graph-locked-features-m2b"?: boolean | undefined;
106
107
  }) | undefined;
107
108
  } | undefined;
108
109
  onWidgetStartProps?: ((widgets: import("./perseus-types").PerseusWidgetsMap) => void) | undefined;
@@ -150,6 +150,7 @@ declare const ref: React.ForwardRefExoticComponent<Omit<Pick<OwnProps & HOCProps
150
150
  segment?: boolean | undefined;
151
151
  } & {
152
152
  "interactive-graph-locked-features-m2"?: boolean | undefined;
153
+ "interactive-graph-locked-features-m2b"?: boolean | undefined;
153
154
  }) | undefined;
154
155
  } | undefined;
155
156
  onWidgetStartProps?: ((widgets: import("./perseus-types").PerseusWidgetsMap) => void) | undefined;
package/dist/types.d.ts CHANGED
@@ -78,7 +78,7 @@ type TrackInteractionArgs = {
78
78
  correct?: boolean;
79
79
  } & Partial<TrackingGradedGroupExtraArguments> & Partial<TrackingSequenceExtraArguments>;
80
80
  export declare const MafsGraphTypeFlags: readonly ["segment", "linear", "linear-system", "ray", "polygon", "circle", "quadratic", "sinusoid"];
81
- export declare const InteractiveGraphLockedFeaturesFlags: readonly ["interactive-graph-locked-features-m2"];
81
+ export declare const InteractiveGraphLockedFeaturesFlags: readonly ["interactive-graph-locked-features-m2", "interactive-graph-locked-features-m2b"];
82
82
  /**
83
83
  * APIOptions provides different ways to customize the behaviour of Perseus.
84
84
  *
@@ -144,6 +144,7 @@ declare const _default: Readonly<{
144
144
  segment?: boolean | undefined;
145
145
  } & {
146
146
  "interactive-graph-locked-features-m2"?: boolean | undefined;
147
+ "interactive-graph-locked-features-m2b"?: boolean | undefined;
147
148
  }) | undefined;
148
149
  } | undefined;
149
150
  onWidgetStartProps?: ((widgets: import("../perseus-types").PerseusWidgetsMap) => void) | undefined;
@@ -220,6 +221,7 @@ declare const _default: Readonly<{
220
221
  segment?: boolean | undefined;
221
222
  } & {
222
223
  "interactive-graph-locked-features-m2"?: boolean | undefined;
224
+ "interactive-graph-locked-features-m2b"?: boolean | undefined;
223
225
  }) | undefined;
224
226
  } | undefined;
225
227
  onWidgetStartProps?: ((widgets: import("../perseus-types").PerseusWidgetsMap) => void) | undefined;
@@ -296,6 +298,7 @@ declare const _default: Readonly<{
296
298
  segment?: boolean | undefined;
297
299
  } & {
298
300
  "interactive-graph-locked-features-m2"?: boolean | undefined;
301
+ "interactive-graph-locked-features-m2b"?: boolean | undefined;
299
302
  }) | undefined;
300
303
  } | undefined;
301
304
  onWidgetStartProps?: ((widgets: import("../perseus-types").PerseusWidgetsMap) => void) | undefined;
@@ -369,6 +372,7 @@ declare const _default: Readonly<{
369
372
  segment?: boolean | undefined;
370
373
  } & {
371
374
  "interactive-graph-locked-features-m2"?: boolean | undefined;
375
+ "interactive-graph-locked-features-m2b"?: boolean | undefined;
372
376
  }) | undefined;
373
377
  } | undefined;
374
378
  onWidgetStartProps?: ((widgets: import("../perseus-types").PerseusWidgetsMap) => void) | undefined;
@@ -445,6 +449,7 @@ declare const _default: Readonly<{
445
449
  segment?: boolean | undefined;
446
450
  } & {
447
451
  "interactive-graph-locked-features-m2"?: boolean | undefined;
452
+ "interactive-graph-locked-features-m2b"?: boolean | undefined;
448
453
  }) | undefined;
449
454
  } | undefined;
450
455
  onWidgetStartProps?: ((widgets: import("../perseus-types").PerseusWidgetsMap) => void) | undefined;
@@ -521,6 +526,7 @@ declare const _default: Readonly<{
521
526
  segment?: boolean | undefined;
522
527
  } & {
523
528
  "interactive-graph-locked-features-m2"?: boolean | undefined;
529
+ "interactive-graph-locked-features-m2b"?: boolean | undefined;
524
530
  }) | undefined;
525
531
  } | undefined;
526
532
  onWidgetStartProps?: ((widgets: import("../perseus-types").PerseusWidgetsMap) => void) | undefined;
@@ -10,5 +10,5 @@ export type SineCoefficient = {
10
10
  };
11
11
  export declare function SinusoidGraph(props: SinusoidGraphProps): JSX.Element;
12
12
  export declare const computeSine: (x: number, sinusoidCoefficients: SineCoefficient) => number;
13
- export declare const getSinusoidCoefficients: (coords: ReadonlyArray<Coord>) => SineCoefficient;
13
+ export declare const getSinusoidCoefficients: (coords: ReadonlyArray<Coord>) => SineCoefficient | undefined;
14
14
  export {};
@@ -0,0 +1,13 @@
1
+ import type { vec } from "mafs";
2
+ import type { RefObject } from "react";
3
+ type Params = {
4
+ gestureTarget: RefObject<Element>;
5
+ onMove: (point: vec.Vector2) => unknown;
6
+ point: vec.Vector2;
7
+ constrain: (point: vec.Vector2) => vec.Vector2;
8
+ };
9
+ type DragState = {
10
+ dragging: boolean;
11
+ };
12
+ export declare function useDraggable(params: Params): DragState;
13
+ export {};
@@ -1,4 +1,5 @@
1
- import type { LockedFigureFillType, LockedFigureColor, PerseusRenderer } from "../../perseus-types";
1
+ import type { LockedFigureFillType, LockedFigureColor, PerseusRenderer, CollinearTuple } from "../../perseus-types";
2
+ import type { Coord } from "@khanacademy/perseus";
2
3
  import type { vec } from "mafs";
3
4
  export declare function interactiveGraphQuestionBuilder(): InteractiveGraphQuestionBuilder;
4
5
  declare class InteractiveGraphQuestionBuilder {
@@ -19,8 +20,14 @@ declare class InteractiveGraphQuestionBuilder {
19
20
  withYRange(min: number, max: number): InteractiveGraphQuestionBuilder;
20
21
  withSnapStep(x: number, y: number): InteractiveGraphQuestionBuilder;
21
22
  withTickStep(x: number, y: number): InteractiveGraphQuestionBuilder;
22
- withSegments(numSegments: number): InteractiveGraphQuestionBuilder;
23
- withCircle(): InteractiveGraphQuestionBuilder;
23
+ withSegments(startCoords: CollinearTuple[]): InteractiveGraphQuestionBuilder;
24
+ withNumSegments(numSegments: number): InteractiveGraphQuestionBuilder;
25
+ withLinear(startCoords?: CollinearTuple): InteractiveGraphQuestionBuilder;
26
+ withLinearSystem(startCoords?: CollinearTuple[]): InteractiveGraphQuestionBuilder;
27
+ withRay(startCoords?: CollinearTuple): InteractiveGraphQuestionBuilder;
28
+ withCircle(startCoords?: Coord): InteractiveGraphQuestionBuilder;
29
+ withQuadratic(startCoords?: [Coord, Coord, Coord]): InteractiveGraphQuestionBuilder;
30
+ withSinusoid(startCoords?: [Coord, Coord]): InteractiveGraphQuestionBuilder;
24
31
  withPolygon(snapTo: "grid" | "angles" | "sides"): InteractiveGraphQuestionBuilder;
25
32
  addLockedPointAt(x: number, y: number): InteractiveGraphQuestionBuilder;
26
33
  addLockedLine(point1: vec.Vector2, point2: vec.Vector2): InteractiveGraphQuestionBuilder;
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
- import { type LockedEllipseType } from "../../perseus-types";
2
+ import { type LockedEllipseType } from "../../../perseus-types";
3
3
  declare const LockedEllipse: (props: LockedEllipseType) => JSX.Element;
4
4
  export default LockedEllipse;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import type { LockedLineType } from "../../perseus-types";
2
+ import type { LockedLineType } from "../../../perseus-types";
3
3
  import type { Interval } from "mafs";
4
4
  type Props = LockedLineType & {
5
5
  range: [Interval, Interval];
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
- import { type LockedPointType } from "../../perseus-types";
2
+ import { type LockedPointType } from "../../../perseus-types";
3
3
  declare const LockedPoint: (props: LockedPointType) => JSX.Element;
4
4
  export default LockedPoint;
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
- import type { LockedPolygonType } from "../../perseus-types";
2
+ import type { LockedPolygonType } from "../../../perseus-types";
3
3
  declare const LockedPolygon: (props: LockedPolygonType) => JSX.Element;
4
4
  export default LockedPolygon;
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
- import type { LockedVectorType } from "../../perseus-types";
2
+ import type { LockedVectorType } from "../../../perseus-types";
3
3
  declare const LockedVector: (props: LockedVectorType) => JSX.Element;
4
4
  export default LockedVector;
@@ -138,6 +138,7 @@ declare const _default: Readonly<{
138
138
  segment?: boolean | undefined;
139
139
  } & {
140
140
  "interactive-graph-locked-features-m2"?: boolean | undefined;
141
+ "interactive-graph-locked-features-m2b"?: boolean | undefined;
141
142
  }) | undefined;
142
143
  } | undefined;
143
144
  onWidgetStartProps?: ((widgets: import("..").PerseusWidgetsMap) => void) | undefined;
@@ -198,6 +199,7 @@ declare const _default: Readonly<{
198
199
  segment?: boolean | undefined;
199
200
  } & {
200
201
  "interactive-graph-locked-features-m2"?: boolean | undefined;
202
+ "interactive-graph-locked-features-m2b"?: boolean | undefined;
201
203
  }) | undefined;
202
204
  } | undefined;
203
205
  onWidgetStartProps?: ((widgets: import("..").PerseusWidgetsMap) => void) | undefined;
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": "23.5.0",
6
+ "version": "24.0.0",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -1,27 +0,0 @@
1
- import * as React from "react";
2
- type Props = {
3
- value: string | number;
4
- className?: string;
5
- labelText?: string;
6
- onFocus: () => void;
7
- onBlur: () => void;
8
- };
9
- type DefaultProps = Pick<Props, "value" | "onFocus" | "onBlur">;
10
- type State = {
11
- focused: boolean;
12
- selectorNamespace: string;
13
- };
14
- declare class MathOutput extends React.Component<Props, State> {
15
- static defaultProps: DefaultProps;
16
- state: State;
17
- _getInputClassName: () => string;
18
- _getDisplayValue: (arg1: string | number) => string;
19
- render(): React.ReactNode;
20
- getValue: () => string | number;
21
- focus: () => void;
22
- blur: () => void;
23
- _bindBlurHandler: () => void;
24
- _unbindBlurHandler: () => void;
25
- componentWillUnmount(): void;
26
- }
27
- export default MathOutput;