@netless/app-slide 0.3.0-canary.12 → 0.3.0-canary.13

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.mjs CHANGED
@@ -348,39 +348,39 @@ xe.wrap = function(e) {
348
348
  var Z = It, X = De.exports, Re = Object.hasOwnProperty, Ve = /* @__PURE__ */ Object.create(null);
349
349
  for (var le in Z)
350
350
  Re.call(Z, le) && (Ve[Z[le]] = le);
351
- var _ = Fe.exports = {
351
+ var y = Fe.exports = {
352
352
  to: {},
353
353
  get: {}
354
354
  };
355
- _.get = function(e) {
355
+ y.get = function(e) {
356
356
  var t = e.substring(0, 3).toLowerCase(), s, r;
357
357
  switch (t) {
358
358
  case "hsl":
359
- s = _.get.hsl(e), r = "hsl";
359
+ s = y.get.hsl(e), r = "hsl";
360
360
  break;
361
361
  case "hwb":
362
- s = _.get.hwb(e), r = "hwb";
362
+ s = y.get.hwb(e), r = "hwb";
363
363
  break;
364
364
  default:
365
- s = _.get.rgb(e), r = "rgb";
365
+ s = y.get.rgb(e), r = "rgb";
366
366
  break;
367
367
  }
368
368
  return s ? { model: r, value: s } : null;
369
369
  };
370
- _.get.rgb = function(e) {
370
+ y.get.rgb = function(e) {
371
371
  if (!e)
372
372
  return null;
373
- var t = /^#([a-f0-9]{3,4})$/i, s = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i, r = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/, o = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/, i = /^(\w+)$/, a = [0, 0, 0, 1], n, l, c;
373
+ var t = /^#([a-f0-9]{3,4})$/i, s = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i, r = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/, o = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/, i = /^(\w+)$/, a = [0, 0, 0, 1], n, l, p;
374
374
  if (n = e.match(s)) {
375
- for (c = n[2], n = n[1], l = 0; l < 3; l++) {
376
- var h = l * 2;
377
- a[l] = parseInt(n.slice(h, h + 2), 16);
375
+ for (p = n[2], n = n[1], l = 0; l < 3; l++) {
376
+ var c = l * 2;
377
+ a[l] = parseInt(n.slice(c, c + 2), 16);
378
378
  }
379
- c && (a[3] = parseInt(c, 16) / 255);
379
+ p && (a[3] = parseInt(p, 16) / 255);
380
380
  } else if (n = e.match(t)) {
381
- for (n = n[1], c = n[3], l = 0; l < 3; l++)
381
+ for (n = n[1], p = n[3], l = 0; l < 3; l++)
382
382
  a[l] = parseInt(n[l] + n[l], 16);
383
- c && (a[3] = parseInt(c + c, 16) / 255);
383
+ p && (a[3] = parseInt(p + p, 16) / 255);
384
384
  } else if (n = e.match(r)) {
385
385
  for (l = 0; l < 3; l++)
386
386
  a[l] = parseInt(n[l + 1], 0);
@@ -395,7 +395,7 @@ _.get.rgb = function(e) {
395
395
  a[l] = N(a[l], 0, 255);
396
396
  return a[3] = N(a[3], 0, 1), a;
397
397
  };
398
- _.get.hsl = function(e) {
398
+ y.get.hsl = function(e) {
399
399
  if (!e)
400
400
  return null;
401
401
  var t = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/, s = e.match(t);
@@ -405,7 +405,7 @@ _.get.hsl = function(e) {
405
405
  }
406
406
  return null;
407
407
  };
408
- _.get.hwb = function(e) {
408
+ y.get.hwb = function(e) {
409
409
  if (!e)
410
410
  return null;
411
411
  var t = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/, s = e.match(t);
@@ -415,27 +415,27 @@ _.get.hwb = function(e) {
415
415
  }
416
416
  return null;
417
417
  };
418
- _.to.hex = function() {
418
+ y.to.hex = function() {
419
419
  var e = X(arguments);
420
420
  return "#" + se(e[0]) + se(e[1]) + se(e[2]) + (e[3] < 1 ? se(Math.round(e[3] * 255)) : "");
421
421
  };
422
- _.to.rgb = function() {
422
+ y.to.rgb = function() {
423
423
  var e = X(arguments);
424
424
  return e.length < 4 || e[3] === 1 ? "rgb(" + Math.round(e[0]) + ", " + Math.round(e[1]) + ", " + Math.round(e[2]) + ")" : "rgba(" + Math.round(e[0]) + ", " + Math.round(e[1]) + ", " + Math.round(e[2]) + ", " + e[3] + ")";
425
425
  };
426
- _.to.rgb.percent = function() {
426
+ y.to.rgb.percent = function() {
427
427
  var e = X(arguments), t = Math.round(e[0] / 255 * 100), s = Math.round(e[1] / 255 * 100), r = Math.round(e[2] / 255 * 100);
428
428
  return e.length < 4 || e[3] === 1 ? "rgb(" + t + "%, " + s + "%, " + r + "%)" : "rgba(" + t + "%, " + s + "%, " + r + "%, " + e[3] + ")";
429
429
  };
430
- _.to.hsl = function() {
430
+ y.to.hsl = function() {
431
431
  var e = X(arguments);
432
432
  return e.length < 4 || e[3] === 1 ? "hsl(" + e[0] + ", " + e[1] + "%, " + e[2] + "%)" : "hsla(" + e[0] + ", " + e[1] + "%, " + e[2] + "%, " + e[3] + ")";
433
433
  };
434
- _.to.hwb = function() {
434
+ y.to.hwb = function() {
435
435
  var e = X(arguments), t = "";
436
436
  return e.length >= 4 && e[3] !== 1 && (t = ", " + e[3]), "hwb(" + e[0] + ", " + e[1] + "%, " + e[2] + "%" + t + ")";
437
437
  };
438
- _.to.keyword = function(e) {
438
+ y.to.keyword = function(e) {
439
439
  return Ve[e.slice(0, 3)];
440
440
  };
441
441
  function N(e, t, s) {
@@ -452,7 +452,7 @@ function g(e) {
452
452
  }
453
453
  function Ee(e, t) {
454
454
  const s = g(e);
455
- return w(s, t), s;
455
+ return _(s, t), s;
456
456
  }
457
457
  function F(e, t) {
458
458
  return e.appendChild(t);
@@ -460,7 +460,7 @@ function F(e, t) {
460
460
  function b(e) {
461
461
  return `${H}-${e}`;
462
462
  }
463
- function w(e, t) {
463
+ function _(e, t) {
464
464
  e.className = b(t);
465
465
  }
466
466
  function zt(e) {
@@ -576,55 +576,55 @@ function qt() {
576
576
  const i = (d) => {
577
577
  o = d;
578
578
  };
579
- let a = !1, n = !1, l = 0, c = 0;
580
- const h = g("div");
581
- w(h, "footer");
582
- const p = g("button");
583
- w(p, "btn-sidebar"), p.classList.add(b("footer-btn")), p.appendChild(Ft(H)), p.onclick = function() {
579
+ let a = !1, n = !1, l = 0, p = 0;
580
+ const c = g("div");
581
+ _(c, "footer");
582
+ const h = g("button");
583
+ _(h, "btn-sidebar"), h.classList.add(b("footer-btn")), h.appendChild(Ft(H)), h.onclick = function() {
584
584
  a || s();
585
- }, p.style.display = "none", h.appendChild(p);
586
- const S = g("div");
587
- w(S, "page-jumps");
585
+ }, h.style.display = "none", c.appendChild(h);
586
+ const v = g("div");
587
+ _(v, "page-jumps");
588
588
  const E = g("button");
589
- w(E, "btn-page-back"), E.classList.add(b("footer-btn")), E.appendChild(Dt(H)), E.onclick = function() {
589
+ _(E, "btn-page-back"), E.classList.add(b("footer-btn")), E.appendChild(Dt(H)), E.onclick = function() {
590
590
  a || e(l - 1);
591
- }, S.appendChild(E);
592
- const v = g("button");
593
- w(v, "btn-page-play"), v.classList.add(b("footer-btn")), v.appendChild(Rt(H)), v.appendChild(Vt(H));
591
+ }, v.appendChild(E);
592
+ const m = g("button");
593
+ _(m, "btn-page-play"), m.classList.add(b("footer-btn")), m.appendChild(Rt(H)), m.appendChild(Vt(H));
594
594
  let V = 0;
595
- v.onclick = function() {
596
- a || (v.classList.add(b("footer-btn-playing")), o(), clearTimeout(V), V = setTimeout(() => {
597
- v.classList.remove(b("footer-btn-playing"));
595
+ m.onclick = function() {
596
+ a || (m.classList.add(b("footer-btn-playing")), o(), clearTimeout(V), V = setTimeout(() => {
597
+ m.classList.remove(b("footer-btn-playing"));
598
598
  }, 500));
599
- }, S.appendChild(v);
599
+ }, v.appendChild(m);
600
600
  const L = g("button");
601
- w(L, "btn-page-next"), L.classList.add(b("footer-btn")), L.appendChild(Ut(H)), L.onclick = function() {
601
+ _(L, "btn-page-next"), L.classList.add(b("footer-btn")), L.appendChild(Ut(H)), L.onclick = function() {
602
602
  a || e(l + 1);
603
- }, S.appendChild(L);
603
+ }, v.appendChild(L);
604
604
  const A = g("div");
605
- w(A, "page-number");
606
- const k = g("input");
607
- w(k, "page-number-input"), k.value = String(l + 1), k.onchange = function() {
608
- a || k.value && e(Number(k.value) - 1);
605
+ _(A, "page-number");
606
+ const S = g("input");
607
+ _(S, "page-number-input"), S.value = String(l + 1), S.onchange = function() {
608
+ a || S.value && e(Number(S.value) - 1);
609
609
  };
610
610
  const f = g("span");
611
- w(f, "total-page"), f.textContent = " / ", A.appendChild(k), A.appendChild(f), h.appendChild(S), h.appendChild(A);
612
- const y = b("readonly");
611
+ _(f, "total-page"), f.textContent = " / ", A.appendChild(S), A.appendChild(f), c.appendChild(v), c.appendChild(A);
612
+ const k = b("readonly");
613
613
  function I(d) {
614
- a !== d && (a = d, h.classList.toggle(y, a), k.disabled = a);
614
+ a !== d && (a = d, c.classList.toggle(k, a), S.disabled = a);
615
615
  }
616
616
  function z(d) {
617
- n !== d && (n = d, p.style.display = n ? "" : "none");
617
+ n !== d && (n = d, h.style.display = n ? "" : "none");
618
618
  }
619
619
  function U(d, q = !1) {
620
- (q || l !== d) && (l = d, k.value = String(l + 1));
620
+ (q || l !== d) && (l = d, S.value = String(l + 1));
621
621
  }
622
622
  function W(d) {
623
- c !== d && (c = d, f.textContent = ` / ${c}`);
623
+ p !== d && (p = d, f.textContent = ` / ${p}`);
624
624
  }
625
625
  return {
626
- $footer: h,
627
- $pageNumberInput: k,
626
+ $footer: c,
627
+ $pageNumberInput: S,
628
628
  set_readonly: I,
629
629
  set_sidebar: z,
630
630
  set_page_index: U,
@@ -683,14 +683,14 @@ const P = typeof window < "u", Be = P && !("onscroll" in window) || typeof navig
683
683
  else
684
684
  for (let s = 0, r; r = t[s]; s += 1)
685
685
  $e(e, r);
686
- }, $ = "src", ue = "srcset", pe = "sizes", Je = "poster", Y = "llOriginalAttrs", Ze = "data", he = "loading", Ke = "loaded", Qe = "applied", jt = "entered", fe = "error", Xe = "native", Ye = "data-", et = "ll-status", m = (e, t) => e.getAttribute(Ye + t), Gt = (e, t, s) => {
686
+ }, $ = "src", ue = "srcset", pe = "sizes", Je = "poster", Y = "llOriginalAttrs", Ze = "data", he = "loading", Ke = "loaded", Qe = "applied", jt = "entered", fe = "error", Xe = "native", Ye = "data-", et = "ll-status", w = (e, t) => e.getAttribute(Ye + t), Gt = (e, t, s) => {
687
687
  var r = Ye + t;
688
688
  if (s === null) {
689
689
  e.removeAttribute(r);
690
690
  return;
691
691
  }
692
692
  e.setAttribute(r, s);
693
- }, ee = (e) => m(e, et), R = (e, t) => Gt(e, et, t), oe = (e) => R(e, null), ge = (e) => ee(e) === null, Wt = (e) => ee(e) === he, Jt = (e) => ee(e) === fe, be = (e) => ee(e) === Xe, Zt = [he, Ke, Qe, fe], Kt = (e) => Zt.indexOf(ee(e)) >= 0, T = (e, t, s, r) => {
693
+ }, ee = (e) => w(e, et), R = (e, t) => Gt(e, et, t), oe = (e) => R(e, null), ge = (e) => ee(e) === null, Wt = (e) => ee(e) === he, Jt = (e) => ee(e) === fe, be = (e) => ee(e) === Xe, Zt = [he, Ke, Qe, fe], Kt = (e) => Zt.indexOf(ee(e)) >= 0, T = (e, t, s, r) => {
694
694
  if (!!e) {
695
695
  if (r !== void 0) {
696
696
  e(t, s, r);
@@ -779,27 +779,27 @@ const P = typeof window < "u", Be = P && !("onscroll" in window) || typeof navig
779
779
  }, M = (e, t, s) => {
780
780
  !s || e.setAttribute(t, s);
781
781
  }, Le = (e, t) => {
782
- M(e, pe, m(e, t.data_sizes)), M(e, ue, m(e, t.data_srcset)), M(e, $, m(e, t.data_src));
782
+ M(e, pe, w(e, t.data_sizes)), M(e, ue, w(e, t.data_srcset)), M(e, $, w(e, t.data_src));
783
783
  }, is = (e, t) => {
784
784
  me(e, (s) => {
785
785
  j(s, Q), Le(s, t);
786
786
  }), j(e, Q), Le(e, t);
787
787
  }, ls = (e, t) => {
788
- j(e, ae), M(e, $, m(e, t.data_src));
788
+ j(e, ae), M(e, $, w(e, t.data_src));
789
789
  }, cs = (e, t) => {
790
790
  ot(e, (s) => {
791
- j(s, ae), M(s, $, m(s, t.data_src));
792
- }), j(e, nt), M(e, Je, m(e, t.data_poster)), M(e, $, m(e, t.data_src)), e.load();
791
+ j(s, ae), M(s, $, w(s, t.data_src));
792
+ }), j(e, nt), M(e, Je, w(e, t.data_poster)), M(e, $, w(e, t.data_src)), e.load();
793
793
  }, ds = (e, t) => {
794
- j(e, at), M(e, Ze, m(e, t.data_src));
794
+ j(e, at), M(e, Ze, w(e, t.data_src));
795
795
  }, us = (e, t, s) => {
796
- const r = m(e, t.data_bg), o = m(e, t.data_bg_hidpi), i = Ge && o ? o : r;
796
+ const r = w(e, t.data_bg), o = w(e, t.data_bg_hidpi), i = Ge && o ? o : r;
797
797
  !i || (e.style.backgroundImage = `url("${i}")`, tt(e).setAttribute($, i), dt(e, t, s));
798
798
  }, ps = (e, t, s) => {
799
- const r = m(e, t.data_bg_multi), o = m(e, t.data_bg_multi_hidpi), i = Ge && o ? o : r;
799
+ const r = w(e, t.data_bg_multi), o = w(e, t.data_bg_multi_hidpi), i = Ge && o ? o : r;
800
800
  !i || (e.style.backgroundImage = i, ct(e, t, s));
801
801
  }, hs = (e, t, s) => {
802
- const r = m(e, t.data_bg_set);
802
+ const r = w(e, t.data_bg_set);
803
803
  if (!r)
804
804
  return;
805
805
  const o = r.split("|");
@@ -981,65 +981,65 @@ function Ks() {
981
981
  e = f;
982
982
  };
983
983
  let s = !1, r = !1, o = !1, i = [], a = 0;
984
- const n = b("readonly"), l = b("preview-active"), c = g("div");
985
- w(c, "content");
984
+ const n = b("readonly"), l = b("preview-active"), p = g("div");
985
+ _(p, "content");
986
+ const c = g("div");
987
+ _(c, "preview-mask"), c.onclick = function(k) {
988
+ r || k.target === c && m(!1);
989
+ }, F(p, c);
986
990
  const h = g("div");
987
- w(h, "preview-mask"), h.onclick = function(y) {
988
- r || y.target === h && v(!1);
989
- }, F(c, h);
990
- const p = g("div");
991
- w(p, "preview"), p.classList.add(b("tele-fancy-scrollbar")), p.onclick = function(y) {
991
+ _(h, "preview"), h.classList.add(b("tele-fancy-scrollbar")), h.onclick = function(k) {
992
992
  var z;
993
993
  if (r)
994
994
  return;
995
- const I = (z = y.target.dataset) == null ? void 0 : z.pageIndex;
996
- I && (y.preventDefault(), y.stopPropagation(), y.stopImmediatePropagation(), e(Number(I)), v(!1));
997
- }, F(c, p);
998
- const S = new te({
999
- container: p,
995
+ const I = (z = k.target.dataset) == null ? void 0 : z.pageIndex;
996
+ I && (k.preventDefault(), k.stopPropagation(), k.stopImmediatePropagation(), e(Number(I)), m(!1));
997
+ }, F(p, h);
998
+ const v = new te({
999
+ container: h,
1000
1000
  elements_selector: `.${b("preview-page>img")}`
1001
1001
  });
1002
1002
  function E(f) {
1003
- r !== f && (r = f, c.classList.toggle(n, r));
1003
+ r !== f && (r = f, p.classList.toggle(n, r));
1004
1004
  }
1005
- function v(f) {
1006
- o !== f && (o = f, c.classList.toggle(l, o));
1005
+ function m(f) {
1006
+ o !== f && (o = f, p.classList.toggle(l, o));
1007
1007
  }
1008
1008
  function V(f) {
1009
1009
  if (i !== f) {
1010
1010
  i = f;
1011
- const y = b("preview-page"), I = b("preview-page-name");
1011
+ const k = b("preview-page"), I = b("preview-page-name");
1012
1012
  i.forEach((z, U) => {
1013
1013
  const W = String(U), d = g("a");
1014
- d.className = y + " " + b(`preview-page-${U}`), d.href = "#", d.dataset.pageIndex = W;
1014
+ d.className = k + " " + b(`preview-page-${U}`), d.href = "#", d.dataset.pageIndex = W;
1015
1015
  const q = g("span");
1016
1016
  q.className = I, q.textContent = String(U + 1), q.dataset.pageIndex = W;
1017
1017
  const B = g("img");
1018
- B.width = z.width, B.height = z.height, B.src = z.thumbnail, B.alt = `page-${U}`, B.dataset.pageIndex = W, F(d, B), F(d, q), F(p, d);
1019
- }), s || S.update();
1018
+ B.width = z.width, B.height = z.height, B.src = z.thumbnail, B.alt = `page-${U}`, B.dataset.pageIndex = W, F(d, B), F(d, q), F(h, d);
1019
+ }), s || v.update();
1020
1020
  }
1021
1021
  }
1022
- function L(f, y = !1) {
1023
- if (y || a !== f) {
1022
+ function L(f, k = !1) {
1023
+ if (k || a !== f) {
1024
1024
  a = f;
1025
- const I = p.querySelector(
1025
+ const I = h.querySelector(
1026
1026
  `.${b(`preview-page-${a}`)}`
1027
1027
  );
1028
- I && p.scrollTo({ top: I.offsetTop - 16 });
1028
+ I && h.scrollTo({ top: I.offsetTop - 16 });
1029
1029
  }
1030
1030
  }
1031
1031
  function A() {
1032
- s = !0, S.destroy();
1032
+ s = !0, v.destroy();
1033
1033
  }
1034
- function k() {
1034
+ function S() {
1035
1035
  return o;
1036
1036
  }
1037
1037
  return {
1038
- $content: c,
1039
- $preview: p,
1038
+ $content: p,
1039
+ $preview: h,
1040
1040
  set_readonly: E,
1041
- set_active: v,
1042
- get_active: k,
1041
+ set_active: m,
1042
+ get_active: S,
1043
1043
  set_pages: V,
1044
1044
  on_new_page_index: t,
1045
1045
  set_page_index: L,
@@ -1084,10 +1084,10 @@ const ke = class {
1084
1084
  this._infoPromise = s, ke.fetchSlideInfo(t).then(({ preview: n, slide: l }) => {
1085
1085
  if (!this._destroyed) {
1086
1086
  if (this._slideCount = l.slideCount, n) {
1087
- const { taskId: c, url: h } = t, { slideCount: p } = l, { width: S, height: E } = n, v = qe(c, h), V = Array.from({ length: p }, (L, A) => ({
1088
- width: S,
1087
+ const { taskId: p, url: c } = t, { slideCount: h } = l, { width: v, height: E } = n, m = qe(p, c), V = Array.from({ length: h }, (L, A) => ({
1088
+ width: v,
1089
1089
  height: E,
1090
- thumbnail: `${v}/preview/${A + 1}.png`
1090
+ thumbnail: `${m}/preview/${A + 1}.png`
1091
1091
  }));
1092
1092
  this.sidebar.set_pages(V), this.footer.set_sidebar(!0);
1093
1093
  }
@@ -1156,55 +1156,55 @@ const C = class {
1156
1156
  };
1157
1157
  let J = C;
1158
1158
  u(J, "active", /* @__PURE__ */ new Set()), u(J, "roomLogger", null);
1159
- function Xs({ context: e, viewer: t, sideEffect: s, logger: r }) {
1160
- const o = r.info.bind(r);
1161
- let i = null;
1162
- t.prepare(({ width: c, height: h, slideCount: p }) => {
1163
- e.destroyed || (c && e.box.setStageRatio(h / c), i = e.createWhiteBoardView({ size: p }), i.setBaseRect({ width: c, height: h }), l());
1159
+ function Xs({ context: e, storage: t, viewer: s, sideEffect: r, logger: o }) {
1160
+ const i = o.info.bind(o);
1161
+ let a = null;
1162
+ s.prepare(({ width: c, height: h, slideCount: v }) => {
1163
+ e.destroyed || (c && e.box.setStageRatio(h / c), a = e.createWhiteBoardView({ size: v }), a.setBaseRect({ width: c, height: h }), p());
1164
1164
  });
1165
- const { slide: a } = t;
1166
- function n(c = e.storage.state.state) {
1165
+ const { slide: n } = s;
1166
+ function l(c = t.state.state) {
1167
1167
  return JSON.stringify(c);
1168
1168
  }
1169
- function l() {
1170
- if (e.storage.state.state)
1171
- o("[Slide] restore " + n()), a.setSlideState(e.storage.state.state);
1169
+ function p() {
1170
+ if (t.state.state)
1171
+ i("[Slide] restore " + l()), n.setSlideState(t.state.state);
1172
1172
  else if (e.isAddApp)
1173
- o("[Slide] kick start"), a.renderSlide(1);
1173
+ i("[Slide] kick start"), n.renderSlide(1);
1174
1174
  else {
1175
- o("[Slide] wait for restore");
1176
- const c = s.add(() => {
1177
- const p = setInterval(() => {
1178
- e.storage.state.state || (o("[Slide] timeout"), a.renderSlide(1));
1175
+ i("[Slide] wait for restore");
1176
+ const c = r.add(() => {
1177
+ const v = setInterval(() => {
1178
+ t.state.state || (i("[Slide] timeout"), n.renderSlide(1));
1179
1179
  }, 15e3);
1180
- return () => clearInterval(p);
1181
- }), h = s.push(
1182
- e.storage.on("stateChanged", () => {
1183
- e.storage.state.state && (o("[Slide] restore " + n()), a.setSlideState(e.storage.state.state), s.flush(h), s.flush(c));
1180
+ return () => clearInterval(v);
1181
+ }), h = r.push(
1182
+ t.on("stateChanged", () => {
1183
+ t.state.state && (i("[Slide] restore " + l()), n.setSlideState(t.state.state), r.flush(h), r.flush(c));
1184
1184
  })
1185
1185
  );
1186
1186
  }
1187
1187
  }
1188
- a.on("stateChange", () => {
1189
- e.isWritable && e.storage.setState({ state: a.slideState });
1190
- }), a.on("syncDispatch", (c) => {
1191
- e.isWritable && (o("[Slide] dispatch " + n(Ie(c, "uuid"))), e.dispatchMagixEvent("syncDispatch", c));
1192
- }), s.push(
1188
+ n.on("stateChange", () => {
1189
+ e.isWritable && t.setState({ state: n.slideState });
1190
+ }), n.on("syncDispatch", (c) => {
1191
+ e.isWritable && (i("[Slide] dispatch " + l(Ie(c, "uuid"))), e.dispatchMagixEvent("syncDispatch", c));
1192
+ }), r.push(
1193
1193
  e.addMagixEventListener(
1194
1194
  "syncDispatch",
1195
1195
  ({ payload: c }) => {
1196
- o("[Slide] receive " + n(Ie(c, "uuid"))), a.emit("syncReceive", c);
1196
+ i("[Slide] receive " + l(Ie(c, "uuid"))), n.emit("syncReceive", c);
1197
1197
  },
1198
1198
  { fireSelfEventAfterCommit: !0 }
1199
1199
  )
1200
- ), a.on("slideChange", (c) => {
1201
- e.isWritable && i && (o("[Slide] page to " + c), i.jumpPage(c - 1));
1202
- }), t.setReadonly(!e.isWritable), s.push(
1200
+ ), n.on("slideChange", (c) => {
1201
+ e.isWritable && a && (i("[Slide] page to " + c), a.jumpPage(c - 1));
1202
+ }), s.setReadonly(!e.isWritable), r.push(
1203
1203
  e.emitter.on("writableChange", (c) => {
1204
- t.setReadonly(!c);
1204
+ s.setReadonly(!c);
1205
1205
  })
1206
- ), s.addEventListener(window, "keydown", (c) => {
1207
- e.box.focus && ((c.key === "ArrowUp" || c.key === "ArrowLeft") && t.slide.prevStep(), (c.key === "ArrowRight" || c.key === "ArrowDown") && t.slide.nextStep());
1206
+ ), r.addEventListener(window, "keydown", (c) => {
1207
+ e.box.focus && ((c.key === "ArrowUp" || c.key === "ArrowLeft") && s.slide.prevStep(), (c.key === "ArrowRight" || c.key === "ArrowDown") && s.slide.nextStep());
1208
1208
  });
1209
1209
  }
1210
1210
  function sr(e) {
@@ -1213,51 +1213,51 @@ function sr(e) {
1213
1213
  const o = new O(s);
1214
1214
  return r.appendChild(document.createElement("style")).textContent = O.styles, r.appendChild(o.$content), r.appendChild(o.$footer), t.appendChild(r), o.prepare(() => o.slide.renderSlide(1)), o;
1215
1215
  }
1216
- const rr = /* @__PURE__ */ ce.usePlugin.bind(ce), or = "0.3.0-canary.12", nr = {
1216
+ const rr = /* @__PURE__ */ ce.usePlugin.bind(ce), or = "0.3.0-canary.13", nr = {
1217
1217
  kind: "Slide",
1218
1218
  setup(e) {
1219
- var a, n;
1220
- console.log("[Slide] setup @ 0.3.0-canary.12 (" + e.appId + ")");
1219
+ var n, l;
1220
+ console.log("[Slide] setup @ 0.3.0-canary.13 (" + e.appId + ")");
1221
1221
  const t = new J(e);
1222
- if (t.info("[Slide] setup @ 0.3.0-canary.12"), !e.storage.state.taskId)
1222
+ if (t.info("[Slide] setup @ 0.3.0-canary.13"), !e.attributes.taskId)
1223
1223
  throw new Error("[Slide] no taskId");
1224
- const s = e.getAppOptions() || {}, r = s.renderOptions || {}, o = new Me(), i = new O({
1224
+ const s = e.createStorage("slide", e.attributes), r = e.getAppOptions() || {}, o = r.renderOptions || {}, i = new Me(), a = new O({
1225
1225
  interactive: !0,
1226
1226
  mode: "interactive",
1227
1227
  enableGlobalClick: !0,
1228
1228
  timestamp: Ot(e),
1229
- logger: s.logger || t,
1229
+ logger: r.logger || t,
1230
1230
  renderOptions: {
1231
- minFPS: r.minFPS || 25,
1232
- maxFPS: r.maxFPS || 30,
1233
- autoFPS: (a = r.autoFPS) != null ? a : !0,
1234
- autoResolution: (n = r.autoResolution) != null ? n : !0,
1235
- resolution: r.resolution,
1236
- maxResolutionLevel: r.maxResolutionLevel,
1237
- transactionBgColor: r.transactionBgColor || Ue(e.box.$content)
1231
+ minFPS: o.minFPS || 25,
1232
+ maxFPS: o.maxFPS || 30,
1233
+ autoFPS: (n = o.autoFPS) != null ? n : !0,
1234
+ autoResolution: (l = o.autoResolution) != null ? l : !0,
1235
+ resolution: o.resolution,
1236
+ maxResolutionLevel: o.maxResolutionLevel,
1237
+ transactionBgColor: o.transactionBgColor || Ue(e.box.$content)
1238
1238
  },
1239
- rtcAudio: s.rtcAudio,
1240
- useLocalCache: s.useLocalCache,
1241
- resourceTimeout: s.resourceTimeout,
1242
- loaderDelegate: s.loaderDelegate,
1243
- navigatorDelegate: s.navigatorDelegate,
1244
- fixedFrameSize: s.fixedFrameSize,
1245
- taskId: e.storage.state.taskId,
1246
- url: e.storage.state.url
1239
+ rtcAudio: r.rtcAudio,
1240
+ useLocalCache: r.useLocalCache,
1241
+ resourceTimeout: r.resourceTimeout,
1242
+ loaderDelegate: r.loaderDelegate,
1243
+ navigatorDelegate: r.navigatorDelegate,
1244
+ fixedFrameSize: r.fixedFrameSize,
1245
+ taskId: s.state.taskId,
1246
+ url: s.state.url
1247
1247
  });
1248
- return Object.assign(i, { context: e, logger: t }), o.push(Te.set(e.appId, i)), o.push(i.events.on("freeze", () => t.info("[Slide] freeze"))), o.push(i.events.on("unfreeze", () => t.info("[Slide] unfreeze"))), o.push(
1249
- i.events.on(
1248
+ return Object.assign(a, { context: e, logger: t }), i.push(Te.set(e.appId, a)), i.push(a.events.on("freeze", () => t.info("[Slide] freeze"))), i.push(a.events.on("unfreeze", () => t.info("[Slide] unfreeze"))), i.push(
1249
+ a.events.on(
1250
1250
  "prepareError",
1251
- (l) => t.info("[Slide] fetch slide info failed: " + l.message)
1251
+ (p) => t.info("[Slide] fetch slide info failed: " + p.message)
1252
1252
  )
1253
- ), o.push(
1254
- i.events.on(
1253
+ ), i.push(
1254
+ a.events.on(
1255
1255
  "renderError",
1256
- ({ error: l, index: c }) => t.info(`[Slide] render failed [${c}]: ${l.message}`)
1256
+ ({ error: p, index: c }) => t.info(`[Slide] render failed [${c}]: ${p.message}`)
1257
1257
  )
1258
- ), e.box.mountStyles(O.styles), e.box.mountStage(i.$slide), e.box.mountFooter(i.$footer), e.box.mountContent(i.$content), o.push(() => i.destroy()), Xs({ context: e, viewer: i, sideEffect: o, logger: t }), e.emitter.on("destroy", () => {
1259
- t.info("[Slide] destroy"), t.destroy(), o.flushAll();
1260
- }), i;
1258
+ ), e.box.mountStyles(O.styles), e.box.mountStage(a.$slide), e.box.mountFooter(a.$footer), e.box.mountContent(a.$content), i.push(() => a.destroy()), Xs({ context: e, storage: s, viewer: a, sideEffect: i, logger: t }), e.emitter.on("destroy", () => {
1259
+ t.info("[Slide] destroy"), t.destroy(), i.flushAll();
1260
+ }), a;
1261
1261
  }
1262
1262
  };
1263
1263
  export {