pdf-tsx 0.1.6 → 0.3.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/LICENSE +21 -21
- package/README.md +296 -212
- 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/PDFNavigation.module.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/PDFSearch.module.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/PDFThumbnails.module.cjs +1 -1
- package/dist/cjs/components/features/PDFZoomControls.module.cjs +1 -1
- package/dist/cjs/components/ui/ToolbarButton.module.cjs +1 -1
- package/dist/cjs/context/ThemeContext.cjs +1 -1
- package/dist/cjs/hooks/useTextLayer.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/pdf-tsx.css +1 -1
- package/dist/cjs/utils/pdfFit.cjs +1 -0
- package/dist/components/PDFViewer.d.ts +7 -0
- package/dist/components/features/PDFAnnotations.d.ts +4 -0
- package/dist/components/features/PDFSignatures.d.ts +4 -0
- package/dist/context/ThemeContext.d.ts +8 -2
- package/dist/es/components/PDFSidebar.module.js +7 -7
- package/dist/es/components/PDFViewer.js +188 -175
- package/dist/es/components/PDFViewer.module.js +15 -12
- package/dist/es/components/features/PDFAnnotations.js +16 -2
- package/dist/es/components/features/PDFAnnotations.module.js +12 -10
- package/dist/es/components/features/PDFNavigation.module.js +3 -3
- package/dist/es/components/features/PDFOutline.module.js +5 -5
- package/dist/es/components/features/PDFPageFit.js +24 -34
- package/dist/es/components/features/PDFPrintButton.js +2 -2
- package/dist/es/components/features/PDFSearch.module.js +4 -4
- package/dist/es/components/features/PDFSignatures.js +20 -12
- package/dist/es/components/features/PDFSignatures.module.js +16 -14
- package/dist/es/components/features/PDFThumbnails.module.js +7 -7
- package/dist/es/components/features/PDFZoomControls.module.js +1 -1
- package/dist/es/components/ui/ToolbarButton.module.js +2 -2
- package/dist/es/context/ThemeContext.js +31 -24
- package/dist/es/hooks/useTextLayer.js +0 -1
- package/dist/es/index.js +17 -16
- package/dist/es/pdf-tsx.css +1 -1
- package/dist/es/utils/pdfFit.js +13 -0
- package/dist/index.d.ts +4 -2
- package/dist/utils/pdfFit.d.ts +2 -0
- package/package.json +61 -61
- 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/vite.svg +0 -1
|
@@ -1,43 +1,33 @@
|
|
|
1
1
|
import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
|
|
2
|
-
import {
|
|
2
|
+
import { computeFit as t } from "../../utils/pdfFit.js";
|
|
3
|
+
import { ToolbarButton as n } from "../ui/ToolbarButton.js";
|
|
3
4
|
import "react";
|
|
4
|
-
import { c as
|
|
5
|
-
import { Fragment as
|
|
5
|
+
import { c as r } from "react/compiler-runtime";
|
|
6
|
+
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
7
|
//#region src/components/features/PDFPageFit.tsx
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
m((h.current.clientWidth - o) / e.width);
|
|
17
|
-
}, l[0] = h, l[1] = f, l[2] = p, l[3] = m, l[4] = g) : g = l[4];
|
|
18
|
-
let _ = g, v;
|
|
19
|
-
l[5] !== h || l[6] !== f || l[7] !== p || l[8] !== m ? (v = async () => {
|
|
20
|
-
if (!f || !h.current) return;
|
|
21
|
-
let e = (await f.getPage(1)).getViewport({
|
|
22
|
-
scale: 1,
|
|
23
|
-
rotation: p
|
|
24
|
-
}), t = h.current.clientWidth - o, n = h.current.clientHeight - s * 2;
|
|
25
|
-
m(Math.min(t / e.width, n / e.height));
|
|
26
|
-
}, l[5] = h, l[6] = f, l[7] = p, l[8] = m, l[9] = v) : v = l[9];
|
|
27
|
-
let y = v, b;
|
|
28
|
-
l[10] !== u || l[11] !== _ ? (b = /* @__PURE__ */ i(t, {
|
|
8
|
+
function s(s) {
|
|
9
|
+
let c = r(18), { fitWidthIcon: l, fitPageIcon: u } = s, { pdf: d, rotation: f, setZoom: p, containerRef: m } = e(), h;
|
|
10
|
+
c[0] !== m || c[1] !== d || c[2] !== f || c[3] !== p ? (h = async (e) => {
|
|
11
|
+
!d || !m.current || p(await t(e, d, m.current, f));
|
|
12
|
+
}, c[0] = m, c[1] = d, c[2] = f, c[3] = p, c[4] = h) : h = c[4];
|
|
13
|
+
let g = h, _;
|
|
14
|
+
c[5] === g ? _ = c[6] : (_ = () => g("width"), c[5] = g, c[6] = _);
|
|
15
|
+
let v;
|
|
16
|
+
c[7] !== l || c[8] !== _ ? (v = /* @__PURE__ */ a(n, {
|
|
29
17
|
onClick: _,
|
|
30
18
|
title: "Adatta alla larghezza",
|
|
31
|
-
children:
|
|
32
|
-
}),
|
|
33
|
-
let
|
|
34
|
-
|
|
19
|
+
children: l
|
|
20
|
+
}), c[7] = l, c[8] = _, c[9] = v) : v = c[9];
|
|
21
|
+
let y;
|
|
22
|
+
c[10] === g ? y = c[11] : (y = () => g("page"), c[10] = g, c[11] = y);
|
|
23
|
+
let b;
|
|
24
|
+
c[12] !== u || c[13] !== y ? (b = /* @__PURE__ */ a(n, {
|
|
35
25
|
onClick: y,
|
|
36
26
|
title: "Adatta pagina intera",
|
|
37
|
-
children:
|
|
38
|
-
}),
|
|
39
|
-
let
|
|
40
|
-
return
|
|
27
|
+
children: u
|
|
28
|
+
}), c[12] = u, c[13] = y, c[14] = b) : b = c[14];
|
|
29
|
+
let x;
|
|
30
|
+
return c[15] !== v || c[16] !== b ? (x = /* @__PURE__ */ o(i, { children: [v, b] }), c[15] = v, c[16] = b, c[17] = x) : x = c[17], x;
|
|
41
31
|
}
|
|
42
32
|
//#endregion
|
|
43
|
-
export {
|
|
33
|
+
export { s as PDFPageFit };
|
|
@@ -9,9 +9,9 @@ function i(i) {
|
|
|
9
9
|
a[0] === s ? c = a[1] : (c = () => {
|
|
10
10
|
let e = URL.createObjectURL(s), t = document.createElement("iframe");
|
|
11
11
|
t.style.display = "none", t.src = e, document.body.appendChild(t), t.onload = () => {
|
|
12
|
-
t.contentWindow?.
|
|
12
|
+
t.contentWindow?.addEventListener("afterprint", () => {
|
|
13
13
|
document.body.removeChild(t), URL.revokeObjectURL(e);
|
|
14
|
-
},
|
|
14
|
+
}, { once: !0 }), t.contentWindow?.print();
|
|
15
15
|
};
|
|
16
16
|
}, a[0] = s, a[1] = c);
|
|
17
17
|
let l = c, u;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var e = {
|
|
2
|
-
wrapper: "
|
|
3
|
-
searchInput: "
|
|
4
|
-
navButton: "
|
|
5
|
-
counter: "
|
|
2
|
+
wrapper: "_wrapper_yinyt_1",
|
|
3
|
+
searchInput: "_searchInput_yinyt_13",
|
|
4
|
+
navButton: "_navButton_yinyt_53",
|
|
5
|
+
counter: "_counter_yinyt_95"
|
|
6
6
|
};
|
|
7
7
|
//#endregion
|
|
8
8
|
export { e as default };
|
|
@@ -87,8 +87,22 @@ function s(e) {
|
|
|
87
87
|
children: [g, C]
|
|
88
88
|
}), t[26] = c, t[27] = l, t[28] = C, t[29] = g, t[30] = w) : w = t[30], w;
|
|
89
89
|
}
|
|
90
|
-
function c() {
|
|
91
|
-
let
|
|
90
|
+
function c(o) {
|
|
91
|
+
let s = r(8), { icon: c } = o, { pdf: l } = e(), u;
|
|
92
|
+
s[0] === l ? u = s[1] : (u = { pdf: l }, s[0] = l, s[1] = u);
|
|
93
|
+
let { signatures: d, loading: f } = t(u), p = d.length, m;
|
|
94
|
+
s[2] !== p || s[3] !== f ? (m = !f && p > 0 && /* @__PURE__ */ i("span", {
|
|
95
|
+
className: n.badge,
|
|
96
|
+
children: p > 99 ? "99+" : p
|
|
97
|
+
}), s[2] = p, s[3] = f, s[4] = m) : m = s[4];
|
|
98
|
+
let h;
|
|
99
|
+
return s[5] !== c || s[6] !== m ? (h = /* @__PURE__ */ a("span", {
|
|
100
|
+
className: n.iconWrapper,
|
|
101
|
+
children: [c, m]
|
|
102
|
+
}), s[5] = c, s[6] = m, s[7] = h) : h = s[7], h;
|
|
103
|
+
}
|
|
104
|
+
function l() {
|
|
105
|
+
let o = r(18), { pdf: c, goToPage: l, setHighlight: u } = e(), d;
|
|
92
106
|
o[0] === c ? d = o[1] : (d = { pdf: c }, o[0] = c, o[1] = d);
|
|
93
107
|
let { signatures: f, loading: p } = t(d), m;
|
|
94
108
|
o[2] !== l || o[3] !== u ? (m = (e) => {
|
|
@@ -113,20 +127,14 @@ function c() {
|
|
|
113
127
|
onClick: () => h(e)
|
|
114
128
|
}, t)), o[10] = h, o[11] = p, o[12] = f, o[13] = v) : v = o[13];
|
|
115
129
|
let y;
|
|
116
|
-
o[14] !==
|
|
117
|
-
className: n.disclaimer,
|
|
118
|
-
children: "La presenza del campo firma non garantisce la validità crittografica."
|
|
119
|
-
}), o[14] = p, o[15] = f, o[16] = y) : y = o[16];
|
|
120
|
-
let b;
|
|
121
|
-
return o[17] !== g || o[18] !== _ || o[19] !== v || o[20] !== y ? (b = /* @__PURE__ */ a("div", {
|
|
130
|
+
return o[14] !== g || o[15] !== _ || o[16] !== v ? (y = /* @__PURE__ */ a("div", {
|
|
122
131
|
className: n.list,
|
|
123
132
|
children: [
|
|
124
133
|
g,
|
|
125
134
|
_,
|
|
126
|
-
v
|
|
127
|
-
y
|
|
135
|
+
v
|
|
128
136
|
]
|
|
129
|
-
}), o[
|
|
137
|
+
}), o[14] = g, o[15] = _, o[16] = v, o[17] = y) : y = o[17], y;
|
|
130
138
|
}
|
|
131
139
|
//#endregion
|
|
132
|
-
export {
|
|
140
|
+
export { l as PDFSignatures, c as PDFSignaturesIcon };
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
var e = {
|
|
2
|
-
list: "
|
|
3
|
-
emptyState: "
|
|
4
|
-
card: "
|
|
5
|
-
cardClickable: "
|
|
6
|
-
cardSigned: "
|
|
7
|
-
cardHeader: "
|
|
8
|
-
statusDot: "
|
|
9
|
-
statusDotSigned: "
|
|
10
|
-
statusLabel: "
|
|
11
|
-
statusLabelSigned: "
|
|
12
|
-
fieldList: "
|
|
13
|
-
fieldRow: "
|
|
14
|
-
fieldLabel: "
|
|
15
|
-
disclaimer: "
|
|
2
|
+
list: "_list_11831_1",
|
|
3
|
+
emptyState: "_emptyState_11831_11",
|
|
4
|
+
card: "_card_11831_23",
|
|
5
|
+
cardClickable: "_cardClickable_11831_45",
|
|
6
|
+
cardSigned: "_cardSigned_11831_61",
|
|
7
|
+
cardHeader: "_cardHeader_11831_71",
|
|
8
|
+
statusDot: "_statusDot_11831_85",
|
|
9
|
+
statusDotSigned: "_statusDotSigned_11831_113",
|
|
10
|
+
statusLabel: "_statusLabel_11831_121",
|
|
11
|
+
statusLabelSigned: "_statusLabelSigned_11831_137",
|
|
12
|
+
fieldList: "_fieldList_11831_145",
|
|
13
|
+
fieldRow: "_fieldRow_11831_157",
|
|
14
|
+
fieldLabel: "_fieldLabel_11831_167",
|
|
15
|
+
disclaimer: "_disclaimer_11831_175",
|
|
16
|
+
iconWrapper: "_iconWrapper_11831_197",
|
|
17
|
+
badge: "_badge_11831_211"
|
|
16
18
|
};
|
|
17
19
|
//#endregion
|
|
18
20
|
export { e as default };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
var e = {
|
|
2
|
-
thumbnailList: "
|
|
3
|
-
thumbnailItem: "
|
|
4
|
-
thumbnailItemActive: "
|
|
5
|
-
thumbnailImg: "
|
|
6
|
-
thumbnailImgActive: "
|
|
7
|
-
thumbnailLabel: "
|
|
8
|
-
thumbnailLabelActive: "
|
|
2
|
+
thumbnailList: "_thumbnailList_116om_1",
|
|
3
|
+
thumbnailItem: "_thumbnailItem_116om_11",
|
|
4
|
+
thumbnailItemActive: "_thumbnailItemActive_116om_37",
|
|
5
|
+
thumbnailImg: "_thumbnailImg_116om_55",
|
|
6
|
+
thumbnailImgActive: "_thumbnailImgActive_116om_67",
|
|
7
|
+
thumbnailLabel: "_thumbnailLabel_116om_75",
|
|
8
|
+
thumbnailLabelActive: "_thumbnailLabelActive_116om_89"
|
|
9
9
|
};
|
|
10
10
|
//#endregion
|
|
11
11
|
export { e as default };
|
|
@@ -5,31 +5,38 @@ import { jsx as s } from "react/jsx-runtime";
|
|
|
5
5
|
//#region src/context/ThemeContext.tsx
|
|
6
6
|
var c = r(null);
|
|
7
7
|
function l(r) {
|
|
8
|
-
let i = o(
|
|
9
|
-
i[0]
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
let
|
|
19
|
-
i[6]
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
8
|
+
let i = o(17), { children: l, themeOverrides: d, defaultTheme: f } = r, [p, m] = a((f === void 0 ? "light" : f) === "dark"), h, g;
|
|
9
|
+
i[0] !== p || i[1] !== d?.dark || i[2] !== d?.light ? (g = p ? {
|
|
10
|
+
...e,
|
|
11
|
+
...d?.dark
|
|
12
|
+
} : {
|
|
13
|
+
...t,
|
|
14
|
+
...d?.light
|
|
15
|
+
}, h = n(g), i[0] = p, i[1] = d?.dark, i[2] = d?.light, i[3] = h, i[4] = g) : (h = i[3], g = i[4]);
|
|
16
|
+
let _ = h, v;
|
|
17
|
+
i[5] === Symbol.for("react.memo_cache_sentinel") ? (v = () => m(u), i[5] = v) : v = i[5];
|
|
18
|
+
let y;
|
|
19
|
+
i[6] !== p || i[7] !== g ? (y = {
|
|
20
|
+
isDark: p,
|
|
21
|
+
toggleTheme: v,
|
|
22
|
+
theme: g
|
|
23
|
+
}, i[6] = p, i[7] = g, i[8] = y) : y = i[8];
|
|
24
|
+
let b = _, x;
|
|
25
|
+
i[9] === b ? x = i[10] : (x = {
|
|
26
|
+
...b,
|
|
27
|
+
height: "100%",
|
|
28
|
+
width: "100%"
|
|
29
|
+
}, i[9] = b, i[10] = x);
|
|
30
|
+
let S;
|
|
31
|
+
i[11] !== l || i[12] !== x ? (S = /* @__PURE__ */ s("div", {
|
|
32
|
+
style: x,
|
|
26
33
|
children: l
|
|
27
|
-
}), i[
|
|
28
|
-
let
|
|
29
|
-
return i[
|
|
30
|
-
value:
|
|
31
|
-
children:
|
|
32
|
-
}), i[
|
|
34
|
+
}), i[11] = l, i[12] = x, i[13] = S) : S = i[13];
|
|
35
|
+
let C;
|
|
36
|
+
return i[14] !== y || i[15] !== S ? (C = /* @__PURE__ */ s(c.Provider, {
|
|
37
|
+
value: y,
|
|
38
|
+
children: S
|
|
39
|
+
}), i[14] = y, i[15] = S, i[16] = C) : C = i[16], C;
|
|
33
40
|
}
|
|
34
41
|
function u(e) {
|
|
35
42
|
return !e;
|
package/dist/es/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import e from "./
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
1
|
+
import { darkTheme as e, lightTheme as t } from "./theme.js";
|
|
2
|
+
import n from "./components/PDFViewer.js";
|
|
3
|
+
import { PDFSidebar as r } from "./components/PDFSidebar.js";
|
|
4
|
+
import { PDFAnnotations as i, PDFAnnotationsIcon as a } from "./components/features/PDFAnnotations.js";
|
|
5
|
+
import { PDFChangeFile as o } from "./components/features/PDFChangeFile.js";
|
|
6
|
+
import { PDFDownloadButton as s } from "./components/features/PDFDownloadButton.js";
|
|
7
|
+
import { PDFNavigation as c } from "./components/features/PDFNavigation.js";
|
|
8
|
+
import { PDFOutline as l } from "./components/features/PDFOutline.js";
|
|
9
|
+
import { PDFPageFit as u } from "./components/features/PDFPageFit.js";
|
|
10
|
+
import { PDFRotationControl as d } from "./components/features/PDFRotationControl.js";
|
|
11
|
+
import { PDFSearch as f } from "./components/features/PDFSearch.js";
|
|
12
|
+
import { PDFSignatures as p, PDFSignaturesIcon as m } from "./components/features/PDFSignatures.js";
|
|
13
|
+
import { PDFThumbnails as h } from "./components/features/PDFThumbnails.js";
|
|
14
|
+
import { PDFZoomControls as g } from "./components/features/PDFZoomControls.js";
|
|
15
|
+
import { PDFThemeToggle as _ } from "./components/features/PDFThemeToggle.js";
|
|
16
|
+
import { PDFPrintButton as v } from "./components/features/PDFPrintButton.js";
|
|
17
|
+
export { i as PDFAnnotations, a as PDFAnnotationsIcon, o as PDFChangeFile, s as PDFDownloadButton, c as PDFNavigation, l as PDFOutline, u as PDFPageFit, v as PDFPrintButton, d as PDFRotationControl, f as PDFSearch, r as PDFSidebar, p as PDFSignatures, m as PDFSignaturesIcon, _ as PDFThemeToggle, h as PDFThumbnails, n as PDFViewer, g as PDFZoomControls, e as darkTheme, t as lightTheme };
|