@khanacademy/math-input 21.1.5 → 21.1.7
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/dist/components/aphrodite-css-transition-group/types.d.ts +0 -1
- package/dist/data/key-configs.d.ts +1 -110
- package/dist/es/index.js +10 -6
- package/dist/es/index.js.map +1 -1
- package/dist/fake-react-native-web/view.d.ts +0 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -4,114 +4,5 @@
|
|
|
4
4
|
import type Key from "./keys";
|
|
5
5
|
import type { MathInputStrings } from "../strings";
|
|
6
6
|
import type { KeyConfig } from "../types";
|
|
7
|
-
declare const KeyConfigs: (strings: MathInputStrings) => {
|
|
8
|
-
x: KeyConfig;
|
|
9
|
-
y: KeyConfig;
|
|
10
|
-
a: KeyConfig;
|
|
11
|
-
b: KeyConfig;
|
|
12
|
-
i: KeyConfig;
|
|
13
|
-
p: KeyConfig;
|
|
14
|
-
q: KeyConfig;
|
|
15
|
-
s: KeyConfig;
|
|
16
|
-
u: KeyConfig;
|
|
17
|
-
g: KeyConfig;
|
|
18
|
-
PLUS: KeyConfig;
|
|
19
|
-
MINUS: KeyConfig;
|
|
20
|
-
NEGATIVE: KeyConfig;
|
|
21
|
-
TIMES: KeyConfig;
|
|
22
|
-
DIVIDE: KeyConfig;
|
|
23
|
-
DECIMAL: KeyConfig;
|
|
24
|
-
PERIOD: KeyConfig;
|
|
25
|
-
PERCENT: KeyConfig;
|
|
26
|
-
CDOT: KeyConfig;
|
|
27
|
-
EQUAL: KeyConfig;
|
|
28
|
-
NEQ: KeyConfig;
|
|
29
|
-
GT: KeyConfig;
|
|
30
|
-
LT: KeyConfig;
|
|
31
|
-
GEQ: KeyConfig;
|
|
32
|
-
LEQ: KeyConfig;
|
|
33
|
-
FRAC_INCLUSIVE: KeyConfig;
|
|
34
|
-
FRAC_EXCLUSIVE: KeyConfig;
|
|
35
|
-
FRAC: KeyConfig;
|
|
36
|
-
EXP: KeyConfig;
|
|
37
|
-
EXP_2: KeyConfig;
|
|
38
|
-
EXP_3: KeyConfig;
|
|
39
|
-
SQRT: KeyConfig;
|
|
40
|
-
CUBE_ROOT: KeyConfig;
|
|
41
|
-
RADICAL: KeyConfig;
|
|
42
|
-
LEFT_PAREN: KeyConfig;
|
|
43
|
-
RIGHT_PAREN: KeyConfig;
|
|
44
|
-
LN: KeyConfig;
|
|
45
|
-
LOG: KeyConfig;
|
|
46
|
-
LOG_N: KeyConfig;
|
|
47
|
-
SIN: KeyConfig;
|
|
48
|
-
COS: KeyConfig;
|
|
49
|
-
TAN: KeyConfig;
|
|
50
|
-
PI: KeyConfig;
|
|
51
|
-
THETA: KeyConfig;
|
|
52
|
-
UP: KeyConfig;
|
|
53
|
-
RIGHT: KeyConfig;
|
|
54
|
-
DOWN: KeyConfig;
|
|
55
|
-
LEFT: KeyConfig;
|
|
56
|
-
BACKSPACE: KeyConfig;
|
|
57
|
-
DISMISS: KeyConfig;
|
|
58
|
-
JUMP_OUT_PARENTHESES: KeyConfig;
|
|
59
|
-
JUMP_OUT_EXPONENT: KeyConfig;
|
|
60
|
-
JUMP_OUT_BASE: KeyConfig;
|
|
61
|
-
JUMP_INTO_NUMERATOR: KeyConfig;
|
|
62
|
-
JUMP_OUT_NUMERATOR: KeyConfig;
|
|
63
|
-
JUMP_OUT_DENOMINATOR: KeyConfig;
|
|
64
|
-
NUM_0: KeyConfig;
|
|
65
|
-
NUM_1: KeyConfig;
|
|
66
|
-
NUM_2: KeyConfig;
|
|
67
|
-
NUM_3: KeyConfig;
|
|
68
|
-
NUM_4: KeyConfig;
|
|
69
|
-
NUM_5: KeyConfig;
|
|
70
|
-
NUM_6: KeyConfig;
|
|
71
|
-
NUM_7: KeyConfig;
|
|
72
|
-
NUM_8: KeyConfig;
|
|
73
|
-
NUM_9: KeyConfig;
|
|
74
|
-
c: KeyConfig;
|
|
75
|
-
d: KeyConfig;
|
|
76
|
-
e: KeyConfig;
|
|
77
|
-
f: KeyConfig;
|
|
78
|
-
h: KeyConfig;
|
|
79
|
-
j: KeyConfig;
|
|
80
|
-
k: KeyConfig;
|
|
81
|
-
l: KeyConfig;
|
|
82
|
-
m: KeyConfig;
|
|
83
|
-
n: KeyConfig;
|
|
84
|
-
o: KeyConfig;
|
|
85
|
-
r: KeyConfig;
|
|
86
|
-
t: KeyConfig;
|
|
87
|
-
v: KeyConfig;
|
|
88
|
-
w: KeyConfig;
|
|
89
|
-
z: KeyConfig;
|
|
90
|
-
A: KeyConfig;
|
|
91
|
-
B: KeyConfig;
|
|
92
|
-
C: KeyConfig;
|
|
93
|
-
D: KeyConfig;
|
|
94
|
-
E: KeyConfig;
|
|
95
|
-
F: KeyConfig;
|
|
96
|
-
G: KeyConfig;
|
|
97
|
-
H: KeyConfig;
|
|
98
|
-
I: KeyConfig;
|
|
99
|
-
J: KeyConfig;
|
|
100
|
-
K: KeyConfig;
|
|
101
|
-
L: KeyConfig;
|
|
102
|
-
M: KeyConfig;
|
|
103
|
-
N: KeyConfig;
|
|
104
|
-
O: KeyConfig;
|
|
105
|
-
P: KeyConfig;
|
|
106
|
-
Q: KeyConfig;
|
|
107
|
-
R: KeyConfig;
|
|
108
|
-
S: KeyConfig;
|
|
109
|
-
T: KeyConfig;
|
|
110
|
-
U: KeyConfig;
|
|
111
|
-
V: KeyConfig;
|
|
112
|
-
W: KeyConfig;
|
|
113
|
-
X: KeyConfig;
|
|
114
|
-
Y: KeyConfig;
|
|
115
|
-
Z: KeyConfig;
|
|
116
|
-
};
|
|
7
|
+
declare const KeyConfigs: (strings: MathInputStrings) => { [key in Key]: KeyConfig; };
|
|
117
8
|
export default KeyConfigs;
|
package/dist/es/index.js
CHANGED
|
@@ -16,7 +16,7 @@ import PropTypes from 'prop-types';
|
|
|
16
16
|
|
|
17
17
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
18
18
|
const libName = "@khanacademy/math-input";
|
|
19
|
-
const libVersion = "21.1.
|
|
19
|
+
const libVersion = "21.1.7";
|
|
20
20
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
21
21
|
|
|
22
22
|
function _extends() {
|
|
@@ -539,6 +539,7 @@ function createMathField(container, locale, strings, configCallback) {
|
|
|
539
539
|
// HTTP request to fetch non-english speech rules, and cannot be easily
|
|
540
540
|
// mocked in consuming packages now that we do not bundle source code.
|
|
541
541
|
// When it eventually times out, it will cause arbitrary test failures.
|
|
542
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
542
543
|
!inJest && SpeechRuleEngine.setup(locale).then(SRE => mathField.setMathspeakOverride(SRE.texToSpeech));
|
|
543
544
|
return mathField;
|
|
544
545
|
}
|
|
@@ -1761,6 +1762,7 @@ class MathInput extends React.Component {
|
|
|
1761
1762
|
* @param {number} y - the y coordinate in the viewport
|
|
1762
1763
|
*/
|
|
1763
1764
|
this._insertCursorAtClosestNode = (x, y) => {
|
|
1765
|
+
var _this$props$keypadEle3;
|
|
1764
1766
|
const cursor = this.mathField.getCursor();
|
|
1765
1767
|
|
|
1766
1768
|
// Pre-emptively check if the input has any child nodes; if not, the
|
|
@@ -1819,7 +1821,7 @@ class MathInput extends React.Component {
|
|
|
1819
1821
|
cursor.insAtLeftEnd(this.mathField.mathField.controller().root);
|
|
1820
1822
|
}
|
|
1821
1823
|
// In that event, we need to update the cursor context ourselves.
|
|
1822
|
-
this.props.keypadElement
|
|
1824
|
+
(_this$props$keypadEle3 = this.props.keypadElement) == null || _this$props$keypadEle3.setCursor({
|
|
1823
1825
|
context: this.mathField.contextForCursor()
|
|
1824
1826
|
});
|
|
1825
1827
|
};
|
|
@@ -2091,12 +2093,13 @@ class MathInput extends React.Component {
|
|
|
2091
2093
|
this._isMounted = true;
|
|
2092
2094
|
this.mathField = new MathWrapper(this._mathContainer, this.props.ariaLabel, this.context.strings, this.context.locale, {
|
|
2093
2095
|
onCursorMove: cursor => {
|
|
2096
|
+
var _this$props$keypadEle4;
|
|
2094
2097
|
// TODO(charlie): It's not great that there is so much coupling
|
|
2095
2098
|
// between this keypad and the input behavior. We should wrap
|
|
2096
2099
|
// this `MathInput` component in an intermediary component
|
|
2097
2100
|
// that translates accesses on the keypad into vanilla props,
|
|
2098
2101
|
// to make this input keypad-agnostic.
|
|
2099
|
-
this.props.keypadElement
|
|
2102
|
+
(_this$props$keypadEle4 = this.props.keypadElement) == null || _this$props$keypadEle4.setCursor(cursor);
|
|
2100
2103
|
}
|
|
2101
2104
|
});
|
|
2102
2105
|
this.mathField.setContent(this.props.value);
|
|
@@ -2188,8 +2191,9 @@ class MathInput extends React.Component {
|
|
|
2188
2191
|
// that the keypad may be anchored above the 'Check answer' bottom bar,
|
|
2189
2192
|
// in which case we don't want to dismiss the keypad on check.
|
|
2190
2193
|
if (!isWithinKeypadBounds(x, y)) {
|
|
2194
|
+
var _this$props$onBlur2, _this$props3;
|
|
2191
2195
|
this.blur();
|
|
2192
|
-
this.props.onBlur
|
|
2196
|
+
(_this$props$onBlur2 = (_this$props3 = this.props).onBlur) == null || _this$props$onBlur2.call(_this$props3);
|
|
2193
2197
|
}
|
|
2194
2198
|
}
|
|
2195
2199
|
}
|
|
@@ -2217,8 +2221,8 @@ class MathInput extends React.Component {
|
|
|
2217
2221
|
}
|
|
2218
2222
|
/** Returns the current bounds of the keypadElement */
|
|
2219
2223
|
_getKeypadBounds() {
|
|
2220
|
-
var _this$props$
|
|
2221
|
-
const keypadNode = (_this$props$
|
|
2224
|
+
var _this$props$keypadEle5;
|
|
2225
|
+
const keypadNode = (_this$props$keypadEle5 = this.props.keypadElement) == null ? void 0 : _this$props$keypadEle5.getDOMNode();
|
|
2222
2226
|
|
|
2223
2227
|
// If the keypad is mounted, return its bounds. Otherwise, return null.
|
|
2224
2228
|
if (keypadNode instanceof Element) {
|