@react-pdf-kit/viewer 2.8.0-beta.1 → 2.8.0-beta.10
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/README.md +44 -30
- package/dist/{AnnotationLayer-C6UTOVmc.js → AnnotationLayer-CyOYh0Tw.js} +2 -2
- package/dist/CanvasLayer-CJqCJ30J.js +111 -0
- package/dist/{LoadingIndicator-Bzzf28Xv.js → LoadingIndicator-0E8WHnSN.js} +7 -7
- package/dist/MenuItem-lItnKNd5.js +31 -0
- package/dist/Paginate.module-DhE7N8AA.js +9 -0
- package/dist/PaginationContext-DIzsZhFd.js +194 -0
- package/dist/{PasswordModal-BeLyLUsu.js → PasswordModal-CxHFn0pB.js} +12 -12
- package/dist/RPLayout.module-BH5r8dDc.js +14 -0
- package/dist/RPPages-U8QNLlIa.js +686 -0
- package/dist/{RPTooltip-CXBVXusS.js → RPTooltip-QWwWh4HW.js} +123 -91
- package/dist/SearchTool.module-DY8Ucfb_.js +17 -0
- package/dist/{SkipLink-CdcjClGB.js → SkipLink-Dj83gZdk.js} +3 -3
- package/dist/{TextLayer-DWGFN9SF.js → TextLayer-D-V9kogG.js} +5 -5
- package/dist/{Thumbnail-BO3QHzxR.js → Thumbnail-BXMk0OWF.js} +6 -6
- package/dist/{Thumbnails-DyeBsQJT.js → Thumbnails-BIuN8LZ8.js} +2 -2
- package/dist/assets/AnnotationLayer.css +1 -1
- package/dist/assets/CanvasLayer.css +1 -0
- package/dist/assets/LoadingIndicator.css +1 -1
- package/dist/assets/MenuItem.css +1 -1
- package/dist/assets/Paginate.css +1 -1
- package/dist/assets/PasswordModal.css +1 -1
- package/dist/assets/RPLayout.css +1 -1
- package/dist/assets/RPPages.css +1 -1
- package/dist/assets/SearchTool.css +1 -1
- package/dist/assets/SkipLink.css +1 -1
- package/dist/assets/TextLayer.css +1 -1
- package/dist/assets/Thumbnail.css +1 -1
- package/dist/assets/style.js +1 -1
- package/dist/components/RPController.js +39 -39
- package/dist/components/RPPages.js +1 -1
- package/dist/components/RPProvider.js +1 -1
- package/dist/components/layout/LayoutContainer.js +6 -6
- package/dist/components/layout/LayoutWrapper.js +5 -5
- package/dist/components/layout/RPDefaultLayout.js +56 -55
- package/dist/components/layout/RPLayout.js +39 -38
- package/dist/components/layout/SkipLink.js +1 -1
- package/dist/components/layout/sidebar/RPSidebar.js +2 -2
- package/dist/components/layout/sidebar/Thumbnail.js +1 -1
- package/dist/components/layout/sidebar/Thumbnails.js +1 -1
- package/dist/components/layout/toolbar/DarkModeTool.js +1 -1
- package/dist/components/layout/toolbar/DocumentProperties.js +6 -6
- package/dist/components/layout/toolbar/FileDownloadTool.js +6 -6
- package/dist/components/layout/toolbar/FileUploadTool.js +6 -6
- package/dist/components/layout/toolbar/FullScreenTool.js +9 -8
- package/dist/components/layout/toolbar/MenuItem.js +1 -1
- package/dist/components/layout/toolbar/MostPageTool.js +23 -29
- package/dist/components/layout/toolbar/OtherTool.js +1 -1
- package/dist/components/layout/toolbar/Paginate.js +18 -3
- package/dist/components/layout/toolbar/PrintTool.js +6 -6
- package/dist/components/layout/toolbar/RPMenuItem.js +2 -2
- package/dist/components/layout/toolbar/RPMoreOptions.js +1 -1
- package/dist/components/layout/toolbar/RPToolbar.js +1 -1
- package/dist/components/layout/toolbar/RotateTool.js +10 -10
- package/dist/components/layout/toolbar/ScrollModeTool.js +17 -17
- package/dist/components/layout/toolbar/SearchCloseButton.js +2 -2
- package/dist/components/layout/toolbar/SearchResultNavigator.js +2 -2
- package/dist/components/layout/toolbar/SearchTool.js +133 -121
- package/dist/components/layout/toolbar/SelectionModeTool.js +10 -10
- package/dist/components/layout/toolbar/ThumbnailTool.js +1 -1
- package/dist/components/layout/toolbar/ToolbarCustom.js +2 -2
- package/dist/components/layout/toolbar/ToolbarDefault.js +2 -2
- package/dist/components/layout/toolbar/ViewModeTool.js +16 -16
- package/dist/components/layout/toolbar/ZoomTool.js +82 -80
- package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +1 -1
- package/dist/components/layout/toolbar/tools/DualPageTool.js +1 -1
- package/dist/components/layout/toolbar/tools/DualPageWithCoverTool.js +1 -1
- package/dist/components/layout/toolbar/tools/FileDownloadTool.js +1 -1
- package/dist/components/layout/toolbar/tools/FileUploadTool.js +1 -1
- package/dist/components/layout/toolbar/tools/FirstPageTool.js +1 -1
- package/dist/components/layout/toolbar/tools/FullScreenTool.js +1 -1
- package/dist/components/layout/toolbar/tools/HorizontalScrollingTool.js +3 -3
- package/dist/components/layout/toolbar/tools/InputPageTool.js +36 -25
- package/dist/components/layout/toolbar/tools/LastPageTool.js +1 -1
- package/dist/components/layout/toolbar/tools/NextPageTool.js +2 -2
- package/dist/components/layout/toolbar/tools/PageScrollingTool.js +1 -1
- package/dist/components/layout/toolbar/tools/PreviousPageTool.js +2 -2
- package/dist/components/layout/toolbar/tools/PrintTool.js +1 -1
- package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +1 -1
- package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +1 -1
- package/dist/components/layout/toolbar/tools/SelectionModeSwitcherTool.js +1 -1
- package/dist/components/layout/toolbar/tools/SinglePageTool.js +1 -1
- package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +1 -1
- package/dist/components/layout/toolbar/tools/ThumbnailTool.js +1 -1
- package/dist/components/layout/toolbar/tools/VerticalScrollingTool.js +1 -1
- package/dist/components/layout/toolbar/tools/ZoomInTool.js +25 -23
- package/dist/components/layout/toolbar/tools/ZoomLevelDisplay.js +1 -1
- package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +2 -2
- package/dist/components/layout/toolbar/tools/ZoomOutTool.js +25 -23
- package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +3 -3
- package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +7 -7
- package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +2 -2
- package/dist/components/page/AnnotationLayer.js +1 -1
- package/dist/components/page/CanvasLayer.js +2 -48
- package/dist/components/page/DualPage.js +2 -2
- package/dist/components/page/DualPageWithCover.js +2 -2
- package/dist/components/page/RPPage.js +94 -2
- package/dist/components/page/SinglePage.js +2 -2
- package/dist/components/page/TextHighlightLayer.js +1 -1
- package/dist/components/page/TextLayer.js +1 -1
- package/dist/components/ui/LoadingIndicator.js +1 -1
- package/dist/components/ui/PasswordModal.js +1 -1
- package/dist/components/ui/RPTooltip.js +1 -1
- package/dist/contexts/DimensionPagesContext.js +38 -22
- package/dist/contexts/ElementPageContext.js +46 -39
- package/dist/contexts/ElementThumbnailContext.js +1 -1
- package/dist/contexts/PaginationContext.js +1 -1
- package/dist/contexts/RenderQueueProvider.js +26 -18
- package/dist/contexts/RenderedPagesCache.js +32 -13
- package/dist/contexts/VirtualScrollContext.js +10 -13
- package/dist/contexts/ZoomContext.js +119 -61
- package/dist/{de_DE--0LF-SJR.js → de_DE-x4Z-jQrz.js} +54 -6
- package/dist/{main-0RC2E65p.js → main-DCzVrq0G.js} +2 -2
- package/dist/main.js +4 -4
- package/dist/style-CJtyyrJx.js +5 -0
- package/dist/types/components/page/CanvasLayer.d.ts +4 -1
- package/dist/types/components/ui/RPTooltip.d.ts +3 -2
- package/dist/types/contexts/RenderQueueProvider.d.ts +2 -0
- package/dist/types/contexts/RenderedPagesCache.d.ts +3 -0
- package/dist/types/contexts/VirtualScrollContext.d.ts +0 -3
- package/dist/types/locales/de_DE.json.d.ts +11 -2
- package/dist/types/locales/en_US.json.d.ts +11 -2
- package/dist/types/locales/it_IT.json.d.ts +11 -2
- package/dist/types/locales/pt_PT.json.d.ts +11 -2
- package/dist/types/locales/th_TH.json.d.ts +11 -2
- package/dist/types/locales/zh_CN.json.d.ts +11 -2
- package/dist/types/utils/Queue.d.ts +1 -0
- package/dist/types/utils/const.d.ts +3 -0
- package/dist/types/utils/constants.d.ts +9 -0
- package/dist/types/utils/documentLayout.d.ts +60 -0
- package/dist/types/utils/hooks/usePinch.d.ts +14 -1
- package/dist/types/utils/hooks/usePresentPage.d.ts +2 -2
- package/dist/types/utils/hooks/useZoomOrigin.d.ts +4 -0
- package/dist/types/utils/types.d.ts +24 -2
- package/dist/types/utils/zoom.d.ts +2 -0
- package/dist/utils/Queue.js +5 -0
- package/dist/utils/const.js +2 -2
- package/dist/utils/constants.js +2 -2
- package/dist/utils/documentLayout.js +141 -0
- package/dist/utils/hooks/useLicense.js +1 -1
- package/dist/utils/hooks/useLoadPdf.js +73 -63
- package/dist/utils/hooks/useLocalization.js +1 -1
- package/dist/utils/hooks/usePaginate.js +1 -1
- package/dist/utils/hooks/usePinch.js +109 -56
- package/dist/utils/hooks/usePresentPage.js +33 -57
- package/dist/utils/hooks/useScrollToPage.js +1 -1
- package/dist/utils/hooks/useSearch.js +66 -67
- package/dist/utils/hooks/useZoomOrigin.js +37 -0
- package/dist/utils/renderPage.js +21 -14
- package/dist/utils/types.js +3 -3
- package/dist/utils/zoom.js +8 -2
- package/package.json +1 -1
- package/dist/MenuItem-9kCH_GQ0.js +0 -15
- package/dist/Paginate.module-B0GMw-MB.js +0 -8
- package/dist/PaginationContext-C5CJiEW-.js +0 -242
- package/dist/RPLayout.module-Vc3h4xxS.js +0 -14
- package/dist/RPPage-BsDixmqF.js +0 -91
- package/dist/RPPages-Cf-FDd0a.js +0 -1007
- package/dist/SearchTool.module-DUkVXfOn.js +0 -16
- package/dist/assets/RPPage.css +0 -1
- package/dist/contexts/VirtualGridContext.js +0 -18
- package/dist/style-BPQRJJJ7.js +0 -5
- package/dist/types/contexts/VirtualGridContext.d.ts +0 -9
- package/dist/types/utils/calculatePage.d.ts +0 -12
- package/dist/types/utils/hooks/useVirtualReactWindow.d.ts +0 -17
- package/dist/utils/calculatePage.js +0 -30
- package/dist/utils/hooks/useVirtualReactWindow.js +0 -86
- /package/dist/{TextHighlightLayer-BSVgBxR3.js → TextHighlightLayer-3vIZbRyL.js} +0 -0
|
@@ -1,66 +1,119 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MAX_ZOOM_SCALE as e } from "../constants.js";
|
|
2
2
|
import { useZoomContext as t } from "../../contexts/ZoomContext.js";
|
|
3
|
-
import {
|
|
3
|
+
import { getZoomOriginFromClientPoint as n } from "./useZoomOrigin.js";
|
|
4
|
+
import { useCallback as r, useEffect as i, useRef as a } from "react";
|
|
4
5
|
//#region lib/utils/hooks/usePinch.ts
|
|
5
|
-
var o = (
|
|
6
|
-
let {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
var o = () => 35 / (window.devicePixelRatio || 1), s = (s, c = {}) => {
|
|
7
|
+
let { targetZoom: l, zoomTo: u } = t(), { onBeforeZoom: d, onPinchEnd: f } = c, p = a(null), m = a(!1), h = a(!1), g = a(!1), _ = a(1), v = a(1), y = a(!1), b = a(!1), x = a(), S = a(l), C = a(null);
|
|
8
|
+
i(() => {
|
|
9
|
+
S.current = l;
|
|
10
|
+
}, [l]);
|
|
11
|
+
let w = r((e, t, n) => {
|
|
12
|
+
if (t === 1) return 1;
|
|
13
|
+
let r = n.current;
|
|
14
|
+
(r > 1 && t < 1 || r < 1 && t > 1) && (n.current = 1);
|
|
15
|
+
let i = Math.floor(e * t * n.current * 100) / (100 * e);
|
|
16
|
+
return n.current = t / i, i;
|
|
17
|
+
}, []), T = r((t, n, r) => {
|
|
18
|
+
let i = S.current || 1, a = 25 / 100, o = e / 100;
|
|
19
|
+
if (i >= o && t > 1 || i <= a && t < 1) return;
|
|
20
|
+
let s = Math.max(a, Math.min(o, Math.round(i * t * 100) / 100));
|
|
21
|
+
Math.abs(s - i) < 1e-10 || (d?.({
|
|
22
|
+
gesture: r,
|
|
23
|
+
previousScale: i,
|
|
24
|
+
nextScale: s,
|
|
25
|
+
origin: n
|
|
26
|
+
}), S.current = s, u(s * 100, {
|
|
27
|
+
origin: n,
|
|
28
|
+
gesture: r,
|
|
29
|
+
previousTargetZoom: i
|
|
30
|
+
}));
|
|
31
|
+
}, [d, u]), E = r((e, t) => n(s, e, t) ?? void 0, [s]), D = r(() => {
|
|
32
|
+
b.current || (y.current = !0, clearTimeout(x.current), x.current = setTimeout(() => {
|
|
33
|
+
y.current = !1;
|
|
34
|
+
}, 100));
|
|
35
|
+
}, []), O = r((e) => {
|
|
36
|
+
if (!e.ctrlKey) {
|
|
37
|
+
b.current = !1, g.current = !1;
|
|
38
|
+
return;
|
|
15
39
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
40
|
+
g.current || (v.current = 1), g.current = !0, b.current = !0, y.current = !1, clearTimeout(x.current), e.preventDefault();
|
|
41
|
+
let t = Math.exp(-e.deltaY / 100);
|
|
42
|
+
T(w(S.current || 1, t, v), E(e.clientX, e.clientY), "wheel");
|
|
43
|
+
}, [
|
|
44
|
+
w,
|
|
45
|
+
E,
|
|
46
|
+
T
|
|
47
|
+
]), k = (e) => Array.from(e.touches).sort((e, t) => e.identifier - t.identifier), A = r(() => {
|
|
48
|
+
!s || C.current || (C.current = {
|
|
49
|
+
touchAction: s.style.touchAction,
|
|
50
|
+
webkitUserSelect: s.style.webkitUserSelect,
|
|
51
|
+
overscrollBehavior: s.style.overscrollBehavior,
|
|
52
|
+
webkitOverflowScrolling: s.style.getPropertyValue("-webkit-overflow-scrolling")
|
|
53
|
+
}, s.style.touchAction = "none", s.style.webkitUserSelect = "none", s.style.overscrollBehavior = "contain", s.style.setProperty("-webkit-overflow-scrolling", "auto"));
|
|
54
|
+
}, [s]), j = r(() => {
|
|
55
|
+
!s || !C.current || (s.style.touchAction = C.current.touchAction, s.style.webkitUserSelect = C.current.webkitUserSelect, s.style.overscrollBehavior = C.current.overscrollBehavior, C.current.webkitOverflowScrolling ? s.style.setProperty("-webkit-overflow-scrolling", C.current.webkitOverflowScrolling) : s.style.removeProperty("-webkit-overflow-scrolling"), C.current = null);
|
|
56
|
+
}, [s]), M = r(() => {
|
|
57
|
+
if (!(m.current || p.current || h.current)) {
|
|
58
|
+
j();
|
|
34
59
|
return;
|
|
35
60
|
}
|
|
36
|
-
|
|
37
|
-
}, [f]), r(() => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
61
|
+
p.current = null, m.current = !1, h.current = !1, _.current = 1, j(), f?.();
|
|
62
|
+
}, [f, j]), N = r((e) => {
|
|
63
|
+
if (e.touches.length !== 2) {
|
|
64
|
+
M();
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
A(), e.preventDefault(), e.stopPropagation();
|
|
68
|
+
let [t, n] = k(e);
|
|
69
|
+
m.current = !0, _.current = 1, p.current = {
|
|
70
|
+
touch0ScreenX: t.screenX,
|
|
71
|
+
touch0ScreenY: t.screenY,
|
|
72
|
+
touch1ScreenX: n.screenX,
|
|
73
|
+
touch1ScreenY: n.screenY
|
|
74
|
+
}, h.current = !1;
|
|
75
|
+
}, [A, M]), P = r((e) => {
|
|
76
|
+
let t = p.current;
|
|
77
|
+
if (!t || e.touches.length !== 2) {
|
|
78
|
+
M();
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
e.preventDefault(), e.stopPropagation();
|
|
82
|
+
let [n, r] = k(e), i = t.touch1ScreenX - t.touch0ScreenX, a = t.touch1ScreenY - t.touch0ScreenY, s = r.screenX - n.screenX, c = r.screenY - n.screenY, l = Math.hypot(i, a) || 1, u = Math.hypot(s, c) || 1;
|
|
83
|
+
if (!h.current && Math.abs(l - u) <= o()) return;
|
|
84
|
+
if (t.touch0ScreenX = n.screenX, t.touch0ScreenY = n.screenY, t.touch1ScreenX = r.screenX, t.touch1ScreenY = r.screenY, !h.current) {
|
|
85
|
+
h.current = !0;
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
let d = u / l;
|
|
89
|
+
T(w(S.current || 1, d, _), E((n.clientX + r.clientX) / 2, (n.clientY + r.clientY) / 2), "touch");
|
|
90
|
+
}, [
|
|
91
|
+
w,
|
|
92
|
+
E,
|
|
93
|
+
M,
|
|
94
|
+
T
|
|
95
|
+
]), F = r((e) => {
|
|
96
|
+
e.touches.length >= 2 || (M(), v.current = 1);
|
|
97
|
+
}, [M]), I = r(() => {
|
|
98
|
+
M(), v.current = 1;
|
|
99
|
+
}, [M]), L = r(() => {
|
|
100
|
+
b.current = !1, g.current = !1, v.current = 1, y.current = !1, clearTimeout(x.current), M();
|
|
101
|
+
}, [M]);
|
|
102
|
+
i(() => {
|
|
103
|
+
if (s) return s.addEventListener("wheel", O, { passive: !1 }), s.addEventListener("scroll", D, { passive: !0 }), s.addEventListener("touchstart", N, { passive: !1 }), s.addEventListener("touchmove", P, { passive: !1 }), s.addEventListener("touchend", F, { passive: !1 }), s.addEventListener("touchcancel", I, { passive: !1 }), window.addEventListener("touchend", F, { passive: !1 }), window.addEventListener("touchcancel", I, { passive: !1 }), window.addEventListener("blur", L), () => {
|
|
104
|
+
j(), s.removeEventListener("wheel", O), s.removeEventListener("scroll", D), s.removeEventListener("touchstart", N), s.removeEventListener("touchmove", P), s.removeEventListener("touchend", F), s.removeEventListener("touchcancel", I), window.removeEventListener("touchend", F), window.removeEventListener("touchcancel", I), window.removeEventListener("blur", L), clearTimeout(x.current);
|
|
56
105
|
};
|
|
57
106
|
}, [
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
107
|
+
s,
|
|
108
|
+
D,
|
|
109
|
+
I,
|
|
110
|
+
F,
|
|
111
|
+
P,
|
|
112
|
+
N,
|
|
113
|
+
O,
|
|
114
|
+
L,
|
|
115
|
+
j
|
|
63
116
|
]);
|
|
64
117
|
};
|
|
65
118
|
//#endregion
|
|
66
|
-
export {
|
|
119
|
+
export { s as usePinch };
|
|
@@ -1,70 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { useSmoothScrollContext as i } from "../../contexts/SmoothScrollContext.js";
|
|
6
|
-
import { getGridDimension as a, getPositionFromPage as o } from "../calculatePage.js";
|
|
7
|
-
import { r as s } from "../../PaginationContext-C5CJiEW-.js";
|
|
8
|
-
import { useCallback as c, useEffect as l, useMemo as u, useRef as d, useState as f } from "react";
|
|
1
|
+
import { useDebounce as e } from "./useDebounce.js";
|
|
2
|
+
import { useSmoothScrollContext as t } from "../../contexts/SmoothScrollContext.js";
|
|
3
|
+
import { r as n } from "../../PaginationContext-DIzsZhFd.js";
|
|
4
|
+
import { useCallback as r, useEffect as i, useRef as a, useState as o } from "react";
|
|
9
5
|
//#region lib/utils/hooks/usePresentPage.ts
|
|
10
|
-
var
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
let [
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
startX: c,
|
|
26
|
-
startY: l,
|
|
27
|
-
endX: u,
|
|
28
|
-
endY: d
|
|
29
|
-
};
|
|
30
|
-
});
|
|
31
|
-
}, [
|
|
32
|
-
y,
|
|
33
|
-
b,
|
|
34
|
-
p,
|
|
35
|
-
m,
|
|
36
|
-
g
|
|
37
|
-
]);
|
|
38
|
-
l(() => {
|
|
39
|
-
E.length > 0 && !T.current && S.current(E[0].pageNumber), E[0]?.ratio && E.some((e) => e.pageNumber === T.current) && setTimeout(() => {
|
|
40
|
-
T.current = void 0;
|
|
41
|
-
}, 500);
|
|
42
|
-
}, [E]);
|
|
43
|
-
let O = c((e) => {
|
|
44
|
-
_.current && cancelAnimationFrame(_.current), _.current = requestAnimationFrame(() => {
|
|
6
|
+
var s = (s, c) => {
|
|
7
|
+
let l = a(), u = a(), { setFocusedPage: d } = n(), f = a(d);
|
|
8
|
+
f.current = d;
|
|
9
|
+
let [p, m] = o([]), { targetScrollPage: h } = t(), g = e(p, 0, 500);
|
|
10
|
+
i(() => {
|
|
11
|
+
g.length > 0 && !h.current && f.current(g[0].pageNumber);
|
|
12
|
+
let e = g[0]?.ratio, t = h.current;
|
|
13
|
+
e && g.some((e) => e.pageNumber === t) && (clearTimeout(u.current), u.current = setTimeout(() => {
|
|
14
|
+
h.current === t && (h.current = void 0);
|
|
15
|
+
}, 500));
|
|
16
|
+
}, [g, h]), i(() => () => {
|
|
17
|
+
clearTimeout(u.current), l.current && cancelAnimationFrame(l.current);
|
|
18
|
+
}, []);
|
|
19
|
+
let _ = r((e) => {
|
|
20
|
+
c && (l.current && cancelAnimationFrame(l.current), l.current = requestAnimationFrame(() => {
|
|
45
21
|
let t = e.target, n = {
|
|
46
|
-
startTop: t.scrollTop,
|
|
47
|
-
startLeft: t.scrollLeft,
|
|
48
|
-
endTop: t.scrollTop + t.clientHeight,
|
|
49
|
-
endLeft: t.scrollLeft + t.clientWidth
|
|
22
|
+
startTop: t.scrollTop - c.offsetTop,
|
|
23
|
+
startLeft: t.scrollLeft - c.offsetLeft,
|
|
24
|
+
endTop: t.scrollTop - c.offsetTop + t.clientHeight,
|
|
25
|
+
endLeft: t.scrollLeft - c.offsetLeft + t.clientWidth
|
|
50
26
|
};
|
|
51
|
-
|
|
52
|
-
let t = e.
|
|
27
|
+
m(c.pages.filter((e) => {
|
|
28
|
+
let t = e.left + e.width >= n.startLeft && e.top + e.height >= n.startTop, r = e.left <= n.endLeft && e.top <= n.endTop;
|
|
53
29
|
return t && r;
|
|
54
30
|
}).map((e) => {
|
|
55
|
-
let t =
|
|
31
|
+
let t = Math.max(n.startLeft, e.left), r = Math.max(n.startTop, e.top), i = Math.min(n.endLeft, e.left + e.width), a = Math.min(n.endTop, e.top + e.height), o = +(Math.max(0, i - t) * Math.max(0, a - r) / (e.width * e.height || 1) * 100).toFixed(2);
|
|
56
32
|
return {
|
|
57
33
|
pageNumber: e.pageNumber,
|
|
58
34
|
ratio: o
|
|
59
35
|
};
|
|
60
36
|
}).sort((e, t) => t.ratio - e.ratio));
|
|
61
|
-
});
|
|
62
|
-
}, [
|
|
63
|
-
|
|
64
|
-
if (
|
|
65
|
-
|
|
37
|
+
}));
|
|
38
|
+
}, [c]);
|
|
39
|
+
i(() => {
|
|
40
|
+
if (s) return s?.addEventListener("scroll", _), _({ target: s }), () => {
|
|
41
|
+
s?.removeEventListener("scroll", _);
|
|
66
42
|
};
|
|
67
|
-
}, [
|
|
43
|
+
}, [s, _]);
|
|
68
44
|
};
|
|
69
45
|
//#endregion
|
|
70
|
-
export {
|
|
46
|
+
export { s as usePresentPage };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e } from "../../PaginationContext-
|
|
1
|
+
import { a as e } from "../../PaginationContext-DIzsZhFd.js";
|
|
2
2
|
export { e as useScrollToPage };
|
|
@@ -1,81 +1,80 @@
|
|
|
1
|
-
import { ScrollMode as e
|
|
2
|
-
import { useDocumentContext as
|
|
3
|
-
import { useScrollModeContext as
|
|
4
|
-
import { useViewModeContext as
|
|
5
|
-
import { useVirtualScrollContext as
|
|
6
|
-
import { useLayoutContainer as
|
|
7
|
-
import { useZoomContext as
|
|
8
|
-
import { usePagesRotateContext as
|
|
9
|
-
import { useDimensionPagesContext as
|
|
10
|
-
import { useSmoothScrollContext as
|
|
11
|
-
import {
|
|
12
|
-
import { r as f } from "../../PaginationContext-
|
|
1
|
+
import { ScrollMode as e } from "../types.js";
|
|
2
|
+
import { useDocumentContext as t } from "../../contexts/RPDocumentContext.js";
|
|
3
|
+
import { useScrollModeContext as n } from "../../contexts/ScrollModeContext.js";
|
|
4
|
+
import { useViewModeContext as r } from "../../contexts/ViewModeContext.js";
|
|
5
|
+
import { useVirtualScrollContext as i } from "../../contexts/VirtualScrollContext.js";
|
|
6
|
+
import { useLayoutContainer as a } from "../../contexts/LayoutContainerContext.js";
|
|
7
|
+
import { useZoomContext as o } from "../../contexts/ZoomContext.js";
|
|
8
|
+
import { usePagesRotateContext as s } from "../../contexts/PagesRotateContext.js";
|
|
9
|
+
import { useDimensionPagesContext as c } from "../../contexts/DimensionPagesContext.js";
|
|
10
|
+
import { useSmoothScrollContext as l } from "../../contexts/SmoothScrollContext.js";
|
|
11
|
+
import { buildDocumentLayout as u, getPagePlacement as d } from "../documentLayout.js";
|
|
12
|
+
import { r as f } from "../../PaginationContext-DIzsZhFd.js";
|
|
13
13
|
import { findMatches as p } from "../highlight.js";
|
|
14
14
|
import { getWordPositionInPage as m } from "../getWordPositionInPage.js";
|
|
15
15
|
import { useCallback as h, useEffect as g, useMemo as _, useRef as v, useState as y } from "react";
|
|
16
16
|
//#region lib/utils/hooks/useSearch.ts
|
|
17
17
|
var b = (b = {}, x = "") => {
|
|
18
|
-
let [S, C] = y(x), [w, T] = y(!1), { pdf: E, pages: D } =
|
|
19
|
-
if (
|
|
20
|
-
let
|
|
21
|
-
if (!
|
|
22
|
-
let
|
|
23
|
-
if (!
|
|
24
|
-
let
|
|
25
|
-
if (
|
|
26
|
-
let
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
let
|
|
39
|
-
height: k[
|
|
40
|
-
width: O[
|
|
41
|
-
},
|
|
18
|
+
let [S, C] = y(x), [w, T] = y(!1), { pdf: E, pages: D } = t(), { widths: O, heights: k } = c(), A = v(!S), { currentZoom: j } = o(), [M, N] = y([]), { setFocusedPage: P } = f(), { viewMode: F } = r(), { pageRotate: I } = s(), [L, R] = y(0), { pageScrollElementRef: z, virtualScrollableElementRef: B } = i(), { scrollMode: V } = n(), { pagesRef: H } = a(), { scrollBehavior: U } = l(), W = v({}), G = v(0), K = _(() => L === 0 ? null : M[L - 1], [L, M]), q = _(() => M.length, [M]), J = h((t) => {
|
|
19
|
+
if (t === 0) return;
|
|
20
|
+
let n = M[t - 1];
|
|
21
|
+
if (!n || !D) return;
|
|
22
|
+
let r = B || z;
|
|
23
|
+
if (!r || !H) return;
|
|
24
|
+
let i = D.get(n.page);
|
|
25
|
+
if (V === e.PAGE_SCROLLING && P(n.page), !i) return;
|
|
26
|
+
let a = u({
|
|
27
|
+
pageDimensions: {
|
|
28
|
+
widths: O,
|
|
29
|
+
heights: k
|
|
30
|
+
},
|
|
31
|
+
viewportWidth: r.clientWidth,
|
|
32
|
+
viewportHeight: r.clientHeight,
|
|
33
|
+
scrollMode: V,
|
|
34
|
+
viewMode: F,
|
|
35
|
+
focusedPage: n.page
|
|
36
|
+
}), o = d(a, n.page);
|
|
37
|
+
if (!o) return;
|
|
38
|
+
let s = {
|
|
39
|
+
height: k[n.page - 1],
|
|
40
|
+
width: O[n.page - 1]
|
|
41
|
+
}, c = I[n.page], { leftInPage: l, topInPage: f } = m(s, H, n.rect, j, c), p = a.offsetLeft + o.left + l, h = a.offsetTop + o.top + f, g = {
|
|
42
42
|
left: Math.max(p, 0),
|
|
43
43
|
top: Math.max(h, 0)
|
|
44
44
|
};
|
|
45
|
-
|
|
45
|
+
r.scrollTo({
|
|
46
46
|
...g,
|
|
47
|
-
behavior:
|
|
47
|
+
behavior: U
|
|
48
48
|
});
|
|
49
49
|
}, [
|
|
50
50
|
D,
|
|
51
51
|
P,
|
|
52
52
|
O,
|
|
53
53
|
k,
|
|
54
|
-
H,
|
|
55
|
-
I,
|
|
56
|
-
F,
|
|
57
54
|
V,
|
|
55
|
+
F,
|
|
58
56
|
B,
|
|
59
|
-
|
|
57
|
+
z,
|
|
58
|
+
H,
|
|
60
59
|
M,
|
|
61
60
|
j,
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
I,
|
|
62
|
+
U
|
|
64
63
|
]);
|
|
65
64
|
g(() => {
|
|
66
|
-
|
|
67
|
-
}, [
|
|
68
|
-
let
|
|
69
|
-
|
|
65
|
+
L && J(L);
|
|
66
|
+
}, [L]);
|
|
67
|
+
let Y = h(() => {
|
|
68
|
+
R((e) => {
|
|
70
69
|
let t;
|
|
71
|
-
return t =
|
|
72
|
-
}),
|
|
73
|
-
}, [
|
|
74
|
-
|
|
70
|
+
return t = q ? e + 1 > q ? 1 : e + 1 : 0, G.current = t, t;
|
|
71
|
+
}), G.current === 1 && J(G.current);
|
|
72
|
+
}, [q, J]), X = h(() => {
|
|
73
|
+
R((e) => {
|
|
75
74
|
let t;
|
|
76
|
-
return t =
|
|
77
|
-
}),
|
|
78
|
-
}, [
|
|
75
|
+
return t = q ? e - 1 <= 0 ? q : e - 1 : 0, G.current = t, t;
|
|
76
|
+
}), G.current === 1 && J(G.current);
|
|
77
|
+
}, [q, J]), Z = h(async (e) => {
|
|
79
78
|
if (!e) return {};
|
|
80
79
|
let t = e.numPages, n = {};
|
|
81
80
|
for (let r = 1; r <= t; r++) {
|
|
@@ -87,11 +86,11 @@ var b = (b = {}, x = "") => {
|
|
|
87
86
|
}, []);
|
|
88
87
|
return g(() => {
|
|
89
88
|
if (!S) {
|
|
90
|
-
A.current = !0, N([]),
|
|
89
|
+
A.current = !0, N([]), R(0);
|
|
91
90
|
return;
|
|
92
91
|
}
|
|
93
|
-
A.current = !1, T(!0), N([]),
|
|
94
|
-
|
|
92
|
+
A.current = !1, T(!0), N([]), R(0), Z(E).then((e) => {
|
|
93
|
+
W.current = e;
|
|
95
94
|
let t = Object.keys(e).reduce((t, n) => {
|
|
96
95
|
let r = p([S], e[n], Number(n) - 1, b).map((e, t) => ({
|
|
97
96
|
...e,
|
|
@@ -100,13 +99,13 @@ var b = (b = {}, x = "") => {
|
|
|
100
99
|
}));
|
|
101
100
|
return [...t, ...r];
|
|
102
101
|
}, []);
|
|
103
|
-
N(t),
|
|
102
|
+
N(t), R(+!!t.length);
|
|
104
103
|
}).catch(() => {
|
|
105
|
-
N([]),
|
|
104
|
+
N([]), R(0);
|
|
106
105
|
}).finally(() => T(!1));
|
|
107
106
|
}, [
|
|
108
107
|
S,
|
|
109
|
-
|
|
108
|
+
Z,
|
|
110
109
|
E,
|
|
111
110
|
b
|
|
112
111
|
]), {
|
|
@@ -114,12 +113,12 @@ var b = (b = {}, x = "") => {
|
|
|
114
113
|
setSearch: C,
|
|
115
114
|
loading: w,
|
|
116
115
|
matches: M,
|
|
117
|
-
totalMatches:
|
|
118
|
-
currentMatchPosition:
|
|
119
|
-
currentMatch:
|
|
120
|
-
nextMatch:
|
|
121
|
-
prevMatch:
|
|
122
|
-
setCurrentMatchPosition:
|
|
116
|
+
totalMatches: q,
|
|
117
|
+
currentMatchPosition: L,
|
|
118
|
+
currentMatch: K,
|
|
119
|
+
nextMatch: Y,
|
|
120
|
+
prevMatch: X,
|
|
121
|
+
setCurrentMatchPosition: R
|
|
123
122
|
};
|
|
124
123
|
};
|
|
125
124
|
//#endregion
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useCallback as e, useEffect as t, useRef as n } from "react";
|
|
2
|
+
//#region lib/utils/hooks/useZoomOrigin.ts
|
|
3
|
+
var r = (e, t, n) => Math.max(t, Math.min(e, n)), i = (e) => Number.isFinite(e.left) && Number.isFinite(e.top) && Number.isFinite(e.width) && Number.isFinite(e.height) && e.width > 0 && e.height > 0, a = (e, t, n) => {
|
|
4
|
+
if (!e || !Number.isFinite(t) || !Number.isFinite(n)) return null;
|
|
5
|
+
let a = e.getBoundingClientRect();
|
|
6
|
+
return i(a) ? [r(t - a.left, 0, a.width), r(n - a.top, 0, a.height)] : null;
|
|
7
|
+
}, o = (e) => {
|
|
8
|
+
if (!e) return;
|
|
9
|
+
let t = e.getBoundingClientRect();
|
|
10
|
+
if (!i(t)) return;
|
|
11
|
+
let { width: n, height: r } = t;
|
|
12
|
+
return [n / 2, r / 2];
|
|
13
|
+
}, s = (s) => {
|
|
14
|
+
let c = n(null), l = e((e, t) => a(s, e, t), [s]);
|
|
15
|
+
return t(() => {
|
|
16
|
+
if (!s) {
|
|
17
|
+
c.current = null;
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
let e = (e) => {
|
|
21
|
+
c.current = l(e.clientX, e.clientY);
|
|
22
|
+
}, t = (e) => {
|
|
23
|
+
c.current = l(e.clientX, e.clientY);
|
|
24
|
+
};
|
|
25
|
+
return s.addEventListener("pointermove", e, { passive: !0 }), s.addEventListener("mousemove", t, { passive: !0 }), () => {
|
|
26
|
+
s.removeEventListener("pointermove", e), s.removeEventListener("mousemove", t);
|
|
27
|
+
};
|
|
28
|
+
}, [s, l]), e(() => {
|
|
29
|
+
if (!s) return;
|
|
30
|
+
let e = s.getBoundingClientRect();
|
|
31
|
+
if (!i(e)) return;
|
|
32
|
+
let { width: t, height: n } = e, a = c.current;
|
|
33
|
+
return a ? [r(a[0], 0, t), r(a[1], 0, n)] : o(s);
|
|
34
|
+
}, [s]);
|
|
35
|
+
};
|
|
36
|
+
//#endregion
|
|
37
|
+
export { o as getZoomCenterOrigin, a as getZoomOriginFromClientPoint, s as useZoomOrigin };
|
package/dist/utils/renderPage.js
CHANGED
|
@@ -1,21 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IOS_MAX_CANVAS_PIXELS as e, MAX_CANVAS_DIM as t, MAX_CANVAS_PIXELS as n, SAFARI_MAX_CANVAS_PIXELS as r } from "./constants.js";
|
|
2
|
+
import { AnnotationMode as i } from "pdfjs-dist";
|
|
2
3
|
//#region lib/utils/renderPage.ts
|
|
3
|
-
var
|
|
4
|
-
let
|
|
5
|
-
|
|
4
|
+
var a = () => {
|
|
5
|
+
let t = navigator.userAgent, i = /iPad|iPhone|iPod/.test(t) && !window.MSStream, a = /^((?!chrome|android).)*safari/i.test(t);
|
|
6
|
+
return i ? e : a ? r : n;
|
|
7
|
+
}, o = (e, n) => {
|
|
8
|
+
let r = window.devicePixelRatio || 1, i = Math.max(e * n, 1), o = Math.min(a(), i * 200), s = Math.sqrt(o / i), c = t / Math.max(e, 1), l = t / Math.max(n, 1), u = Math.min(r, s, c, l);
|
|
9
|
+
return Number.isFinite(u) && u > 0 ? u : 1;
|
|
10
|
+
}, s = (e, t, n = {}) => {
|
|
11
|
+
let { scale: r = 1, rotate: a = 0, renderForms: s = !1, interactiveForm: c = !0 } = n, l = t.getContext("2d", { desynchronized: !1 }), u = e.getViewport({
|
|
12
|
+
scale: r,
|
|
6
13
|
rotation: a
|
|
7
|
-
}), d =
|
|
8
|
-
scale:
|
|
14
|
+
}), d = o(u.width, u.height), f = e.getViewport({
|
|
15
|
+
scale: r * d,
|
|
9
16
|
rotation: a
|
|
10
17
|
});
|
|
11
|
-
|
|
12
|
-
let
|
|
13
|
-
return
|
|
14
|
-
canvas:
|
|
15
|
-
canvasContext:
|
|
16
|
-
viewport:
|
|
17
|
-
annotationMode:
|
|
18
|
+
t.width = Math.floor(f.width), t.height = Math.floor(f.height), t.style.width = `${Math.floor(u.width)}px`, t.style.height = `${Math.floor(u.height)}px`;
|
|
19
|
+
let p = s ? i.ENABLE_FORMS : void 0;
|
|
20
|
+
return c || (p = i.ENABLE), e.render({
|
|
21
|
+
canvas: t,
|
|
22
|
+
canvasContext: l,
|
|
23
|
+
viewport: f,
|
|
24
|
+
annotationMode: p
|
|
18
25
|
});
|
|
19
26
|
};
|
|
20
27
|
//#endregion
|
|
21
|
-
export {
|
|
28
|
+
export { s as renderPage };
|
package/dist/utils/types.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { a as e, i as t, n, o as r, r as i, t as a } from "../de_DE
|
|
1
|
+
import { a as e, i as t, n, o as r, r as i, t as a } from "../de_DE-x4Z-jQrz.js";
|
|
2
2
|
//#region lib/utils/types.ts
|
|
3
3
|
var o = /* @__PURE__ */ function(e) {
|
|
4
4
|
return e[e.Text = 1] = "Text", e[e.Link = 2] = "Link", e[e.FreeText = 3] = "FreeText", e[e.Line = 4] = "Line", e[e.Square = 5] = "Square", e[e.Circle = 6] = "Circle", e[e.Polygon = 7] = "Polygon", e[e.Polyline = 8] = "Polyline", e[e.Highlight = 9] = "Highlight", e[e.Underline = 10] = "Underline", e[e.Squiggly = 11] = "Squiggly", e[e.StrikeOut = 12] = "StrikeOut", e[e.Stamp = 13] = "Stamp", e[e.Caret = 14] = "Caret", e[e.Ink = 15] = "Ink", e[e.Popup = 16] = "Popup", e[e.FileAttachment = 17] = "FileAttachment", e[e.Widget = 20] = "Widget", e;
|
|
5
5
|
}({}), s = /* @__PURE__ */ function(e) {
|
|
6
6
|
return e.INTERNAL_LINK = "internal-link", e.LINK = "link", e.FILE_ATTACHMENT = "file-attachment", e.FORM_TEXT = "form-text", e.FORM_SELECT = "form-select", e.FORM_CHECKBOX = "form-checkbox", e.FORM_RADIO = "form-radio", e.FORM_BUTTON = "form-button", e.BUTTON = "button", e;
|
|
7
7
|
}({}), c = /* @__PURE__ */ function(e) {
|
|
8
|
-
return e.NOT_SUPPORTED = "not-supported", e.INVALID_OR_CORRUPTED_PDF = "invalid-or-corrupted-pdf", e;
|
|
8
|
+
return e.NOT_SUPPORTED = "not-supported", e.INVALID_OR_CORRUPTED_PDF = "invalid-or-corrupted-pdf", e.WASM_URL_REQUIRED = "wasm-url-required", e;
|
|
9
9
|
}({}), l = /* @__PURE__ */ function(e) {
|
|
10
10
|
return e.ACTUAL = "Actual Size", e.PAGE_FIT = "Page Fit", e.PAGE_WIDTH = "Page Width", e;
|
|
11
11
|
}({}), u = /* @__PURE__ */ function(e) {
|
|
@@ -13,7 +13,7 @@ var o = /* @__PURE__ */ function(e) {
|
|
|
13
13
|
}({}), d = /* @__PURE__ */ function(e) {
|
|
14
14
|
return e.SINGLE_PAGE = "Single", e.DUAL_PAGE = "Dual", e.DUAL_PAGE_WITH_COVER = "DualWithCover", e;
|
|
15
15
|
}({}), f = /* @__PURE__ */ function(e) {
|
|
16
|
-
return e.FONT_FAMILY = "--rp-font-family", e.PRIMARY_COLOR = "--rp-primary-color", e.BORDER_RADIUS = "--rp-border-radius", e.TEXT_COLOR = "--rp-text-color", e.OUTLINE_COLOR = "--rp-outline-color", e.FONT_SIZE = "--rp-font-size", e.DROP_MASK_BACKGROUND_COLOR = "--rp-drop-mask-background-color", e.LOADER_BACKDROP_COLOR = "--rp-loader-backdrop-color", e.ICON_DISABLED = "--rp-icon-disabled", e.ICON_FONT_SIZE = "--rp-icon-font-size", e.TOOLBAR_BACKGROUND = "--rp-toolbar-background", e.TOOLBAR_BORDER_COLOR = "--rp-toolbar-border-color", e.TOOLBAR_PADDING = "--rp-toolbar-padding", e.TOOLBAR_GAP = "--rp-toolbar-gap", e.TOOLBAR_SIZE = "--rp-toolbar-size", e.SIDEBAR_WIDTH = "--rp-sidebar-width", e.THUMBNAIL_BORDER_COLOR = "--rp-thumbnail-border-color", e.THUMBNAIL_BACKGROUND_COLOR = "--rp-thumbnail-background-color", e.THUMBNAIL_ACTIVE_COLOR = "--rp-thumbnail-active-color", e.THUMBNAIL_PADDING_Y = "--rp-thumbnail-padding-y", e.BUTTON_HOVER_BACKGROUND = "--rp-button-hover-background", e.BUTTON_PADDING = "--rp-button-padding", e.INPUT_PADDING = "--rp-input-padding", e.INPUT_BORDER_RADIUS = "--rp-input-border-radius", e.INPUT_BACKGROUND_COLOR = "--rp-input-background-color", e.INPUT_PLACEHOLDER_COLOR = "--rp-input-placeholder-color", e.PAGES_BACKGROUND_COLOR = "--rp-pages-background-color", e.PAGE_SHADOW = "--rp-page-shadow", e.PAGE_OUTLINE = "--rp-page-outline", e.PAGE_OUTLINE_OFFSET = "--rp-page-outline-offset", e.ANNOTATION_LAYER_LINK_HOVER_BACKGROUND = "--rp-annotation-layer__link-hover-background", e.DROPDOWN_BACKGROUND_COLOR = "--rp-dropdown-background-color", e.DROPDOWN_PADDING = "--rp-dropdown-padding", e.DROPDOWN_HOVER_BACKGROUND_COLOR = "--rp-dropdown-hover-background-color", e.DROPDOWN_SEPARATOR_COLOR = "--rp-dropdown-separator-color", e.DROPDOWN_SEPARATOR_MARGIN = "--rp-dropdown-separator-margin", e.DROPDOWN_PADDING_MENU_ITEM = "--rp-dropdown-padding-menu-item", e.DROPDOWN_FONT_SIZE = "--rp-dropdown-font-size", e.DROPDOWN_BORDER_RADIUS = "--rp-dropdown-border-radius", e.SEARCH_TOOL_DROPDOWN_PADDING = "--rp-search-tool-dropdown-padding", e.POPOVER_FONT_SIZE = "--rp-popover-font-size", e.POPOVER_BACKGROUND_COLOR = "--rp-popover-background-color", e.POPOVER_COLOR = "--rp-popover-color", e.POPOVER_BORDER_COLOR = "--rp-popover-border-color", e.POPOVER_BORDER_RADIUS = "--rp-popover-border-radius", e.OVERLAY_BACKGROUND_COLOR = "--rp-overlay-background-color", e.DIALOG_BACKGROUND_COLOR = "--rp-dialog-background-color", e.PROPERTIES_DIVIDER_COLOR = "--rp-properties-divider-color", e.PROPERTIES_DIVIDER_MARGIN = "--rp-properties-divider-margin", e.PROPERTY_ITEM_GAP = "--rp-property-item-gap", e.DIALOG_TITLE_COLOR = "--rp-dialog-title-color", e.PROPERTY_ITEM_LABEL_COLOR = "--rp-property-item-label-color", e.PROPERTY_CLOSE_ICON_SIZE = "--rp-property-close-icon-size", e.PROPERTY_ITEM_FONT_SIZE = "--rp-property-item-font-size", e.PROPERTY_ITEM_FONT_WEIGHT = "--rp-property-item-font-weight", e.DIALOG_TITLE_FONT_SIZE = "--rp-dialog-title-font-size", e.DIALOG_TITLE_FONT_WEIGHT = "--rp-dialog-title-font-weight", e.MENU_ITEM_ICON_SIZE = "--rp-menu-item-icon-size", e.PRINT_PROGRESS_BACKGROUND = "--rp-print-progress-background", e.PRINT_PROGRESS_COLOR = "--rp-print-progress-color", e.DROP_ZONE_BORDER = "--rp-drop-zone-border", e.DROP_ZONE_FONT_COLOR = "--rp-drop-zone-font-color", e.DROP_ZONE_FONT_SIZE = "--rp-drop-zone-font-size", e.DROP_ZONE_BACKGROUND_COLOR = "--rp-drop-zone-background-color", e.CHECKBOX_BORDER_RADIUS = "--rp-checkbox-border-radius", e.CHECKBOX_BORDER_COLOR = "--rp-checkbox-border-color", e.CHECKBOX_INDICATOR_COLOR = "--rp-checkbox-indicator-color", e.HIGHLIGHT_BACKGROUND_COLOR = "--rp-highlight-background-color", e.TEXT_LAYER_HIGHLIGHT_BORDER_RADIUS = "--rp-text-layer-highlight-border-radius", e.CURRENT_HIGHLIGHT_BACKGROUND_COLOR = "--rp-current-highlight-background-color", e.TOOLTIP_BACKGROUND_COLOR = "--rp-tooltip-background-color", e.TOOLTIP_BORDER_RADIUS = "--rp-tooltip-border-radius", e.TOOLTIP_FONT_COLOR = "--rp-tooltip-font-color", e.TOOLTIP_FONT_SIZE = "--rp-tooltip-font-size", e.TOOLTIP_PADDING = "--rp-tooltip-padding", e.PASSWORD_MODAL_BACKGROUND_COLOR = "--rp-password-background-color", e.PASSWORD_MODAL_TITLE_FONT_COLOR = "--rp-password-title-font-color", e.PASSWORD_MODAL_CONTENT_FONT_COLOR = "--rp-password-content-font-color", e.PASSWORD_MODAL_INPUT_PLACEHOLDER_COLOR = "--rp-password-input-placeholder-color", e.PASSWORD_MODAL_INPUT_BORDER_COLOR = "--rp-password-input-border-color", e.PASSWORD_MODAL_INPUT_FONT_COLOR = "--rp-password-input-font-color", e.PASSWORD_MODAL_BUTTON_FONT_COLOR = "--rp-password-button-font-color", e.PASSWORD_MODAL_BUTTON_BACKGROUND_COLOR = "--rp-password-button-background-color", e.PASSWORD_MODAL_BUTTON_BORDER_COLOR = "--rp-password-button-border-color", e.PASSWORD_MODAL_BORDER_COLOR = "--rp-password-border-color", e.CONTAINER_FOCUS_OUTLINE_WIDTH = "--rp-container-focus-outline-width", e.CONTAINER_FOCUS_OUTLINE_COLOR = "--rp-container-focus-outline-color", e.CONTAINER_FOCUS_OUTLINE_OFFSET = "--rp-container-focus-outline-offset", e.BUTTON_BORDER_RADIUS = "--rp-button-border-radius", e.SKIP_LINK_FONT_SIZE = "--rp-skip-link-font-size", e.SKIP_LINK_COLOR = "--rp-skip-link-color", e.SKIP_LINK_BACKGROUND_COLOR = "--rp-skip-link-background-color", e.SKIP_LINK_BORDER_COLOR = "--rp-skip-link-border-color", e;
|
|
16
|
+
return e.FONT_FAMILY = "--rp-font-family", e.PRIMARY_COLOR = "--rp-primary-color", e.BORDER_RADIUS = "--rp-border-radius", e.TEXT_COLOR = "--rp-text-color", e.OUTLINE_COLOR = "--rp-outline-color", e.FONT_SIZE = "--rp-font-size", e.DROP_MASK_BACKGROUND_COLOR = "--rp-drop-mask-background-color", e.LOADER_BACKDROP_COLOR = "--rp-loader-backdrop-color", e.ICON_DISABLED = "--rp-icon-disabled", e.ICON_FONT_SIZE = "--rp-icon-font-size", e.TOOLBAR_BACKGROUND = "--rp-toolbar-background", e.TOOLBAR_BORDER_COLOR = "--rp-toolbar-border-color", e.TOOLBAR_PADDING = "--rp-toolbar-padding", e.TOOLBAR_GAP = "--rp-toolbar-gap", e.TOOLBAR_SIZE = "--rp-toolbar-size", e.SIDEBAR_WIDTH = "--rp-sidebar-width", e.THUMBNAIL_BORDER_COLOR = "--rp-thumbnail-border-color", e.THUMBNAIL_BACKGROUND_COLOR = "--rp-thumbnail-background-color", e.THUMBNAIL_ACTIVE_COLOR = "--rp-thumbnail-active-color", e.THUMBNAIL_PADDING_Y = "--rp-thumbnail-padding-y", e.BUTTON_HOVER_BACKGROUND = "--rp-button-hover-background", e.BUTTON_PADDING = "--rp-button-padding", e.INPUT_PADDING = "--rp-input-padding", e.INPUT_BORDER_RADIUS = "--rp-input-border-radius", e.INPUT_BACKGROUND_COLOR = "--rp-input-background-color", e.INPUT_PLACEHOLDER_COLOR = "--rp-input-placeholder-color", e.SEARCH_INPUT_BORDER_COLOR = "--rp-search-input-border-color", e.PAGES_BACKGROUND_COLOR = "--rp-pages-background-color", e.PAGE_SHADOW = "--rp-page-shadow", e.PAGE_OUTLINE = "--rp-page-outline", e.PAGE_OUTLINE_OFFSET = "--rp-page-outline-offset", e.ANNOTATION_LAYER_LINK_HOVER_BACKGROUND = "--rp-annotation-layer__link-hover-background", e.DROPDOWN_BACKGROUND_COLOR = "--rp-dropdown-background-color", e.DROPDOWN_PADDING = "--rp-dropdown-padding", e.DROPDOWN_HOVER_BACKGROUND_COLOR = "--rp-dropdown-hover-background-color", e.DROPDOWN_SEPARATOR_COLOR = "--rp-dropdown-separator-color", e.DROPDOWN_SEPARATOR_MARGIN = "--rp-dropdown-separator-margin", e.DROPDOWN_PADDING_MENU_ITEM = "--rp-dropdown-padding-menu-item", e.DROPDOWN_FONT_SIZE = "--rp-dropdown-font-size", e.DROPDOWN_BORDER_RADIUS = "--rp-dropdown-border-radius", e.SEARCH_TOOL_DROPDOWN_PADDING = "--rp-search-tool-dropdown-padding", e.POPOVER_FONT_SIZE = "--rp-popover-font-size", e.POPOVER_BACKGROUND_COLOR = "--rp-popover-background-color", e.POPOVER_COLOR = "--rp-popover-color", e.POPOVER_BORDER_COLOR = "--rp-popover-border-color", e.POPOVER_BORDER_RADIUS = "--rp-popover-border-radius", e.OVERLAY_BACKGROUND_COLOR = "--rp-overlay-background-color", e.DIALOG_BACKGROUND_COLOR = "--rp-dialog-background-color", e.PROPERTIES_DIVIDER_COLOR = "--rp-properties-divider-color", e.PROPERTIES_DIVIDER_MARGIN = "--rp-properties-divider-margin", e.PROPERTY_ITEM_GAP = "--rp-property-item-gap", e.DIALOG_TITLE_COLOR = "--rp-dialog-title-color", e.PROPERTY_ITEM_LABEL_COLOR = "--rp-property-item-label-color", e.PROPERTY_CLOSE_ICON_SIZE = "--rp-property-close-icon-size", e.PROPERTY_ITEM_FONT_SIZE = "--rp-property-item-font-size", e.PROPERTY_ITEM_FONT_WEIGHT = "--rp-property-item-font-weight", e.DIALOG_TITLE_FONT_SIZE = "--rp-dialog-title-font-size", e.DIALOG_TITLE_FONT_WEIGHT = "--rp-dialog-title-font-weight", e.MENU_ITEM_ICON_SIZE = "--rp-menu-item-icon-size", e.PRINT_PROGRESS_BACKGROUND = "--rp-print-progress-background", e.PRINT_PROGRESS_COLOR = "--rp-print-progress-color", e.PRINT_PROGRESS_CANCEL_BUTTON_BORDER_COLOR = "--rp-print-progress-cancel-button-border-color", e.DROP_ZONE_BORDER = "--rp-drop-zone-border", e.DROP_ZONE_FONT_COLOR = "--rp-drop-zone-font-color", e.DROP_ZONE_FONT_SIZE = "--rp-drop-zone-font-size", e.DROP_ZONE_BACKGROUND_COLOR = "--rp-drop-zone-background-color", e.CHECKBOX_BORDER_RADIUS = "--rp-checkbox-border-radius", e.CHECKBOX_BORDER_COLOR = "--rp-checkbox-border-color", e.CHECKBOX_INDICATOR_COLOR = "--rp-checkbox-indicator-color", e.HIGHLIGHT_BACKGROUND_COLOR = "--rp-highlight-background-color", e.TEXT_LAYER_HIGHLIGHT_BORDER_RADIUS = "--rp-text-layer-highlight-border-radius", e.CURRENT_HIGHLIGHT_BACKGROUND_COLOR = "--rp-current-highlight-background-color", e.TOOLTIP_BACKGROUND_COLOR = "--rp-tooltip-background-color", e.TOOLTIP_BORDER_RADIUS = "--rp-tooltip-border-radius", e.TOOLTIP_FONT_COLOR = "--rp-tooltip-font-color", e.TOOLTIP_FONT_SIZE = "--rp-tooltip-font-size", e.TOOLTIP_PADDING = "--rp-tooltip-padding", e.PASSWORD_MODAL_BACKGROUND_COLOR = "--rp-password-background-color", e.PASSWORD_MODAL_TITLE_FONT_COLOR = "--rp-password-title-font-color", e.PASSWORD_MODAL_CONTENT_FONT_COLOR = "--rp-password-content-font-color", e.PASSWORD_MODAL_INPUT_PLACEHOLDER_COLOR = "--rp-password-input-placeholder-color", e.PASSWORD_MODAL_INPUT_BORDER_COLOR = "--rp-password-input-border-color", e.PASSWORD_MODAL_INPUT_FONT_COLOR = "--rp-password-input-font-color", e.PASSWORD_MODAL_BUTTON_FONT_COLOR = "--rp-password-button-font-color", e.PASSWORD_MODAL_BUTTON_BACKGROUND_COLOR = "--rp-password-button-background-color", e.PASSWORD_MODAL_BUTTON_BORDER_COLOR = "--rp-password-button-border-color", e.PASSWORD_MODAL_BORDER_COLOR = "--rp-password-border-color", e.CONTAINER_FOCUS_OUTLINE_WIDTH = "--rp-container-focus-outline-width", e.CONTAINER_FOCUS_OUTLINE_COLOR = "--rp-container-focus-outline-color", e.CONTAINER_FOCUS_OUTLINE_OFFSET = "--rp-container-focus-outline-offset", e.BUTTON_BORDER_RADIUS = "--rp-button-border-radius", e.SKIP_LINK_FONT_SIZE = "--rp-skip-link-font-size", e.SKIP_LINK_COLOR = "--rp-skip-link-color", e.SKIP_LINK_BACKGROUND_COLOR = "--rp-skip-link-background-color", e.SKIP_LINK_BORDER_COLOR = "--rp-skip-link-border-color", e;
|
|
17
17
|
}({}), p = /* @__PURE__ */ function(e) {
|
|
18
18
|
return e.PAGE_SCROLLING = "PAGE", e.VERTICAL_SCROLLING = "VERTICAL", e.HORIZONTAL_SCROLLING = "HORIZONTAL", e;
|
|
19
19
|
}({}), m = /* @__PURE__ */ function(e) {
|
package/dist/utils/zoom.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { MAX_ZOOM_SCALE as e } from "./constants.js";
|
|
2
2
|
//#region lib/utils/zoom.ts
|
|
3
|
-
var t = (e) => e * 100 <= 25, n = (t) => t * 100 >= e
|
|
3
|
+
var t = (e) => e * 100 <= 25, n = (t) => t * 100 >= e, r = (t) => {
|
|
4
|
+
let n = Math.floor(t / 25) * 25;
|
|
5
|
+
return Math.min(n + 25, e);
|
|
6
|
+
}, i = (e) => {
|
|
7
|
+
let t = Math.ceil(e / 25) * 25;
|
|
8
|
+
return Math.max(t - 25, 25);
|
|
9
|
+
};
|
|
4
10
|
//#endregion
|
|
5
|
-
export { n as isZoomInDisabled, t as isZoomOutDisabled };
|
|
11
|
+
export { r as getNextZoomInLevel, i as getNextZoomOutLevel, n as isZoomInDisabled, t as isZoomOutDisabled };
|