@khanacademy/math-input 1.0.0 → 1.0.1

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 (56) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/components/keypad/index.d.ts +1 -1
  3. package/dist/components/keypad/index.js.flow +1 -3
  4. package/dist/components/node-manager.d.ts +2 -5
  5. package/dist/components/node-manager.js.flow +2 -5
  6. package/dist/components/popover-state-machine.d.ts +1 -8
  7. package/dist/components/popover-state-machine.js.flow +2 -8
  8. package/dist/components/provided-keypad.d.ts +1 -4
  9. package/dist/components/provided-keypad.js.flow +1 -4
  10. package/dist/es/index.css +0 -3
  11. package/dist/es/index.js +53 -64
  12. package/dist/es/index.js.map +1 -1
  13. package/dist/index.css +0 -3
  14. package/dist/index.js +59 -71
  15. package/dist/index.js.map +1 -1
  16. package/dist/store/actions.d.ts +64 -0
  17. package/dist/store/actions.js.flow +100 -0
  18. package/dist/store/echo-reducer.d.ts +2 -3
  19. package/dist/store/echo-reducer.js.flow +2 -6
  20. package/dist/store/index.d.ts +5 -41
  21. package/dist/store/index.js.flow +5 -52
  22. package/dist/store/input-reducer.d.ts +2 -5
  23. package/dist/store/input-reducer.js.flow +3 -6
  24. package/dist/store/keypad-reducer.d.ts +2 -7
  25. package/dist/store/keypad-reducer.js.flow +3 -8
  26. package/dist/store/layout-reducer.d.ts +2 -19
  27. package/dist/store/layout-reducer.js.flow +3 -20
  28. package/dist/store/pager-reducer.d.ts +2 -11
  29. package/dist/store/pager-reducer.js.flow +3 -12
  30. package/dist/store/types.d.ts +2 -1
  31. package/dist/store/types.js.flow +2 -1
  32. package/dist/types.d.ts +13 -0
  33. package/dist/types.js.flow +12 -0
  34. package/less/overrides.less +0 -6
  35. package/package.json +1 -1
  36. package/src/components/keypad/index.tsx +1 -1
  37. package/src/components/keypad-container.tsx +1 -1
  38. package/src/components/keypad.tsx +1 -1
  39. package/src/components/node-manager.ts +2 -2
  40. package/src/components/popover-state-machine.ts +2 -10
  41. package/src/components/provided-keypad.tsx +3 -12
  42. package/src/math-input.stories.tsx +67 -0
  43. package/src/store/actions.ts +178 -0
  44. package/src/store/echo-reducer.ts +5 -2
  45. package/src/store/index.ts +25 -24
  46. package/src/store/input-reducer.ts +3 -2
  47. package/src/store/keypad-reducer.ts +3 -6
  48. package/src/store/layout-reducer.ts +3 -2
  49. package/src/store/pager-reducer.ts +27 -43
  50. package/src/store/types.ts +18 -1
  51. package/src/types.ts +12 -0
  52. package/tsconfig.tsbuildinfo +1 -1
  53. package/dist/actions/index.d.ts +0 -31
  54. package/dist/actions/index.js.flow +0 -40
  55. package/src/actions/index.ts +0 -57
  56. /package/src/components/{gesture-manager.tsx → gesture-manager.ts} +0 -0
@@ -0,0 +1,64 @@
1
+ import type { Key } 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: Key;
58
+ borders: Border;
59
+ initialBounds: DOMRect;
60
+ inPopover: boolean;
61
+ };
62
+ export declare const pressKey: (key: Key, borders: ("LEFT" | "BOTTOM" | 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,100 @@
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 { Key } from "../data/keys";
8
+ import type {
9
+ KeypadConfiguration,
10
+ KeyHandler,
11
+ Cursor,
12
+ ActiveNodesObj,
13
+ Border,
14
+ } from "../types";
15
+ declare type DismissKeypadAction = {|
16
+ type: "DismissKeypad",
17
+ |};
18
+ declare export var dismissKeypad: () => DismissKeypadAction;
19
+ declare type ActivateKeypadAction = {|
20
+ type: "ActivateKeypad",
21
+ |};
22
+ declare export var activateKeypad: () => ActivateKeypadAction;
23
+ /**
24
+ * Configure the keypad with the provided configuration parameters.
25
+ */
26
+ declare type ConfigureKeypadAction = {|
27
+ type: "ConfigureKeypad",
28
+ configuration: KeypadConfiguration,
29
+ |};
30
+ declare export var configureKeypad: (
31
+ configuration: KeypadConfiguration
32
+ ) => ConfigureKeypadAction;
33
+ declare type SetPageSizeAction = {|
34
+ type: "SetPageSize",
35
+ pageWidthPx: number,
36
+ pageHeightPx: number,
37
+ |};
38
+ declare export var setPageSize: (
39
+ pageWidthPx: number,
40
+ pageHeightPx: number
41
+ ) => SetPageSizeAction;
42
+ declare type RemoveEchoAction = {|
43
+ type: "RemoveEcho",
44
+ animationId: string,
45
+ |};
46
+ declare export var removeEcho: (animationId: string) => RemoveEchoAction;
47
+ declare type SetKeyHandlerAction = {|
48
+ type: "SetKeyHandler",
49
+ keyHandler: KeyHandler,
50
+ |};
51
+ declare export var setKeyHandler: (
52
+ keyHandler: KeyHandler
53
+ ) => SetKeyHandlerAction;
54
+ declare type SetCursorAction = {|
55
+ type: "SetCursor",
56
+ cursor: Cursor,
57
+ |};
58
+ declare export var setCursor: (cursor: Cursor) => SetCursorAction;
59
+ declare type OnSwipeChangeAction = {|
60
+ type: "OnSwipeChange",
61
+ dx: number,
62
+ |};
63
+ declare export var onSwipeChange: (dx: number) => OnSwipeChangeAction;
64
+ declare type OnSwipeEndAction = {|
65
+ type: "OnSwipeEnd",
66
+ dx: number,
67
+ |};
68
+ declare export var onSwipeEnd: (dx: number) => OnSwipeEndAction;
69
+ declare type SetActiveNodesAction = {|
70
+ type: "SetActiveNodes",
71
+ activeNodes: any,
72
+ |};
73
+ declare export var setActiveNodes: (
74
+ activeNodes: ActiveNodesObj
75
+ ) => SetActiveNodesAction;
76
+ declare type PressKeyAction = {|
77
+ type: "PressKey",
78
+ key: Key,
79
+ borders: Border,
80
+ initialBounds: DOMRect,
81
+ inPopover: boolean,
82
+ |};
83
+ declare export var pressKey: (
84
+ key: Key,
85
+ borders: ("LEFT" | "BOTTOM" | void)[],
86
+ initialBounds: DOMRect,
87
+ inPopover: any
88
+ ) => PressKeyAction;
89
+ export type Action =
90
+ | DismissKeypadAction
91
+ | ActivateKeypadAction
92
+ | ConfigureKeypadAction
93
+ | SetPageSizeAction
94
+ | RemoveEchoAction
95
+ | SetKeyHandlerAction
96
+ | SetCursorAction
97
+ | OnSwipeChangeAction
98
+ | OnSwipeEndAction
99
+ | SetActiveNodesAction
100
+ | 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,6 +1,7 @@
1
1
  import GestureManager from "../components/gesture-manager";
2
2
  import VelocityTracker from "../components/velocity-tracker";
3
3
  import { LayoutModes } from "../consts";
4
+ import type { KeypadType } from "../consts";
4
5
  import type { Key } from "../data/keys";
5
6
  import type { Cursor, KeyHandler, Popover, Echo } from "../types";
6
7
  export interface InputState {
@@ -9,7 +10,7 @@ export interface InputState {
9
10
  }
10
11
  export interface KeypadState {
11
12
  extraKeys: ReadonlyArray<string>;
12
- keypadType: any;
13
+ keypadType: KeypadType;
13
14
  active: boolean;
14
15
  }
15
16
  export interface PagerState {
@@ -7,6 +7,7 @@
7
7
  import GestureManager from "../components/gesture-manager";
8
8
  import VelocityTracker from "../components/velocity-tracker";
9
9
  import { LayoutModes } from "../consts";
10
+ import type { KeypadType } from "../consts";
10
11
  import type { Key } from "../data/keys";
11
12
  import type { Cursor, KeyHandler, Popover, Echo } from "../types";
12
13
  export interface InputState {
@@ -15,7 +16,7 @@ export interface InputState {
15
16
  }
16
17
  export interface KeypadState {
17
18
  extraKeys: $ReadOnlyArray<string>;
18
- keypadType: any;
19
+ keypadType: KeypadType;
19
20
  active: boolean;
20
21
  }
21
22
  export interface PagerState {
package/dist/types.d.ts CHANGED
@@ -48,3 +48,16 @@ export type KeypadLayout = {
48
48
  numPages: number;
49
49
  maxVisibleRows: number;
50
50
  };
51
+ type ActiveNodesObjPopover = {
52
+ parentId: string;
53
+ childIds: ReadonlyArray<string>;
54
+ };
55
+ export type ActiveNodesObj = {
56
+ popover: ActiveNodesObjPopover | null;
57
+ focus: string | null;
58
+ };
59
+ export type LayoutProps = {
60
+ initialBounds: DOMRect;
61
+ borders: Border;
62
+ };
63
+ export {};
@@ -59,3 +59,15 @@ export type KeypadLayout = {|
59
59
  numPages: number,
60
60
  maxVisibleRows: number,
61
61
  |};
62
+ declare type ActiveNodesObjPopover = {|
63
+ parentId: string,
64
+ childIds: $ReadOnlyArray<string>,
65
+ |};
66
+ export type ActiveNodesObj = {|
67
+ popover: ActiveNodesObjPopover | null,
68
+ focus: string | null,
69
+ |};
70
+ export type LayoutProps = {|
71
+ initialBounds: DOMRect,
72
+ borders: Border,
73
+ |};
@@ -121,9 +121,3 @@
121
121
  display: inline-block !important;
122
122
  }
123
123
  }
124
-
125
- // The keypad sets its own color styles for KaTeX elements that are rendered in
126
- // its keys, so prevent any external styling.
127
- .keypad-container .katex {
128
- color: inherit !important;
129
- }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Khan Academy's new expression editor for the mobile web.",
4
4
  "author": "Khan Academy",
5
5
  "license": "MIT",
6
- "version": "1.0.0",
6
+ "version": "1.0.1",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -31,7 +31,7 @@ const allPages = function (props: Props): React.ReactElement {
31
31
  return pages;
32
32
  };
33
33
 
34
- export default class PreAlgebraKeypad extends React.Component<Props, State> {
34
+ export default class Keypad extends React.Component<Props, State> {
35
35
  state: State = {
36
36
  selectedPage: "Numbers",
37
37
  };
@@ -2,9 +2,9 @@ import {StyleSheet} from "aphrodite";
2
2
  import * as React from "react";
3
3
  import {connect} from "react-redux";
4
4
 
5
- import {setPageSize} from "../actions/index";
6
5
  import {KeypadTypes, LayoutModes} from "../consts";
7
6
  import {View} from "../fake-react-native-web/index";
7
+ import {setPageSize} from "../store/actions";
8
8
 
9
9
  import {
10
10
  innerBorderColor,
@@ -7,8 +7,8 @@ import * as React from "react";
7
7
  import ReactDOM from "react-dom";
8
8
  import {connect} from "react-redux";
9
9
 
10
- import {removeEcho} from "../actions/index";
11
10
  import {View} from "../fake-react-native-web/index";
11
+ import {removeEcho} from "../store/actions";
12
12
 
13
13
  import EchoManager from "./echo-manager";
14
14
  import PopoverManager from "./popover-manager";
@@ -1,4 +1,4 @@
1
- import type {Border} from "../types";
1
+ import type {Border, LayoutProps} from "../types";
2
2
  /**
3
3
  * A manager for our node-to-ID system. In particular, this class is
4
4
  * responsible for maintaing a mapping between DOM nodes and node IDs, and
@@ -122,7 +122,7 @@ class NodeManager {
122
122
  * @returns {object} - the bounding client rect for the given node, along
123
123
  * with its borders
124
124
  */
125
- layoutPropsForId(id: string): {initialBounds: DOMRect; borders: Border} {
125
+ layoutPropsForId(id: string): LayoutProps {
126
126
  if (!this._cachedBoundingBoxesById[id]) {
127
127
  const node = this._nodesById[id];
128
128
 
@@ -1,3 +1,5 @@
1
+ import type {ActiveNodesObj} from "../types";
2
+
1
3
  /**
2
4
  * A state machine for the popover state. In particular, this class manages the
3
5
  * mapping of parent nodes to their children, and translates touch events that
@@ -5,16 +7,6 @@
5
7
  * is present.
6
8
  */
7
9
 
8
- type ActiveNodesObjPopover = {
9
- parentId: string;
10
- childIds: ReadonlyArray<string>;
11
- };
12
-
13
- type ActiveNodesObj = {
14
- popover: ActiveNodesObjPopover | null;
15
- focus: string | null;
16
- };
17
-
18
10
  type Handlers = {
19
11
  onActiveNodesChanged: (activeNodes: ActiveNodesObj) => void;
20
12
  onClick: (keyId: string, domNodeId: string, inPopover: boolean) => void;
@@ -1,4 +1,3 @@
1
- /* eslint-disable react/no-unsafe */
2
1
  import * as React from "react";
3
2
  import ReactDOM from "react-dom";
4
3
  import {Provider} from "react-redux";
@@ -9,7 +8,7 @@ import {
9
8
  configureKeypad,
10
9
  setCursor,
11
10
  setKeyHandler,
12
- } from "../actions/index";
11
+ } from "../store/actions";
13
12
  import {createStore} from "../store/index";
14
13
 
15
14
  import KeypadContainer from "./keypad-container";
@@ -24,21 +23,13 @@ type Props = {
24
23
  };
25
24
 
26
25
  class ProvidedKeypad extends React.Component<Props> {
27
- mounted?: boolean;
28
26
  store: any;
29
27
 
30
- UNSAFE_componentWillMount() {
28
+ constructor(props) {
29
+ super(props);
31
30
  this.store = createStore();
32
31
  }
33
32
 
34
- componentDidMount() {
35
- this.mounted = true;
36
- }
37
-
38
- componentWillUnmount() {
39
- this.mounted = false;
40
- }
41
-
42
33
  activate: () => void = () => {
43
34
  this.store.dispatch(activateKeypad());
44
35
  };