@khanacademy/math-input 0.7.2 → 1.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 +10 -0
- package/dist/actions/index.d.ts +31 -0
- package/dist/actions/index.js.flow +40 -0
- package/dist/components/compute-layout-parameters.d.ts +38 -0
- package/dist/components/compute-layout-parameters.js.flow +49 -0
- package/dist/components/corner-decal.d.ts +12 -0
- package/dist/components/corner-decal.js.flow +15 -0
- package/dist/components/echo-manager.d.ts +26 -0
- package/dist/components/echo-manager.js.flow +29 -0
- package/dist/components/empty-keypad-button.d.ts +13 -0
- package/dist/components/empty-keypad-button.js.flow +23 -0
- package/dist/components/expression-keypad.d.ts +22 -0
- package/dist/components/expression-keypad.js.flow +32 -0
- package/dist/components/fraction-keypad.d.ts +21 -0
- package/dist/components/fraction-keypad.js.flow +30 -0
- package/dist/components/gesture-manager.d.ts +74 -0
- package/dist/components/gesture-manager.js.flow +82 -0
- package/dist/components/gesture-state-machine.d.ts +105 -0
- package/dist/components/gesture-state-machine.js.flow +118 -0
- package/dist/components/icon.d.ts +15 -0
- package/dist/components/icon.js.flow +18 -0
- package/dist/components/input/__tests__/test-math-wrapper.d.ts +8 -0
- package/dist/components/input/__tests__/test-math-wrapper.js.flow +14 -0
- package/dist/components/input/cursor-handle.d.ts +1 -1
- package/dist/components/input/cursor-handle.js.flow +1 -1
- package/dist/components/input/drag-listener.d.ts +13 -0
- package/dist/components/input/drag-listener.js.flow +19 -0
- package/dist/components/input/math-input.d.ts +5 -4
- package/dist/components/input/math-input.js.flow +5 -4
- package/dist/components/input/math-wrapper.d.ts +110 -0
- package/dist/components/input/math-wrapper.js.flow +125 -0
- package/dist/components/input/scroll-into-view.d.ts +11 -0
- package/dist/components/input/scroll-into-view.js.flow +20 -0
- package/dist/components/keypad/button-assets.d.ts +4 -3
- package/dist/components/keypad/button-assets.js.flow +3 -3
- package/dist/components/keypad/button.d.ts +1 -2
- package/dist/components/keypad/button.js.flow +1 -2
- package/dist/components/keypad/keypad-page-items.d.ts +15 -10
- package/dist/components/keypad/keypad-page-items.js.flow +20 -10
- package/dist/components/keypad-button.d.ts +52 -0
- package/dist/components/keypad-button.js.flow +79 -0
- package/dist/components/keypad-container.d.ts +40 -0
- package/dist/components/keypad-container.js.flow +58 -0
- package/dist/components/keypad.d.ts +31 -0
- package/dist/components/keypad.js.flow +40 -0
- package/dist/components/many-keypad-button.d.ts +15 -0
- package/dist/components/many-keypad-button.js.flow +17 -0
- package/dist/components/math-icon.d.ts +16 -0
- package/dist/components/math-icon.js.flow +19 -0
- package/dist/components/multi-symbol-grid.d.ts +14 -0
- package/dist/components/multi-symbol-grid.js.flow +16 -0
- package/dist/components/multi-symbol-popover.d.ts +12 -0
- package/dist/components/multi-symbol-popover.js.flow +15 -0
- package/dist/components/navigation-pad.d.ts +14 -0
- package/dist/components/navigation-pad.js.flow +16 -0
- package/dist/components/node-manager.d.ts +53 -0
- package/dist/components/node-manager.js.flow +65 -0
- package/dist/components/popover-manager.d.ts +13 -0
- package/dist/components/popover-manager.js.flow +15 -0
- package/dist/components/popover-state-machine.d.ts +75 -0
- package/dist/components/popover-state-machine.js.flow +83 -0
- package/dist/components/provided-keypad.d.ts +8 -7
- package/dist/components/provided-keypad.js.flow +8 -7
- package/dist/components/styles.d.ts +6 -0
- package/dist/components/styles.js.flow +13 -0
- package/dist/components/svg-icon.d.ts +12 -0
- package/dist/components/svg-icon.js.flow +15 -0
- package/dist/components/tabbar/icons.d.ts +3 -2
- package/dist/components/tabbar/icons.js.flow +3 -2
- package/dist/components/tabbar/item.d.ts +1 -2
- package/dist/components/tabbar/item.js.flow +1 -2
- package/dist/components/tabbar/tabbar.d.ts +3 -3
- package/dist/components/tabbar/tabbar.js.flow +3 -3
- package/dist/components/text-icon.d.ts +13 -0
- package/dist/components/text-icon.js.flow +16 -0
- package/dist/components/touchable-keypad-button.d.ts +30 -0
- package/dist/components/touchable-keypad-button.js.flow +35 -0
- package/dist/components/two-page-keypad.d.ts +20 -0
- package/dist/components/two-page-keypad.js.flow +30 -0
- package/dist/components/velocity-tracker.d.ts +48 -0
- package/dist/components/velocity-tracker.js.flow +54 -0
- package/dist/es/index.js +938 -1059
- package/dist/es/index.js.map +1 -1
- package/dist/fake-react-native-web/text.d.ts +2 -1
- package/dist/fake-react-native-web/text.js.flow +2 -1
- package/dist/fake-react-native-web/view.d.ts +3 -2
- package/dist/fake-react-native-web/view.js.flow +3 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +988 -1089
- package/dist/index.js.flow +1 -4
- package/dist/index.js.map +1 -1
- package/dist/store/echo-reducer.d.ts +5 -0
- package/dist/store/echo-reducer.js.flow +14 -0
- package/dist/store/index.d.ts +46 -1
- package/dist/store/index.js.flow +64 -1
- package/dist/store/input-reducer.d.ts +7 -0
- package/dist/store/input-reducer.js.flow +16 -0
- package/dist/store/keypad-reducer.d.ts +9 -0
- package/dist/store/keypad-reducer.js.flow +18 -0
- package/dist/store/layout-reducer.d.ts +21 -0
- package/dist/store/layout-reducer.js.flow +30 -0
- package/dist/store/pager-reducer.d.ts +13 -0
- package/dist/store/pager-reducer.js.flow +22 -0
- package/dist/store/shared.d.ts +6 -0
- package/dist/store/shared.js.flow +13 -0
- package/dist/store/types.d.ts +57 -0
- package/dist/store/types.js.flow +63 -0
- package/dist/types.d.ts +50 -0
- package/dist/types.js.flow +61 -0
- package/package.json +1 -1
- package/src/actions/{index.js → index.ts} +5 -5
- package/src/components/__tests__/{gesture-state-machine_test.js → gesture-state-machine.test.ts} +5 -1
- package/src/components/__tests__/{two-page-keypad_test.js → two-page-keypad.test.tsx} +0 -2
- package/src/components/{corner-decal.js → corner-decal.tsx} +6 -5
- package/src/components/{echo-manager.js → echo-manager.tsx} +29 -24
- package/src/components/{empty-keypad-button.js → empty-keypad-button.tsx} +17 -10
- package/src/components/{expression-keypad.js → expression-keypad.tsx} +27 -25
- package/src/components/{fraction-keypad.js → fraction-keypad.tsx} +21 -16
- package/src/components/{gesture-manager.js → gesture-manager.tsx} +10 -4
- package/src/components/{gesture-state-machine.js → gesture-state-machine.ts} +49 -3
- package/src/components/{icon.js → icon.tsx} +12 -14
- package/src/components/input/cursor-handle.tsx +1 -1
- package/src/components/input/{drag-listener.js → drag-listener.ts} +4 -0
- package/src/components/input/math-input.tsx +10 -9
- package/src/components/input/{math-wrapper.js → math-wrapper.ts} +10 -6
- package/src/components/input/{scroll-into-view.js → scroll-into-view.ts} +5 -15
- package/src/components/keypad/button-assets.tsx +4 -5
- package/src/components/keypad/button.tsx +1 -2
- package/src/components/keypad/index.tsx +1 -1
- package/src/components/keypad/keypad-page-items.tsx +33 -10
- package/src/components/{keypad-button.js → keypad-button.tsx} +42 -37
- package/src/components/{keypad-container.js → keypad-container.tsx} +41 -23
- package/src/components/{keypad.js → keypad.tsx} +31 -23
- package/src/components/{many-keypad-button.js → many-keypad-button.tsx} +8 -6
- package/src/components/{math-icon.js → math-icon.tsx} +7 -6
- package/src/components/{multi-symbol-grid.js → multi-symbol-grid.tsx} +8 -8
- package/src/components/{multi-symbol-popover.js → multi-symbol-popover.tsx} +5 -6
- package/src/components/{navigation-pad.js → navigation-pad.tsx} +7 -6
- package/src/components/{node-manager.js → node-manager.ts} +16 -4
- package/src/components/{popover-manager.js → popover-manager.tsx} +13 -16
- package/src/components/{popover-state-machine.js → popover-state-machine.ts} +21 -2
- package/src/components/prop-types.js +1 -67
- package/src/components/provided-keypad.tsx +14 -12
- package/src/components/{svg-icon.js → svg-icon.tsx} +5 -6
- package/src/components/tabbar/icons.tsx +4 -2
- package/src/components/tabbar/item.tsx +1 -3
- package/src/components/tabbar/{tabbar.stories.js → tabbar.stories.tsx} +10 -1
- package/src/components/tabbar/tabbar.tsx +3 -3
- package/src/components/{text-icon.js → text-icon.tsx} +7 -6
- package/src/components/{touchable-keypad-button.js → touchable-keypad-button.tsx} +19 -16
- package/src/components/{two-page-keypad.js → two-page-keypad.tsx} +13 -9
- package/src/components/{velocity-tracker.js → velocity-tracker.ts} +14 -4
- package/src/fake-react-native-web/text.tsx +2 -1
- package/src/fake-react-native-web/view.tsx +3 -2
- package/src/index.ts +1 -4
- package/src/store/echo-reducer.ts +58 -0
- package/src/store/index.ts +14 -425
- package/src/store/input-reducer.ts +55 -0
- package/src/store/keypad-reducer.ts +62 -0
- package/src/store/layout-reducer.ts +133 -0
- package/src/store/pager-reducer.ts +141 -0
- package/src/store/shared.ts +12 -0
- package/src/store/types.ts +65 -0
- package/src/types.ts +69 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/src/components/app.js +0 -73
- package/src/demo.js +0 -9
- package/src/native-app.js +0 -85
- /package/src/components/__tests__/{node-manager_test.js → node-manager.test.ts} +0 -0
- /package/src/components/{compute-layout-parameters.js → compute-layout-parameters.ts} +0 -0
- /package/src/components/input/__tests__/{context-tracking_test.js → context-tracking.test.ts} +0 -0
- /package/src/components/input/__tests__/{mathquill_test.js → mathquill.test.ts} +0 -0
- /package/src/components/input/__tests__/{test-math-wrapper.jsx → test-math-wrapper.ts} +0 -0
- /package/src/components/keypad/{button.stories.js → button.stories.tsx} +0 -0
- /package/src/components/{styles.js → styles.ts} +0 -0
- /package/src/components/tabbar/__tests__/{tabbar_test.js → tabbar.test.tsx} +0 -0
|
@@ -7,23 +7,33 @@
|
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
import type { KeyConfig } from "../../data/key-configs";
|
|
9
9
|
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
10
|
-
declare
|
|
10
|
+
declare type KeypadPageContainerProps = {|
|
|
11
11
|
children: React.Node,
|
|
12
|
-
|}
|
|
13
|
-
declare export var
|
|
12
|
+
|};
|
|
13
|
+
declare export var KeypadPageContainer: (
|
|
14
|
+
x: KeypadPageContainerProps
|
|
15
|
+
) => React.Element<any>;
|
|
16
|
+
declare type KeypadButtonProps = {|
|
|
14
17
|
keyConfig: KeyConfig,
|
|
15
18
|
tintColor?: string,
|
|
16
19
|
style?: StyleType,
|
|
17
20
|
onClickKey: (keyConfig: string) => void,
|
|
18
|
-
|}
|
|
19
|
-
declare export var
|
|
21
|
+
|};
|
|
22
|
+
declare export var KeypadButton: (x: KeypadButtonProps) => React.Element<any>;
|
|
23
|
+
declare type SecondaryKeypadButtonProps = {|
|
|
20
24
|
keyConfig: KeyConfig,
|
|
21
|
-
style?:
|
|
25
|
+
style?: StyleType,
|
|
22
26
|
onClickKey: (keyConfig: string) => void,
|
|
23
|
-
|}
|
|
24
|
-
declare export var
|
|
27
|
+
|};
|
|
28
|
+
declare export var SecondaryKeypadButton: (
|
|
29
|
+
x: SecondaryKeypadButtonProps
|
|
30
|
+
) => React.Element<any>;
|
|
31
|
+
declare type KeypadActionButtonProps = {|
|
|
25
32
|
keyConfig: KeyConfig,
|
|
26
|
-
style?:
|
|
33
|
+
style?: StyleType,
|
|
27
34
|
onClickKey: (keyConfig: string) => void,
|
|
28
|
-
|}
|
|
35
|
+
|};
|
|
36
|
+
declare export var KeypadActionButton: (
|
|
37
|
+
x: KeypadActionButtonProps
|
|
38
|
+
) => React.Element<any>;
|
|
29
39
|
declare export var PlaceHolderButton: () => React.Element<any>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A component that renders a keypad button.
|
|
3
|
+
*/
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import type { KeyType } from "../consts";
|
|
6
|
+
import type { Border, KeyConfig, Icon as IconType } from "../types";
|
|
7
|
+
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
8
|
+
interface ReduxProps {
|
|
9
|
+
heightPx: number;
|
|
10
|
+
widthPx: number;
|
|
11
|
+
}
|
|
12
|
+
interface Props extends ReduxProps {
|
|
13
|
+
ariaLabel?: string;
|
|
14
|
+
borders: Border;
|
|
15
|
+
childKeys: ReadonlyArray<KeyConfig>;
|
|
16
|
+
disabled: boolean;
|
|
17
|
+
focused: boolean;
|
|
18
|
+
popoverEnabled: boolean;
|
|
19
|
+
type: KeyType;
|
|
20
|
+
icon: IconType;
|
|
21
|
+
style?: StyleType;
|
|
22
|
+
onTouchCancel?: (evt: React.TouchEvent<HTMLDivElement>) => void;
|
|
23
|
+
onTouchEnd?: (evt: React.TouchEvent<HTMLDivElement>) => void;
|
|
24
|
+
onTouchMove?: (evt: React.TouchEvent<HTMLDivElement>) => void;
|
|
25
|
+
onTouchStart?: (evt: React.TouchEvent<HTMLDivElement>) => void;
|
|
26
|
+
ref?: (any: any) => void;
|
|
27
|
+
}
|
|
28
|
+
declare class KeypadButton extends React.PureComponent<Props> {
|
|
29
|
+
buttonSizeStyle: StyleType | undefined;
|
|
30
|
+
static defaultProps: {
|
|
31
|
+
borders: readonly ("LEFT" | "BOTTOM")[];
|
|
32
|
+
childKeys: never[];
|
|
33
|
+
disabled: boolean;
|
|
34
|
+
focused: boolean;
|
|
35
|
+
popoverEnabled: boolean;
|
|
36
|
+
};
|
|
37
|
+
UNSAFE_componentWillMount(): void;
|
|
38
|
+
componentDidMount(): void;
|
|
39
|
+
UNSAFE_componentWillUpdate(newProps: any, newState: any): void;
|
|
40
|
+
_preInjectStyles: () => void;
|
|
41
|
+
_getFocusStyle: (type: any) => any[];
|
|
42
|
+
_getButtonStyle: (type: any, borders: any, style?: any) => any[];
|
|
43
|
+
render(): JSX.Element;
|
|
44
|
+
}
|
|
45
|
+
declare const _default: import("react-redux").ConnectedComponent<typeof KeypadButton, import("react-redux").Omit<Pick<Props, "style" | "icon" | "ref" | "ariaLabel" | "onTouchCancel" | "onTouchEnd" | "onTouchMove" | "onTouchStart" | "type" | "heightPx" | "widthPx"> & {
|
|
46
|
+
disabled?: boolean | undefined;
|
|
47
|
+
focused?: boolean | undefined;
|
|
48
|
+
borders?: ("LEFT" | "BOTTOM" | undefined)[] | undefined;
|
|
49
|
+
childKeys?: readonly KeyConfig[] | undefined;
|
|
50
|
+
popoverEnabled?: boolean | undefined;
|
|
51
|
+
} & {}, "heightPx" | "widthPx">>;
|
|
52
|
+
export default _default;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for data
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.21.0
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import * as $Flowgen$Import$react_2d_redux from "react-redux";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import type { KeyType } from "../consts";
|
|
10
|
+
import type { Border, KeyConfig, Icon as IconType } from "../types";
|
|
11
|
+
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
12
|
+
declare interface ReduxProps {
|
|
13
|
+
heightPx: number;
|
|
14
|
+
widthPx: number;
|
|
15
|
+
}
|
|
16
|
+
declare type Props = {
|
|
17
|
+
ariaLabel?: string,
|
|
18
|
+
borders: Border,
|
|
19
|
+
childKeys: $ReadOnlyArray<KeyConfig>,
|
|
20
|
+
disabled: boolean,
|
|
21
|
+
focused: boolean,
|
|
22
|
+
popoverEnabled: boolean,
|
|
23
|
+
type: KeyType,
|
|
24
|
+
icon: IconType,
|
|
25
|
+
style?: StyleType,
|
|
26
|
+
onTouchCancel?: (evt: SyntheticTouchEvent<HTMLDivElement>) => void,
|
|
27
|
+
onTouchEnd?: (evt: SyntheticTouchEvent<HTMLDivElement>) => void,
|
|
28
|
+
onTouchMove?: (evt: SyntheticTouchEvent<HTMLDivElement>) => void,
|
|
29
|
+
onTouchStart?: (evt: SyntheticTouchEvent<HTMLDivElement>) => void,
|
|
30
|
+
ref?: (any: any) => void,
|
|
31
|
+
} & ReduxProps;
|
|
32
|
+
declare class KeypadButton extends React.PureComponent<Props> {
|
|
33
|
+
buttonSizeStyle: StyleType | void;
|
|
34
|
+
static defaultProps: {|
|
|
35
|
+
borders: $ReadOnlyArray<"LEFT" | "BOTTOM">,
|
|
36
|
+
childKeys: empty[],
|
|
37
|
+
disabled: boolean,
|
|
38
|
+
focused: boolean,
|
|
39
|
+
popoverEnabled: boolean,
|
|
40
|
+
|};
|
|
41
|
+
UNSAFE_componentWillMount(): void;
|
|
42
|
+
componentDidMount(): void;
|
|
43
|
+
UNSAFE_componentWillUpdate(newProps: any, newState: any): void;
|
|
44
|
+
_preInjectStyles: () => void;
|
|
45
|
+
_getFocusStyle: (type: any) => any[];
|
|
46
|
+
_getButtonStyle: (type: any, borders: any, style?: any) => any[];
|
|
47
|
+
render(): React$Node;
|
|
48
|
+
}
|
|
49
|
+
declare var _default: $Flowgen$Import$react_2d_redux.ConnectedComponent<
|
|
50
|
+
typeof KeypadButton,
|
|
51
|
+
$Flowgen$Import$react_2d_redux.Omit<
|
|
52
|
+
{|
|
|
53
|
+
...Pick<
|
|
54
|
+
Props,
|
|
55
|
+
| "style"
|
|
56
|
+
| "icon"
|
|
57
|
+
| "ref"
|
|
58
|
+
| "ariaLabel"
|
|
59
|
+
| "onTouchCancel"
|
|
60
|
+
| "onTouchEnd"
|
|
61
|
+
| "onTouchMove"
|
|
62
|
+
| "onTouchStart"
|
|
63
|
+
| "type"
|
|
64
|
+
| "heightPx"
|
|
65
|
+
| "widthPx"
|
|
66
|
+
>,
|
|
67
|
+
...{|
|
|
68
|
+
disabled?: boolean | void,
|
|
69
|
+
focused?: boolean | void,
|
|
70
|
+
borders?: ("LEFT" | "BOTTOM" | void)[] | void,
|
|
71
|
+
childKeys?: $ReadOnlyArray<KeyConfig> | void,
|
|
72
|
+
popoverEnabled?: boolean | void,
|
|
73
|
+
|},
|
|
74
|
+
...{||},
|
|
75
|
+
|},
|
|
76
|
+
"heightPx" | "widthPx"
|
|
77
|
+
>
|
|
78
|
+
>;
|
|
79
|
+
declare export default typeof _default;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { LayoutModes } from "../consts";
|
|
3
|
+
import type { KeypadType } from "../consts";
|
|
4
|
+
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
5
|
+
interface ReduxProps {
|
|
6
|
+
active?: boolean;
|
|
7
|
+
extraKeys?: ReadonlyArray<string>;
|
|
8
|
+
keypadType?: KeypadType;
|
|
9
|
+
layoutMode?: keyof typeof LayoutModes;
|
|
10
|
+
navigationPadEnabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface Props extends ReduxProps {
|
|
13
|
+
onDismiss?: () => void;
|
|
14
|
+
onElementMounted: (element: any) => void;
|
|
15
|
+
onPageSizeChange?: (width: number, height: number) => void;
|
|
16
|
+
style?: StyleType;
|
|
17
|
+
}
|
|
18
|
+
type State = {
|
|
19
|
+
hasBeenActivated: boolean;
|
|
20
|
+
viewportWidth: string | number;
|
|
21
|
+
};
|
|
22
|
+
declare class KeypadContainer extends React.Component<Props, State> {
|
|
23
|
+
_resizeTimeout: number | null | undefined;
|
|
24
|
+
hasMounted: boolean | undefined;
|
|
25
|
+
state: {
|
|
26
|
+
hasBeenActivated: boolean;
|
|
27
|
+
viewportWidth: string;
|
|
28
|
+
};
|
|
29
|
+
UNSAFE_componentWillMount(): void;
|
|
30
|
+
componentDidMount(): void;
|
|
31
|
+
UNSAFE_componentWillReceiveProps(nextProps: any): void;
|
|
32
|
+
componentDidUpdate(prevProps: any): void;
|
|
33
|
+
componentWillUnmount(): void;
|
|
34
|
+
_throttleResizeHandler: () => void;
|
|
35
|
+
_onResize: () => void;
|
|
36
|
+
renderKeypad: () => JSX.Element;
|
|
37
|
+
render(): JSX.Element;
|
|
38
|
+
}
|
|
39
|
+
declare const _default: import("react-redux").ConnectedComponent<typeof KeypadContainer, import("react-redux").Omit<React.ClassAttributes<KeypadContainer> & Props, "active" | "extraKeys" | "navigationPadEnabled" | "keypadType" | "onPageSizeChange" | "layoutMode">>;
|
|
40
|
+
export default _default;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for data
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.21.0
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import * as $Flowgen$Import$react_2d_redux from "react-redux";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { LayoutModes } from "../consts";
|
|
10
|
+
import type { KeypadType } from "../consts";
|
|
11
|
+
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
12
|
+
declare interface ReduxProps {
|
|
13
|
+
active?: boolean;
|
|
14
|
+
extraKeys?: $ReadOnlyArray<string>;
|
|
15
|
+
keypadType?: KeypadType;
|
|
16
|
+
layoutMode?: $Keys<typeof LayoutModes>;
|
|
17
|
+
navigationPadEnabled?: boolean;
|
|
18
|
+
}
|
|
19
|
+
declare type Props = {
|
|
20
|
+
onDismiss?: () => void,
|
|
21
|
+
onElementMounted: (element: any) => void,
|
|
22
|
+
onPageSizeChange?: (width: number, height: number) => void,
|
|
23
|
+
style?: StyleType,
|
|
24
|
+
} & ReduxProps;
|
|
25
|
+
declare type State = {|
|
|
26
|
+
hasBeenActivated: boolean,
|
|
27
|
+
viewportWidth: string | number,
|
|
28
|
+
|};
|
|
29
|
+
declare class KeypadContainer extends React.Component<Props, State> {
|
|
30
|
+
_resizeTimeout: number | null | void;
|
|
31
|
+
hasMounted: boolean | void;
|
|
32
|
+
state: {|
|
|
33
|
+
hasBeenActivated: boolean,
|
|
34
|
+
viewportWidth: string,
|
|
35
|
+
|};
|
|
36
|
+
UNSAFE_componentWillMount(): void;
|
|
37
|
+
componentDidMount(): void;
|
|
38
|
+
UNSAFE_componentWillReceiveProps(nextProps: any): void;
|
|
39
|
+
componentDidUpdate(prevProps: any): void;
|
|
40
|
+
componentWillUnmount(): void;
|
|
41
|
+
_throttleResizeHandler: () => void;
|
|
42
|
+
_onResize: () => void;
|
|
43
|
+
renderKeypad: () => React$Node;
|
|
44
|
+
render(): React$Node;
|
|
45
|
+
}
|
|
46
|
+
declare var _default: $Flowgen$Import$react_2d_redux.ConnectedComponent<
|
|
47
|
+
typeof KeypadContainer,
|
|
48
|
+
$Flowgen$Import$react_2d_redux.Omit<
|
|
49
|
+
{| ...React.ClassAttributes<KeypadContainer>, ...Props |},
|
|
50
|
+
| "active"
|
|
51
|
+
| "extraKeys"
|
|
52
|
+
| "navigationPadEnabled"
|
|
53
|
+
| "keypadType"
|
|
54
|
+
| "onPageSizeChange"
|
|
55
|
+
| "layoutMode"
|
|
56
|
+
>
|
|
57
|
+
>;
|
|
58
|
+
declare export default typeof _default;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A keypad component that acts as a container for rows or columns of buttons,
|
|
3
|
+
* and manages the rendering of echo animations on top of those buttons.
|
|
4
|
+
*/
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import type { Popover, Echo } from "../types";
|
|
7
|
+
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
8
|
+
interface ReduxProps {
|
|
9
|
+
active: boolean;
|
|
10
|
+
echoes: ReadonlyArray<Echo>;
|
|
11
|
+
popover: Popover | null;
|
|
12
|
+
}
|
|
13
|
+
interface Props extends ReduxProps {
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
style?: StyleType;
|
|
16
|
+
removeEcho?: (animationId: string) => void;
|
|
17
|
+
}
|
|
18
|
+
declare class Keypad extends React.Component<Props> {
|
|
19
|
+
_isMounted: boolean | undefined;
|
|
20
|
+
_resizeTimeout: number | null | undefined;
|
|
21
|
+
_container: DOMRect | null | undefined;
|
|
22
|
+
componentDidMount(): void;
|
|
23
|
+
UNSAFE_componentWillReceiveProps(newProps: any): void;
|
|
24
|
+
componentWillUnmount(): void;
|
|
25
|
+
_computeContainer: () => void;
|
|
26
|
+
_updateSizeAndPosition: () => void;
|
|
27
|
+
_onResize: () => void;
|
|
28
|
+
render(): JSX.Element;
|
|
29
|
+
}
|
|
30
|
+
declare const _default: import("react-redux").ConnectedComponent<typeof Keypad, import("react-redux").Omit<React.ClassAttributes<Keypad> & Props, "active" | "popover" | "echoes" | "removeEcho">>;
|
|
31
|
+
export default _default;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for data
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.21.0
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import * as $Flowgen$Import$react_2d_redux from "react-redux";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import type { Popover, Echo } from "../types";
|
|
10
|
+
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
11
|
+
declare interface ReduxProps {
|
|
12
|
+
active: boolean;
|
|
13
|
+
echoes: $ReadOnlyArray<Echo>;
|
|
14
|
+
popover: Popover | null;
|
|
15
|
+
}
|
|
16
|
+
declare type Props = {
|
|
17
|
+
children: React.Node,
|
|
18
|
+
style?: StyleType,
|
|
19
|
+
removeEcho?: (animationId: string) => void,
|
|
20
|
+
} & ReduxProps;
|
|
21
|
+
declare class Keypad extends React.Component<Props> {
|
|
22
|
+
_isMounted: boolean | void;
|
|
23
|
+
_resizeTimeout: number | null | void;
|
|
24
|
+
_container: DOMRect | null | void;
|
|
25
|
+
componentDidMount(): void;
|
|
26
|
+
UNSAFE_componentWillReceiveProps(newProps: any): void;
|
|
27
|
+
componentWillUnmount(): void;
|
|
28
|
+
_computeContainer: () => void;
|
|
29
|
+
_updateSizeAndPosition: () => void;
|
|
30
|
+
_onResize: () => void;
|
|
31
|
+
render(): React$Node;
|
|
32
|
+
}
|
|
33
|
+
declare var _default: $Flowgen$Import$react_2d_redux.ConnectedComponent<
|
|
34
|
+
typeof Keypad,
|
|
35
|
+
$Flowgen$Import$react_2d_redux.Omit<
|
|
36
|
+
{| ...React.ClassAttributes<Keypad>, ...Props |},
|
|
37
|
+
"active" | "popover" | "echoes" | "removeEcho"
|
|
38
|
+
>
|
|
39
|
+
>;
|
|
40
|
+
declare export default typeof _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A keypad button that displays an arbitrary number of symbols, with no
|
|
3
|
+
* 'default' symbol.
|
|
4
|
+
*/
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
type Props = {
|
|
7
|
+
keys: ReadonlyArray<string>;
|
|
8
|
+
};
|
|
9
|
+
declare class ManyKeypadButton extends React.Component<Props> {
|
|
10
|
+
static defaultProps: {
|
|
11
|
+
keys: never[];
|
|
12
|
+
};
|
|
13
|
+
render(): JSX.Element;
|
|
14
|
+
}
|
|
15
|
+
export default ManyKeypadButton;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for data
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.21.0
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
declare type Props = {|
|
|
9
|
+
keys: $ReadOnlyArray<string>,
|
|
10
|
+
|};
|
|
11
|
+
declare class ManyKeypadButton extends React.Component<Props> {
|
|
12
|
+
static defaultProps: {|
|
|
13
|
+
keys: empty[],
|
|
14
|
+
|};
|
|
15
|
+
render(): React$Node;
|
|
16
|
+
}
|
|
17
|
+
declare export default typeof ManyKeypadButton;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A component that renders an icon with math (via KaTeX).
|
|
3
|
+
*/
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
6
|
+
type Props = {
|
|
7
|
+
math: string;
|
|
8
|
+
style: StyleType;
|
|
9
|
+
};
|
|
10
|
+
declare class MathIcon extends React.Component<Props> {
|
|
11
|
+
componentDidMount(): void;
|
|
12
|
+
componentDidUpdate(prevProps: any): void;
|
|
13
|
+
_renderMath: () => void;
|
|
14
|
+
render(): JSX.Element;
|
|
15
|
+
}
|
|
16
|
+
export default MathIcon;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for data
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.21.0
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
9
|
+
declare type Props = {|
|
|
10
|
+
math: string,
|
|
11
|
+
style: StyleType,
|
|
12
|
+
|};
|
|
13
|
+
declare class MathIcon extends React.Component<Props> {
|
|
14
|
+
componentDidMount(): void;
|
|
15
|
+
componentDidUpdate(prevProps: any): void;
|
|
16
|
+
_renderMath: () => void;
|
|
17
|
+
render(): React$Node;
|
|
18
|
+
}
|
|
19
|
+
declare export default typeof MathIcon;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A grid of symbols, rendered as text and positioned based on the number of
|
|
3
|
+
* symbols provided. Up to four symbols will be shown.
|
|
4
|
+
*/
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import type { Icon as IconType } from "../types";
|
|
7
|
+
type Props = {
|
|
8
|
+
focused: boolean;
|
|
9
|
+
icons: ReadonlyArray<IconType>;
|
|
10
|
+
};
|
|
11
|
+
declare class MultiSymbolGrid extends React.Component<Props> {
|
|
12
|
+
render(): JSX.Element;
|
|
13
|
+
}
|
|
14
|
+
export default MultiSymbolGrid;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for data
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.21.0
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
import type { Icon as IconType } from "../types";
|
|
9
|
+
declare type Props = {|
|
|
10
|
+
focused: boolean,
|
|
11
|
+
icons: $ReadOnlyArray<IconType>,
|
|
12
|
+
|};
|
|
13
|
+
declare class MultiSymbolGrid extends React.Component<Props> {
|
|
14
|
+
render(): React$Node;
|
|
15
|
+
}
|
|
16
|
+
declare export default typeof MultiSymbolGrid;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A popover that renders a set of keys floating above the page.
|
|
3
|
+
*/
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { KeyConfig } from "../types";
|
|
6
|
+
type Prop = {
|
|
7
|
+
keys: ReadonlyArray<KeyConfig>;
|
|
8
|
+
};
|
|
9
|
+
declare class MultiSymbolPopover extends React.Component<Prop> {
|
|
10
|
+
render(): JSX.Element;
|
|
11
|
+
}
|
|
12
|
+
export default MultiSymbolPopover;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for data
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.21.0
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
import { KeyConfig } from "../types";
|
|
9
|
+
declare type Prop = {|
|
|
10
|
+
keys: $ReadOnlyArray<KeyConfig>,
|
|
11
|
+
|};
|
|
12
|
+
declare class MultiSymbolPopover extends React.Component<Prop> {
|
|
13
|
+
render(): React$Node;
|
|
14
|
+
}
|
|
15
|
+
declare export default typeof MultiSymbolPopover;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A component that renders a navigation pad, which consists of an arrow for
|
|
3
|
+
* each possible direction.
|
|
4
|
+
*/
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
7
|
+
type Props = {
|
|
8
|
+
roundTopLeft: boolean;
|
|
9
|
+
style: StyleType;
|
|
10
|
+
};
|
|
11
|
+
declare class NavigationPad extends React.Component<Props> {
|
|
12
|
+
render(): JSX.Element;
|
|
13
|
+
}
|
|
14
|
+
export default NavigationPad;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for data
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.21.0
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
9
|
+
declare type Props = {|
|
|
10
|
+
roundTopLeft: boolean,
|
|
11
|
+
style: StyleType,
|
|
12
|
+
|};
|
|
13
|
+
declare class NavigationPad extends React.Component<Props> {
|
|
14
|
+
render(): React$Node;
|
|
15
|
+
}
|
|
16
|
+
declare export default typeof NavigationPad;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Border } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* A manager for our node-to-ID system. In particular, this class is
|
|
4
|
+
* responsible for maintaing a mapping between DOM nodes and node IDs, and
|
|
5
|
+
* translating touch events from the raw positions at which they occur to the
|
|
6
|
+
* nodes over which they are occurring. This differs from browser behavior, in
|
|
7
|
+
* which touch events are only sent to the node in which a touch started.
|
|
8
|
+
*/
|
|
9
|
+
declare class NodeManager {
|
|
10
|
+
_nodesById: Record<string, HTMLElement>;
|
|
11
|
+
_bordersById: Record<string, Border>;
|
|
12
|
+
_orderedIds: ReadonlyArray<string>;
|
|
13
|
+
_cachedBoundingBoxesById: Record<string, DOMRect>;
|
|
14
|
+
constructor();
|
|
15
|
+
/**
|
|
16
|
+
* Register a DOM node with a given identifier.
|
|
17
|
+
*
|
|
18
|
+
* @param {string} id - the identifier of the given node
|
|
19
|
+
* @param {node} domNode - the DOM node linked to the identifier
|
|
20
|
+
* @param {object} borders - an opaque object describing the node's borders
|
|
21
|
+
*/
|
|
22
|
+
registerDOMNode(id: string, domNode: HTMLElement, childIds: ReadonlyArray<string>, borders: Border): void;
|
|
23
|
+
/**
|
|
24
|
+
* Unregister the DOM node with the given identifier.
|
|
25
|
+
*
|
|
26
|
+
* @param {string} id - the identifier of the node to unregister
|
|
27
|
+
*/
|
|
28
|
+
unregisterDOMNode(id: string): void;
|
|
29
|
+
/**
|
|
30
|
+
* Return the identifier of the topmost node located at the given
|
|
31
|
+
* coordinates.
|
|
32
|
+
*
|
|
33
|
+
* @param {number} x - the x coordinate at which to search for a node
|
|
34
|
+
* @param {number} y - the y coordinate at which to search for a node
|
|
35
|
+
* @returns {null|string} - null or the identifier of the topmost node at
|
|
36
|
+
* the given coordinates
|
|
37
|
+
*/
|
|
38
|
+
idForCoords(x: number, y: number): string | void;
|
|
39
|
+
/**
|
|
40
|
+
* Return the necessary layout information, including the bounds and border
|
|
41
|
+
* values, for the node with the given identifier.
|
|
42
|
+
*
|
|
43
|
+
* @param {string} id - the identifier of the node for which to return the
|
|
44
|
+
* layout information
|
|
45
|
+
* @returns {object} - the bounding client rect for the given node, along
|
|
46
|
+
* with its borders
|
|
47
|
+
*/
|
|
48
|
+
layoutPropsForId(id: string): {
|
|
49
|
+
initialBounds: DOMRect;
|
|
50
|
+
borders: Border;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export default NodeManager;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for data
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.21.0
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import type { Border } from "../types";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A manager for our node-to-ID system. In particular, this class is
|
|
11
|
+
* responsible for maintaing a mapping between DOM nodes and node IDs, and
|
|
12
|
+
* translating touch events from the raw positions at which they occur to the
|
|
13
|
+
* nodes over which they are occurring. This differs from browser behavior, in
|
|
14
|
+
* which touch events are only sent to the node in which a touch started.
|
|
15
|
+
*/
|
|
16
|
+
declare class NodeManager {
|
|
17
|
+
_nodesById: { [key: string]: HTMLElement };
|
|
18
|
+
_bordersById: { [key: string]: Border };
|
|
19
|
+
_orderedIds: $ReadOnlyArray<string>;
|
|
20
|
+
_cachedBoundingBoxesById: { [key: string]: DOMRect };
|
|
21
|
+
constructor(): this;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Register a DOM node with a given identifier.
|
|
25
|
+
* @param {string} id - the identifier of the given node
|
|
26
|
+
* @param {node} domNode - the DOM node linked to the identifier
|
|
27
|
+
* @param {{...}} borders - an opaque object describing the node's borders
|
|
28
|
+
*/
|
|
29
|
+
registerDOMNode(
|
|
30
|
+
id: string,
|
|
31
|
+
domNode: HTMLElement,
|
|
32
|
+
childIds: $ReadOnlyArray<string>,
|
|
33
|
+
borders: Border
|
|
34
|
+
): void;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Unregister the DOM node with the given identifier.
|
|
38
|
+
* @param {string} id - the identifier of the node to unregister
|
|
39
|
+
*/
|
|
40
|
+
unregisterDOMNode(id: string): void;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Return the identifier of the topmost node located at the given
|
|
44
|
+
* coordinates.
|
|
45
|
+
* @param {number} x - the x coordinate at which to search for a node
|
|
46
|
+
* @param {number} y - the y coordinate at which to search for a node
|
|
47
|
+
* @returns {null | string} - null or the identifier of the topmost node at
|
|
48
|
+
* the given coordinates
|
|
49
|
+
*/
|
|
50
|
+
idForCoords(x: number, y: number): string | void;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Return the necessary layout information, including the bounds and border
|
|
54
|
+
* values, for the node with the given identifier.
|
|
55
|
+
* @param {string} id - the identifier of the node for which to return the
|
|
56
|
+
* layout information
|
|
57
|
+
* @returns {{...}} - the bounding client rect for the given node, along
|
|
58
|
+
* with its borders
|
|
59
|
+
*/
|
|
60
|
+
layoutPropsForId(id: string): {|
|
|
61
|
+
initialBounds: DOMRect,
|
|
62
|
+
borders: Border,
|
|
63
|
+
|};
|
|
64
|
+
}
|
|
65
|
+
declare export default typeof NodeManager;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A component that renders and animates the popovers that appear over the
|
|
3
|
+
* multi-functional keys.
|
|
4
|
+
*/
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import type { Popover } from "../types";
|
|
7
|
+
type PopoverManagerProps = {
|
|
8
|
+
popover: Popover | null;
|
|
9
|
+
};
|
|
10
|
+
declare class PopoverManager extends React.Component<PopoverManagerProps> {
|
|
11
|
+
render(): JSX.Element | null;
|
|
12
|
+
}
|
|
13
|
+
export default PopoverManager;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for data
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.21.0
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
import type { Popover } from "../types";
|
|
9
|
+
declare type PopoverManagerProps = {|
|
|
10
|
+
popover: Popover | null,
|
|
11
|
+
|};
|
|
12
|
+
declare class PopoverManager extends React.Component<PopoverManagerProps> {
|
|
13
|
+
render(): React$Node | null;
|
|
14
|
+
}
|
|
15
|
+
declare export default typeof PopoverManager;
|