@khanacademy/perseus 18.0.1 → 19.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.
- package/CHANGELOG.md +6 -0
- package/dist/es/index.css +0 -24
- package/dist/es/index.js +77 -2496
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +0 -24
- package/dist/index.d.ts +0 -1
- package/dist/index.js +75 -2496
- package/dist/index.js.map +1 -1
- package/dist/perseus-types.d.ts +2 -109
- package/dist/strings.js +0 -29
- package/dist/types.d.ts +0 -4
- package/dist/widgets/expression.d.ts +2 -2
- package/dist/widgets.d.ts +1 -1
- package/package.json +1 -1
- package/src/__tests__/widgets.test.ts +0 -1
- package/src/extra-widgets.ts +0 -2
- package/src/index.ts +0 -1
- package/src/perseus-types.ts +1 -154
- package/src/styles/perseus-renderer.less +0 -1
- package/src/types.ts +0 -5
- package/src/util/register-all-widgets-for-testing.ts +1 -3
- package/src/widgets/__tests__/renderQuestion.tsx +11 -3
- package/src/widgets.ts +1 -9
- package/tsconfig-build.tsbuildinfo +1 -1
- package/dist/widgets/transformer.d.ts +0 -94
- package/src/styles/widgets/transformer.less +0 -29
- package/src/widgets/__stories__/transformer.stories.tsx +0 -14
- package/src/widgets/__testdata__/transformer.testdata.ts +0 -107
- package/src/widgets/transformer.tsx +0 -2936
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import type { Coord } from "../interactive2/types";
|
|
3
|
-
import type { PerseusTransformerWidgetOptions, PerseusTransformerTransformation as TransformerTransformation } from "../perseus-types";
|
|
4
|
-
import type { Path, PerseusScore, WidgetProps } from "../types";
|
|
5
|
-
type Graphie = any;
|
|
6
|
-
type Tool = any;
|
|
7
|
-
type ToolCleanup = any;
|
|
8
|
-
type Rubric = PerseusTransformerWidgetOptions;
|
|
9
|
-
type RenderProps = PerseusTransformerWidgetOptions;
|
|
10
|
-
type UserInput = any;
|
|
11
|
-
type Props = WidgetProps<RenderProps, Rubric> & {
|
|
12
|
-
transformations: ReadonlyArray<TransformerTransformation>;
|
|
13
|
-
keypadElement: any;
|
|
14
|
-
};
|
|
15
|
-
declare class Transformer extends React.Component<Props> {
|
|
16
|
-
tools: {
|
|
17
|
-
[key: string]: Tool;
|
|
18
|
-
};
|
|
19
|
-
currentTool: Tool | null | undefined;
|
|
20
|
-
transformations: ReadonlyArray<TransformerTransformation>;
|
|
21
|
-
shape: any | null | undefined;
|
|
22
|
-
dilationCircle: any | null | undefined;
|
|
23
|
-
rotatePoint: any | null | undefined;
|
|
24
|
-
rotateHandle: any | null | undefined;
|
|
25
|
-
static defaultProps: any;
|
|
26
|
-
render(): React.ReactNode;
|
|
27
|
-
componentDidMount(): void;
|
|
28
|
-
componentDidUpdate(prevProps: Props): void;
|
|
29
|
-
shouldSetupGraphie: (arg1: Props, arg2: Props) => boolean;
|
|
30
|
-
graphie: () => Graphie;
|
|
31
|
-
setupGraphie: (arg1: Graphie) => void;
|
|
32
|
-
setTransformations: (arg1: ReadonlyArray<TransformerTransformation>) => void;
|
|
33
|
-
addTransformerShape: (arg1: any, arg2: boolean) => void;
|
|
34
|
-
addTool: (arg1: TransformerTransformation["type"]) => void;
|
|
35
|
-
removeTool: (arg1: string) => void;
|
|
36
|
-
addTranslationTool: () => any;
|
|
37
|
-
snapCoord: (arg1: Coord) => Coord;
|
|
38
|
-
normalizeReflectionCoords: (arg1: [Coord, Coord]) => [Coord, Coord];
|
|
39
|
-
addReflectionTool: () => ToolCleanup;
|
|
40
|
-
scaleToCurrentRange: (arg1: number) => number;
|
|
41
|
-
addRotationTool: () => ToolCleanup;
|
|
42
|
-
addDilationTool: () => ToolCleanup;
|
|
43
|
-
getRotationTransformFromAngle: (arg1: Coord, arg2: number) => TransformerTransformation;
|
|
44
|
-
doTransform: (arg1: TransformerTransformation, arg2?: (arg1: any) => unknown | null | undefined) => void;
|
|
45
|
-
applyTransform: (arg1: TransformerTransformation) => void;
|
|
46
|
-
applyCoordTransformation: (arg1: TransformerTransformation) => void;
|
|
47
|
-
resetCoords: () => void;
|
|
48
|
-
handleUndoClick: () => void;
|
|
49
|
-
setTransformationProps: (arg1: ReadonlyArray<TransformerTransformation>, arg2: (arg1: any) => unknown) => void;
|
|
50
|
-
addTransform: (arg1: TransformerTransformation, arg2?: (arg1: any) => unknown | null | undefined) => void;
|
|
51
|
-
changeTool: (arg1: Tool, arg2: any) => void;
|
|
52
|
-
simpleValidate: (arg1: Rubric) => PerseusScore;
|
|
53
|
-
/**
|
|
54
|
-
* Calculate where the coordinates would be if they were
|
|
55
|
-
* moved, even if we're in formal mode with no movement
|
|
56
|
-
* (and thus the actual movablepoints may not have moved
|
|
57
|
-
*/
|
|
58
|
-
getCoords: () => Coord;
|
|
59
|
-
getEditorJSON: () => any;
|
|
60
|
-
getUserInput: UserInput;
|
|
61
|
-
_handleFocus: (...rest: ReadonlyArray<string>) => void;
|
|
62
|
-
_handleBlur: (...rest: ReadonlyArray<string>) => void;
|
|
63
|
-
_getTransformationForID: (arg1: string) => any;
|
|
64
|
-
getInputPaths: () => ReadonlyArray<Path>;
|
|
65
|
-
_passToInner: (arg1: string, arg2: ReadonlyArray<string>, arg3?: any | null | undefined, arg4?: (arg1: any) => unknown | null | undefined) => any;
|
|
66
|
-
focus: () => boolean;
|
|
67
|
-
focusInputPath: (arg1: Path) => boolean;
|
|
68
|
-
blurInputPath: (arg1: Path) => boolean;
|
|
69
|
-
setInputValue: (arg1: Path, arg2: any, arg3: (arg1: any) => unknown) => any;
|
|
70
|
-
getDOMNodeForPath: (arg1: Path) => any;
|
|
71
|
-
getGrammarTypeForPath: (arg1: Path) => any;
|
|
72
|
-
static validate(guess: UserInput, rubric: Rubric): PerseusScore;
|
|
73
|
-
}
|
|
74
|
-
declare const _default: Readonly<{
|
|
75
|
-
name: string;
|
|
76
|
-
displayName: string;
|
|
77
|
-
getWidget?: (() => typeof Transformer) | undefined;
|
|
78
|
-
accessible?: boolean | ((props: any) => boolean) | undefined;
|
|
79
|
-
hidden?: boolean | undefined;
|
|
80
|
-
version?: import("../types").Version | undefined;
|
|
81
|
-
supportedAlignments?: readonly import("../types").Alignment[] | undefined;
|
|
82
|
-
defaultAlignment?: import("../types").Alignment | undefined;
|
|
83
|
-
getDefaultAlignment?: (() => import("../types").Alignment) | undefined;
|
|
84
|
-
isLintable?: boolean | undefined;
|
|
85
|
-
tracking?: import("../types").Tracking | undefined;
|
|
86
|
-
traverseChildWidgets?: any;
|
|
87
|
-
transform?: import("../types").WidgetTransform | undefined;
|
|
88
|
-
staticTransform?: import("../types").WidgetTransform | undefined;
|
|
89
|
-
propUpgrades?: {
|
|
90
|
-
[key: string]: (arg1: any) => any;
|
|
91
|
-
} | undefined;
|
|
92
|
-
widget: typeof Transformer;
|
|
93
|
-
}>;
|
|
94
|
-
export default _default;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
.perseus-widget-transformer {
|
|
2
|
-
.highlighted-tool-button {
|
|
3
|
-
text-shadow: 1px 1px rgba(0, 0, 0, 0.25);
|
|
4
|
-
}
|
|
5
|
-
> .graphie-container {
|
|
6
|
-
margin-bottom: 10px;
|
|
7
|
-
position: relative;
|
|
8
|
-
overflow: hidden;
|
|
9
|
-
|
|
10
|
-
> img,
|
|
11
|
-
> .unresponsive-svg-image {
|
|
12
|
-
position: absolute;
|
|
13
|
-
// Preserves background image alignment (if image is a graph,
|
|
14
|
-
// it can extend up and to the right to allow for axis labels)
|
|
15
|
-
bottom: 0;
|
|
16
|
-
left: 0;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
.transformer-undo-button {
|
|
20
|
-
float: right;
|
|
21
|
-
}
|
|
22
|
-
.perseus-transformation-list {
|
|
23
|
-
input {
|
|
24
|
-
width: 40px;
|
|
25
|
-
}
|
|
26
|
-
margin-top: 10px;
|
|
27
|
-
margin-bottom: 10px;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
|
|
3
|
-
import {RendererWithDebugUI} from "../../../../../testing/renderer-with-debug-ui";
|
|
4
|
-
import {question} from "../__testdata__/transformer.testdata";
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: "Perseus/Widgets/Transformer",
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
type StoryArgs = Record<any, any>;
|
|
11
|
-
|
|
12
|
-
export const Question = (args: StoryArgs): React.ReactElement => {
|
|
13
|
-
return <RendererWithDebugUI question={question} />;
|
|
14
|
-
};
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import type {PerseusRenderer, TransformerWidget} from "../../perseus-types";
|
|
2
|
-
|
|
3
|
-
export const question: PerseusRenderer = {
|
|
4
|
-
content:
|
|
5
|
-
"$\\overleftrightarrow{MN}$ is the perpendicular bisector of segment $\\overline{JL}$. \n\n**Perform a reflection that proves $M$ must be equidistant from $J$ and $L$ and select the option which explains the proof.** \nThe statement must be true for any point $M$ which lies on the perpendicular bisector. \n\n[[☃ transformer 1]] \n\n",
|
|
6
|
-
images: {
|
|
7
|
-
"https://ka-perseus-images.s3.amazonaws.com/6cf0d9f007084e9d06e3ce0e241416dde920ec9c.png":
|
|
8
|
-
{height: 503, width: 504},
|
|
9
|
-
},
|
|
10
|
-
widgets: {
|
|
11
|
-
"transformer 1": {
|
|
12
|
-
graded: true,
|
|
13
|
-
options: {
|
|
14
|
-
correct: {
|
|
15
|
-
shape: {
|
|
16
|
-
coords: [
|
|
17
|
-
[-1.1546319456101628e-14, -1.199040866595169e-14],
|
|
18
|
-
[6.999999999999989, 6.999999999999986],
|
|
19
|
-
[-7.000000000000007, 6.999999999999989],
|
|
20
|
-
],
|
|
21
|
-
options: [{}],
|
|
22
|
-
type: ["polygon-3"],
|
|
23
|
-
},
|
|
24
|
-
transformations: [
|
|
25
|
-
{
|
|
26
|
-
line: [
|
|
27
|
-
[1.499999999999988, -1.5000000000000002],
|
|
28
|
-
[-1.4999999999999996, 1.4999999999999882],
|
|
29
|
-
],
|
|
30
|
-
type: "reflection",
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
},
|
|
34
|
-
drawSolutionShape: false,
|
|
35
|
-
gradeEmpty: false,
|
|
36
|
-
graph: {
|
|
37
|
-
backgroundImage: {
|
|
38
|
-
bottom: 0,
|
|
39
|
-
height: 400,
|
|
40
|
-
left: 0,
|
|
41
|
-
scale: 1,
|
|
42
|
-
url: "https://ka-perseus-graphie.s3.amazonaws.com/778924d189c73077f3338098cb4e48fe79695f93.png",
|
|
43
|
-
width: 400,
|
|
44
|
-
},
|
|
45
|
-
gridStep: [1, 1],
|
|
46
|
-
labels: ["x", "y"],
|
|
47
|
-
markings: "none",
|
|
48
|
-
range: [
|
|
49
|
-
[-10, 10],
|
|
50
|
-
[-10, 10],
|
|
51
|
-
],
|
|
52
|
-
rulerLabel: "",
|
|
53
|
-
rulerTicks: 10,
|
|
54
|
-
showProtractor: false,
|
|
55
|
-
showRuler: false,
|
|
56
|
-
snapStep: [0.5, 0.5],
|
|
57
|
-
step: [1, 1],
|
|
58
|
-
},
|
|
59
|
-
graphMode: "interactive",
|
|
60
|
-
listMode: "static",
|
|
61
|
-
starting: {
|
|
62
|
-
shape: {
|
|
63
|
-
coords: [
|
|
64
|
-
[0, 0],
|
|
65
|
-
[-7, -7],
|
|
66
|
-
[-7, 7],
|
|
67
|
-
],
|
|
68
|
-
options: [{}],
|
|
69
|
-
type: ["polygon-3"],
|
|
70
|
-
},
|
|
71
|
-
transformations: [],
|
|
72
|
-
},
|
|
73
|
-
tools: {
|
|
74
|
-
dilation: {
|
|
75
|
-
constraints: {fixed: false},
|
|
76
|
-
coord: [6, 6],
|
|
77
|
-
enabled: true,
|
|
78
|
-
required: false,
|
|
79
|
-
},
|
|
80
|
-
reflection: {
|
|
81
|
-
constraints: {fixed: false},
|
|
82
|
-
coords: [
|
|
83
|
-
[8, -1.5],
|
|
84
|
-
[8, 2.5],
|
|
85
|
-
],
|
|
86
|
-
enabled: true,
|
|
87
|
-
required: false,
|
|
88
|
-
},
|
|
89
|
-
rotation: {
|
|
90
|
-
constraints: {fixed: false},
|
|
91
|
-
coord: [1, 6],
|
|
92
|
-
enabled: true,
|
|
93
|
-
required: false,
|
|
94
|
-
},
|
|
95
|
-
translation: {
|
|
96
|
-
constraints: {},
|
|
97
|
-
enabled: true,
|
|
98
|
-
required: false,
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
version: 1.2,
|
|
102
|
-
},
|
|
103
|
-
type: "transformer",
|
|
104
|
-
version: {major: 0, minor: 0},
|
|
105
|
-
} as TransformerWidget,
|
|
106
|
-
},
|
|
107
|
-
};
|