@khanacademy/math-input 14.0.0 → 14.1.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.
- package/CHANGELOG.md +16 -0
- package/dist/components/keypad-legacy/provided-keypad.d.ts +2 -0
- package/dist/data/keys.d.ts +2 -1
- package/dist/es/index.js +59 -33
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +61 -33
- package/dist/index.js.map +1 -1
- package/dist/version.d.ts +1 -0
- package/package.json +3 -3
- package/src/components/keypad/__tests__/__snapshots__/keypad.test.tsx.snap +0 -2
- package/src/components/keypad/keypad.tsx +0 -1
- package/src/components/keypad-legacy/provided-keypad.tsx +36 -32
- package/src/data/keys.ts +118 -115
- package/src/index.ts +3 -0
- package/src/version.ts +10 -0
- package/tsconfig-build.json +1 -0
- package/tsconfig-build.tsbuildinfo +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* A single entry-point for all of the external-facing functionality.
|
|
3
3
|
*/
|
|
4
4
|
import "../less/main.less";
|
|
5
|
+
export { libVersion } from "./version";
|
|
5
6
|
export { default as KeypadInput } from "./components/input/math-input";
|
|
6
7
|
export { createMathField, mathQuillInstance, } from "./components/input/mathquill-instance";
|
|
7
8
|
export { type MathFieldInterface } from "./components/input/mathquill-types";
|
|
@@ -13,6 +14,7 @@ export { KeypadContext, StatefulKeypadContextProvider, } from "./components/keyp
|
|
|
13
14
|
export { keypadElementPropType } from "./components/prop-types";
|
|
14
15
|
export type { KeypadAPI, KeypadConfiguration } from "./types";
|
|
15
16
|
export type { default as Keys } from "./data/keys";
|
|
17
|
+
export { KeyArray } from "./data/keys";
|
|
16
18
|
export { default as KeyConfigs } from "./data/key-configs";
|
|
17
19
|
export { type KeyType, KeypadType } from "./enums";
|
|
18
20
|
export { default as keyTranslator } from "./components/key-handlers/key-translator";
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var perseusCore = require('@khanacademy/perseus-core');
|
|
5
6
|
var Color = require('@khanacademy/wonder-blocks-color');
|
|
6
7
|
var i18n = require('@khanacademy/wonder-blocks-i18n');
|
|
7
8
|
var wonderStuffCore = require('@khanacademy/wonder-stuff-core');
|
|
@@ -49,6 +50,11 @@ var katex__default = /*#__PURE__*/_interopDefaultLegacy(katex);
|
|
|
49
50
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
50
51
|
var Redux__namespace = /*#__PURE__*/_interopNamespace(Redux);
|
|
51
52
|
|
|
53
|
+
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
54
|
+
const libName = "@khanacademy/math-input";
|
|
55
|
+
const libVersion = "14.1.0";
|
|
56
|
+
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
57
|
+
|
|
52
58
|
function _defineProperty(obj, key, value) {
|
|
53
59
|
key = _toPropertyKey(key);
|
|
54
60
|
if (key in obj) {
|
|
@@ -5322,7 +5328,6 @@ function Keypad$2(props) {
|
|
|
5322
5328
|
style: styles$d.keypadInnerContainer
|
|
5323
5329
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
5324
5330
|
style: [styles$d.keypadGrid, gridStyle],
|
|
5325
|
-
role: "grid",
|
|
5326
5331
|
tabIndex: 0,
|
|
5327
5332
|
"aria-label": "Keypad"
|
|
5328
5333
|
}, selectedPage === "Fractions" && /*#__PURE__*/React__namespace.createElement(FractionsPage, {
|
|
@@ -9939,6 +9944,38 @@ class ProvidedKeypad extends React__namespace.Component {
|
|
|
9939
9944
|
_defineProperty(this, "getDOMNode", () => {
|
|
9940
9945
|
return ReactDOM__default["default"].findDOMNode(this);
|
|
9941
9946
|
});
|
|
9947
|
+
_defineProperty(this, "onElementMounted", element => {
|
|
9948
|
+
var _this$props$onElement, _this$props;
|
|
9949
|
+
this.props.onAnalyticsEvent({
|
|
9950
|
+
type: "math-input:keypad-opened",
|
|
9951
|
+
payload: {
|
|
9952
|
+
virtualKeypadVersion: "MATH_INPUT_KEYPAD_V1"
|
|
9953
|
+
}
|
|
9954
|
+
});
|
|
9955
|
+
|
|
9956
|
+
// Append the dispatch methods that we want to expose
|
|
9957
|
+
// externally to the returned React element.
|
|
9958
|
+
const elementWithDispatchMethods = {
|
|
9959
|
+
...element,
|
|
9960
|
+
activate: this.activate,
|
|
9961
|
+
dismiss: this.dismiss,
|
|
9962
|
+
configure: this.configure,
|
|
9963
|
+
setCursor: this.setCursor,
|
|
9964
|
+
setKeyHandler: this.setKeyHandler,
|
|
9965
|
+
getDOMNode: this.getDOMNode
|
|
9966
|
+
};
|
|
9967
|
+
(_this$props$onElement = (_this$props = this.props).onElementMounted) === null || _this$props$onElement === void 0 ? void 0 : _this$props$onElement.call(_this$props, elementWithDispatchMethods);
|
|
9968
|
+
});
|
|
9969
|
+
_defineProperty(this, "onDismiss", () => {
|
|
9970
|
+
var _this$props$onDismiss, _this$props2;
|
|
9971
|
+
this.props.onAnalyticsEvent({
|
|
9972
|
+
type: "math-input:keypad-closed",
|
|
9973
|
+
payload: {
|
|
9974
|
+
virtualKeypadVersion: "MATH_INPUT_KEYPAD_V1"
|
|
9975
|
+
}
|
|
9976
|
+
});
|
|
9977
|
+
(_this$props$onDismiss = (_this$props2 = this.props).onDismiss) === null || _this$props$onDismiss === void 0 ? void 0 : _this$props$onDismiss.call(_this$props2);
|
|
9978
|
+
});
|
|
9942
9979
|
this.store = createStore();
|
|
9943
9980
|
}
|
|
9944
9981
|
componentDidUpdate(prevProps) {
|
|
@@ -9951,43 +9988,13 @@ class ProvidedKeypad extends React__namespace.Component {
|
|
|
9951
9988
|
}
|
|
9952
9989
|
render() {
|
|
9953
9990
|
const {
|
|
9954
|
-
onElementMounted,
|
|
9955
|
-
onDismiss,
|
|
9956
9991
|
style
|
|
9957
9992
|
} = this.props;
|
|
9958
9993
|
return /*#__PURE__*/React__namespace.createElement(reactRedux.Provider, {
|
|
9959
9994
|
store: this.store
|
|
9960
9995
|
}, /*#__PURE__*/React__namespace.createElement(KeypadContainer$1, {
|
|
9961
|
-
onElementMounted:
|
|
9962
|
-
|
|
9963
|
-
type: "math-input:keypad-opened",
|
|
9964
|
-
payload: {
|
|
9965
|
-
virtualKeypadVersion: "MATH_INPUT_KEYPAD_V1"
|
|
9966
|
-
}
|
|
9967
|
-
});
|
|
9968
|
-
|
|
9969
|
-
// Append the dispatch methods that we want to expose
|
|
9970
|
-
// externally to the returned React element.
|
|
9971
|
-
const elementWithDispatchMethods = {
|
|
9972
|
-
...element,
|
|
9973
|
-
activate: this.activate,
|
|
9974
|
-
dismiss: this.dismiss,
|
|
9975
|
-
configure: this.configure,
|
|
9976
|
-
setCursor: this.setCursor,
|
|
9977
|
-
setKeyHandler: this.setKeyHandler,
|
|
9978
|
-
getDOMNode: this.getDOMNode
|
|
9979
|
-
};
|
|
9980
|
-
onElementMounted === null || onElementMounted === void 0 ? void 0 : onElementMounted(elementWithDispatchMethods);
|
|
9981
|
-
},
|
|
9982
|
-
onDismiss: () => {
|
|
9983
|
-
this.props.onAnalyticsEvent({
|
|
9984
|
-
type: "math-input:keypad-closed",
|
|
9985
|
-
payload: {
|
|
9986
|
-
virtualKeypadVersion: "MATH_INPUT_KEYPAD_V1"
|
|
9987
|
-
}
|
|
9988
|
-
});
|
|
9989
|
-
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
9990
|
-
},
|
|
9996
|
+
onElementMounted: this.onElementMounted,
|
|
9997
|
+
onDismiss: this.onDismiss,
|
|
9991
9998
|
style: style
|
|
9992
9999
|
}));
|
|
9993
10000
|
}
|
|
@@ -10030,8 +10037,28 @@ const keypadElementPropType = PropTypes__default["default"].shape({
|
|
|
10030
10037
|
getDOMNode: PropTypes__default["default"].func.isRequired
|
|
10031
10038
|
});
|
|
10032
10039
|
|
|
10040
|
+
const KeyArray = ["PLUS", "MINUS", "NEGATIVE", "TIMES", "DIVIDE", "DECIMAL", "PERIOD", "PERCENT", "CDOT", "EQUAL", "NEQ", "GT", "LT", "GEQ", "LEQ",
|
|
10041
|
+
// mobile native only
|
|
10042
|
+
"FRAC_INCLUSIVE",
|
|
10043
|
+
// mobile native only
|
|
10044
|
+
"FRAC_EXCLUSIVE",
|
|
10045
|
+
// mobile native only
|
|
10046
|
+
"FRAC", "EXP", "EXP_2", "EXP_3", "SQRT", "CUBE_ROOT", "RADICAL", "LEFT_PAREN", "RIGHT_PAREN", "LN", "LOG", "LOG_N", "SIN", "COS",
|
|
10047
|
+
// TODO(charlie): Add in additional Greek letters.,
|
|
10048
|
+
"TAN", "PI", "THETA", "UP", "RIGHT", "DOWN", "LEFT", "BACKSPACE", "DISMISS", "JUMP_OUT_PARENTHESES", "JUMP_OUT_EXPONENT", "JUMP_OUT_BASE", "JUMP_INTO_NUMERATOR", "JUMP_OUT_NUMERATOR", "JUMP_OUT_DENOMINATOR",
|
|
10049
|
+
// Multi-functional keys.
|
|
10050
|
+
"NOOP",
|
|
10051
|
+
// mobile native only
|
|
10052
|
+
"MANY",
|
|
10053
|
+
// A custom key that captures an arbitrary number of symbols but has no 'default' symbol or action.
|
|
10054
|
+
"NUM_0", "NUM_1", "NUM_2", "NUM_3", "NUM_4", "NUM_5", "NUM_6", "NUM_7", "NUM_8", "NUM_9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
|
|
10055
|
+
// Currently only used by
|
|
10056
|
+
// Perseus' Expression MathInput
|
|
10057
|
+
"PHI", "NTHROOT3", "POW", "LOG_B"];
|
|
10058
|
+
|
|
10033
10059
|
exports.CursorContext = CursorContext;
|
|
10034
10060
|
exports.DesktopKeypad = Keypad$2;
|
|
10061
|
+
exports.KeyArray = KeyArray;
|
|
10035
10062
|
exports.KeyConfigs = KeyConfigs;
|
|
10036
10063
|
exports.KeypadContext = KeypadContext;
|
|
10037
10064
|
exports.KeypadInput = MathInput;
|
|
@@ -10042,5 +10069,6 @@ exports.createMathField = createMathField;
|
|
|
10042
10069
|
exports.getCursorContext = getCursorContext;
|
|
10043
10070
|
exports.keyTranslator = keyToMathquillMap;
|
|
10044
10071
|
exports.keypadElementPropType = keypadElementPropType;
|
|
10072
|
+
exports.libVersion = libVersion;
|
|
10045
10073
|
exports.mathQuillInstance = mathQuillInstance;
|
|
10046
10074
|
//# sourceMappingURL=index.js.map
|