@react-pdf-kit/viewer 0.0.0-experimental.9 → 0.0.0-legacy.1
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/{Combination-479e39c6.js → Combination-17ab8af1.js} +184 -187
- package/dist/RPLayout.module-b4b23e29.js +14 -0
- package/dist/assets/style.css +1 -1
- package/dist/assets/style.js +15 -15
- package/dist/components/RPConfig.js +7 -16
- package/dist/components/RPController.js +21 -26
- package/dist/components/RPDropFileZone.js +27 -35
- package/dist/components/RPPages.js +352 -361
- package/dist/components/RPProvider.js +20 -24
- package/dist/components/layout/LayoutContainer.js +1 -1
- package/dist/components/layout/LayoutWrapper.js +1 -1
- package/dist/components/layout/RPDefaultLayout.js +6 -11
- package/dist/components/layout/RPLayout.js +21 -27
- package/dist/components/layout/WrapperLayout.js +9 -10
- package/dist/components/layout/sidebar/RPSidebar.js +3 -4
- package/dist/components/layout/sidebar/Thumbnail.js +3 -4
- package/dist/components/layout/sidebar/Thumbnails.js +3 -4
- package/dist/components/layout/toolbar/DocumentDialog.js +6 -7
- package/dist/components/layout/toolbar/DocumentProperties.js +2 -2
- package/dist/components/layout/toolbar/FileDownloadTool.js +5 -6
- package/dist/components/layout/toolbar/FileUploadTool.js +5 -6
- package/dist/components/layout/toolbar/FullScreenTool.js +2 -2
- package/dist/components/layout/toolbar/MenuItem.js +2 -2
- package/dist/components/layout/toolbar/MenuSeparator.js +2 -2
- package/dist/components/layout/toolbar/MostPageTool.js +5 -6
- package/dist/components/layout/toolbar/OtherTool.js +5 -6
- package/dist/components/layout/toolbar/Paginate.js +3 -4
- package/dist/components/layout/toolbar/PrintTool.js +5 -6
- package/dist/components/layout/toolbar/RPMenuItem.js +2 -2
- package/dist/components/layout/toolbar/RPMoreOptions.js +5 -6
- package/dist/components/layout/toolbar/RPToolbar.js +5 -8
- package/dist/components/layout/toolbar/RPToolbarEnd.js +5 -6
- package/dist/components/layout/toolbar/RotateTool.js +5 -6
- package/dist/components/layout/toolbar/ScrollModeTool.js +2 -2
- package/dist/components/layout/toolbar/SearchResultNavigator.js +3 -6
- package/dist/components/layout/toolbar/SearchTool.js +5 -8
- package/dist/components/layout/toolbar/SelectionModeTool.js +2 -2
- package/dist/components/layout/toolbar/ThumbnailTool.js +3 -4
- package/dist/components/layout/toolbar/ToolbarCustom.js +3 -4
- package/dist/components/layout/toolbar/ToolbarDefault.js +5 -8
- package/dist/components/layout/toolbar/ToolbarLayout.js +5 -8
- package/dist/components/layout/toolbar/ViewModeTool.js +2 -2
- package/dist/components/layout/toolbar/ZoomTool.js +5 -6
- package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +4 -5
- package/dist/components/layout/toolbar/tools/DualPageWithCoverTool.js +7 -13
- package/dist/components/layout/toolbar/tools/FileDownloadTool.js +3 -4
- package/dist/components/layout/toolbar/tools/FileUploadTool.js +3 -4
- package/dist/components/layout/toolbar/tools/FirstPageTool.js +7 -13
- package/dist/components/layout/toolbar/tools/InputPageTool.js +3 -4
- package/dist/components/layout/toolbar/tools/LastPageTool.js +7 -13
- package/dist/components/layout/toolbar/tools/NextPageTool.js +3 -4
- package/dist/components/layout/toolbar/tools/PreviousPageTool.js +3 -4
- package/dist/components/layout/toolbar/tools/PrintTool.js +3 -4
- package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +3 -4
- package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +3 -4
- package/dist/components/layout/toolbar/tools/ThumbnailTool.js +3 -4
- package/dist/components/layout/toolbar/tools/ZoomInTool.js +3 -4
- package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +15 -16
- package/dist/components/layout/toolbar/tools/ZoomOutTool.js +3 -4
- package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +5 -8
- package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +3 -4
- package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +5 -6
- package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +5 -6
- package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +5 -6
- package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +5 -6
- package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +5 -6
- package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +2 -2
- package/dist/components/page/AnnotationLayer.js +72 -69
- package/dist/components/page/CanvasLayer.js +3 -4
- package/dist/components/page/CustomElement.js +3 -4
- package/dist/components/page/DualPage.js +5 -11
- package/dist/components/page/DualPageWithCover.js +5 -11
- package/dist/components/page/RPPage.js +6 -12
- package/dist/components/page/SinglePage.js +5 -11
- package/dist/components/page/TextHighlightLayer.js +178 -86
- package/dist/components/page/TextLayer.js +170 -125
- package/dist/components/ui/DropDown.js +2 -2
- package/dist/components/ui/LoadingIndicator.js +7 -8
- package/dist/contexts/ConfigContext.js +4 -5
- package/dist/contexts/DimensionPagesContext.js +5 -6
- package/dist/contexts/DropFileZoneContext.js +4 -5
- package/dist/contexts/ElementPageContext.js +5 -6
- package/dist/contexts/FileInputContext.js +5 -6
- package/dist/contexts/HighlightContext.js +7 -10
- package/dist/contexts/LicenseContext.js +6 -8
- package/dist/contexts/PagesRotateContext.js +5 -6
- package/dist/contexts/PaginationContext.js +5 -6
- package/dist/contexts/PrintContext.js +16 -17
- package/dist/contexts/RPDocumentContext.js +13 -14
- package/dist/contexts/RenderQueueProvider.js +5 -6
- package/dist/contexts/RotationContext.js +8 -9
- package/dist/contexts/SearchContext.js +5 -8
- package/dist/contexts/ThumbnailsContext.js +4 -5
- package/dist/contexts/ZoomContext.js +5 -6
- package/dist/{index-535ad364.js → index-11f3cd64.js} +1 -1
- package/dist/main.js +115 -120
- package/dist/polyfills.js +8166 -0
- 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/main.d.ts +1 -1
- package/dist/types/utils/annotations.d.ts +2 -2
- package/dist/types/utils/getThumbnailViewport.d.ts +2 -2
- package/dist/types/utils/highlight.d.ts +5 -5
- package/dist/types/utils/hooks/useFlickerSelectText.d.ts +1 -0
- 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 +1 -5
- package/dist/types/utils/hooks/usePdfProperties.d.ts +1 -1
- package/dist/types/utils/hooks/useTextSelection.d.ts +3 -12
- package/dist/types/utils/link_service.d.ts +3 -2
- package/dist/types/utils/renderPage.d.ts +2 -2
- package/dist/types/utils/types.d.ts +8 -9
- package/dist/utils/highlight.js +158 -184
- package/dist/utils/hooks/useCopyText.js +22 -60
- package/dist/utils/hooks/useFileDownload.js +5 -6
- package/dist/utils/hooks/useFlickerSelectText.js +25 -0
- package/dist/utils/hooks/useHighlight.js +33 -35
- package/dist/utils/hooks/useLicense.js +29 -38
- package/dist/utils/hooks/useLoadPdf.js +80 -103
- package/dist/utils/hooks/useLoadWorker.js +14 -4
- package/dist/utils/hooks/usePageRotateContext.js +7 -8
- package/dist/utils/hooks/usePaginate.js +3 -4
- package/dist/utils/hooks/usePinch.js +10 -11
- package/dist/utils/hooks/usePresentPage.js +3 -4
- package/dist/utils/hooks/usePrint.js +78 -74
- package/dist/utils/hooks/useRotate.js +3 -4
- package/dist/utils/hooks/useScrollToPage.js +3 -4
- package/dist/utils/hooks/useSearch.js +15 -18
- package/dist/utils/hooks/useTextSelection.js +73 -2
- package/dist/utils/hooks/useThumbnail.js +17 -18
- package/dist/utils/hooks/useVirtualReactWindow.js +3 -4
- package/dist/utils/hooks/useWatermark.js +6 -8
- package/dist/utils/link_service.js +19 -18
- package/dist/utils/renderPage.js +1 -1
- package/dist/utils/types.js +3 -3
- package/package.json +14 -3
- package/dist/RPLayout.module-7766e0b4.js +0 -14
- package/dist/contexts/LayoutDropFileZoneContext.js +0 -11
- package/dist/contexts/TextSelectionContext.js +0 -191
- package/dist/types/contexts/LayoutDropFileZoneContext.d.ts +0 -9
- package/dist/types/contexts/TextSelectionContext.d.ts +0 -14
- package/dist/types/utils/geometryCache.d.ts +0 -15
- package/dist/types/utils/glyphHitTest.d.ts +0 -12
- package/dist/types/utils/hooks/useDropFileZone.d.ts +0 -5
- package/dist/types/utils/selectionUtils.d.ts +0 -30
- package/dist/utils/geometryCache.js +0 -32
- package/dist/utils/glyphHitTest.js +0 -29
- package/dist/utils/hooks/useDropFileZone.js +0 -12
- package/dist/utils/selectionUtils.js +0 -96
|
@@ -1,156 +1,201 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { useDocumentContext as
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { useZoomContext as V } from "../../contexts/ZoomContext.js";
|
|
8
|
-
import { geometryCache as Z } from "../../utils/geometryCache.js";
|
|
9
|
-
import { rectsForRange as k } from "../../utils/selectionUtils.js";
|
|
10
|
-
import { SelectionMode as F } from "../../utils/types.js";
|
|
1
|
+
import { jsx as B } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as g, useState as H, useMemo as P, useCallback as _, useEffect as w } from "react";
|
|
3
|
+
import { useDocumentContext as G } from "../../contexts/RPDocumentContext.js";
|
|
4
|
+
import * as J from "pdfjs-dist";
|
|
5
|
+
import { resetDivs as $, highlightMatches as U } from "../../utils/highlight.js";
|
|
6
|
+
import { useSearchContext as V } from "../../contexts/SearchContext.js";
|
|
11
7
|
import "../../utils/hooks/useLoadPdf.js";
|
|
12
|
-
import "
|
|
13
|
-
import "
|
|
8
|
+
import "../../utils/types.js";
|
|
9
|
+
import "../../de_DE-a553b162.js";
|
|
14
10
|
import "../../utils/getThumbnailViewport.js";
|
|
15
11
|
import "../../contexts/ConfigContext.js";
|
|
16
12
|
import "../../contexts/DocumentPasswordContext.js";
|
|
17
13
|
import "../../utils/appConsole.js";
|
|
18
|
-
import "../../de_DE-a553b162.js";
|
|
19
14
|
import "../../utils/hooks/usePdfProperties.js";
|
|
20
15
|
import "../../utils/convertPdfDate.js";
|
|
21
16
|
import "../../utils/formatFileSize.js";
|
|
22
|
-
import "../../utils/hooks/useSearch.js";
|
|
23
|
-
import "../../utils/highlight.js";
|
|
24
17
|
import "../../utils/charators.js";
|
|
18
|
+
import "../../utils/hooks/useSearch.js";
|
|
25
19
|
import "../../contexts/VirtualScrollContext.js";
|
|
26
20
|
import "../../contexts/ScrollModeContext.js";
|
|
27
21
|
import "../../contexts/InitialStateContext.js";
|
|
28
|
-
import "../../
|
|
22
|
+
import "../../contexts/ZoomContext.js";
|
|
23
|
+
import "../../utils/constants.js";
|
|
24
|
+
import "../../utils/getZoomLevel.js";
|
|
25
|
+
import "../../contexts/LayoutContainerContext.js";
|
|
26
|
+
import "../../contexts/ViewModeContext.js";
|
|
27
|
+
import "../../contexts/RotationContext.js";
|
|
29
28
|
import "../../contexts/GlobalCurrentPage.js";
|
|
30
29
|
import "../../contexts/EventCallbackContext.js";
|
|
31
|
-
import "../../
|
|
30
|
+
import "../../utils/hooks/useDebounce.js";
|
|
31
|
+
import "../../PaginationContext-9217cab4.js";
|
|
32
32
|
import "../../contexts/VirtualGridContext.js";
|
|
33
33
|
import "../../utils/smoothScrollTo.js";
|
|
34
34
|
import "../../contexts/DimensionPagesContext.js";
|
|
35
|
-
import "../../utils/constants.js";
|
|
36
35
|
import "../../contexts/PagesRotateContext.js";
|
|
37
|
-
import "../../contexts/RotationContext.js";
|
|
38
|
-
import "../../utils/getZoomLevel.js";
|
|
39
|
-
import "../../contexts/LayoutContainerContext.js";
|
|
40
|
-
import "../../utils/hooks/useDebounce.js";
|
|
41
36
|
import "../../contexts/SmoothScrollContext.js";
|
|
42
37
|
import "../../utils/getScrollDistance.js";
|
|
43
38
|
import "../../utils/calculatePage.js";
|
|
44
39
|
import "../../utils/getWordPositionInPage.js";
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"rp-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
L(() => {
|
|
62
|
-
const t = p.get(o);
|
|
63
|
-
if (!t)
|
|
64
|
-
return;
|
|
65
|
-
const r = t.page.getViewport({ scale: c }), s = t.page.getPageGeometry(r);
|
|
66
|
-
Z.set(e, s), P(s);
|
|
67
|
-
}, [p, o, e, c]);
|
|
68
|
-
const R = d(() => $(e), [$, e, w]), x = d(() => i.filter((t) => t.pageIndex === e), [i, e]), b = d(() => {
|
|
69
|
-
if (!x.length || !u)
|
|
70
|
-
return [];
|
|
71
|
-
const t = [];
|
|
72
|
-
for (const [r, s] of x.entries()) {
|
|
73
|
-
const C = X(u, s), N = l !== null && l.pageIndex === e && l.pageMatchIdx === s.pageMatchIdx;
|
|
74
|
-
C.length > 0 && t.push({ rects: C, isActive: N, matchIndex: r });
|
|
75
|
-
}
|
|
76
|
-
return t;
|
|
77
|
-
}, [x, u, l, e]), I = y(
|
|
78
|
-
(t) => {
|
|
79
|
-
!n || !m.current || _(e, t, m.current);
|
|
80
|
-
},
|
|
81
|
-
[n, _, e]
|
|
82
|
-
), S = y(
|
|
83
|
-
(t) => {
|
|
84
|
-
!n || !m.current || v(e, t, m.current);
|
|
40
|
+
const X = "_selecting_1553j_14", z = "_markedContent_1553j_37", a = {
|
|
41
|
+
"rp-text-layer": "_rp-text-layer_1553j_1",
|
|
42
|
+
selecting: X,
|
|
43
|
+
markedContent: z,
|
|
44
|
+
"rp-text-layer-text": "_rp-text-layer-text_1553j_61"
|
|
45
|
+
}, Ae = (k) => {
|
|
46
|
+
const { pageNumber: d } = k, { pages: R } = G(), i = g(null), { matches: O, currentMatch: v } = V(), [D, A] = H(
|
|
47
|
+
[]
|
|
48
|
+
), p = g(), h = g(), L = g([]), y = P(() => O.filter((r) => r.pageIndex === d - 1), [O, d]), T = _(
|
|
49
|
+
(r, t, e = !1) => {
|
|
50
|
+
if (e && $(r, t), !y.length) {
|
|
51
|
+
L.current = [], A([]);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const n = U(y, r, t);
|
|
55
|
+
A(n);
|
|
85
56
|
},
|
|
86
|
-
[
|
|
87
|
-
),
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
57
|
+
[y]
|
|
58
|
+
), x = g(), C = g(!1), E = _(() => Array.from(document.querySelectorAll('[data-rp$="-textLayer"]')), []);
|
|
59
|
+
w(() => ((() => {
|
|
60
|
+
if (x.current)
|
|
61
|
+
return;
|
|
62
|
+
x.current = new AbortController();
|
|
63
|
+
const { signal: t } = x.current, e = () => {
|
|
64
|
+
E().forEach((o) => {
|
|
65
|
+
const s = o.querySelector(".endOfContent");
|
|
66
|
+
s && (o.appendChild(s), s.style.width = "", s.style.height = "", o.classList.remove(a.selecting));
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
document.addEventListener(
|
|
70
|
+
"pointerdown",
|
|
71
|
+
() => {
|
|
72
|
+
C.current = !0;
|
|
73
|
+
},
|
|
74
|
+
{ signal: t }
|
|
75
|
+
), document.addEventListener(
|
|
76
|
+
"pointerup",
|
|
77
|
+
() => {
|
|
78
|
+
C.current = !1, e();
|
|
79
|
+
},
|
|
80
|
+
{ signal: t }
|
|
81
|
+
), window.addEventListener(
|
|
82
|
+
"blur",
|
|
83
|
+
() => {
|
|
84
|
+
C.current = !1, e();
|
|
85
|
+
},
|
|
86
|
+
{ signal: t }
|
|
87
|
+
), document.addEventListener(
|
|
88
|
+
"keyup",
|
|
89
|
+
() => {
|
|
90
|
+
C.current || e();
|
|
91
|
+
},
|
|
92
|
+
{ signal: t }
|
|
93
|
+
);
|
|
94
|
+
let n = null;
|
|
95
|
+
document.addEventListener(
|
|
96
|
+
"selectionchange",
|
|
97
|
+
() => {
|
|
98
|
+
var M, j;
|
|
99
|
+
const o = document.getSelection();
|
|
100
|
+
if (!o)
|
|
101
|
+
return;
|
|
102
|
+
if (o.rangeCount === 0) {
|
|
103
|
+
e();
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const s = /* @__PURE__ */ new Set();
|
|
107
|
+
for (let c = 0; c < o.rangeCount; c++) {
|
|
108
|
+
const f = o.getRangeAt(c);
|
|
109
|
+
E().forEach((N) => {
|
|
110
|
+
f.intersectsNode(N) && !s.has(N) && s.add(N);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
E().forEach((c) => {
|
|
114
|
+
if (s.has(c))
|
|
115
|
+
c.classList.add(a.selecting);
|
|
116
|
+
else {
|
|
117
|
+
const f = c.querySelector(".endOfContent");
|
|
118
|
+
f && (c.appendChild(f), f.style.width = "", f.style.height = "", c.classList.remove(a.selecting));
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
const l = o.getRangeAt(0);
|
|
122
|
+
let u = n && (l.compareBoundaryPoints(Range.END_TO_END, n) === 0 || l.compareBoundaryPoints(Range.START_TO_END, n) === 0) ? l.startContainer : l.endContainer;
|
|
123
|
+
u.nodeType === Node.TEXT_NODE && (u = u.parentNode);
|
|
124
|
+
const m = (M = u.parentElement) == null ? void 0 : M.closest(
|
|
125
|
+
a["rp-text-layer"]
|
|
126
|
+
), S = m == null ? void 0 : m.querySelector(".endOfContent");
|
|
127
|
+
S && m && (S.style.width = m.style.width, S.style.height = m.style.height, (j = u.parentElement) == null || j.insertBefore(S, u.nextSibling)), n = l.cloneRange();
|
|
128
|
+
},
|
|
129
|
+
{ signal: t }
|
|
130
|
+
);
|
|
131
|
+
})(), () => {
|
|
132
|
+
var t;
|
|
133
|
+
(t = x.current) == null || t.abort(), x.current = void 0;
|
|
134
|
+
}), [E]);
|
|
135
|
+
const q = _(() => {
|
|
136
|
+
i.current && i.current.classList.add(a.selecting);
|
|
137
|
+
}, []), I = _(() => {
|
|
138
|
+
i.current && i.current.classList.remove(a.selecting);
|
|
139
|
+
}, []);
|
|
140
|
+
return w(() => {
|
|
141
|
+
if (L.current.forEach((e) => {
|
|
142
|
+
e.classList.remove("selected");
|
|
143
|
+
}), !D.length || !v || v.pageIndex !== d - 1)
|
|
144
|
+
return;
|
|
145
|
+
const r = y.findIndex(
|
|
146
|
+
(e) => JSON.stringify(e) === JSON.stringify(v)
|
|
147
|
+
);
|
|
148
|
+
if (r === -1)
|
|
149
|
+
return;
|
|
150
|
+
const t = D.filter((e) => e.index === r);
|
|
151
|
+
t.length && (L.current = t.map((e) => e.element), t.forEach((e) => {
|
|
152
|
+
e.element.classList.add("selected");
|
|
153
|
+
}));
|
|
154
|
+
}, [v, D, y]), w(() => {
|
|
155
|
+
const r = R.get(d);
|
|
156
|
+
if (!r || !i.current)
|
|
157
|
+
return;
|
|
158
|
+
const t = i.current;
|
|
159
|
+
return p.current && p.current.cancel(), r.page.getTextContent().then((e) => {
|
|
160
|
+
const n = r.page.getViewport({ scale: 1 });
|
|
161
|
+
return p.current = new J.TextLayer({
|
|
162
|
+
viewport: n,
|
|
163
|
+
textContentSource: e,
|
|
164
|
+
container: t
|
|
165
|
+
}), h.current = e, t && (t.innerText = ""), p.current.render();
|
|
166
|
+
}).then(() => {
|
|
167
|
+
var s, l;
|
|
168
|
+
[].slice.call(t.children).forEach((b) => {
|
|
169
|
+
b.classList.add(a["rp-text-layer-text"]), b.setAttribute("data-rp", "rp-text-layer-text");
|
|
170
|
+
});
|
|
171
|
+
const n = (s = p.current) == null ? void 0 : s.textDivs;
|
|
172
|
+
n && h.current && T(h.current, n);
|
|
173
|
+
const o = document.createElement("div");
|
|
174
|
+
o.className = "endOfContent", (l = i.current) == null || l.appendChild(o);
|
|
175
|
+
}).catch(() => {
|
|
176
|
+
}), () => {
|
|
177
|
+
var e;
|
|
178
|
+
(e = p.current) == null || e.cancel();
|
|
179
|
+
};
|
|
180
|
+
}, [R, d]), w(() => {
|
|
181
|
+
var e;
|
|
182
|
+
[].slice.call(i.current.children).forEach((n) => {
|
|
183
|
+
n.classList.add(a["rp-text-layer-text"]);
|
|
184
|
+
});
|
|
185
|
+
const t = (e = p.current) == null ? void 0 : e.textDivs;
|
|
186
|
+
t && h.current && T(h.current, t, !0);
|
|
187
|
+
}, [T]), /* @__PURE__ */ B(
|
|
91
188
|
"div",
|
|
92
189
|
{
|
|
93
190
|
"data-rp-text-layer": !0,
|
|
94
|
-
"data-rp": `page-${
|
|
95
|
-
className:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
{
|
|
100
|
-
className: h["rp-selection-highlight"],
|
|
101
|
-
style: {
|
|
102
|
-
position: "absolute",
|
|
103
|
-
left: `${t.x}px`,
|
|
104
|
-
top: `${t.y}px`,
|
|
105
|
-
width: `${t.width}px`,
|
|
106
|
-
height: `${t.height}px`
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
`sel-${r}`
|
|
110
|
-
)),
|
|
111
|
-
b.map(
|
|
112
|
-
(t) => t.rects.map((r, s) => /* @__PURE__ */ f(
|
|
113
|
-
"div",
|
|
114
|
-
{
|
|
115
|
-
className: t.isActive ? h["rp-search-highlight-active"] : h["rp-search-highlight"],
|
|
116
|
-
style: {
|
|
117
|
-
position: "absolute",
|
|
118
|
-
left: `${r.x}px`,
|
|
119
|
-
top: `${r.y}px`,
|
|
120
|
-
width: `${r.width}px`,
|
|
121
|
-
height: `${r.height}px`
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
`search-${t.matchIndex}-${s}`
|
|
125
|
-
))
|
|
126
|
-
),
|
|
127
|
-
/* @__PURE__ */ f(
|
|
128
|
-
"div",
|
|
129
|
-
{
|
|
130
|
-
ref: m,
|
|
131
|
-
className: h["rp-text-interaction-overlay"],
|
|
132
|
-
style: {
|
|
133
|
-
position: "absolute",
|
|
134
|
-
inset: 0,
|
|
135
|
-
cursor: n ? "text" : "default"
|
|
136
|
-
},
|
|
137
|
-
onPointerDown: I,
|
|
138
|
-
onPointerMove: S,
|
|
139
|
-
onPointerUp: q
|
|
140
|
-
}
|
|
141
|
-
)
|
|
142
|
-
]
|
|
191
|
+
"data-rp": `page-${d}-textLayer`,
|
|
192
|
+
className: a["rp-text-layer"],
|
|
193
|
+
ref: i,
|
|
194
|
+
onMouseDown: q,
|
|
195
|
+
onMouseUp: I
|
|
143
196
|
}
|
|
144
197
|
);
|
|
145
198
|
};
|
|
146
|
-
function X(a, o) {
|
|
147
|
-
let e = 0, p = 0, c = 0;
|
|
148
|
-
for (let i = 0; i < a.runs.length; i++) {
|
|
149
|
-
const g = a.runs[i].glyphs.length;
|
|
150
|
-
o.start.idx === i && (e = c + o.start.offset), o.end.idx === i && (p = c + o.end.offset - 1), c += g;
|
|
151
|
-
}
|
|
152
|
-
return p < e ? [] : k(a, e, p);
|
|
153
|
-
}
|
|
154
199
|
export {
|
|
155
|
-
|
|
200
|
+
Ae as TextLayer
|
|
156
201
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsxs as p, jsx as d } from "react/jsx-runtime";
|
|
2
|
-
import { R as l, T as c, P as _, C as m } from "../../index-
|
|
2
|
+
import { R as l, T as c, P as _, C as m } from "../../index-11f3cd64.js";
|
|
3
3
|
import { c as A } from "../../clsx-0c6e471a.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "../../index-113053cf.js";
|
|
6
6
|
import "react-dom";
|
|
7
7
|
import "../../index-23911b43.js";
|
|
8
|
-
import "../../Combination-
|
|
8
|
+
import "../../Combination-17ab8af1.js";
|
|
9
9
|
import "../../index-d0f0aa9a.js";
|
|
10
10
|
import "../../index-ada501c4.js";
|
|
11
11
|
const F = "_slideDownAndFade_1vzkq_1", w = "_slideLeftAndFade_1vzkq_1", f = "_slideUpAndFade_1vzkq_1", g = "_slideRightAndFade_1vzkq_1", h = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as a, jsxs as
|
|
1
|
+
import { jsx as a, jsxs as t } from "react/jsx-runtime";
|
|
2
2
|
import { c as o } from "../../clsx-0c6e471a.js";
|
|
3
3
|
import { usePrintContext as p } from "../../contexts/PrintContext.js";
|
|
4
4
|
import { useLocalizationContext as d } from "../../contexts/LocalizationContext.js";
|
|
@@ -6,8 +6,7 @@ import "react";
|
|
|
6
6
|
import "../../utils/hooks/usePrint.js";
|
|
7
7
|
import "../../contexts/RPDocumentContext.js";
|
|
8
8
|
import "../../utils/hooks/useLoadPdf.js";
|
|
9
|
-
import "
|
|
10
|
-
import "@pdf-viewer/pdfium/compat";
|
|
9
|
+
import "pdfjs-dist";
|
|
11
10
|
import "../../utils/types.js";
|
|
12
11
|
import "../../de_DE-a553b162.js";
|
|
13
12
|
import "../../utils/getThumbnailViewport.js";
|
|
@@ -26,10 +25,10 @@ const s = "_loading_wazy2_1", i = {
|
|
|
26
25
|
"rp-loading-progress": "_rp-loading-progress_wazy2_35",
|
|
27
26
|
"rp-loading-cancel-button": "_rp-loading-cancel-button_wazy2_55",
|
|
28
27
|
loading: s
|
|
29
|
-
},
|
|
28
|
+
}, I = ({ percentage: n }) => {
|
|
30
29
|
const { cancel: l } = p(), { localeMessages: r } = d();
|
|
31
|
-
return
|
|
32
|
-
/* @__PURE__ */
|
|
30
|
+
return n < 1 ? null : /* @__PURE__ */ a("div", { className: o(i["rp-loading-overlay"]), children: /* @__PURE__ */ t("div", { className: o(i["rp-loading-modal"]), children: [
|
|
31
|
+
/* @__PURE__ */ t("div", { className: o(i["rp-loading-title"]), children: [
|
|
33
32
|
r == null ? void 0 : r.printLoadingMessage,
|
|
34
33
|
"..."
|
|
35
34
|
] }),
|
|
@@ -37,12 +36,12 @@ const s = "_loading_wazy2_1", i = {
|
|
|
37
36
|
"div",
|
|
38
37
|
{
|
|
39
38
|
className: o(i["rp-loading-progress"]),
|
|
40
|
-
style: { width: `${
|
|
39
|
+
style: { width: `${n}%` }
|
|
41
40
|
}
|
|
42
41
|
) }),
|
|
43
42
|
/* @__PURE__ */ a("button", { className: o(i["rp-loading-cancel-button"]), onClick: l, children: r == null ? void 0 : r.printCancelLabel })
|
|
44
43
|
] }) });
|
|
45
44
|
};
|
|
46
45
|
export {
|
|
47
|
-
|
|
46
|
+
I as default
|
|
48
47
|
};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { createContext as i, useContext as s } from "react";
|
|
3
3
|
const o = i({
|
|
4
|
-
workerUrlAdded: !1
|
|
5
|
-
|
|
6
|
-
}), d = () => s(o), f = (t) => {
|
|
4
|
+
workerUrlAdded: !1
|
|
5
|
+
}), f = () => s(o), x = (t) => {
|
|
7
6
|
const { children: e, ...r } = t;
|
|
8
7
|
return /* @__PURE__ */ n(o.Provider, { value: r, children: e });
|
|
9
8
|
};
|
|
10
9
|
export {
|
|
11
10
|
o as ConfigContext,
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
x as ConfigContextProvider,
|
|
12
|
+
f as useConfigContext
|
|
14
13
|
};
|
|
@@ -6,8 +6,7 @@ import { useZoomContext as y } from "./ZoomContext.js";
|
|
|
6
6
|
import { PAGE_PADDING as f } from "../utils/constants.js";
|
|
7
7
|
import { usePagesRotateContext as D } from "./PagesRotateContext.js";
|
|
8
8
|
import "../utils/hooks/useLoadPdf.js";
|
|
9
|
-
import "
|
|
10
|
-
import "@pdf-viewer/pdfium/compat";
|
|
9
|
+
import "pdfjs-dist";
|
|
11
10
|
import "../utils/types.js";
|
|
12
11
|
import "../de_DE-a553b162.js";
|
|
13
12
|
import "../utils/getThumbnailViewport.js";
|
|
@@ -31,14 +30,14 @@ const g = x({
|
|
|
31
30
|
},
|
|
32
31
|
setHeights: () => {
|
|
33
32
|
}
|
|
34
|
-
}),
|
|
33
|
+
}), T = () => {
|
|
35
34
|
const e = v(g), { widths: r, heights: o } = e;
|
|
36
35
|
if (r && o) {
|
|
37
36
|
const m = r.every((t) => typeof t == "number"), i = o.every((t) => typeof t == "number");
|
|
38
37
|
(!m || !i) && C.warn("Please use this hooks inside children component of RPProvider");
|
|
39
38
|
}
|
|
40
39
|
return e;
|
|
41
|
-
},
|
|
40
|
+
}, U = ({ children: e }) => {
|
|
42
41
|
const [r, o] = u([]), [m, i] = u([]), { pages: t } = l(), { currentZoom: n } = y(), { pageRotate: p } = D();
|
|
43
42
|
return w(() => {
|
|
44
43
|
if (!t)
|
|
@@ -56,6 +55,6 @@ const g = x({
|
|
|
56
55
|
}, [n, p, t]), /* @__PURE__ */ P(g.Provider, { value: { widths: r, heights: m, setWidths: o, setHeights: i }, children: e });
|
|
57
56
|
};
|
|
58
57
|
export {
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
U as DimensionPagesProvider,
|
|
59
|
+
T as useDimensionPagesContext
|
|
61
60
|
};
|
|
@@ -5,8 +5,7 @@ import { useToolbarComponentContext as T } from "./ToolbarComponentContext.js";
|
|
|
5
5
|
import { useDocumentPasswordContext as v } from "./DocumentPasswordContext.js";
|
|
6
6
|
import { useToolComponentContext as L } from "./ToolComponentContext.js";
|
|
7
7
|
import "../utils/hooks/useLoadPdf.js";
|
|
8
|
-
import "
|
|
9
|
-
import "@pdf-viewer/pdfium/compat";
|
|
8
|
+
import "pdfjs-dist";
|
|
10
9
|
import "../utils/types.js";
|
|
11
10
|
import "../de_DE-a553b162.js";
|
|
12
11
|
import "../utils/getThumbnailViewport.js";
|
|
@@ -23,7 +22,7 @@ const l = x({
|
|
|
23
22
|
},
|
|
24
23
|
handleDrop: () => {
|
|
25
24
|
}
|
|
26
|
-
}),
|
|
25
|
+
}), H = () => P(l), I = ({ children: m }) => {
|
|
27
26
|
const [c, e] = F(!1), { setFilename: n, setPdfSrc: a } = h(), { openFileTool: p } = T(), { openFileTool: s } = L(), { setPassword: f } = v(), u = r(
|
|
28
27
|
(o) => {
|
|
29
28
|
var i;
|
|
@@ -58,6 +57,6 @@ const l = x({
|
|
|
58
57
|
};
|
|
59
58
|
export {
|
|
60
59
|
l as DropFileZoneContext,
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
I as DropFileZoneProvider,
|
|
61
|
+
H as useDropFileZoneContext
|
|
63
62
|
};
|
|
@@ -16,8 +16,7 @@ import "../de_DE-a553b162.js";
|
|
|
16
16
|
import "../utils/appConsole.js";
|
|
17
17
|
import "./RPDocumentContext.js";
|
|
18
18
|
import "../utils/hooks/useLoadPdf.js";
|
|
19
|
-
import "
|
|
20
|
-
import "@pdf-viewer/pdfium/compat";
|
|
19
|
+
import "pdfjs-dist";
|
|
21
20
|
import "../utils/getThumbnailViewport.js";
|
|
22
21
|
import "./ConfigContext.js";
|
|
23
22
|
import "./DocumentPasswordContext.js";
|
|
@@ -32,7 +31,7 @@ import "../utils/hooks/useLicense.js";
|
|
|
32
31
|
import "../utils/getZoomLevel.js";
|
|
33
32
|
import "./GlobalCurrentPage.js";
|
|
34
33
|
import "../utils/hooks/useDebounce.js";
|
|
35
|
-
const S = H(void 0),
|
|
34
|
+
const S = H(void 0), Ve = ({ children: l }) => {
|
|
36
35
|
const [s, m] = N({}), { widths: t, heights: r } = J(), { pagesRef: c } = Y(), { scrollMode: C } = $(), { pageRotate: u } = K(), { currentZoom: a } = X(), { columnCount: R } = te(), { pageScrollElementRef: I, virtualScrollableElementRef: T } = oe(), M = d(
|
|
37
36
|
(e, i, o = { behavior: "smooth" }) => {
|
|
38
37
|
var v;
|
|
@@ -102,7 +101,7 @@ const S = H(void 0), be = ({ children: l }) => {
|
|
|
102
101
|
}
|
|
103
102
|
);
|
|
104
103
|
}, h = () => {
|
|
105
|
-
},
|
|
104
|
+
}, be = () => {
|
|
106
105
|
const l = U(S), { type: s, validating: m } = Q(), t = W(0), r = q(() => {
|
|
107
106
|
if (m !== !1)
|
|
108
107
|
return {
|
|
@@ -135,6 +134,6 @@ const S = H(void 0), be = ({ children: l }) => {
|
|
|
135
134
|
};
|
|
136
135
|
export {
|
|
137
136
|
S as ElementPageContext,
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
Ve as ElementPageProvider,
|
|
138
|
+
be as useElementPageContext
|
|
140
139
|
};
|
|
@@ -3,8 +3,7 @@ import { createContext as C, useRef as s, useContext as F } from "react";
|
|
|
3
3
|
import { useDocumentContext as h } from "./RPDocumentContext.js";
|
|
4
4
|
import { useDocumentPasswordContext as P } from "./DocumentPasswordContext.js";
|
|
5
5
|
import "../utils/hooks/useLoadPdf.js";
|
|
6
|
-
import "
|
|
7
|
-
import "@pdf-viewer/pdfium/compat";
|
|
6
|
+
import "pdfjs-dist";
|
|
8
7
|
import "../utils/types.js";
|
|
9
8
|
import "../de_DE-a553b162.js";
|
|
10
9
|
import "../utils/getThumbnailViewport.js";
|
|
@@ -13,7 +12,7 @@ import "../utils/hooks/usePdfProperties.js";
|
|
|
13
12
|
import "../utils/convertPdfDate.js";
|
|
14
13
|
import "../utils/formatFileSize.js";
|
|
15
14
|
import "../utils/appConsole.js";
|
|
16
|
-
const c = C(null),
|
|
15
|
+
const c = C(null), S = ({ children: e }) => {
|
|
17
16
|
const { setFilename: l, setPdfSrc: u } = h(), o = s(), n = s(null), { setPassword: m } = P(), a = () => {
|
|
18
17
|
var t;
|
|
19
18
|
(t = n.current) == null || t.click();
|
|
@@ -38,13 +37,13 @@ const c = C(null), q = ({ children: e }) => {
|
|
|
38
37
|
}
|
|
39
38
|
)
|
|
40
39
|
] });
|
|
41
|
-
},
|
|
40
|
+
}, q = () => {
|
|
42
41
|
const e = F(c);
|
|
43
42
|
if (!e)
|
|
44
43
|
throw new Error("useOpenFileContext must be used within FileInputProvider");
|
|
45
44
|
return e;
|
|
46
45
|
};
|
|
47
46
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
S as FileInputProvider,
|
|
48
|
+
q as useOpenFileContext
|
|
50
49
|
};
|
|
@@ -3,8 +3,7 @@ import { createContext as g, useContext as n } from "react";
|
|
|
3
3
|
import { useDocumentContext as s } from "./RPDocumentContext.js";
|
|
4
4
|
import { useHighlight as c } from "../utils/hooks/useHighlight.js";
|
|
5
5
|
import "../utils/hooks/useLoadPdf.js";
|
|
6
|
-
import "
|
|
7
|
-
import "@pdf-viewer/pdfium/compat";
|
|
6
|
+
import "pdfjs-dist";
|
|
8
7
|
import "../utils/types.js";
|
|
9
8
|
import "../de_DE-a553b162.js";
|
|
10
9
|
import "../utils/getThumbnailViewport.js";
|
|
@@ -16,12 +15,10 @@ import "../utils/convertPdfDate.js";
|
|
|
16
15
|
import "../utils/formatFileSize.js";
|
|
17
16
|
import "../utils/highlight.js";
|
|
18
17
|
import "../utils/charators.js";
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return /* @__PURE__ */ p(o.Provider, { value: { highlight: r, highlightMatches: e, highlightKeywords: m, clear: h }, children: t });
|
|
24
|
-
}, A = () => {
|
|
18
|
+
const o = g(void 0), M = ({ children: t }) => {
|
|
19
|
+
const { pdf: i } = s(), { highlight: r, highlightMatches: e, highlightKeywords: h, clear: m } = c(i);
|
|
20
|
+
return /* @__PURE__ */ p(o.Provider, { value: { highlight: r, highlightMatches: e, highlightKeywords: h, clear: m }, children: t });
|
|
21
|
+
}, k = () => {
|
|
25
22
|
const t = n(o);
|
|
26
23
|
if (!t)
|
|
27
24
|
throw new Error("useHighlightContext must be used within a HighlightProvider");
|
|
@@ -29,6 +26,6 @@ const o = g(void 0), z = ({ children: t }) => {
|
|
|
29
26
|
};
|
|
30
27
|
export {
|
|
31
28
|
o as HighlightContext,
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
M as HighlightProvider,
|
|
30
|
+
k as useHighlightContext
|
|
34
31
|
};
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as s, useContext as i } from "react";
|
|
3
3
|
import { useLicense as c } from "../utils/hooks/useLicense.js";
|
|
4
|
-
import "../utils/types.js";
|
|
5
|
-
import "../de_DE-a553b162.js";
|
|
6
4
|
import "../utils/appConsole.js";
|
|
7
|
-
const e =
|
|
5
|
+
const e = s({ isValid: !1 }), a = () => i(e), f = ({
|
|
8
6
|
children: t,
|
|
9
7
|
licenseKey: o
|
|
10
8
|
}) => {
|
|
11
9
|
const r = c(o);
|
|
12
|
-
return /* @__PURE__ */
|
|
10
|
+
return /* @__PURE__ */ n(e.Provider, { value: r, children: t });
|
|
13
11
|
};
|
|
14
12
|
export {
|
|
15
13
|
e as LicenseContext,
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
f as LicenseProvider,
|
|
15
|
+
a as useLicenseContext
|
|
18
16
|
};
|
|
@@ -4,8 +4,7 @@ import { useDocumentContext as x } from "./RPDocumentContext.js";
|
|
|
4
4
|
import { useRotationContext as C } from "./RotationContext.js";
|
|
5
5
|
import { useEventCallbackContext as d } from "./EventCallbackContext.js";
|
|
6
6
|
import "../utils/hooks/useLoadPdf.js";
|
|
7
|
-
import "
|
|
8
|
-
import "@pdf-viewer/pdfium/compat";
|
|
7
|
+
import "pdfjs-dist";
|
|
9
8
|
import "../utils/types.js";
|
|
10
9
|
import "../de_DE-a553b162.js";
|
|
11
10
|
import "../utils/getThumbnailViewport.js";
|
|
@@ -21,10 +20,10 @@ const p = R({
|
|
|
21
20
|
setSinglePageRotate: () => {
|
|
22
21
|
},
|
|
23
22
|
pageRotate: {}
|
|
24
|
-
}),
|
|
23
|
+
}), G = () => {
|
|
25
24
|
const { singlePageRotate: a, setSinglePageRotate: t, pageRotate: r } = c(p);
|
|
26
25
|
return { singlePageRotate: a, setSinglePageRotate: t, pageRotate: r };
|
|
27
|
-
},
|
|
26
|
+
}, H = ({ children: a }) => {
|
|
28
27
|
const [t, r] = f({}), { rotate: n } = C(), { pages: e } = x(), { onRotate: i } = d();
|
|
29
28
|
l(() => {
|
|
30
29
|
e && r({});
|
|
@@ -39,6 +38,6 @@ const p = R({
|
|
|
39
38
|
};
|
|
40
39
|
export {
|
|
41
40
|
p as PagesRotateContext,
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
H as PagesRotateProvider,
|
|
42
|
+
G as usePagesRotateContext
|
|
44
43
|
};
|