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