pdf-tsx 0.8.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.
Files changed (103) hide show
  1. package/README.md +2 -0
  2. package/dist/cjs/components/PDFSidebar.cjs +1 -1
  3. package/dist/cjs/components/PDFSidebar.module.cjs +1 -1
  4. package/dist/cjs/components/PDFViewer.cjs +1 -1
  5. package/dist/cjs/components/PDFViewer.module.cjs +1 -1
  6. package/dist/cjs/components/features/PDFAnnotations.cjs +1 -1
  7. package/dist/cjs/components/features/PDFAnnotations.module.cjs +1 -1
  8. package/dist/cjs/components/features/PDFAttachments.cjs +1 -1
  9. package/dist/cjs/components/features/PDFAttachments.module.cjs +1 -1
  10. package/dist/cjs/components/features/PDFChangeFile.cjs +1 -1
  11. package/dist/cjs/components/features/PDFDownloadButton.cjs +1 -1
  12. package/dist/cjs/components/features/PDFNavigation.cjs +1 -1
  13. package/dist/cjs/components/features/PDFNavigation.module.cjs +1 -1
  14. package/dist/cjs/components/features/PDFOutline.cjs +1 -1
  15. package/dist/cjs/components/features/PDFOutline.module.cjs +1 -1
  16. package/dist/cjs/components/features/PDFPageFit.cjs +1 -1
  17. package/dist/cjs/components/features/PDFPrintButton.cjs +1 -1
  18. package/dist/cjs/components/features/PDFRotationControl.cjs +1 -1
  19. package/dist/cjs/components/features/PDFSearch.cjs +1 -1
  20. package/dist/cjs/components/features/PDFSearch.module.cjs +1 -1
  21. package/dist/cjs/components/features/PDFSidebarToggle.cjs +1 -1
  22. package/dist/cjs/components/features/PDFSignatures.cjs +1 -1
  23. package/dist/cjs/components/features/PDFSignatures.module.cjs +1 -1
  24. package/dist/cjs/components/features/PDFThemeToggle.cjs +1 -1
  25. package/dist/cjs/components/features/PDFThumbnails.cjs +1 -1
  26. package/dist/cjs/components/features/PDFThumbnails.module.cjs +1 -1
  27. package/dist/cjs/components/features/PDFZoomControls.cjs +1 -1
  28. package/dist/cjs/components/features/PDFZoomControls.module.cjs +1 -1
  29. package/dist/cjs/components/ui/PDFToolbar.cjs +1 -1
  30. package/dist/cjs/components/ui/PDFToolbarDropdownContext.cjs +1 -0
  31. package/dist/cjs/components/ui/PDFToolbarItem.cjs +1 -1
  32. package/dist/cjs/components/ui/ToolbarButton.cjs +1 -1
  33. package/dist/cjs/components/ui/ToolbarButton.module.cjs +1 -1
  34. package/dist/cjs/components/ui/icons.cjs +1 -1
  35. package/dist/cjs/context/ThemeContext.cjs +1 -1
  36. package/dist/cjs/hooks/useAnnotationLayer.cjs +1 -1
  37. package/dist/cjs/hooks/useKeyboardShortcuts.cjs +1 -1
  38. package/dist/cjs/hooks/useOutline.cjs +1 -1
  39. package/dist/cjs/hooks/useOverlayRects.cjs +1 -1
  40. package/dist/cjs/hooks/usePDFLoader.cjs +1 -1
  41. package/dist/cjs/hooks/useScrollTracking.cjs +1 -1
  42. package/dist/cjs/hooks/useTextLayer.cjs +1 -1
  43. package/dist/cjs/hooks/useTextSearch.cjs +1 -1
  44. package/dist/cjs/hooks/useThumbnails.cjs +1 -1
  45. package/dist/cjs/pdf-tsx.css +1 -1
  46. package/dist/components/features/PDFSearch.d.ts +1 -1
  47. package/dist/components/features/PDFSidebarToggle.d.ts +1 -1
  48. package/dist/components/features/PDFZoomControls.d.ts +1 -1
  49. package/dist/components/ui/PDFToolbar.d.ts +2 -2
  50. package/dist/components/ui/PDFToolbarDropdownContext.d.ts +1 -0
  51. package/dist/context/ThemeContext.d.ts +1 -1
  52. package/dist/es/components/PDFSidebar.js +25 -39
  53. package/dist/es/components/PDFSidebar.module.js +9 -9
  54. package/dist/es/components/PDFViewer.js +210 -234
  55. package/dist/es/components/PDFViewer.module.js +15 -15
  56. package/dist/es/components/features/PDFAnnotations.js +54 -62
  57. package/dist/es/components/features/PDFAnnotations.module.js +12 -12
  58. package/dist/es/components/features/PDFAttachments.js +52 -70
  59. package/dist/es/components/features/PDFAttachments.module.js +8 -8
  60. package/dist/es/components/features/PDFChangeFile.js +13 -24
  61. package/dist/es/components/features/PDFDownloadButton.js +10 -13
  62. package/dist/es/components/features/PDFNavigation.js +38 -59
  63. package/dist/es/components/features/PDFNavigation.module.js +3 -3
  64. package/dist/es/components/features/PDFOutline.js +66 -83
  65. package/dist/es/components/features/PDFOutline.module.js +5 -5
  66. package/dist/es/components/features/PDFPageFit.js +18 -23
  67. package/dist/es/components/features/PDFPrintButton.js +14 -17
  68. package/dist/es/components/features/PDFRotationControl.js +7 -13
  69. package/dist/es/components/features/PDFSearch.js +60 -69
  70. package/dist/es/components/features/PDFSearch.module.js +5 -5
  71. package/dist/es/components/features/PDFSidebarToggle.js +8 -13
  72. package/dist/es/components/features/PDFSignatures.js +116 -139
  73. package/dist/es/components/features/PDFSignatures.module.js +16 -16
  74. package/dist/es/components/features/PDFThemeToggle.js +10 -11
  75. package/dist/es/components/features/PDFThumbnails.js +25 -34
  76. package/dist/es/components/features/PDFThumbnails.module.js +9 -9
  77. package/dist/es/components/features/PDFZoomControls.js +21 -36
  78. package/dist/es/components/features/PDFZoomControls.module.js +1 -1
  79. package/dist/es/components/ui/PDFToolbar.js +33 -32
  80. package/dist/es/components/ui/PDFToolbarDropdownContext.js +5 -0
  81. package/dist/es/components/ui/PDFToolbarItem.js +11 -20
  82. package/dist/es/components/ui/ToolbarButton.js +8 -11
  83. package/dist/es/components/ui/ToolbarButton.module.js +2 -2
  84. package/dist/es/components/ui/icons.js +5 -16
  85. package/dist/es/context/ThemeContext.js +28 -38
  86. package/dist/es/hooks/useAnnotationLayer.js +33 -42
  87. package/dist/es/hooks/useKeyboardShortcuts.js +25 -34
  88. package/dist/es/hooks/useOutline.js +18 -23
  89. package/dist/es/hooks/useOverlayRects.js +42 -51
  90. package/dist/es/hooks/usePDFLoader.js +13 -16
  91. package/dist/es/hooks/useScrollTracking.js +24 -25
  92. package/dist/es/hooks/useTextLayer.js +34 -29
  93. package/dist/es/hooks/useTextSearch.js +31 -38
  94. package/dist/es/hooks/useThumbnails.js +33 -44
  95. package/dist/es/pdf-tsx.css +1 -1
  96. package/dist/hooks/useAttachments.d.ts +1 -1
  97. package/dist/hooks/useOutline.d.ts +1 -1
  98. package/dist/hooks/useOverlayRects.d.ts +1 -1
  99. package/dist/hooks/usePDFRenderer.d.ts +1 -1
  100. package/dist/hooks/useSignatures.d.ts +1 -1
  101. package/dist/hooks/useThumbnails.d.ts +1 -1
  102. package/dist/index.d.ts +3 -3
  103. 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 { c as i } from "react/compiler-runtime";
6
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
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 s(e) {
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 c() {
16
- let e = i(1), t;
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__ */ a("path", {
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
- }), e[0] = t) : t = e[0], t;
29
+ });
31
30
  }
32
- function l() {
33
- let e = i(1), t;
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__ */ a("circle", {
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
- }), e[0] = t) : t = e[0], t;
46
+ });
49
47
  }
50
- function u(e) {
51
- let t = i(26), { sig: n, onClick: u } = e, d = !!n.rect, f = `${r.card} ${n.signed ? r.cardSigned : ""} ${d ? r.cardClickable : ""}`, p;
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: [v, y]
118
- }), t[16] = v, t[17] = y, t[18] = b) : b = t[18];
119
- let x = b;
120
- if (d) {
121
- let e;
122
- return t[19] !== x || t[20] !== f || t[21] !== u ? (e = /* @__PURE__ */ a("button", {
123
- type: "button",
124
- className: f,
125
- onClick: u,
126
- children: x
127
- }), t[19] = x, t[20] = f, t[21] = u, t[22] = e) : e = t[22], e;
128
- }
129
- let S;
130
- return t[23] !== x || t[24] !== f ? (S = /* @__PURE__ */ a("div", {
131
- className: f,
132
- children: x
133
- }), t[23] = x, t[24] = f, t[25] = S) : S = t[25], S;
134
- }
135
- function d(t) {
136
- let s = i(8), { icon: c } = t, { pdf: l } = e(), u;
137
- s[0] === l ? u = s[1] : (u = { pdf: l }, s[0] = l, s[1] = u);
138
- let { signatures: d, loading: f } = n(u), p = d.length, m;
139
- s[2] !== p || s[3] !== f ? (m = !f && p > 0 && /* @__PURE__ */ a("span", {
140
- className: r.badge,
141
- children: p > 99 ? "99+" : p
142
- }), s[2] = p, s[3] = f, s[4] = m) : m = s[4];
143
- let h;
144
- return s[5] !== c || s[6] !== m ? (h = /* @__PURE__ */ o("span", {
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, m]
147
- }), s[5] = c, s[6] = m, s[7] = h) : h = s[7], h;
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 f() {
150
- let s = i(24), { pdf: c, goToPage: l, setHighlight: d, setZoom: f, rotation: p, containerRef: m } = e(), h;
151
- s[0] === c ? h = s[1] : (h = { pdf: c }, s[0] = c, s[1] = h);
152
- let { signatures: g, loading: _ } = n(h), v, y, b, x;
153
- if (s[2] !== m || s[3] !== l || s[4] !== _ || s[5] !== c || s[6] !== p || s[7] !== d || s[8] !== f || s[9] !== g) {
154
- let e = async (e) => {
155
- c && m.current && f(await t("page", c, m.current, p)), l(e.page), e.rect && d({
156
- page: e.page,
157
- pdfRect: e.rect
158
- });
159
- };
160
- v = r.list, s[14] === _ ? y = s[15] : (y = _ && /* @__PURE__ */ a("div", {
161
- className: r.emptyState,
162
- children: "Caricamento..."
163
- }), s[14] = _, s[15] = y), s[16] !== _ || s[17] !== g ? (b = !_ && g.length === 0 && /* @__PURE__ */ a("div", {
164
- className: r.emptyState,
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
- y,
176
- b,
177
- x
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
- }), s[19] = v, s[20] = y, s[21] = b, s[22] = x, s[23] = S) : S = s[23], S;
156
+ });
180
157
  }
181
158
  //#endregion
182
- export { f as PDFSignatures, d as PDFSignaturesIcon };
159
+ export { p as PDFSignatures, f as PDFSignaturesIcon };
@@ -1,20 +1,20 @@
1
1
  var e = {
2
- list: "_list_irrdi_1",
3
- emptyState: "_emptyState_irrdi_15",
4
- card: "_card_irrdi_29",
5
- cardSigned: "_cardSigned_irrdi_63",
6
- cardClickable: "_cardClickable_irrdi_73",
7
- cardBody: "_cardBody_irrdi_99",
8
- cardHeader: "_cardHeader_irrdi_107",
9
- fieldName: "_fieldName_irrdi_123",
10
- statusChip: "_statusChip_irrdi_145",
11
- statusChipSigned: "_statusChipSigned_irrdi_177",
12
- fieldList: "_fieldList_irrdi_189",
13
- fieldRow: "_fieldRow_irrdi_201",
14
- fieldLabel: "_fieldLabel_irrdi_217",
15
- fieldValue: "_fieldValue_irrdi_227",
16
- iconWrapper: "_iconWrapper_irrdi_237",
17
- badge: "_badge_irrdi_251"
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 r } from "react/jsx-runtime";
4
+ import { jsx as n } from "react/jsx-runtime";
6
5
  //#region src/components/features/PDFThemeToggle.tsx
7
- function i(i) {
8
- let a = n(4), { lightIcon: o, darkIcon: s } = i, { isDark: c, toggleTheme: l } = t(), u = c ? "Switch to light mode" : "Switch to dark mode", d = c ? o : s, f;
9
- return a[0] !== u || a[1] !== d || a[2] !== l ? (f = /* @__PURE__ */ r(e, {
10
- onClick: l,
11
- title: u,
12
- children: d
13
- }), a[0] = u, a[1] = d, a[2] = l, a[3] = f) : f = a[3], f;
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
- i.toolbarLabel = "Tema";
14
+ r.toolbarLabel = "Tema";
16
15
  //#endregion
17
- export { i as PDFThemeToggle };
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 { c as r } from "react/compiler-runtime";
5
- import { useEffect as i, useRef as a, useState as o } from "react";
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 l = 3;
9
- function u(e, t, n) {
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 - l); t <= Math.min(n, e + l); t++) r.add(t);
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 d() {
20
- let l = r(14), { pdf: d, rotation: f, currentPage: p, goToPage: m, numPages: h } = e(), g;
21
- l[0] === Symbol.for("react.memo_cache_sentinel") ? (g = [], l[0] = g) : g = l[0];
22
- let _ = a(g), v;
23
- l[1] === Symbol.for("react.memo_cache_sentinel") ? (v = [], l[1] = v) : v = l[1];
24
- let [y, b] = o(v), x;
25
- l[2] !== d || l[3] !== f || l[4] !== y ? (x = {
26
- pdf: d,
27
- rotation: f,
28
- visiblePages: y
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
- }, w = [h], l[6] = h, l[7] = C, l[8] = w), i(C, w);
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: h }, (e, t) => {
42
- let r = t + 1, i = S[t], a = p === r;
43
- return /* @__PURE__ */ c("div", {
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: () => m(r),
36
+ onClick: () => f(r),
46
37
  ref: (e) => {
47
- _.current[t] = e;
38
+ m.current[t] = e;
48
39
  },
49
40
  "data-page": r,
50
- children: [i ? /* @__PURE__ */ s("img", {
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__ */ s("div", { className: n.thumbnailSkeleton }), /* @__PURE__ */ s("div", {
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
- }), l[9] = p, l[10] = m, l[11] = h, l[12] = S, l[13] = T) : T = l[13], T;
51
+ });
61
52
  }
62
53
  //#endregion
63
- export { d as PDFThumbnails };
54
+ export { u as PDFThumbnails };
@@ -1,13 +1,13 @@
1
1
  var e = {
2
- thumbnailList: "_thumbnailList_vk7sw_1",
3
- thumbnailItem: "_thumbnailItem_vk7sw_11",
4
- thumbnailItemActive: "_thumbnailItemActive_vk7sw_37",
5
- thumbnailImg: "_thumbnailImg_vk7sw_55",
6
- thumbnailImgActive: "_thumbnailImgActive_vk7sw_67",
7
- thumbnailSkeleton: "_thumbnailSkeleton_vk7sw_75",
8
- shimmer: "_shimmer_vk7sw_1",
9
- thumbnailLabel: "_thumbnailLabel_vk7sw_103",
10
- thumbnailLabelActive: "_thumbnailLabelActive_vk7sw_117"
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 { c as r } from "react/compiler-runtime";
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 c = r(21), { zoomOutIcon: l, zoomInIcon: u } = s, { zoom: d, setZoom: f, setFitMode: p } = e(), m;
10
- c[0] !== p || c[1] !== f ? (m = (e) => {
11
- p(null), f((t) => Math.min(Math.max(t + e, .2), 3));
12
- }, c[0] = p, c[1] = f, c[2] = m) : m = c[2];
13
- let h = m, g;
14
- c[3] === h ? g = c[4] : (g = () => h(-.2), c[3] = h, c[4] = g);
15
- let _;
16
- c[5] !== g || c[6] !== l ? (_ = /* @__PURE__ */ a(t, {
17
- onClick: g,
18
- title: "Riduci zoom",
19
- children: l
20
- }), c[5] = g, c[6] = l, c[7] = _) : _ = c[7];
21
- let v;
22
- c[8] === d ? v = c[9] : (v = Math.round(d * 100), c[8] = d, c[9] = v);
23
- let y;
24
- c[10] === v ? y = c[11] : (y = /* @__PURE__ */ o("span", {
25
- className: n.zoomLabel,
26
- children: [v, "%"]
27
- }), c[10] = v, c[11] = y);
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
@@ -1,3 +1,3 @@
1
- var e = { zoomLabel: "_zoomLabel_1r6if_1" };
1
+ var e = { zoomLabel: "_zoomLabel_m8iv9_1" };
2
2
  //#endregion
3
3
  export { e as default };