@react-pdf-kit/viewer 2.9.1 → 2.9.2
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/CanvasLayer-C3gb8EXu.js +116 -0
- package/dist/RPPages-BZwgKgfJ.js +717 -0
- package/dist/components/RPPages.js +1 -1
- package/dist/components/page/CanvasLayer.js +1 -1
- package/dist/components/page/RPPage.js +48 -56
- package/dist/contexts/RenderQueueProvider.js +27 -27
- package/dist/contexts/ZoomContext.js +89 -83
- package/dist/main.js +1 -1
- package/dist/types/utils/documentLayout.d.ts +1 -1
- package/dist/utils/documentLayout.js +44 -44
- package/dist/utils/hooks/useLicense.js +1 -1
- package/dist/utils/hooks/usePresentPage.js +9 -5
- package/package.json +1 -1
- package/dist/CanvasLayer-CJqCJ30J.js +0 -111
- package/dist/RPPages-cyO0Tn21.js +0 -690
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../CanvasLayer-
|
|
1
|
+
import { t as e } from "../../CanvasLayer-C3gb8EXu.js";
|
|
2
2
|
export { e as CanvasLayer };
|
|
@@ -4,91 +4,83 @@ import { usePagesRotateContext as n } from "../../contexts/PagesRotateContext.js
|
|
|
4
4
|
import { useLayerContext as r } from "../../contexts/LayerContext.js";
|
|
5
5
|
import { useLoaderContext as i } from "../../contexts/LoaderContext.js";
|
|
6
6
|
import { withRef as a } from "../../utils/withRef.js";
|
|
7
|
-
import { n as o, t as s } from "../../CanvasLayer-
|
|
7
|
+
import { n as o, t as s } from "../../CanvasLayer-C3gb8EXu.js";
|
|
8
8
|
import { t as c } from "../../TextLayer-Bp1CDIIa.js";
|
|
9
9
|
import { t as l } from "../../AnnotationLayer-oDu2B4X1.js";
|
|
10
10
|
import { t as u } from "../../TextHighlightLayer-3vIZbRyL.js";
|
|
11
11
|
import { CustomElement as d } from "./CustomElement.js";
|
|
12
|
-
import { useCallback as f,
|
|
13
|
-
import { jsx as
|
|
12
|
+
import { useCallback as f, useImperativeHandle as p, useMemo as m, useRef as h, useState as g } from "react";
|
|
13
|
+
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
14
14
|
//#region lib/components/page/RPPage.tsx
|
|
15
|
-
var
|
|
16
|
-
let { pageNumber:
|
|
15
|
+
var y = a((a, y) => {
|
|
16
|
+
let { pageNumber: b, style: x, ...S } = a, { pages: C } = e(), { pageRotate: w } = n(), { textLayer: T } = r(), { currentZoom: E, targetZoom: D } = t(), { LoaderImageComponent: O } = i(), k = C.get(b), [A, j] = g(!1), M = h(null);
|
|
17
|
+
p(y, () => M.current);
|
|
18
|
+
let N = k ? w[b] ?? k.defaultRotation ?? 0 : 0, P = m(() => k ? k.page.getViewport({
|
|
19
|
+
scale: 1,
|
|
20
|
+
rotation: N
|
|
21
|
+
}) : {
|
|
17
22
|
width: 0,
|
|
18
23
|
height: 0
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
p(() => {
|
|
23
|
-
w && (A.current = w.get(x), A.current && F(A.current.page.getViewport({
|
|
24
|
-
scale: 1,
|
|
25
|
-
rotation: I
|
|
26
|
-
})));
|
|
27
|
-
}, [
|
|
28
|
-
w,
|
|
29
|
-
x,
|
|
30
|
-
I
|
|
31
|
-
]);
|
|
32
|
-
let L = h(() => ({
|
|
33
|
-
width: P.width * (O || D || 1),
|
|
34
|
-
height: P.height * (O || D || 1)
|
|
24
|
+
}, [k, N]), F = m(() => ({
|
|
25
|
+
width: P.width * (D || E || 1),
|
|
26
|
+
height: P.height * (D || E || 1)
|
|
35
27
|
}), [
|
|
36
28
|
P,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
]),
|
|
40
|
-
switch (
|
|
41
|
-
case 90: return `${
|
|
29
|
+
D,
|
|
30
|
+
E
|
|
31
|
+
]), I = m(() => {
|
|
32
|
+
switch (N) {
|
|
33
|
+
case 90: return `${F.width / 2}px ${F.width / 2}px`;
|
|
42
34
|
case -90:
|
|
43
|
-
case 270: return `${
|
|
35
|
+
case 270: return `${F.height / 2}px ${F.height / 2}px`;
|
|
44
36
|
default: return "center";
|
|
45
37
|
}
|
|
46
|
-
}, [
|
|
47
|
-
|
|
48
|
-
}, []),
|
|
49
|
-
|
|
38
|
+
}, [N, F]), L = m(() => !E || !D ? 1 : D / E, [E, D]), R = f((e) => {
|
|
39
|
+
j(!e.hasRenderedBefore);
|
|
40
|
+
}, []), z = f(() => {
|
|
41
|
+
j(!1);
|
|
50
42
|
}, []);
|
|
51
|
-
return /* @__PURE__ */
|
|
52
|
-
ref:
|
|
53
|
-
id: `page-${
|
|
54
|
-
"data-rp": `page-${
|
|
55
|
-
...
|
|
43
|
+
return /* @__PURE__ */ _("div", {
|
|
44
|
+
ref: M,
|
|
45
|
+
id: `page-${b}`,
|
|
46
|
+
"data-rp": `page-${b}`,
|
|
47
|
+
...S,
|
|
56
48
|
style: {
|
|
57
|
-
...
|
|
58
|
-
"--rp-rotate": `${
|
|
59
|
-
"--rp-page-rotate-translate": `${
|
|
49
|
+
...x,
|
|
50
|
+
"--rp-rotate": `${N}deg`,
|
|
51
|
+
"--rp-page-rotate-translate": `${I}`,
|
|
60
52
|
"--user-unit": P.userUnit || 1,
|
|
61
|
-
"--scale-factor":
|
|
62
|
-
"--rp-canvas-scale-ratio":
|
|
53
|
+
"--scale-factor": D || E,
|
|
54
|
+
"--rp-canvas-scale-ratio": L,
|
|
63
55
|
"--total-scale-factor": "calc(var(--scale-factor) * var(--user-unit))"
|
|
64
56
|
},
|
|
65
57
|
className: o["rp-page-wrapper"],
|
|
66
|
-
children: /* @__PURE__ */
|
|
58
|
+
children: /* @__PURE__ */ v("div", {
|
|
67
59
|
style: {
|
|
68
|
-
width: `${
|
|
69
|
-
height: `${
|
|
60
|
+
width: `${F.width}px`,
|
|
61
|
+
height: `${F.height}px`
|
|
70
62
|
},
|
|
71
63
|
className: o["rp-page"],
|
|
72
64
|
children: [
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
onLoading:
|
|
75
|
-
onLoaded:
|
|
76
|
-
pageNumber:
|
|
65
|
+
/* @__PURE__ */ _(s, {
|
|
66
|
+
onLoading: R,
|
|
67
|
+
onLoaded: z,
|
|
68
|
+
pageNumber: b
|
|
77
69
|
}),
|
|
78
|
-
|
|
70
|
+
A && O && /* @__PURE__ */ _("div", {
|
|
79
71
|
className: o["rp-loader-wrapper"],
|
|
80
|
-
children: /* @__PURE__ */
|
|
72
|
+
children: /* @__PURE__ */ _(O, {})
|
|
81
73
|
}),
|
|
82
|
-
/* @__PURE__ */
|
|
83
|
-
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
pageNumber:
|
|
74
|
+
/* @__PURE__ */ _(d, { pageNumber: b }),
|
|
75
|
+
T && /* @__PURE__ */ _(c, { pageNumber: b }),
|
|
76
|
+
/* @__PURE__ */ _(u, {
|
|
77
|
+
pageNumber: b,
|
|
86
78
|
viewport: P
|
|
87
79
|
}),
|
|
88
|
-
/* @__PURE__ */
|
|
80
|
+
/* @__PURE__ */ _(l, { pageNumber: b })
|
|
89
81
|
]
|
|
90
82
|
})
|
|
91
83
|
});
|
|
92
84
|
});
|
|
93
85
|
//#endregion
|
|
94
|
-
export {
|
|
86
|
+
export { y as RPPage };
|
|
@@ -6,60 +6,60 @@ import { renderPage as i } from "../utils/renderPage.js";
|
|
|
6
6
|
import { createContext as a, useCallback as o, useContext as s, useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
7
7
|
import { jsx as f } from "react/jsx-runtime";
|
|
8
8
|
//#region lib/contexts/RenderQueueProvider.tsx
|
|
9
|
-
var p = a(null), m = ({ children: a }) => {
|
|
10
|
-
let s = u(!1),
|
|
11
|
-
|
|
9
|
+
var p = a(null), m = (e, t) => t.destroyed ? !0 : e instanceof Error ? e.message === "Worker was destroyed" || e.message === "Worker was destroyed." || e.message === "Transport destroyed" : !1, h = ({ children: a }) => {
|
|
10
|
+
let s = u(!1), h = u(/* @__PURE__ */ new Map()), [g, _] = d([]), v = o((e) => {
|
|
11
|
+
_((t) => [...t, {
|
|
12
12
|
id: e.page.pageNumber.toString(),
|
|
13
13
|
data: e,
|
|
14
14
|
priority: 0
|
|
15
15
|
}]);
|
|
16
|
-
}, []),
|
|
16
|
+
}, []), y = l(() => new r(v), [v]), { focusedPage: b } = n(), { pdf: x } = t(), S = u(x);
|
|
17
17
|
c(() => {
|
|
18
|
-
|
|
19
|
-
}, [
|
|
20
|
-
let
|
|
18
|
+
S.current = x;
|
|
19
|
+
}, [x]);
|
|
20
|
+
let C = o((t) => {
|
|
21
21
|
s.current = !0;
|
|
22
|
-
let n =
|
|
23
|
-
n && (n.cancel(),
|
|
22
|
+
let n = h.current.get(t.id);
|
|
23
|
+
n && (n.cancel(), h.current.delete(t.id));
|
|
24
24
|
let r;
|
|
25
25
|
try {
|
|
26
26
|
r = i(t.data.page, t.data.canvasElem, t.data.options);
|
|
27
|
-
} catch {
|
|
28
|
-
return t.data.onRenderTask?.(null), Promise.resolve();
|
|
27
|
+
} catch (e) {
|
|
28
|
+
return m(e, t.data.page) || console.error(`Error rendering page ${t.data.page.pageNumber}:`, e), t.data.onRenderTask?.(null), Promise.resolve();
|
|
29
29
|
}
|
|
30
|
-
return
|
|
30
|
+
return h.current.set(t.id, r), t.data.onRenderTask?.(r), e(S.current, r.promise).then(() => {
|
|
31
31
|
t.data.canvasElem.hidden = !1, t.data.onLoaded && t.data.onLoaded();
|
|
32
32
|
}).catch((e) => {
|
|
33
33
|
e.name !== "RenderingCancelledException" && console.error(`Error rendering page ${t.data.page.pageNumber}:`, e);
|
|
34
34
|
}).finally(() => {
|
|
35
|
-
|
|
35
|
+
h.current.delete(t.id), t.data.onRenderTask?.(null);
|
|
36
36
|
});
|
|
37
37
|
}, []);
|
|
38
38
|
return c(() => {
|
|
39
|
-
|
|
40
|
-
}, [
|
|
41
|
-
|
|
42
|
-
}, [
|
|
43
|
-
if (
|
|
39
|
+
h.current.forEach((e) => e.cancel()), h.current.clear(), y.clear(), _(y.peekAll());
|
|
40
|
+
}, [x, y]), c(() => {
|
|
41
|
+
b && (y.changePagePriority(`^page-${b}`, 0), y.changePagePriority(`^thumbnail-${b}`, 1));
|
|
42
|
+
}, [b]), c(() => {
|
|
43
|
+
if (y.isEmpty() || s.current) return;
|
|
44
44
|
let e = () => {
|
|
45
|
-
let t =
|
|
46
|
-
t ?
|
|
45
|
+
let t = y.dequeue();
|
|
46
|
+
t ? C(t).catch(() => {}).finally(() => {
|
|
47
47
|
e();
|
|
48
|
-
}) : (s.current = !1,
|
|
48
|
+
}) : (s.current = !1, _(y.peekAll()));
|
|
49
49
|
};
|
|
50
50
|
e();
|
|
51
51
|
}, [
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
y,
|
|
53
|
+
C,
|
|
54
|
+
g
|
|
55
55
|
]), /* @__PURE__ */ f(p.Provider, {
|
|
56
|
-
value:
|
|
56
|
+
value: y,
|
|
57
57
|
children: a
|
|
58
58
|
});
|
|
59
|
-
},
|
|
59
|
+
}, g = () => {
|
|
60
60
|
let e = s(p);
|
|
61
61
|
if (!e) throw Error("RenderQueue not found");
|
|
62
62
|
return e;
|
|
63
63
|
};
|
|
64
64
|
//#endregion
|
|
65
|
-
export { p as RenderQueueContext,
|
|
65
|
+
export { p as RenderQueueContext, h as RenderQueueProvider, g as useRenderQueue };
|
|
@@ -8,11 +8,11 @@ import { getZoomLevel as s } from "../utils/getZoomLevel.js";
|
|
|
8
8
|
import { useLayoutContainer as c } from "./LayoutContainerContext.js";
|
|
9
9
|
import { useRotationContext as ee } from "./RotationContext.js";
|
|
10
10
|
import { useGlobalCurrentPage as te } from "./GlobalCurrentPage.js";
|
|
11
|
-
import { useDebounce as
|
|
12
|
-
import { createContext as
|
|
13
|
-
import { jsx as
|
|
11
|
+
import { useDebounce as l } from "../utils/hooks/useDebounce.js";
|
|
12
|
+
import { createContext as u, useCallback as d, useContext as f, useEffect as p, useLayoutEffect as m, useMemo as h, useRef as g, useState as _ } from "react";
|
|
13
|
+
import { jsx as ne } from "react/jsx-runtime";
|
|
14
14
|
//#region lib/contexts/ZoomContext.tsx
|
|
15
|
-
var
|
|
15
|
+
var v = u({
|
|
16
16
|
zoomLevel: 100,
|
|
17
17
|
currentZoom: 1,
|
|
18
18
|
targetZoom: 1,
|
|
@@ -22,133 +22,139 @@ var g = l({
|
|
|
22
22
|
previousTargetZoom: null,
|
|
23
23
|
zoomTo: () => {},
|
|
24
24
|
setZoomLevel: () => {}
|
|
25
|
-
}),
|
|
26
|
-
let e =
|
|
25
|
+
}), y = () => {
|
|
26
|
+
let e = f(v);
|
|
27
27
|
return typeof e.currentZoom != "number" && t.warn("Please use this hooks inside children component of RPProvider"), e;
|
|
28
|
-
},
|
|
29
|
-
let { initialScale:
|
|
30
|
-
width:
|
|
31
|
-
height:
|
|
32
|
-
}),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
e ||= j.get(1);
|
|
36
|
-
let t = e?.page.getViewport({
|
|
28
|
+
}, b = ({ children: t }) => {
|
|
29
|
+
let { initialScale: u = e.PAGE_FIT } = r(), [f, y] = _(u), [b, x] = _(0), [S, re] = _(0), [C, w] = _(!1), [T, E] = _(null), [D, O] = _(null), [k, A] = _(null), j = g(0), M = g(0), { pages: N } = n(), { pagesRef: P } = c(), { viewMode: F } = i(), [ie, ae] = _({
|
|
30
|
+
width: P?.clientWidth || 0,
|
|
31
|
+
height: P?.clientHeight || 0
|
|
32
|
+
}), I = l(ie, 100), { rotate: L } = ee(), { currentPage: R } = te(), [z, oe] = _(R), B = g(), V = g(), H = g(), U = g({}), W = g(L), G = h(() => {
|
|
33
|
+
let e = N.get(z);
|
|
34
|
+
return e ||= N.get(1), e?.page.getViewport({
|
|
37
35
|
scale: 1,
|
|
38
|
-
rotation: e.defaultRotation +
|
|
39
|
-
});
|
|
40
|
-
t && JSON.stringify(t) !== JSON.stringify(z.current) && (z.current = t, R(t));
|
|
36
|
+
rotation: e.defaultRotation + L
|
|
37
|
+
}) ?? null;
|
|
41
38
|
}, [
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
])
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
} : null, [L, M]), q = p(() => {
|
|
39
|
+
N,
|
|
40
|
+
L,
|
|
41
|
+
z
|
|
42
|
+
]), K = d(() => G ? {
|
|
43
|
+
pageWidth: (G?.width || 0) + 8,
|
|
44
|
+
pageHeight: G?.height || 0,
|
|
45
|
+
clientWidth: P?.clientWidth || 0,
|
|
46
|
+
clientHeight: P?.clientHeight || 0
|
|
47
|
+
} : null, [G, P]), q = h(() => {
|
|
52
48
|
let e = K();
|
|
53
|
-
if (!
|
|
54
|
-
if (typeof
|
|
55
|
-
let { clientWidth: t, clientHeight: n, pageWidth: r, pageHeight: i } = e, o = s(
|
|
49
|
+
if (!I.width || !I.height || !e) return 0;
|
|
50
|
+
if (typeof f == "number") return Math.max(25, Math.min(f, a)) / 100;
|
|
51
|
+
let { clientWidth: t, clientHeight: n, pageWidth: r, pageHeight: i } = e, o = s(f, t, n, r, i, F) / 100;
|
|
56
52
|
return Math.max(25 / 100, Math.min(o, a / 100));
|
|
57
53
|
}, [
|
|
58
|
-
|
|
59
|
-
|
|
54
|
+
f,
|
|
55
|
+
I,
|
|
60
56
|
K,
|
|
61
|
-
|
|
62
|
-
]), J =
|
|
63
|
-
|
|
64
|
-
}, []), Y =
|
|
65
|
-
|
|
66
|
-
}, []), X =
|
|
57
|
+
F
|
|
58
|
+
]), J = d(() => {
|
|
59
|
+
B.current &&= (clearTimeout(B.current), void 0), V.current &&= (clearTimeout(V.current), void 0), H.current &&= (cancelAnimationFrame(H.current), void 0);
|
|
60
|
+
}, []), Y = d((e) => {
|
|
61
|
+
x(e), w(!1), E(null), O(null), A(null);
|
|
62
|
+
}, []), X = d((e, t = {}) => {
|
|
67
63
|
if (!e) return;
|
|
68
|
-
let n =
|
|
69
|
-
if (!(!(Math.abs(e -
|
|
70
|
-
if (J(),
|
|
64
|
+
let n = j.current === 0;
|
|
65
|
+
if (!(!(Math.abs(e - M.current) > 1e-10) && !n)) {
|
|
66
|
+
if (J(), E(t.origin ?? null), O(t.gesture ?? null), A(t.previousTargetZoom ?? M.current ?? j.current ?? null), M.current = e, re(e), n || t.immediate) {
|
|
71
67
|
Y(e);
|
|
72
68
|
return;
|
|
73
69
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}, o),
|
|
77
|
-
|
|
78
|
-
|
|
70
|
+
w(!0), V.current = setTimeout(() => {
|
|
71
|
+
B.current &&= (clearTimeout(B.current), void 0), H.current &&= (cancelAnimationFrame(H.current), void 0), V.current = void 0, Y(e);
|
|
72
|
+
}, o), H.current = requestAnimationFrame(() => {
|
|
73
|
+
H.current = void 0, B.current = setTimeout(() => {
|
|
74
|
+
B.current = void 0, V.current &&= (clearTimeout(V.current), void 0), Y(e);
|
|
79
75
|
}, 400);
|
|
80
76
|
});
|
|
81
77
|
}
|
|
82
78
|
}, [J, Y]);
|
|
83
|
-
|
|
79
|
+
m(() => {
|
|
84
80
|
if (!q) return;
|
|
85
|
-
let e =
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
81
|
+
let e = U.current;
|
|
82
|
+
U.current = {};
|
|
83
|
+
let t = W.current !== L && typeof f != "number";
|
|
84
|
+
W.current = L, X(q, t ? {
|
|
85
|
+
...e,
|
|
86
|
+
immediate: !0
|
|
87
|
+
} : e);
|
|
88
|
+
}, [
|
|
89
|
+
q,
|
|
90
|
+
L,
|
|
91
|
+
X,
|
|
92
|
+
f
|
|
93
|
+
]);
|
|
94
|
+
let Z = d((e) => {
|
|
89
95
|
if (typeof e == "number") return Math.max(25, Math.min(e, a)) / 100;
|
|
90
96
|
let t = K();
|
|
91
97
|
if (!t) return 0;
|
|
92
|
-
let { clientWidth: n, clientHeight: r, pageWidth: i, pageHeight: o } = t, c = s(e, n, r, i, o,
|
|
98
|
+
let { clientWidth: n, clientHeight: r, pageWidth: i, pageHeight: o } = t, c = s(e, n, r, i, o, F);
|
|
93
99
|
return Math.max(25, Math.min(c, a)) / 100;
|
|
94
|
-
}, [K,
|
|
95
|
-
|
|
100
|
+
}, [K, F]), Q = d((e, t = {}) => {
|
|
101
|
+
U.current = t, y(e), X(Z(e), t);
|
|
96
102
|
}, [Z, X]);
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}, [
|
|
100
|
-
|
|
101
|
-
}, [
|
|
103
|
+
p(() => {
|
|
104
|
+
S && (M.current = S);
|
|
105
|
+
}, [S]), p(() => {
|
|
106
|
+
b && (j.current = b);
|
|
107
|
+
}, [b]), p(() => () => {
|
|
102
108
|
J();
|
|
103
|
-
}, [J]),
|
|
104
|
-
oe(
|
|
105
|
-
}, [
|
|
109
|
+
}, [J]), p(() => {
|
|
110
|
+
oe(R);
|
|
111
|
+
}, [f]), p(() => {
|
|
106
112
|
let e = new ResizeObserver((e) => {
|
|
107
113
|
e.forEach((e) => {
|
|
108
|
-
|
|
114
|
+
ae({
|
|
109
115
|
width: e.contentRect.width,
|
|
110
116
|
height: e.contentRect.height
|
|
111
117
|
});
|
|
112
118
|
});
|
|
113
119
|
});
|
|
114
|
-
return
|
|
120
|
+
return P && e.observe(P), () => {
|
|
115
121
|
e.disconnect();
|
|
116
122
|
};
|
|
117
|
-
}, [
|
|
118
|
-
let $ =
|
|
123
|
+
}, [P]);
|
|
124
|
+
let $ = d((e) => {
|
|
119
125
|
let t = 0;
|
|
120
126
|
if (typeof e == "function") {
|
|
121
127
|
let n = K();
|
|
122
128
|
if (!n) return;
|
|
123
129
|
let { clientWidth: r, clientHeight: i, pageWidth: a, pageHeight: o } = n;
|
|
124
|
-
t = (t) => e(s(t, r, i, a, o,
|
|
130
|
+
t = (t) => e(s(t, r, i, a, o, F));
|
|
125
131
|
} else t = e;
|
|
126
|
-
t && (
|
|
127
|
-
}, [K,
|
|
128
|
-
zoomLevel:
|
|
129
|
-
currentZoom:
|
|
130
|
-
targetZoom:
|
|
131
|
-
isZooming:
|
|
132
|
-
zoomOrigin:
|
|
133
|
-
zoomGesture:
|
|
134
|
-
previousTargetZoom:
|
|
132
|
+
t && (U.current = {}, y(typeof t == "number" ? Math.max(25, Math.min(t, a)) : t));
|
|
133
|
+
}, [K, F]), se = h(() => ({
|
|
134
|
+
zoomLevel: f,
|
|
135
|
+
currentZoom: b,
|
|
136
|
+
targetZoom: S || b,
|
|
137
|
+
isZooming: C,
|
|
138
|
+
zoomOrigin: T,
|
|
139
|
+
zoomGesture: D,
|
|
140
|
+
previousTargetZoom: k,
|
|
135
141
|
zoomTo: Q,
|
|
136
142
|
setZoomLevel: $
|
|
137
143
|
}), [
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
x,
|
|
141
|
-
d,
|
|
144
|
+
b,
|
|
145
|
+
S,
|
|
142
146
|
C,
|
|
147
|
+
f,
|
|
143
148
|
T,
|
|
144
149
|
D,
|
|
150
|
+
k,
|
|
145
151
|
Q,
|
|
146
152
|
$
|
|
147
153
|
]);
|
|
148
|
-
return /* @__PURE__ */
|
|
154
|
+
return /* @__PURE__ */ ne(v.Provider, {
|
|
149
155
|
value: se,
|
|
150
156
|
children: t
|
|
151
157
|
});
|
|
152
158
|
};
|
|
153
159
|
//#endregion
|
|
154
|
-
export {
|
|
160
|
+
export { v as ZoomContext, b as ZoomProvider, y as useZoomContext };
|
package/dist/main.js
CHANGED
|
@@ -16,7 +16,7 @@ import { useHighlightContext as y } from "./contexts/HighlightContext.js";
|
|
|
16
16
|
import { useElementPageContext as b } from "./contexts/ElementPageContext.js";
|
|
17
17
|
import { useElementThumbnailContext as x } from "./contexts/ElementThumbnailContext.js";
|
|
18
18
|
import { RPProvider as S } from "./components/RPProvider.js";
|
|
19
|
-
import { t as C } from "./RPPages-
|
|
19
|
+
import { t as C } from "./RPPages-BZwgKgfJ.js";
|
|
20
20
|
import { useFileDownload as w } from "./utils/hooks/useFileDownload.js";
|
|
21
21
|
import { RPTheme as T } from "./components/RPTheme.js";
|
|
22
22
|
import { RPConfig as E } from "./components/RPConfig.js";
|
|
@@ -46,7 +46,7 @@ type BuildDocumentLayoutOptions = {
|
|
|
46
46
|
export declare const getPageGroupForPage: (pageNumber: number, viewMode: ViewMode, totalPages: number) => number[];
|
|
47
47
|
export declare const buildDocumentLayout: (options: BuildDocumentLayoutOptions) => DocumentLayout;
|
|
48
48
|
export declare const getPagePlacement: (layout: DocumentLayout, pageNumber: number) => DocumentPagePlacement | null;
|
|
49
|
-
export declare const getPageContentOffset: (pageBoxWidth: number,
|
|
49
|
+
export declare const getPageContentOffset: (pageBoxWidth: number, _pageBoxHeight: number, pageWidth: number, _pageHeight: number) => {
|
|
50
50
|
x: number;
|
|
51
51
|
y: number;
|
|
52
52
|
};
|