pdf-tsx 0.3.0 → 0.5.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 (111) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +350 -296
  3. package/dist/cjs/components/PDFSidebar.cjs +1 -1
  4. package/dist/cjs/components/PDFSidebar.module.cjs +1 -1
  5. package/dist/cjs/components/PDFViewer.cjs +1 -1
  6. package/dist/cjs/components/PDFViewer.module.cjs +1 -1
  7. package/dist/cjs/components/features/PDFAnnotations.cjs +1 -1
  8. package/dist/cjs/components/features/PDFAnnotations.module.cjs +1 -1
  9. package/dist/cjs/components/features/PDFChangeFile.cjs +1 -1
  10. package/dist/cjs/components/features/PDFDownloadButton.cjs +1 -1
  11. package/dist/cjs/components/features/PDFNavigation.cjs +1 -1
  12. package/dist/cjs/components/features/PDFNavigation.module.cjs +1 -1
  13. package/dist/cjs/components/features/PDFOutline.cjs +1 -1
  14. package/dist/cjs/components/features/PDFOutline.module.cjs +1 -1
  15. package/dist/cjs/components/features/PDFPageFit.cjs +1 -1
  16. package/dist/cjs/components/features/PDFPrintButton.cjs +1 -1
  17. package/dist/cjs/components/features/PDFRotationControl.cjs +1 -1
  18. package/dist/cjs/components/features/PDFSearch.cjs +1 -1
  19. package/dist/cjs/components/features/PDFSearch.module.cjs +1 -1
  20. package/dist/cjs/components/features/PDFSidebarToggle.cjs +1 -0
  21. package/dist/cjs/components/features/PDFSignatures.cjs +1 -1
  22. package/dist/cjs/components/features/PDFSignatures.module.cjs +1 -1
  23. package/dist/cjs/components/features/PDFThemeToggle.cjs +1 -1
  24. package/dist/cjs/components/features/PDFThumbnails.cjs +1 -1
  25. package/dist/cjs/components/features/PDFThumbnails.module.cjs +1 -1
  26. package/dist/cjs/components/features/PDFZoomControls.cjs +1 -1
  27. package/dist/cjs/components/features/PDFZoomControls.module.cjs +1 -1
  28. package/dist/cjs/components/ui/ToolbarButton.module.cjs +1 -1
  29. package/dist/cjs/components/ui/icons.cjs +1 -1
  30. package/dist/cjs/context/ThemeContext.cjs +1 -1
  31. package/dist/cjs/context/themeContextValue.cjs +1 -0
  32. package/dist/cjs/hooks/useAnnotationLayer.cjs +1 -1
  33. package/dist/cjs/hooks/useAnnotations.cjs +1 -1
  34. package/dist/cjs/hooks/useKeyboardShortcuts.cjs +1 -1
  35. package/dist/cjs/hooks/useOutline.cjs +1 -1
  36. package/dist/cjs/hooks/useOverlayRects.cjs +1 -0
  37. package/dist/cjs/hooks/usePDFLoader.cjs +1 -0
  38. package/dist/cjs/hooks/usePDFRenderer.cjs +1 -0
  39. package/dist/cjs/hooks/useScrollTracking.cjs +1 -1
  40. package/dist/cjs/hooks/useTextLayer.cjs +1 -1
  41. package/dist/cjs/hooks/useTextSearch.cjs +1 -1
  42. package/dist/cjs/hooks/useTheme.cjs +1 -0
  43. package/dist/cjs/hooks/useThumbnails.cjs +1 -1
  44. package/dist/cjs/index.cjs +1 -1
  45. package/dist/cjs/pdf-tsx.css +1 -1
  46. package/dist/components/PDFSidebar.d.ts +1 -1
  47. package/dist/components/PDFViewer.d.ts +2 -0
  48. package/dist/components/features/PDFSidebarToggle.d.ts +7 -0
  49. package/dist/components/ui/icons.d.ts +0 -14
  50. package/dist/context/PDFViewerContext.d.ts +2 -0
  51. package/dist/context/ThemeContext.d.ts +0 -6
  52. package/dist/context/themeContextValue.d.ts +7 -0
  53. package/dist/es/components/PDFSidebar.js +39 -36
  54. package/dist/es/components/PDFSidebar.module.js +9 -7
  55. package/dist/es/components/PDFViewer.js +240 -266
  56. package/dist/es/components/PDFViewer.module.js +15 -15
  57. package/dist/es/components/features/PDFAnnotations.js +57 -64
  58. package/dist/es/components/features/PDFAnnotations.module.js +12 -12
  59. package/dist/es/components/features/PDFChangeFile.js +3 -3
  60. package/dist/es/components/features/PDFDownloadButton.js +2 -2
  61. package/dist/es/components/features/PDFNavigation.js +3 -3
  62. package/dist/es/components/features/PDFNavigation.module.js +3 -3
  63. package/dist/es/components/features/PDFOutline.js +7 -7
  64. package/dist/es/components/features/PDFOutline.module.js +5 -5
  65. package/dist/es/components/features/PDFPageFit.js +1 -1
  66. package/dist/es/components/features/PDFPrintButton.js +5 -4
  67. package/dist/es/components/features/PDFRotationControl.js +1 -1
  68. package/dist/es/components/features/PDFSearch.js +19 -14
  69. package/dist/es/components/features/PDFSearch.module.js +5 -4
  70. package/dist/es/components/features/PDFSidebarToggle.js +21 -0
  71. package/dist/es/components/features/PDFSignatures.js +158 -116
  72. package/dist/es/components/features/PDFSignatures.module.js +16 -16
  73. package/dist/es/components/features/PDFThemeToggle.js +5 -5
  74. package/dist/es/components/features/PDFThumbnails.js +54 -30
  75. package/dist/es/components/features/PDFThumbnails.module.js +9 -7
  76. package/dist/es/components/features/PDFZoomControls.js +1 -1
  77. package/dist/es/components/features/PDFZoomControls.module.js +1 -1
  78. package/dist/es/components/ui/ToolbarButton.module.js +2 -2
  79. package/dist/es/components/ui/icons.js +1 -1
  80. package/dist/es/context/ThemeContext.js +20 -25
  81. package/dist/es/context/themeContextValue.js +5 -0
  82. package/dist/es/hooks/useAnnotationLayer.js +11 -11
  83. package/dist/es/hooks/useAnnotations.js +0 -1
  84. package/dist/es/hooks/useKeyboardShortcuts.js +12 -15
  85. package/dist/es/hooks/useOutline.js +31 -12
  86. package/dist/es/hooks/useOverlayRects.js +72 -0
  87. package/dist/es/hooks/usePDFLoader.js +26 -0
  88. package/dist/es/hooks/usePDFRenderer.js +83 -0
  89. package/dist/es/hooks/useScrollTracking.js +21 -20
  90. package/dist/es/hooks/useTextLayer.js +13 -12
  91. package/dist/es/hooks/useTextSearch.js +30 -18
  92. package/dist/es/hooks/useTheme.js +10 -0
  93. package/dist/es/hooks/useThumbnails.js +86 -24
  94. package/dist/es/index.js +2 -1
  95. package/dist/es/pdf-tsx.css +1 -1
  96. package/dist/hooks/useAnnotationLayer.d.ts +2 -2
  97. package/dist/hooks/useAnnotations.d.ts +0 -5
  98. package/dist/hooks/useKeyboardShortcuts.d.ts +1 -2
  99. package/dist/hooks/useOverlayRects.d.ts +21 -0
  100. package/dist/hooks/usePDFLoader.d.ts +4 -0
  101. package/dist/hooks/usePDFRenderer.d.ts +16 -0
  102. package/dist/hooks/useScrollTracking.d.ts +2 -1
  103. package/dist/hooks/useTextLayer.d.ts +2 -2
  104. package/dist/hooks/useTheme.d.ts +2 -0
  105. package/dist/hooks/useThumbnails.d.ts +3 -2
  106. package/dist/index.d.ts +1 -0
  107. package/dist/pdf-tsx.cjs.js +5 -0
  108. package/dist/pdf-tsx.css +2 -0
  109. package/dist/pdf-tsx.es.js +2637 -0
  110. package/dist/vite.svg +1 -0
  111. package/package.json +61 -61
@@ -1,19 +1,19 @@
1
1
  var e = {
2
- appLayout: "_appLayout_nel8e_1",
3
- mainContent: "_mainContent_nel8e_15",
4
- toolbar: "_toolbar_nel8e_29",
5
- scrollContainer: "_scrollContainer_nel8e_53",
6
- pageWrapper: "_pageWrapper_nel8e_73",
7
- pageCanvas: "_pageCanvas_nel8e_83",
8
- textLayer: "_textLayer_nel8e_97",
9
- markedContent: "_markedContent_nel8e_149",
10
- endOfContent: "_endOfContent_nel8e_177",
11
- selecting: "_selecting_nel8e_195",
12
- pageSkeleton: "_pageSkeleton_nel8e_235",
13
- shimmer: "_shimmer_nel8e_1",
14
- highlightOverlay: "_highlightOverlay_nel8e_267",
15
- linkOverlay: "_linkOverlay_nel8e_283",
16
- searchMatchOverlay: "_searchMatchOverlay_nel8e_295"
2
+ appLayout: "_appLayout_1ug7w_1",
3
+ body: "_body_1ug7w_9",
4
+ toolbar: "_toolbar_1ug7w_17",
5
+ scrollContainer: "_scrollContainer_1ug7w_29",
6
+ pageWrapper: "_pageWrapper_1ug7w_39",
7
+ pageCanvas: "_pageCanvas_1ug7w_44",
8
+ textLayer: "_textLayer_1ug7w_53",
9
+ markedContent: "_markedContent_1ug7w_79",
10
+ endOfContent: "_endOfContent_1ug7w_94",
11
+ selecting: "_selecting_1ug7w_103",
12
+ pageSkeleton: "_pageSkeleton_1ug7w_123",
13
+ shimmer: "_shimmer_1ug7w_1",
14
+ highlightOverlay: "_highlightOverlay_1ug7w_144",
15
+ linkOverlay: "_linkOverlay_1ug7w_153",
16
+ searchMatchOverlay: "_searchMatchOverlay_1ug7w_160"
17
17
  };
18
18
  //#endregion
19
19
  export { e as default };
@@ -1,10 +1,11 @@
1
1
  import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
- import { useAnnotations as t } from "../../hooks/useAnnotations.js";
3
- import n from "./PDFAnnotations.module.js";
4
- import { c as r } from "react/compiler-runtime";
5
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
2
+ import { computeFit as t } from "../../utils/pdfFit.js";
3
+ import { useAnnotations as n } from "../../hooks/useAnnotations.js";
4
+ import r from "./PDFAnnotations.module.js";
5
+ import { c as i } from "react/compiler-runtime";
6
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
6
7
  //#region src/components/features/PDFAnnotations.tsx
7
- var o = {
8
+ var s = {
8
9
  Text: "Nota",
9
10
  Highlight: "Evidenziazione",
10
11
  Underline: "Sottolineatura",
@@ -17,89 +18,81 @@ var o = {
17
18
  Stamp: "Timbro",
18
19
  FileAttachment: "Allegato"
19
20
  };
20
- function s(e) {
21
- return e ? `rgb(${e.r}, ${e.g}, ${e.b})` : "#d4d4d8";
22
- }
23
21
  function c(e) {
24
- let t = r(22), { ann: c, onClick: l } = e, u = o[c.subtype] ?? c.subtype, d = `${n.card} ${c.rect ? n.cardClickable : ""}`, f;
25
- t[0] === c.color ? f = t[1] : (f = s(c.color), t[0] = c.color, t[1] = f);
26
- let p = `3px solid ${f}`, m;
27
- t[2] === p ? m = t[3] : (m = { borderLeft: p }, t[2] = p, t[3] = m);
22
+ let t = i(17), { ann: n, onClick: c } = e, l = s[n.subtype] ?? n.subtype, u = `${r.card} ${n.rect ? r.cardClickable : ""}`, d;
23
+ t[0] === l ? d = t[1] : (d = /* @__PURE__ */ a("span", {
24
+ className: r.cardLabel,
25
+ children: l
26
+ }), t[0] = l, t[1] = d);
27
+ let f;
28
+ t[2] === n.page ? f = t[3] : (f = /* @__PURE__ */ o("span", {
29
+ className: r.cardPage,
30
+ children: ["p.", n.page]
31
+ }), t[2] = n.page, t[3] = f);
32
+ let p;
33
+ t[4] !== d || t[5] !== f ? (p = /* @__PURE__ */ o("div", {
34
+ className: r.cardHeader,
35
+ children: [d, f]
36
+ }), t[4] = d, t[5] = f, t[6] = p) : p = t[6];
37
+ let m;
38
+ t[7] === n.title ? m = t[8] : (m = n.title && /* @__PURE__ */ a("div", {
39
+ className: r.cardAuthor,
40
+ children: n.title
41
+ }), t[7] = n.title, t[8] = m);
28
42
  let h;
29
- t[4] === u ? h = t[5] : (h = /* @__PURE__ */ i("span", {
30
- className: n.cardLabel,
31
- children: u
32
- }), t[4] = u, t[5] = h);
43
+ t[9] === n.contents ? h = t[10] : (h = n.contents && /* @__PURE__ */ a("div", {
44
+ className: r.cardContent,
45
+ children: n.contents
46
+ }), t[9] = n.contents, t[10] = h);
33
47
  let g;
34
- t[6] === c.page ? g = t[7] : (g = /* @__PURE__ */ a("span", {
35
- className: n.cardPage,
36
- children: ["p.", c.page]
37
- }), t[6] = c.page, t[7] = g);
38
- let _;
39
- t[8] !== h || t[9] !== g ? (_ = /* @__PURE__ */ a("div", {
40
- className: n.cardHeader,
41
- children: [h, g]
42
- }), t[8] = h, t[9] = g, t[10] = _) : _ = t[10];
43
- let v;
44
- t[11] === c.title ? v = t[12] : (v = c.title && /* @__PURE__ */ i("div", {
45
- className: n.cardAuthor,
46
- children: c.title
47
- }), t[11] = c.title, t[12] = v);
48
- let y;
49
- t[13] === c.contents ? y = t[14] : (y = c.contents && /* @__PURE__ */ i("div", {
50
- className: n.cardContent,
51
- children: c.contents
52
- }), t[13] = c.contents, t[14] = y);
53
- let b;
54
- return t[15] !== l || t[16] !== d || t[17] !== m || t[18] !== _ || t[19] !== v || t[20] !== y ? (b = /* @__PURE__ */ a("div", {
55
- className: d,
56
- style: m,
57
- onClick: l,
48
+ return t[11] !== c || t[12] !== u || t[13] !== p || t[14] !== m || t[15] !== h ? (g = /* @__PURE__ */ o("div", {
49
+ className: u,
50
+ onClick: c,
58
51
  children: [
59
- _,
60
- v,
61
- y
52
+ p,
53
+ m,
54
+ h
62
55
  ]
63
- }), t[15] = l, t[16] = d, t[17] = m, t[18] = _, t[19] = v, t[20] = y, t[21] = b) : b = t[21], b;
56
+ }), t[11] = c, t[12] = u, t[13] = p, t[14] = m, t[15] = h, t[16] = g) : g = t[16], g;
64
57
  }
65
- function l(o) {
66
- let s = r(8), { icon: c } = o, { pdf: l } = e(), u;
58
+ function l(t) {
59
+ let s = i(8), { icon: c } = t, { pdf: l } = e(), u;
67
60
  s[0] === l ? u = s[1] : (u = { pdf: l }, s[0] = l, s[1] = u);
68
- let { annotations: d, loading: f } = t(u), p = d.length, m;
69
- s[2] !== p || s[3] !== f ? (m = !f && p > 0 && /* @__PURE__ */ i("span", {
70
- className: n.badge,
61
+ let { annotations: d, loading: f } = n(u), p = d.length, m;
62
+ s[2] !== p || s[3] !== f ? (m = !f && p > 0 && /* @__PURE__ */ a("span", {
63
+ className: r.badge,
71
64
  children: p > 99 ? "99+" : p
72
65
  }), s[2] = p, s[3] = f, s[4] = m) : m = s[4];
73
66
  let h;
74
- return s[5] !== c || s[6] !== m ? (h = /* @__PURE__ */ a("span", {
75
- className: n.iconWrapper,
67
+ return s[5] !== c || s[6] !== m ? (h = /* @__PURE__ */ o("span", {
68
+ className: r.iconWrapper,
76
69
  children: [c, m]
77
70
  }), s[5] = c, s[6] = m, s[7] = h) : h = s[7], h;
78
71
  }
79
72
  function u() {
80
- let { pdf: r, goToPage: o, setHighlight: s } = e(), { annotations: l, loading: u } = t({ pdf: r }), d = (e) => {
81
- o(e.page), e.rect && s({
73
+ let { pdf: i, goToPage: s, setHighlight: l, setZoom: u, rotation: d, containerRef: f } = e(), { annotations: p, loading: m } = n({ pdf: i }), h = async (e) => {
74
+ i && f.current && u(await t("page", i, f.current, d)), s(e.page), e.rect && l({
82
75
  page: e.page,
83
76
  pdfRect: e.rect
84
77
  });
85
- }, f = l.reduce((e, t) => ((e[t.page] ??= []).push(t), e), {});
86
- return /* @__PURE__ */ a("div", {
87
- className: n.list,
78
+ }, g = p.reduce((e, t) => ((e[t.page] ??= []).push(t), e), {});
79
+ return /* @__PURE__ */ o("div", {
80
+ className: r.list,
88
81
  children: [
89
- u && /* @__PURE__ */ i("div", {
90
- className: n.emptyState,
82
+ m && /* @__PURE__ */ a("div", {
83
+ className: r.emptyState,
91
84
  children: "Caricamento..."
92
85
  }),
93
- !u && l.length === 0 && /* @__PURE__ */ i("div", {
94
- className: n.emptyState,
86
+ !m && p.length === 0 && /* @__PURE__ */ a("div", {
87
+ className: r.emptyState,
95
88
  children: "Nessuna annotazione rilevata."
96
89
  }),
97
- !u && Object.entries(f).map(([e, t]) => /* @__PURE__ */ a("div", { children: [/* @__PURE__ */ a("div", {
98
- className: n.pageHeader,
90
+ !m && Object.entries(g).map(([e, t]) => /* @__PURE__ */ o("div", { children: [/* @__PURE__ */ o("div", {
91
+ className: r.pageHeader,
99
92
  children: ["Pagina ", e]
100
- }), t.map((e) => /* @__PURE__ */ i(c, {
93
+ }), t.map((e) => /* @__PURE__ */ a(c, {
101
94
  ann: e,
102
- onClick: () => d(e)
95
+ onClick: () => h(e)
103
96
  }, e.id))] }, e))
104
97
  ]
105
98
  });
@@ -1,16 +1,16 @@
1
1
  var e = {
2
- list: "_list_10scn_1",
3
- emptyState: "_emptyState_10scn_11",
4
- pageHeader: "_pageHeader_10scn_23",
5
- card: "_card_10scn_45",
6
- cardClickable: "_cardClickable_10scn_65",
7
- cardHeader: "_cardHeader_10scn_81",
8
- cardLabel: "_cardLabel_10scn_95",
9
- cardPage: "_cardPage_10scn_107",
10
- cardAuthor: "_cardAuthor_10scn_117",
11
- cardContent: "_cardContent_10scn_129",
12
- iconWrapper: "_iconWrapper_10scn_141",
13
- badge: "_badge_10scn_155"
2
+ list: "_list_r71a6_1",
3
+ emptyState: "_emptyState_r71a6_6",
4
+ pageHeader: "_pageHeader_r71a6_12",
5
+ card: "_card_r71a6_23",
6
+ cardClickable: "_cardClickable_r71a6_33",
7
+ cardHeader: "_cardHeader_r71a6_41",
8
+ cardLabel: "_cardLabel_r71a6_48",
9
+ cardPage: "_cardPage_r71a6_54",
10
+ cardAuthor: "_cardAuthor_r71a6_59",
11
+ cardContent: "_cardContent_r71a6_65",
12
+ iconWrapper: "_iconWrapper_r71a6_71",
13
+ badge: "_badge_r71a6_78"
14
14
  };
15
15
  //#endregion
16
16
  export { e as default };
@@ -1,11 +1,11 @@
1
1
  import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
2
  import { ToolbarButton as t } from "../ui/ToolbarButton.js";
3
- import { useRef as n } from "react";
4
- import { c as r } from "react/compiler-runtime";
3
+ import { c as n } from "react/compiler-runtime";
4
+ import { useRef as r } from "react";
5
5
  import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
6
6
  //#region src/components/features/PDFChangeFile.tsx
7
7
  function s(s) {
8
- let c = r(11), { icon: l } = s, { onChangeFile: u } = e(), d = n(null), f;
8
+ let c = n(11), { icon: l } = s, { onChangeFile: u } = e(), d = r(null), f;
9
9
  c[0] === u ? f = c[1] : (f = (e) => {
10
10
  let t = e.target.files?.[0];
11
11
  t && u?.(t), e.target.value = "";
@@ -1,14 +1,14 @@
1
1
  import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
2
  import { ToolbarButton as t } from "../ui/ToolbarButton.js";
3
- import "react";
4
3
  import { c as n } from "react/compiler-runtime";
4
+ import "react";
5
5
  import { jsxs as r } from "react/jsx-runtime";
6
6
  //#region src/components/features/PDFDownloadButton.tsx
7
7
  function i(i) {
8
8
  let a = n(5), { icon: o } = i, { file: s } = e(), c;
9
9
  a[0] === s ? c = a[1] : (c = () => {
10
10
  let e = URL.createObjectURL(s), t = document.createElement("a");
11
- t.href = e, t.download = s.name || "documento.pdf", t.click(), URL.revokeObjectURL(e);
11
+ t.href = e, t.download = s.name || "documento.pdf", t.click(), setTimeout(() => URL.revokeObjectURL(e), 0);
12
12
  }, a[0] = s, a[1] = c);
13
13
  let l = c, u;
14
14
  return a[2] !== l || a[3] !== o ? (u = /* @__PURE__ */ r(t, {
@@ -1,12 +1,12 @@
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 "./PDFNavigation.module.js";
4
- import { useState as r } from "react";
5
- import { c as i } from "react/compiler-runtime";
4
+ import { c as r } from "react/compiler-runtime";
5
+ import { useState as i } from "react";
6
6
  import { jsx as a, jsxs as o } from "react/jsx-runtime";
7
7
  //#region src/components/features/PDFNavigation.tsx
8
8
  function s(s) {
9
- let c = i(34), { prevIcon: l, nextIcon: u } = s, { currentPage: d, numPages: f, goToPage: p } = e(), [m, h] = r(!1), [g, _] = r(""), v;
9
+ let c = r(34), { prevIcon: l, nextIcon: u } = s, { currentPage: d, numPages: f, goToPage: p } = e(), [m, h] = i(!1), [g, _] = i(""), v;
10
10
  c[0] !== p || c[1] !== g ? (v = () => {
11
11
  let e = parseInt(g, 10);
12
12
  isNaN(e) || p(e), h(!1);
@@ -1,7 +1,7 @@
1
1
  var e = {
2
- navWrapper: "_navWrapper_6ysgx_1",
3
- pageInput: "_pageInput_6ysgx_15",
4
- pageTotal: "_pageTotal_6ysgx_71"
2
+ navWrapper: "_navWrapper_hrnrb_1",
3
+ pageInput: "_pageInput_hrnrb_7",
4
+ pageTotal: "_pageTotal_hrnrb_35"
5
5
  };
6
6
  //#endregion
7
7
  export { e as default };
@@ -2,8 +2,8 @@ import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
2
  import { useOutline as t } from "../../hooks/useOutline.js";
3
3
  import { IconChevronDown as n, IconChevronRight as r } from "../ui/icons.js";
4
4
  import i from "./PDFOutline.module.js";
5
- import { useState as a } from "react";
6
- import { c as o } from "react/compiler-runtime";
5
+ import { c as a } from "react/compiler-runtime";
6
+ import { useState as o } from "react";
7
7
  import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
8
8
  //#region src/components/features/PDFOutline.tsx
9
9
  async function u(e, t) {
@@ -18,7 +18,7 @@ async function u(e, t) {
18
18
  }
19
19
  }
20
20
  function d(e) {
21
- let t = o(25), { node: u, depth: p, onNavigate: m } = e, [h, g] = a(p === 0), _ = u.items.length > 0, v = 12 + p * 14, y = u.bold ? 600 : 400, b = u.italic ? "italic" : "normal", x;
21
+ let t = a(25), { node: u, depth: p, onNavigate: m } = e, [h, g] = o(p === 0), _ = u.items.length > 0, v = 12 + p * 14, y = u.bold ? 600 : 400, b = u.italic ? "italic" : "normal", x;
22
22
  t[0] !== v || t[1] !== y || t[2] !== b ? (x = {
23
23
  paddingLeft: v,
24
24
  fontWeight: y,
@@ -63,13 +63,13 @@ function f(e) {
63
63
  return !e;
64
64
  }
65
65
  function p() {
66
- let n = o(18), { pdf: r, goToPage: a } = e(), s;
66
+ let n = a(18), { pdf: r, goToPage: o } = e(), s;
67
67
  n[0] === r ? s = n[1] : (s = { pdf: r }, n[0] = r, n[1] = s);
68
68
  let { outline: f, loading: p } = t(s), m;
69
- n[2] !== a || n[3] !== r ? (m = async (e) => {
69
+ n[2] !== o || n[3] !== r ? (m = async (e) => {
70
70
  let t = await u(r, e);
71
- t !== null && a(t);
72
- }, n[2] = a, n[3] = r, n[4] = m) : m = n[4];
71
+ t !== null && o(t);
72
+ }, n[2] = o, n[3] = r, n[4] = m) : m = n[4];
73
73
  let h = m, g;
74
74
  n[5] === p ? g = n[6] : (g = p && /* @__PURE__ */ c("div", {
75
75
  className: i.emptyState,
@@ -1,9 +1,9 @@
1
1
  var e = {
2
- emptyState: "_emptyState_1w4ic_1",
3
- tree: "_tree_1w4ic_13",
4
- row: "_row_1w4ic_25",
5
- chevronBtn: "_chevronBtn_1w4ic_61",
6
- title: "_title_1w4ic_91"
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
7
  };
8
8
  //#endregion
9
9
  export { e as default };
@@ -1,8 +1,8 @@
1
1
  import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
2
  import { computeFit as t } from "../../utils/pdfFit.js";
3
3
  import { ToolbarButton as n } from "../ui/ToolbarButton.js";
4
- import "react";
5
4
  import { c as r } from "react/compiler-runtime";
5
+ import "react";
6
6
  import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
7
7
  //#region src/components/features/PDFPageFit.tsx
8
8
  function s(s) {
@@ -1,7 +1,7 @@
1
1
  import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
2
  import { ToolbarButton as t } from "../ui/ToolbarButton.js";
3
- import "react";
4
3
  import { c as n } from "react/compiler-runtime";
4
+ import "react";
5
5
  import { jsx as r } from "react/jsx-runtime";
6
6
  //#region src/components/features/PDFPrintButton.tsx
7
7
  function i(i) {
@@ -9,9 +9,10 @@ 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?.addEventListener("afterprint", () => {
13
- document.body.removeChild(t), URL.revokeObjectURL(e);
14
- }, { once: !0 }), t.contentWindow?.print();
12
+ let n = !1, r = () => {
13
+ n || (n = !0, t.remove(), URL.revokeObjectURL(e));
14
+ };
15
+ t.contentWindow?.addEventListener("afterprint", r, { once: !0 }), setTimeout(r, 6e4), t.contentWindow?.print();
15
16
  };
16
17
  }, a[0] = s, a[1] = c);
17
18
  let l = c, u;
@@ -1,7 +1,7 @@
1
1
  import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
2
  import { ToolbarButton as t } from "../ui/ToolbarButton.js";
3
- import "react";
4
3
  import { c as n } from "react/compiler-runtime";
4
+ import "react";
5
5
  import { jsx as r } from "react/jsx-runtime";
6
6
  //#region src/components/features/PDFRotationControl.tsx
7
7
  function i(i) {
@@ -1,18 +1,18 @@
1
1
  import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
2
  import { useTextSearch as t } from "../../hooks/useTextSearch.js";
3
3
  import n from "./PDFSearch.module.js";
4
- import { useEffect as r, useState as i } from "react";
5
- import { c as a } from "react/compiler-runtime";
4
+ import { c as r } from "react/compiler-runtime";
5
+ import { useEffect as i, useState as a } from "react";
6
6
  import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
7
7
  //#region src/components/features/PDFSearch.tsx
8
8
  function l(l) {
9
- let u = a(33), { searchIcon: d, prevIcon: f, nextIcon: p, clearIcon: m } = l, { pdf: h, goToPage: g, setHighlight: _, setSearchMatches: v } = e(), [y, b] = i(""), [x, S] = i(0), C;
9
+ let u = r(35), { searchIcon: d, prevIcon: f, nextIcon: p, clearIcon: m } = l, { pdf: h, goToPage: g, setHighlight: _, setSearchMatches: v } = e(), [y, b] = a(""), [x, S] = a(0), C;
10
10
  u[0] !== h || u[1] !== y ? (C = {
11
11
  pdf: h,
12
12
  query: y
13
13
  }, u[0] = h, u[1] = y, u[2] = C) : C = u[2];
14
14
  let { matches: w, searching: T } = t(C), E = w.length, D, O;
15
- 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]), r(D, O);
15
+ 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);
16
16
  let k;
17
17
  u[7] !== g || u[8] !== w || u[9] !== _ || u[10] !== E ? (k = (e) => {
18
18
  let t = (e + E) % E;
@@ -32,14 +32,19 @@ function l(l) {
32
32
  b(""), S(0), _(null);
33
33
  }, u[14] = _, u[15] = N);
34
34
  let P = N, F;
35
- u[16] !== M || u[17] !== y ? (F = /* @__PURE__ */ s("input", {
35
+ u[16] === d ? F = u[17] : (F = /* @__PURE__ */ s("span", {
36
+ className: n.searchIconWrapper,
37
+ children: d
38
+ }), u[16] = d, u[17] = F);
39
+ let I;
40
+ u[18] !== M || u[19] !== y ? (I = /* @__PURE__ */ s("input", {
36
41
  className: n.searchInput,
37
42
  value: y,
38
43
  onChange: M,
39
44
  placeholder: "Cerca nel documento..."
40
- }), u[16] = M, u[17] = y, u[18] = F) : F = u[18];
41
- let I;
42
- 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: [
45
+ }), u[18] = M, u[19] = y, u[20] = I) : I = u[20];
46
+ let L;
47
+ u[21] !== m || u[22] !== P || u[23] !== x || u[24] !== A || u[25] !== p || u[26] !== f || u[27] !== y || u[28] !== T || u[29] !== E ? (L = y && /* @__PURE__ */ c(o, { children: [
43
48
  /* @__PURE__ */ s("span", {
44
49
  className: n.counter,
45
50
  children: T ? "…" : E === 0 ? "0" : `${x + 1}/${E}`
@@ -61,16 +66,16 @@ function l(l) {
61
66
  onClick: P,
62
67
  children: m
63
68
  })
64
- ] }), 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];
65
- let L;
66
- return u[29] !== d || u[30] !== F || u[31] !== I ? (L = /* @__PURE__ */ c("div", {
69
+ ] }), u[21] = m, u[22] = P, u[23] = x, u[24] = A, u[25] = p, u[26] = f, u[27] = y, u[28] = T, u[29] = E, u[30] = L) : L = u[30];
70
+ let R;
71
+ return u[31] !== F || u[32] !== I || u[33] !== L ? (R = /* @__PURE__ */ c("div", {
67
72
  className: n.wrapper,
68
73
  children: [
69
- d,
70
74
  F,
71
- I
75
+ I,
76
+ L
72
77
  ]
73
- }), u[29] = d, u[30] = F, u[31] = I, u[32] = L) : L = u[32], L;
78
+ }), u[31] = F, u[32] = I, u[33] = L, u[34] = R) : R = u[34], R;
74
79
  }
75
80
  //#endregion
76
81
  export { l as PDFSearch };
@@ -1,8 +1,9 @@
1
1
  var e = {
2
- wrapper: "_wrapper_yinyt_1",
3
- searchInput: "_searchInput_yinyt_13",
4
- navButton: "_navButton_yinyt_53",
5
- counter: "_counter_yinyt_95"
2
+ wrapper: "_wrapper_18kvs_1",
3
+ searchIconWrapper: "_searchIconWrapper_18kvs_7",
4
+ searchInput: "_searchInput_18kvs_13",
5
+ navButton: "_navButton_18kvs_33",
6
+ counter: "_counter_18kvs_54"
6
7
  };
7
8
  //#endregion
8
9
  export { e as default };
@@ -0,0 +1,21 @@
1
+ import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
+ import t from "../ui/ToolbarButton.module.js";
3
+ import { c as n } from "react/compiler-runtime";
4
+ import { jsx as r } from "react/jsx-runtime";
5
+ //#region src/components/features/PDFSidebarToggle.tsx
6
+ function i(i) {
7
+ let o = n(6), { collapseIcon: s, expandIcon: c } = i, { sidebarCollapsed: l, setSidebarCollapsed: u } = e(), d;
8
+ o[0] === u ? d = o[1] : (d = () => u(a), o[0] = u, o[1] = d);
9
+ let f = l ? "Espandi sidebar" : "Comprimi sidebar", p = l ? c ?? s : s, m;
10
+ return o[2] !== d || o[3] !== f || o[4] !== p ? (m = /* @__PURE__ */ r("button", {
11
+ className: t.btn,
12
+ onClick: d,
13
+ title: f,
14
+ children: p
15
+ }), o[2] = d, o[3] = f, o[4] = p, o[5] = m) : m = o[5], m;
16
+ }
17
+ function a(e) {
18
+ return !e;
19
+ }
20
+ //#endregion
21
+ export { i as PDFSidebarToggle };