@react-pdf-kit/viewer 0.0.0-experimental.8 → 0.0.0-experimental.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/RPLayout.module-7766e0b4.js +14 -0
- package/dist/assets/style.css +1 -1
- package/dist/assets/style.js +15 -15
- package/dist/components/RPConfig.js +11 -12
- package/dist/components/RPController.js +26 -21
- package/dist/components/RPDropFileZone.js +8 -7
- package/dist/components/RPPages.js +360 -351
- package/dist/components/RPProvider.js +24 -20
- package/dist/components/layout/LayoutContainer.js +1 -1
- package/dist/components/layout/LayoutWrapper.js +1 -1
- package/dist/components/layout/RPDefaultLayout.js +7 -4
- package/dist/components/layout/RPLayout.js +7 -4
- package/dist/components/layout/WrapperLayout.js +4 -3
- package/dist/components/layout/sidebar/RPSidebar.js +4 -3
- package/dist/components/layout/sidebar/Thumbnail.js +4 -3
- package/dist/components/layout/sidebar/Thumbnails.js +4 -3
- package/dist/components/layout/toolbar/DocumentDialog.js +6 -5
- package/dist/components/layout/toolbar/FileDownloadTool.js +4 -3
- package/dist/components/layout/toolbar/FileUploadTool.js +4 -3
- package/dist/components/layout/toolbar/MostPageTool.js +4 -3
- package/dist/components/layout/toolbar/OtherTool.js +4 -3
- package/dist/components/layout/toolbar/Paginate.js +4 -3
- package/dist/components/layout/toolbar/PrintTool.js +4 -3
- package/dist/components/layout/toolbar/RPMoreOptions.js +4 -3
- package/dist/components/layout/toolbar/RPToolbar.js +6 -3
- package/dist/components/layout/toolbar/RPToolbarEnd.js +4 -3
- package/dist/components/layout/toolbar/RotateTool.js +4 -3
- package/dist/components/layout/toolbar/SearchResultNavigator.js +6 -3
- package/dist/components/layout/toolbar/SearchTool.js +6 -3
- package/dist/components/layout/toolbar/ThumbnailTool.js +4 -3
- package/dist/components/layout/toolbar/ToolbarCustom.js +4 -3
- package/dist/components/layout/toolbar/ToolbarDefault.js +6 -3
- package/dist/components/layout/toolbar/ToolbarLayout.js +6 -3
- package/dist/components/layout/toolbar/ZoomTool.js +4 -3
- package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +4 -3
- package/dist/components/layout/toolbar/tools/DualPageWithCoverTool.js +9 -5
- package/dist/components/layout/toolbar/tools/FileDownloadTool.js +4 -3
- package/dist/components/layout/toolbar/tools/FileUploadTool.js +4 -3
- package/dist/components/layout/toolbar/tools/FirstPageTool.js +9 -5
- package/dist/components/layout/toolbar/tools/InputPageTool.js +4 -3
- package/dist/components/layout/toolbar/tools/LastPageTool.js +9 -5
- package/dist/components/layout/toolbar/tools/NextPageTool.js +4 -3
- package/dist/components/layout/toolbar/tools/PreviousPageTool.js +4 -3
- package/dist/components/layout/toolbar/tools/PrintTool.js +4 -3
- package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +4 -3
- package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +4 -3
- package/dist/components/layout/toolbar/tools/ThumbnailTool.js +4 -3
- package/dist/components/layout/toolbar/tools/ZoomInTool.js +4 -3
- package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +14 -13
- package/dist/components/layout/toolbar/tools/ZoomOutTool.js +4 -3
- package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +6 -3
- package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +4 -3
- package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +4 -3
- package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +4 -3
- package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +4 -3
- package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +4 -3
- package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +4 -3
- package/dist/components/page/AnnotationLayer.js +69 -72
- package/dist/components/page/CanvasLayer.js +4 -3
- package/dist/components/page/CustomElement.js +4 -3
- package/dist/components/page/DualPage.js +11 -5
- package/dist/components/page/DualPageWithCover.js +11 -5
- package/dist/components/page/RPPage.js +12 -6
- package/dist/components/page/SinglePage.js +11 -5
- package/dist/components/page/TextHighlightLayer.js +86 -178
- package/dist/components/page/TextLayer.js +125 -170
- package/dist/components/ui/LoadingIndicator.js +8 -7
- package/dist/contexts/DimensionPagesContext.js +6 -5
- package/dist/contexts/DropFileZoneContext.js +5 -4
- package/dist/contexts/ElementPageContext.js +6 -5
- package/dist/contexts/FileInputContext.js +6 -5
- package/dist/contexts/HighlightContext.js +10 -7
- package/dist/contexts/PagesRotateContext.js +6 -5
- package/dist/contexts/PaginationContext.js +6 -5
- package/dist/contexts/PrintContext.js +17 -16
- package/dist/contexts/RPDocumentContext.js +14 -13
- package/dist/contexts/RenderQueueProvider.js +6 -5
- package/dist/contexts/RotationContext.js +9 -8
- package/dist/contexts/SearchContext.js +8 -5
- package/dist/contexts/TextSelectionContext.js +191 -0
- package/dist/contexts/ThumbnailsContext.js +5 -4
- package/dist/contexts/ZoomContext.js +6 -5
- package/dist/main.js +116 -113
- package/dist/types/components/layout/sidebar/Thumbnail.d.ts +2 -2
- package/dist/types/contexts/RPDocumentContext.d.ts +1 -1
- package/dist/types/contexts/RenderQueueProvider.d.ts +1 -1
- package/dist/types/contexts/RenderedPagesCache.d.ts +2 -2
- package/dist/types/contexts/TextSelectionContext.d.ts +14 -0
- package/dist/types/main.d.ts +1 -1
- package/dist/types/utils/annotations.d.ts +2 -2
- package/dist/types/utils/geometryCache.d.ts +15 -0
- package/dist/types/utils/getThumbnailViewport.d.ts +2 -2
- package/dist/types/utils/glyphHitTest.d.ts +12 -0
- package/dist/types/utils/highlight.d.ts +5 -5
- package/dist/types/utils/hooks/useHighlight.d.ts +1 -1
- package/dist/types/utils/hooks/useLoadPdf.d.ts +2 -2
- package/dist/types/utils/hooks/useLoadWorker.d.ts +5 -1
- package/dist/types/utils/hooks/usePdfProperties.d.ts +1 -1
- package/dist/types/utils/hooks/useTextSelection.d.ts +12 -3
- package/dist/types/utils/link_service.d.ts +2 -3
- package/dist/types/utils/renderPage.d.ts +2 -2
- package/dist/types/utils/selectionUtils.d.ts +30 -0
- package/dist/types/utils/types.d.ts +5 -7
- package/dist/utils/geometryCache.js +32 -0
- package/dist/utils/glyphHitTest.js +29 -0
- package/dist/utils/highlight.js +184 -158
- package/dist/utils/hooks/useCopyText.js +60 -22
- package/dist/utils/hooks/useFileDownload.js +6 -5
- package/dist/utils/hooks/useHighlight.js +35 -33
- package/dist/utils/hooks/useLicense.js +62 -62
- package/dist/utils/hooks/useLoadPdf.js +102 -70
- package/dist/utils/hooks/useLoadWorker.js +4 -14
- package/dist/utils/hooks/usePageRotateContext.js +8 -7
- package/dist/utils/hooks/usePaginate.js +4 -3
- package/dist/utils/hooks/usePinch.js +11 -10
- package/dist/utils/hooks/usePresentPage.js +4 -3
- package/dist/utils/hooks/usePrint.js +74 -78
- package/dist/utils/hooks/useRotate.js +4 -3
- package/dist/utils/hooks/useScrollToPage.js +4 -3
- package/dist/utils/hooks/useSearch.js +18 -15
- package/dist/utils/hooks/useTextSelection.js +2 -73
- package/dist/utils/hooks/useThumbnail.js +18 -17
- package/dist/utils/hooks/useVirtualReactWindow.js +4 -3
- package/dist/utils/link_service.js +18 -19
- package/dist/utils/renderPage.js +1 -1
- package/dist/utils/selectionUtils.js +96 -0
- package/package.json +2 -3
- package/dist/RPLayout.module-b4b23e29.js +0 -14
- package/dist/types/utils/hooks/useFlickerSelectText.d.ts +0 -1
- package/dist/utils/hooks/useFlickerSelectText.js +0 -25
package/dist/main.js
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import { RPProvider as
|
|
2
|
-
import { RPPages as
|
|
3
|
-
import { RPConfig as
|
|
4
|
-
import { RPDefaultLayout as
|
|
5
|
-
import { RPLayout as
|
|
6
|
-
import { RPTheme as
|
|
7
|
-
import { default as
|
|
8
|
-
import { UIButton as
|
|
9
|
-
import { useDarkModeContext as
|
|
10
|
-
import { u as
|
|
11
|
-
import { useDocumentContext as
|
|
12
|
-
import { useRotationContext as
|
|
13
|
-
import { useViewModeContext as
|
|
14
|
-
import { useDropFileZoneContext as
|
|
15
|
-
import { useFileDownload as
|
|
16
|
-
import { useOpenFileContext as
|
|
17
|
-
import { usePrintContext as
|
|
18
|
-
import { useZoomContext as
|
|
19
|
-
import { useSearchContext as
|
|
20
|
-
import { useHighlightContext as
|
|
21
|
-
import { useFullScreenContext as
|
|
22
|
-
import { usePageRotateContext as
|
|
23
|
-
import { useElementPageContext as
|
|
24
|
-
import { SearchTool as
|
|
25
|
-
import { ThemeSwitcherTool as
|
|
26
|
-
import { ThumbnailTool as
|
|
27
|
-
import { FileUploadTool as
|
|
28
|
-
import { FileDownloadTool as
|
|
29
|
-
import { PrintTool as
|
|
30
|
-
import { FullScreenTool as
|
|
31
|
-
import { PreviousPageTool as
|
|
32
|
-
import { NextPageTool as
|
|
33
|
-
import { InputPageTool as
|
|
34
|
-
import { ZoomInTool as
|
|
35
|
-
import { ZoomOutTool as
|
|
36
|
-
import { ZoomLevelTool as
|
|
37
|
-
import { DocumentPropertiesTool as
|
|
38
|
-
import { RotateClockwiseTool as
|
|
39
|
-
import { RotateCounterclockwiseTool as
|
|
40
|
-
import { RPHorizontalBar as
|
|
41
|
-
import { RPVerticalBar as
|
|
42
|
-
import { SelectionModeSwitcherTool as
|
|
43
|
-
import { SinglePageTool as
|
|
44
|
-
import { DualPageTool as
|
|
45
|
-
import { DualPageWithCoverTool as
|
|
46
|
-
import { PageScrollingTool as
|
|
47
|
-
import { VerticalScrollingTool as
|
|
48
|
-
import { HorizontalScrollingTool as
|
|
49
|
-
import { FirstPageTool as
|
|
50
|
-
import { LastPageTool as
|
|
51
|
-
import { Locales as
|
|
1
|
+
import { RPProvider as Lt } from "./components/RPProvider.js";
|
|
2
|
+
import { RPPages as Zt } from "./components/RPPages.js";
|
|
3
|
+
import { RPConfig as Vt } from "./components/RPConfig.js";
|
|
4
|
+
import { RPDefaultLayout as kt } from "./components/layout/RPDefaultLayout.js";
|
|
5
|
+
import { RPLayout as It } from "./components/layout/RPLayout.js";
|
|
6
|
+
import { RPTheme as yt } from "./components/RPTheme.js";
|
|
7
|
+
import { default as Ot } from "./components/ui/RPTooltip.js";
|
|
8
|
+
import { UIButton as Et } from "./components/ui/Button.js";
|
|
9
|
+
import { useDarkModeContext as Wt } from "./contexts/DarkModeContext.js";
|
|
10
|
+
import { u as qt } from "./PaginationContext-9217cab4.js";
|
|
11
|
+
import { useDocumentContext as Gt } from "./contexts/RPDocumentContext.js";
|
|
12
|
+
import { useRotationContext as Kt } from "./contexts/RotationContext.js";
|
|
13
|
+
import { useViewModeContext as Xt } from "./contexts/ViewModeContext.js";
|
|
14
|
+
import { useDropFileZoneContext as _t } from "./contexts/DropFileZoneContext.js";
|
|
15
|
+
import { useFileDownload as om } from "./utils/hooks/useFileDownload.js";
|
|
16
|
+
import { useOpenFileContext as tm } from "./contexts/FileInputContext.js";
|
|
17
|
+
import { usePrintContext as pm } from "./contexts/PrintContext.js";
|
|
18
|
+
import { useZoomContext as em } from "./contexts/ZoomContext.js";
|
|
19
|
+
import { useSearchContext as xm } from "./contexts/SearchContext.js";
|
|
20
|
+
import { useHighlightContext as am } from "./contexts/HighlightContext.js";
|
|
21
|
+
import { useFullScreenContext as um } from "./contexts/FullScreenContext.js";
|
|
22
|
+
import { usePageRotateContext as Pm } from "./utils/hooks/usePageRotateContext.js";
|
|
23
|
+
import { useElementPageContext as cm } from "./contexts/ElementPageContext.js";
|
|
24
|
+
import { SearchTool as Cm } from "./components/layout/toolbar/SearchTool.js";
|
|
25
|
+
import { ThemeSwitcherTool as Sm } from "./components/layout/toolbar/tools/ThemeSwitcherTool.js";
|
|
26
|
+
import { ThumbnailTool as hm } from "./components/layout/toolbar/tools/ThumbnailTool.js";
|
|
27
|
+
import { FileUploadTool as wm } from "./components/layout/toolbar/tools/FileUploadTool.js";
|
|
28
|
+
import { FileDownloadTool as Lm } from "./components/layout/toolbar/tools/FileDownloadTool.js";
|
|
29
|
+
import { PrintTool as Zm } from "./components/layout/toolbar/tools/PrintTool.js";
|
|
30
|
+
import { FullScreenTool as Vm } from "./components/layout/toolbar/tools/FullScreenTool.js";
|
|
31
|
+
import { PreviousPageTool as km } from "./components/layout/toolbar/tools/PreviousPageTool.js";
|
|
32
|
+
import { NextPageTool as Im } from "./components/layout/toolbar/tools/NextPageTool.js";
|
|
33
|
+
import { InputPageTool as ym } from "./components/layout/toolbar/tools/InputPageTool.js";
|
|
34
|
+
import { ZoomInTool as Om } from "./components/layout/toolbar/tools/ZoomInTool.js";
|
|
35
|
+
import { ZoomOutTool as Em } from "./components/layout/toolbar/tools/ZoomOutTool.js";
|
|
36
|
+
import { ZoomLevelTool as Wm } from "./components/layout/toolbar/tools/ZoomLevelTool.js";
|
|
37
|
+
import { DocumentPropertiesTool as qm } from "./components/layout/toolbar/tools/DocumentPropertiesTool.js";
|
|
38
|
+
import { RotateClockwiseTool as Gm } from "./components/layout/toolbar/tools/RotateClockwiseTool.js";
|
|
39
|
+
import { RotateCounterclockwiseTool as Km } from "./components/layout/toolbar/tools/RotateCounterclockwiseTool.js";
|
|
40
|
+
import { RPHorizontalBar as Xm } from "./components/layout/toolbar/tools/defaults/RPHorizontalBar.js";
|
|
41
|
+
import { RPVerticalBar as _m } from "./components/layout/toolbar/tools/defaults/RPVerticalBar.js";
|
|
42
|
+
import { SelectionModeSwitcherTool as op } from "./components/layout/toolbar/tools/SelectionModeSwitcherTool.js";
|
|
43
|
+
import { SinglePageTool as tp } from "./components/layout/toolbar/tools/SinglePageTool.js";
|
|
44
|
+
import { DualPageTool as pp } from "./components/layout/toolbar/tools/DualPageTool.js";
|
|
45
|
+
import { DualPageWithCoverTool as ep } from "./components/layout/toolbar/tools/DualPageWithCoverTool.js";
|
|
46
|
+
import { PageScrollingTool as xp } from "./components/layout/toolbar/tools/PageScrollingTool.js";
|
|
47
|
+
import { VerticalScrollingTool as ap } from "./components/layout/toolbar/tools/VerticalScrollingTool.js";
|
|
48
|
+
import { HorizontalScrollingTool as up } from "./components/layout/toolbar/tools/HorizontalScrollingTool.js";
|
|
49
|
+
import { FirstPageTool as Pp } from "./components/layout/toolbar/tools/FirstPageTool.js";
|
|
50
|
+
import { LastPageTool as cp } from "./components/layout/toolbar/tools/LastPageTool.js";
|
|
51
|
+
import { Locales as Cp, ScrollMode as Rp, SelectionMode as Sp, ThemeVariables as dp, ViewMode as hp, ZoomLevel as Dp } from "./utils/types.js";
|
|
52
52
|
import "react/jsx-runtime";
|
|
53
53
|
import "react";
|
|
54
54
|
import "./contexts/DocumentPasswordContext.js";
|
|
@@ -79,23 +79,24 @@ import "./contexts/SmoothScrollContext.js";
|
|
|
79
79
|
import "./contexts/RenderQueueProvider.js";
|
|
80
80
|
import "./utils/Queue.js";
|
|
81
81
|
import "./utils/renderPage.js";
|
|
82
|
-
import "
|
|
82
|
+
import "@pdf-viewer/pdfium/compat";
|
|
83
83
|
import "./contexts/GlobalCurrentPage.js";
|
|
84
|
+
import "./contexts/TextSelectionContext.js";
|
|
85
|
+
import "./utils/glyphHitTest.js";
|
|
86
|
+
import "./utils/selectionUtils.js";
|
|
87
|
+
import "./utils/geometryCache.js";
|
|
84
88
|
import "./contexts/LoaderContext.js";
|
|
85
89
|
import "./components/icons/LoaderIcon.js";
|
|
86
90
|
import "./clsx-0c6e471a.js";
|
|
87
91
|
import "./contexts/ToolComponentContext.js";
|
|
88
92
|
import "./contexts/IconToolContext.js";
|
|
89
93
|
import "./contexts/OtherToolContext.js";
|
|
90
|
-
import "./utils/hooks/useFlickerSelectText.js";
|
|
91
94
|
import "./assets/style.js";
|
|
92
95
|
import "./libInjectCss.js";
|
|
93
96
|
import "./utils/injectPrintCSS.js";
|
|
94
97
|
import "./components/page/RPPage.js";
|
|
95
98
|
import "./components/page/CanvasLayer.js";
|
|
96
99
|
import "./components/page/TextLayer.js";
|
|
97
|
-
import "./utils/highlight.js";
|
|
98
|
-
import "./utils/charators.js";
|
|
99
100
|
import "./components/page/AnnotationLayer.js";
|
|
100
101
|
import "./utils/link_service.js";
|
|
101
102
|
import "./utils/annotations.js";
|
|
@@ -104,6 +105,8 @@ import "./utils/dateFormatter.js";
|
|
|
104
105
|
import "./components/page/TextHighlightLayer.js";
|
|
105
106
|
import "./components/page/searchHighlight.js";
|
|
106
107
|
import "./utils/const.js";
|
|
108
|
+
import "./utils/highlight.js";
|
|
109
|
+
import "./utils/charators.js";
|
|
107
110
|
import "./components/page/CustomElement.js";
|
|
108
111
|
import "./utils/withRef.js";
|
|
109
112
|
import "./utils/hooks/useVirtualReactWindow.js";
|
|
@@ -118,11 +121,10 @@ import "./utils/hooks/useDebounce.js";
|
|
|
118
121
|
import "./components/ui/PasswordModal.js";
|
|
119
122
|
import "./utils/hooks/usePresentPage.js";
|
|
120
123
|
import "./components/layout/LayoutContainer.js";
|
|
121
|
-
import "./RPLayout.module-
|
|
124
|
+
import "./RPLayout.module-7766e0b4.js";
|
|
122
125
|
import "./contexts/ThemeContext.js";
|
|
123
126
|
import "./components/layout/LayoutWrapper.js";
|
|
124
127
|
import "./utils/hooks/useCopyText.js";
|
|
125
|
-
import "./utils/hooks/useTextSelection.js";
|
|
126
128
|
import "./utils/approximateFragtion.js";
|
|
127
129
|
import "./contexts/ConfigContext.js";
|
|
128
130
|
import "./utils/hooks/useLoadWorker.js";
|
|
@@ -213,6 +215,7 @@ import "./utils/hooks/useDarkMode.js";
|
|
|
213
215
|
import "./utils/smoothScrollTo.js";
|
|
214
216
|
import "./utils/getScrollDistance.js";
|
|
215
217
|
import "./utils/hooks/useLoadPdf.js";
|
|
218
|
+
import "@pdf-viewer/pdfium";
|
|
216
219
|
import "./utils/hooks/usePdfProperties.js";
|
|
217
220
|
import "./utils/convertPdfDate.js";
|
|
218
221
|
import "./utils/formatFileSize.js";
|
|
@@ -232,60 +235,60 @@ import "./components/layout/toolbar/SearchCloseButton.js";
|
|
|
232
235
|
import "./components/icons/ChevronDownIcon.js";
|
|
233
236
|
import "./components/layout/toolbar/ThumbnailTool.js";
|
|
234
237
|
export {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
238
|
+
qm as DocumentPropertiesTool,
|
|
239
|
+
pp as DualPageTool,
|
|
240
|
+
ep as DualPageWithCoverTool,
|
|
241
|
+
Lm as FileDownloadTool,
|
|
242
|
+
wm as FileUploadTool,
|
|
243
|
+
Pp as FirstPageTool,
|
|
244
|
+
Vm as FullScreenTool,
|
|
245
|
+
up as HorizontalScrollingTool,
|
|
246
|
+
ym as InputPageTool,
|
|
247
|
+
cp as LastPageTool,
|
|
248
|
+
Cp as Locales,
|
|
249
|
+
Im as NextPageTool,
|
|
250
|
+
xp as PageScrollingTool,
|
|
251
|
+
km as PreviousPageTool,
|
|
252
|
+
Zm as PrintTool,
|
|
253
|
+
Et as RPButton,
|
|
254
|
+
Vt as RPConfig,
|
|
255
|
+
kt as RPDefaultLayout,
|
|
256
|
+
Xm as RPHorizontalBar,
|
|
257
|
+
It as RPLayout,
|
|
258
|
+
Zt as RPPages,
|
|
259
|
+
Lt as RPProvider,
|
|
260
|
+
yt as RPTheme,
|
|
261
|
+
Ot as RPTooltip,
|
|
262
|
+
_m as RPVerticalBar,
|
|
263
|
+
Gm as RotateClockwiseTool,
|
|
264
|
+
Km as RotateCounterclockwiseTool,
|
|
265
|
+
Rp as ScrollMode,
|
|
266
|
+
Cm as SearchTool,
|
|
267
|
+
Sp as SelectionMode,
|
|
268
|
+
op as SelectionModeSwitcherTool,
|
|
269
|
+
tp as SinglePageTool,
|
|
270
|
+
Sm as ThemeSwitcherTool,
|
|
271
|
+
dp as ThemeVariables,
|
|
272
|
+
hm as ThumbnailTool,
|
|
273
|
+
ap as VerticalScrollingTool,
|
|
274
|
+
hp as ViewMode,
|
|
275
|
+
Om as ZoomInTool,
|
|
276
|
+
Dp as ZoomLevel,
|
|
277
|
+
Wm as ZoomLevelTool,
|
|
278
|
+
Em as ZoomOutTool,
|
|
279
|
+
Wt as useDarkModeContext,
|
|
280
|
+
Gt as useDocumentContext,
|
|
281
|
+
_t as useDropFileZoneContext,
|
|
282
|
+
cm as useElementPageContext,
|
|
283
|
+
om as useFileDownload,
|
|
284
|
+
um as useFullScreenContext,
|
|
285
|
+
am as useHighlightContext,
|
|
286
|
+
tm as useOpenFileContext,
|
|
287
|
+
Pm as usePageRotateContext,
|
|
288
|
+
qt as usePaginationContext,
|
|
289
|
+
pm as usePrintContext,
|
|
290
|
+
Kt as useRotationContext,
|
|
291
|
+
xm as useSearchContext,
|
|
292
|
+
Xt as useViewModeContext,
|
|
293
|
+
em as useZoomContext
|
|
291
294
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { Viewport } from '@pdf-viewer/pdfium/compat';
|
|
3
3
|
interface Props {
|
|
4
4
|
pageNumber: number;
|
|
5
5
|
loading: boolean;
|
|
6
6
|
isFocused: boolean;
|
|
7
|
-
viewport:
|
|
7
|
+
viewport: Viewport;
|
|
8
8
|
defaultRotation: number;
|
|
9
9
|
}
|
|
10
10
|
export declare const Thumbnail: FC<Props>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FC, PropsWithChildren } from 'react';
|
|
2
2
|
import { DocumentContextType, RPSrc, CharacterMap, LoadPDFOptions } from '../utils/types';
|
|
3
|
-
import { PDFDocumentProxy } from '
|
|
3
|
+
import { PDFDocumentProxy } from '@pdf-viewer/pdfium/compat';
|
|
4
4
|
declare const DocumentContext: React.Context<DocumentContextType>;
|
|
5
5
|
interface Props extends PropsWithChildren, LoadPDFOptions {
|
|
6
6
|
src?: RPSrc;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Queue } from '../utils/Queue';
|
|
2
2
|
import { FC } from 'react';
|
|
3
|
-
import { PDFPageProxy } from '
|
|
3
|
+
import { PDFPageProxy } from '@pdf-viewer/pdfium/compat';
|
|
4
4
|
import { RenderOptions } from '../utils/types';
|
|
5
5
|
interface RenderData {
|
|
6
6
|
page: PDFPageProxy;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Viewport } from '@pdf-viewer/pdfium/compat';
|
|
2
2
|
import { FC, PropsWithChildren } from 'react';
|
|
3
3
|
interface CacheContext {
|
|
4
|
-
viewports: Map<number,
|
|
4
|
+
viewports: Map<number, Viewport>;
|
|
5
5
|
pages: Map<number, any>;
|
|
6
6
|
}
|
|
7
7
|
export declare const RenderedPagesCacheContext: import('react').Context<CacheContext>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FC, PropsWithChildren } from 'react';
|
|
2
|
+
import { HighlightRect } from '../utils/selectionUtils';
|
|
3
|
+
export interface TextSelectionContextType {
|
|
4
|
+
handlePointerDown: (pageIndex: number, e: React.PointerEvent, overlayEl: HTMLElement) => void;
|
|
5
|
+
handlePointerMove: (pageIndex: number, e: React.PointerEvent, overlayEl: HTMLElement) => void;
|
|
6
|
+
handlePointerUp: () => void;
|
|
7
|
+
getPageSelectionRects: (pageIndex: number) => HighlightRect[];
|
|
8
|
+
isSelecting: boolean;
|
|
9
|
+
selectedText: string;
|
|
10
|
+
selectionVersion: number;
|
|
11
|
+
clearSelection: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const useTextSelectionContext: () => TextSelectionContextType;
|
|
14
|
+
export declare const TextSelectionProvider: FC<PropsWithChildren>;
|
package/dist/types/main.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export { useHighlightContext } from './contexts/HighlightContext';
|
|
|
21
21
|
export { useFullScreenContext } from './contexts/FullScreenContext';
|
|
22
22
|
export { usePageRotateContext } from './utils/hooks/usePageRotateContext';
|
|
23
23
|
export { useElementPageContext } from './contexts/ElementPageContext';
|
|
24
|
-
export { type PDFDocumentProxy } from '
|
|
24
|
+
export { type PDFDocumentProxy } from '@pdf-viewer/pdfium/compat';
|
|
25
25
|
export { SearchTool } from './components/layout/toolbar/SearchTool';
|
|
26
26
|
export { ThemeSwitcherTool } from './components/layout/toolbar/tools/ThemeSwitcherTool';
|
|
27
27
|
export { ThumbnailTool } from './components/layout/toolbar/tools/ThumbnailTool';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Viewport, PDFDocumentProxy } from '@pdf-viewer/pdfium/compat';
|
|
2
2
|
import { Annotation, AnnotationEventPayload } from './types';
|
|
3
3
|
export declare const insertDateText: (annotationLayer: HTMLDivElement | null) => void;
|
|
4
4
|
export declare function bindLayerEvents(annotatedLayer: HTMLDivElement, handler: (event: Event) => void): void;
|
|
5
5
|
export declare function unbindLayerEvents(annotatedLayer: HTMLDivElement, handler: (event: Event) => void): void;
|
|
6
6
|
export declare function handleAnnotationLink(annotation: Annotation): void;
|
|
7
|
-
export declare function handleAnnotationWidget(annotation: Annotation, viewport:
|
|
7
|
+
export declare function handleAnnotationWidget(annotation: Annotation, viewport: Viewport, canvasMap: Map<string, HTMLCanvasElement>): void;
|
|
8
8
|
/**
|
|
9
9
|
* Fixes tabindex values greater than 0 in annotation layer elements
|
|
10
10
|
* WCAG 2.1 requires tabindex to be 0, -1, or not set (for natural tab order)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PageGeometry } from '@pdf-viewer/pdfium';
|
|
2
|
+
/**
|
|
3
|
+
* LRU cache for PageGeometry objects keyed by page index.
|
|
4
|
+
*/
|
|
5
|
+
export declare class GeometryCache {
|
|
6
|
+
private cache;
|
|
7
|
+
private readonly maxSize;
|
|
8
|
+
constructor(maxSize?: number);
|
|
9
|
+
get(pageIndex: number): PageGeometry | undefined;
|
|
10
|
+
set(pageIndex: number, geometry: PageGeometry): void;
|
|
11
|
+
clear(): void;
|
|
12
|
+
get size(): number;
|
|
13
|
+
}
|
|
14
|
+
/** Shared singleton instance */
|
|
15
|
+
export declare const geometryCache: GeometryCache;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PDFPageProxy } from '
|
|
1
|
+
import { PDFPageProxy } from '@pdf-viewer/pdfium/compat';
|
|
2
2
|
export declare const getThumbnailViewport: (page: PDFPageProxy, rotation?: number) => {
|
|
3
3
|
scale: number;
|
|
4
|
-
thumbnailViewport: import('
|
|
4
|
+
thumbnailViewport: import('@pdf-viewer/pdfium/compat').Viewport;
|
|
5
5
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PageGeometry } from '@pdf-viewer/pdfium';
|
|
2
|
+
export interface HitResult {
|
|
3
|
+
runIndex: number;
|
|
4
|
+
glyphIndex: number;
|
|
5
|
+
charIndex: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Two-pass glyph hit-testing:
|
|
9
|
+
* 1. Exact match against tight bounds
|
|
10
|
+
* 2. Tolerance-expanded match using Manhattan distance
|
|
11
|
+
*/
|
|
12
|
+
export declare function glyphAt(geometry: PageGeometry, x: number, y: number, tolerance?: number): HitResult | null;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TextContentCompat } from '@pdf-viewer/pdfium/compat';
|
|
2
2
|
import { SearchOptions, Match, MatchHighlight } from './types';
|
|
3
|
-
export declare function findMatches(queries: (string | RegExp)[], textContent:
|
|
3
|
+
export declare function findMatches(queries: (string | RegExp)[], textContent: TextContentCompat, pageIndex: number, options: SearchOptions): Match[];
|
|
4
4
|
export declare function isMatchEntireWord(content: string, startIdx: number, length: number): boolean;
|
|
5
|
-
export declare function highlightMatches(matches: Match[], textContent:
|
|
5
|
+
export declare function highlightMatches(matches: Match[], textContent: TextContentCompat, textDivs: HTMLElement[]): {
|
|
6
6
|
element: HTMLElement;
|
|
7
7
|
index: number;
|
|
8
8
|
}[];
|
|
9
|
-
export declare function resetDivs(textContent:
|
|
9
|
+
export declare function resetDivs(textContent: TextContentCompat, textDivs: HTMLElement[]): void;
|
|
10
10
|
export declare function getHighlightOptionsWithDefaults(options?: SearchOptions): SearchOptions;
|
|
11
|
-
export declare function highlightMultipleColorMatches(matches: MatchHighlight[], textContent:
|
|
11
|
+
export declare function highlightMultipleColorMatches(matches: MatchHighlight[], textContent: TextContentCompat, textDivs: HTMLElement[]): {
|
|
12
12
|
element: HTMLElement;
|
|
13
13
|
index: number;
|
|
14
14
|
}[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PDFDocumentProxy } from '
|
|
1
|
+
import { PDFDocumentProxy } from '@pdf-viewer/pdfium/compat';
|
|
2
2
|
import { PdfPage, RPSrc, CharacterMap, LoadPDFOptions, ErrorType } from '../types';
|
|
3
|
-
export declare const useLoadPdf: (src?: RPSrc,
|
|
3
|
+
export declare const useLoadPdf: (src?: RPSrc, _characterMap?: CharacterMap, options?: LoadPDFOptions) => {
|
|
4
4
|
pdf: PDFDocumentProxy | undefined;
|
|
5
5
|
pages: Map<number, PdfPage>;
|
|
6
6
|
loading: boolean;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated No longer needed — PDFium uses WASM directly without a web worker.
|
|
3
|
+
* Kept for backward compatibility in case external code references it.
|
|
4
|
+
*/
|
|
5
|
+
export declare const useLoadWorker: (_workerUrl?: string) => {
|
|
2
6
|
workerUrlAdded: boolean;
|
|
3
7
|
};
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Legacy hook — selection logic has moved to TextSelectionContext.
|
|
3
|
+
*
|
|
4
|
+
* This file is kept so existing call sites compile without changes.
|
|
5
|
+
* The TextSelectionProvider (in contexts/TextSelectionContext.tsx) now
|
|
6
|
+
* manages all pointer-event-based text selection via glyph hit-testing
|
|
7
|
+
* and fires `onTextSelect` through EventCallbackContext.
|
|
8
|
+
*
|
|
9
|
+
* This hook is intentionally a no-op. Remove the call site when convenient.
|
|
10
|
+
*/
|
|
2
11
|
interface UseTextSelectionOptions {
|
|
3
|
-
onTextSelect?: (selection:
|
|
12
|
+
onTextSelect?: ((selection: unknown) => void) | undefined;
|
|
4
13
|
pagesRef: HTMLElement | null;
|
|
5
14
|
}
|
|
6
|
-
export declare const useTextSelection: (
|
|
15
|
+
export declare const useTextSelection: (_options: UseTextSelectionOptions) => void;
|
|
7
16
|
export {};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { PDFDocumentProxy } from '
|
|
2
|
-
|
|
3
|
-
declare class SimpleLinkService implements IPDFLinkService {
|
|
1
|
+
import { PDFDocumentProxy, LinkService } from '@pdf-viewer/pdfium/compat';
|
|
2
|
+
declare class SimpleLinkService implements LinkService {
|
|
4
3
|
externalLinkEnabled: boolean;
|
|
5
4
|
pdfDocument: PDFDocumentProxy | undefined;
|
|
6
5
|
constructor(pdfDocument: PDFDocumentProxy, goToPage: (page: number) => void);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { PDFPageProxy } from '
|
|
1
|
+
import { PDFPageProxy, RenderTask } from '@pdf-viewer/pdfium/compat';
|
|
2
2
|
import { RenderOptions } from './types';
|
|
3
|
-
export declare const renderPage: (page: PDFPageProxy, canvasElem: HTMLCanvasElement, options?: RenderOptions) =>
|
|
3
|
+
export declare const renderPage: (page: PDFPageProxy, canvasElem: HTMLCanvasElement, options?: RenderOptions) => RenderTask;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { PageGeometry } from '@pdf-viewer/pdfium';
|
|
2
|
+
export interface CharRange {
|
|
3
|
+
start: number;
|
|
4
|
+
end: number;
|
|
5
|
+
}
|
|
6
|
+
export interface HighlightRect {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Expand selection to word boundaries.
|
|
14
|
+
* Walk backward/forward from charIndex until hitting a space (flags=1) or empty (flags=2) glyph.
|
|
15
|
+
*/
|
|
16
|
+
export declare function expandToWordBoundary(geometry: PageGeometry, charIndex: number): CharRange;
|
|
17
|
+
/**
|
|
18
|
+
* Expand selection to line boundaries.
|
|
19
|
+
* Find all runs that vertically overlap >= 50% with the run containing charIndex.
|
|
20
|
+
*/
|
|
21
|
+
export declare function expandToLineBoundary(geometry: PageGeometry, charIndex: number): CharRange;
|
|
22
|
+
/**
|
|
23
|
+
* Compute merged highlight rectangles for a character range.
|
|
24
|
+
* Adjacent glyphs on the same visual line are merged into single rectangles.
|
|
25
|
+
*/
|
|
26
|
+
export declare function rectsForRange(geometry: PageGeometry, startChar: number, endChar: number): HighlightRect[];
|
|
27
|
+
/**
|
|
28
|
+
* Extract text from a character range across all runs.
|
|
29
|
+
*/
|
|
30
|
+
export declare function textForRange(geometry: PageGeometry, startChar: number, endChar: number): string;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { PDFPageProxy } from '
|
|
2
|
-
import { DocumentInitParameters, PDFDataRangeTransport, PDFDocumentProxy, TypedArray } from 'pdfjs-dist/types/src/display/api';
|
|
3
|
-
import { PageViewport } from 'pdfjs-dist/types/web/interfaces';
|
|
1
|
+
import { PDFDocumentProxy, PDFPageProxy, Viewport } from '@pdf-viewer/pdfium/compat';
|
|
4
2
|
import { Dispatch, FC, PropsWithChildren, SetStateAction } from 'react';
|
|
5
3
|
export interface DocumentContextType {
|
|
6
4
|
pdf?: PDFDocumentProxy;
|
|
@@ -254,7 +252,7 @@ export type DecryptedLicense = {
|
|
|
254
252
|
};
|
|
255
253
|
export interface PdfPage {
|
|
256
254
|
page: PDFPageProxy;
|
|
257
|
-
thumbnailViewport:
|
|
255
|
+
thumbnailViewport: Viewport;
|
|
258
256
|
thumbnailScale: number;
|
|
259
257
|
defaultRotation: number;
|
|
260
258
|
}
|
|
@@ -291,7 +289,7 @@ export interface ThumbnailRenderedList {
|
|
|
291
289
|
loading: boolean;
|
|
292
290
|
page: PDFPageProxy;
|
|
293
291
|
thumbnailSrc?: string;
|
|
294
|
-
viewport:
|
|
292
|
+
viewport: Viewport;
|
|
295
293
|
scale: number;
|
|
296
294
|
defaultRotation: number;
|
|
297
295
|
}
|
|
@@ -300,8 +298,8 @@ export declare enum ViewMode {
|
|
|
300
298
|
DUAL_PAGE = "Dual",
|
|
301
299
|
DUAL_PAGE_WITH_COVER = "DualWithCover"
|
|
302
300
|
}
|
|
303
|
-
export type PDFSrc = string | URL |
|
|
304
|
-
export type RPSrc =
|
|
301
|
+
export type PDFSrc = string | URL | ArrayBuffer | Uint8Array | undefined | null;
|
|
302
|
+
export type RPSrc = PDFSrc;
|
|
305
303
|
export interface FullScreenToolProps {
|
|
306
304
|
isFullScreen: boolean;
|
|
307
305
|
toggleFullScreen: () => void;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var i = Object.defineProperty;
|
|
2
|
+
var a = (t, e, c) => e in t ? i(t, e, { enumerable: !0, configurable: !0, writable: !0, value: c }) : t[e] = c;
|
|
3
|
+
var h = (t, e, c) => (a(t, typeof e != "symbol" ? e + "" : e, c), c);
|
|
4
|
+
class o {
|
|
5
|
+
constructor(e = 50) {
|
|
6
|
+
h(this, "cache", /* @__PURE__ */ new Map());
|
|
7
|
+
h(this, "maxSize");
|
|
8
|
+
this.maxSize = e;
|
|
9
|
+
}
|
|
10
|
+
get(e) {
|
|
11
|
+
const c = this.cache.get(e);
|
|
12
|
+
return c !== void 0 && (this.cache.delete(e), this.cache.set(e, c)), c;
|
|
13
|
+
}
|
|
14
|
+
set(e, c) {
|
|
15
|
+
if (this.cache.has(e) && this.cache.delete(e), this.cache.size >= this.maxSize) {
|
|
16
|
+
const s = this.cache.keys().next().value;
|
|
17
|
+
s !== void 0 && this.cache.delete(s);
|
|
18
|
+
}
|
|
19
|
+
this.cache.set(e, c);
|
|
20
|
+
}
|
|
21
|
+
clear() {
|
|
22
|
+
this.cache.clear();
|
|
23
|
+
}
|
|
24
|
+
get size() {
|
|
25
|
+
return this.cache.size;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const l = new o();
|
|
29
|
+
export {
|
|
30
|
+
o as GeometryCache,
|
|
31
|
+
l as geometryCache
|
|
32
|
+
};
|