@netless/app-slide 0.2.105-beta.1 → 0.2.105-beta.2

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/main.es.js CHANGED
@@ -42853,7 +42853,7 @@ class SlidePreviewer {
42853
42853
  }
42854
42854
  }
42855
42855
  const usePlugin = /* @__PURE__ */ Slide.Slide.usePlugin.bind(Slide.Slide);
42856
- const version = "0.2.105-beta.1";
42856
+ const version = "0.2.105-beta.2";
42857
42857
  const DEFAULT_SLIDE_SETUP_READY_TIMEOUT = 5e3;
42858
42858
  const SlideApp = {
42859
42859
  kind: "Slide",
@@ -42919,6 +42919,8 @@ const SlideApp = {
42919
42919
  apps.set(context.appId, slideController, box);
42920
42920
  logger.setAppController(context.appId, slideController);
42921
42921
  slideController.readyPromise.then(options.onReady).then(() => {
42922
+ if (disposed)
42923
+ return;
42922
42924
  const room2 = context.getRoom();
42923
42925
  let synced = false;
42924
42926
  if (room2 && context.getIsWritable()) {
@@ -42973,6 +42975,44 @@ const SlideApp = {
42973
42975
  return () => room.callbacks.off("onRoomStateChanged", onRoomStateChanged);
42974
42976
  });
42975
42977
  }
42978
+ const isLazySetupMode = () => {
42979
+ var _a2;
42980
+ return ((_a2 = context.getWindowManager()) == null ? void 0 : _a2.lazySetupInMaximizedMode) === true;
42981
+ };
42982
+ const isBlurFreezeAllowed = () => {
42983
+ var _a2;
42984
+ const boxStatus = context.getBoxStatus();
42985
+ if (boxStatus)
42986
+ return boxStatus !== "normal";
42987
+ const boxState = (_a2 = context.getWindowManager()) == null ? void 0 : _a2.boxState;
42988
+ return boxState != null && boxState !== "normal";
42989
+ };
42990
+ sideEffect.add(
42991
+ () => context.emitter.on("focus", (isFocused) => {
42992
+ if (disposed)
42993
+ return;
42994
+ if (!isLazySetupMode())
42995
+ return;
42996
+ const controller = docsViewer == null ? void 0 : docsViewer.slideController;
42997
+ if (!controller)
42998
+ return;
42999
+ if (!isFocused) {
43000
+ if (!isBlurFreezeAllowed())
43001
+ return;
43002
+ if (!controller.isFrozen) {
43003
+ log("[Slide] blur freeze", context.appId);
43004
+ controller.freeze();
43005
+ }
43006
+ return;
43007
+ }
43008
+ if (useFreezer) {
43009
+ apps.focus(context.appId);
43010
+ } else if (controller.isFrozen) {
43011
+ log("[Slide] focus unfreeze", context.appId);
43012
+ controller.unfreeze();
43013
+ }
43014
+ })
43015
+ );
42976
43016
  let disposed = false;
42977
43017
  let offDestroy;
42978
43018
  const teardown = () => {