@netless/window-manager 1.0.7-beta.3 → 1.0.7-beta.5

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,13 +5428,19 @@ class BoxManager {
5422
5428
  }
5423
5429
  }
5424
5430
  setBoxesStatus(status) {
5425
- this.teleBoxManager.setBoxesStatus(new Map(Object.entries(status != null ? 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);
5426
5435
  }
5427
5436
  setBoxStatus(appId, status) {
5428
5437
  this.teleBoxManager.update(appId, { boxStatus: status }, true);
5429
5438
  }
5430
5439
  setLastNotMinimizedBoxesStatus(status) {
5431
- this.teleBoxManager.setLastNotMinimizedBoxesStatus(new Map(Object.entries(status != null ? status : {})), true);
5440
+ const map = new Map(Object.entries(status != null ? status : {}));
5441
+ this.teleBoxManager.setLastNotMinimizedBoxesStatus(map, true);
5442
+ this.context.callbacks.emit("onLastNotMinimizedBoxesStatusChange", map);
5443
+ this.context.emitter.emit("lastNotMinimizedBoxesStatusChange", map);
5432
5444
  }
5433
5445
  setLastNotMinimizedBoxStatus(appId, status) {
5434
5446
  this.teleBoxManager.update(appId, { lastNotMinimizedBoxStatus: status }, true);
@@ -5448,7 +5460,8 @@ class BoxManager {
5448
5460
  prefersColorScheme: createTeleBoxManagerConfig == null ? void 0 : createTeleBoxManagerConfig.prefersColorScheme,
5449
5461
  useBoxesStatus: (createTeleBoxManagerConfig == null ? void 0 : createTeleBoxManagerConfig.useBoxesStatus) || false
5450
5462
  };
5451
- const manager = new TeleBoxManager(initManagerState);
5463
+ const TeleBoxManagerClass = getExtendClass$1(TeleBoxManager, WindowManager.extendClass);
5464
+ const manager = new TeleBoxManagerClass(initManagerState);
5452
5465
  if (this.teleBoxManager) {
5453
5466
  this.teleBoxManager.destroy();
5454
5467
  }
@@ -5461,7 +5474,8 @@ class BoxManager {
5461
5474
  }
5462
5475
  setCollectorContainer(container) {
5463
5476
  var _a;
5464
- const collector = new TeleBoxCollector({
5477
+ const TeleBoxCollectorClass = getExtendClass$1(TeleBoxCollector, WindowManager.extendClass);
5478
+ const collector = new TeleBoxCollectorClass({
5465
5479
  styles: (_a = this.createTeleBoxManagerConfig) == null ? void 0 : _a.collectorStyles
5466
5480
  }).mount(container);
5467
5481
  this.teleBoxManager.setCollector(collector);
@@ -6864,6 +6878,10 @@ function getExtendClass$1(baseClass, extendClass) {
6864
6878
  return (extendClass == null ? void 0 : extendClass.AppProxy) || AppProxy;
6865
6879
  case "AppContext":
6866
6880
  return (extendClass == null ? void 0 : extendClass.AppContext) || AppContext;
6881
+ case "TeleBoxManager":
6882
+ return (extendClass == null ? void 0 : extendClass.TeleBoxManager) || TeleBoxManager;
6883
+ case "TeleBoxCollector":
6884
+ return (extendClass == null ? void 0 : extendClass.TeleBoxCollector) || TeleBoxCollector;
6867
6885
  default:
6868
6886
  return baseClass;
6869
6887
  }
@@ -7191,6 +7209,9 @@ class AppProxy {
7191
7209
  this.notifyPageStateChange = debounce(() => {
7192
7210
  this.appEmitter.emit("pageStateChange", this.pageState);
7193
7211
  }, 50);
7212
+ this.notifyBoxStatusChange = (status) => {
7213
+ this.appEmitter.emit("boxStatusChange", { appId: this.id, status });
7214
+ };
7194
7215
  this.kind = params.kind;
7195
7216
  this.id = appId;
7196
7217
  this.stateKey = `${this.id}_state`;
@@ -8100,6 +8121,17 @@ class AppManager {
8100
8121
  this.dispatchInternalEvent(Events.AppBoxStateChange, payload);
8101
8122
  callbacks$1.emit("onBoxStateChange", payload);
8102
8123
  };
8124
+ this.notifyBoxesStatusChange = debounce(() => {
8125
+ const entries = Object.entries(this.attributes.boxesStatus);
8126
+ if (entries.length > 0) {
8127
+ entries.forEach(([appId, status]) => {
8128
+ const appProxy = this.appProxies.get(appId);
8129
+ if (appProxy) {
8130
+ appProxy.notifyBoxStatusChange(status);
8131
+ }
8132
+ });
8133
+ }
8134
+ }, 50);
8103
8135
  this.addBoxesStatusChangeListener = () => {
8104
8136
  this.refresher.add("boxesStatus", () => {
8105
8137
  return safeListenPropsUpdated(
@@ -8107,6 +8139,7 @@ class AppManager {
8107
8139
  () => {
8108
8140
  var _a;
8109
8141
  (_a = this.boxManager) == null ? void 0 : _a.setBoxesStatus(this.attributes.boxesStatus);
8142
+ this.notifyBoxesStatusChange();
8110
8143
  }
8111
8144
  );
8112
8145
  });
@@ -8115,7 +8148,9 @@ class AppManager {
8115
8148
  () => this.attributes.lastNotMinimizedBoxesStatus,
8116
8149
  () => {
8117
8150
  var _a;
8118
- (_a = this.boxManager) == null ? void 0 : _a.setLastNotMinimizedBoxesStatus(this.attributes.lastNotMinimizedBoxesStatus);
8151
+ (_a = this.boxManager) == null ? void 0 : _a.setLastNotMinimizedBoxesStatus(
8152
+ this.attributes.lastNotMinimizedBoxesStatus
8153
+ );
8119
8154
  }
8120
8155
  );
8121
8156
  });
@@ -19453,6 +19488,10 @@ function getExtendClass(baseClass, extendClass) {
19453
19488
  return (extendClass == null ? void 0 : extendClass.AppProxy) || AppProxy;
19454
19489
  case "AppContext":
19455
19490
  return (extendClass == null ? void 0 : extendClass.AppContext) || AppContext;
19491
+ case "TeleBoxManager":
19492
+ return (extendClass == null ? void 0 : extendClass.TeleBoxManager) || TeleBoxManager;
19493
+ case "TeleBoxCollector":
19494
+ return (extendClass == null ? void 0 : extendClass.TeleBoxCollector) || TeleBoxCollector;
19456
19495
  default:
19457
19496
  return baseClass;
19458
19497
  }
@@ -19461,7 +19500,7 @@ const reconnectRefresher = new ReconnectRefresher({ emitter: internalEmitter });
19461
19500
  const _WindowManager = class extends InvisiblePlugin {
19462
19501
  constructor(context) {
19463
19502
  super(context);
19464
- this.version = "1.0.7-beta.3";
19503
+ this.version = "1.0.7-beta.5";
19465
19504
  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" } };
19466
19505
  this.emitter = callbacks$1;
19467
19506
  this.viewMode = ViewMode.Broadcaster;
@@ -20277,5 +20316,5 @@ WindowManager.containerSizeRatio = DEFAULT_CONTAINER_RATIO;
20277
20316
  WindowManager.isCreated = false;
20278
20317
  WindowManager._resolve = (_manager) => void 0;
20279
20318
  setupBuiltin();
20280
- export { AppContext, AppCreateError, AppManager, AppManagerNotInitError, AppNotRegisterError, AppProxy, AttributesDelegate, BindContainerRoomPhaseInvalidError, BoxManager, BoxManagerNotFoundError, BoxNotCreatedError, BuiltinApps, CursorManager, ExtendPlugin, ExtendPluginManager, InvalidScenePath, ParamsInvalidError, WhiteWebSDKInvalidError, WindowManager, calculateNextIndex, getExtendClass, reconnectRefresher };
20319
+ export { AppContext, AppCreateError, AppManager, AppManagerNotInitError, AppNotRegisterError, AppProxy, AttributesDelegate, BindContainerRoomPhaseInvalidError, BoxManager, BoxManagerNotFoundError, BoxNotCreatedError, BuiltinApps, CursorManager, ExtendPlugin, ExtendPluginManager, InvalidScenePath, ParamsInvalidError, TeleBoxCollector, TeleBoxManager, WhiteWebSDKInvalidError, WindowManager, calculateNextIndex, getExtendClass, reconnectRefresher };
20281
20320
  //# sourceMappingURL=index.mjs.map