@maestro_io/maestro-web-sdk 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.
- package/dist/1.maestro-web-sdk.umd.js +2 -0
- package/dist/1.maestro-web-sdk.umd.js.map +1 -0
- package/dist/2.maestro-web-sdk.umd.js +2 -0
- package/dist/2.maestro-web-sdk.umd.js.map +1 -0
- package/dist/3.maestro-web-sdk.umd.js +2 -0
- package/dist/3.maestro-web-sdk.umd.js.map +1 -0
- package/dist/4.maestro-web-sdk.umd.js +2 -0
- package/dist/4.maestro-web-sdk.umd.js.map +1 -0
- package/dist/5.maestro-web-sdk.umd.js +2 -0
- package/dist/5.maestro-web-sdk.umd.js.map +1 -0
- package/dist/6.maestro-web-sdk.umd.js +2 -0
- package/dist/6.maestro-web-sdk.umd.js.map +1 -0
- package/dist/MaestroEventDelegate.d.ts +9 -0
- package/dist/components/atoms/BaseButton/BaseButton.d.ts +9 -0
- package/dist/components/atoms/BaseButton/index.d.ts +2 -0
- package/dist/components/atoms/Image/index.d.ts +9 -0
- package/dist/components/atoms/SvgIcon/BetsIcon.d.ts +7 -0
- package/dist/components/atoms/SvgIcon/FantasyIcon.d.ts +6 -0
- package/dist/components/atoms/SvgIcon/Icon.d.ts +30 -0
- package/dist/components/atoms/SvgIcon/KeyPlaysIcon.d.ts +6 -0
- package/dist/components/atoms/SvgIcon/PlayIcon.d.ts +6 -0
- package/dist/components/atoms/SvgIcon/StatsIcon.d.ts +6 -0
- package/dist/components/atoms/SvgIcon/WarningIcon.d.ts +6 -0
- package/dist/components/atoms/SvgIcon/index.d.ts +2 -0
- package/dist/components/core/App/App.d.ts +10 -0
- package/dist/components/core/App/index.d.ts +2 -0
- package/dist/components/core/PanelManager/PanelManager.d.ts +14 -0
- package/dist/components/core/PanelManager/index.d.ts +2 -0
- package/dist/components/molecules/ActionButton/ActionButton.d.ts +50 -0
- package/dist/components/molecules/ActionButton/index.d.ts +2 -0
- package/dist/components/molecules/PanelNavButton/PanelNavButton.d.ts +107 -0
- package/dist/components/molecules/PanelNavButton/index.d.ts +2 -0
- package/dist/components/molecules/ScrollableGradient/ScrollableGradient.d.ts +11 -0
- package/dist/components/molecules/ScrollableGradient/index.d.ts +2 -0
- package/dist/components/molecules/SegmentButton/SegmentButton.d.ts +10 -0
- package/dist/components/molecules/SegmentButton/index.d.ts +2 -0
- package/dist/components/molecules/WatchButton/WatchButton.d.ts +10 -0
- package/dist/components/molecules/WatchButton/index.d.ts +2 -0
- package/dist/components/organisms/PanelNavigation/PanelNavigation.d.ts +15 -0
- package/dist/components/organisms/PanelNavigation/index.d.ts +2 -0
- package/dist/components/organisms/SegmentController/SegmentController.d.ts +14 -0
- package/dist/components/organisms/SegmentController/index.d.ts +2 -0
- package/dist/external/AxiosNetworkClient.d.ts +15 -0
- package/dist/external/LocalStorageCacheManager.d.ts +10 -0
- package/dist/external/ReactRenderer.d.ts +26 -0
- package/dist/external/ports/cacheManager.d.ts +15 -0
- package/dist/external/ports/networkClient.d.ts +5 -0
- package/dist/external/ports/renderer.d.ts +9 -0
- package/dist/external/spatial-navigation/index.d.ts +5 -0
- package/dist/external/spatial-navigation/measureLayout.d.ts +2 -0
- package/dist/external/spatial-navigation/spatialNavigation.d.ts +166 -0
- package/dist/external/spatial-navigation/utils.d.ts +15 -0
- package/dist/external/spatial-navigation/visualDebugger.d.ts +17 -0
- package/dist/external/spatial-navigation/withFocusable.d.ts +81 -0
- package/dist/helpers/Observable.d.ts +12 -0
- package/dist/helpers/deliver-focus.d.ts +5 -0
- package/dist/helpers/withRemoteControl.d.ts +47 -0
- package/dist/index.d.ts +60 -382
- package/dist/interfaces/IMaestroEvent.d.ts +62 -0
- package/dist/interfaces/IMaestroEventDelegate.d.ts +18 -0
- package/dist/interfaces/IMaestroManager.d.ts +82 -0
- package/dist/maestro-web-sdk.umd.js +2 -3
- package/dist/maestro-web-sdk.umd.js.map +1 -1
- package/dist/models/IModel.d.ts +7 -0
- package/dist/models/IPanel.d.ts +20 -0
- package/dist/models/ITheme.d.ts +77 -0
- package/dist/modules/key-plays/constants.d.ts +3 -0
- package/dist/modules/key-plays/interfaces/IKeyPlays.d.ts +31 -0
- package/dist/modules/key-plays/interfaces/IKeyPlaysResponse.d.ts +44 -0
- package/dist/modules/key-plays/view/KeyPlayCardScoreTagView.d.ts +9 -0
- package/dist/modules/key-plays/view/KeyPlayCardView.d.ts +115 -0
- package/dist/modules/key-plays/view/KeyPlayErrorStateView.d.ts +11 -0
- package/dist/modules/key-plays/view/KeyPlaysView.d.ts +53 -0
- package/dist/modules/key-plays/view-model/KeyPlaysViewModel.d.ts +29 -0
- package/dist/services/NetworkManager.d.ts +13 -0
- package/dist/services/ThemeManager/constants.d.ts +2 -0
- package/dist/view-models/MaestroEventViewModel.d.ts +37 -0
- package/dist/view-models/PanelManagerViewModel.d.ts +18 -0
- package/dist/view-models/ViewModel.d.ts +12 -0
- package/dist/view-models/index.d.ts +17 -0
- package/package.json +57 -36
- package/dist/BetsIcon-UrnN4lvP.js +0 -22
- package/dist/BetsIcon-UrnN4lvP.js.map +0 -1
- package/dist/FantasyIcon-DmloKsq_.js +0 -24
- package/dist/FantasyIcon-DmloKsq_.js.map +0 -1
- package/dist/KeyPlayErrorStateView-Dk89rtUq.js +0 -112
- package/dist/KeyPlayErrorStateView-Dk89rtUq.js.map +0 -1
- package/dist/KeyPlaysIcon-Br9gu_Zu.js +0 -24
- package/dist/KeyPlaysIcon-Br9gu_Zu.js.map +0 -1
- package/dist/KeyPlaysView-Br-88ytG.js +0 -174
- package/dist/KeyPlaysView-Br-88ytG.js.map +0 -1
- package/dist/PlayIcon-CNKWNaLP.js +0 -24
- package/dist/PlayIcon-CNKWNaLP.js.map +0 -1
- package/dist/StatsIcon-Ds4hriWX.js +0 -25
- package/dist/StatsIcon-Ds4hriWX.js.map +0 -1
- package/dist/WarningIcon-BuzZKL26.js +0 -24
- package/dist/WarningIcon-BuzZKL26.js.map +0 -1
- package/dist/index-BaSckwps.js +0 -2998
- package/dist/index-BaSckwps.js.map +0 -1
- package/dist/index-DXErYNZH.js +0 -151
- package/dist/index-DXErYNZH.js.map +0 -1
- package/dist/index-q5GKgbOd.js +0 -56
- package/dist/index-q5GKgbOd.js.map +0 -1
- package/dist/maestro-web-sdk.esm.js +0 -6
- package/dist/maestro-web-sdk.esm.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { Direction, Layout } from './utils';
|
|
2
|
+
import { KEY_ENTER } from './utils';
|
|
3
|
+
export declare const ROOT_FOCUS_KEY = "SN:ROOT";
|
|
4
|
+
export type KeyType = Direction | typeof KEY_ENTER;
|
|
5
|
+
export interface KeyMap {
|
|
6
|
+
[key: string]: number;
|
|
7
|
+
}
|
|
8
|
+
interface FocusableComponent {
|
|
9
|
+
focusKey: string;
|
|
10
|
+
node: HTMLElement;
|
|
11
|
+
parentFocusKey: string | null;
|
|
12
|
+
onEnterPressHandler?: (details: {
|
|
13
|
+
pressedKeys: Record<string, number>;
|
|
14
|
+
}) => void;
|
|
15
|
+
onEnterReleaseHandler?: () => void;
|
|
16
|
+
onArrowPressHandler?: (direction: Direction, details: {
|
|
17
|
+
pressedKeys: Record<string, number>;
|
|
18
|
+
}) => boolean | void;
|
|
19
|
+
onBecameFocusedHandler?: (layout: Layout, details: any) => void;
|
|
20
|
+
onBecameBlurredHandler?: (layout: Layout, details: any) => void;
|
|
21
|
+
onUpdateFocus?: (isFocused: boolean) => void;
|
|
22
|
+
onUpdateHasFocusedChild?: (hasFocusedChild: boolean) => void;
|
|
23
|
+
forgetLastFocusedChild?: boolean;
|
|
24
|
+
trackChildren?: boolean;
|
|
25
|
+
lastFocusedChildKey: string | null;
|
|
26
|
+
preferredChildFocusKey?: string;
|
|
27
|
+
focusable: boolean;
|
|
28
|
+
blockNavigationOut?: boolean;
|
|
29
|
+
autoRestoreFocus?: boolean;
|
|
30
|
+
layout: Layout;
|
|
31
|
+
layoutUpdated: boolean;
|
|
32
|
+
}
|
|
33
|
+
interface Corner {
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
36
|
+
}
|
|
37
|
+
interface RefCorners {
|
|
38
|
+
a: Corner;
|
|
39
|
+
b: Corner;
|
|
40
|
+
}
|
|
41
|
+
export interface InitOptions {
|
|
42
|
+
debug?: boolean;
|
|
43
|
+
visualDebug?: boolean;
|
|
44
|
+
nativeMode?: boolean;
|
|
45
|
+
throttle?: number;
|
|
46
|
+
throttleKeypresses?: boolean;
|
|
47
|
+
}
|
|
48
|
+
interface AddFocusableOptions {
|
|
49
|
+
focusKey: string;
|
|
50
|
+
node: HTMLElement;
|
|
51
|
+
parentFocusKey: string | null;
|
|
52
|
+
onEnterPressHandler?: (details: {
|
|
53
|
+
pressedKeys: Record<string, number>;
|
|
54
|
+
}) => void;
|
|
55
|
+
onEnterReleaseHandler?: () => void;
|
|
56
|
+
onArrowPressHandler?: (direction: Direction, details: {
|
|
57
|
+
pressedKeys: Record<string, number>;
|
|
58
|
+
}) => boolean | void;
|
|
59
|
+
onBecameFocusedHandler?: (layout: Layout, details: any) => void;
|
|
60
|
+
onBecameBlurredHandler?: (layout: Layout, details: any) => void;
|
|
61
|
+
forgetLastFocusedChild?: boolean;
|
|
62
|
+
trackChildren?: boolean;
|
|
63
|
+
onUpdateFocus?: (isFocused: boolean) => void;
|
|
64
|
+
onUpdateHasFocusedChild?: (hasFocusedChild: boolean) => void;
|
|
65
|
+
preferredChildFocusKey?: string;
|
|
66
|
+
autoRestoreFocus?: boolean;
|
|
67
|
+
focusable?: boolean;
|
|
68
|
+
blockNavigationOut?: boolean;
|
|
69
|
+
}
|
|
70
|
+
interface UpdateFocusableOptions {
|
|
71
|
+
node?: HTMLElement;
|
|
72
|
+
preferredChildFocusKey?: string;
|
|
73
|
+
focusable?: boolean;
|
|
74
|
+
blockNavigationOut?: boolean;
|
|
75
|
+
}
|
|
76
|
+
export declare const getChildClosestToOrigin: (children: FocusableComponent[]) => FocusableComponent;
|
|
77
|
+
declare class SpatialNavigation {
|
|
78
|
+
private focusableComponents;
|
|
79
|
+
private focusKey;
|
|
80
|
+
private parentsHavingFocusedChild;
|
|
81
|
+
private enabled;
|
|
82
|
+
private nativeMode;
|
|
83
|
+
private throttle;
|
|
84
|
+
private throttleKeypresses;
|
|
85
|
+
private pressedKeys;
|
|
86
|
+
private paused;
|
|
87
|
+
private keyDownEventListener;
|
|
88
|
+
private keyUpEventListener;
|
|
89
|
+
private keyMap;
|
|
90
|
+
private debug;
|
|
91
|
+
private visualDebugger;
|
|
92
|
+
private logIndex;
|
|
93
|
+
/**
|
|
94
|
+
* Used to determine the coordinate that will be used to filter items that are over the "edge"
|
|
95
|
+
*/
|
|
96
|
+
static getCutoffCoordinate(isVertical: boolean, isIncremental: boolean, isSibling: boolean, layout: Layout): number;
|
|
97
|
+
/**
|
|
98
|
+
* Returns two corners (a and b) coordinates that are used as a reference points
|
|
99
|
+
* Where "a" is always leftmost and topmost corner, and "b" is rightmost bottommost corner
|
|
100
|
+
*/
|
|
101
|
+
static getRefCorners(direction: Direction, isSibling: boolean, layout: Layout): RefCorners;
|
|
102
|
+
/**
|
|
103
|
+
* Calculates if the sibling node is intersecting enough with the ref node by the secondary coordinate
|
|
104
|
+
*/
|
|
105
|
+
static isAdjacentSlice(refCorners: RefCorners, siblingCorners: RefCorners, isVerticalDirection: boolean): boolean;
|
|
106
|
+
static getPrimaryAxisDistance(refCorners: RefCorners, siblingCorners: RefCorners, isVerticalDirection: boolean): number;
|
|
107
|
+
static getSecondaryAxisDistance(refCorners: RefCorners, siblingCorners: RefCorners, isVerticalDirection: boolean): number;
|
|
108
|
+
/**
|
|
109
|
+
* Inspired by: https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS_for_TV/TV_remote_control_navigation#Algorithm_design
|
|
110
|
+
* Ref Corners are the 2 corners of the current component in the direction of navigation
|
|
111
|
+
* They used as a base to measure adjacent slices
|
|
112
|
+
*/
|
|
113
|
+
sortSiblingsByPriority(siblings: FocusableComponent[], currentLayout: Layout, direction: Direction, _focusKey: string): FocusableComponent[];
|
|
114
|
+
constructor();
|
|
115
|
+
init({ debug, visualDebug, nativeMode, throttle, throttleKeypresses, }?: InitOptions): void;
|
|
116
|
+
startDrawLayouts(): void;
|
|
117
|
+
destroy(): void;
|
|
118
|
+
getEventType(keyCode: number): KeyType | undefined;
|
|
119
|
+
bindEventHandlers(): void;
|
|
120
|
+
unbindEventHandlers(): void;
|
|
121
|
+
onEnterPress(details: {
|
|
122
|
+
pressedKeys: Record<string, number>;
|
|
123
|
+
}): void;
|
|
124
|
+
onEnterRelease(): void;
|
|
125
|
+
onArrowPress(direction: Direction, details: {
|
|
126
|
+
pressedKeys: Record<string, number>;
|
|
127
|
+
}): boolean | void;
|
|
128
|
+
navigateByDirection(direction: Direction, details?: Record<string, any>): void;
|
|
129
|
+
onKeyEvent(event: KeyboardEvent): void;
|
|
130
|
+
smartNavigate(direction: Direction, fromParentFocusKey: string | null, details: Record<string, any>): void;
|
|
131
|
+
saveLastFocusedChildKey(component: FocusableComponent | undefined, focusKey: string): void;
|
|
132
|
+
log(functionName: string, debugString: string, ...rest: any[]): void;
|
|
133
|
+
getNextFocusKey(targetFocusKey: string): string;
|
|
134
|
+
addFocusable({ focusKey, node, parentFocusKey, onEnterPressHandler, onEnterReleaseHandler, onArrowPressHandler, onBecameFocusedHandler, onBecameBlurredHandler, forgetLastFocusedChild, trackChildren, onUpdateFocus, onUpdateHasFocusedChild, preferredChildFocusKey, autoRestoreFocus, focusable, blockNavigationOut, }: AddFocusableOptions): void;
|
|
135
|
+
removeFocusable({ focusKey }: {
|
|
136
|
+
focusKey: string;
|
|
137
|
+
}): void;
|
|
138
|
+
getNodeLayoutByFocusKey(focusKey: string): Layout | null;
|
|
139
|
+
setCurrentFocusedKey(newFocusKey: string, details: Record<string, any>): void;
|
|
140
|
+
updateParentsHasFocusedChild(focusKey: string, details: Record<string, any>): void;
|
|
141
|
+
updateParentsLastFocusedChild(focusKey: string): void;
|
|
142
|
+
getKeyMap(): KeyMap;
|
|
143
|
+
setKeyMap(keyMap: KeyMap): void;
|
|
144
|
+
isFocusableComponent(focusKey: string): boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Checks whether the focusableComponent is actually participating in spatial navigation (in other words, is a
|
|
147
|
+
* 'focusable' focusableComponent). Seems less confusing than calling it isFocusableFocusableComponent()
|
|
148
|
+
*/
|
|
149
|
+
isParticipatingFocusableComponent(focusKey: string): boolean;
|
|
150
|
+
onIntermediateNodeBecameFocused(focusKey: string, details: Record<string, any>): void;
|
|
151
|
+
onIntermediateNodeBecameBlurred(focusKey: string, details: Record<string, any>): void;
|
|
152
|
+
pause(): void;
|
|
153
|
+
resume(): void;
|
|
154
|
+
setFocus(targetFocusKey: string, details?: Record<string, any>): void;
|
|
155
|
+
updateAllLayouts(): void;
|
|
156
|
+
updateLayout(focusKey: string): void;
|
|
157
|
+
updateFocusable(focusKey: string, { node, preferredChildFocusKey, focusable, blockNavigationOut, }: UpdateFocusableOptions): void;
|
|
158
|
+
isNativeMode(): boolean;
|
|
159
|
+
getFocusableComponents(): FocusableComponent[];
|
|
160
|
+
getFocusableComponentsByParentFocusKey(parentFocusKey: string): FocusableComponent[];
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Export singleton
|
|
164
|
+
*/
|
|
165
|
+
declare const _default: SpatialNavigation;
|
|
166
|
+
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const DIRECTION_LEFT = "left";
|
|
2
|
+
export declare const DIRECTION_RIGHT = "right";
|
|
3
|
+
export declare const DIRECTION_UP = "up";
|
|
4
|
+
export declare const DIRECTION_DOWN = "down";
|
|
5
|
+
export declare const KEY_ENTER = "enter";
|
|
6
|
+
export type Direction = typeof DIRECTION_LEFT | typeof DIRECTION_RIGHT | typeof DIRECTION_UP | typeof DIRECTION_DOWN;
|
|
7
|
+
export interface Layout {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
left: number;
|
|
13
|
+
top: number;
|
|
14
|
+
node: HTMLElement;
|
|
15
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface Layout {
|
|
2
|
+
left: number;
|
|
3
|
+
top: number;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
}
|
|
7
|
+
declare class VisualDebugger {
|
|
8
|
+
private debugCtx;
|
|
9
|
+
private layoutsCtx;
|
|
10
|
+
constructor();
|
|
11
|
+
static createCanvas(id: string, zIndex: number): CanvasRenderingContext2D;
|
|
12
|
+
clear(): void;
|
|
13
|
+
clearLayouts(): void;
|
|
14
|
+
drawLayout(layout: Layout, focusKey: string, parentFocusKey: string): void;
|
|
15
|
+
drawPoint(x: number, y: number, color?: string, size?: number): void;
|
|
16
|
+
}
|
|
17
|
+
export default VisualDebugger;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Direction, Layout } from './utils';
|
|
4
|
+
interface WithFocusableConfig {
|
|
5
|
+
forgetLastFocusedChild?: boolean;
|
|
6
|
+
trackChildren?: boolean;
|
|
7
|
+
autoRestoreFocus?: boolean;
|
|
8
|
+
blockNavigationOut?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface WithFocusableProps {
|
|
11
|
+
focused?: boolean;
|
|
12
|
+
focusKey?: string;
|
|
13
|
+
parentFocusKey?: string;
|
|
14
|
+
preferredChildFocusKey?: string;
|
|
15
|
+
forgetLastFocusedChild?: boolean;
|
|
16
|
+
trackChildren?: boolean;
|
|
17
|
+
autoRestoreFocus?: boolean;
|
|
18
|
+
blockNavigationOut?: boolean;
|
|
19
|
+
focusable?: boolean;
|
|
20
|
+
onEnterPress?: (props: any, details: {
|
|
21
|
+
pressedKeys: Record<string, number>;
|
|
22
|
+
}) => void;
|
|
23
|
+
onEnterRelease?: (props: any) => void;
|
|
24
|
+
onArrowPress?: (direction: Direction, props: any, details: {
|
|
25
|
+
pressedKeys: Record<string, number>;
|
|
26
|
+
}) => boolean | void;
|
|
27
|
+
onBecameFocused?: (layout: Layout, props: any, details: any) => void;
|
|
28
|
+
onBecameBlurred?: (layout: Layout, props: any, details: any) => void;
|
|
29
|
+
}
|
|
30
|
+
export interface WithFocusableState {
|
|
31
|
+
realFocusKey: string;
|
|
32
|
+
focused: boolean;
|
|
33
|
+
hasFocusedChild: boolean;
|
|
34
|
+
parentFocusKey: string;
|
|
35
|
+
}
|
|
36
|
+
declare const withFocusable: <P extends object>({ forgetLastFocusedChild: configForgetLastFocusedChild, trackChildren: configTrackChildren, autoRestoreFocus: configAutoRestoreFocus, blockNavigationOut: configBlockNavigationOut, }?: WithFocusableConfig) => (WrappedComponent: import("react").ComponentType<P & WithFocusableProps>) => {
|
|
37
|
+
new (props?: (P & WithFocusableProps) | undefined, context?: any): {
|
|
38
|
+
state: WithFocusableState;
|
|
39
|
+
getChildContext(): {
|
|
40
|
+
parentFocusKey: string;
|
|
41
|
+
};
|
|
42
|
+
setFocus: (focusKey: string) => void;
|
|
43
|
+
navigateByDirection: (direction: Direction, details?: Record<string, any>) => void;
|
|
44
|
+
stealFocus: () => void;
|
|
45
|
+
onUpdateFocus: (focused: boolean) => void;
|
|
46
|
+
onUpdateHasFocusedChild: (hasFocusedChild: boolean) => void;
|
|
47
|
+
onEnterPressHandler: (details: {
|
|
48
|
+
pressedKeys: Record<string, number>;
|
|
49
|
+
}) => void;
|
|
50
|
+
onEnterReleaseHandler: () => void;
|
|
51
|
+
onArrowPressHandler: (direction: Direction, details: {
|
|
52
|
+
pressedKeys: Record<string, number>;
|
|
53
|
+
}) => boolean | void;
|
|
54
|
+
onBecameFocusedHandler: (layout: Layout, details: any) => void;
|
|
55
|
+
onBecameBlurredHandler: (layout: Layout, details: any) => void;
|
|
56
|
+
componentDidMount(): void;
|
|
57
|
+
componentDidUpdate(): void;
|
|
58
|
+
componentWillUnmount(): void;
|
|
59
|
+
render(): import("react").ReactElement<P & WithFocusableProps>;
|
|
60
|
+
setState<K extends keyof WithFocusableState>(state: WithFocusableState | ((prevState: Readonly<WithFocusableState>, props: P & WithFocusableProps) => WithFocusableState | Pick<WithFocusableState, K>) | Pick<WithFocusableState, K>, callback?: (() => any) | undefined): void;
|
|
61
|
+
forceUpdate(callBack?: (() => any) | undefined): void;
|
|
62
|
+
props: Readonly<{
|
|
63
|
+
children?: import("react").ReactNode;
|
|
64
|
+
}> & Readonly<P & WithFocusableProps>;
|
|
65
|
+
context: any;
|
|
66
|
+
refs: {
|
|
67
|
+
[key: string]: import("react").ReactInstance;
|
|
68
|
+
};
|
|
69
|
+
componentWillMount?(): void;
|
|
70
|
+
componentWillReceiveProps?(nextProps: Readonly<P & WithFocusableProps>, nextContext: any): void;
|
|
71
|
+
shouldComponentUpdate?(nextProps: Readonly<P & WithFocusableProps>, nextState: Readonly<WithFocusableState>, nextContext: any): boolean;
|
|
72
|
+
componentWillUpdate?(nextProps: Readonly<P & WithFocusableProps>, nextState: Readonly<WithFocusableState>, nextContext: any): void;
|
|
73
|
+
};
|
|
74
|
+
contextTypes: {
|
|
75
|
+
parentFocusKey: PropTypes.Requireable<string>;
|
|
76
|
+
};
|
|
77
|
+
childContextTypes: {
|
|
78
|
+
parentFocusKey: PropTypes.Requireable<string>;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
export default withFocusable;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Basic observable implementation for view models
|
|
3
|
+
*/
|
|
4
|
+
export declare class Observable<T> {
|
|
5
|
+
private listeners;
|
|
6
|
+
private _value;
|
|
7
|
+
constructor(initialValue: T);
|
|
8
|
+
get value(): T;
|
|
9
|
+
set value(newValue: T);
|
|
10
|
+
subscribe(listener: (value: T) => void): () => void;
|
|
11
|
+
private notify;
|
|
12
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type RemoteControlProps = {
|
|
3
|
+
onBackPressed?: (e: KeyboardEvent) => void;
|
|
4
|
+
onLeftPressed?: (e: KeyboardEvent) => void;
|
|
5
|
+
remoteControlActive?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const withRemoteControl: <P extends object>(WrappedComponent: React.ComponentType<P>) => {
|
|
8
|
+
new (props: P & RemoteControlProps): {
|
|
9
|
+
cleanup?: (() => void) | undefined;
|
|
10
|
+
componentDidUpdate(prevProps: Readonly<P & RemoteControlProps>): void;
|
|
11
|
+
componentDidMount(): void;
|
|
12
|
+
componentWillUnmount(): void;
|
|
13
|
+
handleKeyDown: (e: KeyboardEvent) => void;
|
|
14
|
+
render(): React.JSX.Element;
|
|
15
|
+
setState<K extends "active">(state: {
|
|
16
|
+
active: boolean;
|
|
17
|
+
} | ((prevState: Readonly<{
|
|
18
|
+
active: boolean;
|
|
19
|
+
}>, props: P & RemoteControlProps) => {
|
|
20
|
+
active: boolean;
|
|
21
|
+
} | Pick<{
|
|
22
|
+
active: boolean;
|
|
23
|
+
}, K>) | Pick<{
|
|
24
|
+
active: boolean;
|
|
25
|
+
}, K>, callback?: (() => any) | undefined): void;
|
|
26
|
+
forceUpdate(callBack?: (() => any) | undefined): void;
|
|
27
|
+
props: Readonly<{
|
|
28
|
+
children?: React.ReactNode;
|
|
29
|
+
}> & Readonly<P & RemoteControlProps>;
|
|
30
|
+
state: Readonly<{
|
|
31
|
+
active: boolean;
|
|
32
|
+
}>;
|
|
33
|
+
context: any;
|
|
34
|
+
refs: {
|
|
35
|
+
[key: string]: React.ReactInstance;
|
|
36
|
+
};
|
|
37
|
+
componentWillMount?(): void;
|
|
38
|
+
componentWillReceiveProps?(nextProps: Readonly<P & RemoteControlProps>, nextContext: any): void;
|
|
39
|
+
shouldComponentUpdate?(nextProps: Readonly<P & RemoteControlProps>, nextState: Readonly<{
|
|
40
|
+
active: boolean;
|
|
41
|
+
}>, nextContext: any): boolean;
|
|
42
|
+
componentWillUpdate?(nextProps: Readonly<P & RemoteControlProps>, nextState: Readonly<{
|
|
43
|
+
active: boolean;
|
|
44
|
+
}>, nextContext: any): void;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export default withRemoteControl;
|