@vue-pdf-viewer/viewer 3.0.0-alpha.3 → 3.0.0-alpha.30

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.
Files changed (187) hide show
  1. package/dist/annotation-font-Dz5-utxy.js +21 -0
  2. package/dist/annotation-font-style-italic-DrQU7N-a.js +21 -0
  3. package/dist/annotation-font-style-underline-D7zPcuK6.js +21 -0
  4. package/dist/annotation-font-weight-bold-Ba2Ix8G4.js +23 -0
  5. package/dist/index.js +16150 -13316
  6. package/dist/index.umd.cjs +23 -22
  7. package/dist/types/assets/pdf-annotations/index.d.ts +2 -0
  8. package/dist/types/components/AppButton.vue.d.ts +18 -0
  9. package/dist/types/components/AppFormControl.vue.d.ts +30 -0
  10. package/dist/types/components/AppIcon.vue.d.ts +15 -0
  11. package/dist/types/components/AppInput.vue.d.ts +12 -0
  12. package/dist/types/components/AppLoader.vue.d.ts +19 -0
  13. package/dist/types/components/AppPopover.vue.d.ts +93 -0
  14. package/dist/types/components/AppTooltip.vue.d.ts +34 -0
  15. package/dist/types/components/ColorButton.vue.d.ts +15 -0
  16. package/dist/types/components/DragFileMask.vue.d.ts +55 -0
  17. package/dist/types/components/FreeTextPanel.vue.d.ts +2 -0
  18. package/dist/types/components/FreeTextPanelFontColors.vue.d.ts +2 -0
  19. package/dist/types/components/FreeTextPanelFontFamilySelector.vue.d.ts +2 -0
  20. package/dist/types/components/FreeTextPanelFontSizeSelector.vue.d.ts +2 -0
  21. package/dist/types/components/FreeTextPanelTextStyle.vue.d.ts +2 -0
  22. package/dist/types/components/HighlightColorPicker.vue.d.ts +2 -0
  23. package/dist/types/components/LayerAnnotation.vue.d.ts +47 -0
  24. package/dist/types/components/LayerAnnotationEditor.vue.d.ts +26 -0
  25. package/dist/types/components/LayerAnnotationEditorFreeText.vue.d.ts +37 -0
  26. package/dist/types/components/LayerAnnotationEditorFreeTextItem.vue.d.ts +33 -0
  27. package/dist/types/components/LayerAnnotationEditorHighlight.vue.d.ts +37 -0
  28. package/dist/types/components/LayerAnnotationEditorHighlightItem.vue.d.ts +26 -0
  29. package/dist/types/components/LayerAnnotationEditorImage.vue.d.ts +28 -0
  30. package/dist/types/components/LayerAnnotationStampResizer.vue.d.ts +28 -0
  31. package/dist/types/components/LayerCanvas.vue.d.ts +25 -0
  32. package/dist/types/components/LayerText.vue.d.ts +30 -0
  33. package/dist/types/components/LayerTextHighlight.vue.d.ts +20 -0
  34. package/dist/types/components/LayerTextSearchHighlight.vue.d.ts +19 -0
  35. package/dist/types/components/LayerXFA.vue.d.ts +23 -0
  36. package/dist/types/components/ModalPassword.vue.d.ts +19 -0
  37. package/dist/types/components/ModalPdfProperties.vue.d.ts +18 -0
  38. package/dist/types/components/ModalPrintLoadingProgress.vue.d.ts +20 -0
  39. package/dist/types/components/Signatures.vue.d.ts +2 -0
  40. package/dist/types/components/SwitchAppearance.vue.d.ts +23 -0
  41. package/dist/types/components/ToolCommentPanel.vue.d.ts +31 -0
  42. package/dist/types/components/ToolDownload.vue.d.ts +21 -0
  43. package/dist/types/components/ToolFullscreen.vue.d.ts +22 -0
  44. package/dist/types/components/ToolMenuOthers.vue.d.ts +88 -0
  45. package/dist/types/components/ToolMenuOthersMobile.vue.d.ts +21 -0
  46. package/dist/types/components/ToolOpenFile.vue.d.ts +21 -0
  47. package/dist/types/components/ToolOpenFileInput.vue.d.ts +11 -0
  48. package/dist/types/components/ToolPagination.vue.d.ts +68 -0
  49. package/dist/types/components/ToolPrint.vue.d.ts +35 -0
  50. package/dist/types/components/ToolSearch.vue.d.ts +73 -0
  51. package/dist/types/components/ToolThumbnail.vue.d.ts +43 -0
  52. package/dist/types/components/ToolZoom.vue.d.ts +55 -0
  53. package/dist/types/components/ToolZoomPercentageMenu.vue.d.ts +25 -0
  54. package/dist/types/components/VPdfComments.vue.d.ts +28 -0
  55. package/dist/types/components/VPdfCommentsDate.vue.d.ts +15 -0
  56. package/dist/types/components/VPdfCommentsHeader.vue.d.ts +16 -0
  57. package/dist/types/components/VPdfCommentsIcon.vue.d.ts +16 -0
  58. package/dist/types/components/VPdfCommentsReplies.vue.d.ts +16 -0
  59. package/dist/types/components/VPdfCommentsSidebar.vue.d.ts +15 -0
  60. package/dist/types/components/VPdfCommentsText.vue.d.ts +2 -0
  61. package/dist/types/components/VPdfPage.vue.d.ts +44 -0
  62. package/dist/types/components/VPdfSplitter.vue.d.ts +2 -0
  63. package/dist/types/components/VPdfThumbnail.vue.d.ts +26 -0
  64. package/dist/types/components/VPdfThumbnails.vue.d.ts +22 -0
  65. package/dist/types/components/VPdfViewer.vue.d.ts +606 -0
  66. package/dist/types/components/index.d.ts +4 -0
  67. package/dist/types/components/ui/button/Button.vue.d.ts +52 -0
  68. package/dist/types/components/ui/button/index.d.ts +7 -0
  69. package/dist/types/components/ui/checkbox/Checkbox.vue.d.ts +35 -0
  70. package/dist/types/components/ui/checkbox/index.d.ts +1 -0
  71. package/dist/types/components/ui/collapsible/Collapsible.vue.d.ts +30 -0
  72. package/dist/types/components/ui/collapsible/CollapsibleContent.vue.d.ts +28 -0
  73. package/dist/types/components/ui/collapsible/CollapsibleTrigger.vue.d.ts +28 -0
  74. package/dist/types/components/ui/collapsible/index.d.ts +3 -0
  75. package/dist/types/components/ui/dialog/Dialog.vue.d.ts +28 -0
  76. package/dist/types/components/ui/dialog/DialogClose.vue.d.ts +28 -0
  77. package/dist/types/components/ui/dialog/DialogContent.vue.d.ts +35 -0
  78. package/dist/types/components/ui/dialog/DialogDescription.vue.d.ts +35 -0
  79. package/dist/types/components/ui/dialog/DialogFooter.vue.d.ts +34 -0
  80. package/dist/types/components/ui/dialog/DialogHeader.vue.d.ts +34 -0
  81. package/dist/types/components/ui/dialog/DialogTitle.vue.d.ts +35 -0
  82. package/dist/types/components/ui/dialog/DialogTrigger.vue.d.ts +28 -0
  83. package/dist/types/components/ui/dialog/index.d.ts +8 -0
  84. package/dist/types/components/ui/dropdown-menu/DropdownMenu.vue.d.ts +28 -0
  85. package/dist/types/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue.d.ts +35 -0
  86. package/dist/types/components/ui/dropdown-menu/DropdownMenuContent.vue.d.ts +52 -0
  87. package/dist/types/components/ui/dropdown-menu/DropdownMenuGroup.vue.d.ts +28 -0
  88. package/dist/types/components/ui/dropdown-menu/DropdownMenuItem.vue.d.ts +41 -0
  89. package/dist/types/components/ui/dropdown-menu/DropdownMenuLabel.vue.d.ts +38 -0
  90. package/dist/types/components/ui/dropdown-menu/DropdownMenuRadioGroup.vue.d.ts +28 -0
  91. package/dist/types/components/ui/dropdown-menu/DropdownMenuRadioItem.vue.d.ts +38 -0
  92. package/dist/types/components/ui/dropdown-menu/DropdownMenuSeparator.vue.d.ts +17 -0
  93. package/dist/types/components/ui/dropdown-menu/DropdownMenuShortcut.vue.d.ts +34 -0
  94. package/dist/types/components/ui/dropdown-menu/DropdownMenuSub.vue.d.ts +28 -0
  95. package/dist/types/components/ui/dropdown-menu/DropdownMenuSubContent.vue.d.ts +35 -0
  96. package/dist/types/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue.d.ts +35 -0
  97. package/dist/types/components/ui/dropdown-menu/DropdownMenuTrigger.vue.d.ts +28 -0
  98. package/dist/types/components/ui/dropdown-menu/index.d.ts +15 -0
  99. package/dist/types/components/ui/input/Input.vue.d.ts +16 -0
  100. package/dist/types/components/ui/input/index.d.ts +7 -0
  101. package/dist/types/components/ui/popover/Popover.vue.d.ts +28 -0
  102. package/dist/types/components/ui/popover/PopoverContent.vue.d.ts +64 -0
  103. package/dist/types/components/ui/popover/PopoverTrigger.vue.d.ts +28 -0
  104. package/dist/types/components/ui/popover/index.d.ts +3 -0
  105. package/dist/types/components/ui/progress/Progress.vue.d.ts +28 -0
  106. package/dist/types/components/ui/progress/index.d.ts +1 -0
  107. package/dist/types/components/ui/select/Select.vue.d.ts +28 -0
  108. package/dist/types/components/ui/select/SelectContent.vue.d.ts +55 -0
  109. package/dist/types/components/ui/select/SelectGroup.vue.d.ts +35 -0
  110. package/dist/types/components/ui/select/SelectItem.vue.d.ts +35 -0
  111. package/dist/types/components/ui/select/SelectItemText.vue.d.ts +28 -0
  112. package/dist/types/components/ui/select/SelectLabel.vue.d.ts +35 -0
  113. package/dist/types/components/ui/select/SelectScrollDownButton.vue.d.ts +35 -0
  114. package/dist/types/components/ui/select/SelectScrollUpButton.vue.d.ts +35 -0
  115. package/dist/types/components/ui/select/SelectSeparator.vue.d.ts +17 -0
  116. package/dist/types/components/ui/select/SelectTrigger.vue.d.ts +35 -0
  117. package/dist/types/components/ui/select/SelectValue.vue.d.ts +28 -0
  118. package/dist/types/components/ui/select/index.d.ts +11 -0
  119. package/dist/types/components/ui/toast/Toast.vue.d.ts +28 -0
  120. package/dist/types/components/ui/toast/ToastAction.vue.d.ts +35 -0
  121. package/dist/types/components/ui/toast/ToastClose.vue.d.ts +17 -0
  122. package/dist/types/components/ui/toast/ToastDescription.vue.d.ts +35 -0
  123. package/dist/types/components/ui/toast/ToastProvider.vue.d.ts +28 -0
  124. package/dist/types/components/ui/toast/ToastTitle.vue.d.ts +35 -0
  125. package/dist/types/components/ui/toast/ToastViewport.vue.d.ts +17 -0
  126. package/dist/types/components/ui/toast/Toaster.vue.d.ts +2 -0
  127. package/dist/types/components/ui/toast/index.d.ts +21 -0
  128. package/dist/types/components/ui/toast/use-toast.d.ts +272 -0
  129. package/dist/types/components/ui/tooltip/Tooltip.vue.d.ts +28 -0
  130. package/dist/types/components/ui/tooltip/TooltipContent.vue.d.ts +52 -0
  131. package/dist/types/components/ui/tooltip/TooltipProvider.vue.d.ts +28 -0
  132. package/dist/types/components/ui/tooltip/TooltipTrigger.vue.d.ts +28 -0
  133. package/dist/types/components/ui/tooltip/index.d.ts +4 -0
  134. package/dist/types/components/utils/annotations.d.ts +5 -0
  135. package/dist/types/components/utils/destination.d.ts +7 -0
  136. package/dist/types/components/utils/helpers.d.ts +2 -0
  137. package/dist/types/components/utils/link_service.d.ts +71 -0
  138. package/dist/types/components/utils/sanitizeExternalURL.d.ts +1 -0
  139. package/dist/types/composables/__mocks__/useLicense.d.ts +12 -0
  140. package/dist/types/composables/useAnnotationDrag.d.ts +72 -0
  141. package/dist/types/composables/useAnnotationFreeText.d.ts +1542 -0
  142. package/dist/types/composables/useAnnotationHighlight.d.ts +389 -0
  143. package/dist/types/composables/useAnnotationStamp.d.ts +513 -0
  144. package/dist/types/composables/useAnnotationStorage.d.ts +72 -0
  145. package/dist/types/composables/useCommandHistory.d.ts +6 -0
  146. package/dist/types/composables/useDownload.d.ts +13 -0
  147. package/dist/types/composables/useHighlight.d.ts +11 -0
  148. package/dist/types/composables/useLicense.d.ts +22 -0
  149. package/dist/types/composables/usePdf.d.ts +28 -0
  150. package/dist/types/composables/usePdfComments.d.ts +5 -0
  151. package/dist/types/composables/usePdfPagesSizes.d.ts +8 -0
  152. package/dist/types/composables/usePdfProperties.d.ts +10 -0
  153. package/dist/types/composables/usePinch.d.ts +3 -0
  154. package/dist/types/composables/usePlugins.d.ts +252 -0
  155. package/dist/types/composables/usePrintControl.d.ts +22 -0
  156. package/dist/types/composables/usePrintProcess.d.ts +8 -0
  157. package/dist/types/composables/useRenderQueue.d.ts +13 -0
  158. package/dist/types/composables/useRequestAnimationFrame.d.ts +1 -0
  159. package/dist/types/composables/useRotation.d.ts +7 -0
  160. package/dist/types/composables/useScale.d.ts +21 -0
  161. package/dist/types/composables/useSearch.d.ts +5 -0
  162. package/dist/types/composables/useTextLayers.d.ts +5 -0
  163. package/dist/types/composables/useVirtualPages.d.ts +32 -0
  164. package/dist/types/composables/useVisibilities.d.ts +9 -0
  165. package/dist/types/const.d.ts +151 -0
  166. package/dist/types/index.d.ts +8 -0
  167. package/dist/types/utils/annotation-command.d.ts +18 -0
  168. package/dist/types/utils/annotation-display.d.ts +28 -0
  169. package/dist/types/utils/annotation-free-text.d.ts +3 -0
  170. package/dist/types/utils/annotation-highlight.d.ts +100 -0
  171. package/dist/types/utils/annotation-image.d.ts +111 -0
  172. package/dist/types/utils/annotation-pdf.d.ts +35 -0
  173. package/dist/types/utils/appConsole.d.ts +24 -0
  174. package/dist/types/utils/characters.d.ts +16 -0
  175. package/dist/types/utils/color.d.ts +4 -0
  176. package/dist/types/utils/convertPDFDate.d.ts +1 -0
  177. package/dist/types/utils/enumerators.d.ts +81 -0
  178. package/dist/types/utils/highlight.d.ts +8 -0
  179. package/dist/types/utils/historyManager.d.ts +55 -0
  180. package/dist/types/utils/promiseWithResolvers.d.ts +7 -0
  181. package/dist/types/utils/searchHighlight.d.ts +10 -0
  182. package/dist/types/utils/smoothScroll.d.ts +2 -0
  183. package/dist/types/utils/types.d.ts +741 -0
  184. package/dist/types/utils/uiViewer.d.ts +4 -0
  185. package/dist/types/utils/validators.d.ts +26 -0
  186. package/dist/types/utils.d.ts +21 -0
  187. package/package.json +7 -7
@@ -0,0 +1,28 @@
1
+ import { PDFPageProxy } from 'pdfjs-dist';
2
+ import { Annotation } from './types';
3
+ /**
4
+ * Scale factors for the canvas, necessary with HiDPI displays.
5
+ */
6
+ export declare class OutputScale {
7
+ sx: number;
8
+ sy: number;
9
+ constructor();
10
+ /**
11
+ * @type {boolean} Returns `true` when scaling is required, `false` otherwise.
12
+ */
13
+ get scaled(): boolean;
14
+ /**
15
+ * @type {boolean} Returns `true` when scaling is symmetric,
16
+ * `false` otherwise.
17
+ */
18
+ get symmetric(): boolean;
19
+ /**
20
+ * @returns {boolean} Returns `true` if scaling was limited,
21
+ * `false` otherwise.
22
+ */
23
+ limitCanvas(width: number, height: number, maxPixels: number, maxDim: number, capAreaFactor?: number): boolean;
24
+ static get pixelRatio(): number;
25
+ static capPixels(maxPixels: number, capAreaFactor: number): number;
26
+ }
27
+ export declare const getBaseTranslation: (parentDimensions: [number, number], rotation: number, outlineWidth?: number) => [number, number];
28
+ export declare function setAnnotationPosition(page: PDFPageProxy, annotationElement: any, annotation: Annotation): void;
@@ -0,0 +1,3 @@
1
+ export declare function getFreeTextFontSize(fontSize: number): string;
2
+ export declare function getFreeTextFontFamily(fontName: string): string;
3
+ export declare function replaceNewlinesWithBackslashN(contentEditableElement: HTMLDivElement): string;
@@ -0,0 +1,100 @@
1
+ import type { PageViewport } from 'pdfjs-dist';
2
+ import type { RectBox } from './types';
3
+ export declare function calculateBoundingBox(boxes: RectBox[]): [number, number, number, number];
4
+ export declare function createSVGPathFromQuadPoints(quadPoints: number[], viewport: PageViewport): string;
5
+ declare class HighlightOutline {
6
+ #private;
7
+ constructor(outlines: any[], box: Float32Array, lastPoint: any[]);
8
+ get outlines(): any[];
9
+ toSVGPath(): string;
10
+ /**
11
+ * Serialize the outlines into the PDF page coordinate system.
12
+ * @param {Array<number>} _bbox - the bounding box of the annotation.
13
+ * @param {number} _rotation - the rotation of the annotation.
14
+ * @returns {Array<Array<number>>}
15
+ */
16
+ serialize([blX, blY, trX, trY]: [number, number, number, number], _rotation: number): any[][];
17
+ get box(): Float32Array;
18
+ }
19
+ export declare function getHighlightOutlineCreator(boxes: RectBox[], options?: {
20
+ borderWidth: number;
21
+ innerMargin: number;
22
+ isLTR: boolean;
23
+ }): {
24
+ box: Float32Array;
25
+ getOutlines: () => HighlightOutline;
26
+ };
27
+ export declare function quadPointsToBoxes(quadPoints: number[], rect: number[], pageWidth: number, pageHeight: number, pageX?: number, pageY?: number): {
28
+ x: number;
29
+ y: number;
30
+ width: number;
31
+ height: number;
32
+ }[];
33
+ export declare function quadPointsToBoxesForRect(quadPoints: number[], rect: number[]): {
34
+ x: number;
35
+ y: number;
36
+ width: number;
37
+ height: number;
38
+ }[];
39
+ /**
40
+ * Get selection boxes from text layer with proper rotation handling.
41
+ * Adapted from PDF.js display/editor/tools.js
42
+ * @param {HTMLElement} textLayer - The text layer element
43
+ * @returns {Array<{x: number, y: number, width: number, height: number}>|null} Normalized boxes or null
44
+ */
45
+ export declare function getSelectionBoxes(textLayer: HTMLElement): {
46
+ x: number;
47
+ y: number;
48
+ width: number;
49
+ height: number;
50
+ }[] | null;
51
+ /**
52
+ * Convert selection boxes to PDF quadPoints
53
+ * @param {Array<{x: number, y: number, width: number, height: number}>} boxes - Normalized boxes (0-1 range)
54
+ * @param {PageViewport} viewport - PDF page viewport
55
+ * @returns {number[]} Array of quadPoints in PDF coordinate system
56
+ */
57
+ /**
58
+ * Convert selection boxes to PDF quadPoints coordinates
59
+ *
60
+ * In PDF, quadPoints are used to define the coordinates of a quadrilateral.
61
+ * Each quadrilateral requires 8 numbers representing 4 points (x,y pairs).
62
+ * The points MUST be specified in the following order (x,y pairs):
63
+ * - (x1,y1): left x, bottom y - bottom left
64
+ * - (x2,y2): right x, bottom y - bottom right
65
+ * - (x3,y3): left x, top y - top left
66
+ * - (x4,y4): right x, top y - top right
67
+ *
68
+ * This order is based on PDF.js implementation and real-world PDF files,
69
+ * which differs slightly from the PDF specification (which suggests a different order).
70
+ *
71
+ * @param boxes Array of normalized boxes (coordinates in 0-1 range)
72
+ * @param viewport PDF page viewport for coordinate conversion
73
+ * @returns Array of quadPoints in PDF coordinate system
74
+ * @throws Error if boxes array is empty
75
+ */
76
+ export declare function boxesToQuadPoints(boxes: Array<{
77
+ x: number;
78
+ y: number;
79
+ width: number;
80
+ height: number;
81
+ }>, viewport: PageViewport): number[];
82
+ /**
83
+ * Convert PDF quadPoints back to viewport boxes
84
+ * @param {number[]} quadPoints - Array of quadPoints in PDF coordinate system
85
+ * @param {PageViewport} viewport - PDF page viewport
86
+ * @returns {Array<{x: number, y: number, width: number, height: number}>} Array of normalized boxes (0-1 range)
87
+ */
88
+ export declare function quadPointsToBoxesForAnnotation(quadPoints: number[], viewport: PageViewport): Array<{
89
+ x: number;
90
+ y: number;
91
+ width: number;
92
+ height: number;
93
+ }>;
94
+ /**
95
+ * Calculate the bounding rectangle from quadPoints
96
+ * @param {number[]} quadPoints - Array of quadPoints coordinates
97
+ * @returns {number[]} Bounding rectangle [x1, y1, x2, y2] in PDF coordinates
98
+ */
99
+ export declare function quadPointsToRect(quadPoints: number[]): number[];
100
+ export {};
@@ -0,0 +1,111 @@
1
+ /**
2
+ * AnnotationImageManager - Based on PDF.js ImageManager
3
+ *
4
+ * Manages images used by annotation editors with memory optimization.
5
+ * Features:
6
+ * - Caching with reference counting
7
+ * - Memory management (converts to blob when not in use)
8
+ * - Multiple image sources: File, URL, Blob, Canvas
9
+ * - SVG support with aspect ratio preservation
10
+ * - Unique ID generation and validation
11
+ */
12
+ export interface ImageData {
13
+ bitmap: ImageBitmap | HTMLImageElement;
14
+ id: string;
15
+ refCounter: number;
16
+ isSvg: boolean;
17
+ url?: string;
18
+ file?: File;
19
+ blobPromise?: Promise<Blob>;
20
+ svgUrl?: string;
21
+ }
22
+ export interface ImageManagerOptions {
23
+ baseId?: string;
24
+ }
25
+ /**
26
+ * Utility function to generate unique IDs
27
+ */
28
+ declare function generateUuid(): string;
29
+ /**
30
+ * Utility function to fetch data from URL
31
+ */
32
+ declare function fetchImageData(url: string): Promise<Blob>;
33
+ declare function validateFileSize(file: File, maxSize?: number): boolean;
34
+ declare function validateFileMimeType(file: File, mimeTypes?: string[]): boolean;
35
+ declare function isSVGFittingCanvas(): Promise<boolean>;
36
+ export declare class AnnotationImageManager {
37
+ private readonly baseId;
38
+ private idCounter;
39
+ private cache;
40
+ constructor(options?: ImageManagerOptions);
41
+ /**
42
+ * Get image data from cache or create new entry
43
+ */
44
+ private get;
45
+ /**
46
+ * Handle SVG image loading with aspect ratio preservation
47
+ */
48
+ private handleSvgImage;
49
+ /**
50
+ * Get image from File object
51
+ */
52
+ getFromFile(file: File): Promise<ImageData | null>;
53
+ /**
54
+ * Get image from URL
55
+ */
56
+ getFromUrl(url: string): Promise<ImageData | null>;
57
+ /**
58
+ * Get image from Blob with custom ID
59
+ */
60
+ getFromBlob(id: string, blobPromise: Promise<Blob>): Promise<ImageData | null>;
61
+ /**
62
+ * Get image by ID (restore from cache)
63
+ */
64
+ getFromId(id: string): Promise<ImageData | null>;
65
+ /**
66
+ * Get image from Canvas element
67
+ */
68
+ getFromCanvas(id: string, canvas: HTMLCanvasElement): ImageData;
69
+ /**
70
+ * Get SVG URL by ID
71
+ */
72
+ getSvgUrl(id: string): string | null;
73
+ /**
74
+ * Delete image by ID (decrement reference counter)
75
+ */
76
+ deleteId(id: string): void;
77
+ /**
78
+ * Check if ID belongs to this manager
79
+ */
80
+ isValidId(id: string): boolean;
81
+ /**
82
+ * Get all cached image IDs
83
+ */
84
+ getCachedIds(): string[];
85
+ /**
86
+ * Get cache statistics
87
+ */
88
+ getCacheStats(): {
89
+ totalImages: number;
90
+ loadedImages: number;
91
+ totalMemory: number;
92
+ };
93
+ /**
94
+ * Clear all cached images
95
+ */
96
+ clear(): void;
97
+ /**
98
+ * Convert ImageBitmap to data URL (for export/clipboard)
99
+ */
100
+ bitmapToDataUrl(imageData: ImageData): Promise<string>;
101
+ /**
102
+ * Create ImageBitmap from existing ImageData for serialization
103
+ */
104
+ serializeBitmap(imageData: ImageData, options?: {
105
+ width?: number;
106
+ height?: number;
107
+ preserveAspectRatio?: boolean;
108
+ }): Promise<ImageBitmap>;
109
+ }
110
+ export declare const annotationImageManager: AnnotationImageManager;
111
+ export { generateUuid, fetchImageData, isSVGFittingCanvas, validateFileSize, validateFileMimeType };
@@ -0,0 +1,35 @@
1
+ import { PDFDocumentProxy } from 'pdfjs-dist';
2
+ export declare function updatePdfAnnotations(pdfDocument: PDFDocumentProxy): Promise<void>;
3
+ /**
4
+ * Calculate the proper rect for highlight annotation serialization
5
+ *
6
+ * This method replicates the getRect logic from PDF.js AnnotationEditor to ensure
7
+ * that outlines are properly serialized when saving documents. The issue was that
8
+ * the original rect was not being calculated in the same coordinate system that
9
+ * PDF.js uses for outline serialization.
10
+ *
11
+ * In PDF.js, the HighlightEditor.serialize() method calls:
12
+ * 1. const rect = this.getRect(0, 0) - to get the rect in page coordinates
13
+ * 2. outlines: this.#serializeOutlines(rect) - to serialize outlines using that rect
14
+ *
15
+ * The #serializeOutlines method then calls:
16
+ * return this.#highlightOutlines.serialize(rect, this.#getRotation())
17
+ *
18
+ * This ensures that the outlines are properly transformed from normalized coordinates
19
+ * (0-1 range) to actual page coordinates, taking into account page translation and rotation.
20
+ *
21
+ * Since we use dontFlip: true in getViewport, the coordinates are already in PDF
22
+ * coordinate system (Y=0 at bottom), so we don't need to flip Y coordinates again.
23
+ *
24
+ * @param {number[]} quadPoints - The quad points of the annotation in page coordinates
25
+ * @param {Object} pageDimensions - Page dimensions and translation from viewport.rawDims
26
+ * @param {number} rotation - Page rotation in degrees (0, 90, 180, 270)
27
+ * @param {boolean} isDontFlip - Whether the viewport was created with dontFlip: true (default: true)
28
+ * @returns {number[]} The calculated rect [x1, y1, x2, y2] in page coordinates
29
+ */
30
+ export declare const getAnnotationRect: (quadPoints: number[], pageDimensions: {
31
+ width: number;
32
+ height: number;
33
+ pageX: number;
34
+ pageY: number;
35
+ }, rotation?: number, isDontFlip?: boolean) => number[];
@@ -0,0 +1,24 @@
1
+ export declare class Console {
2
+ private static instance;
3
+ private isProduction;
4
+ private constructor();
5
+ static getInstance(): Console;
6
+ /**
7
+ * Debug level logging - stripped in production
8
+ */
9
+ debug(...args: any[]): void;
10
+ /**
11
+ * Info level logging
12
+ */
13
+ info(...args: any[]): void;
14
+ /**
15
+ * Warning level logging
16
+ */
17
+ warn(...args: any[]): void;
18
+ /**
19
+ * Error level logging
20
+ */
21
+ error(...args: any[]): void;
22
+ }
23
+ declare const _default: Console;
24
+ export default _default;
@@ -0,0 +1,16 @@
1
+ declare enum CharacterType {
2
+ SPACE = 0,
3
+ ALPHA_LETTER = 1,
4
+ PUNCTUATION = 2,
5
+ HAN_LETTER = 3,
6
+ KATAKANA_LETTER = 4,
7
+ HIRAGANA_LETTER = 5,
8
+ HALF_WIDTH_KATAKANA_LETTER = 6,
9
+ THAI_LETTER = 7
10
+ }
11
+ /**
12
+ * This function is based on the word-break detection implemented in:
13
+ * https://hg.mozilla.org/mozilla-central/file/tip/intl/lwbrk/WordBreaker.cpp
14
+ */
15
+ declare function getCharacterType(charCode: number): CharacterType;
16
+ export { CharacterType, getCharacterType };
@@ -0,0 +1,4 @@
1
+ export declare const makeHexColor: (r: number, g: number, b: number) => string;
2
+ export declare const uint8ClampedArrayToRgb: (color: Uint8ClampedArray | number[]) => number[];
3
+ export declare function rgbToUint8ClampedArray(hexColor: string): number[];
4
+ export declare function hexToUint8ClampedArray(hexColor: string): Uint8ClampedArray;
@@ -0,0 +1 @@
1
+ export declare const convertPDFDate: (input: string) => Date | null;
@@ -0,0 +1,81 @@
1
+ export declare enum LicenseType {
2
+ All = "all",
3
+ Premium = "premium",
4
+ Freemium = "freemium",
5
+ Unlicense = "none",
6
+ Organization = "organization",
7
+ Developer = "developer",
8
+ FreeTrial = "free-trial"
9
+ }
10
+ export declare enum ScrollMode {
11
+ Vertical = "Vertical",
12
+ Horizontal = "Horizontal",
13
+ Page = "Page",
14
+ Wrapped = "Wrapped"
15
+ }
16
+ export declare enum ViewMode {
17
+ SinglePage = "Single",
18
+ DualPage = "Dual"
19
+ }
20
+ export declare enum ZoomLevel {
21
+ ActualSize = "actualSize",
22
+ PageFit = "pageFit",
23
+ PageWidth = "pageWidth"
24
+ }
25
+ export declare enum ScrollDirection {
26
+ Horizontal = "Horizontal",
27
+ Vertical = "Vertical",
28
+ Both = "Both"
29
+ }
30
+ export declare enum VPVAnnotationType {
31
+ INTERNAL_LINK = "internal-link",
32
+ LINK = "link",
33
+ FILE_ATTACHMENT = "file-attachment",
34
+ FORM_TEXT = "form-text",
35
+ FORM_SELECT = "form-select",
36
+ FORM_CHECKBOX = "form-checkbox",
37
+ FORM_RADIO = "form-radio",
38
+ FORM_BUTTON = "form-button",
39
+ BUTTON = "button",
40
+ NAVIGATION = "navigation"
41
+ }
42
+ export declare enum LayerRenderStatus {
43
+ PreRender = 0,
44
+ DidRender = 1
45
+ }
46
+ export declare enum AnnotationType {
47
+ Text = 1,
48
+ Link = 2,
49
+ FreeText = 3,
50
+ Line = 4,
51
+ Square = 5,
52
+ Circle = 6,
53
+ Polygon = 7,
54
+ Polyline = 8,
55
+ Highlight = 9,
56
+ Underline = 10,
57
+ Squiggly = 11,
58
+ StrikeOut = 12,
59
+ Stamp = 13,
60
+ Caret = 14,
61
+ Ink = 15,
62
+ Popup = 16,
63
+ FileAttachment = 17,
64
+ Widget = 20
65
+ }
66
+ export declare enum AnnotationFlag {
67
+ INVISIBLE = 1,
68
+ HIDDEN = 2,
69
+ PRINT = 4,
70
+ NOZOOM = 8,
71
+ NOROTATE = 16,
72
+ NOVIEW = 32,
73
+ READONLY = 64,
74
+ LOCKED = 128,
75
+ TOGGLENOVIEW = 256,
76
+ LOCKEDCONTENTS = 512
77
+ }
78
+ export declare enum LicenseProduct {
79
+ Viewer = "viewer",
80
+ ViewerAndAnnotation = "viewer_and_annotation"
81
+ }
@@ -0,0 +1,8 @@
1
+ import type { TextContent } from 'pdfjs-dist/types/src/display/text_layer';
2
+ import type { HighlightOptions, Match } from './types';
3
+ declare function isMatchEntireWord(content: string, startIdx: number, length: number): boolean;
4
+ declare function highlightMatches(matches: Match[], textContent: TextContent, textDivs: HTMLElement[]): void;
5
+ declare function resetDivs(textContent: TextContent, textDivs: HTMLElement[]): void;
6
+ declare function findMatches(queries: (string | RegExp)[], textContent: TextContent, pageIndex: number, options: HighlightOptions): Match[];
7
+ declare function getHighlightOptionsWithDefaults(options?: HighlightOptions): HighlightOptions;
8
+ export { findMatches, highlightMatches, resetDivs, getHighlightOptionsWithDefaults, isMatchEntireWord };
@@ -0,0 +1,55 @@
1
+ interface Command extends CommandHistory {
2
+ mustExec: boolean;
3
+ overwriteIfSameType?: boolean;
4
+ keepUndo?: boolean;
5
+ }
6
+ interface CommandHistory {
7
+ cmd: Function;
8
+ undo: Function;
9
+ post: Function;
10
+ type: number;
11
+ }
12
+ export declare class HistoryManager {
13
+ commandHistory: CommandHistory[] | null;
14
+ locked: boolean;
15
+ maxSize: number;
16
+ position: number;
17
+ constructor(maxSize?: number);
18
+ /**
19
+ * @typedef {Object} addOptions
20
+ * @property {function} cmd
21
+ * @property {function} undo
22
+ * @property {function} [post]
23
+ * @property {boolean} mustExec
24
+ * @property {number} type
25
+ * @property {boolean} overwriteIfSameType
26
+ * @property {boolean} keepUndo
27
+ */
28
+ /**
29
+ * Add a new couple of commands to be used in case of redo/undo.
30
+ * @param {addOptions} options
31
+ */
32
+ add({ cmd, undo, post, mustExec, type, overwriteIfSameType, keepUndo }: Command): void;
33
+ /**
34
+ * Undo the last command.
35
+ */
36
+ undo(): void;
37
+ /**
38
+ * Redo the last command.
39
+ */
40
+ redo(): void;
41
+ /**
42
+ * Check if there is something to undo.
43
+ * @returns {boolean}
44
+ */
45
+ hasSomethingToUndo(): boolean;
46
+ /**
47
+ * Check if there is something to redo.
48
+ * @returns {boolean}
49
+ */
50
+ hasSomethingToRedo(): boolean;
51
+ cleanType(type: number): void;
52
+ destroy(): void;
53
+ reset(): void;
54
+ }
55
+ export {};
@@ -0,0 +1,7 @@
1
+ type Resolve = (value: unknown) => void;
2
+ export declare function promiseWithResolvers<T = void>(): {
3
+ promise: Promise<T>;
4
+ resolve: Resolve;
5
+ reject: (reason?: any) => void;
6
+ };
7
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { CSSProperties } from 'vue';
2
+ import type { FlagKeyword, HighlightArea, HighlightMatchPosition, NormalizedKeyword, SingleKeyword } from './types';
3
+ export declare const normalizeFlagKeyword: (flagKeyword: FlagKeyword) => NormalizedKeyword;
4
+ export declare const normalizeSingleKeyword: (keyword: SingleKeyword, matchCase?: boolean, wholeWords?: boolean) => NormalizedKeyword;
5
+ export declare const sortHighlightPosition: (a: HighlightArea, b: HighlightArea) => 0 | 1 | -1;
6
+ export declare const getHighlightStyle: (area: HighlightArea) => CSSProperties;
7
+ export declare const unwrap: (ele: Node) => void;
8
+ export declare const getHighlightElement: (layerRef: HTMLElement, query: HighlightMatchPosition, selector?: string) => HTMLElement;
9
+ export declare const getHighlightElements: (layerRef: HTMLElement, querySelector: string) => Promise<NodeListOf<Element>>;
10
+ export declare function scrollHighlightIntoView(highlightEle: HTMLElement, pageContainer: HTMLElement, viewerContainer: HTMLElement): void;
@@ -0,0 +1,2 @@
1
+ import { ScrollDirection, Offset } from '..';
2
+ export declare const smoothScroll: (ele: HTMLElement, scrollDirection: ScrollDirection, targetPosition: Offset, duration: number, easing?: (t: number) => number, onReachTarget?: () => void) => void;