@netless/app-slide 0.0.43 → 0.0.44

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
@@ -30293,33 +30293,33 @@ void main() {
30293
30293
  };
30294
30294
  class RE {
30295
30295
  constructor(t3, e3, n2, i2, r3) {
30296
- this.taskId = t3, this.slideIndex = e3, this.microTaskManager = n2, this.renderer = i2, this.cache = r3, this.idToHashMap = Object.create(null), this.textures = Object.create(null), this.graphics = [], this.hashToIdMap = Object.create(null);
30296
+ this.taskId = t3, this.slideIndex = e3, this.microTaskManager = n2, this.renderer = i2, this.cache = r3, this.imgElements = [], this.svgElements = [], this.idToHashMap = Object.create(null), this.textures = Object.create(null), this.graphics = [], this.hashToIdMap = Object.create(null);
30297
30297
  }
30298
30298
  setCacheLength(t3) {
30299
30299
  return this.cache ? this.cache.setItem(this.slideIndex + "-length", t3) : Promise.resolve(0);
30300
30300
  }
30301
- render(t3, e3) {
30302
- const { items: n2, width: i2, height: r3 } = t3, o3 = EE.getObject("foo"), s3 = new ey(o3, { width: i2, height: r3, resolution: 1 }), a2 = TE.getObject("foo");
30303
- a2.setAttribute("viewBox", `0 0 ${i2} ${r3}`), a2.setAttribute("width", "" + i2), a2.setAttribute("height", "" + r3);
30304
- const u2 = {}, h2 = {};
30305
- n2.forEach((t4) => {
30301
+ render(t3, e3, n2) {
30302
+ const { items: i2, width: r3, height: o3 } = t3, s3 = EE.getObject(n2), a2 = new ey(s3, { width: r3, height: o3, resolution: 1 }), u2 = TE.getObject(n2);
30303
+ this.imgElements.push(s3), this.svgElements.push(u2), u2.setAttribute("viewBox", `0 0 ${r3} ${o3}`), u2.setAttribute("width", "" + r3), u2.setAttribute("height", "" + o3);
30304
+ const h2 = {}, c2 = {};
30305
+ i2.forEach((t4) => {
30306
30306
  const { item: e4, x: n3, y: i3 } = t4, r4 = n3 + 2, o4 = i3 + 2;
30307
30307
  e4.pathsData.forEach((t5) => {
30308
30308
  let e5 = "";
30309
30309
  t5.cmds.forEach(([n4, i4]) => {
30310
30310
  e5 += n4 + " ", e5 += i4.map((e6) => (Object(l.isNumber)(e6) || (e6.x = Math.round(e6.x + t5.offset.x + r4), e6.y = Math.round(e6.y + t5.offset.y + o4)), e6)).reduce((t6, e6) => (Object(l.isNumber)(e6) ? t6 += e6 + " " : t6 += `${e6.x} ${e6.y} `, t6), ""), e5 += " ";
30311
- }), t5.pathElement.setAttribute("d", e5), a2.appendChild(t5.pathElement);
30311
+ }), t5.pathElement.setAttribute("d", e5), u2.appendChild(t5.pathElement);
30312
30312
  });
30313
- const c3 = e4.width - 4 - 2 * e4.padding, d3 = e4.height - 4 - 2 * e4.padding;
30314
- this.textures[e4.hash] = { texture: new _y(s3, new h_(r4 + 2, o4 + 2, c3, d3)), pivot: e4.pivot }, u2[e4.hash] = { x: r4 + 2, y: o4 + 2, w: c3, h: d3, pivot: e4.pivot }, h2[e4.hash] = this.hashToIdMap[e4.hash];
30313
+ const s4 = e4.width - 4 - 2 * e4.padding, d3 = e4.height - 4 - 2 * e4.padding;
30314
+ this.textures[e4.hash] = { texture: new _y(a2, new h_(r4 + 2, o4 + 2, s4, d3)), pivot: e4.pivot }, h2[e4.hash] = { x: r4 + 2, y: o4 + 2, w: s4, h: d3, pivot: e4.pivot }, c2[e4.hash] = this.hashToIdMap[e4.hash];
30315
30315
  });
30316
- const c2 = (d2 = '<?xml version="1.0" encoding="utf-8"?>' + a2.outerHTML, "data:image/svg+xml," + encodeURIComponent(d2).replace(/'/g, "%27").replace(/"/g, "%22"));
30317
- var d2;
30318
- if (o3.src = c2, this.cache) {
30316
+ const d2 = (p2 = '<?xml version="1.0" encoding="utf-8"?>' + u2.outerHTML, "data:image/svg+xml," + encodeURIComponent(p2).replace(/'/g, "%27").replace(/"/g, "%22"));
30317
+ var p2;
30318
+ if (s3.src = d2, this.cache) {
30319
30319
  const t4 = new CE();
30320
30320
  t4.addMTask(() => PE(this, void 0, void 0, function* () {
30321
30321
  var t5, n3, i3;
30322
- this.graphics.length > 0 && (yield (t5 = this.cache) === null || t5 === void 0 ? void 0 : t5.setItem(`${this.slideIndex}-texture-${e3}`, c2), yield (n3 = this.cache) === null || n3 === void 0 ? void 0 : n3.setItem(`${this.slideIndex}-json-${e3}`, u2), yield (i3 = this.cache) === null || i3 === void 0 ? void 0 : i3.setItem(`${this.slideIndex}-map-${e3}`, h2));
30322
+ this.graphics.length > 0 && (yield (t5 = this.cache) === null || t5 === void 0 ? void 0 : t5.setItem(`${this.slideIndex}-texture-${e3}`, d2), yield (n3 = this.cache) === null || n3 === void 0 ? void 0 : n3.setItem(`${this.slideIndex}-json-${e3}`, h2), yield (i3 = this.cache) === null || i3 === void 0 ? void 0 : i3.setItem(`${this.slideIndex}-map-${e3}`, c2));
30323
30323
  })), this.microTaskManager.addTask(t4);
30324
30324
  }
30325
30325
  }
@@ -30420,7 +30420,7 @@ void main() {
30420
30420
  Object.keys(this.textures).forEach((t3) => {
30421
30421
  var e3;
30422
30422
  (e3 = this.textures[t3]) === null || e3 === void 0 || e3.texture.destroy(true);
30423
- }), this.textures = Object.create(null), this.graphics = [];
30423
+ }), this.textures = Object.create(null), this.imgElements.forEach((t3) => EE.collectObject(t3)), this.svgElements.forEach((t3) => TE.collectObject(t3)), this.graphics = [];
30424
30424
  }
30425
30425
  }
30426
30426
  const IE = 134217729;
@@ -33306,7 +33306,7 @@ void main(void){
33306
33306
  }
33307
33307
  destroy() {
33308
33308
  var t3;
33309
- (t3 = this.tmRoot) === null || t3 === void 0 || t3.commonTimeNode.destroy();
33309
+ this.globalEventHub.removeAllListeners(), (t3 = this.tmRoot) === null || t3 === void 0 || t3.commonTimeNode.destroy();
33310
33310
  }
33311
33311
  hasMainSeq() {
33312
33312
  return !!this.mainSeq && this.mainSeq.commonTimeNode.children.length > 0;
@@ -33416,8 +33416,8 @@ void main(void){
33416
33416
  return !!this.timing;
33417
33417
  }
33418
33418
  clearOnSlideChange() {
33419
- var t3, e3, n2;
33420
- this.ctx.eventHub.removeAllListeners(), this.globalEventHub.removeAllListeners(), (t3 = this.timing) === null || t3 === void 0 || t3.setMainSeqStep(0, "start"), (e3 = this.timing) === null || e3 === void 0 || e3.resetAllInteractiveSeq(), (n2 = this.timing) === null || n2 === void 0 || n2.destroy(), this.timing = void 0, super.clearOnSlideChange();
33419
+ var t3, e3;
33420
+ this.ctx.eventHub.removeAllListeners(), this.globalEventHub.removeAllListeners(), (t3 = this.timing) === null || t3 === void 0 || t3.resetAllInteractiveSeq(), (e3 = this.timing) === null || e3 === void 0 || e3.destroy(), this.timing = void 0, super.clearOnSlideChange();
33421
33421
  }
33422
33422
  destroy() {
33423
33423
  var t3, e3;
@@ -33713,7 +33713,7 @@ void main(void){
33713
33713
  }
33714
33714
  const i2 = n2.graphicsTexture.pack();
33715
33715
  yield n2.graphicsTexture.setCacheLength(i2.length);
33716
- const r3 = i2.map((t4, e4) => () => (n2.graphicsTexture.render(t4, e4), Promise.resolve()));
33716
+ const r3 = i2.map((t4, e4) => () => (n2.graphicsTexture.render(t4, e4, this.objPoolGroup), Promise.resolve()));
33717
33717
  e3.addSubMTask(r3);
33718
33718
  }));
33719
33719
  }
@@ -33881,7 +33881,7 @@ void main(void){
33881
33881
  const r3 = yield this.stagePool.getStage(t3);
33882
33882
  this.translateEvent(r3.ctx.eventHub, [hC.mainSeqStepChange, hC.mainSeqStateChange, hC.hyperlinkTrigger, hC.interactiveSeqAction, hC.mainSeqStepStart, hC.mainSeqStepEnd, hC.animateStart, hC.animateEnd, hC.mediaPlay, hC.mediaPause, hC.mediaSeek, hC.requestGotoSlide, hC.requestNextSlide, hC.requestPrevSlide, hC.interactiveSeqStateChange]), this.currentIndex = Number(t3);
33883
33883
  const { width: o3, height: s3, slideCount: a2 } = r3.json;
33884
- this.slideCount = a2, this.designWidth = o3, this.designHeight = s3, (n2 = this.currentStage) === null || n2 === void 0 || n2.clearOnSlideChange();
33884
+ this.slideCount = a2, this.designWidth = o3, this.designHeight = s3, r3.json.transition && r3.json.transition.type && !this.prevSlideBase64 && this.currentStage && (this.prevSlideBase64 = this.getBase64(this.currentStage)), (n2 = this.currentStage) === null || n2 === void 0 || n2.clearOnSlideChange();
33885
33885
  const l2 = this.currentStage;
33886
33886
  this.currentStage = r3, r3.initOnReuse(), r3.createTiming(), r3.container.visible = true, r3.collectMainSeqStartValue(), this.isForward ? r3.setMainSeqStep(0, "start") : r3.setMainSeqStep(-1, "end");
33887
33887
  let u2 = null;
@@ -35540,7 +35540,7 @@ void main(void){
35540
35540
  }
35541
35541
  var xR = { syncDispatch: "syncDispatch", syncReceive: "syncReceive", renderStart: "renderStart", renderEnd: "renderEnd", renderError: "renderError", slideChange: "slideChange", mainSeqStepStart: "mainSeqStepStart", mainSeqStepEnd: "mainSeqStepEnd", animateStart: "animateStart", animateEnd: "animateEnd", stateChange: "stateChange" }, bR = { taskId: "", url: "", currentSlideIndex: -1, mainSeqStep: -1, mainSeqState: null, mediaState: Object.create(null), interactiveSeqState: Object.create(null) }, wR = "";
35542
35542
  try {
35543
- wR = "0.1.46";
35543
+ wR = "0.1.47";
35544
35544
  } catch (t3) {
35545
35545
  wR = "dev";
35546
35546
  }
@@ -35786,7 +35786,7 @@ void main(void){
35786
35786
  return mR(this, function(i2) {
35787
35787
  switch (i2.label) {
35788
35788
  case 0:
35789
- return this.iosResetCache.indexOf(t4) < 0 && this.iosResetCache.push(t4), this.isLoading = true, [4, (e4 = this.player) === null || e4 === void 0 ? void 0 : e4.renderSlide(t4)];
35789
+ return this.player && t4 === this.player.currentIndex ? [2] : (this.iosResetCache.indexOf(t4) < 0 && this.iosResetCache.push(t4), this.isLoading = true, [4, (e4 = this.player) === null || e4 === void 0 ? void 0 : e4.renderSlide(t4)]);
35790
35790
  case 1:
35791
35791
  return i2.sent(), this.__slideState.currentSlideIndex = t4, this.isLoading = false, this.resizeView(), this.emitStateChange(), setTimeout(function() {
35792
35792
  var t5, e5;
@@ -35812,7 +35812,7 @@ void main(void){
35812
35812
  return Promise.resolve();
35813
35813
  if (this.iosNewPlayer) {
35814
35814
  var r3 = this.player.getSnapshot();
35815
- this.cacheImage.src = r3, this.frame.appendChild(this.cacheImage), this.player.destroy(), this.player = this.iosNewPlayer, this.iosNewPlayer = void 0, this.needClearCacheImage = true, ((n2 = this.player) === null || n2 === void 0 ? void 0 : n2.view) && (this.player.view.style.visibility = "hidden", this.frame.appendChild(this.player.view));
35815
+ this.cacheImage.src = r3, this.frame.appendChild(this.cacheImage), this.player.destroy(), this.player = this.iosNewPlayer, this.iosNewPlayer = void 0, this.needClearCacheImage = true, ((n2 = this == null ? void 0 : this.player) === null || n2 === void 0 ? void 0 : n2.view) && (this.player.view.style.visibility = "hidden", this.frame.appendChild(this.player.view));
35816
35816
  }
35817
35817
  var o3 = Math.random().toString(32).substr(2);
35818
35818
  return this.player.isForward = e4, this.renderingTaskManager.addTask(function() {
@@ -35892,7 +35892,7 @@ void main(void){
35892
35892
  return [2, yR(function() {
35893
35893
  return !o3.isReleasing;
35894
35894
  }, 6e4)];
35895
- for (n2 in this.isReleasing = true, this.initPlayer(this.config), this.player.view && (this.player.view.style.visibility = "hidden"), e4 = this.__slideState, this.__slideState = Object(l.cloneDeep)(bR), e4.mediaState)
35895
+ for (n2 in this.isReleasing = true, this.player = this.initPlayer(this.config), this.player.view && (this.frame.appendChild(this.player.view), this.player.view.style.visibility = "hidden"), e4 = this.__slideState, this.__slideState = Object(l.cloneDeep)(bR), e4.mediaState)
35896
35896
  (i2 = e4.mediaState[n2]).type === "play" && (r3 = Math.max((t4 = i2.frozenTime) !== null && t4 !== void 0 ? t4 : 0, i2.time), i2.time = this.timestamp() - (r3 - i2.time), i2.frozenTime = void 0);
35897
35897
  return [4, this.setSlideState(e4)];
35898
35898
  case 1:
@@ -37926,7 +37926,7 @@ class SlidePreviewer {
37926
37926
  return `${this.namespace}-${className}`;
37927
37927
  }
37928
37928
  }
37929
- const version = "0.0.43";
37929
+ const version = "0.0.44";
37930
37930
  const SlideApp = {
37931
37931
  kind: "Slide",
37932
37932
  setup(context) {