@netless/app-slide 0.2.31-beta.3 → 0.2.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/main.es.js CHANGED
@@ -31185,7 +31185,7 @@ void main(void){
31185
31185
  }), this.onPauseMedia = () => {
31186
31186
  this.playButton.style.display = "block", this.pauseButton.style.display = "none";
31187
31187
  }, this.onPlayMedia = () => {
31188
- this.media.fullscreen && this.onClickFullScreenButtonHandle(), this.playButton.style.display = "none", this.pauseButton.style.display = "block", this.playCallBackList.forEach((t3) => {
31188
+ this.playButton.style.display = "none", this.pauseButton.style.display = "block", this.playCallBackList.forEach((t3) => {
31189
31189
  t3();
31190
31190
  });
31191
31191
  }, this._playMediaFromCtrl = () => {
@@ -31193,7 +31193,7 @@ void main(void){
31193
31193
  }, this._pauseMediaFromCtrl = () => {
31194
31194
  this.pauseMediaFromCtrl(false), this.delayHide();
31195
31195
  }, this.onClickFullScreenButtonHandle = () => {
31196
- this.fullscreenStatus = true, this.media.requestFullscreen(), this.ctx.eventHub.emit(Gy.fullscreenChange, { targetId: this.targetId, state: true }), this.delayHide();
31196
+ this.fullscreenPlay();
31197
31197
  }, this.onClickCancelFullScreenButtonHandle = () => {
31198
31198
  this.fullscreenStatus = false, this.media.requestCancelFullscreen(), this.ctx.eventHub.emit(Gy.fullscreenChange, { targetId: this.targetId, state: false }), this.delayHide();
31199
31199
  }, this.onFullScreenChange = (t3) => {
@@ -31319,6 +31319,9 @@ void main(void){
31319
31319
  addPlayCallBack(t2) {
31320
31320
  this.playCallBackList.push(t2);
31321
31321
  }
31322
+ fullscreenPlay() {
31323
+ this.fullscreenStatus = true, this.ctx.mode !== "interactive" && this.media.requestFullscreen(), this.ctx.mode !== "local" && this.ctx.eventHub.emit(Gy.fullscreenChange, { targetId: this.targetId, state: true }), this.delayHide();
31324
+ }
31322
31325
  changeFullScreenState(t2, e2, i2) {
31323
31326
  i2 === this.ctx.slideIndex && (t2 && this.targetId === e2 ? this.fullscreenStatus = t2 : this.fullscreenStatus = false, this.fullscreenStatus ? (this.fullScreenButton.style.display = "none", this.exitFullScreenButton.style.display = "block") : (this.fullScreenButton.style.display = "block", this.exitFullScreenButton.style.display = "none"), this.setControllerPosition());
31324
31327
  }
@@ -31499,8 +31502,8 @@ void main(void){
31499
31502
  const e2 = this.videoElement;
31500
31503
  e2 && e2.videoWidth <= 0 || (Hy.RtcAudioClazz ? (this.videoElement && (this.videoElement.volume = 0, this.videoElement.muted = true), this.rtcAudio.once("play", () => {
31501
31504
  var t3;
31502
- (t3 = this.videoElement) === null || t3 === void 0 || t3.play();
31503
- }), this.rtcAudio.play()) : yield (t2 = this.videoElement) === null || t2 === void 0 ? void 0 : t2.play());
31505
+ (t3 = this.videoElement) === null || t3 === void 0 || t3.play(), this.fullscreen && this.controller.fullscreenPlay();
31506
+ }), this.rtcAudio.play()) : (yield (t2 = this.videoElement) === null || t2 === void 0 ? void 0 : t2.play(), this.fullscreen && this.controller.fullscreenPlay()));
31504
31507
  });
31505
31508
  }
31506
31509
  load() {
@@ -31567,7 +31570,7 @@ void main(void){
31567
31570
  };
31568
31571
  class p_ extends Za.a {
31569
31572
  constructor(t2) {
31570
- super(), this.type = "audio", this.isPlaying = false, this.isGlobalPause = false, this.fullscreen = false, this.updateVolume = (t3) => {
31573
+ super(), this.type = "audio", this.isPlaying = false, this.isGlobalPause = false, this.updateVolume = (t3) => {
31571
31574
  this.audioPlayer.volume(t3);
31572
31575
  }, this.id = t2.id;
31573
31576
  let e2 = t2.audio.src;
@@ -33616,7 +33619,7 @@ void main(void){
33616
33619
  const ky = { randomBar: "RandomLines", circle: "Shape", ripple: "Ripples", wipe: "Erase", dissolve: "Dissolve", morph: "Smooth", fade: "FadeInOut", push: "Push", split: "Separation", reveal: "Display", pull: "Uncover", cover: "Cover", flash: "Flash", checker: "Checkerboard", blinds: "WindowShades", curtains: "Curtain", fallOver: "Fall", drape: "Suspension", wheel: "Clock", comb: "Combing", warp: "Scale", peelOff: "PeelOff", flip: "Flip", gallery: "Gallery", switch: "Switch", prism: "Prism", doors: "Doors" }, Gy = { mainSeqStepChange: "mainSeqStepChange", mainSeqStateChange: "mainSeqStateChange", interactiveSeqStateChange: "interactiveSeqStateChange", interactiveSeqAction: "interactiveSeqAction", mainSeqStepStart: "mainSeqStepStart", mainSeqStepEnd: "mainSeqStepEnd", slideChange: "slideChange", renderStart: "renderStart", renderEnd: "renderEnd", hyperlinkTrigger: "hyperlinkTrigger", animateStart: "animateStart", animateEnd: "animateEnd", mediaSeek: "mediaSeek", mediaPlay: "mediaPlay", mediaPause: "mediaPause", mediaStop: "mediaStop", requestNextSlide: "requestNextSlide", requestPrevSlide: "requestPrevSlide", requestGotoSlide: "requestGotoSlide", userInput: "userInput", fullscreenChange: "fullscreenChange", changeLocalFullscreenState: "changeLocalFullscreenState" };
33617
33620
  class Hy extends Za.a {
33618
33621
  constructor(t2, e2 = {}) {
33619
- super(), this.errorChannel = new Za.a(), this.transactionPlayer = null, this.isForward = true, this.drawCall = 0, this.scale = 1, this._isPaused = false, this.maxResolution = new Lh.g(0, 0), this.isNVIDIA = false, this.fps = new bm(), this.designWidth = 0, this.designHeight = 0, this.currentIndex = 0, this.slideCount = 0, this.runtime = { drawCall: 0, fps: 0 }, this.globalEventHub = new Za.a(), this.globalVideoSprite = new ep(), this.onMousemoveTimeout = null, this.cacheFunctionMap = /* @__PURE__ */ new Map(), this.isPlayerPaused = () => this._isPaused, this.onWebGLLost = () => {
33622
+ super(), this.errorChannel = new Za.a(), this.transactionPlayer = null, this.isForward = true, this.drawCall = 0, this.scale = 1, this._isPaused = false, this.maxResolution = new Lh.g(0, 0), this.isNVIDIA = false, this.fps = new bm(), this.designWidth = 0, this.designHeight = 0, this.currentIndex = 0, this.slideCount = 0, this.runtime = { drawCall: 0, fps: 0 }, this.globalEventHub = new Za.a(), this.globalVideoBackground = new Jd(), this.globalVideoSprite = new ep(), this.onMousemoveTimeout = null, this.cacheFunctionMap = /* @__PURE__ */ new Map(), this.isPlayerPaused = () => this._isPaused, this.onWebGLLost = () => {
33620
33623
  this.errorChannel.emit("error", new Tm(gm.CanvasCrash, "webgl context lost."));
33621
33624
  }, this.fullscreenOnMousemove = ({ index: t3, targetId: e3 }) => {
33622
33625
  this.globalEventHub.emit("controllerShowStatusChange", { slideIndex: t3, targetId: e3, status: true }), this.onMousemoveTimeout && clearTimeout(this.onMousemoveTimeout), this.onMousemoveTimeout = setTimeout(() => {
@@ -33624,31 +33627,42 @@ void main(void){
33624
33627
  }, s_.hoverHiddeDelay);
33625
33628
  }, this.fullscreenOnMouseleave = ({ index: t3, targetId: e3 }) => {
33626
33629
  this.globalEventHub.emit("controllerShowStatusChange", { slideIndex: t3, targetId: e3, status: false });
33630
+ }, this.calculateFullscreenVideoPosition = (t3) => {
33631
+ const { width: e3, height: i3 } = t3, { designWidth: n3, designHeight: r2 } = this, o2 = Math.min(n3 / e3, r2 / i3);
33632
+ return { x: (n3 - e3 * o2) / 2, y: (r2 - i3 * o2) / 2, width: e3 * o2, height: i3 * o2 };
33627
33633
  }, this.onRequestFullscreenVideo = (t3) => {
33628
33634
  const { texture: e3, index: i3, targetId: n3 } = t3;
33629
- if (i3 === this.currentIndex)
33630
- if (this.onRequestCancelFullscreenVideo(), this.globalVideoSprite.texture = e3, this.globalVideoSprite.width = this.designWidth, this.globalVideoSprite.height = this.designHeight, this.globalVideoSprite.interactive = true, this.app.stage.addChild(this.globalVideoSprite), this.globalEventHub.emit("onFullscreenChange", { status: true, targetId: n3, slideIndex: this.currentIndex }), n_.isDesktop()) {
33631
- const t4 = { handleEvent: () => {
33632
- this.fullscreenOnMouseleave({ index: i3, targetId: n3 });
33633
- } };
33634
- this.app.view.addEventListener("mouseout", t4, false);
33635
- const e4 = { handleEvent: () => {
33636
- this.globalEventHub.emit("controllerShowStatusChange", { slideIndex: i3, targetId: n3, status: true });
33637
- } };
33638
- this.app.view.addEventListener("mouseover", e4, false);
33639
- const r2 = { handleEvent: () => {
33640
- this.fullscreenOnMousemove({ index: i3, targetId: n3 });
33641
- } };
33642
- this.app.view.addEventListener("mousemove", r2, false), (this.cacheFunctionMap.has("move") || this.cacheFunctionMap.has("out") || this.cacheFunctionMap.has("over")) && this.clearFullscreenEventListenersWithAppView(), this.cacheFunctionMap.set("over", e4), this.cacheFunctionMap.set("move", r2), this.cacheFunctionMap.set("out", t4);
33643
- } else {
33644
- const t4 = { handleEvent: () => {
33645
- this.fullscreenOnMousemove({ index: i3, targetId: n3 });
33646
- } };
33647
- this.app.view.addEventListener("touchstart", t4, false), this.cacheFunctionMap.has("touch") && this.clearFullscreenEventListenersWithAppView(), this.cacheFunctionMap.set("touch", t4);
33648
- }
33635
+ if (i3 !== this.currentIndex)
33636
+ return void e3.destroy(false);
33637
+ this.onRequestCancelFullscreenVideo(), this.globalVideoBackground.width = this.designWidth, this.globalVideoBackground.height = this.designHeight, this.globalVideoBackground.beginFill(0, 1), this.globalVideoBackground.drawRect(0, 0, this.designWidth, this.designHeight), this.globalVideoBackground.endFill(), this.globalVideoBackground.interactive = true, this.app.stage.addChild(this.globalVideoBackground);
33638
+ const { x: r2, y: o2, width: s2, height: a2 } = this.calculateFullscreenVideoPosition(e3);
33639
+ this.globalVideoSprite.texture = e3, this.globalVideoSprite.width = s2, this.globalVideoSprite.height = a2, this.globalVideoSprite.position.x = r2, this.globalVideoSprite.position.y = o2, this.globalVideoBackground.addChild(this.globalVideoSprite), this.globalEventHub.emit("onFullscreenChange", { status: true, targetId: n3, slideIndex: this.currentIndex }), this.clearFullscreenEventListenersWithAppView();
33640
+ const l2 = { handleEvent: () => {
33641
+ var t4;
33642
+ (t4 = this.currentStage) === null || t4 === void 0 || t4.ctx.eventHub.emit(Gy.userInput);
33643
+ } };
33644
+ if (this.app.view.addEventListener("pointerdown", l2, false), this.cacheFunctionMap.set("pointerdown", l2), n_.isDesktop()) {
33645
+ const t4 = { handleEvent: () => {
33646
+ this.fullscreenOnMouseleave({ index: i3, targetId: n3 });
33647
+ } };
33648
+ this.app.view.addEventListener("mouseout", t4, false);
33649
+ const e4 = { handleEvent: () => {
33650
+ this.globalEventHub.emit("controllerShowStatusChange", { slideIndex: i3, targetId: n3, status: true });
33651
+ } };
33652
+ this.app.view.addEventListener("mouseover", e4, false);
33653
+ const r3 = { handleEvent: () => {
33654
+ this.fullscreenOnMousemove({ index: i3, targetId: n3 });
33655
+ } };
33656
+ this.app.view.addEventListener("mousemove", r3, false), this.cacheFunctionMap.set("mouseover", e4), this.cacheFunctionMap.set("mousemove", r3), this.cacheFunctionMap.set("mouseout", t4);
33657
+ } else {
33658
+ const t4 = { handleEvent: () => {
33659
+ this.fullscreenOnMousemove({ index: i3, targetId: n3 });
33660
+ } };
33661
+ this.app.view.addEventListener("touchstart", t4, false), this.cacheFunctionMap.set("touchstart", t4);
33662
+ }
33649
33663
  }, this.onRequestCancelFullscreenVideo = (t3 = false) => {
33650
33664
  var e3, i3;
33651
- this.globalVideoSprite.texture.destroy(false), this.app.stage.removeChild(this.globalVideoSprite), this.globalEventHub.emit("onFullscreenChange", { status: false, slideIndex: this.currentIndex, targetId: (e3 = this.currentStage) === null || e3 === void 0 ? void 0 : e3.ctx.latestChangeFullscreenTargetId }), this.clearFullscreenEventListenersWithAppView(), t3 && this.emit(Gy.changeLocalFullscreenState, { status: false, slideIndex: this.currentIndex, targetId: (i3 = this.currentStage) === null || i3 === void 0 ? void 0 : i3.ctx.latestChangeFullscreenTargetId });
33665
+ this.globalVideoSprite.texture.destroy(false), this.globalVideoBackground.removeChild(this.globalVideoSprite), this.app.stage.removeChild(this.globalVideoBackground), this.globalEventHub.emit("onFullscreenChange", { status: false, slideIndex: this.currentIndex, targetId: (e3 = this.currentStage) === null || e3 === void 0 ? void 0 : e3.ctx.latestChangeFullscreenTargetId }), this.clearFullscreenEventListenersWithAppView(), t3 && this.emit(Gy.changeLocalFullscreenState, { status: false, slideIndex: this.currentIndex, targetId: (i3 = this.currentStage) === null || i3 === void 0 ? void 0 : i3.ctx.latestChangeFullscreenTargetId });
33652
33666
  }, this.logger = t2.logger, this.mode = t2.mode, this.volumeAdjuster = t2.volumeAdjuster, this.localStorage = new Ly(this.logger), this.cachedExtract = new Fy(this.localStorage), this.config = { minFPS: $a()(e2.minFPS) ? 30 : e2.minFPS, maxFPS: $a()(e2.maxFPS) ? 40 : e2.maxFPS, resolution: $a()(e2.resolution) ? 1 : e2.resolution, autoFPS: !$a()(e2.autoFPS) && e2.autoFPS, autoResolution: !$a()(e2.autoResolution) && e2.autoResolution, transactionBgColor: $a()(e2.transactionBgColor) ? 0 : e2.transactionBgColor, maxResolutionLevel: this.getMaxResolution(e2.maxResolutionLevel), forceCanvas: !$a()(e2.forceCanvas) && e2.forceCanvas, enableNvidiaDetect: !$a()(e2.enableNvidiaDetect) && e2.enableNvidiaDetect }, this.updateMaxResolutionLevel(this.config.maxResolutionLevel), this.loader = new Lm(this.localStorage, t2.useLocalCache, this.logger, t2.resourceTimeout, t2.loadDelegate);
33653
33667
  const i2 = Ph.isWebGLSupported();
33654
33668
  this.app = new Xh({ antialias: true, autoDensity: false, backgroundColor: 16777215, forceCanvas: this.config.forceCanvas || !i2 }), this.updateConfig(this.config), this.app.ticker.maxFPS = 60, this.app.ticker.minFPS = this.config.minFPS, this.app.ticker.maxFPS = this.config.maxFPS, this.app.view.style.zIndex = "1", this.app.stage.sortableChildren = true;
@@ -33948,7 +33962,9 @@ void main(void){
33948
33962
  });
33949
33963
  }
33950
33964
  clearFullscreenEventListenersWithAppView() {
33951
- this.cacheFunctionMap.has("move") && (this.app.view.removeEventListener("mousemove", this.cacheFunctionMap.get("move"), false), this.cacheFunctionMap.delete("move")), this.cacheFunctionMap.has("out") && (this.app.view.removeEventListener("mouseout", this.cacheFunctionMap.get("out"), false), this.cacheFunctionMap.delete("out")), this.cacheFunctionMap.has("over") && (this.app.view.removeEventListener("mouseover", this.cacheFunctionMap.get("over"), false), this.cacheFunctionMap.delete("over")), this.cacheFunctionMap.has("touch") && (this.app.view.removeEventListener("touchstart", this.cacheFunctionMap.get("touch"), false), this.cacheFunctionMap.delete("touch"));
33965
+ ["mousemove", "mouseout", "mouseover", "touchstart", "pointerdown"].forEach((t2) => {
33966
+ this.cacheFunctionMap.has(t2) && (this.app.view.removeEventListener(t2, this.cacheFunctionMap.get(t2), false), this.cacheFunctionMap.delete(t2));
33967
+ });
33952
33968
  }
33953
33969
  syncFullscreenVideoState(t2) {
33954
33970
  this.globalEventHub.emit("syncFullscreenVideoState", t2);
@@ -35669,7 +35685,7 @@ void main(void){
35669
35685
  }
35670
35686
  var lT = { syncDispatch: "syncDispatch", syncReceive: "syncReceive", syncEventLag: "syncEventLag", renderStart: "renderStart", renderEnd: "renderEnd", renderError: "renderError", slideChange: "slideChange", mainSeqStepStart: "mainSeqStepStart", mainSeqStepEnd: "mainSeqStepEnd", animateStart: "animateStart", animateEnd: "animateEnd", stateChange: "stateChange", slideStepEnd: "slideEnd", slideStepStart: "slideStart" }, hT = { taskId: "", url: "", currentSlideIndex: -1, mainSeqStep: -1, mainSeqState: null, mediaState: /* @__PURE__ */ Object.create(null), interactiveSeqState: /* @__PURE__ */ Object.create(null) }, uT = "";
35671
35687
  try {
35672
- uT = "0.10.3-beta.2";
35688
+ uT = "0.10.3-beta.4";
35673
35689
  } catch (t2) {
35674
35690
  uT = "dev";
35675
35691
  }
@@ -38739,7 +38755,7 @@ class SlidePreviewer {
38739
38755
  }
38740
38756
  }
38741
38757
  const usePlugin = /* @__PURE__ */ Slide.Slide.usePlugin.bind(Slide.Slide);
38742
- const version = "0.2.31-beta.3";
38758
+ const version = "0.2.31";
38743
38759
  const SlideApp = {
38744
38760
  kind: "Slide",
38745
38761
  setup(context) {