@pdf-viewer/react 1.8.0-rc.2 → 1.9.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/{Popover-1faa77f6.js → Popover-48c8394c.js} +2 -2
- package/dist/RPLayout-3042ec91.js +3349 -0
- package/dist/assets/{RPDefaultLayout.css → RPLayout.css} +1 -1
- package/dist/{component-1da194e8.js → component-2aa6e53b.js} +1 -1
- package/dist/components/RPConfig.js +691 -673
- package/dist/components/RPController.js +9 -9
- package/dist/components/RPPages.js +14 -2
- package/dist/components/icons/ChevronDownIcon.js +23 -0
- package/dist/components/layout/LayoutContainer.js +14 -2
- package/dist/components/layout/RPDefaultLayout.js +3 -2
- package/dist/components/layout/RPLayout.js +50 -0
- 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/DarkModeTool.js +16 -19
- package/dist/components/layout/toolbar/DocumentDialog.js +14 -2
- 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 +13 -5
- package/dist/components/layout/toolbar/OtherTool.js +3 -4
- 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 +6 -3
- package/dist/components/layout/toolbar/SelectionModeTool.js +1 -1
- package/dist/components/layout/toolbar/ToolbarCustom.js +47 -0
- package/dist/components/layout/toolbar/ViewModeTool.js +1 -1
- package/dist/components/layout/toolbar/ZoomTool.js +2 -2
- package/dist/components/layout/toolbar/tools/FileDownloadTool.js +17 -0
- package/dist/components/layout/toolbar/tools/FileUploadTool.js +17 -0
- package/dist/components/layout/toolbar/tools/FullScreenTool.js +25 -0
- package/dist/components/layout/toolbar/tools/InputPageTool.js +45 -0
- package/dist/components/layout/toolbar/tools/NextPageTool.js +61 -0
- package/dist/components/layout/toolbar/tools/PreviousPageTool.js +21 -0
- package/dist/components/layout/toolbar/tools/PrintTool.js +17 -0
- package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +17 -0
- package/dist/components/layout/toolbar/tools/ThumbnailTool.js +23 -0
- package/dist/components/layout/toolbar/tools/ZoomInTool.js +28 -0
- package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +92 -0
- package/dist/components/layout/toolbar/tools/ZoomOutTool.js +28 -0
- package/dist/components/page/AnnotationLayer.js +14 -2
- package/dist/components/page/CanvasLayer.js +14 -2
- package/dist/components/page/DualPage.js +1 -1
- package/dist/components/page/RPPage.js +13 -2
- package/dist/components/page/SinglePage.js +2 -2
- package/dist/components/page/TextHighlightLayer.js +14 -2
- package/dist/components/page/TextLayer.js +14 -2
- package/dist/components/ui/Checkbox.js +228 -116
- 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/ElementPageContext.js +46 -57
- package/dist/contexts/PaginationContext.js +3 -3
- package/dist/contexts/PrintContext.js +2 -2
- package/dist/contexts/SearchContext.js +2 -2
- package/dist/contexts/ThumbnailsContext.js +2 -2
- package/dist/{floating-ui.react-dom-15b9b819.js → floating-ui.react-dom-4b1e2e46.js} +394 -380
- package/dist/index-6e0e48fa.js +332 -0
- package/dist/{index-7279fb4e.js → index-951f0f1f.js} +464 -456
- package/dist/index-e3a67935.js +150 -0
- package/dist/main.js +70 -44
- package/dist/types/components/icons/ChevronDownIcon.d.ts +2 -0
- package/dist/types/components/layout/RPDefaultLayout.d.ts +2 -2
- package/dist/types/components/layout/RPLayout.d.ts +2 -0
- package/dist/types/components/layout/toolbar/SearchTool.d.ts +2 -1
- package/dist/types/components/layout/toolbar/ToolbarCustom.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/FileDownloadTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/FileUploadTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/FullScreenTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/InputPageTool.d.ts +2 -0
- package/dist/types/components/layout/toolbar/tools/NextPageTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/PreviousPageTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/PrintTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/ThemeSwitcherTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/ThumbnailTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/ZoomInTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/ZoomLevelTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/ZoomOutTool.d.ts +3 -0
- package/dist/types/main.d.ts +15 -1
- package/dist/types/utils/constants.d.ts +2 -0
- package/dist/types/utils/types.d.ts +28 -2
- package/dist/utils/constants.js +5 -3
- package/dist/utils/hooks/useFileDownload.js +14 -2
- package/dist/utils/hooks/useLicense.js +24 -26
- package/dist/utils/hooks/usePageRotateContext.js +14 -17
- package/dist/utils/hooks/usePaginate.js +14 -2
- package/dist/utils/hooks/usePresentPage.js +14 -2
- package/dist/utils/hooks/usePrint.js +14 -2
- package/dist/utils/hooks/useScrollToPage.js +14 -2
- package/dist/utils/hooks/useSearch.js +14 -2
- package/dist/utils/hooks/useThumbnail.js +14 -2
- package/dist/utils/hooks/useVirtualReactWindow.js +14 -2
- package/package.json +1 -1
- package/dist/RPDefaultLayout-2cca5d34.js +0 -3263
- package/dist/index-1cb41342.js +0 -307
- package/dist/index-aa2d3884.js +0 -140
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import * as r from "react";
|
|
2
|
+
import { u as R, P as w, a as h, f as _, g as U } from "./index-6e0e48fa.js";
|
|
3
|
+
import { jsx as T } from "react/jsx-runtime";
|
|
4
|
+
function b(t) {
|
|
5
|
+
const e = r.useRef(t);
|
|
6
|
+
return r.useEffect(() => {
|
|
7
|
+
e.current = t;
|
|
8
|
+
}), r.useMemo(() => (...n) => {
|
|
9
|
+
var s;
|
|
10
|
+
return (s = e.current) == null ? void 0 : s.call(e, ...n);
|
|
11
|
+
}, []);
|
|
12
|
+
}
|
|
13
|
+
function z(t, e = globalThis == null ? void 0 : globalThis.document) {
|
|
14
|
+
const n = b(t);
|
|
15
|
+
r.useEffect(() => {
|
|
16
|
+
const s = (i) => {
|
|
17
|
+
i.key === "Escape" && n(i);
|
|
18
|
+
};
|
|
19
|
+
return e.addEventListener("keydown", s, { capture: !0 }), () => e.removeEventListener("keydown", s, { capture: !0 });
|
|
20
|
+
}, [n, e]);
|
|
21
|
+
}
|
|
22
|
+
var H = "DismissableLayer", p = "dismissableLayer.update", M = "dismissableLayer.pointerDownOutside", K = "dismissableLayer.focusOutside", g, S = r.createContext({
|
|
23
|
+
layers: /* @__PURE__ */ new Set(),
|
|
24
|
+
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
25
|
+
branches: /* @__PURE__ */ new Set()
|
|
26
|
+
}), j = r.forwardRef(
|
|
27
|
+
(t, e) => {
|
|
28
|
+
const {
|
|
29
|
+
disableOutsidePointerEvents: n = !1,
|
|
30
|
+
onEscapeKeyDown: s,
|
|
31
|
+
onPointerDownOutside: i,
|
|
32
|
+
onFocusOutside: a,
|
|
33
|
+
onInteractOutside: l,
|
|
34
|
+
onDismiss: d,
|
|
35
|
+
...E
|
|
36
|
+
} = t, u = r.useContext(S), [c, B] = r.useState(null), f = (c == null ? void 0 : c.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, F] = r.useState({}), I = R(e, (o) => B(o)), m = Array.from(u.layers), [W] = [...u.layersWithOutsidePointerEventsDisabled].slice(-1), A = m.indexOf(W), P = c ? m.indexOf(c) : -1, N = u.layersWithOutsidePointerEventsDisabled.size > 0, D = P >= A, k = $((o) => {
|
|
37
|
+
const v = o.target, C = [...u.branches].some((y) => y.contains(v));
|
|
38
|
+
!D || C || (i == null || i(o), l == null || l(o), o.defaultPrevented || d == null || d());
|
|
39
|
+
}, f), L = q((o) => {
|
|
40
|
+
const v = o.target;
|
|
41
|
+
[...u.branches].some((y) => y.contains(v)) || (a == null || a(o), l == null || l(o), o.defaultPrevented || d == null || d());
|
|
42
|
+
}, f);
|
|
43
|
+
return z((o) => {
|
|
44
|
+
P === u.layers.size - 1 && (s == null || s(o), !o.defaultPrevented && d && (o.preventDefault(), d()));
|
|
45
|
+
}, f), r.useEffect(() => {
|
|
46
|
+
if (c)
|
|
47
|
+
return n && (u.layersWithOutsidePointerEventsDisabled.size === 0 && (g = f.body.style.pointerEvents, f.body.style.pointerEvents = "none"), u.layersWithOutsidePointerEventsDisabled.add(c)), u.layers.add(c), O(), () => {
|
|
48
|
+
n && u.layersWithOutsidePointerEventsDisabled.size === 1 && (f.body.style.pointerEvents = g);
|
|
49
|
+
};
|
|
50
|
+
}, [c, f, n, u]), r.useEffect(() => () => {
|
|
51
|
+
c && (u.layers.delete(c), u.layersWithOutsidePointerEventsDisabled.delete(c), O());
|
|
52
|
+
}, [c, u]), r.useEffect(() => {
|
|
53
|
+
const o = () => F({});
|
|
54
|
+
return document.addEventListener(p, o), () => document.removeEventListener(p, o);
|
|
55
|
+
}, []), /* @__PURE__ */ T(
|
|
56
|
+
w.div,
|
|
57
|
+
{
|
|
58
|
+
...E,
|
|
59
|
+
ref: I,
|
|
60
|
+
style: {
|
|
61
|
+
pointerEvents: N ? D ? "auto" : "none" : void 0,
|
|
62
|
+
...t.style
|
|
63
|
+
},
|
|
64
|
+
onFocusCapture: h(t.onFocusCapture, L.onFocusCapture),
|
|
65
|
+
onBlurCapture: h(t.onBlurCapture, L.onBlurCapture),
|
|
66
|
+
onPointerDownCapture: h(
|
|
67
|
+
t.onPointerDownCapture,
|
|
68
|
+
k.onPointerDownCapture
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
j.displayName = H;
|
|
75
|
+
var X = "DismissableLayerBranch", Y = r.forwardRef((t, e) => {
|
|
76
|
+
const n = r.useContext(S), s = r.useRef(null), i = R(e, s);
|
|
77
|
+
return r.useEffect(() => {
|
|
78
|
+
const a = s.current;
|
|
79
|
+
if (a)
|
|
80
|
+
return n.branches.add(a), () => {
|
|
81
|
+
n.branches.delete(a);
|
|
82
|
+
};
|
|
83
|
+
}, [n.branches]), /* @__PURE__ */ T(w.div, { ...t, ref: i });
|
|
84
|
+
});
|
|
85
|
+
Y.displayName = X;
|
|
86
|
+
function $(t, e = globalThis == null ? void 0 : globalThis.document) {
|
|
87
|
+
const n = b(t), s = r.useRef(!1), i = r.useRef(() => {
|
|
88
|
+
});
|
|
89
|
+
return r.useEffect(() => {
|
|
90
|
+
const a = (d) => {
|
|
91
|
+
if (d.target && !s.current) {
|
|
92
|
+
let E = function() {
|
|
93
|
+
x(
|
|
94
|
+
M,
|
|
95
|
+
n,
|
|
96
|
+
u,
|
|
97
|
+
{ discrete: !0 }
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
const u = { originalEvent: d };
|
|
101
|
+
d.pointerType === "touch" ? (e.removeEventListener("click", i.current), i.current = E, e.addEventListener("click", i.current, { once: !0 })) : E();
|
|
102
|
+
} else
|
|
103
|
+
e.removeEventListener("click", i.current);
|
|
104
|
+
s.current = !1;
|
|
105
|
+
}, l = window.setTimeout(() => {
|
|
106
|
+
e.addEventListener("pointerdown", a);
|
|
107
|
+
}, 0);
|
|
108
|
+
return () => {
|
|
109
|
+
window.clearTimeout(l), e.removeEventListener("pointerdown", a), e.removeEventListener("click", i.current);
|
|
110
|
+
};
|
|
111
|
+
}, [e, n]), {
|
|
112
|
+
// ensures we check React component tree (not just DOM tree)
|
|
113
|
+
onPointerDownCapture: () => s.current = !0
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function q(t, e = globalThis == null ? void 0 : globalThis.document) {
|
|
117
|
+
const n = b(t), s = r.useRef(!1);
|
|
118
|
+
return r.useEffect(() => {
|
|
119
|
+
const i = (a) => {
|
|
120
|
+
a.target && !s.current && x(K, n, { originalEvent: a }, {
|
|
121
|
+
discrete: !1
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
return e.addEventListener("focusin", i), () => e.removeEventListener("focusin", i);
|
|
125
|
+
}, [e, n]), {
|
|
126
|
+
onFocusCapture: () => s.current = !0,
|
|
127
|
+
onBlurCapture: () => s.current = !1
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function O() {
|
|
131
|
+
const t = new CustomEvent(p);
|
|
132
|
+
document.dispatchEvent(t);
|
|
133
|
+
}
|
|
134
|
+
function x(t, e, n, { discrete: s }) {
|
|
135
|
+
const i = n.originalEvent.target, a = new CustomEvent(t, { bubbles: !1, cancelable: !0, detail: n });
|
|
136
|
+
e && i.addEventListener(t, e, { once: !0 }), s ? _(i, a) : i.dispatchEvent(a);
|
|
137
|
+
}
|
|
138
|
+
var G = r[" useId ".trim().toString()] || (() => {
|
|
139
|
+
}), J = 0;
|
|
140
|
+
function Z(t) {
|
|
141
|
+
const [e, n] = r.useState(G());
|
|
142
|
+
return U(() => {
|
|
143
|
+
t || n((s) => s ?? String(J++));
|
|
144
|
+
}, [t]), t || (e ? `radix-${e}` : "");
|
|
145
|
+
}
|
|
146
|
+
export {
|
|
147
|
+
j as D,
|
|
148
|
+
Z as a,
|
|
149
|
+
b as u
|
|
150
|
+
};
|
package/dist/main.js
CHANGED
|
@@ -1,49 +1,75 @@
|
|
|
1
|
-
import { RPProvider as
|
|
2
|
-
import { a as x,
|
|
3
|
-
import { RPConfig as
|
|
4
|
-
import { RPController as
|
|
5
|
-
import { RPTheme as
|
|
6
|
-
import { RPDropFileZone as
|
|
7
|
-
import { useDarkModeContext as
|
|
8
|
-
import { useDocumentContext as
|
|
9
|
-
import { useRotationContext as
|
|
10
|
-
import { useViewModeContext as
|
|
11
|
-
import { useDropFileZoneContext as
|
|
12
|
-
import { useOpenFileContext as
|
|
13
|
-
import { useZoomContext as
|
|
14
|
-
import { useHighlightContext as
|
|
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 n, d as a, e as s } from "./RPLayout-3042ec91.js";
|
|
3
|
+
import { RPConfig as i } from "./components/RPConfig.js";
|
|
4
|
+
import { RPController as T } from "./components/RPController.js";
|
|
5
|
+
import { RPTheme as R } from "./components/RPTheme.js";
|
|
6
|
+
import { RPDropFileZone as g } from "./components/RPDropFileZone.js";
|
|
7
|
+
import { useDarkModeContext as h } from "./contexts/DarkModeContext.js";
|
|
8
|
+
import { useDocumentContext as D } from "./contexts/RPDocumentContext.js";
|
|
9
|
+
import { useRotationContext as Z } from "./contexts/RotationContext.js";
|
|
10
|
+
import { useViewModeContext as L } from "./contexts/ViewModeContext.js";
|
|
11
|
+
import { useDropFileZoneContext as M } from "./contexts/DropFileZoneContext.js";
|
|
12
|
+
import { useOpenFileContext as V } from "./contexts/FileInputContext.js";
|
|
13
|
+
import { useZoomContext as I } from "./contexts/ZoomContext.js";
|
|
14
|
+
import { useHighlightContext as k } from "./contexts/HighlightContext.js";
|
|
15
15
|
import { usePdfProperties as H } from "./utils/hooks/usePdfProperties.js";
|
|
16
|
-
import { useFullScreenContext as
|
|
17
|
-
import { usePageRotateContext as
|
|
18
|
-
import { useElementPageContext as
|
|
19
|
-
import {
|
|
16
|
+
import { useFullScreenContext as U } from "./contexts/FullScreenContext.js";
|
|
17
|
+
import { usePageRotateContext as q } from "./utils/hooks/usePageRotateContext.js";
|
|
18
|
+
import { useElementPageContext as A } from "./contexts/ElementPageContext.js";
|
|
19
|
+
import { ThemeSwitcherTool as G } from "./components/layout/toolbar/tools/ThemeSwitcherTool.js";
|
|
20
|
+
import { ThumbnailTool as K } from "./components/layout/toolbar/tools/ThumbnailTool.js";
|
|
21
|
+
import { FileUploadTool as W } from "./components/layout/toolbar/tools/FileUploadTool.js";
|
|
22
|
+
import { FileDownloadTool as Y } from "./components/layout/toolbar/tools/FileDownloadTool.js";
|
|
23
|
+
import { PrintTool as $ } from "./components/layout/toolbar/tools/PrintTool.js";
|
|
24
|
+
import { FullScreenTool as eo } from "./components/layout/toolbar/tools/FullScreenTool.js";
|
|
25
|
+
import { PreviousPageTool as to } from "./components/layout/toolbar/tools/PreviousPageTool.js";
|
|
26
|
+
import { NextPageTool as mo } from "./components/layout/toolbar/tools/NextPageTool.js";
|
|
27
|
+
import { InputPageTool as po } from "./components/layout/toolbar/tools/InputPageTool.js";
|
|
28
|
+
import { ZoomInTool as no } from "./components/layout/toolbar/tools/ZoomInTool.js";
|
|
29
|
+
import { ZoomOutTool as so } from "./components/layout/toolbar/tools/ZoomOutTool.js";
|
|
30
|
+
import { ZoomLevelTool as io } from "./components/layout/toolbar/tools/ZoomLevelTool.js";
|
|
31
|
+
import { Locales as To, ScrollMode as Co, ThemeVariables as Ro, ViewMode as go, ZoomLevel as co } from "./utils/types.js";
|
|
20
32
|
export {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
33
|
+
Y as FileDownloadTool,
|
|
34
|
+
W as FileUploadTool,
|
|
35
|
+
eo as FullScreenTool,
|
|
36
|
+
po as InputPageTool,
|
|
37
|
+
To as Locales,
|
|
38
|
+
mo as NextPageTool,
|
|
39
|
+
to as PreviousPageTool,
|
|
40
|
+
$ as PrintTool,
|
|
41
|
+
i as RPConfig,
|
|
42
|
+
T as RPController,
|
|
24
43
|
x as RPDefaultLayout,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
g as RPDropFileZone,
|
|
45
|
+
m as RPLayout,
|
|
46
|
+
l as RPPages,
|
|
47
|
+
r as RPProvider,
|
|
48
|
+
R as RPTheme,
|
|
49
|
+
Co as ScrollMode,
|
|
50
|
+
p as SearchTool,
|
|
51
|
+
G as ThemeSwitcherTool,
|
|
52
|
+
Ro as ThemeVariables,
|
|
53
|
+
K as ThumbnailTool,
|
|
54
|
+
go as ViewMode,
|
|
55
|
+
no as ZoomInTool,
|
|
56
|
+
co as ZoomLevel,
|
|
57
|
+
io as ZoomLevelTool,
|
|
58
|
+
so as ZoomOutTool,
|
|
59
|
+
h as useDarkModeContext,
|
|
60
|
+
D as useDocumentContext,
|
|
61
|
+
M as useDropFileZoneContext,
|
|
62
|
+
A as useElementPageContext,
|
|
63
|
+
f as useFileDownload,
|
|
64
|
+
U as useFullScreenContext,
|
|
65
|
+
k as useHighlightContext,
|
|
66
|
+
V as useOpenFileContext,
|
|
67
|
+
q as usePageRotateContext,
|
|
68
|
+
n as usePaginationContext,
|
|
43
69
|
H as usePdfProperties,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
70
|
+
a as usePrintContext,
|
|
71
|
+
Z as useRotationContext,
|
|
72
|
+
s as useSearchContext,
|
|
73
|
+
L as useViewModeContext,
|
|
74
|
+
I as useZoomContext
|
|
49
75
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const RPDefaultLayout: import('react').ForwardRefExoticComponent<
|
|
1
|
+
import { RPDefaultLayoutProps } from '../../utils/types';
|
|
2
|
+
export declare const RPDefaultLayout: import('react').ForwardRefExoticComponent<RPDefaultLayoutProps & import('react').RefAttributes<HTMLDivElement>>;
|
package/dist/types/main.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { RPProvider } from './components/RPProvider';
|
|
|
2
2
|
export { RPPages } from './components/RPPages';
|
|
3
3
|
export { RPConfig } from './components/RPConfig';
|
|
4
4
|
export { RPDefaultLayout } from './components/layout/RPDefaultLayout';
|
|
5
|
+
export { RPLayout } from './components/layout/RPLayout';
|
|
5
6
|
export { RPController } from './components/RPController';
|
|
6
7
|
export { RPTheme } from './components/RPTheme';
|
|
7
8
|
export { RPDropFileZone } from './components/RPDropFileZone';
|
|
@@ -22,5 +23,18 @@ export { useFullScreenContext } from './contexts/FullScreenContext';
|
|
|
22
23
|
export { usePageRotateContext } from './utils/hooks/usePageRotateContext';
|
|
23
24
|
export { useElementPageContext } from './contexts/ElementPageContext';
|
|
24
25
|
export { type PDFDocumentProxy } from 'pdfjs-dist';
|
|
25
|
-
export
|
|
26
|
+
export { SearchTool } from '../lib/components/layout/toolbar/SearchTool';
|
|
27
|
+
export { ThemeSwitcherTool } from './components/layout/toolbar/tools/ThemeSwitcherTool';
|
|
28
|
+
export { ThumbnailTool } from './components/layout/toolbar/tools/ThumbnailTool';
|
|
29
|
+
export { FileUploadTool } from './components/layout/toolbar/tools/FileUploadTool';
|
|
30
|
+
export { FileDownloadTool } from './components/layout/toolbar/tools/FileDownloadTool';
|
|
31
|
+
export { PrintTool } from './components/layout/toolbar/tools/PrintTool';
|
|
32
|
+
export { FullScreenTool } from './components/layout/toolbar/tools/FullScreenTool';
|
|
33
|
+
export { PreviousPageTool } from './components/layout/toolbar/tools/PreviousPageTool';
|
|
34
|
+
export { NextPageTool } from './components/layout/toolbar/tools/NextPageTool';
|
|
35
|
+
export { InputPageTool } from './components/layout/toolbar/tools/InputPageTool';
|
|
36
|
+
export { ZoomInTool } from './components/layout/toolbar/tools/ZoomInTool';
|
|
37
|
+
export { ZoomOutTool } from './components/layout/toolbar/tools/ZoomOutTool';
|
|
38
|
+
export { ZoomLevelTool } from './components/layout/toolbar/tools/ZoomLevelTool';
|
|
39
|
+
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 } from './utils/types';
|
|
26
40
|
export { ViewMode, ScrollMode, ZoomLevel, Locales, ThemeVariables } from './utils/types';
|
|
@@ -221,7 +221,6 @@ export interface DarkMode extends DarkModeProps {
|
|
|
221
221
|
onDarkModeChange: (value: boolean) => void;
|
|
222
222
|
}
|
|
223
223
|
export interface License {
|
|
224
|
-
validating?: boolean;
|
|
225
224
|
isValid: boolean;
|
|
226
225
|
invalidatedMessage?: string;
|
|
227
226
|
type?: LicenseType;
|
|
@@ -503,7 +502,7 @@ export interface RPConfigProps extends Omit<ConfigContextType, 'workerUrlAdded'>
|
|
|
503
502
|
workerUrl?: string;
|
|
504
503
|
licenseKey?: string;
|
|
505
504
|
}
|
|
506
|
-
export interface
|
|
505
|
+
export interface RPDefaultLayoutProps extends PropsWithChildren, ViewportProps {
|
|
507
506
|
slots?: RPSlots;
|
|
508
507
|
icons?: RPIcons;
|
|
509
508
|
style?: React.CSSProperties;
|
|
@@ -511,6 +510,13 @@ export interface RPLayoutProps extends PropsWithChildren, ViewportProps {
|
|
|
511
510
|
onLoaded?: () => void;
|
|
512
511
|
cleanupOnLoaded?: () => void;
|
|
513
512
|
}
|
|
513
|
+
export interface RPLayoutProps extends PropsWithChildren, ViewportProps {
|
|
514
|
+
toolbar?: Partial<ToolbarProps>;
|
|
515
|
+
style?: React.CSSProperties;
|
|
516
|
+
className?: string;
|
|
517
|
+
onLoaded?: () => void;
|
|
518
|
+
cleanupOnLoaded?: () => void;
|
|
519
|
+
}
|
|
514
520
|
export interface DimensionPagesContextType {
|
|
515
521
|
widths: number[];
|
|
516
522
|
heights: number[];
|
|
@@ -719,4 +725,24 @@ export interface CharacterIndex {
|
|
|
719
725
|
charIdxInSpan: number;
|
|
720
726
|
spanIdx: number;
|
|
721
727
|
}
|
|
728
|
+
export interface ToolbarCustomProps {
|
|
729
|
+
children: React.ReactNode;
|
|
730
|
+
toolbar?: Partial<ToolbarProps>;
|
|
731
|
+
}
|
|
732
|
+
export interface ToolProps {
|
|
733
|
+
icon?: React.ReactNode;
|
|
734
|
+
}
|
|
735
|
+
export interface ThemeSwitcherToolProps {
|
|
736
|
+
icons?: {
|
|
737
|
+
lightModeIcon?: React.ReactNode;
|
|
738
|
+
darkModeIcon?: React.ReactNode;
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
export interface ToolbarSection {
|
|
742
|
+
component: React.ReactNode;
|
|
743
|
+
}
|
|
744
|
+
export interface ToolbarProps {
|
|
745
|
+
topbar: Partial<ToolbarSection>;
|
|
746
|
+
leftSidebar: Partial<ToolbarSection>;
|
|
747
|
+
}
|
|
722
748
|
export {};
|
package/dist/utils/constants.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _ = 4, A = 200, o = 20, t = 25, I = 1e3;
|
|
2
2
|
export {
|
|
3
|
-
I as
|
|
3
|
+
I as MAX_ZOOM_SCALE,
|
|
4
|
+
t as MIN_ZOOM_SCALE,
|
|
5
|
+
_ as PAGE_PADDING,
|
|
4
6
|
o as SCROLL_BAR_WIDTH,
|
|
5
|
-
|
|
7
|
+
A as THUMBNAIL_MIN_WIDTH
|
|
6
8
|
};
|
|
@@ -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 {
|
|
5
|
+
import { c as T } from "../../RPLayout-3042ec91.js";
|
|
6
6
|
import "../../contexts/DarkModeContext.js";
|
|
7
7
|
import "../../contexts/RotationContext.js";
|
|
8
8
|
import "../../contexts/LayerContext.js";
|
|
@@ -30,6 +30,18 @@ import "../../components/RPConfig.js";
|
|
|
30
30
|
import "../../contexts/ThemeContext.js";
|
|
31
31
|
import "../../components/RPDropFileZone.js";
|
|
32
32
|
import "../../contexts/ToolbarComponentContext.js";
|
|
33
|
+
import "../../components/ui/Button.js";
|
|
34
|
+
import "../../SearchCloseButton-ddb9877e.js";
|
|
35
|
+
import "../../components/ui/Input.js";
|
|
36
|
+
import "../../components/ui/Checkbox.js";
|
|
37
|
+
import "../../components/icons/LoaderIcon.js";
|
|
38
|
+
import "../../contexts/IconContext.js";
|
|
39
|
+
import "../../components/ui/RPTooltip.js";
|
|
40
|
+
import "../../Popover-48c8394c.js";
|
|
41
|
+
import "../../contexts/ViewportContext.js";
|
|
42
|
+
import "../../components/ui/DropDown.js";
|
|
43
|
+
import "../../components/layout/toolbar/MenuItem.js";
|
|
44
|
+
import "../../components/layout/toolbar/MenuSeparator.js";
|
|
33
45
|
export {
|
|
34
|
-
|
|
46
|
+
T as useFileDownload
|
|
35
47
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { appConsole as
|
|
3
|
-
const b = /* @__PURE__ */ new Date("2025-07-
|
|
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 g, useCallback as h, useEffect as A } from "react";
|
|
2
|
+
import { appConsole as c } from "../appConsole.js";
|
|
3
|
+
const b = /* @__PURE__ */ new Date("2025-07-29T03:33:35.655Z"), l = "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. ${l}`,
|
|
5
|
+
mismatchedDomain: `Your license key is not valid for the current domain / IP. ${l}`,
|
|
6
|
+
expired: `Your license key has expired. ${l}`,
|
|
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), d = {
|
|
54
54
|
isValid: !0,
|
|
55
55
|
invalidatedMessage: s.invalidLicense,
|
|
56
56
|
type: void 0
|
|
57
57
|
}, x = (r) => {
|
|
58
|
-
const [t, e] =
|
|
59
|
-
if (
|
|
60
|
-
throw e(
|
|
58
|
+
const [t, e] = g(d), n = h(async () => {
|
|
59
|
+
if (!r)
|
|
60
|
+
throw e(d), new Error(s.invalidLicense);
|
|
61
61
|
let i;
|
|
62
62
|
try {
|
|
63
63
|
i = await I(r);
|
|
64
|
-
} catch (
|
|
65
|
-
throw
|
|
64
|
+
} catch (m) {
|
|
65
|
+
throw c.warn(m.message), new Error(m.message);
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
const { avu: a, exp: o, dmt:
|
|
67
|
+
c.debug(">>> validatedLicense", i);
|
|
68
|
+
const { avu: a, exp: o, dmt: w, dm: p, t: v } = 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 f = new Date(o * 1e3), E = (/* @__PURE__ */ new Date()).getTime();
|
|
74
|
+
if (f.getTime() < E)
|
|
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 u = new Date(a * 1e3);
|
|
81
|
+
if (c.debug("availableUntilTimestamp", u), u.getTime() < b.getTime())
|
|
82
82
|
throw new Error(s.exceededVersion);
|
|
83
|
-
if (!y(
|
|
83
|
+
if (!y(w, p))
|
|
84
84
|
throw new Error(s.mismatchedDomain);
|
|
85
85
|
return {
|
|
86
86
|
isValid: !0,
|
|
87
|
-
type:
|
|
87
|
+
type: v,
|
|
88
88
|
invalidatedMessage: void 0
|
|
89
89
|
};
|
|
90
90
|
}, [r]);
|
|
@@ -93,15 +93,13 @@ 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
|
|
97
|
-
validating: !1
|
|
96
|
+
invalidatedMessage: o
|
|
98
97
|
});
|
|
99
98
|
}).catch((i) => {
|
|
100
99
|
e({
|
|
101
|
-
...
|
|
102
|
-
isValid: !1
|
|
103
|
-
|
|
104
|
-
}), l.warn(i.message);
|
|
100
|
+
...d,
|
|
101
|
+
isValid: !1
|
|
102
|
+
}), c.warn(i.message);
|
|
105
103
|
});
|
|
106
104
|
}, [n]), t;
|
|
107
105
|
};
|
|
@@ -1,30 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { usePagesRotateContext as
|
|
3
|
-
import { useLicenseContext as
|
|
4
|
-
import { LicenseType as
|
|
5
|
-
import { ORGANIZATION_ALLOWED_FEATURES_MESSAGE as
|
|
6
|
-
const
|
|
7
|
-
const { setSinglePageRotate: n } =
|
|
8
|
-
(
|
|
1
|
+
import { useCallback as a } from "react";
|
|
2
|
+
import { usePagesRotateContext as c } from "../../contexts/PagesRotateContext.js";
|
|
3
|
+
import { useLicenseContext as m } from "../../contexts/LicenseContext.js";
|
|
4
|
+
import { LicenseType as f } from "../types.js";
|
|
5
|
+
import { ORGANIZATION_ALLOWED_FEATURES_MESSAGE as u } from "../const.js";
|
|
6
|
+
const E = () => {
|
|
7
|
+
const { setSinglePageRotate: n } = c(), { type: s } = m(), i = a(
|
|
8
|
+
(r, t) => {
|
|
9
9
|
n((e) => {
|
|
10
|
-
const o = typeof t == "function" ? t(e[
|
|
10
|
+
const o = typeof t == "function" ? t(e[r] || 0) : t;
|
|
11
11
|
return o % 90 !== 0 ? (console.warn("rotationDegree must be a multiple of 90 got", o), e) : {
|
|
12
12
|
...e,
|
|
13
|
-
[
|
|
13
|
+
[r]: o
|
|
14
14
|
};
|
|
15
15
|
});
|
|
16
16
|
},
|
|
17
17
|
[n]
|
|
18
18
|
);
|
|
19
|
-
return
|
|
19
|
+
return s !== f.Organization ? {
|
|
20
20
|
rotate: () => {
|
|
21
|
+
console.error(u);
|
|
21
22
|
}
|
|
22
|
-
} :
|
|
23
|
-
rotate: () => {
|
|
24
|
-
r.current === 0 && (console.error(R), r.current++);
|
|
25
|
-
}
|
|
26
|
-
} : { rotate: c };
|
|
23
|
+
} : { rotate: i };
|
|
27
24
|
};
|
|
28
25
|
export {
|
|
29
|
-
|
|
26
|
+
E as usePageRotateContext
|
|
30
27
|
};
|