@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @khanacademy/math-input
|
|
2
2
|
|
|
3
|
+
## 14.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 5bcf118c: Desktop Expression Widget now uses v2 keypad
|
|
8
|
+
|
|
9
|
+
## 14.0.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 4f8afadd: Fix provided-keypad so that it doesn't re-render unnecessarily.
|
|
14
|
+
- 7d8905b6: Removes "grid" role from keypad to un-muddle screen reader experience.
|
|
15
|
+
- 55d4cd00: Print package name and version when loaded in the page
|
|
16
|
+
- Updated dependencies [55d4cd00]
|
|
17
|
+
- @khanacademy/perseus-core@1.1.1
|
|
18
|
+
|
|
3
19
|
## 14.0.0
|
|
4
20
|
|
|
5
21
|
### Major Changes
|
|
@@ -21,6 +21,8 @@ declare class ProvidedKeypad extends React.Component<Props> implements KeypadAPI
|
|
|
21
21
|
setCursor: (cursor: Cursor) => void;
|
|
22
22
|
setKeyHandler: (keyHandler: KeyHandler) => void;
|
|
23
23
|
getDOMNode: () => ReturnType<typeof ReactDOM.findDOMNode>;
|
|
24
|
+
onElementMounted: (element: any) => void;
|
|
25
|
+
onDismiss: () => void;
|
|
24
26
|
render(): React.ReactNode;
|
|
25
27
|
}
|
|
26
28
|
export default ProvidedKeypad;
|
package/dist/data/keys.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
export declare const KeyArray: readonly ["PLUS", "MINUS", "NEGATIVE", "TIMES", "DIVIDE", "DECIMAL", "PERIOD", "PERCENT", "CDOT", "EQUAL", "NEQ", "GT", "LT", "GEQ", "LEQ", "FRAC_INCLUSIVE", "FRAC_EXCLUSIVE", "FRAC", "EXP", "EXP_2", "EXP_3", "SQRT", "CUBE_ROOT", "RADICAL", "LEFT_PAREN", "RIGHT_PAREN", "LN", "LOG", "LOG_N", "SIN", "COS", "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", "NOOP", "MANY", "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", "PHI", "NTHROOT3", "POW", "LOG_B"];
|
|
2
|
+
type Key = typeof KeyArray[number];
|
|
2
3
|
export default Key;
|
package/dist/es/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { addLibraryVersionToPerseusDebug } from '@khanacademy/perseus-core';
|
|
1
2
|
import Color from '@khanacademy/wonder-blocks-color';
|
|
2
3
|
import * as i18n from '@khanacademy/wonder-blocks-i18n';
|
|
3
4
|
import { getDecimalSeparator } from '@khanacademy/wonder-blocks-i18n';
|
|
@@ -16,6 +17,11 @@ import PropTypes from 'prop-types';
|
|
|
16
17
|
import { TransitionGroup, CSSTransition } from 'react-transition-group';
|
|
17
18
|
import * as Redux from 'redux';
|
|
18
19
|
|
|
20
|
+
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
21
|
+
const libName = "@khanacademy/math-input";
|
|
22
|
+
const libVersion = "14.1.0";
|
|
23
|
+
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
24
|
+
|
|
19
25
|
function _extends() {
|
|
20
26
|
_extends = Object.assign || function (target) {
|
|
21
27
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -5023,7 +5029,6 @@ function Keypad$2(props) {
|
|
|
5023
5029
|
style: styles$d.keypadInnerContainer
|
|
5024
5030
|
}, /*#__PURE__*/React.createElement(View$1, {
|
|
5025
5031
|
style: [styles$d.keypadGrid, gridStyle],
|
|
5026
|
-
role: "grid",
|
|
5027
5032
|
tabIndex: 0,
|
|
5028
5033
|
"aria-label": "Keypad"
|
|
5029
5034
|
}, selectedPage === "Fractions" && /*#__PURE__*/React.createElement(FractionsPage, {
|
|
@@ -9741,6 +9746,37 @@ class ProvidedKeypad extends React.Component {
|
|
|
9741
9746
|
this.getDOMNode = () => {
|
|
9742
9747
|
return ReactDOM.findDOMNode(this);
|
|
9743
9748
|
};
|
|
9749
|
+
this.onElementMounted = element => {
|
|
9750
|
+
var _this$props$onElement, _this$props;
|
|
9751
|
+
this.props.onAnalyticsEvent({
|
|
9752
|
+
type: "math-input:keypad-opened",
|
|
9753
|
+
payload: {
|
|
9754
|
+
virtualKeypadVersion: "MATH_INPUT_KEYPAD_V1"
|
|
9755
|
+
}
|
|
9756
|
+
});
|
|
9757
|
+
|
|
9758
|
+
// Append the dispatch methods that we want to expose
|
|
9759
|
+
// externally to the returned React element.
|
|
9760
|
+
const elementWithDispatchMethods = _extends({}, element, {
|
|
9761
|
+
activate: this.activate,
|
|
9762
|
+
dismiss: this.dismiss,
|
|
9763
|
+
configure: this.configure,
|
|
9764
|
+
setCursor: this.setCursor,
|
|
9765
|
+
setKeyHandler: this.setKeyHandler,
|
|
9766
|
+
getDOMNode: this.getDOMNode
|
|
9767
|
+
});
|
|
9768
|
+
(_this$props$onElement = (_this$props = this.props).onElementMounted) == null ? void 0 : _this$props$onElement.call(_this$props, elementWithDispatchMethods);
|
|
9769
|
+
};
|
|
9770
|
+
this.onDismiss = () => {
|
|
9771
|
+
var _this$props$onDismiss, _this$props2;
|
|
9772
|
+
this.props.onAnalyticsEvent({
|
|
9773
|
+
type: "math-input:keypad-closed",
|
|
9774
|
+
payload: {
|
|
9775
|
+
virtualKeypadVersion: "MATH_INPUT_KEYPAD_V1"
|
|
9776
|
+
}
|
|
9777
|
+
});
|
|
9778
|
+
(_this$props$onDismiss = (_this$props2 = this.props).onDismiss) == null ? void 0 : _this$props$onDismiss.call(_this$props2);
|
|
9779
|
+
};
|
|
9744
9780
|
this.store = createStore();
|
|
9745
9781
|
}
|
|
9746
9782
|
componentDidUpdate(prevProps) {
|
|
@@ -9753,42 +9789,13 @@ class ProvidedKeypad extends React.Component {
|
|
|
9753
9789
|
}
|
|
9754
9790
|
render() {
|
|
9755
9791
|
const {
|
|
9756
|
-
onElementMounted,
|
|
9757
|
-
onDismiss,
|
|
9758
9792
|
style
|
|
9759
9793
|
} = this.props;
|
|
9760
9794
|
return /*#__PURE__*/React.createElement(Provider, {
|
|
9761
9795
|
store: this.store
|
|
9762
9796
|
}, /*#__PURE__*/React.createElement(KeypadContainer$1, {
|
|
9763
|
-
onElementMounted:
|
|
9764
|
-
|
|
9765
|
-
type: "math-input:keypad-opened",
|
|
9766
|
-
payload: {
|
|
9767
|
-
virtualKeypadVersion: "MATH_INPUT_KEYPAD_V1"
|
|
9768
|
-
}
|
|
9769
|
-
});
|
|
9770
|
-
|
|
9771
|
-
// Append the dispatch methods that we want to expose
|
|
9772
|
-
// externally to the returned React element.
|
|
9773
|
-
const elementWithDispatchMethods = _extends({}, element, {
|
|
9774
|
-
activate: this.activate,
|
|
9775
|
-
dismiss: this.dismiss,
|
|
9776
|
-
configure: this.configure,
|
|
9777
|
-
setCursor: this.setCursor,
|
|
9778
|
-
setKeyHandler: this.setKeyHandler,
|
|
9779
|
-
getDOMNode: this.getDOMNode
|
|
9780
|
-
});
|
|
9781
|
-
onElementMounted == null ? void 0 : onElementMounted(elementWithDispatchMethods);
|
|
9782
|
-
},
|
|
9783
|
-
onDismiss: () => {
|
|
9784
|
-
this.props.onAnalyticsEvent({
|
|
9785
|
-
type: "math-input:keypad-closed",
|
|
9786
|
-
payload: {
|
|
9787
|
-
virtualKeypadVersion: "MATH_INPUT_KEYPAD_V1"
|
|
9788
|
-
}
|
|
9789
|
-
});
|
|
9790
|
-
onDismiss == null ? void 0 : onDismiss();
|
|
9791
|
-
},
|
|
9797
|
+
onElementMounted: this.onElementMounted,
|
|
9798
|
+
onDismiss: this.onDismiss,
|
|
9792
9799
|
style: style
|
|
9793
9800
|
}));
|
|
9794
9801
|
}
|
|
@@ -9831,5 +9838,24 @@ const keypadElementPropType = PropTypes.shape({
|
|
|
9831
9838
|
getDOMNode: PropTypes.func.isRequired
|
|
9832
9839
|
});
|
|
9833
9840
|
|
|
9834
|
-
|
|
9841
|
+
const KeyArray = ["PLUS", "MINUS", "NEGATIVE", "TIMES", "DIVIDE", "DECIMAL", "PERIOD", "PERCENT", "CDOT", "EQUAL", "NEQ", "GT", "LT", "GEQ", "LEQ",
|
|
9842
|
+
// mobile native only
|
|
9843
|
+
"FRAC_INCLUSIVE",
|
|
9844
|
+
// mobile native only
|
|
9845
|
+
"FRAC_EXCLUSIVE",
|
|
9846
|
+
// mobile native only
|
|
9847
|
+
"FRAC", "EXP", "EXP_2", "EXP_3", "SQRT", "CUBE_ROOT", "RADICAL", "LEFT_PAREN", "RIGHT_PAREN", "LN", "LOG", "LOG_N", "SIN", "COS",
|
|
9848
|
+
// TODO(charlie): Add in additional Greek letters.,
|
|
9849
|
+
"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",
|
|
9850
|
+
// Multi-functional keys.
|
|
9851
|
+
"NOOP",
|
|
9852
|
+
// mobile native only
|
|
9853
|
+
"MANY",
|
|
9854
|
+
// A custom key that captures an arbitrary number of symbols but has no 'default' symbol or action.
|
|
9855
|
+
"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",
|
|
9856
|
+
// Currently only used by
|
|
9857
|
+
// Perseus' Expression MathInput
|
|
9858
|
+
"PHI", "NTHROOT3", "POW", "LOG_B"];
|
|
9859
|
+
|
|
9860
|
+
export { CursorContext, Keypad$2 as DesktopKeypad, KeyArray, KeyConfigs, KeypadContext, MathInput as KeypadInput, KeypadType, KeypadSwitch as MobileKeypad, StatefulKeypadContextProvider, createMathField, getCursorContext, keyToMathquillMap as keyTranslator, keypadElementPropType, libVersion, mathQuillInstance };
|
|
9835
9861
|
//# sourceMappingURL=index.js.map
|