@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.
- package/dist/components/page/CustomElement.js +1 -1
- package/dist/contexts/ElementPageContext.js +42 -34
- package/dist/types/utils/const.d.ts +1 -0
- package/dist/types/utils/types.d.ts +3 -3
- package/dist/utils/const.js +3 -2
- package/dist/utils/hooks/useLicense.js +1 -1
- package/dist/utils/hooks/usePageRotateContext.js +13 -12
- package/package.json +1 -1
|
@@ -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 {
|
|
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
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { LicenseType as
|
|
4
|
-
import { useDimensionPagesContext as
|
|
5
|
-
import { usePagesRotateContext as
|
|
6
|
-
import { useLicenseContext as
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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]:
|
|
16
|
+
[e]: o(t[e], n, a[e], u)
|
|
15
17
|
};
|
|
16
18
|
});
|
|
17
19
|
},
|
|
18
|
-
[
|
|
19
|
-
),
|
|
20
|
-
|
|
21
|
-
const t = { ...
|
|
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
|
-
}, []),
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
return
|
|
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__ */
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
|
43
|
+
return s !== w.Organization ? {
|
|
36
44
|
updateElement: () => {
|
|
37
|
-
console.
|
|
45
|
+
console.error(l);
|
|
38
46
|
},
|
|
39
|
-
|
|
40
|
-
console.
|
|
47
|
+
clearElements: () => {
|
|
48
|
+
console.error(l);
|
|
41
49
|
},
|
|
42
50
|
removeElement: () => {
|
|
43
|
-
console.
|
|
51
|
+
console.error(l);
|
|
44
52
|
},
|
|
45
|
-
|
|
46
|
-
} :
|
|
53
|
+
elementList: {}
|
|
54
|
+
} : r;
|
|
47
55
|
};
|
|
48
56
|
export {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
57
|
+
x as ElementPageContext,
|
|
58
|
+
j as ElementPageProvider,
|
|
59
|
+
k as useElementPageContext
|
|
52
60
|
};
|
|
@@ -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
|
-
|
|
683
|
-
|
|
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;
|
package/dist/utils/const.js
CHANGED
|
@@ -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-
|
|
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
|
|
1
|
+
import { useCallback as a } from "react";
|
|
2
2
|
import { usePagesRotateContext as c } from "../../contexts/PagesRotateContext.js";
|
|
3
|
-
import { useLicenseContext as
|
|
4
|
-
import { LicenseType as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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[
|
|
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
|
-
[
|
|
13
|
+
[r]: o
|
|
13
14
|
};
|
|
14
15
|
});
|
|
15
16
|
},
|
|
16
17
|
[n]
|
|
17
18
|
);
|
|
18
|
-
return
|
|
19
|
+
return s !== f.Organization ? {
|
|
19
20
|
rotate: () => {
|
|
20
|
-
console.
|
|
21
|
+
console.error(u);
|
|
21
22
|
}
|
|
22
|
-
} : { rotate:
|
|
23
|
+
} : { rotate: i };
|
|
23
24
|
};
|
|
24
25
|
export {
|
|
25
|
-
|
|
26
|
+
E as usePageRotateContext
|
|
26
27
|
};
|