@react-pdf-kit/viewer 2.0.0-beta.4 → 2.0.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/{ToolbarLayout.module-692ae41a.js → ToolbarLayout.module-b9afb430.js} +9 -8
- package/dist/assets/style.js +32 -31
- package/dist/components/RPConfig.js +1 -1
- package/dist/components/RPController.js +5 -5
- package/dist/components/RPDropFileZone.js +1 -1
- package/dist/components/RPPages.js +5 -5
- package/dist/components/RPProvider.js +5 -5
- package/dist/components/layout/LayoutContainer.js +5 -5
- package/dist/components/layout/RPDefaultLayout.js +5 -5
- package/dist/components/layout/RPLayout.js +5 -5
- package/dist/components/layout/WrapperLayout.js +1 -1
- package/dist/components/layout/sidebar/RPSidebar.js +5 -5
- package/dist/components/layout/sidebar/Thumbnail.js +5 -5
- package/dist/components/layout/sidebar/Thumbnails.js +5 -5
- package/dist/components/layout/toolbar/DarkModeTool.js +2 -2
- package/dist/components/layout/toolbar/DocumentDialog.js +5 -5
- package/dist/components/layout/toolbar/DocumentProperties.js +3 -3
- package/dist/components/layout/toolbar/FileDownloadTool.js +5 -5
- package/dist/components/layout/toolbar/FileUploadTool.js +4 -4
- package/dist/components/layout/toolbar/FullScreenTool.js +3 -3
- package/dist/components/layout/toolbar/MenuItem.js +3 -3
- package/dist/components/layout/toolbar/MenuSeparator.js +3 -3
- package/dist/components/layout/toolbar/MostPageTool.js +5 -5
- package/dist/components/layout/toolbar/OtherTool.js +5 -5
- package/dist/components/layout/toolbar/Paginate.js +5 -5
- package/dist/components/layout/toolbar/PrintTool.js +5 -5
- package/dist/components/layout/toolbar/RPMenuItem.js +3 -3
- package/dist/components/layout/toolbar/RPMoreOptions.js +5 -5
- package/dist/components/layout/toolbar/RPToolbar.js +5 -5
- package/dist/components/layout/toolbar/RPToolbarEnd.js +5 -5
- package/dist/components/layout/toolbar/RotateTool.js +4 -4
- package/dist/components/layout/toolbar/ScrollModeTool.js +3 -3
- package/dist/components/layout/toolbar/SearchCloseButton.js +2 -2
- package/dist/components/layout/toolbar/SearchResultNavigator.js +5 -5
- package/dist/components/layout/toolbar/SearchTool.js +5 -5
- package/dist/components/layout/toolbar/SelectionModeTool.js +3 -3
- package/dist/components/layout/toolbar/ThumbnailTool.js +5 -5
- package/dist/components/layout/toolbar/ToolbarCustom.js +5 -5
- package/dist/components/layout/toolbar/ToolbarDefault.js +5 -5
- package/dist/components/layout/toolbar/ToolbarLayout.js +5 -5
- package/dist/components/layout/toolbar/ViewModeTool.js +3 -3
- package/dist/components/layout/toolbar/ZoomTool.js +5 -5
- package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +5 -5
- package/dist/components/layout/toolbar/tools/DualPageTool.js +5 -5
- package/dist/components/layout/toolbar/tools/FileDownloadTool.js +5 -5
- package/dist/components/layout/toolbar/tools/FileUploadTool.js +3 -3
- package/dist/components/layout/toolbar/tools/FullScreenTool.js +2 -2
- package/dist/components/layout/toolbar/tools/InputPageTool.js +5 -5
- package/dist/components/layout/toolbar/tools/NextPageTool.js +5 -5
- package/dist/components/layout/toolbar/tools/PreviousPageTool.js +5 -5
- package/dist/components/layout/toolbar/tools/PrintTool.js +5 -5
- package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +3 -3
- package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +3 -3
- package/dist/components/layout/toolbar/tools/SelectionModeSwitcherTool.js +2 -2
- package/dist/components/layout/toolbar/tools/SinglePageTool.js +5 -5
- package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +2 -2
- package/dist/components/layout/toolbar/tools/ThumbnailTool.js +5 -5
- package/dist/components/layout/toolbar/tools/ZoomInTool.js +3 -3
- package/dist/components/layout/toolbar/tools/ZoomLevelDisplay.js +5 -5
- package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +5 -5
- package/dist/components/layout/toolbar/tools/ZoomOutTool.js +3 -3
- package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +5 -5
- package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +5 -5
- package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +3 -3
- package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +5 -5
- package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +5 -5
- package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +3 -3
- package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +5 -5
- package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +5 -5
- package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +4 -4
- package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +3 -3
- package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +3 -3
- package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +3 -3
- package/dist/components/page/AnnotationLayer.js +5 -5
- package/dist/components/page/CanvasLayer.js +5 -5
- package/dist/components/page/CustomElement.js +1 -1
- package/dist/components/page/DualPage.js +5 -5
- package/dist/components/page/RPPage.js +5 -5
- package/dist/components/page/SinglePage.js +5 -5
- package/dist/components/page/TextHighlightLayer.js +5 -5
- package/dist/components/page/TextLayer.js +5 -5
- package/dist/components/ui/Checkbox.js +1 -1
- package/dist/components/ui/DropDown.js +3 -3
- package/dist/components/ui/LoadingIndicator.js +5 -5
- package/dist/components/ui/RPTooltip.js +102 -118
- 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 +5 -5
- package/dist/contexts/PrintContext.js +5 -5
- package/dist/contexts/RPDocumentContext.js +1 -1
- package/dist/contexts/RenderQueueProvider.js +5 -5
- package/dist/contexts/RotationContext.js +1 -1
- package/dist/contexts/SearchContext.js +5 -5
- package/dist/contexts/ThumbnailsContext.js +5 -5
- package/dist/contexts/ZoomContext.js +1 -1
- package/dist/{floating-ui.react-dom-d22a10b4.js → floating-ui.react-dom-6b2fe0df.js} +3 -3
- package/dist/{index-c9a2990a.js → index-35c7f4a2.js} +3 -3
- package/dist/{index-3bf64864.js → index-f563c6f0.js} +100 -97
- package/dist/main.js +17 -16
- package/dist/types/main.d.ts +1 -0
- package/dist/types/utils/annotations.d.ts +1 -0
- package/dist/types/utils/hooks/useLoadWorker.d.ts +15 -0
- package/dist/utils/annotations.js +137 -106
- package/dist/utils/hooks/useFileDownload.js +5 -5
- package/dist/utils/hooks/useLicense.js +1 -1
- package/dist/utils/hooks/useLoadPdf.js +23 -23
- package/dist/utils/hooks/useLoadWorker.js +12 -10
- package/dist/utils/hooks/usePageRotateContext.js +1 -1
- package/dist/utils/hooks/usePaginate.js +5 -5
- package/dist/utils/hooks/usePinch.js +1 -1
- package/dist/utils/hooks/usePresentPage.js +5 -5
- package/dist/utils/hooks/usePrint.js +5 -5
- package/dist/utils/hooks/useRotate.js +1 -1
- package/dist/utils/hooks/useScrollToPage.js +5 -5
- package/dist/utils/hooks/useSearch.js +5 -5
- package/dist/utils/hooks/useThumbnail.js +5 -5
- package/dist/utils/hooks/useVirtualReactWindow.js +5 -5
- package/dist/utils/renderPage.js +4 -4
- package/package.json +2 -1
- package/dist/pdf-ba2a5710.js +0 -17940
package/dist/main.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RPProvider as kr } from "./components/RPProvider.js";
|
|
2
|
-
import { a as Br, R as Hr, S as Ir, b as Or, u as
|
|
3
|
-
import { RPConfig as
|
|
2
|
+
import { a as Br, R as Hr, S as Ir, b as Or, u as jr, c as zr, d as Er } from "./ToolbarLayout.module-b9afb430.js";
|
|
3
|
+
import { RPConfig as Ur } from "./components/RPConfig.js";
|
|
4
4
|
import { RPLayout as Ar } from "./components/layout/RPLayout.js";
|
|
5
5
|
import { RPTheme as Jr } from "./components/RPTheme.js";
|
|
6
6
|
import { useDarkModeContext as Qr } from "./contexts/DarkModeContext.js";
|
|
@@ -14,6 +14,7 @@ import { useHighlightContext as lt } from "./contexts/HighlightContext.js";
|
|
|
14
14
|
import { useFullScreenContext as ft } from "./contexts/FullScreenContext.js";
|
|
15
15
|
import { usePageRotateContext as st } from "./utils/hooks/usePageRotateContext.js";
|
|
16
16
|
import { useElementPageContext as Tt } from "./contexts/ElementPageContext.js";
|
|
17
|
+
import * as o from "pdfjs-dist";
|
|
17
18
|
import { ThemeSwitcherTool as ct } from "./components/layout/toolbar/tools/ThemeSwitcherTool.js";
|
|
18
19
|
import { ThumbnailTool as gt } from "./components/layout/toolbar/tools/ThumbnailTool.js";
|
|
19
20
|
import { FileUploadTool as dt } from "./components/layout/toolbar/tools/FileUploadTool.js";
|
|
@@ -25,9 +26,9 @@ import { NextPageTool as Vt } from "./components/layout/toolbar/tools/NextPageTo
|
|
|
25
26
|
import { InputPageTool as kt } from "./components/layout/toolbar/tools/InputPageTool.js";
|
|
26
27
|
import { ZoomInTool as Bt } from "./components/layout/toolbar/tools/ZoomInTool.js";
|
|
27
28
|
import { ZoomOutTool as It } from "./components/layout/toolbar/tools/ZoomOutTool.js";
|
|
28
|
-
import { ZoomLevelTool as
|
|
29
|
-
import { DocumentPropertiesTool as
|
|
30
|
-
import { RotateClockwiseTool as
|
|
29
|
+
import { ZoomLevelTool as jt } from "./components/layout/toolbar/tools/ZoomLevelTool.js";
|
|
30
|
+
import { DocumentPropertiesTool as Et } from "./components/layout/toolbar/tools/DocumentPropertiesTool.js";
|
|
31
|
+
import { RotateClockwiseTool as Ut } from "./components/layout/toolbar/tools/RotateClockwiseTool.js";
|
|
31
32
|
import { RotateCounterclockwiseTool as At } from "./components/layout/toolbar/tools/RotateCounterclockwiseTool.js";
|
|
32
33
|
import { RPHorizontalBar as Jt } from "./components/layout/toolbar/tools/defaults/RPHorizontalBar.js";
|
|
33
34
|
import { RPVerticalBar as Qt } from "./components/layout/toolbar/tools/defaults/RPVerticalBar.js";
|
|
@@ -78,7 +79,6 @@ import "./utils/highlight.js";
|
|
|
78
79
|
import "./utils/charators.js";
|
|
79
80
|
import "./utils/Queue.js";
|
|
80
81
|
import "./utils/renderPage.js";
|
|
81
|
-
import "./pdf-ba2a5710.js";
|
|
82
82
|
import "./contexts/ThemeContext.js";
|
|
83
83
|
import "./contexts/ConfigContext.js";
|
|
84
84
|
import "./components/icons/Thumbnail.js";
|
|
@@ -93,15 +93,15 @@ import "./components/icons/DarkPdfIcon.js";
|
|
|
93
93
|
import "./LayoutWrapper-6224491f.js";
|
|
94
94
|
import "./SearchCloseButton-08d57275.js";
|
|
95
95
|
import "./components/ui/RPTooltip.js";
|
|
96
|
-
import "./index-
|
|
96
|
+
import "./index-35c7f4a2.js";
|
|
97
97
|
import "react-dom";
|
|
98
|
-
import "./floating-ui.react-dom-
|
|
98
|
+
import "./floating-ui.react-dom-6b2fe0df.js";
|
|
99
99
|
import "./components/icons/CloseIcon.js";
|
|
100
100
|
import "./components/ui/Checkbox.js";
|
|
101
101
|
import "./components/icons/CheckIcon.js";
|
|
102
102
|
import "./contexts/IconContext.js";
|
|
103
103
|
import "./components/ui/DropDown.js";
|
|
104
|
-
import "./index-
|
|
104
|
+
import "./index-f563c6f0.js";
|
|
105
105
|
import "./components/layout/toolbar/MenuItem.js";
|
|
106
106
|
import "./components/layout/toolbar/MenuSeparator.js";
|
|
107
107
|
import "./utils/dateFormatter.js";
|
|
@@ -173,7 +173,7 @@ import "./utils/getElementPositionInPage.js";
|
|
|
173
173
|
import "./components/icons/ChevronDownIcon.js";
|
|
174
174
|
import "./components/layout/toolbar/ThumbnailTool.js";
|
|
175
175
|
export {
|
|
176
|
-
|
|
176
|
+
Et as DocumentPropertiesTool,
|
|
177
177
|
om as DualPageTool,
|
|
178
178
|
ht as FileDownloadTool,
|
|
179
179
|
dt as FileUploadTool,
|
|
@@ -183,7 +183,7 @@ export {
|
|
|
183
183
|
Vt as NextPageTool,
|
|
184
184
|
Lt as PreviousPageTool,
|
|
185
185
|
Dt as PrintTool,
|
|
186
|
-
|
|
186
|
+
Ur as RPConfig,
|
|
187
187
|
Br as RPDefaultLayout,
|
|
188
188
|
Jt as RPHorizontalBar,
|
|
189
189
|
Ar as RPLayout,
|
|
@@ -191,7 +191,7 @@ export {
|
|
|
191
191
|
kr as RPProvider,
|
|
192
192
|
Jr as RPTheme,
|
|
193
193
|
Qt as RPVerticalBar,
|
|
194
|
-
|
|
194
|
+
Ut as RotateClockwiseTool,
|
|
195
195
|
At as RotateCounterclockwiseTool,
|
|
196
196
|
mm as ScrollMode,
|
|
197
197
|
Ir as SearchTool,
|
|
@@ -204,8 +204,9 @@ export {
|
|
|
204
204
|
em as ViewMode,
|
|
205
205
|
Bt as ZoomInTool,
|
|
206
206
|
xm as ZoomLevel,
|
|
207
|
-
|
|
207
|
+
jt as ZoomLevelTool,
|
|
208
208
|
It as ZoomOutTool,
|
|
209
|
+
o as pdfjs,
|
|
209
210
|
Qr as useDarkModeContext,
|
|
210
211
|
Xr as useDocumentContext,
|
|
211
212
|
tt as useDropFileZoneContext,
|
|
@@ -215,10 +216,10 @@ export {
|
|
|
215
216
|
lt as useHighlightContext,
|
|
216
217
|
pt as useOpenFileContext,
|
|
217
218
|
st as usePageRotateContext,
|
|
218
|
-
|
|
219
|
-
|
|
219
|
+
jr as usePaginationContext,
|
|
220
|
+
zr as usePrintContext,
|
|
220
221
|
_r as useRotationContext,
|
|
221
|
-
|
|
222
|
+
Er as useSearchContext,
|
|
222
223
|
ot as useViewModeContext,
|
|
223
224
|
et as useZoomContext
|
|
224
225
|
};
|
package/dist/types/main.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export { useFullScreenContext } from './contexts/FullScreenContext';
|
|
|
20
20
|
export { usePageRotateContext } from './utils/hooks/usePageRotateContext';
|
|
21
21
|
export { useElementPageContext } from './contexts/ElementPageContext';
|
|
22
22
|
export { type PDFDocumentProxy } from 'pdfjs-dist';
|
|
23
|
+
export * as pdfjs from 'pdfjs-dist';
|
|
23
24
|
export { SearchTool } from '../lib/components/layout/toolbar/SearchTool';
|
|
24
25
|
export { ThemeSwitcherTool } from './components/layout/toolbar/tools/ThemeSwitcherTool';
|
|
25
26
|
export { ThumbnailTool } from './components/layout/toolbar/tools/ThumbnailTool';
|
|
@@ -5,4 +5,5 @@ export declare function bindLayerEvents(annotatedLayer: HTMLDivElement, handler:
|
|
|
5
5
|
export declare function unbindLayerEvents(annotatedLayer: HTMLDivElement, handler: (event: Event) => void): void;
|
|
6
6
|
export declare function handleAnnotationLink(annotation: Annotation): void;
|
|
7
7
|
export declare function handleAnnotationWidget(annotation: Annotation, viewport: PageViewport, canvasMap: Map<string, HTMLCanvasElement>): void;
|
|
8
|
+
export declare function handleAriaHasPopup(targetElement: HTMLElement): void;
|
|
8
9
|
export declare function annotationEventsHandler(evt: Event, PDFDoc: PDFDocumentProxy, Annotations: Object[]): Promise<AnnotationEventPayload | undefined>;
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook to configure the PDF.js worker URL.
|
|
3
|
+
*
|
|
4
|
+
* For Next.js 14 compatibility, users should configure the worker in their own code:
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { pdfjs } from '@react-pdf-kit/viewer'
|
|
7
|
+
*
|
|
8
|
+
* pdfjs.GlobalWorkerOptions.workerSrc = new URL(
|
|
9
|
+
* 'pdfjs-dist/build/pdf.worker.min.mjs',
|
|
10
|
+
* import.meta.url,
|
|
11
|
+
* ).toString();
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* The workerUrl prop can still be used to override the worker URL if needed.
|
|
15
|
+
*/
|
|
1
16
|
export declare const useLoadWorker: (workerUrl?: string) => {
|
|
2
17
|
workerUrlAdded: boolean;
|
|
3
18
|
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { sanitizeExternalUrl as
|
|
1
|
+
import { sanitizeExternalUrl as I } from "./sanitizeExternalUrl.js";
|
|
2
2
|
import { AnnotationType as l } from "./types.js";
|
|
3
|
-
import { dateFormatter as
|
|
3
|
+
import { dateFormatter as B } from "./dateFormatter.js";
|
|
4
4
|
import "../th_TH-d627cd51.js";
|
|
5
|
-
const
|
|
6
|
-
function
|
|
7
|
-
const
|
|
8
|
-
return
|
|
5
|
+
const v = ["click", "dblclick", "input", "change", "mouseover"], g = /* @__PURE__ */ new Map(), x = (e, t) => `${e.loadingTask.docId}___${t.num}R${t.gen === 0 ? "" : t.gen}`;
|
|
6
|
+
function C(e, t) {
|
|
7
|
+
const n = x(e, t);
|
|
8
|
+
return g.has(n) ? g.get(n) ?? null : null;
|
|
9
9
|
}
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
switch (
|
|
10
|
+
const S = (e, t, n) => {
|
|
11
|
+
g.set(x(e, t), n);
|
|
12
|
+
}, T = (e, t) => {
|
|
13
|
+
switch (t[1].name) {
|
|
14
14
|
case "XYZ":
|
|
15
15
|
return {
|
|
16
|
-
bottomOffset: (
|
|
17
|
-
leftOffset: (
|
|
16
|
+
bottomOffset: (n, s) => t[3] === null ? s : t[3],
|
|
17
|
+
leftOffset: (n, s) => t[2] === null ? 0 : t[2],
|
|
18
18
|
pageIndex: e,
|
|
19
|
-
scaleTo:
|
|
19
|
+
scaleTo: t[4]
|
|
20
20
|
};
|
|
21
21
|
case "Fit":
|
|
22
22
|
case "FitB":
|
|
@@ -29,7 +29,7 @@ const v = (e, s, t) => {
|
|
|
29
29
|
case "FitH":
|
|
30
30
|
case "FitBH":
|
|
31
31
|
return {
|
|
32
|
-
bottomOffset:
|
|
32
|
+
bottomOffset: t[2],
|
|
33
33
|
leftOffset: 0,
|
|
34
34
|
pageIndex: e,
|
|
35
35
|
scaleTo: 1
|
|
@@ -42,76 +42,106 @@ const v = (e, s, t) => {
|
|
|
42
42
|
scaleTo: 1
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
},
|
|
45
|
+
}, M = (e) => {
|
|
46
46
|
e && (() => {
|
|
47
|
-
const
|
|
47
|
+
const n = e == null ? void 0 : e.querySelectorAll(
|
|
48
48
|
'[data-l10n-id="pdfjs-annotation-date-time-string"]'
|
|
49
49
|
);
|
|
50
|
-
|
|
51
|
-
const { date: a, time: o, dateObj: i } = JSON.parse(
|
|
52
|
-
a && o ?
|
|
50
|
+
n == null || n.forEach((s) => {
|
|
51
|
+
const { date: a, time: o, dateObj: i } = JSON.parse(s.dataset.l10nArgs ?? "{}");
|
|
52
|
+
a && o ? s.textContent = `${a}, ${o}` : i && (s.textContent = B(i));
|
|
53
53
|
});
|
|
54
54
|
})();
|
|
55
55
|
};
|
|
56
|
-
async function
|
|
57
|
-
let
|
|
58
|
-
if (typeof
|
|
59
|
-
const
|
|
56
|
+
async function E(e, t) {
|
|
57
|
+
let n;
|
|
58
|
+
if (typeof t == "string" ? n = await e.getDestination(t) : n = t, n && typeof n[0] == "object" && n[0] !== null) {
|
|
59
|
+
const s = n[0], a = C(e, s);
|
|
60
60
|
if (a === null) {
|
|
61
|
-
const o = await e.getPageIndex(
|
|
62
|
-
return
|
|
61
|
+
const o = await e.getPageIndex(s);
|
|
62
|
+
return S(e, s, o), await E(e, n);
|
|
63
63
|
} else
|
|
64
|
-
return
|
|
64
|
+
return T(a, n);
|
|
65
65
|
} else
|
|
66
|
-
return
|
|
66
|
+
return T(n[0], n);
|
|
67
67
|
}
|
|
68
|
-
function
|
|
69
|
-
for (const
|
|
70
|
-
e.addEventListener(
|
|
68
|
+
function P(e, t) {
|
|
69
|
+
for (const n of v)
|
|
70
|
+
e.addEventListener(n, t);
|
|
71
71
|
}
|
|
72
|
-
function
|
|
73
|
-
for (const
|
|
74
|
-
e.removeEventListener(
|
|
72
|
+
function $(e, t) {
|
|
73
|
+
for (const n of v)
|
|
74
|
+
e.removeEventListener(n, t);
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
const { id:
|
|
76
|
+
function D(e) {
|
|
77
|
+
const { id: t, url: n, unsafeUrl: s } = e;
|
|
78
78
|
new MutationObserver((o, i) => {
|
|
79
|
-
const c = document.querySelector(`[data-annotation-id="${
|
|
79
|
+
const c = document.querySelector(`[data-annotation-id="${t}"]`);
|
|
80
80
|
if (c) {
|
|
81
|
-
const r = c.querySelector("a"),
|
|
82
|
-
r && (r == null || r.setAttribute("target", "_blank"), r == null || r.setAttribute("href",
|
|
81
|
+
const r = c.querySelector("a"), p = I((n || s) ?? "", "");
|
|
82
|
+
r && (r == null || r.setAttribute("target", "_blank"), r == null || r.setAttribute("href", p), r == null || r.setAttribute("rel", "noopener noreferrer")), i.disconnect();
|
|
83
83
|
}
|
|
84
84
|
}).observe(document.body, { childList: !0, subtree: !0 });
|
|
85
85
|
}
|
|
86
|
-
function
|
|
87
|
-
const { rotation:
|
|
86
|
+
function U(e, t, n) {
|
|
87
|
+
const { rotation: s, scale: a } = t, o = s % 180 === 0;
|
|
88
88
|
if (e.fieldType === "Btn" && e.pushButton) {
|
|
89
89
|
const i = e.rect[2] - e.rect[0], c = e.rect[3] - e.rect[1], r = document.createElement("canvas");
|
|
90
|
-
r.setAttribute("width", ((o ? i : c) * a).toString()), r.setAttribute("height", ((o ? c : i) * a).toString()),
|
|
90
|
+
r.setAttribute("width", ((o ? i : c) * a).toString()), r.setAttribute("height", ((o ? c : i) * a).toString()), n.set(e.id, r);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
93
|
+
function V(e) {
|
|
94
|
+
var o;
|
|
95
|
+
let t = e;
|
|
96
|
+
for (; t.tagName !== "SECTION"; )
|
|
97
|
+
t = t.parentElement;
|
|
98
|
+
const n = t.getAttribute("aria-haspopup") === "dialog", s = t.classList.contains("popupAnnotation");
|
|
99
|
+
if (!n && !s)
|
|
100
|
+
return;
|
|
101
|
+
let a = t.id || t.getAttribute("aria-controls");
|
|
102
|
+
if (a || (a = (o = t.firstChild) == null ? void 0 : o.id), a && t.parentElement) {
|
|
103
|
+
const i = t.parentElement.querySelector(`[aria-controls="${a}"]`);
|
|
104
|
+
i && new MutationObserver((r, p) => {
|
|
105
|
+
const b = document.querySelectorAll(".popupDate");
|
|
106
|
+
b.length > 0 && (b.forEach((m) => {
|
|
107
|
+
if (m.innerHTML)
|
|
108
|
+
return !1;
|
|
109
|
+
const N = m.getAttribute("data-l10n-args");
|
|
110
|
+
if (N) {
|
|
111
|
+
const { date: h, time: O, dateObj: A } = JSON.parse(N);
|
|
112
|
+
if (h && O)
|
|
113
|
+
m.textContent = `${h}, ${O}`;
|
|
114
|
+
else if (A) {
|
|
115
|
+
const _ = new Date(A);
|
|
116
|
+
m.textContent = _.toLocaleString();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}), p.disconnect());
|
|
120
|
+
}).observe(i, { childList: !0, subtree: !0 });
|
|
121
|
+
}
|
|
99
122
|
}
|
|
100
|
-
function
|
|
101
|
-
|
|
123
|
+
function d(e, t, n) {
|
|
124
|
+
const s = [];
|
|
125
|
+
if (n)
|
|
126
|
+
for (const a of n)
|
|
127
|
+
a[e] === t && s.push(a);
|
|
128
|
+
return s;
|
|
102
129
|
}
|
|
103
|
-
|
|
130
|
+
function u(e, t) {
|
|
131
|
+
return { type: e, data: t };
|
|
132
|
+
}
|
|
133
|
+
async function k(e, t) {
|
|
104
134
|
if (e.dest)
|
|
105
135
|
if (typeof e.dest == "string") {
|
|
106
|
-
const
|
|
136
|
+
const n = await E(t, e.dest);
|
|
107
137
|
return u(l.INTERNAL_LINK, {
|
|
108
|
-
referencedPage:
|
|
138
|
+
referencedPage: n.pageIndex,
|
|
109
139
|
offset: null
|
|
110
140
|
});
|
|
111
141
|
} else {
|
|
112
|
-
const
|
|
142
|
+
const n = await t.getPageIndex(e.dest[0]);
|
|
113
143
|
return u(l.INTERNAL_LINK, {
|
|
114
|
-
referencedPage:
|
|
144
|
+
referencedPage: n,
|
|
115
145
|
offset: {
|
|
116
146
|
left: e.dest[2],
|
|
117
147
|
bottom: e.dest[3]
|
|
@@ -124,20 +154,20 @@ async function _(e, s) {
|
|
|
124
154
|
unsafeUrl: e.unsafeUrl
|
|
125
155
|
});
|
|
126
156
|
}
|
|
127
|
-
function
|
|
128
|
-
for (const
|
|
129
|
-
let
|
|
130
|
-
const
|
|
131
|
-
if (
|
|
132
|
-
for (const a in
|
|
133
|
-
|
|
134
|
-
|
|
157
|
+
function y(e) {
|
|
158
|
+
for (const t of e.getElementsByTagName("span")) {
|
|
159
|
+
let n = t.textContent;
|
|
160
|
+
const s = JSON.parse(t.dataset.l10nArgs ?? "{}");
|
|
161
|
+
if (n)
|
|
162
|
+
for (const a in s)
|
|
163
|
+
n = n.replace(`{{${a}}}`, s[a]);
|
|
164
|
+
t.textContent = n;
|
|
135
165
|
}
|
|
136
166
|
}
|
|
137
|
-
function
|
|
167
|
+
function w(e) {
|
|
138
168
|
return u(l.FILE_ATTACHMENT, e.file);
|
|
139
169
|
}
|
|
140
|
-
function f(e,
|
|
170
|
+
function f(e, t) {
|
|
141
171
|
switch (e.type) {
|
|
142
172
|
case "textarea":
|
|
143
173
|
case "text":
|
|
@@ -147,22 +177,22 @@ function f(e, s) {
|
|
|
147
177
|
});
|
|
148
178
|
case "select-one":
|
|
149
179
|
case "select-multiple":
|
|
150
|
-
const
|
|
180
|
+
const n = [];
|
|
151
181
|
for (const a of e.options)
|
|
152
|
-
|
|
182
|
+
n.push({
|
|
153
183
|
value: a.value,
|
|
154
184
|
label: a.label
|
|
155
185
|
});
|
|
156
|
-
const
|
|
186
|
+
const s = [];
|
|
157
187
|
for (const a of e.selectedOptions)
|
|
158
|
-
|
|
188
|
+
s.push({
|
|
159
189
|
value: a.value,
|
|
160
190
|
label: a.label
|
|
161
191
|
});
|
|
162
192
|
return u(l.FORM_SELECT, {
|
|
163
193
|
fieldName: e.name,
|
|
164
|
-
value:
|
|
165
|
-
options:
|
|
194
|
+
value: s,
|
|
195
|
+
options: n
|
|
166
196
|
});
|
|
167
197
|
case "checkbox":
|
|
168
198
|
return u(l.FORM_CHECKBOX, {
|
|
@@ -172,64 +202,64 @@ function f(e, s) {
|
|
|
172
202
|
case "radio":
|
|
173
203
|
return u(l.FORM_RADIO, {
|
|
174
204
|
fieldName: e.name,
|
|
175
|
-
...
|
|
205
|
+
...t
|
|
176
206
|
});
|
|
177
207
|
case "button":
|
|
178
208
|
return u(l.FORM_BUTTON, {
|
|
179
209
|
fieldName: e.name,
|
|
180
|
-
...
|
|
210
|
+
...t
|
|
181
211
|
});
|
|
182
212
|
}
|
|
183
213
|
}
|
|
184
|
-
async function
|
|
214
|
+
async function j(e, t, n) {
|
|
185
215
|
var a;
|
|
186
|
-
let
|
|
187
|
-
if (
|
|
188
|
-
if (
|
|
189
|
-
const o = (a =
|
|
216
|
+
let s = e.target.parentNode;
|
|
217
|
+
if (s.tagName === "DIV" && (s = s.firstChild), typeof s.className != "object")
|
|
218
|
+
if (s.className === "linkAnnotation" && e.type === "click") {
|
|
219
|
+
const o = (a = s.dataset) == null ? void 0 : a.annotationId;
|
|
190
220
|
if (o) {
|
|
191
|
-
const i = d("id", o,
|
|
221
|
+
const i = d("id", o, n);
|
|
192
222
|
if (i.length)
|
|
193
|
-
return await
|
|
223
|
+
return await k(i[0], t);
|
|
194
224
|
}
|
|
195
225
|
} else if (
|
|
196
226
|
/* annotation.className.includes('popupAnnotation') || */
|
|
197
|
-
|
|
227
|
+
s.className.includes("textAnnotation")
|
|
198
228
|
)
|
|
199
|
-
|
|
200
|
-
else if (
|
|
201
|
-
|
|
202
|
-
const o =
|
|
229
|
+
y(s);
|
|
230
|
+
else if (s.className.includes("fileAttachmentAnnotation")) {
|
|
231
|
+
y(s);
|
|
232
|
+
const o = s.dataset.annotationId;
|
|
203
233
|
if (o && e.type === "dblclick")
|
|
204
|
-
return
|
|
205
|
-
} else if (
|
|
206
|
-
let o =
|
|
207
|
-
return o || (o =
|
|
234
|
+
return w(d("id", o, n)[0]);
|
|
235
|
+
} else if (s.className.includes("textWidgetAnnotation") && e.type === "input") {
|
|
236
|
+
let o = s.getElementsByTagName("input")[0];
|
|
237
|
+
return o || (o = s.getElementsByTagName("textarea")[0]), f(o);
|
|
208
238
|
} else {
|
|
209
|
-
if (
|
|
210
|
-
return f(
|
|
211
|
-
if (
|
|
212
|
-
return f(
|
|
213
|
-
if (
|
|
214
|
-
const o =
|
|
239
|
+
if (s.className.includes("choiceWidgetAnnotation") && e.type === "input")
|
|
240
|
+
return f(s.getElementsByTagName("select")[0]);
|
|
241
|
+
if (s.className.includes("buttonWidgetAnnotation checkBox") && e.type === "change")
|
|
242
|
+
return f(s.getElementsByTagName("input")[0]);
|
|
243
|
+
if (s.className.includes("buttonWidgetAnnotation radioButton") && e.type === "change") {
|
|
244
|
+
const o = s.dataset.annotationId;
|
|
215
245
|
if (o) {
|
|
216
|
-
const i = d("id", o,
|
|
246
|
+
const i = d("id", o, n)[0], c = [];
|
|
217
247
|
for (const r of d(
|
|
218
248
|
"fieldName",
|
|
219
249
|
i.fieldName,
|
|
220
|
-
|
|
250
|
+
n
|
|
221
251
|
))
|
|
222
252
|
r.buttonValue && c.push(r.buttonValue);
|
|
223
|
-
return f(
|
|
253
|
+
return f(s.getElementsByTagName("input")[0], {
|
|
224
254
|
value: i.buttonValue,
|
|
225
255
|
defaultValue: i.fieldValue,
|
|
226
256
|
options: c
|
|
227
257
|
});
|
|
228
258
|
}
|
|
229
|
-
} else if (
|
|
230
|
-
const o =
|
|
259
|
+
} else if (s.className.includes("buttonWidgetAnnotation pushButton") && e.type === "click") {
|
|
260
|
+
const o = s.dataset.annotationId;
|
|
231
261
|
if (o) {
|
|
232
|
-
const i = d("id", o,
|
|
262
|
+
const i = d("id", o, n)[0], { action: c } = i;
|
|
233
263
|
return c && ["Print", "SaveAs"].includes(c) ? { type: l.BUTTON, data: i } : i.resetForm ? f(
|
|
234
264
|
{ name: i.fieldName, type: "button" },
|
|
235
265
|
{ actions: i.actions, reset: !0 }
|
|
@@ -242,10 +272,11 @@ async function S(e, s, t) {
|
|
|
242
272
|
}
|
|
243
273
|
}
|
|
244
274
|
export {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
275
|
+
j as annotationEventsHandler,
|
|
276
|
+
P as bindLayerEvents,
|
|
277
|
+
D as handleAnnotationLink,
|
|
278
|
+
U as handleAnnotationWidget,
|
|
279
|
+
V as handleAriaHasPopup,
|
|
280
|
+
M as insertDateText,
|
|
281
|
+
$ as unbindLayerEvents
|
|
251
282
|
};
|
|
@@ -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-b9afb430.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 "pdfjs-dist";
|
|
37
37
|
import "../../components/layout/Container.js";
|
|
38
38
|
import "../../contexts/ViewportContext.js";
|
|
39
39
|
import "../../contexts/ToolbarComponentContext.js";
|
|
@@ -95,10 +95,10 @@ import "../getWordPositionInPage.js";
|
|
|
95
95
|
import "../smoothScrollTo.js";
|
|
96
96
|
import "../../components/layout/toolbar/FileUploadTool.js";
|
|
97
97
|
import "../../components/icons/FileUploadDefaultIcon.js";
|
|
98
|
-
import "../../index-
|
|
99
|
-
import "../../index-
|
|
98
|
+
import "../../index-f563c6f0.js";
|
|
99
|
+
import "../../index-35c7f4a2.js";
|
|
100
100
|
import "react-dom";
|
|
101
|
-
import "../../floating-ui.react-dom-
|
|
101
|
+
import "../../floating-ui.react-dom-6b2fe0df.js";
|
|
102
102
|
import "../../components/layout/toolbar/DarkModeTool.js";
|
|
103
103
|
import "../../components/icons/MoonIcon.js";
|
|
104
104
|
import "../../components/icons/SunIcon.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-
|
|
3
|
+
const b = /* @__PURE__ */ new Date("2026-02-02T14:51:17.318Z"), 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 d, useRef as A, useEffect as k } from "react";
|
|
2
|
+
import * as I from "pdfjs-dist";
|
|
3
|
+
import { ErrorType as F } from "../types.js";
|
|
4
|
+
import { getThumbnailViewport as j } from "../getThumbnailViewport.js";
|
|
5
|
+
import { useConfigContext as z } from "../../contexts/ConfigContext.js";
|
|
6
|
+
import { useDocumentPasswordContext as _ } 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 Y = (m, s, h = {}) => {
|
|
11
|
+
const [n, q] = d(), { workerUrlAdded: v } = z(), [D, S] = d(/* @__PURE__ */ new Map()), a = A(), [f, g] = d(0), [P, T] = d(!1), [N, O] = d(), { password: u, passwordError: U, setPasswordError: c, passwordRequired: p, setPasswordRequired: w } = _(), { onLoadError: i, onLoaded: E, onLoadProgress: b, disableAutoFetch: x, disableStream: C, rangeChunkSize: V } = h;
|
|
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), a.current = Date.now();
|
|
18
|
+
const r = a.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
|
+
...x !== void 0 && { disableAutoFetch: x },
|
|
24
|
+
...C !== void 0 && { disableStream: C },
|
|
25
|
+
...V !== void 0 && { rangeChunkSize: V },
|
|
26
|
+
verbosity: I.VerbosityLevel.ERRORS
|
|
27
27
|
};
|
|
28
28
|
try {
|
|
29
|
-
const e =
|
|
29
|
+
const e = I.getDocument(R);
|
|
30
30
|
e.onProgress = (o) => {
|
|
31
|
-
if (r ===
|
|
31
|
+
if (r === a.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 === a.current && (q(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 $ = (m, s, I = {}) => {
|
|
|
44
44
|
});
|
|
45
45
|
};
|
|
46
46
|
} catch (e) {
|
|
47
|
-
|
|
47
|
+
O(F.NOT_SUPPORTED), i && i(e);
|
|
48
48
|
}
|
|
49
49
|
}, [m, v, u, i, E]), k(() => {
|
|
50
50
|
if (p)
|
|
@@ -61,7 +61,7 @@ const $ = (m, s, I = {}) => {
|
|
|
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 } = j(o), L = o.getViewport();
|
|
65
65
|
r.set(o.pageNumber, {
|
|
66
66
|
page: o,
|
|
67
67
|
thumbnailViewport: y,
|
|
@@ -72,14 +72,14 @@ const $ = (m, s, I = {}) => {
|
|
|
72
72
|
});
|
|
73
73
|
}, [n, P, p]), {
|
|
74
74
|
pdf: n,
|
|
75
|
-
pages:
|
|
75
|
+
pages: D,
|
|
76
76
|
loading: P,
|
|
77
|
-
error:
|
|
77
|
+
error: N,
|
|
78
78
|
loadingProgress: f,
|
|
79
79
|
passwordRequired: p,
|
|
80
|
-
passwordError:
|
|
80
|
+
passwordError: U
|
|
81
81
|
};
|
|
82
82
|
};
|
|
83
83
|
export {
|
|
84
|
-
|
|
84
|
+
Y as useLoadPdf
|
|
85
85
|
};
|