@pdf-viewer/react 0.4.0-beta.1 → 0.5.0-beta.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.
- package/dist/Container-337e1b18.js +37 -0
- package/dist/RPLayout-88110444.js +2757 -0
- package/dist/assets/Container.css +1 -1
- package/dist/assets/RPLayout.css +1 -0
- package/dist/assets/RPTooltip.css +1 -0
- package/dist/components/RPController.js +16 -47
- package/dist/components/RPDocument.js +13 -4
- package/dist/components/RPDropFileZone.js +18 -17
- package/dist/components/RPViewer.js +12 -22
- package/dist/components/layout/Container.js +6 -26
- package/dist/components/layout/RPLayout.js +14 -57
- package/dist/components/layout/WrapperLayout.js +9 -8
- package/dist/components/layout/sidebar/RPSidebar.js +10 -32
- package/dist/components/layout/sidebar/RPSplitter.js +9 -7
- package/dist/components/layout/sidebar/Thumbnail.js +1 -1
- package/dist/components/layout/sidebar/Thumbnails.js +1 -1
- package/dist/components/layout/toolbar/DarkModeTool.js +13 -12
- package/dist/components/layout/toolbar/DocumentDialog.js +7 -21
- package/dist/components/layout/toolbar/DocumentProperties.js +7 -6
- package/dist/components/layout/toolbar/FileDownloadTool.js +3 -2
- package/dist/components/layout/toolbar/FileUploadTool.js +16 -15
- package/dist/components/layout/toolbar/FullScreenTool.js +30 -32
- 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 +10 -23
- package/dist/components/layout/toolbar/OtherTool.js +4 -3
- package/dist/components/layout/toolbar/Paginate.js +3 -2
- package/dist/components/layout/toolbar/PrintTool.js +3 -2
- package/dist/components/layout/toolbar/RPToolbar.js +1 -1
- package/dist/components/layout/toolbar/RPToolbarEnd.js +2 -2
- package/dist/components/layout/toolbar/RotateTool.js +24 -23
- package/dist/components/layout/toolbar/ScrollModeTool.js +35 -34
- package/dist/components/layout/toolbar/SearchTool.js +8 -19
- package/dist/components/layout/toolbar/SelectionModeTool.js +27 -26
- package/dist/components/layout/toolbar/ViewModeTool.js +1 -1
- package/dist/components/layout/toolbar/ZoomTool.js +9 -19
- package/dist/components/page/AnnotationLayer.js +9 -23
- package/dist/components/page/CanvasLayer.js +7 -22
- package/dist/components/page/DualPage.js +1 -1
- package/dist/components/page/RPPage.js +8 -22
- package/dist/components/page/SinglePage.js +1 -1
- package/dist/components/page/TextLayer.js +7 -22
- 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 +2397 -0
- package/dist/contexts/PaginateContext.js +3 -3
- package/dist/contexts/PrintContext.js +2 -2
- package/dist/contexts/RPDocumentContext.js +33 -25
- package/dist/contexts/SearchContext.js +3 -3
- package/dist/contexts/ThumbnailsContext.js +4 -4
- package/dist/index-2b077daa.js +122 -0
- package/dist/{index-3459164c.js → index-8049287f.js} +982 -952
- package/dist/main.js +31 -32
- package/dist/types/components/layout/RPLayout.d.ts +1 -2
- package/dist/types/components/ui/RPTooltip.d.ts +8 -0
- package/dist/types/contexts/RPDocumentContext.d.ts +4 -2
- package/dist/types/main.d.ts +1 -0
- package/dist/types/utils/hooks/useLoadPdf.d.ts +2 -2
- package/dist/types/utils/types.d.ts +9 -2
- package/dist/utils/hooks/useFileDownload.js +7 -22
- package/dist/utils/hooks/useLicense.js +15 -23
- package/dist/utils/hooks/useLoadPdf.js +27 -27
- package/dist/utils/hooks/usePaginate.js +8 -21
- package/dist/utils/hooks/usePrint.js +7 -22
- package/dist/utils/hooks/useScrollToPage.js +9 -21
- package/dist/utils/hooks/useSearch.js +9 -22
- package/dist/utils/hooks/useThumbnail.js +7 -22
- package/dist/utils/hooks/useVirtualReactWindow.js +9 -21
- package/package.json +2 -1
- package/dist/Container.module-cb7b45b9.js +0 -14
- package/dist/RPSplitter.module-13d612c4.js +0 -7
- package/dist/RPTheme.module-f756e5cd.js +0 -7
- package/dist/Thumbnails-06fa1aa5.js +0 -2657
- package/dist/WrapperLayout.module-147bc943.js +0 -6
- package/dist/assets/Thumbnails.css +0 -1
- package/dist/index-743c36f0.js +0 -139
- /package/dist/assets/{RPTheme.css → RPDropFileZone.css} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import {
|
|
3
|
+
import { P as p, k as n, u as P } from "../RPLayout-88110444.js";
|
|
4
4
|
import "./RPDocumentContext.js";
|
|
5
5
|
import "../utils/appConsole.js";
|
|
6
6
|
import "./InitialStateContext.js";
|
|
7
7
|
export {
|
|
8
|
-
|
|
8
|
+
p as PaginateContext,
|
|
9
9
|
n as PaginateProvider,
|
|
10
|
-
|
|
10
|
+
P as usePaginateContext
|
|
11
11
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import {
|
|
3
|
+
import { p as e, q as n, c as p } from "../RPLayout-88110444.js";
|
|
4
4
|
export {
|
|
5
5
|
e as PrintContext,
|
|
6
6
|
n as PrintProvider,
|
|
7
|
-
|
|
7
|
+
p as usePrintContext
|
|
8
8
|
};
|
|
@@ -1,31 +1,39 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { useLoadPdf as
|
|
4
|
-
import { usePdfProperties as
|
|
5
|
-
import { LoaderIcon as
|
|
6
|
-
import { appConsole as
|
|
7
|
-
const c =
|
|
2
|
+
import { createContext as x, useState as a, useEffect as C, useMemo as g, useContext as v } from "react";
|
|
3
|
+
import { useLoadPdf as D } from "../utils/hooks/useLoadPdf.js";
|
|
4
|
+
import { usePdfProperties as S } from "../utils/hooks/usePdfProperties.js";
|
|
5
|
+
import { LoaderIcon as y } from "../components/icons/LoaderIcon.js";
|
|
6
|
+
import { appConsole as j } from "../utils/appConsole.js";
|
|
7
|
+
const c = x({
|
|
8
8
|
pdf: void 0,
|
|
9
9
|
pages: /* @__PURE__ */ new Map(),
|
|
10
10
|
setPdfSrc: () => {
|
|
11
11
|
},
|
|
12
12
|
setFilename: () => {
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
},
|
|
14
|
+
loading: !1
|
|
15
|
+
}), E = ({
|
|
16
|
+
children: t,
|
|
17
|
+
src: e,
|
|
18
|
+
characterMap: l,
|
|
19
|
+
onLoadError: u,
|
|
20
|
+
onLoaded: P
|
|
21
|
+
}) => {
|
|
22
|
+
const [o, i] = a(e), { pdf: n, pages: s, loading: p } = D(o, l, { onLoadError: u, onLoaded: P }), [d, f] = a(), m = S(o, n, d);
|
|
23
|
+
C(() => {
|
|
24
|
+
f(e == null ? void 0 : e.split("/").pop()), i(e);
|
|
18
25
|
}, [e]);
|
|
19
|
-
const
|
|
26
|
+
const h = g(() => ({
|
|
20
27
|
pdf: n,
|
|
21
|
-
pages:
|
|
28
|
+
pages: s,
|
|
22
29
|
pdfSrc: o,
|
|
23
|
-
setPdfSrc:
|
|
24
|
-
pdfProperties:
|
|
30
|
+
setPdfSrc: i,
|
|
31
|
+
pdfProperties: m,
|
|
25
32
|
setFilename: f,
|
|
26
|
-
filename:
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
filename: d,
|
|
34
|
+
loading: p
|
|
35
|
+
}), [n, s, o, m, p]);
|
|
36
|
+
return /* @__PURE__ */ r(c.Provider, { value: h, children: n ? t : /* @__PURE__ */ r(
|
|
29
37
|
"div",
|
|
30
38
|
{
|
|
31
39
|
style: {
|
|
@@ -35,15 +43,15 @@ const c = l({
|
|
|
35
43
|
height: "100%",
|
|
36
44
|
width: "100%"
|
|
37
45
|
},
|
|
38
|
-
children: /* @__PURE__ */ r(
|
|
46
|
+
children: /* @__PURE__ */ r(y, {})
|
|
39
47
|
}
|
|
40
|
-
);
|
|
41
|
-
},
|
|
42
|
-
const t =
|
|
43
|
-
return t.pdf ||
|
|
48
|
+
) });
|
|
49
|
+
}, R = () => {
|
|
50
|
+
const t = v(c);
|
|
51
|
+
return t.pdf || j.error("Please use this hooks inside children component of RPDocument"), t;
|
|
44
52
|
};
|
|
45
53
|
export {
|
|
46
|
-
|
|
54
|
+
E as DocumentProvider,
|
|
47
55
|
c as default,
|
|
48
|
-
|
|
56
|
+
R as useDocumentContext
|
|
49
57
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import {
|
|
3
|
+
import { S as a, g as s, d as S } from "../RPLayout-88110444.js";
|
|
4
4
|
export {
|
|
5
5
|
a as SearchContext,
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
s as SearchProvider,
|
|
7
|
+
S as useSearchContext
|
|
8
8
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import {
|
|
3
|
+
import { y as m, B as r, z as e } from "../RPLayout-88110444.js";
|
|
4
4
|
export {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
m as ThumbnailContext,
|
|
6
|
+
r as ThumbnailProvider,
|
|
7
|
+
e as useThumbnailContext
|
|
8
8
|
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import * as i from "react";
|
|
2
|
+
import { jsx as y } from "react/jsx-runtime";
|
|
3
|
+
function w(e, s = []) {
|
|
4
|
+
let t = [];
|
|
5
|
+
function o(c, u) {
|
|
6
|
+
const r = i.createContext(u), f = t.length;
|
|
7
|
+
t = [...t, u];
|
|
8
|
+
const a = (d) => {
|
|
9
|
+
var x;
|
|
10
|
+
const { scope: l, children: v, ...S } = d, h = ((x = l == null ? void 0 : l[e]) == null ? void 0 : x[f]) || r, z = i.useMemo(() => S, Object.values(S));
|
|
11
|
+
return /* @__PURE__ */ y(h.Provider, { value: z, children: v });
|
|
12
|
+
};
|
|
13
|
+
a.displayName = c + "Provider";
|
|
14
|
+
function b(d, l) {
|
|
15
|
+
var h;
|
|
16
|
+
const v = ((h = l == null ? void 0 : l[e]) == null ? void 0 : h[f]) || r, S = i.useContext(v);
|
|
17
|
+
if (S)
|
|
18
|
+
return S;
|
|
19
|
+
if (u !== void 0)
|
|
20
|
+
return u;
|
|
21
|
+
throw new Error(`\`${d}\` must be used within \`${c}\``);
|
|
22
|
+
}
|
|
23
|
+
return [a, b];
|
|
24
|
+
}
|
|
25
|
+
const n = () => {
|
|
26
|
+
const c = t.map((u) => i.createContext(u));
|
|
27
|
+
return function(r) {
|
|
28
|
+
const f = (r == null ? void 0 : r[e]) || c;
|
|
29
|
+
return i.useMemo(
|
|
30
|
+
() => ({ [`__scope${e}`]: { ...r, [e]: f } }),
|
|
31
|
+
[r, f]
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
return n.scopeName = e, [o, g(n, ...s)];
|
|
36
|
+
}
|
|
37
|
+
function g(...e) {
|
|
38
|
+
const s = e[0];
|
|
39
|
+
if (e.length === 1)
|
|
40
|
+
return s;
|
|
41
|
+
const t = () => {
|
|
42
|
+
const o = e.map((n) => ({
|
|
43
|
+
useScope: n(),
|
|
44
|
+
scopeName: n.scopeName
|
|
45
|
+
}));
|
|
46
|
+
return function(c) {
|
|
47
|
+
const u = o.reduce((r, { useScope: f, scopeName: a }) => {
|
|
48
|
+
const d = f(c)[`__scope${a}`];
|
|
49
|
+
return { ...r, ...d };
|
|
50
|
+
}, {});
|
|
51
|
+
return i.useMemo(() => ({ [`__scope${s.scopeName}`]: u }), [u]);
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
return t.scopeName = s.scopeName, t;
|
|
55
|
+
}
|
|
56
|
+
function C(e) {
|
|
57
|
+
const s = i.useRef(e);
|
|
58
|
+
return i.useEffect(() => {
|
|
59
|
+
s.current = e;
|
|
60
|
+
}), i.useMemo(() => (...t) => {
|
|
61
|
+
var o;
|
|
62
|
+
return (o = s.current) == null ? void 0 : o.call(s, ...t);
|
|
63
|
+
}, []);
|
|
64
|
+
}
|
|
65
|
+
var p = globalThis != null && globalThis.document ? i.useLayoutEffect : () => {
|
|
66
|
+
};
|
|
67
|
+
function E(e) {
|
|
68
|
+
const [s, t] = i.useState(void 0);
|
|
69
|
+
return p(() => {
|
|
70
|
+
if (e) {
|
|
71
|
+
t({ width: e.offsetWidth, height: e.offsetHeight });
|
|
72
|
+
const o = new ResizeObserver((n) => {
|
|
73
|
+
if (!Array.isArray(n) || !n.length)
|
|
74
|
+
return;
|
|
75
|
+
const c = n[0];
|
|
76
|
+
let u, r;
|
|
77
|
+
if ("borderBoxSize" in c) {
|
|
78
|
+
const f = c.borderBoxSize, a = Array.isArray(f) ? f[0] : f;
|
|
79
|
+
u = a.inlineSize, r = a.blockSize;
|
|
80
|
+
} else
|
|
81
|
+
u = e.offsetWidth, r = e.offsetHeight;
|
|
82
|
+
t({ width: u, height: r });
|
|
83
|
+
});
|
|
84
|
+
return o.observe(e, { box: "border-box" }), () => o.unobserve(e);
|
|
85
|
+
} else
|
|
86
|
+
t(void 0);
|
|
87
|
+
}, [e]), s;
|
|
88
|
+
}
|
|
89
|
+
function _({
|
|
90
|
+
prop: e,
|
|
91
|
+
defaultProp: s,
|
|
92
|
+
onChange: t = () => {
|
|
93
|
+
}
|
|
94
|
+
}) {
|
|
95
|
+
const [o, n] = m({ defaultProp: s, onChange: t }), c = e !== void 0, u = c ? e : o, r = C(t), f = i.useCallback(
|
|
96
|
+
(a) => {
|
|
97
|
+
if (c) {
|
|
98
|
+
const d = typeof a == "function" ? a(e) : a;
|
|
99
|
+
d !== e && r(d);
|
|
100
|
+
} else
|
|
101
|
+
n(a);
|
|
102
|
+
},
|
|
103
|
+
[c, e, n, r]
|
|
104
|
+
);
|
|
105
|
+
return [u, f];
|
|
106
|
+
}
|
|
107
|
+
function m({
|
|
108
|
+
defaultProp: e,
|
|
109
|
+
onChange: s
|
|
110
|
+
}) {
|
|
111
|
+
const t = i.useState(e), [o] = t, n = i.useRef(o), c = C(s);
|
|
112
|
+
return i.useEffect(() => {
|
|
113
|
+
n.current !== o && (c(o), n.current = o);
|
|
114
|
+
}, [o, n, c]), t;
|
|
115
|
+
}
|
|
116
|
+
export {
|
|
117
|
+
_ as a,
|
|
118
|
+
E as b,
|
|
119
|
+
w as c,
|
|
120
|
+
C as d,
|
|
121
|
+
p as u
|
|
122
|
+
};
|