@khanacademy/math-input 0.6.8 → 0.7.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/.eslintrc.js +1 -0
- package/CHANGELOG.md +6 -0
- package/dist/components/common-style.d.ts +21 -0
- package/dist/components/common-style.js.flow +27 -0
- package/dist/components/input/cursor-contexts.d.ts +19 -0
- package/dist/components/input/cursor-contexts.js.flow +32 -0
- package/dist/components/input/cursor-handle.d.ts +25 -0
- package/dist/components/input/cursor-handle.js.flow +28 -0
- package/dist/components/input/math-input.d.ts +128 -0
- package/dist/components/input/math-input.js.flow +152 -0
- package/dist/components/keypad/button-assets.d.ts +6 -0
- package/dist/components/keypad/button-assets.js.flow +12 -0
- package/dist/components/keypad/button.d.ts +14 -0
- package/dist/components/keypad/button.js.flow +19 -0
- package/dist/components/keypad/index.d.ts +15 -0
- package/dist/components/keypad/index.js.flow +22 -0
- package/dist/components/keypad/keypad-page-items.d.ts +24 -0
- package/dist/components/keypad/keypad-page-items.js.flow +30 -0
- package/dist/components/keypad/numeric-input-page.d.ts +8 -0
- package/dist/components/keypad/numeric-input-page.js.flow +13 -0
- package/dist/components/keypad/pre-algebra-page.d.ts +8 -0
- package/dist/components/keypad/pre-algebra-page.js.flow +13 -0
- package/dist/components/keypad/trigonometry-page.d.ts +8 -0
- package/dist/components/keypad/trigonometry-page.js.flow +15 -0
- package/dist/components/provided-keypad.d.ts +23 -0
- package/dist/components/provided-keypad.js.flow +32 -0
- package/dist/components/tabbar/icons.d.ts +7 -0
- package/dist/components/tabbar/icons.js.flow +13 -0
- package/dist/components/tabbar/item.d.ts +14 -0
- package/dist/components/tabbar/item.js.flow +20 -0
- package/dist/components/tabbar/tabbar.d.ts +14 -0
- package/dist/components/tabbar/tabbar.js.flow +20 -0
- package/{src/components/tabbar/types.js → dist/components/tabbar/types.d.ts} +0 -2
- package/dist/components/tabbar/types.js.flow +7 -0
- package/dist/components/z-indexes.d.ts +7 -0
- package/dist/components/z-indexes.js.flow +13 -0
- package/dist/consts.d.ts +51 -0
- package/dist/consts.js.flow +66 -0
- package/dist/data/key-configs.d.ts +7 -0
- package/dist/data/key-configs.js.flow +13 -0
- package/dist/data/keys.d.ts +57 -0
- package/dist/data/keys.js.flow +112 -0
- package/dist/es/index.js +487 -985
- package/dist/es/index.js.map +1 -1
- package/dist/fake-react-native-web/index.d.ts +10 -0
- package/dist/fake-react-native-web/index.js.flow +8 -0
- package/dist/fake-react-native-web/text.d.ts +12 -0
- package/dist/fake-react-native-web/text.js.flow +18 -0
- package/dist/fake-react-native-web/view.d.ts +22 -0
- package/dist/fake-react-native-web/view.js.flow +28 -0
- package/dist/index.d.ts +14 -2
- package/dist/index.js +524 -951
- package/dist/index.js.flow +20 -2
- package/dist/index.js.map +1 -1
- package/dist/store/index.d.ts +1 -0
- package/dist/store/index.js.flow +7 -0
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js.flow +7 -0
- package/package.json +2 -2
- package/src/components/__tests__/gesture-state-machine_test.js +1 -1
- package/src/components/__tests__/node-manager_test.js +1 -1
- package/src/components/__tests__/two-page-keypad_test.js +1 -1
- package/src/components/app.js +2 -2
- package/src/components/{common-style.js → common-style.ts} +0 -1
- package/src/components/compute-layout-parameters.js +2 -2
- package/src/components/corner-decal.js +2 -2
- package/src/components/echo-manager.js +5 -5
- package/src/components/empty-keypad-button.js +3 -3
- package/src/components/expression-keypad.js +10 -10
- package/src/components/fraction-keypad.js +9 -9
- package/src/components/gesture-manager.js +3 -3
- package/src/components/icon.js +6 -6
- package/src/components/iconography/down.js +1 -1
- package/src/components/iconography/index.js +41 -41
- package/src/components/iconography/left.js +1 -1
- package/src/components/iconography/right.js +1 -1
- package/src/components/iconography/up.js +1 -1
- package/src/components/input/__tests__/context-tracking_test.js +3 -3
- package/src/components/input/__tests__/mathquill_test.js +2 -2
- package/src/components/input/__tests__/test-math-wrapper.jsx +1 -1
- package/src/components/input/{cursor-contexts.js → cursor-contexts.ts} +7 -14
- package/src/components/input/{cursor-handle.js → cursor-handle.tsx} +19 -20
- package/src/components/input/{math-input.js → math-input.tsx} +170 -151
- package/src/components/input/math-wrapper.js +5 -5
- package/src/components/input/scroll-into-view.js +1 -1
- package/src/components/keypad/{button-assets.js → button-assets.tsx} +5 -4
- package/src/components/keypad/button.stories.js +1 -1
- package/src/components/keypad/{button.js → button.tsx} +9 -9
- package/src/components/keypad/{index.js → index.tsx} +16 -15
- package/src/components/keypad/{keypad-page-items.js → keypad-page-items.tsx} +24 -39
- package/src/components/keypad/{keypad-pages.stories.js → keypad-pages.stories.tsx} +6 -8
- package/src/components/keypad/{keypad.stories.js → keypad.stories.tsx} +3 -5
- package/src/components/keypad/{numeric-input-page.js → numeric-input-page.tsx} +6 -7
- package/src/components/keypad/{pre-algebra-page.js → pre-algebra-page.tsx} +6 -7
- package/src/components/keypad/{trigonometry-page.js → trigonometry-page.tsx} +6 -7
- package/src/components/keypad-button.js +7 -11
- package/src/components/keypad-container.js +10 -10
- package/src/components/keypad.js +5 -5
- package/src/components/many-keypad-button.js +6 -6
- package/src/components/math-icon.js +3 -3
- package/src/components/multi-symbol-grid.js +6 -6
- package/src/components/multi-symbol-popover.js +5 -5
- package/src/components/navigation-pad.js +6 -6
- package/src/components/popover-manager.js +3 -3
- package/src/components/prop-types.js +3 -3
- package/src/components/{provided-keypad.js → provided-keypad.tsx} +16 -14
- package/src/components/styles.js +1 -1
- package/src/components/svg-icon.js +1 -1
- package/src/components/tabbar/__tests__/tabbar_test.js +1 -1
- package/src/components/tabbar/{icons.js → icons.tsx} +7 -12
- package/src/components/tabbar/{item.js → item.tsx} +6 -8
- package/src/components/tabbar/tabbar.stories.js +2 -2
- package/src/components/tabbar/{tabbar.js → tabbar.tsx} +6 -8
- package/src/components/tabbar/types.ts +1 -0
- package/src/components/text-icon.js +3 -3
- package/src/components/touchable-keypad-button.js +5 -5
- package/src/components/two-page-keypad.js +5 -5
- package/src/components/{z-indexes.js → z-indexes.ts} +0 -1
- package/src/{consts.js → consts.ts} +22 -27
- package/src/data/{key-configs.js → key-configs.ts} +7 -8
- package/src/data/{keys.js → keys.ts} +7 -13
- package/src/demo.js +1 -1
- package/src/fake-react-native-web/{index.js → index.ts} +2 -3
- package/src/fake-react-native-web/{text.js → text.tsx} +7 -9
- package/src/fake-react-native-web/{view.js → view.tsx} +15 -17
- package/src/{index.js → index.ts} +9 -10
- package/src/native-app.js +3 -3
- package/src/store/{index.js → index.ts} +63 -34
- package/src/{utils.js → utils.ts} +1 -2
- package/tsconfig.json +9 -0
- package/tsconfig.tsbuildinfo +1 -0
- /package/dist/{strings.js → strings} +0 -0
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
1
|
import * as React from "react";
|
|
4
2
|
|
|
5
|
-
import type {TabbarItemType} from "./types
|
|
3
|
+
import type {TabbarItemType} from "./types";
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
tintColor
|
|
9
|
-
type
|
|
10
|
-
}: {
|
|
11
|
-
tintColor: string,
|
|
12
|
-
type: TabbarItemType,
|
|
13
|
-
}): React.Node {
|
|
5
|
+
const IconAsset: React.FC<{
|
|
6
|
+
tintColor: string;
|
|
7
|
+
type: TabbarItemType;
|
|
8
|
+
}> = function ({tintColor, type}): React.ReactElement {
|
|
14
9
|
if (type === "Geometry") {
|
|
15
10
|
return (
|
|
16
11
|
<svg
|
|
@@ -62,8 +57,8 @@ function IconAsset({
|
|
|
62
57
|
);
|
|
63
58
|
}
|
|
64
59
|
|
|
65
|
-
|
|
60
|
+
// type as never;
|
|
66
61
|
throw new Error("Invalid icon type");
|
|
67
|
-
}
|
|
62
|
+
};
|
|
68
63
|
|
|
69
64
|
export default IconAsset;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
1
|
import Clickable from "@khanacademy/wonder-blocks-clickable";
|
|
4
2
|
import Color from "@khanacademy/wonder-blocks-color";
|
|
5
3
|
import {View} from "@khanacademy/wonder-blocks-core";
|
|
6
4
|
import {StyleSheet} from "aphrodite";
|
|
7
5
|
import * as React from "react";
|
|
8
6
|
|
|
9
|
-
import IconAsset from "./icons
|
|
7
|
+
import IconAsset from "./icons";
|
|
10
8
|
|
|
11
9
|
import type {TabbarItemType} from "./types";
|
|
12
10
|
|
|
@@ -73,15 +71,15 @@ function imageTintColor(
|
|
|
73
71
|
}
|
|
74
72
|
export type ItemState = "active" | "inactive" | "disabled";
|
|
75
73
|
type Props = {
|
|
76
|
-
onClick: () => void
|
|
77
|
-
itemState: ItemState
|
|
78
|
-
itemType: TabbarItemType
|
|
74
|
+
onClick: () => void;
|
|
75
|
+
itemState: ItemState;
|
|
76
|
+
itemType: TabbarItemType;
|
|
79
77
|
};
|
|
80
78
|
|
|
81
|
-
type State =
|
|
79
|
+
type State = Record<any, any>;
|
|
82
80
|
|
|
83
81
|
class TabbarItem extends React.Component<Props, State> {
|
|
84
|
-
render(): React.
|
|
82
|
+
render(): React.ReactNode {
|
|
85
83
|
const {onClick, itemType, itemState} = this.props;
|
|
86
84
|
return (
|
|
87
85
|
<Clickable onClick={onClick} disabled={itemState === "disabled"}>
|
|
@@ -2,8 +2,8 @@ import {action} from "@storybook/addon-actions";
|
|
|
2
2
|
import {withKnobs, select, array} from "@storybook/addon-knobs";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
|
|
5
|
-
import {TabbarItemForTesting as TabbarItem} from "./item
|
|
6
|
-
import Tabbar from "./tabbar
|
|
5
|
+
import {TabbarItemForTesting as TabbarItem} from "./item";
|
|
6
|
+
import Tabbar from "./tabbar";
|
|
7
7
|
|
|
8
8
|
export default {title: "Tab Bar", decorators: [withKnobs]};
|
|
9
9
|
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
1
|
import Color from "@khanacademy/wonder-blocks-color";
|
|
4
2
|
import {View} from "@khanacademy/wonder-blocks-core";
|
|
5
3
|
import {StyleSheet} from "aphrodite";
|
|
6
4
|
import * as React from "react";
|
|
7
5
|
|
|
8
|
-
import TabbarItem from "./item
|
|
6
|
+
import TabbarItem from "./item";
|
|
9
7
|
|
|
10
|
-
import type {TabbarItemType} from "./types
|
|
8
|
+
import type {TabbarItemType} from "./types";
|
|
11
9
|
|
|
12
10
|
const styles = StyleSheet.create({
|
|
13
11
|
tabbar: {
|
|
@@ -22,19 +20,19 @@ const styles = StyleSheet.create({
|
|
|
22
20
|
});
|
|
23
21
|
|
|
24
22
|
type TabbarState = {
|
|
25
|
-
selectedItem: number
|
|
23
|
+
selectedItem: number;
|
|
26
24
|
};
|
|
27
25
|
|
|
28
26
|
type TabbarProps = {
|
|
29
|
-
items: Array<TabbarItemType
|
|
30
|
-
onSelect: (item: TabbarItemType) => void
|
|
27
|
+
items: Array<TabbarItemType>;
|
|
28
|
+
onSelect: (item: TabbarItemType) => void;
|
|
31
29
|
};
|
|
32
30
|
|
|
33
31
|
class Tabbar extends React.Component<TabbarProps, TabbarState> {
|
|
34
32
|
state: TabbarState = {
|
|
35
33
|
selectedItem: 0,
|
|
36
34
|
};
|
|
37
|
-
render(): React.
|
|
35
|
+
render(): React.ReactNode {
|
|
38
36
|
const {items, onSelect} = this.props;
|
|
39
37
|
return (
|
|
40
38
|
<View style={styles.tabbar}>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type TabbarItemType = "Geometry" | "Operators" | "Numbers";
|
|
@@ -6,10 +6,10 @@ import {StyleSheet} from "aphrodite";
|
|
|
6
6
|
import PropTypes from "prop-types";
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
|
|
9
|
-
import {View, Text} from "../fake-react-native-web/index
|
|
9
|
+
import {View, Text} from "../fake-react-native-web/index";
|
|
10
10
|
|
|
11
|
-
import {iconSizeHeightPx, iconSizeWidthPx} from "./common-style
|
|
12
|
-
import Styles from "./styles
|
|
11
|
+
import {iconSizeHeightPx, iconSizeWidthPx} from "./common-style";
|
|
12
|
+
import Styles from "./styles";
|
|
13
13
|
|
|
14
14
|
const {row, centered} = Styles;
|
|
15
15
|
|
|
@@ -10,12 +10,12 @@ import * as React from "react";
|
|
|
10
10
|
import ReactDOM from "react-dom";
|
|
11
11
|
import {connect} from "react-redux";
|
|
12
12
|
|
|
13
|
-
import {KeyTypes} from "../consts
|
|
14
|
-
import KeyConfigs from "../data/key-configs
|
|
13
|
+
import {KeyTypes} from "../consts";
|
|
14
|
+
import KeyConfigs from "../data/key-configs";
|
|
15
15
|
|
|
16
|
-
import GestureManager from "./gesture-manager
|
|
17
|
-
import KeypadButton from "./keypad-button
|
|
18
|
-
import {bordersPropType, keyIdPropType} from "./prop-types
|
|
16
|
+
import GestureManager from "./gesture-manager";
|
|
17
|
+
import KeypadButton from "./keypad-button";
|
|
18
|
+
import {bordersPropType, keyIdPropType} from "./prop-types";
|
|
19
19
|
|
|
20
20
|
class TouchableKeypadButton extends React.Component {
|
|
21
21
|
static propTypes = {
|
|
@@ -7,17 +7,17 @@ import PropTypes from "prop-types";
|
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
import {connect} from "react-redux";
|
|
9
9
|
|
|
10
|
-
import {View} from "../fake-react-native-web/index
|
|
10
|
+
import {View} from "../fake-react-native-web/index";
|
|
11
11
|
|
|
12
12
|
import {
|
|
13
13
|
innerBorderColor,
|
|
14
14
|
innerBorderStyle,
|
|
15
15
|
innerBorderWidthPx,
|
|
16
16
|
offBlack16,
|
|
17
|
-
} from "./common-style
|
|
18
|
-
import Keypad from "./keypad
|
|
19
|
-
import Styles from "./styles
|
|
20
|
-
import Tabbar from "./tabbar/tabbar
|
|
17
|
+
} from "./common-style";
|
|
18
|
+
import Keypad from "./keypad";
|
|
19
|
+
import Styles from "./styles";
|
|
20
|
+
import Tabbar from "./tabbar/tabbar";
|
|
21
21
|
|
|
22
22
|
const {column, row, fullWidth} = Styles;
|
|
23
23
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
/**
|
|
3
2
|
* Constants that are shared between multiple files.
|
|
4
3
|
*/
|
|
@@ -9,25 +8,19 @@ export type KeypadType = "FRACTION" | "EXPRESSION";
|
|
|
9
8
|
export const KeypadTypes = {
|
|
10
9
|
FRACTION: "FRACTION",
|
|
11
10
|
EXPRESSION: "EXPRESSION",
|
|
12
|
-
};
|
|
11
|
+
} as const;
|
|
13
12
|
|
|
14
|
-
export type KeyType =
|
|
15
|
-
| "EMPTY"
|
|
16
|
-
// For numerals, variables, and any other characters that themselves
|
|
13
|
+
export type KeyType = // For numerals, variables, and any other characters that themselves
|
|
17
14
|
// compose 'values'.
|
|
18
|
-
| "
|
|
19
|
-
// For buttons that
|
|
20
|
-
| "OPERATOR"
|
|
21
|
-
// For buttons that move the cursor in an input (including via
|
|
15
|
+
| "EMPTY" // For buttons that insert or adjust math in an input.
|
|
16
|
+
| "VALUE" // For buttons that move the cursor in an input (including via
|
|
22
17
|
// deletion).
|
|
23
|
-
| "
|
|
24
|
-
// For buttons that modify the broader keypad state (e.g., by changing
|
|
18
|
+
| "OPERATOR" // For buttons that modify the broader keypad state (e.g., by changing
|
|
25
19
|
// the visible pane).
|
|
26
|
-
| "
|
|
27
|
-
// For buttons that house multiple buttons and have no action
|
|
20
|
+
| "INPUT_NAVIGATION" // For buttons that house multiple buttons and have no action
|
|
28
21
|
// themselves.
|
|
22
|
+
| "KEYPAD_NAVIGATION" // For the echo animation that appears on press.
|
|
29
23
|
| "MANY"
|
|
30
|
-
// For the echo animation that appears on press.
|
|
31
24
|
| "ECHO";
|
|
32
25
|
|
|
33
26
|
export const KeyTypes = {
|
|
@@ -48,30 +41,32 @@ export const KeyTypes = {
|
|
|
48
41
|
MANY: "MANY",
|
|
49
42
|
// For the echo animation that appears on press.
|
|
50
43
|
ECHO: "ECHO",
|
|
51
|
-
};
|
|
44
|
+
} as const;
|
|
52
45
|
|
|
53
46
|
export const DeviceOrientations = {
|
|
54
47
|
LANDSCAPE: "LANDSCAPE",
|
|
55
48
|
PORTRAIT: "PORTRAIT",
|
|
56
|
-
};
|
|
49
|
+
} as const;
|
|
57
50
|
|
|
58
51
|
export const DeviceTypes = {
|
|
59
52
|
PHONE: "PHONE",
|
|
60
53
|
TABLET: "TABLET",
|
|
61
|
-
};
|
|
54
|
+
} as const;
|
|
62
55
|
|
|
63
56
|
export const LayoutModes = {
|
|
64
57
|
FULLSCREEN: "FULLSCREEN",
|
|
65
58
|
COMPACT: "COMPACT",
|
|
66
|
-
};
|
|
59
|
+
} as const;
|
|
67
60
|
|
|
68
61
|
export const BorderDirections = {
|
|
69
|
-
LEFT:
|
|
70
|
-
BOTTOM:
|
|
71
|
-
};
|
|
72
|
-
export const BorderStyles: {
|
|
73
|
-
[style: string]:
|
|
74
|
-
|
|
62
|
+
LEFT: "LEFT" as const,
|
|
63
|
+
BOTTOM: "BOTTOM" as const,
|
|
64
|
+
} as const;
|
|
65
|
+
export const BorderStyles: {
|
|
66
|
+
[style: string]: ReadonlyArray<
|
|
67
|
+
typeof BorderDirections[keyof typeof BorderDirections]
|
|
68
|
+
>;
|
|
69
|
+
} = {
|
|
75
70
|
LEFT: ["LEFT"],
|
|
76
71
|
BOTTOM: ["BOTTOM"],
|
|
77
72
|
ALL: ["LEFT", "BOTTOM"],
|
|
@@ -82,15 +77,15 @@ export const IconTypes = {
|
|
|
82
77
|
MATH: "MATH",
|
|
83
78
|
SVG: "SVG",
|
|
84
79
|
TEXT: "TEXT",
|
|
85
|
-
};
|
|
80
|
+
} as const;
|
|
86
81
|
|
|
87
82
|
export const DecimalSeparators = {
|
|
88
83
|
COMMA: "COMMA",
|
|
89
84
|
PERIOD: "PERIOD",
|
|
90
|
-
};
|
|
85
|
+
} as const;
|
|
91
86
|
|
|
92
87
|
export const EchoAnimationTypes = {
|
|
93
88
|
SLIDE_AND_FADE: "SLIDE_AND_FADE",
|
|
94
89
|
FADE_ONLY: "FADE_ONLY",
|
|
95
90
|
LONG_FADE_ONLY: "LONG_FADE_ONLY",
|
|
96
|
-
};
|
|
91
|
+
} as const;
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
/**
|
|
3
2
|
* This file contains configuration settings for the buttons in the keypad.
|
|
4
3
|
*/
|
|
5
4
|
import * as i18n from "@khanacademy/wonder-blocks-i18n";
|
|
6
5
|
|
|
7
|
-
import {DecimalSeparators, IconTypes, KeyTypes} from "../consts
|
|
8
|
-
import {decimalSeparator} from "../utils
|
|
6
|
+
import {DecimalSeparators, IconTypes, KeyTypes} from "../consts";
|
|
7
|
+
import {decimalSeparator} from "../utils";
|
|
9
8
|
|
|
10
|
-
import Keys from "./keys
|
|
9
|
+
import Keys from "./keys";
|
|
11
10
|
|
|
12
11
|
export type KeyConfig = {
|
|
13
|
-
id: string
|
|
14
|
-
type: string
|
|
15
|
-
ariaLabel: string
|
|
12
|
+
id: string;
|
|
13
|
+
type: string;
|
|
14
|
+
ariaLabel: string;
|
|
16
15
|
};
|
|
17
16
|
|
|
18
|
-
const KeyConfigs:
|
|
17
|
+
const KeyConfigs: any = {
|
|
19
18
|
// Basic math keys.
|
|
20
19
|
[Keys.PLUS]: {
|
|
21
20
|
type: KeyTypes.OPERATOR,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
/**
|
|
3
2
|
* This file contains constants for keypad buttons that aren't single
|
|
4
3
|
* alphanumeric characters.
|
|
@@ -19,9 +18,9 @@ export type Key =
|
|
|
19
18
|
| "GT"
|
|
20
19
|
| "LT"
|
|
21
20
|
| "GEQ"
|
|
22
|
-
| "LEQ"
|
|
21
|
+
| "LEQ" // mobile native only
|
|
23
22
|
| "FRAC_INCLUSIVE" // mobile native only
|
|
24
|
-
| "FRAC_EXCLUSIVE"
|
|
23
|
+
| "FRAC_EXCLUSIVE"
|
|
25
24
|
| "FRAC"
|
|
26
25
|
| "EXP"
|
|
27
26
|
| "EXP_2"
|
|
@@ -35,10 +34,8 @@ export type Key =
|
|
|
35
34
|
| "LOG"
|
|
36
35
|
| "LOG_N"
|
|
37
36
|
| "SIN"
|
|
38
|
-
| "COS"
|
|
37
|
+
| "COS" // TODO(charlie): Add in additional Greek letters.
|
|
39
38
|
| "TAN"
|
|
40
|
-
|
|
41
|
-
// TODO(charlie): Add in additional Greek letters.
|
|
42
39
|
| "PI"
|
|
43
40
|
| "THETA"
|
|
44
41
|
| "UP"
|
|
@@ -52,14 +49,11 @@ export type Key =
|
|
|
52
49
|
| "JUMP_OUT_BASE"
|
|
53
50
|
| "JUMP_INTO_NUMERATOR"
|
|
54
51
|
| "JUMP_OUT_NUMERATOR"
|
|
55
|
-
| "JUMP_OUT_DENOMINATOR"
|
|
56
|
-
| "NOOP"
|
|
57
|
-
|
|
58
|
-
// Multi-functional keys.
|
|
59
|
-
| "FRAC_MULTI" // mobile native only
|
|
60
|
-
|
|
52
|
+
| "JUMP_OUT_DENOMINATOR" // Multi-functional keys.
|
|
53
|
+
| "NOOP" // mobile native only
|
|
61
54
|
// A custom key that captures an arbitrary number of symbols but has no
|
|
62
55
|
// 'default' symbol or action.
|
|
56
|
+
| "FRAC_MULTI"
|
|
63
57
|
| "MANY";
|
|
64
58
|
|
|
65
59
|
// TODO(charlie): There's duplication between this file and key-configs.js.
|
|
@@ -125,6 +119,6 @@ const Keys = {
|
|
|
125
119
|
// A custom key that captures an arbitrary number of symbols but has no
|
|
126
120
|
// 'default' symbol or action.
|
|
127
121
|
MANY: "MANY",
|
|
128
|
-
};
|
|
122
|
+
} as const;
|
|
129
123
|
|
|
130
124
|
export default Keys;
|
package/src/demo.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
/**
|
|
3
2
|
* This file exports components View and Text which wrap <div> and <span>.
|
|
4
3
|
* We do this so that someday in the future we can use these components with
|
|
@@ -8,5 +7,5 @@
|
|
|
8
7
|
* StyleSheets instead.
|
|
9
8
|
*/
|
|
10
9
|
|
|
11
|
-
export {default as Text} from "./text
|
|
12
|
-
export {default as View} from "./view
|
|
10
|
+
export {default as Text} from "./text";
|
|
11
|
+
export {default as View} from "./view";
|
|
@@ -1,23 +1,21 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
1
|
import {StyleSheet, css} from "aphrodite";
|
|
4
2
|
import * as React from "react";
|
|
5
3
|
|
|
6
4
|
import type {CSSProperties} from "aphrodite";
|
|
7
5
|
|
|
8
|
-
type Props = {
|
|
9
|
-
children: React.
|
|
6
|
+
type Props = {
|
|
7
|
+
children: React.ReactNode;
|
|
10
8
|
// The `dynamicStyle` prop is provided for animating dynamic
|
|
11
9
|
// properties, as creating Aphrodite StyleSheets in animation loops is
|
|
12
10
|
// expensive. `dynamicStyle` should be a raw style object, rather than
|
|
13
11
|
// a StyleSheet.
|
|
14
|
-
dynamicStyle?: CSSProperties
|
|
15
|
-
numberOfLines?: number
|
|
16
|
-
style?: CSSProperties
|
|
17
|
-
|
|
12
|
+
dynamicStyle?: CSSProperties;
|
|
13
|
+
numberOfLines?: number;
|
|
14
|
+
style?: CSSProperties;
|
|
15
|
+
};
|
|
18
16
|
|
|
19
17
|
class Text extends React.Component<Props> {
|
|
20
|
-
render(): React.
|
|
18
|
+
render(): React.ReactNode {
|
|
21
19
|
const {numberOfLines, style} = this.props;
|
|
22
20
|
|
|
23
21
|
const className = css(
|
|
@@ -1,33 +1,31 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
1
|
import {StyleSheet, css} from "aphrodite";
|
|
4
2
|
import * as React from "react";
|
|
5
3
|
|
|
6
4
|
import type {CSSProperties} from "aphrodite";
|
|
7
5
|
|
|
8
|
-
type Props = {
|
|
9
|
-
ariaLabel?: string
|
|
10
|
-
children: React.
|
|
6
|
+
type Props = {
|
|
7
|
+
ariaLabel?: string;
|
|
8
|
+
children: React.ReactNode;
|
|
11
9
|
// The `dynamicStyle` prop is provided for animating dynamic
|
|
12
10
|
// properties, as creating Aphrodite StyleSheets in animation loops is
|
|
13
11
|
// expensive. `dynamicStyle` should be a raw style object, rather than
|
|
14
12
|
// a StyleSheet.
|
|
15
|
-
dynamicStyle?: CSSProperties
|
|
13
|
+
dynamicStyle?: CSSProperties;
|
|
16
14
|
// The `extraClassName` prop should almost never be used. It gives the
|
|
17
15
|
// client a way to provide an additional CSS class name, to augment
|
|
18
16
|
// the class name generated by Aphrodite. (Right now, it's only used to
|
|
19
17
|
// disable some externally-applied CSS that would otherwise be far too
|
|
20
18
|
// difficult to override with inline styles.)
|
|
21
|
-
extraClassName?: string
|
|
22
|
-
numberOfLines?: number
|
|
23
|
-
onClick?: (SyntheticEvent<HTMLDivElement>) => void
|
|
24
|
-
onTouchCancel?: (
|
|
25
|
-
onTouchEnd?: (
|
|
26
|
-
onTouchMove?: (
|
|
27
|
-
onTouchStart?: (
|
|
28
|
-
role?: string
|
|
29
|
-
style?: CSSProperties
|
|
30
|
-
|
|
19
|
+
extraClassName?: string;
|
|
20
|
+
numberOfLines?: number;
|
|
21
|
+
onClick?: (arg1: React.SyntheticEvent<HTMLDivElement>) => void;
|
|
22
|
+
onTouchCancel?: (arg1: React.TouchEvent<HTMLDivElement>) => void;
|
|
23
|
+
onTouchEnd?: (arg1: React.TouchEvent<HTMLDivElement>) => void;
|
|
24
|
+
onTouchMove?: (arg1: React.TouchEvent<HTMLDivElement>) => void;
|
|
25
|
+
onTouchStart?: (arg1: React.TouchEvent<HTMLDivElement>) => void;
|
|
26
|
+
role?: string;
|
|
27
|
+
style?: CSSProperties;
|
|
28
|
+
};
|
|
31
29
|
|
|
32
30
|
class View extends React.Component<Props> {
|
|
33
31
|
// $FlowFixMe[signature-verification-failure]
|
|
@@ -60,7 +58,7 @@ class View extends React.Component<Props> {
|
|
|
60
58
|
},
|
|
61
59
|
});
|
|
62
60
|
|
|
63
|
-
render(): React.
|
|
61
|
+
render(): React.ReactNode {
|
|
64
62
|
const className =
|
|
65
63
|
css(
|
|
66
64
|
View.styles.initial,
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
/**
|
|
3
2
|
* A single entry-point for all of the external-facing functionality.
|
|
4
3
|
*/
|
|
5
4
|
|
|
6
5
|
import "../less/main.less";
|
|
7
6
|
|
|
8
|
-
export {default as KeypadInput} from "./components/input/math-input
|
|
7
|
+
export {default as KeypadInput} from "./components/input/math-input";
|
|
9
8
|
export {
|
|
10
9
|
keypadConfigurationPropType,
|
|
11
10
|
keypadElementPropType,
|
|
12
|
-
} from "./components/prop-types
|
|
13
|
-
export {default as Keypad} from "./components/provided-keypad
|
|
14
|
-
export {KeypadTypes} from "./consts
|
|
15
|
-
export {default as KeyConfigs} from "./data/key-configs
|
|
11
|
+
} from "./components/prop-types";
|
|
12
|
+
export {default as Keypad} from "./components/provided-keypad";
|
|
13
|
+
export {KeypadTypes} from "./consts";
|
|
14
|
+
export {default as KeyConfigs} from "./data/key-configs";
|
|
16
15
|
|
|
17
|
-
import * as CursorContexts from "./components/input/cursor-contexts
|
|
16
|
+
import * as CursorContexts from "./components/input/cursor-contexts";
|
|
18
17
|
|
|
19
18
|
export {CursorContexts};
|
|
20
19
|
|
|
21
|
-
export type {KeypadType, KeyType} from "./consts
|
|
22
|
-
export type {Key} from "./data/keys
|
|
23
|
-
export type {CursorContext} from "./components/input/cursor-contexts
|
|
20
|
+
export type {KeypadType, KeyType} from "./consts";
|
|
21
|
+
export type {Key} from "./data/keys";
|
|
22
|
+
export type {CursorContext} from "./components/input/cursor-contexts";
|
package/src/native-app.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import ReactDOM from "react-dom";
|
|
3
3
|
|
|
4
|
-
import KeyConfigs from "./data/key-configs
|
|
5
|
-
import {View} from "./fake-react-native-web/index
|
|
4
|
+
import KeyConfigs from "./data/key-configs";
|
|
5
|
+
import {View} from "./fake-react-native-web/index";
|
|
6
6
|
|
|
7
|
-
import {KeypadInput} from "./index
|
|
7
|
+
import {KeypadInput} from "./index";
|
|
8
8
|
|
|
9
9
|
// eslint-disable-next-line react/prop-types
|
|
10
10
|
const ManualInput = ({handler}) => {
|