@khanacademy/math-input 16.1.0 → 16.1.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 (70) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +1 -9
  3. package/dist/components/input/cursor-styles.d.ts +5 -0
  4. package/dist/components/input/scroll-into-view.d.ts +1 -0
  5. package/dist/enums.d.ts +0 -29
  6. package/dist/es/index.css +0 -66
  7. package/dist/es/index.js +18 -45
  8. package/dist/es/index.js.map +1 -1
  9. package/dist/index.css +0 -66
  10. package/dist/index.js +18 -45
  11. package/dist/index.js.map +1 -1
  12. package/dist/types.d.ts +1 -40
  13. package/less/main.less +0 -3
  14. package/package.json +6 -10
  15. package/src/components/input/cursor-handle.tsx +1 -1
  16. package/src/components/input/cursor-styles.ts +10 -0
  17. package/src/components/input/math-input.tsx +5 -7
  18. package/src/components/input/scroll-into-view.ts +4 -1
  19. package/src/data/key-configs.ts +0 -9
  20. package/src/enums.ts +0 -43
  21. package/src/types.ts +1 -54
  22. package/tsconfig-build.tsbuildinfo +1 -1
  23. package/dist/components/common-style.d.ts +0 -21
  24. package/index.html +0 -21
  25. package/less/echo.less +0 -56
  26. package/less/popover.less +0 -22
  27. package/less/tabbar.less +0 -6
  28. package/src/components/common-style.ts +0 -46
  29. package/tools/svg-to-react/convert.py +0 -111
  30. package/tools/svg-to-react/icons/math-keypad-icon-0.svg +0 -32
  31. package/tools/svg-to-react/icons/math-keypad-icon-1.svg +0 -32
  32. package/tools/svg-to-react/icons/math-keypad-icon-2.svg +0 -32
  33. package/tools/svg-to-react/icons/math-keypad-icon-3.svg +0 -32
  34. package/tools/svg-to-react/icons/math-keypad-icon-4.svg +0 -32
  35. package/tools/svg-to-react/icons/math-keypad-icon-5.svg +0 -32
  36. package/tools/svg-to-react/icons/math-keypad-icon-6.svg +0 -32
  37. package/tools/svg-to-react/icons/math-keypad-icon-7.svg +0 -32
  38. package/tools/svg-to-react/icons/math-keypad-icon-8.svg +0 -32
  39. package/tools/svg-to-react/icons/math-keypad-icon-9.svg +0 -32
  40. package/tools/svg-to-react/icons/math-keypad-icon-addition.svg +0 -34
  41. package/tools/svg-to-react/icons/math-keypad-icon-cos.svg +0 -38
  42. package/tools/svg-to-react/icons/math-keypad-icon-delete.svg +0 -36
  43. package/tools/svg-to-react/icons/math-keypad-icon-dismiss.svg +0 -36
  44. package/tools/svg-to-react/icons/math-keypad-icon-division.svg +0 -36
  45. package/tools/svg-to-react/icons/math-keypad-icon-equals-not.svg +0 -50
  46. package/tools/svg-to-react/icons/math-keypad-icon-equals.svg +0 -48
  47. package/tools/svg-to-react/icons/math-keypad-icon-exponent-2.svg +0 -38
  48. package/tools/svg-to-react/icons/math-keypad-icon-exponent-3.svg +0 -38
  49. package/tools/svg-to-react/icons/math-keypad-icon-exponent.svg +0 -38
  50. package/tools/svg-to-react/icons/math-keypad-icon-fraction.svg +0 -42
  51. package/tools/svg-to-react/icons/math-keypad-icon-greater-than.svg +0 -46
  52. package/tools/svg-to-react/icons/math-keypad-icon-jump-out-base.svg +0 -44
  53. package/tools/svg-to-react/icons/math-keypad-icon-jump-out-denominator.svg +0 -48
  54. package/tools/svg-to-react/icons/math-keypad-icon-jump-out-exponent.svg +0 -44
  55. package/tools/svg-to-react/icons/math-keypad-icon-jump-out-parentheses.svg +0 -44
  56. package/tools/svg-to-react/icons/math-keypad-icon-less-than.svg +0 -46
  57. package/tools/svg-to-react/icons/math-keypad-icon-log-10.svg +0 -36
  58. package/tools/svg-to-react/icons/math-keypad-icon-log-e.svg +0 -36
  59. package/tools/svg-to-react/icons/math-keypad-icon-log.svg +0 -38
  60. package/tools/svg-to-react/icons/math-keypad-icon-multiplication-cross.svg +0 -40
  61. package/tools/svg-to-react/icons/math-keypad-icon-multiplication-dot.svg +0 -38
  62. package/tools/svg-to-react/icons/math-keypad-icon-percent.svg +0 -42
  63. package/tools/svg-to-react/icons/math-keypad-icon-radical-2.svg +0 -36
  64. package/tools/svg-to-react/icons/math-keypad-icon-radical-3.svg +0 -38
  65. package/tools/svg-to-react/icons/math-keypad-icon-radical.svg +0 -38
  66. package/tools/svg-to-react/icons/math-keypad-icon-radix-character.svg +0 -32
  67. package/tools/svg-to-react/icons/math-keypad-icon-sin.svg +0 -38
  68. package/tools/svg-to-react/icons/math-keypad-icon-subtraction.svg +0 -32
  69. package/tools/svg-to-react/icons/math-keypad-icon-tan.svg +0 -38
  70. package/tools/svg-to-react/symbol_map.py +0 -41
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # @khanacademy/math-input
2
2
 
3
+ ## 16.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#856](https://github.com/Khan/perseus/pull/856) [`6c323dc3`](https://github.com/Khan/perseus/commit/6c323dc37e7cc972fe5a1ab7cbf90a23bf4dd3a0) Thanks [@nedredmond](https://github.com/nedredmond)! - Upgrade WB
8
+
9
+ * [#804](https://github.com/Khan/perseus/pull/804) [`2c295e2c`](https://github.com/Khan/perseus/commit/2c295e2c26ff2bf15e1e8e82bcc34e04e4b9bab0) Thanks [@nixterrimus](https://github.com/nixterrimus)! - Upgrade WonderBlocks Popover
10
+
11
+ * Updated dependencies [[`1f4e17ba`](https://github.com/Khan/perseus/commit/1f4e17ba77e1491523813655af18a70285a25989), [`8857950b`](https://github.com/Khan/perseus/commit/8857950bdeeb6e13bc3766b1c6545289b21cbe2a)]:
12
+ - @khanacademy/perseus-core@1.4.1
13
+
14
+ ## 16.1.1
15
+
16
+ ### Patch Changes
17
+
18
+ - [#841](https://github.com/Khan/perseus/pull/841) [`41d3cd93`](https://github.com/Khan/perseus/commit/41d3cd93f78d4649c8a57b6fa4964c0c9f2c45b0) Thanks [@handeyeco](https://github.com/handeyeco)! - Remove unused SVG tooling
19
+
20
+ * [#843](https://github.com/Khan/perseus/pull/843) [`27f691aa`](https://github.com/Khan/perseus/commit/27f691aa11f061b54db487b5b35222431776260f) Thanks [@handeyeco](https://github.com/handeyeco)! - Remove seemingly unused index.html
21
+
22
+ - [#844](https://github.com/Khan/perseus/pull/844) [`3803452b`](https://github.com/Khan/perseus/commit/3803452b0593649faf4043bf6e1d7681a14078e4) Thanks [@handeyeco](https://github.com/handeyeco)! - Remove seemingly unused Less
23
+
24
+ * [#846](https://github.com/Khan/perseus/pull/846) [`ef32b88f`](https://github.com/Khan/perseus/commit/ef32b88f5027154784fb496506d7c96ee3765eac) Thanks [@handeyeco](https://github.com/handeyeco)! - Break up common-styles.ts
25
+
26
+ - [#840](https://github.com/Khan/perseus/pull/840) [`820febc5`](https://github.com/Khan/perseus/commit/820febc5814a5a10d7c1743be8aa9d220f2d9bd8) Thanks [@handeyeco](https://github.com/handeyeco)! - Remove Redux as a dependency
27
+
28
+ * [#845](https://github.com/Khan/perseus/pull/845) [`67a09051`](https://github.com/Khan/perseus/commit/67a09051c61df98b697349ad75760193e4228bfe) Thanks [@handeyeco](https://github.com/handeyeco)! - Remove some seemingly unused types
29
+
3
30
  ## 16.1.0
4
31
 
5
32
  ### Minor Changes
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Khan Academy's expression editor for the mobile web. Used in the [Perseus](https://github.com/khan/perseus) exercise framework to power math input and expression editing on small screens.
4
4
 
5
- Built with [React](https://github.com/facebook/react), [Redux](https://github.com/reactjs/redux), [MathQuill](https://github.com/mathquill/mathquill), [Aphrodite](https://github.com/khan/aphrodite), and more.
5
+ Built with [React](https://github.com/facebook/react), [MathQuill](https://github.com/mathquill/mathquill), [Aphrodite](https://github.com/khan/aphrodite), and more.
6
6
 
7
7
  ![](https://cloud.githubusercontent.com/assets/1309177/15994911/d1acd29e-30c5-11e6-9707-6bef8e69114f.gif)
8
8
 
@@ -26,14 +26,6 @@ When you start the project you'll need to be on a device that supports touch or
26
26
 
27
27
  ![](https://cloud.githubusercontent.com/assets/1309177/15994912/d2b60cdc-30c5-11e6-8eb4-9086d76f327c.gif)
28
28
 
29
- ## Demo
30
-
31
- A live demo is available via [GitHub Pages](http://khan.github.io/math-input/). You can configure some of the keypad's behaviors, along with the set of active keys, via the [editor](http://khan.github.io/math-input/custom.html).
32
-
33
- Note that, as the input and keypad only respond to touch events, you'll need to enable mobile emulation (e.g., as supported by Chrome) in order to use the keypad in a desktop browser.
34
-
35
- To run the demo locally, clone the repo, `yarn install`, `yarn watch`, and open the `index.html` page. The local behaviors can similarly be customized via the editor @ `custom.html`.
36
-
37
29
  ## License
38
30
 
39
31
  [MIT License](http://opensource.org/licenses/MIT)
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Common parameters used to style components.
3
+ */
4
+ export declare const cursorHandleRadiusPx = 11;
5
+ export declare const cursorHandleDistanceMultiplier = 1.045;
@@ -8,4 +8,5 @@
8
8
  * TODO(charlie): Move this scroll logic out of our components and into a higher
9
9
  * level in the component tree--perhaps even into webapp, beyond Perseus.
10
10
  */
11
+ export declare const toolbarHeightPx = 60;
11
12
  export declare const scrollIntoView: (containerNode: any, keypadNode: any) => void;
package/dist/enums.d.ts CHANGED
@@ -7,32 +7,3 @@ export declare enum KeypadType {
7
7
  }
8
8
  export declare const KeyTypes: string[];
9
9
  export type KeyType = typeof KeyTypes[number];
10
- export declare enum DeviceOrientation {
11
- LANDSCAPE = "LANDSCAPE",
12
- PORTRAIT = "PORTRAIT"
13
- }
14
- export declare enum DeviceType {
15
- PHONE = "PHONE",
16
- TABLET = "TABLET"
17
- }
18
- export declare enum LayoutMode {
19
- FULLSCREEN = "FULLSCREEN",
20
- COMPACT = "COMPACT"
21
- }
22
- export declare enum BorderDirection {
23
- LEFT = "LEFT",
24
- BOTTOM = "BOTTOM"
25
- }
26
- export declare const BorderStyles: {
27
- [style: string]: ReadonlyArray<BorderDirection>;
28
- };
29
- export declare enum IconType {
30
- MATH = "MATH",
31
- SVG = "SVG",
32
- TEXT = "TEXT"
33
- }
34
- export declare enum EchoAnimationType {
35
- SLIDE_AND_FADE = "SLIDE_AND_FADE",
36
- FADE_ONLY = "FADE_ONLY",
37
- LONG_FADE_ONLY = "LONG_FADE_ONLY"
38
- }
package/dist/es/index.css CHANGED
@@ -1,45 +1,3 @@
1
- /**
2
- * Styles for managing the popover animations.
3
- *
4
- * Ideally, we'd be generating these styles with Aphrodite (along with
5
- * CSSTransitionGroup's support for custom classnames), but the generated
6
- * styles have issues on mobile Safari.
7
- * See: https://github.com/Khan/aphrodite/issues/68.
8
- *
9
- * If the animation durations change, the corresponding values in
10
- * echo-manager.js must change as well.
11
- */
12
- .echo-slide-and-fade-enter {
13
- opacity: 1 !important;
14
- transform: translate3d(0, 0, 0) !important;
15
- }
16
- .echo-slide-and-fade-enter.echo-slide-and-fade-enter-active {
17
- opacity: 0 !important;
18
- transform: translate3d(0, -33%, 0) !important;
19
- /**
20
- * TODO(charlie): These times are intentionally different, which means
21
- * that the animation really "ends" after 400ms
22
- * cubic-bezier(1, 0, 0.9, 1) (since the opacity goes to 0), even though
23
- * the transform doesn't complete. There's probably a way to achieve the
24
- * same effect by manipulating the transform's Bezier curve and total
25
- * displacement.
26
- */
27
- transition: transform 800ms cubic-bezier(0, 1, 0.25, 1), opacity 400ms cubic-bezier(1, 0, 0.9, 1) !important;
28
- }
29
- .echo-fade-only-enter {
30
- opacity: 1 !important;
31
- }
32
- .echo-fade-only-enter.echo-fade-only-enter-active {
33
- opacity: 0 !important;
34
- transition: opacity 300ms cubic-bezier(0.25, 0, 0.75, 1) !important;
35
- }
36
- .echo-long-fade-only-enter {
37
- opacity: 1 !important;
38
- }
39
- .echo-long-fade-only-enter.echo-long-fade-only-enter-active {
40
- opacity: 0 !important;
41
- transition: opacity 400ms cubic-bezier(0.75, 0, 0.75, 1) !important;
42
- }
43
1
  .keypad-input {
44
2
  outline: none !important;
45
3
  }
@@ -120,24 +78,6 @@
120
78
  color: white !important;
121
79
  display: inline-block !important;
122
80
  }
123
- /**
124
- * Styles for managing the popover animations.
125
- *
126
- * Ideally, we'd be generating these styles with Aphrodite (along with
127
- * CSSTransitionGroup's support for custom classnames), but the generated
128
- * styles have issues on mobile Safari.
129
- * See: https://github.com/Khan/aphrodite/issues/68.
130
- *
131
- * If the animation durations change, the corresponding values in
132
- * popover-manager.js must change as well.
133
- */
134
- .popover-enter {
135
- opacity: 0 !important;
136
- }
137
- .popover-enter.popover-enter-active {
138
- opacity: 1 !important;
139
- transition: opacity 200ms ease-out !important;
140
- }
141
81
  /*
142
82
  * MathQuill v0.10.1 http://mathquill.com
143
83
  * by Han, Jeanine, and Mary maintainers@mathquill.com
@@ -574,9 +514,3 @@
574
514
  margin-top: -0.1em;
575
515
  }
576
516
 
577
- .tabbar_item {
578
- background-color: red;
579
- }
580
- .tabbar_item:focus {
581
- background-color: green;
582
- }
package/dist/es/index.js CHANGED
@@ -17,7 +17,7 @@ import PropTypes from 'prop-types';
17
17
 
18
18
  // This file is processed by a Rollup plugin (replace) to inject the production
19
19
  const libName = "@khanacademy/math-input";
20
- const libVersion = "16.1.0";
20
+ const libVersion = "16.1.2";
21
21
  addLibraryVersionToPerseusDebug(libName, libVersion);
22
22
 
23
23
  function _extends() {
@@ -103,11 +103,6 @@ View.styles = StyleSheet.create({
103
103
  /**
104
104
  * Common parameters used to style components.
105
105
  */
106
- const wonderBlocksBlue = Color.blue;
107
- const offBlack = Color.offBlack;
108
- Color.offBlack32;
109
- Color.offBlack16;
110
- Color.offBlack8;
111
106
  const cursorHandleRadiusPx = 11;
112
107
 
113
108
  // The amount to multiply the radius by to get the distance from the
@@ -115,10 +110,6 @@ const cursorHandleRadiusPx = 11;
115
110
  // one quadrant replace with a square. The hypotenuse of the square is
116
111
  // 1.045 times the radius of the circle.
117
112
  const cursorHandleDistanceMultiplier = 1.045;
118
- // HACK(charlie): This should be injected by webapp somehow.
119
- // TODO(charlie): Add a link to the webapp location as soon as the footer
120
- // has settled down.
121
- const toolbarHeightPx = 60;
122
113
 
123
114
  const touchTargetRadiusPx = 2 * cursorHandleRadiusPx;
124
115
  const touchTargetHeightPx = 2 * touchTargetRadiusPx;
@@ -1318,6 +1309,11 @@ class MathWrapper {
1318
1309
  * TODO(charlie): Move this scroll logic out of our components and into a higher
1319
1310
  * level in the component tree--perhaps even into webapp, beyond Perseus.
1320
1311
  */
1312
+
1313
+ // HACK(charlie): This should be injected by webapp somehow.
1314
+ // TODO(charlie): Add a link to the webapp location as soon as the footer
1315
+ // has settled down.
1316
+ const toolbarHeightPx = 60;
1321
1317
  const scrollIntoView = (containerNode, keypadNode) => {
1322
1318
  // TODO(charlie): There's no need for us to be reading the keypad bounds
1323
1319
  // here, since they're pre-determined by logic in the store. We should
@@ -2037,7 +2033,7 @@ class MathInput extends React.Component {
2037
2033
  const innerStyle = _extends({}, inlineStyles.innerContainer, {
2038
2034
  borderWidth: this.getBorderWidthPx()
2039
2035
  }, focused ? {
2040
- borderColor: wonderBlocksBlue
2036
+ borderColor: Color.blue
2041
2037
  } : {}, style);
2042
2038
 
2043
2039
  // NOTE(diedra): This label explicitly refers to tapping because this field
@@ -2123,7 +2119,7 @@ const inlineStyles = {
2123
2119
  borderStyle: "solid",
2124
2120
  borderColor: Color.offBlack50,
2125
2121
  borderRadius: 4,
2126
- color: offBlack
2122
+ color: Color.offBlack
2127
2123
  }
2128
2124
  };
2129
2125
 
@@ -2360,37 +2356,9 @@ function Tabbar(props) {
2360
2356
  })));
2361
2357
  }
2362
2358
 
2363
- /**
2364
- * Constants that are shared between multiple files.
2365
- */
2366
-
2367
- let KeypadType = /*#__PURE__*/function (KeypadType) {
2368
- KeypadType["FRACTION"] = "FRACTION";
2369
- KeypadType["EXPRESSION"] = "EXPRESSION";
2370
- return KeypadType;
2371
- }({});
2372
- let BorderDirection = /*#__PURE__*/function (BorderDirection) {
2373
- BorderDirection["LEFT"] = "LEFT";
2374
- BorderDirection["BOTTOM"] = "BOTTOM";
2375
- return BorderDirection;
2376
- }({});
2377
- ({
2378
- LEFT: [BorderDirection.LEFT],
2379
- BOTTOM: [BorderDirection.BOTTOM],
2380
- ALL: [BorderDirection.LEFT, BorderDirection.BOTTOM],
2381
- NONE: []
2382
- });
2383
- let IconType = /*#__PURE__*/function (IconType) {
2384
- IconType["MATH"] = "MATH";
2385
- IconType["SVG"] = "SVG";
2386
- IconType["TEXT"] = "TEXT";
2387
- return IconType;
2388
- }({});
2389
-
2390
2359
  const getDefaultOperatorFields = ({
2391
2360
  key,
2392
2361
  keyType: _keyType = "OPERATOR",
2393
- iconType: _iconType = IconType.SVG,
2394
2362
  ariaLabel: _ariaLabel = key,
2395
2363
  data: _data = key
2396
2364
  }) => ({
@@ -2398,14 +2366,12 @@ const getDefaultOperatorFields = ({
2398
2366
  type: _keyType,
2399
2367
  ariaLabel: _ariaLabel,
2400
2368
  icon: {
2401
- type: _iconType,
2402
2369
  data: _data
2403
2370
  }
2404
2371
  });
2405
2372
  const getDefaultValueFields = ({
2406
2373
  key,
2407
2374
  keyType: _keyType2 = "VALUE",
2408
- iconType: _iconType2 = IconType.MATH,
2409
2375
  ariaLabel: _ariaLabel2 = key,
2410
2376
  data: _data2 = key
2411
2377
  }) => ({
@@ -2413,7 +2379,6 @@ const getDefaultValueFields = ({
2413
2379
  type: _keyType2,
2414
2380
  ariaLabel: _ariaLabel2,
2415
2381
  icon: {
2416
- type: _iconType2,
2417
2382
  data: _data2
2418
2383
  }
2419
2384
  });
@@ -2421,14 +2386,12 @@ const getDefaultNumberFields = ({
2421
2386
  key,
2422
2387
  data: _data3 = key.replace("NUM_", ""),
2423
2388
  keyType: _keyType3 = "VALUE",
2424
- iconType: _iconType3 = IconType.TEXT,
2425
2389
  ariaLabel: _ariaLabel3 = _data3
2426
2390
  }) => ({
2427
2391
  id: key,
2428
2392
  type: _keyType3,
2429
2393
  ariaLabel: _ariaLabel3,
2430
2394
  icon: {
2431
- type: _iconType3,
2432
2395
  data: _data3
2433
2396
  }
2434
2397
  });
@@ -5613,5 +5576,15 @@ const KeyArray = ["PLUS", "MINUS", "NEGATIVE", "TIMES", "DIVIDE", "DECIMAL", "PE
5613
5576
  // Perseus' Expression MathInput
5614
5577
  "PHI", "NTHROOT3", "POW", "LOG_B"];
5615
5578
 
5579
+ /**
5580
+ * Constants that are shared between multiple files.
5581
+ */
5582
+
5583
+ let KeypadType = /*#__PURE__*/function (KeypadType) {
5584
+ KeypadType["FRACTION"] = "FRACTION";
5585
+ KeypadType["EXPRESSION"] = "EXPRESSION";
5586
+ return KeypadType;
5587
+ }({});
5588
+
5616
5589
  export { CursorContext, Keypad as DesktopKeypad, KeyArray, KeyConfigs, KeypadContext, MathInput as KeypadInput, KeypadType, MobileKeypad, StatefulKeypadContextProvider, createMathField, getCursorContext, keyToMathquillMap as keyTranslator, keypadElementPropType, libVersion, mathQuillInstance };
5617
5590
  //# sourceMappingURL=index.js.map