@khanacademy/math-input 1.0.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/components/compute-layout-parameters.d.ts +2 -1
  3. package/dist/components/compute-layout-parameters.js.flow +2 -21
  4. package/dist/components/echo-manager.d.ts +4 -4
  5. package/dist/components/echo-manager.js.flow +4 -4
  6. package/dist/components/expression-keypad.d.ts +1 -1
  7. package/dist/components/expression-keypad.js.flow +1 -1
  8. package/dist/components/fraction-keypad.d.ts +1 -1
  9. package/dist/components/fraction-keypad.js.flow +1 -1
  10. package/dist/components/gesture-state-machine.d.ts +7 -7
  11. package/dist/components/gesture-state-machine.js.flow +8 -8
  12. package/dist/components/icon.d.ts +2 -2
  13. package/dist/components/icon.js.flow +2 -2
  14. package/dist/components/input/cursor-contexts.d.ts +10 -9
  15. package/dist/components/input/cursor-contexts.js.flow +11 -16
  16. package/dist/components/input/math-wrapper.d.ts +3 -2
  17. package/dist/components/input/math-wrapper.js.flow +3 -16
  18. package/dist/components/keypad/index.d.ts +1 -1
  19. package/dist/components/keypad/index.js.flow +1 -3
  20. package/dist/components/keypad-button.d.ts +8 -8
  21. package/dist/components/keypad-button.js.flow +10 -9
  22. package/dist/components/keypad-container.d.ts +2 -3
  23. package/dist/components/keypad-container.js.flow +2 -3
  24. package/dist/components/keypad.d.ts +1 -1
  25. package/dist/components/keypad.js.flow +1 -1
  26. package/dist/components/multi-symbol-grid.d.ts +2 -2
  27. package/dist/components/multi-symbol-grid.js.flow +2 -2
  28. package/dist/components/node-manager.d.ts +2 -5
  29. package/dist/components/node-manager.js.flow +2 -5
  30. package/dist/components/popover-state-machine.d.ts +1 -8
  31. package/dist/components/popover-state-machine.js.flow +2 -8
  32. package/dist/components/provided-keypad.d.ts +1 -4
  33. package/dist/components/provided-keypad.js.flow +1 -4
  34. package/dist/components/styles.d.ts +1 -2
  35. package/dist/components/styles.js.flow +1 -3
  36. package/dist/components/touchable-keypad-button.d.ts +6 -6
  37. package/dist/components/touchable-keypad-button.js.flow +6 -6
  38. package/dist/data/keys.d.ts +51 -52
  39. package/dist/data/keys.js.flow +50 -99
  40. package/dist/enums.d.ts +49 -0
  41. package/dist/enums.js.flow +63 -0
  42. package/dist/es/index.css +0 -3
  43. package/dist/es/index.js +415 -455
  44. package/dist/es/index.js.map +1 -1
  45. package/dist/fake-react-native-web/view.d.ts +1 -2
  46. package/dist/fake-react-native-web/view.js.flow +1 -2
  47. package/dist/index.css +0 -3
  48. package/dist/index.d.ts +3 -6
  49. package/dist/index.js +438 -477
  50. package/dist/index.js.flow +3 -6
  51. package/dist/index.js.map +1 -1
  52. package/dist/store/actions.d.ts +64 -0
  53. package/dist/store/actions.js.flow +101 -0
  54. package/dist/store/echo-reducer.d.ts +2 -3
  55. package/dist/store/echo-reducer.js.flow +2 -6
  56. package/dist/store/index.d.ts +5 -41
  57. package/dist/store/index.js.flow +5 -52
  58. package/dist/store/input-reducer.d.ts +2 -5
  59. package/dist/store/input-reducer.js.flow +3 -6
  60. package/dist/store/keypad-reducer.d.ts +2 -7
  61. package/dist/store/keypad-reducer.js.flow +3 -8
  62. package/dist/store/layout-reducer.d.ts +2 -19
  63. package/dist/store/layout-reducer.js.flow +3 -20
  64. package/dist/store/pager-reducer.d.ts +2 -11
  65. package/dist/store/pager-reducer.js.flow +3 -12
  66. package/dist/store/shared.d.ts +2 -1
  67. package/dist/store/shared.js.flow +2 -1
  68. package/dist/store/types.d.ts +5 -5
  69. package/dist/store/types.js.flow +5 -5
  70. package/dist/types.d.ts +28 -16
  71. package/dist/types.js.flow +32 -20
  72. package/less/overrides.less +0 -6
  73. package/package.json +1 -1
  74. package/src/components/compute-layout-parameters.ts +6 -6
  75. package/src/components/echo-manager.tsx +10 -10
  76. package/src/components/expression-keypad.tsx +9 -10
  77. package/src/components/fraction-keypad.tsx +11 -12
  78. package/src/components/gesture-state-machine.ts +8 -8
  79. package/src/components/icon.tsx +6 -6
  80. package/src/components/input/__tests__/context-tracking.test.ts +20 -20
  81. package/src/components/input/cursor-contexts.ts +22 -29
  82. package/src/components/input/math-wrapper.ts +75 -67
  83. package/src/components/keypad/index.tsx +1 -1
  84. package/src/components/keypad-button.tsx +20 -21
  85. package/src/components/keypad-container.tsx +9 -10
  86. package/src/components/keypad.tsx +1 -1
  87. package/src/components/many-keypad-button.tsx +2 -2
  88. package/src/components/multi-symbol-grid.tsx +4 -5
  89. package/src/components/multi-symbol-popover.tsx +1 -1
  90. package/src/components/navigation-pad.tsx +1 -1
  91. package/src/components/node-manager.ts +2 -2
  92. package/src/components/popover-state-machine.ts +2 -10
  93. package/src/components/provided-keypad.tsx +3 -12
  94. package/src/components/touchable-keypad-button.tsx +7 -7
  95. package/src/data/key-configs.ts +58 -58
  96. package/src/data/keys.ts +53 -105
  97. package/src/enums.ts +74 -0
  98. package/src/index.ts +3 -9
  99. package/src/math-input.stories.tsx +67 -0
  100. package/src/store/actions.ts +179 -0
  101. package/src/store/echo-reducer.ts +10 -7
  102. package/src/store/index.ts +24 -24
  103. package/src/store/input-reducer.ts +7 -6
  104. package/src/store/keypad-reducer.ts +3 -6
  105. package/src/store/layout-reducer.ts +12 -11
  106. package/src/store/pager-reducer.ts +30 -46
  107. package/src/store/shared.ts +4 -4
  108. package/src/store/types.ts +21 -5
  109. package/src/types.ts +32 -20
  110. package/src/utils.ts +3 -3
  111. package/tsconfig-build.tsbuildinfo +1 -0
  112. package/dist/actions/index.d.ts +0 -31
  113. package/dist/actions/index.js.flow +0 -40
  114. package/dist/consts.d.ts +0 -51
  115. package/dist/consts.js.flow +0 -66
  116. package/src/actions/index.ts +0 -57
  117. package/src/consts.ts +0 -91
  118. package/tsconfig.tsbuildinfo +0 -1
  119. /package/src/components/{gesture-manager.tsx → gesture-manager.ts} +0 -0
  120. /package/{tsconfig.json → tsconfig-build.json} +0 -0
@@ -0,0 +1,64 @@
1
+ import Keys from "../data/keys";
2
+ import type { KeypadConfiguration, KeyHandler, Cursor, ActiveNodesObj, Border } from "../types";
3
+ type DismissKeypadAction = {
4
+ type: "DismissKeypad";
5
+ };
6
+ export declare const dismissKeypad: () => DismissKeypadAction;
7
+ type ActivateKeypadAction = {
8
+ type: "ActivateKeypad";
9
+ };
10
+ export declare const activateKeypad: () => ActivateKeypadAction;
11
+ /**
12
+ * Configure the keypad with the provided configuration parameters.
13
+ */
14
+ type ConfigureKeypadAction = {
15
+ type: "ConfigureKeypad";
16
+ configuration: KeypadConfiguration;
17
+ };
18
+ export declare const configureKeypad: (configuration: KeypadConfiguration) => ConfigureKeypadAction;
19
+ type SetPageSizeAction = {
20
+ type: "SetPageSize";
21
+ pageWidthPx: number;
22
+ pageHeightPx: number;
23
+ };
24
+ export declare const setPageSize: (pageWidthPx: number, pageHeightPx: number) => SetPageSizeAction;
25
+ type RemoveEchoAction = {
26
+ type: "RemoveEcho";
27
+ animationId: string;
28
+ };
29
+ export declare const removeEcho: (animationId: string) => RemoveEchoAction;
30
+ type SetKeyHandlerAction = {
31
+ type: "SetKeyHandler";
32
+ keyHandler: KeyHandler;
33
+ };
34
+ export declare const setKeyHandler: (keyHandler: KeyHandler) => SetKeyHandlerAction;
35
+ type SetCursorAction = {
36
+ type: "SetCursor";
37
+ cursor: Cursor;
38
+ };
39
+ export declare const setCursor: (cursor: Cursor) => SetCursorAction;
40
+ type OnSwipeChangeAction = {
41
+ type: "OnSwipeChange";
42
+ dx: number;
43
+ };
44
+ export declare const onSwipeChange: (dx: number) => OnSwipeChangeAction;
45
+ type OnSwipeEndAction = {
46
+ type: "OnSwipeEnd";
47
+ dx: number;
48
+ };
49
+ export declare const onSwipeEnd: (dx: number) => OnSwipeEndAction;
50
+ type SetActiveNodesAction = {
51
+ type: "SetActiveNodes";
52
+ activeNodes: any;
53
+ };
54
+ export declare const setActiveNodes: (activeNodes: ActiveNodesObj) => SetActiveNodesAction;
55
+ type PressKeyAction = {
56
+ type: "PressKey";
57
+ key: Keys;
58
+ borders: Border;
59
+ initialBounds: DOMRect;
60
+ inPopover: boolean;
61
+ };
62
+ export declare const pressKey: (key: Keys, borders: readonly (import("../enums").BorderDirection | undefined)[], initialBounds: DOMRect, inPopover: any) => PressKeyAction;
63
+ export type Action = DismissKeypadAction | ActivateKeypadAction | ConfigureKeypadAction | SetPageSizeAction | RemoveEchoAction | SetKeyHandlerAction | SetCursorAction | OnSwipeChangeAction | OnSwipeEndAction | SetActiveNodesAction | PressKeyAction;
64
+ export {};
@@ -0,0 +1,101 @@
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$_2e__2e__2f_enums from "../enums";
8
+ import Keys from "../data/keys";
9
+ import type {
10
+ KeypadConfiguration,
11
+ KeyHandler,
12
+ Cursor,
13
+ ActiveNodesObj,
14
+ Border,
15
+ } from "../types";
16
+ declare type DismissKeypadAction = {|
17
+ type: "DismissKeypad",
18
+ |};
19
+ declare export var dismissKeypad: () => DismissKeypadAction;
20
+ declare type ActivateKeypadAction = {|
21
+ type: "ActivateKeypad",
22
+ |};
23
+ declare export var activateKeypad: () => ActivateKeypadAction;
24
+ /**
25
+ * Configure the keypad with the provided configuration parameters.
26
+ */
27
+ declare type ConfigureKeypadAction = {|
28
+ type: "ConfigureKeypad",
29
+ configuration: KeypadConfiguration,
30
+ |};
31
+ declare export var configureKeypad: (
32
+ configuration: KeypadConfiguration
33
+ ) => ConfigureKeypadAction;
34
+ declare type SetPageSizeAction = {|
35
+ type: "SetPageSize",
36
+ pageWidthPx: number,
37
+ pageHeightPx: number,
38
+ |};
39
+ declare export var setPageSize: (
40
+ pageWidthPx: number,
41
+ pageHeightPx: number
42
+ ) => SetPageSizeAction;
43
+ declare type RemoveEchoAction = {|
44
+ type: "RemoveEcho",
45
+ animationId: string,
46
+ |};
47
+ declare export var removeEcho: (animationId: string) => RemoveEchoAction;
48
+ declare type SetKeyHandlerAction = {|
49
+ type: "SetKeyHandler",
50
+ keyHandler: KeyHandler,
51
+ |};
52
+ declare export var setKeyHandler: (
53
+ keyHandler: KeyHandler
54
+ ) => SetKeyHandlerAction;
55
+ declare type SetCursorAction = {|
56
+ type: "SetCursor",
57
+ cursor: Cursor,
58
+ |};
59
+ declare export var setCursor: (cursor: Cursor) => SetCursorAction;
60
+ declare type OnSwipeChangeAction = {|
61
+ type: "OnSwipeChange",
62
+ dx: number,
63
+ |};
64
+ declare export var onSwipeChange: (dx: number) => OnSwipeChangeAction;
65
+ declare type OnSwipeEndAction = {|
66
+ type: "OnSwipeEnd",
67
+ dx: number,
68
+ |};
69
+ declare export var onSwipeEnd: (dx: number) => OnSwipeEndAction;
70
+ declare type SetActiveNodesAction = {|
71
+ type: "SetActiveNodes",
72
+ activeNodes: any,
73
+ |};
74
+ declare export var setActiveNodes: (
75
+ activeNodes: ActiveNodesObj
76
+ ) => SetActiveNodesAction;
77
+ declare type PressKeyAction = {|
78
+ type: "PressKey",
79
+ key: Keys,
80
+ borders: Border,
81
+ initialBounds: DOMRect,
82
+ inPopover: boolean,
83
+ |};
84
+ declare export var pressKey: (
85
+ key: Keys,
86
+ borders: $ReadOnlyArray<$Flowgen$Import$_2e__2e__2f_enums.BorderDirection | void>,
87
+ initialBounds: DOMRect,
88
+ inPopover: any
89
+ ) => PressKeyAction;
90
+ export type Action =
91
+ | DismissKeypadAction
92
+ | ActivateKeypadAction
93
+ | ConfigureKeypadAction
94
+ | SetPageSizeAction
95
+ | RemoveEchoAction
96
+ | SetKeyHandlerAction
97
+ | SetCursorAction
98
+ | OnSwipeChangeAction
99
+ | OnSwipeEndAction
100
+ | SetActiveNodesAction
101
+ | PressKeyAction;
@@ -1,5 +1,4 @@
1
+ import type { Action } from "./actions";
1
2
  import type { EchoState } from "./types";
2
- declare const echoReducer: (state: {
3
- readonly echoes: readonly [];
4
- } | undefined, action: any) => EchoState;
3
+ declare const echoReducer: (state: EchoState | undefined, action: Action) => EchoState;
5
4
  export default echoReducer;
@@ -4,11 +4,7 @@
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
+ import type { Action } from "./actions";
7
8
  import type { EchoState } from "./types";
8
- declare var echoReducer: (
9
- state: {|
10
- +echoes: [],
11
- |} | void,
12
- action: any
13
- ) => EchoState;
9
+ declare var echoReducer: (state: EchoState | void, action: Action) => EchoState;
14
10
  declare export default typeof echoReducer;
@@ -1,46 +1,10 @@
1
1
  import * as Redux from "redux";
2
- import GestureManager from "../components/gesture-manager";
3
2
  import type { GestureState } from "./types";
4
3
  export declare const createStore: () => Redux.Store<Redux.EmptyObject & {
5
4
  input: import("./types").InputState;
6
- keypad: import("./types").KeypadState | {
7
- readonly extraKeys: readonly ["x", "y", "THETA", "PI"];
8
- readonly keypadType: "EXPRESSION";
9
- readonly active: false;
10
- };
11
- pager: import("./types").PagerState | {
12
- readonly animateToPosition: false;
13
- readonly currentPage: number;
14
- readonly dx: 0;
15
- readonly numPages: number;
16
- readonly pageWidthPx: 0;
17
- readonly velocityTracker: import("../components/velocity-tracker").default;
18
- };
19
- gestures: GestureState | {
20
- readonly popover: null;
21
- readonly focus: null;
22
- readonly gestureManager: GestureManager;
23
- };
24
- echoes: import("./types").EchoState | {
25
- readonly echoes: readonly [];
26
- };
27
- layout: import("./types").LayoutState | {
28
- readonly gridDimensions: {
29
- readonly numRows: number;
30
- readonly numColumns: number;
31
- readonly numMaxVisibleRows: number;
32
- readonly numPages: number;
33
- };
34
- readonly buttonDimensions: {
35
- readonly widthPx: 48;
36
- readonly heightPx: 48;
37
- };
38
- readonly pageDimensions: {
39
- readonly pageWidthPx: 0;
40
- readonly pageHeightPx: 0;
41
- };
42
- readonly layoutMode: "FULLSCREEN";
43
- readonly paginationEnabled: false;
44
- readonly navigationPadEnabled: false;
45
- };
5
+ keypad: import("./types").KeypadState;
6
+ pager: import("./types").PagerState;
7
+ gestures: GestureState;
8
+ echoes: import("./types").EchoState;
9
+ layout: import("./types").LayoutState;
46
10
  }, Redux.AnyAction>;
@@ -5,65 +5,18 @@
5
5
  * @flow
6
6
  */
7
7
  import * as $Flowgen$Import$_2e__2f_types from "./types";
8
- import * as $Flowgen$Import$_2e__2e__2f_components_2f_velocity_2d_tracker from "../components/velocity-tracker";
9
8
  import * as Redux from "redux";
10
- import GestureManager from "../components/gesture-manager";
11
9
  import type { GestureState } from "./types";
12
10
  declare export var createStore: () => Redux.Store<
13
11
  {|
14
12
  ...Redux.EmptyObject,
15
13
  ...{|
16
14
  input: $Flowgen$Import$_2e__2f_types.InputState,
17
- keypad:
18
- | $Flowgen$Import$_2e__2f_types.KeypadState
19
- | {|
20
- +extraKeys: ["x", "y", "THETA", "PI"],
21
- +keypadType: "EXPRESSION",
22
- +active: false,
23
- |},
24
- pager:
25
- | $Flowgen$Import$_2e__2f_types.PagerState
26
- | {|
27
- +animateToPosition: false,
28
- +currentPage: number,
29
- +dx: 0,
30
- +numPages: number,
31
- +pageWidthPx: 0,
32
- +velocityTracker: $Flowgen$Import$_2e__2e__2f_components_2f_velocity_2d_tracker.default,
33
- |},
34
- gestures:
35
- | GestureState
36
- | {|
37
- +popover: null,
38
- +focus: null,
39
- +gestureManager: GestureManager,
40
- |},
41
- echoes:
42
- | $Flowgen$Import$_2e__2f_types.EchoState
43
- | {|
44
- +echoes: [],
45
- |},
46
- layout:
47
- | $Flowgen$Import$_2e__2f_types.LayoutState
48
- | {|
49
- +gridDimensions: {|
50
- +numRows: number,
51
- +numColumns: number,
52
- +numMaxVisibleRows: number,
53
- +numPages: number,
54
- |},
55
- +buttonDimensions: {|
56
- +widthPx: 48,
57
- +heightPx: 48,
58
- |},
59
- +pageDimensions: {|
60
- +pageWidthPx: 0,
61
- +pageHeightPx: 0,
62
- |},
63
- +layoutMode: "FULLSCREEN",
64
- +paginationEnabled: false,
65
- +navigationPadEnabled: false,
66
- |},
15
+ keypad: $Flowgen$Import$_2e__2f_types.KeypadState,
16
+ pager: $Flowgen$Import$_2e__2f_types.PagerState,
17
+ gestures: GestureState,
18
+ echoes: $Flowgen$Import$_2e__2f_types.EchoState,
19
+ layout: $Flowgen$Import$_2e__2f_types.LayoutState,
67
20
  |},
68
21
  |},
69
22
  Redux.AnyAction
@@ -1,7 +1,4 @@
1
- import type { Cursor, KeyHandler } from "../types";
1
+ import type { Action } from "./actions";
2
2
  import type { InputState } from "./types";
3
- declare const inputReducer: (state: {
4
- keyHandler: KeyHandler | null;
5
- cursor: Cursor;
6
- } | undefined, action: any) => InputState;
3
+ declare const inputReducer: (state: InputState | undefined, action: Action) => InputState;
7
4
  export default inputReducer;
@@ -4,13 +4,10 @@
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
- import type { Cursor, KeyHandler } from "../types";
7
+ import type { Action } from "./actions";
8
8
  import type { InputState } from "./types";
9
9
  declare var inputReducer: (
10
- state: {|
11
- keyHandler: KeyHandler | null,
12
- cursor: Cursor,
13
- |} | void,
14
- action: any
10
+ state: InputState | void,
11
+ action: Action
15
12
  ) => InputState;
16
13
  declare export default typeof inputReducer;
@@ -1,9 +1,4 @@
1
+ import type { Action } from "./actions";
1
2
  import type { KeypadState } from "./types";
2
- declare const keypadReducer: (state: {
3
- readonly extraKeys: readonly ["x", "y", "THETA", "PI"];
4
- readonly keypadType: "EXPRESSION";
5
- readonly active: false;
6
- } | undefined, action: {
7
- type: string;
8
- }) => KeypadState;
3
+ declare const keypadReducer: (state: KeypadState | undefined, action: Action) => KeypadState;
9
4
  export default keypadReducer;
@@ -4,15 +4,10 @@
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
+ import type { Action } from "./actions";
7
8
  import type { KeypadState } from "./types";
8
9
  declare var keypadReducer: (
9
- state: {|
10
- +extraKeys: ["x", "y", "THETA", "PI"],
11
- +keypadType: "EXPRESSION",
12
- +active: false,
13
- |} | void,
14
- action: {|
15
- type: string,
16
- |}
10
+ state: KeypadState | void,
11
+ action: Action
17
12
  ) => KeypadState;
18
13
  declare export default typeof keypadReducer;
@@ -1,21 +1,4 @@
1
+ import type { Action } from "./actions";
1
2
  import type { LayoutState } from "./types";
2
- declare const layoutReducer: (state: {
3
- readonly gridDimensions: {
4
- readonly numRows: number;
5
- readonly numColumns: number;
6
- readonly numMaxVisibleRows: number;
7
- readonly numPages: number;
8
- };
9
- readonly buttonDimensions: {
10
- readonly widthPx: 48;
11
- readonly heightPx: 48;
12
- };
13
- readonly pageDimensions: {
14
- readonly pageWidthPx: 0;
15
- readonly pageHeightPx: 0;
16
- };
17
- readonly layoutMode: "FULLSCREEN";
18
- readonly paginationEnabled: false;
19
- readonly navigationPadEnabled: false;
20
- } | undefined, action: any) => LayoutState;
3
+ declare const layoutReducer: (state: LayoutState | undefined, action: Action) => LayoutState;
21
4
  export default layoutReducer;
@@ -4,27 +4,10 @@
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
+ import type { Action } from "./actions";
7
8
  import type { LayoutState } from "./types";
8
9
  declare var layoutReducer: (
9
- state: {|
10
- +gridDimensions: {|
11
- +numRows: number,
12
- +numColumns: number,
13
- +numMaxVisibleRows: number,
14
- +numPages: number,
15
- |},
16
- +buttonDimensions: {|
17
- +widthPx: 48,
18
- +heightPx: 48,
19
- |},
20
- +pageDimensions: {|
21
- +pageWidthPx: 0,
22
- +pageHeightPx: 0,
23
- |},
24
- +layoutMode: "FULLSCREEN",
25
- +paginationEnabled: false,
26
- +navigationPadEnabled: false,
27
- |} | void,
28
- action: any
10
+ state: LayoutState | void,
11
+ action: Action
29
12
  ) => LayoutState;
30
13
  declare export default typeof layoutReducer;
@@ -1,13 +1,4 @@
1
- import VelocityTracker from "../components/velocity-tracker";
1
+ import type { Action } from "./actions";
2
2
  import type { PagerState } from "./types";
3
- declare const pagerReducer: (state: {
4
- readonly animateToPosition: false;
5
- readonly currentPage: number;
6
- readonly dx: 0;
7
- readonly numPages: number;
8
- readonly pageWidthPx: 0;
9
- readonly velocityTracker: VelocityTracker;
10
- } | undefined, action: {
11
- type: string;
12
- }) => PagerState;
3
+ declare const pagerReducer: (state: PagerState | undefined, action: Action) => PagerState;
13
4
  export default pagerReducer;
@@ -4,19 +4,10 @@
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
- import VelocityTracker from "../components/velocity-tracker";
7
+ import type { Action } from "./actions";
8
8
  import type { PagerState } from "./types";
9
9
  declare var pagerReducer: (
10
- state: {|
11
- +animateToPosition: false,
12
- +currentPage: number,
13
- +dx: 0,
14
- +numPages: number,
15
- +pageWidthPx: 0,
16
- +velocityTracker: VelocityTracker,
17
- |} | void,
18
- action: {|
19
- type: string,
20
- |}
10
+ state: PagerState | void,
11
+ action: Action
21
12
  ) => PagerState;
22
13
  declare export default typeof pagerReducer;
@@ -1,4 +1,5 @@
1
- declare const defaultKeypadType: "EXPRESSION";
1
+ import { KeypadType } from "../enums";
2
+ declare const defaultKeypadType = KeypadType.EXPRESSION;
2
3
  declare const keypadForType: {
3
4
  readonly FRACTION: import("../types").KeypadLayout;
4
5
  readonly EXPRESSION: import("../types").KeypadLayout;
@@ -5,7 +5,8 @@
5
5
  * @flow
6
6
  */
7
7
  import * as $Flowgen$Import$_2e__2e__2f_types from "../types";
8
- declare var defaultKeypadType: "EXPRESSION";
8
+ import { KeypadType } from "../enums";
9
+ declare var defaultKeypadType: KeypadType.EXPRESSION;
9
10
  declare var keypadForType: {|
10
11
  +FRACTION: $Flowgen$Import$_2e__2e__2f_types.KeypadLayout,
11
12
  +EXPRESSION: $Flowgen$Import$_2e__2e__2f_types.KeypadLayout,
@@ -1,7 +1,7 @@
1
1
  import GestureManager from "../components/gesture-manager";
2
2
  import VelocityTracker from "../components/velocity-tracker";
3
- import { LayoutModes } from "../consts";
4
- import type { Key } from "../data/keys";
3
+ import Keys from "../data/keys";
4
+ import { LayoutMode, KeypadType } from "../enums";
5
5
  import type { Cursor, KeyHandler, Popover, Echo } from "../types";
6
6
  export interface InputState {
7
7
  keyHandler: KeyHandler | null;
@@ -9,7 +9,7 @@ export interface InputState {
9
9
  }
10
10
  export interface KeypadState {
11
11
  extraKeys: ReadonlyArray<string>;
12
- keypadType: any;
12
+ keypadType: KeypadType;
13
13
  active: boolean;
14
14
  }
15
15
  export interface PagerState {
@@ -22,7 +22,7 @@ export interface PagerState {
22
22
  }
23
23
  export interface GestureState {
24
24
  popover: Popover | null;
25
- focus: Key | null;
25
+ focus: Keys | null;
26
26
  gestureManager: GestureManager;
27
27
  }
28
28
  export interface EchoState {
@@ -43,7 +43,7 @@ export interface LayoutState {
43
43
  pageWidthPx: number;
44
44
  pageHeightPx: number;
45
45
  };
46
- layoutMode: keyof typeof LayoutModes;
46
+ layoutMode: LayoutMode;
47
47
  paginationEnabled: boolean;
48
48
  navigationPadEnabled: boolean;
49
49
  }
@@ -6,8 +6,8 @@
6
6
  */
7
7
  import GestureManager from "../components/gesture-manager";
8
8
  import VelocityTracker from "../components/velocity-tracker";
9
- import { LayoutModes } from "../consts";
10
- import type { Key } from "../data/keys";
9
+ import Keys from "../data/keys";
10
+ import { LayoutMode, KeypadType } from "../enums";
11
11
  import type { Cursor, KeyHandler, Popover, Echo } from "../types";
12
12
  export interface InputState {
13
13
  keyHandler: KeyHandler | null;
@@ -15,7 +15,7 @@ export interface InputState {
15
15
  }
16
16
  export interface KeypadState {
17
17
  extraKeys: $ReadOnlyArray<string>;
18
- keypadType: any;
18
+ keypadType: KeypadType;
19
19
  active: boolean;
20
20
  }
21
21
  export interface PagerState {
@@ -28,7 +28,7 @@ export interface PagerState {
28
28
  }
29
29
  export interface GestureState {
30
30
  popover: Popover | null;
31
- focus: Key | null;
31
+ focus: Keys | null;
32
32
  gestureManager: GestureManager;
33
33
  }
34
34
  export interface EchoState {
@@ -49,7 +49,7 @@ export interface LayoutState {
49
49
  pageWidthPx: number,
50
50
  pageHeightPx: number,
51
51
  |};
52
- layoutMode: $Keys<typeof LayoutModes>;
52
+ layoutMode: LayoutMode;
53
53
  paginationEnabled: boolean;
54
54
  navigationPadEnabled: boolean;
55
55
  }
package/dist/types.d.ts CHANGED
@@ -1,8 +1,7 @@
1
- import { BorderDirections, EchoAnimationTypes, KeyTypes, IconTypes } from "./consts";
1
+ import Keys from "./data/keys";
2
+ import { BorderDirection, EchoAnimationType, IconType, KeyType, KeypadType } from "./enums";
2
3
  import type { CursorContext } from "./components/input/cursor-contexts";
3
- import type { KeypadType } from "./consts";
4
- import type { Key } from "./data/keys";
5
- export type Border = Partial<Array<keyof typeof BorderDirections>>;
4
+ export type Border = Partial<ReadonlyArray<BorderDirection>>;
6
5
  export type Bound = {
7
6
  top: number;
8
7
  right: number;
@@ -12,33 +11,33 @@ export type Bound = {
12
11
  width: number;
13
12
  };
14
13
  export type Popover = {
15
- parentId: Key;
14
+ parentId: Keys;
16
15
  bounds: Partial<Bound>;
17
- childKeyIds: Array<Key>;
16
+ childKeyIds: Array<Keys>;
18
17
  };
19
18
  export type Echo = {
20
19
  animationId: string;
21
- animationType: keyof typeof EchoAnimationTypes;
20
+ animationType: EchoAnimationType;
22
21
  borders: Border;
23
- id: Key;
22
+ id: Keys;
24
23
  initialBounds: DOMRect;
25
24
  };
26
- export type Icon = {
27
- type: keyof typeof IconTypes;
25
+ export type IconConfig = {
26
+ type: IconType;
28
27
  data: string;
29
28
  };
30
29
  export type KeyConfig = {
31
30
  ariaLabel: string;
32
- id: Key;
33
- type: keyof typeof KeyTypes;
34
- childKeyIds: Array<Key>;
35
- icon: Icon;
31
+ id: Keys;
32
+ type: KeyType;
33
+ childKeyIds: Array<Keys>;
34
+ icon: IconConfig;
36
35
  };
37
36
  export type KeypadConfiguration = {
38
37
  keypadType: KeypadType;
39
- extraKeys?: ReadonlyArray<Key>;
38
+ extraKeys?: ReadonlyArray<Keys>;
40
39
  };
41
- export type KeyHandler = (key: Key) => Cursor;
40
+ export type KeyHandler = (key: Keys) => Cursor;
42
41
  export type Cursor = {
43
42
  context: CursorContext;
44
43
  };
@@ -48,3 +47,16 @@ export type KeypadLayout = {
48
47
  numPages: number;
49
48
  maxVisibleRows: number;
50
49
  };
50
+ type ActiveNodesObjPopover = {
51
+ parentId: string;
52
+ childIds: ReadonlyArray<string>;
53
+ };
54
+ export type ActiveNodesObj = {
55
+ popover: ActiveNodesObjPopover | null;
56
+ focus: string | null;
57
+ };
58
+ export type LayoutProps = {
59
+ initialBounds: DOMRect;
60
+ borders: Border;
61
+ };
62
+ export {};