@netless/window-manager 1.0.7-beta.4 → 1.0.7-beta.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
@@ -1000,6 +1000,12 @@ class AppContext {
1000
1000
  this.getWindowManager = () => {
1001
1001
  return this.manager.windowManger;
1002
1002
  };
1003
+ this.getBoxStatus = () => {
1004
+ return this.manager.store.getBoxStatus(this.appId);
1005
+ };
1006
+ this.getLastNotMinimizedBoxStatus = () => {
1007
+ return this.manager.store.getLastNotMinimizedBoxStatus(this.appId);
1008
+ };
1003
1009
  this.getDisplayer = () => {
1004
1010
  return this.manager.displayer;
1005
1011
  };
@@ -5422,19 +5428,16 @@ class BoxManager {
5422
5428
  }
5423
5429
  }
5424
5430
  setBoxesStatus(status) {
5425
- this.teleBoxManager.setBoxesStatus(new Map(Object.entries(status != null ? status : {})), true);
5426
- }
5427
- setBoxStatus(appId, status) {
5428
- this.teleBoxManager.update(appId, { boxStatus: status }, true);
5431
+ const map = new Map(Object.entries(status != null ? status : {}));
5432
+ this.teleBoxManager.setBoxesStatus(map, true);
5433
+ this.context.callbacks.emit("onBoxesStatusChange", map);
5434
+ this.context.emitter.emit("boxesStatusChange", map);
5429
5435
  }
5430
5436
  setLastNotMinimizedBoxesStatus(status) {
5431
- this.teleBoxManager.setLastNotMinimizedBoxesStatus(
5432
- new Map(Object.entries(status != null ? status : {})),
5433
- true
5434
- );
5435
- }
5436
- setLastNotMinimizedBoxStatus(appId, status) {
5437
- this.teleBoxManager.update(appId, { lastNotMinimizedBoxStatus: status }, true);
5437
+ const map = new Map(Object.entries(status != null ? status : {}));
5438
+ this.teleBoxManager.setLastNotMinimizedBoxesStatus(map, true);
5439
+ this.context.callbacks.emit("onLastNotMinimizedBoxesStatusChange", map);
5440
+ this.context.emitter.emit("lastNotMinimizedBoxesStatusChange", map);
5438
5441
  }
5439
5442
  setupBoxManager(createTeleBoxManagerConfig) {
5440
5443
  const root = WindowManager.wrapper ? WindowManager.wrapper : document.body;
@@ -7200,6 +7203,9 @@ class AppProxy {
7200
7203
  this.notifyPageStateChange = debounce(() => {
7201
7204
  this.appEmitter.emit("pageStateChange", this.pageState);
7202
7205
  }, 50);
7206
+ this.notifyBoxStatusChange = (status) => {
7207
+ this.appEmitter.emit("boxStatusChange", { appId: this.id, status });
7208
+ };
7203
7209
  this.kind = params.kind;
7204
7210
  this.id = appId;
7205
7211
  this.stateKey = `${this.id}_state`;
@@ -8109,6 +8115,17 @@ class AppManager {
8109
8115
  this.dispatchInternalEvent(Events.AppBoxStateChange, payload);
8110
8116
  callbacks$1.emit("onBoxStateChange", payload);
8111
8117
  };
8118
+ this.notifyBoxesStatusChange = debounce(() => {
8119
+ const entries = Object.entries(this.attributes.boxesStatus);
8120
+ if (entries.length > 0) {
8121
+ entries.forEach(([appId, status]) => {
8122
+ const appProxy = this.appProxies.get(appId);
8123
+ if (appProxy) {
8124
+ appProxy.notifyBoxStatusChange(status);
8125
+ }
8126
+ });
8127
+ }
8128
+ }, 50);
8112
8129
  this.addBoxesStatusChangeListener = () => {
8113
8130
  this.refresher.add("boxesStatus", () => {
8114
8131
  return safeListenPropsUpdated(
@@ -8116,6 +8133,7 @@ class AppManager {
8116
8133
  () => {
8117
8134
  var _a;
8118
8135
  (_a = this.boxManager) == null ? void 0 : _a.setBoxesStatus(this.attributes.boxesStatus);
8136
+ this.notifyBoxesStatusChange();
8119
8137
  }
8120
8138
  );
8121
8139
  });
@@ -19476,7 +19494,7 @@ const reconnectRefresher = new ReconnectRefresher({ emitter: internalEmitter });
19476
19494
  const _WindowManager = class extends InvisiblePlugin {
19477
19495
  constructor(context) {
19478
19496
  super(context);
19479
- this.version = "1.0.7-beta.4";
19497
+ this.version = "1.0.7-beta.6";
19480
19498
  this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "0.3.0-beta.10", "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" } };
19481
19499
  this.emitter = callbacks$1;
19482
19500
  this.viewMode = ViewMode.Broadcaster;
@@ -19901,13 +19919,13 @@ const _WindowManager = class extends InvisiblePlugin {
19901
19919
  var _a;
19902
19920
  if (!this.canOperate)
19903
19921
  return;
19904
- (_a = this.boxManager) == null ? void 0 : _a.setBoxStatus(boxId, boxStatus);
19922
+ (_a = this.appManager) == null ? void 0 : _a.store.setBoxStatus(boxId, boxStatus);
19905
19923
  }
19906
19924
  setLastNotMinimizedBoxStatus(boxId, lastNotMinimizedBoxStatus) {
19907
19925
  var _a;
19908
19926
  if (!this.canOperate)
19909
19927
  return;
19910
- (_a = this.boxManager) == null ? void 0 : _a.setLastNotMinimizedBoxStatus(boxId, lastNotMinimizedBoxStatus);
19928
+ (_a = this.appManager) == null ? void 0 : _a.store.setLastNotMinimizedBoxStatus(boxId, lastNotMinimizedBoxStatus);
19911
19929
  }
19912
19930
  setFullscreen(fullscreen) {
19913
19931
  var _a;