@react-pdf-kit/viewer 2.0.0-beta.1 → 2.0.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/Combination-54a77a7a.js +701 -0
- package/dist/MostPageTool.module-13578ad6.js +6 -0
- package/dist/OtherTool.module-a4be5f1f.js +6 -0
- package/dist/Paginate.module-206a7d7d.js +8 -0
- package/dist/PaginationContext-9217cab4.js +201 -0
- package/dist/{LayoutWrapper-6224491f.js → RPLayout.module-967bf4bc.js} +3 -9
- package/dist/RPToolbar.module-27d7fe77.js +10 -0
- package/dist/SearchTool.module-99f60dc7.js +16 -0
- package/dist/ToolbarLayout.module-1fee0a18.js +11 -0
- package/dist/ZoomTool.module-7082af8c.js +12 -0
- package/dist/assets/style.css +1 -1
- package/dist/assets/style.js +32 -31
- package/dist/components/RPConfig.js +10 -1485
- package/dist/components/RPController.js +77 -148
- package/dist/components/RPPages.js +981 -124
- package/dist/components/RPProvider.js +56 -118
- package/dist/components/icons/DualPageIcon.js +6 -6
- package/dist/components/icons/SinglePageIcon.js +6 -6
- package/dist/components/layout/LayoutContainer.js +31 -138
- package/dist/components/layout/LayoutWrapper.js +8 -4
- package/dist/components/layout/RPDefaultLayout.js +162 -88
- package/dist/components/layout/RPLayout.js +119 -107
- package/dist/components/layout/sidebar/RPSidebar.js +83 -113
- package/dist/components/layout/sidebar/Thumbnail.js +120 -126
- package/dist/components/layout/sidebar/Thumbnails.js +56 -121
- package/dist/components/layout/toolbar/DarkModeTool.js +6 -4
- package/dist/components/layout/toolbar/DocumentDialog.js +304 -132
- package/dist/components/layout/toolbar/DocumentProperties.js +12 -9
- package/dist/components/layout/toolbar/FileDownloadTool.js +34 -126
- package/dist/components/layout/toolbar/FileUploadTool.js +8 -5
- package/dist/components/layout/toolbar/FullScreenTool.js +16 -13
- package/dist/components/layout/toolbar/MenuItem.js +11 -8
- package/dist/components/layout/toolbar/MenuSeparator.js +8 -5
- package/dist/components/layout/toolbar/MostPageTool.js +64 -125
- package/dist/components/layout/toolbar/OtherTool.js +162 -114
- package/dist/components/layout/toolbar/Paginate.js +113 -117
- package/dist/components/layout/toolbar/PrintTool.js +55 -125
- package/dist/components/layout/toolbar/RPMenuItem.js +14 -11
- package/dist/components/layout/toolbar/RPMoreOptions.js +66 -121
- package/dist/components/layout/toolbar/RPToolbar.js +89 -81
- package/dist/components/layout/toolbar/RPToolbarEnd.js +68 -90
- package/dist/components/layout/toolbar/RotateTool.js +12 -9
- package/dist/components/layout/toolbar/ScrollModeTool.js +14 -11
- package/dist/components/layout/toolbar/SearchCloseButton.js +23 -9
- package/dist/components/layout/toolbar/SearchResultNavigator.js +53 -106
- package/dist/components/layout/toolbar/SearchTool.js +222 -121
- package/dist/components/layout/toolbar/SelectionModeTool.js +8 -5
- package/dist/components/layout/toolbar/ThumbnailTool.js +15 -124
- package/dist/components/layout/toolbar/ToolbarCustom.js +44 -130
- package/dist/components/layout/toolbar/ToolbarDefault.js +122 -120
- package/dist/components/layout/toolbar/ToolbarLayout.js +85 -83
- package/dist/components/layout/toolbar/ViewModeTool.js +10 -7
- package/dist/components/layout/toolbar/ZoomTool.js +128 -120
- package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +17 -123
- package/dist/components/layout/toolbar/tools/DualPageTool.js +26 -0
- package/dist/components/layout/toolbar/tools/FileDownloadTool.js +10 -121
- package/dist/components/layout/toolbar/tools/FileUploadTool.js +6 -4
- package/dist/components/layout/toolbar/tools/FullScreenTool.js +13 -11
- package/dist/components/layout/toolbar/tools/InputPageTool.js +19 -112
- package/dist/components/layout/toolbar/tools/NextPageTool.js +30 -123
- package/dist/components/layout/toolbar/tools/PreviousPageTool.js +16 -109
- package/dist/components/layout/toolbar/tools/PrintTool.js +12 -123
- package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +6 -4
- package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +6 -4
- package/dist/components/layout/toolbar/tools/SelectionModeSwitcherTool.js +31 -0
- package/dist/components/layout/toolbar/tools/SinglePageTool.js +26 -0
- package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +6 -4
- package/dist/components/layout/toolbar/tools/ThumbnailTool.js +17 -128
- package/dist/components/layout/toolbar/tools/ZoomInTool.js +6 -4
- package/dist/components/layout/toolbar/tools/ZoomLevelDisplay.js +22 -137
- package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +26 -123
- package/dist/components/layout/toolbar/tools/ZoomOutTool.js +6 -4
- package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +95 -105
- package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +16 -125
- package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +8 -5
- package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +10 -117
- package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +12 -120
- package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +10 -7
- package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +36 -125
- package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +16 -123
- package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +14 -11
- package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +15 -12
- package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +18 -15
- package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +10 -7
- package/dist/components/page/AnnotationLayer.js +122 -126
- package/dist/components/page/CanvasLayer.js +54 -125
- package/dist/components/page/DualPage.js +68 -111
- package/dist/components/page/RPPage.js +126 -125
- package/dist/components/page/SinglePage.js +58 -111
- package/dist/components/page/TextHighlightLayer.js +184 -128
- package/dist/components/page/TextLayer.js +184 -125
- package/dist/components/ui/Checkbox.js +25 -24
- package/dist/components/ui/DropDown.js +11 -8
- package/dist/components/ui/LoadingIndicator.js +34 -129
- package/dist/components/ui/RPTooltip.js +412 -196
- package/dist/contexts/ElementPageContext.js +1 -1
- package/dist/contexts/FullScreenContext.js +17 -10
- package/dist/contexts/LocalizationContext.js +24 -29
- package/dist/contexts/PaginationContext.js +14 -119
- package/dist/contexts/PrintContext.js +67 -133
- package/dist/contexts/RPDocumentContext.js +32 -24
- package/dist/contexts/RenderQueueProvider.js +47 -119
- package/dist/contexts/SearchContext.js +65 -113
- package/dist/contexts/ThumbnailsContext.js +32 -133
- package/dist/contexts/ZoomContext.js +22 -22
- package/dist/floating-ui.react-dom-5ec29bd6.js +1327 -0
- package/dist/index-4baea9b5.js +1198 -0
- package/dist/index-655864a7.js +27 -0
- package/dist/{index-c9a2990a.js → index-c0faa594.js} +64 -87
- package/dist/index-e3ee9457.js +150 -0
- package/dist/main.js +193 -142
- package/dist/types/components/icons/DualPageIcon.d.ts +1 -1
- package/dist/types/components/icons/SinglePageIcon.d.ts +1 -1
- package/dist/types/components/layout/toolbar/tools/DualPageTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/SelectionModeSwitcherTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/SinglePageTool.d.ts +3 -0
- package/dist/types/contexts/RenderQueueProvider.d.ts +2 -2
- package/dist/types/main.d.ts +5 -5
- package/dist/types/utils/annotations.d.ts +2 -1
- package/dist/types/utils/getElementPositionInPage.d.ts +2 -2
- package/dist/types/utils/hooks/useCopyText.d.ts +1 -0
- package/dist/types/utils/hooks/usePrint.d.ts +3 -2
- package/dist/types/utils/hooks/useSearch.d.ts +1 -2
- package/dist/types/utils/renderPage.d.ts +2 -2
- package/dist/types/utils/types.d.ts +27 -4
- package/dist/utils/annotations.js +128 -142
- package/dist/utils/getWordPositionInPage.js +5 -5
- package/dist/utils/highlight.js +72 -72
- package/dist/utils/hooks/useCopyText.js +36 -0
- package/dist/utils/hooks/useFileDownload.js +20 -129
- package/dist/utils/hooks/useHighlight.js +28 -28
- package/dist/utils/hooks/useLicense.js +1 -1
- package/dist/utils/hooks/useLoadPdf.js +42 -39
- package/dist/utils/hooks/useLoadWorker.js +9 -6
- package/dist/utils/hooks/useLocalization.js +13 -13
- package/dist/utils/hooks/usePaginate.js +21 -126
- package/dist/utils/hooks/usePresentPage.js +75 -127
- package/dist/utils/hooks/usePrint.js +173 -130
- package/dist/utils/hooks/useScrollToPage.js +15 -120
- package/dist/utils/hooks/useSearch.js +132 -126
- package/dist/utils/hooks/useThumbnail.js +47 -130
- package/dist/utils/hooks/useVirtualReactWindow.js +64 -128
- package/dist/utils/injectPrintCSS.js +1 -1
- package/dist/utils/renderPage.js +12 -10
- package/package.json +26 -23
- package/dist/SearchCloseButton-08d57275.js +0 -33
- package/dist/ToolbarLayout.module-37619c4b.js +0 -3548
- package/dist/index-808ea7bf.js +0 -1685
- package/dist/index-a48ec088.js +0 -1672
package/dist/utils/highlight.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { getCharacterType as
|
|
2
|
-
function V(r, c,
|
|
1
|
+
import { getCharacterType as D } from "./charators.js";
|
|
2
|
+
function V(r, c, u, i) {
|
|
3
3
|
const o = [];
|
|
4
4
|
for (const n of r) {
|
|
5
5
|
const s = y(c, n, i);
|
|
6
|
-
o.push(...I(s, c,
|
|
6
|
+
o.push(...I(s, c, u));
|
|
7
7
|
}
|
|
8
8
|
return o;
|
|
9
9
|
}
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
c.matchCase ||
|
|
10
|
+
const X = (r, c) => {
|
|
11
|
+
const u = ["g"];
|
|
12
|
+
c.matchCase || u.push("i");
|
|
13
13
|
let o = r.replace(/[.^$*+?()[{|\\]/g, (n) => `\\${n}`).trim();
|
|
14
|
-
return new RegExp(o,
|
|
14
|
+
return new RegExp(o, u.join(""));
|
|
15
15
|
};
|
|
16
|
-
function y(r, c,
|
|
16
|
+
function y(r, c, u) {
|
|
17
17
|
const i = [];
|
|
18
18
|
for (const t of r.items)
|
|
19
19
|
if (t.hasEOL)
|
|
@@ -27,14 +27,14 @@ function y(r, c, a) {
|
|
|
27
27
|
i.push(t.str);
|
|
28
28
|
const o = i.join("").replace(/\n/g, " ");
|
|
29
29
|
let n;
|
|
30
|
-
c instanceof RegExp ? n = c.flags.indexOf("g") === -1 ? new RegExp(c, `${c.flags}g`) : c : n =
|
|
30
|
+
c instanceof RegExp ? n = c.flags.indexOf("g") === -1 ? new RegExp(c, `${c.flags}g`) : c : n = X(c, u);
|
|
31
31
|
const s = [];
|
|
32
32
|
let e;
|
|
33
33
|
for (; (e = n.exec(o)) !== null; )
|
|
34
|
-
|
|
34
|
+
u.wholeWords && !L(o, e.index, e[0].length) || s.push([e.index, e[0].length, e[0]]);
|
|
35
35
|
return s;
|
|
36
36
|
}
|
|
37
|
-
function I(r, c,
|
|
37
|
+
function I(r, c, u) {
|
|
38
38
|
function i(l) {
|
|
39
39
|
return l.hasEOL ? l.str.endsWith("-") ? -1 : 1 : 0;
|
|
40
40
|
}
|
|
@@ -46,7 +46,7 @@ function I(r, c, a) {
|
|
|
46
46
|
const f = s[o];
|
|
47
47
|
n += f.str.length + i(f), o++;
|
|
48
48
|
}
|
|
49
|
-
const
|
|
49
|
+
const h = {
|
|
50
50
|
idx: o,
|
|
51
51
|
offset: d - n
|
|
52
52
|
};
|
|
@@ -59,81 +59,81 @@ function I(r, c, a) {
|
|
|
59
59
|
offset: d - n
|
|
60
60
|
};
|
|
61
61
|
t.push({
|
|
62
|
-
start:
|
|
62
|
+
start: h,
|
|
63
63
|
end: m,
|
|
64
64
|
str: r[l][2],
|
|
65
65
|
oIndex: r[l][0],
|
|
66
|
-
pageIndex:
|
|
66
|
+
pageIndex: u,
|
|
67
67
|
rect: {
|
|
68
68
|
left: 0,
|
|
69
|
-
|
|
69
|
+
bottom: 0,
|
|
70
70
|
width: 0,
|
|
71
71
|
height: 0
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
for (const l of t) {
|
|
76
|
-
const d = s[l.start.idx],
|
|
77
|
-
left: Math.min(
|
|
78
|
-
|
|
79
|
-
width: Math.abs(
|
|
80
|
-
height: Math.max(d.height,
|
|
76
|
+
const d = s[l.start.idx], h = s[l.end.idx], m = d.transform[4] + l.start.offset * (d.width / d.str.length), f = d.transform[5], E = h.transform[4] + l.end.offset * (h.width / h.str.length), a = h.transform[5], M = {
|
|
77
|
+
left: Math.min(m, E),
|
|
78
|
+
bottom: Math.min(f, a),
|
|
79
|
+
width: Math.abs(E - m),
|
|
80
|
+
height: Math.max(d.height, h.height)
|
|
81
81
|
};
|
|
82
|
-
l.rect =
|
|
82
|
+
l.rect = M;
|
|
83
83
|
}
|
|
84
84
|
return t;
|
|
85
85
|
}
|
|
86
|
-
function L(r, c,
|
|
86
|
+
function L(r, c, u) {
|
|
87
87
|
let i = r.slice(0, c).match(/([^\p{M}])\p{M}*$/u);
|
|
88
88
|
if (i) {
|
|
89
89
|
const o = r.charCodeAt(c), n = i[1].charCodeAt(0);
|
|
90
|
-
if (
|
|
90
|
+
if (D(o) === D(n))
|
|
91
91
|
return !1;
|
|
92
92
|
}
|
|
93
|
-
if (i = r.slice(c +
|
|
94
|
-
const o = r.charCodeAt(c +
|
|
95
|
-
if (
|
|
93
|
+
if (i = r.slice(c + u).match(/^\p{M}*([^\p{M}])/u), i) {
|
|
94
|
+
const o = r.charCodeAt(c + u - 1), n = i[1].charCodeAt(0);
|
|
95
|
+
if (D(o) === D(n))
|
|
96
96
|
return !1;
|
|
97
97
|
}
|
|
98
98
|
return !0;
|
|
99
99
|
}
|
|
100
|
-
function H(r, c,
|
|
100
|
+
function H(r, c, u) {
|
|
101
101
|
const i = [];
|
|
102
102
|
function o(n, s, e = -1, t = -1, l = "") {
|
|
103
|
-
const d = c.items[n],
|
|
104
|
-
let m = "", f = "", E = "",
|
|
105
|
-
if (!
|
|
103
|
+
const d = c.items[n], h = [];
|
|
104
|
+
let m = "", f = "", E = "", a = u[n];
|
|
105
|
+
if (!a)
|
|
106
106
|
return;
|
|
107
|
-
if (
|
|
108
|
-
const
|
|
109
|
-
|
|
107
|
+
if (a.nodeType === Node.TEXT_NODE) {
|
|
108
|
+
const p = document.createElement("span");
|
|
109
|
+
a.before(p), p.append(a), u[n] = p, a = p;
|
|
110
110
|
}
|
|
111
111
|
e >= 0 && t >= 0 ? m = d.str.substring(e, t) : e < 0 && t < 0 ? m = d.str : e >= 0 ? m = d.str.substring(e) : t >= 0 && (m = d.str.substring(0, t));
|
|
112
|
-
const
|
|
113
|
-
if (N.className = "highlight appended " + l, N.setAttribute("data-match-index", `${s}`), N.append(
|
|
114
|
-
if (
|
|
112
|
+
const M = document.createTextNode(m), N = document.createElement("span");
|
|
113
|
+
if (N.className = "highlight appended " + l, N.setAttribute("data-match-index", `${s}`), N.append(M), h.push(N), i.push({ element: N, index: s }), e > 0)
|
|
114
|
+
if (a.childNodes.length === 1 && a.childNodes[0].nodeType === Node.TEXT_NODE) {
|
|
115
115
|
f = d.str.substring(0, e);
|
|
116
|
-
const
|
|
117
|
-
|
|
116
|
+
const p = document.createTextNode(f);
|
|
117
|
+
h.unshift(p);
|
|
118
118
|
} else {
|
|
119
|
-
let
|
|
120
|
-
const
|
|
121
|
-
for (const g of
|
|
119
|
+
let p = 0;
|
|
120
|
+
const b = [];
|
|
121
|
+
for (const g of a.childNodes) {
|
|
122
122
|
const x = g.nodeType === Node.TEXT_NODE ? g.nodeValue : g.firstChild.nodeValue;
|
|
123
|
-
|
|
123
|
+
p += x.length, p <= e ? b.push(g) : e >= p - x.length && t <= p && b.push(
|
|
124
124
|
document.createTextNode(
|
|
125
|
-
x.substring(0, e - (
|
|
125
|
+
x.substring(0, e - (p - x.length))
|
|
126
126
|
)
|
|
127
127
|
);
|
|
128
128
|
}
|
|
129
|
-
|
|
129
|
+
h.unshift(...b);
|
|
130
130
|
}
|
|
131
131
|
if (t > 0) {
|
|
132
132
|
E = d.str.substring(t);
|
|
133
|
-
const
|
|
134
|
-
|
|
133
|
+
const p = document.createTextNode(E);
|
|
134
|
+
h.push(p);
|
|
135
135
|
}
|
|
136
|
-
|
|
136
|
+
a.replaceChildren(...h);
|
|
137
137
|
}
|
|
138
138
|
for (const [n, s] of r.entries())
|
|
139
139
|
if (s.start.idx === s.end.idx)
|
|
@@ -144,11 +144,11 @@ function H(r, c, a) {
|
|
|
144
144
|
return i;
|
|
145
145
|
}
|
|
146
146
|
function R(r, c) {
|
|
147
|
-
const
|
|
147
|
+
const u = r.items.map((i) => i.str);
|
|
148
148
|
for (let i = 0; i < c.length; i++) {
|
|
149
149
|
const o = c[i];
|
|
150
150
|
if (o && o.nodeType !== Node.TEXT_NODE) {
|
|
151
|
-
const n = document.createTextNode(
|
|
151
|
+
const n = document.createTextNode(u[i]);
|
|
152
152
|
o.replaceChildren(n);
|
|
153
153
|
}
|
|
154
154
|
}
|
|
@@ -156,54 +156,54 @@ function R(r, c) {
|
|
|
156
156
|
function W(r = {}) {
|
|
157
157
|
return { matchCase: !1, wholeWords: !1, ...r };
|
|
158
158
|
}
|
|
159
|
-
function A(r, c,
|
|
159
|
+
function A(r, c, u) {
|
|
160
160
|
const i = [];
|
|
161
161
|
function o(n, s, e = -1, t = -1, l) {
|
|
162
|
-
var
|
|
163
|
-
const d = c.items[n],
|
|
164
|
-
let m = "", f = "", E = "",
|
|
165
|
-
if (!
|
|
162
|
+
var p, b;
|
|
163
|
+
const d = c.items[n], h = [];
|
|
164
|
+
let m = "", f = "", E = "", a = u[n];
|
|
165
|
+
if (!a)
|
|
166
166
|
return;
|
|
167
167
|
e >= 0 && t >= 0 ? m = d.str.substring(e, t) : e < 0 && t < 0 ? m = d.str : e >= 0 ? m = d.str.substring(e) : t >= 0 && (m = d.str.substring(0, t));
|
|
168
|
-
const
|
|
169
|
-
if (N.style.background = l, N.append(
|
|
170
|
-
if (
|
|
168
|
+
const M = document.createTextNode(m), N = document.createElement("span");
|
|
169
|
+
if (N.style.background = l, N.append(M), h.push(N), e > 0)
|
|
170
|
+
if (a.childNodes.length === 1 && a.childNodes[0].nodeType === Node.TEXT_NODE) {
|
|
171
171
|
f = d.str.substring(0, e);
|
|
172
172
|
const g = document.createTextNode(f);
|
|
173
|
-
|
|
173
|
+
h.unshift(g);
|
|
174
174
|
} else {
|
|
175
175
|
let g = 0;
|
|
176
176
|
const x = [];
|
|
177
|
-
for (const T of
|
|
178
|
-
const v = T.nodeType === Node.TEXT_NODE ? T.nodeValue || "" : ((
|
|
179
|
-
if (g +=
|
|
177
|
+
for (const T of a.childNodes) {
|
|
178
|
+
const v = T.nodeType === Node.TEXT_NODE ? T.nodeValue || "" : ((p = T.firstChild) == null ? void 0 : p.nodeValue) || "", C = v.length;
|
|
179
|
+
if (g += C, g <= e)
|
|
180
180
|
x.push(T);
|
|
181
|
-
else if (e >= g -
|
|
182
|
-
const w = v.substring(0, e - (g -
|
|
181
|
+
else if (e >= g - C && t <= g) {
|
|
182
|
+
const w = v.substring(0, e - (g - C));
|
|
183
183
|
x.push(document.createTextNode(w));
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
|
|
186
|
+
h.unshift(...x);
|
|
187
187
|
}
|
|
188
188
|
if (t > 0)
|
|
189
|
-
if (
|
|
189
|
+
if (a.childNodes.length === 1 && a.childNodes[0].nodeType === Node.TEXT_NODE) {
|
|
190
190
|
E = d.str.substring(t);
|
|
191
191
|
const g = document.createTextNode(E);
|
|
192
|
-
|
|
192
|
+
h.push(g);
|
|
193
193
|
} else {
|
|
194
194
|
let g = 0;
|
|
195
195
|
const x = [];
|
|
196
|
-
for (const T of
|
|
196
|
+
for (const T of a.childNodes) {
|
|
197
197
|
g >= t && x.push(T);
|
|
198
|
-
const v = T.nodeType === Node.TEXT_NODE ? T.nodeValue || "" : ((
|
|
199
|
-
if (g +=
|
|
200
|
-
const w = v.substring(t - (g -
|
|
198
|
+
const v = T.nodeType === Node.TEXT_NODE ? T.nodeValue || "" : ((b = T.firstChild) == null ? void 0 : b.nodeValue) || "", C = v.length;
|
|
199
|
+
if (g += C, g > t) {
|
|
200
|
+
const w = v.substring(t - (g - C));
|
|
201
201
|
w && x.push(document.createTextNode(w));
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
x.length > 0 &&
|
|
204
|
+
x.length > 0 && h.push(...x);
|
|
205
205
|
}
|
|
206
|
-
|
|
206
|
+
a.replaceChildren(...h), i.push({ element: N, index: s });
|
|
207
207
|
}
|
|
208
208
|
for (const [n, s] of r.entries()) {
|
|
209
209
|
const { start: e, end: t, color: l } = s;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useRef as o, useEffect as i } from "react";
|
|
2
|
+
const s = /[\x00-\x1F]/g;
|
|
3
|
+
let c = null, r = null;
|
|
4
|
+
function d(e) {
|
|
5
|
+
return c || (c = /([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu, r = /* @__PURE__ */ new Map([["ſt", "ſt"]])), e.replace(
|
|
6
|
+
c,
|
|
7
|
+
(f, u, t) => u ? u.normalize("NFKC") : (r == null ? void 0 : r.get(t)) || ""
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
function p(e, f = !1) {
|
|
11
|
+
return s.test(e) ? f ? e.replace(s, (u) => u === "\0" ? "" : " ") : e.replace(/\x00/g, "") : e;
|
|
12
|
+
}
|
|
13
|
+
const x = (e) => {
|
|
14
|
+
const f = o(!1), u = o(null);
|
|
15
|
+
i(() => {
|
|
16
|
+
if (!e || f.current)
|
|
17
|
+
return;
|
|
18
|
+
const t = (n) => {
|
|
19
|
+
var l;
|
|
20
|
+
const b = document.getSelection();
|
|
21
|
+
if (!b)
|
|
22
|
+
return;
|
|
23
|
+
const a = b.toString();
|
|
24
|
+
a && ((l = n.clipboardData) == null || l.setData(
|
|
25
|
+
"text/plain",
|
|
26
|
+
p(d(a))
|
|
27
|
+
), n.preventDefault(), n.stopPropagation());
|
|
28
|
+
};
|
|
29
|
+
return e.addEventListener("copy", t), u.current = e, f.current = !0, () => {
|
|
30
|
+
u.current && (u.current.removeEventListener("copy", t), f.current = !1);
|
|
31
|
+
};
|
|
32
|
+
}, [e]);
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
x as useCopyText
|
|
36
|
+
};
|
|
@@ -1,142 +1,33 @@
|
|
|
1
|
+
import { useDocumentContext as c } from "../../contexts/RPDocumentContext.js";
|
|
2
|
+
import { useCallback as a } from "react";
|
|
3
|
+
import { useDownloadContext as s } from "../../contexts/DownloadContext.js";
|
|
1
4
|
import "react/jsx-runtime";
|
|
2
|
-
import "react";
|
|
3
|
-
import "../../contexts/RPDocumentContext.js";
|
|
4
|
-
import "../../contexts/DocumentPasswordContext.js";
|
|
5
|
-
import { b as Hr } from "../../ToolbarLayout.module-37619c4b.js";
|
|
6
|
-
import "../../contexts/DarkModeContext.js";
|
|
7
|
-
import "../../contexts/RotationContext.js";
|
|
8
|
-
import "../../contexts/LayerContext.js";
|
|
9
|
-
import "../../contexts/ZoomContext.js";
|
|
10
|
-
import "../../contexts/ViewModeContext.js";
|
|
11
|
-
import "../../contexts/ScrollModeContext.js";
|
|
12
|
-
import "../../contexts/VirtualScrollContext.js";
|
|
13
|
-
import "../../contexts/VirtualGridContext.js";
|
|
14
|
-
import "../../contexts/SelectionModeContext.js";
|
|
15
|
-
import "../../contexts/InitialStateContext.js";
|
|
16
|
-
import "../../contexts/FullScreenContext.js";
|
|
17
|
-
import "../../contexts/FileInputContext.js";
|
|
18
|
-
import "../../contexts/DropFileZoneContext.js";
|
|
19
|
-
import "../../contexts/LayoutContainerContext.js";
|
|
20
|
-
import "../../contexts/DimensionPagesContext.js";
|
|
21
|
-
import "../../contexts/LocalizationContext.js";
|
|
22
|
-
import "../../contexts/HighlightContext.js";
|
|
23
|
-
import "../../contexts/LicenseContext.js";
|
|
24
|
-
import "../../contexts/DownloadContext.js";
|
|
25
|
-
import "../../contexts/SmoothScrollContext.js";
|
|
26
|
-
import "../../contexts/ElementPageContext.js";
|
|
27
|
-
import "../../contexts/PagesRotateContext.js";
|
|
28
|
-
import "../../contexts/GlobalCurrentPage.js";
|
|
29
|
-
import "../../contexts/LoaderContext.js";
|
|
30
|
-
import "../../contexts/ToolComponentContext.js";
|
|
31
|
-
import "../../contexts/IconToolContext.js";
|
|
32
|
-
import "../../contexts/OtherToolContext.js";
|
|
33
|
-
import "../../contexts/EventCallbackContext.js";
|
|
34
|
-
import "../../components/RPConfig.js";
|
|
35
|
-
import "../../components/layout/Container.js";
|
|
36
|
-
import "../../contexts/ViewportContext.js";
|
|
37
|
-
import "../../contexts/ToolbarComponentContext.js";
|
|
38
|
-
import "../../components/layout/sidebar/RPSplitter.js";
|
|
39
|
-
import "../../components/layout/WrapperLayout.js";
|
|
40
|
-
import "../../LayoutWrapper-6224491f.js";
|
|
41
|
-
import "../../contexts/ThemeContext.js";
|
|
42
|
-
import "../../components/RPDropFileZone.js";
|
|
43
|
-
import "../../components/ui/Button.js";
|
|
44
|
-
import "../../SearchCloseButton-08d57275.js";
|
|
45
|
-
import "../../components/ui/Input.js";
|
|
46
|
-
import "../../components/ui/Checkbox.js";
|
|
47
|
-
import "../../components/icons/LoaderIcon.js";
|
|
48
|
-
import "../../contexts/IconContext.js";
|
|
49
|
-
import "../../components/ui/RPTooltip.js";
|
|
50
|
-
import "../../components/ui/DropDown.js";
|
|
51
|
-
import "../../components/layout/toolbar/MenuItem.js";
|
|
52
|
-
import "../../components/layout/toolbar/MenuSeparator.js";
|
|
53
|
-
import "../dateFormatter.js";
|
|
54
|
-
import "../../components/layout/toolbar/PropertyItem.js";
|
|
55
|
-
import "../../RotateTool.module-67946714.js";
|
|
56
5
|
import "./useLoadPdf.js";
|
|
57
6
|
import "pdfjs-dist";
|
|
58
7
|
import "../types.js";
|
|
59
8
|
import "../../th_TH-d627cd51.js";
|
|
60
9
|
import "../getThumbnailViewport.js";
|
|
61
10
|
import "../../contexts/ConfigContext.js";
|
|
11
|
+
import "../../contexts/DocumentPasswordContext.js";
|
|
62
12
|
import "../appConsole.js";
|
|
63
13
|
import "./usePdfProperties.js";
|
|
64
14
|
import "../convertPdfDate.js";
|
|
65
15
|
import "../formatFileSize.js";
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
import "../../components/page/CustomElement.js";
|
|
82
|
-
import "../getZoomLevel.js";
|
|
83
|
-
import "./useDebounce.js";
|
|
84
|
-
import "./useLicense.js";
|
|
85
|
-
import "../getScrollDistance.js";
|
|
86
|
-
import "../getElementPositionInPage.js";
|
|
87
|
-
import "../calculatePage.js";
|
|
88
|
-
import "./useMousePressed.js";
|
|
89
|
-
import "./useGrabScroll.js";
|
|
90
|
-
import "./usePinch.js";
|
|
91
|
-
import "../../components/ui/PasswordModal.js";
|
|
92
|
-
import "./useLocalization.js";
|
|
93
|
-
import "../approximateFragtion.js";
|
|
94
|
-
import "../getWordPositionInPage.js";
|
|
95
|
-
import "../smoothScrollTo.js";
|
|
96
|
-
import "../../components/layout/toolbar/FileUploadTool.js";
|
|
97
|
-
import "../../components/icons/FileUploadDefaultIcon.js";
|
|
98
|
-
import "../../index-a48ec088.js";
|
|
99
|
-
import "../../index-c9a2990a.js";
|
|
100
|
-
import "react-dom";
|
|
101
|
-
import "../../index-808ea7bf.js";
|
|
102
|
-
import "../../components/layout/toolbar/DarkModeTool.js";
|
|
103
|
-
import "../../components/icons/MoonIcon.js";
|
|
104
|
-
import "../../components/icons/SunIcon.js";
|
|
105
|
-
import "./useDarkMode.js";
|
|
106
|
-
import "../../components/icons/ThreeDotIcon.js";
|
|
107
|
-
import "../../components/icons/CloseIcon.js";
|
|
108
|
-
import "../../components/layout/toolbar/DocumentProperties.js";
|
|
109
|
-
import "../../components/icons/InfoIcon.js";
|
|
110
|
-
import "../../components/layout/toolbar/RotateTool.js";
|
|
111
|
-
import "../../components/icons/ClockwiseIcon.js";
|
|
112
|
-
import "./useRotate.js";
|
|
113
|
-
import "../../components/layout/toolbar/ViewModeTool.js";
|
|
114
|
-
import "../../components/icons/SinglePageIcon.js";
|
|
115
|
-
import "../../components/icons/DualPageIcon.js";
|
|
116
|
-
import "../../components/icons/CheckIcon.js";
|
|
117
|
-
import "../../components/layout/toolbar/ScrollModeTool.js";
|
|
118
|
-
import "../../components/icons/PageScrollingIcon.js";
|
|
119
|
-
import "../../components/icons/VerticalScrollingIcon.js";
|
|
120
|
-
import "../../components/icons/HorizontalScrollingIcon.js";
|
|
121
|
-
import "../../components/icons/FileDownloadDefaultIcon.js";
|
|
122
|
-
import "../../components/icons/PrintDefaultIcon.js";
|
|
123
|
-
import "../../components/layout/toolbar/FullScreenTool.js";
|
|
124
|
-
import "../../components/icons/FullScreenIcon.js";
|
|
125
|
-
import "./useFullScreen.js";
|
|
126
|
-
import "../../components/icons/GoToDownIcon.js";
|
|
127
|
-
import "../../components/layout/toolbar/SelectionModeTool.js";
|
|
128
|
-
import "../../components/icons/TextSelectionDefaultIcon.js";
|
|
129
|
-
import "../../components/icons/HandModeDefaultIcon.js";
|
|
130
|
-
import "../../components/icons/ZoomInIcon.js";
|
|
131
|
-
import "../../components/icons/ZoomOutIcon.js";
|
|
132
|
-
import "../zoom.js";
|
|
133
|
-
import "../../components/icons/SearchIcon.js";
|
|
134
|
-
import "../../components/icons/ClearIcon.js";
|
|
135
|
-
import "./useHighlight.js";
|
|
136
|
-
import "../../components/RPTheme.js";
|
|
137
|
-
import "./useLoadWorker.js";
|
|
138
|
-
import "../../components/icons/LightPdfIcon.js";
|
|
139
|
-
import "../../components/icons/DarkPdfIcon.js";
|
|
16
|
+
const i = ".pdf", d = (o) => URL.createObjectURL(o), l = async (o) => {
|
|
17
|
+
const r = await (await fetch(o)).blob();
|
|
18
|
+
return d(r);
|
|
19
|
+
}, k = () => {
|
|
20
|
+
const { filename: o, pdfSrc: e } = c(), { downloadFilename: r } = s(), m = (t) => {
|
|
21
|
+
const n = r || t;
|
|
22
|
+
return n.endsWith(i) ? n : `${n}${i}`;
|
|
23
|
+
};
|
|
24
|
+
return { download: a(async () => {
|
|
25
|
+
if (!o || !e)
|
|
26
|
+
throw new Error("There is no PDF source to download");
|
|
27
|
+
const t = document.createElement("a");
|
|
28
|
+
t.href = await l(e), t.download = m(o), document.body.appendChild(t), t.click(), document.body.removeChild(t);
|
|
29
|
+
}, [o, e]) };
|
|
30
|
+
};
|
|
140
31
|
export {
|
|
141
|
-
|
|
32
|
+
k as useFileDownload
|
|
142
33
|
};
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import { useState as
|
|
1
|
+
import { useState as m, useCallback as r, useEffect as C } from "react";
|
|
2
2
|
import { getHighlightOptionsWithDefaults as H, findMatches as M } from "../highlight.js";
|
|
3
3
|
import "../charators.js";
|
|
4
4
|
const k = (s) => {
|
|
5
|
-
const [n,
|
|
5
|
+
const [n, c] = m(void 0), [f, l] = m([]), u = r(async (t) => {
|
|
6
6
|
if (!t)
|
|
7
7
|
return {};
|
|
8
8
|
const i = t.numPages, e = {};
|
|
9
9
|
for (let o = 1; o <= i; o++) {
|
|
10
|
-
const
|
|
11
|
-
e[o.toString()] = await
|
|
10
|
+
const h = await t.getPage(o);
|
|
11
|
+
e[o.toString()] = await h.getTextContent();
|
|
12
12
|
}
|
|
13
13
|
return e;
|
|
14
|
-
}, []),
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
};
|
|
14
|
+
}, []), p = r(async (t) => {
|
|
15
|
+
c(t);
|
|
16
|
+
}, []), g = r(() => {
|
|
17
|
+
l([]), c(void 0);
|
|
18
|
+
}, []);
|
|
19
19
|
return C(() => {
|
|
20
|
-
s &&
|
|
20
|
+
s && u(s).then((t) => {
|
|
21
21
|
let i = [];
|
|
22
|
-
for (const { keyword: e, highlightColor: o, options:
|
|
22
|
+
for (const { keyword: e, highlightColor: o, options: h } of n) {
|
|
23
23
|
if (!e)
|
|
24
24
|
continue;
|
|
25
|
-
const
|
|
26
|
-
for (const
|
|
27
|
-
const
|
|
25
|
+
const y = H(h);
|
|
26
|
+
for (const a of Object.keys(t)) {
|
|
27
|
+
const b = M(
|
|
28
28
|
[e],
|
|
29
|
-
t[
|
|
30
|
-
Number(
|
|
31
|
-
|
|
32
|
-
).map((
|
|
33
|
-
...
|
|
34
|
-
page: Number(
|
|
35
|
-
pageMatchIdx:
|
|
29
|
+
t[a],
|
|
30
|
+
Number(a) - 1,
|
|
31
|
+
y
|
|
32
|
+
).map((w, x) => ({
|
|
33
|
+
...w,
|
|
34
|
+
page: Number(a),
|
|
35
|
+
pageMatchIdx: x,
|
|
36
36
|
color: o,
|
|
37
37
|
keyword: e
|
|
38
38
|
}));
|
|
39
|
-
i = [...i, ...
|
|
39
|
+
i = [...i, ...b];
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
l(i);
|
|
43
43
|
}).catch(() => {
|
|
44
|
-
|
|
44
|
+
g();
|
|
45
45
|
});
|
|
46
|
-
}, [n, s]), {
|
|
47
|
-
highlight:
|
|
48
|
-
clear:
|
|
49
|
-
highlightMatches:
|
|
46
|
+
}, [n, s, g, u]), {
|
|
47
|
+
highlight: p,
|
|
48
|
+
clear: g,
|
|
49
|
+
highlightMatches: f,
|
|
50
50
|
highlightKeywords: n
|
|
51
51
|
};
|
|
52
52
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState as E, useCallback as h, useEffect as A } from "react";
|
|
2
2
|
import { appConsole as l } from "../appConsole.js";
|
|
3
|
-
const b = /* @__PURE__ */ new Date("2026-
|
|
3
|
+
const b = /* @__PURE__ */ new Date("2026-02-11T05:07:32.609Z"), d = "Please visit https://www.react-pdf.dev/manage-license/ to generate a new license key.", s = {
|
|
4
4
|
invalidLicense: `You are currently using without a valid license. ${d}`,
|
|
5
5
|
mismatchedDomain: `Your license key is not valid for the current domain / IP. ${d}`,
|
|
6
6
|
expired: `Your license key has expired. ${d}`,
|