@khanacademy/math-input 3.0.0 → 4.0.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 (91) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/components/input/__tests__/test-math-wrapper.d.ts +1 -1
  3. package/dist/components/input/__tests__/test-math-wrapper.js.flow +1 -1
  4. package/dist/components/input/key-handlers/handle-arrow.d.ts +3 -0
  5. package/dist/components/input/key-handlers/handle-arrow.js.flow +12 -0
  6. package/dist/components/input/key-handlers/handle-backspace.d.ts +7 -0
  7. package/dist/components/input/key-handlers/handle-backspace.js.flow +14 -0
  8. package/dist/components/input/key-handlers/handle-exponent.d.ts +3 -0
  9. package/dist/components/input/key-handlers/handle-exponent.js.flow +12 -0
  10. package/dist/components/input/key-handlers/handle-jump-out.d.ts +7 -0
  11. package/dist/components/input/key-handlers/handle-jump-out.js.flow +14 -0
  12. package/dist/components/input/math-wrapper.d.ts +7 -78
  13. package/dist/components/input/math-wrapper.js.flow +16 -78
  14. package/dist/components/input/mathquill-helpers.d.ts +46 -0
  15. package/dist/components/input/mathquill-helpers.js.flow +56 -0
  16. package/dist/components/input/mathquill-instance.d.ts +3 -0
  17. package/dist/components/input/mathquill-instance.js.flow +9 -0
  18. package/dist/components/input/mathquill-types.d.ts +25 -0
  19. package/dist/components/input/mathquill-types.js.flow +34 -0
  20. package/dist/components/key-translator.d.ts +4 -0
  21. package/dist/components/key-translator.js.flow +10 -0
  22. package/dist/components/keypad/button-assets.d.ts +2 -2
  23. package/dist/components/keypad/button-assets.js.flow +2 -2
  24. package/dist/components/keypad/keypad-page-items.d.ts +1 -1
  25. package/dist/components/keypad/keypad-page-items.js.flow +1 -1
  26. package/dist/components/keypad-legacy/gesture-manager.d.ts +21 -9
  27. package/dist/components/keypad-legacy/gesture-manager.js.flow +27 -12
  28. package/dist/components/keypad-legacy/gesture-state-machine.d.ts +9 -9
  29. package/dist/components/keypad-legacy/gesture-state-machine.js.flow +10 -10
  30. package/dist/components/keypad-legacy/keypad-button.d.ts +2 -2
  31. package/dist/components/keypad-legacy/keypad-button.js.flow +3 -3
  32. package/dist/components/keypad-legacy/store/actions.d.ts +4 -14
  33. package/dist/components/keypad-legacy/store/actions.js.flow +3 -15
  34. package/dist/components/keypad-legacy/store/types.d.ts +2 -2
  35. package/dist/components/keypad-legacy/store/types.js.flow +2 -2
  36. package/dist/components/keypad-legacy/touchable-keypad-button.d.ts +6 -6
  37. package/dist/components/keypad-legacy/touchable-keypad-button.js.flow +9 -14
  38. package/dist/data/key-configs.d.ts +3 -6
  39. package/dist/data/key-configs.js.flow +3 -8
  40. package/dist/data/keys.d.ts +2 -54
  41. package/dist/data/keys.js.flow +116 -55
  42. package/dist/enums.d.ts +2 -9
  43. package/dist/enums.js.flow +2 -11
  44. package/dist/es/index.js +1781 -1196
  45. package/dist/es/index.js.map +1 -1
  46. package/dist/index.d.ts +3 -2
  47. package/dist/index.js +2069 -1242
  48. package/dist/index.js.flow +4 -2
  49. package/dist/index.js.map +1 -1
  50. package/dist/strings.js +26 -10
  51. package/dist/types.d.ts +10 -12
  52. package/dist/types.js.flow +13 -12
  53. package/package.json +1 -1
  54. package/src/components/input/__tests__/context-tracking.test.ts +43 -44
  55. package/src/components/input/__tests__/mathquill.test.ts +133 -135
  56. package/src/components/input/key-handlers/handle-arrow.ts +70 -0
  57. package/src/components/input/key-handlers/handle-backspace.ts +275 -0
  58. package/src/components/input/key-handlers/handle-exponent.ts +52 -0
  59. package/src/components/input/key-handlers/handle-jump-out.ts +103 -0
  60. package/src/components/input/math-input.tsx +11 -12
  61. package/src/components/input/math-wrapper.ts +88 -837
  62. package/src/components/input/mathquill-helpers.ts +268 -0
  63. package/src/components/input/mathquill-instance.ts +5 -0
  64. package/src/components/input/mathquill-types.ts +55 -0
  65. package/src/components/key-translator.ts +209 -0
  66. package/src/components/keypad/button-assets.tsx +411 -100
  67. package/src/components/keypad/geometry-page/index.tsx +1 -1
  68. package/src/components/keypad/keypad-mathquill.stories.tsx +69 -0
  69. package/src/components/keypad/keypad-page-items.tsx +2 -1
  70. package/src/components/keypad/operators-page/index.tsx +1 -1
  71. package/src/components/keypad-legacy/echo-manager.tsx +4 -4
  72. package/src/components/keypad-legacy/empty-keypad-button.tsx +6 -4
  73. package/src/components/keypad-legacy/gesture-manager.ts +32 -9
  74. package/src/components/keypad-legacy/gesture-state-machine.ts +14 -14
  75. package/src/components/keypad-legacy/keypad-button.tsx +15 -18
  76. package/src/components/keypad-legacy/many-keypad-button.tsx +9 -2
  77. package/src/components/keypad-legacy/store/actions.ts +3 -29
  78. package/src/components/keypad-legacy/store/echo-reducer.ts +2 -5
  79. package/src/components/keypad-legacy/store/index.ts +4 -10
  80. package/src/components/keypad-legacy/store/input-reducer.ts +1 -2
  81. package/src/components/keypad-legacy/store/keypad-reducer.ts +2 -3
  82. package/src/components/keypad-legacy/store/types.ts +2 -2
  83. package/src/components/keypad-legacy/touchable-keypad-button.tsx +8 -13
  84. package/src/components/tabbar/icons.tsx +0 -2
  85. package/src/data/key-configs.ts +751 -304
  86. package/src/data/keys.ts +118 -65
  87. package/src/enums.ts +10 -9
  88. package/src/index.ts +3 -2
  89. package/src/math-input.stories.tsx +1 -1
  90. package/src/types.ts +10 -12
  91. package/tsconfig-build.tsbuildinfo +1 -1
@@ -4,58 +4,119 @@
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
- /**
8
- * This file contains constants for keypad buttons that aren't single
9
- * alphanumeric characters.
10
- */
11
-
12
- declare var Keys: {|
13
- +PLUS: "PLUS", // "PLUS"
14
- +MINUS: "MINUS", // "MINUS"
15
- +NEGATIVE: "NEGATIVE", // "NEGATIVE"
16
- +TIMES: "TIMES", // "TIMES"
17
- +DIVIDE: "DIVIDE", // "DIVIDE"
18
- +DECIMAL: "DECIMAL", // "DECIMAL"
19
- +PERIOD: "PERIOD", // "PERIOD"
20
- +PERCENT: "PERCENT", // "PERCENT"
21
- +CDOT: "CDOT", // "CDOT"
22
- +EQUAL: "EQUAL", // "EQUAL"
23
- +NEQ: "NEQ", // "NEQ"
24
- +GT: "GT", // "GT"
25
- +LT: "LT", // "LT"
26
- +GEQ: "GEQ", // "GEQ"
27
- +LEQ: "LEQ", // "LEQ"
28
- +FRAC_INCLUSIVE: "FRAC_INCLUSIVE", // "FRAC_INCLUSIVE"
29
- +FRAC_EXCLUSIVE: "FRAC_EXCLUSIVE", // "FRAC_EXCLUSIVE"
30
- +FRAC: "FRAC", // "FRAC"
31
- +EXP: "EXP", // "EXP"
32
- +EXP_2: "EXP_2", // "EXP_2"
33
- +EXP_3: "EXP_3", // "EXP_3"
34
- +SQRT: "SQRT", // "SQRT"
35
- +CUBE_ROOT: "CUBE_ROOT", // "CUBE_ROOT"
36
- +RADICAL: "RADICAL", // "RADICAL"
37
- +LEFT_PAREN: "LEFT_PAREN", // "LEFT_PAREN"
38
- +RIGHT_PAREN: "RIGHT_PAREN", // "RIGHT_PAREN"
39
- +LN: "LN", // "LN"
40
- +LOG: "LOG", // "LOG"
41
- +LOG_N: "LOG_N", // "LOG_N"
42
- +SIN: "SIN", // "SIN"
43
- +COS: "COS", // "COS"
44
- +TAN: "TAN", // "TAN"
45
- +PI: "PI", // "PI"
46
- +THETA: "THETA", // "THETA"
47
- +UP: "UP", // "UP"
48
- +RIGHT: "RIGHT", // "RIGHT"
49
- +DOWN: "DOWN", // "DOWN"
50
- +LEFT: "LEFT", // "LEFT"
51
- +BACKSPACE: "BACKSPACE", // "BACKSPACE"
52
- +DISMISS: "DISMISS", // "DISMISS"
53
- +JUMP_OUT_PARENTHESES: "JUMP_OUT_PARENTHESES", // "JUMP_OUT_PARENTHESES"
54
- +JUMP_OUT_EXPONENT: "JUMP_OUT_EXPONENT", // "JUMP_OUT_EXPONENT"
55
- +JUMP_OUT_BASE: "JUMP_OUT_BASE", // "JUMP_OUT_BASE"
56
- +JUMP_INTO_NUMERATOR: "JUMP_INTO_NUMERATOR", // "JUMP_INTO_NUMERATOR"
57
- +JUMP_OUT_NUMERATOR: "JUMP_OUT_NUMERATOR", // "JUMP_OUT_NUMERATOR"
58
- +JUMP_OUT_DENOMINATOR: "JUMP_OUT_DENOMINATOR", // "JUMP_OUT_DENOMINATOR"
59
- +NOOP: "NOOP", // "NOOP"
60
- |};
61
- declare export default typeof Keys;
7
+ declare type Key =
8
+ | "PLUS"
9
+ | "MINUS"
10
+ | "NEGATIVE"
11
+ | "TIMES"
12
+ | "DIVIDE"
13
+ | "DECIMAL"
14
+ | "PERIOD"
15
+ | "PERCENT"
16
+ | "CDOT"
17
+ | "EQUAL"
18
+ | "NEQ"
19
+ | "GT"
20
+ | "LT"
21
+ | "GEQ"
22
+ | "LEQ"
23
+ | "FRAC_INCLUSIVE"
24
+ | "FRAC_EXCLUSIVE"
25
+ | "FRAC"
26
+ | "EXP"
27
+ | "EXP_2"
28
+ | "EXP_3"
29
+ | "SQRT"
30
+ | "CUBE_ROOT"
31
+ | "RADICAL"
32
+ | "LEFT_PAREN"
33
+ | "RIGHT_PAREN"
34
+ | "LN"
35
+ | "LOG"
36
+ | "LOG_N"
37
+ | "SIN"
38
+ | "COS"
39
+ | "TAN"
40
+ | "PI"
41
+ | "THETA"
42
+ | "UP"
43
+ | "RIGHT"
44
+ | "DOWN"
45
+ | "LEFT"
46
+ | "BACKSPACE"
47
+ | "DISMISS"
48
+ | "JUMP_OUT_PARENTHESES"
49
+ | "JUMP_OUT_EXPONENT"
50
+ | "JUMP_OUT_BASE"
51
+ | "JUMP_INTO_NUMERATOR"
52
+ | "JUMP_OUT_NUMERATOR"
53
+ | "JUMP_OUT_DENOMINATOR"
54
+ | "NOOP"
55
+ | "MANY"
56
+ | "NUM_0"
57
+ | "NUM_1"
58
+ | "NUM_2"
59
+ | "NUM_3"
60
+ | "NUM_4"
61
+ | "NUM_5"
62
+ | "NUM_6"
63
+ | "NUM_7"
64
+ | "NUM_8"
65
+ | "NUM_9"
66
+ | "a"
67
+ | "b"
68
+ | "c"
69
+ | "d"
70
+ | "e"
71
+ | "f"
72
+ | "g"
73
+ | "h"
74
+ | "i"
75
+ | "j"
76
+ | "k"
77
+ | "l"
78
+ | "m"
79
+ | "n"
80
+ | "o"
81
+ | "p"
82
+ | "q"
83
+ | "r"
84
+ | "s"
85
+ | "t"
86
+ | "u"
87
+ | "v"
88
+ | "w"
89
+ | "x"
90
+ | "y"
91
+ | "z"
92
+ | "A"
93
+ | "B"
94
+ | "C"
95
+ | "D"
96
+ | "E"
97
+ | "F"
98
+ | "G"
99
+ | "H"
100
+ | "I"
101
+ | "J"
102
+ | "K"
103
+ | "L"
104
+ | "M"
105
+ | "N"
106
+ | "O"
107
+ | "P"
108
+ | "Q"
109
+ | "R"
110
+ | "S"
111
+ | "T"
112
+ | "U"
113
+ | "V"
114
+ | "W"
115
+ | "X"
116
+ | "Y"
117
+ | "Z"
118
+ | "PHI"
119
+ | "NTHROOT3"
120
+ | "POW"
121
+ | "LOG_B";
122
+ declare export default typeof Key;
package/dist/enums.d.ts CHANGED
@@ -5,15 +5,8 @@ export declare enum KeypadType {
5
5
  FRACTION = "FRACTION",
6
6
  EXPRESSION = "EXPRESSION"
7
7
  }
8
- export declare enum KeyType {
9
- EMPTY = "EMPTY",
10
- VALUE = "VALUE",
11
- OPERATOR = "OPERATOR",
12
- INPUT_NAVIGATION = "INPUT_NAVIGATION",
13
- KEYPAD_NAVIGATION = "KEYPAD_NAVIGATION",
14
- MANY = "MANY",
15
- ECHO = "ECHO"
16
- }
8
+ export declare const KeyTypes: string[];
9
+ export type KeyType = typeof KeyTypes[number];
17
10
  export declare enum DeviceOrientation {
18
11
  LANDSCAPE = "LANDSCAPE",
19
12
  PORTRAIT = "PORTRAIT"
@@ -12,17 +12,8 @@ declare export var KeypadType: {|
12
12
  +FRACTION: "FRACTION", // "FRACTION"
13
13
  +EXPRESSION: "EXPRESSION", // "EXPRESSION"
14
14
  |};
15
-
16
- declare export var KeyType: {|
17
- +EMPTY: "EMPTY", // "EMPTY"
18
- +VALUE: "VALUE", // "VALUE"
19
- +OPERATOR: "OPERATOR", // "OPERATOR"
20
- +INPUT_NAVIGATION: "INPUT_NAVIGATION", // "INPUT_NAVIGATION"
21
- +KEYPAD_NAVIGATION: "KEYPAD_NAVIGATION", // "KEYPAD_NAVIGATION"
22
- +MANY: "MANY", // "MANY"
23
- +ECHO: "ECHO", // "ECHO"
24
- |};
25
-
15
+ declare export var KeyTypes: string[];
16
+ export type KeyType = $ElementType<typeof KeyTypes, number>;
26
17
  declare export var DeviceOrientation: {|
27
18
  +LANDSCAPE: "LANDSCAPE", // "LANDSCAPE"
28
19
  +PORTRAIT: "PORTRAIT", // "PORTRAIT"