@khanacademy/perseus 53.1.0 → 54.1.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.
- package/dist/components/highlighting/types.d.ts +2 -1
- package/dist/components.d.ts +0 -1
- package/dist/es/index.js +621 -1948
- package/dist/es/index.js.map +1 -1
- package/dist/es/strings.js +61 -10
- package/dist/es/strings.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +698 -775
- package/dist/index.js.map +1 -1
- package/dist/interactive2/movable.d.ts +2 -1
- package/dist/strings.d.ts +57 -6
- package/dist/strings.js +139 -67
- package/dist/strings.js.map +1 -1
- package/dist/types.d.ts +6 -13
- package/dist/util/graphie.d.ts +1 -1
- package/dist/util.d.ts +0 -5
- package/dist/widget-ai-utils/radio/radio-ai-utils.d.ts +2 -1
- package/dist/widget-type-utils.d.ts +1 -0
- package/dist/widgets/categorizer/categorizer.d.ts +1 -2
- package/dist/widgets/cs-program/cs-program.d.ts +0 -2
- package/dist/widgets/dropdown/dropdown.d.ts +0 -2
- package/dist/widgets/expression/expression.d.ts +3 -6
- package/dist/widgets/grapher/grapher.d.ts +0 -2
- package/dist/widgets/iframe/iframe.d.ts +1 -2
- package/dist/widgets/interactive-graph.d.ts +2 -87
- package/dist/widgets/interactive-graphs/backgrounds/axis-labels.d.ts +4 -1
- package/dist/widgets/interactive-graphs/graphs/angle.d.ts +2 -1
- package/dist/widgets/interactive-graphs/graphs/circle.d.ts +6 -2
- package/dist/widgets/interactive-graphs/graphs/components/hairlines.d.ts +7 -0
- package/dist/widgets/interactive-graphs/graphs/components/movable-point-view.d.ts +1 -0
- package/dist/widgets/interactive-graphs/graphs/components/svg-line.d.ts +2 -1
- package/dist/widgets/interactive-graphs/graphs/linear-system.d.ts +2 -2
- package/dist/widgets/interactive-graphs/graphs/linear.d.ts +1 -1
- package/dist/widgets/interactive-graphs/graphs/point.d.ts +3 -2
- package/dist/widgets/interactive-graphs/graphs/ray.d.ts +1 -1
- package/dist/widgets/interactive-graphs/graphs/screenreader-text.d.ts +1 -0
- package/dist/widgets/interactive-graphs/graphs/segment.d.ts +2 -2
- package/dist/widgets/interactive-graphs/graphs/sinusoid.d.ts +2 -1
- package/dist/widgets/interactive-graphs/graphs/utils.d.ts +0 -3
- package/dist/widgets/interactive-graphs/interactive-graph-question-builder.d.ts +1 -2
- package/dist/widgets/interactive-graphs/reducer/interactive-graph-action.d.ts +3 -3
- package/dist/widgets/label-image/label-image.d.ts +1 -3
- package/dist/widgets/matrix/matrix.d.ts +1 -2
- package/dist/widgets/number-line/number-line.d.ts +0 -2
- package/dist/widgets/numeric-input/numeric-input.d.ts +0 -2
- package/dist/widgets/orderer/orderer.d.ts +0 -2
- package/dist/widgets/plotter/plotter.d.ts +0 -2
- package/dist/widgets/radio/radio.d.ts +1 -2
- package/dist/widgets/sorter/sorter.d.ts +1 -2
- package/dist/widgets/table/table.d.ts +0 -2
- package/dist/widgets.d.ts +1 -2
- package/package.json +10 -10
- package/dist/components/graph.d.ts +0 -61
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type PerseusExpressionWidgetOptions
|
|
1
|
+
import { type PerseusExpressionWidgetOptions } from "@khanacademy/perseus-core";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
4
4
|
import type { DependenciesContext } from "../../dependencies";
|
|
@@ -17,7 +17,7 @@ type RenderProps = {
|
|
|
17
17
|
keypadConfiguration: ReturnType<typeof keypadConfigurationForProps>;
|
|
18
18
|
};
|
|
19
19
|
type ExternalProps = WidgetProps<RenderProps, PerseusExpressionRubric>;
|
|
20
|
-
|
|
20
|
+
type Props = ExternalProps & Partial<React.ContextType<typeof DependenciesContext>> & {
|
|
21
21
|
apiOptions: NonNullable<ExternalProps["apiOptions"]>;
|
|
22
22
|
buttonSets: NonNullable<ExternalProps["buttonSets"]>;
|
|
23
23
|
functions: NonNullable<ExternalProps["functions"]>;
|
|
@@ -29,7 +29,7 @@ export type Props = ExternalProps & Partial<React.ContextType<typeof Dependencie
|
|
|
29
29
|
ariaLabel: PerseusExpressionWidgetOptions["ariaLabel"];
|
|
30
30
|
value: string;
|
|
31
31
|
};
|
|
32
|
-
|
|
32
|
+
type ExpressionState = {
|
|
33
33
|
invalid: boolean;
|
|
34
34
|
showErrorTooltip: boolean;
|
|
35
35
|
showErrorStyle: boolean;
|
|
@@ -128,7 +128,6 @@ declare const _default: {
|
|
|
128
128
|
editorChangeDelay?: number;
|
|
129
129
|
onWidgetStartProps?: (widgets: import("@khanacademy/perseus-core").PerseusWidgetsMap) => void;
|
|
130
130
|
}> & {
|
|
131
|
-
GroupMetadataEditor: NonNullable<import("../..").APIOptions["GroupMetadataEditor"]>;
|
|
132
131
|
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
133
132
|
canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
|
|
134
133
|
crossOutEnabled: NonNullable<import("../..").APIOptions["crossOutEnabled"]>;
|
|
@@ -201,7 +200,6 @@ declare const _default: {
|
|
|
201
200
|
editorChangeDelay?: number;
|
|
202
201
|
onWidgetStartProps?: (widgets: import("@khanacademy/perseus-core").PerseusWidgetsMap) => void;
|
|
203
202
|
}> & {
|
|
204
|
-
GroupMetadataEditor: NonNullable<import("../..").APIOptions["GroupMetadataEditor"]>;
|
|
205
203
|
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
206
204
|
canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
|
|
207
205
|
crossOutEnabled: NonNullable<import("../..").APIOptions["crossOutEnabled"]>;
|
|
@@ -225,7 +223,6 @@ declare const _default: {
|
|
|
225
223
|
version: import("@khanacademy/perseus-core").Version | undefined;
|
|
226
224
|
propUpgrades: import("@khanacademy/perseus-core").WidgetOptionsUpgradeMap | undefined;
|
|
227
225
|
isLintable: true;
|
|
228
|
-
getPublicWidgetOptions: typeof getExpressionPublicWidgetOptions;
|
|
229
226
|
getOneCorrectAnswerFromRubric(rubric: PerseusExpressionRubric): string | null | undefined;
|
|
230
227
|
};
|
|
231
228
|
export default _default;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { getGrapherPublicWidgetOptions } from "@khanacademy/perseus-core";
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import Graphie from "../../components/graphie";
|
|
4
3
|
import type { Coord } from "../../interactive2/types";
|
|
@@ -47,6 +46,5 @@ declare const _default: {
|
|
|
47
46
|
widget: typeof Grapher;
|
|
48
47
|
transform: (arg1: PerseusGrapherWidgetOptions) => RenderProps;
|
|
49
48
|
staticTransform: (arg1: PerseusGrapherWidgetOptions) => RenderProps;
|
|
50
|
-
getPublicWidgetOptions: typeof getGrapherPublicWidgetOptions;
|
|
51
49
|
};
|
|
52
50
|
export default _default;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* It's particularly well suited for embedding our ProcessingJS programs,
|
|
7
7
|
* but could also be used for embedding viz's hosted elsewhere.
|
|
8
8
|
*/
|
|
9
|
-
import { type PerseusIFrameWidgetOptions
|
|
9
|
+
import { type PerseusIFrameWidgetOptions } from "@khanacademy/perseus-core";
|
|
10
10
|
import * as React from "react";
|
|
11
11
|
import type { WidgetProps, Widget } from "../../types";
|
|
12
12
|
import type { UnsupportedWidgetPromptJSON } from "../../widget-ai-utils/unsupported-widget";
|
|
@@ -39,6 +39,5 @@ declare const _default: {
|
|
|
39
39
|
displayName: string;
|
|
40
40
|
widget: typeof Iframe;
|
|
41
41
|
hidden: true;
|
|
42
|
-
getPublicWidgetOptions: typeof getIFramePublicWidgetOptions;
|
|
43
42
|
};
|
|
44
43
|
export default _default;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { getInteractiveGraphPublicWidgetOptions } from "@khanacademy/perseus-core";
|
|
2
1
|
import * as React from "react";
|
|
3
|
-
import { PerseusI18nContext } from "../components/i18n-context";
|
|
4
2
|
import type { StatefulMafsGraphType } from "./interactive-graphs/stateful-mafs-graph";
|
|
5
3
|
import type { QuadraticGraphState } from "./interactive-graphs/types";
|
|
6
4
|
import type { Coord } from "../interactive2/types";
|
|
7
|
-
import type {
|
|
5
|
+
import type { WidgetProps } from "../types";
|
|
8
6
|
import type { InteractiveGraphPromptJSON } from "../widget-ai-utils/interactive-graph/interactive-graph-ai-utils";
|
|
9
7
|
import type { UnsupportedWidgetPromptJSON } from "../widget-ai-utils/unsupported-widget";
|
|
10
8
|
import type { QuadraticCoefficient, SineCoefficient, Range } from "@khanacademy/kmath";
|
|
11
|
-
import type { PerseusGraphType, PerseusGraphTypeAngle, PerseusGraphTypePoint,
|
|
9
|
+
import type { PerseusGraphType, PerseusGraphTypeAngle, PerseusGraphTypePoint, PerseusGraphTypeSegment, GraphRange, LockedFigure, PerseusImageBackground, MarkingsType } from "@khanacademy/perseus-core";
|
|
12
10
|
import type { PerseusInteractiveGraphRubric, PerseusInteractiveGraphUserInput } from "@khanacademy/perseus-score";
|
|
13
11
|
type RenderProps = {
|
|
14
12
|
/**
|
|
@@ -117,89 +115,7 @@ type DefaultProps = {
|
|
|
117
115
|
showProtractor: Props["showProtractor"];
|
|
118
116
|
graph: Props["graph"];
|
|
119
117
|
};
|
|
120
|
-
export declare function getSinusoidCoefficients(coords: ReadonlyArray<Coord>): SineCoefficient;
|
|
121
|
-
export declare function getQuadraticCoefficients(coords: ReadonlyArray<Coord>): QuadraticCoefficient;
|
|
122
|
-
declare class LegacyInteractiveGraph extends React.Component<Props, State> {
|
|
123
|
-
static contextType: React.Context<import("../components/i18n-context").I18nContextType>;
|
|
124
|
-
context: React.ContextType<typeof PerseusI18nContext>;
|
|
125
|
-
angle: any | null | undefined;
|
|
126
|
-
circle: any | null | undefined;
|
|
127
|
-
graphie: any | null | undefined;
|
|
128
|
-
horizHairline: any | null | undefined;
|
|
129
|
-
line: any | null | undefined;
|
|
130
|
-
lines: ReadonlyArray<ReadonlyArray<Coord>> | null | undefined;
|
|
131
|
-
parabola: any | null | undefined;
|
|
132
|
-
pointA: any | null | undefined;
|
|
133
|
-
pointB: any | null | undefined;
|
|
134
|
-
pointC: any | null | undefined;
|
|
135
|
-
points: Array<any>;
|
|
136
|
-
polygon: any | null | undefined;
|
|
137
|
-
shouldResetGraphie: boolean;
|
|
138
|
-
sinusoid: any | null | undefined;
|
|
139
|
-
trashCan: any | null | undefined;
|
|
140
|
-
vertHairline: any | null | undefined;
|
|
141
|
-
static defaultProps: DefaultProps;
|
|
142
|
-
state: State;
|
|
143
|
-
componentDidMount(): void;
|
|
144
|
-
UNSAFE_componentWillReceiveProps(nextProps: Props): void;
|
|
145
|
-
componentDidUpdate(prevProps: Props, prevState: State): void;
|
|
146
|
-
_getShouldShowInstructions: (arg1?: Props | null | undefined) => boolean;
|
|
147
|
-
setGraphie: (arg1: any) => void;
|
|
148
|
-
handleAddPointsMouseDown: (arg1: Coord) => void;
|
|
149
|
-
resetGraphie: () => void;
|
|
150
|
-
setupGraphie: () => void;
|
|
151
|
-
showHairlines: (arg1: Coord) => void;
|
|
152
|
-
hideHairlines: () => void;
|
|
153
|
-
setTrashCanVisibility: (arg1: number) => void;
|
|
154
|
-
isClickToAddPoints: (arg1?: Props | null | undefined) => boolean;
|
|
155
|
-
areAngleGraphsEqual(prevGraph: PerseusGraphTypeAngle, currentGraph: PerseusGraphTypeAngle): boolean;
|
|
156
|
-
arePointGraphsEqual(prevGraph: PerseusGraphTypePoint, currentGraph: PerseusGraphTypePoint): boolean;
|
|
157
|
-
arePolygonGraphsEqual(prevGraph: PerseusGraphTypePolygon, currentGraph: PerseusGraphTypePolygon): boolean;
|
|
158
|
-
areSegmentGraphsEqual(prevGraph: PerseusGraphTypeSegment, currentGraph: PerseusGraphTypeSegment): boolean;
|
|
159
|
-
_lineStroke: () => {
|
|
160
|
-
["stroke-width"]?: number;
|
|
161
|
-
};
|
|
162
|
-
addLine: (arg1: string) => void;
|
|
163
|
-
removeLine: () => void;
|
|
164
|
-
addNoneControls: () => void;
|
|
165
|
-
removeNoneControls: () => void;
|
|
166
|
-
addLinearControls: () => void;
|
|
167
|
-
removeLinearControls: () => void;
|
|
168
|
-
addQuadraticControls: () => void;
|
|
169
|
-
updateQuadratic: () => void;
|
|
170
|
-
removeQuadraticControls: () => void;
|
|
171
|
-
addSinusoidControls: () => void;
|
|
172
|
-
updateSinusoid: () => void;
|
|
173
|
-
removeSinusoidControls: () => void;
|
|
174
|
-
addCircleControls: () => void;
|
|
175
|
-
removeCircleControls: () => void;
|
|
176
|
-
addLinearSystemControls: () => void;
|
|
177
|
-
removeLinearSystemControls: () => void;
|
|
178
|
-
isCoordInTrash: (arg1: Coord) => boolean;
|
|
179
|
-
createPointForPointsType: (arg1: Coord, arg2: number) => any;
|
|
180
|
-
removePoint: (arg1: Coord) => number | null | undefined;
|
|
181
|
-
createPointForPolygonType: (arg1: Coord, arg2: number) => any;
|
|
182
|
-
updateCoordsFromPoints: () => void;
|
|
183
|
-
clearCoords: () => void;
|
|
184
|
-
onChange: ChangeHandler;
|
|
185
|
-
addPointControls: () => void;
|
|
186
|
-
removePointControls: () => void;
|
|
187
|
-
addSegmentControls: () => void;
|
|
188
|
-
removeSegmentControls: () => void;
|
|
189
|
-
addRayControls: () => void;
|
|
190
|
-
removeRayControls: () => void;
|
|
191
|
-
addPolygonControls: () => void;
|
|
192
|
-
updatePolygon: () => void;
|
|
193
|
-
removePolygonControls: () => void;
|
|
194
|
-
addAngleControls: () => void;
|
|
195
|
-
removeAngleControls: () => void;
|
|
196
|
-
toggleShowSides: () => void;
|
|
197
|
-
getUserInput(): PerseusInteractiveGraphUserInput;
|
|
198
|
-
focus: () => void;
|
|
199
|
-
render(): React.ReactNode;
|
|
200
|
-
}
|
|
201
118
|
declare class InteractiveGraph extends React.Component<Props, State> {
|
|
202
|
-
legacyGraphRef: React.RefObject<LegacyInteractiveGraph>;
|
|
203
119
|
mafsRef: React.RefObject<StatefulMafsGraphType>;
|
|
204
120
|
static defaultProps: DefaultProps;
|
|
205
121
|
getUserInput(): PerseusInteractiveGraphUserInput;
|
|
@@ -260,6 +176,5 @@ declare const _default: {
|
|
|
260
176
|
displayName: string;
|
|
261
177
|
widget: typeof InteractiveGraph;
|
|
262
178
|
staticTransform: <T>(value: T) => T;
|
|
263
|
-
getPublicWidgetOptions: typeof getInteractiveGraphPublicWidgetOptions;
|
|
264
179
|
};
|
|
265
180
|
export default _default;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { vec } from "mafs";
|
|
2
|
+
import type { I18nContextType } from "../../../components/i18n-context";
|
|
2
3
|
import type { AngleGraphState, Dispatch, InteractiveGraphElementSuite } from "../types";
|
|
3
|
-
export declare function renderAngleGraph(state: AngleGraphState, dispatch: Dispatch): InteractiveGraphElementSuite;
|
|
4
|
+
export declare function renderAngleGraph(state: AngleGraphState, dispatch: Dispatch, i18n: I18nContextType): InteractiveGraphElementSuite;
|
|
4
5
|
export declare function getAngleSideConstraint(sidePoint: [number, number], vertex: [number, number], snapDegrees: number): {
|
|
5
6
|
up: vec.Vector2;
|
|
6
7
|
down: vec.Vector2;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
1
2
|
import type { I18nContextType } from "../../../components/i18n-context";
|
|
2
|
-
import type { CircleGraphState, Dispatch, InteractiveGraphElementSuite } from "../types";
|
|
3
|
-
export declare function renderCircleGraph(state: CircleGraphState, dispatch: Dispatch): InteractiveGraphElementSuite;
|
|
3
|
+
import type { CircleGraphState, Dispatch, InteractiveGraphElementSuite, MafsGraphProps } from "../types";
|
|
4
|
+
export declare function renderCircleGraph(state: CircleGraphState, dispatch: Dispatch, i18n: I18nContextType): InteractiveGraphElementSuite;
|
|
5
|
+
type CircleGraphProps = MafsGraphProps<CircleGraphState>;
|
|
6
|
+
export declare function CircleGraph(props: CircleGraphProps): React.JSX.Element;
|
|
4
7
|
export declare function describeCircleGraph(state: CircleGraphState, i18n: I18nContextType): Record<string, string>;
|
|
8
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { vec } from "mafs";
|
|
3
3
|
import type { SVGProps } from "react";
|
|
4
|
-
|
|
4
|
+
type Props = {
|
|
5
5
|
start: vec.Vector2;
|
|
6
6
|
end: vec.Vector2;
|
|
7
7
|
style?: SVGProps<SVGLineElement>["style"];
|
|
@@ -9,3 +9,4 @@ export type Props = {
|
|
|
9
9
|
testId?: string;
|
|
10
10
|
};
|
|
11
11
|
export declare function SVGLine(props: Props): React.JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { I18nContextType } from "../../../components/i18n-context";
|
|
2
2
|
import type { LinearSystemGraphState, Dispatch, InteractiveGraphElementSuite } from "../types";
|
|
3
|
-
export declare function renderLinearSystemGraph(state: LinearSystemGraphState, dispatch: Dispatch): InteractiveGraphElementSuite;
|
|
4
|
-
export declare function
|
|
3
|
+
export declare function renderLinearSystemGraph(state: LinearSystemGraphState, dispatch: Dispatch, i18n: I18nContextType): InteractiveGraphElementSuite;
|
|
4
|
+
export declare function getLinearSystemGraphDescription(state: LinearSystemGraphState, i18n: I18nContextType): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { I18nContextType } from "../../../components/i18n-context";
|
|
2
2
|
import type { LinearGraphState, Dispatch, InteractiveGraphElementSuite } from "../types";
|
|
3
|
-
export declare function renderLinearGraph(state: LinearGraphState, dispatch: Dispatch): InteractiveGraphElementSuite;
|
|
3
|
+
export declare function renderLinearGraph(state: LinearGraphState, dispatch: Dispatch, i18n: I18nContextType): InteractiveGraphElementSuite;
|
|
4
4
|
export declare function describeLinearGraph(state: LinearGraphState, i18n: I18nContextType): Record<string, string>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { I18nContextType } from "../../../components/i18n-context";
|
|
1
2
|
import type { PerseusStrings } from "../../../strings";
|
|
2
3
|
import type { PointGraphState, Dispatch, InteractiveGraphElementSuite } from "../types";
|
|
3
|
-
export declare function renderPointGraph(state: PointGraphState, dispatch: Dispatch): InteractiveGraphElementSuite;
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function renderPointGraph(state: PointGraphState, dispatch: Dispatch, i18n: I18nContextType): InteractiveGraphElementSuite;
|
|
5
|
+
export declare function getPointGraphDescription(state: PointGraphState, i18n: {
|
|
5
6
|
strings: PerseusStrings;
|
|
6
7
|
locale: string;
|
|
7
8
|
}): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { I18nContextType } from "../../../components/i18n-context";
|
|
2
2
|
import type { Dispatch, InteractiveGraphElementSuite, RayGraphState } from "../types";
|
|
3
|
-
export declare function renderRayGraph(state: RayGraphState, dispatch: Dispatch): InteractiveGraphElementSuite;
|
|
3
|
+
export declare function renderRayGraph(state: RayGraphState, dispatch: Dispatch, i18n: I18nContextType): InteractiveGraphElementSuite;
|
|
4
4
|
export declare function describeRayGraph(state: RayGraphState, i18n: I18nContextType): Record<string, string>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { I18nContextType } from "../../../components/i18n-context";
|
|
2
2
|
import type { Dispatch, InteractiveGraphElementSuite, SegmentGraphState } from "../types";
|
|
3
|
-
export declare function renderSegmentGraph(state: SegmentGraphState, dispatch: Dispatch): InteractiveGraphElementSuite;
|
|
4
|
-
export declare function
|
|
3
|
+
export declare function renderSegmentGraph(state: SegmentGraphState, dispatch: Dispatch, i18n: I18nContextType): InteractiveGraphElementSuite;
|
|
4
|
+
export declare function getSegmentGraphDescription(state: SegmentGraphState, i18n: I18nContextType): string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { type I18nContextType } from "../../../components/i18n-context";
|
|
1
2
|
import type { SinusoidGraphState, Dispatch, InteractiveGraphElementSuite } from "../types";
|
|
2
3
|
import type { NamedSineCoefficient } from "@khanacademy/kmath";
|
|
3
4
|
import type { Coord } from "@khanacademy/perseus-core";
|
|
4
|
-
export declare function renderSinusoidGraph(state: SinusoidGraphState, dispatch: Dispatch): InteractiveGraphElementSuite;
|
|
5
|
+
export declare function renderSinusoidGraph(state: SinusoidGraphState, dispatch: Dispatch, i18n: I18nContextType): InteractiveGraphElementSuite;
|
|
5
6
|
export declare const computeSine: (x: number, sinusoidCoefficients: NamedSineCoefficient) => number;
|
|
6
7
|
export declare const getSinusoidCoefficients: (coords: ReadonlyArray<Coord>) => NamedSineCoefficient | undefined;
|
|
@@ -14,8 +14,6 @@ export declare const getIntersectionOfRayWithBox: (initialPoint: vec.Vector2, th
|
|
|
14
14
|
export declare function getArrayWithoutDuplicates(array: Array<Coord>): Array<Coord>;
|
|
15
15
|
export declare function getSlopeStringForLine(line: PairOfPoints, strings: PerseusStrings): string;
|
|
16
16
|
export declare function getInterceptStringForLine(line: PairOfPoints, strings: PerseusStrings, locale: string): string;
|
|
17
|
-
type GraphLocations = "origin" | "x-axis" | "y-axis" | 1 | 2 | 3 | 4;
|
|
18
|
-
export declare function getCoordQuadrant(coord: Coord): GraphLocations;
|
|
19
17
|
export declare function getQuadraticVertexString(vertex: Coord, strings: PerseusStrings): string;
|
|
20
18
|
export declare function getQuadraticPointString(pointNumber: any, coord: Coord, strings: PerseusStrings, locale: string): string;
|
|
21
19
|
export declare function getQuadraticXIntercepts(a: number, b: number, c: number): number[];
|
|
@@ -33,4 +31,3 @@ export declare function getSideLengthsFromPoints(points: Coord[], i: number, isP
|
|
|
33
31
|
* exact side length or the approximate side length.
|
|
34
32
|
*/
|
|
35
33
|
export declare function getPolygonSideString(sideLength: number, pointIndex: number, strings: PerseusStrings, locale: string): string;
|
|
36
|
-
export {};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { vec } from "mafs";
|
|
2
2
|
import type { Coord } from "../../interactive2/types";
|
|
3
3
|
import type { CollinearTuple, LockedFigureColor, LockedFigureFillType, LockedLineStyle, MarkingsType, PerseusRenderer } from "@khanacademy/perseus-core";
|
|
4
|
-
import type { Interval } from "mafs";
|
|
5
4
|
export type LockedFunctionOptions = {
|
|
6
5
|
color?: LockedFigureColor;
|
|
7
6
|
strokeStyle?: LockedLineStyle;
|
|
8
7
|
directionalAxis?: "x" | "y";
|
|
9
|
-
domain?:
|
|
8
|
+
domain?: [min: number | null, max: number | null];
|
|
10
9
|
labels?: LockedFigureLabelOptions[];
|
|
11
10
|
ariaLabel?: string;
|
|
12
11
|
};
|
|
@@ -111,12 +111,12 @@ export interface ChangeKeyboardInvitationVisibility {
|
|
|
111
111
|
}
|
|
112
112
|
declare function changeKeyboardInvitationVisibility(shouldShow: boolean): ChangeKeyboardInvitationVisibility;
|
|
113
113
|
export declare const CLOSE_POLYGON = "close-polygon";
|
|
114
|
-
|
|
114
|
+
interface ClosePolygon {
|
|
115
115
|
type: typeof CLOSE_POLYGON;
|
|
116
116
|
}
|
|
117
117
|
declare function closePolygon(): ClosePolygon;
|
|
118
118
|
export declare const OPEN_POLYGON = "open-polygon";
|
|
119
|
-
|
|
119
|
+
interface OpenPolygon {
|
|
120
120
|
type: typeof OPEN_POLYGON;
|
|
121
121
|
}
|
|
122
122
|
declare function openPolygon(): OpenPolygon;
|
|
@@ -166,7 +166,7 @@ export interface ChangeRange {
|
|
|
166
166
|
}
|
|
167
167
|
export declare function changeRange(range: [x: Interval, y: Interval]): ChangeRange;
|
|
168
168
|
export declare const REINITIALIZE = "reinitialize";
|
|
169
|
-
|
|
169
|
+
interface Reinitialize {
|
|
170
170
|
type: typeof REINITIALIZE;
|
|
171
171
|
params: InitializeGraphStateParams;
|
|
172
172
|
}
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* that involve the use of images, and enable learners to demonstrate their
|
|
6
6
|
* knowledge by directly interacting with the image.
|
|
7
7
|
*/
|
|
8
|
-
import { getLabelImagePublicWidgetOptions } from "@khanacademy/perseus-core";
|
|
9
8
|
import * as React from "react";
|
|
10
9
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
11
10
|
import Marker from "./marker";
|
|
@@ -15,7 +14,7 @@ import type { APIOptions, Widget } from "../../types";
|
|
|
15
14
|
import type { LabelImagePromptJSON } from "../../widget-ai-utils/label-image/label-image-ai-utils";
|
|
16
15
|
import type { InteractiveMarkerType, PerseusLabelImageWidgetOptions } from "@khanacademy/perseus-core";
|
|
17
16
|
import type { PerseusLabelImageUserInput } from "@khanacademy/perseus-score";
|
|
18
|
-
|
|
17
|
+
type PreferredPopoverDirection = "NONE" | "UP" | "DOWN" | "LEFT" | "RIGHT";
|
|
19
18
|
/**
|
|
20
19
|
* Represents a direction vector.
|
|
21
20
|
* No diagonals allowed.
|
|
@@ -92,6 +91,5 @@ declare const _default: {
|
|
|
92
91
|
}, keyof import("../..").PerseusDependenciesV2> & React.RefAttributes<LabelImage>>;
|
|
93
92
|
accessible: true;
|
|
94
93
|
isLintable: true;
|
|
95
|
-
getPublicWidgetOptions: typeof getLabelImagePublicWidgetOptions;
|
|
96
94
|
};
|
|
97
95
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type PerseusMatrixWidgetAnswers } from "@khanacademy/perseus-core";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
4
4
|
import type { FocusPath, Widget, WidgetProps } from "../../types";
|
|
@@ -60,6 +60,5 @@ declare const _default: {
|
|
|
60
60
|
transform: (arg1: any) => any;
|
|
61
61
|
staticTransform: (arg1: any) => any;
|
|
62
62
|
isLintable: true;
|
|
63
|
-
getPublicWidgetOptions: typeof getMatrixPublicWidgetOptions;
|
|
64
63
|
};
|
|
65
64
|
export default _default;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { getNumberLinePublicWidgetOptions } from "@khanacademy/perseus-core";
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
4
3
|
import type { ChangeableProps } from "../../mixins/changeable";
|
|
@@ -79,6 +78,5 @@ declare const _default: {
|
|
|
79
78
|
widget: typeof NumberLine;
|
|
80
79
|
transform: (arg1: any) => any;
|
|
81
80
|
staticTransform: (arg1: any) => any;
|
|
82
|
-
getPublicWidgetOptions: typeof getNumberLinePublicWidgetOptions;
|
|
83
81
|
};
|
|
84
82
|
export default _default;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { getNumericInputPublicWidgetOptions } from "@khanacademy/perseus-core";
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
4
3
|
import InputWithExamples from "../../components/input-with-examples";
|
|
@@ -76,7 +75,6 @@ declare const _default: {
|
|
|
76
75
|
widget: typeof NumericInput;
|
|
77
76
|
transform: (widgetOptions: PerseusNumericInputWidgetOptions) => RenderProps;
|
|
78
77
|
isLintable: true;
|
|
79
|
-
getPublicWidgetOptions: typeof getNumericInputPublicWidgetOptions;
|
|
80
78
|
getOneCorrectAnswerFromRubric(rubric: PerseusNumericInputRubric): string | null | undefined;
|
|
81
79
|
};
|
|
82
80
|
export default _default;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { getOrdererPublicWidgetOptions } from "@khanacademy/perseus-core";
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import type { Widget, WidgetProps } from "../../types";
|
|
4
3
|
import type { OrdererPromptJSON } from "../../widget-ai-utils/orderer/orderer-ai-utils";
|
|
@@ -55,6 +54,5 @@ declare const _default: {
|
|
|
55
54
|
hidden: true;
|
|
56
55
|
widget: typeof Orderer;
|
|
57
56
|
isLintable: true;
|
|
58
|
-
getPublicWidgetOptions: typeof getOrdererPublicWidgetOptions;
|
|
59
57
|
};
|
|
60
58
|
export default _default;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { getPlotterPublicWidgetOptions } from "@khanacademy/perseus-core";
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
4
3
|
import type { Widget, WidgetProps } from "../../types";
|
|
@@ -76,6 +75,5 @@ declare const _default: {
|
|
|
76
75
|
hidden: true;
|
|
77
76
|
widget: typeof Plotter;
|
|
78
77
|
staticTransform: <T>(value: T) => T;
|
|
79
|
-
getPublicWidgetOptions: typeof getPlotterPublicWidgetOptions;
|
|
80
78
|
};
|
|
81
79
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type PerseusRadioWidgetOptions, getRadioPublicWidgetOptions } from "@khanacademy/perseus-core";
|
|
2
1
|
import Radio from "./radio-component";
|
|
3
2
|
import type { RenderProps } from "./radio-component";
|
|
4
3
|
import type { PerseusStrings } from "../../strings";
|
|
4
|
+
import type { PerseusRadioWidgetOptions } from "@khanacademy/perseus-core";
|
|
5
5
|
declare const _default: {
|
|
6
6
|
name: string;
|
|
7
7
|
displayName: string;
|
|
@@ -12,6 +12,5 @@ declare const _default: {
|
|
|
12
12
|
version: import("@khanacademy/perseus-core").Version | undefined;
|
|
13
13
|
propUpgrades: import("@khanacademy/perseus-core").WidgetOptionsUpgradeMap | undefined;
|
|
14
14
|
isLintable: true;
|
|
15
|
-
getPublicWidgetOptions: typeof getRadioPublicWidgetOptions;
|
|
16
15
|
};
|
|
17
16
|
export default _default;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type PerseusSorterWidgetOptions, getSorterPublicWidgetOptions } from "@khanacademy/perseus-core";
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import type { SortableOption } from "../../components/sortable";
|
|
4
3
|
import type { Widget, WidgetProps } from "../../types";
|
|
5
4
|
import type { SorterPromptJSON } from "../../widget-ai-utils/sorter/sorter-ai-utils";
|
|
5
|
+
import type { PerseusSorterWidgetOptions } from "@khanacademy/perseus-core";
|
|
6
6
|
import type { PerseusSorterRubric, PerseusSorterUserInput } from "@khanacademy/perseus-score";
|
|
7
7
|
type RenderProps = PerseusSorterWidgetOptions;
|
|
8
8
|
type Props = WidgetProps<RenderProps, PerseusSorterRubric>;
|
|
@@ -34,6 +34,5 @@ declare const _default: {
|
|
|
34
34
|
displayName: string;
|
|
35
35
|
widget: typeof Sorter;
|
|
36
36
|
isLintable: true;
|
|
37
|
-
getPublicWidgetOptions: typeof getSorterPublicWidgetOptions;
|
|
38
37
|
};
|
|
39
38
|
export default _default;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { getTablePublicWidgetOptions } from "@khanacademy/perseus-core";
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
4
3
|
import type { ChangeableProps } from "../../mixins/changeable";
|
|
@@ -46,6 +45,5 @@ declare const _default: {
|
|
|
46
45
|
transform: (arg1: any) => any;
|
|
47
46
|
hidden: true;
|
|
48
47
|
isLintable: true;
|
|
49
|
-
getPublicWidgetOptions: typeof getTablePublicWidgetOptions;
|
|
50
48
|
};
|
|
51
49
|
export default _default;
|
package/dist/widgets.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PerseusStrings } from "./strings";
|
|
2
|
-
import type { Tracking, WidgetExports, WidgetTransform
|
|
2
|
+
import type { Tracking, WidgetExports, WidgetTransform } from "./types";
|
|
3
3
|
import type { PerseusWidget, Version } from "@khanacademy/perseus-core";
|
|
4
4
|
import type * as React from "react";
|
|
5
5
|
type Editor = any;
|
|
@@ -28,7 +28,6 @@ export declare const replaceEditor: (name: string, replacementName: string) => v
|
|
|
28
28
|
export declare const replaceDeprecatedEditors: () => void;
|
|
29
29
|
export declare const getWidget: (name: string) => React.ComponentType<any> | null | undefined;
|
|
30
30
|
export declare const getWidgetExport: (name: string) => WidgetExports | null;
|
|
31
|
-
export declare const getPublicWidgetOptionsFunction: (name: string) => PublicWidgetOptionsFunction;
|
|
32
31
|
export declare const getEditor: (name: string) => Editor | null | undefined;
|
|
33
32
|
export declare const getTransform: (name: string) => WidgetTransform | null | undefined;
|
|
34
33
|
export declare const getVersion: (name: string) => Version | 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": "
|
|
6
|
+
"version": "54.1.0",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -41,15 +41,15 @@
|
|
|
41
41
|
"test": "bash -c 'yarn --silent --cwd \"../..\" test ${@:0} $($([[ ${@: -1} = -* ]] || [[ ${@: -1} = bash ]]) && echo $PWD)'"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@khanacademy/kas": "^0.4.
|
|
45
|
-
"@khanacademy/keypad-context": "^1.0.
|
|
46
|
-
"@khanacademy/kmath": "^0.3.
|
|
47
|
-
"@khanacademy/math-input": "^22.2.
|
|
48
|
-
"@khanacademy/perseus-core": "3.
|
|
49
|
-
"@khanacademy/perseus-linter": "^1.2.
|
|
50
|
-
"@khanacademy/perseus-score": "^2.2.
|
|
51
|
-
"@khanacademy/pure-markdown": "^0.3.
|
|
52
|
-
"@khanacademy/simple-markdown": "^0.13.
|
|
44
|
+
"@khanacademy/kas": "^0.4.16",
|
|
45
|
+
"@khanacademy/keypad-context": "^1.0.19",
|
|
46
|
+
"@khanacademy/kmath": "^0.3.5",
|
|
47
|
+
"@khanacademy/math-input": "^22.2.6",
|
|
48
|
+
"@khanacademy/perseus-core": "3.7.0",
|
|
49
|
+
"@khanacademy/perseus-linter": "^1.2.18",
|
|
50
|
+
"@khanacademy/perseus-score": "^2.2.2",
|
|
51
|
+
"@khanacademy/pure-markdown": "^0.3.27",
|
|
52
|
+
"@khanacademy/simple-markdown": "^0.13.20",
|
|
53
53
|
"@types/classnames": "2.2.0",
|
|
54
54
|
"@use-gesture/react": "^10.2.27",
|
|
55
55
|
"mafs": "0.19.0",
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import type { Coord } from "../interactive2/types";
|
|
3
|
-
import type { GridDimensions } from "../util";
|
|
4
|
-
import type { PerseusImageBackground } from "@khanacademy/perseus-core";
|
|
5
|
-
type Props = {
|
|
6
|
-
box: [number, number];
|
|
7
|
-
labels: ReadonlyArray<string>;
|
|
8
|
-
range: [Coord, Coord];
|
|
9
|
-
step: [number, number];
|
|
10
|
-
gridStep: [number, number];
|
|
11
|
-
snapStep: [number, number];
|
|
12
|
-
markings: string;
|
|
13
|
-
backgroundImage: PerseusImageBackground;
|
|
14
|
-
showProtractor: boolean;
|
|
15
|
-
showRuler: boolean;
|
|
16
|
-
rulerLabel: string;
|
|
17
|
-
rulerTicks: number;
|
|
18
|
-
instructions?: string;
|
|
19
|
-
isMobile: boolean;
|
|
20
|
-
onGraphieUpdated?: (graphie: any) => void;
|
|
21
|
-
onClick?: (Coord: any) => void;
|
|
22
|
-
onMouseDown?: (Coord: any) => void;
|
|
23
|
-
onMouseMove?: (Coord: any) => void;
|
|
24
|
-
setDrawingAreaAvailable?: (boolean: any) => void;
|
|
25
|
-
};
|
|
26
|
-
type DefaultProps = {
|
|
27
|
-
labels: Props["labels"];
|
|
28
|
-
range: Props["range"];
|
|
29
|
-
step: Props["step"];
|
|
30
|
-
gridStep: Props["gridStep"];
|
|
31
|
-
snapStep: Props["snapStep"];
|
|
32
|
-
markings: Props["markings"];
|
|
33
|
-
backgroundImage: Props["backgroundImage"];
|
|
34
|
-
showProtractor: Props["showProtractor"];
|
|
35
|
-
showRuler: Props["showRuler"];
|
|
36
|
-
rulerLabel: Props["rulerLabel"];
|
|
37
|
-
rulerTicks: Props["rulerTicks"];
|
|
38
|
-
isMobile: Props["isMobile"];
|
|
39
|
-
};
|
|
40
|
-
declare class Graph extends React.Component<Props> {
|
|
41
|
-
graphieDivRef: React.RefObject<HTMLDivElement>;
|
|
42
|
-
protractor: any;
|
|
43
|
-
ruler: any;
|
|
44
|
-
_graphie: any;
|
|
45
|
-
_hasSetupGraphieThisUpdate: boolean;
|
|
46
|
-
_shouldSetupGraphie: boolean;
|
|
47
|
-
static defaultProps: DefaultProps;
|
|
48
|
-
componentDidMount(): void;
|
|
49
|
-
UNSAFE_componentWillReceiveProps(nextProps: any): void;
|
|
50
|
-
componentDidUpdate(): void;
|
|
51
|
-
reset: () => void;
|
|
52
|
-
graphie: () => any;
|
|
53
|
-
pointsFromNormalized: (arg1: any, arg2: any) => any;
|
|
54
|
-
_setupGraphie: (arg1: any) => void;
|
|
55
|
-
_getGridConfig: () => [GridDimensions, GridDimensions];
|
|
56
|
-
_updateProtractor: () => void;
|
|
57
|
-
_updateRuler: () => void;
|
|
58
|
-
toJSON: () => any;
|
|
59
|
-
render(): React.ReactNode;
|
|
60
|
-
}
|
|
61
|
-
export default Graph;
|