@khanacademy/math-input 0.6.2 → 0.6.4
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.
- package/.eslintrc.js +6 -1
- package/CHANGELOG.md +12 -0
- package/dist/es/index.js +2 -0
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/input/cursor-contexts.js +21 -0
- package/src/consts.js +22 -0
- package/src/data/key-configs.js +1 -0
- package/src/data/keys.js +58 -0
- package/src/index.js +4 -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": "0.6.
|
|
6
|
+
"version": "0.6.4",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"jquery": "^2.1.1",
|
|
31
31
|
"katex": "^0.11.1",
|
|
32
32
|
"mathquill": "git+https://git@github.com/Khan/mathquill.git#a9ae54e057c5c1acc8244a5627acbff29901d992",
|
|
33
|
-
"perseus-build-settings": "^0.0.
|
|
33
|
+
"perseus-build-settings": "^0.0.5",
|
|
34
34
|
"prop-types": "15.6.1",
|
|
35
35
|
"react": "^16.8.0",
|
|
36
36
|
"react-dom": "^16.8.0",
|
|
@@ -11,6 +11,27 @@
|
|
|
11
11
|
* the radical.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
+
export type CursorContext =
|
|
15
|
+
// The cursor is not in any of the other viable contexts.
|
|
16
|
+
| "NONE"
|
|
17
|
+
// The cursor is within a set of parentheses.
|
|
18
|
+
| "IN_PARENS"
|
|
19
|
+
// The cursor is within a superscript (e.g., an exponent).
|
|
20
|
+
| "IN_SUPER_SCRIPT"
|
|
21
|
+
// The cursor is within a subscript (e.g., the base of a custom logarithm).
|
|
22
|
+
| "IN_SUB_SCRIPT"
|
|
23
|
+
// The cursor is in the numerator of a fraction.
|
|
24
|
+
| "IN_NUMERATOR"
|
|
25
|
+
// The cursor is in the denominator of a fraction.
|
|
26
|
+
| "IN_DENOMINATOR"
|
|
27
|
+
// The cursor is sitting before a fraction; that is, the cursor is within
|
|
28
|
+
// what looks to be a mixed number preceding a fraction. This will only be
|
|
29
|
+
// the case when the only math between the cursor and the fraction to its
|
|
30
|
+
// write is non-leaf math (numbers and variables).
|
|
31
|
+
| "BEFORE_FRACTION";
|
|
32
|
+
|
|
33
|
+
// TODO: Get rid of these constants in favour of CursorContext type.
|
|
34
|
+
|
|
14
35
|
// The cursor is not in any of the other viable contexts.
|
|
15
36
|
export const NONE = "NONE";
|
|
16
37
|
// The cursor is within a set of parentheses.
|
package/src/consts.js
CHANGED
|
@@ -3,11 +3,33 @@
|
|
|
3
3
|
* Constants that are shared between multiple files.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
export type KeypadType = "FRACTION" | "EXPRESSION";
|
|
7
|
+
|
|
8
|
+
// TODO: Retire this in favour of KeypadType (above)
|
|
6
9
|
export const KeypadTypes = {
|
|
7
10
|
FRACTION: "FRACTION",
|
|
8
11
|
EXPRESSION: "EXPRESSION",
|
|
9
12
|
};
|
|
10
13
|
|
|
14
|
+
export type KeyType =
|
|
15
|
+
| "EMPTY"
|
|
16
|
+
// For numerals, variables, and any other characters that themselves
|
|
17
|
+
// compose 'values'.
|
|
18
|
+
| "VALUE"
|
|
19
|
+
// For buttons that insert or adjust math in an input.
|
|
20
|
+
| "OPERATOR"
|
|
21
|
+
// For buttons that move the cursor in an input (including via
|
|
22
|
+
// deletion).
|
|
23
|
+
| "INPUT_NAVIGATION"
|
|
24
|
+
// For buttons that modify the broader keypad state (e.g., by changing
|
|
25
|
+
// the visible pane).
|
|
26
|
+
| "KEYPAD_NAVIGATION"
|
|
27
|
+
// For buttons that house multiple buttons and have no action
|
|
28
|
+
// themselves.
|
|
29
|
+
| "MANY"
|
|
30
|
+
// For the echo animation that appears on press.
|
|
31
|
+
| "ECHO";
|
|
32
|
+
|
|
11
33
|
export const KeyTypes = {
|
|
12
34
|
EMPTY: "EMPTY",
|
|
13
35
|
// For numerals, variables, and any other characters that themselves
|
package/src/data/key-configs.js
CHANGED
package/src/data/keys.js
CHANGED
|
@@ -4,6 +4,64 @@
|
|
|
4
4
|
* alphanumeric characters.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
export 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" // mobile native only
|
|
24
|
+
| "FRAC_EXCLUSIVE" // mobile native only
|
|
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
|
+
|
|
41
|
+
// TODO(charlie): Add in additional Greek letters.
|
|
42
|
+
| "PI"
|
|
43
|
+
| "THETA"
|
|
44
|
+
| "UP"
|
|
45
|
+
| "RIGHT"
|
|
46
|
+
| "DOWN"
|
|
47
|
+
| "LEFT"
|
|
48
|
+
| "BACKSPACE"
|
|
49
|
+
| "DISMISS"
|
|
50
|
+
| "JUMP_OUT_PARENTHESES"
|
|
51
|
+
| "JUMP_OUT_EXPONENT"
|
|
52
|
+
| "JUMP_OUT_BASE"
|
|
53
|
+
| "JUMP_INTO_NUMERATOR"
|
|
54
|
+
| "JUMP_OUT_NUMERATOR"
|
|
55
|
+
| "JUMP_OUT_DENOMINATOR"
|
|
56
|
+
| "NOOP"
|
|
57
|
+
|
|
58
|
+
// Multi-functional keys.
|
|
59
|
+
| "FRAC_MULTI" // mobile native only
|
|
60
|
+
|
|
61
|
+
// A custom key that captures an arbitrary number of symbols but has no
|
|
62
|
+
// 'default' symbol or action.
|
|
63
|
+
| "MANY";
|
|
64
|
+
|
|
7
65
|
// TODO(charlie): There's duplication between this file and key-configs.js.
|
|
8
66
|
// We should clean it up by removing this file and requiring clients to use the
|
|
9
67
|
// `id` field on the key configurations.
|
package/src/index.js
CHANGED
|
@@ -17,3 +17,7 @@ export {default as KeyConfigs} from "./data/key-configs.js";
|
|
|
17
17
|
import * as CursorContexts from "./components/input/cursor-contexts.js";
|
|
18
18
|
|
|
19
19
|
export {CursorContexts};
|
|
20
|
+
|
|
21
|
+
export type {KeypadType, KeyType} from "./consts.js";
|
|
22
|
+
export type {Key} from "./data/keys.js";
|
|
23
|
+
export type {CursorContext} from "./components/input/cursor-contexts.js";
|