@pdf-viewer/react 0.6.0-beta.2 → 0.6.0-beta.4

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 (51) hide show
  1. package/dist/{RPLayout-f65ede89.js → RPLayout-fab06e11.js} +428 -426
  2. package/dist/components/RPController.js +1 -1
  3. package/dist/components/RPViewer.js +1 -1
  4. package/dist/components/layout/RPLayout.js +1 -1
  5. package/dist/components/layout/sidebar/RPSidebar.js +1 -1
  6. package/dist/components/layout/sidebar/Thumbnail.js +1 -1
  7. package/dist/components/layout/sidebar/Thumbnails.js +1 -1
  8. package/dist/components/layout/toolbar/DocumentDialog.js +1 -1
  9. package/dist/components/layout/toolbar/FileDownloadTool.js +1 -1
  10. package/dist/components/layout/toolbar/MenuItem.js +1 -1
  11. package/dist/components/layout/toolbar/MenuSeparator.js +1 -1
  12. package/dist/components/layout/toolbar/MostPageTool.js +2 -2
  13. package/dist/components/layout/toolbar/OtherTool.js +2 -2
  14. package/dist/components/layout/toolbar/Paginate.js +1 -1
  15. package/dist/components/layout/toolbar/PrintTool.js +1 -1
  16. package/dist/components/layout/toolbar/RPToolbar.js +1 -1
  17. package/dist/components/layout/toolbar/RPToolbarEnd.js +1 -1
  18. package/dist/components/layout/toolbar/RotateTool.js +1 -1
  19. package/dist/components/layout/toolbar/ScrollModeTool.js +1 -1
  20. package/dist/components/layout/toolbar/SearchTool.js +1 -1
  21. package/dist/components/layout/toolbar/SelectionModeTool.js +1 -1
  22. package/dist/components/layout/toolbar/ViewModeTool.js +1 -1
  23. package/dist/components/layout/toolbar/ZoomTool.js +2 -2
  24. package/dist/components/page/AnnotationLayer.js +1 -1
  25. package/dist/components/page/CanvasLayer.js +1 -1
  26. package/dist/components/page/DualPage.js +1 -1
  27. package/dist/components/page/RPPage.js +1 -1
  28. package/dist/components/page/SinglePage.js +1 -1
  29. package/dist/components/page/TextLayer.js +1 -1
  30. package/dist/components/ui/Checkbox.js +1 -1
  31. package/dist/components/ui/DropDown.js +1 -1
  32. package/dist/components/ui/LoadingIndicator.js +1 -1
  33. package/dist/components/ui/RPTooltip.js +1793 -532
  34. package/dist/contexts/PaginateContext.js +1 -1
  35. package/dist/contexts/PrintContext.js +1 -1
  36. package/dist/contexts/SearchContext.js +1 -1
  37. package/dist/contexts/ThumbnailsContext.js +1 -1
  38. package/dist/index-3459164c.js +3609 -0
  39. package/dist/{index-71898eb9.js → index-743c36f0.js} +30 -30
  40. package/dist/main.js +1 -1
  41. package/dist/utils/hooks/useFileDownload.js +1 -1
  42. package/dist/utils/hooks/useLicense.js +15 -23
  43. package/dist/utils/hooks/usePaginate.js +1 -1
  44. package/dist/utils/hooks/usePrint.js +1 -1
  45. package/dist/utils/hooks/useScrollToPage.js +1 -1
  46. package/dist/utils/hooks/useSearch.js +1 -1
  47. package/dist/utils/hooks/useThumbnail.js +1 -1
  48. package/dist/utils/hooks/useVirtualReactWindow.js +1 -1
  49. package/package.json +1 -1
  50. package/dist/floating-ui.react-dom-e6d5fe8f.js +0 -1327
  51. package/dist/index-316854c1.js +0 -2299
@@ -78,37 +78,13 @@ function y(e) {
78
78
  return (r = n.current) == null ? void 0 : r.call(n, ...t);
79
79
  }, []);
80
80
  }
81
- var g = globalThis != null && globalThis.document ? i.useLayoutEffect : () => {
82
- };
83
- function $(e) {
84
- const [n, t] = i.useState(void 0);
85
- return g(() => {
86
- if (e) {
87
- t({ width: e.offsetWidth, height: e.offsetHeight });
88
- const r = new ResizeObserver((u) => {
89
- if (!Array.isArray(u) || !u.length)
90
- return;
91
- const s = u[0];
92
- let o, c;
93
- if ("borderBoxSize" in s) {
94
- const a = s.borderBoxSize, f = Array.isArray(a) ? a[0] : a;
95
- o = f.inlineSize, c = f.blockSize;
96
- } else
97
- o = e.offsetWidth, c = e.offsetHeight;
98
- t({ width: o, height: c });
99
- });
100
- return r.observe(e, { box: "border-box" }), () => r.unobserve(e);
101
- } else
102
- t(void 0);
103
- }, [e]), n;
104
- }
105
- function _({
81
+ function $({
106
82
  prop: e,
107
83
  defaultProp: n,
108
84
  onChange: t = () => {
109
85
  }
110
86
  }) {
111
- const [r, u] = p({ defaultProp: n, onChange: t }), s = e !== void 0, o = s ? e : r, c = y(t), a = i.useCallback(
87
+ const [r, u] = g({ defaultProp: n, onChange: t }), s = e !== void 0, o = s ? e : r, c = y(t), a = i.useCallback(
112
88
  (f) => {
113
89
  if (s) {
114
90
  const d = typeof f == "function" ? f(e) : f;
@@ -120,7 +96,7 @@ function _({
120
96
  );
121
97
  return [o, a];
122
98
  }
123
- function p({
99
+ function g({
124
100
  defaultProp: e,
125
101
  onChange: n
126
102
  }) {
@@ -129,11 +105,35 @@ function p({
129
105
  u.current !== r && (s(r), u.current = r);
130
106
  }, [r, u, s]), t;
131
107
  }
108
+ var p = globalThis != null && globalThis.document ? i.useLayoutEffect : () => {
109
+ };
110
+ function _(e) {
111
+ const [n, t] = i.useState(void 0);
112
+ return p(() => {
113
+ if (e) {
114
+ t({ width: e.offsetWidth, height: e.offsetHeight });
115
+ const r = new ResizeObserver((u) => {
116
+ if (!Array.isArray(u) || !u.length)
117
+ return;
118
+ const s = u[0];
119
+ let o, c;
120
+ if ("borderBoxSize" in s) {
121
+ const a = s.borderBoxSize, f = Array.isArray(a) ? a[0] : a;
122
+ o = f.inlineSize, c = f.blockSize;
123
+ } else
124
+ o = e.offsetWidth, c = e.offsetHeight;
125
+ t({ width: o, height: c });
126
+ });
127
+ return r.observe(e, { box: "border-box" }), () => r.unobserve(e);
128
+ } else
129
+ t(void 0);
130
+ }, [e]), n;
131
+ }
132
132
  export {
133
- g as a,
133
+ $ as a,
134
134
  _ as b,
135
135
  E as c,
136
- $ as d,
136
+ y as d,
137
137
  m as e,
138
- y as u
138
+ p as u
139
139
  };
package/dist/main.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { RPDocument as t } from "./components/RPDocument.js";
2
- import { a as x, R as n, b as s, u as m, c as p, d as u } from "./RPLayout-f65ede89.js";
2
+ import { a as x, R as n, b as s, u as m, c as p, d as u } from "./RPLayout-fab06e11.js";
3
3
  import { RPConfig as f } from "./components/RPConfig.js";
4
4
  import { RPTheme as i } from "./components/RPTheme.js";
5
5
  import { RPDropFileZone as R } from "./components/RPDropFileZone.js";
@@ -1,6 +1,6 @@
1
1
  import "react/jsx-runtime";
2
2
  import "../../contexts/RPDocumentContext.js";
3
- import { b as w } from "../../RPLayout-f65ede89.js";
3
+ import { b as w } from "../../RPLayout-fab06e11.js";
4
4
  import "../../components/RPConfig.js";
5
5
  import "../../contexts/ThemeContext.js";
6
6
  import "react";
@@ -1,6 +1,6 @@
1
1
  import { useState as g, useCallback as h, useEffect as v } from "react";
2
2
  import { appConsole as l } from "../appConsole.js";
3
- const b = /* @__PURE__ */ new Date("2025-02-14T08:54:45.055Z"), d = "Please visit https://www.react-pdf.dev/license-management/ to generate a new license key.", o = {
3
+ const b = /* @__PURE__ */ new Date("2025-02-18T09:31:53.394Z"), d = "Please visit https://www.react-pdf.dev/license-management/ to generate a new license key.", o = {
4
4
  invalidLicense: `You are currently using without a valid license. ${d}`,
5
5
  mismatchedDomain: `Your license key is not valid for the current domain / IP. ${d}`,
6
6
  expired: `Your license key has expired. ${d}`,
@@ -8,39 +8,31 @@ const b = /* @__PURE__ */ new Date("2025-02-14T08:54:45.055Z"), d = "Please visi
8
8
  invalidSignature: "Invalid license key: Signature mismatch"
9
9
  };
10
10
  function y(r) {
11
- const n = r.replace(/-----BEGIN PUBLIC KEY-----/, "").replace(/-----END PUBLIC KEY-----/, "").replace(/\s+/g, ""), t = atob(n), i = new Uint8Array(t.length);
11
+ const i = r.replace(/-----BEGIN PUBLIC KEY-----/, "").replace(/-----END PUBLIC KEY-----/, "").replace(/\s+/g, ""), t = atob(i), n = new Uint8Array(t.length);
12
12
  for (let e = 0; e < t.length; e++)
13
- i[e] = t.charCodeAt(e);
14
- return i.buffer;
13
+ n[e] = t.charCodeAt(e);
14
+ return n.buffer;
15
15
  }
16
16
  function A(r) {
17
- const n = atob(r), t = new Uint8Array(n.length);
18
- for (let i = 0; i < n.length; i++)
19
- t[i] = n.charCodeAt(i);
17
+ const i = atob(r), t = new Uint8Array(i.length);
18
+ for (let n = 0; n < i.length; n++)
19
+ t[n] = i.charCodeAt(n);
20
20
  return t.buffer;
21
21
  }
22
- async function I(r, n = "SHA-256") {
22
+ async function I(r, i = "SHA-256") {
23
23
  try {
24
- const { data: t, signature: i } = JSON.parse(atob(r)), e = y(`-----BEGIN PUBLIC KEY-----
25
- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyrIi83Zr5AKaWO6zbZmX
26
- qv3McVhtnPOnWCiFgf5xeaglLzEwMiXo3gALaPoBp5Q0WPOSBE9GTqwOyQUgpDNS
27
- BuQ0cjOzQdFM3GPnKSqQThZJfjUmD9egMZDmfhcpFGPybUoicoIEFQOdX2vMFUfn
28
- 6yjRsyvbK6UPTombYl785V8dXNnnIHa4tQC1JSaSe/bhG3e/6kbQCy9VJ23242q9
29
- WJpx9c2sZ+bmyI0r9Zx0PfqcDJzDfKn45v96EtxGhV16OZhqkbj4ljiJ/mfqfCkx
30
- ybkm9nvxz0hAwcEftQaxl/0cZ1RxtsRcL+V3msLsmGcs9nPqAuXecbfg9QVCi/+m
31
- iwIDAQAB
32
- -----END PUBLIC KEY-----`), a = await window.crypto.subtle.importKey(
24
+ const { data: t, signature: n } = JSON.parse(atob(r)), e = y("-----BEGIN PUBLIC KEY-----MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyrIi83Zr5AKaWO6zbZmXqv3McVhtnPOnWCiFgf5xeaglLzEwMiXo3gALaPoBp5Q0WPOSBE9GTqwOyQUgpDNSBuQ0cjOzQdFM3GPnKSqQThZJfjUmD9egMZDmfhcpFGPybUoicoIEFQOdX2vMFUfn6yjRsyvbK6UPTombYl785V8dXNnnIHa4tQC1JSaSe/bhG3e/6kbQCy9VJ23242q9WJpx9c2sZ+bmyI0r9Zx0PfqcDJzDfKn45v96EtxGhV16OZhqkbj4ljiJ/mfqfCkxybkm9nvxz0hAwcEftQaxl/0cZ1RxtsRcL+V3msLsmGcs9nPqAuXecbfg9QVCi/+miwIDAQAB-----END PUBLIC KEY-----"), a = await window.crypto.subtle.importKey(
33
25
  "spki",
34
26
  // str2ab(publicKeyContent), // Convert PEM string to ArrayBuffer
35
27
  e,
36
- { name: "RSA-PSS", hash: n },
28
+ { name: "RSA-PSS", hash: i },
37
29
  !0,
38
30
  ["verify"]
39
31
  );
40
32
  if (!await window.crypto.subtle.verify(
41
33
  { name: "RSA-PSS", saltLength: 32 },
42
34
  a,
43
- A(i),
35
+ A(n),
44
36
  // Convert signature to ArrayBuffer
45
37
  new TextEncoder().encode(atob(t))
46
38
  ))
@@ -50,12 +42,12 @@ iwIDAQAB
50
42
  throw new Error(o.invalidLicense);
51
43
  }
52
44
  }
53
- const L = (r, n) => r === "specific" ? n === window.location.host : window.location.host.includes(n), c = {
45
+ const L = (r, i) => r === "specific" ? i === window.location.host : window.location.host.includes(i), c = {
54
46
  isValid: !1,
55
47
  invalidatedMessage: o.invalidLicense,
56
48
  type: void 0
57
49
  }, T = (r) => {
58
- const [n, t] = g(c), i = h(async () => {
50
+ const [i, t] = g(c), n = h(async () => {
59
51
  if (!r)
60
52
  return t(c), c;
61
53
  try {
@@ -88,14 +80,14 @@ const L = (r, n) => r === "specific" ? n === window.location.host : window.locat
88
80
  }
89
81
  }, [r]);
90
82
  return v(() => {
91
- i().then(({ isValid: e, type: a, invalidatedMessage: s }) => {
83
+ n().then(({ isValid: e, type: a, invalidatedMessage: s }) => {
92
84
  t({
93
85
  isValid: e,
94
86
  type: a,
95
87
  invalidatedMessage: s
96
88
  });
97
89
  });
98
- }, [i]), n;
90
+ }, [n]), i;
99
91
  };
100
92
  export {
101
93
  T as useLicense
@@ -1,5 +1,5 @@
1
1
  import "react";
2
- import { j as d } from "../../RPLayout-f65ede89.js";
2
+ import { j as d } from "../../RPLayout-fab06e11.js";
3
3
  import "../../contexts/ScrollStateContext.js";
4
4
  import "react/jsx-runtime";
5
5
  import "../../contexts/RPDocumentContext.js";
@@ -1,7 +1,7 @@
1
1
  import "react";
2
2
  import "react/jsx-runtime";
3
3
  import "../../contexts/RPDocumentContext.js";
4
- import { o as d } from "../../RPLayout-f65ede89.js";
4
+ import { o as d } from "../../RPLayout-fab06e11.js";
5
5
  import "../../components/RPConfig.js";
6
6
  import "../../contexts/ThemeContext.js";
7
7
  import "../../components/RPDropFileZone.js";
@@ -2,7 +2,7 @@ import "react";
2
2
  import "../../contexts/ScrollModeContext.js";
3
3
  import "react/jsx-runtime";
4
4
  import "../../contexts/RPDocumentContext.js";
5
- import { e as h } from "../../RPLayout-f65ede89.js";
5
+ import { e as h } from "../../RPLayout-fab06e11.js";
6
6
  import "../../components/RPConfig.js";
7
7
  import "../../contexts/ThemeContext.js";
8
8
  import "../../components/RPDropFileZone.js";
@@ -1,7 +1,7 @@
1
1
  import "react";
2
2
  import "react/jsx-runtime";
3
3
  import "../../contexts/RPDocumentContext.js";
4
- import { f as j } from "../../RPLayout-f65ede89.js";
4
+ import { f as j } from "../../RPLayout-fab06e11.js";
5
5
  import "../../components/RPConfig.js";
6
6
  import "../../contexts/ThemeContext.js";
7
7
  import "../../components/RPDropFileZone.js";
@@ -2,7 +2,7 @@ import "react";
2
2
  import "../renderPage.js";
3
3
  import "react/jsx-runtime";
4
4
  import "../../contexts/RPDocumentContext.js";
5
- import { x as c } from "../../RPLayout-f65ede89.js";
5
+ import { x as c } from "../../RPLayout-fab06e11.js";
6
6
  import "../../components/RPConfig.js";
7
7
  import "../../contexts/ThemeContext.js";
8
8
  import "../../components/RPDropFileZone.js";
@@ -3,7 +3,7 @@ import "../types.js";
3
3
  import "../../contexts/ScrollModeContext.js";
4
4
  import "react/jsx-runtime";
5
5
  import "../../contexts/RPDocumentContext.js";
6
- import { i as b } from "../../RPLayout-f65ede89.js";
6
+ import { i as b } from "../../RPLayout-fab06e11.js";
7
7
  import "../../components/RPConfig.js";
8
8
  import "../../contexts/ThemeContext.js";
9
9
  import "../../components/RPDropFileZone.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pdf-viewer/react",
3
3
  "private": false,
4
- "version": "0.6.0-beta.2",
4
+ "version": "0.6.0-beta.4",
5
5
  "keywords": [
6
6
  "component",
7
7
  "frontend",