@khanacademy/perseus 19.1.9 → 19.2.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/image-loader.d.ts +2 -2
- package/dist/components/math-input.d.ts +1 -1
- package/dist/es/index.js +488 -499
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +474 -498
- package/dist/index.js.map +1 -1
- package/dist/interactive2/arrowhead.d.ts +9 -0
- package/dist/interactive2/get-clip-point.d.ts +2 -0
- package/dist/interactive2/wrapped-drawing.d.ts +29 -0
- package/dist/interactive2/wrapped-ellipse.d.ts +8 -1
- package/dist/interactive2/wrapped-line.d.ts +10 -1
- package/dist/interactive2/wrapped-path.d.ts +7 -1
- package/dist/logging/log.d.ts +1 -1
- package/dist/perseus-types.d.ts +9 -4
- package/dist/util/sizing-utils.d.ts +1 -1
- package/dist/widgets/expression.d.ts +2 -2
- package/dist/widgets/graded-group.d.ts +1 -1
- package/dist/widgets/python-program.d.ts +33 -0
- package/package.json +4 -4
- package/dist/interactive2/wrapped-defaults.d.ts +0 -5
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import WrappedPath from "./wrapped-path";
|
|
2
|
+
import type { Graphie } from "../util/graphie";
|
|
3
|
+
import type { Coord } from "@khanacademy/perseus";
|
|
4
|
+
export declare class Arrowhead extends WrappedPath {
|
|
5
|
+
private static scale;
|
|
6
|
+
center: Coord;
|
|
7
|
+
constructor(graphie: Graphie, style: any);
|
|
8
|
+
toCoordAtAngle(coord: Coord, angle: number): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default methods for a wrapped movable.
|
|
3
|
+
*/
|
|
4
|
+
import type { Coord } from "./types";
|
|
5
|
+
import type { Graphie } from "../util/graphie";
|
|
6
|
+
export interface VisibleShape {
|
|
7
|
+
attr: (...args: any[]) => void;
|
|
8
|
+
animate: (...args: any[]) => void;
|
|
9
|
+
remove: () => void;
|
|
10
|
+
hide: () => void;
|
|
11
|
+
show: () => void;
|
|
12
|
+
}
|
|
13
|
+
export default abstract class WrappedDrawing {
|
|
14
|
+
graphie: Graphie;
|
|
15
|
+
abstract wrapper: HTMLDivElement;
|
|
16
|
+
abstract visibleShape: VisibleShape;
|
|
17
|
+
initialPoint: Coord;
|
|
18
|
+
constructor(graphie: Graphie, initialPoint: Coord);
|
|
19
|
+
transform(transformation: any): void;
|
|
20
|
+
toFront(): void;
|
|
21
|
+
toBack(): void;
|
|
22
|
+
remove(): void;
|
|
23
|
+
getMouseTarget(): any;
|
|
24
|
+
moveTo(point: any): void;
|
|
25
|
+
hide(): void;
|
|
26
|
+
show(): void;
|
|
27
|
+
attr(...args: any[]): void;
|
|
28
|
+
animate(...args: any[]): void;
|
|
29
|
+
}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import WrappedDrawing from "./wrapped-drawing";
|
|
1
2
|
import type { Coord } from "./types";
|
|
2
|
-
|
|
3
|
+
import type { VisibleShape } from "./wrapped-drawing";
|
|
4
|
+
declare class WrappedEllipse extends WrappedDrawing {
|
|
5
|
+
initialPoint: Coord;
|
|
6
|
+
wrapper: HTMLDivElement;
|
|
7
|
+
visibleShape: VisibleShape;
|
|
8
|
+
constructor(graphie: any, center: Coord, radii: [number, number], options: any);
|
|
9
|
+
}
|
|
3
10
|
export default WrappedEllipse;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import WrappedDrawing from "./wrapped-drawing";
|
|
1
2
|
import type { Coord } from "./types";
|
|
2
|
-
|
|
3
|
+
import type { VisibleShape } from "./wrapped-drawing";
|
|
4
|
+
declare class WrappedLine extends WrappedDrawing {
|
|
5
|
+
initialLength: number;
|
|
6
|
+
wrapper: HTMLDivElement;
|
|
7
|
+
visibleShape: VisibleShape;
|
|
8
|
+
constructor(graphie: any, start: Coord, end: Coord, options: any);
|
|
9
|
+
getMouseTarget(): HTMLDivElement;
|
|
10
|
+
moveTo(start: any, end: any): void;
|
|
11
|
+
}
|
|
3
12
|
export default WrappedLine;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import WrappedDrawing from "./wrapped-drawing";
|
|
1
2
|
import type { Coord } from "./types";
|
|
2
|
-
|
|
3
|
+
import type { VisibleShape } from "./wrapped-drawing";
|
|
4
|
+
declare class WrappedPath extends WrappedDrawing {
|
|
5
|
+
wrapper: HTMLDivElement;
|
|
6
|
+
visibleShape: VisibleShape;
|
|
7
|
+
constructor(graphie: any, points: ReadonlyArray<Coord>, options: any);
|
|
8
|
+
}
|
|
3
9
|
export default WrappedPath;
|
package/dist/logging/log.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export declare const Errors: Readonly<{
|
|
|
39
39
|
/**
|
|
40
40
|
* @type {ErrorKind} The kind of error being reported
|
|
41
41
|
*/
|
|
42
|
-
export type ErrorKind = typeof Errors[keyof typeof Errors];
|
|
42
|
+
export type ErrorKind = (typeof Errors)[keyof typeof Errors];
|
|
43
43
|
export type LogErrorOptions = {
|
|
44
44
|
cause?: Error | null | undefined;
|
|
45
45
|
loggedMetadata?: Metadata | null | undefined;
|
package/dist/perseus-types.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export type PerseusImageDetail = {
|
|
|
31
31
|
height: number;
|
|
32
32
|
};
|
|
33
33
|
export declare const ItemExtras: readonly ["calculator", "chi2Table", "financialCalculatorMonthlyPayment", "financialCalculatorTotalAmount", "financialCalculatorTimeToPayOff", "periodicTable", "periodicTableWithKey", "tTable", "zTable"];
|
|
34
|
-
export type PerseusAnswerArea = Record<typeof ItemExtras[number], boolean>;
|
|
34
|
+
export type PerseusAnswerArea = Record<(typeof ItemExtras)[number], boolean>;
|
|
35
35
|
type Widget<Type extends string, Options> = {
|
|
36
36
|
type: Type;
|
|
37
37
|
static?: boolean;
|
|
@@ -65,6 +65,7 @@ export type OrdererWidget = Widget<'orderer', PerseusOrdererWidgetOptions>;
|
|
|
65
65
|
export type PassageRefWidget = Widget<'passage-ref', PerseusPassageRefWidgetOptions>;
|
|
66
66
|
export type PassageWidget = Widget<'passage', PerseusPassageWidgetOptions>;
|
|
67
67
|
export type PlotterWidget = Widget<'plotter', PerseusPlotterWidgetOptions>;
|
|
68
|
+
export type PythonProgramWidget = Widget<'python-program', PerseusPythonProgramWidgetOptions>;
|
|
68
69
|
export type RadioWidget = Widget<'radio', PerseusRadioWidgetOptions>;
|
|
69
70
|
export type SequenceWidget = Widget<'sequence', PerseusSequenceWidgetOptions>;
|
|
70
71
|
export type SimulatorWidget = Widget<'simulator', PerseusSimulatorWidgetOptions>;
|
|
@@ -81,7 +82,7 @@ export type SimpleMarkdownTesterWidget = Widget<'simple-markdown-tester', Perseu
|
|
|
81
82
|
export type UnitInputWidget = Widget<'unit-input', PerseusUnitInputWidgetOptions>;
|
|
82
83
|
export type VideoWidget = Widget<'video', PerseusVideoWidgetOptions>;
|
|
83
84
|
export type AutoCorrectWidget = Widget<'deprecated-standin', PerseusWidgetOptions>;
|
|
84
|
-
export type PerseusWidget = CategorizerWidget | CSProgramWidget | DefinitionWidget | DropdownWidget | ExampleGraphieWidget | ExampleWidget | ExplanationWidget | ExpressionWidget | GradedGroupSetWidget | GradedGroupWidget | GrapherWidget | GroupWidget | IFrameWidget | ImageWidget | InputNumberWidget | InteractionWidget | InteractiveGraphWidget | LabelImageWidget | LightsPuzzleWidget | MatcherWidget | MatrixWidget | MeasurerWidget | MoleculeRendererWidget | NumberLineWidget | NumericInputWidget | OrdererWidget | PassageRefWidget | PassageWidget | PlotterWidget | RadioWidget | ReactionDiagramWidget | RefTargetWidget | SequenceWidget | SimpleMarkdownTesterWidget | SimulatorWidget | SorterWidget | TableWidget | UnitInputWidget | VideoWidget | AutoCorrectWidget;
|
|
85
|
+
export type PerseusWidget = CategorizerWidget | CSProgramWidget | DefinitionWidget | DropdownWidget | ExampleGraphieWidget | ExampleWidget | ExplanationWidget | ExpressionWidget | GradedGroupSetWidget | GradedGroupWidget | GrapherWidget | GroupWidget | IFrameWidget | ImageWidget | InputNumberWidget | InteractionWidget | InteractiveGraphWidget | LabelImageWidget | LightsPuzzleWidget | MatcherWidget | MatrixWidget | MeasurerWidget | MoleculeRendererWidget | NumberLineWidget | NumericInputWidget | OrdererWidget | PassageRefWidget | PassageWidget | PlotterWidget | PythonProgramWidget | RadioWidget | ReactionDiagramWidget | RefTargetWidget | SequenceWidget | SimpleMarkdownTesterWidget | SimulatorWidget | SorterWidget | TableWidget | UnitInputWidget | VideoWidget | AutoCorrectWidget;
|
|
85
86
|
export type PerseusImageBackground = {
|
|
86
87
|
url: string | null | undefined;
|
|
87
88
|
width?: number;
|
|
@@ -141,7 +142,7 @@ export type PerseusExpressionAnswerForm = {
|
|
|
141
142
|
value: string;
|
|
142
143
|
form: boolean;
|
|
143
144
|
simplify: boolean;
|
|
144
|
-
considered: typeof PerseusExpressionAnswerFormConsidered[number];
|
|
145
|
+
considered: (typeof PerseusExpressionAnswerFormConsidered)[number];
|
|
145
146
|
key?: string;
|
|
146
147
|
};
|
|
147
148
|
export type PerseusGradedGroupWidgetOptions = {
|
|
@@ -410,7 +411,7 @@ export type PerseusPassageRefWidgetOptions = {
|
|
|
410
411
|
summaryText: string;
|
|
411
412
|
};
|
|
412
413
|
export declare const plotterPlotTypes: readonly ["bar", "line", "pic", "histogram", "dotplot"];
|
|
413
|
-
export type PlotType = typeof plotterPlotTypes[number];
|
|
414
|
+
export type PlotType = (typeof plotterPlotTypes)[number];
|
|
414
415
|
export type PerseusPlotterWidgetOptions = {
|
|
415
416
|
labels: ReadonlyArray<string>;
|
|
416
417
|
categories: ReadonlyArray<string>;
|
|
@@ -636,6 +637,10 @@ export type PerseusCSProgramSetting = {
|
|
|
636
637
|
name: string;
|
|
637
638
|
value: string;
|
|
638
639
|
};
|
|
640
|
+
export type PerseusPythonProgramWidgetOptions = {
|
|
641
|
+
programID: string;
|
|
642
|
+
height: number;
|
|
643
|
+
};
|
|
639
644
|
export type PerseusIFrameWidgetOptions = {
|
|
640
645
|
url: string;
|
|
641
646
|
settings: ReadonlyArray<PerseusCSProgramSetting>;
|
|
@@ -4,6 +4,6 @@ export declare const containerSizeClass: {
|
|
|
4
4
|
readonly LARGE: "large";
|
|
5
5
|
readonly XLARGE: "xlarge";
|
|
6
6
|
};
|
|
7
|
-
export type SizeClass = typeof containerSizeClass[keyof typeof containerSizeClass];
|
|
7
|
+
export type SizeClass = (typeof containerSizeClass)[keyof typeof containerSizeClass];
|
|
8
8
|
export declare const getClassFromWidth: (width: number) => SizeClass;
|
|
9
9
|
export declare const getInteractiveBoxFromSizeClass: (sizeClass: SizeClass) => [number, number];
|
|
@@ -212,7 +212,7 @@ declare const _default: Readonly<{
|
|
|
212
212
|
onFocus: (blurPath: import("../types").FocusPath) => void;
|
|
213
213
|
times: boolean;
|
|
214
214
|
value: string;
|
|
215
|
-
}, "onChange" | "
|
|
215
|
+
}, "onChange" | "analytics" | "buttonsVisible" | "static" | "containerSizeClass" | "widgetId" | "problemNum" | "questionCompleted" | "findWidgets" | "trackInteraction" | "keypadElement" | "keypadConfiguration" | "alignment" | "reviewModeRubric" | "isLastUsedWidget"> & {
|
|
216
216
|
onFocus?: ((blurPath: import("../types").FocusPath) => void) | undefined;
|
|
217
217
|
onBlur?: ((blurPath: import("../types").FocusPath) => void) | undefined;
|
|
218
218
|
value?: string | undefined;
|
|
@@ -401,7 +401,7 @@ declare const _default: Readonly<{
|
|
|
401
401
|
onFocus: (blurPath: import("../types").FocusPath) => void;
|
|
402
402
|
times: boolean;
|
|
403
403
|
value: string;
|
|
404
|
-
}, "onChange" | "
|
|
404
|
+
}, "onChange" | "analytics" | "buttonsVisible" | "static" | "containerSizeClass" | "widgetId" | "problemNum" | "questionCompleted" | "findWidgets" | "trackInteraction" | "keypadElement" | "keypadConfiguration" | "alignment" | "reviewModeRubric" | "isLastUsedWidget"> & {
|
|
405
405
|
onFocus?: ((blurPath: import("../types").FocusPath) => void) | undefined;
|
|
406
406
|
onBlur?: ((blurPath: import("../types").FocusPath) => void) | undefined;
|
|
407
407
|
value?: string | undefined;
|
|
@@ -24,7 +24,7 @@ type DefaultProps = {
|
|
|
24
24
|
linterContext: Props["linterContext"];
|
|
25
25
|
};
|
|
26
26
|
type State = {
|
|
27
|
-
status: typeof GRADING_STATUSES[keyof typeof GRADING_STATUSES];
|
|
27
|
+
status: (typeof GRADING_STATUSES)[keyof typeof GRADING_STATUSES];
|
|
28
28
|
showHint: boolean;
|
|
29
29
|
message: string;
|
|
30
30
|
answerBarState: ANSWER_BAR_STATES;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
type Props = {
|
|
3
|
+
programID: string;
|
|
4
|
+
height: number;
|
|
5
|
+
};
|
|
6
|
+
type DefaultProps = {
|
|
7
|
+
height: Props["height"];
|
|
8
|
+
};
|
|
9
|
+
declare class PythonProgram extends React.Component<Props> {
|
|
10
|
+
static defaultProps: DefaultProps;
|
|
11
|
+
render(): React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
declare const _default: Readonly<{
|
|
14
|
+
name: string;
|
|
15
|
+
displayName: string;
|
|
16
|
+
getWidget?: (() => typeof PythonProgram) | undefined;
|
|
17
|
+
widget: typeof PythonProgram;
|
|
18
|
+
accessible?: boolean | ((props: any) => boolean) | undefined;
|
|
19
|
+
hidden?: boolean | undefined;
|
|
20
|
+
version?: import("../types").Version | undefined;
|
|
21
|
+
supportedAlignments?: readonly import("../types").Alignment[] | undefined;
|
|
22
|
+
defaultAlignment?: import("../types").Alignment | undefined;
|
|
23
|
+
getDefaultAlignment?: (() => import("../types").Alignment) | undefined;
|
|
24
|
+
isLintable?: boolean | undefined;
|
|
25
|
+
tracking?: import("../types").Tracking | undefined;
|
|
26
|
+
traverseChildWidgets?: any;
|
|
27
|
+
transform?: import("../types").WidgetTransform | undefined;
|
|
28
|
+
staticTransform?: import("../types").WidgetTransform | undefined;
|
|
29
|
+
propUpgrades?: {
|
|
30
|
+
[key: string]: (arg1: any) => any;
|
|
31
|
+
} | undefined;
|
|
32
|
+
}>;
|
|
33
|
+
export default _default;
|
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": "19.
|
|
6
|
+
"version": "19.2.0",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@khanacademy/kas": "^0.3.8",
|
|
29
29
|
"@khanacademy/kmath": "^0.1.12",
|
|
30
|
-
"@khanacademy/math-input": "^17.0.
|
|
30
|
+
"@khanacademy/math-input": "^17.0.8",
|
|
31
31
|
"@khanacademy/perseus-core": "1.4.2",
|
|
32
|
-
"@khanacademy/perseus-linter": "^0.3.
|
|
33
|
-
"@khanacademy/pure-markdown": "^0.2.
|
|
32
|
+
"@khanacademy/perseus-linter": "^0.3.12",
|
|
33
|
+
"@khanacademy/pure-markdown": "^0.2.15",
|
|
34
34
|
"@khanacademy/simple-markdown": "^0.11.3",
|
|
35
35
|
"@khanacademy/wonder-blocks-banner": "^3.0.33"
|
|
36
36
|
},
|