@pdf-viewer/react 1.9.1-rc.5 → 1.9.1-rc.6

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,54 +1,54 @@
1
- import { jsx as H } from "react/jsx-runtime";
2
- import { createContext as N, useContext as S, useState as u, useRef as E, useEffect as a, useCallback as x, useMemo as C } from "react";
3
- import { ZoomLevel as G } from "../utils/types.js";
4
- import { appConsole as R } from "../utils/appConsole.js";
5
- import { useInitialStateContext as A } from "./InitialStateContext.js";
6
- import { useDocumentContext as I } from "./RPDocumentContext.js";
7
- import { PAGE_PADDING as M } from "../utils/constants.js";
8
- import { getZoomLevel as O } from "../utils/getZoomLevel.js";
9
- import { useLayoutContainer as J } from "./LayoutContainerContext.js";
10
- import { useViewModeContext as _ } from "./ViewModeContext.js";
11
- import { useRotationContext as j } from "./RotationContext.js";
12
- import { useGlobalCurrentPage as F } from "./GlobalCurrentPage.js";
13
- const L = N({
1
+ import { jsx as S } from "react/jsx-runtime";
2
+ import { createContext as E, useContext as G, useState as c, useRef as A, useEffect as a, useCallback as x, useMemo as C } from "react";
3
+ import { ZoomLevel as I } from "../utils/types.js";
4
+ import { appConsole as M } from "../utils/appConsole.js";
5
+ import { useInitialStateContext as O } from "./InitialStateContext.js";
6
+ import { useDocumentContext as R } from "./RPDocumentContext.js";
7
+ import { PAGE_PADDING as J } from "../utils/constants.js";
8
+ import { getZoomLevel as _ } from "../utils/getZoomLevel.js";
9
+ import { useLayoutContainer as j } from "./LayoutContainerContext.js";
10
+ import { useViewModeContext as F } from "./ViewModeContext.js";
11
+ import { useRotationContext as T } from "./RotationContext.js";
12
+ import { useGlobalCurrentPage as k } from "./GlobalCurrentPage.js";
13
+ const L = E({
14
14
  zoomLevel: 100,
15
15
  currentZoom: 1,
16
16
  setZoomLevel: () => {
17
17
  }
18
- }), ne = () => {
19
- const c = S(L);
20
- return typeof c.currentZoom != "number" && R.warn("Please use this hooks inside children component of RPProvider"), c;
21
- }, re = ({ children: c }) => {
22
- const { initialScale: w = G.PAGE_FIT } = A(), [r, f] = u(w), { pages: l } = I(), { pagesRef: o } = J(), { viewMode: p } = _(), [h, W] = u((o == null ? void 0 : o.clientWidth) || 0), { rotate: d } = j(), [n, b] = u(null), g = E(null), { currentPage: v } = F(), [P, V] = u(v);
18
+ }), ie = () => {
19
+ const m = G(L);
20
+ return typeof m.currentZoom != "number" && M.warn("Please use this hooks inside children component of RPProvider"), m;
21
+ }, se = ({ children: m }) => {
22
+ const { initialScale: w = I.PAGE_FIT } = O(), [r, f] = c(w), { pages: l } = R(), { pagesRef: o } = j(), { viewMode: h } = F(), [p, W] = c((o == null ? void 0 : o.clientWidth) || 0), [H, b] = c((o == null ? void 0 : o.clientHeight) || 0), { rotate: g } = T(), [n, V] = c(null), d = A(null), { currentPage: v } = k(), [P, z] = c(v);
23
23
  a(() => {
24
24
  let e = l.get(P);
25
25
  e || (e = l.get(1));
26
26
  const t = e == null ? void 0 : e.page.getViewport({
27
27
  scale: 1,
28
- rotation: e.defaultRotation + d
28
+ rotation: e.defaultRotation + g
29
29
  });
30
- t && JSON.stringify(t) !== JSON.stringify(g.current) && (g.current = t, b(t));
31
- }, [l, d, P]);
30
+ t && JSON.stringify(t) !== JSON.stringify(d.current) && (d.current = t, V(t));
31
+ }, [l, g, P]);
32
32
  const Z = x(() => {
33
33
  if (!n)
34
34
  return null;
35
- const e = ((n == null ? void 0 : n.width) || 0) + 2 * M, t = (n == null ? void 0 : n.height) || 0, i = (o == null ? void 0 : o.clientWidth) || 0, s = (o == null ? void 0 : o.clientHeight) || 0;
36
- return { pageWidth: e, pageHeight: t, clientWidth: i, clientHeight: s };
37
- }, [n]), m = C(() => {
35
+ const e = ((n == null ? void 0 : n.width) || 0) + 2 * J, t = (n == null ? void 0 : n.height) || 0, s = (o == null ? void 0 : o.clientWidth) || 0, i = (o == null ? void 0 : o.clientHeight) || 0;
36
+ return { pageWidth: e, pageHeight: t, clientWidth: s, clientHeight: i };
37
+ }, [n]), u = C(() => {
38
38
  const e = Z();
39
- if (!h || !e)
39
+ if (!p || !e)
40
40
  return 0;
41
41
  if (typeof r == "number")
42
42
  return r / 100;
43
- const { clientWidth: t, clientHeight: i, pageWidth: s, pageHeight: D } = e;
44
- return O(r, t, i, s, D, p) / 100;
45
- }, [r, h, Z, p]);
43
+ const { clientWidth: t, clientHeight: s, pageWidth: i, pageHeight: N } = e;
44
+ return _(r, t, s, i, N, h) / 100;
45
+ }, [r, p, H, Z, h]);
46
46
  a(() => {
47
- V(v);
47
+ z(v);
48
48
  }, [r]), a(() => {
49
- const e = (i) => {
50
- i.forEach((s) => {
51
- W(s.contentRect.width);
49
+ const e = (s) => {
50
+ s.forEach((i) => {
51
+ W(i.contentRect.width), b(i.contentRect.height);
52
52
  });
53
53
  }, t = new ResizeObserver(e);
54
54
  return o && t.observe(o), () => {
@@ -58,18 +58,18 @@ const L = N({
58
58
  const y = x(
59
59
  (e) => {
60
60
  let t = 0;
61
- typeof e == "function" ? t = e(m * 100) : t = e, t && f(t);
61
+ typeof e == "function" ? t = e(u * 100) : t = e, t && f(t);
62
62
  },
63
- [f, m]
64
- ), z = C(() => ({
63
+ [f, u]
64
+ ), D = C(() => ({
65
65
  zoomLevel: r,
66
- currentZoom: m,
66
+ currentZoom: u,
67
67
  setZoomLevel: y
68
- }), [m, r]);
69
- return /* @__PURE__ */ H(L.Provider, { value: z, children: c });
68
+ }), [u, r]);
69
+ return /* @__PURE__ */ S(L.Provider, { value: D, children: m });
70
70
  };
71
71
  export {
72
72
  L as ZoomContext,
73
- re as ZoomProvider,
74
- ne as useZoomContext
73
+ se as ZoomProvider,
74
+ ie as useZoomContext
75
75
  };
@@ -1,6 +1,6 @@
1
1
  import { useState as E, useCallback as h, useEffect as A } from "react";
2
2
  import { appConsole as l } from "../appConsole.js";
3
- const b = /* @__PURE__ */ new Date("2025-10-02T02:07:59.628Z"), d = "Please visit https://www.react-pdf.dev/manage-license/ to generate a new license key.", s = {
3
+ const b = /* @__PURE__ */ new Date("2025-10-02T07:09:09.012Z"), d = "Please visit https://www.react-pdf.dev/manage-license/ to generate a new license key.", s = {
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}`,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@pdf-viewer/react",
3
3
  "private": false,
4
4
  "description": "A react-pdf-viewer component for React and Next.js. Suitable for react-pdf document.",
5
- "version": "1.9.1-rc.5",
5
+ "version": "1.9.1-rc.6",
6
6
  "keywords": [
7
7
  "react-pdf",
8
8
  "react-pdf-viewer",