@netless/window-manager 1.0.11 → 1.0.13-beta.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/dist/index.mjs CHANGED
@@ -7372,6 +7372,9 @@ const _AppProxy = class {
7372
7372
  get appAttributes() {
7373
7373
  return this.store.getAppAttributes(this.id);
7374
7374
  }
7375
+ get Logger() {
7376
+ return this.manager.windowManger.Logger;
7377
+ }
7375
7378
  getFullScenePath() {
7376
7379
  if (this.scenePath) {
7377
7380
  return get(this.appAttributes, [Fields.FullPath]) || this.getFullScenePathFromScenes();
@@ -7389,12 +7392,13 @@ const _AppProxy = class {
7389
7392
  this.manager.safeUpdateAttributes(["apps", this.id, Fields.FullPath], path);
7390
7393
  }
7391
7394
  async baseInsertApp(skipUpdate = false, boxStatus = TELE_BOX_STATE.Normal) {
7392
- var _a;
7395
+ var _a, _b, _c;
7393
7396
  const params = this.params;
7394
7397
  if (!params.kind) {
7398
+ (_a = this.Logger) == null ? void 0 : _a.error(`[WindowManager]: kind require`);
7395
7399
  throw new Error("[WindowManager]: kind require");
7396
7400
  }
7397
- const appImpl = await ((_a = appRegister.appClasses.get(params.kind)) == null ? void 0 : _a());
7401
+ const appImpl = await ((_b = appRegister.appClasses.get(params.kind)) == null ? void 0 : _b());
7398
7402
  const appParams = appRegister.registered.get(params.kind);
7399
7403
  if (appImpl) {
7400
7404
  await this.setupApp(
@@ -7409,6 +7413,7 @@ const _AppProxy = class {
7409
7413
  params.isDragContent
7410
7414
  );
7411
7415
  } else {
7416
+ (_c = this.Logger) == null ? void 0 : _c.error(`[WindowManager]: app load failed ${params.kind} ${params.src}`);
7412
7417
  throw new Error(`[WindowManager]: app load failed ${params.kind} ${params.src}`);
7413
7418
  }
7414
7419
  internalEmitter.emit("updateManagerRect");
@@ -7422,7 +7427,7 @@ const _AppProxy = class {
7422
7427
  return (_a = this.boxManager) == null ? void 0 : _a.getBox(this.id);
7423
7428
  }
7424
7429
  async setupApp(appId, skipUpdate, app, options, appOptions, boxStatus, forceTop, forceNormal, isDragContent) {
7425
- var _a;
7430
+ var _a, _b;
7426
7431
  log("setupApp", appId, app, options, boxStatus, forceTop, forceNormal, isDragContent);
7427
7432
  if (!this.boxManager) {
7428
7433
  throw new BoxManagerNotFoundError();
@@ -7481,7 +7486,7 @@ const _AppProxy = class {
7481
7486
  this.boxManager.focusBox({ appId }, false);
7482
7487
  }
7483
7488
  } catch (error) {
7484
- console.error(error);
7489
+ (_b = this.Logger) == null ? void 0 : _b.error(`[WindowManager]: app setup error: ${error.message}`);
7485
7490
  throw new Error(`[WindowManager]: app setup error: ${error.message}`);
7486
7491
  }
7487
7492
  }
@@ -8491,6 +8496,9 @@ class AppManager {
8491
8496
  var _a;
8492
8497
  return ((_a = this.room) == null ? void 0 : _a.uid) || "";
8493
8498
  }
8499
+ get Logger() {
8500
+ return this.windowManger.Logger;
8501
+ }
8494
8502
  getMainViewSceneDir() {
8495
8503
  const scenePath = this.store.getMainViewScenePath();
8496
8504
  if (scenePath) {
@@ -8584,6 +8592,7 @@ class AppManager {
8584
8592
  }
8585
8593
  }
8586
8594
  async _attributesUpdateCallback(apps) {
8595
+ var _a;
8587
8596
  if (apps && WindowManager.container) {
8588
8597
  const appIds = Object.keys(apps);
8589
8598
  if (appIds.length === 0) {
@@ -8607,6 +8616,7 @@ class AppManager {
8607
8616
  try {
8608
8617
  const appAttributes = this.attributes[id2];
8609
8618
  if (!appAttributes) {
8619
+ (_a = this.Logger) == null ? void 0 : _a.error(`[WindowManager]: appAttributes is undefined, appId: ${id2}`);
8610
8620
  throw new Error("appAttributes is undefined");
8611
8621
  }
8612
8622
  this.appCreateQueue.push(async () => {
@@ -8678,7 +8688,9 @@ class AppManager {
8678
8688
  }
8679
8689
  }
8680
8690
  async addApp(params, isDynamicPPT) {
8691
+ var _a;
8681
8692
  log("addApp", params);
8693
+ (_a = this.windowManger.Logger) == null ? void 0 : _a.info(`[WindowManager]: addApp ${params.kind}, isDynamicPPT: ${isDynamicPPT}`);
8682
8694
  const { appId, needFocus } = await this.beforeAddApp(params, isDynamicPPT);
8683
8695
  const appProxy = await this.baseInsertApp(params, appId, true, needFocus);
8684
8696
  this.afterAddApp(appProxy);
@@ -8715,12 +8727,13 @@ class AppManager {
8715
8727
  async closeApp(appId, needClose = true) {
8716
8728
  const appProxy = this.appProxies.get(appId);
8717
8729
  if (appProxy) {
8718
- appProxy.destroy(true, needClose, false);
8730
+ await appProxy.destroy(true, needClose, false);
8719
8731
  }
8720
8732
  }
8721
8733
  async baseInsertApp(params, appId, isAddApp, focus) {
8734
+ var _a, _b;
8722
8735
  if (this.appProxies.has(appId)) {
8723
- console.warn("[WindowManager]: app duplicate exists and cannot be created again");
8736
+ (_a = this.windowManger.Logger) == null ? void 0 : _a.warn(`[WindowManager]: app duplicate exists and cannot be created again, appId: ${appId}`);
8724
8737
  return;
8725
8738
  }
8726
8739
  const AppProxyClass = getExtendClass$1(AppProxy, WindowManager.extendClass);
@@ -8731,6 +8744,7 @@ class AppManager {
8731
8744
  return appProxy;
8732
8745
  } else {
8733
8746
  this.appStatus.delete(appId);
8747
+ (_b = this.Logger) == null ? void 0 : _b.error(`[WindowManager]: initialize AppProxy failed, appId: ${appId}`);
8734
8748
  throw new Error("[WindowManger]: initialize AppProxy failed");
8735
8749
  }
8736
8750
  }
@@ -8741,13 +8755,16 @@ class AppManager {
8741
8755
  this.windowManger.safeUpdateAttributes(keys, value);
8742
8756
  }
8743
8757
  async setMainViewScenePath(scenePath) {
8758
+ var _a, _b;
8744
8759
  if (this.room) {
8745
8760
  const scenePathType = this.displayer.scenePathType(scenePath);
8746
8761
  const sceneDir = parseSceneDir(scenePath);
8747
8762
  if (sceneDir !== ROOT_DIR) {
8763
+ (_a = this.Logger) == null ? void 0 : _a.error(`[WindowManager]: main view scenePath must in root dir "/"`);
8748
8764
  throw new Error(`[WindowManager]: main view scenePath must in root dir "/"`);
8749
8765
  }
8750
8766
  if (scenePathType === ScenePathType.None) {
8767
+ (_b = this.Logger) == null ? void 0 : _b.error(`[WindowManager]: ${scenePath} not valid scene`);
8751
8768
  throw new Error(`[WindowManager]: ${scenePath} not valid scene`);
8752
8769
  } else if (scenePathType === ScenePathType.Page) {
8753
8770
  await this._setMainViewScenePath(scenePath);
@@ -8769,7 +8786,7 @@ class AppManager {
8769
8786
  }
8770
8787
  }
8771
8788
  async setMainViewSceneIndex(index2) {
8772
- var _a;
8789
+ var _a, _b;
8773
8790
  if (this.room) {
8774
8791
  if (this.store.getMainViewSceneIndex() === index2)
8775
8792
  return;
@@ -8783,6 +8800,7 @@ class AppManager {
8783
8800
  this.dispatchSetMainViewScenePath(scenePath);
8784
8801
  }
8785
8802
  } else {
8803
+ (_b = this.Logger) == null ? void 0 : _b.error(`[WindowManager]: ${index2} not valid index`);
8786
8804
  throw new Error(`[WindowManager]: ${index2} not valid index`);
8787
8805
  }
8788
8806
  }
@@ -19643,15 +19661,18 @@ const reconnectRefresher = new ReconnectRefresher({ emitter: internalEmitter });
19643
19661
  const _WindowManager = class extends InvisiblePlugin {
19644
19662
  constructor(context) {
19645
19663
  super(context);
19646
- this.version = "1.0.11";
19647
- this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "0.3.0", "emittery": "^0.9.2", "lodash": "^4.17.21", "p-retry": "^4.6.1", "uuid": "^7.0.3", "video.js": ">=7" }, "peerDependencies": { "jspdf": "2.5.1", "white-web-sdk": "^2.16.52" }, "devDependencies": { "@hyrious/dts": "^0.2.2", "@netless/app-docs-viewer": "^0.2.19", "@netless/app-media-player": "0.1.4", "@rollup/plugin-commonjs": "^20.0.0", "@rollup/plugin-node-resolve": "^13.0.4", "@rollup/plugin-url": "^6.1.0", "@sveltejs/vite-plugin-svelte": "1.0.0-next.30", "@tsconfig/svelte": "^2.0.1", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.4", "@types/uuid": "^8.3.1", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "@vitest/ui": "^0.14.1", "cypress": "^8.7.0", "dotenv": "^10.0.0", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^3.2.0", "jsdom": "^19.0.0", "jspdf": "^2.5.1", "less": "^4.1.1", "prettier": "^2.3.2", "prettier-plugin-svelte": "^2.4.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^3.14.1", "side-effect-manager": "0.1.5", "svelte": "^3.42.4", "typescript": "^4.5.5", "vite": "^2.9.9", "vitest": "^0.14.1", "white-web-sdk": "^2.16.52" } };
19664
+ this.version = "1.0.13-beta.0";
19665
+ this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "0.3.0", "emittery": "^0.9.2", "lodash": "^4.17.21", "p-retry": "^4.6.1", "uuid": "^7.0.3", "video.js": ">=7" }, "peerDependencies": { "jspdf": "2.5.1", "white-web-sdk": "^2.16.53" }, "devDependencies": { "@hyrious/dts": "^0.2.2", "@netless/app-docs-viewer": "^0.2.19", "@netless/app-media-player": "0.1.4", "@rollup/plugin-commonjs": "^20.0.0", "@rollup/plugin-node-resolve": "^13.0.4", "@rollup/plugin-url": "^6.1.0", "@sveltejs/vite-plugin-svelte": "1.0.0-next.30", "@tsconfig/svelte": "^2.0.1", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.4", "@types/uuid": "^8.3.1", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "@vitest/ui": "^0.14.1", "cypress": "^8.7.0", "dotenv": "^10.0.0", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^3.2.0", "jsdom": "^19.0.0", "jspdf": "^2.5.1", "less": "^4.1.1", "prettier": "^2.3.2", "prettier-plugin-svelte": "^2.4.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^3.14.1", "side-effect-manager": "0.1.5", "svelte": "^3.42.4", "typescript": "^4.5.5", "vite": "^2.9.9", "vitest": "^0.14.1", "white-web-sdk": "^2.16.53" } };
19648
19666
  this.emitter = callbacks$1;
19649
19667
  this.viewMode = ViewMode.Broadcaster;
19650
19668
  this.isReplay = isPlayer(this.displayer);
19651
19669
  this._cursorUIDs = [];
19652
19670
  this.containerSizeRatio = _WindowManager.containerSizeRatio;
19653
19671
  _WindowManager.displayer = context.displayer;
19654
- window.NETLESS_DEPS = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "0.3.0", "emittery": "^0.9.2", "lodash": "^4.17.21", "p-retry": "^4.6.1", "uuid": "^7.0.3", "video.js": ">=7" }, "peerDependencies": { "jspdf": "2.5.1", "white-web-sdk": "^2.16.52" }, "devDependencies": { "@hyrious/dts": "^0.2.2", "@netless/app-docs-viewer": "^0.2.19", "@netless/app-media-player": "0.1.4", "@rollup/plugin-commonjs": "^20.0.0", "@rollup/plugin-node-resolve": "^13.0.4", "@rollup/plugin-url": "^6.1.0", "@sveltejs/vite-plugin-svelte": "1.0.0-next.30", "@tsconfig/svelte": "^2.0.1", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.4", "@types/uuid": "^8.3.1", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "@vitest/ui": "^0.14.1", "cypress": "^8.7.0", "dotenv": "^10.0.0", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^3.2.0", "jsdom": "^19.0.0", "jspdf": "^2.5.1", "less": "^4.1.1", "prettier": "^2.3.2", "prettier-plugin-svelte": "^2.4.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^3.14.1", "side-effect-manager": "0.1.5", "svelte": "^3.42.4", "typescript": "^4.5.5", "vite": "^2.9.9", "vitest": "^0.14.1", "white-web-sdk": "^2.16.52" } };
19672
+ window.NETLESS_DEPS = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "0.3.0", "emittery": "^0.9.2", "lodash": "^4.17.21", "p-retry": "^4.6.1", "uuid": "^7.0.3", "video.js": ">=7" }, "peerDependencies": { "jspdf": "2.5.1", "white-web-sdk": "^2.16.53" }, "devDependencies": { "@hyrious/dts": "^0.2.2", "@netless/app-docs-viewer": "^0.2.19", "@netless/app-media-player": "0.1.4", "@rollup/plugin-commonjs": "^20.0.0", "@rollup/plugin-node-resolve": "^13.0.4", "@rollup/plugin-url": "^6.1.0", "@sveltejs/vite-plugin-svelte": "1.0.0-next.30", "@tsconfig/svelte": "^2.0.1", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.4", "@types/uuid": "^8.3.1", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "@vitest/ui": "^0.14.1", "cypress": "^8.7.0", "dotenv": "^10.0.0", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^3.2.0", "jsdom": "^19.0.0", "jspdf": "^2.5.1", "less": "^4.1.1", "prettier": "^2.3.2", "prettier-plugin-svelte": "^2.4.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^3.14.1", "side-effect-manager": "0.1.5", "svelte": "^3.42.4", "typescript": "^4.5.5", "vite": "^2.9.9", "vitest": "^0.14.1", "white-web-sdk": "^2.16.53" } };
19673
+ }
19674
+ get Logger() {
19675
+ return this._roomLogger;
19655
19676
  }
19656
19677
  static onCreate(manager) {
19657
19678
  _WindowManager._resolve(manager);
@@ -19676,6 +19697,9 @@ const _WindowManager = class extends InvisiblePlugin {
19676
19697
  room.disableSerialization = false;
19677
19698
  }
19678
19699
  manager = await this.initManager(room);
19700
+ if (manager) {
19701
+ manager._roomLogger = room.logger;
19702
+ }
19679
19703
  }
19680
19704
  if (_WindowManager.isCreated) {
19681
19705
  throw new Error("[WindowManager]: Already created cannot be created again");