@tantawowa/hosanna-ui 2.0.3 → 2.1.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/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Hosanna UI
2
2
 
3
- Source SDK for native Roku and the Roku browser emulator.
3
+ Source SDK for Roku applications. The browser runtime emulates Roku for
4
+ development and testing.
4
5
 
5
6
  Install the framework and tools in your application, then connect the SDK:
6
7
 
@@ -17,8 +18,14 @@ Generated application files stay in the application's `src-generated` directory.
17
18
  Application tests can import `src/hosanna-ui/lib/test-utils.ts` from the installed
18
19
  SDK. This test helper requires Vitest in the application and is not a runtime import.
19
20
 
20
- The proprietary TypeScript-to-BrightScript compiler is installed separately and
21
- requires its existing Hosanna compiler license. It is not included in this SDK.
21
+ The TypeScript-to-BrightScript compiler is separate from this SDK. Install the
22
+ published native executable with
23
+ `npm install --save-dev --save-exact @tantawowa/hsc@1.54.1`. It uses the bundled
24
+ Hosanna Compiler Binary License and requires no license key. The compiler is
25
+ proprietary and closed source.
26
+ With Tools 5.1.1 or later, HST resolves the compiler from `package.json` and the
27
+ lockfile. Remove legacy `transpiler-version` pins after declaring the npm package;
28
+ see [compiler migration](https://github.com/TantaWowa/hosanna-ui/blob/main/docs/npm-migration.md#existing-application).
22
29
 
23
30
  The device chrome under `public/device-chrome/v1` is for development previews.
24
31
  It must not be copied into an application's public directory or production output.
@@ -2,8 +2,8 @@
2
2
  "schemaVersion": 2,
3
3
  "artifact": "npm-sdk",
4
4
  "packageName": "@tantawowa/hosanna-ui",
5
- "version": "2.0.3",
6
- "sourceCommit": "ed9d9afbfe2df5dcf5e71b5e1e34235c954684f9",
5
+ "version": "2.1.0",
6
+ "sourceCommit": "08f3b524c1d66291f8c4d634185eb8bba335a3dc",
7
7
  "files": [
8
8
  {
9
9
  "path": "LICENSE",
@@ -13,10 +13,6 @@
13
13
  "path": "hosanna-consumer-dependencies.json",
14
14
  "sha256": "d2c606fa9a5050596c44906c2d15380363175fc51c0152cdb28f958bd596cd65"
15
15
  },
16
- {
17
- "path": "hosanna.json",
18
- "sha256": "83d69a1a6119ba43946244d58fca0bfb93cdddf38f36af95aaa98f64707c16a7"
19
- },
20
16
  {
21
17
  "path": "platforms/roku/DebugTools/TrackerTask.xml",
22
18
  "sha256": "fb11ec867eddec69591316a531e403b76aae30cefab35d6e20080086a8abff3e"
@@ -363,7 +359,7 @@
363
359
  },
364
360
  {
365
361
  "path": "src/hosanna-bridge-targets/web/brs/WebRoBitmap.ts",
366
- "sha256": "465b317a6fc80018a504e9f6da4c7c982128f64d2d5d8376c40c11d513b0dcf3"
362
+ "sha256": "b4be6ac206646f3cab6d8170b6115ec844577fb3a621fbf81b3dc3b1ad9b8b20"
367
363
  },
368
364
  {
369
365
  "path": "src/hosanna-bridge-targets/web/brs/WebRoByteArray.ts",
@@ -891,7 +887,7 @@
891
887
  },
892
888
  {
893
889
  "path": "src/hosanna-bridge-targets/web/sg/WebSGPoster.ts",
894
- "sha256": "023b91e4fb3fb3d0201b34b726fcb3c931159e0657ed4ec21ef8d6db60658a48"
890
+ "sha256": "8690f7310f0f3ee124530ec016f82a252aa408da403b514566b2ddfdd2f893e1"
895
891
  },
896
892
  {
897
893
  "path": "src/hosanna-bridge-targets/web/sg/WebSGRectangle.ts",
@@ -1847,7 +1843,7 @@
1847
1843
  },
1848
1844
  {
1849
1845
  "path": "src/hosanna-ui/app-roku/HosannaApp.xml",
1850
- "sha256": "5ccf7bc1726b61ffad7a063ed1ecf76216d25e33bed47aad6cb46a2d22d999eb"
1846
+ "sha256": "027475b9fe1446b65f6961e690d150f3be988cac26be6578bf5cbc770cf5098f"
1851
1847
  },
1852
1848
  {
1853
1849
  "path": "src/hosanna-ui/app-roku/HosannaMainThreadScene.xml",
@@ -1903,7 +1899,7 @@
1903
1899
  },
1904
1900
  {
1905
1901
  "path": "src/hosanna-ui/async/ImageGeneratorCommands.ts",
1906
- "sha256": "1ccad5f53256eea09dee46e9261afb38de1bba9701cacaf9d341d719ccfc74dc"
1902
+ "sha256": "2bb5bef67aaafcb6877d3a43b790490d418659c8ca2e4db48b7cbeb25d58f7e6"
1907
1903
  },
1908
1904
  {
1909
1905
  "path": "src/hosanna-ui/async/LivePlaylistCommands.ts",
@@ -1947,7 +1943,7 @@
1947
1943
  },
1948
1944
  {
1949
1945
  "path": "src/hosanna-ui/lib/BaseApp.ts",
1950
- "sha256": "2d8f750e4d2ede4addae1464c22f2420e1415c3e4d6d5662c14bc60b70727d74"
1946
+ "sha256": "b300ace1436dcfc41f7bb15e2d9ec5ebbf85f5c594e2967742311279a5968e2f"
1951
1947
  },
1952
1948
  {
1953
1949
  "path": "src/hosanna-ui/lib/BuildConfigRuntimePath.ts",
@@ -1955,7 +1951,7 @@
1955
1951
  },
1956
1952
  {
1957
1953
  "path": "src/hosanna-ui/lib/ConfigurationLoader.ts",
1958
- "sha256": "bf4f92b3fe8f1c786e919ece015b1f37eec73685445c78895aa5f06702a67335"
1954
+ "sha256": "be039919478eeb7eba4d686637731855c693676c18c517ff6700a9610029e643"
1959
1955
  },
1960
1956
  {
1961
1957
  "path": "src/hosanna-ui/lib/ConfigurationValidator.ts",
@@ -2347,7 +2343,7 @@
2347
2343
  },
2348
2344
  {
2349
2345
  "path": "src/hosanna-ui/lib/shapes/ShapeLoader.ts",
2350
- "sha256": "deead76ba28c00b1d8dc238be79a5527e6f514b3b47561c4641ab5ff569ab2e2"
2346
+ "sha256": "2ccc633a272f9efdacb5e7e52a7c5d7b2bf4db2d7131a9900542f68b8143146f"
2351
2347
  },
2352
2348
  {
2353
2349
  "path": "src/hosanna-ui/lib/shapes/ShapeMaskResolver.ts",
@@ -2635,7 +2631,7 @@
2635
2631
  },
2636
2632
  {
2637
2633
  "path": "src/hosanna-ui/views/lib/BaseView.ts",
2638
- "sha256": "fc014923ab461492c2dc8f364c286821c8b212b2bb9766ba676cf71ae87dfc23"
2634
+ "sha256": "b3ceb393e817c371610c26b0e54c1d886dafd637828f5c31fa51f6781fd78cf1"
2639
2635
  },
2640
2636
  {
2641
2637
  "path": "src/hosanna-ui/views/lib/BuildConfig.ts",
@@ -2651,7 +2647,7 @@
2651
2647
  },
2652
2648
  {
2653
2649
  "path": "src/hosanna-ui/views/lib/SharedVideoPlayerState.ts",
2654
- "sha256": "d83d243de936951164f67b52f835594da958551f7dc8eb25788d9c41d5ae0b1d"
2650
+ "sha256": "ee93df71339a89fe8a45e10f3d24a6454990667c676c32263c5eeb9435fc17ae"
2655
2651
  },
2656
2652
  {
2657
2653
  "path": "src/hosanna-ui/views/lib/ViewBuilder.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tantawowa/hosanna-ui",
3
- "version": "2.0.3",
3
+ "version": "2.1.0",
4
4
  "description": "Hosanna UI source SDK for Roku and its browser emulator",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -1,6 +1,7 @@
1
1
  import { WebDraw2D, WebDrawableSource } from './draw2d/WebDraw2D';
2
2
  import { WebBrsComponent } from './WebBrsComponent';
3
3
  import { WebRoFont } from './WebRoFont';
4
+ import { WebRoByteArray } from './WebRoByteArray';
4
5
 
5
6
  interface BitmapSize {
6
7
  width: number;
@@ -66,6 +67,19 @@ export class WebRoBitmap extends WebBrsComponent {
66
67
  return this.height;
67
68
  }
68
69
 
70
+ GetPng(x: number, y: number, width: number, height: number): WebRoByteArray {
71
+ const canvas = document.createElement('canvas');
72
+ canvas.width = width;
73
+ canvas.height = height;
74
+ const context = canvas.getContext('2d');
75
+ if (!context) {
76
+ throw new Error('WebRoBitmap.GetPng requires a 2D canvas context');
77
+ }
78
+ context.drawImage(this.canvas, x, y, width, height, 0, 0, width, height);
79
+ const encoded = canvas.toDataURL('image/png').split(',')[1];
80
+ return new WebRoByteArray(Uint8Array.from(atob(encoded), character => character.charCodeAt(0)));
81
+ }
82
+
69
83
  getCanvas(): CanvasImageSource {
70
84
  return this.canvas;
71
85
  }
@@ -285,7 +285,7 @@ export class WebSGPoster extends WebSGGroup implements ISGNPoster {
285
285
 
286
286
  // Detect if content-related fields changed since last render
287
287
  const resolvedUri = resolveImageUri(this.uri);
288
- const ninePatch = isNinePatch(resolvedUri);
288
+ const ninePatch = isNinePatch(this.uri) || isNinePatch(resolvedUri);
289
289
  const contentChanged = this._contentDirty ||
290
290
  resolvedUri !== this._lastRenderedUri ||
291
291
  this.blendColor !== this._lastRenderedBlendColor ||
@@ -12,6 +12,7 @@
12
12
  <!-- Hosanna script imports for the UI -->
13
13
  <!-- HOSANNA_SCRIPT_IMPORTS -->
14
14
  <children>
15
-
15
+ <!-- Cover the initial scene until BaseApp establishes its black background. -->
16
+ <Rectangle id="hs_startupBackdrop" width="1920" height="1080" color="0x000000FF" />
16
17
  </children>
17
18
  </component>
@@ -90,16 +90,6 @@ export class ImageGeneratorCommands extends AbstractAsyncHandler {
90
90
  }
91
91
 
92
92
  private ensureShapePatch(request: ShapePatchRequest): ImageGeneratorShapePatchResult {
93
- if (!__ROKU__) {
94
- return {
95
- uri: request.uri,
96
- cacheKey: request.cacheKey,
97
- cacheHit: true,
98
- generated: false,
99
- success: true,
100
- };
101
- }
102
-
103
93
  const fs = CreateObject<ISGROFileSystem>('roFileSystem');
104
94
  try {
105
95
  this.ensureDirectory(fs, this.getDirectoryPath(request.uri));
@@ -133,16 +123,6 @@ export class ImageGeneratorCommands extends AbstractAsyncHandler {
133
123
  }
134
124
 
135
125
  private ensureShapeMask(request: ShapeMaskRequest): ImageGeneratorShapePatchResult {
136
- if (!__ROKU__) {
137
- return {
138
- uri: request.uri,
139
- cacheKey: request.cacheKey,
140
- cacheHit: true,
141
- generated: false,
142
- success: true,
143
- };
144
- }
145
-
146
126
  const fs = CreateObject<ISGROFileSystem>('roFileSystem');
147
127
  try {
148
128
  this.ensureDirectory(fs, this.getDirectoryPath(request.uri));
@@ -584,6 +584,15 @@ export class BaseApp extends BaseView<ViewState> implements IObserver {
584
584
  private prepareScene() {
585
585
  this.scene.id = 'mainScene';
586
586
  this.scene.backgroundColor = '#000000';
587
+ if (__ROKU__) {
588
+ // The XML backdrop covers frames before begin(). Hide it only after the
589
+ // scene background is black so it cannot cover the runtime app views.
590
+ // eslint-disable-next-line @hosanna-eslint/no-find-node-method
591
+ const startupBackdrop = this.scene.findNode('hs_startupBackdrop') as ISGNRectangle | undefined;
592
+ if (startupBackdrop) {
593
+ startupBackdrop.visible = false;
594
+ }
595
+ }
587
596
  this.renderer = this.scene;
588
597
  GetGlobalAA().scene = this.scene;
589
598
  // Cache the global node (shared across threads on Roku) so post-process and other async callbacks can access it
@@ -1986,8 +1995,6 @@ export class BaseApp extends BaseView<ViewState> implements IObserver {
1986
1995
  * `theme.compiledShapes`, so shapes must be reloaded). Fragments created
1987
1996
  * before a reload must be recreated to pick up new shape styles.
1988
1997
  *
1989
- * On Roku this waits for the imageGenerator task to pre-render each shape
1990
- * to a nine-patch image; on other platforms it resolves immediately.
1991
1998
  */
1992
1999
  loadShapes(): HsPromise<void> {
1993
2000
  return loadShapesForAppConfig(this.appConfig);
@@ -2033,10 +2040,8 @@ export class BaseApp extends BaseView<ViewState> implements IObserver {
2033
2040
  console.warn('[BaseApp] ⚠️ No valid "tasks" config found in build config, using default: { default: 1 }');
2034
2041
  }
2035
2042
 
2036
- if (__ROKU__) {
2037
- if (taskConfig.imageGenerator === undefined) {
2038
- taskConfig.imageGenerator = 1;
2039
- }
2043
+ if (taskConfig.imageGenerator === undefined) {
2044
+ taskConfig.imageGenerator = 1;
2040
2045
  }
2041
2046
 
2042
2047
  console.info('[BaseApp] Starting asyncCommandHandler with task config:', taskConfig);
@@ -105,8 +105,10 @@ export interface IConfigurationLoader {
105
105
 
106
106
  /**
107
107
  * Shows a configuration error to the user with appropriate platform-specific UI.
108
+ * Without options the dialog has a single OK button. With options it shows the
109
+ * given buttons and, after closing, reports the selected button index.
108
110
  */
109
- showConfigurationError(title: string, message: string): void;
111
+ showConfigurationError(title: string, message: string, options?: IConfigurationErrorOptions): void;
110
112
 
111
113
  /**
112
114
  * Gets the current environment (development, production, qa).
@@ -114,6 +116,11 @@ export interface IConfigurationLoader {
114
116
  getEnvironment(): string;
115
117
  }
116
118
 
119
+ export interface IConfigurationErrorOptions {
120
+ buttons?: string[];
121
+ onButtonSelected?: (index: number) => void;
122
+ }
123
+
117
124
  /**
118
125
  * ConfigurationLoader handles loading and validation of configuration files
119
126
  * with proper error handling and user feedback.
@@ -427,13 +434,13 @@ Troubleshooting:
427
434
  /**
428
435
  * Shows a configuration error with platform-appropriate UI.
429
436
  */
430
- showConfigurationError(title: string, message: string): void {
437
+ showConfigurationError(title: string, message: string, options?: IConfigurationErrorOptions): void {
431
438
  console.error(`FATAL CONFIGURATION ERROR: ${title}`);
432
439
  console.error(message);
433
440
  const dialog = CreateObject<ISGNStandardMessageDialog>('roSGNode', 'StandardMessageDialog');
434
441
  dialog.title = title;
435
442
  dialog.message = [message];
436
- dialog.buttons = ["OK"];
443
+ dialog.buttons = options?.buttons && options.buttons.length > 0 ? options.buttons : ["OK"];
437
444
  const globalAA = GetGlobalAA();
438
445
  const scene = globalAA?.scene;
439
446
  if (scene) {
@@ -444,6 +451,7 @@ Troubleshooting:
444
451
  scene.dialog = null;
445
452
  dialog.close = true;
446
453
  scene.setFocus(true);
454
+ if (options?.onButtonSelected) options.onButtonSelected(dialog.buttonSelected as number);
447
455
  });
448
456
  } else {
449
457
  console.error('Scene not found, Must be running from backgroud task. cannot show configuration error');
@@ -109,12 +109,6 @@ function validateMaskEntry(styleKey: string, entry: ShapeStyleEntry): void {
109
109
  /**
110
110
  * Compiles `theme.shapes` into `theme.compiledShapes`.
111
111
  *
112
- * On Roku each entry is pre-rendered to a nine-patch image by the
113
- * imageGenerator task and compiles to `{ uri, translationOffset, sizeOffset }`.
114
- * On all other platforms shapes draw natively, so each entry compiles to its
115
- * resolved shape fields and no task work is done. Build-generated image
116
- * metadata is retained so Image consumers can use the same packaged assets.
117
- *
118
112
  * Safe to call at any time. Must be re-run after a config reload
119
113
  * (`setConfig` replaces styles wholesale, wiping `theme.compiledShapes`);
120
114
  * fragments created before that re-run must be recreated to pick up changes.
@@ -130,27 +124,6 @@ export function loadShapesForAppConfig(appConfig: IAppConfig): HsPromise<void> {
130
124
 
131
125
  const resolverOptions = getResolverOptions(appConfig, shapes);
132
126
 
133
- if (!__ROKU__) {
134
- const supplied = appConfig.get<Record<string, CompiledShape>>(THEME_COMPILED_SHAPES_KEY, {});
135
- const compiled: Record<string, CompiledShape> = { ...supplied };
136
- for (const styleKey in shapes) {
137
- validateMaskEntry(styleKey, shapes[styleKey]);
138
- const spec = resolveShapeSpecFields(shapes[styleKey], resolverOptions);
139
- compiled[styleKey] = {
140
- ...supplied[styleKey],
141
- kind: spec.kind,
142
- fillColor: spec.fillColor,
143
- cornerRadius: spec.cornerRadius,
144
- strokeColor: spec.strokeColor,
145
- strokeWidth: spec.strokeWidth,
146
- shadows: spec.shadows,
147
- };
148
- }
149
- storeCompiledShapes(appConfig, compiled);
150
- resolve();
151
- return;
152
- }
153
-
154
127
  const requests: Record<string, ShapePatchRequest> = {};
155
128
  const supplied = appConfig.get<Record<string, CompiledShape>>(THEME_COMPILED_SHAPES_KEY, {});
156
129
  const compiled: Record<string, CompiledShape> = { ...supplied };
@@ -203,11 +176,33 @@ export function loadShapesForAppConfig(appConfig: IAppConfig): HsPromise<void> {
203
176
  requestCount++;
204
177
  }
205
178
 
179
+ if (!__ROKU__) {
180
+ for (const styleKey in shapes) {
181
+ const spec = resolveShapeSpecFields(shapes[styleKey], resolverOptions);
182
+ compiled[styleKey] = {
183
+ ...compiled[styleKey],
184
+ kind: spec.kind,
185
+ fillColor: spec.fillColor,
186
+ cornerRadius: spec.cornerRadius,
187
+ strokeColor: spec.strokeColor,
188
+ strokeWidth: spec.strokeWidth,
189
+ shadows: spec.shadows,
190
+ };
191
+ }
192
+ }
193
+
206
194
  // uris and offsets are deterministic from the spec, so the compiled map is
207
195
  // valid before generation completes; the promise gates on the task so
208
196
  // callers can await the images existing on disk.
209
197
  storeCompiledShapes(appConfig, compiled);
210
198
 
199
+ if (!__ROKU__) {
200
+ if (requestCount === 0) {
201
+ resolve();
202
+ return;
203
+ }
204
+ }
205
+
211
206
  const compileState: {
212
207
  settled: boolean;
213
208
  timeoutHandle?: ReturnType<typeof setTimeout>;
@@ -217,6 +217,8 @@ export class BaseView<T extends ViewState, R extends ISGNGroup = ISGNGroup> impl
217
217
  // passed in through view state belongs to the caller and is only suspended.
218
218
  private disposesViewModelOnUnmount = true;
219
219
  private hasStartedViewModel = false;
220
+ private isViewModelSuspended = false;
221
+ private hasReleasedViewModel = false;
220
222
  private boundViewModelHid = '';
221
223
  private isApplyingViewModelFocus = false;
222
224
  private lastReportedViewModelFocusId = '';
@@ -2808,6 +2810,7 @@ export class BaseView<T extends ViewState, R extends ISGNGroup = ISGNGroup> impl
2808
2810
  }
2809
2811
 
2810
2812
  onDidRemoveFromAggregateView(view: IAggregateView): void {
2813
+ this.releaseViewModel();
2811
2814
  if (this.eventHandlers['onDidRemoveFromAggregateView']) {
2812
2815
  this.eventHandlers['onDidRemoveFromAggregateView'](view);
2813
2816
  }
@@ -2849,6 +2852,7 @@ export class BaseView<T extends ViewState, R extends ISGNGroup = ISGNGroup> impl
2849
2852
  const vm = this.viewModel;
2850
2853
  if (vm) {
2851
2854
  this.bindViewModel();
2855
+ this.isViewModelSuspended = false;
2852
2856
  if (this.hasStartedViewModel) {
2853
2857
  vm.resume(this.getViewModelContext());
2854
2858
  } else {
@@ -2867,9 +2871,7 @@ export class BaseView<T extends ViewState, R extends ISGNGroup = ISGNGroup> impl
2867
2871
  if (this.eventHandlers['onDisappear']) {
2868
2872
  this.eventHandlers['onDisappear']();
2869
2873
  }
2870
- if (this.viewModel && this.hasStartedViewModel) {
2871
- this.viewModel.suspend();
2872
- }
2874
+ this.suspendViewModel();
2873
2875
  }
2874
2876
 
2875
2877
  setShowOnScreen(shown: boolean) {
@@ -3450,6 +3452,7 @@ export class BaseView<T extends ViewState, R extends ISGNGroup = ISGNGroup> impl
3450
3452
  if (!vm) {
3451
3453
  return;
3452
3454
  }
3455
+ this.hasReleasedViewModel = false;
3453
3456
  vm.addObserver('__internalState', this, (field) => {
3454
3457
  const current = this.viewModel;
3455
3458
  if (!current) {
@@ -3478,13 +3481,15 @@ export class BaseView<T extends ViewState, R extends ISGNGroup = ISGNGroup> impl
3478
3481
  }
3479
3482
  if (previous) {
3480
3483
  previous.removeObservers(this);
3481
- if (this.disposesViewModelOnUnmount) {
3484
+ if (this.disposesViewModelOnUnmount && !previous.isDisposed) {
3482
3485
  previous.dispose();
3483
3486
  }
3484
3487
  }
3485
3488
  this.viewModel = vm;
3486
3489
  this.disposesViewModelOnUnmount = false;
3487
3490
  this.hasStartedViewModel = false;
3491
+ this.isViewModelSuspended = false;
3492
+ this.hasReleasedViewModel = false;
3488
3493
  this.boundViewModelHid = '';
3489
3494
  this.lastReportedViewModelFocusId = '';
3490
3495
  this.pendingViewModelFocus = '';
@@ -3494,39 +3499,47 @@ export class BaseView<T extends ViewState, R extends ISGNGroup = ISGNGroup> impl
3494
3499
  /** The view is unmounted: its own model is finished; a parent's model is only paused. */
3495
3500
  private releaseViewModel(): void {
3496
3501
  const vm = this.viewModel;
3497
- if (!vm) {
3502
+ if (!vm || this.hasReleasedViewModel) {
3498
3503
  return;
3499
3504
  }
3505
+ this.hasReleasedViewModel = true;
3500
3506
  vm.removeObservers(this);
3501
3507
  this.boundViewModelHid = '';
3502
3508
  this.lastReportedViewModelFocusId = '';
3503
3509
  this.pendingViewModelFocus = '';
3504
3510
  if (!this.disposesViewModelOnUnmount) {
3505
- if (this.hasStartedViewModel) {
3506
- vm.suspend();
3507
- }
3511
+ this.suspendViewModel();
3508
3512
  return;
3509
3513
  }
3510
- // Dispose only when a fresh model can take its place, so a view that is
3511
- // mounted again never holds a dead one.
3512
3514
  const replacement = this.createViewModel();
3513
- if (replacement) {
3515
+ this.viewModel = replacement;
3516
+ this.hasStartedViewModel = false;
3517
+ this.isViewModelSuspended = false;
3518
+ if (!vm.isDisposed) {
3514
3519
  vm.dispose();
3515
- this.viewModel = replacement;
3516
- this.hasStartedViewModel = false;
3517
- } else if (this.hasStartedViewModel) {
3520
+ }
3521
+ }
3522
+
3523
+ private suspendViewModel(): void {
3524
+ const vm = this.viewModel;
3525
+ if (vm && this.hasStartedViewModel && !this.isViewModelSuspended && !vm.isDisposed) {
3526
+ this.isViewModelSuspended = true;
3518
3527
  vm.suspend();
3519
3528
  }
3520
3529
  }
3521
3530
 
3522
3531
  /** The view instance is being reused for another screen: drop a parent's model and start clean. */
3523
3532
  private recycleViewModel(): void {
3533
+ if (this.hasStartedViewModel || this.boundViewModelHid !== '' || this.viewModel?.isDisposed) {
3534
+ this.releaseViewModel();
3535
+ }
3524
3536
  if (!this.disposesViewModelOnUnmount) {
3525
- this.viewModel?.removeObservers(this);
3526
3537
  this.viewModel = this.createViewModel();
3527
3538
  this.disposesViewModelOnUnmount = true;
3528
3539
  }
3529
3540
  this.hasStartedViewModel = false;
3541
+ this.isViewModelSuspended = false;
3542
+ this.hasReleasedViewModel = false;
3530
3543
  this.boundViewModelHid = '';
3531
3544
  this.lastReportedViewModelFocusId = '';
3532
3545
  this.pendingViewModelFocus = '';
@@ -76,8 +76,8 @@ export class SharedVideoPlayerState extends HsObservable {
76
76
  @observableField errorMsg?: string;
77
77
  @observableField errorStr?: string;
78
78
 
79
- /** Set only during `endSeek()` to trigger real seek in player */
80
- @observableField seek: number | undefined = undefined;
79
+ /** A seek command must notify even when its target matches the previous seek. */
80
+ @observableField(true) seek: number | undefined = undefined;
81
81
 
82
82
  @observableField isSeeking: boolean = false;
83
83
 
@@ -412,8 +412,10 @@ export class SharedVideoPlayerState extends HsObservable {
412
412
  }
413
413
 
414
414
  override setField(name: string, value: unknown) {
415
+ // Observable initializers enter here before the other fields exist. Keep
416
+ // boolean operands defined for Roku's eager logical evaluation.
415
417
  // Drop playback intents during handover, rather than replaying them on release.
416
- if (this.isPlayerLocked && !this.isResettingPlayback && (
418
+ if (this.isPlayerLocked === true && this.isResettingPlayback !== true && (
417
419
  (name === 'control' && value !== VideoControl.None) ||
418
420
  (name === 'seek' && value !== undefined) ||
419
421
  name === 'subtitleTrack' || name === 'audioTrack' || name === 'playbackSpeed' ||
@@ -422,8 +424,8 @@ export class SharedVideoPlayerState extends HsObservable {
422
424
  return;
423
425
  }
424
426
  if (name === 'position' || name === 'duration' || name === 'isLive' || name === 'isSeeking') {
425
- const nextIsLive = name === 'isLive' ? value === true : this.isLive;
426
- const nextIsSeeking = name === 'isSeeking' ? value === true : this.isSeeking;
427
+ const nextIsLive = name === 'isLive' ? value === true : this.isLive === true;
428
+ const nextIsSeeking = name === 'isSeeking' ? value === true : this.isSeeking === true;
427
429
  const nextDuration = name === 'duration'
428
430
  ? (typeof value === 'number' ? value : -1)
429
431
  : this.duration;
@@ -433,7 +435,7 @@ export class SharedVideoPlayerState extends HsObservable {
433
435
  const preservesConfirmedLiveEdge = nextIsLive
434
436
  && !nextIsSeeking
435
437
  && (
436
- (name === 'duration' && this.isAtLiveEdge)
438
+ (name === 'duration' && this.isAtLiveEdge === true)
437
439
  || (name === 'isLive' && value === true)
438
440
  );
439
441
  this.isAtLiveEdge = preservesConfirmedLiveEdge || isAtLiveEdge(
package/hosanna.json DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "note": "Framework checkout; compiler selection remains independent of npm framework distribution.",
3
- "transpiler-version": "1.53.0"
4
- }