pdf-tsx 0.9.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/PDFToolbar.module.cjs +1 -1
- 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/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 +213 -253
- 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 +53 -83
- package/dist/es/components/ui/PDFToolbar.module.js +9 -9
- package/dist/es/components/ui/PDFToolbarItem.js +10 -19
- 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 -43
- 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
|
@@ -2,42 +2,40 @@ import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
|
|
|
2
2
|
import { computeFit as t } from "../../utils/pdfFit.js";
|
|
3
3
|
import { useSignatures as n } from "../../hooks/useSignatures.js";
|
|
4
4
|
import r from "./PDFSignatures.module.js";
|
|
5
|
-
import {
|
|
6
|
-
import { jsx as
|
|
5
|
+
import { memo as i, useCallback as a } from "react";
|
|
6
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
7
|
//#region src/components/features/PDFSignatures.tsx
|
|
8
|
-
function
|
|
8
|
+
function c(e) {
|
|
9
9
|
if (!e) return;
|
|
10
10
|
let t = e.match(/D:(\d{4})(\d{2})(\d{2})(\d{2})?(\d{2})?(\d{2})?/);
|
|
11
11
|
if (!t) return e;
|
|
12
12
|
let [, n, r, i, a = "00", o = "00"] = t;
|
|
13
13
|
return `${i}/${r}/${n} ${a}:${o}`;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
return e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ a("svg", {
|
|
15
|
+
function l() {
|
|
16
|
+
return /* @__PURE__ */ o("svg", {
|
|
18
17
|
width: "10",
|
|
19
18
|
height: "10",
|
|
20
19
|
viewBox: "0 0 10 10",
|
|
21
20
|
fill: "none",
|
|
22
21
|
"aria-hidden": !0,
|
|
23
|
-
children: /* @__PURE__ */
|
|
22
|
+
children: /* @__PURE__ */ o("path", {
|
|
24
23
|
d: "M1.5 5L3.8 7.5L8.5 2.5",
|
|
25
24
|
stroke: "currentColor",
|
|
26
25
|
strokeWidth: "1.6",
|
|
27
26
|
strokeLinecap: "round",
|
|
28
27
|
strokeLinejoin: "round"
|
|
29
28
|
})
|
|
30
|
-
})
|
|
29
|
+
});
|
|
31
30
|
}
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
return e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ a("svg", {
|
|
31
|
+
function u() {
|
|
32
|
+
return /* @__PURE__ */ o("svg", {
|
|
35
33
|
width: "10",
|
|
36
34
|
height: "10",
|
|
37
35
|
viewBox: "0 0 10 10",
|
|
38
36
|
fill: "none",
|
|
39
37
|
"aria-hidden": !0,
|
|
40
|
-
children: /* @__PURE__ */
|
|
38
|
+
children: /* @__PURE__ */ o("circle", {
|
|
41
39
|
cx: "5",
|
|
42
40
|
cy: "5",
|
|
43
41
|
r: "3.7",
|
|
@@ -45,138 +43,117 @@ function l() {
|
|
|
45
43
|
strokeWidth: "1.3",
|
|
46
44
|
strokeDasharray: "2.2 1.4"
|
|
47
45
|
})
|
|
48
|
-
})
|
|
46
|
+
});
|
|
49
47
|
}
|
|
50
|
-
function
|
|
51
|
-
let
|
|
52
|
-
t[0] === n.fieldName ? p = t[1] : (p = /* @__PURE__ */ a("span", {
|
|
53
|
-
className: r.fieldName,
|
|
54
|
-
children: n.fieldName
|
|
55
|
-
}), t[0] = n.fieldName, t[1] = p);
|
|
56
|
-
let m = `${r.statusChip} ${n.signed ? r.statusChipSigned : ""}`, h;
|
|
57
|
-
t[2] === n.signed ? h = t[3] : (h = n.signed ? /* @__PURE__ */ a(c, {}) : /* @__PURE__ */ a(l, {}), t[2] = n.signed, t[3] = h);
|
|
58
|
-
let g = n.signed ? "Firmato" : "Non firmato", _;
|
|
59
|
-
t[4] !== m || t[5] !== h || t[6] !== g ? (_ = /* @__PURE__ */ o("span", {
|
|
60
|
-
className: m,
|
|
61
|
-
children: [h, g]
|
|
62
|
-
}), t[4] = m, t[5] = h, t[6] = g, t[7] = _) : _ = t[7];
|
|
63
|
-
let v;
|
|
64
|
-
t[8] !== p || t[9] !== _ ? (v = /* @__PURE__ */ o("div", {
|
|
65
|
-
className: r.cardHeader,
|
|
66
|
-
children: [p, _]
|
|
67
|
-
}), t[8] = p, t[9] = _, t[10] = v) : v = t[10];
|
|
68
|
-
let y;
|
|
69
|
-
t[11] !== n.location || t[12] !== n.reason || t[13] !== n.signDate || t[14] !== n.signerName ? (y = (n.signerName || n.signDate || n.reason || n.location) && /* @__PURE__ */ o("div", {
|
|
70
|
-
className: r.fieldList,
|
|
71
|
-
children: [
|
|
72
|
-
n.signerName && /* @__PURE__ */ o("div", {
|
|
73
|
-
className: r.fieldRow,
|
|
74
|
-
children: [/* @__PURE__ */ a("span", {
|
|
75
|
-
className: r.fieldLabel,
|
|
76
|
-
children: "Firmatario"
|
|
77
|
-
}), /* @__PURE__ */ a("span", {
|
|
78
|
-
className: r.fieldValue,
|
|
79
|
-
children: n.signerName
|
|
80
|
-
})]
|
|
81
|
-
}),
|
|
82
|
-
n.signDate && /* @__PURE__ */ o("div", {
|
|
83
|
-
className: r.fieldRow,
|
|
84
|
-
children: [/* @__PURE__ */ a("span", {
|
|
85
|
-
className: r.fieldLabel,
|
|
86
|
-
children: "Data"
|
|
87
|
-
}), /* @__PURE__ */ a("span", {
|
|
88
|
-
className: r.fieldValue,
|
|
89
|
-
children: s(n.signDate)
|
|
90
|
-
})]
|
|
91
|
-
}),
|
|
92
|
-
n.reason && /* @__PURE__ */ o("div", {
|
|
93
|
-
className: r.fieldRow,
|
|
94
|
-
children: [/* @__PURE__ */ a("span", {
|
|
95
|
-
className: r.fieldLabel,
|
|
96
|
-
children: "Motivo"
|
|
97
|
-
}), /* @__PURE__ */ a("span", {
|
|
98
|
-
className: r.fieldValue,
|
|
99
|
-
children: n.reason
|
|
100
|
-
})]
|
|
101
|
-
}),
|
|
102
|
-
n.location && /* @__PURE__ */ o("div", {
|
|
103
|
-
className: r.fieldRow,
|
|
104
|
-
children: [/* @__PURE__ */ a("span", {
|
|
105
|
-
className: r.fieldLabel,
|
|
106
|
-
children: "Luogo"
|
|
107
|
-
}), /* @__PURE__ */ a("span", {
|
|
108
|
-
className: r.fieldValue,
|
|
109
|
-
children: n.location
|
|
110
|
-
})]
|
|
111
|
-
})
|
|
112
|
-
]
|
|
113
|
-
}), t[11] = n.location, t[12] = n.reason, t[13] = n.signDate, t[14] = n.signerName, t[15] = y) : y = t[15];
|
|
114
|
-
let b;
|
|
115
|
-
t[16] !== v || t[17] !== y ? (b = /* @__PURE__ */ o("div", {
|
|
48
|
+
var d = i(function({ sig: e, onNavigate: t }) {
|
|
49
|
+
let n = !!e.rect, i = `${r.card} ${e.signed ? r.cardSigned : ""} ${n ? r.cardClickable : ""}`, d = a(() => t(e), [t, e]), f = /* @__PURE__ */ s("div", {
|
|
116
50
|
className: r.cardBody,
|
|
117
|
-
children: [
|
|
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
|
-
|
|
51
|
+
children: [/* @__PURE__ */ s("div", {
|
|
52
|
+
className: r.cardHeader,
|
|
53
|
+
children: [/* @__PURE__ */ o("span", {
|
|
54
|
+
className: r.fieldName,
|
|
55
|
+
children: e.fieldName
|
|
56
|
+
}), /* @__PURE__ */ s("span", {
|
|
57
|
+
className: `${r.statusChip} ${e.signed ? r.statusChipSigned : ""}`,
|
|
58
|
+
children: [e.signed ? /* @__PURE__ */ o(l, {}) : /* @__PURE__ */ o(u, {}), e.signed ? "Firmato" : "Non firmato"]
|
|
59
|
+
})]
|
|
60
|
+
}), (e.signerName || e.signDate || e.reason || e.location) && /* @__PURE__ */ s("div", {
|
|
61
|
+
className: r.fieldList,
|
|
62
|
+
children: [
|
|
63
|
+
e.signerName && /* @__PURE__ */ s("div", {
|
|
64
|
+
className: r.fieldRow,
|
|
65
|
+
children: [/* @__PURE__ */ o("span", {
|
|
66
|
+
className: r.fieldLabel,
|
|
67
|
+
children: "Firmatario"
|
|
68
|
+
}), /* @__PURE__ */ o("span", {
|
|
69
|
+
className: r.fieldValue,
|
|
70
|
+
children: e.signerName
|
|
71
|
+
})]
|
|
72
|
+
}),
|
|
73
|
+
e.signDate && /* @__PURE__ */ s("div", {
|
|
74
|
+
className: r.fieldRow,
|
|
75
|
+
children: [/* @__PURE__ */ o("span", {
|
|
76
|
+
className: r.fieldLabel,
|
|
77
|
+
children: "Data"
|
|
78
|
+
}), /* @__PURE__ */ o("span", {
|
|
79
|
+
className: r.fieldValue,
|
|
80
|
+
children: c(e.signDate)
|
|
81
|
+
})]
|
|
82
|
+
}),
|
|
83
|
+
e.reason && /* @__PURE__ */ s("div", {
|
|
84
|
+
className: r.fieldRow,
|
|
85
|
+
children: [/* @__PURE__ */ o("span", {
|
|
86
|
+
className: r.fieldLabel,
|
|
87
|
+
children: "Motivo"
|
|
88
|
+
}), /* @__PURE__ */ o("span", {
|
|
89
|
+
className: r.fieldValue,
|
|
90
|
+
children: e.reason
|
|
91
|
+
})]
|
|
92
|
+
}),
|
|
93
|
+
e.location && /* @__PURE__ */ s("div", {
|
|
94
|
+
className: r.fieldRow,
|
|
95
|
+
children: [/* @__PURE__ */ o("span", {
|
|
96
|
+
className: r.fieldLabel,
|
|
97
|
+
children: "Luogo"
|
|
98
|
+
}), /* @__PURE__ */ o("span", {
|
|
99
|
+
className: r.fieldValue,
|
|
100
|
+
children: e.location
|
|
101
|
+
})]
|
|
102
|
+
})
|
|
103
|
+
]
|
|
104
|
+
})]
|
|
105
|
+
});
|
|
106
|
+
return n ? /* @__PURE__ */ o("button", {
|
|
107
|
+
type: "button",
|
|
108
|
+
className: i,
|
|
109
|
+
onClick: d,
|
|
110
|
+
children: f
|
|
111
|
+
}) : /* @__PURE__ */ o("div", {
|
|
112
|
+
className: i,
|
|
113
|
+
children: f
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
function f({ icon: t }) {
|
|
117
|
+
let { pdf: i } = e(), { signatures: a, loading: c } = n({ pdf: i }), l = a.length;
|
|
118
|
+
return /* @__PURE__ */ s("span", {
|
|
145
119
|
className: r.iconWrapper,
|
|
146
|
-
children: [c,
|
|
147
|
-
|
|
120
|
+
children: [t, !c && l > 0 && /* @__PURE__ */ o("span", {
|
|
121
|
+
className: r.badge,
|
|
122
|
+
children: l > 99 ? "99+" : l
|
|
123
|
+
})]
|
|
124
|
+
});
|
|
148
125
|
}
|
|
149
|
-
function
|
|
150
|
-
let
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
children: "Nessuna firma rilevata."
|
|
166
|
-
}), s[16] = _, s[17] = g, s[18] = b) : b = s[18], x = !_ && g.map((t, n) => /* @__PURE__ */ a(u, {
|
|
167
|
-
sig: t,
|
|
168
|
-
onClick: () => e(t)
|
|
169
|
-
}, n)), s[2] = m, s[3] = l, s[4] = _, s[5] = c, s[6] = p, s[7] = d, s[8] = f, s[9] = g, s[10] = v, s[11] = y, s[12] = b, s[13] = x;
|
|
170
|
-
} else v = s[10], y = s[11], b = s[12], x = s[13];
|
|
171
|
-
let S;
|
|
172
|
-
return s[19] !== v || s[20] !== y || s[21] !== b || s[22] !== x ? (S = /* @__PURE__ */ o("div", {
|
|
173
|
-
className: v,
|
|
126
|
+
function p() {
|
|
127
|
+
let { pdf: i, goToPage: c, setHighlight: l, setZoom: u, rotation: f, containerRef: p } = e(), { signatures: m, loading: h } = n({ pdf: i }), g = a(async (e) => {
|
|
128
|
+
i && p.current && u(await t("page", i, p.current, f)), c(e.page), e.rect && l({
|
|
129
|
+
page: e.page,
|
|
130
|
+
pdfRect: e.rect
|
|
131
|
+
});
|
|
132
|
+
}, [
|
|
133
|
+
i,
|
|
134
|
+
p,
|
|
135
|
+
f,
|
|
136
|
+
c,
|
|
137
|
+
u,
|
|
138
|
+
l
|
|
139
|
+
]);
|
|
140
|
+
return /* @__PURE__ */ s("div", {
|
|
141
|
+
className: r.list,
|
|
174
142
|
children: [
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
143
|
+
h && /* @__PURE__ */ o("div", {
|
|
144
|
+
className: r.emptyState,
|
|
145
|
+
children: "Caricamento..."
|
|
146
|
+
}),
|
|
147
|
+
!h && m.length === 0 && /* @__PURE__ */ o("div", {
|
|
148
|
+
className: r.emptyState,
|
|
149
|
+
children: "Nessuna firma rilevata."
|
|
150
|
+
}),
|
|
151
|
+
!h && m.map((e, t) => /* @__PURE__ */ o(d, {
|
|
152
|
+
sig: e,
|
|
153
|
+
onNavigate: g
|
|
154
|
+
}, t))
|
|
178
155
|
]
|
|
179
|
-
})
|
|
156
|
+
});
|
|
180
157
|
}
|
|
181
158
|
//#endregion
|
|
182
|
-
export {
|
|
159
|
+
export { p as PDFSignatures, f as PDFSignaturesIcon };
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
var e = {
|
|
2
|
-
list: "
|
|
3
|
-
emptyState: "
|
|
4
|
-
card: "
|
|
5
|
-
cardSigned: "
|
|
6
|
-
cardClickable: "
|
|
7
|
-
cardBody: "
|
|
8
|
-
cardHeader: "
|
|
9
|
-
fieldName: "
|
|
10
|
-
statusChip: "
|
|
11
|
-
statusChipSigned: "
|
|
12
|
-
fieldList: "
|
|
13
|
-
fieldRow: "
|
|
14
|
-
fieldLabel: "
|
|
15
|
-
fieldValue: "
|
|
16
|
-
iconWrapper: "
|
|
17
|
-
badge: "
|
|
2
|
+
list: "_list_b0wj1_1",
|
|
3
|
+
emptyState: "_emptyState_b0wj1_8",
|
|
4
|
+
card: "_card_b0wj1_15",
|
|
5
|
+
cardSigned: "_cardSigned_b0wj1_32",
|
|
6
|
+
cardClickable: "_cardClickable_b0wj1_37",
|
|
7
|
+
cardBody: "_cardBody_b0wj1_50",
|
|
8
|
+
cardHeader: "_cardHeader_b0wj1_54",
|
|
9
|
+
fieldName: "_fieldName_b0wj1_62",
|
|
10
|
+
statusChip: "_statusChip_b0wj1_73",
|
|
11
|
+
statusChipSigned: "_statusChipSigned_b0wj1_89",
|
|
12
|
+
fieldList: "_fieldList_b0wj1_95",
|
|
13
|
+
fieldRow: "_fieldRow_b0wj1_101",
|
|
14
|
+
fieldLabel: "_fieldLabel_b0wj1_109",
|
|
15
|
+
fieldValue: "_fieldValue_b0wj1_114",
|
|
16
|
+
iconWrapper: "_iconWrapper_b0wj1_119",
|
|
17
|
+
badge: "_badge_b0wj1_126"
|
|
18
18
|
};
|
|
19
19
|
//#endregion
|
|
20
20
|
export { e as default };
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { ToolbarButton as e } from "../ui/ToolbarButton.js";
|
|
2
2
|
import { useTheme as t } from "../../hooks/useTheme.js";
|
|
3
|
-
import { c as n } from "react/compiler-runtime";
|
|
4
3
|
import "react";
|
|
5
|
-
import { jsx as
|
|
4
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
6
5
|
//#region src/components/features/PDFThemeToggle.tsx
|
|
7
|
-
function
|
|
8
|
-
let
|
|
9
|
-
return
|
|
10
|
-
onClick:
|
|
11
|
-
title:
|
|
12
|
-
children:
|
|
13
|
-
})
|
|
6
|
+
function r({ lightIcon: r, darkIcon: i }) {
|
|
7
|
+
let { isDark: a, toggleTheme: o } = t();
|
|
8
|
+
return /* @__PURE__ */ n(e, {
|
|
9
|
+
onClick: o,
|
|
10
|
+
title: a ? "Switch to light mode" : "Switch to dark mode",
|
|
11
|
+
children: a ? r : i
|
|
12
|
+
});
|
|
14
13
|
}
|
|
15
|
-
|
|
14
|
+
r.toolbarLabel = "Tema";
|
|
16
15
|
//#endregion
|
|
17
|
-
export {
|
|
16
|
+
export { r as PDFThemeToggle };
|
|
@@ -1,63 +1,54 @@
|
|
|
1
1
|
import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
|
|
2
2
|
import { useThumbnails as t } from "../../hooks/useThumbnails.js";
|
|
3
3
|
import n from "./PDFThumbnails.module.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
4
|
+
import { useEffect as r, useRef as i, useState as a } from "react";
|
|
5
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
6
|
//#region src/components/features/PDFThumbnails.tsx
|
|
8
|
-
var
|
|
9
|
-
function
|
|
7
|
+
var c = 3;
|
|
8
|
+
function l(e, t, n) {
|
|
10
9
|
let r = new Set(t);
|
|
11
10
|
for (let t of e) {
|
|
12
11
|
if (!t.isIntersecting) continue;
|
|
13
12
|
let e = Number(t.target.dataset.page);
|
|
14
|
-
for (let t = Math.max(1, e -
|
|
13
|
+
for (let t = Math.max(1, e - c); t <= Math.min(n, e + c); t++) r.add(t);
|
|
15
14
|
}
|
|
16
15
|
let i = Array.from(r).sort((e, t) => e - t);
|
|
17
16
|
return i.join(",") === t.join(",") ? t : i;
|
|
18
17
|
}
|
|
19
|
-
function
|
|
20
|
-
let
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}, l[2] = d, l[3] = f, l[4] = y, l[5] = x) : x = l[5];
|
|
30
|
-
let { thumbnails: S } = t(x), C, w;
|
|
31
|
-
l[6] === h ? (C = l[7], w = l[8]) : (C = () => {
|
|
32
|
-
if (h === 0) return;
|
|
33
|
-
let e = new IntersectionObserver((e) => b((t) => u(e, t, h)), { threshold: 0 });
|
|
34
|
-
return _.current.forEach((t) => {
|
|
18
|
+
function u() {
|
|
19
|
+
let { pdf: c, rotation: u, currentPage: d, goToPage: f, numPages: p } = e(), m = i([]), [h, g] = a([]), { thumbnails: _ } = t({
|
|
20
|
+
pdf: c,
|
|
21
|
+
rotation: u,
|
|
22
|
+
visiblePages: h
|
|
23
|
+
});
|
|
24
|
+
return r(() => {
|
|
25
|
+
if (p === 0) return;
|
|
26
|
+
let e = new IntersectionObserver((e) => g((t) => l(e, t, p)), { threshold: 0 });
|
|
27
|
+
return m.current.forEach((t) => {
|
|
35
28
|
t && e.observe(t);
|
|
36
29
|
}), () => e.disconnect();
|
|
37
|
-
},
|
|
38
|
-
let T;
|
|
39
|
-
return l[9] !== p || l[10] !== m || l[11] !== h || l[12] !== S ? (T = /* @__PURE__ */ s("div", {
|
|
30
|
+
}, [p]), /* @__PURE__ */ o("div", {
|
|
40
31
|
className: n.thumbnailList,
|
|
41
|
-
children: Array.from({ length:
|
|
42
|
-
let r = t + 1, i =
|
|
43
|
-
return /* @__PURE__ */
|
|
32
|
+
children: Array.from({ length: p }, (e, t) => {
|
|
33
|
+
let r = t + 1, i = _[t], a = d === r;
|
|
34
|
+
return /* @__PURE__ */ s("div", {
|
|
44
35
|
className: `${n.thumbnailItem} ${a ? n.thumbnailItemActive : ""}`,
|
|
45
|
-
onClick: () =>
|
|
36
|
+
onClick: () => f(r),
|
|
46
37
|
ref: (e) => {
|
|
47
|
-
|
|
38
|
+
m.current[t] = e;
|
|
48
39
|
},
|
|
49
40
|
"data-page": r,
|
|
50
|
-
children: [i ? /* @__PURE__ */
|
|
41
|
+
children: [i ? /* @__PURE__ */ o("img", {
|
|
51
42
|
src: i,
|
|
52
43
|
className: `${n.thumbnailImg} ${a ? n.thumbnailImgActive : ""}`,
|
|
53
44
|
alt: `Anteprima pagina ${r}`
|
|
54
|
-
}) : /* @__PURE__ */
|
|
45
|
+
}) : /* @__PURE__ */ o("div", { className: n.thumbnailSkeleton }), /* @__PURE__ */ o("div", {
|
|
55
46
|
className: `${n.thumbnailLabel} ${a ? n.thumbnailLabelActive : ""}`,
|
|
56
47
|
children: r
|
|
57
48
|
})]
|
|
58
49
|
}, t);
|
|
59
50
|
})
|
|
60
|
-
})
|
|
51
|
+
});
|
|
61
52
|
}
|
|
62
53
|
//#endregion
|
|
63
|
-
export {
|
|
54
|
+
export { u as PDFThumbnails };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var e = {
|
|
2
|
-
thumbnailList: "
|
|
3
|
-
thumbnailItem: "
|
|
4
|
-
thumbnailItemActive: "
|
|
5
|
-
thumbnailImg: "
|
|
6
|
-
thumbnailImgActive: "
|
|
7
|
-
thumbnailSkeleton: "
|
|
8
|
-
shimmer: "
|
|
9
|
-
thumbnailLabel: "
|
|
10
|
-
thumbnailLabelActive: "
|
|
2
|
+
thumbnailList: "_thumbnailList_t3mg8_1",
|
|
3
|
+
thumbnailItem: "_thumbnailItem_t3mg8_6",
|
|
4
|
+
thumbnailItemActive: "_thumbnailItemActive_t3mg8_19",
|
|
5
|
+
thumbnailImg: "_thumbnailImg_t3mg8_28",
|
|
6
|
+
thumbnailImgActive: "_thumbnailImgActive_t3mg8_34",
|
|
7
|
+
thumbnailSkeleton: "_thumbnailSkeleton_t3mg8_40",
|
|
8
|
+
shimmer: "_shimmer_t3mg8_1",
|
|
9
|
+
thumbnailLabel: "_thumbnailLabel_t3mg8_63",
|
|
10
|
+
thumbnailLabelActive: "_thumbnailLabelActive_t3mg8_70"
|
|
11
11
|
};
|
|
12
12
|
//#endregion
|
|
13
13
|
export { e as default };
|
|
@@ -1,44 +1,29 @@
|
|
|
1
1
|
import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
|
|
2
2
|
import { ToolbarButton as t } from "../ui/ToolbarButton.js";
|
|
3
3
|
import n from "./PDFZoomControls.module.js";
|
|
4
|
-
import {
|
|
5
|
-
import "react";
|
|
4
|
+
import { useCallback as r } from "react";
|
|
6
5
|
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
6
|
//#region src/components/features/PDFZoomControls.tsx
|
|
8
|
-
function s(s) {
|
|
9
|
-
let
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
let b;
|
|
29
|
-
c[12] === h ? b = c[13] : (b = () => h(.2), c[12] = h, c[13] = b);
|
|
30
|
-
let x;
|
|
31
|
-
c[14] !== b || c[15] !== u ? (x = /* @__PURE__ */ a(t, {
|
|
32
|
-
onClick: b,
|
|
33
|
-
title: "Aumenta zoom",
|
|
34
|
-
children: u
|
|
35
|
-
}), c[14] = b, c[15] = u, c[16] = x) : x = c[16];
|
|
36
|
-
let S;
|
|
37
|
-
return c[17] !== _ || c[18] !== y || c[19] !== x ? (S = /* @__PURE__ */ o(i, { children: [
|
|
38
|
-
_,
|
|
39
|
-
y,
|
|
40
|
-
x
|
|
41
|
-
] }), c[17] = _, c[18] = y, c[19] = x, c[20] = S) : S = c[20], S;
|
|
7
|
+
function s({ zoomOutIcon: s, zoomInIcon: c }) {
|
|
8
|
+
let { zoom: l, setZoom: u, setFitMode: d } = e(), f = r((e) => {
|
|
9
|
+
d(null), u((t) => Math.min(Math.max(t + e, .2), 3));
|
|
10
|
+
}, [d, u]), p = r(() => f(-.2), [f]), m = r(() => f(.2), [f]);
|
|
11
|
+
return /* @__PURE__ */ o(i, { children: [
|
|
12
|
+
/* @__PURE__ */ a(t, {
|
|
13
|
+
onClick: p,
|
|
14
|
+
title: "Riduci zoom",
|
|
15
|
+
children: s
|
|
16
|
+
}),
|
|
17
|
+
/* @__PURE__ */ o("span", {
|
|
18
|
+
className: n.zoomLabel,
|
|
19
|
+
children: [Math.round(l * 100), "%"]
|
|
20
|
+
}),
|
|
21
|
+
/* @__PURE__ */ a(t, {
|
|
22
|
+
onClick: m,
|
|
23
|
+
title: "Aumenta zoom",
|
|
24
|
+
children: c
|
|
25
|
+
})
|
|
26
|
+
] });
|
|
42
27
|
}
|
|
43
28
|
s.toolbarLabel = "Zoom";
|
|
44
29
|
//#endregion
|