@netless/app-slide 0.2.91 → 0.2.93

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
@@ -28682,10 +28682,22 @@ void main() {
28682
28682
  const t3 = l2 * u2;
28683
28683
  t3 > 2048 && (l2 *= u2 / t3);
28684
28684
  }
28685
- const c2 = document.createElement("canvas"), d2 = Math.ceil(a2.width * l2), p2 = Math.ceil(a2.height * l2);
28686
- c2.width = d2, c2.height = p2;
28687
- c2.getContext("2d").drawImage(a2, 0, 0, d2, p2);
28688
- const f2 = new Vh.c(c2, { resolution: 1 });
28685
+ const c2 = Math.ceil(a2.width * l2), d2 = Math.ceil(a2.height * l2);
28686
+ let p2;
28687
+ try {
28688
+ p2 = yield createImageBitmap(a2, { resizeWidth: c2, resizeHeight: d2, resizeQuality: "high" });
28689
+ } catch (t3) {
28690
+ this.logger.warn("createImageBitmap failed, fallback to canvas: " + t3, this.taskId || "");
28691
+ const e3 = document.createElement("canvas");
28692
+ e3.width = c2, e3.height = d2;
28693
+ const i3 = e3.getContext("2d");
28694
+ if (!i3)
28695
+ throw new Tm(gm.CanvasCrash, "Failed to get 2D context from canvas");
28696
+ i3.drawImage(a2, 0, 0, c2, d2);
28697
+ const n3 = new Vh.c(e3, { resolution: 1 });
28698
+ return this.logger.info("load end. " + r2, this.taskId || ""), { baseTexture: n3, scale: l2 };
28699
+ }
28700
+ const f2 = new Vh.c(p2, { resolution: 1 });
28689
28701
  return this.logger.info("load end. " + r2, this.taskId || ""), { baseTexture: f2, scale: l2 };
28690
28702
  });
28691
28703
  }
@@ -31062,8 +31074,20 @@ void main(void){
31062
31074
  if (this.json.isMathFallback) {
31063
31075
  if (!this.json.textBody)
31064
31076
  return this;
31065
- const t3 = () => this.json.textBody.paragraphs[0].lines.length <= 1, e3 = () => this.json.textBody.paragraphs[0].lines[0].textUnits.length <= 1, i3 = () => "" === this.json.textBody.paragraphs[0].lines[0].textUnits[0].content.trim();
31066
- if ((() => this.json.textBody.paragraphs.length <= 1)() && t3() && e3() && i3())
31077
+ const t3 = () => {
31078
+ var t4, e4, i4, n3;
31079
+ return Number(null !== (n3 = null === (i4 = null === (e4 = null === (t4 = this.json.textBody) || void 0 === t4 ? void 0 : t4.paragraphs) || void 0 === e4 ? void 0 : e4[0]) || void 0 === i4 ? void 0 : i4.lines.length) && void 0 !== n3 ? n3 : 0) <= 1;
31080
+ }, e3 = () => {
31081
+ var t4, e4, i4, n3, r2, o2, s2;
31082
+ return Number(null !== (s2 = null === (o2 = null === (r2 = null === (n3 = null === (i4 = null === (e4 = null === (t4 = this.json.textBody) || void 0 === t4 ? void 0 : t4.paragraphs) || void 0 === e4 ? void 0 : e4[0]) || void 0 === i4 ? void 0 : i4.lines) || void 0 === n3 ? void 0 : n3[0]) || void 0 === r2 ? void 0 : r2.textUnits) || void 0 === o2 ? void 0 : o2.length) && void 0 !== s2 ? s2 : 0) <= 1;
31083
+ }, i3 = () => {
31084
+ var t4, e4, i4, n3, r2, o2;
31085
+ return "" === (null !== (o2 = null === (r2 = null === (n3 = null === (i4 = null === (e4 = null === (t4 = this.json.textBody.paragraphs[0]) || void 0 === t4 ? void 0 : t4.lines[0]) || void 0 === e4 ? void 0 : e4.textUnits) || void 0 === i4 ? void 0 : i4[0]) || void 0 === n3 ? void 0 : n3.content) || void 0 === r2 ? void 0 : r2.trim()) && void 0 !== o2 ? o2 : "");
31086
+ };
31087
+ if ((() => {
31088
+ var t4, e4;
31089
+ return Number(null === (e4 = null === (t4 = this.json.textBody) || void 0 === t4 ? void 0 : t4.paragraphs) || void 0 === e4 ? void 0 : e4.length) <= 1;
31090
+ })() && t3() && e3() && i3())
31067
31091
  return this;
31068
31092
  }
31069
31093
  return null !== (n2 = null === (i2 = this.text) || void 0 === i2 ? void 0 : i2.getTextElement(t2, e2)) && void 0 !== n2 ? n2 : null;
@@ -34151,12 +34175,13 @@ void main(void){
34151
34175
  this.slideCount = c2, this.designWidth = h2, this.designHeight = u2, null === (e2 = this.currentStage) || void 0 === e2 || e2.clearOnSlideChange();
34152
34176
  const d2 = this.currentStage;
34153
34177
  this.currentStage = s2, s2.initOnReuse(), s2.createTiming(), s2.container.visible = true, s2.collectMainSeqStartValue(), this.isForward ? s2.setMainSeqStep(0, "start") : s2.setMainSeqStep(-1, "end"), this.onRequestCancelFullscreenVideo(true);
34154
- let p2 = false;
34155
- if (Ph.isWebGLSupported() && !this.config.forceCanvas && s2.json.transition && s2.json.transition.type && this.app.stage.children.length > 0 && this.view && d2) {
34178
+ const p2 = () => !!this.app.renderer.gl;
34179
+ let f2 = false;
34180
+ if (Ph.isWebGLSupported() && !this.config.forceCanvas && s2.json.transition && s2.json.transition.type && this.app.stage.children.length > 0 && this.view && d2 && !p2()) {
34156
34181
  let { transition: t3 } = s2.json;
34157
34182
  !this.isForward && (null == d2 ? void 0 : d2.json.transition) && (t3 = d2.json.transition);
34158
34183
  const e3 = this.getTransactionTexture(d2, this.view, null, null);
34159
- this.initTransactionPlayer(t3), null === (i2 = this.transactionPlayer) || void 0 === i2 || i2.setPrevTexture(e3), p2 = true;
34184
+ this.initTransactionPlayer(t3), null === (i2 = this.transactionPlayer) || void 0 === i2 || i2.setPrevTexture(e3), f2 = true;
34160
34185
  }
34161
34186
  if (this.app.stage.addChild(s2.container), this.updateResolution(this.config.resolution * this.scale), d2) {
34162
34187
  d2.clearOnTransactionEnd();
@@ -34166,8 +34191,8 @@ void main(void){
34166
34191
  this.logger.error("removeChild error: PPTPlayer:622", this.taskId);
34167
34192
  }
34168
34193
  }
34169
- if (s2.json.transition && s2.json.transition.type && this.app.stage.children.length > 0 && this.view && this.transactionPlayer && p2) {
34170
- const e3 = yield this.getTransactionTexture(s2, this.view, a2, l2);
34194
+ if (s2.json.transition && s2.json.transition.type && this.app.stage.children.length > 0 && this.view && this.transactionPlayer && f2 && !p2()) {
34195
+ const e3 = this.getTransactionTexture(s2, this.view, a2, l2);
34171
34196
  this.transactionPlayer.setNextTexture(e3), this.tracker({ name: "slidePageChangePure", reason: "", result: "", payload: { duration: Date.now() - o2, from: r2, to: t2 } }), yield this.transactionPlayer.play();
34172
34197
  const i3 = this.transactionPlayer.renderer.domElement;
34173
34198
  if (this.view.parentElement && i3)
@@ -36501,7 +36526,7 @@ void main(void){
36501
36526
  }
36502
36527
  var _T = { 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", useraddLink: "useraddLink" }, yT = { taskId: "", url: "", currentSlideIndex: -1, mainSeqStep: -1, mainSeqState: null, mediaState: /* @__PURE__ */ Object.create(null), interactiveSeqState: /* @__PURE__ */ Object.create(null) }, xT = "";
36503
36528
  try {
36504
- xT = "1.4.45";
36529
+ xT = "1.4.47";
36505
36530
  } catch (t2) {
36506
36531
  xT = "-dev-";
36507
36532
  }
@@ -36557,32 +36582,32 @@ void main(void){
36557
36582
  i4 > 0 && Number.isInteger(i4) && (e2.__stageCountLimit = i4);
36558
36583
  }, n3.receiveSyncHandler = function(t3) {
36559
36584
  return pT(n3, void 0, void 0, function() {
36560
- var e3, i4, n4, r2, o2, s2 = this;
36561
- return fT(this, function(a2) {
36562
- switch (a2.label) {
36585
+ var e3, i4, n4, r2, o2, s2, a2, l2 = this;
36586
+ return fT(this, function(h2) {
36587
+ switch (h2.label) {
36563
36588
  case 0:
36564
36589
  return Vm()(t3.incrId) && (t3.incrId && t3.incrId - this._receiveIncrId != 1 && this.emit(_T.syncEventLag), this._receiveIncrId = t3.incrId || 0), this.logger.info("sync receive " + JSON.stringify(t3), this.taskId), "nextStep" !== t3.type ? [3, 1] : (this.mainSeqStep !== t3.next - 1 && this.mainSeqStep + 1 !== this.mainSeqLength && this.player ? (this.setMainSeqStep(t3.next, "start"), this.player.nextTick(function() {
36565
- s2.doNextStep(true, t3.clientId || "");
36590
+ l2.doNextStep(true, t3.clientId || "");
36566
36591
  })) : this.doNextStep(true, t3.clientId || ""), [3, 6]);
36567
36592
  case 1:
36568
- return "prevStep" !== t3.type ? [3, 2] : (0 === this.mainSeqStep && "idle" === this.mainSeqState || this.mainSeqStep === t3.next + 1 || this.mainSeqStep + 1 === this.mainSeqLength ? this.doPrevStep(true) : (this.setMainSeqStep(t3.next + 1, "start"), null === (e3 = this.player) || void 0 === e3 || e3.nextTick(function() {
36569
- s2.doPrevStep(true);
36593
+ return "prevStep" !== t3.type ? [3, 2] : (0 === this.mainSeqStep && "idle" === this.mainSeqState || this.mainSeqStep === t3.next + 1 || this.mainSeqStep + 1 === this.mainSeqLength ? this.doPrevStep(true) : (this.setMainSeqStep(t3.next + 1, "start"), null === (i4 = this.player) || void 0 === i4 || i4.nextTick(function() {
36594
+ l2.doPrevStep(true);
36570
36595
  })), [3, 6]);
36571
36596
  case 2:
36572
36597
  return "interactiveAnim" !== t3.type ? [3, 3] : (this.player ? this.player.applyInteractiveAction(t3.action) : this.__slideState.interactiveSeqState[t3.seqId] ? this.__slideState.interactiveSeqState[t3.seqId].step += 1 : this.__slideState.interactiveSeqState[t3.seqId] = { step: 0, state: "end" }, [3, 6]);
36573
36598
  case 3:
36574
36599
  return "renderSlide" !== t3.type ? [3, 5] : [4, this.doRenderSlide(t3.index, t3.isForward)];
36575
36600
  case 4:
36576
- return a2.sent(), [3, 6];
36601
+ return h2.sent(), [3, 6];
36577
36602
  case 5:
36578
- "mediaPlay" === t3.type ? (null === (i4 = this.player) || void 0 === i4 || i4.setMediaState(t3.id, true), this.__slideState.mediaState[t3.id] = t3.state) : "mediaPause" === t3.type ? (null === (n4 = this.player) || void 0 === n4 || n4.setMediaState(t3.id, false), this.__slideState.mediaState[t3.id] = t3.state) : "mediaSeek" === t3.type ? (null === (r2 = this.player) || void 0 === r2 || r2.setMediaCurrentTime(t3.id, t3.time), this.__slideState.mediaState[t3.id] = t3.state) : "mediaFullscreen" === t3.type && (t3.targetId && this.__slideState.mediaState[t3.targetId] ? this.__slideState.mediaState[t3.targetId].fullscreen = t3.state : this.__slideState.mediaState[t3.targetId] = { fullscreen: t3.state, type: "pause", time: 0 }, null === (o2 = this.player) || void 0 === o2 || o2.syncFullscreenVideoState({ targetId: t3.targetId, state: t3.state, slideIndex: t3.slideIndex })), a2.label = 6;
36603
+ "mediaPlay" === t3.type ? (e3 = void 0, t3.state.time && (e3 = (this.timestamp() - t3.state.time) / 1e3), null === (n4 = this.player) || void 0 === n4 || n4.setMediaState(t3.id, true, e3), this.__slideState.mediaState[t3.id] = t3.state) : "mediaPause" === t3.type ? (null === (r2 = this.player) || void 0 === r2 || r2.setMediaState(t3.id, false, null === (o2 = t3.state) || void 0 === o2 ? void 0 : o2.time), this.__slideState.mediaState[t3.id] = t3.state) : "mediaSeek" === t3.type ? (null === (s2 = this.player) || void 0 === s2 || s2.setMediaCurrentTime(t3.id, t3.time), this.__slideState.mediaState[t3.id] = t3.state) : "mediaFullscreen" === t3.type && (t3.targetId && this.__slideState.mediaState[t3.targetId] ? this.__slideState.mediaState[t3.targetId].fullscreen = t3.state : this.__slideState.mediaState[t3.targetId] = { fullscreen: t3.state, type: "pause", time: 0 }, null === (a2 = this.player) || void 0 === a2 || a2.syncFullscreenVideoState({ targetId: t3.targetId, state: t3.state, slideIndex: t3.slideIndex })), h2.label = 6;
36579
36604
  case 6:
36580
36605
  return [2];
36581
36606
  }
36582
36607
  });
36583
36608
  });
36584
36609
  }, n3.flushDebounce = function() {
36585
- n3.resizeView.flush(), n3.handleViewClick.flush();
36610
+ n3.resizeView.flush(), n3.config.disableClickDebounce || n3.handleViewClick.flush();
36586
36611
  }, n3.handlePrevSlide = function(t3) {
36587
36612
  return void 0 === t3 && (t3 = false), pT(n3, void 0, void 0, function() {
36588
36613
  var e3, i4;
@@ -36603,7 +36628,7 @@ void main(void){
36603
36628
  n3.renderSlide(t3, e3);
36604
36629
  } else
36605
36630
  -1 === t3 && n3.renderSlide(n3.slideCount, true);
36606
- }, e2.instances.push(n3), n3.config = n3.initSlideConfig(i3), n3.tracker = function(t3) {
36631
+ }, e2.instances.push(n3), n3.config = n3.initSlideConfig(i3), n3.config.disableClickDebounce && (n3.handleViewClick = n3._handleViewClick.bind(n3)), n3.tracker = function(t3) {
36607
36632
  i3.whiteTracker && i3.whiteTracker.commit({ name: t3.name, reason: t3.reason, result: t3.result, payload: cT(cT({}, t3.payload), { slideId: n3.randomId, taskId: n3.taskId }) }, { slideVersion: n3.version || "" });
36608
36633
  }, e2.trackLogger.setEnable(!!n3.config.enableTracking), n3.logger = { info: function(t3, i4) {
36609
36634
  var r2;
@@ -36625,7 +36650,7 @@ void main(void){
36625
36650
  }), n3.renderingTaskManager.eventHub.on("task-error", function(t3) {
36626
36651
  var e3 = t3.error, i4 = t3.task, r2 = Tm.transform(e3);
36627
36652
  r2.errorType === gm.RuntimeWarn ? n3.logger.warn(r2.message, n3.taskId) : n3.logger.error(r2.message, n3.taskId), n3.isLoading = false, n3.reportError(r2, i4.slideIndex);
36628
- }), window.addEventListener("__slide_ref__", n3.handleSlideRef), window.addEventListener("__slide_updateStageCountLimit", n3.updateStageCountLimit), n3.resizeView = $y()(n3.resizeView.bind(n3), 50), n3.player = n3.initPlayer(n3.config), n3.config.controller && n3.createController(), n3.player.view && n3.canvasContainer.appendChild(n3.player.view), n3.handleViewClick = $y()(n3.handleViewClick, 300), n3.player.errorChannel.on("error", function(t3, e3) {
36653
+ }), window.addEventListener("__slide_ref__", n3.handleSlideRef), window.addEventListener("__slide_updateStageCountLimit", n3.updateStageCountLimit), n3.resizeView = $y()(n3.resizeView.bind(n3), 50), n3.player = n3.initPlayer(n3.config), n3.config.controller && n3.createController(), n3.player.view && n3.canvasContainer.appendChild(n3.player.view), n3.config.disableClickDebounce || (n3.handleViewClick = $y()(n3.handleViewClick, 300)), n3.player.errorChannel.on("error", function(t3, e3) {
36629
36654
  var i4 = Tm.transform(t3);
36630
36655
  i4.errorType === gm.RuntimeWarn ? n3.logger.warn(i4.message, n3.taskId) : n3.logger.error(i4.message, n3.taskId), n3.isLoading = false, n3.reportError(t3, e3), n3.tracker({ name: "slideError", reason: i4.errorMsg, result: "", payload: { code: i4.errorType } });
36631
36656
  }), window.addEventListener("message", n3.recoverHandler), e2.volumeAdjuster.on("update", n3._updateVolumeByStaticAdjuster), n3.volumeAdjuster.volume = e2.volumeAdjuster.volume, n3;
@@ -36708,7 +36733,7 @@ void main(void){
36708
36733
  }, enumerable: false, configurable: true }), e2.prototype.reportError = function(t3, i3) {
36709
36734
  this.emit(_T.renderError, { error: t3, index: i3 }), window.postMessage({ type: "@slide/_error_", errorType: t3.errorType, errorMsg: t3.errorMsg, slideId: this.randomId, slideIndex: i3 || -1, customMessage: "@slide/_error_" }, "*"), e2.trackLogger.uploadLog(true);
36710
36735
  }, e2.prototype.initSlideConfig = function(t3) {
36711
- return t3.timestamp && (this.timestamp = t3.timestamp), t3.rtcAudio && (Yy.RtcAudioClazz = t3.rtcAudio), false !== t3.enableWebAudio && (t3.enableWebAudio = true), this.mode = t3.mode, this.anchor = t3.anchor, this.anchor.appendChild(this.frame), this.enableGlobalClick = !$a()(t3.enableGlobalClick) && t3.enableGlobalClick, this.resize = t3.resize || false, this.interactive = t3.interactive, this.frame.style.cssText = t3.fixedFrameSize ? "width:" + t3.fixedFrameSize.width + "px;height:" + t3.fixedFrameSize.height + "px;" : "width:100%;height:100%", this.frame.style.cssText += "display:flex;justify-content:center;align-items:center;visibility:hidden;position:relative;z-index:1;", t3.fixedFrameSize && (this.frameWidth = t3.fixedFrameSize.width, this.frameHeight = t3.fixedFrameSize.height), t3;
36736
+ return t3.timestamp && (this.timestamp = t3.timestamp), t3.rtcAudio && (Yy.RtcAudioClazz = t3.rtcAudio), false !== t3.enableWebAudio && (t3.enableWebAudio = true), this.mode = t3.mode, this.anchor = t3.anchor, this.anchor.appendChild(this.frame), this.enableGlobalClick = !$a()(t3.enableGlobalClick) && t3.enableGlobalClick, this.resize = t3.resize || false, this.interactive = t3.interactive, this.frame.style.cssText = t3.fixedFrameSize ? "width:" + t3.fixedFrameSize.width + "px;height:" + t3.fixedFrameSize.height + "px;" : "width:100%;height:100%", this.frame.style.cssText += "display:flex;justify-content:center;align-items:center;visibility:hidden;position:relative;z-index:1;", t3.fixedFrameSize && (this.frameWidth = t3.fixedFrameSize.width, this.frameHeight = t3.fixedFrameSize.height), t3.disableClickDebounce = t3.disableClickDebounce || false, t3;
36712
36737
  }, e2.prototype.initPlayer = function(t3) {
36713
36738
  var e3, i3, n3, r2 = this, o2 = new Yy({ mode: this.mode, useLocalCache: !!$a()(this.config.useLocalCache) || this.config.useLocalCache, logger: this.logger, resourceTimeout: $a()(this.config.resourceTimeout) ? 15e3 : this.config.resourceTimeout, loadDelegate: this.config.loaderDelegate, volumeAdjuster: this.volumeAdjuster, urlInterrupter: this.urlInterrupter, tracker: this.tracker, enableWebAudio: this.config.enableWebAudio, enableAutoForward: this.config.enableAutoForward, customLinks: this.config.customLinks }, t3.renderOptions);
36714
36739
  return o2.setInteractive(this.interactive), o2.updateConfig(t3.renderOptions || {}), o2.on(Xy.renderStart, function(t4) {
@@ -40226,7 +40251,7 @@ class SlidePreviewer {
40226
40251
  }
40227
40252
  }
40228
40253
  const usePlugin = /* @__PURE__ */ Slide.Slide.usePlugin.bind(Slide.Slide);
40229
- const version = "0.2.91";
40254
+ const version = "0.2.93";
40230
40255
  const SlideApp = {
40231
40256
  kind: "Slide",
40232
40257
  setup(context) {