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