@3dsource/angular-unreal-module 0.0.17 → 0.0.18

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/LICENSE ADDED
@@ -0,0 +1,14 @@
1
+ Copyright (c) 2025 3dsource
2
+ All Rights Reserved.
3
+
4
+ This software and associated documentation files (the “Software”) are proprietary
5
+ and confidential. Unauthorized copying, modification, distribution, or any other
6
+ use of the Software, in whole or in part, without the prior written consent of
7
+ the copyright holder is strictly prohibited.
8
+
9
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
10
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
11
+ FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
12
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
13
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
14
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,36 @@
1
- # Angular Unreal Module
1
+ # @3dsource/angular-unreal-module
2
2
 
3
- Special wrapper for using unreal module in angular projects
3
+ ### An unreal scene standalone component for a metabox studio and configurators for communicate with unreal applications
4
+
5
+ ## Installation
6
+
7
+ ### peer dependencies
8
+
9
+ _List of peer dependencies_
10
+
11
+ ```json
12
+ {
13
+ "@3dsource/source-ui-native": "^1.0.7",
14
+ "@3dsource/types-unreal": "^0.0.1",
15
+ "@3dsource/utils": "^1.0.13",
16
+ "@angular/cdk": "^19.2.0",
17
+ "@angular/common": "^19.2.0",
18
+ "@angular/core": "^19.2.0",
19
+ "@angular/forms": "^19.2.0",
20
+ "@ngrx/effects": "^19.1.0",
21
+ "@ngrx/operators": "^19.1.0",
22
+ "@ngrx/store": "^19.1.0"
23
+ }
24
+ ```
25
+
26
+ ```shell
27
+ npx install-peerdeps @3dsource/angular-unreal-module
28
+ ```
29
+
30
+ ### library
31
+
32
+ ```shell
33
+ npm i @3dsource/angular-unreal-module
34
+ ```
35
+
36
+ ## Usage
@@ -5,7 +5,7 @@ import { createAction, props, createReducer, on, createFeature, Store, createSel
5
5
  import { Actions, createEffect, ofType } from '@ngrx/effects';
6
6
  import { skip, share, merge, timer, of, Subject, combineLatest, switchMap, timeout, retryWhen, take, fromEvent, from, tap as tap$1, interval, startWith, combineLatestWith, takeUntil as takeUntil$1, auditTime, map as map$1, EMPTY, debounceTime as debounceTime$1, scan, Observable, BehaviorSubject, first as first$1, distinctUntilChanged as distinctUntilChanged$1, concat } from 'rxjs';
7
7
  import { concatLatestFrom } from '@ngrx/operators';
8
- import { Falsy, Truthy, Logger, generateUuid, tapLog, COLOR_CODES, Signal, where, KeyboardNumericCode, InvertedKeyMap, Semaphore, isEmpty, lerp, clampf, calculateMedian, smoothTransition, getCanvasCached, getSnapshot, whereNot, HEXtoRGB, RGBtoHSV, inverseLerp, HSVtoRGB, RGBtoHEX, fpIsASameAsB, fitIntoRectangle } from '@3dsource/utils';
8
+ import { Falsy, Truthy, Logger, generateUuid, tapLog, COLOR_CODES, calculateMedian, clampf, Signal, where, KeyboardNumericCode, InvertedKeyMap, Semaphore, isEmpty, lerp, smoothTransition, getCanvasCached, getSnapshot, whereNot, HEXtoRGB, RGBtoHSV, inverseLerp, HSVtoRGB, RGBtoHEX, fpIsASameAsB, fitIntoRectangle } from '@3dsource/utils';
9
9
  import { toSignal, takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';
10
10
  import { HttpClient } from '@angular/common/http';
11
11
  import { DialogRef, DIALOG_DATA, Dialog } from '@angular/cdk/dialog';
@@ -1564,6 +1564,87 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
1564
1564
  type: Injectable
1565
1565
  }] });
1566
1566
 
1567
+ class DataFlowMonitor {
1568
+ /**
1569
+ * Initializes the DataFlowMonitor monitor.
1570
+ * @param yellowFlagThresholdPercentage - The percentage drop to trigger a YELLOW warning (default: 15%).
1571
+ * @param redFlagThresholdPercentage - The percentage drop to trigger a RED warning (default: 30%).
1572
+ * @param historyBufferLength - buffer length (default: 100).
1573
+ * @param splitPoint - The point at which to split the history buffer into two halves (default: 0.5).
1574
+ */
1575
+ constructor(yellowFlagThresholdPercentage = 15, redFlagThresholdPercentage = 30, historyBufferLength = 100, splitPoint = 0.5) {
1576
+ this.yellowFlagThresholdPercentage = yellowFlagThresholdPercentage;
1577
+ this.redFlagThresholdPercentage = redFlagThresholdPercentage;
1578
+ this.historyBufferLength = historyBufferLength;
1579
+ this.splitPoint = splitPoint;
1580
+ this.dataHistory = [];
1581
+ }
1582
+ reset() {
1583
+ this.dataHistory.length = 0;
1584
+ }
1585
+ config(data) {
1586
+ this.reset();
1587
+ this.yellowFlagThresholdPercentage = data.yellowFlag;
1588
+ this.redFlagThresholdPercentage = data.redFlag;
1589
+ }
1590
+ /**
1591
+ * Adds a new bitrate measurement and checks for significant drops.
1592
+ * @param currentValue - The current bitrate in kbps.
1593
+ * @returns BitrateCheckResult indicating if a drop was detected.
1594
+ */
1595
+ addValue(currentValue) {
1596
+ if (isNaN(currentValue) || currentValue < 1) {
1597
+ return {};
1598
+ }
1599
+ const historyLength = this.dataHistory.length;
1600
+ if (historyLength > this.historyBufferLength) {
1601
+ this.dataHistory.shift();
1602
+ }
1603
+ this.dataHistory.push(currentValue);
1604
+ if (historyLength < this.historyBufferLength) {
1605
+ this.dataHistory.length = this.historyBufferLength;
1606
+ this.dataHistory.fill(currentValue, 0, this.historyBufferLength);
1607
+ }
1608
+ const splitIndex = Math.floor(historyLength * this.splitPoint);
1609
+ const firstHalf = this.dataHistory.slice(0, splitIndex);
1610
+ const secondHalf = this.dataHistory.slice(splitIndex);
1611
+ const firstHalfMedian = calculateMedian(firstHalf);
1612
+ const secondHalfMedian = calculateMedian(secondHalf);
1613
+ const dropPercentage = clampf(0, 100, ((firstHalfMedian - secondHalfMedian) / firstHalfMedian) * 100);
1614
+ const isRedFlag = dropPercentage >= this.redFlagThresholdPercentage;
1615
+ if (dropPercentage >= this.yellowFlagThresholdPercentage) {
1616
+ return {
1617
+ config: {
1618
+ yellowFlagThresholdPercentage: this.yellowFlagThresholdPercentage,
1619
+ redFlagThresholdPercentage: this.redFlagThresholdPercentage,
1620
+ historyBufferLength: this.historyBufferLength,
1621
+ splitPoint: this.splitPoint,
1622
+ },
1623
+ isDropDetected: true,
1624
+ dropPercentage,
1625
+ dataHistory: [...this.dataHistory],
1626
+ activeMedian: secondHalfMedian,
1627
+ quality: isRedFlag ? 'red' : 'orange',
1628
+ message: `Significant flow drop detected: ${dropPercentage.toFixed(2)}% (from ${firstHalfMedian} to ${secondHalfMedian})`,
1629
+ };
1630
+ }
1631
+ return {
1632
+ config: {
1633
+ yellowFlagThresholdPercentage: this.yellowFlagThresholdPercentage,
1634
+ redFlagThresholdPercentage: this.redFlagThresholdPercentage,
1635
+ historyBufferLength: this.historyBufferLength,
1636
+ splitPoint: this.splitPoint,
1637
+ },
1638
+ isDropDetected: false,
1639
+ dropPercentage,
1640
+ dataHistory: [...this.dataHistory],
1641
+ activeMedian: secondHalfMedian,
1642
+ quality: 'lime',
1643
+ message: 'Stable flow',
1644
+ };
1645
+ }
1646
+ }
1647
+
1567
1648
  /**
1568
1649
  * Default LBM Filter Parameters
1569
1650
  */
@@ -1856,7 +1937,8 @@ class AggregatorService extends SubService {
1856
1937
  }
1857
1938
  removeLoadScreen() {
1858
1939
  document
1859
- .getElementById(this.#unrealInitialConfig?.screenLockerContainerId || SCREEN_LOCKER_CONTAINER_ID)
1940
+ .getElementById(this.#unrealInitialConfig?.screenLockerContainerId ||
1941
+ SCREEN_LOCKER_CONTAINER_ID)
1860
1942
  ?.remove();
1861
1943
  }
1862
1944
  startListenCallbacks() {
@@ -3312,87 +3394,6 @@ function decodeData(anyData) {
3312
3394
  }
3313
3395
  }
3314
3396
 
3315
- class DataFlowMonitor {
3316
- /**
3317
- * Initializes the DataFlowMonitor monitor.
3318
- * @param yellowFlagThresholdPercentage - The percentage drop to trigger a YELLOW warning (default: 15%).
3319
- * @param redFlagThresholdPercentage - The percentage drop to trigger a RED warning (default: 30%).
3320
- * @param historyBufferLength - buffer length (default: 100).
3321
- * @param splitPoint - The point at which to split the history buffer into two halves (default: 0.5).
3322
- */
3323
- constructor(yellowFlagThresholdPercentage = 15, redFlagThresholdPercentage = 30, historyBufferLength = 100, splitPoint = 0.5) {
3324
- this.yellowFlagThresholdPercentage = yellowFlagThresholdPercentage;
3325
- this.redFlagThresholdPercentage = redFlagThresholdPercentage;
3326
- this.historyBufferLength = historyBufferLength;
3327
- this.splitPoint = splitPoint;
3328
- this.dataHistory = [];
3329
- }
3330
- reset() {
3331
- this.dataHistory.length = 0;
3332
- }
3333
- config(data) {
3334
- this.reset();
3335
- this.yellowFlagThresholdPercentage = data.yellowFlag;
3336
- this.redFlagThresholdPercentage = data.redFlag;
3337
- }
3338
- /**
3339
- * Adds a new bitrate measurement and checks for significant drops.
3340
- * @param currentValue - The current bitrate in kbps.
3341
- * @returns BitrateCheckResult indicating if a drop was detected.
3342
- */
3343
- addValue(currentValue) {
3344
- if (isNaN(currentValue) || currentValue < 1) {
3345
- return {};
3346
- }
3347
- const historyLength = this.dataHistory.length;
3348
- if (historyLength > this.historyBufferLength) {
3349
- this.dataHistory.shift();
3350
- }
3351
- this.dataHistory.push(currentValue);
3352
- if (historyLength < this.historyBufferLength) {
3353
- this.dataHistory.length = this.historyBufferLength;
3354
- this.dataHistory.fill(currentValue, 0, this.historyBufferLength);
3355
- }
3356
- const splitIndex = Math.floor(historyLength * this.splitPoint);
3357
- const firstHalf = this.dataHistory.slice(0, splitIndex);
3358
- const secondHalf = this.dataHistory.slice(splitIndex);
3359
- const firstHalfMedian = calculateMedian(firstHalf);
3360
- const secondHalfMedian = calculateMedian(secondHalf);
3361
- const dropPercentage = clampf(0, 100, ((firstHalfMedian - secondHalfMedian) / firstHalfMedian) * 100);
3362
- const isRedFlag = dropPercentage >= this.redFlagThresholdPercentage;
3363
- if (dropPercentage >= this.yellowFlagThresholdPercentage) {
3364
- return {
3365
- config: {
3366
- yellowFlagThresholdPercentage: this.yellowFlagThresholdPercentage,
3367
- redFlagThresholdPercentage: this.redFlagThresholdPercentage,
3368
- historyBufferLength: this.historyBufferLength,
3369
- splitPoint: this.splitPoint,
3370
- },
3371
- isDropDetected: true,
3372
- dropPercentage,
3373
- dataHistory: [...this.dataHistory],
3374
- activeMedian: secondHalfMedian,
3375
- quality: isRedFlag ? 'red' : 'orange',
3376
- message: `Significant flow drop detected: ${dropPercentage.toFixed(2)}% (from ${firstHalfMedian} to ${secondHalfMedian})`,
3377
- };
3378
- }
3379
- return {
3380
- config: {
3381
- yellowFlagThresholdPercentage: this.yellowFlagThresholdPercentage,
3382
- redFlagThresholdPercentage: this.redFlagThresholdPercentage,
3383
- historyBufferLength: this.historyBufferLength,
3384
- splitPoint: this.splitPoint,
3385
- },
3386
- isDropDetected: false,
3387
- dropPercentage,
3388
- dataHistory: [...this.dataHistory],
3389
- activeMedian: secondHalfMedian,
3390
- quality: 'lime',
3391
- message: 'Stable flow',
3392
- };
3393
- }
3394
- }
3395
-
3396
3397
  /**
3397
3398
  * UnrealInternalSignalEvents commands list wrapper listener
3398
3399
  * @param event
@@ -4226,7 +4227,8 @@ class UnrealStatusComponent {
4226
4227
  * or any other relevant information that the iframe needs to process.
4227
4228
  */
4228
4229
  sendMessageToIndex(text) {
4229
- const objectElement = document.getElementById(this.#unrealInitialConfig?.screenLockerContainerId || SCREEN_LOCKER_CONTAINER_ID);
4230
+ const objectElement = document.getElementById(this.#unrealInitialConfig?.screenLockerContainerId ||
4231
+ SCREEN_LOCKER_CONTAINER_ID);
4230
4232
  try {
4231
4233
  const objectDocument = objectElement.contentWindow;
4232
4234
  objectDocument?.postMessage(text, '*');