@khanacademy/perseus 0.1.0 → 0.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.
Files changed (57) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/es/index.css +4361 -0
  3. package/dist/es/index.js +3 -3
  4. package/dist/es/index.js.map +1 -1
  5. package/dist/index.css +0 -7573
  6. package/dist/index.js +3 -3
  7. package/dist/index.js.map +1 -1
  8. package/dist/strings.js +0 -45
  9. package/package.json +4 -4
  10. package/src/components/fixed-to-responsive.jsx +1 -0
  11. package/src/components/graph.jsx +2 -1
  12. package/src/components/info-tip/info-tip.jsx +0 -3
  13. package/src/components/input-with-examples.jsx +1 -1
  14. package/src/components/lint.jsx +0 -2
  15. package/src/components/number-input.jsx +1 -1
  16. package/src/components/prop-check-box.jsx +3 -1
  17. package/src/components/range-input.jsx +1 -1
  18. package/src/components/simple-keypad-input.jsx +5 -5
  19. package/src/components/sortable.jsx +1 -0
  20. package/src/components/stub-tag-editor.jsx +1 -0
  21. package/src/interactive2/movable-helper-methods.js +1 -1
  22. package/src/interactive2/movable-line-options.js +2 -2
  23. package/src/interactive2/movable-line.js +1 -1
  24. package/src/interactive2/movable-point-options.js +1 -1
  25. package/src/interactive2/movable-point.jsx +1 -2
  26. package/src/interactive2/movable-polygon-options.js +1 -1
  27. package/src/interactive2/movable-polygon.js +2 -1
  28. package/src/interactive2/movable.js +1 -1
  29. package/src/interactive2/wrapped-defaults.js +1 -1
  30. package/src/interactive2/wrapped-ellipse.js +1 -1
  31. package/src/interactive2/wrapped-line.js +1 -1
  32. package/src/mixins/provide-keypad.jsx +1 -3
  33. package/src/perseus-markdown.jsx +1 -0
  34. package/src/styles/perseus-renderer.less +1 -2
  35. package/src/util/answer-types.js +1 -1
  36. package/src/util/graphie.js +1 -1
  37. package/src/util/interactive.js +11 -5
  38. package/src/util/math.js +1 -1
  39. package/src/widgets/cs-program.jsx +0 -1
  40. package/src/widgets/expression.jsx +3 -5
  41. package/src/widgets/grapher/util.jsx +9 -22
  42. package/src/widgets/grapher.jsx +6 -1
  43. package/src/widgets/iframe.jsx +0 -1
  44. package/src/widgets/image.jsx +1 -0
  45. package/src/widgets/input-number.jsx +1 -0
  46. package/src/widgets/interaction.jsx +2 -2
  47. package/src/widgets/interactive-graph.jsx +1 -2
  48. package/src/widgets/matrix.jsx +1 -0
  49. package/src/widgets/number-line.jsx +1 -1
  50. package/src/widgets/numeric-input.jsx +2 -2
  51. package/src/widgets/radio/cross-out-menu-wrapper.jsx +5 -5
  52. package/src/widgets/reaction-diagram.jsx +1 -0
  53. package/src/widgets/simulator.jsx +1 -1
  54. package/src/widgets/table.jsx +1 -2
  55. package/src/widgets/transformer.jsx +14 -8
  56. package/src/widgets/unit.jsx +1 -1
  57. package/src/widgets/video.jsx +1 -6
package/dist/strings.js CHANGED
@@ -56,35 +56,21 @@ module.exports = [
56
56
  i18n._("Correct (but you crossed it out)", {}),
57
57
  i18n._("Correct (selected)", {}),
58
58
  i18n._("Correct!", {}),
59
- i18n._("Cosine", {}),
60
59
  i18n._("Cross out", {}),
61
60
  i18n._("Cross out Choice %(letter)s", {}),
62
- i18n._("Cube", {}),
63
- i18n._("Cube root", {}),
64
- i18n._("Custom exponent", {}),
65
- i18n._("Decimal", {}),
66
- i18n._("Delete", {}),
67
61
  // I18N: As in the command, "Dilate the polygon"
68
62
  i18n._("Dilate", {}),
69
63
  i18n._("dilation", {}),
70
64
  i18n._("Dilation", {}),
71
65
  i18n.$_("Dilation about %(point)s by %(scale)s", {}),
72
66
  i18n.$_("Dilation of scale %(scale)s about %(point)s", {}),
73
- i18n._("Dismiss", {}),
74
- i18n._("Divide", {}),
75
- i18n._("Down arrow", {}),
76
67
  i18n._("Drag handles to make graph", {}),
77
68
  i18n._("End of reading passage.", {}),
78
69
  i18n._("entered in an invalid answer.", {}),
79
- i18n._("Equals sign", {}),
80
70
  i18n.$_("Error rendering: %(error)s", {}),
81
71
  i18n._("Explain", {}),
82
72
  i18n._("False", {}),
83
- i18n._("Fraction, excluding the current expression", {}),
84
- i18n._("Fraction, with current expression in numerator", {}),
85
73
  i18n._("Get another hint", {}),
86
- i18n._("Greater than or equal to sign", {}),
87
- i18n._("Greater than sign", {}),
88
74
  i18n._("Hide explanation", {}),
89
75
  i18n._("Hint #%(pos)s", {}),
90
76
  i18n._("Hints", {}),
@@ -96,48 +82,26 @@ module.exports = [
96
82
  i18n._("It looks like you left something blank or ", {}),
97
83
  i18n._("Keep trying", {}),
98
84
  i18n._("Khan Academy video wrapper", {}),
99
- i18n._("Left arrow", {}),
100
- i18n._("Left parenthesis", {}),
101
- i18n._("Less than or equal to sign", {}),
102
- i18n._("Less than sign", {}),
103
85
  // I18N: a label next to a reading passage to denote the line number
104
86
  i18n._("Line ", {}),
105
87
  i18n.$_("line %(lineNumber)s", {}),
106
88
  i18n.$_("lines %(lineRange)s", {}),
107
89
  i18n._("Loading...", {}),
108
- i18n._("Logarithm with base 10", {}),
109
- i18n._("Logarithm with custom base", {}),
110
90
  i18n._("Make circle filled", {}),
111
91
  i18n._("Make circle open", {}),
112
92
  i18n._("Make sure you fill in all cells in the matrix.", {}),
113
93
  i18n._("Make sure you select something for every row.", {}),
114
- i18n._("Math input box", {}),
115
- i18n._("Minus", {}),
116
94
  i18n.ngettext("Moves: %(num)s","Moves: %(num)s", {}),
117
- i18n._("Multiply", {}),
118
- i18n._("Natural logarithm", {}),
119
- i18n._("Navigate right into the numerator of a fraction", {}),
120
- i18n._("Navigate right out of a base", {}),
121
- i18n._("Navigate right out of a set of parentheses", {}),
122
- i18n._("Navigate right out of an exponent", {}),
123
- i18n._("Navigate right out of the denominator of a fraction", {}),
124
- i18n._("Navigate right out of the numerator and into the denominator", {}),
125
- i18n._("Negative", {}),
126
95
  i18n._("Next question", {}),
127
96
  i18n._("No", {}),
128
97
  i18n._("None of the above", {}),
129
- i18n._("Not-equals sign", {}),
130
98
  i18n._("Note: For this question, the shape will not move.", {}),
131
99
  i18n._("Number of divisions:", {}),
132
100
  i18n._("Number of trials:", {}),
133
101
  i18n._("Open menu for Choice %(letter)s", {}),
134
102
  i18n._("Parameter", {}),
135
- i18n._("Percent", {}),
136
- i18n._("Pi", {}),
137
103
  i18n._("Please choose the correct number of answers.", {}),
138
104
  i18n.$_("Please make sure the number of divisions is in the range %(divRangeString)s.", {}),
139
- i18n._("Plus", {}),
140
- i18n._("Radical with custom root", {}),
141
105
  i18n._("Reaction arrow pointing to the right.", {}),
142
106
  // I18N: As in the command, "Reflect the polygon"
143
107
  i18n._("Reflect", {}),
@@ -145,8 +109,6 @@ module.exports = [
145
109
  i18n._("Reflection", {}),
146
110
  i18n.$_("Reflection over the line from %(point1)s to %(point2)s", {}),
147
111
  i18n._("Remove highlight", {}),
148
- i18n._("Right arrow", {}),
149
- i18n._("Right parenthesis", {}),
150
112
  // I18N: As in the command, "Rotate the polygon"
151
113
  i18n._("Rotate", {}),
152
114
  i18n._("rotation", {}),
@@ -157,21 +119,15 @@ module.exports = [
157
119
  i18n._("Run simulation", {}),
158
120
  i18n._("Sample size:", {}),
159
121
  i18n._("See video transcript", {}),
160
- i18n._("Sine", {}),
161
122
  i18n._("Skip to %(title)s", {}),
162
123
  i18n._("Something went wrong.", {}),
163
124
  i18n._("Sorry, I don't understand that!", {}),
164
- i18n._("Square", {}),
165
- i18n._("Square root", {}),
166
125
  i18n._("Switch direction", {}),
167
- i18n._("Tangent", {}),
168
126
  i18n._("Tap each dot on the image to select all answers that apply.", {}),
169
127
  i18n._("Tap each dot on the image to select an answer.", {}),
170
128
  i18n._("Tap to add points", {}),
171
- i18n._("Tap with one or two fingers to open keyboard", {}),
172
129
  i18n._("That answer is numerically incorrect.", {}),
173
130
  i18n._("The symbol %(questionSymbol)s indicates that question %(questionNumber)s references this portion of the passage.", {}),
174
- i18n._("Theta", {}),
175
131
  i18n._("This controls the proportion or percentage that will be used in your simulation.", {}),
176
132
  i18n._("This controls the sample size that will be used in your simulation. For example, if you set this to 100, then for each trial, responses from 100 participants will be simulated.", {}),
177
133
  i18n._("This is the number of trials used in the simulation. For example, if set to 50, then the survey will be conducted 50 times.", {}),
@@ -184,7 +140,6 @@ module.exports = [
184
140
  i18n._("True", {}),
185
141
  i18n._("Try again", {}),
186
142
  i18n._("Undo", {}),
187
- i18n._("Up arrow", {}),
188
143
  i18n._("Use the interactive graph to define a correct transformation.", {}),
189
144
  i18n._("Value", {}),
190
145
  i18n._("We could not understand your answer. Please check your answer for extra text or symbols.", {}),
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "access": "public"
4
4
  },
5
5
  "name": "@khanacademy/perseus",
6
- "version": "0.1.0",
6
+ "version": "0.2.0",
7
7
  "description": "Core Perseus API (includes renderers and widgets)",
8
8
  "module": "dist/es/index.js",
9
9
  "main": "dist/index.js",
@@ -12,9 +12,9 @@
12
12
  "test": "bash -c 'yarn --silent --cwd \"../..\" test ${@:0} $($([[ ${@: -1} = -* ]] || [[ ${@: -1} = bash ]]) && echo $PWD)'"
13
13
  },
14
14
  "dependencies": {
15
- "@khanacademy/math-input": "^0.4.1",
16
- "kas": "git+https://git@github.com/Khan/KAS.git#a5b04e0688ec692da86e2991cd389f1fd3831528",
17
- "kmath": "git+https://git@github.com/Khan/kmath.git#e1191bbc7bac64ccb582de1b3b2d47ba38b510e0",
15
+ "@khanacademy/kmath": "0.0.5",
16
+ "@khanacademy/math-input": "^0.5.0",
17
+ "@khanacademy/kas": "^0.2.3",
18
18
  "mathquill": "git+https://git@github.com/Khan/mathquill.git#a9ae54e057c5c1acc8244a5627acbff29901d992",
19
19
  "simple-markdown": "^0.3.1"
20
20
  },
@@ -1,3 +1,4 @@
1
+ /* eslint-disable react/prop-types */
1
2
  // @flow
2
3
  /**
3
4
  * A wrapper for a component that would otherwise have a fixed width and
@@ -6,11 +6,12 @@ import * as React from "react";
6
6
  import ReactDOM from "react-dom";
7
7
  import _ from "underscore";
8
8
 
9
- import SvgImage from "../components/svg-image.jsx";
10
9
  import {interactiveSizes} from "../styles/constants.js";
11
10
  import Util from "../util.js";
12
11
  import GraphUtils from "../util/graph-utils.js";
13
12
 
13
+ import SvgImage from "./svg-image.jsx";
14
+
14
15
  const defaultBackgroundImage = {
15
16
  url: null,
16
17
  };
@@ -120,9 +120,6 @@ class InfoTip extends React.Component<Props, State> {
120
120
  alt=""
121
121
  width={10}
122
122
  height={10}
123
- // The question mark icon is a data url, so no need to run
124
- // it through staticUrl!
125
- // eslint-disable-next-line static-service/require-static-url
126
123
  src={questionMark}
127
124
  onMouseEnter={this.handleMouseEnter}
128
125
  onMouseLeave={this.handleMouseLeave}
@@ -4,7 +4,6 @@ import PropTypes from "prop-types";
4
4
  import * as React from "react";
5
5
  import _ from "underscore";
6
6
 
7
- import MathOutput from "../components/math-output.jsx";
8
7
  import Gorgon from "../gorgon/gorgon.js";
9
8
  import {linterContextProps, linterContextDefault} from "../gorgon/proptypes.js";
10
9
  import {ClassNames as ApiClassNames} from "../perseus-api.jsx";
@@ -12,6 +11,7 @@ import Renderer from "../renderer.jsx";
12
11
  import Util from "../util.js";
13
12
 
14
13
  import MathInput from "./math-input.jsx";
14
+ import MathOutput from "./math-output.jsx";
15
15
  import TextInput from "./text-input.jsx";
16
16
  import Tooltip from "./tooltip.jsx";
17
17
 
@@ -114,8 +114,6 @@ class Lint extends React.Component<Props, State> {
114
114
 
115
115
  return (
116
116
  <a
117
- // This is not a user-facing component and so
118
- // eslint-disable-next-line static-service/require-safe-link-to
119
117
  href={`https://khanacademy.org/r/linter-rules#${this.props.ruleName}`}
120
118
  target="lint-help-window"
121
119
  className={css(style)}
@@ -1,8 +1,8 @@
1
1
  /* eslint-disable react/sort-comp */
2
2
  // @flow
3
+ import {number as knumber} from "@khanacademy/kmath";
3
4
  import classNames from "classnames";
4
5
  import $ from "jquery";
5
- import {number as knumber} from "kmath";
6
6
  import PropTypes from "prop-types";
7
7
  import * as React from "react";
8
8
  import ReactDOM from "react-dom";
@@ -1,4 +1,6 @@
1
- /* eslint-disable @babel/no-invalid-this, react/sort-comp */
1
+ /* eslint-disable react/prop-types */
2
+ /* eslint-disable @babel/no-invalid-this */
3
+ /* eslint-disable react/sort-comp */
2
4
  // @flow
3
5
  import createReactClass from "create-react-class";
4
6
  import PropTypes from "prop-types";
@@ -3,7 +3,7 @@
3
3
  import PropTypes from "prop-types";
4
4
  import * as React from "react";
5
5
 
6
- import NumberInput from "../components/number-input.jsx";
6
+ import NumberInput from "./number-input.jsx";
7
7
 
8
8
  const truth = () => true;
9
9
 
@@ -9,15 +9,15 @@
9
9
  * interface to `math-input`'s MathInput component.
10
10
  */
11
11
 
12
- import {components, consts, propTypes} from "@khanacademy/math-input";
12
+ import {
13
+ KeypadInput,
14
+ KeypadTypes,
15
+ keypadElementPropType,
16
+ } from "@khanacademy/math-input";
13
17
  import createReactClass from "create-react-class";
14
18
  import PropTypes from "prop-types";
15
19
  import * as React from "react";
16
20
 
17
- const {KeypadInput} = components;
18
- const {KeypadTypes} = consts;
19
- const {keypadElementPropType} = propTypes;
20
-
21
21
  const SimpleKeypadInput: any = createReactClass({
22
22
  displayName: "SimpleKeypadInput",
23
23
 
@@ -16,6 +16,7 @@ import Renderer from "../renderer.jsx";
16
16
  import Util from "../util.js";
17
17
 
18
18
  import type {LinterContextProps} from "../types";
19
+
19
20
  const HORIZONTAL = "horizontal";
20
21
  const VERTICAL = "vertical";
21
22
 
@@ -16,6 +16,7 @@ import PropTypes from "prop-types";
16
16
  import * as React from "react";
17
17
 
18
18
  import TextListEditor from "./text-list-editor.jsx";
19
+
19
20
  const EMPTY_ARRAY = [];
20
21
 
21
22
  class StubTagEditor extends React.Component<$FlowFixMe> {
@@ -8,7 +8,7 @@
8
8
  * are simply for convenience.
9
9
  */
10
10
 
11
- import {point as kpoint} from "kmath";
11
+ import {point as kpoint} from "@khanacademy/kmath";
12
12
  import _ from "underscore";
13
13
 
14
14
  import {Errors} from "../logging/log.js";
@@ -3,7 +3,7 @@
3
3
  /**
4
4
  * A library of options to pass to add/draw/remove/constraints
5
5
  */
6
- import {vector as kvector, point as kpoint} from "kmath";
6
+ import {vector as kvector, point as kpoint} from "@khanacademy/kmath";
7
7
  import _ from "underscore";
8
8
 
9
9
  import KhanMath from "../util/math.js";
@@ -35,7 +35,7 @@ const getClipPoint = function (graph, coord: Coord, angle: number) {
35
35
  // shoot a point off into the distance ...
36
36
  const distance = xExtent + yExtent;
37
37
  // we need to scale the point according to the scale of the axes
38
- const angleVec = graph.unscaleVector(kvector.cartFromPolarDeg([1, angle]));
38
+ const angleVec = graph.unscaleVector(kvector.cartFromPolarDeg(1, angle));
39
39
  const distVec = kvector.scale(kvector.normalize(angleVec), distance);
40
40
  const farCoord = kvector.add(coord, distVec);
41
41
  const scaledAngle = kvector.polarDegFromCart(angleVec)[1];
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * MovableLine
4
4
  */
5
- import {vector as kvector} from "kmath";
5
+ import {vector as kvector} from "@khanacademy/kmath";
6
6
  import _ from "underscore";
7
7
 
8
8
  import KhanColors from "../util/colors.js";
@@ -3,7 +3,7 @@
3
3
  /**
4
4
  * A library of options to pass to add/draw/remove/constraints
5
5
  */
6
- import {point as kpoint} from "kmath";
6
+ import {point as kpoint} from "@khanacademy/kmath";
7
7
  import _ from "underscore";
8
8
 
9
9
  import WrappedEllipse from "./wrapped-ellipse.js";
@@ -50,8 +50,7 @@
50
50
  * remove:
51
51
  * removes the point from graphie
52
52
  */
53
- import {point as kpoint} from "kmath";
54
- import {vector as kvector} from "kmath";
53
+ import {point as kpoint, vector as kvector} from "@khanacademy/kmath";
55
54
  import * as React from "react";
56
55
  import * as ReactDOM from "react-dom";
57
56
  import _ from "underscore";
@@ -4,7 +4,7 @@
4
4
  * A library of options to pass to add/draw/remove/constraints
5
5
  */
6
6
 
7
- import {point as kpoint, vector as kvector} from "kmath";
7
+ import {point as kpoint, vector as kvector} from "@khanacademy/kmath";
8
8
  import _ from "underscore";
9
9
 
10
10
  import type {Coord} from "./types.js";
@@ -3,7 +3,7 @@
3
3
  * Creates and adds a polygon to the graph that can be dragged around.
4
4
  * It allows constraints on its movement and draws when moves happen.
5
5
  */
6
- import {vector as kvector} from "kmath";
6
+ import {vector as kvector} from "@khanacademy/kmath";
7
7
  import _ from "underscore";
8
8
 
9
9
  import KhanColors from "../util/colors.js";
@@ -213,6 +213,7 @@ _.extend(MovablePolygon.prototype, {
213
213
  refCoord,
214
214
  self._prevRefCoord,
215
215
  );
216
+ // $FlowFixMe[incompatible-type] _applyConstraints can return false
216
217
  if (refCoord === false) {
217
218
  return;
218
219
  }
@@ -10,8 +10,8 @@
10
10
  * let this class handle all of the virtual mouse events, and then
11
11
  * take appropriate action in onMoveStart, onMove, onMoveEnd
12
12
  */
13
+ import {point as kpoint} from "@khanacademy/kmath";
13
14
  import $ from "jquery";
14
- import {point as kpoint} from "kmath";
15
15
  import _ from "underscore";
16
16
 
17
17
  import InteractiveUtil from "./interactive-util.js";
@@ -4,8 +4,8 @@
4
4
  * Default methods for a wrapped movable.
5
5
  */
6
6
 
7
+ import {vector as kvector} from "@khanacademy/kmath";
7
8
  import $ from "jquery";
8
- import {vector as kvector} from "kmath";
9
9
  import _ from "underscore";
10
10
 
11
11
  import InteractiveUtil from "./interactive-util.js";
@@ -1,5 +1,5 @@
1
1
  // @flow
2
- import {vector as kvector} from "kmath";
2
+ import {vector as kvector} from "@khanacademy/kmath";
3
3
  import _ from "underscore";
4
4
 
5
5
  import InteractiveUtil from "./interactive-util.js";
@@ -1,5 +1,5 @@
1
1
  // @flow
2
- import {point as kpoint, vector as kvector} from "kmath";
2
+ import {point as kpoint, vector as kvector} from "@khanacademy/kmath";
3
3
  import _ from "underscore";
4
4
 
5
5
  import KhanMath from "../util/math.js";
@@ -11,13 +11,11 @@
11
11
  * extend a `ProvideKeypad` component instead of using this mixin.
12
12
  */
13
13
 
14
- import {components} from "@khanacademy/math-input";
14
+ import {Keypad} from "@khanacademy/math-input";
15
15
  import PropTypes from "prop-types";
16
16
  import * as React from "react";
17
17
  import ReactDOM from "react-dom";
18
18
 
19
- const {Keypad} = components;
20
-
21
19
  export type KeypadProps = {|
22
20
  // An Aphrodite style object, to be applied to the keypad container.
23
21
  // Note that, given our awkward structure of injecting the keypad, this
@@ -303,6 +303,7 @@ const rules = {
303
303
  // and false otherwise. We need this so that lint nodes can figure out whether
304
304
  // they should behave as an inline wrapper or a block wrapper
305
305
  function isInline(node) {
306
+ // eslint-disable-next-line no-prototype-builtins
306
307
  return !!(node && node.type && inlineNodeTypes.hasOwnProperty(node.type));
307
308
  }
308
309
  const inlineNodeTypes = {
@@ -1004,5 +1004,4 @@
1004
1004
  }
1005
1005
  }
1006
1006
 
1007
- @import (inline) "../../../../node_modules/@khanacademy/math-input/build/math-input.css";
1008
- @import (inline) "../../../../node_modules/mathquill/build/mathquill.css";
1007
+ @import (inline) "../../../math-input/dist/index.css";
@@ -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";
@@ -1,7 +1,7 @@
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
- import {point as kpoint, vector as kvector} from "kmath";
5
5
  import Raphael from "raphael";
6
6
  import _ from "underscore";
7
7
 
@@ -9,8 +9,12 @@
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
- import {vector as kvector, point as kpoint, line as kline} from "kmath";
14
18
  import Raphael from "raphael";
15
19
  import _ from "underscore";
16
20
 
@@ -1299,7 +1303,7 @@ _.extend(GraphUtils.Graphie.prototype, {
1299
1303
 
1300
1304
  const distance = xExtent + yExtent;
1301
1305
  const angleVec = graph.unscaleVector(
1302
- kvector.cartFromPolarDeg([1, angle]),
1306
+ kvector.cartFromPolarDeg(1, angle),
1303
1307
  );
1304
1308
  const distVec = kvector.scale(
1305
1309
  kvector.normalize(angleVec),
@@ -2711,10 +2715,10 @@ _.extend(GraphUtils.Graphie.prototype, {
2711
2715
  ) {
2712
2716
  const distFromRotationCenter =
2713
2717
  radius + distanceFromArrowMidline;
2714
- const vec = kvector.cartFromPolarDeg([
2718
+ const vec = kvector.cartFromPolarDeg(
2715
2719
  distFromRotationCenter,
2716
2720
  angle + offset,
2717
- ]);
2721
+ );
2718
2722
  const absolute = kvector.add(center, vec);
2719
2723
  const pixels = graphie.scalePoint(absolute);
2720
2724
  return pixels[0] + "," + pixels[1];
@@ -2886,13 +2890,15 @@ _.extend(GraphUtils.Graphie.prototype, {
2886
2890
  const oldAngle = oldPolar[1];
2887
2891
  const newAngle = newPolar[1];
2888
2892
  let result = options.onMove(newAngle, oldAngle);
2893
+ // $FlowFixMe[incompatible-type] add proper onMove param type
2889
2894
  if (result != null && result !== true) {
2895
+ // $FlowFixMe[incompatible-type] add proper onMove param type
2890
2896
  if (result === false) {
2891
2897
  result = oldAngle;
2892
2898
  }
2893
2899
  coord = kvector.add(
2894
2900
  rotatePoint.coord,
2895
- kvector.cartFromPolarDeg([oldPolar[0], result]),
2901
+ kvector.cartFromPolarDeg(oldPolar[0], result),
2896
2902
  );
2897
2903
  }
2898
2904
  }
package/src/util/math.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // @flow
2
2
 
3
+ import {number as knumber} from "@khanacademy/kmath";
3
4
  import $ from "jquery";
4
- import {number as knumber} from "kmath";
5
5
  import _ from "underscore";
6
6
 
7
7
  export type Format =
@@ -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 {components, consts} from "@khanacademy/math-input";
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
  };