@netless/window-manager 1.0.13-test.4 → 1.0.13-test.6

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
@@ -464,7 +464,7 @@ class AppListeners {
464
464
  break;
465
465
  }
466
466
  case Events.SetMainViewScenePath: {
467
- console.log("[window-manager] mainMagixEventListener ", JSON.stringify(data.payload));
467
+ console.log("[window-manager] mainMagixEventListener " + JSON.stringify(data.payload));
468
468
  this.setMainViewScenePathHandler(data.payload);
469
469
  break;
470
470
  }
@@ -5711,7 +5711,7 @@ class LocalConsole {
5711
5711
  if (args === null) {
5712
5712
  return;
5713
5713
  }
5714
- console.log(`[window-manager][${this.name}]:`, ...args);
5714
+ console.log(`[window-manager][${this.name}]: ${args.join(", ")}`);
5715
5715
  }
5716
5716
  log(...args) {
5717
5717
  const ms = this.debounceTime;
@@ -5723,7 +5723,7 @@ class LocalConsole {
5723
5723
  this.flushTimer = setTimeout(() => this.flush(), ms);
5724
5724
  return;
5725
5725
  }
5726
- console.log(`[window-manager][${this.name}]:`, ...args);
5726
+ console.log(`[window-manager][${this.name}]: ${args.join(", ")}`);
5727
5727
  }
5728
5728
  }
5729
5729
  const setupWrapper = (root) => {
@@ -7783,6 +7783,7 @@ const setDefaultCameraBound = (view) => {
7783
7783
  minContentMode: () => 0.1
7784
7784
  });
7785
7785
  };
7786
+ window.___local_log = window.___local_log || /* @__PURE__ */ new Set();
7786
7787
  class MainViewProxy {
7787
7788
  constructor(manager) {
7788
7789
  this.manager = manager;
@@ -7820,7 +7821,7 @@ class MainViewProxy {
7820
7821
  () => this.mainViewCamera,
7821
7822
  (camera) => {
7822
7823
  if (camera && camera.id !== this.manager.uid) {
7823
- console.log("[window-manager] cameraReaction ", JSON.stringify(camera), JSON.stringify(this.mainViewSize));
7824
+ console.log("[window-manager] cameraReaction " + JSON.stringify(camera) + JSON.stringify(this.mainViewSize));
7824
7825
  this.moveCameraToContian(this.mainViewSize);
7825
7826
  this.moveCamera(camera);
7826
7827
  }
@@ -7830,15 +7831,15 @@ class MainViewProxy {
7830
7831
  };
7831
7832
  this.sizeChangeHandler = debounce((size2) => {
7832
7833
  if (size2) {
7833
- console.log("[window-manager] sizeChangeHandler current size and camera", JSON.stringify(size2), JSON.stringify(this.mainViewCamera));
7834
7834
  this.moveCameraToContian(size2);
7835
7835
  this.moveCamera(this.mainViewCamera);
7836
+ console.log("[window-manager] sizeChangeHandler current size and camera" + JSON.stringify(size2) + JSON.stringify(this.mainViewCamera) + JSON.stringify(this.mainView.camera) + JSON.stringify(this.mainView.size));
7836
7837
  }
7837
7838
  this.ensureMainViewSize();
7838
7839
  }, 30);
7839
7840
  this.onUpdateContainerSizeRatio = () => {
7840
7841
  const size2 = this.store.getMainViewSize();
7841
- console.log("[window-manager] onUpdateContainerSizeRatio ", JSON.stringify(size2));
7842
+ console.log("[window-manager] onUpdateContainerSizeRatio " + JSON.stringify(size2));
7842
7843
  this.sizeChangeHandler(size2);
7843
7844
  };
7844
7845
  this.onCameraUpdatedByDevice = (camera) => {
@@ -8162,7 +8163,7 @@ class AppManager {
8162
8163
  sceneName = (_b = this.callbacksNode) == null ? void 0 : _b.scenes[nextIndex];
8163
8164
  }
8164
8165
  if (sceneName) {
8165
- console.log("[window-manager] onRemoveScenes setMainViewScenePath", `${ROOT_DIR}${sceneName}`);
8166
+ console.log(`[window-manager] onRemoveScenes setMainViewScenePath${ROOT_DIR}${sceneName}`);
8166
8167
  this.setMainViewScenePath(`${ROOT_DIR}${sceneName}`);
8167
8168
  }
8168
8169
  await this.setMainViewSceneIndex(nextIndex);
@@ -8740,11 +8741,7 @@ class AppManager {
8740
8741
  const hasRoot = this.hasRoot(mainView.divElement);
8741
8742
  const rect = this.getRectByDivElement(mainView.divElement);
8742
8743
  console.log(
8743
- "[window-manager] bindMainView hasRoot",
8744
- hasRoot,
8745
- JSON.stringify(rect),
8746
- window.outerHeight,
8747
- window.outerWidth,
8744
+ "[window-manager] bindMainView hasRoot" + hasRoot + JSON.stringify(rect) + window.outerHeight + window.outerWidth,
8748
8745
  (_b = (_a = window.visualViewport) == null ? void 0 : _a.width) != null ? _b : "null",
8749
8746
  (_d = (_c = window.visualViewport) == null ? void 0 : _c.height) != null ? _d : "null",
8750
8747
  (_f = (_e = window.visualViewport) == null ? void 0 : _e.offsetLeft) != null ? _f : "null",
@@ -8986,12 +8983,14 @@ class ContainerResizeObserver {
8986
8983
  return containerResizeObserver;
8987
8984
  }
8988
8985
  observePlaygroundSize(container, sizer, wrapper) {
8986
+ console.log(`[window-manager] observePlaygroundSize ${container.getBoundingClientRect(), sizer.getBoundingClientRect(), wrapper.getBoundingClientRect()}`);
8989
8987
  this.updateSizer(container.getBoundingClientRect(), sizer, wrapper);
8990
8988
  this.containerResizeObserver = new ResizeObserver$2((entries) => {
8991
8989
  var _a;
8992
8990
  const containerRect = (_a = entries[0]) == null ? void 0 : _a.contentRect;
8993
8991
  if (containerRect) {
8994
8992
  this.updateSizer(containerRect, sizer, wrapper);
8993
+ console.log(`[window-manager] containerResizeObserver ${containerRect}`);
8995
8994
  this.emitter.emit("playgroundSizeChange", containerRect);
8996
8995
  }
8997
8996
  });
@@ -9174,7 +9173,7 @@ const replaceRoomFunction = (room, manager) => {
9174
9173
  var _a;
9175
9174
  _scalePptToFit.call(room, ...args);
9176
9175
  if ((_a = manager.appManager) == null ? void 0 : _a.mainViewProxy) {
9177
- console.log("[window-manager] scalePptToFit ", JSON.stringify(args));
9176
+ console.log("[window-manager] scalePptToFit " + JSON.stringify(args));
9178
9177
  manager.appManager.mainViewProxy.setCameraAndSize();
9179
9178
  }
9180
9179
  };
@@ -19768,7 +19767,7 @@ const reconnectRefresher = new ReconnectRefresher({ emitter: internalEmitter });
19768
19767
  const _WindowManager = class extends InvisiblePlugin {
19769
19768
  constructor(context) {
19770
19769
  super(context);
19771
- this.version = "1.0.13-test.4";
19770
+ this.version = "1.0.13-test.5";
19772
19771
  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" } };
19773
19772
  this.emitter = callbacks$1;
19774
19773
  this.viewMode = ViewMode.Broadcaster;
@@ -19776,12 +19775,28 @@ const _WindowManager = class extends InvisiblePlugin {
19776
19775
  this._cursorUIDs = [];
19777
19776
  this.containerSizeRatio = _WindowManager.containerSizeRatio;
19778
19777
  this.visibleStateListener = () => {
19779
- console.log("[window-manager] visibleStateListener isVisible:", !document.hidden);
19778
+ console.log("[window-manager] visibleStateListener isVisible:" + !document.hidden);
19779
+ };
19780
+ this.onMainViewScenePathChangeHandler = (scenePath) => {
19781
+ const mainViewElement = this.mainView.divElement;
19782
+ if (mainViewElement) {
19783
+ const backgroundImage = mainViewElement.querySelector(".background img");
19784
+ if (backgroundImage) {
19785
+ const backgroundImageRect = backgroundImage == null ? void 0 : backgroundImage.getBoundingClientRect();
19786
+ const backgroundImageCSS = window.getComputedStyle(backgroundImage);
19787
+ const backgroundImageVisible = (backgroundImageRect == null ? void 0 : backgroundImageRect.width) > 0 && (backgroundImageRect == null ? void 0 : backgroundImageRect.height) > 0 && backgroundImageCSS.display !== "none";
19788
+ console.log("[window-manager] backgroundImageVisible" + backgroundImageVisible);
19789
+ return;
19790
+ }
19791
+ console.log("[window-manager] onMainViewScenePathChange" + scenePath + "backgroundImageVisible is not found");
19792
+ }
19793
+ console.log("[window-manager] onMainViewScenePathChange" + scenePath + "mainViewElement is not found");
19780
19794
  };
19781
19795
  _WindowManager.displayer = context.displayer;
19782
19796
  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" } };
19783
19797
  this.visibleStateListener();
19784
19798
  document.addEventListener("visibilitychange", this.visibleStateListener);
19799
+ this.emitter.on("mainViewScenePathChange", this.onMainViewScenePathChangeHandler);
19785
19800
  }
19786
19801
  get Logger() {
19787
19802
  return this._roomLogger;
@@ -19897,6 +19912,7 @@ const _WindowManager = class extends InvisiblePlugin {
19897
19912
  console.warn("[WindowManager]: indexedDB open failed");
19898
19913
  console.log(error);
19899
19914
  }
19915
+ manager.emitter.on("mainViewScenePathChange", manager.onMainViewScenePathChangeHandler);
19900
19916
  return manager;
19901
19917
  }
19902
19918
  static initManager(room) {
@@ -20458,6 +20474,7 @@ const _WindowManager = class extends InvisiblePlugin {
20458
20474
  }
20459
20475
  _WindowManager.params = void 0;
20460
20476
  document.removeEventListener("visibilitychange", this.visibleStateListener);
20477
+ this.emitter.off("mainViewScenePathChange", this.onMainViewScenePathChangeHandler);
20461
20478
  (_f = this._iframeBridge) == null ? void 0 : _f.destroy();
20462
20479
  this._iframeBridge = void 0;
20463
20480
  log("Destroyed");