@pdf-viewer/react 1.9.2-rc.2 → 1.9.2-rc.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/{ToolbarLayout.module-95e678ab.js → ToolbarLayout.module-d8ed3e47.js} +3 -3
- package/dist/components/RPController.js +1 -1
- package/dist/components/RPPages.js +1 -1
- package/dist/components/layout/LayoutContainer.js +1 -1
- package/dist/components/layout/RPDefaultLayout.js +1 -1
- package/dist/components/layout/RPLayout.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/SearchResultNavigator.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/ThumbnailTool.js +1 -1
- package/dist/components/layout/toolbar/ToolbarCustom.js +5 -5
- package/dist/components/layout/toolbar/ToolbarDefault.js +34 -21
- package/dist/components/layout/toolbar/ViewModeTool.js +1 -1
- package/dist/components/layout/toolbar/ZoomTool.js +1 -1
- package/dist/components/layout/toolbar/tools/FileDownloadTool.js +1 -1
- package/dist/components/layout/toolbar/tools/InputPageTool.js +1 -1
- package/dist/components/layout/toolbar/tools/NextPageTool.js +1 -1
- package/dist/components/layout/toolbar/tools/PreviousPageTool.js +1 -1
- package/dist/components/layout/toolbar/tools/PrintTool.js +1 -1
- package/dist/components/layout/toolbar/tools/ThumbnailTool.js +1 -1
- package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +1 -1
- package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +1 -1
- 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 +1 -1
- package/dist/components/ui/DropDown.js +1 -1
- package/dist/components/ui/LoadingIndicator.js +1 -1
- package/dist/components/ui/RPTooltip.js +405 -192
- package/dist/contexts/PaginationContext.js +1 -1
- package/dist/contexts/PrintContext.js +1 -1
- package/dist/contexts/RenderQueueProvider.js +1 -1
- package/dist/contexts/SearchContext.js +1 -1
- package/dist/contexts/ThumbnailsContext.js +1 -1
- package/dist/contexts/ZoomContext.js +51 -48
- package/dist/floating-ui.react-dom-88a86594.js +1447 -0
- package/dist/{index-5908484b.js → index-48ca3f30.js} +2 -2
- package/dist/index-4ba3ab9a.js +1877 -0
- package/dist/main.js +1 -1
- package/dist/utils/hooks/useFileDownload.js +1 -1
- package/dist/utils/hooks/useLicense.js +1 -1
- 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/index-18b0454c.js +0 -1657
- package/dist/index-f4a9ae4d.js +0 -1664
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { r as p, P as e, u as P } from "../ToolbarLayout.module-
|
|
3
|
+
import { r as p, P as e, u as P } from "../ToolbarLayout.module-d8ed3e47.js";
|
|
4
4
|
import "./RPDocumentContext.js";
|
|
5
5
|
import "../utils/appConsole.js";
|
|
6
6
|
import "./GlobalCurrentPage.js";
|
|
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
|
|
|
2
2
|
import "react";
|
|
3
3
|
import "../utils/Queue.js";
|
|
4
4
|
import "../utils/renderPage.js";
|
|
5
|
-
import { z as m, f as p, A as d } from "../ToolbarLayout.module-
|
|
5
|
+
import { z as m, f as p, A as d } from "../ToolbarLayout.module-d8ed3e47.js";
|
|
6
6
|
export {
|
|
7
7
|
m as RenderQueueContext,
|
|
8
8
|
p as RenderQueueProvider,
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { ZoomLevel as
|
|
4
|
-
import { appConsole as
|
|
5
|
-
import { useInitialStateContext as
|
|
6
|
-
import { useDocumentContext as
|
|
7
|
-
import { PAGE_PADDING as
|
|
1
|
+
import { jsx as I } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as M, useContext as O, useState as u, useRef as R, useEffect as p, useCallback as Z, useMemo as x } from "react";
|
|
3
|
+
import { ZoomLevel as J } from "../utils/types.js";
|
|
4
|
+
import { appConsole as _ } from "../utils/appConsole.js";
|
|
5
|
+
import { useInitialStateContext as j } from "./InitialStateContext.js";
|
|
6
|
+
import { useDocumentContext as F } from "./RPDocumentContext.js";
|
|
7
|
+
import { PAGE_PADDING as T } from "../utils/constants.js";
|
|
8
8
|
import { getZoomLevel as C } from "../utils/getZoomLevel.js";
|
|
9
|
-
import { useLayoutContainer as
|
|
10
|
-
import { useViewModeContext as
|
|
11
|
-
import { useRotationContext as
|
|
12
|
-
import { useGlobalCurrentPage as
|
|
13
|
-
import { useDebounce as
|
|
14
|
-
const D =
|
|
9
|
+
import { useLayoutContainer as k } from "./LayoutContainerContext.js";
|
|
10
|
+
import { useViewModeContext as q } from "./ViewModeContext.js";
|
|
11
|
+
import { useRotationContext as B } from "./RotationContext.js";
|
|
12
|
+
import { useGlobalCurrentPage as K } from "./GlobalCurrentPage.js";
|
|
13
|
+
import { useDebounce as Q } from "../utils/hooks/useDebounce.js";
|
|
14
|
+
const D = M({
|
|
15
15
|
zoomLevel: 100,
|
|
16
16
|
currentZoom: 1,
|
|
17
17
|
setZoomLevel: () => {
|
|
18
18
|
}
|
|
19
|
-
}),
|
|
20
|
-
const c =
|
|
21
|
-
return typeof c.currentZoom != "number" &&
|
|
22
|
-
},
|
|
23
|
-
const { initialScale: W =
|
|
19
|
+
}), ue = () => {
|
|
20
|
+
const c = O(D);
|
|
21
|
+
return typeof c.currentZoom != "number" && _.warn("Please use this hooks inside children component of RPProvider"), c;
|
|
22
|
+
}, le = ({ children: c }) => {
|
|
23
|
+
const { initialScale: W = J.PAGE_FIT } = j(), [s, b] = u(W), { pages: l } = F(), { pagesRef: t } = k(), { viewMode: h } = q(), [H, V] = u({
|
|
24
24
|
width: (t == null ? void 0 : t.clientWidth) || 0,
|
|
25
25
|
height: (t == null ? void 0 : t.clientHeight) || 0
|
|
26
|
-
}), a =
|
|
26
|
+
}), a = Q(H, 100), { rotate: g } = B(), [n, z] = u(null), d = R(null), { currentPage: v } = K(), [w, y] = u(v);
|
|
27
27
|
p(() => {
|
|
28
28
|
let e = l.get(w);
|
|
29
29
|
e || (e = l.get(1));
|
|
@@ -34,25 +34,25 @@ const D = I({
|
|
|
34
34
|
o && JSON.stringify(o) !== JSON.stringify(d.current) && (d.current = o, z(o));
|
|
35
35
|
}, [l, g, w]);
|
|
36
36
|
const m = Z(() => {
|
|
37
|
-
if (!
|
|
37
|
+
if (!n)
|
|
38
38
|
return null;
|
|
39
|
-
const e = ((
|
|
40
|
-
return { pageWidth: e, pageHeight: o, clientWidth:
|
|
41
|
-
}, [
|
|
39
|
+
const e = ((n == null ? void 0 : n.width) || 0) + 2 * T, o = (n == null ? void 0 : n.height) || 0, i = (t == null ? void 0 : t.clientWidth) || 0, r = (t == null ? void 0 : t.clientHeight) || 0;
|
|
40
|
+
return { pageWidth: e, pageHeight: o, clientWidth: i, clientHeight: r };
|
|
41
|
+
}, [n, t]), L = x(() => {
|
|
42
42
|
const e = m();
|
|
43
43
|
if (!a.width || !a.height || !e)
|
|
44
44
|
return 0;
|
|
45
|
-
if (typeof
|
|
46
|
-
return
|
|
47
|
-
const { clientWidth: o, clientHeight:
|
|
48
|
-
return C(
|
|
49
|
-
}, [
|
|
45
|
+
if (typeof s == "number")
|
|
46
|
+
return s / 100;
|
|
47
|
+
const { clientWidth: o, clientHeight: i, pageWidth: r, pageHeight: f } = e;
|
|
48
|
+
return C(s, o, i, r, f, h) / 100;
|
|
49
|
+
}, [s, a, m, h]);
|
|
50
50
|
p(() => {
|
|
51
51
|
y(v);
|
|
52
|
-
}, [
|
|
53
|
-
const e = (
|
|
54
|
-
|
|
55
|
-
V({ width:
|
|
52
|
+
}, [s]), p(() => {
|
|
53
|
+
const e = (i) => {
|
|
54
|
+
i.forEach((r) => {
|
|
55
|
+
V({ width: r.contentRect.width, height: r.contentRect.height });
|
|
56
56
|
});
|
|
57
57
|
}, o = new ResizeObserver(e);
|
|
58
58
|
return t && o.observe(t), () => {
|
|
@@ -63,32 +63,35 @@ const D = I({
|
|
|
63
63
|
(e) => {
|
|
64
64
|
let o = 0;
|
|
65
65
|
if (typeof e == "function") {
|
|
66
|
-
const
|
|
67
|
-
if (!
|
|
66
|
+
const i = m();
|
|
67
|
+
if (!i)
|
|
68
68
|
return;
|
|
69
|
-
const { clientWidth:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
69
|
+
const { clientWidth: r, clientHeight: f, pageWidth: P, pageHeight: E } = i;
|
|
70
|
+
o = (G) => {
|
|
71
|
+
const A = C(
|
|
72
|
+
G,
|
|
73
|
+
r,
|
|
74
|
+
f,
|
|
75
|
+
P,
|
|
76
|
+
E,
|
|
77
|
+
h
|
|
78
|
+
);
|
|
79
|
+
return e(A);
|
|
80
|
+
};
|
|
78
81
|
} else
|
|
79
82
|
o = e;
|
|
80
83
|
o && b(o);
|
|
81
84
|
},
|
|
82
85
|
[m]
|
|
83
86
|
), S = x(() => ({
|
|
84
|
-
zoomLevel:
|
|
87
|
+
zoomLevel: s,
|
|
85
88
|
currentZoom: L,
|
|
86
89
|
setZoomLevel: N
|
|
87
|
-
}), [L,
|
|
88
|
-
return /* @__PURE__ */
|
|
90
|
+
}), [L, s]);
|
|
91
|
+
return /* @__PURE__ */ I(D.Provider, { value: S, children: c });
|
|
89
92
|
};
|
|
90
93
|
export {
|
|
91
94
|
D as ZoomContext,
|
|
92
|
-
|
|
93
|
-
|
|
95
|
+
le as ZoomProvider,
|
|
96
|
+
ue as useZoomContext
|
|
94
97
|
};
|