@khanacademy/math-input 1.0.1 → 2.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 +5 -1
- package/dist/components/compute-layout-parameters.d.ts +2 -1
- package/dist/components/compute-layout-parameters.js.flow +2 -21
- package/dist/components/echo-manager.d.ts +4 -4
- package/dist/components/echo-manager.js.flow +4 -4
- package/dist/components/expression-keypad.d.ts +1 -1
- package/dist/components/expression-keypad.js.flow +1 -1
- package/dist/components/fraction-keypad.d.ts +1 -1
- package/dist/components/fraction-keypad.js.flow +1 -1
- package/dist/components/gesture-state-machine.d.ts +7 -7
- package/dist/components/gesture-state-machine.js.flow +8 -8
- package/dist/components/icon.d.ts +2 -2
- package/dist/components/icon.js.flow +2 -2
- package/dist/components/input/cursor-contexts.d.ts +10 -9
- package/dist/components/input/cursor-contexts.js.flow +11 -16
- package/dist/components/input/math-wrapper.d.ts +3 -2
- package/dist/components/input/math-wrapper.js.flow +3 -16
- package/dist/components/keypad-button.d.ts +8 -8
- package/dist/components/keypad-button.js.flow +10 -9
- package/dist/components/keypad-container.d.ts +2 -3
- package/dist/components/keypad-container.js.flow +2 -3
- package/dist/components/keypad.d.ts +1 -1
- package/dist/components/keypad.js.flow +1 -1
- package/dist/components/multi-symbol-grid.d.ts +2 -2
- package/dist/components/multi-symbol-grid.js.flow +2 -2
- package/dist/components/styles.d.ts +1 -2
- package/dist/components/styles.js.flow +1 -3
- package/dist/components/touchable-keypad-button.d.ts +6 -6
- package/dist/components/touchable-keypad-button.js.flow +6 -6
- package/dist/data/keys.d.ts +51 -52
- package/dist/data/keys.js.flow +50 -99
- package/dist/enums.d.ts +49 -0
- package/dist/enums.js.flow +63 -0
- package/dist/es/index.js +362 -391
- package/dist/es/index.js.map +1 -1
- package/dist/fake-react-native-web/view.d.ts +1 -2
- package/dist/fake-react-native-web/view.js.flow +1 -2
- package/dist/index.d.ts +3 -6
- package/dist/index.js +379 -406
- package/dist/index.js.flow +3 -6
- package/dist/index.js.map +1 -1
- package/dist/store/actions.d.ts +3 -3
- package/dist/store/actions.js.flow +5 -4
- package/dist/store/shared.d.ts +2 -1
- package/dist/store/shared.js.flow +2 -1
- package/dist/store/types.d.ts +4 -5
- package/dist/store/types.js.flow +4 -5
- package/dist/types.d.ts +15 -16
- package/dist/types.js.flow +20 -20
- package/package.json +1 -1
- package/src/components/compute-layout-parameters.ts +6 -6
- package/src/components/echo-manager.tsx +10 -10
- package/src/components/expression-keypad.tsx +9 -10
- package/src/components/fraction-keypad.tsx +11 -12
- package/src/components/gesture-state-machine.ts +8 -8
- package/src/components/icon.tsx +6 -6
- package/src/components/input/__tests__/context-tracking.test.ts +20 -20
- package/src/components/input/cursor-contexts.ts +22 -29
- package/src/components/input/math-wrapper.ts +75 -67
- package/src/components/keypad-button.tsx +20 -21
- package/src/components/keypad-container.tsx +8 -9
- package/src/components/many-keypad-button.tsx +2 -2
- package/src/components/multi-symbol-grid.tsx +4 -5
- package/src/components/multi-symbol-popover.tsx +1 -1
- package/src/components/navigation-pad.tsx +1 -1
- package/src/components/touchable-keypad-button.tsx +7 -7
- package/src/data/key-configs.ts +58 -58
- package/src/data/keys.ts +53 -105
- package/src/enums.ts +74 -0
- package/src/index.ts +3 -9
- package/src/math-input.stories.tsx +8 -8
- package/src/store/actions.ts +4 -3
- package/src/store/echo-reducer.ts +5 -5
- package/src/store/index.ts +1 -2
- package/src/store/input-reducer.ts +4 -4
- package/src/store/layout-reducer.ts +9 -9
- package/src/store/pager-reducer.ts +3 -3
- package/src/store/shared.ts +4 -4
- package/src/store/types.ts +4 -5
- package/src/types.ts +20 -20
- package/src/utils.ts +3 -3
- package/tsconfig-build.tsbuildinfo +1 -0
- package/dist/consts.d.ts +0 -51
- package/dist/consts.js.flow +0 -66
- package/src/consts.ts +0 -91
- package/tsconfig.tsbuildinfo +0 -1
- /package/{tsconfig.json → tsconfig-build.json} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* to be conservative in our measurements and make things smaller than they
|
|
19
19
|
* might need to be.
|
|
20
20
|
*/
|
|
21
|
+
import { LayoutMode } from "../enums";
|
|
21
22
|
export declare const computeLayoutParameters: ({ numColumns, numMaxVisibleRows, numPages }: {
|
|
22
23
|
numColumns: any;
|
|
23
24
|
numMaxVisibleRows: any;
|
|
@@ -34,5 +35,5 @@ export declare const computeLayoutParameters: ({ numColumns, numMaxVisibleRows,
|
|
|
34
35
|
toolbarEnabled: any;
|
|
35
36
|
}) => {
|
|
36
37
|
buttonDimensions: any;
|
|
37
|
-
layoutMode:
|
|
38
|
+
layoutMode: LayoutMode;
|
|
38
39
|
};
|
|
@@ -4,26 +4,7 @@
|
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
* An algorithm for computing the appropriate layout parameters for the keypad,
|
|
9
|
-
* including the size of the buttons and whether or not to render fullscreen,
|
|
10
|
-
* taking into account a number of factors including the size of the screen, the
|
|
11
|
-
* orientation of the screen, the presence of browser chrome, the presence of
|
|
12
|
-
* other exercise-related chrome, the size of the input box, the parameters that
|
|
13
|
-
* define the keypad (i.e., the number of rows, columns, and pages), and so
|
|
14
|
-
* forth.
|
|
15
|
-
*
|
|
16
|
-
* The computations herein make some strong assumptions about the sizes of
|
|
17
|
-
* various other elements and the situations under which they will be visible
|
|
18
|
-
* (e.g., browser chrome). However, this is just a heuristic--it's not crucial
|
|
19
|
-
* that our buttons are sized in a pixel-perfect manner, but rather, that we
|
|
20
|
-
* make a balanced use of space.
|
|
21
|
-
*
|
|
22
|
-
* Note that one goal of the algorithm is to avoid resizing the keypad in the
|
|
23
|
-
* face of dynamic browser chrome. In order to avoid that awkwardness, we tend
|
|
24
|
-
* to be conservative in our measurements and make things smaller than they
|
|
25
|
-
* might need to be.
|
|
26
|
-
*/
|
|
7
|
+
import { LayoutMode } from "../enums";
|
|
27
8
|
declare export var computeLayoutParameters: (
|
|
28
9
|
x: {|
|
|
29
10
|
numColumns: any,
|
|
@@ -45,5 +26,5 @@ declare export var computeLayoutParameters: (
|
|
|
45
26
|
|}
|
|
46
27
|
) => {|
|
|
47
28
|
buttonDimensions: any,
|
|
48
|
-
layoutMode:
|
|
29
|
+
layoutMode: LayoutMode,
|
|
49
30
|
|};
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* A component that renders and animates the selection state effect effect.
|
|
3
3
|
*/
|
|
4
4
|
import * as React from "react";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import Keys from "../data/keys";
|
|
6
|
+
import { EchoAnimationType } from "../enums";
|
|
7
7
|
import type { Border, Bound } from "../types";
|
|
8
8
|
type EchoPropType = {
|
|
9
9
|
animationId: string;
|
|
10
|
-
animationType:
|
|
10
|
+
animationType: EchoAnimationType;
|
|
11
11
|
borders: Border;
|
|
12
|
-
id:
|
|
12
|
+
id: Keys;
|
|
13
13
|
initialBounds: Bound;
|
|
14
14
|
};
|
|
15
15
|
type EchoManagerProps = {
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
7
|
import * as React from "react";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
8
|
+
import Keys from "../data/keys";
|
|
9
|
+
import { EchoAnimationType } from "../enums";
|
|
10
10
|
import type { Border, Bound } from "../types";
|
|
11
11
|
declare type EchoPropType = {|
|
|
12
12
|
animationId: string,
|
|
13
|
-
animationType:
|
|
13
|
+
animationType: EchoAnimationType,
|
|
14
14
|
borders: Border,
|
|
15
|
-
id:
|
|
15
|
+
id: Keys,
|
|
16
16
|
initialBounds: Bound,
|
|
17
17
|
|};
|
|
18
18
|
declare type EchoManagerProps = {|
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* A keypad that includes all of the expression symbols.
|
|
3
3
|
*/
|
|
4
4
|
import * as React from "react";
|
|
5
|
+
import { CursorContext } from "./input/cursor-contexts";
|
|
5
6
|
import type { KeypadLayout } from "../types";
|
|
6
|
-
import type { CursorContext } from "./input/cursor-contexts";
|
|
7
7
|
interface ReduxProps {
|
|
8
8
|
currentPage: number;
|
|
9
9
|
cursorContext?: CursorContext;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import * as $Flowgen$Import$react_2d_redux from "react-redux";
|
|
8
8
|
import * as React from "react";
|
|
9
|
+
import { CursorContext } from "./input/cursor-contexts";
|
|
9
10
|
import type { KeypadLayout } from "../types";
|
|
10
|
-
import type { CursorContext } from "./input/cursor-contexts";
|
|
11
11
|
declare interface ReduxProps {
|
|
12
12
|
currentPage: number;
|
|
13
13
|
cursorContext?: CursorContext;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* with fractions, decimals, and percents.
|
|
4
4
|
*/
|
|
5
5
|
import * as React from "react";
|
|
6
|
+
import { CursorContext } from "./input/cursor-contexts";
|
|
6
7
|
import type { KeypadLayout } from "../types";
|
|
7
|
-
import type { CursorContext } from "./input/cursor-contexts";
|
|
8
8
|
interface ReduxProps {
|
|
9
9
|
cursorContext?: CursorContext;
|
|
10
10
|
dynamicJumpOut: boolean;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import * as $Flowgen$Import$react_2d_redux from "react-redux";
|
|
8
8
|
import * as React from "react";
|
|
9
|
+
import { CursorContext } from "./input/cursor-contexts";
|
|
9
10
|
import type { KeypadLayout } from "../types";
|
|
10
|
-
import type { CursorContext } from "./input/cursor-contexts";
|
|
11
11
|
declare interface ReduxProps {
|
|
12
12
|
cursorContext?: CursorContext;
|
|
13
13
|
dynamicJumpOut: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Keys 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.
|
|
@@ -21,25 +21,25 @@ type Options = {
|
|
|
21
21
|
holdIntervalMs: number;
|
|
22
22
|
};
|
|
23
23
|
type TouchState = {
|
|
24
|
-
activeNodeId:
|
|
24
|
+
activeNodeId: Keys;
|
|
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<Keys, TouchState>;
|
|
31
31
|
type SwipeState = {
|
|
32
|
-
touchId:
|
|
32
|
+
touchId: Keys;
|
|
33
33
|
startX: number;
|
|
34
34
|
};
|
|
35
35
|
declare class GestureStateMachine {
|
|
36
36
|
handlers: Handlers;
|
|
37
37
|
options: Options;
|
|
38
|
-
swipeDisabledNodeIds: Partial<[
|
|
39
|
-
multiPressableKeys: Partial<[
|
|
38
|
+
swipeDisabledNodeIds: Partial<[Keys]>;
|
|
39
|
+
multiPressableKeys: Partial<[Keys]>;
|
|
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?: [Keys], multiPressableKeys?: [Keys]);
|
|
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 Keys from "../data/keys";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* The state machine that backs our gesture system. In particular, this state
|
|
@@ -28,29 +28,29 @@ declare type Options = {|
|
|
|
28
28
|
holdIntervalMs: number,
|
|
29
29
|
|};
|
|
30
30
|
declare type TouchState = {|
|
|
31
|
-
activeNodeId:
|
|
31
|
+
activeNodeId: Keys,
|
|
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: Keys]: TouchState };
|
|
38
38
|
declare type SwipeState = {|
|
|
39
|
-
touchId:
|
|
39
|
+
touchId: Keys,
|
|
40
40
|
startX: number,
|
|
41
41
|
|};
|
|
42
42
|
declare class GestureStateMachine {
|
|
43
43
|
handlers: Handlers;
|
|
44
44
|
options: Options;
|
|
45
|
-
swipeDisabledNodeIds: $Rest<[
|
|
46
|
-
multiPressableKeys: $Rest<[
|
|
45
|
+
swipeDisabledNodeIds: $Rest<[Keys], {}>;
|
|
46
|
+
multiPressableKeys: $Rest<[Keys], {}>;
|
|
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?: [Keys],
|
|
53
|
+
multiPressableKeys?: [Keys]
|
|
54
54
|
): this;
|
|
55
55
|
_maybeCancelLongPressForTouch(touchId: any): void;
|
|
56
56
|
_maybeCancelPressAndHoldForTouch(touchId: any): void;
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* A component that renders an icon for a symbol with the given name.
|
|
3
3
|
*/
|
|
4
4
|
import * as React from "react";
|
|
5
|
-
import type {
|
|
5
|
+
import type { IconConfig } from "../types";
|
|
6
6
|
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
7
7
|
type Props = {
|
|
8
8
|
focused: boolean;
|
|
9
|
-
icon:
|
|
9
|
+
icon: IconConfig;
|
|
10
10
|
style?: StyleType;
|
|
11
11
|
};
|
|
12
12
|
declare class Icon extends React.PureComponent<Props> {
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
7
|
import * as React from "react";
|
|
8
|
-
import type {
|
|
8
|
+
import type { IconConfig } from "../types";
|
|
9
9
|
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
10
10
|
declare type Props = {|
|
|
11
11
|
focused: boolean,
|
|
12
|
-
icon:
|
|
12
|
+
icon: IconConfig,
|
|
13
13
|
style?: StyleType,
|
|
14
14
|
|};
|
|
15
15
|
declare class Icon extends React.PureComponent<Props> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Enum that defines the various contexts in which a cursor can exist. The
|
|
3
3
|
* active context is determined first by looking at the cursor's siblings (e.g.,
|
|
4
4
|
* for the `BEFORE_FRACTION` context), and then at its direct parent. Though a
|
|
5
5
|
* cursor could in theory be nested in multiple contexts, we only care about the
|
|
@@ -9,11 +9,12 @@
|
|
|
9
9
|
* now, we show the dismiss button rather than allowing the user to jump out of
|
|
10
10
|
* the radical.
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
export declare enum CursorContext {
|
|
13
|
+
NONE = "NONE",
|
|
14
|
+
IN_PARENS = "IN_PARENS",
|
|
15
|
+
IN_SUPER_SCRIPT = "IN_SUPER_SCRIPT",
|
|
16
|
+
IN_SUB_SCRIPT = "IN_SUB_SCRIPT",
|
|
17
|
+
IN_NUMERATOR = "IN_NUMERATOR",
|
|
18
|
+
IN_DENOMINATOR = "IN_DENOMINATOR",
|
|
19
|
+
BEFORE_FRACTION = "BEFORE_FRACTION"
|
|
20
|
+
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Enum that defines the various contexts in which a cursor can exist. The
|
|
9
9
|
* active context is determined first by looking at the cursor's siblings (e.g.,
|
|
10
10
|
* for the `BEFORE_FRACTION` context), and then at its direct parent. Though a
|
|
11
11
|
* cursor could in theory be nested in multiple contexts, we only care about the
|
|
@@ -15,18 +15,13 @@
|
|
|
15
15
|
* now, we show the dismiss button rather than allowing the user to jump out of
|
|
16
16
|
* the radical.
|
|
17
17
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
declare export var IN_SUPER_SCRIPT: "IN_SUPER_SCRIPT";
|
|
29
|
-
declare export var IN_SUB_SCRIPT: "IN_SUB_SCRIPT";
|
|
30
|
-
declare export var IN_NUMERATOR: "IN_NUMERATOR";
|
|
31
|
-
declare export var IN_DENOMINATOR: "IN_DENOMINATOR";
|
|
32
|
-
declare export var BEFORE_FRACTION: "BEFORE_FRACTION";
|
|
18
|
+
|
|
19
|
+
declare export var CursorContext: {|
|
|
20
|
+
+NONE: "NONE", // "NONE"
|
|
21
|
+
+IN_PARENS: "IN_PARENS", // "IN_PARENS"
|
|
22
|
+
+IN_SUPER_SCRIPT: "IN_SUPER_SCRIPT", // "IN_SUPER_SCRIPT"
|
|
23
|
+
+IN_SUB_SCRIPT: "IN_SUB_SCRIPT", // "IN_SUB_SCRIPT"
|
|
24
|
+
+IN_NUMERATOR: "IN_NUMERATOR", // "IN_NUMERATOR"
|
|
25
|
+
+IN_DENOMINATOR: "IN_DENOMINATOR", // "IN_DENOMINATOR"
|
|
26
|
+
+BEFORE_FRACTION: "BEFORE_FRACTION", // "BEFORE_FRACTION"
|
|
27
|
+
|};
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* more regular interface for the functionality we need while insulating us
|
|
4
4
|
* from MathQuill changes.
|
|
5
5
|
*/
|
|
6
|
+
import { CursorContext } from "./cursor-contexts";
|
|
6
7
|
declare class MathWrapper {
|
|
7
8
|
MQ: any;
|
|
8
9
|
mathField: any;
|
|
@@ -18,7 +19,7 @@ declare class MathWrapper {
|
|
|
18
19
|
* @returns {object} a cursor object, consisting of a cursor context
|
|
19
20
|
*/
|
|
20
21
|
pressKey(key: string): {
|
|
21
|
-
context:
|
|
22
|
+
context: CursorContext;
|
|
22
23
|
};
|
|
23
24
|
/**
|
|
24
25
|
* Place the cursor beside the node located at the given coordinates.
|
|
@@ -104,7 +105,7 @@ declare class MathWrapper {
|
|
|
104
105
|
_handleBackspaceOutsideParens(cursor: any): void;
|
|
105
106
|
_handleBackspaceInsideParens(cursor: any): void;
|
|
106
107
|
_handleBackspaceAfterLigaturedSymbol(cursor: any): void;
|
|
107
|
-
contextForCursor(cursor: any):
|
|
108
|
+
contextForCursor(cursor: any): CursorContext;
|
|
108
109
|
_isAtTopLevel(cursor: any): boolean;
|
|
109
110
|
}
|
|
110
111
|
export default MathWrapper;
|
|
@@ -4,11 +4,7 @@
|
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
* This file contains a wrapper around MathQuill so that we can provide a
|
|
9
|
-
* more regular interface for the functionality we need while insulating us
|
|
10
|
-
* from MathQuill changes.
|
|
11
|
-
*/
|
|
7
|
+
import { CursorContext } from "./cursor-contexts";
|
|
12
8
|
declare class MathWrapper {
|
|
13
9
|
MQ: any;
|
|
14
10
|
mathField: any;
|
|
@@ -24,7 +20,7 @@ declare class MathWrapper {
|
|
|
24
20
|
* @returns {{...}} a cursor object, consisting of a cursor context
|
|
25
21
|
*/
|
|
26
22
|
pressKey(key: string): {|
|
|
27
|
-
context:
|
|
23
|
+
context: CursorContext,
|
|
28
24
|
|};
|
|
29
25
|
|
|
30
26
|
/**
|
|
@@ -110,16 +106,7 @@ declare class MathWrapper {
|
|
|
110
106
|
_handleBackspaceOutsideParens(cursor: any): void;
|
|
111
107
|
_handleBackspaceInsideParens(cursor: any): void;
|
|
112
108
|
_handleBackspaceAfterLigaturedSymbol(cursor: any): void;
|
|
113
|
-
contextForCursor(
|
|
114
|
-
cursor: any
|
|
115
|
-
):
|
|
116
|
-
| "NONE"
|
|
117
|
-
| "IN_PARENS"
|
|
118
|
-
| "IN_SUPER_SCRIPT"
|
|
119
|
-
| "IN_SUB_SCRIPT"
|
|
120
|
-
| "IN_NUMERATOR"
|
|
121
|
-
| "IN_DENOMINATOR"
|
|
122
|
-
| "BEFORE_FRACTION";
|
|
109
|
+
contextForCursor(cursor: any): CursorContext;
|
|
123
110
|
_isAtTopLevel(cursor: any): boolean;
|
|
124
111
|
}
|
|
125
112
|
declare export default typeof MathWrapper;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* A component that renders a keypad button.
|
|
3
3
|
*/
|
|
4
4
|
import * as React from "react";
|
|
5
|
-
import
|
|
6
|
-
import type { Border, KeyConfig,
|
|
5
|
+
import { BorderDirection, KeyType } from "../enums";
|
|
6
|
+
import type { Border, KeyConfig, IconConfig } from "../types";
|
|
7
7
|
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
8
8
|
interface ReduxProps {
|
|
9
9
|
heightPx: number;
|
|
@@ -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;
|
|
@@ -28,7 +28,7 @@ interface Props extends ReduxProps {
|
|
|
28
28
|
declare class KeypadButton extends React.PureComponent<Props> {
|
|
29
29
|
buttonSizeStyle: StyleType | undefined;
|
|
30
30
|
static defaultProps: {
|
|
31
|
-
borders: readonly
|
|
31
|
+
borders: readonly BorderDirection[];
|
|
32
32
|
childKeys: never[];
|
|
33
33
|
disabled: boolean;
|
|
34
34
|
focused: boolean;
|
|
@@ -38,15 +38,15 @@ declare class KeypadButton extends React.PureComponent<Props> {
|
|
|
38
38
|
componentDidMount(): void;
|
|
39
39
|
UNSAFE_componentWillUpdate(newProps: any, newState: any): void;
|
|
40
40
|
_preInjectStyles: () => void;
|
|
41
|
-
_getFocusStyle: (type:
|
|
41
|
+
_getFocusStyle: (type: KeyType) => any[];
|
|
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<Props, "style" | "
|
|
46
|
-
disabled?: boolean | undefined;
|
|
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" | "icon" | "type" | "heightPx" | "widthPx" | "key"> & {
|
|
47
46
|
focused?: boolean | undefined;
|
|
48
|
-
borders?: (
|
|
47
|
+
borders?: readonly (BorderDirection | undefined)[] | undefined;
|
|
49
48
|
childKeys?: readonly KeyConfig[] | undefined;
|
|
49
|
+
disabled?: boolean | undefined;
|
|
50
50
|
popoverEnabled?: boolean | undefined;
|
|
51
51
|
} & {}, "heightPx" | "widthPx">>;
|
|
52
52
|
export default _default;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import * as $Flowgen$Import$react_2d_redux from "react-redux";
|
|
8
8
|
import * as React from "react";
|
|
9
|
-
import
|
|
10
|
-
import type { Border, KeyConfig,
|
|
9
|
+
import { BorderDirection, KeyType } from "../enums";
|
|
10
|
+
import type { Border, KeyConfig, IconConfig } from "../types";
|
|
11
11
|
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
12
12
|
declare interface ReduxProps {
|
|
13
13
|
heightPx: number;
|
|
@@ -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,
|
|
@@ -32,7 +32,7 @@ declare type Props = {
|
|
|
32
32
|
declare class KeypadButton extends React.PureComponent<Props> {
|
|
33
33
|
buttonSizeStyle: StyleType | void;
|
|
34
34
|
static defaultProps: {|
|
|
35
|
-
borders: $ReadOnlyArray<
|
|
35
|
+
borders: $ReadOnlyArray<BorderDirection>,
|
|
36
36
|
childKeys: empty[],
|
|
37
37
|
disabled: boolean,
|
|
38
38
|
focused: boolean,
|
|
@@ -42,7 +42,7 @@ declare class KeypadButton extends React.PureComponent<Props> {
|
|
|
42
42
|
componentDidMount(): void;
|
|
43
43
|
UNSAFE_componentWillUpdate(newProps: any, newState: any): void;
|
|
44
44
|
_preInjectStyles: () => void;
|
|
45
|
-
_getFocusStyle: (type:
|
|
45
|
+
_getFocusStyle: (type: KeyType) => any[];
|
|
46
46
|
_getButtonStyle: (type: any, borders: any, style?: any) => any[];
|
|
47
47
|
render(): React$Node;
|
|
48
48
|
}
|
|
@@ -51,24 +51,25 @@ declare var _default: $Flowgen$Import$react_2d_redux.ConnectedComponent<
|
|
|
51
51
|
$Flowgen$Import$react_2d_redux.Omit<
|
|
52
52
|
{|
|
|
53
53
|
...Pick<
|
|
54
|
-
Props,
|
|
54
|
+
{| ...React.ClassAttributes<KeypadButton>, ...Props |},
|
|
55
55
|
| "style"
|
|
56
|
-
| "icon"
|
|
57
56
|
| "ref"
|
|
58
57
|
| "ariaLabel"
|
|
59
58
|
| "onTouchCancel"
|
|
60
59
|
| "onTouchEnd"
|
|
61
60
|
| "onTouchMove"
|
|
62
61
|
| "onTouchStart"
|
|
62
|
+
| "icon"
|
|
63
63
|
| "type"
|
|
64
64
|
| "heightPx"
|
|
65
65
|
| "widthPx"
|
|
66
|
+
| "key"
|
|
66
67
|
>,
|
|
67
68
|
...{|
|
|
68
|
-
disabled?: boolean | void,
|
|
69
69
|
focused?: boolean | void,
|
|
70
|
-
borders?:
|
|
70
|
+
borders?: $ReadOnlyArray<BorderDirection | void> | void,
|
|
71
71
|
childKeys?: $ReadOnlyArray<KeyConfig> | void,
|
|
72
|
+
disabled?: boolean | void,
|
|
72
73
|
popoverEnabled?: boolean | void,
|
|
73
74
|
|},
|
|
74
75
|
...{||},
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import type { KeypadType } from "../consts";
|
|
2
|
+
import { LayoutMode, KeypadType } from "../enums";
|
|
4
3
|
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
5
4
|
interface ReduxProps {
|
|
6
5
|
active?: boolean;
|
|
7
6
|
extraKeys?: ReadonlyArray<string>;
|
|
8
7
|
keypadType?: KeypadType;
|
|
9
|
-
layoutMode?:
|
|
8
|
+
layoutMode?: LayoutMode;
|
|
10
9
|
navigationPadEnabled?: boolean;
|
|
11
10
|
}
|
|
12
11
|
interface Props extends ReduxProps {
|
|
@@ -6,14 +6,13 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import * as $Flowgen$Import$react_2d_redux from "react-redux";
|
|
8
8
|
import * as React from "react";
|
|
9
|
-
import {
|
|
10
|
-
import type { KeypadType } from "../consts";
|
|
9
|
+
import { LayoutMode, KeypadType } from "../enums";
|
|
11
10
|
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
12
11
|
declare interface ReduxProps {
|
|
13
12
|
active?: boolean;
|
|
14
13
|
extraKeys?: $ReadOnlyArray<string>;
|
|
15
14
|
keypadType?: KeypadType;
|
|
16
|
-
layoutMode?:
|
|
15
|
+
layoutMode?: LayoutMode;
|
|
17
16
|
navigationPadEnabled?: boolean;
|
|
18
17
|
}
|
|
19
18
|
declare type Props = {
|
|
@@ -27,5 +27,5 @@ declare class Keypad extends React.Component<Props> {
|
|
|
27
27
|
_onResize: () => void;
|
|
28
28
|
render(): JSX.Element;
|
|
29
29
|
}
|
|
30
|
-
declare const _default: import("react-redux").ConnectedComponent<typeof Keypad, import("react-redux").Omit<React.ClassAttributes<Keypad> & Props, "
|
|
30
|
+
declare const _default: import("react-redux").ConnectedComponent<typeof Keypad, import("react-redux").Omit<React.ClassAttributes<Keypad> & Props, "popover" | "echoes" | "removeEcho" | "active">>;
|
|
31
31
|
export default _default;
|
|
@@ -34,7 +34,7 @@ declare var _default: $Flowgen$Import$react_2d_redux.ConnectedComponent<
|
|
|
34
34
|
typeof Keypad,
|
|
35
35
|
$Flowgen$Import$react_2d_redux.Omit<
|
|
36
36
|
{| ...React.ClassAttributes<Keypad>, ...Props |},
|
|
37
|
-
"
|
|
37
|
+
"popover" | "echoes" | "removeEcho" | "active"
|
|
38
38
|
>
|
|
39
39
|
>;
|
|
40
40
|
declare export default typeof _default;
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* symbols provided. Up to four symbols will be shown.
|
|
4
4
|
*/
|
|
5
5
|
import * as React from "react";
|
|
6
|
-
import
|
|
6
|
+
import { IconConfig } from "../types";
|
|
7
7
|
type Props = {
|
|
8
8
|
focused: boolean;
|
|
9
|
-
icons: ReadonlyArray<
|
|
9
|
+
icons: ReadonlyArray<IconConfig>;
|
|
10
10
|
};
|
|
11
11
|
declare class MultiSymbolGrid extends React.Component<Props> {
|
|
12
12
|
render(): JSX.Element;
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
7
|
import * as React from "react";
|
|
8
|
-
import
|
|
8
|
+
import { IconConfig } from "../types";
|
|
9
9
|
declare type Props = {|
|
|
10
10
|
focused: boolean,
|
|
11
|
-
icons: $ReadOnlyArray<
|
|
11
|
+
icons: $ReadOnlyArray<IconConfig>,
|
|
12
12
|
|};
|
|
13
13
|
declare class MultiSymbolGrid extends React.Component<Props> {
|
|
14
14
|
render(): React$Node;
|
|
@@ -4,10 +4,8 @@
|
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
-
import * as $Flowgen$Import$aphrodite from "aphrodite";
|
|
8
|
-
|
|
9
7
|
/**
|
|
10
8
|
* Common styles shared across components.
|
|
11
9
|
*/
|
|
12
|
-
declare var _default:
|
|
10
|
+
declare var _default: any;
|
|
13
11
|
declare export default typeof _default;
|
|
@@ -4,22 +4,22 @@
|
|
|
4
4
|
* touch events globally) opaque to the KeypadButton.
|
|
5
5
|
*/
|
|
6
6
|
import * as React from "react";
|
|
7
|
-
import
|
|
7
|
+
import Keys from "../data/keys";
|
|
8
|
+
import { KeyType } from "../enums";
|
|
8
9
|
import GestureManager from "./gesture-manager";
|
|
9
|
-
import type {
|
|
10
|
-
import type { Border, Icon } from "../types";
|
|
10
|
+
import type { Border, IconConfig } from "../types";
|
|
11
11
|
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
12
12
|
type Props = {
|
|
13
13
|
borders: Border;
|
|
14
|
-
childKeyIds: ReadonlyArray<
|
|
14
|
+
childKeyIds: ReadonlyArray<Keys>;
|
|
15
15
|
disabled: boolean;
|
|
16
16
|
focused: boolean;
|
|
17
17
|
gestureManager: GestureManager;
|
|
18
|
-
id:
|
|
18
|
+
id: Keys;
|
|
19
19
|
popoverEnabled: boolean;
|
|
20
20
|
style: StyleType;
|
|
21
21
|
type: KeyType;
|
|
22
|
-
icon:
|
|
22
|
+
icon: IconConfig;
|
|
23
23
|
};
|
|
24
24
|
declare class TouchableKeypadButton extends React.Component<Props> {
|
|
25
25
|
shouldComponentUpdate(newProps: any): boolean;
|