@react-pdf-kit/viewer 2.5.0-beta.1 → 2.5.0-beta.2
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/assets/style.css +1 -1
- package/dist/assets/style.js +1 -1
- package/dist/components/RPController.js +25 -24
- package/dist/components/RPProvider.js +3 -2
- package/dist/components/layout/RPDefaultLayout.js +7 -3
- package/dist/components/layout/RPLayout.js +7 -3
- package/dist/components/layout/sidebar/CustomThumbnailElement.js +53 -0
- package/dist/components/layout/sidebar/RPSidebar.js +7 -3
- package/dist/components/layout/sidebar/Thumbnail.js +59 -50
- package/dist/components/layout/sidebar/Thumbnails.js +29 -25
- package/dist/components/layout/toolbar/ToolbarCustom.js +7 -3
- package/dist/components/layout/toolbar/ToolbarDefault.js +7 -3
- package/dist/components/layout/toolbar/ToolbarLayout.js +6 -2
- package/dist/components/layout/toolbar/tools/DualPageWithCoverTool.js +4 -2
- package/dist/components/layout/toolbar/tools/FirstPageTool.js +4 -2
- package/dist/components/layout/toolbar/tools/LastPageTool.js +4 -2
- package/dist/contexts/ElementThumbnailContext.js +129 -0
- package/dist/main.js +110 -107
- package/dist/types/components/layout/sidebar/CustomThumbnailElement.d.ts +6 -0
- package/dist/types/contexts/ElementThumbnailContext.d.ts +11 -0
- package/dist/types/main.d.ts +1 -0
- package/dist/types/utils/types.d.ts +12 -0
- package/dist/utils/hooks/useLicense.js +1 -1
- package/package.json +1 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useRef as h, useState as
|
|
3
|
-
import { c as
|
|
4
|
-
import { LoaderIcon as
|
|
5
|
-
import { u as
|
|
6
|
-
import { usePagesRotateContext as
|
|
7
|
-
import { useRenderQueue as
|
|
8
|
-
import { useDocumentContext as
|
|
1
|
+
import { jsxs as _, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as h, useState as z, useMemo as w, useCallback as N, useEffect as $ } from "react";
|
|
3
|
+
import { c as S } from "../../../clsx-0c6e471a.js";
|
|
4
|
+
import { LoaderIcon as I } from "../../icons/LoaderIcon.js";
|
|
5
|
+
import { u as L } from "../../../PaginationContext-87f832f2.js";
|
|
6
|
+
import { usePagesRotateContext as T } from "../../../contexts/PagesRotateContext.js";
|
|
7
|
+
import { useRenderQueue as j } from "../../../contexts/RenderQueueProvider.js";
|
|
8
|
+
import { useDocumentContext as q } from "../../../contexts/RPDocumentContext.js";
|
|
9
|
+
import { CustomThumbnailElement as D } from "./CustomThumbnailElement.js";
|
|
9
10
|
import "../../../utils/types.js";
|
|
10
11
|
import "../../../de_DE-8145915f.js";
|
|
11
12
|
import "../../../contexts/ScrollModeContext.js";
|
|
@@ -38,33 +39,38 @@ import "../../../utils/getScrollDistance.js";
|
|
|
38
39
|
import "../../../utils/calculatePage.js";
|
|
39
40
|
import "../../../utils/Queue.js";
|
|
40
41
|
import "../../../utils/renderPage.js";
|
|
42
|
+
import "../../../contexts/ElementThumbnailContext.js";
|
|
43
|
+
import "../../../contexts/LicenseContext.js";
|
|
44
|
+
import "../../../utils/hooks/useLicense.js";
|
|
45
|
+
import "../../../contexts/ThumbnailsContext.js";
|
|
46
|
+
import "../../../utils/hooks/useThumbnail.js";
|
|
41
47
|
const i = {
|
|
42
|
-
"rp-thumbnail-wrapper": "_rp-thumbnail-
|
|
43
|
-
"rp-thumbnail-text": "_rp-thumbnail-
|
|
44
|
-
"rp-thumbnail": "_rp-
|
|
45
|
-
"rp-thumbnail-active": "_rp-thumbnail-
|
|
46
|
-
"rp-thumbnail-loader": "_rp-thumbnail-
|
|
47
|
-
},
|
|
48
|
-
const { pageNumber: t, isFocused:
|
|
48
|
+
"rp-thumbnail-wrapper": "_rp-thumbnail-wrapper_czi7p_1",
|
|
49
|
+
"rp-thumbnail-text": "_rp-thumbnail-text_czi7p_10",
|
|
50
|
+
"rp-thumbnail": "_rp-thumbnail_czi7p_1",
|
|
51
|
+
"rp-thumbnail-active": "_rp-thumbnail-active_czi7p_23",
|
|
52
|
+
"rp-thumbnail-loader": "_rp-thumbnail-loader_czi7p_32"
|
|
53
|
+
}, Nt = (C) => {
|
|
54
|
+
const { pageNumber: t, isFocused: u, viewport: s } = C, { goToPage: d } = L(), { pageRotate: P } = T(), o = h(null), n = j(), { pages: a } = q(), [m, b] = z(null), c = h(!1), g = h(), R = w(() => u ? i["rp-thumbnail-active"] : "", [u]), p = w(() => ({
|
|
49
55
|
width: Math.round(s.width),
|
|
50
56
|
height: Math.round(s.height)
|
|
51
|
-
}), [s]),
|
|
57
|
+
}), [s]), f = N(() => {
|
|
52
58
|
t && d(t);
|
|
53
59
|
}, [d, t]);
|
|
54
|
-
return
|
|
60
|
+
return $(() => {
|
|
55
61
|
const e = a.get(t);
|
|
56
|
-
|
|
57
|
-
}, [a, t]),
|
|
62
|
+
g.current === e || (b(null), g.current = e);
|
|
63
|
+
}, [a, t]), $(() => {
|
|
58
64
|
const e = a.get(t);
|
|
59
65
|
if (!o.current || !t || !e || m)
|
|
60
66
|
return;
|
|
61
67
|
const l = new IntersectionObserver((y) => {
|
|
62
|
-
y.forEach((
|
|
68
|
+
y.forEach((E) => {
|
|
63
69
|
if (c.current) {
|
|
64
70
|
c.current = !1, n.removeQueue(`thumbnail-${t}`);
|
|
65
71
|
return;
|
|
66
72
|
}
|
|
67
|
-
if (
|
|
73
|
+
if (E.isIntersecting) {
|
|
68
74
|
const v = document.createElement("canvas");
|
|
69
75
|
c.current = !0, n.enqueue(
|
|
70
76
|
`thumbnail-${t}`,
|
|
@@ -78,8 +84,8 @@ const i = {
|
|
|
78
84
|
v.toBlob((x) => {
|
|
79
85
|
if (!x)
|
|
80
86
|
return;
|
|
81
|
-
const
|
|
82
|
-
b(
|
|
87
|
+
const k = URL.createObjectURL(x);
|
|
88
|
+
b(k);
|
|
83
89
|
});
|
|
84
90
|
}
|
|
85
91
|
},
|
|
@@ -91,12 +97,12 @@ const i = {
|
|
|
91
97
|
return o.current && l.observe(o.current), () => {
|
|
92
98
|
l.disconnect(), n.removeQueue(`thumbnail-${t}`);
|
|
93
99
|
};
|
|
94
|
-
}, [n, t, a, m]), /* @__PURE__ */
|
|
100
|
+
}, [n, t, a, m]), /* @__PURE__ */ _(
|
|
95
101
|
"div",
|
|
96
102
|
{
|
|
97
|
-
onClick:
|
|
103
|
+
onClick: f,
|
|
98
104
|
onKeyDown: (e) => {
|
|
99
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
105
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), f());
|
|
100
106
|
},
|
|
101
107
|
id: `page-${t}`,
|
|
102
108
|
className: i["rp-thumbnail-wrapper"],
|
|
@@ -104,36 +110,39 @@ const i = {
|
|
|
104
110
|
role: "button",
|
|
105
111
|
tabIndex: 0,
|
|
106
112
|
"aria-label": `Go to page ${t}`,
|
|
107
|
-
"aria-current":
|
|
113
|
+
"aria-current": u ? "page" : void 0,
|
|
108
114
|
children: [
|
|
109
|
-
/* @__PURE__ */
|
|
115
|
+
/* @__PURE__ */ _(
|
|
110
116
|
"div",
|
|
111
117
|
{
|
|
112
118
|
style: {
|
|
113
119
|
transform: `rotate(${P[t || 0]}deg)`
|
|
114
120
|
},
|
|
115
|
-
className:
|
|
121
|
+
className: S(R, i["rp-thumbnail"]),
|
|
116
122
|
"aria-hidden": "true",
|
|
117
|
-
children:
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
123
|
+
children: [
|
|
124
|
+
m ? /* @__PURE__ */ r(
|
|
125
|
+
"img",
|
|
126
|
+
{
|
|
127
|
+
src: m,
|
|
128
|
+
width: p.width,
|
|
129
|
+
height: p.height,
|
|
130
|
+
alt: `Page ${t} thumbnail`,
|
|
131
|
+
"aria-hidden": "true"
|
|
132
|
+
}
|
|
133
|
+
) : /* @__PURE__ */ r(
|
|
134
|
+
"div",
|
|
135
|
+
{
|
|
136
|
+
className: i["rp-thumbnail-loader"],
|
|
137
|
+
style: {
|
|
138
|
+
width: `${p.width}px`,
|
|
139
|
+
height: `${p.height}px`
|
|
140
|
+
},
|
|
141
|
+
children: /* @__PURE__ */ r(I, { "aria-hidden": "true" })
|
|
142
|
+
}
|
|
143
|
+
),
|
|
144
|
+
/* @__PURE__ */ r(D, { pageNumber: t })
|
|
145
|
+
]
|
|
137
146
|
}
|
|
138
147
|
),
|
|
139
148
|
/* @__PURE__ */ r("div", { className: i["rp-thumbnail-text"], "aria-hidden": "true", children: t })
|
|
@@ -142,5 +151,5 @@ const i = {
|
|
|
142
151
|
);
|
|
143
152
|
};
|
|
144
153
|
export {
|
|
145
|
-
|
|
154
|
+
Nt as Thumbnail
|
|
146
155
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as d, useImperativeHandle as R, useEffect as T, useMemo as x, useCallback as C } from "react";
|
|
3
3
|
import { Thumbnail as y } from "./Thumbnail.js";
|
|
4
|
-
import { useThumbnailContext as
|
|
5
|
-
import { useInfiniteScroll as
|
|
6
|
-
import { u as
|
|
7
|
-
import {
|
|
4
|
+
import { useThumbnailContext as I } from "../../../contexts/ThumbnailsContext.js";
|
|
5
|
+
import { useInfiniteScroll as S } from "../../../utils/hooks/useInfiniteScroll.js";
|
|
6
|
+
import { u as j } from "../../../PaginationContext-87f832f2.js";
|
|
7
|
+
import { useThumbnailContainerRegister as z } from "../../../contexts/ElementThumbnailContext.js";
|
|
8
|
+
import { withRef as D } from "../../../utils/withRef.js";
|
|
8
9
|
import "../../../clsx-0c6e471a.js";
|
|
9
10
|
import "../../icons/LoaderIcon.js";
|
|
10
11
|
import "../../../contexts/PagesRotateContext.js";
|
|
@@ -42,37 +43,40 @@ import "../../../utils/hooks/useDebounce.js";
|
|
|
42
43
|
import "../../../contexts/SmoothScrollContext.js";
|
|
43
44
|
import "../../../utils/getScrollDistance.js";
|
|
44
45
|
import "../../../utils/calculatePage.js";
|
|
46
|
+
import "./CustomThumbnailElement.js";
|
|
45
47
|
import "../../../utils/hooks/useThumbnail.js";
|
|
46
|
-
|
|
48
|
+
import "../../../contexts/LicenseContext.js";
|
|
49
|
+
import "../../../utils/hooks/useLicense.js";
|
|
50
|
+
const P = {
|
|
47
51
|
"rp-thumbnails-container": "_rp-thumbnails-container_1szrf_1",
|
|
48
52
|
"rp-thumbnails": "_rp-thumbnails_1szrf_1"
|
|
49
|
-
},
|
|
50
|
-
const t = r == null ? void 0 : r.querySelector(`#page-${
|
|
51
|
-
r && (t != null && t.offsetTop) && (r.scrollTop = (t == null ? void 0 : t.offsetTop) -
|
|
52
|
-
},
|
|
53
|
-
const { show: t, width:
|
|
54
|
-
|
|
55
|
-
const
|
|
53
|
+
}, M = 16, O = (r, p) => {
|
|
54
|
+
const t = r == null ? void 0 : r.querySelector(`#page-${p}`);
|
|
55
|
+
r && (t != null && t.offsetTop) && (r.scrollTop = (t == null ? void 0 : t.offsetTop) - M);
|
|
56
|
+
}, jt = D((r, p) => {
|
|
57
|
+
const { show: t, width: _ } = r, { focusedPage: i, totalPages: a } = j(), { thumbnailPages: u, addPage: c, thumbnailLength: m, addToPage: l } = I(), s = z(), n = d(null), f = d(1);
|
|
58
|
+
R(p, () => n.current), T(() => (s(n.current), () => s(null)), [s]);
|
|
59
|
+
const h = x(() => Object.values(u), [u]), v = C(() => {
|
|
56
60
|
const o = m + 1;
|
|
57
|
-
o <= a &&
|
|
58
|
-
}, [
|
|
59
|
-
return
|
|
60
|
-
i > m && a > m ?
|
|
61
|
-
}, [i, m,
|
|
62
|
-
var
|
|
63
|
-
return /* @__PURE__ */
|
|
61
|
+
o <= a && c(o);
|
|
62
|
+
}, [c, a, m]);
|
|
63
|
+
return T(() => {
|
|
64
|
+
i > m && a > m ? l(i) : t && f.current !== i && (O(n.current, i), f.current = i);
|
|
65
|
+
}, [i, m, l, t, h]), S(n.current, v), /* @__PURE__ */ e("div", { ref: n, className: P["rp-thumbnails-container"], style: { width: _ }, children: /* @__PURE__ */ e("div", { className: P["rp-thumbnails"], children: t ? h.map((o, N) => {
|
|
66
|
+
var b, g;
|
|
67
|
+
return /* @__PURE__ */ e(
|
|
64
68
|
y,
|
|
65
69
|
{
|
|
66
|
-
isFocused: i === ((
|
|
67
|
-
pageNumber: (
|
|
70
|
+
isFocused: i === ((b = o.page) == null ? void 0 : b.pageNumber),
|
|
71
|
+
pageNumber: (g = o.page) == null ? void 0 : g.pageNumber,
|
|
68
72
|
loading: o.loading,
|
|
69
73
|
viewport: o.viewport,
|
|
70
74
|
defaultRotation: o.defaultRotation
|
|
71
75
|
},
|
|
72
|
-
|
|
76
|
+
N
|
|
73
77
|
);
|
|
74
78
|
}) : null }) });
|
|
75
79
|
});
|
|
76
80
|
export {
|
|
77
|
-
|
|
81
|
+
jt as Thumbnails
|
|
78
82
|
};
|
|
@@ -46,14 +46,18 @@ import "../../../utils/calculatePage.js";
|
|
|
46
46
|
import "../../../contexts/RenderQueueProvider.js";
|
|
47
47
|
import "../../../utils/Queue.js";
|
|
48
48
|
import "../../../utils/renderPage.js";
|
|
49
|
+
import "../sidebar/CustomThumbnailElement.js";
|
|
50
|
+
import "../../../contexts/ElementThumbnailContext.js";
|
|
51
|
+
import "../../../contexts/LicenseContext.js";
|
|
52
|
+
import "../../../utils/hooks/useLicense.js";
|
|
53
|
+
import "../../../utils/hooks/useThumbnail.js";
|
|
49
54
|
import "../../../utils/hooks/useInfiniteScroll.js";
|
|
50
55
|
import "../../../utils/withRef.js";
|
|
51
|
-
import "../../../utils/hooks/useThumbnail.js";
|
|
52
56
|
import "../../../utils/hooks/usePrint.js";
|
|
53
57
|
import "../../../contexts/LocalizationContext.js";
|
|
54
58
|
import "../../../utils/hooks/useLocalization.js";
|
|
55
59
|
import "../../../contexts/ViewportContext.js";
|
|
56
|
-
const
|
|
60
|
+
const jr = (h) => {
|
|
57
61
|
const { children: u, toolbar: b } = h, n = d(null), { active: a } = x(), { showPrintProgress: f } = C(), { progress: g, showDefaultProgress: w } = R(), { percentage: s } = g || {}, o = b, m = o == null ? void 0 : o.topbar, p = o == null ? void 0 : o.leftSidebar, l = d(null), [c, P] = N(I), v = w ?? f;
|
|
58
62
|
return /* @__PURE__ */ i(e, { children: [
|
|
59
63
|
/* @__PURE__ */ i("div", { className: t["rp-toolbar-layout"], children: [
|
|
@@ -106,5 +110,5 @@ const Fr = (h) => {
|
|
|
106
110
|
] });
|
|
107
111
|
};
|
|
108
112
|
export {
|
|
109
|
-
|
|
113
|
+
jr as ToolbarCustom
|
|
110
114
|
};
|
|
@@ -48,9 +48,13 @@ import "../../../utils/calculatePage.js";
|
|
|
48
48
|
import "../../../contexts/RenderQueueProvider.js";
|
|
49
49
|
import "../../../utils/Queue.js";
|
|
50
50
|
import "../../../utils/renderPage.js";
|
|
51
|
+
import "../sidebar/CustomThumbnailElement.js";
|
|
52
|
+
import "../../../contexts/ElementThumbnailContext.js";
|
|
53
|
+
import "../../../contexts/LicenseContext.js";
|
|
54
|
+
import "../../../utils/hooks/useLicense.js";
|
|
55
|
+
import "../../../utils/hooks/useThumbnail.js";
|
|
51
56
|
import "../../../utils/hooks/useInfiniteScroll.js";
|
|
52
57
|
import "../../../utils/withRef.js";
|
|
53
|
-
import "../../../utils/hooks/useThumbnail.js";
|
|
54
58
|
import "../../../contexts/IconToolContext.js";
|
|
55
59
|
import "../../../contexts/ToolComponentContext.js";
|
|
56
60
|
import "./ThumbnailTool.js";
|
|
@@ -144,7 +148,7 @@ import "../../icons/HandModeDefaultIcon.js";
|
|
|
144
148
|
import "../../../contexts/SelectionModeContext.js";
|
|
145
149
|
import "../../../utils/hooks/usePrint.js";
|
|
146
150
|
import "../../../RPToolbar.module-27d7fe77.js";
|
|
147
|
-
const
|
|
151
|
+
const fo = (l) => {
|
|
148
152
|
const { children: c } = l, i = s(null), { active: m } = w(), { showPrintProgress: d } = v(), { progress: h, showDefaultProgress: u } = x(), { percentage: p } = h || {}, e = s(null), [a, b] = P(D), f = u ?? d;
|
|
149
153
|
return /* @__PURE__ */ o(n, { children: [
|
|
150
154
|
/* @__PURE__ */ o("div", { className: t["rp-toolbar-layout"], children: [
|
|
@@ -189,5 +193,5 @@ const co = (l) => {
|
|
|
189
193
|
] });
|
|
190
194
|
};
|
|
191
195
|
export {
|
|
192
|
-
|
|
196
|
+
fo as ToolbarDefault
|
|
193
197
|
};
|
|
@@ -43,6 +43,10 @@ import "../../../utils/calculatePage.js";
|
|
|
43
43
|
import "../../../contexts/RenderQueueProvider.js";
|
|
44
44
|
import "../../../utils/Queue.js";
|
|
45
45
|
import "../../../utils/renderPage.js";
|
|
46
|
+
import "../sidebar/CustomThumbnailElement.js";
|
|
47
|
+
import "../../../contexts/ElementThumbnailContext.js";
|
|
48
|
+
import "../../../contexts/LicenseContext.js";
|
|
49
|
+
import "../../../utils/hooks/useLicense.js";
|
|
46
50
|
import "../../../contexts/ThumbnailsContext.js";
|
|
47
51
|
import "../../../utils/hooks/useThumbnail.js";
|
|
48
52
|
import "../../../utils/hooks/useInfiniteScroll.js";
|
|
@@ -146,10 +150,10 @@ import "../../../contexts/SelectionModeContext.js";
|
|
|
146
150
|
import "../../../RPToolbar.module-27d7fe77.js";
|
|
147
151
|
import "../../ui/LoadingIndicator.js";
|
|
148
152
|
import "../../../RPSplitter-b62772f9.js";
|
|
149
|
-
const
|
|
153
|
+
const Zr = (m) => {
|
|
150
154
|
const { children: r, toolbar: o } = m;
|
|
151
155
|
return o && typeof o == "boolean" ? /* @__PURE__ */ t(i, { children: r }) : /* @__PURE__ */ t(p, { toolbar: o, children: r });
|
|
152
156
|
};
|
|
153
157
|
export {
|
|
154
|
-
|
|
158
|
+
Zr as ToolbarLayout
|
|
155
159
|
};
|
|
@@ -30,6 +30,7 @@ import "../../../../contexts/LicenseContext.js";
|
|
|
30
30
|
import "../../../../contexts/DownloadContext.js";
|
|
31
31
|
import "../../../../contexts/SmoothScrollContext.js";
|
|
32
32
|
import "../../../../contexts/ElementPageContext.js";
|
|
33
|
+
import "../../../../contexts/ElementThumbnailContext.js";
|
|
33
34
|
import "../../../../contexts/PagesRotateContext.js";
|
|
34
35
|
import "../../../../contexts/RenderQueueProvider.js";
|
|
35
36
|
import "../../../../contexts/GlobalCurrentPage.js";
|
|
@@ -184,11 +185,12 @@ import "../../../icons/CloseIcon.js";
|
|
|
184
185
|
import "../../sidebar/RPSidebar.js";
|
|
185
186
|
import "../../../icons/Thumbnail.js";
|
|
186
187
|
import "../../sidebar/Thumbnail.js";
|
|
188
|
+
import "../../sidebar/CustomThumbnailElement.js";
|
|
187
189
|
import "../../../../utils/hooks/useInfiniteScroll.js";
|
|
188
190
|
import "../../../icons/LightPdfIcon.js";
|
|
189
191
|
import "../../../icons/DarkPdfIcon.js";
|
|
190
192
|
import "../../../../utils/hooks/useDropFileZone.js";
|
|
191
|
-
const C = ({ children: t, className: i, localeMessages: o }) => /* @__PURE__ */ r(m, { className: i, content: o == null ? void 0 : o.dualPageWithCoverTooltip, children: t }),
|
|
193
|
+
const C = ({ children: t, className: i, localeMessages: o }) => /* @__PURE__ */ r(m, { className: i, content: o == null ? void 0 : o.dualPageWithCoverTooltip, children: t }), Jr = ({ icon: t }) => {
|
|
192
194
|
const { setDualPageWithCover: i } = e(), { localeMessages: o } = u();
|
|
193
195
|
return /* @__PURE__ */ r(C, { localeMessages: o, children: /* @__PURE__ */ r(
|
|
194
196
|
p,
|
|
@@ -200,5 +202,5 @@ const C = ({ children: t, className: i, localeMessages: o }) => /* @__PURE__ */
|
|
|
200
202
|
) });
|
|
201
203
|
};
|
|
202
204
|
export {
|
|
203
|
-
|
|
205
|
+
Jr as DualPageWithCoverTool
|
|
204
206
|
};
|
|
@@ -29,6 +29,7 @@ import "../../../../contexts/LicenseContext.js";
|
|
|
29
29
|
import "../../../../contexts/DownloadContext.js";
|
|
30
30
|
import "../../../../contexts/SmoothScrollContext.js";
|
|
31
31
|
import "../../../../contexts/ElementPageContext.js";
|
|
32
|
+
import "../../../../contexts/ElementThumbnailContext.js";
|
|
32
33
|
import "../../../../contexts/PagesRotateContext.js";
|
|
33
34
|
import "../../../../contexts/RenderQueueProvider.js";
|
|
34
35
|
import "../../../../contexts/GlobalCurrentPage.js";
|
|
@@ -184,16 +185,17 @@ import "../../../icons/CloseIcon.js";
|
|
|
184
185
|
import "../../sidebar/RPSidebar.js";
|
|
185
186
|
import "../../../icons/Thumbnail.js";
|
|
186
187
|
import "../../sidebar/Thumbnail.js";
|
|
188
|
+
import "../../sidebar/CustomThumbnailElement.js";
|
|
187
189
|
import "../../../../utils/hooks/useInfiniteScroll.js";
|
|
188
190
|
import "../../../icons/LightPdfIcon.js";
|
|
189
191
|
import "../../../icons/DarkPdfIcon.js";
|
|
190
192
|
import "../../../../utils/hooks/useDropFileZone.js";
|
|
191
|
-
const l = ({ children: t, className: r, localeMessages: o }) => /* @__PURE__ */ i(n, { className: r, content: o == null ? void 0 : o.firstPageTooltip, children: t }),
|
|
193
|
+
const l = ({ children: t, className: r, localeMessages: o }) => /* @__PURE__ */ i(n, { className: r, content: o == null ? void 0 : o.firstPageTooltip, children: t }), Qr = ({ icon: t }) => {
|
|
192
194
|
const { goToPage: r } = f(), { localeMessages: o } = c(), m = p(() => {
|
|
193
195
|
r(1);
|
|
194
196
|
}, [r]);
|
|
195
197
|
return /* @__PURE__ */ i(l, { localeMessages: o, children: /* @__PURE__ */ i(a, { onClick: m, "aria-label": o == null ? void 0 : o.firstPageTooltip, children: t || /* @__PURE__ */ i(T, { className: P["rp-go-to-Top"] }) }) });
|
|
196
198
|
};
|
|
197
199
|
export {
|
|
198
|
-
|
|
200
|
+
Qr as FirstPageTool
|
|
199
201
|
};
|
|
@@ -29,6 +29,7 @@ import "../../../../contexts/LicenseContext.js";
|
|
|
29
29
|
import "../../../../contexts/DownloadContext.js";
|
|
30
30
|
import "../../../../contexts/SmoothScrollContext.js";
|
|
31
31
|
import "../../../../contexts/ElementPageContext.js";
|
|
32
|
+
import "../../../../contexts/ElementThumbnailContext.js";
|
|
32
33
|
import "../../../../contexts/PagesRotateContext.js";
|
|
33
34
|
import "../../../../contexts/RenderQueueProvider.js";
|
|
34
35
|
import "../../../../contexts/GlobalCurrentPage.js";
|
|
@@ -184,16 +185,17 @@ import "../../../icons/CloseIcon.js";
|
|
|
184
185
|
import "../../sidebar/RPSidebar.js";
|
|
185
186
|
import "../../../icons/Thumbnail.js";
|
|
186
187
|
import "../../sidebar/Thumbnail.js";
|
|
188
|
+
import "../../sidebar/CustomThumbnailElement.js";
|
|
187
189
|
import "../../../../utils/hooks/useInfiniteScroll.js";
|
|
188
190
|
import "../../../icons/LightPdfIcon.js";
|
|
189
191
|
import "../../../icons/DarkPdfIcon.js";
|
|
190
192
|
import "../../../../utils/hooks/useDropFileZone.js";
|
|
191
|
-
const c = ({ children: t, className: r, localeMessages: o }) => /* @__PURE__ */ m(a, { className: r, content: o == null ? void 0 : o.lastPageTooltip, children: t }),
|
|
193
|
+
const c = ({ children: t, className: r, localeMessages: o }) => /* @__PURE__ */ m(a, { className: r, content: o == null ? void 0 : o.lastPageTooltip, children: t }), Qr = ({ icon: t }) => {
|
|
192
194
|
const { goToPage: r, totalPages: o } = T(), { localeMessages: i } = f(), p = n(() => {
|
|
193
195
|
r(o);
|
|
194
196
|
}, [r, o]);
|
|
195
197
|
return /* @__PURE__ */ m(c, { localeMessages: i, children: /* @__PURE__ */ m(P, { onClick: p, "aria-label": i == null ? void 0 : i.lastPageTooltip, children: t || /* @__PURE__ */ m(l, {}) }) });
|
|
196
198
|
};
|
|
197
199
|
export {
|
|
198
|
-
|
|
200
|
+
Qr as LastPageTool
|
|
199
201
|
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { jsx as y } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as M, useState as O, useRef as x, useCallback as m, useContext as L, useMemo as B } from "react";
|
|
3
|
+
import { LicenseType as D } from "../utils/types.js";
|
|
4
|
+
import { usePagesRotateContext as I } from "./PagesRotateContext.js";
|
|
5
|
+
import { useLicenseContext as G } from "./LicenseContext.js";
|
|
6
|
+
import { useThumbnailContext as g } from "./ThumbnailsContext.js";
|
|
7
|
+
import { useSmoothScrollContext as F } from "./SmoothScrollContext.js";
|
|
8
|
+
import { ORGANIZATION_ALLOWED_FEATURES_MESSAGE as h } from "../utils/const.js";
|
|
9
|
+
import "../de_DE-8145915f.js";
|
|
10
|
+
import "./RPDocumentContext.js";
|
|
11
|
+
import "../utils/hooks/useLoadPdf.js";
|
|
12
|
+
import "pdfjs-dist";
|
|
13
|
+
import "../utils/getThumbnailViewport.js";
|
|
14
|
+
import "./ConfigContext.js";
|
|
15
|
+
import "./DocumentPasswordContext.js";
|
|
16
|
+
import "../utils/appConsole.js";
|
|
17
|
+
import "../utils/hooks/usePdfProperties.js";
|
|
18
|
+
import "../utils/convertPdfDate.js";
|
|
19
|
+
import "../utils/formatFileSize.js";
|
|
20
|
+
import "./RotationContext.js";
|
|
21
|
+
import "./InitialStateContext.js";
|
|
22
|
+
import "./EventCallbackContext.js";
|
|
23
|
+
import "../utils/hooks/useLicense.js";
|
|
24
|
+
import "../utils/hooks/useThumbnail.js";
|
|
25
|
+
const U = 16, f = M(
|
|
26
|
+
void 0
|
|
27
|
+
), mt = ({ children: r }) => {
|
|
28
|
+
const [a, s] = O({}), { pageRotate: n } = I(), { thumbnailPages: p } = g(), { scrollBehavior: E } = F(), d = x(null), w = m((e) => {
|
|
29
|
+
d.current = e;
|
|
30
|
+
}, []), R = m(
|
|
31
|
+
(e, i) => {
|
|
32
|
+
s((o) => {
|
|
33
|
+
var l;
|
|
34
|
+
const t = (l = p[e]) == null ? void 0 : l.viewport, c = {
|
|
35
|
+
width: t ? t.width : 0,
|
|
36
|
+
height: t ? t.height : 0
|
|
37
|
+
};
|
|
38
|
+
return {
|
|
39
|
+
...o,
|
|
40
|
+
[e]: i(o[e] ?? [], c, n[e] ?? 0)
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
[p, n]
|
|
45
|
+
), b = m((e) => {
|
|
46
|
+
s((i) => {
|
|
47
|
+
const o = { ...i };
|
|
48
|
+
return delete o[e], o;
|
|
49
|
+
});
|
|
50
|
+
}, []), A = m((e, i) => {
|
|
51
|
+
s((o) => {
|
|
52
|
+
const t = { ...o };
|
|
53
|
+
return t[e] ? (t[e] = t[e].filter((c, l) => l !== i), t) : o;
|
|
54
|
+
});
|
|
55
|
+
}, []), S = m(
|
|
56
|
+
(e, i, o) => {
|
|
57
|
+
var v;
|
|
58
|
+
const t = d.current;
|
|
59
|
+
if (!t)
|
|
60
|
+
return;
|
|
61
|
+
const c = t.querySelector(
|
|
62
|
+
`[data-rp="thumbnail-${e}-customElement"]`
|
|
63
|
+
), l = (v = c == null ? void 0 : c.children) == null ? void 0 : v[i];
|
|
64
|
+
if (!l)
|
|
65
|
+
return;
|
|
66
|
+
const T = t.getBoundingClientRect(), C = l.getBoundingClientRect(), P = t.scrollTop + (C.top - T.top) - U, _ = t.scrollLeft + (C.left - T.left);
|
|
67
|
+
t.scrollTo({
|
|
68
|
+
top: Math.max(P, 0),
|
|
69
|
+
left: Math.max(_, 0),
|
|
70
|
+
behavior: (o == null ? void 0 : o.behavior) ?? E
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
[E]
|
|
74
|
+
);
|
|
75
|
+
return /* @__PURE__ */ y(
|
|
76
|
+
f.Provider,
|
|
77
|
+
{
|
|
78
|
+
value: {
|
|
79
|
+
updateElement: R,
|
|
80
|
+
clearElements: b,
|
|
81
|
+
removeElement: A,
|
|
82
|
+
elementList: a,
|
|
83
|
+
scrollToElement: S,
|
|
84
|
+
setThumbnailContainer: w
|
|
85
|
+
},
|
|
86
|
+
children: r
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
}, u = () => {
|
|
90
|
+
}, ut = () => {
|
|
91
|
+
const r = L(f);
|
|
92
|
+
return (r == null ? void 0 : r.setThumbnailContainer) ?? u;
|
|
93
|
+
}, at = () => {
|
|
94
|
+
const r = L(f), { type: a, validating: s } = G(), n = x(0), p = B(() => {
|
|
95
|
+
if (s !== !1)
|
|
96
|
+
return {
|
|
97
|
+
updateElement: u,
|
|
98
|
+
clearElements: u,
|
|
99
|
+
removeElement: u,
|
|
100
|
+
elementList: {},
|
|
101
|
+
scrollToElement: u
|
|
102
|
+
};
|
|
103
|
+
if (!(a !== D.Developer))
|
|
104
|
+
return {
|
|
105
|
+
updateElement: () => {
|
|
106
|
+
n.current === 0 && (console.error(h), n.current++);
|
|
107
|
+
},
|
|
108
|
+
clearElements: () => {
|
|
109
|
+
n.current === 0 && (console.error(h), n.current++);
|
|
110
|
+
},
|
|
111
|
+
removeElement: () => {
|
|
112
|
+
n.current === 0 && (console.error(h), n.current++);
|
|
113
|
+
},
|
|
114
|
+
elementList: {},
|
|
115
|
+
scrollToElement: () => {
|
|
116
|
+
n.current === 0 && (console.error(h), n.current++);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}, [a, s]);
|
|
120
|
+
if (!r)
|
|
121
|
+
throw new Error("useElementThumbnailContext must be used within a ElementThumbnailProvider");
|
|
122
|
+
return p || r;
|
|
123
|
+
};
|
|
124
|
+
export {
|
|
125
|
+
f as ElementThumbnailContext,
|
|
126
|
+
mt as ElementThumbnailProvider,
|
|
127
|
+
at as useElementThumbnailContext,
|
|
128
|
+
ut as useThumbnailContainerRegister
|
|
129
|
+
};
|