@netless/app-slide 0.3.0-canary.17 → 0.3.0-canary.19
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.js +2 -2
- package/dist/main.js.map +1 -1
- package/dist/main.mjs +153 -146
- package/dist/main.mjs.map +1 -1
- package/package.json +2 -2
- package/src/connect.ts +7 -1
- package/dist/main.iife.js +0 -3
- package/dist/main.iife.js.map +0 -1
package/dist/main.mjs
CHANGED
|
@@ -358,9 +358,9 @@ Ie.wrap = function(e) {
|
|
|
358
358
|
return e(Ie(arguments));
|
|
359
359
|
};
|
|
360
360
|
};
|
|
361
|
-
var
|
|
362
|
-
for (var de in
|
|
363
|
-
Ve.call(
|
|
361
|
+
var J = It, Z = he, Ve = Object.hasOwnProperty, Ue = /* @__PURE__ */ Object.create(null);
|
|
362
|
+
for (var de in J)
|
|
363
|
+
Ve.call(J, de) && (Ue[J[de]] = de);
|
|
364
364
|
var A = At.exports = {
|
|
365
365
|
to: {},
|
|
366
366
|
get: {}
|
|
@@ -386,8 +386,8 @@ A.get.rgb = function(e) {
|
|
|
386
386
|
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*)?\)$/, n = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/, i = /^(\w+)$/, o = [0, 0, 0, 1], a, l, h;
|
|
387
387
|
if (a = e.match(s)) {
|
|
388
388
|
for (h = a[2], a = a[1], l = 0; l < 3; l++) {
|
|
389
|
-
var
|
|
390
|
-
o[l] = parseInt(a.slice(
|
|
389
|
+
var b = l * 2;
|
|
390
|
+
o[l] = parseInt(a.slice(b, b + 2), 16);
|
|
391
391
|
}
|
|
392
392
|
h && (o[3] = parseInt(h, 16) / 255);
|
|
393
393
|
} else if (a = e.match(t)) {
|
|
@@ -403,17 +403,17 @@ A.get.rgb = function(e) {
|
|
|
403
403
|
o[l] = Math.round(parseFloat(a[l + 1]) * 2.55);
|
|
404
404
|
a[4] && (a[5] ? o[3] = parseFloat(a[4]) * 0.01 : o[3] = parseFloat(a[4]));
|
|
405
405
|
} else
|
|
406
|
-
return (a = e.match(i)) ? a[1] === "transparent" ? [0, 0, 0, 0] : Ve.call(
|
|
406
|
+
return (a = e.match(i)) ? a[1] === "transparent" ? [0, 0, 0, 0] : Ve.call(J, a[1]) ? (o = J[a[1]], o[3] = 1, o) : null : null;
|
|
407
407
|
for (l = 0; l < 3; l++)
|
|
408
|
-
o[l] =
|
|
409
|
-
return o[3] =
|
|
408
|
+
o[l] = D(o[l], 0, 255);
|
|
409
|
+
return o[3] = D(o[3], 0, 1), o;
|
|
410
410
|
};
|
|
411
411
|
A.get.hsl = function(e) {
|
|
412
412
|
if (!e)
|
|
413
413
|
return null;
|
|
414
414
|
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);
|
|
415
415
|
if (s) {
|
|
416
|
-
var r = parseFloat(s[4]), n = (parseFloat(s[1]) % 360 + 360) % 360, i =
|
|
416
|
+
var r = parseFloat(s[4]), n = (parseFloat(s[1]) % 360 + 360) % 360, i = D(parseFloat(s[2]), 0, 100), o = D(parseFloat(s[3]), 0, 100), a = D(isNaN(r) ? 1 : r, 0, 1);
|
|
417
417
|
return [n, i, o, a];
|
|
418
418
|
}
|
|
419
419
|
return null;
|
|
@@ -423,7 +423,7 @@ A.get.hwb = function(e) {
|
|
|
423
423
|
return null;
|
|
424
424
|
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);
|
|
425
425
|
if (s) {
|
|
426
|
-
var r = parseFloat(s[4]), n = (parseFloat(s[1]) % 360 + 360) % 360, i =
|
|
426
|
+
var r = parseFloat(s[4]), n = (parseFloat(s[1]) % 360 + 360) % 360, i = D(parseFloat(s[2]), 0, 100), o = D(parseFloat(s[3]), 0, 100), a = D(isNaN(r) ? 1 : r, 0, 1);
|
|
427
427
|
return [n, i, o, a];
|
|
428
428
|
}
|
|
429
429
|
return null;
|
|
@@ -451,7 +451,7 @@ A.to.hwb = function() {
|
|
|
451
451
|
A.to.keyword = function(e) {
|
|
452
452
|
return Ue[e.slice(0, 3)];
|
|
453
453
|
};
|
|
454
|
-
function
|
|
454
|
+
function D(e, t, s) {
|
|
455
455
|
return Math.min(Math.max(t, e), s);
|
|
456
456
|
}
|
|
457
457
|
function se(e) {
|
|
@@ -465,7 +465,7 @@ function re(e) {
|
|
|
465
465
|
}
|
|
466
466
|
function m(e, t) {
|
|
467
467
|
const s = re(e);
|
|
468
|
-
return
|
|
468
|
+
return Tt(s, t), s;
|
|
469
469
|
}
|
|
470
470
|
function B(e, t) {
|
|
471
471
|
return e.appendChild(t);
|
|
@@ -473,10 +473,10 @@ function B(e, t) {
|
|
|
473
473
|
function v(e) {
|
|
474
474
|
return `${O}-${e}`;
|
|
475
475
|
}
|
|
476
|
-
function
|
|
476
|
+
function Tt(e, t) {
|
|
477
477
|
e.className = v(t);
|
|
478
478
|
}
|
|
479
|
-
function
|
|
479
|
+
function Ot(e) {
|
|
480
480
|
return e.endsWith("/") ? e.slice(0, -1) : e;
|
|
481
481
|
}
|
|
482
482
|
function ze(e, t) {
|
|
@@ -513,7 +513,7 @@ function Dt(e) {
|
|
|
513
513
|
return e;
|
|
514
514
|
}
|
|
515
515
|
function He(e, t) {
|
|
516
|
-
return `${
|
|
516
|
+
return `${Ot(t || Fe)}/${e}`;
|
|
517
517
|
}
|
|
518
518
|
async function Ft({ taskId: e, url: t }) {
|
|
519
519
|
const s = He(e, t), r = `${s}/preview/1.png`, n = `${s}/jsonOutput/slide-1.json`, i = new Promise((a) => {
|
|
@@ -598,7 +598,7 @@ function Wt(e) {
|
|
|
598
598
|
const i = document.createElementNS(t, "text");
|
|
599
599
|
return i.setAttribute("x", "125"), i.setAttribute("y", "345"), i.setAttribute("data-id", "progress"), i.style.fontSize = "246px", i.textContent = "20", s.appendChild(i), s.appendChild(r), s;
|
|
600
600
|
}
|
|
601
|
-
function
|
|
601
|
+
function Xt() {
|
|
602
602
|
let e = j;
|
|
603
603
|
const t = (p) => {
|
|
604
604
|
e = p;
|
|
@@ -612,54 +612,54 @@ function Jt() {
|
|
|
612
612
|
n = p;
|
|
613
613
|
};
|
|
614
614
|
let o = !1, a = !1, l = 0, h = 0;
|
|
615
|
-
const
|
|
616
|
-
|
|
615
|
+
const b = m("div", "footer"), c = m("button", "btn-sidebar");
|
|
616
|
+
c.classList.add(v("footer-btn")), c.appendChild(Ut(O)), c.onclick = function() {
|
|
617
617
|
o || s();
|
|
618
|
-
},
|
|
619
|
-
const
|
|
620
|
-
|
|
618
|
+
}, c.style.display = "none", b.appendChild(c);
|
|
619
|
+
const d = m("div", "page-jumps"), f = m("button", "btn-page-back");
|
|
620
|
+
f.classList.add(v("footer-btn")), f.appendChild(Bt(O)), f.onclick = function() {
|
|
621
621
|
o || e(l - 1);
|
|
622
|
-
},
|
|
622
|
+
}, d.appendChild(f);
|
|
623
623
|
const u = m("button", "btn-page-play");
|
|
624
624
|
u.classList.add(v("footer-btn")), u.appendChild(Ht(O)), u.appendChild(qt(O));
|
|
625
|
-
let
|
|
625
|
+
let k = 0;
|
|
626
626
|
u.onclick = function() {
|
|
627
|
-
o || (u.classList.add(v("footer-btn-playing")), n(), clearTimeout(
|
|
627
|
+
o || (u.classList.add(v("footer-btn-playing")), n(), clearTimeout(k), k = window.setTimeout(() => {
|
|
628
628
|
u.classList.remove(v("footer-btn-playing"));
|
|
629
629
|
}, 500));
|
|
630
|
-
},
|
|
631
|
-
const
|
|
632
|
-
|
|
630
|
+
}, d.appendChild(u);
|
|
631
|
+
const S = m("button", "btn-page-next");
|
|
632
|
+
S.classList.add(v("footer-btn")), S.appendChild(jt(O)), S.onclick = function() {
|
|
633
633
|
o || e(l + 1);
|
|
634
|
-
},
|
|
635
|
-
const
|
|
634
|
+
}, d.appendChild(S);
|
|
635
|
+
const N = m("div", "page-number"), I = m("input", "page-number-input");
|
|
636
636
|
I.value = String(l + 1), I.onchange = function() {
|
|
637
637
|
o || I.value && e(Number(I.value) - 1);
|
|
638
638
|
};
|
|
639
639
|
const g = m("span", "total-page");
|
|
640
|
-
g.textContent = " / ",
|
|
640
|
+
g.textContent = " / ", N.appendChild(I), N.appendChild(g), b.appendChild(d), b.appendChild(N);
|
|
641
641
|
const w = v("readonly");
|
|
642
642
|
let z = j;
|
|
643
643
|
const L = (p) => {
|
|
644
644
|
z = p;
|
|
645
645
|
}, C = (p) => {
|
|
646
646
|
if (p < 99) {
|
|
647
|
-
_.style.display = "block",
|
|
647
|
+
_.style.display = "block", x.style.display = "none";
|
|
648
648
|
const te = _.querySelector("[data-id]");
|
|
649
649
|
te && (te.textContent = p.toString().padStart(2, "0"));
|
|
650
650
|
} else
|
|
651
|
-
_.style.display = "none",
|
|
652
|
-
},
|
|
651
|
+
_.style.display = "none", x.style.display = "block";
|
|
652
|
+
}, x = Gt(O), _ = Wt(O);
|
|
653
653
|
_.style.display = "none";
|
|
654
654
|
const $ = m("button", "footer-btn");
|
|
655
|
-
$.appendChild(
|
|
655
|
+
$.appendChild(x), $.onclick = function() {
|
|
656
656
|
z(C);
|
|
657
657
|
}, $.appendChild(_);
|
|
658
658
|
function y(p) {
|
|
659
|
-
o !== p && (o = p,
|
|
659
|
+
o !== p && (o = p, b.classList.toggle(w, o), I.disabled = o);
|
|
660
660
|
}
|
|
661
661
|
function U(p) {
|
|
662
|
-
a !== p && (a = p,
|
|
662
|
+
a !== p && (a = p, c.style.display = a ? "" : "none");
|
|
663
663
|
}
|
|
664
664
|
function ce(p, te = !1) {
|
|
665
665
|
(te || l !== p) && (l = p, I.value = String(l + 1));
|
|
@@ -668,7 +668,7 @@ function Jt() {
|
|
|
668
668
|
h !== p && (h = p, g.textContent = ` / ${h}`);
|
|
669
669
|
}
|
|
670
670
|
return {
|
|
671
|
-
$footer:
|
|
671
|
+
$footer: b,
|
|
672
672
|
$pageNumberInput: I,
|
|
673
673
|
set_readonly: y,
|
|
674
674
|
set_sidebar: U,
|
|
@@ -680,9 +680,9 @@ function Jt() {
|
|
|
680
680
|
on_save_to_pdf: L
|
|
681
681
|
};
|
|
682
682
|
}
|
|
683
|
-
const
|
|
683
|
+
const R = typeof window < "u", qe = R && !("onscroll" in window) || typeof navigator < "u" && /(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent), je = R && "IntersectionObserver" in window, Ge = R && "classList" in document.createElement("p"), We = R && window.devicePixelRatio > 1, Jt = {
|
|
684
684
|
elements_selector: ".lazy",
|
|
685
|
-
container: qe ||
|
|
685
|
+
container: qe || R ? document : null,
|
|
686
686
|
threshold: 300,
|
|
687
687
|
thresholds: null,
|
|
688
688
|
data_src: "src",
|
|
@@ -713,7 +713,7 @@ const F = typeof window < "u", qe = F && !("onscroll" in window) || typeof navig
|
|
|
713
713
|
callback_cancel: null,
|
|
714
714
|
use_native: !1,
|
|
715
715
|
restore_on_error: !1
|
|
716
|
-
},
|
|
716
|
+
}, Xe = (e) => Object.assign({}, Jt, e), $e = function(e, t) {
|
|
717
717
|
let s;
|
|
718
718
|
const r = "LazyLoad::Initialized", n = new e(t);
|
|
719
719
|
try {
|
|
@@ -729,14 +729,14 @@ const F = typeof window < "u", qe = F && !("onscroll" in window) || typeof navig
|
|
|
729
729
|
else
|
|
730
730
|
for (let s = 0, r; r = t[s]; s += 1)
|
|
731
731
|
$e(e, r);
|
|
732
|
-
},
|
|
732
|
+
}, T = "src", ge = "srcset", be = "sizes", Je = "poster", K = "llOriginalAttrs", Ye = "data", me = "loading", Ze = "loaded", Ke = "applied", Zt = "entered", ve = "error", Qe = "native", et = "data-", tt = "ll-status", E = (e, t) => e.getAttribute(et + t), Kt = (e, t, s) => {
|
|
733
733
|
var r = et + t;
|
|
734
734
|
if (s === null) {
|
|
735
735
|
e.removeAttribute(r);
|
|
736
736
|
return;
|
|
737
737
|
}
|
|
738
738
|
e.setAttribute(r, s);
|
|
739
|
-
}, Q = (e) =>
|
|
739
|
+
}, Q = (e) => E(e, tt), q = (e, t) => Kt(e, tt, t), ne = (e) => q(e, null), we = (e) => Q(e) === null, Qt = (e) => Q(e) === me, es = (e) => Q(e) === ve, _e = (e) => Q(e) === Qe, ts = [me, Ze, Ke, ve], ss = (e) => ts.indexOf(Q(e)) >= 0, V = (e, t, s, r) => {
|
|
740
740
|
if (e) {
|
|
741
741
|
if (r !== void 0) {
|
|
742
742
|
e(t, s, r);
|
|
@@ -748,7 +748,7 @@ const F = typeof window < "u", qe = F && !("onscroll" in window) || typeof navig
|
|
|
748
748
|
}
|
|
749
749
|
e(t);
|
|
750
750
|
}
|
|
751
|
-
},
|
|
751
|
+
}, X = (e, t) => {
|
|
752
752
|
if (Ge) {
|
|
753
753
|
e.classList.add(t);
|
|
754
754
|
return;
|
|
@@ -791,7 +791,7 @@ const F = typeof window < "u", qe = F && !("onscroll" in window) || typeof navig
|
|
|
791
791
|
ot(s).forEach(t);
|
|
792
792
|
}, nt = (e, t) => {
|
|
793
793
|
ot(e).forEach(t);
|
|
794
|
-
}, ae = [
|
|
794
|
+
}, ae = [T], it = [T, Je], Y = [T, ge, be], at = [Ye], le = (e) => !!e[K], lt = (e) => e[K], ct = (e) => delete e[K], G = (e, t) => {
|
|
795
795
|
if (le(e))
|
|
796
796
|
return;
|
|
797
797
|
const s = {};
|
|
@@ -819,33 +819,33 @@ const F = typeof window < "u", qe = F && !("onscroll" in window) || typeof navig
|
|
|
819
819
|
const t = lt(e);
|
|
820
820
|
e.style.backgroundImage = t.backgroundImage;
|
|
821
821
|
}, dt = (e, t, s) => {
|
|
822
|
-
|
|
822
|
+
X(e, t.class_applied), q(e, Ke), s && (t.unobserve_completed && ie(e, t), V(t.callback_applied, e, s));
|
|
823
823
|
}, ut = (e, t, s) => {
|
|
824
|
-
|
|
825
|
-
},
|
|
824
|
+
X(e, t.class_loading), q(e, me), s && (ye(s, 1), V(t.callback_loading, e, s));
|
|
825
|
+
}, F = (e, t, s) => {
|
|
826
826
|
s && e.setAttribute(t, s);
|
|
827
827
|
}, Me = (e, t) => {
|
|
828
|
-
|
|
828
|
+
F(e, be, E(e, t.data_sizes)), F(e, ge, E(e, t.data_srcset)), F(e, T, E(e, t.data_src));
|
|
829
829
|
}, hs = (e, t) => {
|
|
830
830
|
ke(e, (s) => {
|
|
831
831
|
G(s, Y), Me(s, t);
|
|
832
832
|
}), G(e, Y), Me(e, t);
|
|
833
833
|
}, fs = (e, t) => {
|
|
834
|
-
G(e, ae),
|
|
834
|
+
G(e, ae), F(e, T, E(e, t.data_src));
|
|
835
835
|
}, gs = (e, t) => {
|
|
836
836
|
nt(e, (s) => {
|
|
837
|
-
G(s, ae),
|
|
838
|
-
}), G(e, it),
|
|
837
|
+
G(s, ae), F(s, T, E(s, t.data_src));
|
|
838
|
+
}), G(e, it), F(e, Je, E(e, t.data_poster)), F(e, T, E(e, t.data_src)), e.load();
|
|
839
839
|
}, bs = (e, t) => {
|
|
840
|
-
G(e, at),
|
|
840
|
+
G(e, at), F(e, Ye, E(e, t.data_src));
|
|
841
841
|
}, ms = (e, t, s) => {
|
|
842
|
-
const r =
|
|
843
|
-
i && (e.style.backgroundImage = `url("${i}")`, st(e).setAttribute(
|
|
842
|
+
const r = E(e, t.data_bg), n = E(e, t.data_bg_hidpi), i = We && n ? n : r;
|
|
843
|
+
i && (e.style.backgroundImage = `url("${i}")`, st(e).setAttribute(T, i), ut(e, t, s));
|
|
844
844
|
}, vs = (e, t, s) => {
|
|
845
|
-
const r =
|
|
845
|
+
const r = E(e, t.data_bg_multi), n = E(e, t.data_bg_multi_hidpi), i = We && n ? n : r;
|
|
846
846
|
i && (e.style.backgroundImage = i, dt(e, t, s));
|
|
847
847
|
}, ws = (e, t, s) => {
|
|
848
|
-
const r =
|
|
848
|
+
const r = E(e, t.data_bg_set);
|
|
849
849
|
if (!r)
|
|
850
850
|
return;
|
|
851
851
|
const n = r.split("|");
|
|
@@ -863,7 +863,7 @@ const F = typeof window < "u", qe = F && !("onscroll" in window) || typeof navig
|
|
|
863
863
|
const r = pt[e.tagName];
|
|
864
864
|
r && (r(e, t), ut(e, t, s));
|
|
865
865
|
}, ks = ["IMG", "IFRAME", "VIDEO", "OBJECT"], Ss = (e) => ks.indexOf(e.tagName) > -1, ht = (e, t) => {
|
|
866
|
-
t && !ls(t) && !cs(t) &&
|
|
866
|
+
t && !ls(t) && !cs(t) && V(e.callback_finish, t);
|
|
867
867
|
}, Ne = (e, t, s) => {
|
|
868
868
|
e.addEventListener(t, s), e.llEvLisnrs[t] = s;
|
|
869
869
|
}, xs = (e, t, s) => {
|
|
@@ -885,10 +885,10 @@ const F = typeof window < "u", qe = F && !("onscroll" in window) || typeof navig
|
|
|
885
885
|
os(e), ye(s, -1), as(s), M(e, t.class_loading), t.unobserve_completed && ie(e, s);
|
|
886
886
|
}, Cs = (e, t, s, r) => {
|
|
887
887
|
const n = _e(t);
|
|
888
|
-
ft(t, s, r),
|
|
888
|
+
ft(t, s, r), X(t, s.class_loaded), q(t, Ze), V(s.callback_loaded, t, r), n || ht(s, r);
|
|
889
889
|
}, As = (e, t, s, r) => {
|
|
890
890
|
const n = _e(t);
|
|
891
|
-
ft(t, s, r),
|
|
891
|
+
ft(t, s, r), X(t, s.class_error), q(t, ve), V(s.callback_error, t, r), s.restore_on_error && H(t, Y), n || ht(s, r);
|
|
892
892
|
}, xe = (e, t, s) => {
|
|
893
893
|
const r = st(e) || e;
|
|
894
894
|
if (Se(r))
|
|
@@ -906,12 +906,12 @@ const F = typeof window < "u", qe = F && !("onscroll" in window) || typeof navig
|
|
|
906
906
|
Ss(e) ? zs(e, t, s) : Is(e, t, s);
|
|
907
907
|
}, Ls = (e, t, s) => {
|
|
908
908
|
e.setAttribute("loading", "lazy"), xe(e, t, s), _s(e, t), q(e, Qe);
|
|
909
|
-
},
|
|
910
|
-
e.removeAttribute(
|
|
909
|
+
}, Te = (e) => {
|
|
910
|
+
e.removeAttribute(T), e.removeAttribute(ge), e.removeAttribute(be);
|
|
911
911
|
}, $s = (e) => {
|
|
912
912
|
ke(e, (t) => {
|
|
913
|
-
|
|
914
|
-
}),
|
|
913
|
+
Te(t);
|
|
914
|
+
}), Te(e);
|
|
915
915
|
}, gt = (e) => {
|
|
916
916
|
ke(e, (t) => {
|
|
917
917
|
H(t, Y);
|
|
@@ -922,15 +922,15 @@ const F = typeof window < "u", qe = F && !("onscroll" in window) || typeof navig
|
|
|
922
922
|
}), H(e, it), e.load();
|
|
923
923
|
}, Ns = (e) => {
|
|
924
924
|
H(e, ae);
|
|
925
|
-
},
|
|
925
|
+
}, Ts = (e) => {
|
|
926
926
|
H(e, at);
|
|
927
|
-
},
|
|
927
|
+
}, Os = {
|
|
928
928
|
IMG: gt,
|
|
929
929
|
IFRAME: Ns,
|
|
930
930
|
VIDEO: Ms,
|
|
931
|
-
OBJECT:
|
|
931
|
+
OBJECT: Ts
|
|
932
932
|
}, Ps = (e) => {
|
|
933
|
-
const t =
|
|
933
|
+
const t = Os[e.tagName];
|
|
934
934
|
if (!t) {
|
|
935
935
|
ps(e);
|
|
936
936
|
return;
|
|
@@ -941,12 +941,12 @@ const F = typeof window < "u", qe = F && !("onscroll" in window) || typeof navig
|
|
|
941
941
|
}, Fs = (e, t) => {
|
|
942
942
|
Ps(e), Ds(e, t), ne(e), ct(e);
|
|
943
943
|
}, Rs = (e, t, s, r) => {
|
|
944
|
-
s.cancel_on_exit && Qt(e) && e.tagName === "IMG" && (fe(e), $s(e), gt(e), M(e, s.class_loading), ye(r, -1), ne(e),
|
|
944
|
+
s.cancel_on_exit && Qt(e) && e.tagName === "IMG" && (fe(e), $s(e), gt(e), M(e, s.class_loading), ye(r, -1), ne(e), V(s.callback_cancel, e, t, r));
|
|
945
945
|
}, Vs = (e, t, s, r) => {
|
|
946
946
|
const n = ss(e);
|
|
947
|
-
q(e, Zt),
|
|
947
|
+
q(e, Zt), X(e, s.class_entered), M(e, s.class_exited), is(e, s, r), V(s.callback_enter, e, t, r), !n && Ee(e, s, r);
|
|
948
948
|
}, Us = (e, t, s, r) => {
|
|
949
|
-
we(e) || (
|
|
949
|
+
we(e) || (X(e, s.class_exited), Rs(e, t, s, r), V(s.callback_exit, e, t, r));
|
|
950
950
|
}, Bs = ["IMG", "IFRAME", "VIDEO"], bt = (e) => e.use_native && "loading" in HTMLImageElement.prototype, Hs = (e, t, s) => {
|
|
951
951
|
e.forEach((r) => {
|
|
952
952
|
Bs.indexOf(r.tagName) !== -1 && Ls(r, t, s);
|
|
@@ -962,29 +962,29 @@ const F = typeof window < "u", qe = F && !("onscroll" in window) || typeof navig
|
|
|
962
962
|
t.forEach((s) => {
|
|
963
963
|
e.observe(s);
|
|
964
964
|
});
|
|
965
|
-
}, Js = (e, t) => {
|
|
966
|
-
ns(e), Ws(e, t);
|
|
967
965
|
}, Xs = (e, t) => {
|
|
966
|
+
ns(e), Ws(e, t);
|
|
967
|
+
}, Js = (e, t) => {
|
|
968
968
|
!je || bt(e) || (t._observer = new IntersectionObserver((s) => {
|
|
969
969
|
Gs(s, e, t);
|
|
970
970
|
}, js(e)));
|
|
971
|
-
}, mt = (e) => Array.prototype.slice.call(e), oe = (e) => e.container.querySelectorAll(e.elements_selector), Ys = (e) => mt(e).filter(we), Zs = (e) => es(e), Ks = (e) => mt(e).filter(Zs),
|
|
971
|
+
}, mt = (e) => Array.prototype.slice.call(e), oe = (e) => e.container.querySelectorAll(e.elements_selector), Ys = (e) => mt(e).filter(we), Zs = (e) => es(e), Ks = (e) => mt(e).filter(Zs), Oe = (e, t) => Ys(e || oe(t)), Qs = (e, t) => {
|
|
972
972
|
Ks(oe(e)).forEach((r) => {
|
|
973
973
|
M(r, e.class_error), ne(r);
|
|
974
974
|
}), t.update();
|
|
975
975
|
}, er = (e, t) => {
|
|
976
|
-
|
|
976
|
+
R && (t._onlineHandler = () => {
|
|
977
977
|
Qs(e, t);
|
|
978
978
|
}, window.addEventListener("online", t._onlineHandler));
|
|
979
979
|
}, tr = (e) => {
|
|
980
|
-
|
|
980
|
+
R && window.removeEventListener("online", e._onlineHandler);
|
|
981
981
|
}, ee = function(e, t) {
|
|
982
|
-
const s =
|
|
983
|
-
this._settings = s, this.loadingCount = 0,
|
|
982
|
+
const s = Xe(e);
|
|
983
|
+
this._settings = s, this.loadingCount = 0, Js(s, this), er(s, this), this.update(t);
|
|
984
984
|
};
|
|
985
985
|
ee.prototype = {
|
|
986
986
|
update: function(e) {
|
|
987
|
-
const t = this._settings, s =
|
|
987
|
+
const t = this._settings, s = Oe(e, t);
|
|
988
988
|
if (rt(this, s.length), qe || !je) {
|
|
989
989
|
this.loadAll(s);
|
|
990
990
|
return;
|
|
@@ -993,7 +993,7 @@ ee.prototype = {
|
|
|
993
993
|
Hs(s, t, this);
|
|
994
994
|
return;
|
|
995
995
|
}
|
|
996
|
-
|
|
996
|
+
Xs(this._observer, s);
|
|
997
997
|
},
|
|
998
998
|
destroy: function() {
|
|
999
999
|
this._observer && this._observer.disconnect(), tr(this), oe(this._settings).forEach((e) => {
|
|
@@ -1002,7 +1002,7 @@ ee.prototype = {
|
|
|
1002
1002
|
},
|
|
1003
1003
|
loadAll: function(e) {
|
|
1004
1004
|
const t = this._settings;
|
|
1005
|
-
|
|
1005
|
+
Oe(e, t).forEach((r) => {
|
|
1006
1006
|
ie(r, this), Ee(r, t, this);
|
|
1007
1007
|
});
|
|
1008
1008
|
},
|
|
@@ -1014,118 +1014,118 @@ ee.prototype = {
|
|
|
1014
1014
|
}
|
|
1015
1015
|
};
|
|
1016
1016
|
ee.load = (e, t) => {
|
|
1017
|
-
const s =
|
|
1017
|
+
const s = Xe(t);
|
|
1018
1018
|
Ee(e, s);
|
|
1019
1019
|
};
|
|
1020
1020
|
ee.resetStatus = (e) => {
|
|
1021
1021
|
ne(e);
|
|
1022
1022
|
};
|
|
1023
|
-
|
|
1023
|
+
R && Yt(ee, window.lazyLoadOptions);
|
|
1024
1024
|
function sr() {
|
|
1025
1025
|
let e = j;
|
|
1026
1026
|
const t = (g) => {
|
|
1027
1027
|
e = g;
|
|
1028
1028
|
};
|
|
1029
1029
|
let s = !1, r = !1, n = !1, i = [], o = 0;
|
|
1030
|
-
const a = v("readonly"), l = v("preview-active"), h = m("div", "content"),
|
|
1031
|
-
|
|
1032
|
-
r || w.target ===
|
|
1033
|
-
}, B(h,
|
|
1034
|
-
const
|
|
1035
|
-
|
|
1030
|
+
const a = v("readonly"), l = v("preview-active"), h = m("div", "content"), b = m("div", "preview-mask");
|
|
1031
|
+
b.onclick = function(w) {
|
|
1032
|
+
r || w.target === b && u(!1);
|
|
1033
|
+
}, B(h, b);
|
|
1034
|
+
const c = m("div", "preview");
|
|
1035
|
+
c.classList.add(v("tele-fancy-scrollbar")), c.onclick = function(w) {
|
|
1036
1036
|
var L;
|
|
1037
1037
|
if (r)
|
|
1038
1038
|
return;
|
|
1039
1039
|
const z = (L = w.target.dataset) == null ? void 0 : L.pageIndex;
|
|
1040
1040
|
z && (w.preventDefault(), w.stopPropagation(), w.stopImmediatePropagation(), e(Number(z)), u(!1));
|
|
1041
|
-
}, B(h,
|
|
1042
|
-
let
|
|
1043
|
-
function
|
|
1041
|
+
}, B(h, c);
|
|
1042
|
+
let d;
|
|
1043
|
+
function f(g) {
|
|
1044
1044
|
r !== g && (r = g, h.classList.toggle(a, r));
|
|
1045
1045
|
}
|
|
1046
1046
|
function u(g) {
|
|
1047
|
-
n !== g && (n = g, h.classList.toggle(l, n), n && !
|
|
1048
|
-
container:
|
|
1047
|
+
n !== g && (n = g, h.classList.toggle(l, n), n && !d && (d = new ee({
|
|
1048
|
+
container: c,
|
|
1049
1049
|
elements_selector: `.${v("preview-page>img")}`
|
|
1050
1050
|
})));
|
|
1051
1051
|
}
|
|
1052
|
-
function
|
|
1052
|
+
function k(g) {
|
|
1053
1053
|
if (i !== g) {
|
|
1054
1054
|
i = g;
|
|
1055
1055
|
const w = v("preview-page"), z = v("preview-page-name");
|
|
1056
1056
|
i.forEach((L, C) => {
|
|
1057
|
-
const
|
|
1058
|
-
_.className = w + " " + v(`preview-page-${C}`), _.href = "#", _.dataset.pageIndex =
|
|
1057
|
+
const x = String(C), _ = re("a");
|
|
1058
|
+
_.className = w + " " + v(`preview-page-${C}`), _.href = "#", _.dataset.pageIndex = x;
|
|
1059
1059
|
const $ = re("span");
|
|
1060
|
-
$.className = z, $.textContent = String(C + 1), $.dataset.pageIndex =
|
|
1060
|
+
$.className = z, $.textContent = String(C + 1), $.dataset.pageIndex = x;
|
|
1061
1061
|
const y = re("img");
|
|
1062
|
-
y.width = L.width, y.height = L.height, y.alt = `page-${C}`, y.dataset.src = L.thumbnail, y.dataset.pageIndex =
|
|
1063
|
-
}), s ||
|
|
1062
|
+
y.width = L.width, y.height = L.height, y.alt = `page-${C}`, y.dataset.src = L.thumbnail, y.dataset.pageIndex = x, B(_, y), B(_, $), B(c, _);
|
|
1063
|
+
}), s || d == null || d.update();
|
|
1064
1064
|
}
|
|
1065
1065
|
}
|
|
1066
|
-
function
|
|
1066
|
+
function S(g, w = !1) {
|
|
1067
1067
|
if (w || o !== g) {
|
|
1068
1068
|
o = g;
|
|
1069
|
-
const z =
|
|
1069
|
+
const z = c.querySelector(
|
|
1070
1070
|
`.${v(`preview-page-${o}`)}`
|
|
1071
1071
|
);
|
|
1072
|
-
z &&
|
|
1072
|
+
z && c.scrollTo({ top: z.offsetTop - 16 });
|
|
1073
1073
|
}
|
|
1074
1074
|
}
|
|
1075
|
-
function
|
|
1076
|
-
s = !0,
|
|
1075
|
+
function N() {
|
|
1076
|
+
s = !0, d == null || d.destroy();
|
|
1077
1077
|
}
|
|
1078
1078
|
function I() {
|
|
1079
1079
|
return n;
|
|
1080
1080
|
}
|
|
1081
1081
|
return {
|
|
1082
1082
|
$content: h,
|
|
1083
|
-
$preview:
|
|
1084
|
-
set_readonly:
|
|
1083
|
+
$preview: c,
|
|
1084
|
+
set_readonly: f,
|
|
1085
1085
|
set_active: u,
|
|
1086
1086
|
get_active: I,
|
|
1087
|
-
set_pages:
|
|
1087
|
+
set_pages: k,
|
|
1088
1088
|
on_new_page_index: t,
|
|
1089
|
-
set_page_index:
|
|
1090
|
-
destroy:
|
|
1089
|
+
set_page_index: S,
|
|
1090
|
+
destroy: N
|
|
1091
1091
|
};
|
|
1092
1092
|
}
|
|
1093
1093
|
const vt = class {
|
|
1094
1094
|
constructor(e) {
|
|
1095
|
-
this.sideEffect = new De(), this.events = new Ct(), this.$slide = m("div", "slide"), this.$overlay = m("div", "overlay"), this.sidebar = sr(), this.footer =
|
|
1095
|
+
this.sideEffect = new De(), this.events = new Ct(), this.$slide = m("div", "slide"), this.$overlay = m("div", "overlay"), this.sidebar = sr(), this.footer = Xt(), this._getWhiteSnapshot = null, this._slideTitle = "", this._ready = !1, this._slideCount = 0, this._destroyed = !1, this._isFrozen = !1, this._cachedIsFrozen = !1, this.onPlay = () => {
|
|
1096
1096
|
this.slide.nextStep();
|
|
1097
1097
|
}, this.onNewPageIndex = (o) => {
|
|
1098
1098
|
this._ready && o >= 0 && o < this._slideCount ? this.slide.renderSlide(o + 1) : this.setPage(this.slide.slideState.currentSlideIndex);
|
|
1099
1099
|
}, this.onTogglePreview = () => {
|
|
1100
1100
|
this.sidebar.set_active(!this.sidebar.get_active());
|
|
1101
1101
|
}, this.toPdf = async (o) => {
|
|
1102
|
-
const l = document.createElement("canvas"), h = l.getContext("2d"), { slideCount:
|
|
1103
|
-
let
|
|
1104
|
-
|
|
1105
|
-
const
|
|
1106
|
-
|
|
1107
|
-
const
|
|
1108
|
-
if (!
|
|
1102
|
+
const l = document.createElement("canvas"), h = l.getContext("2d"), { slideCount: b, width: c, height: d } = this.slide;
|
|
1103
|
+
let f = Math.floor(c), u = Math.floor(d);
|
|
1104
|
+
f > 1920 && (f = 1920, u = Math.floor(d * f / c)), u > 1920 && (u = 1920, f = Math.floor(c * u / d)), l.width = f, l.height = u;
|
|
1105
|
+
const k = document.createElement("canvas");
|
|
1106
|
+
k.width = c, k.height = d;
|
|
1107
|
+
const S = k.getContext("2d");
|
|
1108
|
+
if (!S || !this._getWhiteSnapshot || !h)
|
|
1109
1109
|
return null;
|
|
1110
|
-
const
|
|
1111
|
-
format: [
|
|
1112
|
-
orientation:
|
|
1110
|
+
const N = f > u ? "l" : "p", { jsPDF: I } = await import("jspdf"), g = new I({
|
|
1111
|
+
format: [f, u],
|
|
1112
|
+
orientation: N,
|
|
1113
1113
|
compress: !0
|
|
1114
1114
|
});
|
|
1115
|
-
for (let
|
|
1116
|
-
const _ = await this.slide.snapshotWithTimingEnd(
|
|
1115
|
+
for (let x = 1; x <= b; x++) {
|
|
1116
|
+
const _ = await this.slide.snapshotWithTimingEnd(x);
|
|
1117
1117
|
if (_) {
|
|
1118
1118
|
const y = document.createElement("img");
|
|
1119
|
-
y.src = _, await new Promise((U) => y.onload = U), h.drawImage(y, 0, 0,
|
|
1119
|
+
y.src = _, await new Promise((U) => y.onload = U), h.drawImage(y, 0, 0, f, u);
|
|
1120
1120
|
}
|
|
1121
|
-
|
|
1121
|
+
S.clearRect(0, 0, c, d), this._getWhiteSnapshot(x, k, S);
|
|
1122
1122
|
try {
|
|
1123
|
-
const y =
|
|
1124
|
-
U.src = y, await new Promise((ce) => U.onload = ce), h.drawImage(U, 0, 0,
|
|
1123
|
+
const y = k.toDataURL("image/png"), U = document.createElement("img");
|
|
1124
|
+
U.src = y, await new Promise((ce) => U.onload = ce), h.drawImage(U, 0, 0, f, u);
|
|
1125
1125
|
} catch {
|
|
1126
1126
|
}
|
|
1127
1127
|
const $ = l.toDataURL("image/jpeg", 0.6);
|
|
1128
|
-
|
|
1128
|
+
x > 1 && g.addPage(), g.addImage($, "JPEG", 0, 0, f, u, "", "FAST"), h.clearRect(0, 0, f, u), o(Math.ceil(x / b * 100));
|
|
1129
1129
|
}
|
|
1130
1130
|
const w = g.output("arraybuffer"), z = new Blob([w]), L = URL.createObjectURL(z), C = document.createElement("a");
|
|
1131
1131
|
C.setAttribute("href", L), C.setAttribute("download", `${this._slideTitle || "snapshot"}.pdf`), C.style.display = "none", document.body.appendChild(C), C.click(), document.body.removeChild(C), window.postMessage({ type: "@app-slide/_download_pdf_", buf: w });
|
|
@@ -1140,10 +1140,10 @@ const vt = class {
|
|
|
1140
1140
|
this._infoPromise = t, vt.fetchSlideInfo(e).then(({ preview: o, slide: a }) => {
|
|
1141
1141
|
if (!this._destroyed) {
|
|
1142
1142
|
if (this._slideCount = a.slideCount, o) {
|
|
1143
|
-
const { taskId: l, url: h } = e, { slideCount:
|
|
1144
|
-
width:
|
|
1145
|
-
height:
|
|
1146
|
-
thumbnail: `${
|
|
1143
|
+
const { taskId: l, url: h } = e, { slideCount: b } = a, { width: c, height: d } = o, f = He(l, h), u = Array.from({ length: b }, (k, S) => ({
|
|
1144
|
+
width: c,
|
|
1145
|
+
height: d,
|
|
1146
|
+
thumbnail: `${f}/preview/${S + 1}.png`
|
|
1147
1147
|
}));
|
|
1148
1148
|
this.sidebar.set_pages(u), this.footer.set_sidebar(!0);
|
|
1149
1149
|
}
|
|
@@ -1206,17 +1206,17 @@ W.fetchSlideInfo = Ft;
|
|
|
1206
1206
|
function rr(e) {
|
|
1207
1207
|
return e.displayer.logger;
|
|
1208
1208
|
}
|
|
1209
|
-
const
|
|
1209
|
+
const P = class {
|
|
1210
1210
|
constructor(e) {
|
|
1211
1211
|
this.context = e, this.info = (t) => {
|
|
1212
|
-
|
|
1213
|
-
}, e && (
|
|
1212
|
+
P.roomLogger && this.context ? P.roomLogger.info(t + ` (${this.context.appId})`) : this.context ? console.debug(t + ` (${this.context.appId})`) : console.debug(t);
|
|
1213
|
+
}, e && (P.active.add(e.appId), P.roomLogger = rr(e));
|
|
1214
1214
|
}
|
|
1215
1215
|
destroy() {
|
|
1216
|
-
this.context &&
|
|
1216
|
+
this.context && P.active.delete(this.context.appId), P.active.size === 0 && (P.roomLogger = null);
|
|
1217
1217
|
}
|
|
1218
1218
|
};
|
|
1219
|
-
let Ce =
|
|
1219
|
+
let Ce = P;
|
|
1220
1220
|
Ce.active = /* @__PURE__ */ new Set();
|
|
1221
1221
|
Ce.roomLogger = null;
|
|
1222
1222
|
function or({ context: e, storage: t, viewer: s, sideEffect: r, logger: n }) {
|
|
@@ -1224,13 +1224,13 @@ function or({ context: e, storage: t, viewer: s, sideEffect: r, logger: n }) {
|
|
|
1224
1224
|
let o = null;
|
|
1225
1225
|
s.prepare(({ width: c, height: d, slideCount: f }) => {
|
|
1226
1226
|
e.destroyed || (c && e.box.setStageRatio(d / c), o = e.createWhiteBoardView({ size: f }), o.setBaseRect({ width: c, height: d }), s.setSlideTitle(e.box.title), s.attachWhiteSnapshot(
|
|
1227
|
-
(
|
|
1227
|
+
(u, k, S) => {
|
|
1228
1228
|
if (!o)
|
|
1229
1229
|
return null;
|
|
1230
|
-
const
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1230
|
+
const N = o.pageState.pages[u - 1];
|
|
1231
|
+
k.width = o.view.size.width, k.height = o.view.size.height, o.view.screenshotToCanvas(
|
|
1232
|
+
S,
|
|
1233
|
+
N,
|
|
1234
1234
|
o.view.size.width,
|
|
1235
1235
|
o.view.size.height,
|
|
1236
1236
|
{
|
|
@@ -1283,20 +1283,27 @@ function or({ context: e, storage: t, viewer: s, sideEffect: r, logger: n }) {
|
|
|
1283
1283
|
e.emitter.on("writableChange", (c) => {
|
|
1284
1284
|
s.setReadonly(!c);
|
|
1285
1285
|
})
|
|
1286
|
-
)
|
|
1287
|
-
|
|
1286
|
+
);
|
|
1287
|
+
const b = (c) => {
|
|
1288
|
+
if (!c)
|
|
1289
|
+
return !1;
|
|
1290
|
+
const d = c.tagName;
|
|
1291
|
+
return d === "INPUT" || d === "TEXTAREA" || d === "SELECT";
|
|
1292
|
+
};
|
|
1293
|
+
r.addEventListener(window, "keydown", (c) => {
|
|
1294
|
+
e.box.focus && !e.box.readonly && !b(c.target) && ((c.key === "ArrowUp" || c.key === "ArrowLeft") && s.slide.prevStep(), (c.key === "ArrowRight" || c.key === "ArrowDown") && s.slide.nextStep());
|
|
1288
1295
|
});
|
|
1289
1296
|
}
|
|
1290
1297
|
function ar(e) {
|
|
1291
1298
|
const { container: t, ...s } = e, r = m("div", "preview-wrapper"), n = new W(s);
|
|
1292
1299
|
return r.appendChild(document.createElement("style")).textContent = W.styles, r.appendChild(n.$content), r.appendChild(n.$footer), t.appendChild(r), n.prepare(() => n.slide.renderSlide(1)), n;
|
|
1293
1300
|
}
|
|
1294
|
-
const lr = /* @__PURE__ */ ue.usePlugin.bind(ue), cr = "0.3.0-canary.
|
|
1301
|
+
const lr = /* @__PURE__ */ ue.usePlugin.bind(ue), cr = "0.3.0-canary.19", dr = {
|
|
1295
1302
|
kind: "Slide",
|
|
1296
1303
|
setup(e) {
|
|
1297
|
-
console.log("[Slide] setup @ 0.3.0-canary.
|
|
1304
|
+
console.log("[Slide] setup @ 0.3.0-canary.19 (" + e.appId + ")");
|
|
1298
1305
|
const t = new Ce(e);
|
|
1299
|
-
if (t.info("[Slide] setup @ 0.3.0-canary.
|
|
1306
|
+
if (t.info("[Slide] setup @ 0.3.0-canary.19"), !e.attributes.taskId)
|
|
1300
1307
|
throw new Error("[Slide] no taskId");
|
|
1301
1308
|
const s = e.createStorage("slide", e.attributes), r = e.getAppOptions() || {}, n = r.renderOptions || {}, i = new De(), o = new W({
|
|
1302
1309
|
interactive: !0,
|