@24i/bigscreen-sdk 1.0.0 → 1.0.1-alpha.2074
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/package.json +12 -11
- package/packages/developer-tools/src/EnvironmentSelection/styles/EnvironmentSelection.scss +1 -1
- package/packages/device/src/driver/index.vidaa.tv.ts +1 -0
- package/packages/device/src/resolver/resolver.ts +5 -0
- package/packages/driver-vidaa/src/DeviceVidaa.ts +134 -0
- package/packages/driver-vidaa/src/__mocks__/vidaa.ts +20 -0
- package/packages/driver-vidaa/src/formatUserAgent.ts +16 -0
- package/packages/driver-vidaa/src/index.ts +1 -0
- package/packages/driver-vidaa/src/keymap.ts +54 -0
- package/packages/driver-vidaa/src/types.ts +82 -0
- package/packages/grid/src/Base/Base.tsx +25 -6
- package/packages/grid/src/Base/MouseNavigation/MouseNavigation.tsx +58 -0
- package/packages/grid/src/Base/MouseNavigation/MouseNavigationFallback.ts +4 -0
- package/packages/grid/src/Base/MouseNavigation/index.tizen.tv.ts +1 -0
- package/packages/grid/src/Base/MouseNavigation/index.ts +1 -0
- package/packages/grid/src/Base/MouseNavigation/index.webos.tv.ts +1 -0
- package/packages/grid/src/Base/MouseNavigation/index.webtv.ts +1 -0
- package/packages/grid/src/Base/interface.ts +47 -0
- package/packages/grid/src/UnifiedGridController/UnifiedGridController.ts +4 -1
- package/packages/list/src/Base/Base.tsx +16 -5
- package/packages/list/src/Base/MouseNavigation/MouseNavigation.tsx +58 -0
- package/packages/list/src/Base/MouseNavigation/MouseNavigationFallback.ts +4 -0
- package/packages/list/src/Base/MouseNavigation/index.tizen.tv.ts +1 -0
- package/packages/list/src/Base/MouseNavigation/index.ts +1 -0
- package/packages/list/src/Base/MouseNavigation/index.webos.tv.ts +1 -0
- package/packages/list/src/Base/MouseNavigation/index.webtv.ts +1 -0
- package/packages/list/src/Base/interface.ts +39 -0
- package/packages/list/src/BasicList/BasicList.tsx +4 -1
- package/packages/list/src/EdgeOffsetList/EdgeOffsetList.tsx +4 -3
- package/packages/list/src/FirstOnlyList/FirstOnlyList.tsx +2 -2
- package/packages/list/src/FirstOnlyVariedList/FirstOnlyVariedList.tsx +2 -2
- package/packages/list/src/FixedToEndList/FixedToEndList.tsx +2 -2
- package/packages/list/src/interface.ts +2 -0
- package/packages/logger/README.md +1 -1
- package/packages/menu/src/MenuAndContentContainer/MenuAndContentContainer.tsx +3 -1
- package/packages/menu/src/MenuAndContentContainer/interface.ts +1 -1
- package/packages/mouse-navigation/src/MouseNavigation.tsx +2 -2
- package/packages/scroll-text/src/Base.tsx +5 -0
- package/utils/create-export-maps/src/__tests__/createExportMaps.spec.ts +2 -2
- package/utils/create-export-maps/src/createExportMaps.ts +1 -1
- package/packages/focus/src/__test__/candidate.spec.tsx +0 -245
- package/packages/focus/src/__test__/focusFirstExisting.spec.tsx +0 -21
- package/packages/focus/src/__test__/refocusAfterHashChange.spec.tsx +0 -41
- package/packages/focus/src/__test__/safeFocus.spec.tsx +0 -41
- package/packages/grid/src/Base/Base.mouse.tsx +0 -24
- package/packages/grid/src/Base/index.tizen.tv.ts +0 -1
- package/packages/grid/src/Base/index.webos.tv.ts +0 -1
- package/packages/grid/src/Base/index.webtv.ts +0 -1
- package/packages/list/src/Base/Base.mouse.tsx +0 -28
- package/packages/list/src/Base/index.tizen.tv.ts +0 -1
- package/packages/list/src/Base/index.webos.tv.ts +0 -1
- package/packages/list/src/Base/index.webtv.ts +0 -1
- package/packages/mouse-navigation/src/__test__/MouseElementWrapper.spec.tsx +0 -61
- package/packages/mouse-navigation/src/__test__/MouseNavigation.spec.tsx +0 -107
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { createRef } from '@24i/bigscreen-sdk/jsx';
|
|
2
|
-
import { shallow } from '@24i/bigscreen-sdk/jsx/test-utils';
|
|
3
|
-
import { safeFocus } from '../safeFocus';
|
|
4
|
-
|
|
5
|
-
describe('safeFocus', () => {
|
|
6
|
-
const wrapperElement = createRef<HTMLDivElement>();
|
|
7
|
-
const element1 = createRef<HTMLDivElement>();
|
|
8
|
-
const element2 = createRef<HTMLDivElement>();
|
|
9
|
-
const testSafeFocus = safeFocus(wrapperElement);
|
|
10
|
-
|
|
11
|
-
shallow(
|
|
12
|
-
<div>
|
|
13
|
-
<div ref={wrapperElement} tabIndex={0}>
|
|
14
|
-
<div ref={element1} tabIndex={0} />
|
|
15
|
-
</div>
|
|
16
|
-
<div ref={element2} tabIndex={0} />
|
|
17
|
-
</div>,
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
it('should focus element when activeElement is inside of the wrapperElement', () => {
|
|
21
|
-
wrapperElement.current!.focus();
|
|
22
|
-
testSafeFocus(element1.current!);
|
|
23
|
-
expect(document.activeElement === element1.current!).toBeTruthy();
|
|
24
|
-
testSafeFocus(wrapperElement.current!);
|
|
25
|
-
expect(document.activeElement === wrapperElement.current!).toBeTruthy();
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('should focus element when activeElement is body', () => {
|
|
29
|
-
document.body.focus();
|
|
30
|
-
testSafeFocus(element1.current!);
|
|
31
|
-
expect(document.activeElement === element1.current!).toBeTruthy();
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('should not focus element when activeElement is outside of the wrapperElement', () => {
|
|
35
|
-
element2.current!.focus();
|
|
36
|
-
testSafeFocus(element1.current!);
|
|
37
|
-
expect(document.activeElement === element1.current!).toBeFalsy();
|
|
38
|
-
testSafeFocus(wrapperElement.current!);
|
|
39
|
-
expect(document.activeElement === wrapperElement.current!).toBeFalsy();
|
|
40
|
-
});
|
|
41
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { createRef, forwardRef, Reference } from '@24i/bigscreen-sdk/jsx';
|
|
2
|
-
import { MouseNavigation } from '@24i/bigscreen-sdk/mouse-navigation';
|
|
3
|
-
import { GridBase as Base, Props as GridProps } from './Base';
|
|
4
|
-
import { Item } from '../types';
|
|
5
|
-
|
|
6
|
-
export const GridBase = forwardRef(<T extends Item<U>, U>(props: GridProps<T, U>,
|
|
7
|
-
gridRef: Reference<Base<T, U>>,
|
|
8
|
-
) => {
|
|
9
|
-
const direction = props.horizontal ? 'horizontal' : 'vertical';
|
|
10
|
-
const mrcuRef = createRef<MouseNavigation>();
|
|
11
|
-
return (
|
|
12
|
-
<MouseNavigation
|
|
13
|
-
ref={mrcuRef}
|
|
14
|
-
getMountingPoint={() => gridRef.current!.scroller.current!.wrapRef}
|
|
15
|
-
direction={direction}
|
|
16
|
-
forward={props.mrcuForward || props.forwardGroup}
|
|
17
|
-
backward={props.mrcuBackward || props.backwardGroup}
|
|
18
|
-
shouldShowMrcuForward={props.shouldShowMrcuForward}
|
|
19
|
-
shouldShowMrcuBackward={props.shouldShowMrcuBackward}
|
|
20
|
-
>
|
|
21
|
-
<Base {...props} ref={gridRef} mrcuRef={mrcuRef} />
|
|
22
|
-
</MouseNavigation>
|
|
23
|
-
);
|
|
24
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { GridBase } from './Base.mouse';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { GridBase } from './Base.mouse';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { GridBase } from './Base.mouse';
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { createRef, forwardRef, Reference } from '@24i/bigscreen-sdk/jsx';
|
|
2
|
-
import { MouseNavigation } from '@24i/bigscreen-sdk/mouse-navigation';
|
|
3
|
-
import { ListBase as Base, Props as ListProps } from './Base';
|
|
4
|
-
import { Item } from '../types';
|
|
5
|
-
|
|
6
|
-
export const ListBase = forwardRef(<T extends Item<U>, U>(props: ListProps<T, U>,
|
|
7
|
-
listRef: Reference<Base<T, U>>,
|
|
8
|
-
) => {
|
|
9
|
-
const direction = props.horizontal ? 'horizontal' : 'vertical';
|
|
10
|
-
const mrcuRef = createRef<MouseNavigation>();
|
|
11
|
-
return (
|
|
12
|
-
<MouseNavigation
|
|
13
|
-
getMountingPoint={() => listRef.current!.scroller.current!.wrapRef}
|
|
14
|
-
direction={direction}
|
|
15
|
-
forward={props.mrcuForward || props.forward}
|
|
16
|
-
backward={props.mrcuBackward || props.backward}
|
|
17
|
-
shouldShowMrcuForward={props.shouldShowMrcuForward}
|
|
18
|
-
shouldShowMrcuBackward={props.shouldShowMrcuBackward}
|
|
19
|
-
ref={mrcuRef}
|
|
20
|
-
>
|
|
21
|
-
<Base
|
|
22
|
-
{...props}
|
|
23
|
-
mrcuRef={mrcuRef}
|
|
24
|
-
ref={listRef}
|
|
25
|
-
/>
|
|
26
|
-
</MouseNavigation>
|
|
27
|
-
);
|
|
28
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ListBase } from './Base.mouse';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ListBase } from './Base.mouse';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ListBase } from './Base.mouse';
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { createRef } from '@24i/bigscreen-sdk/jsx';
|
|
2
|
-
import { getKeyMap } from '@24i/bigscreen-sdk/device';
|
|
3
|
-
import { MountedComponent, shallow, keydown } from '@24i/bigscreen-sdk/jsx/test-utils';
|
|
4
|
-
import { MouseElementWrapper } from '../MouseElementWrapper';
|
|
5
|
-
import { MouseNavigationInterface } from '../MouseNavigationInterface';
|
|
6
|
-
|
|
7
|
-
describe('MouseElementWrapper', () => {
|
|
8
|
-
const mPointRef = createRef<HTMLDivElement>();
|
|
9
|
-
let root: MountedComponent<HTMLDivElement>;
|
|
10
|
-
let nav: MountedComponent<MouseElementWrapper>;
|
|
11
|
-
|
|
12
|
-
beforeEach(() => {
|
|
13
|
-
jest.clearAllMocks();
|
|
14
|
-
root = shallow(<div className="mounting-point" ref={mPointRef} />);
|
|
15
|
-
nav = shallow(
|
|
16
|
-
<>
|
|
17
|
-
<MouseElementWrapper
|
|
18
|
-
getMountingPoint={() => mPointRef}
|
|
19
|
-
>
|
|
20
|
-
<div className="test-child" />
|
|
21
|
-
</MouseElementWrapper>
|
|
22
|
-
</>,
|
|
23
|
-
);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
afterEach(() => {
|
|
27
|
-
nav.unmount();
|
|
28
|
-
root.unmount();
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('should not render child immediately', () => {
|
|
32
|
-
expect(root.find('.test-child')).toBe(null);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('should handle key event correctly', () => {
|
|
36
|
-
|
|
37
|
-
const event = new MouseEvent('mousemove', {});
|
|
38
|
-
document.dispatchEvent(event);
|
|
39
|
-
|
|
40
|
-
expect(root.find('.mounting-point').firstElementChild)
|
|
41
|
-
.toBe(nav.ref().domRef.current);
|
|
42
|
-
|
|
43
|
-
keydown(document, getKeyMap().UP!);
|
|
44
|
-
expect(root.find('.mounting-point').firstElementChild).toBe(null);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('should handle interface request to hide', () => {
|
|
48
|
-
const event = new MouseEvent('mousemove', {});
|
|
49
|
-
document.dispatchEvent(event);
|
|
50
|
-
|
|
51
|
-
expect(root.find('.mounting-point').firstElementChild)
|
|
52
|
-
.toBe(nav.ref().domRef.current);
|
|
53
|
-
|
|
54
|
-
MouseNavigationInterface.hide();
|
|
55
|
-
expect(root.find('.mounting-point').firstElementChild).toBe(null);
|
|
56
|
-
|
|
57
|
-
MouseNavigationInterface.show();
|
|
58
|
-
expect(root.find('.mounting-point').firstElementChild)
|
|
59
|
-
.toBe(nav.ref().domRef.current);
|
|
60
|
-
});
|
|
61
|
-
});
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { createRef } from '@24i/bigscreen-sdk/jsx';
|
|
2
|
-
import { getKeyMap } from '@24i/bigscreen-sdk/device';
|
|
3
|
-
import { MountedComponent, shallow, keydown } from '@24i/bigscreen-sdk/jsx/test-utils';
|
|
4
|
-
import { MouseNavigation } from '../MouseNavigation';
|
|
5
|
-
import { MouseNavigationInterface } from '../MouseNavigationInterface';
|
|
6
|
-
|
|
7
|
-
const forwardMock = jest.fn();
|
|
8
|
-
const backwardMock = jest.fn();
|
|
9
|
-
const showForwardMock = jest.fn(() => true);
|
|
10
|
-
const showBackwardMock = jest.fn(() => true);
|
|
11
|
-
|
|
12
|
-
describe('MouseNavigation', () => {
|
|
13
|
-
const mPointRef = createRef<HTMLDivElement>();
|
|
14
|
-
let nav: MountedComponent<MouseNavigation>;
|
|
15
|
-
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
nav = shallow(
|
|
18
|
-
<MouseNavigation
|
|
19
|
-
getMountingPoint={() => mPointRef}
|
|
20
|
-
direction="vertical"
|
|
21
|
-
forward={forwardMock}
|
|
22
|
-
backward={backwardMock}
|
|
23
|
-
shouldShowMrcuForward={showForwardMock}
|
|
24
|
-
shouldShowMrcuBackward={showBackwardMock}
|
|
25
|
-
>
|
|
26
|
-
<>
|
|
27
|
-
<div className="test-child" />
|
|
28
|
-
<div className="mounting-point" ref={mPointRef} />
|
|
29
|
-
</>
|
|
30
|
-
</MouseNavigation>,
|
|
31
|
-
);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
afterEach(() => {
|
|
35
|
-
nav.unmount();
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it('should handle key event correctly', () => {
|
|
39
|
-
|
|
40
|
-
const event = new MouseEvent('mousemove', {});
|
|
41
|
-
document.dispatchEvent(event);
|
|
42
|
-
|
|
43
|
-
expect(nav.find('.mounting-point').firstElementChild)
|
|
44
|
-
.toBe(nav.ref().arrows.current?.domRef.current);
|
|
45
|
-
|
|
46
|
-
keydown(document, getKeyMap().UP!);
|
|
47
|
-
|
|
48
|
-
expect(nav.find('.mounting-point').firstElementChild).toBe(null);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('should render child', () => {
|
|
52
|
-
expect(nav.find('.test-child').className).not.toBe(null);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('should return correct mapped direction', () => {
|
|
56
|
-
expect(nav.ref().mapDirectionToProps('horizontal').horizontal).toBe(true);
|
|
57
|
-
expect(nav.ref().mapDirectionToProps('vertical').vertical).toBe(true);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('should handle interface request to hide', () => {
|
|
61
|
-
const event = new MouseEvent('mousemove', {});
|
|
62
|
-
document.dispatchEvent(event);
|
|
63
|
-
|
|
64
|
-
expect(nav.find('.mounting-point').firstElementChild)
|
|
65
|
-
.toBe(nav.ref().arrows.current?.domRef.current);
|
|
66
|
-
|
|
67
|
-
MouseNavigationInterface.hide();
|
|
68
|
-
|
|
69
|
-
expect(nav.find('.mounting-point').firstElementChild).toBe(null);
|
|
70
|
-
|
|
71
|
-
MouseNavigationInterface.show();
|
|
72
|
-
|
|
73
|
-
expect(nav.find('.mounting-point').firstElementChild)
|
|
74
|
-
.toBe(nav.ref().arrows.current?.domRef.current);
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it('should propagate forward and backward', () => {
|
|
78
|
-
nav.ref().handleArrowState = jest.fn();
|
|
79
|
-
nav.ref().forward();
|
|
80
|
-
nav.ref().backward();
|
|
81
|
-
|
|
82
|
-
expect(forwardMock).toHaveBeenCalledTimes(1);
|
|
83
|
-
expect(backwardMock).toHaveBeenCalledTimes(1);
|
|
84
|
-
expect(nav.ref().handleArrowState).toHaveBeenCalledTimes(2);
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it('should show/hide arrows as reported', () => {
|
|
88
|
-
nav.ref().arrows = {
|
|
89
|
-
current: {
|
|
90
|
-
enableArrow: jest.fn(),
|
|
91
|
-
disableArrow: jest.fn(),
|
|
92
|
-
},
|
|
93
|
-
} as any;
|
|
94
|
-
|
|
95
|
-
nav.ref().handleArrowState();
|
|
96
|
-
expect(nav.ref().arrows.current?.enableArrow).toHaveBeenNthCalledWith(1, 'down');
|
|
97
|
-
expect(nav.ref().arrows.current?.enableArrow).toHaveBeenNthCalledWith(2, 'up');
|
|
98
|
-
expect(nav.ref().arrows.current?.enableArrow).toHaveBeenCalledTimes(2);
|
|
99
|
-
|
|
100
|
-
showForwardMock.mockImplementationOnce(() => false);
|
|
101
|
-
showBackwardMock.mockImplementationOnce(() => false);
|
|
102
|
-
nav.ref().handleArrowState();
|
|
103
|
-
expect(nav.ref().arrows.current?.disableArrow).toHaveBeenNthCalledWith(1, 'down');
|
|
104
|
-
expect(nav.ref().arrows.current?.disableArrow).toHaveBeenNthCalledWith(2, 'up');
|
|
105
|
-
expect(nav.ref().arrows.current?.disableArrow).toHaveBeenCalledTimes(2);
|
|
106
|
-
});
|
|
107
|
-
});
|