@pdf-viewer/react 1.5.1 → 1.6.0-beta.1
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/RPDefaultLayout-3a892bb5.js +3041 -0
- package/dist/SearchCloseButton-d6135e7c.js +32 -0
- package/dist/assets/RPDefaultLayout.css +1 -1
- package/dist/assets/SearchCloseButton.css +1 -0
- 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/LayoutContainer.js +1 -1
- package/dist/components/layout/RPDefaultLayout.js +1 -1
- 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/SearchCloseButton.js +9 -0
- package/dist/components/layout/toolbar/SearchResultNavigator.js +10 -0
- package/dist/components/layout/toolbar/SearchTool.js +3 -3
- 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/TextHighlightLayer.js +1 -1
- package/dist/components/page/TextLayer.js +1 -1
- package/dist/components/ui/Checkbox.js +14 -13
- package/dist/components/ui/DropDown.js +1 -1
- package/dist/components/ui/LoadingIndicator.js +1 -1
- package/dist/components/ui/RPTooltip.js +689 -331
- 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/index-2e540713.js +23 -0
- package/dist/index-353ec0a6.js +172 -0
- package/dist/index-5ff5dbd0.js +1675 -0
- package/dist/index-71898eb9.js +139 -0
- package/dist/main.js +1 -1
- package/dist/types/components/layout/toolbar/SearchCloseButton.d.ts +7 -0
- package/dist/types/components/layout/toolbar/SearchResultNavigator.d.ts +1 -0
- package/dist/utils/hooks/useFileDownload.js +1 -1
- package/dist/utils/hooks/useLicense.js +18 -18
- package/dist/utils/hooks/usePaginate.js +1 -1
- package/dist/utils/hooks/usePresentPage.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 +1 -1
- package/dist/RPDefaultLayout-ed089918.js +0 -2958
- package/dist/index-1cb41342.js +0 -307
- package/dist/index-7279fb4e.js +0 -1557
- package/dist/index-aa2d3884.js +0 -140
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import * as i from "react";
|
|
2
|
+
import { jsx as C } from "react/jsx-runtime";
|
|
3
|
+
function m(e, n) {
|
|
4
|
+
const t = i.createContext(n), r = (s) => {
|
|
5
|
+
const { children: o, ...c } = s, a = i.useMemo(() => c, Object.values(c));
|
|
6
|
+
return /* @__PURE__ */ C(t.Provider, { value: a, children: o });
|
|
7
|
+
};
|
|
8
|
+
r.displayName = e + "Provider";
|
|
9
|
+
function u(s) {
|
|
10
|
+
const o = i.useContext(t);
|
|
11
|
+
if (o)
|
|
12
|
+
return o;
|
|
13
|
+
if (n !== void 0)
|
|
14
|
+
return n;
|
|
15
|
+
throw new Error(`\`${s}\` must be used within \`${e}\``);
|
|
16
|
+
}
|
|
17
|
+
return [r, u];
|
|
18
|
+
}
|
|
19
|
+
function E(e, n = []) {
|
|
20
|
+
let t = [];
|
|
21
|
+
function r(s, o) {
|
|
22
|
+
const c = i.createContext(o), a = t.length;
|
|
23
|
+
t = [...t, o];
|
|
24
|
+
const f = (d) => {
|
|
25
|
+
var b;
|
|
26
|
+
const { scope: l, children: S, ...v } = d, h = ((b = l == null ? void 0 : l[e]) == null ? void 0 : b[a]) || c, z = i.useMemo(() => v, Object.values(v));
|
|
27
|
+
return /* @__PURE__ */ C(h.Provider, { value: z, children: S });
|
|
28
|
+
};
|
|
29
|
+
f.displayName = s + "Provider";
|
|
30
|
+
function x(d, l) {
|
|
31
|
+
var h;
|
|
32
|
+
const S = ((h = l == null ? void 0 : l[e]) == null ? void 0 : h[a]) || c, v = i.useContext(S);
|
|
33
|
+
if (v)
|
|
34
|
+
return v;
|
|
35
|
+
if (o !== void 0)
|
|
36
|
+
return o;
|
|
37
|
+
throw new Error(`\`${d}\` must be used within \`${s}\``);
|
|
38
|
+
}
|
|
39
|
+
return [f, x];
|
|
40
|
+
}
|
|
41
|
+
const u = () => {
|
|
42
|
+
const s = t.map((o) => i.createContext(o));
|
|
43
|
+
return function(c) {
|
|
44
|
+
const a = (c == null ? void 0 : c[e]) || s;
|
|
45
|
+
return i.useMemo(
|
|
46
|
+
() => ({ [`__scope${e}`]: { ...c, [e]: a } }),
|
|
47
|
+
[c, a]
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
return u.scopeName = e, [r, P(u, ...n)];
|
|
52
|
+
}
|
|
53
|
+
function P(...e) {
|
|
54
|
+
const n = e[0];
|
|
55
|
+
if (e.length === 1)
|
|
56
|
+
return n;
|
|
57
|
+
const t = () => {
|
|
58
|
+
const r = e.map((u) => ({
|
|
59
|
+
useScope: u(),
|
|
60
|
+
scopeName: u.scopeName
|
|
61
|
+
}));
|
|
62
|
+
return function(s) {
|
|
63
|
+
const o = r.reduce((c, { useScope: a, scopeName: f }) => {
|
|
64
|
+
const d = a(s)[`__scope${f}`];
|
|
65
|
+
return { ...c, ...d };
|
|
66
|
+
}, {});
|
|
67
|
+
return i.useMemo(() => ({ [`__scope${n.scopeName}`]: o }), [o]);
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
return t.scopeName = n.scopeName, t;
|
|
71
|
+
}
|
|
72
|
+
function y(e) {
|
|
73
|
+
const n = i.useRef(e);
|
|
74
|
+
return i.useEffect(() => {
|
|
75
|
+
n.current = e;
|
|
76
|
+
}), i.useMemo(() => (...t) => {
|
|
77
|
+
var r;
|
|
78
|
+
return (r = n.current) == null ? void 0 : r.call(n, ...t);
|
|
79
|
+
}, []);
|
|
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 _({
|
|
106
|
+
prop: e,
|
|
107
|
+
defaultProp: n,
|
|
108
|
+
onChange: t = () => {
|
|
109
|
+
}
|
|
110
|
+
}) {
|
|
111
|
+
const [r, u] = p({ defaultProp: n, onChange: t }), s = e !== void 0, o = s ? e : r, c = y(t), a = i.useCallback(
|
|
112
|
+
(f) => {
|
|
113
|
+
if (s) {
|
|
114
|
+
const d = typeof f == "function" ? f(e) : f;
|
|
115
|
+
d !== e && c(d);
|
|
116
|
+
} else
|
|
117
|
+
u(f);
|
|
118
|
+
},
|
|
119
|
+
[s, e, u, c]
|
|
120
|
+
);
|
|
121
|
+
return [o, a];
|
|
122
|
+
}
|
|
123
|
+
function p({
|
|
124
|
+
defaultProp: e,
|
|
125
|
+
onChange: n
|
|
126
|
+
}) {
|
|
127
|
+
const t = i.useState(e), [r] = t, u = i.useRef(r), s = y(n);
|
|
128
|
+
return i.useEffect(() => {
|
|
129
|
+
u.current !== r && (s(r), u.current = r);
|
|
130
|
+
}, [r, u, s]), t;
|
|
131
|
+
}
|
|
132
|
+
export {
|
|
133
|
+
g as a,
|
|
134
|
+
_ as b,
|
|
135
|
+
E as c,
|
|
136
|
+
$ as d,
|
|
137
|
+
m as e,
|
|
138
|
+
y as u
|
|
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 m, d as p, e as f } from "./RPDefaultLayout-
|
|
2
|
+
import { b as x, R as n, c as s, u as m, d as p, e as f } from "./RPDefaultLayout-3a892bb5.js";
|
|
3
3
|
import { RPConfig as a } from "./components/RPConfig.js";
|
|
4
4
|
import { RPController as l } from "./components/RPController.js";
|
|
5
5
|
import { RPTheme as P } from "./components/RPTheme.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SearchResultNavigator: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import "../../contexts/RPDocumentContext.js";
|
|
4
|
-
import { c as C } from "../../RPDefaultLayout-
|
|
4
|
+
import { c as C } from "../../RPDefaultLayout-3a892bb5.js";
|
|
5
5
|
import "../../contexts/DarkModeContext.js";
|
|
6
6
|
import "../../contexts/RotationContext.js";
|
|
7
7
|
import "../../contexts/LayerContext.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useState as
|
|
1
|
+
import { useState as E, useCallback as h, useEffect as A } from "react";
|
|
2
2
|
import { appConsole as c } from "../appConsole.js";
|
|
3
|
-
const b = /* @__PURE__ */ new Date("2025-05-
|
|
3
|
+
const b = /* @__PURE__ */ new Date("2025-05-15T03:02:24.859Z"), l = "Please visit https://www.react-pdf.dev/manage-license/ to generate a new license key.", o = {
|
|
4
4
|
invalidLicense: `You are currently using without a valid license. ${l}`,
|
|
5
5
|
mismatchedDomain: `Your license key is not valid for the current domain / IP. ${l}`,
|
|
6
6
|
expired: `Your license key has expired. ${l}`,
|
|
@@ -44,20 +44,20 @@ kwIDAQAB
|
|
|
44
44
|
// Convert signature to ArrayBuffer
|
|
45
45
|
new TextEncoder().encode(atob(e))
|
|
46
46
|
))
|
|
47
|
-
throw new Error(
|
|
47
|
+
throw new Error(o.invalidSignature);
|
|
48
48
|
return JSON.parse(atob(e));
|
|
49
49
|
} catch {
|
|
50
|
-
throw new Error(
|
|
50
|
+
throw new Error(o.invalidLicense);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
const y = (r, t) => r === "specific" ? t === window.location.host : window.location.host.includes(t), d = {
|
|
54
54
|
isValid: !0,
|
|
55
|
-
invalidatedMessage:
|
|
55
|
+
invalidatedMessage: o.invalidLicense,
|
|
56
56
|
type: void 0
|
|
57
57
|
}, x = (r) => {
|
|
58
|
-
const [t, e] =
|
|
58
|
+
const [t, e] = E(d), n = h(async () => {
|
|
59
59
|
if (!r)
|
|
60
|
-
throw e(d), new Error(
|
|
60
|
+
throw e(d), new Error("License is missing");
|
|
61
61
|
let i;
|
|
62
62
|
try {
|
|
63
63
|
i = await I(r);
|
|
@@ -65,35 +65,35 @@ const y = (r, t) => r === "specific" ? t === window.location.host : window.locat
|
|
|
65
65
|
throw c.warn(m.message), new Error(m.message);
|
|
66
66
|
}
|
|
67
67
|
c.debug(">>> validatedLicense", i);
|
|
68
|
-
const { avu: a, exp:
|
|
69
|
-
if (!
|
|
68
|
+
const { avu: a, exp: s, dmt: w, dm: p, t: f } = i;
|
|
69
|
+
if (!s)
|
|
70
70
|
throw new Error("License is missing expiration timestamp");
|
|
71
|
-
if (
|
|
71
|
+
if (s > Number.MAX_SAFE_INTEGER / 1e3)
|
|
72
72
|
throw new Error("Invalid expiration timestamp: value too large");
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
75
|
-
throw new Error(
|
|
73
|
+
const v = new Date(s * 1e3), g = (/* @__PURE__ */ new Date()).getTime();
|
|
74
|
+
if (v.getTime() < g)
|
|
75
|
+
throw new Error(o.expired);
|
|
76
76
|
if (!a)
|
|
77
77
|
throw new Error("License is missing available until version timestamp");
|
|
78
78
|
if (a > Number.MAX_SAFE_INTEGER / 1e3)
|
|
79
79
|
throw new Error("Invalid available until version timestamp: value too large");
|
|
80
80
|
const u = new Date(a * 1e3);
|
|
81
81
|
if (c.debug("availableUntilTimestamp", u), u.getTime() < b.getTime())
|
|
82
|
-
throw new Error(
|
|
82
|
+
throw new Error(o.exceededVersion);
|
|
83
83
|
if (!y(w, p))
|
|
84
|
-
throw new Error(
|
|
84
|
+
throw new Error(o.mismatchedDomain);
|
|
85
85
|
return {
|
|
86
86
|
isValid: !0,
|
|
87
|
-
type:
|
|
87
|
+
type: f,
|
|
88
88
|
invalidatedMessage: void 0
|
|
89
89
|
};
|
|
90
90
|
}, [r]);
|
|
91
91
|
return A(() => {
|
|
92
|
-
n().then(({ isValid: i, type: a, invalidatedMessage:
|
|
92
|
+
n().then(({ isValid: i, type: a, invalidatedMessage: s }) => {
|
|
93
93
|
e({
|
|
94
94
|
isValid: i,
|
|
95
95
|
type: a,
|
|
96
|
-
invalidatedMessage:
|
|
96
|
+
invalidatedMessage: s
|
|
97
97
|
});
|
|
98
98
|
}).catch((i) => {
|
|
99
99
|
e({
|
|
@@ -4,7 +4,7 @@ import "../../contexts/DimensionPagesContext.js";
|
|
|
4
4
|
import "../calculatePage.js";
|
|
5
5
|
import "react/jsx-runtime";
|
|
6
6
|
import "../../contexts/RPDocumentContext.js";
|
|
7
|
-
import { v as F } from "../../RPDefaultLayout-
|
|
7
|
+
import { v as F } from "../../RPDefaultLayout-3a892bb5.js";
|
|
8
8
|
import "../../contexts/DarkModeContext.js";
|
|
9
9
|
import "../../contexts/RotationContext.js";
|
|
10
10
|
import "../../contexts/LayerContext.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "react";
|
|
2
2
|
import "react/jsx-runtime";
|
|
3
3
|
import "../../contexts/RPDocumentContext.js";
|
|
4
|
-
import { i as E } from "../../RPDefaultLayout-
|
|
4
|
+
import { i as E } from "../../RPDefaultLayout-3a892bb5.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 D } from "../../RPDefaultLayout-
|
|
5
|
+
import { f as D } from "../../RPDefaultLayout-3a892bb5.js";
|
|
6
6
|
import "../../contexts/DarkModeContext.js";
|
|
7
7
|
import "../types.js";
|
|
8
8
|
import "../../contexts/RotationContext.js";
|
|
@@ -7,7 +7,7 @@ import "pdfjs-dist";
|
|
|
7
7
|
import "../../contexts/RPDocumentContext.js";
|
|
8
8
|
import "../../contexts/ZoomContext.js";
|
|
9
9
|
import "react/jsx-runtime";
|
|
10
|
-
import { n as G } from "../../RPDefaultLayout-
|
|
10
|
+
import { n as G } from "../../RPDefaultLayout-3a892bb5.js";
|
|
11
11
|
import "../../contexts/DarkModeContext.js";
|
|
12
12
|
import "../../contexts/RotationContext.js";
|
|
13
13
|
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 F } from "../../RPDefaultLayout-
|
|
5
|
+
import { k as F } from "../../RPDefaultLayout-3a892bb5.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 { s as C } from "../../RPDefaultLayout-
|
|
6
|
+
import { s as C } from "../../RPDefaultLayout-3a892bb5.js";
|
|
7
7
|
import "../../contexts/DarkModeContext.js";
|
|
8
8
|
import "../../contexts/RotationContext.js";
|
|
9
9
|
import "../../contexts/LayerContext.js";
|