@khanacademy/math-input 3.0.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/dist/components/input/__tests__/test-math-wrapper.d.ts +1 -1
- package/dist/components/input/__tests__/test-math-wrapper.js.flow +1 -1
- package/dist/components/input/key-handlers/handle-arrow.d.ts +3 -0
- package/dist/components/input/key-handlers/handle-arrow.js.flow +12 -0
- package/dist/components/input/key-handlers/handle-backspace.d.ts +7 -0
- package/dist/components/input/key-handlers/handle-backspace.js.flow +14 -0
- package/dist/components/input/key-handlers/handle-exponent.d.ts +3 -0
- package/dist/components/input/key-handlers/handle-exponent.js.flow +12 -0
- package/dist/components/input/key-handlers/handle-jump-out.d.ts +7 -0
- package/dist/components/input/key-handlers/handle-jump-out.js.flow +14 -0
- package/dist/components/input/math-wrapper.d.ts +7 -78
- package/dist/components/input/math-wrapper.js.flow +16 -78
- package/dist/components/input/mathquill-helpers.d.ts +46 -0
- package/dist/components/input/mathquill-helpers.js.flow +56 -0
- package/dist/components/input/mathquill-instance.d.ts +3 -0
- package/dist/components/input/mathquill-instance.js.flow +9 -0
- package/dist/components/input/mathquill-types.d.ts +25 -0
- package/dist/components/input/mathquill-types.js.flow +34 -0
- package/dist/components/key-translator.d.ts +4 -0
- package/dist/components/key-translator.js.flow +10 -0
- package/dist/components/keypad/button-assets.d.ts +2 -2
- package/dist/components/keypad/button-assets.js.flow +2 -2
- package/dist/components/keypad/keypad-page-items.d.ts +1 -1
- package/dist/components/keypad/keypad-page-items.js.flow +1 -1
- package/dist/components/keypad-legacy/gesture-manager.d.ts +21 -9
- package/dist/components/keypad-legacy/gesture-manager.js.flow +27 -12
- package/dist/components/keypad-legacy/gesture-state-machine.d.ts +9 -9
- package/dist/components/keypad-legacy/gesture-state-machine.js.flow +10 -10
- package/dist/components/keypad-legacy/keypad-button.d.ts +2 -2
- package/dist/components/keypad-legacy/keypad-button.js.flow +3 -3
- package/dist/components/keypad-legacy/store/actions.d.ts +4 -14
- package/dist/components/keypad-legacy/store/actions.js.flow +3 -15
- package/dist/components/keypad-legacy/store/types.d.ts +2 -2
- package/dist/components/keypad-legacy/store/types.js.flow +2 -2
- package/dist/components/keypad-legacy/touchable-keypad-button.d.ts +6 -6
- package/dist/components/keypad-legacy/touchable-keypad-button.js.flow +9 -14
- package/dist/data/key-configs.d.ts +3 -6
- package/dist/data/key-configs.js.flow +3 -8
- package/dist/data/keys.d.ts +2 -54
- package/dist/data/keys.js.flow +116 -55
- package/dist/enums.d.ts +2 -9
- package/dist/enums.js.flow +2 -11
- package/dist/es/index.js +1781 -1196
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2069 -1242
- package/dist/index.js.flow +4 -2
- package/dist/index.js.map +1 -1
- package/dist/strings.js +26 -10
- package/dist/types.d.ts +10 -12
- package/dist/types.js.flow +13 -12
- package/package.json +1 -1
- package/src/components/input/__tests__/context-tracking.test.ts +43 -44
- package/src/components/input/__tests__/mathquill.test.ts +133 -135
- package/src/components/input/key-handlers/handle-arrow.ts +70 -0
- package/src/components/input/key-handlers/handle-backspace.ts +275 -0
- package/src/components/input/key-handlers/handle-exponent.ts +52 -0
- package/src/components/input/key-handlers/handle-jump-out.ts +103 -0
- package/src/components/input/math-input.tsx +11 -12
- package/src/components/input/math-wrapper.ts +88 -837
- package/src/components/input/mathquill-helpers.ts +268 -0
- package/src/components/input/mathquill-instance.ts +5 -0
- package/src/components/input/mathquill-types.ts +55 -0
- package/src/components/key-translator.ts +209 -0
- package/src/components/keypad/button-assets.tsx +411 -100
- package/src/components/keypad/geometry-page/index.tsx +1 -1
- package/src/components/keypad/keypad-mathquill.stories.tsx +69 -0
- package/src/components/keypad/keypad-page-items.tsx +2 -1
- package/src/components/keypad/operators-page/index.tsx +1 -1
- package/src/components/keypad-legacy/echo-manager.tsx +4 -4
- package/src/components/keypad-legacy/empty-keypad-button.tsx +6 -4
- package/src/components/keypad-legacy/gesture-manager.ts +32 -9
- package/src/components/keypad-legacy/gesture-state-machine.ts +14 -14
- package/src/components/keypad-legacy/keypad-button.tsx +15 -18
- package/src/components/keypad-legacy/many-keypad-button.tsx +9 -2
- package/src/components/keypad-legacy/store/actions.ts +3 -29
- package/src/components/keypad-legacy/store/echo-reducer.ts +2 -5
- package/src/components/keypad-legacy/store/index.ts +4 -10
- package/src/components/keypad-legacy/store/input-reducer.ts +1 -2
- package/src/components/keypad-legacy/store/keypad-reducer.ts +2 -3
- package/src/components/keypad-legacy/store/types.ts +2 -2
- package/src/components/keypad-legacy/touchable-keypad-button.tsx +8 -13
- package/src/components/tabbar/icons.tsx +0 -2
- package/src/data/key-configs.ts +751 -304
- package/src/data/keys.ts +118 -65
- package/src/enums.ts +10 -9
- package/src/index.ts +3 -2
- package/src/math-input.stories.tsx +1 -1
- package/src/types.ts +10 -12
- package/tsconfig-build.tsbuildinfo +1 -1
|
@@ -3,46 +3,58 @@
|
|
|
3
3
|
* connects our various bits of logic for managing gestures and interactions,
|
|
4
4
|
* and links them together.
|
|
5
5
|
*/
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import Key from "../../data/keys";
|
|
8
|
+
import { ActiveNodesObj, LayoutProps } from "../../types";
|
|
6
9
|
import GestureStateMachine from "./gesture-state-machine";
|
|
7
10
|
import NodeManager from "./node-manager";
|
|
8
11
|
import PopoverStateMachine from "./popover-state-machine";
|
|
12
|
+
type Options = {
|
|
13
|
+
swipeEnabled: boolean;
|
|
14
|
+
};
|
|
15
|
+
type Handlers = {
|
|
16
|
+
onSwipeChange?: (dx: number) => void;
|
|
17
|
+
onSwipeEnd?: (dx: number) => void;
|
|
18
|
+
onActiveNodesChanged: (activeNodes: ActiveNodesObj) => void;
|
|
19
|
+
onClick: (key: Key, layoutProps: LayoutProps, inPopover: boolean) => void;
|
|
20
|
+
};
|
|
9
21
|
declare class GestureManager {
|
|
10
22
|
swipeEnabled: boolean;
|
|
11
23
|
trackEvents: boolean;
|
|
12
24
|
nodeManager: NodeManager;
|
|
13
25
|
popoverStateMachine: PopoverStateMachine;
|
|
14
26
|
gestureStateMachine: GestureStateMachine;
|
|
15
|
-
constructor(options:
|
|
27
|
+
constructor(options: Options, handlers: Handlers, disabledSwipeKeys: ReadonlyArray<Key>, multiPressableKeys: ReadonlyArray<Key>);
|
|
16
28
|
/**
|
|
17
29
|
* Handle a touch-start event that originated in a node registered with the
|
|
18
30
|
* gesture system.
|
|
19
31
|
*
|
|
20
|
-
* @param {TouchEvent} evt - the raw touch event from the browser
|
|
32
|
+
* @param {React.TouchEvent<HTMLDivElement>} evt - the raw touch event from the browser
|
|
21
33
|
* @param {string} id - the identifier of the DOM node in which the touch
|
|
22
34
|
* occurred
|
|
23
35
|
*/
|
|
24
|
-
onTouchStart(evt: TouchEvent
|
|
36
|
+
onTouchStart(evt: React.TouchEvent<HTMLDivElement>, id?: string | undefined): void;
|
|
25
37
|
/**
|
|
26
38
|
* Handle a touch-move event that originated in a node registered with the
|
|
27
39
|
* gesture system.
|
|
28
40
|
*
|
|
29
|
-
* @param {TouchEvent} evt - the raw touch event from the browser
|
|
41
|
+
* @param {React.TouchEvent<HTMLDivElement>} evt - the raw touch event from the browser
|
|
30
42
|
*/
|
|
31
|
-
onTouchMove(evt: TouchEvent): void;
|
|
43
|
+
onTouchMove(evt: React.TouchEvent<HTMLDivElement>): void;
|
|
32
44
|
/**
|
|
33
45
|
* Handle a touch-end event that originated in a node registered with the
|
|
34
46
|
* gesture system.
|
|
35
47
|
*
|
|
36
|
-
* @param {TouchEvent} evt - the raw touch event from the browser
|
|
48
|
+
* @param {React.TouchEvent<HTMLDivElement>} evt - the raw touch event from the browser
|
|
37
49
|
*/
|
|
38
|
-
onTouchEnd(evt: TouchEvent): void;
|
|
50
|
+
onTouchEnd(evt: React.TouchEvent<HTMLDivElement>): void;
|
|
39
51
|
/**
|
|
40
52
|
* Handle a touch-cancel event that originated in a node registered with the
|
|
41
53
|
* gesture system.
|
|
42
54
|
*
|
|
43
|
-
* @param {TouchEvent} evt - the raw touch event from the browser
|
|
55
|
+
* @param {React.TouchEvent<HTMLDivElement>} evt - the raw touch event from the browser
|
|
44
56
|
*/
|
|
45
|
-
onTouchCancel(evt: TouchEvent): void;
|
|
57
|
+
onTouchCancel(evt: React.TouchEvent<HTMLDivElement>): void;
|
|
46
58
|
/**
|
|
47
59
|
* Register a DOM node with a given identifier.
|
|
48
60
|
*
|
|
@@ -4,9 +4,21 @@
|
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
import Key from "../../data/keys";
|
|
9
|
+
import { ActiveNodesObj, LayoutProps } from "../../types";
|
|
7
10
|
import GestureStateMachine from "./gesture-state-machine";
|
|
8
11
|
import NodeManager from "./node-manager";
|
|
9
12
|
import PopoverStateMachine from "./popover-state-machine";
|
|
13
|
+
declare type Options = {|
|
|
14
|
+
swipeEnabled: boolean,
|
|
15
|
+
|};
|
|
16
|
+
declare type Handlers = {|
|
|
17
|
+
onSwipeChange?: (dx: number) => void,
|
|
18
|
+
onSwipeEnd?: (dx: number) => void,
|
|
19
|
+
onActiveNodesChanged: (activeNodes: ActiveNodesObj) => void,
|
|
20
|
+
onClick: (key: Key, layoutProps: LayoutProps, inPopover: boolean) => void,
|
|
21
|
+
|};
|
|
10
22
|
declare class GestureManager {
|
|
11
23
|
swipeEnabled: boolean;
|
|
12
24
|
trackEvents: boolean;
|
|
@@ -14,41 +26,44 @@ declare class GestureManager {
|
|
|
14
26
|
popoverStateMachine: PopoverStateMachine;
|
|
15
27
|
gestureStateMachine: GestureStateMachine;
|
|
16
28
|
constructor(
|
|
17
|
-
options:
|
|
18
|
-
handlers:
|
|
19
|
-
disabledSwipeKeys:
|
|
20
|
-
multiPressableKeys:
|
|
29
|
+
options: Options,
|
|
30
|
+
handlers: Handlers,
|
|
31
|
+
disabledSwipeKeys: $ReadOnlyArray<Key>,
|
|
32
|
+
multiPressableKeys: $ReadOnlyArray<Key>
|
|
21
33
|
): this;
|
|
22
34
|
|
|
23
35
|
/**
|
|
24
36
|
* Handle a touch-start event that originated in a node registered with the
|
|
25
37
|
* gesture system.
|
|
26
|
-
* @param {
|
|
38
|
+
* @param {SyntheticTouchEvent<HTMLDivElement>} evt - the raw touch event from the browser
|
|
27
39
|
* @param {string} id - the identifier of the DOM node in which the touch
|
|
28
40
|
* occurred
|
|
29
41
|
*/
|
|
30
|
-
onTouchStart(
|
|
42
|
+
onTouchStart(
|
|
43
|
+
evt: SyntheticTouchEvent<HTMLDivElement>,
|
|
44
|
+
id?: string | void
|
|
45
|
+
): void;
|
|
31
46
|
|
|
32
47
|
/**
|
|
33
48
|
* Handle a touch-move event that originated in a node registered with the
|
|
34
49
|
* gesture system.
|
|
35
|
-
* @param {
|
|
50
|
+
* @param {SyntheticTouchEvent<HTMLDivElement>} evt - the raw touch event from the browser
|
|
36
51
|
*/
|
|
37
|
-
onTouchMove(evt:
|
|
52
|
+
onTouchMove(evt: SyntheticTouchEvent<HTMLDivElement>): void;
|
|
38
53
|
|
|
39
54
|
/**
|
|
40
55
|
* Handle a touch-end event that originated in a node registered with the
|
|
41
56
|
* gesture system.
|
|
42
|
-
* @param {
|
|
57
|
+
* @param {SyntheticTouchEvent<HTMLDivElement>} evt - the raw touch event from the browser
|
|
43
58
|
*/
|
|
44
|
-
onTouchEnd(evt:
|
|
59
|
+
onTouchEnd(evt: SyntheticTouchEvent<HTMLDivElement>): void;
|
|
45
60
|
|
|
46
61
|
/**
|
|
47
62
|
* Handle a touch-cancel event that originated in a node registered with the
|
|
48
63
|
* gesture system.
|
|
49
|
-
* @param {
|
|
64
|
+
* @param {SyntheticTouchEvent<HTMLDivElement>} evt - the raw touch event from the browser
|
|
50
65
|
*/
|
|
51
|
-
onTouchCancel(evt:
|
|
66
|
+
onTouchCancel(evt: SyntheticTouchEvent<HTMLDivElement>): void;
|
|
52
67
|
|
|
53
68
|
/**
|
|
54
69
|
* Register a DOM node with a given identifier.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Key from "../../data/keys";
|
|
2
2
|
/**
|
|
3
3
|
* The state machine that backs our gesture system. In particular, this state
|
|
4
4
|
* machine manages the interplay between focuses, touch ups, and swiping.
|
|
@@ -11,8 +11,8 @@ export type Handlers = {
|
|
|
11
11
|
onBlur: () => void;
|
|
12
12
|
onTrigger: (id: string) => void;
|
|
13
13
|
onLongPress: (id: string) => void;
|
|
14
|
-
onSwipeChange
|
|
15
|
-
onSwipeEnd
|
|
14
|
+
onSwipeChange?: (x: number) => void;
|
|
15
|
+
onSwipeEnd?: (x: number) => void;
|
|
16
16
|
onTouchEnd: (id: string) => void;
|
|
17
17
|
};
|
|
18
18
|
type Options = {
|
|
@@ -21,25 +21,25 @@ type Options = {
|
|
|
21
21
|
holdIntervalMs: number;
|
|
22
22
|
};
|
|
23
23
|
type TouchState = {
|
|
24
|
-
activeNodeId:
|
|
24
|
+
activeNodeId: Key;
|
|
25
25
|
pressAndHoldIntervalId: number | null;
|
|
26
26
|
longPressTimeoutId: number | null;
|
|
27
27
|
swipeLocked: boolean;
|
|
28
28
|
startX: number;
|
|
29
29
|
};
|
|
30
|
-
type TouchStateMap = Record<
|
|
30
|
+
type TouchStateMap = Record<Key, TouchState>;
|
|
31
31
|
type SwipeState = {
|
|
32
|
-
touchId:
|
|
32
|
+
touchId: Key;
|
|
33
33
|
startX: number;
|
|
34
34
|
};
|
|
35
35
|
declare class GestureStateMachine {
|
|
36
36
|
handlers: Handlers;
|
|
37
37
|
options: Options;
|
|
38
|
-
swipeDisabledNodeIds:
|
|
39
|
-
multiPressableKeys:
|
|
38
|
+
swipeDisabledNodeIds: ReadonlyArray<Key>;
|
|
39
|
+
multiPressableKeys: ReadonlyArray<Key>;
|
|
40
40
|
touchState: Partial<TouchStateMap>;
|
|
41
41
|
swipeState: SwipeState | null;
|
|
42
|
-
constructor(handlers: Handlers, options: Partial<Options>, swipeDisabledNodeIds?:
|
|
42
|
+
constructor(handlers: Handlers, options: Partial<Options>, swipeDisabledNodeIds?: ReadonlyArray<Key>, multiPressableKeys?: ReadonlyArray<Key>);
|
|
43
43
|
_maybeCancelLongPressForTouch(touchId: any): void;
|
|
44
44
|
_maybeCancelPressAndHoldForTouch(touchId: any): void;
|
|
45
45
|
_cleanupTouchEvent(touchId: any): void;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
-
import
|
|
7
|
+
import Key from "../../data/keys";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* The state machine that backs our gesture system. In particular, this state
|
|
@@ -18,8 +18,8 @@ export type Handlers = {|
|
|
|
18
18
|
onBlur: () => void,
|
|
19
19
|
onTrigger: (id: string) => void,
|
|
20
20
|
onLongPress: (id: string) => void,
|
|
21
|
-
onSwipeChange
|
|
22
|
-
onSwipeEnd
|
|
21
|
+
onSwipeChange?: (x: number) => void,
|
|
22
|
+
onSwipeEnd?: (x: number) => void,
|
|
23
23
|
onTouchEnd: (id: string) => void,
|
|
24
24
|
|};
|
|
25
25
|
declare type Options = {|
|
|
@@ -28,29 +28,29 @@ declare type Options = {|
|
|
|
28
28
|
holdIntervalMs: number,
|
|
29
29
|
|};
|
|
30
30
|
declare type TouchState = {|
|
|
31
|
-
activeNodeId:
|
|
31
|
+
activeNodeId: Key,
|
|
32
32
|
pressAndHoldIntervalId: number | null,
|
|
33
33
|
longPressTimeoutId: number | null,
|
|
34
34
|
swipeLocked: boolean,
|
|
35
35
|
startX: number,
|
|
36
36
|
|};
|
|
37
|
-
declare type TouchStateMap = { [key:
|
|
37
|
+
declare type TouchStateMap = { [key: Key]: TouchState };
|
|
38
38
|
declare type SwipeState = {|
|
|
39
|
-
touchId:
|
|
39
|
+
touchId: Key,
|
|
40
40
|
startX: number,
|
|
41
41
|
|};
|
|
42
42
|
declare class GestureStateMachine {
|
|
43
43
|
handlers: Handlers;
|
|
44
44
|
options: Options;
|
|
45
|
-
swipeDisabledNodeIds: $
|
|
46
|
-
multiPressableKeys: $
|
|
45
|
+
swipeDisabledNodeIds: $ReadOnlyArray<Key>;
|
|
46
|
+
multiPressableKeys: $ReadOnlyArray<Key>;
|
|
47
47
|
touchState: $Rest<TouchStateMap, {}>;
|
|
48
48
|
swipeState: SwipeState | null;
|
|
49
49
|
constructor(
|
|
50
50
|
handlers: Handlers,
|
|
51
51
|
options: $Rest<Options, {}>,
|
|
52
|
-
swipeDisabledNodeIds?:
|
|
53
|
-
multiPressableKeys?:
|
|
52
|
+
swipeDisabledNodeIds?: $ReadOnlyArray<Key>,
|
|
53
|
+
multiPressableKeys?: $ReadOnlyArray<Key>
|
|
54
54
|
): this;
|
|
55
55
|
_maybeCancelLongPressForTouch(touchId: any): void;
|
|
56
56
|
_maybeCancelPressAndHoldForTouch(touchId: any): void;
|
|
@@ -17,7 +17,7 @@ interface Props extends ReduxProps {
|
|
|
17
17
|
focused: boolean;
|
|
18
18
|
popoverEnabled: boolean;
|
|
19
19
|
type: KeyType;
|
|
20
|
-
icon
|
|
20
|
+
icon?: IconConfig;
|
|
21
21
|
style?: StyleType;
|
|
22
22
|
onTouchCancel?: (evt: React.TouchEvent<HTMLDivElement>) => void;
|
|
23
23
|
onTouchEnd?: (evt: React.TouchEvent<HTMLDivElement>) => void;
|
|
@@ -42,7 +42,7 @@ declare class KeypadButton extends React.PureComponent<Props> {
|
|
|
42
42
|
_getButtonStyle: (type: any, borders: any, style?: any) => any[];
|
|
43
43
|
render(): JSX.Element;
|
|
44
44
|
}
|
|
45
|
-
declare const _default: import("react-redux").ConnectedComponent<typeof KeypadButton, import("react-redux").Omit<Pick<React.ClassAttributes<KeypadButton> & Props, "style" | "ref" | "ariaLabel" | "onTouchCancel" | "onTouchEnd" | "onTouchMove" | "onTouchStart" | "
|
|
45
|
+
declare const _default: import("react-redux").ConnectedComponent<typeof KeypadButton, import("react-redux").Omit<Pick<React.ClassAttributes<KeypadButton> & Props, "style" | "ref" | "ariaLabel" | "onTouchCancel" | "onTouchEnd" | "onTouchMove" | "onTouchStart" | "type" | "icon" | "key" | "heightPx" | "widthPx"> & {
|
|
46
46
|
focused?: boolean | undefined;
|
|
47
47
|
borders?: readonly (BorderDirection | undefined)[] | undefined;
|
|
48
48
|
childKeys?: readonly NonManyKeyConfig[] | undefined;
|
|
@@ -21,7 +21,7 @@ declare type Props = {
|
|
|
21
21
|
focused: boolean,
|
|
22
22
|
popoverEnabled: boolean,
|
|
23
23
|
type: KeyType,
|
|
24
|
-
icon
|
|
24
|
+
icon?: IconConfig,
|
|
25
25
|
style?: StyleType,
|
|
26
26
|
onTouchCancel?: (evt: SyntheticTouchEvent<HTMLDivElement>) => void,
|
|
27
27
|
onTouchEnd?: (evt: SyntheticTouchEvent<HTMLDivElement>) => void,
|
|
@@ -59,11 +59,11 @@ declare var _default: $Flowgen$Import$react_2d_redux.ConnectedComponent<
|
|
|
59
59
|
| "onTouchEnd"
|
|
60
60
|
| "onTouchMove"
|
|
61
61
|
| "onTouchStart"
|
|
62
|
-
| "icon"
|
|
63
62
|
| "type"
|
|
63
|
+
| "icon"
|
|
64
|
+
| "key"
|
|
64
65
|
| "heightPx"
|
|
65
66
|
| "widthPx"
|
|
66
|
-
| "key"
|
|
67
67
|
>,
|
|
68
68
|
...{|
|
|
69
69
|
focused?: boolean | void,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Key from "../../../data/keys";
|
|
2
2
|
import type { Bound, KeypadConfiguration, KeyHandler, Cursor, ActiveNodesObj } from "../../../types";
|
|
3
3
|
type DismissKeypadAction = {
|
|
4
4
|
type: "DismissKeypad";
|
|
@@ -37,16 +37,6 @@ type SetCursorAction = {
|
|
|
37
37
|
cursor: Cursor;
|
|
38
38
|
};
|
|
39
39
|
export declare const setCursor: (cursor: Cursor) => SetCursorAction;
|
|
40
|
-
type OnSwipeChangeAction = {
|
|
41
|
-
type: "OnSwipeChange";
|
|
42
|
-
dx: number;
|
|
43
|
-
};
|
|
44
|
-
export declare const onSwipeChange: (dx: number) => OnSwipeChangeAction;
|
|
45
|
-
type OnSwipeEndAction = {
|
|
46
|
-
type: "OnSwipeEnd";
|
|
47
|
-
dx: number;
|
|
48
|
-
};
|
|
49
|
-
export declare const onSwipeEnd: (dx: number) => OnSwipeEndAction;
|
|
50
40
|
type SetActiveNodesAction = {
|
|
51
41
|
type: "SetActiveNodes";
|
|
52
42
|
activeNodes: any;
|
|
@@ -54,10 +44,10 @@ type SetActiveNodesAction = {
|
|
|
54
44
|
export declare const setActiveNodes: (activeNodes: ActiveNodesObj) => SetActiveNodesAction;
|
|
55
45
|
type PressKeyAction = {
|
|
56
46
|
type: "PressKey";
|
|
57
|
-
key:
|
|
47
|
+
key: Key;
|
|
58
48
|
initialBounds: Bound;
|
|
59
49
|
inPopover: boolean;
|
|
60
50
|
};
|
|
61
|
-
export declare const pressKey: (key:
|
|
62
|
-
export type Action = DismissKeypadAction | ActivateKeypadAction | ConfigureKeypadAction | SetPageSizeAction | RemoveEchoAction | SetKeyHandlerAction | SetCursorAction |
|
|
51
|
+
export declare const pressKey: (key: Key, initialBounds: Bound, inPopover: any) => PressKeyAction;
|
|
52
|
+
export type Action = DismissKeypadAction | ActivateKeypadAction | ConfigureKeypadAction | SetPageSizeAction | RemoveEchoAction | SetKeyHandlerAction | SetCursorAction | SetActiveNodesAction | PressKeyAction;
|
|
63
53
|
export {};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
-
import
|
|
7
|
+
import Key from "../../../data/keys";
|
|
8
8
|
import type {
|
|
9
9
|
Bound,
|
|
10
10
|
KeypadConfiguration,
|
|
@@ -56,16 +56,6 @@ declare type SetCursorAction = {|
|
|
|
56
56
|
cursor: Cursor,
|
|
57
57
|
|};
|
|
58
58
|
declare export var setCursor: (cursor: Cursor) => SetCursorAction;
|
|
59
|
-
declare type OnSwipeChangeAction = {|
|
|
60
|
-
type: "OnSwipeChange",
|
|
61
|
-
dx: number,
|
|
62
|
-
|};
|
|
63
|
-
declare export var onSwipeChange: (dx: number) => OnSwipeChangeAction;
|
|
64
|
-
declare type OnSwipeEndAction = {|
|
|
65
|
-
type: "OnSwipeEnd",
|
|
66
|
-
dx: number,
|
|
67
|
-
|};
|
|
68
|
-
declare export var onSwipeEnd: (dx: number) => OnSwipeEndAction;
|
|
69
59
|
declare type SetActiveNodesAction = {|
|
|
70
60
|
type: "SetActiveNodes",
|
|
71
61
|
activeNodes: any,
|
|
@@ -75,12 +65,12 @@ declare export var setActiveNodes: (
|
|
|
75
65
|
) => SetActiveNodesAction;
|
|
76
66
|
declare type PressKeyAction = {|
|
|
77
67
|
type: "PressKey",
|
|
78
|
-
key:
|
|
68
|
+
key: Key,
|
|
79
69
|
initialBounds: Bound,
|
|
80
70
|
inPopover: boolean,
|
|
81
71
|
|};
|
|
82
72
|
declare export var pressKey: (
|
|
83
|
-
key:
|
|
73
|
+
key: Key,
|
|
84
74
|
initialBounds: Bound,
|
|
85
75
|
inPopover: any
|
|
86
76
|
) => PressKeyAction;
|
|
@@ -92,7 +82,5 @@ export type Action =
|
|
|
92
82
|
| RemoveEchoAction
|
|
93
83
|
| SetKeyHandlerAction
|
|
94
84
|
| SetCursorAction
|
|
95
|
-
| OnSwipeChangeAction
|
|
96
|
-
| OnSwipeEndAction
|
|
97
85
|
| SetActiveNodesAction
|
|
98
86
|
| PressKeyAction;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Key from "../../../data/keys";
|
|
2
2
|
import { LayoutMode, KeypadType } from "../../../enums";
|
|
3
3
|
import GestureManager from "../gesture-manager";
|
|
4
4
|
import type { Cursor, KeyHandler, Popover, Echo } from "../../../types";
|
|
@@ -13,7 +13,7 @@ export interface KeypadState {
|
|
|
13
13
|
}
|
|
14
14
|
export interface GestureState {
|
|
15
15
|
popover: Popover | null;
|
|
16
|
-
focus:
|
|
16
|
+
focus: Key | null;
|
|
17
17
|
gestureManager: GestureManager;
|
|
18
18
|
}
|
|
19
19
|
export interface EchoState {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
-
import
|
|
7
|
+
import Key from "../../../data/keys";
|
|
8
8
|
import { LayoutMode, KeypadType } from "../../../enums";
|
|
9
9
|
import GestureManager from "../gesture-manager";
|
|
10
10
|
import type { Cursor, KeyHandler, Popover, Echo } from "../../../types";
|
|
@@ -19,7 +19,7 @@ export interface KeypadState {
|
|
|
19
19
|
}
|
|
20
20
|
export interface GestureState {
|
|
21
21
|
popover: Popover | null;
|
|
22
|
-
focus:
|
|
22
|
+
focus: Key | null;
|
|
23
23
|
gestureManager: GestureManager;
|
|
24
24
|
}
|
|
25
25
|
export interface EchoState {
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* touch events globally) opaque to the KeypadButton.
|
|
5
5
|
*/
|
|
6
6
|
import * as React from "react";
|
|
7
|
-
import
|
|
7
|
+
import Key from "../../data/keys";
|
|
8
8
|
import { KeyType } from "../../enums";
|
|
9
9
|
import GestureManager from "./gesture-manager";
|
|
10
|
-
import type { Border, IconConfig, KeyConfig
|
|
10
|
+
import type { Border, IconConfig, KeyConfig } from "../../types";
|
|
11
11
|
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
12
12
|
interface SharedProps {
|
|
13
13
|
borders?: Border;
|
|
@@ -20,12 +20,12 @@ interface OwnProps extends SharedProps {
|
|
|
20
20
|
interface Props extends SharedProps {
|
|
21
21
|
childKeyIds?: ReadonlyArray<string>;
|
|
22
22
|
gestureManager: GestureManager;
|
|
23
|
-
id:
|
|
23
|
+
id: Key;
|
|
24
24
|
focused: boolean;
|
|
25
25
|
popoverEnabled: boolean;
|
|
26
|
-
childKeys?: ReadonlyArray<
|
|
26
|
+
childKeys?: ReadonlyArray<KeyConfig>;
|
|
27
27
|
ariaLabel?: string;
|
|
28
|
-
icon
|
|
28
|
+
icon?: IconConfig;
|
|
29
29
|
type: KeyType;
|
|
30
30
|
}
|
|
31
31
|
declare class TouchableKeypadButton extends React.Component<Props> {
|
|
@@ -33,5 +33,5 @@ declare class TouchableKeypadButton extends React.Component<Props> {
|
|
|
33
33
|
componentWillUnmount(): void;
|
|
34
34
|
render(): JSX.Element;
|
|
35
35
|
}
|
|
36
|
-
declare const _default: import("react-redux").ConnectedComponent<typeof TouchableKeypadButton, import("react-redux").Omit<React.ClassAttributes<TouchableKeypadButton> & Props, "style" | "ariaLabel" | "
|
|
36
|
+
declare const _default: import("react-redux").ConnectedComponent<typeof TouchableKeypadButton, import("react-redux").Omit<React.ClassAttributes<TouchableKeypadButton> & Props, "style" | "ariaLabel" | "type" | "id" | "icon" | "childKeyIds" | "focused" | "borders" | "childKeys" | "disabled" | "popoverEnabled" | "gestureManager"> & OwnProps>;
|
|
37
37
|
export default _default;
|
|
@@ -6,15 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import * as $Flowgen$Import$react_2d_redux from "react-redux";
|
|
8
8
|
import * as React from "react";
|
|
9
|
-
import
|
|
9
|
+
import Key from "../../data/keys";
|
|
10
10
|
import { KeyType } from "../../enums";
|
|
11
11
|
import GestureManager from "./gesture-manager";
|
|
12
|
-
import type {
|
|
13
|
-
Border,
|
|
14
|
-
IconConfig,
|
|
15
|
-
KeyConfig,
|
|
16
|
-
NonManyKeyConfig,
|
|
17
|
-
} from "../../types";
|
|
12
|
+
import type { Border, IconConfig, KeyConfig } from "../../types";
|
|
18
13
|
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
19
14
|
declare interface SharedProps {
|
|
20
15
|
borders?: Border;
|
|
@@ -27,12 +22,12 @@ declare type OwnProps = {
|
|
|
27
22
|
declare type Props = {
|
|
28
23
|
childKeyIds?: $ReadOnlyArray<string>,
|
|
29
24
|
gestureManager: GestureManager,
|
|
30
|
-
id:
|
|
25
|
+
id: Key,
|
|
31
26
|
focused: boolean,
|
|
32
27
|
popoverEnabled: boolean,
|
|
33
|
-
childKeys?: $ReadOnlyArray<
|
|
28
|
+
childKeys?: $ReadOnlyArray<KeyConfig>,
|
|
34
29
|
ariaLabel?: string,
|
|
35
|
-
icon
|
|
30
|
+
icon?: IconConfig,
|
|
36
31
|
type: KeyType,
|
|
37
32
|
} & SharedProps;
|
|
38
33
|
declare class TouchableKeypadButton extends React.Component<Props> {
|
|
@@ -47,16 +42,16 @@ declare var _default: $Flowgen$Import$react_2d_redux.ConnectedComponent<
|
|
|
47
42
|
{| ...React.ClassAttributes<TouchableKeypadButton>, ...Props |},
|
|
48
43
|
| "style"
|
|
49
44
|
| "ariaLabel"
|
|
50
|
-
| "
|
|
45
|
+
| "type"
|
|
46
|
+
| "id"
|
|
51
47
|
| "icon"
|
|
48
|
+
| "childKeyIds"
|
|
49
|
+
| "focused"
|
|
52
50
|
| "borders"
|
|
53
51
|
| "childKeys"
|
|
54
52
|
| "disabled"
|
|
55
53
|
| "popoverEnabled"
|
|
56
|
-
| "type"
|
|
57
54
|
| "gestureManager"
|
|
58
|
-
| "childKeyIds"
|
|
59
|
-
| "id"
|
|
60
55
|
>,
|
|
61
56
|
...OwnProps,
|
|
62
57
|
|}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
type: string;
|
|
4
|
-
ariaLabel: string;
|
|
5
|
-
};
|
|
1
|
+
import { KeyConfig } from "../types";
|
|
2
|
+
import Key from "./keys";
|
|
6
3
|
declare const KeyConfigs: {
|
|
7
|
-
[key
|
|
4
|
+
[key in Key]: KeyConfig;
|
|
8
5
|
};
|
|
9
6
|
export default KeyConfigs;
|
|
@@ -4,12 +4,7 @@
|
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
ariaLabel: string,
|
|
11
|
-
|};
|
|
12
|
-
declare var KeyConfigs: {
|
|
13
|
-
[key: string]: any,
|
|
14
|
-
};
|
|
7
|
+
import { KeyConfig } from "../types";
|
|
8
|
+
import Key from "./keys";
|
|
9
|
+
declare var KeyConfigs: $ObjMapi<{ [k: Key]: any }, <key>(key) => KeyConfig>;
|
|
15
10
|
declare export default typeof KeyConfigs;
|
package/dist/data/keys.d.ts
CHANGED
|
@@ -1,54 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* alphanumeric characters.
|
|
4
|
-
*/
|
|
5
|
-
declare enum Keys {
|
|
6
|
-
PLUS = "PLUS",
|
|
7
|
-
MINUS = "MINUS",
|
|
8
|
-
NEGATIVE = "NEGATIVE",
|
|
9
|
-
TIMES = "TIMES",
|
|
10
|
-
DIVIDE = "DIVIDE",
|
|
11
|
-
DECIMAL = "DECIMAL",
|
|
12
|
-
PERIOD = "PERIOD",
|
|
13
|
-
PERCENT = "PERCENT",
|
|
14
|
-
CDOT = "CDOT",
|
|
15
|
-
EQUAL = "EQUAL",
|
|
16
|
-
NEQ = "NEQ",
|
|
17
|
-
GT = "GT",
|
|
18
|
-
LT = "LT",
|
|
19
|
-
GEQ = "GEQ",
|
|
20
|
-
LEQ = "LEQ",
|
|
21
|
-
FRAC_INCLUSIVE = "FRAC_INCLUSIVE",
|
|
22
|
-
FRAC_EXCLUSIVE = "FRAC_EXCLUSIVE",
|
|
23
|
-
FRAC = "FRAC",
|
|
24
|
-
EXP = "EXP",
|
|
25
|
-
EXP_2 = "EXP_2",
|
|
26
|
-
EXP_3 = "EXP_3",
|
|
27
|
-
SQRT = "SQRT",
|
|
28
|
-
CUBE_ROOT = "CUBE_ROOT",
|
|
29
|
-
RADICAL = "RADICAL",
|
|
30
|
-
LEFT_PAREN = "LEFT_PAREN",
|
|
31
|
-
RIGHT_PAREN = "RIGHT_PAREN",
|
|
32
|
-
LN = "LN",
|
|
33
|
-
LOG = "LOG",
|
|
34
|
-
LOG_N = "LOG_N",
|
|
35
|
-
SIN = "SIN",
|
|
36
|
-
COS = "COS",
|
|
37
|
-
TAN = "TAN",
|
|
38
|
-
PI = "PI",
|
|
39
|
-
THETA = "THETA",
|
|
40
|
-
UP = "UP",
|
|
41
|
-
RIGHT = "RIGHT",
|
|
42
|
-
DOWN = "DOWN",
|
|
43
|
-
LEFT = "LEFT",
|
|
44
|
-
BACKSPACE = "BACKSPACE",
|
|
45
|
-
DISMISS = "DISMISS",
|
|
46
|
-
JUMP_OUT_PARENTHESES = "JUMP_OUT_PARENTHESES",
|
|
47
|
-
JUMP_OUT_EXPONENT = "JUMP_OUT_EXPONENT",
|
|
48
|
-
JUMP_OUT_BASE = "JUMP_OUT_BASE",
|
|
49
|
-
JUMP_INTO_NUMERATOR = "JUMP_INTO_NUMERATOR",
|
|
50
|
-
JUMP_OUT_NUMERATOR = "JUMP_OUT_NUMERATOR",
|
|
51
|
-
JUMP_OUT_DENOMINATOR = "JUMP_OUT_DENOMINATOR",
|
|
52
|
-
NOOP = "NOOP"
|
|
53
|
-
}
|
|
54
|
-
export default Keys;
|
|
1
|
+
type Key = "PLUS" | "MINUS" | "NEGATIVE" | "TIMES" | "DIVIDE" | "DECIMAL" | "PERIOD" | "PERCENT" | "CDOT" | "EQUAL" | "NEQ" | "GT" | "LT" | "GEQ" | "LEQ" | "FRAC_INCLUSIVE" | "FRAC_EXCLUSIVE" | "FRAC" | "EXP" | "EXP_2" | "EXP_3" | "SQRT" | "CUBE_ROOT" | "RADICAL" | "LEFT_PAREN" | "RIGHT_PAREN" | "LN" | "LOG" | "LOG_N" | "SIN" | "COS" | "TAN" | "PI" | "THETA" | "UP" | "RIGHT" | "DOWN" | "LEFT" | "BACKSPACE" | "DISMISS" | "JUMP_OUT_PARENTHESES" | "JUMP_OUT_EXPONENT" | "JUMP_OUT_BASE" | "JUMP_INTO_NUMERATOR" | "JUMP_OUT_NUMERATOR" | "JUMP_OUT_DENOMINATOR" | "NOOP" | "MANY" | "NUM_0" | "NUM_1" | "NUM_2" | "NUM_3" | "NUM_4" | "NUM_5" | "NUM_6" | "NUM_7" | "NUM_8" | "NUM_9" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" | "PHI" | "NTHROOT3" | "POW" | "LOG_B";
|
|
2
|
+
export default Key;
|