@pdf-viewer/react 1.8.0-beta.4 → 1.8.0-beta.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.
@@ -11,7 +11,7 @@ const d = ({ child: e }) => {
11
11
  };
12
12
  }, [e]), /* @__PURE__ */ n("div", { ref: t });
13
13
  }, h = ({ pageNumber: e }) => {
14
- const { elements: t } = a(), o = l(null), r = i(() => {
14
+ const { elementList: t } = a(), o = l(null), r = i(() => {
15
15
  var m;
16
16
  return (m = t[e]) == null ? void 0 : m.map((u, s) => u instanceof HTMLElement ? /* @__PURE__ */ n(d, { child: u }, s) : /* @__PURE__ */ n("div", { children: u }, s));
17
17
  }, [t, e]);
@@ -1,52 +1,60 @@
1
- import { jsx as d } from "react/jsx-runtime";
2
- import { createContext as x, useState as w, useCallback as a, useContext as P } from "react";
3
- import { LicenseType as g } from "../utils/types.js";
4
- import { useDimensionPagesContext as C } from "./DimensionPagesContext.js";
5
- import { usePagesRotateContext as p } from "./PagesRotateContext.js";
6
- import { useLicenseContext as y } from "./LicenseContext.js";
7
- const c = x(void 0), O = ({ children: s }) => {
8
- const [i, r] = w({}), { widths: l, heights: m } = C(), { pageRotate: u } = p(), E = a(
9
- (e, n) => {
10
- r((t) => {
11
- const o = { width: l[e], height: m[e] };
1
+ import { jsx as p } from "react/jsx-runtime";
2
+ import { createContext as h, useState as L, useCallback as i, useContext as v } from "react";
3
+ import { LicenseType as w } from "../utils/types.js";
4
+ import { useDimensionPagesContext as g } from "./DimensionPagesContext.js";
5
+ import { usePagesRotateContext as A } from "./PagesRotateContext.js";
6
+ import { useLicenseContext as O } from "./LicenseContext.js";
7
+ import { useZoomContext as R } from "./ZoomContext.js";
8
+ import { ORGANIZATION_ALLOWED_FEATURES_MESSAGE as l } from "../utils/const.js";
9
+ const x = h(void 0), j = ({ children: r }) => {
10
+ const [s, m] = L({}), { widths: c, heights: E } = g(), { pageRotate: a } = A(), { zoomLevel: u } = R(), d = i(
11
+ (e, o) => {
12
+ m((t) => {
13
+ const n = { width: c[e], height: E[e] };
12
14
  return {
13
15
  ...t,
14
- [e]: n(t[e], o, u[e])
16
+ [e]: o(t[e], n, a[e], u)
15
17
  };
16
18
  });
17
19
  },
18
- [l, m]
19
- ), h = a((e) => {
20
- r((n) => {
21
- const t = { ...n };
20
+ [c, E, u, a]
21
+ ), f = i((e) => {
22
+ m((o) => {
23
+ const t = { ...o };
22
24
  return delete t[e], t;
23
25
  });
24
- }, []), f = a((e, n) => {
25
- r((t) => {
26
- const o = { ...t };
27
- return o[e] = o[e].filter((T, v) => v !== n), o;
26
+ }, []), C = i((e, o) => {
27
+ m((t) => {
28
+ const n = { ...t };
29
+ return n[e] = n[e].filter((S, P) => P !== o), n;
28
30
  });
29
31
  }, []);
30
- return /* @__PURE__ */ d(c.Provider, { value: { updateElement: E, clearElement: h, removeElement: f, elements: i }, children: s });
31
- }, S = () => {
32
- const s = P(c), { type: i } = y();
33
- if (!s)
32
+ return /* @__PURE__ */ p(
33
+ x.Provider,
34
+ {
35
+ value: { updateElement: d, clearElements: f, removeElement: C, elementList: s },
36
+ children: r
37
+ }
38
+ );
39
+ }, k = () => {
40
+ const r = v(x), { type: s } = O();
41
+ if (!r)
34
42
  throw new Error("useElementPageContext must be used within a ElementPageProvider");
35
- return i !== g.Organization ? {
43
+ return s !== w.Organization ? {
36
44
  updateElement: () => {
37
- console.warn("This feature is only available in the organization version");
45
+ console.error(l);
38
46
  },
39
- clearElement: () => {
40
- console.warn("This feature is only available in the organization version");
47
+ clearElements: () => {
48
+ console.error(l);
41
49
  },
42
50
  removeElement: () => {
43
- console.warn("This feature is only available in the organization version");
51
+ console.error(l);
44
52
  },
45
- elements: {}
46
- } : s;
53
+ elementList: {}
54
+ } : r;
47
55
  };
48
56
  export {
49
- c as ElementPageContext,
50
- O as ElementPageProvider,
51
- S as useElementPageContext
57
+ x as ElementPageContext,
58
+ j as ElementPageProvider,
59
+ k as useElementPageContext
52
60
  };
@@ -1,2 +1,3 @@
1
1
  import { NormalizedKeyword } from './types';
2
2
  export declare const EMPTY_KEYWORD_REGEXP: NormalizedKeyword;
3
+ export declare const ORGANIZATION_ALLOWED_FEATURES_MESSAGE = "This feature is only available for the Organization license";
@@ -677,10 +677,10 @@ export interface useElementPage {
677
677
  updateElement: (pageNumber: number, element: (prevElements: Array<HTMLElement | JSX.Element>, dimension: {
678
678
  width: number;
679
679
  height: number;
680
- }, rotate: number) => Array<HTMLElement | JSX.Element>) => void;
680
+ }, rotate: number, zoomLevel: number) => Array<HTMLElement | JSX.Element>) => void;
681
681
  removeElement: (pageNumber: number, index: number) => void;
682
- clearElement: (pageNumber: number) => void;
683
- elements: Record<number, Array<HTMLElement | JSX.Element>>;
682
+ clearElements: (pageNumber: number) => void;
683
+ elementList: Record<number, Array<HTMLElement | JSX.Element>>;
684
684
  }
685
685
  export interface MatchHighlight extends MatchValue {
686
686
  keyword: string | RegExp;
@@ -2,7 +2,8 @@ const e = {
2
2
  keyword: "",
3
3
  regExp: new RegExp(" "),
4
4
  wholeWords: !1
5
- };
5
+ }, E = "This feature is only available for the Organization license";
6
6
  export {
7
- e as EMPTY_KEYWORD_REGEXP
7
+ e as EMPTY_KEYWORD_REGEXP,
8
+ E as ORGANIZATION_ALLOWED_FEATURES_MESSAGE
8
9
  };
@@ -1,6 +1,6 @@
1
1
  import { useState as g, useCallback as h, useEffect as A } from "react";
2
2
  import { appConsole as c } from "../appConsole.js";
3
- const b = /* @__PURE__ */ new Date("2025-07-17T02:37:17.250Z"), l = "Please visit https://www.react-pdf.dev/manage-license/ to generate a new license key.", s = {
3
+ const b = /* @__PURE__ */ new Date("2025-07-17T03:26:14.130Z"), l = "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. ${l}`,
5
5
  mismatchedDomain: `Your license key is not valid for the current domain / IP. ${l}`,
6
6
  expired: `Your license key has expired. ${l}`,
@@ -1,26 +1,27 @@
1
- import { useCallback as s } from "react";
1
+ import { useCallback as a } from "react";
2
2
  import { usePagesRotateContext as c } from "../../contexts/PagesRotateContext.js";
3
- import { useLicenseContext as l } from "../../contexts/LicenseContext.js";
4
- import { LicenseType as u } from "../types.js";
5
- const y = () => {
6
- const { setSinglePageRotate: n } = c(), { type: r } = l(), a = s(
7
- (i, t) => {
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) => {
8
9
  n((e) => {
9
- const o = typeof t == "function" ? t(e[i] || 0) : t;
10
+ const o = typeof t == "function" ? t(e[r] || 0) : t;
10
11
  return o % 90 !== 0 ? (console.warn("rotationDegree must be a multiple of 90 got", o), e) : {
11
12
  ...e,
12
- [i]: o
13
+ [r]: o
13
14
  };
14
15
  });
15
16
  },
16
17
  [n]
17
18
  );
18
- return r !== u.Organization ? {
19
+ return s !== f.Organization ? {
19
20
  rotate: () => {
20
- console.warn("This feature is only available in the organization version");
21
+ console.error(u);
21
22
  }
22
- } : { rotate: a };
23
+ } : { rotate: i };
23
24
  };
24
25
  export {
25
- y as usePageRotateContext
26
+ E as usePageRotateContext
26
27
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@pdf-viewer/react",
3
3
  "private": false,
4
4
  "description": "The PDF Viewer component for React and Next.js",
5
- "version": "1.8.0-beta.4",
5
+ "version": "1.8.0-beta.6",
6
6
  "keywords": [
7
7
  "component",
8
8
  "frontend",