pdf-tsx 0.1.1 → 0.1.3

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 (58) hide show
  1. package/README.md +10 -0
  2. package/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -1
  3. package/dist/cjs/components/PDFSidebar.cjs +1 -1
  4. package/dist/cjs/components/features/PDFAnnotations.cjs +1 -1
  5. package/dist/cjs/components/features/PDFChangeFile.cjs +1 -1
  6. package/dist/cjs/components/features/PDFDownloadButton.cjs +1 -1
  7. package/dist/cjs/components/features/PDFNavigation.cjs +1 -1
  8. package/dist/cjs/components/features/PDFOutline.cjs +1 -1
  9. package/dist/cjs/components/features/PDFPageFit.cjs +1 -1
  10. package/dist/cjs/components/features/PDFPrintButton.cjs +1 -1
  11. package/dist/cjs/components/features/PDFRotationControl.cjs +1 -1
  12. package/dist/cjs/components/features/PDFSearch.cjs +1 -1
  13. package/dist/cjs/components/features/PDFSignatures.cjs +1 -1
  14. package/dist/cjs/components/features/PDFThemeToggle.cjs +1 -1
  15. package/dist/cjs/components/features/PDFThumbnails.cjs +1 -1
  16. package/dist/cjs/components/features/PDFZoomControls.cjs +1 -1
  17. package/dist/cjs/components/ui/ToolbarButton.cjs +1 -1
  18. package/dist/cjs/components/ui/icons.cjs +1 -1
  19. package/dist/cjs/context/ThemeContext.cjs +1 -1
  20. package/dist/cjs/hooks/useAnnotationLayer.cjs +1 -1
  21. package/dist/cjs/hooks/useKeyboardShortcuts.cjs +1 -1
  22. package/dist/cjs/hooks/useOutline.cjs +1 -1
  23. package/dist/cjs/hooks/useScrollTracking.cjs +1 -1
  24. package/dist/cjs/hooks/useTextLayer.cjs +1 -1
  25. package/dist/cjs/hooks/useTextSearch.cjs +1 -1
  26. package/dist/cjs/hooks/useThumbnails.cjs +1 -1
  27. package/dist/es/components/PDFSidebar.js +17 -18
  28. package/dist/es/components/features/PDFAnnotations.js +32 -32
  29. package/dist/es/components/features/PDFChangeFile.js +7 -8
  30. package/dist/es/components/features/PDFDownloadButton.js +6 -7
  31. package/dist/es/components/features/PDFNavigation.js +12 -13
  32. package/dist/es/components/features/PDFOutline.js +42 -43
  33. package/dist/es/components/features/PDFPageFit.js +10 -10
  34. package/dist/es/components/features/PDFPrintButton.js +6 -7
  35. package/dist/es/components/features/PDFRotationControl.js +9 -10
  36. package/dist/es/components/features/PDFSearch.js +15 -16
  37. package/dist/es/components/features/PDFSignatures.js +55 -56
  38. package/dist/es/components/features/PDFThemeToggle.js +7 -8
  39. package/dist/es/components/features/PDFThumbnails.js +20 -21
  40. package/dist/es/components/features/PDFZoomControls.js +20 -21
  41. package/dist/es/components/ui/ToolbarButton.js +7 -8
  42. package/dist/es/components/ui/icons.js +9 -9
  43. package/dist/es/context/ThemeContext.js +19 -19
  44. package/dist/es/hooks/useAnnotationLayer.js +16 -17
  45. package/dist/es/hooks/useKeyboardShortcuts.js +15 -16
  46. package/dist/es/hooks/useOutline.js +7 -8
  47. package/dist/es/hooks/useScrollTracking.js +11 -11
  48. package/dist/es/hooks/useTextLayer.js +13 -14
  49. package/dist/es/hooks/useTextSearch.js +7 -8
  50. package/dist/es/hooks/useThumbnails.js +7 -8
  51. package/package.json +8 -3
  52. package/dist/cjs/node_modules/react/cjs/react-compiler-runtime.development.cjs +0 -5
  53. package/dist/cjs/node_modules/react/cjs/react-compiler-runtime.production.cjs +0 -1
  54. package/dist/cjs/node_modules/react/compiler-runtime.cjs +0 -1
  55. package/dist/es/_virtual/_rolldown/runtime.js +0 -7
  56. package/dist/es/node_modules/react/cjs/react-compiler-runtime.development.js +0 -14
  57. package/dist/es/node_modules/react/cjs/react-compiler-runtime.production.js +0 -11
  58. package/dist/es/node_modules/react/compiler-runtime.js +0 -10
@@ -1,40 +1,39 @@
1
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";
2
+ import { useThumbnails as t } from "../../hooks/useThumbnails.js";
3
+ import n from "./PDFThumbnails.module.js";
4
+ import { c as r } from "react/compiler-runtime";
5
5
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
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 = {
7
+ function o() {
8
+ let o = r(12), { pdf: s, rotation: c, currentPage: l, goToPage: u } = e(), d;
9
+ o[0] !== s || o[1] !== c ? (d = {
11
10
  pdf: s,
12
11
  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) {
12
+ }, o[0] = s, o[1] = c, o[2] = d) : d = o[2];
13
+ let { thumbnails: f } = t(d), p;
14
+ if (o[3] !== l || o[4] !== u || o[5] !== f) {
16
15
  let e;
17
- t[7] !== l || t[8] !== u ? (e = (e, t) => {
18
- let n = l === t + 1;
16
+ o[7] !== l || o[8] !== u ? (e = (e, t) => {
17
+ let r = l === t + 1;
19
18
  return /* @__PURE__ */ a("div", {
20
- className: `${r.thumbnailItem} ${n ? r.thumbnailItemActive : ""}`,
19
+ className: `${n.thumbnailItem} ${r ? n.thumbnailItemActive : ""}`,
21
20
  onClick: () => u(t + 1),
22
21
  children: [/* @__PURE__ */ i("img", {
23
22
  src: e,
24
- className: `${r.thumbnailImg} ${n ? r.thumbnailImgActive : ""}`,
23
+ className: `${n.thumbnailImg} ${r ? n.thumbnailImgActive : ""}`,
25
24
  alt: `Anteprima pagina ${t + 1}`
26
25
  }), /* @__PURE__ */ i("div", {
27
- className: `${r.thumbnailLabel} ${n ? r.thumbnailLabelActive : ""}`,
26
+ className: `${n.thumbnailLabel} ${r ? n.thumbnailLabelActive : ""}`,
28
27
  children: t + 1
29
28
  })]
30
29
  }, 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];
30
+ }, o[7] = l, o[8] = u, o[9] = e) : e = o[9], p = f.map(e), o[3] = l, o[4] = u, o[5] = f, o[6] = p;
31
+ } else p = o[6];
33
32
  let m;
34
- return t[10] === p ? m = t[11] : (m = /* @__PURE__ */ i("div", {
35
- className: r.thumbnailList,
33
+ return o[10] === p ? m = o[11] : (m = /* @__PURE__ */ i("div", {
34
+ className: n.thumbnailList,
36
35
  children: p
37
- }), t[10] = p, t[11] = m), m;
36
+ }), o[10] = p, o[11] = m), m;
38
37
  }
39
38
  //#endregion
40
- export { s as PDFThumbnails };
39
+ export { o as PDFThumbnails };
@@ -1,47 +1,46 @@
1
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 "./PDFZoomControls.module.js";
2
+ import { ToolbarButton as t } from "../ui/ToolbarButton.js";
3
+ import n from "./PDFZoomControls.module.js";
5
4
  import "react";
5
+ import { c as r } from "react/compiler-runtime";
6
6
  import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
7
7
  //#region src/components/features/PDFZoomControls.tsx
8
- var s = t();
9
- function c(t) {
10
- let c = (0, s.c)(18), { zoomOutIcon: d, zoomInIcon: f } = t, { zoom: p, setZoom: m } = e(), h;
11
- c[0] === m ? h = c[1] : (h = () => m(u), c[0] = m, c[1] = h);
8
+ function s(s) {
9
+ let u = r(18), { zoomOutIcon: d, zoomInIcon: f } = s, { zoom: p, setZoom: m } = e(), h;
10
+ u[0] === m ? h = u[1] : (h = () => m(l), u[0] = m, u[1] = h);
12
11
  let g;
13
- c[2] !== h || c[3] !== d ? (g = /* @__PURE__ */ a(n, {
12
+ u[2] !== h || u[3] !== d ? (g = /* @__PURE__ */ a(t, {
14
13
  onClick: h,
15
14
  title: "Riduci zoom",
16
15
  children: d
17
- }), c[2] = h, c[3] = d, c[4] = g) : g = c[4];
16
+ }), u[2] = h, u[3] = d, u[4] = g) : g = u[4];
18
17
  let _;
19
- c[5] === p ? _ = c[6] : (_ = Math.round(p * 100), c[5] = p, c[6] = _);
18
+ u[5] === p ? _ = u[6] : (_ = Math.round(p * 100), u[5] = p, u[6] = _);
20
19
  let v;
21
- c[7] === _ ? v = c[8] : (v = /* @__PURE__ */ o("span", {
22
- className: r.zoomLabel,
20
+ u[7] === _ ? v = u[8] : (v = /* @__PURE__ */ o("span", {
21
+ className: n.zoomLabel,
23
22
  children: [_, "%"]
24
- }), c[7] = _, c[8] = v);
23
+ }), u[7] = _, u[8] = v);
25
24
  let y;
26
- c[9] === m ? y = c[10] : (y = () => m(l), c[9] = m, c[10] = y);
25
+ u[9] === m ? y = u[10] : (y = () => m(c), u[9] = m, u[10] = y);
27
26
  let b;
28
- c[11] !== y || c[12] !== f ? (b = /* @__PURE__ */ a(n, {
27
+ u[11] !== y || u[12] !== f ? (b = /* @__PURE__ */ a(t, {
29
28
  onClick: y,
30
29
  title: "Aumenta zoom",
31
30
  children: f
32
- }), c[11] = y, c[12] = f, c[13] = b) : b = c[13];
31
+ }), u[11] = y, u[12] = f, u[13] = b) : b = u[13];
33
32
  let x;
34
- return c[14] !== g || c[15] !== v || c[16] !== b ? (x = /* @__PURE__ */ o(i, { children: [
33
+ return u[14] !== g || u[15] !== v || u[16] !== b ? (x = /* @__PURE__ */ o(i, { children: [
35
34
  g,
36
35
  v,
37
36
  b
38
- ] }), c[14] = g, c[15] = v, c[16] = b, c[17] = x) : x = c[17], x;
37
+ ] }), u[14] = g, u[15] = v, u[16] = b, u[17] = x) : x = u[17], x;
39
38
  }
40
- function l(e) {
39
+ function c(e) {
41
40
  return Math.min(e + .2, 3);
42
41
  }
43
- function u(e) {
42
+ function l(e) {
44
43
  return Math.max(e - .2, .2);
45
44
  }
46
45
  //#endregion
47
- export { c as PDFZoomControls };
46
+ export { s as PDFZoomControls };
@@ -1,16 +1,15 @@
1
- import { require_compiler_runtime as e } from "../../node_modules/react/compiler-runtime.js";
2
- import t from "./ToolbarButton.module.js";
1
+ import e from "./ToolbarButton.module.js";
2
+ import { c as t } from "react/compiler-runtime";
3
3
  import { jsx as n } from "react/jsx-runtime";
4
4
  //#region src/components/ui/ToolbarButton.tsx
5
- var r = e();
6
- function i(e) {
7
- let i = (0, r.c)(7), a, o, s;
8
- i[0] === e ? (a = i[1], o = i[2], s = i[3]) : ({$primary: a, className: o, ...s} = e, i[0] = e, i[1] = a, i[2] = o, i[3] = s);
9
- let c = a ? `${t.btn} ${t.primary}` : t.btn, l = o ? `${c} ${o}` : c, u;
5
+ function r(r) {
6
+ let i = t(7), a, o, s;
7
+ i[0] === r ? (a = i[1], o = i[2], s = i[3]) : ({$primary: a, className: o, ...s} = r, i[0] = r, i[1] = a, i[2] = o, i[3] = s);
8
+ let c = a ? `${e.btn} ${e.primary}` : e.btn, l = o ? `${c} ${o}` : c, u;
10
9
  return i[4] !== s || i[5] !== l ? (u = /* @__PURE__ */ n("button", {
11
10
  className: l,
12
11
  ...s
13
12
  }), i[4] = s, i[5] = l, i[6] = u) : u = i[6], u;
14
13
  }
15
14
  //#endregion
16
- export { i as ToolbarButton };
15
+ export { r as ToolbarButton };
@@ -1,8 +1,8 @@
1
- import { require_compiler_runtime as e } from "../../node_modules/react/compiler-runtime.js";
2
1
  import "react";
2
+ import { c as e } from "react/compiler-runtime";
3
3
  import { jsx as t } from "react/jsx-runtime";
4
4
  //#region src/components/ui/icons.tsx
5
- var n = e(), r = (e, n = 16) => /* @__PURE__ */ t("svg", {
5
+ var n = (e, n = 16) => /* @__PURE__ */ t("svg", {
6
6
  xmlns: "http://www.w3.org/2000/svg",
7
7
  width: n,
8
8
  height: n,
@@ -13,16 +13,16 @@ var n = e(), r = (e, n = 16) => /* @__PURE__ */ t("svg", {
13
13
  strokeLinecap: "round",
14
14
  strokeLinejoin: "round",
15
15
  children: e
16
- }), i = (e) => {
17
- let i = (0, n.c)(3), { size: a } = e, o;
16
+ }), r = (r) => {
17
+ let i = e(3), { size: a } = r, o;
18
18
  i[0] === Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ t("polyline", { points: "9 18 15 12 9 6" }), i[0] = o) : o = i[0];
19
19
  let s;
20
- return i[1] === a ? s = i[2] : (s = r(o, a), i[1] = a, i[2] = s), s;
21
- }, a = (e) => {
22
- let i = (0, n.c)(3), { size: a } = e, o;
20
+ return i[1] === a ? s = i[2] : (s = n(o, a), i[1] = a, i[2] = s), s;
21
+ }, i = (r) => {
22
+ let i = e(3), { size: a } = r, o;
23
23
  i[0] === Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ t("polyline", { points: "6 9 12 15 18 9" }), i[0] = o) : o = i[0];
24
24
  let s;
25
- return i[1] === a ? s = i[2] : (s = r(o, a), i[1] = a, i[2] = s), s;
25
+ return i[1] === a ? s = i[2] : (s = n(o, a), i[1] = a, i[2] = s), s;
26
26
  };
27
27
  //#endregion
28
- export { a as IconChevronDown, i as IconChevronRight };
28
+ export { i as IconChevronDown, r as IconChevronRight };
@@ -1,43 +1,43 @@
1
- import { require_compiler_runtime as e } from "../node_modules/react/compiler-runtime.js";
2
- import { darkTheme as t, lightTheme as n, themeToCssVars as r } from "../theme.js";
3
- import { createContext as i, useContext as a, useState as o } from "react";
1
+ import { darkTheme as e, lightTheme as t, themeToCssVars as n } from "../theme.js";
2
+ import { createContext as r, useContext as i, useState as a } from "react";
3
+ import { c as o } from "react/compiler-runtime";
4
4
  import { jsx as s } from "react/jsx-runtime";
5
5
  //#region src/context/ThemeContext.tsx
6
- var c = e(), l = i(null);
7
- function u(e) {
8
- let i = (0, c.c)(14), { children: a } = e, [u, f] = o(!0), p = u ? t : n, m;
9
- i[0] === p ? m = i[1] : (m = r(p), i[0] = p, i[1] = m);
6
+ var c = r(null);
7
+ function l(r) {
8
+ let i = o(14), { children: l } = r, [d, f] = a(!0), p = d ? e : t, m;
9
+ i[0] === p ? m = i[1] : (m = n(p), i[0] = p, i[1] = m);
10
10
  let h = m, g;
11
- i[2] === Symbol.for("react.memo_cache_sentinel") ? (g = () => f(d), i[2] = g) : g = i[2];
11
+ i[2] === Symbol.for("react.memo_cache_sentinel") ? (g = () => f(u), i[2] = g) : g = i[2];
12
12
  let _;
13
- i[3] !== u || i[4] !== p ? (_ = {
14
- isDark: u,
13
+ i[3] !== d || i[4] !== p ? (_ = {
14
+ isDark: d,
15
15
  toggleTheme: g,
16
16
  theme: p
17
- }, i[3] = u, i[4] = p, i[5] = _) : _ = i[5];
17
+ }, i[3] = d, i[4] = p, i[5] = _) : _ = i[5];
18
18
  let v = h, y;
19
19
  i[6] === v ? y = i[7] : (y = {
20
20
  ...v,
21
21
  display: "contents"
22
22
  }, i[6] = v, i[7] = y);
23
23
  let b;
24
- i[8] !== a || i[9] !== y ? (b = /* @__PURE__ */ s("div", {
24
+ i[8] !== l || i[9] !== y ? (b = /* @__PURE__ */ s("div", {
25
25
  style: y,
26
- children: a
27
- }), i[8] = a, i[9] = y, i[10] = b) : b = i[10];
26
+ children: l
27
+ }), i[8] = l, i[9] = y, i[10] = b) : b = i[10];
28
28
  let x;
29
- return i[11] !== _ || i[12] !== b ? (x = /* @__PURE__ */ s(l.Provider, {
29
+ return i[11] !== _ || i[12] !== b ? (x = /* @__PURE__ */ s(c.Provider, {
30
30
  value: _,
31
31
  children: b
32
32
  }), i[11] = _, i[12] = b, i[13] = x) : x = i[13], x;
33
33
  }
34
- function d(e) {
34
+ function u(e) {
35
35
  return !e;
36
36
  }
37
- function f() {
38
- let e = a(l);
37
+ function d() {
38
+ let e = i(c);
39
39
  if (!e) throw Error("useTheme must be used inside <ThemeProvider>");
40
40
  return e;
41
41
  }
42
42
  //#endregion
43
- export { u as ThemeProvider, f as useTheme };
43
+ export { l as ThemeProvider, d as useTheme };
@@ -1,13 +1,12 @@
1
- import { require_compiler_runtime as e } from "../node_modules/react/compiler-runtime.js";
2
- import { isSafeUrl as t } from "../utils/url.js";
3
- import { useEffect as n, useState as r } from "react";
1
+ import { isSafeUrl as e } from "../utils/url.js";
2
+ import { useEffect as t, useState as n } from "react";
4
3
  import "pdfjs-dist";
4
+ import { c as r } from "react/compiler-runtime";
5
5
  //#region src/hooks/useAnnotationLayer.ts
6
- var i = e();
7
- function a(e) {
8
- let a = (0, i.c)(15), { pdf: o, zoom: s, rotation: c, numPages: l, goToPage: u } = e, d;
6
+ function i(i) {
7
+ let a = r(15), { pdf: o, zoom: s, rotation: c, numPages: l, goToPage: u } = i, d;
9
8
  a[0] === Symbol.for("react.memo_cache_sentinel") ? (d = [], a[0] = d) : d = a[0];
10
- let [f, p] = r(d), m, h;
9
+ let [f, p] = n(d), m, h;
11
10
  a[1] !== l || a[2] !== o || a[3] !== c || a[4] !== s ? (m = () => {
12
11
  if (!o) return;
13
12
  let e = !1;
@@ -43,18 +42,18 @@ function a(e) {
43
42
  s,
44
43
  c,
45
44
  l
46
- ], a[1] = l, a[2] = o, a[3] = c, a[4] = s, a[5] = m, a[6] = h) : (m = a[5], h = a[6]), n(m, h);
45
+ ], a[1] = l, a[2] = o, a[3] = c, a[4] = s, a[5] = m, a[6] = h) : (m = a[5], h = a[6]), t(m, h);
47
46
  let g;
48
- a[7] !== u || a[8] !== o ? (g = async (e) => {
49
- if (e.url) {
50
- if (!t(e.url)) return;
51
- window.open(e.url, "_blank", "noopener,noreferrer");
47
+ a[7] !== u || a[8] !== o ? (g = async (t) => {
48
+ if (t.url) {
49
+ if (!e(t.url)) return;
50
+ window.open(t.url, "_blank", "noopener,noreferrer");
52
51
  return;
53
52
  }
54
- if (e.dest && o) {
55
- let t = null;
56
- if (typeof e.dest == "string" ? t = await o.getDestination(e.dest) : Array.isArray(e.dest) && (t = e.dest), !t) return;
57
- u(await o.getPageIndex(t[0]) + 1);
53
+ if (t.dest && o) {
54
+ let e = null;
55
+ if (typeof t.dest == "string" ? e = await o.getDestination(t.dest) : Array.isArray(t.dest) && (e = t.dest), !e) return;
56
+ u(await o.getPageIndex(e[0]) + 1);
58
57
  }
59
58
  }, a[7] = u, a[8] = o, a[9] = g) : g = a[9];
60
59
  let _ = g, v;
@@ -68,4 +67,4 @@ function a(e) {
68
67
  return v;
69
68
  }
70
69
  //#endregion
71
- export { a as useAnnotationLayer };
70
+ export { i as useAnnotationLayer };
@@ -1,11 +1,10 @@
1
- import { require_compiler_runtime as e } from "../node_modules/react/compiler-runtime.js";
2
- import { useEffect as t } from "react";
1
+ import { useEffect as e } from "react";
3
2
  import "pdfjs-dist";
3
+ import { c as t } from "react/compiler-runtime";
4
4
  //#region src/hooks/useKeyboardShortcuts.ts
5
- var n = e();
6
- function r(e) {
7
- let r = (0, n.c)(13), { pdf: s, currentPage: c, numPages: l, goToPage: u, setZoom: d, setRotation: f } = e, p;
8
- r[0] !== c || r[1] !== u || r[2] !== s || r[3] !== f || r[4] !== d ? (p = () => {
5
+ function n(n) {
6
+ let o = t(13), { pdf: s, currentPage: c, numPages: l, goToPage: u, setZoom: d, setRotation: f } = n, p;
7
+ o[0] !== c || o[1] !== u || o[2] !== s || o[3] !== f || o[4] !== d ? (p = () => {
9
8
  if (!s) return;
10
9
  let e = (e) => {
11
10
  let t = e.target.tagName;
@@ -20,35 +19,35 @@ function r(e) {
20
19
  break bb13;
21
20
  case "+":
22
21
  case "=":
23
- e.preventDefault(), d(o);
22
+ e.preventDefault(), d(a);
24
23
  break bb13;
25
24
  case "-":
26
- e.preventDefault(), d(a);
25
+ e.preventDefault(), d(i);
27
26
  break bb13;
28
27
  case "r":
29
- case "R": e.preventDefault(), f(i);
28
+ case "R": e.preventDefault(), f(r);
30
29
  }
31
30
  };
32
31
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
33
- }, r[0] = c, r[1] = u, r[2] = s, r[3] = f, r[4] = d, r[5] = p) : p = r[5];
32
+ }, o[0] = c, o[1] = u, o[2] = s, o[3] = f, o[4] = d, o[5] = p) : p = o[5];
34
33
  let m;
35
- r[6] !== c || r[7] !== u || r[8] !== l || r[9] !== s || r[10] !== f || r[11] !== d ? (m = [
34
+ o[6] !== c || o[7] !== u || o[8] !== l || o[9] !== s || o[10] !== f || o[11] !== d ? (m = [
36
35
  s,
37
36
  c,
38
37
  l,
39
38
  u,
40
39
  d,
41
40
  f
42
- ], r[6] = c, r[7] = u, r[8] = l, r[9] = s, r[10] = f, r[11] = d, r[12] = m) : m = r[12], t(p, m);
41
+ ], o[6] = c, o[7] = u, o[8] = l, o[9] = s, o[10] = f, o[11] = d, o[12] = m) : m = o[12], e(p, m);
43
42
  }
44
- function i(e) {
43
+ function r(e) {
45
44
  return (e + 90) % 360;
46
45
  }
47
- function a(e) {
46
+ function i(e) {
48
47
  return Math.max(e - .2, .2);
49
48
  }
50
- function o(e) {
49
+ function a(e) {
51
50
  return Math.min(e + .2, 3);
52
51
  }
53
52
  //#endregion
54
- export { r as useKeyboardShortcuts };
53
+ export { n as useKeyboardShortcuts };
@@ -1,15 +1,14 @@
1
- import { require_compiler_runtime as e } from "../node_modules/react/compiler-runtime.js";
2
- import { useEffect as t, useState as n } from "react";
1
+ import { useEffect as e, useState as t } from "react";
3
2
  import "pdfjs-dist";
3
+ import { c as n } from "react/compiler-runtime";
4
4
  //#region src/hooks/useOutline.ts
5
- var r = e();
6
- function i(e) {
7
- let i = (0, r.c)(7), { pdf: a } = e, o;
5
+ function r(r) {
6
+ let i = n(7), { pdf: a } = r, o;
8
7
  i[0] === Symbol.for("react.memo_cache_sentinel") ? (o = [], i[0] = o) : o = i[0];
9
- let [s, c] = n(o), [l, u] = n(!1), d, f;
8
+ let [s, c] = t(o), [l, u] = t(!1), d, f;
10
9
  i[1] === a ? (d = i[2], f = i[3]) : (d = () => {
11
10
  a && (u(!0), a.getOutline().then((e) => c(e ?? [])).catch(() => c([])).finally(() => u(!1)));
12
- }, f = [a], i[1] = a, i[2] = d, i[3] = f), t(d, f);
11
+ }, f = [a], i[1] = a, i[2] = d, i[3] = f), e(d, f);
13
12
  let p;
14
13
  return i[4] !== l || i[5] !== s ? (p = {
15
14
  outline: s,
@@ -17,4 +16,4 @@ function i(e) {
17
16
  }, i[4] = l, i[5] = s, i[6] = p) : p = i[6], p;
18
17
  }
19
18
  //#endregion
20
- export { i as useOutline };
19
+ export { r as useOutline };
@@ -1,10 +1,10 @@
1
- import { require_compiler_runtime as e } from "../node_modules/react/compiler-runtime.js";
2
- import { useEffect as t, useState as n } from "react";
1
+ import { useEffect as e, useState as t } from "react";
3
2
  import "pdfjs-dist";
3
+ import { c as n } from "react/compiler-runtime";
4
4
  //#region src/hooks/useScrollTracking.ts
5
- var r = e(), i = 10;
6
- function a(e) {
7
- let a = (0, r.c)(16), { pdf: o, numPages: s, zoom: c, rotation: l, containerRef: u, canvasRefs: d } = e, [f, p] = n(1), m;
5
+ var r = 10;
6
+ function i(i) {
7
+ let a = n(16), { pdf: o, numPages: s, zoom: c, rotation: l, containerRef: u, canvasRefs: d } = i, [f, p] = t(1), m;
8
8
  a[0] !== d || a[1] !== u ? (m = () => {
9
9
  let e = u.current;
10
10
  if (!e) return;
@@ -24,13 +24,13 @@ function a(e) {
24
24
  l,
25
25
  u,
26
26
  d
27
- ], a[3] = d, a[4] = u, a[5] = o, a[6] = l, a[7] = c, a[8] = h) : h = a[8], t(m, h);
27
+ ], a[3] = d, a[4] = u, a[5] = o, a[6] = l, a[7] = c, a[8] = h) : h = a[8], e(m, h);
28
28
  let g;
29
29
  a[9] !== d || a[10] !== u || a[11] !== s ? (g = (e) => {
30
- let t = Math.min(Math.max(e, 1), s), n = d.current[t - 1], r = u.current;
31
- if (n && r) {
32
- let e = (n.parentElement ?? n).getBoundingClientRect().top, a = r.getBoundingClientRect().top, o = r.scrollTop + (e - a) - i;
33
- r.scrollTo({
30
+ let t = Math.min(Math.max(e, 1), s), n = d.current[t - 1], i = u.current;
31
+ if (n && i) {
32
+ let e = (n.parentElement ?? n).getBoundingClientRect().top, a = i.getBoundingClientRect().top, o = i.scrollTop + (e - a) - r;
33
+ i.scrollTo({
34
34
  top: o,
35
35
  behavior: "smooth"
36
36
  }), p(t);
@@ -43,4 +43,4 @@ function a(e) {
43
43
  }, a[13] = f, a[14] = _, a[15] = v) : v = a[15], v;
44
44
  }
45
45
  //#endregion
46
- export { a as useScrollTracking };
46
+ export { i as useScrollTracking };
@@ -1,29 +1,28 @@
1
- import { require_compiler_runtime as e } from "../node_modules/react/compiler-runtime.js";
2
1
  /* empty css */
3
- import { useEffect as t, useRef as n } from "react";
4
- import * as r from "pdfjs-dist";
2
+ import { useEffect as e, useRef as t } from "react";
3
+ import * as n from "pdfjs-dist";
4
+ import { c as r } from "react/compiler-runtime";
5
5
  //#region src/hooks/useTextLayer.ts
6
- var i = e();
7
- function a(e) {
8
- let a = (0, i.c)(8), { pdf: o, zoom: s, rotation: c, numPages: l, canvasRefs: u } = e, d;
6
+ function i(i) {
7
+ let a = r(8), { pdf: o, zoom: s, rotation: c, numPages: l, canvasRefs: u } = i, d;
9
8
  a[0] === Symbol.for("react.memo_cache_sentinel") ? (d = [], a[0] = d) : d = a[0];
10
- let f = n(d), p, m;
9
+ let f = t(d), p, m;
11
10
  return a[1] !== u || a[2] !== l || a[3] !== o || a[4] !== c || a[5] !== s ? (p = () => {
12
11
  if (!o) return;
13
12
  let e = !1;
14
13
  return (async () => {
15
14
  for (let t = 1; t <= l && !e; t++) {
16
- let n = f.current[t - 1], i = u.current[t - 1];
17
- if (!n || !i) continue;
18
- n.replaceChildren();
15
+ let r = f.current[t - 1], i = u.current[t - 1];
16
+ if (!r || !i) continue;
17
+ r.replaceChildren();
19
18
  let a = await o.getPage(t), l = a.getViewport({
20
19
  scale: s,
21
20
  rotation: c
22
21
  }), d = await a.getTextContent();
23
22
  if (e) break;
24
- n.style.width = `${l.width}px`, n.style.height = `${l.height}px`, await new r.TextLayer({
23
+ r.style.width = `${l.width}px`, r.style.height = `${l.height}px`, await new n.TextLayer({
25
24
  textContentSource: d,
26
- container: n,
25
+ container: r,
27
26
  viewport: l
28
27
  }).render();
29
28
  }
@@ -36,7 +35,7 @@ function a(e) {
36
35
  c,
37
36
  l,
38
37
  u
39
- ], a[1] = u, a[2] = l, a[3] = o, a[4] = c, a[5] = s, a[6] = p, a[7] = m) : (p = a[6], m = a[7]), t(p, m), f;
38
+ ], a[1] = u, a[2] = l, a[3] = o, a[4] = c, a[5] = s, a[6] = p, a[7] = m) : (p = a[6], m = a[7]), e(p, m), f;
40
39
  }
41
40
  //#endregion
42
- export { a as useTextLayer };
41
+ export { i as useTextLayer };
@@ -1,12 +1,11 @@
1
- import { require_compiler_runtime as e } from "../node_modules/react/compiler-runtime.js";
2
- import { useEffect as t, useState as n } from "react";
1
+ import { useEffect as e, useState as t } from "react";
3
2
  import "pdfjs-dist";
3
+ import { c as n } from "react/compiler-runtime";
4
4
  //#region src/hooks/useTextSearch.ts
5
- var r = e();
6
- function i(e) {
7
- let i = (0, r.c)(8), { pdf: a, query: o } = e, s;
5
+ function r(r) {
6
+ let i = n(8), { pdf: a, query: o } = r, s;
8
7
  i[0] === Symbol.for("react.memo_cache_sentinel") ? (s = [], i[0] = s) : s = i[0];
9
- let [c, l] = n(s), [u, d] = n(!1), f, p;
8
+ let [c, l] = t(s), [u, d] = t(!1), f, p;
10
9
  i[1] !== a || i[2] !== o ? (f = () => {
11
10
  let e = o.trim().toLowerCase();
12
11
  if (!a || !e) {
@@ -42,7 +41,7 @@ function i(e) {
42
41
  })(), () => {
43
42
  t = !0;
44
43
  };
45
- }, p = [a, o], i[1] = a, i[2] = o, i[3] = f, i[4] = p) : (f = i[3], p = i[4]), t(f, p);
44
+ }, p = [a, o], i[1] = a, i[2] = o, i[3] = f, i[4] = p) : (f = i[3], p = i[4]), e(f, p);
46
45
  let m;
47
46
  return i[5] !== c || i[6] !== u ? (m = {
48
47
  matches: c,
@@ -50,4 +49,4 @@ function i(e) {
50
49
  }, i[5] = c, i[6] = u, i[7] = m) : m = i[7], m;
51
50
  }
52
51
  //#endregion
53
- export { i as useTextSearch };
52
+ export { r as useTextSearch };
@@ -1,12 +1,11 @@
1
- import { require_compiler_runtime as e } from "../node_modules/react/compiler-runtime.js";
2
- import { useEffect as t, useState as n } from "react";
1
+ import { useEffect as e, useState as t } from "react";
3
2
  import "pdfjs-dist";
3
+ import { c as n } from "react/compiler-runtime";
4
4
  //#region src/hooks/useThumbnails.ts
5
- var r = e();
6
- function i(e) {
7
- let i = (0, r.c)(7), { pdf: a, rotation: o } = e, s;
5
+ function r(r) {
6
+ let i = n(7), { pdf: a, rotation: o } = r, s;
8
7
  i[0] === Symbol.for("react.memo_cache_sentinel") ? (s = [], i[0] = s) : s = i[0];
9
- let [c, l] = n(s), u, d;
8
+ let [c, l] = t(s), u, d;
10
9
  i[1] !== a || i[2] !== o ? (u = () => {
11
10
  a && (async () => {
12
11
  let e = [];
@@ -23,9 +22,9 @@ function i(e) {
23
22
  }
24
23
  l(e);
25
24
  })();
26
- }, d = [a, o], i[1] = a, i[2] = o, i[3] = u, i[4] = d) : (u = i[3], d = i[4]), t(u, d);
25
+ }, d = [a, o], i[1] = a, i[2] = o, i[3] = u, i[4] = d) : (u = i[3], d = i[4]), e(u, d);
27
26
  let f;
28
27
  return i[5] === c ? f = i[6] : (f = { thumbnails: c }, i[5] = c, i[6] = f), f;
29
28
  }
30
29
  //#endregion
31
- export { i as useThumbnails };
30
+ export { r as useThumbnails };
package/package.json CHANGED
@@ -1,18 +1,23 @@
1
1
  {
2
2
  "name": "pdf-tsx",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "A fully-featured, composable PDF viewer component for React",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.cjs",
7
7
  "module": "./dist/es/index.js",
8
8
  "types": "./dist/index.d.ts",
9
- "sideEffects": false,
9
+ "sideEffects": [
10
+ "*.css"
11
+ ],
10
12
  "exports": {
11
13
  ".": {
12
14
  "types": "./dist/index.d.ts",
13
15
  "import": "./dist/es/index.js",
14
16
  "require": "./dist/cjs/index.cjs"
15
- }
17
+ },
18
+ "./style.css": "./dist/es/pdf-tsx.css",
19
+ "./dist/es/pdf-tsx.css": "./dist/es/pdf-tsx.css",
20
+ "./dist/cjs/pdf-tsx.css": "./dist/cjs/pdf-tsx.css"
16
21
  },
17
22
  "keywords": [
18
23
  "pdf",
@@ -1,5 +0,0 @@
1
- "use strict";var e=require(`../../../_virtual/_rolldown/runtime.cjs`).__commonJSMin((e=>{process.env.NODE_ENV!==`production`&&(function(){var t=require(`react`).__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;e.c=function(e){var n=t.H;return n===null&&console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
2
- 1. You might have mismatching versions of React and the renderer (such as React DOM)
3
- 2. You might be breaking the Rules of Hooks
4
- 3. You might have more than one copy of React in the same app
5
- See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),n.useMemoCache(e)}})()}));Object.defineProperty(exports,`default`,{enumerable:!0,get:function(){return e()}});
@@ -1 +0,0 @@
1
- "use strict";var e=require(`../../../_virtual/_rolldown/runtime.cjs`).__commonJSMin((e=>{var t=require(`react`).__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;e.c=function(e){return t.H.useMemoCache(e)}}));Object.defineProperty(exports,`default`,{enumerable:!0,get:function(){return e()}});
@@ -1 +0,0 @@
1
- "use strict";const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`./cjs/react-compiler-runtime.production.cjs`),n=require(`./cjs/react-compiler-runtime.development.cjs`);var r=e.__commonJSMin(((e,r)=>{process.env.NODE_ENV===`production`?r.exports=t.default:r.exports=n.default}));Object.defineProperty(exports,`default`,{enumerable:!0,get:function(){return r()}});
@@ -1,7 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var e = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), t = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
3
- if (typeof require < "u") return require.apply(this, arguments);
4
- throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
5
- });
6
- //#endregion
7
- export { e as __commonJSMin, t as __require };
@@ -1,14 +0,0 @@
1
- import { __commonJSMin as e, __require as t } from "../../../_virtual/_rolldown/runtime.js";
2
- //#region node_modules/react/cjs/react-compiler-runtime.development.js
3
- var n = /* @__PURE__ */ e(((e) => {
4
- process.env.NODE_ENV !== "production" && (function() {
5
- var n = t("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
6
- e.c = function(e) {
7
- var t = n.H;
8
- return t === null && console.error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem."), t.useMemoCache(e);
9
- };
10
- })();
11
- }));
12
- //#endregion
13
- export default n();
14
- export { n as require_react_compiler_runtime_development };