@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.
Files changed (67) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/es/index.css +4361 -0
  3. package/dist/es/index.js +2 -10
  4. package/dist/es/index.js.map +1 -1
  5. package/dist/index.css +0 -7573
  6. package/dist/index.js +2 -10
  7. package/dist/index.js.map +1 -1
  8. package/dist/strings.js +0 -45
  9. package/package.json +16 -6
  10. package/src/README.md +33 -5
  11. package/src/components/fixed-to-responsive.jsx +1 -0
  12. package/src/components/graph.jsx +2 -1
  13. package/src/components/info-tip/info-tip.jsx +0 -3
  14. package/src/components/input-with-examples.jsx +1 -1
  15. package/src/components/lint.jsx +0 -2
  16. package/src/components/number-input.jsx +1 -1
  17. package/src/components/prop-check-box.jsx +3 -1
  18. package/src/components/range-input.jsx +1 -1
  19. package/src/components/simple-keypad-input.jsx +5 -5
  20. package/src/components/sortable.jsx +1 -0
  21. package/src/components/stub-tag-editor.jsx +1 -0
  22. package/src/interactive2/movable-helper-methods.js +1 -1
  23. package/src/interactive2/movable-line-options.js +2 -2
  24. package/src/interactive2/movable-line.js +1 -1
  25. package/src/interactive2/movable-point-options.js +1 -1
  26. package/src/interactive2/movable-point.jsx +1 -2
  27. package/src/interactive2/movable-polygon-options.js +1 -1
  28. package/src/interactive2/movable-polygon.js +2 -1
  29. package/src/interactive2/movable.js +1 -1
  30. package/src/interactive2/wrapped-defaults.js +1 -1
  31. package/src/interactive2/wrapped-ellipse.js +1 -1
  32. package/src/interactive2/wrapped-line.js +1 -1
  33. package/src/jipt-paragraphs.js +6 -6
  34. package/src/mixins/provide-keypad.jsx +3 -3
  35. package/src/multi-items/multi-renderer.jsx +1 -0
  36. package/src/perseus-markdown.jsx +6 -7
  37. package/src/pure-markdown.js +2 -1
  38. package/src/renderer.jsx +1 -0
  39. package/src/styles/perseus-renderer.less +1 -2
  40. package/src/util/answer-types.js +1 -1
  41. package/src/util/graphie.js +2 -1
  42. package/src/util/interactive.js +12 -5
  43. package/src/util/math.js +1 -1
  44. package/src/widgets/__stories__/unit.stories.jsx +45 -0
  45. package/src/widgets/__stories__/video-transcript-link.stories.jsx +24 -0
  46. package/src/widgets/__tests__/renderQuestion.jsx +1 -0
  47. package/src/widgets/cs-program.jsx +0 -1
  48. package/src/widgets/expression.jsx +3 -5
  49. package/src/widgets/grapher/util.jsx +9 -22
  50. package/src/widgets/grapher.jsx +6 -1
  51. package/src/widgets/iframe.jsx +0 -1
  52. package/src/widgets/image.jsx +1 -0
  53. package/src/widgets/input-number.jsx +1 -0
  54. package/src/widgets/interaction.jsx +2 -2
  55. package/src/widgets/interactive-graph.jsx +1 -2
  56. package/src/widgets/matrix.jsx +1 -0
  57. package/src/widgets/number-line.jsx +1 -1
  58. package/src/widgets/numeric-input.jsx +2 -2
  59. package/src/widgets/passage/passage-markdown.jsx +1 -1
  60. package/src/widgets/radio/cross-out-menu-wrapper.jsx +5 -5
  61. package/src/widgets/reaction-diagram.jsx +1 -0
  62. package/src/widgets/simulator.jsx +1 -1
  63. package/src/widgets/table.jsx +1 -2
  64. package/src/widgets/transformer.jsx +14 -8
  65. package/src/widgets/unit.jsx +3 -2
  66. package/src/widgets/video.jsx +1 -6
  67. package/README.md +0 -3
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.2",
7
7
  "description": "Core Perseus API (includes renderers and widgets)",
8
8
  "module": "dist/es/index.js",
9
9
  "main": "dist/index.js",
@@ -12,22 +12,26 @@
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",
18
- "mathquill": "git+https://git@github.com/Khan/mathquill.git#a9ae54e057c5c1acc8244a5627acbff29901d992",
19
- "simple-markdown": "^0.3.1"
15
+ "@khanacademy/kmath": "0.0.5",
16
+ "@khanacademy/math-input": "^0.5.1",
17
+ "@khanacademy/kas": "^0.2.3",
18
+ "@khanacademy/simple-markdown": "^0.8.1",
19
+ "mathquill": "git+https://git@github.com/Khan/mathquill.git#a9ae54e057c5c1acc8244a5627acbff29901d992"
20
20
  },
21
21
  "devDependencies": {
22
+ "@khanacademy/wonder-blocks-button": "2.11.5",
22
23
  "@khanacademy/wonder-blocks-color": "^1.1.20",
23
24
  "@khanacademy/wonder-blocks-core": "^4.3.0",
24
25
  "@khanacademy/wonder-blocks-data": "^7.0.0",
25
26
  "@khanacademy/wonder-blocks-dropdown": "^2.6.7",
26
27
  "@khanacademy/wonder-blocks-i18n": "^1.2.3",
28
+ "@khanacademy/wonder-blocks-layout": "1.4.9",
27
29
  "@khanacademy/wonder-blocks-link": "^3.8.5",
28
30
  "@khanacademy/wonder-blocks-popover": "^1.1.10",
31
+ "@khanacademy/wonder-blocks-progress-spinner": "1.1.31",
29
32
  "@khanacademy/wonder-blocks-spacing": "^3.0.5",
30
33
  "@khanacademy/wonder-blocks-tooltip": "^1.3.10",
34
+ "@khanacademy/wonder-blocks-typography": "1.1.31",
31
35
  "@khanacademy/wonder-stuff-core": "^0.1.2",
32
36
  "aphrodite": "^1.2.5",
33
37
  "classnames": "^1.1.4",
@@ -36,6 +40,7 @@
36
40
  "eslint-plugin-import": "^2.26.0",
37
41
  "intersection-observer": "^0.12.0",
38
42
  "jquery": "^2.1.1",
43
+ "lodash.debounce": "^4.0.8",
39
44
  "perseus-build-settings": "^0.0.1",
40
45
  "prop-types": "^15.6.1",
41
46
  "react": "16.14.0",
@@ -43,21 +48,26 @@
43
48
  "underscore": "^1.4.4"
44
49
  },
45
50
  "peerDependencies": {
51
+ "@khanacademy/wonder-blocks-button": "2.11.5",
46
52
  "@khanacademy/wonder-blocks-color": "^1.1.20",
47
53
  "@khanacademy/wonder-blocks-core": "^4.3.0",
48
54
  "@khanacademy/wonder-blocks-data": "^7.0.0",
49
55
  "@khanacademy/wonder-blocks-dropdown": "^2.6.7",
50
56
  "@khanacademy/wonder-blocks-i18n": "^1.2.3",
57
+ "@khanacademy/wonder-blocks-layout": "1.4.9",
51
58
  "@khanacademy/wonder-blocks-link": "^3.8.5",
52
59
  "@khanacademy/wonder-blocks-popover": "^1.1.10",
60
+ "@khanacademy/wonder-blocks-progress-spinner": "1.1.31",
53
61
  "@khanacademy/wonder-blocks-spacing": "^3.0.5",
54
62
  "@khanacademy/wonder-blocks-tooltip": "^1.3.10",
63
+ "@khanacademy/wonder-blocks-typography": "1.1.31",
55
64
  "@khanacademy/wonder-stuff-core": "^0.1.2",
56
65
  "aphrodite": "^1.2.5",
57
66
  "classnames": "^1.1.4",
58
67
  "create-react-class": "^15.6.3",
59
68
  "intersection-observer": "^0.12.0",
60
69
  "jquery": "^2.1.1",
70
+ "lodash.debounce": "^4.0.8",
61
71
  "prop-types": "^15.6.1",
62
72
  "react": "16.14.0",
63
73
  "react-dom": "16.14.0",
package/src/README.md CHANGED
@@ -1,7 +1,35 @@
1
- Widgets from the Perseus (exercise) editor.
1
+ # Perseus
2
2
 
3
- TODO(benkraft): Figure out the distinction between this and the various other
4
- Perseus packages.
3
+ <p align="center"><img src="logo.png" alt="perseus logo" width="150px"/></p>
5
4
 
6
- Code-Owner: Learning Platform
7
- Crowdin-Category: content.chrome
5
+ <p align="center">Perseus Exercise Renderer</p>
6
+
7
+ Perseus is Khan Academy's exercise system. This repo contains the code needed to take a problem in the perseus format and present it, allow interaction, and grade the result of a learner's work.
8
+
9
+ <p align="center"><img src="sample.png" alt="sample of perseus in use" height="150px"/></p>
10
+
11
+ This repo is a constellation of sub-repos for showing exercise content. Please see individual projects in in the `packages/` folder for more information about each sub-project.
12
+
13
+ ## Getting started
14
+
15
+ ### Prerequisites
16
+
17
+ - [Node.JS v12](https://nodejs.org/download/release/v10.18.1/)
18
+ - [Yarn](https://yarnpkg.com/lang/en/docs/install/)
19
+
20
+ ### Installation
21
+
22
+ To install perseus, you need to run the following commands:
23
+
24
+ #### `yarn install`
25
+
26
+ Installs project dependencies
27
+
28
+ ## Contributing
29
+
30
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for a walkthrough of how some
31
+ of the Perseus code works and how to extend it.
32
+
33
+ ## License
34
+
35
+ [MIT License](http://opensource.org/licenses/MIT)
@@ -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";
@@ -3,21 +3,21 @@
3
3
  * Paragraph parsing/splitting for article jipt i18n
4
4
  */
5
5
 
6
- import SimpleMarkdown from "simple-markdown";
6
+ import SimpleMarkdown from "@khanacademy/simple-markdown";
7
7
 
8
- const arrayRules = {
8
+ import type {ParserRules} from "@khanacademy/simple-markdown";
9
+
10
+ const arrayRules: ParserRules = {
9
11
  fence: {
10
- // $FlowFixMe[prop-missing]
11
- // $FlowFixMe[incompatible-use]
12
12
  match: SimpleMarkdown.defaultRules.fence.match,
13
13
  order: 1,
14
+ // $FlowFixMe[incompatible-type]
14
15
  parse: (capture, state, parse) => capture[3],
15
16
  },
16
17
  paragraph: {
17
- // $FlowFixMe[prop-missing]
18
- // $FlowFixMe[incompatible-use]
19
18
  match: SimpleMarkdown.defaultRules.paragraph.match,
20
19
  order: 2,
20
+ // $FlowFixMe[incompatible-type]
21
21
  parse: (capture, state, parse) => capture[1],
22
22
  },
23
23
  };
@@ -11,19 +11,19 @@
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;
19
+ import type {CSSProperties} from "aphrodite";
20
20
 
21
21
  export type KeypadProps = {|
22
22
  // An Aphrodite style object, to be applied to the keypad container.
23
23
  // Note that, given our awkward structure of injecting the keypad, this
24
24
  // style won't be applied or updated dynamically. Rather, it will only
25
25
  // be applied in `componentDidMount`.
26
- keypadStyle?: any,
26
+ keypadStyle?: CSSProperties,
27
27
  |};
28
28
 
29
29
  export type KeypadApiOptions = {|
@@ -38,6 +38,7 @@
38
38
  */
39
39
  import * as i18n from "@khanacademy/wonder-blocks-i18n";
40
40
  import {StyleSheet, css} from "aphrodite";
41
+ // eslint-disable-next-line import/no-extraneous-dependencies
41
42
  import lens from "hubble";
42
43
  import * as React from "react";
43
44
 
@@ -1,9 +1,9 @@
1
- /* eslint-disable no-useless-escape */
1
+ /* eslint-disable no-useless-escape, no-prototype-builtins */
2
2
  // @flow
3
3
  // TODO(FEI-4465): move this into it's own package called perseus-markdown
4
+ import SimpleMarkdown from "@khanacademy/simple-markdown";
4
5
  import * as i18n from "@khanacademy/wonder-blocks-i18n";
5
6
  import * as React from "react";
6
- import SimpleMarkdown from "simple-markdown";
7
7
  import _ from "underscore";
8
8
 
9
9
  import Lint from "./components/lint.jsx";
@@ -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 = {
@@ -319,6 +320,7 @@ const inlineNodeTypes = {
319
320
  };
320
321
 
321
322
  // $FlowFixMe[prop-missing]
323
+ // $FlowFixMe[incompatible-call]
322
324
  const builtParser = SimpleMarkdown.parserFor(rules);
323
325
  const parse = (source: string, state: $FlowFixMe): $FlowFixMe => {
324
326
  const paragraphedSource = source + "\n\n";
@@ -420,15 +422,12 @@ export default {
420
422
  traverseContent: traverseContent,
421
423
  parse: parse,
422
424
  parseInline: inlineParser,
423
- // $FlowFixMe[prop-missing]
424
425
  reactFor: SimpleMarkdown.reactFor,
425
- // $FlowFixMe[prop-missing]
426
+ // $FlowFixMe[incompatible-use]
426
427
  ruleOutput: (SimpleMarkdown.ruleOutput(rules, "react"): $FlowFixMe),
427
- // $FlowFixMe[prop-missing]
428
428
  basicOutput: (SimpleMarkdown.reactFor(
429
- // $FlowFixMe[prop-missing]
429
+ // $FlowFixMe[incompatible-use]
430
430
  SimpleMarkdown.ruleOutput(rules, "react"),
431
431
  ): $FlowFixMe),
432
- // $FlowFixMe[prop-missing]
433
432
  sanitizeUrl: SimpleMarkdown.sanitizeUrl,
434
433
  };
@@ -3,7 +3,7 @@
3
3
  * Contains markdown related functions in pure javascript,
4
4
  * extracted from perseus-markdown.jsx
5
5
  */
6
- import SimpleMarkdown from "simple-markdown";
6
+ import SimpleMarkdown from "@khanacademy/simple-markdown";
7
7
 
8
8
  import Util from "./util.js";
9
9
 
@@ -334,6 +334,7 @@ export const pureMarkdownRules = {
334
334
  };
335
335
 
336
336
  // $FlowFixMe[prop-missing]
337
+ // $FlowFixMe[incompatible-call]
337
338
  const builtParser = SimpleMarkdown.parserFor(pureMarkdownRules);
338
339
 
339
340
  export const parse = (source: string, state: $FlowFixMe): $FlowFixMe => {
package/src/renderer.jsx CHANGED
@@ -1275,6 +1275,7 @@ class Renderer extends React.Component<Props, State> {
1275
1275
  {({setAssetStatus}) => (
1276
1276
  <SvgImage
1277
1277
  setAssetStatus={setAssetStatus}
1278
+ /* $FlowFixMe[incompatible-type]: sanitizeUrl() can return null */
1278
1279
  src={PerseusMarkdown.sanitizeUrl(node.target)}
1279
1280
  alt={node.alt}
1280
1281
  title={node.title}
@@ -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";