@netless/app-slide 0.2.30-beta.1 → 0.2.30

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
@@ -31049,7 +31049,7 @@ void main(void){
31049
31049
  var t3, e2;
31050
31050
  (t3 = this.strokeGraphics) === null || t3 === void 0 || t3.render(), (e2 = this.backgroundGraphics) === null || e2 === void 0 || e2.render(), this.createBackground(), this.subClassRender(), this.createFilledPathMask(), this.createPathFill(), this.createArrow();
31051
31051
  }), "@ShapeImpl[render]"), this.text && this.text.render(t2), t2.addSubMTask(() => Zv(this, void 0, void 0, function* () {
31052
- var t3, e2, i2, n2, r2, o2, s2, a2, l2, h2, u2;
31052
+ var t3, e2, i2, n2, r2, o2, s2, a2, l2, h2, u2, c2, d2;
31053
31053
  if (((t3 = this.json.textBody) === null || t3 === void 0 ? void 0 : t3.iterateType) === "wd" || ((e2 = this.json.textBody) === null || e2 === void 0 ? void 0 : e2.iterateType) === "lt") {
31054
31054
  if (this.renderContainer.addChild(this.container), this.text) {
31055
31055
  const { x: t4, y: e3 } = (i2 = this.json.scale) !== null && i2 !== void 0 ? i2 : { x: 1, y: 1 };
@@ -31060,12 +31060,12 @@ void main(void){
31060
31060
  if (cg()(this.json.textRotateWithShape) && !this.json.textRotateWithShape) {
31061
31061
  const t5 = this.json.rotation || 0;
31062
31062
  this.text.container.rotation = -t5;
31063
- const { width: e3 } = this.text;
31064
- this.text.container.position.x = e3;
31063
+ const { width: e4 } = this.text;
31064
+ this.text.container.position.x = e4;
31065
31065
  }
31066
31066
  this.text.container.zIndex = 100;
31067
- const t4 = (a2 = this.json.effectList) === null || a2 === void 0 ? void 0 : a2.find((t5) => t5.type === "outerShadow");
31068
- t4 && t4.sx !== 1 ? this.container.addChild(this.text.container) : this.effectContainer.addChild(this.text.container);
31067
+ const t4 = (a2 = this.json.effectList) === null || a2 === void 0 ? void 0 : a2.find((t5) => t5.type === "outerShadow"), e3 = (l2 = this.json.effectList) === null || l2 === void 0 ? void 0 : l2.find((t5) => t5.type === "softEdge"), i3 = (h2 = this.json.effectList) === null || h2 === void 0 ? void 0 : h2.find((t5) => t5.type === "glow");
31068
+ t4 && t4.sx !== 1 || e3 || i3 ? this.container.addChild(this.text.container) : this.effectContainer.addChild(this.text.container);
31069
31069
  }
31070
31070
  this.renderContainer.addChild(this.container);
31071
31071
  }
@@ -31073,7 +31073,7 @@ void main(void){
31073
31073
  const t4 = Vh.p.create({ width: this.json.width, height: this.json.height, resolution: Math.ceil(this.ctx.renderer.resolution) });
31074
31074
  this.ctx.renderer.render(this.renderContainer, { renderTexture: t4 }), this.ctx.bgTexture = t4;
31075
31075
  }
31076
- this.json.effectList && this.json.effectList.length > 0 && ((l2 = this.ctx.featureList) === null || l2 === void 0 ? void 0 : l2.effect) && !this.ctx.forceCanvas && (this.effectObject = new qv(this.effectContainer, this.json.effectList, `${this.ctx.taskId}_${this.ctx.slideIndex}_${this.json.id}`, this.ctx, this.json.rotation || 0, new Lh.g(((h2 = this.json.scale) === null || h2 === void 0 ? void 0 : h2.x) || 1, ((u2 = this.json.scale) === null || u2 === void 0 ? void 0 : u2.y) || 1)), function(t4) {
31076
+ this.json.effectList && this.json.effectList.length > 0 && ((u2 = this.ctx.featureList) === null || u2 === void 0 ? void 0 : u2.effect) && !this.ctx.forceCanvas && !this.json.media && (this.effectObject = new qv(this.effectContainer, this.json.effectList, `${this.ctx.taskId}_${this.ctx.slideIndex}_${this.json.id}`, this.ctx, this.json.rotation || 0, new Lh.g(((c2 = this.json.scale) === null || c2 === void 0 ? void 0 : c2.x) || 1, ((d2 = this.json.scale) === null || d2 === void 0 ? void 0 : d2.y) || 1)), function(t4) {
31077
31077
  var e3, i3, n3;
31078
31078
  return ((e3 = t4.fillStyle) === null || e3 === void 0 ? void 0 : e3.fillType) === "gifFill" || (((n3 = (i3 = t4.lineStyle) === null || i3 === void 0 ? void 0 : i3.fill) === null || n3 === void 0 ? void 0 : n3.fillType) === "gifFill" || !!t4.picFill && t4.picFill.fillType === "gifFill");
31079
31079
  }(this.json) && this.effectObject.setFrameCount(-1), this.effectObject.on("ready", () => {
@@ -31157,10 +31157,10 @@ void main(void){
31157
31157
  this.playButton.style.display = "none", this.pauseButton.style.display = "block", this.playCallBackList.forEach((t3) => {
31158
31158
  t3();
31159
31159
  });
31160
- }, this.playMediaFromCtrl = () => {
31161
- this.ctx.isPlayerPaused() ? this.ctx.logger.info("Media controller prevent play event with paused state", this.ctx.taskId) : (this.ctx.mode !== "interactive" && this.playMedia(), this.ctx.mode !== "local" && this.ctx.eventHub.emit(ky.mediaPlay, { id: this.targetId, time: this.media.currentTime - this.start }));
31162
- }, this.pauseMediaFromCtrl = () => {
31163
- this.ctx.isPlayerPaused() ? this.ctx.logger.info("Media controller prevent pause event with paused state", this.ctx.taskId) : (this.ctx.mode !== "interactive" && this.pauseMedia(), this.ctx.mode === "local" || this.ctx.isRendering || this.ctx.eventHub.emit(ky.mediaPause, { id: this.targetId, time: this.media.currentTime - this.start }));
31160
+ }, this._playMediaFromCtrl = () => {
31161
+ this.playMediaFromCtrl(false);
31162
+ }, this._pauseMediaFromCtrl = () => {
31163
+ this.pauseMediaFromCtrl(false);
31164
31164
  }, this.onClickFullScreenButtonHandle = () => {
31165
31165
  this.media.requestFullscreen(), this.ctx.eventHub.emit(ky.fullscreenChange, { targetId: this.targetId, state: true });
31166
31166
  }, this.onClickCancelFullScreenButtonHandle = () => {
@@ -31260,6 +31260,12 @@ void main(void){
31260
31260
  }
31261
31261
  }
31262
31262
  }
31263
+ playMediaFromCtrl(t2) {
31264
+ this.ctx.isPlayerPaused() ? this.ctx.logger.info("Media controller prevent play event with paused state", this.ctx.taskId) : (this.ctx.mode !== "interactive" && this.playMedia(), this.ctx.mode !== "local" && this.ctx.eventHub.emit(ky.mediaPlay, { id: this.targetId, time: this.media.currentTime - this.start, _stateOnly: t2 }));
31265
+ }
31266
+ pauseMediaFromCtrl(t2) {
31267
+ this.ctx.isPlayerPaused() ? this.ctx.logger.info("Media controller prevent pause event with paused state", this.ctx.taskId) : (this.ctx.mode !== "interactive" && this.pauseMedia(), this.ctx.mode === "local" || this.ctx.isRendering || this.ctx.eventHub.emit(ky.mediaPause, { id: this.targetId, time: this.media.currentTime - this.start, _stateOnly: t2 }));
31268
+ }
31263
31269
  setControllerPosition() {
31264
31270
  var t2;
31265
31271
  const { target: e2 } = this, { stageWidth: i2, stageHeight: n2 } = this.ctx, r2 = e2.getGlobalPosition(), o2 = Number((t2 = this.container) === null || t2 === void 0 ? void 0 : t2.getAttribute("data-scale")), s2 = i2 * o2, a2 = 1 / o2 * (300 > s2 ? s2 / 300 : 1);
@@ -31277,11 +31283,11 @@ void main(void){
31277
31283
  i2 === this.ctx.slideIndex ? t2 && this.targetId === e2 ? (this.fullScreenButton.style.display = "none", this.exitFullScreenButton.style.display = "block", this.mediaController.style.display = "flex", this.mediaController.removeEventListener("mouseout", this.onMouseOut, false)) : (this.fullScreenButton.style.display = "block", this.exitFullScreenButton.style.display = "none", this.mediaController.style.display = "none", this.mediaController.addEventListener("mouseout", this.onMouseOut, false)) : this.ctx.logger.info("Media controller prevent fullscreen event with different slide index", this.ctx.taskId);
31278
31284
  }
31279
31285
  bindEvent() {
31280
- this.mediaController.addEventListener("mouseover", this.showController, false), this.mediaController.addEventListener("mouseout", this.onMouseOut, false), this.progress.addEventListener("mousedown", this.changeMediaProgress, false), this.playButton.addEventListener("click", this.playMediaFromCtrl, false), this.pauseButton.addEventListener("click", this.pauseMediaFromCtrl, false), this.media.on("durationchange", this.getMediaDuration, false), this.media.on("timeupdate", this.mediaTimeUpdate, false), this.media.on("pause", this.onPauseMedia, false), this.media.on("play", this.onPlayMedia, false), this.isVideo && (this.ctx.globalEventHub.on("onFullscreenChange", this.onFullScreenChange), this.fullScreenButton.addEventListener("click", this.onClickFullScreenButtonHandle, false), this.exitFullScreenButton.addEventListener("click", this.onClickCancelFullScreenButtonHandle, false), this.containerObserver = new MutationObserver(this.onContainerSizeChange), this.container && this.containerObserver.observe(this.container, { attributes: true, attributeFilter: ["data-scale", "style"] }));
31286
+ this.mediaController.addEventListener("mouseover", this.showController, false), this.mediaController.addEventListener("mouseout", this.onMouseOut, false), this.progress.addEventListener("mousedown", this.changeMediaProgress, false), this.playButton.addEventListener("click", this._playMediaFromCtrl, false), this.pauseButton.addEventListener("click", this._pauseMediaFromCtrl, false), this.media.on("durationchange", this.getMediaDuration, false), this.media.on("timeupdate", this.mediaTimeUpdate, false), this.media.on("pause", this.onPauseMedia, false), this.media.on("play", this.onPlayMedia, false), this.isVideo && (this.ctx.globalEventHub.on("onFullscreenChange", this.onFullScreenChange), this.fullScreenButton.addEventListener("click", this.onClickFullScreenButtonHandle, false), this.exitFullScreenButton.addEventListener("click", this.onClickCancelFullScreenButtonHandle, false), this.containerObserver = new MutationObserver(this.onContainerSizeChange), this.container && this.containerObserver.observe(this.container, { attributes: true, attributeFilter: ["data-scale", "style"] }));
31281
31287
  }
31282
31288
  unbindEvent() {
31283
31289
  var t2;
31284
- this.mediaController.removeEventListener("mouseover", this.showController, false), this.mediaController.removeEventListener("mouseout", this.onMouseOut, false), this.progress.removeEventListener("mousedown", this.changeMediaProgress, false), this.playButton.removeEventListener("click", this.playMediaFromCtrl, false), this.pauseButton.removeEventListener("click", this.pauseMediaFromCtrl, false), this.media.removeAllListeners(), this.isVideo && (this.ctx.globalEventHub.removeListener("onFullscreenChange", this.onFullScreenChange), this.fullScreenButton.removeEventListener("click", this.onClickFullScreenButtonHandle, false), this.exitFullScreenButton.removeEventListener("click", this.onClickCancelFullScreenButtonHandle, false), (t2 = this.containerObserver) === null || t2 === void 0 || t2.disconnect());
31290
+ this.mediaController.removeEventListener("mouseover", this.showController, false), this.mediaController.removeEventListener("mouseout", this.onMouseOut, false), this.progress.removeEventListener("mousedown", this.changeMediaProgress, false), this.playButton.removeEventListener("click", this._playMediaFromCtrl, false), this.pauseButton.removeEventListener("click", this._pauseMediaFromCtrl, false), this.media.removeAllListeners(), this.isVideo && (this.ctx.globalEventHub.removeListener("onFullscreenChange", this.onFullScreenChange), this.fullScreenButton.removeEventListener("click", this.onClickFullScreenButtonHandle, false), this.exitFullScreenButton.removeEventListener("click", this.onClickCancelFullScreenButtonHandle, false), (t2 = this.containerObserver) === null || t2 === void 0 || t2.disconnect());
31285
31291
  }
31286
31292
  show() {
31287
31293
  this.setControllerPosition(), this.mediaController.style.display = "flex";
@@ -31594,12 +31600,12 @@ void main(void){
31594
31600
  if (e2 === "call")
31595
31601
  if (/playFrom\(([0-9.]+)\)/.test(t2)) {
31596
31602
  const e3 = t2.match(/playFrom\(([0-9.]+)\)/), n3 = Number(e3[1] || "0");
31597
- (i2 = this.mediaPlayer) === null || i2 === void 0 || i2.controller.playMediaFromCtrl(), setTimeout(() => {
31603
+ (i2 = this.mediaPlayer) === null || i2 === void 0 || i2.controller.playMediaFromCtrl(true), setTimeout(() => {
31598
31604
  var t3;
31599
31605
  (t3 = this.mediaPlayer) === null || t3 === void 0 || t3.controller.jumpToTime(n3);
31600
31606
  }, 1e3);
31601
31607
  } else
31602
- t2 === "custom-pause" ? (n2 = this.mediaPlayer) === null || n2 === void 0 || n2.controller.pauseMediaFromCtrl() : t2 === "togglePause" ? this.mediaPlayer && (this.mediaPlayer.isPlaying ? this.mediaPlayer.controller.pauseMediaFromCtrl() : this.mediaPlayer.controller.playMediaFromCtrl()) : t2 === "stop" && ((r2 = this.mediaPlayer) === null || r2 === void 0 || r2.stop());
31608
+ t2 === "custom-pause" ? (n2 = this.mediaPlayer) === null || n2 === void 0 || n2.controller.pauseMediaFromCtrl(true) : t2 === "togglePause" ? this.mediaPlayer && (this.mediaPlayer.isPlaying ? this.mediaPlayer.controller.pauseMediaFromCtrl(true) : this.mediaPlayer.controller.playMediaFromCtrl(true)) : t2 === "stop" && ((r2 = this.mediaPlayer) === null || r2 === void 0 || r2.stop());
31603
31609
  }
31604
31610
  renderPic() {
31605
31611
  var t2, e2, i2, n2, r2, o2;
@@ -32407,7 +32413,7 @@ void main(void){
32407
32413
  !this.isApplied && i2 && n2 && (this.isApplied = true, (e2 = (t3 = this.timingTarget) === null || t3 === void 0 ? void 0 : t3.cmd) === null || e2 === void 0 || e2.applyCommand(i2, n2));
32408
32414
  }, this.onSeekToStart = () => {
32409
32415
  var t3, e2;
32410
- (e2 = (t3 = this.timingTarget) === null || t3 === void 0 ? void 0 : t3.cmd) === null || e2 === void 0 || e2.applyCommand("custom-pause", "call");
32416
+ this.commonTimeNode.isInInteractiveSeq || (e2 = (t3 = this.timingTarget) === null || t3 === void 0 ? void 0 : t3.cmd) === null || e2 === void 0 || e2.applyCommand("custom-pause", "call");
32411
32417
  }, this.onSeekToEnd = () => {
32412
32418
  }, this.commonTimeNode.on("timeNodeStart", () => {
32413
32419
  this.isApplied = false;
@@ -35620,7 +35626,7 @@ void main(void){
35620
35626
  }
35621
35627
  var aT = { 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" }, lT = { taskId: "", url: "", currentSlideIndex: -1, mainSeqStep: -1, mainSeqState: null, mediaState: /* @__PURE__ */ Object.create(null), interactiveSeqState: /* @__PURE__ */ Object.create(null) }, hT = "";
35622
35628
  try {
35623
- hT = "0.10.1";
35629
+ hT = "0.10.2-beta.1";
35624
35630
  } catch (t2) {
35625
35631
  hT = "dev";
35626
35632
  }
@@ -35838,12 +35844,16 @@ void main(void){
35838
35844
  r2.emit(aT.mainSeqStepEnd, t4);
35839
35845
  }), o2.on(ky.mediaPlay, function(t4) {
35840
35846
  var e4, i4 = (e4 = r2.__slideState.mediaState[t4.id]) !== null && e4 !== void 0 ? e4 : {};
35841
- i4.type = "play", i4.time = r2.timestamp() - 1e3 * t4.time, r2.__slideState.mediaState[t4.id] = i4, r2.emitSyncDispatch({ slideIndex: r2.__slideState.currentSlideIndex, type: "mediaPlay", id: t4.id, state: i4 }), r2.emitStateChange();
35847
+ i4.type = "play", i4.time = r2.timestamp() - 1e3 * t4.time, r2.__slideState.mediaState[t4.id] = i4, t4._stateOnly ? r2.config.mode === "interactive" && r2.receiveSyncHandler({ slideIndex: r2.__slideState.currentSlideIndex, type: "mediaPlay", id: t4.id, state: i4 }).catch(function(t5) {
35848
+ r2.logger.error(t5 == null ? void 0 : t5.message, r2.taskId);
35849
+ }) : r2.emitSyncDispatch({ slideIndex: r2.__slideState.currentSlideIndex, type: "mediaPlay", id: t4.id, state: i4 }), r2.emitStateChange();
35842
35850
  }), o2.on(ky.mediaStop, function(t4) {
35843
35851
  delete r2.__slideState.mediaState[t4.id], r2.emitStateChange();
35844
35852
  }), o2.on(ky.mediaPause, function(t4) {
35845
35853
  var e4, i4 = (e4 = r2.__slideState.mediaState[t4.id]) !== null && e4 !== void 0 ? e4 : {};
35846
- i4.type = "pause", i4.time = t4.time, r2.__slideState.mediaState[t4.id] = i4, r2.emitSyncDispatch({ slideIndex: r2.__slideState.currentSlideIndex, type: "mediaPause", id: t4.id, state: i4 }), r2.emitStateChange();
35854
+ i4.type = "pause", i4.time = t4.time, r2.__slideState.mediaState[t4.id] = i4, t4._stateOnly ? r2.config.mode === "interactive" && r2.receiveSyncHandler({ slideIndex: r2.__slideState.currentSlideIndex, type: "mediaPause", id: t4.id, state: i4 }).catch(function(t5) {
35855
+ r2.logger.error(t5 == null ? void 0 : t5.message, r2.taskId);
35856
+ }) : r2.emitSyncDispatch({ slideIndex: r2.__slideState.currentSlideIndex, type: "mediaPause", id: t4.id, state: i4 }), r2.emitStateChange();
35847
35857
  }), o2.on(ky.mediaSeek, function(t4) {
35848
35858
  var e4, i4 = (e4 = r2.__slideState.mediaState[t4.id]) !== null && e4 !== void 0 ? e4 : {};
35849
35859
  t4.isPlaying ? (i4.type = "play", i4.time = r2.timestamp() - 1e3 * t4.time) : (i4.type = "pause", i4.time = t4.time), r2.__slideState.mediaState[t4.id] = i4, r2.emitSyncDispatch({ slideIndex: r2.__slideState.currentSlideIndex, type: "mediaSeek", id: t4.id, time: t4.time, state: i4 }), r2.emitStateChange();
@@ -38685,7 +38695,7 @@ class SlidePreviewer {
38685
38695
  }
38686
38696
  }
38687
38697
  const usePlugin = /* @__PURE__ */ Slide.Slide.usePlugin.bind(Slide.Slide);
38688
- const version = "0.2.30-beta.1";
38698
+ const version = "0.2.30";
38689
38699
  const SlideApp = {
38690
38700
  kind: "Slide",
38691
38701
  setup(context) {