@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# @khanacademy/math-input
|
|
2
2
|
|
|
3
|
+
## 4.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- c4b8d862: Type safety changes that touch our external exports. These are breaking changes to any consumers of the Key data and types.
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- 0d352105: Added remaining missing keys for current pages
|
|
12
|
+
- e900688e: Centralize Key2MathQuill translator. TeXButtons send keypresses, not strings/functions anymore.
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 47055ffc: Switch several icons to Phosphor equivalents:
|
|
17
|
+
|
|
18
|
+
- All numbers 0-9
|
|
19
|
+
- Minus
|
|
20
|
+
- Plus
|
|
21
|
+
- Times
|
|
22
|
+
- Backspace
|
|
23
|
+
- Decimal (though this one is supposed to be a , per the code elsewhere)
|
|
24
|
+
- Period (same as decimal right now)
|
|
25
|
+
- Divide
|
|
26
|
+
- Equal
|
|
27
|
+
- Percent
|
|
28
|
+
- Centered Dot (same icon as Period/Decimal, without y-axis transform)
|
|
29
|
+
- Pi
|
|
30
|
+
- X with mathematical chi
|
|
31
|
+
- x with small mathematical chi
|
|
32
|
+
- Square root with "radical"
|
|
33
|
+
- Dismiss with caret
|
|
34
|
+
- Operators tab icon with "radical"
|
|
35
|
+
|
|
36
|
+
- 3a3c317d: Refactor MathWrapper to use shared key2MathQuill translator
|
|
37
|
+
|
|
3
38
|
## 3.0.0
|
|
4
39
|
|
|
5
40
|
### Major Changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for data
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.21.0
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import Key from "../../../data/keys";
|
|
8
|
+
import { MathFieldInterface } from "../mathquill-types";
|
|
9
|
+
declare export default function handleArrow(
|
|
10
|
+
mathField: MathFieldInterface,
|
|
11
|
+
key: Key
|
|
12
|
+
): void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MathFieldInterface } from "../mathquill-types";
|
|
2
|
+
/**
|
|
3
|
+
* Selects and deletes part of the expression based on the cursor location.
|
|
4
|
+
* See inline comments for precise behavior of different cases.
|
|
5
|
+
*/
|
|
6
|
+
declare function handleBackspace(mathField: MathFieldInterface): void;
|
|
7
|
+
export default handleBackspace;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for data
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.21.0
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import { MathFieldInterface } from "../mathquill-types";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Selects and deletes part of the expression based on the cursor location.
|
|
11
|
+
* See inline comments for precise behavior of different cases.
|
|
12
|
+
*/
|
|
13
|
+
declare function handleBackspace(mathField: MathFieldInterface): void;
|
|
14
|
+
declare export default typeof handleBackspace;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for data
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.21.0
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import Key from "../../../data/keys";
|
|
8
|
+
import { MathFieldInterface } from "../mathquill-types";
|
|
9
|
+
declare export default function handleExponent(
|
|
10
|
+
mathField: MathFieldInterface,
|
|
11
|
+
key: Key
|
|
12
|
+
): void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import Key from "../../../data/keys";
|
|
2
|
+
import { MathFieldInterface } from "../mathquill-types";
|
|
3
|
+
/**
|
|
4
|
+
* Advances the cursor to the next logical position.
|
|
5
|
+
*/
|
|
6
|
+
declare function handleJumpOut(mathField: MathFieldInterface, key: Key): void;
|
|
7
|
+
export default handleJumpOut;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for data
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.21.0
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import Key from "../../../data/keys";
|
|
8
|
+
import { MathFieldInterface } from "../mathquill-types";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Advances the cursor to the next logical position.
|
|
12
|
+
*/
|
|
13
|
+
declare function handleJumpOut(mathField: MathFieldInterface, key: Key): void;
|
|
14
|
+
declare export default typeof handleJumpOut;
|
|
@@ -1,26 +1,24 @@
|
|
|
1
|
+
import Key from "../../data/keys";
|
|
2
|
+
import { Cursor } from "../../types";
|
|
3
|
+
import { MathFieldInterface, MathFieldCursor } from "./mathquill-types";
|
|
1
4
|
/**
|
|
2
5
|
* This file contains a wrapper around MathQuill so that we can provide a
|
|
3
6
|
* more regular interface for the functionality we need while insulating us
|
|
4
7
|
* from MathQuill changes.
|
|
5
8
|
*/
|
|
6
|
-
import { CursorContext } from "./cursor-contexts";
|
|
7
9
|
declare class MathWrapper {
|
|
8
|
-
|
|
9
|
-
mathField: any;
|
|
10
|
+
mathField: MathFieldInterface;
|
|
10
11
|
callbacks: any;
|
|
11
12
|
constructor(element: any, options?: {}, callbacks?: {});
|
|
12
13
|
focus(): void;
|
|
13
14
|
blur(): void;
|
|
14
|
-
_writeNormalFunction(name: string): void;
|
|
15
15
|
/**
|
|
16
16
|
* Handle a key press and return the resulting cursor state.
|
|
17
17
|
*
|
|
18
18
|
* @param {Key} key - an enum representing the key that was pressed
|
|
19
19
|
* @returns {object} a cursor object, consisting of a cursor context
|
|
20
20
|
*/
|
|
21
|
-
pressKey(key:
|
|
22
|
-
context: CursorContext;
|
|
23
|
-
};
|
|
21
|
+
pressKey(key: Key): Cursor;
|
|
24
22
|
/**
|
|
25
23
|
* Place the cursor beside the node located at the given coordinates.
|
|
26
24
|
*
|
|
@@ -33,79 +31,10 @@ declare class MathWrapper {
|
|
|
33
31
|
*/
|
|
34
32
|
setCursorPosition(x: number, y: number, hitNode: HTMLElement): void;
|
|
35
33
|
getCursor(): any;
|
|
34
|
+
contextForCursor(cursor: MathFieldCursor): import("./cursor-contexts").CursorContext;
|
|
36
35
|
getSelection(): any;
|
|
37
|
-
getContent():
|
|
36
|
+
getContent(): string;
|
|
38
37
|
setContent(latex: string): void;
|
|
39
38
|
isEmpty(): boolean;
|
|
40
|
-
_handleBackspaceInNthRoot(cursor: any): void;
|
|
41
|
-
/**
|
|
42
|
-
* Advances the cursor to the next logical position.
|
|
43
|
-
*
|
|
44
|
-
* @param {cursor} cursor
|
|
45
|
-
* @private
|
|
46
|
-
*/
|
|
47
|
-
_handleJumpOut(cursor: any, key: any): void;
|
|
48
|
-
/**
|
|
49
|
-
* Selects and deletes part of the expression based on the cursor location.
|
|
50
|
-
* See inline comments for precise behavior of different cases.
|
|
51
|
-
*
|
|
52
|
-
* @param {cursor} cursor
|
|
53
|
-
* @private
|
|
54
|
-
*/
|
|
55
|
-
_handleBackspace(cursor: any): void;
|
|
56
|
-
_handleLeftArrow(cursor: any): void;
|
|
57
|
-
_handleRightArrow(cursor: any): void;
|
|
58
|
-
_handleExponent(cursor: any, key: any): void;
|
|
59
|
-
/**
|
|
60
|
-
* Return the start node, end node, and full name of the command of which
|
|
61
|
-
* the initial node is a part, or `null` if the node is not part of a
|
|
62
|
-
* command.
|
|
63
|
-
*
|
|
64
|
-
* @param {node} initialNode - the node to included as part of the command
|
|
65
|
-
* @returns {null|object} - `null` or an object containing the start node
|
|
66
|
-
* (`startNode`), end node (`endNode`), and full
|
|
67
|
-
* name (`name`) of the command
|
|
68
|
-
* @private
|
|
69
|
-
*/
|
|
70
|
-
_maybeFindCommand(initialNode: any): {
|
|
71
|
-
name: string;
|
|
72
|
-
startNode: any;
|
|
73
|
-
endNode: any;
|
|
74
|
-
} | null;
|
|
75
|
-
/**
|
|
76
|
-
* Return the start node, end node, and full name of the command to the left
|
|
77
|
-
* of `\\left(`, or `null` if there is no command.
|
|
78
|
-
*
|
|
79
|
-
* @param {node} leftParenNode - node where .ctrlSeq == `\\left(`
|
|
80
|
-
* @returns {null|object} - `null` or an object containing the start node
|
|
81
|
-
* (`startNode`), end node (`endNode`), and full
|
|
82
|
-
* name (`name`) of the command
|
|
83
|
-
* @private
|
|
84
|
-
*/
|
|
85
|
-
_maybeFindCommandBeforeParens(leftParenNode: any): {
|
|
86
|
-
name: string;
|
|
87
|
-
startNode: any;
|
|
88
|
-
endNode: any;
|
|
89
|
-
} | null;
|
|
90
|
-
_selectNode(node: any, cursor: any): void;
|
|
91
|
-
_isFraction(node: any): any;
|
|
92
|
-
_isNumerator(node: any): any;
|
|
93
|
-
_isDenominator(node: any): any;
|
|
94
|
-
_isSubScript(node: any): any;
|
|
95
|
-
_isSuperScript(node: any): any;
|
|
96
|
-
_isParens(node: any): any;
|
|
97
|
-
_isLeaf(node: any): any;
|
|
98
|
-
_isSquareRoot(node: any): any;
|
|
99
|
-
_isNthRoot(node: any): any;
|
|
100
|
-
_isNthRootIndex(node: any): any;
|
|
101
|
-
_isInsideLogIndex(cursor: any): boolean;
|
|
102
|
-
_isInsideEmptyNode(cursor: any): boolean;
|
|
103
|
-
_handleBackspaceInRootIndex(cursor: any): void;
|
|
104
|
-
_handleBackspaceInLogIndex(cursor: any): void;
|
|
105
|
-
_handleBackspaceOutsideParens(cursor: any): void;
|
|
106
|
-
_handleBackspaceInsideParens(cursor: any): void;
|
|
107
|
-
_handleBackspaceAfterLigaturedSymbol(cursor: any): void;
|
|
108
|
-
contextForCursor(cursor: any): CursorContext;
|
|
109
|
-
_isAtTopLevel(cursor: any): boolean;
|
|
110
39
|
}
|
|
111
40
|
export default MathWrapper;
|
|
@@ -4,24 +4,29 @@
|
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
-
import
|
|
7
|
+
import * as $Flowgen$Import$_2e__2f_cursor_2d_contexts from "./cursor-contexts";
|
|
8
|
+
import Key from "../../data/keys";
|
|
9
|
+
import { Cursor } from "../../types";
|
|
10
|
+
import { MathFieldInterface, MathFieldCursor } from "./mathquill-types";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* This file contains a wrapper around MathQuill so that we can provide a
|
|
14
|
+
* more regular interface for the functionality we need while insulating us
|
|
15
|
+
* from MathQuill changes.
|
|
16
|
+
*/
|
|
8
17
|
declare class MathWrapper {
|
|
9
|
-
|
|
10
|
-
mathField: any;
|
|
18
|
+
mathField: MathFieldInterface;
|
|
11
19
|
callbacks: any;
|
|
12
20
|
constructor(element: any, options?: {||}, callbacks?: {||}): this;
|
|
13
21
|
focus(): void;
|
|
14
22
|
blur(): void;
|
|
15
|
-
_writeNormalFunction(name: string): void;
|
|
16
23
|
|
|
17
24
|
/**
|
|
18
25
|
* Handle a key press and return the resulting cursor state.
|
|
19
26
|
* @param {Key} key - an enum representing the key that was pressed
|
|
20
27
|
* @returns {{...}} a cursor object, consisting of a cursor context
|
|
21
28
|
*/
|
|
22
|
-
pressKey(key:
|
|
23
|
-
context: CursorContext,
|
|
24
|
-
|};
|
|
29
|
+
pressKey(key: Key): Cursor;
|
|
25
30
|
|
|
26
31
|
/**
|
|
27
32
|
* Place the cursor beside the node located at the given coordinates.
|
|
@@ -34,79 +39,12 @@ declare class MathWrapper {
|
|
|
34
39
|
*/
|
|
35
40
|
setCursorPosition(x: number, y: number, hitNode: HTMLElement): void;
|
|
36
41
|
getCursor(): any;
|
|
42
|
+
contextForCursor(
|
|
43
|
+
cursor: MathFieldCursor
|
|
44
|
+
): $Flowgen$Import$_2e__2f_cursor_2d_contexts.CursorContext;
|
|
37
45
|
getSelection(): any;
|
|
38
|
-
getContent():
|
|
46
|
+
getContent(): string;
|
|
39
47
|
setContent(latex: string): void;
|
|
40
48
|
isEmpty(): boolean;
|
|
41
|
-
_handleBackspaceInNthRoot(cursor: any): void;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Advances the cursor to the next logical position.
|
|
45
|
-
* @param {cursor} cursor
|
|
46
|
-
* @private
|
|
47
|
-
*/
|
|
48
|
-
_handleJumpOut(cursor: any, key: any): void;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Selects and deletes part of the expression based on the cursor location.
|
|
52
|
-
* See inline comments for precise behavior of different cases.
|
|
53
|
-
* @param {cursor} cursor
|
|
54
|
-
* @private
|
|
55
|
-
*/
|
|
56
|
-
_handleBackspace(cursor: any): void;
|
|
57
|
-
_handleLeftArrow(cursor: any): void;
|
|
58
|
-
_handleRightArrow(cursor: any): void;
|
|
59
|
-
_handleExponent(cursor: any, key: any): void;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Return the start node, end node, and full name of the command of which
|
|
63
|
-
* the initial node is a part, or `null` if the node is not part of a
|
|
64
|
-
* command.
|
|
65
|
-
* @param {node} initialNode - the node to included as part of the command
|
|
66
|
-
* @returns {null | {...}} - `null` or an object containing the start node
|
|
67
|
-
* (`startNode`), end node (`endNode`), and full
|
|
68
|
-
* name (`name`) of the command
|
|
69
|
-
* @private
|
|
70
|
-
*/
|
|
71
|
-
_maybeFindCommand(initialNode: any): {|
|
|
72
|
-
name: string,
|
|
73
|
-
startNode: any,
|
|
74
|
-
endNode: any,
|
|
75
|
-
|} | null;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Return the start node, end node, and full name of the command to the left
|
|
79
|
-
* of `\\left(`, or `null` if there is no command.
|
|
80
|
-
* @param {node} leftParenNode - node where .ctrlSeq == `\\left(`
|
|
81
|
-
* @returns {null | {...}} - `null` or an object containing the start node
|
|
82
|
-
* (`startNode`), end node (`endNode`), and full
|
|
83
|
-
* name (`name`) of the command
|
|
84
|
-
* @private
|
|
85
|
-
*/
|
|
86
|
-
_maybeFindCommandBeforeParens(leftParenNode: any): {|
|
|
87
|
-
name: string,
|
|
88
|
-
startNode: any,
|
|
89
|
-
endNode: any,
|
|
90
|
-
|} | null;
|
|
91
|
-
_selectNode(node: any, cursor: any): void;
|
|
92
|
-
_isFraction(node: any): any;
|
|
93
|
-
_isNumerator(node: any): any;
|
|
94
|
-
_isDenominator(node: any): any;
|
|
95
|
-
_isSubScript(node: any): any;
|
|
96
|
-
_isSuperScript(node: any): any;
|
|
97
|
-
_isParens(node: any): any;
|
|
98
|
-
_isLeaf(node: any): any;
|
|
99
|
-
_isSquareRoot(node: any): any;
|
|
100
|
-
_isNthRoot(node: any): any;
|
|
101
|
-
_isNthRootIndex(node: any): any;
|
|
102
|
-
_isInsideLogIndex(cursor: any): boolean;
|
|
103
|
-
_isInsideEmptyNode(cursor: any): boolean;
|
|
104
|
-
_handleBackspaceInRootIndex(cursor: any): void;
|
|
105
|
-
_handleBackspaceInLogIndex(cursor: any): void;
|
|
106
|
-
_handleBackspaceOutsideParens(cursor: any): void;
|
|
107
|
-
_handleBackspaceInsideParens(cursor: any): void;
|
|
108
|
-
_handleBackspaceAfterLigaturedSymbol(cursor: any): void;
|
|
109
|
-
contextForCursor(cursor: any): CursorContext;
|
|
110
|
-
_isAtTopLevel(cursor: any): boolean;
|
|
111
49
|
}
|
|
112
50
|
declare export default typeof MathWrapper;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { CursorContext } from "./cursor-contexts";
|
|
2
|
+
import { MathFieldCursor, MathFieldInterface } from "./mathquill-types";
|
|
3
|
+
export declare function getCursor(mathField: MathFieldInterface): MathFieldCursor;
|
|
4
|
+
export declare function isFraction(node: any): boolean;
|
|
5
|
+
export declare function isNumerator(node: any): boolean;
|
|
6
|
+
export declare function isDenominator(node: any): boolean;
|
|
7
|
+
export declare function isSubScript(node: any): boolean;
|
|
8
|
+
export declare function isSuperScript(node: any): boolean;
|
|
9
|
+
export declare function isParens(node: any): boolean;
|
|
10
|
+
export declare function isLeaf(node: any): boolean;
|
|
11
|
+
export declare function isSquareRoot(node: any): boolean;
|
|
12
|
+
export declare function isNthRoot(node: any): boolean;
|
|
13
|
+
export declare function isNthRootIndex(node: any): boolean;
|
|
14
|
+
export declare function isInsideLogIndex(cursor: MathFieldCursor): boolean;
|
|
15
|
+
export declare function isInsideEmptyNode(cursor: MathFieldCursor): boolean;
|
|
16
|
+
export declare function selectNode(node: any, cursor: any): void;
|
|
17
|
+
/**
|
|
18
|
+
* Return the start node, end node, and full name of the command of which
|
|
19
|
+
* the initial node is a part, or `null` if the node is not part of a
|
|
20
|
+
* command.
|
|
21
|
+
*
|
|
22
|
+
* @param {node} initialNode - the node to included as part of the command
|
|
23
|
+
* @returns {null|object} - `null` or an object containing the start node
|
|
24
|
+
* (`startNode`), end node (`endNode`), and full
|
|
25
|
+
* name (`name`) of the command
|
|
26
|
+
*/
|
|
27
|
+
export declare function maybeFindCommand(initialNode: any): {
|
|
28
|
+
name: string;
|
|
29
|
+
startNode: any;
|
|
30
|
+
endNode: any;
|
|
31
|
+
} | null;
|
|
32
|
+
/**
|
|
33
|
+
* Return the start node, end node, and full name of the command to the left
|
|
34
|
+
* of `\\left(`, or `null` if there is no command.
|
|
35
|
+
*
|
|
36
|
+
* @param {node} leftParenNode - node where .ctrlSeq == `\\left(`
|
|
37
|
+
* @returns {null|object} - `null` or an object containing the start node
|
|
38
|
+
* (`startNode`), end node (`endNode`), and full
|
|
39
|
+
* name (`name`) of the command
|
|
40
|
+
*/
|
|
41
|
+
export declare function maybeFindCommandBeforeParens(leftParenNode: any): {
|
|
42
|
+
name: string;
|
|
43
|
+
startNode: any;
|
|
44
|
+
endNode: any;
|
|
45
|
+
} | null;
|
|
46
|
+
export declare function contextForCursor(cursor: MathFieldCursor): CursorContext;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for data
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.21.0
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import { CursorContext } from "./cursor-contexts";
|
|
8
|
+
import { MathFieldCursor, MathFieldInterface } from "./mathquill-types";
|
|
9
|
+
declare export function getCursor(
|
|
10
|
+
mathField: MathFieldInterface
|
|
11
|
+
): MathFieldCursor;
|
|
12
|
+
declare export function isFraction(node: any): boolean;
|
|
13
|
+
declare export function isNumerator(node: any): boolean;
|
|
14
|
+
declare export function isDenominator(node: any): boolean;
|
|
15
|
+
declare export function isSubScript(node: any): boolean;
|
|
16
|
+
declare export function isSuperScript(node: any): boolean;
|
|
17
|
+
declare export function isParens(node: any): boolean;
|
|
18
|
+
declare export function isLeaf(node: any): boolean;
|
|
19
|
+
declare export function isSquareRoot(node: any): boolean;
|
|
20
|
+
declare export function isNthRoot(node: any): boolean;
|
|
21
|
+
declare export function isNthRootIndex(node: any): boolean;
|
|
22
|
+
declare export function isInsideLogIndex(cursor: MathFieldCursor): boolean;
|
|
23
|
+
declare export function isInsideEmptyNode(cursor: MathFieldCursor): boolean;
|
|
24
|
+
declare export function selectNode(node: any, cursor: any): void;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Return the start node, end node, and full name of the command of which
|
|
28
|
+
* the initial node is a part, or `null` if the node is not part of a
|
|
29
|
+
* command.
|
|
30
|
+
* @param {node} initialNode - the node to included as part of the command
|
|
31
|
+
* @returns {null | {...}} - `null` or an object containing the start node
|
|
32
|
+
* (`startNode`), end node (`endNode`), and full
|
|
33
|
+
* name (`name`) of the command
|
|
34
|
+
*/
|
|
35
|
+
declare export function maybeFindCommand(initialNode: any): {|
|
|
36
|
+
name: string,
|
|
37
|
+
startNode: any,
|
|
38
|
+
endNode: any,
|
|
39
|
+
|} | null;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Return the start node, end node, and full name of the command to the left
|
|
43
|
+
* of `\\left(`, or `null` if there is no command.
|
|
44
|
+
* @param {node} leftParenNode - node where .ctrlSeq == `\\left(`
|
|
45
|
+
* @returns {null | {...}} - `null` or an object containing the start node
|
|
46
|
+
* (`startNode`), end node (`endNode`), and full
|
|
47
|
+
* name (`name`) of the command
|
|
48
|
+
*/
|
|
49
|
+
declare export function maybeFindCommandBeforeParens(leftParenNode: any): {|
|
|
50
|
+
name: string,
|
|
51
|
+
startNode: any,
|
|
52
|
+
endNode: any,
|
|
53
|
+
|} | null;
|
|
54
|
+
declare export function contextForCursor(
|
|
55
|
+
cursor: MathFieldCursor
|
|
56
|
+
): CursorContext;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for data
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.21.0
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import { MathQuillInterface } from "./mathquill-types";
|
|
8
|
+
declare var _default: MathQuillInterface;
|
|
9
|
+
declare export default typeof _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import Key from "../../data/keys";
|
|
2
|
+
export interface MathQuillInterface {
|
|
3
|
+
L: "L";
|
|
4
|
+
R: "R";
|
|
5
|
+
MathField: (mount: HTMLDivElement, options: any) => MathFieldInterface;
|
|
6
|
+
}
|
|
7
|
+
export interface MathFieldInterface {
|
|
8
|
+
write: (input: string) => void;
|
|
9
|
+
cmd: (input: string) => void;
|
|
10
|
+
keystroke: (input: string) => void;
|
|
11
|
+
typedText: (input: string) => void;
|
|
12
|
+
latex: (input?: string) => string;
|
|
13
|
+
moveToDirEnd: (direction: "L" | "R") => void;
|
|
14
|
+
select: () => void;
|
|
15
|
+
clearSelection: () => void;
|
|
16
|
+
__controller: any;
|
|
17
|
+
}
|
|
18
|
+
export declare enum MathFieldActionType {
|
|
19
|
+
WRITE = "write",
|
|
20
|
+
CMD = "cmd",
|
|
21
|
+
KEYSTROKE = "keystroke",
|
|
22
|
+
MQ_END = 0
|
|
23
|
+
}
|
|
24
|
+
export type MathFieldCursor = any;
|
|
25
|
+
export type MathQuillUpdaterCallback = (mathQuill: MathFieldInterface, key: Key) => void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for data
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.21.0
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import Key from "../../data/keys";
|
|
8
|
+
export interface MathQuillInterface {
|
|
9
|
+
L: "L";
|
|
10
|
+
R: "R";
|
|
11
|
+
MathField: (mount: HTMLDivElement, options: any) => MathFieldInterface;
|
|
12
|
+
}
|
|
13
|
+
export interface MathFieldInterface {
|
|
14
|
+
write: (input: string) => void;
|
|
15
|
+
cmd: (input: string) => void;
|
|
16
|
+
keystroke: (input: string) => void;
|
|
17
|
+
typedText: (input: string) => void;
|
|
18
|
+
latex: (input?: string) => string;
|
|
19
|
+
moveToDirEnd: (direction: "L" | "R") => void;
|
|
20
|
+
select: () => void;
|
|
21
|
+
clearSelection: () => void;
|
|
22
|
+
__controller: any;
|
|
23
|
+
}
|
|
24
|
+
declare export var MathFieldActionType: {|
|
|
25
|
+
+WRITE: "write", // "write"
|
|
26
|
+
+CMD: "cmd", // "cmd"
|
|
27
|
+
+KEYSTROKE: "keystroke", // "keystroke"
|
|
28
|
+
+MQ_END: 0, // 0
|
|
29
|
+
|};
|
|
30
|
+
export type MathFieldCursor = any;
|
|
31
|
+
export type MathQuillUpdaterCallback = (
|
|
32
|
+
mathQuill: MathFieldInterface,
|
|
33
|
+
key: Key
|
|
34
|
+
) => void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for data
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.21.0
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import Key from "../data/keys";
|
|
8
|
+
import { MathQuillUpdaterCallback } from "./input/mathquill-types";
|
|
9
|
+
declare var keyToMathquillMap: { [key: Key]: MathQuillUpdaterCallback };
|
|
10
|
+
declare export default typeof keyToMathquillMap;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
7
|
import * as React from "react";
|
|
8
|
-
import
|
|
8
|
+
import { KeyConfig } from "../../types";
|
|
9
9
|
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
10
10
|
declare type KeypadPageContainerProps = {|
|
|
11
11
|
children: React.Node,
|