pdf-tsx 1.0.1 → 1.1.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/LICENSE +78 -78
- package/README.md +678 -634
- package/dist/cjs/components/PDFViewer.cjs +1 -1
- package/dist/cjs/components/PDFViewer.module.cjs +1 -1
- package/dist/cjs/components/features/PDFViewModeToggle.cjs +1 -0
- package/dist/cjs/components/features/PDFViewModeToggle.module.cjs +1 -0
- package/dist/cjs/favicon.svg +9 -0
- package/dist/cjs/hooks/usePDFLoader.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/labels.cjs +1 -1
- package/dist/cjs/pdf-tsx.css +1 -1
- package/dist/cjs/vendor/pdfjs-wasm/jbig2.cjs +1 -0
- package/dist/cjs/vendor/pdfjs-wasm/openjpeg.cjs +1 -0
- package/dist/cjs/vendor/pdfjs-wasm/qcms_bg.cjs +1 -0
- package/dist/components/PDFSidebar.d.ts +1 -1
- package/dist/components/PDFViewer.d.ts +2 -2
- package/dist/components/features/PDFAnnotations.d.ts +2 -2
- package/dist/components/features/PDFAttachments.d.ts +2 -2
- package/dist/components/features/PDFChangeFile.d.ts +1 -1
- package/dist/components/features/PDFDownloadButton.d.ts +1 -1
- package/dist/components/features/PDFNavigation.d.ts +1 -1
- package/dist/components/features/PDFOutline.d.ts +1 -1
- package/dist/components/features/PDFPageFit.d.ts +1 -1
- package/dist/components/features/PDFPrintButton.d.ts +1 -1
- package/dist/components/features/PDFRotationControl.d.ts +1 -1
- package/dist/components/features/PDFSearch.d.ts +1 -1
- package/dist/components/features/PDFSidebarToggle.d.ts +1 -1
- package/dist/components/features/PDFSignatures.d.ts +2 -2
- package/dist/components/features/PDFThemeToggle.d.ts +1 -1
- package/dist/components/features/PDFThumbnails.d.ts +1 -1
- package/dist/components/features/PDFViewModeToggle.d.ts +11 -0
- package/dist/components/features/PDFZoomControls.d.ts +1 -1
- package/dist/components/ui/PDFToolbar.d.ts +1 -1
- package/dist/components/ui/PDFToolbarItem.d.ts +1 -1
- package/dist/components/ui/PDFToolbarSeparator.d.ts +1 -1
- package/dist/components/ui/ToolbarButton.d.ts +1 -1
- package/dist/components/ui/icons.d.ts +3 -2
- package/dist/context/LabelsContext.d.ts +1 -1
- package/dist/context/PDFViewerContext.d.ts +2 -0
- package/dist/context/ThemeContext.d.ts +1 -1
- package/dist/es/components/PDFViewer.js +247 -224
- package/dist/es/components/PDFViewer.module.js +26 -23
- package/dist/es/components/features/PDFViewModeToggle.js +70 -0
- package/dist/es/components/features/PDFViewModeToggle.module.js +12 -0
- package/dist/es/favicon.svg +9 -0
- package/dist/es/hooks/usePDFLoader.js +36 -16
- package/dist/es/index.js +13 -12
- package/dist/es/labels.js +8 -0
- package/dist/es/pdf-tsx.css +1 -1
- package/dist/es/vendor/pdfjs-wasm/jbig2.js +4 -0
- package/dist/es/vendor/pdfjs-wasm/openjpeg.js +4 -0
- package/dist/es/vendor/pdfjs-wasm/qcms_bg.js +4 -0
- package/dist/hooks/usePDFLoader.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/labels.d.ts +4 -0
- package/package.json +66 -65
- package/dist/cjs/vite.svg +0 -1
- package/dist/components/features/PDFSignButton.d.ts +0 -10
- package/dist/components/features/SignaturePad.d.ts +0 -10
- package/dist/es/vite.svg +0 -1
- package/dist/pdf-tsx.cjs.js +0 -5
- package/dist/pdf-tsx.css +0 -2
- package/dist/pdf-tsx.es.js +0 -2637
- package/dist/src/components/PDFSidebar.d.ts +0 -11
- package/dist/src/components/PDFViewer.d.ts +0 -22
- package/dist/src/components/features/PDFAnnotations.d.ts +0 -5
- package/dist/src/components/features/PDFAttachments.d.ts +0 -5
- package/dist/src/components/features/PDFChangeFile.d.ts +0 -9
- package/dist/src/components/features/PDFDownloadButton.d.ts +0 -9
- package/dist/src/components/features/PDFNavigation.d.ts +0 -10
- package/dist/src/components/features/PDFOutline.d.ts +0 -1
- package/dist/src/components/features/PDFPageFit.d.ts +0 -10
- package/dist/src/components/features/PDFPrintButton.d.ts +0 -9
- package/dist/src/components/features/PDFRotationControl.d.ts +0 -9
- package/dist/src/components/features/PDFSearch.d.ts +0 -13
- package/dist/src/components/features/PDFSidebarToggle.d.ts +0 -10
- package/dist/src/components/features/PDFSignatures.d.ts +0 -5
- package/dist/src/components/features/PDFThemeToggle.d.ts +0 -10
- package/dist/src/components/features/PDFThumbnails.d.ts +0 -1
- package/dist/src/components/features/PDFZoomControls.d.ts +0 -10
- package/dist/src/components/ui/PDFToolbar.d.ts +0 -8
- package/dist/src/components/ui/PDFToolbarDropdownContext.d.ts +0 -1
- package/dist/src/components/ui/PDFToolbarItem.d.ts +0 -7
- package/dist/src/components/ui/PDFToolbarSeparator.d.ts +0 -4
- package/dist/src/components/ui/ToolbarButton.d.ts +0 -6
- package/dist/src/components/ui/icons.d.ts +0 -7
- package/dist/src/context/LabelsContext.d.ts +0 -7
- package/dist/src/context/PDFViewerContext.d.ts +0 -30
- package/dist/src/context/ThemeContext.d.ts +0 -12
- package/dist/src/context/labelsContextValue.d.ts +0 -2
- package/dist/src/context/themeContextValue.d.ts +0 -7
- package/dist/src/hooks/useAnnotationLayer.d.ts +0 -34
- package/dist/src/hooks/useAnnotations.d.ts +0 -15
- package/dist/src/hooks/useAttachments.d.ts +0 -11
- package/dist/src/hooks/useKeyboardShortcuts.d.ts +0 -9
- package/dist/src/hooks/useLabels.d.ts +0 -2
- package/dist/src/hooks/useOutline.d.ts +0 -14
- package/dist/src/hooks/useOverlayRects.d.ts +0 -21
- package/dist/src/hooks/usePDFLoader.d.ts +0 -5
- package/dist/src/hooks/usePDFRenderer.d.ts +0 -16
- package/dist/src/hooks/useScrollTracking.d.ts +0 -10
- package/dist/src/hooks/useSignatures.d.ts +0 -17
- package/dist/src/hooks/useTextLayer.d.ts +0 -10
- package/dist/src/hooks/useTextSearch.d.ts +0 -12
- package/dist/src/hooks/useTheme.d.ts +0 -2
- package/dist/src/hooks/useThumbnails.d.ts +0 -10
- package/dist/src/index.d.ts +0 -24
- package/dist/src/labels.d.ts +0 -53
- package/dist/src/theme.d.ts +0 -27
- package/dist/src/utils/pdfFit.d.ts +0 -2
- package/dist/src/utils/url.d.ts +0 -1
- package/dist/utils/addSignatureToPdf.d.ts +0 -9
- package/dist/vite.svg +0 -1
- package/dist/wasm/LICENSE_JBIG2 +0 -196
- package/dist/wasm/LICENSE_OPENJPEG +0 -39
- package/dist/wasm/LICENSE_PDFJS_JBIG2 +0 -13
- package/dist/wasm/LICENSE_PDFJS_OPENJPEG +0 -22
- package/dist/wasm/LICENSE_PDFJS_QCMS +0 -22
- package/dist/wasm/LICENSE_QCMS +0 -21
- package/dist/wasm/jbig2.wasm +0 -0
- package/dist/wasm/jbig2_nowasm_fallback.js +0 -15
- package/dist/wasm/openjpeg.wasm +0 -0
- package/dist/wasm/openjpeg_nowasm_fallback.js +0 -17
- package/dist/wasm/qcms_bg.wasm +0 -0
- package/dist/wasm/quickjs-eval.js +0 -16
- package/dist/wasm/quickjs-eval.wasm +0 -0
- /package/dist/{src/hooks → hooks}/usePinchZoom.d.ts +0 -0
- /package/dist/{src/utils → utils}/pdfjsPolyfill.d.ts +0 -0
- /package/dist/{src/utils → utils}/zoom.d.ts +0 -0
|
@@ -3,266 +3,289 @@ 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 { usePinchZoom as
|
|
11
|
-
import { PDFJS_POLYFILL as
|
|
12
|
-
import { computeFit as
|
|
13
|
-
import { ThemeProvider as
|
|
14
|
-
import { LabelsProvider as
|
|
15
|
-
import { useLabels as
|
|
16
|
-
import
|
|
17
|
-
import { useCallback as
|
|
18
|
-
import * as
|
|
19
|
-
import { Fragment as
|
|
6
|
+
import { useAnnotationLayer as ee } from "../hooks/useAnnotationLayer.js";
|
|
7
|
+
import { usePDFLoader as te } from "../hooks/usePDFLoader.js";
|
|
8
|
+
import { usePDFRenderer as ne } from "../hooks/usePDFRenderer.js";
|
|
9
|
+
import { useOverlayRects as re } from "../hooks/useOverlayRects.js";
|
|
10
|
+
import { usePinchZoom as ie } from "../hooks/usePinchZoom.js";
|
|
11
|
+
import { PDFJS_POLYFILL as ae, applyPdfjsPolyfill as a } from "../utils/pdfjsPolyfill.js";
|
|
12
|
+
import { computeFit as oe } from "../utils/pdfFit.js";
|
|
13
|
+
import { ThemeProvider as se } from "../context/ThemeContext.js";
|
|
14
|
+
import { LabelsProvider as ce } from "../context/LabelsContext.js";
|
|
15
|
+
import { useLabels as o } from "../hooks/useLabels.js";
|
|
16
|
+
import s from "./PDFViewer.module.js";
|
|
17
|
+
import { useCallback as c, useEffect as l, useMemo as u, useRef as d, useState as f } from "react";
|
|
18
|
+
import * as le from "pdfjs-dist";
|
|
19
|
+
import { Fragment as ue, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
20
20
|
//#region src/components/PDFViewer.tsx
|
|
21
|
-
|
|
22
|
-
var
|
|
23
|
-
function
|
|
24
|
-
let t =
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
className: `${
|
|
27
|
-
children: [e ? /* @__PURE__ */
|
|
21
|
+
a();
|
|
22
|
+
var h = 2;
|
|
23
|
+
function de({ hasRead: e }) {
|
|
24
|
+
let t = o();
|
|
25
|
+
return /* @__PURE__ */ m("div", {
|
|
26
|
+
className: `${s.requireReadBanner} ${e ? s.requireReadDone : ""}`,
|
|
27
|
+
children: [e ? /* @__PURE__ */ p("svg", {
|
|
28
28
|
width: "16",
|
|
29
29
|
height: "16",
|
|
30
30
|
viewBox: "0 0 16 16",
|
|
31
31
|
fill: "none",
|
|
32
32
|
"aria-hidden": "true",
|
|
33
|
-
children: /* @__PURE__ */
|
|
33
|
+
children: /* @__PURE__ */ p("path", {
|
|
34
34
|
d: "M3 8l3.5 3.5L13 4.5",
|
|
35
35
|
stroke: "currentColor",
|
|
36
36
|
strokeWidth: "2",
|
|
37
37
|
strokeLinecap: "round",
|
|
38
38
|
strokeLinejoin: "round"
|
|
39
39
|
})
|
|
40
|
-
}) : /* @__PURE__ */
|
|
40
|
+
}) : /* @__PURE__ */ p("svg", {
|
|
41
41
|
width: "16",
|
|
42
42
|
height: "16",
|
|
43
43
|
viewBox: "0 0 16 16",
|
|
44
44
|
fill: "none",
|
|
45
45
|
"aria-hidden": "true",
|
|
46
|
-
children: /* @__PURE__ */
|
|
46
|
+
children: /* @__PURE__ */ p("path", {
|
|
47
47
|
d: "M8 3v10M4 9l4 4 4-4",
|
|
48
48
|
stroke: "currentColor",
|
|
49
49
|
strokeWidth: "2",
|
|
50
50
|
strokeLinecap: "round",
|
|
51
51
|
strokeLinejoin: "round"
|
|
52
52
|
})
|
|
53
|
-
}), /* @__PURE__ */
|
|
53
|
+
}), /* @__PURE__ */ p("span", { children: e ? t.requireReadDone : t.requireReadPending })]
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
let e = new URL(
|
|
59
|
-
return
|
|
60
|
-
}, [c]);
|
|
61
|
-
let [T, E] = m(1), [D, me] = m(0), [O, k] = m(null), [A, he] = m([]), [j, ge] = m(!1), [M, N] = m(x ?? null), [P, F] = m(null), [I, L] = m(!1), R = p(!1), z = p(null), B = p([]), V = p([]), H = p(D);
|
|
62
|
-
d(() => {
|
|
63
|
-
H.current = D;
|
|
64
|
-
}, [D]);
|
|
65
|
-
let [_e, ve] = m(null);
|
|
66
|
-
_e !== o && (ve(o), k(null), L(!1)), d(() => {
|
|
67
|
-
R.current = !1;
|
|
56
|
+
var g = ({ file: a, workerSrc: o, sidebar: g, toolbar: _, onChangeFile: v, themeOverrides: fe, defaultTheme: pe, defaultFit: y, defaultLayout: me, language: he, className: b, style: ge, requireRead: x, onDocumentRead: _e }) => {
|
|
57
|
+
l(() => {
|
|
58
|
+
let e = new URL(o, location.href).href, t = new Blob([`${ae}\nimport(${JSON.stringify(e)});`], { type: "application/javascript" }), n = URL.createObjectURL(t);
|
|
59
|
+
return le.GlobalWorkerOptions.workerSrc = n, () => URL.revokeObjectURL(n);
|
|
68
60
|
}, [o]);
|
|
69
|
-
let
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}, [
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
61
|
+
let [S, C] = f(1), [w, ve] = f(0), [T, E] = f(null), [D, ye] = f([]), [O, be] = f(!1), [k, A] = f(y ?? null), [j, xe] = f(me ?? "continuous"), [M, N] = f(null), [P, F] = f(!1), I = d(!1), L = d(null), R = d([]), z = d([]), B = d(w);
|
|
62
|
+
l(() => {
|
|
63
|
+
B.current = w;
|
|
64
|
+
}, [w]);
|
|
65
|
+
let [Se, Ce] = f(null);
|
|
66
|
+
Se !== a && (Ce(a), E(null), F(!1)), l(() => {
|
|
67
|
+
I.current = !1;
|
|
68
|
+
}, [a]);
|
|
69
|
+
let { pdf: V, numPages: H, loading: we } = te(a);
|
|
70
|
+
l(() => {
|
|
71
|
+
V && (R.current = Array(V.numPages).fill(null), z.current = Array(V.numPages).fill(null));
|
|
72
|
+
}, [V]), l(() => {
|
|
73
|
+
!V || !y || !L.current || oe(y, V, L.current, B.current).then(C);
|
|
74
|
+
}, [V, y]);
|
|
75
|
+
let U = d(k);
|
|
76
|
+
l(() => {
|
|
77
|
+
U.current = k;
|
|
78
|
+
}, [k]), l(() => {
|
|
79
|
+
if (!V || !L.current) return;
|
|
80
|
+
let e = L.current, t = new ResizeObserver(() => {
|
|
81
|
+
U.current && oe(U.current, V, e, B.current).then(C);
|
|
82
82
|
});
|
|
83
83
|
return t.observe(e), () => t.disconnect();
|
|
84
|
-
}, [
|
|
85
|
-
let { currentPage:
|
|
86
|
-
numPages:
|
|
87
|
-
containerRef:
|
|
88
|
-
pageRefs:
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
|
|
84
|
+
}, [V]);
|
|
85
|
+
let { currentPage: W, goToPage: G } = t({
|
|
86
|
+
numPages: H,
|
|
87
|
+
containerRef: L,
|
|
88
|
+
pageRefs: R
|
|
89
|
+
}), [K, Te] = f([]);
|
|
90
|
+
l(() => {
|
|
91
|
+
let e = L.current;
|
|
92
|
+
if (!e || H === 0) return;
|
|
93
|
+
let t = /* @__PURE__ */ new Set(), n = new IntersectionObserver((e) => {
|
|
94
|
+
let n = !1;
|
|
95
|
+
for (let r of e) {
|
|
96
|
+
let e = R.current.indexOf(r.target);
|
|
97
|
+
if (e === -1) continue;
|
|
98
|
+
let i = e + 1;
|
|
99
|
+
r.isIntersecting ? t.has(i) || (t.add(i), n = !0) : t.delete(i) && (n = !0);
|
|
100
|
+
}
|
|
101
|
+
n && Te(Array.from(t).sort((e, t) => e - t));
|
|
102
|
+
}, {
|
|
103
|
+
root: e,
|
|
104
|
+
rootMargin: "300px 0px",
|
|
105
|
+
threshold: 0
|
|
106
|
+
});
|
|
107
|
+
return R.current.forEach((e) => e && n.observe(e)), () => n.disconnect();
|
|
108
|
+
}, [H, j]), l(() => {
|
|
109
|
+
H === 0 || W < H || (x && !P && F(!0), I.current || (I.current = !0, _e?.()));
|
|
92
110
|
}, [
|
|
93
|
-
K,
|
|
94
111
|
W,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
112
|
+
H,
|
|
113
|
+
x,
|
|
114
|
+
P,
|
|
115
|
+
_e
|
|
98
116
|
]);
|
|
99
|
-
let
|
|
100
|
-
if (
|
|
101
|
-
let e = /* @__PURE__ */ new Set(), t = Math.max(
|
|
117
|
+
let q = u(() => {
|
|
118
|
+
if (H === 0) return [];
|
|
119
|
+
let e = /* @__PURE__ */ new Set(), t = Math.max(W - h, 1), n = Math.min(W + h, H);
|
|
102
120
|
for (let r = t; r <= n; r++) e.add(r);
|
|
103
|
-
|
|
104
|
-
|
|
121
|
+
for (let t of K) e.add(t);
|
|
122
|
+
T && e.add(T.page);
|
|
123
|
+
for (let t of D) e.add(t.page);
|
|
105
124
|
return Array.from(e).sort((e, t) => e - t);
|
|
106
125
|
}, [
|
|
107
|
-
K,
|
|
108
126
|
W,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
127
|
+
H,
|
|
128
|
+
T,
|
|
129
|
+
D,
|
|
130
|
+
K
|
|
131
|
+
]), { pageSizes: Ee, renderedPages: J } = ne({
|
|
132
|
+
pdf: V,
|
|
133
|
+
zoom: S,
|
|
134
|
+
rotation: w,
|
|
135
|
+
visiblePages: q,
|
|
136
|
+
canvasRefs: z
|
|
137
|
+
}), Y = u(() => {
|
|
138
|
+
let e = new Set(q);
|
|
139
|
+
for (let t of J) e.add(t);
|
|
120
140
|
return Array.from(e).sort((e, t) => e - t);
|
|
121
|
-
}, [
|
|
141
|
+
}, [q, J]);
|
|
122
142
|
n({
|
|
123
|
-
pdf:
|
|
124
|
-
currentPage:
|
|
125
|
-
goToPage:
|
|
126
|
-
setRotation:
|
|
127
|
-
}),
|
|
128
|
-
let
|
|
129
|
-
pdf:
|
|
130
|
-
zoom:
|
|
131
|
-
rotation:
|
|
132
|
-
mountedPages:
|
|
133
|
-
canvasRefs:
|
|
134
|
-
}), { linkOverlays:
|
|
135
|
-
pdf:
|
|
136
|
-
zoom:
|
|
137
|
-
rotation:
|
|
138
|
-
mountedPages:
|
|
139
|
-
goToPage:
|
|
143
|
+
pdf: V,
|
|
144
|
+
currentPage: W,
|
|
145
|
+
goToPage: G,
|
|
146
|
+
setRotation: ve
|
|
147
|
+
}), ie(L, S, C, A);
|
|
148
|
+
let De = r({
|
|
149
|
+
pdf: V,
|
|
150
|
+
zoom: S,
|
|
151
|
+
rotation: w,
|
|
152
|
+
mountedPages: Y,
|
|
153
|
+
canvasRefs: z
|
|
154
|
+
}), { linkOverlays: Oe, noteOverlays: ke } = ee({
|
|
155
|
+
pdf: V,
|
|
156
|
+
zoom: S,
|
|
157
|
+
rotation: w,
|
|
158
|
+
mountedPages: Y,
|
|
159
|
+
goToPage: G
|
|
140
160
|
});
|
|
141
|
-
|
|
142
|
-
if (!
|
|
143
|
-
let e = () =>
|
|
144
|
-
e.key === "Escape" &&
|
|
161
|
+
l(() => {
|
|
162
|
+
if (!M) return;
|
|
163
|
+
let e = () => N(null), t = (e) => {
|
|
164
|
+
e.key === "Escape" && N(null);
|
|
145
165
|
};
|
|
146
166
|
return document.addEventListener("click", e), document.addEventListener("keydown", t), () => {
|
|
147
167
|
document.removeEventListener("click", e), document.removeEventListener("keydown", t);
|
|
148
168
|
};
|
|
149
|
-
}, [
|
|
150
|
-
let { overlayRect:
|
|
151
|
-
pdf:
|
|
152
|
-
highlight:
|
|
153
|
-
searchMatches:
|
|
154
|
-
zoom:
|
|
155
|
-
rotation:
|
|
156
|
-
}),
|
|
169
|
+
}, [M]);
|
|
170
|
+
let { overlayRect: X, searchOverlays: Ae } = re({
|
|
171
|
+
pdf: V,
|
|
172
|
+
highlight: T,
|
|
173
|
+
searchMatches: D,
|
|
174
|
+
zoom: S,
|
|
175
|
+
rotation: w
|
|
176
|
+
}), je = c((e, t) => {
|
|
157
177
|
(!e.url || !i(e.url)) && (t.preventDefault(), e.url || e._handleClick());
|
|
158
|
-
}, []),
|
|
159
|
-
|
|
178
|
+
}, []), Z = d(null), Me = c((e, t) => {
|
|
179
|
+
Z.current && clearTimeout(Z.current);
|
|
160
180
|
let n = t.clientY > window.innerHeight * .6;
|
|
161
|
-
|
|
181
|
+
N({
|
|
162
182
|
x: Math.min(t.clientX, window.innerWidth - 304),
|
|
163
183
|
y: n ? window.innerHeight - t.clientY + 8 : t.clientY + 12,
|
|
164
184
|
above: n,
|
|
165
185
|
contents: e.contents,
|
|
166
186
|
title: e.title
|
|
167
187
|
});
|
|
168
|
-
}, []),
|
|
169
|
-
|
|
170
|
-
}, []),
|
|
171
|
-
|
|
188
|
+
}, []), Q = c(() => {
|
|
189
|
+
Z.current = setTimeout(() => N(null), 200);
|
|
190
|
+
}, []), $ = c((e) => {
|
|
191
|
+
E({
|
|
172
192
|
page: e.page,
|
|
173
193
|
pdfRect: e.pdfRect
|
|
174
|
-
}),
|
|
175
|
-
}, [
|
|
176
|
-
pdf:
|
|
177
|
-
numPages:
|
|
178
|
-
zoom:
|
|
179
|
-
setZoom:
|
|
180
|
-
rotation:
|
|
181
|
-
setRotation:
|
|
182
|
-
currentPage:
|
|
183
|
-
goToPage:
|
|
184
|
-
containerRef:
|
|
185
|
-
canvasRefs:
|
|
186
|
-
file:
|
|
187
|
-
highlight:
|
|
188
|
-
setHighlight:
|
|
189
|
-
searchMatches:
|
|
190
|
-
setSearchMatches:
|
|
191
|
-
onChangeFile:
|
|
192
|
-
sidebarCollapsed:
|
|
193
|
-
setSidebarCollapsed:
|
|
194
|
-
fitMode:
|
|
195
|
-
setFitMode:
|
|
196
|
-
|
|
194
|
+
}), G(e.page);
|
|
195
|
+
}, [E, G]), Ne = u(() => ({
|
|
196
|
+
pdf: V,
|
|
197
|
+
numPages: H,
|
|
198
|
+
zoom: S,
|
|
199
|
+
setZoom: C,
|
|
200
|
+
rotation: w,
|
|
201
|
+
setRotation: ve,
|
|
202
|
+
currentPage: W,
|
|
203
|
+
goToPage: G,
|
|
204
|
+
containerRef: L,
|
|
205
|
+
canvasRefs: z,
|
|
206
|
+
file: a,
|
|
207
|
+
highlight: T,
|
|
208
|
+
setHighlight: E,
|
|
209
|
+
searchMatches: D,
|
|
210
|
+
setSearchMatches: ye,
|
|
211
|
+
onChangeFile: v,
|
|
212
|
+
sidebarCollapsed: O,
|
|
213
|
+
setSidebarCollapsed: be,
|
|
214
|
+
fitMode: k,
|
|
215
|
+
setFitMode: A,
|
|
216
|
+
pageLayout: j,
|
|
217
|
+
setPageLayout: xe,
|
|
218
|
+
navigationLocked: !!x && !P
|
|
197
219
|
}), [
|
|
198
|
-
|
|
220
|
+
V,
|
|
221
|
+
H,
|
|
222
|
+
S,
|
|
223
|
+
w,
|
|
199
224
|
W,
|
|
225
|
+
G,
|
|
226
|
+
a,
|
|
200
227
|
T,
|
|
201
228
|
D,
|
|
202
|
-
|
|
203
|
-
q,
|
|
204
|
-
o,
|
|
229
|
+
v,
|
|
205
230
|
O,
|
|
206
|
-
|
|
207
|
-
b,
|
|
231
|
+
k,
|
|
208
232
|
j,
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
I
|
|
233
|
+
x,
|
|
234
|
+
P
|
|
212
235
|
]);
|
|
213
|
-
return /* @__PURE__ */
|
|
214
|
-
themeOverrides:
|
|
215
|
-
defaultTheme:
|
|
216
|
-
children: /* @__PURE__ */
|
|
217
|
-
language:
|
|
218
|
-
children: /* @__PURE__ */
|
|
219
|
-
value:
|
|
220
|
-
children: [/* @__PURE__ */
|
|
221
|
-
className: `${
|
|
222
|
-
style:
|
|
223
|
-
children: [
|
|
224
|
-
className:
|
|
225
|
-
children:
|
|
226
|
-
}), /* @__PURE__ */
|
|
227
|
-
className:
|
|
228
|
-
children: [
|
|
229
|
-
className:
|
|
230
|
-
ref:
|
|
236
|
+
return /* @__PURE__ */ p(se, {
|
|
237
|
+
themeOverrides: fe,
|
|
238
|
+
defaultTheme: pe,
|
|
239
|
+
children: /* @__PURE__ */ p(ce, {
|
|
240
|
+
language: he,
|
|
241
|
+
children: /* @__PURE__ */ m(e.Provider, {
|
|
242
|
+
value: Ne,
|
|
243
|
+
children: [/* @__PURE__ */ m("div", {
|
|
244
|
+
className: `${s.appLayout}${b ? ` ${b}` : ""}`,
|
|
245
|
+
style: ge,
|
|
246
|
+
children: [_ && /* @__PURE__ */ p("div", {
|
|
247
|
+
className: s.toolbar,
|
|
248
|
+
children: _
|
|
249
|
+
}), /* @__PURE__ */ m("div", {
|
|
250
|
+
className: s.body,
|
|
251
|
+
children: [g, /* @__PURE__ */ m("div", {
|
|
252
|
+
className: `${s.scrollContainer} ${j === "single" ? s.single : j === "spread" ? s.spread : ""}`,
|
|
253
|
+
ref: L,
|
|
231
254
|
children: [
|
|
232
|
-
|
|
233
|
-
Array.from({ length:
|
|
234
|
-
let n =
|
|
235
|
-
return /* @__PURE__ */
|
|
236
|
-
className:
|
|
255
|
+
we && /* @__PURE__ */ p("div", { className: s.documentLoading }),
|
|
256
|
+
Array.from({ length: H }, (e, t) => {
|
|
257
|
+
let n = J.has(t + 1), r = Ee[t], ee = Y.includes(t + 1);
|
|
258
|
+
return /* @__PURE__ */ m("div", {
|
|
259
|
+
className: `${s.pageWrapper}${t + 1 === W ? ` ${s.currentPage}` : ""}`,
|
|
237
260
|
ref: (e) => {
|
|
238
|
-
|
|
261
|
+
R.current[t] = e;
|
|
239
262
|
},
|
|
240
263
|
style: r ? {
|
|
241
264
|
width: r.width,
|
|
242
265
|
height: r.height
|
|
243
266
|
} : void 0,
|
|
244
267
|
children: [
|
|
245
|
-
r && !n && /* @__PURE__ */
|
|
246
|
-
className:
|
|
268
|
+
r && !n && /* @__PURE__ */ p("div", {
|
|
269
|
+
className: s.pageSkeleton,
|
|
247
270
|
style: {
|
|
248
271
|
width: r.width,
|
|
249
272
|
height: r.height
|
|
250
273
|
}
|
|
251
274
|
}),
|
|
252
|
-
|
|
253
|
-
className:
|
|
275
|
+
ee && /* @__PURE__ */ m(ue, { children: [/* @__PURE__ */ p("canvas", {
|
|
276
|
+
className: s.pageCanvas,
|
|
254
277
|
ref: (e) => {
|
|
255
|
-
|
|
278
|
+
z.current[t] = e;
|
|
256
279
|
},
|
|
257
280
|
style: { display: n ? "block" : "none" }
|
|
258
|
-
}), /* @__PURE__ */
|
|
259
|
-
className: `textLayer ${
|
|
281
|
+
}), /* @__PURE__ */ p("div", {
|
|
282
|
+
className: `textLayer ${s.textLayer}`,
|
|
260
283
|
ref: (e) => {
|
|
261
|
-
|
|
284
|
+
De.current[t] = e;
|
|
262
285
|
}
|
|
263
286
|
})] }),
|
|
264
|
-
|
|
265
|
-
className:
|
|
287
|
+
Oe.filter((e) => e.page === t + 1).map((e, t) => /* @__PURE__ */ p("a", {
|
|
288
|
+
className: s.linkOverlay,
|
|
266
289
|
href: e.url && i(e.url) ? e.url : "#",
|
|
267
290
|
target: "_blank",
|
|
268
291
|
rel: "noopener noreferrer",
|
|
@@ -272,27 +295,27 @@ var v = ({ file: o, workerSrc: c, sidebar: v, toolbar: y, onChangeFile: b, theme
|
|
|
272
295
|
width: e.width,
|
|
273
296
|
height: e.height
|
|
274
297
|
},
|
|
275
|
-
onClick: (t) =>
|
|
298
|
+
onClick: (t) => je(e, t)
|
|
276
299
|
}, t)),
|
|
277
|
-
|
|
278
|
-
className:
|
|
300
|
+
ke.filter((e) => e.page === t + 1).map((e, t) => e.subtype === "Text" ? /* @__PURE__ */ p("div", {
|
|
301
|
+
className: s.noteIconOverlay,
|
|
279
302
|
style: {
|
|
280
303
|
left: e.x,
|
|
281
304
|
top: e.y,
|
|
282
305
|
width: Math.max(e.width, 26),
|
|
283
306
|
height: Math.max(e.height, 26)
|
|
284
307
|
},
|
|
285
|
-
onMouseEnter: (t) =>
|
|
286
|
-
onMouseLeave:
|
|
287
|
-
onClick: () =>
|
|
288
|
-
children: /* @__PURE__ */
|
|
308
|
+
onMouseEnter: (t) => Me(e, t),
|
|
309
|
+
onMouseLeave: Q,
|
|
310
|
+
onClick: () => $(e),
|
|
311
|
+
children: /* @__PURE__ */ m("svg", {
|
|
289
312
|
width: "22",
|
|
290
313
|
height: "22",
|
|
291
314
|
viewBox: "0 0 12 12",
|
|
292
315
|
fill: "none",
|
|
293
316
|
"aria-hidden": "true",
|
|
294
317
|
children: [
|
|
295
|
-
/* @__PURE__ */
|
|
318
|
+
/* @__PURE__ */ p("rect", {
|
|
296
319
|
x: "0.5",
|
|
297
320
|
y: "0.5",
|
|
298
321
|
width: "9",
|
|
@@ -302,13 +325,13 @@ var v = ({ file: o, workerSrc: c, sidebar: v, toolbar: y, onChangeFile: b, theme
|
|
|
302
325
|
stroke: "rgba(160,120,0,0.7)",
|
|
303
326
|
strokeWidth: "1"
|
|
304
327
|
}),
|
|
305
|
-
/* @__PURE__ */
|
|
328
|
+
/* @__PURE__ */ p("path", {
|
|
306
329
|
d: "M9.5 5.5v3l2.5-3z",
|
|
307
330
|
fill: "rgba(255,210,0,0.9)",
|
|
308
331
|
stroke: "rgba(160,120,0,0.7)",
|
|
309
332
|
strokeWidth: "1"
|
|
310
333
|
}),
|
|
311
|
-
/* @__PURE__ */
|
|
334
|
+
/* @__PURE__ */ p("line", {
|
|
312
335
|
x1: "2",
|
|
313
336
|
y1: "3",
|
|
314
337
|
x2: "8",
|
|
@@ -317,7 +340,7 @@ var v = ({ file: o, workerSrc: c, sidebar: v, toolbar: y, onChangeFile: b, theme
|
|
|
317
340
|
strokeWidth: "1",
|
|
318
341
|
strokeLinecap: "round"
|
|
319
342
|
}),
|
|
320
|
-
/* @__PURE__ */
|
|
343
|
+
/* @__PURE__ */ p("line", {
|
|
321
344
|
x1: "2",
|
|
322
345
|
y1: "5.5",
|
|
323
346
|
x2: "7",
|
|
@@ -328,20 +351,20 @@ var v = ({ file: o, workerSrc: c, sidebar: v, toolbar: y, onChangeFile: b, theme
|
|
|
328
351
|
})
|
|
329
352
|
]
|
|
330
353
|
})
|
|
331
|
-
}, t) : /* @__PURE__ */
|
|
332
|
-
className:
|
|
354
|
+
}, t) : /* @__PURE__ */ p("div", {
|
|
355
|
+
className: s.noteOverlay,
|
|
333
356
|
style: {
|
|
334
357
|
left: e.x,
|
|
335
358
|
top: e.y,
|
|
336
359
|
width: e.width,
|
|
337
360
|
height: e.height
|
|
338
361
|
},
|
|
339
|
-
onMouseEnter: (t) =>
|
|
340
|
-
onMouseLeave:
|
|
341
|
-
onClick: () =>
|
|
362
|
+
onMouseEnter: (t) => Me(e, t),
|
|
363
|
+
onMouseLeave: Q,
|
|
364
|
+
onClick: () => $(e)
|
|
342
365
|
}, t)),
|
|
343
|
-
|
|
344
|
-
className:
|
|
366
|
+
Ae.filter((e) => e.page === t + 1).map((e, t) => /* @__PURE__ */ p("div", {
|
|
367
|
+
className: s.searchMatchOverlay,
|
|
345
368
|
style: {
|
|
346
369
|
left: e.x,
|
|
347
370
|
top: e.y,
|
|
@@ -349,42 +372,42 @@ var v = ({ file: o, workerSrc: c, sidebar: v, toolbar: y, onChangeFile: b, theme
|
|
|
349
372
|
height: e.height
|
|
350
373
|
}
|
|
351
374
|
}, t)),
|
|
352
|
-
|
|
353
|
-
className:
|
|
375
|
+
T && X?.page === t + 1 && /* @__PURE__ */ p("div", {
|
|
376
|
+
className: s.highlightOverlay,
|
|
354
377
|
style: {
|
|
355
|
-
left:
|
|
356
|
-
top:
|
|
357
|
-
width:
|
|
358
|
-
height:
|
|
378
|
+
left: X.x,
|
|
379
|
+
top: X.y,
|
|
380
|
+
width: X.width,
|
|
381
|
+
height: X.height
|
|
359
382
|
}
|
|
360
383
|
})
|
|
361
384
|
]
|
|
362
|
-
}, `${t}-${
|
|
385
|
+
}, `${t}-${w}`);
|
|
363
386
|
}),
|
|
364
|
-
|
|
387
|
+
x && /* @__PURE__ */ p(de, { hasRead: P })
|
|
365
388
|
]
|
|
366
389
|
})]
|
|
367
390
|
})]
|
|
368
|
-
}),
|
|
369
|
-
className:
|
|
370
|
-
style:
|
|
371
|
-
left:
|
|
372
|
-
bottom:
|
|
391
|
+
}), M && /* @__PURE__ */ m("div", {
|
|
392
|
+
className: s.notePopover,
|
|
393
|
+
style: M.above ? {
|
|
394
|
+
left: M.x,
|
|
395
|
+
bottom: M.y
|
|
373
396
|
} : {
|
|
374
|
-
left:
|
|
375
|
-
top:
|
|
397
|
+
left: M.x,
|
|
398
|
+
top: M.y
|
|
376
399
|
},
|
|
377
400
|
onMouseEnter: () => {
|
|
378
|
-
|
|
401
|
+
Z.current && clearTimeout(Z.current);
|
|
379
402
|
},
|
|
380
|
-
onMouseLeave:
|
|
403
|
+
onMouseLeave: Q,
|
|
381
404
|
onClick: (e) => e.stopPropagation(),
|
|
382
|
-
children: [
|
|
383
|
-
className:
|
|
384
|
-
children:
|
|
385
|
-
}), /* @__PURE__ */
|
|
386
|
-
className:
|
|
387
|
-
children:
|
|
405
|
+
children: [M.title && /* @__PURE__ */ p("div", {
|
|
406
|
+
className: s.notePopoverTitle,
|
|
407
|
+
children: M.title
|
|
408
|
+
}), /* @__PURE__ */ p("p", {
|
|
409
|
+
className: s.notePopoverContent,
|
|
410
|
+
children: M.contents
|
|
388
411
|
})]
|
|
389
412
|
})]
|
|
390
413
|
})
|
|
@@ -392,4 +415,4 @@ var v = ({ file: o, workerSrc: c, sidebar: v, toolbar: y, onChangeFile: b, theme
|
|
|
392
415
|
});
|
|
393
416
|
};
|
|
394
417
|
//#endregion
|
|
395
|
-
export {
|
|
418
|
+
export { g as default };
|