pdf-tsx 0.1.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.
Files changed (132) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +190 -0
  3. package/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -0
  4. package/dist/cjs/components/PDFSidebar.cjs +1 -0
  5. package/dist/cjs/components/PDFSidebar.module.cjs +1 -0
  6. package/dist/cjs/components/PDFViewer.cjs +1 -0
  7. package/dist/cjs/components/PDFViewer.module.cjs +1 -0
  8. package/dist/cjs/components/features/PDFAnnotations.cjs +1 -0
  9. package/dist/cjs/components/features/PDFAnnotations.module.cjs +1 -0
  10. package/dist/cjs/components/features/PDFChangeFile.cjs +1 -0
  11. package/dist/cjs/components/features/PDFDownloadButton.cjs +1 -0
  12. package/dist/cjs/components/features/PDFNavigation.cjs +1 -0
  13. package/dist/cjs/components/features/PDFNavigation.module.cjs +1 -0
  14. package/dist/cjs/components/features/PDFOutline.cjs +1 -0
  15. package/dist/cjs/components/features/PDFOutline.module.cjs +1 -0
  16. package/dist/cjs/components/features/PDFPageFit.cjs +1 -0
  17. package/dist/cjs/components/features/PDFPrintButton.cjs +1 -0
  18. package/dist/cjs/components/features/PDFRotationControl.cjs +1 -0
  19. package/dist/cjs/components/features/PDFSearch.cjs +1 -0
  20. package/dist/cjs/components/features/PDFSearch.module.cjs +1 -0
  21. package/dist/cjs/components/features/PDFSignatures.cjs +1 -0
  22. package/dist/cjs/components/features/PDFSignatures.module.cjs +1 -0
  23. package/dist/cjs/components/features/PDFThemeToggle.cjs +1 -0
  24. package/dist/cjs/components/features/PDFThumbnails.cjs +1 -0
  25. package/dist/cjs/components/features/PDFThumbnails.module.cjs +1 -0
  26. package/dist/cjs/components/features/PDFZoomControls.cjs +1 -0
  27. package/dist/cjs/components/features/PDFZoomControls.module.cjs +1 -0
  28. package/dist/cjs/components/ui/ToolbarButton.cjs +1 -0
  29. package/dist/cjs/components/ui/ToolbarButton.module.cjs +1 -0
  30. package/dist/cjs/components/ui/icons.cjs +1 -0
  31. package/dist/cjs/context/PDFViewerContext.cjs +1 -0
  32. package/dist/cjs/context/ThemeContext.cjs +1 -0
  33. package/dist/cjs/hooks/useAnnotationLayer.cjs +1 -0
  34. package/dist/cjs/hooks/useAnnotations.cjs +1 -0
  35. package/dist/cjs/hooks/useKeyboardShortcuts.cjs +1 -0
  36. package/dist/cjs/hooks/useOutline.cjs +1 -0
  37. package/dist/cjs/hooks/useScrollTracking.cjs +1 -0
  38. package/dist/cjs/hooks/useSignatures.cjs +1 -0
  39. package/dist/cjs/hooks/useTextLayer.cjs +1 -0
  40. package/dist/cjs/hooks/useTextSearch.cjs +1 -0
  41. package/dist/cjs/hooks/useThumbnails.cjs +1 -0
  42. package/dist/cjs/index.cjs +1 -0
  43. package/dist/cjs/node_modules/react/cjs/react-compiler-runtime.development.cjs +5 -0
  44. package/dist/cjs/node_modules/react/cjs/react-compiler-runtime.production.cjs +1 -0
  45. package/dist/cjs/node_modules/react/compiler-runtime.cjs +1 -0
  46. package/dist/cjs/pdf-tsx.css +2 -0
  47. package/dist/cjs/theme.cjs +1 -0
  48. package/dist/cjs/utils/url.cjs +1 -0
  49. package/dist/cjs/vite.svg +1 -0
  50. package/dist/components/PDFSidebar.d.ts +11 -0
  51. package/dist/components/PDFViewer.d.ts +10 -0
  52. package/dist/components/features/PDFAnnotations.d.ts +1 -0
  53. package/dist/components/features/PDFChangeFile.d.ts +6 -0
  54. package/dist/components/features/PDFDownloadButton.d.ts +6 -0
  55. package/dist/components/features/PDFNavigation.d.ts +7 -0
  56. package/dist/components/features/PDFOutline.d.ts +1 -0
  57. package/dist/components/features/PDFPageFit.d.ts +7 -0
  58. package/dist/components/features/PDFPrintButton.d.ts +6 -0
  59. package/dist/components/features/PDFRotationControl.d.ts +6 -0
  60. package/dist/components/features/PDFSearch.d.ts +9 -0
  61. package/dist/components/features/PDFSignatures.d.ts +1 -0
  62. package/dist/components/features/PDFThemeToggle.d.ts +7 -0
  63. package/dist/components/features/PDFThumbnails.d.ts +1 -0
  64. package/dist/components/features/PDFZoomControls.d.ts +7 -0
  65. package/dist/components/ui/ToolbarButton.d.ts +6 -0
  66. package/dist/components/ui/icons.d.ts +20 -0
  67. package/dist/context/PDFViewerContext.d.ts +25 -0
  68. package/dist/context/ThemeContext.d.ts +12 -0
  69. package/dist/es/_virtual/_rolldown/runtime.js +7 -0
  70. package/dist/es/components/PDFSidebar.js +43 -0
  71. package/dist/es/components/PDFSidebar.module.js +11 -0
  72. package/dist/es/components/PDFViewer.js +263 -0
  73. package/dist/es/components/PDFViewer.module.js +16 -0
  74. package/dist/es/components/features/PDFAnnotations.js +94 -0
  75. package/dist/es/components/features/PDFAnnotations.module.js +14 -0
  76. package/dist/es/components/features/PDFChangeFile.js +36 -0
  77. package/dist/es/components/features/PDFDownloadButton.js +23 -0
  78. package/dist/es/components/features/PDFNavigation.js +71 -0
  79. package/dist/es/components/features/PDFNavigation.module.js +7 -0
  80. package/dist/es/components/features/PDFOutline.js +101 -0
  81. package/dist/es/components/features/PDFOutline.module.js +9 -0
  82. package/dist/es/components/features/PDFPageFit.js +43 -0
  83. package/dist/es/components/features/PDFPrintButton.js +26 -0
  84. package/dist/es/components/features/PDFRotationControl.js +22 -0
  85. package/dist/es/components/features/PDFSearch.js +77 -0
  86. package/dist/es/components/features/PDFSearch.module.js +8 -0
  87. package/dist/es/components/features/PDFSignatures.js +133 -0
  88. package/dist/es/components/features/PDFSignatures.module.js +18 -0
  89. package/dist/es/components/features/PDFThemeToggle.js +17 -0
  90. package/dist/es/components/features/PDFThumbnails.js +40 -0
  91. package/dist/es/components/features/PDFThumbnails.module.js +11 -0
  92. package/dist/es/components/features/PDFZoomControls.js +47 -0
  93. package/dist/es/components/features/PDFZoomControls.module.js +3 -0
  94. package/dist/es/components/ui/ToolbarButton.js +16 -0
  95. package/dist/es/components/ui/ToolbarButton.module.js +6 -0
  96. package/dist/es/components/ui/icons.js +28 -0
  97. package/dist/es/context/PDFViewerContext.js +11 -0
  98. package/dist/es/context/ThemeContext.js +43 -0
  99. package/dist/es/hooks/useAnnotationLayer.js +71 -0
  100. package/dist/es/hooks/useAnnotations.js +44 -0
  101. package/dist/es/hooks/useKeyboardShortcuts.js +54 -0
  102. package/dist/es/hooks/useOutline.js +20 -0
  103. package/dist/es/hooks/useScrollTracking.js +46 -0
  104. package/dist/es/hooks/useSignatures.js +45 -0
  105. package/dist/es/hooks/useTextLayer.js +42 -0
  106. package/dist/es/hooks/useTextSearch.js +53 -0
  107. package/dist/es/hooks/useThumbnails.js +31 -0
  108. package/dist/es/index.js +16 -0
  109. package/dist/es/node_modules/react/cjs/react-compiler-runtime.development.js +14 -0
  110. package/dist/es/node_modules/react/cjs/react-compiler-runtime.production.js +11 -0
  111. package/dist/es/node_modules/react/compiler-runtime.js +10 -0
  112. package/dist/es/pdf-tsx.css +2 -0
  113. package/dist/es/theme.js +67 -0
  114. package/dist/es/utils/url.js +11 -0
  115. package/dist/es/vite.svg +1 -0
  116. package/dist/hooks/useAnnotationLayer.d.ts +20 -0
  117. package/dist/hooks/useAnnotations.d.ts +20 -0
  118. package/dist/hooks/useKeyboardShortcuts.d.ts +11 -0
  119. package/dist/hooks/useOutline.d.ts +14 -0
  120. package/dist/hooks/useScrollTracking.d.ts +14 -0
  121. package/dist/hooks/useSignatures.d.ts +17 -0
  122. package/dist/hooks/useTextLayer.d.ts +10 -0
  123. package/dist/hooks/useTextSearch.d.ts +12 -0
  124. package/dist/hooks/useThumbnails.d.ts +9 -0
  125. package/dist/index.d.ts +15 -0
  126. package/dist/pdf-tsx.cjs.js +5 -0
  127. package/dist/pdf-tsx.css +2 -0
  128. package/dist/pdf-tsx.es.js +2637 -0
  129. package/dist/theme.d.ts +24 -0
  130. package/dist/utils/url.d.ts +1 -0
  131. package/dist/vite.svg +1 -0
  132. package/package.json +60 -0
@@ -0,0 +1,36 @@
1
+ import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
+ import { require_compiler_runtime as t } from "../../node_modules/react/compiler-runtime.js";
3
+ import { ToolbarButton as n } from "../ui/ToolbarButton.js";
4
+ import { useRef as r } from "react";
5
+ import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
6
+ //#region src/components/features/PDFChangeFile.tsx
7
+ var s = t();
8
+ function c(t) {
9
+ let c = (0, s.c)(11), { icon: l } = t, { onChangeFile: u } = e(), d = r(null), f;
10
+ c[0] === u ? f = c[1] : (f = (e) => {
11
+ let t = e.target.files?.[0];
12
+ t && u?.(t), e.target.value = "";
13
+ }, c[0] = u, c[1] = f);
14
+ let p = f, m;
15
+ c[2] === Symbol.for("react.memo_cache_sentinel") ? (m = { display: "none" }, c[2] = m) : m = c[2];
16
+ let h;
17
+ c[3] === p ? h = c[4] : (h = /* @__PURE__ */ a("input", {
18
+ ref: d,
19
+ type: "file",
20
+ accept: ".pdf",
21
+ style: m,
22
+ onChange: p
23
+ }), c[3] = p, c[4] = h);
24
+ let g;
25
+ c[5] === Symbol.for("react.memo_cache_sentinel") ? (g = () => d.current?.click(), c[5] = g) : g = c[5];
26
+ let _;
27
+ c[6] === l ? _ = c[7] : (_ = /* @__PURE__ */ a(n, {
28
+ onClick: g,
29
+ title: "Apri altro file",
30
+ children: l
31
+ }), c[6] = l, c[7] = _);
32
+ let v;
33
+ return c[8] !== h || c[9] !== _ ? (v = /* @__PURE__ */ o(i, { children: [h, _] }), c[8] = h, c[9] = _, c[10] = v) : v = c[10], v;
34
+ }
35
+ //#endregion
36
+ export { c as PDFChangeFile };
@@ -0,0 +1,23 @@
1
+ import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
+ import { require_compiler_runtime as t } from "../../node_modules/react/compiler-runtime.js";
3
+ import { ToolbarButton as n } from "../ui/ToolbarButton.js";
4
+ import "react";
5
+ import { jsxs as r } from "react/jsx-runtime";
6
+ //#region src/components/features/PDFDownloadButton.tsx
7
+ var i = t();
8
+ function a(t) {
9
+ let a = (0, i.c)(5), { icon: o } = t, { file: s } = e(), c;
10
+ a[0] === s ? c = a[1] : (c = () => {
11
+ let e = URL.createObjectURL(s), t = document.createElement("a");
12
+ t.href = e, t.download = s.name || "documento.pdf", t.click(), URL.revokeObjectURL(e);
13
+ }, a[0] = s, a[1] = c);
14
+ let l = c, u;
15
+ return a[2] !== l || a[3] !== o ? (u = /* @__PURE__ */ r(n, {
16
+ $primary: !0,
17
+ onClick: l,
18
+ title: "Scarica PDF",
19
+ children: [o, "Scarica"]
20
+ }), a[2] = l, a[3] = o, a[4] = u) : u = a[4], u;
21
+ }
22
+ //#endregion
23
+ export { a as PDFDownloadButton };
@@ -0,0 +1,71 @@
1
+ import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
+ import { require_compiler_runtime as t } from "../../node_modules/react/compiler-runtime.js";
3
+ import { ToolbarButton as n } from "../ui/ToolbarButton.js";
4
+ import r from "./PDFNavigation.module.js";
5
+ import { useState as i } from "react";
6
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
7
+ //#region src/components/features/PDFNavigation.tsx
8
+ var s = t();
9
+ function c(t) {
10
+ let c = (0, s.c)(34), { prevIcon: l, nextIcon: u } = t, { currentPage: d, numPages: f, goToPage: p } = e(), [m, h] = i(!1), [g, _] = i(""), v;
11
+ c[0] !== p || c[1] !== g ? (v = () => {
12
+ let e = parseInt(g, 10);
13
+ isNaN(e) || p(e), h(!1);
14
+ }, c[0] = p, c[1] = g, c[2] = v) : v = c[2];
15
+ let y = v, b;
16
+ c[3] !== d || c[4] !== p ? (b = () => p(d - 1), c[3] = d, c[4] = p, c[5] = b) : b = c[5];
17
+ let x = d === 1, S;
18
+ c[6] !== l || c[7] !== b || c[8] !== x ? (S = /* @__PURE__ */ a(n, {
19
+ onClick: b,
20
+ disabled: x,
21
+ title: "Pagina precedente (←)",
22
+ children: l
23
+ }), c[6] = l, c[7] = b, c[8] = x, c[9] = S) : S = c[9];
24
+ let C = m ? g : d, w;
25
+ c[10] === d ? w = c[11] : (w = () => {
26
+ h(!0), _(String(d));
27
+ }, c[10] = d, c[11] = w);
28
+ let T;
29
+ c[12] === Symbol.for("react.memo_cache_sentinel") ? (T = (e) => _(e.target.value), c[12] = T) : T = c[12];
30
+ let E;
31
+ c[13] === y ? E = c[14] : (E = (e) => {
32
+ e.key === "Enter" && y(), e.key === "Escape" && h(!1);
33
+ }, c[13] = y, c[14] = E);
34
+ let D;
35
+ c[15] !== y || c[16] !== C || c[17] !== w || c[18] !== E ? (D = /* @__PURE__ */ a("input", {
36
+ className: r.pageInput,
37
+ type: "number",
38
+ value: C,
39
+ onFocus: w,
40
+ onBlur: y,
41
+ onChange: T,
42
+ onKeyDown: E,
43
+ title: "Vai alla pagina"
44
+ }), c[15] = y, c[16] = C, c[17] = w, c[18] = E, c[19] = D) : D = c[19];
45
+ let O;
46
+ c[20] === f ? O = c[21] : (O = /* @__PURE__ */ o("span", {
47
+ className: r.pageTotal,
48
+ children: ["/ ", f]
49
+ }), c[20] = f, c[21] = O);
50
+ let k;
51
+ c[22] !== d || c[23] !== p ? (k = () => p(d + 1), c[22] = d, c[23] = p, c[24] = k) : k = c[24];
52
+ let A = d === f, j;
53
+ c[25] !== u || c[26] !== k || c[27] !== A ? (j = /* @__PURE__ */ a(n, {
54
+ onClick: k,
55
+ disabled: A,
56
+ title: "Pagina successiva (→)",
57
+ children: u
58
+ }), c[25] = u, c[26] = k, c[27] = A, c[28] = j) : j = c[28];
59
+ let M;
60
+ return c[29] !== O || c[30] !== j || c[31] !== S || c[32] !== D ? (M = /* @__PURE__ */ o("div", {
61
+ className: r.navWrapper,
62
+ children: [
63
+ S,
64
+ D,
65
+ O,
66
+ j
67
+ ]
68
+ }), c[29] = O, c[30] = j, c[31] = S, c[32] = D, c[33] = M) : M = c[33], M;
69
+ }
70
+ //#endregion
71
+ export { c as PDFNavigation };
@@ -0,0 +1,7 @@
1
+ var e = {
2
+ navWrapper: "_navWrapper_ew1r2_1",
3
+ pageInput: "_pageInput_ew1r2_8",
4
+ pageTotal: "_pageTotal_ew1r2_36"
5
+ };
6
+ //#endregion
7
+ export { e as default };
@@ -0,0 +1,101 @@
1
+ import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
+ import { require_compiler_runtime as t } from "../../node_modules/react/compiler-runtime.js";
3
+ import { useOutline as n } from "../../hooks/useOutline.js";
4
+ import { IconChevronDown as r, IconChevronRight as i } from "../ui/icons.js";
5
+ import a from "./PDFOutline.module.js";
6
+ import { useState as o } from "react";
7
+ import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
8
+ //#region src/components/features/PDFOutline.tsx
9
+ var u = t();
10
+ async function d(e, t) {
11
+ if (!e || !t) return null;
12
+ try {
13
+ let n = typeof t == "string" ? await e.getDestination(t) : t;
14
+ if (!n || n.length === 0) return null;
15
+ let r = n[0];
16
+ return await e.getPageIndex(r) + 1;
17
+ } catch {
18
+ return null;
19
+ }
20
+ }
21
+ function f(e) {
22
+ let t = (0, u.c)(25), { node: n, depth: d, onNavigate: m } = e, [h, g] = o(d === 0), _ = n.items.length > 0, v = 12 + d * 14, y = n.bold ? 600 : 400, b = n.italic ? "italic" : "normal", x;
23
+ t[0] !== v || t[1] !== y || t[2] !== b ? (x = {
24
+ paddingLeft: v,
25
+ fontWeight: y,
26
+ fontStyle: b
27
+ }, t[0] = v, t[1] = y, t[2] = b, t[3] = x) : x = t[3];
28
+ let S;
29
+ t[4] !== n.dest || t[5] !== m ? (S = () => m(n.dest), t[4] = n.dest, t[5] = m, t[6] = S) : S = t[6];
30
+ let C;
31
+ t[7] !== _ || t[8] !== h ? (C = _ ? /* @__PURE__ */ c("button", {
32
+ className: a.chevronBtn,
33
+ onClick: (e) => {
34
+ e.stopPropagation(), g(p);
35
+ },
36
+ children: c(h ? r : i, { size: 12 })
37
+ }) : /* @__PURE__ */ c("span", { style: {
38
+ width: 16,
39
+ flexShrink: 0
40
+ } }), t[7] = _, t[8] = h, t[9] = C) : C = t[9];
41
+ let w;
42
+ t[10] === n.title ? w = t[11] : (w = /* @__PURE__ */ c("span", {
43
+ className: a.title,
44
+ title: n.title,
45
+ children: n.title
46
+ }), t[10] = n.title, t[11] = w);
47
+ let T;
48
+ t[12] !== x || t[13] !== S || t[14] !== C || t[15] !== w ? (T = /* @__PURE__ */ l("div", {
49
+ className: a.row,
50
+ style: x,
51
+ onClick: S,
52
+ children: [C, w]
53
+ }), t[12] = x, t[13] = S, t[14] = C, t[15] = w, t[16] = T) : T = t[16];
54
+ let E;
55
+ t[17] !== d || t[18] !== n.items || t[19] !== m || t[20] !== h ? (E = h && n.items.map((e, t) => /* @__PURE__ */ c(f, {
56
+ node: e,
57
+ depth: d + 1,
58
+ onNavigate: m
59
+ }, t)), t[17] = d, t[18] = n.items, t[19] = m, t[20] = h, t[21] = E) : E = t[21];
60
+ let D;
61
+ return t[22] !== T || t[23] !== E ? (D = /* @__PURE__ */ l(s, { children: [T, E] }), t[22] = T, t[23] = E, t[24] = D) : D = t[24], D;
62
+ }
63
+ function p(e) {
64
+ return !e;
65
+ }
66
+ function m() {
67
+ let t = (0, u.c)(18), { pdf: r, goToPage: i } = e(), o;
68
+ t[0] === r ? o = t[1] : (o = { pdf: r }, t[0] = r, t[1] = o);
69
+ let { outline: s, loading: p } = n(o), m;
70
+ t[2] !== i || t[3] !== r ? (m = async (e) => {
71
+ let t = await d(r, e);
72
+ t !== null && i(t);
73
+ }, t[2] = i, t[3] = r, t[4] = m) : m = t[4];
74
+ let h = m, g;
75
+ t[5] === p ? g = t[6] : (g = p && /* @__PURE__ */ c("div", {
76
+ className: a.emptyState,
77
+ children: "Caricamento..."
78
+ }), t[5] = p, t[6] = g);
79
+ let _;
80
+ t[7] !== p || t[8] !== s ? (_ = !p && s.length === 0 && /* @__PURE__ */ c("div", {
81
+ className: a.emptyState,
82
+ children: "Nessun segnalibro disponibile."
83
+ }), t[7] = p, t[8] = s, t[9] = _) : _ = t[9];
84
+ let v;
85
+ t[10] !== h || t[11] !== p || t[12] !== s ? (v = !p && s.map((e, t) => /* @__PURE__ */ c(f, {
86
+ node: e,
87
+ depth: 0,
88
+ onNavigate: h
89
+ }, t)), t[10] = h, t[11] = p, t[12] = s, t[13] = v) : v = t[13];
90
+ let y;
91
+ return t[14] !== g || t[15] !== _ || t[16] !== v ? (y = /* @__PURE__ */ l("div", {
92
+ className: a.tree,
93
+ children: [
94
+ g,
95
+ _,
96
+ v
97
+ ]
98
+ }), t[14] = g, t[15] = _, t[16] = v, t[17] = y) : y = t[17], y;
99
+ }
100
+ //#endregion
101
+ export { m as PDFOutline };
@@ -0,0 +1,9 @@
1
+ var e = {
2
+ emptyState: "_emptyState_hqvdn_1",
3
+ tree: "_tree_hqvdn_7",
4
+ row: "_row_hqvdn_13",
5
+ chevronBtn: "_chevronBtn_hqvdn_31",
6
+ title: "_title_hqvdn_46"
7
+ };
8
+ //#endregion
9
+ export { e as default };
@@ -0,0 +1,43 @@
1
+ import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
+ import { require_compiler_runtime as t } from "../../node_modules/react/compiler-runtime.js";
3
+ import { ToolbarButton as n } from "../ui/ToolbarButton.js";
4
+ import "react";
5
+ import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
6
+ //#region src/components/features/PDFPageFit.tsx
7
+ var o = t(), s = 60, c = 10;
8
+ function l(t) {
9
+ let l = (0, o.c)(19), { fitWidthIcon: u, fitPageIcon: d } = t, { pdf: f, rotation: p, setZoom: m, containerRef: h } = e(), g;
10
+ l[0] !== h || l[1] !== f || l[2] !== p || l[3] !== m ? (g = async () => {
11
+ if (!f || !h.current) return;
12
+ let e = (await f.getPage(1)).getViewport({
13
+ scale: 1,
14
+ rotation: p
15
+ });
16
+ m((h.current.clientWidth - s) / 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 - s, n = h.current.clientHeight - c * 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(n, {
29
+ onClick: _,
30
+ title: "Adatta alla larghezza",
31
+ children: u
32
+ }), l[10] = u, l[11] = _, l[12] = b) : b = l[12];
33
+ let x;
34
+ l[13] !== d || l[14] !== y ? (x = /* @__PURE__ */ i(n, {
35
+ onClick: y,
36
+ title: "Adatta pagina intera",
37
+ children: d
38
+ }), l[13] = d, l[14] = y, l[15] = x) : x = l[15];
39
+ let S;
40
+ return l[16] !== b || l[17] !== x ? (S = /* @__PURE__ */ a(r, { children: [b, x] }), l[16] = b, l[17] = x, l[18] = S) : S = l[18], S;
41
+ }
42
+ //#endregion
43
+ export { l as PDFPageFit };
@@ -0,0 +1,26 @@
1
+ import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
+ import { require_compiler_runtime as t } from "../../node_modules/react/compiler-runtime.js";
3
+ import { ToolbarButton as n } from "../ui/ToolbarButton.js";
4
+ import "react";
5
+ import { jsx as r } from "react/jsx-runtime";
6
+ //#region src/components/features/PDFPrintButton.tsx
7
+ var i = t();
8
+ function a(t) {
9
+ let a = (0, i.c)(5), { icon: o } = t, { file: s } = e(), c;
10
+ a[0] === s ? c = a[1] : (c = () => {
11
+ let e = URL.createObjectURL(s), t = document.createElement("iframe");
12
+ t.style.display = "none", t.src = e, document.body.appendChild(t), t.onload = () => {
13
+ t.contentWindow?.print(), setTimeout(() => {
14
+ document.body.removeChild(t), URL.revokeObjectURL(e);
15
+ }, 1e3);
16
+ };
17
+ }, a[0] = s, a[1] = c);
18
+ let l = c, u;
19
+ return a[2] !== l || a[3] !== o ? (u = /* @__PURE__ */ r(n, {
20
+ onClick: l,
21
+ title: "Stampa PDF",
22
+ children: o
23
+ }), a[2] = l, a[3] = o, a[4] = u) : u = a[4], u;
24
+ }
25
+ //#endregion
26
+ export { a as PDFPrintButton };
@@ -0,0 +1,22 @@
1
+ import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
+ import { require_compiler_runtime as t } from "../../node_modules/react/compiler-runtime.js";
3
+ import { ToolbarButton as n } from "../ui/ToolbarButton.js";
4
+ import "react";
5
+ import { jsx as r } from "react/jsx-runtime";
6
+ //#region src/components/features/PDFRotationControl.tsx
7
+ var i = t();
8
+ function a(t) {
9
+ let a = (0, i.c)(5), { icon: s } = t, { setRotation: c } = e(), l;
10
+ a[0] === c ? l = a[1] : (l = () => c(o), a[0] = c, a[1] = l);
11
+ let u;
12
+ return a[2] !== s || a[3] !== l ? (u = /* @__PURE__ */ r(n, {
13
+ onClick: l,
14
+ title: "Ruota documento",
15
+ children: s
16
+ }), a[2] = s, a[3] = l, a[4] = u) : u = a[4], u;
17
+ }
18
+ function o(e) {
19
+ return (e + 90) % 360;
20
+ }
21
+ //#endregion
22
+ export { a as PDFRotationControl };
@@ -0,0 +1,77 @@
1
+ import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
+ import { require_compiler_runtime as t } from "../../node_modules/react/compiler-runtime.js";
3
+ import { useTextSearch as n } from "../../hooks/useTextSearch.js";
4
+ import r from "./PDFSearch.module.js";
5
+ import { useEffect as i, useState as a } from "react";
6
+ import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
7
+ //#region src/components/features/PDFSearch.tsx
8
+ var l = t();
9
+ function u(t) {
10
+ let u = (0, l.c)(33), { searchIcon: d, prevIcon: f, nextIcon: p, clearIcon: m } = t, { pdf: h, goToPage: g, setHighlight: _, setSearchMatches: v } = e(), [y, b] = a(""), [x, S] = a(0), C;
11
+ u[0] !== h || u[1] !== y ? (C = {
12
+ pdf: h,
13
+ query: y
14
+ }, u[0] = h, u[1] = y, u[2] = C) : C = u[2];
15
+ let { matches: w, searching: T } = n(C), E = w.length, D, O;
16
+ u[3] !== w || u[4] !== v ? (D = () => (v(w), () => v([])), O = [w, v], u[3] = w, u[4] = v, u[5] = D, u[6] = O) : (D = u[5], O = u[6]), i(D, O);
17
+ let k;
18
+ u[7] !== g || u[8] !== w || u[9] !== _ || u[10] !== E ? (k = (e) => {
19
+ let t = (e + E) % E;
20
+ S(t);
21
+ let n = w[t];
22
+ g(n.page), _({
23
+ page: n.page,
24
+ pdfRect: n.pdfRect
25
+ });
26
+ }, u[7] = g, u[8] = w, u[9] = _, u[10] = E, u[11] = k) : k = u[11];
27
+ let A = k, j;
28
+ u[12] === _ ? j = u[13] : (j = (e) => {
29
+ b(e.target.value), S(0), _(null);
30
+ }, u[12] = _, u[13] = j);
31
+ let M = j, N;
32
+ u[14] === _ ? N = u[15] : (N = () => {
33
+ b(""), S(0), _(null);
34
+ }, u[14] = _, u[15] = N);
35
+ let P = N, F;
36
+ u[16] !== M || u[17] !== y ? (F = /* @__PURE__ */ s("input", {
37
+ className: r.searchInput,
38
+ value: y,
39
+ onChange: M,
40
+ placeholder: "Cerca nel documento..."
41
+ }), u[16] = M, u[17] = y, u[18] = F) : F = u[18];
42
+ let I;
43
+ u[19] !== m || u[20] !== P || u[21] !== x || u[22] !== A || u[23] !== p || u[24] !== f || u[25] !== y || u[26] !== T || u[27] !== E ? (I = y && /* @__PURE__ */ c(o, { children: [
44
+ /* @__PURE__ */ s("span", {
45
+ className: r.counter,
46
+ children: T ? "…" : E === 0 ? "0" : `${x + 1}/${E}`
47
+ }),
48
+ /* @__PURE__ */ s("button", {
49
+ className: r.navButton,
50
+ onClick: () => A(x - 1),
51
+ disabled: E === 0,
52
+ children: f
53
+ }),
54
+ /* @__PURE__ */ s("button", {
55
+ className: r.navButton,
56
+ onClick: () => A(x + 1),
57
+ disabled: E === 0,
58
+ children: p
59
+ }),
60
+ /* @__PURE__ */ s("button", {
61
+ className: r.navButton,
62
+ onClick: P,
63
+ children: m
64
+ })
65
+ ] }), u[19] = m, u[20] = P, u[21] = x, u[22] = A, u[23] = p, u[24] = f, u[25] = y, u[26] = T, u[27] = E, u[28] = I) : I = u[28];
66
+ let L;
67
+ return u[29] !== d || u[30] !== F || u[31] !== I ? (L = /* @__PURE__ */ c("div", {
68
+ className: r.wrapper,
69
+ children: [
70
+ d,
71
+ F,
72
+ I
73
+ ]
74
+ }), u[29] = d, u[30] = F, u[31] = I, u[32] = L) : L = u[32], L;
75
+ }
76
+ //#endregion
77
+ export { u as PDFSearch };
@@ -0,0 +1,8 @@
1
+ var e = {
2
+ wrapper: "_wrapper_1x913_1",
3
+ searchInput: "_searchInput_1x913_7",
4
+ navButton: "_navButton_1x913_27",
5
+ counter: "_counter_1x913_48"
6
+ };
7
+ //#endregion
8
+ export { e as default };
@@ -0,0 +1,133 @@
1
+ import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
+ import { require_compiler_runtime as t } from "../../node_modules/react/compiler-runtime.js";
3
+ import { useSignatures as n } from "../../hooks/useSignatures.js";
4
+ import r from "./PDFSignatures.module.js";
5
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
+ //#region src/components/features/PDFSignatures.tsx
7
+ var o = t();
8
+ function s(e) {
9
+ if (!e) return;
10
+ let t = e.match(/D:(\d{4})(\d{2})(\d{2})(\d{2})?(\d{2})?(\d{2})?/);
11
+ if (!t) return e;
12
+ let [, n, r, i, a = "00", o = "00"] = t;
13
+ return `${i}/${r}/${n} ${a}:${o}`;
14
+ }
15
+ function c(e) {
16
+ let t = (0, o.c)(31), { sig: n, onClick: c } = e, l = `${r.card} ${n.signed ? r.cardSigned : ""} ${n.rect ? r.cardClickable : ""}`, u = `${r.statusDot} ${n.signed ? r.statusDotSigned : ""}`, d = n.signed ? "✓" : "○", f;
17
+ t[0] !== u || t[1] !== d ? (f = /* @__PURE__ */ i("div", {
18
+ className: u,
19
+ children: d
20
+ }), t[0] = u, t[1] = d, t[2] = f) : f = t[2];
21
+ let p = `${r.statusLabel} ${n.signed ? r.statusLabelSigned : ""}`, m = n.signed ? "Firmato" : "Non firmato", h;
22
+ t[3] !== p || t[4] !== m ? (h = /* @__PURE__ */ i("span", {
23
+ className: p,
24
+ children: m
25
+ }), t[3] = p, t[4] = m, t[5] = h) : h = t[5];
26
+ let g;
27
+ t[6] !== f || t[7] !== h ? (g = /* @__PURE__ */ a("div", {
28
+ className: r.cardHeader,
29
+ children: [f, h]
30
+ }), t[6] = f, t[7] = h, t[8] = g) : g = t[8];
31
+ let _;
32
+ t[9] === Symbol.for("react.memo_cache_sentinel") ? (_ = /* @__PURE__ */ i("span", {
33
+ className: r.fieldLabel,
34
+ children: "Campo: "
35
+ }), t[9] = _) : _ = t[9];
36
+ let v;
37
+ t[10] === n.fieldName ? v = t[11] : (v = /* @__PURE__ */ a("div", {
38
+ className: r.fieldRow,
39
+ children: [_, n.fieldName]
40
+ }), t[10] = n.fieldName, t[11] = v);
41
+ let y;
42
+ t[12] === n.signerName ? y = t[13] : (y = n.signerName && /* @__PURE__ */ a("div", {
43
+ className: r.fieldRow,
44
+ children: [/* @__PURE__ */ i("span", {
45
+ className: r.fieldLabel,
46
+ children: "Firmatario: "
47
+ }), n.signerName]
48
+ }), t[12] = n.signerName, t[13] = y);
49
+ let b;
50
+ t[14] === n.signDate ? b = t[15] : (b = n.signDate && /* @__PURE__ */ a("div", {
51
+ className: r.fieldRow,
52
+ children: [/* @__PURE__ */ i("span", {
53
+ className: r.fieldLabel,
54
+ children: "Data: "
55
+ }), s(n.signDate)]
56
+ }), t[14] = n.signDate, t[15] = b);
57
+ let x;
58
+ t[16] === n.reason ? x = t[17] : (x = n.reason && /* @__PURE__ */ a("div", {
59
+ className: r.fieldRow,
60
+ children: [/* @__PURE__ */ i("span", {
61
+ className: r.fieldLabel,
62
+ children: "Motivo: "
63
+ }), n.reason]
64
+ }), t[16] = n.reason, t[17] = x);
65
+ let S;
66
+ t[18] === n.location ? S = t[19] : (S = n.location && /* @__PURE__ */ a("div", {
67
+ className: r.fieldRow,
68
+ children: [/* @__PURE__ */ i("span", {
69
+ className: r.fieldLabel,
70
+ children: "Luogo: "
71
+ }), n.location]
72
+ }), t[18] = n.location, t[19] = S);
73
+ let C;
74
+ t[20] !== v || t[21] !== y || t[22] !== b || t[23] !== x || t[24] !== S ? (C = /* @__PURE__ */ a("div", {
75
+ className: r.fieldList,
76
+ children: [
77
+ v,
78
+ y,
79
+ b,
80
+ x,
81
+ S
82
+ ]
83
+ }), t[20] = v, t[21] = y, t[22] = b, t[23] = x, t[24] = S, t[25] = C) : C = t[25];
84
+ let w;
85
+ return t[26] !== c || t[27] !== l || t[28] !== C || t[29] !== g ? (w = /* @__PURE__ */ a("div", {
86
+ className: l,
87
+ onClick: c,
88
+ children: [g, C]
89
+ }), t[26] = c, t[27] = l, t[28] = C, t[29] = g, t[30] = w) : w = t[30], w;
90
+ }
91
+ function l() {
92
+ let t = (0, o.c)(22), { pdf: s, goToPage: l, setHighlight: u } = e(), d;
93
+ t[0] === s ? d = t[1] : (d = { pdf: s }, t[0] = s, t[1] = d);
94
+ let { signatures: f, loading: p } = n(d), m;
95
+ t[2] !== l || t[3] !== u ? (m = (e) => {
96
+ l(e.page), e.rect && u({
97
+ page: e.page,
98
+ pdfRect: e.rect
99
+ });
100
+ }, t[2] = l, t[3] = u, t[4] = m) : m = t[4];
101
+ let h = m, g;
102
+ t[5] === p ? g = t[6] : (g = p && /* @__PURE__ */ i("div", {
103
+ className: r.emptyState,
104
+ children: "Caricamento..."
105
+ }), t[5] = p, t[6] = g);
106
+ let _;
107
+ t[7] !== p || t[8] !== f ? (_ = !p && f.length === 0 && /* @__PURE__ */ i("div", {
108
+ className: r.emptyState,
109
+ children: "Nessuna firma rilevata."
110
+ }), t[7] = p, t[8] = f, t[9] = _) : _ = t[9];
111
+ let v;
112
+ t[10] !== h || t[11] !== p || t[12] !== f ? (v = !p && f.map((e, t) => /* @__PURE__ */ i(c, {
113
+ sig: e,
114
+ onClick: () => h(e)
115
+ }, t)), t[10] = h, t[11] = p, t[12] = f, t[13] = v) : v = t[13];
116
+ let y;
117
+ t[14] !== p || t[15] !== f ? (y = !p && f.length > 0 && /* @__PURE__ */ i("div", {
118
+ className: r.disclaimer,
119
+ children: "La presenza del campo firma non garantisce la validità crittografica."
120
+ }), t[14] = p, t[15] = f, t[16] = y) : y = t[16];
121
+ let b;
122
+ return t[17] !== g || t[18] !== _ || t[19] !== v || t[20] !== y ? (b = /* @__PURE__ */ a("div", {
123
+ className: r.list,
124
+ children: [
125
+ g,
126
+ _,
127
+ v,
128
+ y
129
+ ]
130
+ }), t[17] = g, t[18] = _, t[19] = v, t[20] = y, t[21] = b) : b = t[21], b;
131
+ }
132
+ //#endregion
133
+ export { l as PDFSignatures };
@@ -0,0 +1,18 @@
1
+ var e = {
2
+ list: "_list_m6w4t_1",
3
+ emptyState: "_emptyState_m6w4t_6",
4
+ card: "_card_m6w4t_12",
5
+ cardClickable: "_cardClickable_m6w4t_23",
6
+ cardSigned: "_cardSigned_m6w4t_31",
7
+ cardHeader: "_cardHeader_m6w4t_36",
8
+ statusDot: "_statusDot_m6w4t_43",
9
+ statusDotSigned: "_statusDotSigned_m6w4t_57",
10
+ statusLabel: "_statusLabel_m6w4t_61",
11
+ statusLabelSigned: "_statusLabelSigned_m6w4t_69",
12
+ fieldList: "_fieldList_m6w4t_73",
13
+ fieldRow: "_fieldRow_m6w4t_79",
14
+ fieldLabel: "_fieldLabel_m6w4t_84",
15
+ disclaimer: "_disclaimer_m6w4t_88"
16
+ };
17
+ //#endregion
18
+ export { e as default };
@@ -0,0 +1,17 @@
1
+ import { require_compiler_runtime as e } from "../../node_modules/react/compiler-runtime.js";
2
+ import { useTheme as t } from "../../context/ThemeContext.js";
3
+ import { ToolbarButton as n } from "../ui/ToolbarButton.js";
4
+ import "react";
5
+ import { jsx as r } from "react/jsx-runtime";
6
+ //#region src/components/features/PDFThemeToggle.tsx
7
+ var i = e();
8
+ function a(e) {
9
+ let a = (0, i.c)(4), { lightIcon: o, darkIcon: s } = e, { isDark: c, toggleTheme: l } = t(), u = c ? "Switch to light mode" : "Switch to dark mode", d = c ? o : s, f;
10
+ return a[0] !== u || a[1] !== d || a[2] !== l ? (f = /* @__PURE__ */ r(n, {
11
+ onClick: l,
12
+ title: u,
13
+ children: d
14
+ }), a[0] = u, a[1] = d, a[2] = l, a[3] = f) : f = a[3], f;
15
+ }
16
+ //#endregion
17
+ export { a as PDFThemeToggle };
@@ -0,0 +1,40 @@
1
+ import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
+ import { require_compiler_runtime as t } from "../../node_modules/react/compiler-runtime.js";
3
+ import { useThumbnails as n } from "../../hooks/useThumbnails.js";
4
+ import r from "./PDFThumbnails.module.js";
5
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
+ //#region src/components/features/PDFThumbnails.tsx
7
+ var o = t();
8
+ function s() {
9
+ let t = (0, o.c)(12), { pdf: s, rotation: c, currentPage: l, goToPage: u } = e(), d;
10
+ t[0] !== s || t[1] !== c ? (d = {
11
+ pdf: s,
12
+ rotation: c
13
+ }, t[0] = s, t[1] = c, t[2] = d) : d = t[2];
14
+ let { thumbnails: f } = n(d), p;
15
+ if (t[3] !== l || t[4] !== u || t[5] !== f) {
16
+ let e;
17
+ t[7] !== l || t[8] !== u ? (e = (e, t) => {
18
+ let n = l === t + 1;
19
+ return /* @__PURE__ */ a("div", {
20
+ className: `${r.thumbnailItem} ${n ? r.thumbnailItemActive : ""}`,
21
+ onClick: () => u(t + 1),
22
+ children: [/* @__PURE__ */ i("img", {
23
+ src: e,
24
+ className: `${r.thumbnailImg} ${n ? r.thumbnailImgActive : ""}`,
25
+ alt: `Anteprima pagina ${t + 1}`
26
+ }), /* @__PURE__ */ i("div", {
27
+ className: `${r.thumbnailLabel} ${n ? r.thumbnailLabelActive : ""}`,
28
+ children: t + 1
29
+ })]
30
+ }, t);
31
+ }, t[7] = l, t[8] = u, t[9] = e) : e = t[9], p = f.map(e), t[3] = l, t[4] = u, t[5] = f, t[6] = p;
32
+ } else p = t[6];
33
+ let m;
34
+ return t[10] === p ? m = t[11] : (m = /* @__PURE__ */ i("div", {
35
+ className: r.thumbnailList,
36
+ children: p
37
+ }), t[10] = p, t[11] = m), m;
38
+ }
39
+ //#endregion
40
+ export { s as PDFThumbnails };
@@ -0,0 +1,11 @@
1
+ var e = {
2
+ thumbnailList: "_thumbnailList_f8jl0_1",
3
+ thumbnailItem: "_thumbnailItem_f8jl0_6",
4
+ thumbnailItemActive: "_thumbnailItemActive_f8jl0_19",
5
+ thumbnailImg: "_thumbnailImg_f8jl0_28",
6
+ thumbnailImgActive: "_thumbnailImgActive_f8jl0_34",
7
+ thumbnailLabel: "_thumbnailLabel_f8jl0_38",
8
+ thumbnailLabelActive: "_thumbnailLabelActive_f8jl0_45"
9
+ };
10
+ //#endregion
11
+ export { e as default };