@24i/bigscreen-sdk 1.0.2-alpha.2089 → 1.0.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@24i/bigscreen-sdk",
3
- "version": "1.0.2-alpha.2089",
3
+ "version": "1.0.2",
4
4
  "description": "SmartApps BIGscreen SDK monorepo",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -140,7 +140,6 @@
140
140
  display: inline-block;
141
141
  vertical-align: top;
142
142
  width: $value-width;
143
- word-break: break-word;
144
143
  }
145
144
  }
146
145
  }
@@ -4,7 +4,6 @@ import {
4
4
  ScreenSaverStatus,
5
5
  VolumeRange,
6
6
  } from '@24i/bigscreen-sdk/driver-base';
7
- import { NetworkConnectionTypeMap } from './constants';
8
7
  import { getPlatformInfo } from './formatUserAgent';
9
8
  import { HisenseVidaaApi } from './types';
10
9
  import { getKeyMap } from './keymap';
@@ -119,12 +118,7 @@ export class DeviceVidaa extends DeviceBase {
119
118
  }
120
119
 
121
120
  async getConnectionType(): Promise<ConnectionType> {
122
- try {
123
- const netType = window.Hisense_GetNetType();
124
- return NetworkConnectionTypeMap[netType] || 'unknown';
125
- } catch (e) {
126
- console.error('[DeviceVidaa] Failed getConnectionType', e);
127
- }
121
+ // not supported on Hisense VIDAA platform
128
122
  return 'unknown';
129
123
  }
130
124
 
@@ -6,7 +6,6 @@ export const mockHisenseVidaaApi: HisenseVidaaApi = {
6
6
  Hisense_GetFirmWareVersion: () => 'V0000.01.00Q.L0301',
7
7
  Hisense_Get4KSupportState: () => true,
8
8
  Hisense_GetDeviceID: () => '861003009000001000000641123456789012',
9
- Hisense_GetNetType: () => 'wireless',
10
9
  };
11
10
 
12
11
  // Key constants are set to random number values
@@ -1,5 +1,3 @@
1
- export type HisenseNetType = 'OFF' | 'wired' | 'wireless';
2
-
3
1
  export interface HisenseVidaaApi {
4
2
  /**
5
3
  * This interface will retrieve Hisense Unique ID for the device.
@@ -29,12 +27,6 @@ export interface HisenseVidaaApi {
29
27
  * @return a string that represents the TV model name.
30
28
  */
31
29
  Hisense_GetModelName: () => string,
32
- /**
33
- * This interface retrieves the network type of the device.
34
- * @return a string that represents the network type for the device.
35
- * The one from "OFF", "wired", "wireless".
36
- */
37
- Hisense_GetNetType: () => HisenseNetType,
38
30
  }
39
31
 
40
32
  export type HisenseVidaaKeys = {
@@ -524,7 +524,6 @@ export class UnifiedGridController<T> implements IUnifiedGridController<T> {
524
524
  forEach(this.groups, (group, index) => {
525
525
  this.updateItemsInGroup(group, index * itemsInGroup);
526
526
  });
527
- base.mrcuRef.current?.handleArrowState();
528
527
  }
529
528
 
530
529
  prependData(data: T[]) {
@@ -550,6 +549,5 @@ export class UnifiedGridController<T> implements IUnifiedGridController<T> {
550
549
  this.scrollIndexToPixels(this.scrollIndex),
551
550
  );
552
551
  this.focusCurrentItem();
553
- base.mrcuRef.current?.handleArrowState();
554
552
  }
555
553
  }
@@ -49,8 +49,6 @@ export class ListBase<T extends Item<U>, U>
49
49
 
50
50
  mrcuRef = createRef<IMouseNavigation>();
51
51
 
52
- // mrcuRef2: Reference<HTMLDivElement>;
53
-
54
52
  itemRefs: Reference<T>[] = [];
55
53
 
56
54
  index = 0;
@@ -346,7 +344,7 @@ export class ListBase<T extends Item<U>, U>
346
344
  }
347
345
 
348
346
  render() {
349
- const { horizontal, className, mrcuMountingPoint } = this.props;
347
+ const { horizontal, className } = this.props;
350
348
  return (
351
349
  <Scroller
352
350
  className={className}
@@ -359,7 +357,7 @@ export class ListBase<T extends Item<U>, U>
359
357
  <MouseNavigation
360
358
  // @ts-ignore - needed to convert fallback (false) to interface
361
359
  ref={this.mrcuRef}
362
- getMountingPoint={() => mrcuMountingPoint || this.scroller.current!.wrapRef}
360
+ getMountingPoint={() => this.scroller.current!.wrapRef}
363
361
  {...this.props}
364
362
  />
365
363
  </Scroller>
@@ -1,4 +1,4 @@
1
- import { Component, createRef, DeclareProps, Reference } from '@24i/bigscreen-sdk/jsx';
1
+ import { Component, createRef, DeclareProps } from '@24i/bigscreen-sdk/jsx';
2
2
  import { IFocusable } from '@24i/bigscreen-sdk/focus';
3
3
  import { noop } from '@24i/bigscreen-sdk/utils/noop';
4
4
  import { ListBase } from '../Base';
@@ -29,8 +29,6 @@ export class EdgeOffsetList<T extends Item<U>, U>
29
29
  */
30
30
  base = createRef<ListBase<T, U>>();
31
31
 
32
- //mrcuRef = createRef<HTMLDivElement>();
33
-
34
32
  /**
35
33
  * Unified controller for leveraging common behaviour
36
34
  */
@@ -1,6 +1,5 @@
1
1
  import { Reference, Component } from '@24i/bigscreen-sdk/jsx';
2
2
  import { EasingType } from '@24i/bigscreen-sdk/animations';
3
- import { HtmlAttributes } from 'csstype';
4
3
 
5
4
  export interface Item<T> extends Component<any> {
6
5
  focus: (options?: FocusOptions) => void,
@@ -67,11 +66,6 @@ export type BasicProps<T extends Item<U>, U> = {
67
66
  */
68
67
  fastFocusingOptimization?: boolean,
69
68
 
70
- /**
71
- * Returns a reference to the custom HTML div for the mrcu arrows.
72
- */
73
- mrcuMountingPoint?: Reference<HTMLDivElement>,
74
-
75
69
  /**
76
70
  * Function called every time before list performs one full scroll.
77
71
  * @param item Reference to item on current scroll
@@ -1,7 +1,6 @@
1
1
  import { Component, createRef } from '@24i/bigscreen-sdk/jsx';
2
2
  import { device } from '@24i/bigscreen-sdk/device';
3
3
  import { stopEvent } from '@24i/bigscreen-sdk/utils/stopEvent';
4
- import { getDisplayToggler, DISPLAY_NONE } from '@24i/bigscreen-sdk/utils/displayToggler';
5
4
  import { service } from './service';
6
5
  import {
7
6
  Props,
@@ -26,16 +25,6 @@ export class MenuAndContentContainer<T extends string = string>
26
25
  */
27
26
  listensToMouse = false;
28
27
 
29
- /**
30
- * Element for triggering menu by mouse event.
31
- */
32
- mouseTriggerElement = createRef<HTMLDivElement>();
33
-
34
- /**
35
- * DisplayToggler for {@link mouseTriggerElement}.
36
- */
37
- mouseTriggerElementDisplayToggler = getDisplayToggler(this.mouseTriggerElement, true);
38
-
39
28
  /**
40
29
  * Adds event listeners:
41
30
  * - keydown to {@link Props.elementForEvents elementForEvents}
@@ -69,12 +58,10 @@ export class MenuAndContentContainer<T extends string = string>
69
58
  onVisibilityChange = (visible: boolean) => {
70
59
  if (visible) {
71
60
  this.menu.current!.focus();
72
- if (this.listensToMouse) this.mouseTriggerElementDisplayToggler.hide();
73
61
  service.triggerEvent('visibilitychange', true);
74
62
  } else {
75
63
  const { router: { current: router } } = this.props;
76
64
  router!.focus();
77
- if (this.listensToMouse) this.mouseTriggerElementDisplayToggler.show();
78
65
  service.triggerEvent('visibilitychange', false);
79
66
  }
80
67
  };
@@ -101,10 +88,14 @@ export class MenuAndContentContainer<T extends string = string>
101
88
  * @param event mouse event
102
89
  */
103
90
  onMouseMove = (event: MouseEvent) => {
91
+ const { Menu } = this.props;
104
92
  const menu = this.menu.current!;
105
93
  if (this.isMenuAvailable() && !menu.isOpen()) {
106
- menu.open();
107
- stopEvent(event);
94
+ const { clientX, clientY } = event;
95
+ if (Menu.shouldOpenMenuWithMouse({ clientX, clientY })) {
96
+ menu.open();
97
+ stopEvent(event);
98
+ }
108
99
  }
109
100
  };
110
101
 
@@ -136,8 +127,8 @@ export class MenuAndContentContainer<T extends string = string>
136
127
  addMouseListener() {
137
128
  if (!this.listensToMouse) {
138
129
  this.listensToMouse = true;
139
- if (!this.menu.current!.isOpen()) this.mouseTriggerElementDisplayToggler.show();
140
- this.mouseTriggerElement.current!.addEventListener('mousemove', this.onMouseMove);
130
+ const { elementForEvents } = this.props;
131
+ elementForEvents.current!.addEventListener('mousemove', this.onMouseMove);
141
132
  }
142
133
  }
143
134
 
@@ -147,8 +138,8 @@ export class MenuAndContentContainer<T extends string = string>
147
138
  removeMouseListener() {
148
139
  if (this.listensToMouse) {
149
140
  this.listensToMouse = false;
150
- if (!this.menu.current!.isOpen()) this.mouseTriggerElementDisplayToggler.hide();
151
- this.mouseTriggerElement.current!.removeEventListener('mousemove', this.onMouseMove);
141
+ const { elementForEvents } = this.props;
142
+ elementForEvents.current!.removeEventListener('mousemove', this.onMouseMove);
152
143
  }
153
144
  }
154
145
 
@@ -164,18 +155,12 @@ export class MenuAndContentContainer<T extends string = string>
164
155
  const { children, items, Menu } = this.props;
165
156
  return (
166
157
  <>
167
- <div className="menu-container">
168
- <Menu
169
- ref={this.menu}
170
- items={items}
171
- onVisibilityChange={this.onVisibilityChange}
172
- contentContainer={this}
173
- />
174
- <div
175
- ref={this.mouseTriggerElement}
176
- className={`menu-mouse-trigger ${DISPLAY_NONE}`}
177
- />
178
- </div>
158
+ <Menu
159
+ ref={this.menu}
160
+ items={items}
161
+ onVisibilityChange={this.onVisibilityChange}
162
+ contentContainer={this}
163
+ />
179
164
  {children}
180
165
  </>
181
166
  );
@@ -119,6 +119,13 @@ export interface Menu<
119
119
  updateItems(items: MenuItem<T>[]): void,
120
120
  }
121
121
 
122
+ /**
123
+ * Function for deciding whether to open menu based on mouse position.
124
+ */
125
+ type MouseMenuOpenResolver = (
126
+ ({ clientX, clientY }: { clientX: number, clientY: number }) => boolean
127
+ );
128
+
122
129
  /**
123
130
  * Function for deciding whether to open menu based on pressed key.
124
131
  */
@@ -138,6 +145,7 @@ type KeyboardMenuCloseResolver = (
138
145
  */
139
146
  export interface MenuComponent<T extends string = string, P extends MenuProps<T> = MenuProps<T>> {
140
147
  new (props: P): Menu<T, P>,
148
+ shouldOpenMenuWithMouse: MouseMenuOpenResolver,
141
149
  shouldOpenMenu: KeyboardMenuOpenResolver,
142
150
  shouldCloseMenu: KeyboardMenuCloseResolver,
143
151
  }
@@ -1,4 +1,4 @@
1
- .menu-container .side-menu {
1
+ .menu-container {
2
2
  position: absolute;
3
3
  top: 0;
4
4
  left: 0;
@@ -220,7 +220,7 @@ export class SideMenu extends Component<Props> implements ISideMenu {
220
220
  render() {
221
221
  const { items } = this.props;
222
222
  return (
223
- <div ref={this.visualController.div} className={`side-menu ${DISPLAY_NONE}`}>
223
+ <div ref={this.visualController.div} className={`menu-container ${DISPLAY_NONE}`}>
224
224
  <div
225
225
  ref={this.visualController.overlay}
226
226
  className={`overlay ${animated ? DISPLAY_NONE : ''}`}
@@ -2,7 +2,7 @@
2
2
  @import '@24i/bigscreen-sdk/sass-utils/transition';
3
3
  @import '@24i/bigscreen-sdk/sass-utils/prefix-property';
4
4
 
5
- .menu-container .side-menu {
5
+ .menu-container {
6
6
  @include transform(translate3d(0, 0, 0));
7
7
  @include transition(prefix-property(transform), 300ms);
8
8
 
@@ -1,6 +1,6 @@
1
1
  @import '@24i/bigscreen-sdk/sass-utils/transform';
2
2
 
3
- [dir=rtl] .menu-container .side-menu {
3
+ [dir=rtl] .menu-container {
4
4
  left: auto;
5
5
  right: 0;
6
6
 
@@ -94,22 +94,6 @@ export class MouseNavigation extends Component<Props> {
94
94
  }
95
95
  };
96
96
 
97
- onWheel = (event: WheelEvent) => {
98
- const { forward, backward, direction } = this.props;
99
- const { horizontal } = this.mapDirectionToProps(direction);
100
- if (horizontal) return;
101
- if (event.deltaY > 0) forward();
102
- else if (event.deltaY < 0) backward();
103
- };
104
-
105
- addWheelListner() {
106
- this.arrows.current?.domRef.current?.addEventListener('wheel', this.onWheel);
107
- }
108
-
109
- removeWheelListner() {
110
- this.arrows.current?.domRef.current?.removeEventListener('wheel', this.onWheel);
111
- }
112
-
113
97
  isActive() {
114
98
  return this.navigationState === 'active';
115
99
  }
@@ -128,7 +112,6 @@ export class MouseNavigation extends Component<Props> {
128
112
  getMountingPoint(),
129
113
  );
130
114
  this.handleArrowState();
131
- this.addWheelListner();
132
115
  this.navigationState = 'active';
133
116
  };
134
117
 
@@ -146,7 +129,6 @@ export class MouseNavigation extends Component<Props> {
146
129
  destroyArrows() {
147
130
  if (this.navigationState === 'inactive') return;
148
131
  this.navigationState = 'inactive';
149
- this.removeWheelListner();
150
132
  removeNode(this.arrows.current!.domRef);
151
133
  }
152
134
 
@@ -189,7 +189,11 @@ export class PlayerUI extends Component<Props>
189
189
  }
190
190
 
191
191
  canHideAutomatically() {
192
- return !this.isHidingDisabled;
192
+ return (
193
+ this.isPlaying()
194
+ && !this.seeking.isSeeking()
195
+ && !this.isHidingDisabled
196
+ );
193
197
  }
194
198
 
195
199
  isPlaying() {
@@ -1,8 +0,0 @@
1
- /**
2
- * Mapping connection type from Hisense VIDAA to SDK connection type.
3
- */
4
- export const NetworkConnectionTypeMap = {
5
- wired: 'cable',
6
- wireless: 'wifi',
7
- OFF: 'none',
8
- } as const;