@netless/window-manager 1.0.0-canary.29 → 1.0.0-canary.31

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
@@ -20,7 +20,7 @@ var __spreadProps = (a2, b2) => __defProps(a2, __getOwnPropDescs(b2));
20
20
  import pRetry from "p-retry";
21
21
  import Emittery from "emittery";
22
22
  import { debounce, isObject, has, get, size as size$1, mapValues, noop as noop$1, pick, isBoolean, isNumber, throttle, isEqual, omitBy, isUndefined, isInteger, orderBy, isEmpty, omit, isFunction, isNull } from "lodash";
23
- import { ScenePathType, UpdateEventKind, listenUpdated, unlistenUpdated, reaction, WhiteVersion, autorun, toJS, listenDisposed, unlistenDisposed, AnimationMode, ViewMode, isPlayer, isRoom, ApplianceNames, RoomPhase, InvisiblePlugin } from "white-web-sdk";
23
+ import { ScenePathType, UpdateEventKind, listenUpdated, unlistenUpdated, reaction, toJS, WhiteVersion, autorun, listenDisposed, unlistenDisposed, AnimationMode, ViewMode, isPlayer, isRoom, ApplianceNames, RoomPhase, InvisiblePlugin } from "white-web-sdk";
24
24
  import { v4 } from "uuid";
25
25
  import { genUID, SideEffectManager } from "side-effect-manager";
26
26
  import { Val, combine, ValManager, withReadonlyValueEnhancer, withValueEnhancer, derive } from "value-enhancer";
@@ -42,6 +42,7 @@ var Events = /* @__PURE__ */ ((Events2) => {
42
42
  Events2["RootDirRemoved"] = "RootDirRemoved";
43
43
  Events2["Refresh"] = "Refresh";
44
44
  Events2["InitMainViewCamera"] = "InitMainViewCamera";
45
+ Events2["InvokeAttributesUpdateCallback"] = "InvokeAttributesUpdateCallback";
45
46
  return Events2;
46
47
  })(Events || {});
47
48
  const MagixEventName = "__WindowManger";
@@ -494,6 +495,10 @@ class AppListeners {
494
495
  this.setAppFocusViewIndexHandler(data.payload);
495
496
  break;
496
497
  }
498
+ case Events.InvokeAttributesUpdateCallback: {
499
+ this.manager.attributesUpdateCallback(this.manager.attributes.apps);
500
+ break;
501
+ }
497
502
  }
498
503
  }
499
504
  };
@@ -997,7 +1002,7 @@ const serializeRoomMembers = (members) => {
997
1002
  var _a;
998
1003
  return __spreadValues({
999
1004
  uid: ((_a = member.payload) == null ? void 0 : _a.uid) || ""
1000
- }, member);
1005
+ }, toJS(member));
1001
1006
  });
1002
1007
  };
1003
1008
  const createInvisiblePlugin = async (room) => {
@@ -1163,7 +1168,7 @@ class AppContext {
1163
1168
  return this.manager.room;
1164
1169
  }
1165
1170
  get members() {
1166
- return this.manager.members;
1171
+ return this.manager.members$.value;
1167
1172
  }
1168
1173
  get currentMember() {
1169
1174
  const self2 = findMemberByUid(this.room, this.manager.uid);
@@ -1244,7 +1249,6 @@ class CameraSynchronizer {
1244
1249
  }
1245
1250
  };
1246
1251
  this.onRemoteUpdate = throttle((camera, size2) => {
1247
- var _a;
1248
1252
  this.remoteCamera = camera;
1249
1253
  this.remoteSize = size2;
1250
1254
  if (this.remoteSize && this.rect) {
@@ -1261,7 +1265,7 @@ class CameraSynchronizer {
1261
1265
  if (camera.centerY !== null) {
1262
1266
  config.centerY = camera.centerY;
1263
1267
  }
1264
- (_a = this.view) == null ? void 0 : _a.moveCamera(config);
1268
+ this.moveCamera(config);
1265
1269
  }
1266
1270
  }, 10);
1267
1271
  }
@@ -1269,15 +1273,13 @@ class CameraSynchronizer {
1269
1273
  this.view = view;
1270
1274
  }
1271
1275
  onRemoteSizeUpdate(size2) {
1272
- var _a;
1273
1276
  this.remoteSize = size2;
1274
1277
  const needMoveCamera = !isEqual(pick(this.rect, ["width", "height"]), pick(size2, ["width", "height"]));
1275
1278
  if (this.rect && this.remoteCamera && needMoveCamera) {
1276
1279
  const scale2 = this.rect.width / size2.width;
1277
1280
  const nextScale = this.remoteCamera.scale * scale2;
1278
- (_a = this.view) == null ? void 0 : _a.moveCamera({
1279
- scale: nextScale,
1280
- animationMode: AnimationMode.Continuous
1281
+ this.moveCamera({
1282
+ scale: nextScale
1281
1283
  });
1282
1284
  }
1283
1285
  }
@@ -1285,6 +1287,10 @@ class CameraSynchronizer {
1285
1287
  this.saveCamera(camera);
1286
1288
  this.remoteCamera = camera;
1287
1289
  }
1290
+ moveCamera(camera) {
1291
+ var _a;
1292
+ (_a = this.view) == null ? void 0 : _a.moveCamera(__spreadProps(__spreadValues({}, camera), { animationMode: AnimationMode.Continuous }));
1293
+ }
1288
1294
  }
1289
1295
  class ViewSync {
1290
1296
  constructor(context) {
@@ -1440,7 +1446,7 @@ class AttributesDelegate {
1440
1446
  attrNames.push("scenes");
1441
1447
  }
1442
1448
  const options = pick(params.options, attrNames);
1443
- const attrs = { kind: params.kind, options, isDynamicPPT };
1449
+ const attrs = { kind: params.kind, options, isDynamicPPT, setup: false };
1444
1450
  if (typeof params.src === "string") {
1445
1451
  attrs.src = params.src;
1446
1452
  }
@@ -1718,6 +1724,10 @@ class AppProxy {
1718
1724
  this.onFocus = () => {
1719
1725
  this.setScenePath();
1720
1726
  };
1727
+ this.setupDone = () => {
1728
+ this.store.updateAppAttributes(this.id, "setup", true);
1729
+ this.manager.dispatchInternalEvent(Events.InvokeAttributesUpdateCallback);
1730
+ };
1721
1731
  this.kind = params.kind;
1722
1732
  this.id = appId;
1723
1733
  this.appScenePath = `/${this.id}-app-dir`;
@@ -1740,9 +1750,6 @@ class AppProxy {
1740
1750
  notifyPageStateChange: this.notifyPageStateChange
1741
1751
  });
1742
1752
  this.sideEffectManager.add(() => () => this._pageState.destroy());
1743
- this.sideEffectManager.add(() => emitter.on("roomMembersChange", (members) => {
1744
- this.appEmitter.emit("roomMembersChange", members);
1745
- }));
1746
1753
  this.camera$.setValue(toJS(this.appAttributes.camera));
1747
1754
  this.size$.setValue(toJS(this.appAttributes.size));
1748
1755
  this.addCameraReaction();
@@ -1802,6 +1809,9 @@ class AppProxy {
1802
1809
  }
1803
1810
  });
1804
1811
  }
1812
+ }),
1813
+ this.manager.members$.reaction((members) => {
1814
+ this.appEmitter.emit("roomMembersChange", members);
1805
1815
  })
1806
1816
  ]);
1807
1817
  }
@@ -1909,6 +1919,9 @@ class AppProxy {
1909
1919
  this.appResult = result;
1910
1920
  appRegister.notifyApp(this.kind, "created", { appId, result });
1911
1921
  this.fixMobileSize();
1922
+ if (this.isAddApp) {
1923
+ this.setupDone();
1924
+ }
1912
1925
  }, SETUP_APP_DELAY);
1913
1926
  });
1914
1927
  const box = (_a = this.boxManager) == null ? void 0 : _a.createBox({
@@ -2484,6 +2497,7 @@ class AppManager {
2484
2497
  this.appCreateQueue = new AppCreateQueue();
2485
2498
  this.sceneIndex$ = new Val(void 0);
2486
2499
  this.focused$ = new Val(void 0);
2500
+ this.members$ = new Val([]);
2487
2501
  this.sideEffectManager = new SideEffectManager();
2488
2502
  this.sceneState = null;
2489
2503
  this.rootDirRemoving = false;
@@ -2731,7 +2745,7 @@ class AppManager {
2731
2745
  appProxy.appEmitter.emit("roomStateChange", state);
2732
2746
  });
2733
2747
  if (state.roomMembers) {
2734
- emitter.emit("roomMembersChange", this.members);
2748
+ this.members$.setValue(serializeRoomMembers(state.roomMembers));
2735
2749
  }
2736
2750
  emitter.emit("observerIdChange", this.displayer.observerId);
2737
2751
  if (state.memberState) {
@@ -2809,6 +2823,7 @@ class AppManager {
2809
2823
  appRegister.setSyncRegisterApp((payload) => {
2810
2824
  this.safeUpdateAttributes([Fields.Registered, payload.kind], payload);
2811
2825
  });
2826
+ this.members$.setValue(serializeRoomMembers(this.displayer.state.roomMembers));
2812
2827
  }
2813
2828
  async onRootDirRemoved(needClose = true) {
2814
2829
  await this.setMainViewScenePath(INIT_DIR);
@@ -2846,9 +2861,6 @@ class AppManager {
2846
2861
  var _a;
2847
2862
  return ((_a = this.room) == null ? void 0 : _a.uid) || "";
2848
2863
  }
2849
- get members() {
2850
- return serializeRoomMembers(this.displayer.state.roomMembers);
2851
- }
2852
2864
  getMainViewSceneDir() {
2853
2865
  const scenePath = this.store.getMainViewScenePath();
2854
2866
  if (scenePath) {
@@ -2924,13 +2936,17 @@ class AppManager {
2924
2936
  this.appCreateQueue.emitReady();
2925
2937
  }
2926
2938
  const appsWithCreatedAt = appIds.map((appId) => {
2927
- return {
2928
- id: appId,
2929
- createdAt: apps[appId].createdAt
2930
- };
2939
+ if (apps[appId].setup) {
2940
+ return {
2941
+ id: appId,
2942
+ createdAt: apps[appId].createdAt
2943
+ };
2944
+ } else {
2945
+ return {};
2946
+ }
2931
2947
  });
2932
2948
  for (const { id: id2 } of orderBy(appsWithCreatedAt, "createdAt", "asc")) {
2933
- if (!this.appProxies.has(id2) && !this.appStatus.has(id2)) {
2949
+ if (id2 && !this.appProxies.has(id2) && !this.appStatus.has(id2)) {
2934
2950
  const app = apps[id2];
2935
2951
  try {
2936
2952
  const appAttributes = this.attributes[id2];
@@ -2973,11 +2989,11 @@ class AppManager {
2973
2989
  mainView.disableCameraTransform = disableCameraTransform;
2974
2990
  wait(30).then(() => {
2975
2991
  mainView.divElement = divElement;
2992
+ emitter.emit("mainViewMounted");
2976
2993
  });
2977
2994
  if (!mainView.focusScenePath) {
2978
2995
  this.setMainViewFocusPath();
2979
2996
  }
2980
- emitter.emit("mainViewMounted");
2981
2997
  }
2982
2998
  setMainViewFocusPath(scenePath) {
2983
2999
  var _a;
@@ -3162,6 +3178,7 @@ class AppManager {
3162
3178
  this.sideEffectManager.flushAll();
3163
3179
  this.sceneIndex$.destroy();
3164
3180
  this.focused$.destroy();
3181
+ this.members$.destroy();
3165
3182
  }
3166
3183
  }
3167
3184
  /*! *****************************************************************************
@@ -4006,7 +4023,7 @@ var shallowequal = function shallowEqual(objA, objB, compare, compareContext) {
4006
4023
  }
4007
4024
  return true;
4008
4025
  };
4009
- var shadowStyles = /* @__PURE__ */ (() => '.tele-fancy-scrollbar {\n overscroll-behavior: contain;\n overflow: auto;\n overflow-y: scroll;\n overflow-y: overlay;\n -webkit-overflow-scrolling: touch;\n -ms-overflow-style: -ms-autohiding-scrollbar;\n scrollbar-width: auto;\n}\n.tele-fancy-scrollbar::-webkit-scrollbar {\n height: 8px;\n width: 8px;\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-track {\n background-color: transparent;\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-thumb {\n background-color: rgba(68, 78, 96, 0.1);\n background-color: transparent;\n border-radius: 4px;\n transition: background-color 0.4s;\n}\n.tele-fancy-scrollbar:hover::-webkit-scrollbar-thumb {\n background-color: rgba(68, 78, 96, 0.1);\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-thumb:hover {\n background-color: rgba(68, 78, 96, 0.2);\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-thumb:active {\n background-color: rgba(68, 78, 96, 0.2);\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-thumb:vertical {\n min-height: 50px;\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-thumb:horizontal {\n min-width: 50px;\n}\n.telebox-quarantine {\n all: initial;\n position: relative;\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n}\n.telebox-body-wrap {\n color: #191919;\n color: var(--tele-box-color, #191919);\n flex: 1;\n width: 100%;\n overflow: hidden;\n display: flex;\n justify-content: center;\n align-items: center;\n position: relative;\n}\n.telebox-content {\n width: 100%;\n height: 100%;\n position: relative;\n background-color: #f9f9f9;\n background-color: var(--tele-manager-container-background, #f9f9f9);\n}\n.telebox-box-stage {\n position: absolute;\n z-index: 1;\n overflow: hidden;\n background-color: #fff;\n background-color: var(--tele-manager-stage-background, #fff);\n box-shadow: 0px 0px 16px rgba(0, 0, 0, 0.08);\n box-shadow: var(--tele-manager-stage-shadow, 0px 0px 16px rgba(0, 0, 0, 0.08));\n}\n.telebox-footer-wrap {\n flex-shrink: 0;\n display: flex;\n flex-direction: column;\n color: #191919;\n color: var(--tele-box-footer-color, #191919);\n background-color: #fff;\n background-color: var(--tele-box-footer-background, #fff);\n}\n.telebox-footer-wrap::before {\n content: "";\n display: block;\n flex: 1;\n}\n.telebox-color-scheme-dark {\n color-scheme: dark;\n}\n.telebox-color-scheme-dark .telebox-body-wrap {\n color: #e9e9e9;\n color: var(--tele-box-color-dark, #e9e9e9);\n}\n.telebox-color-scheme-dark .telebox-content {\n background-color: #25282e;\n background-color: var(--tele-manager-container-background-dark, #25282e);\n}\n.telebox-color-scheme-dark .telebox-box-stage {\n background-color: #272a30;\n background-color: var(--tele-manager-stage-background-dark, #272a30);\n box-shadow: 0px 0px 16px rgba(0, 0, 0, 0.24);\n box-shadow: var(--tele-manager-stage-shadow-dark, 0px 0px 16px rgba(0, 0, 0, 0.24));\n}\n.telebox-color-scheme-dark .telebox-footer-wrap {\n color: #e9e9e9;\n color: var(--tele-box-footer-color-dark, #e9e9e9);\n background-color: #383b42;\n background-color: var(--tele-box-footer-background-dark, #383b42);\n}')();
4026
+ var shadowStyles = /* @__PURE__ */ (() => '.tele-fancy-scrollbar {\n overscroll-behavior: contain;\n overflow: auto;\n overflow-y: scroll;\n overflow-y: overlay;\n -webkit-overflow-scrolling: touch;\n -ms-overflow-style: -ms-autohiding-scrollbar;\n scrollbar-width: auto;\n}\n.tele-fancy-scrollbar::-webkit-scrollbar {\n height: 8px;\n width: 8px;\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-track {\n background-color: transparent;\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-thumb {\n background-color: rgba(68, 78, 96, 0.1);\n background-color: transparent;\n border-radius: 4px;\n transition: background-color 0.4s;\n}\n.tele-fancy-scrollbar:hover::-webkit-scrollbar-thumb {\n background-color: rgba(68, 78, 96, 0.1);\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-thumb:hover {\n background-color: rgba(68, 78, 96, 0.2);\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-thumb:active {\n background-color: rgba(68, 78, 96, 0.2);\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-thumb:vertical {\n min-height: 50px;\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-thumb:horizontal {\n min-width: 50px;\n}\n.telebox-quarantine {\n all: initial;\n position: relative;\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n}\n.telebox-body-wrap {\n color: #191919;\n color: var(--tele-boxColor, #191919);\n flex: 1;\n width: 100%;\n overflow: hidden;\n display: flex;\n justify-content: center;\n align-items: center;\n position: relative;\n}\n.telebox-content {\n width: 100%;\n height: 100%;\n position: relative;\n background-color: #f9f9f9;\n background-color: var(--tele-boxContainerBackground, #f9f9f9);\n}\n.telebox-box-stage {\n position: absolute;\n z-index: 1;\n overflow: hidden;\n background-color: #fff;\n background-color: var(--tele-boxStageBackground, #fff);\n boxShadow: 0px 0px 16px rgba(0, 0, 0, 0.08);\n boxShadow: var(--tele-boxStageShadow, 0px 0px 16px rgba(0, 0, 0, 0.08));\n}\n.telebox-footer-wrap {\n flex-shrink: 0;\n display: flex;\n flex-direction: column;\n color: #191919;\n color: var(--tele-boxFooterColor, #191919);\n background-color: #fff;\n background-color: var(--tele-boxFooterBackground, #fff);\n}\n.telebox-footer-wrap::before {\n content: "";\n display: block;\n flex: 1;\n}\n.telebox-color-scheme-dark {\n color-scheme: dark;\n}\n.telebox-color-scheme-dark .telebox-body-wrap {\n color: #e9e9e9;\n color: var(--tele-boxColor, #e9e9e9);\n}\n.telebox-color-scheme-dark .telebox-content {\n background-color: #25282e;\n background-color: var(--tele-boxContainerBackground, #25282e);\n}\n.telebox-color-scheme-dark .telebox-box-stage {\n background-color: #272a30;\n background-color: var(--tele-boxStageBackground, #272a30);\n boxShadow: 0px 0px 16px rgba(0, 0, 0, 0.24);\n boxShadow: var(--tele-boxStageShadow, 0px 0px 16px rgba(0, 0, 0, 0.24));\n}\n.telebox-color-scheme-dark .telebox-footer-wrap {\n color: #e9e9e9;\n color: var(--tele-boxFooterColor, #e9e9e9);\n background-color: #383b42;\n background-color: var(--tele-boxFooterBackground, #383b42);\n}')();
4010
4027
  var TELE_BOX_COLOR_SCHEME = /* @__PURE__ */ ((TELE_BOX_COLOR_SCHEME2) => {
4011
4028
  TELE_BOX_COLOR_SCHEME2["Light"] = "light";
4012
4029
  TELE_BOX_COLOR_SCHEME2["Dark"] = "dark";
@@ -4165,9 +4182,9 @@ class DefaultTitleBar {
4165
4182
  }
4166
4183
  });
4167
4184
  }), "render-state-btns");
4168
- this.sideEffect.addEventListener($buttonsContainer, "pointerup", (ev) => {
4185
+ this.sideEffect.addEventListener($buttonsContainer, "click", (ev) => {
4169
4186
  var _a;
4170
- if (!ev.isPrimary || this.readonly$.value) {
4187
+ if (this.readonly$.value) {
4171
4188
  return;
4172
4189
  }
4173
4190
  const target = ev.target;
@@ -4891,7 +4908,8 @@ class TeleBoxCollector {
4891
4908
  darkMode$,
4892
4909
  namespace = "telebox",
4893
4910
  styles: styles2 = {},
4894
- root$
4911
+ root,
4912
+ onClick
4895
4913
  }) {
4896
4914
  this._sideEffect = new SideEffectManager();
4897
4915
  this.namespace = namespace;
@@ -4906,10 +4924,6 @@ class TeleBoxCollector {
4906
4924
  $collector: el$
4907
4925
  };
4908
4926
  withValueEnhancer(this, valConfig, valManager);
4909
- const propsValConfig = {
4910
- root: root$
4911
- };
4912
- withReadonlyValueEnhancer(this, propsValConfig);
4913
4927
  const myReadonlyValConfig = {
4914
4928
  rect: rect$,
4915
4929
  visible: visible$
@@ -4918,9 +4932,13 @@ class TeleBoxCollector {
4918
4932
  el$.value.className = this.wrapClassName("collector");
4919
4933
  el$.value.style.backgroundImage = `url('${collectorSVG}')`;
4920
4934
  this._sideEffect.addDisposer(el$.subscribe(($collector) => {
4921
- this._sideEffect.addEventListener($collector, "pointerup", (ev) => {
4922
- if (ev.isPrimary && !readonly$.value) {
4923
- minimized$.setValue(false);
4935
+ this._sideEffect.add(() => {
4936
+ root.appendChild($collector);
4937
+ return () => $collector.remove();
4938
+ }, "telebox-collector-mount");
4939
+ this._sideEffect.addEventListener($collector, "click", () => {
4940
+ if (!readonly$.value) {
4941
+ onClick == null ? void 0 : onClick();
4924
4942
  }
4925
4943
  }, {}, "telebox-collector-click");
4926
4944
  this._sideEffect.addDisposer([
@@ -4942,13 +4960,8 @@ class TeleBoxCollector {
4942
4960
  }
4943
4961
  });
4944
4962
  }),
4945
- root$.subscribe((root) => {
4946
- if (root) {
4947
- root.appendChild($collector);
4948
- }
4949
- }),
4950
- combine([minimized$, root$]).subscribe(([minimized, root]) => {
4951
- if (minimized && root) {
4963
+ minimized$.subscribe((minimized) => {
4964
+ if (minimized) {
4952
4965
  const { x: x2, y: y2, width, height } = $collector.getBoundingClientRect();
4953
4966
  const rootRect = root.getBoundingClientRect();
4954
4967
  rect$.setValue({
@@ -5077,6 +5090,7 @@ const ResizeObserver$2 = window.ResizeObserver || ResizeObserver$3;
5077
5090
  class TeleBoxManager {
5078
5091
  constructor({
5079
5092
  root = null,
5093
+ fullscreen = false,
5080
5094
  prefersColorScheme = TELE_BOX_COLOR_SCHEME.Light,
5081
5095
  minimized = false,
5082
5096
  maximized = false,
@@ -5088,7 +5102,8 @@ class TeleBoxManager {
5088
5102
  containerStyle = "",
5089
5103
  stageStyle = "",
5090
5104
  defaultBoxBodyStyle = null,
5091
- defaultBoxStageStyle = null
5105
+ defaultBoxStageStyle = null,
5106
+ theme = {}
5092
5107
  } = {}) {
5093
5108
  this.events = new Emittery();
5094
5109
  this._sideEffect = new SideEffectManager();
@@ -5097,14 +5112,19 @@ class TeleBoxManager {
5097
5112
  this._sideEffect.addDisposer(() => valManager.destroy());
5098
5113
  const root$ = new Val(root);
5099
5114
  const readonly$ = new Val(readonly);
5100
- const minimized$ = new Val(minimized);
5101
- const maximized$ = new Val(maximized);
5102
5115
  const fence$ = new Val(fence);
5103
5116
  const containerStyle$ = new Val(containerStyle);
5104
5117
  const stageStyle$ = new Val(stageStyle);
5105
5118
  const stageRatio$ = new Val(stageRatio);
5106
5119
  const defaultBoxBodyStyle$ = new Val(defaultBoxBodyStyle);
5107
5120
  const defaultBoxStageStyle$ = new Val(defaultBoxStageStyle);
5121
+ const fullscreen$ = new Val(fullscreen);
5122
+ const input_minimized$ = new Val(minimized);
5123
+ const input_maximized$ = new Val(maximized);
5124
+ const maximized$ = combine([input_maximized$, fullscreen$], ([maximized2, fullscreen2]) => fullscreen2 ? true : maximized2);
5125
+ const minimized$ = combine([input_minimized$, fullscreen$], ([minimized2, fullscreen2]) => fullscreen2 ? false : minimized2);
5126
+ this.setMaximized = (maximized2, skipUpdate) => input_maximized$.setValue(maximized2, skipUpdate);
5127
+ this.setMinimized = (minimized2, skipUpdate) => input_minimized$.setValue(minimized2, skipUpdate);
5108
5128
  const rootRect$ = new Val({
5109
5129
  x: 0,
5110
5130
  y: 0,
@@ -5162,27 +5182,21 @@ class TeleBoxManager {
5162
5182
  }));
5163
5183
  const darkMode$ = combine([prefersDark$, prefersColorScheme$], ([prefersDark, prefersColorScheme2]) => prefersColorScheme2 === "auto" ? prefersDark : prefersColorScheme2 === "dark");
5164
5184
  const state$ = combine([minimized$, maximized$], ([minimized2, maximized2]) => minimized2 ? TELE_BOX_STATE.Minimized : maximized2 ? TELE_BOX_STATE.Maximized : TELE_BOX_STATE.Normal);
5165
- this.collector = collector != null ? collector : new TeleBoxCollector({
5166
- minimized$,
5167
- readonly$,
5168
- darkMode$,
5169
- namespace,
5170
- root$
5171
- });
5172
5185
  const readonlyValConfig = {
5173
5186
  darkMode: darkMode$,
5174
5187
  state: state$,
5175
5188
  root: root$,
5176
5189
  rootRect: rootRect$,
5177
- stageRect: stageRect$
5190
+ stageRect: stageRect$,
5191
+ minimized: minimized$,
5192
+ maximized: maximized$
5178
5193
  };
5179
5194
  withReadonlyValueEnhancer(this, readonlyValConfig, valManager);
5180
5195
  const valConfig = {
5196
+ fullscreen: fullscreen$,
5181
5197
  prefersColorScheme: prefersColorScheme$,
5182
5198
  readonly: readonly$,
5183
5199
  fence: fence$,
5184
- minimized: minimized$,
5185
- maximized: maximized$,
5186
5200
  stageRatio: stageRatio$,
5187
5201
  containerStyle: containerStyle$,
5188
5202
  stageStyle: stageStyle$,
@@ -5218,6 +5232,7 @@ class TeleBoxManager {
5218
5232
  this._sideEffect.addEventListener(window, "pointerdown", checkFocusBox, true);
5219
5233
  this.$container = document.createElement("div");
5220
5234
  this.$container.className = this.wrapClassName("manager-container");
5235
+ this.setTheme(theme);
5221
5236
  this.$stage = document.createElement("div");
5222
5237
  this.$stage.className = this.wrapClassName("manager-stage");
5223
5238
  this.$container.appendChild(this.$stage);
@@ -5226,11 +5241,17 @@ class TeleBoxManager {
5226
5241
  this.$container.classList.toggle(this.wrapClassName("color-scheme-dark"), darkMode);
5227
5242
  this.$container.classList.toggle(this.wrapClassName("color-scheme-light"), !darkMode);
5228
5243
  }),
5244
+ fullscreen$.subscribe((fullscreen2) => {
5245
+ this.$container.classList.toggle(this.wrapClassName("is-fullscreen"), Boolean(fullscreen2));
5246
+ }),
5247
+ combine([this.boxes$, fullscreen$], ([boxes, fullscreen2]) => fullscreen2 === "no-titlebar" || fullscreen2 === true && boxes.length <= 1).subscribe((hideSingleTabTitlebar) => {
5248
+ this.$container.classList.toggle(this.wrapClassName("hide-fullscreen-titlebar"), hideSingleTabTitlebar);
5249
+ }),
5229
5250
  maximized$.subscribe((maximized2) => {
5230
- this.$container.classList.toggle("is-maximized", maximized2);
5251
+ this.$container.classList.toggle(this.wrapClassName("is-maximized"), maximized2);
5231
5252
  }),
5232
5253
  minimized$.subscribe((minimized2) => {
5233
- this.$container.classList.toggle("is-minimized", minimized2);
5254
+ this.$container.classList.toggle(this.wrapClassName("is-minimized"), minimized2);
5234
5255
  }),
5235
5256
  containerStyle$.subscribe((containerStyle2) => {
5236
5257
  this.$container.style.cssText = containerStyle2;
@@ -5252,6 +5273,14 @@ class TeleBoxManager {
5252
5273
  }
5253
5274
  })
5254
5275
  ]);
5276
+ this.collector = collector != null ? collector : new TeleBoxCollector({
5277
+ minimized$,
5278
+ readonly$,
5279
+ darkMode$,
5280
+ namespace,
5281
+ root: this.$container,
5282
+ onClick: () => input_minimized$.setValue(false)
5283
+ });
5255
5284
  this.titleBar = new MaxTitleBar({
5256
5285
  namespace: this.namespace,
5257
5286
  title$: derive(this.topBox$, (topBox) => (topBox == null ? void 0 : topBox.title) || ""),
@@ -5264,11 +5293,11 @@ class TeleBoxManager {
5264
5293
  onEvent: (event) => {
5265
5294
  switch (event.type) {
5266
5295
  case TELE_BOX_DELEGATE_EVENT.Maximize: {
5267
- maximized$.setValue(!maximized$.value);
5296
+ this.setMaximized(!maximized$.value);
5268
5297
  break;
5269
5298
  }
5270
5299
  case TELE_BOX_DELEGATE_EVENT.Minimize: {
5271
- minimized$.setValue(true);
5300
+ this.setMinimized(true);
5272
5301
  break;
5273
5302
  }
5274
5303
  case TELE_BOX_EVENT.Close: {
@@ -5441,6 +5470,12 @@ class TeleBoxManager {
5441
5470
  }
5442
5471
  return deletedBoxes;
5443
5472
  }
5473
+ setTheme(theme) {
5474
+ Object.keys(theme).forEach((key) => {
5475
+ var _a;
5476
+ this.$container.style.setProperty(`--tele-${key}`, (_a = theme[key]) != null ? _a : null);
5477
+ });
5478
+ }
5444
5479
  mount(root) {
5445
5480
  this._root$.setValue(root);
5446
5481
  }
@@ -5772,6 +5807,9 @@ class BoxManager {
5772
5807
  if (createTeleBoxManagerConfig == null ? void 0 : createTeleBoxManagerConfig.stageStyle) {
5773
5808
  initManagerState.stageStyle = createTeleBoxManagerConfig.stageStyle;
5774
5809
  }
5810
+ if (createTeleBoxManagerConfig == null ? void 0 : createTeleBoxManagerConfig.fullscreen) {
5811
+ initManagerState.fullscreen = createTeleBoxManagerConfig.fullscreen;
5812
+ }
5775
5813
  const manager = new TeleBoxManager(initManagerState);
5776
5814
  if (this.teleBoxManager) {
5777
5815
  this.teleBoxManager.destroy();
@@ -6482,16 +6520,16 @@ class Cursor {
6482
6520
  this.cursorManager = cursorManager;
6483
6521
  this.wrapper = wrapper;
6484
6522
  this.move = (position) => {
6485
- var _a;
6523
+ var _a, _b;
6486
6524
  if (position.type === "main") {
6487
- const rect = this.cursorManager.wrapperRect;
6525
+ const rect = (_a = this.manager.boxManager) == null ? void 0 : _a.stageRect;
6488
6526
  if (this.component && rect) {
6489
6527
  this.autoHidden();
6490
6528
  this.moveCursor(position, rect, this.manager.mainView);
6491
6529
  }
6492
6530
  } else {
6493
6531
  const focusView = this.cursorManager.focusView;
6494
- const viewRect = (_a = focusView == null ? void 0 : focusView.divElement) == null ? void 0 : _a.getBoundingClientRect();
6532
+ const viewRect = (_b = focusView == null ? void 0 : focusView.divElement) == null ? void 0 : _b.getBoundingClientRect();
6495
6533
  const viewCamera = focusView == null ? void 0 : focusView.camera;
6496
6534
  if (focusView && viewRect && viewCamera && this.component) {
6497
6535
  this.autoHidden();
@@ -6691,7 +6729,7 @@ class CursorManager {
6691
6729
  return;
6692
6730
  }
6693
6731
  this.updateCursor(this.getType(event), event.clientX, event.clientY);
6694
- }, 16);
6732
+ }, 48);
6695
6733
  this.getPoint = (view, clientX, clientY) => {
6696
6734
  var _a2;
6697
6735
  const rect = (_a2 = view == null ? void 0 : view.divElement) == null ? void 0 : _a2.getBoundingClientRect();
@@ -6752,6 +6790,7 @@ class CursorManager {
6752
6790
  wrapper.removeEventListener("pointerleave", this.mouseLeaveListener);
6753
6791
  };
6754
6792
  });
6793
+ this.updateContainerRect();
6755
6794
  }
6756
6795
  setMainViewDivElement(div) {
6757
6796
  this.mainViewElement = div;
@@ -6781,7 +6820,7 @@ class CursorManager {
6781
6820
  }
6782
6821
  updateContainerRect() {
6783
6822
  var _a, _b;
6784
- this.wrapperRect = (_a = this.manager.boxManager) == null ? void 0 : _a.teleBoxManager.stageRect;
6823
+ this.wrapperRect = (_a = this.manager.boxManager) == null ? void 0 : _a.stageRect;
6785
6824
  this.playgroundRect = (_b = WindowManager.playground) == null ? void 0 : _b.getBoundingClientRect();
6786
6825
  }
6787
6826
  deleteCursor(uid) {
@@ -16532,15 +16571,15 @@ const reconnectRefresher = new ReconnectRefresher({ emitter });
16532
16571
  const _WindowManager = class extends InvisiblePlugin {
16533
16572
  constructor(context) {
16534
16573
  super(context);
16535
- this.version = "1.0.0-canary.29";
16536
- this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "1.0.0-alpha.27", "emittery": "^0.11.0", "lodash": "^4.17.21", "p-retry": "^4.6.1", "side-effect-manager": "^1.1.0", "uuid": "^7.0.3", "value-enhancer": "^1.3.0", "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", "@playwright/test": "^1.23.0", "@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/node": "^18.0.0", "@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", "vite-plugin-dts": "^1.2.0", "vitest": "^0.14.1", "white-web-sdk": "2.16.10" } };
16574
+ this.version = "1.0.0-canary.31";
16575
+ this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "1.0.0-alpha.29", "emittery": "^0.11.0", "lodash": "^4.17.21", "p-retry": "^4.6.1", "side-effect-manager": "^1.1.0", "uuid": "^7.0.3", "value-enhancer": "^1.3.0", "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", "@playwright/test": "^1.23.0", "@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/node": "^18.0.0", "@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", "vite-plugin-dts": "^1.2.0", "vitest": "^0.14.1", "white-web-sdk": "2.16.10" } };
16537
16576
  this.emitter = callbacks$1;
16538
16577
  this.viewMode = ViewMode.Broadcaster;
16539
16578
  this.viewMode$ = new Val(ViewMode.Broadcaster);
16540
16579
  this.isReplay = isPlayer(this.displayer);
16541
16580
  this.containerSizeRatio = _WindowManager.containerSizeRatio;
16542
16581
  _WindowManager.displayer = context.displayer;
16543
- window.NETLESS_DEPS = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "1.0.0-alpha.27", "emittery": "^0.11.0", "lodash": "^4.17.21", "p-retry": "^4.6.1", "side-effect-manager": "^1.1.0", "uuid": "^7.0.3", "value-enhancer": "^1.3.0", "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", "@playwright/test": "^1.23.0", "@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/node": "^18.0.0", "@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", "vite-plugin-dts": "^1.2.0", "vitest": "^0.14.1", "white-web-sdk": "2.16.10" } };
16582
+ window.NETLESS_DEPS = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "1.0.0-alpha.29", "emittery": "^0.11.0", "lodash": "^4.17.21", "p-retry": "^4.6.1", "side-effect-manager": "^1.1.0", "uuid": "^7.0.3", "value-enhancer": "^1.3.0", "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", "@playwright/test": "^1.23.0", "@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/node": "^18.0.0", "@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", "vite-plugin-dts": "^1.2.0", "vitest": "^0.14.1", "white-web-sdk": "2.16.10" } };
16544
16583
  }
16545
16584
  static async mount(params) {
16546
16585
  var _a;
@@ -16596,7 +16635,8 @@ const _WindowManager = class extends InvisiblePlugin {
16596
16635
  prefersColorScheme: params.prefersColorScheme,
16597
16636
  stageRatio: _WindowManager.containerSizeRatio,
16598
16637
  containerStyle: params.containerStyle,
16599
- stageStyle: params.stageStyle
16638
+ stageStyle: params.stageStyle,
16639
+ fullscreen: params.fullscreen
16600
16640
  });
16601
16641
  (_a = manager.appManager) == null ? void 0 : _a.setBoxManager(manager.boxManager);
16602
16642
  if (params.container) {