@khanacademy/math-input 3.0.0 → 4.0.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 +35 -0
- package/dist/components/input/__tests__/test-math-wrapper.d.ts +1 -1
- package/dist/components/input/__tests__/test-math-wrapper.js.flow +1 -1
- package/dist/components/input/key-handlers/handle-arrow.d.ts +3 -0
- package/dist/components/input/key-handlers/handle-arrow.js.flow +12 -0
- package/dist/components/input/key-handlers/handle-backspace.d.ts +7 -0
- package/dist/components/input/key-handlers/handle-backspace.js.flow +14 -0
- package/dist/components/input/key-handlers/handle-exponent.d.ts +3 -0
- package/dist/components/input/key-handlers/handle-exponent.js.flow +12 -0
- package/dist/components/input/key-handlers/handle-jump-out.d.ts +7 -0
- package/dist/components/input/key-handlers/handle-jump-out.js.flow +14 -0
- package/dist/components/input/math-wrapper.d.ts +7 -78
- package/dist/components/input/math-wrapper.js.flow +16 -78
- package/dist/components/input/mathquill-helpers.d.ts +46 -0
- package/dist/components/input/mathquill-helpers.js.flow +56 -0
- package/dist/components/input/mathquill-instance.d.ts +3 -0
- package/dist/components/input/mathquill-instance.js.flow +9 -0
- package/dist/components/input/mathquill-types.d.ts +25 -0
- package/dist/components/input/mathquill-types.js.flow +34 -0
- package/dist/components/key-translator.d.ts +4 -0
- package/dist/components/key-translator.js.flow +10 -0
- package/dist/components/keypad/button-assets.d.ts +2 -2
- package/dist/components/keypad/button-assets.js.flow +2 -2
- package/dist/components/keypad/keypad-page-items.d.ts +1 -1
- package/dist/components/keypad/keypad-page-items.js.flow +1 -1
- package/dist/components/keypad-legacy/gesture-manager.d.ts +21 -9
- package/dist/components/keypad-legacy/gesture-manager.js.flow +27 -12
- package/dist/components/keypad-legacy/gesture-state-machine.d.ts +9 -9
- package/dist/components/keypad-legacy/gesture-state-machine.js.flow +10 -10
- package/dist/components/keypad-legacy/keypad-button.d.ts +2 -2
- package/dist/components/keypad-legacy/keypad-button.js.flow +3 -3
- package/dist/components/keypad-legacy/store/actions.d.ts +4 -14
- package/dist/components/keypad-legacy/store/actions.js.flow +3 -15
- package/dist/components/keypad-legacy/store/types.d.ts +2 -2
- package/dist/components/keypad-legacy/store/types.js.flow +2 -2
- package/dist/components/keypad-legacy/touchable-keypad-button.d.ts +6 -6
- package/dist/components/keypad-legacy/touchable-keypad-button.js.flow +9 -14
- package/dist/data/key-configs.d.ts +3 -6
- package/dist/data/key-configs.js.flow +3 -8
- package/dist/data/keys.d.ts +2 -54
- package/dist/data/keys.js.flow +116 -55
- package/dist/enums.d.ts +2 -9
- package/dist/enums.js.flow +2 -11
- package/dist/es/index.js +1781 -1196
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2069 -1242
- package/dist/index.js.flow +4 -2
- package/dist/index.js.map +1 -1
- package/dist/strings.js +26 -10
- package/dist/types.d.ts +10 -12
- package/dist/types.js.flow +13 -12
- package/package.json +1 -1
- package/src/components/input/__tests__/context-tracking.test.ts +43 -44
- package/src/components/input/__tests__/mathquill.test.ts +133 -135
- package/src/components/input/key-handlers/handle-arrow.ts +70 -0
- package/src/components/input/key-handlers/handle-backspace.ts +275 -0
- package/src/components/input/key-handlers/handle-exponent.ts +52 -0
- package/src/components/input/key-handlers/handle-jump-out.ts +103 -0
- package/src/components/input/math-input.tsx +11 -12
- package/src/components/input/math-wrapper.ts +88 -837
- package/src/components/input/mathquill-helpers.ts +268 -0
- package/src/components/input/mathquill-instance.ts +5 -0
- package/src/components/input/mathquill-types.ts +55 -0
- package/src/components/key-translator.ts +209 -0
- package/src/components/keypad/button-assets.tsx +411 -100
- package/src/components/keypad/geometry-page/index.tsx +1 -1
- package/src/components/keypad/keypad-mathquill.stories.tsx +69 -0
- package/src/components/keypad/keypad-page-items.tsx +2 -1
- package/src/components/keypad/operators-page/index.tsx +1 -1
- package/src/components/keypad-legacy/echo-manager.tsx +4 -4
- package/src/components/keypad-legacy/empty-keypad-button.tsx +6 -4
- package/src/components/keypad-legacy/gesture-manager.ts +32 -9
- package/src/components/keypad-legacy/gesture-state-machine.ts +14 -14
- package/src/components/keypad-legacy/keypad-button.tsx +15 -18
- package/src/components/keypad-legacy/many-keypad-button.tsx +9 -2
- package/src/components/keypad-legacy/store/actions.ts +3 -29
- package/src/components/keypad-legacy/store/echo-reducer.ts +2 -5
- package/src/components/keypad-legacy/store/index.ts +4 -10
- package/src/components/keypad-legacy/store/input-reducer.ts +1 -2
- package/src/components/keypad-legacy/store/keypad-reducer.ts +2 -3
- package/src/components/keypad-legacy/store/types.ts +2 -2
- package/src/components/keypad-legacy/touchable-keypad-button.tsx +8 -13
- package/src/components/tabbar/icons.tsx +0 -2
- package/src/data/key-configs.ts +751 -304
- package/src/data/keys.ts +118 -65
- package/src/enums.ts +10 -9
- package/src/index.ts +3 -2
- package/src/math-input.stories.tsx +1 -1
- package/src/types.ts +10 -12
- package/tsconfig-build.tsbuildinfo +1 -1
|
@@ -10,18 +10,13 @@ import ReactDOM from "react-dom";
|
|
|
10
10
|
import {connect} from "react-redux";
|
|
11
11
|
|
|
12
12
|
import KeyConfigs from "../../data/key-configs";
|
|
13
|
-
import
|
|
13
|
+
import Key from "../../data/keys";
|
|
14
14
|
import {KeyType} from "../../enums";
|
|
15
15
|
|
|
16
16
|
import GestureManager from "./gesture-manager";
|
|
17
17
|
import KeypadButton from "./keypad-button";
|
|
18
18
|
|
|
19
|
-
import type {
|
|
20
|
-
Border,
|
|
21
|
-
IconConfig,
|
|
22
|
-
KeyConfig,
|
|
23
|
-
NonManyKeyConfig,
|
|
24
|
-
} from "../../types";
|
|
19
|
+
import type {Border, IconConfig, KeyConfig} from "../../types";
|
|
25
20
|
import type {State} from "./store/types";
|
|
26
21
|
import type {StyleType} from "@khanacademy/wonder-blocks-core";
|
|
27
22
|
|
|
@@ -38,12 +33,12 @@ interface OwnProps extends SharedProps {
|
|
|
38
33
|
interface Props extends SharedProps {
|
|
39
34
|
childKeyIds?: ReadonlyArray<string>;
|
|
40
35
|
gestureManager: GestureManager;
|
|
41
|
-
id:
|
|
36
|
+
id: Key;
|
|
42
37
|
focused: boolean;
|
|
43
38
|
popoverEnabled: boolean;
|
|
44
|
-
childKeys?: ReadonlyArray<
|
|
39
|
+
childKeys?: ReadonlyArray<KeyConfig>;
|
|
45
40
|
ariaLabel?: string;
|
|
46
|
-
icon
|
|
41
|
+
icon?: IconConfig;
|
|
47
42
|
type: KeyType;
|
|
48
43
|
}
|
|
49
44
|
|
|
@@ -116,7 +111,7 @@ class TouchableKeypadButton extends React.Component<Props> {
|
|
|
116
111
|
}
|
|
117
112
|
}
|
|
118
113
|
|
|
119
|
-
const extractProps = (keyConfig:
|
|
114
|
+
const extractProps = (keyConfig: KeyConfig) => {
|
|
120
115
|
const {ariaLabel, icon, type} = keyConfig;
|
|
121
116
|
return {ariaLabel, icon, type};
|
|
122
117
|
};
|
|
@@ -130,14 +125,14 @@ const mapStateToProps = (state: State, ownProps: OwnProps): Props => {
|
|
|
130
125
|
const childKeyIds =
|
|
131
126
|
"childKeyIds" in keyConfig ? keyConfig.childKeyIds : undefined;
|
|
132
127
|
|
|
133
|
-
const childKeys = childKeyIds
|
|
128
|
+
const childKeys: readonly KeyConfig[] | undefined = childKeyIds
|
|
134
129
|
? childKeyIds.map((id) => KeyConfigs[id])
|
|
135
130
|
: undefined;
|
|
136
131
|
|
|
137
132
|
// Override with the default child props, if the key is a multi-symbol key
|
|
138
133
|
// (but not a many-symbol key, which operates under different rules).
|
|
139
134
|
const useFirstChildProps =
|
|
140
|
-
type !==
|
|
135
|
+
type !== "MANY" && childKeys && childKeys.length > 0;
|
|
141
136
|
|
|
142
137
|
return {
|
|
143
138
|
...rest,
|