@tantawowa/hosanna-ui 2.3.0 → 2.4.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 (66) hide show
  1. package/dist-manifest.json +69 -65
  2. package/package.json +1 -1
  3. package/src/hosanna-bridge-core/Promises.ts +1 -1
  4. package/src/hosanna-bridge-core/TimerService.ts +1 -1
  5. package/src/hosanna-bridge-core/decorators.ts +11 -3
  6. package/src/hosanna-bridge-lib/FocusManager.ts +1 -1
  7. package/src/hosanna-bridge-lib/PerfettoUtil.ts +1 -1
  8. package/src/hosanna-bridge-lib/SystemMessageManager.ts +1 -1
  9. package/src/hosanna-bridge-lib/TextToSpeechManager.ts +1 -1
  10. package/src/hosanna-bridge-lib/decorators.ts +1 -0
  11. package/src/hosanna-bridge-targets/common/device/AppPerformanceManager.ts +2 -2
  12. package/src/hosanna-bridge-targets/common/device/DeviceRegistry.ts +1 -1
  13. package/src/hosanna-bridge-targets/common/device/HosannaDevice.ts +3 -3
  14. package/src/hosanna-list/BaseCollectionViewLayout.ts +4 -4
  15. package/src/hosanna-list/BaseCollectionViewRow.ts +8 -0
  16. package/src/hosanna-list/CollectionView.ts +24 -7
  17. package/src/hosanna-list/CollectionViewAPI.ts +2 -0
  18. package/src/hosanna-list/CollectionViewDSLManager.ts +1 -1
  19. package/src/hosanna-list/CollectionViewDataSource.ts +2 -2
  20. package/src/hosanna-list/CollectionViewFocusManager.ts +1 -1
  21. package/src/hosanna-list/CustomViewRow.ts +2 -2
  22. package/src/hosanna-list/CustomViewRowLayout.ts +1 -1
  23. package/src/hosanna-list/DynamicCell.ts +16 -6
  24. package/src/hosanna-list/EPGProgramLayout.ts +2 -2
  25. package/src/hosanna-list/EPGView.ts +1 -1
  26. package/src/hosanna-list/GridRowLayout.ts +1 -1
  27. package/src/hosanna-list/HorizontalRow.ts +14 -1
  28. package/src/hosanna-list/HorizontalRowLayout.ts +38 -2
  29. package/src/hosanna-list/ListRowLayout.ts +1 -1
  30. package/src/hosanna-list/focusStrategies/HorizontalHybridFocusAnimationStrategy.ts +16 -2
  31. package/src/hosanna-ui/async/AbstractAsyncHandler.ts +2 -2
  32. package/src/hosanna-ui/async/AsyncCommandHandler.ts +1 -1
  33. package/src/hosanna-ui/async/AsyncManager.ts +2 -2
  34. package/src/hosanna-ui/async/AsyncTaskMessageLoop.ts +2 -2
  35. package/src/hosanna-ui/lib/BaseApp.ts +1 -9
  36. package/src/hosanna-ui/lib/FragmentFocusStyle.ts +151 -0
  37. package/src/hosanna-ui/lib/HosannaDeviceUpdateManager.ts +6 -6
  38. package/src/hosanna-ui/lib/MeasurementUtils.ts +2 -2
  39. package/src/hosanna-ui/lib/animation.ts +1 -1
  40. package/src/hosanna-ui/lib/debugger/RemoteDebugClient.ts +1 -1
  41. package/src/hosanna-ui/lib/images/ImageCacher.ts +1 -1
  42. package/src/hosanna-ui/lib/orientation/OrientationController.ts +1 -1
  43. package/src/hosanna-ui/lib/rive/RiveManager.ts +1 -1
  44. package/src/hosanna-ui/lib/test-utils.ts +44 -3
  45. package/src/hosanna-ui/targets/common/app/AppInitializer.ts +2 -0
  46. package/src/hosanna-ui/views/aggregate-views/AggregateViewTransition.ts +1 -1
  47. package/src/hosanna-ui/views/aggregate-views/FadeTransition.ts +1 -1
  48. package/src/hosanna-ui/views/aggregate-views/NavController.ts +4 -0
  49. package/src/hosanna-ui/views/controls/Button.ts +1 -1
  50. package/src/hosanna-ui/views/controls/FragmentView.ts +1 -1
  51. package/src/hosanna-ui/views/dialogs/DialogManager.ts +1 -1
  52. package/src/hosanna-ui/views/groups/Mask.ts +1 -1
  53. package/src/hosanna-ui/views/groups/SafeArea.ts +1 -1
  54. package/src/hosanna-ui/views/lib/AppConfig.ts +22 -0
  55. package/src/hosanna-ui/views/lib/BaseView.ts +7 -16
  56. package/src/hosanna-ui/views/lib/SharedVideoPlayerState.ts +1 -1
  57. package/src/hosanna-ui/views/lib/ViewBuilder.ts +1 -1
  58. package/src/hosanna-ui/views/lib/ViewFragmentProvider.ts +36 -13
  59. package/src/hosanna-ui/views/primitives/AnimatedPoster.ts +1 -1
  60. package/src/hosanna-ui/views/primitives/Label.ts +2 -2
  61. package/src/hosanna-ui/views/primitives/MultiStyleLabel.ts +1 -1
  62. package/src/hosanna-ui/views/primitives/RiveAnimation.ts +1 -1
  63. package/src/hosanna-ui/views/primitives/SimpleLabel.ts +2 -2
  64. package/src/hosanna-ui/views/primitives/VideoPlayer.ts +1 -1
  65. package/src/hosanna-ui/views/screens/SpringboardScreen.ts +1 -1
  66. package/src/hosanna-ui/views/toasts/ToastManager.ts +2 -2
@@ -238,12 +238,12 @@ export class HosannaDeviceCapabilities implements IHosannaDeviceCapabilities {
238
238
  }
239
239
 
240
240
  export class HosannaDeviceUpdateManager implements IHosannaDeviceUpdateManager {
241
- @inject() private hosannaDevice!: IHosannaDevice;
242
- @inject() private networkInfo!: IHosannaNetworkInfo;
243
- @inject() private deviceCapabilities!: IHosannaDeviceCapabilities;
244
- @inject() private sharedDeeplinkInfo!: SharedDeeplinkInfo;
245
- @inject() private textToSpeechManager!: TextToSpeechManager;
246
- @inject() private memoryPressureManager!: IHosannaMemoryPressureManager;
241
+ @inject({ eager: true }) private hosannaDevice!: IHosannaDevice;
242
+ @inject({ eager: true }) private networkInfo!: IHosannaNetworkInfo;
243
+ @inject({ eager: true }) private deviceCapabilities!: IHosannaDeviceCapabilities;
244
+ @inject({ eager: true }) private sharedDeeplinkInfo!: SharedDeeplinkInfo;
245
+ @inject({ eager: true }) private textToSpeechManager!: TextToSpeechManager;
246
+ @inject({ eager: true }) private memoryPressureManager!: IHosannaMemoryPressureManager;
247
247
  private recentMemoryPressureDeliveryIds: string[] = [];
248
248
 
249
249
  onSystemDeviceInfoEvent(event: ISystemEvent<ISystemDeviceInfoEventData>): HosannaDeviceInfoUpdateResult {
@@ -69,11 +69,11 @@ export class MeasurementUtils {
69
69
  /**
70
70
  * Font manager for retrieving fonts.
71
71
  */
72
- @inject() private fontManager!: IFontManager;
72
+ @inject({ eager: true }) private fontManager!: IFontManager;
73
73
  /**
74
74
  * Style registry for resolving font styles.
75
75
  */
76
- @inject() private appConfig!: IAppConfig;
76
+ @inject({ eager: true }) private appConfig!: IAppConfig;
77
77
  /**
78
78
  * Cache of label instances, keyed by font or style key.
79
79
  */
@@ -107,7 +107,7 @@ export class ViewJsonAnimator implements ITickable {
107
107
  id = `${hs_GetRandomUUID()}`;
108
108
 
109
109
  /** Timer service for scheduling animation ticks. */
110
- @inject() private timerService!: TimerService;
110
+ @inject({ eager: true }) private timerService!: TimerService;
111
111
  /**
112
112
  * Measures progress since start/resume. Updates target 60Hz on the app loop.
113
113
  */
@@ -404,7 +404,7 @@ export class RemoteDebugClient extends FocusDevRelayClientBase {
404
404
  /** Subscribers notified when the WebSocket opens (and immediately if already connected). */
405
405
  private connectionOpenListeners: Array<() => void> = [];
406
406
 
407
- @inject() protected focusManager!: IFocusManager;
407
+ @inject({ eager: true }) protected focusManager!: IFocusManager;
408
408
 
409
409
  /**
410
410
  * Constructs a new RemoteDebugClient.
@@ -25,7 +25,7 @@ interface InFlightDownload<TItem> {
25
25
  }
26
26
 
27
27
  export class ImageCacher {
28
- @inject() private fileManager!: FileManager;
28
+ @inject({ eager: true }) private fileManager!: FileManager;
29
29
 
30
30
  private inFlightByKey: Record<string, InFlightDownload<unknown>> = {};
31
31
  private inFlightToken = 0;
@@ -35,7 +35,7 @@ export class UnsupportedOrientationPlatformAdapter implements IOrientationPlatfo
35
35
  }
36
36
 
37
37
  export class OrientationController implements IOrientationController {
38
- @inject() private orientationPlatformAdapter!: IOrientationPlatformAdapter;
38
+ @inject({ eager: true }) private orientationPlatformAdapter!: IOrientationPlatformAdapter;
39
39
 
40
40
  private app?: IOrientationAppHost;
41
41
  private isStarted = false;
@@ -30,7 +30,7 @@ export function createDefaultRiveManagerDependencies(): RiveManagerDependencies
30
30
  * embedded file assets into CacheFS without transforming the animation.
31
31
  */
32
32
  export class RiveManager {
33
- @inject() private assetBundleManager!: AssetBundleManager;
33
+ @inject({ eager: true }) private assetBundleManager!: AssetBundleManager;
34
34
 
35
35
  private files: Record<string, PreparedRiveFile> = {};
36
36
 
@@ -85,7 +85,39 @@ export function prepareUITestEnv(globalAA: any, documentProps: any = {}) {
85
85
  };
86
86
  }
87
87
 
88
- // Ensure __hs_ioc exists and can resolve systemService
88
+ // Default stubs for BaseView's eagerly resolved base IoC services.
89
+ // Kept in a fallback map rather than __hs_container so test-supplied
90
+ // __hs_container entries and custom __hs_ioc.resolve implementations
91
+ // always take precedence.
92
+ const defaultBaseViewServices: Record<string, any> = {
93
+ nodePool: {
94
+ get: vi.fn(),
95
+ release: vi.fn(),
96
+ },
97
+ appConfig: {
98
+ get: vi.fn(),
99
+ getStyle: vi.fn(),
100
+ },
101
+ viewManager: {
102
+ registerView: vi.fn(),
103
+ unregisterView: vi.fn(),
104
+ registerControlWithError: vi.fn(),
105
+ },
106
+ viewBuilder: {
107
+ createView: vi.fn(),
108
+ },
109
+ focusManager: {
110
+ setFocus: vi.fn(),
111
+ requestFocus: vi.fn(),
112
+ clearFocus: vi.fn(),
113
+ },
114
+ instancePool: {
115
+ get: vi.fn(),
116
+ release: vi.fn(),
117
+ },
118
+ };
119
+
120
+ // Ensure __hs_ioc exists and can resolve systemService and base view services
89
121
  if (!globalAA.__hs_ioc) {
90
122
  globalAA.__hs_ioc = {
91
123
  resolve: vi.fn().mockImplementation((key: string) => {
@@ -97,11 +129,14 @@ export function prepareUITestEnv(globalAA: any, documentProps: any = {}) {
97
129
  if (key === 'systemService') {
98
130
  return globalAA.__hs_container.systemService;
99
131
  }
132
+ if (key in defaultBaseViewServices) {
133
+ return defaultBaseViewServices[key];
134
+ }
100
135
  return undefined;
101
136
  }),
102
137
  };
103
138
  } else if (typeof globalAA.__hs_ioc.resolve === 'function') {
104
- // Enhance existing resolve to ensure systemService fallbacks
139
+ // Enhance existing resolve to ensure systemService and base view fallbacks
105
140
  const originalResolve = globalAA.__hs_ioc.resolve;
106
141
  // Check if originalResolve is already a vi.fn() mock
107
142
  const isMock = typeof originalResolve.getMockImplementation === 'function';
@@ -118,16 +153,22 @@ export function prepareUITestEnv(globalAA: any, documentProps: any = {}) {
118
153
  if (key === 'systemService') {
119
154
  return globalAA.__hs_container.systemService;
120
155
  }
156
+ if (key in defaultBaseViewServices) {
157
+ return defaultBaseViewServices[key];
158
+ }
121
159
  throw e;
122
160
  }
123
161
  // Fallback: check container directly
124
162
  if (globalAA.__hs_container[key]) {
125
163
  return globalAA.__hs_container[key];
126
164
  }
127
- // Final fallback for systemService
165
+ // Final fallback for systemService and base view services
128
166
  if (key === 'systemService') {
129
167
  return globalAA.__hs_container.systemService;
130
168
  }
169
+ if (key in defaultBaseViewServices) {
170
+ return defaultBaseViewServices[key];
171
+ }
131
172
  return undefined;
132
173
  });
133
174
  };
@@ -48,6 +48,7 @@ import {
48
48
  SceneGraphFileTransferManager,
49
49
  } from '@hs-src/hosanna-bridge-lib/system-services';
50
50
  import { HosannaDeviceLayoutInfo } from '@hs-src/hosanna-bridge-targets/common/device/HosannaDeviceLayoutInfo';
51
+ import { DeviceRegistry } from '@hs-src/hosanna-bridge-targets/common/device/DeviceRegistry';
51
52
  import { UnsupportedBrowserHistoryManager } from '@hs-src/hosanna-bridge-lib/browser-history';
52
53
  import { HosannaMemoryPressureManager } from '@hs-src/hosanna-bridge-lib/memory-pressure';
53
54
 
@@ -83,6 +84,7 @@ export class BaseAppInitializer {
83
84
  { key: 'deviceCapabilities', clazz: HosannaDeviceCapabilities },
84
85
  { key: 'memoryPressureManager', clazz: HosannaMemoryPressureManager },
85
86
  { key: 'deviceUpdateManager', clazz: HosannaDeviceUpdateManager },
87
+ { key: 'deviceRegistry', clazz: DeviceRegistry },
86
88
  { key: 'hosannaDevice', clazz: RokuDevice },
87
89
  { key: 'platformStore', clazz: RokuPlatformStore },
88
90
  { key: 'remoteDebugClient', clazz: RemoteDebugClient },
@@ -56,7 +56,7 @@ export class AggregateViewTransition {
56
56
  */
57
57
  navDirection?: 'forward' | 'backward';
58
58
 
59
- @inject() protected focusManager!: IFocusManager;
59
+ @inject({ eager: true }) protected focusManager!: IFocusManager;
60
60
 
61
61
  private shouldNotifyTargetAdded: boolean | undefined;
62
62
 
@@ -31,7 +31,7 @@ export class FadeTransition extends AggregateViewTransition {
31
31
  private fadeRectangle?: ISGNRectangle;
32
32
 
33
33
  /** Node pool for rectangle allocation and release. */
34
- @inject() private nodePool!: INodePool;
34
+ @inject({ eager: true }) private nodePool!: INodePool;
35
35
 
36
36
  private fadeInterval?: ReturnType<typeof setInterval>;
37
37
  private fadeColor = '#000000'; // Default fade color
@@ -355,6 +355,10 @@ export class NavControllerView extends BaseAggregateViewView<NavControllerState>
355
355
  // later pop back is treated as reappear. Pop/replace: true — `clearNavStackTopSeenForView` already ran
356
356
  // for the removed top; do not re-mark the same source or pool reuse would lose first-appear.
357
357
  if (transition.removeSourceWhenComplete === false) {
358
+ // Keep the covered screen on the stack, outside the renderer that can be pooled on suspend.
359
+ if (transition.source && this.shouldRemoveFromAggregateView && transition.source._hid !== transition.target?._hid) {
360
+ this.removeChild(transition.source);
361
+ }
358
362
  this.updateNavStackTopSeenForView(transition.source);
359
363
  }
360
364
  // Callback for when the last view is removed from the stack.
@@ -114,7 +114,7 @@ export class ButtonView<T extends ButtonState = ButtonState, R extends ISGNGroup
114
114
  /** Horizontal alignment from style (e.g. "left", "center"). */
115
115
  @state horizontalAlignment?: SGHorizontalAlignment;
116
116
 
117
- @inject() private measurementUtils!: MeasurementUtils;
117
+ @inject({ eager: true }) private measurementUtils!: MeasurementUtils;
118
118
 
119
119
  /** Whether this is a composite view. */
120
120
  compositeView = false;
@@ -48,7 +48,7 @@ export class FragmentViewView extends BaseView<FragmentViewState> {
48
48
  /**
49
49
  * Injected provider for managing view fragments.
50
50
  */
51
- @inject() protected viewFragmentProvider!: IViewFragmentProvider;
51
+ @inject({ eager: true }) protected viewFragmentProvider!: IViewFragmentProvider;
52
52
 
53
53
  /**
54
54
  * The current view fragment associated with this view.
@@ -47,7 +47,7 @@ interface PendingDialog {
47
47
  */
48
48
  @view('DialogManager')
49
49
  export class DialogManagerView<T extends DialogManagerState = DialogManagerState, R extends ISGNGroup = ISGNGroup> extends BaseView<T, R> {
50
- @inject() private deviceLayout!: IHosannaDeviceLayoutInfo;
50
+ @inject({ eager: true }) private deviceLayout!: IHosannaDeviceLayoutInfo;
51
51
 
52
52
  private pendingDialogs: PendingDialog[] = [];
53
53
  private pendingDialogFlushScheduled = false;
@@ -62,7 +62,7 @@ export class MaskView<T extends MaskState = MaskState, R extends ISGNMaskGroup =
62
62
  /** Indicates this is not a composite view. */
63
63
  compositeView = false;
64
64
  /** The Hosanna device instance, used for device-specific properties. */
65
- @inject() hosannaDevice!: IHosannaDevice;
65
+ @inject({ eager: true }) hosannaDevice!: IHosannaDevice;
66
66
  /** The mask scale factor based on the device's resolution. */
67
67
  private maskScale = this.hosannaDevice.resolutionInfo.scale;
68
68
  /** The platform type, used for specific rendering logic. */
@@ -46,7 +46,7 @@ export const ALL_SAFE_AREA_EDGES: SafeAreaEdge[] = [
46
46
  */
47
47
  @aggregateView('SafeArea')
48
48
  export class SafeAreaView extends BaseView<SafeAreaState> {
49
- @inject('hosannaDevice') private safeAreaDevice!: IHosannaDevice;
49
+ @inject('hosannaDevice', { eager: true }) private safeAreaDevice!: IHosannaDevice;
50
50
 
51
51
  @state edges: SafeAreaEdge[] = [...ALL_SAFE_AREA_EDGES];
52
52
  @state insetType = SafeAreaInsetType.Interaction;
@@ -1,3 +1,4 @@
1
+ import type { FragmentFocusStyleTracks } from '../../lib/FragmentFocusStyle';
1
2
  import { IHosannaDevice } from '@hs-src/hosanna-bridge-core/api';
2
3
  import { AppUtils } from '@hs-src/hosanna-bridge-core/AppUtils';
3
4
  import { IResolutionInfo } from '@hs-src/hosanna-bridge-core/device-api';
@@ -144,6 +145,8 @@ export interface IViewFragment {
144
145
  focusPercent?: number;
145
146
  /** CollectionView-owned row focus from 0 to 1; present only for an opted-in cell or header fragment. */
146
147
  rowFocusPercent?: number;
148
+ /** Compiled presentation fields for an opted-in fragment. */
149
+ focusStyleTracks?: FragmentFocusStyleTracks;
147
150
  dataMap: IViewFragmentDataMap;
148
151
  /** Shared from the provider's resolved-style cache; avoids rebuilding the data/fn binding-id set per fragment and bind. */
149
152
  dataMapBindingViewIds?: string[];
@@ -170,6 +173,14 @@ export interface IViewFragment {
170
173
  hsShapesUnresolved?: boolean;
171
174
  /** Style/locale revision at which this pooled fragment's SG tree was created. */
172
175
  styleLayoutRevision?: number;
176
+ /** Resolved configuration used to build this fragment's nodes and tracks. */
177
+ resolvedStyleGeneration?: number;
178
+ }
179
+
180
+ export function isFragmentStyleStale(fragment: IViewFragment, config: IAppConfig): boolean {
181
+ if (fragment.styleLayoutRevision !== undefined && fragment.styleLayoutRevision !== config.getStyleLayoutRevision()) return true;
182
+ return fragment.resolvedStyleGeneration !== undefined
183
+ && fragment.resolvedStyleGeneration !== config.getResolvedStyleGeneration(fragment.styleKey);
173
184
  }
174
185
 
175
186
  export interface IFragmentChildViewStyle {
@@ -180,6 +191,11 @@ export interface IFragmentChildViewStyle {
180
191
  * The `IFragmentStyle` interface represents a style for a view fragment.
181
192
  * This is how the style is stored in the style registry.
182
193
  */
194
+ export interface IFragmentFocusAnimation {
195
+ progress: 'focusPercent' | 'rowFocusPercent';
196
+ properties: Record<string, string[]>;
197
+ }
198
+
183
199
  export interface IFragmentStyle {
184
200
  isResolutionApplied?: boolean;
185
201
  $supportsDataMap?: boolean;
@@ -188,9 +204,15 @@ export interface IFragmentStyle {
188
204
  base: IFragmentChildViewStyle[];
189
205
  normal: IFragmentChildViewStyle;
190
206
  focused?: IFragmentChildViewStyle;
207
+ focusFootprint?: IFragmentChildViewStyle;
208
+ interacted?: IFragmentChildViewStyle;
191
209
  disabled?: IFragmentChildViewStyle;
210
+ error?: IFragmentChildViewStyle;
192
211
  selected?: IFragmentChildViewStyle;
212
+ focusSelected?: IFragmentChildViewStyle;
193
213
  };
214
+ /** Interpolate named child fields between the existing status styles using CollectionView progress. */
215
+ animated?: IFragmentFocusAnimation | IFragmentFocusAnimation[];
194
216
  dataMap?: IViewFragmentDataMap;
195
217
  callbacks?: IViewFragmentCallbackNameMap;
196
218
  }
@@ -1,7 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-unsafe-function-type */
2
2
  import type { IFocusable, IFocusManager, INextFocusResolutionEvent, HsInputEvent } from '@hs-src/hosanna-bridge-lib/IFocusManager';
3
3
  import { Direction, HsCancellationToken } from '@hs-src/hosanna-bridge-core/api';
4
- import { inject } from '@hs-src/hosanna-bridge-core/decorators';
5
4
  import { IIdentifiable, I2DRectangle } from '@hs-src/hosanna-bridge-core/brs-api';
6
5
  import { ISGNNode, ISGNGroup } from '@hs-src/hosanna-bridge-targets/common/sg-api';
7
6
  import { HsObservable, IAudioGuideItem, IInstancePool, ViewStatus } from '../../hosanna-api';
@@ -168,18 +167,12 @@ export class BaseView<T extends ViewState, R extends ISGNGroup = ISGNGroup> impl
168
167
  _cacheKey = '';
169
168
 
170
169
  // private nodePool: INodePool = new NodePool();
171
- // hs:exclude-from-platform roku
172
- @inject() nodePool!: INodePool;
173
- // hs:exclude-from-platform roku
174
- @inject() appConfig!: IAppConfig;
175
- // hs:exclude-from-platform roku
176
- @inject() protected viewManager!: IViewManager;
177
- // hs:exclude-from-platform roku
178
- @inject() protected viewBuilder!: ViewBuilder;
179
- // hs:exclude-from-platform roku
180
- @inject() protected focusManager!: IFocusManager;
181
- // hs:exclude-from-platform roku
182
- @inject() instancePool!: IInstancePool;
170
+ nodePool!: INodePool;
171
+ appConfig!: IAppConfig;
172
+ protected viewManager!: IViewManager;
173
+ protected viewBuilder!: ViewBuilder;
174
+ protected focusManager!: IFocusManager;
175
+ instancePool!: IInstancePool;
183
176
 
184
177
  private _renderer: R | undefined;
185
178
  protected state: T = {} as T;
@@ -425,9 +418,7 @@ export class BaseView<T extends ViewState, R extends ISGNGroup = ISGNGroup> impl
425
418
  // hs:exclude-from-platform roku
426
419
  this._hid = `${getUniqueViewId()}`;
427
420
  if (!this.shouldDeferViewInitialization()) {
428
- if (__ROKU__) {
429
- this.assignBaseIOCServices();
430
- }
421
+ this.assignBaseIOCServices();
431
422
  this.initializeViewNotifications();
432
423
  }
433
424
  }
@@ -110,7 +110,7 @@ export class SharedVideoPlayerState extends HsObservable {
110
110
  @observableField castAvailable: boolean = false;
111
111
  @observableField castActive: boolean = false;
112
112
 
113
- @inject() developerUtils!: IDeveloperUtils;
113
+ @inject({ eager: true }) developerUtils!: IDeveloperUtils;
114
114
 
115
115
  rokuContentNode?: ISGNContentNode;
116
116
 
@@ -9,7 +9,7 @@ import { inject } from '@hs-src/hosanna-bridge-core/decorators';
9
9
  * It uses an `InstancePool` to manage reusable instances of views.
10
10
  */
11
11
  export class ViewBuilder {
12
- @inject() instancePool!: InstancePool;
12
+ @inject({ eager: true }) instancePool!: InstancePool;
13
13
 
14
14
  constructor() {
15
15
  console.info('Created ViewBuilder');
@@ -1,3 +1,4 @@
1
+ import { applyFragmentFocusStyle, applyFragmentItemFocusStyle, applyFragmentRowFocusStyle, compileFragmentFocusStyle, statusOverridesFragmentFocusStyle } from '../../lib/FragmentFocusStyle';
1
2
  import { applyEffectStyle } from '../../lib/EffectStyle';
2
3
  import { IHosannaDevice } from '@hs-src/hosanna-bridge-core/api';
3
4
  import { inject } from '@hs-src/hosanna-bridge-core/decorators';
@@ -7,7 +8,7 @@ import { ISGNGroup, ISGNScene, ISGNNode, ISGNPoster } from '@hs-src/hosanna-brid
7
8
  import { IBaseCollectionViewRow } from '@hs-src/hosanna-list/CollectionViewAPI';
8
9
  import { JsonData } from '../../async/AsyncApi';
9
10
  import { ViewStatus } from '../../hosanna-api';
10
- import { IFragmentStyle, IStyleDictionary, IViewFragment, IViewFragmentDataMap, AppConfig, ViewFragmentCallbackHandler, ViewFragmentCallbackType, ISpecificViewFragmentCallbackHandler, IParsedFunctionMapping, FragmentCallbackEntry, SpecificFragmentCallbackEntry, ViewFragmentFocusPercentCallbackHandler, FocusPercentFragmentCallbackEntry } from './AppConfig';
11
+ import { IFragmentStyle, isFragmentStyleStale, IViewFragment, IViewFragmentDataMap, AppConfig, ViewFragmentCallbackHandler, ViewFragmentCallbackType, ISpecificViewFragmentCallbackHandler, IParsedFunctionMapping, FragmentCallbackEntry, SpecificFragmentCallbackEntry, ViewFragmentFocusPercentCallbackHandler, FocusPercentFragmentCallbackEntry } from './AppConfig';
11
12
  import { findNode, mapChildrenById } from './utils';
12
13
  import { SystemMessageLevel } from '@hs-src/hosanna-bridge-lib/ISystemMessageManager';
13
14
  import { isComputedReference, substituteComputedReferences } from '@hs-src/hosanna-ui/lib/FragmentComputed';
@@ -166,12 +167,12 @@ export class ViewFragmentProvider implements IViewFragmentProvider {
166
167
  } = {};
167
168
 
168
169
  /** Style registry for resolving fragment styles. */
169
- @inject() private appConfig!: AppConfig;
170
+ @inject({ eager: true }) private appConfig!: AppConfig;
170
171
 
171
172
  /** Font manager for resolving fonts in fragments. */
172
- @inject() private fontManager!: FontManager;
173
+ @inject({ eager: true }) private fontManager!: FontManager;
173
174
 
174
- @inject() hosannaDevice!: IHosannaDevice;
175
+ @inject({ eager: true }) hosannaDevice!: IHosannaDevice;
175
176
 
176
177
  /** Internal fragment ID counter for unique IDs. */
177
178
  private fragmentId = 0;
@@ -407,10 +408,7 @@ export class ViewFragmentProvider implements IViewFragmentProvider {
407
408
  }
408
409
 
409
410
  private shouldDiscardStalePooledFragment(styleKey: string, fragment: IViewFragment): boolean {
410
- if (
411
- fragment.styleLayoutRevision !== undefined
412
- && fragment.styleLayoutRevision !== this.appConfig.getStyleLayoutRevision()
413
- ) {
411
+ if (isFragmentStyleStale(fragment, this.appConfig)) {
414
412
  return true;
415
413
  }
416
414
  return this.shouldDiscardStalePooledShapeFragment(styleKey, fragment);
@@ -534,6 +532,7 @@ export class ViewFragmentProvider implements IViewFragmentProvider {
534
532
  refreshEffectStyles: Object.keys(effectStyleKeysById).length ? refreshEffectStyles : undefined,
535
533
  applyEffectStyle: undefined as IViewFragment['applyEffectStyle'],
536
534
  styleLayoutRevision: this.appConfig.getStyleLayoutRevision(),
535
+ resolvedStyleGeneration: resolvedStyleGeneration > 0 ? resolvedStyleGeneration : undefined,
537
536
  // Records whether this instance's SG nodes were realized before its
538
537
  // hs_shape styles compiled, so a later acquire can discard + rebuild it.
539
538
  hsShapesUnresolved: (styleJson as unknown as JsonData).hsShapesUnresolved === true,
@@ -583,6 +582,21 @@ export class ViewFragmentProvider implements IViewFragmentProvider {
583
582
  }
584
583
  }
585
584
 
585
+ if (styleJson.animated) {
586
+ const tracks = compileFragmentFocusStyle(styleJson, viewsById);
587
+ if (tracks.all.length > 0) {
588
+ const focusFragment = fragment as unknown as IViewFragment;
589
+ focusFragment.focusStyleTracks = tracks;
590
+ if (tracks.focusPercent.length > 0) {
591
+ fragment.callbacks.onFocusPercentChanged = [applyFragmentItemFocusStyle, ...(fragment.callbacks.onFocusPercentChanged ?? [])];
592
+ }
593
+ if (tracks.rowFocusPercent.length > 0) {
594
+ fragment.callbacks.onRowFocusPercentChanged = [applyFragmentRowFocusStyle, ...(fragment.callbacks.onRowFocusPercentChanged ?? [])];
595
+ }
596
+ applyFragmentFocusStyle(focusFragment, 0);
597
+ }
598
+ }
599
+
586
600
  //create datamap if required
587
601
  if (fragment.dataMap) {
588
602
 
@@ -727,13 +741,16 @@ export class ViewFragmentProvider implements IViewFragmentProvider {
727
741
  if (__SCROLL_JANK_TELEMETRY__) {
728
742
  availableBefore = this.availableFragmentsavailableFragmentsById[fragment.styleKey]?.length ?? 0;
729
743
  }
730
- if (
731
- fragment.styleLayoutRevision !== undefined
732
- && fragment.styleLayoutRevision !== this.appConfig.getStyleLayoutRevision()
733
- ) {
744
+ if (isFragmentStyleStale(fragment, this.appConfig)) {
734
745
  this.discardFragment(fragment);
735
746
  return;
736
747
  }
748
+ if (fragment.focusStyleTracks) {
749
+ fragment.focusPercent = undefined;
750
+ fragment.rowFocusPercent = undefined;
751
+ if (fragment.viewStatus === ViewStatus.Normal) applyFragmentFocusStyle(fragment, 0);
752
+ else this.applyViewStatus(fragment, ViewStatus.Normal);
753
+ }
737
754
  fragment.lastAppliedLayoutCacheKey = undefined;
738
755
  this.unregisterFragmentInUse(fragment);
739
756
  const fragmentCachce = this.availableFragmentsavailableFragmentsById[fragment.styleKey];
@@ -1117,7 +1134,12 @@ export class ViewFragmentProvider implements IViewFragmentProvider {
1117
1134
  * @param status The view status.
1118
1135
  */
1119
1136
  public applyViewStatus(viewFragment: IViewFragment, status: ViewStatus) {
1120
- const statusStyle = this.appConfig.get<IStyleDictionary>(`${viewFragment.styleKey}.views.${status}`);
1137
+ const style = this.appConfig.get<IFragmentStyle>(viewFragment.styleKey);
1138
+ const statusStyle = status === ViewStatus.None ? undefined : style?.views?.[status];
1139
+ const overridesProgress = viewFragment.focusStyleTracks !== undefined && statusOverridesFragmentFocusStyle(status);
1140
+ if (overridesProgress) {
1141
+ applyFragmentFocusStyle(viewFragment, 0, ViewStatus.Normal);
1142
+ }
1121
1143
  viewFragment.viewStatus = status;
1122
1144
  if (statusStyle) {
1123
1145
  for (const key in statusStyle) {
@@ -1147,6 +1169,7 @@ export class ViewFragmentProvider implements IViewFragmentProvider {
1147
1169
  }
1148
1170
  }
1149
1171
  }
1172
+ if (viewFragment.focusStyleTracks && !overridesProgress) applyFragmentFocusStyle(viewFragment);
1150
1173
  viewFragment.refreshEffectStyles?.();
1151
1174
  }
1152
1175
 
@@ -21,7 +21,7 @@ export class AnimatedPosterView<T extends AnimatedPosterState = AnimatedPosterSt
21
21
  extends BaseView<T, ISGNGroup>
22
22
  implements ITickable
23
23
  {
24
- @inject() private timerService!: TimerService;
24
+ @inject({ eager: true }) private timerService!: TimerService;
25
25
 
26
26
  @state spriteSheetUri = '';
27
27
  @state frameOffsets: AnimatedPosterFrameOffset[] = [];
@@ -60,13 +60,13 @@ export class LabelView<T extends LabelState = LabelState, R extends ISGNLabel =
60
60
  /** Whether to use monospaced digits. monospacedDigits = true works only for system default fonts */
61
61
  @state monospacedDigits = false;
62
62
  /** Utility for measuring text size. */
63
- @inject() private measurementUtils!: MeasurementUtils;
63
+ @inject({ eager: true }) private measurementUtils!: MeasurementUtils;
64
64
 
65
65
  /** The currently active font key or style. */
66
66
  private activeFontKey: IStyle = '';
67
67
 
68
68
  /** Font manager for resolving fonts. */
69
- @inject() fontManager!: IFontManager;
69
+ @inject({ eager: true }) fontManager!: IFontManager;
70
70
  /** The currently active font object. */
71
71
  activeFont?: ISGNFont;
72
72
  /** Whether the label can receive focus. */
@@ -16,7 +16,7 @@ export class MultiStyleLabelView<T extends MultiStyleLabelState = MultiStyleLabe
16
16
  @state drawingStyles: Record<string, unknown> = {};
17
17
  @state plainText = '';
18
18
 
19
- @inject('measurementUtils') private richTextMeasurementUtils!: MeasurementUtils;
19
+ @inject('measurementUtils', { eager: true }) private richTextMeasurementUtils!: MeasurementUtils;
20
20
 
21
21
  protected override createRenderer(): R {
22
22
  return this.reserveRenderer('MultiStyleLabel') as R;
@@ -18,7 +18,7 @@ export class RiveAnimationView<T extends RiveAnimationState = RiveAnimationState
18
18
  extends BaseView<T, ISGNGroup>
19
19
  implements ITickable
20
20
  {
21
- @inject() private timerService!: TimerService;
21
+ @inject({ eager: true }) private timerService!: TimerService;
22
22
 
23
23
  @state file?: PreparedRiveFile;
24
24
  @state animationName = '';
@@ -33,8 +33,8 @@ export class SimpleLabelView<T extends SimpleLabelState = SimpleLabelState, R ex
33
33
  /** Font key in `uri,size` form or system font name (same as Label). */
34
34
  @state fontKey = '';
35
35
 
36
- @inject() private measurementUtils!: MeasurementUtils;
37
- @inject() fontManager!: IFontManager;
36
+ @inject({ eager: true }) private measurementUtils!: MeasurementUtils;
37
+ @inject({ eager: true }) fontManager!: IFontManager;
38
38
 
39
39
  private activeFontKey: IStyle = '';
40
40
  private activeFont?: ISGNFont;
@@ -118,7 +118,7 @@ export class VideoPlayerView<T extends VideoPlayerState = VideoPlayerState, R ex
118
118
  /** Callback for cast kind changes. */
119
119
  @state onCastKindChange?: (kind: 'airplay' | 'chromecast' | 'none') => void;
120
120
  /** Thumbnail manager for video preview tiles. */
121
- @inject() thumbnailManager!: ThumbnailManager;
121
+ @inject({ eager: true }) thumbnailManager!: ThumbnailManager;
122
122
 
123
123
  private seekTo: number | undefined = undefined;
124
124
  private lastRenderedContentUrl: string | undefined = undefined;
@@ -77,7 +77,7 @@ export class SpringboardScreenView<T extends SpringboardScreenState = Springboar
77
77
  @state private lastVisitedScreens: string[] = [];
78
78
  @state private version: number = 1;
79
79
 
80
- @inject() protected deviceLayout!: IHosannaDeviceLayoutInfo;
80
+ @inject({ eager: true }) protected deviceLayout!: IHosannaDeviceLayoutInfo;
81
81
 
82
82
  private registry = AppUtils.resolve<IDeviceRegistry>('deviceRegistry');
83
83
  private didAutoOpen = false;
@@ -84,8 +84,8 @@ const DEFAULT_REPOSITION_DURATION_MS = 200;
84
84
  */
85
85
  @view('ToastManager')
86
86
  export class ToastManagerView<T extends ToastManagerState = ToastManagerState, R extends ISGNGroup = ISGNGroup> extends BaseView<T, R> {
87
- @inject() private timerService!: TimerService;
88
- @inject() private deviceLayout!: IHosannaDeviceLayoutInfo;
87
+ @inject({ eager: true }) private timerService!: TimerService;
88
+ @inject({ eager: true }) private deviceLayout!: IHosannaDeviceLayoutInfo;
89
89
 
90
90
  canReceiveFocus = false;
91
91