@tantawowa/hosanna-ui 2.0.2 → 2.0.3

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.
@@ -2,8 +2,8 @@
2
2
  "schemaVersion": 2,
3
3
  "artifact": "npm-sdk",
4
4
  "packageName": "@tantawowa/hosanna-ui",
5
- "version": "2.0.2",
6
- "sourceCommit": "811a31c682344d9aead9b495245eb6b479df33d5",
5
+ "version": "2.0.3",
6
+ "sourceCommit": "ed9d9afbfe2df5dcf5e71b5e1e34235c954684f9",
7
7
  "files": [
8
8
  {
9
9
  "path": "LICENSE",
@@ -309,6 +309,22 @@
309
309
  "path": "src/hosanna-bridge-targets/roku/polyfills.roku.ts",
310
310
  "sha256": "3417b34248ff4f6cc374fe3513f4480e95ceaf44a9178629b2350ae246618ac5"
311
311
  },
312
+ {
313
+ "path": "src/hosanna-bridge-targets/web/assets/fonts/NotoSans_Condensed-Bold.ttf",
314
+ "sha256": "0e33e939db9dd0d897453f9d01088c4f258b9888eff1d24a6e65d18b2a427485"
315
+ },
316
+ {
317
+ "path": "src/hosanna-bridge-targets/web/assets/fonts/NotoSans_Condensed-Regular.ttf",
318
+ "sha256": "4e326cc003d76d2ab8fafefdda2cb8d4558beb8279ad763b9acd6309ff2d70bc"
319
+ },
320
+ {
321
+ "path": "src/hosanna-bridge-targets/web/assets/fonts/OFL.txt",
322
+ "sha256": "e2e177a32561584d4fc13aaa3cd8e53758a12910f013fe9ca125419111722029"
323
+ },
324
+ {
325
+ "path": "src/hosanna-bridge-targets/web/assets/fonts/README.md",
326
+ "sha256": "6a8a29efae82941fe3ffc909f2daf6cba2d5c238494f2fbdb78da739ed38b41c"
327
+ },
312
328
  {
313
329
  "path": "src/hosanna-bridge-targets/web/brs/VirtualBrsComponent.ts",
314
330
  "sha256": "616c8deab4de69267ea015679ff0e2eb2be8b9c5c627e5c888891ab724ce00ae"
@@ -555,7 +571,7 @@
555
571
  },
556
572
  {
557
573
  "path": "src/hosanna-bridge-targets/web/lib/WebFontService.ts",
558
- "sha256": "04393c5904d62cd760fab9f9f599c822b34b356b0b79d8c1ff889a428a02bf2d"
574
+ "sha256": "b4eba0dca29eb6fd9e074d8d4fd5bac80684218ba6270cf897f75167705e82b9"
559
575
  },
560
576
  {
561
577
  "path": "src/hosanna-bridge-targets/web/lib/WebOrientationPlatformAdapter.ts",
@@ -739,7 +755,7 @@
739
755
  },
740
756
  {
741
757
  "path": "src/hosanna-bridge-targets/web/sg/ComponentLibraryArchive.ts",
742
- "sha256": "cf508fc03c774c9703b9250708d5a582ab24a7899e9296d9d40eac92bd57531d"
758
+ "sha256": "717ed04ad996143f07ad82bb29035f71030b0f96a49fc84cd95b01cc944e1c6b"
743
759
  },
744
760
  {
745
761
  "path": "src/hosanna-bridge-targets/web/sg/HsShape.ts",
@@ -1447,7 +1463,7 @@
1447
1463
  },
1448
1464
  {
1449
1465
  "path": "src/hosanna-game/runtime/GameRuntime.ts",
1450
- "sha256": "e9e9ca3fe9034507f1b67953cbddd96a6c0a485410868c3fb2dc63d4e164fe2a"
1466
+ "sha256": "a198eeef1e4fa5701f58fc6c99b61315158397e4905d993d72823f4b563fa076"
1451
1467
  },
1452
1468
  {
1453
1469
  "path": "src/hosanna-game/runtime/GameRuntimeServices.ts",
@@ -1931,7 +1947,7 @@
1931
1947
  },
1932
1948
  {
1933
1949
  "path": "src/hosanna-ui/lib/BaseApp.ts",
1934
- "sha256": "3af17a3bf5c7c59c9ee47c67ee3c247bb26de0c9383acb5e9811ffa87833110e"
1950
+ "sha256": "2d8f750e4d2ede4addae1464c22f2420e1415c3e4d6d5662c14bc60b70727d74"
1935
1951
  },
1936
1952
  {
1937
1953
  "path": "src/hosanna-ui/lib/BuildConfigRuntimePath.ts",
@@ -2619,7 +2635,7 @@
2619
2635
  },
2620
2636
  {
2621
2637
  "path": "src/hosanna-ui/views/lib/BaseView.ts",
2622
- "sha256": "ad210cb3e4b0483f32d3944a0be826aa099fd325ac087f46a6169663a5df371e"
2638
+ "sha256": "fc014923ab461492c2dc8f364c286821c8b212b2bb9766ba676cf71ae87dfc23"
2623
2639
  },
2624
2640
  {
2625
2641
  "path": "src/hosanna-ui/views/lib/BuildConfig.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tantawowa/hosanna-ui",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "Hosanna UI source SDK for Roku and its browser emulator",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -0,0 +1,93 @@
1
+ Copyright 2022 The Noto Project Authors (https://github.com/notofonts/latin-greek-cyrillic)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ https://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,5 @@
1
+ # Browser system fonts
2
+
3
+ These unmodified Noto Sans Condensed files provide the browser emulator’s regular and bold system fonts. WebFontService resolves them from the installed SDK; Vite emits them as application build assets. Roku uses its native system fonts.
4
+
5
+ The files retain their original font metadata and are licensed under the SIL Open Font License 1.1 in OFL.txt. Source and copyright holder: https://github.com/notofonts/latin-greek-cyrillic.
@@ -107,7 +107,15 @@ export function registerFont(fontName: string, fontUrl: string): Promise<void> {
107
107
  }
108
108
 
109
109
  const normalizedFontUrl = normalizePkgUri(fontUrl);
110
- const fontFace = new FontFace(normalizedFontName, `url(${normalizedFontUrl})`);
110
+ // Keep the public system-font identity while loading its bytes from the SDK.
111
+ // Vite serves these relative assets in development and emits them for production.
112
+ let assetUrl = normalizedFontUrl;
113
+ if (normalizedFontUrl === normalizePkgUri(SystemDefaultRegularFontUri)) {
114
+ assetUrl = new URL('../assets/fonts/NotoSans_Condensed-Regular.ttf', import.meta.url).href;
115
+ } else if (normalizedFontUrl === normalizePkgUri(SystemDefaultBoldFontUri)) {
116
+ assetUrl = new URL('../assets/fonts/NotoSans_Condensed-Bold.ttf', import.meta.url).href;
117
+ }
118
+ const fontFace = new FontFace(normalizedFontName, `url(${assetUrl})`);
111
119
  return fontFace
112
120
  .load()
113
121
  .then((loadedFontFace) => {
@@ -1,6 +1,6 @@
1
1
  // hs:exclude-from-platform roku
2
2
  import { unzipSync, strFromU8 } from 'fflate';
3
- import { crc32 } from 'crc';
3
+ import crc32 from 'crc/calculators/crc32';
4
4
  import { AppUtils } from '@hs-src/hosanna-bridge-core/AppUtils';
5
5
  import { createPortPromise } from '@hs-src/hosanna-bridge-core/Promises';
6
6
  import type { IHosannaFileSystem } from '@hs-src/hosanna-bridge-core/api';
@@ -202,12 +202,15 @@ export class GameRuntime {
202
202
  GameCollisionManager.renderDebugColliders(this.options.screen);
203
203
  }
204
204
  }
205
- if (this.options.screen.Present) {
206
- this.options.screen.Present();
207
- if (__TELEMETRY__) {
208
- this.updatePerformanceStats(frameDeltaMs, frameStartMs, updateEndMs, renderEndMs, this.now());
205
+ if (!__ROKU__) {
206
+ // Present is a browser hook; probing it on native roScreen raises an error.
207
+ if (this.options.screen.Present) {
208
+ this.options.screen.Present();
209
+ if (__TELEMETRY__) {
210
+ this.updatePerformanceStats(frameDeltaMs, frameStartMs, updateEndMs, renderEndMs, this.now());
211
+ }
212
+ return true;
209
213
  }
210
- return true;
211
214
  }
212
215
  this.options.screen.SwapBuffers();
213
216
  if (__TELEMETRY__) {
@@ -482,6 +482,11 @@ export class BaseApp extends BaseView<ViewState> implements IObserver {
482
482
  this.begin();
483
483
  }
484
484
 
485
+ /** BaseApp creates the container that its BaseView services depend on. */
486
+ protected override shouldDeferViewInitialization(): boolean {
487
+ return true;
488
+ }
489
+
485
490
  /**
486
491
  * Begins the application launch sequence.
487
492
  * Initializes scene, IoC, views, and starts the main loop.
@@ -500,6 +505,7 @@ export class BaseApp extends BaseView<ViewState> implements IObserver {
500
505
  // Emulated web: call directly since hs_native_roku is a no-op
501
506
  this.assignBaseIOCServices();
502
507
  }
508
+ this.initializeViewNotifications();
503
509
  this.beforeLaunch();
504
510
  // CRITICAL: Resolve IoC dependencies BEFORE creating views
505
511
  // Views (like DialogManagerView) extend BaseView which uses @inject() decorators
@@ -539,24 +545,6 @@ export class BaseApp extends BaseView<ViewState> implements IObserver {
539
545
  });
540
546
  }
541
547
 
542
- /**
543
- * Assigns base IoC services to the app instance.
544
- * Used as a workaround for static-only injection on Roku.
545
- */
546
- private assignBaseIOCServices() {
547
- //On Roku, @inject is static only, not lazy, so if something does not exist at instanatiation time, we have to assign it later.
548
- //This is a workaround for that.
549
- //Where we have to assign anything that was injected before we made the IOC container.
550
- const platform = AppUtils.getPlatform();
551
- this.nodePool = AppUtils.resolve('nodePool');
552
- this.appConfig = AppUtils.resolve('appConfig');
553
- this.viewManager = AppUtils.resolve('viewManager');
554
- this.viewBuilder = AppUtils.resolve('viewBuilder');
555
- this.focusManager = AppUtils.resolve('focusManager');
556
- this.instancePool = AppUtils.resolve('instancePool');
557
- console.info(`Assigned base IOC services to BaseApp (platform: ${platform})`);
558
- }
559
-
560
548
  /*******************************************************************
561
549
  * Launch initialization
562
550
  *******************************************************************/
@@ -168,11 +168,17 @@ export class BaseView<T extends ViewState, R extends ISGNGroup = ISGNGroup> impl
168
168
  _cacheKey = '';
169
169
 
170
170
  // private nodePool: INodePool = new NodePool();
171
+ // hs:exclude-from-platform roku
171
172
  @inject() nodePool!: INodePool;
173
+ // hs:exclude-from-platform roku
172
174
  @inject() appConfig!: IAppConfig;
175
+ // hs:exclude-from-platform roku
173
176
  @inject() protected viewManager!: IViewManager;
177
+ // hs:exclude-from-platform roku
174
178
  @inject() protected viewBuilder!: ViewBuilder;
179
+ // hs:exclude-from-platform roku
175
180
  @inject() protected focusManager!: IFocusManager;
181
+ // hs:exclude-from-platform roku
176
182
  @inject() instancePool!: IInstancePool;
177
183
 
178
184
  private _renderer: R | undefined;
@@ -410,6 +416,31 @@ export class BaseView<T extends ViewState, R extends ISGNGroup = ISGNGroup> impl
410
416
  constructor() {
411
417
  // hs:exclude-from-platform roku
412
418
  this._hid = `${getUniqueViewId()}`;
419
+ if (!this.shouldDeferViewInitialization()) {
420
+ if (__ROKU__) {
421
+ this.assignBaseIOCServices();
422
+ }
423
+ this.initializeViewNotifications();
424
+ }
425
+ }
426
+
427
+ /** The app overrides this while it creates the container used by all views. */
428
+ protected shouldDeferViewInitialization(): boolean {
429
+ return false;
430
+ }
431
+
432
+ /** Resolve view services after the app has created its IoC container. */
433
+ protected assignBaseIOCServices(): void {
434
+ this.nodePool = AppUtils.resolve('nodePool');
435
+ this.appConfig = AppUtils.resolve('appConfig');
436
+ this.viewManager = AppUtils.resolve('viewManager');
437
+ this.viewBuilder = AppUtils.resolve('viewBuilder');
438
+ this.focusManager = AppUtils.resolve('focusManager');
439
+ this.instancePool = AppUtils.resolve('instancePool');
440
+ }
441
+
442
+ /** The app defers notification subscriptions until its services are ready. */
443
+ protected initializeViewNotifications(): void {
413
444
  if ((this as INotificationClient).notificationHandlers) {
414
445
  toggleNotificationSubscription(this as INotificationClient, true);
415
446
  }