@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
|
@@ -6,9 +6,8 @@ import {StyleSheet, css} from "aphrodite";
|
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
import {connect} from "react-redux";
|
|
8
8
|
|
|
9
|
-
import {BorderDirection, BorderStyles, KeyType} from "
|
|
10
|
-
import {View} from "
|
|
11
|
-
|
|
9
|
+
import {BorderDirection, BorderStyles, KeyType, KeyTypes} from "../../enums";
|
|
10
|
+
import {View} from "../../fake-react-native-web/index";
|
|
12
11
|
import {
|
|
13
12
|
wonderBlocksBlue,
|
|
14
13
|
innerBorderColor,
|
|
@@ -18,13 +17,14 @@ import {
|
|
|
18
17
|
operatorGrey,
|
|
19
18
|
controlGrey,
|
|
20
19
|
emptyGrey,
|
|
21
|
-
} from "
|
|
20
|
+
} from "../common-style";
|
|
21
|
+
|
|
22
22
|
import CornerDecal from "./corner-decal";
|
|
23
23
|
import Icon from "./icon";
|
|
24
24
|
import MultiSymbolGrid from "./multi-symbol-grid";
|
|
25
25
|
|
|
26
|
-
import type {
|
|
27
|
-
import type {
|
|
26
|
+
import type {Border, NonManyKeyConfig, IconConfig} from "../../types";
|
|
27
|
+
import type {State} from "./store/types";
|
|
28
28
|
import type {StyleType} from "@khanacademy/wonder-blocks-core";
|
|
29
29
|
|
|
30
30
|
interface ReduxProps {
|
|
@@ -35,12 +35,12 @@ interface ReduxProps {
|
|
|
35
35
|
interface Props extends ReduxProps {
|
|
36
36
|
ariaLabel?: string;
|
|
37
37
|
borders: Border;
|
|
38
|
-
childKeys: ReadonlyArray<
|
|
38
|
+
childKeys: ReadonlyArray<NonManyKeyConfig>;
|
|
39
39
|
disabled: boolean;
|
|
40
40
|
focused: boolean;
|
|
41
41
|
popoverEnabled: boolean;
|
|
42
42
|
type: KeyType;
|
|
43
|
-
icon
|
|
43
|
+
icon?: IconConfig;
|
|
44
44
|
style?: StyleType;
|
|
45
45
|
onTouchCancel?: (evt: React.TouchEvent<HTMLDivElement>) => void;
|
|
46
46
|
onTouchEnd?: (evt: React.TouchEvent<HTMLDivElement>) => void;
|
|
@@ -101,7 +101,7 @@ class KeypadButton extends React.PureComponent<Props> {
|
|
|
101
101
|
// object. This method must be called whenever a property that
|
|
102
102
|
// influences the possible outcomes of `this._getFocusStyle` and
|
|
103
103
|
// `this._getButtonStyle` changes (such as `this.buttonSizeStyle`).
|
|
104
|
-
for (const type of
|
|
104
|
+
for (const type of KeyTypes) {
|
|
105
105
|
css(View.styles.initial, ...this._getFocusStyle(type));
|
|
106
106
|
|
|
107
107
|
for (const borders of Object.values(BorderStyles)) {
|
|
@@ -115,10 +115,7 @@ class KeypadButton extends React.PureComponent<Props> {
|
|
|
115
115
|
|
|
116
116
|
_getFocusStyle = (type: KeyType) => {
|
|
117
117
|
let focusBackgroundStyle;
|
|
118
|
-
if (
|
|
119
|
-
type === KeyType.INPUT_NAVIGATION ||
|
|
120
|
-
type === KeyType.KEYPAD_NAVIGATION
|
|
121
|
-
) {
|
|
118
|
+
if (type === "INPUT_NAVIGATION" || type === "KEYPAD_NAVIGATION") {
|
|
122
119
|
focusBackgroundStyle = styles.light;
|
|
123
120
|
} else {
|
|
124
121
|
focusBackgroundStyle = styles.bright;
|
|
@@ -131,25 +128,25 @@ class KeypadButton extends React.PureComponent<Props> {
|
|
|
131
128
|
// Select the appropriate style for the button.
|
|
132
129
|
let backgroundStyle;
|
|
133
130
|
switch (type) {
|
|
134
|
-
case
|
|
131
|
+
case "EMPTY":
|
|
135
132
|
backgroundStyle = styles.empty;
|
|
136
133
|
break;
|
|
137
134
|
|
|
138
|
-
case
|
|
139
|
-
case
|
|
135
|
+
case "MANY":
|
|
136
|
+
case "VALUE":
|
|
140
137
|
backgroundStyle = styles.value;
|
|
141
138
|
break;
|
|
142
139
|
|
|
143
|
-
case
|
|
140
|
+
case "OPERATOR":
|
|
144
141
|
backgroundStyle = styles.operator;
|
|
145
142
|
break;
|
|
146
143
|
|
|
147
|
-
case
|
|
148
|
-
case
|
|
144
|
+
case "INPUT_NAVIGATION":
|
|
145
|
+
case "KEYPAD_NAVIGATION":
|
|
149
146
|
backgroundStyle = styles.control;
|
|
150
147
|
break;
|
|
151
148
|
|
|
152
|
-
case
|
|
149
|
+
case "ECHO":
|
|
153
150
|
backgroundStyle = null;
|
|
154
151
|
break;
|
|
155
152
|
}
|
|
@@ -168,7 +165,7 @@ class KeypadButton extends React.PureComponent<Props> {
|
|
|
168
165
|
styles.buttonBase,
|
|
169
166
|
backgroundStyle,
|
|
170
167
|
...borderStyle,
|
|
171
|
-
type ===
|
|
168
|
+
type === "ECHO" && styles.echo,
|
|
172
169
|
this.buttonSizeStyle,
|
|
173
170
|
// React Native allows you to set the 'style' props on user defined
|
|
174
171
|
// components.
|
|
@@ -197,7 +194,7 @@ class KeypadButton extends React.PureComponent<Props> {
|
|
|
197
194
|
// We render in the focus state if the key is focused, or if it's an
|
|
198
195
|
// echo.
|
|
199
196
|
const renderFocused =
|
|
200
|
-
(!disabled && focused) || popoverEnabled || type ===
|
|
197
|
+
(!disabled && focused) || popoverEnabled || type === "ECHO";
|
|
201
198
|
const buttonStyle = this._getButtonStyle(type, borders, style);
|
|
202
199
|
const focusStyle = this._getFocusStyle(type);
|
|
203
200
|
const iconWrapperStyle = [
|
|
@@ -218,9 +215,9 @@ class KeypadButton extends React.PureComponent<Props> {
|
|
|
218
215
|
childKeys &&
|
|
219
216
|
childKeys.length > 0 && <CornerDecal style={styles.decalInset} />;
|
|
220
217
|
|
|
221
|
-
if (type ===
|
|
218
|
+
if (type === "EMPTY") {
|
|
222
219
|
return <View style={buttonStyle} {...eventHandlers} />;
|
|
223
|
-
} else if (type ===
|
|
220
|
+
} else if (type === "MANY") {
|
|
224
221
|
// TODO(charlie): Make the long-press interaction accessible. See
|
|
225
222
|
// the TODO in key-configs.js for more.
|
|
226
223
|
const manyButtonA11yMarkup = {
|
|
@@ -229,7 +226,7 @@ class KeypadButton extends React.PureComponent<Props> {
|
|
|
229
226
|
};
|
|
230
227
|
const icons = childKeys.map((keyConfig) => {
|
|
231
228
|
return keyConfig.icon;
|
|
232
|
-
})
|
|
229
|
+
}) as ReadonlyArray<IconConfig>;
|
|
233
230
|
return (
|
|
234
231
|
<View
|
|
235
232
|
style={buttonStyle}
|
|
@@ -256,7 +253,10 @@ class KeypadButton extends React.PureComponent<Props> {
|
|
|
256
253
|
<View style={buttonStyle} {...eventHandlers} {...a11yMarkup}>
|
|
257
254
|
{maybeFocusBox}
|
|
258
255
|
<View style={iconWrapperStyle}>
|
|
259
|
-
<Icon
|
|
256
|
+
<Icon
|
|
257
|
+
icon={icon as IconConfig}
|
|
258
|
+
focused={renderFocused}
|
|
259
|
+
/>
|
|
260
260
|
</View>
|
|
261
261
|
{maybeCornerDecal}
|
|
262
262
|
</View>
|
|
@@ -2,23 +2,23 @@ import {StyleSheet} from "aphrodite";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import {connect} from "react-redux";
|
|
4
4
|
|
|
5
|
-
import {LayoutMode, KeypadType} from "
|
|
6
|
-
import {View} from "
|
|
7
|
-
import {setPageSize} from "../store/actions";
|
|
8
|
-
|
|
5
|
+
import {LayoutMode, KeypadType} from "../../enums";
|
|
6
|
+
import {View} from "../../fake-react-native-web/index";
|
|
9
7
|
import {
|
|
10
8
|
innerBorderColor,
|
|
11
9
|
innerBorderStyle,
|
|
12
10
|
innerBorderWidthPx,
|
|
13
11
|
compactKeypadBorderRadiusPx,
|
|
14
|
-
} from "
|
|
12
|
+
} from "../common-style";
|
|
13
|
+
|
|
15
14
|
import ExpressionKeypad from "./expression-keypad";
|
|
16
15
|
import FractionKeypad from "./fraction-keypad";
|
|
17
16
|
import NavigationPad from "./navigation-pad";
|
|
17
|
+
import {setPageSize} from "./store/actions";
|
|
18
18
|
import Styles from "./styles";
|
|
19
19
|
import * as zIndexes from "./z-indexes";
|
|
20
20
|
|
|
21
|
-
import type {State as ReduxState} from "
|
|
21
|
+
import type {State as ReduxState} from "./store/types";
|
|
22
22
|
import type {StyleType} from "@khanacademy/wonder-blocks-core";
|
|
23
23
|
|
|
24
24
|
const {row, centered, fullWidth} = Styles;
|
|
@@ -7,14 +7,14 @@ import * as React from "react";
|
|
|
7
7
|
import ReactDOM from "react-dom";
|
|
8
8
|
import {connect} from "react-redux";
|
|
9
9
|
|
|
10
|
-
import {View} from "
|
|
11
|
-
import {removeEcho} from "../store/actions";
|
|
10
|
+
import {View} from "../../fake-react-native-web/index";
|
|
12
11
|
|
|
13
12
|
import EchoManager from "./echo-manager";
|
|
14
13
|
import PopoverManager from "./popover-manager";
|
|
14
|
+
import {removeEcho} from "./store/actions";
|
|
15
15
|
|
|
16
|
-
import type {
|
|
17
|
-
import type {
|
|
16
|
+
import type {Bound, Popover, Echo} from "../../types";
|
|
17
|
+
import type {State} from "./store/types";
|
|
18
18
|
import type {StyleType} from "@khanacademy/wonder-blocks-core";
|
|
19
19
|
|
|
20
20
|
interface ReduxProps {
|
|
@@ -33,7 +33,7 @@ interface Props extends ReduxProps {
|
|
|
33
33
|
class Keypad extends React.Component<Props> {
|
|
34
34
|
_isMounted: boolean | undefined;
|
|
35
35
|
_resizeTimeout: number | null | undefined;
|
|
36
|
-
_container:
|
|
36
|
+
_container: Bound | null | undefined;
|
|
37
37
|
|
|
38
38
|
componentDidMount() {
|
|
39
39
|
this._isMounted = true;
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
|
|
8
|
-
import KeyConfigs from "
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
8
|
+
import KeyConfigs from "../../data/key-configs";
|
|
9
|
+
import {IconType} from "../../enums";
|
|
10
|
+
import {KeyConfig} from "../../types";
|
|
11
11
|
|
|
12
12
|
import EmptyKeypadButton from "./empty-keypad-button";
|
|
13
13
|
import TouchableKeypadButton from "./touchable-keypad-button";
|
|
@@ -33,10 +33,17 @@ class ManyKeypadButton extends React.Component<Props> {
|
|
|
33
33
|
const keyConfig = KeyConfigs[keys[0]];
|
|
34
34
|
return <TouchableKeypadButton keyConfig={keyConfig} {...rest} />;
|
|
35
35
|
} else {
|
|
36
|
-
const keyConfig = {
|
|
37
|
-
id:
|
|
38
|
-
type:
|
|
36
|
+
const keyConfig: KeyConfig = {
|
|
37
|
+
id: "MANY",
|
|
38
|
+
type: "MANY",
|
|
39
39
|
childKeyIds: keys,
|
|
40
|
+
ariaLabel: keys
|
|
41
|
+
.map((key) => KeyConfigs[key].ariaLabel)
|
|
42
|
+
.join(", "),
|
|
43
|
+
icon: {
|
|
44
|
+
type: IconType.SVG,
|
|
45
|
+
data: "many",
|
|
46
|
+
},
|
|
40
47
|
};
|
|
41
48
|
return <TouchableKeypadButton keyConfig={keyConfig} {...rest} />;
|
|
42
49
|
}
|
|
@@ -7,9 +7,9 @@ import katex from "katex";
|
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
import ReactDOM from "react-dom";
|
|
9
9
|
|
|
10
|
-
import {View} from "
|
|
10
|
+
import {View} from "../../fake-react-native-web/index";
|
|
11
|
+
import {iconSizeHeightPx, iconSizeWidthPx} from "../common-style";
|
|
11
12
|
|
|
12
|
-
import {iconSizeHeightPx, iconSizeWidthPx} from "./common-style";
|
|
13
13
|
import Styles from "./styles";
|
|
14
14
|
|
|
15
15
|
import type {StyleType} from "@khanacademy/wonder-blocks-core";
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
import {StyleSheet} from "aphrodite";
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
|
|
9
|
-
import {IconType} from "
|
|
10
|
-
import {View} from "
|
|
11
|
-
import {IconConfig} from "
|
|
9
|
+
import {IconType} from "../../enums";
|
|
10
|
+
import {View} from "../../fake-react-native-web/index";
|
|
11
|
+
import {IconConfig} from "../../types";
|
|
12
|
+
import {iconSizeHeightPx, iconSizeWidthPx} from "../common-style";
|
|
12
13
|
|
|
13
|
-
import {iconSizeHeightPx, iconSizeWidthPx} from "./common-style";
|
|
14
14
|
import Icon from "./icon";
|
|
15
15
|
import Styles from "./styles";
|
|
16
16
|
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
import {StyleSheet} from "aphrodite";
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
|
|
8
|
-
import {BorderStyles} from "
|
|
9
|
-
import {View} from "
|
|
10
|
-
import {KeyConfig} from "
|
|
8
|
+
import {BorderStyles} from "../../enums";
|
|
9
|
+
import {View} from "../../fake-react-native-web/index";
|
|
10
|
+
import {KeyConfig} from "../../types";
|
|
11
11
|
|
|
12
12
|
import TouchableKeypadButton from "./touchable-keypad-button";
|
|
13
13
|
import * as zIndexes from "./z-indexes";
|
|
@@ -27,7 +27,6 @@ class MultiSymbolPopover extends React.Component<Prop> {
|
|
|
27
27
|
{keys.map((key) => {
|
|
28
28
|
return (
|
|
29
29
|
<TouchableKeypadButton
|
|
30
|
-
key={key.id}
|
|
31
30
|
keyConfig={key}
|
|
32
31
|
borders={BorderStyles.NONE}
|
|
33
32
|
/>
|
|
@@ -6,16 +6,16 @@
|
|
|
6
6
|
import {StyleSheet} from "aphrodite";
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
|
|
9
|
-
import KeyConfigs from "
|
|
10
|
-
import {BorderStyles} from "
|
|
11
|
-
import {View} from "
|
|
12
|
-
|
|
9
|
+
import KeyConfigs from "../../data/key-configs";
|
|
10
|
+
import {BorderStyles} from "../../enums";
|
|
11
|
+
import {View} from "../../fake-react-native-web/index";
|
|
13
12
|
import {
|
|
14
13
|
navigationPadWidthPx,
|
|
15
14
|
controlGrey,
|
|
16
15
|
valueGrey,
|
|
17
16
|
offBlack16,
|
|
18
|
-
} from "
|
|
17
|
+
} from "../common-style";
|
|
18
|
+
|
|
19
19
|
import Styles from "./styles";
|
|
20
20
|
import TouchableKeypadButton from "./touchable-keypad-button";
|
|
21
21
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {LayoutProps, Bound} from "../../types";
|
|
2
2
|
/**
|
|
3
3
|
* A manager for our node-to-ID system. In particular, this class is
|
|
4
4
|
* responsible for maintaing a mapping between DOM nodes and node IDs, and
|
|
@@ -9,18 +9,13 @@ import type {Border, LayoutProps} from "../types";
|
|
|
9
9
|
|
|
10
10
|
class NodeManager {
|
|
11
11
|
_nodesById: Record<string, HTMLElement>;
|
|
12
|
-
_bordersById: Record<string, Border>;
|
|
13
12
|
_orderedIds: ReadonlyArray<string>;
|
|
14
|
-
_cachedBoundingBoxesById: Record<string,
|
|
13
|
+
_cachedBoundingBoxesById: Record<string, Bound>;
|
|
15
14
|
|
|
16
15
|
constructor() {
|
|
17
16
|
// A mapping from IDs to DOM nodes.
|
|
18
17
|
this._nodesById = {};
|
|
19
18
|
|
|
20
|
-
// A mapping from IDs to the borders around the DOM nodes, which can be
|
|
21
|
-
// useful for layout purposes.
|
|
22
|
-
this._bordersById = {};
|
|
23
|
-
|
|
24
19
|
// An ordered list of IDs, where DOM nodes that are "higher" on the
|
|
25
20
|
// page come earlier in the list. Note that an ID may be present in
|
|
26
21
|
// this ordered list but not be registered to a DOM node (i.e., if it
|
|
@@ -53,10 +48,8 @@ class NodeManager {
|
|
|
53
48
|
id: string,
|
|
54
49
|
domNode: HTMLElement,
|
|
55
50
|
childIds: ReadonlyArray<string>,
|
|
56
|
-
borders: Border,
|
|
57
51
|
) {
|
|
58
52
|
this._nodesById[id] = domNode;
|
|
59
|
-
this._bordersById[id] = borders;
|
|
60
53
|
|
|
61
54
|
// Make sure that any children appear first.
|
|
62
55
|
// TODO(charlie): This is a very simplistic system that wouldn't
|
|
@@ -133,7 +126,6 @@ class NodeManager {
|
|
|
133
126
|
|
|
134
127
|
return {
|
|
135
128
|
initialBounds: this._cachedBoundingBoxesById[id],
|
|
136
|
-
borders: this._bordersById[id],
|
|
137
129
|
};
|
|
138
130
|
}
|
|
139
131
|
}
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
import {CSSTransition} from "react-transition-group";
|
|
8
8
|
|
|
9
|
-
import KeyConfigs from "
|
|
9
|
+
import KeyConfigs from "../../data/key-configs";
|
|
10
10
|
|
|
11
11
|
import MultiSymbolPopover from "./multi-symbol-popover";
|
|
12
12
|
|
|
13
|
-
import type {Popover, KeyConfig} from "
|
|
13
|
+
import type {Popover, KeyConfig} from "../../types";
|
|
14
14
|
|
|
15
15
|
// NOTE(charlie): These must be kept in sync with the transition durations and
|
|
16
16
|
// classnames specified in popover.less.
|
|
@@ -2,18 +2,17 @@ import * as React from "react";
|
|
|
2
2
|
import ReactDOM from "react-dom";
|
|
3
3
|
import {Provider} from "react-redux";
|
|
4
4
|
|
|
5
|
+
import KeypadContainer from "./keypad-container";
|
|
5
6
|
import {
|
|
6
7
|
activateKeypad,
|
|
7
8
|
dismissKeypad,
|
|
8
9
|
configureKeypad,
|
|
9
10
|
setCursor,
|
|
10
11
|
setKeyHandler,
|
|
11
|
-
} from "
|
|
12
|
-
import {createStore} from "
|
|
13
|
-
|
|
14
|
-
import KeypadContainer from "./keypad-container";
|
|
12
|
+
} from "./store/actions";
|
|
13
|
+
import {createStore} from "./store/index";
|
|
15
14
|
|
|
16
|
-
import type {Cursor, KeypadConfiguration, KeyHandler} from "
|
|
15
|
+
import type {Cursor, KeypadConfiguration, KeyHandler} from "../../types";
|
|
17
16
|
import type {StyleType} from "@khanacademy/wonder-blocks-core";
|
|
18
17
|
|
|
19
18
|
type Props = {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Key from "../../../data/keys";
|
|
2
2
|
|
|
3
3
|
import type {
|
|
4
|
+
Bound,
|
|
4
5
|
KeypadConfiguration,
|
|
5
6
|
KeyHandler,
|
|
6
7
|
Cursor,
|
|
7
8
|
ActiveNodesObj,
|
|
8
|
-
|
|
9
|
-
} from "../types";
|
|
9
|
+
} from "../../../types";
|
|
10
10
|
|
|
11
11
|
// naming convention: verb + noun
|
|
12
12
|
// the noun should be one of the other properties in the object that's
|
|
@@ -104,30 +104,6 @@ export const setCursor = (cursor: Cursor): SetCursorAction => {
|
|
|
104
104
|
};
|
|
105
105
|
|
|
106
106
|
// Gesture actions
|
|
107
|
-
type OnSwipeChangeAction = {
|
|
108
|
-
type: "OnSwipeChange";
|
|
109
|
-
dx: number;
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
export const onSwipeChange = (dx: number): OnSwipeChangeAction => {
|
|
113
|
-
return {
|
|
114
|
-
type: "OnSwipeChange",
|
|
115
|
-
dx,
|
|
116
|
-
};
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
type OnSwipeEndAction = {
|
|
120
|
-
type: "OnSwipeEnd";
|
|
121
|
-
dx: number;
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
export const onSwipeEnd = (dx: number): OnSwipeEndAction => {
|
|
125
|
-
return {
|
|
126
|
-
type: "OnSwipeEnd",
|
|
127
|
-
dx,
|
|
128
|
-
};
|
|
129
|
-
};
|
|
130
|
-
|
|
131
107
|
type SetActiveNodesAction = {
|
|
132
108
|
type: "SetActiveNodes";
|
|
133
109
|
activeNodes: any;
|
|
@@ -144,22 +120,19 @@ export const setActiveNodes = (
|
|
|
144
120
|
|
|
145
121
|
type PressKeyAction = {
|
|
146
122
|
type: "PressKey";
|
|
147
|
-
key:
|
|
148
|
-
|
|
149
|
-
initialBounds: DOMRect;
|
|
123
|
+
key: Key;
|
|
124
|
+
initialBounds: Bound;
|
|
150
125
|
inPopover: boolean;
|
|
151
126
|
};
|
|
152
127
|
|
|
153
128
|
export const pressKey = (
|
|
154
|
-
key:
|
|
155
|
-
|
|
156
|
-
initialBounds: DOMRect,
|
|
129
|
+
key: Key,
|
|
130
|
+
initialBounds: Bound,
|
|
157
131
|
inPopover: any,
|
|
158
132
|
): PressKeyAction => {
|
|
159
133
|
return {
|
|
160
134
|
type: "PressKey",
|
|
161
135
|
key,
|
|
162
|
-
borders,
|
|
163
136
|
initialBounds,
|
|
164
137
|
inPopover,
|
|
165
138
|
};
|
|
@@ -173,7 +146,5 @@ export type Action =
|
|
|
173
146
|
| RemoveEchoAction
|
|
174
147
|
| SetKeyHandlerAction
|
|
175
148
|
| SetCursorAction
|
|
176
|
-
| OnSwipeChangeAction
|
|
177
|
-
| OnSwipeEndAction
|
|
178
149
|
| SetActiveNodesAction
|
|
179
150
|
| PressKeyAction;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import KeyConfigs from "
|
|
2
|
-
import {EchoAnimationType
|
|
1
|
+
import KeyConfigs from "../../../data/key-configs";
|
|
2
|
+
import {EchoAnimationType} from "../../../enums";
|
|
3
3
|
|
|
4
4
|
import type {Action} from "./actions";
|
|
5
5
|
import type {EchoState} from "./types";
|
|
@@ -22,10 +22,7 @@ const echoReducer = function (
|
|
|
22
22
|
|
|
23
23
|
// Add in the echo animation if the user performs a math
|
|
24
24
|
// operation.
|
|
25
|
-
if (
|
|
26
|
-
keyConfig.type === KeyType.VALUE ||
|
|
27
|
-
keyConfig.type === KeyType.OPERATOR
|
|
28
|
-
) {
|
|
25
|
+
if (keyConfig.type === "VALUE" || keyConfig.type === "OPERATOR") {
|
|
29
26
|
return {
|
|
30
27
|
...state,
|
|
31
28
|
echoes: [
|
|
@@ -35,7 +32,6 @@ const echoReducer = function (
|
|
|
35
32
|
animationType: action.inPopover
|
|
36
33
|
? EchoAnimationType.LONG_FADE_ONLY
|
|
37
34
|
: EchoAnimationType.FADE_ONLY,
|
|
38
|
-
borders: action.borders,
|
|
39
35
|
id: keyConfig.id,
|
|
40
36
|
initialBounds: action.initialBounds,
|
|
41
37
|
},
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import * as Redux from "redux";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import Key from "../../../data/keys";
|
|
4
|
+
import GestureManager from "../gesture-manager";
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import {setActiveNodes, pressKey} from "./actions";
|
|
7
7
|
import echoReducer from "./echo-reducer";
|
|
8
8
|
import inputReducer from "./input-reducer";
|
|
9
9
|
import keypadReducer from "./keypad-reducer";
|
|
10
10
|
import layoutReducer from "./layout-reducer";
|
|
11
|
-
import pagerReducer from "./pager-reducer";
|
|
12
11
|
import {defaultKeypadType, keypadForType} from "./shared";
|
|
13
12
|
|
|
14
|
-
import type {LayoutProps, ActiveNodesObj} from "
|
|
13
|
+
import type {LayoutProps, ActiveNodesObj} from "../../../types";
|
|
15
14
|
import type {Action} from "./actions";
|
|
16
15
|
import type {GestureState} from "./types";
|
|
17
16
|
|
|
@@ -24,32 +23,21 @@ export const createStore = () => {
|
|
|
24
23
|
swipeEnabled,
|
|
25
24
|
},
|
|
26
25
|
{
|
|
27
|
-
onSwipeChange: (dx: number) => {
|
|
28
|
-
store.dispatch(onSwipeChange(dx));
|
|
29
|
-
},
|
|
30
|
-
onSwipeEnd: (dx: number) => {
|
|
31
|
-
store.dispatch(onSwipeEnd(dx));
|
|
32
|
-
},
|
|
33
26
|
onActiveNodesChanged: (activeNodes: ActiveNodesObj) => {
|
|
34
27
|
store.dispatch(setActiveNodes(activeNodes));
|
|
35
28
|
},
|
|
36
29
|
onClick: (
|
|
37
|
-
key:
|
|
30
|
+
key: Key,
|
|
38
31
|
layoutProps: LayoutProps,
|
|
39
32
|
inPopover: boolean,
|
|
40
33
|
) => {
|
|
41
34
|
store.dispatch(
|
|
42
|
-
pressKey(
|
|
43
|
-
key,
|
|
44
|
-
layoutProps.borders,
|
|
45
|
-
layoutProps.initialBounds,
|
|
46
|
-
inPopover,
|
|
47
|
-
),
|
|
35
|
+
pressKey(key, layoutProps.initialBounds, inPopover),
|
|
48
36
|
);
|
|
49
37
|
},
|
|
50
38
|
},
|
|
51
39
|
[],
|
|
52
|
-
[
|
|
40
|
+
["BACKSPACE", "UP", "RIGHT", "DOWN", "LEFT"],
|
|
53
41
|
);
|
|
54
42
|
};
|
|
55
43
|
|
|
@@ -107,7 +95,6 @@ export const createStore = () => {
|
|
|
107
95
|
const reducer = Redux.combineReducers({
|
|
108
96
|
input: inputReducer,
|
|
109
97
|
keypad: keypadReducer,
|
|
110
|
-
pager: pagerReducer,
|
|
111
98
|
gestures: gestureReducer,
|
|
112
99
|
echoes: echoReducer,
|
|
113
100
|
layout: layoutReducer,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {KeyType} from "../enums";
|
|
1
|
+
import KeyConfigs from "../../../data/key-configs";
|
|
2
|
+
import {CursorContext} from "../../input/cursor-contexts";
|
|
4
3
|
|
|
5
|
-
import type {Cursor, KeyHandler} from "
|
|
4
|
+
import type {Cursor, KeyHandler} from "../../../types";
|
|
6
5
|
import type {Action} from "./actions";
|
|
7
6
|
import type {InputState} from "./types";
|
|
8
7
|
|
|
@@ -29,7 +28,7 @@ const inputReducer = function (
|
|
|
29
28
|
|
|
30
29
|
case "PressKey":
|
|
31
30
|
const keyConfig = KeyConfigs[action.key];
|
|
32
|
-
if (keyConfig.type !==
|
|
31
|
+
if (keyConfig.type !== "KEYPAD_NAVIGATION") {
|
|
33
32
|
// This is probably an anti-pattern but it works for the
|
|
34
33
|
// case where we don't actually control the state but we
|
|
35
34
|
// still want to communicate with the other object
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import KeyConfigs from "
|
|
2
|
-
import Keys from "../data/keys";
|
|
1
|
+
import KeyConfigs from "../../../data/key-configs";
|
|
3
2
|
|
|
4
3
|
import {defaultKeypadType} from "./shared";
|
|
5
4
|
|
|
@@ -7,7 +6,7 @@ import type {Action} from "./actions";
|
|
|
7
6
|
import type {KeypadState} from "./types";
|
|
8
7
|
|
|
9
8
|
const initialKeypadState = {
|
|
10
|
-
extraKeys: ["x", "y",
|
|
9
|
+
extraKeys: ["x", "y", "THETA", "PI"] as const,
|
|
11
10
|
keypadType: defaultKeypadType,
|
|
12
11
|
active: false,
|
|
13
12
|
} as const;
|
|
@@ -46,7 +45,7 @@ const keypadReducer = function (
|
|
|
46
45
|
// right actions when they occur. Hence, we figure off a
|
|
47
46
|
// dismissal here rather than dispatching a dismiss action in
|
|
48
47
|
// the first place.
|
|
49
|
-
if (keyConfig.id ===
|
|
48
|
+
if (keyConfig.id === "DISMISS") {
|
|
50
49
|
return keypadReducer(state, {type: "DismissKeypad"});
|
|
51
50
|
}
|
|
52
51
|
return state;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import {DeviceOrientation, DeviceType, LayoutMode} from "../../../enums";
|
|
2
|
+
import {tabletCutoffPx} from "../../common-style";
|
|
3
|
+
import {computeLayoutParameters} from "../compute-layout-parameters";
|
|
4
4
|
|
|
5
5
|
import {defaultKeypadType, keypadForType} from "./shared";
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import {KeypadType} from "../../../enums";
|
|
2
|
+
import {expressionKeypadLayout} from "../expression-keypad";
|
|
3
|
+
import {fractionKeypadLayout} from "../fraction-keypad";
|
|
4
4
|
|
|
5
5
|
const defaultKeypadType = KeypadType.EXPRESSION;
|
|
6
6
|
|