@netless/window-manager 0.4.25 → 0.4.26

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.es.js CHANGED
@@ -1264,7 +1264,10 @@ class AppProxy {
1264
1264
  var _a3;
1265
1265
  const fullPath = (_a3 = this.appAttributes) == null ? void 0 : _a3.fullPath;
1266
1266
  this.setFocusScenePathHandler(fullPath);
1267
- this.notifyPageStateChange();
1267
+ if (this._prevFullPath !== fullPath) {
1268
+ this.notifyPageStateChange();
1269
+ this._prevFullPath = fullPath;
1270
+ }
1268
1271
  });
1269
1272
  });
1270
1273
  };
@@ -1555,6 +1558,7 @@ class AppProxy {
1555
1558
  (_b = this.manager.refresher) == null ? void 0 : _b.remove(this.id);
1556
1559
  (_c = this.manager.refresher) == null ? void 0 : _c.remove(this.stateKey);
1557
1560
  (_d = this.manager.refresher) == null ? void 0 : _d.remove(`${this.id}-fullPath`);
1561
+ this._prevFullPath = void 0;
1558
1562
  }
1559
1563
  close() {
1560
1564
  return this.destroy(true, true, false);
@@ -1683,6 +1687,11 @@ class MainViewProxy {
1683
1687
  this.sideEffectManager.add(() => {
1684
1688
  return emitter.on("containerSizeRatioUpdate", this.onUpdateContainerSizeRatio);
1685
1689
  });
1690
+ this.sideEffectManager.add(() => {
1691
+ return emitter.on("startReconnect", () => {
1692
+ this.mainView.release();
1693
+ });
1694
+ });
1686
1695
  }
1687
1696
  ensureCameraAndSize() {
1688
1697
  if (!this.mainViewCamera || !this.mainViewSize) {
@@ -1696,6 +1705,9 @@ class MainViewProxy {
1696
1705
  get mainViewSize() {
1697
1706
  return this.store.getMainViewSize();
1698
1707
  }
1708
+ get didRelease() {
1709
+ return get(this.view, ["didRelease"]);
1710
+ }
1699
1711
  moveCameraSizeByAttributes() {
1700
1712
  this.moveCameraToContian(this.mainViewSize);
1701
1713
  this.moveCamera(this.mainViewCamera);
@@ -1728,16 +1740,22 @@ class MainViewProxy {
1728
1740
  return mainView;
1729
1741
  }
1730
1742
  onReconnect() {
1731
- const mainViewScenePath = this.store.getMainViewScenePath();
1732
- if (mainViewScenePath) {
1733
- setViewFocusScenePath(this.view, mainViewScenePath);
1743
+ if (this.didRelease) {
1744
+ this.rebind();
1745
+ } else {
1746
+ const mainViewScenePath = this.store.getMainViewScenePath();
1747
+ if (mainViewScenePath) {
1748
+ setViewFocusScenePath(this.view, mainViewScenePath);
1749
+ }
1734
1750
  }
1735
1751
  }
1736
1752
  rebind() {
1737
1753
  const divElement = this.mainView.divElement;
1738
1754
  const disableCameraTransform = this.mainView.disableCameraTransform;
1739
1755
  this.stop();
1740
- this.mainView.release();
1756
+ if (!this.didRelease) {
1757
+ this.mainView.release();
1758
+ }
1741
1759
  this.removeMainViewListener();
1742
1760
  this.mainView = this.createMainView();
1743
1761
  this.mainView.disableCameraTransform = disableCameraTransform;
@@ -5573,6 +5591,9 @@ class ReconnectRefresher {
5573
5591
  this.reactors = /* @__PURE__ */ new Map();
5574
5592
  this.disposers = /* @__PURE__ */ new Map();
5575
5593
  this.onPhaseChanged = (phase) => {
5594
+ if (phase === RoomPhase.Reconnecting) {
5595
+ this.ctx.emitter.emit("startReconnect");
5596
+ }
5576
5597
  if (phase === RoomPhase.Connected && this.phase === RoomPhase.Reconnecting) {
5577
5598
  this.onReconnected();
5578
5599
  }
@@ -5589,7 +5610,7 @@ class ReconnectRefresher {
5589
5610
  this.disposers.set(id2, func());
5590
5611
  }
5591
5612
  });
5592
- this.ctx.emitter.emit("onReconnected", void 0);
5613
+ this.ctx.emitter.emit("onReconnected");
5593
5614
  };
5594
5615
  }
5595
5616
  setRoom(room) {
@@ -14884,7 +14905,7 @@ const reconnectRefresher = new ReconnectRefresher({ emitter });
14884
14905
  const _WindowManager = class extends InvisiblePlugin {
14885
14906
  constructor(context) {
14886
14907
  super(context);
14887
- this.version = "0.4.25";
14908
+ this.version = "0.4.26";
14888
14909
  this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "0.2.26", "emittery": "^0.9.2", "lodash": "^4.17.21", "p-retry": "^4.6.1", "side-effect-manager": "^0.1.5", "uuid": "^7.0.3", "video.js": ">=7" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "^0.2.9", "@netless/app-media-player": "0.1.0-beta.5", "@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.22", "@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", "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", "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", "svelte": "^3.42.4", "typescript": "^4.5.5", "vite": "^2.5.3", "vitest": "^0.12.4", "white-web-sdk": "2.16.10" } };
14889
14910
  this.emitter = callbacks$1;
14890
14911
  this.viewMode = ViewMode.Broadcaster;