@netless/window-manager 1.0.0-canary.5 → 1.0.0-canary.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.es.js CHANGED
@@ -1033,11 +1033,13 @@ class AppContext {
1033
1033
  view = this.appProxy.createAppDir();
1034
1034
  }
1035
1035
  const viewWrapper = document.createElement("div");
1036
+ this._viewWrapper = viewWrapper;
1036
1037
  viewWrapper.className = "window-manager-view-wrapper";
1037
1038
  (_a = this.box.$content.parentElement) == null ? void 0 : _a.appendChild(viewWrapper);
1038
1039
  const removeViewWrapper = () => {
1039
1040
  var _a2;
1040
1041
  (_a2 = this.box.$content.parentElement) == null ? void 0 : _a2.removeChild(viewWrapper);
1042
+ this._viewWrapper = void 0;
1041
1043
  };
1042
1044
  view.divElement = viewWrapper;
1043
1045
  if (this.isAddApp) {
@@ -1297,14 +1299,12 @@ class AppViewSync {
1297
1299
  this.synchronizer.setRect(rect);
1298
1300
  }
1299
1301
  }));
1300
- if (!this.appProxy.size$.value) {
1301
- this.appProxy.storeSize({
1302
- id: this.appProxy.uid,
1303
- width: box.contentStageRect.width,
1304
- height: box.contentStageRect.height
1305
- });
1306
- }
1307
1302
  }
1303
+ combine([this.appProxy.camera$, this.appProxy.size$]).subscribe(([camera, size2]) => {
1304
+ if (camera && size2) {
1305
+ this.synchronizer.onRemoteUpdate(camera, size2);
1306
+ }
1307
+ });
1308
1308
  }
1309
1309
  destroy() {
1310
1310
  this.sem.flushAll();
@@ -1653,12 +1653,43 @@ class AppProxy {
1653
1653
  });
1654
1654
  });
1655
1655
  combine([this.box$, this.view$]).subscribe(([box, view]) => {
1656
+ var _a2, _b;
1656
1657
  if (box && view) {
1657
- const appViewSync = new AppViewSync(this);
1658
- this.appViewSync = appViewSync;
1659
- this.sideEffectManager.add(() => () => appViewSync.destroy());
1658
+ if (!this.camera$.value) {
1659
+ this.storeCamera({
1660
+ centerX: 0,
1661
+ centerY: 0,
1662
+ scale: 1,
1663
+ id: this.uid
1664
+ });
1665
+ }
1666
+ if (!this.size$.value && box.contentStageRect) {
1667
+ this.storeSize({
1668
+ id: this.uid,
1669
+ width: (_a2 = box.contentStageRect) == null ? void 0 : _a2.width,
1670
+ height: (_b = box.contentStageRect) == null ? void 0 : _b.height
1671
+ });
1672
+ }
1673
+ this.appViewSync = new AppViewSync(this);
1674
+ this.sideEffectManager.add(() => () => {
1675
+ var _a3;
1676
+ return (_a3 = this.appViewSync) == null ? void 0 : _a3.destroy();
1677
+ });
1660
1678
  }
1661
1679
  });
1680
+ this.sideEffectManager.add(() => emitter.on("memberStateChange", (memberState) => {
1681
+ var _a2, _b;
1682
+ const needPointerEventsNone = memberState.currentApplianceName === "clicker";
1683
+ if (needPointerEventsNone) {
1684
+ if ((_a2 = this.appContext) == null ? void 0 : _a2._viewWrapper) {
1685
+ this.appContext._viewWrapper.style.pointerEvents = "none";
1686
+ }
1687
+ } else {
1688
+ if ((_b = this.appContext) == null ? void 0 : _b._viewWrapper) {
1689
+ this.appContext._viewWrapper.style.pointerEvents = "auto";
1690
+ }
1691
+ }
1692
+ }));
1662
1693
  }
1663
1694
  createAppDir() {
1664
1695
  const scenePath = this.scenePath || this.appScenePath;
@@ -2555,6 +2586,9 @@ class AppManager {
2555
2586
  emitter.emit("roomMembersChange", this.members);
2556
2587
  }
2557
2588
  emitter.emit("observerIdChange", this.displayer.observerId);
2589
+ if (state.memberState) {
2590
+ emitter.emit("memberStateChange", toJS(state.memberState));
2591
+ }
2558
2592
  };
2559
2593
  this.displayerWritableListener = (isReadonly) => {
2560
2594
  var _a, _b;
@@ -15461,7 +15495,7 @@ const reconnectRefresher = new ReconnectRefresher({ emitter });
15461
15495
  const _WindowManager = class extends InvisiblePlugin {
15462
15496
  constructor(context) {
15463
15497
  super(context);
15464
- this.version = "1.0.0-canary.5";
15498
+ this.version = "1.0.0-canary.6";
15465
15499
  this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "1.0.0-alpha.13", "emittery": "^0.9.2", "lodash": "^4.17.21", "p-retry": "^4.6.1", "side-effect-manager": "^1.1.0", "uuid": "^7.0.3", "value-enhancer": "^1.2.1", "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", "@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", "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.14.1", "white-web-sdk": "2.16.10" } };
15466
15500
  this.emitter = callbacks$1;
15467
15501
  this.viewMode = ViewMode.Broadcaster;