@khanacademy/perseus 0.1.0 → 0.2.2
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 +30 -0
- package/dist/es/index.css +4361 -0
- package/dist/es/index.js +2 -10
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +0 -7573
- package/dist/index.js +2 -10
- package/dist/index.js.map +1 -1
- package/dist/strings.js +0 -45
- package/package.json +16 -6
- package/src/README.md +33 -5
- package/src/components/fixed-to-responsive.jsx +1 -0
- package/src/components/graph.jsx +2 -1
- package/src/components/info-tip/info-tip.jsx +0 -3
- package/src/components/input-with-examples.jsx +1 -1
- package/src/components/lint.jsx +0 -2
- package/src/components/number-input.jsx +1 -1
- package/src/components/prop-check-box.jsx +3 -1
- package/src/components/range-input.jsx +1 -1
- package/src/components/simple-keypad-input.jsx +5 -5
- package/src/components/sortable.jsx +1 -0
- package/src/components/stub-tag-editor.jsx +1 -0
- package/src/interactive2/movable-helper-methods.js +1 -1
- package/src/interactive2/movable-line-options.js +2 -2
- package/src/interactive2/movable-line.js +1 -1
- package/src/interactive2/movable-point-options.js +1 -1
- package/src/interactive2/movable-point.jsx +1 -2
- package/src/interactive2/movable-polygon-options.js +1 -1
- package/src/interactive2/movable-polygon.js +2 -1
- package/src/interactive2/movable.js +1 -1
- package/src/interactive2/wrapped-defaults.js +1 -1
- package/src/interactive2/wrapped-ellipse.js +1 -1
- package/src/interactive2/wrapped-line.js +1 -1
- package/src/jipt-paragraphs.js +6 -6
- package/src/mixins/provide-keypad.jsx +3 -3
- package/src/multi-items/multi-renderer.jsx +1 -0
- package/src/perseus-markdown.jsx +6 -7
- package/src/pure-markdown.js +2 -1
- package/src/renderer.jsx +1 -0
- package/src/styles/perseus-renderer.less +1 -2
- package/src/util/answer-types.js +1 -1
- package/src/util/graphie.js +2 -1
- package/src/util/interactive.js +12 -5
- package/src/util/math.js +1 -1
- package/src/widgets/__stories__/unit.stories.jsx +45 -0
- package/src/widgets/__stories__/video-transcript-link.stories.jsx +24 -0
- package/src/widgets/__tests__/renderQuestion.jsx +1 -0
- package/src/widgets/cs-program.jsx +0 -1
- package/src/widgets/expression.jsx +3 -5
- package/src/widgets/grapher/util.jsx +9 -22
- package/src/widgets/grapher.jsx +6 -1
- package/src/widgets/iframe.jsx +0 -1
- package/src/widgets/image.jsx +1 -0
- package/src/widgets/input-number.jsx +1 -0
- package/src/widgets/interaction.jsx +2 -2
- package/src/widgets/interactive-graph.jsx +1 -2
- package/src/widgets/matrix.jsx +1 -0
- package/src/widgets/number-line.jsx +1 -1
- package/src/widgets/numeric-input.jsx +2 -2
- package/src/widgets/passage/passage-markdown.jsx +1 -1
- package/src/widgets/radio/cross-out-menu-wrapper.jsx +5 -5
- package/src/widgets/reaction-diagram.jsx +1 -0
- package/src/widgets/simulator.jsx +1 -1
- package/src/widgets/table.jsx +1 -2
- package/src/widgets/transformer.jsx +14 -8
- package/src/widgets/unit.jsx +3 -2
- package/src/widgets/video.jsx +1 -6
- package/README.md +0 -3
package/src/util/answer-types.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint-disable no-useless-escape */
|
|
2
2
|
// @flow
|
|
3
|
+
import * as KAS from "@khanacademy/kas";
|
|
3
4
|
import * as i18n from "@khanacademy/wonder-blocks-i18n";
|
|
4
5
|
import $ from "jquery";
|
|
5
|
-
import KAS from "kas";
|
|
6
6
|
import _ from "underscore";
|
|
7
7
|
|
|
8
8
|
import {Errors} from "../logging/log.js";
|
package/src/util/graphie.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/* eslint-disable @babel/no-invalid-this */
|
|
2
2
|
// @flow
|
|
3
|
+
import {point as kpoint, vector as kvector} from "@khanacademy/kmath";
|
|
3
4
|
import $ from "jquery";
|
|
4
|
-
|
|
5
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
5
6
|
import Raphael from "raphael";
|
|
6
7
|
import _ from "underscore";
|
|
7
8
|
|
package/src/util/interactive.js
CHANGED
|
@@ -9,8 +9,13 @@
|
|
|
9
9
|
|
|
10
10
|
// TODO(emily): This file breaks our line length limits like nobody's business.
|
|
11
11
|
// Figure out how to fix that.
|
|
12
|
+
import {
|
|
13
|
+
vector as kvector,
|
|
14
|
+
point as kpoint,
|
|
15
|
+
line as kline,
|
|
16
|
+
} from "@khanacademy/kmath";
|
|
12
17
|
import $ from "jquery";
|
|
13
|
-
|
|
18
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
14
19
|
import Raphael from "raphael";
|
|
15
20
|
import _ from "underscore";
|
|
16
21
|
|
|
@@ -1299,7 +1304,7 @@ _.extend(GraphUtils.Graphie.prototype, {
|
|
|
1299
1304
|
|
|
1300
1305
|
const distance = xExtent + yExtent;
|
|
1301
1306
|
const angleVec = graph.unscaleVector(
|
|
1302
|
-
kvector.cartFromPolarDeg(
|
|
1307
|
+
kvector.cartFromPolarDeg(1, angle),
|
|
1303
1308
|
);
|
|
1304
1309
|
const distVec = kvector.scale(
|
|
1305
1310
|
kvector.normalize(angleVec),
|
|
@@ -2711,10 +2716,10 @@ _.extend(GraphUtils.Graphie.prototype, {
|
|
|
2711
2716
|
) {
|
|
2712
2717
|
const distFromRotationCenter =
|
|
2713
2718
|
radius + distanceFromArrowMidline;
|
|
2714
|
-
const vec = kvector.cartFromPolarDeg(
|
|
2719
|
+
const vec = kvector.cartFromPolarDeg(
|
|
2715
2720
|
distFromRotationCenter,
|
|
2716
2721
|
angle + offset,
|
|
2717
|
-
|
|
2722
|
+
);
|
|
2718
2723
|
const absolute = kvector.add(center, vec);
|
|
2719
2724
|
const pixels = graphie.scalePoint(absolute);
|
|
2720
2725
|
return pixels[0] + "," + pixels[1];
|
|
@@ -2886,13 +2891,15 @@ _.extend(GraphUtils.Graphie.prototype, {
|
|
|
2886
2891
|
const oldAngle = oldPolar[1];
|
|
2887
2892
|
const newAngle = newPolar[1];
|
|
2888
2893
|
let result = options.onMove(newAngle, oldAngle);
|
|
2894
|
+
// $FlowFixMe[incompatible-type] add proper onMove param type
|
|
2889
2895
|
if (result != null && result !== true) {
|
|
2896
|
+
// $FlowFixMe[incompatible-type] add proper onMove param type
|
|
2890
2897
|
if (result === false) {
|
|
2891
2898
|
result = oldAngle;
|
|
2892
2899
|
}
|
|
2893
2900
|
coord = kvector.add(
|
|
2894
2901
|
rotatePoint.coord,
|
|
2895
|
-
kvector.cartFromPolarDeg(
|
|
2902
|
+
kvector.cartFromPolarDeg(oldPolar[0], result),
|
|
2896
2903
|
);
|
|
2897
2904
|
}
|
|
2898
2905
|
}
|
package/src/util/math.js
CHANGED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import {ApiOptions} from "../../perseus-api.jsx";
|
|
5
|
+
import {OldUnitInput} from "../unit.jsx";
|
|
6
|
+
|
|
7
|
+
type StoryArgs = {||};
|
|
8
|
+
|
|
9
|
+
type Story = {|
|
|
10
|
+
title: string,
|
|
11
|
+
|};
|
|
12
|
+
|
|
13
|
+
export default ({
|
|
14
|
+
title: "Perseus/Widgets/Unit",
|
|
15
|
+
}: Story);
|
|
16
|
+
|
|
17
|
+
export const StaticRender = (args: StoryArgs): React.Node => {
|
|
18
|
+
return (
|
|
19
|
+
<OldUnitInput
|
|
20
|
+
apiOptions={{
|
|
21
|
+
...ApiOptions.defaults,
|
|
22
|
+
staticRender: true,
|
|
23
|
+
}}
|
|
24
|
+
value="2 tbsp"
|
|
25
|
+
onFocus={() => {}}
|
|
26
|
+
onBlur={() => {}}
|
|
27
|
+
onChange={({value}) => {}}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const NonStaticRender = (args: StoryArgs): React.Node => {
|
|
33
|
+
return (
|
|
34
|
+
<OldUnitInput
|
|
35
|
+
apiOptions={{
|
|
36
|
+
...ApiOptions.defaults,
|
|
37
|
+
staticRender: false,
|
|
38
|
+
}}
|
|
39
|
+
value="2 tbsp"
|
|
40
|
+
onFocus={() => {}}
|
|
41
|
+
onBlur={() => {}}
|
|
42
|
+
onChange={({value}) => {}}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import VideoTranscriptLink from "../video-transcript-link.jsx";
|
|
5
|
+
|
|
6
|
+
type StoryArgs = {||};
|
|
7
|
+
|
|
8
|
+
type Story = {|
|
|
9
|
+
title: string,
|
|
10
|
+
|};
|
|
11
|
+
|
|
12
|
+
export default ({
|
|
13
|
+
title: "Perseus/Components/Video Transcript Link",
|
|
14
|
+
}: Story);
|
|
15
|
+
|
|
16
|
+
export const YoutubeVideoLink = (args: StoryArgs): React.Node => {
|
|
17
|
+
return (
|
|
18
|
+
<VideoTranscriptLink location="https://www.youtube.com/watch?v=YoutubeId" />
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const SlugVideoLink = (args: StoryArgs): React.Node => {
|
|
23
|
+
return <VideoTranscriptLink location="slug-video-id" />;
|
|
24
|
+
};
|
|
@@ -30,7 +30,6 @@ function getUrlFromProgramID(programID) {
|
|
|
30
30
|
// as a `file://` URL. In this case, we want to reference `ka.org` instead
|
|
31
31
|
// of defaulting to what we get from `toAbsoluteUrl`.
|
|
32
32
|
if (isFileProtocol(InitialRequestUrl.protocol)) {
|
|
33
|
-
// eslint-disable-next-line static-service/require-safe-link-to
|
|
34
33
|
return `https://khanacademy.org${path}`;
|
|
35
34
|
}
|
|
36
35
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
1
2
|
// @flow
|
|
2
|
-
import
|
|
3
|
+
import * as KAS from "@khanacademy/kas";
|
|
4
|
+
import {KeypadInput, KeypadTypes} from "@khanacademy/math-input";
|
|
3
5
|
import * as i18n from "@khanacademy/wonder-blocks-i18n";
|
|
4
6
|
import classNames from "classnames";
|
|
5
|
-
import KAS from "kas";
|
|
6
7
|
import * as React from "react";
|
|
7
8
|
import _ from "underscore";
|
|
8
9
|
|
|
@@ -20,9 +21,6 @@ import KhanAnswerTypes from "../util/answer-types.js";
|
|
|
20
21
|
import type {PerseusExpressionWidgetOptions} from "../perseus-types.js";
|
|
21
22
|
import type {PerseusScore, WidgetExports, WidgetProps} from "../types.js";
|
|
22
23
|
|
|
23
|
-
const {KeypadInput} = components;
|
|
24
|
-
const {KeypadTypes} = consts;
|
|
25
|
-
|
|
26
24
|
type InputPath = $ReadOnlyArray<string>;
|
|
27
25
|
|
|
28
26
|
const ERROR_MESSAGE = i18n._("Sorry, I don't understand that!");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable one-var */
|
|
2
2
|
// @flow
|
|
3
|
-
import {point as kpoint} from "kmath";
|
|
3
|
+
import {point as kpoint} from "@khanacademy/kmath";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import _ from "underscore";
|
|
6
6
|
|
|
@@ -105,9 +105,7 @@ const PlotDefaults = {
|
|
|
105
105
|
};
|
|
106
106
|
|
|
107
107
|
const Linear = _.extend({}, PlotDefaults, {
|
|
108
|
-
url:
|
|
109
|
-
// eslint-disable-next-line static-service/require-safe-link-to
|
|
110
|
-
"https://ka-perseus-graphie.s3.amazonaws.com/67aaf581e6d9ef9038c10558a1f70ac21c11c9f8.png",
|
|
108
|
+
url: "https://ka-perseus-graphie.s3.amazonaws.com/67aaf581e6d9ef9038c10558a1f70ac21c11c9f8.png",
|
|
111
109
|
|
|
112
110
|
defaultCoords: [
|
|
113
111
|
[0.25, 0.75],
|
|
@@ -145,9 +143,7 @@ const Linear = _.extend({}, PlotDefaults, {
|
|
|
145
143
|
});
|
|
146
144
|
|
|
147
145
|
const Quadratic = _.extend({}, PlotDefaults, {
|
|
148
|
-
url:
|
|
149
|
-
// eslint-disable-next-line static-service/require-safe-link-to
|
|
150
|
-
"https://ka-perseus-graphie.s3.amazonaws.com/e23d36e6fc29ee37174e92c9daba2a66677128ab.png",
|
|
146
|
+
url: "https://ka-perseus-graphie.s3.amazonaws.com/e23d36e6fc29ee37174e92c9daba2a66677128ab.png",
|
|
151
147
|
|
|
152
148
|
defaultCoords: [
|
|
153
149
|
[0.5, 0.5],
|
|
@@ -205,9 +201,7 @@ const Quadratic = _.extend({}, PlotDefaults, {
|
|
|
205
201
|
});
|
|
206
202
|
|
|
207
203
|
const Sinusoid = _.extend({}, PlotDefaults, {
|
|
208
|
-
url:
|
|
209
|
-
// eslint-disable-next-line static-service/require-safe-link-to
|
|
210
|
-
"https://ka-perseus-graphie.s3.amazonaws.com/3d68e7718498475f53b206c2ab285626baf8857e.png",
|
|
204
|
+
url: "https://ka-perseus-graphie.s3.amazonaws.com/3d68e7718498475f53b206c2ab285626baf8857e.png",
|
|
211
205
|
|
|
212
206
|
defaultCoords: [
|
|
213
207
|
[0.5, 0.5],
|
|
@@ -273,9 +267,7 @@ const Sinusoid = _.extend({}, PlotDefaults, {
|
|
|
273
267
|
});
|
|
274
268
|
|
|
275
269
|
const Tangent = _.extend({}, PlotDefaults, {
|
|
276
|
-
url:
|
|
277
|
-
// eslint-disable-next-line static-service/require-safe-link-to
|
|
278
|
-
"https://ka-perseus-graphie.s3.amazonaws.com/7db80d23c35214f98659fe1cf0765811c1bbfbba.png",
|
|
270
|
+
url: "https://ka-perseus-graphie.s3.amazonaws.com/7db80d23c35214f98659fe1cf0765811c1bbfbba.png",
|
|
279
271
|
|
|
280
272
|
defaultCoords: [
|
|
281
273
|
[0.5, 0.5],
|
|
@@ -329,9 +321,7 @@ const Tangent = _.extend({}, PlotDefaults, {
|
|
|
329
321
|
});
|
|
330
322
|
|
|
331
323
|
const Exponential = _.extend({}, PlotDefaults, {
|
|
332
|
-
url:
|
|
333
|
-
// eslint-disable-next-line static-service/require-safe-link-to
|
|
334
|
-
"https://ka-perseus-graphie.s3.amazonaws.com/9cbfad55525e3ce755a31a631b074670a5dad611.png",
|
|
324
|
+
url: "https://ka-perseus-graphie.s3.amazonaws.com/9cbfad55525e3ce755a31a631b074670a5dad611.png",
|
|
335
325
|
|
|
336
326
|
defaultCoords: [
|
|
337
327
|
[0.5, 0.55],
|
|
@@ -437,9 +427,7 @@ const Exponential = _.extend({}, PlotDefaults, {
|
|
|
437
427
|
});
|
|
438
428
|
|
|
439
429
|
const Logarithm = _.extend({}, PlotDefaults, {
|
|
440
|
-
url:
|
|
441
|
-
// eslint-disable-next-line static-service/require-safe-link-to
|
|
442
|
-
"https://ka-perseus-graphie.s3.amazonaws.com/f6491e99d34af34d924bfe0231728ad912068dc3.png",
|
|
430
|
+
url: "https://ka-perseus-graphie.s3.amazonaws.com/f6491e99d34af34d924bfe0231728ad912068dc3.png",
|
|
443
431
|
|
|
444
432
|
defaultCoords: [
|
|
445
433
|
[0.55, 0.5],
|
|
@@ -537,9 +525,7 @@ const Logarithm = _.extend({}, PlotDefaults, {
|
|
|
537
525
|
});
|
|
538
526
|
|
|
539
527
|
const AbsoluteValue = _.extend({}, PlotDefaults, {
|
|
540
|
-
url:
|
|
541
|
-
// eslint-disable-next-line static-service/require-safe-link-to
|
|
542
|
-
"https://ka-perseus-graphie.s3.amazonaws.com/8256a630175a0cb1d11de223d6de0266daf98721.png",
|
|
528
|
+
url: "https://ka-perseus-graphie.s3.amazonaws.com/8256a630175a0cb1d11de223d6de0266daf98721.png",
|
|
543
529
|
|
|
544
530
|
defaultCoords: [
|
|
545
531
|
[0.5, 0.5],
|
|
@@ -695,6 +681,7 @@ export const pointsFromNormalized = (
|
|
|
695
681
|
// on the Graphie to handle snapping. Here, we need the points
|
|
696
682
|
// returned to already be snapped so that the plot that goes
|
|
697
683
|
// through them is correct.
|
|
684
|
+
// $FlowFixMe[invalid-tuple-arity] improve unsnappedPoint type so it knows arity
|
|
698
685
|
return kpoint.roundTo(unsnappedPoint, snapStep);
|
|
699
686
|
});
|
|
700
687
|
};
|
package/src/widgets/grapher.jsx
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
1
2
|
/* eslint-disable react/sort-comp */
|
|
2
3
|
// @flow
|
|
3
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
number as knumber,
|
|
6
|
+
vector as kvector,
|
|
7
|
+
point as kpoint,
|
|
8
|
+
} from "@khanacademy/kmath";
|
|
4
9
|
import * as React from "react";
|
|
5
10
|
import _ from "underscore";
|
|
6
11
|
|
package/src/widgets/iframe.jsx
CHANGED
|
@@ -101,7 +101,6 @@ class Iframe extends React.Component<$FlowFixMe> {
|
|
|
101
101
|
// If the URL doesnt start with http, it must be a program ID
|
|
102
102
|
if (url && url.length && url.indexOf("http") !== 0) {
|
|
103
103
|
url =
|
|
104
|
-
// eslint-disable-next-line static-service/require-safe-link-to
|
|
105
104
|
"https://www.khanacademy.org/computer-programming/program/" +
|
|
106
105
|
url +
|
|
107
106
|
"/embedded?buttons=no&embed=yes&editor=no&author=no";
|
package/src/widgets/image.jsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @babel/no-invalid-this, react/no-unsafe, react/sort-comp */
|
|
2
2
|
// @flow
|
|
3
|
-
import KAS from "kas";
|
|
4
|
-
import {vector as kvector} from "kmath";
|
|
3
|
+
import * as KAS from "@khanacademy/kas";
|
|
4
|
+
import {vector as kvector} from "@khanacademy/kmath";
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import _ from "underscore";
|
|
7
7
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint-disable @babel/no-invalid-this, react/no-unsafe, react/sort-comp */
|
|
2
2
|
// @flow
|
|
3
|
+
import {number as knumber, point as kpoint} from "@khanacademy/kmath";
|
|
3
4
|
import * as i18n from "@khanacademy/wonder-blocks-i18n";
|
|
4
5
|
import $ from "jquery";
|
|
5
|
-
import kmath from "kmath";
|
|
6
6
|
import debounce from "lodash.debounce";
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
import _ from "underscore";
|
|
@@ -37,7 +37,6 @@ type SineCoefficient = [
|
|
|
37
37
|
];
|
|
38
38
|
type QuadraticCoefficient = [/* a */ number, /* b */ number, /* c */ number];
|
|
39
39
|
|
|
40
|
-
const {number: knumber, point: kpoint} = kmath;
|
|
41
40
|
const {DeprecationMixin} = Util;
|
|
42
41
|
|
|
43
42
|
const TRASH_ICON_URI =
|
package/src/widgets/matrix.jsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
1
2
|
// @flow
|
|
2
3
|
|
|
3
4
|
import * as i18n from "@khanacademy/wonder-blocks-i18n";
|
|
@@ -9,8 +10,7 @@ import InputWithExamples from "../components/input-with-examples.jsx";
|
|
|
9
10
|
import PossibleAnswers from "../components/possible-answers.jsx";
|
|
10
11
|
import SimpleKeypadInput from "../components/simple-keypad-input.jsx";
|
|
11
12
|
import {linterContextDefault} from "../gorgon/proptypes.js";
|
|
12
|
-
import {ClassNames as ApiClassNames} from "../perseus-api.jsx";
|
|
13
|
-
import {ApiOptions} from "../perseus-api.jsx";
|
|
13
|
+
import {ApiOptions, ClassNames as ApiClassNames} from "../perseus-api.jsx";
|
|
14
14
|
import TexWrangler from "../tex-wrangler.js";
|
|
15
15
|
import KhanAnswerTypes from "../util/answer-types.js";
|
|
16
16
|
import KhanMath from "../util/math.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* eslint-disable react/sort-comp */
|
|
2
2
|
// @flow
|
|
3
|
+
import SimpleMarkdown from "@khanacademy/simple-markdown";
|
|
3
4
|
import * as i18n from "@khanacademy/wonder-blocks-i18n";
|
|
4
5
|
import PropTypes from "prop-types";
|
|
5
6
|
import * as React from "react";
|
|
6
|
-
import SimpleMarkdown from "simple-markdown";
|
|
7
7
|
import _ from "underscore";
|
|
8
8
|
|
|
9
9
|
const START_REF_PREFIX = "start-ref-";
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* to uncover a cross-out button underneath. (This is why we need to wrap the
|
|
11
11
|
* content!)
|
|
12
12
|
*/
|
|
13
|
-
import
|
|
13
|
+
import Color from "@khanacademy/wonder-blocks-color";
|
|
14
14
|
import * as i18n from "@khanacademy/wonder-blocks-i18n";
|
|
15
15
|
import {StyleSheet, css} from "aphrodite";
|
|
16
16
|
import * as React from "react";
|
|
@@ -248,9 +248,9 @@ export default class CrossOutMenuWrapper extends React.PureComponent<
|
|
|
248
248
|
return this.props.primaryProductColor;
|
|
249
249
|
}
|
|
250
250
|
if (this.state.hovered) {
|
|
251
|
-
return
|
|
251
|
+
return Color.offBlack;
|
|
252
252
|
}
|
|
253
|
-
return
|
|
253
|
+
return Color.offBlack50;
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
_renderMenu(): React.Element<"div"> {
|
|
@@ -396,7 +396,7 @@ const styles = StyleSheet.create({
|
|
|
396
396
|
// to being closed, rather than awkwardly _sliding_ closed.
|
|
397
397
|
[mediaQueries.smOrSmaller]: {
|
|
398
398
|
transition: "transform 0.2s ease-out",
|
|
399
|
-
backgroundColor:
|
|
399
|
+
backgroundColor: Color.white,
|
|
400
400
|
},
|
|
401
401
|
},
|
|
402
402
|
|
|
@@ -471,7 +471,7 @@ const styles = StyleSheet.create({
|
|
|
471
471
|
alignItems: "center",
|
|
472
472
|
justifyContent: "center",
|
|
473
473
|
|
|
474
|
-
background:
|
|
474
|
+
background: Color.offBlack50,
|
|
475
475
|
cursor: "pointer",
|
|
476
476
|
|
|
477
477
|
[mediaQueries.mdOrLarger]: {
|
|
@@ -67,6 +67,7 @@ class ReactionDiagramWidget extends React.Component<$FlowFixMe> {
|
|
|
67
67
|
// we're limited to a single reaction step. At some point, add support
|
|
68
68
|
// for more steps in the reaction.
|
|
69
69
|
rotationAngle: PropTypes.arrayOf(PropTypes.number),
|
|
70
|
+
// eslint-disable-next-line react/forbid-prop-types
|
|
70
71
|
separators: PropTypes.arrayOf(PropTypes.object),
|
|
71
72
|
smiles: PropTypes.arrayOf(PropTypes.string),
|
|
72
73
|
widgetId: PropTypes.string,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-unused-vars, react/no-unsafe, react/sort-comp */
|
|
2
2
|
// @flow
|
|
3
|
+
import {number as knumber} from "@khanacademy/kmath";
|
|
3
4
|
import * as i18n from "@khanacademy/wonder-blocks-i18n";
|
|
4
|
-
import {number as knumber} from "kmath";
|
|
5
5
|
import PropTypes from "prop-types";
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
import ReactDOM from "react-dom";
|
package/src/widgets/table.jsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable react/sort-comp */
|
|
2
2
|
// @flow
|
|
3
|
-
import {
|
|
3
|
+
import {keypadElementPropType} from "@khanacademy/math-input";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import ReactDOM from "react-dom";
|
|
@@ -18,7 +18,6 @@ import KhanAnswerTypes from "../util/answer-types.js";
|
|
|
18
18
|
import type {WidgetExports} from "../types.js";
|
|
19
19
|
|
|
20
20
|
const {assert} = InteractiveUtil;
|
|
21
|
-
const {keypadElementPropType} = propTypes;
|
|
22
21
|
|
|
23
22
|
/* Input handling: Maps a (row, column) pair to a unique ref used by React,
|
|
24
23
|
* and extracts (row, column) pairs from input paths, used to allow outsiders
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
/* eslint-disable
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
2
|
+
/* eslint-disable @babel/no-invalid-this */
|
|
3
|
+
/* eslint-disable camelcase */
|
|
4
|
+
/* eslint-disable react/no-did-update-set-state */
|
|
5
|
+
/* eslint-disable react/sort-comp */
|
|
2
6
|
/*
|
|
3
7
|
NOTE(Pereus stabilize project): This widget is no-longer-used as of January
|
|
4
8
|
2022. It's not present in US content but is still present in some
|
|
@@ -10,16 +14,16 @@ ref: https://khanacademy.slack.com/archives/CJDRXTGQ7/p1641857400011600
|
|
|
10
14
|
ref: https://khanacademy.slack.com/archives/C2RFQGYKU/p1596160975061500?thread_ts=1596129758.040000&cid=C2RFQGYKU
|
|
11
15
|
*/
|
|
12
16
|
// @flow
|
|
13
|
-
import * as i18n from "@khanacademy/wonder-blocks-i18n";
|
|
14
|
-
import createReactClass from "create-react-class";
|
|
15
|
-
import $ from "jquery";
|
|
16
17
|
import {
|
|
17
18
|
number as knumber,
|
|
18
19
|
vector as kvector,
|
|
19
20
|
point as kpoint,
|
|
20
21
|
ray as kray,
|
|
21
22
|
line as kline,
|
|
22
|
-
} from "kmath";
|
|
23
|
+
} from "@khanacademy/kmath";
|
|
24
|
+
import * as i18n from "@khanacademy/wonder-blocks-i18n";
|
|
25
|
+
import createReactClass from "create-react-class";
|
|
26
|
+
import $ from "jquery";
|
|
23
27
|
import * as React from "react";
|
|
24
28
|
import ReactDOM from "react-dom";
|
|
25
29
|
import _ from "underscore";
|
|
@@ -823,6 +827,7 @@ const Transformations = {
|
|
|
823
827
|
transform1: ReflectionTransformation,
|
|
824
828
|
transform2: ReflectionTransformation,
|
|
825
829
|
) {
|
|
830
|
+
// $FlowFixMe[incompatible-call]
|
|
826
831
|
if (!kline.equal(transform1.line, transform2.line)) {
|
|
827
832
|
return false;
|
|
828
833
|
}
|
|
@@ -2151,15 +2156,16 @@ class Transformer extends React.Component<Props> {
|
|
|
2151
2156
|
normalizeReflectionCoords: ([Coord, Coord]) => [Coord, Coord] = (
|
|
2152
2157
|
messyCoords,
|
|
2153
2158
|
) => {
|
|
2159
|
+
// $FlowFixMe[incompatible-call]
|
|
2154
2160
|
const midpoint = this.snapCoord(kline.midpoint(messyCoords));
|
|
2155
2161
|
const origDirectionPolar = kvector.polarDegFromCart(
|
|
2156
2162
|
kvector.subtract(messyCoords[0], messyCoords[1]),
|
|
2157
2163
|
);
|
|
2158
|
-
|
|
2164
|
+
|
|
2165
|
+
const direction = kvector.cartFromPolarDeg(
|
|
2159
2166
|
1,
|
|
2160
2167
|
KhanMath.roundToNearest(45, origDirectionPolar[1]),
|
|
2161
|
-
|
|
2162
|
-
const direction = kvector.cartFromPolarDeg(directionPolar);
|
|
2168
|
+
);
|
|
2163
2169
|
const coords = _.map(
|
|
2164
2170
|
[-1, 1],
|
|
2165
2171
|
function (directionCoefficient) {
|
package/src/widgets/unit.jsx
CHANGED
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
// terms of a certain type.
|
|
5
5
|
// TODO(joel): Allow sigfigs within a range rather than an exact expected
|
|
6
6
|
// value?
|
|
7
|
+
import * as KAS from "@khanacademy/kas";
|
|
7
8
|
import * as i18n from "@khanacademy/wonder-blocks-i18n";
|
|
9
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
8
10
|
import lens from "hubble";
|
|
9
11
|
import $ from "jquery";
|
|
10
|
-
import KAS from "kas";
|
|
11
12
|
import * as React from "react";
|
|
12
13
|
import ReactDOM from "react-dom";
|
|
13
14
|
import _ from "underscore";
|
|
@@ -81,7 +82,7 @@ type DefaultProps = {|
|
|
|
81
82
|
* shows and hides an error buddy. The error message is only shown after a
|
|
82
83
|
* rolling two second delay, but hidden immediately on further typing.
|
|
83
84
|
*/
|
|
84
|
-
class OldUnitInput extends React.Component<Props> {
|
|
85
|
+
export class OldUnitInput extends React.Component<Props> {
|
|
85
86
|
_errorTimeout: ?TimeoutID;
|
|
86
87
|
|
|
87
88
|
static defaultProps: DefaultProps = {
|
package/src/widgets/video.jsx
CHANGED
|
@@ -16,11 +16,7 @@ import a11y from "../util/a11y.js";
|
|
|
16
16
|
import VideoTranscriptLink from "./video-transcript-link.jsx";
|
|
17
17
|
|
|
18
18
|
import type {PerseusVideoWidgetOptions} from "../perseus-types.js";
|
|
19
|
-
import type {
|
|
20
|
-
PerseusScore,
|
|
21
|
-
WidgetExports,
|
|
22
|
-
WidgetProps,
|
|
23
|
-
} from "../types.js";
|
|
19
|
+
import type {PerseusScore, WidgetExports, WidgetProps} from "../types.js";
|
|
24
20
|
|
|
25
21
|
// Current default is 720p, based on the typical videos we upload currently
|
|
26
22
|
const DEFAULT_WIDTH = 1280;
|
|
@@ -83,7 +79,6 @@ class Video extends React.Component<Props> {
|
|
|
83
79
|
url = location;
|
|
84
80
|
} else {
|
|
85
81
|
url = KA_EMBED.replace("{slug}", location);
|
|
86
|
-
// eslint-disable-next-line static-service/require-safe-link-to
|
|
87
82
|
let embedHostname = "https://www.khanacademy.org";
|
|
88
83
|
if (IS_KA_SITE.test(InitialRequestUrl.host)) {
|
|
89
84
|
embedHostname = InitialRequestUrl.origin;
|
package/README.md
DELETED