@khanacademy/math-input 4.2.0 → 4.3.1

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 (71) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/components/input/mathquill-types.d.ts +2 -0
  3. package/dist/components/input/mathquill-types.js.flow +2 -0
  4. package/dist/components/keypad/index.d.ts +8 -16
  5. package/dist/components/keypad/index.js.flow +10 -22
  6. package/dist/components/keypad/keypad-button.d.ts +12 -0
  7. package/dist/components/keypad/keypad-button.js.flow +18 -0
  8. package/dist/components/keypad/keypad-pages/extras-page.d.ts +9 -0
  9. package/dist/components/keypad/{operators-page/basic-relations-buttons.js.flow → keypad-pages/extras-page.js.flow} +3 -3
  10. package/dist/components/keypad/keypad-pages/geometry-page.d.ts +7 -0
  11. package/dist/components/keypad/{operators-page/logarithms-buttons.js.flow → keypad-pages/geometry-page.js.flow} +1 -3
  12. package/dist/components/keypad/keypad-pages/numbers-page.d.ts +7 -0
  13. package/dist/components/keypad/{operators-page/pre-algebra-buttons.js.flow → keypad-pages/numbers-page.js.flow} +1 -3
  14. package/dist/components/keypad/keypad-pages/operators-page.d.ts +11 -0
  15. package/dist/components/keypad/{operators-page/advanced-relations-buttons.js.flow → keypad-pages/operators-page.js.flow} +5 -3
  16. package/dist/components/keypad/shared-keys.d.ts +9 -0
  17. package/dist/components/keypad/{numbers-page/types.js.flow → shared-keys.js.flow} +4 -1
  18. package/dist/es/index.js +771 -842
  19. package/dist/es/index.js.map +1 -1
  20. package/dist/index.js +834 -930
  21. package/dist/index.js.map +1 -1
  22. package/package.json +2 -3
  23. package/src/components/input/__tests__/test-math-wrapper.ts +2 -5
  24. package/src/components/input/mathquill-types.ts +6 -0
  25. package/src/components/keypad/__tests__/keypad-button.test.tsx +4 -2
  26. package/src/components/keypad/button-assets.tsx +506 -310
  27. package/src/components/keypad/index.tsx +73 -49
  28. package/src/components/keypad/{button.stories.tsx → keypad-button.stories.tsx} +2 -1
  29. package/src/components/keypad/keypad-button.tsx +128 -0
  30. package/src/components/keypad/keypad-mathquill.stories.tsx +10 -4
  31. package/src/components/keypad/keypad-pages/extras-page.tsx +34 -0
  32. package/src/components/keypad/keypad-pages/geometry-page.tsx +33 -0
  33. package/src/components/keypad/keypad-pages/numbers-page.tsx +84 -0
  34. package/src/components/keypad/keypad-pages/operators-page.tsx +116 -0
  35. package/src/components/keypad/keypad.stories.tsx +11 -0
  36. package/src/components/keypad/shared-keys.tsx +78 -0
  37. package/src/components/tabbar/icons.tsx +26 -8
  38. package/tsconfig-build.tsbuildinfo +1 -1
  39. package/dist/components/keypad/button.d.ts +0 -12
  40. package/dist/components/keypad/button.js.flow +0 -18
  41. package/dist/components/keypad/extras-page/index.d.ts +0 -10
  42. package/dist/components/keypad/extras-page/index.js.flow +0 -15
  43. package/dist/components/keypad/geometry-page/index.d.ts +0 -9
  44. package/dist/components/keypad/geometry-page/index.js.flow +0 -14
  45. package/dist/components/keypad/keypad-page-items.d.ts +0 -26
  46. package/dist/components/keypad/keypad-page-items.js.flow +0 -40
  47. package/dist/components/keypad/numbers-page/index.d.ts +0 -10
  48. package/dist/components/keypad/numbers-page/index.js.flow +0 -18
  49. package/dist/components/keypad/numbers-page/types.d.ts +0 -4
  50. package/dist/components/keypad/operators-page/advanced-relations-buttons.d.ts +0 -8
  51. package/dist/components/keypad/operators-page/basic-relations-buttons.d.ts +0 -8
  52. package/dist/components/keypad/operators-page/index.d.ts +0 -10
  53. package/dist/components/keypad/operators-page/index.js.flow +0 -18
  54. package/dist/components/keypad/operators-page/logarithms-buttons.d.ts +0 -8
  55. package/dist/components/keypad/operators-page/pre-algebra-buttons.d.ts +0 -8
  56. package/dist/components/keypad/operators-page/types.d.ts +0 -6
  57. package/dist/components/keypad/operators-page/types.js.flow +0 -12
  58. package/src/components/keypad/__tests__/Button.test.tsx +0 -51
  59. package/src/components/keypad/button.tsx +0 -108
  60. package/src/components/keypad/extras-page/index.tsx +0 -27
  61. package/src/components/keypad/geometry-page/index.tsx +0 -89
  62. package/src/components/keypad/keypad-page-items.tsx +0 -118
  63. package/src/components/keypad/numbers-page/index.tsx +0 -136
  64. package/src/components/keypad/numbers-page/types.ts +0 -4
  65. package/src/components/keypad/operators-page/advanced-relations-buttons.tsx +0 -33
  66. package/src/components/keypad/operators-page/basic-relations-buttons.tsx +0 -33
  67. package/src/components/keypad/operators-page/index.tsx +0 -94
  68. package/src/components/keypad/operators-page/logarithms-buttons.tsx +0 -33
  69. package/src/components/keypad/operators-page/pre-algebra-buttons.tsx +0 -37
  70. package/src/components/keypad/operators-page/types.ts +0 -6
  71. /package/src/components/keypad/{keypad-pages.stories.tsx → keypad-pages/keypad-pages.stories.tsx} +0 -0
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Khan Academy's new expression editor for the mobile web.",
4
4
  "author": "Khan Academy",
5
5
  "license": "MIT",
6
- "version": "4.2.0",
6
+ "version": "4.3.1",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -19,6 +19,7 @@
19
19
  "source": "src/index.ts",
20
20
  "scripts": {},
21
21
  "dependencies": {
22
+ "mathquill": "git+https://git@github.com/Khan/mathquill.git#a9ae54e057c5c1acc8244a5627acbff29901d992",
22
23
  "performance-now": "^0.2.0"
23
24
  },
24
25
  "devDependencies": {
@@ -31,7 +32,6 @@
31
32
  "aphrodite": "^1.1.0",
32
33
  "jquery": "^2.1.1",
33
34
  "katex": "^0.11.1",
34
- "mathquill": "git+https://git@github.com/Khan/mathquill.git#a9ae54e057c5c1acc8244a5627acbff29901d992",
35
35
  "perseus-build-settings": "^0.1.0",
36
36
  "prop-types": "15.6.1",
37
37
  "react": "^16.8.0",
@@ -51,7 +51,6 @@
51
51
  "aphrodite": "^1.1.0",
52
52
  "jquery": "^2.1.1",
53
53
  "katex": "^0.11.1",
54
- "mathquill": "git+https://git@github.com/Khan/mathquill.git#a9ae54e057c5c1acc8244a5627acbff29901d992",
55
54
  "prop-types": "15.6.1",
56
55
  "react": "^16.8.0",
57
56
  "react-dom": "^16.8.0",
@@ -1,8 +1,5 @@
1
- import MathQuill from "mathquill";
2
-
3
1
  import MathWrapper from "../math-wrapper";
4
-
5
- const MQ = MathQuill.getInterface(2);
2
+ import {mathQuillInstance} from "../mathquill-instance";
6
3
 
7
4
  export default class TestMathWrapper extends MathWrapper {
8
5
  getContent() {
@@ -18,7 +15,7 @@ export default class TestMathWrapper extends MathWrapper {
18
15
  }
19
16
 
20
17
  moveToStart() {
21
- this.mathField.moveToDirEnd(MQ.L);
18
+ this.mathField.moveToDirEnd(mathQuillInstance.L);
22
19
  }
23
20
 
24
21
  isSelected() {
@@ -62,6 +62,12 @@ export interface MathFieldInterface {
62
62
  // Clears the selection
63
63
  // https://docs.mathquill.com/en/latest/Api_Methods/#clearselection
64
64
  clearSelection: () => void;
65
+ // Custom helper in our MathQuill fork
66
+ // check to see if cursor is on right end
67
+ cursorAtRightEnd: () => boolean;
68
+ // Custom helper in our MathQuill fork
69
+ // check to see if cursor is on left end
70
+ cursorAtLeftEnd: () => boolean;
65
71
  // This isn't part of the MathQuill public API
66
72
  // I don't know what it is and it feels wrong using it
67
73
  __controller: any;
@@ -4,15 +4,16 @@ import * as React from "react";
4
4
  import "@testing-library/jest-dom";
5
5
 
6
6
  import Keys from "../../../data/key-configs";
7
- import {KeypadButton} from "../keypad-page-items";
7
+ import {KeypadButton} from "../keypad-button";
8
8
 
9
9
  describe("<KeypadButton />", () => {
10
10
  it("uses the aria label from the key config", () => {
11
11
  // Arrange
12
12
  render(
13
13
  <KeypadButton
14
- onClickKey={(config) => {}}
14
+ onClickKey={() => {}}
15
15
  keyConfig={Keys.LEFT_PAREN}
16
+ coord={[0, 0]}
16
17
  />,
17
18
  );
18
19
 
@@ -29,6 +30,7 @@ describe("<KeypadButton />", () => {
29
30
  <KeypadButton
30
31
  onClickKey={mockClickKeyCallback}
31
32
  keyConfig={Keys.LEFT_PAREN}
33
+ coord={[0, 0]}
32
34
  />,
33
35
  );
34
36