@react-pdf-kit/viewer 2.0.0-beta.10 → 2.0.0-beta.12

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 (181) hide show
  1. package/dist/{Combination-54a77a7a.js → Combination-136ff99c.js} +184 -187
  2. package/dist/Paginate.module-4eef00aa.js +8 -0
  3. package/dist/RPLayout.module-b4b23e29.js +14 -0
  4. package/dist/RPSplitter-f6acf13b.js +71 -0
  5. package/dist/ToolbarLayout.module-6e339802.js +12 -0
  6. package/dist/assets/style.css +1 -1
  7. package/dist/assets/style.js +32 -30
  8. package/dist/components/RPController.js +1 -1
  9. package/dist/components/RPDropFileZone.js +1 -1
  10. package/dist/components/RPPages.js +544 -497
  11. package/dist/components/RPProvider.js +32 -22
  12. package/dist/components/icons/DualPageWithCoverIcon.js +22 -0
  13. package/dist/components/layout/LayoutContainer.js +1 -1
  14. package/dist/components/layout/LayoutWrapper.js +1 -1
  15. package/dist/components/layout/RPDefaultLayout.js +58 -36
  16. package/dist/components/layout/RPLayout.js +32 -28
  17. package/dist/components/layout/SkipLink.js +29 -0
  18. package/dist/components/layout/WrapperLayout.js +1 -1
  19. package/dist/components/layout/sidebar/RPSidebar.js +32 -37
  20. package/dist/components/layout/sidebar/RPSplitter.js +6 -59
  21. package/dist/components/layout/sidebar/Thumbnail.js +57 -48
  22. package/dist/components/layout/sidebar/Thumbnails.js +9 -9
  23. package/dist/components/layout/toolbar/DarkModeTool.js +1 -1
  24. package/dist/components/layout/toolbar/DocumentDialog.js +28 -28
  25. package/dist/components/layout/toolbar/DocumentProperties.js +3 -3
  26. package/dist/components/layout/toolbar/FileDownloadTool.js +3 -3
  27. package/dist/components/layout/toolbar/FileUploadTool.js +3 -3
  28. package/dist/components/layout/toolbar/FullScreenTool.js +3 -3
  29. package/dist/components/layout/toolbar/MenuItem.js +2 -2
  30. package/dist/components/layout/toolbar/MenuSeparator.js +2 -2
  31. package/dist/components/layout/toolbar/MostPageTool.js +3 -3
  32. package/dist/components/layout/toolbar/OtherTool.js +43 -34
  33. package/dist/components/layout/toolbar/Paginate.js +53 -46
  34. package/dist/components/layout/toolbar/PrintTool.js +3 -3
  35. package/dist/components/layout/toolbar/RPMenuItem.js +2 -2
  36. package/dist/components/layout/toolbar/RPMoreOptions.js +45 -44
  37. package/dist/components/layout/toolbar/RPToolbar.js +7 -6
  38. package/dist/components/layout/toolbar/RPToolbarEnd.js +6 -5
  39. package/dist/components/layout/toolbar/RotateTool.js +3 -3
  40. package/dist/components/layout/toolbar/ScrollModeTool.js +37 -37
  41. package/dist/components/layout/toolbar/SearchCloseButton.js +1 -1
  42. package/dist/components/layout/toolbar/SearchResultNavigator.js +44 -24
  43. package/dist/components/layout/toolbar/SearchTool.js +138 -117
  44. package/dist/components/layout/toolbar/SelectionModeTool.js +3 -3
  45. package/dist/components/layout/toolbar/ThumbnailTool.js +1 -1
  46. package/dist/components/layout/toolbar/ToolbarCustom.js +43 -27
  47. package/dist/components/layout/toolbar/ToolbarDefault.js +42 -33
  48. package/dist/components/layout/toolbar/ToolbarLayout.js +9 -8
  49. package/dist/components/layout/toolbar/ViewModeTool.js +43 -34
  50. package/dist/components/layout/toolbar/ZoomTool.js +3 -3
  51. package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +2 -2
  52. package/dist/components/layout/toolbar/tools/DualPageTool.js +3 -3
  53. package/dist/components/layout/toolbar/tools/DualPageWithCoverTool.js +202 -0
  54. package/dist/components/layout/toolbar/tools/FileDownloadTool.js +6 -6
  55. package/dist/components/layout/toolbar/tools/FileUploadTool.js +5 -5
  56. package/dist/components/layout/toolbar/tools/FirstPageTool.js +197 -0
  57. package/dist/components/layout/toolbar/tools/FullScreenTool.js +16 -15
  58. package/dist/components/layout/toolbar/tools/HorizontalScrollingTool.js +37 -0
  59. package/dist/components/layout/toolbar/tools/InputPageTool.js +35 -28
  60. package/dist/components/layout/toolbar/tools/LastPageTool.js +197 -0
  61. package/dist/components/layout/toolbar/tools/NextPageTool.js +9 -8
  62. package/dist/components/layout/toolbar/tools/PageScrollingTool.js +37 -0
  63. package/dist/components/layout/toolbar/tools/PreviousPageTool.js +15 -14
  64. package/dist/components/layout/toolbar/tools/PrintTool.js +4 -4
  65. package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +12 -5
  66. package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +9 -9
  67. package/dist/components/layout/toolbar/tools/SelectionModeSwitcherTool.js +18 -10
  68. package/dist/components/layout/toolbar/tools/SinglePageTool.js +2 -2
  69. package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +10 -2
  70. package/dist/components/layout/toolbar/tools/ThumbnailTool.js +13 -12
  71. package/dist/components/layout/toolbar/tools/VerticalScrollingTool.js +37 -0
  72. package/dist/components/layout/toolbar/tools/ZoomInTool.js +15 -14
  73. package/dist/components/layout/toolbar/tools/ZoomLevelDisplay.js +1 -1
  74. package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +75 -41
  75. package/dist/components/layout/toolbar/tools/ZoomOutTool.js +12 -11
  76. package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +7 -6
  77. package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +1 -1
  78. package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +11 -11
  79. package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +22 -15
  80. package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +20 -13
  81. package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +22 -14
  82. package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +35 -19
  83. package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +21 -14
  84. package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +33 -19
  85. package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +54 -36
  86. package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +39 -23
  87. package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +52 -29
  88. package/dist/components/page/AnnotationLayer.js +76 -69
  89. package/dist/components/page/CanvasLayer.js +1 -1
  90. package/dist/components/page/CustomElement.js +1 -1
  91. package/dist/components/page/DualPage.js +1 -1
  92. package/dist/components/page/DualPageWithCover.js +131 -0
  93. package/dist/components/page/RPPage.js +1 -1
  94. package/dist/components/page/SinglePage.js +1 -1
  95. package/dist/components/page/TextHighlightLayer.js +1 -1
  96. package/dist/components/page/TextLayer.js +1 -1
  97. package/dist/components/ui/Button.js +14 -12
  98. package/dist/components/ui/Checkbox.js +84 -77
  99. package/dist/components/ui/DropDown.js +2 -2
  100. package/dist/components/ui/Input.js +12 -11
  101. package/dist/components/ui/LoadingIndicator.js +1 -1
  102. package/dist/components/ui/PasswordModal.js +44 -30
  103. package/dist/contexts/DimensionPagesContext.js +1 -1
  104. package/dist/contexts/DropFileZoneContext.js +1 -1
  105. package/dist/contexts/ElementPageContext.js +1 -1
  106. package/dist/contexts/EventCallbackContext.js +12 -8
  107. package/dist/contexts/FileInputContext.js +1 -1
  108. package/dist/contexts/HighlightContext.js +1 -1
  109. package/dist/contexts/LocalizationContext.js +1 -1
  110. package/dist/contexts/PagesRotateContext.js +1 -1
  111. package/dist/contexts/PaginationContext.js +1 -1
  112. package/dist/contexts/PrintContext.js +1 -1
  113. package/dist/contexts/RPDocumentContext.js +1 -1
  114. package/dist/contexts/RenderQueueProvider.js +1 -1
  115. package/dist/contexts/RotationContext.js +1 -1
  116. package/dist/contexts/ScrollModeContext.js +1 -1
  117. package/dist/contexts/SearchContext.js +1 -1
  118. package/dist/contexts/SelectionModeContext.js +1 -1
  119. package/dist/contexts/ThumbnailsContext.js +1 -1
  120. package/dist/contexts/ViewModeContext.js +19 -15
  121. package/dist/contexts/ZoomContext.js +1 -1
  122. package/dist/de_DE-a553b162.js +489 -0
  123. package/dist/{index-4baea9b5.js → index-61f59539.js} +1 -1
  124. package/dist/main.js +115 -99
  125. package/dist/types/components/icons/DualPageWithCoverIcon.d.ts +2 -0
  126. package/dist/types/components/layout/LayoutContainer.d.ts +1 -5
  127. package/dist/types/components/layout/LayoutWrapper.d.ts +1 -5
  128. package/dist/types/components/layout/SkipLink.d.ts +7 -0
  129. package/dist/types/components/layout/sidebar/Thumbnails.d.ts +1 -3
  130. package/dist/types/components/layout/toolbar/RPToolbar.d.ts +1 -3
  131. package/dist/types/components/layout/toolbar/tools/DualPageWithCoverTool.d.ts +3 -0
  132. package/dist/types/components/layout/toolbar/tools/FirstPageTool.d.ts +3 -0
  133. package/dist/types/components/layout/toolbar/tools/HorizontalScrollingTool.d.ts +3 -0
  134. package/dist/types/components/layout/toolbar/tools/LastPageTool.d.ts +3 -0
  135. package/dist/types/components/layout/toolbar/tools/PageScrollingTool.d.ts +3 -0
  136. package/dist/types/components/layout/toolbar/tools/VerticalScrollingTool.d.ts +3 -0
  137. package/dist/types/components/page/DualPageWithCover.d.ts +5 -0
  138. package/dist/types/components/page/RPPage.d.ts +1 -3
  139. package/dist/types/components/ui/Button.d.ts +1 -3
  140. package/dist/types/components/ui/Checkbox.d.ts +1 -0
  141. package/dist/types/components/ui/Input.d.ts +1 -3
  142. package/dist/types/components/ui/RPTooltip.d.ts +1 -3
  143. package/dist/types/locales/de_DE.json.d.ts +83 -0
  144. package/dist/types/locales/en_US.json.d.ts +2 -0
  145. package/dist/types/locales/it_IT.json.d.ts +2 -0
  146. package/dist/types/locales/pt_PT.json.d.ts +2 -0
  147. package/dist/types/locales/th_TH.json.d.ts +2 -0
  148. package/dist/types/locales/zh_CN.json.d.ts +2 -0
  149. package/dist/types/main.d.ts +7 -1
  150. package/dist/types/utils/annotations.d.ts +10 -1
  151. package/dist/types/utils/calculatePage.d.ts +3 -3
  152. package/dist/types/utils/hooks/usePresentPage.d.ts +2 -1
  153. package/dist/types/utils/hooks/useTextSelection.d.ts +7 -0
  154. package/dist/types/utils/types.d.ts +34 -3
  155. package/dist/types/utils/withRef.d.ts +5 -4
  156. package/dist/utils/annotations.js +145 -150
  157. package/dist/utils/calculatePage.js +17 -11
  158. package/dist/utils/getZoomLevel.js +9 -9
  159. package/dist/utils/highlight.js +139 -139
  160. package/dist/utils/hooks/useFileDownload.js +1 -1
  161. package/dist/utils/hooks/useLicense.js +1 -1
  162. package/dist/utils/hooks/useLoadPdf.js +1 -1
  163. package/dist/utils/hooks/useLocalization.js +12 -11
  164. package/dist/utils/hooks/usePageRotateContext.js +1 -1
  165. package/dist/utils/hooks/usePaginate.js +1 -1
  166. package/dist/utils/hooks/usePinch.js +1 -1
  167. package/dist/utils/hooks/usePresentPage.js +45 -45
  168. package/dist/utils/hooks/usePrint.js +1 -1
  169. package/dist/utils/hooks/useRotate.js +1 -1
  170. package/dist/utils/hooks/useScrollToPage.js +1 -1
  171. package/dist/utils/hooks/useSearch.js +76 -62
  172. package/dist/utils/hooks/useTextSelection.js +76 -0
  173. package/dist/utils/hooks/useThumbnail.js +1 -1
  174. package/dist/utils/hooks/useVirtualReactWindow.js +60 -42
  175. package/dist/utils/types.js +14 -13
  176. package/dist/utils/withRef.js +5 -5
  177. package/package.json +5 -6
  178. package/dist/Paginate.module-206a7d7d.js +0 -8
  179. package/dist/RPLayout.module-967bf4bc.js +0 -13
  180. package/dist/ToolbarLayout.module-1fee0a18.js +0 -11
  181. package/dist/th_TH-d627cd51.js +0 -398
@@ -1,18 +1,18 @@
1
- import { useState as P, useRef as b, useMemo as V, useCallback as d, useEffect as Z } from "react";
2
- import { ScrollMode as E } from "../types.js";
3
- import { findMatches as et } from "../highlight.js";
4
- import { useVirtualScrollContext as ot } from "../../contexts/VirtualScrollContext.js";
5
- import { useScrollModeContext as rt } from "../../contexts/ScrollModeContext.js";
6
- import { useDocumentContext as nt } from "../../contexts/RPDocumentContext.js";
7
- import { useZoomContext as st } from "../../contexts/ZoomContext.js";
8
- import { u as ct } from "../../PaginationContext-9217cab4.js";
9
- import { useViewModeContext as it } from "../../contexts/ViewModeContext.js";
10
- import { useDimensionPagesContext as at } from "../../contexts/DimensionPagesContext.js";
11
- import { useLayoutContainer as mt } from "../../contexts/LayoutContainerContext.js";
12
- import { getScrollDistance as _ } from "../getScrollDistance.js";
13
- import { getWordPositionInPage as ut } from "../getWordPositionInPage.js";
14
- import { usePagesRotateContext as pt } from "../../contexts/PagesRotateContext.js";
15
- import "../../th_TH-d627cd51.js";
1
+ import { useState as C, useRef as b, useMemo as H, useCallback as I, useEffect as z } from "react";
2
+ import { ScrollMode as N, ViewMode as rt } from "../types.js";
3
+ import { findMatches as nt } from "../highlight.js";
4
+ import { useVirtualScrollContext as st } from "../../contexts/VirtualScrollContext.js";
5
+ import { useScrollModeContext as ct } from "../../contexts/ScrollModeContext.js";
6
+ import { useDocumentContext as it } from "../../contexts/RPDocumentContext.js";
7
+ import { useZoomContext as at } from "../../contexts/ZoomContext.js";
8
+ import { u as mt } from "../../PaginationContext-9217cab4.js";
9
+ import { useViewModeContext as ut } from "../../contexts/ViewModeContext.js";
10
+ import { useDimensionPagesContext as pt } from "../../contexts/DimensionPagesContext.js";
11
+ import { useLayoutContainer as lt } from "../../contexts/LayoutContainerContext.js";
12
+ import { getScrollDistance as F } from "../getScrollDistance.js";
13
+ import { getWordPositionInPage as ft } from "../getWordPositionInPage.js";
14
+ import { usePagesRotateContext as gt } from "../../contexts/PagesRotateContext.js";
15
+ import "../../de_DE-a553b162.js";
16
16
  import "../charators.js";
17
17
  import "react/jsx-runtime";
18
18
  import "../appConsole.js";
@@ -35,114 +35,128 @@ import "../../contexts/VirtualGridContext.js";
35
35
  import "../smoothScrollTo.js";
36
36
  import "../../contexts/SmoothScrollContext.js";
37
37
  import "../calculatePage.js";
38
- const Qt = (N = {}, k = "") => {
39
- const [u, v] = P(k), [W, T] = P(!1), { pdf: y, pages: C } = nt(), { widths: f, heights: S } = at(), I = b(!u), { currentZoom: j } = st(), [s, g] = P([]), { setFocusedPage: O } = ct(), { columnCount: z } = it(), { pageRotate: F } = pt(), [c, i] = P(0), { pageScrollElementRef: D, virtualScrollableElementRef: G } = ot(), { scrollMode: h } = rt(), { pagesRef: R } = mt(), H = b({}), m = b(0), q = V(() => c === 0 ? null : s[c - 1], [c, s]), a = V(() => s.length, [s]), p = d(
38
+ const Yt = (O = {}, U = "") => {
39
+ const [u, q] = C(U), [B, y] = C(!1), { pdf: _, pages: S } = it(), { widths: f, heights: R } = pt(), w = b(!u), { currentZoom: A } = at(), [s, g] = C([]), { setFocusedPage: D } = mt(), { columnCount: G, viewMode: V } = ut(), { pageRotate: v } = gt(), [c, i] = C(0), { pageScrollElementRef: W, virtualScrollableElementRef: Z } = st(), { scrollMode: h } = ct(), { pagesRef: L } = lt(), J = b({}), m = b(0), K = H(() => c === 0 ? null : s[c - 1], [c, s]), a = H(() => s.length, [s]), p = I(
40
40
  (e) => {
41
41
  if (e === 0)
42
42
  return;
43
43
  const t = s[e - 1];
44
- if (!t || !C)
44
+ if (!t || !S)
45
45
  return;
46
- const o = G || D;
47
- if (!o || !R)
46
+ const o = Z || W;
47
+ if (!o || !L)
48
48
  return;
49
- const r = C.get(t.page);
50
- if (h === E.PAGE_SCROLLING && O(t.page), !r)
49
+ const r = S.get(t.page);
50
+ if (h === N.PAGE_SCROLLING && D(t.page), !r)
51
51
  return;
52
52
  let n = 0, l = 0;
53
- if (h === E.VERTICAL_SCROLLING) {
54
- const x = t.page - 1, M = z, $ = x % M, tt = Math.floor(x / M);
55
- n = _(S, tt), l = _(f, $);
53
+ if (h === N.VERTICAL_SCROLLING) {
54
+ const d = t.page - 1, M = G;
55
+ let x, P;
56
+ if (V === rt.DUAL_PAGE_WITH_COVER)
57
+ if (t.page === 1)
58
+ x = 0, P = 0;
59
+ else {
60
+ const k = t.page - 2;
61
+ x = k % 2, P = Math.floor(k / 2) + 1;
62
+ }
63
+ else
64
+ x = d % M, P = Math.floor(d / M);
65
+ n = F(R, P), l = F(f, x);
56
66
  }
57
- h === E.HORIZONTAL_SCROLLING && (l = f.slice(0, t.page - 1).reduce((x, M) => x + M, 0));
58
- const L = {
59
- height: S[t.page - 1],
67
+ h === N.HORIZONTAL_SCROLLING && (l = f.slice(0, t.page - 1).reduce((d, M) => d + M, 0));
68
+ const E = {
69
+ height: R[t.page - 1],
60
70
  width: f[t.page - 1]
61
- }, w = F[t.page], { leftInPage: K, topInPage: Q } = ut(
71
+ }, T = v[t.page], { leftInPage: Y, topInPage: $ } = ft(
72
+ E,
62
73
  L,
63
- R,
64
74
  t.rect,
65
- j,
66
- w
67
- ), U = l + K, X = n + Q, Y = {
68
- left: Math.max(U, 0),
69
- top: Math.max(X, 0)
75
+ A,
76
+ T
77
+ ), tt = l + Y, et = n + $, ot = {
78
+ left: Math.max(tt, 0),
79
+ top: Math.max(et, 0)
70
80
  };
71
81
  o.scrollTo({
72
- ...Y,
82
+ ...ot,
73
83
  behavior: "smooth"
74
84
  });
75
85
  },
76
86
  [
77
- C,
78
- O,
79
- f,
80
87
  S,
81
- h,
82
- G,
83
88
  D,
89
+ f,
84
90
  R,
85
- s
91
+ h,
92
+ V,
93
+ G,
94
+ Z,
95
+ W,
96
+ L,
97
+ s,
98
+ A,
99
+ v
86
100
  ]
87
101
  );
88
- Z(() => {
102
+ z(() => {
89
103
  c && p(c);
90
104
  }, [c]);
91
- const B = d(() => {
105
+ const Q = I(() => {
92
106
  i((e) => {
93
107
  let t;
94
108
  return a ? e + 1 > a ? t = 1 : t = e + 1 : t = 0, m.current = t, t;
95
109
  }), m.current === 1 && p(m.current);
96
- }, [a, p]), J = d(() => {
110
+ }, [a, p]), X = I(() => {
97
111
  i((e) => {
98
112
  let t;
99
113
  return a ? e - 1 <= 0 ? t = a : t = e - 1 : t = 0, m.current = t, t;
100
114
  }), m.current === 1 && p(m.current);
101
- }, [a, p]), A = d(async (e) => {
115
+ }, [a, p]), j = I(async (e) => {
102
116
  if (!e)
103
117
  return {};
104
118
  const t = e.numPages, o = {};
105
119
  for (let r = 1; r <= t; r++) {
106
- if (I.current)
120
+ if (w.current)
107
121
  throw "close pop over";
108
122
  const n = await e.getPage(r);
109
123
  o[r.toString()] = await n.getTextContent();
110
124
  }
111
125
  return o;
112
126
  }, []);
113
- return Z(() => {
127
+ return z(() => {
114
128
  if (!u) {
115
- I.current = !0, g([]), i(0);
129
+ w.current = !0, g([]), i(0);
116
130
  return;
117
131
  }
118
- I.current = !1, T(!0), g([]), i(0), A(y).then((e) => {
119
- H.current = e;
132
+ w.current = !1, y(!0), g([]), i(0), j(_).then((e) => {
133
+ J.current = e;
120
134
  const o = Object.keys(e).reduce((r, n) => {
121
- const l = et(
135
+ const l = nt(
122
136
  [u],
123
137
  e[n],
124
138
  Number(n) - 1,
125
- N
126
- ).map((L, w) => ({ ...L, page: Number(n), pageMatchIdx: w }));
139
+ O
140
+ ).map((E, T) => ({ ...E, page: Number(n), pageMatchIdx: T }));
127
141
  return [...r, ...l];
128
142
  }, []);
129
143
  g(o), i(o.length ? 1 : 0);
130
144
  }).catch(() => {
131
145
  g([]), i(0);
132
- }).finally(() => T(!1));
133
- }, [u, A, y, N]), {
146
+ }).finally(() => y(!1));
147
+ }, [u, j, _, O]), {
134
148
  search: u,
135
- setSearch: v,
136
- loading: W,
149
+ setSearch: q,
150
+ loading: B,
137
151
  matches: s,
138
152
  totalMatches: a,
139
153
  currentMatchPosition: c,
140
- currentMatch: q,
141
- nextMatch: B,
142
- prevMatch: J,
154
+ currentMatch: K,
155
+ nextMatch: Q,
156
+ prevMatch: X,
143
157
  setCurrentMatchPosition: i
144
158
  };
145
159
  };
146
160
  export {
147
- Qt as useSearch
161
+ Yt as useSearch
148
162
  };
@@ -0,0 +1,76 @@
1
+ import { useCallback as p, useEffect as b } from "react";
2
+ const D = ({ onTextSelect: s, pagesRef: n }) => {
3
+ const f = p(() => {
4
+ const e = n == null ? void 0 : n.querySelectorAll('[data-rp$="-textLayer"]');
5
+ return e ? Array.from(e) : [];
6
+ }, [n]), N = p(() => {
7
+ const e = document.getSelection();
8
+ if (!e || e.rangeCount === 0 || e.toString().trim() === "")
9
+ return null;
10
+ const E = e.toString(), a = /* @__PURE__ */ new Map(), O = f();
11
+ for (let i = 0; i < e.rangeCount; i++) {
12
+ const t = e.getRangeAt(i);
13
+ O.forEach((d) => {
14
+ if (t.intersectsNode(d)) {
15
+ const g = d.getAttribute("data-rp"), T = g == null ? void 0 : g.match(/page-(\d+)-textLayer/);
16
+ if (T) {
17
+ const h = parseInt(T[1]), C = d.closest('[data-rp*="page-"]');
18
+ if (!C)
19
+ return;
20
+ const c = C.getBoundingClientRect();
21
+ a.has(h) || a.set(h, {
22
+ rects: [],
23
+ pageRect: c
24
+ });
25
+ const y = a.get(h), _ = document.createTreeWalker(d, NodeFilter.SHOW_TEXT, null);
26
+ let u;
27
+ for (; u = _.nextNode(); )
28
+ if (t.intersectsNode(u) && u.parentElement) {
29
+ const o = document.createRange();
30
+ o.selectNodeContents(u);
31
+ const A = t.compareBoundaryPoints(Range.START_TO_START, o) > 0 ? t.startContainer : o.startContainer, B = t.compareBoundaryPoints(Range.START_TO_START, o) > 0 ? t.startOffset : o.startOffset, R = t.compareBoundaryPoints(Range.END_TO_END, o) < 0 ? t.endContainer : o.endContainer, S = t.compareBoundaryPoints(Range.END_TO_END, o) < 0 ? t.endOffset : o.endOffset, m = document.createRange();
32
+ m.setStart(A, B), m.setEnd(R, S);
33
+ const r = m.getBoundingClientRect();
34
+ if (r.width === 0 || r.height === 0)
35
+ continue;
36
+ const P = {
37
+ left: r.left - c.left,
38
+ top: r.top - c.top,
39
+ right: r.right - c.left,
40
+ bottom: r.bottom - c.top,
41
+ width: r.width,
42
+ height: r.height
43
+ };
44
+ y.rects.push(P);
45
+ }
46
+ }
47
+ }
48
+ });
49
+ }
50
+ const w = Array.from(a.entries()).sort(([i], [t]) => i - t).map(([i, t]) => ({
51
+ pageNumber: i,
52
+ pageBasedBoundingRects: t.rects,
53
+ pageDimension: {
54
+ width: t.pageRect.width,
55
+ height: t.pageRect.height
56
+ },
57
+ pagePositionInWindow: {
58
+ x: t.pageRect.left,
59
+ y: t.pageRect.top
60
+ }
61
+ }));
62
+ return {
63
+ text: E,
64
+ pageSelections: w
65
+ };
66
+ }, [f]), l = p(() => {
67
+ const e = N();
68
+ e && (s == null || s(e));
69
+ }, [N, s]);
70
+ b(() => (n == null || n.addEventListener("pointerup", l), () => {
71
+ n == null || n.removeEventListener("pointerup", l);
72
+ }), [n, l]);
73
+ };
74
+ export {
75
+ D as useTextSelection
76
+ };
@@ -5,7 +5,7 @@ import "react/jsx-runtime";
5
5
  import "./useLoadPdf.js";
6
6
  import "pdfjs-dist";
7
7
  import "../types.js";
8
- import "../../th_TH-d627cd51.js";
8
+ import "../../de_DE-a553b162.js";
9
9
  import "../../contexts/ConfigContext.js";
10
10
  import "../../contexts/DocumentPasswordContext.js";
11
11
  import "../appConsole.js";
@@ -1,12 +1,12 @@
1
- import { useMemo as i, useCallback as a, useEffect as R } from "react";
2
- import { ScrollMode as p, ViewMode as G } from "../types.js";
3
- import { useScrollModeContext as H } from "../../contexts/ScrollModeContext.js";
4
- import { useViewModeContext as O } from "../../contexts/ViewModeContext.js";
5
- import { useVirtualGridContext as S } from "../../contexts/VirtualGridContext.js";
6
- import { useVirtualScrollContext as A } from "../../contexts/VirtualScrollContext.js";
7
- import { useDimensionPagesContext as D } from "../../contexts/DimensionPagesContext.js";
8
- import { getGridDimension as P } from "../calculatePage.js";
9
- import "../../th_TH-d627cd51.js";
1
+ import { useMemo as m, useCallback as _, useEffect as R } from "react";
2
+ import { ScrollMode as C, ViewMode as g } from "../types.js";
3
+ import { useScrollModeContext as x } from "../../contexts/ScrollModeContext.js";
4
+ import { useViewModeContext as G } from "../../contexts/ViewModeContext.js";
5
+ import { useVirtualGridContext as H } from "../../contexts/VirtualGridContext.js";
6
+ import { useVirtualScrollContext as M } from "../../contexts/VirtualScrollContext.js";
7
+ import { useDimensionPagesContext as O } from "../../contexts/DimensionPagesContext.js";
8
+ import { getGridDimension as V } from "../calculatePage.js";
9
+ import "../../de_DE-a553b162.js";
10
10
  import "react/jsx-runtime";
11
11
  import "../appConsole.js";
12
12
  import "../../contexts/InitialStateContext.js";
@@ -28,51 +28,69 @@ import "../../contexts/GlobalCurrentPage.js";
28
28
  import "../../contexts/EventCallbackContext.js";
29
29
  import "./useDebounce.js";
30
30
  import "../../contexts/PagesRotateContext.js";
31
- const st = () => {
32
- const { viewMode: d } = O(), { scrollMode: n } = H(), { setColumnCount: g } = S(), { virtualScrollableElementRef: C } = A(), o = D(), s = i(() => o.heights.length, [o.heights]), r = i(() => n === p.HORIZONTAL_SCROLLING ? s : d === G.DUAL_PAGE ? 2 : 1, [d, n, n, s, C]), c = i(() => o.widths.reduce((t, l, h) => {
33
- const m = h % r;
34
- return (!t[m] || l > t[m]) && (t[m] = l), t;
35
- }, []), [o.widths, r]), f = a(
31
+ const ct = () => {
32
+ const { viewMode: n } = G(), { scrollMode: c } = x(), { setColumnCount: f } = H(), { virtualScrollableElementRef: w } = M(), t = O(), l = m(() => t.heights.length, [t.heights]), o = m(() => c === C.HORIZONTAL_SCROLLING ? l : n === g.DUAL_PAGE || n === g.DUAL_PAGE_WITH_COVER ? 2 : 1, [n, c, c, l, w]), d = m(() => {
33
+ if (n === g.DUAL_PAGE_WITH_COVER && t.widths.length > 0) {
34
+ const i = [0, 0];
35
+ return t.widths.forEach((u, a) => {
36
+ const s = a + 1;
37
+ if (s === 1)
38
+ return;
39
+ const h = s % 2 === 0 ? 0 : 1;
40
+ i[h] = Math.max(i[h] || 0, u);
41
+ }), i;
42
+ }
43
+ return t.widths.reduce((i, u, a) => {
44
+ const s = a % o;
45
+ return (!i[s] || u > i[s]) && (i[s] = u), i;
46
+ }, []);
47
+ }, [t.widths, o, n]), I = _(
36
48
  (e) => {
37
- const t = e % c.length;
38
- return c[t] || 0;
49
+ const r = e % d.length;
50
+ return d[r] || 0;
39
51
  },
40
- [c]
41
- ), w = a(
52
+ [d]
53
+ ), P = _(
42
54
  (e) => {
43
- const t = Array.from({ length: r }, (l, h) => {
44
- const m = e * r + h;
45
- return o.heights[m] || 0;
55
+ if (n === g.DUAL_PAGE_WITH_COVER) {
56
+ if (e === 0)
57
+ return t.heights[0] || 0;
58
+ const u = 1 + (e - 1) * o + 1, s = Array.from({ length: o }, (h, E) => u + E - 1).filter((h) => h < t.heights.length).map((h) => t.heights[h] || 0);
59
+ return Math.max(...s, 0);
60
+ }
61
+ const i = Array.from({ length: o }, (u, a) => {
62
+ const s = e * o + a;
63
+ return t.heights[s] || 0;
46
64
  });
47
- return Math.max(...t);
65
+ return Math.max(...i);
48
66
  },
49
- [o.heights, r]
67
+ [t.heights, o, n]
50
68
  );
51
69
  R(() => {
52
- g(r);
53
- }, [r, g]);
54
- const x = i(() => n === p.HORIZONTAL_SCROLLING || n === p.PAGE_SCROLLING ? 1 : Math.round(s / r), [r, s, n]), L = i(() => o.heights.reduce((e, t) => e + t, 0) / o.heights.length || 0, [o]), I = i(() => o.widths.reduce((e, t) => e + t, 0) / o.widths.length || 0, [o]), u = i(() => {
55
- const { rowsHeight: e, columnsWidth: t } = P(o, r);
70
+ f(o);
71
+ }, [o, f]);
72
+ const A = m(() => c === C.HORIZONTAL_SCROLLING || c === C.PAGE_SCROLLING ? 1 : n === g.DUAL_PAGE_WITH_COVER && l > 0 ? 1 + Math.ceil((l - 1) / o) : Math.round(l / o), [o, l, c, n]), L = m(() => t.heights.reduce((e, r) => e + r, 0) / t.heights.length || 0, [t]), D = m(() => t.widths.reduce((e, r) => e + r, 0) / t.widths.length || 0, [t]), p = m(() => {
73
+ const e = n === g.DUAL_PAGE_WITH_COVER, { rowsHeight: r, columnsWidth: i } = V(t, o, e);
56
74
  return {
57
- rowsHeight: e,
58
- columnsWidth: t
75
+ rowsHeight: r,
76
+ columnsWidth: i
59
77
  };
60
- }, [o, r]), M = i(() => ({
61
- width: u.columnsWidth.reduce((e, t) => e + t, 0),
62
- height: u.rowsHeight.reduce((e, t) => e + t, 0)
63
- }), [u]);
78
+ }, [t, o, n]), W = m(() => ({
79
+ width: p.columnsWidth.reduce((e, r) => e + r, 0),
80
+ height: p.rowsHeight.reduce((e, r) => e + r, 0)
81
+ }), [p]);
64
82
  return {
65
- rowCount: x,
66
- rowHeight: w,
67
- columnCount: r,
68
- columnWidth: f,
69
- pageDimension: o,
83
+ rowCount: A,
84
+ rowHeight: P,
85
+ columnCount: o,
86
+ columnWidth: I,
87
+ pageDimension: t,
70
88
  estimatedRowHeight: L,
71
- estimatedColumnWidth: I,
72
- gridDimension: u,
73
- totalDimension: M
89
+ estimatedColumnWidth: D,
90
+ gridDimension: p,
91
+ totalDimension: W
74
92
  };
75
93
  };
76
94
  export {
77
- st as useVirtualReactWindow
95
+ ct as useVirtualReactWindow
78
96
  };
@@ -1,21 +1,22 @@
1
- import { e as r, z as _, i as R, p as o, t as p } from "../th_TH-d627cd51.js";
2
- var D = /* @__PURE__ */ ((O) => (O[O.Text = 1] = "Text", O[O.Link = 2] = "Link", O[O.FreeText = 3] = "FreeText", O[O.Line = 4] = "Line", O[O.Square = 5] = "Square", O[O.Circle = 6] = "Circle", O[O.Polygon = 7] = "Polygon", O[O.Polyline = 8] = "Polyline", O[O.Highlight = 9] = "Highlight", O[O.Underline = 10] = "Underline", O[O.Squiggly = 11] = "Squiggly", O[O.StrikeOut = 12] = "StrikeOut", O[O.Stamp = 13] = "Stamp", O[O.Caret = 14] = "Caret", O[O.Ink = 15] = "Ink", O[O.Popup = 16] = "Popup", O[O.FileAttachment = 17] = "FileAttachment", O[O.Widget = 20] = "Widget", O))(D || {}), N = /* @__PURE__ */ ((O) => (O.INTERNAL_LINK = "internal-link", O.LINK = "link", O.FILE_ATTACHMENT = "file-attachment", O.FORM_TEXT = "form-text", O.FORM_SELECT = "form-select", O.FORM_CHECKBOX = "form-checkbox", O.FORM_RADIO = "form-radio", O.FORM_BUTTON = "form-button", O.BUTTON = "button", O))(N || {}), E = /* @__PURE__ */ ((O) => (O.NOT_SUPPORTED = "not-supported", O))(E || {}), I = /* @__PURE__ */ ((O) => (O.ACTUAL = "Actual Size", O.PAGE_FIT = "Page Fit", O.PAGE_WIDTH = "Page Width", O))(I || {}), L = /* @__PURE__ */ ((O) => (O.Organization = "organization", O.Developer = "developer", O.FreeTrial = "free-trial", O))(L || {}), d = /* @__PURE__ */ ((O) => (O.SINGLE_PAGE = "Single", O.DUAL_PAGE = "Dual", O))(d || {}), C = /* @__PURE__ */ ((O) => (O.FONT_FAMILY = "--rp-font-family", O.PRIMARY_COLOR = "--rp-primary-color", O.BORDER_RADIUS = "--rp-border-radius", O.TEXT_COLOR = "--rp-text-color", O.OUTLINE_COLOR = "--rp-outline-color", O.FONT_SIZE = "--rp-font-size", O.DROP_MASK_BACKGROUND_COLOR = "--rp-drop-mask-background-color", O.LOADER_BACKDROP_COLOR = "--rp-loader-backdrop-color", O.ICON_DISABLED = "--rp-icon-disabled", O.ICON_FONT_SIZE = "--rp-icon-font-size", O.TOOLBAR_BACKGROUND = "--rp-toolbar-background", O.TOOLBAR_BORDER_COLOR = "--rp-toolbar-border-color", O.TOOLBAR_PADDING = "--rp-toolbar-padding", O.TOOLBAR_GAP = "--rp-toolbar-gap", O.TOOLBAR_SIZE = "--rp-toolbar-size", O.SIDEBAR_WIDTH = "--rp-sidebar-width", O.THUMBNAIL_BORDER_COLOR = "--rp-thumbnail-border-color", O.THUMBNAIL_BACKGROUND_COLOR = "--rp-thumbnail-background-color", O.THUMBNAIL_ACTIVE_COLOR = "--rp-thumbnail-active-color", O.THUMBNAIL_PADDING_Y = "--rp-thumbnail-padding-y", O.BUTTON_HOVER_BACKGROUND = "--rp-button-hover-background", O.BUTTON_PADDING = "--rp-button-padding", O.INPUT_PADDING = "--rp-input-padding", O.INPUT_BORDER_RADIUS = "--rp-input-border-radius", O.INPUT_BACKGROUND_COLOR = "--rp-input-background-color", O.INPUT_PLACEHOLDER_COLOR = "--rp-input-placeholder-color", O.PAGES_BACKGROUND_COLOR = "--rp-pages-background-color", O.ANNOTATION_LAYER_LINK_HOVER_BACKGROUND = "--rp-annotation-layer__link-hover-background", O.DROPDOWN_BACKGROUND_COLOR = "--rp-dropdown-background-color", O.DROPDOWN_PADDING = "--rp-dropdown-padding", O.DROPDOWN_HOVER_BACKGROUND_COLOR = "--rp-dropdown-hover-background-color", O.DROPDOWN_SEPARATOR_COLOR = "--rp-dropdown-separator-color", O.DROPDOWN_SEPARATOR_MARGIN = "--rp-dropdown-separator-margin", O.DROPDOWN_PADDING_MENU_ITEM = "--rp-dropdown-padding-menu-item", O.DROPDOWN_FONT_SIZE = "--rp-dropdown-font-size", O.DROPDOWN_BORDER_RADIUS = "--rp-dropdown-border-radius", O.SEARCH_TOOL_DROPDOWN_PADDING = "--rp-search-tool-dropdown-padding", O.POPOVER_FONT_SIZE = "--rp-popover-font-size", O.POPOVER_BACKGROUND_COLOR = "--rp-popover-background-color", O.POPOVER_COLOR = "--rp-popover-color", O.POPOVER_BORDER_COLOR = "--rp-popover-border-color", O.POPOVER_BORDER_RADIUS = "--rp-popover-border-radius", O.OVERLAY_BACKGROUND_COLOR = "--rp-overlay-background-color", O.DIALOG_BACKGROUND_COLOR = "--rp-dialog-background-color", O.PROPERTIES_DIVIDER_COLOR = "--rp-properties-divider-color", O.PROPERTIES_DIVIDER_MARGIN = "--rp-properties-divider-margin", O.PROPERTY_ITEM_GAP = "--rp-property-item-gap", O.DIALOG_TITLE_COLOR = "--rp-dialog-title-color", O.PROPERTY_ITEM_LABEL_COLOR = "--rp-property-item-label-color", O.PROPERTY_CLOSE_ICON_SIZE = "--rp-property-close-icon-size", O.PROPERTY_ITEM_FONT_SIZE = "--rp-property-item-font-size", O.PROPERTY_ITEM_FONT_WEIGHT = "--rp-property-item-font-weight", O.DIALOG_TITLE_FONT_SIZE = "--rp-dialog-title-font-size", O.DIALOG_TITLE_FONT_WEIGHT = "--rp-dialog-title-font-weight", O.MENU_ITEM_ICON_SIZE = "--rp-menu-item-icon-size", O.PRINT_PROGRESS_BACKGROUND = "--rp-print-progress-background", O.PRINT_PROGRESS_COLOR = "--rp-print-progress-color", O.DROP_ZONE_BORDER = "--rp-drop-zone-border", O.DROP_ZONE_FONT_COLOR = "--rp-drop-zone-font-color", O.DROP_ZONE_FONT_SIZE = "--rp-drop-zone-font-size", O.DROP_ZONE_BACKGROUND_COLOR = "--rp-drop-zone-background-color", O.CHECKBOX_BORDER_RADIUS = "--rp-checkbox-border-radius", O.CHECKBOX_BORDER_COLOR = "--rp-checkbox-border-color", O.CHECKBOX_INDICATOR_COLOR = "--rp-checkbox-indicator-color", O.HIGHLIGHT_BACKGROUND_COLOR = "--rp-highlight-background-color", O.TEXT_LAYER_HIGHLIGHT_BORDER_RADIUS = "--rp-text-layer-highlight-border-radius", O.CURRENT_HIGHLIGHT_BACKGROUND_COLOR = "--rp-current-highlight-background-color", O.TOOLTIP_BACKGROUND_COLOR = "--rp-tooltip-background-color", O.TOOLTIP_BORDER_RADIUS = "--rp-tooltip-border-radius", O.TOOLTIP_FONT_COLOR = "--rp-tooltip-font-color", O.TOOLTIP_FONT_SIZE = "--rp-tooltip-font-size", O.TOOLTIP_PADDING = "--rp-tooltip-padding", O.PASSWORD_MODAL_BACKGROUND_COLOR = "--rp-password-background-color", O.PASSWORD_MODAL_TITLE_FONT_COLOR = "--rp-password-title-font-color", O.PASSWORD_MODAL_CONTENT_FONT_COLOR = "--rp-password-content-font-color", O.PASSWORD_MODAL_INPUT_PLACEHOLDER_COLOR = "--rp-password-input-placeholder-color", O.PASSWORD_MODAL_INPUT_BORDER_COLOR = "--rp-password-input-border-color", O.PASSWORD_MODAL_INPUT_FONT_COLOR = "--rp-password-input-font-color", O.PASSWORD_MODAL_BUTTON_FONT_COLOR = "--rp-password-button-font-color", O.PASSWORD_MODAL_BUTTON_BACKGROUND_COLOR = "--rp-password-button-background-color", O.PASSWORD_MODAL_BUTTON_BORDER_COLOR = "--rp-password-button-border-color", O.PASSWORD_MODAL_BORDER_COLOR = "--rp-password-border-color", O.CONTAINER_FOCUS_OUTLINE_WIDTH = "--rp-container-focus-outline-width", O.CONTAINER_FOCUS_OUTLINE_COLOR = "--rp-container-focus-outline-color", O.CONTAINER_FOCUS_OUTLINE_OFFSET = "--rp-container-focus-outline-offset", O.BUTTON_BORDER_RADIUS = "--rp-button-border-radius", O))(C || {}), P = /* @__PURE__ */ ((O) => (O.PAGE_SCROLLING = "PAGE", O.VERTICAL_SCROLLING = "VERTICAL", O.HORIZONTAL_SCROLLING = "HORIZONTAL", O))(P || {}), c = /* @__PURE__ */ ((O) => (O.TEXT = "TEXT", O.HAND = "HAND", O))(c || {});
3
- const A = {
1
+ import { e as r, z as _, i as R, p as o, t as p, d as D } from "../de_DE-a553b162.js";
2
+ var I = /* @__PURE__ */ ((O) => (O[O.Text = 1] = "Text", O[O.Link = 2] = "Link", O[O.FreeText = 3] = "FreeText", O[O.Line = 4] = "Line", O[O.Square = 5] = "Square", O[O.Circle = 6] = "Circle", O[O.Polygon = 7] = "Polygon", O[O.Polyline = 8] = "Polyline", O[O.Highlight = 9] = "Highlight", O[O.Underline = 10] = "Underline", O[O.Squiggly = 11] = "Squiggly", O[O.StrikeOut = 12] = "StrikeOut", O[O.Stamp = 13] = "Stamp", O[O.Caret = 14] = "Caret", O[O.Ink = 15] = "Ink", O[O.Popup = 16] = "Popup", O[O.FileAttachment = 17] = "FileAttachment", O[O.Widget = 20] = "Widget", O))(I || {}), N = /* @__PURE__ */ ((O) => (O.INTERNAL_LINK = "internal-link", O.LINK = "link", O.FILE_ATTACHMENT = "file-attachment", O.FORM_TEXT = "form-text", O.FORM_SELECT = "form-select", O.FORM_CHECKBOX = "form-checkbox", O.FORM_RADIO = "form-radio", O.FORM_BUTTON = "form-button", O.BUTTON = "button", O))(N || {}), L = /* @__PURE__ */ ((O) => (O.NOT_SUPPORTED = "not-supported", O))(L || {}), E = /* @__PURE__ */ ((O) => (O.ACTUAL = "Actual Size", O.PAGE_FIT = "Page Fit", O.PAGE_WIDTH = "Page Width", O))(E || {}), d = /* @__PURE__ */ ((O) => (O.Organization = "organization", O.Developer = "developer", O.FreeTrial = "free-trial", O))(d || {}), C = /* @__PURE__ */ ((O) => (O.SINGLE_PAGE = "Single", O.DUAL_PAGE = "Dual", O.DUAL_PAGE_WITH_COVER = "DualWithCover", O))(C || {}), P = /* @__PURE__ */ ((O) => (O.FONT_FAMILY = "--rp-font-family", O.PRIMARY_COLOR = "--rp-primary-color", O.BORDER_RADIUS = "--rp-border-radius", O.TEXT_COLOR = "--rp-text-color", O.OUTLINE_COLOR = "--rp-outline-color", O.FONT_SIZE = "--rp-font-size", O.DROP_MASK_BACKGROUND_COLOR = "--rp-drop-mask-background-color", O.LOADER_BACKDROP_COLOR = "--rp-loader-backdrop-color", O.ICON_DISABLED = "--rp-icon-disabled", O.ICON_FONT_SIZE = "--rp-icon-font-size", O.TOOLBAR_BACKGROUND = "--rp-toolbar-background", O.TOOLBAR_BORDER_COLOR = "--rp-toolbar-border-color", O.TOOLBAR_PADDING = "--rp-toolbar-padding", O.TOOLBAR_GAP = "--rp-toolbar-gap", O.TOOLBAR_SIZE = "--rp-toolbar-size", O.SIDEBAR_WIDTH = "--rp-sidebar-width", O.THUMBNAIL_BORDER_COLOR = "--rp-thumbnail-border-color", O.THUMBNAIL_BACKGROUND_COLOR = "--rp-thumbnail-background-color", O.THUMBNAIL_ACTIVE_COLOR = "--rp-thumbnail-active-color", O.THUMBNAIL_PADDING_Y = "--rp-thumbnail-padding-y", O.BUTTON_HOVER_BACKGROUND = "--rp-button-hover-background", O.BUTTON_PADDING = "--rp-button-padding", O.INPUT_PADDING = "--rp-input-padding", O.INPUT_BORDER_RADIUS = "--rp-input-border-radius", O.INPUT_BACKGROUND_COLOR = "--rp-input-background-color", O.INPUT_PLACEHOLDER_COLOR = "--rp-input-placeholder-color", O.PAGES_BACKGROUND_COLOR = "--rp-pages-background-color", O.ANNOTATION_LAYER_LINK_HOVER_BACKGROUND = "--rp-annotation-layer__link-hover-background", O.DROPDOWN_BACKGROUND_COLOR = "--rp-dropdown-background-color", O.DROPDOWN_PADDING = "--rp-dropdown-padding", O.DROPDOWN_HOVER_BACKGROUND_COLOR = "--rp-dropdown-hover-background-color", O.DROPDOWN_SEPARATOR_COLOR = "--rp-dropdown-separator-color", O.DROPDOWN_SEPARATOR_MARGIN = "--rp-dropdown-separator-margin", O.DROPDOWN_PADDING_MENU_ITEM = "--rp-dropdown-padding-menu-item", O.DROPDOWN_FONT_SIZE = "--rp-dropdown-font-size", O.DROPDOWN_BORDER_RADIUS = "--rp-dropdown-border-radius", O.SEARCH_TOOL_DROPDOWN_PADDING = "--rp-search-tool-dropdown-padding", O.POPOVER_FONT_SIZE = "--rp-popover-font-size", O.POPOVER_BACKGROUND_COLOR = "--rp-popover-background-color", O.POPOVER_COLOR = "--rp-popover-color", O.POPOVER_BORDER_COLOR = "--rp-popover-border-color", O.POPOVER_BORDER_RADIUS = "--rp-popover-border-radius", O.OVERLAY_BACKGROUND_COLOR = "--rp-overlay-background-color", O.DIALOG_BACKGROUND_COLOR = "--rp-dialog-background-color", O.PROPERTIES_DIVIDER_COLOR = "--rp-properties-divider-color", O.PROPERTIES_DIVIDER_MARGIN = "--rp-properties-divider-margin", O.PROPERTY_ITEM_GAP = "--rp-property-item-gap", O.DIALOG_TITLE_COLOR = "--rp-dialog-title-color", O.PROPERTY_ITEM_LABEL_COLOR = "--rp-property-item-label-color", O.PROPERTY_CLOSE_ICON_SIZE = "--rp-property-close-icon-size", O.PROPERTY_ITEM_FONT_SIZE = "--rp-property-item-font-size", O.PROPERTY_ITEM_FONT_WEIGHT = "--rp-property-item-font-weight", O.DIALOG_TITLE_FONT_SIZE = "--rp-dialog-title-font-size", O.DIALOG_TITLE_FONT_WEIGHT = "--rp-dialog-title-font-weight", O.MENU_ITEM_ICON_SIZE = "--rp-menu-item-icon-size", O.PRINT_PROGRESS_BACKGROUND = "--rp-print-progress-background", O.PRINT_PROGRESS_COLOR = "--rp-print-progress-color", O.DROP_ZONE_BORDER = "--rp-drop-zone-border", O.DROP_ZONE_FONT_COLOR = "--rp-drop-zone-font-color", O.DROP_ZONE_FONT_SIZE = "--rp-drop-zone-font-size", O.DROP_ZONE_BACKGROUND_COLOR = "--rp-drop-zone-background-color", O.CHECKBOX_BORDER_RADIUS = "--rp-checkbox-border-radius", O.CHECKBOX_BORDER_COLOR = "--rp-checkbox-border-color", O.CHECKBOX_INDICATOR_COLOR = "--rp-checkbox-indicator-color", O.HIGHLIGHT_BACKGROUND_COLOR = "--rp-highlight-background-color", O.TEXT_LAYER_HIGHLIGHT_BORDER_RADIUS = "--rp-text-layer-highlight-border-radius", O.CURRENT_HIGHLIGHT_BACKGROUND_COLOR = "--rp-current-highlight-background-color", O.TOOLTIP_BACKGROUND_COLOR = "--rp-tooltip-background-color", O.TOOLTIP_BORDER_RADIUS = "--rp-tooltip-border-radius", O.TOOLTIP_FONT_COLOR = "--rp-tooltip-font-color", O.TOOLTIP_FONT_SIZE = "--rp-tooltip-font-size", O.TOOLTIP_PADDING = "--rp-tooltip-padding", O.PASSWORD_MODAL_BACKGROUND_COLOR = "--rp-password-background-color", O.PASSWORD_MODAL_TITLE_FONT_COLOR = "--rp-password-title-font-color", O.PASSWORD_MODAL_CONTENT_FONT_COLOR = "--rp-password-content-font-color", O.PASSWORD_MODAL_INPUT_PLACEHOLDER_COLOR = "--rp-password-input-placeholder-color", O.PASSWORD_MODAL_INPUT_BORDER_COLOR = "--rp-password-input-border-color", O.PASSWORD_MODAL_INPUT_FONT_COLOR = "--rp-password-input-font-color", O.PASSWORD_MODAL_BUTTON_FONT_COLOR = "--rp-password-button-font-color", O.PASSWORD_MODAL_BUTTON_BACKGROUND_COLOR = "--rp-password-button-background-color", O.PASSWORD_MODAL_BUTTON_BORDER_COLOR = "--rp-password-button-border-color", O.PASSWORD_MODAL_BORDER_COLOR = "--rp-password-border-color", O.CONTAINER_FOCUS_OUTLINE_WIDTH = "--rp-container-focus-outline-width", O.CONTAINER_FOCUS_OUTLINE_COLOR = "--rp-container-focus-outline-color", O.CONTAINER_FOCUS_OUTLINE_OFFSET = "--rp-container-focus-outline-offset", O.BUTTON_BORDER_RADIUS = "--rp-button-border-radius", O.SKIP_LINK_FONT_SIZE = "--rp-skip-link-font-size", O.SKIP_LINK_COLOR = "--rp-skip-link-color", O.SKIP_LINK_BACKGROUND_COLOR = "--rp-skip-link-background-color", O.SKIP_LINK_BORDER_COLOR = "--rp-skip-link-border-color", O))(P || {}), c = /* @__PURE__ */ ((O) => (O.PAGE_SCROLLING = "PAGE", O.VERTICAL_SCROLLING = "VERTICAL", O.HORIZONTAL_SCROLLING = "HORIZONTAL", O))(c || {}), t = /* @__PURE__ */ ((O) => (O.TEXT = "TEXT", O.HAND = "HAND", O))(t || {});
3
+ const U = {
4
4
  en_US: r,
5
5
  zh_CN: _,
6
6
  it_IT: R,
7
7
  pt_PT: o,
8
- th_TH: p
8
+ th_TH: p,
9
+ de_DE: D
9
10
  };
10
11
  export {
11
- D as AnnotationSubType,
12
+ I as AnnotationSubType,
12
13
  N as AnnotationType,
13
- E as ErrorType,
14
- L as LicenseType,
15
- A as Locales,
16
- P as ScrollMode,
17
- c as SelectionMode,
18
- C as ThemeVariables,
19
- d as ViewMode,
20
- I as ZoomLevel
14
+ L as ErrorType,
15
+ d as LicenseType,
16
+ U as Locales,
17
+ c as ScrollMode,
18
+ t as SelectionMode,
19
+ P as ThemeVariables,
20
+ C as ViewMode,
21
+ E as ZoomLevel
21
22
  };
@@ -1,8 +1,8 @@
1
- import { forwardRef as o } from "react";
2
- const s = (e) => o ? o((r, t) => e(r, t)) : (r) => {
3
- const { ref: t, ...f } = r;
4
- return e(f, t);
1
+ import { forwardRef as r } from "react";
2
+ const c = (o) => r ? r(o) : (t) => {
3
+ const { ref: n, ...e } = t;
4
+ return o(e, n);
5
5
  };
6
6
  export {
7
- s as withRef
7
+ c as withRef
8
8
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-pdf-kit/viewer",
3
- "version": "2.0.0-beta.10",
3
+ "version": "2.0.0-beta.12",
4
4
  "private": false,
5
5
  "description": "A react-pdf-viewer component for React and Next.js. Suitable for react-pdf document.",
6
6
  "keywords": [
@@ -39,9 +39,9 @@
39
39
  "prepare": "husky"
40
40
  },
41
41
  "dependencies": {
42
- "@radix-ui/react-checkbox": "^1.1.3",
43
- "@radix-ui/react-popover": "1.0.6",
44
- "@radix-ui/react-tooltip": "^1.1.8",
42
+ "@radix-ui/react-checkbox": "^1.3.3",
43
+ "@radix-ui/react-popover": "^1.1.15",
44
+ "@radix-ui/react-tooltip": "^1.2.8",
45
45
  "pdfjs-dist": "5.4.530",
46
46
  "react-virtualized-auto-sizer": "^1.0.24",
47
47
  "react-window": "^1.8.10"
@@ -51,6 +51,7 @@
51
51
  "@radix-ui/react-dialog": "^1.1.2",
52
52
  "@radix-ui/react-dropdown-menu": "^2.1.2",
53
53
  "@rollup/plugin-commonjs": "^28.0.1",
54
+ "@tanstack/eslint-plugin-query": "^5.60.1",
54
55
  "@types/react": "^18.2.14",
55
56
  "@types/react-dom": "^18.2.6",
56
57
  "@types/react-window": "^1.8.8",
@@ -68,9 +69,7 @@
68
69
  "postcss": "^8.4.47",
69
70
  "postcss-load-config": "^6.0.1",
70
71
  "rollup-plugin-postcss": "^4.0.2",
71
- "react": "^18.2.0",
72
72
  "react-devtools": "^6.1.0",
73
- "react-dom": "^18.2.0",
74
73
  "rollup": "^4.24.2",
75
74
  "typescript": "^5.0.2",
76
75
  "vite": "^4.4.0",
@@ -1,8 +0,0 @@
1
- const p = {
2
- "rp-paginate": "_rp-paginate_1gck0_1",
3
- "rp-page-input": "_rp-page-input_1gck0_6",
4
- "rp-total-page": "_rp-total-page_1gck0_18"
5
- };
6
- export {
7
- p as c
8
- };
@@ -1,13 +0,0 @@
1
- const r = {
2
- "rp-layout": "_rp-layout_1e7yi_1",
3
- "rp-layout-wrapper": "_rp-layout-wrapper_1e7yi_5",
4
- "rp-content": "_rp-content_1e7yi_11",
5
- "rp-pages": "_rp-pages_1e7yi_17",
6
- "rp-container": "_rp-container_1e7yi_22",
7
- "rp-loader": "_rp-loader_1e7yi_26",
8
- "rp-theme-variables": "_rp-theme-variables_1e7yi_30",
9
- "rp-dark-mode": "_rp-dark-mode_1e7yi_141"
10
- };
11
- export {
12
- r as c
13
- };
@@ -1,11 +0,0 @@
1
- const r = {
2
- "rp-toolbar-layout": "_rp-toolbar-layout_vwobs_1",
3
- "rp-content": "_rp-content_vwobs_7",
4
- "rp-topbar-content": "_rp-topbar-content_vwobs_13",
5
- "rp-sidebar-content": "_rp-sidebar-content_vwobs_22",
6
- "rp-pages": "_rp-pages_vwobs_32",
7
- "rp-thumbnails-wrapper": "_rp-thumbnails-wrapper_vwobs_37"
8
- };
9
- export {
10
- r as c
11
- };