@pdf-viewer/react 1.9.0-beta.1 → 1.9.0-beta.3
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/{Popover-48c8394c.js → Popover-1faa77f6.js} +2 -2
- package/dist/RPLayout-897cb09d.js +3393 -0
- package/dist/assets/RPLayout.css +1 -1
- package/dist/{component-2aa6e53b.js → component-1da194e8.js} +1 -1
- package/dist/components/RPConfig.js +673 -691
- package/dist/components/RPController.js +1 -1
- package/dist/components/RPDropFileZone.js +27 -26
- package/dist/components/RPPages.js +9 -3
- package/dist/components/layout/LayoutContainer.js +9 -3
- package/dist/components/layout/RPDefaultLayout.js +1 -1
- package/dist/components/layout/RPLayout.js +9 -4
- package/dist/components/layout/WrapperLayout.js +8 -7
- package/dist/components/layout/sidebar/RPSidebar.js +3 -2
- 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 +20 -18
- package/dist/components/layout/toolbar/DocumentDialog.js +7 -4
- package/dist/components/layout/toolbar/DocumentProperties.js +19 -17
- package/dist/components/layout/toolbar/FileDownloadTool.js +4 -2
- package/dist/components/layout/toolbar/FileUploadTool.js +21 -19
- package/dist/components/layout/toolbar/FullScreenTool.js +45 -36
- 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 -4
- package/dist/components/layout/toolbar/OtherTool.js +4 -3
- package/dist/components/layout/toolbar/Paginate.js +4 -2
- package/dist/components/layout/toolbar/PrintTool.js +4 -2
- package/dist/components/layout/toolbar/RPToolbar.js +3 -2
- package/dist/components/layout/toolbar/RPToolbarEnd.js +1 -1
- package/dist/components/layout/toolbar/RotateTool.js +27 -25
- package/dist/components/layout/toolbar/ScrollModeTool.js +43 -41
- package/dist/components/layout/toolbar/SearchResultNavigator.js +1 -1
- package/dist/components/layout/toolbar/SearchTool.js +10 -4
- package/dist/components/layout/toolbar/SelectionModeTool.js +32 -30
- package/dist/components/layout/toolbar/ThumbnailTool.js +17 -0
- package/dist/components/layout/toolbar/ToolbarCustom.js +9 -3
- package/dist/components/layout/toolbar/ViewModeTool.js +33 -24
- package/dist/components/layout/toolbar/ZoomTool.js +5 -3
- package/dist/components/layout/toolbar/tools/FileDownloadTool.js +9 -13
- package/dist/components/layout/toolbar/tools/FileUploadTool.js +10 -14
- package/dist/components/layout/toolbar/tools/FullScreenTool.js +13 -17
- package/dist/components/layout/toolbar/tools/InputPageTool.js +1 -1
- package/dist/components/layout/toolbar/tools/NextPageTool.js +10 -4
- package/dist/components/layout/toolbar/tools/PreviousPageTool.js +1 -1
- package/dist/components/layout/toolbar/tools/PrintTool.js +8 -12
- package/dist/components/layout/toolbar/tools/ThumbnailTool.js +1 -1
- package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +55 -56
- package/dist/components/layout/toolbar/tools/defaults/LeftSidebarDefaultTools.js +16 -0
- package/dist/components/layout/toolbar/tools/defaults/TopbarDefaultTools.js +59 -0
- package/dist/components/page/AnnotationLayer.js +9 -3
- package/dist/components/page/CanvasLayer.js +9 -3
- package/dist/components/page/DualPage.js +1 -1
- package/dist/components/page/RPPage.js +9 -3
- package/dist/components/page/SinglePage.js +1 -1
- package/dist/components/page/TextHighlightLayer.js +9 -3
- package/dist/components/page/TextLayer.js +9 -3
- package/dist/components/ui/Checkbox.js +116 -228
- package/dist/components/ui/DropDown.js +1 -1
- package/dist/components/ui/LoadingIndicator.js +1 -1
- package/dist/components/ui/Popover.js +1 -1
- package/dist/components/ui/RPTooltip.js +207 -207
- package/dist/contexts/DropFileZoneContext.js +28 -29
- package/dist/contexts/ElementPageContext.js +54 -43
- package/dist/contexts/IconToolContext.js +13 -0
- package/dist/contexts/PaginationContext.js +3 -3
- package/dist/contexts/PrintContext.js +1 -1
- package/dist/contexts/SearchContext.js +1 -1
- package/dist/contexts/ThumbnailsContext.js +1 -1
- package/dist/contexts/ToolComponentContext.js +52 -0
- package/dist/contexts/ToolbarComponentContext.js +6 -3
- package/dist/{floating-ui.react-dom-4b1e2e46.js → floating-ui.react-dom-15b9b819.js} +380 -394
- package/dist/index-1cb41342.js +307 -0
- package/dist/{index-951f0f1f.js → index-7279fb4e.js} +456 -464
- package/dist/index-aa2d3884.js +140 -0
- package/dist/main.js +23 -19
- package/dist/types/components/layout/toolbar/ThumbnailTool.d.ts +2 -0
- package/dist/types/components/layout/toolbar/tools/defaults/LeftSidebarDefaultTools.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/defaults/TopbarDefaultTools.d.ts +3 -0
- package/dist/types/contexts/IconToolContext.d.ts +9 -0
- package/dist/types/contexts/ToolComponentContext.d.ts +12 -0
- package/dist/types/main.d.ts +3 -1
- package/dist/types/utils/types.d.ts +63 -43
- package/dist/utils/hooks/useFileDownload.js +9 -3
- package/dist/utils/hooks/useLicense.js +26 -24
- package/dist/utils/hooks/usePageRotateContext.js +19 -20
- package/dist/utils/hooks/usePaginate.js +9 -3
- package/dist/utils/hooks/usePresentPage.js +9 -3
- package/dist/utils/hooks/usePrint.js +9 -3
- package/dist/utils/hooks/useScrollToPage.js +9 -3
- package/dist/utils/hooks/useSearch.js +9 -3
- package/dist/utils/hooks/useThumbnail.js +9 -3
- package/dist/utils/hooks/useVirtualReactWindow.js +9 -3
- package/dist/utils/types.js +6 -6
- package/package.json +1 -1
- package/dist/RPLayout-3042ec91.js +0 -3349
- package/dist/index-6e0e48fa.js +0 -332
- package/dist/index-e3a67935.js +0 -150
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import * as i from "react";
|
|
2
|
+
import { u as p, a as R, P as w, c as h, d as _, b as U } from "./index-1cb41342.js";
|
|
3
|
+
import { jsx as T } from "react/jsx-runtime";
|
|
4
|
+
function z(t, e = globalThis == null ? void 0 : globalThis.document) {
|
|
5
|
+
const s = p(t);
|
|
6
|
+
i.useEffect(() => {
|
|
7
|
+
const n = (r) => {
|
|
8
|
+
r.key === "Escape" && s(r);
|
|
9
|
+
};
|
|
10
|
+
return e.addEventListener("keydown", n, { capture: !0 }), () => e.removeEventListener("keydown", n, { capture: !0 });
|
|
11
|
+
}, [s, e]);
|
|
12
|
+
}
|
|
13
|
+
var H = "DismissableLayer", b = "dismissableLayer.update", M = "dismissableLayer.pointerDownOutside", K = "dismissableLayer.focusOutside", O, S = i.createContext({
|
|
14
|
+
layers: /* @__PURE__ */ new Set(),
|
|
15
|
+
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
16
|
+
branches: /* @__PURE__ */ new Set()
|
|
17
|
+
}), j = i.forwardRef(
|
|
18
|
+
(t, e) => {
|
|
19
|
+
const {
|
|
20
|
+
disableOutsidePointerEvents: s = !1,
|
|
21
|
+
onEscapeKeyDown: n,
|
|
22
|
+
onPointerDownOutside: r,
|
|
23
|
+
onFocusOutside: o,
|
|
24
|
+
onInteractOutside: l,
|
|
25
|
+
onDismiss: d,
|
|
26
|
+
...v
|
|
27
|
+
} = t, u = i.useContext(S), [c, B] = i.useState(null), f = (c == null ? void 0 : c.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, F] = i.useState({}), I = R(e, (a) => B(a)), m = Array.from(u.layers), [W] = [...u.layersWithOutsidePointerEventsDisabled].slice(-1), k = m.indexOf(W), P = c ? m.indexOf(c) : -1, A = u.layersWithOutsidePointerEventsDisabled.size > 0, D = P >= k, N = $((a) => {
|
|
28
|
+
const E = a.target, C = [...u.branches].some((y) => y.contains(E));
|
|
29
|
+
!D || C || (r == null || r(a), l == null || l(a), a.defaultPrevented || d == null || d());
|
|
30
|
+
}, f), L = q((a) => {
|
|
31
|
+
const E = a.target;
|
|
32
|
+
[...u.branches].some((y) => y.contains(E)) || (o == null || o(a), l == null || l(a), a.defaultPrevented || d == null || d());
|
|
33
|
+
}, f);
|
|
34
|
+
return z((a) => {
|
|
35
|
+
P === u.layers.size - 1 && (n == null || n(a), !a.defaultPrevented && d && (a.preventDefault(), d()));
|
|
36
|
+
}, f), i.useEffect(() => {
|
|
37
|
+
if (c)
|
|
38
|
+
return s && (u.layersWithOutsidePointerEventsDisabled.size === 0 && (O = f.body.style.pointerEvents, f.body.style.pointerEvents = "none"), u.layersWithOutsidePointerEventsDisabled.add(c)), u.layers.add(c), g(), () => {
|
|
39
|
+
s && u.layersWithOutsidePointerEventsDisabled.size === 1 && (f.body.style.pointerEvents = O);
|
|
40
|
+
};
|
|
41
|
+
}, [c, f, s, u]), i.useEffect(() => () => {
|
|
42
|
+
c && (u.layers.delete(c), u.layersWithOutsidePointerEventsDisabled.delete(c), g());
|
|
43
|
+
}, [c, u]), i.useEffect(() => {
|
|
44
|
+
const a = () => F({});
|
|
45
|
+
return document.addEventListener(b, a), () => document.removeEventListener(b, a);
|
|
46
|
+
}, []), /* @__PURE__ */ T(
|
|
47
|
+
w.div,
|
|
48
|
+
{
|
|
49
|
+
...v,
|
|
50
|
+
ref: I,
|
|
51
|
+
style: {
|
|
52
|
+
pointerEvents: A ? D ? "auto" : "none" : void 0,
|
|
53
|
+
...t.style
|
|
54
|
+
},
|
|
55
|
+
onFocusCapture: h(t.onFocusCapture, L.onFocusCapture),
|
|
56
|
+
onBlurCapture: h(t.onBlurCapture, L.onBlurCapture),
|
|
57
|
+
onPointerDownCapture: h(
|
|
58
|
+
t.onPointerDownCapture,
|
|
59
|
+
N.onPointerDownCapture
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
j.displayName = H;
|
|
66
|
+
var X = "DismissableLayerBranch", Y = i.forwardRef((t, e) => {
|
|
67
|
+
const s = i.useContext(S), n = i.useRef(null), r = R(e, n);
|
|
68
|
+
return i.useEffect(() => {
|
|
69
|
+
const o = n.current;
|
|
70
|
+
if (o)
|
|
71
|
+
return s.branches.add(o), () => {
|
|
72
|
+
s.branches.delete(o);
|
|
73
|
+
};
|
|
74
|
+
}, [s.branches]), /* @__PURE__ */ T(w.div, { ...t, ref: r });
|
|
75
|
+
});
|
|
76
|
+
Y.displayName = X;
|
|
77
|
+
function $(t, e = globalThis == null ? void 0 : globalThis.document) {
|
|
78
|
+
const s = p(t), n = i.useRef(!1), r = i.useRef(() => {
|
|
79
|
+
});
|
|
80
|
+
return i.useEffect(() => {
|
|
81
|
+
const o = (d) => {
|
|
82
|
+
if (d.target && !n.current) {
|
|
83
|
+
let v = function() {
|
|
84
|
+
x(
|
|
85
|
+
M,
|
|
86
|
+
s,
|
|
87
|
+
u,
|
|
88
|
+
{ discrete: !0 }
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
const u = { originalEvent: d };
|
|
92
|
+
d.pointerType === "touch" ? (e.removeEventListener("click", r.current), r.current = v, e.addEventListener("click", r.current, { once: !0 })) : v();
|
|
93
|
+
} else
|
|
94
|
+
e.removeEventListener("click", r.current);
|
|
95
|
+
n.current = !1;
|
|
96
|
+
}, l = window.setTimeout(() => {
|
|
97
|
+
e.addEventListener("pointerdown", o);
|
|
98
|
+
}, 0);
|
|
99
|
+
return () => {
|
|
100
|
+
window.clearTimeout(l), e.removeEventListener("pointerdown", o), e.removeEventListener("click", r.current);
|
|
101
|
+
};
|
|
102
|
+
}, [e, s]), {
|
|
103
|
+
// ensures we check React component tree (not just DOM tree)
|
|
104
|
+
onPointerDownCapture: () => n.current = !0
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function q(t, e = globalThis == null ? void 0 : globalThis.document) {
|
|
108
|
+
const s = p(t), n = i.useRef(!1);
|
|
109
|
+
return i.useEffect(() => {
|
|
110
|
+
const r = (o) => {
|
|
111
|
+
o.target && !n.current && x(K, s, { originalEvent: o }, {
|
|
112
|
+
discrete: !1
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
return e.addEventListener("focusin", r), () => e.removeEventListener("focusin", r);
|
|
116
|
+
}, [e, s]), {
|
|
117
|
+
onFocusCapture: () => n.current = !0,
|
|
118
|
+
onBlurCapture: () => n.current = !1
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function g() {
|
|
122
|
+
const t = new CustomEvent(b);
|
|
123
|
+
document.dispatchEvent(t);
|
|
124
|
+
}
|
|
125
|
+
function x(t, e, s, { discrete: n }) {
|
|
126
|
+
const r = s.originalEvent.target, o = new CustomEvent(t, { bubbles: !1, cancelable: !0, detail: s });
|
|
127
|
+
e && r.addEventListener(t, e, { once: !0 }), n ? _(r, o) : r.dispatchEvent(o);
|
|
128
|
+
}
|
|
129
|
+
var G = i["useId".toString()] || (() => {
|
|
130
|
+
}), J = 0;
|
|
131
|
+
function Z(t) {
|
|
132
|
+
const [e, s] = i.useState(G());
|
|
133
|
+
return U(() => {
|
|
134
|
+
t || s((n) => n ?? String(J++));
|
|
135
|
+
}, [t]), t || (e ? `radix-${e}` : "");
|
|
136
|
+
}
|
|
137
|
+
export {
|
|
138
|
+
j as D,
|
|
139
|
+
Z as u
|
|
140
|
+
};
|
package/dist/main.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { RPProvider as r } from "./components/RPProvider.js";
|
|
2
|
-
import { a as x, b as m, R as l, S as p, c as f, u as
|
|
2
|
+
import { a as x, b as m, R as l, S as p, c as f, u as a, d as n, e as s } from "./RPLayout-897cb09d.js";
|
|
3
3
|
import { RPConfig as i } from "./components/RPConfig.js";
|
|
4
4
|
import { RPController as T } from "./components/RPController.js";
|
|
5
|
-
import { RPTheme as
|
|
5
|
+
import { RPTheme as d } from "./components/RPTheme.js";
|
|
6
6
|
import { RPDropFileZone as g } from "./components/RPDropFileZone.js";
|
|
7
7
|
import { useDarkModeContext as h } from "./contexts/DarkModeContext.js";
|
|
8
|
-
import { useDocumentContext as
|
|
8
|
+
import { useDocumentContext as F } from "./contexts/RPDocumentContext.js";
|
|
9
9
|
import { useRotationContext as Z } from "./contexts/RotationContext.js";
|
|
10
|
-
import { useViewModeContext as
|
|
11
|
-
import { useDropFileZoneContext as
|
|
10
|
+
import { useViewModeContext as b } from "./contexts/ViewModeContext.js";
|
|
11
|
+
import { useDropFileZoneContext as v } from "./contexts/DropFileZoneContext.js";
|
|
12
12
|
import { useOpenFileContext as V } from "./contexts/FileInputContext.js";
|
|
13
13
|
import { useZoomContext as I } from "./contexts/ZoomContext.js";
|
|
14
14
|
import { useHighlightContext as k } from "./contexts/HighlightContext.js";
|
|
@@ -25,16 +25,19 @@ import { FullScreenTool as eo } from "./components/layout/toolbar/tools/FullScre
|
|
|
25
25
|
import { PreviousPageTool as to } from "./components/layout/toolbar/tools/PreviousPageTool.js";
|
|
26
26
|
import { NextPageTool as mo } from "./components/layout/toolbar/tools/NextPageTool.js";
|
|
27
27
|
import { InputPageTool as po } from "./components/layout/toolbar/tools/InputPageTool.js";
|
|
28
|
-
import { ZoomInTool as
|
|
28
|
+
import { ZoomInTool as ao } from "./components/layout/toolbar/tools/ZoomInTool.js";
|
|
29
29
|
import { ZoomOutTool as so } from "./components/layout/toolbar/tools/ZoomOutTool.js";
|
|
30
30
|
import { ZoomLevelTool as io } from "./components/layout/toolbar/tools/ZoomLevelTool.js";
|
|
31
|
-
import {
|
|
31
|
+
import { TopbarDefaultTools as To } from "./components/layout/toolbar/tools/defaults/TopbarDefaultTools.js";
|
|
32
|
+
import { LeftSidebarDefaultTools as Ro } from "./components/layout/toolbar/tools/defaults/LeftSidebarDefaultTools.js";
|
|
33
|
+
import { Locales as co, ScrollMode as ho, ThemeVariables as Do, ViewMode as Fo, ZoomLevel as So } from "./utils/types.js";
|
|
32
34
|
export {
|
|
33
35
|
Y as FileDownloadTool,
|
|
34
36
|
W as FileUploadTool,
|
|
35
37
|
eo as FullScreenTool,
|
|
36
38
|
po as InputPageTool,
|
|
37
|
-
|
|
39
|
+
Ro as LeftSidebarDefaultTools,
|
|
40
|
+
co as Locales,
|
|
38
41
|
mo as NextPageTool,
|
|
39
42
|
to as PreviousPageTool,
|
|
40
43
|
$ as PrintTool,
|
|
@@ -45,31 +48,32 @@ export {
|
|
|
45
48
|
m as RPLayout,
|
|
46
49
|
l as RPPages,
|
|
47
50
|
r as RPProvider,
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
d as RPTheme,
|
|
52
|
+
ho as ScrollMode,
|
|
50
53
|
p as SearchTool,
|
|
51
54
|
G as ThemeSwitcherTool,
|
|
52
|
-
|
|
55
|
+
Do as ThemeVariables,
|
|
53
56
|
K as ThumbnailTool,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
To as TopbarDefaultTools,
|
|
58
|
+
Fo as ViewMode,
|
|
59
|
+
ao as ZoomInTool,
|
|
60
|
+
So as ZoomLevel,
|
|
57
61
|
io as ZoomLevelTool,
|
|
58
62
|
so as ZoomOutTool,
|
|
59
63
|
h as useDarkModeContext,
|
|
60
|
-
|
|
61
|
-
|
|
64
|
+
F as useDocumentContext,
|
|
65
|
+
v as useDropFileZoneContext,
|
|
62
66
|
A as useElementPageContext,
|
|
63
67
|
f as useFileDownload,
|
|
64
68
|
U as useFullScreenContext,
|
|
65
69
|
k as useHighlightContext,
|
|
66
70
|
V as useOpenFileContext,
|
|
67
71
|
q as usePageRotateContext,
|
|
68
|
-
|
|
72
|
+
a as usePaginationContext,
|
|
69
73
|
H as usePdfProperties,
|
|
70
|
-
|
|
74
|
+
n as usePrintContext,
|
|
71
75
|
Z as useRotationContext,
|
|
72
76
|
s as useSearchContext,
|
|
73
|
-
|
|
77
|
+
b as useViewModeContext,
|
|
74
78
|
I as useZoomContext
|
|
75
79
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC, PropsWithChildren } from 'react';
|
|
2
|
+
import { RPIcons } from '../utils/types';
|
|
3
|
+
type IconToolContext = RPIcons & {
|
|
4
|
+
setIcons: React.Dispatch<React.SetStateAction<RPIcons>>;
|
|
5
|
+
};
|
|
6
|
+
export declare const IconToolContext: import('react').Context<IconToolContext>;
|
|
7
|
+
export declare const useIconToolContext: () => IconToolContext;
|
|
8
|
+
export declare const IconToolProvider: FC<PropsWithChildren>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC, PropsWithChildren } from 'react';
|
|
2
|
+
import { RPSlots } from '../utils/types';
|
|
3
|
+
type ToolContext = RPSlots & {
|
|
4
|
+
setSlots: React.Dispatch<React.SetStateAction<RPSlots>>;
|
|
5
|
+
};
|
|
6
|
+
export declare const ToolComponentContext: import('react').Context<ToolContext>;
|
|
7
|
+
export declare const useToolComponentContext: () => ToolContext;
|
|
8
|
+
interface Props extends PropsWithChildren {
|
|
9
|
+
slots?: RPSlots;
|
|
10
|
+
}
|
|
11
|
+
export declare const ToolComponentProvider: FC<Props>;
|
|
12
|
+
export {};
|
package/dist/types/main.d.ts
CHANGED
|
@@ -36,5 +36,7 @@ export { InputPageTool } from './components/layout/toolbar/tools/InputPageTool';
|
|
|
36
36
|
export { ZoomInTool } from './components/layout/toolbar/tools/ZoomInTool';
|
|
37
37
|
export { ZoomOutTool } from './components/layout/toolbar/tools/ZoomOutTool';
|
|
38
38
|
export { ZoomLevelTool } from './components/layout/toolbar/tools/ZoomLevelTool';
|
|
39
|
-
export
|
|
39
|
+
export { TopbarDefaultTools } from './components/layout/toolbar/tools/defaults/TopbarDefaultTools';
|
|
40
|
+
export { LeftSidebarDefaultTools } from './components/layout/toolbar/tools/defaults/LeftSidebarDefaultTools';
|
|
41
|
+
export type { CharacterMap, DarkModeProps, DownloadToolProps, FullScreenToolProps, Localization, MatchValue, OpenFileToolProps, PageNavigationToolProps, PdfPage, PdfProperties, PreparePrintProgress, PrintToolProps, RPConfigProps, RPThemeProps, RPProviderProps, RPDefaultLayoutProps, RPLayoutProps, RPIcons, RPSlots, SearchOptions, SetPageResult, ScrollModeProps, ThumbnailToolProps, ViewModeProps, ZoomProps, TopbarDefaultToolProps, TopbarDefaultToolSlots, TopbarDefaultToolIcons, LeftSidebarDefaultToolProps, LeftSidebarDefaultToolSlots, LeftSidebarDefaultToolIcons } from './utils/types';
|
|
40
42
|
export { ViewMode, ScrollMode, ZoomLevel, Locales, ThemeVariables } from './utils/types';
|
|
@@ -221,13 +221,15 @@ export interface DarkMode extends DarkModeProps {
|
|
|
221
221
|
onDarkModeChange: (value: boolean) => void;
|
|
222
222
|
}
|
|
223
223
|
export interface License {
|
|
224
|
+
validating?: boolean;
|
|
224
225
|
isValid: boolean;
|
|
225
226
|
invalidatedMessage?: string;
|
|
226
227
|
type?: LicenseType;
|
|
227
228
|
}
|
|
228
229
|
export declare enum LicenseType {
|
|
229
230
|
Organization = "organization",
|
|
230
|
-
Developer = "developer"
|
|
231
|
+
Developer = "developer",
|
|
232
|
+
FreeTrial = "free-trial"
|
|
231
233
|
}
|
|
232
234
|
export type DecryptedLicense = {
|
|
233
235
|
exp: number;
|
|
@@ -322,50 +324,10 @@ export interface ThumbnailToolProps {
|
|
|
322
324
|
onClick: () => void;
|
|
323
325
|
active: boolean;
|
|
324
326
|
}
|
|
325
|
-
export interface RPSlots {
|
|
326
|
-
themeSwitcher?: boolean | FC<Omit<DarkModeProps, 'onDarkModeChange'>>;
|
|
327
|
-
documentProperties?: boolean;
|
|
328
|
-
rotateTool?: boolean;
|
|
329
|
-
fullscreenTool?: boolean | FC<FullScreenToolProps>;
|
|
330
|
-
openFileTool?: boolean | FC<OpenFileToolProps>;
|
|
331
|
-
dropFileZone?: boolean | React.ReactNode | React.ComponentType;
|
|
332
|
-
downloadTool?: boolean | FC<DownloadToolProps>;
|
|
333
|
-
zoomTool?: boolean | FC<ZoomProps>;
|
|
334
|
-
viewModeTool?: boolean;
|
|
335
|
-
scrollModeTool?: boolean;
|
|
336
|
-
thumbnailTool?: boolean | FC<ThumbnailToolProps>;
|
|
337
|
-
pageNavigationTool?: boolean | FC<PageNavigationToolProps>;
|
|
338
|
-
printTool?: boolean | FC<PrintToolProps>;
|
|
339
|
-
containerWidthSm?: number;
|
|
340
|
-
showPrintProgress?: boolean;
|
|
341
|
-
selectionModeTool?: boolean;
|
|
342
|
-
searchTool?: boolean;
|
|
343
|
-
jumpNavigationTool?: boolean;
|
|
327
|
+
export interface RPSlots extends TopbarDefaultToolSlots, LeftSidebarDefaultToolSlots {
|
|
344
328
|
sidebarEnable?: boolean;
|
|
345
329
|
}
|
|
346
|
-
export interface RPIcons {
|
|
347
|
-
goToFirstPageIcon?: React.ReactNode;
|
|
348
|
-
goToLastPageIcon?: React.ReactNode;
|
|
349
|
-
lightModeIcon?: React.ReactNode;
|
|
350
|
-
darkModeIcon?: React.ReactNode;
|
|
351
|
-
nextIcon?: React.ReactNode;
|
|
352
|
-
prevIcon?: React.ReactNode;
|
|
353
|
-
fullScreenIcon?: React.ReactNode;
|
|
354
|
-
downloadIcon?: React.ReactNode;
|
|
355
|
-
zoomInIcon?: React.ReactNode;
|
|
356
|
-
zoomOutIcon?: React.ReactNode;
|
|
357
|
-
openFileIcon?: React.ReactNode;
|
|
358
|
-
rotateClockwiseIcon?: React.ReactNode;
|
|
359
|
-
rotateCounterClockwiseIcon?: React.ReactNode;
|
|
360
|
-
pageScrollIcon?: React.ReactNode;
|
|
361
|
-
verticalScrollIcon?: React.ReactNode;
|
|
362
|
-
horizontalScrollIcon?: React.ReactNode;
|
|
363
|
-
documentPropertiesIcon?: React.ReactNode;
|
|
364
|
-
printIcon?: React.ReactNode;
|
|
365
|
-
thumbnailIcon?: React.ReactNode;
|
|
366
|
-
searchIcon?: React.ReactNode;
|
|
367
|
-
textSelectionIcon?: React.ReactNode;
|
|
368
|
-
handModeIcon?: React.ReactNode;
|
|
330
|
+
export interface RPIcons extends TopbarDefaultToolIcons, LeftSidebarDefaultToolIcons {
|
|
369
331
|
}
|
|
370
332
|
export interface PdfProperties {
|
|
371
333
|
filename: string;
|
|
@@ -745,4 +707,62 @@ export interface ToolbarProps {
|
|
|
745
707
|
topbar: Partial<ToolbarSection>;
|
|
746
708
|
leftSidebar: Partial<ToolbarSection>;
|
|
747
709
|
}
|
|
710
|
+
export interface TopbarDefaultToolSlots {
|
|
711
|
+
themeSwitcher?: boolean | FC<Omit<DarkModeProps, 'onDarkModeChange'>>;
|
|
712
|
+
documentProperties?: boolean;
|
|
713
|
+
rotateTool?: boolean;
|
|
714
|
+
fullscreenTool?: boolean | FC<FullScreenToolProps>;
|
|
715
|
+
openFileTool?: boolean | FC<OpenFileToolProps>;
|
|
716
|
+
dropFileZone?: boolean | React.ReactNode | React.ComponentType;
|
|
717
|
+
downloadTool?: boolean | FC<DownloadToolProps>;
|
|
718
|
+
zoomTool?: boolean | FC<ZoomProps>;
|
|
719
|
+
viewModeTool?: boolean;
|
|
720
|
+
scrollModeTool?: boolean;
|
|
721
|
+
pageNavigationTool?: boolean | FC<PageNavigationToolProps>;
|
|
722
|
+
printTool?: boolean | FC<PrintToolProps>;
|
|
723
|
+
containerWidthSm?: number;
|
|
724
|
+
showPrintProgress?: boolean;
|
|
725
|
+
selectionModeTool?: boolean;
|
|
726
|
+
searchTool?: boolean;
|
|
727
|
+
jumpNavigationTool?: boolean;
|
|
728
|
+
}
|
|
729
|
+
export interface TopbarDefaultToolIcons {
|
|
730
|
+
goToFirstPageIcon?: React.ReactNode;
|
|
731
|
+
goToLastPageIcon?: React.ReactNode;
|
|
732
|
+
lightModeIcon?: React.ReactNode;
|
|
733
|
+
darkModeIcon?: React.ReactNode;
|
|
734
|
+
nextIcon?: React.ReactNode;
|
|
735
|
+
prevIcon?: React.ReactNode;
|
|
736
|
+
fullScreenIcon?: React.ReactNode;
|
|
737
|
+
downloadIcon?: React.ReactNode;
|
|
738
|
+
zoomInIcon?: React.ReactNode;
|
|
739
|
+
zoomOutIcon?: React.ReactNode;
|
|
740
|
+
openFileIcon?: React.ReactNode;
|
|
741
|
+
rotateClockwiseIcon?: React.ReactNode;
|
|
742
|
+
rotateCounterClockwiseIcon?: React.ReactNode;
|
|
743
|
+
singlePageIcon?: React.ReactNode;
|
|
744
|
+
dualPageIcon?: React.ReactNode;
|
|
745
|
+
pageScrollIcon?: React.ReactNode;
|
|
746
|
+
verticalScrollIcon?: React.ReactNode;
|
|
747
|
+
horizontalScrollIcon?: React.ReactNode;
|
|
748
|
+
documentPropertiesIcon?: React.ReactNode;
|
|
749
|
+
printIcon?: React.ReactNode;
|
|
750
|
+
searchIcon?: React.ReactNode;
|
|
751
|
+
textSelectionIcon?: React.ReactNode;
|
|
752
|
+
handModeIcon?: React.ReactNode;
|
|
753
|
+
}
|
|
754
|
+
export interface TopbarDefaultToolProps {
|
|
755
|
+
slots?: TopbarDefaultToolSlots;
|
|
756
|
+
icons?: TopbarDefaultToolIcons;
|
|
757
|
+
}
|
|
758
|
+
export interface LeftSidebarDefaultToolSlots {
|
|
759
|
+
thumbnailTool?: boolean | FC<ThumbnailToolProps>;
|
|
760
|
+
}
|
|
761
|
+
export interface LeftSidebarDefaultToolIcons {
|
|
762
|
+
thumbnailIcon?: React.ReactNode;
|
|
763
|
+
}
|
|
764
|
+
export interface LeftSidebarDefaultToolProps {
|
|
765
|
+
slots?: LeftSidebarDefaultToolSlots;
|
|
766
|
+
icons?: LeftSidebarDefaultToolIcons;
|
|
767
|
+
}
|
|
748
768
|
export {};
|
|
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
|
|
|
2
2
|
import "react";
|
|
3
3
|
import "../../contexts/RPDocumentContext.js";
|
|
4
4
|
import "../../contexts/DocumentPasswordContext.js";
|
|
5
|
-
import { c as
|
|
5
|
+
import { c as Z } from "../../RPLayout-897cb09d.js";
|
|
6
6
|
import "../../contexts/DarkModeContext.js";
|
|
7
7
|
import "../../contexts/RotationContext.js";
|
|
8
8
|
import "../../contexts/LayerContext.js";
|
|
@@ -30,6 +30,7 @@ import "../../components/RPConfig.js";
|
|
|
30
30
|
import "../../contexts/ThemeContext.js";
|
|
31
31
|
import "../../components/RPDropFileZone.js";
|
|
32
32
|
import "../../contexts/ToolbarComponentContext.js";
|
|
33
|
+
import "../../contexts/ToolComponentContext.js";
|
|
33
34
|
import "../../components/ui/Button.js";
|
|
34
35
|
import "../../SearchCloseButton-ddb9877e.js";
|
|
35
36
|
import "../../components/ui/Input.js";
|
|
@@ -37,11 +38,16 @@ import "../../components/ui/Checkbox.js";
|
|
|
37
38
|
import "../../components/icons/LoaderIcon.js";
|
|
38
39
|
import "../../contexts/IconContext.js";
|
|
39
40
|
import "../../components/ui/RPTooltip.js";
|
|
40
|
-
import "../../Popover-
|
|
41
|
+
import "../../Popover-1faa77f6.js";
|
|
41
42
|
import "../../contexts/ViewportContext.js";
|
|
43
|
+
import "../../contexts/IconToolContext.js";
|
|
42
44
|
import "../../components/ui/DropDown.js";
|
|
43
45
|
import "../../components/layout/toolbar/MenuItem.js";
|
|
44
46
|
import "../../components/layout/toolbar/MenuSeparator.js";
|
|
47
|
+
import "../dateFormatter.js";
|
|
48
|
+
import "../../components/layout/toolbar/PropertyItem.js";
|
|
49
|
+
import "../../contexts/OtherToolContext.js";
|
|
50
|
+
import "../../components/layout/toolbar/RotateTool.js";
|
|
45
51
|
export {
|
|
46
|
-
|
|
52
|
+
Z as useFileDownload
|
|
47
53
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { appConsole as
|
|
3
|
-
const b = /* @__PURE__ */ new Date("2025-
|
|
4
|
-
invalidLicense: `You are currently using without a valid license. ${
|
|
5
|
-
mismatchedDomain: `Your license key is not valid for the current domain / IP. ${
|
|
6
|
-
expired: `Your license key has expired. ${
|
|
1
|
+
import { useState as E, useCallback as h, useEffect as A } from "react";
|
|
2
|
+
import { appConsole as l } from "../appConsole.js";
|
|
3
|
+
const b = /* @__PURE__ */ new Date("2025-08-06T04:39:21.945Z"), d = "Please visit https://www.react-pdf.dev/manage-license/ to generate a new license key.", s = {
|
|
4
|
+
invalidLicense: `You are currently using without a valid license. ${d}`,
|
|
5
|
+
mismatchedDomain: `Your license key is not valid for the current domain / IP. ${d}`,
|
|
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
|
};
|
|
@@ -50,41 +50,41 @@ kwIDAQAB
|
|
|
50
50
|
throw new Error(s.invalidLicense);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
const y = (r, t) => r === "specific" ? t === window.location.host : window.location.host.includes(t),
|
|
53
|
+
const y = (r, t) => r === "specific" ? t === window.location.host : window.location.host.includes(t), u = {
|
|
54
54
|
isValid: !0,
|
|
55
55
|
invalidatedMessage: s.invalidLicense,
|
|
56
56
|
type: void 0
|
|
57
57
|
}, x = (r) => {
|
|
58
|
-
const [t, e] =
|
|
59
|
-
if (!r)
|
|
60
|
-
throw e(
|
|
58
|
+
const [t, e] = E(u), n = h(async () => {
|
|
59
|
+
if (e((c) => ({ ...c, validating: !0 })), !r)
|
|
60
|
+
throw e({ ...u, validating: !1 }), new Error(s.invalidLicense);
|
|
61
61
|
let i;
|
|
62
62
|
try {
|
|
63
63
|
i = await I(r);
|
|
64
|
-
} catch (
|
|
65
|
-
throw
|
|
64
|
+
} catch (c) {
|
|
65
|
+
throw l.warn(c.message), new Error(c.message);
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
const { avu: a, exp: o, dmt:
|
|
67
|
+
l.debug(">>> validatedLicense", i);
|
|
68
|
+
const { avu: a, exp: o, dmt: m, dm: w, t: f } = i;
|
|
69
69
|
if (!o)
|
|
70
70
|
throw new Error("License is missing expiration timestamp");
|
|
71
71
|
if (o > Number.MAX_SAFE_INTEGER / 1e3)
|
|
72
72
|
throw new Error("Invalid expiration timestamp: value too large");
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
73
|
+
const p = new Date(o * 1e3), g = (/* @__PURE__ */ new Date()).getTime();
|
|
74
|
+
if (p.getTime() < g)
|
|
75
75
|
throw new Error(s.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
|
-
const
|
|
81
|
-
if (
|
|
80
|
+
const v = new Date(a * 1e3);
|
|
81
|
+
if (l.debug("availableUntilTimestamp", v), v.getTime() < b.getTime())
|
|
82
82
|
throw new Error(s.exceededVersion);
|
|
83
|
-
if (!y(
|
|
83
|
+
if (!y(m, w))
|
|
84
84
|
throw new Error(s.mismatchedDomain);
|
|
85
85
|
return {
|
|
86
86
|
isValid: !0,
|
|
87
|
-
type:
|
|
87
|
+
type: f,
|
|
88
88
|
invalidatedMessage: void 0
|
|
89
89
|
};
|
|
90
90
|
}, [r]);
|
|
@@ -93,13 +93,15 @@ const y = (r, t) => r === "specific" ? t === window.location.host : window.locat
|
|
|
93
93
|
e({
|
|
94
94
|
isValid: i,
|
|
95
95
|
type: a,
|
|
96
|
-
invalidatedMessage: o
|
|
96
|
+
invalidatedMessage: o,
|
|
97
|
+
validating: !1
|
|
97
98
|
});
|
|
98
99
|
}).catch((i) => {
|
|
99
100
|
e({
|
|
100
|
-
...
|
|
101
|
-
isValid: !1
|
|
102
|
-
|
|
101
|
+
...u,
|
|
102
|
+
isValid: !1,
|
|
103
|
+
validating: !1
|
|
104
|
+
}), l.warn(i.message);
|
|
103
105
|
});
|
|
104
106
|
}, [n]), t;
|
|
105
107
|
};
|
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
import { useCallback as
|
|
2
|
-
import { usePagesRotateContext as
|
|
3
|
-
import { useLicenseContext as
|
|
4
|
-
import { LicenseType as
|
|
5
|
-
import { ORGANIZATION_ALLOWED_FEATURES_MESSAGE as
|
|
6
|
-
const
|
|
7
|
-
const { setSinglePageRotate:
|
|
8
|
-
(
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
return
|
|
12
|
-
...
|
|
13
|
-
[
|
|
1
|
+
import { useMemo as c, useCallback as f } from "react";
|
|
2
|
+
import { usePagesRotateContext as m } from "../../contexts/PagesRotateContext.js";
|
|
3
|
+
import { useLicenseContext as p } from "../../contexts/LicenseContext.js";
|
|
4
|
+
import { LicenseType as u } from "../types.js";
|
|
5
|
+
import { ORGANIZATION_ALLOWED_FEATURES_MESSAGE as R } from "../const.js";
|
|
6
|
+
const d = () => {
|
|
7
|
+
const { setSinglePageRotate: r } = m(), { type: e, validating: s } = p(), a = c(() => e ? [u.Organization, u.FreeTrial].includes(e) : !1, [e]), i = f(
|
|
8
|
+
(l, t) => {
|
|
9
|
+
r((o) => {
|
|
10
|
+
const n = typeof t == "function" ? t(o[l] || 0) : t;
|
|
11
|
+
return n % 90 !== 0 ? (console.warn("rotationDegree must be a multiple of 90 got", n), o) : {
|
|
12
|
+
...o,
|
|
13
|
+
[l]: n
|
|
14
14
|
};
|
|
15
15
|
});
|
|
16
16
|
},
|
|
17
|
-
[
|
|
17
|
+
[r]
|
|
18
18
|
);
|
|
19
|
-
return s !==
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} : { rotate: i };
|
|
19
|
+
return { rotate: c(() => s !== !1 ? () => {
|
|
20
|
+
} : a ? i : () => {
|
|
21
|
+
console.error(R);
|
|
22
|
+
}, [s, a, i]) };
|
|
24
23
|
};
|
|
25
24
|
export {
|
|
26
|
-
|
|
25
|
+
d as usePageRotateContext
|
|
27
26
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "react";
|
|
2
2
|
import "../types.js";
|
|
3
|
-
import {
|
|
3
|
+
import { o as $ } from "../../RPLayout-897cb09d.js";
|
|
4
4
|
import "react/jsx-runtime";
|
|
5
5
|
import "../../contexts/RPDocumentContext.js";
|
|
6
6
|
import "../../contexts/DocumentPasswordContext.js";
|
|
@@ -31,6 +31,7 @@ import "../../components/RPConfig.js";
|
|
|
31
31
|
import "../../contexts/ThemeContext.js";
|
|
32
32
|
import "../../components/RPDropFileZone.js";
|
|
33
33
|
import "../../contexts/ToolbarComponentContext.js";
|
|
34
|
+
import "../../contexts/ToolComponentContext.js";
|
|
34
35
|
import "../../components/ui/Button.js";
|
|
35
36
|
import "../../SearchCloseButton-ddb9877e.js";
|
|
36
37
|
import "../../components/ui/Input.js";
|
|
@@ -38,12 +39,17 @@ import "../../components/ui/Checkbox.js";
|
|
|
38
39
|
import "../../components/icons/LoaderIcon.js";
|
|
39
40
|
import "../../contexts/IconContext.js";
|
|
40
41
|
import "../../components/ui/RPTooltip.js";
|
|
41
|
-
import "../../Popover-
|
|
42
|
+
import "../../Popover-1faa77f6.js";
|
|
42
43
|
import "../../contexts/ViewportContext.js";
|
|
44
|
+
import "../../contexts/IconToolContext.js";
|
|
43
45
|
import "../../components/ui/DropDown.js";
|
|
44
46
|
import "../../components/layout/toolbar/MenuItem.js";
|
|
45
47
|
import "../../components/layout/toolbar/MenuSeparator.js";
|
|
48
|
+
import "../dateFormatter.js";
|
|
49
|
+
import "../../components/layout/toolbar/PropertyItem.js";
|
|
50
|
+
import "../../contexts/OtherToolContext.js";
|
|
51
|
+
import "../../components/layout/toolbar/RotateTool.js";
|
|
46
52
|
import "./useDebounce.js";
|
|
47
53
|
export {
|
|
48
|
-
|
|
54
|
+
$ as usePaginate
|
|
49
55
|
};
|
|
@@ -5,7 +5,7 @@ import "../calculatePage.js";
|
|
|
5
5
|
import "react/jsx-runtime";
|
|
6
6
|
import "../../contexts/RPDocumentContext.js";
|
|
7
7
|
import "../../contexts/DocumentPasswordContext.js";
|
|
8
|
-
import {
|
|
8
|
+
import { F as $ } from "../../RPLayout-897cb09d.js";
|
|
9
9
|
import "../../contexts/DarkModeContext.js";
|
|
10
10
|
import "../../contexts/RotationContext.js";
|
|
11
11
|
import "../../contexts/LayerContext.js";
|
|
@@ -31,6 +31,7 @@ import "../../components/RPConfig.js";
|
|
|
31
31
|
import "../../contexts/ThemeContext.js";
|
|
32
32
|
import "../../components/RPDropFileZone.js";
|
|
33
33
|
import "../../contexts/ToolbarComponentContext.js";
|
|
34
|
+
import "../../contexts/ToolComponentContext.js";
|
|
34
35
|
import "../../components/ui/Button.js";
|
|
35
36
|
import "../../SearchCloseButton-ddb9877e.js";
|
|
36
37
|
import "../../components/ui/Input.js";
|
|
@@ -38,12 +39,17 @@ import "../../components/ui/Checkbox.js";
|
|
|
38
39
|
import "../../components/icons/LoaderIcon.js";
|
|
39
40
|
import "../../contexts/IconContext.js";
|
|
40
41
|
import "../../components/ui/RPTooltip.js";
|
|
41
|
-
import "../../Popover-
|
|
42
|
+
import "../../Popover-1faa77f6.js";
|
|
42
43
|
import "../../contexts/ViewportContext.js";
|
|
44
|
+
import "../../contexts/IconToolContext.js";
|
|
43
45
|
import "../../components/ui/DropDown.js";
|
|
44
46
|
import "../../components/layout/toolbar/MenuItem.js";
|
|
45
47
|
import "../../components/layout/toolbar/MenuSeparator.js";
|
|
48
|
+
import "../dateFormatter.js";
|
|
49
|
+
import "../../components/layout/toolbar/PropertyItem.js";
|
|
50
|
+
import "../../contexts/OtherToolContext.js";
|
|
51
|
+
import "../../components/layout/toolbar/RotateTool.js";
|
|
46
52
|
import "./useDebounce.js";
|
|
47
53
|
export {
|
|
48
|
-
|
|
54
|
+
$ as usePresentPage
|
|
49
55
|
};
|