@netless/window-manager 1.0.7-beta.8 → 1.0.8

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
@@ -1,6 +1,6 @@
1
1
  import pRetry from "p-retry";
2
2
  import Emittery from "emittery";
3
- import { debounce, isEqual, omit, isObject, has, get, size as size$1, mapValues, noop as noop$2, isEmpty, pick, isInteger, orderBy, isFunction, isNumber, isNull } from "lodash";
3
+ import { debounce, isObject, has, get, size as size$1, mapValues, noop as noop$2, isEmpty, omit, pick, isEqual, isInteger, orderBy, isFunction, isNumber, isNull } from "lodash";
4
4
  import { ScenePathType, UpdateEventKind, listenUpdated, unlistenUpdated, reaction, autorun, toJS, listenDisposed, unlistenDisposed, WhiteVersion, ApplianceNames, isRoom, ViewMode, AnimationMode, isPlayer, RoomPhase, PlayerPhase, InvisiblePlugin } from "white-web-sdk";
5
5
  import { v4 } from "uuid";
6
6
  import { ResizeObserver as ResizeObserver$3 } from "@juggle/resize-observer";
@@ -466,14 +466,6 @@ class AppListeners {
466
466
  this.setMainViewScenePathHandler(data.payload);
467
467
  break;
468
468
  }
469
- case Events.MoveCamera: {
470
- this.moveCameraHandler(data.payload);
471
- break;
472
- }
473
- case Events.MoveCameraToContain: {
474
- this.moveCameraToContainHandler(data.payload);
475
- break;
476
- }
477
469
  case Events.CursorMove: {
478
470
  this.cursorMoveHandler(data.payload);
479
471
  break;
@@ -513,14 +505,6 @@ class AppListeners {
513
505
  setViewFocusScenePath(this.manager.mainView, nextScenePath);
514
506
  callbacks$1.emit("mainViewScenePathChange", nextScenePath);
515
507
  };
516
- this.moveCameraHandler = (payload) => {
517
- if (isEqual(omit(payload, ["animationMode"]), { ...this.manager.mainView.camera }))
518
- return;
519
- this.manager.mainView.moveCamera(payload);
520
- };
521
- this.moveCameraToContainHandler = (payload) => {
522
- this.manager.mainView.moveCameraToContain(payload);
523
- };
524
508
  this.cursorMoveHandler = (payload) => {
525
509
  internalEmitter.emit("cursorMove", payload);
526
510
  };
@@ -6992,9 +6976,8 @@ function getExtendClass$1(baseClass, extendClass) {
6992
6976
  default:
6993
6977
  return baseClass;
6994
6978
  }
6995
- } else {
6996
- return baseClass;
6997
6979
  }
6980
+ return baseClass;
6998
6981
  }
6999
6982
  var Fields = /* @__PURE__ */ ((Fields2) => {
7000
6983
  Fields2["Apps"] = "apps";
@@ -8517,8 +8500,12 @@ class AppManager {
8517
8500
  async onCreated() {
8518
8501
  var _a;
8519
8502
  if (Object.keys(this.attributes.apps).length && this.store.focus) {
8503
+ this._focusAppId = this.store.focus;
8520
8504
  await new Promise((resolve) => {
8521
8505
  this._focusAppCreatedResolve = resolve;
8506
+ this._resolveTimer = setTimeout(() => {
8507
+ resolve(this.appProxies.get(this._focusAppId || ""));
8508
+ }, 500);
8522
8509
  }).then(() => {
8523
8510
  this.focusByAttributes(this.attributes.apps);
8524
8511
  });
@@ -8630,7 +8617,10 @@ class AppManager {
8630
8617
  id2,
8631
8618
  false
8632
8619
  );
8633
- if (appProxy && this.store.focus === id2 && this._focusAppCreatedResolve) {
8620
+ if (appProxy && this._focusAppId === id2 && this._focusAppCreatedResolve) {
8621
+ if (this._resolveTimer) {
8622
+ clearTimeout(this._resolveTimer);
8623
+ }
8634
8624
  this._focusAppCreatedResolve(appProxy);
8635
8625
  }
8636
8626
  return appProxy;
@@ -8855,7 +8845,11 @@ class AppManager {
8855
8845
  this.sideEffectManager.flushAll();
8856
8846
  this._prevFocused = void 0;
8857
8847
  this._prevSceneIndex = void 0;
8848
+ if (this._resolveTimer) {
8849
+ clearTimeout(this._resolveTimer);
8850
+ }
8858
8851
  this._focusAppCreatedResolve = void 0;
8852
+ this._resolveTimer = void 0;
8859
8853
  }
8860
8854
  }
8861
8855
  AppManager.kind = "AppManager";
@@ -19636,15 +19630,14 @@ function getExtendClass(baseClass, extendClass) {
19636
19630
  default:
19637
19631
  return baseClass;
19638
19632
  }
19639
- } else {
19640
- return baseClass;
19641
19633
  }
19634
+ return baseClass;
19642
19635
  }
19643
19636
  const reconnectRefresher = new ReconnectRefresher({ emitter: internalEmitter });
19644
19637
  const _WindowManager = class extends InvisiblePlugin {
19645
19638
  constructor(context) {
19646
19639
  super(context);
19647
- this.version = "1.0.7-beta.8";
19640
+ this.version = "1.0.8";
19648
19641
  this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "0.3.0-beta.14", "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" } };
19649
19642
  this.emitter = callbacks$1;
19650
19643
  this.viewMode = ViewMode.Broadcaster;
@@ -20257,25 +20250,21 @@ const _WindowManager = class extends InvisiblePlugin {
20257
20250
  }
20258
20251
  }
20259
20252
  moveCamera(camera) {
20260
- var _a;
20261
20253
  const pureCamera = omit(camera, ["animationMode"]);
20262
20254
  const mainViewCamera = { ...this.mainView.camera };
20263
20255
  if (isEqual({ ...mainViewCamera, ...pureCamera }, mainViewCamera))
20264
20256
  return;
20265
20257
  this.mainView.moveCamera(camera);
20266
- (_a = this.appManager) == null ? void 0 : _a.dispatchInternalEvent(Events.MoveCamera, camera);
20267
20258
  setTimeout(() => {
20268
- var _a2;
20269
- (_a2 = this.appManager) == null ? void 0 : _a2.mainViewProxy.setCameraAndSize();
20259
+ var _a;
20260
+ (_a = this.appManager) == null ? void 0 : _a.mainViewProxy.setCameraAndSize();
20270
20261
  }, 500);
20271
20262
  }
20272
20263
  moveCameraToContain(rectangle) {
20273
- var _a;
20274
20264
  this.mainView.moveCameraToContain(rectangle);
20275
- (_a = this.appManager) == null ? void 0 : _a.dispatchInternalEvent(Events.MoveCameraToContain, rectangle);
20276
20265
  setTimeout(() => {
20277
- var _a2;
20278
- (_a2 = this.appManager) == null ? void 0 : _a2.mainViewProxy.setCameraAndSize();
20266
+ var _a;
20267
+ (_a = this.appManager) == null ? void 0 : _a.mainViewProxy.setCameraAndSize();
20279
20268
  }, 500);
20280
20269
  }
20281
20270
  convertToPointInWorld(point) {