@react-pdf-kit/viewer 2.0.0-beta.0 → 2.0.0-beta.2
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/{LayoutWrapper-a871c161.js → LayoutWrapper-6224491f.js} +1 -1
- package/dist/{RotateTool.module-03987eba.js → RotateTool.module-67946714.js} +1 -1
- package/dist/{SearchCloseButton-cbf182aa.js → SearchCloseButton-08d57275.js} +1 -1
- package/dist/ToolbarLayout.module-3a77cc37.js +3556 -0
- package/dist/assets/style.css +1 -0
- package/dist/assets/style.js +74 -0
- package/dist/components/RPConfig.js +14 -1489
- package/dist/components/RPController.js +175 -61
- package/dist/components/RPDropFileZone.js +26 -12
- package/dist/components/RPPages.js +82 -8
- package/dist/components/RPProvider.js +173 -19
- package/dist/components/RPTheme.js +6 -5
- package/dist/components/icons/DualPageIcon.js +6 -6
- package/dist/components/icons/LoaderIcon.js +1 -1
- package/dist/components/icons/SinglePageIcon.js +6 -6
- package/dist/components/layout/Container.js +1 -1
- package/dist/components/layout/LayoutContainer.js +87 -7
- package/dist/components/layout/LayoutWrapper.js +2 -1
- package/dist/components/layout/RPDefaultLayout.js +127 -3
- package/dist/components/layout/RPLayout.js +108 -20
- package/dist/components/layout/WrapperLayout.js +22 -9
- package/dist/components/layout/sidebar/RPSidebar.js +127 -2
- package/dist/components/layout/sidebar/RPSplitter.js +1 -1
- package/dist/components/layout/sidebar/Thumbnail.js +89 -8
- package/dist/components/layout/sidebar/Thumbnails.js +134 -2
- package/dist/components/layout/toolbar/DarkModeTool.js +22 -13
- package/dist/components/layout/toolbar/DocumentDialog.js +89 -8
- package/dist/components/layout/toolbar/DocumentProperties.js +18 -8
- package/dist/components/layout/toolbar/FileDownloadTool.js +127 -2
- package/dist/components/layout/toolbar/FileUploadTool.js +31 -10
- package/dist/components/layout/toolbar/FullScreenTool.js +39 -27
- package/dist/components/layout/toolbar/MenuItem.js +12 -8
- package/dist/components/layout/toolbar/MenuSeparator.js +8 -4
- package/dist/components/layout/toolbar/MostPageTool.js +89 -9
- package/dist/components/layout/toolbar/OtherTool.js +119 -3
- package/dist/components/layout/toolbar/Paginate.js +123 -2
- package/dist/components/layout/toolbar/PrintTool.js +127 -2
- package/dist/components/layout/toolbar/PropertyItem.js +1 -1
- package/dist/components/layout/toolbar/RPMenuItem.js +20 -13
- package/dist/components/layout/toolbar/RPMoreOptions.js +169 -44
- package/dist/components/layout/toolbar/RPToolbar.js +133 -3
- package/dist/components/layout/toolbar/RPToolbarEnd.js +133 -2
- package/dist/components/layout/toolbar/RotateTool.js +39 -18
- package/dist/components/layout/toolbar/ScrollModeTool.js +27 -18
- package/dist/components/layout/toolbar/SearchCloseButton.js +11 -2
- package/dist/components/layout/toolbar/SearchResultNavigator.js +133 -3
- package/dist/components/layout/toolbar/SearchTool.js +87 -8
- package/dist/components/layout/toolbar/SelectionModeTool.js +19 -10
- package/dist/components/layout/toolbar/ThumbnailTool.js +139 -10
- package/dist/components/layout/toolbar/ToolbarCustom.js +104 -23
- package/dist/components/layout/toolbar/ToolbarDefault.js +113 -31
- package/dist/components/layout/toolbar/ToolbarLayout.js +145 -6
- package/dist/components/layout/toolbar/ViewModeTool.js +28 -19
- package/dist/components/layout/toolbar/ZoomTool.js +138 -128
- package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +137 -7
- package/dist/components/layout/toolbar/tools/DualPageTool.js +144 -0
- package/dist/components/layout/toolbar/tools/FileDownloadTool.js +140 -9
- package/dist/components/layout/toolbar/tools/FileUploadTool.js +27 -8
- package/dist/components/layout/toolbar/tools/FullScreenTool.js +23 -13
- package/dist/components/layout/toolbar/tools/InputPageTool.js +157 -26
- package/dist/components/layout/toolbar/tools/NextPageTool.js +89 -9
- package/dist/components/layout/toolbar/tools/PreviousPageTool.js +142 -11
- package/dist/components/layout/toolbar/tools/PrintTool.js +138 -7
- package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +29 -8
- package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +32 -11
- package/dist/components/layout/toolbar/tools/SelectionModeSwitcherTool.js +29 -0
- package/dist/components/layout/toolbar/tools/SinglePageTool.js +144 -0
- package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +15 -6
- package/dist/components/layout/toolbar/tools/ThumbnailTool.js +142 -11
- package/dist/components/layout/toolbar/tools/ZoomInTool.js +47 -20
- package/dist/components/layout/toolbar/tools/ZoomLevelDisplay.js +140 -0
- package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +158 -29
- package/dist/components/layout/toolbar/tools/ZoomOutTool.js +45 -18
- package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +104 -19
- package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +144 -11
- package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +15 -5
- package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +141 -11
- package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +90 -9
- package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +21 -9
- package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +90 -10
- package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +137 -7
- package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +33 -12
- package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +23 -14
- package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +22 -13
- package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +27 -18
- package/dist/components/page/AnnotationLayer.js +87 -9
- package/dist/components/page/CanvasLayer.js +90 -8
- package/dist/components/page/CustomElement.js +49 -18
- package/dist/components/page/DualPage.js +136 -2
- package/dist/components/page/RPPage.js +88 -8
- package/dist/components/page/SinglePage.js +136 -2
- package/dist/components/page/TextHighlightLayer.js +88 -8
- package/dist/components/page/TextLayer.js +89 -9
- package/dist/components/ui/Button.js +9 -8
- package/dist/components/ui/Checkbox.js +6 -5
- package/dist/components/ui/DropDown.js +18 -14
- package/dist/components/ui/Input.js +10 -9
- package/dist/components/ui/LoadingIndicator.js +135 -2
- package/dist/components/ui/PasswordModal.js +18 -15
- package/dist/components/ui/RPTooltip.js +202 -415
- package/dist/contexts/DimensionPagesContext.js +35 -17
- package/dist/contexts/DropFileZoneContext.js +32 -22
- package/dist/contexts/ElementPageContext.js +114 -51
- package/dist/contexts/EventCallbackContext.js +30 -0
- package/dist/contexts/FileInputContext.js +32 -22
- package/dist/contexts/GlobalCurrentPage.js +13 -10
- package/dist/contexts/HighlightContext.js +24 -11
- package/dist/contexts/LicenseContext.js +1 -0
- package/dist/contexts/LoaderContext.js +10 -9
- package/dist/contexts/LocalizationContext.js +11 -10
- package/dist/contexts/PagesRotateContext.js +36 -18
- package/dist/contexts/PaginationContext.js +135 -4
- package/dist/contexts/PrintContext.js +138 -4
- package/dist/contexts/RPDocumentContext.js +46 -28
- package/dist/contexts/RenderQueueProvider.js +136 -4
- package/dist/contexts/RotationContext.js +25 -15
- package/dist/contexts/ScrollModeContext.js +7 -6
- package/dist/contexts/SearchContext.js +138 -4
- package/dist/contexts/SelectionModeContext.js +5 -4
- package/dist/contexts/ThumbnailsContext.js +138 -4
- package/dist/contexts/ViewModeContext.js +10 -9
- package/dist/contexts/ZoomContext.js +34 -24
- package/dist/index-808ea7bf.js +1685 -0
- package/dist/index-a48ec088.js +1672 -0
- package/dist/{index-35c7f4a2.js → index-c9a2990a.js} +3 -3
- package/dist/libInjectCss.js +9 -0
- package/dist/main.js +222 -84
- package/dist/types/assets/style.d.ts +1 -0
- package/dist/types/components/icons/DualPageIcon.d.ts +1 -1
- package/dist/types/components/icons/SinglePageIcon.d.ts +1 -1
- package/dist/types/components/layout/toolbar/tools/DualPageTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/SelectionModeSwitcherTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/SinglePageTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/ZoomLevelDisplay.d.ts +7 -0
- package/dist/types/contexts/EventCallbackContext.d.ts +5 -0
- package/dist/types/contexts/RenderQueueProvider.d.ts +2 -2
- package/dist/types/libInjectCss.d.ts +1 -0
- package/dist/types/main.d.ts +5 -5
- package/dist/types/utils/annotations.d.ts +1 -2
- package/dist/types/utils/approximateFragtion.d.ts +9 -0
- package/dist/types/utils/getElementPositionInPage.d.ts +5 -0
- package/dist/types/utils/hooks/useCopyText.d.ts +1 -0
- package/dist/types/utils/hooks/usePrint.d.ts +3 -2
- package/dist/types/utils/hooks/useSearch.d.ts +1 -2
- package/dist/types/utils/injectPrintCSS.d.ts +1 -0
- package/dist/types/utils/link_service.d.ts +11 -1
- package/dist/types/utils/renderPage.d.ts +2 -2
- package/dist/types/utils/types.d.ts +38 -5
- package/dist/types/utils/zoom.d.ts +2 -0
- package/dist/utils/annotations.js +48 -58
- package/dist/utils/approximateFragtion.js +22 -0
- package/dist/utils/getElementPositionInPage.js +84 -0
- package/dist/utils/getWordPositionInPage.js +5 -5
- package/dist/utils/getZoomLevel.js +9 -8
- package/dist/utils/highlight.js +72 -72
- package/dist/utils/hooks/useCopyText.js +36 -0
- package/dist/utils/hooks/useDarkModeProps.js +3 -2
- package/dist/utils/hooks/useFileDownload.js +90 -8
- package/dist/utils/hooks/useHighlight.js +13 -12
- package/dist/utils/hooks/useLicense.js +1 -1
- package/dist/utils/hooks/useLoadPdf.js +44 -36
- package/dist/utils/hooks/useLoadWorker.js +8 -8
- package/dist/utils/hooks/usePageRotateContext.js +33 -17
- package/dist/utils/hooks/usePaginate.js +88 -8
- package/dist/utils/hooks/usePinch.js +62 -41
- package/dist/utils/hooks/usePresentPage.js +88 -8
- package/dist/utils/hooks/usePrint.js +90 -9
- package/dist/utils/hooks/useRotate.js +21 -7
- package/dist/utils/hooks/useScrollToPage.js +86 -8
- package/dist/utils/hooks/useSearch.js +86 -8
- package/dist/utils/hooks/useThumbnail.js +89 -8
- package/dist/utils/hooks/useVirtualReactWindow.js +88 -8
- package/dist/utils/hooks/useWatermark.js +18 -15
- package/dist/utils/injectPrintCSS.js +22 -0
- package/dist/utils/link_service.js +49 -9
- package/dist/utils/renderPage.js +13 -10
- package/dist/utils/zoom.js +6 -0
- package/package.json +5 -6
- package/dist/ToolbarLayout.module-c588d36b.js +0 -3411
- package/dist/ZoomTool.module-6c5eabbb.js +0 -12
- package/dist/assets/Button.css +0 -1
- package/dist/assets/Checkbox.css +0 -1
- package/dist/assets/Container.css +0 -1
- package/dist/assets/DropDown.css +0 -1
- package/dist/assets/Input.css +0 -1
- package/dist/assets/LayoutWrapper.css +0 -1
- package/dist/assets/LoaderIcon.css +0 -1
- package/dist/assets/MenuItem.css +0 -1
- package/dist/assets/MenuSeparator.css +0 -1
- package/dist/assets/PasswordModal.css +0 -1
- package/dist/assets/PropertyItem.css +0 -1
- package/dist/assets/RPDropFileZone.css +0 -1
- package/dist/assets/RPSplitter.css +0 -1
- package/dist/assets/RPTooltip.css +0 -1
- package/dist/assets/RotateTool.css +0 -1
- package/dist/assets/SearchCloseButton.css +0 -1
- package/dist/assets/ToolbarLayout.css +0 -1
- package/dist/assets/WrapperLayout.css +0 -1
- package/dist/assets/ZoomTool.css +0 -1
- package/dist/floating-ui.react-dom-6b2fe0df.js +0 -1474
- package/dist/index-f563c6f0.js +0 -1889
|
@@ -224,10 +224,11 @@ export interface DarkModeProps {
|
|
|
224
224
|
export interface DarkMode extends DarkModeProps {
|
|
225
225
|
onDarkModeChange: (value: boolean) => void;
|
|
226
226
|
}
|
|
227
|
-
export interface
|
|
227
|
+
export interface RenderOptions {
|
|
228
228
|
scale?: number;
|
|
229
229
|
rotate?: number;
|
|
230
230
|
renderForms?: boolean;
|
|
231
|
+
interactiveForm?: boolean;
|
|
231
232
|
}
|
|
232
233
|
export interface License {
|
|
233
234
|
validating?: boolean;
|
|
@@ -321,13 +322,18 @@ export interface PreparePrintProgress {
|
|
|
321
322
|
totalPages: number;
|
|
322
323
|
percentage: number;
|
|
323
324
|
}
|
|
325
|
+
export interface PrintConfiguration {
|
|
326
|
+
visibleDefaultProgress?: boolean;
|
|
327
|
+
}
|
|
328
|
+
export type PrintOptions = PrintConfiguration | React.MouseEvent<{}>;
|
|
324
329
|
export interface PrintToolProps {
|
|
325
|
-
print: () => void
|
|
330
|
+
print: (options?: PrintOptions) => Promise<void>;
|
|
326
331
|
cancel: () => void;
|
|
327
332
|
setOnProgress: (callback: (progress: PreparePrintProgress) => void) => void;
|
|
328
333
|
setOnComplete: (callback: () => void) => void;
|
|
329
334
|
setOnError: (callback: (error: Error) => void) => void;
|
|
330
335
|
progress: PreparePrintProgress;
|
|
336
|
+
showDefaultProgress?: boolean;
|
|
331
337
|
}
|
|
332
338
|
export interface ThumbnailToolProps {
|
|
333
339
|
onClick: () => void;
|
|
@@ -456,7 +462,12 @@ export interface CharacterMap {
|
|
|
456
462
|
url: string;
|
|
457
463
|
isCompressed: boolean;
|
|
458
464
|
}
|
|
459
|
-
export interface
|
|
465
|
+
export interface EventCallbackContextType {
|
|
466
|
+
onPageChange?: (page: number) => void;
|
|
467
|
+
onRotate?: (rotation: Record<number, number>) => void;
|
|
468
|
+
onScroll?: (scroll: Event) => void;
|
|
469
|
+
}
|
|
470
|
+
export interface RPProviderProps extends PropsWithChildren, LoadPDFOptions, RPControllerProps, EventCallbackContextType {
|
|
460
471
|
src: RPSrc;
|
|
461
472
|
workerUrl?: string;
|
|
462
473
|
characterMap?: CharacterMap;
|
|
@@ -468,6 +479,8 @@ export interface RPControllerProps extends PropsWithChildren, DarkModeProviderPr
|
|
|
468
479
|
locale?: string;
|
|
469
480
|
localization?: LocalizationMap;
|
|
470
481
|
downloadFilename?: string;
|
|
482
|
+
initialSelectionMode?: SelectionMode;
|
|
483
|
+
interactiveForm?: boolean;
|
|
471
484
|
}
|
|
472
485
|
export interface RPConfigProps extends Omit<ConfigContextType, 'workerUrlAdded'>, RPThemeContextType, PropsWithChildren {
|
|
473
486
|
workerUrl?: string;
|
|
@@ -502,6 +515,7 @@ export interface ZoomContextType {
|
|
|
502
515
|
export type ZoomProps = Omit<ZoomContextType, 'currentZoom'>;
|
|
503
516
|
export type InitialStateContextType = {
|
|
504
517
|
instanceId: string;
|
|
518
|
+
interactiveForm?: boolean;
|
|
505
519
|
} & ZoomProviderProps & PageProviderProps & ViewModeInitialProps & ScrollModeInitialProps & RotateProviderProps;
|
|
506
520
|
export interface ZoomProviderProps {
|
|
507
521
|
initialScale?: number | ZoomLevel;
|
|
@@ -535,6 +549,12 @@ export interface ScrollModeInitialProps {
|
|
|
535
549
|
initialScrollMode?: ScrollMode;
|
|
536
550
|
}
|
|
537
551
|
export interface RectPosition {
|
|
552
|
+
left: number;
|
|
553
|
+
bottom: number;
|
|
554
|
+
width: number;
|
|
555
|
+
height: number;
|
|
556
|
+
}
|
|
557
|
+
export interface ElementPosition {
|
|
538
558
|
left: number;
|
|
539
559
|
top: number;
|
|
540
560
|
width: number;
|
|
@@ -605,8 +625,7 @@ export interface SearchContextType {
|
|
|
605
625
|
prevMatch: () => void;
|
|
606
626
|
searchOptions: SearchOptions;
|
|
607
627
|
setSearchOptions: Dispatch<SetStateAction<SearchOptions>>;
|
|
608
|
-
|
|
609
|
-
setCurrentMatchElement: Dispatch<SetStateAction<HTMLElement | null>>;
|
|
628
|
+
setCurrentMatchPosition: Dispatch<React.SetStateAction<number>>;
|
|
610
629
|
}
|
|
611
630
|
export declare enum SelectionMode {
|
|
612
631
|
TEXT = "TEXT",
|
|
@@ -623,7 +642,11 @@ export type LoaderImage = JSX.Element | string;
|
|
|
623
642
|
export interface LoadPDFOptions {
|
|
624
643
|
onLoadError?: (error: any) => void;
|
|
625
644
|
onLoaded?: (pdfDocument: PDFDocumentProxy) => void;
|
|
645
|
+
onLoadProgress?: (progress: number) => void;
|
|
626
646
|
loaderImage?: LoaderImage;
|
|
647
|
+
disableAutoFetch?: boolean;
|
|
648
|
+
disableStream?: boolean;
|
|
649
|
+
rangeChunkSize?: number;
|
|
627
650
|
}
|
|
628
651
|
export interface ScrollPosition {
|
|
629
652
|
left: number;
|
|
@@ -659,6 +682,9 @@ export interface useElementPage {
|
|
|
659
682
|
removeElement: (pageNumber: number, index: number) => void;
|
|
660
683
|
clearElements: (pageNumber: number) => void;
|
|
661
684
|
elementList: Record<number, Array<HTMLElement | JSX.Element>>;
|
|
685
|
+
scrollToElement: (page: number, index: number, config?: {
|
|
686
|
+
behavior: 'smooth' | 'auto' | 'instant';
|
|
687
|
+
}) => void;
|
|
662
688
|
}
|
|
663
689
|
export interface MatchHighlight extends MatchValue {
|
|
664
690
|
keyword: string | RegExp;
|
|
@@ -710,6 +736,13 @@ export interface ThemeSwitcherIcons {
|
|
|
710
736
|
export interface ThemeSwitcherToolProps {
|
|
711
737
|
icons?: ThemeSwitcherIcons;
|
|
712
738
|
}
|
|
739
|
+
export interface SelectionModeSwitcherIcons {
|
|
740
|
+
textSelectionIcon?: React.ReactNode;
|
|
741
|
+
handModeIcon?: React.ReactNode;
|
|
742
|
+
}
|
|
743
|
+
export interface SelectionModeSwitcherToolProps {
|
|
744
|
+
icons?: SelectionModeSwitcherIcons;
|
|
745
|
+
}
|
|
713
746
|
export interface ToolbarSection {
|
|
714
747
|
component: React.ReactNode;
|
|
715
748
|
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { sanitizeExternalUrl as
|
|
2
|
-
import {
|
|
3
|
-
import { dateFormatter as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { sanitizeExternalUrl as _ } from "./sanitizeExternalUrl.js";
|
|
2
|
+
import { AnnotationType as l } from "./types.js";
|
|
3
|
+
import { dateFormatter as L } from "./dateFormatter.js";
|
|
4
|
+
import "../th_TH-d627cd51.js";
|
|
5
|
+
const T = ["click", "dblclick", "input", "change"], m = /* @__PURE__ */ new Map(), v = (e, t) => `${e.loadingTask.docId}___${t.num}R${t.gen === 0 ? "" : t.gen}`;
|
|
6
|
+
function I(e, t) {
|
|
7
|
+
const n = v(e, t);
|
|
8
|
+
return m.has(n) ? m.get(n) ?? null : null;
|
|
8
9
|
}
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
},
|
|
10
|
+
const x = (e, t, n) => {
|
|
11
|
+
m.set(v(e, t), n);
|
|
12
|
+
}, A = (e, t) => {
|
|
12
13
|
switch (t[1].name) {
|
|
13
14
|
case "XYZ":
|
|
14
15
|
return {
|
|
@@ -42,19 +43,19 @@ const B = (e, t, n) => {
|
|
|
42
43
|
};
|
|
43
44
|
}
|
|
44
45
|
};
|
|
45
|
-
async function
|
|
46
|
+
async function E(e, t) {
|
|
46
47
|
let n;
|
|
47
48
|
if (typeof t == "string" ? n = await e.getDestination(t) : n = t, n && typeof n[0] == "object" && n[0] !== null) {
|
|
48
|
-
const a = n[0], s =
|
|
49
|
+
const a = n[0], s = I(e, a);
|
|
49
50
|
if (s === null) {
|
|
50
51
|
const r = await e.getPageIndex(a);
|
|
51
|
-
return
|
|
52
|
+
return x(e, a, r), await E(e, n);
|
|
52
53
|
} else
|
|
53
|
-
return
|
|
54
|
+
return A(s, n);
|
|
54
55
|
} else
|
|
55
|
-
return
|
|
56
|
+
return A(n[0], n);
|
|
56
57
|
}
|
|
57
|
-
const
|
|
58
|
+
const M = (e) => {
|
|
58
59
|
const n = e.target.parentNode;
|
|
59
60
|
if (!n)
|
|
60
61
|
return;
|
|
@@ -67,7 +68,7 @@ const H = (e) => {
|
|
|
67
68
|
if (c) {
|
|
68
69
|
try {
|
|
69
70
|
const { dateObj: i } = JSON.parse(c);
|
|
70
|
-
i && (o.textContent =
|
|
71
|
+
i && (o.textContent = L(i));
|
|
71
72
|
} catch {
|
|
72
73
|
}
|
|
73
74
|
a.disconnect();
|
|
@@ -83,43 +84,33 @@ const H = (e) => {
|
|
|
83
84
|
attributes: !0
|
|
84
85
|
// Watch for changes to attributes
|
|
85
86
|
}), () => a.disconnect();
|
|
86
|
-
}, M = (e, t, n, a) => {
|
|
87
|
-
if (e.type !== "click")
|
|
88
|
-
return;
|
|
89
|
-
const s = e.target, r = s.getAttribute("data-element-id"), o = s.getAttribute("href");
|
|
90
|
-
if (o && o !== "#")
|
|
91
|
-
return;
|
|
92
|
-
const c = t.find((i) => i.id === r);
|
|
93
|
-
!c || c.annotationType !== _.Link || c.dest && b(n, c.dest).then((i) => {
|
|
94
|
-
a(i);
|
|
95
|
-
});
|
|
96
87
|
};
|
|
97
|
-
function
|
|
98
|
-
for (const n of
|
|
88
|
+
function H(e, t) {
|
|
89
|
+
for (const n of T)
|
|
99
90
|
e.addEventListener(n, t);
|
|
100
91
|
}
|
|
101
|
-
function
|
|
102
|
-
for (const n of
|
|
92
|
+
function P(e, t) {
|
|
93
|
+
for (const n of T)
|
|
103
94
|
e.removeEventListener(n, t);
|
|
104
95
|
}
|
|
105
|
-
function
|
|
96
|
+
function U(e) {
|
|
106
97
|
const { id: t, url: n, unsafeUrl: a } = e;
|
|
107
98
|
new MutationObserver((r, o) => {
|
|
108
99
|
const c = document.querySelector(`[data-annotation-id="${t}"]`);
|
|
109
100
|
if (c) {
|
|
110
|
-
const i = c.querySelector("a"), p =
|
|
101
|
+
const i = c.querySelector("a"), p = _((n || a) ?? "", "");
|
|
111
102
|
i && (i == null || i.setAttribute("target", "_blank"), i == null || i.setAttribute("href", p), i == null || i.setAttribute("rel", "noopener noreferrer")), o.disconnect();
|
|
112
103
|
}
|
|
113
104
|
}).observe(document.body, { childList: !0, subtree: !0 });
|
|
114
105
|
}
|
|
115
|
-
function
|
|
106
|
+
function V(e, t, n) {
|
|
116
107
|
const { rotation: a, scale: s } = t, r = a % 180 === 0;
|
|
117
108
|
if (e.fieldType === "Btn" && e.pushButton) {
|
|
118
109
|
const o = e.rect[2] - e.rect[0], c = e.rect[3] - e.rect[1], i = document.createElement("canvas");
|
|
119
110
|
i.setAttribute("width", ((r ? o : c) * s).toString()), i.setAttribute("height", ((r ? c : o) * s).toString()), n.set(e.id, i);
|
|
120
111
|
}
|
|
121
112
|
}
|
|
122
|
-
function
|
|
113
|
+
function B(e) {
|
|
123
114
|
var r;
|
|
124
115
|
let t = e;
|
|
125
116
|
for (; t.tagName !== "SECTION"; )
|
|
@@ -131,14 +122,14 @@ function k(e) {
|
|
|
131
122
|
if (s || (s = (r = t.firstChild) == null ? void 0 : r.id), s && t.parentElement) {
|
|
132
123
|
const o = t.parentElement.querySelector(`[aria-controls="${s}"]`);
|
|
133
124
|
o && new MutationObserver((i, p) => {
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
if (
|
|
125
|
+
const b = document.querySelectorAll(".popupDate");
|
|
126
|
+
b.length > 0 && (b.forEach((g) => {
|
|
127
|
+
if (g.innerHTML)
|
|
137
128
|
return !1;
|
|
138
|
-
const N =
|
|
129
|
+
const N = g.getAttribute("data-l10n-args");
|
|
139
130
|
if (N) {
|
|
140
|
-
const { date:
|
|
141
|
-
|
|
131
|
+
const { date: h, time: y } = JSON.parse(N);
|
|
132
|
+
h && y && (g.textContent = `${h}, ${y}`);
|
|
142
133
|
}
|
|
143
134
|
}), p.disconnect());
|
|
144
135
|
}).observe(o, { childList: !0, subtree: !0 });
|
|
@@ -154,10 +145,10 @@ function d(e, t, n) {
|
|
|
154
145
|
function u(e, t) {
|
|
155
146
|
return { type: e, data: t };
|
|
156
147
|
}
|
|
157
|
-
async function
|
|
148
|
+
async function w(e, t) {
|
|
158
149
|
if (e.dest)
|
|
159
150
|
if (typeof e.dest == "string") {
|
|
160
|
-
const n = await
|
|
151
|
+
const n = await E(t, e.dest);
|
|
161
152
|
return u(l.INTERNAL_LINK, {
|
|
162
153
|
referencedPage: n.pageIndex,
|
|
163
154
|
offset: null
|
|
@@ -178,7 +169,7 @@ async function S(e, t) {
|
|
|
178
169
|
unsafeUrl: e.unsafeUrl
|
|
179
170
|
});
|
|
180
171
|
}
|
|
181
|
-
function
|
|
172
|
+
function O(e) {
|
|
182
173
|
for (const t of e.getElementsByTagName("span")) {
|
|
183
174
|
let n = t.textContent;
|
|
184
175
|
const a = JSON.parse(t.dataset.l10nArgs ?? "{}");
|
|
@@ -188,7 +179,7 @@ function T(e) {
|
|
|
188
179
|
t.textContent = n;
|
|
189
180
|
}
|
|
190
181
|
}
|
|
191
|
-
function
|
|
182
|
+
function S(e) {
|
|
192
183
|
return u(l.FILE_ATTACHMENT, e.file);
|
|
193
184
|
}
|
|
194
185
|
function f(e, t) {
|
|
@@ -235,27 +226,27 @@ function f(e, t) {
|
|
|
235
226
|
});
|
|
236
227
|
}
|
|
237
228
|
}
|
|
238
|
-
async function
|
|
229
|
+
async function $(e, t, n) {
|
|
239
230
|
var s;
|
|
240
231
|
let a = e.target.parentNode;
|
|
241
|
-
if (a.tagName === "DIV" && (a = a.firstChild),
|
|
232
|
+
if (a.tagName === "DIV" && (a = a.firstChild), B(a), typeof a.className != "object")
|
|
242
233
|
if (a.className === "linkAnnotation" && e.type === "click") {
|
|
243
234
|
const r = (s = a.dataset) == null ? void 0 : s.annotationId;
|
|
244
235
|
if (r) {
|
|
245
236
|
const o = d("id", r, n);
|
|
246
237
|
if (o.length)
|
|
247
|
-
return await
|
|
238
|
+
return await w(o[0], t);
|
|
248
239
|
}
|
|
249
240
|
} else if (
|
|
250
241
|
/* annotation.className.includes('popupAnnotation') || */
|
|
251
242
|
a.className.includes("textAnnotation")
|
|
252
243
|
)
|
|
253
|
-
|
|
244
|
+
O(a);
|
|
254
245
|
else if (a.className.includes("fileAttachmentAnnotation")) {
|
|
255
|
-
|
|
246
|
+
O(a);
|
|
256
247
|
const r = a.dataset.annotationId;
|
|
257
248
|
if (r && e.type === "dblclick")
|
|
258
|
-
return
|
|
249
|
+
return S(d("id", r, n)[0]);
|
|
259
250
|
} else if (a.className.includes("textWidgetAnnotation") && e.type === "input") {
|
|
260
251
|
let r = a.getElementsByTagName("input")[0];
|
|
261
252
|
return r || (r = a.getElementsByTagName("textarea")[0]), f(r);
|
|
@@ -296,11 +287,10 @@ async function D(e, t, n) {
|
|
|
296
287
|
}
|
|
297
288
|
}
|
|
298
289
|
export {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
U as unbindLayerEvents
|
|
290
|
+
$ as annotationEventsHandler,
|
|
291
|
+
M as annotationsEvents,
|
|
292
|
+
H as bindLayerEvents,
|
|
293
|
+
U as handleAnnotationLink,
|
|
294
|
+
V as handleAnnotationWidget,
|
|
295
|
+
P as unbindLayerEvents
|
|
306
296
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
function u(t) {
|
|
2
|
+
if (Math.floor(t) === t)
|
|
3
|
+
return [t, 1];
|
|
4
|
+
const e = 1 / t, s = 8;
|
|
5
|
+
if (e > s)
|
|
6
|
+
return [1, s];
|
|
7
|
+
if (Math.floor(e) === e)
|
|
8
|
+
return [1, e];
|
|
9
|
+
const r = t > 1 ? e : t;
|
|
10
|
+
let i = 0, n = 1, o = 1, l = 1;
|
|
11
|
+
for (; ; ) {
|
|
12
|
+
const c = i + o, f = n + l;
|
|
13
|
+
if (f > s)
|
|
14
|
+
break;
|
|
15
|
+
r <= c / f ? (o = c, l = f) : (i = c, n = f);
|
|
16
|
+
}
|
|
17
|
+
let a;
|
|
18
|
+
return r - i / n < o / l - r ? a = r === t ? [i, n] : [n, i] : a = r === t ? [o, l] : [l, o], a;
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
u as approximateFraction
|
|
22
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
function g(e, o) {
|
|
2
|
+
!e || typeof e != "object" || Object.entries(e).forEach(([d, i]) => {
|
|
3
|
+
if (i == null)
|
|
4
|
+
return;
|
|
5
|
+
const s = d.replace(/([A-Z])/g, "-$1").toLowerCase(), n = [
|
|
6
|
+
"width",
|
|
7
|
+
"height",
|
|
8
|
+
"top",
|
|
9
|
+
"right",
|
|
10
|
+
"bottom",
|
|
11
|
+
"left",
|
|
12
|
+
"margin",
|
|
13
|
+
"margin-top",
|
|
14
|
+
"margin-right",
|
|
15
|
+
"margin-bottom",
|
|
16
|
+
"margin-left",
|
|
17
|
+
"padding",
|
|
18
|
+
"padding-top",
|
|
19
|
+
"padding-right",
|
|
20
|
+
"padding-bottom",
|
|
21
|
+
"padding-left",
|
|
22
|
+
"border-width",
|
|
23
|
+
"border-top-width",
|
|
24
|
+
"border-right-width",
|
|
25
|
+
"border-bottom-width",
|
|
26
|
+
"border-left-width",
|
|
27
|
+
"font-size",
|
|
28
|
+
"line-height",
|
|
29
|
+
"letter-spacing",
|
|
30
|
+
"word-spacing",
|
|
31
|
+
"min-width",
|
|
32
|
+
"min-height",
|
|
33
|
+
"max-width",
|
|
34
|
+
"max-height",
|
|
35
|
+
"flex-basis",
|
|
36
|
+
"grid-gap",
|
|
37
|
+
"grid-row-gap",
|
|
38
|
+
"grid-column-gap"
|
|
39
|
+
];
|
|
40
|
+
let t;
|
|
41
|
+
typeof i == "number" && i !== 0 ? t = n.includes(s) ? `${i}px` : String(i) : t = String(i), o.style.setProperty(s, t);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
const f = (e, o, d, i, s) => {
|
|
45
|
+
let n = "center";
|
|
46
|
+
switch (i) {
|
|
47
|
+
case 90:
|
|
48
|
+
n = `${e.width / 2}px ${e.width / 2}px`;
|
|
49
|
+
break;
|
|
50
|
+
case -90:
|
|
51
|
+
case 270:
|
|
52
|
+
n = `${e.height / 2}px ${e.height / 2}px`;
|
|
53
|
+
break;
|
|
54
|
+
default:
|
|
55
|
+
n = "center";
|
|
56
|
+
}
|
|
57
|
+
const t = document.createElement("div");
|
|
58
|
+
t.id = "parent-element", t.style.width = `${e.width}px`, t.style.height = `${e.height}px`, t.style.setProperty("--scale-factor", s.toString()), t.style.setProperty("--rotation", i.toString()), t.style.setProperty("--transform-origin", n), t.style.left = "-99999px", t.style.visibility = "hidden", t.style.position = "absolute";
|
|
59
|
+
const l = document.createElement("div");
|
|
60
|
+
l.style.position = "relative", l.style.width = "100%", l.style.height = "100%", t.appendChild(l);
|
|
61
|
+
let r;
|
|
62
|
+
if (d instanceof HTMLElement)
|
|
63
|
+
r = d.cloneNode(!0), l.appendChild(r);
|
|
64
|
+
else {
|
|
65
|
+
const p = d.props;
|
|
66
|
+
r = document.createElement("div"), p.style && g(p.style, r), p.className && (r.className = p.className), l.appendChild(r);
|
|
67
|
+
}
|
|
68
|
+
o.appendChild(t);
|
|
69
|
+
const c = t.getBoundingClientRect(), h = r.getBoundingClientRect();
|
|
70
|
+
o.removeChild(t);
|
|
71
|
+
const a = {
|
|
72
|
+
top: o.clientHeight / 2,
|
|
73
|
+
left: o.clientWidth / 2
|
|
74
|
+
};
|
|
75
|
+
return {
|
|
76
|
+
left: h.left - c.left - a.left,
|
|
77
|
+
top: h.top - c.top - a.top,
|
|
78
|
+
width: h.width,
|
|
79
|
+
height: h.height
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
export {
|
|
83
|
+
f as getElementPagePosition
|
|
84
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const a = (i, h, l, o, n) => {
|
|
2
|
-
const c = l.height * o, s = l.width * o, y = l.
|
|
2
|
+
const c = l.height * o, s = l.width * o, y = l.bottom * o, m = l.left * o, d = {
|
|
3
3
|
width: n % 180 === 90 ? i.height : i.width,
|
|
4
4
|
height: n % 180 === 90 ? i.width : i.height
|
|
5
5
|
}, r = {
|
|
@@ -8,16 +8,16 @@ const a = (i, h, l, o, n) => {
|
|
|
8
8
|
}, t = document.createElement("div");
|
|
9
9
|
t.style.width = `${d.width}px`, t.style.height = `${d.height}px`, t.style.position = "absolute", t.style.transform = `rotate(${n}deg)`, t.style.transformOrigin = "center center", t.style.visibility = "hidden", t.style.left = "-99999px";
|
|
10
10
|
const e = document.createElement("div");
|
|
11
|
-
e.style.position = "absolute", e.style.width = `${s}px`, e.style.height = `${c}px`, e.style.position = "absolute", e.style.bottom = `${y}px`, e.style.left = `${
|
|
12
|
-
const
|
|
11
|
+
e.style.position = "absolute", e.style.width = `${s}px`, e.style.height = `${c}px`, e.style.position = "absolute", e.style.bottom = `${y}px`, e.style.left = `${m}px`, t.appendChild(e), h.appendChild(t);
|
|
12
|
+
const g = t.getBoundingClientRect(), p = e.getBoundingClientRect();
|
|
13
13
|
h.removeChild(t);
|
|
14
14
|
const u = {
|
|
15
15
|
top: h.clientHeight / 2,
|
|
16
16
|
left: h.clientWidth / 2
|
|
17
17
|
};
|
|
18
18
|
return {
|
|
19
|
-
leftInPage:
|
|
20
|
-
topInPage:
|
|
19
|
+
leftInPage: p.left - g.left - u.left + r.width / 2,
|
|
20
|
+
topInPage: p.top - g.top - u.top + r.height / 2
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
23
|
export {
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import { SCROLL_BAR_WIDTH as
|
|
2
|
-
import { ViewMode as
|
|
3
|
-
|
|
1
|
+
import { SCROLL_BAR_WIDTH as n, PAGE_PADDING as f } from "./constants.js";
|
|
2
|
+
import { ViewMode as i, ZoomLevel as r } from "./types.js";
|
|
3
|
+
import "../th_TH-d627cd51.js";
|
|
4
|
+
const D = (o, t, a, e, A, c) => {
|
|
4
5
|
if (typeof o == "number")
|
|
5
6
|
return o;
|
|
6
|
-
const
|
|
7
|
+
const m = c === i.DUAL_PAGE ? 2 * e : e;
|
|
7
8
|
switch (o) {
|
|
8
9
|
case r.PAGE_FIT:
|
|
9
10
|
const s = Math.min(
|
|
10
|
-
(t -
|
|
11
|
-
(
|
|
11
|
+
(t - n) / m,
|
|
12
|
+
(a - f) / A
|
|
12
13
|
);
|
|
13
14
|
return Math.floor(s * 100);
|
|
14
15
|
case r.PAGE_WIDTH:
|
|
15
|
-
return Math.floor((t -
|
|
16
|
+
return Math.floor((t - n) / m * 100);
|
|
16
17
|
case r.ACTUAL:
|
|
17
18
|
default:
|
|
18
19
|
return 100;
|
|
19
20
|
}
|
|
20
21
|
};
|
|
21
22
|
export {
|
|
22
|
-
|
|
23
|
+
D as getZoomLevel
|
|
23
24
|
};
|