html-flip-book-vanilla 0.0.0-alpha.53 → 0.0.0-alpha.55
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/flipbook.d.ts.map +1 -1
- package/dist/flipbook.js +73 -66
- package/dist/flipbook.js.map +1 -1
- package/dist/leaf.d.ts +1 -0
- package/dist/leaf.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/flipbook.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flipbook.d.ts","sourceRoot":"","sources":["../src/flipbook.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AACtB,OAAO,iBAAiB,CAAC;AACzB,OAAO,mBAAmB,CAAC;AAI3B,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAInE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EACX,eAAe,EAGf,SAAS,EAGT,MAAM,qBAAqB,CAAC;AAG7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAsDtD,cAAM,QAAQ;IACb,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,OAAO,CAAC,YAAY,CAAqB;IACzC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAwC;IACxE,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAG/B;IACF,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAwB;IAClD,OAAO,CAAC,SAAS,CAAqB;IACtC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA8B;IACjE,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAA0B;IAC9D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAA8B;IAC7D,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAmC;IACnE,OAAO,CAAC,QAAQ,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AqCzB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmClD,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAiFnC,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAcpC,OAAO,CAAC,kBAAkB;IAQ1B,OAAO;CAoCP;AAED,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,CAAC;AACxC,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAClG,OAAO,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,YAAY,EACX,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,iBAAiB,EACjB,cAAc,GACd,MAAM,qBAAqB,CAAC"}
|
package/dist/flipbook.js
CHANGED
|
@@ -73,7 +73,7 @@ function W(c, t) {
|
|
|
73
73
|
face: u === 0 ? 1 : 0,
|
|
74
74
|
zIndex: c.zIndices[u === 0 ? 1 : 0]
|
|
75
75
|
}
|
|
76
|
-
].filter((
|
|
76
|
+
].filter((g) => g.polygon.length > 0).map((g) => C(g, t));
|
|
77
77
|
}
|
|
78
78
|
const Z = ["data-face", "data-page-index", "data-bookmark-id", "aria-label"];
|
|
79
79
|
function j(c) {
|
|
@@ -268,7 +268,7 @@ class U {
|
|
|
268
268
|
const d = o[l];
|
|
269
269
|
let h = e.surfaces[l];
|
|
270
270
|
h || (h = this.host.ownerDocument.createElement("div"), h.setAttribute("data-flipbook-no-flip", ""), s.parentElement === this.host ? this.host.insertBefore(h, s) : this.host.append(h), e.surfaces.push(h)), h.hidden = !1, h.className = `flipbook-bookmark-surface ${n}`.trim(), h.dataset.bookmarkSurface = t.id, h.dataset.leafIndex = String(Math.floor(t.pageIndex / 2)), h.dataset.bookmarkFace = String(d.face), h.style.cssText = `position:absolute;left:${r}px;top:${a}px;width:${e.exposed.width}px;height:${e.exposed.height}px;pointer-events:none;transform-origin:0px 0px;overflow:visible;`;
|
|
271
|
-
for (const [u,
|
|
271
|
+
for (const [u, m] of e.appearance) h.style.setProperty(u, m);
|
|
272
272
|
h.style.transform = d.transform, h.style.zIndex = String(d.zIndex), h.style.clipPath = `polygon(${d.polygon.map((u) => `${u.x}px ${u.y}px`).join(", ")})`;
|
|
273
273
|
const p = l === 0 ? e.button : e.visual;
|
|
274
274
|
l === 0 ? this.showFace(e, d.face) : this.showVisualFace(e, d.face), this.placeContent(e, p, i, d.face), p.parentElement !== h && h.append(p);
|
|
@@ -394,18 +394,18 @@ class q {
|
|
|
394
394
|
return `inset(${i}px ${s}px ${o}px ${n}px)`;
|
|
395
395
|
}
|
|
396
396
|
place(t, e, i, s) {
|
|
397
|
-
const o = { left: t.left, top: t.top, width: t.width, height: t.height }, n = t.width >= t.height, r = n ? "left" : "top", a = n ? t.width : t.height, l = n ? e.width : e.height, d = Math.max(0, a - l) || a, h = i === "left" || i === "top" ? -1 : 1, u = ((n ? this.view?.innerWidth : this.view?.innerHeight) ?? a + 16) - a - 8,
|
|
398
|
-
return o[r] =
|
|
397
|
+
const o = { left: t.left, top: t.top, width: t.width, height: t.height }, n = t.width >= t.height, r = n ? "left" : "top", a = n ? t.width : t.height, l = n ? e.width : e.height, d = Math.max(0, a - l) || a, h = i === "left" || i === "top" ? -1 : 1, u = ((n ? this.view?.innerWidth : this.view?.innerHeight) ?? a + 16) - a - 8, m = s.dataset.orientation === "parallel" ? this.outsideFriends(s, n, a, h, u) : void 0;
|
|
398
|
+
return o[r] = m ?? Math.max(8, Math.min(t[r] + h * d, u)), o;
|
|
399
399
|
}
|
|
400
400
|
outsideFriends(t, e, i, s, o) {
|
|
401
401
|
const n = t.closest(".flipbook-bookmarks__rail");
|
|
402
402
|
if (!n) return;
|
|
403
|
-
const r = t.closest(".flipbook-bookmark-slot"), a = n.getBoundingClientRect(), l = e ? "left" : "top", d = e ? "right" : "bottom", h = Array.from(n.querySelectorAll(".flipbook-bookmark-slot")).filter((
|
|
404
|
-
(
|
|
403
|
+
const r = t.closest(".flipbook-bookmark-slot"), a = n.getBoundingClientRect(), l = e ? "left" : "top", d = e ? "right" : "bottom", h = Array.from(n.querySelectorAll(".flipbook-bookmark-slot")).filter((g) => g !== r).map((g) => g.getBoundingClientRect()).filter(
|
|
404
|
+
(g) => g.width > 0 && g.height > 0 && g[d] > a[l] && g[l] < a[d]
|
|
405
405
|
);
|
|
406
406
|
if (h.length === 0) return;
|
|
407
|
-
const p = Math.max(a[l], Math.min(...h.map((
|
|
408
|
-
return (s < 0 ? [p, u] : [u, p]).find((
|
|
407
|
+
const p = Math.max(a[l], Math.min(...h.map((g) => g[l]))) - i - 4, u = Math.min(a[d], Math.max(...h.map((g) => g[d]))) + 4;
|
|
408
|
+
return (s < 0 ? [p, u] : [u, p]).find((g) => g >= 8 && g <= o);
|
|
409
409
|
}
|
|
410
410
|
copyAppearance(t) {
|
|
411
411
|
const e = this.view?.getComputedStyle(t);
|
|
@@ -438,12 +438,12 @@ function B(c, t, e, i, s, o, n = i, r = 0) {
|
|
|
438
438
|
const b = Math.floor((a - l) / (l + s / 2) + 0.5);
|
|
439
439
|
h = Math.max(1, Math.min(h, b || 1)), h > 1 && (d = Math.min(d, (a - l) / (h - 0.5))), p = Math.min(d / 2, a - l);
|
|
440
440
|
}
|
|
441
|
-
const u = Math.max(1, Math.ceil(c / h)),
|
|
441
|
+
const u = Math.max(1, Math.ceil(c / h)), m = Math.min(
|
|
442
442
|
Math.max(i, n),
|
|
443
443
|
i + (u - 1) * o
|
|
444
|
-
),
|
|
444
|
+
), g = Math.min(i * 0.75, Math.max(20, i * 0.6)), f = u > 1 ? Math.min(o, (m - g) / (u - 1)) : 0;
|
|
445
445
|
if (u > 1 && f < r && o >= r) {
|
|
446
|
-
const b = Math.max(1, 1 + Math.floor((
|
|
446
|
+
const b = Math.max(1, 1 + Math.floor((m - g) / r)), k = Math.ceil(c / b), y = (a - (k - 0.5) * s) / (k + 0.5);
|
|
447
447
|
return B(
|
|
448
448
|
c,
|
|
449
449
|
t,
|
|
@@ -461,8 +461,8 @@ function B(c, t, e, i, s, o, n = i, r = 0) {
|
|
|
461
461
|
pitch: d,
|
|
462
462
|
stagger: p,
|
|
463
463
|
step: f,
|
|
464
|
-
frontDepth:
|
|
465
|
-
depth:
|
|
464
|
+
frontDepth: m - (u - 1) * f,
|
|
465
|
+
depth: m
|
|
466
466
|
};
|
|
467
467
|
}
|
|
468
468
|
const G = ["top", "right", "bottom", "left"], K = 28;
|
|
@@ -590,8 +590,8 @@ class J {
|
|
|
590
590
|
r.dataset.stackCapacity = String(d.capacity), r.dataset.stackLayers = String(d.layers), r.dataset.stackPitch = String(d.pitch), r.dataset.stackStagger = String(d.stagger), r.style.width = `${d.depth}px`, r.style.zIndex = String(this.getRestingRailZIndex(n)), n === "left" && (r.style.left = `${t.left - d.depth}px`), this.orderedLeafIds.forEach((h, p) => {
|
|
591
591
|
const u = this.items.get(h);
|
|
592
592
|
if (!u || u.edge !== n) return;
|
|
593
|
-
const
|
|
594
|
-
b.dataset.stackLayer = String(
|
|
593
|
+
const m = Math.floor(p / d.capacity), g = p % d.capacity, f = d.frontDepth + m * d.step, b = u.slot;
|
|
594
|
+
b.dataset.stackLayer = String(m), b.dataset.stackRow = String(g), b.dataset.stackPeek = String(m === 0 ? f : d.step), b.style.setProperty("--bookmark-exposed-depth", `${f}px`), b.style.setProperty("--bookmark-exposed-length", `${d.length}px`), b.style.top = `${g * d.pitch + m % 2 * d.stagger}px`, b.style.width = `${f}px`, b.style.height = `${d.length}px`, b.style.zIndex = String(d.layers - m);
|
|
595
595
|
});
|
|
596
596
|
}
|
|
597
597
|
}
|
|
@@ -711,9 +711,9 @@ class J {
|
|
|
711
711
|
p.className = "flipbook-bookmark__content", p.inert = !0, p.setAttribute("aria-hidden", "true"), h.append(p);
|
|
712
712
|
const u = p.cloneNode(!1);
|
|
713
713
|
u.hidden = !0;
|
|
714
|
-
const
|
|
715
|
-
|
|
716
|
-
const
|
|
714
|
+
const m = this.host.ownerDocument.createElement("span");
|
|
715
|
+
m.className = "flipbook-bookmark__expanded-content", m.inert = !0, m.hidden = !0, this.storage.append(u, m);
|
|
716
|
+
const g = (f) => {
|
|
717
717
|
f.preventDefault();
|
|
718
718
|
const b = h.ownerDocument.getSelection();
|
|
719
719
|
if (this.mouseMode === "select" && b && !b.isCollapsed && (h.contains(b.anchorNode) || h.contains(b.focusNode)))
|
|
@@ -727,7 +727,7 @@ class J {
|
|
|
727
727
|
const y = k.button.dataset.face === "1" ? k.leaf.back : k.leaf.front, x = this.provider?.onClick;
|
|
728
728
|
x ? x(this.getContext().currentLeafIndex, y) : this.jump(y.pageIndex);
|
|
729
729
|
};
|
|
730
|
-
h.addEventListener("click",
|
|
730
|
+
h.addEventListener("click", g), r = {
|
|
731
731
|
leaf: t,
|
|
732
732
|
bookmark: o,
|
|
733
733
|
reverseBookmark: n,
|
|
@@ -736,8 +736,8 @@ class J {
|
|
|
736
736
|
slot: d,
|
|
737
737
|
content: p,
|
|
738
738
|
reverse: u,
|
|
739
|
-
click:
|
|
740
|
-
expanded:
|
|
739
|
+
click: g,
|
|
740
|
+
expanded: m,
|
|
741
741
|
expandedRenderer: void 0,
|
|
742
742
|
edge: "right"
|
|
743
743
|
}, this.items.set(t.id, r), this.bindPreview(r), p.replaceChildren(i ? i(o) : o.label), n !== o && u.replaceChildren(i ? i(n) : n.label);
|
|
@@ -950,18 +950,18 @@ function O(c, t, e, i) {
|
|
|
950
950
|
}, n = [
|
|
951
951
|
{ x: 0, y: s, radius: c },
|
|
952
952
|
{ x: 0, y: t - s, radius: Math.hypot(c, t) }
|
|
953
|
-
], r = Number.EPSILON * Math.max(c, t, 1) * 8, a = (p, u,
|
|
953
|
+
], r = Number.EPSILON * Math.max(c, t, 1) * 8, a = (p, u, m = r) => Math.hypot(p.x - u.x, p.y - u.y) <= u.radius + m;
|
|
954
954
|
if (n.every((p) => a(o, p, 0))) return o;
|
|
955
955
|
const l = [
|
|
956
956
|
{ x: c, y: s },
|
|
957
957
|
{ x: -c, y: s }
|
|
958
958
|
];
|
|
959
959
|
for (const p of n) {
|
|
960
|
-
const u = o.x - p.x,
|
|
961
|
-
if (
|
|
962
|
-
const f = Math.hypot(u /
|
|
963
|
-
x: p.x + u /
|
|
964
|
-
y: p.y +
|
|
960
|
+
const u = o.x - p.x, m = o.y - p.y, g = Math.max(Math.abs(u), Math.abs(m));
|
|
961
|
+
if (g === 0) continue;
|
|
962
|
+
const f = Math.hypot(u / g, m / g), b = {
|
|
963
|
+
x: p.x + u / g * p.radius / f,
|
|
964
|
+
y: p.y + m / g * p.radius / f
|
|
965
965
|
};
|
|
966
966
|
n.every((k) => a(b, k)) && l.push(b);
|
|
967
967
|
}
|
|
@@ -982,14 +982,14 @@ function L(c, t, e, i) {
|
|
|
982
982
|
const s = F(c), o = F(t), n = i === "top" ? 0 : o, r = O(s, o, e, i), a = s - r.x, l = n - r.y, d = Math.hypot(a, l), h = d === 0 ? { x: 1, y: 0 } : { x: a / d, y: l / d }, p = {
|
|
983
983
|
x: (s + r.x) / 2,
|
|
984
984
|
y: (n + r.y) / 2
|
|
985
|
-
}, u = p.x * h.x + p.y * h.y,
|
|
985
|
+
}, u = p.x * h.x + p.y * h.y, m = [
|
|
986
986
|
1 - 2 * h.x * h.x,
|
|
987
987
|
-2 * h.x * h.y,
|
|
988
988
|
-2 * h.x * h.y,
|
|
989
989
|
1 - 2 * h.y * h.y,
|
|
990
990
|
2 * h.x * u,
|
|
991
991
|
2 * h.y * u
|
|
992
|
-
],
|
|
992
|
+
], g = [
|
|
993
993
|
{ x: 0, y: 0 },
|
|
994
994
|
{ x: s, y: 0 },
|
|
995
995
|
{ x: s, y: o },
|
|
@@ -997,9 +997,9 @@ function L(c, t, e, i) {
|
|
|
997
997
|
];
|
|
998
998
|
return {
|
|
999
999
|
destination: r,
|
|
1000
|
-
front: R(
|
|
1001
|
-
folded: R(
|
|
1002
|
-
reflection:
|
|
1000
|
+
front: R(g, h, p, -1),
|
|
1001
|
+
folded: R(g, h, p, 1),
|
|
1002
|
+
reflection: m,
|
|
1003
1003
|
normal: h,
|
|
1004
1004
|
midpoint: p,
|
|
1005
1005
|
strength: I(S((s - r.x) / (2 * s)))
|
|
@@ -1082,6 +1082,13 @@ class ct {
|
|
|
1082
1082
|
get isTurning() {
|
|
1083
1083
|
return this.flipPosition !== 0;
|
|
1084
1084
|
}
|
|
1085
|
+
/**
|
|
1086
|
+
* True while a drag or animation holds this leaf promoted
|
|
1087
|
+
* (a `beginFlip` without its matching `endFlip`).
|
|
1088
|
+
*/
|
|
1089
|
+
get isFlipping() {
|
|
1090
|
+
return this.flipRefCount > 0;
|
|
1091
|
+
}
|
|
1085
1092
|
get isCover() {
|
|
1086
1093
|
return this.isFirst || this.isLast;
|
|
1087
1094
|
}
|
|
@@ -1153,11 +1160,11 @@ class ct {
|
|
|
1153
1160
|
M(d);
|
|
1154
1161
|
return;
|
|
1155
1162
|
}
|
|
1156
|
-
const u = Math.min(p / a, 1),
|
|
1163
|
+
const u = Math.min(p / a, 1), m = lt(u), g = s + m * (t - s);
|
|
1157
1164
|
o && (this.manualFoldPoint = {
|
|
1158
|
-
x: o.x +
|
|
1159
|
-
y: o.y +
|
|
1160
|
-
}, u === 1 && (t === 0 || t === 1) && (this.manualFoldPoint = void 0)), this.flipPosition = Math.max(0, Math.min(1,
|
|
1165
|
+
x: o.x + m * (n.x - o.x),
|
|
1166
|
+
y: o.y + m * (n.y - o.y)
|
|
1167
|
+
}, u === 1 && (t === 0 || t === 1) && (this.manualFoldPoint = void 0)), this.flipPosition = Math.max(0, Math.min(1, g)), this.applyTransform(g), u < 1 ? M(d) : (this.currentAnimation = null, this.targetFlipPosition = null, this.manualNeedsSettlement = !1, (this.flipPosition === 0 || this.flipPosition === 1) && this.onTurned(this.flipPosition === 1 ? v.Forward : v.Backward), this.endFlip(), i());
|
|
1161
1168
|
};
|
|
1162
1169
|
M(d);
|
|
1163
1170
|
}), this.currentAnimation);
|
|
@@ -1192,7 +1199,7 @@ class ct {
|
|
|
1192
1199
|
const u = this.bookProperties.isLTR;
|
|
1193
1200
|
if (!h) return;
|
|
1194
1201
|
h.classList.remove("page--folded"), h.style.clipPath = "", h.style.removeProperty("--fold-shading");
|
|
1195
|
-
const
|
|
1202
|
+
const m = p % 2 + 1 === 1, f = `${m ? u ? e > 0.5 ? 180 - e * 180 : -e * 180 : e > 0.5 ? -(180 - e * 180) : e * 180 : u ? e < 0.5 ? -e * 180 : 180 - e * 180 : e < 0.5 ? e * 180 : -(180 - e * 180)}deg`, b = `${m ? u ? "100%" : "-100%" : "0px"}`, k = m ? e > 0.5 ? -1 : 1 : e < 0.5 ? -1 : 1, y = m ? u ? "left" : "right" : u ? "right" : "left";
|
|
1196
1203
|
if (h.style.transform = `translateX(${b})rotateY(${f})scaleX(${k})`, h.style.transformOrigin = y, h.style.zIndex = this.getSurfaceZIndex(h, e, p, !1), i) {
|
|
1197
1204
|
const x = y === "left" ? "right" : "left";
|
|
1198
1205
|
h.style.setProperty("--inner-shadow-shadow", l.toFixed(3)), h.style.setProperty("--inner-shadow-highlight", d.toFixed(3)), h.style.setProperty("--inner-shadow-edge", x);
|
|
@@ -1223,18 +1230,18 @@ class ct {
|
|
|
1223
1230
|
o ? 1 - i : i,
|
|
1224
1231
|
this.foldOrigin < 0.5 ? "top" : "bottom",
|
|
1225
1232
|
this.foldPointer - this.foldOrigin
|
|
1226
|
-
), [r, a, l, d, h, p] = n.reflection, u = o ? !this.bookProperties.isLTR : this.bookProperties.isLTR,
|
|
1227
|
-
for (let
|
|
1228
|
-
const f = this.pages[
|
|
1233
|
+
), [r, a, l, d, h, p] = n.reflection, u = o ? !this.bookProperties.isLTR : this.bookProperties.isLTR, m = o ? 0 : u ? t : -t;
|
|
1234
|
+
for (let g = 0; g < this.pages.length; g++) {
|
|
1235
|
+
const f = this.pages[g];
|
|
1229
1236
|
if (!f) continue;
|
|
1230
|
-
const b =
|
|
1237
|
+
const b = g === (o ? 1 : 0), k = b ? !u : u, y = (b ? n.front : n.folded).map((x) => ({
|
|
1231
1238
|
x: k ? t - x.x : x.x,
|
|
1232
1239
|
y: x.y
|
|
1233
1240
|
}));
|
|
1234
|
-
f.classList.add("page--folded"), f.style.transformOrigin = "0px 0px", f.style.transform = b ? `translateX(${
|
|
1241
|
+
f.classList.add("page--folded"), f.style.transformOrigin = "0px 0px", f.style.transform = b ? `translateX(${m}px)` : u ? `matrix(${-r}, ${-a}, ${l}, ${d}, ${m + r * t + h}, ${a * t + p})` : `matrix(${-r}, ${a}, ${-l}, ${d}, ${m + t - h}, ${p})`, f.style.clipPath = y.length < 3 ? "polygon(0px 0px, 0px 0px, 0px 0px)" : `polygon(${y.map((x) => `${x.x.toFixed(3)}px ${x.y.toFixed(3)}px`).join(", ")})`, f.style.zIndex = this.getSurfaceZIndex(
|
|
1235
1242
|
f,
|
|
1236
1243
|
i,
|
|
1237
|
-
o ? 1 -
|
|
1244
|
+
o ? 1 - g : g,
|
|
1238
1245
|
!0
|
|
1239
1246
|
), this.bookProperties.pageShadow && this.applyCreaseShading(
|
|
1240
1247
|
f,
|
|
@@ -1250,10 +1257,10 @@ class ct {
|
|
|
1250
1257
|
this.reportTransform(t, e, i, n, o);
|
|
1251
1258
|
}
|
|
1252
1259
|
applyCreaseShading(t, e, i, s, o, n, r, a) {
|
|
1253
|
-
const l = n ? -s.x : s.x, d = n ? e - o.x : o.x, h = Math.abs(l) * e + Math.abs(s.y) * i, p = Math.min(0, l * e) + Math.min(0, s.y * i), u = (l * d + s.y * o.y - p) / h * 100,
|
|
1260
|
+
const l = n ? -s.x : s.x, d = n ? e - o.x : o.x, h = Math.abs(l) * e + Math.abs(s.y) * i, p = Math.min(0, l * e) + Math.min(0, s.y * i), u = (l * d + s.y * o.y - p) / h * 100, m = Math.atan2(l, -s.y) * 180 / Math.PI, g = Math.min(18, 100 * Math.min(e * 0.12, 48) / h), f = (r * (a ? 0.24 : 0.3)).toFixed(3);
|
|
1254
1261
|
t.style.setProperty(
|
|
1255
1262
|
"--fold-shading",
|
|
1256
|
-
a ? `linear-gradient(${
|
|
1263
|
+
a ? `linear-gradient(${m}deg, transparent ${u - g}%, rgba(0,0,0,${f}) ${u}%, transparent ${u + 0.5}%)` : `linear-gradient(${m}deg, rgba(0,0,0,${f}) ${u}%, rgba(255,255,255,${(r * 0.35).toFixed(3)}) ${u + g * 0.3}%, transparent ${u + g}%)`
|
|
1257
1264
|
);
|
|
1258
1265
|
}
|
|
1259
1266
|
}
|
|
@@ -1475,7 +1482,7 @@ class w {
|
|
|
1475
1482
|
pointerType: f.pointerType || "mouse",
|
|
1476
1483
|
srcEvent: f
|
|
1477
1484
|
}), d = () => {
|
|
1478
|
-
s.removeEventListener("pointermove", p), s.removeEventListener("pointerup", u), s.removeEventListener("pointercancel",
|
|
1485
|
+
s.removeEventListener("pointermove", p), s.removeEventListener("pointerup", u), s.removeEventListener("pointercancel", g), o?.removeEventListener("blur", m), this.cancelBookmarkPointerDrag = void 0;
|
|
1479
1486
|
}, h = (f, b) => {
|
|
1480
1487
|
d(), n && (f.timeStamp - r.timeStamp > 50 && (a = 0), e.dataset.bookmarkDragged = "true", i ? this.onDragEnd(l(f), b) : this._suppressNextClick = !0), this.touchDirectionLock = "none";
|
|
1481
1488
|
}, p = (f) => {
|
|
@@ -1494,10 +1501,10 @@ class w {
|
|
|
1494
1501
|
}
|
|
1495
1502
|
}, u = (f) => {
|
|
1496
1503
|
f.pointerId === t.pointerId && h(f, !1);
|
|
1497
|
-
},
|
|
1498
|
-
f.pointerId === t.pointerId &&
|
|
1504
|
+
}, m = () => h(r, !0), g = (f) => {
|
|
1505
|
+
f.pointerId === t.pointerId && m();
|
|
1499
1506
|
};
|
|
1500
|
-
this.cancelBookmarkPointerDrag =
|
|
1507
|
+
this.cancelBookmarkPointerDrag = m, s.addEventListener("pointermove", p, { passive: !1 }), s.addEventListener("pointerup", u), s.addEventListener("pointercancel", g), o?.addEventListener("blur", m);
|
|
1501
1508
|
};
|
|
1502
1509
|
/** Download config (handlers and filename hints). Used by toolbar. */
|
|
1503
1510
|
getDownloadConfig() {
|
|
@@ -1570,10 +1577,10 @@ class w {
|
|
|
1570
1577
|
this.pageElements.forEach((a, l) => {
|
|
1571
1578
|
a.dataset.pageIndex = l.toString(), this.configurePageScrollport(a, l), a.dataset.pageSemanticName = this.pageSemantics?.indexToSemanticName(l) ?? "", a.dataset.pageTitle = this.pageSemantics?.indexToTitle(l) ?? "", a.dataset.isCoverPage = n.has(l) ? "1" : "";
|
|
1572
1579
|
}), this.recalculateSizes(), this.pageElements.forEach((a, l) => {
|
|
1573
|
-
const d = Math.floor(l / 2), h = (l + 1) % 2 === 1, p = this.initialTurnedLeaves.has(d), u = this.initialTurnedLeaves.size > 0 ? Math.max(...this.initialTurnedLeaves) + 1 : 0,
|
|
1580
|
+
const d = Math.floor(l / 2), h = (l + 1) % 2 === 1, p = this.initialTurnedLeaves.has(d), u = this.initialTurnedLeaves.size > 0 ? Math.max(...this.initialTurnedLeaves) + 1 : 0, m = d === u || d === u - 1 && p;
|
|
1574
1581
|
if (a.classList.add(
|
|
1575
1582
|
h ? "odd" : "even",
|
|
1576
|
-
...
|
|
1583
|
+
...m ? ["current-page"] : []
|
|
1577
1584
|
), h)
|
|
1578
1585
|
this.leaves[d] = new ct(
|
|
1579
1586
|
d,
|
|
@@ -1586,8 +1593,8 @@ class w {
|
|
|
1586
1593
|
pageShadow: this.pageShadow,
|
|
1587
1594
|
snapshotDuringFlip: this.snapshotDuringFlip
|
|
1588
1595
|
},
|
|
1589
|
-
(
|
|
1590
|
-
const f =
|
|
1596
|
+
(g) => {
|
|
1597
|
+
const f = g === v.Forward ? l + 2 === this.pagesCount ? [l + 1] : [l + 1, l + 2] : l === 0 ? [l] : [l - 1, l];
|
|
1591
1598
|
if (this.prevVisiblePageIndices && this.prevVisiblePageIndices.length === f.length && f.every((k, y) => k === this.prevVisiblePageIndices?.[y]))
|
|
1592
1599
|
return;
|
|
1593
1600
|
const b = this.prevVisiblePageIndices;
|
|
@@ -1596,8 +1603,8 @@ class w {
|
|
|
1596
1603
|
);
|
|
1597
1604
|
else {
|
|
1598
1605
|
this.leaves[d].pages[1] = a;
|
|
1599
|
-
const
|
|
1600
|
-
this.leaves[d].applyTransform(
|
|
1606
|
+
const g = p ? 1 : 0;
|
|
1607
|
+
this.leaves[d].applyTransform(g);
|
|
1601
1608
|
}
|
|
1602
1609
|
});
|
|
1603
1610
|
const r = this.initialTurnedLeaves.size > 0 ? Math.max(...this.initialTurnedLeaves) : -1;
|
|
@@ -1660,9 +1667,9 @@ class w {
|
|
|
1660
1667
|
r.add(Math.floor(l / 2));
|
|
1661
1668
|
}
|
|
1662
1669
|
for (let a = 0; a < t; a++) {
|
|
1663
|
-
const l = this.leaves[a], d = a >= o && a <= n,
|
|
1664
|
-
for (const
|
|
1665
|
-
|
|
1670
|
+
const l = this.leaves[a], d = a >= o && a <= n, h = r.has(a), p = this.activeFlips.has(a) || l.isFlipping, u = h || d || p;
|
|
1671
|
+
for (const m of l.pages)
|
|
1672
|
+
m && (m.style.display = u ? "" : "none", m.style.contentVisibility = u ? "visible" : "hidden");
|
|
1666
1673
|
}
|
|
1667
1674
|
}
|
|
1668
1675
|
fillDebugBar() {
|
|
@@ -1761,11 +1768,11 @@ class w {
|
|
|
1761
1768
|
cornerY: b < 0.5 ? 0 : 1,
|
|
1762
1769
|
delta: 0,
|
|
1763
1770
|
isDuringAutoFlip: !1
|
|
1764
|
-
}, this.activeFlips.set(f.index, i);
|
|
1771
|
+
}, this.activeFlips.set(f.index, i), this.updateLeavesBufferVisibility();
|
|
1765
1772
|
}
|
|
1766
1773
|
i.delta = r;
|
|
1767
|
-
const h = i.direction === v.Backward ? i.leaf.pages[1] ?? i.leaf.pages[0] : i.leaf.pages[0], p = Number.parseFloat(h.style.width), u = Number.parseFloat(h.style.height),
|
|
1768
|
-
if (
|
|
1774
|
+
const h = i.direction === v.Backward ? i.leaf.pages[1] ?? i.leaf.pages[0] : i.leaf.pages[0], p = Number.parseFloat(h.style.width), u = Number.parseFloat(h.style.height), m = Number.isFinite(p) && p > 0 && Number.isFinite(u) && u > 0, g = i.leaf.pages.some((f) => f?.dataset.isCoverPage === "1");
|
|
1775
|
+
if (m && !g && i.leaf.pages[1]) {
|
|
1769
1776
|
const f = Number.isFinite(t.center.y) && i.startingY !== void 0 ? t.center.y - i.startingY : 0;
|
|
1770
1777
|
i.leaf.setManualFold({
|
|
1771
1778
|
x: (i.direction === v.Forward ? 1 : -1) - r / p,
|
|
@@ -1849,12 +1856,12 @@ class w {
|
|
|
1849
1856
|
this.clearHoverShadow();
|
|
1850
1857
|
return;
|
|
1851
1858
|
}
|
|
1852
|
-
const d = r ? l.pages[0] : l.pages[1] ?? l.pages[0], h = Number.parseFloat(d.style.width), p = Number.parseFloat(d.style.height), u = Number.parseFloat(d.style.top),
|
|
1853
|
-
if (!Number.isFinite(
|
|
1859
|
+
const d = r ? l.pages[0] : l.pages[1] ?? l.pages[0], h = Number.parseFloat(d.style.width), p = Number.parseFloat(d.style.height), u = Number.parseFloat(d.style.top), m = n ? o + h - i : i - (o - h), g = h * ut;
|
|
1860
|
+
if (!Number.isFinite(m) || !Number.isFinite(s) || !Number.isFinite(p) || !Number.isFinite(u) || h <= 0 || p <= 0 || m < 0 || m > g || s < u || s > u + p) {
|
|
1854
1861
|
this.clearHoverShadow();
|
|
1855
1862
|
return;
|
|
1856
1863
|
}
|
|
1857
|
-
const b = (1 - Math.min(1,
|
|
1864
|
+
const b = (1 - Math.min(1, m / g)) * ft;
|
|
1858
1865
|
this.hoveredLeaf && this.hoveredLeaf !== l && this.hoveredLeaf.setHoverShadow(0), this.hoveredLeaf !== l && l.setFoldOrigin((s - u) / p), this.hoveredLeaf = l, l.setHoverShadow(b);
|
|
1859
1866
|
});
|
|
1860
1867
|
handleMouseLeave = () => {
|
|
@@ -1937,7 +1944,7 @@ class w {
|
|
|
1937
1944
|
delta: 0,
|
|
1938
1945
|
isDuringAutoFlip: !0
|
|
1939
1946
|
};
|
|
1940
|
-
this.activeFlips.set(t.index, e);
|
|
1947
|
+
this.activeFlips.set(t.index, e), this.updateLeavesBufferVisibility();
|
|
1941
1948
|
const i = this.currentPageIndex + 2;
|
|
1942
1949
|
this.lastFlipParams = this.buildPageFlipParams(i, "forward"), this.onPageFlipping && this.onPageFlipping(this.lastFlipParams);
|
|
1943
1950
|
try {
|
|
@@ -1963,7 +1970,7 @@ class w {
|
|
|
1963
1970
|
delta: 0,
|
|
1964
1971
|
isDuringAutoFlip: !0
|
|
1965
1972
|
};
|
|
1966
|
-
this.activeFlips.set(t.index, e);
|
|
1973
|
+
this.activeFlips.set(t.index, e), this.updateLeavesBufferVisibility();
|
|
1967
1974
|
const i = this.currentPageIndex - 2;
|
|
1968
1975
|
this.lastFlipParams = this.buildPageFlipParams(Math.max(0, i), "backward"), this.onPageFlipping && this.onPageFlipping(this.lastFlipParams);
|
|
1969
1976
|
try {
|