@khanacademy/math-input 0.7.1 → 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.
Files changed (176) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/actions/index.d.ts +31 -0
  3. package/dist/actions/index.js.flow +40 -0
  4. package/dist/components/compute-layout-parameters.d.ts +38 -0
  5. package/dist/components/compute-layout-parameters.js.flow +49 -0
  6. package/dist/components/corner-decal.d.ts +12 -0
  7. package/dist/components/corner-decal.js.flow +15 -0
  8. package/dist/components/echo-manager.d.ts +26 -0
  9. package/dist/components/echo-manager.js.flow +29 -0
  10. package/dist/components/empty-keypad-button.d.ts +13 -0
  11. package/dist/components/empty-keypad-button.js.flow +23 -0
  12. package/dist/components/expression-keypad.d.ts +22 -0
  13. package/dist/components/expression-keypad.js.flow +32 -0
  14. package/dist/components/fraction-keypad.d.ts +21 -0
  15. package/dist/components/fraction-keypad.js.flow +30 -0
  16. package/dist/components/gesture-manager.d.ts +74 -0
  17. package/dist/components/gesture-manager.js.flow +82 -0
  18. package/dist/components/gesture-state-machine.d.ts +105 -0
  19. package/dist/components/gesture-state-machine.js.flow +118 -0
  20. package/dist/components/icon.d.ts +15 -0
  21. package/dist/components/icon.js.flow +18 -0
  22. package/dist/components/input/__tests__/test-math-wrapper.d.ts +8 -0
  23. package/dist/components/input/__tests__/test-math-wrapper.js.flow +14 -0
  24. package/dist/components/input/cursor-handle.d.ts +1 -1
  25. package/dist/components/input/cursor-handle.js.flow +1 -1
  26. package/dist/components/input/drag-listener.d.ts +13 -0
  27. package/dist/components/input/drag-listener.js.flow +19 -0
  28. package/dist/components/input/math-input.d.ts +5 -4
  29. package/dist/components/input/math-input.js.flow +5 -4
  30. package/dist/components/input/math-wrapper.d.ts +110 -0
  31. package/dist/components/input/math-wrapper.js.flow +125 -0
  32. package/dist/components/input/scroll-into-view.d.ts +11 -0
  33. package/dist/components/input/scroll-into-view.js.flow +20 -0
  34. package/dist/components/keypad/button-assets.d.ts +4 -3
  35. package/dist/components/keypad/button-assets.js.flow +3 -3
  36. package/dist/components/keypad/button.d.ts +2 -4
  37. package/dist/components/keypad/button.js.flow +2 -4
  38. package/dist/components/keypad/keypad-page-items.d.ts +16 -12
  39. package/dist/components/keypad/keypad-page-items.js.flow +21 -12
  40. package/dist/components/keypad-button.d.ts +52 -0
  41. package/dist/components/keypad-button.js.flow +79 -0
  42. package/dist/components/keypad-container.d.ts +40 -0
  43. package/dist/components/keypad-container.js.flow +58 -0
  44. package/dist/components/keypad.d.ts +31 -0
  45. package/dist/components/keypad.js.flow +40 -0
  46. package/dist/components/many-keypad-button.d.ts +15 -0
  47. package/dist/components/many-keypad-button.js.flow +17 -0
  48. package/dist/components/math-icon.d.ts +16 -0
  49. package/dist/components/math-icon.js.flow +19 -0
  50. package/dist/components/multi-symbol-grid.d.ts +14 -0
  51. package/dist/components/multi-symbol-grid.js.flow +16 -0
  52. package/dist/components/multi-symbol-popover.d.ts +12 -0
  53. package/dist/components/multi-symbol-popover.js.flow +15 -0
  54. package/dist/components/navigation-pad.d.ts +14 -0
  55. package/dist/components/navigation-pad.js.flow +16 -0
  56. package/dist/components/node-manager.d.ts +53 -0
  57. package/dist/components/node-manager.js.flow +65 -0
  58. package/dist/components/popover-manager.d.ts +13 -0
  59. package/dist/components/popover-manager.js.flow +15 -0
  60. package/dist/components/popover-state-machine.d.ts +75 -0
  61. package/dist/components/popover-state-machine.js.flow +83 -0
  62. package/dist/components/provided-keypad.d.ts +8 -7
  63. package/dist/components/provided-keypad.js.flow +8 -7
  64. package/dist/components/styles.d.ts +6 -0
  65. package/dist/components/styles.js.flow +13 -0
  66. package/dist/components/svg-icon.d.ts +12 -0
  67. package/dist/components/svg-icon.js.flow +15 -0
  68. package/dist/components/tabbar/icons.d.ts +3 -2
  69. package/dist/components/tabbar/icons.js.flow +3 -2
  70. package/dist/components/tabbar/item.d.ts +1 -2
  71. package/dist/components/tabbar/item.js.flow +1 -2
  72. package/dist/components/tabbar/tabbar.d.ts +3 -3
  73. package/dist/components/tabbar/tabbar.js.flow +3 -3
  74. package/dist/components/text-icon.d.ts +13 -0
  75. package/dist/components/text-icon.js.flow +16 -0
  76. package/dist/components/touchable-keypad-button.d.ts +30 -0
  77. package/dist/components/touchable-keypad-button.js.flow +35 -0
  78. package/dist/components/two-page-keypad.d.ts +20 -0
  79. package/dist/components/two-page-keypad.js.flow +30 -0
  80. package/dist/components/velocity-tracker.d.ts +48 -0
  81. package/dist/components/velocity-tracker.js.flow +54 -0
  82. package/dist/es/index.js +938 -1061
  83. package/dist/es/index.js.map +1 -1
  84. package/dist/fake-react-native-web/text.d.ts +2 -1
  85. package/dist/fake-react-native-web/text.js.flow +2 -1
  86. package/dist/fake-react-native-web/view.d.ts +3 -2
  87. package/dist/fake-react-native-web/view.js.flow +3 -2
  88. package/dist/index.d.ts +1 -1
  89. package/dist/index.js +992 -1095
  90. package/dist/index.js.flow +1 -4
  91. package/dist/index.js.map +1 -1
  92. package/dist/store/echo-reducer.d.ts +5 -0
  93. package/dist/store/echo-reducer.js.flow +14 -0
  94. package/dist/store/index.d.ts +46 -1
  95. package/dist/store/index.js.flow +64 -1
  96. package/dist/store/input-reducer.d.ts +7 -0
  97. package/dist/store/input-reducer.js.flow +16 -0
  98. package/dist/store/keypad-reducer.d.ts +9 -0
  99. package/dist/store/keypad-reducer.js.flow +18 -0
  100. package/dist/store/layout-reducer.d.ts +21 -0
  101. package/dist/store/layout-reducer.js.flow +30 -0
  102. package/dist/store/pager-reducer.d.ts +13 -0
  103. package/dist/store/pager-reducer.js.flow +22 -0
  104. package/dist/store/shared.d.ts +6 -0
  105. package/dist/store/shared.js.flow +13 -0
  106. package/dist/store/types.d.ts +57 -0
  107. package/dist/store/types.js.flow +63 -0
  108. package/dist/types.d.ts +50 -0
  109. package/dist/types.js.flow +61 -0
  110. package/package.json +2 -2
  111. package/src/actions/{index.js → index.ts} +5 -5
  112. package/src/components/__tests__/{gesture-state-machine_test.js → gesture-state-machine.test.ts} +5 -1
  113. package/src/components/__tests__/{two-page-keypad_test.js → two-page-keypad.test.tsx} +0 -2
  114. package/src/components/{corner-decal.js → corner-decal.tsx} +6 -5
  115. package/src/components/{echo-manager.js → echo-manager.tsx} +29 -24
  116. package/src/components/{empty-keypad-button.js → empty-keypad-button.tsx} +17 -10
  117. package/src/components/{expression-keypad.js → expression-keypad.tsx} +27 -25
  118. package/src/components/{fraction-keypad.js → fraction-keypad.tsx} +21 -16
  119. package/src/components/{gesture-manager.js → gesture-manager.tsx} +10 -4
  120. package/src/components/{gesture-state-machine.js → gesture-state-machine.ts} +50 -4
  121. package/src/components/{icon.js → icon.tsx} +12 -14
  122. package/src/components/input/cursor-handle.tsx +1 -1
  123. package/src/components/input/{drag-listener.js → drag-listener.ts} +4 -0
  124. package/src/components/input/math-input.tsx +10 -9
  125. package/src/components/input/{math-wrapper.js → math-wrapper.ts} +10 -6
  126. package/src/components/input/{scroll-into-view.js → scroll-into-view.ts} +5 -15
  127. package/src/components/keypad/button-assets.tsx +4 -5
  128. package/src/components/keypad/button.tsx +2 -5
  129. package/src/components/keypad/index.tsx +1 -1
  130. package/src/components/keypad/keypad-page-items.tsx +34 -13
  131. package/src/components/{keypad-button.js → keypad-button.tsx} +42 -37
  132. package/src/components/{keypad-container.js → keypad-container.tsx} +41 -23
  133. package/src/components/{keypad.js → keypad.tsx} +31 -23
  134. package/src/components/{many-keypad-button.js → many-keypad-button.tsx} +8 -6
  135. package/src/components/{math-icon.js → math-icon.tsx} +7 -6
  136. package/src/components/{multi-symbol-grid.js → multi-symbol-grid.tsx} +8 -8
  137. package/src/components/{multi-symbol-popover.js → multi-symbol-popover.tsx} +5 -6
  138. package/src/components/{navigation-pad.js → navigation-pad.tsx} +7 -6
  139. package/src/components/{node-manager.js → node-manager.ts} +16 -4
  140. package/src/components/{popover-manager.js → popover-manager.tsx} +13 -16
  141. package/src/components/{popover-state-machine.js → popover-state-machine.ts} +21 -2
  142. package/src/components/prop-types.js +1 -67
  143. package/src/components/provided-keypad.tsx +14 -12
  144. package/src/components/{svg-icon.js → svg-icon.tsx} +5 -6
  145. package/src/components/tabbar/icons.tsx +4 -2
  146. package/src/components/tabbar/item.tsx +1 -3
  147. package/src/components/tabbar/{tabbar.stories.js → tabbar.stories.tsx} +10 -1
  148. package/src/components/tabbar/tabbar.tsx +3 -3
  149. package/src/components/{text-icon.js → text-icon.tsx} +7 -6
  150. package/src/components/{touchable-keypad-button.js → touchable-keypad-button.tsx} +19 -16
  151. package/src/components/{two-page-keypad.js → two-page-keypad.tsx} +13 -9
  152. package/src/components/{velocity-tracker.js → velocity-tracker.ts} +14 -4
  153. package/src/fake-react-native-web/text.tsx +2 -1
  154. package/src/fake-react-native-web/view.tsx +3 -3
  155. package/src/index.ts +1 -4
  156. package/src/store/echo-reducer.ts +58 -0
  157. package/src/store/index.ts +14 -425
  158. package/src/store/input-reducer.ts +55 -0
  159. package/src/store/keypad-reducer.ts +62 -0
  160. package/src/store/layout-reducer.ts +133 -0
  161. package/src/store/pager-reducer.ts +141 -0
  162. package/src/store/shared.ts +12 -0
  163. package/src/store/types.ts +65 -0
  164. package/src/types.ts +69 -0
  165. package/tsconfig.tsbuildinfo +1 -1
  166. package/src/components/app.js +0 -73
  167. package/src/demo.js +0 -9
  168. package/src/native-app.js +0 -85
  169. /package/src/components/__tests__/{node-manager_test.js → node-manager.test.ts} +0 -0
  170. /package/src/components/{compute-layout-parameters.js → compute-layout-parameters.ts} +0 -0
  171. /package/src/components/input/__tests__/{context-tracking_test.js → context-tracking.test.ts} +0 -0
  172. /package/src/components/input/__tests__/{mathquill_test.js → mathquill.test.ts} +0 -0
  173. /package/src/components/input/__tests__/{test-math-wrapper.jsx → test-math-wrapper.ts} +0 -0
  174. /package/src/components/keypad/{button.stories.js → button.stories.tsx} +0 -0
  175. /package/src/components/{styles.js → styles.ts} +0 -0
  176. /package/src/components/tabbar/__tests__/{tabbar_test.js → tabbar.test.tsx} +0 -0
@@ -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;
@@ -0,0 +1,75 @@
1
+ /**
2
+ * A state machine for the popover state. In particular, this class manages the
3
+ * mapping of parent nodes to their children, and translates touch events that
4
+ * traverse various nodes to actions that are conditioned on whether a popover
5
+ * is present.
6
+ */
7
+ type ActiveNodesObjPopover = {
8
+ parentId: string;
9
+ childIds: ReadonlyArray<string>;
10
+ };
11
+ type ActiveNodesObj = {
12
+ popover: ActiveNodesObjPopover | null;
13
+ focus: string | null;
14
+ };
15
+ type Handlers = {
16
+ onActiveNodesChanged: (activeNodes: ActiveNodesObj) => void;
17
+ onClick: (keyId: string, domNodeId: string, inPopover: boolean) => void;
18
+ };
19
+ declare class PopoverStateMachine {
20
+ handlers: Handlers;
21
+ popovers: Record<string, ReadonlyArray<string>>;
22
+ activePopover: string | null;
23
+ constructor(handlers: any);
24
+ /**
25
+ * Register a popover container as containing a set of children.
26
+ *
27
+ * @param {string} id - the identifier of the popover container
28
+ * @param {string[]} childIds - the identifiers of the nodes contained in
29
+ * the popover container
30
+ */
31
+ registerPopover(id: any, childIds: any): void;
32
+ /**
33
+ * Unregister a popover container.
34
+ *
35
+ * @param {string} id - the identifier of the popover container to
36
+ * unregister
37
+ */
38
+ unregisterPopover(id: any): void;
39
+ /**
40
+ * @returns {boolean} - whether a popover is active and visible
41
+ */
42
+ isPopoverVisible(): boolean;
43
+ /**
44
+ * Blur the active nodes.
45
+ */
46
+ onBlur(): void;
47
+ /**
48
+ * Handle a focus event on the node with the given identifier.
49
+ *
50
+ * @param {string} id - the identifier of the node that was focused
51
+ */
52
+ onFocus(id: any): void;
53
+ /**
54
+ * Handle a long press event on the node with the given identifier.
55
+ *
56
+ * @param {string} id - the identifier of the node that was long-pressed
57
+ */
58
+ onLongPress(id: any): void;
59
+ /**
60
+ * Handle the trigger (click or hold) of the node with the given identifier.
61
+ *
62
+ * @param {string} id - the identifier of the node that was triggered
63
+ */
64
+ onTrigger(id: any): void;
65
+ /**
66
+ * Handle a touch-end event on the node with the given identifier.
67
+ *
68
+ * @param {string} id - the identifier of the node over which the touch
69
+ * ended
70
+ */
71
+ onTouchEnd(id: any): void;
72
+ _isNodeInsidePopover(popover: any, id: any): boolean;
73
+ _defaultNodeForPopover(popover: any): string;
74
+ }
75
+ export default PopoverStateMachine;
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Flowtype definitions for data
3
+ * Generated by Flowgen from a Typescript Definition
4
+ * Flowgen v1.21.0
5
+ * @flow
6
+ */
7
+ /**
8
+ * A state machine for the popover state. In particular, this class manages the
9
+ * mapping of parent nodes to their children, and translates touch events that
10
+ * traverse various nodes to actions that are conditioned on whether a popover
11
+ * is present.
12
+ */
13
+ declare type ActiveNodesObjPopover = {|
14
+ parentId: string,
15
+ childIds: $ReadOnlyArray<string>,
16
+ |};
17
+ declare type ActiveNodesObj = {|
18
+ popover: ActiveNodesObjPopover | null,
19
+ focus: string | null,
20
+ |};
21
+ declare type Handlers = {|
22
+ onActiveNodesChanged: (activeNodes: ActiveNodesObj) => void,
23
+ onClick: (keyId: string, domNodeId: string, inPopover: boolean) => void,
24
+ |};
25
+ declare class PopoverStateMachine {
26
+ handlers: Handlers;
27
+ popovers: { [key: string]: $ReadOnlyArray<string> };
28
+ activePopover: string | null;
29
+ constructor(handlers: any): this;
30
+
31
+ /**
32
+ * Register a popover container as containing a set of children.
33
+ * @param {string} id - the identifier of the popover container
34
+ * @param {string[]} childIds - the identifiers of the nodes contained in
35
+ * the popover container
36
+ */
37
+ registerPopover(id: any, childIds: any): void;
38
+
39
+ /**
40
+ * Unregister a popover container.
41
+ * @param {string} id - the identifier of the popover container to
42
+ * unregister
43
+ */
44
+ unregisterPopover(id: any): void;
45
+
46
+ /**
47
+ * @returns {boolean} - whether a popover is active and visible
48
+ */
49
+ isPopoverVisible(): boolean;
50
+
51
+ /**
52
+ * Blur the active nodes.
53
+ */
54
+ onBlur(): void;
55
+
56
+ /**
57
+ * Handle a focus event on the node with the given identifier.
58
+ * @param {string} id - the identifier of the node that was focused
59
+ */
60
+ onFocus(id: any): void;
61
+
62
+ /**
63
+ * Handle a long press event on the node with the given identifier.
64
+ * @param {string} id - the identifier of the node that was long-pressed
65
+ */
66
+ onLongPress(id: any): void;
67
+
68
+ /**
69
+ * Handle the trigger (click or hold) of the node with the given identifier.
70
+ * @param {string} id - the identifier of the node that was triggered
71
+ */
72
+ onTrigger(id: any): void;
73
+
74
+ /**
75
+ * Handle a touch-end event on the node with the given identifier.
76
+ * @param {string} id - the identifier of the node over which the touch
77
+ * ended
78
+ */
79
+ onTouchEnd(id: any): void;
80
+ _isNodeInsidePopover(popover: any, id: any): boolean;
81
+ _defaultNodeForPopover(popover: any): string;
82
+ }
83
+ declare export default typeof PopoverStateMachine;
@@ -1,22 +1,23 @@
1
1
  import * as React from "react";
2
2
  import ReactDOM from "react-dom";
3
- import type { CSSProperties } from "aphrodite";
3
+ import type { Cursor, KeypadConfiguration, KeyHandler } from "../types";
4
+ import type { StyleType } from "@khanacademy/wonder-blocks-core";
4
5
  type Props = {
5
6
  onElementMounted?: (arg1: any) => void;
6
- onDismiss?: () => unknown;
7
- style?: CSSProperties;
7
+ onDismiss?: () => void;
8
+ style?: StyleType;
8
9
  };
9
10
  declare class ProvidedKeypad extends React.Component<Props> {
10
- mounted: boolean;
11
+ mounted?: boolean;
11
12
  store: any;
12
13
  UNSAFE_componentWillMount(): void;
13
14
  componentDidMount(): void;
14
15
  componentWillUnmount(): void;
15
16
  activate: () => void;
16
17
  dismiss: () => void;
17
- configure: () => void;
18
- setCursor: () => void;
19
- setKeyHandler: (keyHandler: any) => void;
18
+ configure: (configuration: KeypadConfiguration, cb: () => void) => void;
19
+ setCursor: (cursor: Cursor) => void;
20
+ setKeyHandler: (keyHandler: KeyHandler) => void;
20
21
  getDOMNode: () => ReturnType<typeof ReactDOM.findDOMNode>;
21
22
  render(): React.ReactNode;
22
23
  }
@@ -6,23 +6,24 @@
6
6
  */
7
7
  import * as React from "react";
8
8
  import ReactDOM from "react-dom";
9
- import type { CSSProperties } from "aphrodite";
9
+ import type { Cursor, KeypadConfiguration, KeyHandler } from "../types";
10
+ import type { StyleType } from "@khanacademy/wonder-blocks-core";
10
11
  declare type Props = {|
11
12
  onElementMounted?: (arg1: any) => void,
12
- onDismiss?: () => mixed,
13
- style?: CSSProperties,
13
+ onDismiss?: () => void,
14
+ style?: StyleType,
14
15
  |};
15
16
  declare class ProvidedKeypad extends React.Component<Props> {
16
- mounted: boolean;
17
+ mounted?: boolean;
17
18
  store: any;
18
19
  UNSAFE_componentWillMount(): void;
19
20
  componentDidMount(): void;
20
21
  componentWillUnmount(): void;
21
22
  activate: () => void;
22
23
  dismiss: () => void;
23
- configure: () => void;
24
- setCursor: () => void;
25
- setKeyHandler: (keyHandler: any) => void;
24
+ configure: (configuration: KeypadConfiguration, cb: () => void) => void;
25
+ setCursor: (cursor: Cursor) => void;
26
+ setKeyHandler: (keyHandler: KeyHandler) => void;
26
27
  getDOMNode: () => $Call<
27
28
  <R>((...args: any[]) => R) => R,
28
29
  typeof ReactDOM.findDOMNode
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Common styles shared across components.
3
+ */
4
+ /// <reference path="../../types/aphrodite.d.ts" />
5
+ declare const _default: import("aphrodite").StyleDeclaration;
6
+ export default _default;
@@ -0,0 +1,13 @@
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$aphrodite from "aphrodite";
8
+
9
+ /**
10
+ * Common styles shared across components.
11
+ */
12
+ declare var _default: $Flowgen$Import$aphrodite.StyleDeclaration;
13
+ declare export default typeof _default;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * A component that renders a single SVG icon.
3
+ */
4
+ import * as React from "react";
5
+ type Props = {
6
+ color: string;
7
+ name: string;
8
+ };
9
+ declare class SvgIcon extends React.Component<Props> {
10
+ render(): JSX.Element;
11
+ }
12
+ export default SvgIcon;
@@ -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
+ declare type Props = {|
9
+ color: string,
10
+ name: string,
11
+ |};
12
+ declare class SvgIcon extends React.Component<Props> {
13
+ render(): React$Node;
14
+ }
15
+ declare export default typeof SvgIcon;
@@ -1,7 +1,8 @@
1
1
  import * as React from "react";
2
2
  import type { TabbarItemType } from "./types";
3
- declare const IconAsset: React.FC<{
3
+ type Props = {
4
4
  tintColor: string;
5
5
  type: TabbarItemType;
6
- }>;
6
+ };
7
+ declare const IconAsset: ({ tintColor, type }: Props) => React.ReactElement;
7
8
  export default IconAsset;
@@ -6,8 +6,9 @@
6
6
  */
7
7
  import * as React from "react";
8
8
  import type { TabbarItemType } from "./types";
9
- declare var IconAsset: React.StatelessFunctionalComponent<{|
9
+ declare type Props = {|
10
10
  tintColor: string,
11
11
  type: TabbarItemType,
12
- |}>;
12
+ |};
13
+ declare var IconAsset: (x: Props) => React.Element<any>;
13
14
  declare export default typeof IconAsset;
@@ -6,8 +6,7 @@ type Props = {
6
6
  itemState: ItemState;
7
7
  itemType: TabbarItemType;
8
8
  };
9
- type State = Record<any, any>;
10
- declare class TabbarItem extends React.Component<Props, State> {
9
+ declare class TabbarItem extends React.Component<Props> {
11
10
  render(): React.ReactNode;
12
11
  }
13
12
  export declare const TabbarItemForTesting: typeof TabbarItem;
@@ -12,8 +12,7 @@ declare type Props = {|
12
12
  itemState: ItemState,
13
13
  itemType: TabbarItemType,
14
14
  |};
15
- declare type State = { [key: any]: any };
16
- declare class TabbarItem extends React.Component<Props, State> {
15
+ declare class TabbarItem extends React.Component<Props> {
17
16
  render(): React.Node;
18
17
  }
19
18
  declare export var TabbarItemForTesting: typeof TabbarItem;
@@ -3,11 +3,11 @@ import type { TabbarItemType } from "./types";
3
3
  type TabbarState = {
4
4
  selectedItem: number;
5
5
  };
6
- type TabbarProps = {
7
- items: Array<TabbarItemType>;
6
+ type Props = {
7
+ items: ReadonlyArray<TabbarItemType>;
8
8
  onSelect: (item: TabbarItemType) => void;
9
9
  };
10
- declare class Tabbar extends React.Component<TabbarProps, TabbarState> {
10
+ declare class Tabbar extends React.Component<Props, TabbarState> {
11
11
  state: TabbarState;
12
12
  render(): React.ReactNode;
13
13
  }
@@ -9,11 +9,11 @@ import type { TabbarItemType } from "./types";
9
9
  declare type TabbarState = {|
10
10
  selectedItem: number,
11
11
  |};
12
- declare type TabbarProps = {|
13
- items: Array<TabbarItemType>,
12
+ declare type Props = {|
13
+ items: $ReadOnlyArray<TabbarItemType>,
14
14
  onSelect: (item: TabbarItemType) => void,
15
15
  |};
16
- declare class Tabbar extends React.Component<TabbarProps, TabbarState> {
16
+ declare class Tabbar extends React.Component<Props, TabbarState> {
17
17
  state: TabbarState;
18
18
  render(): React.Node;
19
19
  }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * A component that renders a text-based icon.
3
+ */
4
+ import * as React from "react";
5
+ import type { StyleType } from "@khanacademy/wonder-blocks-core";
6
+ type Props = {
7
+ character: string;
8
+ style?: StyleType;
9
+ };
10
+ declare class TextIcon extends React.Component<Props> {
11
+ render(): JSX.Element;
12
+ }
13
+ export default TextIcon;
@@ -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
+ character: string,
11
+ style?: StyleType,
12
+ |};
13
+ declare class TextIcon extends React.Component<Props> {
14
+ render(): React$Node;
15
+ }
16
+ declare export default typeof TextIcon;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * A touchable wrapper around the base KeypadButton component. This button is
3
+ * responsible for keeping our button ID system (which will be used to handle
4
+ * touch events globally) opaque to the KeypadButton.
5
+ */
6
+ import * as React from "react";
7
+ import { KeyType } from "../consts";
8
+ import GestureManager from "./gesture-manager";
9
+ import type { Key } from "../data/keys";
10
+ import type { Border, Icon } from "../types";
11
+ import type { StyleType } from "@khanacademy/wonder-blocks-core";
12
+ type Props = {
13
+ borders: Border;
14
+ childKeyIds: ReadonlyArray<Key>;
15
+ disabled: boolean;
16
+ focused: boolean;
17
+ gestureManager: GestureManager;
18
+ id: Key;
19
+ popoverEnabled: boolean;
20
+ style: StyleType;
21
+ type: KeyType;
22
+ icon: Icon;
23
+ };
24
+ declare class TouchableKeypadButton extends React.Component<Props> {
25
+ shouldComponentUpdate(newProps: any): boolean;
26
+ componentWillUnmount(): void;
27
+ render(): JSX.Element;
28
+ }
29
+ declare const _default: import("react-redux").ConnectedComponent<typeof TouchableKeypadButton, any>;
30
+ export default _default;
@@ -0,0 +1,35 @@
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 { KeyType } from "../consts";
10
+ import GestureManager from "./gesture-manager";
11
+ import type { Key } from "../data/keys";
12
+ import type { Border, Icon } from "../types";
13
+ import type { StyleType } from "@khanacademy/wonder-blocks-core";
14
+ declare type Props = {|
15
+ borders: Border,
16
+ childKeyIds: $ReadOnlyArray<Key>,
17
+ disabled: boolean,
18
+ focused: boolean,
19
+ gestureManager: GestureManager,
20
+ id: Key,
21
+ popoverEnabled: boolean,
22
+ style: StyleType,
23
+ type: KeyType,
24
+ icon: Icon,
25
+ |};
26
+ declare class TouchableKeypadButton extends React.Component<Props> {
27
+ shouldComponentUpdate(newProps: any): boolean;
28
+ componentWillUnmount(): void;
29
+ render(): React$Node;
30
+ }
31
+ declare var _default: $Flowgen$Import$react_2d_redux.ConnectedComponent<
32
+ typeof TouchableKeypadButton,
33
+ any
34
+ >;
35
+ declare export default typeof _default;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * A keypad with two pages of keys.
3
+ */
4
+ import * as React from "react";
5
+ interface ReduxProps {
6
+ paginationEnabled: boolean;
7
+ }
8
+ interface Props extends ReduxProps {
9
+ currentPage: number;
10
+ leftPage: React.ReactNode;
11
+ rightPage: React.ReactNode;
12
+ }
13
+ declare class TwoPageKeypad extends React.Component<Props> {
14
+ state: {
15
+ selectedPage: string;
16
+ };
17
+ render(): JSX.Element;
18
+ }
19
+ declare const _default: import("react-redux").ConnectedComponent<typeof TwoPageKeypad, import("react-redux").Omit<React.ClassAttributes<TwoPageKeypad> & Props, "paginationEnabled">>;
20
+ export default _default;
@@ -0,0 +1,30 @@
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
+ declare interface ReduxProps {
10
+ paginationEnabled: boolean;
11
+ }
12
+ declare type Props = {
13
+ currentPage: number,
14
+ leftPage: React.Node,
15
+ rightPage: React.Node,
16
+ } & ReduxProps;
17
+ declare class TwoPageKeypad extends React.Component<Props> {
18
+ state: {|
19
+ selectedPage: string,
20
+ |};
21
+ render(): React$Node;
22
+ }
23
+ declare var _default: $Flowgen$Import$react_2d_redux.ConnectedComponent<
24
+ typeof TwoPageKeypad,
25
+ $Flowgen$Import$react_2d_redux.Omit<
26
+ {| ...React.ClassAttributes<TwoPageKeypad>, ...Props |},
27
+ "paginationEnabled"
28
+ >
29
+ >;
30
+ declare export default typeof _default;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * A system for tracking gesture velocity in a single dimension.
3
+ *
4
+ * Velocity is computed by smoothing linearly over the gestures that have
5
+ * occurred in the last 100 milliseconds.
6
+ */
7
+ type Event = {
8
+ x: number;
9
+ t: number;
10
+ };
11
+ declare class VelocityTracker {
12
+ options: {
13
+ velocityTimeout: number;
14
+ };
15
+ _events: Array<Event>;
16
+ constructor(options?: any);
17
+ /**
18
+ * Pushes an event with the given displacement onto the event buffer,
19
+ * associating it with a timestamp. Note that, as this method computes the
20
+ * timestamp for the event at calltime, it should be called immediately
21
+ * after the event occurs.
22
+ *
23
+ * @param {number} x - the cumulative displacement of the event
24
+ */
25
+ push(x: number): void;
26
+ /**
27
+ * Compute the velocity with respect to the events that have been tracked
28
+ * by the system. Velocity is computed by smoothing linearly over recent
29
+ * displacement values.
30
+ *
31
+ * Note that, for performance reasons, a call to `getVelocity` will clear
32
+ * out the event buffer. As such, repeated calls will not return the same
33
+ * value (in particular, a second call in quick succession will return 0).
34
+ *
35
+ * @returns {number} the velocity associated with the tracker
36
+ */
37
+ getVelocity(): number;
38
+ /**
39
+ * Filter the tracked events to exclude any events that occurred too far in
40
+ * the past, and reset the event buffer.
41
+ *
42
+ * @returns {number[]} an array of displacements corresponding to events
43
+ * that occurred in the past `velocityTimeout`
44
+ * milliseconds
45
+ */
46
+ _getEvents(): ReadonlyArray<Event>;
47
+ }
48
+ export default VelocityTracker;