@react-pdf-kit/viewer 2.8.0-beta.1 → 2.8.0-beta.11
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-cyO0Tn21.js +690 -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,15 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./clsx-DSGuh5YW.js";
|
|
2
|
-
import { r as t } from "./dist-VbpVNBs6.js";
|
|
3
|
-
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
-
import './assets/MenuItem.css';//#region lib/components/layout/toolbar/MenuItem.module.css
|
|
5
|
-
var r = { "rp-menu-item": "_rp-menu-item_cu12j_1" }, i = (i) => {
|
|
6
|
-
let { children: a, className: o, ...s } = i;
|
|
7
|
-
return /* @__PURE__ */ n(t, {
|
|
8
|
-
...s,
|
|
9
|
-
tabIndex: 0,
|
|
10
|
-
className: e(r["rp-menu-item"], o),
|
|
11
|
-
children: a
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
//#endregion
|
|
15
|
-
export { i as t };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import './assets/Paginate.css';//#region lib/components/layout/toolbar/Paginate.module.css
|
|
2
|
-
var e = {
|
|
3
|
-
"rp-paginate": "_rp-paginate_1yinm_1",
|
|
4
|
-
"rp-page-input": "_rp-page-input_1yinm_6",
|
|
5
|
-
"rp-total-page": "_rp-total-page_1yinm_29"
|
|
6
|
-
};
|
|
7
|
-
//#endregion
|
|
8
|
-
export { e as t };
|
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
import { ScrollMode as e, ViewMode as t } from "./utils/types.js";
|
|
2
|
-
import { appConsole as n } from "./utils/appConsole.js";
|
|
3
|
-
import { useDocumentContext as r } from "./contexts/RPDocumentContext.js";
|
|
4
|
-
import { useInitialStateContext as i } from "./contexts/InitialStateContext.js";
|
|
5
|
-
import { useScrollModeContext as a } from "./contexts/ScrollModeContext.js";
|
|
6
|
-
import { useViewModeContext as o } from "./contexts/ViewModeContext.js";
|
|
7
|
-
import { useVirtualScrollContext as s } from "./contexts/VirtualScrollContext.js";
|
|
8
|
-
import { useVirtualGridContext as c } from "./contexts/VirtualGridContext.js";
|
|
9
|
-
import { smoothScrollTo as l } from "./utils/smoothScrollTo.js";
|
|
10
|
-
import { useLayoutContainer as u } from "./contexts/LayoutContainerContext.js";
|
|
11
|
-
import { useGlobalCurrentPage as d } from "./contexts/GlobalCurrentPage.js";
|
|
12
|
-
import { useDebounce as f } from "./utils/hooks/useDebounce.js";
|
|
13
|
-
import { useDimensionPagesContext as p } from "./contexts/DimensionPagesContext.js";
|
|
14
|
-
import { useSmoothScrollContext as m } from "./contexts/SmoothScrollContext.js";
|
|
15
|
-
import { getScrollDistance as h } from "./utils/getScrollDistance.js";
|
|
16
|
-
import { getGridDimension as g, getPositionFromPage as _ } from "./utils/calculatePage.js";
|
|
17
|
-
import { createContext as v, useCallback as y, useContext as b, useEffect as x, useMemo as S, useRef as C, useState as w } from "react";
|
|
18
|
-
import { jsx as T } from "react/jsx-runtime";
|
|
19
|
-
//#region lib/utils/hooks/useScrollToPage.ts
|
|
20
|
-
var E = () => {
|
|
21
|
-
let { viewMode: n } = o(), { scrollMode: r } = a(), { virtualScrollRef: i, virtualScrollableElementRef: u, pageScrollElementRef: d } = s(), { setFocusedPage: f } = k(), v = C(), { columnCount: b } = c(), { widths: S, heights: w } = p(), T = C(r), E = C(n), D = C(b), { targetScrollPage: O, scrollBehavior: A } = m(), j = C(null);
|
|
22
|
-
x(() => {
|
|
23
|
-
i?.scrollToItem && (v.current = i);
|
|
24
|
-
}, [i]), x(() => {
|
|
25
|
-
T.current = r, E.current = n;
|
|
26
|
-
}, [r, n]);
|
|
27
|
-
let M = y((e, t) => {
|
|
28
|
-
if (!d) return;
|
|
29
|
-
let n = Math.ceil(e / 2) * 2 - 1;
|
|
30
|
-
if (e === n + 1) {
|
|
31
|
-
let e = {
|
|
32
|
-
left: S[n],
|
|
33
|
-
top: 0
|
|
34
|
-
};
|
|
35
|
-
return new Promise((t) => l(d, e, t));
|
|
36
|
-
}
|
|
37
|
-
return d?.scrollTo({
|
|
38
|
-
left: 0,
|
|
39
|
-
top: 0,
|
|
40
|
-
behavior: t
|
|
41
|
-
});
|
|
42
|
-
}, [
|
|
43
|
-
d,
|
|
44
|
-
S,
|
|
45
|
-
l
|
|
46
|
-
]);
|
|
47
|
-
x(() => {
|
|
48
|
-
T.current = r, E.current = n;
|
|
49
|
-
}, [r, n]), x(() => {
|
|
50
|
-
D.current = b;
|
|
51
|
-
}, [b]);
|
|
52
|
-
let N = y((n, r = A) => {
|
|
53
|
-
f(n);
|
|
54
|
-
let i = n - 1, a = i, o = 0;
|
|
55
|
-
if (E.current === t.DUAL_PAGE && T.current === e.PAGE_SCROLLING) {
|
|
56
|
-
M(n, r);
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
if (T.current === e.PAGE_SCROLLING) {
|
|
60
|
-
f(n);
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
if (!v.current || !u) {
|
|
64
|
-
j.current = {
|
|
65
|
-
page: n,
|
|
66
|
-
behavior: r
|
|
67
|
-
};
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
j.current = null;
|
|
71
|
-
let s = u;
|
|
72
|
-
r === "smooth" && (O.current = n);
|
|
73
|
-
let c = E.current === t.DUAL_PAGE_WITH_COVER, { columnsWidth: l, rowsHeight: d } = g({
|
|
74
|
-
widths: S,
|
|
75
|
-
heights: w
|
|
76
|
-
}, b, c);
|
|
77
|
-
if (T.current === e.HORIZONTAL_SCROLLING) {
|
|
78
|
-
o = i;
|
|
79
|
-
let e = h(l, o), t = {
|
|
80
|
-
left: Math.floor(e),
|
|
81
|
-
top: 0
|
|
82
|
-
};
|
|
83
|
-
return s.scrollTo({
|
|
84
|
-
...t,
|
|
85
|
-
behavior: r
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
if (E.current === t.DUAL_PAGE_WITH_COVER) {
|
|
89
|
-
let { rowIndex: e, columnIndex: t } = _(n, b, !0), i = h(l, t), a = h(d, e), o = {
|
|
90
|
-
left: Math.floor(i),
|
|
91
|
-
top: Math.floor(a)
|
|
92
|
-
};
|
|
93
|
-
return s.scrollTo({
|
|
94
|
-
...o,
|
|
95
|
-
behavior: r
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
if (E.current === t.DUAL_PAGE) {
|
|
99
|
-
o = i % 2, a = Math.floor(i / 2);
|
|
100
|
-
let e = h(l, o), t = h(d, a), n = {
|
|
101
|
-
left: Math.floor(e),
|
|
102
|
-
top: Math.floor(t)
|
|
103
|
-
};
|
|
104
|
-
return s.scrollTo({
|
|
105
|
-
...n,
|
|
106
|
-
behavior: r
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
let p = h(d, a), m = {
|
|
110
|
-
left: 0,
|
|
111
|
-
top: Math.floor(p)
|
|
112
|
-
};
|
|
113
|
-
return s.scrollTo({
|
|
114
|
-
...m,
|
|
115
|
-
behavior: r
|
|
116
|
-
});
|
|
117
|
-
}, [
|
|
118
|
-
u,
|
|
119
|
-
b,
|
|
120
|
-
M,
|
|
121
|
-
f,
|
|
122
|
-
l,
|
|
123
|
-
w,
|
|
124
|
-
S,
|
|
125
|
-
A
|
|
126
|
-
]);
|
|
127
|
-
return x(() => {
|
|
128
|
-
if (!u || !j.current) return;
|
|
129
|
-
let { page: e, behavior: t } = j.current;
|
|
130
|
-
j.current = null, N(e, t);
|
|
131
|
-
}, [u, N]), { scrollToPage: N };
|
|
132
|
-
}, D = (n = 1) => {
|
|
133
|
-
let [r, i] = w(n), [s, c] = w(0), { scrollToPage: l } = E(), d = C(n), { viewMode: m } = o(), { scrollMode: h } = a(), { widths: g } = p(), { pagesRef: _ } = u(), v = f(r, 100), b = y((e) => {
|
|
134
|
-
if (!/^[0-9]*$/g.test(e.toString()) || !e) return {
|
|
135
|
-
success: !1,
|
|
136
|
-
currentPage: d.current
|
|
137
|
-
};
|
|
138
|
-
let t = +e;
|
|
139
|
-
return t < 0 || t > s ? {
|
|
140
|
-
success: !1,
|
|
141
|
-
currentPage: d.current
|
|
142
|
-
} : (i(t), d.current = t, {
|
|
143
|
-
success: !0,
|
|
144
|
-
currentPage: +e
|
|
145
|
-
});
|
|
146
|
-
}, [s]), x = y(b, [b]), T = y((e) => {
|
|
147
|
-
i(e), d.current = e;
|
|
148
|
-
}, []), D = y((e, t) => {
|
|
149
|
-
let n = b(e);
|
|
150
|
-
return n.success && l(n.currentPage, t), n;
|
|
151
|
-
}, [b, l]), O = y((e) => {
|
|
152
|
-
let n = e % 2 == 1;
|
|
153
|
-
if (!_ || n) return !1;
|
|
154
|
-
let r = n ? g[e] : g[e - 1], i = n ? g[e + 1] : g[e];
|
|
155
|
-
return m === t.DUAL_PAGE && r + i < _.clientWidth;
|
|
156
|
-
}, [
|
|
157
|
-
m,
|
|
158
|
-
g,
|
|
159
|
-
_,
|
|
160
|
-
s
|
|
161
|
-
]), k = y(() => {
|
|
162
|
-
let e = r - 1;
|
|
163
|
-
O(e) && (e = r - 2), D(e);
|
|
164
|
-
}, [
|
|
165
|
-
D,
|
|
166
|
-
r,
|
|
167
|
-
m,
|
|
168
|
-
h,
|
|
169
|
-
O
|
|
170
|
-
]), A = S(() => m === t.DUAL_PAGE && h === e.PAGE_SCROLLING ? r === s - 1 : r === s, [
|
|
171
|
-
r,
|
|
172
|
-
s,
|
|
173
|
-
m,
|
|
174
|
-
h
|
|
175
|
-
]);
|
|
176
|
-
return {
|
|
177
|
-
focusedPage: v,
|
|
178
|
-
totalPages: s,
|
|
179
|
-
setFocusedPage: x,
|
|
180
|
-
resetPage: T,
|
|
181
|
-
setTotalPages: c,
|
|
182
|
-
nextPage: y(() => {
|
|
183
|
-
if (A) return;
|
|
184
|
-
let e = r + 1;
|
|
185
|
-
O(e) && (e = r + 2), D(e);
|
|
186
|
-
}, [
|
|
187
|
-
D,
|
|
188
|
-
r,
|
|
189
|
-
O,
|
|
190
|
-
m,
|
|
191
|
-
h,
|
|
192
|
-
A
|
|
193
|
-
]),
|
|
194
|
-
prevPage: k,
|
|
195
|
-
goToPage: D
|
|
196
|
-
};
|
|
197
|
-
}, O = v({
|
|
198
|
-
focusedPage: 0,
|
|
199
|
-
setFocusedPage: (e) => {},
|
|
200
|
-
goToPage: (e, t) => ({
|
|
201
|
-
success: !!e,
|
|
202
|
-
currentPage: +e
|
|
203
|
-
}),
|
|
204
|
-
totalPages: 0,
|
|
205
|
-
setTotalPages: (e) => {},
|
|
206
|
-
prevPage: () => {},
|
|
207
|
-
nextPage: () => {}
|
|
208
|
-
}), k = () => {
|
|
209
|
-
let e = b(O);
|
|
210
|
-
return e?.focusedPage === void 0 && n.error("Please use this hooks inside children component of RPProvider"), e;
|
|
211
|
-
}, A = ({ children: e }) => {
|
|
212
|
-
let { pdf: t } = r(), { setCurrentPage: n } = d(), { initialPage: a = 1 } = i(), { focusedPage: o, totalPages: s, setFocusedPage: c, resetPage: l, setTotalPages: u, goToPage: f, nextPage: p, prevPage: m } = D(a), h = C(!0);
|
|
213
|
-
return x(() => {
|
|
214
|
-
if (!t) {
|
|
215
|
-
h.current || (u(0), l(1));
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
if (!t.numPages) return;
|
|
219
|
-
u(t.numPages);
|
|
220
|
-
let e = h.current ? a : 1;
|
|
221
|
-
l(Math.min(Math.max(e, 1), t.numPages)), h.current = !1;
|
|
222
|
-
}, [
|
|
223
|
-
t,
|
|
224
|
-
u,
|
|
225
|
-
l
|
|
226
|
-
]), x(() => {
|
|
227
|
-
n(o);
|
|
228
|
-
}, [o, n]), /* @__PURE__ */ T(O.Provider, {
|
|
229
|
-
value: {
|
|
230
|
-
focusedPage: o,
|
|
231
|
-
totalPages: s,
|
|
232
|
-
setFocusedPage: c,
|
|
233
|
-
setTotalPages: u,
|
|
234
|
-
nextPage: p,
|
|
235
|
-
prevPage: m,
|
|
236
|
-
goToPage: f
|
|
237
|
-
},
|
|
238
|
-
children: e
|
|
239
|
-
});
|
|
240
|
-
};
|
|
241
|
-
//#endregion
|
|
242
|
-
export { E as a, D as i, A as n, k as r, O as t };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import './assets/RPLayout.css';//#region lib/components/layout/RPLayout.module.css
|
|
2
|
-
var e = {
|
|
3
|
-
"rp-layout": "_rp-layout_1yzm4_1",
|
|
4
|
-
"rp-layout-wrapper": "_rp-layout-wrapper_1yzm4_5",
|
|
5
|
-
"rp-content": "_rp-content_1yzm4_11",
|
|
6
|
-
"rp-sidebar": "_rp-sidebar_1yzm4_18",
|
|
7
|
-
"rp-pages": "_rp-pages_1yzm4_23",
|
|
8
|
-
"rp-container": "_rp-container_1yzm4_29",
|
|
9
|
-
"rp-loader": "_rp-loader_1yzm4_33",
|
|
10
|
-
"rp-theme-variables": "_rp-theme-variables_1yzm4_37",
|
|
11
|
-
"rp-dark-mode": "_rp-dark-mode_1yzm4_156"
|
|
12
|
-
};
|
|
13
|
-
//#endregion
|
|
14
|
-
export { e as t };
|
package/dist/RPPage-BsDixmqF.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { useDocumentContext as e } from "./contexts/RPDocumentContext.js";
|
|
2
|
-
import { useZoomContext as t } from "./contexts/ZoomContext.js";
|
|
3
|
-
import { usePagesRotateContext as n } from "./contexts/PagesRotateContext.js";
|
|
4
|
-
import { useLayerContext as r } from "./contexts/LayerContext.js";
|
|
5
|
-
import { useLoaderContext as i } from "./contexts/LoaderContext.js";
|
|
6
|
-
import { CanvasLayer as a } from "./components/page/CanvasLayer.js";
|
|
7
|
-
import { t as o } from "./TextLayer-DWGFN9SF.js";
|
|
8
|
-
import { t as s } from "./AnnotationLayer-C6UTOVmc.js";
|
|
9
|
-
import { t as c } from "./TextHighlightLayer-BSVgBxR3.js";
|
|
10
|
-
import { CustomElement as l } from "./components/page/CustomElement.js";
|
|
11
|
-
import { withRef as u } from "./utils/withRef.js";
|
|
12
|
-
import { useCallback as d, useEffect 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
|
-
import './assets/RPPage.css';//#region lib/components/page/RPPage.module.css
|
|
15
|
-
var y = {
|
|
16
|
-
"rp-page-wrapper": "_rp-page-wrapper_krysr_1",
|
|
17
|
-
"rp-page": "_rp-page_krysr_1",
|
|
18
|
-
"rp-loader-wrapper": "_rp-loader-wrapper_krysr_17"
|
|
19
|
-
}, b = u((u, b) => {
|
|
20
|
-
let { pageNumber: x, style: S, ...C } = u, { pages: w } = e(), { pageRotate: T } = n(), { textLayer: E } = r(), { currentZoom: D } = t(), { LoaderImageComponent: O } = i(), k = h(w.get(x)), [A, j] = g(!1), M = h(null), [N, P] = g({
|
|
21
|
-
width: 0,
|
|
22
|
-
height: 0
|
|
23
|
-
});
|
|
24
|
-
p(b, () => M.current);
|
|
25
|
-
let F = m(() => k.current ? T[x] : 0, [x, T]);
|
|
26
|
-
f(() => {
|
|
27
|
-
w && (k.current = w.get(x), k.current && P(k.current.page.getViewport({
|
|
28
|
-
scale: D,
|
|
29
|
-
rotation: F
|
|
30
|
-
})));
|
|
31
|
-
}, [
|
|
32
|
-
w,
|
|
33
|
-
x,
|
|
34
|
-
F,
|
|
35
|
-
D
|
|
36
|
-
]);
|
|
37
|
-
let I = m(() => {
|
|
38
|
-
switch (F) {
|
|
39
|
-
case 90: return `${N.width / 2}px ${N.width / 2}px`;
|
|
40
|
-
case -90:
|
|
41
|
-
case 270: return `${N.height / 2}px ${N.height / 2}px`;
|
|
42
|
-
default: return "center";
|
|
43
|
-
}
|
|
44
|
-
}, [F, N]), L = d(() => {
|
|
45
|
-
j(!0);
|
|
46
|
-
}, []), R = d(() => {
|
|
47
|
-
j(!1);
|
|
48
|
-
}, []);
|
|
49
|
-
return /* @__PURE__ */ _("div", {
|
|
50
|
-
ref: M,
|
|
51
|
-
id: `page-${x}`,
|
|
52
|
-
"data-rp": `page-${x}`,
|
|
53
|
-
...C,
|
|
54
|
-
style: {
|
|
55
|
-
...S,
|
|
56
|
-
"--rp-rotate": `${F}deg`,
|
|
57
|
-
"--rp-page-rotate-translate": `${I}`,
|
|
58
|
-
"--user-unit": N.userUnit || 1,
|
|
59
|
-
"--scale-factor": D,
|
|
60
|
-
"--total-scale-factor": "calc(var(--scale-factor) * var(--user-unit))"
|
|
61
|
-
},
|
|
62
|
-
className: y["rp-page-wrapper"],
|
|
63
|
-
children: /* @__PURE__ */ v("div", {
|
|
64
|
-
style: {
|
|
65
|
-
width: `${N.width}px`,
|
|
66
|
-
height: `${N.height}px`
|
|
67
|
-
},
|
|
68
|
-
className: y["rp-page"],
|
|
69
|
-
children: [
|
|
70
|
-
/* @__PURE__ */ _(a, {
|
|
71
|
-
onLoading: L,
|
|
72
|
-
onLoaded: R,
|
|
73
|
-
pageNumber: x
|
|
74
|
-
}),
|
|
75
|
-
A && O && /* @__PURE__ */ _("div", {
|
|
76
|
-
className: y["rp-loader-wrapper"],
|
|
77
|
-
children: /* @__PURE__ */ _(O, {})
|
|
78
|
-
}),
|
|
79
|
-
/* @__PURE__ */ _(l, { pageNumber: x }),
|
|
80
|
-
E && /* @__PURE__ */ _(o, { pageNumber: x }),
|
|
81
|
-
/* @__PURE__ */ _(c, {
|
|
82
|
-
pageNumber: x,
|
|
83
|
-
viewport: N
|
|
84
|
-
}),
|
|
85
|
-
/* @__PURE__ */ _(s, { pageNumber: x })
|
|
86
|
-
]
|
|
87
|
-
})
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
//#endregion
|
|
91
|
-
export { b as t };
|