@react-pdf-kit/viewer 2.8.0-beta.6 → 2.8.0-beta.8
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/README.md +44 -30
- package/dist/{AnnotationLayer-CAIvKf_O.js → AnnotationLayer-CyOYh0Tw.js} +2 -2
- package/dist/CanvasLayer-CJqCJ30J.js +111 -0
- package/dist/{LoadingIndicator-DiWoWs4Y.js → LoadingIndicator-B_Jsf8No.js} +7 -7
- package/dist/MenuItem-D-GflAAo.js +31 -0
- package/dist/PaginationContext-DIzsZhFd.js +194 -0
- package/dist/{PasswordModal-CB9Rd2zJ.js → PasswordModal-S0leMhEd.js} +11 -11
- package/dist/RPLayout.module-BH5r8dDc.js +14 -0
- package/dist/RPPages-BQw330_L.js +655 -0
- package/dist/{RPTooltip-ZZoFqP7C.js → RPTooltip-COLVx-C_.js} +123 -91
- package/dist/SearchTool.module-DY8Ucfb_.js +17 -0
- package/dist/{SkipLink-CdcjClGB.js → SkipLink-Dj83gZdk.js} +3 -3
- package/dist/{TextLayer-DWGFN9SF.js → TextLayer-D-V9kogG.js} +5 -5
- package/dist/{Thumbnail-CzclS3h_.js → Thumbnail-C6zkvwcs.js} +6 -6
- package/dist/{Thumbnails-DnAsrttK.js → Thumbnails-DKG6I7pb.js} +2 -2
- package/dist/assets/AnnotationLayer.css +1 -1
- package/dist/assets/CanvasLayer.css +1 -0
- package/dist/assets/LoadingIndicator.css +1 -1
- package/dist/assets/MenuItem.css +1 -1
- package/dist/assets/PasswordModal.css +1 -1
- package/dist/assets/RPLayout.css +1 -1
- package/dist/assets/RPPages.css +1 -1
- package/dist/assets/SearchTool.css +1 -1
- package/dist/assets/SkipLink.css +1 -1
- package/dist/assets/TextLayer.css +1 -1
- package/dist/assets/Thumbnail.css +1 -1
- package/dist/assets/style.js +1 -1
- package/dist/components/RPController.js +39 -39
- package/dist/components/RPPages.js +1 -1
- package/dist/components/RPProvider.js +1 -1
- package/dist/components/layout/LayoutContainer.js +6 -6
- package/dist/components/layout/LayoutWrapper.js +5 -5
- package/dist/components/layout/RPDefaultLayout.js +2 -2
- package/dist/components/layout/RPLayout.js +2 -2
- package/dist/components/layout/SkipLink.js +1 -1
- package/dist/components/layout/sidebar/RPSidebar.js +2 -2
- package/dist/components/layout/sidebar/Thumbnail.js +1 -1
- package/dist/components/layout/sidebar/Thumbnails.js +1 -1
- package/dist/components/layout/toolbar/DarkModeTool.js +1 -1
- package/dist/components/layout/toolbar/DocumentProperties.js +6 -6
- package/dist/components/layout/toolbar/FileDownloadTool.js +6 -6
- package/dist/components/layout/toolbar/FileUploadTool.js +6 -6
- package/dist/components/layout/toolbar/FullScreenTool.js +9 -8
- package/dist/components/layout/toolbar/MenuItem.js +1 -1
- package/dist/components/layout/toolbar/MostPageTool.js +23 -29
- package/dist/components/layout/toolbar/OtherTool.js +1 -1
- package/dist/components/layout/toolbar/Paginate.js +2 -2
- package/dist/components/layout/toolbar/PrintTool.js +6 -6
- package/dist/components/layout/toolbar/RPMenuItem.js +2 -2
- package/dist/components/layout/toolbar/RPMoreOptions.js +1 -1
- package/dist/components/layout/toolbar/RPToolbar.js +1 -1
- package/dist/components/layout/toolbar/RotateTool.js +10 -10
- package/dist/components/layout/toolbar/ScrollModeTool.js +17 -17
- package/dist/components/layout/toolbar/SearchCloseButton.js +2 -2
- package/dist/components/layout/toolbar/SearchResultNavigator.js +2 -2
- package/dist/components/layout/toolbar/SearchTool.js +133 -121
- package/dist/components/layout/toolbar/SelectionModeTool.js +10 -10
- package/dist/components/layout/toolbar/ThumbnailTool.js +1 -1
- package/dist/components/layout/toolbar/ToolbarCustom.js +2 -2
- package/dist/components/layout/toolbar/ToolbarDefault.js +2 -2
- package/dist/components/layout/toolbar/ViewModeTool.js +16 -16
- package/dist/components/layout/toolbar/ZoomTool.js +82 -80
- package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +1 -1
- package/dist/components/layout/toolbar/tools/DualPageTool.js +1 -1
- package/dist/components/layout/toolbar/tools/DualPageWithCoverTool.js +1 -1
- package/dist/components/layout/toolbar/tools/FileDownloadTool.js +1 -1
- package/dist/components/layout/toolbar/tools/FileUploadTool.js +1 -1
- package/dist/components/layout/toolbar/tools/FirstPageTool.js +1 -1
- package/dist/components/layout/toolbar/tools/FullScreenTool.js +1 -1
- package/dist/components/layout/toolbar/tools/HorizontalScrollingTool.js +3 -3
- package/dist/components/layout/toolbar/tools/InputPageTool.js +2 -2
- package/dist/components/layout/toolbar/tools/LastPageTool.js +1 -1
- package/dist/components/layout/toolbar/tools/NextPageTool.js +2 -2
- package/dist/components/layout/toolbar/tools/PageScrollingTool.js +1 -1
- package/dist/components/layout/toolbar/tools/PreviousPageTool.js +2 -2
- package/dist/components/layout/toolbar/tools/PrintTool.js +1 -1
- 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/SelectionModeSwitcherTool.js +1 -1
- package/dist/components/layout/toolbar/tools/SinglePageTool.js +1 -1
- package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +1 -1
- package/dist/components/layout/toolbar/tools/ThumbnailTool.js +1 -1
- package/dist/components/layout/toolbar/tools/VerticalScrollingTool.js +1 -1
- package/dist/components/layout/toolbar/tools/ZoomInTool.js +25 -23
- package/dist/components/layout/toolbar/tools/ZoomLevelDisplay.js +1 -1
- package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +2 -2
- package/dist/components/layout/toolbar/tools/ZoomOutTool.js +25 -23
- package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.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/FullScreenTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +3 -3
- package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +7 -7
- package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +2 -2
- package/dist/components/page/AnnotationLayer.js +1 -1
- package/dist/components/page/CanvasLayer.js +2 -48
- package/dist/components/page/DualPage.js +2 -2
- package/dist/components/page/DualPageWithCover.js +2 -2
- package/dist/components/page/RPPage.js +94 -2
- package/dist/components/page/SinglePage.js +2 -2
- package/dist/components/page/TextHighlightLayer.js +1 -1
- package/dist/components/page/TextLayer.js +1 -1
- package/dist/components/ui/LoadingIndicator.js +1 -1
- package/dist/components/ui/PasswordModal.js +1 -1
- package/dist/components/ui/RPTooltip.js +1 -1
- package/dist/contexts/DimensionPagesContext.js +38 -22
- package/dist/contexts/ElementPageContext.js +46 -39
- package/dist/contexts/ElementThumbnailContext.js +1 -1
- package/dist/contexts/PaginationContext.js +1 -1
- package/dist/contexts/RenderQueueProvider.js +24 -18
- package/dist/contexts/RenderedPagesCache.js +32 -13
- package/dist/contexts/VirtualScrollContext.js +10 -13
- package/dist/contexts/ZoomContext.js +119 -61
- package/dist/{de_DE-DwUvXUWH.js → de_DE-x4Z-jQrz.js} +30 -0
- package/dist/{main-CKr9unOk.js → main-7sMXtgRg.js} +2 -2
- package/dist/main.js +4 -4
- package/dist/style-CJtyyrJx.js +5 -0
- package/dist/types/components/page/CanvasLayer.d.ts +4 -1
- package/dist/types/components/ui/RPTooltip.d.ts +3 -2
- package/dist/types/contexts/RenderQueueProvider.d.ts +2 -0
- package/dist/types/contexts/RenderedPagesCache.d.ts +3 -0
- package/dist/types/contexts/VirtualScrollContext.d.ts +0 -3
- package/dist/types/locales/de_DE.json.d.ts +5 -0
- package/dist/types/locales/en_US.json.d.ts +5 -0
- package/dist/types/locales/it_IT.json.d.ts +5 -0
- package/dist/types/locales/pt_PT.json.d.ts +5 -0
- package/dist/types/locales/th_TH.json.d.ts +5 -0
- package/dist/types/locales/zh_CN.json.d.ts +5 -0
- package/dist/types/utils/Queue.d.ts +1 -0
- package/dist/types/utils/const.d.ts +3 -0
- package/dist/types/utils/constants.d.ts +9 -0
- package/dist/types/utils/documentLayout.d.ts +60 -0
- package/dist/types/utils/hooks/usePinch.d.ts +14 -1
- package/dist/types/utils/hooks/usePresentPage.d.ts +2 -2
- package/dist/types/utils/hooks/useZoomOrigin.d.ts +4 -0
- package/dist/types/utils/types.d.ts +21 -2
- package/dist/types/utils/zoom.d.ts +2 -0
- package/dist/utils/Queue.js +5 -0
- package/dist/utils/const.js +2 -2
- package/dist/utils/constants.js +2 -2
- package/dist/utils/documentLayout.js +141 -0
- package/dist/utils/hooks/useLicense.js +1 -1
- package/dist/utils/hooks/useLoadPdf.js +73 -63
- package/dist/utils/hooks/useLocalization.js +1 -1
- package/dist/utils/hooks/usePaginate.js +1 -1
- package/dist/utils/hooks/usePinch.js +109 -56
- package/dist/utils/hooks/usePresentPage.js +33 -57
- package/dist/utils/hooks/useScrollToPage.js +1 -1
- package/dist/utils/hooks/useSearch.js +66 -67
- package/dist/utils/hooks/useZoomOrigin.js +37 -0
- package/dist/utils/renderPage.js +21 -14
- package/dist/utils/types.js +3 -3
- package/dist/utils/zoom.js +8 -2
- package/package.json +1 -1
- package/dist/MenuItem-BJDWfzAw.js +0 -15
- package/dist/PaginationContext-Cwf8sCpK.js +0 -242
- package/dist/RPLayout.module-Vc3h4xxS.js +0 -14
- package/dist/RPPage-C_r8aeTc.js +0 -91
- package/dist/RPPages-CmXHTAqF.js +0 -1007
- package/dist/SearchTool.module-DUkVXfOn.js +0 -16
- package/dist/assets/RPPage.css +0 -1
- package/dist/contexts/VirtualGridContext.js +0 -18
- package/dist/style-C8T5x1fE.js +0 -5
- package/dist/types/contexts/VirtualGridContext.d.ts +0 -9
- package/dist/types/utils/calculatePage.d.ts +0 -12
- package/dist/types/utils/hooks/useVirtualReactWindow.d.ts +0 -17
- package/dist/utils/calculatePage.js +0 -30
- package/dist/utils/hooks/useVirtualReactWindow.js +0 -86
- /package/dist/{TextHighlightLayer-BSVgBxR3.js → TextHighlightLayer-3vIZbRyL.js} +0 -0
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { Queue } from '../utils/Queue';
|
|
2
2
|
import { FC } from 'react';
|
|
3
3
|
import { PDFPageProxy } from 'pdfjs-dist';
|
|
4
|
+
import { RenderTask } from 'pdfjs-dist/types/src/display/api';
|
|
4
5
|
import { RenderOptions } from '../utils/types';
|
|
5
6
|
interface RenderData {
|
|
6
7
|
page: PDFPageProxy;
|
|
7
8
|
canvasElem: HTMLCanvasElement;
|
|
8
9
|
options?: RenderOptions;
|
|
9
10
|
onLoaded?: () => void;
|
|
11
|
+
onRenderTask?: (task: RenderTask | null) => void;
|
|
10
12
|
}
|
|
11
13
|
export declare const RenderQueueContext: import('react').Context<Queue<RenderData> | null>;
|
|
12
14
|
export declare const RenderQueueProvider: FC<{
|
|
@@ -3,6 +3,9 @@ import { FC, PropsWithChildren } from 'react';
|
|
|
3
3
|
interface CacheContext {
|
|
4
4
|
viewports: Map<number, PageViewport>;
|
|
5
5
|
pages: Map<number, any>;
|
|
6
|
+
hasRenderedPage: (key: string) => boolean;
|
|
7
|
+
markRenderedPage: (key: string) => void;
|
|
8
|
+
clearRenderedPages: () => void;
|
|
6
9
|
}
|
|
7
10
|
export declare const RenderedPagesCacheContext: import('react').Context<CacheContext>;
|
|
8
11
|
export declare const useRenderedPagesCache: () => CacheContext;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { FC, PropsWithChildren } from 'react';
|
|
2
|
-
import { VariableSizeGrid } from 'react-window';
|
|
3
2
|
interface ContextType {
|
|
4
|
-
virtualScrollRef?: VariableSizeGrid;
|
|
5
|
-
getVirtualScrollRef: (element: VariableSizeGrid) => void;
|
|
6
3
|
pageScrollElementRef?: HTMLDivElement;
|
|
7
4
|
getPageScrollElementRef: (element: HTMLDivElement) => void;
|
|
8
5
|
virtualScrollableElementRef?: HTMLDivElement;
|
|
@@ -9,6 +9,9 @@ declare const _default: {
|
|
|
9
9
|
"searchMatchCaseTooltip": "Groß-/Kleinschreibung beachten",
|
|
10
10
|
"searchWholeWordsLabel": "Ganze Wörter",
|
|
11
11
|
"searchWholeWordsTooltip": "Exakte Wörter suchen (Groß-/Kleinschreibung ignorieren)",
|
|
12
|
+
"searchLoadingMessage": "Suche läuft",
|
|
13
|
+
"searchNoResultsMessage": "Keine Treffer gefunden",
|
|
14
|
+
"searchResultsMessage": "{current} von {total} Treffern",
|
|
12
15
|
"previousPageTooltip": "Vorherige Seite",
|
|
13
16
|
"currentPageTooltip": "Aktuelle Seite",
|
|
14
17
|
"nextPageTooltip": "Nächste Seite",
|
|
@@ -49,6 +52,8 @@ declare const _default: {
|
|
|
49
52
|
"pageScrollingTooltip": "Seitenweises Blättern aktivieren",
|
|
50
53
|
"verticalScrollingLabel": "Vertikaler Bildlauf",
|
|
51
54
|
"verticalScrollingTooltip": "Vertikalen Bildlauf aktivieren",
|
|
55
|
+
"horizontalScrollingLabel": "Horizontaler Bildlauf",
|
|
56
|
+
"horizontalScrollingTooltip": "Horizontalen Bildlauf aktivieren",
|
|
52
57
|
"horizontalLabel": "Horizontaler Bildlauf",
|
|
53
58
|
"horizontalTooltip": "Horizontalen Bildlauf aktivieren",
|
|
54
59
|
"wrappedScrollingLabel": "Bildlauf mit Umbruch",
|
|
@@ -9,6 +9,9 @@ declare const _default: {
|
|
|
9
9
|
"searchMatchCaseTooltip": "Search case sensitive text",
|
|
10
10
|
"searchWholeWordsLabel": "Whole Words",
|
|
11
11
|
"searchWholeWordsTooltip": "Search exact and case insensitive word(s)",
|
|
12
|
+
"searchLoadingMessage": "Searching",
|
|
13
|
+
"searchNoResultsMessage": "No matches found",
|
|
14
|
+
"searchResultsMessage": "{current} of {total} matches",
|
|
12
15
|
"previousPageTooltip": "Previous page",
|
|
13
16
|
"currentPageTooltip": "Current page",
|
|
14
17
|
"nextPageTooltip": "Next page",
|
|
@@ -49,6 +52,8 @@ declare const _default: {
|
|
|
49
52
|
"pageScrollingTooltip": "Enable page scrolling",
|
|
50
53
|
"verticalScrollingLabel": "Vertical scrolling",
|
|
51
54
|
"verticalScrollingTooltip": "Enable vertical scrolling",
|
|
55
|
+
"horizontalScrollingLabel": "Horizontal scrolling",
|
|
56
|
+
"horizontalScrollingTooltip": "Enable horizontal scrolling",
|
|
52
57
|
"horizontalLabel": "Horizontal scrolling",
|
|
53
58
|
"horizontalTooltip": "Enable horizontal scrolling",
|
|
54
59
|
"wrappedScrollingLabel": "Wrapped scrolling",
|
|
@@ -9,6 +9,9 @@ declare const _default: {
|
|
|
9
9
|
"searchMatchCaseTooltip": "Cerca testo con distinzione maiuscole/minuscole",
|
|
10
10
|
"searchWholeWordsLabel": "Parola intera",
|
|
11
11
|
"searchWholeWordsTooltip": "Cerca esatte parole senza distinzione maiuscole/minuscole",
|
|
12
|
+
"searchLoadingMessage": "Ricerca in corso",
|
|
13
|
+
"searchNoResultsMessage": "Nessuna corrispondenza trovata",
|
|
14
|
+
"searchResultsMessage": "{current} di {total} corrispondenze",
|
|
12
15
|
"previousPageTooltip": "Pagina precedente",
|
|
13
16
|
"currentPageTooltip": "Pagina corrente",
|
|
14
17
|
"nextPageTooltip": "Pagina successiva",
|
|
@@ -49,6 +52,8 @@ declare const _default: {
|
|
|
49
52
|
"pageScrollingTooltip": "Abilita lo scorrimento delle pagine",
|
|
50
53
|
"verticalScrollingLabel": "Scorrimento verticale",
|
|
51
54
|
"verticalScrollingTooltip": "Abilita lo scorrimento verticale",
|
|
55
|
+
"horizontalScrollingLabel": "Scorrimento orizzontale",
|
|
56
|
+
"horizontalScrollingTooltip": "Abilita lo scorrimento orizzontale",
|
|
52
57
|
"horizontalLabel": "Scorrimento orizzontale",
|
|
53
58
|
"horizontalTooltip": "Abilita lo scorrimento orizzontale",
|
|
54
59
|
"wrappedScrollingLabel": "Scorrimento avvolto",
|
|
@@ -9,6 +9,9 @@ declare const _default: {
|
|
|
9
9
|
"searchMatchCaseTooltip": "Pesquisar texto com distinção de maiúsculas/minúsculas",
|
|
10
10
|
"searchWholeWordsLabel": "Palavra inteira",
|
|
11
11
|
"searchWholeWordsTooltip": "Pesquisar palavras exatas sem distinção de maiúsculas/minúsculas",
|
|
12
|
+
"searchLoadingMessage": "A pesquisar",
|
|
13
|
+
"searchNoResultsMessage": "Nenhuma correspondência encontrada",
|
|
14
|
+
"searchResultsMessage": "{current} de {total} correspondências",
|
|
12
15
|
"previousPageTooltip": "Página anterior",
|
|
13
16
|
"currentPageTooltip": "Página atual",
|
|
14
17
|
"nextPageTooltip": "Próxima página",
|
|
@@ -49,6 +52,8 @@ declare const _default: {
|
|
|
49
52
|
"pageScrollingTooltip": "Ativar rolagem de página",
|
|
50
53
|
"verticalScrollingLabel": "Rolagem vertical",
|
|
51
54
|
"verticalScrollingTooltip": "Ativar rolagem vertical",
|
|
55
|
+
"horizontalScrollingLabel": "Rolagem horizontal",
|
|
56
|
+
"horizontalScrollingTooltip": "Ativar rolagem horizontal",
|
|
52
57
|
"horizontalLabel": "Rolagem horizontal",
|
|
53
58
|
"horizontalTooltip": "Ativar rolagem horizontal",
|
|
54
59
|
"wrappedScrollingLabel": "Rolagem envolvida",
|
|
@@ -9,6 +9,9 @@ declare const _default: {
|
|
|
9
9
|
"searchMatchCaseTooltip": "ค้นหาข้อความที่มีการแยกตัวพิมพ์ใหญ่/พิมพ์เล็ก",
|
|
10
10
|
"searchWholeWordsLabel": "ทั้งคำ",
|
|
11
11
|
"searchWholeWordsTooltip": "ค้นหาคำที่ตรงตัวไม่มีการแยกตัวพิมพ์ใหญ่/พิมพ์เล็ก",
|
|
12
|
+
"searchLoadingMessage": "กำลังค้นหา",
|
|
13
|
+
"searchNoResultsMessage": "ไม่พบผลการค้นหา",
|
|
14
|
+
"searchResultsMessage": "ผลการค้นหาที่ {current} จาก {total}",
|
|
12
15
|
"previousPageTooltip": "หน้าก่อนหน้า",
|
|
13
16
|
"currentPageTooltip": "หน้าปัจจุบัน",
|
|
14
17
|
"nextPageTooltip": "หน้าถัดไป",
|
|
@@ -49,6 +52,8 @@ declare const _default: {
|
|
|
49
52
|
"pageScrollingTooltip": "เปิดใช้การเลื่อนภายในหน้า",
|
|
50
53
|
"verticalScrollingLabel": "การเลื่อนแนวตั้ง",
|
|
51
54
|
"verticalScrollingTooltip": "เปิดใช้การเลื่อนแนวตั้ง",
|
|
55
|
+
"horizontalScrollingLabel": "การเลื่อนแนวนอน",
|
|
56
|
+
"horizontalScrollingTooltip": "เปิดใช้การเลื่อนแนวนอน",
|
|
52
57
|
"horizontalLabel": "การเลื่อนแนวนอน",
|
|
53
58
|
"horizontalTooltip": "เปิดใช้การเลื่อนแนวนอน",
|
|
54
59
|
"wrappedScrollingLabel": "การเลื่อนแบบแรพ",
|
|
@@ -9,6 +9,9 @@ declare const _default: {
|
|
|
9
9
|
"searchMatchCaseTooltip": "搜索区分大小写",
|
|
10
10
|
"searchWholeWordsLabel": "全字匹配",
|
|
11
11
|
"searchWholeWordsTooltip": "搜索完全匹配",
|
|
12
|
+
"searchLoadingMessage": "正在搜索",
|
|
13
|
+
"searchNoResultsMessage": "未找到匹配项",
|
|
14
|
+
"searchResultsMessage": "第 {current} 条,共 {total} 条匹配",
|
|
12
15
|
"previousPageTooltip": "上一页",
|
|
13
16
|
"currentPageTooltip": "当前页",
|
|
14
17
|
"nextPageTooltip": "下一页",
|
|
@@ -49,6 +52,8 @@ declare const _default: {
|
|
|
49
52
|
"pageScrollingTooltip": "启用页面滚动",
|
|
50
53
|
"verticalScrollingLabel": "垂直滚动",
|
|
51
54
|
"verticalScrollingTooltip": "启用垂直滚动",
|
|
55
|
+
"horizontalScrollingLabel": "水平滚动",
|
|
56
|
+
"horizontalScrollingTooltip": "启用水平滚动",
|
|
52
57
|
"horizontalLabel": "水平滚动",
|
|
53
58
|
"horizontalTooltip": "启用水平滚动",
|
|
54
59
|
"wrappedScrollingLabel": "环绕滚动",
|
|
@@ -10,6 +10,7 @@ export declare class Queue<T> {
|
|
|
10
10
|
enqueue(id: string, data: T, priority?: number): void;
|
|
11
11
|
dequeue(): QueueItem<T> | undefined;
|
|
12
12
|
removeQueue(id: string): boolean;
|
|
13
|
+
removeQueues(id: string | RegExp): number;
|
|
13
14
|
changePagePriority(id: string | RegExp, newPriority: number): boolean;
|
|
14
15
|
peekAll(): QueueItem<T>[];
|
|
15
16
|
isEmpty(): boolean;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { NormalizedKeyword } from './types';
|
|
2
2
|
export declare const EMPTY_KEYWORD_REGEXP: NormalizedKeyword;
|
|
3
|
+
export declare const DOCS_URL = "https://www.react-pdf-kit.dev/docs";
|
|
3
4
|
export declare const ORGANIZATION_ALLOWED_FEATURES_MESSAGE = "This feature is only available for the Organization license";
|
|
4
5
|
export declare const INVALID_OR_CORRUPTED_PDF_MESSAGE = "Invalid or corrupted PDF file.";
|
|
5
6
|
export declare const BROWSER_NOT_SUPPORTED_MESSAGE = "React PDF Kit is unable to render on this browser.";
|
|
7
|
+
export declare const WASM_URL_REQUIRED_MESSAGE = "This PDF uses JPEG 2000 images and requires pdf.js WASM assets. Please set wasmUrl in RPConfig.";
|
|
8
|
+
export declare const WASM_URL_REQUIRED_CONSOLE_MESSAGE = "This PDF uses JPEG 2000 images and requires pdf.js WASM assets. Please set wasmUrl in RPConfig. Learn more: https://www.react-pdf-kit.dev/docs/components/rp-config";
|
|
@@ -3,3 +3,12 @@ export declare const THUMBNAIL_MIN_WIDTH = 200;
|
|
|
3
3
|
export declare const SCROLL_BAR_WIDTH = 20;
|
|
4
4
|
export declare const MIN_ZOOM_SCALE = 25;
|
|
5
5
|
export declare const MAX_ZOOM_SCALE = 1000;
|
|
6
|
+
export declare const ZOOM_STEP_PERCENT = 25;
|
|
7
|
+
export declare const VIRTUAL_SCROLL_ROW_OVERSCAN = 2;
|
|
8
|
+
export declare const ZOOM_DEBOUNCE_MS = 400;
|
|
9
|
+
export declare const ZOOM_SAFETY_TIMEOUT_MS = 1000;
|
|
10
|
+
export declare const MAX_CANVAS_DIM = 32767;
|
|
11
|
+
export declare const MAX_CANVAS_PIXELS = 33554432;
|
|
12
|
+
export declare const SAFARI_MAX_CANVAS_PIXELS = 16777216;
|
|
13
|
+
export declare const IOS_MAX_CANVAS_PIXELS = 5242880;
|
|
14
|
+
export declare const CANVAS_AREA_CAP_FACTOR = 200;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ScrollMode, ViewMode } from './types';
|
|
2
|
+
export type DocumentPagePlacement = {
|
|
3
|
+
pageNumber: number;
|
|
4
|
+
rowIndex: number;
|
|
5
|
+
left: number;
|
|
6
|
+
top: number;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
};
|
|
10
|
+
export type DocumentRow = {
|
|
11
|
+
index: number;
|
|
12
|
+
top: number;
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
pageNumbers: number[];
|
|
16
|
+
};
|
|
17
|
+
export type VisibleDocumentRow = DocumentRow & {
|
|
18
|
+
pages: DocumentPagePlacement[];
|
|
19
|
+
};
|
|
20
|
+
export type DocumentLayout = {
|
|
21
|
+
rows: DocumentRow[];
|
|
22
|
+
pages: DocumentPagePlacement[];
|
|
23
|
+
documentWidth: number;
|
|
24
|
+
documentHeight: number;
|
|
25
|
+
offsetLeft: number;
|
|
26
|
+
offsetTop: number;
|
|
27
|
+
scrollWidth: number;
|
|
28
|
+
scrollHeight: number;
|
|
29
|
+
viewportWidth: number;
|
|
30
|
+
viewportHeight: number;
|
|
31
|
+
scrollMode: ScrollMode;
|
|
32
|
+
viewMode: ViewMode;
|
|
33
|
+
};
|
|
34
|
+
export type PageDimensions = {
|
|
35
|
+
widths: number[];
|
|
36
|
+
heights: number[];
|
|
37
|
+
};
|
|
38
|
+
type BuildDocumentLayoutOptions = {
|
|
39
|
+
pageDimensions: PageDimensions;
|
|
40
|
+
viewportWidth: number;
|
|
41
|
+
viewportHeight: number;
|
|
42
|
+
scrollMode: ScrollMode;
|
|
43
|
+
viewMode: ViewMode;
|
|
44
|
+
focusedPage?: number;
|
|
45
|
+
};
|
|
46
|
+
export declare const getPageGroupForPage: (pageNumber: number, viewMode: ViewMode, totalPages: number) => number[];
|
|
47
|
+
export declare const buildDocumentLayout: (options: BuildDocumentLayoutOptions) => DocumentLayout;
|
|
48
|
+
export declare const getPagePlacement: (layout: DocumentLayout, pageNumber: number) => DocumentPagePlacement | null;
|
|
49
|
+
export declare const getPageContentOffset: (pageBoxWidth: number, pageBoxHeight: number, pageWidth: number, pageHeight: number) => {
|
|
50
|
+
x: number;
|
|
51
|
+
y: number;
|
|
52
|
+
};
|
|
53
|
+
export declare const getPageFromDocumentPoint: (layout: DocumentLayout, documentX: number, documentY: number) => DocumentPagePlacement | null;
|
|
54
|
+
export declare const getVisibleRows: (layout: DocumentLayout, scrollTop: number, scrollLeft: number, viewportWidth: number, viewportHeight: number, overscan?: number) => VisibleDocumentRow[];
|
|
55
|
+
export declare const getRowsByIndexes: (layout: DocumentLayout, rowIndexes: number[], pageNumbers?: number[]) => VisibleDocumentRow[];
|
|
56
|
+
export declare const getScrollTargetForPage: (layout: DocumentLayout, pageNumber: number) => {
|
|
57
|
+
left: number;
|
|
58
|
+
top: number;
|
|
59
|
+
} | null;
|
|
60
|
+
export {};
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { ZoomOrigin } from './useZoomOrigin';
|
|
2
|
+
export type PinchZoomGesture = 'touch' | 'wheel';
|
|
3
|
+
export interface PinchZoomMetadata {
|
|
4
|
+
gesture?: PinchZoomGesture;
|
|
5
|
+
previousScale: number;
|
|
6
|
+
nextScale: number;
|
|
7
|
+
origin?: ZoomOrigin;
|
|
8
|
+
}
|
|
9
|
+
interface UsePinchOptions {
|
|
10
|
+
onBeforeZoom?: (metadata: PinchZoomMetadata) => void;
|
|
11
|
+
onPinchEnd?: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const usePinch: (container: HTMLDivElement | null, options?: UsePinchOptions) => void;
|
|
14
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const usePresentPage: (
|
|
1
|
+
import { DocumentLayout } from '../documentLayout';
|
|
2
|
+
export declare const usePresentPage: (element?: HTMLElement, layout?: DocumentLayout) => void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type ZoomOrigin = [number, number];
|
|
2
|
+
export declare const getZoomOriginFromClientPoint: (element: HTMLElement | null, clientX: number, clientY: number) => ZoomOrigin | null;
|
|
3
|
+
export declare const getZoomCenterOrigin: (element: HTMLElement | null) => ZoomOrigin | undefined;
|
|
4
|
+
export declare const useZoomOrigin: (element: HTMLElement | null) => () => ZoomOrigin | undefined;
|
|
@@ -47,7 +47,8 @@ export declare enum AnnotationType {
|
|
|
47
47
|
}
|
|
48
48
|
export declare enum ErrorType {
|
|
49
49
|
NOT_SUPPORTED = "not-supported",
|
|
50
|
-
INVALID_OR_CORRUPTED_PDF = "invalid-or-corrupted-pdf"
|
|
50
|
+
INVALID_OR_CORRUPTED_PDF = "invalid-or-corrupted-pdf",
|
|
51
|
+
WASM_URL_REQUIRED = "wasm-url-required"
|
|
51
52
|
}
|
|
52
53
|
export interface AnnotationEventPayload {
|
|
53
54
|
type: AnnotationType;
|
|
@@ -86,6 +87,9 @@ export type Localization = {
|
|
|
86
87
|
searchMatchCaseTooltip?: string;
|
|
87
88
|
searchWholeWordsLabel?: string;
|
|
88
89
|
searchWholeWordsTooltip?: string;
|
|
90
|
+
searchLoadingMessage?: string;
|
|
91
|
+
searchNoResultsMessage?: string;
|
|
92
|
+
searchResultsMessage?: string;
|
|
89
93
|
previousPageTooltip?: string;
|
|
90
94
|
currentPageTooltip?: string;
|
|
91
95
|
nextPageTooltip?: string;
|
|
@@ -125,6 +129,8 @@ export type Localization = {
|
|
|
125
129
|
pageScrollingTooltip?: string;
|
|
126
130
|
verticalScrollingLabel?: string;
|
|
127
131
|
verticalScrollingTooltip?: string;
|
|
132
|
+
horizontalScrollingLabel?: string;
|
|
133
|
+
horizontalScrollingTooltip?: string;
|
|
128
134
|
horizontalLabel?: string;
|
|
129
135
|
horizontalTooltip?: string;
|
|
130
136
|
singlePageLabel?: string;
|
|
@@ -400,6 +406,7 @@ export declare enum ThemeVariables {
|
|
|
400
406
|
INPUT_BORDER_RADIUS = "--rp-input-border-radius",
|
|
401
407
|
INPUT_BACKGROUND_COLOR = "--rp-input-background-color",
|
|
402
408
|
INPUT_PLACEHOLDER_COLOR = "--rp-input-placeholder-color",
|
|
409
|
+
SEARCH_INPUT_BORDER_COLOR = "--rp-search-input-border-color",
|
|
403
410
|
PAGES_BACKGROUND_COLOR = "--rp-pages-background-color",
|
|
404
411
|
PAGE_SHADOW = "--rp-page-shadow",
|
|
405
412
|
PAGE_OUTLINE = "--rp-page-outline",
|
|
@@ -434,6 +441,7 @@ export declare enum ThemeVariables {
|
|
|
434
441
|
MENU_ITEM_ICON_SIZE = "--rp-menu-item-icon-size",
|
|
435
442
|
PRINT_PROGRESS_BACKGROUND = "--rp-print-progress-background",
|
|
436
443
|
PRINT_PROGRESS_COLOR = "--rp-print-progress-color",
|
|
444
|
+
PRINT_PROGRESS_CANCEL_BUTTON_BORDER_COLOR = "--rp-print-progress-cancel-button-border-color",
|
|
437
445
|
DROP_ZONE_BORDER = "--rp-drop-zone-border",
|
|
438
446
|
DROP_ZONE_FONT_COLOR = "--rp-drop-zone-font-color",
|
|
439
447
|
DROP_ZONE_FONT_SIZE = "--rp-drop-zone-font-size",
|
|
@@ -550,9 +558,20 @@ export interface DimensionPagesContextType {
|
|
|
550
558
|
export interface ZoomContextType {
|
|
551
559
|
zoomLevel: number | ZoomLevel;
|
|
552
560
|
currentZoom: number;
|
|
561
|
+
targetZoom: number;
|
|
562
|
+
isZooming: boolean;
|
|
563
|
+
zoomOrigin: [number, number] | null;
|
|
564
|
+
zoomGesture: 'touch' | 'wheel' | 'toolbar' | null;
|
|
565
|
+
previousTargetZoom: number | null;
|
|
566
|
+
zoomTo: (zoomLevel: number | ZoomLevel, options?: {
|
|
567
|
+
immediate?: boolean;
|
|
568
|
+
origin?: [number, number];
|
|
569
|
+
gesture?: 'touch' | 'wheel' | 'toolbar';
|
|
570
|
+
previousTargetZoom?: number;
|
|
571
|
+
}) => void;
|
|
553
572
|
setZoomLevel: (callback: number | ZoomLevel | ((prev: number) => number | ZoomLevel)) => void;
|
|
554
573
|
}
|
|
555
|
-
export type ZoomProps =
|
|
574
|
+
export type ZoomProps = Pick<ZoomContextType, 'zoomLevel' | 'setZoomLevel'>;
|
|
556
575
|
export type InitialStateContextType = {
|
|
557
576
|
interactiveForm?: boolean;
|
|
558
577
|
} & ZoomProviderProps & PageProviderProps & ViewModeInitialProps & ScrollModeInitialProps & RotateProviderProps;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export declare const isZoomOutDisabled: (currentZoom: number) => boolean;
|
|
2
2
|
export declare const isZoomInDisabled: (currentZoom: number) => boolean;
|
|
3
|
+
export declare const getNextZoomInLevel: (currentZoomPercent: number) => number;
|
|
4
|
+
export declare const getNextZoomOutLevel: (currentZoomPercent: number) => number;
|
package/dist/utils/Queue.js
CHANGED
|
@@ -6,6 +6,7 @@ var e = class {
|
|
|
6
6
|
this._triggerEnqueue = e;
|
|
7
7
|
}
|
|
8
8
|
enqueue(e, t, n = 0) {
|
|
9
|
+
this.removeQueue(e);
|
|
9
10
|
let r = {
|
|
10
11
|
id: e,
|
|
11
12
|
data: t,
|
|
@@ -20,6 +21,10 @@ var e = class {
|
|
|
20
21
|
let t = this._items.findIndex((t) => t.id === e);
|
|
21
22
|
return t === -1 ? !1 : (this._items.splice(t, 1), !0);
|
|
22
23
|
}
|
|
24
|
+
removeQueues(e) {
|
|
25
|
+
let t = new RegExp(e), n = this._items.length;
|
|
26
|
+
return this._items = this._items.filter((e) => !t.test(e.id)), n - this._items.length;
|
|
27
|
+
}
|
|
23
28
|
changePagePriority(e, t) {
|
|
24
29
|
let n = this._items.find((t) => new RegExp(e).test(t.id));
|
|
25
30
|
return n ? (this.removeQueue(n.id), this.enqueue(n.id, n.data, t), !0) : !1;
|
package/dist/utils/const.js
CHANGED
|
@@ -3,6 +3,6 @@ var e = {
|
|
|
3
3
|
keyword: "",
|
|
4
4
|
regExp: /* @__PURE__ */ RegExp(" "),
|
|
5
5
|
wholeWords: !1
|
|
6
|
-
}, t = "This feature is only available for the Organization license",
|
|
6
|
+
}, t = "https://www.react-pdf-kit.dev/docs", n = "This feature is only available for the Organization license", r = "Invalid or corrupted PDF file.", i = "React PDF Kit is unable to render on this browser.", a = "This PDF uses JPEG 2000 images and requires pdf.js WASM assets. Please set wasmUrl in RPConfig.", o = `${a} Learn more: ${t}/components/rp-config`;
|
|
7
7
|
//#endregion
|
|
8
|
-
export {
|
|
8
|
+
export { i as BROWSER_NOT_SUPPORTED_MESSAGE, t as DOCS_URL, e as EMPTY_KEYWORD_REGEXP, r as INVALID_OR_CORRUPTED_PDF_MESSAGE, n as ORGANIZATION_ALLOWED_FEATURES_MESSAGE, o as WASM_URL_REQUIRED_CONSOLE_MESSAGE, a as WASM_URL_REQUIRED_MESSAGE };
|
package/dist/utils/constants.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
//#region lib/utils/constants.ts
|
|
2
|
-
var e = 4, t = 200, n = 20, r = 25, i = 1e3;
|
|
2
|
+
var e = 4, t = 200, n = 20, r = 25, i = 1e3, a = 25, o = 2, s = 400, c = 1e3, l = 32767, u = 33554432, d = 16777216, f = 5242880, p = 200;
|
|
3
3
|
//#endregion
|
|
4
|
-
export { i as MAX_ZOOM_SCALE, r as MIN_ZOOM_SCALE, e as PAGE_PADDING, n as SCROLL_BAR_WIDTH, t as THUMBNAIL_MIN_WIDTH };
|
|
4
|
+
export { p as CANVAS_AREA_CAP_FACTOR, f as IOS_MAX_CANVAS_PIXELS, l as MAX_CANVAS_DIM, u as MAX_CANVAS_PIXELS, i as MAX_ZOOM_SCALE, r as MIN_ZOOM_SCALE, e as PAGE_PADDING, d as SAFARI_MAX_CANVAS_PIXELS, n as SCROLL_BAR_WIDTH, t as THUMBNAIL_MIN_WIDTH, o as VIRTUAL_SCROLL_ROW_OVERSCAN, s as ZOOM_DEBOUNCE_MS, c as ZOOM_SAFETY_TIMEOUT_MS, a as ZOOM_STEP_PERCENT };
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { ScrollMode as e, ViewMode as t } from "./types.js";
|
|
2
|
+
//#region lib/utils/documentLayout.ts
|
|
3
|
+
var n = (e, t) => Math.max(0, (e - t) / 2), r = .5, i = (e, t, i) => {
|
|
4
|
+
let a = n(e, i), o = Math.max(0, e - t);
|
|
5
|
+
return Math.max(0, a - o * r);
|
|
6
|
+
}, a = (e) => e.reduce((e, t) => e + t, 0), o = (e) => Math.min(e.widths.length, e.heights.length), s = (e) => e === "WRAPPED", c = (e, t) => {
|
|
7
|
+
let n = t - 1;
|
|
8
|
+
return {
|
|
9
|
+
width: e.widths[n] || 0,
|
|
10
|
+
height: e.heights[n] || 0
|
|
11
|
+
};
|
|
12
|
+
}, l = (e, n, r) => {
|
|
13
|
+
if (!r) return [];
|
|
14
|
+
let i = Math.max(1, Math.min(e, r));
|
|
15
|
+
if (n === t.DUAL_PAGE) {
|
|
16
|
+
let e = Math.floor((i - 1) / 2) * 2 + 1;
|
|
17
|
+
return [e, e + 1].filter((e) => e <= r);
|
|
18
|
+
}
|
|
19
|
+
if (n === t.DUAL_PAGE_WITH_COVER) {
|
|
20
|
+
if (i === 1) return [1];
|
|
21
|
+
let e = Math.floor((i - 2) / 2) * 2 + 2;
|
|
22
|
+
return [e, e + 1].filter((e) => e <= r);
|
|
23
|
+
}
|
|
24
|
+
return [i];
|
|
25
|
+
}, u = (e, t) => {
|
|
26
|
+
let n = t.map((t) => c(e, t));
|
|
27
|
+
return {
|
|
28
|
+
pageNumbers: t,
|
|
29
|
+
width: a(n.map((e) => e.width)),
|
|
30
|
+
height: Math.max(...n.map((e) => e.height), 0)
|
|
31
|
+
};
|
|
32
|
+
}, d = (e, n) => {
|
|
33
|
+
let r = o(e), i = [];
|
|
34
|
+
if (n === t.DUAL_PAGE) {
|
|
35
|
+
for (let t = 1; t <= r; t += 2) i.push(u(e, [t, t + 1].filter((e) => e <= r)));
|
|
36
|
+
return i;
|
|
37
|
+
}
|
|
38
|
+
if (n === t.DUAL_PAGE_WITH_COVER) {
|
|
39
|
+
r >= 1 && i.push(u(e, [1]));
|
|
40
|
+
for (let t = 2; t <= r; t += 2) i.push(u(e, [t, t + 1].filter((e) => e <= r)));
|
|
41
|
+
return i;
|
|
42
|
+
}
|
|
43
|
+
for (let t = 1; t <= r; t += 1) i.push(u(e, [t]));
|
|
44
|
+
return i;
|
|
45
|
+
}, f = (e, t) => {
|
|
46
|
+
let n = o(e), r = Math.max(t, 1), i = [], a = [], s = 0;
|
|
47
|
+
for (let t = 1; t <= n; t += 1) {
|
|
48
|
+
let { width: n } = c(e, t);
|
|
49
|
+
a.length > 0 && s + n > r && (i.push(u(e, a)), a = [], s = 0), a.push(t), s += n;
|
|
50
|
+
}
|
|
51
|
+
return a.length && i.push(u(e, a)), i;
|
|
52
|
+
}, p = ({ pageDimensions: t, viewportWidth: n, scrollMode: r, viewMode: i, focusedPage: a }) => {
|
|
53
|
+
let c = o(t);
|
|
54
|
+
return c ? r === e.PAGE_SCROLLING ? [u(t, l(a || 1, i, c))] : r === e.HORIZONTAL_SCROLLING ? [u(t, Array.from({ length: c }, (e, t) => t + 1))] : s(r) ? f(t, n) : d(t, i) : [];
|
|
55
|
+
}, m = (t) => {
|
|
56
|
+
let { pageDimensions: r, viewportWidth: a, viewportHeight: o, scrollMode: l, viewMode: u } = t, d = p(t), f = s(l) ? Math.max(a, ...d.map((e) => e.width), 0) : Math.max(...d.map((e) => e.width), 0), m = [], h = [], g = 0;
|
|
57
|
+
d.forEach((t, o) => {
|
|
58
|
+
let u = s(l) ? Math.max(f, t.width) : t.width, d = {
|
|
59
|
+
index: o,
|
|
60
|
+
top: g,
|
|
61
|
+
width: u,
|
|
62
|
+
height: t.height,
|
|
63
|
+
pageNumbers: t.pageNumbers
|
|
64
|
+
}, p = l !== e.HORIZONTAL_SCROLLING && !s(l) && t.width < f ? i(f, a, t.width) : n(f, t.width);
|
|
65
|
+
t.pageNumbers.forEach((e) => {
|
|
66
|
+
let { width: t, height: n } = c(r, e);
|
|
67
|
+
h.push({
|
|
68
|
+
pageNumber: e,
|
|
69
|
+
rowIndex: o,
|
|
70
|
+
left: p,
|
|
71
|
+
top: g,
|
|
72
|
+
width: t,
|
|
73
|
+
height: n
|
|
74
|
+
}), p += t;
|
|
75
|
+
}), m.push(d), g += t.height;
|
|
76
|
+
});
|
|
77
|
+
let _ = g, v = l === e.HORIZONTAL_SCROLLING ? 0 : n(a, f), y = l === e.PAGE_SCROLLING || l === e.HORIZONTAL_SCROLLING ? n(o, _) : 0;
|
|
78
|
+
return {
|
|
79
|
+
rows: m,
|
|
80
|
+
pages: h,
|
|
81
|
+
documentWidth: f,
|
|
82
|
+
documentHeight: _,
|
|
83
|
+
offsetLeft: v,
|
|
84
|
+
offsetTop: y,
|
|
85
|
+
scrollWidth: Math.max(a, v + f),
|
|
86
|
+
scrollHeight: Math.max(o, y + _),
|
|
87
|
+
viewportWidth: a,
|
|
88
|
+
viewportHeight: o,
|
|
89
|
+
scrollMode: l,
|
|
90
|
+
viewMode: u
|
|
91
|
+
};
|
|
92
|
+
}, h = (e, t) => e.pages.find((e) => e.pageNumber === t) ?? null, g = (e, t, r, i) => ({
|
|
93
|
+
x: n(e, r),
|
|
94
|
+
y: n(t, i)
|
|
95
|
+
}), _ = (e, t, n) => {
|
|
96
|
+
let r = e.rows.find((e) => n >= e.top && n <= e.top + e.height) ?? e.rows.reduce((e, t) => {
|
|
97
|
+
if (!e) return t;
|
|
98
|
+
let r = e.top + e.height / 2, i = t.top + t.height / 2;
|
|
99
|
+
return Math.abs(n - i) < Math.abs(n - r) ? t : e;
|
|
100
|
+
}, null);
|
|
101
|
+
if (!r) return null;
|
|
102
|
+
let i = e.pages.filter((e) => e.rowIndex === r.index);
|
|
103
|
+
return i.find((e) => t >= e.left && t <= e.left + e.width && n >= e.top && n <= e.top + e.height) || i.reduce((e, n) => {
|
|
104
|
+
if (!e) return n;
|
|
105
|
+
let r = e.left + e.width / 2, i = n.left + n.width / 2;
|
|
106
|
+
return Math.abs(t - i) < Math.abs(t - r) ? n : e;
|
|
107
|
+
}, null);
|
|
108
|
+
}, v = (e, t, n, r, i, a = 1) => {
|
|
109
|
+
let o = t - e.offsetTop, s = o + i, c = n - e.offsetLeft, l = c + r, u = e.rows.filter((e) => e.top + e.height >= o && e.top <= s), d = u[0]?.index ?? 0, f = u[u.length - 1]?.index ?? d, p = Math.max(0, d - a), m = Math.min(e.rows.length - 1, f + a), h = r * Math.max(1, a), g = e.pages.reduce((e, t) => {
|
|
110
|
+
let n = e.get(t.rowIndex);
|
|
111
|
+
return n ? n.push(t) : e.set(t.rowIndex, [t]), e;
|
|
112
|
+
}, /* @__PURE__ */ new Map());
|
|
113
|
+
return e.rows.slice(p, m + 1).map((e) => ({
|
|
114
|
+
...e,
|
|
115
|
+
pages: (g.get(e.index) ?? []).filter((e) => {
|
|
116
|
+
let t = e.left + e.width, n = e.top + e.height;
|
|
117
|
+
return t >= c - h && e.left <= l + h && n >= o && e.top <= s;
|
|
118
|
+
})
|
|
119
|
+
}));
|
|
120
|
+
}, y = (e, t, n) => {
|
|
121
|
+
let r = new Set(t), i = n ? new Set(n) : null, a = e.pages.reduce((e, t) => {
|
|
122
|
+
if (i && !i.has(t.pageNumber)) return e;
|
|
123
|
+
let n = e.get(t.rowIndex);
|
|
124
|
+
return n ? n.push(t) : e.set(t.rowIndex, [t]), e;
|
|
125
|
+
}, /* @__PURE__ */ new Map());
|
|
126
|
+
return e.rows.filter((e) => r.has(e.index)).map((e) => ({
|
|
127
|
+
...e,
|
|
128
|
+
pages: a.get(e.index) ?? []
|
|
129
|
+
}));
|
|
130
|
+
}, b = (t, n) => {
|
|
131
|
+
let r = h(t, n);
|
|
132
|
+
return r ? t.scrollMode === e.HORIZONTAL_SCROLLING ? {
|
|
133
|
+
left: t.offsetLeft + r.left,
|
|
134
|
+
top: 0
|
|
135
|
+
} : (t.scrollMode, e.PAGE_SCROLLING, {
|
|
136
|
+
left: t.offsetLeft + r.left,
|
|
137
|
+
top: t.offsetTop + r.top
|
|
138
|
+
}) : null;
|
|
139
|
+
};
|
|
140
|
+
//#endregion
|
|
141
|
+
export { m as buildDocumentLayout, g as getPageContentOffset, _ as getPageFromDocumentPoint, l as getPageGroupForPage, h as getPagePlacement, y as getRowsByIndexes, b as getScrollTargetForPage, v as getVisibleRows };
|
|
@@ -3,7 +3,7 @@ import { LicenseType as t } from "../types.js";
|
|
|
3
3
|
import { appConsole as n } from "../appConsole.js";
|
|
4
4
|
import { useCallback as r, useEffect as i, useState as a } from "react";
|
|
5
5
|
//#region lib/utils/hooks/useLicense.ts
|
|
6
|
-
var o = /* @__PURE__ */ new Date("2026-
|
|
6
|
+
var o = /* @__PURE__ */ new Date("2026-07-31T06:54:28.636Z"), s = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvIokvErJ0Fctu0jduSAx\ngr+5Har/VSuZLlOunS28hnlqqA+OF1apHL7RYkjBosS15yvviYdLrVWYHpHnoY4b\nHLQ9I6YX6FMB9T/VbB4xLdVdKvfi8r49aTScl5EKuSpgpPgz2VSJTfvVGcRuth/Y\nBm7PPGYdL2l2gvKDxchmmsHFPukGki9L4JOUeIVX0GXAxabENckaEH/iC1NZhX+W\nvXnpHeHuIIKlZ16LSivXNgo6BH2Z3GFdg4G3cAaXr6qNP8fsacYNqv2SpTW1viFD\nvzcGRabN25gpJAp9/syeScefWH3OiJY1lmw88oTiJbjIoiq6AkPhfn3G9mF54nvR\nkwIDAQAB\n-----END PUBLIC KEY-----", c = "Please visit https://app.react-pdf-kit.dev to generate a new license key.", l = {
|
|
7
7
|
invalidLicense: `You are currently using without a valid license. ${c}`,
|
|
8
8
|
mismatchedDomain: `Your license key is not valid for the current domain / IP. ${c}`,
|
|
9
9
|
expired: `Your license key has expired. ${c}`,
|