@pdf-viewer/react 1.8.2 → 1.8.3-rc.0
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,71 +1,71 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { LicenseType as
|
|
1
|
+
import { jsx as L } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as w, useState as P, useCallback as u, useContext as h, useRef as g, useMemo as A } from "react";
|
|
3
|
+
import { LicenseType as R } from "../utils/types.js";
|
|
4
4
|
import { useDimensionPagesContext as y } from "./DimensionPagesContext.js";
|
|
5
|
-
import { usePagesRotateContext as
|
|
6
|
-
import { useLicenseContext as
|
|
7
|
-
import { useZoomContext as
|
|
8
|
-
import { ORGANIZATION_ALLOWED_FEATURES_MESSAGE as
|
|
9
|
-
const d =
|
|
10
|
-
const [
|
|
5
|
+
import { usePagesRotateContext as S } from "./PagesRotateContext.js";
|
|
6
|
+
import { useLicenseContext as T } from "./LicenseContext.js";
|
|
7
|
+
import { useZoomContext as _ } from "./ZoomContext.js";
|
|
8
|
+
import { ORGANIZATION_ALLOWED_FEATURES_MESSAGE as E } from "../utils/const.js";
|
|
9
|
+
const d = w(void 0), z = ({ children: i }) => {
|
|
10
|
+
const [l, o] = P({}), { widths: t, heights: c } = y(), { pageRotate: m } = S(), { zoomLevel: f } = _(), x = u(
|
|
11
11
|
(e, r) => {
|
|
12
12
|
o((n) => {
|
|
13
13
|
const s = { width: t[e], height: c[e] };
|
|
14
14
|
return {
|
|
15
15
|
...n,
|
|
16
|
-
[e]: r(n[e], s,
|
|
16
|
+
[e]: r(n[e], s, m[e], f)
|
|
17
17
|
};
|
|
18
18
|
});
|
|
19
19
|
},
|
|
20
|
-
[t, c, f,
|
|
21
|
-
), p =
|
|
20
|
+
[t, c, f, m]
|
|
21
|
+
), p = u((e) => {
|
|
22
22
|
o((r) => {
|
|
23
23
|
const n = { ...r };
|
|
24
24
|
return delete n[e], n;
|
|
25
25
|
});
|
|
26
|
-
}, []),
|
|
26
|
+
}, []), v = u((e, r) => {
|
|
27
27
|
o((n) => {
|
|
28
28
|
const s = { ...n };
|
|
29
|
-
return s[e] = s[e].filter((
|
|
29
|
+
return s[e] = s[e].filter((D, C) => C !== r), s;
|
|
30
30
|
});
|
|
31
31
|
}, []);
|
|
32
|
-
return /* @__PURE__ */
|
|
32
|
+
return /* @__PURE__ */ L(
|
|
33
33
|
d.Provider,
|
|
34
34
|
{
|
|
35
|
-
value: { updateElement: x, clearElements: p, removeElement:
|
|
35
|
+
value: { updateElement: x, clearElements: p, removeElement: v, elementList: l },
|
|
36
36
|
children: i
|
|
37
37
|
}
|
|
38
38
|
);
|
|
39
|
-
},
|
|
39
|
+
}, a = () => {
|
|
40
40
|
}, U = () => {
|
|
41
|
-
const i = h(d), { type:
|
|
41
|
+
const i = h(d), { type: l, validating: o } = T(), t = g(0), c = A(() => {
|
|
42
42
|
if (o !== !1)
|
|
43
43
|
return {
|
|
44
|
-
updateElement:
|
|
45
|
-
clearElements:
|
|
46
|
-
removeElement:
|
|
44
|
+
updateElement: a,
|
|
45
|
+
clearElements: a,
|
|
46
|
+
removeElement: a,
|
|
47
47
|
elementList: {}
|
|
48
48
|
};
|
|
49
|
-
if (
|
|
49
|
+
if (!(l !== R.Developer))
|
|
50
50
|
return {
|
|
51
51
|
updateElement: () => {
|
|
52
|
-
t.current === 0 && (console.error(
|
|
52
|
+
t.current === 0 && (console.error(E), t.current++);
|
|
53
53
|
},
|
|
54
54
|
clearElements: () => {
|
|
55
|
-
t.current === 0 && (console.error(
|
|
55
|
+
t.current === 0 && (console.error(E), t.current++);
|
|
56
56
|
},
|
|
57
57
|
removeElement: () => {
|
|
58
|
-
t.current === 0 && (console.error(
|
|
58
|
+
t.current === 0 && (console.error(E), t.current++);
|
|
59
59
|
},
|
|
60
60
|
elementList: {}
|
|
61
61
|
};
|
|
62
|
-
}, [
|
|
62
|
+
}, [l, o]);
|
|
63
63
|
if (!i)
|
|
64
64
|
throw new Error("useElementPageContext must be used within a ElementPageProvider");
|
|
65
65
|
return c || i;
|
|
66
66
|
};
|
|
67
67
|
export {
|
|
68
68
|
d as ElementPageContext,
|
|
69
|
-
|
|
69
|
+
z as ElementPageProvider,
|
|
70
70
|
U as useElementPageContext
|
|
71
71
|
};
|
|
@@ -228,7 +228,8 @@ export interface License {
|
|
|
228
228
|
}
|
|
229
229
|
export declare enum LicenseType {
|
|
230
230
|
Organization = "organization",
|
|
231
|
-
Developer = "developer"
|
|
231
|
+
Developer = "developer",
|
|
232
|
+
FreeTrial = "free-trial"
|
|
232
233
|
}
|
|
233
234
|
export type DecryptedLicense = {
|
|
234
235
|
exp: number;
|
|
@@ -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-08-
|
|
3
|
+
const b = /* @__PURE__ */ new Date("2025-08-20T05:13:07.643Z"), 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}`,
|
|
@@ -1,30 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { usePagesRotateContext as
|
|
3
|
-
import { useLicenseContext as
|
|
1
|
+
import { useMemo as c, useCallback as u } from "react";
|
|
2
|
+
import { usePagesRotateContext as f } from "../../contexts/PagesRotateContext.js";
|
|
3
|
+
import { useLicenseContext as m } from "../../contexts/LicenseContext.js";
|
|
4
4
|
import { LicenseType as p } from "../types.js";
|
|
5
5
|
import { ORGANIZATION_ALLOWED_FEATURES_MESSAGE as R } from "../const.js";
|
|
6
|
-
const
|
|
7
|
-
const { setSinglePageRotate: n } =
|
|
8
|
-
(
|
|
9
|
-
n((
|
|
10
|
-
const o = typeof
|
|
11
|
-
return o % 90 !== 0 ? (console.warn("rotationDegree must be a multiple of 90 got", o),
|
|
12
|
-
...
|
|
13
|
-
[
|
|
6
|
+
const y = () => {
|
|
7
|
+
const { setSinglePageRotate: n } = f(), { type: r, validating: s } = m(), a = c(() => r !== p.Developer, [r]), i = u(
|
|
8
|
+
(l, e) => {
|
|
9
|
+
n((t) => {
|
|
10
|
+
const o = typeof e == "function" ? e(t[l] || 0) : e;
|
|
11
|
+
return o % 90 !== 0 ? (console.warn("rotationDegree must be a multiple of 90 got", o), t) : {
|
|
12
|
+
...t,
|
|
13
|
+
[l]: o
|
|
14
14
|
};
|
|
15
15
|
});
|
|
16
16
|
},
|
|
17
17
|
[n]
|
|
18
18
|
);
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
rotate: () => {
|
|
24
|
-
r.current === 0 && (console.error(R), r.current++);
|
|
25
|
-
}
|
|
26
|
-
} : { rotate: c };
|
|
19
|
+
return { rotate: c(() => s !== !1 ? () => {
|
|
20
|
+
} : a ? i : () => {
|
|
21
|
+
console.error(R);
|
|
22
|
+
}, [s, a, i]) };
|
|
27
23
|
};
|
|
28
24
|
export {
|
|
29
|
-
|
|
25
|
+
y as usePageRotateContext
|
|
30
26
|
};
|
package/dist/utils/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { e as r, z as _, i as R, p as o, t as p } from "../th_TH-f515b3ad.js";
|
|
2
|
-
var D = /* @__PURE__ */ ((O) => (O[O.Text = 1] = "Text", O[O.Link = 2] = "Link", O[O.FreeText = 3] = "FreeText", O[O.Line = 4] = "Line", O[O.Square = 5] = "Square", O[O.Circle = 6] = "Circle", O[O.Polygon = 7] = "Polygon", O[O.Polyline = 8] = "Polyline", O[O.Highlight = 9] = "Highlight", O[O.Underline = 10] = "Underline", O[O.Squiggly = 11] = "Squiggly", O[O.StrikeOut = 12] = "StrikeOut", O[O.Stamp = 13] = "Stamp", O[O.Caret = 14] = "Caret", O[O.Ink = 15] = "Ink", O[O.Popup = 16] = "Popup", O[O.FileAttachment = 17] = "FileAttachment", O[O.Widget = 20] = "Widget", O))(D || {}), N = /* @__PURE__ */ ((O) => (O.INTERNAL_LINK = "internal-link", O.LINK = "link", O.FILE_ATTACHMENT = "file-attachment", O.FORM_TEXT = "form-text", O.FORM_SELECT = "form-select", O.FORM_CHECKBOX = "form-checkbox", O.FORM_RADIO = "form-radio", O.FORM_BUTTON = "form-button", O.BUTTON = "button", O))(N || {}),
|
|
3
|
-
const
|
|
2
|
+
var D = /* @__PURE__ */ ((O) => (O[O.Text = 1] = "Text", O[O.Link = 2] = "Link", O[O.FreeText = 3] = "FreeText", O[O.Line = 4] = "Line", O[O.Square = 5] = "Square", O[O.Circle = 6] = "Circle", O[O.Polygon = 7] = "Polygon", O[O.Polyline = 8] = "Polyline", O[O.Highlight = 9] = "Highlight", O[O.Underline = 10] = "Underline", O[O.Squiggly = 11] = "Squiggly", O[O.StrikeOut = 12] = "StrikeOut", O[O.Stamp = 13] = "Stamp", O[O.Caret = 14] = "Caret", O[O.Ink = 15] = "Ink", O[O.Popup = 16] = "Popup", O[O.FileAttachment = 17] = "FileAttachment", O[O.Widget = 20] = "Widget", O))(D || {}), N = /* @__PURE__ */ ((O) => (O.INTERNAL_LINK = "internal-link", O.LINK = "link", O.FILE_ATTACHMENT = "file-attachment", O.FORM_TEXT = "form-text", O.FORM_SELECT = "form-select", O.FORM_CHECKBOX = "form-checkbox", O.FORM_RADIO = "form-radio", O.FORM_BUTTON = "form-button", O.BUTTON = "button", O))(N || {}), E = /* @__PURE__ */ ((O) => (O.ACTUAL = "Actual", O.PAGE_FIT = "Fit", O.PAGE_WIDTH = "Width", O))(E || {}), I = /* @__PURE__ */ ((O) => (O.Organization = "organization", O.Developer = "developer", O.FreeTrial = "free-trial", O))(I || {}), L = /* @__PURE__ */ ((O) => (O.SINGLE_PAGE = "Single", O.DUAL_PAGE = "Dual", O))(L || {}), d = /* @__PURE__ */ ((O) => (O.FONT_FAMILY = "--rp-font-family", O.PRIMARY_COLOR = "--rp-primary-color", O.BORDER_RADIUS = "--rp-border-radius", O.TEXT_COLOR = "--rp-text-color", O.OUTLINE_COLOR = "--rp-outline-color", O.FONT_SIZE = "--rp-font-size", O.DROP_MASK_BACKGROUND_COLOR = "--rp-drop-mask-background-color", O.LOADER_BACKDROP_COLOR = "--rp-loader-backdrop-color", O.ICON_DISABLED = "--rp-icon-disabled", O.ICON_FONT_SIZE = "--rp-icon-font-size", O.TOOLBAR_BACKGROUND = "--rp-toolbar-background", O.TOOLBAR_BORDER_COLOR = "--rp-toolbar-border-color", O.TOOLBAR_PADDING = "--rp-toolbar-padding", O.TOOLBAR_GAP = "--rp-toolbar-gap", O.TOOLBAR_SIZE = "--rp-toolbar-size", O.SIDEBAR_WIDTH = "--rp-sidebar-width", O.THUMBNAIL_BORDER_COLOR = "--rp-thumbnail-border-color", O.THUMBNAIL_BACKGROUND_COLOR = "--rp-thumbnail-background-color", O.THUMBNAIL_ACTIVE_COLOR = "--rp-thumbnail-active-color", O.THUMBNAIL_PADDING_Y = "--rp-thumbnail-padding-y", O.BUTTON_HOVER_BACKGROUND = "--rp-button-hover-background", O.BUTTON_PADDING = "--rp-button-padding", O.INPUT_PADDING = "--rp-input-padding", O.INPUT_BORDER_RADIUS = "--rp-input-border-radius", O.INPUT_BACKGROUND_COLOR = "--rp-input-background-color", O.INPUT_PLACEHOLDER_COLOR = "--rp-input-placeholder-color", O.PAGES_BACKGROUND_COLOR = "--rp-pages-background-color", O.ANNOTATION_LAYER_LINK_HOVER_BACKGROUND = "--rp-annotation-layer__link-hover-background", O.DROPDOWN_BACKGROUND_COLOR = "--rp-dropdown-background-color", O.DROPDOWN_PADDING = "--rp-dropdown-padding", O.DROPDOWN_HOVER_BACKGROUND_COLOR = "--rp-dropdown-hover-background-color", O.DROPDOWN_SEPARATOR_COLOR = "--rp-dropdown-separator-color", O.DROPDOWN_SEPARATOR_MARGIN = "--rp-dropdown-separator-margin", O.DROPDOWN_PADDING_MENU_ITEM = "--rp-dropdown-padding-menu-item", O.DROPDOWN_FONT_SIZE = "--rp-dropdown-font-size", O.DROPDOWN_BORDER_RADIUS = "--rp-dropdown-border-radius", O.SEARCH_TOOL_DROPDOWN_PADDING = "--rp-search-tool-dropdown-padding", O.POPOVER_FONT_SIZE = "--rp-popover-font-size", O.POPOVER_BACKGROUND_COLOR = "--rp-popover-background-color", O.POPOVER_COLOR = "--rp-popover-color", O.POPOVER_BORDER_COLOR = "--rp-popover-border-color", O.POPOVER_BORDER_RADIUS = "--rp-popover-border-radius", O.OVERLAY_BACKGROUND_COLOR = "--rp-overlay-background-color", O.DIALOG_BACKGROUND_COLOR = "--rp-dialog-background-color", O.PROPERTIES_DIVIDER_COLOR = "--rp-properties-divider-color", O.PROPERTIES_DIVIDER_MARGIN = "--rp-properties-divider-margin", O.PROPERTY_ITEM_GAP = "--rp-property-item-gap", O.DIALOG_TITLE_COLOR = "--rp-dialog-title-color", O.PROPERTY_ITEM_LABEL_COLOR = "--rp-property-item-label-color", O.PROPERTY_CLOSE_ICON_SIZE = "--rp-property-close-icon-size", O.PROPERTY_ITEM_FONT_SIZE = "--rp-property-item-font-size", O.PROPERTY_ITEM_FONT_WEIGHT = "--rp-property-item-font-weight", O.DIALOG_TITLE_FONT_SIZE = "--rp-dialog-title-font-size", O.DIALOG_TITLE_FONT_WEIGHT = "--rp-dialog-title-font-weight", O.MENU_ITEM_ICON_SIZE = "--rp-menu-item-icon-size", O.PRINT_PROGRESS_BACKGROUND = "--rp-print-progress-background", O.PRINT_PROGRESS_COLOR = "--rp-print-progress-color", O.DROP_ZONE_BORDER = "--rp-drop-zone-border", O.DROP_ZONE_FONT_COLOR = "--rp-drop-zone-font-color", O.DROP_ZONE_FONT_SIZE = "--rp-drop-zone-font-size", O.DROP_ZONE_BACKGROUND_COLOR = "--rp-drop-zone-background-color", O.CHECKBOX_BORDER_RADIUS = "--rp-checkbox-border-radius", O.CHECKBOX_BORDER_COLOR = "--rp-checkbox-border-color", O.CHECKBOX_INDICATOR_COLOR = "--rp-checkbox-indicator-color", O.HIGHLIGHT_BACKGROUND_COLOR = "--rp-highlight-background-color", O.TEXT_LAYER_HIGHLIGHT_BORDER_RADIUS = "--rp-text-layer-highlight-border-radius", O.CURRENT_HIGHLIGHT_BACKGROUND_COLOR = "--rp-current-highlight-background-color", O.TOOLTIP_BACKGROUND_COLOR = "--rp-tooltip-background-color", O.TOOLTIP_BORDER_RADIUS = "--rp-tooltip-border-radius", O.TOOLTIP_FONT_COLOR = "--rp-tooltip-font-color", O.TOOLTIP_FONT_SIZE = "--rp-tooltip-font-size", O.TOOLTIP_PADDING = "--rp-tooltip-padding", O.PASSWORD_MODAL_BACKGROUND_COLOR = "--rp-password-background-color", O.PASSWORD_MODAL_TITLE_FONT_COLOR = "--rp-password-title-font-color", O.PASSWORD_MODAL_CONTENT_FONT_COLOR = "--rp-password-content-font-color", O.PASSWORD_MODAL_INPUT_PLACEHOLDER_COLOR = "--rp-password-input-placeholder-color", O.PASSWORD_MODAL_INPUT_BORDER_COLOR = "--rp-password-input-border-color", O.PASSWORD_MODAL_INPUT_FONT_COLOR = "--rp-password-input-font-color", O.PASSWORD_MODAL_BUTTON_FONT_COLOR = "--rp-password-button-font-color", O.PASSWORD_MODAL_BUTTON_BACKGROUND_COLOR = "--rp-password-button-background-color", O.PASSWORD_MODAL_BUTTON_BORDER_COLOR = "--rp-password-button-border-color", O.PASSWORD_MODAL_BORDER_COLOR = "--rp-password-border-color", O.CONTAINER_FOCUS_OUTLINE_WIDTH = "--rp-container-focus-outline-width", O.CONTAINER_FOCUS_OUTLINE_COLOR = "--rp-container-focus-outline-color", O.CONTAINER_FOCUS_OUTLINE_OFFSET = "--rp-container-focus-outline-offset", O.BUTTON_BORDER_RADIUS = "--rp-button-border-radius", O))(d || {}), C = /* @__PURE__ */ ((O) => (O.PAGE_SCROLLING = "PAGE", O.VERTICAL_SCROLLING = "VERTICAL", O.HORIZONTAL_SCROLLING = "HORIZONTAL", O))(C || {}), P = /* @__PURE__ */ ((O) => (O.TEXT = "TEXT", O.HAND = "HAND", O))(P || {});
|
|
3
|
+
const t = {
|
|
4
4
|
en_US: r,
|
|
5
5
|
zh_CN: _,
|
|
6
6
|
it_IT: R,
|
|
@@ -10,11 +10,11 @@ const A = {
|
|
|
10
10
|
export {
|
|
11
11
|
D as AnnotationSubType,
|
|
12
12
|
N as AnnotationType,
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
I as LicenseType,
|
|
14
|
+
t as Locales,
|
|
15
15
|
C as ScrollMode,
|
|
16
16
|
P as SelectionMode,
|
|
17
17
|
d as ThemeVariables,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
L as ViewMode,
|
|
19
|
+
E as ZoomLevel
|
|
20
20
|
};
|
package/package.json
CHANGED