@pdf-viewer/react 0.9.0-beta.7 → 0.9.0-beta.8
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
2
|
+
import { useState as e } from "react";
|
|
3
3
|
import { P as u, S as M, T as R, a as C } from "../RPDefaultLayout-ae8b7de8.js";
|
|
4
4
|
import { DarkModeProvider as L } from "../contexts/DarkModeContext.js";
|
|
5
5
|
import { ScrollMode as T, SelectionMode as V } from "../utils/types.js";
|
|
@@ -18,12 +18,12 @@ import { FullScreenProvider as Z } from "../contexts/FullScreenContext.js";
|
|
|
18
18
|
import { FileInputProvider as j } from "../contexts/FileInputContext.js";
|
|
19
19
|
import { DropFileZoneProvider as A } from "../contexts/DropFileZoneContext.js";
|
|
20
20
|
import { LayoutContainerContext as N } from "../contexts/LayoutContainerContext.js";
|
|
21
|
-
const
|
|
21
|
+
const lr = (t) => {
|
|
22
22
|
const {
|
|
23
|
-
children:
|
|
24
|
-
darkMode:
|
|
23
|
+
children: n,
|
|
24
|
+
darkMode: l = !1,
|
|
25
25
|
onDarkModeChange: d,
|
|
26
|
-
|
|
26
|
+
initialRotation: m = 0,
|
|
27
27
|
textLayer: a = !0,
|
|
28
28
|
initialPage: c = 1,
|
|
29
29
|
// initialViewMode = ViewMode.SINGLE_PAGE,
|
|
@@ -32,28 +32,28 @@ const nr = (t) => {
|
|
|
32
32
|
initialScale: P,
|
|
33
33
|
initialScrollMode: p = T.VERTICAL_SCROLLING,
|
|
34
34
|
mobileWidth: v
|
|
35
|
-
} = t, [i, S] =
|
|
35
|
+
} = t, [i, S] = e(null), [o, s] = e(null);
|
|
36
36
|
return /* @__PURE__ */ r(
|
|
37
37
|
G,
|
|
38
38
|
{
|
|
39
39
|
initialScale: P,
|
|
40
40
|
initialPage: c,
|
|
41
41
|
initialScrollMode: p,
|
|
42
|
-
|
|
42
|
+
initialRotation: m,
|
|
43
43
|
children: /* @__PURE__ */ r(w, { mobileWidth: v, containerRef: i, children: /* @__PURE__ */ r(D, { children: /* @__PURE__ */ r(y, { children: /* @__PURE__ */ r(g, { children: /* @__PURE__ */ r(k, { children: /* @__PURE__ */ r(E, { initialSelectionMode: V.TEXT, children: /* @__PURE__ */ r(F, { children: /* @__PURE__ */ r(u, { children: /* @__PURE__ */ r(b, { children: /* @__PURE__ */ r(x, { textLayer: a, children: /* @__PURE__ */ r(
|
|
44
44
|
N.Provider,
|
|
45
45
|
{
|
|
46
|
-
value: { container: i, contentRef:
|
|
46
|
+
value: { container: i, contentRef: o, setContainer: S, setContentRef: s },
|
|
47
47
|
children: /* @__PURE__ */ r(I, { children: /* @__PURE__ */ r(
|
|
48
48
|
L,
|
|
49
49
|
{
|
|
50
|
-
darkMode:
|
|
50
|
+
darkMode: l,
|
|
51
51
|
onDarkModeChange: d,
|
|
52
52
|
children: /* @__PURE__ */ r(M, { initialSearch: h, children: /* @__PURE__ */ r(
|
|
53
53
|
R,
|
|
54
54
|
{
|
|
55
55
|
initialThumbnailsVisible: f,
|
|
56
|
-
children: /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(Z, { elementRef:
|
|
56
|
+
children: /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(Z, { elementRef: o, children: /* @__PURE__ */ r(C, { children: /* @__PURE__ */ r(j, { children: n }) }) }) })
|
|
57
57
|
}
|
|
58
58
|
) })
|
|
59
59
|
}
|
|
@@ -64,5 +64,5 @@ const nr = (t) => {
|
|
|
64
64
|
);
|
|
65
65
|
};
|
|
66
66
|
export {
|
|
67
|
-
|
|
67
|
+
lr as RPController
|
|
68
68
|
};
|
|
@@ -10,7 +10,7 @@ const r = a({
|
|
|
10
10
|
const t = u(r);
|
|
11
11
|
return typeof (t == null ? void 0 : t.rotate) > "u" && l.error("Please use this hooks inside children component of RPController or RPLayout"), t;
|
|
12
12
|
}, P = ({ children: t }) => {
|
|
13
|
-
const {
|
|
13
|
+
const { initialRotation: n = 0 } = p(), [o, e] = c(n), s = m(() => ({
|
|
14
14
|
rotate: o,
|
|
15
15
|
setRotate: e
|
|
16
16
|
}), [o, e]);
|
|
@@ -17,26 +17,26 @@ const g = P({
|
|
|
17
17
|
return typeof e.currentZoom != "number" && b.warn("Please use this hooks inside children component of RPController or RPLayout"), e;
|
|
18
18
|
}, N = ({ children: e }) => {
|
|
19
19
|
const {
|
|
20
|
-
initialScale:
|
|
20
|
+
initialScale: n = S.PAGE_FIT,
|
|
21
21
|
initialPage: c = 1,
|
|
22
|
-
|
|
23
|
-
} = A(), [
|
|
22
|
+
initialRotation: u = 0
|
|
23
|
+
} = A(), [r, a] = v(typeof n == "number" ? n : 100), { pages: l } = D(), { contentRef: t } = G(), p = s(() => r / 100, [r]), o = s(() => {
|
|
24
24
|
var m;
|
|
25
25
|
return (m = l.get(c)) == null ? void 0 : m.page.getViewport({ scale: 1, rotation: u });
|
|
26
26
|
}, [l, c, u]), i = s(() => {
|
|
27
|
-
if (!
|
|
27
|
+
if (!o)
|
|
28
28
|
return 0;
|
|
29
|
-
const m = ((
|
|
30
|
-
return E(
|
|
31
|
-
}, [
|
|
29
|
+
const m = ((o == null ? void 0 : o.width) || 0) + 2 * f, x = ((o == null ? void 0 : o.height) || 0) + 2 * f, Z = (t == null ? void 0 : t.clientWidth) || 0, C = (t == null ? void 0 : t.clientHeight) || 0;
|
|
30
|
+
return E(n, Z, C, m, x);
|
|
31
|
+
}, [o, n, t]);
|
|
32
32
|
y(() => {
|
|
33
33
|
typeof i == "number" && i && a(i);
|
|
34
34
|
}, [i]);
|
|
35
35
|
const h = s(() => ({
|
|
36
|
-
zoomLevel:
|
|
36
|
+
zoomLevel: r,
|
|
37
37
|
currentZoom: p,
|
|
38
38
|
setZoomLevel: a
|
|
39
|
-
}), [p,
|
|
39
|
+
}), [p, r]);
|
|
40
40
|
return /* @__PURE__ */ L(g.Provider, { value: h, children: e });
|
|
41
41
|
};
|
|
42
42
|
export {
|
|
@@ -412,7 +412,7 @@ export declare enum ThemeVariables {
|
|
|
412
412
|
export interface DarkModeProviderProps extends PropsWithChildren, Partial<Omit<DarkMode, 'setDarkMode'>> {
|
|
413
413
|
}
|
|
414
414
|
export interface RotateProviderProps extends PropsWithChildren {
|
|
415
|
-
|
|
415
|
+
initialRotation?: number;
|
|
416
416
|
}
|
|
417
417
|
export interface LayerProviderProps extends PropsWithChildren {
|
|
418
418
|
textLayer?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState as g, useCallback as E, useEffect as h } from "react";
|
|
2
2
|
import { appConsole as l } from "../appConsole.js";
|
|
3
|
-
const A = /* @__PURE__ */ new Date("2025-02-27T09:
|
|
3
|
+
const A = /* @__PURE__ */ new Date("2025-02-27T09:12:14.100Z"), d = "Please visit https://www.react-pdf.dev/license-management/ to generate a new license key.", o = {
|
|
4
4
|
invalidLicense: `You are currently using without a valid license. ${d}`,
|
|
5
5
|
mismatchedDomain: `Your license key is not valid for the current domain / IP. ${d}`,
|
|
6
6
|
expired: `Your license key has expired. ${d}`,
|