@khanacademy/math-input 22.3.0 → 23.0.1
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/input/math-wrapper.d.ts +3 -3
- package/dist/components/input/mathquill-types.d.ts +2 -2
- package/dist/components/key-handlers/handle-arrow.d.ts +2 -2
- package/dist/components/key-handlers/handle-exponent.d.ts +2 -2
- package/dist/components/key-handlers/handle-jump-out.d.ts +2 -2
- package/dist/components/key-handlers/key-translator.d.ts +2 -2
- package/dist/components/keypad/button-assets.d.ts +2 -2
- package/dist/components/keypad/keypad-pages/extras-page.d.ts +2 -2
- package/dist/components/keypad/keypad.d.ts +2 -3
- package/dist/components/keypad/mobile-keypad-internals.d.ts +3 -4
- package/dist/data/key-configs.d.ts +2 -2
- package/dist/data/keys.d.ts +0 -3
- package/dist/enums.d.ts +0 -4
- package/dist/es/index.js +2 -57
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +1 -4
- package/dist/index.js +1 -58
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +5 -12
- package/package.json +11 -11
package/dist/index.d.ts
CHANGED
|
@@ -12,10 +12,7 @@ export { MobileKeypad } from "./components/keypad";
|
|
|
12
12
|
export { default as DesktopKeypad } from "./components/keypad";
|
|
13
13
|
export { MathInputI18nContextProvider, MathInputI18nContext, useMathInputI18n, } from "./components/i18n-context";
|
|
14
14
|
export { keypadElementPropType } from "./components/prop-types";
|
|
15
|
-
export type { KeypadAPI
|
|
15
|
+
export type { KeypadAPI } from "./types";
|
|
16
16
|
export { convertDotToTimesByLocale } from "./utils";
|
|
17
|
-
export type { default as Keys } from "./data/keys";
|
|
18
|
-
export { KeyArray } from "./data/keys";
|
|
19
17
|
export { default as KeyConfigs } from "./data/key-configs";
|
|
20
|
-
export { type KeyType, KeypadType } from "./enums";
|
|
21
18
|
export { getKeyTranslator } from "./components/key-handlers/key-translator";
|
package/dist/index.js
CHANGED
|
@@ -88,7 +88,7 @@ const addLibraryVersionToPerseusDebug = (libraryName, libraryVersion) => {
|
|
|
88
88
|
|
|
89
89
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
90
90
|
const libName = "@khanacademy/math-input";
|
|
91
|
-
const libVersion = "
|
|
91
|
+
const libVersion = "23.0.1";
|
|
92
92
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
93
93
|
|
|
94
94
|
class View extends React__namespace.Component {
|
|
@@ -872,37 +872,6 @@ function handleBackspaceInLogIndex(mathField, cursor) {
|
|
|
872
872
|
mathField.keystroke("Backspace");
|
|
873
873
|
}
|
|
874
874
|
}
|
|
875
|
-
function handleBackspaceOutsideParens(cursor) {
|
|
876
|
-
// In this case the node with '\\left(' for its ctrlSeq
|
|
877
|
-
// is the parent of the expression contained within the
|
|
878
|
-
// parentheses.
|
|
879
|
-
//
|
|
880
|
-
// Handle selecting an expression before deleting:
|
|
881
|
-
// (x+1)| => |(x+1)|
|
|
882
|
-
// \log(x+1)| => |\log(x+1)|
|
|
883
|
-
|
|
884
|
-
const leftNode = cursor[mathQuillInstance.L];
|
|
885
|
-
const rightNode = cursor[mathQuillInstance.R];
|
|
886
|
-
const command = maybeFindCommandBeforeParens(leftNode);
|
|
887
|
-
if (command && command.startNode) {
|
|
888
|
-
// There's a command before the parens so we select it as well as
|
|
889
|
-
// the parens.
|
|
890
|
-
cursor.insLeftOf(command.startNode);
|
|
891
|
-
cursor.startSelection();
|
|
892
|
-
if (rightNode === MathFieldActionType.MQ_END) {
|
|
893
|
-
cursor.insAtRightEnd(cursor.parent);
|
|
894
|
-
} else {
|
|
895
|
-
cursor.insLeftOf(rightNode);
|
|
896
|
-
}
|
|
897
|
-
cursor.select();
|
|
898
|
-
cursor.endSelection();
|
|
899
|
-
} else {
|
|
900
|
-
cursor.startSelection();
|
|
901
|
-
cursor.insLeftOf(leftNode); // left of \\left(
|
|
902
|
-
cursor.select();
|
|
903
|
-
cursor.endSelection();
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
875
|
function handleBackspaceInsideParens(mathField, cursor) {
|
|
907
876
|
// Handle situations when the cursor is inside parens or a
|
|
908
877
|
// command that uses parens, e.g. \log() or \tan()
|
|
@@ -993,8 +962,6 @@ function handleBackspace(mathField) {
|
|
|
993
962
|
selectNode(leftNode, cursor);
|
|
994
963
|
} else if (isNthRootIndex(parent)) {
|
|
995
964
|
handleBackspaceInRootIndex(mathField, cursor);
|
|
996
|
-
} else if (leftNode.ctrlSeq === "\\left(") {
|
|
997
|
-
handleBackspaceOutsideParens(cursor);
|
|
998
965
|
} else if (grandparent.ctrlSeq === "\\left(") {
|
|
999
966
|
handleBackspaceInsideParens(mathField, cursor);
|
|
1000
967
|
} else if (isInsideLogIndex(cursor)) {
|
|
@@ -6021,34 +5988,10 @@ const keypadElementPropType = PropTypes__default["default"].shape({
|
|
|
6021
5988
|
getDOMNode: PropTypes__default["default"].func.isRequired
|
|
6022
5989
|
});
|
|
6023
5990
|
|
|
6024
|
-
const KeyArray = ["PLUS", "MINUS", "NEGATIVE", "TIMES", "DIVIDE", "DECIMAL", "PERIOD", "PERCENT", "CDOT", "EQUAL", "NEQ", "GT", "LT", "GEQ", "LEQ",
|
|
6025
|
-
// mobile native only
|
|
6026
|
-
"FRAC_INCLUSIVE",
|
|
6027
|
-
// mobile native only
|
|
6028
|
-
"FRAC_EXCLUSIVE",
|
|
6029
|
-
// mobile native only
|
|
6030
|
-
"FRAC", "EXP", "EXP_2", "EXP_3", "SQRT", "CUBE_ROOT", "RADICAL", "LEFT_PAREN", "RIGHT_PAREN", "LN", "LOG", "LOG_N", "SIN", "COS",
|
|
6031
|
-
// TODO(charlie): Add in additional Greek letters.,
|
|
6032
|
-
"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",
|
|
6033
|
-
// Multi-functional keys.
|
|
6034
|
-
"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"];
|
|
6035
|
-
|
|
6036
|
-
/**
|
|
6037
|
-
* Constants that are shared between multiple files.
|
|
6038
|
-
*/
|
|
6039
|
-
|
|
6040
|
-
let KeypadType = /*#__PURE__*/function (KeypadType) {
|
|
6041
|
-
KeypadType["FRACTION"] = "FRACTION";
|
|
6042
|
-
KeypadType["EXPRESSION"] = "EXPRESSION";
|
|
6043
|
-
return KeypadType;
|
|
6044
|
-
}({});
|
|
6045
|
-
|
|
6046
5991
|
exports.CursorContext = CursorContext;
|
|
6047
5992
|
exports.DesktopKeypad = Keypad;
|
|
6048
|
-
exports.KeyArray = KeyArray;
|
|
6049
5993
|
exports.KeyConfigs = KeyConfigs;
|
|
6050
5994
|
exports.KeypadInput = MathInput;
|
|
6051
|
-
exports.KeypadType = KeypadType;
|
|
6052
5995
|
exports.MathInputI18nContext = MathInputI18nContext;
|
|
6053
5996
|
exports.MathInputI18nContextProvider = MathInputI18nContextProvider;
|
|
6054
5997
|
exports.MobileKeypad = MobileKeypad;
|