@khanacademy/math-input 2.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 +55 -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-input.d.ts +1 -1
- package/dist/components/input/math-input.js.flow +1 -1
- 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/button.d.ts +1 -2
- package/dist/components/keypad/button.js.flow +1 -1
- package/dist/components/keypad/{pre-algebra-page.d.ts → geometry-page/index.d.ts} +1 -1
- package/dist/components/keypad/{pre-algebra-page.js.flow → geometry-page/index.js.flow} +1 -1
- package/dist/components/keypad/index.d.ts +5 -4
- package/dist/components/keypad/index.js.flow +9 -4
- package/dist/components/keypad/keypad-page-items.d.ts +9 -3
- package/dist/components/keypad/keypad-page-items.js.flow +9 -3
- package/dist/components/keypad/{numeric-input-page.d.ts → numbers-page/index.d.ts} +3 -2
- package/dist/components/keypad/numbers-page/index.js.flow +17 -0
- package/dist/components/keypad/numbers-page/types.d.ts +4 -0
- package/dist/components/keypad/numbers-page/types.js.flow +10 -0
- package/dist/components/keypad/operators-page/advanced-relations-buttons.d.ts +7 -0
- package/dist/components/keypad/{numeric-input-page.js.flow → operators-page/advanced-relations-buttons.js.flow} +3 -4
- package/dist/components/keypad/operators-page/basic-relations-buttons.d.ts +7 -0
- package/dist/components/keypad/{trigonometry-page.js.flow → operators-page/basic-relations-buttons.js.flow} +3 -6
- package/dist/components/keypad/operators-page/index.d.ts +9 -0
- package/dist/components/keypad/operators-page/index.js.flow +17 -0
- package/dist/components/keypad/operators-page/logarithms-buttons.d.ts +7 -0
- package/dist/components/keypad/operators-page/logarithms-buttons.js.flow +12 -0
- package/dist/components/keypad/operators-page/pre-algebra-buttons.d.ts +7 -0
- package/dist/components/keypad/operators-page/pre-algebra-buttons.js.flow +12 -0
- package/dist/components/keypad/operators-page/types.d.ts +6 -0
- package/dist/components/keypad/operators-page/types.js.flow +12 -0
- package/dist/components/{compute-layout-parameters.d.ts → keypad-legacy/compute-layout-parameters.d.ts} +1 -1
- package/dist/components/{compute-layout-parameters.js.flow → keypad-legacy/compute-layout-parameters.js.flow} +1 -1
- package/dist/components/{echo-manager.d.ts → keypad-legacy/echo-manager.d.ts} +2 -11
- package/dist/components/{echo-manager.js.flow → keypad-legacy/echo-manager.js.flow} +2 -11
- package/dist/components/{expression-keypad.d.ts → keypad-legacy/expression-keypad.d.ts} +3 -4
- package/dist/components/{expression-keypad.js.flow → keypad-legacy/expression-keypad.js.flow} +3 -4
- package/dist/components/{fraction-keypad.d.ts → keypad-legacy/fraction-keypad.d.ts} +2 -2
- package/dist/components/{fraction-keypad.js.flow → keypad-legacy/fraction-keypad.js.flow} +2 -2
- package/dist/components/{gesture-manager.d.ts → keypad-legacy/gesture-manager.d.ts} +22 -10
- package/dist/components/{gesture-manager.js.flow → keypad-legacy/gesture-manager.js.flow} +28 -13
- package/dist/components/{gesture-state-machine.d.ts → keypad-legacy/gesture-state-machine.d.ts} +9 -9
- package/dist/components/{gesture-state-machine.js.flow → keypad-legacy/gesture-state-machine.js.flow} +10 -10
- package/dist/components/{icon.d.ts → keypad-legacy/icon.d.ts} +1 -1
- package/dist/components/{icon.js.flow → keypad-legacy/icon.js.flow} +1 -1
- package/dist/components/{keypad-button.d.ts → keypad-legacy/keypad-button.d.ts} +6 -6
- package/dist/components/{keypad-button.js.flow → keypad-legacy/keypad-button.js.flow} +7 -7
- package/dist/components/{keypad-container.d.ts → keypad-legacy/keypad-container.d.ts} +2 -2
- package/dist/components/{keypad-container.js.flow → keypad-legacy/keypad-container.js.flow} +3 -3
- package/dist/components/{keypad.d.ts → keypad-legacy/keypad.d.ts} +3 -3
- package/dist/components/{keypad.js.flow → keypad-legacy/keypad.js.flow} +3 -3
- package/dist/components/{multi-symbol-grid.d.ts → keypad-legacy/multi-symbol-grid.d.ts} +1 -1
- package/dist/components/{multi-symbol-grid.js.flow → keypad-legacy/multi-symbol-grid.js.flow} +1 -1
- package/dist/components/{multi-symbol-popover.d.ts → keypad-legacy/multi-symbol-popover.d.ts} +1 -1
- package/dist/components/{multi-symbol-popover.js.flow → keypad-legacy/multi-symbol-popover.js.flow} +1 -1
- package/dist/components/{node-manager.d.ts → keypad-legacy/node-manager.d.ts} +3 -4
- package/dist/components/{node-manager.js.flow → keypad-legacy/node-manager.js.flow} +3 -5
- package/dist/components/{popover-manager.d.ts → keypad-legacy/popover-manager.d.ts} +1 -1
- package/dist/components/{popover-manager.js.flow → keypad-legacy/popover-manager.js.flow} +1 -1
- package/dist/components/{popover-state-machine.d.ts → keypad-legacy/popover-state-machine.d.ts} +1 -1
- package/dist/components/{popover-state-machine.js.flow → keypad-legacy/popover-state-machine.js.flow} +1 -1
- package/dist/components/{provided-keypad.d.ts → keypad-legacy/provided-keypad.d.ts} +1 -1
- package/dist/components/{provided-keypad.js.flow → keypad-legacy/provided-keypad.js.flow} +1 -1
- package/dist/{store → components/keypad-legacy/store}/actions.d.ts +6 -17
- package/dist/{store → components/keypad-legacy/store}/actions.js.flow +7 -22
- package/dist/{store → components/keypad-legacy/store}/index.d.ts +0 -1
- package/dist/{store → components/keypad-legacy/store}/index.js.flow +0 -1
- package/dist/components/keypad-legacy/store/shared.d.ts +7 -0
- package/dist/components/keypad-legacy/store/shared.js.flow +14 -0
- package/dist/{store → components/keypad-legacy/store}/types.d.ts +5 -15
- package/dist/{store → components/keypad-legacy/store}/types.js.flow +5 -15
- package/dist/components/keypad-legacy/touchable-keypad-button.d.ts +37 -0
- package/dist/components/keypad-legacy/touchable-keypad-button.js.flow +59 -0
- package/dist/components/{two-page-keypad.d.ts → keypad-legacy/two-page-keypad.d.ts} +0 -1
- package/dist/components/{two-page-keypad.js.flow → keypad-legacy/two-page-keypad.js.flow} +0 -1
- package/dist/data/key-configs.d.ts +4 -5
- package/dist/data/key-configs.js.flow +3 -6
- package/dist/data/keys.d.ts +2 -56
- package/dist/data/keys.js.flow +116 -57
- package/dist/enums.d.ts +2 -9
- package/dist/enums.js.flow +2 -11
- package/dist/es/index.js +6393 -5116
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.js +6868 -5330
- package/dist/index.js.flow +6 -3
- package/dist/index.js.map +1 -1
- package/dist/strings.js +26 -10
- package/dist/types.d.ts +19 -17
- package/dist/types.js.flow +28 -23
- 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 +12 -13
- 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 +452 -116
- package/src/components/keypad/button.stories.tsx +61 -13
- package/src/components/keypad/button.tsx +1 -1
- package/src/components/keypad/{trigonometry-page.tsx → geometry-page/index.tsx} +4 -5
- package/src/components/keypad/index.tsx +19 -14
- package/src/components/keypad/keypad-mathquill.stories.tsx +69 -0
- package/src/components/keypad/keypad-page-items.tsx +36 -22
- package/src/components/keypad/keypad-pages.stories.tsx +5 -5
- package/src/components/keypad/keypad.stories.tsx +75 -17
- package/src/components/keypad/{numeric-input-page.tsx → numbers-page/index.tsx} +47 -11
- package/src/components/keypad/numbers-page/types.ts +4 -0
- package/src/components/keypad/operators-page/advanced-relations-buttons.tsx +32 -0
- package/src/components/keypad/operators-page/basic-relations-buttons.tsx +32 -0
- package/src/components/keypad/{pre-algebra-page.tsx → operators-page/index.tsx} +26 -30
- package/src/components/keypad/operators-page/logarithms-buttons.tsx +32 -0
- package/src/components/keypad/operators-page/pre-algebra-buttons.tsx +36 -0
- package/src/components/keypad/operators-page/types.ts +6 -0
- package/src/components/{__tests__ → keypad-legacy/__tests__}/two-page-keypad.test.tsx +0 -2
- package/src/components/{compute-layout-parameters.ts → keypad-legacy/compute-layout-parameters.ts} +2 -3
- package/src/components/{corner-decal.tsx → keypad-legacy/corner-decal.tsx} +2 -3
- package/src/components/{echo-manager.tsx → keypad-legacy/echo-manager.tsx} +8 -21
- package/src/components/{empty-keypad-button.tsx → keypad-legacy/empty-keypad-button.tsx} +8 -6
- package/src/components/{expression-keypad.tsx → keypad-legacy/expression-keypad.tsx} +8 -17
- package/src/components/{fraction-keypad.tsx → keypad-legacy/fraction-keypad.tsx} +6 -6
- package/src/components/{gesture-manager.ts → keypad-legacy/gesture-manager.ts} +34 -11
- package/src/components/{gesture-state-machine.ts → keypad-legacy/gesture-state-machine.ts} +14 -14
- package/src/components/{icon.tsx → keypad-legacy/icon.tsx} +3 -3
- package/src/components/{keypad-button.tsx → keypad-legacy/keypad-button.tsx} +26 -26
- package/src/components/{keypad-container.tsx → keypad-legacy/keypad-container.tsx} +6 -6
- package/src/components/{keypad.tsx → keypad-legacy/keypad.tsx} +5 -5
- package/src/components/{many-keypad-button.tsx → keypad-legacy/many-keypad-button.tsx} +13 -6
- package/src/components/{math-icon.tsx → keypad-legacy/math-icon.tsx} +2 -2
- package/src/components/{multi-symbol-grid.tsx → keypad-legacy/multi-symbol-grid.tsx} +4 -4
- package/src/components/{multi-symbol-popover.tsx → keypad-legacy/multi-symbol-popover.tsx} +3 -4
- package/src/components/{navigation-pad.tsx → keypad-legacy/navigation-pad.tsx} +5 -5
- package/src/components/{node-manager.ts → keypad-legacy/node-manager.ts} +2 -10
- package/src/components/{popover-manager.tsx → keypad-legacy/popover-manager.tsx} +2 -2
- package/src/components/{popover-state-machine.ts → keypad-legacy/popover-state-machine.ts} +1 -1
- package/src/components/{provided-keypad.tsx → keypad-legacy/provided-keypad.tsx} +4 -5
- package/src/{store → components/keypad-legacy/store}/actions.ts +7 -36
- package/src/{store → components/keypad-legacy/store}/echo-reducer.ts +3 -7
- package/src/{store → components/keypad-legacy/store}/index.ts +7 -20
- package/src/{store → components/keypad-legacy/store}/input-reducer.ts +4 -5
- package/src/{store → components/keypad-legacy/store}/keypad-reducer.ts +3 -4
- package/src/{store → components/keypad-legacy/store}/layout-reducer.ts +3 -3
- package/src/{store → components/keypad-legacy/store}/shared.ts +3 -3
- package/src/{store → components/keypad-legacy/store}/types.ts +15 -19
- package/src/components/{styles.ts → keypad-legacy/styles.ts} +1 -1
- package/src/components/{text-icon.tsx → keypad-legacy/text-icon.tsx} +2 -2
- package/src/components/{touchable-keypad-button.tsx → keypad-legacy/touchable-keypad-button.tsx} +35 -21
- package/src/components/{two-page-keypad.tsx → keypad-legacy/two-page-keypad.tsx} +5 -6
- package/src/components/tabbar/icons.tsx +0 -2
- package/src/data/key-configs.ts +751 -309
- package/src/data/keys.ts +118 -70
- package/src/enums.ts +10 -9
- package/src/index.ts +6 -3
- package/src/math-input.stories.tsx +3 -3
- package/src/types.ts +21 -16
- package/tsconfig-build.tsbuildinfo +1 -1
- package/dist/components/keypad/trigonometry-page.d.ts +0 -8
- package/dist/components/touchable-keypad-button.d.ts +0 -30
- package/dist/components/touchable-keypad-button.js.flow +0 -35
- package/dist/components/velocity-tracker.d.ts +0 -48
- package/dist/components/velocity-tracker.js.flow +0 -54
- package/dist/store/pager-reducer.d.ts +0 -4
- package/dist/store/pager-reducer.js.flow +0 -13
- package/dist/store/shared.d.ts +0 -7
- package/dist/store/shared.js.flow +0 -14
- package/src/components/velocity-tracker.ts +0 -86
- package/src/store/pager-reducer.ts +0 -125
- /package/dist/components/{corner-decal.d.ts → keypad-legacy/corner-decal.d.ts} +0 -0
- /package/dist/components/{corner-decal.js.flow → keypad-legacy/corner-decal.js.flow} +0 -0
- /package/dist/components/{empty-keypad-button.d.ts → keypad-legacy/empty-keypad-button.d.ts} +0 -0
- /package/dist/components/{empty-keypad-button.js.flow → keypad-legacy/empty-keypad-button.js.flow} +0 -0
- /package/dist/components/{many-keypad-button.d.ts → keypad-legacy/many-keypad-button.d.ts} +0 -0
- /package/dist/components/{many-keypad-button.js.flow → keypad-legacy/many-keypad-button.js.flow} +0 -0
- /package/dist/components/{math-icon.d.ts → keypad-legacy/math-icon.d.ts} +0 -0
- /package/dist/components/{math-icon.js.flow → keypad-legacy/math-icon.js.flow} +0 -0
- /package/dist/components/{navigation-pad.d.ts → keypad-legacy/navigation-pad.d.ts} +0 -0
- /package/dist/components/{navigation-pad.js.flow → keypad-legacy/navigation-pad.js.flow} +0 -0
- /package/dist/{store → components/keypad-legacy/store}/echo-reducer.d.ts +0 -0
- /package/dist/{store → components/keypad-legacy/store}/echo-reducer.js.flow +0 -0
- /package/dist/{store → components/keypad-legacy/store}/input-reducer.d.ts +0 -0
- /package/dist/{store → components/keypad-legacy/store}/input-reducer.js.flow +0 -0
- /package/dist/{store → components/keypad-legacy/store}/keypad-reducer.d.ts +0 -0
- /package/dist/{store → components/keypad-legacy/store}/keypad-reducer.js.flow +0 -0
- /package/dist/{store → components/keypad-legacy/store}/layout-reducer.d.ts +0 -0
- /package/dist/{store → components/keypad-legacy/store}/layout-reducer.js.flow +0 -0
- /package/dist/components/{styles.d.ts → keypad-legacy/styles.d.ts} +0 -0
- /package/dist/components/{styles.js.flow → keypad-legacy/styles.js.flow} +0 -0
- /package/dist/components/{svg-icon.d.ts → keypad-legacy/svg-icon.d.ts} +0 -0
- /package/dist/components/{svg-icon.js.flow → keypad-legacy/svg-icon.js.flow} +0 -0
- /package/dist/components/{text-icon.d.ts → keypad-legacy/text-icon.d.ts} +0 -0
- /package/dist/components/{text-icon.js.flow → keypad-legacy/text-icon.js.flow} +0 -0
- /package/dist/components/{z-indexes.d.ts → keypad-legacy/z-indexes.d.ts} +0 -0
- /package/dist/components/{z-indexes.js.flow → keypad-legacy/z-indexes.js.flow} +0 -0
- /package/src/components/{__tests__ → keypad-legacy/__tests__}/gesture-state-machine.test.ts +0 -0
- /package/src/components/{__tests__ → keypad-legacy/__tests__}/node-manager.test.ts +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/arrow.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/backspace.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/cdot.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/cos.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/cube-root.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/dismiss.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/divide.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/down.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/equal.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/exp-2.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/exp-3.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/exp.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/frac.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/geq.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/gt.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/index.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/jump-into-numerator.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/jump-out-base.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/jump-out-denominator.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/jump-out-exponent.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/jump-out-numerator.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/jump-out-parentheses.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/left-paren.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/left.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/leq.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/ln.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/log-n.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/log.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/lt.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/minus.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/neq.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/parens.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/percent.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/period.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/plus.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/radical.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/right-paren.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/right.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/sin.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/sqrt.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/tan.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/times.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/up.js +0 -0
- /package/src/components/{svg-icon.tsx → keypad-legacy/svg-icon.tsx} +0 -0
- /package/src/components/{z-indexes.ts → keypad-legacy/z-indexes.ts} +0 -0
package/src/data/key-configs.ts
CHANGED
|
@@ -4,47 +4,113 @@
|
|
|
4
4
|
import * as i18n from "@khanacademy/wonder-blocks-i18n";
|
|
5
5
|
|
|
6
6
|
import {DecimalSeparator, IconType, KeyType} from "../enums";
|
|
7
|
+
import {KeyConfig} from "../types";
|
|
7
8
|
import {decimalSeparator} from "../utils";
|
|
8
9
|
|
|
9
|
-
import
|
|
10
|
+
import Key from "./keys";
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
type KeyConfigMapper = (args: {
|
|
13
|
+
key: Key;
|
|
14
|
+
keyType?: KeyType;
|
|
15
|
+
iconType?: IconType;
|
|
16
|
+
ariaLabel?: string;
|
|
17
|
+
data?: string;
|
|
18
|
+
}) => KeyConfig;
|
|
19
|
+
|
|
20
|
+
const getDefaultOperatorFields: KeyConfigMapper = ({
|
|
21
|
+
key,
|
|
22
|
+
keyType = "OPERATOR",
|
|
23
|
+
iconType = IconType.SVG,
|
|
24
|
+
ariaLabel = key,
|
|
25
|
+
data = key,
|
|
26
|
+
}) => ({
|
|
27
|
+
id: key,
|
|
28
|
+
type: keyType,
|
|
29
|
+
ariaLabel,
|
|
30
|
+
icon: {
|
|
31
|
+
type: iconType,
|
|
32
|
+
data,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const getDefaultValueFields: KeyConfigMapper = ({
|
|
37
|
+
key,
|
|
38
|
+
keyType = "VALUE",
|
|
39
|
+
iconType = IconType.MATH,
|
|
40
|
+
ariaLabel = key,
|
|
41
|
+
data = key,
|
|
42
|
+
}) => ({
|
|
43
|
+
id: key,
|
|
44
|
+
type: keyType,
|
|
45
|
+
ariaLabel,
|
|
46
|
+
icon: {
|
|
47
|
+
type: iconType,
|
|
48
|
+
data,
|
|
49
|
+
},
|
|
50
|
+
});
|
|
16
51
|
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
[
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
52
|
+
const getDefaultNumberFields: KeyConfigMapper = ({
|
|
53
|
+
key,
|
|
54
|
+
data = key.replace("NUM_", ""),
|
|
55
|
+
keyType = "VALUE",
|
|
56
|
+
iconType = IconType.TEXT,
|
|
57
|
+
ariaLabel = data,
|
|
58
|
+
}) => ({
|
|
59
|
+
id: key,
|
|
60
|
+
type: keyType,
|
|
61
|
+
ariaLabel,
|
|
62
|
+
icon: {
|
|
63
|
+
type: iconType,
|
|
64
|
+
data,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const KeyConfigs: {
|
|
69
|
+
[key in Key]: KeyConfig;
|
|
70
|
+
} = {
|
|
71
|
+
// Basic math
|
|
72
|
+
PLUS: {
|
|
73
|
+
...getDefaultOperatorFields({
|
|
74
|
+
key: "PLUS",
|
|
75
|
+
// I18N: A label for a 'plus' sign.
|
|
76
|
+
ariaLabel: i18n._("Plus"),
|
|
77
|
+
}),
|
|
78
|
+
},
|
|
79
|
+
MINUS: {
|
|
80
|
+
...getDefaultOperatorFields({
|
|
81
|
+
key: "MINUS",
|
|
82
|
+
// I18N: A label for a 'minus' sign.
|
|
83
|
+
ariaLabel: i18n._("Minus"),
|
|
84
|
+
}),
|
|
85
|
+
},
|
|
86
|
+
NEGATIVE: {
|
|
87
|
+
...getDefaultOperatorFields({
|
|
88
|
+
key: "NEGATIVE",
|
|
89
|
+
// I18N: A label for a 'negative' sign.
|
|
90
|
+
ariaLabel: i18n._("Negative"),
|
|
91
|
+
}),
|
|
92
|
+
},
|
|
93
|
+
TIMES: {
|
|
94
|
+
...getDefaultOperatorFields({
|
|
95
|
+
key: "TIMES",
|
|
96
|
+
// I18N: A label for a 'multiply' sign.
|
|
97
|
+
ariaLabel: i18n._("Multiply"),
|
|
98
|
+
}),
|
|
99
|
+
},
|
|
100
|
+
DIVIDE: {
|
|
101
|
+
...getDefaultOperatorFields({
|
|
102
|
+
key: "DIVIDE",
|
|
103
|
+
// I18N: A label for a 'divide' sign.
|
|
104
|
+
ariaLabel: i18n._("Divide"),
|
|
105
|
+
}),
|
|
106
|
+
},
|
|
107
|
+
DECIMAL: {
|
|
108
|
+
...getDefaultOperatorFields({
|
|
109
|
+
key: "DECIMAL",
|
|
110
|
+
keyType: "VALUE",
|
|
111
|
+
// I18N: A label for a 'decimal' sign (represented as '.' or ',').
|
|
112
|
+
ariaLabel: i18n._("Decimal"),
|
|
113
|
+
}),
|
|
48
114
|
icon:
|
|
49
115
|
decimalSeparator === DecimalSeparator.COMMA
|
|
50
116
|
? {
|
|
@@ -55,295 +121,671 @@ const KeyConfigs: any = {
|
|
|
55
121
|
}
|
|
56
122
|
: {
|
|
57
123
|
type: IconType.SVG,
|
|
58
|
-
data:
|
|
124
|
+
data: "PERIOD",
|
|
59
125
|
},
|
|
60
126
|
},
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
127
|
+
PERIOD: {
|
|
128
|
+
...getDefaultOperatorFields({
|
|
129
|
+
key: "PERIOD",
|
|
130
|
+
keyType: "VALUE",
|
|
131
|
+
ariaLabel: ".",
|
|
132
|
+
}),
|
|
133
|
+
},
|
|
134
|
+
PERCENT: {
|
|
135
|
+
...getDefaultOperatorFields({
|
|
136
|
+
key: "PERCENT",
|
|
137
|
+
// I18N: A label for a 'percent' sign (represented as '%').
|
|
138
|
+
ariaLabel: i18n._("Percent"),
|
|
139
|
+
}),
|
|
140
|
+
},
|
|
141
|
+
CDOT: {
|
|
142
|
+
...getDefaultOperatorFields({
|
|
143
|
+
key: "CDOT",
|
|
144
|
+
// I18N: A label for a 'centered dot' multiplication sign (represented as '⋅').
|
|
145
|
+
ariaLabel: i18n._("Multiply"),
|
|
146
|
+
}),
|
|
147
|
+
},
|
|
148
|
+
EQUAL: {
|
|
149
|
+
...getDefaultOperatorFields({
|
|
150
|
+
key: "EQUAL",
|
|
151
|
+
// I18N: A label for an 'equals' sign (represented as '=').
|
|
152
|
+
ariaLabel: i18n._("Equals sign"),
|
|
153
|
+
}),
|
|
154
|
+
},
|
|
155
|
+
NEQ: {
|
|
156
|
+
...getDefaultOperatorFields({
|
|
157
|
+
key: "NEQ",
|
|
158
|
+
// I18N: A label for a 'not-equals' sign (represented as '≠').
|
|
159
|
+
ariaLabel: i18n._("Not-equals sign"),
|
|
160
|
+
}),
|
|
161
|
+
},
|
|
162
|
+
GT: {
|
|
163
|
+
...getDefaultOperatorFields({
|
|
164
|
+
key: "GT",
|
|
165
|
+
// I18N: A label for a 'greater than' sign (represented as '>').
|
|
166
|
+
ariaLabel: i18n._("Greater than sign"),
|
|
167
|
+
}),
|
|
168
|
+
},
|
|
169
|
+
LT: {
|
|
170
|
+
...getDefaultOperatorFields({
|
|
171
|
+
key: "LT",
|
|
172
|
+
// I18N: A label for a 'less than' sign (represented as '<').
|
|
173
|
+
ariaLabel: i18n._("Less than sign"),
|
|
174
|
+
}),
|
|
175
|
+
},
|
|
176
|
+
GEQ: {
|
|
177
|
+
...getDefaultOperatorFields({
|
|
178
|
+
key: "GEQ",
|
|
179
|
+
// I18N: A label for a 'greater than or equal to' sign (represented as '≥').
|
|
180
|
+
ariaLabel: i18n._("Greater than or equal to sign"),
|
|
181
|
+
}),
|
|
182
|
+
},
|
|
183
|
+
LEQ: {
|
|
184
|
+
...getDefaultOperatorFields({
|
|
185
|
+
key: "LEQ",
|
|
186
|
+
// I18N: A label for a 'less than or equal to' sign (represented as '≤').
|
|
187
|
+
ariaLabel: i18n._("Less than or equal to sign"),
|
|
188
|
+
}),
|
|
96
189
|
},
|
|
97
190
|
// mobile native
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
191
|
+
FRAC_INCLUSIVE: {
|
|
192
|
+
...getDefaultOperatorFields({
|
|
193
|
+
key: "FRAC_INCLUSIVE",
|
|
194
|
+
// I18N: A label for a button that creates a new fraction and puts the
|
|
195
|
+
// current expression in the numerator of that fraction.
|
|
196
|
+
ariaLabel: i18n._("Fraction, with current expression in numerator"),
|
|
197
|
+
}),
|
|
103
198
|
},
|
|
104
199
|
// mobile native
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
200
|
+
FRAC_EXCLUSIVE: {
|
|
201
|
+
...getDefaultOperatorFields({
|
|
202
|
+
key: "FRAC_EXCLUSIVE",
|
|
203
|
+
// I18N: A label for a button that creates a new fraction next to the
|
|
204
|
+
// cursor.
|
|
205
|
+
ariaLabel: i18n._("Fraction, excluding the current expression"),
|
|
206
|
+
}),
|
|
110
207
|
},
|
|
111
208
|
// mobile web
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
},
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
},
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
},
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
},
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
},
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
},
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
209
|
+
FRAC: {
|
|
210
|
+
...getDefaultOperatorFields({
|
|
211
|
+
key: "FRAC",
|
|
212
|
+
// I18N: A label for a button that creates a new fraction next to the
|
|
213
|
+
// cursor.
|
|
214
|
+
ariaLabel: i18n._("Fraction, excluding the current expression"),
|
|
215
|
+
}),
|
|
216
|
+
},
|
|
217
|
+
EXP: {
|
|
218
|
+
...getDefaultOperatorFields({
|
|
219
|
+
key: "EXP",
|
|
220
|
+
// I18N: A label for a button that will allow the user to input a
|
|
221
|
+
// custom exponent.
|
|
222
|
+
ariaLabel: i18n._("Custom exponent"),
|
|
223
|
+
}),
|
|
224
|
+
},
|
|
225
|
+
EXP_2: {
|
|
226
|
+
...getDefaultOperatorFields({
|
|
227
|
+
key: "EXP_2",
|
|
228
|
+
// I18N: A label for a button that will square (take to the second
|
|
229
|
+
// power) some math.
|
|
230
|
+
ariaLabel: i18n._("Square"),
|
|
231
|
+
}),
|
|
232
|
+
},
|
|
233
|
+
EXP_3: {
|
|
234
|
+
...getDefaultOperatorFields({
|
|
235
|
+
key: "EXP_3",
|
|
236
|
+
// I18N: A label for a button that will cube (take to the third power)
|
|
237
|
+
// some math.
|
|
238
|
+
ariaLabel: i18n._("Cube"),
|
|
239
|
+
}),
|
|
240
|
+
},
|
|
241
|
+
SQRT: {
|
|
242
|
+
...getDefaultOperatorFields({
|
|
243
|
+
key: "SQRT",
|
|
244
|
+
// I18N: A label for a button that will allow the user to input a
|
|
245
|
+
// square root.
|
|
246
|
+
ariaLabel: i18n._("Square root"),
|
|
247
|
+
}),
|
|
248
|
+
},
|
|
249
|
+
CUBE_ROOT: {
|
|
250
|
+
...getDefaultOperatorFields({
|
|
251
|
+
key: "CUBE_ROOT",
|
|
252
|
+
// I18N: A label for a button that will allow the user to input a
|
|
253
|
+
// cube root.
|
|
254
|
+
ariaLabel: i18n._("Cube root"),
|
|
255
|
+
}),
|
|
256
|
+
},
|
|
257
|
+
RADICAL: {
|
|
258
|
+
...getDefaultOperatorFields({
|
|
259
|
+
key: "RADICAL",
|
|
260
|
+
// I18N: A label for a button that will allow the user to input a
|
|
261
|
+
// radical with a custom root.
|
|
262
|
+
ariaLabel: i18n._("Radical with custom root"),
|
|
263
|
+
}),
|
|
264
|
+
},
|
|
265
|
+
LEFT_PAREN: {
|
|
266
|
+
...getDefaultOperatorFields({
|
|
267
|
+
key: "LEFT_PAREN",
|
|
268
|
+
// I18N: A label for a button that will allow the user to input a
|
|
269
|
+
// left parenthesis (i.e. '(')
|
|
270
|
+
ariaLabel: i18n._("Left parenthesis"),
|
|
271
|
+
}),
|
|
272
|
+
},
|
|
273
|
+
RIGHT_PAREN: {
|
|
274
|
+
...getDefaultOperatorFields({
|
|
275
|
+
key: "RIGHT_PAREN",
|
|
276
|
+
// I18N: A label for a button that will allow the user to input a
|
|
277
|
+
// right parenthesis (i.e. ')')
|
|
278
|
+
ariaLabel: i18n._("Right parenthesis"),
|
|
279
|
+
}),
|
|
280
|
+
},
|
|
281
|
+
LN: {
|
|
282
|
+
...getDefaultOperatorFields({
|
|
283
|
+
key: "LN",
|
|
284
|
+
// I18N: A label for a button that will allow the user to input a
|
|
285
|
+
// natural logarithm.
|
|
286
|
+
ariaLabel: i18n._("Natural logarithm"),
|
|
287
|
+
}),
|
|
288
|
+
},
|
|
289
|
+
LOG: {
|
|
290
|
+
...getDefaultOperatorFields({
|
|
291
|
+
key: "LOG",
|
|
292
|
+
// I18N: A label for a button that will allow the user to input a
|
|
293
|
+
// logarithm with base 10.
|
|
294
|
+
ariaLabel: i18n._("Logarithm with base 10"),
|
|
295
|
+
}),
|
|
296
|
+
},
|
|
297
|
+
LOG_N: {
|
|
298
|
+
...getDefaultOperatorFields({
|
|
299
|
+
key: "LOG_N",
|
|
300
|
+
// I18N: A label for a button that will allow the user to input a
|
|
301
|
+
// logarithm with a custom base.
|
|
302
|
+
ariaLabel: i18n._("Logarithm with custom base"),
|
|
303
|
+
}),
|
|
304
|
+
},
|
|
305
|
+
SIN: {
|
|
306
|
+
...getDefaultOperatorFields({
|
|
307
|
+
key: "SIN",
|
|
308
|
+
// I18N: A label for a button that will allow the user to input a
|
|
309
|
+
// sine function.
|
|
310
|
+
ariaLabel: i18n._("Sine"),
|
|
311
|
+
}),
|
|
312
|
+
},
|
|
313
|
+
COS: {
|
|
314
|
+
...getDefaultOperatorFields({
|
|
315
|
+
key: "COS",
|
|
316
|
+
// I18N: A label for a button that will allow the user to input a
|
|
317
|
+
// cosine function.
|
|
318
|
+
ariaLabel: i18n._("Cosine"),
|
|
319
|
+
}),
|
|
320
|
+
},
|
|
321
|
+
TAN: {
|
|
322
|
+
...getDefaultOperatorFields({
|
|
323
|
+
key: "TAN",
|
|
324
|
+
// I18N: A label for a button that will allow the user to input a
|
|
325
|
+
// tangent function.
|
|
326
|
+
ariaLabel: i18n._("Tangent"),
|
|
327
|
+
}),
|
|
328
|
+
},
|
|
329
|
+
PI: {
|
|
330
|
+
...getDefaultValueFields({
|
|
331
|
+
key: "PI",
|
|
185
332
|
data: "\\pi",
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
333
|
+
// I18N: A label for a button that will allow the user to input the
|
|
334
|
+
// mathematical constant pi (i.e., π)
|
|
335
|
+
ariaLabel: i18n._("Pi"),
|
|
336
|
+
}),
|
|
337
|
+
},
|
|
338
|
+
THETA: {
|
|
339
|
+
...getDefaultValueFields({
|
|
340
|
+
key: "THETA",
|
|
193
341
|
data: "\\theta",
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
342
|
+
// I18N: A label for a button that will allow the user to input the
|
|
343
|
+
// mathematical constant theta (i.e., θ)
|
|
344
|
+
ariaLabel: i18n._("Theta"),
|
|
345
|
+
}),
|
|
346
|
+
},
|
|
347
|
+
NOOP: {
|
|
348
|
+
...getDefaultOperatorFields({
|
|
349
|
+
key: "NOOP",
|
|
350
|
+
keyType: "EMPTY",
|
|
351
|
+
}),
|
|
352
|
+
},
|
|
353
|
+
// Input navigation
|
|
354
|
+
UP: {
|
|
355
|
+
...getDefaultOperatorFields({
|
|
356
|
+
key: "UP",
|
|
357
|
+
keyType: "INPUT_NAVIGATION",
|
|
358
|
+
ariaLabel: i18n._("Up arrow"),
|
|
359
|
+
}),
|
|
360
|
+
},
|
|
361
|
+
RIGHT: {
|
|
362
|
+
...getDefaultOperatorFields({
|
|
363
|
+
key: "RIGHT",
|
|
364
|
+
keyType: "INPUT_NAVIGATION",
|
|
365
|
+
ariaLabel: i18n._("Right arrow"),
|
|
366
|
+
}),
|
|
367
|
+
},
|
|
368
|
+
DOWN: {
|
|
369
|
+
...getDefaultOperatorFields({
|
|
370
|
+
key: "DOWN",
|
|
371
|
+
keyType: "INPUT_NAVIGATION",
|
|
372
|
+
ariaLabel: i18n._("Down arrow"),
|
|
373
|
+
}),
|
|
374
|
+
},
|
|
375
|
+
LEFT: {
|
|
376
|
+
...getDefaultOperatorFields({
|
|
377
|
+
key: "LEFT",
|
|
378
|
+
keyType: "INPUT_NAVIGATION",
|
|
379
|
+
ariaLabel: i18n._("Left arrow"),
|
|
380
|
+
}),
|
|
381
|
+
},
|
|
382
|
+
JUMP_OUT_PARENTHESES: {
|
|
383
|
+
...getDefaultOperatorFields({
|
|
384
|
+
key: "JUMP_OUT_PARENTHESES",
|
|
385
|
+
keyType: "INPUT_NAVIGATION",
|
|
386
|
+
ariaLabel: i18n._("Navigate right out of a set of parentheses"),
|
|
387
|
+
}),
|
|
388
|
+
},
|
|
389
|
+
JUMP_OUT_EXPONENT: {
|
|
390
|
+
...getDefaultOperatorFields({
|
|
391
|
+
key: "JUMP_OUT_EXPONENT",
|
|
392
|
+
keyType: "INPUT_NAVIGATION",
|
|
393
|
+
ariaLabel: i18n._("Navigate right out of an exponent"),
|
|
394
|
+
}),
|
|
395
|
+
},
|
|
396
|
+
JUMP_OUT_BASE: {
|
|
397
|
+
...getDefaultOperatorFields({
|
|
398
|
+
key: "JUMP_OUT_BASE",
|
|
399
|
+
keyType: "INPUT_NAVIGATION",
|
|
400
|
+
ariaLabel: i18n._("Navigate right out of a base"),
|
|
401
|
+
}),
|
|
402
|
+
},
|
|
403
|
+
JUMP_INTO_NUMERATOR: {
|
|
404
|
+
...getDefaultOperatorFields({
|
|
405
|
+
key: "JUMP_INTO_NUMERATOR",
|
|
406
|
+
keyType: "INPUT_NAVIGATION",
|
|
407
|
+
ariaLabel: i18n._(
|
|
408
|
+
"Navigate right into the numerator of a fraction",
|
|
409
|
+
),
|
|
410
|
+
}),
|
|
411
|
+
},
|
|
412
|
+
JUMP_OUT_NUMERATOR: {
|
|
413
|
+
...getDefaultOperatorFields({
|
|
414
|
+
key: "JUMP_OUT_NUMERATOR",
|
|
415
|
+
keyType: "INPUT_NAVIGATION",
|
|
416
|
+
ariaLabel: i18n._(
|
|
417
|
+
"Navigate right out of the numerator and into the denominator",
|
|
418
|
+
),
|
|
419
|
+
}),
|
|
420
|
+
},
|
|
421
|
+
JUMP_OUT_DENOMINATOR: {
|
|
422
|
+
...getDefaultOperatorFields({
|
|
423
|
+
key: "JUMP_OUT_DENOMINATOR",
|
|
424
|
+
keyType: "INPUT_NAVIGATION",
|
|
425
|
+
ariaLabel: i18n._(
|
|
426
|
+
"Navigate right out of the denominator of a fraction",
|
|
427
|
+
),
|
|
428
|
+
}),
|
|
429
|
+
},
|
|
430
|
+
BACKSPACE: {
|
|
431
|
+
...getDefaultOperatorFields({
|
|
432
|
+
key: "BACKSPACE",
|
|
433
|
+
keyType: "INPUT_NAVIGATION",
|
|
434
|
+
ariaLabel: i18n._("Delete"),
|
|
435
|
+
}),
|
|
198
436
|
},
|
|
199
437
|
|
|
200
|
-
//
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
},
|
|
209
|
-
[Keys.DOWN]: {
|
|
210
|
-
type: KeyType.INPUT_NAVIGATION,
|
|
211
|
-
ariaLabel: i18n._("Down arrow"),
|
|
212
|
-
},
|
|
213
|
-
[Keys.LEFT]: {
|
|
214
|
-
type: KeyType.INPUT_NAVIGATION,
|
|
215
|
-
ariaLabel: i18n._("Left arrow"),
|
|
216
|
-
},
|
|
217
|
-
[Keys.JUMP_OUT_PARENTHESES]: {
|
|
218
|
-
type: KeyType.INPUT_NAVIGATION,
|
|
219
|
-
ariaLabel: i18n._("Navigate right out of a set of parentheses"),
|
|
220
|
-
},
|
|
221
|
-
[Keys.JUMP_OUT_EXPONENT]: {
|
|
222
|
-
type: KeyType.INPUT_NAVIGATION,
|
|
223
|
-
ariaLabel: i18n._("Navigate right out of an exponent"),
|
|
224
|
-
},
|
|
225
|
-
[Keys.JUMP_OUT_BASE]: {
|
|
226
|
-
type: KeyType.INPUT_NAVIGATION,
|
|
227
|
-
ariaLabel: i18n._("Navigate right out of a base"),
|
|
228
|
-
},
|
|
229
|
-
[Keys.JUMP_INTO_NUMERATOR]: {
|
|
230
|
-
type: KeyType.INPUT_NAVIGATION,
|
|
231
|
-
ariaLabel: i18n._("Navigate right into the numerator of a fraction"),
|
|
232
|
-
},
|
|
233
|
-
[Keys.JUMP_OUT_NUMERATOR]: {
|
|
234
|
-
type: KeyType.INPUT_NAVIGATION,
|
|
235
|
-
ariaLabel: i18n._(
|
|
236
|
-
"Navigate right out of the numerator and into the denominator",
|
|
237
|
-
),
|
|
238
|
-
},
|
|
239
|
-
[Keys.JUMP_OUT_DENOMINATOR]: {
|
|
240
|
-
type: KeyType.INPUT_NAVIGATION,
|
|
241
|
-
ariaLabel: i18n._(
|
|
242
|
-
"Navigate right out of the denominator of a fraction",
|
|
243
|
-
),
|
|
244
|
-
},
|
|
245
|
-
[Keys.BACKSPACE]: {
|
|
246
|
-
type: KeyType.INPUT_NAVIGATION,
|
|
247
|
-
// I18N: A label for a button that will delete some input.
|
|
248
|
-
ariaLabel: i18n._("Delete"),
|
|
438
|
+
// Keypad navigation
|
|
439
|
+
DISMISS: {
|
|
440
|
+
...getDefaultOperatorFields({
|
|
441
|
+
key: "DISMISS",
|
|
442
|
+
keyType: "KEYPAD_NAVIGATION",
|
|
443
|
+
// I18N: A label for a button that will dismiss/hide a keypad.
|
|
444
|
+
ariaLabel: i18n._("Dismiss"),
|
|
445
|
+
}),
|
|
249
446
|
},
|
|
250
447
|
|
|
251
|
-
//
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
448
|
+
// TODO(charlie): Use the numeral color for the 'Many' key.
|
|
449
|
+
MANY: {
|
|
450
|
+
...getDefaultOperatorFields({
|
|
451
|
+
key: "MANY",
|
|
452
|
+
keyType: "MANY",
|
|
453
|
+
}),
|
|
256
454
|
},
|
|
257
|
-
};
|
|
258
455
|
|
|
259
|
-
//
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
456
|
+
// NUMBERS
|
|
457
|
+
NUM_0: {
|
|
458
|
+
...getDefaultNumberFields({
|
|
459
|
+
key: "NUM_0",
|
|
460
|
+
}),
|
|
461
|
+
},
|
|
462
|
+
NUM_1: {
|
|
463
|
+
...getDefaultNumberFields({
|
|
464
|
+
key: "NUM_1",
|
|
465
|
+
}),
|
|
466
|
+
},
|
|
467
|
+
NUM_2: {
|
|
468
|
+
...getDefaultNumberFields({
|
|
469
|
+
key: "NUM_2",
|
|
470
|
+
}),
|
|
471
|
+
},
|
|
472
|
+
NUM_3: {
|
|
473
|
+
...getDefaultNumberFields({
|
|
474
|
+
key: "NUM_3",
|
|
475
|
+
}),
|
|
476
|
+
},
|
|
477
|
+
NUM_4: {
|
|
478
|
+
...getDefaultNumberFields({
|
|
479
|
+
key: "NUM_4",
|
|
480
|
+
}),
|
|
481
|
+
},
|
|
482
|
+
NUM_5: {
|
|
483
|
+
...getDefaultNumberFields({
|
|
484
|
+
key: "NUM_5",
|
|
485
|
+
}),
|
|
486
|
+
},
|
|
487
|
+
NUM_6: {
|
|
488
|
+
...getDefaultNumberFields({
|
|
489
|
+
key: "NUM_6",
|
|
490
|
+
}),
|
|
491
|
+
},
|
|
492
|
+
NUM_7: {
|
|
493
|
+
...getDefaultNumberFields({
|
|
494
|
+
key: "NUM_7",
|
|
495
|
+
}),
|
|
496
|
+
},
|
|
497
|
+
NUM_8: {
|
|
498
|
+
...getDefaultNumberFields({
|
|
499
|
+
key: "NUM_8",
|
|
500
|
+
}),
|
|
501
|
+
},
|
|
502
|
+
NUM_9: {
|
|
503
|
+
...getDefaultNumberFields({
|
|
504
|
+
key: "NUM_9",
|
|
505
|
+
}),
|
|
506
|
+
},
|
|
268
507
|
|
|
269
|
-
//
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
508
|
+
// LETTERS
|
|
509
|
+
A: {
|
|
510
|
+
...getDefaultValueFields({
|
|
511
|
+
key: "A",
|
|
512
|
+
}),
|
|
513
|
+
},
|
|
514
|
+
B: {
|
|
515
|
+
...getDefaultValueFields({
|
|
516
|
+
key: "B",
|
|
517
|
+
}),
|
|
518
|
+
},
|
|
519
|
+
C: {
|
|
520
|
+
...getDefaultValueFields({
|
|
521
|
+
key: "C",
|
|
522
|
+
}),
|
|
523
|
+
},
|
|
524
|
+
D: {
|
|
525
|
+
...getDefaultValueFields({
|
|
526
|
+
key: "D",
|
|
527
|
+
}),
|
|
528
|
+
},
|
|
529
|
+
E: {
|
|
530
|
+
...getDefaultValueFields({
|
|
531
|
+
key: "E",
|
|
532
|
+
}),
|
|
533
|
+
},
|
|
534
|
+
F: {
|
|
535
|
+
...getDefaultValueFields({
|
|
536
|
+
key: "F",
|
|
537
|
+
}),
|
|
538
|
+
},
|
|
539
|
+
G: {
|
|
540
|
+
...getDefaultValueFields({
|
|
541
|
+
key: "G",
|
|
542
|
+
}),
|
|
543
|
+
},
|
|
544
|
+
H: {
|
|
545
|
+
...getDefaultValueFields({
|
|
546
|
+
key: "H",
|
|
547
|
+
}),
|
|
548
|
+
},
|
|
549
|
+
I: {
|
|
550
|
+
...getDefaultValueFields({
|
|
551
|
+
key: "I",
|
|
552
|
+
}),
|
|
553
|
+
},
|
|
554
|
+
J: {
|
|
555
|
+
...getDefaultValueFields({
|
|
556
|
+
key: "J",
|
|
557
|
+
}),
|
|
558
|
+
},
|
|
559
|
+
K: {
|
|
560
|
+
...getDefaultValueFields({
|
|
561
|
+
key: "K",
|
|
562
|
+
}),
|
|
563
|
+
},
|
|
564
|
+
L: {
|
|
565
|
+
...getDefaultValueFields({
|
|
566
|
+
key: "L",
|
|
567
|
+
}),
|
|
568
|
+
},
|
|
569
|
+
M: {
|
|
570
|
+
...getDefaultValueFields({
|
|
571
|
+
key: "M",
|
|
572
|
+
}),
|
|
573
|
+
},
|
|
574
|
+
N: {
|
|
575
|
+
...getDefaultValueFields({
|
|
576
|
+
key: "N",
|
|
577
|
+
}),
|
|
578
|
+
},
|
|
579
|
+
O: {
|
|
580
|
+
...getDefaultValueFields({
|
|
581
|
+
key: "O",
|
|
582
|
+
}),
|
|
583
|
+
},
|
|
584
|
+
P: {
|
|
585
|
+
...getDefaultValueFields({
|
|
586
|
+
key: "P",
|
|
587
|
+
}),
|
|
588
|
+
},
|
|
589
|
+
Q: {
|
|
590
|
+
...getDefaultValueFields({
|
|
591
|
+
key: "Q",
|
|
592
|
+
}),
|
|
593
|
+
},
|
|
594
|
+
R: {
|
|
595
|
+
...getDefaultValueFields({
|
|
596
|
+
key: "R",
|
|
597
|
+
}),
|
|
598
|
+
},
|
|
599
|
+
S: {
|
|
600
|
+
...getDefaultValueFields({
|
|
601
|
+
key: "S",
|
|
602
|
+
}),
|
|
603
|
+
},
|
|
604
|
+
T: {
|
|
605
|
+
...getDefaultValueFields({
|
|
606
|
+
key: "T",
|
|
607
|
+
}),
|
|
608
|
+
},
|
|
609
|
+
U: {
|
|
610
|
+
...getDefaultValueFields({
|
|
611
|
+
key: "U",
|
|
612
|
+
}),
|
|
613
|
+
},
|
|
614
|
+
V: {
|
|
615
|
+
...getDefaultValueFields({
|
|
616
|
+
key: "V",
|
|
617
|
+
}),
|
|
618
|
+
},
|
|
619
|
+
W: {
|
|
620
|
+
...getDefaultValueFields({
|
|
621
|
+
key: "W",
|
|
622
|
+
}),
|
|
623
|
+
},
|
|
624
|
+
X: {
|
|
625
|
+
...getDefaultValueFields({
|
|
626
|
+
key: "X",
|
|
627
|
+
}),
|
|
628
|
+
},
|
|
629
|
+
Y: {
|
|
630
|
+
...getDefaultValueFields({
|
|
631
|
+
key: "Y",
|
|
632
|
+
}),
|
|
633
|
+
},
|
|
634
|
+
Z: {
|
|
635
|
+
...getDefaultValueFields({
|
|
636
|
+
key: "Z",
|
|
637
|
+
}),
|
|
638
|
+
},
|
|
639
|
+
a: {
|
|
640
|
+
...getDefaultValueFields({
|
|
641
|
+
key: "a",
|
|
642
|
+
}),
|
|
643
|
+
},
|
|
644
|
+
b: {
|
|
645
|
+
...getDefaultValueFields({
|
|
646
|
+
key: "b",
|
|
647
|
+
}),
|
|
648
|
+
},
|
|
649
|
+
c: {
|
|
650
|
+
...getDefaultValueFields({
|
|
651
|
+
key: "c",
|
|
652
|
+
}),
|
|
653
|
+
},
|
|
654
|
+
d: {
|
|
655
|
+
...getDefaultValueFields({
|
|
656
|
+
key: "d",
|
|
657
|
+
}),
|
|
658
|
+
},
|
|
659
|
+
e: {
|
|
660
|
+
...getDefaultValueFields({
|
|
661
|
+
key: "e",
|
|
662
|
+
}),
|
|
663
|
+
},
|
|
664
|
+
f: {
|
|
665
|
+
...getDefaultValueFields({
|
|
666
|
+
key: "f",
|
|
667
|
+
}),
|
|
668
|
+
},
|
|
669
|
+
g: {
|
|
670
|
+
...getDefaultValueFields({
|
|
671
|
+
key: "g",
|
|
672
|
+
}),
|
|
673
|
+
},
|
|
674
|
+
h: {
|
|
675
|
+
...getDefaultValueFields({
|
|
676
|
+
key: "h",
|
|
677
|
+
}),
|
|
678
|
+
},
|
|
679
|
+
i: {
|
|
680
|
+
...getDefaultValueFields({
|
|
681
|
+
key: "i",
|
|
682
|
+
}),
|
|
683
|
+
},
|
|
684
|
+
j: {
|
|
685
|
+
...getDefaultValueFields({
|
|
686
|
+
key: "j",
|
|
687
|
+
}),
|
|
688
|
+
},
|
|
689
|
+
k: {
|
|
690
|
+
...getDefaultValueFields({
|
|
691
|
+
key: "k",
|
|
692
|
+
}),
|
|
693
|
+
},
|
|
694
|
+
l: {
|
|
695
|
+
...getDefaultValueFields({
|
|
696
|
+
key: "l",
|
|
697
|
+
}),
|
|
698
|
+
},
|
|
699
|
+
m: {
|
|
700
|
+
...getDefaultValueFields({
|
|
701
|
+
key: "m",
|
|
702
|
+
}),
|
|
703
|
+
},
|
|
704
|
+
n: {
|
|
705
|
+
...getDefaultValueFields({
|
|
706
|
+
key: "n",
|
|
707
|
+
}),
|
|
708
|
+
},
|
|
709
|
+
o: {
|
|
710
|
+
...getDefaultValueFields({
|
|
711
|
+
key: "o",
|
|
712
|
+
}),
|
|
713
|
+
},
|
|
714
|
+
p: {
|
|
715
|
+
...getDefaultValueFields({
|
|
716
|
+
key: "p",
|
|
717
|
+
}),
|
|
718
|
+
},
|
|
719
|
+
q: {
|
|
720
|
+
...getDefaultValueFields({
|
|
721
|
+
key: "q",
|
|
722
|
+
}),
|
|
723
|
+
},
|
|
724
|
+
r: {
|
|
725
|
+
...getDefaultValueFields({
|
|
726
|
+
key: "r",
|
|
727
|
+
}),
|
|
728
|
+
},
|
|
729
|
+
s: {
|
|
730
|
+
...getDefaultValueFields({
|
|
731
|
+
key: "s",
|
|
732
|
+
}),
|
|
733
|
+
},
|
|
734
|
+
t: {
|
|
735
|
+
...getDefaultValueFields({
|
|
736
|
+
key: "t",
|
|
737
|
+
}),
|
|
738
|
+
},
|
|
739
|
+
u: {
|
|
740
|
+
...getDefaultValueFields({
|
|
741
|
+
key: "u",
|
|
742
|
+
}),
|
|
743
|
+
},
|
|
744
|
+
v: {
|
|
745
|
+
...getDefaultValueFields({
|
|
746
|
+
key: "v",
|
|
747
|
+
}),
|
|
748
|
+
},
|
|
749
|
+
w: {
|
|
750
|
+
...getDefaultValueFields({
|
|
751
|
+
key: "w",
|
|
752
|
+
}),
|
|
753
|
+
},
|
|
754
|
+
x: {
|
|
755
|
+
...getDefaultValueFields({
|
|
756
|
+
key: "x",
|
|
757
|
+
}),
|
|
758
|
+
},
|
|
759
|
+
y: {
|
|
760
|
+
...getDefaultValueFields({
|
|
761
|
+
key: "y",
|
|
762
|
+
}),
|
|
763
|
+
},
|
|
764
|
+
z: {
|
|
765
|
+
...getDefaultValueFields({
|
|
766
|
+
key: "z",
|
|
767
|
+
}),
|
|
768
|
+
},
|
|
769
|
+
PHI: {
|
|
770
|
+
...getDefaultValueFields({
|
|
771
|
+
key: "PHI",
|
|
772
|
+
}),
|
|
773
|
+
},
|
|
774
|
+
NTHROOT3: {
|
|
775
|
+
...getDefaultValueFields({
|
|
776
|
+
key: "NTHROOT3",
|
|
777
|
+
}),
|
|
778
|
+
},
|
|
779
|
+
POW: {
|
|
780
|
+
...getDefaultValueFields({
|
|
781
|
+
key: "POW",
|
|
782
|
+
}),
|
|
783
|
+
},
|
|
784
|
+
LOG_B: {
|
|
785
|
+
...getDefaultValueFields({
|
|
786
|
+
key: "LOG_B",
|
|
787
|
+
}),
|
|
788
|
+
},
|
|
273
789
|
};
|
|
274
790
|
|
|
275
|
-
// Add in every numeral.
|
|
276
|
-
const NUMBERS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
|
|
277
|
-
for (const num of NUMBERS) {
|
|
278
|
-
// TODO(charlie): Consider removing the SVG icons that we have for the
|
|
279
|
-
// numeral keys. They can be rendered just as easily with text (though that
|
|
280
|
-
// would mean that we'd be using text beyond the variable key).
|
|
281
|
-
const textRepresentation = `${num}`;
|
|
282
|
-
KeyConfigs[`NUM_${num}`] = {
|
|
283
|
-
type: KeyType.VALUE,
|
|
284
|
-
ariaLabel: textRepresentation,
|
|
285
|
-
icon: {
|
|
286
|
-
type: IconType.TEXT,
|
|
287
|
-
data: textRepresentation,
|
|
288
|
-
},
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
// Add in every variable.
|
|
293
|
-
const LETTERS = [
|
|
294
|
-
"A",
|
|
295
|
-
"B",
|
|
296
|
-
"C",
|
|
297
|
-
"D",
|
|
298
|
-
"E",
|
|
299
|
-
"F",
|
|
300
|
-
"G",
|
|
301
|
-
"H",
|
|
302
|
-
"I",
|
|
303
|
-
"J",
|
|
304
|
-
"K",
|
|
305
|
-
"L",
|
|
306
|
-
"M",
|
|
307
|
-
"N",
|
|
308
|
-
"O",
|
|
309
|
-
"P",
|
|
310
|
-
"Q",
|
|
311
|
-
"R",
|
|
312
|
-
"S",
|
|
313
|
-
"T",
|
|
314
|
-
"U",
|
|
315
|
-
"V",
|
|
316
|
-
"W",
|
|
317
|
-
"X",
|
|
318
|
-
"Y",
|
|
319
|
-
"Z",
|
|
320
|
-
];
|
|
321
|
-
for (const letter of LETTERS) {
|
|
322
|
-
const lowerCaseVariable = letter.toLowerCase();
|
|
323
|
-
const upperCaseVariable = letter.toUpperCase();
|
|
324
|
-
|
|
325
|
-
for (const textRepresentation of [lowerCaseVariable, upperCaseVariable]) {
|
|
326
|
-
KeyConfigs[textRepresentation] = {
|
|
327
|
-
type: KeyType.VALUE,
|
|
328
|
-
ariaLabel: textRepresentation,
|
|
329
|
-
icon: {
|
|
330
|
-
type: IconType.MATH,
|
|
331
|
-
data: textRepresentation,
|
|
332
|
-
},
|
|
333
|
-
};
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
for (const key of Object.keys(KeyConfigs)) {
|
|
338
|
-
KeyConfigs[key] = {
|
|
339
|
-
id: key,
|
|
340
|
-
// Default to an SVG icon indexed by the key name.
|
|
341
|
-
icon: {
|
|
342
|
-
type: IconType.SVG,
|
|
343
|
-
data: key,
|
|
344
|
-
},
|
|
345
|
-
...KeyConfigs[key],
|
|
346
|
-
};
|
|
347
|
-
}
|
|
348
|
-
|
|
349
791
|
export default KeyConfigs;
|