@pdf-viewer/react 0.9.0-beta.2 → 0.9.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.
- package/dist/{Container-83627c27.js → Container-fdb0a71f.js} +7 -6
- package/dist/{RPDefaultLayout-3d9595ed.js → RPDefaultLayout-1a423868.js} +18 -17
- package/dist/components/RPController.js +1 -1
- package/dist/components/RPPages.js +1 -1
- package/dist/components/RPProvider.js +1 -1
- package/dist/components/layout/Container.js +1 -1
- package/dist/components/layout/RPDefaultLayout.js +2 -2
- package/dist/components/layout/sidebar/RPSidebar.js +1 -1
- package/dist/components/layout/sidebar/Thumbnail.js +1 -1
- package/dist/components/layout/sidebar/Thumbnails.js +1 -1
- package/dist/components/layout/toolbar/DocumentDialog.js +1 -1
- package/dist/components/layout/toolbar/FileDownloadTool.js +1 -1
- package/dist/components/layout/toolbar/MenuItem.js +1 -1
- package/dist/components/layout/toolbar/MenuSeparator.js +1 -1
- package/dist/components/layout/toolbar/MostPageTool.js +2 -2
- package/dist/components/layout/toolbar/OtherTool.js +2 -2
- package/dist/components/layout/toolbar/Paginate.js +1 -1
- package/dist/components/layout/toolbar/PrintTool.js +1 -1
- package/dist/components/layout/toolbar/RPToolbar.js +1 -1
- package/dist/components/layout/toolbar/RPToolbarEnd.js +1 -1
- package/dist/components/layout/toolbar/RotateTool.js +1 -1
- package/dist/components/layout/toolbar/ScrollModeTool.js +1 -1
- package/dist/components/layout/toolbar/SearchTool.js +1 -1
- package/dist/components/layout/toolbar/SelectionModeTool.js +1 -1
- package/dist/components/layout/toolbar/ViewModeTool.js +1 -1
- package/dist/components/layout/toolbar/ZoomTool.js +2 -2
- package/dist/components/page/AnnotationLayer.js +1 -1
- package/dist/components/page/CanvasLayer.js +1 -1
- package/dist/components/page/DualPage.js +1 -1
- package/dist/components/page/RPPage.js +1 -1
- package/dist/components/page/SinglePage.js +1 -1
- package/dist/components/page/TextLayer.js +1 -1
- package/dist/components/ui/Checkbox.js +1 -1
- package/dist/components/ui/DropDown.js +1 -1
- package/dist/components/ui/LoadingIndicator.js +1 -1
- package/dist/components/ui/RPTooltip.js +532 -1793
- package/dist/contexts/PaginationContext.js +1 -1
- package/dist/contexts/PrintContext.js +1 -1
- package/dist/contexts/SearchContext.js +1 -1
- package/dist/contexts/ThumbnailsContext.js +1 -1
- package/dist/floating-ui.react-dom-e6d5fe8f.js +1327 -0
- package/dist/index-316854c1.js +2299 -0
- package/dist/{index-743c36f0.js → index-71898eb9.js} +30 -30
- package/dist/main.js +1 -1
- package/dist/utils/hooks/useFileDownload.js +1 -1
- package/dist/utils/hooks/useLicense.js +39 -31
- package/dist/utils/hooks/usePaginate.js +1 -1
- package/dist/utils/hooks/usePrint.js +1 -1
- package/dist/utils/hooks/useScrollToPage.js +1 -1
- package/dist/utils/hooks/useSearch.js +1 -1
- package/dist/utils/hooks/useThumbnail.js +1 -1
- package/dist/utils/hooks/useVirtualReactWindow.js +1 -1
- package/package.json +4 -4
- package/dist/index-3459164c.js +0 -3609
|
@@ -78,13 +78,37 @@ function y(e) {
|
|
|
78
78
|
return (r = n.current) == null ? void 0 : r.call(n, ...t);
|
|
79
79
|
}, []);
|
|
80
80
|
}
|
|
81
|
-
|
|
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 _({
|
|
82
106
|
prop: e,
|
|
83
107
|
defaultProp: n,
|
|
84
108
|
onChange: t = () => {
|
|
85
109
|
}
|
|
86
110
|
}) {
|
|
87
|
-
const [r, u] =
|
|
111
|
+
const [r, u] = p({ defaultProp: n, onChange: t }), s = e !== void 0, o = s ? e : r, c = y(t), a = i.useCallback(
|
|
88
112
|
(f) => {
|
|
89
113
|
if (s) {
|
|
90
114
|
const d = typeof f == "function" ? f(e) : f;
|
|
@@ -96,7 +120,7 @@ function $({
|
|
|
96
120
|
);
|
|
97
121
|
return [o, a];
|
|
98
122
|
}
|
|
99
|
-
function
|
|
123
|
+
function p({
|
|
100
124
|
defaultProp: e,
|
|
101
125
|
onChange: n
|
|
102
126
|
}) {
|
|
@@ -105,35 +129,11 @@ function g({
|
|
|
105
129
|
u.current !== r && (s(r), u.current = r);
|
|
106
130
|
}, [r, u, s]), t;
|
|
107
131
|
}
|
|
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
|
-
|
|
133
|
+
g as a,
|
|
134
134
|
_ as b,
|
|
135
135
|
E as c,
|
|
136
|
-
|
|
136
|
+
$ as d,
|
|
137
137
|
m as e,
|
|
138
|
-
|
|
138
|
+
y as u
|
|
139
139
|
};
|
package/dist/main.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RPProvider as t } from "./components/RPProvider.js";
|
|
2
|
-
import { b as x, R as n, c as s, u as p, d as f, e as m } from "./RPDefaultLayout-
|
|
2
|
+
import { b as x, R as n, c as s, u as p, d as f, e as m } from "./RPDefaultLayout-1a423868.js";
|
|
3
3
|
import { RPConfig as a } from "./components/RPConfig.js";
|
|
4
4
|
import { RPController as C } from "./components/RPController.js";
|
|
5
5
|
import { RPTheme as l } from "./components/RPTheme.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "../../contexts/RPDocumentContext.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import { c as v } from "../../RPDefaultLayout-
|
|
4
|
+
import { c as v } from "../../RPDefaultLayout-1a423868.js";
|
|
5
5
|
import "../../contexts/DarkModeContext.js";
|
|
6
6
|
import "../../contexts/RotationContext.js";
|
|
7
7
|
import "../../contexts/LayerContext.js";
|
|
@@ -1,94 +1,102 @@
|
|
|
1
|
-
import { useState as g, useCallback as
|
|
1
|
+
import { useState as g, useCallback as E, useEffect as h } from "react";
|
|
2
2
|
import { appConsole as l } from "../appConsole.js";
|
|
3
|
-
const
|
|
3
|
+
const A = /* @__PURE__ */ new Date("2025-02-26T10:08:29.736Z"), 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}`,
|
|
7
7
|
exceededVersion: "Your license does not support the current version of React PDF. The library version you are using exceeds the supported range of your license.",
|
|
8
8
|
invalidSignature: "Invalid license key: Signature mismatch"
|
|
9
9
|
};
|
|
10
|
-
function
|
|
11
|
-
const
|
|
12
|
-
for (let e = 0; e <
|
|
13
|
-
n[e] =
|
|
10
|
+
function b(r) {
|
|
11
|
+
const t = r.replace(/-----BEGIN PUBLIC KEY-----/, "").replace(/-----END PUBLIC KEY-----/, "").replace(/\s+/g, ""), i = atob(t), n = new Uint8Array(i.length);
|
|
12
|
+
for (let e = 0; e < i.length; e++)
|
|
13
|
+
n[e] = i.charCodeAt(e);
|
|
14
14
|
return n.buffer;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
const
|
|
18
|
-
for (let n = 0; n <
|
|
19
|
-
|
|
20
|
-
return
|
|
16
|
+
function S(r) {
|
|
17
|
+
const t = atob(r), i = new Uint8Array(t.length);
|
|
18
|
+
for (let n = 0; n < t.length; n++)
|
|
19
|
+
i[n] = t.charCodeAt(n);
|
|
20
|
+
return i.buffer;
|
|
21
21
|
}
|
|
22
|
-
async function I(r,
|
|
22
|
+
async function I(r, t = "SHA-256") {
|
|
23
23
|
try {
|
|
24
|
-
const { data:
|
|
24
|
+
const { data: i, signature: n } = JSON.parse(atob(r)), e = b(`-----BEGIN PUBLIC KEY-----
|
|
25
|
+
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvIokvErJ0Fctu0jduSAx
|
|
26
|
+
gr+5Har/VSuZLlOunS28hnlqqA+OF1apHL7RYkjBosS15yvviYdLrVWYHpHnoY4b
|
|
27
|
+
HLQ9I6YX6FMB9T/VbB4xLdVdKvfi8r49aTScl5EKuSpgpPgz2VSJTfvVGcRuth/Y
|
|
28
|
+
Bm7PPGYdL2l2gvKDxchmmsHFPukGki9L4JOUeIVX0GXAxabENckaEH/iC1NZhX+W
|
|
29
|
+
vXnpHeHuIIKlZ16LSivXNgo6BH2Z3GFdg4G3cAaXr6qNP8fsacYNqv2SpTW1viFD
|
|
30
|
+
vzcGRabN25gpJAp9/syeScefWH3OiJY1lmw88oTiJbjIoiq6AkPhfn3G9mF54nvR
|
|
31
|
+
kwIDAQAB
|
|
32
|
+
-----END PUBLIC KEY-----`), a = await window.crypto.subtle.importKey(
|
|
25
33
|
"spki",
|
|
26
34
|
// str2ab(publicKeyContent), // Convert PEM string to ArrayBuffer
|
|
27
35
|
e,
|
|
28
|
-
{ name: "RSA-PSS", hash:
|
|
36
|
+
{ name: "RSA-PSS", hash: t },
|
|
29
37
|
!0,
|
|
30
38
|
["verify"]
|
|
31
39
|
);
|
|
32
40
|
if (!await window.crypto.subtle.verify(
|
|
33
41
|
{ name: "RSA-PSS", saltLength: 32 },
|
|
34
42
|
a,
|
|
35
|
-
|
|
43
|
+
S(n),
|
|
36
44
|
// Convert signature to ArrayBuffer
|
|
37
|
-
new TextEncoder().encode(atob(
|
|
45
|
+
new TextEncoder().encode(atob(i))
|
|
38
46
|
))
|
|
39
47
|
throw new Error(o.invalidSignature);
|
|
40
|
-
return JSON.parse(atob(
|
|
48
|
+
return JSON.parse(atob(i));
|
|
41
49
|
} catch {
|
|
42
50
|
throw new Error(o.invalidLicense);
|
|
43
51
|
}
|
|
44
52
|
}
|
|
45
|
-
const L = (r,
|
|
53
|
+
const L = (r, t) => r === "specific" ? t === window.location.host : window.location.host.includes(t), c = {
|
|
46
54
|
isValid: !1,
|
|
47
55
|
invalidatedMessage: o.invalidLicense,
|
|
48
56
|
type: void 0
|
|
49
|
-
},
|
|
50
|
-
const [
|
|
57
|
+
}, N = (r) => {
|
|
58
|
+
const [t, i] = g(c), n = E(async () => {
|
|
51
59
|
if (!r)
|
|
52
|
-
return
|
|
60
|
+
return i(c), c;
|
|
53
61
|
try {
|
|
54
62
|
const e = await I(r);
|
|
55
63
|
l.debug(">>> validatedLicense", e);
|
|
56
|
-
const { avu: a, exp: s, dmt: m, dm:
|
|
64
|
+
const { avu: a, exp: s, dmt: m, dm: p, t: v } = e;
|
|
57
65
|
if (!s)
|
|
58
66
|
throw new Error("License is missing expiration timestamp");
|
|
59
67
|
if (s > Number.MAX_SAFE_INTEGER / 1e3)
|
|
60
68
|
throw new Error("Invalid expiration timestamp: value too large");
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
69
|
+
const f = new Date(s * 1e3), w = (/* @__PURE__ */ new Date()).getTime();
|
|
70
|
+
if (f.getTime() < w)
|
|
63
71
|
throw new Error(o.expired);
|
|
64
72
|
if (!a)
|
|
65
73
|
throw new Error("License is missing available until version timestamp");
|
|
66
74
|
if (a > Number.MAX_SAFE_INTEGER / 1e3)
|
|
67
75
|
throw new Error("Invalid available until version timestamp: value too large");
|
|
68
76
|
const u = new Date(a * 1e3);
|
|
69
|
-
if (l.debug("availableUntilTimestamp", u), u.getTime() <
|
|
77
|
+
if (l.debug("availableUntilTimestamp", u), u.getTime() < A.getTime())
|
|
70
78
|
throw new Error(o.exceededVersion);
|
|
71
|
-
if (!L(m,
|
|
79
|
+
if (!L(m, p))
|
|
72
80
|
throw new Error(o.mismatchedDomain);
|
|
73
81
|
return {
|
|
74
82
|
isValid: !0,
|
|
75
|
-
type:
|
|
83
|
+
type: v,
|
|
76
84
|
invalidatedMessage: void 0
|
|
77
85
|
};
|
|
78
86
|
} catch (e) {
|
|
79
87
|
return l.warn(e.message), { ...c, invalidatedMessage: e.message };
|
|
80
88
|
}
|
|
81
89
|
}, [r]);
|
|
82
|
-
return
|
|
90
|
+
return h(() => {
|
|
83
91
|
n().then(({ isValid: e, type: a, invalidatedMessage: s }) => {
|
|
84
|
-
|
|
92
|
+
i({
|
|
85
93
|
isValid: e,
|
|
86
94
|
type: a,
|
|
87
95
|
invalidatedMessage: s
|
|
88
96
|
});
|
|
89
97
|
});
|
|
90
|
-
}, [n]),
|
|
98
|
+
}, [n]), t;
|
|
91
99
|
};
|
|
92
100
|
export {
|
|
93
|
-
|
|
101
|
+
N as useLicense
|
|
94
102
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "react";
|
|
2
2
|
import "react/jsx-runtime";
|
|
3
3
|
import "../../contexts/RPDocumentContext.js";
|
|
4
|
-
import { i as z } from "../../RPDefaultLayout-
|
|
4
|
+
import { i as z } from "../../RPDefaultLayout-1a423868.js";
|
|
5
5
|
import "../../contexts/DarkModeContext.js";
|
|
6
6
|
import "../../contexts/RotationContext.js";
|
|
7
7
|
import "../../contexts/LayerContext.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 { f as y } from "../../RPDefaultLayout-
|
|
5
|
+
import { f as y } from "../../RPDefaultLayout-1a423868.js";
|
|
6
6
|
import "../../contexts/DarkModeContext.js";
|
|
7
7
|
import "../types.js";
|
|
8
8
|
import "../../contexts/RotationContext.js";
|
|
@@ -8,7 +8,7 @@ import "./usePageDimension.js";
|
|
|
8
8
|
import "../../contexts/RPDocumentContext.js";
|
|
9
9
|
import "../../contexts/ZoomContext.js";
|
|
10
10
|
import "react/jsx-runtime";
|
|
11
|
-
import { n as C } from "../../RPDefaultLayout-
|
|
11
|
+
import { n as C } from "../../RPDefaultLayout-1a423868.js";
|
|
12
12
|
import "../../contexts/DarkModeContext.js";
|
|
13
13
|
import "../../contexts/RotationContext.js";
|
|
14
14
|
import "../../contexts/LayerContext.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 { k as A } from "../../RPDefaultLayout-
|
|
5
|
+
import { k as A } from "../../RPDefaultLayout-1a423868.js";
|
|
6
6
|
import "../../contexts/DarkModeContext.js";
|
|
7
7
|
import "../../contexts/RotationContext.js";
|
|
8
8
|
import "../../contexts/LayerContext.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 { r as y } from "../../RPDefaultLayout-
|
|
6
|
+
import { r as y } from "../../RPDefaultLayout-1a423868.js";
|
|
7
7
|
import "../../contexts/DarkModeContext.js";
|
|
8
8
|
import "../../contexts/RotationContext.js";
|
|
9
9
|
import "../../contexts/LayerContext.js";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pdf-viewer/react",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.9.0-beta.
|
|
4
|
+
"version": "0.9.0-beta.4",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"component",
|
|
7
7
|
"frontend",
|
|
@@ -42,15 +42,15 @@
|
|
|
42
42
|
"prepare": "husky"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"pdfjs-dist": "4.7.76"
|
|
45
|
+
"pdfjs-dist": "4.7.76",
|
|
46
|
+
"react": "^18.2.0",
|
|
47
|
+
"react-dom": "^18.2.0"
|
|
46
48
|
},
|
|
47
49
|
"dependencies": {
|
|
48
50
|
"@radix-ui/react-checkbox": "^1.1.3",
|
|
49
51
|
"@radix-ui/react-tooltip": "^1.1.8",
|
|
50
52
|
"@tanstack/react-query": "^5.60.6",
|
|
51
53
|
"pdfjs-dist": "4.7.76",
|
|
52
|
-
"react": "^18.2.0",
|
|
53
|
-
"react-dom": "^18.2.0",
|
|
54
54
|
"react-virtualized-auto-sizer": "^1.0.24",
|
|
55
55
|
"react-window": "^1.8.10"
|
|
56
56
|
},
|