@pdf-viewer/react 1.2.0 → 1.3.0-beta.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/{RPDefaultLayout-8ee7a95b.js → RPDefaultLayout-f556799a.js} +986 -1084
- package/dist/assets/RPDefaultLayout.css +1 -1
- package/dist/components/RPController.js +1 -1
- package/dist/components/RPPages.js +1 -1
- package/dist/components/RPProvider.js +1 -1
- package/dist/components/layout/RPDefaultLayout.js +1 -1
- package/dist/components/layout/sidebar/RPSidebar.js +1 -1
- package/dist/components/layout/sidebar/Thumbnail.js +1 -1
- package/dist/components/layout/sidebar/Thumbnails.js +1 -1
- package/dist/components/layout/toolbar/DocumentDialog.js +1 -1
- package/dist/components/layout/toolbar/FileDownloadTool.js +1 -1
- package/dist/components/layout/toolbar/MostPageTool.js +1 -1
- package/dist/components/layout/toolbar/OtherTool.js +1 -1
- package/dist/components/layout/toolbar/Paginate.js +1 -1
- package/dist/components/layout/toolbar/PrintTool.js +1 -1
- package/dist/components/layout/toolbar/RPToolbar.js +1 -1
- package/dist/components/layout/toolbar/RPToolbarEnd.js +1 -1
- package/dist/components/layout/toolbar/SearchTool.js +1 -1
- package/dist/components/layout/toolbar/ZoomTool.js +1 -1
- package/dist/components/page/AnnotationLayer.js +3 -4
- package/dist/components/page/CanvasLayer.js +1 -1
- package/dist/components/page/DualPage.js +1 -1
- package/dist/components/page/RPPage.js +1 -1
- package/dist/components/page/SinglePage.js +1 -1
- package/dist/components/page/TextLayer.js +1 -1
- package/dist/components/ui/LoadingIndicator.js +1 -1
- package/dist/contexts/PaginationContext.js +1 -1
- package/dist/contexts/PrintContext.js +1 -1
- package/dist/contexts/SearchContext.js +1 -1
- package/dist/contexts/ThumbnailsContext.js +1 -1
- package/dist/main.js +1 -1
- package/dist/types/utils/annotations.d.ts +9 -0
- package/dist/types/utils/renderPage.d.ts +7 -1
- package/dist/types/utils/types.d.ts +15 -0
- package/dist/utils/annotations.js +304 -0
- package/dist/utils/hooks/useFileDownload.js +1 -1
- package/dist/utils/hooks/useLicense.js +1 -1
- package/dist/utils/hooks/usePaginate.js +1 -1
- package/dist/utils/hooks/usePdfProperties.js +22 -25
- package/dist/utils/hooks/usePrint.js +1 -1
- package/dist/utils/hooks/useScrollToPage.js +1 -1
- package/dist/utils/hooks/useSearch.js +1 -1
- package/dist/utils/hooks/useThumbnail.js +1 -1
- package/dist/utils/hooks/useVirtualReactWindow.js +1 -1
- package/dist/utils/renderPage.js +10 -8
- package/dist/utils/types.js +13 -12
- package/package.json +1 -1
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { sanitizeExternalUrl as L } from "./sanitizeExternalUrl.js";
|
|
2
|
+
import { AnnotationSubType as _, AnnotationType as l } from "./types.js";
|
|
3
|
+
import { dateFormatter as I } from "./dateFormatter.js";
|
|
4
|
+
const v = ["click", "dblclick", "input", "change"], g = /* @__PURE__ */ new Map(), E = (e, t) => `${e.loadingTask.docId}___${t.num}R${t.gen === 0 ? "" : t.gen}`;
|
|
5
|
+
function x(e, t) {
|
|
6
|
+
const n = E(e, t);
|
|
7
|
+
return g.has(n) ? g.get(n) ?? null : null;
|
|
8
|
+
}
|
|
9
|
+
const B = (e, t, n) => {
|
|
10
|
+
g.set(E(e, t), n);
|
|
11
|
+
}, O = (e, t) => {
|
|
12
|
+
switch (t[1].name) {
|
|
13
|
+
case "XYZ":
|
|
14
|
+
return {
|
|
15
|
+
bottomOffset: (n, a) => t[3] === null ? a : t[3],
|
|
16
|
+
leftOffset: (n, a) => t[2] === null ? 0 : t[2],
|
|
17
|
+
pageIndex: e,
|
|
18
|
+
scaleTo: t[4]
|
|
19
|
+
};
|
|
20
|
+
case "Fit":
|
|
21
|
+
case "FitB":
|
|
22
|
+
return {
|
|
23
|
+
bottomOffset: 0,
|
|
24
|
+
leftOffset: 0,
|
|
25
|
+
pageIndex: e,
|
|
26
|
+
scaleTo: 1
|
|
27
|
+
};
|
|
28
|
+
case "FitH":
|
|
29
|
+
case "FitBH":
|
|
30
|
+
return {
|
|
31
|
+
bottomOffset: t[2],
|
|
32
|
+
leftOffset: 0,
|
|
33
|
+
pageIndex: e,
|
|
34
|
+
scaleTo: 1
|
|
35
|
+
};
|
|
36
|
+
default:
|
|
37
|
+
return {
|
|
38
|
+
bottomOffset: 0,
|
|
39
|
+
leftOffset: 0,
|
|
40
|
+
pageIndex: e,
|
|
41
|
+
scaleTo: 1
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
async function b(e, t) {
|
|
46
|
+
let n;
|
|
47
|
+
if (typeof t == "string" ? n = await e.getDestination(t) : n = t, n && typeof n[0] == "object" && n[0] !== null) {
|
|
48
|
+
const a = n[0], s = x(e, a);
|
|
49
|
+
if (s === null) {
|
|
50
|
+
const r = await e.getPageIndex(a);
|
|
51
|
+
return B(e, a, r), await b(e, n);
|
|
52
|
+
} else
|
|
53
|
+
return O(s, n);
|
|
54
|
+
} else
|
|
55
|
+
return O(n[0], n);
|
|
56
|
+
}
|
|
57
|
+
const H = (e) => {
|
|
58
|
+
const n = e.target.parentNode;
|
|
59
|
+
if (!n)
|
|
60
|
+
return;
|
|
61
|
+
const a = new MutationObserver((s) => {
|
|
62
|
+
s.forEach(() => {
|
|
63
|
+
n.querySelectorAll(
|
|
64
|
+
'[data-l10n-id="pdfjs-annotation-date-time-string"]'
|
|
65
|
+
).forEach((o) => {
|
|
66
|
+
const c = o.getAttribute("data-l10n-args");
|
|
67
|
+
if (c)
|
|
68
|
+
try {
|
|
69
|
+
const { dateObj: i } = JSON.parse(c);
|
|
70
|
+
o.textContent = I(i);
|
|
71
|
+
} catch {
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
return a.observe(n, {
|
|
77
|
+
childList: !0,
|
|
78
|
+
// Watch for changes to child elements
|
|
79
|
+
subtree: !0,
|
|
80
|
+
// Watch all descendants, not just direct children
|
|
81
|
+
attributes: !0
|
|
82
|
+
// Watch for changes to attributes
|
|
83
|
+
}), () => a.disconnect();
|
|
84
|
+
}, M = (e, t, n, a) => {
|
|
85
|
+
if (e.type !== "click")
|
|
86
|
+
return;
|
|
87
|
+
const s = e.target, r = s.getAttribute("data-element-id"), o = s.getAttribute("href");
|
|
88
|
+
if (o && o !== "#")
|
|
89
|
+
return;
|
|
90
|
+
const c = t.find((i) => i.id === r);
|
|
91
|
+
!c || c.annotationType !== _.Link || c.dest && b(n, c.dest).then((i) => {
|
|
92
|
+
a(i);
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
function P(e, t) {
|
|
96
|
+
for (const n of v)
|
|
97
|
+
e.addEventListener(n, t);
|
|
98
|
+
}
|
|
99
|
+
function U(e, t) {
|
|
100
|
+
for (const n of v)
|
|
101
|
+
e.removeEventListener(n, t);
|
|
102
|
+
}
|
|
103
|
+
function V(e) {
|
|
104
|
+
const { id: t, url: n, unsafeUrl: a } = e;
|
|
105
|
+
new MutationObserver((r, o) => {
|
|
106
|
+
const c = document.querySelector(`[data-annotation-id="${t}"]`);
|
|
107
|
+
if (c) {
|
|
108
|
+
const i = c.querySelector("a"), p = L((n || a) ?? "", "");
|
|
109
|
+
i && (i == null || i.setAttribute("target", "_blank"), i == null || i.setAttribute("href", p), i == null || i.setAttribute("rel", "noopener noreferrer")), o.disconnect();
|
|
110
|
+
}
|
|
111
|
+
}).observe(document.body, { childList: !0, subtree: !0 });
|
|
112
|
+
}
|
|
113
|
+
function $(e, t, n) {
|
|
114
|
+
const { rotation: a, scale: s } = t, r = a % 180 === 0;
|
|
115
|
+
if (e.fieldType === "Btn" && e.pushButton) {
|
|
116
|
+
const o = e.rect[2] - e.rect[0], c = e.rect[3] - e.rect[1], i = document.createElement("canvas");
|
|
117
|
+
i.setAttribute("width", ((r ? o : c) * s).toString()), i.setAttribute("height", ((r ? c : o) * s).toString()), n.set(e.id, i);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function k(e) {
|
|
121
|
+
var r;
|
|
122
|
+
let t = e;
|
|
123
|
+
for (; t.tagName !== "SECTION"; )
|
|
124
|
+
t = t.parentElement;
|
|
125
|
+
const n = t.getAttribute("aria-haspopup") === "dialog", a = t.classList.contains("popupAnnotation");
|
|
126
|
+
if (!n && !a)
|
|
127
|
+
return;
|
|
128
|
+
let s = t.id || t.getAttribute("aria-controls");
|
|
129
|
+
if (s || (s = (r = t.firstChild) == null ? void 0 : r.id), s && t.parentElement) {
|
|
130
|
+
const o = t.parentElement.querySelector(`[aria-controls="${s}"]`);
|
|
131
|
+
o && new MutationObserver((i, p) => {
|
|
132
|
+
const h = document.querySelectorAll(".popupDate");
|
|
133
|
+
h.length > 0 && (h.forEach((m) => {
|
|
134
|
+
if (m.innerHTML)
|
|
135
|
+
return !1;
|
|
136
|
+
const N = m.getAttribute("data-l10n-args");
|
|
137
|
+
if (N) {
|
|
138
|
+
const { date: y, time: A } = JSON.parse(N);
|
|
139
|
+
y && A && (m.textContent = `${y}, ${A}`);
|
|
140
|
+
}
|
|
141
|
+
}), p.disconnect());
|
|
142
|
+
}).observe(o, { childList: !0, subtree: !0 });
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function d(e, t, n) {
|
|
146
|
+
const a = [];
|
|
147
|
+
if (n)
|
|
148
|
+
for (const s of n)
|
|
149
|
+
s[e] === t && a.push(s);
|
|
150
|
+
return a;
|
|
151
|
+
}
|
|
152
|
+
function u(e, t) {
|
|
153
|
+
return { type: e, data: t };
|
|
154
|
+
}
|
|
155
|
+
async function S(e, t) {
|
|
156
|
+
if (e.dest)
|
|
157
|
+
if (typeof e.dest == "string") {
|
|
158
|
+
const n = await b(t, e.dest);
|
|
159
|
+
return u(l.INTERNAL_LINK, {
|
|
160
|
+
referencedPage: n.pageIndex,
|
|
161
|
+
offset: null
|
|
162
|
+
});
|
|
163
|
+
} else {
|
|
164
|
+
const n = await t.getPageIndex(e.dest[0]);
|
|
165
|
+
return u(l.INTERNAL_LINK, {
|
|
166
|
+
referencedPage: n,
|
|
167
|
+
offset: {
|
|
168
|
+
left: e.dest[2],
|
|
169
|
+
bottom: e.dest[3]
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
else if (e.url)
|
|
174
|
+
return u(l.LINK, {
|
|
175
|
+
url: e.url,
|
|
176
|
+
unsafeUrl: e.unsafeUrl
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
function T(e) {
|
|
180
|
+
for (const t of e.getElementsByTagName("span")) {
|
|
181
|
+
let n = t.textContent;
|
|
182
|
+
const a = JSON.parse(t.dataset.l10nArgs ?? "{}");
|
|
183
|
+
if (n)
|
|
184
|
+
for (const s in a)
|
|
185
|
+
n = n.replace(`{{${s}}}`, a[s]);
|
|
186
|
+
t.textContent = n;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
function w(e) {
|
|
190
|
+
return u(l.FILE_ATTACHMENT, e.file);
|
|
191
|
+
}
|
|
192
|
+
function f(e, t) {
|
|
193
|
+
switch (e.type) {
|
|
194
|
+
case "textarea":
|
|
195
|
+
case "text":
|
|
196
|
+
return u(l.FORM_TEXT, {
|
|
197
|
+
fieldName: e.name,
|
|
198
|
+
value: e.value
|
|
199
|
+
});
|
|
200
|
+
case "select-one":
|
|
201
|
+
case "select-multiple":
|
|
202
|
+
const n = [];
|
|
203
|
+
for (const s of e.options)
|
|
204
|
+
n.push({
|
|
205
|
+
value: s.value,
|
|
206
|
+
label: s.label
|
|
207
|
+
});
|
|
208
|
+
const a = [];
|
|
209
|
+
for (const s of e.selectedOptions)
|
|
210
|
+
a.push({
|
|
211
|
+
value: s.value,
|
|
212
|
+
label: s.label
|
|
213
|
+
});
|
|
214
|
+
return u(l.FORM_SELECT, {
|
|
215
|
+
fieldName: e.name,
|
|
216
|
+
value: a,
|
|
217
|
+
options: n
|
|
218
|
+
});
|
|
219
|
+
case "checkbox":
|
|
220
|
+
return u(l.FORM_CHECKBOX, {
|
|
221
|
+
fieldName: e.name,
|
|
222
|
+
checked: e.checked
|
|
223
|
+
});
|
|
224
|
+
case "radio":
|
|
225
|
+
return u(l.FORM_RADIO, {
|
|
226
|
+
fieldName: e.name,
|
|
227
|
+
...t
|
|
228
|
+
});
|
|
229
|
+
case "button":
|
|
230
|
+
return u(l.FORM_BUTTON, {
|
|
231
|
+
fieldName: e.name,
|
|
232
|
+
...t
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
async function D(e, t, n) {
|
|
237
|
+
var s;
|
|
238
|
+
let a = e.target.parentNode;
|
|
239
|
+
if (a.tagName === "DIV" && (a = a.firstChild), k(a), typeof a.className != "object")
|
|
240
|
+
if (a.className === "linkAnnotation" && e.type === "click") {
|
|
241
|
+
const r = (s = a.dataset) == null ? void 0 : s.annotationId;
|
|
242
|
+
if (r) {
|
|
243
|
+
const o = d("id", r, n);
|
|
244
|
+
if (o.length)
|
|
245
|
+
return await S(o[0], t);
|
|
246
|
+
}
|
|
247
|
+
} else if (
|
|
248
|
+
/* annotation.className.includes('popupAnnotation') || */
|
|
249
|
+
a.className.includes("textAnnotation")
|
|
250
|
+
)
|
|
251
|
+
T(a);
|
|
252
|
+
else if (a.className.includes("fileAttachmentAnnotation")) {
|
|
253
|
+
T(a);
|
|
254
|
+
const r = a.dataset.annotationId;
|
|
255
|
+
if (r && e.type === "dblclick")
|
|
256
|
+
return w(d("id", r, n)[0]);
|
|
257
|
+
} else if (a.className.includes("textWidgetAnnotation") && e.type === "input") {
|
|
258
|
+
let r = a.getElementsByTagName("input")[0];
|
|
259
|
+
return r || (r = a.getElementsByTagName("textarea")[0]), f(r);
|
|
260
|
+
} else {
|
|
261
|
+
if (a.className.includes("choiceWidgetAnnotation") && e.type === "input")
|
|
262
|
+
return f(a.getElementsByTagName("select")[0]);
|
|
263
|
+
if (a.className.includes("buttonWidgetAnnotation checkBox") && e.type === "change")
|
|
264
|
+
return f(a.getElementsByTagName("input")[0]);
|
|
265
|
+
if (a.className.includes("buttonWidgetAnnotation radioButton") && e.type === "change") {
|
|
266
|
+
const r = a.dataset.annotationId;
|
|
267
|
+
if (r) {
|
|
268
|
+
const o = d("id", r, n)[0], c = [];
|
|
269
|
+
for (const i of d(
|
|
270
|
+
"fieldName",
|
|
271
|
+
o.fieldName,
|
|
272
|
+
n
|
|
273
|
+
))
|
|
274
|
+
i.buttonValue && c.push(i.buttonValue);
|
|
275
|
+
return f(a.getElementsByTagName("input")[0], {
|
|
276
|
+
value: o.buttonValue,
|
|
277
|
+
defaultValue: o.fieldValue,
|
|
278
|
+
options: c
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
} else if (a.className.includes("buttonWidgetAnnotation pushButton") && e.type === "click") {
|
|
282
|
+
const r = a.dataset.annotationId;
|
|
283
|
+
if (r) {
|
|
284
|
+
const o = d("id", r, n)[0], { action: c } = o;
|
|
285
|
+
return c && ["Print", "SaveAs"].includes(c) ? { type: l.BUTTON, data: o } : o.resetForm ? f(
|
|
286
|
+
{ name: o.fieldName, type: "button" },
|
|
287
|
+
{ actions: o.actions, reset: !0 }
|
|
288
|
+
) : f(
|
|
289
|
+
{ name: o.fieldName, type: "button" },
|
|
290
|
+
{ actions: o.actions, reset: !1 }
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
export {
|
|
297
|
+
D as annotationEventsHandler,
|
|
298
|
+
H as annotationsEvents,
|
|
299
|
+
P as bindLayerEvents,
|
|
300
|
+
V as handleAnnotationLink,
|
|
301
|
+
$ as handleAnnotationWidget,
|
|
302
|
+
M as handleClick,
|
|
303
|
+
U as unbindLayerEvents
|
|
304
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "../../contexts/RPDocumentContext.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import { c as y } from "../../RPDefaultLayout-
|
|
4
|
+
import { c as y } from "../../RPDefaultLayout-f556799a.js";
|
|
5
5
|
import "../../contexts/DarkModeContext.js";
|
|
6
6
|
import "../../contexts/RotationContext.js";
|
|
7
7
|
import "../../contexts/LayerContext.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState as E, useCallback as g, useEffect as v } from "react";
|
|
2
2
|
import { appConsole as l } from "../appConsole.js";
|
|
3
|
-
const b = /* @__PURE__ */ new Date("2025-03-
|
|
3
|
+
const b = /* @__PURE__ */ new Date("2025-03-31T06:34:19.046Z"), d = "Please visit https://www.react-pdf.dev/license-management/ to generate a new license key.", o = {
|
|
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}`,
|
|
@@ -1,39 +1,36 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { convertPDFDate as
|
|
3
|
-
import { formatFileSize as
|
|
4
|
-
const D = (
|
|
5
|
-
const [
|
|
6
|
-
if (!
|
|
1
|
+
import { useState as S, useCallback as m, useEffect as d } from "react";
|
|
2
|
+
import { convertPDFDate as l } from "../convertPdfDate.js";
|
|
3
|
+
import { formatFileSize as w } from "../formatFileSize.js";
|
|
4
|
+
const D = (n, t, s) => {
|
|
5
|
+
const [u, p] = S(), c = m(async () => {
|
|
6
|
+
if (!t || !n)
|
|
7
7
|
return;
|
|
8
|
-
const
|
|
9
|
-
let
|
|
10
|
-
|
|
11
|
-
l = Number(i.headers.get("content-length")) || 0;
|
|
12
|
-
else
|
|
13
|
-
throw i.body;
|
|
8
|
+
const r = await t.getMetadata().then(), P = t.numPages, e = r == null ? void 0 : r.info, a = await t.getDownloadInfo();
|
|
9
|
+
let f = 0;
|
|
10
|
+
a && (f = a.length);
|
|
14
11
|
try {
|
|
15
|
-
const
|
|
16
|
-
pageCount:
|
|
17
|
-
filename:
|
|
18
|
-
fileSize:
|
|
12
|
+
const o = l(e.CreationDate), i = l(e.ModDate), g = {
|
|
13
|
+
pageCount: P,
|
|
14
|
+
filename: s || "",
|
|
15
|
+
fileSize: w(f),
|
|
19
16
|
title: e.Title,
|
|
20
17
|
author: e.Author,
|
|
21
18
|
subject: e.Subject,
|
|
22
19
|
keywords: e.Keywords || "",
|
|
23
20
|
creator: e.Creator,
|
|
24
|
-
createdOn: (
|
|
25
|
-
modifiedOn: (
|
|
21
|
+
createdOn: (o == null ? void 0 : o.toISOString()) || "",
|
|
22
|
+
modifiedOn: (i == null ? void 0 : i.toISOString()) || "",
|
|
26
23
|
pdfProducer: e.Producer,
|
|
27
24
|
pdfVersion: e.PDFFormatVersion
|
|
28
25
|
};
|
|
29
|
-
|
|
30
|
-
} catch (
|
|
31
|
-
console.log("properties err",
|
|
26
|
+
p(g);
|
|
27
|
+
} catch (o) {
|
|
28
|
+
console.log("properties err", o);
|
|
32
29
|
}
|
|
33
|
-
}, [
|
|
34
|
-
return
|
|
35
|
-
|
|
36
|
-
}, [
|
|
30
|
+
}, [t, s, n]);
|
|
31
|
+
return d(() => {
|
|
32
|
+
c();
|
|
33
|
+
}, [c]), u;
|
|
37
34
|
};
|
|
38
35
|
export {
|
|
39
36
|
D as usePdfProperties
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "react";
|
|
2
2
|
import "react/jsx-runtime";
|
|
3
3
|
import "../../contexts/RPDocumentContext.js";
|
|
4
|
-
import { i as A } from "../../RPDefaultLayout-
|
|
4
|
+
import { i as A } from "../../RPDefaultLayout-f556799a.js";
|
|
5
5
|
import "../../contexts/DarkModeContext.js";
|
|
6
6
|
import "../../contexts/RotationContext.js";
|
|
7
7
|
import "../../contexts/LayerContext.js";
|
|
@@ -2,7 +2,7 @@ import "react";
|
|
|
2
2
|
import "../../contexts/ScrollModeContext.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "../../contexts/RPDocumentContext.js";
|
|
5
|
-
import { f as A } from "../../RPDefaultLayout-
|
|
5
|
+
import { f as A } from "../../RPDefaultLayout-f556799a.js";
|
|
6
6
|
import "../../contexts/DarkModeContext.js";
|
|
7
7
|
import "../types.js";
|
|
8
8
|
import "../../contexts/RotationContext.js";
|
|
@@ -7,7 +7,7 @@ import "pdfjs-dist";
|
|
|
7
7
|
import "../../contexts/RPDocumentContext.js";
|
|
8
8
|
import "../../contexts/ZoomContext.js";
|
|
9
9
|
import "react/jsx-runtime";
|
|
10
|
-
import { n as C } from "../../RPDefaultLayout-
|
|
10
|
+
import { n as C } from "../../RPDefaultLayout-f556799a.js";
|
|
11
11
|
import "../../contexts/DarkModeContext.js";
|
|
12
12
|
import "../../contexts/RotationContext.js";
|
|
13
13
|
import "../../contexts/LayerContext.js";
|
|
@@ -2,7 +2,7 @@ import "react";
|
|
|
2
2
|
import "../renderPage.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "../../contexts/RPDocumentContext.js";
|
|
5
|
-
import { k as B } from "../../RPDefaultLayout-
|
|
5
|
+
import { k as B } from "../../RPDefaultLayout-f556799a.js";
|
|
6
6
|
import "../../contexts/DarkModeContext.js";
|
|
7
7
|
import "../../contexts/RotationContext.js";
|
|
8
8
|
import "../../contexts/LayerContext.js";
|
|
@@ -3,7 +3,7 @@ import "../types.js";
|
|
|
3
3
|
import "../../contexts/ScrollModeContext.js";
|
|
4
4
|
import "react/jsx-runtime";
|
|
5
5
|
import "../../contexts/RPDocumentContext.js";
|
|
6
|
-
import { r as y } from "../../RPDefaultLayout-
|
|
6
|
+
import { r as y } from "../../RPDefaultLayout-f556799a.js";
|
|
7
7
|
import "../../contexts/DarkModeContext.js";
|
|
8
8
|
import "../../contexts/RotationContext.js";
|
|
9
9
|
import "../../contexts/LayerContext.js";
|
package/dist/utils/renderPage.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { AnnotationMode as a } from "pdfjs-dist";
|
|
2
|
+
const p = (o, t, d = {}) => {
|
|
3
|
+
const { scale: i = 1, rotate: r = 0, renderForms: h = !1 } = d, s = t.getContext("2d", {
|
|
3
4
|
desynchronized: !1
|
|
4
|
-
}),
|
|
5
|
-
scale: i *
|
|
5
|
+
}), w = window.devicePixelRatio, n = o.getViewport({ scale: i, rotation: r }), e = o.getViewport({
|
|
6
|
+
scale: i * w,
|
|
6
7
|
rotation: r
|
|
7
8
|
});
|
|
8
|
-
return t.width =
|
|
9
|
-
canvasContext:
|
|
10
|
-
viewport:
|
|
9
|
+
return t.width = e.width, t.height = e.height, t.style.width = `${Math.floor(n.width)}px`, t.style.height = `${Math.floor(n.height)}px`, o.render({
|
|
10
|
+
canvasContext: s,
|
|
11
|
+
viewport: e,
|
|
12
|
+
annotationMode: h ? a.ENABLE_FORMS : void 0
|
|
11
13
|
});
|
|
12
14
|
};
|
|
13
15
|
export {
|
|
14
|
-
|
|
16
|
+
p as renderPage
|
|
15
17
|
};
|
package/dist/utils/types.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { e as O, z as _, i as R, p as I, t as
|
|
2
|
-
var
|
|
3
|
-
const
|
|
1
|
+
import { e as O, z as _, i as R, p as I, t as E } from "../th_TH-2c4015a5.js";
|
|
2
|
+
var N = /* @__PURE__ */ ((r) => (r[r.Text = 1] = "Text", r[r.Link = 2] = "Link", r[r.FreeText = 3] = "FreeText", r[r.Line = 4] = "Line", r[r.Square = 5] = "Square", r[r.Circle = 6] = "Circle", r[r.Polygon = 7] = "Polygon", r[r.Polyline = 8] = "Polyline", r[r.Highlight = 9] = "Highlight", r[r.Underline = 10] = "Underline", r[r.Squiggly = 11] = "Squiggly", r[r.StrikeOut = 12] = "StrikeOut", r[r.Stamp = 13] = "Stamp", r[r.Caret = 14] = "Caret", r[r.Ink = 15] = "Ink", r[r.Popup = 16] = "Popup", r[r.FileAttachment = 17] = "FileAttachment", r[r.Widget = 20] = "Widget", r))(N || {}), L = /* @__PURE__ */ ((r) => (r.INTERNAL_LINK = "internal-link", r.LINK = "link", r.FILE_ATTACHMENT = "file-attachment", r.FORM_TEXT = "form-text", r.FORM_SELECT = "form-select", r.FORM_CHECKBOX = "form-checkbox", r.FORM_RADIO = "form-radio", r.FORM_BUTTON = "form-button", r.BUTTON = "button", r))(L || {}), D = /* @__PURE__ */ ((r) => (r.ACTUAL = "Actual", r.PAGE_FIT = "Fit", r.PAGE_WIDTH = "Width", r))(D || {}), p = /* @__PURE__ */ ((r) => (r.Organization = "organization", r.Developer = "developer", r))(p || {}), d = /* @__PURE__ */ ((r) => (r.SINGLE_PAGE = "Single", r.DUAL_PAGE = "Dual", r))(d || {}), C = /* @__PURE__ */ ((r) => (r.TEXT_COLOR = "--rp-text-color", r.OUTLINE_COLOR = "--rp-outline-color", r.FONT_FAMILY = "--rp-font-family", r.PRIMARY_COLOR = "--rp-primary-color", r.BORDER_RADIUS = "--rp-border-radius", r.DROP_MASK_BACKGROUND_COLOR = "--rp-drop-mask-background-color", r.LOADER_BACKDROP_COLOR = "--rp-loader-backdrop-color", r.ICON_DISABLED = "--rp-icon-disabled", r.ICON_FONT_SIZE = "--rp-icon-font-size", r.TOOLBAR_BACKGROUND = "--rp-toolbar-background", r.TOOLBAR_BORDER_COLOR = "--rp-toolbar-border-color", r.TOOLBAR_PADDING = "--rp-toolbar-padding", r.TOOLBAR_GAP = "--rp-toolbar-gap", r.SIDEBAR_WIDTH = "--rp-sidebar-width", r.THUMBNAIL_BORDER_COLOR = "--rp-thumbnail-border-color", r.THUMBNAIL_BACKGROUND_COLOR = "--rp-thumbnail-background-color", r.THUMBNAIL_ACTIVE_COLOR = "--rp-thumbnail-active-color", r.THUMBNAIL_PADDING_Y = "--rp-thumbnail-padding-y", r.BUTTON_HOVER_BACKGROUND = "--rp-button-hover-background", r.BUTTON_PADDING = "--rp-button-padding", r.INPUT_PADDING = "--rp-input-padding", r.INPUT_BORDER_RADIUS = "--rp-input-border-radius", r.INPUT_BACKGROUND_COLOR = "--rp-input-background-color", r.PAGES_BACKGROUND_COLOR = "--rp-pages-background-color", r.ANNOTATION_LAYER_LINK_HOVER_BACKGROUND = "--rp-annotation-layer__link-hover-background", r.DROPDOWN_BACKGROUND_COLOR = "--rp-dropdown-background-color", r.DROPDOWN_PADDING = "--rp-dropdown-padding", r.DROPDOWN_HOVER_BACKGROUND_COLOR = "--rp-dropdown-hover-background-color", r.DROPDOWN_SEPARATOR_COLOR = "--rp-dropdown-separator-color", r.DROPDOWN_SEPARATOR_MARGIN = "--rp-dropdown-separator-margin", r.POPOVER_BACKGROUND_COLOR = "--rp-popover-background-color", r.POPOVER_COLOR = "--rp-popover-color", r.POPOVER_BORDER_COLOR = "--rp-popover-border-color", r.OVERLAY_BACKGROUND_COLOR = "--rp-overlay-background-color", r.DIALOG_BACKGROUND_COLOR = "--rp-dialog-background-color", r.PROPERTIES_DIVIDER_COLOR = "--rp-properties-divider-color", r.PROPERTIES_DIVIDER_MARGIN = "--rp-properties-divider-margin", r.PROPERTY_ITEM_GAP = "--rp-property-item-gap", r.DIALOG_TITLE_COLOR = "--rp-dialog-title-color", r.PROPERTY_ITEM_LABEL_COLOR = "--rp-property-item-label-color", r.PROPERTY_CLOSE_ICON_SIZE = "--rp-property-close-icon-size", r.PROPERTY_ITEM_FONT_SIZE = "--rp-property-item-font-size", r.PROPERTY_ITEM_FONT_WEIGHT = "--rp-property-item-font-weight", r.DIALOG_TITLE_FONT_SIZE = "--rp-dialog-title-font-size", r.DIALOG_TITLE_FONT_WEIGHT = "--rp-dialog-title-font-weight", r.MENU_ITEM_ICON_SIZE = "--rp-menu-item-icon-size", r.PRINT_PROGRESS_BACKGROUND = "--rp-print-progress-background", r))(C || {}), P = /* @__PURE__ */ ((r) => (r.PAGE_SCROLLING = "PAGE", r.VERTICAL_SCROLLING = "VERTICAL", r.HORIZONTAL_SCROLLING = "HORIZONTAL", r))(P || {}), o = /* @__PURE__ */ ((r) => (r.TEXT = "TEXT", r.HAND = "HAND", r))(o || {});
|
|
3
|
+
const g = {
|
|
4
4
|
en_US: O,
|
|
5
5
|
zh_CN: _,
|
|
6
6
|
it_IT: R,
|
|
7
7
|
pt_PT: I,
|
|
8
|
-
th_TH:
|
|
8
|
+
th_TH: E
|
|
9
9
|
};
|
|
10
10
|
export {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
P as
|
|
16
|
-
o as
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
N as AnnotationSubType,
|
|
12
|
+
L as AnnotationType,
|
|
13
|
+
p as LicenseType,
|
|
14
|
+
g as Locales,
|
|
15
|
+
P as ScrollMode,
|
|
16
|
+
o as SelectionMode,
|
|
17
|
+
C as ThemeVariables,
|
|
18
|
+
d as ViewMode,
|
|
19
|
+
D as ZoomLevel
|
|
19
20
|
};
|