@react-pdf-kit/viewer 2.0.0-beta.3 → 2.0.0-beta.4
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/{ToolbarLayout.module-7a53aa2b.js → ToolbarLayout.module-692ae41a.js} +5 -6
- package/dist/components/RPConfig.js +1 -1
- package/dist/components/RPController.js +2 -2
- package/dist/components/RPDropFileZone.js +1 -1
- package/dist/components/RPPages.js +2 -2
- package/dist/components/RPProvider.js +2 -2
- package/dist/components/layout/LayoutContainer.js +2 -2
- package/dist/components/layout/RPDefaultLayout.js +2 -2
- package/dist/components/layout/RPLayout.js +2 -2
- package/dist/components/layout/WrapperLayout.js +1 -1
- package/dist/components/layout/sidebar/RPSidebar.js +2 -2
- package/dist/components/layout/sidebar/Thumbnail.js +2 -2
- package/dist/components/layout/sidebar/Thumbnails.js +2 -2
- package/dist/components/layout/toolbar/DocumentDialog.js +2 -2
- package/dist/components/layout/toolbar/FileDownloadTool.js +2 -2
- package/dist/components/layout/toolbar/FileUploadTool.js +1 -1
- package/dist/components/layout/toolbar/MostPageTool.js +2 -2
- package/dist/components/layout/toolbar/OtherTool.js +2 -2
- package/dist/components/layout/toolbar/Paginate.js +2 -2
- package/dist/components/layout/toolbar/PrintTool.js +2 -2
- package/dist/components/layout/toolbar/RPMoreOptions.js +2 -2
- package/dist/components/layout/toolbar/RPToolbar.js +2 -2
- package/dist/components/layout/toolbar/RPToolbarEnd.js +2 -2
- package/dist/components/layout/toolbar/RotateTool.js +1 -1
- package/dist/components/layout/toolbar/SearchResultNavigator.js +2 -2
- package/dist/components/layout/toolbar/SearchTool.js +2 -2
- package/dist/components/layout/toolbar/ThumbnailTool.js +2 -2
- package/dist/components/layout/toolbar/ToolbarCustom.js +2 -2
- package/dist/components/layout/toolbar/ToolbarDefault.js +2 -2
- package/dist/components/layout/toolbar/ToolbarLayout.js +2 -2
- package/dist/components/layout/toolbar/ZoomTool.js +2 -2
- package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +2 -2
- package/dist/components/layout/toolbar/tools/DualPageTool.js +2 -2
- package/dist/components/layout/toolbar/tools/FileDownloadTool.js +2 -2
- package/dist/components/layout/toolbar/tools/FileUploadTool.js +1 -1
- package/dist/components/layout/toolbar/tools/InputPageTool.js +2 -2
- package/dist/components/layout/toolbar/tools/NextPageTool.js +2 -2
- package/dist/components/layout/toolbar/tools/PreviousPageTool.js +2 -2
- package/dist/components/layout/toolbar/tools/PrintTool.js +2 -2
- package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +1 -1
- package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +1 -1
- package/dist/components/layout/toolbar/tools/SinglePageTool.js +2 -2
- package/dist/components/layout/toolbar/tools/ThumbnailTool.js +2 -2
- package/dist/components/layout/toolbar/tools/ZoomInTool.js +1 -1
- package/dist/components/layout/toolbar/tools/ZoomLevelDisplay.js +2 -2
- package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +2 -2
- package/dist/components/layout/toolbar/tools/ZoomOutTool.js +1 -1
- package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +2 -2
- package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +1 -1
- package/dist/components/page/AnnotationLayer.js +2 -2
- package/dist/components/page/CanvasLayer.js +2 -2
- package/dist/components/page/CustomElement.js +1 -1
- package/dist/components/page/DualPage.js +2 -2
- package/dist/components/page/RPPage.js +2 -2
- package/dist/components/page/SinglePage.js +2 -2
- package/dist/components/page/TextHighlightLayer.js +2 -2
- package/dist/components/page/TextLayer.js +2 -2
- package/dist/components/ui/LoadingIndicator.js +2 -2
- package/dist/contexts/DimensionPagesContext.js +1 -1
- package/dist/contexts/DropFileZoneContext.js +1 -1
- package/dist/contexts/ElementPageContext.js +1 -1
- package/dist/contexts/FileInputContext.js +1 -1
- package/dist/contexts/HighlightContext.js +1 -1
- package/dist/contexts/PagesRotateContext.js +1 -1
- package/dist/contexts/PaginationContext.js +2 -2
- package/dist/contexts/PrintContext.js +2 -2
- package/dist/contexts/RPDocumentContext.js +1 -1
- package/dist/contexts/RenderQueueProvider.js +2 -2
- package/dist/contexts/RotationContext.js +1 -1
- package/dist/contexts/SearchContext.js +2 -2
- package/dist/contexts/ThumbnailsContext.js +2 -2
- package/dist/contexts/ZoomContext.js +1 -1
- package/dist/main.js +2 -2
- package/dist/pdf-ba2a5710.js +17940 -0
- package/dist/utils/hooks/useFileDownload.js +2 -2
- package/dist/utils/hooks/useLicense.js +1 -1
- package/dist/utils/hooks/useLoadPdf.js +23 -23
- package/dist/utils/hooks/useLoadWorker.js +10 -7
- package/dist/utils/hooks/usePageRotateContext.js +1 -1
- package/dist/utils/hooks/usePaginate.js +2 -2
- package/dist/utils/hooks/usePinch.js +1 -1
- package/dist/utils/hooks/usePresentPage.js +2 -2
- package/dist/utils/hooks/usePrint.js +2 -2
- package/dist/utils/hooks/useRotate.js +1 -1
- package/dist/utils/hooks/useScrollToPage.js +2 -2
- package/dist/utils/hooks/useSearch.js +2 -2
- package/dist/utils/hooks/useThumbnail.js +2 -2
- package/dist/utils/hooks/useVirtualReactWindow.js +2 -2
- package/dist/utils/renderPage.js +4 -4
- package/package.json +2 -6
|
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
|
|
|
2
2
|
import "react";
|
|
3
3
|
import "../../contexts/RPDocumentContext.js";
|
|
4
4
|
import "../../contexts/DocumentPasswordContext.js";
|
|
5
|
-
import { b as Er } from "../../ToolbarLayout.module-
|
|
5
|
+
import { b as Er } from "../../ToolbarLayout.module-692ae41a.js";
|
|
6
6
|
import "../../contexts/DarkModeContext.js";
|
|
7
7
|
import "../../contexts/RotationContext.js";
|
|
8
8
|
import "../../contexts/LayerContext.js";
|
|
@@ -33,7 +33,7 @@ import "../../contexts/OtherToolContext.js";
|
|
|
33
33
|
import "../../contexts/EventCallbackContext.js";
|
|
34
34
|
import "../../contexts/ThemeContext.js";
|
|
35
35
|
import "../../contexts/ConfigContext.js";
|
|
36
|
-
import "
|
|
36
|
+
import "../../pdf-ba2a5710.js";
|
|
37
37
|
import "../../components/layout/Container.js";
|
|
38
38
|
import "../../contexts/ViewportContext.js";
|
|
39
39
|
import "../../contexts/ToolbarComponentContext.js";
|
|
@@ -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("2026-01-
|
|
3
|
+
const b = /* @__PURE__ */ new Date("2026-01-22T17:22:58.542Z"), 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,39 +1,39 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import
|
|
3
|
-
import { ErrorType as
|
|
4
|
-
import { getThumbnailViewport as
|
|
5
|
-
import { useConfigContext as
|
|
6
|
-
import { useDocumentPasswordContext as
|
|
1
|
+
import { useState as a, useRef as U, useEffect as k } from "react";
|
|
2
|
+
import { V as A, g as F } from "../../pdf-ba2a5710.js";
|
|
3
|
+
import { ErrorType as z } from "../types.js";
|
|
4
|
+
import { getThumbnailViewport as _ } from "../getThumbnailViewport.js";
|
|
5
|
+
import { useConfigContext as j } from "../../contexts/ConfigContext.js";
|
|
6
|
+
import { useDocumentPasswordContext as B } from "../../contexts/DocumentPasswordContext.js";
|
|
7
7
|
import "../../th_TH-d627cd51.js";
|
|
8
8
|
import "react/jsx-runtime";
|
|
9
9
|
import "../appConsole.js";
|
|
10
|
-
const
|
|
11
|
-
const [n,
|
|
10
|
+
const $ = (m, s, I = {}) => {
|
|
11
|
+
const [n, h] = a(), { workerUrlAdded: v } = j(), [q, S] = a(/* @__PURE__ */ new Map()), d = U(), [f, g] = a(0), [P, T] = a(!1), [D, N] = a(), { password: u, passwordError: O, setPasswordError: c, passwordRequired: p, setPasswordRequired: w } = B(), { onLoadError: i, onLoaded: E, onLoadProgress: b, disableAutoFetch: V, disableStream: x, rangeChunkSize: C } = I;
|
|
12
12
|
return k(() => {
|
|
13
13
|
b && b(f);
|
|
14
14
|
}, [f, b]), k(() => {
|
|
15
15
|
if (!v || !m)
|
|
16
16
|
return;
|
|
17
|
-
g(0),
|
|
18
|
-
const r =
|
|
17
|
+
g(0), d.current = Date.now();
|
|
18
|
+
const r = d.current, R = {
|
|
19
19
|
url: m,
|
|
20
20
|
cMapPacked: (s == null ? void 0 : s.isCompressed) ?? !0,
|
|
21
21
|
...(s == null ? void 0 : s.url) && { cMapUrl: s.url },
|
|
22
22
|
...u && { password: u },
|
|
23
|
-
...
|
|
24
|
-
...
|
|
25
|
-
...
|
|
26
|
-
verbosity:
|
|
23
|
+
...V !== void 0 && { disableAutoFetch: V },
|
|
24
|
+
...x !== void 0 && { disableStream: x },
|
|
25
|
+
...C !== void 0 && { rangeChunkSize: C },
|
|
26
|
+
verbosity: A.ERRORS
|
|
27
27
|
};
|
|
28
28
|
try {
|
|
29
|
-
const e =
|
|
29
|
+
const e = F(R);
|
|
30
30
|
e.onProgress = (o) => {
|
|
31
|
-
if (r ===
|
|
31
|
+
if (r === d.current) {
|
|
32
32
|
const { loaded: y, total: l } = o, L = l ? Math.min(100, Math.round(y / l * 100)) : 0;
|
|
33
33
|
g(L);
|
|
34
34
|
}
|
|
35
35
|
}, T(!0);
|
|
36
|
-
const t = e.promise.then((o) => (r ===
|
|
36
|
+
const t = e.promise.then((o) => (r === d.current && (h(o), g(100)), E && E(o), w(!1), c(""), o)).catch((o) => {
|
|
37
37
|
o instanceof Error && o.name === "PasswordException" ? (w(!0), c(o.message || "Password required")) : o instanceof Error && o.name === "InvalidPDFException" && u ? (w(!0), c("Incorrect password")) : i && i(o);
|
|
38
38
|
}).finally(() => {
|
|
39
39
|
T(!1);
|
|
@@ -44,7 +44,7 @@ const Y = (m, s, h = {}) => {
|
|
|
44
44
|
});
|
|
45
45
|
};
|
|
46
46
|
} catch (e) {
|
|
47
|
-
|
|
47
|
+
N(z.NOT_SUPPORTED), i && i(e);
|
|
48
48
|
}
|
|
49
49
|
}, [m, v, u, i, E]), k(() => {
|
|
50
50
|
if (p)
|
|
@@ -61,7 +61,7 @@ const Y = (m, s, h = {}) => {
|
|
|
61
61
|
}
|
|
62
62
|
Promise.all(e).then((t) => {
|
|
63
63
|
t.map((o) => {
|
|
64
|
-
const { thumbnailViewport: y, scale: l } =
|
|
64
|
+
const { thumbnailViewport: y, scale: l } = _(o), L = o.getViewport();
|
|
65
65
|
r.set(o.pageNumber, {
|
|
66
66
|
page: o,
|
|
67
67
|
thumbnailViewport: y,
|
|
@@ -72,14 +72,14 @@ const Y = (m, s, h = {}) => {
|
|
|
72
72
|
});
|
|
73
73
|
}, [n, P, p]), {
|
|
74
74
|
pdf: n,
|
|
75
|
-
pages:
|
|
75
|
+
pages: q,
|
|
76
76
|
loading: P,
|
|
77
|
-
error:
|
|
77
|
+
error: D,
|
|
78
78
|
loadingProgress: f,
|
|
79
79
|
passwordRequired: p,
|
|
80
|
-
passwordError:
|
|
80
|
+
passwordError: O
|
|
81
81
|
};
|
|
82
82
|
};
|
|
83
83
|
export {
|
|
84
|
-
|
|
84
|
+
$ as useLoadPdf
|
|
85
85
|
};
|