@react-pdf-kit/viewer 2.8.0-beta.0 → 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.
Files changed (205) hide show
  1. package/README.md +44 -30
  2. package/dist/{AnnotationLayer-C6UTOVmc.js → AnnotationLayer-CyOYh0Tw.js} +2 -2
  3. package/dist/{Button-BNlmxWrV.js → Button-DBu3SaMk.js} +1 -1
  4. package/dist/CanvasLayer-CJqCJ30J.js +111 -0
  5. package/dist/{Checkbox-Brta-YKG.js → Checkbox-CSIEUyO8.js} +4 -4
  6. package/dist/{Combination-DqNkTtir.js → Combination-11kyhTGt.js} +15 -15
  7. package/dist/Container-BuamPhw4.js +18 -0
  8. package/dist/{DocumentDialog-C9G7lVTh.js → DocumentDialog-cRr9sSSH.js} +4 -4
  9. package/dist/{DropDown-DikL-krI.js → DropDown-CM6xEwZC.js} +2 -2
  10. package/dist/{Input-DjSWOjCI.js → Input-Dpo1Xfxe.js} +1 -1
  11. package/dist/{LoaderIcon-D9YjinGf.js → LoaderIcon-B3ddfd0D.js} +1 -1
  12. package/dist/{LoadingIndicator-DiWoWs4Y.js → LoadingIndicator-0E8WHnSN.js} +8 -8
  13. package/dist/MenuItem-lItnKNd5.js +31 -0
  14. package/dist/{MenuSeparator-D1H5l8Ej.js → MenuSeparator-CaFxd8b5.js} +1 -1
  15. package/dist/Paginate.module-DhE7N8AA.js +9 -0
  16. package/dist/PaginationContext-DIzsZhFd.js +194 -0
  17. package/dist/{PasswordModal-BIr84lGN.js → PasswordModal-CxHFn0pB.js} +13 -13
  18. package/dist/{RPDropFileZone-D1C3ouep.js → RPDropFileZone-Bq1bzWmO.js} +1 -1
  19. package/dist/RPLayout.module-BH5r8dDc.js +14 -0
  20. package/dist/RPPages-U8QNLlIa.js +686 -0
  21. package/dist/{RPTooltip-ZZoFqP7C.js → RPTooltip-QWwWh4HW.js} +127 -95
  22. package/dist/SearchTool.module-DY8Ucfb_.js +17 -0
  23. package/dist/{SkipLink-CdcjClGB.js → SkipLink-Dj83gZdk.js} +3 -3
  24. package/dist/{TextLayer-DWGFN9SF.js → TextLayer-D-V9kogG.js} +5 -5
  25. package/dist/{Thumbnail-CU1p9tZ6.js → Thumbnail-BXMk0OWF.js} +8 -8
  26. package/dist/{Thumbnails-VMbfTvqt.js → Thumbnails-BIuN8LZ8.js} +2 -2
  27. package/dist/assets/AnnotationLayer.css +1 -1
  28. package/dist/assets/CanvasLayer.css +1 -0
  29. package/dist/assets/LoadingIndicator.css +1 -1
  30. package/dist/assets/MenuItem.css +1 -1
  31. package/dist/assets/Paginate.css +1 -1
  32. package/dist/assets/PasswordModal.css +1 -1
  33. package/dist/assets/RPLayout.css +1 -1
  34. package/dist/assets/RPPages.css +1 -1
  35. package/dist/assets/SearchTool.css +1 -1
  36. package/dist/assets/SkipLink.css +1 -1
  37. package/dist/assets/TextLayer.css +1 -1
  38. package/dist/assets/Thumbnail.css +1 -1
  39. package/dist/assets/style.js +1 -1
  40. package/dist/{clsx-B7LyVm5O.js → clsx-DSGuh5YW.js} +1 -1
  41. package/dist/components/RPController.js +39 -39
  42. package/dist/components/RPDropFileZone.js +1 -1
  43. package/dist/components/RPPages.js +1 -1
  44. package/dist/components/RPProvider.js +1 -1
  45. package/dist/components/icons/LoaderIcon.js +1 -1
  46. package/dist/components/layout/Container.js +1 -1
  47. package/dist/components/layout/LayoutContainer.js +7 -7
  48. package/dist/components/layout/LayoutWrapper.js +5 -5
  49. package/dist/components/layout/RPDefaultLayout.js +56 -55
  50. package/dist/components/layout/RPLayout.js +39 -38
  51. package/dist/components/layout/SkipLink.js +1 -1
  52. package/dist/components/layout/sidebar/RPSidebar.js +3 -3
  53. package/dist/components/layout/sidebar/Thumbnail.js +1 -1
  54. package/dist/components/layout/sidebar/Thumbnails.js +1 -1
  55. package/dist/components/layout/toolbar/DarkModeTool.js +2 -2
  56. package/dist/components/layout/toolbar/DocumentDialog.js +1 -1
  57. package/dist/components/layout/toolbar/DocumentProperties.js +7 -7
  58. package/dist/components/layout/toolbar/FileDownloadTool.js +7 -7
  59. package/dist/components/layout/toolbar/FileUploadTool.js +7 -7
  60. package/dist/components/layout/toolbar/FullScreenTool.js +10 -9
  61. package/dist/components/layout/toolbar/MenuItem.js +1 -1
  62. package/dist/components/layout/toolbar/MenuSeparator.js +1 -1
  63. package/dist/components/layout/toolbar/MostPageTool.js +25 -31
  64. package/dist/components/layout/toolbar/OtherTool.js +6 -6
  65. package/dist/components/layout/toolbar/Paginate.js +20 -5
  66. package/dist/components/layout/toolbar/PrintTool.js +7 -7
  67. package/dist/components/layout/toolbar/RPMenuItem.js +3 -3
  68. package/dist/components/layout/toolbar/RPMoreOptions.js +6 -6
  69. package/dist/components/layout/toolbar/RPToolbar.js +1 -1
  70. package/dist/components/layout/toolbar/RotateTool.js +12 -12
  71. package/dist/components/layout/toolbar/ScrollModeTool.js +18 -18
  72. package/dist/components/layout/toolbar/SearchCloseButton.js +3 -3
  73. package/dist/components/layout/toolbar/SearchResultNavigator.js +3 -3
  74. package/dist/components/layout/toolbar/SearchTool.js +134 -122
  75. package/dist/components/layout/toolbar/SelectionModeTool.js +12 -12
  76. package/dist/components/layout/toolbar/ThumbnailTool.js +2 -2
  77. package/dist/components/layout/toolbar/ToolbarCustom.js +2 -2
  78. package/dist/components/layout/toolbar/ToolbarDefault.js +2 -2
  79. package/dist/components/layout/toolbar/ViewModeTool.js +18 -18
  80. package/dist/components/layout/toolbar/ZoomTool.js +86 -84
  81. package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +3 -3
  82. package/dist/components/layout/toolbar/tools/DualPageTool.js +2 -2
  83. package/dist/components/layout/toolbar/tools/DualPageWithCoverTool.js +1 -1
  84. package/dist/components/layout/toolbar/tools/FileDownloadTool.js +2 -2
  85. package/dist/components/layout/toolbar/tools/FileUploadTool.js +2 -2
  86. package/dist/components/layout/toolbar/tools/FirstPageTool.js +1 -1
  87. package/dist/components/layout/toolbar/tools/FullScreenTool.js +2 -2
  88. package/dist/components/layout/toolbar/tools/HorizontalScrollingTool.js +4 -4
  89. package/dist/components/layout/toolbar/tools/InputPageTool.js +37 -26
  90. package/dist/components/layout/toolbar/tools/LastPageTool.js +1 -1
  91. package/dist/components/layout/toolbar/tools/NextPageTool.js +3 -3
  92. package/dist/components/layout/toolbar/tools/PageScrollingTool.js +2 -2
  93. package/dist/components/layout/toolbar/tools/PreviousPageTool.js +3 -3
  94. package/dist/components/layout/toolbar/tools/PrintTool.js +2 -2
  95. package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +2 -2
  96. package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +2 -2
  97. package/dist/components/layout/toolbar/tools/SelectionModeSwitcherTool.js +2 -2
  98. package/dist/components/layout/toolbar/tools/SinglePageTool.js +2 -2
  99. package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +2 -2
  100. package/dist/components/layout/toolbar/tools/ThumbnailTool.js +2 -2
  101. package/dist/components/layout/toolbar/tools/VerticalScrollingTool.js +2 -2
  102. package/dist/components/layout/toolbar/tools/ZoomInTool.js +25 -23
  103. package/dist/components/layout/toolbar/tools/ZoomLevelDisplay.js +1 -1
  104. package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +6 -6
  105. package/dist/components/layout/toolbar/tools/ZoomOutTool.js +25 -23
  106. package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +2 -2
  107. package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +2 -2
  108. package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +2 -2
  109. package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +2 -2
  110. package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +5 -5
  111. package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +2 -2
  112. package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +4 -4
  113. package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +8 -8
  114. package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +4 -4
  115. package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +4 -4
  116. package/dist/components/page/AnnotationLayer.js +1 -1
  117. package/dist/components/page/CanvasLayer.js +2 -48
  118. package/dist/components/page/DualPage.js +2 -2
  119. package/dist/components/page/DualPageWithCover.js +2 -2
  120. package/dist/components/page/RPPage.js +94 -2
  121. package/dist/components/page/SinglePage.js +2 -2
  122. package/dist/components/page/TextHighlightLayer.js +1 -1
  123. package/dist/components/page/TextLayer.js +1 -1
  124. package/dist/components/ui/Button.js +1 -1
  125. package/dist/components/ui/Checkbox.js +1 -1
  126. package/dist/components/ui/DropDown.js +1 -1
  127. package/dist/components/ui/Input.js +1 -1
  128. package/dist/components/ui/LoadingIndicator.js +1 -1
  129. package/dist/components/ui/PasswordModal.js +1 -1
  130. package/dist/components/ui/RPTooltip.js +1 -1
  131. package/dist/contexts/DimensionPagesContext.js +38 -22
  132. package/dist/contexts/ElementPageContext.js +46 -39
  133. package/dist/contexts/ElementThumbnailContext.js +1 -1
  134. package/dist/contexts/LoaderContext.js +1 -1
  135. package/dist/contexts/LocalizationContext.js +12 -6
  136. package/dist/contexts/PaginationContext.js +1 -1
  137. package/dist/contexts/RenderQueueProvider.js +26 -18
  138. package/dist/contexts/RenderedPagesCache.js +32 -13
  139. package/dist/contexts/VirtualScrollContext.js +10 -13
  140. package/dist/contexts/ZoomContext.js +119 -61
  141. package/dist/{de_DE--0LF-SJR.js → de_DE-x4Z-jQrz.js} +54 -6
  142. package/dist/{dist-7FA4Do6I.js → dist-B2hwhF6G.js} +7 -7
  143. package/dist/{dist-BRVqFn7R.js → dist-BfuBBQ14.js} +6 -6
  144. package/dist/{dist-C3WNMuW2.js → dist-CNbFpoT1.js} +2 -2
  145. package/dist/{dist-bK-AHWLF.js → dist-CgoP608h.js} +7 -7
  146. package/dist/{dist-CKteKPPA.js → dist-VbpVNBs6.js} +7 -7
  147. package/dist/icons.js +1 -1
  148. package/dist/{lib-BiapEtK1.js → lib-CSInlR9T.js} +142 -237
  149. package/dist/{main-B74-PfMa.js → main-DCzVrq0G.js} +3 -3
  150. package/dist/main.js +5 -5
  151. package/dist/style-CJtyyrJx.js +5 -0
  152. package/dist/types/components/page/CanvasLayer.d.ts +4 -1
  153. package/dist/types/components/ui/RPTooltip.d.ts +3 -2
  154. package/dist/types/contexts/RenderQueueProvider.d.ts +2 -0
  155. package/dist/types/contexts/RenderedPagesCache.d.ts +3 -0
  156. package/dist/types/contexts/VirtualScrollContext.d.ts +0 -3
  157. package/dist/types/locales/de_DE.json.d.ts +11 -2
  158. package/dist/types/locales/en_US.json.d.ts +11 -2
  159. package/dist/types/locales/it_IT.json.d.ts +11 -2
  160. package/dist/types/locales/pt_PT.json.d.ts +11 -2
  161. package/dist/types/locales/th_TH.json.d.ts +11 -2
  162. package/dist/types/locales/zh_CN.json.d.ts +11 -2
  163. package/dist/types/utils/Queue.d.ts +1 -0
  164. package/dist/types/utils/const.d.ts +3 -0
  165. package/dist/types/utils/constants.d.ts +9 -0
  166. package/dist/types/utils/documentLayout.d.ts +60 -0
  167. package/dist/types/utils/hooks/usePinch.d.ts +14 -1
  168. package/dist/types/utils/hooks/usePresentPage.d.ts +2 -2
  169. package/dist/types/utils/hooks/useZoomOrigin.d.ts +4 -0
  170. package/dist/types/utils/types.d.ts +25 -2
  171. package/dist/types/utils/zoom.d.ts +2 -0
  172. package/dist/utils/Queue.js +5 -0
  173. package/dist/utils/const.js +2 -2
  174. package/dist/utils/constants.js +2 -2
  175. package/dist/utils/documentLayout.js +141 -0
  176. package/dist/utils/hooks/useLicense.js +2 -2
  177. package/dist/utils/hooks/useLoadPdf.js +73 -63
  178. package/dist/utils/hooks/useLocalization.js +1 -1
  179. package/dist/utils/hooks/usePaginate.js +1 -1
  180. package/dist/utils/hooks/usePinch.js +109 -56
  181. package/dist/utils/hooks/usePresentPage.js +33 -57
  182. package/dist/utils/hooks/useScrollToPage.js +1 -1
  183. package/dist/utils/hooks/useSearch.js +66 -67
  184. package/dist/utils/hooks/useZoomOrigin.js +37 -0
  185. package/dist/utils/renderPage.js +21 -14
  186. package/dist/utils/types.js +3 -3
  187. package/dist/utils/zoom.js +8 -2
  188. package/package.json +1 -1
  189. package/dist/Container-DTWaZzc7.js +0 -16
  190. package/dist/MenuItem-BJDWfzAw.js +0 -15
  191. package/dist/Paginate.module-B0GMw-MB.js +0 -8
  192. package/dist/PaginationContext-C5CJiEW-.js +0 -242
  193. package/dist/RPLayout.module-Vc3h4xxS.js +0 -14
  194. package/dist/RPPage-BsDixmqF.js +0 -91
  195. package/dist/RPPages-BkEFexWu.js +0 -1007
  196. package/dist/SearchTool.module-DUkVXfOn.js +0 -16
  197. package/dist/assets/RPPage.css +0 -1
  198. package/dist/contexts/VirtualGridContext.js +0 -18
  199. package/dist/style-BPQRJJJ7.js +0 -5
  200. package/dist/types/contexts/VirtualGridContext.d.ts +0 -9
  201. package/dist/types/utils/calculatePage.d.ts +0 -12
  202. package/dist/types/utils/hooks/useVirtualReactWindow.d.ts +0 -17
  203. package/dist/utils/calculatePage.js +0 -30
  204. package/dist/utils/hooks/useVirtualReactWindow.js +0 -86
  205. /package/dist/{TextHighlightLayer-BSVgBxR3.js → TextHighlightLayer-3vIZbRyL.js} +0 -0
@@ -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 };
@@ -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 };