pdf-tsx 0.8.0 → 0.10.0
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 +2 -0
- package/dist/cjs/components/PDFSidebar.cjs +1 -1
- package/dist/cjs/components/PDFSidebar.module.cjs +1 -1
- package/dist/cjs/components/PDFViewer.cjs +1 -1
- package/dist/cjs/components/PDFViewer.module.cjs +1 -1
- package/dist/cjs/components/features/PDFAnnotations.cjs +1 -1
- package/dist/cjs/components/features/PDFAnnotations.module.cjs +1 -1
- package/dist/cjs/components/features/PDFAttachments.cjs +1 -1
- package/dist/cjs/components/features/PDFAttachments.module.cjs +1 -1
- package/dist/cjs/components/features/PDFChangeFile.cjs +1 -1
- package/dist/cjs/components/features/PDFDownloadButton.cjs +1 -1
- package/dist/cjs/components/features/PDFNavigation.cjs +1 -1
- package/dist/cjs/components/features/PDFNavigation.module.cjs +1 -1
- package/dist/cjs/components/features/PDFOutline.cjs +1 -1
- package/dist/cjs/components/features/PDFOutline.module.cjs +1 -1
- package/dist/cjs/components/features/PDFPageFit.cjs +1 -1
- package/dist/cjs/components/features/PDFPrintButton.cjs +1 -1
- package/dist/cjs/components/features/PDFRotationControl.cjs +1 -1
- package/dist/cjs/components/features/PDFSearch.cjs +1 -1
- package/dist/cjs/components/features/PDFSearch.module.cjs +1 -1
- package/dist/cjs/components/features/PDFSidebarToggle.cjs +1 -1
- package/dist/cjs/components/features/PDFSignatures.cjs +1 -1
- package/dist/cjs/components/features/PDFSignatures.module.cjs +1 -1
- package/dist/cjs/components/features/PDFThemeToggle.cjs +1 -1
- package/dist/cjs/components/features/PDFThumbnails.cjs +1 -1
- package/dist/cjs/components/features/PDFThumbnails.module.cjs +1 -1
- package/dist/cjs/components/features/PDFZoomControls.cjs +1 -1
- package/dist/cjs/components/features/PDFZoomControls.module.cjs +1 -1
- package/dist/cjs/components/ui/PDFToolbar.cjs +1 -1
- package/dist/cjs/components/ui/PDFToolbarDropdownContext.cjs +1 -0
- package/dist/cjs/components/ui/PDFToolbarItem.cjs +1 -1
- package/dist/cjs/components/ui/ToolbarButton.cjs +1 -1
- package/dist/cjs/components/ui/ToolbarButton.module.cjs +1 -1
- package/dist/cjs/components/ui/icons.cjs +1 -1
- package/dist/cjs/context/ThemeContext.cjs +1 -1
- package/dist/cjs/hooks/useAnnotationLayer.cjs +1 -1
- package/dist/cjs/hooks/useKeyboardShortcuts.cjs +1 -1
- package/dist/cjs/hooks/useOutline.cjs +1 -1
- package/dist/cjs/hooks/useOverlayRects.cjs +1 -1
- package/dist/cjs/hooks/usePDFLoader.cjs +1 -1
- package/dist/cjs/hooks/useScrollTracking.cjs +1 -1
- package/dist/cjs/hooks/useTextLayer.cjs +1 -1
- package/dist/cjs/hooks/useTextSearch.cjs +1 -1
- package/dist/cjs/hooks/useThumbnails.cjs +1 -1
- package/dist/cjs/pdf-tsx.css +1 -1
- package/dist/components/features/PDFSearch.d.ts +1 -1
- package/dist/components/features/PDFSidebarToggle.d.ts +1 -1
- package/dist/components/features/PDFZoomControls.d.ts +1 -1
- package/dist/components/ui/PDFToolbar.d.ts +2 -2
- package/dist/components/ui/PDFToolbarDropdownContext.d.ts +1 -0
- package/dist/context/ThemeContext.d.ts +1 -1
- package/dist/es/components/PDFSidebar.js +25 -39
- package/dist/es/components/PDFSidebar.module.js +9 -9
- package/dist/es/components/PDFViewer.js +210 -234
- package/dist/es/components/PDFViewer.module.js +15 -15
- package/dist/es/components/features/PDFAnnotations.js +54 -62
- package/dist/es/components/features/PDFAnnotations.module.js +12 -12
- package/dist/es/components/features/PDFAttachments.js +52 -70
- package/dist/es/components/features/PDFAttachments.module.js +8 -8
- package/dist/es/components/features/PDFChangeFile.js +13 -24
- package/dist/es/components/features/PDFDownloadButton.js +10 -13
- package/dist/es/components/features/PDFNavigation.js +38 -59
- package/dist/es/components/features/PDFNavigation.module.js +3 -3
- package/dist/es/components/features/PDFOutline.js +66 -83
- package/dist/es/components/features/PDFOutline.module.js +5 -5
- package/dist/es/components/features/PDFPageFit.js +18 -23
- package/dist/es/components/features/PDFPrintButton.js +14 -17
- package/dist/es/components/features/PDFRotationControl.js +7 -13
- package/dist/es/components/features/PDFSearch.js +60 -69
- package/dist/es/components/features/PDFSearch.module.js +5 -5
- package/dist/es/components/features/PDFSidebarToggle.js +8 -13
- package/dist/es/components/features/PDFSignatures.js +116 -139
- package/dist/es/components/features/PDFSignatures.module.js +16 -16
- package/dist/es/components/features/PDFThemeToggle.js +10 -11
- package/dist/es/components/features/PDFThumbnails.js +25 -34
- package/dist/es/components/features/PDFThumbnails.module.js +9 -9
- package/dist/es/components/features/PDFZoomControls.js +21 -36
- package/dist/es/components/features/PDFZoomControls.module.js +1 -1
- package/dist/es/components/ui/PDFToolbar.js +33 -32
- package/dist/es/components/ui/PDFToolbarDropdownContext.js +5 -0
- package/dist/es/components/ui/PDFToolbarItem.js +11 -20
- package/dist/es/components/ui/ToolbarButton.js +8 -11
- package/dist/es/components/ui/ToolbarButton.module.js +2 -2
- package/dist/es/components/ui/icons.js +5 -16
- package/dist/es/context/ThemeContext.js +28 -38
- package/dist/es/hooks/useAnnotationLayer.js +33 -42
- package/dist/es/hooks/useKeyboardShortcuts.js +25 -34
- package/dist/es/hooks/useOutline.js +18 -23
- package/dist/es/hooks/useOverlayRects.js +42 -51
- package/dist/es/hooks/usePDFLoader.js +13 -16
- package/dist/es/hooks/useScrollTracking.js +24 -25
- package/dist/es/hooks/useTextLayer.js +34 -29
- package/dist/es/hooks/useTextSearch.js +31 -38
- package/dist/es/hooks/useThumbnails.js +33 -44
- package/dist/es/pdf-tsx.css +1 -1
- package/dist/hooks/useAttachments.d.ts +1 -1
- package/dist/hooks/useOutline.d.ts +1 -1
- package/dist/hooks/useOverlayRects.d.ts +1 -1
- package/dist/hooks/usePDFRenderer.d.ts +1 -1
- package/dist/hooks/useSignatures.d.ts +1 -1
- package/dist/hooks/useThumbnails.d.ts +1 -1
- package/dist/index.d.ts +3 -3
- package/package.json +3 -3
|
@@ -5,7 +5,7 @@ interface PDFSearchProps {
|
|
|
5
5
|
nextIcon: React.ReactNode;
|
|
6
6
|
clearIcon: React.ReactNode;
|
|
7
7
|
}
|
|
8
|
-
export declare function PDFSearch({ searchIcon, prevIcon, nextIcon, clearIcon }: PDFSearchProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function PDFSearch({ searchIcon, prevIcon, nextIcon, clearIcon, }: PDFSearchProps): import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
export declare namespace PDFSearch {
|
|
10
10
|
var toolbarLabel: string;
|
|
11
11
|
}
|
|
@@ -3,7 +3,7 @@ interface PDFSidebarToggleProps {
|
|
|
3
3
|
collapseIcon: ReactNode;
|
|
4
4
|
expandIcon: ReactNode;
|
|
5
5
|
}
|
|
6
|
-
export declare function PDFSidebarToggle({ collapseIcon, expandIcon }: PDFSidebarToggleProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function PDFSidebarToggle({ collapseIcon, expandIcon, }: PDFSidebarToggleProps): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export declare namespace PDFSidebarToggle {
|
|
8
8
|
var toolbarLabel: string;
|
|
9
9
|
}
|
|
@@ -3,7 +3,7 @@ interface PDFZoomControlsProps {
|
|
|
3
3
|
zoomOutIcon: React.ReactNode;
|
|
4
4
|
zoomInIcon: React.ReactNode;
|
|
5
5
|
}
|
|
6
|
-
export declare function PDFZoomControls({ zoomOutIcon, zoomInIcon }: PDFZoomControlsProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function PDFZoomControls({ zoomOutIcon, zoomInIcon, }: PDFZoomControlsProps): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export declare namespace PDFZoomControls {
|
|
8
8
|
var toolbarLabel: string;
|
|
9
9
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
|
|
2
|
+
import { PDFToolbarDropdownContext } from './PDFToolbarDropdownContext';
|
|
3
|
+
export { PDFToolbarDropdownContext };
|
|
3
4
|
interface Props {
|
|
4
5
|
children: React.ReactNode;
|
|
5
6
|
overflowIcon?: React.ReactNode;
|
|
6
7
|
}
|
|
7
8
|
export declare function PDFToolbar({ children, overflowIcon }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PDFToolbarDropdownContext: import('react').Context<boolean>;
|
|
@@ -8,5 +8,5 @@ interface ThemeProviderProps {
|
|
|
8
8
|
};
|
|
9
9
|
defaultTheme?: "light" | "dark";
|
|
10
10
|
}
|
|
11
|
-
export declare function ThemeProvider({ children, themeOverrides, defaultTheme }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function ThemeProvider({ children, themeOverrides, defaultTheme, }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
export {};
|
|
@@ -1,45 +1,31 @@
|
|
|
1
1
|
import { usePDFViewer as e } from "../context/PDFViewerContext.js";
|
|
2
2
|
import t from "./PDFSidebar.module.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
3
|
+
import { useState as n } from "react";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
6
5
|
//#region src/components/PDFSidebar.tsx
|
|
7
|
-
function
|
|
8
|
-
let
|
|
9
|
-
|
|
10
|
-
let p = f;
|
|
11
|
-
if (l) return null;
|
|
12
|
-
let m;
|
|
13
|
-
if (s[1] !== u || s[2] !== c) {
|
|
14
|
-
let e;
|
|
15
|
-
s[4] === u ? e = s[5] : (e = (e, n) => /* @__PURE__ */ i("button", {
|
|
16
|
-
className: `${t.panelButton} ${u === n ? t.panelButtonActive : ""}`,
|
|
17
|
-
onClick: () => p(n),
|
|
18
|
-
title: e.label,
|
|
19
|
-
children: e.icon
|
|
20
|
-
}, n), s[4] = u, s[5] = e), m = c.map(e), s[1] = u, s[2] = c, s[3] = m;
|
|
21
|
-
} else m = s[3];
|
|
22
|
-
let h;
|
|
23
|
-
s[6] === m ? h = s[7] : (h = /* @__PURE__ */ i("div", {
|
|
24
|
-
className: t.buttonBar,
|
|
25
|
-
children: m
|
|
26
|
-
}), s[6] = m, s[7] = h);
|
|
27
|
-
let g;
|
|
28
|
-
s[8] !== u || s[9] !== c ? (g = u !== null && /* @__PURE__ */ a("div", {
|
|
29
|
-
className: t.contentPanel,
|
|
30
|
-
children: [/* @__PURE__ */ i("div", {
|
|
31
|
-
className: t.panelHeader,
|
|
32
|
-
children: c[u].label
|
|
33
|
-
}), /* @__PURE__ */ i("div", {
|
|
34
|
-
className: t.panelBody,
|
|
35
|
-
children: c[u].content
|
|
36
|
-
})]
|
|
37
|
-
}), s[8] = u, s[9] = c, s[10] = g) : g = s[10];
|
|
38
|
-
let _;
|
|
39
|
-
return s[11] !== h || s[12] !== g ? (_ = /* @__PURE__ */ a("div", {
|
|
6
|
+
function a({ panels: a }) {
|
|
7
|
+
let { sidebarCollapsed: o } = e(), [s, c] = n(null), l = (e) => c((t) => t === e ? null : e);
|
|
8
|
+
return o ? null : /* @__PURE__ */ i("div", {
|
|
40
9
|
className: t.wrapper,
|
|
41
|
-
children: [
|
|
42
|
-
|
|
10
|
+
children: [/* @__PURE__ */ r("div", {
|
|
11
|
+
className: t.buttonBar,
|
|
12
|
+
children: a.map((e, n) => /* @__PURE__ */ r("button", {
|
|
13
|
+
className: `${t.panelButton} ${s === n ? t.panelButtonActive : ""}`,
|
|
14
|
+
onClick: () => l(n),
|
|
15
|
+
title: e.label,
|
|
16
|
+
children: e.icon
|
|
17
|
+
}, n))
|
|
18
|
+
}), s !== null && /* @__PURE__ */ i("div", {
|
|
19
|
+
className: t.contentPanel,
|
|
20
|
+
children: [/* @__PURE__ */ r("div", {
|
|
21
|
+
className: t.panelHeader,
|
|
22
|
+
children: a[s].label
|
|
23
|
+
}), /* @__PURE__ */ r("div", {
|
|
24
|
+
className: t.panelBody,
|
|
25
|
+
children: a[s].content
|
|
26
|
+
})]
|
|
27
|
+
})]
|
|
28
|
+
});
|
|
43
29
|
}
|
|
44
30
|
//#endregion
|
|
45
|
-
export {
|
|
31
|
+
export { a as PDFSidebar };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var e = {
|
|
2
|
-
wrapper: "
|
|
3
|
-
wrapperCollapsed: "
|
|
4
|
-
buttonBar: "
|
|
5
|
-
toggleButton: "
|
|
6
|
-
panelButton: "
|
|
7
|
-
panelButtonActive: "
|
|
8
|
-
contentPanel: "
|
|
9
|
-
panelHeader: "
|
|
10
|
-
panelBody: "
|
|
2
|
+
wrapper: "_wrapper_1kvg0_1",
|
|
3
|
+
wrapperCollapsed: "_wrapperCollapsed_1kvg0_7",
|
|
4
|
+
buttonBar: "_buttonBar_1kvg0_16",
|
|
5
|
+
toggleButton: "_toggleButton_1kvg0_26",
|
|
6
|
+
panelButton: "_panelButton_1kvg0_35",
|
|
7
|
+
panelButtonActive: "_panelButtonActive_1kvg0_57",
|
|
8
|
+
contentPanel: "_contentPanel_1kvg0_66",
|
|
9
|
+
panelHeader: "_panelHeader_1kvg0_74",
|
|
10
|
+
panelBody: "_panelBody_1kvg0_86"
|
|
11
11
|
};
|
|
12
12
|
//#endregion
|
|
13
13
|
export { e as default };
|
|
@@ -3,243 +3,219 @@ import { useScrollTracking as t } from "../hooks/useScrollTracking.js";
|
|
|
3
3
|
import { useKeyboardShortcuts as n } from "../hooks/useKeyboardShortcuts.js";
|
|
4
4
|
import { useTextLayer as r } from "../hooks/useTextLayer.js";
|
|
5
5
|
import { isSafeUrl as i } from "../utils/url.js";
|
|
6
|
-
import { useAnnotationLayer as
|
|
7
|
-
import { usePDFLoader as
|
|
8
|
-
import { usePDFRenderer as
|
|
9
|
-
import { useOverlayRects as
|
|
10
|
-
import { computeFit as
|
|
11
|
-
import { ThemeProvider as
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import { Fragment as ce, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
6
|
+
import { useAnnotationLayer as a } from "../hooks/useAnnotationLayer.js";
|
|
7
|
+
import { usePDFLoader as ee } from "../hooks/usePDFLoader.js";
|
|
8
|
+
import { usePDFRenderer as te } from "../hooks/usePDFRenderer.js";
|
|
9
|
+
import { useOverlayRects as o } from "../hooks/useOverlayRects.js";
|
|
10
|
+
import { computeFit as s } from "../utils/pdfFit.js";
|
|
11
|
+
import { ThemeProvider as c } from "../context/ThemeContext.js";
|
|
12
|
+
import l from "./PDFViewer.module.js";
|
|
13
|
+
import { useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
14
|
+
import * as h from "pdfjs-dist";
|
|
15
|
+
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
17
16
|
//#region src/components/PDFViewer.tsx
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
!A || !m || !w.current || ie(m, A, w.current, Oe.current).then(v);
|
|
42
|
-
}, F = [A, m], d[12] = m, d[13] = A, d[14] = P, d[15] = F) : (P = d[14], F = d[15]), o(P, F);
|
|
43
|
-
let je = s(C), I, L;
|
|
44
|
-
d[16] === C ? (I = d[17], L = d[18]) : (I = () => {
|
|
45
|
-
je.current = C;
|
|
46
|
-
}, L = [C], d[16] = C, d[17] = I, d[18] = L), o(I, L);
|
|
47
|
-
let R, z;
|
|
48
|
-
d[19] === A ? (R = d[20], z = d[21]) : (R = () => {
|
|
49
|
-
if (!A || !w.current) return;
|
|
50
|
-
let e = w.current, t = new ResizeObserver(() => {
|
|
51
|
-
je.current && ie(je.current, A, e, Oe.current).then(v);
|
|
17
|
+
var y = 2, b = ({ file: b, workerSrc: x, sidebar: S, toolbar: C, onChangeFile: w, themeOverrides: ne, defaultTheme: re, defaultFit: T, className: E, style: ie }) => {
|
|
18
|
+
d(() => {
|
|
19
|
+
h.GlobalWorkerOptions.workerSrc = x;
|
|
20
|
+
}, [x]);
|
|
21
|
+
let [D, O] = m(1), [k, A] = m(0), [j, M] = m(null), [N, P] = m([]), [F, I] = m(!1), [L, R] = m(T ?? null), z = p(null), B = p([]), V = p([]), H = p(k);
|
|
22
|
+
d(() => {
|
|
23
|
+
H.current = k;
|
|
24
|
+
}, [k]);
|
|
25
|
+
let [U, W] = m(null);
|
|
26
|
+
U !== b && (W(b), M(null));
|
|
27
|
+
let { pdf: G, numPages: K } = ee(b);
|
|
28
|
+
d(() => {
|
|
29
|
+
G && (B.current = Array(G.numPages).fill(null), V.current = Array(G.numPages).fill(null));
|
|
30
|
+
}, [G]), d(() => {
|
|
31
|
+
!G || !T || !z.current || s(T, G, z.current, H.current).then(O);
|
|
32
|
+
}, [G, T]);
|
|
33
|
+
let q = p(L);
|
|
34
|
+
d(() => {
|
|
35
|
+
q.current = L;
|
|
36
|
+
}, [L]), d(() => {
|
|
37
|
+
if (!G || !z.current) return;
|
|
38
|
+
let e = z.current, t = new ResizeObserver(() => {
|
|
39
|
+
q.current && s(q.current, G, e, H.current).then(O);
|
|
52
40
|
});
|
|
53
41
|
return t.observe(e), () => t.disconnect();
|
|
54
|
-
},
|
|
55
|
-
let
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
d[24] !== V || d[25] !== b || d[26] !== j || d[27] !== S ? (U = () => {
|
|
63
|
-
if (j === 0) return [];
|
|
64
|
-
let e = /* @__PURE__ */ new Set(), t = Math.max(V - le, 1), n = Math.min(V + le, j);
|
|
42
|
+
}, [G]);
|
|
43
|
+
let { currentPage: J, goToPage: Y } = t({
|
|
44
|
+
numPages: K,
|
|
45
|
+
containerRef: z,
|
|
46
|
+
pageRefs: B
|
|
47
|
+
}), X = f(() => {
|
|
48
|
+
if (K === 0) return [];
|
|
49
|
+
let e = /* @__PURE__ */ new Set(), t = Math.max(J - y, 1), n = Math.min(J + y, K);
|
|
65
50
|
for (let r = t; r <= n; r++) e.add(r);
|
|
66
|
-
|
|
67
|
-
for (let t of
|
|
68
|
-
return Array.from(e).sort(
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
})()
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
className:
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
51
|
+
j && e.add(j.page);
|
|
52
|
+
for (let t of N) e.add(t.page);
|
|
53
|
+
return Array.from(e).sort((e, t) => e - t);
|
|
54
|
+
}, [
|
|
55
|
+
J,
|
|
56
|
+
K,
|
|
57
|
+
j,
|
|
58
|
+
N
|
|
59
|
+
]), { pageSizes: ae, renderedPages: Z } = te({
|
|
60
|
+
pdf: G,
|
|
61
|
+
zoom: D,
|
|
62
|
+
rotation: k,
|
|
63
|
+
visiblePages: X,
|
|
64
|
+
canvasRefs: V
|
|
65
|
+
}), Q = f(() => {
|
|
66
|
+
let e = new Set(X);
|
|
67
|
+
for (let t of Z) e.add(t);
|
|
68
|
+
return Array.from(e).sort((e, t) => e - t);
|
|
69
|
+
}, [X, Z]);
|
|
70
|
+
n({
|
|
71
|
+
pdf: G,
|
|
72
|
+
currentPage: J,
|
|
73
|
+
goToPage: Y,
|
|
74
|
+
setZoom: O,
|
|
75
|
+
setRotation: A,
|
|
76
|
+
setFitMode: R
|
|
77
|
+
});
|
|
78
|
+
let oe = r({
|
|
79
|
+
pdf: G,
|
|
80
|
+
zoom: D,
|
|
81
|
+
rotation: k,
|
|
82
|
+
mountedPages: Q,
|
|
83
|
+
canvasRefs: V
|
|
84
|
+
}), se = a({
|
|
85
|
+
pdf: G,
|
|
86
|
+
zoom: D,
|
|
87
|
+
rotation: k,
|
|
88
|
+
mountedPages: Q,
|
|
89
|
+
goToPage: Y
|
|
90
|
+
}), { overlayRect: $, searchOverlays: ce } = o({
|
|
91
|
+
pdf: G,
|
|
92
|
+
highlight: j,
|
|
93
|
+
searchMatches: N,
|
|
94
|
+
zoom: D,
|
|
95
|
+
rotation: k
|
|
96
|
+
}), le = u((e, t) => {
|
|
97
|
+
(!e.url || !i(e.url)) && (t.preventDefault(), e.url || e._handleClick());
|
|
98
|
+
}, []), ue = f(() => ({
|
|
99
|
+
pdf: G,
|
|
100
|
+
numPages: K,
|
|
101
|
+
zoom: D,
|
|
102
|
+
setZoom: O,
|
|
103
|
+
rotation: k,
|
|
104
|
+
setRotation: A,
|
|
105
|
+
currentPage: J,
|
|
106
|
+
goToPage: Y,
|
|
107
|
+
containerRef: z,
|
|
108
|
+
canvasRefs: V,
|
|
109
|
+
file: b,
|
|
110
|
+
highlight: j,
|
|
111
|
+
setHighlight: M,
|
|
112
|
+
searchMatches: N,
|
|
113
|
+
setSearchMatches: P,
|
|
114
|
+
onChangeFile: w,
|
|
115
|
+
sidebarCollapsed: F,
|
|
116
|
+
setSidebarCollapsed: I,
|
|
117
|
+
fitMode: L,
|
|
118
|
+
setFitMode: R
|
|
119
|
+
}), [
|
|
120
|
+
G,
|
|
121
|
+
K,
|
|
122
|
+
D,
|
|
123
|
+
k,
|
|
124
|
+
J,
|
|
125
|
+
Y,
|
|
126
|
+
b,
|
|
127
|
+
j,
|
|
128
|
+
N,
|
|
129
|
+
w,
|
|
130
|
+
F,
|
|
131
|
+
L
|
|
132
|
+
]);
|
|
133
|
+
return /* @__PURE__ */ _(c, {
|
|
134
|
+
themeOverrides: ne,
|
|
135
|
+
defaultTheme: re,
|
|
136
|
+
children: /* @__PURE__ */ _(e.Provider, {
|
|
137
|
+
value: ue,
|
|
138
|
+
children: /* @__PURE__ */ v("div", {
|
|
139
|
+
className: `${l.appLayout}${E ? ` ${E}` : ""}`,
|
|
140
|
+
style: ie,
|
|
141
|
+
children: [C && /* @__PURE__ */ _("div", {
|
|
142
|
+
className: l.toolbar,
|
|
143
|
+
children: C
|
|
144
|
+
}), /* @__PURE__ */ v("div", {
|
|
145
|
+
className: l.body,
|
|
146
|
+
children: [S, /* @__PURE__ */ _("div", {
|
|
147
|
+
className: l.scrollContainer,
|
|
148
|
+
ref: z,
|
|
149
|
+
children: Array.from({ length: K }, (e, t) => {
|
|
150
|
+
let n = Z.has(t + 1), r = ae[t], a = Q.includes(t + 1);
|
|
151
|
+
return /* @__PURE__ */ v("div", {
|
|
152
|
+
className: l.pageWrapper,
|
|
153
|
+
ref: (e) => {
|
|
154
|
+
B.current[t] = e;
|
|
155
|
+
},
|
|
156
|
+
style: r ? {
|
|
157
|
+
width: r.width,
|
|
158
|
+
height: r.height
|
|
159
|
+
} : void 0,
|
|
160
|
+
children: [
|
|
161
|
+
r && !n && /* @__PURE__ */ _("div", {
|
|
162
|
+
className: l.pageSkeleton,
|
|
163
|
+
style: {
|
|
164
|
+
width: r.width,
|
|
165
|
+
height: r.height
|
|
166
|
+
}
|
|
167
|
+
}),
|
|
168
|
+
a && /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("canvas", {
|
|
169
|
+
className: l.pageCanvas,
|
|
170
|
+
ref: (e) => {
|
|
171
|
+
V.current[t] = e;
|
|
172
|
+
},
|
|
173
|
+
style: { display: n ? "block" : "none" }
|
|
174
|
+
}), /* @__PURE__ */ _("div", {
|
|
175
|
+
className: `textLayer ${l.textLayer}`,
|
|
176
|
+
ref: (e) => {
|
|
177
|
+
oe.current[t] = e;
|
|
178
|
+
}
|
|
179
|
+
})] }),
|
|
180
|
+
se.filter((e) => e.page === t + 1).map((e, t) => /* @__PURE__ */ _("a", {
|
|
181
|
+
className: l.linkOverlay,
|
|
182
|
+
href: e.url && i(e.url) ? e.url : "#",
|
|
183
|
+
target: "_blank",
|
|
184
|
+
rel: "noopener noreferrer",
|
|
185
|
+
style: {
|
|
186
|
+
left: e.x,
|
|
187
|
+
top: e.y,
|
|
188
|
+
width: e.width,
|
|
189
|
+
height: e.height
|
|
190
|
+
},
|
|
191
|
+
onClick: (t) => le(e, t)
|
|
192
|
+
}, t)),
|
|
193
|
+
ce.filter((e) => e.page === t + 1).map((e, t) => /* @__PURE__ */ _("div", {
|
|
194
|
+
className: l.searchMatchOverlay,
|
|
195
|
+
style: {
|
|
196
|
+
left: e.x,
|
|
197
|
+
top: e.y,
|
|
198
|
+
width: e.width,
|
|
199
|
+
height: e.height
|
|
200
|
+
}
|
|
201
|
+
}, t)),
|
|
202
|
+
j && $?.page === t + 1 && /* @__PURE__ */ _("div", {
|
|
203
|
+
className: l.highlightOverlay,
|
|
204
|
+
style: {
|
|
205
|
+
left: $.x,
|
|
206
|
+
top: $.y,
|
|
207
|
+
width: $.width,
|
|
208
|
+
height: $.height
|
|
209
|
+
}
|
|
210
|
+
})
|
|
211
|
+
]
|
|
212
|
+
}, `${t}-${k}`);
|
|
213
|
+
})
|
|
214
|
+
})]
|
|
215
|
+
})]
|
|
216
|
+
})
|
|
217
|
+
})
|
|
218
|
+
});
|
|
209
219
|
};
|
|
210
|
-
function ue(e, t) {
|
|
211
|
-
return e - t;
|
|
212
|
-
}
|
|
213
|
-
function de(e, t) {
|
|
214
|
-
return e - t;
|
|
215
|
-
}
|
|
216
|
-
function fe(e, t) {
|
|
217
|
-
return /* @__PURE__ */ l("a", {
|
|
218
|
-
className: a.linkOverlay,
|
|
219
|
-
href: e.url && i(e.url) ? e.url : "#",
|
|
220
|
-
target: "_blank",
|
|
221
|
-
rel: "noopener noreferrer",
|
|
222
|
-
style: {
|
|
223
|
-
left: e.x,
|
|
224
|
-
top: e.y,
|
|
225
|
-
width: e.width,
|
|
226
|
-
height: e.height
|
|
227
|
-
},
|
|
228
|
-
onClick: (t) => {
|
|
229
|
-
(!e.url || !i(e.url)) && (t.preventDefault(), e.url || e._handleClick());
|
|
230
|
-
}
|
|
231
|
-
}, t);
|
|
232
|
-
}
|
|
233
|
-
function pe(e, t) {
|
|
234
|
-
return /* @__PURE__ */ l("div", {
|
|
235
|
-
className: a.searchMatchOverlay,
|
|
236
|
-
style: {
|
|
237
|
-
left: e.x,
|
|
238
|
-
top: e.y,
|
|
239
|
-
width: e.width,
|
|
240
|
-
height: e.height
|
|
241
|
-
}
|
|
242
|
-
}, t);
|
|
243
|
-
}
|
|
244
220
|
//#endregion
|
|
245
|
-
export {
|
|
221
|
+
export { b as default };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
var e = {
|
|
2
|
-
appLayout: "
|
|
3
|
-
body: "
|
|
4
|
-
toolbar: "
|
|
5
|
-
scrollContainer: "
|
|
6
|
-
pageWrapper: "
|
|
7
|
-
pageCanvas: "
|
|
8
|
-
textLayer: "
|
|
9
|
-
markedContent: "
|
|
10
|
-
endOfContent: "
|
|
11
|
-
selecting: "
|
|
12
|
-
pageSkeleton: "
|
|
13
|
-
spin: "
|
|
14
|
-
highlightOverlay: "
|
|
15
|
-
linkOverlay: "
|
|
16
|
-
searchMatchOverlay: "
|
|
2
|
+
appLayout: "_appLayout_1nhg3_1",
|
|
3
|
+
body: "_body_1nhg3_9",
|
|
4
|
+
toolbar: "_toolbar_1nhg3_17",
|
|
5
|
+
scrollContainer: "_scrollContainer_1nhg3_29",
|
|
6
|
+
pageWrapper: "_pageWrapper_1nhg3_39",
|
|
7
|
+
pageCanvas: "_pageCanvas_1nhg3_44",
|
|
8
|
+
textLayer: "_textLayer_1nhg3_53",
|
|
9
|
+
markedContent: "_markedContent_1nhg3_79",
|
|
10
|
+
endOfContent: "_endOfContent_1nhg3_94",
|
|
11
|
+
selecting: "_selecting_1nhg3_103",
|
|
12
|
+
pageSkeleton: "_pageSkeleton_1nhg3_123",
|
|
13
|
+
spin: "_spin_1nhg3_1",
|
|
14
|
+
highlightOverlay: "_highlightOverlay_1nhg3_152",
|
|
15
|
+
linkOverlay: "_linkOverlay_1nhg3_161",
|
|
16
|
+
searchMatchOverlay: "_searchMatchOverlay_1nhg3_168"
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
19
19
|
export { e as default };
|