@netless/window-manager 0.4.65 → 0.4.66

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
@@ -22,7 +22,7 @@ import Emittery from "emittery";
22
22
  import { debounce, isEqual, omit, isObject, has, get, size as size$1, mapValues, noop as noop$2, pick, isEmpty, isInteger, orderBy, isFunction, isNumber, isNull } from "lodash";
23
23
  import { ScenePathType, UpdateEventKind, listenUpdated, unlistenUpdated, reaction, autorun, toJS, listenDisposed, unlistenDisposed, ViewMode, AnimationMode, isPlayer, isRoom, WhiteVersion, ApplianceNames, RoomPhase, PlayerPhase, InvisiblePlugin } from "white-web-sdk";
24
24
  import { v4 } from "uuid";
25
- import { genUID, SideEffectManager } from "side-effect-manager";
25
+ import { genUID as genUID$1, SideEffectManager as SideEffectManager$1 } from "side-effect-manager";
26
26
  import { ResizeObserver as ResizeObserver$3 } from "@juggle/resize-observer";
27
27
  import p$1 from "video.js";
28
28
  var Events = /* @__PURE__ */ ((Events2) => {
@@ -691,12 +691,12 @@ function isRef(e2) {
691
691
  return Boolean(has(e2, "__isRef"));
692
692
  }
693
693
  function makeRef(v2) {
694
- return { k: genUID(), v: v2, __isRef: true };
694
+ return { k: genUID$1(), v: v2, __isRef: true };
695
695
  }
696
696
  const STORAGE_NS = "_WM-STORAGE_";
697
697
  class Storage {
698
698
  constructor(context, id2, defaultState) {
699
- this._sideEffect = new SideEffectManager();
699
+ this._sideEffect = new SideEffectManager$1();
700
700
  this._destroyed = false;
701
701
  this._refMap = /* @__PURE__ */ new WeakMap();
702
702
  this._lastValue = /* @__PURE__ */ new Map();
@@ -1073,6 +1073,12 @@ class AppContext {
1073
1073
  get pageState() {
1074
1074
  return this.appProxy.pageState;
1075
1075
  }
1076
+ get kind() {
1077
+ return this.appProxy.kind;
1078
+ }
1079
+ dispatchAppEvent(type, value) {
1080
+ internalEmitter.emit(`custom-${this.kind}`, { kind: this.kind, appId: this.appId, type, value });
1081
+ }
1076
1082
  }
1077
1083
  class AppPageStateImpl {
1078
1084
  constructor(params) {
@@ -1364,10 +1370,11 @@ class AppProxy {
1364
1370
  });
1365
1371
  (_b = this.manager.refresher) == null ? void 0 : _b.add(this.stateKey, () => {
1366
1372
  return autorun(() => {
1367
- var _a3, _b2, _c2;
1373
+ var _a3, _b2, _c2, _d;
1368
1374
  const appState = (_a3 = this.appAttributes) == null ? void 0 : _a3.state;
1369
1375
  if ((appState == null ? void 0 : appState.zIndex) > 0 && appState.zIndex !== ((_b2 = this.box) == null ? void 0 : _b2.zIndex)) {
1370
1376
  (_c2 = this.boxManager) == null ? void 0 : _c2.setZIndex(appId2, appState.zIndex);
1377
+ (_d = this.boxManager) == null ? void 0 : _d.focusBox({ appId: appId2 });
1371
1378
  }
1372
1379
  });
1373
1380
  });
@@ -1783,7 +1790,7 @@ class MainViewProxy {
1783
1790
  this.mainViewIsAddListener = false;
1784
1791
  this.store = this.manager.store;
1785
1792
  this.viewMode = this.manager.windowManger.viewMode;
1786
- this.sideEffectManager = new SideEffectManager();
1793
+ this.sideEffectManager = new SideEffectManager$1();
1787
1794
  this.startListenWritableChange = () => {
1788
1795
  this.sideEffectManager.add(() => {
1789
1796
  return internalEmitter.on("writableChange", (isWritable) => {
@@ -2090,7 +2097,7 @@ class AppManager {
2090
2097
  this.mainViewScenesLength = 0;
2091
2098
  this.callbacksNode = null;
2092
2099
  this.appCreateQueue = new AppCreateQueue();
2093
- this.sideEffectManager = new SideEffectManager();
2100
+ this.sideEffectManager = new SideEffectManager$1();
2094
2101
  this.sceneState = null;
2095
2102
  this.rootDirRemoving = false;
2096
2103
  this.onRemoveScenes = async (params) => {
@@ -2941,7 +2948,7 @@ var objectAssign = shouldUseNative$1() ? Object.assign : function(target, source
2941
2948
  * This source code is licensed under the MIT license found in the
2942
2949
  * LICENSE file in the root directory of this source tree.
2943
2950
  */
2944
- var l$1 = objectAssign, n$3 = typeof Symbol === "function" && Symbol.for, p = n$3 ? Symbol.for("react.element") : 60103, q = n$3 ? Symbol.for("react.portal") : 60106, r$4 = n$3 ? Symbol.for("react.fragment") : 60107, t$3 = n$3 ? Symbol.for("react.strict_mode") : 60108, u$3 = n$3 ? Symbol.for("react.profiler") : 60114, v$2 = n$3 ? Symbol.for("react.provider") : 60109, w$1 = n$3 ? Symbol.for("react.context") : 60110, x$1 = n$3 ? Symbol.for("react.forward_ref") : 60112, y$1 = n$3 ? Symbol.for("react.suspense") : 60113, z$1 = n$3 ? Symbol.for("react.memo") : 60115, A$1 = n$3 ? Symbol.for("react.lazy") : 60116, B$1 = typeof Symbol === "function" && Symbol.iterator;
2951
+ var l$1 = objectAssign, n$2 = typeof Symbol === "function" && Symbol.for, p = n$2 ? Symbol.for("react.element") : 60103, q = n$2 ? Symbol.for("react.portal") : 60106, r$3 = n$2 ? Symbol.for("react.fragment") : 60107, t$3 = n$2 ? Symbol.for("react.strict_mode") : 60108, u$3 = n$2 ? Symbol.for("react.profiler") : 60114, v$2 = n$2 ? Symbol.for("react.provider") : 60109, w$1 = n$2 ? Symbol.for("react.context") : 60110, x$1 = n$2 ? Symbol.for("react.forward_ref") : 60112, y$1 = n$2 ? Symbol.for("react.suspense") : 60113, z$1 = n$2 ? Symbol.for("react.memo") : 60115, A$1 = n$2 ? Symbol.for("react.lazy") : 60116, B$1 = typeof Symbol === "function" && Symbol.iterator;
2945
2952
  function C$2(a2) {
2946
2953
  for (var b2 = "https://reactjs.org/docs/error-decoder.html?invariant=" + a2, c2 = 1; c2 < arguments.length; c2++)
2947
2954
  b2 += "&args[]=" + encodeURIComponent(arguments[c2]);
@@ -3129,7 +3136,7 @@ react_production_min.Children = { map: function(a2, b2, c2) {
3129
3136
  return a2;
3130
3137
  } };
3131
3138
  react_production_min.Component = F$2;
3132
- react_production_min.Fragment = r$4;
3139
+ react_production_min.Fragment = r$3;
3133
3140
  react_production_min.Profiler = u$3;
3134
3141
  react_production_min.PureComponent = H$2;
3135
3142
  react_production_min.StrictMode = t$3;
@@ -4289,10 +4296,10 @@ var shallowequal = function shallowEqual(objA, objB, compare, compareContext) {
4289
4296
  }
4290
4297
  return true;
4291
4298
  };
4292
- const e$1$1 = "!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", s$1$1 = e$1$1.length, t$1$1 = Array(20), r$1$1 = () => {
4299
+ const e$1 = "!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", s$1 = e$1.length, t$1 = Array(20), r$1$1 = () => {
4293
4300
  for (let r2 = 0; r2 < 20; r2++)
4294
- t$1$1[r2] = e$1$1.charAt(Math.random() * s$1$1);
4295
- return t$1$1.join("");
4301
+ t$1[r2] = e$1.charAt(Math.random() * s$1);
4302
+ return t$1.join("");
4296
4303
  };
4297
4304
  class o$1 {
4298
4305
  constructor() {
@@ -4347,7 +4354,7 @@ class o$1 {
4347
4354
  var e$2 = Object.defineProperty, s$2 = (typeof require != "undefined" && require, (s2, r2, t2) => (((s3, r3, t3) => {
4348
4355
  r3 in s3 ? e$2(s3, r3, { enumerable: true, configurable: true, writable: true, value: t3 }) : s3[r3] = t3;
4349
4356
  })(s2, typeof r2 != "symbol" ? r2 + "" : r2, t2), t2));
4350
- class r$3 {
4357
+ class r$2 {
4351
4358
  constructor(e2, r2) {
4352
4359
  s$2(this, "_value"), s$2(this, "_beforeDestroys"), s$2(this, "_subscribers"), this._value = e2, r2 && (this.compare = r2);
4353
4360
  }
@@ -4370,7 +4377,7 @@ class r$3 {
4370
4377
  return e2(this._value, void 0, s2), r2;
4371
4378
  }
4372
4379
  derive(e2, s2, t2) {
4373
- const i2 = new r$3(e2(this.value, void 0, t2), s2), o2 = this.reaction((s3, r2, t3) => {
4380
+ const i2 = new r$2(e2(this.value, void 0, t2), s2), o2 = this.reaction((s3, r2, t3) => {
4374
4381
  i2.setValue(e2(s3, r2, t3));
4375
4382
  });
4376
4383
  return i2.addBeforeDestroy(o2), i2;
@@ -4389,7 +4396,7 @@ class r$3 {
4389
4396
  }
4390
4397
  function t$2(e2, s2, t2, i2) {
4391
4398
  let o2 = e2.map((e3) => e3.value);
4392
- const u2 = new r$3(s2(o2, void 0, i2), t2);
4399
+ const u2 = new r$2(s2(o2, void 0, i2), t2);
4393
4400
  return e2.forEach((e3, r2) => {
4394
4401
  const t3 = e3.reaction((e4, t4, i3) => {
4395
4402
  const c2 = o2.slice();
@@ -4400,7 +4407,7 @@ function t$2(e2, s2, t2, i2) {
4400
4407
  u2.addBeforeDestroy(t3);
4401
4408
  }), u2;
4402
4409
  }
4403
- function i$2(e2, s2) {
4410
+ function i$1(e2, s2) {
4404
4411
  Object.keys(s2).forEach((r2) => {
4405
4412
  u$2(e2, r2, s2[r2]);
4406
4413
  });
@@ -4418,7 +4425,7 @@ function c(e2) {
4418
4425
  e2.remove(r2);
4419
4426
  }), s3;
4420
4427
  };
4421
- return { bindSideEffect: s2, combine: (e3, r2, i2, o2) => s2(t$2(e3, r2, i2, o2)), createVal: (e3, t2) => s2(new r$3(e3, t2)) };
4428
+ return { bindSideEffect: s2, combine: (e3, r2, i2, o2) => s2(t$2(e3, r2, i2, o2)), createVal: (e3, t2) => s2(new r$2(e3, t2)) };
4422
4429
  }
4423
4430
  var TELE_BOX_COLOR_SCHEME;
4424
4431
  (function(TELE_BOX_COLOR_SCHEME2) {
@@ -4968,7 +4975,7 @@ class TeleBox {
4968
4975
  $userFooter: $userFooter$,
4969
4976
  $userStyles: $userStyles$
4970
4977
  };
4971
- i$2(this, valConfig);
4978
+ i$1(this, valConfig);
4972
4979
  this._state$ = state$;
4973
4980
  this._minSize$ = minSize$;
4974
4981
  this._size$ = size$;
@@ -5888,7 +5895,7 @@ class TeleBoxManager {
5888
5895
  minimized: minimized$,
5889
5896
  maximized: maximized$
5890
5897
  };
5891
- i$2(this, valConfig);
5898
+ i$1(this, valConfig);
5892
5899
  this._state$ = state$;
5893
5900
  this.root.appendChild(this.maxTitleBar.render());
5894
5901
  }
@@ -6053,7 +6060,7 @@ class TeleBoxManager {
6053
6060
  this.removeAll(skipUpdate);
6054
6061
  Object.keys(this).forEach((key) => {
6055
6062
  const value = this[key];
6056
- if (value instanceof r$3) {
6063
+ if (value instanceof r$2) {
6057
6064
  value.destroy();
6058
6065
  }
6059
6066
  });
@@ -7295,7 +7302,7 @@ class CursorManager {
7295
7302
  this.manager = manager;
7296
7303
  this.enableCursor = enableCursor;
7297
7304
  this.cursorInstances = /* @__PURE__ */ new Map();
7298
- this.sideEffectManager = new SideEffectManager();
7305
+ this.sideEffectManager = new SideEffectManager$1();
7299
7306
  this.store = this.manager.store;
7300
7307
  this.applianceIcons = ApplianceMap;
7301
7308
  this.onCursorMove = (payload) => {
@@ -7779,65 +7786,79 @@ const debounceFn = (inputFunction, options = {}) => {
7779
7786
  };
7780
7787
  return debouncedFunction;
7781
7788
  };
7782
- const s$1 = "!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", e$1 = s$1.length, t$1 = Array(20), i$1 = () => {
7783
- for (let i2 = 0; i2 < 20; i2++)
7784
- t$1[i2] = s$1.charAt(Math.random() * e$1);
7785
- return t$1.join("");
7789
+ const SOUP = "!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
7790
+ const SOUP_LEN = 87;
7791
+ const ID_LEN = 20;
7792
+ const reusedIdCarrier = [];
7793
+ const genUID = () => {
7794
+ for (let i2 = 0; i2 < ID_LEN; i2++) {
7795
+ reusedIdCarrier[i2] = SOUP.charAt(Math.random() * SOUP_LEN);
7796
+ }
7797
+ return reusedIdCarrier.join("");
7786
7798
  };
7787
- function r$2(s2) {
7799
+ function invoke(fn) {
7788
7800
  try {
7789
- return s2();
7801
+ return fn();
7790
7802
  } catch (e2) {
7791
7803
  console.error(e2);
7792
7804
  }
7793
7805
  }
7794
- class n$2 {
7806
+ class SideEffectManager {
7795
7807
  constructor() {
7808
+ this.push = this.addDisposer;
7796
7809
  this.disposers = /* @__PURE__ */ new Map();
7797
7810
  }
7798
- addDisposer(s2, e2 = this.genUID()) {
7799
- return this.flush(e2), this.disposers.set(e2, Array.isArray(s2) ? () => s2.forEach(r$2) : s2), e2;
7800
- }
7801
- add(s2, e2 = this.genUID()) {
7802
- return this.addDisposer(s2(), e2);
7803
- }
7804
- addEventListener(s2, e2, t2, i2, r2 = this.genUID()) {
7805
- return s2.addEventListener(e2, t2, i2), this.addDisposer(() => s2.removeEventListener(e2, t2, i2), r2), r2;
7806
- }
7807
- setTimeout(s2, e2, t2 = this.genUID()) {
7808
- const i2 = window.setTimeout(() => {
7809
- this.remove(t2), s2();
7810
- }, e2);
7811
- return this.addDisposer(() => window.clearTimeout(i2), t2);
7812
- }
7813
- setInterval(s2, e2, t2 = this.genUID()) {
7814
- const i2 = window.setInterval(s2, e2);
7815
- return this.addDisposer(() => window.clearInterval(i2), t2);
7816
- }
7817
- remove(s2) {
7818
- const e2 = this.disposers.get(s2);
7819
- return this.disposers.delete(s2), e2;
7820
- }
7821
- flush(s2) {
7822
- const e2 = this.remove(s2);
7823
- if (e2)
7824
- try {
7825
- e2();
7826
- } catch (t2) {
7827
- console.error(t2);
7828
- }
7811
+ addDisposer(disposer, disposerID = this.genUID()) {
7812
+ this.flush(disposerID);
7813
+ this.disposers.set(disposerID, Array.isArray(disposer) ? joinDisposers(disposer) : disposer);
7814
+ return disposerID;
7815
+ }
7816
+ add(executor, disposerID = this.genUID()) {
7817
+ const disposers = executor();
7818
+ return disposers ? this.addDisposer(disposers, disposerID) : disposerID;
7819
+ }
7820
+ addEventListener(el, type, listener, options, disposerID = this.genUID()) {
7821
+ el.addEventListener(type, listener, options);
7822
+ this.addDisposer(() => el.removeEventListener(type, listener, options), disposerID);
7823
+ return disposerID;
7824
+ }
7825
+ setTimeout(handler, timeout, disposerID = this.genUID()) {
7826
+ const ticket = window.setTimeout(() => {
7827
+ this.remove(disposerID);
7828
+ handler();
7829
+ }, timeout);
7830
+ return this.addDisposer(() => window.clearTimeout(ticket), disposerID);
7831
+ }
7832
+ setInterval(handler, timeout, disposerID = this.genUID()) {
7833
+ const ticket = window.setInterval(handler, timeout);
7834
+ return this.addDisposer(() => window.clearInterval(ticket), disposerID);
7835
+ }
7836
+ remove(disposerID) {
7837
+ const disposer = this.disposers.get(disposerID);
7838
+ this.disposers.delete(disposerID);
7839
+ return disposer;
7840
+ }
7841
+ flush(disposerID) {
7842
+ const disposer = this.remove(disposerID);
7843
+ if (disposer) {
7844
+ disposer();
7845
+ }
7829
7846
  }
7830
7847
  flushAll() {
7831
- this.disposers.forEach(r$2), this.disposers.clear();
7848
+ this.disposers.forEach(invoke);
7849
+ this.disposers.clear();
7832
7850
  }
7833
7851
  genUID() {
7834
- let s2;
7852
+ let uid;
7835
7853
  do {
7836
- s2 = i$1();
7837
- } while (this.disposers.has(s2));
7838
- return s2;
7854
+ uid = genUID();
7855
+ } while (this.disposers.has(uid));
7856
+ return uid;
7839
7857
  }
7840
7858
  }
7859
+ function joinDisposers(disposers) {
7860
+ return () => disposers.forEach(invoke);
7861
+ }
7841
7862
  var resizeObservers = [];
7842
7863
  var hasActiveObservations = function() {
7843
7864
  return resizeObservers.some(function(ro) {
@@ -7913,11 +7934,11 @@ var isHidden = function(target) {
7913
7934
  return !(offsetWidth || offsetHeight || target.getClientRects().length);
7914
7935
  };
7915
7936
  var isElement = function(obj) {
7916
- var _a, _b;
7937
+ var _a;
7917
7938
  if (obj instanceof Element) {
7918
7939
  return true;
7919
7940
  }
7920
- var scope = (_b = (_a = obj) === null || _a === void 0 ? void 0 : _a.ownerDocument) === null || _b === void 0 ? void 0 : _b.defaultView;
7941
+ var scope = (_a = obj === null || obj === void 0 ? void 0 : obj.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView;
7921
7942
  return !!(scope && obj instanceof scope.Element);
7922
7943
  };
7923
7944
  var isReplacedElement = function(target) {
@@ -8114,7 +8135,7 @@ var queueMicroTask = function(callback) {
8114
8135
  return notify();
8115
8136
  }).observe(el_1, config);
8116
8137
  trigger = function() {
8117
- el_1.textContent = "" + (toggle_1 ? toggle_1-- : toggle_1++);
8138
+ el_1.textContent = "".concat(toggle_1 ? toggle_1-- : toggle_1++);
8118
8139
  };
8119
8140
  }
8120
8141
  callbacks.push(callback);
@@ -9078,7 +9099,7 @@ class DocsViewer {
9078
9099
  this.namespace = "netless-app-docs-viewer";
9079
9100
  this.isShowPreview = false;
9080
9101
  this.isSmallBox = false;
9081
- this.sideEffect = new n$2();
9102
+ this.sideEffect = new SideEffectManager();
9082
9103
  if (pages.length <= 0) {
9083
9104
  throw new Error("[DocsViewer] Empty pages.");
9084
9105
  }
@@ -9087,6 +9108,7 @@ class DocsViewer {
9087
9108
  this.pages = pages;
9088
9109
  this.onNewPageIndex = onNewPageIndex;
9089
9110
  this.onPlay = onPlay;
9111
+ this.onPageIndexChanged = () => void 0;
9090
9112
  this.render();
9091
9113
  }
9092
9114
  mount() {
@@ -9120,6 +9142,7 @@ class DocsViewer {
9120
9142
  if (!Number.isNaN(pageIndex)) {
9121
9143
  this.pageIndex = pageIndex;
9122
9144
  this.$pageNumberInput.value = String(pageIndex + 1);
9145
+ this.onPageIndexChanged(pageIndex);
9123
9146
  }
9124
9147
  }
9125
9148
  setSmallBox(isSmallBox) {
@@ -9639,7 +9662,7 @@ class PageRenderer {
9639
9662
  const SCROLLBAR_DEFAULT_MIN_HEIGHT = 30;
9640
9663
  class ScrollBar {
9641
9664
  constructor(config) {
9642
- this.sideEffect = new n$2();
9665
+ this.sideEffect = new SideEffectManager();
9643
9666
  this.pagesScrollTop = config.pagesScrollTop || 0;
9644
9667
  this.containerWidth = config.containerWidth || 1;
9645
9668
  this.containerHeight = config.containerHeight || 1;
@@ -9770,7 +9793,7 @@ class StaticDocsViewer {
9770
9793
  baseScenePath,
9771
9794
  appId
9772
9795
  }) {
9773
- this.sideEffect = new n$2();
9796
+ this.sideEffect = new SideEffectManager();
9774
9797
  this.userScrolling = false;
9775
9798
  this.onNewPageIndex = (index2) => {
9776
9799
  this.scrollToPage(index2);
@@ -10132,7 +10155,7 @@ class StaticDocsViewer {
10132
10155
  }
10133
10156
  class DynamicDocsViewer {
10134
10157
  constructor({ context, whiteboardView, box, pages }) {
10135
- this.sideEffect = new n$2();
10158
+ this.sideEffect = new SideEffectManager();
10136
10159
  this.onPlayPPT = () => {
10137
10160
  const room = this.context.getRoom();
10138
10161
  if (room) {
@@ -10361,6 +10384,13 @@ function setupStaticDocsViewer(context, whiteboardView, box, pages) {
10361
10384
  baseScenePath: context.getInitScenePath(),
10362
10385
  appId: context.appId
10363
10386
  }).mount();
10387
+ docsViewer.viewer.onPageIndexChanged = (index2) => {
10388
+ context.dispatchAppEvent("pageStateChange", { index: index2, length: pages.length });
10389
+ };
10390
+ context.dispatchAppEvent("pageStateChange", {
10391
+ index: docsViewer.viewer.pageIndex,
10392
+ length: pages.length
10393
+ });
10364
10394
  context.emitter.on("attributesUpdate", (attributes) => {
10365
10395
  if (attributes) {
10366
10396
  if (attributes.pageScrollTop != null) {
@@ -10381,6 +10411,13 @@ function setupDynamicDocsViewer(context, whiteboardView, box, pages) {
10381
10411
  box,
10382
10412
  pages
10383
10413
  }).mount();
10414
+ docsViewer.viewer.onPageIndexChanged = (index2) => {
10415
+ context.dispatchAppEvent("pageStateChange", { index: index2, length: pages.length });
10416
+ };
10417
+ context.dispatchAppEvent("pageStateChange", {
10418
+ index: docsViewer.getPageIndex(),
10419
+ length: pages.length
10420
+ });
10384
10421
  context.mountView(docsViewer.$whiteboardView);
10385
10422
  if (context.isAddApp) {
10386
10423
  whiteboardView.callbacks.once("onSizeUpdated", ({ width: contentWidth, height: contentHeight }) => {
@@ -17009,7 +17046,7 @@ const _IframeBridge = class {
17009
17046
  this.allowAppliances = ["clicker"];
17010
17047
  this.bridgeDisposer = noop$2;
17011
17048
  this.rootRect = null;
17012
- this.sideEffectManager = new SideEffectManager();
17049
+ this.sideEffectManager = new SideEffectManager$1();
17013
17050
  this.execListenIframe = debounce((options) => {
17014
17051
  this.listenIframe(options);
17015
17052
  }, 50);
@@ -17468,14 +17505,14 @@ const reconnectRefresher = new ReconnectRefresher({ emitter: internalEmitter });
17468
17505
  const _WindowManager = class extends InvisiblePlugin {
17469
17506
  constructor(context) {
17470
17507
  super(context);
17471
- this.version = "0.4.65";
17472
- this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "0.2.27", "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": { "jspdf": "2.5.1", "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "^0.2.16", "@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", "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", "svelte": "^3.42.4", "typescript": "^4.5.5", "vite": "^2.5.3", "vitest": "^0.14.1", "white-web-sdk": "2.16.43" } };
17508
+ this.version = "0.4.66-beta.0";
17509
+ this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "0.2.27", "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": { "jspdf": "2.5.1", "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "^0.2.17", "@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", "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", "svelte": "^3.42.4", "typescript": "^4.5.5", "vite": "^2.5.3", "vitest": "^0.14.1", "white-web-sdk": "2.16.43" } };
17473
17510
  this.emitter = callbacks$1;
17474
17511
  this.viewMode = ViewMode.Broadcaster;
17475
17512
  this.isReplay = isPlayer(this.displayer);
17476
17513
  this.containerSizeRatio = _WindowManager.containerSizeRatio;
17477
17514
  _WindowManager.displayer = context.displayer;
17478
- window.NETLESS_DEPS = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "0.2.27", "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": { "jspdf": "2.5.1", "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "^0.2.16", "@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", "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", "svelte": "^3.42.4", "typescript": "^4.5.5", "vite": "^2.5.3", "vitest": "^0.14.1", "white-web-sdk": "2.16.43" } };
17515
+ window.NETLESS_DEPS = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "0.2.27", "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": { "jspdf": "2.5.1", "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "^0.2.17", "@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", "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", "svelte": "^3.42.4", "typescript": "^4.5.5", "vite": "^2.5.3", "vitest": "^0.14.1", "white-web-sdk": "2.16.43" } };
17479
17516
  }
17480
17517
  static async mount(params) {
17481
17518
  const room = params.room;
@@ -17701,11 +17738,12 @@ const _WindowManager = class extends InvisiblePlugin {
17701
17738
  for (const appId of apps) {
17702
17739
  const appScenePath = appManager.store.getAppScenePath(appId);
17703
17740
  if (appScenePath && appScenePath === scenePath) {
17704
- console.warn(`[WindowManager]: ScenePath ${scenePath} Already opened`);
17741
+ console.warn(`[WindowManager]: ScenePath "${scenePath}" already opened`);
17705
17742
  if (this.boxManager) {
17706
17743
  const topBox = this.boxManager.getTopBox();
17707
17744
  if (topBox) {
17708
17745
  this.boxManager.setZIndex(appId, topBox.zIndex + 1, false);
17746
+ this.boxManager.focusBox({ appId }, false);
17709
17747
  }
17710
17748
  }
17711
17749
  return;
@@ -17827,6 +17865,9 @@ const _WindowManager = class extends InvisiblePlugin {
17827
17865
  onAppDestroy(kind2, listener) {
17828
17866
  addEmitterOnceListener(`destroy-${kind2}`, listener);
17829
17867
  }
17868
+ onAppEvent(kind2, listener) {
17869
+ return internalEmitter.on(`custom-${kind2}`, listener);
17870
+ }
17830
17871
  setViewMode(mode) {
17831
17872
  var _a, _b, _c, _d;
17832
17873
  if (mode === ViewMode.Broadcaster || mode === ViewMode.Follower) {